From 655c5d70935ab98b01fa778a7ce26ffd7f313d7f Mon Sep 17 00:00:00 2001 From: vspader Date: Thu, 2 Jun 2005 18:16:43 +0000 Subject: [PATCH] Initial revision --- .DS_Store | Bin 0 -> 12292 bytes AppController.h | 27 + AppController.m | 142 + COPYING | 340 + Changelog | 3 + Cog.scriptSuite | 114 + Cog.scriptTerminology | 100 + Cog.xcode/project.pbxproj | 1709 ++ Cog.xcode/xugg.mode1 | 1382 + Cog.xcode/xugg.pbxuser | 2574 ++ Cog_Prefix.pch | 7 + Credits.html | 4 + DBLog.c | 24 + DBLog.h | 21 + English.lproj/InfoPlist.strings | Bin 0 -> 240 bytes English.lproj/MainMenu.nib/classes.nib | 91 + English.lproj/MainMenu.nib/info.nib | 22 + English.lproj/MainMenu.nib/keyedobjects.nib | Bin 0 -> 39818 bytes English.lproj/MainMenu~.nib/classes.nib | 91 + English.lproj/MainMenu~.nib/info.nib | 22 + English.lproj/MainMenu~.nib/keyedobjects.nib | Bin 0 -> 39818 bytes Feedback/FeedbackController.h | 26 + Feedback/FeedbackController.m | 74 + Feedback/FeedbackSocket.h | 27 + Feedback/FeedbackSocket.m | 131 + Icons/add_blue.png | Bin 0 -> 4837 bytes Icons/add_gray.png | Bin 0 -> 4851 bytes Icons/bground.png | Bin 0 -> 1896 bytes Icons/info_blue.png | Bin 0 -> 4847 bytes Icons/info_gray.png | Bin 0 -> 4837 bytes Icons/next_blue.png | Bin 0 -> 5595 bytes Icons/next_gray.png | Bin 0 -> 5634 bytes Icons/pause_blue.png | Bin 0 -> 5337 bytes Icons/pause_gray.png | Bin 0 -> 5348 bytes Icons/play_blue.png | Bin 0 -> 5552 bytes Icons/play_gray.png | Bin 0 -> 5618 bytes Icons/prev_blue.png | Bin 0 -> 5609 bytes Icons/prev_gray.png | Bin 0 -> 5641 bytes Icons/remove_blue.png | Bin 0 -> 4750 bytes Icons/remove_gray.png | Bin 0 -> 4716 bytes Icons/repeat_blue.png | Bin 0 -> 5181 bytes Icons/repeat_gray.png | Bin 0 -> 5151 bytes Icons/shuffle_blue.png | Bin 0 -> 4876 bytes Icons/shuffle_gray.png | Bin 0 -> 4843 bytes Icons/stop_blue.png | Bin 0 -> 5282 bytes Icons/stop_gray.png | Bin 0 -> 5302 bytes Icons/wheel.icns | Bin 0 -> 41626 bytes Info.plist | 90 + Libraries/.DS_Store | Bin 0 -> 6148 bytes Libraries/DecMPA/DecMPA.xcode/project.pbxproj | 927 + Libraries/DecMPA/DecMPA.xcode/xugg.mode1 | 1240 + Libraries/DecMPA/DecMPA.xcode/xugg.pbxuser | 122 + .../DecMPA/English.lproj/InfoPlist.strings | Bin 0 -> 142 bytes Libraries/DecMPA/Files/ChangeLog.txt | 125 + Libraries/DecMPA/Files/License.txt | 459 + Libraries/DecMPA/Files/Readme.txt | 131 + Libraries/DecMPA/Files/Todo.txt | 3 + Libraries/DecMPA/Files/include/decmpa.h | 556 + Libraries/DecMPA/Files/src/DecMPA.cpp | 262 + .../DecMPA/Files/src/DecMPAFileAccess.cpp | 326 + Libraries/DecMPA/Files/src/DecMPAFileAccess.h | 75 + Libraries/DecMPA/Files/src/DecodeEngine.h | 36 + Libraries/DecMPA/Files/src/DefInc.h | 25 + Libraries/DecMPA/Files/src/IFileAccess.h | 40 + Libraries/DecMPA/Files/src/MPADecoder.cpp | 638 + Libraries/DecMPA/Files/src/MPADecoder.h | 143 + Libraries/DecMPA/Files/src/MPAFrameFinder.cpp | 550 + Libraries/DecMPA/Files/src/MPAFrameFinder.h | 201 + Libraries/DecMPA/Files/src/MPAInfo.cpp | 200 + Libraries/DecMPA/Files/src/MPAInfo.h | 81 + Libraries/DecMPA/Files/src/MemBuffer.h | 157 + .../DecMPA/Files/src/frame/audioFrame.cpp | 119 + Libraries/DecMPA/Files/src/frame/audioFrame.h | 85 + .../DecMPA/Files/src/frame/floatFrame.cpp | 71 + Libraries/DecMPA/Files/src/frame/floatFrame.h | 49 + Libraries/DecMPA/Files/src/frame/frame.cpp | 73 + Libraries/DecMPA/Files/src/frame/frame.h | 103 + Libraries/DecMPA/Files/src/frame/pcmFrame.cpp | 143 + Libraries/DecMPA/Files/src/frame/pcmFrame.h | 50 + .../DecMPA/Files/src/frame/rawDataBuffer.cpp | 21 + .../DecMPA/Files/src/frame/rawDataBuffer.h | 48 + .../DecMPA/Files/src/hip/DecodeEngine_Hip.cpp | 135 + Libraries/DecMPA/Files/src/hip/HIPDefines.h | 10 + Libraries/DecMPA/Files/src/hip/VbrTag.c | 176 + Libraries/DecMPA/Files/src/hip/VbrTag.h | 82 + Libraries/DecMPA/Files/src/hip/common.c | 320 + Libraries/DecMPA/Files/src/hip/common.h | 54 + Libraries/DecMPA/Files/src/hip/dct64_i386.c | 348 + Libraries/DecMPA/Files/src/hip/dct64_i386.h | 36 + Libraries/DecMPA/Files/src/hip/decode_i386.c | 202 + Libraries/DecMPA/Files/src/hip/decode_i386.h | 36 + Libraries/DecMPA/Files/src/hip/huffman.h | 354 + Libraries/DecMPA/Files/src/hip/interface.c | 666 + Libraries/DecMPA/Files/src/hip/interface.h | 47 + Libraries/DecMPA/Files/src/hip/l2tables.h | 177 + Libraries/DecMPA/Files/src/hip/layer1.c | 194 + Libraries/DecMPA/Files/src/hip/layer1.h | 33 + Libraries/DecMPA/Files/src/hip/layer2.c | 333 + Libraries/DecMPA/Files/src/hip/layer2.h | 49 + Libraries/DecMPA/Files/src/hip/layer3.c | 1827 ++ Libraries/DecMPA/Files/src/hip/layer3.h | 35 + Libraries/DecMPA/Files/src/hip/mpg123.h | 157 + Libraries/DecMPA/Files/src/hip/mpglib.h | 90 + Libraries/DecMPA/Files/src/hip/tabinit.c | 143 + Libraries/DecMPA/Files/src/hip/tabinit.h | 38 + .../Files/src/mpegAudioFrame/dxHead.cpp | 138 + .../DecMPA/Files/src/mpegAudioFrame/dxHead.h | 66 + .../src/mpegAudioFrame/mpegAudioHeader.cpp | 281 + .../src/mpegAudioFrame/mpegAudioHeader.h | 113 + .../Files/src/splay/DecodeEngine_SPlay.cpp | 49 + Libraries/DecMPA/Files/src/splay/attribute.h | 33 + Libraries/DecMPA/Files/src/splay/common.h | 73 + Libraries/DecMPA/Files/src/splay/dct.h | 33 + Libraries/DecMPA/Files/src/splay/dct36_12.cpp | 290 + Libraries/DecMPA/Files/src/splay/dct64.cpp | 205 + .../DecMPA/Files/src/splay/dct64_down.cpp | 215 + .../DecMPA/Files/src/splay/huffmanlookup.cpp | 124 + .../DecMPA/Files/src/splay/huffmanlookup.h | 57 + .../DecMPA/Files/src/splay/huffmantable.cpp | 584 + .../DecMPA/Files/src/splay/mpeg2tables.h | 441 + .../Files/src/splay/mpegAudioBitWindow.cpp | 44 + .../Files/src/splay/mpegAudioBitWindow.h | 144 + .../Files/src/splay/mpegAudioStream.cpp | 42 + .../DecMPA/Files/src/splay/mpegAudioStream.h | 146 + .../DecMPA/Files/src/splay/mpeglayer1.cpp | 118 + .../DecMPA/Files/src/splay/mpeglayer2.cpp | 449 + .../DecMPA/Files/src/splay/mpeglayer3.cpp | 1798 ++ Libraries/DecMPA/Files/src/splay/mpegsound.h | 252 + .../DecMPA/Files/src/splay/mpegtable.cpp | 43 + .../DecMPA/Files/src/splay/mpegtoraw.cpp | 137 + Libraries/DecMPA/Files/src/splay/op.h | 96 + .../DecMPA/Files/src/splay/splayDecoder.cpp | 85 + .../DecMPA/Files/src/splay/splayDecoder.h | 75 + .../DecMPA/Files/src/splay/synth_Down.cpp | 231 + .../DecMPA/Files/src/splay/synth_Std.cpp | 329 + .../DecMPA/Files/src/splay/synth_filter.cpp | 159 + .../DecMPA/Files/src/splay/synthesis.cpp | 73 + Libraries/DecMPA/Files/src/splay/synthesis.h | 92 + Libraries/DecMPA/Files/src/splay/window.cpp | 78 + Libraries/DecMPA/Files/src/splay/window.h | 10 + Libraries/DecMPA/Info.plist | 26 + .../FAAD2/English.lproj/InfoPlist.strings | Bin 0 -> 140 bytes Libraries/FAAD2/FAAD2.xcode/project.pbxproj | 1991 ++ Libraries/FAAD2/FAAD2.xcode/xugg.mode1 | 1223 + Libraries/FAAD2/FAAD2.xcode/xugg.pbxuser | 98 + Libraries/FAAD2/FAAD2_Prefix.pch | 5 + Libraries/FAAD2/Files/AUTHORS | 17 + Libraries/FAAD2/Files/COPYING | 350 + Libraries/FAAD2/Files/ChangeLog | 126 + Libraries/FAAD2/Files/NEWS | 7 + Libraries/FAAD2/Files/README | 122 + Libraries/FAAD2/Files/README.linux | 16 + Libraries/FAAD2/Files/TODO | 2 + Libraries/FAAD2/Files/config.h | 113 + Libraries/FAAD2/Files/include/faad.h | 32 + Libraries/FAAD2/Files/include/neaacdec.h | 252 + Libraries/FAAD2/Files/libfaad/Makefile.am | 26 + Libraries/FAAD2/Files/libfaad/analysis.h | 49 + Libraries/FAAD2/Files/libfaad/bits.c | 213 + Libraries/FAAD2/Files/libfaad/bits.h | 382 + Libraries/FAAD2/Files/libfaad/cfft.c | 1002 + Libraries/FAAD2/Files/libfaad/cfft.h | 53 + Libraries/FAAD2/Files/libfaad/cfft_tab.h | 1820 ++ Libraries/FAAD2/Files/libfaad/codebook/hcb.h | 142 + .../FAAD2/Files/libfaad/codebook/hcb_1.h | 183 + .../FAAD2/Files/libfaad/codebook/hcb_10.h | 309 + .../FAAD2/Files/libfaad/codebook/hcb_11.h | 412 + .../FAAD2/Files/libfaad/codebook/hcb_2.h | 182 + .../FAAD2/Files/libfaad/codebook/hcb_3.h | 193 + .../FAAD2/Files/libfaad/codebook/hcb_4.h | 196 + .../FAAD2/Files/libfaad/codebook/hcb_5.h | 193 + .../FAAD2/Files/libfaad/codebook/hcb_6.h | 179 + .../FAAD2/Files/libfaad/codebook/hcb_7.h | 159 + .../FAAD2/Files/libfaad/codebook/hcb_8.h | 170 + .../FAAD2/Files/libfaad/codebook/hcb_9.h | 369 + .../FAAD2/Files/libfaad/codebook/hcb_sf.h | 273 + Libraries/FAAD2/Files/libfaad/common.c | 519 + Libraries/FAAD2/Files/libfaad/common.h | 425 + Libraries/FAAD2/Files/libfaad/decoder.c | 1024 + Libraries/FAAD2/Files/libfaad/decoder.h | 121 + Libraries/FAAD2/Files/libfaad/drc.c | 170 + Libraries/FAAD2/Files/libfaad/drc.h | 46 + Libraries/FAAD2/Files/libfaad/drm_dec.c | 990 + Libraries/FAAD2/Files/libfaad/drm_dec.h | 97 + Libraries/FAAD2/Files/libfaad/error.c | 61 + Libraries/FAAD2/Files/libfaad/error.h | 41 + Libraries/FAAD2/Files/libfaad/filtbank.c | 404 + Libraries/FAAD2/Files/libfaad/filtbank.h | 58 + Libraries/FAAD2/Files/libfaad/fixed.h | 265 + Libraries/FAAD2/Files/libfaad/hcr.c | 409 + Libraries/FAAD2/Files/libfaad/huffman.c | 556 + Libraries/FAAD2/Files/libfaad/huffman.h | 44 + Libraries/FAAD2/Files/libfaad/ic_predict.c | 267 + Libraries/FAAD2/Files/libfaad/ic_predict.h | 249 + Libraries/FAAD2/Files/libfaad/iq_table.h | 16455 ++++++++++++ Libraries/FAAD2/Files/libfaad/is.c | 106 + Libraries/FAAD2/Files/libfaad/is.h | 64 + Libraries/FAAD2/Files/libfaad/kbd_win.h | 2294 ++ Libraries/FAAD2/Files/libfaad/libfaad.dsp | 484 + Libraries/FAAD2/Files/libfaad/libfaad.dsw | 29 + Libraries/FAAD2/Files/libfaad/libfaad.sln | 24 + Libraries/FAAD2/Files/libfaad/libfaad.vcproj | 1015 + Libraries/FAAD2/Files/libfaad/libfaad2.def | 14 + Libraries/FAAD2/Files/libfaad/libfaad2.vcp | 2091 ++ Libraries/FAAD2/Files/libfaad/libfaad2.vcw | 29 + .../FAAD2/Files/libfaad/libfaad2_dll.dsp | 355 + .../FAAD2/Files/libfaad/libfaad2_dll.dsw | 29 + .../FAAD2/Files/libfaad/libfaad2_dll.sln | 21 + .../FAAD2/Files/libfaad/libfaad2_dll.vcproj | 307 + Libraries/FAAD2/Files/libfaad/lt_predict.c | 215 + Libraries/FAAD2/Files/libfaad/lt_predict.h | 63 + Libraries/FAAD2/Files/libfaad/mdct.c | 298 + Libraries/FAAD2/Files/libfaad/mdct.h | 45 + Libraries/FAAD2/Files/libfaad/mdct_tab.h | 3652 +++ Libraries/FAAD2/Files/libfaad/mp4.c | 299 + Libraries/FAAD2/Files/libfaad/mp4.h | 49 + Libraries/FAAD2/Files/libfaad/ms.c | 74 + Libraries/FAAD2/Files/libfaad/ms.h | 41 + Libraries/FAAD2/Files/libfaad/output.c | 557 + Libraries/FAAD2/Files/libfaad/output.h | 45 + Libraries/FAAD2/Files/libfaad/pns.c | 265 + Libraries/FAAD2/Files/libfaad/pns.h | 53 + Libraries/FAAD2/Files/libfaad/ps_dec.c | 1985 ++ Libraries/FAAD2/Files/libfaad/ps_dec.h | 148 + Libraries/FAAD2/Files/libfaad/ps_syntax.c | 545 + Libraries/FAAD2/Files/libfaad/ps_tables.h | 547 + Libraries/FAAD2/Files/libfaad/pulse.c | 56 + Libraries/FAAD2/Files/libfaad/pulse.h | 40 + Libraries/FAAD2/Files/libfaad/rvlc.c | 530 + Libraries/FAAD2/Files/libfaad/rvlc.h | 53 + Libraries/FAAD2/Files/libfaad/sbr_dct.c | 2271 ++ Libraries/FAAD2/Files/libfaad/sbr_dct.h | 49 + Libraries/FAAD2/Files/libfaad/sbr_dec.c | 614 + Libraries/FAAD2/Files/libfaad/sbr_dec.h | 249 + Libraries/FAAD2/Files/libfaad/sbr_e_nf.c | 507 + Libraries/FAAD2/Files/libfaad/sbr_e_nf.h | 47 + Libraries/FAAD2/Files/libfaad/sbr_fbt.c | 761 + Libraries/FAAD2/Files/libfaad/sbr_fbt.h | 52 + Libraries/FAAD2/Files/libfaad/sbr_hfadj.c | 1720 ++ Libraries/FAAD2/Files/libfaad/sbr_hfadj.h | 54 + Libraries/FAAD2/Files/libfaad/sbr_hfgen.c | 666 + Libraries/FAAD2/Files/libfaad/sbr_hfgen.h | 46 + Libraries/FAAD2/Files/libfaad/sbr_huff.c | 357 + Libraries/FAAD2/Files/libfaad/sbr_huff.h | 43 + Libraries/FAAD2/Files/libfaad/sbr_noise.h | 561 + Libraries/FAAD2/Files/libfaad/sbr_qmf.c | 633 + Libraries/FAAD2/Files/libfaad/sbr_qmf.h | 52 + Libraries/FAAD2/Files/libfaad/sbr_qmf_c.h | 365 + Libraries/FAAD2/Files/libfaad/sbr_syntax.c | 871 + Libraries/FAAD2/Files/libfaad/sbr_syntax.h | 64 + Libraries/FAAD2/Files/libfaad/sbr_tf_grid.c | 258 + Libraries/FAAD2/Files/libfaad/sbr_tf_grid.h | 44 + Libraries/FAAD2/Files/libfaad/sine_win.h | 4301 ++++ Libraries/FAAD2/Files/libfaad/specrec.c | 1272 + Libraries/FAAD2/Files/libfaad/specrec.h | 46 + Libraries/FAAD2/Files/libfaad/ssr.c | 172 + Libraries/FAAD2/Files/libfaad/ssr.h | 56 + Libraries/FAAD2/Files/libfaad/ssr_fb.c | 182 + Libraries/FAAD2/Files/libfaad/ssr_fb.h | 44 + Libraries/FAAD2/Files/libfaad/ssr_ipqf.c | 188 + Libraries/FAAD2/Files/libfaad/ssr_ipqf.h | 37 + Libraries/FAAD2/Files/libfaad/ssr_win.h | 626 + Libraries/FAAD2/Files/libfaad/structs.h | 473 + Libraries/FAAD2/Files/libfaad/syntax.c | 2330 ++ Libraries/FAAD2/Files/libfaad/syntax.h | 124 + Libraries/FAAD2/Files/libfaad/tns.c | 306 + Libraries/FAAD2/Files/libfaad/tns.h | 48 + Libraries/FAAD2/Info.plist | 26 + .../FLAC/English.lproj/InfoPlist.strings | Bin 0 -> 138 bytes Libraries/FLAC/FLAC.xcode/project.pbxproj | 1080 + Libraries/FLAC/FLAC.xcode/xugg.mode1 | 1303 + Libraries/FLAC/FLAC.xcode/xugg.pbxuser | 1094 + Libraries/FLAC/Files/AUTHORS | 41 + Libraries/FLAC/Files/COPYING.FDL | 355 + Libraries/FLAC/Files/COPYING.GPL | 340 + Libraries/FLAC/Files/COPYING.LGPL | 481 + Libraries/FLAC/Files/COPYING.Xiph | 28 + Libraries/FLAC/Files/include/FLAC/Makefile.am | 46 + Libraries/FLAC/Files/include/FLAC/Makefile.in | 487 + Libraries/FLAC/Files/include/FLAC/all.h | 158 + Libraries/FLAC/Files/include/FLAC/assert.h | 45 + Libraries/FLAC/Files/include/FLAC/callback.h | 181 + Libraries/FLAC/Files/include/FLAC/export.h | 47 + .../FLAC/Files/include/FLAC/file_decoder.h | 660 + .../FLAC/Files/include/FLAC/file_encoder.h | 871 + Libraries/FLAC/Files/include/FLAC/format.h | 861 + Libraries/FLAC/Files/include/FLAC/metadata.h | 1858 ++ Libraries/FLAC/Files/include/FLAC/ordinals.h | 73 + .../include/FLAC/seekable_stream_decoder.h | 931 + .../include/FLAC/seekable_stream_encoder.h | 992 + .../FLAC/Files/include/FLAC/stream_decoder.h | 873 + .../FLAC/Files/include/FLAC/stream_encoder.h | 1064 + .../FLAC/Files/include/OggFLAC/Makefile.am | 44 + .../FLAC/Files/include/OggFLAC/Makefile.in | 485 + Libraries/FLAC/Files/include/OggFLAC/all.h | 55 + Libraries/FLAC/Files/include/OggFLAC/export.h | 47 + .../FLAC/Files/include/OggFLAC/file_decoder.h | 621 + .../FLAC/Files/include/OggFLAC/file_encoder.h | 874 + .../include/OggFLAC/seekable_stream_decoder.h | 855 + .../include/OggFLAC/seekable_stream_encoder.h | 936 + .../Files/include/OggFLAC/stream_decoder.h | 622 + .../Files/include/OggFLAC/stream_encoder.h | 828 + .../FLAC/Files/include/share/Makefile.am | 12 + .../FLAC/Files/include/share/Makefile.in | 521 + Libraries/FLAC/Files/include/share/getopt.h | 184 + Libraries/FLAC/Files/include/share/grabbag.h | 28 + .../Files/include/share/grabbag/Makefile.am | 9 + .../Files/include/share/grabbag/Makefile.in | 376 + .../Files/include/share/grabbag/cuesheet.h | 42 + .../FLAC/Files/include/share/grabbag/file.h | 54 + .../Files/include/share/grabbag/replaygain.h | 64 + .../Files/include/share/grabbag/seektable.h | 38 + .../Files/include/share/replaygain_analysis.h | 57 + .../include/share/replaygain_synthesis.h | 51 + Libraries/FLAC/Files/include/share/utf8.h | 27 + Libraries/FLAC/Files/src/libFLAC/Makefile.am | 103 + Libraries/FLAC/Files/src/libFLAC/Makefile.in | 745 + .../FLAC/Files/src/libFLAC/Makefile.lite | 86 + Libraries/FLAC/Files/src/libFLAC/bitbuffer.c | 2690 ++ Libraries/FLAC/Files/src/libFLAC/bitmath.c | 145 + Libraries/FLAC/Files/src/libFLAC/cpu.c | 179 + Libraries/FLAC/Files/src/libFLAC/crc.c | 149 + .../FLAC/Files/src/libFLAC/file_decoder.c | 673 + .../FLAC/Files/src/libFLAC/file_encoder.c | 776 + Libraries/FLAC/Files/src/libFLAC/fixed.c | 422 + Libraries/FLAC/Files/src/libFLAC/float.c | 304 + Libraries/FLAC/Files/src/libFLAC/format.c | 474 + .../FLAC/Files/src/libFLAC/ia32/Makefile.am | 43 + .../FLAC/Files/src/libFLAC/ia32/Makefile.in | 494 + .../FLAC/Files/src/libFLAC/ia32/cpu_asm.nasm | 100 + .../Files/src/libFLAC/ia32/fixed_asm.nasm | 306 + .../FLAC/Files/src/libFLAC/ia32/lpc_asm.nasm | 1503 ++ Libraries/FLAC/Files/src/libFLAC/ia32/nasm.h | 75 + .../Files/src/libFLAC/include/Makefile.am | 31 + .../Files/src/libFLAC/include/Makefile.in | 543 + .../src/libFLAC/include/private/Makefile.am | 44 + .../src/libFLAC/include/private/Makefile.in | 463 + .../Files/src/libFLAC/include/private/all.h | 48 + .../src/libFLAC/include/private/bitbuffer.h | 159 + .../src/libFLAC/include/private/bitmath.h | 42 + .../Files/src/libFLAC/include/private/cpu.h | 94 + .../Files/src/libFLAC/include/private/crc.h | 57 + .../Files/src/libFLAC/include/private/fixed.h | 97 + .../Files/src/libFLAC/include/private/float.h | 97 + .../src/libFLAC/include/private/format.h | 44 + .../Files/src/libFLAC/include/private/lpc.h | 197 + .../Files/src/libFLAC/include/private/md5.h | 54 + .../src/libFLAC/include/private/memory.h | 56 + .../src/libFLAC/include/private/metadata.h | 40 + .../include/private/stream_encoder_framing.h | 45 + .../src/libFLAC/include/protected/Makefile.am | 38 + .../src/libFLAC/include/protected/Makefile.in | 457 + .../Files/src/libFLAC/include/protected/all.h | 42 + .../libFLAC/include/protected/file_decoder.h | 41 + .../libFLAC/include/protected/file_encoder.h | 41 + .../protected/seekable_stream_decoder.h | 42 + .../protected/seekable_stream_encoder.h | 42 + .../include/protected/stream_decoder.h | 51 + .../include/protected/stream_encoder.h | 60 + Libraries/FLAC/Files/src/libFLAC/libFLAC.m4 | 104 + .../Files/src/libFLAC/libFLAC_dynamic.dsp | 406 + .../FLAC/Files/src/libFLAC/libFLAC_static.dsp | 399 + Libraries/FLAC/Files/src/libFLAC/lpc.c | 430 + Libraries/FLAC/Files/src/libFLAC/md5.c | 315 + Libraries/FLAC/Files/src/libFLAC/memory.c | 188 + .../Files/src/libFLAC/metadata_iterators.c | 2964 +++ .../FLAC/Files/src/libFLAC/metadata_object.c | 1472 ++ .../FLAC/Files/src/libFLAC/ppc/Makefile.am | 31 + .../FLAC/Files/src/libFLAC/ppc/Makefile.in | 543 + .../FLAC/Files/src/libFLAC/ppc/as/Makefile.am | 52 + .../FLAC/Files/src/libFLAC/ppc/as/Makefile.in | 512 + .../FLAC/Files/src/libFLAC/ppc/as/lpc_asm.s | 429 + .../Files/src/libFLAC/ppc/gas/Makefile.am | 52 + .../Files/src/libFLAC/ppc/gas/Makefile.in | 512 + .../FLAC/Files/src/libFLAC/ppc/gas/lpc_asm.s | 431 + .../src/libFLAC/seekable_stream_decoder.c | 1111 + .../src/libFLAC/seekable_stream_encoder.c | 943 + .../FLAC/Files/src/libFLAC/stream_decoder.c | 2157 ++ .../FLAC/Files/src/libFLAC/stream_encoder.c | 3394 +++ .../src/libFLAC/stream_encoder_framing.c | 499 + .../FLAC/Files/src/libOggFLAC/Makefile.am | 63 + .../FLAC/Files/src/libOggFLAC/Makefile.in | 704 + .../FLAC/Files/src/libOggFLAC/Makefile.lite | 64 + .../FLAC/Files/src/libOggFLAC/file_decoder.c | 664 + .../FLAC/Files/src/libOggFLAC/file_encoder.c | 814 + .../Files/src/libOggFLAC/include/Makefile.am | 31 + .../Files/src/libOggFLAC/include/Makefile.in | 543 + .../libOggFLAC/include/private/Makefile.am | 36 + .../libOggFLAC/include/private/Makefile.in | 455 + .../src/libOggFLAC/include/private/all.h | 40 + .../include/private/ogg_decoder_aspect.h | 79 + .../include/private/ogg_encoder_aspect.h | 62 + .../libOggFLAC/include/private/ogg_helper.h | 43 + .../libOggFLAC/include/private/ogg_mapping.h | 63 + .../libOggFLAC/include/protected/Makefile.am | 38 + .../libOggFLAC/include/protected/Makefile.in | 457 + .../src/libOggFLAC/include/protected/all.h | 42 + .../include/protected/file_decoder.h | 41 + .../include/protected/file_encoder.h | 41 + .../protected/seekable_stream_decoder.h | 42 + .../protected/seekable_stream_encoder.h | 44 + .../include/protected/stream_decoder.h | 43 + .../include/protected/stream_encoder.h | 43 + .../FLAC/Files/src/libOggFLAC/libOggFLAC.m4 | 104 + .../src/libOggFLAC/libOggFLAC_dynamic.dsp | 227 + .../src/libOggFLAC/libOggFLAC_static.dsp | 220 + .../Files/src/libOggFLAC/ogg_decoder_aspect.c | 249 + .../Files/src/libOggFLAC/ogg_encoder_aspect.c | 218 + .../FLAC/Files/src/libOggFLAC/ogg_helper.c | 189 + .../FLAC/Files/src/libOggFLAC/ogg_mapping.c | 43 + .../src/libOggFLAC/seekable_stream_decoder.c | 978 + .../src/libOggFLAC/seekable_stream_encoder.c | 1063 + .../Files/src/libOggFLAC/stream_decoder.c | 564 + .../Files/src/libOggFLAC/stream_encoder.c | 713 + Libraries/FLAC/Files/src/share/Makefile.am | 22 + Libraries/FLAC/Files/src/share/Makefile.in | 534 + Libraries/FLAC/Files/src/share/Makefile.lite | 53 + Libraries/FLAC/Files/src/share/README | 5 + .../FLAC/Files/src/share/getopt/Makefile.am | 19 + .../FLAC/Files/src/share/getopt/Makefile.in | 497 + .../FLAC/Files/src/share/getopt/Makefile.lite | 16 + .../FLAC/Files/src/share/getopt/getopt.c | 1065 + .../FLAC/Files/src/share/getopt/getopt1.c | 204 + .../Files/src/share/getopt/getopt_static.dsp | 112 + .../FLAC/Files/src/share/grabbag/Makefile.am | 23 + .../FLAC/Files/src/share/grabbag/Makefile.in | 508 + .../Files/src/share/grabbag/Makefile.lite | 18 + .../FLAC/Files/src/share/grabbag/cuesheet.c | 593 + Libraries/FLAC/Files/src/share/grabbag/file.c | 142 + .../src/share/grabbag/grabbag_static.dsp | 136 + .../FLAC/Files/src/share/grabbag/replaygain.c | 615 + .../FLAC/Files/src/share/grabbag/seektable.c | 93 + .../src/share/replaygain_analysis/Makefile.am | 19 + .../src/share/replaygain_analysis/Makefile.in | 498 + .../share/replaygain_analysis/Makefile.lite | 15 + .../replaygain_analysis/replaygain_analysis.c | 413 + .../replaygain_analysis_static.dsp | 108 + .../share/replaygain_synthesis/Makefile.am | 21 + .../share/replaygain_synthesis/Makefile.in | 596 + .../share/replaygain_synthesis/Makefile.lite | 15 + .../replaygain_synthesis/include/Makefile.am | 18 + .../replaygain_synthesis/include/Makefile.in | 530 + .../include/private/Makefile.am | 19 + .../include/private/Makefile.in | 438 + .../include/private/fast_float_math_hack.h | 39 + .../replaygain_synthesis.c | 465 + .../replaygain_synthesis_static.dsp | 108 + .../FLAC/Files/src/share/utf8/Makefile.am | 23 + .../FLAC/Files/src/share/utf8/Makefile.in | 504 + .../FLAC/Files/src/share/utf8/Makefile.lite | 17 + .../FLAC/Files/src/share/utf8/charmaps.h | 57 + Libraries/FLAC/Files/src/share/utf8/charset.c | 531 + Libraries/FLAC/Files/src/share/utf8/charset.h | 72 + .../FLAC/Files/src/share/utf8/charset_test.c | 259 + .../FLAC/Files/src/share/utf8/charsetmap.h | 79 + .../FLAC/Files/src/share/utf8/iconvert.c | 248 + Libraries/FLAC/Files/src/share/utf8/makemap.c | 77 + Libraries/FLAC/Files/src/share/utf8/utf8.c | 319 + .../FLAC/Files/src/share/utf8/utf8_static.dsp | 116 + Libraries/FLAC/Info.plist | 26 + Libraries/MAC/.DS_Store | Bin 0 -> 6148 bytes Libraries/MAC/English.lproj/InfoPlist.strings | Bin 0 -> 136 bytes Libraries/MAC/Files/.DS_Store | Bin 0 -> 6148 bytes Libraries/MAC/Files/Shared/.DS_Store | Bin 0 -> 6148 bytes Libraries/MAC/Files/Shared/APETag.h | 293 + Libraries/MAC/Files/Shared/All.h | 250 + Libraries/MAC/Files/Shared/IO.h | 49 + Libraries/MAC/Files/Shared/MACDll.h | 99 + Libraries/MAC/Files/Shared/MACLib.h | 450 + Libraries/MAC/Files/Shared/SmartPtr.h | 89 + Libraries/MAC/Files/Source/.DS_Store | Bin 0 -> 12292 bytes Libraries/MAC/Files/Source/.gdb_history | 5 + Libraries/MAC/Files/Source/Credits.txt | 25 + Libraries/MAC/Files/Source/History.txt | 79 + Libraries/MAC/Files/Source/License.htm | 48 + Libraries/MAC/Files/Source/MACLib/.DS_Store | Bin 0 -> 15364 bytes .../MAC/Files/Source/MACLib/APECompress.cpp | 249 + .../MAC/Files/Source/MACLib/APECompress.h | 56 + .../Files/Source/MACLib/APECompressCore.cpp | 126 + .../MAC/Files/Source/MACLib/APECompressCore.h | 41 + .../Files/Source/MACLib/APECompressCreate.cpp | 287 + .../Files/Source/MACLib/APECompressCreate.h | 43 + .../MAC/Files/Source/MACLib/APEDecompress.cpp | 488 + .../MAC/Files/Source/MACLib/APEDecompress.h | 72 + .../MAC/Files/Source/MACLib/APEHeader.cpp | 324 + Libraries/MAC/Files/Source/MACLib/APEHeader.h | 57 + Libraries/MAC/Files/Source/MACLib/APEInfo.cpp | 369 + Libraries/MAC/Files/Source/MACLib/APEInfo.h | 100 + Libraries/MAC/Files/Source/MACLib/APELink.cpp | 121 + Libraries/MAC/Files/Source/MACLib/APELink.h | 30 + .../MAC/Files/Source/MACLib/APESimple.cpp | 427 + Libraries/MAC/Files/Source/MACLib/APETag.cpp | 754 + Libraries/MAC/Files/Source/MACLib/APETag.h | 294 + .../Files/Source/MACLib/Assembly/Assembly.h | 12 + .../Files/Source/MACLib/Assembly/Assembly.nas | 181 + .../Files/Source/MACLib/Assembly/Tools.inc | 117 + .../MAC/Files/Source/MACLib/BitArray.cpp | 441 + Libraries/MAC/Files/Source/MACLib/BitArray.h | 62 + Libraries/MAC/Files/Source/MACLib/MACLib.cpp | 159 + Libraries/MAC/Files/Source/MACLib/MACLib.h | 451 + .../MAC/Files/Source/MACLib/MACLib.vcproj | 1019 + .../Files/Source/MACLib/MACProgressHelper.cpp | 82 + .../Files/Source/MACLib/MACProgressHelper.h | 37 + Libraries/MAC/Files/Source/MACLib/MD5.cpp | 264 + .../Source/MACLib/MultichannelNNFilter.h | 95 + .../MAC/Files/Source/MACLib/NNFilter.cpp | 327 + Libraries/MAC/Files/Source/MACLib/NNFilter.h | 44 + .../MAC/Files/Source/MACLib/NewPredictor.cpp | 408 + .../MAC/Files/Source/MACLib/NewPredictor.h | 111 + .../Source/MACLib/Old/APEDecompressCore.cpp | 179 + .../Source/MACLib/Old/APEDecompressCore.h | 37 + .../Source/MACLib/Old/APEDecompressOld.cpp | 279 + .../Source/MACLib/Old/APEDecompressOld.h | 43 + .../Source/MACLib/Old/Anti-Predictor.cpp | 394 + .../Files/Source/MACLib/Old/Anti-Predictor.h | 253 + .../MACLib/Old/AntiPredictorExtraHigh.cpp | 330 + .../Source/MACLib/Old/AntiPredictorFast.cpp | 88 + .../Source/MACLib/Old/AntiPredictorHigh.cpp | 484 + .../Source/MACLib/Old/AntiPredictorNormal.cpp | 262 + .../Files/Source/MACLib/Old/UnBitArrayOld.cpp | 353 + .../Files/Source/MACLib/Old/UnBitArrayOld.h | 46 + .../MAC/Files/Source/MACLib/Old/UnMAC.cpp | 261 + Libraries/MAC/Files/Source/MACLib/Old/UnMAC.h | 69 + Libraries/MAC/Files/Source/MACLib/Predictor.h | 30 + Libraries/MAC/Files/Source/MACLib/Prepare.cpp | 537 + Libraries/MAC/Files/Source/MACLib/Prepare.h | 38 + .../Source/MACLib/ScaledFirstOrderFilter.h | 31 + .../MAC/Files/Source/MACLib/StartFilter.h | 178 + .../MAC/Files/Source/MACLib/UnBitArray.cpp | 293 + .../MAC/Files/Source/MACLib/UnBitArray.h | 51 + .../Files/Source/MACLib/UnBitArrayBase.cpp | 122 + .../MAC/Files/Source/MACLib/UnBitArrayBase.h | 59 + .../Files/Source/MACLib/WAVInputSource.cpp | 292 + .../MAC/Files/Source/MACLib/WAVInputSource.h | 64 + Libraries/MAC/Files/Source/MACLib/md5.h | 79 + Libraries/MAC/Files/Source/Readme.htm | 67 + Libraries/MAC/Files/Source/Shared/.DS_Store | Bin 0 -> 12292 bytes .../MAC/Files/Source/Shared/APEInfoDialog.cpp | 308 + .../MAC/Files/Source/Shared/APEInfoDialog.h | 22 + Libraries/MAC/Files/Source/Shared/All.h | 250 + .../Files/Source/Shared/CharacterHelper.cpp | 144 + .../MAC/Files/Source/Shared/CharacterHelper.h | 15 + .../MAC/Files/Source/Shared/CircleBuffer.cpp | 89 + .../MAC/Files/Source/Shared/CircleBuffer.h | 59 + .../Files/Source/Shared/GlobalFunctions.cpp | 152 + .../MAC/Files/Source/Shared/GlobalFunctions.h | 23 + Libraries/MAC/Files/Source/Shared/ID3Genres.h | 28 + Libraries/MAC/Files/Source/Shared/IO.h | 49 + Libraries/MAC/Files/Source/Shared/NoWindows.h | 70 + .../MAC/Files/Source/Shared/RollBuffer.h | 120 + Libraries/MAC/Files/Source/Shared/SmartPtr.h | 89 + .../MAC/Files/Source/Shared/StdLibFileIO.cpp | 242 + .../MAC/Files/Source/Shared/StdLibFileIO.h | 53 + Libraries/MAC/Files/Source/Shared/StdString.h | 3015 +++ Libraries/MAC/Files/Source/Shared/Unicows.cpp | 18 + .../MAC/Files/Source/Shared/WAVInfoDialog.cpp | 156 + .../MAC/Files/Source/Shared/WAVInfoDialog.h | 22 + .../MAC/Files/Source/Shared/WinFileIO.cpp | 162 + Libraries/MAC/Files/Source/Shared/WinFileIO.h | 49 + Libraries/MAC/Info.plist | 26 + Libraries/MAC/MAC.xcode/project.pbxproj | 1312 + Libraries/MAC/MAC.xcode/xugg.mode1 | 1284 + Libraries/MAC/MAC.xcode/xugg.pbxuser | 692 + .../MPCDec/English.lproj/InfoPlist.strings | Bin 0 -> 142 bytes Libraries/MPCDec/Files/AUTHORS | 10 + Libraries/MPCDec/Files/COPYING | 31 + Libraries/MPCDec/Files/ChangeLog | 23 + Libraries/MPCDec/Files/INSTALL | 3 + Libraries/MPCDec/Files/README | 6 + Libraries/MPCDec/Files/include/config.h | 105 + Libraries/MPCDec/Files/include/mainpage.h | 38 + .../Files/include/mpcdec/config_types.h | 48 + .../Files/include/mpcdec/config_types.h.in | 48 + .../Files/include/mpcdec/config_win32.h | 48 + .../MPCDec/Files/include/mpcdec/decoder.h | 148 + .../MPCDec/Files/include/mpcdec/huffman.h | 80 + .../MPCDec/Files/include/mpcdec/internal.h | 67 + Libraries/MPCDec/Files/include/mpcdec/math.h | 144 + .../MPCDec/Files/include/mpcdec/mpcdec.h | 132 + .../MPCDec/Files/include/mpcdec/reader.h | 82 + .../MPCDec/Files/include/mpcdec/requant.h | 51 + .../MPCDec/Files/include/mpcdec/streaminfo.h | 86 + Libraries/MPCDec/Files/src/huffsv46.c | 268 + Libraries/MPCDec/Files/src/huffsv7.c | 500 + Libraries/MPCDec/Files/src/idtag.c | 83 + Libraries/MPCDec/Files/src/mpc_decoder.c | 1349 + Libraries/MPCDec/Files/src/mpc_reader.c | 96 + Libraries/MPCDec/Files/src/requant.c | 152 + Libraries/MPCDec/Files/src/sample.cpp | 328 + Libraries/MPCDec/Files/src/streaminfo.c | 280 + Libraries/MPCDec/Files/src/synth_filter.c | 442 + Libraries/MPCDec/Info.plist | 26 + Libraries/MPCDec/MPCDec.xcode/project.pbxproj | 599 + Libraries/MPCDec/MPCDec.xcode/xugg.mode1 | 1238 + Libraries/MPCDec/MPCDec.xcode/xugg.pbxuser | 172 + Libraries/Ogg/.cvsignore | 27 + Libraries/Ogg/English.lproj/InfoPlist.strings | Bin 0 -> 136 bytes Libraries/Ogg/Files/AUTHORS | 4 + Libraries/Ogg/Files/CHANGES | 27 + Libraries/Ogg/Files/COPYING | 28 + Libraries/Ogg/Files/HACKING | 48 + Libraries/Ogg/Files/README | 103 + Libraries/Ogg/Files/include/.cvsignore | 2 + Libraries/Ogg/Files/include/ogg/.cvsignore | 3 + .../Ogg/Files/include/ogg/config_types.h.in | 11 + Libraries/Ogg/Files/include/ogg/ogg.h | 202 + Libraries/Ogg/Files/include/ogg/os_types.h | 127 + Libraries/Ogg/Files/src/.cvsignore | 6 + Libraries/Ogg/Files/src/bitwise.c | 784 + Libraries/Ogg/Files/src/framing.c | 1800 ++ Libraries/Ogg/Info.plist | 26 + Libraries/Ogg/Ogg.xcode/project.pbxproj | 342 + Libraries/Ogg/Ogg.xcode/xugg.mode1 | 1241 + Libraries/Ogg/Ogg.xcode/xugg.pbxuser | 169 + .../SndFile/English.lproj/InfoPlist.strings | Bin 0 -> 144 bytes Libraries/SndFile/Files/AUTHORS | 14 + Libraries/SndFile/Files/COPYING | 503 + Libraries/SndFile/Files/ChangeLog | 5161 ++++ Libraries/SndFile/Files/INSTALL | 182 + Libraries/SndFile/Files/NEWS | 98 + Libraries/SndFile/Files/README | 74 + Libraries/SndFile/Files/TODO | 42 + Libraries/SndFile/Files/src/G72x/ChangeLog | 50 + Libraries/SndFile/Files/src/G72x/Makefile.am | 28 + Libraries/SndFile/Files/src/G72x/Makefile.in | 478 + Libraries/SndFile/Files/src/G72x/README | 0 .../SndFile/Files/src/G72x/README.original | 94 + Libraries/SndFile/Files/src/G72x/g721.c | 162 + Libraries/SndFile/Files/src/G72x/g723_16.c | 169 + Libraries/SndFile/Files/src/G72x/g723_24.c | 146 + Libraries/SndFile/Files/src/G72x/g723_40.c | 160 + Libraries/SndFile/Files/src/G72x/g72x.c | 636 + Libraries/SndFile/Files/src/G72x/g72x.h | 117 + Libraries/SndFile/Files/src/G72x/g72x_priv.h | 119 + Libraries/SndFile/Files/src/G72x/g72x_test.c | 222 + Libraries/SndFile/Files/src/GSM610/COPYRIGHT | 16 + Libraries/SndFile/Files/src/GSM610/ChangeLog | 56 + .../SndFile/Files/src/GSM610/Makefile.am | 21 + .../SndFile/Files/src/GSM610/Makefile.in | 470 + Libraries/SndFile/Files/src/GSM610/README | 36 + Libraries/SndFile/Files/src/GSM610/add.c | 248 + Libraries/SndFile/Files/src/GSM610/code.c | 97 + Libraries/SndFile/Files/src/GSM610/config.h | 33 + Libraries/SndFile/Files/src/GSM610/decode.c | 67 + Libraries/SndFile/Files/src/GSM610/gsm.h | 58 + .../SndFile/Files/src/GSM610/gsm610_priv.h | 304 + .../SndFile/Files/src/GSM610/gsm_create.c | 44 + .../SndFile/Files/src/GSM610/gsm_decode.c | 366 + .../SndFile/Files/src/GSM610/gsm_destroy.c | 31 + .../SndFile/Files/src/GSM610/gsm_encode.c | 456 + .../SndFile/Files/src/GSM610/gsm_option.c | 74 + .../SndFile/Files/src/GSM610/long_term.c | 951 + Libraries/SndFile/Files/src/GSM610/lpc.c | 341 + .../SndFile/Files/src/GSM610/preprocess.c | 115 + Libraries/SndFile/Files/src/GSM610/rpe.c | 490 + .../SndFile/Files/src/GSM610/short_term.c | 427 + Libraries/SndFile/Files/src/GSM610/table.c | 69 + Libraries/SndFile/Files/src/Symbols.darwin | 34 + Libraries/SndFile/Files/src/Symbols.linux | 40 + Libraries/SndFile/Files/src/aiff.c | 1345 + Libraries/SndFile/Files/src/alaw.c | 544 + Libraries/SndFile/Files/src/au.c | 495 + Libraries/SndFile/Files/src/au.h | 39 + Libraries/SndFile/Files/src/au_g72x.c | 634 + Libraries/SndFile/Files/src/avr.c | 262 + Libraries/SndFile/Files/src/command.c | 325 + Libraries/SndFile/Files/src/common.c | 1188 + Libraries/SndFile/Files/src/common.h | 691 + Libraries/SndFile/Files/src/config.h | 239 + .../SndFile/Files/src/create_symbols_file.py | 147 + Libraries/SndFile/Files/src/dither.c | 534 + Libraries/SndFile/Files/src/double64.c | 1007 + Libraries/SndFile/Files/src/dwd.c | 209 + Libraries/SndFile/Files/src/dwvw.c | 665 + Libraries/SndFile/Files/src/file_io.c | 1287 + Libraries/SndFile/Files/src/float32.c | 960 + Libraries/SndFile/Files/src/float_cast.h | 210 + Libraries/SndFile/Files/src/gsm610.c | 605 + Libraries/SndFile/Files/src/htk.c | 226 + Libraries/SndFile/Files/src/ima_adpcm.c | 1008 + Libraries/SndFile/Files/src/interleave.c | 306 + Libraries/SndFile/Files/src/ircam.c | 331 + Libraries/SndFile/Files/src/libsndfile.def | 37 + Libraries/SndFile/Files/src/macbinary3.c | 58 + Libraries/SndFile/Files/src/macos.c | 63 + Libraries/SndFile/Files/src/mat4.c | 393 + Libraries/SndFile/Files/src/mat5.c | 506 + Libraries/SndFile/Files/src/ms_adpcm.c | 834 + Libraries/SndFile/Files/src/nist.c | 354 + Libraries/SndFile/Files/src/ogg.c | 898 + Libraries/SndFile/Files/src/paf.c | 847 + Libraries/SndFile/Files/src/pcm.c | 2898 +++ Libraries/SndFile/Files/src/pvf.c | 200 + Libraries/SndFile/Files/src/raw.c | 110 + Libraries/SndFile/Files/src/rx2.c | 325 + Libraries/SndFile/Files/src/sd2.c | 572 + Libraries/SndFile/Files/src/sds.c | 995 + Libraries/SndFile/Files/src/sf_unistd.h | 67 + Libraries/SndFile/Files/src/sfendian.h | 258 + Libraries/SndFile/Files/src/sndfile.c | 2487 ++ Libraries/SndFile/Files/src/sndfile.h | 491 + Libraries/SndFile/Files/src/strings.c | 203 + Libraries/SndFile/Files/src/svx.c | 410 + Libraries/SndFile/Files/src/test_endswap.c | 233 + Libraries/SndFile/Files/src/test_endswap.def | 28 + Libraries/SndFile/Files/src/test_endswap.tpl | 126 + Libraries/SndFile/Files/src/test_file_io.c | 448 + Libraries/SndFile/Files/src/test_log_printf.c | 138 + Libraries/SndFile/Files/src/txw.c | 378 + Libraries/SndFile/Files/src/ulaw.c | 1047 + Libraries/SndFile/Files/src/voc.c | 878 + Libraries/SndFile/Files/src/vox_adpcm.c | 537 + Libraries/SndFile/Files/src/w64.c | 581 + Libraries/SndFile/Files/src/wav.c | 1391 + Libraries/SndFile/Files/src/wav_w64.c | 386 + Libraries/SndFile/Files/src/wav_w64.h | 282 + Libraries/SndFile/Files/src/wve.c | 124 + Libraries/SndFile/Files/src/xi.c | 1194 + Libraries/SndFile/Info.plist | 26 + .../SndFile/SndFile.xcode/project.pbxproj | 1542 ++ Libraries/SndFile/SndFile.xcode/xugg.mode1 | 1249 + Libraries/SndFile/SndFile.xcode/xugg.pbxuser | 274 + .../TagLib/English.lproj/InfoPlist.strings | Bin 0 -> 142 bytes Libraries/TagLib/Files/AUTHORS | 8 + Libraries/TagLib/Files/COPYING | 481 + Libraries/TagLib/Files/ChangeLog | 0 Libraries/TagLib/Files/INSTALL | 167 + Libraries/TagLib/Files/Makefile.am | 29 + Libraries/TagLib/Files/Makefile.cvs | 14 + Libraries/TagLib/Files/Makefile.in | 643 + Libraries/TagLib/Files/README | 1 + Libraries/TagLib/Files/TODO | 0 Libraries/TagLib/Files/config.h | 65 + Libraries/TagLib/Files/taglib/ape/Makefile.am | 13 + Libraries/TagLib/Files/taglib/ape/Makefile.in | 553 + .../Files/taglib/ape/ape-tag-format.txt | 170 + .../TagLib/Files/taglib/ape/apefooter.cpp | 232 + Libraries/TagLib/Files/taglib/ape/apefooter.h | 168 + Libraries/TagLib/Files/taglib/ape/apeitem.cpp | 186 + Libraries/TagLib/Files/taglib/ape/apeitem.h | 150 + Libraries/TagLib/Files/taglib/ape/apetag.cpp | 255 + Libraries/TagLib/Files/taglib/ape/apetag.h | 157 + .../TagLib/Files/taglib/audioproperties.cpp | 47 + .../TagLib/Files/taglib/audioproperties.h | 104 + .../TagLib/Files/taglib/configure.in.bot | 8 + Libraries/TagLib/Files/taglib/configure.in.in | 18 + Libraries/TagLib/Files/taglib/fileref.cpp | 143 + Libraries/TagLib/Files/taglib/fileref.h | 183 + .../TagLib/Files/taglib/flac/Makefile.am | 16 + .../TagLib/Files/taglib/flac/Makefile.in | 555 + .../TagLib/Files/taglib/flac/flacfile.cpp | 468 + Libraries/TagLib/Files/taglib/flac/flacfile.h | 196 + .../Files/taglib/flac/flacproperties.cpp | 146 + .../TagLib/Files/taglib/flac/flacproperties.h | 84 + Libraries/TagLib/Files/taglib/flac/flactag.h | 212 + Libraries/TagLib/Files/taglib/mpc/Makefile.am | 16 + Libraries/TagLib/Files/taglib/mpc/Makefile.in | 555 + .../TagLib/Files/taglib/mpc/combinedtag.h | 171 + Libraries/TagLib/Files/taglib/mpc/mpcfile.cpp | 358 + Libraries/TagLib/Files/taglib/mpc/mpcfile.h | 162 + .../TagLib/Files/taglib/mpc/mpcproperties.cpp | 140 + .../TagLib/Files/taglib/mpc/mpcproperties.h | 77 + .../TagLib/Files/taglib/mpeg/Makefile.am | 19 + .../TagLib/Files/taglib/mpeg/Makefile.in | 662 + .../Files/taglib/mpeg/id3v1/Makefile.am | 14 + .../Files/taglib/mpeg/id3v1/Makefile.in | 548 + .../Files/taglib/mpeg/id3v1/id3v1genres.cpp | 215 + .../Files/taglib/mpeg/id3v1/id3v1genres.h | 61 + .../Files/taglib/mpeg/id3v1/id3v1tag.cpp | 239 + .../TagLib/Files/taglib/mpeg/id3v1/id3v1tag.h | 172 + .../Files/taglib/mpeg/id3v2/Makefile.am | 28 + .../Files/taglib/mpeg/id3v2/Makefile.in | 686 + .../taglib/mpeg/id3v2/frames/Makefile.am | 27 + .../taglib/mpeg/id3v2/frames/Makefile.in | 583 + .../id3v2/frames/attachedpictureframe.cpp | 165 + .../mpeg/id3v2/frames/attachedpictureframe.h | 195 + .../mpeg/id3v2/frames/commentsframe.cpp | 152 + .../taglib/mpeg/id3v2/frames/commentsframe.h | 154 + .../mpeg/id3v2/frames/relativevolumeframe.cpp | 137 + .../mpeg/id3v2/frames/relativevolumeframe.h | 207 + .../id3v2/frames/textidentificationframe.cpp | 245 + .../id3v2/frames/textidentificationframe.h | 241 + .../frames/uniquefileidentifierframe.cpp | 107 + .../id3v2/frames/uniquefileidentifierframe.h | 101 + .../taglib/mpeg/id3v2/frames/unknownframe.cpp | 80 + .../taglib/mpeg/id3v2/frames/unknownframe.h | 74 + .../taglib/mpeg/id3v2/id3v2.4.0-frames.txt | 1734 ++ .../taglib/mpeg/id3v2/id3v2.4.0-structure.txt | 733 + .../taglib/mpeg/id3v2/id3v2extendedheader.cpp | 67 + .../taglib/mpeg/id3v2/id3v2extendedheader.h | 88 + .../Files/taglib/mpeg/id3v2/id3v2footer.cpp | 56 + .../Files/taglib/mpeg/id3v2/id3v2footer.h | 77 + .../Files/taglib/mpeg/id3v2/id3v2frame.cpp | 467 + .../Files/taglib/mpeg/id3v2/id3v2frame.h | 369 + .../taglib/mpeg/id3v2/id3v2framefactory.cpp | 309 + .../taglib/mpeg/id3v2/id3v2framefactory.h | 140 + .../Files/taglib/mpeg/id3v2/id3v2header.cpp | 227 + .../Files/taglib/mpeg/id3v2/id3v2header.h | 159 + .../taglib/mpeg/id3v2/id3v2synchdata.cpp | 48 + .../Files/taglib/mpeg/id3v2/id3v2synchdata.h | 61 + .../Files/taglib/mpeg/id3v2/id3v2tag.cpp | 464 + .../TagLib/Files/taglib/mpeg/id3v2/id3v2tag.h | 295 + .../TagLib/Files/taglib/mpeg/mpegfile.cpp | 698 + Libraries/TagLib/Files/taglib/mpeg/mpegfile.h | 260 + .../TagLib/Files/taglib/mpeg/mpegheader.cpp | 253 + .../TagLib/Files/taglib/mpeg/mpegheader.h | 155 + .../Files/taglib/mpeg/mpegproperties.cpp | 220 + .../TagLib/Files/taglib/mpeg/mpegproperties.h | 105 + .../TagLib/Files/taglib/mpeg/xingheader.cpp | 111 + .../TagLib/Files/taglib/mpeg/xingheader.h | 91 + Libraries/TagLib/Files/taglib/ogg/Makefile.am | 23 + Libraries/TagLib/Files/taglib/ogg/Makefile.in | 664 + .../TagLib/Files/taglib/ogg/flac/Makefile.am | 15 + .../TagLib/Files/taglib/ogg/flac/Makefile.in | 522 + .../Files/taglib/ogg/flac/oggflacfile.cpp | 245 + .../Files/taglib/ogg/flac/oggflacfile.h | 113 + Libraries/TagLib/Files/taglib/ogg/oggfile.cpp | 332 + Libraries/TagLib/Files/taglib/ogg/oggfile.h | 107 + Libraries/TagLib/Files/taglib/ogg/oggpage.cpp | 251 + Libraries/TagLib/Files/taglib/ogg/oggpage.h | 198 + .../TagLib/Files/taglib/ogg/oggpageheader.cpp | 317 + .../TagLib/Files/taglib/ogg/oggpageheader.h | 227 + .../Files/taglib/ogg/vorbis/Makefile.am | 14 + .../Files/taglib/ogg/vorbis/Makefile.in | 548 + .../Files/taglib/ogg/vorbis/vorbisfile.cpp | 113 + .../Files/taglib/ogg/vorbis/vorbisfile.h | 113 + .../taglib/ogg/vorbis/vorbisproperties.cpp | 179 + .../taglib/ogg/vorbis/vorbisproperties.h | 120 + .../TagLib/Files/taglib/ogg/xiphcomment.cpp | 293 + .../TagLib/Files/taglib/ogg/xiphcomment.h | 190 + Libraries/TagLib/Files/taglib/tag.cpp | 79 + Libraries/TagLib/Files/taglib/tag.h | 168 + .../TagLib/Files/taglib/taglib-config.in | 55 + .../TagLib/Files/taglib/toolkit/Makefile.am | 16 + .../TagLib/Files/taglib/toolkit/Makefile.in | 572 + .../TagLib/Files/taglib/toolkit/taglib.h | 155 + .../Files/taglib/toolkit/tbytevector.cpp | 627 + .../TagLib/Files/taglib/toolkit/tbytevector.h | 397 + .../Files/taglib/toolkit/tbytevectorlist.cpp | 88 + .../Files/taglib/toolkit/tbytevectorlist.h | 77 + .../TagLib/Files/taglib/toolkit/tdebug.cpp | 51 + .../TagLib/Files/taglib/toolkit/tdebug.h | 67 + .../TagLib/Files/taglib/toolkit/tfile.cpp | 484 + Libraries/TagLib/Files/taglib/toolkit/tfile.h | 240 + Libraries/TagLib/Files/taglib/toolkit/tlist.h | 236 + .../TagLib/Files/taglib/toolkit/tlist.tcc | 296 + Libraries/TagLib/Files/taglib/toolkit/tmap.h | 177 + .../TagLib/Files/taglib/toolkit/tmap.tcc | 172 + .../TagLib/Files/taglib/toolkit/tstring.cpp | 723 + .../TagLib/Files/taglib/toolkit/tstring.h | 414 + .../Files/taglib/toolkit/tstringlist.cpp | 118 + .../TagLib/Files/taglib/toolkit/tstringlist.h | 110 + .../TagLib/Files/taglib/toolkit/unicode.cpp | 303 + .../TagLib/Files/taglib/toolkit/unicode.h | 149 + Libraries/TagLib/Info.plist | 26 + Libraries/TagLib/TagLib.xcode/project.pbxproj | 1906 ++ Libraries/TagLib/TagLib.xcode/xugg.mode1 | 1258 + Libraries/TagLib/TagLib.xcode/xugg.pbxuser | 338 + Libraries/Vorbis/.cvsignore | 18 + .../Vorbis/English.lproj/InfoPlist.strings | Bin 0 -> 142 bytes Libraries/Vorbis/Files/AUTHORS | 3 + Libraries/Vorbis/Files/CHANGES | 23 + Libraries/Vorbis/Files/COPYING | 28 + Libraries/Vorbis/Files/README | 130 + Libraries/Vorbis/Files/include/.cvsignore | 2 + Libraries/Vorbis/Files/include/Makefile.am | 3 + .../Vorbis/Files/include/vorbis/.cvsignore | 2 + .../Vorbis/Files/include/vorbis/Makefile.am | 7 + Libraries/Vorbis/Files/include/vorbis/codec.h | 240 + .../Vorbis/Files/include/vorbis/vorbisenc.h | 112 + .../Vorbis/Files/include/vorbis/vorbisfile.h | 143 + Libraries/Vorbis/Files/lib/.cvsignore | 6 + Libraries/Vorbis/Files/lib/Makefile.am | 44 + Libraries/Vorbis/Files/lib/analysis.c | 121 + Libraries/Vorbis/Files/lib/backends.h | 146 + Libraries/Vorbis/Files/lib/barkmel.c | 64 + Libraries/Vorbis/Files/lib/bitrate.c | 253 + Libraries/Vorbis/Files/lib/bitrate.h | 59 + Libraries/Vorbis/Files/lib/block.c | 985 + Libraries/Vorbis/Files/lib/books/.cvsignore | 2 + Libraries/Vorbis/Files/lib/books/Makefile.am | 3 + .../Vorbis/Files/lib/books/coupled/.cvsignore | 2 + .../Files/lib/books/coupled/Makefile.am | 3 + .../lib/books/coupled/res_books_stereo.h | 20989 ++++++++++++++++ .../Vorbis/Files/lib/books/floor/.cvsignore | 2 + .../Vorbis/Files/lib/books/floor/Makefile.am | 3 + .../Files/lib/books/floor/floor_books.h | 1838 ++ .../Files/lib/books/uncoupled/.cvsignore | 2 + .../Files/lib/books/uncoupled/Makefile.am | 3 + .../lib/books/uncoupled/res_books_uncoupled.h | 11517 +++++++++ Libraries/Vorbis/Files/lib/codebook.c | 615 + Libraries/Vorbis/Files/lib/codebook.h | 160 + Libraries/Vorbis/Files/lib/codec_internal.h | 137 + Libraries/Vorbis/Files/lib/envelope.c | 382 + Libraries/Vorbis/Files/lib/envelope.h | 81 + Libraries/Vorbis/Files/lib/floor0.c | 223 + Libraries/Vorbis/Files/lib/floor1.c | 1090 + Libraries/Vorbis/Files/lib/highlevel.h | 57 + Libraries/Vorbis/Files/lib/info.c | 603 + Libraries/Vorbis/Files/lib/lookup.c | 94 + Libraries/Vorbis/Files/lib/lookup.h | 32 + Libraries/Vorbis/Files/lib/lookup_data.h | 189 + Libraries/Vorbis/Files/lib/lookups.pl | 142 + Libraries/Vorbis/Files/lib/lpc.c | 149 + Libraries/Vorbis/Files/lib/lpc.h | 29 + Libraries/Vorbis/Files/lib/lsp.c | 455 + Libraries/Vorbis/Files/lib/lsp.h | 28 + Libraries/Vorbis/Files/lib/mapping0.c | 844 + Libraries/Vorbis/Files/lib/masking.h | 785 + Libraries/Vorbis/Files/lib/mdct.c | 564 + Libraries/Vorbis/Files/lib/mdct.h | 83 + Libraries/Vorbis/Files/lib/misc.c | 213 + Libraries/Vorbis/Files/lib/misc.h | 52 + Libraries/Vorbis/Files/lib/modes/.cvsignore | 2 + Libraries/Vorbis/Files/lib/modes/Makefile.am | 6 + Libraries/Vorbis/Files/lib/modes/floor_all.h | 248 + Libraries/Vorbis/Files/lib/modes/psych_11.h | 51 + Libraries/Vorbis/Files/lib/modes/psych_16.h | 129 + Libraries/Vorbis/Files/lib/modes/psych_44.h | 666 + Libraries/Vorbis/Files/lib/modes/psych_8.h | 102 + Libraries/Vorbis/Files/lib/modes/residue_16.h | 163 + Libraries/Vorbis/Files/lib/modes/residue_44.h | 294 + .../Vorbis/Files/lib/modes/residue_44u.h | 318 + Libraries/Vorbis/Files/lib/modes/residue_8.h | 97 + Libraries/Vorbis/Files/lib/modes/setup_11.h | 141 + Libraries/Vorbis/Files/lib/modes/setup_16.h | 149 + Libraries/Vorbis/Files/lib/modes/setup_22.h | 128 + Libraries/Vorbis/Files/lib/modes/setup_32.h | 132 + Libraries/Vorbis/Files/lib/modes/setup_44.h | 107 + Libraries/Vorbis/Files/lib/modes/setup_44u.h | 74 + Libraries/Vorbis/Files/lib/modes/setup_8.h | 146 + Libraries/Vorbis/Files/lib/modes/setup_X.h | 226 + Libraries/Vorbis/Files/lib/os.h | 156 + Libraries/Vorbis/Files/lib/psy.c | 1224 + Libraries/Vorbis/Files/lib/psy.h | 186 + Libraries/Vorbis/Files/lib/psytune.c | 521 + Libraries/Vorbis/Files/lib/registry.c | 46 + Libraries/Vorbis/Files/lib/registry.h | 32 + Libraries/Vorbis/Files/lib/res0.c | 909 + Libraries/Vorbis/Files/lib/scales.h | 84 + Libraries/Vorbis/Files/lib/sharedbook.c | 734 + Libraries/Vorbis/Files/lib/smallft.c | 1255 + Libraries/Vorbis/Files/lib/smallft.h | 34 + Libraries/Vorbis/Files/lib/synthesis.c | 170 + Libraries/Vorbis/Files/lib/tone.c | 54 + Libraries/Vorbis/Files/lib/vorbisenc.c | 1184 + Libraries/Vorbis/Files/lib/vorbisfile.c | 1981 ++ Libraries/Vorbis/Files/lib/window.c | 2136 ++ Libraries/Vorbis/Files/lib/window.h | 26 + Libraries/Vorbis/Files/todo.txt | 22 + Libraries/Vorbis/Info.plist | 26 + Libraries/Vorbis/Vorbis.xcode/project.pbxproj | 1452 ++ Libraries/Vorbis/Vorbis.xcode/xugg.mode1 | 1224 + Libraries/Vorbis/Vorbis.xcode/xugg.pbxuser | 126 + PLANNED | 10 + Playlist/DNDArrayController.h | 22 + Playlist/DNDArrayController.m | 147 + Playlist/PlaylistController.h | 83 + Playlist/PlaylistController.m | 496 + Playlist/PlaylistEntry.h | 67 + Playlist/PlaylistEntry.m | 276 + Playlist/PlaylistView.h | 21 + Playlist/PlaylistView.m | 67 + README | 12 + Sound.h | 128 + Sound.m | 667 + SoundController.h | 42 + SoundController.m | 261 + SoundFile/AACFile.h | 30 + SoundFile/AACFile.m | 139 + SoundFile/FlacFile.h | 28 + SoundFile/FlacFile.m | 186 + SoundFile/MPEGFile.h | 18 + SoundFile/MPEGFile.m | 107 + SoundFile/MonkeysFile.h | 19 + SoundFile/MonkeysFile.m | 86 + SoundFile/MusepackFile.h | 30 + SoundFile/MusepackFile.m | 210 + SoundFile/SoundFile.h | 58 + SoundFile/SoundFile.m | 205 + SoundFile/VorbisFile.h | 20 + SoundFile/VorbisFile.m | 77 + SoundFile/WaveFile.h | 20 + SoundFile/WaveFile.m | 121 + TrackingCell.h | 14 + TrackingCell.m | 27 + TrackingSlider.h | 10 + TrackingSlider.m | 38 + Updates/MacPADSocket.h | 71 + Updates/MacPADSocket.m | 399 + Updates/UpdateController.h | 46 + Updates/UpdateController.m | 168 + VirtualRingBuffer.h | 88 + VirtualRingBuffer.m | 309 + main.m | 14 + xchat/cog.py | 36 + xchat/cog.script | 9 + 997 files changed, 348887 insertions(+) create mode 100644 .DS_Store create mode 100644 AppController.h create mode 100644 AppController.m create mode 100644 COPYING create mode 100644 Changelog create mode 100644 Cog.scriptSuite create mode 100644 Cog.scriptTerminology create mode 100644 Cog.xcode/project.pbxproj create mode 100644 Cog.xcode/xugg.mode1 create mode 100644 Cog.xcode/xugg.pbxuser create mode 100644 Cog_Prefix.pch create mode 100644 Credits.html create mode 100644 DBLog.c create mode 100644 DBLog.h create mode 100644 English.lproj/InfoPlist.strings create mode 100644 English.lproj/MainMenu.nib/classes.nib create mode 100644 English.lproj/MainMenu.nib/info.nib create mode 100644 English.lproj/MainMenu.nib/keyedobjects.nib create mode 100644 English.lproj/MainMenu~.nib/classes.nib create mode 100644 English.lproj/MainMenu~.nib/info.nib create mode 100644 English.lproj/MainMenu~.nib/keyedobjects.nib create mode 100644 Feedback/FeedbackController.h create mode 100644 Feedback/FeedbackController.m create mode 100644 Feedback/FeedbackSocket.h create mode 100644 Feedback/FeedbackSocket.m create mode 100644 Icons/add_blue.png create mode 100644 Icons/add_gray.png create mode 100644 Icons/bground.png create mode 100644 Icons/info_blue.png create mode 100644 Icons/info_gray.png create mode 100644 Icons/next_blue.png create mode 100644 Icons/next_gray.png create mode 100644 Icons/pause_blue.png create mode 100644 Icons/pause_gray.png create mode 100644 Icons/play_blue.png create mode 100644 Icons/play_gray.png create mode 100644 Icons/prev_blue.png create mode 100644 Icons/prev_gray.png create mode 100644 Icons/remove_blue.png create mode 100644 Icons/remove_gray.png create mode 100644 Icons/repeat_blue.png create mode 100644 Icons/repeat_gray.png create mode 100644 Icons/shuffle_blue.png create mode 100644 Icons/shuffle_gray.png create mode 100644 Icons/stop_blue.png create mode 100644 Icons/stop_gray.png create mode 100644 Icons/wheel.icns create mode 100644 Info.plist create mode 100644 Libraries/.DS_Store create mode 100644 Libraries/DecMPA/DecMPA.xcode/project.pbxproj create mode 100644 Libraries/DecMPA/DecMPA.xcode/xugg.mode1 create mode 100644 Libraries/DecMPA/DecMPA.xcode/xugg.pbxuser create mode 100644 Libraries/DecMPA/English.lproj/InfoPlist.strings create mode 100644 Libraries/DecMPA/Files/ChangeLog.txt create mode 100644 Libraries/DecMPA/Files/License.txt create mode 100644 Libraries/DecMPA/Files/Readme.txt create mode 100644 Libraries/DecMPA/Files/Todo.txt create mode 100644 Libraries/DecMPA/Files/include/decmpa.h create mode 100644 Libraries/DecMPA/Files/src/DecMPA.cpp create mode 100644 Libraries/DecMPA/Files/src/DecMPAFileAccess.cpp create mode 100644 Libraries/DecMPA/Files/src/DecMPAFileAccess.h create mode 100644 Libraries/DecMPA/Files/src/DecodeEngine.h create mode 100644 Libraries/DecMPA/Files/src/DefInc.h create mode 100644 Libraries/DecMPA/Files/src/IFileAccess.h create mode 100644 Libraries/DecMPA/Files/src/MPADecoder.cpp create mode 100644 Libraries/DecMPA/Files/src/MPADecoder.h create mode 100644 Libraries/DecMPA/Files/src/MPAFrameFinder.cpp create mode 100644 Libraries/DecMPA/Files/src/MPAFrameFinder.h create mode 100644 Libraries/DecMPA/Files/src/MPAInfo.cpp create mode 100644 Libraries/DecMPA/Files/src/MPAInfo.h create mode 100644 Libraries/DecMPA/Files/src/MemBuffer.h create mode 100644 Libraries/DecMPA/Files/src/frame/audioFrame.cpp create mode 100644 Libraries/DecMPA/Files/src/frame/audioFrame.h create mode 100644 Libraries/DecMPA/Files/src/frame/floatFrame.cpp create mode 100644 Libraries/DecMPA/Files/src/frame/floatFrame.h create mode 100644 Libraries/DecMPA/Files/src/frame/frame.cpp create mode 100644 Libraries/DecMPA/Files/src/frame/frame.h create mode 100644 Libraries/DecMPA/Files/src/frame/pcmFrame.cpp create mode 100644 Libraries/DecMPA/Files/src/frame/pcmFrame.h create mode 100644 Libraries/DecMPA/Files/src/frame/rawDataBuffer.cpp create mode 100644 Libraries/DecMPA/Files/src/frame/rawDataBuffer.h create mode 100644 Libraries/DecMPA/Files/src/hip/DecodeEngine_Hip.cpp create mode 100644 Libraries/DecMPA/Files/src/hip/HIPDefines.h create mode 100644 Libraries/DecMPA/Files/src/hip/VbrTag.c create mode 100644 Libraries/DecMPA/Files/src/hip/VbrTag.h create mode 100644 Libraries/DecMPA/Files/src/hip/common.c create mode 100644 Libraries/DecMPA/Files/src/hip/common.h create mode 100644 Libraries/DecMPA/Files/src/hip/dct64_i386.c create mode 100644 Libraries/DecMPA/Files/src/hip/dct64_i386.h create mode 100644 Libraries/DecMPA/Files/src/hip/decode_i386.c create mode 100644 Libraries/DecMPA/Files/src/hip/decode_i386.h create mode 100644 Libraries/DecMPA/Files/src/hip/huffman.h create mode 100644 Libraries/DecMPA/Files/src/hip/interface.c create mode 100644 Libraries/DecMPA/Files/src/hip/interface.h create mode 100644 Libraries/DecMPA/Files/src/hip/l2tables.h create mode 100644 Libraries/DecMPA/Files/src/hip/layer1.c create mode 100644 Libraries/DecMPA/Files/src/hip/layer1.h create mode 100644 Libraries/DecMPA/Files/src/hip/layer2.c create mode 100644 Libraries/DecMPA/Files/src/hip/layer2.h create mode 100644 Libraries/DecMPA/Files/src/hip/layer3.c create mode 100644 Libraries/DecMPA/Files/src/hip/layer3.h create mode 100644 Libraries/DecMPA/Files/src/hip/mpg123.h create mode 100644 Libraries/DecMPA/Files/src/hip/mpglib.h create mode 100644 Libraries/DecMPA/Files/src/hip/tabinit.c create mode 100644 Libraries/DecMPA/Files/src/hip/tabinit.h create mode 100644 Libraries/DecMPA/Files/src/mpegAudioFrame/dxHead.cpp create mode 100644 Libraries/DecMPA/Files/src/mpegAudioFrame/dxHead.h create mode 100644 Libraries/DecMPA/Files/src/mpegAudioFrame/mpegAudioHeader.cpp create mode 100644 Libraries/DecMPA/Files/src/mpegAudioFrame/mpegAudioHeader.h create mode 100644 Libraries/DecMPA/Files/src/splay/DecodeEngine_SPlay.cpp create mode 100644 Libraries/DecMPA/Files/src/splay/attribute.h create mode 100644 Libraries/DecMPA/Files/src/splay/common.h create mode 100644 Libraries/DecMPA/Files/src/splay/dct.h create mode 100644 Libraries/DecMPA/Files/src/splay/dct36_12.cpp create mode 100644 Libraries/DecMPA/Files/src/splay/dct64.cpp create mode 100644 Libraries/DecMPA/Files/src/splay/dct64_down.cpp create mode 100644 Libraries/DecMPA/Files/src/splay/huffmanlookup.cpp create mode 100644 Libraries/DecMPA/Files/src/splay/huffmanlookup.h create mode 100644 Libraries/DecMPA/Files/src/splay/huffmantable.cpp create mode 100644 Libraries/DecMPA/Files/src/splay/mpeg2tables.h create mode 100644 Libraries/DecMPA/Files/src/splay/mpegAudioBitWindow.cpp create mode 100644 Libraries/DecMPA/Files/src/splay/mpegAudioBitWindow.h create mode 100644 Libraries/DecMPA/Files/src/splay/mpegAudioStream.cpp create mode 100644 Libraries/DecMPA/Files/src/splay/mpegAudioStream.h create mode 100644 Libraries/DecMPA/Files/src/splay/mpeglayer1.cpp create mode 100644 Libraries/DecMPA/Files/src/splay/mpeglayer2.cpp create mode 100644 Libraries/DecMPA/Files/src/splay/mpeglayer3.cpp create mode 100644 Libraries/DecMPA/Files/src/splay/mpegsound.h create mode 100644 Libraries/DecMPA/Files/src/splay/mpegtable.cpp create mode 100644 Libraries/DecMPA/Files/src/splay/mpegtoraw.cpp create mode 100644 Libraries/DecMPA/Files/src/splay/op.h create mode 100644 Libraries/DecMPA/Files/src/splay/splayDecoder.cpp create mode 100644 Libraries/DecMPA/Files/src/splay/splayDecoder.h create mode 100644 Libraries/DecMPA/Files/src/splay/synth_Down.cpp create mode 100644 Libraries/DecMPA/Files/src/splay/synth_Std.cpp create mode 100644 Libraries/DecMPA/Files/src/splay/synth_filter.cpp create mode 100644 Libraries/DecMPA/Files/src/splay/synthesis.cpp create mode 100644 Libraries/DecMPA/Files/src/splay/synthesis.h create mode 100644 Libraries/DecMPA/Files/src/splay/window.cpp create mode 100644 Libraries/DecMPA/Files/src/splay/window.h create mode 100644 Libraries/DecMPA/Info.plist create mode 100644 Libraries/FAAD2/English.lproj/InfoPlist.strings create mode 100644 Libraries/FAAD2/FAAD2.xcode/project.pbxproj create mode 100644 Libraries/FAAD2/FAAD2.xcode/xugg.mode1 create mode 100644 Libraries/FAAD2/FAAD2.xcode/xugg.pbxuser create mode 100644 Libraries/FAAD2/FAAD2_Prefix.pch create mode 100644 Libraries/FAAD2/Files/AUTHORS create mode 100644 Libraries/FAAD2/Files/COPYING create mode 100644 Libraries/FAAD2/Files/ChangeLog create mode 100644 Libraries/FAAD2/Files/NEWS create mode 100644 Libraries/FAAD2/Files/README create mode 100644 Libraries/FAAD2/Files/README.linux create mode 100644 Libraries/FAAD2/Files/TODO create mode 100644 Libraries/FAAD2/Files/config.h create mode 100644 Libraries/FAAD2/Files/include/faad.h create mode 100644 Libraries/FAAD2/Files/include/neaacdec.h create mode 100644 Libraries/FAAD2/Files/libfaad/Makefile.am create mode 100644 Libraries/FAAD2/Files/libfaad/analysis.h create mode 100644 Libraries/FAAD2/Files/libfaad/bits.c create mode 100644 Libraries/FAAD2/Files/libfaad/bits.h create mode 100644 Libraries/FAAD2/Files/libfaad/cfft.c create mode 100644 Libraries/FAAD2/Files/libfaad/cfft.h create mode 100644 Libraries/FAAD2/Files/libfaad/cfft_tab.h create mode 100644 Libraries/FAAD2/Files/libfaad/codebook/hcb.h create mode 100644 Libraries/FAAD2/Files/libfaad/codebook/hcb_1.h create mode 100644 Libraries/FAAD2/Files/libfaad/codebook/hcb_10.h create mode 100644 Libraries/FAAD2/Files/libfaad/codebook/hcb_11.h create mode 100644 Libraries/FAAD2/Files/libfaad/codebook/hcb_2.h create mode 100644 Libraries/FAAD2/Files/libfaad/codebook/hcb_3.h create mode 100644 Libraries/FAAD2/Files/libfaad/codebook/hcb_4.h create mode 100644 Libraries/FAAD2/Files/libfaad/codebook/hcb_5.h create mode 100644 Libraries/FAAD2/Files/libfaad/codebook/hcb_6.h create mode 100644 Libraries/FAAD2/Files/libfaad/codebook/hcb_7.h create mode 100644 Libraries/FAAD2/Files/libfaad/codebook/hcb_8.h create mode 100644 Libraries/FAAD2/Files/libfaad/codebook/hcb_9.h create mode 100644 Libraries/FAAD2/Files/libfaad/codebook/hcb_sf.h create mode 100644 Libraries/FAAD2/Files/libfaad/common.c create mode 100644 Libraries/FAAD2/Files/libfaad/common.h create mode 100644 Libraries/FAAD2/Files/libfaad/decoder.c create mode 100644 Libraries/FAAD2/Files/libfaad/decoder.h create mode 100644 Libraries/FAAD2/Files/libfaad/drc.c create mode 100644 Libraries/FAAD2/Files/libfaad/drc.h create mode 100644 Libraries/FAAD2/Files/libfaad/drm_dec.c create mode 100644 Libraries/FAAD2/Files/libfaad/drm_dec.h create mode 100644 Libraries/FAAD2/Files/libfaad/error.c create mode 100644 Libraries/FAAD2/Files/libfaad/error.h create mode 100644 Libraries/FAAD2/Files/libfaad/filtbank.c create mode 100644 Libraries/FAAD2/Files/libfaad/filtbank.h create mode 100644 Libraries/FAAD2/Files/libfaad/fixed.h create mode 100644 Libraries/FAAD2/Files/libfaad/hcr.c create mode 100644 Libraries/FAAD2/Files/libfaad/huffman.c create mode 100644 Libraries/FAAD2/Files/libfaad/huffman.h create mode 100644 Libraries/FAAD2/Files/libfaad/ic_predict.c create mode 100644 Libraries/FAAD2/Files/libfaad/ic_predict.h create mode 100644 Libraries/FAAD2/Files/libfaad/iq_table.h create mode 100644 Libraries/FAAD2/Files/libfaad/is.c create mode 100644 Libraries/FAAD2/Files/libfaad/is.h create mode 100644 Libraries/FAAD2/Files/libfaad/kbd_win.h create mode 100644 Libraries/FAAD2/Files/libfaad/libfaad.dsp create mode 100644 Libraries/FAAD2/Files/libfaad/libfaad.dsw create mode 100644 Libraries/FAAD2/Files/libfaad/libfaad.sln create mode 100644 Libraries/FAAD2/Files/libfaad/libfaad.vcproj create mode 100644 Libraries/FAAD2/Files/libfaad/libfaad2.def create mode 100644 Libraries/FAAD2/Files/libfaad/libfaad2.vcp create mode 100644 Libraries/FAAD2/Files/libfaad/libfaad2.vcw create mode 100644 Libraries/FAAD2/Files/libfaad/libfaad2_dll.dsp create mode 100644 Libraries/FAAD2/Files/libfaad/libfaad2_dll.dsw create mode 100644 Libraries/FAAD2/Files/libfaad/libfaad2_dll.sln create mode 100644 Libraries/FAAD2/Files/libfaad/libfaad2_dll.vcproj create mode 100644 Libraries/FAAD2/Files/libfaad/lt_predict.c create mode 100644 Libraries/FAAD2/Files/libfaad/lt_predict.h create mode 100644 Libraries/FAAD2/Files/libfaad/mdct.c create mode 100644 Libraries/FAAD2/Files/libfaad/mdct.h create mode 100644 Libraries/FAAD2/Files/libfaad/mdct_tab.h create mode 100644 Libraries/FAAD2/Files/libfaad/mp4.c create mode 100644 Libraries/FAAD2/Files/libfaad/mp4.h create mode 100644 Libraries/FAAD2/Files/libfaad/ms.c create mode 100644 Libraries/FAAD2/Files/libfaad/ms.h create mode 100644 Libraries/FAAD2/Files/libfaad/output.c create mode 100644 Libraries/FAAD2/Files/libfaad/output.h create mode 100644 Libraries/FAAD2/Files/libfaad/pns.c create mode 100644 Libraries/FAAD2/Files/libfaad/pns.h create mode 100644 Libraries/FAAD2/Files/libfaad/ps_dec.c create mode 100644 Libraries/FAAD2/Files/libfaad/ps_dec.h create mode 100644 Libraries/FAAD2/Files/libfaad/ps_syntax.c create mode 100644 Libraries/FAAD2/Files/libfaad/ps_tables.h create mode 100644 Libraries/FAAD2/Files/libfaad/pulse.c create mode 100644 Libraries/FAAD2/Files/libfaad/pulse.h create mode 100644 Libraries/FAAD2/Files/libfaad/rvlc.c create mode 100644 Libraries/FAAD2/Files/libfaad/rvlc.h create mode 100644 Libraries/FAAD2/Files/libfaad/sbr_dct.c create mode 100644 Libraries/FAAD2/Files/libfaad/sbr_dct.h create mode 100644 Libraries/FAAD2/Files/libfaad/sbr_dec.c create mode 100644 Libraries/FAAD2/Files/libfaad/sbr_dec.h create mode 100644 Libraries/FAAD2/Files/libfaad/sbr_e_nf.c create mode 100644 Libraries/FAAD2/Files/libfaad/sbr_e_nf.h create mode 100644 Libraries/FAAD2/Files/libfaad/sbr_fbt.c create mode 100644 Libraries/FAAD2/Files/libfaad/sbr_fbt.h create mode 100644 Libraries/FAAD2/Files/libfaad/sbr_hfadj.c create mode 100644 Libraries/FAAD2/Files/libfaad/sbr_hfadj.h create mode 100644 Libraries/FAAD2/Files/libfaad/sbr_hfgen.c create mode 100644 Libraries/FAAD2/Files/libfaad/sbr_hfgen.h create mode 100644 Libraries/FAAD2/Files/libfaad/sbr_huff.c create mode 100644 Libraries/FAAD2/Files/libfaad/sbr_huff.h create mode 100644 Libraries/FAAD2/Files/libfaad/sbr_noise.h create mode 100644 Libraries/FAAD2/Files/libfaad/sbr_qmf.c create mode 100644 Libraries/FAAD2/Files/libfaad/sbr_qmf.h create mode 100644 Libraries/FAAD2/Files/libfaad/sbr_qmf_c.h create mode 100644 Libraries/FAAD2/Files/libfaad/sbr_syntax.c create mode 100644 Libraries/FAAD2/Files/libfaad/sbr_syntax.h create mode 100644 Libraries/FAAD2/Files/libfaad/sbr_tf_grid.c create mode 100644 Libraries/FAAD2/Files/libfaad/sbr_tf_grid.h create mode 100644 Libraries/FAAD2/Files/libfaad/sine_win.h create mode 100644 Libraries/FAAD2/Files/libfaad/specrec.c create mode 100644 Libraries/FAAD2/Files/libfaad/specrec.h create mode 100644 Libraries/FAAD2/Files/libfaad/ssr.c create mode 100644 Libraries/FAAD2/Files/libfaad/ssr.h create mode 100644 Libraries/FAAD2/Files/libfaad/ssr_fb.c create mode 100644 Libraries/FAAD2/Files/libfaad/ssr_fb.h create mode 100644 Libraries/FAAD2/Files/libfaad/ssr_ipqf.c create mode 100644 Libraries/FAAD2/Files/libfaad/ssr_ipqf.h create mode 100644 Libraries/FAAD2/Files/libfaad/ssr_win.h create mode 100644 Libraries/FAAD2/Files/libfaad/structs.h create mode 100644 Libraries/FAAD2/Files/libfaad/syntax.c create mode 100644 Libraries/FAAD2/Files/libfaad/syntax.h create mode 100644 Libraries/FAAD2/Files/libfaad/tns.c create mode 100644 Libraries/FAAD2/Files/libfaad/tns.h create mode 100644 Libraries/FAAD2/Info.plist create mode 100644 Libraries/FLAC/English.lproj/InfoPlist.strings create mode 100644 Libraries/FLAC/FLAC.xcode/project.pbxproj create mode 100644 Libraries/FLAC/FLAC.xcode/xugg.mode1 create mode 100644 Libraries/FLAC/FLAC.xcode/xugg.pbxuser create mode 100644 Libraries/FLAC/Files/AUTHORS create mode 100644 Libraries/FLAC/Files/COPYING.FDL create mode 100644 Libraries/FLAC/Files/COPYING.GPL create mode 100644 Libraries/FLAC/Files/COPYING.LGPL create mode 100644 Libraries/FLAC/Files/COPYING.Xiph create mode 100644 Libraries/FLAC/Files/include/FLAC/Makefile.am create mode 100644 Libraries/FLAC/Files/include/FLAC/Makefile.in create mode 100644 Libraries/FLAC/Files/include/FLAC/all.h create mode 100644 Libraries/FLAC/Files/include/FLAC/assert.h create mode 100644 Libraries/FLAC/Files/include/FLAC/callback.h create mode 100644 Libraries/FLAC/Files/include/FLAC/export.h create mode 100644 Libraries/FLAC/Files/include/FLAC/file_decoder.h create mode 100644 Libraries/FLAC/Files/include/FLAC/file_encoder.h create mode 100644 Libraries/FLAC/Files/include/FLAC/format.h create mode 100644 Libraries/FLAC/Files/include/FLAC/metadata.h create mode 100644 Libraries/FLAC/Files/include/FLAC/ordinals.h create mode 100644 Libraries/FLAC/Files/include/FLAC/seekable_stream_decoder.h create mode 100644 Libraries/FLAC/Files/include/FLAC/seekable_stream_encoder.h create mode 100644 Libraries/FLAC/Files/include/FLAC/stream_decoder.h create mode 100644 Libraries/FLAC/Files/include/FLAC/stream_encoder.h create mode 100644 Libraries/FLAC/Files/include/OggFLAC/Makefile.am create mode 100644 Libraries/FLAC/Files/include/OggFLAC/Makefile.in create mode 100644 Libraries/FLAC/Files/include/OggFLAC/all.h create mode 100644 Libraries/FLAC/Files/include/OggFLAC/export.h create mode 100644 Libraries/FLAC/Files/include/OggFLAC/file_decoder.h create mode 100644 Libraries/FLAC/Files/include/OggFLAC/file_encoder.h create mode 100644 Libraries/FLAC/Files/include/OggFLAC/seekable_stream_decoder.h create mode 100644 Libraries/FLAC/Files/include/OggFLAC/seekable_stream_encoder.h create mode 100644 Libraries/FLAC/Files/include/OggFLAC/stream_decoder.h create mode 100644 Libraries/FLAC/Files/include/OggFLAC/stream_encoder.h create mode 100644 Libraries/FLAC/Files/include/share/Makefile.am create mode 100644 Libraries/FLAC/Files/include/share/Makefile.in create mode 100644 Libraries/FLAC/Files/include/share/getopt.h create mode 100644 Libraries/FLAC/Files/include/share/grabbag.h create mode 100644 Libraries/FLAC/Files/include/share/grabbag/Makefile.am create mode 100644 Libraries/FLAC/Files/include/share/grabbag/Makefile.in create mode 100644 Libraries/FLAC/Files/include/share/grabbag/cuesheet.h create mode 100644 Libraries/FLAC/Files/include/share/grabbag/file.h create mode 100644 Libraries/FLAC/Files/include/share/grabbag/replaygain.h create mode 100644 Libraries/FLAC/Files/include/share/grabbag/seektable.h create mode 100644 Libraries/FLAC/Files/include/share/replaygain_analysis.h create mode 100644 Libraries/FLAC/Files/include/share/replaygain_synthesis.h create mode 100644 Libraries/FLAC/Files/include/share/utf8.h create mode 100644 Libraries/FLAC/Files/src/libFLAC/Makefile.am create mode 100644 Libraries/FLAC/Files/src/libFLAC/Makefile.in create mode 100644 Libraries/FLAC/Files/src/libFLAC/Makefile.lite create mode 100644 Libraries/FLAC/Files/src/libFLAC/bitbuffer.c create mode 100644 Libraries/FLAC/Files/src/libFLAC/bitmath.c create mode 100644 Libraries/FLAC/Files/src/libFLAC/cpu.c create mode 100644 Libraries/FLAC/Files/src/libFLAC/crc.c create mode 100644 Libraries/FLAC/Files/src/libFLAC/file_decoder.c create mode 100644 Libraries/FLAC/Files/src/libFLAC/file_encoder.c create mode 100644 Libraries/FLAC/Files/src/libFLAC/fixed.c create mode 100644 Libraries/FLAC/Files/src/libFLAC/float.c create mode 100644 Libraries/FLAC/Files/src/libFLAC/format.c create mode 100644 Libraries/FLAC/Files/src/libFLAC/ia32/Makefile.am create mode 100644 Libraries/FLAC/Files/src/libFLAC/ia32/Makefile.in create mode 100644 Libraries/FLAC/Files/src/libFLAC/ia32/cpu_asm.nasm create mode 100644 Libraries/FLAC/Files/src/libFLAC/ia32/fixed_asm.nasm create mode 100644 Libraries/FLAC/Files/src/libFLAC/ia32/lpc_asm.nasm create mode 100644 Libraries/FLAC/Files/src/libFLAC/ia32/nasm.h create mode 100644 Libraries/FLAC/Files/src/libFLAC/include/Makefile.am create mode 100644 Libraries/FLAC/Files/src/libFLAC/include/Makefile.in create mode 100644 Libraries/FLAC/Files/src/libFLAC/include/private/Makefile.am create mode 100644 Libraries/FLAC/Files/src/libFLAC/include/private/Makefile.in create mode 100644 Libraries/FLAC/Files/src/libFLAC/include/private/all.h create mode 100644 Libraries/FLAC/Files/src/libFLAC/include/private/bitbuffer.h create mode 100644 Libraries/FLAC/Files/src/libFLAC/include/private/bitmath.h create mode 100644 Libraries/FLAC/Files/src/libFLAC/include/private/cpu.h create mode 100644 Libraries/FLAC/Files/src/libFLAC/include/private/crc.h create mode 100644 Libraries/FLAC/Files/src/libFLAC/include/private/fixed.h create mode 100644 Libraries/FLAC/Files/src/libFLAC/include/private/float.h create mode 100644 Libraries/FLAC/Files/src/libFLAC/include/private/format.h create mode 100644 Libraries/FLAC/Files/src/libFLAC/include/private/lpc.h create mode 100644 Libraries/FLAC/Files/src/libFLAC/include/private/md5.h create mode 100644 Libraries/FLAC/Files/src/libFLAC/include/private/memory.h create mode 100644 Libraries/FLAC/Files/src/libFLAC/include/private/metadata.h create mode 100644 Libraries/FLAC/Files/src/libFLAC/include/private/stream_encoder_framing.h create mode 100644 Libraries/FLAC/Files/src/libFLAC/include/protected/Makefile.am create mode 100644 Libraries/FLAC/Files/src/libFLAC/include/protected/Makefile.in create mode 100644 Libraries/FLAC/Files/src/libFLAC/include/protected/all.h create mode 100644 Libraries/FLAC/Files/src/libFLAC/include/protected/file_decoder.h create mode 100644 Libraries/FLAC/Files/src/libFLAC/include/protected/file_encoder.h create mode 100644 Libraries/FLAC/Files/src/libFLAC/include/protected/seekable_stream_decoder.h create mode 100644 Libraries/FLAC/Files/src/libFLAC/include/protected/seekable_stream_encoder.h create mode 100644 Libraries/FLAC/Files/src/libFLAC/include/protected/stream_decoder.h create mode 100644 Libraries/FLAC/Files/src/libFLAC/include/protected/stream_encoder.h create mode 100644 Libraries/FLAC/Files/src/libFLAC/libFLAC.m4 create mode 100644 Libraries/FLAC/Files/src/libFLAC/libFLAC_dynamic.dsp create mode 100644 Libraries/FLAC/Files/src/libFLAC/libFLAC_static.dsp create mode 100644 Libraries/FLAC/Files/src/libFLAC/lpc.c create mode 100644 Libraries/FLAC/Files/src/libFLAC/md5.c create mode 100644 Libraries/FLAC/Files/src/libFLAC/memory.c create mode 100644 Libraries/FLAC/Files/src/libFLAC/metadata_iterators.c create mode 100644 Libraries/FLAC/Files/src/libFLAC/metadata_object.c create mode 100644 Libraries/FLAC/Files/src/libFLAC/ppc/Makefile.am create mode 100644 Libraries/FLAC/Files/src/libFLAC/ppc/Makefile.in create mode 100644 Libraries/FLAC/Files/src/libFLAC/ppc/as/Makefile.am create mode 100644 Libraries/FLAC/Files/src/libFLAC/ppc/as/Makefile.in create mode 100644 Libraries/FLAC/Files/src/libFLAC/ppc/as/lpc_asm.s create mode 100644 Libraries/FLAC/Files/src/libFLAC/ppc/gas/Makefile.am create mode 100644 Libraries/FLAC/Files/src/libFLAC/ppc/gas/Makefile.in create mode 100644 Libraries/FLAC/Files/src/libFLAC/ppc/gas/lpc_asm.s create mode 100644 Libraries/FLAC/Files/src/libFLAC/seekable_stream_decoder.c create mode 100644 Libraries/FLAC/Files/src/libFLAC/seekable_stream_encoder.c create mode 100644 Libraries/FLAC/Files/src/libFLAC/stream_decoder.c create mode 100644 Libraries/FLAC/Files/src/libFLAC/stream_encoder.c create mode 100644 Libraries/FLAC/Files/src/libFLAC/stream_encoder_framing.c create mode 100644 Libraries/FLAC/Files/src/libOggFLAC/Makefile.am create mode 100644 Libraries/FLAC/Files/src/libOggFLAC/Makefile.in create mode 100644 Libraries/FLAC/Files/src/libOggFLAC/Makefile.lite create mode 100644 Libraries/FLAC/Files/src/libOggFLAC/file_decoder.c create mode 100644 Libraries/FLAC/Files/src/libOggFLAC/file_encoder.c create mode 100644 Libraries/FLAC/Files/src/libOggFLAC/include/Makefile.am create mode 100644 Libraries/FLAC/Files/src/libOggFLAC/include/Makefile.in create mode 100644 Libraries/FLAC/Files/src/libOggFLAC/include/private/Makefile.am create mode 100644 Libraries/FLAC/Files/src/libOggFLAC/include/private/Makefile.in create mode 100644 Libraries/FLAC/Files/src/libOggFLAC/include/private/all.h create mode 100644 Libraries/FLAC/Files/src/libOggFLAC/include/private/ogg_decoder_aspect.h create mode 100644 Libraries/FLAC/Files/src/libOggFLAC/include/private/ogg_encoder_aspect.h create mode 100644 Libraries/FLAC/Files/src/libOggFLAC/include/private/ogg_helper.h create mode 100644 Libraries/FLAC/Files/src/libOggFLAC/include/private/ogg_mapping.h create mode 100644 Libraries/FLAC/Files/src/libOggFLAC/include/protected/Makefile.am create mode 100644 Libraries/FLAC/Files/src/libOggFLAC/include/protected/Makefile.in create mode 100644 Libraries/FLAC/Files/src/libOggFLAC/include/protected/all.h create mode 100644 Libraries/FLAC/Files/src/libOggFLAC/include/protected/file_decoder.h create mode 100644 Libraries/FLAC/Files/src/libOggFLAC/include/protected/file_encoder.h create mode 100644 Libraries/FLAC/Files/src/libOggFLAC/include/protected/seekable_stream_decoder.h create mode 100644 Libraries/FLAC/Files/src/libOggFLAC/include/protected/seekable_stream_encoder.h create mode 100644 Libraries/FLAC/Files/src/libOggFLAC/include/protected/stream_decoder.h create mode 100644 Libraries/FLAC/Files/src/libOggFLAC/include/protected/stream_encoder.h create mode 100644 Libraries/FLAC/Files/src/libOggFLAC/libOggFLAC.m4 create mode 100644 Libraries/FLAC/Files/src/libOggFLAC/libOggFLAC_dynamic.dsp create mode 100644 Libraries/FLAC/Files/src/libOggFLAC/libOggFLAC_static.dsp create mode 100644 Libraries/FLAC/Files/src/libOggFLAC/ogg_decoder_aspect.c create mode 100644 Libraries/FLAC/Files/src/libOggFLAC/ogg_encoder_aspect.c create mode 100644 Libraries/FLAC/Files/src/libOggFLAC/ogg_helper.c create mode 100644 Libraries/FLAC/Files/src/libOggFLAC/ogg_mapping.c create mode 100644 Libraries/FLAC/Files/src/libOggFLAC/seekable_stream_decoder.c create mode 100644 Libraries/FLAC/Files/src/libOggFLAC/seekable_stream_encoder.c create mode 100644 Libraries/FLAC/Files/src/libOggFLAC/stream_decoder.c create mode 100644 Libraries/FLAC/Files/src/libOggFLAC/stream_encoder.c create mode 100644 Libraries/FLAC/Files/src/share/Makefile.am create mode 100644 Libraries/FLAC/Files/src/share/Makefile.in create mode 100644 Libraries/FLAC/Files/src/share/Makefile.lite create mode 100644 Libraries/FLAC/Files/src/share/README create mode 100644 Libraries/FLAC/Files/src/share/getopt/Makefile.am create mode 100644 Libraries/FLAC/Files/src/share/getopt/Makefile.in create mode 100644 Libraries/FLAC/Files/src/share/getopt/Makefile.lite create mode 100644 Libraries/FLAC/Files/src/share/getopt/getopt.c create mode 100644 Libraries/FLAC/Files/src/share/getopt/getopt1.c create mode 100644 Libraries/FLAC/Files/src/share/getopt/getopt_static.dsp create mode 100644 Libraries/FLAC/Files/src/share/grabbag/Makefile.am create mode 100644 Libraries/FLAC/Files/src/share/grabbag/Makefile.in create mode 100644 Libraries/FLAC/Files/src/share/grabbag/Makefile.lite create mode 100644 Libraries/FLAC/Files/src/share/grabbag/cuesheet.c create mode 100644 Libraries/FLAC/Files/src/share/grabbag/file.c create mode 100644 Libraries/FLAC/Files/src/share/grabbag/grabbag_static.dsp create mode 100644 Libraries/FLAC/Files/src/share/grabbag/replaygain.c create mode 100644 Libraries/FLAC/Files/src/share/grabbag/seektable.c create mode 100644 Libraries/FLAC/Files/src/share/replaygain_analysis/Makefile.am create mode 100644 Libraries/FLAC/Files/src/share/replaygain_analysis/Makefile.in create mode 100644 Libraries/FLAC/Files/src/share/replaygain_analysis/Makefile.lite create mode 100644 Libraries/FLAC/Files/src/share/replaygain_analysis/replaygain_analysis.c create mode 100644 Libraries/FLAC/Files/src/share/replaygain_analysis/replaygain_analysis_static.dsp create mode 100644 Libraries/FLAC/Files/src/share/replaygain_synthesis/Makefile.am create mode 100644 Libraries/FLAC/Files/src/share/replaygain_synthesis/Makefile.in create mode 100644 Libraries/FLAC/Files/src/share/replaygain_synthesis/Makefile.lite create mode 100644 Libraries/FLAC/Files/src/share/replaygain_synthesis/include/Makefile.am create mode 100644 Libraries/FLAC/Files/src/share/replaygain_synthesis/include/Makefile.in create mode 100644 Libraries/FLAC/Files/src/share/replaygain_synthesis/include/private/Makefile.am create mode 100644 Libraries/FLAC/Files/src/share/replaygain_synthesis/include/private/Makefile.in create mode 100644 Libraries/FLAC/Files/src/share/replaygain_synthesis/include/private/fast_float_math_hack.h create mode 100644 Libraries/FLAC/Files/src/share/replaygain_synthesis/replaygain_synthesis.c create mode 100644 Libraries/FLAC/Files/src/share/replaygain_synthesis/replaygain_synthesis_static.dsp create mode 100644 Libraries/FLAC/Files/src/share/utf8/Makefile.am create mode 100644 Libraries/FLAC/Files/src/share/utf8/Makefile.in create mode 100644 Libraries/FLAC/Files/src/share/utf8/Makefile.lite create mode 100644 Libraries/FLAC/Files/src/share/utf8/charmaps.h create mode 100644 Libraries/FLAC/Files/src/share/utf8/charset.c create mode 100644 Libraries/FLAC/Files/src/share/utf8/charset.h create mode 100644 Libraries/FLAC/Files/src/share/utf8/charset_test.c create mode 100644 Libraries/FLAC/Files/src/share/utf8/charsetmap.h create mode 100644 Libraries/FLAC/Files/src/share/utf8/iconvert.c create mode 100644 Libraries/FLAC/Files/src/share/utf8/makemap.c create mode 100644 Libraries/FLAC/Files/src/share/utf8/utf8.c create mode 100644 Libraries/FLAC/Files/src/share/utf8/utf8_static.dsp create mode 100644 Libraries/FLAC/Info.plist create mode 100644 Libraries/MAC/.DS_Store create mode 100644 Libraries/MAC/English.lproj/InfoPlist.strings create mode 100644 Libraries/MAC/Files/.DS_Store create mode 100644 Libraries/MAC/Files/Shared/.DS_Store create mode 100755 Libraries/MAC/Files/Shared/APETag.h create mode 100755 Libraries/MAC/Files/Shared/All.h create mode 100755 Libraries/MAC/Files/Shared/IO.h create mode 100755 Libraries/MAC/Files/Shared/MACDll.h create mode 100755 Libraries/MAC/Files/Shared/MACLib.h create mode 100755 Libraries/MAC/Files/Shared/SmartPtr.h create mode 100644 Libraries/MAC/Files/Source/.DS_Store create mode 100644 Libraries/MAC/Files/Source/.gdb_history create mode 100755 Libraries/MAC/Files/Source/Credits.txt create mode 100755 Libraries/MAC/Files/Source/History.txt create mode 100755 Libraries/MAC/Files/Source/License.htm create mode 100644 Libraries/MAC/Files/Source/MACLib/.DS_Store create mode 100755 Libraries/MAC/Files/Source/MACLib/APECompress.cpp create mode 100755 Libraries/MAC/Files/Source/MACLib/APECompress.h create mode 100755 Libraries/MAC/Files/Source/MACLib/APECompressCore.cpp create mode 100755 Libraries/MAC/Files/Source/MACLib/APECompressCore.h create mode 100755 Libraries/MAC/Files/Source/MACLib/APECompressCreate.cpp create mode 100755 Libraries/MAC/Files/Source/MACLib/APECompressCreate.h create mode 100755 Libraries/MAC/Files/Source/MACLib/APEDecompress.cpp create mode 100755 Libraries/MAC/Files/Source/MACLib/APEDecompress.h create mode 100755 Libraries/MAC/Files/Source/MACLib/APEHeader.cpp create mode 100755 Libraries/MAC/Files/Source/MACLib/APEHeader.h create mode 100755 Libraries/MAC/Files/Source/MACLib/APEInfo.cpp create mode 100755 Libraries/MAC/Files/Source/MACLib/APEInfo.h create mode 100755 Libraries/MAC/Files/Source/MACLib/APELink.cpp create mode 100755 Libraries/MAC/Files/Source/MACLib/APELink.h create mode 100755 Libraries/MAC/Files/Source/MACLib/APESimple.cpp create mode 100755 Libraries/MAC/Files/Source/MACLib/APETag.cpp create mode 100755 Libraries/MAC/Files/Source/MACLib/APETag.h create mode 100755 Libraries/MAC/Files/Source/MACLib/Assembly/Assembly.h create mode 100755 Libraries/MAC/Files/Source/MACLib/Assembly/Assembly.nas create mode 100755 Libraries/MAC/Files/Source/MACLib/Assembly/Tools.inc create mode 100755 Libraries/MAC/Files/Source/MACLib/BitArray.cpp create mode 100755 Libraries/MAC/Files/Source/MACLib/BitArray.h create mode 100755 Libraries/MAC/Files/Source/MACLib/MACLib.cpp create mode 100755 Libraries/MAC/Files/Source/MACLib/MACLib.h create mode 100755 Libraries/MAC/Files/Source/MACLib/MACLib.vcproj create mode 100755 Libraries/MAC/Files/Source/MACLib/MACProgressHelper.cpp create mode 100755 Libraries/MAC/Files/Source/MACLib/MACProgressHelper.h create mode 100755 Libraries/MAC/Files/Source/MACLib/MD5.cpp create mode 100755 Libraries/MAC/Files/Source/MACLib/MultichannelNNFilter.h create mode 100755 Libraries/MAC/Files/Source/MACLib/NNFilter.cpp create mode 100755 Libraries/MAC/Files/Source/MACLib/NNFilter.h create mode 100755 Libraries/MAC/Files/Source/MACLib/NewPredictor.cpp create mode 100755 Libraries/MAC/Files/Source/MACLib/NewPredictor.h create mode 100755 Libraries/MAC/Files/Source/MACLib/Old/APEDecompressCore.cpp create mode 100755 Libraries/MAC/Files/Source/MACLib/Old/APEDecompressCore.h create mode 100755 Libraries/MAC/Files/Source/MACLib/Old/APEDecompressOld.cpp create mode 100755 Libraries/MAC/Files/Source/MACLib/Old/APEDecompressOld.h create mode 100755 Libraries/MAC/Files/Source/MACLib/Old/Anti-Predictor.cpp create mode 100755 Libraries/MAC/Files/Source/MACLib/Old/Anti-Predictor.h create mode 100755 Libraries/MAC/Files/Source/MACLib/Old/AntiPredictorExtraHigh.cpp create mode 100755 Libraries/MAC/Files/Source/MACLib/Old/AntiPredictorFast.cpp create mode 100755 Libraries/MAC/Files/Source/MACLib/Old/AntiPredictorHigh.cpp create mode 100755 Libraries/MAC/Files/Source/MACLib/Old/AntiPredictorNormal.cpp create mode 100755 Libraries/MAC/Files/Source/MACLib/Old/UnBitArrayOld.cpp create mode 100755 Libraries/MAC/Files/Source/MACLib/Old/UnBitArrayOld.h create mode 100755 Libraries/MAC/Files/Source/MACLib/Old/UnMAC.cpp create mode 100755 Libraries/MAC/Files/Source/MACLib/Old/UnMAC.h create mode 100755 Libraries/MAC/Files/Source/MACLib/Predictor.h create mode 100755 Libraries/MAC/Files/Source/MACLib/Prepare.cpp create mode 100755 Libraries/MAC/Files/Source/MACLib/Prepare.h create mode 100755 Libraries/MAC/Files/Source/MACLib/ScaledFirstOrderFilter.h create mode 100755 Libraries/MAC/Files/Source/MACLib/StartFilter.h create mode 100755 Libraries/MAC/Files/Source/MACLib/UnBitArray.cpp create mode 100755 Libraries/MAC/Files/Source/MACLib/UnBitArray.h create mode 100755 Libraries/MAC/Files/Source/MACLib/UnBitArrayBase.cpp create mode 100755 Libraries/MAC/Files/Source/MACLib/UnBitArrayBase.h create mode 100755 Libraries/MAC/Files/Source/MACLib/WAVInputSource.cpp create mode 100755 Libraries/MAC/Files/Source/MACLib/WAVInputSource.h create mode 100755 Libraries/MAC/Files/Source/MACLib/md5.h create mode 100755 Libraries/MAC/Files/Source/Readme.htm create mode 100644 Libraries/MAC/Files/Source/Shared/.DS_Store create mode 100755 Libraries/MAC/Files/Source/Shared/APEInfoDialog.cpp create mode 100755 Libraries/MAC/Files/Source/Shared/APEInfoDialog.h create mode 100755 Libraries/MAC/Files/Source/Shared/All.h create mode 100755 Libraries/MAC/Files/Source/Shared/CharacterHelper.cpp create mode 100755 Libraries/MAC/Files/Source/Shared/CharacterHelper.h create mode 100755 Libraries/MAC/Files/Source/Shared/CircleBuffer.cpp create mode 100755 Libraries/MAC/Files/Source/Shared/CircleBuffer.h create mode 100755 Libraries/MAC/Files/Source/Shared/GlobalFunctions.cpp create mode 100755 Libraries/MAC/Files/Source/Shared/GlobalFunctions.h create mode 100755 Libraries/MAC/Files/Source/Shared/ID3Genres.h create mode 100755 Libraries/MAC/Files/Source/Shared/IO.h create mode 100755 Libraries/MAC/Files/Source/Shared/NoWindows.h create mode 100755 Libraries/MAC/Files/Source/Shared/RollBuffer.h create mode 100755 Libraries/MAC/Files/Source/Shared/SmartPtr.h create mode 100755 Libraries/MAC/Files/Source/Shared/StdLibFileIO.cpp create mode 100755 Libraries/MAC/Files/Source/Shared/StdLibFileIO.h create mode 100755 Libraries/MAC/Files/Source/Shared/StdString.h create mode 100755 Libraries/MAC/Files/Source/Shared/Unicows.cpp create mode 100755 Libraries/MAC/Files/Source/Shared/WAVInfoDialog.cpp create mode 100755 Libraries/MAC/Files/Source/Shared/WAVInfoDialog.h create mode 100755 Libraries/MAC/Files/Source/Shared/WinFileIO.cpp create mode 100755 Libraries/MAC/Files/Source/Shared/WinFileIO.h create mode 100644 Libraries/MAC/Info.plist create mode 100644 Libraries/MAC/MAC.xcode/project.pbxproj create mode 100644 Libraries/MAC/MAC.xcode/xugg.mode1 create mode 100644 Libraries/MAC/MAC.xcode/xugg.pbxuser create mode 100644 Libraries/MPCDec/English.lproj/InfoPlist.strings create mode 100644 Libraries/MPCDec/Files/AUTHORS create mode 100644 Libraries/MPCDec/Files/COPYING create mode 100644 Libraries/MPCDec/Files/ChangeLog create mode 100644 Libraries/MPCDec/Files/INSTALL create mode 100644 Libraries/MPCDec/Files/README create mode 100644 Libraries/MPCDec/Files/include/config.h create mode 100644 Libraries/MPCDec/Files/include/mainpage.h create mode 100644 Libraries/MPCDec/Files/include/mpcdec/config_types.h create mode 100644 Libraries/MPCDec/Files/include/mpcdec/config_types.h.in create mode 100644 Libraries/MPCDec/Files/include/mpcdec/config_win32.h create mode 100644 Libraries/MPCDec/Files/include/mpcdec/decoder.h create mode 100644 Libraries/MPCDec/Files/include/mpcdec/huffman.h create mode 100644 Libraries/MPCDec/Files/include/mpcdec/internal.h create mode 100644 Libraries/MPCDec/Files/include/mpcdec/math.h create mode 100644 Libraries/MPCDec/Files/include/mpcdec/mpcdec.h create mode 100644 Libraries/MPCDec/Files/include/mpcdec/reader.h create mode 100644 Libraries/MPCDec/Files/include/mpcdec/requant.h create mode 100644 Libraries/MPCDec/Files/include/mpcdec/streaminfo.h create mode 100644 Libraries/MPCDec/Files/src/huffsv46.c create mode 100644 Libraries/MPCDec/Files/src/huffsv7.c create mode 100644 Libraries/MPCDec/Files/src/idtag.c create mode 100644 Libraries/MPCDec/Files/src/mpc_decoder.c create mode 100644 Libraries/MPCDec/Files/src/mpc_reader.c create mode 100644 Libraries/MPCDec/Files/src/requant.c create mode 100644 Libraries/MPCDec/Files/src/sample.cpp create mode 100644 Libraries/MPCDec/Files/src/streaminfo.c create mode 100644 Libraries/MPCDec/Files/src/synth_filter.c create mode 100644 Libraries/MPCDec/Info.plist create mode 100644 Libraries/MPCDec/MPCDec.xcode/project.pbxproj create mode 100644 Libraries/MPCDec/MPCDec.xcode/xugg.mode1 create mode 100644 Libraries/MPCDec/MPCDec.xcode/xugg.pbxuser create mode 100644 Libraries/Ogg/.cvsignore create mode 100644 Libraries/Ogg/English.lproj/InfoPlist.strings create mode 100644 Libraries/Ogg/Files/AUTHORS create mode 100644 Libraries/Ogg/Files/CHANGES create mode 100644 Libraries/Ogg/Files/COPYING create mode 100644 Libraries/Ogg/Files/HACKING create mode 100644 Libraries/Ogg/Files/README create mode 100644 Libraries/Ogg/Files/include/.cvsignore create mode 100644 Libraries/Ogg/Files/include/ogg/.cvsignore create mode 100644 Libraries/Ogg/Files/include/ogg/config_types.h.in create mode 100644 Libraries/Ogg/Files/include/ogg/ogg.h create mode 100644 Libraries/Ogg/Files/include/ogg/os_types.h create mode 100644 Libraries/Ogg/Files/src/.cvsignore create mode 100644 Libraries/Ogg/Files/src/bitwise.c create mode 100644 Libraries/Ogg/Files/src/framing.c create mode 100644 Libraries/Ogg/Info.plist create mode 100644 Libraries/Ogg/Ogg.xcode/project.pbxproj create mode 100644 Libraries/Ogg/Ogg.xcode/xugg.mode1 create mode 100644 Libraries/Ogg/Ogg.xcode/xugg.pbxuser create mode 100644 Libraries/SndFile/English.lproj/InfoPlist.strings create mode 100644 Libraries/SndFile/Files/AUTHORS create mode 100644 Libraries/SndFile/Files/COPYING create mode 100644 Libraries/SndFile/Files/ChangeLog create mode 100644 Libraries/SndFile/Files/INSTALL create mode 100644 Libraries/SndFile/Files/NEWS create mode 100644 Libraries/SndFile/Files/README create mode 100644 Libraries/SndFile/Files/TODO create mode 100644 Libraries/SndFile/Files/src/G72x/ChangeLog create mode 100644 Libraries/SndFile/Files/src/G72x/Makefile.am create mode 100644 Libraries/SndFile/Files/src/G72x/Makefile.in create mode 100644 Libraries/SndFile/Files/src/G72x/README create mode 100644 Libraries/SndFile/Files/src/G72x/README.original create mode 100644 Libraries/SndFile/Files/src/G72x/g721.c create mode 100644 Libraries/SndFile/Files/src/G72x/g723_16.c create mode 100644 Libraries/SndFile/Files/src/G72x/g723_24.c create mode 100644 Libraries/SndFile/Files/src/G72x/g723_40.c create mode 100644 Libraries/SndFile/Files/src/G72x/g72x.c create mode 100644 Libraries/SndFile/Files/src/G72x/g72x.h create mode 100644 Libraries/SndFile/Files/src/G72x/g72x_priv.h create mode 100644 Libraries/SndFile/Files/src/G72x/g72x_test.c create mode 100644 Libraries/SndFile/Files/src/GSM610/COPYRIGHT create mode 100644 Libraries/SndFile/Files/src/GSM610/ChangeLog create mode 100644 Libraries/SndFile/Files/src/GSM610/Makefile.am create mode 100644 Libraries/SndFile/Files/src/GSM610/Makefile.in create mode 100644 Libraries/SndFile/Files/src/GSM610/README create mode 100644 Libraries/SndFile/Files/src/GSM610/add.c create mode 100644 Libraries/SndFile/Files/src/GSM610/code.c create mode 100644 Libraries/SndFile/Files/src/GSM610/config.h create mode 100644 Libraries/SndFile/Files/src/GSM610/decode.c create mode 100644 Libraries/SndFile/Files/src/GSM610/gsm.h create mode 100644 Libraries/SndFile/Files/src/GSM610/gsm610_priv.h create mode 100644 Libraries/SndFile/Files/src/GSM610/gsm_create.c create mode 100644 Libraries/SndFile/Files/src/GSM610/gsm_decode.c create mode 100644 Libraries/SndFile/Files/src/GSM610/gsm_destroy.c create mode 100644 Libraries/SndFile/Files/src/GSM610/gsm_encode.c create mode 100644 Libraries/SndFile/Files/src/GSM610/gsm_option.c create mode 100644 Libraries/SndFile/Files/src/GSM610/long_term.c create mode 100644 Libraries/SndFile/Files/src/GSM610/lpc.c create mode 100644 Libraries/SndFile/Files/src/GSM610/preprocess.c create mode 100644 Libraries/SndFile/Files/src/GSM610/rpe.c create mode 100644 Libraries/SndFile/Files/src/GSM610/short_term.c create mode 100644 Libraries/SndFile/Files/src/GSM610/table.c create mode 100644 Libraries/SndFile/Files/src/Symbols.darwin create mode 100644 Libraries/SndFile/Files/src/Symbols.linux create mode 100644 Libraries/SndFile/Files/src/aiff.c create mode 100644 Libraries/SndFile/Files/src/alaw.c create mode 100644 Libraries/SndFile/Files/src/au.c create mode 100644 Libraries/SndFile/Files/src/au.h create mode 100644 Libraries/SndFile/Files/src/au_g72x.c create mode 100644 Libraries/SndFile/Files/src/avr.c create mode 100644 Libraries/SndFile/Files/src/command.c create mode 100644 Libraries/SndFile/Files/src/common.c create mode 100644 Libraries/SndFile/Files/src/common.h create mode 100644 Libraries/SndFile/Files/src/config.h create mode 100755 Libraries/SndFile/Files/src/create_symbols_file.py create mode 100644 Libraries/SndFile/Files/src/dither.c create mode 100644 Libraries/SndFile/Files/src/double64.c create mode 100644 Libraries/SndFile/Files/src/dwd.c create mode 100644 Libraries/SndFile/Files/src/dwvw.c create mode 100644 Libraries/SndFile/Files/src/file_io.c create mode 100644 Libraries/SndFile/Files/src/float32.c create mode 100644 Libraries/SndFile/Files/src/float_cast.h create mode 100644 Libraries/SndFile/Files/src/gsm610.c create mode 100644 Libraries/SndFile/Files/src/htk.c create mode 100644 Libraries/SndFile/Files/src/ima_adpcm.c create mode 100644 Libraries/SndFile/Files/src/interleave.c create mode 100644 Libraries/SndFile/Files/src/ircam.c create mode 100644 Libraries/SndFile/Files/src/libsndfile.def create mode 100644 Libraries/SndFile/Files/src/macbinary3.c create mode 100644 Libraries/SndFile/Files/src/macos.c create mode 100644 Libraries/SndFile/Files/src/mat4.c create mode 100644 Libraries/SndFile/Files/src/mat5.c create mode 100644 Libraries/SndFile/Files/src/ms_adpcm.c create mode 100644 Libraries/SndFile/Files/src/nist.c create mode 100644 Libraries/SndFile/Files/src/ogg.c create mode 100644 Libraries/SndFile/Files/src/paf.c create mode 100644 Libraries/SndFile/Files/src/pcm.c create mode 100644 Libraries/SndFile/Files/src/pvf.c create mode 100644 Libraries/SndFile/Files/src/raw.c create mode 100644 Libraries/SndFile/Files/src/rx2.c create mode 100644 Libraries/SndFile/Files/src/sd2.c create mode 100644 Libraries/SndFile/Files/src/sds.c create mode 100644 Libraries/SndFile/Files/src/sf_unistd.h create mode 100644 Libraries/SndFile/Files/src/sfendian.h create mode 100644 Libraries/SndFile/Files/src/sndfile.c create mode 100644 Libraries/SndFile/Files/src/sndfile.h create mode 100644 Libraries/SndFile/Files/src/strings.c create mode 100644 Libraries/SndFile/Files/src/svx.c create mode 100644 Libraries/SndFile/Files/src/test_endswap.c create mode 100644 Libraries/SndFile/Files/src/test_endswap.def create mode 100644 Libraries/SndFile/Files/src/test_endswap.tpl create mode 100644 Libraries/SndFile/Files/src/test_file_io.c create mode 100644 Libraries/SndFile/Files/src/test_log_printf.c create mode 100644 Libraries/SndFile/Files/src/txw.c create mode 100644 Libraries/SndFile/Files/src/ulaw.c create mode 100644 Libraries/SndFile/Files/src/voc.c create mode 100644 Libraries/SndFile/Files/src/vox_adpcm.c create mode 100644 Libraries/SndFile/Files/src/w64.c create mode 100644 Libraries/SndFile/Files/src/wav.c create mode 100644 Libraries/SndFile/Files/src/wav_w64.c create mode 100644 Libraries/SndFile/Files/src/wav_w64.h create mode 100644 Libraries/SndFile/Files/src/wve.c create mode 100644 Libraries/SndFile/Files/src/xi.c create mode 100644 Libraries/SndFile/Info.plist create mode 100644 Libraries/SndFile/SndFile.xcode/project.pbxproj create mode 100644 Libraries/SndFile/SndFile.xcode/xugg.mode1 create mode 100644 Libraries/SndFile/SndFile.xcode/xugg.pbxuser create mode 100644 Libraries/TagLib/English.lproj/InfoPlist.strings create mode 100644 Libraries/TagLib/Files/AUTHORS create mode 100644 Libraries/TagLib/Files/COPYING create mode 100644 Libraries/TagLib/Files/ChangeLog create mode 100644 Libraries/TagLib/Files/INSTALL create mode 100644 Libraries/TagLib/Files/Makefile.am create mode 100644 Libraries/TagLib/Files/Makefile.cvs create mode 100644 Libraries/TagLib/Files/Makefile.in create mode 100644 Libraries/TagLib/Files/README create mode 100644 Libraries/TagLib/Files/TODO create mode 100644 Libraries/TagLib/Files/config.h create mode 100644 Libraries/TagLib/Files/taglib/ape/Makefile.am create mode 100644 Libraries/TagLib/Files/taglib/ape/Makefile.in create mode 100644 Libraries/TagLib/Files/taglib/ape/ape-tag-format.txt create mode 100644 Libraries/TagLib/Files/taglib/ape/apefooter.cpp create mode 100644 Libraries/TagLib/Files/taglib/ape/apefooter.h create mode 100644 Libraries/TagLib/Files/taglib/ape/apeitem.cpp create mode 100644 Libraries/TagLib/Files/taglib/ape/apeitem.h create mode 100644 Libraries/TagLib/Files/taglib/ape/apetag.cpp create mode 100644 Libraries/TagLib/Files/taglib/ape/apetag.h create mode 100644 Libraries/TagLib/Files/taglib/audioproperties.cpp create mode 100644 Libraries/TagLib/Files/taglib/audioproperties.h create mode 100644 Libraries/TagLib/Files/taglib/configure.in.bot create mode 100644 Libraries/TagLib/Files/taglib/configure.in.in create mode 100644 Libraries/TagLib/Files/taglib/fileref.cpp create mode 100644 Libraries/TagLib/Files/taglib/fileref.h create mode 100644 Libraries/TagLib/Files/taglib/flac/Makefile.am create mode 100644 Libraries/TagLib/Files/taglib/flac/Makefile.in create mode 100644 Libraries/TagLib/Files/taglib/flac/flacfile.cpp create mode 100644 Libraries/TagLib/Files/taglib/flac/flacfile.h create mode 100644 Libraries/TagLib/Files/taglib/flac/flacproperties.cpp create mode 100644 Libraries/TagLib/Files/taglib/flac/flacproperties.h create mode 100644 Libraries/TagLib/Files/taglib/flac/flactag.h create mode 100644 Libraries/TagLib/Files/taglib/mpc/Makefile.am create mode 100644 Libraries/TagLib/Files/taglib/mpc/Makefile.in create mode 100644 Libraries/TagLib/Files/taglib/mpc/combinedtag.h create mode 100644 Libraries/TagLib/Files/taglib/mpc/mpcfile.cpp create mode 100644 Libraries/TagLib/Files/taglib/mpc/mpcfile.h create mode 100644 Libraries/TagLib/Files/taglib/mpc/mpcproperties.cpp create mode 100644 Libraries/TagLib/Files/taglib/mpc/mpcproperties.h create mode 100644 Libraries/TagLib/Files/taglib/mpeg/Makefile.am create mode 100644 Libraries/TagLib/Files/taglib/mpeg/Makefile.in create mode 100644 Libraries/TagLib/Files/taglib/mpeg/id3v1/Makefile.am create mode 100644 Libraries/TagLib/Files/taglib/mpeg/id3v1/Makefile.in create mode 100644 Libraries/TagLib/Files/taglib/mpeg/id3v1/id3v1genres.cpp create mode 100644 Libraries/TagLib/Files/taglib/mpeg/id3v1/id3v1genres.h create mode 100644 Libraries/TagLib/Files/taglib/mpeg/id3v1/id3v1tag.cpp create mode 100644 Libraries/TagLib/Files/taglib/mpeg/id3v1/id3v1tag.h create mode 100644 Libraries/TagLib/Files/taglib/mpeg/id3v2/Makefile.am create mode 100644 Libraries/TagLib/Files/taglib/mpeg/id3v2/Makefile.in create mode 100644 Libraries/TagLib/Files/taglib/mpeg/id3v2/frames/Makefile.am create mode 100644 Libraries/TagLib/Files/taglib/mpeg/id3v2/frames/Makefile.in create mode 100644 Libraries/TagLib/Files/taglib/mpeg/id3v2/frames/attachedpictureframe.cpp create mode 100644 Libraries/TagLib/Files/taglib/mpeg/id3v2/frames/attachedpictureframe.h create mode 100644 Libraries/TagLib/Files/taglib/mpeg/id3v2/frames/commentsframe.cpp create mode 100644 Libraries/TagLib/Files/taglib/mpeg/id3v2/frames/commentsframe.h create mode 100644 Libraries/TagLib/Files/taglib/mpeg/id3v2/frames/relativevolumeframe.cpp create mode 100644 Libraries/TagLib/Files/taglib/mpeg/id3v2/frames/relativevolumeframe.h create mode 100644 Libraries/TagLib/Files/taglib/mpeg/id3v2/frames/textidentificationframe.cpp create mode 100644 Libraries/TagLib/Files/taglib/mpeg/id3v2/frames/textidentificationframe.h create mode 100644 Libraries/TagLib/Files/taglib/mpeg/id3v2/frames/uniquefileidentifierframe.cpp create mode 100644 Libraries/TagLib/Files/taglib/mpeg/id3v2/frames/uniquefileidentifierframe.h create mode 100644 Libraries/TagLib/Files/taglib/mpeg/id3v2/frames/unknownframe.cpp create mode 100644 Libraries/TagLib/Files/taglib/mpeg/id3v2/frames/unknownframe.h create mode 100644 Libraries/TagLib/Files/taglib/mpeg/id3v2/id3v2.4.0-frames.txt create mode 100644 Libraries/TagLib/Files/taglib/mpeg/id3v2/id3v2.4.0-structure.txt create mode 100644 Libraries/TagLib/Files/taglib/mpeg/id3v2/id3v2extendedheader.cpp create mode 100644 Libraries/TagLib/Files/taglib/mpeg/id3v2/id3v2extendedheader.h create mode 100644 Libraries/TagLib/Files/taglib/mpeg/id3v2/id3v2footer.cpp create mode 100644 Libraries/TagLib/Files/taglib/mpeg/id3v2/id3v2footer.h create mode 100644 Libraries/TagLib/Files/taglib/mpeg/id3v2/id3v2frame.cpp create mode 100644 Libraries/TagLib/Files/taglib/mpeg/id3v2/id3v2frame.h create mode 100644 Libraries/TagLib/Files/taglib/mpeg/id3v2/id3v2framefactory.cpp create mode 100644 Libraries/TagLib/Files/taglib/mpeg/id3v2/id3v2framefactory.h create mode 100644 Libraries/TagLib/Files/taglib/mpeg/id3v2/id3v2header.cpp create mode 100644 Libraries/TagLib/Files/taglib/mpeg/id3v2/id3v2header.h create mode 100644 Libraries/TagLib/Files/taglib/mpeg/id3v2/id3v2synchdata.cpp create mode 100644 Libraries/TagLib/Files/taglib/mpeg/id3v2/id3v2synchdata.h create mode 100644 Libraries/TagLib/Files/taglib/mpeg/id3v2/id3v2tag.cpp create mode 100644 Libraries/TagLib/Files/taglib/mpeg/id3v2/id3v2tag.h create mode 100644 Libraries/TagLib/Files/taglib/mpeg/mpegfile.cpp create mode 100644 Libraries/TagLib/Files/taglib/mpeg/mpegfile.h create mode 100644 Libraries/TagLib/Files/taglib/mpeg/mpegheader.cpp create mode 100644 Libraries/TagLib/Files/taglib/mpeg/mpegheader.h create mode 100644 Libraries/TagLib/Files/taglib/mpeg/mpegproperties.cpp create mode 100644 Libraries/TagLib/Files/taglib/mpeg/mpegproperties.h create mode 100644 Libraries/TagLib/Files/taglib/mpeg/xingheader.cpp create mode 100644 Libraries/TagLib/Files/taglib/mpeg/xingheader.h create mode 100644 Libraries/TagLib/Files/taglib/ogg/Makefile.am create mode 100644 Libraries/TagLib/Files/taglib/ogg/Makefile.in create mode 100644 Libraries/TagLib/Files/taglib/ogg/flac/Makefile.am create mode 100644 Libraries/TagLib/Files/taglib/ogg/flac/Makefile.in create mode 100644 Libraries/TagLib/Files/taglib/ogg/flac/oggflacfile.cpp create mode 100644 Libraries/TagLib/Files/taglib/ogg/flac/oggflacfile.h create mode 100644 Libraries/TagLib/Files/taglib/ogg/oggfile.cpp create mode 100644 Libraries/TagLib/Files/taglib/ogg/oggfile.h create mode 100644 Libraries/TagLib/Files/taglib/ogg/oggpage.cpp create mode 100644 Libraries/TagLib/Files/taglib/ogg/oggpage.h create mode 100644 Libraries/TagLib/Files/taglib/ogg/oggpageheader.cpp create mode 100644 Libraries/TagLib/Files/taglib/ogg/oggpageheader.h create mode 100644 Libraries/TagLib/Files/taglib/ogg/vorbis/Makefile.am create mode 100644 Libraries/TagLib/Files/taglib/ogg/vorbis/Makefile.in create mode 100644 Libraries/TagLib/Files/taglib/ogg/vorbis/vorbisfile.cpp create mode 100644 Libraries/TagLib/Files/taglib/ogg/vorbis/vorbisfile.h create mode 100644 Libraries/TagLib/Files/taglib/ogg/vorbis/vorbisproperties.cpp create mode 100644 Libraries/TagLib/Files/taglib/ogg/vorbis/vorbisproperties.h create mode 100644 Libraries/TagLib/Files/taglib/ogg/xiphcomment.cpp create mode 100644 Libraries/TagLib/Files/taglib/ogg/xiphcomment.h create mode 100644 Libraries/TagLib/Files/taglib/tag.cpp create mode 100644 Libraries/TagLib/Files/taglib/tag.h create mode 100644 Libraries/TagLib/Files/taglib/taglib-config.in create mode 100644 Libraries/TagLib/Files/taglib/toolkit/Makefile.am create mode 100644 Libraries/TagLib/Files/taglib/toolkit/Makefile.in create mode 100644 Libraries/TagLib/Files/taglib/toolkit/taglib.h create mode 100644 Libraries/TagLib/Files/taglib/toolkit/tbytevector.cpp create mode 100644 Libraries/TagLib/Files/taglib/toolkit/tbytevector.h create mode 100644 Libraries/TagLib/Files/taglib/toolkit/tbytevectorlist.cpp create mode 100644 Libraries/TagLib/Files/taglib/toolkit/tbytevectorlist.h create mode 100644 Libraries/TagLib/Files/taglib/toolkit/tdebug.cpp create mode 100644 Libraries/TagLib/Files/taglib/toolkit/tdebug.h create mode 100644 Libraries/TagLib/Files/taglib/toolkit/tfile.cpp create mode 100644 Libraries/TagLib/Files/taglib/toolkit/tfile.h create mode 100644 Libraries/TagLib/Files/taglib/toolkit/tlist.h create mode 100644 Libraries/TagLib/Files/taglib/toolkit/tlist.tcc create mode 100644 Libraries/TagLib/Files/taglib/toolkit/tmap.h create mode 100644 Libraries/TagLib/Files/taglib/toolkit/tmap.tcc create mode 100644 Libraries/TagLib/Files/taglib/toolkit/tstring.cpp create mode 100644 Libraries/TagLib/Files/taglib/toolkit/tstring.h create mode 100644 Libraries/TagLib/Files/taglib/toolkit/tstringlist.cpp create mode 100644 Libraries/TagLib/Files/taglib/toolkit/tstringlist.h create mode 100644 Libraries/TagLib/Files/taglib/toolkit/unicode.cpp create mode 100644 Libraries/TagLib/Files/taglib/toolkit/unicode.h create mode 100644 Libraries/TagLib/Info.plist create mode 100644 Libraries/TagLib/TagLib.xcode/project.pbxproj create mode 100644 Libraries/TagLib/TagLib.xcode/xugg.mode1 create mode 100644 Libraries/TagLib/TagLib.xcode/xugg.pbxuser create mode 100644 Libraries/Vorbis/.cvsignore create mode 100644 Libraries/Vorbis/English.lproj/InfoPlist.strings create mode 100644 Libraries/Vorbis/Files/AUTHORS create mode 100644 Libraries/Vorbis/Files/CHANGES create mode 100644 Libraries/Vorbis/Files/COPYING create mode 100644 Libraries/Vorbis/Files/README create mode 100644 Libraries/Vorbis/Files/include/.cvsignore create mode 100644 Libraries/Vorbis/Files/include/Makefile.am create mode 100644 Libraries/Vorbis/Files/include/vorbis/.cvsignore create mode 100644 Libraries/Vorbis/Files/include/vorbis/Makefile.am create mode 100644 Libraries/Vorbis/Files/include/vorbis/codec.h create mode 100644 Libraries/Vorbis/Files/include/vorbis/vorbisenc.h create mode 100644 Libraries/Vorbis/Files/include/vorbis/vorbisfile.h create mode 100644 Libraries/Vorbis/Files/lib/.cvsignore create mode 100644 Libraries/Vorbis/Files/lib/Makefile.am create mode 100644 Libraries/Vorbis/Files/lib/analysis.c create mode 100644 Libraries/Vorbis/Files/lib/backends.h create mode 100644 Libraries/Vorbis/Files/lib/barkmel.c create mode 100644 Libraries/Vorbis/Files/lib/bitrate.c create mode 100644 Libraries/Vorbis/Files/lib/bitrate.h create mode 100644 Libraries/Vorbis/Files/lib/block.c create mode 100644 Libraries/Vorbis/Files/lib/books/.cvsignore create mode 100644 Libraries/Vorbis/Files/lib/books/Makefile.am create mode 100644 Libraries/Vorbis/Files/lib/books/coupled/.cvsignore create mode 100644 Libraries/Vorbis/Files/lib/books/coupled/Makefile.am create mode 100644 Libraries/Vorbis/Files/lib/books/coupled/res_books_stereo.h create mode 100644 Libraries/Vorbis/Files/lib/books/floor/.cvsignore create mode 100644 Libraries/Vorbis/Files/lib/books/floor/Makefile.am create mode 100644 Libraries/Vorbis/Files/lib/books/floor/floor_books.h create mode 100644 Libraries/Vorbis/Files/lib/books/uncoupled/.cvsignore create mode 100644 Libraries/Vorbis/Files/lib/books/uncoupled/Makefile.am create mode 100644 Libraries/Vorbis/Files/lib/books/uncoupled/res_books_uncoupled.h create mode 100644 Libraries/Vorbis/Files/lib/codebook.c create mode 100644 Libraries/Vorbis/Files/lib/codebook.h create mode 100644 Libraries/Vorbis/Files/lib/codec_internal.h create mode 100644 Libraries/Vorbis/Files/lib/envelope.c create mode 100644 Libraries/Vorbis/Files/lib/envelope.h create mode 100644 Libraries/Vorbis/Files/lib/floor0.c create mode 100644 Libraries/Vorbis/Files/lib/floor1.c create mode 100644 Libraries/Vorbis/Files/lib/highlevel.h create mode 100644 Libraries/Vorbis/Files/lib/info.c create mode 100644 Libraries/Vorbis/Files/lib/lookup.c create mode 100644 Libraries/Vorbis/Files/lib/lookup.h create mode 100644 Libraries/Vorbis/Files/lib/lookup_data.h create mode 100755 Libraries/Vorbis/Files/lib/lookups.pl create mode 100644 Libraries/Vorbis/Files/lib/lpc.c create mode 100644 Libraries/Vorbis/Files/lib/lpc.h create mode 100644 Libraries/Vorbis/Files/lib/lsp.c create mode 100644 Libraries/Vorbis/Files/lib/lsp.h create mode 100644 Libraries/Vorbis/Files/lib/mapping0.c create mode 100644 Libraries/Vorbis/Files/lib/masking.h create mode 100644 Libraries/Vorbis/Files/lib/mdct.c create mode 100644 Libraries/Vorbis/Files/lib/mdct.h create mode 100644 Libraries/Vorbis/Files/lib/misc.c create mode 100644 Libraries/Vorbis/Files/lib/misc.h create mode 100644 Libraries/Vorbis/Files/lib/modes/.cvsignore create mode 100644 Libraries/Vorbis/Files/lib/modes/Makefile.am create mode 100644 Libraries/Vorbis/Files/lib/modes/floor_all.h create mode 100644 Libraries/Vorbis/Files/lib/modes/psych_11.h create mode 100644 Libraries/Vorbis/Files/lib/modes/psych_16.h create mode 100644 Libraries/Vorbis/Files/lib/modes/psych_44.h create mode 100644 Libraries/Vorbis/Files/lib/modes/psych_8.h create mode 100644 Libraries/Vorbis/Files/lib/modes/residue_16.h create mode 100644 Libraries/Vorbis/Files/lib/modes/residue_44.h create mode 100644 Libraries/Vorbis/Files/lib/modes/residue_44u.h create mode 100644 Libraries/Vorbis/Files/lib/modes/residue_8.h create mode 100644 Libraries/Vorbis/Files/lib/modes/setup_11.h create mode 100644 Libraries/Vorbis/Files/lib/modes/setup_16.h create mode 100644 Libraries/Vorbis/Files/lib/modes/setup_22.h create mode 100644 Libraries/Vorbis/Files/lib/modes/setup_32.h create mode 100644 Libraries/Vorbis/Files/lib/modes/setup_44.h create mode 100644 Libraries/Vorbis/Files/lib/modes/setup_44u.h create mode 100644 Libraries/Vorbis/Files/lib/modes/setup_8.h create mode 100644 Libraries/Vorbis/Files/lib/modes/setup_X.h create mode 100644 Libraries/Vorbis/Files/lib/os.h create mode 100644 Libraries/Vorbis/Files/lib/psy.c create mode 100644 Libraries/Vorbis/Files/lib/psy.h create mode 100644 Libraries/Vorbis/Files/lib/psytune.c create mode 100644 Libraries/Vorbis/Files/lib/registry.c create mode 100644 Libraries/Vorbis/Files/lib/registry.h create mode 100644 Libraries/Vorbis/Files/lib/res0.c create mode 100644 Libraries/Vorbis/Files/lib/scales.h create mode 100644 Libraries/Vorbis/Files/lib/sharedbook.c create mode 100644 Libraries/Vorbis/Files/lib/smallft.c create mode 100644 Libraries/Vorbis/Files/lib/smallft.h create mode 100644 Libraries/Vorbis/Files/lib/synthesis.c create mode 100644 Libraries/Vorbis/Files/lib/tone.c create mode 100644 Libraries/Vorbis/Files/lib/vorbisenc.c create mode 100644 Libraries/Vorbis/Files/lib/vorbisfile.c create mode 100644 Libraries/Vorbis/Files/lib/window.c create mode 100644 Libraries/Vorbis/Files/lib/window.h create mode 100644 Libraries/Vorbis/Files/todo.txt create mode 100644 Libraries/Vorbis/Info.plist create mode 100644 Libraries/Vorbis/Vorbis.xcode/project.pbxproj create mode 100644 Libraries/Vorbis/Vorbis.xcode/xugg.mode1 create mode 100644 Libraries/Vorbis/Vorbis.xcode/xugg.pbxuser create mode 100644 PLANNED create mode 100755 Playlist/DNDArrayController.h create mode 100755 Playlist/DNDArrayController.m create mode 100644 Playlist/PlaylistController.h create mode 100644 Playlist/PlaylistController.m create mode 100644 Playlist/PlaylistEntry.h create mode 100644 Playlist/PlaylistEntry.m create mode 100644 Playlist/PlaylistView.h create mode 100644 Playlist/PlaylistView.m create mode 100644 README create mode 100644 Sound.h create mode 100644 Sound.m create mode 100644 SoundController.h create mode 100644 SoundController.m create mode 100644 SoundFile/AACFile.h create mode 100644 SoundFile/AACFile.m create mode 100644 SoundFile/FlacFile.h create mode 100644 SoundFile/FlacFile.m create mode 100644 SoundFile/MPEGFile.h create mode 100644 SoundFile/MPEGFile.m create mode 100644 SoundFile/MonkeysFile.h create mode 100644 SoundFile/MonkeysFile.m create mode 100644 SoundFile/MusepackFile.h create mode 100644 SoundFile/MusepackFile.m create mode 100644 SoundFile/SoundFile.h create mode 100644 SoundFile/SoundFile.m create mode 100644 SoundFile/VorbisFile.h create mode 100644 SoundFile/VorbisFile.m create mode 100644 SoundFile/WaveFile.h create mode 100644 SoundFile/WaveFile.m create mode 100644 TrackingCell.h create mode 100644 TrackingCell.m create mode 100644 TrackingSlider.h create mode 100644 TrackingSlider.m create mode 100644 Updates/MacPADSocket.h create mode 100644 Updates/MacPADSocket.m create mode 100644 Updates/UpdateController.h create mode 100644 Updates/UpdateController.m create mode 100644 VirtualRingBuffer.h create mode 100644 VirtualRingBuffer.m create mode 100644 main.m create mode 100644 xchat/cog.py create mode 100644 xchat/cog.script diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..6c7c8b7e02161e46ac80318a24409ff2640dfa9f GIT binary patch literal 12292 zcmeHL-A)rh6h6}eEodsnkZ`%idlE0aFW6#85RF9>O^nhXN_E?9N}IriNngQ-@FBeQ zEqn-{LBDfmkeS&65);$NnP&GiyXQOe&3EQ!XNbsbP1+BM)`_T$i|y(y+-4Mh&sVM# z+>-~e26&>31~jG-Y?|}d2daQ7pbDr0s(>mm4+>z-=2E_3-M4S`t_r9EH&Owf9}-+_ ztIkfXm8k( z$+()0+o2e#9k@i?$yBY?yDFdxwI0280+Hu{&{JY1z z;t=oXIe2&I5cQp)9Yf%wdGl`WX5PFW-L=8gWJjbR2myC*N}go&)3|1DhfEFtc%p5jH!}uE@Lo;WV!WWN8=pDC`dHCLUz1Te7&QBsQ zn8}3Q^&&(ZIO9d*F<$mKY$H3UIZ_0y14M=PrGKEWN;bO~k374jd3~7gA7f`Red{q@ z&DGnGd}D3`pImM@>&5Hfqxyxrk1x?njH5RC8D`>mT!^k;J+}Ag71SBQcLGF;9>+bu ziy3HwF?o0i=j%tA#oUjwh?y9(Ff$Kx%d8jHJk}Vdb6tv--8%38>ldH@&vhG=oGPFS z{G9@3q1LEvA%@#q=b{zxB*FC_7Z>)MS}PFT*oB|Vb{zKXTZNw`?p@W{skL~6^3M+f ze(z*-{l^-1{@tPLzy0#LIqScSKfS2}s(>n>3aA3AfGVI0r~;~hDxeCe0;<6OtH3X} Cvz$=? literal 0 HcmV?d00001 diff --git a/AppController.h b/AppController.h new file mode 100644 index 000000000..eff4ba803 --- /dev/null +++ b/AppController.h @@ -0,0 +1,27 @@ +/* AppController */ + +#import + +#import "PlaylistController.h" + +@interface AppController : NSObject +{ + IBOutlet PlaylistController *playlistController; + IBOutlet NSPanel *infoPanel; + IBOutlet NSWindow *mainWindow; +} +- (IBAction)addFiles:(id)sender; +- (IBAction)delEntries:(id)sender; +- (IBAction)showInfo:(id)sender; +- (IBAction)savePlaylist:(id)sender; +- (IBAction)savePlaylistAs:(id)sender; +- (IBAction)loadPlaylist:(id)sender; + +- (void)openPanelDidEnd:(NSOpenPanel *)panel returnCode:(int)returnCode contextInfo:(void *)contextInfo; + +//Fun stuff +- (BOOL)applicationShouldHandleReopen:(NSApplication *)theApplication hasVisibleWindows:(BOOL)flag; +- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename; +- (void)application:(NSApplication *)theApplication openFiles:(NSArray *)filenames; + +@end diff --git a/AppController.m b/AppController.m new file mode 100644 index 000000000..5d84654bb --- /dev/null +++ b/AppController.m @@ -0,0 +1,142 @@ +#import "AppController.h" + +@implementation AppController + +- (IBAction)addFiles:(id)sender +{ + NSOpenPanel *p; + + p = [NSOpenPanel openPanel]; + + [p setCanChooseDirectories:YES]; + [p setAllowsMultipleSelection:YES]; + + // [p beginSheetForDirectory:nil file:nil types:[`listController acceptableFileTypes] modalForWindow:mainWindow modalDelegate:self didEndSelector:@selector(openPanelDidEnd:returnCode:contextInfo:) contextInfo:NULL]; +// [p beginForDirectory:nil file:nil types:[playlistController acceptableFileTypes] modelessDelegate:self didEndSelector:@selector(openPanelDidEnd:returnCode:contextInfo:) contextInfo:nil]; + + if ([p runModalForTypes:[playlistController acceptableFileTypes]] == NSOKButton) + { + [playlistController addPaths:[p filenames] sort:NO]; + } + +} + +- (void)openPanelDidEnd:(NSOpenPanel *)panel returnCode:(int)returnCode contextInfo:(void *)contextInfo +{ + if (returnCode == NSOKButton) + { + [playlistController addPaths:[panel filenames] sort:NO]; + } + + [panel release]; +} + +- (IBAction)delEntries:(id)sender +{ + [playlistController remove:self]; +} + +- (IBAction)showInfo:(id)sender +{ + [infoPanel makeKeyAndOrderFront:self]; +} + +- (PlaylistEntry *)currentEntry +{ + return [playlistController currentEntry]; +} + +- (BOOL)application:(NSApplication *)sender delegateHandlesKey:(NSString *)key +{ +// DBLog(@"W00t"); + return [key isEqualToString:@"currentEntry"]; +} + +- (void)awakeFromNib +{ +// DBLog(@"AWAKe"); + NSString *filename = @"~/Library/Application Support/Cog/Default.playlist"; + [playlistController loadPlaylist:[filename stringByExpandingTildeInPath]]; +} + +- (void)applicationWillTerminate:(NSNotification *)aNotification +{ +// DBLog(@"QUITTING"); + NSFileManager *fileManager = [NSFileManager defaultManager]; + NSString *folder = @"~/Library/Application Support/Cog/"; + + folder = [folder stringByExpandingTildeInPath]; + + if ([fileManager fileExistsAtPath: folder] == NO) + { + [fileManager createDirectoryAtPath: folder attributes: nil]; + } + + NSString *fileName = @"Default.playlist"; + + [playlistController savePlaylist:[folder stringByAppendingPathComponent: fileName]]; + +} + +- (IBAction)savePlaylist:(id)sender +{ + if ([playlistController playlistFilename] == nil) + [self savePlaylistAs:sender]; + + [playlistController savePlaylist:[playlistController playlistFilename]]; +} +- (IBAction)savePlaylistAs:(id)sender +{ + NSSavePanel *p; + + p = [NSSavePanel savePanel]; + + [p setAllowedFileTypes:[playlistController acceptablePlaylistTypes]]; + + if ([p runModalForDirectory:nil file:[[playlistController playlistFilename] lastPathComponent]] == NSOKButton) + { + [playlistController setPlaylistFilename:[p filename]]; + + [playlistController savePlaylist:[p filename]]; + } +} +- (IBAction)loadPlaylist:(id)sender +{ + NSOpenPanel *p; + + p = [NSOpenPanel openPanel]; + + [p setCanChooseDirectories:NO]; + [p setAllowsMultipleSelection:NO]; + + if ([p runModalForTypes:[playlistController acceptablePlaylistTypes]] == NSOKButton) + { + [playlistController setPlaylistFilename:[p filename]]; + + [playlistController loadPlaylist:[p filename]]; + } +} + +- (BOOL)applicationShouldHandleReopen:(NSApplication *)theApplication hasVisibleWindows:(BOOL)flag +{ + // if (flag == NO) + [mainWindow makeKeyAndOrderFront:self]; + + return NO; +} + +- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename +{ + if ([playlistController addPaths:[NSArray arrayWithObject:filename] sort:NO] != 1) + return NO; + + return YES; +} + +- (void)application:(NSApplication *)theApplication openFiles:(NSArray *)filenames +{ + [playlistController addPaths:filenames sort:YES]; + [theApplication replyToOpenOrPrint:NSApplicationDelegateReplySuccess]; +} + +@end diff --git a/COPYING b/COPYING new file mode 100644 index 000000000..3912109b5 --- /dev/null +++ b/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/Changelog b/Changelog new file mode 100644 index 000000000..b7dad8524 --- /dev/null +++ b/Changelog @@ -0,0 +1,3 @@ +Awesomized id3v2 and tagging support courtesy of TagLib. +Dramatically improved performance of monkeys audio codec. +minor bug fixes. \ No newline at end of file diff --git a/Cog.scriptSuite b/Cog.scriptSuite new file mode 100644 index 000000000..8c71a36ec --- /dev/null +++ b/Cog.scriptSuite @@ -0,0 +1,114 @@ + + + + + AppleEventCode + CoRo + Classes + + NSApplication + + AppleEventCode + capp + Attributes + + currentEntry + + AppleEventCode + CoCE + ReadOnly + YES + Type + PlaylistEntry + + + Superclass + NSCoreSuite.NSApplication + + PlaylistEntry + + AppleEventCode + CoPE + Attributes + + album + + AppleEventCode + CoAl + ReadOnly + YES + Type + NSString + + artist + + AppleEventCode + CoAr + ReadOnly + YES + Type + NSString + + genre + + AppleEventCode + CoGe + ReadOnly + YES + Type + NSString + + length + + AppleEventCode + CoLe + ReadOnly + YES + Type + NSNumber<Double> + + bitRate + + AppleEventCode + CoBi + ReadOnly + YES + Type + NSNumber<Int> + + title + + AppleEventCode + CoTi + ReadOnly + YES + Type + NSString + + track + + AppleEventCode + CoTr + ReadOnly + YES + Type + NSString + + year + + AppleEventCode + CoYe + ReadOnly + YES + Type + NSString + + + Superclass + NSCoreSuite.AbstractObject + + + Name + Cog + + diff --git a/Cog.scriptTerminology b/Cog.scriptTerminology new file mode 100644 index 000000000..dedd051d5 --- /dev/null +++ b/Cog.scriptTerminology @@ -0,0 +1,100 @@ + + + + + Classes + + NSApplication + + Attributes + + currentEntry + + Description + The currently playing entry. + Name + currententry + + + Description + Cog's top level scripting object. + Name + application + PluralName + applications + + PlaylistEntry + + Attributes + + album + + Description + This is the... whatever. + Name + album + + artist + + Description + The artist of the entry. + Name + artist + + genre + + Description + This is the... whatever. + Name + genre + + length + + Description + This is the... whatever. + Name + length + + bitRate + + Description + This is the... whatever. + Name + bitRate + + title + + Description + This is the... whatever. + Name + title + + track + + Description + This is the... whatever. + Name + track + + year + + Description + This is the... whatever. + Name + year + + + Description + A playlist entry. + Name + playlistentry + PluralName + playlistentries + + + Description + Cog's AppleScript interface + Name + Cog + + diff --git a/Cog.xcode/project.pbxproj b/Cog.xcode/project.pbxproj new file mode 100644 index 000000000..de9952e6b --- /dev/null +++ b/Cog.xcode/project.pbxproj @@ -0,0 +1,1709 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 39; + objects = { + 080E96DDFE201D6D7F000001 = { + children = ( + 8E267D030837F7A6004ACBC5, + 8E267D080837F7A6004ACBC5, + 8E47215C08318D12001F89FA, + 8EF6FA64082DA525006F7BE6, + 8E6529F8083D93AF00A7AF1B, + 8E2871080836934A0013CE39, + 8E2871090836934A0013CE39, + 8E4721D108319294001F89FA, + 8E4721D208319294001F89FA, + 8E4721D4083192C2001F89FA, + 8E4721D5083192C2001F89FA, + 8E45227A0832898A00F8BA7C, + 8E45227B0832898A00F8BA7C, + ); + isa = PBXGroup; + name = Classes; + refType = 4; + sourceTree = ""; + }; + 089C165CFE840E0CC02AAC07 = { + children = ( + 089C165DFE840E0CC02AAC07, + ); + isa = PBXVariantGroup; + name = InfoPlist.strings; + refType = 4; + sourceTree = ""; + }; + 089C165DFE840E0CC02AAC07 = { + fileEncoding = 10; + isa = PBXFileReference; + lastKnownFileType = text.plist.strings; + name = English; + path = English.lproj/InfoPlist.strings; + refType = 4; + sourceTree = ""; + }; +//080 +//081 +//082 +//083 +//084 +//100 +//101 +//102 +//103 +//104 + 1058C7A0FEA54F0111CA2CBB = { + children = ( + 8E14E468084CF15C00246BCC, + 8E5A9031084CB48500AE6D62, + 8E81BC31083673ED0025A375, + 8E81BC32083673ED0025A375, + 8EE4A69B082E6EB200415456, + 8EE4A698082E6EA000415456, + 8EE4A694082E6E9100415456, + 8EE4A690082E6E8000415456, + 8EE4A68C082E6E7000415456, + 8EE4A688082E6E6000415456, + 8EE4A684082E6E5100415456, + 1058C7A1FEA54F0111CA2CBB, + ); + isa = PBXGroup; + name = "Linked Frameworks"; + refType = 4; + sourceTree = ""; + }; + 1058C7A1FEA54F0111CA2CBB = { + isa = PBXFileReference; + lastKnownFileType = wrapper.framework; + name = Cocoa.framework; + path = /System/Library/Frameworks/Cocoa.framework; + refType = 0; + sourceTree = ""; + }; + 1058C7A2FEA54F0111CA2CBB = { + children = ( + 29B97324FDCFA39411CA2CEA, + 13E42FB307B3F0F600E4EEF1, + 29B97325FDCFA39411CA2CEA, + ); + isa = PBXGroup; + name = "Other Frameworks"; + refType = 4; + sourceTree = ""; + }; +//100 +//101 +//102 +//103 +//104 +//130 +//131 +//132 +//133 +//134 + 13E42FB307B3F0F600E4EEF1 = { + isa = PBXFileReference; + lastKnownFileType = wrapper.framework; + name = CoreData.framework; + path = /System/Library/Frameworks/CoreData.framework; + refType = 0; + sourceTree = ""; + }; +//130 +//131 +//132 +//133 +//134 +//190 +//191 +//192 +//193 +//194 + 19C28FACFE9D520D11CA2CBB = { + children = ( + 8D1107320486CEB800E47090, + ); + isa = PBXGroup; + name = Products; + refType = 4; + sourceTree = ""; + }; +//190 +//191 +//192 +//193 +//194 +//290 +//291 +//292 +//293 +//294 + 29B97313FDCFA39411CA2CEA = { + buildSettings = { + }; + buildStyles = ( + 4A9504CCFFE6A4B311CA0CBA, + 4A9504CDFFE6A4B311CA0CBA, + ); + hasScannedForEncodings = 1; + isa = PBXProject; + mainGroup = 29B97314FDCFA39411CA2CEA; + projectDirPath = ""; + targets = ( + 8D1107260486CEB800E47090, + ); + }; + 29B97314FDCFA39411CA2CEA = { + children = ( + 080E96DDFE201D6D7F000001, + 29B97315FDCFA39411CA2CEA, + 29B97317FDCFA39411CA2CEA, + 29B97323FDCFA39411CA2CEA, + 19C28FACFE9D520D11CA2CBB, + ); + isa = PBXGroup; + name = Cog; + path = ""; + refType = 4; + sourceTree = ""; + }; + 29B97315FDCFA39411CA2CEA = { + children = ( + 32CA4F630368D1EE00C91783, + 29B97316FDCFA39411CA2CEA, + 8E0EBF0C084BA776003A6E64, + 8E0EBF0D084BA776003A6E64, + ); + isa = PBXGroup; + name = "Other Sources"; + path = ""; + refType = 4; + sourceTree = ""; + }; + 29B97316FDCFA39411CA2CEA = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.objc; + path = main.m; + refType = 4; + sourceTree = ""; + }; + 29B97317FDCFA39411CA2CEA = { + children = ( + 8EAFD26D08465E4500107BA5, + 8EDCBDCA0840617B00F5C7E3, + 8EDCBDCC0840618900F5C7E3, + 8D1107310486CEB800E47090, + 089C165CFE840E0CC02AAC07, + 29B97318FDCFA39411CA2CEA, + 8E10DBEF084BBCF00013815C, + 8E5A90B0084CBC2F00AE6D62, + ); + isa = PBXGroup; + name = Resources; + path = ""; + refType = 4; + sourceTree = ""; + }; + 29B97318FDCFA39411CA2CEA = { + children = ( + 29B97319FDCFA39411CA2CEA, + ); + isa = PBXVariantGroup; + name = MainMenu.nib; + path = ""; + refType = 4; + sourceTree = ""; + }; + 29B97319FDCFA39411CA2CEA = { + isa = PBXFileReference; + lastKnownFileType = wrapper.nib; + name = English; + path = English.lproj/MainMenu.nib; + refType = 4; + sourceTree = ""; + }; + 29B97323FDCFA39411CA2CEA = { + children = ( + 1058C7A0FEA54F0111CA2CBB, + 1058C7A2FEA54F0111CA2CBB, + ); + isa = PBXGroup; + name = Frameworks; + path = ""; + refType = 4; + sourceTree = ""; + }; + 29B97324FDCFA39411CA2CEA = { + isa = PBXFileReference; + lastKnownFileType = wrapper.framework; + name = AppKit.framework; + path = /System/Library/Frameworks/AppKit.framework; + refType = 0; + sourceTree = ""; + }; + 29B97325FDCFA39411CA2CEA = { + isa = PBXFileReference; + lastKnownFileType = wrapper.framework; + name = Foundation.framework; + path = /System/Library/Frameworks/Foundation.framework; + refType = 0; + sourceTree = ""; + }; +//290 +//291 +//292 +//293 +//294 +//320 +//321 +//322 +//323 +//324 + 32CA4F630368D1EE00C91783 = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = Cog_Prefix.pch; + refType = 4; + sourceTree = ""; + }; +//320 +//321 +//322 +//323 +//324 +//4A0 +//4A1 +//4A2 +//4A3 +//4A4 + 4A9504CCFFE6A4B311CA0CBA = { + buildSettings = { + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_GENERATE_DEBUGGING_SYMBOLS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + OTHER_CFLAGS = "-D__MACOSX__ -DDEBUG"; + PREBINDING = NO; + ZERO_LINK = YES; + }; + isa = PBXBuildStyle; + name = Development; + }; + 4A9504CDFFE6A4B311CA0CBA = { + buildSettings = { + COPY_PHASE_STRIP = YES; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + GCC_GENERATE_DEBUGGING_SYMBOLS = NO; + GCC_OPTIMIZATION_LEVEL = 3; + PREBINDING = NO; + ZERO_LINK = NO; + }; + isa = PBXBuildStyle; + name = Deployment; + }; +//4A0 +//4A1 +//4A2 +//4A3 +//4A4 +//8D0 +//8D1 +//8D2 +//8D3 +//8D4 + 8D1107260486CEB800E47090 = { + buildPhases = ( + 8D1107290486CEB800E47090, + 8D11072C0486CEB800E47090, + 8D11072E0486CEB800E47090, + 8EFFB6980833028600C53833, + ); + buildRules = ( + ); + buildSettings = { + FRAMEWORK_SEARCH_PATHS = "/Users/xugg/Projects/Cog/Libraries/DecMPA/build /Users/xugg/Projects/Cog/Libraries/FLAC/build /Users/xugg/Projects/Cog/Libraries/MAC/build /Users/xugg/Projects/Cog/Libraries/MPCDec/build /Users/xugg/Projects/Cog/Libraries/Ogg/build /Users/xugg/Projects/Cog/Libraries/SndFile/build /Users/xugg/Projects/Cog/Libraries/Vorbis/build /Users/xugg/Projects/Cog/Libraries/MetaTag/build /Users/xugg/Projects/Cog/Libraries/TagLib/build /Users/xugg/Projects/Cog/Libraries/FAAD2/build"; + GCC_GENERATE_DEBUGGING_SYMBOLS = NO; + GCC_OPTIMIZATION_LEVEL = 3; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = Cog_Prefix.pch; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = MAC; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(HOME)/Applications"; + OTHER_CFLAGS = "-D__MACOSX__"; + OTHER_LDFLAGS = "-Wl,-read_only_relocs,warning"; + PRODUCT_NAME = Cog; + WRAPPER_EXTENSION = app; + }; + dependencies = ( + ); + isa = PBXNativeTarget; + name = Cog; + productInstallPath = "$(HOME)/Applications"; + productName = Cog; + productReference = 8D1107320486CEB800E47090; + productType = "com.apple.product-type.application"; + }; + 8D1107290486CEB800E47090 = { + buildActionMask = 2147483647; + files = ( + 8D11072A0486CEB800E47090, + 8D11072B0486CEB800E47090, + 8EDCBDCB0840617B00F5C7E3, + 8EDCBDCD0840618900F5C7E3, + 8EAFD28208465E5600107BA5, + 8EAFD28308465E5600107BA5, + 8EAFD28408465E5600107BA5, + 8EAFD28508465E5600107BA5, + 8EAFD28608465E5600107BA5, + 8EAFD28708465E5600107BA5, + 8EAFD28808465E5600107BA5, + 8EAFD28908465E5600107BA5, + 8EAFD28A08465E5600107BA5, + 8EAFD28B08465E5600107BA5, + 8EAFD28C08465E5600107BA5, + 8EAFD28D08465E5600107BA5, + 8EAFD28E08465E5600107BA5, + 8EAFD28F08465E5600107BA5, + 8EAFD29008465E5600107BA5, + 8EAFD29108465E5600107BA5, + 8EAFD29208465E5600107BA5, + 8EAFD29308465E5600107BA5, + 8EAFD29408465E5600107BA5, + 8EAFD29508465E5600107BA5, + 8EAB85FD0846889B000A9CEC, + 8E6F2A1908480D010011F126, + 8E10DBF0084BBCF00013815C, + 8E5A90B1084CBC2F00AE6D62, + ); + isa = PBXResourcesBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 8D11072A0486CEB800E47090 = { + fileRef = 29B97318FDCFA39411CA2CEA; + isa = PBXBuildFile; + settings = { + }; + }; + 8D11072B0486CEB800E47090 = { + fileRef = 089C165CFE840E0CC02AAC07; + isa = PBXBuildFile; + settings = { + }; + }; + 8D11072C0486CEB800E47090 = { + buildActionMask = 2147483647; + files = ( + 8D11072D0486CEB800E47090, + 8EF6FA73082DA526006F7BE6, + 8EF6FA74082DA526006F7BE6, + 8EF6FA75082DA526006F7BE6, + 8EF6FA76082DA526006F7BE6, + 8EF6FA77082DA526006F7BE6, + 8EF6FA78082DA526006F7BE6, + 8EF6FA79082DA526006F7BE6, + 8E47218D08318D7A001F89FA, + 8E47218E08318D7A001F89FA, + 8E47218F08318D7A001F89FA, + 8E47219008318D7A001F89FA, + 8E4721D308319294001F89FA, + 8E4721D6083192C2001F89FA, + 8E45227C0832898A00F8BA7C, + 8E28710B0836934A0013CE39, + 8E267D0E0837F7A6004ACBC5, + 8E267D100837F7A6004ACBC5, + 8E267D120837F7A6004ACBC5, + 8E267D140837F7A6004ACBC5, + 8E29790A083D891500F2C55A, + 8E652A02083D93EB00A7AF1B, + 8E0EBF0F084BA776003A6E64, + 8E14E47C084CF1A200246BCC, + ); + isa = PBXSourcesBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 8D11072D0486CEB800E47090 = { + fileRef = 29B97316FDCFA39411CA2CEA; + isa = PBXBuildFile; + settings = { + ATTRIBUTES = ( + ); + }; + }; + 8D11072E0486CEB800E47090 = { + buildActionMask = 2147483647; + files = ( + 8D11072F0486CEB800E47090, + 8EE4A685082E6E5100415456, + 8EE4A689082E6E6000415456, + 8EE4A68D082E6E7000415456, + 8EE4A691082E6E8000415456, + 8EE4A695082E6E9100415456, + 8EE4A699082E6EA000415456, + 8EE4A69C082E6EB200415456, + 8E81BC33083673ED0025A375, + 8E81BC34083673ED0025A375, + 8E5A9032084CB48500AE6D62, + 8E14E469084CF15C00246BCC, + ); + isa = PBXFrameworksBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 8D11072F0486CEB800E47090 = { + fileRef = 1058C7A1FEA54F0111CA2CBB; + isa = PBXBuildFile; + settings = { + }; + }; + 8D1107310486CEB800E47090 = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = text.plist; + path = Info.plist; + refType = 4; + sourceTree = ""; + }; + 8D1107320486CEB800E47090 = { + explicitFileType = wrapper.application; + includeInIndex = 0; + isa = PBXFileReference; + path = Cog.app; + refType = 3; + sourceTree = BUILT_PRODUCTS_DIR; + }; +//8D0 +//8D1 +//8D2 +//8D3 +//8D4 +//8E0 +//8E1 +//8E2 +//8E3 +//8E4 + 8E0EBF0C084BA776003A6E64 = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = DBLog.h; + refType = 4; + sourceTree = ""; + }; + 8E0EBF0D084BA776003A6E64 = { + explicitFileType = sourcecode.cpp.objcpp; + fileEncoding = 4; + isa = PBXFileReference; + path = DBLog.c; + refType = 4; + sourceTree = ""; + }; + 8E0EBF0F084BA776003A6E64 = { + fileRef = 8E0EBF0D084BA776003A6E64; + isa = PBXBuildFile; + settings = { + }; + }; + 8E10DBEF084BBCF00013815C = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = text.html; + path = Credits.html; + refType = 4; + sourceTree = ""; + }; + 8E10DBF0084BBCF00013815C = { + fileRef = 8E10DBEF084BBCF00013815C; + isa = PBXBuildFile; + settings = { + }; + }; + 8E14E468084CF15C00246BCC = { + isa = PBXFileReference; + lastKnownFileType = wrapper.framework; + name = FAAD2.framework; + path = Libraries/FAAD2/build/FAAD2.framework; + refType = 4; + sourceTree = ""; + }; + 8E14E469084CF15C00246BCC = { + fileRef = 8E14E468084CF15C00246BCC; + isa = PBXBuildFile; + settings = { + }; + }; + 8E14E472084CF16400246BCC = { + fileRef = 8E14E468084CF15C00246BCC; + isa = PBXBuildFile; + settings = { + }; + }; + 8E14E479084CF1A200246BCC = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = AACFile.h; + refType = 4; + sourceTree = ""; + }; + 8E14E47A084CF1A200246BCC = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.objc; + path = AACFile.m; + refType = 4; + sourceTree = ""; + }; + 8E14E47B084CF1A200246BCC = { + fileRef = 8E14E479084CF1A200246BCC; + isa = PBXBuildFile; + settings = { + }; + }; + 8E14E47C084CF1A200246BCC = { + fileRef = 8E14E47A084CF1A200246BCC; + isa = PBXBuildFile; + settings = { + }; + }; + 8E267D030837F7A6004ACBC5 = { + children = ( + 8E267D040837F7A6004ACBC5, + 8E267D050837F7A6004ACBC5, + 8E267D060837F7A6004ACBC5, + 8E267D070837F7A6004ACBC5, + ); + isa = PBXGroup; + path = Feedback; + refType = 4; + sourceTree = ""; + }; + 8E267D040837F7A6004ACBC5 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = FeedbackController.h; + refType = 4; + sourceTree = ""; + }; + 8E267D050837F7A6004ACBC5 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.objc; + path = FeedbackController.m; + refType = 4; + sourceTree = ""; + }; + 8E267D060837F7A6004ACBC5 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = FeedbackSocket.h; + refType = 4; + sourceTree = ""; + }; + 8E267D070837F7A6004ACBC5 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.objc; + path = FeedbackSocket.m; + refType = 4; + sourceTree = ""; + }; + 8E267D080837F7A6004ACBC5 = { + children = ( + 8E267D090837F7A6004ACBC5, + 8E267D0A0837F7A6004ACBC5, + 8E267D0B0837F7A6004ACBC5, + 8E267D0C0837F7A6004ACBC5, + ); + isa = PBXGroup; + path = Updates; + refType = 4; + sourceTree = ""; + }; + 8E267D090837F7A6004ACBC5 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = MacPADSocket.h; + refType = 4; + sourceTree = ""; + }; + 8E267D0A0837F7A6004ACBC5 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.objc; + path = MacPADSocket.m; + refType = 4; + sourceTree = ""; + }; + 8E267D0B0837F7A6004ACBC5 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = UpdateController.h; + refType = 4; + sourceTree = ""; + }; + 8E267D0C0837F7A6004ACBC5 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.objc; + path = UpdateController.m; + refType = 4; + sourceTree = ""; + }; + 8E267D0E0837F7A6004ACBC5 = { + fileRef = 8E267D050837F7A6004ACBC5; + isa = PBXBuildFile; + settings = { + }; + }; + 8E267D100837F7A6004ACBC5 = { + fileRef = 8E267D070837F7A6004ACBC5; + isa = PBXBuildFile; + settings = { + }; + }; + 8E267D120837F7A6004ACBC5 = { + fileRef = 8E267D0A0837F7A6004ACBC5; + isa = PBXBuildFile; + settings = { + }; + }; + 8E267D140837F7A6004ACBC5 = { + fileRef = 8E267D0C0837F7A6004ACBC5; + isa = PBXBuildFile; + settings = { + }; + }; + 8E2871080836934A0013CE39 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = VirtualRingBuffer.h; + refType = 4; + sourceTree = ""; + }; + 8E2871090836934A0013CE39 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.objc; + path = VirtualRingBuffer.m; + refType = 4; + sourceTree = ""; + }; + 8E28710B0836934A0013CE39 = { + fileRef = 8E2871090836934A0013CE39; + isa = PBXBuildFile; + settings = { + }; + }; + 8E297908083D891500F2C55A = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.objc; + path = TrackingCell.m; + refType = 4; + sourceTree = ""; + }; + 8E297909083D891500F2C55A = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = TrackingCell.h; + refType = 4; + sourceTree = ""; + }; + 8E29790A083D891500F2C55A = { + fileRef = 8E297908083D891500F2C55A; + isa = PBXBuildFile; + settings = { + }; + }; + 8E45227A0832898A00F8BA7C = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = Sound.h; + refType = 4; + sourceTree = ""; + }; + 8E45227B0832898A00F8BA7C = { + explicitFileType = sourcecode.cpp.objcpp; + fileEncoding = 4; + isa = PBXFileReference; + path = Sound.m; + refType = 4; + sourceTree = ""; + }; + 8E45227C0832898A00F8BA7C = { + fileRef = 8E45227B0832898A00F8BA7C; + isa = PBXBuildFile; + settings = { + }; + }; + 8E47215C08318D12001F89FA = { + children = ( + 8E47218508318D7A001F89FA, + 8E47218608318D7A001F89FA, + 8E47218708318D7A001F89FA, + 8E47218808318D7A001F89FA, + 8E47218908318D7A001F89FA, + 8E47218A08318D7A001F89FA, + 8E47218B08318D7A001F89FA, + 8E47218C08318D7A001F89FA, + ); + isa = PBXGroup; + name = Playlist; + refType = 4; + sourceTree = ""; + }; + 8E47218508318D7A001F89FA = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = DNDArrayController.h; + path = Playlist/DNDArrayController.h; + refType = 4; + sourceTree = ""; + }; + 8E47218608318D7A001F89FA = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.objc; + name = DNDArrayController.m; + path = Playlist/DNDArrayController.m; + refType = 4; + sourceTree = ""; + }; + 8E47218708318D7A001F89FA = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = PlaylistController.h; + path = Playlist/PlaylistController.h; + refType = 4; + sourceTree = ""; + }; + 8E47218808318D7A001F89FA = { + explicitFileType = sourcecode.c.objc; + fileEncoding = 30; + isa = PBXFileReference; + name = PlaylistController.m; + path = Playlist/PlaylistController.m; + refType = 4; + sourceTree = ""; + }; + 8E47218908318D7A001F89FA = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = PlaylistEntry.h; + path = Playlist/PlaylistEntry.h; + refType = 4; + sourceTree = ""; + }; + 8E47218A08318D7A001F89FA = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.objc; + name = PlaylistEntry.m; + path = Playlist/PlaylistEntry.m; + refType = 4; + sourceTree = ""; + }; + 8E47218B08318D7A001F89FA = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = PlaylistView.h; + path = Playlist/PlaylistView.h; + refType = 4; + sourceTree = ""; + }; + 8E47218C08318D7A001F89FA = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.objc; + name = PlaylistView.m; + path = Playlist/PlaylistView.m; + refType = 4; + sourceTree = ""; + }; + 8E47218D08318D7A001F89FA = { + fileRef = 8E47218608318D7A001F89FA; + isa = PBXBuildFile; + settings = { + }; + }; + 8E47218E08318D7A001F89FA = { + fileRef = 8E47218808318D7A001F89FA; + isa = PBXBuildFile; + settings = { + }; + }; + 8E47218F08318D7A001F89FA = { + fileRef = 8E47218A08318D7A001F89FA; + isa = PBXBuildFile; + settings = { + }; + }; + 8E47219008318D7A001F89FA = { + fileRef = 8E47218C08318D7A001F89FA; + isa = PBXBuildFile; + settings = { + }; + }; + 8E4721D108319294001F89FA = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = AppController.h; + refType = 4; + sourceTree = ""; + }; + 8E4721D208319294001F89FA = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.objc; + path = AppController.m; + refType = 4; + sourceTree = ""; + }; + 8E4721D308319294001F89FA = { + fileRef = 8E4721D208319294001F89FA; + isa = PBXBuildFile; + settings = { + }; + }; + 8E4721D4083192C2001F89FA = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = SoundController.h; + refType = 4; + sourceTree = ""; + }; + 8E4721D5083192C2001F89FA = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.objc; + path = SoundController.m; + refType = 4; + sourceTree = ""; + }; + 8E4721D6083192C2001F89FA = { + fileRef = 8E4721D5083192C2001F89FA; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A9031084CB48500AE6D62 = { + isa = PBXFileReference; + lastKnownFileType = wrapper.framework; + name = TagLib.framework; + path = Libraries/TagLib/build/TagLib.framework; + refType = 4; + sourceTree = ""; + }; + 8E5A9032084CB48500AE6D62 = { + fileRef = 8E5A9031084CB48500AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A908D084CB92D00AE6D62 = { + fileRef = 8E5A9031084CB48500AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A90B0084CBC2F00AE6D62 = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = text; + path = Changelog; + refType = 4; + sourceTree = ""; + }; + 8E5A90B1084CBC2F00AE6D62 = { + fileRef = 8E5A90B0084CBC2F00AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E6529F8083D93AF00A7AF1B = { + children = ( + 8E297908083D891500F2C55A, + 8E297909083D891500F2C55A, + 8E6529FF083D93EB00A7AF1B, + 8E652A00083D93EB00A7AF1B, + ); + isa = PBXGroup; + name = Slider; + refType = 4; + sourceTree = ""; + }; + 8E6529FF083D93EB00A7AF1B = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = TrackingSlider.h; + refType = 4; + sourceTree = ""; + }; + 8E652A00083D93EB00A7AF1B = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.objc; + path = TrackingSlider.m; + refType = 4; + sourceTree = ""; + }; + 8E652A02083D93EB00A7AF1B = { + fileRef = 8E652A00083D93EB00A7AF1B; + isa = PBXBuildFile; + settings = { + }; + }; + 8E6F2A1808480D010011F126 = { + isa = PBXFileReference; + lastKnownFileType = image.icns; + name = wheel.icns; + path = Icons/wheel.icns; + refType = 4; + sourceTree = ""; + }; + 8E6F2A1908480D010011F126 = { + fileRef = 8E6F2A1808480D010011F126; + isa = PBXBuildFile; + settings = { + }; + }; + 8E81BC31083673ED0025A375 = { + isa = PBXFileReference; + lastKnownFileType = wrapper.framework; + name = AudioToolbox.framework; + path = /System/Library/Frameworks/AudioToolbox.framework; + refType = 0; + sourceTree = ""; + }; + 8E81BC32083673ED0025A375 = { + isa = PBXFileReference; + lastKnownFileType = wrapper.framework; + name = AudioUnit.framework; + path = /System/Library/Frameworks/AudioUnit.framework; + refType = 0; + sourceTree = ""; + }; + 8E81BC33083673ED0025A375 = { + fileRef = 8E81BC31083673ED0025A375; + isa = PBXBuildFile; + settings = { + }; + }; + 8E81BC34083673ED0025A375 = { + fileRef = 8E81BC32083673ED0025A375; + isa = PBXBuildFile; + settings = { + }; + }; + 8EAB85FC0846889B000A9CEC = { + isa = PBXFileReference; + lastKnownFileType = image.png; + name = bground.png; + path = Icons/bground.png; + refType = 4; + sourceTree = ""; + }; + 8EAB85FD0846889B000A9CEC = { + fileRef = 8EAB85FC0846889B000A9CEC; + isa = PBXBuildFile; + settings = { + }; + }; + 8EAFD26D08465E4500107BA5 = { + children = ( + 8E6F2A1808480D010011F126, + 8EAFD26E08465E5600107BA5, + 8EAFD26F08465E5600107BA5, + 8EAFD27008465E5600107BA5, + 8EAFD27108465E5600107BA5, + 8EAFD27208465E5600107BA5, + 8EAFD27308465E5600107BA5, + 8EAFD27408465E5600107BA5, + 8EAFD27508465E5600107BA5, + 8EAFD27608465E5600107BA5, + 8EAFD27708465E5600107BA5, + 8EAFD27808465E5600107BA5, + 8EAFD27908465E5600107BA5, + 8EAFD27A08465E5600107BA5, + 8EAFD27B08465E5600107BA5, + 8EAFD27C08465E5600107BA5, + 8EAFD27D08465E5600107BA5, + 8EAFD27E08465E5600107BA5, + 8EAFD27F08465E5600107BA5, + 8EAFD28008465E5600107BA5, + 8EAFD28108465E5600107BA5, + 8EAB85FC0846889B000A9CEC, + ); + isa = PBXGroup; + name = Icons; + refType = 4; + sourceTree = ""; + }; + 8EAFD26E08465E5600107BA5 = { + isa = PBXFileReference; + lastKnownFileType = image.png; + name = add_blue.png; + path = Icons/add_blue.png; + refType = 4; + sourceTree = ""; + }; + 8EAFD26F08465E5600107BA5 = { + isa = PBXFileReference; + lastKnownFileType = image.png; + name = add_gray.png; + path = Icons/add_gray.png; + refType = 4; + sourceTree = ""; + }; + 8EAFD27008465E5600107BA5 = { + isa = PBXFileReference; + lastKnownFileType = image.png; + name = info_blue.png; + path = Icons/info_blue.png; + refType = 4; + sourceTree = ""; + }; + 8EAFD27108465E5600107BA5 = { + isa = PBXFileReference; + lastKnownFileType = image.png; + name = info_gray.png; + path = Icons/info_gray.png; + refType = 4; + sourceTree = ""; + }; + 8EAFD27208465E5600107BA5 = { + isa = PBXFileReference; + lastKnownFileType = image.png; + name = next_blue.png; + path = Icons/next_blue.png; + refType = 4; + sourceTree = ""; + }; + 8EAFD27308465E5600107BA5 = { + isa = PBXFileReference; + lastKnownFileType = image.png; + name = next_gray.png; + path = Icons/next_gray.png; + refType = 4; + sourceTree = ""; + }; + 8EAFD27408465E5600107BA5 = { + isa = PBXFileReference; + lastKnownFileType = image.png; + name = pause_blue.png; + path = Icons/pause_blue.png; + refType = 4; + sourceTree = ""; + }; + 8EAFD27508465E5600107BA5 = { + isa = PBXFileReference; + lastKnownFileType = image.png; + name = pause_gray.png; + path = Icons/pause_gray.png; + refType = 4; + sourceTree = ""; + }; + 8EAFD27608465E5600107BA5 = { + isa = PBXFileReference; + lastKnownFileType = image.png; + name = play_blue.png; + path = Icons/play_blue.png; + refType = 4; + sourceTree = ""; + }; + 8EAFD27708465E5600107BA5 = { + isa = PBXFileReference; + lastKnownFileType = image.png; + name = play_gray.png; + path = Icons/play_gray.png; + refType = 4; + sourceTree = ""; + }; + 8EAFD27808465E5600107BA5 = { + isa = PBXFileReference; + lastKnownFileType = image.png; + name = prev_blue.png; + path = Icons/prev_blue.png; + refType = 4; + sourceTree = ""; + }; + 8EAFD27908465E5600107BA5 = { + isa = PBXFileReference; + lastKnownFileType = image.png; + name = prev_gray.png; + path = Icons/prev_gray.png; + refType = 4; + sourceTree = ""; + }; + 8EAFD27A08465E5600107BA5 = { + isa = PBXFileReference; + lastKnownFileType = image.png; + name = remove_blue.png; + path = Icons/remove_blue.png; + refType = 4; + sourceTree = ""; + }; + 8EAFD27B08465E5600107BA5 = { + isa = PBXFileReference; + lastKnownFileType = image.png; + name = remove_gray.png; + path = Icons/remove_gray.png; + refType = 4; + sourceTree = ""; + }; + 8EAFD27C08465E5600107BA5 = { + isa = PBXFileReference; + lastKnownFileType = image.png; + name = repeat_blue.png; + path = Icons/repeat_blue.png; + refType = 4; + sourceTree = ""; + }; + 8EAFD27D08465E5600107BA5 = { + isa = PBXFileReference; + lastKnownFileType = image.png; + name = repeat_gray.png; + path = Icons/repeat_gray.png; + refType = 4; + sourceTree = ""; + }; + 8EAFD27E08465E5600107BA5 = { + isa = PBXFileReference; + lastKnownFileType = image.png; + name = shuffle_blue.png; + path = Icons/shuffle_blue.png; + refType = 4; + sourceTree = ""; + }; + 8EAFD27F08465E5600107BA5 = { + isa = PBXFileReference; + lastKnownFileType = image.png; + name = shuffle_gray.png; + path = Icons/shuffle_gray.png; + refType = 4; + sourceTree = ""; + }; + 8EAFD28008465E5600107BA5 = { + isa = PBXFileReference; + lastKnownFileType = image.png; + name = stop_blue.png; + path = Icons/stop_blue.png; + refType = 4; + sourceTree = ""; + }; + 8EAFD28108465E5600107BA5 = { + isa = PBXFileReference; + lastKnownFileType = image.png; + name = stop_gray.png; + path = Icons/stop_gray.png; + refType = 4; + sourceTree = ""; + }; + 8EAFD28208465E5600107BA5 = { + fileRef = 8EAFD26E08465E5600107BA5; + isa = PBXBuildFile; + settings = { + }; + }; + 8EAFD28308465E5600107BA5 = { + fileRef = 8EAFD26F08465E5600107BA5; + isa = PBXBuildFile; + settings = { + }; + }; + 8EAFD28408465E5600107BA5 = { + fileRef = 8EAFD27008465E5600107BA5; + isa = PBXBuildFile; + settings = { + }; + }; + 8EAFD28508465E5600107BA5 = { + fileRef = 8EAFD27108465E5600107BA5; + isa = PBXBuildFile; + settings = { + }; + }; + 8EAFD28608465E5600107BA5 = { + fileRef = 8EAFD27208465E5600107BA5; + isa = PBXBuildFile; + settings = { + }; + }; + 8EAFD28708465E5600107BA5 = { + fileRef = 8EAFD27308465E5600107BA5; + isa = PBXBuildFile; + settings = { + }; + }; + 8EAFD28808465E5600107BA5 = { + fileRef = 8EAFD27408465E5600107BA5; + isa = PBXBuildFile; + settings = { + }; + }; + 8EAFD28908465E5600107BA5 = { + fileRef = 8EAFD27508465E5600107BA5; + isa = PBXBuildFile; + settings = { + }; + }; + 8EAFD28A08465E5600107BA5 = { + fileRef = 8EAFD27608465E5600107BA5; + isa = PBXBuildFile; + settings = { + }; + }; + 8EAFD28B08465E5600107BA5 = { + fileRef = 8EAFD27708465E5600107BA5; + isa = PBXBuildFile; + settings = { + }; + }; + 8EAFD28C08465E5600107BA5 = { + fileRef = 8EAFD27808465E5600107BA5; + isa = PBXBuildFile; + settings = { + }; + }; + 8EAFD28D08465E5600107BA5 = { + fileRef = 8EAFD27908465E5600107BA5; + isa = PBXBuildFile; + settings = { + }; + }; + 8EAFD28E08465E5600107BA5 = { + fileRef = 8EAFD27A08465E5600107BA5; + isa = PBXBuildFile; + settings = { + }; + }; + 8EAFD28F08465E5600107BA5 = { + fileRef = 8EAFD27B08465E5600107BA5; + isa = PBXBuildFile; + settings = { + }; + }; + 8EAFD29008465E5600107BA5 = { + fileRef = 8EAFD27C08465E5600107BA5; + isa = PBXBuildFile; + settings = { + }; + }; + 8EAFD29108465E5600107BA5 = { + fileRef = 8EAFD27D08465E5600107BA5; + isa = PBXBuildFile; + settings = { + }; + }; + 8EAFD29208465E5600107BA5 = { + fileRef = 8EAFD27E08465E5600107BA5; + isa = PBXBuildFile; + settings = { + }; + }; + 8EAFD29308465E5600107BA5 = { + fileRef = 8EAFD27F08465E5600107BA5; + isa = PBXBuildFile; + settings = { + }; + }; + 8EAFD29408465E5600107BA5 = { + fileRef = 8EAFD28008465E5600107BA5; + isa = PBXBuildFile; + settings = { + }; + }; + 8EAFD29508465E5600107BA5 = { + fileRef = 8EAFD28108465E5600107BA5; + isa = PBXBuildFile; + settings = { + }; + }; + 8EDCBDCA0840617B00F5C7E3 = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = text.plist.scriptTerminology; + path = Cog.scriptTerminology; + refType = 4; + sourceTree = ""; + }; + 8EDCBDCB0840617B00F5C7E3 = { + fileRef = 8EDCBDCA0840617B00F5C7E3; + isa = PBXBuildFile; + settings = { + }; + }; + 8EDCBDCC0840618900F5C7E3 = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = text.plist.scriptSuite; + path = Cog.scriptSuite; + refType = 4; + sourceTree = ""; + }; + 8EDCBDCD0840618900F5C7E3 = { + fileRef = 8EDCBDCC0840618900F5C7E3; + isa = PBXBuildFile; + settings = { + }; + }; + 8EE4A684082E6E5100415456 = { + isa = PBXFileReference; + lastKnownFileType = wrapper.framework; + name = DecMPA.framework; + path = Libraries/DecMPA/build/DecMPA.framework; + refType = 4; + sourceTree = ""; + }; + 8EE4A685082E6E5100415456 = { + fileRef = 8EE4A684082E6E5100415456; + isa = PBXBuildFile; + settings = { + }; + }; + 8EE4A688082E6E6000415456 = { + isa = PBXFileReference; + lastKnownFileType = wrapper.framework; + name = FLAC.framework; + path = Libraries/FLAC/build/FLAC.framework; + refType = 4; + sourceTree = ""; + }; + 8EE4A689082E6E6000415456 = { + fileRef = 8EE4A688082E6E6000415456; + isa = PBXBuildFile; + settings = { + }; + }; + 8EE4A68C082E6E7000415456 = { + isa = PBXFileReference; + lastKnownFileType = wrapper.framework; + name = MAC.framework; + path = Libraries/MAC/build/MAC.framework; + refType = 4; + sourceTree = ""; + }; + 8EE4A68D082E6E7000415456 = { + fileRef = 8EE4A68C082E6E7000415456; + isa = PBXBuildFile; + settings = { + }; + }; + 8EE4A690082E6E8000415456 = { + isa = PBXFileReference; + lastKnownFileType = wrapper.framework; + name = MPCDec.framework; + path = Libraries/MPCDec/build/MPCDec.framework; + refType = 4; + sourceTree = ""; + }; + 8EE4A691082E6E8000415456 = { + fileRef = 8EE4A690082E6E8000415456; + isa = PBXBuildFile; + settings = { + }; + }; + 8EE4A694082E6E9100415456 = { + isa = PBXFileReference; + lastKnownFileType = wrapper.framework; + name = Ogg.framework; + path = Libraries/Ogg/build/Ogg.framework; + refType = 4; + sourceTree = ""; + }; + 8EE4A695082E6E9100415456 = { + fileRef = 8EE4A694082E6E9100415456; + isa = PBXBuildFile; + settings = { + }; + }; + 8EE4A698082E6EA000415456 = { + isa = PBXFileReference; + lastKnownFileType = wrapper.framework; + name = SndFile.framework; + path = Libraries/SndFile/build/SndFile.framework; + refType = 4; + sourceTree = ""; + }; + 8EE4A699082E6EA000415456 = { + fileRef = 8EE4A698082E6EA000415456; + isa = PBXBuildFile; + settings = { + }; + }; + 8EE4A69B082E6EB200415456 = { + isa = PBXFileReference; + lastKnownFileType = wrapper.framework; + name = Vorbis.framework; + path = Libraries/Vorbis/build/Vorbis.framework; + refType = 4; + sourceTree = ""; + }; + 8EE4A69C082E6EB200415456 = { + fileRef = 8EE4A69B082E6EB200415456; + isa = PBXBuildFile; + settings = { + }; + }; + 8EF6FA64082DA525006F7BE6 = { + children = ( + 8E14E479084CF1A200246BCC, + 8E14E47A084CF1A200246BCC, + 8EF6FA65082DA526006F7BE6, + 8EF6FA66082DA526006F7BE6, + 8EF6FA67082DA526006F7BE6, + 8EF6FA68082DA526006F7BE6, + 8EF6FA69082DA526006F7BE6, + 8EF6FA6A082DA526006F7BE6, + 8EF6FA6B082DA526006F7BE6, + 8EF6FA6C082DA526006F7BE6, + 8EF6FA6F082DA526006F7BE6, + 8EF6FA70082DA526006F7BE6, + 8EF6FA71082DA526006F7BE6, + 8EF6FA72082DA526006F7BE6, + 8EF6FA6D082DA526006F7BE6, + 8EF6FA6E082DA526006F7BE6, + ); + isa = PBXGroup; + path = SoundFile; + refType = 4; + sourceTree = ""; + }; + 8EF6FA65082DA526006F7BE6 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = FlacFile.h; + refType = 4; + sourceTree = ""; + }; + 8EF6FA66082DA526006F7BE6 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.objc; + path = FlacFile.m; + refType = 4; + sourceTree = ""; + }; + 8EF6FA67082DA526006F7BE6 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = MonkeysFile.h; + refType = 4; + sourceTree = ""; + }; + 8EF6FA68082DA526006F7BE6 = { + explicitFileType = sourcecode.cpp.objcpp; + fileEncoding = 30; + isa = PBXFileReference; + path = MonkeysFile.m; + refType = 4; + sourceTree = ""; + }; + 8EF6FA69082DA526006F7BE6 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = MPEGFile.h; + refType = 4; + sourceTree = ""; + }; + 8EF6FA6A082DA526006F7BE6 = { + explicitFileType = sourcecode.cpp.objcpp; + fileEncoding = 30; + isa = PBXFileReference; + path = MPEGFile.m; + refType = 4; + sourceTree = ""; + }; + 8EF6FA6B082DA526006F7BE6 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = MusepackFile.h; + refType = 4; + sourceTree = ""; + }; + 8EF6FA6C082DA526006F7BE6 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.objc; + path = MusepackFile.m; + refType = 4; + sourceTree = ""; + }; + 8EF6FA6D082DA526006F7BE6 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = SoundFile.h; + refType = 4; + sourceTree = ""; + }; + 8EF6FA6E082DA526006F7BE6 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.objc; + path = SoundFile.m; + refType = 4; + sourceTree = ""; + }; + 8EF6FA6F082DA526006F7BE6 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = VorbisFile.h; + refType = 4; + sourceTree = ""; + }; + 8EF6FA70082DA526006F7BE6 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.objc; + path = VorbisFile.m; + refType = 4; + sourceTree = ""; + }; + 8EF6FA71082DA526006F7BE6 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = WaveFile.h; + refType = 4; + sourceTree = ""; + }; + 8EF6FA72082DA526006F7BE6 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.objc; + path = WaveFile.m; + refType = 4; + sourceTree = ""; + }; + 8EF6FA73082DA526006F7BE6 = { + fileRef = 8EF6FA66082DA526006F7BE6; + isa = PBXBuildFile; + settings = { + }; + }; + 8EF6FA74082DA526006F7BE6 = { + fileRef = 8EF6FA68082DA526006F7BE6; + isa = PBXBuildFile; + settings = { + }; + }; + 8EF6FA75082DA526006F7BE6 = { + fileRef = 8EF6FA6A082DA526006F7BE6; + isa = PBXBuildFile; + settings = { + }; + }; + 8EF6FA76082DA526006F7BE6 = { + fileRef = 8EF6FA6C082DA526006F7BE6; + isa = PBXBuildFile; + settings = { + }; + }; + 8EF6FA77082DA526006F7BE6 = { + fileRef = 8EF6FA6E082DA526006F7BE6; + isa = PBXBuildFile; + settings = { + }; + }; + 8EF6FA78082DA526006F7BE6 = { + fileRef = 8EF6FA70082DA526006F7BE6; + isa = PBXBuildFile; + settings = { + }; + }; + 8EF6FA79082DA526006F7BE6 = { + fileRef = 8EF6FA72082DA526006F7BE6; + isa = PBXBuildFile; + settings = { + }; + }; + 8EFFB6980833028600C53833 = { + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + 8E14E472084CF16400246BCC, + 8E5A908D084CB92D00AE6D62, + 8EFFB6D0083302A500C53833, + 8EFFB6D1083302A500C53833, + 8EFFB6D2083302A500C53833, + 8EFFB6D3083302A500C53833, + 8EFFB6D4083302A500C53833, + 8EFFB6D5083302A500C53833, + 8EFFB6D6083302A500C53833, + 8E14E47B084CF1A200246BCC, + ); + isa = PBXCopyFilesBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 8EFFB6D0083302A500C53833 = { + fileRef = 8EE4A69B082E6EB200415456; + isa = PBXBuildFile; + settings = { + }; + }; + 8EFFB6D1083302A500C53833 = { + fileRef = 8EE4A698082E6EA000415456; + isa = PBXBuildFile; + settings = { + }; + }; + 8EFFB6D2083302A500C53833 = { + fileRef = 8EE4A694082E6E9100415456; + isa = PBXBuildFile; + settings = { + }; + }; + 8EFFB6D3083302A500C53833 = { + fileRef = 8EE4A690082E6E8000415456; + isa = PBXBuildFile; + settings = { + }; + }; + 8EFFB6D4083302A500C53833 = { + fileRef = 8EE4A68C082E6E7000415456; + isa = PBXBuildFile; + settings = { + }; + }; + 8EFFB6D5083302A500C53833 = { + fileRef = 8EE4A688082E6E6000415456; + isa = PBXBuildFile; + settings = { + }; + }; + 8EFFB6D6083302A500C53833 = { + fileRef = 8EE4A684082E6E5100415456; + isa = PBXBuildFile; + settings = { + }; + }; + }; + rootObject = 29B97313FDCFA39411CA2CEA; +} diff --git a/Cog.xcode/xugg.mode1 b/Cog.xcode/xugg.mode1 new file mode 100644 index 000000000..8ec3b838d --- /dev/null +++ b/Cog.xcode/xugg.mode1 @@ -0,0 +1,1382 @@ + + + + + ActivePerspectiveName + Project + AllowedModules + + + BundleLoadPath + + MaxInstances + n + Module + PBXSmartGroupTreeModule + Name + Groups and Files Outline View + + + BundleLoadPath + + MaxInstances + n + Module + PBXNavigatorGroup + Name + Editor + + + BundleLoadPath + + MaxInstances + n + Module + XCTaskListModule + Name + Task List + + + BundleLoadPath + + MaxInstances + n + Module + XCDetailModule + Name + File and Smart Group Detail Viewer + + + BundleLoadPath + + MaxInstances + 1 + Module + PBXBuildResultsModule + Name + Detailed Build Results Viewer + + + BundleLoadPath + + MaxInstances + 1 + Module + PBXProjectFindModule + Name + Project Batch Find Tool + + + BundleLoadPath + + MaxInstances + n + Module + PBXRunSessionModule + Name + Run Log + + + BundleLoadPath + + MaxInstances + n + Module + PBXBookmarksModule + Name + Bookmarks Tool + + + BundleLoadPath + + MaxInstances + n + Module + PBXClassBrowserModule + Name + Class Browser + + + BundleLoadPath + + MaxInstances + n + Module + PBXCVSModule + Name + Source Code Control Tool + + + BundleLoadPath + + MaxInstances + n + Module + PBXDebugBreakpointsModule + Name + Debug Breakpoints Tool + + + BundleLoadPath + + MaxInstances + n + Module + XCDockableInspector + Name + Inspector + + + BundleLoadPath + + MaxInstances + n + Module + PBXOpenQuicklyModule + Name + Open Quickly Tool + + + BundleLoadPath + + MaxInstances + 1 + Module + PBXDebugSessionModule + Name + Debugger + + + BundleLoadPath + + MaxInstances + 1 + Module + PBXDebugCLIModule + Name + Debug Console + + + Description + DefaultDescriptionKey + DockingSystemVisible + + Extension + mode1 + FavBarConfig + + PBXProjectModuleGUID + 8EB77465082DA402005891CA + XCBarModuleItemNames + + XCBarModuleItems + + + FirstTimeWindowDisplayed + + Identifier + com.apple.perspectives.project.mode1 + MajorVersion + 31 + MinorVersion + 1 + Name + Default + Notifications + + OpenEditors + + PerspectiveWidths + + -1 + -1 + + Perspectives + + + ChosenToolbarItems + + active-target-popup + action + NSToolbarFlexibleSpaceItem + buildOrClean + build-and-runOrDebug + com.apple.ide.PBXToolbarStopButton + get-info + toggle-editor + NSToolbarFlexibleSpaceItem + com.apple.pbx.toolbar.searchfield + + ControllerClassBaseName + + IconName + WindowOfProjectWithEditor + Identifier + perspective.project + IsVertical + + Layout + + + ContentConfiguration + + PBXBottomSmartGroupGIDs + + 1C37FBAC04509CD000000102 + 1C37FAAC04509CD000000102 + 1C08E77C0454961000C914BD + 1C37FABC05509CD000000102 + 1C37FABC05539CD112110102 + E2644B35053B69B200211256 + 1C37FABC04509CD000100104 + 1CC0EA4004350EF90044410B + 1CC0EA4004350EF90041110B + + PBXProjectModuleGUID + 1CE0B1FE06471DED0097A5F4 + PBXProjectModuleLabel + Files + PBXProjectStructureProvided + yes + PBXSmartGroupTreeModuleColumnData + + PBXSmartGroupTreeModuleColumnWidthsKey + + 186 + + PBXSmartGroupTreeModuleColumnsKey_v4 + + MainColumn + + + PBXSmartGroupTreeModuleOutlineStateKey_v7 + + PBXSmartGroupTreeModuleOutlineStateExpansionKey + + 29B97314FDCFA39411CA2CEA + 080E96DDFE201D6D7F000001 + 8E47215C08318D12001F89FA + 8EF6FA64082DA525006F7BE6 + 29B97323FDCFA39411CA2CEA + 1C37FBAC04509CD000000102 + 1C37FABC05509CD000000102 + + PBXSmartGroupTreeModuleOutlineStateSelectionKey + + + 15 + 13 + 1 + 0 + + + PBXSmartGroupTreeModuleOutlineStateVisibleRectKey + {{0, 0}, {186, 565}} + + PBXTopSmartGroupGIDs + + XCIncludePerspectivesSwitch + + XCSharingToken + com.apple.Xcode.GFSharingToken + + GeometryConfiguration + + Frame + {{0, 0}, {203, 583}} + GroupTreeTableConfiguration + + MainColumn + 186 + + RubberWindowFrame + 1 122 1024 624 0 0 1024 746 + + Module + PBXSmartGroupTreeModule + Proportion + 203pt + + + Dock + + + BecomeActive + + ContentConfiguration + + PBXProjectModuleGUID + 1CE0B20306471E060097A5F4 + PBXProjectModuleLabel + AACFile.m + PBXSplitModuleInNavigatorKey + + Split0 + + PBXProjectModuleGUID + 1CE0B20406471E060097A5F4 + PBXProjectModuleLabel + AACFile.m + _historyCapacity + 0 + bookmark + 8ED1CBB7084F633100771E1E + history + + 8EF6FACD082DAA2B006F7BE6 + 8EF6FAD1082DAA2B006F7BE6 + 8E9BF100082FEF6B00B26943 + 8E267DDB0837FE5F004ACBC5 + 8E267E0008380176004ACBC5 + 8E1A1826083806B700AEA302 + 8E6082C7083920310017AECF + 8E25B5E5083CDD4A0064353E + 8E652A33083E1A7900A7AF1B + 8E652A34083E1A7900A7AF1B + 8E652A35083E1A7900A7AF1B + 8E652A36083E1A7900A7AF1B + 8EDCBEF40840FA2200F5C7E3 + 8EC8FBD20842932A00DF2C98 + 8EDC88A90842F8DE007D1532 + 8EDC88B50842F936007D1532 + 8E1BDA7908430E7700A08868 + 8ED833CD08457E6B0033CDBD + 8E6F2A2708480D900011F126 + 8E6F2A2808480D900011F126 + 8E6F2ACC08481B100011F126 + 8ED3C9B1084915CE00BB7797 + 8E10DC00084BBE490013815C + 8E10DC01084BBE490013815C + 8E10DC02084BBE490013815C + 8E94D973084BE3D1007F0AEB + 8E94D9D2084BEA32007F0AEB + 8E94D9D3084BEA32007F0AEB + 8E94DA67084BF01F007F0AEB + 8E94DA68084BF01F007F0AEB + 8E5A8EA4084CB19900AE6D62 + 8E5A9054084CB7FE00AE6D62 + 8E5A90B7084CC25900AE6D62 + 8E5A90B8084CC25900AE6D62 + 8EA0A215084CC43F008DFEC9 + 8EA0A216084CC43F008DFEC9 + 8EA0A217084CC43F008DFEC9 + 8EA0A218084CC43F008DFEC9 + 8EA0A21A084CC43F008DFEC9 + 8E14E4A5084D089100246BCC + 8E14E4A6084D089100246BCC + 8E14E4A7084D089100246BCC + 8E14E4AC084D089100246BCC + 8E14E4AD084D089100246BCC + 8E14E4B0084D089100246BCC + 8E74C915084D451C00DF47F3 + 8E74C916084D451C00DF47F3 + 8E74C919084D451C00DF47F3 + 8E74C91A084D451C00DF47F3 + 8E74C91B084D451C00DF47F3 + 8EC18D9D084E3D8200AE0BA9 + 8EC18D9E084E3D8200AE0BA9 + 8EC18D9F084E3D8200AE0BA9 + 8EC18DDB084E403100AE0BA9 + 8EC18EA5084E55A800AE0BA9 + 8EC18EB8084E57D500AE0BA9 + 8EC7DA89084E672F00A079A7 + 8EC7DA8A084E672F00A079A7 + 8E45D7D3084E831E00867D39 + + prevStack + + 8EF6FAD5082DAA2B006F7BE6 + 8EF6FAD6082DAA2B006F7BE6 + 8EF6FAD7082DAA2B006F7BE6 + 8EF6FAD8082DAA2B006F7BE6 + 8EF6FADA082DAA2B006F7BE6 + 8EF6FADC082DAA2B006F7BE6 + 8EF6FADD082DAA2B006F7BE6 + 8EF6FADE082DAA2B006F7BE6 + 8EF6FADF082DAA2B006F7BE6 + 8EF6FAE1082DAA2B006F7BE6 + 8EF6FAEF082DAA2B006F7BE6 + 8EF6FAF3082DAA2B006F7BE6 + 8EE4A6C3082E6F6100415456 + 8EE4A6C8082E6F6100415456 + 8EE4A6FE082E704E00415456 + 8EE4A799082E7D8700415456 + 8E9BF08B082FB9DD00B26943 + 8E4721AE08318F3E001F89FA + 8E4721AF08318F3E001F89FA + 8E4721B008318F3E001F89FA + 8E4721B108318F3E001F89FA + 8E4721B208318F3E001F89FA + 8E4721B308318F3E001F89FA + 8E4721B908318F3E001F89FA + 8E4721BA08318F3E001F89FA + 8E4721E008319EFC001F89FA + 8E4721E108319EFC001F89FA + 8E4721E508319EFC001F89FA + 8E4521C408327F4C00F8BA7C + 8E4522A608329C9B00F8BA7C + 8E4522AF08329C9B00F8BA7C + 8E287164083695080013CE39 + 8EDE0CCC08369EB200EABFE4 + 8E267D8C0837F963004ACBC5 + 8E267D8D0837F963004ACBC5 + 8E267D900837F963004ACBC5 + 8E267D910837F963004ACBC5 + 8E267D920837F963004ACBC5 + 8E267D940837F963004ACBC5 + 8E267DA00837FA6E004ACBC5 + 8E267E0308380176004ACBC5 + 8E267E1A083801D8004ACBC5 + 8E1A182C083806B700AEA302 + 8E297910083D892800F2C55A + 8E6529B5083D8D7F00A7AF1B + 8E652A39083E1A7900A7AF1B + 8E652A3A083E1A7900A7AF1B + 8EDCBDDB084061E500F5C7E3 + 8EDCBDDC084061E500F5C7E3 + 8E0EBF58084BAA56003A6E64 + 8E0EBF59084BAA56003A6E64 + 8E10DC08084BBE490013815C + 8E5A90BB084CC25900AE6D62 + 8E14E4B3084D089100246BCC + 8E14E4B4084D089100246BCC + 8E14E4B5084D089100246BCC + 8E14E4CB084D089100246BCC + 8EC18EAA084E55A800AE0BA9 + 8EC18EBD084E57D500AE0BA9 + + + SplitCount + 1 + + StatusBarVisibility + + + GeometryConfiguration + + Frame + {{0, 0}, {816, 404}} + RubberWindowFrame + 1 122 1024 624 0 0 1024 746 + + Module + PBXNavigatorGroup + Proportion + 404pt + + + ContentConfiguration + + PBXProjectModuleGUID + 1CE0B20506471E060097A5F4 + PBXProjectModuleLabel + Detail + + GeometryConfiguration + + Frame + {{0, 409}, {816, 174}} + RubberWindowFrame + 1 122 1024 624 0 0 1024 746 + + Module + XCDetailModule + Proportion + 174pt + + + Proportion + 816pt + + + Name + Project + ServiceClasses + + XCModuleDock + PBXSmartGroupTreeModule + XCModuleDock + PBXNavigatorGroup + XCDetailModule + + TableOfContents + + 8ED1CBB8084F633100771E1E + 1CE0B1FE06471DED0097A5F4 + 8ED1CBB9084F633100771E1E + 1CE0B20306471E060097A5F4 + 1CE0B20506471E060097A5F4 + + ToolbarConfiguration + xcode.toolbar.config.default + + + ControllerClassBaseName + + IconName + WindowOfProject + Identifier + perspective.morph + IsVertical + 0 + Layout + + + BecomeActive + 1 + ContentConfiguration + + PBXBottomSmartGroupGIDs + + 1C37FBAC04509CD000000102 + 1C37FAAC04509CD000000102 + 1C08E77C0454961000C914BD + 1C37FABC05509CD000000102 + 1C37FABC05539CD112110102 + E2644B35053B69B200211256 + 1C37FABC04509CD000100104 + 1CC0EA4004350EF90044410B + 1CC0EA4004350EF90041110B + + PBXProjectModuleGUID + 11E0B1FE06471DED0097A5F4 + PBXProjectModuleLabel + Files + PBXProjectStructureProvided + yes + PBXSmartGroupTreeModuleColumnData + + PBXSmartGroupTreeModuleColumnWidthsKey + + 186 + + PBXSmartGroupTreeModuleColumnsKey_v4 + + MainColumn + + + PBXSmartGroupTreeModuleOutlineStateKey_v7 + + PBXSmartGroupTreeModuleOutlineStateExpansionKey + + 29B97314FDCFA39411CA2CEA + 1C37FABC05509CD000000102 + + PBXSmartGroupTreeModuleOutlineStateSelectionKey + + + 0 + + + PBXSmartGroupTreeModuleOutlineStateVisibleRectKey + {{0, 0}, {186, 337}} + + PBXTopSmartGroupGIDs + + XCIncludePerspectivesSwitch + 1 + XCSharingToken + com.apple.Xcode.GFSharingToken + + GeometryConfiguration + + Frame + {{0, 0}, {203, 355}} + GroupTreeTableConfiguration + + MainColumn + 186 + + RubberWindowFrame + 373 269 690 397 0 0 1440 878 + + Module + PBXSmartGroupTreeModule + Proportion + 100% + + + Name + Morph + PreferredWidth + 300 + ServiceClasses + + XCModuleDock + PBXSmartGroupTreeModule + + TableOfContents + + 11E0B1FE06471DED0097A5F4 + + ToolbarConfiguration + xcode.toolbar.config.default.short + + + PerspectivesBarVisible + + ShelfIsVisible + + SourceDescription + file at '/System/Library/PrivateFrameworks/DevToolsInterface.framework/Versions/A/Resources/XCPerspectivesSpecificationMode1.xcperspec' + StatusbarIsVisible + + TimeStamp + 0.0 + ToolbarDisplayMode + 1 + ToolbarIsVisible + + ToolbarSizeMode + 1 + Type + Perspectives + UpdateMessage + The Default Workspace in this version of Xcode now includes support to hide and show the detail view (what has been referred to as the "Metro-Morph" feature). You must discard your current Default Workspace settings and update to the latest Default Workspace in order to gain this feature. Do you wish to update to the latest Workspace defaults for project '%@'? + WindowJustification + 5 + WindowOrderList + + /Users/xugg/Projects/Cog/Cog.xcode + + WindowString + 1 122 1024 624 0 0 1024 746 + WindowTools + + + FirstTimeWindowDisplayed + + Identifier + windowTool.build + IsVertical + + Layout + + + Dock + + + BecomeActive + + ContentConfiguration + + PBXProjectModuleGUID + 1CD0528F0623707200166675 + PBXProjectModuleLabel + AACFile.m + StatusBarVisibility + + + GeometryConfiguration + + Frame + {{0, 0}, {1024, 342}} + RubberWindowFrame + 0 122 1024 624 0 0 1024 746 + + Module + PBXNavigatorGroup + Proportion + 342pt + + + ContentConfiguration + + PBXBuildLogShowsTranscriptDefaultKey + {{0, 92}, {1024, 144}} + PBXProjectModuleGUID + XCMainBuildResultsModuleGUID + PBXProjectModuleLabel + Build + XCBuildResultsTrigger_Collapse + 1021 + XCBuildResultsTrigger_Open + 1011 + + GeometryConfiguration + + Frame + {{0, 347}, {1024, 236}} + RubberWindowFrame + 0 122 1024 624 0 0 1024 746 + + Module + PBXBuildResultsModule + Proportion + 236pt + + + Proportion + 583pt + + + Name + Build Results + ServiceClasses + + PBXBuildResultsModule + + StatusbarIsVisible + + TableOfContents + + 8EF6FAA6082DA951006F7BE6 + 8E45D7CC084E82FF00867D39 + 1CD0528F0623707200166675 + XCMainBuildResultsModuleGUID + + ToolbarConfiguration + xcode.toolbar.config.build + WindowString + 0 122 1024 624 0 0 1024 746 + WindowToolGUID + 8EF6FAA6082DA951006F7BE6 + WindowToolIsVisible + + + + FirstTimeWindowDisplayed + + Identifier + windowTool.debugger + IsVertical + + Layout + + + Dock + + + ContentConfiguration + + Debugger + + HorizontalSplitView + + _collapsingFrameDimension + 0.0 + _indexOfCollapsedView + 0 + _percentageOfCollapsedView + 0.0 + isCollapsed + yes + sizes + + {{0, 0}, {245, 210}} + {{245, 0}, {779, 210}} + + + VerticalSplitView + + _collapsingFrameDimension + 0.0 + _indexOfCollapsedView + 0 + _percentageOfCollapsedView + 0.0 + isCollapsed + yes + sizes + + {{0, 0}, {1024, 210}} + {{0, 210}, {1024, 374}} + + + + LauncherConfigVersion + 8 + PBXProjectModuleGUID + 1C162984064C10D400B95A72 + PBXProjectModuleLabel + Debug - GLUTExamples (Underwater) + + GeometryConfiguration + + DebugConsoleDrawerSize + {100, 120} + DebugConsoleVisible + None + DebugConsoleWindowFrame + {{200, 200}, {500, 300}} + DebugSTDIOWindowFrame + {{200, 200}, {500, 300}} + Frame + {{0, 0}, {1024, 584}} + RubberWindowFrame + 0 121 1024 625 0 0 1024 746 + + Module + PBXDebugSessionModule + Proportion + 584pt + + + Proportion + 584pt + + + Name + Debugger + ServiceClasses + + PBXDebugSessionModule + + StatusbarIsVisible + + TableOfContents + + 1CD10A99069EF8BA00B06720 + 8EC7DA61084E64C200A079A7 + 1C162984064C10D400B95A72 + 8EC7DA62084E64C200A079A7 + 8EC7DA63084E64C200A079A7 + 8EC7DA64084E64C200A079A7 + 8EC7DA65084E64C200A079A7 + 8EC7DA66084E64C200A079A7 + 8EC7DA67084E64C200A079A7 + + ToolbarConfiguration + xcode.toolbar.config.debug + WindowString + 0 121 1024 625 0 0 1024 746 + WindowToolGUID + 1CD10A99069EF8BA00B06720 + WindowToolIsVisible + + + + FirstTimeWindowDisplayed + + Identifier + windowTool.find + IsVertical + + Layout + + + Dock + + + Dock + + + BecomeActive + + ContentConfiguration + + PBXProjectModuleGUID + 1CDD528C0622207200134675 + PBXProjectModuleLabel + Sound.m + StatusBarVisibility + + + GeometryConfiguration + + Frame + {{0, 0}, {1024, 342}} + RubberWindowFrame + 0 65 1024 681 0 0 1024 746 + + Module + PBXNavigatorGroup + Proportion + 1024pt + + + Proportion + 342pt + + + ContentConfiguration + + PBXProjectModuleGUID + 1CD0528E0623707200166675 + PBXProjectModuleLabel + Project Find + + GeometryConfiguration + + Frame + {{0, 347}, {1024, 293}} + RubberWindowFrame + 0 65 1024 681 0 0 1024 746 + + Module + PBXProjectFindModule + Proportion + 293pt + + + Proportion + 640pt + + + Name + Project Find + ServiceClasses + + PBXProjectFindModule + + StatusbarIsVisible + + TableOfContents + + 1C530D57069F1CE1000CFCEE + 8E50FC75084E14FC0048349E + 8E50FC76084E14FC0048349E + 1CDD528C0622207200134675 + 1CD0528E0623707200166675 + + WindowString + 0 65 1024 681 0 0 1024 746 + WindowToolGUID + 1C530D57069F1CE1000CFCEE + WindowToolIsVisible + + + + Identifier + MENUSEPARATOR + + + FirstTimeWindowDisplayed + + Identifier + windowTool.debuggerConsole + IsVertical + + Layout + + + Dock + + + ContentConfiguration + + PBXProjectModuleGUID + 1C78EAAC065D492600B07095 + PBXProjectModuleLabel + Debugger Console + + GeometryConfiguration + + Frame + {{0, 0}, {440, 358}} + RubberWindowFrame + 525 161 440 400 0 0 1024 746 + + Module + PBXDebugCLIModule + Proportion + 358pt + + + Proportion + 359pt + + + Name + Debugger Console + ServiceClasses + + PBXDebugCLIModule + + StatusbarIsVisible + + TableOfContents + + 8E7A9371083675B600771E14 + 8EC7DA68084E64C200A079A7 + 1C78EAAC065D492600B07095 + + WindowString + 525 161 440 400 0 0 1024 746 + WindowToolGUID + 8E7A9371083675B600771E14 + WindowToolIsVisible + + + + FirstTimeWindowDisplayed + + Identifier + windowTool.run + IsVertical + + Layout + + + Dock + + + ContentConfiguration + + LauncherConfigVersion + 3 + PBXProjectModuleGUID + 1CD0528B0623707200166675 + PBXProjectModuleLabel + Run + Runner + + HorizontalSplitView + + _collapsingFrameDimension + 0.0 + _indexOfCollapsedView + 0 + _percentageOfCollapsedView + 0.0 + isCollapsed + yes + sizes + + {{0, 0}, {367, 168}} + {{0, 173}, {367, 270}} + + + VerticalSplitView + + _collapsingFrameDimension + 0.0 + _indexOfCollapsedView + 0 + _percentageOfCollapsedView + 0.0 + isCollapsed + yes + sizes + + {{0, 0}, {406, 443}} + {{411, 0}, {517, 443}} + + + + + GeometryConfiguration + + Frame + {{0, 0}, {1024, 583}} + RubberWindowFrame + 0 123 1024 623 0 0 1024 746 + + Module + PBXRunSessionModule + Proportion + 583pt + + + Proportion + 582pt + + + Name + Run Log + ServiceClasses + + PBXRunSessionModule + + StatusbarIsVisible + + TableOfContents + + 1C0AD2B3069F1EA900FABCE6 + 8E45D7C5084E82F800867D39 + 1CD0528B0623707200166675 + 8E45D7C6084E82F800867D39 + + ToolbarConfiguration + xcode.toolbar.config.run + WindowString + 0 123 1024 623 0 0 1024 746 + WindowToolGUID + 1C0AD2B3069F1EA900FABCE6 + WindowToolIsVisible + + + + Identifier + windowTool.scm + Layout + + + Dock + + + ContentConfiguration + + PBXProjectModuleGUID + 1C78EAB2065D492600B07095 + PBXProjectModuleLabel + <No Editor> + PBXSplitModuleInNavigatorKey + + Split0 + + PBXProjectModuleGUID + 1C78EAB3065D492600B07095 + + SplitCount + 1 + + StatusBarVisibility + 1 + + GeometryConfiguration + + Frame + {{0, 0}, {452, 0}} + RubberWindowFrame + 743 379 452 308 0 0 1280 1002 + + Module + PBXNavigatorGroup + Proportion + 0pt + + + BecomeActive + 1 + ContentConfiguration + + PBXProjectModuleGUID + 1CD052920623707200166675 + PBXProjectModuleLabel + SCM + + GeometryConfiguration + + ConsoleFrame + {{0, 259}, {452, 0}} + Frame + {{0, 7}, {452, 259}} + RubberWindowFrame + 743 379 452 308 0 0 1280 1002 + TableConfiguration + + Status + 30 + FileName + 199 + Path + 197.09500122070312 + + TableFrame + {{0, 0}, {452, 250}} + + Module + PBXCVSModule + Proportion + 262pt + + + Proportion + 266pt + + + Name + SCM + ServiceClasses + + PBXCVSModule + + StatusbarIsVisible + 1 + TableOfContents + + 1C78EAB4065D492600B07095 + 1C78EAB5065D492600B07095 + 1C78EAB2065D492600B07095 + 1CD052920623707200166675 + + ToolbarConfiguration + xcode.toolbar.config.scm + WindowString + 743 379 452 308 0 0 1280 1002 + + + FirstTimeWindowDisplayed + + Identifier + windowTool.breakpoints + IsVertical + + Layout + + + Dock + + + BecomeActive + + ContentConfiguration + + PBXProjectModuleGUID + 1CD052930623707200166675 + PBXProjectModuleLabel + Breakpoints + + GeometryConfiguration + + BreakpointsTreeTableConfiguration + + enabledColumn + 16 + breakpointColumn + 216 + + Frame + {{0, 0}, {240, 195}} + RubberWindowFrame + 42 484 240 216 0 0 1024 746 + + Module + PBXDebugBreakpointsModule + Proportion + 195pt + + + Proportion + 196pt + + + Name + Breakpoints + ServiceClasses + + PBXDebugBreakpointsModule + + StatusbarIsVisible + + TableOfContents + + 1C0AD2AD069F1E9B00FABCE6 + 8E7E8313084AFAC000C61FB4 + 1CD052930623707200166675 + + WindowString + 42 484 240 216 0 0 1024 746 + WindowToolGUID + 1C0AD2AD069F1E9B00FABCE6 + WindowToolIsVisible + + + + Identifier + windowTool.bookmarks + Layout + + + Dock + + + Module + PBXBookmarksModule + Proportion + 100% + + + Proportion + 100% + + + Name + Bookmarks + ServiceClasses + + PBXBookmarksModule + + StatusbarIsVisible + 0 + WindowString + 538 42 401 187 0 0 1280 1002 + + + Identifier + windowTool.classBrowser + Layout + + + Dock + + + BecomeActive + 1 + ContentConfiguration + + OptionsSetName + Hierarchy, all classes + PBXProjectModuleGUID + 1CA6456E063B45B4001379D8 + PBXProjectModuleLabel + Class Browser - NSObject + + GeometryConfiguration + + ClassesFrame + {{0, 0}, {374, 96}} + ClassesTreeTableConfiguration + + PBXClassNameColumnIdentifier + 208 + PBXClassBookColumnIdentifier + 22 + + Frame + {{0, 0}, {630, 331}} + MembersFrame + {{0, 105}, {374, 395}} + MembersTreeTableConfiguration + + PBXMemberTypeIconColumnIdentifier + 22 + PBXMemberNameColumnIdentifier + 216 + PBXMemberTypeColumnIdentifier + 97 + PBXMemberBookColumnIdentifier + 22 + + PBXModuleWindowStatusBarHidden2 + 1 + RubberWindowFrame + 385 179 630 352 0 0 1440 878 + + Module + PBXClassBrowserModule + Proportion + 332pt + + + Proportion + 332pt + + + Name + Class Browser + ServiceClasses + + PBXClassBrowserModule + + StatusbarIsVisible + 0 + TableOfContents + + 1C0AD2AF069F1E9B00FABCE6 + 1C0AD2B0069F1E9B00FABCE6 + 1CA6456E063B45B4001379D8 + + ToolbarConfiguration + xcode.toolbar.config.classbrowser + WindowString + 385 179 630 352 0 0 1440 878 + WindowToolGUID + 1C0AD2AF069F1E9B00FABCE6 + WindowToolIsVisible + 0 + + + + diff --git a/Cog.xcode/xugg.pbxuser b/Cog.xcode/xugg.pbxuser new file mode 100644 index 000000000..62f16162b --- /dev/null +++ b/Cog.xcode/xugg.pbxuser @@ -0,0 +1,2574 @@ +// !$*UTF8*$! +{ + 089C165DFE840E0CC02AAC07 = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {775, 372}}"; + sepNavSelRange = "{111, 0}"; + sepNavVisRect = "{{0, 0}, {775, 372}}"; + sepNavWindowFrame = "{{15, 61}, {1016, 680}}"; + }; + }; + 29B97313FDCFA39411CA2CEA = { + activeBuildStyle = 4A9504CCFFE6A4B311CA0CBA; + activeExecutable = 8EB77455082DA3EB005891CA; + activeTarget = 8D1107260486CEB800E47090; + addToTargets = ( + 8D1107260486CEB800E47090, + ); + breakpoints = ( + 8EF1B97C083A49980095B236, + 8EEFDF8808410C00008BB533, + 8EDC87BA0842F2A4007D1532, + ); + codeSenseManager = 8EB77467082DA402005891CA; + executables = ( + 8EB77455082DA3EB005891CA, + ); + perUserDictionary = { + PBXConfiguration.PBXFileTableDataSource3.PBXFileTableDataSource = { + PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; + PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Target_ColumnID; + PBXFileTableDataSourceColumnWidthsKey = ( + 20, + 577, + 20, + 48, + 43, + 43, + 20, + ); + PBXFileTableDataSourceColumnsKey = ( + PBXFileDataSource_FiletypeID, + PBXFileDataSource_Filename_ColumnID, + PBXFileDataSource_Built_ColumnID, + PBXFileDataSource_ObjectSize_ColumnID, + PBXFileDataSource_Errors_ColumnID, + PBXFileDataSource_Warnings_ColumnID, + PBXFileDataSource_Target_ColumnID, + ); + }; + PBXConfiguration.PBXFileTableDataSource3.PBXFindDataSource = { + PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; + PBXFileTableDataSourceColumnSortingKey = PBXFindDataSource_LocationID; + PBXFileTableDataSourceColumnWidthsKey = ( + 200, + 120, + ); + PBXFileTableDataSourceColumnsKey = ( + PBXFindDataSource_MessageID, + PBXFindDataSource_LocationID, + ); + }; + PBXConfiguration.PBXTargetDataSource.PBXTargetDataSource = { + PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; + PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID; + PBXFileTableDataSourceColumnWidthsKey = ( + 20, + 200, + 397, + 20, + 48, + 43, + 43, + ); + PBXFileTableDataSourceColumnsKey = ( + PBXFileDataSource_FiletypeID, + PBXFileDataSource_Filename_ColumnID, + PBXTargetDataSource_PrimaryAttribute, + PBXFileDataSource_Built_ColumnID, + PBXFileDataSource_ObjectSize_ColumnID, + PBXFileDataSource_Errors_ColumnID, + PBXFileDataSource_Warnings_ColumnID, + ); + }; + PBXPerProjectTemplateStateSaveDate = 139420459; + PBXWorkspaceStateSaveDate = 139420459; + }; + perUserProjectItems = { + 8E0EBF58084BAA56003A6E64 = 8E0EBF58084BAA56003A6E64; + 8E0EBF59084BAA56003A6E64 = 8E0EBF59084BAA56003A6E64; + 8E10DC00084BBE490013815C = 8E10DC00084BBE490013815C; + 8E10DC01084BBE490013815C = 8E10DC01084BBE490013815C; + 8E10DC02084BBE490013815C = 8E10DC02084BBE490013815C; + 8E10DC08084BBE490013815C = 8E10DC08084BBE490013815C; + 8E14E4A5084D089100246BCC = 8E14E4A5084D089100246BCC; + 8E14E4A6084D089100246BCC = 8E14E4A6084D089100246BCC; + 8E14E4A7084D089100246BCC = 8E14E4A7084D089100246BCC; + 8E14E4AC084D089100246BCC = 8E14E4AC084D089100246BCC; + 8E14E4AD084D089100246BCC = 8E14E4AD084D089100246BCC; + 8E14E4B0084D089100246BCC = 8E14E4B0084D089100246BCC; + 8E14E4B3084D089100246BCC = 8E14E4B3084D089100246BCC; + 8E14E4B4084D089100246BCC = 8E14E4B4084D089100246BCC; + 8E14E4B5084D089100246BCC = 8E14E4B5084D089100246BCC; + 8E14E4CB084D089100246BCC = 8E14E4CB084D089100246BCC; + 8E1A1826083806B700AEA302 = 8E1A1826083806B700AEA302; + 8E1A182C083806B700AEA302 = 8E1A182C083806B700AEA302; + 8E1BDA7908430E7700A08868 = 8E1BDA7908430E7700A08868; + 8E25B5E5083CDD4A0064353E = 8E25B5E5083CDD4A0064353E; + 8E267D8C0837F963004ACBC5 = 8E267D8C0837F963004ACBC5; + 8E267D8D0837F963004ACBC5 = 8E267D8D0837F963004ACBC5; + 8E267D900837F963004ACBC5 = 8E267D900837F963004ACBC5; + 8E267D910837F963004ACBC5 = 8E267D910837F963004ACBC5; + 8E267D920837F963004ACBC5 = 8E267D920837F963004ACBC5; + 8E267D940837F963004ACBC5 = 8E267D940837F963004ACBC5; + 8E267DA00837FA6E004ACBC5 = 8E267DA00837FA6E004ACBC5; + 8E267DDB0837FE5F004ACBC5 = 8E267DDB0837FE5F004ACBC5; + 8E267E0008380176004ACBC5 = 8E267E0008380176004ACBC5; + 8E267E0308380176004ACBC5 = 8E267E0308380176004ACBC5; + 8E267E1A083801D8004ACBC5 = 8E267E1A083801D8004ACBC5; + 8E287164083695080013CE39 = 8E287164083695080013CE39; + 8E297910083D892800F2C55A = 8E297910083D892800F2C55A; + 8E4521C408327F4C00F8BA7C = 8E4521C408327F4C00F8BA7C; + 8E4522A608329C9B00F8BA7C = 8E4522A608329C9B00F8BA7C; + 8E4522AF08329C9B00F8BA7C = 8E4522AF08329C9B00F8BA7C; + 8E45D7D3084E831E00867D39 = 8E45D7D3084E831E00867D39; + 8E4721AE08318F3E001F89FA = 8E4721AE08318F3E001F89FA; + 8E4721AF08318F3E001F89FA = 8E4721AF08318F3E001F89FA; + 8E4721B008318F3E001F89FA = 8E4721B008318F3E001F89FA; + 8E4721B108318F3E001F89FA = 8E4721B108318F3E001F89FA; + 8E4721B208318F3E001F89FA = 8E4721B208318F3E001F89FA; + 8E4721B308318F3E001F89FA = 8E4721B308318F3E001F89FA; + 8E4721B908318F3E001F89FA = 8E4721B908318F3E001F89FA; + 8E4721BA08318F3E001F89FA = 8E4721BA08318F3E001F89FA; + 8E4721E008319EFC001F89FA = 8E4721E008319EFC001F89FA; + 8E4721E108319EFC001F89FA = 8E4721E108319EFC001F89FA; + 8E4721E508319EFC001F89FA = 8E4721E508319EFC001F89FA; + 8E5A8EA4084CB19900AE6D62 = 8E5A8EA4084CB19900AE6D62; + 8E5A9054084CB7FE00AE6D62 = 8E5A9054084CB7FE00AE6D62; + 8E5A90B7084CC25900AE6D62 = 8E5A90B7084CC25900AE6D62; + 8E5A90B8084CC25900AE6D62 = 8E5A90B8084CC25900AE6D62; + 8E5A90BB084CC25900AE6D62 = 8E5A90BB084CC25900AE6D62; + 8E6082C7083920310017AECF = 8E6082C7083920310017AECF; + 8E6529B5083D8D7F00A7AF1B = 8E6529B5083D8D7F00A7AF1B; + 8E652A33083E1A7900A7AF1B = 8E652A33083E1A7900A7AF1B; + 8E652A34083E1A7900A7AF1B = 8E652A34083E1A7900A7AF1B; + 8E652A35083E1A7900A7AF1B = 8E652A35083E1A7900A7AF1B; + 8E652A36083E1A7900A7AF1B = 8E652A36083E1A7900A7AF1B; + 8E652A39083E1A7900A7AF1B = 8E652A39083E1A7900A7AF1B; + 8E652A3A083E1A7900A7AF1B = 8E652A3A083E1A7900A7AF1B; + 8E6F2A2708480D900011F126 = 8E6F2A2708480D900011F126; + 8E6F2A2808480D900011F126 = 8E6F2A2808480D900011F126; + 8E6F2ACC08481B100011F126 = 8E6F2ACC08481B100011F126; + 8E74C915084D451C00DF47F3 = 8E74C915084D451C00DF47F3; + 8E74C916084D451C00DF47F3 = 8E74C916084D451C00DF47F3; + 8E74C919084D451C00DF47F3 = 8E74C919084D451C00DF47F3; + 8E74C91A084D451C00DF47F3 = 8E74C91A084D451C00DF47F3; + 8E74C91B084D451C00DF47F3 = 8E74C91B084D451C00DF47F3; + 8E94D973084BE3D1007F0AEB = 8E94D973084BE3D1007F0AEB; + 8E94D9D2084BEA32007F0AEB = 8E94D9D2084BEA32007F0AEB; + 8E94D9D3084BEA32007F0AEB = 8E94D9D3084BEA32007F0AEB; + 8E94DA67084BF01F007F0AEB = 8E94DA67084BF01F007F0AEB; + 8E94DA68084BF01F007F0AEB = 8E94DA68084BF01F007F0AEB; + 8E9BF08B082FB9DD00B26943 = 8E9BF08B082FB9DD00B26943; + 8E9BF100082FEF6B00B26943 = 8E9BF100082FEF6B00B26943; + 8EA0A215084CC43F008DFEC9 = 8EA0A215084CC43F008DFEC9; + 8EA0A216084CC43F008DFEC9 = 8EA0A216084CC43F008DFEC9; + 8EA0A217084CC43F008DFEC9 = 8EA0A217084CC43F008DFEC9; + 8EA0A218084CC43F008DFEC9 = 8EA0A218084CC43F008DFEC9; + 8EA0A21A084CC43F008DFEC9 = 8EA0A21A084CC43F008DFEC9; + 8EC18D9D084E3D8200AE0BA9 = 8EC18D9D084E3D8200AE0BA9; + 8EC18D9E084E3D8200AE0BA9 = 8EC18D9E084E3D8200AE0BA9; + 8EC18D9F084E3D8200AE0BA9 = 8EC18D9F084E3D8200AE0BA9; + 8EC18DDB084E403100AE0BA9 = 8EC18DDB084E403100AE0BA9; + 8EC18EA5084E55A800AE0BA9 = 8EC18EA5084E55A800AE0BA9; + 8EC18EAA084E55A800AE0BA9 = 8EC18EAA084E55A800AE0BA9; + 8EC18EB8084E57D500AE0BA9 = 8EC18EB8084E57D500AE0BA9; + 8EC18EBD084E57D500AE0BA9 = 8EC18EBD084E57D500AE0BA9; + 8EC7DA89084E672F00A079A7 = 8EC7DA89084E672F00A079A7; + 8EC7DA8A084E672F00A079A7 = 8EC7DA8A084E672F00A079A7; + 8EC8FBD20842932A00DF2C98 = 8EC8FBD20842932A00DF2C98; + 8ED1CBB7084F633100771E1E = 8ED1CBB7084F633100771E1E; + 8ED3C9B1084915CE00BB7797 = 8ED3C9B1084915CE00BB7797; + 8ED833CD08457E6B0033CDBD = 8ED833CD08457E6B0033CDBD; + 8EDC88A90842F8DE007D1532 = 8EDC88A90842F8DE007D1532; + 8EDC88B50842F936007D1532 = 8EDC88B50842F936007D1532; + 8EDCBDDB084061E500F5C7E3 = 8EDCBDDB084061E500F5C7E3; + 8EDCBDDC084061E500F5C7E3 = 8EDCBDDC084061E500F5C7E3; + 8EDCBEF40840FA2200F5C7E3 = 8EDCBEF40840FA2200F5C7E3; + 8EDE0CCC08369EB200EABFE4 = 8EDE0CCC08369EB200EABFE4; + 8EE4A6C3082E6F6100415456 = 8EE4A6C3082E6F6100415456; + 8EE4A6C8082E6F6100415456 = 8EE4A6C8082E6F6100415456; + 8EE4A6FE082E704E00415456 = 8EE4A6FE082E704E00415456; + 8EE4A799082E7D8700415456 = 8EE4A799082E7D8700415456; + 8EF6FACD082DAA2B006F7BE6 = 8EF6FACD082DAA2B006F7BE6; + 8EF6FAD1082DAA2B006F7BE6 = 8EF6FAD1082DAA2B006F7BE6; + 8EF6FAD5082DAA2B006F7BE6 = 8EF6FAD5082DAA2B006F7BE6; + 8EF6FAD6082DAA2B006F7BE6 = 8EF6FAD6082DAA2B006F7BE6; + 8EF6FAD7082DAA2B006F7BE6 = 8EF6FAD7082DAA2B006F7BE6; + 8EF6FAD8082DAA2B006F7BE6 = 8EF6FAD8082DAA2B006F7BE6; + 8EF6FADA082DAA2B006F7BE6 = 8EF6FADA082DAA2B006F7BE6; + 8EF6FADC082DAA2B006F7BE6 = 8EF6FADC082DAA2B006F7BE6; + 8EF6FADD082DAA2B006F7BE6 = 8EF6FADD082DAA2B006F7BE6; + 8EF6FADE082DAA2B006F7BE6 = 8EF6FADE082DAA2B006F7BE6; + 8EF6FADF082DAA2B006F7BE6 = 8EF6FADF082DAA2B006F7BE6; + 8EF6FAE1082DAA2B006F7BE6 = 8EF6FAE1082DAA2B006F7BE6; + 8EF6FAEF082DAA2B006F7BE6 = 8EF6FAEF082DAA2B006F7BE6; + 8EF6FAF3082DAA2B006F7BE6 = 8EF6FAF3082DAA2B006F7BE6; + }; + sourceControlManager = 8EB77466082DA402005891CA; + userBuildSettings = { + }; + }; + 29B97316FDCFA39411CA2CEA = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {711, 551}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRect = "{{0, 0}, {711, 551}}"; + sepNavWindowFrame = "{{15, 61}, {750, 680}}"; + }; + }; + 8D1107260486CEB800E47090 = { + activeExec = 0; + executables = ( + 8EB77455082DA3EB005891CA, + ); + }; + 8D1107310486CEB800E47090 = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {775, 1274}}"; + sepNavSelRange = "{501, 0}"; + sepNavVisRect = "{{0, 20}, {775, 372}}"; + sepNavWindowFrame = "{{15, 61}, {500, 680}}"; + }; + }; + 8E0EBF0C084BA776003A6E64 = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {775, 372}}"; + sepNavSelRange = "{218, 0}"; + sepNavVisRect = "{{0, 0}, {775, 372}}"; + }; + }; + 8E0EBF0D084BA776003A6E64 = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {983, 350}}"; + sepNavSelRange = "{257, 0}"; + sepNavVisRect = "{{0, 0}, {983, 310}}"; + }; + }; + 8E0EBF58084BAA56003A6E64 = { + fRef = 8E0EBF0C084BA776003A6E64; + isa = PBXTextBookmark; + name = "NSDebug.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 140; + vrLoc = 0; + }; + 8E0EBF59084BAA56003A6E64 = { + fRef = 8E0EBF0D084BA776003A6E64; + isa = PBXTextBookmark; + name = "NSDebug.c: 10"; + rLen = 0; + rLoc = 140; + rType = 0; + vrLen = 241; + vrLoc = 0; + }; + 8E10DBEF084BBCF00013815C = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {775, 372}}"; + sepNavSelRange = "{36, 0}"; + sepNavVisRect = "{{0, 0}, {775, 372}}"; + }; + }; + 8E10DC00084BBE490013815C = { + fRef = 089C165DFE840E0CC02AAC07; + isa = PBXTextBookmark; + name = "English: 4"; + rLen = 0; + rLoc = 111; + rType = 0; + vrLen = 119; + vrLoc = 0; + }; + 8E10DC01084BBE490013815C = { + fRef = 8D1107310486CEB800E47090; + isa = PBXTextBookmark; + name = "Info.plist: 18"; + rLen = 0; + rLoc = 501; + rType = 0; + vrLen = 677; + vrLoc = 39; + }; + 8E10DC02084BBE490013815C = { + fRef = 8E10DBEF084BBCF00013815C; + isa = PBXTextBookmark; + name = "Credits.html: 5"; + rLen = 0; + rLoc = 30; + rType = 0; + vrLen = 30; + vrLoc = 0; + }; + 8E10DC08084BBE490013815C = { + fRef = 8E10DBEF084BBCF00013815C; + isa = PBXTextBookmark; + name = "Credits.html: 5"; + rLen = 0; + rLoc = 30; + rType = 0; + vrLen = 30; + vrLoc = 0; + }; + 8E14E479084CF1A200246BCC = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {775, 434}}"; + sepNavSelRange = "{406, 0}"; + sepNavVisRect = "{{0, 0}, {775, 372}}"; + }; + }; + 8E14E47A084CF1A200246BCC = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {775, 1960}}"; + sepNavSelRange = "{182, 0}"; + sepNavVisRect = "{{0, 28}, {775, 372}}"; + }; + }; + 8E14E4A5084D089100246BCC = { + fRef = 8E3851EC084CEC0200D715B8; + isa = PBXTextBookmark; + name = "faad.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1096; + vrLoc = 227; + }; + 8E14E4A6084D089100246BCC = { + fRef = 8EF6FA68082DA526006F7BE6; + isa = PBXTextBookmark; + name = "MonkeysFile.m: 20"; + rLen = 0; + rLoc = 343; + rType = 0; + vrLen = 500; + vrLoc = 1226; + }; + 8E14E4A7084D089100246BCC = { + fRef = 8EF6FA6A082DA526006F7BE6; + isa = PBXTextBookmark; + name = "MPEGFile.m: 41"; + rLen = 0; + rLoc = 893; + rType = 0; + vrLen = 803; + vrLoc = 464; + }; + 8E14E4AA084D089100246BCC = { + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = libmp4.c; + path = /Users/xugg/Desktop/faad2.1/plugins/xmms/src/libmp4.c; + refType = 0; + sourceTree = ""; + }; + 8E14E4AC084D089100246BCC = { + fRef = 8EF6FA65082DA526006F7BE6; + isa = PBXTextBookmark; + name = "FlacFile.h: 10"; + rLen = 0; + rLoc = 183; + rType = 0; + vrLen = 619; + vrLoc = 3; + }; + 8E14E4AD084D089100246BCC = { + fRef = 8EF6FA69082DA526006F7BE6; + isa = PBXTextBookmark; + name = "MPEGFile.h: 14"; + rLen = 0; + rLoc = 245; + rType = 0; + vrLen = 272; + vrLoc = 0; + }; + 8E14E4B0084D089100246BCC = { + fRef = 8EF6FA6D082DA526006F7BE6; + isa = PBXTextBookmark; + name = "SoundFile.h: channels"; + rLen = 0; + rLoc = 358; + rType = 0; + vrLen = 495; + vrLoc = 0; + }; + 8E14E4B3084D089100246BCC = { + fRef = 8E3851EC084CEC0200D715B8; + isa = PBXTextBookmark; + name = "faad.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1096; + vrLoc = 227; + }; + 8E14E4B4084D089100246BCC = { + fRef = 8E14E479084CF1A200246BCC; + isa = PBXTextBookmark; + name = "AACFile.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 203; + vrLoc = 0; + }; + 8E14E4B5084D089100246BCC = { + fRef = 8E14E47A084CF1A200246BCC; + isa = PBXTextBookmark; + name = "AACFile.m: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 188; + vrLoc = 0; + }; + 8E14E4CB084D089100246BCC = { + fRef = 8E14E4CC084D089100246BCC; + isa = PBXTextBookmark; + name = "(null): 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 578; + vrLoc = 0; + }; + 8E14E4CC084D089100246BCC = { + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = libmp4.c; + path = /Users/xugg/Desktop/faad2.1/plugins/xmms/src/libmp4.c; + refType = 0; + sourceTree = ""; + }; + 8E1A1826083806B700AEA302 = { + fRef = 8E1A1827083806B700AEA302; + isa = PBXTextBookmark; + name = "(null): 1"; + rLen = 2113; + rLoc = 0; + rType = 0; + vrLen = 939; + vrLoc = 1174; + }; + 8E1A1827083806B700AEA302 = { + isa = PBXFileReference; + lastKnownFileType = text.xml; + name = Info.plist; + path = /Users/xugg/Projects/zyGora/Info.plist; + refType = 0; + sourceTree = ""; + }; + 8E1A182C083806B700AEA302 = { + fRef = 8E1A182D083806B700AEA302; + isa = PBXTextBookmark; + name = "(null): 1"; + rLen = 2113; + rLoc = 0; + rType = 0; + vrLen = 939; + vrLoc = 1174; + }; + 8E1A182D083806B700AEA302 = { + isa = PBXFileReference; + lastKnownFileType = text.xml; + name = Info.plist; + path = /Users/xugg/Projects/zyGora/Info.plist; + refType = 0; + sourceTree = ""; + }; + 8E1BDA7908430E7700A08868 = { + fRef = 8EF6FA70082DA526006F7BE6; + isa = PBXTextBookmark; + name = "VorbisFile.m: 31"; + rLen = 0; + rLoc = 470; + rType = 0; + vrLen = 475; + vrLoc = 230; + }; + 8E25B5E5083CDD4A0064353E = { + fRef = 8E47218508318D7A001F89FA; + isa = PBXTextBookmark; + name = "DNDArrayController.h: 23"; + rLen = 0; + rLoc = 811; + rType = 0; + vrLen = 811; + vrLoc = 0; + }; + 8E267D040837F7A6004ACBC5 = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {775, 547}}"; + sepNavSelRange = "{302, 0}"; + sepNavVisRect = "{{0, 0}, {775, 547}}"; + }; + }; + 8E267D050837F7A6004ACBC5 = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {920, 1050}}"; + sepNavSelRange = "{471, 0}"; + sepNavVisRect = "{{0, 241}, {775, 372}}"; + }; + }; + 8E267D060837F7A6004ACBC5 = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {775, 547}}"; + sepNavSelRange = "{221, 0}"; + sepNavVisRect = "{{0, 0}, {775, 547}}"; + }; + }; + 8E267D070837F7A6004ACBC5 = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {983, 1848}}"; + sepNavSelRange = "{999, 0}"; + sepNavVisRect = "{{0, 314}, {983, 310}}"; + }; + }; + 8E267D090837F7A6004ACBC5 = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {775, 994}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRect = "{{0, 0}, {775, 372}}"; + }; + }; + 8E267D0A0837F7A6004ACBC5 = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {740, 5600}}"; + sepNavSelRange = "{7208, 5}"; + sepNavVisRect = "{{0, 3039}, {740, 180}}"; + }; + }; + 8E267D0B0837F7A6004ACBC5 = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {775, 658}}"; + sepNavSelRange = "{998, 0}"; + sepNavVisRect = "{{0, 272}, {775, 372}}"; + }; + }; + 8E267D0C0837F7A6004ACBC5 = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1022, 2366}}"; + sepNavSelRange = "{818, 0}"; + sepNavVisRect = "{{0, 132}, {775, 372}}"; + }; + }; + 8E267D8C0837F963004ACBC5 = { + fRef = 8E267D040837F7A6004ACBC5; + isa = PBXTextBookmark; + name = "FeedbackController.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 550; + vrLoc = 0; + }; + 8E267D8D0837F963004ACBC5 = { + fRef = 8E267D050837F7A6004ACBC5; + isa = PBXTextBookmark; + name = "FeedbackController.m: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 998; + vrLoc = 0; + }; + 8E267D900837F963004ACBC5 = { + fRef = 8E267D060837F7A6004ACBC5; + isa = PBXTextBookmark; + name = "FeedbackSocket.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 424; + vrLoc = 0; + }; + 8E267D910837F963004ACBC5 = { + fRef = 8E267D070837F7A6004ACBC5; + isa = PBXTextBookmark; + name = "FeedbackSocket.m: 29"; + rLen = 0; + rLoc = 851; + rType = 0; + vrLen = 1023; + vrLoc = 2398; + }; + 8E267D920837F963004ACBC5 = { + fRef = 8E267D0B0837F7A6004ACBC5; + isa = PBXTextBookmark; + name = "UpdateController.h: 10"; + rLen = 0; + rLoc = 175; + rType = 0; + vrLen = 927; + vrLoc = 0; + }; + 8E267D940837F963004ACBC5 = { + fRef = 8E267D090837F7A6004ACBC5; + isa = PBXTextBookmark; + name = "MacPADSocket.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1424; + vrLoc = 0; + }; + 8E267DA00837FA6E004ACBC5 = { + fRef = 8E267D0C0837F7A6004ACBC5; + isa = PBXTextBookmark; + name = "UpdateController.m: 135"; + rLen = 0; + rLoc = 3657; + rType = 0; + vrLen = 1150; + vrLoc = 3310; + }; + 8E267DDB0837FE5F004ACBC5 = { + fRef = 8E267D060837F7A6004ACBC5; + isa = PBXTextBookmark; + name = "FeedbackSocket.h: from"; + rLen = 0; + rLoc = 221; + rType = 0; + vrLen = 495; + vrLoc = 0; + }; + 8E267E0008380176004ACBC5 = { + fRef = 8E267D070837F7A6004ACBC5; + isa = PBXTextBookmark; + name = "FeedbackSocket.m: 30"; + rLen = 0; + rLoc = 818; + rType = 0; + vrLen = 1440; + vrLoc = 139; + }; + 8E267E0308380176004ACBC5 = { + fRef = 8D1107310486CEB800E47090; + isa = PBXTextBookmark; + name = "Info.plist: 20"; + rLen = 0; + rLoc = 258; + rType = 0; + vrLen = 777; + vrLoc = 0; + }; + 8E267E1A083801D8004ACBC5 = { + fRef = 089C165DFE840E0CC02AAC07; + isa = PBXTextBookmark; + name = "English: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 112; + vrLoc = 0; + }; + 8E2871080836934A0013CE39 = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {4550, 1246}}"; + sepNavSelRange = "{3334, 0}"; + sepNavVisRect = "{{0, 874}, {775, 372}}"; + }; + }; + 8E2871090836934A0013CE39 = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {4550, 4340}}"; + sepNavSelRange = "{2692, 0}"; + sepNavVisRect = "{{0, 328}, {775, 372}}"; + }; + }; + 8E287164083695080013CE39 = { + fRef = 8E2871090836934A0013CE39; + isa = PBXTextBookmark; + name = "VirtualRingBuffer.m: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1783; + vrLoc = 0; + }; + 8E297908083D891500F2C55A = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {983, 392}}"; + sepNavSelRange = "{355, 0}"; + sepNavVisRect = "{{0, 0}, {983, 310}}"; + sepNavWindowFrame = "{{15, 61}, {702, 680}}"; + }; + }; + 8E297909083D891500F2C55A = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {775, 547}}"; + sepNavSelRange = "{311, 0}"; + sepNavVisRect = "{{0, 0}, {775, 547}}"; + sepNavWindowFrame = "{{15, 61}, {702, 680}}"; + }; + }; + 8E297910083D892800F2C55A = { + fRef = 8E297908083D891500F2C55A; + isa = PBXTextBookmark; + name = "PositionSlider.m: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 65; + vrLoc = 0; + }; + 8E3851EC084CEC0200D715B8 = { + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = faad.h; + path = /Users/xugg/Desktop/faad2/include/faad.h; + refType = 0; + sourceTree = ""; + }; + 8E4521C408327F4C00F8BA7C = { + fRef = 8E4721D5083192C2001F89FA; + isa = PBXTextBookmark; + name = "SoundController.m: 6"; + rLen = 0; + rLoc = 920; + rType = 0; + vrLen = 67; + vrLoc = 0; + }; + 8E45227A0832898A00F8BA7C = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {860, 1792}}"; + sepNavSelRange = "{1555, 0}"; + sepNavVisRect = "{{0, 790}, {775, 372}}"; + sepNavWindowFrame = "{{15, 61}, {702, 680}}"; + }; + }; + 8E45227B0832898A00F8BA7C = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1208, 9352}}"; + sepNavSelRange = "{2206, 0}"; + sepNavVisRect = "{{0, 798}, {983, 342}}"; + sepNavWindowFrame = "{{15, 66}, {702, 680}}"; + }; + }; + 8E4522A608329C9B00F8BA7C = { + fRef = 8E45227A0832898A00F8BA7C; + isa = PBXTextBookmark; + name = "Sound.h: 13"; + rLen = 0; + rLoc = 2006; + rType = 0; + vrLen = 199; + vrLoc = 0; + }; + 8E4522AF08329C9B00F8BA7C = { + fRef = 8E45227B0832898A00F8BA7C; + isa = PBXTextBookmark; + name = "Sound.m: 15"; + rLen = 0; + rLoc = 17822; + rType = 0; + vrLen = 182; + vrLoc = 0; + }; + 8E45D7D3084E831E00867D39 = { + fRef = 8E14E47A084CF1A200246BCC; + isa = PBXTextBookmark; + name = "AACFile.m: 16"; + rLen = 0; + rLoc = 226; + rType = 0; + vrLen = 637; + vrLoc = 17; + }; + 8E47218508318D7A001F89FA = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {962, 547}}"; + sepNavSelRange = "{811, 0}"; + sepNavVisRect = "{{0, 0}, {775, 547}}"; + }; + }; + 8E47218608318D7A001F89FA = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {758, 2072}}"; + sepNavSelRange = "{1640, 5}"; + sepNavVisRect = "{{0, 813}, {740, 180}}"; + }; + }; + 8E47218708318D7A001F89FA = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {775, 1176}}"; + sepNavSelRange = "{1643, 38}"; + sepNavVisRect = "{{0, 748}, {775, 372}}"; + }; + }; + 8E47218808318D7A001F89FA = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {818, 6958}}"; + sepNavSelRange = "{747, 0}"; + sepNavVisRect = "{{0, 185}, {775, 372}}"; + }; + }; + 8E47218908318D7A001F89FA = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {775, 952}}"; + sepNavSelRange = "{374, 0}"; + sepNavVisRect = "{{0, 214}, {775, 372}}"; + }; + }; + 8E47218A08318D7A001F89FA = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {782, 3878}}"; + sepNavSelRange = "{1734, 0}"; + sepNavVisRect = "{{0, 1386}, {775, 372}}"; + sepNavWindowFrame = "{{15, 61}, {1016, 680}}"; + }; + }; + 8E47218B08318D7A001F89FA = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {775, 372}}"; + sepNavSelRange = "{222, 0}"; + sepNavVisRect = "{{0, 0}, {775, 372}}"; + }; + }; + 8E47218C08318D7A001F89FA = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {983, 952}}"; + sepNavSelRange = "{536, 0}"; + sepNavVisRect = "{{0, 300}, {983, 310}}"; + }; + }; + 8E4721AE08318F3E001F89FA = { + fRef = 8E47218508318D7A001F89FA; + isa = PBXTextBookmark; + name = "DNDArrayController.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 811; + vrLoc = 0; + }; + 8E4721AF08318F3E001F89FA = { + fRef = 8E47218608318D7A001F89FA; + isa = PBXTextBookmark; + name = "DNDArrayController.m: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 951; + vrLoc = 0; + }; + 8E4721B008318F3E001F89FA = { + fRef = 8E47218708318D7A001F89FA; + isa = PBXTextBookmark; + name = "PlaylistController.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 812; + vrLoc = 0; + }; + 8E4721B108318F3E001F89FA = { + fRef = 8E47218808318D7A001F89FA; + isa = PBXTextBookmark; + name = "PlaylistController.m: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 988; + vrLoc = 0; + }; + 8E4721B208318F3E001F89FA = { + fRef = 8E47218908318D7A001F89FA; + isa = PBXTextBookmark; + name = "PlaylistEntry.h: 15"; + rLen = 0; + rLoc = 265; + rType = 0; + vrLen = 496; + vrLoc = 0; + }; + 8E4721B308318F3E001F89FA = { + fRef = 8E47218A08318D7A001F89FA; + isa = PBXTextBookmark; + name = "PlaylistEntry.m: display"; + rLen = 0; + rLoc = 1655; + rType = 0; + vrLen = 231; + vrLoc = 1488; + }; + 8E4721B908318F3E001F89FA = { + fRef = 8E47218C08318D7A001F89FA; + isa = PBXTextBookmark; + name = "PlaylistView.m: 15"; + rLen = 0; + rLoc = 284; + rType = 0; + vrLen = 518; + vrLoc = 507; + }; + 8E4721BA08318F3E001F89FA = { + fRef = 8E47218B08318D7A001F89FA; + isa = PBXTextBookmark; + name = "PlaylistView.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 213; + vrLoc = 0; + }; + 8E4721D108319294001F89FA = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {775, 392}}"; + sepNavSelRange = "{231, 0}"; + sepNavVisRect = "{{0, 0}, {775, 372}}"; + }; + }; + 8E4721D208319294001F89FA = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1340, 2002}}"; + sepNavSelRange = "{1400, 0}"; + sepNavVisRect = "{{0, 1599}, {775, 372}}"; + }; + }; + 8E4721D4083192C2001F89FA = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {775, 602}}"; + sepNavSelRange = "{488, 0}"; + sepNavVisRect = "{{0, 210}, {775, 372}}"; + }; + }; + 8E4721D5083192C2001F89FA = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {950, 3668}}"; + sepNavSelRange = "{4513, 0}"; + sepNavVisRect = "{{0, 2276}, {775, 372}}"; + sepNavWindowFrame = "{{15, 61}, {1016, 680}}"; + }; + }; + 8E4721E008319EFC001F89FA = { + fRef = 8E4721D4083192C2001F89FA; + isa = PBXTextBookmark; + name = "SoundController.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 95; + vrLoc = 0; + }; + 8E4721E108319EFC001F89FA = { + fRef = 8E4721D108319294001F89FA; + isa = PBXTextBookmark; + name = "AppController.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 91; + vrLoc = 0; + }; + 8E4721E508319EFC001F89FA = { + fRef = 8E4721D208319294001F89FA; + isa = PBXTextBookmark; + name = "AppController.m: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 63; + vrLoc = 0; + }; + 8E5A8EA4084CB19900AE6D62 = { + fRef = 8E4721D5083192C2001F89FA; + isa = PBXTextBookmark; + name = "SoundController.m: 204"; + rLen = 0; + rLoc = 4513; + rType = 0; + vrLen = 767; + vrLoc = 3530; + }; + 8E5A9054084CB7FE00AE6D62 = { + fRef = 8E47218908318D7A001F89FA; + isa = PBXTextBookmark; + name = "PlaylistEntry.h: track"; + rLen = 0; + rLoc = 374; + rType = 0; + vrLen = 410; + vrLoc = 266; + }; + 8E5A90B7084CC25900AE6D62 = { + fRef = 8E5A90B0084CBC2F00AE6D62; + isa = PBXTextBookmark; + name = "Changelog: 3"; + rLen = 0; + rLoc = 131; + rType = 0; + vrLen = 131; + vrLoc = 0; + }; + 8E5A90B8084CC25900AE6D62 = { + fRef = 8E2871090836934A0013CE39; + isa = PBXTextBookmark; + name = "VirtualRingBuffer.m: 77"; + rLen = 0; + rLoc = 2692; + rType = 0; + vrLen = 648; + vrLoc = 1619; + }; + 8E5A90BB084CC25900AE6D62 = { + fRef = 8E5A90B0084CBC2F00AE6D62; + isa = PBXTextBookmark; + name = "Changelog: 3"; + rLen = 0; + rLoc = 131; + rType = 0; + vrLen = 131; + vrLoc = 0; + }; + 8E6082C7083920310017AECF = { + fRef = 8E267D040837F7A6004ACBC5; + isa = PBXTextBookmark; + name = "FeedbackController.h: fromView"; + rLen = 0; + rLoc = 302; + rType = 0; + vrLen = 583; + vrLoc = 0; + }; + 8E6529B5083D8D7F00A7AF1B = { + fRef = 8E297909083D891500F2C55A; + isa = PBXTextBookmark; + name = "PositionSlider.h: 9"; + rLen = 0; + rLoc = 86; + rType = 0; + vrLen = 170; + vrLoc = 0; + }; + 8E6529FF083D93EB00A7AF1B = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {775, 547}}"; + sepNavSelRange = "{106, 0}"; + sepNavVisRect = "{{0, 0}, {775, 547}}"; + }; + }; + 8E652A00083D93EB00A7AF1B = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {775, 547}}"; + sepNavSelRange = "{664, 0}"; + sepNavVisRect = "{{0, 0}, {775, 547}}"; + }; + }; + 8E652A33083E1A7900A7AF1B = { + fRef = 8E297908083D891500F2C55A; + isa = PBXTextBookmark; + name = "TrackingCell.m: 26"; + rLen = 0; + rLoc = 520; + rType = 0; + vrLen = 522; + vrLoc = 0; + }; + 8E652A34083E1A7900A7AF1B = { + fRef = 8E297909083D891500F2C55A; + isa = PBXTextBookmark; + name = "TrackingCell.h: 13"; + rLen = 0; + rLoc = 311; + rType = 0; + vrLen = 317; + vrLoc = 0; + }; + 8E652A35083E1A7900A7AF1B = { + fRef = 8E6529FF083D93EB00A7AF1B; + isa = PBXTextBookmark; + name = "TrackingSlider.h: 10"; + rLen = 0; + rLoc = 106; + rType = 0; + vrLen = 111; + vrLoc = 0; + }; + 8E652A36083E1A7900A7AF1B = { + fRef = 8E652A00083D93EB00A7AF1B; + isa = PBXTextBookmark; + name = "TrackingSlider.m: 35"; + rLen = 0; + rLoc = 664; + rType = 0; + vrLen = 684; + vrLoc = 0; + }; + 8E652A39083E1A7900A7AF1B = { + fRef = 8E6529FF083D93EB00A7AF1B; + isa = PBXTextBookmark; + name = "TrackingSlider.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 93; + vrLoc = 0; + }; + 8E652A3A083E1A7900A7AF1B = { + fRef = 8E652A00083D93EB00A7AF1B; + isa = PBXTextBookmark; + name = "TrackingSlider.m: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 65; + vrLoc = 0; + }; + 8E6F2A2708480D900011F126 = { + fRef = 8E267D090837F7A6004ACBC5; + isa = PBXTextBookmark; + name = "MacPADSocket.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 967; + vrLoc = 0; + }; + 8E6F2A2808480D900011F126 = { + fRef = 8E267D050837F7A6004ACBC5; + isa = PBXTextBookmark; + name = "FeedbackController.m: openFeedbackWindow:"; + rLen = 0; + rLoc = 471; + rType = 0; + vrLen = 782; + vrLoc = 325; + }; + 8E6F2ACC08481B100011F126 = { + fRef = 8E267D0B0837F7A6004ACBC5; + isa = PBXTextBookmark; + name = "UpdateController.h: takeBoolFromObject:"; + rLen = 0; + rLoc = 998; + rType = 0; + vrLen = 681; + vrLoc = 363; + }; + 8E74C915084D451C00DF47F3 = { + fRef = 8EF6FA66082DA526006F7BE6; + isa = PBXTextBookmark; + name = "FlacFile.m: 48"; + rLen = 0; + rLoc = 1625; + rType = 0; + vrLen = 947; + vrLoc = 1156; + }; + 8E74C916084D451C00DF47F3 = { + fRef = 8EF6FA67082DA526006F7BE6; + isa = PBXTextBookmark; + name = "MonkeysFile.h: 15"; + rLen = 0; + rLoc = 267; + rType = 0; + vrLen = 308; + vrLoc = 0; + }; + 8E74C919084D451C00DF47F3 = { + fRef = 8EF6FA6E082DA526006F7BE6; + isa = PBXTextBookmark; + name = "SoundFile.m: 83"; + rLen = 0; + rLoc = 1676; + rType = 0; + vrLen = 591; + vrLoc = 1140; + }; + 8E74C91A084D451C00DF47F3 = { + fRef = 8E47218708318D7A001F89FA; + isa = PBXTextBookmark; + name = "- (NSArray *)acceptablePlaylistTypes;"; + rLen = 38; + rLoc = 1643; + rType = 0; + vrLen = 595; + vrLoc = 1271; + }; + 8E74C91B084D451C00DF47F3 = { + fRef = 8E47218808318D7A001F89FA; + isa = PBXTextBookmark; + name = "PlaylistController.m: 33"; + rLen = 0; + rLoc = 747; + rType = 0; + vrLen = 668; + vrLoc = 238; + }; + 8E94D973084BE3D1007F0AEB = { + fRef = 8E4721D108319294001F89FA; + isa = PBXTextBookmark; + name = "AppController.h: 12"; + rLen = 0; + rLoc = 231; + rType = 0; + vrLen = 839; + vrLoc = 0; + }; + 8E94D9D2084BEA32007F0AEB = { + fRef = 8E0EBF0D084BA776003A6E64; + isa = PBXTextBookmark; + name = "DBLog.c: DBLog"; + rLen = 0; + rLoc = 170; + rType = 0; + vrLen = 297; + vrLoc = 0; + }; + 8E94D9D3084BEA32007F0AEB = { + fRef = 8E0EBF0C084BA776003A6E64; + isa = PBXTextBookmark; + name = "DBLog.h: 17"; + rLen = 0; + rLoc = 218; + rType = 0; + vrLen = 273; + vrLoc = 0; + }; + 8E94DA67084BF01F007F0AEB = { + fRef = 8EF6FA71082DA526006F7BE6; + isa = PBXTextBookmark; + name = "WaveFile.h: readInfo"; + rLen = 0; + rLoc = 302; + rType = 0; + vrLen = 309; + vrLoc = 0; + }; + 8E94DA68084BF01F007F0AEB = { + fRef = 8EF6FA72082DA526006F7BE6; + isa = PBXTextBookmark; + name = "WaveFile.m: readInfo"; + rLen = 0; + rLoc = 1534; + rType = 0; + vrLen = 460; + vrLoc = 1194; + }; + 8E9BF08B082FB9DD00B26943 = { + fRef = 8E9BF08C082FB9DD00B26943; + isa = PBXTextBookmark; + name = "(null): 196"; + rLen = 3575; + rLoc = 6874; + rType = 0; + vrLen = 1168; + vrLoc = 9375; + }; + 8E9BF08C082FB9DD00B26943 = { + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.objc; + name = VirtualRingBuffer.m; + path = /Users/xugg/Projects/zyGora/VirtualRingBuffer.m; + refType = 0; + sourceTree = ""; + }; + 8E9BF100082FEF6B00B26943 = { + fRef = 8E9BF08C082FB9DD00B26943; + isa = PBXTextBookmark; + name = "VirtualRingBuffer.m: 314"; + rLen = 0; + rLoc = 10841; + rType = 0; + vrLen = 661; + vrLoc = 2015; + }; + 8EA0A215084CC43F008DFEC9 = { + fRef = 8E2871080836934A0013CE39; + isa = PBXTextBookmark; + name = "VirtualRingBuffer.h: 47"; + rLen = 0; + rLoc = 3334; + rType = 0; + vrLen = 1043; + vrLoc = 3793; + }; + 8EA0A216084CC43F008DFEC9 = { + fRef = 8E4721D4083192C2001F89FA; + isa = PBXTextBookmark; + name = "SoundController.h: sendPort"; + rLen = 0; + rLoc = 488; + rType = 0; + vrLen = 671; + vrLoc = 367; + }; + 8EA0A217084CC43F008DFEC9 = { + fRef = 8E4721D208319294001F89FA; + isa = PBXTextBookmark; + name = "AppController.m: 56"; + rLen = 0; + rLoc = 1400; + rType = 0; + vrLen = 648; + vrLoc = 2995; + }; + 8EA0A218084CC43F008DFEC9 = { + fRef = 8E45227A0832898A00F8BA7C; + isa = PBXTextBookmark; + name = "Sound.h: 73"; + rLen = 0; + rLoc = 1555; + rType = 0; + vrLen = 914; + vrLoc = 1073; + }; + 8EA0A21A084CC43F008DFEC9 = { + fRef = 8E47218B08318D7A001F89FA; + isa = PBXTextBookmark; + name = "PlaylistView.h: 13"; + rLen = 0; + rLoc = 222; + rType = 0; + vrLen = 369; + vrLoc = 0; + }; + 8EB77455082DA3EB005891CA = { + activeArgIndex = 2147483647; + activeArgIndices = ( + ); + argumentStrings = ( + ); + configStateDict = { + }; + cppStopOnCatchEnabled = 0; + cppStopOnThrowEnabled = 0; + customDataFormattersEnabled = 1; + debuggerPlugin = GDBDebugging; + disassemblyDisplayState = 0; + dylibVariantSuffix = ""; + enableDebugStr = 1; + environmentEntries = ( + ); + executableSystemSymbolLevel = 0; + executableUserSymbolLevel = 0; + isa = PBXExecutable; + libgmallocEnabled = 0; + name = Cog; + savedGlobals = { + }; + shlibInfoDictList_v2 = ( + { + level = 0; + path = /Users/xugg/Projects/Cog/build/Cog.app/Contents/MacOS/Cog; + whenToLoad = 0; + }, + { + level = 0; + path = /usr/lib/system/libmathCommon.A.dylib; + whenToLoad = 0; + }, + { + level = 0; + path = /usr/lib/libSystem.B.dylib; + whenToLoad = 0; + }, + { + level = 0; + path = /usr/lib/libicucore.A.dylib; + whenToLoad = 0; + }, + { + level = 0; + path = /usr/lib/libauto.dylib; + whenToLoad = 0; + }, + { + level = 0; + path = /usr/lib/libobjc.A.dylib; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation; + whenToLoad = 0; + }, + { + level = 0; + path = /usr/lib/libz.1.2.2.dylib; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/SystemConfiguration.framework/Versions/A/SystemConfiguration; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/Security.framework/Versions/A/Security; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/DiskArbitration.framework/Versions/A/DiskArbitration; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Versions/A/CarbonCore; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/OSServices.framework/Versions/A/OSServices; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CFNetwork.framework/Versions/A/CFNetwork; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/WebServicesCore.framework/Versions/A/WebServicesCore; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/SearchKit.framework/Versions/A/SearchKit; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/Metadata.framework/Versions/A/Metadata; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices; + whenToLoad = 0; + }, + { + level = 0; + path = /usr/lib/libbsm.dylib; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/CoreGraphics.framework/Versions/A/CoreGraphics; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/AE.framework/Versions/A/AE; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ATS.framework/Versions/A/ATS; + whenToLoad = 0; + }, + { + level = 0; + path = /usr/lib/libcrypto.0.9.7.dylib; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/LaunchServices; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ColorSync.framework/Versions/A/ColorSync; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/CoreText.framework/Versions/A/CoreText; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/QD.framework/Versions/A/QD; + whenToLoad = 0; + }, + { + level = 0; + path = /usr/lib/libcups.2.dylib; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/PrintCore.framework/Versions/A/PrintCore; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/HIServices.framework/Versions/A/HIServices; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/LangAnalysis.framework/Versions/A/LangAnalysis; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/FindByContent.framework/Versions/A/FindByContent; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/SpeechSynthesis.framework/Versions/A/SpeechSynthesis; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/Resources/libJPEG.dylib; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/Resources/libJP2.dylib; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/Resources/libGIF.dylib; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/Resources/libRaw.dylib; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/Resources/libTIFF.dylib; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/Resources/libPng.dylib; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/Resources/libRadiance.dylib; + whenToLoad = 0; + }, + { + level = 0; + path = /usr/lib/libmx.A.dylib; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vImage.framework/Versions/A/vImage; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libvMisc.dylib; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libvDSP.dylib; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libLAPACK.dylib; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/vecLib; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/Accelerate.framework/Versions/A/Accelerate; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/ImageIO; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/CoreAudio.framework/Versions/A/CoreAudio; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/CarbonSound.framework/Versions/A/CarbonSound; + whenToLoad = 0; + }, + { + level = 0; + path = /usr/lib/libiconv.2.dylib; + whenToLoad = 0; + }, + { + level = 0; + path = /usr/lib/libxml2.2.dylib; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/PrivateFrameworks/DesktopServicesPriv.framework/Versions/A/DesktopServicesPriv; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/SpeechRecognition.framework/Versions/A/SpeechRecognition; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/AudioUnit.framework/Versions/A/AudioUnit; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/AudioToolbox.framework/Versions/A/AudioToolbox; + whenToLoad = 0; + }, + { + level = 0; + path = /usr/lib/libsqlite3.0.dylib; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/CoreData.framework/Versions/A/CoreData; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGLU.dylib; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGLImage.dylib; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/QuartzCore.framework/Versions/A/QuartzCore; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa; + whenToLoad = 0; + }, + { + level = 0; + path = /usr/lib/libgcc_s.1.0.dylib; + whenToLoad = 0; + }, + { + level = 0; + path = "/usr/lib/libstdc++.6.0.3.dylib"; + whenToLoad = 0; + }, + { + level = 0; + path = /Users/xugg/Projects/Cog/build/Cog.app/Contents/Frameworks/DecMPA.framework/Versions/A/DecMPA; + whenToLoad = 0; + }, + { + level = 0; + path = /Users/xugg/Projects/Cog/build/Cog.app/Contents/Frameworks/FLAC.framework/Versions/A/FLAC; + whenToLoad = 0; + }, + { + level = 0; + path = /Users/xugg/Projects/Cog/build/Cog.app/Contents/Frameworks/MAC.framework/Versions/A/MAC; + whenToLoad = 0; + }, + { + level = 0; + path = /Users/xugg/Projects/Cog/build/Cog.app/Contents/Frameworks/MPCDec.framework/Versions/A/MPCDec; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/ImageCapture.framework/Versions/A/ImageCapture; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/SecurityHI.framework/Versions/A/SecurityHI; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/Ink.framework/Versions/A/Ink; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/Help.framework/Versions/A/Help; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/OpenScripting.framework/Versions/A/OpenScripting; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/Print.framework/Versions/A/Print; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HTMLRendering.framework/Versions/A/HTMLRendering; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/NavigationServices.framework/Versions/A/NavigationServices; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/CommonPanels.framework/Versions/A/CommonPanels; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/Carbon.framework/Versions/A/Carbon; + whenToLoad = 0; + }, + { + level = 0; + path = /Users/xugg/Projects/Cog/build/Cog.app/Contents/Frameworks/Ogg.framework/Versions/A/Ogg; + whenToLoad = 0; + }, + { + level = 0; + path = /Users/xugg/Projects/Cog/build/Cog.app/Contents/Frameworks/SndFile.framework/Versions/A/SndFile; + whenToLoad = 0; + }, + { + level = 0; + path = /Users/xugg/Projects/Cog/build/Cog.app/Contents/Frameworks/Vorbis.framework/Versions/A/Vorbis; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/PrivateFrameworks/ZeroLink.framework/Versions/A/ZeroLink; + whenToLoad = 0; + }, + { + level = 0; + path = "/Users/xugg/Projects/Cog/build/Cog.build/Cog.build/Objects-normal/ppc/main.ob"; + whenToLoad = 0; + }, + { + level = 0; + path = "/Users/xugg/Projects/Cog/build/Cog.build/Cog.build/Objects-normal/ppc/PlaylistView.ob"; + whenToLoad = 0; + }, + { + level = 0; + path = "/Users/xugg/Projects/Cog/build/Cog.build/Cog.build/Objects-normal/ppc/DNDArrayController.ob"; + whenToLoad = 0; + }, + { + level = 0; + path = "/Users/xugg/Projects/Cog/build/Cog.build/Cog.build/Objects-normal/ppc/PlaylistController.ob"; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/CoreGraphics.framework/Versions/A/Resources/libCSync.A.dylib; + whenToLoad = 0; + }, + { + level = 0; + path = "/Users/xugg/Projects/Cog/build/Cog.build/Cog.build/Objects-normal/ppc/AppController.ob"; + whenToLoad = 0; + }, + { + level = 0; + path = "/Users/xugg/Projects/Cog/build/Cog.build/Cog.build/Objects-normal/ppc/SoundController.ob"; + whenToLoad = 0; + }, + { + level = 0; + path = "/Users/xugg/Projects/Cog/build/Cog.build/Cog.build/Objects-normal/ppc/Sound.ob"; + whenToLoad = 0; + }, + { + level = 0; + path = "/Users/xugg/Projects/Cog/build/Cog.build/Cog.build/Objects-normal/ppc/ChainRingBuffer.ob"; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/CoreGraphics.framework/Versions/A/Resources/libRIP.A.dylib; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/vecLib.framework/Versions/A/vecLib; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Components/CoreAudio.component/Contents/MacOS/CoreAudio; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/CoreGraphics.framework/Versions/A/Resources/libCGATS.A.dylib; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Extensions/IOAudioFamily.kext/Contents/PlugIns/AOAHALPlugin.bundle/Contents/MacOS/AOAHALPlugin; + whenToLoad = 0; + }, + { + level = 0; + path = /System/Library/Components/DictionaryService.component/Contents/MacOS/DictionaryService; + whenToLoad = 0; + }, + { + level = 0; + path = "/Users/xugg/Projects/Cog/build/Cog.build/Cog.build/Objects-normal/ppc/PlaylistEntry.ob"; + whenToLoad = 0; + }, + { + level = 0; + path = "/Users/xugg/Projects/Cog/build/Cog.build/Cog.build/Objects-normal/ppc/SoundFile.ob"; + whenToLoad = 0; + }, + { + level = 0; + path = "/Users/xugg/Projects/Cog/build/Cog.build/Cog.build/Objects-normal/ppc/VorbisFile.ob"; + whenToLoad = 0; + }, + { + level = 0; + path = /Developer/Applications/Xcode.app/Contents/PlugIns/GDBMIDebugging.xcplugin/Contents/Resources/PBGDBIntrospectionSupport.A.dylib; + whenToLoad = 0; + }, + { + level = 0; + path = "/Library/Application Support/Apple/Developer Tools/CustomDataViews/CarbonDataFormatters.bundle/Contents/MacOS/CarbonDataFormatters"; + whenToLoad = 0; + }, + { + level = 0; + path = "/Users/xugg/Projects/Cog/build/Cog.build/Cog.build/Objects-normal/ppc/VirtualRingBuffer.ob"; + whenToLoad = 0; + }, + { + level = 0; + path = "/Users/xugg/Projects/Cog/build/Cog.build/Cog.build/Objects-normal/ppc/WaveFile.ob"; + whenToLoad = 0; + }, + { + level = 0; + path = /Users/xugg/Projects/Cog/build/Cog.app/Contents/Frameworks/MetaTag.framework/Versions/A/MetaTag; + whenToLoad = 0; + }, + { + level = 0; + path = "/Users/xugg/Projects/Cog/build/Cog.build/Cog.build/Objects-normal/ppc/TrackingSlider.ob"; + whenToLoad = 0; + }, + { + level = 0; + path = "/Users/xugg/Projects/Cog/build/Cog.build/Cog.build/Objects-normal/ppc/TrackingCell.ob"; + whenToLoad = 0; + }, + { + level = 0; + path = "/Users/xugg/Projects/Cog/build/Cog.build/Cog.build/Objects-normal/ppc/MacPADSocket.ob"; + whenToLoad = 0; + }, + { + level = 0; + path = "/Users/xugg/Projects/Cog/build/Cog.build/Cog.build/Objects-normal/ppc/UpdateController.ob"; + whenToLoad = 0; + }, + { + level = 0; + path = "/Users/xugg/Projects/Cog/build/Cog.build/Cog.build/Objects-normal/ppc/FeedbackController.ob"; + whenToLoad = 0; + }, + { + level = 0; + path = "/Users/xugg/Projects/Cog/build/Cog.build/Cog.build/Objects-normal/ppc/MPEGFile.ob"; + whenToLoad = 0; + }, + { + level = 0; + path = /usr/lib/dyld; + whenToLoad = 0; + }, + { + level = 0; + path = "/Users/xugg/Projects/Cog/build/Cog.build/Cog.build/Objects-normal/ppc/MonkeysFile.ob"; + whenToLoad = 0; + }, + { + level = 0; + path = /Users/xugg/Projects/Cog/build/Cog.app/Contents/Frameworks/TagLib.framework/Versions/A/TagLib; + whenToLoad = 0; + }, + { + level = 0; + path = /Users/xugg/Projects/Cog/build/Cog.app/Contents/Frameworks/FAAD2.framework/Versions/A/FAAD2; + whenToLoad = 0; + }, + { + level = 0; + path = "/Users/xugg/Projects/Cog/build/Cog.build/Cog.build/Objects-normal/ppc/DBLog.ob"; + whenToLoad = 0; + }, + { + level = 0; + path = "/Users/xugg/Projects/Cog/build/Cog.build/Cog.build/Objects-normal/ppc/AACFile.ob"; + whenToLoad = 0; + }, + ); + sourceDirectories = ( + ); + }; + 8EB77466082DA402005891CA = { + fallbackIsa = XCSourceControlManager; + isSCMEnabled = 0; + isa = PBXSourceControlManager; + scmConfiguration = { + }; + scmType = ""; + }; + 8EB77467082DA402005891CA = { + indexTemplatePath = ""; + isa = PBXCodeSenseManager; + }; + 8EC18D9D084E3D8200AE0BA9 = { + fRef = 8E45227B0832898A00F8BA7C; + isa = PBXTextBookmark; + name = "Sound.m: 32"; + rLen = 0; + rLoc = 774; + rType = 0; + vrLen = 515; + vrLoc = 4427; + }; + 8EC18D9E084E3D8200AE0BA9 = { + fRef = 8E14E4AA084D089100246BCC; + isa = PBXTextBookmark; + name = "libmp4.c: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 578; + vrLoc = 0; + }; + 8EC18D9F084E3D8200AE0BA9 = { + fRef = 8E47218A08318D7A001F89FA; + isa = PBXTextBookmark; + name = "PlaylistEntry.m: 109"; + rLen = 0; + rLoc = 1734; + rType = 0; + vrLen = 244; + vrLoc = 1652; + }; + 8EC18DDB084E403100AE0BA9 = { + fRef = 8EF6FA6B082DA526006F7BE6; + isa = PBXTextBookmark; + name = "MusepackFile.h: buffer"; + rLen = 0; + rLoc = 383; + rType = 0; + vrLen = 564; + vrLoc = 35; + }; + 8EC18EA5084E55A800AE0BA9 = { + fRef = 8EC18EA6084E55A800AE0BA9; + isa = PBXTextBookmark; + name = "(null): 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1165; + vrLoc = 0; + }; + 8EC18EA6084E55A800AE0BA9 = { + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = in_mp4.c; + path = /Users/xugg/Desktop/faad2.1/plugins/in_mp4/in_mp4.c; + refType = 0; + sourceTree = ""; + }; + 8EC18EAA084E55A800AE0BA9 = { + fRef = 8EC18EAB084E55A800AE0BA9; + isa = PBXTextBookmark; + name = "(null): 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1165; + vrLoc = 0; + }; + 8EC18EAB084E55A800AE0BA9 = { + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = in_mp4.c; + path = /Users/xugg/Desktop/faad2.1/plugins/in_mp4/in_mp4.c; + refType = 0; + sourceTree = ""; + }; + 8EC18EB8084E57D500AE0BA9 = { + fRef = 8EC18EB9084E57D500AE0BA9; + isa = PBXTextBookmark; + name = "(null): 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 578; + vrLoc = 0; + }; + 8EC18EB9084E57D500AE0BA9 = { + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = libmp4.c; + path = /Users/xugg/Desktop/faad2/plugins/xmms/src/libmp4.c; + refType = 0; + sourceTree = ""; + }; + 8EC18EBD084E57D500AE0BA9 = { + fRef = 8EC18EBE084E57D500AE0BA9; + isa = PBXTextBookmark; + name = "(null): 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 578; + vrLoc = 0; + }; + 8EC18EBE084E57D500AE0BA9 = { + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = libmp4.c; + path = /Users/xugg/Desktop/faad2/plugins/xmms/src/libmp4.c; + refType = 0; + sourceTree = ""; + }; + 8EC7DA89084E672F00A079A7 = { + fRef = 8EF6FA6C082DA526006F7BE6; + isa = PBXTextBookmark; + name = "MusepackFile.m: 106"; + rLen = 0; + rLoc = 2177; + rType = 0; + vrLen = 682; + vrLoc = 2425; + }; + 8EC7DA8A084E672F00A079A7 = { + fRef = 8E14E479084CF1A200246BCC; + isa = PBXTextBookmark; + name = "AACFile.h: buffer"; + rLen = 0; + rLoc = 406; + rType = 0; + vrLen = 501; + vrLoc = 0; + }; + 8EC8FBD20842932A00DF2C98 = { + fRef = 8EF6FA6F082DA526006F7BE6; + isa = PBXTextBookmark; + name = "VorbisFile.h: 14"; + rLen = 0; + rLoc = 276; + rType = 0; + vrLen = 365; + vrLoc = 0; + }; + 8ED1CBB7084F633100771E1E = { + fRef = 8E14E47A084CF1A200246BCC; + isa = PBXTextBookmark; + name = "AACFile.m: 13"; + rLen = 0; + rLoc = 182; + rType = 0; + vrLen = 637; + vrLoc = 17; + }; + 8ED3C9B1084915CE00BB7797 = { + fRef = 8E267D0C0837F7A6004ACBC5; + isa = PBXTextBookmark; + name = "UpdateController.m: 34"; + rLen = 0; + rLoc = 818; + rType = 0; + vrLen = 725; + vrLoc = 171; + }; + 8ED833CD08457E6B0033CDBD = { + fRef = 8E47218608318D7A001F89FA; + isa = PBXTextBookmark; + name = "DNDArrayController.m: 131"; + rLen = 0; + rLoc = 3343; + rType = 0; + vrLen = 625; + vrLoc = 3014; + }; + 8EDC87BA0842F2A4007D1532 = { + fileReference = 8EF6FA6E082DA526006F7BE6; + functionName = "+readInfo:"; + isa = PBXFileBreakpoint; + lineNumber = 113; + state = 2; + }; + 8EDC88A90842F8DE007D1532 = { + fRef = 8EDCBDCA0840617B00F5C7E3; + isa = PBXTextBookmark; + name = "Cog.scriptTerminology: 63"; + rLen = 0; + rLoc = 1569; + rType = 0; + vrLen = 668; + vrLoc = 947; + }; + 8EDC88B50842F936007D1532 = { + fRef = 8EDCBDCC0840618900F5C7E3; + isa = PBXTextBookmark; + name = "Cog.scriptSuite: 68"; + rLen = 0; + rLoc = 1627; + rType = 0; + vrLen = 643; + vrLoc = 1228; + }; + 8EDCBDCA0840617B00F5C7E3 = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {775, 1414}}"; + sepNavSelRange = "{1569, 0}"; + sepNavVisRect = "{{0, 537}, {775, 373}}"; + }; + }; + 8EDCBDCC0840618900F5C7E3 = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {775, 1610}}"; + sepNavSelRange = "{1627, 0}"; + sepNavVisRect = "{{0, 717}, {775, 373}}"; + }; + }; + 8EDCBDDB084061E500F5C7E3 = { + fRef = 8EDCBDCA0840617B00F5C7E3; + isa = PBXTextBookmark; + name = "Cog.scriptTerminology: 1"; + rLen = 0; + rLoc = 2430; + rType = 0; + vrLen = 0; + vrLoc = 0; + }; + 8EDCBDDC084061E500F5C7E3 = { + fRef = 8EDCBDCC0840618900F5C7E3; + isa = PBXTextBookmark; + name = "Cog.scriptSuite: 1"; + rLen = 0; + rLoc = 2525; + rType = 0; + vrLen = 0; + vrLoc = 0; + }; + 8EDCBEF40840FA2200F5C7E3 = { + fRef = 8E47218C08318D7A001F89FA; + isa = PBXTextBookmark; + name = "PlaylistView.m: 61"; + rLen = 0; + rLoc = 1014; + rType = 0; + vrLen = 434; + vrLoc = 612; + }; + 8EDE0CCC08369EB200EABFE4 = { + fRef = 8E2871080836934A0013CE39; + isa = PBXTextBookmark; + name = initWi; + rLen = 6; + rLoc = 3762; + rType = 0; + vrLen = 1069; + vrLoc = 3336; + }; + 8EE4A6C3082E6F6100415456 = { + fRef = 8EF6FA6A082DA526006F7BE6; + isa = PBXTextBookmark; + name = "MPEGFile.m: 13"; + rLen = 0; + rLoc = 182; + rType = 0; + vrLen = 891; + vrLoc = 0; + }; + 8EE4A6C8082E6F6100415456 = { + fRef = 8EF6FA68082DA526006F7BE6; + isa = PBXTextBookmark; + name = "MonkeysFile.m: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 893; + vrLoc = 0; + }; + 8EE4A6FE082E704E00415456 = { + fRef = 8EF6FA6B082DA526006F7BE6; + isa = PBXTextBookmark; + name = "MusepackFile.h: 10"; + rLen = 0; + rLoc = 182; + rType = 0; + vrLen = 583; + vrLoc = 0; + }; + 8EE4A799082E7D8700415456 = { + fRef = 8EF6FA72082DA526006F7BE6; + isa = PBXTextBookmark; + name = "WaveFile.m: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 761; + vrLoc = 0; + }; + 8EEFDF8808410C00008BB533 = { + fileReference = 8E4721D5083192C2001F89FA; + functionName = "-handlePortMessage:"; + isa = PBXFileBreakpoint; + lineNumber = 239; + state = 2; + }; + 8EF1B97C083A49980095B236 = { + fileReference = 8E47218808318D7A001F89FA; + functionName = "-currentEntry"; + isa = PBXFileBreakpoint; + lineNumber = 372; + state = 2; + }; + 8EF6FA65082DA526006F7BE6 = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {775, 406}}"; + sepNavSelRange = "{183, 0}"; + sepNavVisRect = "{{0, 14}, {775, 372}}"; + }; + }; + 8EF6FA66082DA526006F7BE6 = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1130, 2562}}"; + sepNavSelRange = "{1625, 0}"; + sepNavVisRect = "{{0, 574}, {775, 372}}"; + }; + }; + 8EF6FA67082DA526006F7BE6 = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {775, 372}}"; + sepNavSelRange = "{267, 0}"; + sepNavVisRect = "{{0, 0}, {775, 372}}"; + }; + }; + 8EF6FA68082DA526006F7BE6 = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {775, 1218}}"; + sepNavSelRange = "{343, 0}"; + sepNavVisRect = "{{0, 684}, {775, 372}}"; + }; + }; + 8EF6FA69082DA526006F7BE6 = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {775, 372}}"; + sepNavSelRange = "{245, 0}"; + sepNavVisRect = "{{0, 0}, {775, 372}}"; + }; + }; + 8EF6FA6A082DA526006F7BE6 = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {775, 1484}}"; + sepNavSelRange = "{893, 0}"; + sepNavVisRect = "{{0, 370}, {775, 372}}"; + }; + }; + 8EF6FA6B082DA526006F7BE6 = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {776, 434}}"; + sepNavSelRange = "{383, 0}"; + sepNavVisRect = "{{0, 42}, {775, 372}}"; + }; + }; + 8EF6FA6C082DA526006F7BE6 = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {775, 2912}}"; + sepNavSelRange = "{2177, 0}"; + sepNavVisRect = "{{0, 1632}, {775, 372}}"; + }; + }; + 8EF6FA6D082DA526006F7BE6 = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {775, 826}}"; + sepNavSelRange = "{358, 0}"; + sepNavVisRect = "{{0, 0}, {775, 372}}"; + sepNavWindowFrame = "{{15, 61}, {1016, 680}}"; + }; + }; + 8EF6FA6E082DA526006F7BE6 = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {775, 2884}}"; + sepNavSelRange = "{2876, 0}"; + sepNavVisRect = "{{0, 1770}, {775, 372}}"; + sepNavWindowFrame = "{{15, 61}, {750, 680}}"; + }; + }; + 8EF6FA6F082DA526006F7BE6 = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {775, 373}}"; + sepNavSelRange = "{284, 0}"; + sepNavVisRect = "{{0, 0}, {775, 373}}"; + }; + }; + 8EF6FA70082DA526006F7BE6 = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {983, 1092}}"; + sepNavSelRange = "{402, 0}"; + sepNavVisRect = "{{0, 370}, {983, 310}}"; + }; + }; + 8EF6FA71082DA526006F7BE6 = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {775, 372}}"; + sepNavSelRange = "{302, 0}"; + sepNavVisRect = "{{0, 0}, {775, 372}}"; + }; + }; + 8EF6FA72082DA526006F7BE6 = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {782, 1708}}"; + sepNavSelRange = "{1865, 0}"; + sepNavVisRect = "{{0, 1137}, {775, 372}}"; + }; + }; + 8EF6FACD082DAA2B006F7BE6 = { + fRef = 8EF6FACE082DAA2B006F7BE6; + isa = PBXTextBookmark; + name = "(null): 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 622; + vrLoc = 0; + }; + 8EF6FACE082DAA2B006F7BE6 = { + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = FlacFile.h; + path = /Users/xugg/Projects/zyGora/FlacFile.h; + refType = 0; + sourceTree = ""; + }; + 8EF6FAD1082DAA2B006F7BE6 = { + fRef = 8EF6FAD2082DAA2B006F7BE6; + isa = PBXTextBookmark; + name = "(null): 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 921; + vrLoc = 2314; + }; + 8EF6FAD2082DAA2B006F7BE6 = { + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.objc; + name = FlacFile.m; + path = /Users/xugg/Projects/zyGora/FlacFile.m; + refType = 0; + sourceTree = ""; + }; + 8EF6FAD5082DAA2B006F7BE6 = { + fRef = 8EF6FA6D082DA526006F7BE6; + isa = PBXTextBookmark; + name = "SoundFile.h: 26"; + rLen = 0; + rLoc = 435; + rType = 0; + vrLen = 500; + vrLoc = 166; + }; + 8EF6FAD6082DAA2B006F7BE6 = { + fRef = 8EF6FA65082DA526006F7BE6; + isa = PBXTextBookmark; + name = "FlacFile.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 523; + vrLoc = 0; + }; + 8EF6FAD7082DAA2B006F7BE6 = { + fRef = 8EF6FA70082DA526006F7BE6; + isa = PBXTextBookmark; + name = "VorbisFile.m: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 389; + vrLoc = 0; + }; + 8EF6FAD8082DAA2B006F7BE6 = { + fRef = 8EF6FA71082DA526006F7BE6; + isa = PBXTextBookmark; + name = "WaveFile.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 270; + vrLoc = 0; + }; + 8EF6FADA082DAA2B006F7BE6 = { + fRef = 8EF6FA6F082DA526006F7BE6; + isa = PBXTextBookmark; + name = "VorbisFile.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 360; + vrLoc = 0; + }; + 8EF6FADC082DAA2B006F7BE6 = { + fRef = 8EF6FA6C082DA526006F7BE6; + isa = PBXTextBookmark; + name = "MusepackFile.m: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 442; + vrLoc = 0; + }; + 8EF6FADD082DAA2B006F7BE6 = { + fRef = 8EF6FA69082DA526006F7BE6; + isa = PBXTextBookmark; + name = "MPEGFile.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 267; + vrLoc = 0; + }; + 8EF6FADE082DAA2B006F7BE6 = { + fRef = 8EF6FA67082DA526006F7BE6; + isa = PBXTextBookmark; + name = "MonkeysFile.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 303; + vrLoc = 0; + }; + 8EF6FADF082DAA2B006F7BE6 = { + fRef = 8EF6FA66082DA526006F7BE6; + isa = PBXTextBookmark; + name = "FlacFile.m: open_private:"; + rLen = 0; + rLoc = 3062; + rType = 0; + vrLen = 603; + vrLoc = 2490; + }; + 8EF6FAE1082DAA2B006F7BE6 = { + fRef = 8EF6FA6E082DA526006F7BE6; + isa = PBXTextBookmark; + name = "SoundFile.m: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 519; + vrLoc = 0; + }; + 8EF6FAEF082DAA2B006F7BE6 = { + fRef = 8EF6FAF0082DAA2B006F7BE6; + isa = PBXTextBookmark; + name = "(null): 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 622; + vrLoc = 0; + }; + 8EF6FAF0082DAA2B006F7BE6 = { + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = FlacFile.h; + path = /Users/xugg/Projects/zyGora/FlacFile.h; + refType = 0; + sourceTree = ""; + }; + 8EF6FAF3082DAA2B006F7BE6 = { + fRef = 8EF6FAF4082DAA2B006F7BE6; + isa = PBXTextBookmark; + name = "(null): 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 921; + vrLoc = 2314; + }; + 8EF6FAF4082DAA2B006F7BE6 = { + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.objc; + name = FlacFile.m; + path = /Users/xugg/Projects/zyGora/FlacFile.m; + refType = 0; + sourceTree = ""; + }; +} diff --git a/Cog_Prefix.pch b/Cog_Prefix.pch new file mode 100644 index 000000000..75b2886c2 --- /dev/null +++ b/Cog_Prefix.pch @@ -0,0 +1,7 @@ +// +// Prefix header for all source files of the 'Cog' target in the 'Cog' project +// + +#ifdef __OBJC__ + #import +#endif diff --git a/Credits.html b/Credits.html new file mode 100644 index 000000000..7879e1ce9 --- /dev/null +++ b/Credits.html @@ -0,0 +1,4 @@ + + + + diff --git a/DBLog.c b/DBLog.c new file mode 100644 index 000000000..47d0a585b --- /dev/null +++ b/DBLog.c @@ -0,0 +1,24 @@ +/* + * NSDebug.c + * Cog + * + * Created by Zaphod Beeblebrox on 5/30/05. + * Copyright 2005 __MyCompanyName__. All rights reserved. + * + */ + +#include "DBLog.h" + +void DBLog(NSString *format, ...) +{ +#ifdef DEBUG + + va_list ap; + + va_start(ap, format); + + NSLogv(format, ap); + + va_end(ap); +#endif +} diff --git a/DBLog.h b/DBLog.h new file mode 100644 index 000000000..230d32f09 --- /dev/null +++ b/DBLog.h @@ -0,0 +1,21 @@ +/* + * NSDebug.h + * Cog + * + * Created by Zaphod Beeblebrox on 5/30/05. + * Copyright 2005 __MyCompanyName__. All rights reserved. + * + */ + +#include + +#ifdef __cplusplus +extern "C" +{ +#endif + + void DBLog(NSString *format, ...); + +#ifdef __cplusplus +}; +#endif \ No newline at end of file diff --git a/English.lproj/InfoPlist.strings b/English.lproj/InfoPlist.strings new file mode 100644 index 0000000000000000000000000000000000000000..210807cd80c547a515b5dc90ba90ab0cd4bac81e GIT binary patch literal 240 zcmXAjK?=e!5JmsmQxum)R0LPzMnM#$3k&X}O{-{=(yE|0@{;OHWXSx?%lm#hkU542TB$IGD!T9P+ZCHJA4$alKYy+A)BmEzeWmRf0{J9GhOmEm8b ziRPR>?_L!;gUys{4O_!F?Vt=(Mu#{V$OiY8T`Ha8e}9iRPJ6nJ?JYTMlEa4Su>F8~ KqA@WIKm7n~dMO_O literal 0 HcmV?d00001 diff --git a/English.lproj/MainMenu.nib/classes.nib b/English.lproj/MainMenu.nib/classes.nib new file mode 100644 index 000000000..7f8d579a7 --- /dev/null +++ b/English.lproj/MainMenu.nib/classes.nib @@ -0,0 +1,91 @@ +{ + IBClasses = ( + { + ACTIONS = { + addFiles = id; + delEntries = id; + loadPlaylist = id; + savePlaylist = id; + savePlaylistAs = id; + showInfo = id; + }; + CLASS = AppController; + LANGUAGE = ObjC; + OUTLETS = { + infoPanel = NSPanel; + mainWindow = NSWindow; + playlistController = PlaylistController; + }; + SUPERCLASS = NSObject; + }, + { + CLASS = DNDArrayController; + LANGUAGE = ObjC; + OUTLETS = {tableView = NSTableView; }; + SUPERCLASS = NSArrayController; + }, + { + ACTIONS = {cancel = id; openFeedbackWindow = id; sendFeedback = id; }; + CLASS = FeedbackController; + LANGUAGE = ObjC; + OUTLETS = { + feedbackWindow = NSWindow; + fromView = NSTextField; + messageView = NSTextView; + sendingIndicator = NSProgressIndicator; + subjectView = NSTextField; + }; + SUPERCLASS = NSObject; + }, + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + { + ACTIONS = {takeRepeatFromObject = id; takeShuffleFromObject = id; }; + CLASS = PlaylistController; + LANGUAGE = ObjC; + SUPERCLASS = DNDArrayController; + }, + {CLASS = PlaylistEntry; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + { + CLASS = PlaylistView; + LANGUAGE = ObjC; + OUTLETS = {playlistController = PlaylistController; soundController = SoundController; }; + SUPERCLASS = NSTableView; + }, + { + ACTIONS = { + next = id; + pause = id; + pauseResume = id; + prev = id; + resume = id; + seek = id; + stop = id; + }; + CLASS = SoundController; + LANGUAGE = ObjC; + OUTLETS = { + bitrateField = NSTextField; + lengthField = NSTextField; + playlistController = PlaylistController; + positionSlider = TrackingSlider; + timeField = NSTextField; + }; + SUPERCLASS = NSObject; + }, + {CLASS = TrackingSlider; LANGUAGE = ObjC; SUPERCLASS = NSSlider; }, + { + ACTIONS = {okay = id; openUpdateWindow = id; takeBoolFromObject = id; }; + CLASS = UpdateController; + LANGUAGE = ObjC; + OUTLETS = { + autoCheckButton = NSButton; + checkingIndicator = NSProgressIndicator; + okayButton = NSButton; + statusView = NSTextField; + updateWindow = NSWindow; + }; + SUPERCLASS = NSObject; + } + ); + IBVersion = 1; +} \ No newline at end of file diff --git a/English.lproj/MainMenu.nib/info.nib b/English.lproj/MainMenu.nib/info.nib new file mode 100644 index 000000000..c6c863b06 --- /dev/null +++ b/English.lproj/MainMenu.nib/info.nib @@ -0,0 +1,22 @@ + + + + + IBDocumentLocation + 298 406 356 240 0 0 1024 746 + IBEditorPositions + + 29 + 334 667 253 44 0 0 1024 746 + + IBFramework Version + 437.0 + IBOpenObjects + + 21 + 29 + + IBSystem Version + 8B15 + + diff --git a/English.lproj/MainMenu.nib/keyedobjects.nib b/English.lproj/MainMenu.nib/keyedobjects.nib new file mode 100644 index 0000000000000000000000000000000000000000..108d281660500b6fe651123cbe887f38c98ef36c GIT binary patch literal 39818 zcmb@v2YeL8`#(Ojv%9yqmsfT#z2_28ij*X@fQ1gyO9F&$NDc_3kwPy!0v4*hV5Ny5 zVDDl_K@=4b6%Z9HAH;?Q8{+Rhvv)~opRb?S{||)R?an@B=9#C>GqV#aOG~P2va3nJF03k=TrxdaRnQp!RhLwh=QpmYs4Qq)F=0xusHS?nZ4J!p7n~I= z?iy+sMd&s6zfTO}9owf{E4Nv3VNIb!ANH%|#781XHfcvXk}jk>=|%dHB2r9(WFjdc z(+DRwl2zm`ayPk$+)M5w_mg#GJ$ZsWOP(Xolb6VAWG6X9j*uV8FEob6(l{DVQ)ns; z(2Hq1dIjxFd($gvKRTG^(b04a9ZRpGL0V3$=}bC{&ZV4QO&8H?=?(NYdON*`K0vq9 zhv^gaN%{8Ny4u24EF-IX3nFJ*u-P#K{VC}WhdN})1ADORQ`rAn(h*Qa)2Y zSH4ufQvRd-p!}%(q5P?wR{mj(sZ3{)%wmZwiKVf0)`&G`7qgbE73;uq*=6i<)|GW* zJy<{1pABQf*=RO~UBwDn5i4dvHj$OE*V$X_0Q-!6&W^CJ*w^eh`TT*>>Kb*ex=wvieOP^5eL{UweMWsjeNBB` z-LCFX-&Xgk`_vEAkJLlzQS}S;OZ7kMx9ZR8FY2%A@9HUyX{x4ah8CekYw=owmZ+s@ z0j-JFRBNWS(6Y1+TCUbnyIkv`_0)Q4y|sSYP%Tf(*9x@p+ErSi7SzhLX(}`$_v*`$hXzJE{Gq{h|G(ozni+PU{+3s(W-3e`B>%dYm4w zYkI2QSieZWSZ@;g-AZqxx7R!9x%%b$6?%8Qhu%l;uMf}%>Uny;K2jg0kJTsW<$8r) zsZZ0Z^_lv$`U-ueewTi~zFL1!->5&TKc+veKcl~-zpU@j-__sKKh!_cKh;0ezt;bw z|DgY<|E~YzAs)kHd2CO-C&82M33!@#ntED$vOKw-&YmuwD?NiegFPcW1+IK}MtVkh z#(S>PM|y&uDW0jGO3yUUbk7XWT+cku)t-f(>pa(cR(Njptn%FDS?77ov(59O=MB$p z&mPY{&qtm^p2MEcJU>u{4)y%zIpz7=Pz+}H=uoo7h%js;+K4d{j6@^N$S^XE7Dh`F zG+G&1Mmytjqqot==x+=#1{))c0;ABFU`#Y78B>gDMwKzkm~C+5YGbLf%vfRE9?}^1 zLTB7(+;6Nl)*Bm*O)dw$N13r2>3oW4jNw@ z-y1&|Cyn2X)5bqu-Rtp2c@w-T-c)av*~MdhZe!zjvv3nfFHTP2StRcX;pd-s@fKUFY5C z-Q<1P`-t~R?^E9Ay{~#-^S3z@pzITuJL+?l4PrQeX1n*J&{0BeZ;pZpsZ{FX% ze|t|uh&-lYdQHo;O~09lZ%Jmd{FY%h!?)(5wER|RPBbT(rDmB~WzI5Zn{&*$CO5A$uQ!*NOU)b1+s!-7JIz)4Nb^2(ow?rJ zterBqm|I=BHJ>z}GhZ=Z)d!fb`MUc0`TF|?_y+m%eEGiNzOlY>zVW^yUnwc}^~cXN zANMWu-R!%?cdPGS-v+dO(6`0+u?deee19`#!~|&wNLG-}rt8 zl>WX`zJDSjBVr@sBH|+g5zT!4BbrCFh-edWS;XZLy&?wT`{0P75rq*`BBn-E`~JrF zxe@as7DW7Qjy1QLFPblzFN4n4%-7BB<_>e0kzu}VzGJ-2#^LWSbGP}vxyRhAeQ548 z_v8D=<^l7d`I_e?^N{(8d6<1~eu|&Z%+Jj)%rDKa@a)%06Z1djaXk0E`J;Kl{0Z=1 zG=DaK!K`g>{%W3NY>oexgyK`oj9s`pWv+`j2(Y`o=nLeQSMZeQ*6>{b-%A zezJbHezAVFPFlZ_0_L-RxBjsHwEnVAS$|unt$%D{Q(Ga+Y-X#rX6v@cHf*nL+CDo1 z|3})EZQFi3%8s^U>{vU_j<*x+L_5h&wo~j>JIzkF19pa;X*aSP+ZWjv+fD4Ib~C%V zeTm(|ZfUo&TiaQ7ww+_QvD@11?DlpCJD2`yceFd%m)e)vm)lp^o$W4mSG$|t-R@!c zw0qgT?JM;nyN})1?q~P62iODcLH1yKh&|NKv-9m?_HcWIU0{zS`|VNoXnTx3)*fe% zx397b?Fn{~U2F&KiS{IWvRz_Nv8URlc9~snSJ;*IG`q^KRvxiy>{@%eJwv(9o@vjr zXWMh^x%NDJzP-S9Y;Ip|FSHlgi|uRdYwhdo>+L1>QhS-b++Ja?v~RF)v~RL+wr{iV zwC^6)xV*Ns^iw;Em?V-|#3p_cMWRUzi6wC)o+OY&l0=e83P~ktB%K6E2FWCiNMmvl zxtKH|O-VD-oLoX$kd~wsX-%@Eb2Z3yw1yX!)&}8jB@WE%T2vIQt}dBSQd&|ot9wOx zIUKQyD%Tb3URqdP9jta+j~bXasHC_W?pgKdfq4T9%YyRr*nxSWX5!AdAjLB-fH5wB zFm8Kb-tZD2E)9+-DKD;=Q9ZnIk-#Sax@5pV6yGE&_bGe}ao{40Ka2hb1oo-|g)=Iu zrsA1i73DPp3d;*81*=8^UT|g&8V(VPhqNJW(F>AuL7$^JY!7LVTOCL)aI~tfsVXU-1l(OK z;SLuS)_@sD-9tK&OUY&A@&cFFVD%{XLpflqC6|*cNM|`t18Qpu(KC4xO2NRqx(_b< zE}X8U+Zxi1bRGvnYO8B1%EC7V9X&|yc-!vNt$RgLMPXfM2oieZ?vnI?if%~o>wwEi0*Ljn=&LYz09 zi1Bv(oH-rZwFqSAwwc!=FsE&9R*OKJb{*!;gTPHfC%gFFVVp#A^94{x-AAU7siYMB zP=<+AK`PO4d9@R!r8Q~ow?3pXN7aSbHB6EdCYm<8SpW1Uk&UF$s$m& zm|R1yMemO%OUP2Pj4UTB$V##l9gtUB8LSdCp<8;E3)v|KN7H5hK+?MhOH0wJM^)jZ z{8^O{JG3e;kurw9GMxmkpI+poJBg0%bxFR7^nHNbOl~2!lH17b8@!998fDhsP?f)gqVtBM0P06yN%9vCdh5A-ZADy*!oEiJ4G76%4bRM%ig zODbyu)3aOUocm0gd?vq7uU>)aZChoX+aM`~uuu2=b8p6?+e=D=Vj5KsmZS(a>!}>r z`|M}jDYTlbSxeTCwWKp-D?I6fHN()M!J6@Q?3_6{Ic-`5a zULmhS@H&G`30TlK2JP#CWT zN_;|`wIJdn@&TIVI|a^w19j9NC0~#)!GoBkUtyxxkYnT<{CrEkBj1xB&HAo6$YYLMOFU_%#QJP!nw#@7~}0|82YLbJXly-XJg0P z=@)=Eu%cXo6tkzIsytW~5)G+|h2a2!f?zoSm^JxAKf2sOg~NskOXW@%*(9?|7nqF9 z%&ylF68#VU9DbP)uWjKHZV+dPbCGkg)6{9=40JAW`uQmtGq|*HmPmVrFiQ;L^Qbv( z+vGxl^GP7F%edcs@x_*d|y*=#!g(;OK&7~b_CweKpj9yN*Vr23$on^N}bYR9RE2?Uo z9H*_*+G*wFMydQX8P*4;b>=?Wg?0rK-Dr2(gZ8Aopiac#;+If=nEn&x^v~>?g)z!< zvi%V$WBS(?l@u5Dt||lswea;?BwlP%2XY{4k{ zy1n~H^mRjk!|D7Gzz$Al7oZ&iSl4In*es+)>%#rxURg}9SwpWOoxxp$sehpfay?x_ zmtuk}rz>b%FyB41TU$ahyFcVWo_l8Ym<@(6Ak??GLLCy{9!~Cv9wpV4P!0dJ)9btW zz!`J)-UhSwe!7~jhKI3~uEVFc5YRr=bsk(}r*~$zTue8w)Bjx3Hpuz538ZbNTbw>} zW?d;}mT)Rm=(FMdgXNQICO7QuDEerqxBEGLMQ@LG#Z$_2c*LHPqM40>`fu#LSkE4? z8L*{@f#}Qhm9_L0`l^gxLXKD0s;a_Sm{Ia~Luy{9+e6e0b_NM*MotQA^Dr%M30it& zwQ5&4QQo1u*U;T=bR^=+ycva+@R6mK&4y}~AwXC+hqUbbbk91v$JMgJX)7(M6!YLC z;e^wDu6d^)(EZZD*U$sd;s@y=`U!MTeqq(5ps;>}g*7d&!6kRjNz)#1hB+fLJ6Ep# z&>4=I06pIZ!3Wek+{$c(Bstj~=gk{4zPKXnw{&v5>2rEyJv|cksz6fszKjb(B)tu# zQ%}^_G>L2hS;y!%A=D!U>iPRqoKe!F1@piz*%!WTcDs4=BuP1-s9mnS-WDHo+GK}~ z&-e6)b@T_fTOfHZ4WeT{JS#duWI}(2jQ&bb(%+-cTo#d*wKx?+O`O^ zZ9i|`VfrWii=Gnpflj1<)6?`H5(iiJA%&97ilQ(@RWwCM)vdOsrlMThiJb9vlpL;- zisF(Y=>`D~o@mfUBEg8tCOv|f$iQ zF1S>7L51uBas7<`=^}4VtG_Awr$P6ekEK2#mikMUY6MHQayDdVLqPv0o(3s{l_B6M z4-x*^Jk4=tIWxf1bj0|Ar^>3}^e|5&CD}9GVa4?`cp4{f&aS`tFL;_1;%SQHX`bL| zzROelod1!hGNoLp08i79vpAclMb6cZ1D+NjYaw_lhszP>X@(@5OR~lFGkBUSZ!WCA zc@|G@&f^r+Z8+~yB$_;P;PWJk8+c8vvP}aD|F9o%I$7YuiT;BsjNb- zW~*|yau2@Ui=VscX0lakj{K6MsRIhDrXsabBAhE|4(NqGh}< z8g&^N`o7#~An)}WXRWdh8s~w`u3eyUmO0tBJ@U$6>GYt0=4yeB%BFS7raG13_MCJV z&sFitRt&=<^rZ5b9E6n^g2s@s8(h;06`w7;xeX>zoBvb8KdC&WJPiqZ78$X#CG0lm z7Uw2N*p0}ELBjG1i;Keo_L7vLn}rM&;PM&r^}4)wYu&xG#Or)&;GGah?@5mC5L4z( z$xb^Fh5Zlg>{a$DAAp??k={F-o%@`7oV&ozDkS*8&hV;WS;h2Vn4?c5)prZ3N4s~< zVCsmxeQ(3t|AMdMA-=wse61FIt#K`}P;dVWV<(iKl%K)augF@S&Dev^1I{`ywibCy zp$SULCsu^n`b*NiUeG;KTyMw}Bl6~k`kVhZOUz4_G9Nw3MB37HHbM9@z|}*NtF}4+ zoAfc8`B{{ru^41x!4-?E_b;4Borj$*;A*q8QAX)Iq*0gSRv9b|t2&k}dDt2n7;)ze z76bD3BMoo=3nrU|m~0`Ld|Zs%6OzL=9fjZc?*)>zW?3v79JWEG`D_lKbDnXY0*6l` z*Nkx+Q9ZeK;>6OhM6!;O^rr>sV?wviVC@Qd|JgI{{|nxFi_|si!}?0zUhq1vINKy| zIl=>Ved1g=rZUwU&K-oqRT{+x(h@e9ETB_a9?N(7IWHkZeG$3xE^?F>(bHX`j4mq4 z&+3$w)i8<}&I;-x$d_dlQ4`KQNFB(=vT+Y!0e5`Z7YgMjWEd?no^>&GIELsbo#nb^ z1Q*H#^5$CCRhCSFB{!Xum4g}ALAbo5=Hz4x#~V2z*n>H3TD8r}$;}B~B7%_yU)-34 zO=6SRu*spsZD{!{fOg zyPe&^?qsXjUF>dl54)G$$L?pV*&4Q%tz+xi18f6(kZoj}*h6eH+rqZ8huI_SQT7;n zoISywWKXfD*)!}}_8fbjy}-7y7uiefW%det)!FHM;C$?S>U`mRiprH=9F>j z;nd_biqm*bQ#j4w^kPn1aGK3&J5D=sdIhK5IK7h70h|uybOfhkI4$IKKBtQ~y^hmm zoZi6cO`P7s=^dP|;`AO)KjQQNr-wK_%;{&G9^v#0PQT*xKV0#01&e%_a^-TabmmG| zuFT@f9Injc$^x!%t}NurVy;}vm8D!+$(0+qax+(M<;v|`xsxk*apfMa+{cv%xUz*S zPjKaVuDr^Xom|<)m3O$Zhbtd)w?HIc^*qdwz+X-{uzi>jZ zRQN11QR?h<_Bn5T#CEZ_**k1EdzZb(-bedAY%kl#K4AOVhwLNvF>+V~g5|aFJO-4* zn3R_kArC5ZLgBz@Kt-`g>;ZvXb3=SOs9eTE@GQb@5F!jHnHemW*PUHa3y|@Q!h$n# z-gb67?>O%{d-k#2BKO7)vP0|>c9?yNxgjw3LGG%Wvx_)u%9UR@ySM=EN=X^Aazn~O z7JwaE z9cVK`Xg>$qBLeMIASfi0NRR}uUK~VXq?S|yl^d3-O-Syzs@n3wSdi*pIIE(zAY)90<7T%;M7(Q>FjcODHh_Z zCyQl?(#i&mUIDCKobQ44__cEJ+83DnbL9kAewN688r8it zSXdPhQt2WeBnCOQNLidoW-qA8%L)KQ$@LBq)pr3R|gKPo6tE9$!Eg!5atdq#GhfYB8=Tny7i z2c%Y1ArO-ij%i$8j1^+pY;a+Du=Fgnvw?Ol(Ebgyf1a0hb%E-D^{ZXhqfh}uoWFqo zl;D5#m5BKQgK8$Du6PKRui_@-yZqXq0HeB7Lq?YX<1$C#Q~}C=&WjS0Z6#3N=%VCU zrP<9X75JcUB*uZk84VB&6IjncatDyC5=eAsAE)Ytu-sGMr<`ixPA$lT{0bEUern4F zYM9~?O_gNr(o>RX-7V@!p4?I8C z;YkyC(j^naP!u&}wu|8;n7~?oLni(J@V_{UHUK>HLcmY6{TitQ-bes%EP;2gsGK#V zNCMY%058J#ddf8~+oAb5y+iGrtt4 zs1lfmN*IVz{1x_S5{v|r+~_|oNm@jqt9zp=tvak7Lb9!;f|ztpvjj0MFGNfxh-q9$ zOe;Z5YeCF7>1hP=Dv|w!JsxtYi?TWFQjzdM!Z#W)-xBy*b1eM;U(SW_<%B0Jr(nKK zc*eq?KNDe~usSfZqBh``qombTOqwK?p39-^Yb$E2C3^V;hzrkVtrIA?jMI*Sg7)W7 z;CcaCXK>tAaO^;qI|znz1;fL-msV5=W7a$im_7mzPK7qZk7+JJiA zpeHU1^EMp$?_f=EM6vu;2XYud!UyjvKz2R{r0cP2qrxB^%<3*-i20)`D$2%$2o;~} zfKC9=VorMtpxr+{+YQzxYLkRU(;jk zq8J|}y`%^hLj)%xI~XFM7s?Q&?78bUb+puimKmJ(7qs-bFfFq|%UnrIfuy3ZprW6k zVx)i^5LGKfCWVFiY5+yFGDH9!cwwN|0_gPuC~YNy4iZ2I3!q~q(80(Tmq3n&^bP}F z3BWgUI$QwGyD;Ee0QfcmSi4gK&KH1(3Ba}o)@E3BFyJaWBsK$Zs{;bvkYE_gJ-~7w zr=tayf^!BvG&*a5W1YYuF^m)#MhOfEQ2N%ERSLhj4#$uwa2JH56s)Sd)~7sFAlkJm zSXeh44*~TSPOlQE$DV^)g$Sz)v`2vYF&8yNc$`2z-bEcNZBGE+NMJx=P0{3ltYR60 zRXM*jLS3r|mll?ki&($YN9s`RS+-q!PJ3Q^K}2iXHtj|2B~qZhti7VWN;45oA&44W zC<kiwKudk zwH?|{?JaE=IfX^~Ye|mwwpjWVf3^3uJ=$LC!>9d-S$YJEN(*7$Km~HknPSNjE@w4r z;n0x~4lHcJ!$ZhdUM+IR73DGk?cPQm2g*ya?W)1e1O%Ycl7%h?i$nFckO?HNr&pkw zw`W;p&8)gXlF_Eys6nNUg%TCF;FE&&BZ_LPsvv0v6GIh)BZ}Qc`e7KmAoB0%sOp+wg{2c} z%ZAm6O4VVLg5_1gVKriXA%7M+csQ0Dv0^@ALP^a~^zRt=t6QWyHq25_M3}P>v}?a} zim(6?toEn2YYj#fQE19^QG(qm5Q+oC-P}r&FihS=0CC>Cdr5B%Yot2S60=Mb0i>g_ zYLM5*eNH(yW4m>?E-vs2sIwGC_d}F-$CU)&~^;0RMnMWdOj908l+ltR|k(pbHv6v!KDvXfSt} zSb}TNpr_so4In4Ca(X)&tO%3PPmpliScDk$=tp9CMby?d2%hww`d|Q^`JgcpQKOLOY|xFR8pvy+0mSS!0G**uI3b$48~+X zr)y;j`Nx@vEZ^i5D76lU{^D2GSmkx}$UbYJH);NQacJ=X4XNk8t`p zr%!YGJf|;m`U zviIzc9kKeEGjHC3`rNvHgMOo14yNBE^6N^3J{#6%3!SRpsjre68KvVhs_RR)WUYlT zlHG!{gQe1ja{8dm#X}9R_lC3a(@uAdB3)F{FcBZ6-xEs2_v3V<$iyR>t`V@#EW zlj}lEZU{5^kYsYRo03O?cCK6-=@2TO{HUJC5PzFQxtqR4pM!$8%{qE{tAiRhPPd@f zQRhamLON_DRD7p~6xZlagebn8(}xAcV~X7QDGQ>`N9gk*LNRvkXgn$jeGGdTF0N@2p;W3R3BG87^1a zJDm^n!4PI-*;e*Oa8{Z|O}=`iY-BvB(W2z6Q*^&1lPoAszW z{F~ACG}f;^3-u1DJ0WMn`#LY`OG2nyg;BpHQSYi#cJ2O`9$$Fg9^ZL^9=|k%`-(8` zcO>rJ^~2rve?h+JyvX0a0P=nzDSukUj#F^bJ9|6K!m^7X}M_4yuQS-Onq zD&5~s?u3Q(2w)8ipIF0}2Cv>8_wHmBVdd7~aEUc{#BHlp?zTQDWyIC$cSj?jm9GtJ}Go7zGsAQIB0lbdZ4lMMS zlEmfXDnpe&ZnaEZQvhBJ0ub~7@Yf(#HV<`0)umvRYEI1a+YM4%n4;`9ejp|$bv zcdqEzX6cRMiigu551zTb#`8FGhXVBzo+t5l361hBA>VqQ^E@xM*kJ9ndu>&9MHN@_ zxiVDzqu)93Fwn=txiZYj!(I$`GgsEU4`_4GOP-fKuK?Ps7>?J;7SDFjD+m)ZC#iH- ztm-$8=684Z7j)k%yt(feh=+d?&`xst>s|o{TR>ZR-t)XKF8;#l&(g1KP~PbQ!gav8-}9k}BNGv4 zyL&~u)?mU-sKsVGHx89GYG+@RfwbpiY%20RiVk)LNax%0iRa}to|g$$&JY)RKJ`4f z#`7TQ{E_E#&k@g2&ljFA!QNL?@qF$155{`9=eXxv{EmW-2M zpZbMjL(h+%pLKPO=Y;1cPET=qdX487&##>R$?0E+63=kxJb%_jml;dc*0I&*06ZoRSsSpiXCF9*i(8&PYFC^78l_pqqe&$lsi+O`+= zK6pu12e){{i1obmfafJ6&WLwQQbvc$ScHtDctF4yErLVjkIqoFMv{@Nk1$fX62X;R zp`jEr6eJn}1c{0d<29@j+E*sC-3@pb48mwDQeZSP8XFfG7aL8CrbaVz6)7|>;Yxe1 zL~_Lfbgs1H3dYor$VhX_=xjsKp4Z7cqD&}E4dQu zj$U7*-x{NzEMFLmPjarTC6ar-z@+=YKx5E4V^Fx32wUQiN}GhOc*xDk zyk14sSw=(BnkS3~J!wGa36i*yi0Uz}B)JZP2s~tse~xg3@p0ZKvH<`5<@XWBC|Y8S zF>*!em@zI~97nb~6Sh7wzC1 z2$`0$aCY+!#>;MVsFg0^=KdnF(uh@ox_Mg4) z_6i1zCm=OapOgFVns&GGuJNAnzOl#H>scu^?S8II=SnZG^yW%WuGDe`>BDb?ro9qU zjqYtDazY*5JyEir5rNyhv3WtPl7z80P_ojCFb)xCqi4Bs*!a}*r180N#5ihvVZb#$ z#+ANY87O_QtGI&cJ%uY}T&X-KZ6%ysoT&16!w*Bh@nw*X@`PNRTuKzM^ ze>M)EHEjog5T{E44r>sn%bguYO5}frkpCScAkFEc(p3;7Uq z0gw-Xx`qqbsos@6W1qX%kdFQ)Z-m#R(cVa}<=I3Ia3wE951e9UJXglp@Q6pkMRvx> zzV}9ByRT=H*YcXeZ^kWUjPT`94(d%5&fOB>`wj?C9d}&AzVE!f-ZXDIS_a4#ZwBny zl@&F4l@;R94cCDdYt>vC!Igp$b1;irwsY-~x3TB(HSobZOB?CExNbw-e&LRLo8jjY zSe}F4mT;s2N$y&3J@L%W4uMUCQ$ET8+|jao+lqo%Nt)aNmxYrR4u~kD4svK;TOIT^ zG+OLz^S1NCZIBMW_}H zLGPZWy2WsKFLPD5w{uu33Z?4Cc_-NGgiRy>DRo>fQp5j;?)G*Qy4%~+`21YmUF_=a zBCcE|tmp9Vh2=%T(gsTVe6$S;(T3>8oh}n4ZIfKua>XQ(wEYXa;vFVwD=?0nOIwLc z+hojNL0i611q~=W$4!#6shf9#aFe`6Mz1h+rCgcXz!Q?g(6%iGzD--VELwCXbj|r# zo$5|bZ+RG4xtyF8bun(6Hf~z}U&Oe^7XXGB*9#>ZPE#voh;gHAWT(%E9T``VSMy^1 z%I)ZB5Ap|0?)~1bXz=a=mVZG#CYAvv5sKyvE9Y76y~S+^os88QVO>U7yXx?ahQ?9v zD%T7_RnK=D!ojb`pr7At?eN~ub{Izhk1GyV;+5c7(Ku`?>Qf!Y4(|hK`MGR)wP<D^XWn{t9H*N1CUpgZe**-)GTR}bMwMP;zuz2J^Z1Ef2= zZvZK*Il5(qK)UQgNOv_vy1X8#eTL1I2%`nUaL=BD@(b@icjRDUZ*WJhU?Mu?%<=ug zdjPGrOFMj%Y}EsDj7sU6lETtnB~{h+Cm7ZFCXk-b@X#01q9X+b=_#wbX?*Ve5-F@F zF`itxP2L<@fAfg<8$5|YhaI^?-n^>*<`>={a1*iviji>w*kIjFZJYNOq|P9M6S#6W zQfFelM2vHuyEWx}Lyc$t#542cGxy?|jbKeYGc+i6<1~2WJZsh_F)1l96_aVN>Wd_Z zHC(x$E33JJ1q=Xvd%S&dXbl>L9w@7Dx8r4Z3b-*pmd#taB?Azd^EH$cNz@G1w+tmL zOw)|OVz%ky%KFtNgnu1U0x}WO!>vdNAsltl9Jy?sJ+I68Sco=bz(TAU2Np2P(Q_NQ zvVkiPa%Gcb;gRw7MdzdJ3>HL|U*tb!5=4?Ju7oK~G1CO42-G&OHsM=81WM0GOCz%} zXt~I|7_>k&ftE+OvXv_ja|H<}bm#ibOj^X1FfC)uae|hyT-mYO zg!hW2^tp92T<>WXA?uzcRtuE3F#R2+KvWcpEOA{U(#I?jOZ<+(6)bq)jmD$OkSspS z5CT>O+hL-t2e953`gZrZ`c@XJnl)^{Ib9Tlp;}UT*V)aL_e4F|*u28&IK(VelQ5)u zY&E`zzt$^uAes+E=rADKFA(j$5Tb=Zv^b1tpFs41TX<#>fRe!Q&JX`JLS%)i!nEt z4?^ZPqAsSf1b37xFbzi_ZceZ9cB2ba1U0OwLcP@4WkC&ZpNsMl^HHFDtPbVZT=|kK zUrCg8Y+zKMMn7ZPVpP8s{e0{~{rm#@`NeQQe;`PeBIaOVSA3b z-S|S?pmTGl+KM(J3(R-S-N@ZktKG~!SQ~oM{J`9=woq4@AM17}pF`LZPuQs-uzia8Vv1*v7*dIo& z`Hwb3{mZB5i}iVAy0(S%(Js?klVj>|wnu&57pW~G^J%8;u$|_!2-uhV;>md9s5wpV zsokiS8Xfe7MyfBvmuXx|=4gEpmM3|iQww~}agbsQZG^c}yU*C6&mptagZen5nYv7$ z@7-Z^RJ*7fNe!wZi`BVY`CgcGiuJ5lxbmy>mDA0EeEh+cf8fyJjKgm^ixf*@2-+BS zC?z<^6{wsMQPaW_<#Hx+0I9O{r722AozHLx;#kfiIAg+-KqU;E4H}IZ%rc$(QJL-t zPnt7TBpm2^Y!Zj{gF5TMSu>Q1;}EO^oHcil{7B#o>q&h$3bR-SmN`Wg!xWT{Lch@V zoaQ)>2*cPa|ao&PNh)f1j8mzSg`#c32Mo0_Ib54rXF$!|vvoarN zO+@zib`({MXh9^+uXEr{{s~3FSq=)LF^5qpD;z_VnJmV>15S}e^E>~D8XskuNH8A9 zwhSjAW(e)>{K;AS18&{3uUq{FKq_{Ai9KN5d_BV+q^~bxcqBQ>u=@x*!oKCo4`F|j zD?g5wYRBD#G!DMMXca1OmhqggpL=o$QU|`lNF88v)NzqHh(iVESzDI|$n8y7A@U7l zyVfw&F`m6W2(v%oho z49|x^@=wvLV$+Y@Wyh6Mb^D%tWj<7S`ydWkoVAmM-q|i9armZM>V3|;11B?ojPsUH z_%hUG>Re2~FV*23bx;OgH$vp zIHOQBOc9EvRPN&wFE$8bKVK00CyMaDP~t5@z4w39b|wMm?R1wV^B>>px=w!pJ&wu4 zw7O1bdO@BzYZT`O*Z2NL-zN0_X3mVzt}}+zF|yCT4fW#n2*LRP5G_$09EKod>i-)D z|10BTfL-jN3N}D}))aHML72Xsb-jRD?-e^e7&bA5WRKYe;msqioV|~noaWQgH5kn% z&_6=2geB*^2qyVHu0wEGB7o+KsYei-FN*HnZv3>q8;@cIODoo9Xp6KPMG<~?so9{V zkTeu$Qr7R5XdtUnYn&;o&=m~?^1Sj8nuM)7H zrLq$un$?X{L`&kVV>`7GzD#T(hNs&ZR>IkTfdO*&$(%JnyBZGAILNJwsk(vWo+bTK za?gY!tjfO}=Zz74>Np)JtQUlyT~g0#i+oW*?lOuUuHk{s!$7OY)m`TA>IU^M^?7ZJ z)>l2~i-(`HM;dfkdl+Qc+Du_$=~!tdVUt@+M})a^_qNiMSaty^i%cVvylv)a~lxtnFy@emyeS zz=-+u)ivV$Iyw0x9O?O~re~$PQJ(^@?H~?+9q((d7GSY^yty5IQkJ-PC_gYki^r*c06BT zz9XOr`11LzFk~Z1P%fT=FMA4bB@FbHNRdK8t`*&u2yY6$k~GzR@#%XpYKq$iO6MyW zB2><-l>!DQXsG+B@D3TAJ9#RIYyp^SLy$3!0BAx5i~qh6&x^aFt@s7tLOla9MqNx$ zEM&rri_KtOK^?%Ltt3NyZR!MsRf9CjyFCB~k;z(Y;CDFzXs>V$zX3G>-2;sQP~ZXS z0=R?)M^jvYnBkX;S3Hl4_1NGF3R>4n2*Lwy4qPFSti3Bbr-kT@g#+Hv{6M?Wbkx7} z`R0C~LTZgv<5Ml&*ntAA1sE(-y9`Bpjo_efgJ7j#aGy7lbVs|-*8(BL2J>ShS8I*H z;FLZ`HPqp7@#mtde4f$CoJO*YFV$9LzSft_R*z%Nt^=8lD*o2KOoSwh^x4J{nyJko zee?xnhT6hhiRl}u?n2Gmlg3faG(Jat`Z(B|VuUBh^tpHk#ZI{WJ|xv=Vx9>vI9*I- zSRnYj6#e=%v^exS+;@@Fg>6E@rW^cdL;Y7Xg9r z$TtcZc|>S31UCU;;*~N49Ee;(18I(v18I&ouQChG31*R5YzF1)P$rut<`i?Pd@V}3 zS%Ev#@OqSLv&O77r<*g(nRTy9DKh7q3xrUcSDOpXMdo7j8uQw^*QYEqmzyhKL~k%} zG;cC*Hg7R+HE#>OQl-ee%e>pX$GjIWR=M9?ZLTrb0?&H$0TF(i8_iATL*{1jsulBL z6Vb8xnEAN*1YWrEl=-yz42<-1=JT9&;_On+F5~QS&aU7L7OM+qT{-Ku_XMJU}ew_8^Yyf8iIUB^;V9thch9EDGvwY5maW-5w8^IaIbtGq_I2+B` z7|syfjpJ-QXIF7n$k_zWia0CgEXdhJ&L(j-nX?kkrf@cuvr^8=I4kF@g0o7_rg2s! z!B%sImpIgNHl4E>oXzBH7H6|LnemKB_>blohX$W>q>*$>FB)9V z#+JQ0Ksh;WWh)aK;D_W0V+wy66DxN}2S-In=hhaq3Dpux+&S3|faSUmyo(329rcW6 zIRa1pA=lYhkPSg=Cm)KK;#zNk@IyS`&QTix?l`95@eJU)sI6)>mr=Gy}4e{lm@J-No49~R*_t3W_cZ~2en^Xq| z%|QKV_&U1LQR@NaHXyZa{pGepvm12B8C0Cn)$QBXu_hYTjaq|;Lrnbz;()m!KUpr> z|KLu?Gw+BFbIXNuz-awRs&d4_B9@brjUy6pMn*l^9U68^d$(I6y(D*Nc9tCbdPogL zq6z54?!)cLoQQe(Xq2l(D z88~06RGrIqvM2R9Y$3_QX;U|ond~{^Qq5;hW4CEDaC+2SHUqY3q46b7rCQFOP`h}a zV~>z(I6J%8BK>N%!WR!`D21&@%Ilz!#2z)jVk^lkHdE(hJiFWYLhs4ekhwUes)jwo zmZ_^~Bb+yNKdHg#Qmc{DN{3TZi@nD4kk+~bDXK+UUz~pR0?mXQbCkWxHqgd!t5ISwA)^?6abdd#Qp4!d83Y76V&dPel z*v_u?EHU?}!}a+L&J@nC`osKE+lG^{rkc;H2NBhLi?gzpuvys2HI6M%|6-f8*6bzE za-4(ply;-h!Q2gZ=?G51a`e_n2rk2ETeq^8&40)-oS3zi-R^l(GxfPROKUSu$l|1r z@u@x=3B+8j7$5DxpwJq#Un1qjUD%Whb1(y9dyIOso%`x9$*Q=#uI!^AIhI6;> zMLlCjoVInBxnExdpCHpX4D0qQPTBes(FabZ61&Q-gsbug4#R@s5{FYYm1bR}F?h-i^ zyeJ1U6$JwdTc&trVh~BzS;A@$#X(;g891b1fz?}QVXN@ofUFVoxzn4g@2^gV5l@2;XYG zOufQM>W(AKoR4LG^BWmvp|g;GB%H1iXQ?SSBOxjhtnkDlIZjqXfJEmzCxw@Eo%4e{ z((F>{Po;}9%y2XsoH*e#!ED3Z>074-evw)r^4G|dk-tU$9{ES)pOJq>o-(w^(~vo1Khm-++wxmcR=jT1i&2m13n@X;!)w zurjPntC7{%y2!fNYGO6Dnpw@QORN@FORJUD+RC!BtsJY3)z)ffwYNH0xmHK3lXaWVs*8;S>3H3R!^&!)!Vw#>SOh_`dR(00oFikkTuvEVhy$OtbA*jHQX9u z6<8y!QPyZ{j5XF8XN|Y6vI?yUR*_X~1+9tJBx|x&VokB8TBTN*Rc=*SmDV(?%Br?% ztXgZjHN%=|&9Y`&bF8`6JZrwSz``W4uC^9hi>$@gHP*G(b=LLP5^Jfo%vx@(uvS_( zST|ZXSvOm^ShrfYS+`qvSa({hth=nct$VC{t^2I|t<}~VYpu1;T5mmIZLl7+Hd>pk zhpf%k7Hg~Zu=R-bsP&ljxb=kfr1g~bwDpYjto5Ary!C>$&3e&#$$Hs(#d_6x&3fJ1 zZoOf>Y3<+)GJXeVcXGChGfdCBIlG55L|({s-pASfoUP_;4QFdPTgTaY&K}@w17{C% zwvn?}VaJG%J z7dd;0vzIx0g|k;VdyTW#Iory)&M;Fx=j;e)M>+d~voAUOinFgdgZLif z>>JLGbM`G~n8n|7_5)`>a(05VpE&!OvtKy-m9vwa{l?kvoc+NWbjDwto#O0o&Q5do z4_66SDOVM)GOnsz)wrs26>kSKxa#Gq$yFa$Bjkrju3B8Rx$5U?6j!6U8pG9CuEudS zo~sF5P2_44SChG#!qrr+rg1f$s{yWNa5a;wjkwyFs~2(gVy-sfYE!N@<7#uRUc%KD zTy4qKR$Oh()hw=Nb2W#nZMfQ&tL?bjp5q`iHJ7U$x!Q@VmvZ$ou3pa7E4bR3t6jL- zm8;#j+MTOCxZ0Dey|~(&t5?}t`6qv5Uvj8Y93efxjKxi z!?`+ws|8#g$<0KZ95P{p_b%_7Feicpc)c_5nZ5 zv@i108|}?@A3vq`XZGXvU-l37EA~Bpnr*-2r`PzY-%mUG>2Q0spQhQb+xR@ee$76L zmkwTIAM#V(Pp`v^1>g14wtm{wPYpk{>}Ty$e%j1W+xh8a`wctRPh;#q?YVxMVz0tG z4u8V2+4kG^m3SrLxAqf$+8*ygyw`rye#m~(&b2?m`xE!tpW93QG}liX`Dv=3Cj03K zKaIzG6HnTA*<<`PTBa}TTVz(>{d~Kx3$%%w*RWTGzaU#?-(%mq#=cj+jiFCBw^&PT z5ySf+5=kSxq%a#hkNV@SbHnle=84{3cpvKRc(dttyutK{_j~UtGXXUvxn^f`0NyiN zg3x#+Lfs7rW*ZRu8;G(P99rYl+@gCKF;HU~g|8)rI@4y>T9|lK{ z%dq@e^LcP3-ZYAwx#Z=Lc^GdEJz{KfRg+hJ=Sg@xFS_kJG5n>_!(`#EjAcQXTT z)f|VnTF!)EEXO!MXm5gOZpGw$%znat+I|ib^+o$-NXH=v;FtE-n0&|mG5$1vQ-6-X zt-rlL*Wby1ng0rZ7k@W@Pk(R!V1J%}n16(SlmB)9Xa1l3r=yIhCQ;p@3ZiC5T^n_C z)O}G~qh5`AGiqnl?x+u=K8iXJbtvldsH0I|MtvQ1Eb4gFcTqn?orwA+nns(^3DM1> zFNtm$-99=udQfyhbYXNw^vvi5(L8!#^y27iqc=xCAH5@bZ}h?FZ=!#VAu&pf8l%Vf zVj^N9W9*ogF&$&N$MlTp9n&YKU(A4*p)mz9B{7vTGh&>W#WB~$TpzP6=FXTkF&kpG z#ylVMTFiSfhhh%Ld>!*`%rCLt*x1-cu@}WQiES2pNo>p5wz0ip^J0g`7Q`0Dmc}}< zH^tr;`$Ftnv2Vxjj(sn7Pwc+fk7EzTei!>w>@Tq=WB-VYjI-mS;$q_B;#$XD7I$S_ z-?;H{g>gl3!MI6rv*Q-VEsMJ~ZdKfaaqq;v8~1+P{`!R zjE{(qiO-I26W=brLwv{hOXG{13S*u?n6#Kg43Kw`(l zUWtPeMO>UXo zIypPJZF1M-?#VrqdnXS`9+!Mo@`U8#*OcxlJyUw8^hxQLG9YD8N`6XVN>NHMWm3wtl=&%6%GD{0 zQdXqgo^of(Qz_4+JeTr9%C?l3QeH_pkQ$vDn;M^*n3|lLnwp-Pk=iJ=X==OF4yhee zFHP;4Iy5yub$Dt)>V(v(sb#54QkSK!NWCHT#?+frZ%y5r`gQ8D)Z?k&rT&n5BK7Cg zUsHceJ(cE7^QD<-R$5}(#c55`ny0l$YoFFRt!vuEw8?2x(n{0H(<;)c(rVJCr_D^e zHtmMAO=(BdeoxoaQ_?%8_ek%bJ|cZW`qcEY^osOp=~d}-(&wemPro+(`t()l_oc5+ zUz@%@{o(Xy(qBp6oqjz1yYwH@Po)2p{%iVg>3;<5K%YRrz<|J@z>q**U|3*8U}Ruy zU`n7gP#&lZ%nDo+xGu0Huq<$E;NHOffo*}80D;mpr6zs~$6^JM1lnSVCY8$~yY zZ4}=qvC&11S~bdQG@#L-MnnEz4d?ycRN=;dK(-ti6{NC+wl{k?Uni(YW#M;)YYNvDZY$hd z_iy@A`AckI=}?j02kl`#efJ917&~|PylK`2N(b| zU;`Y06Yu~&AOL_s1c(E*01TvnApi#800j&KMgn7i@xUZtDli?G1vpcwBEEnwEnb#v_cv{6VhZfJ(w zWq!?E$^4GFhPjT}%sj$8#yr71$vn+G%e=$9$Gp#c#C*zp$Lhcuz#7OZW~o_PmY!u` znOJqKdRB^+VP#nuE619^n#`KUn!%dQTEtqyTFu(R+Qw>P9b_G5HM5Se?y_1~_gN2F zk6BMy&sp!;9ocj?lPzN_*ebS$tz*a8Np?Lu#m=y^Y>b^_k7kc$FJ^CKZ)R_0Z)fjh zpJQKOUt(WjUuWNB-(tVvwC42Se9HNZlh5hPQE*foEl1BWa7-Kv$HhT76lWM`1ZOno zTh4c!wVd^wjhxM#Eu2QqeohnT5a$ohQO;S;U!2RFdz|~6hny$eJZ>*;KDQ6IKlcmn zATFKDXvcQtn%_j~Rp?s4u( z?iubm?nUk;?iKD`ZVUGr_dTyQ?-O2kULLO(uaqa{DR?TLmZ#?#cvfBo&&vz)KwdpB z%^SkQcyoF4c?)@qdCPb!cq@5pdFy%Gc)NLfc!zm^@Q(6M@E-G?@m}&?^WO5_@mujb z^Skl$_`UcHK8r8n8~7%^hwtP2`Gff*_@nvb_!Ib(`BV8{@fY)#^4IWp@^|qM@DKBw z`A7K=_>cL|_%Hac`2X_X3i1U~fl*))*aQy25CJO42?#-hV3=TpV4PrrV6I?=V3lCC zV4a{@a8z(Ya8htua8__$a8+KD zs$#r&SnF~#GGCl*gGo?5)1cv11v;uXakiZ>M>Ek| z2=@yw3NH!o3jZg3Abc$9A?hjWE&5#4Pc%R@P*fr+6;+GkqFPa%2oZfHnkkwinkQNy zS}0m9+Ai8DY8JJKo|k-D(!YdW!YbjG2uegHr6tl5c}ZOfS+b<$r;;-z55#T6pNc;d z_ZH`iKNt5A_ZJTo7m5KfP0SRl#4d4AOo$uA!^NY-W5pB1lf~1-GsLsS^TZ3pi^NOC z%f)NOTg1D?zlaZtkBCo-&x@~!Z;J1UpNQX=b}sEv+OxEOX+f#B)KnTSO_kB`a#rCUlHOAnPEE4^LTq3lECFY8v8SJta6zpPK0yv$n`D@&Hul_6!B zGPG<)+3d1;Weds{l`Sn>Ue;80wCs+gt)zqGL(Gr9-9PN!Li%OE*e?kZzOil)la*7H)08umtCh!F)w+N#>AI;c9U3RE_gLsg}6sXQv5szw!1k*Y6MBUGbRV^rf* z6IIJp`&7TF4yX>PnpHTCG)=t4(T)x=Ni^ zXVpX1gql=0sE4cPsToI;}xlsf}pk+FC8FMYM!=l6I->740?cP3>*%UF|DfCtVj^S6z2qo-SX<)Nyotolqy%xpZD#jV`DgtPAO)I!uS_ zNZpsZ;kvJNdvuMueY#(DO}az6!@6eODcxIrC;g}T{(8P%s2A%cdbwVu*XZ?nqu!z? z^rQ4+^%L}y_0#mz^|SPI_4D=L=vV1?>znjv_1E;b^#ABv^bg8ED(_z2r<_|ZC>NHC z%O&N8a#Ojr++JQ?UQ-?|uP>iizPS9m^0npPmv1cJS-z*dsr>iydxqAAPKE-5*kCq* zhKM06AVeVu8!pt)3%r>*fTyLIao@$*v~b7%9CrNSIOVwHxL(<&vU6p( z%Dl?nm3=DvSAJ1hP${d7SJqa-m8r@hm1reV*-$yJa#Q6WmB%XotUO(Lrt)0n#mXmD zv?^v5yNX*Ss1j9)tIDcWRi-LSRc#eqm8u$2m94_6@T%!mzf~QqI$YIUb+qb4)yb;U zRTrvmRQ>I2=j`bG*!hXGyYo|LzO%2h#OZW;oIYp38FYfqh_k`D%=xWzm2dLuB zyJoxQxfZw*0HZo)S-~N8*ur?4GzM=OH~`dPaCgd!~36d6s%scvgAVcz*Gm@SO6T^<3~= z^4#}4@;vpt@VxeR{y;Zxp0}5m=4E<0UcOi8)q9Ozi`VA0duzR<_e<{x?h*_-L1NynqMuf7FSEE<<+WcXZ7If5!Ius$5l_Po>Ki)^~~xy z)qARsR$r{XTz#$jX7%mryS~mJ=;q7w_44KW`uYa=3_g!9>Pz?_U%fBw%lc;f=J^)* z7WtO?R`^!=*7%P5uKOPN9{Zm8Ui$v^{a4e!W?)TW4XuV*!>Qrd2x|g0shWnG;WeXb z#@0-znOw8JW@F6{HQQ=-*6gm?Tk}iJotoGF_Wn-(F8;3m9{!$wz|Zir{XD-`)2Kl%6ioBeJ5@NTdr_%!%D_-^pa!T%2a4{QZ~1b%3EfStiEU{|mQ*c1E=%m@2| z1HeIG5l9D_AP3}wLQo7!Ksl%awO~1D0xh5ow1ZWk8>|NX;9xKeM!^JF3&J1*W4ZZ>2g<6N&hB|~g zg}Q{ghI)j0hI)tkg!+dDh6+MJh!J9kxFJDE6e`b7Fg`bWNq42l#+iXw)HDPoOOL@FcBh&z&sWFiY9 z3nPmoOC!r7D1f$k^K0`q+lprr74#me{t~j@ZuF)!2>L-?2NfyRnwo{n*3Ulh~Vht9YCE$MM2A zEzXQ{;{3QUE{;p$^0+FljqBrvxG7#2uaBqWL*iIG7boIh#)rpO$JfT!$2Y_`#y7{e z#J9z_$1lgP#c#xK#qY%L##`d|%{!TH;F}wC5fepLy6|Z(Zq?w$;9cz*~Iz8Ux{mpyNQ;> zvt;LFw`5+jS291@H#s0VC|Q)GCs|2uQjioTgUL`bl8hze$z&2r!pZvN(B$ysq~z4( z^yIAM+~oY^H_2a<2a<=9&B-IlW62ZAlgTs5>&bh`hsjs9k87XSzNmd&`?mHS)EfE- zY6o?MI)9)m)C1}XeFl9F^@9dL1EB(_2%{G|hm4Q~s(>mX z7vzO%pa29yVd%rt83=;vp%j#XP-rMbKn>6^XaqDG8VgN;CPUMp8PF_fE;Jwd23ia) zg_c7rq3@tI(0XViv>Dn8ZHIP3yP-YM&(J>TH|QXA82SS`3LS?|LZ_i~&_(DHbOpKw z-GpvI|3EF!edrSJ$Dgb6uCZu65n(KCSCjmtWVXu7BMZ zb%W}P>S%S$I$_R#8qt$Po*f!o0y;g8|Ya5p#)?gi(=ec}G_K)3(~U2G+wy*aBC;m9Pu;!ZmOZ4#5#P1}9+%u7}fb79I-YFa>`J4~Iv= zW8m@dBzP+P6+9E31Ah&F122Y`!QaBG;5G0%cmuo%{sGvz}ht^cL|*ZKqXhwJ~SKUV)|{ptF1 z^%v_e*I%o@S%16!ZvFr2AJ#vqe_sEp{!RTmq&3nO>41FjK#^`p9?}cRNBSZIkU>Zh zLPuB#7ZD&Lq!f`N3Pg?Q5CdXHY={GKA|Awt1P~C3AaSG?fsqt41i=s-p^#z7NMsB$ z9+`wpMW!ROkh#cwWFfKyS&pnkRwL_>4ajC>E3yOGh3r8Zk^M*$atLWgjv^#>Pl19^CriZ5|rRS!XrN2#Y zO#hTVoIaVpn!cBQntq;snQ5EpoavhBp6Q>VXT+KEj5XuU#51YPkPMm`m6?{ApIM&y zHuHUEYi4`q$IR}`-pql_k<78opP5scvze>eDcNb+>Digt+1a_-`PqfpCD~=!71>qU z)!B8~4cX1vt=S#fUD-X^#_axVQ}$4{IeR2~JbN;GI(sgAF?%U{HG3m_EBjBjCHo-z zDElP)Jo_^HZ}va575Wj{9_@&JjDCW4L-WvHXg=B(?T-#b3s3-Mplp9v(J|nFI(XHqX^hb0zx(97U_o2U`2hrcrBj|DTBzguthh9W4 zqgT-z=-=oa^d5R2eTY6mpQEqPH|RU8HP#mEfPFBFv2Iu%)(gwW`eFmHL0Az+$5=4$B9mP&yr?9iw z1?&=bD>pMYC--&ko802uvfQ`1?{aH%-{&^vw&b?we$4%p`#HBS_gn5@?)Ti0-0|GW z+?m|@++VpXx$C*Vb9Zw0a`$tOa!+$Fa<6l5bMNsscssl!{xSXu-W~rG{|x^e?}vYZ z7vKQSz}YwtFUCvoGF*l$aSg7=jkpD`z$nd7 z;-~R*_(l9Oeht5g-^TCa|HB{RPw?mXEBp=qj%ZD^B{~ov9B-lKq!6gKQh$tnbgo02LI>JDh2^--coP>w)5di`uB1D|1C14^&3?VQACn#bVF_IWV zj3*`$Q;F%sEMhJ(pIAsNA(j&>iPgk9Vgs?6*h=gmb`g7sMq)qFL>wZTiKD~`;uLX~ zxIkPYt`awhTf{#^3-N$>OgtlA68{qakstI;vOU>}>_T=WyOVijPx3P|pX^KaCkK)R zBtSAq7Re#`WHDJnmXZ=uMk+`(sU`KKku;Mw(m^^&H|ZsPq@N6uAQ>j3WP+?E>qvym zkXaHVb0k4hu^lJM}5mi^`|^Q2nR@)F7&mqEQTrMR6!TRZNvo zrIdt{Q%XurX(>HrpiGpNs-P+<7v-gDr~n00VJb=`s9LIys;5#^hC-d$(YHA(zJ++bAOl_gIQ9G$!)KAo2s*&19 z{Yo`a2dTqUGj)VIPMxIAQ0J+?s4LVp>IU^Ub(^|NJ)xdbCR`-V0RA2)Pq=-SY` Xp2J8jzhzuRru|GWQxH?aQ?P%dE{ literal 0 HcmV?d00001 diff --git a/English.lproj/MainMenu~.nib/classes.nib b/English.lproj/MainMenu~.nib/classes.nib new file mode 100644 index 000000000..7f8d579a7 --- /dev/null +++ b/English.lproj/MainMenu~.nib/classes.nib @@ -0,0 +1,91 @@ +{ + IBClasses = ( + { + ACTIONS = { + addFiles = id; + delEntries = id; + loadPlaylist = id; + savePlaylist = id; + savePlaylistAs = id; + showInfo = id; + }; + CLASS = AppController; + LANGUAGE = ObjC; + OUTLETS = { + infoPanel = NSPanel; + mainWindow = NSWindow; + playlistController = PlaylistController; + }; + SUPERCLASS = NSObject; + }, + { + CLASS = DNDArrayController; + LANGUAGE = ObjC; + OUTLETS = {tableView = NSTableView; }; + SUPERCLASS = NSArrayController; + }, + { + ACTIONS = {cancel = id; openFeedbackWindow = id; sendFeedback = id; }; + CLASS = FeedbackController; + LANGUAGE = ObjC; + OUTLETS = { + feedbackWindow = NSWindow; + fromView = NSTextField; + messageView = NSTextView; + sendingIndicator = NSProgressIndicator; + subjectView = NSTextField; + }; + SUPERCLASS = NSObject; + }, + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + { + ACTIONS = {takeRepeatFromObject = id; takeShuffleFromObject = id; }; + CLASS = PlaylistController; + LANGUAGE = ObjC; + SUPERCLASS = DNDArrayController; + }, + {CLASS = PlaylistEntry; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + { + CLASS = PlaylistView; + LANGUAGE = ObjC; + OUTLETS = {playlistController = PlaylistController; soundController = SoundController; }; + SUPERCLASS = NSTableView; + }, + { + ACTIONS = { + next = id; + pause = id; + pauseResume = id; + prev = id; + resume = id; + seek = id; + stop = id; + }; + CLASS = SoundController; + LANGUAGE = ObjC; + OUTLETS = { + bitrateField = NSTextField; + lengthField = NSTextField; + playlistController = PlaylistController; + positionSlider = TrackingSlider; + timeField = NSTextField; + }; + SUPERCLASS = NSObject; + }, + {CLASS = TrackingSlider; LANGUAGE = ObjC; SUPERCLASS = NSSlider; }, + { + ACTIONS = {okay = id; openUpdateWindow = id; takeBoolFromObject = id; }; + CLASS = UpdateController; + LANGUAGE = ObjC; + OUTLETS = { + autoCheckButton = NSButton; + checkingIndicator = NSProgressIndicator; + okayButton = NSButton; + statusView = NSTextField; + updateWindow = NSWindow; + }; + SUPERCLASS = NSObject; + } + ); + IBVersion = 1; +} \ No newline at end of file diff --git a/English.lproj/MainMenu~.nib/info.nib b/English.lproj/MainMenu~.nib/info.nib new file mode 100644 index 000000000..1dd2768ca --- /dev/null +++ b/English.lproj/MainMenu~.nib/info.nib @@ -0,0 +1,22 @@ + + + + + IBDocumentLocation + 298 406 356 240 0 0 1024 746 + IBEditorPositions + + 29 + 334 667 253 44 0 0 1024 746 + + IBFramework Version + 437.0 + IBOpenObjects + + 29 + 21 + + IBSystem Version + 8B15 + + diff --git a/English.lproj/MainMenu~.nib/keyedobjects.nib b/English.lproj/MainMenu~.nib/keyedobjects.nib new file mode 100644 index 0000000000000000000000000000000000000000..280dfec35b14cfd3e59f595e20a0c98a4c5997b1 GIT binary patch literal 39818 zcmbq+2YeJo`~S?&?%v*BKH0tWo=X6+P*NxXR65dI0)%czjt~e*NTHV<1q(&QUa-(q zRP5ML#Dan-Dj*^#B4R;o*em?LGkceW_P)OVKM-fztP_nQ;Affm3SpVNl{Xj zG$o)kRhlcUl-5d~(m}aIxm4+cl_knjWtnoFa*wh~xlg%Yc~E&mc~W^nc~N;;c}00$c|+N*ysNyY>{kvbpD2fv zBg*H>m&$j__sZ|eAId+<38pZ{G-k3$mcSBODobOTtO;wzTCkR^9c#}zv5Q$3)|GW< z{aAlCj16a_*%)>?D`Lg0gaz3|R>odqZ?gUD5c`xJW?!%`*)jGF`=0&Cer12ER8>?> z^{TcSqsFRnYNDE|HdULc=cyN{E!8$^p4vg}s9vIWReP%g)Pd>{b%Z)jEmlj^pgKvN zs@AG?>P&T>x=6iBy;{9SU8dfIPdBT#sCTNX)ivr`^#S!!^-1+9b))*M`hxnZ`kJ~` z-KM^!?pF7x@2mUNkJQi9BkJesSL!$FPwLO=FY52=-x||YP16i5LW|bowFE6uOVI*a zbM1WX0!%IX^0fl3P#dpZt`%uPZK^g+tJZ3?T5YDb zKy&bkYm2m{+A@5)PP;+7L%S27R%-WZ_iGPm>$L~9N3@OF)7mrIv)XIg2iiXEL+z;c zwRTMVM*CL#PWxW_K|8MfsQsks{N+@q5Y-(t^K2&&^59|_vj}6#%h1-aeBP2 z>8W~Cy_tTV-aPcXm7c4&)7$HL`X&0MdUw5t-be4R56}nd`FepqQXi#{)hFl`dZk{a zPt$AknflfGb^3DsPW@hemHvRfUVmJFLVreoR)0y~qHojR(cjfS(D&(|=!f(#^{@2r z^&j-#^^+drF+7&X_QZPC(qN_)5X)0dC+L~%nc}JPO!G|l%<#)c<%J9^*rHu(X-j}x@V_n zmuHV>pXVdbLC+!2_f(-nJimGV_WWZg1~Ytg2-#pn7`72@#25)iqLF4~7@0;3qa_I% zt&A+At#OHQnbF7SZwxR78zYQDqsW+GOf*W3$;LFJ+L&d`Hn?$xvBX$vTxZ-G(inF` zXWV1lYpgQX8S9M)T?&kcjE9ZKjVFv}jAxA(jm^fZ#%soQ<1OQD;{#(K;C*NuFupXt zGrl)|HGVTr7$?2D*W-=yCU{f4soqR)6K^wbD|*n|+S?xg=XpDLyLh{L`*{0$`+M`f z1>P~bX?(=@^J!m9&Kf}*g`1uw;KYD-j{_g$9 zdjdk_F%8peTBdFK%|u)!naT1h!@K}j7n&Ezt8B9at~#2XCY%VdcH*Ym>GjBKV&_|m0m}|{-=EK_G z<_7Z-S8mOX=JV#u<}3OD^HpD0Uq9bq-w@wWUxBaKH`zDESMICB^>p7%-(253-vZxa z-wNLizB_$)`_}m$@jdE$%=auQ@eRSx%f9z~`+cAK4*NdyedGHDPyOoq%lA(NiJ%c? zM07+Lb0g+O zEQt8W9BaPFzGL5+o6VQZSIk$<*UYWTdFJcp8|Itl+vZO5J#&}2+uXy(nS1FX^8<6A z`JuVrJYc@nV6w==&skD1@l81sAc2lKf3 zGhqCJpM&PF=3etR^LO)4P4xDc`M3Fxc`{OoWaev;s__;Zhrc@_HS_gIPoxp)jWls( zntw+|dR{Uz%%hQ3q#YR-nG*Sv^`^DMddqs-+G)LGy=%Q^?Xq@Td#v}Zz19cTKI=nk zzjeU+$okkiXnkTGB1^4Lt;5!5))DJ->kI2k>nrQ1^|f`(`o{X!`p){^`ayZrI&S@F z{bc=Y{bK!U{bv2H7h8W=e_DT8e_Q`pC#;h;v8k=t%vNp9)@=_dv<=&9o3_u6!2gl9 zW!tvjj>X}7Xl+gWzDonzU+9T~z_Go*IJ=Pv)kGC(k zi|h$@v0Y*Z?TL1&J;^R3d+o{g6uaD>YFF5mc9lKNuC{CJTDwj$?dkRmd!{|ho^8*u z=i2k^`St?avAKPPeWkt7USwZoUu|DwU&~B;vAx7zYA>^|vzOb~+birF>>KS{?Az^? z!MA$l1P$BGD#t+B#oq#0LdVkqzP$CnvwHJ zb8|2%F0^K+H-X>XE$+nGiQ06-N@B)&Ter$T%GD{ zYAdIPZwfqmki7A>-KSgk%HqnRdS(a|F2mj4q%X!Z&SAl1PsWps|r>NoWPcz6+(7OK+$x`A4q!lV0k%O^{6f?EtpjW zu|unpGAU!=mFXmS{ggQAPNHLbU6gMieeWYTlAFlQXJY$Iv;Om4-6I-1bS8!7gg2Nl^4|pO9F!{Yicp1WmUC- z>DjGv&U_|KK2y-ASFgbIHm$PGY>*TJ*r$8JnKxs>_OkMzm_{{&B`Si<1}q0&cKS2! z6k0`AuOX|+8qyiE6`pj#+F@X5uy(v1J7-Q#PHu}pPL>du_U$1rS@Y)YBlnT}$pd6P zc@Sgr5P6tvAdiqoF(QwU$H^1qNeDrHaS;?7ev5elZbPNj1}ka>?RulGKV}(o*~a--b3yx>#B=`QU|3t zsZKI_?K2gcZp4Jr>dLx`5|_>w$ct;pi)6DkeAnzm&q#- zyv{&Vb}aB4gZA|oZqwJu)^%hnd7ZpLwly>sQwS0%sIRUphaieC&{O?<`AE*LE6AIW z@g0!yx5(RMCrEsUyes8=H`znpCws{UWFLs%PYytbhzSS%AL^<%#HzBq97%+Vqlj)2ZWZPW>gvg)U@Ebqwl=zr9 zYkcCEtb+0V16b7hA zWpRiv#qI=knm_>roTg4Er>U(vL;YUjLEPy?S#>Z1|VB#+QYYEhelV6qe%5#tEK zgannB=T{XKLtT$3E2*6%?KtqQn_AJe4*o!}rffFuNokfE{<7+_l6svl2DEZU?_gQ! zB%!SfT&l*~DXzvT6;Dbr6$YYLWp)2b%#QJP!kNI`KE~V8F!a@Bc(ACv-o}o%)6dc0 zz{(2QrIWY<$RuWs-A?rqZ;vG|in^ zW5+ipQVIzTKrm?r&7@777EU*(7t97d4+*X2^n7{&y^vl+TaY-~k{qS2X%@|bNaWym zuB$)fz>0wZ_j(75V8g@=hn|Abma+hiB7dWKpBhYD@Kf*)EqWjm7j9fMQ#P_0WVK~x zw*VOCba1+UfOx$vZ3k^BH6?9N^JoX!k#?dNlSeQt1(?f{=a3uNu&T=HS|`V89*_;+r$cBy?N1BP(=a-mj-Z8fAZU{}1$IISfmP*|rBY9~ zciP#y)7Hryo<9qgb1Ej(B+2-CW`yw?EAZ-;RS)@cTC|Q9(FwFzXk;n6QrH^CO-@eH zPp`6Id5P53!bcYFr??0W2MxNzLB6J?bQ0uZGMz%pL%LEZY6vfs(WOpDjAoapn2Zx$ z{03HE}BeqeBW;O=uKauxh19^aEz>p#UqA$@c zYv>mGvJ729URT%Z>Y`bgQSx_VY+j|Wg|Hdy3=-IkEDfvjFfQ8#E|B|FCWjY1wz_du!=?u9g)ZTX|WPm;w z?@Q}mOFx7b-%k(FkDz-BimFS4!t@OmrnI6KU%7Km+Vy}l%o&l{xoXV^&Tz~G==oek z9#HS_DYFreIe;}1{^dxx*zV5>cRTPCOs-humDpWj*p?DROKBV{*#B%ORQO{|0Wz*ql zSHM|^U)!}DzDxz2Yw4U~#t*Elo?28cuVB8q)z#KkR!BRMGv1Dp!&O#UQdTT|AoPPL z8nux?FruJf2d9T=DwJr?bcYq+pF-1Ed2@Ed&3{4D#1KtolBRirrui;S?Q;G{n#z@_ zN(E@DLc-#7nie`&I1Xr9fRu%xsRAxXn5O9xZ7$Ik-=9L$9C`D~hMT9+ zJaR-Js4P?#ktNF2)TdmlES9ug?OX%>V!|80*12k2LA9H0$}ca23kykhKggs{PPWMO zWVI9OEvKzu1GL*gWw~;_t9g_a$_>hm%1tCrxmmfzjp&tImD`ltk*Ik@xl>t*tGn=X zCw+)KA~i=rS@DzsMb%S~*C-Rt6*LF*LZ6CanW&U{Vqo3W3Bl??6T?jrY9xtP<;Zo0 zzjM=?gDT2rLA@i(C9h!x)vIZJwU1rxV&^Sw-Y}+2$J6JwFD0*|Xzyr$qwaWT>mEm$ux{GJ3cx3~I;ZgdF z^0*v?dMPh&m~6-rsQZzmvoavV@uR7ZxE&dJw{w0jeI7RJF%HvjV4|^Ae)e&B&E^kps1mp6C)~bWuq`R>!QY#(~5z zR#+cIZjpgRZ8-TL)gT+o#@&a-)bU|=D3qR%k+jHo)`!*MFrtI>m+O}i++HS-H`ch` zvLp&5xfz|T989|Q!s{J1CnsC@-bf3?(FOyM|rM7PBR6DO<*_W6Rm~Yz4c4-NWD=MU!ur;Jk%rzWRSoW^sS z!f6Jl=W*JC(`-)La@vv8OF8YvX>U#ka5|LJ5uA?Uw20IBoG#?_8cvsTdOfE%aC#G` zw{dz0r+0C>kJJ5}e#GfPP7iTSLShL z0arLzuH?!hu3U{8E3Pc($_lRB$d#M9aw}JE=gOU2xr;0JaOFO(Y~adMT-n5xSGcmB zD?7OIHdl6W%?PVXZee6S|u?7Sy>fn3~sDM4GC@V%DRHlWH zAD6MwfXWh)+XDc(=7tb;P=ySK;9P{;AW9feHZxcvzjt;-EkMRI3JcD}dCS@9yzRW} z?ApV2iu4;hz&>IhvxDpt%nbp#57JjPoGF}XT=|DHRtS%!Y$_6SL#Bp|0Q*d8ig$#j zkP(%5uKT25@sz3XpTdp4l8xST8zGVtjU-a}wNlWLHelbf?^d(#NN3>}gVG%0{bbz z9u{Dy06-BbB|#FvdT|iBkvdWZP;O+ZHYa)Gs_QBSV?nBa(X7h4#vm^Q$QI5~fc*SS zkgX)8tpPGyg8ahy5+J{7OlezC+McsqDR^xPv4$IfUt2Y#vrA zVvu8t#kW|(MtTBkK6O*Y0w7S?qYiZ^Kgm)HfX;Bt-yXr5TC8@+G6BW;8R-3RCVGVu zy^&zbXvvi0&W}LvC&82k^v0`~1HB2H`8Z3Kyoo3rQdd?R0E321bJ3ef@Ms}Tm(G@UU2-5`vQY)(wi%AK` zG_EMY3bAZ9xTqpnej3=>06Q08{{h%P&q}(wKy^U+6)x#fsDL5PUx5F&pnr64gnfZQ zwUba+JOs;Eag%T@FB=tL)O2i2=wd)z>L{El0D1DPATimN1LO)9B*#L{PEM(S2Yn+U z4h+s{1YnqedJ2%+0OSqPURiXqIkA_d7U^6WvFj ztNWek{@wcSV?_6{qWglO!IH`$quk#2lDuKnxNg+>hv@tOr^%x8gmZO%5S<^Y?>td- zo+LUSl^-leQHmIqAqbyQYNLLE*;FIH#g~oX90i`hm$7Yq)Q@( zp(tv|Y!||>AOdUojfwaJo&Uw*J)`r?b9H`#?bS$q=S@WCO=aiZE30M=DVCjUIyx`L zbpz&_mu=I0oL(e4Z+=GSnlwXNBs#a<&d=xc0@3+}qVtd?(qh;_EsnE`q&T%GgL$Ze zfhfmcVUJ2-B#`F@|Fk4&5rwY43{`10VeJr-Z7mhZq;r}jkZE}?WHNzF(|TlD31nIe zWX4HPBamN(1SstBkWMbh3t^Xvg%1+G(TMn#fY+MSHUeJGx!~o5CoHERJ~upL;m@B6 zFi=zz7+F~taLZBBYAZ`i#nN*Hlzm-gU5x}Up8#^<*{pR01{ZVML157C3=CW^KX;Cs;&Xkc6VPc1 zr~&#N`*$#CV>Z&1rNvul~t_v#$}MBA(w?aUXG4e za5`LcoPX|)Z$ihnh>o?}Wyb}g<6)v>+XHJetR@(66&-S$0l3ux0d7bz4CO9Bxrfuy z0!rZ-gB}{4)qt^9z>p9|3J9YF1OzC3>!wx-zqlU8kjZctgrgL!uK%u2MW{fuYjv=w zemEWi=nb4+E7@gi{Ej1{aBf znG_j8bOW0(mFwdQWNpPhCo~M*5fNCGaPw+7oxtf#PN#DU@tVcyJg3D0ZL9XW_J+1i z+pfK-?I3?+o&IW)qaj7<{?*>oc4@n*k1WylB4+6kEG{pCc>@+mFK3EXOSqghsD%R~ zAskrSf`^BYucAhzk1H!=4%)qqQVx`tV%t@tn+XU&r6mh}87v9a+d?LgyPjT&YTlkx zt7>P}50Z>F-A0Wnbu3h=xD~f0gR3iNg1Dd;e>erzwVakXL+}}qY803)OJ_py7|OV0 zhjJCT;X9e=(DtK>Qahl1qI8+UMFA+LxS8yG}n0V;4jU9*nA~9adC6p>FE1 zT2ZMwtTb3r9UN9GmKX|Vfx*ME;)q4_5fjR4hl0Oj+)KAecWjuXo`^7KA!yfr=M-T9 zB3SKDZO3YiDx%Po>7oR?V;~dGzYPZ#X7%njYrZBnTF^(f4ZOex-+(*>M5oL(WsyW4m>?HqK6h5*|5becnV z!c-^dNxB-QHW?f6Kg3T+QhsPOl0fkueblxLaj;$(j7GmyJ-1 zvmg{|awgCV^a}y>BB2;0@k=uzjsGwYL>u8)_ zhui>CKozJ}lL-n;h+$%_vmvNJ2k;LFR0cX&fevbhi3P<|8gxMeXcjcM5e?=J6RU8I z8uZkAp#kLNW=?NKgX_X5^b;uDG8Q351Nf0xVG*^pje;k=r#=`R%#|J7jt=gXk#-+s z_#2>TFY3ef5qeL_iaR-7iPo6#NL-#a;a!Ovt&drwk8vd~Myk?5b(nf64hv;y8aOyk zAMbX2H>V%C9iOvwT`$Ivl;}ZyqF$;`(#!P8`V>;6Pqm{teV@~NIbFpmEE$Z+UQXA@ z6!H%<5m~;$DHcmmF`kR{!ZvxbSR+?13yYeGk@=NK?g)Z00j1L*{YoT4uo7QiF|OB= zR{C@T&9l}aobC>lgX^=1^RPZ!pQF#!=jrqH1-hei{R;g`eW4C1UB~HzoIb|slbk-o z=_XD$bNVu;TRGj%>06w>;|w@$84FZR)={=Zma;xNMtzO^cc0h6WB1E6bO+>?-Lm)W z4jr%nnlo?S{)XJTe!afJtq9X^5cze*r_V-j8|Y;HcKr^ikx@E6qo$#HOO{&*BiSuD zJ6JAlD5np|Ts+k9I&U}|KkY=og;8-}A1pC1FC&jx%)2sqpx7x+^W_{MrJ<@_ry?a}9*#-*nrl}?x8aK5Ig;NU zPyzMdrGLR$*}dr;?EWhR`a~G?OA_>!hOut{zl^nWR^Xe@4%`D*P)vJIWEl7>68Nif z+Gk@%WVIllcI9Pbo@eQ6l>+Y@PT3A?@HkBHSioujAFCOf7XDW0)5eGJl`cOOP3K{rTg2_ov@G| z(ODzICzkQ0!E3O`Jw0RK4a||=z=!Y#ZXJyjf$)CI8aoZzi=GMk2y#^V0|#KXou>6& zkfWYbeT4R+)0ESXrA41GvQ`wCi#o&lR_I}BeGi|=9!817AlxOh`eu4-PYv*?lm5@A zz-R23s-n7@AmSaQ;2Rtiw43F22aEZc><-RX&8f~;eXnGeX92v9)($N6=Mu$b;C=i__0#dOx0PA!jWmJj?2~lssa9MaMmjH$1AUsS2+QDj0zvmQM8~=XiijHlT z-YBkkIQ`+ksoQHjPa=0HKtJW#h`)-3X69?q3vPCm9{xSP4M=DklZ@Vw;N;&~apy@KI*jco921-=3?A#)N-cg3n<<7h#5 zcZ)&y-NKvumeb>${`S7-4bL{ueduSq=S?~S!rjINRMT+O-xF zZbBV4+qrS5EK@uEOBqOeKE$RX&*NaQGeA1uo{v3SR(rM(tehb(^nBuZV72D~(s`ff zQ_o?~XPzUT&q3Z7RPlW2`3hq_%yZ214Sq*KM}+eQII<-SUu>78@=^y@!zI2Gwo+}V}4WIgjVnfdl zo}YAewdc6!M^69d^u%h<&z@g6{gczb5G9`C(0Tr7aOnPVUC`tjnfVBohygmy6>a?N zFweDJfTOBnyqs7>*0@x0}&j zS!whzdK$ejnXAgActh8Tpa@yS>av+Y9RK`&&=Kd?05FCt@kss{y}1(Wj$U7*-)f_u zEMFLms zJP$#y%j29jqV@`V>&_7y8qVW0oQFc??TNf?H!jE-ajhT)pS)Q2)R5guerA4Ec?i%v`80&EHiF0ZYHR1av7K9bub~axpINK8Qi!Ho579S zjXR7xjg`h-#@$@GkSmzJEx6K>E3LTFT5JhNoFyvw+T@5CD<*HdHfP%`{Rnx)SgqU{ z-Ym_P9K%Tq)d3mzi8>&z6@?JB`CSJE2#%QK#L+d)ad-xuxR8wi<}vT%Cy z_Qn>sIn+v*aC3jLSZTznK>fUJ=zpv6Iv&`@l^$F{#t!{=3+ve(LeF-G5$qKVmP|lu zq#-BwpEd1H;~nE&<2_@SvD>p;YTCVAna-77T)B)ZJ-JfH6{HWp7Mivsa&Z#BW)#|Tmx0gB7QaCPe~_N=_jXc|N4L?r-MwswH2!CKTO-7jDx35 z+W|nt=~9Tp8pP>xr-zXe_@5!*|Ac`LlE4Qy0BSH{@zh)2RjcE(8Fd!w=A z*Ylv)@|wbL#w}%x@a0er>P-~R-D2VU4hT;jcU;51@4VgKG;cau2FM1lSicDI75ev$$nj*B*JBdY)VjAH1`)k>2y__r$#~+;Q&(__+v{XTP^4 z9BK3TnA!pREzMU+wBb7*T@eebzA@dBIM zyluU38>E9T{vRtgxK+n>=gK%K%Pq6BpoGN#LJj2!hX__q#zjIqwR1PW$xUuq(7UIp zZZRC*i(S?2?HrbhBB{D@-U+rlVIK*)lsYaCsp0>kyS?3n?)LUHK0Q-+m$p8r8QAKgEyphsA8*YO_xFNc6r^`f%Td9j%o|q&Ow|`+*yu&1Jg~s7CaVv9in}qo* za4Qh1pb=(gxJhz0b@NUTZj!gy=oQAUoGVirc|vj++O)yI=eBXnq6IUdYtBaM6nAoZ zE5e;s$jMn*ALHicx@q};5#t(1+!)sjB^yptD^n5UM%l7Jz1K;jA<_r4U86A?2cHNw z?>2;kUxPtEyV=_2y_an>4x>M=I9Q2Sf@4MFu&roFbr{>c_o3ydvgH+`<>e!arJOfv zlj?mKZQ#b3Tv;gEG#Msr@hL5yK#M%t;wsT1K`a>*O$m0ZtSlEibXTBHdE!~N&HKE3 zVzGGQnloz!WId(##roQm<6OBmT$=*j+2G5D;taTY2tO*Tf)(x;?zl7py3PAKfWn%C zE!PR4OV0&#M`NJN8i3lT*jx!PS^x}l_6(3mynEb{gN41`9l64ZV92TCd&IjRt+q-# ze1mM&19FT?>DscQ@?K@tH4P^i)%zxpoVIonXEp_}RVIXgEm8t95z@o0NC*KO)ohMjHqV~detO%sdac zKs5oE$GGwcS03dG5>8;}y76|?|Avbwu^88Yh`0>n(ZXyc@My`ECs&!Rx$?w0@W?gW z0FSn2JK%Ap#N!#RKw6*X%Ci!W?f-%&vh3p&p2%;)xLj;rDsZ`kE6=YoJ9Fi^bKuh5 z>;YVQn!SJvtOdzX{{g-yA4#8Nij7SDAyjvgI7O zHH@JvpnNx8Q--K})V~!KJjOEIvlv^42OFDTG#!VSg=!Lp)Qqjcb@;MD zu>;V200P4RXs-aY`&@vo1fWG>KzjtB_uaxXdl1xkJt%1QA%n)2R~D6=71}aDTP~p; z5YYCW3)&5Uc2gMIhXUGu0j<*ZqujO#`|HKNjKQQFpJ(C!G9nJ43y`j)2DOj*Vh9`2 z+qF@NhxVemQY?2!5&2jS!Lo+oSzxY`YayGs@`-zIWNq2hpxh~UMqP|~zxe=UZawN^ zn#k@x;|ff}VTha4YrNg$92G&0YpPH$b$VG)M_q^&D2WO6l{8}^CcPE^wz#q=DFogcXJ9SVFEtXp7tGSh)_9_zFa^(%_$yvddCons;@Hl;@aPjjb(WsiK$ zpv{plIUgm-oF#ImiUC2bixT17Dx7cS8V8=)Zj={eCWssrEtDlP3CYj>TCM=Nrz>$G9V&bUx>d zVvB}YS7nj1&<52ZsdAwQsP%9T;Y`M{oFxhG4l8@iFWeiH=fDG^(ayc7ly`(@FA8`V z!gVBc`eN%k4Dwb7;ZRFXyF2?iOA+~Imc>~ts)@OB0*kJqreZSm63f6|3aC8Vj?)~@ z+U>-!=buo8Rq#0yJw0Zqu?8cawT)S`5X?4{LR-+yV#s&E;mm= zs!~+w=bt6}b_=cxY7m-Zc3_xJf}P;me&p0ouithn*nL5^*H;>zRKJKx^{bdvINxu^ zkczVs?>-30uHS>?tHma`Z@BV%1I2%gmYUYxcjXdO*FX$vuU26L*fEhEi9?m@Y1^{~ z$Squ01@p~kJ61E)YK9OIW8ib#ZJ0jpB7%K?d$Gq}?*1c7kU!~D1IJAszKIpUJ~jEl zDlB_p5fC^|bar~(y@B4-H&wwx`Id%9Q^)}c6El2h5HCuo{nsd*3df~=CAQbNb~AMN ztM4A-tYzDwT@GPyBTR5-OgU#SPBUy6rv^&h0{&Ae#ZJdYv$LdxZmFs9iP+ z;dvbEEjZ8m4PUl-z?X~33LPP40VX}ms)u=2887s03UkG`MM(B>&b(pPU=mB6>w5)N z!D_kpdG9u#>a%^RzUJm9>QZ&CdWSDb9S#knTqBeM<~(LKCN1VBOLR^;e~P)zk{m38 zo|SO1*NyEtjqu}*2|rV=xs!-PvvqiW{^yTQLe^M1zuJWl!my) z|04pS$4+IQi?^?h@B4b@{VX^a%UN^-^I{6~#d)zf`?*0s{O0=|`r%K`uxkhDZfxg` zcSY!zhUs&H;Ft$Y9Z}#N?m-Op{~raXO|JjS`7wYl_Q3@kfj*TBAvL)^B0kK82xwju z8hANNZD2!MfvAa=R7QkOQG(D$WI*Go$J8CLZuhHyshhM7T3_{m`KQn0^Gcf#EtNG? zbtY6cteh}i6nZ@qHU$>tTp}g+*PJR+!c;YyOlRlgzkcpiCWy@t*d*{h4m1@ z8}RIW&agwwRe+pbSQy@SCFgL&rLSlT zT+Lm+=Aa7j@cnr64Zv8B9!$-20>VH09x5HiOKiaM3K!2Sin-QcNAC{&d;>pDcs5^) z-v`hf&G3Y~-iW5hMJu;Ce6t=xUm0k(LpU=Lvd=ZLTQrh(06rQj1r$67bD83TLm#qt z;lPP$o&}H86qxzt{g7J-48MjOC~>%3AcDrSJ=PN73c@8kfT!>rdPn~fW!wkilB)AX zU$|H!8i=mYR$PHr=_CSQmn^U&3Wy7i2nc8eyC-IX7v17ZfNJN8&IutpV~wp^YhN~8 zeM22i=As&W9_kZ5H>Z&-sGe3hzh$=39wEYPta4?*@jmAB>I;p-+6>Z1?@4B;2lNGM z3%F(5;l$6vdfaE4X?&`4ZK2-U{FBTR0-}%8=b9%-t*;ZNT8VK4f-uwQ;PaTf^eeHk zX@x%Dbkx6mrmr2TQ#To(Xz9i_l!h(PO0|noESM=m6S#cqbw|6$e8b4|EH+Zr`+c@> zb%np0A}Xl&!=Azw-U^=z7Mk9(o8qc&4*n4z%$6Q8KTb6mCDFt0Qhnv2Y<%&Y5PpR&|kW?qLuzTRA6 z-eBHn-elfv-hx-EOcSqEG4C{2ns=FZY><`d?V=2Lj#$~5yC^I7=z&zp#gI&#*Dvx_;qgtJRIgJal*v#y+V&4k+ob~3c4`+Qj>&IDt&IWKckTZl9gEIGfMe0?r)HIF7yH>`KlSa<+)Gt2n!w zvuilJmb1m2E#VAaB4i5WT*ujR&aUTd1!p&4qK-Q?{f>=yqH;>6J92Vzr2AlQA$ddE zIch;R{$K&rtqjO*7b*pG+h(6~m3zunsGDu*CRcdsDBUo3ki0P>LTg?V7&HT=l8)Nw z+?6(Nn|JU)j-xh!%xn1AW@vV{Y~>b#AVO)tyP;KfqfT?sMmSaCV3+Ju5Ny{5VWvw} zBl=EhpVb(E3)nma^yKN3f}YQC(ZNw0!^jrFt30zW2kdA#T{P!ZCO5`W9DrMoV@?Ad z?Old^3n1B!ibDo)%0y!pw?i47z~V=eH#9rTQBQ%_7(ly*K64xK#_iwtsBn=QQ`+uS zRK<%y>d~toqtK8>5@6TfQR{ix7(jI=1dj85zp;~)lo23w?UVAV)ZZP(`*pRFSdRDzddy!_c`?S8KmOWu^XUny8 zR)+*yDHA)ada~Qi<=R4;ffKS`P}duuG2|n0dets3j-kP6Rg2klUvr#|RmC1KKQXqF z**F*LMfHAt0qo%%Hd`B^m5>Ewp4yGwOXjodjZbl+*2|v7J};7e$MyL*18b>zfNe&C zEJ^LcrWmQ(#W+W6mOc+>Z9S;9W-ob`;Vi9r>}hR<(cY)R$-7OQvIRG8jd7TjBVqWQ zK91d_ZZc1(OL4Z=Lu`w$4NmF0mKa*FSo{ek?ta_e47w2$oV)IEK;}e{@^#@Mf znri;ZR_cp9%YB{LLZ1yE;+WCFbevydVU?R5cqEU_e*30n7w zfLol(wG5|YA<0IO+Jgy!ZG|JZRi=r$!5M%>y&mUl3F8Z2?oLGJLI&Y7jS&vj%OYzh zj_|q^hjAg|JRwfhqHr802#d^xKM|0}Zoxai(j<~=OgNLmY`2yB<&Z!;BHRZ$5N-xO z?GgrD6e4|vWSnxP$Wks94hG_yh2qRH;jDFZz7_|4Aq5E!^g2$9xblH8@gm1}LZl+$ z;dB;hyiLdiBInduBsg!A4oQYM)(buXLcbqGjzf4DSId*g62!@0BHx#UoYQvcG{CXI zx@Wv_k#LfkvP5`KI2#OwQ{rT@7UBpoI4QzYGKHsjnA5v(ewpxO=fF*J-j^;2d>Obr z`=#r05(!XoTG?`OzL-cX_Qq*wPE(G<&FDILOxaL*FdCdEcrI|0I*4=0Xg1s}QKz*+ zBuQ^{K7>0Z4nq?O$*-js1*;y3oF#lTQ6Rg!UJLvzwLs)Ak-tX%7WsSRACZ4X{uTLm z*|%c`eiOSrPa@(y}bu(5xsc+KRDatvD;*O0W{GBrDlU zu~MxxE8PlM8CIs%#A<3av(B@cTjyIBSQlCsSuL!VRx7Kum1SjHIaaRK#%gP|v)WsE zRtKx2)ycZpy2QHF>TGqfx?0_=?p6=0r`5~4%<66RvHDv5tp3&jYoImA8f*=*hFbYn zfi=t;ZjG=Ct&!F!YqT}S8f%TS##@(LMb-qX*ebDt)Va>E=S+lJ<)?90zHQ!obLFBC~tShaB)*|aF>uT#7>so8EwZvL# zEwiq(mRr|bE36x=8?BqHo2^@{Tdmuy+pRmSJFS)0UDn;!J=VR}Dr>d1##(Ewv+lF* zw;r(8TMt?fSr1zqtVgUzt;ej#ttYG}t*5Mw*3;HA*0a`g*7MdT>jmpYYqRx|wZ(eb zdc}Ixdd=Euy>7i>ZR6}#&TixEcFykL3^Q#dXLoUSH)r>7b}whEpg}oX!`WKS)^T

|-6uJFinEQJJzuv884%mf*_)j0;Os5V-sWs4XYX+K zE@$s?wu>_e+#b%}=WH)$A8@vh<0J{TpR)s;VM=|>*+I@e;S3`GDQAZ{`;4)5vtK#;jkDi5`-8JTIs1#V zzd8GdvlE=1J8|`5u3o~` zOS#&at6jL-m8;#j+MTOCxZ0Dey|{WAS9^1{4_EtgwI9c6X6gX04&>?}t`6qv5Uvj8 zYCcyBxH^oh!?`+wtA$)0$<V7)HPgDKWhgb0ZYTxOnNq*|_(`dYHZ;$<^{TAMZ zx5AG1(_B9tX1{OW;HRZ{Ro^E2em`AdKY;fFK4!16@3K$W=%&C=TiHA8&-}EbpWbM1 z@YD1BG{OGEp6jOpyr6G@{e_=iXz#Lr@Y751ioLz|6ZYHoaX-zmzp`KV)8_Vv_HBMz zgm>=kx8L>Ci|n=bPCvaAZv#APzi8j?r-}AG_RID!_F=pvaJBuOJ=;&q?Dc*c>8HT# zYCmmZC-`Y=yV6hd?L+pXc*EbT_5wd`iP!mkV1MMNlkI!$fAEgMefCrKR{IV=UF4^o z?0J5Av3<->W9^N8daa+@_Oo~+V4nSxpJv%d?1%l7<2{2n0)^uGiuN7h3uMbMUU#py@0KrQ z=+n(D))HI9@Jfh8(gZIl%*M{6{&?%$a8g1hdVAr0sJG(Hrd#m_)5G5HynmYss42-a zJDUUWp3yRd#>)}v-j87RaRjl?Ab5Sz+=91pzHV+aci=so@8TVtd-1l+{dnKzCwRZ+ z&v=XG?>_4D`4WA}zNWsGzC2%NycKj5-Yi<~o91(T*W!Jjcl+-5J>lEvd&c*i?`z+Q z2st;j93(Lb;Pw1OCpv zZ4qxryc2OK;uzi(s^P7uUekvfpExty%tb9qd%Q)plX(fK=xTOHJ;-Hvk7_?qRE?nj z8ie$>Az*(L6g`Qs{Aq;bn?Th|plf@GmXGi@&_j54=#fYg*(P#WWOd}?$onE6jeI)t z)yVCUpTg>zu&k-Dm|3ufePHtjNP9OFR&ETe*i6`|xv)`J!4BODTk|+9#7?~X^E2xQ z>kqu6)5e=OGw@c;ad@lcOpNm~`%cWa2knP3{EuPcJY_#)KX1QaZ-#vAwm-5zvp=`L z#5_6XkMXDZ&-dr}+xXl0^ZXtC7yB>ucky@g_w--pAMDTf5A%=kKj?qWf5`u%|3s7# z)jXxHjJhZ4k*HUq-iX>BwKM92sC`lUqdtoIH0rac&!fJKIvRB>>f5OA zqmDI^!n&$qqj!C8@(_3 z%jh4Y|A{^sLt|Ks5#x>V#h5V{#H1@pM^J6cJ&5rFJ zJ2*B!c3AAV*s|DpvCCsu#y%JOM(p<39kFl6z7zXi?B3W9W5165KK6L*PqDwo`Qpqt zE6yJm9oHhRLtM|e%i_kwjf=ZHZbDp1+>AIU?%KE;;%<#w7x!k|TX8$%cE|0D`!Mc6 z+@ZL`aVO(xJd4-jJ@MXne|)R>toWSxHu3G^^Wux*E8?r-tK(48A_?_|Z#_x(h7=JAOyZ9dx%mgdJpAel8n-HInlF%%n zMM9^9?g@nnqY}m>j7zvYVRFKZgt-ax6Ru8Jns8^r6A7CVUQ2i<;fI7j5?NwIVq_xT zZ;=?27?+rwn3~uwv3p|w#1V-T60c6YHgQSfvc%ye;vu#O;Z@5)UMPm82zk zlDtX2q=+Od$)6ORbWu`C()6TjlWtAAFKJWK_M`(z$CG|a`X%YNq(74WO8O`1WU`v9 zCmYFTvXvZ@+${OREsYo{{V%FG;>F z`M%^wlb=t1HTh8T;p8L9UnGB-d^Gu33QM^-<NqUP#%T@eOpfm!vLBy)O0o)EiPCNElgXMc7NKTv|rL$dSZIJ^secB(hJhZr%y_soL-(@kzScTGktdY zob-k1SEb*YzB2vp^n24+r$3y&F@1CTj`Xk6zfS)q{k!z<(|=6=IsMmw8R!-09q1eA z9~c-I92goX2n-L53X}%Q0#gE01JeUn1{MXb4qO|!A#i8luE6tw7Xq6DTLLc!UJYyw ze3TKJ5ucHmk(`m5k)Dx}(Ilf;MvIIN8J#jN$>^NXFQYJHRK}Q$aT${{YBK6FZpgSP z^co=a-XHVcy!*}E^B2y{J!fuPT02??T5lSM#-kO{ zY&1KqgjPy((cH8IZ4qq=Z5eF^Z53?|Z5?d`Z4+%L?HKI@?G)_{?HcV7?J?~s?K$lW zy(zsp9iTJmY&w_DqYLR`dJf%2Pta5JG##U7=medj52KHwkEhS4FQETHUrb+0Ur*mb zKSDoGzeRta-6*?xcCT!1wk6w{U6BoEV*mg!0XDz|_<#@)137>c$Oq(r3eW<2zzA3X z8{hz(fE(}tJ^%zlKoqC~U?2hX1uy^yC}03E7#Ifp42%ZG0TY2=fN8)?;8$P{@EfoI zSOhEuRsgGkb-+eo3$Pv73G4y(1BZa4zzN_qa2B`#Tmr5D*MVEWUEp8f5%2_f4!i>1 z0v~|Sj0TMF7~eCRGg>lQG1@ZPGdeQ5FuF5(G3X3{Az>&O28NMgW)v}M7${>1V;W;N zV-aI5V<%%b;{f9*<2d6a<22(h#yQ4a#&gCi##_b*#%JdD%x28?%%7N@m|d7Wrktr{ zs+n4*i|J>EmF2{KWjiYQSp5YRu}y>dnew zNm+VUAB&I8UP&STC~ z&U4O7&TGzBZZj^E%jPP$Dz1iGz}0i3+&H&}o8YFnX)eaiaEEe-b7yl`a#wTLaW`-` zaW8T&aj$T%ac^>ObMJCL@*48m^4jr!;&tM6<*9fYo{neW8F^-25zoa#coc5{ZxC-N z?|0rGyd}J4yp_DwytTZYygj`AyhFTWyc4_&ynlFCc@KGyc~5yS_*wi8{7(EX{O<$NXI!ng75{8B#3&+tipEq@??Fn=h2B!4vj7yeBCEdCvoibOV%L)2Gw6nB}w7ayIlr9CN3@KZxk-DUQDIu+u4wMd&4wsIUj**U+PLfWMPM6k6>!ow0 zze$%!*GjiacS#RQk4yiO{w=*Gy)AtxeIfmt*CMZNUi-Z6d9*xTo;fd=m&nWHk$L^| z2IURS8W-h#Xpd291_<{ipAnRhS0Y5q6MpWiw^E5Ad2r~EGY%KY;DNPaxOIv>eT z<)itN@~7la&#%j`&!3zBTmJt16Z!XLjb%+`-)y$5wJb~4UIxfmGOmm-6Ut;Vg-k6g zk(JA;WUwqDOUcqQLN;19PBu|CSvEyhCtE68AzLk5D_bwyA=@e2BReI#Bzq`(EPEz< zA$ukJB5x&cD{n9FDDNT{%4Kq`yh0AiYvf6JTHa6ohkUVonS7;ujeNa)lYFauhx~y2 zko>6pj{J%Ijr^;kp`xv#z2YZDXGK>@MUkRdQKE1u$`zFgzapRrE24^_ ziV=!Yim{4uiV2FziY1COio1$;ijRuVim%Fs%Ernj%BITJ%JxdOlB*ObMM{a%qKqr6 zm54H>?5jkT8RdB8O63~mI^_oCX5}{J4&@%@A>|e2HRVm^ZRK6%3soysTUC2iM^z_P z7gcvvo+_w{sA8%rRkaFHB~&TZc-17;6xDRq3{{<~UbRkjR&_!3x9YO$s_KU7mg<4} zdv$YlOLZ%CYjs<7do@>GtS(VI)n)1mwO8#|N7O^q!__0zW7K2S3YX{u?Vp=oRyho)5H(zrDqO{K=CAvOIqgET`m!!#o_ zqcrn0yEXeX2Q-H?M>Qujr!*HdFEwv8?=_z^pEX~#jkKM$3awhJ)#|i`TC=uDTdGZJ z)7pMoLQ86EwF9-&wL7(YwEMINw1>1uwa2t4v=6n9wa>IKwXd{qwC@Yr7AOkT1=<2# zfuX=uU@j;ss49R95(Rw=(gj!nUNEs>b-}uV4F#JDwifIt*jaF};A+ABf_DWU3%=+Y z=o;yM)b-Hy)@AFMI<`)sQ|Yuiz0RmB(S>wTU6l^jAv!`gS~pHNQ8!sPMK@2kMz>zK zNw-zEU3WrvO?N|gTX#?QK=)4HT;EdPO5aAGrSGI?>v?*iUZR)kUHWo;rQWaaqYvoA zdQ6Y&Nqv9)K>ZB;cKuHMZv9^Ue*Gc+Vf|74S^XzNb3;2rcZ1L%F-Q$EgVLZe6c`K! zlcC5!7={>z8%7$&7{(hW8h$ZMGt4y1GAuM~HS9NBFx)WQHT-LMWO!2eU16KTE`|I; zQK6(zS|}?t7McsKh4#XV!pg#MVNKzv!r6s?6fP-TUbwPwQ{nc){e?#g9~v7Pn;U6H zsnKEtjUi*y7&k)38e`Jf*N7Si8%G#N8OItY8K)Sh8|#cKjjN68j2n!bjOUCGjE{^@ zjL(cOOy8TbOdU;KOx;a16JTPQxTbtlp~-4;n#xRlOkopc8fltjnr&KQT5Z~HI&L~; z`pb0Q^tb7z>9*;f>Ajh4=9z_NiCJovnU!XZxxj2NgJ#s+-#pMf(fo^fs(FUF&OG0| z!o1qN&b-mQ#k}48r}>)sU-N78JM%~L7fVA+V@p#@3rj0YTT2&9PYcJQx7aLhOO0i; zWt?TAsael>vZcj>z~%$)_vCf)`Qj~*5lR_)(h6#)_c|m*8i+etuL&v zt#55V+5|SSO=8Qn>1>5Ilg(mt*y1+KHo`W_Hr6)5HrZBhTVY#mTW8y7+hW^iJ7>FS zyKK8^yJ34#{9W<)#m$Rb7Pl&<73UP^70ZiN#oA&^v9;J<94VewJhS-M;yJ~?6)z}W zRJ^o!dGV^^BgGesZxr7uepLL$-q7CI-qhaW8?EhG_73(=_Ad5(yTY!v7ua=ngWY5g z*oWAM+kdu?vX8Y-uurnr**Ds^*tgqv+IQLa*!SD7*grcOI2t(`JDNILI9fW|J9Lgh zhuL9u*d3*gGDo?i(&2Z2jw(mek#_WR5Dv;Q%<;2hv}3GezGIbRi{pUfu;ZBHtmBH~ zW=W%x7A37qvPwFZbSddx(zAqCq9}=$RF%LbiITo0XbDkLTQa?5RmriElO<U!~_tFO}XZz2j`+Z07vI`J=Oqvz@b(v#T@L>2$iC9;eUgcY@B4v(`D!`MYzW zbCGk2bGdVcbCq+w^R)A<^Mdn|^Rn}b^Sbk`tD~!ntDCEbtG6rL#c*+5Vwc6`aaFqz zSIULDGOnSnDX!_RI#<1Gu4|cVyKARwk88i{kn6JRk?V=;x$C9tOsiJula(pUG-U;4hO(kEUl~{yDvOlG%LbH9D4Se1wQPD>UD?*M?PWX5c9-of+h2CD z>}uI_cO!QbcQg05YLJ`n7P=+wTz8&Z=2p1v?x;KCCf)trgWN;iW8L-cx$gPyh3>`f zUGCHFv+fJ-OYSS~$L?qDm+m+2_vJ0V(YidVyhAyooL$Z<7nV!P4dtftqH_WRe8Viz4v=>b8ky;D{otG zdoSQ+dAVMJSLBs@t=?j9iPz;V_lCTvH{&I}wcdf=x!&Kr3%q}Lmw1AZf9?O$=WU<&eLnX20yY4@1HUy) zz#qUL!Pa0F*a7Sab^*JAJ;B~!Hpm1yAP*FR5>N`tKqaUFbzmWA2CZN*SOU60H|PO< zAP9!QC|Cu;AOfa96zm5QU@bTh90CppM}nilao_}S5;z5%4%UJ7;2dxsI3HXHE(Vu^ zE5KFYT5ton8Qco)0C$0V!2{r7@ECX!JOiEsFM^lAf55BY4e&O24}1Xr2R;Q~fUm)~ z;0N#%_%+Zd&?L|-@I#GfZ(9u z(BOpNj9^`GesE!MQE*9cPw;5)RPbG>NhmASKJ-(lQ>b&OYp8puXQ)?59nyyMp~8?U zWC>YA&QSl*z|i2((9p2Zh|tK;=+KzZl+dhDeQ055WoUJ1U1(!yb7*VmR_IRXUg+P@ zgV3YU*)X4NmU8FuTCo(TGKe8aQD6%@TJF+iwFmfbv zJaRsAF>)hvGjcofI@&$jGuk^!k7h?1QC5@_kI7@om?{>JRmW;#iCFSmI~e`;&ma?<8=D_n7+V}$8e1M)8CxA&7uy`$ z9ori_7P}C;6uT0;9=jF08@nHG9nXq)huu8M2p`nWM}j;G`O z;&_~j_m2;Z4~`FwkBF~~uZgdVZ;Wq_Z;fw{{~6yMKM+3|KNCM2KOeste;9une^>Rq z>SfjIs&`c%t3E>wpzok2P&25-H(Eh$pe(38)Dh|ob%T0By&*cpfY=ZZ5<(Iv7s`WV zkP=cuT1XESLT0E4vO#vJ6e@!%ATQ*HKqv%7pg2?w)j$a-1))$sh=3@lKQss$0u6^o zLSvwD&;)1_GzFRl&4hl1=0NkH-=T%jB4`P;99jvjf!0HtpsmmjXcx2x+6Ntg4naqt zW6%lcG;|ia09}Iqfv!O}pxe+r=wIj|^cZ>yJ%?UFZ=mO{>41YpPpS zx2TcCNt9w_|s~OeoYDx98>X+4Ts^3?Cs{R5ufE&S0;AZd-@Q-jCI1BCo zcZ55`UEv;ZZ#Wxf!fcoe3t%yv3+KZMSOsfg9b5>T;Uc&gE`eRJ8}`6H7=%M`6t03{ zI02_%6z&HTa4kF#9t;nIe}+fHL#1Mh*nVAzhIkNN*$?VImxakBE>QBoC1zDnyIu5hG$jY={GKB5uTk_z(~YAyK3Xfsq8# z7r_u5p^yQ{U}PBbGcp<(hfG9%L8c)ykzbKH$ZyC3WD&9yS%IuZ)*%~_Ey#9cC$b0G zj~qgdA}5g3$XVnT@*Meqd_uk?zDxX==$c?B@)HFKeWEa7Pxumj64ePb(Jz4~h9<@* zCMD_;za|zZ)+Kf(jwLQ7ZYQ23J|>$b+a$A+?UUV;J(InYf}|{IN|qMK zo|T@Ro|pbT{YQF9dU<+PdTn|`dUJYPdPjO!dT)Av`e6ES`dIp8`b_$4`h5Cg`f~be z`bPS8`d<1$`oHwk^o#WC^t<$j^k=jI`W^Z`+8k|({)o0g+o3<9ozZS+Pn3pcqYRXd z@=yUPMsv}8RF0}pEviEcQ8Q{q?Pw|LLfxnb^`RgdL?dV%h0q!_iKfwhD1p|Z1JNPq zaC9U(1|5%1LVrQ0qBGE0=xlTzIv-t#E<%^0%h6TnT66=t8Qq5NKzE^g(F5oq^eB1) zJ&m44FQ9*;|De~i2 z5MF~P@ig8KC-7Q)AU*^ij*rC0;N$U0_!N9PUWeD?bMg83LVPj43}1<_!Pn!P@U8d` zd>6hKKY$;`kKrfrGx$0DB7Paair>I*zYq8Ae@Ao@DM%%Btk@#s3Kq@ zLG&ds0w*Y905O;tM*K{SCdLsHiC>6m#7yE>Vh-^ev4B`aEG1SDtBG~QMq&%Go!Ck2 zA@&o8h@->_;xuuVxIkPYt`OIWTf|-BU*Zw*gm_N8BHj`oh|lD=fF}7p*_>=iwj$e* zS!4&YBiV)QM)o9WBtWuA4#^`0q?pVl^GP|WB-Nyr)R6|#NLol6X(vla7wIM|$V$>r zf@F{klTk8GLL^Kk$i5^>_9F?hmK;D1CWnzD$dTk2avV8w zCl`>5$R*@5awWN%TuW{sH<4S&ZRDTiE^-gKpFBt&CXbTG$y4MR@+^6tyhvUm{~@oE z*U4Mt9r8Z;kbF!&BVUlO$+zSO@)P-mYCtuj8dFWF=F|^V3#v8MmTE_JpgK~WsjgIa zsuxA40E$I%C_W{mB$SlOr{t89Qd0$#o+_lwR1syP>{JQmqTEykRZ01%K2(qjQ!xsn zYN!O&mqMuwMNkwqfEr8(yY9ck6no3QlW>T}L+0;DhcWNQEh+0A|r&dyH zsP)uFYBRNs+ClB2_EP()gVYh~ICYXbL!G70Qx~br)D`L)b%VM^-J$MN52zQ^OX@ZC kh5B0CsP>22mbI;FJJxn<@W0cj(f?`ddH<*XziYYw12kQA`v3p{ literal 0 HcmV?d00001 diff --git a/Feedback/FeedbackController.h b/Feedback/FeedbackController.h new file mode 100644 index 000000000..69e4d531a --- /dev/null +++ b/Feedback/FeedbackController.h @@ -0,0 +1,26 @@ +// +// FeedbackController.h +// Cog +// +// Created by Vincent Spader on 3/26/05. +// Copyright 2005 __MyCompanyName__. All rights reserved. +// + +#import +#import "FeedbackSocket.h" + +@interface FeedbackController : NSObject { + IBOutlet NSWindow* feedbackWindow; + IBOutlet NSTextField* fromView; + IBOutlet NSTextField* subjectView; + IBOutlet NSTextView* messageView; + IBOutlet NSProgressIndicator *sendingIndicator; + + FeedbackSocket *feedbackSocket; +} + +- (IBAction)openFeedbackWindow:(id)sender; +- (IBAction)sendFeedback:(id)sender; +- (IBAction)cancel:(id)sender; + +@end diff --git a/Feedback/FeedbackController.m b/Feedback/FeedbackController.m new file mode 100644 index 000000000..28c82114b --- /dev/null +++ b/Feedback/FeedbackController.m @@ -0,0 +1,74 @@ +// +// FeedbackController.m +// Cog +// +// Created by Vincent Spader on 3/26/05. +// Copyright 2005 __MyCompanyName__. All rights reserved. +// + +#import "FeedbackController.h" + + +@implementation FeedbackController + +- (IBAction)openFeedbackWindow:(id)sender +{ + [fromView setStringValue:@""]; + [subjectView setStringValue:@""]; + [messageView setString:@""]; + + [feedbackWindow makeFirstResponder:fromView]; + [feedbackWindow makeKeyAndOrderFront: sender]; +} + +- (void)alertDidEnd:(NSAlert *)alert returnCode:(int)returnCode contextInfo:(void *)contextInfo +{ + [feedbackWindow close]; +} + +- (void)FeedbackErrorOccurred:(NSNotification *)aNotification +{ + DBLog(@"Error sending feedback"); + + [sendingIndicator stopAnimation:self]; + + NSAlert *alert = [[[NSAlert alloc] init] autorelease]; + [alert setMessageText:@"Failed"]; + [alert setInformativeText:@"Feedback failed to send."]; + + [alert beginSheetModalForWindow:feedbackWindow modalDelegate:self didEndSelector:@selector(alertDidEnd:returnCode:contextInfo:) contextInfo:NULL]; +} + +- (void)FeedbackSent:(NSNotification *)aNotification +{ +// DBLog(@"Feedback Sent"); + + [sendingIndicator stopAnimation:self]; + + NSAlert *alert = [[[NSAlert alloc] init] autorelease]; + [alert setMessageText:@"Success"]; + [alert setInformativeText:@"Feedback successfully sent!"]; + + [alert beginSheetModalForWindow:feedbackWindow modalDelegate:self didEndSelector:@selector(alertDidEnd:returnCode:contextInfo:) contextInfo:NULL]; +} + + +- (IBAction)sendFeedback:(id)sender +{ +// DBLog(@"Sending feedback..."); + + [sendingIndicator startAnimation:self]; + + //Using this so that if its a bad connection, it doesnt sit there looking stupid..or should it + feedbackSocket = [[FeedbackSocket alloc] init]; + [feedbackSocket setDelegate:self]; + + [feedbackSocket sendFeedback:[fromView stringValue] subject:[subjectView stringValue] message:[messageView string]]; +} + +- (IBAction)cancel:(id)sender +{ + [feedbackWindow close]; +} + +@end diff --git a/Feedback/FeedbackSocket.h b/Feedback/FeedbackSocket.h new file mode 100644 index 000000000..dcd2bff13 --- /dev/null +++ b/Feedback/FeedbackSocket.h @@ -0,0 +1,27 @@ +// +// FeedbackSocket.h +// Cog +// +// Created by Vincent Spader on 3/27/05. +// Copyright 2005 __MyCompanyName__. All rights reserved. +// + +#import + + +@interface FeedbackSocket : NSObject { + NSString *from; + NSString *subject; + NSString *message; + + id delegate; +} + +- (void)setDelegate:(id)d; +- (void)sendFeedback: (NSString *)f subject:(NSString *)s message:(NSString *)m; + +- (void)setFrom:(NSString *)f; +- (void)setSubject:(NSString *)s; +- (void)setMessage:(NSString *)m; + +@end diff --git a/Feedback/FeedbackSocket.m b/Feedback/FeedbackSocket.m new file mode 100644 index 000000000..29bebd955 --- /dev/null +++ b/Feedback/FeedbackSocket.m @@ -0,0 +1,131 @@ +// +// FeedbackSocket.m +// Cog +// +// Created by Vincent Spader on 3/27/05. +// Copyright 2005 __MyCompanyName__. All rights reserved. +// + +#import "FeedbackSocket.h" + +// NSNotifications +NSString *FeedbackErrorOccurredNotification = @"FeedbackErrorOccurredNotification"; +NSString *FeedbackSentNotification = @"FeedbackSentNotification"; + +@implementation FeedbackSocket + +NSString *encodeForURL(NSString *s) +{ + return [(NSString*) CFURLCreateStringByAddingPercentEscapes(NULL, (CFStringRef)s, NULL, NULL, kCFStringEncodingUTF8) autorelease]; +} + +- (void)sendFeedbackThread:(id)sender +{ + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + + NSString *f = encodeForURL(from); + NSString *s = encodeForURL(subject); + NSString *m = encodeForURL(message); + + NSString *postString = [NSString stringWithFormat:@"from=%@&subject=%@&message=%@", f, s, m]; + + NSData *postData = [postString dataUsingEncoding:NSASCIIStringEncoding]; + + NSURL *url = [NSURL URLWithString:@"http://cogosx.sourceforge.net/feedback.php"]; + NSMutableURLRequest *post = [NSMutableURLRequest requestWithURL:url]; + + [post addValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"]; + [post setHTTPMethod:@"POST"]; + [post setHTTPBody:postData]; + + NSError* error; + NSURLResponse* response; + NSData* resultData = [NSURLConnection sendSynchronousRequest:post returningResponse:&response error:&error]; + NSString *resultString = [[[NSString alloc] initWithData:resultData encoding:NSASCIIStringEncoding] autorelease]; + + if ([resultString caseInsensitiveCompare:@"SUCCESS"] == NSOrderedSame) + { + [self performSelectorOnMainThread:@selector(returnSuccess:) withObject:nil waitUntilDone:NO]; + } + else + { + [self performSelectorOnMainThread:@selector(returnFailure:) withObject:nil waitUntilDone:NO]; + } + + [pool release]; +} + +- (void)sendFeedback: (NSString *)f subject:(NSString *)s message:(NSString *)m +{ +// DBLog(@"Detaching thread for feedback"); + if ([f isEqualToString:@""]) + { + f = @"Anonymous"; + } + [self setFrom:f]; + [self setSubject:s]; + [self setMessage:m]; + + [NSThread detachNewThreadSelector:@selector(sendFeedbackThread:) toTarget:self withObject:nil]; +} + +- (void)returnSuccess:(id)userInfo +{ + [[NSNotificationCenter defaultCenter] postNotificationName:FeedbackSentNotification object:self]; +} + +- (void)returnFailure:(id)userInfo +{ + [[NSNotificationCenter defaultCenter] postNotificationName:FeedbackErrorOccurredNotification object:self]; +} + +-(void)setDelegate:(id)d +{ + NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; + + if (delegate != nil) { + // Unregister with the notification center + [nc removeObserver:delegate name:FeedbackErrorOccurredNotification object:self]; + [nc removeObserver:delegate name:FeedbackSentNotification object:self]; + [delegate autorelease]; + } + delegate = [d retain]; + + // Register the new FeedbackNotification methods for the delegate + // Only register if the delegate implements it, though + if ([delegate respondsToSelector:@selector(FeedbackErrorOccurred:)]) + { + [nc addObserver:delegate selector:@selector(FeedbackErrorOccurred:) name:FeedbackErrorOccurredNotification object:self]; + } + if ([delegate respondsToSelector:@selector(FeedbackSent:)]) + { + [nc addObserver:delegate selector:@selector(FeedbackSent:) name:FeedbackSentNotification object:self]; + } +} + + +- (void)setFrom:(NSString *)f +{ + [f retain]; + [from release]; + + from = f; +} + +- (void)setSubject:(NSString *)s +{ + [s retain]; + [subject release]; + + subject = s; +} + +- (void)setMessage:(NSString *)m +{ + [m retain]; + [message release]; + + message = m; +} + +@end diff --git a/Icons/add_blue.png b/Icons/add_blue.png new file mode 100644 index 0000000000000000000000000000000000000000..d721ce3092b0a4368f4f719410815cd73ea2e2c7 GIT binary patch literal 4837 zcmVStO&>uS)ve<0AYj>5AR{$W90N^4L=L-Rl zQUJ&DC0@ZjPh;=*jPLSYvv5M~MF zBAl0-BNIsH15C~g000{K(ZT*WKal6<?_01!^k z@7iDG<<3=fuAC~28EsPoqkpK{9G%|Vj005J}`Hw&=0RYXHq~ibpyyzHQsFW8>#s~la zM4*8xut5h5!4#~(4xGUqyucR%VFpA%3?#rj5JCpzfE)^;7?wd9RKPme1hudO8lVxH z;SjXJF*pk6;1XPc>u?taU>Kgl7`%oF1VP9M6Ja4bh!J9r*dopd7nzO(B4J20l7OTj z>4+3jBE`sZqynizYLQ(?Bl0bB6giDtK>Co|$RIL`{EECsF_eL_Q3KQhbwIhO9~z3r zpmWi5G!I>XmZEFX8nhlgfVQHi(M#xcbO3#dj$?q)F%D*o*1Pf{>6$SWH+$s3q(pv=X`qR|$iJF~TPz zlc-O$C3+J1#CT#lv5;6stS0Uu9wDA3UMCI{Uz12A4#|?_P6{CkNG+sO zq(0IRX`DyT~9-sA|ffUF>wk++Z!kWZ5P$;0Hg6gtI-;!FvmBvPc55=u2?Kjj3a zpE5$3psG>Lsh-pbs)#zDT1jo7c2F-(3)vyY4>O^>2$gY z-Gd%Qm(Z8eYv>2*=jns=cMJ-K3WLW;VkjAF8G9M07`GWOnM|ey)0dgZR4~^v8<}UA z514ONSSt1^d=-((5|uiYR+WC0=c-gyb5%dpd8!Lkt5pxHURHgkMpd&=RhJ{9;hDf7SW4Fc`jUg7sGG*~tLe_Ft1M4hn zm`!3^via;xb_M$zb}xHOQ$usAW~^qBW}W77%>fR^vEcAI*_=wwAG2sV%zY%w@v@XU~7=xdm1xY6*0;iwVIXu6Ta zXrs|dqbIl~?uTdNHFy_3W~^@g_pF#!K2~{F^;Xxc zN!DEJEbDF7S8PxlSDOr*I-AS3sI8l=#CDr)-xT5$k15hA^;2%zG3@;83hbKf2JJca zVfH2VZT8O{%p4LO);n}Nd~$Sk%yw*Wyz8XlG{dRHsl(}4XB%gsbDi@w7p6;)%MzD% zmlsoQr;4X;pL)xc%+^yMd)ZNTI#eJ*$O)i@o$z8)e??LqN_gLa_ z%;TM>o2SC_kmoO6c3xRt`@J4dvz#WL)-Y|z+r(Soy~}%GIzByR`p)SCKE^%*pL(B% zzNWq+-#xw~e%5}Oeh2)X`#bu}{g3#+;d$~F@lFL`0l@*~0lk45fwKc^10MvL1f>Tx z1&sx}1}_Xg6+#RN3Rxd=lW)Km@*DYMGu&q^n$Z=?2%QyL8~QNJCQKgI5srq>2;UHX zZ>IT7>CCnWh~P(Th`1kV8JQRPeH1AwGO8}>QM6NZadh`A)~w`N`)9q5@sFvDxjWlx zwsLl7tZHmhY-8-3xPZ8-xPf?w_(k!T5_A(J3GIpG#Ms0=iQ{tu=WLoYoaCBRmULsT z<=mpV7v|~C%bs^USv6UZd^m-e5|^?+<%1wXP%juy<)>~<9TW0|n}ttBzM_qyQL(qU zN<5P0omQ3hINdvaL;7fjPeygdGYL;pD|wL_lDQ-EO;$wK-mK5raoH_7l$?~Dqf!cK zmb5F^Ft;eTPi8AClM3W{=55LwlZVRpxOiFd;3B_8yA~shQx|tGF!j;$toK>JuS&gYLDkTP@CvOP@r~sh zUu{a>bfJ1`^^VQ7&C1OKHDNXFTgC{M|V%fo{xK_dk6MK@9S!GZ*1JJ zzrV5xZBjOk9!NTH<(q(S+MDf~ceQX@Dh|Ry<-sT4rhI$jQ0Sq~!`#Eo-%($2E^vo}is5J@NVEf|KK?WT&2; zPCq@=ncR8zO#GQ^T~S@VXG71PKNocFOt)Y6$@AXlk6rM*aP%VgV%sIRORYVwJx6|U z{ozQjTW{-S_si{9Jg#)~P3t?+@6&(!YQWWV*Z9{iU7vZq@5byKw{9lg9JnRA_4s!7 z?H6|n?o8ZWdXIRo{Jz@#>IeD{>VLHUv1Pz*;P_y`V9&!@5AO~Mho1hF|I>%z(nrik z)gwkDjgOrl9~%l9z4Bzvli{bbrxVZ0epdf^>vOB;-~HnIOV3#R*zgPai_gEVd8zYq z@2jb=I>#f&AH2?aJ@Kaetz@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzAFaQAR zU;qF*m;eA5Z<1fdMgRZ^14%?dRCwBymrHD%R~5&9=YIEl&e$_!JM}A$?bLCcq$+Jp zTbf4!r&JYUQK~?t2zH1S;vrQ?s0#!eBsK^M(F(Bxu`22UQB`dfP}{VNC~0U(lQbdD z!*=4tkBmK@@jSkJSj;$?IEe&TI+}aF`R@6jbIg z=kK*f#mJDeTD+527|k zyaZ?b*2^{Drj-FdEe~WLo_lg|`SiDTTsiU4{Ot6f78aM@a?UONufWE)-pJ1J@gH@M zJnmStK(qxfKauO{+53EF-}_H?UpoHh>({UU7Pths z2Lh|A$t3Y(y}kWE%Z`5Ku-CsI2@0szfkxA#0K#ohQGgW1At+c2T@!@azOLSmfgdK> ze-5mz-ujiQo@xiT&N)N`Ks-;zbA_H);?b|Y=no!1OaNMMT7|X{H&EN%CvCq9G%!&f zhM%R=#)s|nJI2s>MODvfb73bZCs|xv< z7XdT{8)3E`gtYQvWA4~ZRDU@yrBYf3g}9?YZp#p8)62InUlc(QNvWFxSCgmm+lzlcQm@rMER{;9 ztmk=VwYWUxvO|+e?+%PfamKW~sb~vO+JLWo_CB+pp9ElVd@qk3I)bR+^p5wXB_s5N z%QtGw$aXRePHtblHC5>9`owx7L*+_!D(c@I`B99z2IjVj=5`=Sn>Cfy1y+~l04T3+ z!`kKvw5h1JGzzRxT6bJrtV0m79Pf-)${$U6B7e2u#w$cSlP$w|zClyD2Z;8)fbaXw zKnHy5<9X7&T9IZ_IVJE6<(lKiJhLfachK!oy~Md*-ku9QMr>c zvMFgc>V@&lMhfCtgY~6pC16D{7#2z?AJ5iVDl183aH2@u!P-jFZ9RF|8e;|}h;u%oR5h$GVKT6^ULl=ZbGrvH76;>~L);2bz@-bCFg#ko0V zXXi*&aSr@kKmDB(d~0Z^Qcab5 z3iTGSQ*8>>b{~N8AdZDFZiQ%Dm34t&3|K!1Y#1f$mIYN;6>A06rgokYDhg#zbNHiQ zqNA`tYJ60LmCL7DU%rk3!a^Upp*=Wp&`1gLJ!HCi2t#vEa5(D3Hq|hS)@_nx76WNi zv|dhZoIzcRHE?51IkVKDl=RX6V*h%_}n_qX43qc{&hVcR%k-}pXAE4&OCk$Zcd zc(_`LoS#U=zpIMr{ajC0&U>mCnE*@=fhQ107`N^>8D8!6ayhmp-i$Iz&)lN2v9v2Ws35JsQcOeV9sYxg5>|LgSG zLvzz-3Tq>KNu+*P<=WhVNA^w8_sHXb5_J}cV((5r(al9i5$luAe9CwS%R6^H@^+jg zt2PWn3d8WtC-;8g@aylLcupT0CdzlCY5Jf!jqZ_QVEFFayzj&aSfBc>1v;;sWZyHB z$Mc24n}8ZsrCP1dPVCzA>eFL`GwG?L7_Ab-0e&DYGEMTO?U~?*oA~zkeIZB!JYA=8 z>L>@t24^OA?Rm9YtgT#H|xVeiLkiHo$$;BDoLW z0*wR2RjC|*m!~>)<P)A|vImKlkh(lWfN?+DF~HfK`d#N#AmyYVwIMw)#Dr?L2ATT@@1`kk@%H?>-A zN!kj_J;25o!Y~X`J$(M$*`I!J;^d~yllBVeeV+^%gjsFW+L@>?9+Xoz|lvbZE z6^nZ+StO&>uS)ve<0AYj>5AR{$W90N^4L=L-Rl zQUJ&DC0@ZjPh;=*jPLSYvv5M~MF zBAl0-BNIsH15C~g000{K(ZT*WKal6<?_01!^k z@7iDG<<3=fuAC~28EsPoqkpK{9G%|Vj005J}`Hw&=0RYXHq~ibpyyzHQsFW8>#s~la zM4*8xut5h5!4#~(4xGUqyucR%VFpA%3?#rj5JCpzfE)^;7?wd9RKPme1hudO8lVxH z;SjXJF*pk6;1XPc>u?taU>Kgl7`%oF1VP9M6Ja4bh!J9r*dopd7nzO(B4J20l7OTj z>4+3jBE`sZqynizYLQ(?Bl0bB6giDtK>Co|$RIL`{EECsF_eL_Q3KQhbwIhO9~z3r zpmWi5G!I>XmZEFX8nhlgfVQHi(M#xcbO3#dj$?q)F%D*o*1Pf{>6$SWH+$s3q(pv=X`qR|$iJF~TPz zlc-O$C3+J1#CT#lv5;6stS0Uu9wDA3UMCI{Uz12A4#|?_P6{CkNG+sO zq(0IRX`DyT~9-sA|ffUF>wk++Z!kWZ5P$;0Hg6gtI-;!FvmBvPc55=u2?Kjj3a zpE5$3psG>Lsh-pbs)#zDT1jo7c2F-(3)vyY4>O^>2$gY z-Gd%Qm(Z8eYv>2*=jns=cMJ-K3WLW;VkjAF8G9M07`GWOnM|ey)0dgZR4~^v8<}UA z514ONSSt1^d=-((5|uiYR+WC0=c-gyb5%dpd8!Lkt5pxHURHgkMpd&=RhJ{9;hDf7SW4Fc`jUg7sGG*~tLe_Ft1M4hn zm`!3^via;xb_M$zb}xHOQ$usAW~^qBW}W77%>fR^vEcAI*_=wwAG2sV%zY%w@v@XU~7=xdm1xY6*0;iwVIXu6Ta zXrs|dqbIl~?uTdNHFy_3W~^@g_pF#!K2~{F^;Xxc zN!DEJEbDF7S8PxlSDOr*I-AS3sI8l=#CDr)-xT5$k15hA^;2%zG3@;83hbKf2JJca zVfH2VZT8O{%p4LO);n}Nd~$Sk%yw*Wyz8XlG{dRHsl(}4XB%gsbDi@w7p6;)%MzD% zmlsoQr;4X;pL)xc%+^yMd)ZNTI#eJ*$O)i@o$z8)e??LqN_gLa_ z%;TM>o2SC_kmoO6c3xRt`@J4dvz#WL)-Y|z+r(Soy~}%GIzByR`p)SCKE^%*pL(B% zzNWq+-#xw~e%5}Oeh2)X`#bu}{g3#+;d$~F@lFL`0l@*~0lk45fwKc^10MvL1f>Tx z1&sx}1}_Xg6+#RN3Rxd=lW)Km@*DYMGu&q^n$Z=?2%QyL8~QNJCQKgI5srq>2;UHX zZ>IT7>CCnWh~P(Th`1kV8JQRPeH1AwGO8}>QM6NZadh`A)~w`N`)9q5@sFvDxjWlx zwsLl7tZHmhY-8-3xPZ8-xPf?w_(k!T5_A(J3GIpG#Ms0=iQ{tu=WLoYoaCBRmULsT z<=mpV7v|~C%bs^USv6UZd^m-e5|^?+<%1wXP%juy<)>~<9TW0|n}ttBzM_qyQL(qU zN<5P0omQ3hINdvaL;7fjPeygdGYL;pD|wL_lDQ-EO;$wK-mK5raoH_7l$?~Dqf!cK zmb5F^Ft;eTPi8AClM3W{=55LwlZVRpxOiFd;3B_8yA~shQx|tGF!j;$toK>JuS&gYLDkTP@CvOP@r~sh zUu{a>bfJ1`^^VQ7&C1OKHDNXFTgC{M|V%fo{xK_dk6MK@9S!GZ*1JJ zzrV5xZBjOk9!NTH<(q(S+MDf~ceQX@Dh|Ry<-sT4rhI$jQ0Sq~!`#Eo-%($2E^vo}is5J@NVEf|KK?WT&2; zPCq@=ncR8zO#GQ^T~S@VXG71PKNocFOt)Y6$@AXlk6rM*aP%VgV%sIRORYVwJx6|U z{ozQjTW{-S_si{9Jg#)~P3t?+@6&(!YQWWV*Z9{iU7vZq@5byKw{9lg9JnRA_4s!7 z?H6|n?o8ZWdXIRo{Jz@#>IeD{>VLHUv1Pz*;P_y`V9&!@5AO~Mho1hF|I>%z(nrik z)gwkDjgOrl9~%l9z4Bzvli{bbrxVZ0epdf^>vOB;-~HnIOV3#R*zgPai_gEVd8zYq z@2jb=I>#f&AH2?aJ@Kaetz@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzAFaQAR zU;qF*m;eA5Z<1fdMgRZ^5lKWrRCwByS50gi#})qG%>TPUZj#!v zt-?YqiIz=Dl*PZ@<<9i5D~5`tq8;F2hj=sdeecbCZyxFV`SSn(BErVT21=z8wzjs= zXf&|CzK*rEHKbB0c%GLOhR6|UKtpGsk&HH?Mxad!z1|MmtEOqzwzjq~I5>!bfdSaI zjZ`Xy!-o$eo6SON3IGt;XK1ZKL^LokaOCje!!P9X`Qqrv=<)u6em9*?A9QTT05s~2 zMo_I*A3j)ru(I^;r7xD3moJq{r7J{qPw$}YG4=#jN zJT*9&gPpLENLVnW1ONoSZ!}x2!A7GoxVpA_dhzDXA1*8`e0Fzv`A-`g8y_j9HvU&& z#yQUy3Wc9NbL!NOUYMQD=7;hyO|wHPR0{28vvWn3Wx}>?^!4@O*x0eu$&*vBT)A@P z^tFFn`}6(#_kRaq8Gz~r;WINcodX(;1`EURr0crxzI^uOpPW7Wa>8|85D~%{P-_K% zKtvz{GzeM)I#f{5;EbcczaK}B9!=P`^PPIVmJ7ph$u!M%+qOHd=g&R&+|Ha@t=3pF znf&$K+}sadJo6$P+d(^Q$HXFX1Ol=6OW%?x*r1d`!nQFqGz3!`6YJ~i2esD!v@ENl zwT9Lj{M@;7kW!*rtqz7^_{*7@nYUkh@g1n+A=9>`+2+#l{20%lDU~rCysK7K$ zxJO*8*=!bx=m=9v6)e*n%Mazj80$)vy@e4$8ZvSN0n(5WNlxI5fwO3x5CTCEpj0ZM z-3}n7fq{WTAjZbD)&&7z#BrPhsoowyD=(4)=H@1@UcHJ^snmHqb_4+Kt*+whm3z=iLo0>sfdd#gG=QZ`AI zztp&J;R4F#G5}z7bOb+s=bdiDKty{6WTVjlfTnHR6_HM-zg9}M9zEK&Q@ts)0km2z zY;Qk`(nZQHZxRqS2%WpiimVvP$D{pAyBDQz!+<#QmL;+CX>18IL^lM z^4;tcPdtIp_ffCcK}3+!0BJx$frv#x2MVQB2Uvv)f{QpFbyTm2bpUtLk_&V>8Gz-mi47@9B2Efr=I$FadGi`H*Va>jE|2)7{;zxrB30G#+fr` zaN@)X06->_hGB?rv_!kC1pr|fxVg9p&iUr#%D0AQNtL)*6Rrc$YY_4M?724Eh*eWg_AyuE<` ZGXQQYbmSt)}`24iUSU_=@f1Qn$Zz4XvS4?#64(L+S^B1B$0Hb9q}y!0ByiCp1=TZ3YEQ{JWmL1 z028TulCebwpc;5JkSusI^Mk!c3N<7;NsRnp|YsmRaeEF|5&cB+QjiW>pm=DV+;7uR-BbI}DB zfXs21fpyz}ho@81lmRWaIUZDQ>u5-AgB49zwOPPAnjB&kov9v5MOpCf?P>&g7PyF9 z1`eKr^Q=gj0VjJS>%3SGHN9;F5AdP9YZe!&=v#w5(+}pu5Qwr08ui%97PGJj7(RZoBl%cVDtVo72<*1fPmb6VZ1t*e)V7la3(UAN3HQUz)X6>SBZp3GHG7{Jv~ z&lM%C=WSRem(KHz{i?Tv%@lhD4=ryr%PrKCDfckcvpvVA={qX`tOBNW0kBp87u9K$ z#oD$SYPxi;2Q_83iG{e_oui(jn^#X(<3+Pw;{?|0!3$n9jMd7{0vu>|G+k!h&Er6W z;9?Fvd0X@^;Lhv3x; z3@hF`scX;}i$iCXje_jYk-XS*myWkq4xSF{8ZZvp2Sy_L;r9?eo7sb$}Yy%eWP^z0<$b4E#(Q= zvv+a>c4OBxeLW)eTV~G*kNEUZnST3I8Q^9*>6l@>+1h)cOrQJ`P@@M7q$I6W4=dk< zpfN6^N?;a`ZTA7B9ZjBCQUd)x2Ku}>th%;9o$W3aIAYK?$?{)pOo|B`f8%~;i^)dW z`ngg>JAMl2{exvX36*4GL`snggZEJB8OO+pUI0h<#7L-b2OzxwZjA?ncyvJ0$@7w~ zMrgqSedjEXS{sCA-(;gq&B)lMp!^+wJ*J^2?AO&Gd+dEW=YEcMm{t9Qigx#hwEqk| z1sHzL-?HIXGK3uqUIt*B@`g4^3QwFKmb4C`#B(jac)I9PD~DNUh7dXo@rZ!8w}r>5ar&cbc~cvks3@CDO%lq<^-PK{l?r5enM(cfwJ>fcc~X`M@Ds%HEW=yd zWohL&AZNc!VU<)$9@R2@27(_=X#1u>>i_}53l{?YZi7pY!#F-zbj6|qUc@hlZ)XxR zu85PyF<7F?B9WSPotgDaQaPy;Wq^rd6OaZfQ>HTZDh5_2xznh2J%|&`$$dKZ5FC?8 zmQtx`Kgze^Uu;9?@Ff?FsfH7H$FWL88&#-Z!XnY_J7Pt_A%I7%JX2;XJ(hJ+dCswW zC26qIKv4>yStO&>uS)ve<0AYj>5AR{$W90N^4L=L-Rl zQUJ&DC0@ZjPh;=*jPLSYvv5M~MF zBAl0-BNIsH15C~g000{K(ZT*WKal6<?_01!^k z@7iDG<<3=fuAC~28EsPoqkpK{9G%|Vj005J}`Hw&=0RYXHq~ibpyyzHQsFW8>#s~la zM4*8xut5h5!4#~(4xGUqyucR%VFpA%3?#rj5JCpzfE)^;7?wd9RKPme1hudO8lVxH z;SjXJF*pk6;1XPc>u?taU>Kgl7`%oF1VP9M6Ja4bh!J9r*dopd7nzO(B4J20l7OTj z>4+3jBE`sZqynizYLQ(?Bl0bB6giDtK>Co|$RIL`{EECsF_eL_Q3KQhbwIhO9~z3r zpmWi5G!I>XmZEFX8nhlgfVQHi(M#xcbO3#dj$?q)F%D*o*1Pf{>6$SWH+$s3q(pv=X`qR|$iJF~TPz zlc-O$C3+J1#CT#lv5;6stS0Uu9wDA3UMCI{Uz12A4#|?_P6{CkNG+sO zq(0IRX`DyT~9-sA|ffUF>wk++Z!kWZ5P$;0Hg6gtI-;!FvmBvPc55=u2?Kjj3a zpE5$3psG>Lsh-pbs)#zDT1jo7c2F-(3)vyY4>O^>2$gY z-Gd%Qm(Z8eYv>2*=jns=cMJ-K3WLW;VkjAF8G9M07`GWOnM|ey)0dgZR4~^v8<}UA z514ONSSt1^d=-((5|uiYR+WC0=c-gyb5%dpd8!Lkt5pxHURHgkMpd&=RhJ{9;hDf7SW4Fc`jUg7sGG*~tLe_Ft1M4hn zm`!3^via;xb_M$zb}xHOQ$usAW~^qBW}W77%>fR^vEcAI*_=wwAG2sV%zY%w@v@XU~7=xdm1xY6*0;iwVIXu6Ta zXrs|dqbIl~?uTdNHFy_3W~^@g_pF#!K2~{F^;Xxc zN!DEJEbDF7S8PxlSDOr*I-AS3sI8l=#CDr)-xT5$k15hA^;2%zG3@;83hbKf2JJca zVfH2VZT8O{%p4LO);n}Nd~$Sk%yw*Wyz8XlG{dRHsl(}4XB%gsbDi@w7p6;)%MzD% zmlsoQr;4X;pL)xc%+^yMd)ZNTI#eJ*$O)i@o$z8)e??LqN_gLa_ z%;TM>o2SC_kmoO6c3xRt`@J4dvz#WL)-Y|z+r(Soy~}%GIzByR`p)SCKE^%*pL(B% zzNWq+-#xw~e%5}Oeh2)X`#bu}{g3#+;d$~F@lFL`0l@*~0lk45fwKc^10MvL1f>Tx z1&sx}1}_Xg6+#RN3Rxd=lW)Km@*DYMGu&q^n$Z=?2%QyL8~QNJCQKgI5srq>2;UHX zZ>IT7>CCnWh~P(Th`1kV8JQRPeH1AwGO8}>QM6NZadh`A)~w`N`)9q5@sFvDxjWlx zwsLl7tZHmhY-8-3xPZ8-xPf?w_(k!T5_A(J3GIpG#Ms0=iQ{tu=WLoYoaCBRmULsT z<=mpV7v|~C%bs^USv6UZd^m-e5|^?+<%1wXP%juy<)>~<9TW0|n}ttBzM_qyQL(qU zN<5P0omQ3hINdvaL;7fjPeygdGYL;pD|wL_lDQ-EO;$wK-mK5raoH_7l$?~Dqf!cK zmb5F^Ft;eTPi8AClM3W{=55LwlZVRpxOiFd;3B_8yA~shQx|tGF!j;$toK>JuS&gYLDkTP@CvOP@r~sh zUu{a>bfJ1`^^VQ7&C1OKHDNXFTgC{M|V%fo{xK_dk6MK@9S!GZ*1JJ zzrV5xZBjOk9!NTH<(q(S+MDf~ceQX@Dh|Ry<-sT4rhI$jQ0Sq~!`#Eo-%($2E^vo}is5J@NVEf|KK?WT&2; zPCq@=ncR8zO#GQ^T~S@VXG71PKNocFOt)Y6$@AXlk6rM*aP%VgV%sIRORYVwJx6|U z{ozQjTW{-S_si{9Jg#)~P3t?+@6&(!YQWWV*Z9{iU7vZq@5byKw{9lg9JnRA_4s!7 z?H6|n?o8ZWdXIRo{Jz@#>IeD{>VLHUv1Pz*;P_y`V9&!@5AO~Mho1hF|I>%z(nrik z)gwkDjgOrl9~%l9z4Bzvli{bbrxVZ0epdf^>vOB;-~HnIOV3#R*zgPai_gEVd8zYq z@2jb=I>#f&AH2?aJ@Kaetz@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzAFaQAR zU;qF*m;eA5Z<1fdMgRZ^3Q0skRCwByms@NdM;XU|-^}dn<(&BVlHk~m<2Z3_Cuu_) z_nJ!uPAP?_whF2g;0oSQX{8DY^#Q>Hm3To&NG&Sj1w=tqLh3_Q+7be7sA!Znv`w3m zG|t6#;wE-{IX>s?IlDVN>~V5pQUN1<+L@ip|NCbC-+y-H>8GCtKt!0Eo8!`@ODrrb zP^naynVDgFdYV$HM7F(|( ziXuv-5I?0(g; zqeR$;Ga;fQGUYV~*FBR~d%d*MTih~zPv5nZU)y@&_**km6TiMXJNHVKWpn>4u=0%F zG%`H=-L6e{f5YqB*GX{@v=0u13|xx1gytE67lK!SU>&-Bw6u2Zu7}&!zj063xnsY% zeEIUvfOA0hnZV9DRfxhny1RS6UmX0x0o}6)u^l+q0FwMf0fg(I;s8<{8G-|2pmP+z zxW2P{P45#?@ksCT()_c|xf8A6Cd)EJ1VFTw;Zn!iXTrfRJ?8c8MU(~C$fLqF5m!)K zk55{j4oFZzI}AKXn+Xq?iPw}OdB!>SvC9i)Y;26#*;y`}Ki^}t_oUgd=doa5UlTL| zCpRy?vi9n>wD=-`OTh%Fjr$<2K9)=$y@GQ;8W(Qj`|7$xW@8ZmAp4D{Xb7U#sREm7=Xrad02?Xw&0a+IS=kLt7{mP~~!&dcD3q zRsO+nU~juEcA!;?F<^|Ko8U$Z#;h`}c;gSx@~0P`!WgbQB~7P{5j>NU1szn$D4jcyN3GC0 zH=`9Z=RaV1;Zu6H+|JGi9>I7D>j|C_JfkogLSLvP8E0o3U<0m&Bf(;&Hm*hb3S`4o zf{|$50NPWyG-ruiXKE{J^Qr)wZ@-T%JAc#8A3YHT`5GZPH zBUj7EN3>+aMhROoQ|JncZD{RqawBDARnn~J1%PsSePxVm&N1RpD6W=M-koYNS8+sv zA`^#%Ygk^4x{Q`BMk&=NHZ0jf5nKjJnqaG=CXdQV4k)=A)EXH{>S&~na@`RpFkf>_ zFQmjNM1i^?#a@w`ge9${&ls)OVti%8fHYoiRZf~3nLFSdjZ}ym87JTVGsj+jft`;& zL2=+N>IuZDqnbcH5mEtdgo15NZ6P%QiMGnqdabe6SR|)DsX}ngZF6YJy=yh!F8pG;k5eRu8@N`V3E2}-qSN{h;7Ht#c@wZ;#kn&GN*SuDl~&gI@| zB~%l~nYo0y<%A@K(?@>K)IVO%cR>Ve6gE(ZgG@OjQ=mZ!s}3nAM@ECtq|Oh5nu?;r ztd*qd8Wpss(MGTqW@E?kD+yCoN30Z?)fi8>>)Su3(AAArg7Jj%#M@jr{40E`@dLs4 z1>aZL|1g7<3MDVChEZWwwUyd0L^`WAstXv;V2xt70jCx-8cHZenjq8!p-wkMd6ycvtidB`tID_+`jys1C(0j;`qlyaeNn3bwgr=f?jnCwJzoIWOLFamRn(Oo@z=~i;g0x*N7I* zGP-;8g!O~>O`%X&+P3|+SO0nP)c)y-k2;n&?IM!KO*y>!2EHLIu9+w~n;al+wdgp+ zc%+l>GrWdtBin9!HH@Mq{rpYbZP0-LHSxoiV>)hMs7Wa>jKkr%lN;6QTTCLs?Nu@d~<)t4SdiC{h9b0x$ z+wKRkoogY>niAAwKqoZBpTX|R|rv(-y>x1`X2!zh!RBQzBQJsET8!h@6@~O8SI-M z|Kj-1l`%i9*Xwg4EreYPtdzp{eIMrzoc{RK_uf4I&d#&djK+pd`2Cyk+d44CA|}Y^ zBsECNW#Ywa#23%uO`c%FZbqd!69r8th`mao~*2Da9cWf@xQp(JS>oH%{v z(GO4m>yF8VW#&^yIfGg=;y{F=f_5!zC>7Ygb@;^K)}cQdG(=$pb>h(JR7qEz+ zlmb`}?5&oU?k_Ja?5I{MgY|m64!~OfN*F~G#Zu{HSX}cK@Fs9M{|d_2yA|-i2LM9x VTxG(maWVh^002ovPDHLkV1iHiO}YR8 literal 0 HcmV?d00001 diff --git a/Icons/info_gray.png b/Icons/info_gray.png new file mode 100644 index 0000000000000000000000000000000000000000..dd1842ddb756211f02fdbd081e9441f34a920221 GIT binary patch literal 4837 zcmVStO&>uS)ve<0AYj>5AR{$W90N^4L=L-Rl zQUJ&DC0@ZjPh;=*jPLSYvv5M~MF zBAl0-BNIsH15C~g000{K(ZT*WKal6<?_01!^k z@7iDG<<3=fuAC~28EsPoqkpK{9G%|Vj005J}`Hw&=0RYXHq~ibpyyzHQsFW8>#s~la zM4*8xut5h5!4#~(4xGUqyucR%VFpA%3?#rj5JCpzfE)^;7?wd9RKPme1hudO8lVxH z;SjXJF*pk6;1XPc>u?taU>Kgl7`%oF1VP9M6Ja4bh!J9r*dopd7nzO(B4J20l7OTj z>4+3jBE`sZqynizYLQ(?Bl0bB6giDtK>Co|$RIL`{EECsF_eL_Q3KQhbwIhO9~z3r zpmWi5G!I>XmZEFX8nhlgfVQHi(M#xcbO3#dj$?q)F%D*o*1Pf{>6$SWH+$s3q(pv=X`qR|$iJF~TPz zlc-O$C3+J1#CT#lv5;6stS0Uu9wDA3UMCI{Uz12A4#|?_P6{CkNG+sO zq(0IRX`DyT~9-sA|ffUF>wk++Z!kWZ5P$;0Hg6gtI-;!FvmBvPc55=u2?Kjj3a zpE5$3psG>Lsh-pbs)#zDT1jo7c2F-(3)vyY4>O^>2$gY z-Gd%Qm(Z8eYv>2*=jns=cMJ-K3WLW;VkjAF8G9M07`GWOnM|ey)0dgZR4~^v8<}UA z514ONSSt1^d=-((5|uiYR+WC0=c-gyb5%dpd8!Lkt5pxHURHgkMpd&=RhJ{9;hDf7SW4Fc`jUg7sGG*~tLe_Ft1M4hn zm`!3^via;xb_M$zb}xHOQ$usAW~^qBW}W77%>fR^vEcAI*_=wwAG2sV%zY%w@v@XU~7=xdm1xY6*0;iwVIXu6Ta zXrs|dqbIl~?uTdNHFy_3W~^@g_pF#!K2~{F^;Xxc zN!DEJEbDF7S8PxlSDOr*I-AS3sI8l=#CDr)-xT5$k15hA^;2%zG3@;83hbKf2JJca zVfH2VZT8O{%p4LO);n}Nd~$Sk%yw*Wyz8XlG{dRHsl(}4XB%gsbDi@w7p6;)%MzD% zmlsoQr;4X;pL)xc%+^yMd)ZNTI#eJ*$O)i@o$z8)e??LqN_gLa_ z%;TM>o2SC_kmoO6c3xRt`@J4dvz#WL)-Y|z+r(Soy~}%GIzByR`p)SCKE^%*pL(B% zzNWq+-#xw~e%5}Oeh2)X`#bu}{g3#+;d$~F@lFL`0l@*~0lk45fwKc^10MvL1f>Tx z1&sx}1}_Xg6+#RN3Rxd=lW)Km@*DYMGu&q^n$Z=?2%QyL8~QNJCQKgI5srq>2;UHX zZ>IT7>CCnWh~P(Th`1kV8JQRPeH1AwGO8}>QM6NZadh`A)~w`N`)9q5@sFvDxjWlx zwsLl7tZHmhY-8-3xPZ8-xPf?w_(k!T5_A(J3GIpG#Ms0=iQ{tu=WLoYoaCBRmULsT z<=mpV7v|~C%bs^USv6UZd^m-e5|^?+<%1wXP%juy<)>~<9TW0|n}ttBzM_qyQL(qU zN<5P0omQ3hINdvaL;7fjPeygdGYL;pD|wL_lDQ-EO;$wK-mK5raoH_7l$?~Dqf!cK zmb5F^Ft;eTPi8AClM3W{=55LwlZVRpxOiFd;3B_8yA~shQx|tGF!j;$toK>JuS&gYLDkTP@CvOP@r~sh zUu{a>bfJ1`^^VQ7&C1OKHDNXFTgC{M|V%fo{xK_dk6MK@9S!GZ*1JJ zzrV5xZBjOk9!NTH<(q(S+MDf~ceQX@Dh|Ry<-sT4rhI$jQ0Sq~!`#Eo-%($2E^vo}is5J@NVEf|KK?WT&2; zPCq@=ncR8zO#GQ^T~S@VXG71PKNocFOt)Y6$@AXlk6rM*aP%VgV%sIRORYVwJx6|U z{ozQjTW{-S_si{9Jg#)~P3t?+@6&(!YQWWV*Z9{iU7vZq@5byKw{9lg9JnRA_4s!7 z?H6|n?o8ZWdXIRo{Jz@#>IeD{>VLHUv1Pz*;P_y`V9&!@5AO~Mho1hF|I>%z(nrik z)gwkDjgOrl9~%l9z4Bzvli{bbrxVZ0epdf^>vOB;-~HnIOV3#R*zgPai_gEVd8zYq z@2jb=I>#f&AH2?aJ@Kaetz@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzAFaQAR zU;qF*m;eA5Z<1fdMgRZ^14%?dRCwByS6yse#TEX}nYnZS?5uZj?8M&SO>8!?O&~u& zv2oR8Wd)uJr355Y9xC-QQbmc{C)Dx?FIA;V@X)tb6_rS%wo)3Q)F6e3ho&ZgNdg#b zL2So3UVFX2_ujoTeYopCNT40*XlCx5neY70oJ*%qp9TOB5sJkk78VvzDwR;H)v&m@ zi23<>q*5saLC_{G*-M~q1Cxe9Te1-q0<9RB#b(r;vu(RlDwWXF(}V8rZg`%DR4Rqt zyLTg#$-o!`0FbytGsb|3sJpv+&+gs3AIar%g@OKo`?|WjvK<{AJAKc$0E23+7Ok$X zE`7E5)s5-TrazdSot;=%Shz$)Uz&B4+qByPYptQR&fIg)J&*0p<(@lozSLMd+7SLYbPfsC*Pf!o&966SUj(_F8;5;EQHAA z^ZB1YaP;U;9vK_UUPm!s_a3PaMa;8XX;d?)b6eux*7{$D0878rYo#Xw3=?l%>$yn?*Bf4$jZd zTb5-__Vx9Z`}_OBzVE|zT@^*q6MJ*HXU4|HVB0q0Sl?c&Er;K6y|os{F_cmm`~DcR z+3Yh>6g}a(uJU~!T&YwLhT)KH+s}@Sj&@|y8N_i6Vg@l1t?od~jF(?|884iE0mKZn zz9s7nW`;2aJ9eay&*wXY5YL8TI8>=rz(NRKSy?G$v)QBh{C>n*Cz}W$5+GvmZKzhO z+||KZ~R7z73pw|E%JvJgZemW#`$& z)LQ2q+uon+%Ym6&se(JU^`()K5sZwCYFPXX5b={QT)|LbnF^CLclFI=wAR?@vN(8_p!36^tqY=j%F$|hvgdhmeXf#l+ zl%chTYF({F1mE|elu9vkFAE_$l~U|FZYxr0!&l4za}rF%3>bqbYU12K&*8}@pTxw( zzfi7LQLa|7R$4=;w2GD06;!Gf2qB;>3qlA8A;E&-x-KlsVj)DQlv1j7iMDGC5OMMl zG(!YYgrMHQKmPW2ym96Xj4_!0Y#ROj10V)q015+U2`S}0;-jK7{agY)OlZ`P?EC(5)NIzPwF+1;mgobBLrRG& z?_a@RUVj~yl(3`)DXnB|S=&e{g(!*upze9zGIw-ze4({&tgV$Hg#a@nXap#i*8l>P zQjnH_v;>}h=4tfz_v7TrlOQ6TJ$n|Pe)=hn9WOvw3YJXFETsj@l8~0wnoHQWLcLxG zGdEJH)E6?HPG9qVzc@QPlezouyAg*Ws?{op2ufKX18C^P->p2|%;8qFgJ38zwSj5z znr*2kq{PjI1?d^%q>VMw(%&(!RMcU4k5(K@bK`PzVDZ%ZQI7S?Q{3vfB#dLFJC^fYu7Gxc6OrK zY~tIR`Hq`yqqY(Px0aXj;nWl!dho%2r_( zg+k#qA;j9mTW=u@LO8aw-Nd3LKuZX*z9y2f*f24}aU6tEgty*)8$yV+LZR@QQtEt5 zQBb{AEdl^DXUgUBuP8E zAOAypd;3dUOWke2EzL8{X7l-piHTElb8{Vs4#bg|32IeBS_OX4tlE8)Kfje*O9{CnqQG(^?~!%ORKBi*&jJ zZEbDa6s=S$SY2Jk%*+gCXJ^68ICA932L}!uc!h}G2!bHcTH`x`l~T}JLkKYtMbWd< z)6+lt91t{*~{niR|W!?)g000SaNLh0L01FcU z01FcV0GgZ_000V2X+uL$P-t&-Z*ypGa3D!TLm+T+Z)Rz1WdHzp+MQE(Sd;e_KHv9c z4^~3h@UfR{fdC>StO&>uS)ve<0AYj>5AR{$W90N^4L=L-Rl zQUJ&DC0@ZjPh;=*jPLSYvv5M~MF zBAl0-BNIsH15C~g000{K(ZT*WKal6<?_01!^k z@7iDG<<3=fuAC~28EsPoqkpK{9G%|Vj005J}`Hw&=0RYXHq~ibpyyzHQsFW8>#s~la zM4*8xut5h5!4#~(4xGUqyucR%VFpA%3?#rj5JCpzfE)^;7?wd9RKPme1hudO8lVxH z;SjXJF*pk6;1XPc>u?taU>Kgl7`%oF1VP9M6Ja4bh!J9r*dopd7nzO(B4J20l7OTj z>4+3jBE`sZqynizYLQ(?Bl0bB6giDtK>Co|$RIL`{EECsF_eL_Q3KQhbwIhO9~z3r zpmWi5G!I>XmZEFX8nhlgfVQHi(M#xcbO3#dj$?q)F%D*o*1Pf{>6$SWH+$s3q(pv=X`qR|$iJF~TPz zlc-O$C3+J1#CT#lv5;6stS0Uu9wDA3UMCI{Uz12A4#|?_P6{CkNG+sO zq(0IRX`DyT~9-sA|ffUF>wk++Z!kWZ5P$;0Hg6gtI-;!FvmBvPc55=u2?Kjj3a zpE5$3psG>Lsh-pbs)#zDT1jo7c2F-(3)vyY4>O^>2$gY z-Gd%Qm(Z8eYv>2*=jns=cMJ-K3WLW;VkjAF8G9M07`GWOnM|ey)0dgZR4~^v8<}UA z514ONSSt1^d=-((5|uiYR+WC0=c-gyb5%dpd8!Lkt5pxHURHgkMpd&=RhJ{9;hDf7SW4Fc`jUg7sGG*~tLe_Ft1M4hn zm`!3^via;xb_M$zb}xHOQ$usAW~^qBW}W77%>fR^vEcAI*_=wwAG2sV%zY%w@v@XU~7=xdm1xY6*0;iwVIXu6Ta zXrs|dqbIl~?uTdNHFy_3W~^@g_pF#!K2~{F^;Xxc zN!DEJEbDF7S8PxlSDOr*I-AS3sI8l=#CDr)-xT5$k15hA^;2%zG3@;83hbKf2JJca zVfH2VZT8O{%p4LO);n}Nd~$Sk%yw*Wyz8XlG{dRHsl(}4XB%gsbDi@w7p6;)%MzD% zmlsoQr;4X;pL)xc%+^yMd)ZNTI#eJ*$O)i@o$z8)e??LqN_gLa_ z%;TM>o2SC_kmoO6c3xRt`@J4dvz#WL)-Y|z+r(Soy~}%GIzByR`p)SCKE^%*pL(B% zzNWq+-#xw~e%5}Oeh2)X`#bu}{g3#+;d$~F@lFL`0l@*~0lk45fwKc^10MvL1f>Tx z1&sx}1}_Xg6+#RN3Rxd=lW)Km@*DYMGu&q^n$Z=?2%QyL8~QNJCQKgI5srq>2;UHX zZ>IT7>CCnWh~P(Th`1kV8JQRPeH1AwGO8}>QM6NZadh`A)~w`N`)9q5@sFvDxjWlx zwsLl7tZHmhY-8-3xPZ8-xPf?w_(k!T5_A(J3GIpG#Ms0=iQ{tu=WLoYoaCBRmULsT z<=mpV7v|~C%bs^USv6UZd^m-e5|^?+<%1wXP%juy<)>~<9TW0|n}ttBzM_qyQL(qU zN<5P0omQ3hINdvaL;7fjPeygdGYL;pD|wL_lDQ-EO;$wK-mK5raoH_7l$?~Dqf!cK zmb5F^Ft;eTPi8AClM3W{=55LwlZVRpxOiFd;3B_8yA~shQx|tGF!j;$toK>JuS&gYLDkTP@CvOP@r~sh zUu{a>bfJ1`^^VQ7&C1OKHDNXFTgC{M|V%fo{xK_dk6MK@9S!GZ*1JJ zzrV5xZBjOk9!NTH<(q(S+MDf~ceQX@Dh|Ry<-sT4rhI$jQ0Sq~!`#Eo-%($2E^vo}is5J@NVEf|KK?WT&2; zPCq@=ncR8zO#GQ^T~S@VXG71PKNocFOt)Y6$@AXlk6rM*aP%VgV%sIRORYVwJx6|U z{ozQjTW{-S_si{9Jg#)~P3t?+@6&(!YQWWV*Z9{iU7vZq@5byKw{9lg9JnRA_4s!7 z?H6|n?o8ZWdXIRo{Jz@#>IeD{>VLHUv1Pz*;P_y`V9&!@5AO~Mho1hF|I>%z(nrik z)gwkDjgOrl9~%l9z4Bzvli{bbrxVZ0epdf^>vOB;-~HnIOV3#R*zgPai_gEVd8zYq z@2jb=I>#f&AH2?aJ@Kaetz@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzAFaQAR zU;qF*m;eA5Z<1fdMgRZ``AI}URCwB~SX*oy)fxW&bIx4s^?JP*U)FYf2{DQ7I3y0W z(U~I?1 zxj9bOacr-5*B;MaW=paBp7 zH~;9IOmet{KctcfH)oN8$R|+AT8Dl{r z@<=I{Y}=m8WHM8!ROWi_iol?s3aKmY;AO+$q(b1GSfBwyAH2SYgmo5r=Jf7(fKKNkyw!!V#v7;uPPB*o+wH>IeY1*&UZD{7T z8$g=BXx$<(vJ_k~PbQ_E?ZHw$AJI z9;~SAdR#PYB3`q`T}uK)j;N>rq+^)wqaNG{Keypl*Hj@Y*S z#jCHrI`_5U4jecTNTpJ}s;d4%Yv_GMZQce}QJ3F+InCWdTF!GxCkfcb3{qF#MRNMn zzo$~E=T%kx^ytx}^EU-|=+GfgB9Z8{ZTlIue*F*C*89QqK#~2BBuL8Zl=3nv#_7Ju z63|2hDJ6&i+l(T4@g1aQJ{w?+J?r&)$DVucxutA(QL^WD#@N%`ziPkUx*gmT$V)*M ziie6HB??Xkiq(CC>hp6kPXK7$4zi5>R_y#7fad{xneEE54~GvQZni9I4^-d76)QHA z@YaJd0^^kbFGsBO8D)3`k}J0M2=fVHg{=<_fCn3V=$?n_Q^nTpPLamv(kcegi}fzi_Zk03!xK zf?V%2F=xRPe$4B4s&&T6jhyoq02kQ6z(Bw-jNX(K>np=u;EaKBfOA%$T863dQ#l^v zEJwr{7%^9!&iBZ<&tRoZ2u4r@gUFhMU{E*%=MtO~bd_*ILo60sD}2pC%^wC6a2JLP(g8U1`VqYS=ieY2IS0;h12N_hXN1WwPvEuZ ze}!|O{})UFghJqoYiq)pQxm}KvW?MeX>dW{f{?6eKwN1I#$vIxs;V|HUDxXh!)Vik zD{=X zAUHu)2-Aj*p~*B-08}MEez~FvhGDenx?V37MQJciv$3kC0i4q#0ND`QzzJ#}q{tj(Do6!HzkD+-(7{8vz=u8Gu0-DN-5{Gm} zJl3lkuumJ}_QR zX70%y+kaZ@o)jIHWobf)Dxs<>an6&{N@`rybAC-0 zD40OtK7-1MJ8v?I$A_k^kE3?&_M+HJ z1W?8V=RB#ZDhVM(O4s#eD;d)iU3dEuSk?i%lP_n0SW*H~y7uI_X3ZBu%eE&F>fVxb zyi9SzlPpY42;ho}@b~th>HCj>D_U6{@l*o3t}hEAQbGt3^Lo9D>G*7oC(uw7sRRK_ zX<$5>K`bR<=e7qhp<>0BN6@rsuX9>Kju?r+8G(rM2LwRy&OWs7`VlJp^<`3(d{|MU z^YD7Ti$aK)P!we*7!1Z^3)5hHZEmNG0cJ*GBx)g=luo>5&bPXCTX4sHPeQ8+m6Qtv zTLN5=<4yonHMHT52cAMr+Zr&U0_&o(xv64IBNz^Jh+EQLC!Ze&6G0+IT-0V~_+F+%4-Z zh}aaG);7gC=Tm}+COSGgBBxG&v24y?t?-1J000*X8-@gQ%@INOV+RnvYimv$5>#AD zxEV5mp|STKbUktqLa)r#5JYbJbVK@3px)?JRHtT_J36*Sh-gAIHa1QwigL2Kp?2fK zh0zvYT{EVWHs&or*Im1jK+E0t+^wJiBNq2ZVi#afMmD zOw2(>#_aCx{R^D)Pjbm-AP{)3x3~B0v9YoGt0P18sosa6@*7Lia%C#Y6k3w<(&0BN z%nIvS0I74Q&{bc3y|=gbZJ*EgUSSH61Tfgw*LTgjde*e3#-Jz!Q9z1Ix8f-ZL8v$O zD;*=;epw!-Mp1q3tl8JscM8Cuizi=w`Fy^?&d$!4B9X{1|2_O(BLxEBp)hW$*z8Ft ztE5{rS&$|}!kUdBJ^Vg)tm~TZ?CgBW#Ie4 z>G&J4qu26@q+2aH#N2Seb zqQALzao4V0$E&KUp4D~z*f+jq%49NIq?A8DcI?=`6Q2)Pm@7Jjcf%$Kf9O_;RauM6 z?k63cMdI{F&@X?L*>YFU@{S!lUL&Fxgb*kGpUcCQnM~&CiHV7WLqkK}FRsq0T1Pik zuIYgmZZ7ML%cZx;$P|n-!$^KLBG)z6rTY8(6RTFOIwFMl6M*yI>SoijtVaPnF)}i; zZ+LiEj9$3NO>cl{&8^THnxF*hAgX;}nhrZ@A`_1xJvW2o^c5thEh) zrn|fQH2^Pj&j0qE-3bGzuqg000SaNLh0L01FcU z01FcV0GgZ_000V2X+uL$P-t&-Z*ypGa3D!TLm+T+Z)Rz1WdHzp+MQE(Sd;e_KHv9c z4^~3h@UfR{fdC>StO&>uS)ve<0AYj>5AR{$W90N^4L=L-Rl zQUJ&DC0@ZjPh;=*jPLSYvv5M~MF zBAl0-BNIsH15C~g000{K(ZT*WKal6<?_01!^k z@7iDG<<3=fuAC~28EsPoqkpK{9G%|Vj005J}`Hw&=0RYXHq~ibpyyzHQsFW8>#s~la zM4*8xut5h5!4#~(4xGUqyucR%VFpA%3?#rj5JCpzfE)^;7?wd9RKPme1hudO8lVxH z;SjXJF*pk6;1XPc>u?taU>Kgl7`%oF1VP9M6Ja4bh!J9r*dopd7nzO(B4J20l7OTj z>4+3jBE`sZqynizYLQ(?Bl0bB6giDtK>Co|$RIL`{EECsF_eL_Q3KQhbwIhO9~z3r zpmWi5G!I>XmZEFX8nhlgfVQHi(M#xcbO3#dj$?q)F%D*o*1Pf{>6$SWH+$s3q(pv=X`qR|$iJF~TPz zlc-O$C3+J1#CT#lv5;6stS0Uu9wDA3UMCI{Uz12A4#|?_P6{CkNG+sO zq(0IRX`DyT~9-sA|ffUF>wk++Z!kWZ5P$;0Hg6gtI-;!FvmBvPc55=u2?Kjj3a zpE5$3psG>Lsh-pbs)#zDT1jo7c2F-(3)vyY4>O^>2$gY z-Gd%Qm(Z8eYv>2*=jns=cMJ-K3WLW;VkjAF8G9M07`GWOnM|ey)0dgZR4~^v8<}UA z514ONSSt1^d=-((5|uiYR+WC0=c-gyb5%dpd8!Lkt5pxHURHgkMpd&=RhJ{9;hDf7SW4Fc`jUg7sGG*~tLe_Ft1M4hn zm`!3^via;xb_M$zb}xHOQ$usAW~^qBW}W77%>fR^vEcAI*_=wwAG2sV%zY%w@v@XU~7=xdm1xY6*0;iwVIXu6Ta zXrs|dqbIl~?uTdNHFy_3W~^@g_pF#!K2~{F^;Xxc zN!DEJEbDF7S8PxlSDOr*I-AS3sI8l=#CDr)-xT5$k15hA^;2%zG3@;83hbKf2JJca zVfH2VZT8O{%p4LO);n}Nd~$Sk%yw*Wyz8XlG{dRHsl(}4XB%gsbDi@w7p6;)%MzD% zmlsoQr;4X;pL)xc%+^yMd)ZNTI#eJ*$O)i@o$z8)e??LqN_gLa_ z%;TM>o2SC_kmoO6c3xRt`@J4dvz#WL)-Y|z+r(Soy~}%GIzByR`p)SCKE^%*pL(B% zzNWq+-#xw~e%5}Oeh2)X`#bu}{g3#+;d$~F@lFL`0l@*~0lk45fwKc^10MvL1f>Tx z1&sx}1}_Xg6+#RN3Rxd=lW)Km@*DYMGu&q^n$Z=?2%QyL8~QNJCQKgI5srq>2;UHX zZ>IT7>CCnWh~P(Th`1kV8JQRPeH1AwGO8}>QM6NZadh`A)~w`N`)9q5@sFvDxjWlx zwsLl7tZHmhY-8-3xPZ8-xPf?w_(k!T5_A(J3GIpG#Ms0=iQ{tu=WLoYoaCBRmULsT z<=mpV7v|~C%bs^USv6UZd^m-e5|^?+<%1wXP%juy<)>~<9TW0|n}ttBzM_qyQL(qU zN<5P0omQ3hINdvaL;7fjPeygdGYL;pD|wL_lDQ-EO;$wK-mK5raoH_7l$?~Dqf!cK zmb5F^Ft;eTPi8AClM3W{=55LwlZVRpxOiFd;3B_8yA~shQx|tGF!j;$toK>JuS&gYLDkTP@CvOP@r~sh zUu{a>bfJ1`^^VQ7&C1OKHDNXFTgC{M|V%fo{xK_dk6MK@9S!GZ*1JJ zzrV5xZBjOk9!NTH<(q(S+MDf~ceQX@Dh|Ry<-sT4rhI$jQ0Sq~!`#Eo-%($2E^vo}is5J@NVEf|KK?WT&2; zPCq@=ncR8zO#GQ^T~S@VXG71PKNocFOt)Y6$@AXlk6rM*aP%VgV%sIRORYVwJx6|U z{ozQjTW{-S_si{9Jg#)~P3t?+@6&(!YQWWV*Z9{iU7vZq@5byKw{9lg9JnRA_4s!7 z?H6|n?o8ZWdXIRo{Jz@#>IeD{>VLHUv1Pz*;P_y`V9&!@5AO~Mho1hF|I>%z(nrik z)gwkDjgOrl9~%l9z4Bzvli{bbrxVZ0epdf^>vOB;-~HnIOV3#R*zgPai_gEVd8zYq z@2jb=I>#f&AH2?aJ@Kaetz@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzAFaQAR zU;qF*m;eA5Z<1fdMgRZ{AW1|)RCwB~SY1q8M;88O=KA_lW56~x*m2BH3yC2tKT!#x z`J?&UR85q&iJFIPvr?lzv=7_us(q+7E2@2JE3I0oU1`&-RB5}?W?6M3wOSgn3QF6M zfYb_v5E4iTu?P?Ywyy!>pX)pOaIY^m3Qf{>V07pDo|*H_IcMg4GlX-Fhb@E<34jH_ zBLE}-W&i>J1|SMR0gwO?2M`0W$T^Qcw4MhAM+l(>1qDTtB-wmE-#WM3-I$-BzfKgz zNQM_zu%Ea zB#LWlYJO?6*|roril6ZLd~T1&1E3f}tqdf19=_^~A%4rAc*0Q&p;CnhH+|1~~7e$r$z z-RbV`jyy29XPnP3p#eESM6UAlBSnM{5pisJuHo;(>^72F$dykVK2 zpZBY(`euE7{oyCuo`lVAgMkHE(_c1J4sfg%!iLPUa3mDMSKVhZFfhnvX0cc*QmNGLhWZB2`t|FyI3WZeREudsbSsgZHuScpEL#paGGs-+ zY_QeU)u^nf^rTX$-4=_bqNAgO8Q^4D_Q|sRw9Dn%*3j4pfP(5Bsa`<{D50Rb(oCD` zZ3-aO`_Qbq3|gzpV-o^U#;~}!2=7`itXAtbS(cxcW!YzdV~qJ?vDikx-!D2G4t<81 z83WJeWhBdVm2x@#MpoD>dV{Ud1R;v|WuUCx4VjCG_8n}**4tp#X zYZ3&Z!M}dJVJS+9K0^vvUteF=jK5#At=r!}fcR2e3kgsVP+-M`C?Q}1LqwJlTZ(}( z2Jc!g05rs6v8IlW4m%Y^u~e4j3f?tdhugEpu-eMN{`lm_IR1y@7#q8}3czKHobNf0 z*MIjq&Ye34LIFw%7)6dO69mL!F$9A_Fh;=`g~RTE-EMctvb;eQ#ZoFsQb{ZpEBCJT z=EOp-Yc;SpZ{Ec3j~~Z}AAJZ}mUCi~{ z6B83qRTYd0pp=3#2B*t~SS(g9Nm2C~yzr|R(6V`RmJHYb z^*@#4oAc*!v9A|fw`|4s9ou0xn~jB%U2HZRlF4MTD2jG!Hk)mVqF9Rx3N^P-s#`!0 zWNNmu7Ofjs9c4bRsqhTat?5g@`?%^Ir2QbUN3t4`n2is zY?{B^E-Wa({sRZl+S+Q6)C`MAB$Hr_B}7pqf*=S3DvqP zih@KU0YZpIgSa-B-EPOhg9q{W^oWU9B%NZp601JhLnp3WeZsIHD$# zDJU?;Cf2N36AAL}g{=^1hO-K<8(?AWmbln^bpC;`!fj6-A3T5scYgz4#Nl$Di58DkRyA>>9?Rn^qx%a@lXr|#r= z)@XDp7K<6XHwbX_=uvELY0)B*Py-kzD;O~dT3cIj^ysgV_sAon++w0x9aU+!^2}}^~$&M%x!XXxx#XAusEbtGL7Ca-HI75 zmPz6nxeOJeIquH5mLeR9;OyD6a5|l#ojZ4a!5BM*6{k$2NRo7$5c0{MJ$o*Qq8RP$ z>_jklS5wF|02$tu8*jQBss5hrR=O;sxmf!>7!0DbvlF5yM)&O5bAb@@i6lw4?|WAg zkH^~<78c&@>gw7O3 zZG)h2#o9T4=830FyhKBYJ4h{V^a8m4 cuuA?v0Mu1fHv&{rpa1{>07*qoM6N<$f+K~Q*Z=?k literal 0 HcmV?d00001 diff --git a/Icons/pause_blue.png b/Icons/pause_blue.png new file mode 100644 index 0000000000000000000000000000000000000000..d7910048d5b12094898073ab4b0c2b9fa3d1fc01 GIT binary patch literal 5337 zcmV;~6ejD5P)g000SaNLh0L01FcU z01FcV0GgZ_000V2X+uL$P-t&-Z*ypGa3D!TLm+T+Z)Rz1WdHzp+MQE(Sd;e_KHv9c z4^~3h@UfR{fdC>StO&>uS)ve<0AYj>5AR{$W90N^4L=L-Rl zQUJ&DC0@ZjPh;=*jPLSYvv5M~MF zBAl0-BNIsH15C~g000{K(ZT*WKal6<?_01!^k z@7iDG<<3=fuAC~28EsPoqkpK{9G%|Vj005J}`Hw&=0RYXHq~ibpyyzHQsFW8>#s~la zM4*8xut5h5!4#~(4xGUqyucR%VFpA%3?#rj5JCpzfE)^;7?wd9RKPme1hudO8lVxH z;SjXJF*pk6;1XPc>u?taU>Kgl7`%oF1VP9M6Ja4bh!J9r*dopd7nzO(B4J20l7OTj z>4+3jBE`sZqynizYLQ(?Bl0bB6giDtK>Co|$RIL`{EECsF_eL_Q3KQhbwIhO9~z3r zpmWi5G!I>XmZEFX8nhlgfVQHi(M#xcbO3#dj$?q)F%D*o*1Pf{>6$SWH+$s3q(pv=X`qR|$iJF~TPz zlc-O$C3+J1#CT#lv5;6stS0Uu9wDA3UMCI{Uz12A4#|?_P6{CkNG+sO zq(0IRX`DyT~9-sA|ffUF>wk++Z!kWZ5P$;0Hg6gtI-;!FvmBvPc55=u2?Kjj3a zpE5$3psG>Lsh-pbs)#zDT1jo7c2F-(3)vyY4>O^>2$gY z-Gd%Qm(Z8eYv>2*=jns=cMJ-K3WLW;VkjAF8G9M07`GWOnM|ey)0dgZR4~^v8<}UA z514ONSSt1^d=-((5|uiYR+WC0=c-gyb5%dpd8!Lkt5pxHURHgkMpd&=RhJ{9;hDf7SW4Fc`jUg7sGG*~tLe_Ft1M4hn zm`!3^via;xb_M$zb}xHOQ$usAW~^qBW}W77%>fR^vEcAI*_=wwAG2sV%zY%w@v@XU~7=xdm1xY6*0;iwVIXu6Ta zXrs|dqbIl~?uTdNHFy_3W~^@g_pF#!K2~{F^;Xxc zN!DEJEbDF7S8PxlSDOr*I-AS3sI8l=#CDr)-xT5$k15hA^;2%zG3@;83hbKf2JJca zVfH2VZT8O{%p4LO);n}Nd~$Sk%yw*Wyz8XlG{dRHsl(}4XB%gsbDi@w7p6;)%MzD% zmlsoQr;4X;pL)xc%+^yMd)ZNTI#eJ*$O)i@o$z8)e??LqN_gLa_ z%;TM>o2SC_kmoO6c3xRt`@J4dvz#WL)-Y|z+r(Soy~}%GIzByR`p)SCKE^%*pL(B% zzNWq+-#xw~e%5}Oeh2)X`#bu}{g3#+;d$~F@lFL`0l@*~0lk45fwKc^10MvL1f>Tx z1&sx}1}_Xg6+#RN3Rxd=lW)Km@*DYMGu&q^n$Z=?2%QyL8~QNJCQKgI5srq>2;UHX zZ>IT7>CCnWh~P(Th`1kV8JQRPeH1AwGO8}>QM6NZadh`A)~w`N`)9q5@sFvDxjWlx zwsLl7tZHmhY-8-3xPZ8-xPf?w_(k!T5_A(J3GIpG#Ms0=iQ{tu=WLoYoaCBRmULsT z<=mpV7v|~C%bs^USv6UZd^m-e5|^?+<%1wXP%juy<)>~<9TW0|n}ttBzM_qyQL(qU zN<5P0omQ3hINdvaL;7fjPeygdGYL;pD|wL_lDQ-EO;$wK-mK5raoH_7l$?~Dqf!cK zmb5F^Ft;eTPi8AClM3W{=55LwlZVRpxOiFd;3B_8yA~shQx|tGF!j;$toK>JuS&gYLDkTP@CvOP@r~sh zUu{a>bfJ1`^^VQ7&C1OKHDNXFTgC{M|V%fo{xK_dk6MK@9S!GZ*1JJ zzrV5xZBjOk9!NTH<(q(S+MDf~ceQX@Dh|Ry<-sT4rhI$jQ0Sq~!`#Eo-%($2E^vo}is5J@NVEf|KK?WT&2; zPCq@=ncR8zO#GQ^T~S@VXG71PKNocFOt)Y6$@AXlk6rM*aP%VgV%sIRORYVwJx6|U z{ozQjTW{-S_si{9Jg#)~P3t?+@6&(!YQWWV*Z9{iU7vZq@5byKw{9lg9JnRA_4s!7 z?H6|n?o8ZWdXIRo{Jz@#>IeD{>VLHUv1Pz*;P_y`V9&!@5AO~Mho1hF|I>%z(nrik z)gwkDjgOrl9~%l9z4Bzvli{bbrxVZ0epdf^>vOB;-~HnIOV3#R*zgPai_gEVd8zYq z@2jb=I>#f&AH2?aJ@Kaetz@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzAFaQAR zU;qF*m;eA5Z<1fdMgRZ__en%SRCwB~SWR#o#TEWu|IEy4wUTyMe=BVy+p(}E*~XTu zY|0Q~m18GRKoZKSBwTTENDeu{B{}$z6I_x5IZ#d&7eXizk}60DQL0pcfyn$gph$|1 zuq|2E%Ce-@>`J5A*_r7acJ@~*8waMUYkPX%y#D&V*WY{Hq?E$lK15^y2m@#UU;xko z2ml;_2fzi817HKN0Bk6w?7N=l%Yq{!*3{J0Vi-oWr>AF6B9S=M*x0y7)3jYeh$Ley zPDEj))Q0c-E3WI#JC1W@eSQ5>DwVo8H#c|5w(WE#lUY+r`Cl8j{{H@WE|+T^7#R3o zG#Y&%6luMmM|u+!?gor@kP!#T2*7o~%R%L{Q1%L7FF|eGfR~+3ZDyC>OQ+N4r>3U< zuIu{p^z`(~R|0qJ*s;*Y#ztpvZ|})yH2Sa++w~BS4rr`p52&FNPyh%Z03|h4sUaA& z7U8X3hL@gl?A0r8rqk)a&Cbq_hQr~-_uqei^RB@P4-dEG^ZD)_J9eCDXz4yJ+Ycpq z+aZu1t(vzAjH(4!J*IMLc(*Phf9vABmA>)nwQJYTNhxoPjg75+X>gA}{&<`*b|4ao zJQZpm__64`k9f=8U@ip^6--4HAPa#RC@rH>1du8sR8RoCwM+08$JOT2b* z8qh=pr4)z&-%cZU?VoU#{yoANdo~h@Oh5PBa~nl*QM2ZqjIk$qboXha_c(YsRor!}N1ZVOO7E!pPiyKxsOK0ty!kQD^Bz8X_H42W+{nlX4~N4$^ZEQq zJ#nZ@Z{G{f37n%aS)hyujoqQ~8t~wNU;we=e-%0fAY1ohrD1Q<&WZ>SjA3ET#dYlf!q&`# z&8GQ?X`1r@t_lF)ocCCkby!ax(zHknR1@A5Kve)<{`C`eF+K6CmxFI=WGdqAr@#CI zd;%CT016ba&&-MkTST#H+@rNy7Y=jIdjMQzBO@a*%d&oiSspJ-0T^=P6Z6jcRTpej|>b17qGa$zMxR#lsu@uCibAmEneW9nueTog7+j&~v> zyW*y4?n@?l?k3mFd| z&E??$&?J@gZ-%;IS)c7N45LFxDLZZ3?rLo5tO2)O=~QnJ;G%~6sF=pesX_{Z>j9T; zd-jiuK0H#zSllltq zeZW@=U#xhzo^fGrDhNS!H@w%-3TMe_)if<8bX||St{c%Bn+q|qHJYlR)`C+iU=LQ1 zT3Yw8>G<#!pp=5A08atFB1|v4AOdtr+fWe!tO>5`Ms!_|3L!+J=Xts`Lbr1!6aZFX z70)j;*H`cr;iFU@jtAsCg-x$$xoT1j8MK8iw?w!!;CY@dglH6+rV-~nr@WlbHKPPY zRXCVH;0&0L_8kPNGX>D=X}1qyF0TmGZ(m{keG9x!ldcL0?=Tv@+52< zcLda+Sdg-|k`RPscVbZpa~|FMx-*>fc}7GteSLi?WN&TSs|y8}5OB@%VJX1S8KlM_ zHG98Uxn}Qu0zhWtF)#kSXdZ^ef*9awCN%XL+-)uP;SJGoq`jYfegeA=%k> zcw9$*;3$}5Jvt<#5)EMgF`2KJHR9gv^)cZmIvERN53PAWZGWE9s zpt37ascC=k_|Y}a`NySVGZu@zGc+{x*7Wpr$HL@zhcomLG`{snTJM;OItML9W$WDJKD&|A&T&F@s6A#wmlj~qF2(_6S~`}5O~k{~LY4BG9+q$CJ! zt6c3jB9JSNVSWltH!s^qjvToOU^Ku}K7BPeH;?xB_rH`%rGD{`iFdjv76Wfh)X#s# zq)OPvNw;|vp~Tiu@Rn1^PrQra0|Tr5{rxY6!{O1oM?=o}D<@8z_@-%^r$72|G}id7 zN5EU+^}$tvp*oDU3Q$F*9pbI6!v1g+N0af@6DLl*!5Dj`w&W;1hGEPS(Tk@}o%-Nl zlgMnG|113T%|f{@g435k&{*&rjB%9ZierKm8mDq!61W8X^ddISzk!2IB6I50sSk+g zMZ+*=?|4^Y+xGDK`ua1YqoWUu&o4DbjvPnmo_z&R(l#!v*d3KeBNXpVs9Z+amnV?D z@HUPn+tyE>JbAvcvGG~MFvh<0EtBiI_ba7-Ha0f)=zE_|gzRthiO8Y*Afm0e;rIFx zS6oj%y^QR|f5Eu^xqJV;`!|P&hhHb6-w7e!`+qJEce$?nQ{&^~kRo1cY|UG)cc?(p{S z-|r3%4!#cHkDT*Ae{FZd079PUJxWC1U0GRq=*pEVt#fm8luD)8^71leG8wXM8-`(^ zsi{e|wzjH7BH{P+^r&6Cb}h%_@i&!HZ*k6F2eA3IURc*WdjK2-aIaFTAHYrk?EoSG rvH+Fg000SaNLh0L01FcU z01FcV0GgZ_000V2X+uL$P-t&-Z*ypGa3D!TLm+T+Z)Rz1WdHzp+MQE(Sd;e_KHv9c z4^~3h@UfR{fdC>StO&>uS)ve<0AYj>5AR{$W90N^4L=L-Rl zQUJ&DC0@ZjPh;=*jPLSYvv5M~MF zBAl0-BNIsH15C~g000{K(ZT*WKal6<?_01!^k z@7iDG<<3=fuAC~28EsPoqkpK{9G%|Vj005J}`Hw&=0RYXHq~ibpyyzHQsFW8>#s~la zM4*8xut5h5!4#~(4xGUqyucR%VFpA%3?#rj5JCpzfE)^;7?wd9RKPme1hudO8lVxH z;SjXJF*pk6;1XPc>u?taU>Kgl7`%oF1VP9M6Ja4bh!J9r*dopd7nzO(B4J20l7OTj z>4+3jBE`sZqynizYLQ(?Bl0bB6giDtK>Co|$RIL`{EECsF_eL_Q3KQhbwIhO9~z3r zpmWi5G!I>XmZEFX8nhlgfVQHi(M#xcbO3#dj$?q)F%D*o*1Pf{>6$SWH+$s3q(pv=X`qR|$iJF~TPz zlc-O$C3+J1#CT#lv5;6stS0Uu9wDA3UMCI{Uz12A4#|?_P6{CkNG+sO zq(0IRX`DyT~9-sA|ffUF>wk++Z!kWZ5P$;0Hg6gtI-;!FvmBvPc55=u2?Kjj3a zpE5$3psG>Lsh-pbs)#zDT1jo7c2F-(3)vyY4>O^>2$gY z-Gd%Qm(Z8eYv>2*=jns=cMJ-K3WLW;VkjAF8G9M07`GWOnM|ey)0dgZR4~^v8<}UA z514ONSSt1^d=-((5|uiYR+WC0=c-gyb5%dpd8!Lkt5pxHURHgkMpd&=RhJ{9;hDf7SW4Fc`jUg7sGG*~tLe_Ft1M4hn zm`!3^via;xb_M$zb}xHOQ$usAW~^qBW}W77%>fR^vEcAI*_=wwAG2sV%zY%w@v@XU~7=xdm1xY6*0;iwVIXu6Ta zXrs|dqbIl~?uTdNHFy_3W~^@g_pF#!K2~{F^;Xxc zN!DEJEbDF7S8PxlSDOr*I-AS3sI8l=#CDr)-xT5$k15hA^;2%zG3@;83hbKf2JJca zVfH2VZT8O{%p4LO);n}Nd~$Sk%yw*Wyz8XlG{dRHsl(}4XB%gsbDi@w7p6;)%MzD% zmlsoQr;4X;pL)xc%+^yMd)ZNTI#eJ*$O)i@o$z8)e??LqN_gLa_ z%;TM>o2SC_kmoO6c3xRt`@J4dvz#WL)-Y|z+r(Soy~}%GIzByR`p)SCKE^%*pL(B% zzNWq+-#xw~e%5}Oeh2)X`#bu}{g3#+;d$~F@lFL`0l@*~0lk45fwKc^10MvL1f>Tx z1&sx}1}_Xg6+#RN3Rxd=lW)Km@*DYMGu&q^n$Z=?2%QyL8~QNJCQKgI5srq>2;UHX zZ>IT7>CCnWh~P(Th`1kV8JQRPeH1AwGO8}>QM6NZadh`A)~w`N`)9q5@sFvDxjWlx zwsLl7tZHmhY-8-3xPZ8-xPf?w_(k!T5_A(J3GIpG#Ms0=iQ{tu=WLoYoaCBRmULsT z<=mpV7v|~C%bs^USv6UZd^m-e5|^?+<%1wXP%juy<)>~<9TW0|n}ttBzM_qyQL(qU zN<5P0omQ3hINdvaL;7fjPeygdGYL;pD|wL_lDQ-EO;$wK-mK5raoH_7l$?~Dqf!cK zmb5F^Ft;eTPi8AClM3W{=55LwlZVRpxOiFd;3B_8yA~shQx|tGF!j;$toK>JuS&gYLDkTP@CvOP@r~sh zUu{a>bfJ1`^^VQ7&C1OKHDNXFTgC{M|V%fo{xK_dk6MK@9S!GZ*1JJ zzrV5xZBjOk9!NTH<(q(S+MDf~ceQX@Dh|Ry<-sT4rhI$jQ0Sq~!`#Eo-%($2E^vo}is5J@NVEf|KK?WT&2; zPCq@=ncR8zO#GQ^T~S@VXG71PKNocFOt)Y6$@AXlk6rM*aP%VgV%sIRORYVwJx6|U z{ozQjTW{-S_si{9Jg#)~P3t?+@6&(!YQWWV*Z9{iU7vZq@5byKw{9lg9JnRA_4s!7 z?H6|n?o8ZWdXIRo{Jz@#>IeD{>VLHUv1Pz*;P_y`V9&!@5AO~Mho1hF|I>%z(nrik z)gwkDjgOrl9~%l9z4Bzvli{bbrxVZ0epdf^>vOB;-~HnIOV3#R*zgPai_gEVd8zYq z@2jb=I>#f&AH2?aJ@Kaetz@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzAFaQAR zU;qF*m;eA5Z<1fdMgRZ`0!c(cRCwB~SW9dh#~J?S!R4wHCGjoNG%YEXZAn%w$$+dn zu>)DK+XQit1_4?i#~41eho0QC&%LLIzy)%#+dxHHAVJkYsD-@jC_v&kvg}wAWSNjf ziQ;Q1iH{|@)5AWvltn+1%yPil-G64j`Ty_#=iebh2t02ggvbC~0Db{L2H*t10WbhH z0962G03`qg06Rj6(sR%Atl$VCw5_eJLzZPvEEYQ)4u^+ZTU!rHlGMXFk5Wo~gb3tDqxjt5#>dAyDwWE< zuCA^Nkx1mNp`oGZv17;J>G0skmTWeQ+uz^Dci(-ty0*6V&y|&xD-MU_(ag+D?wP^8 z`R1EGO6f1%ZuiChzW(2ho){&EdV4Kx0D#qv2tW`J>y>~obts_sA%G8FCbaN&YiRn-wmlKwb6H2lV?Q>PFN1WlXSCNggXKnN^L z3ISmt)o+dW_C*n3GnvHaUwn>Rw{HDgRn>PTN&5E6l`9!L7HYq_bm@|dbKWD%^2Ood z;Wy5lIfGy*SeGKE=K_R~hJRRhi%*2ovLHFg!f`hAhh$Ip;l>E?sij z@$g-m?532y^TG=+ymk82X?VR}yCs{j7L76#bsO#_YpzZJ9aJ8OXNQgoMUEUfteb}rfKZ*&gw)MuYr|;U&5T`Uh6q*BQ+`r0VNdFnAB`jqpbs^ zMjvXcc5V_7QXiWTfHH=iogGB?N8xt6Pb-S@nxZH%i*t;zSfNljJ~T8W`Fy@zG!YP> z7M0$9`|UmHboJ^r!=Xh}nQK?CfmpsytWndcG~8}CqS2_dw6t`bF%|>xfKEkJY+48RsYz3P>iCV2pw>3ZK^puh;8S z6y>NSNu5-d(Fr?B?u z5j3HJa|0M6s6VNn)bS8tml1EuBgEH0#-Y6cA2db+2B}wvfr_<@FR;%ugwstEd2mnOrex++b z=z#Z#{Psse=%6$JLTC^I5Sj+fsOfYXgb;AfZCkbBzeMlb+S-b0wd!^{ogU6PZ>`m8 zPFZ#uy9xm{v}El>*8W&usU`%3ra>708yg$Yv>LRU2DPj)yMw{l662xF|Qsuic)BE!rlOdO`R2qmagD!LYg2Cb$6LO>G&5CY|L+3F*NR?lK= z+bN^0{?HIMlT;IBSyjOpD@&3@IOklIWx1Ho=bds(i@_}&oDjm|(#}o+ijqUMTD8n) zpU56O@npOiCOB4~<=5BO8-gUI6k1I~ zE~lVeR>3(3GY8)zurkKL44G!x2xIzt&g-(~GqYwg8Tfp@yu;y0a>m%|zJ2@h@p#&Zm60)sZwT{gqmixz2}U9aa-GF!rlFE z-@Xcu$Fn&yGV+Pn>;26B3Q-0yJvutNv9PdEx_|#Z7^4P2lN-$73|X21ZmtDOz(%V2ikfn0SF}4*Ky;<3iS8)XZrg3uDV>V={>(& z8Dk$zOiX+n2m~_M|92hPY}QC+c2%aQH_XtYnTzQfs>_+F5N$BGXJ9kr(r2N#>6q3mbeL|)KF!QcPz8Pku#=YIFv@WBY zSbv^OCNVWN1xb?f=gytGNeFpgmgR>}Ju4}dO5@wx+kc*(o_;BrOt!xK^2<1S^eF77 z5I?2dxpN1fe)=hb!Ql4UvuD3(ZEgLFEXy;`e9Ba1q>gp=y=H@UzKQDs8pnBrOiLHYN55C7a{~Lhi zpLDWWtJQuB;P>;+y1HtEgM-z9fq{g000SaNLh0L01FcU z01FcV0GgZ_000V2X+uL$P-t&-Z*ypGa3D!TLm+T+Z)Rz1WdHzp+MQE(Sd;e_KHv9c z4^~3h@UfR{fdC>StO&>uS)ve<0AYj>5AR{$W90N^4L=L-Rl zQUJ&DC0@ZjPh;=*jPLSYvv5M~MF zBAl0-BNIsH15C~g000{K(ZT*WKal6<?_01!^k z@7iDG<<3=fuAC~28EsPoqkpK{9G%|Vj005J}`Hw&=0RYXHq~ibpyyzHQsFW8>#s~la zM4*8xut5h5!4#~(4xGUqyucR%VFpA%3?#rj5JCpzfE)^;7?wd9RKPme1hudO8lVxH z;SjXJF*pk6;1XPc>u?taU>Kgl7`%oF1VP9M6Ja4bh!J9r*dopd7nzO(B4J20l7OTj z>4+3jBE`sZqynizYLQ(?Bl0bB6giDtK>Co|$RIL`{EECsF_eL_Q3KQhbwIhO9~z3r zpmWi5G!I>XmZEFX8nhlgfVQHi(M#xcbO3#dj$?q)F%D*o*1Pf{>6$SWH+$s3q(pv=X`qR|$iJF~TPz zlc-O$C3+J1#CT#lv5;6stS0Uu9wDA3UMCI{Uz12A4#|?_P6{CkNG+sO zq(0IRX`DyT~9-sA|ffUF>wk++Z!kWZ5P$;0Hg6gtI-;!FvmBvPc55=u2?Kjj3a zpE5$3psG>Lsh-pbs)#zDT1jo7c2F-(3)vyY4>O^>2$gY z-Gd%Qm(Z8eYv>2*=jns=cMJ-K3WLW;VkjAF8G9M07`GWOnM|ey)0dgZR4~^v8<}UA z514ONSSt1^d=-((5|uiYR+WC0=c-gyb5%dpd8!Lkt5pxHURHgkMpd&=RhJ{9;hDf7SW4Fc`jUg7sGG*~tLe_Ft1M4hn zm`!3^via;xb_M$zb}xHOQ$usAW~^qBW}W77%>fR^vEcAI*_=wwAG2sV%zY%w@v@XU~7=xdm1xY6*0;iwVIXu6Ta zXrs|dqbIl~?uTdNHFy_3W~^@g_pF#!K2~{F^;Xxc zN!DEJEbDF7S8PxlSDOr*I-AS3sI8l=#CDr)-xT5$k15hA^;2%zG3@;83hbKf2JJca zVfH2VZT8O{%p4LO);n}Nd~$Sk%yw*Wyz8XlG{dRHsl(}4XB%gsbDi@w7p6;)%MzD% zmlsoQr;4X;pL)xc%+^yMd)ZNTI#eJ*$O)i@o$z8)e??LqN_gLa_ z%;TM>o2SC_kmoO6c3xRt`@J4dvz#WL)-Y|z+r(Soy~}%GIzByR`p)SCKE^%*pL(B% zzNWq+-#xw~e%5}Oeh2)X`#bu}{g3#+;d$~F@lFL`0l@*~0lk45fwKc^10MvL1f>Tx z1&sx}1}_Xg6+#RN3Rxd=lW)Km@*DYMGu&q^n$Z=?2%QyL8~QNJCQKgI5srq>2;UHX zZ>IT7>CCnWh~P(Th`1kV8JQRPeH1AwGO8}>QM6NZadh`A)~w`N`)9q5@sFvDxjWlx zwsLl7tZHmhY-8-3xPZ8-xPf?w_(k!T5_A(J3GIpG#Ms0=iQ{tu=WLoYoaCBRmULsT z<=mpV7v|~C%bs^USv6UZd^m-e5|^?+<%1wXP%juy<)>~<9TW0|n}ttBzM_qyQL(qU zN<5P0omQ3hINdvaL;7fjPeygdGYL;pD|wL_lDQ-EO;$wK-mK5raoH_7l$?~Dqf!cK zmb5F^Ft;eTPi8AClM3W{=55LwlZVRpxOiFd;3B_8yA~shQx|tGF!j;$toK>JuS&gYLDkTP@CvOP@r~sh zUu{a>bfJ1`^^VQ7&C1OKHDNXFTgC{M|V%fo{xK_dk6MK@9S!GZ*1JJ zzrV5xZBjOk9!NTH<(q(S+MDf~ceQX@Dh|Ry<-sT4rhI$jQ0Sq~!`#Eo-%($2E^vo}is5J@NVEf|KK?WT&2; zPCq@=ncR8zO#GQ^T~S@VXG71PKNocFOt)Y6$@AXlk6rM*aP%VgV%sIRORYVwJx6|U z{ozQjTW{-S_si{9Jg#)~P3t?+@6&(!YQWWV*Z9{iU7vZq@5byKw{9lg9JnRA_4s!7 z?H6|n?o8ZWdXIRo{Jz@#>IeD{>VLHUv1Pz*;P_y`V9&!@5AO~Mho1hF|I>%z(nrik z)gwkDjgOrl9~%l9z4Bzvli{bbrxVZ0epdf^>vOB;-~HnIOV3#R*zgPai_gEVd8zYq z@2jb=I>#f&AH2?aJ@Kaetz@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzAFaQAR zU;qF*m;eA5Z<1fdMgRZ`&PhZ;RCwB~SY2#fM-~3g%-o;#de>gB|JHWx*u;&0k~BZa zu9DKmqz`T!5S(25tN2%c!f3#dr6L8=guh*APl3I>cCN|Us1+J?l~ zZc^8c9Vcr$Yp?IFy}tW%@9=Q%{@Lp^p&erY3W)x9KJj?HFeE2&1ftZTa;4TUl_Q~&dy*mnXK;W z>iT*h5O~DntKQ9hEg|wY0(vb-4}ugQz%{^1LZ;)8<~(4|K`!5d6`u^R#3L7?(dhZn z(b2zYnid%w8=L=J;CAiWv6%~MV9Mct=MegFG z&V2aiR4Vnds;VEJIB{ZOU2reF@PaoUk9XR({i0g8?b~Y0<6wGKk^hh+NXpxk@;WNU z>2~BQ&_o0&C5Qmqj3RmCpGeL9=QLyNC7;hXcKrD9;M#wq_>slo%r**GJJe)n5ls^Dav9iYG10dg9ozV@*ZiPMMRv=RVN_7Y3%eFM6)9HS% z*V}sf^l6?0XBbAaVHgKcR`;lJFhu|h`h#jBk=V&O zZw3I~-Q8WaxVX4~b|L;9f5*Nuq5DA$V2nBb!T@3n#3gN+Sh8Rorz2Va3ykL?W?4 z*Y!G~C`!F)nhNEW_28WDkv`>as$A?U?A{o82RE<3kFMPZu=TO0Aeauoh9Vd;7I5uO z8l!U=NC{{vD7)3mto&L2cJAq|y>MV;LAL5<(D4slqC&Mrtlqt*UC3&@?TO$z*(Ld4+S- z*A%uY!~;Y!2Tn>S;Aa;~W+W_2!j^!P67jh^2%q{D^qK+GKlVL%YFeNvgp$ZW0P`c0 z$@nx)3os!>xn)_JqI(K_j@I}e;{+iHU<3(5#s-oZAd!|>P6CE05nYj3N=vL*fN24y zO-M_?1|c!`32qJ?2TMjERDz-qL_t*)f}#Li*I`+fCWI&#s;Uy_JSnZD##PUQi$)9!D9DcV~0A`5&uV}f&@R8^IP z5F(}P`ihk_G)33lxdi5dBiDYn;}*uF7GT*hogYUwAwMt6L?q?dTj0SSG(UO-daw?R zN|5DMg{R`sb$vw$krF}(!{_rYrDKswZ&iKKrUU`YY2aEkgV|-J)m`IdwbhENn`E*K2PjKvu+zBxz27z50V z#7NXaG%2BJ%rUo}XC9>-nrmff`|2~O+wnLE1j!uMMU3j?eQrmM1a5uNLmsjhK&S(GM(iFO4o#|LkST>^K_QH3G;VH;an7d&5skOEw}&rXzPe&A-1c~@8=XL!u#u2}uCe0C=W3O)yvVAy z&FDDz9Lnk%L13^U0XH+v<`6_KeOi+l6__`A8~#*erM>;JFcFQ5hK7bIMN!^ss;}9( z_~~eKMQsyik~S7BK-b+sDT~dJz1+RQdUSl_S=4p+IuV`&(#|Iv5^zA0!#)_54C#5R z%#5KmRC6a33cXiTQ!^!8%Je~ZclYAJ+e1yuojX}X1fZx4rQC`DC>{^m`wyXQ&p|LQ za^mfxr5q6U`g$rl8Ztf)86LB{_w+7u&Oazja5Td(es=QY$?wj3LUr*S`%9*z*|F4e z9IDq>(m=H8#=v@sSz$g4Aa!W~U8(Twkt0WbS5Z;%69CDq=Oh6P_Vo13TDPy8_Vm~~ z5!`8)Rr=SAW&5R~|7tnHotGWM^eFtZ*Ug@uo>>5cE}ne$RZ&qf*xA{6G8_*7@E^nf zZlJ0v@aj zJ-%RfwQjJsY}u0O?(RMd;18VhKYd|u!T>y$WgR4S`GZh3w|$X4%%(76}G}15(PrbI#8KSouO9tXGvy0D1vDB&F;G y&2iD(SK6#zp3uHEk<{~G|y@Ixxxg7K{Y0000g000SaNLh0L01FcU z01FcV0GgZ_000V2X+uL$P-t&-Z*ypGa3D!TLm+T+Z)Rz1WdHzp+MQE(Sd;e_KHv9c z4^~3h@UfR{fdC>StO&>uS)ve<0AYj>5AR{$W90N^4L=L-Rl zQUJ&DC0@ZjPh;=*jPLSYvv5M~MF zBAl0-BNIsH15C~g000{K(ZT*WKal6<?_01!^k z@7iDG<<3=fuAC~28EsPoqkpK{9G%|Vj005J}`Hw&=0RYXHq~ibpyyzHQsFW8>#s~la zM4*8xut5h5!4#~(4xGUqyucR%VFpA%3?#rj5JCpzfE)^;7?wd9RKPme1hudO8lVxH z;SjXJF*pk6;1XPc>u?taU>Kgl7`%oF1VP9M6Ja4bh!J9r*dopd7nzO(B4J20l7OTj z>4+3jBE`sZqynizYLQ(?Bl0bB6giDtK>Co|$RIL`{EECsF_eL_Q3KQhbwIhO9~z3r zpmWi5G!I>XmZEFX8nhlgfVQHi(M#xcbO3#dj$?q)F%D*o*1Pf{>6$SWH+$s3q(pv=X`qR|$iJF~TPz zlc-O$C3+J1#CT#lv5;6stS0Uu9wDA3UMCI{Uz12A4#|?_P6{CkNG+sO zq(0IRX`DyT~9-sA|ffUF>wk++Z!kWZ5P$;0Hg6gtI-;!FvmBvPc55=u2?Kjj3a zpE5$3psG>Lsh-pbs)#zDT1jo7c2F-(3)vyY4>O^>2$gY z-Gd%Qm(Z8eYv>2*=jns=cMJ-K3WLW;VkjAF8G9M07`GWOnM|ey)0dgZR4~^v8<}UA z514ONSSt1^d=-((5|uiYR+WC0=c-gyb5%dpd8!Lkt5pxHURHgkMpd&=RhJ{9;hDf7SW4Fc`jUg7sGG*~tLe_Ft1M4hn zm`!3^via;xb_M$zb}xHOQ$usAW~^qBW}W77%>fR^vEcAI*_=wwAG2sV%zY%w@v@XU~7=xdm1xY6*0;iwVIXu6Ta zXrs|dqbIl~?uTdNHFy_3W~^@g_pF#!K2~{F^;Xxc zN!DEJEbDF7S8PxlSDOr*I-AS3sI8l=#CDr)-xT5$k15hA^;2%zG3@;83hbKf2JJca zVfH2VZT8O{%p4LO);n}Nd~$Sk%yw*Wyz8XlG{dRHsl(}4XB%gsbDi@w7p6;)%MzD% zmlsoQr;4X;pL)xc%+^yMd)ZNTI#eJ*$O)i@o$z8)e??LqN_gLa_ z%;TM>o2SC_kmoO6c3xRt`@J4dvz#WL)-Y|z+r(Soy~}%GIzByR`p)SCKE^%*pL(B% zzNWq+-#xw~e%5}Oeh2)X`#bu}{g3#+;d$~F@lFL`0l@*~0lk45fwKc^10MvL1f>Tx z1&sx}1}_Xg6+#RN3Rxd=lW)Km@*DYMGu&q^n$Z=?2%QyL8~QNJCQKgI5srq>2;UHX zZ>IT7>CCnWh~P(Th`1kV8JQRPeH1AwGO8}>QM6NZadh`A)~w`N`)9q5@sFvDxjWlx zwsLl7tZHmhY-8-3xPZ8-xPf?w_(k!T5_A(J3GIpG#Ms0=iQ{tu=WLoYoaCBRmULsT z<=mpV7v|~C%bs^USv6UZd^m-e5|^?+<%1wXP%juy<)>~<9TW0|n}ttBzM_qyQL(qU zN<5P0omQ3hINdvaL;7fjPeygdGYL;pD|wL_lDQ-EO;$wK-mK5raoH_7l$?~Dqf!cK zmb5F^Ft;eTPi8AClM3W{=55LwlZVRpxOiFd;3B_8yA~shQx|tGF!j;$toK>JuS&gYLDkTP@CvOP@r~sh zUu{a>bfJ1`^^VQ7&C1OKHDNXFTgC{M|V%fo{xK_dk6MK@9S!GZ*1JJ zzrV5xZBjOk9!NTH<(q(S+MDf~ceQX@Dh|Ry<-sT4rhI$jQ0Sq~!`#Eo-%($2E^vo}is5J@NVEf|KK?WT&2; zPCq@=ncR8zO#GQ^T~S@VXG71PKNocFOt)Y6$@AXlk6rM*aP%VgV%sIRORYVwJx6|U z{ozQjTW{-S_si{9Jg#)~P3t?+@6&(!YQWWV*Z9{iU7vZq@5byKw{9lg9JnRA_4s!7 z?H6|n?o8ZWdXIRo{Jz@#>IeD{>VLHUv1Pz*;P_y`V9&!@5AO~Mho1hF|I>%z(nrik z)gwkDjgOrl9~%l9z4Bzvli{bbrxVZ0epdf^>vOB;-~HnIOV3#R*zgPai_gEVd8zYq z@2jb=I>#f&AH2?aJ@Kaetz@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzAFaQAR zU;qF*m;eA5Z<1fdMgRZ{5J^NqRCwB~SX*oq*BSoKWoO5%*Oy)I+Phwi?Zm*^xYz|5 zN`k={XrZ~`K#G*6FF`!C50z4psF5n6=Bl zQa2&QA%s}UX0u^U(zB(~6F_=oFqVaeG|;d z7tv_+^P4ws{>N^&&)>RrEBu|nZQHi3XlZGwYR#H8d&0B_A7H zM@L6lCX=bIt*t%c_xlgFw6p{^Zrq6SvT}Ue7L7)6?fNx*{q@(AQ&Us_92*-uWwY7t z_V)J19vNI$SC^Yo`U9uad9*Ru__MYxZDegjL*5zykRL__AP7kQF9DIWp@1=l0Qv3! zhK7gG*Y~Bkb?fGtg@uKa*=+Xu2OoS8{zh;|jvR5Rs`^7ol77|N()z;o?c3q?cypXt z7Ro&cfDq)F6avCTYCM|%TQ^03xljn7ef}A)UcLG+RaM`UB}+_=Yb$B!Qm=(@hYw6yfOty{N}%F4?8t_g@~p$A-e!2KiiudJ-Z z)*o#p4u|78UDx*?KYl#04BXkXXPLv{sLNzBds;TO_}8yrXV60kK&auRqxaQbh5Lo%7n1A{pf z#A4W7^b!J^|DS*o1_FWbd>Brr6M;ZLN+c4S7-Ka6z?zzxT(MYe-@?MeOS?NeSCu$R zj9t+O`_G5xKZKUiAhH4@!z1YJ?L|pR32N)=ELJI?B*L}O8eBVkZVA=xF2 zjg6H$oz9W*@$n%lNm7-fC>sLR0k_Xzou70iFy!f35v2rJTw27*KcB>#Z~hjyZr@(+ zR}`R>fKe;80OK5qL;|5u2#irMM&Wk3;c~g$ilS_gB&mwZvRs)+Bx(bz1Iv72IkmZ6 z(>$&B%OvCD<9O?>-{ZuI6NrSvroU3tcIG^kfH8)Jg*YZBCy~u&!59an6qGS|yj~;{ ziCS5fE2+(9t4gI(eqWU@4=NuF^!~IO70INlkZkg4;>zVKcWeHk+-AOOoVLRkfnR>j7x4Hc=3WTv;@f z282lp2RkcEr zBp0{a?d6)LIm=2)^C>|9AcB}+U`ilr7IG}3Rjf$<5I`1y5LpNTgl1>)?umD?di83& z_~MHQ1OnikTS~RDjv*j`;^Jaxn&!0I?d6nnUaaf7U6$>Z5I0t%)_O^dx+tiCfIwCV z=(-MF)1av;(&;o(sT5MFB-FHujGBR#$w1e2WV2a}jg8~fsZ)r@U9SYA#= zwxD8QL}tg%4*Ycge%S3&p}v|b#mYlkRlyibOOix5=UkO#IT??~?Q&6(>01UkAp{6D zhAu57peQjA%AjR*h^#2APRRXTkN_<$E$Hex0FTFGl)@Dft>Dc@OD2<$WjV{P9kG}KRaL<`FIb6KmGANeSFKuwuC6Y$ zx924vM z5RsSjh9$AgTEslWg=S_Ei^Y<=ckiAigp6>%-#=lq*}n96JevjvZq@_>tC3Epp=lay zHrqWup=GnngyP}Dhp~C{W~>a>dlt>YDgr;DJZ2F9vZ^v=xC~~t!)-SkBO&n`YJ6g?Fj~h zr>Ccj5#XWoWd|q5!{0CW8&i?{n^gDgo)OGy;fWrd=1JCyN_w%u_G3Ii)Xl-pR{C+>YUN6eZ${@=!QmGVT zu^2+35T>T4Fg7-ZNF~UX_q}}+22iBy`m=cMoCGDsHmtAKA$gJQ&S`A>+9#;Zg;m3;=hcs^8k|H z>j&!hQhJ^+J{yU70s0PbW{U5p((^Z)<= M07*qoM6N<$g0@M$761SM literal 0 HcmV?d00001 diff --git a/Icons/prev_blue.png b/Icons/prev_blue.png new file mode 100644 index 0000000000000000000000000000000000000000..b730a0ec4348dd07538f217921629fcd252e6241 GIT binary patch literal 5609 zcmVg000SaNLh0L01FcU z01FcV0GgZ_000V2X+uL$P-t&-Z*ypGa3D!TLm+T+Z)Rz1WdHzp+MQE(Sd;e_KHv9c z4^~3h@UfR{fdC>StO&>uS)ve<0AYj>5AR{$W90N^4L=L-Rl zQUJ&DC0@ZjPh;=*jPLSYvv5M~MF zBAl0-BNIsH15C~g000{K(ZT*WKal6<?_01!^k z@7iDG<<3=fuAC~28EsPoqkpK{9G%|Vj005J}`Hw&=0RYXHq~ibpyyzHQsFW8>#s~la zM4*8xut5h5!4#~(4xGUqyucR%VFpA%3?#rj5JCpzfE)^;7?wd9RKPme1hudO8lVxH z;SjXJF*pk6;1XPc>u?taU>Kgl7`%oF1VP9M6Ja4bh!J9r*dopd7nzO(B4J20l7OTj z>4+3jBE`sZqynizYLQ(?Bl0bB6giDtK>Co|$RIL`{EECsF_eL_Q3KQhbwIhO9~z3r zpmWi5G!I>XmZEFX8nhlgfVQHi(M#xcbO3#dj$?q)F%D*o*1Pf{>6$SWH+$s3q(pv=X`qR|$iJF~TPz zlc-O$C3+J1#CT#lv5;6stS0Uu9wDA3UMCI{Uz12A4#|?_P6{CkNG+sO zq(0IRX`DyT~9-sA|ffUF>wk++Z!kWZ5P$;0Hg6gtI-;!FvmBvPc55=u2?Kjj3a zpE5$3psG>Lsh-pbs)#zDT1jo7c2F-(3)vyY4>O^>2$gY z-Gd%Qm(Z8eYv>2*=jns=cMJ-K3WLW;VkjAF8G9M07`GWOnM|ey)0dgZR4~^v8<}UA z514ONSSt1^d=-((5|uiYR+WC0=c-gyb5%dpd8!Lkt5pxHURHgkMpd&=RhJ{9;hDf7SW4Fc`jUg7sGG*~tLe_Ft1M4hn zm`!3^via;xb_M$zb}xHOQ$usAW~^qBW}W77%>fR^vEcAI*_=wwAG2sV%zY%w@v@XU~7=xdm1xY6*0;iwVIXu6Ta zXrs|dqbIl~?uTdNHFy_3W~^@g_pF#!K2~{F^;Xxc zN!DEJEbDF7S8PxlSDOr*I-AS3sI8l=#CDr)-xT5$k15hA^;2%zG3@;83hbKf2JJca zVfH2VZT8O{%p4LO);n}Nd~$Sk%yw*Wyz8XlG{dRHsl(}4XB%gsbDi@w7p6;)%MzD% zmlsoQr;4X;pL)xc%+^yMd)ZNTI#eJ*$O)i@o$z8)e??LqN_gLa_ z%;TM>o2SC_kmoO6c3xRt`@J4dvz#WL)-Y|z+r(Soy~}%GIzByR`p)SCKE^%*pL(B% zzNWq+-#xw~e%5}Oeh2)X`#bu}{g3#+;d$~F@lFL`0l@*~0lk45fwKc^10MvL1f>Tx z1&sx}1}_Xg6+#RN3Rxd=lW)Km@*DYMGu&q^n$Z=?2%QyL8~QNJCQKgI5srq>2;UHX zZ>IT7>CCnWh~P(Th`1kV8JQRPeH1AwGO8}>QM6NZadh`A)~w`N`)9q5@sFvDxjWlx zwsLl7tZHmhY-8-3xPZ8-xPf?w_(k!T5_A(J3GIpG#Ms0=iQ{tu=WLoYoaCBRmULsT z<=mpV7v|~C%bs^USv6UZd^m-e5|^?+<%1wXP%juy<)>~<9TW0|n}ttBzM_qyQL(qU zN<5P0omQ3hINdvaL;7fjPeygdGYL;pD|wL_lDQ-EO;$wK-mK5raoH_7l$?~Dqf!cK zmb5F^Ft;eTPi8AClM3W{=55LwlZVRpxOiFd;3B_8yA~shQx|tGF!j;$toK>JuS&gYLDkTP@CvOP@r~sh zUu{a>bfJ1`^^VQ7&C1OKHDNXFTgC{M|V%fo{xK_dk6MK@9S!GZ*1JJ zzrV5xZBjOk9!NTH<(q(S+MDf~ceQX@Dh|Ry<-sT4rhI$jQ0Sq~!`#Eo-%($2E^vo}is5J@NVEf|KK?WT&2; zPCq@=ncR8zO#GQ^T~S@VXG71PKNocFOt)Y6$@AXlk6rM*aP%VgV%sIRORYVwJx6|U z{ozQjTW{-S_si{9Jg#)~P3t?+@6&(!YQWWV*Z9{iU7vZq@5byKw{9lg9JnRA_4s!7 z?H6|n?o8ZWdXIRo{Jz@#>IeD{>VLHUv1Pz*;P_y`V9&!@5AO~Mho1hF|I>%z(nrik z)gwkDjgOrl9~%l9z4Bzvli{bbrxVZ0epdf^>vOB;-~HnIOV3#R*zgPai_gEVd8zYq z@2jb=I>#f&AH2?aJ@Kaetz@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzAFaQAR zU;qF*m;eA5Z<1fdMgRZ{2T4RhRCwB~SZPe0#~FU!nfZ=oSzvd$7BFDq3ot%#3aOpL z$hF%zM_boXtElRqSdr>Vt*R>d(?6~hwNj$~OjSj0lPXG+h}21x%L#Eve8k0$O>7MK zzy}1g7%wcl3%lPQ-#7iS_j-xrCL@hzzWL^OX5MGsV@OJgJ55BS1F!=q0iXlW00;ma zfC(T0APT?$5C*U)r8Mq%oo@<`h*()!S%t3a&c?>Z)gF&$V`*vWYE@NRgb)ghF*gy} zrId@7Wz8lMiOE@-!Z@6e{^JI44I^XARA#l^+irlzLtPN#FH?rM3EJKI!Nu^LoT3rGM25P-}ylsiMJF+2)$ z{vu5ONX(eK@`2y)e}8;@yw7g8Pk;XT=aD-G*VEHe5s$~~o12^WlvLF3R;o8P@T!d< z&6&4u9vE2&F27Ai{V;D1B7SplGVH(p#<8li*)V9sBFIXxgFGsCZkLZKHd%Q}1D zz=7G@g4?rak1H07b*ifR8?CnUCu+k3V7BV)?u$w8YfdX!FX$uzD?EeP_0JHUKK)iK z7JFV*)zka;@1I)|+*40IWe6 z5kX1`BET~Ih+g{`v6(M>8Dq~n9FEcFo_lUF-CY#yc{yY33GQ66TW{J5Zg*u*LFOJ0 zm6`}Q@MrnwVp`J=XFn@Koo zz!-sX%9h14E3BhP8v&VbmsA-xz_wC!)kO!`}x0l=P_T}+-e7ok^ zSf^F50p|qHkz6b_8Bb+)o6HNqg9CyA#M1wA<`jTZxdyW(9d+?|e7oIlU*6l>%QIpM z1OknLK;U7N)ZA}t=mh5(hGmZy1tOy*l#`@P-)TIn&_3J@jRa|c@lFk%2C zD5ZVIW=$Bvi8+0hS{**IiF4iv;416w?RAC2;m(*88%jKF;EaKBfOD23S_Z~hrY-%= zID=`%F?I2DN}MbsQqCC!BPfDFq$wd7rZ1fW=MtO~bd~VcyouSc1yvyg?W+-r^9tc` zxU;vn*Tqy-tqKGJYejj3TXTBAL>dfIAd>(&L#j-Db6{fR7~cE)A8`50Pm)Au$^U|q zV2Bf#0tkf=m>tK*FaHUL-}oyyCujojMJ$Zmh=U6P7lf#-7D1)X9S8*0s;XKmbX~6r zhr`W!O)EGrt}Y6-fp2mQ1Mj^E-}TEN04`5sa%`GzGEF~*SR{zkAHRl+Cl5hNfPtVY zgsGs3FDBxM0ZP!y%sFpRp=irNBjx28yF9;f+iGCU8+D4J)CyHqU9niK zQm?221Mi*evWkU_5hG1j--hw($N;O5A& zJW&WiP*nz4NwZMX-i@l&cVqh0L5v^ig%vmQ#HXmNK&V-TrTFLIa5xr(5CNem%8c9X z4hH6@!T8$DP8kD?gv7Algg+{wX$-pN#@fezi;#CG#@>Gs!KuqhE^$B+$ptJ42oNkq zpmEDXsM)v$?Icf*iu$HXcp7fEJE$ni4C90QQ#^7pRg|5ASM*Gk9LMy8PV@W+H1VPaVTuqijV<@d~VePJ8qigT8 za5k?2QPN`MW+hW+5P?b5*VhL*=aYhn##XLe={-4kHe$?8+3c0|Nfi>d5SDzGv zfR~8IL|t9ogrX=X8fvRH&0ig9EU#|BbkxF}3FtcIn4{t(RumiR*L^Rk;W_1bAreS} zq~wid1T4GzzJi%Db_Q~K6w5tTH$5KDiK?oqiL}dfs=d8^{(~a}3X83qm`^yNs0@sX zs>#CrX4o!=0U-AC8WW)=UZy)WkX; zgvxIUNsEQ4C=zH%%9D5u1!%0LcO(LQSz(VHcXD7?8Zf-tE=k;2tF zLx=0grf=1ka?^t3RF_YP@D5}Fi!TNyTLuTZQHhY8Dp>KcFl`l zbX^}OqL+5;*l~PAnFuZ(eGiuZM#{xbyV^))mMT+iX|GvOwoR~PPPyn@FmQ#y6~OXO zWAW&_*ia^dJ9g|iPDC&1x;}o}w-UoJdKMNIp6=`GyLVu6rqt236}DAtlaiz*M3{3s zazi7e-%Tj1AB~Gc2%Y#0-3nC;+qZ8&T3TBAtgh?*-}sd&kw|QjQts{V?|F-q>FIfgi2f#oIQIWM9=0SBi6_R! z#-1D)7;v1Ono+ft?NqX+1DdCy2%n1U>Zo@T;qya?UK*C`>Z)Vi-QA%TD^|Q9g!l)5 zE8ps6(=^SW0{F%7@bDu;LqlTZ>NRdSTuf_df>v7(#a#+fRt~1=u%ZSM!2sg3Gl))K zM|5%=dT7pSTi$GTbaW)z+uPp(@EYg*&F}0@7=X<*%}0pnhqJS@4_>))rE+3og1lZY z^Z9%f3g000SaNLh0L01FcU z01FcV0GgZ_000V2X+uL$P-t&-Z*ypGa3D!TLm+T+Z)Rz1WdHzp+MQE(Sd;e_KHv9c z4^~3h@UfR{fdC>StO&>uS)ve<0AYj>5AR{$W90N^4L=L-Rl zQUJ&DC0@ZjPh;=*jPLSYvv5M~MF zBAl0-BNIsH15C~g000{K(ZT*WKal6<?_01!^k z@7iDG<<3=fuAC~28EsPoqkpK{9G%|Vj005J}`Hw&=0RYXHq~ibpyyzHQsFW8>#s~la zM4*8xut5h5!4#~(4xGUqyucR%VFpA%3?#rj5JCpzfE)^;7?wd9RKPme1hudO8lVxH z;SjXJF*pk6;1XPc>u?taU>Kgl7`%oF1VP9M6Ja4bh!J9r*dopd7nzO(B4J20l7OTj z>4+3jBE`sZqynizYLQ(?Bl0bB6giDtK>Co|$RIL`{EECsF_eL_Q3KQhbwIhO9~z3r zpmWi5G!I>XmZEFX8nhlgfVQHi(M#xcbO3#dj$?q)F%D*o*1Pf{>6$SWH+$s3q(pv=X`qR|$iJF~TPz zlc-O$C3+J1#CT#lv5;6stS0Uu9wDA3UMCI{Uz12A4#|?_P6{CkNG+sO zq(0IRX`DyT~9-sA|ffUF>wk++Z!kWZ5P$;0Hg6gtI-;!FvmBvPc55=u2?Kjj3a zpE5$3psG>Lsh-pbs)#zDT1jo7c2F-(3)vyY4>O^>2$gY z-Gd%Qm(Z8eYv>2*=jns=cMJ-K3WLW;VkjAF8G9M07`GWOnM|ey)0dgZR4~^v8<}UA z514ONSSt1^d=-((5|uiYR+WC0=c-gyb5%dpd8!Lkt5pxHURHgkMpd&=RhJ{9;hDf7SW4Fc`jUg7sGG*~tLe_Ft1M4hn zm`!3^via;xb_M$zb}xHOQ$usAW~^qBW}W77%>fR^vEcAI*_=wwAG2sV%zY%w@v@XU~7=xdm1xY6*0;iwVIXu6Ta zXrs|dqbIl~?uTdNHFy_3W~^@g_pF#!K2~{F^;Xxc zN!DEJEbDF7S8PxlSDOr*I-AS3sI8l=#CDr)-xT5$k15hA^;2%zG3@;83hbKf2JJca zVfH2VZT8O{%p4LO);n}Nd~$Sk%yw*Wyz8XlG{dRHsl(}4XB%gsbDi@w7p6;)%MzD% zmlsoQr;4X;pL)xc%+^yMd)ZNTI#eJ*$O)i@o$z8)e??LqN_gLa_ z%;TM>o2SC_kmoO6c3xRt`@J4dvz#WL)-Y|z+r(Soy~}%GIzByR`p)SCKE^%*pL(B% zzNWq+-#xw~e%5}Oeh2)X`#bu}{g3#+;d$~F@lFL`0l@*~0lk45fwKc^10MvL1f>Tx z1&sx}1}_Xg6+#RN3Rxd=lW)Km@*DYMGu&q^n$Z=?2%QyL8~QNJCQKgI5srq>2;UHX zZ>IT7>CCnWh~P(Th`1kV8JQRPeH1AwGO8}>QM6NZadh`A)~w`N`)9q5@sFvDxjWlx zwsLl7tZHmhY-8-3xPZ8-xPf?w_(k!T5_A(J3GIpG#Ms0=iQ{tu=WLoYoaCBRmULsT z<=mpV7v|~C%bs^USv6UZd^m-e5|^?+<%1wXP%juy<)>~<9TW0|n}ttBzM_qyQL(qU zN<5P0omQ3hINdvaL;7fjPeygdGYL;pD|wL_lDQ-EO;$wK-mK5raoH_7l$?~Dqf!cK zmb5F^Ft;eTPi8AClM3W{=55LwlZVRpxOiFd;3B_8yA~shQx|tGF!j;$toK>JuS&gYLDkTP@CvOP@r~sh zUu{a>bfJ1`^^VQ7&C1OKHDNXFTgC{M|V%fo{xK_dk6MK@9S!GZ*1JJ zzrV5xZBjOk9!NTH<(q(S+MDf~ceQX@Dh|Ry<-sT4rhI$jQ0Sq~!`#Eo-%($2E^vo}is5J@NVEf|KK?WT&2; zPCq@=ncR8zO#GQ^T~S@VXG71PKNocFOt)Y6$@AXlk6rM*aP%VgV%sIRORYVwJx6|U z{ozQjTW{-S_si{9Jg#)~P3t?+@6&(!YQWWV*Z9{iU7vZq@5byKw{9lg9JnRA_4s!7 z?H6|n?o8ZWdXIRo{Jz@#>IeD{>VLHUv1Pz*;P_y`V9&!@5AO~Mho1hF|I>%z(nrik z)gwkDjgOrl9~%l9z4Bzvli{bbrxVZ0epdf^>vOB;-~HnIOV3#R*zgPai_gEVd8zYq z@2jb=I>#f&AH2?aJ@Kaetz@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzAFaQAR zU;qF*m;eA5Z<1fdMgRZ{CrLy>RCwB~SX*pd#TowQvS&}aUdOxZUEAyR;y7`9i-|8_ zry)+{grtA~(G;l_uL+^F4+W%DNKoXyv{j|@Kt&%=TB4>z@iW$cE|hNE;vF6&Cbrwk!9K8_xsBV3JPkova-q~Nh;x-`zWO@ zLWoTWv8bx*jG`!`i9}*}VPWCw`1tsRKp=267K_bAB9V{~LjB&rRa8{C;_-NHWo6|9 z4u@k~t}FLGzu#Zr^?KpZ`=?wQKEjb93)szka>LX0uJ4K7D%Wj=?oI zH|Hdi$-?5|;{9H)_wkyV8sFy4o8icD;M@C zvomzt;P&p_>!Ot2ZMWMGR8~~}w4t$qY%DD`xB&phG$H^&K#U;)k>;U*HirNPIe>w| z0d#kt6aD>tN9X6~UsF}}^6}%xXKo2@|Ni~XL?TfqNzyNCYib{BYHEVV?Mchbv{AYv z0776$QV0kgsn*rU&4(huR4|B7Kl>CHE?jsgkx0BMNz(a4hYrn}u~2j8;K747&UuL} z%Li&}YaiRWb0<7`o@FYMwp@S^lJSL6iP6-pTx+N2QjOk|mxo==J5gI(`? z2M->!nep%yoLomK-M4=I`p367ZHLq8G)wX(T8m5?ie(wzh&FvX0XUpaY;W3*rRdV* z!`Fsq0K5v|$|}yaw6yqAsnkPj*RFkZ%a$!9FE7tHH388%bd!pkv~PnxFE0;Uez=9$ zY_>;JsnkO)EiJwbaBXdE%x1H#OD2=MYc|(-%gf6&@el$Ks_8T#%VIONp|{Oq#tJdR z1kAifx^CRK5hd$Nyvby8x6Ni-*Vfj?3~=Fa*dGpuANF`W+iPlT0Z>qVBGoGh0VNbv z-!$E(dRqfX^*Pj3&ALfI$nx5R0F*H-E-u1XnkcM zB$vyjpD=x50Q!P37N^EWB%__?B8;!WP2D)CF-|}U1A)NI^bG8FJA6K$6pcpf8Dko_ zwzf8BG#ahroYz#8mm8d-l;|hSP<{r6?F<@D=$0pe7oP*0r^@Ik_ZB`QdPQldsU{D)1JX-C2eeYX3xr*>!bwp|!OY zMgAh(b5Ff#Oz38$IcWldk&$co`;jB)@9)Py-+U94aYPpv5ex>wm!~|;S>meL|{V;~U9s&X2_xm-muJRec!onh2TU+tL zhaVUtj4?#!BN!hWhpMVzj2n@~?eXBhfk3e=%X!>lvE;{MF>gVBfgXa00feLjfWA>E z6hiCKR(#a?5zLes)~ugMNhNXexwGc^hUfb&dO>vB3V zI56O~SS)d;WCi;`#IV z+v|rhF*yMN0ig=0s(?@wD2jsFnORWA3_~#&hr@wHB9SXel9OAlR)?Y}_MGgshD#6t zh|t9P`RC{Gk2j8BVq)@!PG9Is005(-qd4;SBRGHY0)$W@1Rzuus;NTfmRU1}kw5@h zSy@mN#cs7)9h`HXl}e?ovTW6(3ITKDoGMyjKvd)q{(eiP)hN{6Hnl|XP<*R z*KLSERaGb{1xhlBlrE;El0;Ea5uShkd6boxYg~iSK?x(A8UQE-V+@QjP|A!pV-%^B z0>)Tek|aVo=LuPsmm-nK3S-b(_ieimul)HH?A`klP0!?Vvk zgQtJ~G(7ISo5ohk7%0^kz!?K&RIdz6OG}Vtd5LqL;GFZY-ELo)nx4wZ%g;-Pc>n^G zQ7B0T3kwU_v12=GYBuB8v12&beGbB~Y@uyp5>;J&Eoy4+#;MLuy!-A6&4|pY&`PnI zN+c42-ELptoQJ8!VhOrjuE@m1gz0peeyAxGp->p{cmkYrxLhtAcni|_XjjJHDz#)^JQAbxJj%Gv$L~sxm*#8#S)~9vC+c9 z!bl(xFnC4@fvTzqhrXB?a{Fh;Op!+N~*(o5L?D7K`Pa+wHFJ?d|jXd_{=I<4_a@7K>$-PAIAh%5)wJ zz{WZ5z31Lc&!Db~VtRxi*tTukP4#VXXb2vUXR4r};GEm-4sbnX`m(C3D%9QG?W?b^ zr?M=A>5g(`VT|4S4#-T&g6UH9|1$pB*;xz@4ys$XZVEBRzBKYVr_=dKU0vPD?Ck8R z?(S|)X&D1$EJImWRhrhVG%d{-=Zt}IQ(GUWH<*9v(j_cFGR>s)TUAuO@=XSeiPknd_b8~ZA zcv)E)(?bw7JU!LLWTw}~n2C#K(NfHXLO6Bm6x?q2?5^UPzQl!1T9l_wF9{;Ewc64AF`lgGKvgOc}21J)>G!bk6gTWx$+uI>YQe@AbJ!c3Z zhh%xvRUWqNuVXV0F+ z;NYNAU0uD@+}wPE5b_t!dDpjjJST0E`s_F!Q zR>s)d-`krofHkR9>JdW7k7j0O9vmJX&I$wqWPE&_PESvhNF+jHu^41oMs{|#$j!|a z1qB7F-|rVCB_-1?m#bX}ags510>IMu`e41HlmTc2uvrLE0bm^f4*)xWc>qBG*9al~ j04@RO25|LGH~HTH!CFa6e1kUI00000NkvXXu0mjfL50KM literal 0 HcmV?d00001 diff --git a/Icons/remove_blue.png b/Icons/remove_blue.png new file mode 100644 index 0000000000000000000000000000000000000000..f62ff09e37dd6df727393f29f91c8a29b2e20af9 GIT binary patch literal 4750 zcmV;95^?Q`P)StO&>uS)ve<0AYj>5AR{$W90N^4L=L-Rl zQUJ&DC0@ZjPh;=*jPLSYvv5M~MF zBAl0-BNIsH15C~g000{K(ZT*WKal6<?_01!^k z@7iDG<<3=fuAC~28EsPoqkpK{9G%|Vj005J}`Hw&=0RYXHq~ibpyyzHQsFW8>#s~la zM4*8xut5h5!4#~(4xGUqyucR%VFpA%3?#rj5JCpzfE)^;7?wd9RKPme1hudO8lVxH z;SjXJF*pk6;1XPc>u?taU>Kgl7`%oF1VP9M6Ja4bh!J9r*dopd7nzO(B4J20l7OTj z>4+3jBE`sZqynizYLQ(?Bl0bB6giDtK>Co|$RIL`{EECsF_eL_Q3KQhbwIhO9~z3r zpmWi5G!I>XmZEFX8nhlgfVQHi(M#xcbO3#dj$?q)F%D*o*1Pf{>6$SWH+$s3q(pv=X`qR|$iJF~TPz zlc-O$C3+J1#CT#lv5;6stS0Uu9wDA3UMCI{Uz12A4#|?_P6{CkNG+sO zq(0IRX`DyT~9-sA|ffUF>wk++Z!kWZ5P$;0Hg6gtI-;!FvmBvPc55=u2?Kjj3a zpE5$3psG>Lsh-pbs)#zDT1jo7c2F-(3)vyY4>O^>2$gY z-Gd%Qm(Z8eYv>2*=jns=cMJ-K3WLW;VkjAF8G9M07`GWOnM|ey)0dgZR4~^v8<}UA z514ONSSt1^d=-((5|uiYR+WC0=c-gyb5%dpd8!Lkt5pxHURHgkMpd&=RhJ{9;hDf7SW4Fc`jUg7sGG*~tLe_Ft1M4hn zm`!3^via;xb_M$zb}xHOQ$usAW~^qBW}W77%>fR^vEcAI*_=wwAG2sV%zY%w@v@XU~7=xdm1xY6*0;iwVIXu6Ta zXrs|dqbIl~?uTdNHFy_3W~^@g_pF#!K2~{F^;Xxc zN!DEJEbDF7S8PxlSDOr*I-AS3sI8l=#CDr)-xT5$k15hA^;2%zG3@;83hbKf2JJca zVfH2VZT8O{%p4LO);n}Nd~$Sk%yw*Wyz8XlG{dRHsl(}4XB%gsbDi@w7p6;)%MzD% zmlsoQr;4X;pL)xc%+^yMd)ZNTI#eJ*$O)i@o$z8)e??LqN_gLa_ z%;TM>o2SC_kmoO6c3xRt`@J4dvz#WL)-Y|z+r(Soy~}%GIzByR`p)SCKE^%*pL(B% zzNWq+-#xw~e%5}Oeh2)X`#bu}{g3#+;d$~F@lFL`0l@*~0lk45fwKc^10MvL1f>Tx z1&sx}1}_Xg6+#RN3Rxd=lW)Km@*DYMGu&q^n$Z=?2%QyL8~QNJCQKgI5srq>2;UHX zZ>IT7>CCnWh~P(Th`1kV8JQRPeH1AwGO8}>QM6NZadh`A)~w`N`)9q5@sFvDxjWlx zwsLl7tZHmhY-8-3xPZ8-xPf?w_(k!T5_A(J3GIpG#Ms0=iQ{tu=WLoYoaCBRmULsT z<=mpV7v|~C%bs^USv6UZd^m-e5|^?+<%1wXP%juy<)>~<9TW0|n}ttBzM_qyQL(qU zN<5P0omQ3hINdvaL;7fjPeygdGYL;pD|wL_lDQ-EO;$wK-mK5raoH_7l$?~Dqf!cK zmb5F^Ft;eTPi8AClM3W{=55LwlZVRpxOiFd;3B_8yA~shQx|tGF!j;$toK>JuS&gYLDkTP@CvOP@r~sh zUu{a>bfJ1`^^VQ7&C1OKHDNXFTgC{M|V%fo{xK_dk6MK@9S!GZ*1JJ zzrV5xZBjOk9!NTH<(q(S+MDf~ceQX@Dh|Ry<-sT4rhI$jQ0Sq~!`#Eo-%($2E^vo}is5J@NVEf|KK?WT&2; zPCq@=ncR8zO#GQ^T~S@VXG71PKNocFOt)Y6$@AXlk6rM*aP%VgV%sIRORYVwJx6|U z{ozQjTW{-S_si{9Jg#)~P3t?+@6&(!YQWWV*Z9{iU7vZq@5byKw{9lg9JnRA_4s!7 z?H6|n?o8ZWdXIRo{Jz@#>IeD{>VLHUv1Pz*;P_y`V9&!@5AO~Mho1hF|I>%z(nrik z)gwkDjgOrl9~%l9z4Bzvli{bbrxVZ0epdf^>vOB;-~HnIOV3#R*zgPai_gEVd8zYq z@2jb=I>#f&AH2?aJ@Kaetz@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzAFaQAR zU;qF*m;eA5Z<1fdMgRZ@tVu*cRCwByS4(UZ*%dway;rZkc7JT+Ph)I@f52!m!5I+0 zQDVqwl+^?gjf9e2mQg+uiWJQvN;Z+Qi6TXsS!9FViC*?08n_%U}g{z_4W1+4sP#1TpApnF7}VUse|6_%E|W#?OOm~qV;CnSa}*% zm*&cg_pZ-BdT`;<+~Or7dc-Z1SBzHz8)Lw1ijxy#@AZ~OzE{{Wbx;)c=HQmV$^}Ue zMp)VA$Wlptz)ETZ!LEh(7) zwh#bL0OdgJI0_{76Y;{Or(pi&(9qCAS63H=@B46FSDU2yzQ~V!;10b5r8R^|AS6Mm zR76W;+r0v0Yc4j|rO4h938c0Wj2uPe3V&dd=KHSeYTx%Es?{o@DB6<<`;d7gycvDUbl8&c@JWO@+6f<}shw*p(}iO3 zx{^eLwR$-1^zU&j#|4`hVk2N;BavtWHO)2C7Efxea%w1NmTE<)HVp1BHv#S7xjW&k z)-F#=qCYFZjMw2zcs)aqmH;R85)j(&Da&n>(roG;frvpwX;B%5mIAfN;IqXh)?i|-NHXI}5Ox{mcR4{Pq+~E{mJDqvnwGZ!AUM5m?cwYlMGOIfXVnCs&o@!7 zF+4}W5QE$ftgm`qO42SRgeZ}AbJ`C8Hh`cEEcJTn;T_E0`WNce3Z#@kb{0e_8^no$ zF+gG%^(cmPb8vU;!+Nj_VFGxL*rZ}BK!eA(ik=xL-cND&EFKt4i9K=!!OUiDgwbGz8^^u4) zld}VqBw$HG%#1K$G!vki0UPF2DYwNy074NQn_#Tfv zMMx_oC4qX(C_8=7I}f5`TLp=*ULwj?MHylsPGAK&bo39xw#7@yVbFxD61E+up*+uD z))d#dS@V?ZgG~Y@fG6vWTjdz_?s1fkje&?ZlBre4t-ftcT0WFTND#f;^GL!(RphLs z?t1>R>dfV5J!u-vdc|`)bD)IrG&H!qYS0vfz!NacFZKz}YBtLS27{S0;}}HZ70p&5 zuC1ZVF^!-zKdW+u!mYl%U!H&Rpx8CA18Xtke$@b);8Ut}!@CTWGEdXvOP?_S!3>aq z5baiG8zdlBXED+plsofI2}Ir+)oufEIMhT!D8z)6Dt zI+$K??B#U;%0hGH89HY_!=ZPkuH*}aGXPjHGr};OpWMCoql2TRx#Zdf2o9lL3QJQa zA{C3;o)Ij2%e;NRMbMsx??+)6&NDMa7=~bGSX!SwHa-3EfljQ} zubc;&2DD?PU@d8ZTOt#B#XJLbHOPdhUpbEhoxFN%dirBa>$91opnAQ&nejptYt^-% zpE-B_`&ZW4>pXNEy4aoaByah?$)=kLm#ql_NJ6x{jMaaBino2Lee2!hzxRTUU$lSf zz5vY3&{`Kw9RK9PUoZUN(#(9mIr&w1qkCZaE(E201co>M2tWi91QMxj&GkCg?|lL5 z_UAY}Qd*h*#`N!mQoo6!s7!6d@)EER0=8}2U_N>G&h4LGy!zRj_v;4D?ZdDKhhcXX zpn?F(N#BVZKwPaNTz!u4(F0g>53th}I5M^G`q;$euR-)l7=~fn*X-+owbn4kKuS3p z$IVkSckg}si@RUGHCI{3O2Vibppkj(5FrpiUJ|zFeC!z;zcw;9`WL0FKP5?WPY8i1 zitv8{6A^?E0MG~ENWHptuv)3?t=DQJQ55z7fY$a?*YjqAT<)eDbX*2-5y0d0Hz?Kj cD&YSN0C6m6vc)(ry8r+H07*qoM6N<$f;;d2ng9R* literal 0 HcmV?d00001 diff --git a/Icons/remove_gray.png b/Icons/remove_gray.png new file mode 100644 index 0000000000000000000000000000000000000000..3e9458f946e566fa883d0231ad80bd9f34d722b3 GIT binary patch literal 4716 zcmV-y5|izTP)StO&>uS)ve<0AYj>5AR{$W90N^4L=L-Rl zQUJ&DC0@ZjPh;=*jPLSYvv5M~MF zBAl0-BNIsH15C~g000{K(ZT*WKal6<?_01!^k z@7iDG<<3=fuAC~28EsPoqkpK{9G%|Vj005J}`Hw&=0RYXHq~ibpyyzHQsFW8>#s~la zM4*8xut5h5!4#~(4xGUqyucR%VFpA%3?#rj5JCpzfE)^;7?wd9RKPme1hudO8lVxH z;SjXJF*pk6;1XPc>u?taU>Kgl7`%oF1VP9M6Ja4bh!J9r*dopd7nzO(B4J20l7OTj z>4+3jBE`sZqynizYLQ(?Bl0bB6giDtK>Co|$RIL`{EECsF_eL_Q3KQhbwIhO9~z3r zpmWi5G!I>XmZEFX8nhlgfVQHi(M#xcbO3#dj$?q)F%D*o*1Pf{>6$SWH+$s3q(pv=X`qR|$iJF~TPz zlc-O$C3+J1#CT#lv5;6stS0Uu9wDA3UMCI{Uz12A4#|?_P6{CkNG+sO zq(0IRX`DyT~9-sA|ffUF>wk++Z!kWZ5P$;0Hg6gtI-;!FvmBvPc55=u2?Kjj3a zpE5$3psG>Lsh-pbs)#zDT1jo7c2F-(3)vyY4>O^>2$gY z-Gd%Qm(Z8eYv>2*=jns=cMJ-K3WLW;VkjAF8G9M07`GWOnM|ey)0dgZR4~^v8<}UA z514ONSSt1^d=-((5|uiYR+WC0=c-gyb5%dpd8!Lkt5pxHURHgkMpd&=RhJ{9;hDf7SW4Fc`jUg7sGG*~tLe_Ft1M4hn zm`!3^via;xb_M$zb}xHOQ$usAW~^qBW}W77%>fR^vEcAI*_=wwAG2sV%zY%w@v@XU~7=xdm1xY6*0;iwVIXu6Ta zXrs|dqbIl~?uTdNHFy_3W~^@g_pF#!K2~{F^;Xxc zN!DEJEbDF7S8PxlSDOr*I-AS3sI8l=#CDr)-xT5$k15hA^;2%zG3@;83hbKf2JJca zVfH2VZT8O{%p4LO);n}Nd~$Sk%yw*Wyz8XlG{dRHsl(}4XB%gsbDi@w7p6;)%MzD% zmlsoQr;4X;pL)xc%+^yMd)ZNTI#eJ*$O)i@o$z8)e??LqN_gLa_ z%;TM>o2SC_kmoO6c3xRt`@J4dvz#WL)-Y|z+r(Soy~}%GIzByR`p)SCKE^%*pL(B% zzNWq+-#xw~e%5}Oeh2)X`#bu}{g3#+;d$~F@lFL`0l@*~0lk45fwKc^10MvL1f>Tx z1&sx}1}_Xg6+#RN3Rxd=lW)Km@*DYMGu&q^n$Z=?2%QyL8~QNJCQKgI5srq>2;UHX zZ>IT7>CCnWh~P(Th`1kV8JQRPeH1AwGO8}>QM6NZadh`A)~w`N`)9q5@sFvDxjWlx zwsLl7tZHmhY-8-3xPZ8-xPf?w_(k!T5_A(J3GIpG#Ms0=iQ{tu=WLoYoaCBRmULsT z<=mpV7v|~C%bs^USv6UZd^m-e5|^?+<%1wXP%juy<)>~<9TW0|n}ttBzM_qyQL(qU zN<5P0omQ3hINdvaL;7fjPeygdGYL;pD|wL_lDQ-EO;$wK-mK5raoH_7l$?~Dqf!cK zmb5F^Ft;eTPi8AClM3W{=55LwlZVRpxOiFd;3B_8yA~shQx|tGF!j;$toK>JuS&gYLDkTP@CvOP@r~sh zUu{a>bfJ1`^^VQ7&C1OKHDNXFTgC{M|V%fo{xK_dk6MK@9S!GZ*1JJ zzrV5xZBjOk9!NTH<(q(S+MDf~ceQX@Dh|Ry<-sT4rhI$jQ0Sq~!`#Eo-%($2E^vo}is5J@NVEf|KK?WT&2; zPCq@=ncR8zO#GQ^T~S@VXG71PKNocFOt)Y6$@AXlk6rM*aP%VgV%sIRORYVwJx6|U z{ozQjTW{-S_si{9Jg#)~P3t?+@6&(!YQWWV*Z9{iU7vZq@5byKw{9lg9JnRA_4s!7 z?H6|n?o8ZWdXIRo{Jz@#>IeD{>VLHUv1Pz*;P_y`V9&!@5AO~Mho1hF|I>%z(nrik z)gwkDjgOrl9~%l9z4Bzvli{bbrxVZ0epdf^>vOB;-~HnIOV3#R*zgPai_gEVd8zYq z@2jb=I>#f&AH2?aJ@Kaetz@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzAFaQAR zU;qF*m;eA5Z<1fdMgRZ@ib+I4RCwByS50hN#}WQ!ci%rnij00Nk+Nt>rY*^iWhrrO zMMWJ#uyah&6akFpP@qQxMFFEdwz>9F6ey4!dTY^Bf!+cm5bOY|kV9?RO;Z0sv4q4D zrP!oM^Y^{Sx7))bX-bxyc7efr`(}2&nc11yeRS>GH2?q+p-?Cwm&>74Dxp@ZVP|It zTU%R*#bR(>HzG8VB+#IOibEk1E<}Yuy9#Qj={GkD!>E)>B@7P_V{mW~wrwL8i(zPJ z2#G`jN+|$2!8teB$+i!GTn7Z*RY2I~t%+t=0TuvH0}6 zo$sEkeZBU@#>U2tTrRglMBl15$^qj*U@0Y}l!@cVkH2#)o&I2UcJ{*LUHyE0W8*J{LgBiUvhcqGGtPNBlga$@ zjk&p>y|u8ANROsr7)HmaKuR?0_0ATVrUBcw(bw09lP6BbW@gU5v$C>s?$+&Ff8E~R z{v&`20J0l|&(F_y6x3=p76ideDwX>1@}RLLA6>*20^f97{-om+nvz!^XJdE->K1PoQOmszgt{f{K>^1 zU4&yhXa>!eVWDvZ0S2rPRMo)66TSpp*i?di5%F zT}QE491eouH}muJAH03>Z5W1*Kn5=Wun+7o16p$h1zppTOs3HEo0D5xTbib6tD~c% zGu~F7GM|#fyDwTTQ_x*P* z%hDak0jpFh@H}tIFpMh~=I478@dSb(05Jw)2)#Ol7-L;?2JHF9z!-y43eji`nM|ga zbAHA1ys1j10>(LKySuyDR4O%>$(%qSWw?j{A`T)3b^sAEfB@F=khR_cv}D4>(1gHl zp@2jpfkYxPS1OgVoO8yAXvFor?BvvxX;~Jiql|$ObrkQXkjFZP0Stt2PObI2ror_+ z1Afm&>8q z^r7n-1_zIT7(1bq$_N1Cj^n%*i}nCYf`u_^wc*3Z9v&$`h4oAXaL!SwRk5?ZgL=IV zAv7??(G!Wl(Dm1dXk0MHl9pw~oJb^0Dq=N+k#(KmLwTrP)| zl@;Xk`Oe|dCIC=f^(>Ld`Q7GOlX?MIOlyr2%)zv+UqSk ziK3K3AOpxiLP-hP0ah<<2oZy(Y0!iS2zHewrw}^&z>pI^N16JR0<#k zPK0IAD) z#`EW8I~I+h382wvpj>_q5W?i3u3SFwY^N~jN_K6Lg6fjjG=Y3R55`y{7K?o&;_>)> z$8ic98|#UqM~@=#JXEVy5D|1;11Ug4hMh{$K9AdqsTJ{X8$wyNr}VfG*v{n;jYbRc zc>KOFP4mmKv9Y@kA3mIzn|lL65P&fT&iNjH*uF&BA9>Z<^RSlp8pw#?dLF)g@&u<( zpT29F=9kQIobsttr#@9m?cTe04~#JgO@k1kLx#{HxClw?B~2I5w2;EN1|j$!8QnDT z`0-JlBJ1 zn0rIaTL!d@;B6ic-+3p*45n$q^L^a>>@#rApJ%h#k9A$Y-f|RFZ`~GKwU#KC%fDS( zTKa{Q(q3F#M1Oxjn#}-cmC7qe>jEgaz|*Hsv9z=V##n7}aq-VRJv|?GUv>8Yw>(cY zo6TR{xN+m^=H_Pa*|TRcIXMa2w)e=jdv*J0Y>#@qj(hj+;m(~qNG6lTY&QERA;cd% z&ntAxy#&k{gJBqkQtG`24<7t_b#?W1DJ9bBG}7r~h{t;oiA44|TB%e}EEci8zK)HJ z3NXenJ3ITu$&)94PegxrUDuUT;(LL0U5Atsobw6a_phw2t^N4XqenB7$ty>9>09YuO%NI(e(sZp>JLbA>KL8kp@zl2M u^;j(SpPrtc&jI`sz_ygKqwgT#{|*39dpzzgdclJL0000#f literal 0 HcmV?d00001 diff --git a/Icons/repeat_blue.png b/Icons/repeat_blue.png new file mode 100644 index 0000000000000000000000000000000000000000..1d6547a89df6b89a29df4f5f3134085623a73b16 GIT binary patch literal 5181 zcmV-D6vFF?P)StO&>uS)ve<0AYj>5AR{$W90N^4L=L-Rl zQUJ&DC0@ZjPh;=*jPLSYvv5M~MF zBAl0-BNIsH15C~g000{K(ZT*WKal6<?_01!^k z@7iDG<<3=fuAC~28EsPoqkpK{9G%|Vj005J}`Hw&=0RYXHq~ibpyyzHQsFW8>#s~la zM4*8xut5h5!4#~(4xGUqyucR%VFpA%3?#rj5JCpzfE)^;7?wd9RKPme1hudO8lVxH z;SjXJF*pk6;1XPc>u?taU>Kgl7`%oF1VP9M6Ja4bh!J9r*dopd7nzO(B4J20l7OTj z>4+3jBE`sZqynizYLQ(?Bl0bB6giDtK>Co|$RIL`{EECsF_eL_Q3KQhbwIhO9~z3r zpmWi5G!I>XmZEFX8nhlgfVQHi(M#xcbO3#dj$?q)F%D*o*1Pf{>6$SWH+$s3q(pv=X`qR|$iJF~TPz zlc-O$C3+J1#CT#lv5;6stS0Uu9wDA3UMCI{Uz12A4#|?_P6{CkNG+sO zq(0IRX`DyT~9-sA|ffUF>wk++Z!kWZ5P$;0Hg6gtI-;!FvmBvPc55=u2?Kjj3a zpE5$3psG>Lsh-pbs)#zDT1jo7c2F-(3)vyY4>O^>2$gY z-Gd%Qm(Z8eYv>2*=jns=cMJ-K3WLW;VkjAF8G9M07`GWOnM|ey)0dgZR4~^v8<}UA z514ONSSt1^d=-((5|uiYR+WC0=c-gyb5%dpd8!Lkt5pxHURHgkMpd&=RhJ{9;hDf7SW4Fc`jUg7sGG*~tLe_Ft1M4hn zm`!3^via;xb_M$zb}xHOQ$usAW~^qBW}W77%>fR^vEcAI*_=wwAG2sV%zY%w@v@XU~7=xdm1xY6*0;iwVIXu6Ta zXrs|dqbIl~?uTdNHFy_3W~^@g_pF#!K2~{F^;Xxc zN!DEJEbDF7S8PxlSDOr*I-AS3sI8l=#CDr)-xT5$k15hA^;2%zG3@;83hbKf2JJca zVfH2VZT8O{%p4LO);n}Nd~$Sk%yw*Wyz8XlG{dRHsl(}4XB%gsbDi@w7p6;)%MzD% zmlsoQr;4X;pL)xc%+^yMd)ZNTI#eJ*$O)i@o$z8)e??LqN_gLa_ z%;TM>o2SC_kmoO6c3xRt`@J4dvz#WL)-Y|z+r(Soy~}%GIzByR`p)SCKE^%*pL(B% zzNWq+-#xw~e%5}Oeh2)X`#bu}{g3#+;d$~F@lFL`0l@*~0lk45fwKc^10MvL1f>Tx z1&sx}1}_Xg6+#RN3Rxd=lW)Km@*DYMGu&q^n$Z=?2%QyL8~QNJCQKgI5srq>2;UHX zZ>IT7>CCnWh~P(Th`1kV8JQRPeH1AwGO8}>QM6NZadh`A)~w`N`)9q5@sFvDxjWlx zwsLl7tZHmhY-8-3xPZ8-xPf?w_(k!T5_A(J3GIpG#Ms0=iQ{tu=WLoYoaCBRmULsT z<=mpV7v|~C%bs^USv6UZd^m-e5|^?+<%1wXP%juy<)>~<9TW0|n}ttBzM_qyQL(qU zN<5P0omQ3hINdvaL;7fjPeygdGYL;pD|wL_lDQ-EO;$wK-mK5raoH_7l$?~Dqf!cK zmb5F^Ft;eTPi8AClM3W{=55LwlZVRpxOiFd;3B_8yA~shQx|tGF!j;$toK>JuS&gYLDkTP@CvOP@r~sh zUu{a>bfJ1`^^VQ7&C1OKHDNXFTgC{M|V%fo{xK_dk6MK@9S!GZ*1JJ zzrV5xZBjOk9!NTH<(q(S+MDf~ceQX@Dh|Ry<-sT4rhI$jQ0Sq~!`#Eo-%($2E^vo}is5J@NVEf|KK?WT&2; zPCq@=ncR8zO#GQ^T~S@VXG71PKNocFOt)Y6$@AXlk6rM*aP%VgV%sIRORYVwJx6|U z{ozQjTW{-S_si{9Jg#)~P3t?+@6&(!YQWWV*Z9{iU7vZq@5byKw{9lg9JnRA_4s!7 z?H6|n?o8ZWdXIRo{Jz@#>IeD{>VLHUv1Pz*;P_y`V9&!@5AO~Mho1hF|I>%z(nrik z)gwkDjgOrl9~%l9z4Bzvli{bbrxVZ0epdf^>vOB;-~HnIOV3#R*zgPai_gEVd8zYq z@2jb=I>#f&AH2?aJ@Kaetz@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzAFaQAR zU;qF*m;eA5Z<1fdMgRZ_TS-JgRCwBymuYNV*LBB#=iax?n-OO?q)c%}TtreNC0Vj1 z+1e}@Fk>i6ECeXBAxZ6`MLz_n8Y6|#80d#KU;8Br5FkL&0&N{MD4N2~7u&H4d5>+V zl1Xc~Ws#z|itCV^{k?npVMdgksA&6ui+dm5@_XmpbN=T%dG5LA01y$DmzSBHouyDH zP%4#}pPy%DW`=Y+O|4c<`JR*4N;;I-R)G|Ng$iS3B{p`xT8pMV&)+B%3gmJ*IyyQC z!;o}3O=o8(*=!bTEdUPx!(pvOL}Xh>M_1SO&d2gyy(8Jqfqh=8W4jY%wkj{_0+?E{ z9#vKsY8&%Y%d^)%nZ7k~=GN5g`yz77-l5#*xG&fkgS93*Jhby%`@p8<%pa{+UDhl}q2;IeG4b`RVZ&7MGS^HO4IeU%|?CbnnpM z;InPLkN%OHe>_WS2WTHG2nKA7*ofvHftvs~3Bgu$W;os6e&A%wws#M;O`QG3+}zwx zfeFCe3(?1p9oyXFQmLe@i67q9x&6o4p_6~&_MS|rR2QNwA_gHw#3It*i4v565`&0E zNsQ7O6+VE@^e2*GcsQvx^4R#g=lkgK;c@W2S zP-0Pzhi=)9vh`gQr(M@|&-e87toQf#qn~-^8EUnfw=h5ZU6bnmLAdj&!12R|TkpV> zAom@hlp>q!C#sgXdGT%5m!`<|@5k}nhWi~4zomntdtV$jd_pos2TDT301saFwYaUAEa_04PA(RB9h#R50R&QMyrP3OQqT+c&m zORSSzTh_sr%8g8WYs*Xg^LC9X=_5)0VBh-cNNYCxiK9ijO6BTE z(78Ksg9O$@EKFSC;(ISLcjH1M=ez(fNP;!gtEJyTHgiy^&Fm7OUfsacF{Q|GW2p{a zz)E5$SSx)nqDB7G0W(-87z(%cpk2k)4`1iMUinu{T&J^d4}JTN)0XciY{?>`p!s5B z8W3!QrnO@9%)fK#x3AFIzn773{RPHNaDK8zF|q`KqGG#Q+&DL+#SA)1=r>NXEl9Pn zc35V;dGQiyv~cmgmoRaiuHpS0e(HNTuKznwi&)td5CfEJ zF;_l(osZvsiI%Qi41DDWTqy+16zb^wKH{-gsTNo8wzSgm*dJ4oL|QA!JC4@vIKHaa zN-RuXLj(r)AH`1uG&K@Iz*_3DP^}xPMle_kRYPH|!m^tqcjAYrY%ia0B#6bJ9U+_V zCVKP~)9?I(;?yX@w~4f;T&>$3&vQHkY+MB_qQDChXa}@30%olmv0ApQlr4oSRO*(R zu?q2xUD!H^qZ)gln}TDTai2)Hq7+D6LrWQ@z;Qj#@q@79uxL~1v}7LWWZ~B5%wGS5 zT?da+iQ)Qk#BwoWdh~6k$KIl4$3x@}e+tKUP=GNOv0#)%jDn`JHA8{=%1x9O{B(ve z6_Qwrtsevx6^6+rPolE#J3RcvDT3q{CN6%&$LBuc+(N{3*>ZF2O|HHA514w9+}^{4 zDVKz=@O?!PC|qCTdm29wd|&W=h36|uGnZMo@Fq$L`9mj3rd-l)Tuy|^C8s5wnGCh5 zM3uF0_mL;awzsoXi5V|CB$Tjz?QL$p@h@b$2YB#Xe@T#OZ}`#LW-co%7Hb6&LBwL? zh`G^s7=P}iK*|uCa+5X*3Eytt^ z+&*`P&tCo~l!nd+4^dv6pg8+!BZZpzWJNGhM0KM8^(w{18H)3hY|KvrLgz!r*z@)8 zqZ0wq%p^P7Q_C%x)+>(h2Nwnh`bNjkT^p!YA7Q%Y5IKTVTIKUMehH?IQkvjR3-4DJt zcIoPuX2!3y7JCm6N*zhGao~HW8U5wYsF#cEIDUfG-XTmJ-6NS6L9lU5wOAmI>LgmS zB)8^h$@Sdn-Vnznp1Q!`7FLFKJ@{H84A&js_pR^yFCRMa&^Lbd&bbrzfgXZP8#a#V zI`9aN^XHuX=btb;`Yydk9%oBO{+^DIyWxA^juCKN>Z^;iOrGc19~?ZJX>ENOu*zCX zwOXAX-nHlFM+fp#@#qPs-TurV7^cYEs-pFT1dD#edp=TM@y_SDIfKXrZo1!GJU z$1zeam+viY+0w@P-@N?V8-I4TXv3CcPvT|U8>PtFFV^7Z>87`B^O{nih1${*YrlP+ zN0UWL@+F-&dw@x86?7r@q9JkQITDEi@I*b7=VQ5cyTL zTCEym_+P=E=V6RNYdsJ}_3w^LP|kK3)|C4cJCY< z-LZ4vMaOafEso>sN-1i!8vie_h}>yuwgJb>8|z0m3WYu8QfWu6R^1BVdHzBo498RH r^rb{<%Ll-Fz+B@usPVr0f&Y5|fhPI3-#StO&>uS)ve<0AYj>5AR{$W90N^4L=L-Rl zQUJ&DC0@ZjPh;=*jPLSYvv5M~MF zBAl0-BNIsH15C~g000{K(ZT*WKal6<?_01!^k z@7iDG<<3=fuAC~28EsPoqkpK{9G%|Vj005J}`Hw&=0RYXHq~ibpyyzHQsFW8>#s~la zM4*8xut5h5!4#~(4xGUqyucR%VFpA%3?#rj5JCpzfE)^;7?wd9RKPme1hudO8lVxH z;SjXJF*pk6;1XPc>u?taU>Kgl7`%oF1VP9M6Ja4bh!J9r*dopd7nzO(B4J20l7OTj z>4+3jBE`sZqynizYLQ(?Bl0bB6giDtK>Co|$RIL`{EECsF_eL_Q3KQhbwIhO9~z3r zpmWi5G!I>XmZEFX8nhlgfVQHi(M#xcbO3#dj$?q)F%D*o*1Pf{>6$SWH+$s3q(pv=X`qR|$iJF~TPz zlc-O$C3+J1#CT#lv5;6stS0Uu9wDA3UMCI{Uz12A4#|?_P6{CkNG+sO zq(0IRX`DyT~9-sA|ffUF>wk++Z!kWZ5P$;0Hg6gtI-;!FvmBvPc55=u2?Kjj3a zpE5$3psG>Lsh-pbs)#zDT1jo7c2F-(3)vyY4>O^>2$gY z-Gd%Qm(Z8eYv>2*=jns=cMJ-K3WLW;VkjAF8G9M07`GWOnM|ey)0dgZR4~^v8<}UA z514ONSSt1^d=-((5|uiYR+WC0=c-gyb5%dpd8!Lkt5pxHURHgkMpd&=RhJ{9;hDf7SW4Fc`jUg7sGG*~tLe_Ft1M4hn zm`!3^via;xb_M$zb}xHOQ$usAW~^qBW}W77%>fR^vEcAI*_=wwAG2sV%zY%w@v@XU~7=xdm1xY6*0;iwVIXu6Ta zXrs|dqbIl~?uTdNHFy_3W~^@g_pF#!K2~{F^;Xxc zN!DEJEbDF7S8PxlSDOr*I-AS3sI8l=#CDr)-xT5$k15hA^;2%zG3@;83hbKf2JJca zVfH2VZT8O{%p4LO);n}Nd~$Sk%yw*Wyz8XlG{dRHsl(}4XB%gsbDi@w7p6;)%MzD% zmlsoQr;4X;pL)xc%+^yMd)ZNTI#eJ*$O)i@o$z8)e??LqN_gLa_ z%;TM>o2SC_kmoO6c3xRt`@J4dvz#WL)-Y|z+r(Soy~}%GIzByR`p)SCKE^%*pL(B% zzNWq+-#xw~e%5}Oeh2)X`#bu}{g3#+;d$~F@lFL`0l@*~0lk45fwKc^10MvL1f>Tx z1&sx}1}_Xg6+#RN3Rxd=lW)Km@*DYMGu&q^n$Z=?2%QyL8~QNJCQKgI5srq>2;UHX zZ>IT7>CCnWh~P(Th`1kV8JQRPeH1AwGO8}>QM6NZadh`A)~w`N`)9q5@sFvDxjWlx zwsLl7tZHmhY-8-3xPZ8-xPf?w_(k!T5_A(J3GIpG#Ms0=iQ{tu=WLoYoaCBRmULsT z<=mpV7v|~C%bs^USv6UZd^m-e5|^?+<%1wXP%juy<)>~<9TW0|n}ttBzM_qyQL(qU zN<5P0omQ3hINdvaL;7fjPeygdGYL;pD|wL_lDQ-EO;$wK-mK5raoH_7l$?~Dqf!cK zmb5F^Ft;eTPi8AClM3W{=55LwlZVRpxOiFd;3B_8yA~shQx|tGF!j;$toK>JuS&gYLDkTP@CvOP@r~sh zUu{a>bfJ1`^^VQ7&C1OKHDNXFTgC{M|V%fo{xK_dk6MK@9S!GZ*1JJ zzrV5xZBjOk9!NTH<(q(S+MDf~ceQX@Dh|Ry<-sT4rhI$jQ0Sq~!`#Eo-%($2E^vo}is5J@NVEf|KK?WT&2; zPCq@=ncR8zO#GQ^T~S@VXG71PKNocFOt)Y6$@AXlk6rM*aP%VgV%sIRORYVwJx6|U z{ozQjTW{-S_si{9Jg#)~P3t?+@6&(!YQWWV*Z9{iU7vZq@5byKw{9lg9JnRA_4s!7 z?H6|n?o8ZWdXIRo{Jz@#>IeD{>VLHUv1Pz*;P_y`V9&!@5AO~Mho1hF|I>%z(nrik z)gwkDjgOrl9~%l9z4Bzvli{bbrxVZ0epdf^>vOB;-~HnIOV3#R*zgPai_gEVd8zYq z@2jb=I>#f&AH2?aJ@Kaetz@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzAFaQAR zU;qF*m;eA5Z<1fdMgRZ_JxN4CRCwBymsxBb)fvZs=bYK@T$^j(*l}WC;u|M+?3irM zViJrRZVUk_4@3n~weUbe1(G$MskJz@InVFfPzP_Hix;k9fB^HaZ zbm>y!@il<(*E|G|XX;}bxrIML16zX%iT>Z%C$d-Y0`rf|2z7rRRhF+hVnmQDQ;ne>MmP)B) zOH0esn>KE||CX+aOHEA*t*csN>(_6%^VqRtTTXp; z>W%U7@jn7XK=@sV+O}=m!V7Y_oD70seIk)~Vdot?AH3s^osmQ$fe?aV9;kH)2!s#_ z0UCkUpo5SQjgpGRix<<>)D&^uXlFK?X$XQ~(6;Rf*L4>@y}J44o3GAAp-@;=QBm=H zcX#(sxBp~2Q8$Vo`16L9jS~ojoF9e2_kE5X`-pTpO=V>z6_pi)VMxSvX>4r7w#?NN z6BD&s>wh_pGpV&kYmIv1i6^iui|Og<`XC6N+qP}n1GjCz3fr~_!e9Zga0qdY0a8lN zoju3C{ri~sc7l!y9T}zanoLjMC1u`0q5{X1C&-3nH zo=o1?)zyV<+XO*)El7M1IzLJ&x$CaGNTpKr_4To5&mIbe0s=u01Xz|u*R5S75{dgf z&$~MkiCEES6t!#DE^@itnoK71+>Y+GCDku3d*U@A-}sVRm-b85tR=ip64|N-4(*rIfsKFw=hY;=@tHj9)J+p(`3mr@AA`LO-?HYSl$^8Wirc;ofg@qCZ= z_IA3ux@c-@A|8(;r9@m+wrj8gWk}w6`yCFxcaXJf*7DR-PhpxS!z07^zK3O*)YUEF z;>Dp=TI&`ASP_jz7sYO#{L2u0oE#h@WXqeFpV7@#!>K~+^%S>Ze%-}4bdVp*0Y zUDquHzOQ3d<(vtE(`U|~<2i`Job9H$_o(deY-`+37q?Ao=9%F0SUIr#~_A06ZJtJBeFbZThmVtm=MWwf@o zGCe&_5Crso)XQ6MzKIZmO`A6H%{RkbxNzZnNP+JM%*@T;l}e0_jWIkt%<%9q0G*wk zJp9l@xX~!*&Yt6j8*Z4YuC7iSj^mtZYHIr8%P+rNxpCtrf*?RjNhXtF@4I{Pd>^S4 zJx6=U<#XRxjeYLS#o~z88hKSXEXz8SN~K;_O3fba>7i6C;n)s_GPq^i zE!=zWy%>hUXPsuR!A<1NtWO6yx)m2nf zR9v&rOeVwh^fVVQUSw!!2q`5U9UZ4zTU&oGg!p^0SS*HN$d7_8%OVUzlu|1_&-?k{ z;Nb4_=g+UtX0!azUx^TcXf#SoOUoB4SFYS^n&w+U5DZEwDV0k6Utl51xffUhbj{7p zZJn8!Y0u?y%ZtTgEr4y?mt5Dq7>mWuRaRD>06qf7!!TTU-}S)%9su?d1TGe=kedJi N002ovPDHLkV1jTB{m}pb literal 0 HcmV?d00001 diff --git a/Icons/shuffle_blue.png b/Icons/shuffle_blue.png new file mode 100644 index 0000000000000000000000000000000000000000..c3f4c9dfa0dd77b09ef360f364bce5b1674dcd52 GIT binary patch literal 4876 zcmV+n6Z7neP)StO&>uS)ve<0AYj>5AR{$W90N^4L=L-Rl zQUJ&DC0@ZjPh;=*jPLSYvv5M~MF zBAl0-BNIsH15C~g000{K(ZT*WKal6<?_01!^k z@7iDG<<3=fuAC~28EsPoqkpK{9G%|Vj005J}`Hw&=0RYXHq~ibpyyzHQsFW8>#s~la zM4*8xut5h5!4#~(4xGUqyucR%VFpA%3?#rj5JCpzfE)^;7?wd9RKPme1hudO8lVxH z;SjXJF*pk6;1XPc>u?taU>Kgl7`%oF1VP9M6Ja4bh!J9r*dopd7nzO(B4J20l7OTj z>4+3jBE`sZqynizYLQ(?Bl0bB6giDtK>Co|$RIL`{EECsF_eL_Q3KQhbwIhO9~z3r zpmWi5G!I>XmZEFX8nhlgfVQHi(M#xcbO3#dj$?q)F%D*o*1Pf{>6$SWH+$s3q(pv=X`qR|$iJF~TPz zlc-O$C3+J1#CT#lv5;6stS0Uu9wDA3UMCI{Uz12A4#|?_P6{CkNG+sO zq(0IRX`DyT~9-sA|ffUF>wk++Z!kWZ5P$;0Hg6gtI-;!FvmBvPc55=u2?Kjj3a zpE5$3psG>Lsh-pbs)#zDT1jo7c2F-(3)vyY4>O^>2$gY z-Gd%Qm(Z8eYv>2*=jns=cMJ-K3WLW;VkjAF8G9M07`GWOnM|ey)0dgZR4~^v8<}UA z514ONSSt1^d=-((5|uiYR+WC0=c-gyb5%dpd8!Lkt5pxHURHgkMpd&=RhJ{9;hDf7SW4Fc`jUg7sGG*~tLe_Ft1M4hn zm`!3^via;xb_M$zb}xHOQ$usAW~^qBW}W77%>fR^vEcAI*_=wwAG2sV%zY%w@v@XU~7=xdm1xY6*0;iwVIXu6Ta zXrs|dqbIl~?uTdNHFy_3W~^@g_pF#!K2~{F^;Xxc zN!DEJEbDF7S8PxlSDOr*I-AS3sI8l=#CDr)-xT5$k15hA^;2%zG3@;83hbKf2JJca zVfH2VZT8O{%p4LO);n}Nd~$Sk%yw*Wyz8XlG{dRHsl(}4XB%gsbDi@w7p6;)%MzD% zmlsoQr;4X;pL)xc%+^yMd)ZNTI#eJ*$O)i@o$z8)e??LqN_gLa_ z%;TM>o2SC_kmoO6c3xRt`@J4dvz#WL)-Y|z+r(Soy~}%GIzByR`p)SCKE^%*pL(B% zzNWq+-#xw~e%5}Oeh2)X`#bu}{g3#+;d$~F@lFL`0l@*~0lk45fwKc^10MvL1f>Tx z1&sx}1}_Xg6+#RN3Rxd=lW)Km@*DYMGu&q^n$Z=?2%QyL8~QNJCQKgI5srq>2;UHX zZ>IT7>CCnWh~P(Th`1kV8JQRPeH1AwGO8}>QM6NZadh`A)~w`N`)9q5@sFvDxjWlx zwsLl7tZHmhY-8-3xPZ8-xPf?w_(k!T5_A(J3GIpG#Ms0=iQ{tu=WLoYoaCBRmULsT z<=mpV7v|~C%bs^USv6UZd^m-e5|^?+<%1wXP%juy<)>~<9TW0|n}ttBzM_qyQL(qU zN<5P0omQ3hINdvaL;7fjPeygdGYL;pD|wL_lDQ-EO;$wK-mK5raoH_7l$?~Dqf!cK zmb5F^Ft;eTPi8AClM3W{=55LwlZVRpxOiFd;3B_8yA~shQx|tGF!j;$toK>JuS&gYLDkTP@CvOP@r~sh zUu{a>bfJ1`^^VQ7&C1OKHDNXFTgC{M|V%fo{xK_dk6MK@9S!GZ*1JJ zzrV5xZBjOk9!NTH<(q(S+MDf~ceQX@Dh|Ry<-sT4rhI$jQ0Sq~!`#Eo-%($2E^vo}is5J@NVEf|KK?WT&2; zPCq@=ncR8zO#GQ^T~S@VXG71PKNocFOt)Y6$@AXlk6rM*aP%VgV%sIRORYVwJx6|U z{ozQjTW{-S_si{9Jg#)~P3t?+@6&(!YQWWV*Z9{iU7vZq@5byKw{9lg9JnRA_4s!7 z?H6|n?o8ZWdXIRo{Jz@#>IeD{>VLHUv1Pz*;P_y`V9&!@5AO~Mho1hF|I>%z(nrik z)gwkDjgOrl9~%l9z4Bzvli{bbrxVZ0epdf^>vOB;-~HnIOV3#R*zgPai_gEVd8zYq z@2jb=I>#f&AH2?aJ@Kaetz@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzAFaQAR zU;qF*m;eA5Z<1fdMgRZ^DoI2^RCwByms^ZoRT;;B-&$+0eL1Id=2oXO(_uR8bXp2Q zWC8@*0#30ZJ{Tl57?d|3y(YxO@L=@C#1~`qfd}3+zDS}m5wSp3q>#`QDuhd+wxySu z4((jd%(?A-&R)xheL6i8iqVyPS^Ki~`hS=I_pNWsQ%^kwfQYcXyv)MF0@Z4jMx(*v z;v)0&^HeGovMeo!){JW$KpDV8&3ReLonK6|&Sh)ETD4kbY;25?kr9$4p;D_uJ-Z(n8J~J`;Fj6@)WB^O;&Hr* z5uM;v&|RDbCU1@fd1I`+YyO_`m3P0k`@+fB7cZat&9$ZF7o2m;|0}QxjNY+lX6AcC zJMR8wFn(~5@)YP0JO~baj`$AU7(oz2P=aVHx_@tFc=)bI`nLV^o}u$6etYH0m0tqq z0r#1}-g{L_;yXu1Mt@YEdgzEA-H+G-yl(@YBBB7o2B>&|9FIfrUc zThvyrpp?dYkFg;;Zhz$b6RVqw8%uGna)Mq_C-Myqcj*T zXbMUf3TQ3eSrzoU4y=mV7=;NGHV^_M1V&*r#G%mWIL}cFo_G2-^eJmmcq3nMN&DB)rv;ucypmmz2k`@ zMa$p9wc5!&THK6L!Y*e@Ls7X8tvz0flsWyzU&&gHO_e3-s}O|I_4F&MjS@^C_-=fS zcod3jwVbyuw^?p@l1SmiBk>mMYsrw&vdbu?#>K`JTPlNhpac)tIH8?x2DYK4C7@J~ zBY-q_v~y1_^Q0YEZF%OaIcW|_bYrm#%Csb|XeHyuXg!Pxm5n3vwBBP$w{G<0lLs>A zY3Idt+j*L;oc9*nq`9Zrfvh9s0@?^A+nd@#ZX!C`szB>uW391B!Af$4;PD6|g&P4n z&eP643w6g*-LaN=ocDMjj4bmD7g;>@myOyX0w&(V#Dm|!_f%PD1*O0Q)|xO%T83-h zyHt!3yf3uVN^n5E?P+%$-b1zR$ta4Mh@b#tExxtH$_KA>Uvvp)V|E>WauW+3ZDN!A zFp63xNlHsrI!)hhBqlE5U5-)E%AuNhI<8kdP2#=^l6$VEj%vGbrO~ocyiA}lffOL!m@5i4x)Bx% z9Z^~~11m$PvCdHBTIIg}3#u|O@cy>`(sKQi^8^~2-gCC*Ko$9^6lg^^HiGIt6IFmJ zEto(R_X<>(8(M=3RaXQXfnB@6)NpyZuYcfu6^79}Gt)ayWmo=9nl`wcLB|MMT(Oao z3NZ$Z_Qk#KJ{OM)Kwn>XT`?SCNFk9z`xbrGv+Uiy^OOpscT}lVTEBJQ?MJsoer5jL z`_zMgBv#lY!Gv~0LN((nk@3YdWQ>NWZ)Xo@egz#S_`JQj!|py<}=u6)^QTIvT{SRXYhrzkR+TQ-gZ|)O{y!HjP zwU8|>vG&@F++C8!mk&SuY*OCxlipT$6R`IlYwe)xbbfH`Z^yoU{M_aK_TDd$Oz$Ho z#V9Gx5uD%nBR~XEf~Z2bcD+gc%zFeMyv6>h@zuF6&iz^$^NTFYmU~aNPXQ~X2*WVM z`y(Hn{@{nNo_zC;vrR{P`wqg19fW-Ym~t5tbxGHPPOV0|wnBRGJi(>&?2Hu$X774? z_ny5!N94IQP1Bxk_OpSlwK(U{T2FU6?I+HCbmpt?ee~g-m#TGEb5G4dt7~y2LRmq- z7PePP?AtwaYHIiNAB+ipm*@Ezr4(6~@qYn}2&y=Iw*d#5we|aI)#`1{Mq?_=(yaj2 yhF9YxIajV!-i^y!UI$(Ut`xsP#eO#f{?7mbb7>k9k9UCp0000StO&>uS)ve<0AYj>5AR{$W90N^4L=L-Rl zQUJ&DC0@ZjPh;=*jPLSYvv5M~MF zBAl0-BNIsH15C~g000{K(ZT*WKal6<?_01!^k z@7iDG<<3=fuAC~28EsPoqkpK{9G%|Vj005J}`Hw&=0RYXHq~ibpyyzHQsFW8>#s~la zM4*8xut5h5!4#~(4xGUqyucR%VFpA%3?#rj5JCpzfE)^;7?wd9RKPme1hudO8lVxH z;SjXJF*pk6;1XPc>u?taU>Kgl7`%oF1VP9M6Ja4bh!J9r*dopd7nzO(B4J20l7OTj z>4+3jBE`sZqynizYLQ(?Bl0bB6giDtK>Co|$RIL`{EECsF_eL_Q3KQhbwIhO9~z3r zpmWi5G!I>XmZEFX8nhlgfVQHi(M#xcbO3#dj$?q)F%D*o*1Pf{>6$SWH+$s3q(pv=X`qR|$iJF~TPz zlc-O$C3+J1#CT#lv5;6stS0Uu9wDA3UMCI{Uz12A4#|?_P6{CkNG+sO zq(0IRX`DyT~9-sA|ffUF>wk++Z!kWZ5P$;0Hg6gtI-;!FvmBvPc55=u2?Kjj3a zpE5$3psG>Lsh-pbs)#zDT1jo7c2F-(3)vyY4>O^>2$gY z-Gd%Qm(Z8eYv>2*=jns=cMJ-K3WLW;VkjAF8G9M07`GWOnM|ey)0dgZR4~^v8<}UA z514ONSSt1^d=-((5|uiYR+WC0=c-gyb5%dpd8!Lkt5pxHURHgkMpd&=RhJ{9;hDf7SW4Fc`jUg7sGG*~tLe_Ft1M4hn zm`!3^via;xb_M$zb}xHOQ$usAW~^qBW}W77%>fR^vEcAI*_=wwAG2sV%zY%w@v@XU~7=xdm1xY6*0;iwVIXu6Ta zXrs|dqbIl~?uTdNHFy_3W~^@g_pF#!K2~{F^;Xxc zN!DEJEbDF7S8PxlSDOr*I-AS3sI8l=#CDr)-xT5$k15hA^;2%zG3@;83hbKf2JJca zVfH2VZT8O{%p4LO);n}Nd~$Sk%yw*Wyz8XlG{dRHsl(}4XB%gsbDi@w7p6;)%MzD% zmlsoQr;4X;pL)xc%+^yMd)ZNTI#eJ*$O)i@o$z8)e??LqN_gLa_ z%;TM>o2SC_kmoO6c3xRt`@J4dvz#WL)-Y|z+r(Soy~}%GIzByR`p)SCKE^%*pL(B% zzNWq+-#xw~e%5}Oeh2)X`#bu}{g3#+;d$~F@lFL`0l@*~0lk45fwKc^10MvL1f>Tx z1&sx}1}_Xg6+#RN3Rxd=lW)Km@*DYMGu&q^n$Z=?2%QyL8~QNJCQKgI5srq>2;UHX zZ>IT7>CCnWh~P(Th`1kV8JQRPeH1AwGO8}>QM6NZadh`A)~w`N`)9q5@sFvDxjWlx zwsLl7tZHmhY-8-3xPZ8-xPf?w_(k!T5_A(J3GIpG#Ms0=iQ{tu=WLoYoaCBRmULsT z<=mpV7v|~C%bs^USv6UZd^m-e5|^?+<%1wXP%juy<)>~<9TW0|n}ttBzM_qyQL(qU zN<5P0omQ3hINdvaL;7fjPeygdGYL;pD|wL_lDQ-EO;$wK-mK5raoH_7l$?~Dqf!cK zmb5F^Ft;eTPi8AClM3W{=55LwlZVRpxOiFd;3B_8yA~shQx|tGF!j;$toK>JuS&gYLDkTP@CvOP@r~sh zUu{a>bfJ1`^^VQ7&C1OKHDNXFTgC{M|V%fo{xK_dk6MK@9S!GZ*1JJ zzrV5xZBjOk9!NTH<(q(S+MDf~ceQX@Dh|Ry<-sT4rhI$jQ0Sq~!`#Eo-%($2E^vo}is5J@NVEf|KK?WT&2; zPCq@=ncR8zO#GQ^T~S@VXG71PKNocFOt)Y6$@AXlk6rM*aP%VgV%sIRORYVwJx6|U z{ozQjTW{-S_si{9Jg#)~P3t?+@6&(!YQWWV*Z9{iU7vZq@5byKw{9lg9JnRA_4s!7 z?H6|n?o8ZWdXIRo{Jz@#>IeD{>VLHUv1Pz*;P_y`V9&!@5AO~Mho1hF|I>%z(nrik z)gwkDjgOrl9~%l9z4Bzvli{bbrxVZ0epdf^>vOB;-~HnIOV3#R*zgPai_gEVd8zYq z@2jb=I>#f&AH2?aJ@Kaetz@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzAFaQAR zU;qF*m;eA5Z<1fdMgRZ^2}wjjRCwByS4(UZ$r=9Y(N+Bzdpv{jV0(}U1A_`^c{odW z7_k~G*aL@M0wO}mAySTsl1M1mWOK|Viju<~_Le9I6e&4mSBQYwLjWO&@xo#d@?!I} z3e5O5(=+|5%AtG4_5w;$qf%FQSJ(G{|Ns4e)sS=N&H(@jA*fU;n3r#l=PR^z(^`WNLUOs>#_sO!Lxn=2v}N;__quXj`Hqf`^^WZrfJV)AgN22K zS1;#YKAZez^3L@1^ytjY%vD0jQ{6;)OM5G@QVL3`?AEPYKipI({BZByy$1#d2h%-0 zy|67CmSw^a0ss*BzEN*9dR*7-dH&-0z6ba3pB@_fR)vNn%{rlFR zXJ==B4`3RAS_;Ar9z57uz;#_3MbYkjKL5$_W5<7V?AUQDpU;C3f+zvhS^*#+gn$r0 zgFtIQM+yoWj52g}b)mn%-?DAzyR}-iH;ST3Ddn7P+b!3#{rmSf$E49{Y)hq5zaAMG z`Q8UdK7eC82%|7DEH;jSfY9VhzSU!~K`8~xw$azu2Pus0b8~a+wboymrdifnLu(2? zG&F>Axs1n;A9ovu@$&-*4xBtZd>BF)2%`vukTr1_|7skwbF*NSK|@0di6cjjtO^zZ zl!{O&14Y-0SKju9@Z{;^X5(5yLYd3Z<;2~eE$pp0tyP6ToIcJtu@-)(luE^%5auBUeflO)0k(`U;?wCaD6PKYt#zT5U}wJ9Ov} zY};PzeS#Q_Y7k9;#L$-1=C*EMJl|}@O&=25w9vY1XmaEH9O0_gW2!Z1`5JIFW zrM;Xn)+vObmT93@uYu^;db}+~v_=#uD5YAvOb`TEu2m6+5dzOcz0p7vMPQ79GX~v? zhlVLl7=}R^W1XCHE}9lK*(S4F`KfdaR;#)#0HIi~1 ze0=g`VsLyhxDks^2*GXJZj@iY*1qo(Mktil0MVd?Kx>UK3|kC+&qo+VtBfKLhQR#% z0&d*6vBo);W#QE6(<>1n1d)oMwbG_(Hn`(BJ3P{X? z(U|cYz>LM9l&<=Qf-?rrISkIhILGYF4BFe z7_cl0Qp#2*gg^)Z(=(;Rf8#bV`vlCmlZbesDS4$lAdL3O|U0{r1U|;}-5YS4Yv$GTJ z?d>QQi!e3VhFpDNS(3N|gX1 z0B0PpUcJJlOP4??bw@@@s}uyCMl)xeINf9aI-Q2 z*Z^R7d3pK3;^N{C*L62}p0_^PqhHy!J(W(U@3pnHT?gg000SaNLh0L01FcU z01FcV0GgZ_000V2X+uL$P-t&-Z*ypGa3D!TLm+T+Z)Rz1WdHzp+MQE(Sd;e_KHv9c z4^~3h@UfR{fdC>StO&>uS)ve<0AYj>5AR{$W90N^4L=L-Rl zQUJ&DC0@ZjPh;=*jPLSYvv5M~MF zBAl0-BNIsH15C~g000{K(ZT*WKal6<?_01!^k z@7iDG<<3=fuAC~28EsPoqkpK{9G%|Vj005J}`Hw&=0RYXHq~ibpyyzHQsFW8>#s~la zM4*8xut5h5!4#~(4xGUqyucR%VFpA%3?#rj5JCpzfE)^;7?wd9RKPme1hudO8lVxH z;SjXJF*pk6;1XPc>u?taU>Kgl7`%oF1VP9M6Ja4bh!J9r*dopd7nzO(B4J20l7OTj z>4+3jBE`sZqynizYLQ(?Bl0bB6giDtK>Co|$RIL`{EECsF_eL_Q3KQhbwIhO9~z3r zpmWi5G!I>XmZEFX8nhlgfVQHi(M#xcbO3#dj$?q)F%D*o*1Pf{>6$SWH+$s3q(pv=X`qR|$iJF~TPz zlc-O$C3+J1#CT#lv5;6stS0Uu9wDA3UMCI{Uz12A4#|?_P6{CkNG+sO zq(0IRX`DyT~9-sA|ffUF>wk++Z!kWZ5P$;0Hg6gtI-;!FvmBvPc55=u2?Kjj3a zpE5$3psG>Lsh-pbs)#zDT1jo7c2F-(3)vyY4>O^>2$gY z-Gd%Qm(Z8eYv>2*=jns=cMJ-K3WLW;VkjAF8G9M07`GWOnM|ey)0dgZR4~^v8<}UA z514ONSSt1^d=-((5|uiYR+WC0=c-gyb5%dpd8!Lkt5pxHURHgkMpd&=RhJ{9;hDf7SW4Fc`jUg7sGG*~tLe_Ft1M4hn zm`!3^via;xb_M$zb}xHOQ$usAW~^qBW}W77%>fR^vEcAI*_=wwAG2sV%zY%w@v@XU~7=xdm1xY6*0;iwVIXu6Ta zXrs|dqbIl~?uTdNHFy_3W~^@g_pF#!K2~{F^;Xxc zN!DEJEbDF7S8PxlSDOr*I-AS3sI8l=#CDr)-xT5$k15hA^;2%zG3@;83hbKf2JJca zVfH2VZT8O{%p4LO);n}Nd~$Sk%yw*Wyz8XlG{dRHsl(}4XB%gsbDi@w7p6;)%MzD% zmlsoQr;4X;pL)xc%+^yMd)ZNTI#eJ*$O)i@o$z8)e??LqN_gLa_ z%;TM>o2SC_kmoO6c3xRt`@J4dvz#WL)-Y|z+r(Soy~}%GIzByR`p)SCKE^%*pL(B% zzNWq+-#xw~e%5}Oeh2)X`#bu}{g3#+;d$~F@lFL`0l@*~0lk45fwKc^10MvL1f>Tx z1&sx}1}_Xg6+#RN3Rxd=lW)Km@*DYMGu&q^n$Z=?2%QyL8~QNJCQKgI5srq>2;UHX zZ>IT7>CCnWh~P(Th`1kV8JQRPeH1AwGO8}>QM6NZadh`A)~w`N`)9q5@sFvDxjWlx zwsLl7tZHmhY-8-3xPZ8-xPf?w_(k!T5_A(J3GIpG#Ms0=iQ{tu=WLoYoaCBRmULsT z<=mpV7v|~C%bs^USv6UZd^m-e5|^?+<%1wXP%juy<)>~<9TW0|n}ttBzM_qyQL(qU zN<5P0omQ3hINdvaL;7fjPeygdGYL;pD|wL_lDQ-EO;$wK-mK5raoH_7l$?~Dqf!cK zmb5F^Ft;eTPi8AClM3W{=55LwlZVRpxOiFd;3B_8yA~shQx|tGF!j;$toK>JuS&gYLDkTP@CvOP@r~sh zUu{a>bfJ1`^^VQ7&C1OKHDNXFTgC{M|V%fo{xK_dk6MK@9S!GZ*1JJ zzrV5xZBjOk9!NTH<(q(S+MDf~ceQX@Dh|Ry<-sT4rhI$jQ0Sq~!`#Eo-%($2E^vo}is5J@NVEf|KK?WT&2; zPCq@=ncR8zO#GQ^T~S@VXG71PKNocFOt)Y6$@AXlk6rM*aP%VgV%sIRORYVwJx6|U z{ozQjTW{-S_si{9Jg#)~P3t?+@6&(!YQWWV*Z9{iU7vZq@5byKw{9lg9JnRA_4s!7 z?H6|n?o8ZWdXIRo{Jz@#>IeD{>VLHUv1Pz*;P_y`V9&!@5AO~Mho1hF|I>%z(nrik z)gwkDjgOrl9~%l9z4Bzvli{bbrxVZ0epdf^>vOB;-~HnIOV3#R*zgPai_gEVd8zYq z@2jb=I>#f&AH2?aJ@Kaetz@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzAFaQAR zU;qF*m;eA5Z<1fdMgRZ_z)3_wRCwB~SWQqI#})owchAqV?85Hyx3C6D5taZ+mQWSA zWXBPuNQqsxlem=1&($g)l0#1RB^MoXvM;$f2bWUii<7uWoK)F~EA~`%P0yR|*I&Q)`u#LXDRHk45$OPe02%=305kvs z00-a#Z~){0SO81_TT)8vp4a)Z;E0HY!{KIK*CXBC-G}1w_=(2G#zU&A9uPt#7-KOa z3Q8%rJkLuxjU8#3|SX=xrc922w%**8n#Mna@I6DZpBR+`0-kJD=RnuDzE|r!P-WPyb!h zw6&R;nbcPTck0xsz}D7QM^8`B*+?Yvm>xawD3A23toabAp#zWr2p|9@HdM*MCz{J} zH?G4?Pute|+?(li`fu~|^JBqaaQXfB-`~Dxa3dol&G~%3Yu~U zNQ+dhTLnhef~%&jA{#@%A{Jxs_7FeLIy!(2Z+e2D~e$5~Wc;*W1+ixSc{K;Qz z+kR11)lV*6y0pG4xM!bzHki$3`#jHkPHjK_L$&AIV0yI5en=7|m32yG8CB!-KV%AM zB7&3>M1W_dk-Pa%*em}YWsE%^3Wa7~c;SVu;&4&3=lzVar+MVydA;W}craR)f~*t| zRd*#SP6n#gy+ie7UMv^|dQO8}^So=!r2xDL;6KHotk}7D@nXVt-N&FdJsG&~6p2tf z7$Y!F<#)ZtYWt`|BcSw+s()&@9f9ssWb>vcUDti=;>C-JDsZEtqdXW4?$77*XSMi= zPOa@QI45w9!eTx%?l*Rq#%sWX1A+m>ivKEj3P5Q&j8wzX&U`+9HW&=<9~~X#CAAuc z(QO#U<7jAqB#;;c=Oqg(ixxF1qg|Ynq-xvuB&c|bi##hVKrn`-3J15;V+fkFk2D#^ zALB98y zO}Vf{1nc_!YMXiGB(b3VUP*t_VFpMLjDG}2m@d{Iv z70v=xp{kxriyn!Jzp3Jw`r{cd@*oHTR!tAnck>{#-UrU>yNfDsK-F%f7H4%dD;P*|4ig0%<_uWMxcF!x4;z50P>KI`pbMt?**;y@ z+l8Vi9hPNvHa2(EfZHu~szpy`Eg=NeJ@9Tr z3+xrUMOD?P&@?ULI8I1yY%18qj)zr2tpz7#wfD$560TbSC8dNb0apT^B+RTiAObXn zc5y`nurM6Q32B-Z5kiPY*L5{T5A3B(NC1q=l5xF4b36%85?tv^2@)ttuG%REblTxA zci5_;!*yLv2+=51RVB`OPP#dbt9l8FtWYq4z!_lXC2Uv1@qoM!&XdJNYG*JdsuVRr zsH}eWBFkDK#{%a(r>ZImA%v~#`nH=hG)33_u>@9hz&`V(tc%&S3o|cEQjryF6Hz%6 zkyMermFYquV2|Je0Nl<(*Y#~7ge`;+Mko~8%xBh`gVBzvO$h?F^1!vUgF9P=n#7~B zy-<}(sFb%!Di~s|PgGPYkA|u?)tKly=G(U^x;~ zX&337gr+eNBpA^iTQAHdKLf6$6G^BF?buRnZmO8eh{a+VMNw7+=X|lNt1GiKy8vPY z@&j|um6$R-m;f4dR$heN%@J10p~?wCD0iPMj74-E>B?}<7a0-F_V)HBkzL)k)|bFo zf%8q%gDC-BV^CBEMI|VzpO5X*h!t|VVmxJ)v6Z2UPoZD=O;EOy2-|Dhy}i9jBAOMQ zot+DcqFhOIw4U6!G2PwNmcVk(!@3LTy1(-ZPfv_?%{+?Xl>Cq(Ya)oE)Jn73a^><2 z_QzXSR6e{0YlGZCzQK!(7 zRF)3ktuU*sX93t>e2D(`@ao{;;9E^iP486J5IF#2LqkJ%+@SeuA&82m_-!wm zq7a0-b6o8l;g2iQusDtIo$J=n(9j(KV?Lg8_0`nWG}hPG_ewIE{KY>e-|3`i6uc$A z`*AE5)peD$S7ux^%);AUOCmq{E=G>^ulM!!y%G!t$Lf}boby-DoH_Ff!!XW&^x;^v z@tco>H^=tK*r;9wy*E%vr4!m;VYceW#GF3%~jj@Eh~rK8>S1u1FKC&^VR*3V|ztmtMx!Zf-s|Ha7O~#NtY0Xy`No_a7-}l6Fy{tO^q4Fjc%ap>i5wU7tku z%G(%Dv~Hd~d-if;W8?F>u8)7|TPDYG9+Fc2Y-&~JV2JoLcP?U9j@*NNyiLWuYNpUcAoj^jK%J3IT##Kc7Cv!xYP>m8tm z!$+aT6ZM^O9p9KsF2elpByyim$zz>u_VDm<_Ta&TF9{)j3t;Xm-E6w9`vU+!o|>9^ zVsdg)Oy9W4tx%L{i5_SjT~K0e5aA{;O^27W;A9NsQ!B_V-$rh69(s1&>)*f6J$m%0 zGcYjlI)FcL&j0+i-3bE-xUTyI5q&3>NO2JnECvJb$10Brz50I~p9 o0Nfy=833OGm;i9?UKjb_05nYevey7)m;e9(07*qoM6N<$f(RHNq5uE@ literal 0 HcmV?d00001 diff --git a/Icons/stop_gray.png b/Icons/stop_gray.png new file mode 100644 index 0000000000000000000000000000000000000000..45235753e2161841cc722cbbe5e4a21454467f6a GIT binary patch literal 5302 zcmV;n6iMreP)g000SaNLh0L01FcU z01FcV0GgZ_000V2X+uL$P-t&-Z*ypGa3D!TLm+T+Z)Rz1WdHzp+MQE(Sd;e_KHv9c z4^~3h@UfR{fdC>StO&>uS)ve<0AYj>5AR{$W90N^4L=L-Rl zQUJ&DC0@ZjPh;=*jPLSYvv5M~MF zBAl0-BNIsH15C~g000{K(ZT*WKal6<?_01!^k z@7iDG<<3=fuAC~28EsPoqkpK{9G%|Vj005J}`Hw&=0RYXHq~ibpyyzHQsFW8>#s~la zM4*8xut5h5!4#~(4xGUqyucR%VFpA%3?#rj5JCpzfE)^;7?wd9RKPme1hudO8lVxH z;SjXJF*pk6;1XPc>u?taU>Kgl7`%oF1VP9M6Ja4bh!J9r*dopd7nzO(B4J20l7OTj z>4+3jBE`sZqynizYLQ(?Bl0bB6giDtK>Co|$RIL`{EECsF_eL_Q3KQhbwIhO9~z3r zpmWi5G!I>XmZEFX8nhlgfVQHi(M#xcbO3#dj$?q)F%D*o*1Pf{>6$SWH+$s3q(pv=X`qR|$iJF~TPz zlc-O$C3+J1#CT#lv5;6stS0Uu9wDA3UMCI{Uz12A4#|?_P6{CkNG+sO zq(0IRX`DyT~9-sA|ffUF>wk++Z!kWZ5P$;0Hg6gtI-;!FvmBvPc55=u2?Kjj3a zpE5$3psG>Lsh-pbs)#zDT1jo7c2F-(3)vyY4>O^>2$gY z-Gd%Qm(Z8eYv>2*=jns=cMJ-K3WLW;VkjAF8G9M07`GWOnM|ey)0dgZR4~^v8<}UA z514ONSSt1^d=-((5|uiYR+WC0=c-gyb5%dpd8!Lkt5pxHURHgkMpd&=RhJ{9;hDf7SW4Fc`jUg7sGG*~tLe_Ft1M4hn zm`!3^via;xb_M$zb}xHOQ$usAW~^qBW}W77%>fR^vEcAI*_=wwAG2sV%zY%w@v@XU~7=xdm1xY6*0;iwVIXu6Ta zXrs|dqbIl~?uTdNHFy_3W~^@g_pF#!K2~{F^;Xxc zN!DEJEbDF7S8PxlSDOr*I-AS3sI8l=#CDr)-xT5$k15hA^;2%zG3@;83hbKf2JJca zVfH2VZT8O{%p4LO);n}Nd~$Sk%yw*Wyz8XlG{dRHsl(}4XB%gsbDi@w7p6;)%MzD% zmlsoQr;4X;pL)xc%+^yMd)ZNTI#eJ*$O)i@o$z8)e??LqN_gLa_ z%;TM>o2SC_kmoO6c3xRt`@J4dvz#WL)-Y|z+r(Soy~}%GIzByR`p)SCKE^%*pL(B% zzNWq+-#xw~e%5}Oeh2)X`#bu}{g3#+;d$~F@lFL`0l@*~0lk45fwKc^10MvL1f>Tx z1&sx}1}_Xg6+#RN3Rxd=lW)Km@*DYMGu&q^n$Z=?2%QyL8~QNJCQKgI5srq>2;UHX zZ>IT7>CCnWh~P(Th`1kV8JQRPeH1AwGO8}>QM6NZadh`A)~w`N`)9q5@sFvDxjWlx zwsLl7tZHmhY-8-3xPZ8-xPf?w_(k!T5_A(J3GIpG#Ms0=iQ{tu=WLoYoaCBRmULsT z<=mpV7v|~C%bs^USv6UZd^m-e5|^?+<%1wXP%juy<)>~<9TW0|n}ttBzM_qyQL(qU zN<5P0omQ3hINdvaL;7fjPeygdGYL;pD|wL_lDQ-EO;$wK-mK5raoH_7l$?~Dqf!cK zmb5F^Ft;eTPi8AClM3W{=55LwlZVRpxOiFd;3B_8yA~shQx|tGF!j;$toK>JuS&gYLDkTP@CvOP@r~sh zUu{a>bfJ1`^^VQ7&C1OKHDNXFTgC{M|V%fo{xK_dk6MK@9S!GZ*1JJ zzrV5xZBjOk9!NTH<(q(S+MDf~ceQX@Dh|Ry<-sT4rhI$jQ0Sq~!`#Eo-%($2E^vo}is5J@NVEf|KK?WT&2; zPCq@=ncR8zO#GQ^T~S@VXG71PKNocFOt)Y6$@AXlk6rM*aP%VgV%sIRORYVwJx6|U z{ozQjTW{-S_si{9Jg#)~P3t?+@6&(!YQWWV*Z9{iU7vZq@5byKw{9lg9JnRA_4s!7 z?H6|n?o8ZWdXIRo{Jz@#>IeD{>VLHUv1Pz*;P_y`V9&!@5AO~Mho1hF|I>%z(nrik z)gwkDjgOrl9~%l9z4Bzvli{bbrxVZ0epdf^>vOB;-~HnIOV3#R*zgPai_gEVd8zYq z@2jb=I>#f&AH2?aJ@Kaetz@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzAFaQAR zU;qF*m;eA5Z<1fdMgRZ_)Ja4^RCwB~SY1q9#})qOXYXFREU?B~9x50NY7C2k|Cv{Itd2-PTmc8HWX4#tiFVZ6dD zUiR-Uu)lZj^x^(+7h{8+%<5=o?wpzV=A1LX70B!&r00U45 zpaG}=C<7=0*c3vPpLw0Vf+K{`mX?+_S(bhAc>HiA5*ci6ZayqYQWxhuMk)0ZLOeo< zOQMEJw5(Pr4s1v?fs3<=X)vO z54;$U$0N~b6v0pse#H;3*9*7XjY_40_4RdRvKg$U*08d&f<|lzWdGch_=H_PmfddE5`h31uyE;2xIeg@Zbg26f+S|hhlOO;Q5CR|o z1PBNbFj|0sz@ybin4h1+k3arcUA%vPBA3hk=fQ&qlOB&}_4@VerDp~=Iy%}`tJU^( zbaY&ZMx$>E3=G7M9XkeJn-9-ha=9FC{csE4fB*gR%F4<=mzI{UxLmG>Q&UsQjC}4~sfXxnIZhj8a)8B}@ zckg_-zP|pRuIoR1^wCF|UBO+ra6ze7t3#3`{c&($@QqWaP9YQwSvqqpWHkgp2y9IX z0bwFFnr6RqQv_H`rSQdtM5vZ^xc&!SF%nl)Y-Un>5_+Y-X+WO#lgYB zH_n_ngHSlM#YL=>3lKsY{$UfbtL7;;>eg6l@Q1=-jE$bb;NajJvMgWZoOfNibjjny z!?#JYlT!N53opFz*6CBHp(u(|lTWZ(H1bev>2N1rYj*nY?-ZcR+CG-Ts6Y6{54~N4T`PB&Vcs#Gy>-ASJ zU%nh`05?89&O9DZXRTH{J8*0udgRDqLp_85gc>$Y$d=k1b(nRhnz2pIZ~$}8VbP&O zhtSp86|L23XFVQI=lJ+Iv%#sV8dp{IwNNN@dSGx600lJ%QjcZH_S(FBXf(2L=Wtzu&*jOaug| zZAx#y{q}SFxvL*s1+mXMv1iSsGw^!7h{a;k!otFF##kJ{eL6lqt`v*KA$e8JIRuqH7DZ?c~wQRR0LxTvHdXs7$_EtL*wJ)3Y8?OT~*biv3)Ur zB)ZSEi^mEZkGYJ;iR{pBq%Cza&QUBDkxHe&7zJY#e#H+(QT(c^9+f1ioyxKtE*6U& zvHh_ITOf{EZK)But0&ndvjL?9j4`aQ7qGm%3|-g37zd>klraQDAry&Ho(1i}pO<vgv*yUnOVKusyxk;smZTRYW- zfY5aa^IsRj2=YQ0j@uE#gfQ|wNs@M!wqw(*iKAYxyE*60T#_Wh7^_sPHMiU(!^$Tt z9G0{QC8*VEh7^Pjy{-d7KsNz32vz7?S&So`GRn3-nhRJ-s)e#rt%5ODktB(5&Usaq z5$(bV&v{-Cw1^|>wCCIW| z;+$7G=UnxAy&G%kwYG43*gkoH0A&j@Or%) zoO6}BT&|Sg?=P&bt~NMHN-6ZZj(lE4rBVgw9L$=0N5{H5F=oucIRi82v%XoB&1T{E z`wK3YE5#XO%lr22Dj#+E4|WTCseJGr*DR$56u1SkavL9tl0y|)!!nCY9Iml&g(j}N4dTH{p!^{gAtZ1BKCFY zi6xuOVt#&JKY8+Go-y{Voop(K^7+uv(5EdeEo;-$(}ou}Ma`Z@l-VjVcxgjFXAF!x z>JAldAAjrCE%GrJqYRvyw#JRQ=I7?HxVTsz9v*%KVA901b^B^G>d; zO#bP{jT_NGFn~yV#JnW$q%T8P#Bm`Nq%km9rys)UXtz=cKp?rgitE>}qqny=+tbtY zfyd*S-0|MZ82fN+Z0wU@FqpmeziY_la%L*CjhK<%FjIf)l%g0 zd0e}83c+A7J2p1<31jTTCtj*$S$;qWdH>wGb2lVODojjFAeDM#EXWK1R^HWUZ>Acl z*>nN3>UkayyEILE zXJKLC;`H>iH#LBN4Z6C|a%b1y&!R+j;2!%q`6DLlrA3S*Q zJx04)Bbm(6;;{#yXQpPijOKQlAKmzI{8qA0YZqXW@s6roTEZEbCkWf|pi8Tou3 zsZizxwT3=t^#{mAp82i`H_9hIVsa~(2CxrYulgYfYxVRWd zBoZW#$;gvT)C z(v?@aZ*|s4`$b5e8@cq?(aZZD8-L3fUzCtj5}C$)z@r&E#DdW2cxDw?k;+Cy!&uN} zUY{S8BIM98I`)_P5!Aock8tIC{SHYUM+7M(d+=MzN7Nmu<`zmE-yZawwDt;{T5CYU zJV;kZR00WKI<n85~4N`y9Fw9dZyU>L7%9S(=)OYgyzLSr80O6{NSFxF}&GC8C*C zpt4npuzejH)X!KJozWv5L#h|Q*H7F?O&!l7XG`Ant$xR~wZx6hy-y(@j0>+MCaW!{ zaRds%f~cqHh;^Mbv#@Lk?cw`Yy_J8fUIc~{;)MR&&gO%0b3-@oJ%O>~cKTqPEbPJu zH?Lt~^~E@aemT6Bf7doV1mWafCxFn3b^JWcE@eTh^+@Z{3LYB9i#QQ0EB9uC`zdxI zJOlCK*jQLL>S%3eV`o7)C^suNH$pqtBgD>*gqS7a;NqYo76C!rx0E>9`L_uOaX=k7 z5ssB>6&{CtF&rxng0SES&?77?bc{uSg;{!mjZoqo=p4IK6bpoKT;TcF3kT1PEt~BPX;L$4+ zwL5K>A9?ea^z7v2fcVbu6jSKL5`$NaZ|SkDFaG@0Ol20U6aHQv+@ZTq-@U*0*x-Bq zEG&xE>INoPs5dx%lvh)eSs^~{RX?8jxS7u^tgP@XeOVr~8pp-d+MgGW#)?oACqj4O z^YSY~UOzsdAUIGn=7$x-ntpula$?w5uRlL`|Kiug4Es$ry+9kjr2~K69wB56d63|9 z@n^1o{{4R=f3hWWRN|^bDDnG{1Ogqz{Pse{->oSQBAtB}YyA0KQ5vafF#o9=IJ8J!;Nj`*WI{75&uZ#3@_>5H(D8$+=XCp%qA=Jb~MEs3jT-21TG_Tqv?_#0at9 zEM^Xi)xRL*Kai^f9^gyE_z)`ZisnV=N_Q0snM- z?w*#4*3N;dwz8VK8_2o4w|R7Vsq;>Cb;roUTtU_JP|bDcu)_ZQ0HTbXFhZwJ3LiJT z->kcqciV1a+03u)C-5}HVm=xjh*(A@m_<<=tg4=cFD%JJ4!($!9~wDxso)9?@!jd( zAkfw)giu05qu3vHSdEa_%zOeu)w3|VN_9qo65L7T|K0@52134zjS;9fo{qR|`=W{$ zM`f7}2lZ#b$b+uW);B!WhJ5!<+?jgeK>O*nl7M)UW+w({=E2daDFg48>9p@{?hTs3 zm+^S!;pouR^1J5`?n15p=yjgKI+L{O)~?1I(lRqK-=z=+QB>J>5+P1rUN)F4BGmf=dVA9}_Tq74e60AMyVv z0S!fhqW;i^C}t&pD#Ff<-xNXY?2q)AilCw{@=Xyg$esSfl@smMy6~qW$jPnvDWRYU zdt`S(jwU1x!cL^Fu>G%!Ag!&gZ%#JVH_%eGP~-TEB3#hda|>cPP(9pj&E(jAmWLmS z>5yH?qT7V{w}{!fT4;*=%mx&}z|zUtn5hVd15E7934fGL5E&SmA5_v?1&V+aiNHDf(i+;N55FpkVLp9Xu>KI2_)f9P0%(x z0b-yYRGt$E(C6$mBr6;&{jgB!bXoH@%HQf+8XaQz8;{G~M(i zE?zZp2#U=v?2LCXmD97cF|bruQ@?~Ro12-KIeC~<32G+P#ENSPooPb7!t)n>xN2b_h4jQhA4GH% z)P1PC|Dq3UGO8LzE(alBL8`5@-}%4kgS4ixiTG(*Sw%T&F#QVcr#^s&vMcMWo04q2 zeEq#$d^Y|?AvpDk2PLn_YHMBHy4P9qPleDSf?)ub0vHOcTL>rqR0x8nDAZj^|3{}Y z6@s7*E%j3&gutBoCjCAbD;|{l|A9XI_Y^?`y`cZhpIKcx$ixo^2F5^K7-k}V{^TVo z`2J(u2jhlq)#|Mqw(#@v3POkdMcO&J*mqx&JiF)cu1z=&?mwmd&<26SCwH&qq-G(&^M?&iy+&MJzOilWlw{d3**4? za(Tn7&O%3Q+qt-R{uFcYLWmU_m3dChc@~k_T$75Ki$0$brTQF z5Z^R_jtL&@1c555b>>F!4ZJy zI9NHX*mGLen53w1bOqw%W5Gf1apJfj4kycoQ&E09cyQiesrZBIN_HNQE4HmJy8NKr zIM$VZ--q{Ah*yvf(%_45Y}~Y;8VPdE#lnLRL~I;A;TZxHnd~dtFg|8`qqih7*@9Gr~CK6h&vnmiY;GvwKTKL#$JEL((yk$ zeuVSFz6{NOaofnxx3T$U%_xSs{4M{zPq2v_36J_WAe`~1Qo7FswshoM%y0Q4oGbR` zmeS=UED>#5eC&1Ti2p0h`&-w1_vdcG#>`gps!qNSE5vH#IoQrNVjY{934AaAwk7QL zAskvA3w8Sxy^9?u6oD;E^5WM)Dc6Z?yFmMZwb~ldBgdGPU#xGfXkWsVX1 zznpyuu3uj)|N0x#8~g43lZl6)vEP=}s>Y}owB){TPfEZi$rtb*b`m*eCX zZ1_@J{(kll3p)1}%Rd7Po$uvGLY^P7d^|e&ZjfP?_r(LTiBOosh%Kk_$mL*$w6_)ROm2ma{~V;kFd zm%rZ;+0bkU3^!6t&HK*_W;ttwU{?Kpe}&Lygy6n~wHfX!8nL@zTVg-%O@H|g?khm2 zAS8x;MCbyD&d<9S$Q!Ke{(gtSAA@TaR)XKxh5vP@!P*cE({CaFp2CH1slgp`+4AiU zxkJ9+%kaH~kTjI)k2{o&^U*8jy@^>nP8xECJ1i5v-O>Nu_5Ziew{{|%G1tQQ%^1pu z;f!z%;jTqRB9_!jr)!9%c+xiP5YN@_ZSuOmTfbAA8h+)PhvWkt)#!t7{!eZY!%BxF+2*)`P?qPSBK&yE*1 zOdcKUYs*!RMH~q&{r!^-H^CgB&5riAw-jh!LtN%91LMO5z3m!4hEn}>u&><4B z)wcBCV1o)7zr4wS=3p*0**14HRHR2Bw&4EaLNOp`TxDHlV2>8w>l9)jHpBkf0s=Hz z(O6luH{vpwn~X%L>tVS!V#8Ip)p>$fTYohfyl|PrUHzl&y;44iHR?`tbQog0Ffvtf z(g$(MF1~yJzB!K*e2gBpr-6^|lj$TbAGAKKdEwWYvZ;XWc1~m^3wzIz{sQMBpo|3NC85-K{otGNv zpWZwCs;{y(QBGdlJ2beiue^J?qvpDd@*aeEH{10M-r&WBAU3g&)A`4tCepRV%THf) zZ-JV4_4GwRP1ZbEZh%hUyg1zc;@->*5qxr5`z*r|Tic74WUx=Ux*k>U+F5abU_CUa zQEOAnDe&`nJJcM=K-~6E?r8#;xWDKKo`vlV8TfF-jvrYXD*#iUwS6g?1-im=v(KI!6TAbjFeKZK4n%}kcAjY8b1_a>{75Go#*^+wzrRU_%B zc5!h+Ga4QmX4|R?vpuO)bL42_E@cFBZI3%>A ziR5leNy7N}z@<_W54{ILkW-(T7lj&OcKu?Ux`i=kPt&OxX8)<9l z>;*;8Q`!KUy^Wx!jtr?5Mg}Am9StIhsBf#m2bEo6NHWsUH+ArEV|coGk@YkTtuBIQ zpD|K5_KA-6cC#>{y8C&18EGpqHCvplXX$UPd1BoPZg$>{r`2s>{cdyyG~2|)z}eN@ z05n@Z)YaNiTjvsJ_9Zh72M-gv_Zd)N9?xiHQx_`(0#mb1H7#u~aroHn29LAaYV1hY z)k;+zG@GPPqF#h)@9LS2&}b(K(xAMSb|zOqXB z#g@^~)!qWq#HmJc1!=OsX2lM|c7dX)b^)49gQ$BIg!DwnAT=wW?bfsDf-*=jBZM3DInhV~>_LUHa&ZF&4UIe^s%v7Mt^>2tsky35f;!56JF zWMthPh^sQ^m%V&?=k5zv>>UlnrA{6_D+VKs)`3e$coa!Q9~VUp<^2+uEu5W`5<*k2 z4|SC|dRgdPC3tvPTk6<55VQNNS{&70P z?5fCRYYQWalAikRoxl7dKtsDE)#aom6%44}mWD)y&D(Zek(KsIiY)63XPEChv<~K7 z-ZO?2DXvh&CLHca+6?tL9_hO<)^cq%)KJX8L<(xSGT6~b6nwTjM?4xxrX2(yRg$p? zXs)}PfjS#B7}<%mbEB4}5kP;olR9SFo54@c!`MI>wEDP{8Q_E+c9w_1lccLH^G&Or zEiCj8K|g3&iNV^G<+vfB6*hu}$yHJ4Kq(h{6PRjPd9AfsK&d6Ik0aOtakM4~f>Il3 z*y|}Eq-?Mel$upemxzcyA*M$`sqthnWfg)Z!-^jYEAQD?@WjD;GCfNEE|^ z!39b!=W48^tu15d6c`=g?P5ysyRHgK&96_96B3udDkZL}sSMU0QV5g>rM{p|fI*6# zgB#Du0rJIiKy-{4+_s93n}b(i^D1;y7;QKKswlP&o!qncB5Z2#;2VL*@JcOsv?P zm8%krNv$(;XZS|Vt@-lvb!oO@?vy#&n$_{D)fR!KSYR=VXk5%11au}b0 z*m(F6H&ev$J1=*{omj;Txe}xn;3qc=lzQdnwSob#iv~`cVBXvWHUbyanVmVAL36Eu zsh&vqAvWOk_+7yWw_79u z8i|H*!kqp9bR?i~Eb;IG7Ra+P!&IZcUwhwSrrZ829mKEj z`oo!jwU-w*W`7!b_TSeU`E)FC1yH2FUTbIGXS*K#S1QaPd>7qDKT()ja0?!Gaq3EhJ9U37q`N&0*7NT68zW2b%y&-t^6MF%cu9he)z^|u!r8q{1ODX4V}@w<=+yd4C(a58j2AkUtrb1 zDowF3g z!mWYL=R1MYf;c`=+EZ+~dI0;{NIS~|1Cv%4hE1OShfJ`XdW&Iol)dbTWwS;J6b)MT zmOhMFu)&akVJ{W_5gw@lhPo-sbmckH@hv>oLKHc2X5%qZJ|M1}hSH)$3nixi_VdE4 z)tm|-{GBo{Mp{GfDBwHh_4WP7FW75fJ%3*6>?q_5_6chA-`B_IQ_LR5zP@{2TU1pQ zqqcj6Y12Sg-Q?R3;QH!bRZ+vpotgLFBR}r!s>n*oskskzsVYppaXm50{ODE%uekVx zTLl0Uv7Un4Y3W%xdEMW_|K3!XoqjVW?#4XGU~Xc7i@lBUmCftKsSJj9U`*~O44aDc zc5ra@@+*V_fb=){+ZhpL6)Zp^#{9L<9TeWRRgjZw?Y?8jj-OMog<)*?s?66Z0&BMaZ$;pXdCk}~X`5QUe*jc48Y&bus1;fIG zpjX*IY~Lj)!QlSai~WEjG}0H?Nkg~{Y$-R$C8P&?ath>97Sfqyi2kF$a2wRim>xTE zNci>VvT)T?#E5z9#%i=4)ZPWQ4LkHYrbKQ8V=l&m-4i(yZ~ufouV zI40$j1jCjq<8*iYTfLxR*GSOv9x#La z_4-(uXm;?wM=ZAWGVXoQwSNZx@aQYnX?cwA-=+Ch8Mbw5ud&6>yDvX{`t#UiXiom}SN8qg($iJ{@yqVy~DgD9JS~MjVl2$!SGZ>UD@C=eM5RqTn@!h||8ZG^?yGk_8-9 z?mp>ED>f@c9O<+94W*4&8xXr6_PjPDv=A(~{{E)QfF{JA|NCTS4ly5boNw+d&o12# zPAl6U)#Z5SLm@`Xb859)U;}SqG&%279&nTTypGT|#Ag1rpwcG?aqNyS%IZvA(~j7y zf6va>+Mb0tTyIwv=9Zl9KHJd*2emr?4s+wU1%R)%tT3(Yy)PZ@ znX7G?9;(R5$0W_)6HMN>stBJz0CR??W#1ksL}yy(nLN$MNl zfNyH;>8r`lx?NCMSyPx*TwB{YG+bTN(%RHmT2Oo|zPPD4xMrcSA-|-0RTmQBZ+KFf zo}My$J8G~or>v~HuCBDAYpA1cbf$M?dA_-Qe7L8fzc#I?qC7Vb4?4Pk zX{IzaHE*iuWeami9e)u{hk?+}YMp-`U>T)!x`Y-ameCZv4(zcU@I&aYjWuy&oN^ zZ%@uEscUTnet7@Uy`ie|p5d{DN7Lg|)8o^37aoi@G<3EP!pW5B-kR#_f~2Aw8+(vQ z;6P1sS!;dIKwsbdLSJLkXkT%5Y=E<|wu00ZSxx7g#lz1ZbTl`04NlE=H#JsP-0p3Z z>q3HA^R>lo1J#uyeFKlDditwU+$7fqBf;G|v7Pe|N^4pNX72R2HZYZO^Ck+!ZkKDw$9z_uF5Pgu77tR1_=_ej*j-}J54pMz}^}vs`K)j9UG89 z?vuKrrp~73d-KKpFWPczGUuwUA)(#lkNesNmunnmmYNFM2iu!Ev(uU=b!b)0!^V=1 zzSjQ7v*lI3qfaXf3U7b1i$<%dSWipW%m-&Ad-qL8S@%GFQ)gaQjZzI-O~2Dt*)rJJ zwKP&WX8@bJgN3De6ScS~wA!SlziH@g70kyc+CMau4UROnHK$c3RioA7jUy$^{f%|^ z2FveR!mKxhb>_8{8bl#Z<-+9KB@-Xy=x{Ev@Ks6KPcuv+2RQ1(0jP>4{3P#``C1CV{2neZt%Q+8Nz2gs%#tS=pWChFY!klH|JVQ zGcpWA5qs=ZZ%L+4AmX|5a;l=KueBsRZ~9mX;t_4>tLPjU9jnhA+ym@jOTm0+Lt*sR zU;q~t!~Ii}xv9iBCIrWkP-4dxdo-EK?H%MC)D2Nxec9mw<$hM3v24Gk#?rXdJ_ z^1(z=N=s*2$YOXA!qe^)*Hv9BED!2a0L0=xGtiVAR$vX4(RsJfvD{}IhPX{WHDxrn zW`xz$6(R2QncAMpg#3)s#8AW;KVDEbboaq#KoS|Bn`-a+o=T-1R|eh;Vsgq;{Yas|B25djIZV;-ya(q7GPI=JWQk;_--(v^i zO}MEKuTD~R&ob7#FU(wcjt2j9ianmNd@6;BxX4bn$Ar8hseMQT}eFnzysjDcn z=fwela~Z#PchnbT=NAd&BJQZU(WS=Pvh+q77(zC+)b;*`-T#$ohP~}6uAH>GhPXXG z4^H+~7F}9_w8A^kt%;u(-2xnE{27d^S4RTVIzsY?Fhy&sB|o zova?p&ZS2q!E3X(i#qOO_rcV@pP5}y-#hx~EI`MV4;T6dTIzFq%prnN`!x2Twy;#p0Qse8Hi*1ZljdzDG@ZpZ^rPay9GEGmBH!A_R{1V z(NVMnyr+Y|y`6V-LVQ$MY~-Fe#H~8?5PRIynw`8k7|H89I69L_#^GJJt12>c2R^-h z@NBxc`%!P_@=|+TenmxDZEux-YH31XL~LB)(%sql`HuS5o}sq9l(B{TPoLe(xs_g2 z*4);mOuy4iu)T@QwrKbx66ZaP%E5YUwU?3yq+(K3{sau#ElQ)im7K)7{@wHGHS` zcFS~Ic~{?1Pv^iuTUTdgR!T#2Lt}GYc5(G!N7o>&jjg(&CRWrNT?nqK=ougGA1ux- zDy?jqo1Yn<9qW34jdr(Xb&dA-^^E7|ly}Vz4)m0^4-fVXjt%z0s^`rsu=kSvQ*OAG z(6Hm5VbL+(H#afTH#%0+x7?C9G*g*B(myynG}_hN*WOT=R9#b3Ti#g~8GrL;YGy%M zUShNx;AqF3d(UP@`n!61#}^kLwN>ArnHZZK9lZbBNN3ya?(xB)(YuY6jZ?3t$449c z#s~ZQdk3ec7hk=cpPRU!!MJhLHD_pI`5`cquG;>dzJZ~s+}gXn(NReyxjp^uU9}at z^<&NTIWZk$Bg6OWjA6Yeu#Ru-Ize_nWRZt`dG~C(Z)Ses?lLylHZeFlIyKR=fQ>dc zrnOEC_Yd7EYaZ+vT7GfAYv}&q!06!M)L75xL{D$?$e_QqLvB}Eacxu2$eZQ6PaiMd z$Eq&Ln`?j_PfRSS%FoX!%V?i%tIsM3wb9pfJQ#@-F0?+p_x#AQCyGiWJS#iBFAX{B%G?k+uBoWI}S*3&r9SyR!~+xg{XMfUBI zqM~-1r>DDuBM}JE+}D@oxy1#;{-C(my31>N zx@rpx_GBPFo}&kk9MuHrde&JRQxFI0?)SN+z9#c}9(4Gd=kErZ${R-ZMI!vp%(lv! zmac~4bU_$UUVeD~>p)Xda?=4AP=vZ$^Xe*73zo4ji|z9tmzz6HARFPz-lD3y#_GmI z7z^)U%O8dslM+T1V7QX%$jzwf?40}jptS>l%Tg8$Kc_p|^O~EQ%lhdMx)yu%cA+Of zrrR+Z@voU`FU+iaj(z_40>*FxZO1``tFOK<-Kwi{8}X>mJuK_EcWWJaM9@zSxus`2*Wd$-~zGq-`UX^^ro z-rBu00*;C-PPFCUPKLcr9;JyVw+CO&br00eMO7o-Jgl_+UiaXjcl_*aILFMXQB_pk zS{=Z&X>I!o3#KtRYQcN4`(<&*o96?g-Q67mHHdc2#-(1qG3rM(}PCg&!5C(hKO)%?G`&THxF7;E(mzBjFg&0_5M zOxC1#kLQOMuz`!YbJ^`r=cnQ9#GGM0>{eq7r7cZm-ThHvk6!BdVfSaBKE@oQkl@-e zY;JV^(U+c#g2DS!f0IoF2v~F=%DT*9XfB1AQ;v&OCg7w{5AO zs|8FO>`B|=)84kZ=G^M>cLR3^qmjURf_w7fo4&Gv=g;mfzMAcL+9ueB1e~zv&65i) zC4d4W|jW1EOi#@yYv~;w>#8rv%qi`C{o%pGH&17mr|)(6_M*dlVF=mN(CR!Itm6ee(FjZ2tn*G=L7dJX{`b z=({siU(wJz|6;MfwZE&Tp}n=D7LF2)FFbqs{>l98{l~8!jLlBYKKl(b>_>+$VNVwy z^)!r6&5n0ZznmW)9vYmSoPY7^@tfbizIpg`;r_Fwh1V|^?>~9=^wp!+*b;9qI>I~k zVQOJ%Vxenn=HA_Viz8j_O*L~5TU)vY?=3yN_vF>{Cof+-n1Aqg@m41G`q_(Lv6~Rd z8(WxL?tNY!^Llw?baJGpeQ<8^)$7FvQ;*&~UtWH4_rZgSxfj#tU1+o$Gc=I%XMoL*SE_h@-xyuUor`6wu;FNQs+FZTj^!WP}x z-@W{)*B1$}Y!y{Cq}bWHGZ-E&4ip20!+e2=-Jy4&q$#5tab)%7H%xuf%0TQFn};d} z9J>&E>y!SLqLW#O{ruv+;SN~#X#sP~hS&{$dw+lG6cZ#(O!Q0@ zZUEM_W(1r22u44<-^=07`wVa?!e)kE6Y>y;*7K?H$wA2`IKlPh)6)GiZg5*ww7fk2 zFdVQ|5BB2eZ}bAhescWr;PCZE#KAR=-M>G1un@6Hj?GMmH6r!|?7`^M;9|sjxhU^E zJQrbovmFOMK!EXI^F%%&+#b^R4a~pa+x{Efk%{smfbMLq)s>_G-8t)OngF`fxbq8EUNK6J{iS64>1VEi=c< zN~^(%TgTl)`82RQ86&EW#1Uw{O%zuh+3mTAgF{2lKueaj6|o)lH_|!_jeb&DR>eSC z5a^w8wA$5UB3X#TLI0|@irhx%tTlc*vhwF)ZapWhXJVv%)xd;oW=}SONx~^WLt9dA zQzzn3x7FKsiVVBi%K*NU4WXK7tJ(Rj zMPxU>KzB0@MJ0JHO=%gDrKzo}o1qcKL|0o*Mp{bO+QW@#6-cHUX&G??zT>v?F;gdL zc$sPVIFd=~+9U&_zGrN(M_NrqbJFvY>^&%2auTY>7B;rdN*ujtgS?L^ z$+3XH%k_LQdX=`Ah zszNe#h|X@RPjb}OclM6Bo)jM)6B7}ABRasx!pPjhD=Z~F$&;vItS95_BMA78=wd=p z($aAViA}r}W@T&>78B@gPt}!|ICK1%sEi)PEj%&6TwlxDH#RN6%0yd_7!-UC@EtkI zLx)6GHA~5i^@mq;{OBg4LV)i!N|*;mhY>Z*Jfh+P94s^x?P3i9-#N$HlF4RPo*~x) zoHQs7+IwN`&3<0jf^Ml!^1gP>)kI(3D4h!U&N;!-)Rb&NzZT*~wDi~q_zo8t9pP-L z=Mos~M=?<(rcwakIYpZ(l3X2}gBa$TTGqJ)z;{;hA>L6L+LDHz*ZuS~B-9eL0pGdY zFqb5ly8A?Vnv>03Z2by01HLpGpPK|sKWv=5DkccXYYoeRCxOoBX(6fe110KT*F)>GCp^YXVMT@wd=Iow?7t9NP*un{Fs z1JY?RI2X#}P)^ry^fuL$lL(aqdS?(~rmSq>W25H!u~bT1qOc(*St*+|cuM%=5H zxE}SUkYf%FRdAs)QeE{#Q?WCpT9o(fz z#$Y|~_OZX=bLog+Ama22H8(zgTm%OZHrl=JnyyziC`&^t8`RV6hoH`B9@M}gic zTbfy1y`Xyqs-u`0do9IC5ZKzK5^HfAn#?ZS5TJLa_KGA!b5kvS4Old&>uEdRNV>fS z=$&gJ%{Td$1rLOeiodF9V|Y<2MH*HnD-4aa%-pDo3LXa_!ai#cT5|Gm0?<3Lo2dyQ zw=+GM^iHONbk)XP^;D=6&^uKxO$~jjfs&yqEM=Ti-Ca`>+Etj_B8hOKAvh_!#rEniqHNyP?VqouW&!xGNmw!WUdox;^< z2?%fDV5+HWp{8oP9_XF*b$h3%*!0r~9XyN3!I6PZx9j#o4B>PS0~?y@l>iE?5s%rB zDW(P%szyM51P?~q*m(!VxdfEWFBeDCd`x|+r~vOmVoYtl$x;?B5T4*@;Amk?Ri#RR zP|LYHQUX#-AJH+6ce(zyzPC2Pij|r|arPw282YY+^{}c9#gpu0Mx+YE2qIu@nfbCc z`yuxAEA}KW?Ai@+;BksK9o+qGG}R){LU1(;4_|vfV@;#gupE|*>3KMmp40LCw}pzB z8@UD65c>R0cQ+qD3&jxS95{rfV;Vv;^EK5}0;n#4_ljf`4%`SF{`{pk%s-;Ayn_s- zIgsGtZ;1au!81}53%#` zveoi~9Jr;-ty28lJv0oC!;0WQqN97Do8Ry_oPa0^%gjs2Y3i|Np#9r7sl8ca*8sNYC4L5@6K4eW{11ksjJ|FkOG0A zrA?H%blE7_#oxo)KJm`Ly%!CUjq}Afdpob2Ik>oaxck~mY8$IwRaLqu9~vIy>+Nhs zb@6x8GVpcx2@Cg>Cz5nDb@fPOQxzSu@&({`H{&gJ3^hrf*dKuN{Egq$?~d#w>QIw;qPSZ>1m**==XXxqW>g?rV=XZl*W2^7wWaR+I zZcWLaL2iBlMpj^CySg$wuayD`EV^Cp>k=Dp>XA|0*fsSVmSs)%aCi6dx~OQOe)g28 zgqSVE+0oKci$r%eQ&89sgtdbp>Rlf8|N zlPA?PiEL=0?d)J}Yv-Y=3PUl)*-6tRgqgF8t8aX2Vr+VPQI@%eZdA0LkFRHBa^3B) z@KFDN6zg?6kM0G2cUsGgYGh0x%31n4Q{;%c(kG8fZvlR{+X-aA&)LI+>SXKWU}IzN z~>>6}qG!`nB+&pRaMR$6#YQF261Q}Ix{w-4Qu zLHAMDP*qh>BEn%&K0ZM%9zi)LJqx|p|P`(Ud*MTu%|q;0PZq3Ol62u~M7SszIN z0K5!_kN?f_-#>pCOG{s#3k^60iJzqF$huO^wJ7HxxIu$=u%oSuiWLlG9NN)7ZUNVq zX&Be9Wii)0ZM{74FqX@E6IARdRs_S%0Pv1gMA2=nT#4F#8(=Ws7XtF=$jF-h`mih^ zz{bMP+Fu#wm-W`pa%Q$L%V`3@<4((Uqgzu96a%CI;88=ItesuF*7FIkLc9H3s1z%E zpDh6JM12jfxVca@&E#RybFA}rvbUv5Q=M@zCtZ%Fxl*aYB$$&FgRLmmHaK@5q!U>g?;dxCO^I>ay!@o{!ArtboP$7VybrCOW&!rm8NgyDFBYGbb_ zW5NV@{DIf(?agc`R~&+6U}{zMV=$bxwcvm}r%1SswGB0d1OQJZlBjHBNRc+s0vu;r zZf9m^?XFL7wK)XB7M9xGKZ9oKeztG1w;M;jka^yN0>@#hb%c+^UlS!E^`jc!xE5u2=1|uK9%1$v$Gh z@D6oR4qTQ}aIrse(Jy4LWRkbDzjrF&bHSCqNgj@#^hj%E4f@ScCwFiA5H(<_otf@twX4e4uJ3k_Ma4| zU$a#ANW1A96z4$>a^nMpr%`BeUfoT`AUu)NQbY%PLm84&YR)x! z_%%=C5Skz$JkeOM^D+h`IRhUL15-U|V+V?g=;1^A&+IyIV6T*#h7Lj1h-z)5DX(A^ zTa)VL5E$y^9A?K02yb^toXR;3OLJWVJ6{*FlANXq)yme!#J~t_N?R9q2eOX5w6cL$ zcG<0n$Ur-~bD+H{AiR~HH#9CQn!!p-(mW>4nW(6wpbo2TEdoJNUg@d=QHxAVEGxSa zdCf2Sh8-m!+XE0DA;O1rNrt3$RqQI+FV5fD-rLXJ%g5WzKP)OK^>#@?R!op*KxDYH zg^Nc}Y)qvDAUu&PNnG^Q=L2*bUXhbMtBS?1YLdn$)-2L zqOV1in?NM3L_2E-N|23)zl*W1mWtHnt3(pj&Xj5u63v{*TB1#L6xiH{0$|}13|%S z5cSktf?WXNaje;M^wjAy=PpS|TsVL3?Ac?#2mr#9G||z~kOzdPZv-eM>;fRXjau63 zq)R|-*r|?CpnbrYdc$dARJg9pCCvCR0aWvE2 z49w}Exu1tOOkeEcR0nHoIdCCGcv$%!0bX~($;#i!axXAElaN~>_9Q05TW4kiT_Fef z$|5DshanD(YqyQ3vkfQ`$69B92ddp>V0gmzc24TR?1*6=WNRg0c)}(od*InH+S0;m z2Qa(?F5Y^(KOvTlXK;VVci*2{{{`_T;mqG}h*f;!TJd^>V_~g8Y_eOp@Pfed4s878 z0+ri5&upK7a&AUV{NQ(Y)`l5u4 zwz>(-UAXhdHm>Jc3Bv#s&_GB`VsDAbctUFJf zJaS;`CN?gRj&&<|SM8F4x9T>mmmug`Ink^%WF^GJ&K&t=|B<8T#FUAKn#zP@G{kw} z+>xVuMAic_DZ2*PPj9ykQG{^-#&=T5BKvVQ|F{DKEB+lDi;1o0ym zj~?8$VOux)h5Ohs;T?PTUN|M9A$Jmfjf8s@&n8(4*(Ch-wb-->8+&(qGu4am%N*SJ z-Fr`;KXH2d?$tf$h~TO72e$4$Lp%!a9lpW9U+s z_rm)!tZVn2y&$@#4;}vH;?X1WCpNLcyEaGE9d4DEhnk%~aB#<3p-t;n^KtX+IC;?w zex%0U@bXR$czNf@k!?Wnj!2%`%Lbx-(lVhT%i`SH4QJ(vRA&nlGSvd!GE}{?W8==9 z7Y*q_G)Z2BXGf}L_#VW1UhxDU4ej4=)WF)e#5!YMwWcxz6pnwToBVG|U0 z4K_Ulhrvay! zQ%|pCS%1aW^Xi_>XVtdEqZP`!77DxZCyd<42l>%jYXyLKGNvN%zN~^3>D0E(XT)r- z0K_}3r=wx)vY&OsRbR{9@FN4JVgT_7mWP3ik?b_~Z@eh4rfy0T0EoBKLPKAjqAjI! zkmHn#$w3aZPWKQ%JSkInSAUDDh0duX(o_=_J#}j$Ks=JZCNU@g$*>%;?V)w?Nx|Z zUPfXK!VAmDuR2A6S6w+2-N`z(N?d?DR^t)pB@5kk48$WJpu}^)L>=BmyQlyNPaJ+w zk8OvF^7^A@@QY{co4vx!PjiFOzIn~6)rfx&5Ip%9RZdY8c(HvOK8!*_$7z~(UGYmGKS#8ob9ZAzPP1#u~ z<`(gtqUkLNfuv?|MO2zr4F}r%YqxK!2?XUtUZ+E%)3J#EMnLckS}elL4MDVipf$+I zF7dVdjyMB?mw%+ZqOLC53Gle}ML1rv6rpX?fokHc5n!F7^C+&daIDpdA&lDCeE7;i zK=2eh8k+YUKbV82Fx0wZqEqllaw;HrB7Yhj@H8Pt6X-HwwQE-&sT+(1PP%Gm?cvr_ zr63X$%aU;3xpKr~HEMt7?dyo}LQ&oJr4U|@*Yk9DHTmctJ zgN-zz!kmrOKKM9O!{pzB$gzQaY0O38kIX$N202h?jgnV%joGFnOq7a_igCa5JsX0D$lzqg+ z=WNeicOC5NzP!69Z}moR0Oho+H9on4WO|7gM3=ZpwIRhaHw}z`7x(xzrKRh(wfyPJ znFAYl9@>)xu_YzGJ~=rGVrnn|Y$PGWPovKg3dJD&vJ%b4oQjyJzAwKS$jx4J@@Q)s z6o#|LPoJEurYDC&d=Du-SmB$^6AMA3&&@Q1gr}`3gu^h`3-VTNJJom)pmrjrB-Jw} zRY#A5Bi#rF{X6IY?nTccL@y;LIv^p5tKy+>UV$zo)D&92r~13O`qG2-8>)|=NJQa0 zVt9RJQ8mQ@7vf`(O8KPVAZ^sDAdXO@(y818TtzU~na`%th%Pd9B*1wxxkq|fbTG{w z+*D;?92~MEV#CcwU*E8hkT|V(Sizo#S6*)`YromJzN>9bLUzik{H)wKp2&?W5z<)9 zxb*nYpm2jYWSxoP9_(ohF{_ELt`sL67LKUmh%PRYlgMT)zGh28aJZVM%hU%NnNn#) zT#TMBRq7Q&vNOv&FF7GDqp%<{YI}&t6dqf0U~9?2^W9HfEIW2=LrH1=nzFSO8CZfd z0YjqEm`Rz5F`+Rr60ckhh8HXssDkxEz5`PvQ_4kRssolpJB;kb2FRo;zYqf=t1zj3 z1B`)TW|=nKH_k*42#tzMh;=5BDJ1lWl0G9LE(84@UV!OSfzKCCqfVN)q3eQY%anOdPrGxXEKpUCN&^c zNJgRipP!CoSXK(6*wc?YZHe34EIV3R?k2^EF-aiao!gN)H?zTD4S6%pa? zpPCdKmyn#1URYdGUS7JjcxOvXZbrd|J-g}$CwHdg=4EH(raHq}TR4J3CYoY`%_f6N z9+ap;NPaqvN-HB_2xN*AxU6+@08B3+&^Oo^U;sJZ4DyChA@@+|eU*wRp-$x*0n1A#r+y?I+_fg;c=w*m{LnEEmc=#VVyz!I61-D0F^)@)SRBPjVsGZ?(HhuOK-%G$4Eu9JS;K_&i=t z`PTg8vf{Azxo@h<%Hm;SX9NH|=O_*L5rjqy5j7vR$|F%}bZJq5Auv4AEyxRaKw$00 z)v2cNY{2ASFWF!Y&C1GUKr&}{f2}w^&K1$IV57jXEJ+s_km_L!#R05`$zGq4ml&LJ zYwp{pVl&EHqAR^@(d+ zt7Bt;E0K($T%TYKR-^}xnqKVT?HTRknkfTN0G|+&n7jV$JO6t7ctyd1oe>EN;7QCd z11%y_gY!^9^w7;JwInE!7a0s9LTFBOM8;b1PE5GBry$d84vvKmB1+;U;^}k zL9#tW$koIORB2$d#}LLxr9?(2l;8d2rw0oX1O3gq0RJ|qqan)GoMaL@sd4BsvN?yV zkQ)^ARM=BuVa#E@u! zXjIYOhM=&_AXuuTW-mFg8V%?h4#FfiQDLSYkt+eE^H>w??BNy35vO|+PJnGnfJqZ* zh~@yYht>G%lzOR`1du(FG0`O=Bgz%=19Jy5H7T0Ik%ag=M}PXrERF^QsZ19XqWM(9Cuk^_KsE~&{*UMUJ35)cUJ zo?}rQp5YOZK{rLp+ySi%XR?#RD6kQUCon0YaWpKX@G2HkQi>G_C5Hp>p66x}!Z#Ia zC@KCTNZ?IU#`7HsAYu`;G>X~-NtL<4v)BN3syh|@HPSAd2I!nMCCNaKb$0K7+Wl$e8zp&-7hBU~d|55@(m_#vQ~ zvvHe(K{k{n$Plr&7ZFkTd1<{9#AFNr)-H+wAF0+`MNsRA0X3BgQ96EzC*XVhEpRp& z%gc#yan^)!1OYxuFV7Gq;CqB1vt9=pmR`z+)TfPvJU1doL#+?Y|3$jmCdH}Bzi9;nH5@lAU`rbNX-n0r2)VvN$>y#hKVRk z%QE~VEUjKG1?`=t0f3M0qtobQ?w(qeNXTS{Z9TR<&MU;=>1B=pix?k%WB>(WFsKY! z)|NHlB3F@Ap;CMM`glncLHYobPA=xK#oE-`mTh?{CaEXS=q@htVxvt$hEy4nV9wS43Q;SP)M_~_nK+OHIBJzPG_`bp z-I2~yuu(kNymxbASd3ZW=gk+o$s&RenlVXmYK}yYmWo9>m6S=wlgO~12qbyugn8PqwsdQHcl}d724BRdgMU=K8wdPClAL}DPIlxp7Zxu_ z0U#fSN+1(l;h9uI;**J7%w^~?GS`E`1eDKPNpg^JM-V)YNAh8j_yF_Cg#JFxG(ee{ z6q=Fbg2H^+9{d0;3&1HnqVdFYoI~3s(5WD44Ls;Q30j z+01f*XG(pDpF0f$NEgrDUBRR|0V2jx$R%!W6gZsf;^x8-IKXjLPcIpr;|5S4T_mOf zK4#Fu>du=6zpa?3L3`G)-PnNlQ8|Q%<9$0VK1jkI>J8)jPwoEi?f+Wfe=YF87Wjb{ zz*ydcU)CRp_uqMq!Gd>=+hfjHM+fX%zr3?@oS01ngy2zk>3eD$h6PHWETPA}&`8W`W&hMk?{?SmkJvUg+BHEpF zN%mM0OCB7TYjHtzmM&+K?Ck;QIP2h_yMCl?Z$YT?ap}7%LyL-A0GplrJWL^QcCxb; z7$+JsfmZ*G_P&#Q@`B~e$7_Eg&@bG#6LlptcU-7qlkIE(2P&dKeV2dH+kdg8Dlu(&7Mk71Do0o1 z($&mS5|mcDt7iYsEgM$HsX%>!l>%KX9N;Jt8g6tCf(=Q6x6sAjfwN@rqn8c@n!6#P zwB|(n-_ZR2n2j*NrH-X5-BRnXzq7=55;$(Vyh(>9awH>Gp79Qx13yxgZI-**)of_m z`vL|>c9oklDjOQ#MCs3c$|1YJt{I}=^Q48hTOKa``Pp9B%0g%#Se|`w?m}C2ag2^{ z_q@4}Jh}i-d76lVZFM%sQX^O(A3eF0xN*K^-59Dm$1Nage z+5_u0p{pPoG8h%VuwFg-_ic+mKv;QCx9uqmS92+L&f13+2{;)`9+X|ygnp|5!pDnF z`K=Eg{rf@J`KC>&{$dz>k6V2x5yp|q*T-#uGwv%4|Gs&)vvy6ChD(0z*0(eWmH>-D z-md+>Um^WZ`%a(OxymGayrplkFEDs#ci)t%t>>){80{{_cOQ>dRiqk(&KAC~nBR)8 z9LQWvT*~g(mrZuG7~lTiCx3bOjn`iJ%}X!6^5$PYd*J=tP;8{$jdZ`Oxs?_GOJsRU zvi^Ku#lLv_g&*C!H9Ipia~%ycH|{+9oA>W$3YR@30?L0(--(6wvj`IlMfkthescTT z%&oik?%urvj+h|8zu9ZkPrUg4@>aM)Bhl?!vmV_lSR%qh-BvD!KTb`;=hg1qn!P@K zZE|8_9KyuZ^vvw7n*+}+r$0C2J?t!Ruy`bMNmlP&o3Gi0-CK&%VnR*+zTSE-ozBbK*A$f%W?Q9x zG;?ifM|`a%vFsL|mlX(cb@g zoYyCweq!=RwnY$){WCI;wgTm4p$Hfp4zW2qMYDPP+U=(&tyAIsgQXc}wa}IB;!L8T zfkflTk=tmjxesS=-Mw>n;?{g$!J}%tfchA#Ajq+0mMkql?~UJj;_j^}@FN1@&A2#! z34@Gx#Niy!fFsb63`^&{c=^Vy>(kRWM(-@P+*byceWL3^)zJ$K9>caR`#|y2$?Gub zZ;a1^iy8=*^gf~`S|xmY)YH=XZw*|#J~28pI6U5O>nk+&4HpT0rBV>8M0KEvE#cp{ zCvQw%85tQL9JBUvr%=uy%E-phimp9JbI?L9~?>9 z!VB&o1<%J`*2<5%0pTAxI-h**!zzmvAPNV7&^Z-G?wzVk+?}(hUJp9S| zk@KzlE7z86++N?&J+ZhNlnX?(h30w`&85$=P6QXL91R(Ndwcw9?}-E3%FDOaoj7&Z zLh7r7TsF<(VH4$2Q|Pm=-@ZK5d%SvmR(x!7!RA9}Iu>Wo9f^j!5)=fj{zeNO^yjtV z$-a~O%kt9F^2=*ZblZf`b_X{LCIBmBswL{@y?q0xYuBfS81(*8xmyl*buKKN|4i3P z=qqRdtdk3JZ=U{_*T#q14{Xec2n>wOEI)L-)9T4~E`kawF&5*9$5;m6+}!N>?!%ih z%%1K7sXj7)TXXyH!U*aFGvgIV;tnJy{X*JThQ_)N!{;k?9v-^T?9EL_Y%AiAY3_6) z4o61TSWEiV=(!WS3c@vRG-sx}KBj2*iQ~VXuft0we=*H&JrLvQjO?CI`tO?~7h8Ac zM`(p$fvk%x*xl4)<1J-WcV_~@3HL{9)L)-D*8tz4fRW}zVu*bcOKXn}d~M6+n{`G{ zj@^1NmcVelHBbNjp`rHLb@4v#bTXMCG9<3AtGA$Xzy{?!RJ_}4jrrAZZ`&R~Ti7HA z*mHFC0L}66kp;QE!w-aEdvP!aii^sk!=pL>>SE84&6y?-7Rk|(Abl)-KfICt+p}rkx`YgLfe{ym)$FQIwWP za>QcsB)(TnNp0OvZB<6AhvGvJKD#{FQL`pe%^?HYV9^|X5=!@U&yS*y3d6NLihV!? zmcYdCx8@2u-$2ii%5DB+6~o;LT3+jH6V*TZDi5@L$mX*=l{RcH`ZkVdu&`8?CsoiF(r%o z^7$yUz1kR#%6D7fUC(yds%2Si0F;y%(>66VFINd*-5)xCa#vo6fM*72JcNpMqKW-e3hvVh(Abluxq zoi`Ia0*=jR^juaLeDGpjF-Y9t?lluqs?H6Y|uC zh;$SO^4?J2bN$DEn3sdTeDfDG7l+0RB4RRX2JgM_%8NJmGhk2r5e>4y{eIbUu*3vs z4y*z1>0^q@Sc`h)e=vOf!G|Ax@{cbpFMc!j;)4J^!olVQPc(fD6{ z_~+MucB8V$FMRivXJ>4z=KhQx_x==YY@nbaBFn5k-CZ9}q*ChO6z>18@OdIbNP|7D z#Ce+U|HXo~|2OG>@h&)U|LWUszxwE-ae-uwN_OSGD0?=3g)zW(~}fB)KV zXO5mab?W@(i*4h#uituRK@oede{`^KV0>g~VBpfgz~JCOZ%5P4)v=y5nN*U~aA{^{ ztnYO9iSmm#7ZzSCg-<^D`+H9xKi=HfeDc`Q;TyAeo_OZDAHDh@^|_CRMn{GQ2QH1= z09a)F>eY$Mm#+-nTBy&@W^UiSer})f_0U9YU=8b zG#>40sqdejy)(Nwd!HJc8t%I?IyyRhd31beVCeGYk&)rS`wEE`=lSV-ci@YNv)5;) zCa#W+j*g8_&5SRA7vDWIGdn#ocDet;*{;rx_V&}KTI+X~rkN#Nujtj=54ZR9UqZvc z<*`BdO2yzJgZcHu&Dk5%ljB#eT)7HvY-g_Dn7w&>>goF%;JY`c?%cXDgGL+~>hJA2 zcdn;zaCE>XD1dqY?9}*h|GAFi%?)+6HT(Bf@7Z3yIyF@1#sf)lM^ndz{sHKiO9MkA zS0|@$%-o$9+~(exxOHRdDs&sX92goN86CSiF*P&tyZZ|8&Fs|m$+63qF7}-5Y->Go zxS^r3_0-u@3-mu68SC#let7@(O&dyzRu>lJ=Vm5F1ZYHbjy62EvbMFos~Zhx&tK?= zB20`gtbZSmPmK-sc6YR$JbAM1bbIHS?sL8UBNrAM$X1Y-FI~NKuH(ef#zQr`t2UKw z*ic@zuknCYS%N69Ug$ejzpK0`D>*hYEHoq-j1zs-Qa2`<>EWMHSh4#+y(Kg>HXmy{ z({l-RCTb1eUGKZle)Q13T|0K{*tG}TSkyHfIo@&d{`G(E+pC=&M{0L&E-Nj{&44ej z#U^GJm+iIc>yXn^UF~(11ofr(fQ)RoV8uPRad`lU2bZ8ba;@z zkC#^K9TXpWdOq6Mqi347`{MJr=4I@@qBSXD{(6l{ zCK9-Dc|w&@gYLsw!h7AP_pgcd_2AH`6cPcH2KYJ}4wNShoU3$ZxryZ}jYgwZYcyWo z{^pp>bvq6&@T9qOd4)0lYMDeVmdNA^rP@1KZIdegehntWttng74|0=3y`+4uD+8)V zCesA$^o7~~%Tuk}GEH(e1&;%J3^dFy=~$c-nMz~2ax8)CCJ@Q>A!!@R7CYdttD}OH zZVVa(29xE=6{$S_V6D}QQ}+PunSRn%$w6PEj131LoE(7&j>JJ08u7cSj)sk}6ZsH0 z90R5rj(7r*WC>&n)rBS0gs$3n%9bho`-#q1%pl<*I5|N?SA2=}-DlTs&dy9vUmvou z!#@TX0B8YI3AA!pl9OTqzxnWdM@@0K%9XfK?fL3k{zD3^EjZxdgOu*x@f)@*;jz1T zGMn-U5uF&wu$8_Ah#eXl9v-#|J>RU8s+czU7lU&~7OU{9&Xc=xf~0i2Hi7~2SA-O9 z?p|zw57c5nu&hPKk_fgPzHcTbMlN=>x1Z_lzH5#9PLx~#haAv|SRz(DKQrdOyVl*j zIn~$B-4IZ}#QquEcD=kw&vzdxjn(o{)y$3nlDk*jhU)Hl(G^zlIF^89sTh`k4YB0=*DE7eFC43` zSi5H9&Ze%@la_}c1ZxEr4FGm3gBHlo-8+A3Zvm>C*rk5J(1D%*g6f)u**iD)BA4%K zL2;p5S6edvRqxb5+y3=g32~`K+ndk!S{0Iw3?;hV4bUy&tp)n;_g!q+3PSu6#PEAt z0psK%@=L8e)c)l{7IXasJ{|B2EP;e=w>+I08}6#F$O!fI35+k^bG&=ZB09cQ%n$%9 z1-o8L7KmGy&K_DHt8=q^GYCiKs6orDzqv?%?jXW;c67j#ksav6zdv*NYH!Q-+%T;~ zr0`EFt!eM>vF;Mr5_zyod~Px2tCt4bcIStzzzW5pWTsa(wJw>0bJd6o)ro){vP`un zIwl8B?Oz+KcW2T$9)aoQhq_MN0M~51o0DyXTFUU*)zR~fn^Jr&xWxB1`@%~Y<6KQ- zQT4G-8=JRe1cz9eh_B`H?;rv}^2K)lW zB_33D7AW3#;Xt5^{ZlI%PxUWwFvzQ(Y%_7ofHUmW?G0p2AUvUnO^K@ zIp6czB3;|nYbel|3?teGXhLMZcT85vfu+M0;(mQ+{2Dq<;#Y11gK>aW&?l~>`s9UP z+hV^^jBlq~4sFc~zYon3uetKh*9&pbi|?MkI&=BVq4Kl<*~)jo&>oN)lQ-11U+i1T z2GD#z`R&!(*kxdfgRus_b+|nI`^OVEM$a{E%?U-PiG7@Z$!Gwqk*y3$uQ+t(QvU*s zyg=cfuMF3$3RFrYo&m{aN2lgRz=ij)N%!Q$?3D{GJ6EFyh=i4I!GfUS?4}M~wfS(@ zVE=*|v4p_)UVih=t*P0o7mx2<6K??7>ES@rlG;Ax5-?O3fi@zqsz`do6=zA$! zUw(OQ^5)fxC-;{o8)dA=+<(R3h;(;-RDM-c_we9Kp`Slop6F|<-H>Wha2})ct<3@J z07K**U9hdGYvk-aMq@|i(J0?dpKq@#&oHZa)F1v1+e2C(eFRp-WTx0B1`2R|XdcM^ zA^IPEWsLz&AUCfHQ@gFiaP|Ijpao!weWD9?Y_Uy&uWV@hBTDhro6lc+(z-@`+gw!? zqlcmYIAd?VAQ&tjZGqU#1J>$)`^3|4J$fX5{PMl&*(a~ru!|q9O@~d3mF~OFQ?~uL zw170g>%6tXZ%*BsdE$jP|7L6BC9UxFCvQAIJAL~JFp3$sZqR*Pkc0{yD`q^)O8^C+ zaOK8VETq1ci(&O{rBI0_fN0??ibJ8nz?cJ&duvH(=$_3 z7I5Oz(l9@O!~aA2s3yUbXsu}8Z^!T4ya6ib&6|L<*ldq(p!P>Iv$yZwy?K4=%J9(O z<*_S$FQO~q&;0zP_V2kZulABV41vY;c^9q!FDGVaCIDHwGCnnZ9TZ=%JF>NtC8tjA&|c$%ZKf6r|R#pRb+5(Ak<$-gjiZEB?Ne0SGbfR=`#6cdw^ zlT%ahGk$e!WT@|a$Fak;)qD0goa`Cwwdmx#T+Cw$bD{U5CG=i6f41{fD}YPoYYGe2Y}$A9T-RMR$y^o{4hOG5?pj9JdV?V% z7DIr)c8yOAbT;j-C|$e0ylVIUx`xIh%}0;6v>ZL!+;sR*&7N&##o0-bpk-Dm39*2E&z~6|>};qiN{@?OU9!HcVpHX2G;Av0xUL93 zLLU+6tyU^^ro`f1ElpO2RZZtVj_t`}(cmaSG1`*fj`j_8HC7eG1$t|B-u^+MkumX! zNy#Y?l9LkRqQOUox2IIVab@%6#)Oi+hcBY3=6){mV6Ra0TcizF7_cY4hi3Hl>A`c& z+Y4h19s(YZFOn%d!QF(nj{$;@w;o(Dc!>EN29-=CQC&TZ$?NOtZlcNl9HkSjO!Qqw z9&DiT?iS7V&S`KUSR7{%vz)=+2fm@o=DP6(0wDwepAVQC!-eDoXMG$%Y*Lsrw=_09 z3*`Tj8sfPk!-wV6(SsBgb@S7X3+;6qlKrJjaBBt-jS~U&*a2rt(EyG$!0!b>d8m*D zD+bj~6S;ctvDRn5`tnjiDr`vGg}N-KY`p_T6lq19@%riW%~jdKO1904#ex?>K`a6M zhAcfFgr3{*1H1V%og;m9aQpz)pvUFG4rDej<==B(-0Zm2UQ+_L+;$lg;>c`eXx@(2 zo}R9@eZ}|7=?|;tqn^P=up#Kc=(*FEFC4AP41~RHdujs4BSP=^b^DH=In%ngC_-)L zuJ1z%fp-!4XRhASKG@e@vo=QO2L8tE2NNvra6l7rR!c{Oo)Bzx{0odsSotGDj0-d2+6w*pIkFg~F3RlerX5TnMOu_DcX zS+U>*h{BXyu(l*GAwUjtyuB+K2u)y;D3Ys`GCq^^*zz~H6{88%fst`Bp}unNN(5;P z7Dph_S!_1b1$-abTkK_ZM{hv-WeDV2y_Y9?if<+Pz}ZDd;E^a6zx2$^0~Egh0W7{0 z8rw|(D+`GLyA|Ibd)ZqQQb$cQ(anZsFII8`wZIc8RA<;T0ZWC)&u1kxm&HXZfpc_3 K_cQ)G4 literal 0 HcmV?d00001 diff --git a/Info.plist b/Info.plist new file mode 100644 index 000000000..6790e4a66 --- /dev/null +++ b/Info.plist @@ -0,0 +1,90 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleDocumentTypes + + + CFBundleTypeExtensions + + aif + aiff + aifc + + CFBundleTypeName + AIFF Audio File + + + CFBundleTypeExtensions + + wav + wave + + CFBundleTypeName + Wave Audio File + + + CFBundleTypeExtensions + + mp3 + + CFBundleTypeName + MP3 Audio File + + + CFBundleTypeExtensions + + flac + + CFBundleTypeName + Flac Audio File + + + CFBundleTypeExtensions + + ape + + CFBundleTypeName + Monkey's Audio File + + + CFBundleTypeExtensions + + mpc + + CFBundleTypeName + Musepack Audio File + + + CFBundleTypeExtensions + + ogg + + CFBundleTypeName + Ogg Vorbis File + + + CFBundleExecutable + Cog + CFBundleIconFile + wheel + CFBundleIdentifier + com.badahol.cog + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + APPL + CFBundleSignature + ???? + CFBundleVersion + 0.01 + NSAppleScriptEnabled + YES + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + + diff --git a/Libraries/.DS_Store b/Libraries/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..e4585cfa1d6a1ea4107cab19974236c5398e32d3 GIT binary patch literal 6148 zcmeHKO-sW-5PjR$G@?k49^+3?@Se6&5EO-q2Tz)|ltMA!$5F^{^I!OD^v&*Cc9VJ) z(U~&)lF8ed-M1mT1z<)mvqNA2Af*d-w%Kejc`n|vj*sjTjm>d|;n}L1maD34u{H1; z6_B+{P+*QJE)cJuycD+6;5F<+lK=6J?EuIY_UQK2PPn8!Jd)DPK-n-$euqKvsx-y8?^6WpM}BT90gVy>)E#AO*ZRX`Q^ zrwVY-7E5;=YO4yU0;<4T0r@^;biv$X?a+QY*mQU+&*czijn{H)lvw65_gFjR6Pj^d ziLR^he=&^f&Uof|xyRa}>keZpGmo!q{Bh9O>WpWW4wF07RuxbMVgg~M2@iagD*ylh literal 0 HcmV?d00001 diff --git a/Libraries/DecMPA/DecMPA.xcode/project.pbxproj b/Libraries/DecMPA/DecMPA.xcode/project.pbxproj new file mode 100644 index 000000000..41c667afc --- /dev/null +++ b/Libraries/DecMPA/DecMPA.xcode/project.pbxproj @@ -0,0 +1,927 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 39; + objects = { + 034768DDFF38A45A11DB9C8B = { + children = ( + 8D07F2C80486CC7A007CD1D0, + ); + isa = PBXGroup; + name = Products; + refType = 4; + sourceTree = ""; + }; +//030 +//031 +//032 +//033 +//034 +//080 +//081 +//082 +//083 +//084 + 0867D690FE84028FC02AAC07 = { + buildSettings = { + }; + buildStyles = ( + 4F0BB7EC011F40E904CA0E50, + 4F0BB7ED011F40E904CA0E50, + ); + hasScannedForEncodings = 1; + isa = PBXProject; + mainGroup = 0867D691FE84028FC02AAC07; + productRefGroup = 034768DDFF38A45A11DB9C8B; + projectDirPath = ""; + targets = ( + 8D07F2BC0486CC7A007CD1D0, + ); + }; + 0867D691FE84028FC02AAC07 = { + children = ( + 8EB2607A082DBCD0007A908B, + 08FB77ACFE841707C02AAC07, + 089C1665FE841158C02AAC07, + 0867D69AFE84028FC02AAC07, + 034768DDFF38A45A11DB9C8B, + ); + isa = PBXGroup; + name = DecMPA; + refType = 4; + sourceTree = ""; + }; + 0867D69AFE84028FC02AAC07 = { + children = ( + ); + isa = PBXGroup; + name = "External Frameworks and Libraries"; + refType = 4; + sourceTree = ""; + }; + 089C1665FE841158C02AAC07 = { + children = ( + 8D07F2C70486CC7A007CD1D0, + 089C1666FE841158C02AAC07, + ); + isa = PBXGroup; + name = Resources; + refType = 4; + sourceTree = ""; + }; + 089C1666FE841158C02AAC07 = { + children = ( + 089C1667FE841158C02AAC07, + ); + isa = PBXVariantGroup; + name = InfoPlist.strings; + refType = 4; + sourceTree = ""; + }; + 089C1667FE841158C02AAC07 = { + fileEncoding = 10; + isa = PBXFileReference; + lastKnownFileType = text.plist.strings; + name = English; + path = English.lproj/InfoPlist.strings; + refType = 4; + sourceTree = ""; + }; + 08FB77ACFE841707C02AAC07 = { + children = ( + 8EB26003082DBC69007A908B, + 8EB26004082DBC69007A908B, + 8EB26005082DBC69007A908B, + 8EB26006082DBC69007A908B, + 8EB26007082DBC69007A908B, + 8EB26008082DBC69007A908B, + 8EB26013082DBC69007A908B, + 8EB2602C082DBC69007A908B, + 8EB2602D082DBC69007A908B, + 8EB2602E082DBC69007A908B, + 8EB2602F082DBC69007A908B, + 8EB26030082DBC69007A908B, + 8EB26031082DBC69007A908B, + 8EB26032082DBC69007A908B, + 8EB26033082DBC69007A908B, + 8EB26034082DBC69007A908B, + ); + isa = PBXGroup; + name = Source; + refType = 4; + sourceTree = ""; + }; +//080 +//081 +//082 +//083 +//084 +//4F0 +//4F1 +//4F2 +//4F3 +//4F4 + 4F0BB7EC011F40E904CA0E50 = { + buildSettings = { + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_GENERATE_DEBUGGING_SYMBOLS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + ZERO_LINK = YES; + }; + isa = PBXBuildStyle; + name = Development; + }; + 4F0BB7ED011F40E904CA0E50 = { + buildSettings = { + COPY_PHASE_STRIP = YES; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + ZERO_LINK = NO; + }; + isa = PBXBuildStyle; + name = Deployment; + }; +//4F0 +//4F1 +//4F2 +//4F3 +//4F4 +//8D0 +//8D1 +//8D2 +//8D3 +//8D4 + 8D07F2BC0486CC7A007CD1D0 = { + buildPhases = ( + 8D07F2BD0486CC7A007CD1D0, + 8D07F2BF0486CC7A007CD1D0, + 8D07F2C10486CC7A007CD1D0, + 8D07F2C30486CC7A007CD1D0, + 8D07F2C50486CC7A007CD1D0, + ); + buildRules = ( + ); + buildSettings = { + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + FRAMEWORK_VERSION = A; + GCC_GENERATE_DEBUGGING_SYMBOLS = NO; + GCC_PRECOMPILE_PREFIX_HEADER = NO; + GCC_PREFIX_HEADER = ""; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "@executable_path/../Frameworks"; + LIBRARY_STYLE = DYNAMIC; + PRODUCT_NAME = DecMPA; + WRAPPER_EXTENSION = framework; + }; + dependencies = ( + ); + isa = PBXNativeTarget; + name = DecMPA; + productInstallPath = "$(HOME)/Library/Frameworks"; + productName = DecMPA; + productReference = 8D07F2C80486CC7A007CD1D0; + productType = "com.apple.product-type.framework"; + }; + 8D07F2BD0486CC7A007CD1D0 = { + buildActionMask = 2147483647; + files = ( + 8EB26083082DBDFD007A908B, + ); + isa = PBXHeadersBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 8D07F2BF0486CC7A007CD1D0 = { + buildActionMask = 2147483647; + files = ( + 8D07F2C00486CC7A007CD1D0, + ); + isa = PBXResourcesBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 8D07F2C00486CC7A007CD1D0 = { + fileRef = 089C1666FE841158C02AAC07; + isa = PBXBuildFile; + settings = { + }; + }; + 8D07F2C10486CC7A007CD1D0 = { + buildActionMask = 2147483647; + files = ( + 8EB26039082DBC69007A908B, + 8EB2603A082DBC69007A908B, + 8EB2603E082DBC69007A908B, + 8EB26040082DBC69007A908B, + 8EB26042082DBC69007A908B, + 8EB26044082DBC69007A908B, + 8EB26046082DBC69007A908B, + 8EB26048082DBC69007A908B, + 8EB2604A082DBC69007A908B, + 8EB2604C082DBC69007A908B, + 8EB2604E082DBC69007A908B, + 8EB26051082DBC69007A908B, + 8EB26054082DBC69007A908B, + 8EB26056082DBC69007A908B, + 8EB26058082DBC69007A908B, + 8EB2605C082DBC69007A908B, + 8EB2605E082DBC69007A908B, + 8EB26062082DBC69007A908B, + 8EB26064082DBC69007A908B, + 8EB26066082DBC69007A908B, + 8EB26068082DBC69007A908B, + 8EB2606A082DBC69007A908B, + ); + isa = PBXSourcesBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 8D07F2C30486CC7A007CD1D0 = { + buildActionMask = 2147483647; + files = ( + ); + isa = PBXFrameworksBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 8D07F2C50486CC7A007CD1D0 = { + buildActionMask = 2147483647; + files = ( + ); + isa = PBXRezBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 8D07F2C70486CC7A007CD1D0 = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = text.plist; + path = Info.plist; + refType = 4; + sourceTree = ""; + }; + 8D07F2C80486CC7A007CD1D0 = { + explicitFileType = wrapper.framework; + includeInIndex = 0; + isa = PBXFileReference; + path = DecMPA.framework; + refType = 3; + sourceTree = BUILT_PRODUCTS_DIR; + }; +//8D0 +//8D1 +//8D2 +//8D3 +//8D4 +//8E0 +//8E1 +//8E2 +//8E3 +//8E4 + 8EB26003082DBC69007A908B = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + name = DecMPA.cpp; + path = Files/src/DecMPA.cpp; + refType = 4; + sourceTree = ""; + }; + 8EB26004082DBC69007A908B = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + name = DecMPAFileAccess.cpp; + path = Files/src/DecMPAFileAccess.cpp; + refType = 4; + sourceTree = ""; + }; + 8EB26005082DBC69007A908B = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = DecMPAFileAccess.h; + path = Files/src/DecMPAFileAccess.h; + refType = 4; + sourceTree = ""; + }; + 8EB26006082DBC69007A908B = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = DecodeEngine.h; + path = Files/src/DecodeEngine.h; + refType = 4; + sourceTree = ""; + }; + 8EB26007082DBC69007A908B = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = DefInc.h; + path = Files/src/DefInc.h; + refType = 4; + sourceTree = ""; + }; + 8EB26008082DBC69007A908B = { + children = ( + 8EB26009082DBC69007A908B, + 8EB2600A082DBC69007A908B, + 8EB2600B082DBC69007A908B, + 8EB2600C082DBC69007A908B, + 8EB2600D082DBC69007A908B, + 8EB2600E082DBC69007A908B, + 8EB2600F082DBC69007A908B, + 8EB26010082DBC69007A908B, + 8EB26011082DBC69007A908B, + 8EB26012082DBC69007A908B, + ); + isa = PBXGroup; + name = frame; + path = Files/src/frame; + refType = 4; + sourceTree = ""; + }; + 8EB26009082DBC69007A908B = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + path = audioFrame.cpp; + refType = 4; + sourceTree = ""; + }; + 8EB2600A082DBC69007A908B = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = audioFrame.h; + refType = 4; + sourceTree = ""; + }; + 8EB2600B082DBC69007A908B = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + path = floatFrame.cpp; + refType = 4; + sourceTree = ""; + }; + 8EB2600C082DBC69007A908B = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = floatFrame.h; + refType = 4; + sourceTree = ""; + }; + 8EB2600D082DBC69007A908B = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + path = frame.cpp; + refType = 4; + sourceTree = ""; + }; + 8EB2600E082DBC69007A908B = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = frame.h; + refType = 4; + sourceTree = ""; + }; + 8EB2600F082DBC69007A908B = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + path = pcmFrame.cpp; + refType = 4; + sourceTree = ""; + }; + 8EB26010082DBC69007A908B = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = pcmFrame.h; + refType = 4; + sourceTree = ""; + }; + 8EB26011082DBC69007A908B = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + path = rawDataBuffer.cpp; + refType = 4; + sourceTree = ""; + }; + 8EB26012082DBC69007A908B = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = rawDataBuffer.h; + refType = 4; + sourceTree = ""; + }; + 8EB26013082DBC69007A908B = { + children = ( + 8EB26014082DBC69007A908B, + 8EB26015082DBC69007A908B, + 8EB26016082DBC69007A908B, + 8EB26017082DBC69007A908B, + 8EB26018082DBC69007A908B, + 8EB26019082DBC69007A908B, + 8EB2601A082DBC69007A908B, + 8EB2601B082DBC69007A908B, + 8EB2601C082DBC69007A908B, + 8EB2601D082DBC69007A908B, + 8EB2601E082DBC69007A908B, + 8EB2601F082DBC69007A908B, + 8EB26020082DBC69007A908B, + 8EB26021082DBC69007A908B, + 8EB26022082DBC69007A908B, + 8EB26023082DBC69007A908B, + 8EB26024082DBC69007A908B, + 8EB26025082DBC69007A908B, + 8EB26026082DBC69007A908B, + 8EB26027082DBC69007A908B, + 8EB26028082DBC69007A908B, + 8EB26029082DBC69007A908B, + 8EB2602A082DBC69007A908B, + 8EB2602B082DBC69007A908B, + ); + isa = PBXGroup; + name = hip; + path = Files/src/hip; + refType = 4; + sourceTree = ""; + }; + 8EB26014082DBC69007A908B = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + path = common.c; + refType = 4; + sourceTree = ""; + }; + 8EB26015082DBC69007A908B = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = common.h; + refType = 4; + sourceTree = ""; + }; + 8EB26016082DBC69007A908B = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + path = dct64_i386.c; + refType = 4; + sourceTree = ""; + }; + 8EB26017082DBC69007A908B = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = dct64_i386.h; + refType = 4; + sourceTree = ""; + }; + 8EB26018082DBC69007A908B = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + path = decode_i386.c; + refType = 4; + sourceTree = ""; + }; + 8EB26019082DBC69007A908B = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = decode_i386.h; + refType = 4; + sourceTree = ""; + }; + 8EB2601A082DBC69007A908B = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + path = DecodeEngine_Hip.cpp; + refType = 4; + sourceTree = ""; + }; + 8EB2601B082DBC69007A908B = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = HIPDefines.h; + refType = 4; + sourceTree = ""; + }; + 8EB2601C082DBC69007A908B = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = huffman.h; + refType = 4; + sourceTree = ""; + }; + 8EB2601D082DBC69007A908B = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + path = interface.c; + refType = 4; + sourceTree = ""; + }; + 8EB2601E082DBC69007A908B = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = interface.h; + refType = 4; + sourceTree = ""; + }; + 8EB2601F082DBC69007A908B = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = l2tables.h; + refType = 4; + sourceTree = ""; + }; + 8EB26020082DBC69007A908B = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + path = layer1.c; + refType = 4; + sourceTree = ""; + }; + 8EB26021082DBC69007A908B = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = layer1.h; + refType = 4; + sourceTree = ""; + }; + 8EB26022082DBC69007A908B = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + path = layer2.c; + refType = 4; + sourceTree = ""; + }; + 8EB26023082DBC69007A908B = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = layer2.h; + refType = 4; + sourceTree = ""; + }; + 8EB26024082DBC69007A908B = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + path = layer3.c; + refType = 4; + sourceTree = ""; + }; + 8EB26025082DBC69007A908B = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = layer3.h; + refType = 4; + sourceTree = ""; + }; + 8EB26026082DBC69007A908B = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = mpg123.h; + refType = 4; + sourceTree = ""; + }; + 8EB26027082DBC69007A908B = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = mpglib.h; + refType = 4; + sourceTree = ""; + }; + 8EB26028082DBC69007A908B = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + path = tabinit.c; + refType = 4; + sourceTree = ""; + }; + 8EB26029082DBC69007A908B = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = tabinit.h; + refType = 4; + sourceTree = ""; + }; + 8EB2602A082DBC69007A908B = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + path = VbrTag.c; + refType = 4; + sourceTree = ""; + }; + 8EB2602B082DBC69007A908B = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = VbrTag.h; + refType = 4; + sourceTree = ""; + }; + 8EB2602C082DBC69007A908B = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = IFileAccess.h; + path = Files/src/IFileAccess.h; + refType = 4; + sourceTree = ""; + }; + 8EB2602D082DBC69007A908B = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = MemBuffer.h; + path = Files/src/MemBuffer.h; + refType = 4; + sourceTree = ""; + }; + 8EB2602E082DBC69007A908B = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + name = MPADecoder.cpp; + path = Files/src/MPADecoder.cpp; + refType = 4; + sourceTree = ""; + }; + 8EB2602F082DBC69007A908B = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = MPADecoder.h; + path = Files/src/MPADecoder.h; + refType = 4; + sourceTree = ""; + }; + 8EB26030082DBC69007A908B = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + name = MPAFrameFinder.cpp; + path = Files/src/MPAFrameFinder.cpp; + refType = 4; + sourceTree = ""; + }; + 8EB26031082DBC69007A908B = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = MPAFrameFinder.h; + path = Files/src/MPAFrameFinder.h; + refType = 4; + sourceTree = ""; + }; + 8EB26032082DBC69007A908B = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + name = MPAInfo.cpp; + path = Files/src/MPAInfo.cpp; + refType = 4; + sourceTree = ""; + }; + 8EB26033082DBC69007A908B = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = MPAInfo.h; + path = Files/src/MPAInfo.h; + refType = 4; + sourceTree = ""; + }; + 8EB26034082DBC69007A908B = { + children = ( + 8EB26035082DBC69007A908B, + 8EB26036082DBC69007A908B, + 8EB26037082DBC69007A908B, + 8EB26038082DBC69007A908B, + ); + isa = PBXGroup; + name = mpegAudioFrame; + path = Files/src/mpegAudioFrame; + refType = 4; + sourceTree = ""; + }; + 8EB26035082DBC69007A908B = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + path = dxHead.cpp; + refType = 4; + sourceTree = ""; + }; + 8EB26036082DBC69007A908B = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = dxHead.h; + refType = 4; + sourceTree = ""; + }; + 8EB26037082DBC69007A908B = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + path = mpegAudioHeader.cpp; + refType = 4; + sourceTree = ""; + }; + 8EB26038082DBC69007A908B = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = mpegAudioHeader.h; + refType = 4; + sourceTree = ""; + }; + 8EB26039082DBC69007A908B = { + fileRef = 8EB26003082DBC69007A908B; + isa = PBXBuildFile; + settings = { + }; + }; + 8EB2603A082DBC69007A908B = { + fileRef = 8EB26004082DBC69007A908B; + isa = PBXBuildFile; + settings = { + }; + }; + 8EB2603E082DBC69007A908B = { + fileRef = 8EB26009082DBC69007A908B; + isa = PBXBuildFile; + settings = { + }; + }; + 8EB26040082DBC69007A908B = { + fileRef = 8EB2600B082DBC69007A908B; + isa = PBXBuildFile; + settings = { + }; + }; + 8EB26042082DBC69007A908B = { + fileRef = 8EB2600D082DBC69007A908B; + isa = PBXBuildFile; + settings = { + }; + }; + 8EB26044082DBC69007A908B = { + fileRef = 8EB2600F082DBC69007A908B; + isa = PBXBuildFile; + settings = { + }; + }; + 8EB26046082DBC69007A908B = { + fileRef = 8EB26011082DBC69007A908B; + isa = PBXBuildFile; + settings = { + }; + }; + 8EB26048082DBC69007A908B = { + fileRef = 8EB26014082DBC69007A908B; + isa = PBXBuildFile; + settings = { + }; + }; + 8EB2604A082DBC69007A908B = { + fileRef = 8EB26016082DBC69007A908B; + isa = PBXBuildFile; + settings = { + }; + }; + 8EB2604C082DBC69007A908B = { + fileRef = 8EB26018082DBC69007A908B; + isa = PBXBuildFile; + settings = { + }; + }; + 8EB2604E082DBC69007A908B = { + fileRef = 8EB2601A082DBC69007A908B; + isa = PBXBuildFile; + settings = { + }; + }; + 8EB26051082DBC69007A908B = { + fileRef = 8EB2601D082DBC69007A908B; + isa = PBXBuildFile; + settings = { + }; + }; + 8EB26054082DBC69007A908B = { + fileRef = 8EB26020082DBC69007A908B; + isa = PBXBuildFile; + settings = { + }; + }; + 8EB26056082DBC69007A908B = { + fileRef = 8EB26022082DBC69007A908B; + isa = PBXBuildFile; + settings = { + }; + }; + 8EB26058082DBC69007A908B = { + fileRef = 8EB26024082DBC69007A908B; + isa = PBXBuildFile; + settings = { + }; + }; + 8EB2605C082DBC69007A908B = { + fileRef = 8EB26028082DBC69007A908B; + isa = PBXBuildFile; + settings = { + }; + }; + 8EB2605E082DBC69007A908B = { + fileRef = 8EB2602A082DBC69007A908B; + isa = PBXBuildFile; + settings = { + }; + }; + 8EB26062082DBC69007A908B = { + fileRef = 8EB2602E082DBC69007A908B; + isa = PBXBuildFile; + settings = { + }; + }; + 8EB26064082DBC69007A908B = { + fileRef = 8EB26030082DBC69007A908B; + isa = PBXBuildFile; + settings = { + }; + }; + 8EB26066082DBC69007A908B = { + fileRef = 8EB26032082DBC69007A908B; + isa = PBXBuildFile; + settings = { + }; + }; + 8EB26068082DBC69007A908B = { + fileRef = 8EB26035082DBC69007A908B; + isa = PBXBuildFile; + settings = { + }; + }; + 8EB2606A082DBC69007A908B = { + fileRef = 8EB26037082DBC69007A908B; + isa = PBXBuildFile; + settings = { + }; + }; + 8EB2607A082DBCD0007A908B = { + children = ( + 8EB2607C082DBCDF007A908B, + ); + isa = PBXGroup; + name = Headers; + refType = 4; + sourceTree = ""; + }; + 8EB2607C082DBCDF007A908B = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = decmpa.h; + path = Files/include/decmpa.h; + refType = 4; + sourceTree = ""; + }; + 8EB26083082DBDFD007A908B = { + fileRef = 8EB2607C082DBCDF007A908B; + isa = PBXBuildFile; + settings = { + ATTRIBUTES = ( + Public, + ); + }; + }; + }; + rootObject = 0867D690FE84028FC02AAC07; +} diff --git a/Libraries/DecMPA/DecMPA.xcode/xugg.mode1 b/Libraries/DecMPA/DecMPA.xcode/xugg.mode1 new file mode 100644 index 000000000..a1678aa4f --- /dev/null +++ b/Libraries/DecMPA/DecMPA.xcode/xugg.mode1 @@ -0,0 +1,1240 @@ + + + + + ActivePerspectiveName + Project + AllowedModules + + + BundleLoadPath + + MaxInstances + n + Module + PBXSmartGroupTreeModule + Name + Groups and Files Outline View + + + BundleLoadPath + + MaxInstances + n + Module + PBXNavigatorGroup + Name + Editor + + + BundleLoadPath + + MaxInstances + n + Module + XCTaskListModule + Name + Task List + + + BundleLoadPath + + MaxInstances + n + Module + XCDetailModule + Name + File and Smart Group Detail Viewer + + + BundleLoadPath + + MaxInstances + 1 + Module + PBXBuildResultsModule + Name + Detailed Build Results Viewer + + + BundleLoadPath + + MaxInstances + 1 + Module + PBXProjectFindModule + Name + Project Batch Find Tool + + + BundleLoadPath + + MaxInstances + n + Module + PBXRunSessionModule + Name + Run Log + + + BundleLoadPath + + MaxInstances + n + Module + PBXBookmarksModule + Name + Bookmarks Tool + + + BundleLoadPath + + MaxInstances + n + Module + PBXClassBrowserModule + Name + Class Browser + + + BundleLoadPath + + MaxInstances + n + Module + PBXCVSModule + Name + Source Code Control Tool + + + BundleLoadPath + + MaxInstances + n + Module + PBXDebugBreakpointsModule + Name + Debug Breakpoints Tool + + + BundleLoadPath + + MaxInstances + n + Module + XCDockableInspector + Name + Inspector + + + BundleLoadPath + + MaxInstances + n + Module + PBXOpenQuicklyModule + Name + Open Quickly Tool + + + BundleLoadPath + + MaxInstances + 1 + Module + PBXDebugSessionModule + Name + Debugger + + + BundleLoadPath + + MaxInstances + 1 + Module + PBXDebugCLIModule + Name + Debug Console + + + Description + DefaultDescriptionKey + DockingSystemVisible + + Extension + mode1 + FavBarConfig + + PBXProjectModuleGUID + 8EB25FF7082DBBEE007A908B + XCBarModuleItemNames + + XCBarModuleItems + + + FirstTimeWindowDisplayed + + Identifier + com.apple.perspectives.project.mode1 + MajorVersion + 31 + MinorVersion + 1 + Name + Default + Notifications + + OpenEditors + + PerspectiveWidths + + -1 + -1 + + Perspectives + + + ChosenToolbarItems + + active-target-popup + action + NSToolbarFlexibleSpaceItem + buildOrClean + build-and-runOrDebug + com.apple.ide.PBXToolbarStopButton + get-info + toggle-editor + NSToolbarFlexibleSpaceItem + com.apple.pbx.toolbar.searchfield + + ControllerClassBaseName + + IconName + WindowOfProjectWithEditor + Identifier + perspective.project + IsVertical + + Layout + + + BecomeActive + + ContentConfiguration + + PBXBottomSmartGroupGIDs + + 1C37FBAC04509CD000000102 + 1C37FAAC04509CD000000102 + 1C08E77C0454961000C914BD + 1C37FABC05509CD000000102 + 1C37FABC05539CD112110102 + E2644B35053B69B200211256 + 1C37FABC04509CD000100104 + 1CC0EA4004350EF90044410B + 1CC0EA4004350EF90041110B + + PBXProjectModuleGUID + 1CE0B1FE06471DED0097A5F4 + PBXProjectModuleLabel + Files + PBXProjectStructureProvided + yes + PBXSmartGroupTreeModuleColumnData + + PBXSmartGroupTreeModuleColumnWidthsKey + + 186 + + PBXSmartGroupTreeModuleColumnsKey_v4 + + MainColumn + + + PBXSmartGroupTreeModuleOutlineStateKey_v7 + + PBXSmartGroupTreeModuleOutlineStateExpansionKey + + 0867D691FE84028FC02AAC07 + 8EB2607A082DBCD0007A908B + 1C37FBAC04509CD000000102 + 1C37FABC05509CD000000102 + + PBXSmartGroupTreeModuleOutlineStateSelectionKey + + + 8 + 7 + + + PBXSmartGroupTreeModuleOutlineStateVisibleRectKey + {{0, 0}, {186, 338}} + + PBXTopSmartGroupGIDs + + XCIncludePerspectivesSwitch + + XCSharingToken + com.apple.Xcode.GFSharingToken + + GeometryConfiguration + + Frame + {{0, 0}, {203, 356}} + GroupTreeTableConfiguration + + MainColumn + 186 + + RubberWindowFrame + 167 339 690 397 0 0 1024 746 + + Module + PBXSmartGroupTreeModule + Proportion + 203pt + + + Dock + + + ContentConfiguration + + PBXProjectModuleGUID + 1CE0B20306471E060097A5F4 + PBXProjectModuleLabel + decmpa.h + PBXSplitModuleInNavigatorKey + + Split0 + + PBXProjectModuleGUID + 1CE0B20406471E060097A5F4 + PBXProjectModuleLabel + decmpa.h + _historyCapacity + 0 + bookmark + 8E6F2A7E08480F330011F126 + history + + 8E5E0CE1082E6B2000A1FEF4 + + + SplitCount + 1 + + StatusBarVisibility + + + GeometryConfiguration + + Frame + {{0, 0}, {482, 0}} + RubberWindowFrame + 167 339 690 397 0 0 1024 746 + + Module + PBXNavigatorGroup + Proportion + 0pt + + + ContentConfiguration + + PBXProjectModuleGUID + 1CE0B20506471E060097A5F4 + PBXProjectModuleLabel + Detail + + GeometryConfiguration + + Frame + {{0, 5}, {482, 351}} + RubberWindowFrame + 167 339 690 397 0 0 1024 746 + + Module + XCDetailModule + Proportion + 351pt + + + Proportion + 482pt + + + Name + Project + ServiceClasses + + XCModuleDock + PBXSmartGroupTreeModule + XCModuleDock + PBXNavigatorGroup + XCDetailModule + + TableOfContents + + 8E6F2A7F08480F330011F126 + 1CE0B1FE06471DED0097A5F4 + 8E6F2A8008480F330011F126 + 1CE0B20306471E060097A5F4 + 1CE0B20506471E060097A5F4 + + ToolbarConfiguration + xcode.toolbar.config.default + + + ControllerClassBaseName + + IconName + WindowOfProject + Identifier + perspective.morph + IsVertical + 0 + Layout + + + BecomeActive + 1 + ContentConfiguration + + PBXBottomSmartGroupGIDs + + 1C37FBAC04509CD000000102 + 1C37FAAC04509CD000000102 + 1C08E77C0454961000C914BD + 1C37FABC05509CD000000102 + 1C37FABC05539CD112110102 + E2644B35053B69B200211256 + 1C37FABC04509CD000100104 + 1CC0EA4004350EF90044410B + 1CC0EA4004350EF90041110B + + PBXProjectModuleGUID + 11E0B1FE06471DED0097A5F4 + PBXProjectModuleLabel + Files + PBXProjectStructureProvided + yes + PBXSmartGroupTreeModuleColumnData + + PBXSmartGroupTreeModuleColumnWidthsKey + + 186 + + PBXSmartGroupTreeModuleColumnsKey_v4 + + MainColumn + + + PBXSmartGroupTreeModuleOutlineStateKey_v7 + + PBXSmartGroupTreeModuleOutlineStateExpansionKey + + 29B97314FDCFA39411CA2CEA + 1C37FABC05509CD000000102 + + PBXSmartGroupTreeModuleOutlineStateSelectionKey + + + 0 + + + PBXSmartGroupTreeModuleOutlineStateVisibleRectKey + {{0, 0}, {186, 337}} + + PBXTopSmartGroupGIDs + + XCIncludePerspectivesSwitch + 1 + XCSharingToken + com.apple.Xcode.GFSharingToken + + GeometryConfiguration + + Frame + {{0, 0}, {203, 355}} + GroupTreeTableConfiguration + + MainColumn + 186 + + RubberWindowFrame + 373 269 690 397 0 0 1440 878 + + Module + PBXSmartGroupTreeModule + Proportion + 100% + + + Name + Morph + PreferredWidth + 300 + ServiceClasses + + XCModuleDock + PBXSmartGroupTreeModule + + TableOfContents + + 11E0B1FE06471DED0097A5F4 + + ToolbarConfiguration + xcode.toolbar.config.default.short + + + PerspectivesBarVisible + + ShelfIsVisible + + SourceDescription + file at '/System/Library/PrivateFrameworks/DevToolsInterface.framework/Versions/A/Resources/XCPerspectivesSpecificationMode1.xcperspec' + StatusbarIsVisible + + TimeStamp + 0.0 + ToolbarDisplayMode + 1 + ToolbarIsVisible + + ToolbarSizeMode + 1 + Type + Perspectives + UpdateMessage + The Default Workspace in this version of Xcode now includes support to hide and show the detail view (what has been referred to as the "Metro-Morph" feature). You must discard your current Default Workspace settings and update to the latest Default Workspace in order to gain this feature. Do you wish to update to the latest Workspace defaults for project '%@'? + WindowJustification + 5 + WindowOrderList + + /Users/xugg/Projects/Cog/Libraries/DecMPA/DecMPA.xcode + + WindowString + 167 339 690 397 0 0 1024 746 + WindowTools + + + FirstTimeWindowDisplayed + + Identifier + windowTool.build + IsVertical + + Layout + + + Dock + + + ContentConfiguration + + PBXProjectModuleGUID + 1CD0528F0623707200166675 + PBXProjectModuleLabel + + StatusBarVisibility + + + GeometryConfiguration + + Frame + {{0, 0}, {500, 218}} + RubberWindowFrame + 188 213 500 500 0 0 1024 746 + + Module + PBXNavigatorGroup + Proportion + 218pt + + + BecomeActive + + ContentConfiguration + + PBXProjectModuleGUID + XCMainBuildResultsModuleGUID + PBXProjectModuleLabel + Build + XCBuildResultsTrigger_Collapse + 1021 + XCBuildResultsTrigger_Open + 1011 + + GeometryConfiguration + + Frame + {{0, 223}, {500, 236}} + RubberWindowFrame + 188 213 500 500 0 0 1024 746 + + Module + PBXBuildResultsModule + Proportion + 236pt + + + Proportion + 459pt + + + Name + Build Results + ServiceClasses + + PBXBuildResultsModule + + StatusbarIsVisible + + TableOfContents + + 8EB2606E082DBC79007A908B + 8EB2606F082DBC79007A908B + 1CD0528F0623707200166675 + XCMainBuildResultsModuleGUID + + ToolbarConfiguration + xcode.toolbar.config.build + WindowString + 188 213 500 500 0 0 1024 746 + WindowToolGUID + 8EB2606E082DBC79007A908B + WindowToolIsVisible + + + + Identifier + windowTool.debugger + Layout + + + Dock + + + ContentConfiguration + + Debugger + + HorizontalSplitView + + _collapsingFrameDimension + 0.0 + _indexOfCollapsedView + 0 + _percentageOfCollapsedView + 0.0 + isCollapsed + yes + sizes + + {{0, 0}, {317, 164}} + {{317, 0}, {377, 164}} + + + VerticalSplitView + + _collapsingFrameDimension + 0.0 + _indexOfCollapsedView + 0 + _percentageOfCollapsedView + 0.0 + isCollapsed + yes + sizes + + {{0, 0}, {694, 164}} + {{0, 164}, {694, 216}} + + + + LauncherConfigVersion + 8 + PBXProjectModuleGUID + 1C162984064C10D400B95A72 + PBXProjectModuleLabel + Debug - GLUTExamples (Underwater) + + GeometryConfiguration + + DebugConsoleDrawerSize + {100, 120} + DebugConsoleVisible + None + DebugConsoleWindowFrame + {{200, 200}, {500, 300}} + DebugSTDIOWindowFrame + {{200, 200}, {500, 300}} + Frame + {{0, 0}, {694, 380}} + RubberWindowFrame + 321 238 694 422 0 0 1440 878 + + Module + PBXDebugSessionModule + Proportion + 100% + + + Proportion + 100% + + + Name + Debugger + ServiceClasses + + PBXDebugSessionModule + + StatusbarIsVisible + 1 + TableOfContents + + 1CD10A99069EF8BA00B06720 + 1C0AD2AB069F1E9B00FABCE6 + 1C162984064C10D400B95A72 + 1C0AD2AC069F1E9B00FABCE6 + + ToolbarConfiguration + xcode.toolbar.config.debug + WindowString + 321 238 694 422 0 0 1440 878 + WindowToolGUID + 1CD10A99069EF8BA00B06720 + WindowToolIsVisible + 0 + + + Identifier + windowTool.find + Layout + + + Dock + + + Dock + + + ContentConfiguration + + PBXProjectModuleGUID + 1CDD528C0622207200134675 + PBXProjectModuleLabel + <No Editor> + PBXSplitModuleInNavigatorKey + + Split0 + + PBXProjectModuleGUID + 1CD0528D0623707200166675 + + SplitCount + 1 + + StatusBarVisibility + 1 + + GeometryConfiguration + + Frame + {{0, 0}, {781, 167}} + RubberWindowFrame + 62 385 781 470 0 0 1440 878 + + Module + PBXNavigatorGroup + Proportion + 781pt + + + Proportion + 50% + + + BecomeActive + 1 + ContentConfiguration + + PBXProjectModuleGUID + 1CD0528E0623707200166675 + PBXProjectModuleLabel + Project Find + + GeometryConfiguration + + Frame + {{8, 0}, {773, 254}} + RubberWindowFrame + 62 385 781 470 0 0 1440 878 + + Module + PBXProjectFindModule + Proportion + 50% + + + Proportion + 428pt + + + Name + Project Find + ServiceClasses + + PBXProjectFindModule + + StatusbarIsVisible + 1 + TableOfContents + + 1C530D57069F1CE1000CFCEE + 1C530D58069F1CE1000CFCEE + 1C530D59069F1CE1000CFCEE + 1CDD528C0622207200134675 + 1C530D5A069F1CE1000CFCEE + 1CE0B1FE06471DED0097A5F4 + 1CD0528E0623707200166675 + + WindowString + 62 385 781 470 0 0 1440 878 + WindowToolGUID + 1C530D57069F1CE1000CFCEE + WindowToolIsVisible + 0 + + + Identifier + MENUSEPARATOR + + + Identifier + windowTool.debuggerConsole + Layout + + + Dock + + + BecomeActive + 1 + ContentConfiguration + + PBXProjectModuleGUID + 1C78EAAC065D492600B07095 + PBXProjectModuleLabel + Debugger Console + + GeometryConfiguration + + Frame + {{0, 0}, {440, 358}} + RubberWindowFrame + 650 41 440 400 0 0 1280 1002 + + Module + PBXDebugCLIModule + Proportion + 358pt + + + Proportion + 358pt + + + Name + Debugger Console + ServiceClasses + + PBXDebugCLIModule + + StatusbarIsVisible + 1 + TableOfContents + + 1C78EAAD065D492600B07095 + 1C78EAAE065D492600B07095 + 1C78EAAC065D492600B07095 + + WindowString + 650 41 440 400 0 0 1280 1002 + + + Identifier + windowTool.run + Layout + + + Dock + + + ContentConfiguration + + LauncherConfigVersion + 3 + PBXProjectModuleGUID + 1CD0528B0623707200166675 + PBXProjectModuleLabel + Run + Runner + + HorizontalSplitView + + _collapsingFrameDimension + 0.0 + _indexOfCollapsedView + 0 + _percentageOfCollapsedView + 0.0 + isCollapsed + yes + sizes + + {{0, 0}, {493, 167}} + {{0, 176}, {493, 267}} + + + VerticalSplitView + + _collapsingFrameDimension + 0.0 + _indexOfCollapsedView + 0 + _percentageOfCollapsedView + 0.0 + isCollapsed + yes + sizes + + {{0, 0}, {405, 443}} + {{414, 0}, {514, 443}} + + + + + GeometryConfiguration + + Frame + {{0, 0}, {460, 159}} + RubberWindowFrame + 316 696 459 200 0 0 1280 1002 + + Module + PBXRunSessionModule + Proportion + 159pt + + + Proportion + 159pt + + + Name + Run Log + ServiceClasses + + PBXRunSessionModule + + StatusbarIsVisible + 1 + TableOfContents + + 1C0AD2B3069F1EA900FABCE6 + 1C0AD2B4069F1EA900FABCE6 + 1CD0528B0623707200166675 + 1C0AD2B5069F1EA900FABCE6 + + ToolbarConfiguration + xcode.toolbar.config.run + WindowString + 316 696 459 200 0 0 1280 1002 + WindowToolGUID + 1C0AD2B3069F1EA900FABCE6 + WindowToolIsVisible + 0 + + + Identifier + windowTool.scm + Layout + + + Dock + + + ContentConfiguration + + PBXProjectModuleGUID + 1C78EAB2065D492600B07095 + PBXProjectModuleLabel + <No Editor> + PBXSplitModuleInNavigatorKey + + Split0 + + PBXProjectModuleGUID + 1C78EAB3065D492600B07095 + + SplitCount + 1 + + StatusBarVisibility + 1 + + GeometryConfiguration + + Frame + {{0, 0}, {452, 0}} + RubberWindowFrame + 743 379 452 308 0 0 1280 1002 + + Module + PBXNavigatorGroup + Proportion + 0pt + + + BecomeActive + 1 + ContentConfiguration + + PBXProjectModuleGUID + 1CD052920623707200166675 + PBXProjectModuleLabel + SCM + + GeometryConfiguration + + ConsoleFrame + {{0, 259}, {452, 0}} + Frame + {{0, 7}, {452, 259}} + RubberWindowFrame + 743 379 452 308 0 0 1280 1002 + TableConfiguration + + Status + 30 + FileName + 199 + Path + 197.09500122070312 + + TableFrame + {{0, 0}, {452, 250}} + + Module + PBXCVSModule + Proportion + 262pt + + + Proportion + 266pt + + + Name + SCM + ServiceClasses + + PBXCVSModule + + StatusbarIsVisible + 1 + TableOfContents + + 1C78EAB4065D492600B07095 + 1C78EAB5065D492600B07095 + 1C78EAB2065D492600B07095 + 1CD052920623707200166675 + + ToolbarConfiguration + xcode.toolbar.config.scm + WindowString + 743 379 452 308 0 0 1280 1002 + + + Identifier + windowTool.breakpoints + Layout + + + Dock + + + BecomeActive + 1 + ContentConfiguration + + PBXProjectModuleGUID + 1CD052930623707200166675 + PBXProjectModuleLabel + Breakpoints + + GeometryConfiguration + + BreakpointsTreeTableConfiguration + + enabledColumn + 16 + breakpointColumn + 201.5830078125 + + Frame + {{0, 0}, {240, 195}} + RubberWindowFrame + 342 421 240 216 0 0 1440 878 + + Module + PBXDebugBreakpointsModule + Proportion + 195pt + + + Proportion + 195pt + + + Name + Breakpoints + ServiceClasses + + PBXDebugBreakpointsModule + + StatusbarIsVisible + 0 + TableOfContents + + 1C0AD2AD069F1E9B00FABCE6 + 1C0AD2AE069F1E9B00FABCE6 + 1CD052930623707200166675 + + WindowString + 342 421 240 216 0 0 1440 878 + WindowToolGUID + 1C0AD2AD069F1E9B00FABCE6 + WindowToolIsVisible + 0 + + + Identifier + windowTool.bookmarks + Layout + + + Dock + + + Module + PBXBookmarksModule + Proportion + 100% + + + Proportion + 100% + + + Name + Bookmarks + ServiceClasses + + PBXBookmarksModule + + StatusbarIsVisible + 0 + WindowString + 538 42 401 187 0 0 1280 1002 + + + Identifier + windowTool.classBrowser + Layout + + + Dock + + + BecomeActive + 1 + ContentConfiguration + + OptionsSetName + Hierarchy, all classes + PBXProjectModuleGUID + 1CA6456E063B45B4001379D8 + PBXProjectModuleLabel + Class Browser - NSObject + + GeometryConfiguration + + ClassesFrame + {{0, 0}, {374, 96}} + ClassesTreeTableConfiguration + + PBXClassNameColumnIdentifier + 208 + PBXClassBookColumnIdentifier + 22 + + Frame + {{0, 0}, {630, 331}} + MembersFrame + {{0, 105}, {374, 395}} + MembersTreeTableConfiguration + + PBXMemberTypeIconColumnIdentifier + 22 + PBXMemberNameColumnIdentifier + 216 + PBXMemberTypeColumnIdentifier + 97 + PBXMemberBookColumnIdentifier + 22 + + PBXModuleWindowStatusBarHidden2 + 1 + RubberWindowFrame + 385 179 630 352 0 0 1440 878 + + Module + PBXClassBrowserModule + Proportion + 332pt + + + Proportion + 332pt + + + Name + Class Browser + ServiceClasses + + PBXClassBrowserModule + + StatusbarIsVisible + 0 + TableOfContents + + 1C0AD2AF069F1E9B00FABCE6 + 1C0AD2B0069F1E9B00FABCE6 + 1CA6456E063B45B4001379D8 + + ToolbarConfiguration + xcode.toolbar.config.classbrowser + WindowString + 385 179 630 352 0 0 1440 878 + WindowToolGUID + 1C0AD2AF069F1E9B00FABCE6 + WindowToolIsVisible + 0 + + + + diff --git a/Libraries/DecMPA/DecMPA.xcode/xugg.pbxuser b/Libraries/DecMPA/DecMPA.xcode/xugg.pbxuser new file mode 100644 index 000000000..b674a251d --- /dev/null +++ b/Libraries/DecMPA/DecMPA.xcode/xugg.pbxuser @@ -0,0 +1,122 @@ +// !$*UTF8*$! +{ + 0867D690FE84028FC02AAC07 = { + activeBuildStyle = 4F0BB7ED011F40E904CA0E50; + activeTarget = 8D07F2BC0486CC7A007CD1D0; + addToTargets = ( + 8D07F2BC0486CC7A007CD1D0, + ); + codeSenseManager = 8EB25FF9082DBBEE007A908B; + perUserDictionary = { + PBXConfiguration.PBXFileTableDataSource3.PBXErrorsWarningsDataSource = { + PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; + PBXFileTableDataSourceColumnSortingKey = PBXErrorsWarningsDataSource_LocationID; + PBXFileTableDataSourceColumnWidthsKey = ( + 20, + 300, + 133.2085, + ); + PBXFileTableDataSourceColumnsKey = ( + PBXErrorsWarningsDataSource_TypeID, + PBXErrorsWarningsDataSource_MessageID, + PBXErrorsWarningsDataSource_LocationID, + ); + }; + PBXConfiguration.PBXFileTableDataSource3.PBXFileTableDataSource = { + PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; + PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID; + PBXFileTableDataSourceColumnWidthsKey = ( + 20, + 243, + 20, + 48, + 43, + 43, + 20, + ); + PBXFileTableDataSourceColumnsKey = ( + PBXFileDataSource_FiletypeID, + PBXFileDataSource_Filename_ColumnID, + PBXFileDataSource_Built_ColumnID, + PBXFileDataSource_ObjectSize_ColumnID, + PBXFileDataSource_Errors_ColumnID, + PBXFileDataSource_Warnings_ColumnID, + PBXFileDataSource_Target_ColumnID, + ); + }; + PBXConfiguration.PBXTargetDataSource.PBXTargetDataSource = { + PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; + PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID; + PBXFileTableDataSourceColumnWidthsKey = ( + 20, + 200, + 63, + 20, + 48, + 43, + 43, + ); + PBXFileTableDataSourceColumnsKey = ( + PBXFileDataSource_FiletypeID, + PBXFileDataSource_Filename_ColumnID, + PBXTargetDataSource_PrimaryAttribute, + PBXFileDataSource_Built_ColumnID, + PBXFileDataSource_ObjectSize_ColumnID, + PBXFileDataSource_Errors_ColumnID, + PBXFileDataSource_Warnings_ColumnID, + ); + }; + PBXPerProjectTemplateStateSaveDate = 138940180; + PBXWorkspaceStateSaveDate = 138940180; + }; + perUserProjectItems = { + 8E5E0CE1082E6B2000A1FEF4 = 8E5E0CE1082E6B2000A1FEF4; + 8E6F2A7E08480F330011F126 = 8E6F2A7E08480F330011F126; + }; + sourceControlManager = 8EB25FF8082DBBEE007A908B; + userBuildSettings = { + }; + }; + 8D07F2BC0486CC7A007CD1D0 = { + activeExec = 0; + }; + 8E5E0CE1082E6B2000A1FEF4 = { + fRef = 8EB2607C082DBCDF007A908B; + isa = PBXTextBookmark; + name = "decmpa.h: 7"; + rLen = 0; + rLoc = 333; + rType = 0; + vrLen = 0; + vrLoc = 0; + }; + 8E6F2A7E08480F330011F126 = { + fRef = 8EB2607C082DBCDF007A908B; + isa = PBXTextBookmark; + name = "decmpa.h: 7"; + rLen = 0; + rLoc = 333; + rType = 0; + vrLen = 0; + vrLoc = 0; + }; + 8EB25FF8082DBBEE007A908B = { + fallbackIsa = XCSourceControlManager; + isSCMEnabled = 0; + isa = PBXSourceControlManager; + scmConfiguration = { + }; + scmType = ""; + }; + 8EB25FF9082DBBEE007A908B = { + indexTemplatePath = ""; + isa = PBXCodeSenseManager; + }; + 8EB2607C082DBCDF007A908B = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {818, 7798}}"; + sepNavSelRange = "{333, 0}"; + sepNavVisRect = "{{0, 0}, {0, 0}}"; + }; + }; +} diff --git a/Libraries/DecMPA/English.lproj/InfoPlist.strings b/Libraries/DecMPA/English.lproj/InfoPlist.strings new file mode 100644 index 0000000000000000000000000000000000000000..ad48c78ff2c1452984568852d4b992ddf87d7dbc GIT binary patch literal 142 zcmW-Z-3o$W5JbMAX-Ldpbu{yWZ9kB;V{dOEeU~~o`O3a z4Ko#`*;jotnDji=pw`~AU#;KpTKR#GX)8UgRAOi39651dlrH5euJ%9FK + #endif + #define DECMPA_CC CALLBACK + +#else + + #define DECMPA_CC + +#endif + +/**\def DECMPA_CC +Macro for the calling convention used by DecMPA functions.*/ + + +/**\defgroup GroupFunctions Functions*/ + +/**\defgroup GroupResults Result Codes +Description of the result codes that are returned by most DecMPA functions. + +Codes of the form DECMPA_ERROR_*** represent errors and are all negative. +The other result codes, all >=0, indicate different degrees of success.*/ + +/**\defgroup GroupParamIDs Configuations Parameters +Description of the possible parameters that can be defined using +#DecMPA_SetParam. +*/ + +/**\defgroup GroupParamValues Configuration Parameter Values +Description of the value constants that can be assigned to some configuration +parameters.*/ + +/**\defgroup GroupStructs Structures*/ + + +/**\addtogroup GroupStructs*/ +/*@{*/ + +/**This structure contains pointers to the functions that are used +to read the MP3 data during DecMPA_Decode.*/ +typedef struct +{ + /**Pointer to the function that is used to read data. If this pointer + is NULL, DecMPA will read from stdin and ignore the other callback + functions. + + @param pContext context pointer that was passed to + #DecMPA_CreateUsingCallbacks + @param pBuffer buffer that the data should be stored into + @param nBytes number of bytes to read + @return the number of bytes read or -1 if an error occurred. If + the returned value is less than nBytes it is assumed that the end + of the data stream was reached. + + \note the function that the pointer points to should have the calling + convention DECMPA_CC, i.e. it should be defined as: + \code + long DECMPA_CC MyReadFuncName(void* pContext,void* pBuffer,long nBytes); + \endcode*/ + long (DECMPA_CC* Read)(void* pContext,void* pBuffer,long nBytes); + + + + /**Pointer to function that seeks to the specified data stream position. + This function pointer should be set to NULL if seeking is not supported. + + @param pContext context pointer that was passed to + #DecMPA_CreateUsingCallbacks + @param DestPos destination position, in bytes. + @return nonzero if successful, 0 otherwise. + + \note the function that the pointer points to should have the calling + convention DECMPA_CC, i.e. it should be defined as: + \code + int DECMPA_CC MySeekFuncName(void* pContext,long DestPos); + \endcode*/ + int (DECMPA_CC* Seek)(void* pContext,long DestPos); + + + + /**Pointer to a function that returns the length of the data stream. + This function pointer can be set to NULL if the length cannot be + determined. Alternatively the function can return -1, + + @param pContext context pointer that was passed to + #DecMPA_CreateUsingCallbacks + @return the length, in bytes. -1 if unknown. + + \note the function that the pointer points to should have the calling + convention DECMPA_CC, i.e. it should be defined as: + \code + long DECMPA_CC MyGetLengthFuncName(void* pContext); + \endcode*/ + long (DECMPA_CC* GetLength)(void* pContext); + + + + /**Pointer to a function that returns the current position in the data + stream. This function pointer can only be NULL if Read is also NULL. + + @param pContext context pointer that was passed to + #DecMPA_CreateUsingCallbacks + @return the current position, in bytes or -1 if an error occurred. + + \note the function that the pointer points to should have the calling + convention DECMPA_CC, i.e. it should be defined as: + \code + long DECMPA_CC MyGetPositionFuncName(void* pContext); + \endcode*/ + long (DECMPA_CC* GetPosition)(void* pContext); + +} DecMPA_Callbacks; + + + +/**This structure provides information extracted from an MPEG Audio header.*/ +typedef struct +{ + /**The original header data.*/ + unsigned char aRawData[4]; + + /**Protection*/ + int bProtection; + /**Layer*/ + int nLayer; + /**Version*/ + int nVersion; + /**Padding*/ + int bPadding; + /**Frequency index*/ + int nFrequencyIndex; + /**Frequency in Hz*/ + int nFrequency; + /**Bitrate index*/ + int nBitRateIndex; + /**Extended mode*/ + int nExtendedMode; + /**Mode*/ + int nMode; + /**Input stereo*/ + int bInputStereo; + /**MPEG 2.5*/ + int bMPEG25; + + /**Frame size in bytes*/ + int nFrameSize; + /**Number of decoded samples per frame. If the data is stereo, a sample + consists of one value for the left channel and one for the right.*/ + int nDecodedSamplesPerFrame; + /**Bitrate in Kbps.*/ + int nBitRateKbps; + +} DecMPA_MPEGHeader; + + +/**DecMPA_OutputFormat objects are used to specify the format of the decoded +audio data that is returned by DecMPA_Decode.*/ +typedef struct +{ + /**Specifies the type of the data. Can be either DECMPA_OUTPUT_INT16 or + DECMPA_OUTPUT_FLOAT*/ + int nType; + + /**Specifies the frequency of the data.*/ + int nFrequency; + + /**Specifies the number of channels. Can be 1 for mono or 2 for stereo.*/ + int nChannels; + +} DecMPA_OutputFormat; + +/*@}*/ + + +/**\addtogroup GroupResults*/ +/*@{*/ + +/**The operation has been successfully completed.*/ +#define DECMPA_OK 0 + +/**The end of the stream was reached and there is no more data to decode.*/ +#define DECMPA_END 1 + +/**An invalid parameter was passed to a function.*/ +#define DECMPA_ERROR_PARAM (-1) + +/**The operation is not supported.*/ +#define DECMPA_ERROR_UNSUPPORTED (-2) + +/**There is not enough free memory.*/ +#define DECMPA_ERROR_MEMORY (-3) + +/**An internal error occurred in the decoding routines.*/ +#define DECMPA_ERROR_INTERNAL (-4) + +/**Indicates an error during decoding, which usually means that the input data +is invalid or corrupted.*/ +#define DECMPA_ERROR_DECODE (-5) + +/**An error occurred during the reading of new data.*/ +#define DECMPA_ERROR_READ (-6) + +/**An error occurred when it was tried to seek to a different position in +the data stream.*/ +#define DECMPA_ERROR_SEEK (-7) + +/**An error occurred when opening a file.*/ +#define DECMPA_ERROR_OPENFILE (-8) + +/**The decoder is in the wrong state to perform the specified +function.*/ +#define DECMPA_ERROR_WRONGSTATE (-9) + +/**The requested resource is not available*/ +#define DECMPA_ERROR_NOTAVAILABLE (-10) + +/**The version of the DecMPA library that is used is incompatible:*/ +#define DECMPA_ERROR_INCOMPATIBLEVERSION (-11) + + +/*@}*/ + + + + +/**\addtogroup GroupParamIDs*/ +/*@{*/ + +/**Specifies the format DecMPA will use to output the decoded audio samples. +Can be either #DECMPA_OUTPUT_INT16 or #DECMPA_OUTPUT_FLOAT. + +Default value: #DECMPA_OUTPUT_INT16.*/ +#define DECMPA_PARAM_OUTPUT 0 + +/**Specifies wether the decoder should load a leading ID3v2 tag and +make it available through #DecMPA_GetID3v2Data. Can be either +#DECMPA_YES or #DECMPA_NO. + +Default value: #DECMPA_NO.*/ +#define DECMPA_PARAM_PROVIDEID3V2 1 + +/*@}*/ + +/**Constant indicating the number of definable parameters.*/ +#define DECMPA_PARAMCOUNT 2 + + + +/**\addtogroup GroupParamValues*/ +/*@{*/ + +/**\defgroup GroupParamGeneric Generic values*/ +/*@{*/ + +/**Indicates that the specified function is activated.*/ +#define DECMPA_YES 1 + +/**Indicates that the specified function is not activated.*/ +#define DECMPA_NO 0 + +/*@}*/ + +/**\defgroup GroupParamOutput DECMPA_PARAM_OUTPUT values*/ +/*@{*/ + +/**Indicates that the audio samples are signed 16 bit integers (one per +channel). -32768 is the minimum and 32767 is the maximum value. + +\note As of version 0.3.0 DecMPA uses integers internally. That means that +#DECMPA_OUTPUT_INT16 is a little faster than #DECMPA_OUTPUT_FLOAT because the +latter requires an additional conversion.*/ +#define DECMPA_OUTPUT_INT16 0 + +/**Indicates that the audio samples are floats (one per channel). +-1.0 is the minimum and 1.0 is the maximum value. + +\note As of version 0.3.0 DecMPA uses integers internally. That means that +#DECMPA_OUTPUT_INT16 is a little faster than #DECMPA_OUTPUT_FLOAT because the +latter requires an additional conversion.*/ +#define DECMPA_OUTPUT_FLOAT 1 + +/*@}*/ + +/*@}*/ + + + + +/**\addtogroup GroupFunctions*/ +/*@{*/ + + +/**Creates a new decoder that obtains its input data from a file. + +If you want to provide the input data in some other customized way, use +#DecMPA_CreateUsingCallbacks instead. + +After the decoder is created, additional parameters can be configured with +#DecMPA_SetParam. + +@param ppDecoder pointer to a void* variable that receives the address of the + decoder object. +@param sFilePath path of the file to open +@param APIVersion version number of the DecMPA API. You should always + pass the constant #DECMPA_VERSION for this parameter. +@return a DecMPA result code (see \ref GroupResults).*/ +int DECMPA_CC DecMPA_CreateUsingFile(void** ppDecoder,const char* sFilePath,int APIVersion); + + + +/**Creates a new decoder that obtains its input data using callback functions. + +After the decoder is created, additional parameters can be configured with +#DecMPA_SetParam. + +@param ppDecoder pointer to a void* variable that receives the address of the + decoder object. +@param pCallbacks structure containing pointers to the callback functions that + are used to retrieve the MPEG Audio data. +@param pCallbackContext a pointer that is simply passed to the callback + functions. It has no meaning to the decoder and is only meant to be used + to pass arbitrary data to the callback functions. +@param APIVersion version number of the DecMPA API. You should always + pass the constant #DECMPA_VERSION for this parameter. +@return a DecMPA result code (see \ref GroupResults).*/ +int DECMPA_CC DecMPA_CreateUsingCallbacks(void** ppDecoder,const DecMPA_Callbacks* pCallbacks,void* pCallbackContext,int APIVersion); + + + +/**Sets additional DecMPA parameters. + +Calling this function is completely optional - if you don't call it +or only call it for some parameters, the remaining parameters will simply keep +their default values. + +This function should only be called directly after the decoder was created, +before calling any of the other functions. Otherwise DecMPA_SetParam may return +#DECMPA_ERROR_WRONGSTATE. + +@param pDecoder the decoder object +@param ID ID of the parameter to set. See \ref GroupParamIDs. +@param Value the new value for the specified parameter. Which values are possible + depends of the parameter. +@return a DecMPA result code (see \ref GroupResults).*/ +int DECMPA_CC DecMPA_SetParam(void* pDecoder,int ID,long Value); + + + +/**Returns the current value of a DecMPA parameter. + +@param pDecoder the decoder object +@param ID ID of the parameter. See \ref GroupParamIDs. +@return the current value of the specified parameter. +@see #DecMPA_SetParam +*/ +long DECMPA_CC DecMPA_GetParam(void* pDecoder,int ID); + + + +/**Decodes some data and stores it in the supplied buffer. The buffer is not +necessarily completely filled. Always check the value stored in pBytesDecoded +to find out how much data has been decoded. + +The format of the data (frequency and number of channels) can be obtained by +calling #DecMPA_GetOutputFormat after DecMPA_Decode. The format may +change from one call of DecMPA_Decode to the next. Wether the format has +changed can be checked using #DecMPA_OutputFormatChanged. + +@param pDecoder the decoder object +@param pBuffer pointer to a buffer that receives the decoded data. +@param nBufferBytes size of the buffer, in bytes +@param pBytesDecoded pointer to a variable that receives the number of bytes + that were stored in the buffer. +@return a DecMPA result code (see \ref GroupResults).*/ +int DECMPA_CC DecMPA_Decode(void* pDecoder,void* pBuffer,long nBufferBytes,long* pBytesDecoded); + + + +/**This is a special version of #DecMPA_Decode that does not actually decode +any MPEG Audio data, but only decodes the header information. + +This function is a lot faster than #DecMPA_Decode and can be used +to make a quick run through the file and obtain accurate information about +its properties, like the exact duration or decoded file size. + +The function behaves in all ways like #DecMPA_Decode, except that it does not +return any data. In particular, the output format and mpeg audio header +information returned by #DecMPA_GetOutputFormat and #DecMPA_GetMPEGHeader will +be properly updated, just as #DecMPA_Decode does. + +@param pDecoder the decoder object +@param pDecodedBytes pointer to a variable that receives the decoded size + (in bytes) of the current MPEG audio frame. If #DecMPA_Decode was called + before and some parts of the current frame have already been read, the + size of the remaining data is returned +@return a DecMPA result code (see \ref GroupResults).*/ +int DECMPA_CC DecMPA_DecodeNoData(void* pDecoder,long* pDecodedBytes); + + + +/**Changes the decoding position to the specified time, relative to the +beginning of the data stream. + +If #DecMPA_CreateUsingCallbacks was used to create the decoder and no +Seek callback function has been specified, seeking is not supported and +#DECMPA_ERROR_UNSUPPORTED is returned. + +@param pDecoder the decoder object +@param Millis the target time, in milliseconds +@return a DecMPA result code (see \ref GroupResults).*/ +int DECMPA_CC DecMPA_SeekToTime(void* pDecoder,long Millis); + + + +/**Retrieves the current decoding time. The decoding time corresponds to +the time that it takes to play the data that has been decoded up to now. + +@param pDecoder the decoder object +@param pTime pointer to a variable that receives the time, in milliseconds. +@return a DecMPA result code (see \ref GroupResults).*/ +int DECMPA_CC DecMPA_GetTime(void* pDecoder,long* pTime); + + + +/**Retrieves the time that it takes to play back the whole data stream. +If the duration is not known -1 is returned. + +\note The duration is an estimation that can be slightly wrong for some files +but is pretty accurate for the wide majority of files. If you need a +100% accurate duration value, there is really no other way than to read through +the whole file with #DecMPA_Decode or #DecMPA_DecodeNoData and add up the +\c DecodedBytes values that are returned by those functions. Note that +if you only make this pass through the file to get the duration, i.e. you do +not need decoded audio data, you can use #DecMPA_DecodeNoData which is a lot +faster than #DecMPA_Decode. + +@param pDecoder the decoder object +@param pDuration pointer to a variable that receives the duration, in + milliseconds. +@return a DecMPA result code (see \ref GroupResults).*/ +int DECMPA_CC DecMPA_GetDuration(void* pDecoder,long* pDuration); + + + +/**Retrieves the format of the data that was returned by the last call to +DecMPA_Decode. + +The nType member of DecMPA_OutputFormat never changes and its value is +defined by the #DECMPA_PARAM_OUTPUT parameter that can be set using +#DecMPA_SetParam. If the value has not been explicitly changed using +#DecMPA_SetParam it will be #DECMPA_OUTPUT_INT16, indicating 16 bit signed +samples. + +The remaining fields of the structure may change after calls to +#DecMPA_Decode or #DecMPA_DecodeNoData. + +@param pDecoder the decoder object +@param pFormat pointer to a DecMPA_OutputFormat object that is filled with + the format data +@return a DecMPA result code (see \ref GroupResults).*/ +int DECMPA_CC DecMPA_GetOutputFormat(void* pDecoder,DecMPA_OutputFormat* pFormat); + + + +/**Checks wether the output format has changed during the last call to +DecMPA_Decode. + +@return nonzero if the format has changed, zero otherwise.*/ +int DECMPA_CC DecMPA_OutputFormatChanged(void* pDecoder); + + + +/**Retrieve mpeg header of the data that was returned by the last call to +DecMPA_Decode. This function is only supplied for information purposes. + +@param pDecoder the decoder object +@param pHeader pointer to a DecMPA_MPEGHeader object that received the data. +@return a DecMPA result code (see \ref GroupResults).*/ +int DECMPA_CC DecMPA_GetMPEGHeader(void* pDecoder,DecMPA_MPEGHeader* pHeader); + + + +/**Returns the file's ID3v2 tag, if it has one. If the file has no ID3v2 +tag, #DECMPA_ERROR_NOTAVAILABLE is returned. + +This function will always return #DECMPA_ERROR_NOTAVAILABLE if the decoder parameter +#DECMPA_PARAM_PROVIDEID3V2 has not been set to #DECMPA_YES with #DecMPA_SetParam. + +\note There are other libraries that can be used to parse the returned +data, one of them being id3lib. It can be found at +http://id3lib.sourceforge.net/ . + +@param pDecoder the decoder object +@param ppData pointer to a pointer variable that will receive the address + of the ID3v2 data. The memory that contains the data will remain valid + until the decoder is destroyed. +@param pDataSize pointer to a variable that will receive the size of the + ID3v2 data, in bytes. +@return a DecMPA result code (see \ref GroupResults).*/ +int DECMPA_CC DecMPA_GetID3v2Data(void* pDecoder,unsigned char** ppData,long* pDataSize); + + + +/**Destroys a decoder. + +@param pDecoder decoder object.*/ +void DECMPA_CC DecMPA_Destroy(void* pDecoder); + + +/**Returns the version number of the DecMPA API used by the library.*/ +int DECMPA_CC DecMPA_GetVersion(void); + +/*@}*/ + +#endif + + diff --git a/Libraries/DecMPA/Files/src/DecMPA.cpp b/Libraries/DecMPA/Files/src/DecMPA.cpp new file mode 100644 index 000000000..5c5bd3fbd --- /dev/null +++ b/Libraries/DecMPA/Files/src/DecMPA.cpp @@ -0,0 +1,262 @@ +/* DecMPA - simple MPEG Audio decoding library. + Copyright (C) 2002 Hauke Duden + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + For more information look at the file License.txt in this package. + + email: hazard_hd@users.sourceforge.net +*/ + + +#include "DefInc.h" +#include "../include/decmpa.h" +#include "MPADecoder.h" + +#include + +#include + + +#if defined(__GNUC__) && (defined(_WINDOWS) || defined(_WIN32)) + #define DLLEXPORT __declspec(dllexport) +#else + #define DLLEXPORT +#endif + +long DECMPA_CC DecMPA_StdioRead(void* pContext,void* pBuffer,long nBytes) +{ + long nBytesRead; + + nBytesRead=fread(pBuffer,1,nBytes,(FILE*)pContext); + if(nBytesRead!=nBytes) + { + if(ferror((FILE*)pContext)) + return -1; + } + + return nBytesRead; +} + + +int DECMPA_CC DecMPA_StdioSeek(void* pContext,long DestPos) +{ + if(fseek((FILE*)pContext,DestPos,SEEK_SET)!=0) + return 0; //error + else + return 1; //no error +} + +long DECMPA_CC DecMPA_StdioGetLength(void* pContext) +{ + long nOldPos; + long nLength=-1; + + nOldPos=ftell((FILE*)pContext); + if(fseek((FILE*)pContext,0,SEEK_END)==0) + { + nLength=ftell((FILE*)pContext); + fseek((FILE*)pContext,nOldPos,SEEK_SET); + } + + return nLength; +} + +long DECMPA_CC DecMPA_StdioGetPosition(void* pContext) +{ + return ftell((FILE*)pContext); +} + +void DecMPA_StdioDestroyNotify(void* pContext) +{ + fclose((FILE*)pContext); +} + +DLLEXPORT int DECMPA_CC DecMPA_CreateUsingFile(void** ppDecoder,const char* sFilePath,int Version) +{ + FILE* pFile; + DecMPA_Callbacks Callbacks; + int nResult; + + if(Version>DECMPA_VERSION) + return DECMPA_ERROR_INCOMPATIBLEVERSION; + + pFile=fopen(sFilePath,"rb"); + if(pFile==NULL) + return DECMPA_ERROR_OPENFILE; + + Callbacks.Read=DecMPA_StdioRead; + Callbacks.Seek=DecMPA_StdioSeek; + Callbacks.GetLength=DecMPA_StdioGetLength; + Callbacks.GetPosition=DecMPA_StdioGetPosition; + + nResult=DecMPA_CreateUsingCallbacks(ppDecoder,&Callbacks,pFile,Version); + if(nResult!=DECMPA_OK) + fclose(pFile); + + ((CMPADecoder*)(*ppDecoder))->SetDestroyNotify(DecMPA_StdioDestroyNotify,pFile); + + return nResult; +} + + +DLLEXPORT int DECMPA_CC DecMPA_CreateUsingCallbacks(void** ppDecoder,const DecMPA_Callbacks* pCallbacks,void* pContext,int Version) +{ + DecMPA_Callbacks Callbacks=*pCallbacks; + + if(Callbacks.Read==NULL) + { + Callbacks.Read=DecMPA_StdioRead; + Callbacks.Seek=NULL; + Callbacks.GetLength=NULL; + Callbacks.GetPosition=DecMPA_StdioGetPosition; + + pContext=stdin; + } + + if(Version>DECMPA_VERSION) + return DECMPA_ERROR_INCOMPATIBLEVERSION; + + if(ppDecoder==NULL || Callbacks.GetPosition==NULL) + return DECMPA_ERROR_PARAM; + + try + { + *ppDecoder=new CMPADecoder(Callbacks,pContext); + + return DECMPA_OK; + } + catch(std::bad_alloc e) + { + return DECMPA_ERROR_MEMORY; + } + catch(std::exception e) + { + return DECMPA_ERROR_INTERNAL; + } +} + +DLLEXPORT int DECMPA_CC DecMPA_SetParam(void* pDecoder,int ID,long Value) +{ + if(pDecoder==NULL) + return DECMPA_ERROR_PARAM; + + return ((CMPADecoder*)pDecoder)->SetParam(ID,Value); +} + +DLLEXPORT long DECMPA_CC DecMPA_GetParam(void* pDecoder,int ID) +{ + if(pDecoder==NULL) + return DECMPA_ERROR_PARAM; + + return ((CMPADecoder*)pDecoder)->GetParam(ID); +} + +DLLEXPORT int DECMPA_CC DecMPA_Decode(void* pDecoder,void* pBuffer,long nBufferBytes,long* pBytesDecoded) +{ + if(pDecoder==NULL || pBytesDecoded==NULL || (pBuffer==NULL && nBufferBytes!=0)) + return DECMPA_ERROR_PARAM; + + return ((CMPADecoder*)pDecoder)->Decode(pBuffer,nBufferBytes,*pBytesDecoded); +} + +DLLEXPORT int DECMPA_CC DecMPA_DecodeNoData(void* pDecoder,long* pDecodedBytes) +{ + if(pDecoder==NULL || pDecodedBytes==NULL) + return DECMPA_ERROR_PARAM; + + return ((CMPADecoder*)pDecoder)->DecodeNoData(*pDecodedBytes); +} + +DLLEXPORT int DECMPA_CC DecMPA_SeekToTime(void* pDecoder,long Millis) +{ + if(pDecoder==NULL) + return DECMPA_ERROR_PARAM; + + return ((CMPADecoder*)pDecoder)->SeekToTime(Millis); +} + +DLLEXPORT int DECMPA_CC DecMPA_GetTime(void* pDecoder,long* pTime) +{ + if(pDecoder==NULL || pTime==NULL) + return DECMPA_ERROR_PARAM; + + return ((CMPADecoder*)pDecoder)->GetTime(*pTime); +} + +DLLEXPORT int DECMPA_CC DecMPA_GetDuration(void* pDecoder,long* pDuration) +{ + if(pDecoder==NULL || pDuration==NULL) + return DECMPA_ERROR_PARAM; + + return ((CMPADecoder*)pDecoder)->GetDuration(*pDuration); +} + +DLLEXPORT int DECMPA_CC DecMPA_GetOutputFormat(void* pDecoder,DecMPA_OutputFormat* pFormat) +{ + if(pDecoder==NULL || pFormat==NULL) + return DECMPA_ERROR_PARAM; + + ((CMPADecoder*)pDecoder)->GetOutputFormat(*pFormat); + + return DECMPA_OK; +} + +DLLEXPORT int DECMPA_CC DecMPA_OutputFormatChanged(void* pDecoder) +{ + if(pDecoder==NULL) + return 0; + + return ((CMPADecoder*)pDecoder)->OutputFormatChanged() ? 1 : 0; +} + +DLLEXPORT int DECMPA_CC DecMPA_GetMPEGHeader(void* pDecoder,DecMPA_MPEGHeader* pHeader) +{ + if(pDecoder==NULL || pHeader==NULL) + return DECMPA_ERROR_PARAM; + + ((CMPADecoder*)pDecoder)->GetMPEGHeader(*pHeader); + + return DECMPA_OK; +} + +DLLEXPORT int DECMPA_CC DecMPA_GetID3v2Data(void* pDecoder,unsigned char** ppData,long* pDataSize) +{ + if(pDecoder==NULL || ppData==NULL || pDataSize==NULL) + return DECMPA_ERROR_PARAM; + + return ((CMPADecoder*)pDecoder)->GetID3v2Data(*ppData,*pDataSize); +} + +DLLEXPORT void DECMPA_CC DecMPA_Destroy(void* pDecoder) +{ + if(pDecoder!=NULL) + { + try + { + delete (CMPADecoder*)pDecoder; + } + catch(std::exception) + { + } + } +} + +DLLEXPORT int DECMPA_CC DecMPA_GetVersion(void) +{ + return DECMPA_VERSION; +} + + diff --git a/Libraries/DecMPA/Files/src/DecMPAFileAccess.cpp b/Libraries/DecMPA/Files/src/DecMPAFileAccess.cpp new file mode 100644 index 000000000..c8eb3c9f9 --- /dev/null +++ b/Libraries/DecMPA/Files/src/DecMPAFileAccess.cpp @@ -0,0 +1,326 @@ +/* DecMPA - simple MPEG Audio decoding library. + Copyright (C) 2002 Hauke Duden + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + For more information look at the file License.txt in this package. + + email: hazard_hd@users.sourceforge.net +*/ + +#include "DefInc.h" +#include "DecMPAFileAccess.h" + +#include + +CDecMPAFileAccess::CDecMPAFileAccess(const DecMPA_Callbacks& Callbacks,void* pContext) +{ + m_Callbacks=Callbacks; + m_pCallbackContext=pContext; + + m_nPosition=Callbacks.GetPosition(pContext); + if(m_nPosition<0) + m_nPosition=0; + + m_bEOF=false; + + m_pUndoBuffer=NULL; + m_nUndoBufferSize=0; + + m_nUndoBufferFilled=0; + m_nUndoBufferPos=0; + + m_nUndoRecordingCount=0; + + m_LastError=DECMPA_OK; + + m_pSkipBuffer=NULL; + m_nSkipBufferSize=0; +} + +CDecMPAFileAccess::~CDecMPAFileAccess() +{ + if(m_pUndoBuffer!=NULL) + delete[] m_pUndoBuffer; + + if(m_pSkipBuffer!=NULL) + delete[] m_pSkipBuffer; +} + +int CDecMPAFileAccess::Read(void* pDest,int nBytes) +{ + long nResult=0; + long nRedoBytes=0; + + nRedoBytes=m_nUndoBufferFilled-m_nUndoBufferPos; + if(nRedoBytes>0) + { + if(nRedoBytes>nBytes) + nRedoBytes=nBytes; + memcpy(pDest,m_pUndoBuffer+m_nUndoBufferPos,nRedoBytes); + m_nUndoBufferPos+=nRedoBytes; + nBytes-=nRedoBytes; + pDest=((char*)pDest)+nRedoBytes; + + m_nPosition+=nRedoBytes; + + if(m_nUndoBufferPos==m_nUndoBufferFilled && m_nUndoRecordingCount==0) + { + m_nUndoBufferFilled=0; + m_nUndoBufferPos=0; + } + + nResult+=nRedoBytes; + } + + if(nBytes>0) + { + long nRead; + + nRead=m_Callbacks.Read(m_pCallbackContext,pDest,nBytes); + if(nRead>=0) + { + if(nRead!=nBytes) + m_bEOF=true; + m_nPosition+=nRead; + + if(m_nUndoRecordingCount>0) + { + EnsureUndoBufferFree(nRead); + memcpy(m_pUndoBuffer+m_nUndoBufferPos,pDest,nRead); + m_nUndoBufferFilled+=nRead; + m_nUndoBufferPos+=nRead; + } + + nResult+=nRead; + } + else + { + m_LastError=DECMPA_ERROR_READ; + nResult=-1; + } + } + + return nResult; +} + +long CDecMPAFileAccess::Skip(long nBytes) +{ + long nResult=0; + long nRedoBytes=0; + bool bSeekFailed=false; + + nRedoBytes=m_nUndoBufferFilled-m_nUndoBufferPos; + if(nRedoBytes>0) + { + if(nRedoBytes>nBytes) + nRedoBytes=nBytes; + m_nUndoBufferPos+=nRedoBytes; + nBytes-=nRedoBytes; + + m_nPosition+=nRedoBytes; + + if(m_nUndoBufferPos==m_nUndoBufferFilled && m_nUndoRecordingCount==0) + { + m_nUndoBufferFilled=0; + m_nUndoBufferPos=0; + } + + nResult+=nRedoBytes; + } + + if(nBytes>0) + { + //first try to skip using seek + + if(nBytes>1024 && m_Callbacks.Seek!=NULL && m_nUndoRecordingCount==0) + { + long nLength=GetLength(); + + if(nLength!=-1) + { + long nToSkip=nBytes; + + if(m_nPosition+nToSkip>nLength) + nToSkip=nLength-m_nPosition; + + if(m_Callbacks.Seek(m_pCallbackContext,m_nPosition+nToSkip)!=0) + { + m_nPosition+=nToSkip; + nResult+=nToSkip; + nBytes-=nToSkip; + } + else + { + //seek failed - not critical, we can still try to skip + //using read. + bSeekFailed=true; + } + } + } + } + + if(nBytes>0) + { + int nToRead; + int nRead; + + if(m_pSkipBuffer==NULL) + { + m_nSkipBufferSize=8192; + m_pSkipBuffer=new unsigned char[m_nSkipBufferSize]; + } + + while(nBytes>0 && !m_bEOF) + { + nToRead=(nBytes<=m_nSkipBufferSize) ? nBytes : m_nSkipBufferSize; + + nRead=m_Callbacks.Read(m_pCallbackContext,m_pSkipBuffer,nToRead); + if(nRead>=0) + { + if(nRead!=nToRead) + m_bEOF=true; + m_nPosition+=nRead; + + if(m_nUndoRecordingCount>0) + { + EnsureUndoBufferFree(nRead); + memcpy(m_pUndoBuffer+m_nUndoBufferPos,m_pSkipBuffer,nRead); + m_nUndoBufferFilled+=nRead; + m_nUndoBufferPos+=nRead; + } + + nResult+=nRead; + nBytes-=nRead; + } + else + { + if(bSeekFailed) + { + //if seek also failed before we report a seek error + m_LastError=DECMPA_ERROR_SEEK; + } + else + m_LastError=DECMPA_ERROR_READ; + + nResult=-1; + break; + } + } + } + + return nResult; +} + +bool CDecMPAFileAccess::IsEndOfFile() +{ + return m_bEOF; +} + +bool CDecMPAFileAccess::Seek(long pos) +{ + bool bResult=false; + + if(pos==m_nPosition) + bResult=true; + else + { + if(m_nUndoRecordingCount==0) + { + if(m_Callbacks.Seek!=NULL) + { + if(m_Callbacks.Seek(m_pCallbackContext,pos)!=0) + { + m_nPosition=pos; + bResult=true; + } + else + m_LastError=DECMPA_ERROR_SEEK; + } + } + } + + return bResult; +} + +long CDecMPAFileAccess::GetPosition() +{ + return m_nPosition; +} + +long CDecMPAFileAccess::GetLength() +{ + long nLength=-1; + + if(m_Callbacks.GetLength!=NULL) + nLength=m_Callbacks.GetLength(m_pCallbackContext); + + return nLength; +} + +long CDecMPAFileAccess::StartUndoRecording() +{ + m_nUndoRecordingCount++; + + return m_nUndoBufferPos; +} + +void CDecMPAFileAccess::EndUndoRecording(long ID,bool bUndo) +{ + if(m_nUndoRecordingCount>0) + { + if(bUndo) + { + m_nPosition-=m_nUndoBufferPos-ID; + if(m_nUndoBufferPos!=ID) + m_bEOF=false; + + m_nUndoBufferPos=ID; + } + + m_nUndoRecordingCount--; + } +} + +void CDecMPAFileAccess::EnsureUndoBufferFree(long nBytes) +{ + if(m_nUndoBufferPos+nBytes>m_nUndoBufferSize) + { + unsigned char* pNew; + long nAdd=m_nUndoBufferPos+nBytes-m_nUndoBufferSize; + + if((nAdd & 8191)!=0) + nAdd+=8192-(nAdd & 8191); + + pNew=new unsigned char[m_nUndoBufferSize+nAdd]; + memcpy(pNew,m_pUndoBuffer,m_nUndoBufferFilled); + m_nUndoBufferSize+=nAdd; + + if(m_pUndoBuffer!=NULL) + delete[] m_pUndoBuffer; + m_pUndoBuffer=pNew; + } +} + +int CDecMPAFileAccess::GetLastError() +{ + return m_LastError; +} + +bool CDecMPAFileAccess::CanSeek() +{ + return (m_Callbacks.Seek!=NULL); +} + diff --git a/Libraries/DecMPA/Files/src/DecMPAFileAccess.h b/Libraries/DecMPA/Files/src/DecMPAFileAccess.h new file mode 100644 index 000000000..0437c46b2 --- /dev/null +++ b/Libraries/DecMPA/Files/src/DecMPAFileAccess.h @@ -0,0 +1,75 @@ +/* DecMPA - simple MPEG Audio decoding library. + Copyright (C) 2002 Hauke Duden + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + For more information look at the file License.txt in this package. + + email: hazard_hd@users.sourceforge.net +*/ + +#ifndef _DECMPAFILEACCESS_H_ +#define _DECMPAFILEACCESS_H_ + +#include "../include/decmpa.h" + +#include "IFileAccess.h" + +class CDecMPAFileAccess : public IFileAccess +{ +public: + CDecMPAFileAccess(const DecMPA_Callbacks& Callbacks,void* pContext); + ~CDecMPAFileAccess(); + + int Read(void* pDest,int nBytes); + long Skip(long nBytes); + + bool IsEndOfFile(); + + bool CanSeek(); + bool Seek(long pos); + + long GetPosition(); + long GetLength(); + + long StartUndoRecording(); + void EndUndoRecording(long ID,bool bUndo); + + int GetLastError(); + +protected: + void EnsureUndoBufferFree(long nBytes); + + DecMPA_Callbacks m_Callbacks; + void* m_pCallbackContext; + + long m_nPosition; + bool m_bEOF; + + unsigned char* m_pUndoBuffer; + long m_nUndoBufferSize; + long m_nUndoBufferFilled; + long m_nUndoBufferPos; + + int m_nUndoRecordingCount; + + unsigned char* m_pSkipBuffer; + long m_nSkipBufferSize; + + int m_LastError; +}; + +#endif + diff --git a/Libraries/DecMPA/Files/src/DecodeEngine.h b/Libraries/DecMPA/Files/src/DecodeEngine.h new file mode 100644 index 000000000..4ee440474 --- /dev/null +++ b/Libraries/DecMPA/Files/src/DecodeEngine.h @@ -0,0 +1,36 @@ +/* DecMPA - simple MPEG Audio decoding library. + Copyright (C) 2002 Hauke Duden + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + For more information look at the file License.txt in this package. + + email: hazard_hd@users.sourceforge.net +*/ + + +#ifndef _DECODEENGINE_H_ +#define _DECODEENGINE_H_ + +#include "frame/audioFrame.h" + +void* DecodeEngine_Create(); + +bool DecodeEngine_Decode(void* pEngine,AudioFrame* pDest,void* pData,long nDataLength); +void DecodeEngine_Flush(void* pEngine); + +void DecodeEngine_Destroy(void* pEngine); + +#endif diff --git a/Libraries/DecMPA/Files/src/DefInc.h b/Libraries/DecMPA/Files/src/DefInc.h new file mode 100644 index 000000000..7c22a5fb0 --- /dev/null +++ b/Libraries/DecMPA/Files/src/DefInc.h @@ -0,0 +1,25 @@ +/* DecMPA - simple MPEG Audio decoding library. + Copyright (C) 2002 Hauke Duden + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + For more information look at the file License.txt in this package. + + email: hazard_hd@users.sourceforge.net +*/ + + +#include + diff --git a/Libraries/DecMPA/Files/src/IFileAccess.h b/Libraries/DecMPA/Files/src/IFileAccess.h new file mode 100644 index 000000000..dcece68f6 --- /dev/null +++ b/Libraries/DecMPA/Files/src/IFileAccess.h @@ -0,0 +1,40 @@ +/* DecMPA - simple MPEG Audio decoding library. + Copyright (C) 2002 Hauke Duden + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + For more information look at the file License.txt in this package. + + email: hazard_hd@users.sourceforge.net +*/ + +#ifndef _IFILEACCESS_H_ +#define _IFILEACCESS_H_ + +class IFileAccess +{ +public: + virtual int Read(void* pDest,int nBytes)=0; + virtual long Skip(long nBytes)=0; + virtual bool IsEndOfFile()=0; + + virtual bool CanSeek()=0; + virtual bool Seek(long nPosition)=0; + + virtual long GetPosition()=0; + virtual long GetLength()=0; +}; + +#endif diff --git a/Libraries/DecMPA/Files/src/MPADecoder.cpp b/Libraries/DecMPA/Files/src/MPADecoder.cpp new file mode 100644 index 000000000..ab548d768 --- /dev/null +++ b/Libraries/DecMPA/Files/src/MPADecoder.cpp @@ -0,0 +1,638 @@ +/* DecMPA - simple MPEG Audio decoding library. + Copyright (C) 2002 Hauke Duden + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + For more information look at the file License.txt in this package. + + email: hazard_hd@users.sourceforge.net +*/ + +//This file is a heavily modified version of SPlayPlugin.cpp from the original +//mpeglib. See Readme.txt for details. + +#include "DefInc.h" +#include "MPADecoder.h" + +#include "DecodeEngine.h" + +#include +#include + +#include + + +CMPADecoder::CMPADecoder(const DecMPA_Callbacks& Callbacks,void* pCallbackContext) +{ + pow(6.0,3.0); // fixes bug in __math.h + + m_Callbacks=Callbacks; + m_pCallbackContext=pCallbackContext; + + m_pFileAccess=new CDecMPAFileAccess(Callbacks,pCallbackContext); + + m_nResyncCounter=0; + + m_nBufferBytes=0; + m_nUsedBufferBytes=0; + m_pBuffer=NULL; + + m_OutputFormat.nType=0; + m_OutputFormat.nFrequency=0; + m_OutputFormat.nChannels=0; + m_bOutputFormatChanged=false; + + memset(&m_MPEGHeader,0,sizeof(m_MPEGHeader)); + + m_bDoFloat=false; + m_pPCMFrame=new PCMFrame(MP3FRAMESIZE); + m_pFloatFrame=new FloatFrame(MP3FRAMESIZE); + m_pAudioFrame=NULL; + + m_pFormatFrame=new AudioFrame; + + m_nReadTime=0; + m_nBufferStartTime=0; + m_nDecodeTime=0; + + m_bPrepared=false; + m_bHasFrame=false; + + m_bFirstDecode=true; + + m_pDecodeEngine=DecodeEngine_Create(); + + m_bStoreID3v2=false; + m_pID3v2Data=(unsigned char*)0; + m_nID3v2DataSize=0; + + m_pDestroyNotify=(void (*)(void*))0; + m_pDestroyNotifyContext=(void*)0; + + m_aParams[DECMPA_PARAM_OUTPUT]=DECMPA_OUTPUT_INT16; + m_aParams[DECMPA_PARAM_PROVIDEID3V2]=DECMPA_NO; + + m_bNotMPEG=false; + + m_bDecoderNeedsFlush=false; +} + +CMPADecoder::~CMPADecoder() +{ + if(m_pDestroyNotify!=(void (*)(void*))0) + m_pDestroyNotify(m_pDestroyNotifyContext); + + delete m_pPCMFrame; + delete m_pFloatFrame; + + delete m_pFileAccess; + delete m_pFormatFrame; + + DecodeEngine_Destroy(m_pDecodeEngine); +} + +int CMPADecoder::DecodeNoData(long& nDecodedBytes) +{ + return Decode(NULL,-1,nDecodedBytes); +} + +int CMPADecoder::Decode(void* pBuffer,long nBufferBytes,long& nBytesDecoded) +{ + int Result=DECMPA_OK; + + if(pBuffer==NULL) + nBufferBytes=-1; + + nBytesDecoded=0; + m_bOutputFormatChanged=false; + + if((Result=EnsurePrepared())!=DECMPA_OK) + return Result; + + try + { + while(!ReadDecodedData(pBuffer,nBufferBytes,nBytesDecoded)) + { + Result=DecodeNextFrame(pBuffer==NULL); + if(Result!=DECMPA_OK) + break; + } + } + catch(std::bad_alloc) + { + return DECMPA_ERROR_MEMORY; + } + catch(std::exception) + { + return DECMPA_ERROR_INTERNAL; + } + + return Result; +} + +int CMPADecoder::DecodeNextFrame(bool bNoData) +{ + int Result=DECMPA_OK; + + //find and read the next frame + //we may still have one frame buffered that was read to find out + //the file information. In that case don't read another one + if(!m_bHasFrame) + m_bHasFrame=ReadNextFrame(); + if(m_bHasFrame) + { + bool bDecodeOK; + + //don't use this frame again + m_bHasFrame=false; + + //if bNoData==true we don't decode any audio data but only + //parse the frame headers + //this allows the user to do a quick pass over the file and + //get an accurate estimate of the files properties + //(actual duration, decoded size, etc...). + if(!bNoData) + { + if(m_bDecoderNeedsFlush) + { + DecodeEngine_Flush(m_pDecodeEngine); + m_bDecoderNeedsFlush=false; + } + + bDecodeOK=DecodeEngine_Decode(m_pDecodeEngine,m_pAudioFrame,m_FrameFinder.GetFrameData(),m_FrameFinder.GetFrameSize()); + } + else + { + MpegAudioHeader* pHeader=m_FrameFinder.GetFrameHeader(); + long nDecodedFrameSize; + + m_bDecoderNeedsFlush=true; + + nDecodedFrameSize=pHeader->getpcmperframe(); + if(pHeader->getInputstereo()==1) + nDecodedFrameSize*=2; + + //pretend that we have decoded something + m_pAudioFrame->setLen(nDecodedFrameSize); + m_pAudioFrame->setFrameFormat(pHeader->getInputstereo(),pHeader->getFrequencyHz()); + + //note that this "ghost data" will never be retrieved because the call + //to ReadDecodedData that follows will always remove all of it + //(see Decode) + + bDecodeOK=true; + } + + if(bDecodeOK) + { + //make the decoded data available to the "user" + HandleDecodedData(m_pAudioFrame); + } + //ignore if the decoding of the frame failed. Just continue with + //the next frame + } + else + { + if(m_FrameFinder.IsStreamInvalid()) + Result=DECMPA_ERROR_DECODE; + else + { + if(m_pFileAccess->IsEndOfFile()) + { + //end of file reached + if(!m_FrameFinder.KnowsCharacteristics()) + { + //the end was reached without being able to find out + //essential stream characteristics + //=> not an MPEG Audio file (or one that has less than 4 frames) + Result=DECMPA_ERROR_DECODE; + } + else + Result=DECMPA_END; + } + else + { + if(m_pFileAccess->GetLastError()!=DECMPA_OK) + Result=m_pFileAccess->GetLastError(); + else + { + //should never happen - an invalid stream, end of file + //or a read error are the only things that could cause + //ReadNextFrame to fail + Result=DECMPA_ERROR_INTERNAL; + } + } + } + } + + return Result; +} + +void CMPADecoder::Flush() +{ + m_FrameFinder.Flush(); + DecodeEngine_Flush(m_pDecodeEngine); + + m_nBufferBytes=0; + m_nUsedBufferBytes=0; +} + +bool CMPADecoder::ReadDecodedData(void* pDest,long nBytes,long& nRead) +{ + long nAvailBytes=m_nBufferBytes-m_nUsedBufferBytes; + + if(nAvailBytes>0) + { + if(nBytes>nAvailBytes || nBytes==-1) + nBytes=nAvailBytes; + nBytes&=~m_nOutputBlockSize; //only full samples + + if(pDest!=NULL) + memcpy(pDest,m_pBuffer+m_nUsedBufferBytes,nBytes); + m_nUsedBufferBytes+=nBytes; + + nRead=nBytes; + + m_nReadTime=m_nBufferStartTime+(((double)(m_nUsedBufferBytes/m_nOutputBlockSize))*1000)/m_pFormatFrame->getFrequenceHZ(); + + return true; + } + else + return false; +} + +long CMPADecoder::GetFilePositionFromTime(long Millis) +{ + int nResult; + + if((nResult=EnsurePrepared())!=DECMPA_OK) + return nResult; + + return m_Info.GetFilePositionFromTime(Millis); +} + +int CMPADecoder::SeekToTime(long Millis) +{ + int Result=DECMPA_OK; + + if(!m_pFileAccess->CanSeek()) + Result=DECMPA_ERROR_UNSUPPORTED; + else + { + long nFilePos; + + if((Result=EnsurePrepared())==DECMPA_OK) + { + nFilePos=m_Info.GetFilePositionFromTime(Millis); + if(nFilePos==-1) + Result=DECMPA_ERROR_UNSUPPORTED; + else + { + if(!m_pFileAccess->Seek(nFilePos)) + Result=DECMPA_ERROR_SEEK; + else + { + //throw away buffered data + Flush(); + + if(Millis!=0) + { + //initiate resync (skip next 5 frames until back + //references are ok again) + m_nResyncCounter=5; + } + + m_nDecodeTime=Millis; + m_nBufferStartTime=Millis; + m_nReadTime=Millis; + } + } + } + } + + return Result; +} + +int CMPADecoder::GetTime(long& Time) +{ + Time=(long)m_nReadTime; + + return DECMPA_OK; +} + +int CMPADecoder::GetDuration(long& Duration) +{ + int nResult; + + try + { + if((nResult=EnsurePrepared())!=DECMPA_OK) + return nResult; + + Duration=m_Info.GetDuration(); + + return DECMPA_OK; + } + catch(std::bad_alloc) + { + return DECMPA_ERROR_MEMORY; + } + catch(std::exception) + { + return DECMPA_ERROR_INTERNAL; + } +} + +bool CMPADecoder::ReadNextFrame() +{ + while(!m_FrameFinder.ReadNextFrame()) + { + if(m_FrameFinder.IsStreamInvalid()) + return false; + + if(!m_FrameFinder.ReadInput(m_pFileAccess)) + return false; + } + + return true; +} + +void CMPADecoder::SetOutputFormat(AudioFrame* pNewFormatFrame) +{ + pNewFormatFrame->copyFormat(m_pFormatFrame); + + m_OutputFormat.nFrequency=m_pFormatFrame->getFrequenceHZ(); + m_OutputFormat.nChannels=m_pFormatFrame->getStereo() ? 2 : 1; + + m_bOutputFormatChanged=true; + + m_nOutputBlockSize=m_pFormatFrame->getSampleSize()/8; + m_nOutputBlockSize*=m_OutputFormat.nChannels; +} + +void CMPADecoder::UpdateMPEGHeader(MpegAudioHeader* pHeader) +{ + memcpy(m_MPEGHeader.aRawData,pHeader->getHeader(),4); + m_MPEGHeader.bProtection=pHeader->getProtection()!=0; + + m_MPEGHeader.nLayer=pHeader->getLayer(); + m_MPEGHeader.nVersion=pHeader->getVersion(); + m_MPEGHeader.bPadding=pHeader->getPadding()!=0; + m_MPEGHeader.nFrequencyIndex=pHeader->getFrequency(); + m_MPEGHeader.nFrequency=pHeader->getFrequencyHz(); + m_MPEGHeader.nBitRateIndex=pHeader->getBitrateindex(); + m_MPEGHeader.nExtendedMode=pHeader->getExtendedmode(); + m_MPEGHeader.nMode=pHeader->getMode(); + m_MPEGHeader.bInputStereo=pHeader->getInputstereo()!=0; + m_MPEGHeader.bMPEG25=pHeader->getLayer25()!=0; + + m_MPEGHeader.nFrameSize=pHeader->getFramesize(); + m_MPEGHeader.nDecodedSamplesPerFrame=pHeader->getpcmperframe(); + m_MPEGHeader.nBitRateKbps=pHeader->GetBitRateKbps(); +} + +bool CMPADecoder::OutputFormatChanged() +{ + return m_bOutputFormatChanged; +} + +void CMPADecoder::GetOutputFormat(DecMPA_OutputFormat& Format) +{ + Format=m_OutputFormat; +} + +void CMPADecoder::GetMPEGHeader(DecMPA_MPEGHeader& Header) +{ + Header=m_MPEGHeader; +} + + +void CMPADecoder::HandleDecodedData(AudioFrame* pDecodedFrame) +{ + int nDecodedSamples; + + if(m_bFirstDecode) + { + SetOutputFormat(pDecodedFrame); + m_bFirstDecode=false; + } + + nDecodedSamples=pDecodedFrame->getLen(); + if(pDecodedFrame->getStereo()==1) + nDecodedSamples/=2; + + m_nBufferStartTime=m_nDecodeTime; + m_nDecodeTime+=(((double)nDecodedSamples)*1000)/pDecodedFrame->getFrequenceHZ(); + + if(m_nResyncCounter>0) + { + //we need to resync = read a few frames to make sure + //that the back references are ok again + //do not output any of the decoded data + m_nResyncCounter--; + } + else + { + if(!m_pFormatFrame->isFormatEqual(pDecodedFrame)) + SetOutputFormat(pDecodedFrame); + + UpdateMPEGHeader(m_FrameFinder.GetFrameHeader()); + + if(m_bDoFloat) + { + m_nBufferBytes=m_pFloatFrame->getLen()*sizeof(float); + m_pBuffer=(unsigned char*)m_pFloatFrame->getData(); + } + else + { + m_nBufferBytes=m_pPCMFrame->getLen()*sizeof(short); + m_pBuffer=(unsigned char*)m_pPCMFrame->getData(); + } + m_nUsedBufferBytes=0; + } + +} + +int CMPADecoder::EnsurePrepared() +{ + int Result=DECMPA_OK; + + if(!m_bPrepared) + { + if(m_bNotMPEG) + Result=DECMPA_ERROR_DECODE; + else + { + m_bStoreID3v2=(m_aParams[DECMPA_PARAM_PROVIDEID3V2]==DECMPA_YES); + + m_bDoFloat=(m_aParams[DECMPA_PARAM_OUTPUT]==DECMPA_OUTPUT_FLOAT); + m_nOutputBlockSize=1; + if(m_bDoFloat) + m_pAudioFrame=m_pFloatFrame; + else + m_pAudioFrame=m_pPCMFrame; + + m_OutputFormat.nType=m_aParams[DECMPA_PARAM_OUTPUT]; + + //Skip or store any leading ID3 tags - some tags are not + //correctly escaped and contain "sync" codes that can confuse + //the decoder + HandleID3Tag(); + + if(!m_Info.InitInfo(&m_FrameFinder,m_pFileAccess)) + { + m_bNotMPEG=true; + Result=DECMPA_ERROR_DECODE; + } + else + { + //info reads up to one frame. + //we can use this in decoding, we only have to remember not + //to read a fresh one in the first iteration of Decode + m_bHasFrame=m_FrameFinder.HasFrame(); + + m_bPrepared=true; + } + } + } + + return Result; +} + +void CMPADecoder::HandleID3Tag() +{ + unsigned char aHeaderData[10]; + struct ID3v2Header + { + char sID[3]; + unsigned char Version; + unsigned char Revision; + unsigned char Flags; + unsigned long Size; + } Header; + + int nBytesRead; + long UndoID; + + UndoID=m_pFileAccess->StartUndoRecording(); + + if((nBytesRead=m_pFileAccess->Read((char*)&aHeaderData,10))==10) + { + //we do not read directly into the header because the fields may + //have been padded by the compiler + memcpy(Header.sID,aHeaderData,3); + Header.Version=aHeaderData[3]; + Header.Revision=aHeaderData[4]; + Header.Flags=aHeaderData[5]; + Header.Size=aHeaderData[6]; + Header.Size<<=8; + Header.Size|=aHeaderData[7]; + Header.Size<<=8; + Header.Size|=aHeaderData[8]; + Header.Size<<=8; + Header.Size|=aHeaderData[9]; + + //make sure its an ID3 header + if(strncmp(Header.sID,"ID3",3)==0 && Header.Version!=0xff && Header.Revision!=0xff + && (Header.Size & 0x80808080)==0) + { + unsigned long TagSize=Header.Size; + + //ok, we have an ID3 tag - no need for undo + m_pFileAccess->EndUndoRecording(UndoID,false); + UndoID=-1; + + //correct "unsyncing" of tag size + TagSize=(TagSize & 0x7f) | ((TagSize & 0x7f00)>>1) + | ((TagSize & 0x7f0000)>>2) | ((TagSize & 0x7f000000)>>3); + + if(m_bStoreID3v2) + { + //read ID3 tag + + m_pID3v2Data=new unsigned char[10+TagSize]; + memcpy(m_pID3v2Data,aHeaderData,10); + + if(m_pFileAccess->Read(m_pID3v2Data+10,TagSize)==(long)TagSize) + m_nID3v2DataSize=TagSize+10; + else + { + delete[] m_pID3v2Data; + m_pID3v2Data=(unsigned char*)0; + } + } + else + { + //skip the ID3 tag + m_pFileAccess->Skip(TagSize); + } + } + } + + if(UndoID!=-1) + { + //no ID3 tag found + //=> undo read operations + m_pFileAccess->EndUndoRecording(UndoID,true); + } +} + +int CMPADecoder::GetID3v2Data(unsigned char*& pData,long& nDataSize) +{ + int nResult; + + if((nResult=EnsurePrepared())!=DECMPA_OK) + return nResult; + + if(m_pID3v2Data==(unsigned char*)0) + return DECMPA_ERROR_NOTAVAILABLE; + + pData=m_pID3v2Data; + nDataSize=m_nID3v2DataSize; + + return DECMPA_OK; +} + + +int CMPADecoder::SetParam(int ID,long Value) +{ + bool bOK=false; + + if(m_bPrepared) + return DECMPA_ERROR_WRONGSTATE; + + switch(ID) + { + case DECMPA_PARAM_OUTPUT: bOK=(Value==DECMPA_OUTPUT_INT16 || Value==DECMPA_OUTPUT_FLOAT); + break; + case DECMPA_PARAM_PROVIDEID3V2: bOK=(Value==DECMPA_YES || Value==DECMPA_NO); + break; + } + if(!bOK) + return DECMPA_ERROR_PARAM; + + m_aParams[ID]=Value; + + return DECMPA_OK; + +} + +long CMPADecoder::GetParam(int ID) +{ + if(ID<0 || ID>=DECMPA_PARAMCOUNT) + return 0; + + return m_aParams[ID]; +} diff --git a/Libraries/DecMPA/Files/src/MPADecoder.h b/Libraries/DecMPA/Files/src/MPADecoder.h new file mode 100644 index 000000000..975e6c56e --- /dev/null +++ b/Libraries/DecMPA/Files/src/MPADecoder.h @@ -0,0 +1,143 @@ +/* DecMPA - simple MPEG Audio decoding library. + Copyright (C) 2002 Hauke Duden + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + For more information look at the file License.txt in this package. + + email: hazard_hd@users.sourceforge.net +*/ + +//This file is a heavily modified version of SPlayPlugin.h from the original +//mpeglib. See Readme.txt for details. + + +#ifndef _MPADECODER_H_ +#define _MPADECODER_H_ + +#include "../include/decmpa.h" + +#include "DecMPAFileAccess.h" + +#include "frame/pcmFrame.h" +#include "frame/floatFrame.h" + +#include "MPAFrameFinder.h" +#include "MPAInfo.h" + +class CMPADecoder +{ +public: + CMPADecoder(const DecMPA_Callbacks& Callbacks,void* pCallbackContext); + ~CMPADecoder(); + + int Decode(void* pBuffer,long nBufferBytes,long& nBytesDecoded); + int DecodeNoData(long& nDecodedBytes); + + int SeekToTime(long Millis); + + int GetTime(long& Time); + int GetDuration(long& Duration); + + bool OutputFormatChanged(); + void GetOutputFormat(DecMPA_OutputFormat& Format); + + void GetMPEGHeader(DecMPA_MPEGHeader& Header); + + int GetID3v2Data(unsigned char*& pData,long& nDataSize); + + inline void SetDestroyNotify(void (*pNotify)(void*),void* pContext); + + long GetFilePositionFromTime(long Millis); + + int SetParam(int ID,long Value); + long GetParam(int ID); + +protected: + int DecodeNextFrame(bool bNoData); + bool ReadNextFrame(); + + void HandleDecodedData(AudioFrame* playFrame); + void SetOutputFormat(AudioFrame* pNewFormatFrame); + + bool ReadDecodedData(void* pDest,long nBytes,long& nRead); + + void Flush(); + + int EnsurePrepared(); + void HandleID3Tag(); + + void UpdateMPEGHeader(MpegAudioHeader* pHeader); + + DecMPA_Callbacks m_Callbacks; + void* m_pCallbackContext; + + bool m_bDoFloat; + + AudioFrame* m_pAudioFrame; + FloatFrame* m_pFloatFrame; + PCMFrame* m_pPCMFrame; + + AudioFrame* m_pFormatFrame; + int m_nOutputBlockSize; + + CDecMPAFileAccess* m_pFileAccess; + + long m_nBufferBytes; + long m_nUsedBufferBytes; + unsigned char* m_pBuffer; + + double m_nReadTime; + double m_nBufferStartTime; + double m_nDecodeTime; + + DecMPA_OutputFormat m_OutputFormat; + bool m_bOutputFormatChanged; + + DecMPA_MPEGHeader m_MPEGHeader; + + bool m_bFirstDecode; + bool m_bPrepared; + bool m_bHasFrame; + + int m_nResyncCounter; + + void* m_pDecodeEngine; + + CMPAFrameFinder m_FrameFinder; + CMPAInfo m_Info; + + bool m_bStoreID3v2; + unsigned char* m_pID3v2Data; + long m_nID3v2DataSize; + + void (*m_pDestroyNotify)(void*); + void* m_pDestroyNotifyContext; + + long m_aParams[DECMPA_PARAMCOUNT]; + + bool m_bNotMPEG; + + bool m_bDecoderNeedsFlush; +}; + +inline void CMPADecoder::SetDestroyNotify(void (*pNotify)(void*),void* pContext) +{ + m_pDestroyNotify=pNotify; + m_pDestroyNotifyContext=pContext; +} + +#endif + diff --git a/Libraries/DecMPA/Files/src/MPAFrameFinder.cpp b/Libraries/DecMPA/Files/src/MPAFrameFinder.cpp new file mode 100644 index 000000000..e6c47503d --- /dev/null +++ b/Libraries/DecMPA/Files/src/MPAFrameFinder.cpp @@ -0,0 +1,550 @@ +/* DecMPA - simple MPEG Audio decoding library. + Copyright (C) 2002 Hauke Duden + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + For more information look at the file License.txt in this package. + + email: hazard_hd@users.sourceforge.net +*/ + + +#include "MPAFrameFinder.h" + +#include + +CMPAFrameFinder::CMPAFrameFinder() +{ + // max size of buffer is: + // header: 4 + // max bitrate: 448 + // min freq: 22050 + // padding: 1 + // ------------------ + // maxsize: 4+144000*max(bitrate)/min(freq)+1 ca: 2931 byte + // then we add a "sentinel" at the end these are 4 byte. + // so we should be ok, with a 4KB buffer. + m_OutBuffer.Alloc(4096); + m_OutBuffer.SetSize(4096); + + m_MyInBuffer.Alloc(65536); + + m_pFirstHeader=(HeaderRecord*)0; + m_pLastHeader=(HeaderRecord*)0; + m_pNewHeaderRecord=(HeaderRecord*)0; + + m_bStreamInvalid=false; + m_nLayer=-1; + + m_bAllowFrequencyChanges=false; + + m_nLookAheadFrames=3; //try to find 4 consistent frames by default + + m_nReadStartPosition=0; + + Restart(); +} + +CMPAFrameFinder::~CMPAFrameFinder() +{ + DeleteHeaderRecords(); +} + +bool CMPAFrameFinder::ReadNextFrame() +{ + bool bNeedMoreThanAvailable; + + if(m_State==STATE_HAVEFRAME) + ResetState(); + + while(true) + { + bNeedMoreThanAvailable=false; + while(m_State!=STATE_HAVEFRAME && m_pInBuffer->HasMoreData() && !bNeedMoreThanAvailable) + { + switch(m_State) + { + case STATE_FINDCHARACTERISTICS: if(!FindCharacteristics()) + { + //need more data, but we may still have + //up to 3 bytes buffered + //so, break manually here + bNeedMoreThanAvailable=true; + } + break; + case STATE_FINDSYNC: FindNextSync(); + break; + case STATE_READHEADER: ReadHeader(); + break; + case STATE_CHECKHEADER: CheckHeader(); + break; + case STATE_READFRAME: ReadFrame(); + break; + } + } + + if(m_State!=STATE_HAVEFRAME && m_State>=STATE_FINDSYNC && m_pInBuffer==&m_MyInBuffer) + { + //we need more data, but were still reading + //from our own preread data that was used to find out the + //stream characteristics + + //switch to user buffer (it may already contain some data) + m_pInBuffer=&m_UserInBuffer; + } + else + break; + } + + if(m_State==STATE_FINDCHARACTERISTICS && m_MyInBuffer.GetSize()==m_MyInBuffer.GetCapacity()) + { + //we have read the maximum of data and not found m_nLookAheadFrames+1 consistent + //frames + + //the stream does probably not contain valid MPEG Audio data + m_bStreamInvalid=true; + } + + return (m_State==STATE_HAVEFRAME); //otherwise we need more data +} + +bool CMPAFrameFinder::FindCharacteristics() +{ + unsigned char* pData; + + //we read up to 64k data and try to find at least + //m_nLookAheadFrames+1 frame headers that are consistent with one + //another + + while(m_MyInBuffer.GetBytesLeft()>=4) + { + pData=m_MyInBuffer.GetPosPtr(); + + if(pData[0]==0xff && (pData[1] & 0xe0)==0xe0) + { + //found sync + //parse the header + if(m_pNewHeaderRecord==(HeaderRecord*)0) + m_pNewHeaderRecord=new HeaderRecord; + + if(m_pNewHeaderRecord->Header.parseHeader(pData)) + { + if(IsValidHeader(&m_pNewHeaderRecord->Header)) + { + //seems to be a valid header. + //add the a header record to the list + + m_pNewHeaderRecord->nPosition=m_MyInBuffer.GetPos(); + m_pNewHeaderRecord->pNext=(HeaderRecord*)0; + + if(m_pLastHeader==(HeaderRecord*)0) + m_pFirstHeader=m_pLastHeader=m_pNewHeaderRecord; + else + { + m_pLastHeader->pNext=m_pNewHeaderRecord; + m_pLastHeader=m_pNewHeaderRecord; + } + m_pNewHeaderRecord=(HeaderRecord*)0; + + //check wether we have found m_nLookAheadFrames+1 consistent headers yet + if(FindConsistentHeaders()) + break; + } + } + } + + m_MyInBuffer.AddToPos(1); + } + + return (m_State>=STATE_FINDSYNC); +} + +bool CMPAFrameFinder::FindConsistentHeaders() +{ + HeaderRecord* pRecord; + + //ok, we have found some headers in the data stream + //now we try to find m_nLookAheadFrames+1 that are consistent + //and assume that they correspond to valid frames in the stream + + pRecord=m_pFirstHeader; + while(pRecord!=(HeaderRecord*)0) + { + //be prejudiced for early headers + if(!CanHaveConsistentHeaders(pRecord,m_nLookAheadFrames)) + { + //if we haven't yet read enough data to find + //consistent headers for the first headers, stop + //here + pRecord=(HeaderRecord*)0; + break; + } + + //find two headers that are consistent with this one + if(HasConsistentHeaders(pRecord,pRecord->pNext,m_nLookAheadFrames)) + break; + + pRecord=pRecord->pNext; + } + + if(pRecord!=(HeaderRecord*)0) + { + //yay! we found m_nLookAheadFrames+1 consistent headers. + //The first of them is pRecord + + //store stream characteristics + m_nLayer=pRecord->Header.getLayer(); + m_nInputStereo=pRecord->Header.getInputstereo(); + m_nFrequency=pRecord->Header.getFrequencyHz(); + m_nLayer25=pRecord->Header.getLayer25(); + m_nVersion=pRecord->Header.getVersion(); + + //set input buffer to start of first frame + m_MyInBuffer.SetPos(pRecord->nPosition); + + m_nFirstFramePosition=pRecord->nPosition+m_nReadStartPosition; + + //throw away the header records + DeleteHeaderRecords(); + + //got to next state (start extracting frame data) + m_State++; + + return true; + } + + return false; +} + +bool CMPAFrameFinder::CanHaveConsistentHeaders(CMPAFrameFinder::HeaderRecord* pRecord,int nHeaderCount) +{ + long nFirstFrameBegin; + int nFrameSize; + long nLastFrameHeaderEnd; + + nFirstFrameBegin=pRecord->nPosition; + nFrameSize=pRecord->Header.getFramesize(); + + //assume that the frames have a size difference of at most 512 bytes + //(or at most 512 bytes of data in between) + nLastFrameHeaderEnd=nFirstFrameBegin+((nFrameSize+512)*nHeaderCount)+4; + + if(m_MyInBuffer.GetPos()pNext; + } + + return false; +} + +bool CMPAFrameFinder::AreHeadersConsistent(HeaderRecord* pFirst,HeaderRecord* pSecond) +{ + //do the corresponding frames overlap? + if(pFirst->nPosition+pFirst->Header.getFramesize()>pSecond->nPosition) + return false; + + //different layers? + if(pFirst->Header.getLayer()!=pSecond->Header.getLayer()) + return false; + + //one stereo, the other not? + if(pFirst->Header.getInputstereo()!=pSecond->Header.getInputstereo()) + return false; + + //mpeg 2.5? + if(pFirst->Header.getLayer25()!=pSecond->Header.getLayer25()) + return false; + + //version? + if(pFirst->Header.getVersion()!=pSecond->Header.getVersion()) + return false; + + if(!m_bAllowFrequencyChanges) + { + if(pFirst->Header.getFrequencyHz()!=pSecond->Header.getFrequencyHz()) + return false; + } + + return true; +} + +bool CMPAFrameFinder::IsConformingHeader(MpegAudioHeader* pHeader) +{ + //check wether the header conforms with the detected stream characteristics + + if(pHeader->getInputstereo()==m_nInputStereo + && pHeader->getLayer()==m_nLayer + && pHeader->getLayer25()==m_nLayer25 + && pHeader->getVersion()==m_nVersion + && (pHeader->getFrequencyHz()==m_nFrequency || m_bAllowFrequencyChanges)) + { + return true; + } + + return false; +} + +void CMPAFrameFinder::FindNextSync() +{ + unsigned char* pOut=m_OutBuffer.GetPosPtr(); + + while(m_pInBuffer->HasMoreData()) + { + // shift + pOut[0]=pOut[1]; + pOut[1]=m_pInBuffer->ReadByte(); + + if (pOut[0] == 0xff) + { + // upper 4 bit are syncword, except bit one + // which is layer 2.5 indicator. + if ( (pOut[1] & 0xe0) == 0xe0) + { + m_OutBuffer.SetPos(2); + m_State++; + break; + } + } + } +} + +void CMPAFrameFinder::ReadHeader() +{ + while(m_pInBuffer->HasMoreData()) + { + if(m_OutBuffer.GetPos()>=4) + { + m_State++; + break; + } + + m_OutBuffer.WriteByte(m_pInBuffer->ReadByte()); + } +} + +void CMPAFrameFinder::CheckHeader() +{ + bool bHeaderOK=false; + + if(m_Header.parseHeader(m_OutBuffer.GetPtr())) + { + if(IsValidHeader(&m_Header)) + { + //make sure the header conforms to the established stream + //characteristics + if(IsConformingHeader(&m_Header)) + { + m_nFrameSize=m_Header.getFramesize(); + bHeaderOK=true; + } + } + } + + if(bHeaderOK) + m_State++; + else + ResetState(); +} + +void CMPAFrameFinder::ReadFrame() +{ + int nBytesNeeded; + int nBytesAvailable; + int nCopyBytes; + + do + { + nBytesNeeded=m_nFrameSize-m_OutBuffer.GetPos(); + nBytesAvailable=m_pInBuffer->GetSize()-m_pInBuffer->GetPos(); + + nCopyBytes=(nBytesAvailableGetPosPtr(),nCopyBytes); + m_OutBuffer.AddToPos(nCopyBytes); + m_pInBuffer->AddToPos(nCopyBytes); + + if(nBytesNeeded==nCopyBytes) + { + m_State++; + break; + } + } + while(m_pInBuffer->HasMoreData()); +} + +void CMPAFrameFinder::SetInput(void* pBuffer,int nBufferBytes,long nStreamPosition) +{ + if(m_State==STATE_FINDCHARACTERISTICS) + { + int nCopyBytes=m_MyInBuffer.GetCapacity()-m_MyInBuffer.GetSize(); + + //copy it in into our own buffer + if(nCopyBytes>nBufferBytes) + nCopyBytes=nBufferBytes; + + if(m_MyInBuffer.GetSize()==0) + m_nReadStartPosition=nStreamPosition; + + memcpy(m_MyInBuffer.GetPtr()+m_MyInBuffer.GetSize(),pBuffer,nCopyBytes); + m_MyInBuffer.SetSize(m_MyInBuffer.GetSize()+nCopyBytes); + + pBuffer=((unsigned char*)pBuffer)+nCopyBytes; + nBufferBytes-=nCopyBytes; + + //attach the rest to the user buffer + } + + m_UserInBuffer.Attach(pBuffer,nBufferBytes); +} + +bool CMPAFrameFinder::ReadInput(IFileAccess* pFileAccess) +{ + int nResult; + + if(m_State==STATE_FINDCHARACTERISTICS) + { + int nFree=m_MyInBuffer.GetCapacity()-m_MyInBuffer.GetSize(); + + //read data into our own buffer + if(nFree>0) + { + //read in small chunks + if(nFree>4096) + nFree=4096; + + if(m_MyInBuffer.GetSize()==0) //first input + m_nReadStartPosition=pFileAccess->GetPosition(); + + nResult=pFileAccess->Read((char*)m_MyInBuffer.GetPtr()+m_MyInBuffer.GetSize(),nFree); + if(nResult<=0) + return false; + + m_MyInBuffer.SetSize(m_MyInBuffer.GetSize()+nResult); + } + } + else + { + if(m_UserInBuffer.IsAttached()) + m_UserInBuffer.Alloc(4096); + + nResult=pFileAccess->Read((char*)m_UserInBuffer.GetPtr(),m_UserInBuffer.GetCapacity()); + if(nResult<=0) + return false; + + m_UserInBuffer.SetSize(nResult); + m_UserInBuffer.SetPos(0); + } + + return true; +} + +void CMPAFrameFinder::Flush() +{ + ResetState(); + + m_UserInBuffer.SetSize(0); + m_MyInBuffer.SetSize(0); + + DeleteHeaderRecords(); +} + +void CMPAFrameFinder::ResetState() +{ + m_OutBuffer.SetPos(0); + + //make sure that we do not accidentally treat + //"leftover" data in the buffer as a sync mark + m_OutBuffer.GetPtr()[0]=0; + m_OutBuffer.GetPtr()[1]=0; + + if(m_State>=STATE_FINDSYNC) + m_State=STATE_FINDSYNC; +} + +void CMPAFrameFinder::Restart() +{ + Flush(); + + m_State=STATE_FINDCHARACTERISTICS; + m_pInBuffer=&m_MyInBuffer; + + m_bStreamInvalid=false; + + m_nFirstFramePosition=0; +} + +void CMPAFrameFinder::DeleteHeaderRecords() +{ + HeaderRecord* pRecord; + + while(m_pFirstHeader!=(HeaderRecord*)0) + { + pRecord=m_pFirstHeader; + m_pFirstHeader=m_pFirstHeader->pNext; + + delete pRecord; + } + + m_pLastHeader=(HeaderRecord*)0; + + if(m_pNewHeaderRecord!=(HeaderRecord*)0) + { + delete m_pNewHeaderRecord; + m_pNewHeaderRecord=(HeaderRecord*)0; + } +} + +bool CMPAFrameFinder::IsValidHeader(MpegAudioHeader* pHeader) +{ + int nFrameSize; + + nFrameSize=pHeader->getFramesize(); + + // don't allow stupid framesizes: + // if framesize <4 or > max mepg framsize its an error + if(nFrameSize<4 || nFrameSize+4>4096) + return false; + + if(pHeader->GetBitRateKbps()==0) + { + //skip frames with bitrate 0 (empty) + return false; + } + + return true; +} + + + diff --git a/Libraries/DecMPA/Files/src/MPAFrameFinder.h b/Libraries/DecMPA/Files/src/MPAFrameFinder.h new file mode 100644 index 000000000..e68849279 --- /dev/null +++ b/Libraries/DecMPA/Files/src/MPAFrameFinder.h @@ -0,0 +1,201 @@ +/* DecMPA - simple MPEG Audio decoding library. + Copyright (C) 2002 Hauke Duden + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + For more information look at the file License.txt in this package. + + email: hazard_hd@users.sourceforge.net +*/ + + +#ifndef _MPAFRAMEFINDER_H_ +#define _MPAFRAMEFINDER_H_ + +#include "IFileAccess.h" +#include "mpegAudioFrame/mpegAudioHeader.h" + +#include "MemBuffer.h" + +class CMPAFrameFinder +{ +public: + CMPAFrameFinder(); + ~CMPAFrameFinder(); + + inline void SetLookAheadFrames(int nFrames); + inline void SetAllowFrequencyChanges(bool bAllow); + + inline int GetLookAheadFrames(); + inline bool GetAllowFrequencyChanges(); + + //if false, the finder needs more input data or the stream + //invalid + bool ReadNextFrame(); + + inline bool IsStreamInvalid(); + inline bool KnowsCharacteristics(); + + inline bool HasFrame(); + inline void* GetFrameData(); + inline int GetFrameSize(); + inline double GetAvgFrameSize(); + inline MpegAudioHeader* GetFrameHeader(); + + void SetInput(void* pBuffer,int nBytes,long nStreamPosition); + bool ReadInput(IFileAccess* pAccess); + + //throw away buffered data and find next frame + void Flush(); + + //start with a completely blank slate for a new data stream + void Restart(); + + inline long GetFirstFramePosition(); + +protected: + struct HeaderRecord + { + MpegAudioHeader Header; + long nPosition; + + HeaderRecord* pNext; + }; + + bool FindCharacteristics(); + bool FindConsistentHeaders(); + bool CanHaveConsistentHeaders(HeaderRecord* pRecord,int nHeaderCount); + bool HasConsistentHeaders(HeaderRecord* pCheckRecord,HeaderRecord* pRecord,int nHeadersNeeded); + bool AreHeadersConsistent(HeaderRecord* pFirst,HeaderRecord* pSecond); + + bool IsConformingHeader(MpegAudioHeader* pHeader); + + void FindNextSync(); + void ReadHeader(); + void CheckHeader(); + void ReadFrame(); + + void ResetState(); + + void DeleteHeaderRecords(); + + static bool IsValidHeader(MpegAudioHeader* pHeader); + + CMemBuffer m_OutBuffer; + + CMemBuffer* m_pInBuffer; + CMemBuffer m_MyInBuffer; + CMemBuffer m_UserInBuffer; + + int m_State; + + int m_nLookAheadFrames; + bool m_bAllowFrequencyChanges; + + int m_nLayer; + int m_nInputStereo; + int m_nFrequency; + int m_nLayer25; + int m_nVersion; + + MpegAudioHeader m_Header; + int m_nFrameSize; + + long m_nReadStartPosition; + long m_nFirstFramePosition; + + enum + { + STATE_FINDCHARACTERISTICS=0, + STATE_FINDSYNC, + STATE_READHEADER, + STATE_CHECKHEADER, + STATE_READFRAME, + + STATE_HAVEFRAME + }; + + HeaderRecord* m_pFirstHeader; + HeaderRecord* m_pLastHeader; + + HeaderRecord* m_pNewHeaderRecord; + + bool m_bStreamInvalid; +}; + +inline void CMPAFrameFinder::SetLookAheadFrames(int nFrames) +{ + if(nFrames<0) + nFrames=0; + + m_nLookAheadFrames=nFrames; +} + +inline void CMPAFrameFinder::SetAllowFrequencyChanges(bool bAllow) +{ + m_bAllowFrequencyChanges=bAllow; +} + +inline int CMPAFrameFinder::GetLookAheadFrames() +{ + return m_nLookAheadFrames; +} + +inline bool CMPAFrameFinder::GetAllowFrequencyChanges() +{ + return m_bAllowFrequencyChanges; +} + +inline bool CMPAFrameFinder::HasFrame() +{ + return (m_State==STATE_HAVEFRAME); +} + +inline void* CMPAFrameFinder::GetFrameData() +{ + return m_OutBuffer.GetPtr(); +} + +inline int CMPAFrameFinder::GetFrameSize() +{ + return m_OutBuffer.GetPos(); +} + +inline double CMPAFrameFinder::GetAvgFrameSize() +{ + return m_Header.GetAvgFrameSize(); +} + +inline MpegAudioHeader* CMPAFrameFinder::GetFrameHeader() +{ + return &m_Header; +} + +inline bool CMPAFrameFinder::IsStreamInvalid() +{ + return m_bStreamInvalid; +} + +inline bool CMPAFrameFinder::KnowsCharacteristics() +{ + return (m_State>STATE_FINDCHARACTERISTICS); +} + +inline long CMPAFrameFinder::GetFirstFramePosition() +{ + return m_nFirstFramePosition; +} + +#endif diff --git a/Libraries/DecMPA/Files/src/MPAInfo.cpp b/Libraries/DecMPA/Files/src/MPAInfo.cpp new file mode 100644 index 000000000..804212826 --- /dev/null +++ b/Libraries/DecMPA/Files/src/MPAInfo.cpp @@ -0,0 +1,200 @@ +/* DecMPA - simple MPEG Audio decoding library. + Copyright (C) 2002 Hauke Duden + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + For more information look at the file License.txt in this package. + + email: hazard_hd@users.sourceforge.net +*/ + + +#include "MPAInfo.h" + +CMPAInfo::CMPAInfo() +{ + m_nEncodedDataSize=-1; + m_nEncodedDataOffset=0; + m_nDuration=-1; + m_bXingVBR=false; + + m_XingHeader.toc=m_aXingTOC; +} + +CMPAInfo::~CMPAInfo() +{ +} + +bool CMPAInfo::InitInfo(CMPAFrameFinder* pFrameFinder,IFileAccess* pFileAccess) +{ + m_nEncodedDataSize=-1; + m_nEncodedDataOffset=0; + m_nDuration=-1; + m_bXingVBR=false; + + while(!pFrameFinder->ReadNextFrame()) + { + if(pFrameFinder->IsStreamInvalid()) + return false; + + if(!pFrameFinder->ReadInput(pFileAccess)) + return false; + } + + m_nEncodedDataOffset=pFrameFinder->GetFirstFramePosition(); + + m_nEncodedDataSize=pFileAccess->GetLength(); + if(m_nEncodedDataSize!=-1) + { + //ignore any leading non-MPEG-Audio data + m_nEncodedDataSize-=m_nEncodedDataOffset; + } + + Init(pFrameFinder); + + return true; +} + +void CMPAInfo::Init(CMPAFrameFinder* pFrameFinder) +{ + double nAvgFrameSize; + int nFrameSize; + long nFrameCount=-1; + + nAvgFrameSize=pFrameFinder->GetAvgFrameSize(); + nFrameSize=pFrameFinder->GetFrameSize(); + if(nAvgFrameSize>0) + { + if(ReadXingHeader(pFrameFinder->GetFrameData(),nFrameSize)) + { + m_bXingVBR=true; + nFrameCount=m_XingHeader.frames; + } + else + { + if(m_nEncodedDataSize>=0) + nFrameCount=(long)(m_nEncodedDataSize/nAvgFrameSize); + } + } + + if(nFrameCount!=-1) + { + MpegAudioHeader* pHeader=pFrameFinder->GetFrameHeader(); + int nDecodedSamplesPerFrame; + int nFrequency; + double nDecodedSamples; + + nDecodedSamplesPerFrame=pHeader->getpcmperframe(); + nFrequency=pHeader->getFrequencyHz(); + + nDecodedSamples=((double)nFrameCount)*nDecodedSamplesPerFrame; + + if(nFrequency!=0) + m_nDuration=(long)((nDecodedSamples*1000)/nFrequency); + } +} + +bool CMPAInfo::ReadXingHeader(void* pFrameData,int nFrameSize) +{ + if(nFrameSize<152) //cannot have xing header + return false; + + if(::GetXingHeader(&m_XingHeader,(unsigned char*)pFrameData)==0) + return false; + + //we use floats so that we won't loose precision + //with the un-compensation stuff below + for(int i=0;i<100;i++) + m_aTOC[i]=((float)m_XingHeader.toc[i])/256.0f; + m_aTOC[100]=1.0f; + + if(m_aTOC[0]!=0) + { + //the Xing table of contents compensates for some + //leading non-MP3 data (maybe an ID3 tag or something) + //Since that data may never have been passed to the library + //(or if it has been passed, it should have been skipped) + //we undo this compensation + float FullSizeValue; + + FullSizeValue=1.0f-m_aTOC[0]; + + for(int i=100;i>=0;i--) + m_aTOC[i]=(m_aTOC[i]-m_aTOC[0])/FullSizeValue; + } + + return true; +} + +long CMPAInfo::GetFilePositionFromTime(long Millis) +{ + long nPos=-1; + double nTimeFraction; + + if(m_nDuration>0 && m_nEncodedDataSize>=0) + { + nTimeFraction=((double)Millis)/m_nDuration; + + if(m_bXingVBR) + { + nPos=GetEncodedDataPositionFromTOC((float)nTimeFraction); + + if(nPos>=m_nEncodedDataSize) + nPos=m_nEncodedDataSize; + } + else + nPos=(long)(nTimeFraction*m_nEncodedDataSize); + } + + if(nPos==-1) + { + //ok, we couldn't find the correct position because + //we don't know enough about the stream + + //however, ONE position we know: the beginning + if(Millis==0) + nPos=0; + } + + nPos+=m_nEncodedDataOffset; + + return nPos; +} + +long CMPAInfo::GetEncodedDataPositionFromTOC(float TimeFract) +{ + // interpolate in TOC to get file seek point in bytes + int nTOCIndex; + float LowerPosFract; + float UpperPosFract; + float PosFract; + float Percent=TimeFract*100.0f; + + if(Percent<0.0f) + Percent=0.0f; + if(Percent>100.0f) + Percent=100.0f; + + nTOCIndex=(int)Percent; + if(nTOCIndex>99) + nTOCIndex=99; + LowerPosFract=m_aTOC[nTOCIndex]; + UpperPosFract=m_aTOC[nTOCIndex+1]; + + PosFract=LowerPosFract + ((UpperPosFract-LowerPosFract)*(Percent-nTOCIndex)); + + return (long)(PosFract*m_nEncodedDataSize); +} + diff --git a/Libraries/DecMPA/Files/src/MPAInfo.h b/Libraries/DecMPA/Files/src/MPAInfo.h new file mode 100644 index 000000000..39a065eb0 --- /dev/null +++ b/Libraries/DecMPA/Files/src/MPAInfo.h @@ -0,0 +1,81 @@ +/* DecMPA - simple MPEG Audio decoding library. + Copyright (C) 2002 Hauke Duden + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + For more information look at the file License.txt in this package. + + email: hazard_hd@users.sourceforge.net +*/ + + +#ifndef _MPAINFO_H_ +#define _MPAINFO_H_ + +#include "IFileAccess.h" +#include "MPAFrameFinder.h" +#include "mpegAudioFrame/dxHead.h" + +class CMPAInfo +{ +public: + CMPAInfo(); + ~CMPAInfo(); + + bool InitInfo(CMPAFrameFinder* pFrameFinder,IFileAccess* pFileAccess); + + //-1 if unknown + inline long GetDuration(); + + //-1 if unknown + long GetFilePositionFromTime(long Millis); + + inline bool IsXingVBR(); + inline XHEADDATA* GetXingHeader(); + +protected: + void Init(CMPAFrameFinder* pFrameFinder); + bool ReadXingHeader(void* pFrameData,int nFrameSize); + long GetEncodedDataPositionFromTOC(float TimeFract); + + long m_nEncodedDataSize; + long m_nEncodedDataOffset; + + long m_nDuration; + + bool m_bXingVBR; + XHEADDATA m_XingHeader; + unsigned char m_aXingTOC[100]; + + float m_aTOC[101]; +}; + +inline long CMPAInfo::GetDuration() +{ + return m_nDuration; +} + +inline bool CMPAInfo::IsXingVBR() +{ + return m_bXingVBR; +} + +inline XHEADDATA* CMPAInfo::GetXingHeader() +{ + return &m_XingHeader; +} + + +#endif diff --git a/Libraries/DecMPA/Files/src/MemBuffer.h b/Libraries/DecMPA/Files/src/MemBuffer.h new file mode 100644 index 000000000..4c20165a4 --- /dev/null +++ b/Libraries/DecMPA/Files/src/MemBuffer.h @@ -0,0 +1,157 @@ +/* DecMPA - simple MPEG Audio decoding library. + Copyright (C) 2002 Hauke Duden + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + For more information look at the file License.txt in this package. + + email: hazard_hd@users.sourceforge.net +*/ + + +#ifndef _MEMBUFFER_H_ +#define _MEMBUFFER_H_ + +class CMemBuffer +{ +public: + inline CMemBuffer() + { + m_pBuffer=(unsigned char*)0; + m_nSize=0; + m_nCapacity=0; + m_bAllocated=false; + m_nPos=0; + } + + inline ~CMemBuffer() + { + Free(); + } + + inline void Alloc(int nBytes) + { + Free(); + if(nBytes>0) + { + m_pBuffer=new unsigned char[nBytes]; + m_bAllocated=true; + } + m_nCapacity=nBytes; + } + + inline void Free() + { + if(m_bAllocated) + delete[] m_pBuffer; + Detach(); + } + + inline void Attach(void* pMem,int nBytes) + { + Free(); + m_pBuffer=(unsigned char*)pMem; + m_nSize=nBytes; + m_nCapacity=nBytes; + } + + inline void Detach() + { + m_pBuffer=(unsigned char*)0; + m_nSize=0; + m_nCapacity=0; + m_bAllocated=false; + m_nPos=0; + } + + inline int GetPos() + { + return m_nPos; + } + + inline void SetPos(int Pos) + { + m_nPos=Pos; + } + + inline void AddToPos(int Add) + { + m_nPos+=Add; + } + + inline unsigned char ReadByte() + { + return m_pBuffer[m_nPos++]; + } + + inline void WriteByte(unsigned char Value) + { + m_pBuffer[m_nPos++]=Value; + } + + inline int GetSize() + { + return m_nSize; + } + + inline int GetCapacity() + { + return m_nCapacity; + } + + inline int GetBytesLeft() + { + return m_nSize-m_nPos; + } + + inline void SetSize(int nSize) + { + if(nSize>m_nCapacity) + nSize=m_nCapacity; + m_nSize=nSize; + if(m_nPos>m_nSize) + m_nPos=m_nSize; + } + + inline unsigned char* GetPosPtr() + { + return &m_pBuffer[m_nPos]; + } + + inline unsigned char* GetPtr() + { + return m_pBuffer; + } + + inline bool IsAttached() + { + return !m_bAllocated; + } + + inline bool HasMoreData() + { + return m_nPosstereo=stereo; + this->frequencyHZ=freq; +} + + + +int AudioFrame::isFormatEqual(AudioFrame* compare) { + if(compare->getStereo() != stereo) { + return false; + } + if(compare->getSampleSize() != sampleSize) { + return false; + } + if(compare->getBigEndian() != lBigEndian) { + return false; + } + if(compare->getFrequenceHZ() != frequencyHZ) { + return false; + } + if(compare->getSigned() != lSigned) { + return false; + } + return true; +} + +void AudioFrame::print(const char* msg) { + /*cout << "PCMFrame::print:"<getFrameType() != _FRAME_AUDIO_BASE) { + // cout << "cannot copy frameFormat into frametype!= _FRAME_AUDIO_BASE"<setFrameFormat(getStereo(),getFrequenceHZ()); + dest->sampleSize=getSampleSize(); + dest->lBigEndian=getBigEndian(); + dest->lSigned=getSigned(); +} diff --git a/Libraries/DecMPA/Files/src/frame/audioFrame.h b/Libraries/DecMPA/Files/src/frame/audioFrame.h new file mode 100644 index 000000000..2a8aedf6b --- /dev/null +++ b/Libraries/DecMPA/Files/src/frame/audioFrame.h @@ -0,0 +1,85 @@ +/* + abstract definition of an audio frame + Copyright (C) 2001 Martin Vogt + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Library General Public License as published by + the Free Software Foundation. + + For more information look at the file License.txt in this package + + */ + + + + +#ifndef __AUDIOFRAME_H +#define __AUDIOFRAME_H + + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifndef WORDS_BIGENDIAN +#define AUDIOFRAME_BIGENDIAN 1 +#else +#define AUDIOFRAME_BIGENDIAN 0 +#endif + +#include "frame.h" + +#define SCALFACTOR SHRT_MAX +#define MP3FRAMESIZE (2*2*2*32*18) + + +class AudioFrame : public Frame { + + int stereo; + int frequencyHZ; + + public: + AudioFrame(); + virtual ~AudioFrame(); + + // info about "import" data + void setFrameFormat(int stereo,int freq); + + inline int getStereo() { return stereo; } + inline int getFrequenceHZ() { return frequencyHZ; } + + // these return values depend on the implementation + // how the data is stored internally after "import" + inline int getSampleSize() { return sampleSize; } + inline int getBigEndian() { return lBigEndian; } + inline int getSigned() { return lSigned; } + + // info about output + virtual int getLen(); + virtual void setLen(int len); + virtual int getSize(); + virtual void clearrawdata(); + + // data import + virtual void putFloatData(float* data,int len); + virtual void putFloatData(float* left,float* right,int len); + + virtual void putInt16Data(short* pdata,int nLength); + + virtual void putSilence(int nLength); + + int isFormatEqual(AudioFrame* compare); + // Note: this can only be called with _real_ AudioFrame's as dest + void copyFormat(AudioFrame* dest); + + void print(const char* msg); + + protected: + int sampleSize; + int lBigEndian; + int lSigned; + +}; + + +#endif diff --git a/Libraries/DecMPA/Files/src/frame/floatFrame.cpp b/Libraries/DecMPA/Files/src/frame/floatFrame.cpp new file mode 100644 index 000000000..d94b57363 --- /dev/null +++ b/Libraries/DecMPA/Files/src/frame/floatFrame.cpp @@ -0,0 +1,71 @@ +/* + stores frames as floats. + Copyright (C) 2001 Martin Vogt + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Library General Public License as published by + the Free Software Foundation. + + For more information look at the file License.txt in this package + + */ + +//changes 8/4/2002 (by Hauke Duden): +// - removed cout and exit stuff +// - added #include to ensure that bad_alloc will be thrown on mem error + +#include "floatFrame.h" + +#include +#include + + +FloatFrame::FloatFrame(int size) { + data=new float[size]; + len=0; + this->size=size; + this->sampleSize=sizeof(float)*8; + this->lSigned=true; + this->lBigEndian=AUDIOFRAME_BIGENDIAN; + setFrameType(_FRAME_AUDIO_FLOAT); +} + + +FloatFrame::~FloatFrame() { + delete data; +} + + +void FloatFrame::putFloatData(float* in,int lenCopy) { + //if ((len+lenCopy) > size) { + // cout << "cannot copy putFloatData. Does not fit"<len=len; } + int getSize() { return size; } + float* getData() { return data; } + + void putFloatData(float* data,int len); + void putFloatData(float* left,float* right,int len); + + void putInt16Data(short* pdata,int nLength); + void putSilence(int nLength); + + void clearrawdata() { len=0; } + + + +}; +#endif diff --git a/Libraries/DecMPA/Files/src/frame/frame.cpp b/Libraries/DecMPA/Files/src/frame/frame.cpp new file mode 100644 index 000000000..a42c802f6 --- /dev/null +++ b/Libraries/DecMPA/Files/src/frame/frame.cpp @@ -0,0 +1,73 @@ +/* + base class for frames + Copyright (C) 2001 Martin Vogt + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Library General Public License as published by + the Free Software Foundation. + + For more information look at the file License.txt in this package + + */ + + + +#include "frame.h" + + +Frame::Frame() { + type=_FRAME_UNK; +} + + +Frame::~Frame() { +} + + +const char* Frame::getMajorFrameName(int type) { + int majorID=type >> 12; + switch(majorID) { + case _FRAME_UNK: + return "_FRAME_UNK"; + case _FRAME_RAW: + return "_FRAME_RAW"; + case _FRAME_AUDIO: + return "_FRAME_AUDIO"; + case _FRAME_VIDEO: + return "_FRAME_VIDEO"; + case _FRAME_PAKET: + return "_FRAME_PAKET"; + default: + return "unknown major frameType"; + } + return "never happens Frame::getMajorFrameName"; +} + + + +const char* Frame::getFrameName(int type) { + switch(type) { + // Raw + case _FRAME_RAW_BASE: + return "_FRAME_RAW_BASE"; + case _FRAME_RAW_OGG: + return "_FRAME_RAW_OGG"; + + + // Audio + case _FRAME_AUDIO_BASE: + return "_FRAME_AUDIO_BASE"; + case _FRAME_AUDIO_PCM: + return "_FRAME_AUDIO_PCM"; + case _FRAME_AUDIO_FLOAT: + return "_FRAME_AUDIO_FLOAT"; + + + + // Rest + default: + return "cannot find name"; + } + return "never happens Frame::getFrameName"; +} + diff --git a/Libraries/DecMPA/Files/src/frame/frame.h b/Libraries/DecMPA/Files/src/frame/frame.h new file mode 100644 index 000000000..426a27f94 --- /dev/null +++ b/Libraries/DecMPA/Files/src/frame/frame.h @@ -0,0 +1,103 @@ +/* + base class for frames + Copyright (C) 2001 Martin Vogt + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Library General Public License as published by + the Free Software Foundation. + + For more information look at the file License.txt in this package + + */ + +//changes 8/11/2002 (by Hauke Duden): +// - removed unnecessary includes + +#ifndef __FRAME_H +#define __FRAME_H + + +//#include +//#include +//#include +//#include +//#include + + + +/** + The base class for frames. Every derived class from this class + must belong to some "major" class type and it must have an unique + id for itsself. Even if it is a base class it must have a unique id. + + How does this work. We have an int for the Frame id. In the int + itsself we but the majorid as well. + The Start codes are all multiple of 2 so for example + 0..127 belongs to FRAME UNK + 128..255 belongs to FRAME RAW + + So we can with a simple shift operation find out the major class +*/ +#define _FRAME_SHIFT 7 +#define _FRAME_ID_MAX 128 //(2^_FRAME_SHIFT) + + +// Major Frame classes +#define _FRAME_UNK 0 +#define _FRAME_RAW 1 +#define _FRAME_AUDIO 2 +#define _FRAME_VIDEO 3 +#define _FRAME_PAKET 4 + +// start ids of minor classes + +#define _FRAME_UNK_START (0) +#define _FRAME_RAW_START (_FRAME_ID_MAX) +#define _FRAME_AUDIO_START (_FRAME_ID_MAX*2) +#define _FRAME_VIDEO_START (_FRAME_ID_MAX*2*2) +#define _FRAME_PAKET_START (_FRAME_ID_MAX*2*2*2) + +// Minor Frame type IDs + + +// Raw +#define _FRAME_RAW_BASE (_FRAME_RAW_START+1) +#define _FRAME_RAW_OGG (_FRAME_RAW_START+2) +#define _FRAME_RAW_MPEG_I_VIDEO (_FRAME_RAW_START+3) +#define _FRAME_RAW_MPEG_SYSTEM (_FRAME_RAW_START+4) + + +// Audio: +#define _FRAME_AUDIO_BASE (_FRAME_AUDIO_START+1) +#define _FRAME_AUDIO_PCM (_FRAME_AUDIO_START+2) +#define _FRAME_AUDIO_FLOAT (_FRAME_AUDIO_START+3) + +// Video: +#define _FRAME_VIDEO_BASE (_FRAME_VIDEO_START+1) +#define _FRAME_VIDEO_YUV (_FRAME_VIDEO_START+2) +#define _FRAME_VIDEO_RGB_8 (_FRAME_VIDEO_START+3) +#define _FRAME_VIDEO_RGB_16 (_FRAME_VIDEO_START+4) +#define _FRAME_VIDEO_RGB_32 (_FRAME_VIDEO_START+5) + +// Packet: +#define _FRAME_PACKET_SYNC (_FRAME_PAKET_START+1) +#define _FRAME_PACKET_PACKET_CONTAINER (_FRAME_PAKET_START+2) + + + + +class Frame { + int type; + + public: + Frame(); + ~Frame(); + inline int getMajorFrameType() { return (type>>_FRAME_SHIFT);} + inline int getFrameType() { return type; } + inline void setFrameType(int type) { this->type=type; } + + + static const char* getMajorFrameName(int type); + static const char* getFrameName(int type); +}; +#endif diff --git a/Libraries/DecMPA/Files/src/frame/pcmFrame.cpp b/Libraries/DecMPA/Files/src/frame/pcmFrame.cpp new file mode 100644 index 000000000..d0fec8e41 --- /dev/null +++ b/Libraries/DecMPA/Files/src/frame/pcmFrame.cpp @@ -0,0 +1,143 @@ +/* + pcm frame description. + Copyright (C) 2001 Martin Vogt + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Library General Public License as published by + the Free Software Foundation. + + For more information look at the file License.txt in this package + + */ + +//changes 8/4/2002 (by Hauke Duden): +// - removed cout and exit stuff +// - added #include to ensure that bad_alloc will be thrown on mem error + +#include "pcmFrame.h" +#include + +#include +#include + +#include + +//anscheinend ist die range der Werte -1,1 +/*#define convMacro(in,dtemp,tmp) \ + tmp=(int)(in[0]*32768*0.9f); \ + in++; \ + if(tmp>32767) \ + tmp=32767; \ + else if(tmp<-32768) \ + tmp=-32768;*/ + + +#define convMacro(in,dtemp,tmp) \ + in[0]*=SCALFACTOR; \ + dtemp = ((((65536.0 * 65536.0 * 16)+(65536.0 * 0.5))* 65536.0))+(in[0]); \ + tmp = ((*(int *)&dtemp) - 0x80000000); \ + in++; \ + if(tmp>32767) { \ + tmp=32767; \ + } else if (tmp<-32768) { \ + tmp =-0x8000; \ + } + + + +PCMFrame::PCMFrame(int size) { + data=new short int[size]; + len=0; + this->size=size; + // this format has a sampleSize of 16, signed, endian==machine + this->sampleSize=sizeof(short int)*8; + this->lSigned=true; + this->lBigEndian=AUDIOFRAME_BIGENDIAN; + setFrameType(_FRAME_AUDIO_PCM); +} + + +PCMFrame::~PCMFrame() { + delete data; +} + + +void PCMFrame::putFloatData(float* left,float* right,int copyLen) { + int destSize=0; + if (left != NULL) destSize++; + if (right != NULL) destSize++; + destSize*=copyLen; + /*if ((len+destSize) > size) { + cout << "cannot copy putFloatData L/R version . Does not fit"< 0) { + convMacro(left,dtemp,tmp); + data[len++]=(short int)tmp; + convMacro(right,dtemp,tmp); + data[len++]=(short int)tmp; + i--; + } + break; + case 0: + if (left != NULL) { + int i=copyLen; + while(i > 0) { + convMacro(left,dtemp,tmp); + data[len++]=(short int)tmp; + i--; + // right channel empty + len++; + } + } + if (right != NULL) { + int i=copyLen; + len=len-destSize; + while(i > 0) { + // select right channel + len++; + convMacro(right,dtemp,tmp); + data[len++]=(short int)tmp; + i--; + // left channel already copied + } + } + default: + /*cout << "unknown stereo value in pcmFrame"< size) { + cout << "cannot copy putFloatData. Does not fit"< 0) { + convMacro(in,dtemp,tmp); + data[len++]=(short int)tmp; + lenCopy--; + } + +} + +void PCMFrame::putInt16Data(short* pData,int nLength) +{ + memcpy(data,pData,nLength*sizeof(short)); + len=nLength; +} + +void PCMFrame::putSilence(int nLength) +{ + memset(data,0,nLength*sizeof(short)); + len=nLength; +} diff --git a/Libraries/DecMPA/Files/src/frame/pcmFrame.h b/Libraries/DecMPA/Files/src/frame/pcmFrame.h new file mode 100644 index 000000000..eb84a797e --- /dev/null +++ b/Libraries/DecMPA/Files/src/frame/pcmFrame.h @@ -0,0 +1,50 @@ +/* + pcm frame description. + Copyright (C) 2001 Martin Vogt + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Library General Public License as published by + the Free Software Foundation. + + For more information look at the file License.txt in this package + + */ + + + +#ifndef __PCMFRAME_H +#define __PCMFRAME_H + + +#include "audioFrame.h" + +// this format has a sampleSize of 16, signed, endian==machine + +class PCMFrame : public AudioFrame { + + short int* data; + int len; + int size; + + public: + PCMFrame(int size); + ~PCMFrame(); + + int getLen() { return len; } + void setLen(int len) { this->len=len; } + int getSize() { return size; } + short int* getData() { return data; } + + void putFloatData(float* data,int len); + void putFloatData(float* left,float* right,int len); + + void putInt16Data(short* pdata,int nLength); + + void putSilence(int nLength); + + + void clearrawdata() { len=0; } + + +}; +#endif diff --git a/Libraries/DecMPA/Files/src/frame/rawDataBuffer.cpp b/Libraries/DecMPA/Files/src/frame/rawDataBuffer.cpp new file mode 100644 index 000000000..b14247826 --- /dev/null +++ b/Libraries/DecMPA/Files/src/frame/rawDataBuffer.cpp @@ -0,0 +1,21 @@ +/* + stores simple buffer information. does not allocate anything + Copyright (C) 2001 Martin Vogt + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Library General Public License as published by + the Free Software Foundation. + + For more information look at the file License.txt in this package + + */ + + +#include "rawDataBuffer.h" + +// hm + +RawDataBuffer::~RawDataBuffer() { +} + + diff --git a/Libraries/DecMPA/Files/src/frame/rawDataBuffer.h b/Libraries/DecMPA/Files/src/frame/rawDataBuffer.h new file mode 100644 index 000000000..bcfbb7c13 --- /dev/null +++ b/Libraries/DecMPA/Files/src/frame/rawDataBuffer.h @@ -0,0 +1,48 @@ +/* + stores simple buffer information. does not allocate anything + Copyright (C) 2001 Martin Vogt + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Library General Public License as published by + the Free Software Foundation. + + For more information look at the file License.txt in this package + + */ + + + +#ifndef __RAWDATABUFFER_H +#define __RAWDATABUFFER_H + + +class RawDataBuffer { + + int _size; + unsigned char* _ptr; + int _pos; + + public: + RawDataBuffer(unsigned char* ptr,int size) { set(ptr,size,0); } + ~RawDataBuffer(); + + + + unsigned char* ptr() { return _ptr; } + unsigned char* current() { return _ptr+_pos; } + int size() { return _size; } + int pos() { return _pos; } + int untilend() { return _size-_pos; } + int eof() { return _pos>=_size; } + + void inc() { this->_pos++; } + void inc(int val) { this->_pos+=val; } + void setpos(int val) { this->_pos=val; } + void setptr(unsigned char* ptr) { this->_ptr=ptr; } + void setsize(int size) { this->_size=size; } + + void set(unsigned char* ptr, + int size,int pos) { setpos(pos);setptr(ptr);setsize(size);} + +}; +#endif diff --git a/Libraries/DecMPA/Files/src/hip/DecodeEngine_Hip.cpp b/Libraries/DecMPA/Files/src/hip/DecodeEngine_Hip.cpp new file mode 100644 index 000000000..fbe487cd6 --- /dev/null +++ b/Libraries/DecMPA/Files/src/hip/DecodeEngine_Hip.cpp @@ -0,0 +1,135 @@ +/* DecMPA - simple MPEG Audio decoding library. + Copyright (C) 2002 Hauke Duden + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + For more information look at the file License.txt in this package. + + + email: hazard_hd@users.sourceforge.net +*/ + + +#include +#include "interface.h" + +#include "../DecodeEngine.h" + +#include "../frame/pcmFrame.h" + +#include + +extern const long freqs[9]; + +struct DecodeEngine +{ + MPSTR Decoder; + short aTempBuffer[MP3FRAMESIZE*2]; +}; + +void* DecodeEngine_Create() +{ + DecodeEngine* pEngine=new DecodeEngine; + + if(!InitMP3(&pEngine->Decoder)) + { + delete pEngine; + pEngine=(DecodeEngine*)0; + } + + return pEngine; +} + +void DecodeEngine_Destroy(void* pEng) +{ + DecodeEngine* pEngine=(DecodeEngine*)pEng; + + ExitMP3(&pEngine->Decoder); + + delete pEngine; +} + +bool DecodeEngine_Decode(void* pEng,AudioFrame* pDest,void* pData,long nDataLength) +{ + DecodeEngine* pEngine=(DecodeEngine*)pEng; + int nDone; + int nResult; + char* pOut; + int nOutSize; + int nChannels; + + if(pDest->getFrameType()==_FRAME_AUDIO_PCM) + { + pOut=(char*)((PCMFrame*)pDest)->getData(); + nOutSize=pDest->getSize(); + } + else + { + pOut=(char*)pEngine->aTempBuffer; + nOutSize=sizeof(pEngine->aTempBuffer)/sizeof(short); + } + + nResult=decodeMP3(&pEngine->Decoder,(unsigned char*)pData,nDataLength,pOut,nOutSize,&nDone); + if(nResult==MP3_OK) + { + nDone/=sizeof(short); + nChannels=pEngine->Decoder.fr.stereo; + + if(pDest->getFrameType()!=_FRAME_AUDIO_PCM) + pDest->putInt16Data((short*)pOut,nDone); + else + pDest->setLen(nDone); + + pDest->setFrameFormat((nChannels==2) ? 1 : 0,freqs[pEngine->Decoder.fr.sampling_frequency]); + + return true; + } + else if(nResult==MP3_NEED_MORE) + { + //should never happen otherwise because only whole frames + //are passed to HIP and the modified version of HIP we use + //here does not buffer data from the beginning for later use + + //not critical, though + + pDest->setLen(0); + pDest->setFrameFormat(1,44100); + + return true; + } + else + { + //error + return false; + } +} + +void DecodeEngine_Flush(void* pEng) +{ + DecodeEngine* pEngine=(DecodeEngine*)pEng; + + //complete reinit + ExitMP3(&pEngine->Decoder); + InitMP3(&pEngine->Decoder); + + /*while(pEngine->Decoder.tail!=NULL) + remove_buf(&pEngine->Decoder); + pEngine->Decoder.bsize=0; + + pEngine->Decoder.header_parsed=0; + pEngine->Decoder.side_parsed=0; + pEngine->Decoder.data_parsed=0; + pEngine->Decoder.sync_bitstream=1;*/ +} diff --git a/Libraries/DecMPA/Files/src/hip/HIPDefines.h b/Libraries/DecMPA/Files/src/hip/HIPDefines.h new file mode 100644 index 000000000..2e33badfa --- /dev/null +++ b/Libraries/DecMPA/Files/src/hip/HIPDefines.h @@ -0,0 +1,10 @@ +#ifndef _HIPDEFINES_H_ +#define _HIPDEFINES_H_ + +#define NOANALYSIS +#define USE_LAYER_1 +#define USE_LAYER_2 + +#define MPEG1 + +#endif diff --git a/Libraries/DecMPA/Files/src/hip/VbrTag.c b/Libraries/DecMPA/Files/src/hip/VbrTag.c new file mode 100644 index 000000000..070ed58d1 --- /dev/null +++ b/Libraries/DecMPA/Files/src/hip/VbrTag.c @@ -0,0 +1,176 @@ +/* DecMPA decoding routines from Lame/HIP (Myers W. Carpenter) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + For more information look at the file License.txt in this package. + + + email: hazard_hd@users.sourceforge.net +*/ + +#include "VbrTag.h" +#include + +/* stuff from lame's tables.c */ +const int bitrate_table [3] [16] = { + { 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, -1 }, + { 0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, -1 }, + { 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, -1 }, +}; + +const int samplerate_table [3] [4] = { + { 22050, 24000, 16000, -1 }, /* MPEG 2 */ + { 44100, 48000, 32000, -1 }, /* MPEG 1 */ + { 11025, 12000, 8000, -1 }, /* MPEG 2.5 */ +}; +/* end stuff from lame's tables.c */ + + +/* stuff from VbrTag.c/.h */ +const static char VBRTag[]={"Xing"}; +const static char VBRTag2[]={"Info"}; + +/* from lame's VbrTag.c */ +static int +ExtractI4(unsigned char *buf) +{ + int x; + /* big endian extract */ + x = buf[0]; + x <<= 8; + x |= buf[1]; + x <<= 8; + x |= buf[2]; + x <<= 8; + x |= buf[3]; + return x; +} + +/* from lame's VbrTag.c */ +int +GetVbrTag(VBRTAGDATA *pTagData, unsigned char *buf) +{ + int i, head_flags; + int h_bitrate,h_id, h_mode, h_sr_index; + int enc_delay,enc_padding; + + /* get Vbr header data */ + pTagData->flags = 0; + + /* get selected MPEG header data */ + h_id = (buf[1] >> 3) & 1; + h_sr_index = (buf[2] >> 2) & 3; + h_mode = (buf[3] >> 6) & 3; + h_bitrate = ((buf[2]>>4)&0xf); + h_bitrate = bitrate_table[h_id][h_bitrate]; + + /* check for FFE syncword */ + if ((buf[1]>>4)==0xE) + pTagData->samprate = samplerate_table[2][h_sr_index]; + else + pTagData->samprate = samplerate_table[h_id][h_sr_index]; + // if( h_id == 0 ) + // pTagData->samprate >>= 1; + + /* determine offset of header */ + if( h_id ) + { + /* mpeg1 */ + if( h_mode != 3 ) buf+=(32+4); + else buf+=(17+4); + } + else + { + /* mpeg2 */ + if( h_mode != 3 ) buf+=(17+4); + else buf+=(9+4); + } + + if( buf[0] != VBRTag[0] && buf[0] != VBRTag2[0] ) return 0; /* fail */ + if( buf[1] != VBRTag[1] && buf[1] != VBRTag2[1]) return 0; /* header not found*/ + if( buf[2] != VBRTag[2] && buf[2] != VBRTag2[2]) return 0; + if( buf[3] != VBRTag[3] && buf[3] != VBRTag2[3]) return 0; + + buf+=4; + + pTagData->h_id = h_id; + + head_flags = pTagData->flags = ExtractI4(buf); buf+=4; /* get flags */ + + if( head_flags & FRAMES_FLAG ) + { + pTagData->frames = ExtractI4(buf); buf+=4; + } + + if( head_flags & BYTES_FLAG ) + { + pTagData->bytes = ExtractI4(buf); buf+=4; + } + + if( head_flags & TOC_FLAG ) + { + if( pTagData->toc != NULL ) + { + for(i=0;itoc[i] = buf[i]; + } + buf+=NUMTOCENTRIES; + } + + pTagData->vbr_scale = -1; + + if( head_flags & VBR_SCALE_FLAG ) + { + pTagData->vbr_scale = ExtractI4(buf); buf+=4; + } + + pTagData->headersize = + ((h_id+1)*72000*h_bitrate) / pTagData->samprate; + + buf+=21; + enc_delay = buf[0] << 4; + enc_delay += buf[1] >> 4; + enc_padding= (buf[1] & 0x0F)<<8; + enc_padding += buf[2]; + // check for reasonable values (this may be an old Xing header, + // not a INFO tag) + if (enc_delay<0 || enc_delay > 3000) enc_delay=-1; + if (enc_padding<0 || enc_padding > 3000) enc_padding=-1; + + pTagData->enc_delay=enc_delay; + pTagData->enc_padding=enc_padding; + +#ifdef HIP_DEBUG + fprintf(stderr,"exit GetVbrTag:\n"); + fprintf(stderr," tag = %s\n",VBRTag); + fprintf(stderr," head_flags = %d\n",head_flags); + fprintf(stderr," bytes = %d\n",pTagData->bytes); + fprintf(stderr," frames = %d\n",pTagData->frames); + fprintf(stderr," VBR Scale = %d\n",pTagData->vbr_scale); + fprintf(stderr," enc_delay = %i \n",enc_delay); + fprintf(stderr," enc_padding = %i \n",enc_padding); + fprintf(stderr," toc =\n"); + if( pTagData->toc != NULL ) + { + for(i=0;itoc[i])); + } + } + fprintf(stderr,"\n"); +#endif + return 1; /* success */ +} diff --git a/Libraries/DecMPA/Files/src/hip/VbrTag.h b/Libraries/DecMPA/Files/src/hip/VbrTag.h new file mode 100644 index 000000000..f56feb34c --- /dev/null +++ b/Libraries/DecMPA/Files/src/hip/VbrTag.h @@ -0,0 +1,82 @@ +/* DecMPA decoding routines from Lame/HIP (Myers W. Carpenter) + * + * Xing VBR tagging for LAME. + * + * Copyright (c) 1999 A.L. Faber + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef LAME_VRBTAG_H +#define LAME_VRBTAG_H +/* ----------------------------------------------------------- + * A Vbr header may be present in the ancillary + * data field of the first frame of an mp3 bitstream + * The Vbr header (optionally) contains + * frames total number of audio frames in the bitstream + * bytes total number of bytes in the bitstream + * toc table of contents + + * toc (table of contents) gives seek points + * for random access + * the ith entry determines the seek point for + * i-percent duration + * seek point in bytes = (toc[i]/256.0) * total_bitstream_bytes + * e.g. half duration seek point = (toc[50]/256.0) * total_bitstream_bytes + */ + + +#define FRAMES_FLAG 0x0001 +#define BYTES_FLAG 0x0002 +#define TOC_FLAG 0x0004 +#define VBR_SCALE_FLAG 0x0008 + +#define NUMTOCENTRIES 100 + +#define FRAMES_AND_BYTES (FRAMES_FLAG | BYTES_FLAG) + + + +/*structure to receive extracted header */ +/* toc may be NULL*/ +typedef struct +{ + int h_id; /* from MPEG header, 0=MPEG2, 1=MPEG1 */ + int samprate; /* determined from MPEG header */ + int flags; /* from Vbr header data */ + int frames; /* total bit stream frames from Vbr header data */ + int bytes; /* total bit stream bytes from Vbr header data*/ + int vbr_scale; /* encoded vbr scale from Vbr header data*/ + unsigned char toc[NUMTOCENTRIES]; /* may be NULL if toc not desired*/ + int headersize; /* size of VBR header, in bytes */ + int enc_delay; /* encoder delay */ + int enc_padding; /* encoder paddign added at end of stream */ +} VBRTAGDATA; + +int CheckVbrTag(unsigned char *buf); +int GetVbrTag(VBRTAGDATA *pTagData, unsigned char *buf); + +/* +int SeekPoint(unsigned char TOC[NUMTOCENTRIES], int file_bytes, float percent); +int InitVbrTag(lame_global_flags *gfp); +int PutVbrTag(lame_global_flags *gfp,FILE *fid,int nVbrScale); +int PutLameVBR(lame_global_flags *gfp, FILE *fpStream, uint8_t *pbtStreamBuffer, uint32_t id3v2size, uint16_t crc); +void AddVbrFrame(lame_global_flags *gfp); +void ReportLameTagProgress(lame_global_flags *gfp,int nStart); +void UpdateMusicCRC(uint16_t *crc,unsigned char *buffer, int size); +*/ + +#endif diff --git a/Libraries/DecMPA/Files/src/hip/common.c b/Libraries/DecMPA/Files/src/hip/common.c new file mode 100644 index 000000000..f5df930fa --- /dev/null +++ b/Libraries/DecMPA/Files/src/hip/common.c @@ -0,0 +1,320 @@ +/* DecMPA decoding routines from Lame/HIP (Myers W. Carpenter) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + For more information look at the file License.txt in this package. + + + email: hazard_hd@users.sourceforge.net +*/ + + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include +#include + +#ifdef HAVE_FCNTL_H +#include +#endif + +#ifdef macintosh +#include +#include +#else +#include +#include +#endif + +#include "common.h" + +#ifdef WITH_DMALLOC +#include +#endif + +// In C++ the array first must be prototyped, why ? + +extern const int tabsel_123 [2] [3] [16]; + +const int tabsel_123 [2] [3] [16] = { + { {0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,}, + {0,32,48,56, 64, 80, 96,112,128,160,192,224,256,320,384,}, + {0,32,40,48, 56, 64, 80, 96,112,128,160,192,224,256,320,} }, + + { {0,32,48,56,64,80,96,112,128,144,160,176,192,224,256,}, + {0,8,16,24,32,40,48,56,64,80,96,112,128,144,160,}, + {0,8,16,24,32,40,48,56,64,80,96,112,128,144,160,} } +}; + +const long freqs[9] = { 44100, 48000, 32000, + 22050, 24000, 16000, + 11025, 12000, 8000 }; + +int bitindex; +unsigned char *wordpointer; +unsigned char *pcm_sample; +int pcm_point = 0; + + +#if defined( USE_LAYER_1 ) || defined ( USE_LAYER_2 ) + real muls[27][64]; +#endif + +#define HDRCMPMASK 0xfffffd00 + + +int head_check(unsigned long head,int check_layer) +{ + /* + look for a valid header. + if check_layer > 0, then require that + nLayer = check_layer. + */ + + /* bits 13-14 = layer 3 */ + int nLayer=4-((head>>17)&3); + + if( (head & 0xffe00000) != 0xffe00000) { + /* syncword */ + return FALSE; + } +#if 0 + if(!((head>>17)&3)) { + /* bits 13-14 = layer 3 */ + return FALSE; + } +#endif + + if (3 != nLayer) + { + #if defined (USE_LAYER_1) || defined (USE_LAYER_2) + if (4==nLayer) + return FALSE; + #else + return FALSE; + #endif + } + + if (check_layer>0) { + if (nLayer != check_layer) return FALSE; + } + + if( ((head>>12)&0xf) == 0xf) { + /* bits 16,17,18,19 = 1111 invalid bitrate */ + return FALSE; + } + if( ((head>>10)&0x3) == 0x3 ) { + /* bits 20,21 = 11 invalid sampling freq */ + return FALSE; + } + return TRUE; +} + + +/* + * the code a header and write the information + * into the frame structure + */ +int decode_header(struct frame *fr,unsigned long newhead) +{ + + + if( newhead & (1<<20) ) { + fr->lsf = (newhead & (1<<19)) ? 0x0 : 0x1; + fr->mpeg25 = 0; + } + else { + fr->lsf = 1; + fr->mpeg25 = 1; + } + + + fr->lay = 4-((newhead>>17)&3); + if( ((newhead>>10)&0x3) == 0x3) + { + //fprintf(stderr,"Stream error\n"); + //exit(1); + return 0; + } + if(fr->mpeg25) { + fr->sampling_frequency = 6 + ((newhead>>10)&0x3); + } + else + fr->sampling_frequency = ((newhead>>10)&0x3) + (fr->lsf*3); + + fr->error_protection = ((newhead>>16)&0x1)^0x1; + + if(fr->mpeg25) /* allow Bitrate change for 2.5 ... */ + fr->bitrate_index = ((newhead>>12)&0xf); + + fr->bitrate_index = ((newhead>>12)&0xf); + fr->padding = ((newhead>>9)&0x1); + fr->extension = ((newhead>>8)&0x1); + fr->mode = ((newhead>>6)&0x3); + fr->mode_ext = ((newhead>>4)&0x3); + fr->copyright = ((newhead>>3)&0x1); + fr->original = ((newhead>>2)&0x1); + fr->emphasis = newhead & 0x3; + + fr->stereo = (fr->mode == MPG_MD_MONO) ? 1 : 2; + + switch(fr->lay) + { +#ifdef USE_LAYER_1 + case 1: + fr->framesize = (long) tabsel_123[fr->lsf][0][fr->bitrate_index] * 12000; + fr->framesize /= freqs[fr->sampling_frequency]; + fr->framesize = ((fr->framesize+fr->padding)<<2)-4; + fr->down_sample=0; + fr->down_sample_sblimit = SBLIMIT>>(fr->down_sample); + break; +#endif +#ifdef USE_LAYER_2 + case 2: + fr->framesize = (long) tabsel_123[fr->lsf][1][fr->bitrate_index] * 144000; + fr->framesize /= freqs[fr->sampling_frequency]; + fr->framesize += fr->padding - 4; + fr->down_sample=0; + fr->down_sample_sblimit = SBLIMIT>>(fr->down_sample); + break; +#endif + case 3: +#if 0 + fr->do_layer = do_layer3; + if(fr->lsf) + ssize = (fr->stereo == 1) ? 9 : 17; + else + ssize = (fr->stereo == 1) ? 17 : 32; +#endif + +#if 0 + if(fr->error_protection) + ssize += 2; +#endif + if (fr->bitrate_index==0) + fr->framesize=0; + else{ + fr->framesize = (long) tabsel_123[fr->lsf][2][fr->bitrate_index] * 144000; + fr->framesize /= freqs[fr->sampling_frequency]<<(fr->lsf); + fr->framesize = fr->framesize + fr->padding - 4; + } + break; + default: + //fprintf(stderr,"Sorry, layer %d not supported\n",fr->lay); + return (0); + } + /* print_header(fr); */ + + return 1; +} + + +/*#if 1 +void print_header(struct frame *fr) +{ + static const char *modes[4] = { "Stereo", "Joint-Stereo", "Dual-Channel", "Single-Channel" }; + static const char *layers[4] = { "Unknown" , "I", "II", "III" }; + + fprintf(stderr,"MPEG %s, Layer: %s, Freq: %ld, mode: %s, modext: %d, BPF : %d\n", + fr->mpeg25 ? "2.5" : (fr->lsf ? "2.0" : "1.0"), + layers[fr->lay],freqs[fr->sampling_frequency], + modes[fr->mode],fr->mode_ext,fr->framesize+4); + fprintf(stderr,"Channels: %d, copyright: %s, original: %s, CRC: %s, emphasis: %d.\n", + fr->stereo,fr->copyright?"Yes":"No", + fr->original?"Yes":"No",fr->error_protection?"Yes":"No", + fr->emphasis); + fprintf(stderr,"Bitrate: %d Kbits/s, Extension value: %d\n", + tabsel_123[fr->lsf][fr->lay-1][fr->bitrate_index],fr->extension); +} + +void print_header_compact(struct frame *fr) +{ + static const char *modes[4] = { "stereo", "joint-stereo", "dual-channel", "mono" }; + static const char *layers[4] = { "Unknown" , "I", "II", "III" }; + + fprintf(stderr,"MPEG %s layer %s, %d kbit/s, %ld Hz %s\n", + fr->mpeg25 ? "2.5" : (fr->lsf ? "2.0" : "1.0"), + layers[fr->lay], + tabsel_123[fr->lsf][fr->lay-1][fr->bitrate_index], + freqs[fr->sampling_frequency], modes[fr->mode]); +} + +#endif*/ + +unsigned int getbits(int number_of_bits) +{ + unsigned long rval; + + if(!number_of_bits) + return 0; + + { + rval = wordpointer[0]; + rval <<= 8; + rval |= wordpointer[1]; + rval <<= 8; + rval |= wordpointer[2]; + rval <<= bitindex; + rval &= 0xffffff; + + bitindex += number_of_bits; + + rval >>= (24-number_of_bits); + + wordpointer += (bitindex>>3); + bitindex &= 7; + } + return rval; +} + +unsigned int getbits_fast(int number_of_bits) +{ + unsigned long rval; + + { + rval = wordpointer[0]; + rval <<= 8; + rval |= wordpointer[1]; + rval <<= bitindex; + rval &= 0xffff; + bitindex += number_of_bits; + + rval >>= (16-number_of_bits); + + wordpointer += (bitindex>>3); + bitindex &= 7; + } + return rval; +} + + +int set_pointer( PMPSTR mp, long backstep) +{ + unsigned char *bsbufold; + + if(mp->fsizeold < 0 && backstep > 0) { + //fprintf(stderr,"Can't step back %ld!\n",backstep); + return MP3_ERR; + } + bsbufold = mp->bsspace[1-mp->bsnum] + 512; + wordpointer -= backstep; + if (backstep) + memcpy(wordpointer,bsbufold+mp->fsizeold-backstep,(size_t)backstep); + bitindex = 0; + return MP3_OK; +} diff --git a/Libraries/DecMPA/Files/src/hip/common.h b/Libraries/DecMPA/Files/src/hip/common.h new file mode 100644 index 000000000..43fa85e58 --- /dev/null +++ b/Libraries/DecMPA/Files/src/hip/common.h @@ -0,0 +1,54 @@ +/* DecMPA decoding routines from Lame/HIP (Myers W. Carpenter) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + For more information look at the file License.txt in this package. + + + email: hazard_hd@users.sourceforge.net +*/ + +/* +** Copyright (C) 2000 Albert L. Faber +**/ + + +#ifndef COMMON_H_INCLUDED +#define COMMON_H_INCLUDED + +#include "HIPDefines.h" + +#include "mpg123.h" +#include "mpglib.h" + +extern const int tabsel_123[2][3][16]; +extern const long freqs[9]; +extern unsigned char *wordpointer; +extern int bitindex; + + +#if defined( USE_LAYER_1 ) || defined ( USE_LAYER_2 ) + extern real muls[27][64]; +#endif + +int head_check(unsigned long head,int check_layer); +int decode_header(struct frame *fr,unsigned long newhead); +void print_header(struct frame *fr); +void print_header_compact(struct frame *fr); +unsigned int getbits(int number_of_bits); +unsigned int getbits_fast(int number_of_bits); +int set_pointer( PMPSTR mp, long backstep); + +#endif diff --git a/Libraries/DecMPA/Files/src/hip/dct64_i386.c b/Libraries/DecMPA/Files/src/hip/dct64_i386.c new file mode 100644 index 000000000..8e7ff2817 --- /dev/null +++ b/Libraries/DecMPA/Files/src/hip/dct64_i386.c @@ -0,0 +1,348 @@ +/* DecMPA decoding routines from Lame/HIP (Myers W. Carpenter) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + For more information look at the file License.txt in this package. + + + email: hazard_hd@users.sourceforge.net +*/ + + +/* + * Discrete Cosine Tansform (DCT) for subband synthesis + * optimized for machines with no auto-increment. + * The performance is highly compiler dependend. Maybe + * the dct64.c version for 'normal' processor may be faster + * even for Intel processors. + */ + +/* $Id$ */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "dct64_i386.h" +#include "tabinit.h" + +#ifdef WITH_DMALLOC +#include +#endif + +static void dct64_1(real *out0,real *out1,real *b1,real *b2,real *samples) +{ + + { + register real *costab = pnts[0]; + + b1[0x00] = samples[0x00] + samples[0x1F]; + b1[0x1F] = (samples[0x00] - samples[0x1F]) * costab[0x0]; + + b1[0x01] = samples[0x01] + samples[0x1E]; + b1[0x1E] = (samples[0x01] - samples[0x1E]) * costab[0x1]; + + b1[0x02] = samples[0x02] + samples[0x1D]; + b1[0x1D] = (samples[0x02] - samples[0x1D]) * costab[0x2]; + + b1[0x03] = samples[0x03] + samples[0x1C]; + b1[0x1C] = (samples[0x03] - samples[0x1C]) * costab[0x3]; + + b1[0x04] = samples[0x04] + samples[0x1B]; + b1[0x1B] = (samples[0x04] - samples[0x1B]) * costab[0x4]; + + b1[0x05] = samples[0x05] + samples[0x1A]; + b1[0x1A] = (samples[0x05] - samples[0x1A]) * costab[0x5]; + + b1[0x06] = samples[0x06] + samples[0x19]; + b1[0x19] = (samples[0x06] - samples[0x19]) * costab[0x6]; + + b1[0x07] = samples[0x07] + samples[0x18]; + b1[0x18] = (samples[0x07] - samples[0x18]) * costab[0x7]; + + b1[0x08] = samples[0x08] + samples[0x17]; + b1[0x17] = (samples[0x08] - samples[0x17]) * costab[0x8]; + + b1[0x09] = samples[0x09] + samples[0x16]; + b1[0x16] = (samples[0x09] - samples[0x16]) * costab[0x9]; + + b1[0x0A] = samples[0x0A] + samples[0x15]; + b1[0x15] = (samples[0x0A] - samples[0x15]) * costab[0xA]; + + b1[0x0B] = samples[0x0B] + samples[0x14]; + b1[0x14] = (samples[0x0B] - samples[0x14]) * costab[0xB]; + + b1[0x0C] = samples[0x0C] + samples[0x13]; + b1[0x13] = (samples[0x0C] - samples[0x13]) * costab[0xC]; + + b1[0x0D] = samples[0x0D] + samples[0x12]; + b1[0x12] = (samples[0x0D] - samples[0x12]) * costab[0xD]; + + b1[0x0E] = samples[0x0E] + samples[0x11]; + b1[0x11] = (samples[0x0E] - samples[0x11]) * costab[0xE]; + + b1[0x0F] = samples[0x0F] + samples[0x10]; + b1[0x10] = (samples[0x0F] - samples[0x10]) * costab[0xF]; + } + + + { + register real *costab = pnts[1]; + + b2[0x00] = b1[0x00] + b1[0x0F]; + b2[0x0F] = (b1[0x00] - b1[0x0F]) * costab[0]; + b2[0x01] = b1[0x01] + b1[0x0E]; + b2[0x0E] = (b1[0x01] - b1[0x0E]) * costab[1]; + b2[0x02] = b1[0x02] + b1[0x0D]; + b2[0x0D] = (b1[0x02] - b1[0x0D]) * costab[2]; + b2[0x03] = b1[0x03] + b1[0x0C]; + b2[0x0C] = (b1[0x03] - b1[0x0C]) * costab[3]; + b2[0x04] = b1[0x04] + b1[0x0B]; + b2[0x0B] = (b1[0x04] - b1[0x0B]) * costab[4]; + b2[0x05] = b1[0x05] + b1[0x0A]; + b2[0x0A] = (b1[0x05] - b1[0x0A]) * costab[5]; + b2[0x06] = b1[0x06] + b1[0x09]; + b2[0x09] = (b1[0x06] - b1[0x09]) * costab[6]; + b2[0x07] = b1[0x07] + b1[0x08]; + b2[0x08] = (b1[0x07] - b1[0x08]) * costab[7]; + + b2[0x10] = b1[0x10] + b1[0x1F]; + b2[0x1F] = (b1[0x1F] - b1[0x10]) * costab[0]; + b2[0x11] = b1[0x11] + b1[0x1E]; + b2[0x1E] = (b1[0x1E] - b1[0x11]) * costab[1]; + b2[0x12] = b1[0x12] + b1[0x1D]; + b2[0x1D] = (b1[0x1D] - b1[0x12]) * costab[2]; + b2[0x13] = b1[0x13] + b1[0x1C]; + b2[0x1C] = (b1[0x1C] - b1[0x13]) * costab[3]; + b2[0x14] = b1[0x14] + b1[0x1B]; + b2[0x1B] = (b1[0x1B] - b1[0x14]) * costab[4]; + b2[0x15] = b1[0x15] + b1[0x1A]; + b2[0x1A] = (b1[0x1A] - b1[0x15]) * costab[5]; + b2[0x16] = b1[0x16] + b1[0x19]; + b2[0x19] = (b1[0x19] - b1[0x16]) * costab[6]; + b2[0x17] = b1[0x17] + b1[0x18]; + b2[0x18] = (b1[0x18] - b1[0x17]) * costab[7]; + } + + { + register real *costab = pnts[2]; + + b1[0x00] = b2[0x00] + b2[0x07]; + b1[0x07] = (b2[0x00] - b2[0x07]) * costab[0]; + b1[0x01] = b2[0x01] + b2[0x06]; + b1[0x06] = (b2[0x01] - b2[0x06]) * costab[1]; + b1[0x02] = b2[0x02] + b2[0x05]; + b1[0x05] = (b2[0x02] - b2[0x05]) * costab[2]; + b1[0x03] = b2[0x03] + b2[0x04]; + b1[0x04] = (b2[0x03] - b2[0x04]) * costab[3]; + + b1[0x08] = b2[0x08] + b2[0x0F]; + b1[0x0F] = (b2[0x0F] - b2[0x08]) * costab[0]; + b1[0x09] = b2[0x09] + b2[0x0E]; + b1[0x0E] = (b2[0x0E] - b2[0x09]) * costab[1]; + b1[0x0A] = b2[0x0A] + b2[0x0D]; + b1[0x0D] = (b2[0x0D] - b2[0x0A]) * costab[2]; + b1[0x0B] = b2[0x0B] + b2[0x0C]; + b1[0x0C] = (b2[0x0C] - b2[0x0B]) * costab[3]; + + b1[0x10] = b2[0x10] + b2[0x17]; + b1[0x17] = (b2[0x10] - b2[0x17]) * costab[0]; + b1[0x11] = b2[0x11] + b2[0x16]; + b1[0x16] = (b2[0x11] - b2[0x16]) * costab[1]; + b1[0x12] = b2[0x12] + b2[0x15]; + b1[0x15] = (b2[0x12] - b2[0x15]) * costab[2]; + b1[0x13] = b2[0x13] + b2[0x14]; + b1[0x14] = (b2[0x13] - b2[0x14]) * costab[3]; + + b1[0x18] = b2[0x18] + b2[0x1F]; + b1[0x1F] = (b2[0x1F] - b2[0x18]) * costab[0]; + b1[0x19] = b2[0x19] + b2[0x1E]; + b1[0x1E] = (b2[0x1E] - b2[0x19]) * costab[1]; + b1[0x1A] = b2[0x1A] + b2[0x1D]; + b1[0x1D] = (b2[0x1D] - b2[0x1A]) * costab[2]; + b1[0x1B] = b2[0x1B] + b2[0x1C]; + b1[0x1C] = (b2[0x1C] - b2[0x1B]) * costab[3]; + } + + { + register real const cos0 = pnts[3][0]; + register real const cos1 = pnts[3][1]; + + b2[0x00] = b1[0x00] + b1[0x03]; + b2[0x03] = (b1[0x00] - b1[0x03]) * cos0; + b2[0x01] = b1[0x01] + b1[0x02]; + b2[0x02] = (b1[0x01] - b1[0x02]) * cos1; + + b2[0x04] = b1[0x04] + b1[0x07]; + b2[0x07] = (b1[0x07] - b1[0x04]) * cos0; + b2[0x05] = b1[0x05] + b1[0x06]; + b2[0x06] = (b1[0x06] - b1[0x05]) * cos1; + + b2[0x08] = b1[0x08] + b1[0x0B]; + b2[0x0B] = (b1[0x08] - b1[0x0B]) * cos0; + b2[0x09] = b1[0x09] + b1[0x0A]; + b2[0x0A] = (b1[0x09] - b1[0x0A]) * cos1; + + b2[0x0C] = b1[0x0C] + b1[0x0F]; + b2[0x0F] = (b1[0x0F] - b1[0x0C]) * cos0; + b2[0x0D] = b1[0x0D] + b1[0x0E]; + b2[0x0E] = (b1[0x0E] - b1[0x0D]) * cos1; + + b2[0x10] = b1[0x10] + b1[0x13]; + b2[0x13] = (b1[0x10] - b1[0x13]) * cos0; + b2[0x11] = b1[0x11] + b1[0x12]; + b2[0x12] = (b1[0x11] - b1[0x12]) * cos1; + + b2[0x14] = b1[0x14] + b1[0x17]; + b2[0x17] = (b1[0x17] - b1[0x14]) * cos0; + b2[0x15] = b1[0x15] + b1[0x16]; + b2[0x16] = (b1[0x16] - b1[0x15]) * cos1; + + b2[0x18] = b1[0x18] + b1[0x1B]; + b2[0x1B] = (b1[0x18] - b1[0x1B]) * cos0; + b2[0x19] = b1[0x19] + b1[0x1A]; + b2[0x1A] = (b1[0x19] - b1[0x1A]) * cos1; + + b2[0x1C] = b1[0x1C] + b1[0x1F]; + b2[0x1F] = (b1[0x1F] - b1[0x1C]) * cos0; + b2[0x1D] = b1[0x1D] + b1[0x1E]; + b2[0x1E] = (b1[0x1E] - b1[0x1D]) * cos1; + } + + { + register real const cos0 = pnts[4][0]; + + b1[0x00] = b2[0x00] + b2[0x01]; + b1[0x01] = (b2[0x00] - b2[0x01]) * cos0; + b1[0x02] = b2[0x02] + b2[0x03]; + b1[0x03] = (b2[0x03] - b2[0x02]) * cos0; + b1[0x02] += b1[0x03]; + + b1[0x04] = b2[0x04] + b2[0x05]; + b1[0x05] = (b2[0x04] - b2[0x05]) * cos0; + b1[0x06] = b2[0x06] + b2[0x07]; + b1[0x07] = (b2[0x07] - b2[0x06]) * cos0; + b1[0x06] += b1[0x07]; + b1[0x04] += b1[0x06]; + b1[0x06] += b1[0x05]; + b1[0x05] += b1[0x07]; + + b1[0x08] = b2[0x08] + b2[0x09]; + b1[0x09] = (b2[0x08] - b2[0x09]) * cos0; + b1[0x0A] = b2[0x0A] + b2[0x0B]; + b1[0x0B] = (b2[0x0B] - b2[0x0A]) * cos0; + b1[0x0A] += b1[0x0B]; + + b1[0x0C] = b2[0x0C] + b2[0x0D]; + b1[0x0D] = (b2[0x0C] - b2[0x0D]) * cos0; + b1[0x0E] = b2[0x0E] + b2[0x0F]; + b1[0x0F] = (b2[0x0F] - b2[0x0E]) * cos0; + b1[0x0E] += b1[0x0F]; + b1[0x0C] += b1[0x0E]; + b1[0x0E] += b1[0x0D]; + b1[0x0D] += b1[0x0F]; + + b1[0x10] = b2[0x10] + b2[0x11]; + b1[0x11] = (b2[0x10] - b2[0x11]) * cos0; + b1[0x12] = b2[0x12] + b2[0x13]; + b1[0x13] = (b2[0x13] - b2[0x12]) * cos0; + b1[0x12] += b1[0x13]; + + b1[0x14] = b2[0x14] + b2[0x15]; + b1[0x15] = (b2[0x14] - b2[0x15]) * cos0; + b1[0x16] = b2[0x16] + b2[0x17]; + b1[0x17] = (b2[0x17] - b2[0x16]) * cos0; + b1[0x16] += b1[0x17]; + b1[0x14] += b1[0x16]; + b1[0x16] += b1[0x15]; + b1[0x15] += b1[0x17]; + + b1[0x18] = b2[0x18] + b2[0x19]; + b1[0x19] = (b2[0x18] - b2[0x19]) * cos0; + b1[0x1A] = b2[0x1A] + b2[0x1B]; + b1[0x1B] = (b2[0x1B] - b2[0x1A]) * cos0; + b1[0x1A] += b1[0x1B]; + + b1[0x1C] = b2[0x1C] + b2[0x1D]; + b1[0x1D] = (b2[0x1C] - b2[0x1D]) * cos0; + b1[0x1E] = b2[0x1E] + b2[0x1F]; + b1[0x1F] = (b2[0x1F] - b2[0x1E]) * cos0; + b1[0x1E] += b1[0x1F]; + b1[0x1C] += b1[0x1E]; + b1[0x1E] += b1[0x1D]; + b1[0x1D] += b1[0x1F]; + } + + out0[0x10*16] = b1[0x00]; + out0[0x10*12] = b1[0x04]; + out0[0x10* 8] = b1[0x02]; + out0[0x10* 4] = b1[0x06]; + out0[0x10* 0] = b1[0x01]; + out1[0x10* 0] = b1[0x01]; + out1[0x10* 4] = b1[0x05]; + out1[0x10* 8] = b1[0x03]; + out1[0x10*12] = b1[0x07]; + + b1[0x08] += b1[0x0C]; + out0[0x10*14] = b1[0x08]; + b1[0x0C] += b1[0x0a]; + out0[0x10*10] = b1[0x0C]; + b1[0x0A] += b1[0x0E]; + out0[0x10* 6] = b1[0x0A]; + b1[0x0E] += b1[0x09]; + out0[0x10* 2] = b1[0x0E]; + b1[0x09] += b1[0x0D]; + out1[0x10* 2] = b1[0x09]; + b1[0x0D] += b1[0x0B]; + out1[0x10* 6] = b1[0x0D]; + b1[0x0B] += b1[0x0F]; + out1[0x10*10] = b1[0x0B]; + out1[0x10*14] = b1[0x0F]; + + b1[0x18] += b1[0x1C]; + out0[0x10*15] = b1[0x10] + b1[0x18]; + out0[0x10*13] = b1[0x18] + b1[0x14]; + b1[0x1C] += b1[0x1a]; + out0[0x10*11] = b1[0x14] + b1[0x1C]; + out0[0x10* 9] = b1[0x1C] + b1[0x12]; + b1[0x1A] += b1[0x1E]; + out0[0x10* 7] = b1[0x12] + b1[0x1A]; + out0[0x10* 5] = b1[0x1A] + b1[0x16]; + b1[0x1E] += b1[0x19]; + out0[0x10* 3] = b1[0x16] + b1[0x1E]; + out0[0x10* 1] = b1[0x1E] + b1[0x11]; + b1[0x19] += b1[0x1D]; + out1[0x10* 1] = b1[0x11] + b1[0x19]; + out1[0x10* 3] = b1[0x19] + b1[0x15]; + b1[0x1D] += b1[0x1B]; + out1[0x10* 5] = b1[0x15] + b1[0x1D]; + out1[0x10* 7] = b1[0x1D] + b1[0x13]; + b1[0x1B] += b1[0x1F]; + out1[0x10* 9] = b1[0x13] + b1[0x1B]; + out1[0x10*11] = b1[0x1B] + b1[0x17]; + out1[0x10*13] = b1[0x17] + b1[0x1F]; + out1[0x10*15] = b1[0x1F]; +} + +/* + * the call via dct64 is a trick to force GCC to use + * (new) registers for the b1,b2 pointer to the bufs[xx] field + */ +void dct64( real *a,real *b,real *c) +{ + real bufs[0x40]; + dct64_1(a,b,bufs,bufs+0x20,c); +} + diff --git a/Libraries/DecMPA/Files/src/hip/dct64_i386.h b/Libraries/DecMPA/Files/src/hip/dct64_i386.h new file mode 100644 index 000000000..34dd18bbc --- /dev/null +++ b/Libraries/DecMPA/Files/src/hip/dct64_i386.h @@ -0,0 +1,36 @@ +/* DecMPA decoding routines from Lame/HIP (Myers W. Carpenter) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + For more information look at the file License.txt in this package. + + + email: hazard_hd@users.sourceforge.net +*/ + +/* +** Copyright (C) 2000 Albert L. Faber +**/ + + +#ifndef MPGLIB_DCT64_I386_H_INCLUDED +#define MPGLIB_DCT64_I386_H_INCLUDED + +#include "common.h" + +void dct64( real *a,real *b,real *c); + + +#endif diff --git a/Libraries/DecMPA/Files/src/hip/decode_i386.c b/Libraries/DecMPA/Files/src/hip/decode_i386.c new file mode 100644 index 000000000..d9b661541 --- /dev/null +++ b/Libraries/DecMPA/Files/src/hip/decode_i386.c @@ -0,0 +1,202 @@ +/* DecMPA decoding routines from Lame/HIP (Myers W. Carpenter) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + For more information look at the file License.txt in this package. + + + email: hazard_hd@users.sourceforge.net +*/ + + +/* + * Mpeg Layer-1,2,3 audio decoder + * ------------------------------ + * copyright (c) 1995,1996,1997 by Michael Hipp, All rights reserved. + * See also 'README' + * + * slighlty optimized for machines without autoincrement/decrement. + * The performance is highly compiler dependend. Maybe + * the decode.c version for 'normal' processor may be faster + * even for Intel processors. + */ + +/* $Id$ */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +//#ifdef STDC_HEADERS +# include +# include +//#else +/*# ifndef HAVE_STRCHR +# define strchr index +# define strrchr rindex +# endif +char *strchr (), *strrchr (); +/*# ifndef HAVE_MEMCPY +# define memcpy(d, s, n) bcopy ((s), (d), (n)) +# define memmove(d, s, n) bcopy ((s), (d), (n)) +# endif +#endif*/ + +#if defined(__riscos__) && defined(FPA10) +#include "ymath.h" +#else +#include +#endif + +#include "decode_i386.h" +#include "dct64_i386.h" +#include "tabinit.h" + +#ifdef WITH_DMALLOC +#include +#endif + + + /* old WRITE_SAMPLE */ +#define WRITE_SAMPLE(samples,sum,clip) \ + if( (sum) > 32767.0) { *(samples) = 0x7fff; (clip)++; } \ + else if( (sum) < -32768.0) { *(samples) = -0x8000; (clip)++; } \ + else { *(samples) = (short)( ((sum)>0 ? (sum)+0.5 : (sum)-0.5) ); } + +int synth_1to1_mono(PMPSTR mp, real *bandPtr,unsigned char *samples,int *pnt) +{ + short samples_tmp[64]; + short *tmp1 = samples_tmp; + int i,ret; + int pnt1 = 0; + + ret = synth_1to1(mp,bandPtr,0,(unsigned char *) samples_tmp,&pnt1); + samples += *pnt; + + for(i=0;i<32;i++) { + *( (short *) samples) = *tmp1; + samples += 2; + tmp1 += 2; + } + *pnt += 64; + + return ret; +} + +int synth_1to1(PMPSTR mp, real *bandPtr,int channel,unsigned char *out,int *pnt) +{ + static const int step = 2; + int bo; + short *samples = (short *) (out + *pnt); + + real *b0,(*buf)[0x110]; + int clip = 0; + int bo1; + + bo = mp->synth_bo; + + if(!channel) { + bo--; + bo &= 0xf; + buf = mp->synth_buffs[0]; + } + else { + samples++; + buf = mp->synth_buffs[1]; + } + + if(bo & 0x1) { + b0 = buf[0]; + bo1 = bo; + dct64(buf[1]+((bo+1)&0xf),buf[0]+bo,bandPtr); + } + else { + b0 = buf[1]; + bo1 = bo+1; + dct64(buf[0]+bo,buf[1]+bo+1,bandPtr); + } + + mp->synth_bo = bo; + + { + register int j; + real *window = decwin + 16 - bo1; + + for (j=16;j;j--,b0+=0x10,window+=0x20,samples+=step) + { + real sum; + sum = window[0x0] * b0[0x0]; + sum -= window[0x1] * b0[0x1]; + sum += window[0x2] * b0[0x2]; + sum -= window[0x3] * b0[0x3]; + sum += window[0x4] * b0[0x4]; + sum -= window[0x5] * b0[0x5]; + sum += window[0x6] * b0[0x6]; + sum -= window[0x7] * b0[0x7]; + sum += window[0x8] * b0[0x8]; + sum -= window[0x9] * b0[0x9]; + sum += window[0xA] * b0[0xA]; + sum -= window[0xB] * b0[0xB]; + sum += window[0xC] * b0[0xC]; + sum -= window[0xD] * b0[0xD]; + sum += window[0xE] * b0[0xE]; + sum -= window[0xF] * b0[0xF]; + + WRITE_SAMPLE(samples,sum,clip); + } + + { + real sum; + sum = window[0x0] * b0[0x0]; + sum += window[0x2] * b0[0x2]; + sum += window[0x4] * b0[0x4]; + sum += window[0x6] * b0[0x6]; + sum += window[0x8] * b0[0x8]; + sum += window[0xA] * b0[0xA]; + sum += window[0xC] * b0[0xC]; + sum += window[0xE] * b0[0xE]; + WRITE_SAMPLE(samples,sum,clip); + b0-=0x10,window-=0x20,samples+=step; + } + window += bo1<<1; + + for (j=15;j;j--,b0-=0x10,window-=0x20,samples+=step) + { + real sum; + sum = -window[-0x1] * b0[0x0]; + sum -= window[-0x2] * b0[0x1]; + sum -= window[-0x3] * b0[0x2]; + sum -= window[-0x4] * b0[0x3]; + sum -= window[-0x5] * b0[0x4]; + sum -= window[-0x6] * b0[0x5]; + sum -= window[-0x7] * b0[0x6]; + sum -= window[-0x8] * b0[0x7]; + sum -= window[-0x9] * b0[0x8]; + sum -= window[-0xA] * b0[0x9]; + sum -= window[-0xB] * b0[0xA]; + sum -= window[-0xC] * b0[0xB]; + sum -= window[-0xD] * b0[0xC]; + sum -= window[-0xE] * b0[0xD]; + sum -= window[-0xF] * b0[0xE]; + sum -= window[-0x0] * b0[0xF]; + + WRITE_SAMPLE(samples,sum,clip); + } + } + *pnt += 128; + + return clip; +} + diff --git a/Libraries/DecMPA/Files/src/hip/decode_i386.h b/Libraries/DecMPA/Files/src/hip/decode_i386.h new file mode 100644 index 000000000..2442b134d --- /dev/null +++ b/Libraries/DecMPA/Files/src/hip/decode_i386.h @@ -0,0 +1,36 @@ +/* DecMPA decoding routines from Lame/HIP (Myers W. Carpenter) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + For more information look at the file License.txt in this package. + + + email: hazard_hd@users.sourceforge.net +*/ + +/* +** Copyright (C) 2000 Albert L. Faber +**/ + + +#ifndef DECODE_I386_H_INCLUDED +#define DECODE_I386_H_INCLUDED + +#include "common.h" + +int synth_1to1_mono(PMPSTR mp, real *bandPtr,unsigned char *samples,int *pnt); +int synth_1to1(PMPSTR mp, real *bandPtr,int channel,unsigned char *out,int *pnt); + +#endif diff --git a/Libraries/DecMPA/Files/src/hip/huffman.h b/Libraries/DecMPA/Files/src/hip/huffman.h new file mode 100644 index 000000000..543f208ae --- /dev/null +++ b/Libraries/DecMPA/Files/src/hip/huffman.h @@ -0,0 +1,354 @@ +/* DecMPA decoding routines from Lame/HIP (Myers W. Carpenter) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + For more information look at the file License.txt in this package. + + + email: hazard_hd@users.sourceforge.net +*/ + +/* + * huffman tables ... recalcualted to work with my optimzed + * decoder scheme (MH) + * + * probably we could save a few bytes of memory, because the + * smaller tables are often the part of a bigger table + */ + +struct newhuff +{ + const unsigned int linbits; + const short * const table; +}; + +static const short tab0[] = +{ + 0 +}; + +static const short tab1[] = +{ + -5, -3, -1, 17, 1, 16, 0 +}; + +static const short tab2[] = +{ + -15, -11, -9, -5, -3, -1, 34, 2, 18, -1, 33, 32, 17, -1, 1, + 16, 0 +}; + +static const short tab3[] = +{ + -13, -11, -9, -5, -3, -1, 34, 2, 18, -1, 33, 32, 16, 17, -1, + 1, 0 +}; + +static const short tab5[] = +{ + -29, -25, -23, -15, -7, -5, -3, -1, 51, 35, 50, 49, -3, -1, 19, + 3, -1, 48, 34, -3, -1, 18, 33, -1, 2, 32, 17, -1, 1, 16, + 0 +}; + +static const short tab6[] = +{ + -25, -19, -13, -9, -5, -3, -1, 51, 3, 35, -1, 50, 48, -1, 19, + 49, -3, -1, 34, 2, 18, -3, -1, 33, 32, 1, -1, 17, -1, 16, + 0 +}; + +static const short tab7[] = +{ + -69, -65, -57, -39, -29, -17, -11, -7, -3, -1, 85, 69, -1, 84, 83, + -1, 53, 68, -3, -1, 37, 82, 21, -5, -1, 81, -1, 5, 52, -1, + 80, -1, 67, 51, -5, -3, -1, 36, 66, 20, -1, 65, 64, -11, -7, + -3, -1, 4, 35, -1, 50, 3, -1, 19, 49, -3, -1, 48, 34, 18, + -5, -1, 33, -1, 2, 32, 17, -1, 1, 16, 0 +}; + +static const short tab8[] = +{ + -65, -63, -59, -45, -31, -19, -13, -7, -5, -3, -1, 85, 84, 69, 83, + -3, -1, 53, 68, 37, -3, -1, 82, 5, 21, -5, -1, 81, -1, 52, + 67, -3, -1, 80, 51, 36, -5, -3, -1, 66, 20, 65, -3, -1, 4, + 64, -1, 35, 50, -9, -7, -3, -1, 19, 49, -1, 3, 48, 34, -1, + 2, 32, -1, 18, 33, 17, -3, -1, 1, 16, 0 +}; + +static const short tab9[] = +{ + -63, -53, -41, -29, -19, -11, -5, -3, -1, 85, 69, 53, -1, 83, -1, + 84, 5, -3, -1, 68, 37, -1, 82, 21, -3, -1, 81, 52, -1, 67, + -1, 80, 4, -7, -3, -1, 36, 66, -1, 51, 64, -1, 20, 65, -5, + -3, -1, 35, 50, 19, -1, 49, -1, 3, 48, -5, -3, -1, 34, 2, + 18, -1, 33, 32, -3, -1, 17, 1, -1, 16, 0 +}; + +static const short tab10[] = +{ +-125,-121,-111, -83, -55, -35, -21, -13, -7, -3, -1, 119, 103, -1, 118, + 87, -3, -1, 117, 102, 71, -3, -1, 116, 86, -1, 101, 55, -9, -3, + -1, 115, 70, -3, -1, 85, 84, 99, -1, 39, 114, -11, -5, -3, -1, + 100, 7, 112, -1, 98, -1, 69, 53, -5, -1, 6, -1, 83, 68, 23, + -17, -5, -1, 113, -1, 54, 38, -5, -3, -1, 37, 82, 21, -1, 81, + -1, 52, 67, -3, -1, 22, 97, -1, 96, -1, 5, 80, -19, -11, -7, + -3, -1, 36, 66, -1, 51, 4, -1, 20, 65, -3, -1, 64, 35, -1, + 50, 3, -3, -1, 19, 49, -1, 48, 34, -7, -3, -1, 18, 33, -1, + 2, 32, 17, -1, 1, 16, 0 +}; + +static const short tab11[] = +{ +-121,-113, -89, -59, -43, -27, -17, -7, -3, -1, 119, 103, -1, 118, 117, + -3, -1, 102, 71, -1, 116, -1, 87, 85, -5, -3, -1, 86, 101, 55, + -1, 115, 70, -9, -7, -3, -1, 69, 84, -1, 53, 83, 39, -1, 114, + -1, 100, 7, -5, -1, 113, -1, 23, 112, -3, -1, 54, 99, -1, 96, + -1, 68, 37, -13, -7, -5, -3, -1, 82, 5, 21, 98, -3, -1, 38, + 6, 22, -5, -1, 97, -1, 81, 52, -5, -1, 80, -1, 67, 51, -1, + 36, 66, -15, -11, -7, -3, -1, 20, 65, -1, 4, 64, -1, 35, 50, + -1, 19, 49, -5, -3, -1, 3, 48, 34, 33, -5, -1, 18, -1, 2, + 32, 17, -3, -1, 1, 16, 0 +}; + +static const short tab12[] = +{ +-115, -99, -73, -45, -27, -17, -9, -5, -3, -1, 119, 103, 118, -1, 87, + 117, -3, -1, 102, 71, -1, 116, 101, -3, -1, 86, 55, -3, -1, 115, + 85, 39, -7, -3, -1, 114, 70, -1, 100, 23, -5, -1, 113, -1, 7, + 112, -1, 54, 99, -13, -9, -3, -1, 69, 84, -1, 68, -1, 6, 5, + -1, 38, 98, -5, -1, 97, -1, 22, 96, -3, -1, 53, 83, -1, 37, + 82, -17, -7, -3, -1, 21, 81, -1, 52, 67, -5, -3, -1, 80, 4, + 36, -1, 66, 20, -3, -1, 51, 65, -1, 35, 50, -11, -7, -5, -3, + -1, 64, 3, 48, 19, -1, 49, 34, -1, 18, 33, -7, -5, -3, -1, + 2, 32, 0, 17, -1, 1, 16 +}; + +static const short tab13[] = +{ +-509,-503,-475,-405,-333,-265,-205,-153,-115, -83, -53, -35, -21, -13, -9, + -7, -5, -3, -1, 254, 252, 253, 237, 255, -1, 239, 223, -3, -1, 238, + 207, -1, 222, 191, -9, -3, -1, 251, 206, -1, 220, -1, 175, 233, -1, + 236, 221, -9, -5, -3, -1, 250, 205, 190, -1, 235, 159, -3, -1, 249, + 234, -1, 189, 219, -17, -9, -3, -1, 143, 248, -1, 204, -1, 174, 158, + -5, -1, 142, -1, 127, 126, 247, -5, -1, 218, -1, 173, 188, -3, -1, + 203, 246, 111, -15, -7, -3, -1, 232, 95, -1, 157, 217, -3, -1, 245, + 231, -1, 172, 187, -9, -3, -1, 79, 244, -3, -1, 202, 230, 243, -1, + 63, -1, 141, 216, -21, -9, -3, -1, 47, 242, -3, -1, 110, 156, 15, + -5, -3, -1, 201, 94, 171, -3, -1, 125, 215, 78, -11, -5, -3, -1, + 200, 214, 62, -1, 185, -1, 155, 170, -1, 31, 241, -23, -13, -5, -1, + 240, -1, 186, 229, -3, -1, 228, 140, -1, 109, 227, -5, -1, 226, -1, + 46, 14, -1, 30, 225, -15, -7, -3, -1, 224, 93, -1, 213, 124, -3, + -1, 199, 77, -1, 139, 184, -7, -3, -1, 212, 154, -1, 169, 108, -1, + 198, 61, -37, -21, -9, -5, -3, -1, 211, 123, 45, -1, 210, 29, -5, + -1, 183, -1, 92, 197, -3, -1, 153, 122, 195, -7, -5, -3, -1, 167, + 151, 75, 209, -3, -1, 13, 208, -1, 138, 168, -11, -7, -3, -1, 76, + 196, -1, 107, 182, -1, 60, 44, -3, -1, 194, 91, -3, -1, 181, 137, + 28, -43, -23, -11, -5, -1, 193, -1, 152, 12, -1, 192, -1, 180, 106, + -5, -3, -1, 166, 121, 59, -1, 179, -1, 136, 90, -11, -5, -1, 43, + -1, 165, 105, -1, 164, -1, 120, 135, -5, -1, 148, -1, 119, 118, 178, + -11, -3, -1, 27, 177, -3, -1, 11, 176, -1, 150, 74, -7, -3, -1, + 58, 163, -1, 89, 149, -1, 42, 162, -47, -23, -9, -3, -1, 26, 161, + -3, -1, 10, 104, 160, -5, -3, -1, 134, 73, 147, -3, -1, 57, 88, + -1, 133, 103, -9, -3, -1, 41, 146, -3, -1, 87, 117, 56, -5, -1, + 131, -1, 102, 71, -3, -1, 116, 86, -1, 101, 115, -11, -3, -1, 25, + 145, -3, -1, 9, 144, -1, 72, 132, -7, -5, -1, 114, -1, 70, 100, + 40, -1, 130, 24, -41, -27, -11, -5, -3, -1, 55, 39, 23, -1, 113, + -1, 85, 7, -7, -3, -1, 112, 54, -1, 99, 69, -3, -1, 84, 38, + -1, 98, 53, -5, -1, 129, -1, 8, 128, -3, -1, 22, 97, -1, 6, + 96, -13, -9, -5, -3, -1, 83, 68, 37, -1, 82, 5, -1, 21, 81, + -7, -3, -1, 52, 67, -1, 80, 36, -3, -1, 66, 51, 20, -19, -11, + -5, -1, 65, -1, 4, 64, -3, -1, 35, 50, 19, -3, -1, 49, 3, + -1, 48, 34, -3, -1, 18, 33, -1, 2, 32, -3, -1, 17, 1, 16, + 0 +}; + +static const short tab15[] = +{ +-495,-445,-355,-263,-183,-115, -77, -43, -27, -13, -7, -3, -1, 255, 239, + -1, 254, 223, -1, 238, -1, 253, 207, -7, -3, -1, 252, 222, -1, 237, + 191, -1, 251, -1, 206, 236, -7, -3, -1, 221, 175, -1, 250, 190, -3, + -1, 235, 205, -1, 220, 159, -15, -7, -3, -1, 249, 234, -1, 189, 219, + -3, -1, 143, 248, -1, 204, 158, -7, -3, -1, 233, 127, -1, 247, 173, + -3, -1, 218, 188, -1, 111, -1, 174, 15, -19, -11, -3, -1, 203, 246, + -3, -1, 142, 232, -1, 95, 157, -3, -1, 245, 126, -1, 231, 172, -9, + -3, -1, 202, 187, -3, -1, 217, 141, 79, -3, -1, 244, 63, -1, 243, + 216, -33, -17, -9, -3, -1, 230, 47, -1, 242, -1, 110, 240, -3, -1, + 31, 241, -1, 156, 201, -7, -3, -1, 94, 171, -1, 186, 229, -3, -1, + 125, 215, -1, 78, 228, -15, -7, -3, -1, 140, 200, -1, 62, 109, -3, + -1, 214, 227, -1, 155, 185, -7, -3, -1, 46, 170, -1, 226, 30, -5, + -1, 225, -1, 14, 224, -1, 93, 213, -45, -25, -13, -7, -3, -1, 124, + 199, -1, 77, 139, -1, 212, -1, 184, 154, -7, -3, -1, 169, 108, -1, + 198, 61, -1, 211, 210, -9, -5, -3, -1, 45, 13, 29, -1, 123, 183, + -5, -1, 209, -1, 92, 208, -1, 197, 138, -17, -7, -3, -1, 168, 76, + -1, 196, 107, -5, -1, 182, -1, 153, 12, -1, 60, 195, -9, -3, -1, + 122, 167, -1, 166, -1, 192, 11, -1, 194, -1, 44, 91, -55, -29, -15, + -7, -3, -1, 181, 28, -1, 137, 152, -3, -1, 193, 75, -1, 180, 106, + -5, -3, -1, 59, 121, 179, -3, -1, 151, 136, -1, 43, 90, -11, -5, + -1, 178, -1, 165, 27, -1, 177, -1, 176, 105, -7, -3, -1, 150, 74, + -1, 164, 120, -3, -1, 135, 58, 163, -17, -7, -3, -1, 89, 149, -1, + 42, 162, -3, -1, 26, 161, -3, -1, 10, 160, 104, -7, -3, -1, 134, + 73, -1, 148, 57, -5, -1, 147, -1, 119, 9, -1, 88, 133, -53, -29, + -13, -7, -3, -1, 41, 103, -1, 118, 146, -1, 145, -1, 25, 144, -7, + -3, -1, 72, 132, -1, 87, 117, -3, -1, 56, 131, -1, 102, 71, -7, + -3, -1, 40, 130, -1, 24, 129, -7, -3, -1, 116, 8, -1, 128, 86, + -3, -1, 101, 55, -1, 115, 70, -17, -7, -3, -1, 39, 114, -1, 100, + 23, -3, -1, 85, 113, -3, -1, 7, 112, 54, -7, -3, -1, 99, 69, + -1, 84, 38, -3, -1, 98, 22, -3, -1, 6, 96, 53, -33, -19, -9, + -5, -1, 97, -1, 83, 68, -1, 37, 82, -3, -1, 21, 81, -3, -1, + 5, 80, 52, -7, -3, -1, 67, 36, -1, 66, 51, -1, 65, -1, 20, + 4, -9, -3, -1, 35, 50, -3, -1, 64, 3, 19, -3, -1, 49, 48, + 34, -9, -7, -3, -1, 18, 33, -1, 2, 32, 17, -3, -1, 1, 16, + 0 +}; + +static const short tab16[] = +{ +-509,-503,-461,-323,-103, -37, -27, -15, -7, -3, -1, 239, 254, -1, 223, + 253, -3, -1, 207, 252, -1, 191, 251, -5, -1, 175, -1, 250, 159, -3, + -1, 249, 248, 143, -7, -3, -1, 127, 247, -1, 111, 246, 255, -9, -5, + -3, -1, 95, 245, 79, -1, 244, 243, -53, -1, 240, -1, 63, -29, -19, + -13, -7, -5, -1, 206, -1, 236, 221, 222, -1, 233, -1, 234, 217, -1, + 238, -1, 237, 235, -3, -1, 190, 205, -3, -1, 220, 219, 174, -11, -5, + -1, 204, -1, 173, 218, -3, -1, 126, 172, 202, -5, -3, -1, 201, 125, + 94, 189, 242, -93, -5, -3, -1, 47, 15, 31, -1, 241, -49, -25, -13, + -5, -1, 158, -1, 188, 203, -3, -1, 142, 232, -1, 157, 231, -7, -3, + -1, 187, 141, -1, 216, 110, -1, 230, 156, -13, -7, -3, -1, 171, 186, + -1, 229, 215, -1, 78, -1, 228, 140, -3, -1, 200, 62, -1, 109, -1, + 214, 155, -19, -11, -5, -3, -1, 185, 170, 225, -1, 212, -1, 184, 169, + -5, -1, 123, -1, 183, 208, 227, -7, -3, -1, 14, 224, -1, 93, 213, + -3, -1, 124, 199, -1, 77, 139, -75, -45, -27, -13, -7, -3, -1, 154, + 108, -1, 198, 61, -3, -1, 92, 197, 13, -7, -3, -1, 138, 168, -1, + 153, 76, -3, -1, 182, 122, 60, -11, -5, -3, -1, 91, 137, 28, -1, + 192, -1, 152, 121, -1, 226, -1, 46, 30, -15, -7, -3, -1, 211, 45, + -1, 210, 209, -5, -1, 59, -1, 151, 136, 29, -7, -3, -1, 196, 107, + -1, 195, 167, -1, 44, -1, 194, 181, -23, -13, -7, -3, -1, 193, 12, + -1, 75, 180, -3, -1, 106, 166, 179, -5, -3, -1, 90, 165, 43, -1, + 178, 27, -13, -5, -1, 177, -1, 11, 176, -3, -1, 105, 150, -1, 74, + 164, -5, -3, -1, 120, 135, 163, -3, -1, 58, 89, 42, -97, -57, -33, + -19, -11, -5, -3, -1, 149, 104, 161, -3, -1, 134, 119, 148, -5, -3, + -1, 73, 87, 103, 162, -5, -1, 26, -1, 10, 160, -3, -1, 57, 147, + -1, 88, 133, -9, -3, -1, 41, 146, -3, -1, 118, 9, 25, -5, -1, + 145, -1, 144, 72, -3, -1, 132, 117, -1, 56, 131, -21, -11, -5, -3, + -1, 102, 40, 130, -3, -1, 71, 116, 24, -3, -1, 129, 128, -3, -1, + 8, 86, 55, -9, -5, -1, 115, -1, 101, 70, -1, 39, 114, -5, -3, + -1, 100, 85, 7, 23, -23, -13, -5, -1, 113, -1, 112, 54, -3, -1, + 99, 69, -1, 84, 38, -3, -1, 98, 22, -1, 97, -1, 6, 96, -9, + -5, -1, 83, -1, 53, 68, -1, 37, 82, -1, 81, -1, 21, 5, -33, + -23, -13, -7, -3, -1, 52, 67, -1, 80, 36, -3, -1, 66, 51, 20, + -5, -1, 65, -1, 4, 64, -1, 35, 50, -3, -1, 19, 49, -3, -1, + 3, 48, 34, -3, -1, 18, 33, -1, 2, 32, -3, -1, 17, 1, 16, + 0 +}; + +static const short tab24[] = +{ +-451,-117, -43, -25, -15, -7, -3, -1, 239, 254, -1, 223, 253, -3, -1, + 207, 252, -1, 191, 251, -5, -1, 250, -1, 175, 159, -1, 249, 248, -9, + -5, -3, -1, 143, 127, 247, -1, 111, 246, -3, -1, 95, 245, -1, 79, + 244, -71, -7, -3, -1, 63, 243, -1, 47, 242, -5, -1, 241, -1, 31, + 240, -25, -9, -1, 15, -3, -1, 238, 222, -1, 237, 206, -7, -3, -1, + 236, 221, -1, 190, 235, -3, -1, 205, 220, -1, 174, 234, -15, -7, -3, + -1, 189, 219, -1, 204, 158, -3, -1, 233, 173, -1, 218, 188, -7, -3, + -1, 203, 142, -1, 232, 157, -3, -1, 217, 126, -1, 231, 172, 255,-235, +-143, -77, -45, -25, -15, -7, -3, -1, 202, 187, -1, 141, 216, -5, -3, + -1, 14, 224, 13, 230, -5, -3, -1, 110, 156, 201, -1, 94, 186, -9, + -5, -1, 229, -1, 171, 125, -1, 215, 228, -3, -1, 140, 200, -3, -1, + 78, 46, 62, -15, -7, -3, -1, 109, 214, -1, 227, 155, -3, -1, 185, + 170, -1, 226, 30, -7, -3, -1, 225, 93, -1, 213, 124, -3, -1, 199, + 77, -1, 139, 184, -31, -15, -7, -3, -1, 212, 154, -1, 169, 108, -3, + -1, 198, 61, -1, 211, 45, -7, -3, -1, 210, 29, -1, 123, 183, -3, + -1, 209, 92, -1, 197, 138, -17, -7, -3, -1, 168, 153, -1, 76, 196, + -3, -1, 107, 182, -3, -1, 208, 12, 60, -7, -3, -1, 195, 122, -1, + 167, 44, -3, -1, 194, 91, -1, 181, 28, -57, -35, -19, -7, -3, -1, + 137, 152, -1, 193, 75, -5, -3, -1, 192, 11, 59, -3, -1, 176, 10, + 26, -5, -1, 180, -1, 106, 166, -3, -1, 121, 151, -3, -1, 160, 9, + 144, -9, -3, -1, 179, 136, -3, -1, 43, 90, 178, -7, -3, -1, 165, + 27, -1, 177, 105, -1, 150, 164, -17, -9, -5, -3, -1, 74, 120, 135, + -1, 58, 163, -3, -1, 89, 149, -1, 42, 162, -7, -3, -1, 161, 104, + -1, 134, 119, -3, -1, 73, 148, -1, 57, 147, -63, -31, -15, -7, -3, + -1, 88, 133, -1, 41, 103, -3, -1, 118, 146, -1, 25, 145, -7, -3, + -1, 72, 132, -1, 87, 117, -3, -1, 56, 131, -1, 102, 40, -17, -7, + -3, -1, 130, 24, -1, 71, 116, -5, -1, 129, -1, 8, 128, -1, 86, + 101, -7, -5, -1, 23, -1, 7, 112, 115, -3, -1, 55, 39, 114, -15, + -7, -3, -1, 70, 100, -1, 85, 113, -3, -1, 54, 99, -1, 69, 84, + -7, -3, -1, 38, 98, -1, 22, 97, -5, -3, -1, 6, 96, 53, -1, + 83, 68, -51, -37, -23, -15, -9, -3, -1, 37, 82, -1, 21, -1, 5, + 80, -1, 81, -1, 52, 67, -3, -1, 36, 66, -1, 51, 20, -9, -5, + -1, 65, -1, 4, 64, -1, 35, 50, -1, 19, 49, -7, -5, -3, -1, + 3, 48, 34, 18, -1, 33, -1, 2, 32, -3, -1, 17, 1, -1, 16, + 0 +}; + +static const short tab_c0[] = +{ + -29, -21, -13, -7, -3, -1, 11, 15, -1, 13, 14, -3, -1, 7, 5, + 9, -3, -1, 6, 3, -1, 10, 12, -3, -1, 2, 1, -1, 4, 8, + 0 +}; + +static const short tab_c1[] = +{ + -15, -7, -3, -1, 15, 14, -1, 13, 12, -3, -1, 11, 10, -1, 9, + 8, -7, -3, -1, 7, 6, -1, 5, 4, -3, -1, 3, 2, -1, 1, + 0 +}; + + + +static const struct newhuff ht[] = +{ + { /* 0 */ 0 , tab0 } , + { /* 2 */ 0 , tab1 } , + { /* 3 */ 0 , tab2 } , + { /* 3 */ 0 , tab3 } , + { /* 0 */ 0 , tab0 } , + { /* 4 */ 0 , tab5 } , + { /* 4 */ 0 , tab6 } , + { /* 6 */ 0 , tab7 } , + { /* 6 */ 0 , tab8 } , + { /* 6 */ 0 , tab9 } , + { /* 8 */ 0 , tab10 } , + { /* 8 */ 0 , tab11 } , + { /* 8 */ 0 , tab12 } , + { /* 16 */ 0 , tab13 } , + { /* 0 */ 0 , tab0 } , + { /* 16 */ 0 , tab15 } , + + { /* 16 */ 1 , tab16 } , + { /* 16 */ 2 , tab16 } , + { /* 16 */ 3 , tab16 } , + { /* 16 */ 4 , tab16 } , + { /* 16 */ 6 , tab16 } , + { /* 16 */ 8 , tab16 } , + { /* 16 */ 10, tab16 } , + { /* 16 */ 13, tab16 } , + { /* 16 */ 4 , tab24 } , + { /* 16 */ 5 , tab24 } , + { /* 16 */ 6 , tab24 } , + { /* 16 */ 7 , tab24 } , + { /* 16 */ 8 , tab24 } , + { /* 16 */ 9 , tab24 } , + { /* 16 */ 11, tab24 } , + { /* 16 */ 13, tab24 } +}; + +static const struct newhuff htc[] = +{ + { /* 1 , 1 , */ 0 , tab_c0 } , + { /* 1 , 1 , */ 0 , tab_c1 } +}; + + diff --git a/Libraries/DecMPA/Files/src/hip/interface.c b/Libraries/DecMPA/Files/src/hip/interface.c new file mode 100644 index 000000000..0d6104d73 --- /dev/null +++ b/Libraries/DecMPA/Files/src/hip/interface.c @@ -0,0 +1,666 @@ +/* DecMPA decoding routines from Lame/HIP (Myers W. Carpenter) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + For more information look at the file License.txt in this package. + + + email: hazard_hd@users.sourceforge.net +*/ + +//changes: 8/20/2002, Hauke Duden +// - fixed potential access violation in check_vbr_header and sync_buffer + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include + +#include "common.h" +#include "interface.h" +#include "tabinit.h" +#include "layer3.h" +#include "VbrTag.h" + +#ifdef USE_LAYER_1 + #include "layer1.h" +#endif + +#ifdef USE_LAYER_2 + #include "layer2.h" +#endif + +#ifdef WITH_DMALLOC +#include +#endif + + +BOOL InitMP3( PMPSTR mp) +{ + memset(mp,0,sizeof(MPSTR)); + + mp->framesize = 0; + mp->num_frames = 0; + mp->enc_delay = -1; + mp->enc_padding = -1; + mp->vbr_header=0; + mp->header_parsed=0; + mp->side_parsed=0; + mp->data_parsed=0; + mp->free_format=0; + mp->old_free_format=0; + mp->ssize = 0; + mp->dsize=0; + mp->fsizeold = -1; + mp->bsize = 0; + mp->head = mp->tail = NULL; + mp->fr.single = -1; + mp->bsnum = 0; + wordpointer = mp->bsspace[mp->bsnum] + 512; + mp->synth_bo = 1; + mp->sync_bitstream = 1; + + make_decode_tables(32767); + + init_layer3(SBLIMIT); + +#ifdef USE_LAYER_2 + init_layer2(); +#endif + + return !0; +} + +void ExitMP3( PMPSTR mp) +{ + struct buf *b,*bn; + + b = mp->tail; + while(b) { + free(b->pnt); + bn = b->next; + free(b); + b = bn; + } +} + +static struct buf *addbuf( PMPSTR mp, unsigned char *buf,int size) +{ + struct buf *nbuf; + + nbuf = (struct buf*) malloc( sizeof(struct buf) ); + if(!nbuf) { + //fprintf(stderr,"Out of memory!\n"); + return NULL; + } + nbuf->pnt = (unsigned char*) malloc((size_t)size); + if(!nbuf->pnt) { + free(nbuf); + return NULL; + } + nbuf->size = size; + memcpy(nbuf->pnt,buf,(size_t)size); + nbuf->next = NULL; + nbuf->prev = mp->head; + nbuf->pos = 0; + + if(!mp->tail) { + mp->tail = nbuf; + } + else { + mp->head->next = nbuf; + } + + mp->head = nbuf; + mp->bsize += size; + + return nbuf; +} + +void remove_buf(PMPSTR mp) +{ + struct buf *buf = mp->tail; + + mp->tail = buf->next; + if(mp->tail) + mp->tail->prev = NULL; + else { + mp->tail = mp->head = NULL; + } + + free(buf->pnt); + free(buf); + +} + +static int read_buf_byte(PMPSTR mp) +{ + unsigned int b; + + int pos; + + + pos = mp->tail->pos; + while(pos >= mp->tail->size) { + remove_buf(mp); + //if(!mp->tail) { + //fprintf(stderr,"Fatal error! tried to read past mp buffer\n"); + //exit(1); + //} + pos = mp->tail->pos; + } + + b = mp->tail->pnt[pos]; + mp->bsize--; + mp->tail->pos++; + + + return b; +} + + + +static void read_head(PMPSTR mp) +{ + unsigned long head; + + head = read_buf_byte(mp); + head <<= 8; + head |= read_buf_byte(mp); + head <<= 8; + head |= read_buf_byte(mp); + head <<= 8; + head |= read_buf_byte(mp); + + mp->header = head; +} + + + + + + +void copy_mp(PMPSTR mp,int size,unsigned char *ptr) +{ + int len = 0; + + while(len < size) { + int nlen; + int blen = mp->tail->size - mp->tail->pos; + if( (size - len) <= blen) { + nlen = size-len; + } + else { + nlen = blen; + } + memcpy(ptr+len,mp->tail->pnt+mp->tail->pos,(size_t)nlen); + len += nlen; + mp->tail->pos += nlen; + mp->bsize -= nlen; + if(mp->tail->pos == mp->tail->size) { + remove_buf(mp); + } + } +} + +// number of bytes needed by GetVbrTag to parse header +#define XING_HEADER_SIZE 194 + +// traverse mp data structure without changing it +// (just like sync_buffer) +// pull out Xing bytes +// call vbr header check code from LAME +// if we find a header, parse it and also compute the VBR header size +// if no header, do nothing. +// +// bytes = number of bytes before MPEG header. skip this many bytes +// before starting to read +// return value: number of bytes in VBR header, including syncword +int check_vbr_header(PMPSTR mp,int bytes) +{ + int i,pos; + struct buf *buf=mp->tail; + unsigned char xing[XING_HEADER_SIZE]; + VBRTAGDATA pTagData; + + pos = buf->pos; + // skip to valid header + for (i=0; i= buf->size) { + buf = buf->next; + //fixed by Hauke Duden + //this has to be checked BEFORE accessing buf->pos + if(!buf) return -1; /* fatal error */ + pos = buf->pos; + } + ++pos; + } + // now read header + for (i=0; i= buf->size) + { + buf = buf->next; + + //fixed by Hauke Duden + //this has to be checked BEFORE accessing buf->pos + if(!buf) return -1; /* fatal error */ + + pos = buf->pos; + } + xing[i] = buf->pnt[pos]; + ++pos; + } + + /* check first bytes for Xing header */ + mp->vbr_header = GetVbrTag(&pTagData,xing); + if (mp->vbr_header) { + mp->num_frames=pTagData.frames; + mp->enc_delay=pTagData.enc_delay; + mp->enc_padding=pTagData.enc_padding; + + //fprintf(stderr,"\rmpglib: delays: %i %i \n",mp->enc_delay,mp->enc_padding); + // fprintf(stderr,"\rmpglib: Xing VBR header dectected. MP3 file has %i frames\n", pTagData.frames); + return pTagData.headersize; + } + return 0; +} + + + + + + + +int sync_buffer(PMPSTR mp,int free_match) +{ + /* traverse mp structure without modifing pointers, looking + * for a frame valid header. + * if free_format, valid header must also have the same + * samplerate. + * return number of bytes in mp, before the header + * return -1 if header is not found + */ + unsigned int b[4]={0,0,0,0}; + int i,h,pos; + struct buf *buf=mp->tail; + + pos = buf->pos; + for (i=0; ibsize; i++) + { + /* get 4 bytes */ + + b[0]=b[1]; b[1]=b[2]; b[2]=b[3]; + while(pos >= buf->size) + { + buf = buf->next; + //fixed by Hauke Duden + //this has to be checked BEFORE accessing buf->pos + if(!buf) + { + return -1; + /* not enough data to read 4 bytes */ + } + pos = buf->pos; + } + b[3] = buf->pnt[pos]; + ++pos; + + if (i>=3) + { + struct frame *fr = &mp->fr; + unsigned long head; + + head = b[0]; + head <<= 8; + head |= b[1]; + head <<= 8; + head |= b[2]; + head <<= 8; + head |= b[3]; + h = head_check(head,fr->lay); + + if (h && free_match) + { + /* just to be even more thorough, match the sample rate */ + int mode,stereo,sampling_frequency,mpeg25,lsf; + + if( head & (1<<20) ) + { + lsf = (head & (1<<19)) ? 0x0 : 0x1; + mpeg25 = 0; + } + else + { + lsf = 1; + mpeg25 = 1; + } + + mode = ((head>>6)&0x3); + stereo = (mode == MPG_MD_MONO) ? 1 : 2; + + if(mpeg25) + sampling_frequency = 6 + ((head>>10)&0x3); + else + sampling_frequency = ((head>>10)&0x3) + (lsf*3); + h = ((stereo==fr->stereo) && (lsf==fr->lsf) && (mpeg25==fr->mpeg25) && + (sampling_frequency == fr->sampling_frequency)); + } + + if (h) + return i-3; + } + } + + return -1; +} + + + + + +int decodeMP3( PMPSTR mp,unsigned char *in,int isize,char *out, + int osize,int *done) +{ + int i,iret,bits,bytes; + + if(osize < 4608) + { + //fprintf(stderr,"To less out space\n"); + return MP3_ERR; + } + + if(in!=NULL) + { + if(addbuf(mp,in,isize) == NULL) + return MP3_ERR; + } + + + /* First decode header */ + if(!mp->header_parsed) + { + if (mp->fsizeold==-1 || mp->sync_bitstream) + { + int vbrbytes; + + mp->sync_bitstream=0; + + /* This is the very first call. sync with anything */ + /* bytes= number of bytes before header */ + bytes=sync_buffer(mp,0); + + /* now look for Xing VBR header */ + if (mp->bsize >= bytes+XING_HEADER_SIZE ) + { + /* vbrbytes = number of bytes in entire vbr header */ + vbrbytes=check_vbr_header(mp,bytes); + } + else + { + /* not enough data to look for Xing header */ + + //changed for DecMPA + //since DecMPA only passes in full frames and there is + //not enough data for a xing header, there is no Xing header. + if(mp->bsize==0) + return MP3_NEED_MORE; //no data at all, need next frame + else + { + //frame too small for xing header => no xing header + mp->vbr_header=0; + vbrbytes=0; + } + //return MP3_NEED_MORE; + + } + + if (mp->vbr_header) + { + /* do we have enough data to parse entire Xing header? */ + if (bytes+vbrbytes > mp->bsize) + return MP3_NEED_MORE; + + /* read in Xing header. Buffer data in case it + * is used by a non zero main_data_begin for the next + * frame, but otherwise dont decode Xing header */ + /*fprintf(stderr,"found xing header, skipping %i bytes\n",vbrbytes+bytes);*/ + for (i=0; i0) + { + /* there were some extra bytes in front of header. + * bitstream problem, but we are now resynced + * should try to buffer previous data in case new + * frame has nonzero main_data_begin, but we need + * to make sure we do not overflow buffer + */ + int size; + + //fprintf(stderr,"bitstream problem: resyncing...\n"); + mp->old_free_format=0; + mp->sync_bitstream=1; + + /* skip some bytes, buffer the rest */ + size = (int) (wordpointer - (mp->bsspace[mp->bsnum]+512)); + + if (size > MAXFRAMESIZE) + { + /* wordpointer buffer is trashed. probably cant recover, but try anyway */ + //fprintf(stderr,"mpglib: wordpointer trashed. size=%i (%i) bytes=%i \n", + //size,MAXFRAMESIZE,bytes); + size=0; + wordpointer = mp->bsspace[mp->bsnum]+512; + } + + /* buffer contains 'size' data right now + we want to add 'bytes' worth of data, but do not + exceed MAXFRAMESIZE, so we through away 'i' bytes */ + i = (size+bytes)-MAXFRAMESIZE; + for (; i>0; --i) + { + --bytes; + read_buf_byte(mp); + } + + copy_mp(mp,bytes,wordpointer); + mp->fsizeold += bytes; + } + + read_head(mp); + decode_header(&mp->fr,mp->header); + mp->header_parsed=1; + mp->framesize = mp->fr.framesize; + mp->free_format = (mp->framesize==0); + + if(mp->fr.lsf) + mp->ssize = (mp->fr.stereo == 1) ? 9 : 17; + else + mp->ssize = (mp->fr.stereo == 1) ? 17 : 32; + if (mp->fr.error_protection) + mp->ssize += 2; + + mp->bsnum = 1-mp->bsnum; /* toggle buffer */ + wordpointer = mp->bsspace[mp->bsnum] + 512; + bitindex = 0; + + /* for very first header, never parse rest of data */ + //Hauke Duden: why? header_parsed is 1 so continuing here is the same + //as returning and then being called again with no new data (or not + //enough new data) + //=> removed + //if (mp->fsizeold==-1) + //return MP3_NEED_MORE; + + } + + /* now decode side information */ + if (!mp->side_parsed) + { + /* Layer 3 only */ + if (mp->fr.lay==3) + { + if (mp->bsize < mp->ssize) + return MP3_NEED_MORE; + + copy_mp(mp,mp->ssize,wordpointer); + + if(mp->fr.error_protection) + getbits(16); + bits=do_layer3_sideinfo(&mp->fr); + + /* bits = actual number of bits needed to parse this frame */ + /* can be negative, if all bits needed are in the reservoir */ + if (bits<0) + bits=0; + + /* read just as many bytes as necessary before decoding */ + mp->dsize = (bits+7)/8; + + /* this will force mpglib to read entire frame before decoding */ + /* mp->dsize= mp->framesize - mp->ssize;*/ + } + else + { + /* Layers 1 and 2 */ + + /* check if there is enough input data */ + if(mp->fr.framesize > mp->bsize) + return MP3_NEED_MORE; + + /* takes care that the right amount of data is copied into wordpointer */ + mp->dsize=mp->fr.framesize; + mp->ssize=0; + } + + mp->side_parsed=1; + } + + /* now decode main data */ + iret=MP3_NEED_MORE; + if (!mp->data_parsed ) + { + if(mp->dsize > mp->bsize) + return MP3_NEED_MORE; + + copy_mp(mp,mp->dsize,wordpointer); + + *done = 0; + + //do_layer3(&mp->fr,(unsigned char *) out,done); + switch (mp->fr.lay) + { +#ifdef USE_LAYER_1 + case 1: + if(mp->fr.error_protection) + getbits(16); + + do_layer1(mp,(unsigned char *) out,done); + break; +#endif +#ifdef USE_LAYER_2 + case 2: + if(mp->fr.error_protection) + getbits(16); + + do_layer2(mp,(unsigned char *) out,done); + break; +#endif + case 3: + do_layer3(mp,(unsigned char *) out,done); + break; + default: + //fprintf(stderr,"invalid layer %d\n",mp->fr.lay); + break; + } + + wordpointer = mp->bsspace[mp->bsnum] + 512 + mp->ssize + mp->dsize; + + mp->data_parsed=1; + iret=MP3_OK; + } + + + /* remaining bits are ancillary data, or reservoir for next frame + * If free format, scan stream looking for next frame to determine + * mp->framesize */ + if (mp->free_format) + { + if (mp->old_free_format) + { + /* free format. bitrate must not vary */ + mp->framesize=mp->fsizeold_nopadding + (mp->fr.padding); + } + else + { + bytes=sync_buffer(mp,1); + if (bytes<0) + return iret; + mp->framesize = bytes + mp->ssize+mp->dsize; + mp->fsizeold_nopadding= mp->framesize - mp->fr.padding; + /* + fprintf(stderr,"freeformat bitstream: estimated bitrate=%ikbs \n", + 8*(4+mp->framesize)*freqs[mp->fr.sampling_frequency]/ + (1000*576*(2-mp->fr.lsf))); + */ + } + } + + /* buffer the ancillary data and reservoir for next frame */ + bytes = mp->framesize-(mp->ssize+mp->dsize); + if (bytes > mp->bsize) + return iret; + + if (bytes>0) + { + int size; + copy_mp(mp,bytes,wordpointer); + wordpointer += bytes; + + size = (int) (wordpointer - (mp->bsspace[mp->bsnum]+512)); + if (size > MAXFRAMESIZE) + { + //fprintf(stderr,"fatal error. MAXFRAMESIZE not large enough.\n"); + } + } + + /* the above frame is completey parsed. start looking for next frame */ + mp->fsizeold = mp->framesize; + mp->old_free_format = mp->free_format; + mp->framesize =0; + mp->header_parsed=0; + mp->side_parsed=0; + mp->data_parsed=0; + + return iret; +} + + + diff --git a/Libraries/DecMPA/Files/src/hip/interface.h b/Libraries/DecMPA/Files/src/hip/interface.h new file mode 100644 index 000000000..dc815b9c5 --- /dev/null +++ b/Libraries/DecMPA/Files/src/hip/interface.h @@ -0,0 +1,47 @@ +/* DecMPA decoding routines from Lame/HIP (Myers W. Carpenter) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + For more information look at the file License.txt in this package. + + + email: hazard_hd@users.sourceforge.net +*/ + +/* +** Copyright (C) 2000 Albert L. Faber +**/ + +#ifndef INTERFACE_H_INCLUDED +#define INTERFACE_H_INCLUDED + +#ifdef __cplusplus +extern "C" { +#endif + +#include "common.h" + +BOOL InitMP3(PMPSTR mp); +int decodeMP3(PMPSTR mp,unsigned char *inmemory,int inmemsize,char *outmemory,int outmemsize,int *done); +void ExitMP3(PMPSTR mp); + +/* added remove_buf to support mpglib seeking */ +void remove_buf(PMPSTR mp); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Libraries/DecMPA/Files/src/hip/l2tables.h b/Libraries/DecMPA/Files/src/hip/l2tables.h new file mode 100644 index 000000000..8eef3661e --- /dev/null +++ b/Libraries/DecMPA/Files/src/hip/l2tables.h @@ -0,0 +1,177 @@ +/* DecMPA decoding routines from Lame/HIP (Myers W. Carpenter) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + For more information look at the file License.txt in this package. + + + email: hazard_hd@users.sourceforge.net +*/ + + +/* + * Layer 2 Alloc tables .. + * most other tables are calculated on program start (which is (of course) + * not ISO-conform) .. + * Layer-3 huffman table is in huffman.h + */ + +const struct al_table2 alloc_0[] = { + {4,0},{5,3},{3,-3},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255},{10,-511}, + {11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383},{16,-32767}, + {4,0},{5,3},{3,-3},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255},{10,-511}, + {11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383},{16,-32767}, + {4,0},{5,3},{3,-3},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255},{10,-511}, + {11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383},{16,-32767}, + {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, + {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767}, + {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, + {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767}, + {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, + {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767}, + {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, + {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767}, + {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, + {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767}, + {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, + {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767}, + {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, + {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767}, + {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, + {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767}, + {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, + {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, + {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, + {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, + {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, + {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, + {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, + {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, + {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, + {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, + {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, + {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, + {2,0},{5,3},{7,5},{16,-32767}, + {2,0},{5,3},{7,5},{16,-32767}, + {2,0},{5,3},{7,5},{16,-32767}, + {2,0},{5,3},{7,5},{16,-32767} }; + +const struct al_table2 alloc_1[] = { + {4,0},{5,3},{3,-3},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255},{10,-511}, + {11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383},{16,-32767}, + {4,0},{5,3},{3,-3},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255},{10,-511}, + {11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383},{16,-32767}, + {4,0},{5,3},{3,-3},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255},{10,-511}, + {11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383},{16,-32767}, + {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, + {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767}, + {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, + {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767}, + {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, + {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767}, + {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, + {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767}, + {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, + {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767}, + {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, + {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767}, + {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, + {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767}, + {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, + {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{16,-32767}, + {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, + {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, + {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, + {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, + {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, + {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, + {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, + {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, + {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, + {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, + {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, + {3,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{16,-32767}, + {2,0},{5,3},{7,5},{16,-32767}, + {2,0},{5,3},{7,5},{16,-32767}, + {2,0},{5,3},{7,5},{16,-32767}, + {2,0},{5,3},{7,5},{16,-32767}, + {2,0},{5,3},{7,5},{16,-32767}, + {2,0},{5,3},{7,5},{16,-32767}, + {2,0},{5,3},{7,5},{16,-32767} }; + +const struct al_table2 alloc_2[] = { + {4,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255}, + {10,-511},{11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383}, + {4,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255}, + {10,-511},{11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383}, + {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, + {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, + {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, + {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, + {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, + {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63} }; + +const struct al_table2 alloc_3[] = { + {4,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255}, + {10,-511},{11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383}, + {4,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127},{9,-255}, + {10,-511},{11,-1023},{12,-2047},{13,-4095},{14,-8191},{15,-16383}, + {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, + {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, + {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, + {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, + {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, + {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, + {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, + {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, + {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, + {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63} }; + +const struct al_table2 alloc_4[] = { + {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, + {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{14,-8191}, + {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, + {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{14,-8191}, + {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, + {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{14,-8191}, + {4,0},{5,3},{7,5},{3,-3},{10,9},{4,-7},{5,-15},{6,-31},{7,-63},{8,-127}, + {9,-255},{10,-511},{11,-1023},{12,-2047},{13,-4095},{14,-8191}, + {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, + {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, + {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, + {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, + {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, + {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, + {3,0},{5,3},{7,5},{10,9},{4,-7},{5,-15},{6,-31},{7,-63}, + {2,0},{5,3},{7,5},{10,9}, + {2,0},{5,3},{7,5},{10,9}, + {2,0},{5,3},{7,5},{10,9}, + {2,0},{5,3},{7,5},{10,9}, + {2,0},{5,3},{7,5},{10,9}, + {2,0},{5,3},{7,5},{10,9}, + {2,0},{5,3},{7,5},{10,9}, + {2,0},{5,3},{7,5},{10,9}, + {2,0},{5,3},{7,5},{10,9}, + {2,0},{5,3},{7,5},{10,9}, + {2,0},{5,3},{7,5},{10,9}, + {2,0},{5,3},{7,5},{10,9}, + {2,0},{5,3},{7,5},{10,9}, + {2,0},{5,3},{7,5},{10,9}, + {2,0},{5,3},{7,5},{10,9}, + {2,0},{5,3},{7,5},{10,9}, + {2,0},{5,3},{7,5},{10,9}, + {2,0},{5,3},{7,5},{10,9}, + {2,0},{5,3},{7,5},{10,9} }; + diff --git a/Libraries/DecMPA/Files/src/hip/layer1.c b/Libraries/DecMPA/Files/src/hip/layer1.c new file mode 100644 index 000000000..d3e83d803 --- /dev/null +++ b/Libraries/DecMPA/Files/src/hip/layer1.c @@ -0,0 +1,194 @@ +/* DecMPA decoding routines from Lame/HIP (Myers W. Carpenter) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + For more information look at the file License.txt in this package. + + + email: hazard_hd@users.sourceforge.net +*/ + +/* + * Mpeg Layer-1 audio decoder + * -------------------------- + * copyright (c) 1995 by Michael Hipp, All rights reserved. See also 'README' + * near unoptimzed ... + * + * may have a few bugs after last optimization ... + * + */ + +/* $Id$ */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "HIPDefines.h" + +#ifdef USE_LAYER_1 + +#include +#include "common.h" +#include "decode_i386.h" + +#ifdef WITH_DMALLOC +#include +#endif + +void I_step_one(unsigned int balloc[], unsigned int scale_index[2][SBLIMIT],struct frame *fr) +{ + unsigned int *ba=balloc; + unsigned int *sca = (unsigned int *) scale_index; + + assert ( fr->stereo == 0 || fr->stereo == 1 ); + if(fr->stereo) { + int i; + int jsbound = fr->jsbound; + for (i=0;istereo == 0 || fr->stereo == 1 ); + if(fr->stereo) { + int jsbound = fr->jsbound; + register real *f0 = fraction[0]; + register real *f1 = fraction[1]; + ba = balloc; + for (sample=smpb,i=0;idown_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;idown_sample_sblimit;i<32;i++) + fraction[0][i] = 0.0; + } +} + +//int do_layer1(struct frame *fr,int outmode,struct audio_info_struct *ai) +int do_layer1(PMPSTR mp, unsigned char *pcm_sample,int *pcm_point) +{ + int clip=0; + unsigned int balloc[2*SBLIMIT]; + unsigned int scale_index[2][SBLIMIT]; + real fraction[2][SBLIMIT]; + struct frame *fr=&(mp->fr); + int i,stereo = fr->stereo; + int single = fr->single; + + fr->jsbound = (fr->mode == MPG_MD_JOINT_STEREO) ? (fr->mode_ext<<2)+4 : 32; + + if(stereo == 1 || single == 3) + single = 0; + + I_step_one(balloc,scale_index,fr); + + for (i=0;i= 0) + { + clip += synth_1to1_mono( mp, (real *) fraction[single],pcm_sample,pcm_point); + } + else { + int p1 = *pcm_point; + clip += synth_1to1( mp, (real *) fraction[0],0,pcm_sample,&p1); + clip += synth_1to1( mp, (real *) fraction[1],1,pcm_sample,pcm_point); + } + } + + return clip; +} + +#endif diff --git a/Libraries/DecMPA/Files/src/hip/layer1.h b/Libraries/DecMPA/Files/src/hip/layer1.h new file mode 100644 index 000000000..71a0a9a4d --- /dev/null +++ b/Libraries/DecMPA/Files/src/hip/layer1.h @@ -0,0 +1,33 @@ +/* DecMPA decoding routines from Lame/HIP (Myers W. Carpenter) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + For more information look at the file License.txt in this package. + + + email: hazard_hd@users.sourceforge.net +*/ + +/* +** Copyright (C) 2000 Albert L. Faber +**/ + + +#ifndef LAYER1_H_INCLUDED +#define LAYER1_H_INCLUDED + +int do_layer1(PMPSTR mp, unsigned char *pcm_sample,int *pcm_point); + +#endif diff --git a/Libraries/DecMPA/Files/src/hip/layer2.c b/Libraries/DecMPA/Files/src/hip/layer2.c new file mode 100644 index 000000000..2737b2b42 --- /dev/null +++ b/Libraries/DecMPA/Files/src/hip/layer2.c @@ -0,0 +1,333 @@ +/* DecMPA decoding routines from Lame/HIP (Myers W. Carpenter) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + For more information look at the file License.txt in this package. + + + email: hazard_hd@users.sourceforge.net +*/ + +/* + * Mpeg Layer-2 audio decoder + * -------------------------- + * copyright (c) 1995 by Michael Hipp, All rights reserved. See also 'README' + * + */ + +/* $Id$ */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "HIPDefines.h" + +#ifdef USE_LAYER_2 + + +#include "common.h" +#include "layer2.h" +#include "l2tables.h" +#include "decode_i386.h" + +#ifdef WITH_DMALLOC +#include +#endif + +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 */ + +void init_layer2(void) +{ + 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 }; + static 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; + real *table; + static const int tablen[3] = { 3 , 5 , 9 }; + static int *itable,*tables[3] = { grp_3tab , grp_5tab , grp_9tab }; + + for(i=0;i<3;i++) + { + itable = tables[i]; + len = tablen[i]; + for(j=0;jstereo-1; + int sblimit = fr->II_sblimit; + int jsbound = fr->jsbound; + int sblimit2 = fr->II_sblimit<alloc; + int i; + static 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(step); + } + for (i=sblimit-jsbound;i;i--,alloc1+=(1<bits); + bita[1] = bita[0]; + bita+=2; + } + bita = bit_alloc; + scfsi=scfsi_buf; + for (i=sblimit2;i;i--) + if (*bita++) + *scfsi++ = (char) getbits_fast(2); + } + else /* mono */ + { + for (i=sblimit;i;i--,alloc1+=(1<bits); + bita = bit_alloc; + scfsi=scfsi_buf; + for (i=sblimit;i;i--) + if (*bita++) + *scfsi++ = (char) getbits_fast(2); + } + + bita = bit_alloc; + scfsi=scfsi_buf; + for (i=sblimit2;i;i--) + if (*bita++) + switch (*scfsi++) + { + case 0: + *scale++ = getbits_fast(6); + *scale++ = getbits_fast(6); + *scale++ = getbits_fast(6); + break; + case 1 : + *scale++ = sc = getbits_fast(6); + *scale++ = sc; + *scale++ = getbits_fast(6); + break; + case 2: + *scale++ = sc = getbits_fast(6); + *scale++ = sc; + *scale++ = sc; + break; + default: /* case 3 */ + *scale++ = getbits_fast(6); + *scale++ = sc = getbits_fast(6); + *scale++ = sc; + break; + } + +} + +void II_step_two(unsigned int *bit_alloc,real fraction[2][4][SBLIMIT],int *scale,struct frame *fr,int x1) +{ + int i,j,k,ba; + int stereo = fr->stereo; + int sblimit = fr->II_sblimit; + int jsbound = fr->jsbound; + struct al_table2 *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=muls[k][scale[x1]]; + fraction[j][0][i] = ((real) ((int)getbits(k) + d1)) * cm; + fraction[j][1][i] = ((real) ((int)getbits(k) + d1)) * cm; + fraction[j][2][i] = ((real) ((int)getbits(k) + d1)) * cm; + } + else + { + static 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(k); + tab = (unsigned int *) (table[d1] + idx + idx + idx); + fraction[j][0][i] = muls[*tab++][m]; + fraction[j][1][i] = muls[*tab++][m]; + fraction[j][2][i] = muls[*tab][m]; + } + scale+=3; + } + else + fraction[j][0][i] = fraction[j][1][i] = fraction[j][2][i] = 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=muls[k][scale[x1+3]]; + fraction[1][0][i] = (fraction[0][0][i] = (real) ((int)getbits(k) + d1) ) * cm; + fraction[1][1][i] = (fraction[0][1][i] = (real) ((int)getbits(k) + d1) ) * cm; + fraction[1][2][i] = (fraction[0][2][i] = (real) ((int)getbits(k) + d1) ) * cm; + cm=muls[k][scale[x1]]; + fraction[0][0][i] *= cm; fraction[0][1][i] *= cm; fraction[0][2][i] *= cm; + } + else + { + static 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(k); + tab = (unsigned int *) (table[d1] + idx + idx + idx); + fraction[0][0][i] = muls[*tab][m1]; fraction[1][0][i] = muls[*tab++][m2]; + fraction[0][1][i] = muls[*tab][m1]; fraction[1][1][i] = muls[*tab++][m2]; + fraction[0][2][i] = muls[*tab][m1]; fraction[1][2][i] = 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] = 0.0; + } +/* + 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;ilsf) + table = 4; + else + table = translate[fr->sampling_frequency][2-fr->stereo][fr->bitrate_index]; + sblim = sblims[table]; + + fr->alloc = (struct al_table2*)tables[table]; + fr->II_sblimit = sblim; +} + + +int do_layer2( PMPSTR mp,unsigned char *pcm_sample,int *pcm_point) +//int do_layer2(struct frame *fr,int outmode,struct audio_info_struct *ai) +{ + int clip=0; + int i,j; + real fraction[2][4][SBLIMIT]; /* pick_table clears unused subbands */ + unsigned int bit_alloc[64]; + int scale[192]; + struct frame *fr=&(mp->fr); + int stereo = fr->stereo; + 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(stereo == 1 || single == 3) + single = 0; + + II_step_one(bit_alloc, scale, fr); + + for (i=0;i>2); + for (j=0;j<3;j++) + { + if(single >= 0) + { + clip += synth_1to1_mono(mp, fraction[single][j],pcm_sample,pcm_point); + } + else { + int p1 = *pcm_point; + clip += synth_1to1(mp, fraction[0][j],0,pcm_sample,&p1); + clip += synth_1to1(mp, fraction[1][j],1,pcm_sample,pcm_point); + } + } + } + + return clip; +} + + +#endif diff --git a/Libraries/DecMPA/Files/src/hip/layer2.h b/Libraries/DecMPA/Files/src/hip/layer2.h new file mode 100644 index 000000000..557a32573 --- /dev/null +++ b/Libraries/DecMPA/Files/src/hip/layer2.h @@ -0,0 +1,49 @@ +/* DecMPA decoding routines from Lame/HIP (Myers W. Carpenter) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + For more information look at the file License.txt in this package. + + + email: hazard_hd@users.sourceforge.net +*/ + +/* +** Copyright (C) 2000 Albert L. Faber +**/ + +#ifdef USE_LAYER_2 + +#ifndef LAYER2_H_INCLUDED +#define LAYER2_H_INCLUDED + + +struct al_table2 +{ + short bits; + short d; +}; + + + +void init_layer2(void); +void II_step_one(unsigned int *bit_alloc,int *scale,struct frame *fr); +void II_step_two(unsigned int *bit_alloc,real fraction[2][4][SBLIMIT],int *scale,struct frame *fr,int x1); +int do_layer2( PMPSTR mp,unsigned char *pcm_sample,int *pcm_point); + +#endif + +#endif + diff --git a/Libraries/DecMPA/Files/src/hip/layer3.c b/Libraries/DecMPA/Files/src/hip/layer3.c new file mode 100644 index 000000000..8d2e26157 --- /dev/null +++ b/Libraries/DecMPA/Files/src/hip/layer3.c @@ -0,0 +1,1827 @@ +/* DecMPA decoding routines from Lame/HIP (Myers W. Carpenter) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + For more information look at the file License.txt in this package. + + + email: hazard_hd@users.sourceforge.net +*/ + +/* + * Mpeg Layer-3 audio decoder + * -------------------------- + * copyright (c) 1995,1996,1997 by Michael Hipp. + * All rights reserved. See also 'README' + */ + +/* $Id$ */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include "common.h" +#include "huffman.h" +#include "decode_i386.h" + +#ifdef WITH_DMALLOC +#include +#endif + +#define MPEG1 + + +static real ispow[8207]; +static real aa_ca[8],aa_cs[8]; +static real COS1[12][6]; +static real win[4][36]; +static real win1[4][36]; +static real gainpow2[256+118+4]; +static real COS9[9]; +static real COS6_1,COS6_2; +static real tfcos36[9]; +static real tfcos12[3]; + +struct bandInfoStruct { + short longIdx[23]; + short longDiff[22]; + short shortIdx[14]; + short shortDiff[13]; +}; + +int longLimit[9][23]; +int shortLimit[9][14]; + +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 } } , + /* docs: 332. mpg123: 330 */ + { {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 */ + +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]; + +static unsigned int get1bit(void) +{ + unsigned char rval; + rval = *wordpointer << bitindex; + + bitindex++; + wordpointer += (bitindex>>3); + bitindex &= 7; + + return rval>>7; +} + + + + +/* + * init tables for layer-3 + */ +void init_layer3(int down_sample_sblimit) +{ + int i,j,k; + + for(i=-256;i<118+4;i++) + gainpow2[i+256] = pow((double)2.0,-0.25 * (double) (i+210) ); + + for(i=0;i<8207;i++) + ispow[i] = pow((double)i,(double)4.0/3.0); + + for (i=0;i<8;i++) + { + static 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] = 1.0/sq; + aa_ca[i] = Ci[i]/sq; + } + + for(i=0;i<18;i++) + { + win[0][i] = win[1][i] = 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] = 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] = 0.5 / cos ( M_PI * (double) (2*(i+18)+19) / 72.0 ); + win[3][i+12] = 0.5 / cos ( M_PI * (double) (2*(i+12)+19) / 72.0 ); + win[1][i+24] = 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] = 0.0; + win[3][i+6 ] = 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] = cos( M_PI / 18.0 * (double) i); + + for(i=0;i<9;i++) + tfcos36[i] = 0.5 / cos ( M_PI * (double) (i*2+1) / 36.0 ); + for(i=0;i<3;i++) + tfcos12[i] = 0.5 / cos ( M_PI * (double) (i*2+1) / 12.0 ); + + COS6_1 = cos( M_PI / 6.0 * (double) 1); + COS6_2 = cos( M_PI / 6.0 * (double) 2); + + for(i=0;i<12;i++) + { + win[2][i] = 0.5 * sin( M_PI / 24.0 * (double) (2*i+1) ) / cos ( M_PI * (double) (2*i+7) / 24.0 ); + for(j=0;j<6;j++) + COS1[i][j] = cos( M_PI / 24.0 * (double) ((2*i+7)*(2*j+1)) ); + } + + for(j=0;j<4;j++) { + static int len[4] = { 36,36,12,36 }; + for(i=0;i 0) { + if( i & 1 ) + p1 = pow(base,(i+1.0)*0.5); + else + p2 = pow(base,i*0.5); + } + pow1_1[j][i] = p1; + pow2_1[j][i] = p2; + pow1_2[j][i] = M_SQRT2 * p1; + pow2_2[j][i] = M_SQRT2 * p2; + } + } + + for(j=0;j<9;j++) + { + struct bandInfoStruct *bi = (struct bandInfoStruct *)&bandInfo[j]; + int *mp; + int cb,lwin; + short *bdf; + + mp = map[j][0] = mapbuf0[j]; + bdf = bi->longDiff; + 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; + + } + + for(j=0;j<9;j++) { + for(i=0;i<23;i++) { + longLimit[j][i] = (bandInfo[j].longIdx[i] - 1 + 8) / 18 + 1; + if(longLimit[j][i] > (down_sample_sblimit) ) + longLimit[j][i] = down_sample_sblimit; + } + for(i=0;i<14;i++) { + shortLimit[j][i] = (bandInfo[j].shortIdx[i] - 1) / 18 + 1; + if(shortLimit[j][i] > (down_sample_sblimit) ) + shortLimit[j][i] = down_sample_sblimit; + } + } + + 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++) { + int l; + 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); + } + } + } +} + +/* + * read additional side information + */ +#ifdef MPEG1 +static void III_get_side_info_1(struct III_sideinfo *si,int stereo, + int ms_stereo,long sfreq,int single) +{ + int ch, gr; + int powdiff = (single == 3) ? 4 : 0; + + si->main_data_begin = getbits(9); + if (stereo == 1) + si->private_bits = getbits_fast(5); + else + si->private_bits = getbits_fast(3); + + for (ch=0; chch[ch].gr[0].scfsi = -1; + si->ch[ch].gr[1].scfsi = getbits_fast(4); + } + + for (gr=0; gr<2; gr++) + { + for (ch=0; chch[ch].gr[gr]); + + gr_infos->part2_3_length = getbits(12); + gr_infos->big_values = getbits_fast(9); + if(gr_infos->big_values > 288) { + //fprintf(stderr,"big_values too large! %i\n",gr_infos->big_values); + gr_infos->big_values = 288; + } + { + unsigned int qss = getbits_fast(8); + gr_infos->pow2gain = gainpow2+256 - qss + powdiff; +/* +#ifndef NOANALYSIS + if (mpg123_pinfo != NULL) { + mpg123_pinfo->qss[gr][ch]=qss; + } +#endif +*/ + } + if(ms_stereo) + gr_infos->pow2gain += 2; + gr_infos->scalefac_compress = getbits_fast(4); +/* window-switching flag == 1 for block_Type != 0 .. and block-type == 0 -> win-sw-flag = 0 */ + if(get1bit()) + { + int i; + gr_infos->block_type = getbits_fast(2); + gr_infos->mixed_block_flag = get1bit(); + gr_infos->table_select[0] = getbits_fast(5); + gr_infos->table_select[1] = getbits_fast(5); + + + /* + * table_select[2] not needed, because there is no region2, + * but to satisfy some verifications tools we set it either. + */ + gr_infos->table_select[2] = 0; + for(i=0;i<3;i++) { + unsigned int sbg = (getbits_fast(3)<<3); + gr_infos->full_gain[i] = gr_infos->pow2gain + sbg; +/* +#ifndef NOANALYSIS + if (mpg123_pinfo != NULL) + mpg123_pinfo->sub_gain[gr][ch][i]=sbg/8; +#endif +*/ + } + + if(gr_infos->block_type == 0) { + //fprintf(stderr,"Blocktype == 0 and window-switching == 1 not allowed.\n"); + /* error seems to be very good recoverable, so don't exit */ + /* exit(1); */ + } + /* region_count/start parameters are implicit in this case. */ + gr_infos->region1start = 36>>1; + gr_infos->region2start = 576>>1; + } + else + { + int i,r0c,r1c; + for (i=0; i<3; i++) + gr_infos->table_select[i] = getbits_fast(5); + r0c = getbits_fast(4); + r1c = getbits_fast(3); + gr_infos->region1start = bandInfo[sfreq].longIdx[r0c+1] >> 1 ; + gr_infos->region2start = bandInfo[sfreq].longIdx[r0c+1+r1c+1] >> 1; + gr_infos->block_type = 0; + gr_infos->mixed_block_flag = 0; + } + gr_infos->preflag = get1bit(); + gr_infos->scalefac_scale = get1bit(); + gr_infos->count1table_select = get1bit(); + } + } +} +#endif + +/* + * Side Info for MPEG 2.0 / LSF + */ +static void III_get_side_info_2(struct III_sideinfo *si,int stereo, + int ms_stereo,long sfreq,int single) +{ + int ch; + int powdiff = (single == 3) ? 4 : 0; + + si->main_data_begin = getbits(8); + + if (stereo == 1) + si->private_bits = get1bit(); + else + si->private_bits = getbits_fast(2); + + for (ch=0; chch[ch].gr[0]); + unsigned int qss; + + gr_infos->part2_3_length = getbits(12); + gr_infos->big_values = getbits_fast(9); + if(gr_infos->big_values > 288) { + //fprintf(stderr,"big_values too large! %i\n",gr_infos->big_values); + gr_infos->big_values = 288; + } + qss=getbits_fast(8); + gr_infos->pow2gain = gainpow2+256 - qss + powdiff; +/* +#ifndef NOANALYSIS + if (mpg123_pinfo!=NULL) { + mpg123_pinfo->qss[0][ch]=qss; + } +#endif +*/ + + + if(ms_stereo) + gr_infos->pow2gain += 2; + gr_infos->scalefac_compress = getbits(9); +/* window-switching flag == 1 for block_Type != 0 .. and block-type == 0 -> win-sw-flag = 0 */ + if(get1bit()) + { + int i; + gr_infos->block_type = getbits_fast(2); + gr_infos->mixed_block_flag = get1bit(); + gr_infos->table_select[0] = getbits_fast(5); + gr_infos->table_select[1] = getbits_fast(5); + /* + * table_select[2] not needed, because there is no region2, + * but to satisfy some verifications tools we set it either. + */ + gr_infos->table_select[2] = 0; + for(i=0;i<3;i++) { + unsigned int sbg = (getbits_fast(3)<<3); + gr_infos->full_gain[i] = gr_infos->pow2gain + sbg; +/* +#ifndef NOANALYSIS + if (mpg123_pinfo!=NULL) + mpg123_pinfo->sub_gain[0][ch][i]=sbg/8; +#endif +*/ + + } + + if(gr_infos->block_type == 0) { + //fprintf(stderr,"Blocktype == 0 and window-switching == 1 not allowed.\n"); + /* error seems to be very good recoverable, so don't exit */ + /* exit(1); */ + } + /* region_count/start parameters are implicit in this case. */ +/* check this again! */ + if(gr_infos->block_type == 2) + gr_infos->region1start = 36>>1; + else if(sfreq == 8) +/* check this for 2.5 and sfreq=8 */ + gr_infos->region1start = 108>>1; + else + gr_infos->region1start = 54>>1; + gr_infos->region2start = 576>>1; + } + else + { + int i,r0c,r1c; + for (i=0; i<3; i++) + gr_infos->table_select[i] = getbits_fast(5); + r0c = getbits_fast(4); + r1c = getbits_fast(3); + gr_infos->region1start = bandInfo[sfreq].longIdx[r0c+1] >> 1 ; + gr_infos->region2start = bandInfo[sfreq].longIdx[r0c+1+r1c+1] >> 1; + gr_infos->block_type = 0; + gr_infos->mixed_block_flag = 0; + } + gr_infos->scalefac_scale = get1bit(); + gr_infos->count1table_select = get1bit(); + } +} + +/* + * read scalefactors + */ +#ifdef MPEG1 +static int III_get_scale_factors_1(int *scf,struct gr_info_s *gr_infos) +{ + static 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_infos->scalefac_compress]; + int num1 = slen[1][gr_infos->scalefac_compress]; + + if (gr_infos->block_type == 2) + { + int i=18; + numbits = (num0 + num1) * 18; + + if (gr_infos->mixed_block_flag) { + for (i=8;i;i--) + *scf++ = getbits_fast(num0); + i = 9; + numbits -= num0; /* num0 * 17 + num1 * 18 */ + } + + for (;i;i--) + *scf++ = getbits_fast(num0); + for (i = 18; i; i--) + *scf++ = getbits_fast(num1); + *scf++ = 0; *scf++ = 0; *scf++ = 0; /* short[13][0..2] = 0 */ + } + else + { + int i; + int scfsi = gr_infos->scfsi; + + if(scfsi < 0) { /* scfsi < 0 => granule == 0 */ + for(i=11;i;i--) + *scf++ = getbits_fast(num0); + for(i=10;i;i--) + *scf++ = getbits_fast(num1); + numbits = (num0 + num1) * 10 + num0; + } + else { + numbits = 0; + if(!(scfsi & 0x8)) { + for (i=6;i;i--) + *scf++ = getbits_fast(num0); + numbits += num0 * 6; + } + else { + scf += 6; + } + + if(!(scfsi & 0x4)) { + for (i=5;i;i--) + *scf++ = getbits_fast(num0); + numbits += num0 * 5; + } + else { + scf += 5; + } + + if(!(scfsi & 0x2)) { + for(i=5;i;i--) + *scf++ = getbits_fast(num1); + numbits += num1 * 5; + } + else { + scf += 5; + } + + if(!(scfsi & 0x1)) { + for (i=5;i;i--) + *scf++ = getbits_fast(num1); + numbits += num1 * 5; + } + else { + scf += 5; + } + } + + *scf++ = 0; /* no l[21] in original sources */ + } + return numbits; +} +#endif + +static int III_get_scale_factors_2(int *scf,struct gr_info_s *gr_infos,int i_stereo) +{ + unsigned char *pnt; + int i,j; + unsigned int slen; + int n = 0; + int numbits = 0; + + static 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_infos->scalefac_compress>>1]; + else + slen = n_slen2[gr_infos->scalefac_compress]; + + gr_infos->preflag = (slen>>15) & 0x1; + + n = 0; + if( gr_infos->block_type == 2 ) { + n++; + if(gr_infos->mixed_block_flag) + n++; + } + + pnt = (unsigned char *)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(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_infos->part2_3_length - part2bits; + int *me; + + { + int i; + + for(i=(&xr[SBLIMIT][0]-xrpnt)>>1;i>0;i--) { + *xrpnt++ = 0.0; + *xrpnt++ = 0.0; + } + + xrpnt = (real *) xr; + } + + { + int bv = gr_infos->big_values; + int region1 = gr_infos->region1start; + int region2 = gr_infos->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_infos->block_type == 2) { + /* + * decoding with short or mixed mode BandIndex table + */ + int i,max[4]; + int step=0,lwin=0,cb=0; + register real v = 0.0; + register int *m,mc; + + if(gr_infos->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]; + struct newhuff *h = (struct newhuff *)(ht+gr_infos->table_select[i]); + for(;lp;lp--,mc--) { + register int x,y; + if( (!mc) ) { + mc = *m++; + xrpnt = ((real *) xr) + (*m++); + lwin = *m++; + cb = *m++; + if(lwin == 3) { + v = gr_infos->pow2gain[(*scf++) << shift]; + step = 1; + } + else { + v = gr_infos->full_gain[lwin][(*scf++) << shift]; + step = 3; + } + } + { + register short *val = (short *)h->table; + while((y=*val++)<0) { + if (get1bit()) + val -= y; + part2remain--; + } + x = y >> 4; + y &= 0xf; + } + if(x == 15) { + max[lwin] = cb; + part2remain -= h->linbits+1; + x += getbits((int)h->linbits); + if(get1bit()) + *xrpnt = -ispow[x] * v; + else + *xrpnt = ispow[x] * v; + } + else if(x) { + max[lwin] = cb; + if(get1bit()) + *xrpnt = -ispow[x] * v; + else + *xrpnt = ispow[x] * v; + part2remain--; + } + else + *xrpnt = 0.0; + xrpnt += step; + if(y == 15) { + max[lwin] = cb; + part2remain -= h->linbits+1; + y += getbits((int)h->linbits); + if(get1bit()) + *xrpnt = -ispow[y] * v; + else + *xrpnt = ispow[y] * v; + } + else if(y) { + max[lwin] = cb; + if(get1bit()) + *xrpnt = -ispow[y] * v; + else + *xrpnt = ispow[y] * v; + part2remain--; + } + else + *xrpnt = 0.0; + xrpnt += step; + } + } + for(;l3 && (part2remain > 0);l3--) { + struct newhuff *h = (struct newhuff *)(htc+gr_infos->count1table_select); + register short *val = (short *)h->table,a; + + while((a=*val++)<0) { + part2remain--; + if(part2remain < 0) { + part2remain++; + a = 0; + break; + } + if (get1bit()) + val -= a; + } + for(i=0;i<4;i++) { + if(!(i & 1)) { + if(!mc) { + mc = *m++; + xrpnt = ((real *) xr) + (*m++); + lwin = *m++; + cb = *m++; + if(lwin == 3) { + v = gr_infos->pow2gain[(*scf++) << shift]; + step = 1; + } + else { + v = gr_infos->full_gain[lwin][(*scf++) << shift]; + step = 3; + } + } + mc--; + } + if( (a & (0x8>>i)) ) { + max[lwin] = cb; + part2remain--; + if(part2remain < 0) { + part2remain++; + break; + } + if(get1bit()) + *xrpnt = -v; + else + *xrpnt = v; + } + else + *xrpnt = 0.0; + xrpnt += step; + } + } + + while( m < me ) { + if(!mc) { + mc = *m++; + xrpnt = ((real *) xr) + *m++; + if( (*m++) == 3) + step = 1; + else + step = 3; + m++; /* cb */ + } + mc--; + *xrpnt = 0.0; + xrpnt += step; + *xrpnt = 0.0; + xrpnt += step; +/* we could add a little opt. here: + * if we finished a band for window 3 or a long band + * further bands could copied in a simple loop without a + * special 'map' decoding + */ + } + + gr_infos->maxband[0] = max[0]+1; + gr_infos->maxband[1] = max[1]+1; + gr_infos->maxband[2] = max[2]+1; + gr_infos->maxbandl = max[3]+1; + + { + int rmax = max[0] > max[1] ? max[0] : max[1]; + rmax = (rmax > max[2] ? rmax : max[2]) + 1; + gr_infos->maxb = rmax ? shortLimit[sfreq][rmax] : longLimit[sfreq][max[3]+1]; + } + + } + else { + /* + * decoding with 'long' BandIndex table (block_type != 2) + */ + int *pretab = (int *)(gr_infos->preflag ? pretab1 : pretab2); + int i,max = -1; + int cb = 0; + register int *m = map[sfreq][2]; + register real v = 0.0; + register int mc = 0; +#if 0 + me = mapend[sfreq][2]; +#endif + + /* + * long hash table values + */ + for(i=0;i<3;i++) { + int lp = l[i]; + struct newhuff *h = (struct newhuff *)(ht+gr_infos->table_select[i]); + + for(;lp;lp--,mc--) { + int x,y; + + if(!mc) { + mc = *m++; + v = gr_infos->pow2gain[((*scf++) + (*pretab++)) << shift]; + cb = *m++; + } + { + register short *val = (short *)h->table; + while((y=*val++)<0) { + if (get1bit()) + val -= y; + part2remain--; + } + x = y >> 4; + y &= 0xf; + } + if (x == 15) { + max = cb; + part2remain -= h->linbits+1; + x += getbits((int)h->linbits); + if(get1bit()) + *xrpnt++ = -ispow[x] * v; + else + *xrpnt++ = ispow[x] * v; + } + else if(x) { + max = cb; + if(get1bit()) + *xrpnt++ = -ispow[x] * v; + else + *xrpnt++ = ispow[x] * v; + part2remain--; + } + else + *xrpnt++ = 0.0; + + if (y == 15) { + max = cb; + part2remain -= h->linbits+1; + y += getbits((int)h->linbits); + if(get1bit()) + *xrpnt++ = -ispow[y] * v; + else + *xrpnt++ = ispow[y] * v; + } + else if(y) { + max = cb; + if(get1bit()) + *xrpnt++ = -ispow[y] * v; + else + *xrpnt++ = ispow[y] * v; + part2remain--; + } + else + *xrpnt++ = 0.0; + } + } + + /* + * short (count1table) values + */ + for(;l3 && (part2remain > 0);l3--) { + struct newhuff *h = (struct newhuff *)(htc+gr_infos->count1table_select); + register short *val = (short *)h->table,a; + + while((a=*val++)<0) { + part2remain--; + if(part2remain < 0) { + part2remain++; + a = 0; + break; + } + if (get1bit()) + val -= a; + } + for(i=0;i<4;i++) { + if(!(i & 1)) { + if(!mc) { + mc = *m++; + cb = *m++; + v = gr_infos->pow2gain[((*scf++) + (*pretab++)) << shift]; + } + mc--; + } + if ( (a & (0x8>>i)) ) { + max = cb; + part2remain--; + if(part2remain < 0) { + part2remain++; + break; + } + if(get1bit()) + *xrpnt++ = -v; + else + *xrpnt++ = v; + } + else + *xrpnt++ = 0.0; + } + } + + /* + * zero part + */ + for(i=(&xr[SBLIMIT][0]-xrpnt)>>1;i;i--) { + *xrpnt++ = 0.0; + *xrpnt++ = 0.0; + } + + gr_infos->maxbandl = max+1; + gr_infos->maxb = longLimit[sfreq][gr_infos->maxbandl]; + } + + while( part2remain > 16 ) { + getbits(16); /* Dismiss stuffing Bits */ + part2remain -= 16; + } + if(part2remain > 0) + getbits(part2remain); + else if(part2remain < 0) { + //fprintf(stderr,"mpg123: Can't rewind stream by %d bits!\n",-part2remain); + return 1; /* -> error */ + } + return 0; +} + + +/* + * III_stereo: 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_infos,int sfreq,int ms_stereo,int lsf) +{ + real (*xr)[SBLIMIT*SSLIMIT] = (real (*)[SBLIMIT*SSLIMIT] ) xr_buf; + struct bandInfoStruct *bi = (struct bandInfoStruct *)&bandInfo[sfreq]; + real *tabl1,*tabl2; + + if(lsf) { + int p = gr_infos->scalefac_compress & 0x1; + if(ms_stereo) { + tabl1 = pow1_2[p]; tabl2 = pow2_2[p]; + } + else { + tabl1 = pow1_1[p]; tabl2 = pow2_1[p]; + } + } + else { + if(ms_stereo) { + tabl1 = tan1_2; tabl2 = tan2_2; + } + else { + tabl1 = tan1_1; tabl2 = tan2_1; + } + } + + if (gr_infos->block_type == 2) + { + int lwin,do_l = 0; + if( gr_infos->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_infos->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_infos->mixed_block_flag]; /* scale: 0-15 */ + if(is_p != 7) { + real t1,t2; + sb = bi->shortDiff[sfb]; + idx = bi->shortIdx[sfb] + lwin; + t1 = tabl1[is_p]; t2 = tabl2[is_p]; + for (; sb > 0; sb--,idx+=3) + { + real v = xr[0][idx]; + xr[0][idx] = v * t1; + xr[1][idx] = 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_infos->mixed_block_flag]; /* scale: 0-15 */ + sb = bi->shortDiff[12]; + idx = bi->shortIdx[12] + lwin; +#else + is_p = scalefac[10*3+lwin-gr_infos->mixed_block_flag]; /* scale: 0-15 */ + sb = bi->shortDiff[11]; + idx = bi->shortIdx[11] + lwin; +#endif + if(is_p != 7) + { + real t1,t2; + t1 = tabl1[is_p]; t2 = tabl2[is_p]; + for ( ; sb > 0; sb--,idx+=3 ) + { + real v = xr[0][idx]; + xr[0][idx] = v * t1; + xr[1][idx] = v * t2; + } + } + } /* end for(lwin; .. ; . ) */ + + if (do_l) + { +/* also check l-part, if ALL bands in the three windows are 'empty' + * and mode = mixed_mode + */ + int sfb = gr_infos->maxbandl; + int 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 = tabl1[is_p]; t2 = tabl2[is_p]; + for ( ; sb > 0; sb--,idx++) + { + real v = xr[0][idx]; + xr[0][idx] = v * t1; + xr[1][idx] = v * t2; + } + } + else + idx += sb; + } + } + } + else /* ((gr_infos->block_type != 2)) */ + { + int sfb = gr_infos->maxbandl; + int is_p,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 = tabl1[is_p]; t2 = tabl2[is_p]; + for ( ; sb > 0; sb--,idx++) + { + real v = xr[0][idx]; + xr[0][idx] = v * t1; + xr[1][idx] = v * t2; + } + } + else + idx += sb; + } + + is_p = scalefac[20]; /* copy l-band 20 to l-band 21 */ + if(is_p != 7) + { + int sb; + real t1 = tabl1[is_p],t2 = tabl2[is_p]; + + for ( sb = bi->longDiff[21]; sb > 0; sb--,idx++ ) + { + real v = xr[0][idx]; + xr[0][idx] = v * t1; + xr[1][idx] = v * t2; + } + } + } /* ... */ +} + +static void III_antialias(real xr[SBLIMIT][SSLIMIT],struct gr_info_s *gr_infos) +{ + int sblim; + + if(gr_infos->block_type == 2) + { + if(!gr_infos->mixed_block_flag) + return; + sblim = 1; + } + else { + sblim = gr_infos->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 = (bu * (*cs) ) - (bd * (*ca) ); + *xr1++ = (bd * (*cs++) ) + (bu * (*ca++) ); + } + } + } +} + +/* + DCT insipired by Jeff Tsay's DCT from the maplay package + this is an optimized version with manual unroll. + + References: + [1] S. Winograd: "On Computing the Discrete Fourier Transform", + Mathematics of Computation, Volume 32, Number 141, January 1978, + Pages 175-199 +*/ + +static void dct36(real *inbuf,real *o1,real *o2,real *wintab,real *tsbuf) +{ + { + 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]; + + + { + +#define MACRO0(v) { \ + real tmp; \ + out2[9+(v)] = (tmp = sum0 + sum1) * w[27+(v)]; \ + out2[8-(v)] = tmp * w[26-(v)]; } \ + sum0 -= sum1; \ + ts[SBLIMIT*(8-(v))] = out1[8-(v)] + sum0 * w[8-(v)]; \ + ts[SBLIMIT*(9+(v))] = out1[9+(v)] + sum0 * w[9+(v)]; +#define MACRO1(v) { \ + real sum0,sum1; \ + sum0 = tmp1a + tmp2a; \ + sum1 = (tmp1b + tmp2b) * tfcos36[(v)]; \ + MACRO0(v); } +#define MACRO2(v) { \ + real sum0,sum1; \ + sum0 = tmp2a - tmp1a; \ + sum1 = (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 = in[2*3+0] * c[3]; + ta66 = in[2*6+0] * c[6]; + tb33 = in[2*3+1] * c[3]; + tb66 = in[2*6+1] * c[6]; + + { + real tmp1a,tmp2a,tmp1b,tmp2b; + tmp1a = in[2*1+0] * c[1] + ta33 + in[2*5+0] * c[5] + in[2*7+0] * c[7]; + tmp1b = in[2*1+1] * c[1] + tb33 + in[2*5+1] * c[5] + in[2*7+1] * c[7]; + tmp2a = in[2*0+0] + in[2*2+0] * c[2] + in[2*4+0] * c[4] + ta66 + in[2*8+0] * c[8]; + tmp2b = in[2*0+1] + in[2*2+1] * c[2] + in[2*4+1] * c[4] + tb66 + in[2*8+1] * c[8]; + + MACRO1(0); + MACRO2(8); + } + + { + real tmp1a,tmp2a,tmp1b,tmp2b; + tmp1a = ( in[2*1+0] - in[2*5+0] - in[2*7+0] ) * c[3]; + tmp1b = ( in[2*1+1] - in[2*5+1] - in[2*7+1] ) * c[3]; + tmp2a = ( in[2*2+0] - in[2*4+0] - in[2*8+0] ) * c[6] - in[2*6+0] + in[2*0+0]; + tmp2b = ( 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 = in[2*1+0] * c[5] - ta33 - in[2*5+0] * c[7] + in[2*7+0] * c[1]; + tmp1b = in[2*1+1] * c[5] - tb33 - in[2*5+1] * c[7] + in[2*7+1] * c[1]; + tmp2a = in[2*0+0] - in[2*2+0] * c[8] - in[2*4+0] * c[2] + ta66 + in[2*8+0] * c[4]; + tmp2b = in[2*0+1] - in[2*2+1] * c[8] - in[2*4+1] * c[2] + tb66 + in[2*8+1] * c[4]; + + MACRO1(2); + MACRO2(6); + } + + { + real tmp1a,tmp2a,tmp1b,tmp2b; + tmp1a = in[2*1+0] * c[7] - ta33 + in[2*5+0] * c[1] - in[2*7+0] * c[5]; + tmp1b = in[2*1+1] * c[7] - tb33 + in[2*5+1] * c[1] - in[2*7+1] * c[5]; + tmp2a = in[2*0+0] - in[2*2+0] * c[4] + in[2*4+0] * c[8] + ta66 - in[2*8+0] * c[2]; + tmp2b = in[2*0+1] - in[2*2+1] * c[4] + in[2*4+1] * c[8] + tb66 - 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 = (in[2*0+1] - in[2*2+1] + in[2*4+1] - in[2*6+1] + in[2*8+1] ) * tfcos36[4]; + MACRO0(4); + } + } + + } +} + +/* + * 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 *= COS6_1; \ + in3 *= COS6_1; \ + +#define DCT12_PART2 \ + in0 += in4 * COS6_2; \ + \ + in4 = in0 + in2; \ + in0 -= in2; \ + \ + in1 += in5 * COS6_2; \ + \ + in5 = (in1 + in3) * tfcos12[0]; \ + in1 = (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 = (in1 - in5) * tfcos12[1]; + tmp0 = tmp1 + tmp2; + tmp1 -= tmp2; + } + ts[(17-1)*SBLIMIT] = out1[17-1] + tmp0 * wi[11-1]; + ts[(12+1)*SBLIMIT] = out1[12+1] + tmp0 * wi[6+1]; + ts[(6 +1)*SBLIMIT] = out1[6 +1] + tmp1 * wi[1]; + ts[(11-1)*SBLIMIT] = out1[11-1] + tmp1 * wi[5-1]; + } + + DCT12_PART2 + + ts[(17-0)*SBLIMIT] = out1[17-0] + in2 * wi[11-0]; + ts[(12+0)*SBLIMIT] = out1[12+0] + in2 * wi[6+0]; + ts[(12+2)*SBLIMIT] = out1[12+2] + in3 * wi[6+2]; + ts[(17-2)*SBLIMIT] = out1[17-2] + in3 * wi[11-2]; + + ts[(6+0)*SBLIMIT] = out1[6+0] + in0 * wi[0]; + ts[(11-0)*SBLIMIT] = out1[11-0] + in0 * wi[5-0]; + ts[(6+2)*SBLIMIT] = out1[6+2] + in4 * wi[2]; + ts[(11-2)*SBLIMIT] = out1[11-2] + 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 = (in1 - in5) * tfcos12[1]; + tmp0 = tmp1 + tmp2; + tmp1 -= tmp2; + } + out2[5-1] = tmp0 * wi[11-1]; + out2[0+1] = tmp0 * wi[6+1]; + ts[(12+1)*SBLIMIT] += tmp1 * wi[1]; + ts[(17-1)*SBLIMIT] += tmp1 * wi[5-1]; + } + + DCT12_PART2 + + out2[5-0] = in2 * wi[11-0]; + out2[0+0] = in2 * wi[6+0]; + out2[0+2] = in3 * wi[6+2]; + out2[5-2] = in3 * wi[11-2]; + + ts[(12+0)*SBLIMIT] += in0 * wi[0]; + ts[(17-0)*SBLIMIT] += in0 * wi[5-0]; + ts[(12+2)*SBLIMIT] += in4 * wi[2]; + ts[(17-2)*SBLIMIT] += 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 = (in1 - in5) * tfcos12[1]; + tmp0 = tmp1 + tmp2; + tmp1 -= tmp2; + } + out2[11-1] = tmp0 * wi[11-1]; + out2[6 +1] = tmp0 * wi[6+1]; + out2[0+1] += tmp1 * wi[1]; + out2[5-1] += tmp1 * wi[5-1]; + } + + DCT12_PART2 + + out2[11-0] = in2 * wi[11-0]; + out2[6 +0] = in2 * wi[6+0]; + out2[6 +2] = in3 * wi[6+2]; + out2[11-2] = in3 * wi[11-2]; + + out2[0+0] += in0 * wi[0]; + out2[5-0] += in0 * wi[5-0]; + out2[0+2] += in4 * wi[2]; + out2[5-2] += in4 * wi[5-2]; + } +} + +/* + * III_hybrid + */ +static void III_hybrid( PMPSTR mp, real fsIn[SBLIMIT][SSLIMIT],real tsOut[SSLIMIT][SBLIMIT], + int ch,struct gr_info_s *gr_infos) +{ + real *tspnt = (real *) tsOut; + real (*block)[2][SBLIMIT*SSLIMIT] = mp->hybrid_block; + int *blc = mp->hybrid_blc; + real *rawout1,*rawout2; + int bt; + int sb = 0; + + { + int b = blc[ch]; + rawout1=block[b][ch]; + b=-b+1; + rawout2=block[b][ch]; + blc[ch] = b; + } + + + if(gr_infos->mixed_block_flag) { + sb = 2; + dct36(fsIn[0],rawout1,rawout2,win[0],tspnt); + dct36(fsIn[1],rawout1+18,rawout2+18,win1[0],tspnt+1); + rawout1 += 36; rawout2 += 36; tspnt += 2; + } + + bt = gr_infos->block_type; + if(bt == 2) { + for (; sb<(int)gr_infos->maxb; 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 (; sb<(int)gr_infos->maxb; sb+=2,tspnt+=2,rawout1+=36,rawout2+=36) { + dct36(fsIn[sb],rawout1,rawout2,win[bt],tspnt); + dct36(fsIn[sb+1],rawout1+18,rawout2+18,win1[bt],tspnt+1); + } + } + + for(;sbstereo; + int single = fr->single; + int ms_stereo; + int sfreq = fr->sampling_frequency; + int granules; + int ch,gr,databits; + + if(stereo == 1) { /* stream is mono */ + single = 0; + } + + if(fr->mode == MPG_MD_JOINT_STEREO) { + ms_stereo = fr->mode_ext & 0x2; + } + else + ms_stereo = 0; + + + if(fr->lsf) { + granules = 1; + III_get_side_info_2(&sideinfo,stereo,ms_stereo,sfreq,single); + } + else { + granules = 2; +#ifdef MPEG1 + III_get_side_info_1(&sideinfo,stereo,ms_stereo,sfreq,single); +#else + //fprintf(stderr,"Not supported\n"); +#endif + } + + databits=0; + for (gr=0 ; gr < granules ; ++gr) { + for (ch=0; ch < stereo ; ++ch) { + struct gr_info_s *gr_infos = &(sideinfo.ch[ch].gr[gr]); + databits += gr_infos->part2_3_length; + } + } + return databits-8*sideinfo.main_data_begin; +} + + + +int do_layer3( PMPSTR mp,unsigned char *pcm_sample,int *pcm_point) +{ + int gr, ch, ss,clip=0; + int scalefacs[2][39]; /* max 39 for short[13][3] mode, mixed: 38, long: 22 */ + // struct III_sideinfo sideinfo; + struct frame *fr=&(mp->fr); + int stereo = fr->stereo; + int single = fr->single; + int ms_stereo,i_stereo; + int sfreq = fr->sampling_frequency; + int stereo1,granules; + + if(set_pointer(mp, (int)sideinfo.main_data_begin) == MP3_ERR) + return -1; + + if(stereo == 1) { /* stream is mono */ + stereo1 = 1; + single = 0; + } + else if(single >= 0) /* 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; + i_stereo = fr->mode_ext & 0x1; + } + else + ms_stereo = i_stereo = 0; + + + if(fr->lsf) { + granules = 1; + } + else { + granules = 2; + } + + + for (gr=0;grlsf) + part2bits = III_get_scale_factors_2(scalefacs[0],gr_infos,0); + else { +#ifdef MPEG1 + part2bits = III_get_scale_factors_1(scalefacs[0],gr_infos); +#else + //fprintf(stderr,"Not supported\n"); +#endif + } + +/* +#ifndef NOANALYSIS + if (mpg123_pinfo!=NULL) { + int i; + mpg123_pinfo->sfbits[gr][0] = part2bits; + for (i=0; i<39; i++) + mpg123_pinfo->sfb_s[gr][0][i]=scalefacs[0][i]; + } +#endif +*/ + + if(III_dequantize_sample(hybridIn[0], scalefacs[0],gr_infos,sfreq,part2bits)) + return clip; + } + if(stereo == 2) { + struct gr_info_s *gr_infos = &(sideinfo.ch[1].gr[gr]); + long part2bits; + if(fr->lsf) + part2bits = III_get_scale_factors_2(scalefacs[1],gr_infos,i_stereo); + else { +#ifdef MPEG1 + part2bits = III_get_scale_factors_1(scalefacs[1],gr_infos); +#else + //fprintf(stderr,"Not supported\n"); +#endif + } +/* +#ifndef NOANALYSIS + if (mpg123_pinfo!=NULL) { + int i; + mpg123_pinfo->sfbits[gr][1] = part2bits; + for (i=0; i<39; i++) + mpg123_pinfo->sfb_s[gr][1][i]=scalefacs[1][i]; + } +#endif +*/ + + if(III_dequantize_sample(hybridIn[1],scalefacs[1],gr_infos,sfreq,part2bits)) + return clip; + + if(ms_stereo) { + int i; + for(i=0;ilsf); + + if(ms_stereo || i_stereo || (single == 3) ) { + if(gr_infos->maxb > sideinfo.ch[0].gr[gr].maxb) + sideinfo.ch[0].gr[gr].maxb = gr_infos->maxb; + else + gr_infos->maxb = sideinfo.ch[0].gr[gr].maxb; + } + + switch(single) { + case 3: + { + register int i; + register real *in0 = (real *) hybridIn[0],*in1 = (real *) hybridIn[1]; + for(i=0;i<(int)(SSLIMIT*gr_infos->maxb);i++,in0++) + *in0 = (*in0 + *in1++); /* *0.5 done by pow-scale */ + } + break; + case 1: + { + register int i; + register real *in0 = (real *) hybridIn[0],*in1 = (real *) hybridIn[1]; + for(i=0;i<(int)(SSLIMIT*gr_infos->maxb);i++) + *in0++ = *in1++; + } + break; + } + } + +#ifndef NOANALYSIS + if (mpg123_pinfo!=NULL) { + int i,sb; + float ifqstep; + + mpg123_pinfo->bitrate = + tabsel_123[fr->lsf][fr->lay-1][fr->bitrate_index]; + mpg123_pinfo->sampfreq = freqs[sfreq]; + mpg123_pinfo->emph = fr->emphasis; + mpg123_pinfo->crc = fr->error_protection; + mpg123_pinfo->padding = fr->padding; + mpg123_pinfo->stereo = fr->stereo; + mpg123_pinfo->js = (fr->mode == MPG_MD_JOINT_STEREO); + mpg123_pinfo->ms_stereo = ms_stereo; + mpg123_pinfo->i_stereo = i_stereo; + mpg123_pinfo->maindata = sideinfo.main_data_begin; + + for(ch=0;chbig_values[gr][ch]=gr_infos->big_values; + mpg123_pinfo->scalefac_scale[gr][ch]=gr_infos->scalefac_scale; + mpg123_pinfo->mixed[gr][ch] = gr_infos->mixed_block_flag; + mpg123_pinfo->mpg123blocktype[gr][ch]=gr_infos->block_type; + mpg123_pinfo->mainbits[gr][ch] = gr_infos->part2_3_length; + mpg123_pinfo->preflag[gr][ch] = gr_infos->preflag; + if (gr==1) mpg123_pinfo->scfsi[ch] = gr_infos->scfsi; + } + + + for (ch=0;chscalefac_scale[gr][ch] == 0 ) ? .5 : 1.0; + if (2==gr_infos->block_type) { + for (i=0; i<3; i++) { + for (sb=0; sb<12; sb++) { + int j = 3*sb+i; + /* + is_p = scalefac[sfb*3+lwin-gr_infos->mixed_block_flag]; + */ + /* scalefac was copied into mpg123_pinfo->sfb_s[] above */ + mpg123_pinfo->sfb_s[gr][ch][j] = -ifqstep*mpg123_pinfo->sfb_s[gr][ch][j-gr_infos->mixed_block_flag]; + mpg123_pinfo->sfb_s[gr][ch][j] -= 2*(mpg123_pinfo->sub_gain[gr][ch][i]); + } + mpg123_pinfo->sfb_s[gr][ch][3*sb+i] = - 2*(mpg123_pinfo->sub_gain[gr][ch][i]); + } + }else{ + for (sb=0; sb<21; sb++) { + /* scalefac was copied into mpg123_pinfo->sfb[] above */ + mpg123_pinfo->sfb[gr][ch][sb] = mpg123_pinfo->sfb_s[gr][ch][sb]; + if (gr_infos->preflag) mpg123_pinfo->sfb[gr][ch][sb] += pretab1[sb]; + mpg123_pinfo->sfb[gr][ch][sb] *= -ifqstep; + } + mpg123_pinfo->sfb[gr][ch][21]=0; + } + } + + + + for(ch=0;chmpg123xr[gr][ch][j]=hybridIn[ch][sb][ss]; + } + } +#endif + + for(ch=0;ch= 0) { + clip += synth_1to1_mono(mp, hybridOut[0][ss],pcm_sample,pcm_point); + } + else { + int p1 = *pcm_point; + clip += synth_1to1(mp, hybridOut[0][ss],0,pcm_sample,&p1); + clip += synth_1to1(mp, hybridOut[1][ss],1,pcm_sample,pcm_point); + } + } + } + + return clip; +} + diff --git a/Libraries/DecMPA/Files/src/hip/layer3.h b/Libraries/DecMPA/Files/src/hip/layer3.h new file mode 100644 index 000000000..c28be4899 --- /dev/null +++ b/Libraries/DecMPA/Files/src/hip/layer3.h @@ -0,0 +1,35 @@ +/* DecMPA decoding routines from Lame/HIP (Myers W. Carpenter) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + For more information look at the file License.txt in this package. + + + email: hazard_hd@users.sourceforge.net +*/ + +/* +** Copyright (C) 2000 Albert L. Faber +**/ + +#ifndef LAYER3_H_INCLUDED +#define LAYER3_H_INCLUDED + +void init_layer3(int); +int do_layer3_sideinfo(struct frame *fr); +int do_layer3( PMPSTR mp,unsigned char *pcm_sample,int *pcm_point); + +#endif + diff --git a/Libraries/DecMPA/Files/src/hip/mpg123.h b/Libraries/DecMPA/Files/src/hip/mpg123.h new file mode 100644 index 000000000..6bde9b044 --- /dev/null +++ b/Libraries/DecMPA/Files/src/hip/mpg123.h @@ -0,0 +1,157 @@ +/* DecMPA decoding routines from Lame/HIP (Myers W. Carpenter) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + For more information look at the file License.txt in this package. + + + email: hazard_hd@users.sourceforge.net +*/ + + +#ifndef MPG123_H_INCLUDED +#define MPG123_H_INCLUDED + +#include + +//#ifdef STDC_HEADERS +# include +//#else +/*# ifndef HAVE_STRCHR +# define strchr index +# define strrchr rindex +# endif +char *strchr (), *strrchr (); +# ifndef HAVE_MEMCPY +# define memcpy(d, s, n) bcopy ((s), (d), (n)) +# define memmove(d, s, n) bcopy ((s), (d), (n)) +# endif +#endif*/ + +#include + + +#if defined(__riscos__) && defined(FPA10) +#include "ymath.h" +#else +#include +#endif + +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif +#ifndef M_SQRT2 +#define M_SQRT2 1.41421356237309504880 +#endif + +#ifndef FALSE +#define FALSE 0 +#endif +#ifndef TRUE +#define TRUE 1 +#endif + + +#ifdef REAL_IS_FLOAT +# define real float +#elif defined(REAL_IS_LONG_DOUBLE) +# define real long double +#else +# define real double +#endif + +#define FALSE 0 +#define TRUE 1 + +#define SBLIMIT 32 +#define SSLIMIT 18 + +#define MPG_MD_STEREO 0 +#define MPG_MD_JOINT_STEREO 1 +#define MPG_MD_DUAL_CHANNEL 2 +#define MPG_MD_MONO 3 + +#define MAXFRAMESIZE 1792 + +/* AF: ADDED FOR LAYER1/LAYER2 */ +#define SCALE_BLOCK 12 + + +/* Pre Shift fo 16 to 8 bit converter table */ +#define AUSHIFT (3) + +struct frame { + int stereo; + int jsbound; + int single; + int lsf; + int mpeg25; + int header_change; + int lay; + int error_protection; + int bitrate_index; + int sampling_frequency; + int padding; + int extension; + int mode; + int mode_ext; + int copyright; + int original; + int emphasis; + int framesize; /* computed framesize */ + + /* AF: ADDED FOR LAYER1/LAYER2 */ +#if defined(USE_LAYER_2) || defined(USE_LAYER_1) + int II_sblimit; + struct al_table2 *alloc; + int down_sample_sblimit; + int down_sample; + +#endif + +}; + +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]; + unsigned subblock_gain[3]; + unsigned maxband[3]; + unsigned 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; + struct { + struct gr_info_s gr[2]; + } ch[2]; +}; + + +#endif diff --git a/Libraries/DecMPA/Files/src/hip/mpglib.h b/Libraries/DecMPA/Files/src/hip/mpglib.h new file mode 100644 index 000000000..f9b9be263 --- /dev/null +++ b/Libraries/DecMPA/Files/src/hip/mpglib.h @@ -0,0 +1,90 @@ +/* DecMPA decoding routines from Lame/HIP (Myers W. Carpenter) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + For more information look at the file License.txt in this package. + + + email: hazard_hd@users.sourceforge.net +*/ + + +#ifndef _MPGLIB_H_ +#define _MPGLIB_H_ + +/* +#ifndef NOANALYSIS +extern plotting_data *mpg123_pinfo; +#endif +*/ + +struct buf { + unsigned char *pnt; + long size; + long pos; + struct buf *next; + struct buf *prev; +}; + +struct framebuf { + struct buf *buf; + long pos; + struct frame *next; + struct frame *prev; +}; + +typedef struct mpstr_tag { + struct buf *head,*tail; + int vbr_header; /* 1 if valid Xing vbr header detected */ + int num_frames; /* set if vbr header present */ + int enc_delay; /* set if vbr header present */ + int enc_padding; /* set if vbr header present */ + int header_parsed; + int side_parsed; + int data_parsed; + int free_format; /* 1 = free format frame */ + int old_free_format; /* 1 = last frame was free format */ + int bsize; + int framesize; + int ssize; + int dsize; + int fsizeold; + int fsizeold_nopadding; + struct frame fr; + unsigned char bsspace[2][MAXFRAMESIZE+512]; /* MAXFRAMESIZE */ + real hybrid_block[2][2][SBLIMIT*SSLIMIT]; + int hybrid_blc[2]; + unsigned long header; + int bsnum; + real synth_buffs[2][2][0x110]; + int synth_bo; + int sync_bitstream; + +} MPSTR, *PMPSTR; + + +#if ( defined(_MSC_VER) || defined(__BORLANDC__) ) + typedef int BOOL; /* windef.h contains the same definition */ +#else + #define BOOL int +#endif + +#define MP3_ERR -1 +#define MP3_OK 0 +#define MP3_NEED_MORE 1 + + + +#endif /* _MPGLIB_H_ */ diff --git a/Libraries/DecMPA/Files/src/hip/tabinit.c b/Libraries/DecMPA/Files/src/hip/tabinit.c new file mode 100644 index 000000000..8602ce9bc --- /dev/null +++ b/Libraries/DecMPA/Files/src/hip/tabinit.c @@ -0,0 +1,143 @@ +/* DecMPA decoding routines from Lame/HIP (Myers W. Carpenter) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + For more information look at the file License.txt in this package. + + + email: hazard_hd@users.sourceforge.net +*/ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include "tabinit.h" +#include "mpg123.h" + +#ifdef WITH_DMALLOC +#include +#endif + +real decwin[512+32]; +static real cos64[16],cos32[8],cos16[4],cos8[2],cos4[1]; +real *pnts[] = { cos64,cos32,cos16,cos8,cos4 }; + +const double dewin[512] = { + 0.000000000,-0.000015259,-0.000015259,-0.000015259, + -0.000015259,-0.000015259,-0.000015259,-0.000030518, + -0.000030518,-0.000030518,-0.000030518,-0.000045776, + -0.000045776,-0.000061035,-0.000061035,-0.000076294, + -0.000076294,-0.000091553,-0.000106812,-0.000106812, + -0.000122070,-0.000137329,-0.000152588,-0.000167847, + -0.000198364,-0.000213623,-0.000244141,-0.000259399, + -0.000289917,-0.000320435,-0.000366211,-0.000396729, + -0.000442505,-0.000473022,-0.000534058,-0.000579834, + -0.000625610,-0.000686646,-0.000747681,-0.000808716, + -0.000885010,-0.000961304,-0.001037598,-0.001113892, + -0.001205444,-0.001296997,-0.001388550,-0.001480103, + -0.001586914,-0.001693726,-0.001785278,-0.001907349, + -0.002014160,-0.002120972,-0.002243042,-0.002349854, + -0.002456665,-0.002578735,-0.002685547,-0.002792358, + -0.002899170,-0.002990723,-0.003082275,-0.003173828, + -0.003250122,-0.003326416,-0.003387451,-0.003433228, + -0.003463745,-0.003479004,-0.003479004,-0.003463745, + -0.003417969,-0.003372192,-0.003280640,-0.003173828, + -0.003051758,-0.002883911,-0.002700806,-0.002487183, + -0.002227783,-0.001937866,-0.001617432,-0.001266479, + -0.000869751,-0.000442505, 0.000030518, 0.000549316, + 0.001098633, 0.001693726, 0.002334595, 0.003005981, + 0.003723145, 0.004486084, 0.005294800, 0.006118774, + 0.007003784, 0.007919312, 0.008865356, 0.009841919, + 0.010848999, 0.011886597, 0.012939453, 0.014022827, + 0.015121460, 0.016235352, 0.017349243, 0.018463135, + 0.019577026, 0.020690918, 0.021789551, 0.022857666, + 0.023910522, 0.024932861, 0.025909424, 0.026840210, + 0.027725220, 0.028533936, 0.029281616, 0.029937744, + 0.030532837, 0.031005859, 0.031387329, 0.031661987, + 0.031814575, 0.031845093, 0.031738281, 0.031478882, + 0.031082153, 0.030517578, 0.029785156, 0.028884888, + 0.027801514, 0.026535034, 0.025085449, 0.023422241, + 0.021575928, 0.019531250, 0.017257690, 0.014801025, + 0.012115479, 0.009231567, 0.006134033, 0.002822876, + -0.000686646,-0.004394531,-0.008316040,-0.012420654, + -0.016708374,-0.021179199,-0.025817871,-0.030609131, + -0.035552979,-0.040634155,-0.045837402,-0.051132202, + -0.056533813,-0.061996460,-0.067520142,-0.073059082, + -0.078628540,-0.084182739,-0.089706421,-0.095169067, + -0.100540161,-0.105819702,-0.110946655,-0.115921021, + -0.120697021,-0.125259399,-0.129562378,-0.133590698, + -0.137298584,-0.140670776,-0.143676758,-0.146255493, + -0.148422241,-0.150115967,-0.151306152,-0.151962280, + -0.152069092,-0.151596069,-0.150497437,-0.148773193, + -0.146362305,-0.143264771,-0.139450073,-0.134887695, + -0.129577637,-0.123474121,-0.116577148,-0.108856201, + -0.100311279,-0.090927124,-0.080688477,-0.069595337, + -0.057617187,-0.044784546,-0.031082153,-0.016510010, + -0.001068115, 0.015228271, 0.032379150, 0.050354004, + 0.069168091, 0.088775635, 0.109161377, 0.130310059, + 0.152206421, 0.174789429, 0.198059082, 0.221984863, + 0.246505737, 0.271591187, 0.297210693, 0.323318481, + 0.349868774, 0.376800537, 0.404083252, 0.431655884, + 0.459472656, 0.487472534, 0.515609741, 0.543823242, + 0.572036743, 0.600219727, 0.628295898, 0.656219482, + 0.683914185, 0.711318970, 0.738372803, 0.765029907, + 0.791213989, 0.816864014, 0.841949463, 0.866363525, + 0.890090942, 0.913055420, 0.935195923, 0.956481934, + 0.976852417, 0.996246338, 1.014617920, 1.031936646, + 1.048156738, 1.063217163, 1.077117920, 1.089782715, + 1.101211548, 1.111373901, 1.120223999, 1.127746582, + 1.133926392, 1.138763428, 1.142211914, 1.144287109, + 1.144989014 +}; + +void make_decode_tables(long scaleval) +{ + int i,j,k,kr,divv; + real *table,*costab; + + + for(i=0;i<5;i++) + { + kr=0x10>>i; divv=0x40>>i; + costab = pnts[i]; + for(k=0;k +//#include +#include +#include +#include "dxHead.h" + +// 4 Xing +// 4 flags +// 4 frames +// 4 bytes +// 100 toc + +/*-------------------------------------------------------------*/ +static int ExtractI4(unsigned char *buf) +{ +int x; +// big endian extract + +x = buf[0]; +x <<= 8; +x |= buf[1]; +x <<= 8; +x |= buf[2]; +x <<= 8; +x |= buf[3]; + +return x; +} +/*-------------------------------------------------------------*/ +int GetXingHeader(XHEADDATA *X, unsigned char *buf) +{ +int i, head_flags; +int h_id, h_mode, h_sr_index; +static const int sr_table[4] = { 44100, 48000, 32000, 99999 }; + +// get Xing header data + + +X->flags = 0; // clear to null incase fail + + +// get selected MPEG header data +h_id = (buf[1] >> 3) & 1; +h_sr_index = (buf[2] >> 2) & 3; +h_mode = (buf[3] >> 6) & 3; + + +// determine offset of header +if( h_id ) { // mpeg1 + if( h_mode != 3 ) buf+=(32+4); + else buf+=(17+4); +} +else { // mpeg2 + if( h_mode != 3 ) buf+=(17+4); + else buf+=(9+4); +} + +if( buf[0] != 'X' ) return 0; // fail +if( buf[1] != 'i' ) return 0; // header not found +if( buf[2] != 'n' ) return 0; +if( buf[3] != 'g' ) return 0; +buf+=4; + +X->h_id = h_id; +X->samprate = sr_table[h_sr_index]; +if( h_id == 0 ) X->samprate >>= 1; + +head_flags = X->flags = ExtractI4(buf); buf+=4; // get flags + +if( head_flags & FRAMES_FLAG ) {X->frames = ExtractI4(buf); buf+=4;} +if( head_flags & BYTES_FLAG ) {X->bytes = ExtractI4(buf); buf+=4;} + +if( head_flags & TOC_FLAG ) { + if( X->toc != (unsigned char*)0 ) { + for(i=0;i<100;i++) X->toc[i] = buf[i]; + } + buf+=100; +} + +X->vbr_scale = -1; +if( head_flags & VBR_SCALE_FLAG ) {X->vbr_scale = ExtractI4(buf); buf+=4;} + +//if( X->toc != NULL ) { +//for(i=0;i<100;i++) { +// if( (i%10) == 0 ) printf("\n"); +// printf(" %3d", (int)(X->toc[i])); +//} +//} + +return 1; // success +} +/*-------------------------------------------------------------*/ +int SeekPoint(unsigned char TOC[100], int file_bytes, float percent) +{ + // interpolate in TOC to get file seek point in bytes + int a, seekpoint; + float fa, fb, fx; + + if( percent < 0.0f ) + percent = 0.0f; + if( percent > 100.0f ) + percent = 100.0f; + + a = (int)percent; + if( a > 99 ) + a = 99; + fa = TOC[a]; + if( a < 99 ) + { + fb = TOC[a+1]; + } + else + { + fb = 256.0f; + } + + fx = fa + (fb-fa)*(percent-a); + //printf("%f ....... %f ...... %f\n",fa,fb,fx); + + seekpoint = (int)((1.0f/256.0f)*fx*file_bytes); + + return seekpoint; +} +/*-------------------------------------------------------------*/ diff --git a/Libraries/DecMPA/Files/src/mpegAudioFrame/dxHead.h b/Libraries/DecMPA/Files/src/mpegAudioFrame/dxHead.h new file mode 100644 index 000000000..da0f2eff6 --- /dev/null +++ b/Libraries/DecMPA/Files/src/mpegAudioFrame/dxHead.h @@ -0,0 +1,66 @@ +/*---- DXhead.h ------------------------------------------- + + +decoder MPEG Layer III + +handle Xing header + + +Copyright 1998 Xing Technology Corp. +-----------------------------------------------------------*/ +// A Xing header may be present in the ancillary +// data field of the first frame of an mp3 bitstream +// The Xing header (optionally) contains +// frames total number of audio frames in the bitstream +// bytes total number of bytes in the bitstream +// toc table of contents + +// toc (table of contents^) gives seek points +// for random access +// the ith entry determines the seek point for +// i-percent duration +// seek point in bytes = (toc[i]/256.0) * total_bitstream_bytes +// e.g. half duration seek point = (toc[50]/256.0) * total_bitstream_bytes + +#ifndef __DXHEAD_H +#define __DXHEAD_H + +#define FRAMES_FLAG 0x0001 +#define BYTES_FLAG 0x0002 +#define TOC_FLAG 0x0004 +#define VBR_SCALE_FLAG 0x0008 + +#define FRAMES_AND_BYTES (FRAMES_FLAG | BYTES_FLAG) + +// structure to receive extracted header +// toc may be NULL + +typedef struct XHEADDATA_s { + int h_id; // from MPEG header, 0=MPEG2, 1=MPEG1 + int samprate; // determined from MPEG header + int flags; // from Xing header data + int frames; // total bit stream frames from Xing header data + int bytes; // total bit stream bytes from Xing header data + int vbr_scale; // encoded vbr scale from Xing header data + unsigned char *toc; // pointer to unsigned char toc_buffer[100] + // may be NULL if toc not desired +} XHEADDATA; + +int GetXingHeader(XHEADDATA *X, unsigned char *buf); + +// return 0=fail, 1=success +// X structure to receive header data (output) +// buf bitstream input + + +int SeekPoint(unsigned char TOC[100], int file_bytes, float percent); +// return seekpoint in bytes (may be at eof if percent=100.0) +// TOC = table of contents from Xing header +// file_bytes = number of bytes in mp3 file +// percent = play time percentage of total playtime. May be +// fractional (e.g. 87.245) + + +#endif + + diff --git a/Libraries/DecMPA/Files/src/mpegAudioFrame/mpegAudioHeader.cpp b/Libraries/DecMPA/Files/src/mpegAudioFrame/mpegAudioHeader.cpp new file mode 100644 index 000000000..cf64f1e6f --- /dev/null +++ b/Libraries/DecMPA/Files/src/mpegAudioFrame/mpegAudioHeader.cpp @@ -0,0 +1,281 @@ +/* + stores information after we found a header. + Copyright (C) 2000 Martin Vogt + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Library General Public License as published by + the Free Software Foundation. + + For more information look at the file License.txt in this package + + */ + +//changes 8/4/2002 (by Hauke Duden): +// - removed cout and exit stuff +// - added bitratekbps variable + +#include "mpegAudioHeader.h" + +#define DEBUG_HEADER(x) +//#define DEBUG_HEADER(x) x + + + +static const int frequencies[3][3]= { + {44100,48000,32000}, // MPEG 1 + {22050,24000,16000}, // MPEG 2 + {11025,12000,8000} // MPEG 2.5 +}; + +static int translate[3][2][16] = { { { 2,0,0,2,2,2,3,3,3,3,3,3,3,3,3,2 } , + { 2,0,0,0,0,0,0,2,2,2,3,3,3,3,3,2 } } , + { { 2,0,0,2,2,2,2,2,2,2,2,2,2,2,2,2 } , + { 2,0,0,0,0,0,0,2,2,2,2,2,2,2,2,2 } } , + { { 2,1,1,2,2,2,3,3,3,3,3,3,3,3,3,2 } , + { 2,1,1,1,1,1,1,2,2,2,3,3,3,3,3,2 } } }; + + +static int sblims[5] = { 8 , 12 , 27, 30 , 30 }; + + +static const int bitrate[2][3][15]= { + // MPEG 1 + {{0,32,64,96,128,160,192,224,256,288,320,352,384,416,448}, + {0,32,48,56,64,80,96,112,128,160,192,224,256,320,384}, + {0,32,40,48,56,64,80,96,112,128,160,192,224,256,320}}, + + // MPEG 2 + {{0,32,48,56,64,80,96,112,128,144,160,176,192,224,256}, + {0,8,16,24,32,40,48,56,64,80,96,112,128,144,160}, + {0,8,16,24,32,40,48,56,64,80,96,112,128,144,160}} +}; + + +MpegAudioHeader::MpegAudioHeader() { + +} + + +MpegAudioHeader::~MpegAudioHeader() { +} + + +int MpegAudioHeader::getChannelbitrate() { + //cout << "getChannelbitrate not implemented"<>1)&3); + // we catch the layer==4 error later, for now go on with parsing + version=(int)(((c>>3)&1)^1); + if ((version==0) && lmpeg25) { + //DEBUG_HEADER(cout << "wrong lsf/mpeg25 combination"<>1; + padding=(c&1); + c>>=1; + frequency=(int)(c&3); + c>>=2; + bitrateindex=(int)c; + if(bitrateindex>=15) { + //DEBUG_HEADER(cout << "bitrateindex error"<>4; + extendedmode=c&3; + mode=(int)(c>>2); + + + // Making information + inputstereo= (mode==_MODE_SINGLE)?0:1; + + // + // frequency can be 0,1 or 2 but the mask above allows 3 as well + // check now. + if (frequency > 2) { + //DEBUG_HEADER(cout << "frequency value out of range"<>1; + if(mode==_MODE_SINGLE)stereobound=0; + if(mode==_MODE_JOINT)stereobound=(extendedmode+1)<<2; + + break; + case 1: + subbandnumber=MAXSUBBAND; + stereobound=subbandnumber; + tableindex=0; + if(mode==_MODE_SINGLE)stereobound=0; + if(mode==_MODE_JOINT)stereobound=(extendedmode+1)<<2; + break; + default: + //DEBUG_HEADER(cout <<"unknown layer"<protection=protection; + dest->layer=layer; + dest->version=version; + dest->padding=padding; + dest->frequency=frequency; + dest->frequencyHz=frequencyHz; + dest->bitrateindex=bitrateindex; + dest->extendedmode=extendedmode; + dest->mode=mode; + dest->inputstereo=inputstereo; + dest->channelbitrate=channelbitrate; + dest->tableindex=tableindex; + dest->subbandnumber=subbandnumber; + dest->stereobound=stereobound; + dest->framesize=framesize; + dest->layer3slots=layer3slots; + dest->lmpeg25=lmpeg25; +} + + +void MpegAudioHeader::print(const char* name) { +/* cout << "MpegAudioHeader [START]:"< +//#include +//#include +//#include + +#define _FREQUENCY_44100 0 +#define _FREQUENCY_48000 1 +#define _FREQUENCY_32000 2 + +#define _MODE_FULLSTEREO 0 +#define _MODE_JOINT 1 +#define _MODE_DUAL 2 +#define _MODE_SINGLE 3 + +#define _VERSION_1 0 +#define _VERSION_2 1 + + +#define MAXSUBBAND 32 +#define SCALEBLOCK 12 + + + +class MpegAudioHeader { + + int protection; + int layer; + int version; + int padding; + int frequency; + int frequencyHz; + int bitrateindex; + int extendedmode; + int mode; + int inputstereo; + int channelbitrate; + int tableindex; + int subbandnumber; + int stereobound; + int framesize; + int layer3slots; + int lmpeg25; + unsigned char header[4]; + + int m_nBitRateKbps; + double m_AvgFrameSize; + + public: + MpegAudioHeader(); + ~MpegAudioHeader(); + + int parseHeader(unsigned char* buf); + + inline int getProtection() { return protection; } + inline int getLayer() { return layer; } + inline int getVersion() { return version; } + inline int getPadding() { return padding; } + inline int getFrequency() { return frequency; } + inline int getFrequencyHz() { return frequencyHz; } + inline int getBitrateindex() { return bitrateindex; } + inline int getExtendedmode() { return extendedmode; } + inline int getMode() { return mode; } + inline int getInputstereo() { return inputstereo; } + inline int getFramesize() { return framesize; } + inline int getLayer25() { return lmpeg25; } + + // MPEG layer 2 + inline int getTableindex() { return tableindex; } + // MPEG layer 1/2 + inline int getSubbandnumber() { return subbandnumber; } + inline int getStereobound() { return stereobound; } + // MPEG layer 3 + inline int getLayer3slots() { return layer3slots; } + + int getChannelbitrate(); + + + inline unsigned char* getHeader() { return header; } + int getpcmperframe(); + + + void copyTo(MpegAudioHeader* dest); + + void print(const char* name); + void printStates(const char* name); + + inline int GetBitRateKbps(){ return m_nBitRateKbps; } + inline double GetAvgFrameSize() { return m_AvgFrameSize; } +}; +#endif diff --git a/Libraries/DecMPA/Files/src/splay/DecodeEngine_SPlay.cpp b/Libraries/DecMPA/Files/src/splay/DecodeEngine_SPlay.cpp new file mode 100644 index 000000000..0ffc7ccdc --- /dev/null +++ b/Libraries/DecMPA/Files/src/splay/DecodeEngine_SPlay.cpp @@ -0,0 +1,49 @@ +/* DecMPA - simple MPEG Audio decoding library. + Copyright (C) 2002 Hauke Duden + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + For more information look at the file License.txt in this package. + + email: hazard_hd@users.sourceforge.net +*/ + + +#include "splayDecoder.h" +#include "../DecodeEngine.h" + +#include + +void* DecodeEngine_Create() +{ + return new SplayDecoder(); +} + +void DecodeEngine_Destroy(void* pEng) +{ + delete (SplayDecoder*)pEng; +} + +bool DecodeEngine_Decode(void* pEng,AudioFrame* pDest,void* pData,long nDataLength) +{ + SplayDecoder* pDecoder=(SplayDecoder*)pEng; + + return pDecoder->decode((unsigned char*)pData,nDataLength,pDest)!=0; +} + +void DecodeEngine_Flush(void* pEngine) +{ + //splay doesn't store old data, so we don't have to do anything +} diff --git a/Libraries/DecMPA/Files/src/splay/attribute.h b/Libraries/DecMPA/Files/src/splay/attribute.h new file mode 100644 index 000000000..1306ede0d --- /dev/null +++ b/Libraries/DecMPA/Files/src/splay/attribute.h @@ -0,0 +1,33 @@ +/* + align attribut definition (g++) + Copyright (C) 2001 Martin Vogt + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Library General Public License as published by + the Free Software Foundation. + + For more information look at the file License.txt in this package + + */ + + +#ifndef __ATTRIBUTE_H +#define __ATTRIBUTE_H + + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +/* use gcc attribs to align critical data structures */ + +#ifdef ATTRIBUTE_ALIGNED_MAX +#define ATTR_ALIGN(align) __attribute__ \ + ((__aligned__ ((ATTRIBUTE_ALIGNED_MAX + +#define SSLIMIT 18 +#define SBLIMIT 32 + + +#define LS 0 +#define RS 1 + + +typedef float REAL; + +extern "C" { +// The inline code works on intel only with egcs >= 1.1 +#ifdef __GNUC__ +#if (__GNUC__ < 2 || ( __GNUC__ == 2 && __GNUC_MINOR__ < 91 ) ) +#ifndef _AIX +#warning "inline code disabled! (buggy egcs version)" +#undef __NO_MATH_INLINES +#define __NO_MATH_INLINES 1 +#endif +#endif +#endif +#ifndef WIN32 +#include +#endif +#include + +} +#if defined WIN32 + #include +#endif + +//#include + +#ifndef M_PI +#define MY_PI 3.14159265358979323846 +#else +#define MY_PI M_PI +#endif + +#ifdef PI +#undef PI +#endif +#define PI MY_PI +#define PI_12 (PI/12.0) +#define PI_18 (PI/18.0) +#define PI_24 (PI/24.0) +#define PI_36 (PI/36.0) +#define PI_72 (PI/72.0) + + +#endif diff --git a/Libraries/DecMPA/Files/src/splay/dct.h b/Libraries/DecMPA/Files/src/splay/dct.h new file mode 100644 index 000000000..e2ca59188 --- /dev/null +++ b/Libraries/DecMPA/Files/src/splay/dct.h @@ -0,0 +1,33 @@ +/* + wrapper for dcts + Copyright (C) 2001 Martin Vogt + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Library General Public License as published by + the Free Software Foundation. + + For more information look at the file License.txt in this package + + */ + + +#ifndef __DCT_HEADER_H +#define __DCT_HEADER_H + +// one source: +extern void initialize_dct64(); + +extern void dct64(REAL* out1,REAL* out2,REAL *fraction); + +// one source: +extern void initialize_dct64_downsample(); +extern void dct64_downsample(REAL* out1,REAL* out2,REAL *fraction); + +// one source file: +extern void initialize_dct12_dct36(); + +extern void dct12(REAL *in,REAL *prevblk1,REAL *prevblk2,REAL *wi,REAL *out); +extern void dct36(REAL *inbuf,REAL *prevblk1,REAL *prevblk2,REAL *wi,REAL *out); + +extern void initialize_win(); +#endif diff --git a/Libraries/DecMPA/Files/src/splay/dct36_12.cpp b/Libraries/DecMPA/Files/src/splay/dct36_12.cpp new file mode 100644 index 000000000..942669cc2 --- /dev/null +++ b/Libraries/DecMPA/Files/src/splay/dct36_12.cpp @@ -0,0 +1,290 @@ +/* + wrapper for dcts + Copyright (C) 2001 Martin Vogt + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Library General Public License as published by + the Free Software Foundation. + + For more information look at the file License.txt in this package + + */ + +//changes 8/4/2002 (by Hauke Duden): +// - added some explicit casts to remove compilation warnings + +#include "common.h" +#include "dct.h" + + +ATTR_ALIGN(64) static REAL hsec_12[3]; +ATTR_ALIGN(64) static REAL cos2_6=(REAL)cos(PI/6.0*2.0); +ATTR_ALIGN(64) static REAL cos1_6=(REAL)cos(PI/6.0*1.0); +ATTR_ALIGN(64) static REAL hsec_36[9]; +ATTR_ALIGN(64) static REAL cos_18[9]; + + +/** + This was some time ago a standalone dct class, + but to get more speed I made it an inline dct + int the filter classes +*/ + +static int dct36_12Init=false; + +void initialize_dct12_dct36() { + if (dct36_12Init) { + return; + } + dct36_12Init=true; + + + int i; + + for(i=0;i<3;i++) + hsec_12[i]=(REAL)(0.5/cos(double(i*2+1)* PI_12)); + + for(i=0;i<9;i++) + hsec_36[i]=(REAL)(0.5/cos(double(i*2+1)* PI_36)); + + for(i=0;i<9;i++) + cos_18[i]=(REAL)(cos(PI_18*double(i))); + +} + + +void dct36(REAL *inbuf,REAL *prevblk1, + REAL *prevblk2,REAL *wi,REAL *out){ + +#define MACRO0(v) { \ + REAL tmp; \ + out2[9+(v)]=(tmp=sum0+sum1)*wi[27+(v)]; \ + out2[8-(v)]=tmp * wi[26-(v)]; } \ + sum0-=sum1; \ + ts[SBLIMIT*(8-(v))]=out1[8-(v)]+sum0*wi[8-(v)]; \ + ts[SBLIMIT*(9+(v))]=out1[9+(v)]+sum0*wi[9+(v)]; +#define MACRO1(v) { \ + REAL sum0,sum1; \ + sum0=tmp1a+tmp2a; \ + sum1=(tmp1b+tmp2b)*hsec_36[(v)]; \ + MACRO0(v); } +#define MACRO2(v) { \ + REAL sum0,sum1; \ + sum0=tmp2a-tmp1a; \ + sum1=(tmp2b-tmp1b) * hsec_36[(v)]; \ + MACRO0(v); } + + { + 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]; + + { + REAL *c = cos_18; + REAL *out2 = prevblk2; + REAL *out1 = prevblk1; + REAL *ts = out; + + REAL ta33,ta66,tb33,tb66; + + ta33=in[2*3+0]*c[3]; + ta66=in[2*6+0]*c[6]; + tb33=in[2*3+1]*c[3]; + tb66=in[2*6+1]*c[6]; + + { + REAL tmp1a,tmp2a,tmp1b,tmp2b; + tmp1a= in[2*1+0]*c[1]+ta33 +in[2*5+0]*c[5]+in[2*7+0]*c[7]; + tmp1b= in[2*1+1]*c[1]+tb33 +in[2*5+1]*c[5]+in[2*7+1]*c[7]; + tmp2a=in[2*0+0]+in[2*2+0]*c[2]+in[2*4+0]*c[4]+ta66 +in[2*8+0]*c[8]; + tmp2b=in[2*0+1]+in[2*2+1]*c[2]+in[2*4+1]*c[4]+tb66 +in[2*8+1]*c[8]; + MACRO1(0); + MACRO2(8); + } + + { + REAL tmp1a,tmp2a,tmp1b,tmp2b; + tmp1a=(in[2*1+0]-in[2*5+0]-in[2*7+0])*c[3]; + tmp1b=(in[2*1+1]-in[2*5+1]-in[2*7+1])*c[3]; + tmp2a=(in[2*2+0]-in[2*4+0]-in[2*8+0])*c[6]-in[2*6+0]+in[2*0+0]; + tmp2b=(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= in[2*1+0]*c[5]-ta33 -in[2*5+0]*c[7]+in[2*7+0]*c[1]; + tmp1b= in[2*1+1]*c[5]-tb33 -in[2*5+1]*c[7]+in[2*7+1]*c[1]; + tmp2a=in[2*0+0]-in[2*2+0]*c[8]-in[2*4+0]*c[2]+ta66 +in[2*8+0]*c[4]; + tmp2b=in[2*0+1]-in[2*2+1]*c[8]-in[2*4+1]*c[2]+tb66 +in[2*8+1]*c[4]; + MACRO1(2); + MACRO2(6); + } + + { + REAL tmp1a,tmp2a,tmp1b,tmp2b; + tmp1a= in[2*1+0]*c[7]-ta33 +in[2*5+0]*c[1]-in[2*7+0]*c[5]; + tmp1b= in[2*1+1]*c[7]-tb33 +in[2*5+1]*c[1]-in[2*7+1]*c[5]; + tmp2a=in[2*0+0]-in[2*2+0]*c[4]+in[2*4+0]*c[8]+ta66 -in[2*8+0]*c[2]; + tmp2b=in[2*0+1]-in[2*2+1]*c[4]+in[2*4+1]*c[8]+tb66 -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=(in[2*0+1]-in[2*2+1]+in[2*4+1]-in[2*6+1]+in[2*8+1])*hsec_36[4]; + MACRO0(4); + } + } + } + + +} + + +void dct12(REAL *in,REAL *prevblk1,REAL *prevblk2,REAL *wi,REAL *out) { + +#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*=cos1_6; \ + in3*=cos1_6; + +#define DCT12_PART2 \ + in0+=in4*cos2_6; \ + \ + in4=in0+in2; \ + in0-=in2; \ + \ + in1+=in5*cos2_6; \ + \ + in5=(in1+in3)*hsec_12[0]; \ + in1=(in1-in3)*hsec_12[2]; \ + \ + in3=in4+in5; \ + in4-=in5; \ + \ + in2=in0+in1; \ + in0-=in1; + + { + REAL in0,in1,in2,in3,in4,in5; + register REAL *pb1=prevblk1; + out[SBLIMIT*0]=pb1[0];out[SBLIMIT*1]=pb1[1];out[SBLIMIT*2]=pb1[2]; + out[SBLIMIT*3]=pb1[3];out[SBLIMIT*4]=pb1[4];out[SBLIMIT*5]=pb1[5]; + + DCT12_PART1; + + { + REAL tmp0,tmp1=(in0-in4); + { + register REAL tmp2=(in1-in5)*hsec_12[1]; + tmp0=tmp1+tmp2; + tmp1-=tmp2; + } + out[(17-1)*SBLIMIT]=pb1[17-1]+tmp0*wi[11-1]; + out[(12+1)*SBLIMIT]=pb1[12+1]+tmp0*wi[ 6+1]; + out[(6 +1)*SBLIMIT]=pb1[6 +1]+tmp1*wi[ 1 ]; + out[(11-1)*SBLIMIT]=pb1[11-1]+tmp1*wi[ 5-1]; + } + + DCT12_PART2; + out[(17-0)*SBLIMIT]=pb1[17-0]+in2*wi[11-0]; + out[(12+0)*SBLIMIT]=pb1[12+0]+in2*wi[ 6+0]; + out[(12+2)*SBLIMIT]=pb1[12+2]+in3*wi[ 6+2]; + out[(17-2)*SBLIMIT]=pb1[17-2]+in3*wi[11-2]; + + out[( 6+0)*SBLIMIT]=pb1[ 6+0]+in0*wi[0]; + out[(11-0)*SBLIMIT]=pb1[11-0]+in0*wi[5-0]; + out[( 6+2)*SBLIMIT]=pb1[ 6+2]+in4*wi[2]; + out[(11-2)*SBLIMIT]=pb1[11-2]+in4*wi[5-2]; + } + + in++; + { + REAL in0,in1,in2,in3,in4,in5; + register REAL *pb2 = prevblk2; + + DCT12_PART1; + + { + REAL tmp0,tmp1=(in0-in4); + { + REAL tmp2=(in1-in5)*hsec_12[1]; + tmp0=tmp1+tmp2; + tmp1-=tmp2; + } + pb2[5-1]=tmp0*wi[11-1]; + pb2[0+1]=tmp0*wi[6+1]; + out[(12+1)*SBLIMIT]+=tmp1*wi[1]; + out[(17-1)*SBLIMIT]+=tmp1*wi[5-1]; + } + + DCT12_PART2; + + pb2[5-0]=in2*wi[11-0]; + pb2[0+0]=in2*wi[6+0]; + pb2[0+2]=in3*wi[6+2]; + pb2[5-2]=in3*wi[11-2]; + + out[(12+0)*SBLIMIT]+=in0*wi[0]; + out[(17-0)*SBLIMIT]+=in0*wi[5-0]; + out[(12+2)*SBLIMIT]+=in4*wi[2]; + out[(17-2)*SBLIMIT]+=in4*wi[5-2]; + } + + in++; + { + REAL in0,in1,in2,in3,in4,in5; + register REAL *pb2 = prevblk2; + pb2[12]=pb2[13]=pb2[14]=pb2[15]=pb2[16]=pb2[17]=0.0; + + DCT12_PART1; + + { + REAL tmp0,tmp1=(in0-in4); + { + REAL tmp2=(in1-in5)*hsec_12[1]; + tmp0=tmp1+tmp2; + tmp1-=tmp2; + } + pb2[11-1]=tmp0*wi[11-1]; + pb2[ 6+1]=tmp0*wi[6+1]; + pb2[ 0+1]+=tmp1*wi[1]; + pb2[ 5-1]+=tmp1*wi[5-1]; + } + + DCT12_PART2; + pb2[11-0]=in2*wi[11-0]; + pb2[ 6+0]=in2*wi[ 6+0]; + pb2[ 6+2]=in3*wi[ 6+2]; + pb2[11-2]=in3*wi[11-2]; + + pb2[ 0+0]+=in0*wi[0 ]; + pb2[ 5-0]+=in0*wi[5-0]; + pb2[ 0+2]+=in4*wi[2 ]; + pb2[ 5-2]+=in4*wi[5-2]; + } + + +} + + diff --git a/Libraries/DecMPA/Files/src/splay/dct64.cpp b/Libraries/DecMPA/Files/src/splay/dct64.cpp new file mode 100644 index 000000000..5a142f09e --- /dev/null +++ b/Libraries/DecMPA/Files/src/splay/dct64.cpp @@ -0,0 +1,205 @@ +/* + wrapper for dcts + Copyright (C) 2001 Martin Vogt + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Library General Public License as published by + the Free Software Foundation. + + For more information look at the file License.txt in this package + + */ + +//changes 8/4/2002 (by Hauke Duden): +// - added some explicit casts to remove compilation warnings + +#include "common.h" +#include "dct.h" + +ATTR_ALIGN(64) static REAL hcos_64[16]; +ATTR_ALIGN(64) static REAL hcos_32[8]; +ATTR_ALIGN(64) static REAL hcos_16[4]; +ATTR_ALIGN(64) static REAL hcos_8[2]; +ATTR_ALIGN(64) static REAL hcos_4; + +/** + This was some time ago a standalone dct class, + but to get more speed I made it an inline dct + int the filter classes +*/ + +static int dct64Init=false; + +void initialize_dct64() { + if (dct64Init) { + return; + } + dct64Init=true; + + int i; + + for(i=0;i<16;i++) { + hcos_64[i]=(REAL)(1.0/(2.0*cos(MY_PI*double(i*2+1)/64.0))); + } + for(i=0;i< 8;i++) { + hcos_32[i]=(REAL)(1.0/(2.0*cos(MY_PI*double(i*2+1)/32.0))); + } + for(i=0;i< 4;i++) { + hcos_16[i]=(REAL)(1.0/(2.0*cos(MY_PI*double(i*2+1)/16.0))); + } + for(i=0;i< 2;i++) { + hcos_8[i]=(REAL)(1.0/(2.0*cos(MY_PI*double(i*2+1)/ 8.0))); + } + hcos_4=(REAL)(1.0/(2.0*cos(MY_PI*1.0/4.0))); + +} + + + + +// +// splay dct64 , faster than mpeg123 dct. (from decode.c) +// +void dct64(REAL* out1,REAL* out2,REAL *fraction) { + ATTR_ALIGN(64) REAL p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,pa,pb,pc,pd,pe,pf; + ATTR_ALIGN(64) REAL q0,q1,q2,q3,q4,q5,q6,q7,q8,q9,qa,qb,qc,qd,qe,qf; + +#define OUT1(v,t) out1[(32-(v))*16] =(-(out1[(v)*16]=t)) +#define OUT2(v) out2[(96-(v)-32)*16]=out2[((v)-32)*16] + + // compute new values via a fast cosine transform: + { + // put to buffer 0..15 + register REAL* x=fraction; + + p0=x[ 0]+x[31];p1=x[ 1]+x[30];p2=x[ 2]+x[29];p3=x[ 3]+x[28]; + p4=x[ 4]+x[27];p5=x[ 5]+x[26];p6=x[ 6]+x[25];p7=x[ 7]+x[24]; + p8=x[ 8]+x[23];p9=x[ 9]+x[22];pa=x[10]+x[21];pb=x[11]+x[20]; + pc=x[12]+x[19];pd=x[13]+x[18];pe=x[14]+x[17];pf=x[15]+x[16]; + } + + // put to buffer 32..39 + q0=p0+pf;q1=p1+pe;q2=p2+pd;q3=p3+pc; + q4=p4+pb;q5=p5+pa;q6=p6+p9;q7=p7+p8; + // put to buffer 40..47 + q8=hcos_32[0]*(p0-pf);q9=hcos_32[1]*(p1-pe); + qa=hcos_32[2]*(p2-pd);qb=hcos_32[3]*(p3-pc); + qc=hcos_32[4]*(p4-pb);qd=hcos_32[5]*(p5-pa); + qe=hcos_32[6]*(p6-p9);qf=hcos_32[7]*(p7-p8); + + p0=q0+q7;p1=q1+q6;p2=q2+q5;p3=q3+q4; + p4=hcos_16[0]*(q0-q7);p5=hcos_16[1]*(q1-q6); + p6=hcos_16[2]*(q2-q5);p7=hcos_16[3]*(q3-q4); + p8=q8+qf;p9=q9+qe;pa=qa+qd;pb=qb+qc; + pc=hcos_16[0]*(q8-qf);pd=hcos_16[1]*(q9-qe); + pe=hcos_16[2]*(qa-qd);pf=hcos_16[3]*(qb-qc); + + q0=p0+p3;q1=p1+p2;q2=hcos_8[0]*(p0-p3);q3=hcos_8[1]*(p1-p2); + q4=p4+p7;q5=p5+p6;q6=hcos_8[0]*(p4-p7);q7=hcos_8[1]*(p5-p6); + q8=p8+pb;q9=p9+pa;qa=hcos_8[0]*(p8-pb);qb=hcos_8[1]*(p9-pa); + qc=pc+pf;qd=pd+pe;qe=hcos_8[0]*(pc-pf);qf=hcos_8[1]*(pd-pe); + + p0=q0+q1;p1=hcos_4*(q0-q1);p2=q2+q3;p3=hcos_4*(q2-q3); + p4=q4+q5;p5=hcos_4*(q4-q5);p6=q6+q7;p7=hcos_4*(q6-q7); + p8=q8+q9;p9=hcos_4*(q8-q9);pa=qa+qb;pb=hcos_4*(qa-qb); + pc=qc+qd;pd=hcos_4*(qc-qd);pe=qe+qf;pf=hcos_4*(qe-qf); + + { + register REAL tmp; + + tmp=p6+p7; + OUT2(36)=-(p5+tmp); + OUT2(44)=-(p4+tmp); + tmp=pb+pf; + OUT1(10,tmp); + OUT1(6,pd+tmp); + tmp=pe+pf; + OUT2(46)=-(p8+pc+tmp); + OUT2(34)=-(p9+pd+tmp); + tmp+=pa+pb; + OUT2(38)=-(pd+tmp); + OUT2(42)=-(pc+tmp); + OUT1(2,p9+pd+pf); + OUT1(4,p5+p7); + OUT2(48)=-p0; + out2[0]=-(out1[0]=p1); + OUT1( 8,p3); + OUT1(12,p7); + OUT1(14,pf); + OUT2(40)=-(p2+p3); + } + + { + // put to buffer 16..31 + register REAL *x=fraction; + + p0=hcos_64[ 0]*(x[ 0]-x[31]);p1=hcos_64[ 1]*(x[ 1]-x[30]); + p2=hcos_64[ 2]*(x[ 2]-x[29]);p3=hcos_64[ 3]*(x[ 3]-x[28]); + p4=hcos_64[ 4]*(x[ 4]-x[27]);p5=hcos_64[ 5]*(x[ 5]-x[26]); + p6=hcos_64[ 6]*(x[ 6]-x[25]);p7=hcos_64[ 7]*(x[ 7]-x[24]); + p8=hcos_64[ 8]*(x[ 8]-x[23]);p9=hcos_64[ 9]*(x[ 9]-x[22]); + pa=hcos_64[10]*(x[10]-x[21]);pb=hcos_64[11]*(x[11]-x[20]); + pc=hcos_64[12]*(x[12]-x[19]);pd=hcos_64[13]*(x[13]-x[18]); + pe=hcos_64[14]*(x[14]-x[17]);pf=hcos_64[15]*(x[15]-x[16]); + } + + // put to 48..63 + q0=p0+pf;q1=p1+pe;q2=p2+pd;q3=p3+pc; + q4=p4+pb;q5=p5+pa;q6=p6+p9;q7=p7+p8; + q8=hcos_32[0]*(p0-pf);q9=hcos_32[1]*(p1-pe); + qa=hcos_32[2]*(p2-pd);qb=hcos_32[3]*(p3-pc); + qc=hcos_32[4]*(p4-pb);qd=hcos_32[5]*(p5-pa); + qe=hcos_32[6]*(p6-p9);qf=hcos_32[7]*(p7-p8); + + p0=q0+q7;p1=q1+q6;p2=q2+q5;p3=q3+q4; + p4=hcos_16[0]*(q0-q7);p5=hcos_16[1]*(q1-q6); + p6=hcos_16[2]*(q2-q5);p7=hcos_16[3]*(q3-q4); + p8=q8+qf;p9=q9+qe;pa=qa+qd;pb=qb+qc; + pc=hcos_16[0]*(q8-qf);pd=hcos_16[1]*(q9-qe); + pe=hcos_16[2]*(qa-qd);pf=hcos_16[3]*(qb-qc); + + q0=p0+p3;q1=p1+p2;q2=hcos_8[0]*(p0-p3);q3=hcos_8[1]*(p1-p2); + q4=p4+p7;q5=p5+p6;q6=hcos_8[0]*(p4-p7);q7=hcos_8[1]*(p5-p6); + q8=p8+pb;q9=p9+pa;qa=hcos_8[0]*(p8-pb);qb=hcos_8[1]*(p9-pa); + qc=pc+pf;qd=pd+pe;qe=hcos_8[0]*(pc-pf);qf=hcos_8[1]*(pd-pe); + + p0=q0+q1;p1=hcos_4*(q0-q1); + p2=q2+q3;p3=hcos_4*(q2-q3); + p4=q4+q5;p5=hcos_4*(q4-q5); + p6=q6+q7;p7=hcos_4*(q6-q7); + p8=q8+q9;p9=hcos_4*(q8-q9); + pa=qa+qb;pb=hcos_4*(qa-qb); + pc=qc+qd;pd=hcos_4*(qc-qd); + pe=qe+qf;pf=hcos_4*(qe-qf); + + { + REAL tmp; + + tmp=pd+pf; + OUT1(5,p5+p7+pb+tmp); + tmp+=p9; + OUT1(1,p1+tmp); + OUT2(33)=-(p1+pe+tmp); + tmp+=p5+p7; + OUT1(3,tmp); + OUT2(35)=-(p6+pe+tmp); + tmp=pa+pb+pc+pd+pe+pf; + OUT2(39)=-(p2+p3+tmp-pc); + OUT2(43)=-(p4+p6+p7+tmp-pd); + OUT2(37)=-(p5+p6+p7+tmp-pc); + OUT2(41)=-(p2+p3+tmp-pd); + tmp=p8+pc+pe+pf; + OUT2(47)=-(p0+tmp); + OUT2(45)=-(p4+p6+p7+tmp); + tmp=pb+pf; + OUT1(11,p7+tmp); + tmp+=p3; + OUT1( 9,tmp); + OUT1( 7,pd+tmp); + OUT1(13,p7+pf); + OUT1(15,pf); + } + +} + + diff --git a/Libraries/DecMPA/Files/src/splay/dct64_down.cpp b/Libraries/DecMPA/Files/src/splay/dct64_down.cpp new file mode 100644 index 000000000..09d907eef --- /dev/null +++ b/Libraries/DecMPA/Files/src/splay/dct64_down.cpp @@ -0,0 +1,215 @@ +/* + wrapper for dcts + Copyright (C) 2001 Martin Vogt + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Library General Public License as published by + the Free Software Foundation. + + For more information look at the file License.txt in this package + + */ + +//changes 8/4/2002 (by Hauke Duden): +// - added some explicit casts to remove compilation warnings + +#include "common.h" +#include "dct.h" + + +ATTR_ALIGN(64) static REAL hcos_64_down[16]; +ATTR_ALIGN(64) static REAL hcos_32_down[8]; +ATTR_ALIGN(64) static REAL hcos_16_down[4]; +ATTR_ALIGN(64) static REAL hcos_8_down[2]; +ATTR_ALIGN(64) static REAL hcos_4_down; + +/** + This was some time ago a standalone dct class, + but to get more speed I made it an inline dct + int the filter classes +*/ + +static int dctInit=false; + +void initialize_dct64_downsample() { + if (dctInit) { + return; + } + dctInit=true; + + int i; + + for(i=0;i<16;i++) { + hcos_64_down[i]=(REAL)(1.0/(2.0*cos(MY_PI*double(i*2+1)/64.0))); + } + for(i=0;i< 8;i++) { + hcos_32_down[i]=(REAL)(1.0/(2.0*cos(MY_PI*double(i*2+1)/32.0))); + } + for(i=0;i< 4;i++) { + hcos_16_down[i]=(REAL)(1.0/(2.0*cos(MY_PI*double(i*2+1)/16.0))); + } + for(i=0;i< 2;i++) { + hcos_8_down[i]=(REAL)(1.0/(2.0*cos(MY_PI*double(i*2+1)/ 8.0))); + } + hcos_4_down=(REAL)(1.0/(2.0*cos(MY_PI*1.0/4.0))); + +} + +void dct64_downsample(REAL* out1,REAL* out2,REAL *fraction) { + REAL p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,pa,pb,pc,pd,pe,pf; + REAL q0,q1,q2,q3,q4,q5,q6,q7,q8,q9,qa,qb,qc,qd,qe,qf; + +#define OUT1(v,t) out1[(32-(v))*16] =(-(out1[(v)*16]=t)) +#define OUT2(v) out2[(96-(v)-32)*16]=out2[((v)-32)*16] + + // compute new values via a fast cosine transform: + /* { + register REAL *x=fraction; + + p0=x[ 0]+x[31];p1=x[ 1]+x[30];p2=x[ 2]+x[29];p3=x[ 3]+x[28]; + p4=x[ 4]+x[27];p5=x[ 5]+x[26];p6=x[ 6]+x[25];p7=x[ 7]+x[24]; + p8=x[ 8]+x[23];p9=x[ 9]+x[22];pa=x[10]+x[21];pb=x[11]+x[20]; + pc=x[12]+x[19];pd=x[13]+x[18];pe=x[14]+x[17];pf=x[15]+x[16]; + } + + q0=p0+pf;q1=p1+pe;q2=p2+pd;q3=p3+pc; + q4=p4+pb;q5=p5+pa;q6=p6+p9;q7=p7+p8; + q8=hcos_32_down[0]*(p0-pf);q9=hcos_32_down[1]*(p1-pe); + qa=hcos_32_down[2]*(p2-pd);qb=hcos_32_down[3]*(p3-pc); + qc=hcos_32_down[4]*(p4-pb);qd=hcos_32_down[5]*(p5-pa); + qe=hcos_32_down[6]*(p6-p9);qf=hcos_32_down[7]*(p7-p8); */ + + { + + register REAL *x=fraction; + + q0=x[ 0]+x[15];q1=x[ 1]+x[14];q2=x[ 2]+x[13];q3=x[ 3]+x[12]; + q4=x[ 4]+x[11];q5=x[ 5]+x[10];q6=x[ 6]+x[ 9];q7=x[ 7]+x[ 8]; + + q8=hcos_32_down[0]*(x[ 0]-x[15]);q9=hcos_32_down[1]*(x[ 1]-x[14]); + qa=hcos_32_down[2]*(x[ 2]-x[13]);qb=hcos_32_down[3]*(x[ 3]-x[12]); + qc=hcos_32_down[4]*(x[ 4]-x[11]);qd=hcos_32_down[5]*(x[ 5]-x[10]); + qe=hcos_32_down[6]*(x[ 6]-x[ 9]);qf=hcos_32_down[7]*(x[ 7]-x[ 8]); + } + + p0=q0+q7;p1=q1+q6;p2=q2+q5;p3=q3+q4; + p4=hcos_16_down[0]*(q0-q7);p5=hcos_16_down[1]*(q1-q6); + p6=hcos_16_down[2]*(q2-q5);p7=hcos_16_down[3]*(q3-q4); + p8=q8+qf;p9=q9+qe;pa=qa+qd;pb=qb+qc; + pc=hcos_16_down[0]*(q8-qf);pd=hcos_16_down[1]*(q9-qe); + pe=hcos_16_down[2]*(qa-qd);pf=hcos_16_down[3]*(qb-qc); + + q0=p0+p3;q1=p1+p2;q2=hcos_8_down[0]*(p0-p3);q3=hcos_8_down[1]*(p1-p2); + q4=p4+p7;q5=p5+p6;q6=hcos_8_down[0]*(p4-p7);q7=hcos_8_down[1]*(p5-p6); + q8=p8+pb;q9=p9+pa;qa=hcos_8_down[0]*(p8-pb);qb=hcos_8_down[1]*(p9-pa); + qc=pc+pf;qd=pd+pe;qe=hcos_8_down[0]*(pc-pf);qf=hcos_8_down[1]*(pd-pe); + + p0=q0+q1;p1=hcos_4_down*(q0-q1);p2=q2+q3;p3=hcos_4_down*(q2-q3); + p4=q4+q5;p5=hcos_4_down*(q4-q5);p6=q6+q7;p7=hcos_4_down*(q6-q7); + p8=q8+q9;p9=hcos_4_down*(q8-q9);pa=qa+qb;pb=hcos_4_down*(qa-qb); + pc=qc+qd;pd=hcos_4_down*(qc-qd);pe=qe+qf;pf=hcos_4_down*(qe-qf); + + { + register REAL tmp; + + tmp=p6+p7; + OUT2(36)=-(p5+tmp); + OUT2(44)=-(p4+tmp); + tmp=pb+pf; + OUT1(10,tmp); + OUT1(6,pd+tmp); + tmp=pe+pf; + OUT2(46)=-(p8+pc+tmp); + OUT2(34)=-(p9+pd+tmp); + tmp+=pa+pb; + OUT2(38)=-(pd+tmp); + OUT2(42)=-(pc+tmp); + OUT1(2,p9+pd+pf); + OUT1(4,p5+p7); + OUT2(48)=-p0; + out2[0]=-(out1[0]=p1); + OUT1( 8,p3); + OUT1(12,p7); + OUT1(14,pf); + OUT2(40)=-(p2+p3); + } + + { + register REAL *x=fraction; + + /* p0=hcos_64_down[ 0]*(x[ 0]-x[31]);p1=hcos_64_down[ 1]*(x[ 1]-x[30]); + p2=hcos_64_down[ 2]*(x[ 2]-x[29]);p3=hcos_64_down[ 3]*(x[ 3]-x[28]); + p4=hcos_64_down[ 4]*(x[ 4]-x[27]);p5=hcos_64_down[ 5]*(x[ 5]-x[26]); + p6=hcos_64_down[ 6]*(x[ 6]-x[25]);p7=hcos_64_down[ 7]*(x[ 7]-x[24]); + p8=hcos_64_down[ 8]*(x[ 8]-x[23]);p9=hcos_64_down[ 9]*(x[ 9]-x[22]); + pa=hcos_64_down[10]*(x[10]-x[21]);pb=hcos_64_down[11]*(x[11]-x[20]); + pc=hcos_64_down[12]*(x[12]-x[19]);pd=hcos_64_down[13]*(x[13]-x[18]); + pe=hcos_64_down[14]*(x[14]-x[17]);pf=hcos_64_down[15]*(x[15]-x[16]); */ + + p0=hcos_64_down[ 0]*x[ 0];p1=hcos_64_down[ 1]*x[ 1]; + p2=hcos_64_down[ 2]*x[ 2];p3=hcos_64_down[ 3]*x[ 3]; + p4=hcos_64_down[ 4]*x[ 4];p5=hcos_64_down[ 5]*x[ 5]; + p6=hcos_64_down[ 6]*x[ 6];p7=hcos_64_down[ 7]*x[ 7]; + p8=hcos_64_down[ 8]*x[ 8];p9=hcos_64_down[ 9]*x[ 9]; + pa=hcos_64_down[10]*x[10];pb=hcos_64_down[11]*x[11]; + pc=hcos_64_down[12]*x[12];pd=hcos_64_down[13]*x[13]; + pe=hcos_64_down[14]*x[14];pf=hcos_64_down[15]*x[15]; + } + + q0=p0+pf;q1=p1+pe;q2=p2+pd;q3=p3+pc; + q4=p4+pb;q5=p5+pa;q6=p6+p9;q7=p7+p8; + q8=hcos_32_down[0]*(p0-pf);q9=hcos_32_down[1]*(p1-pe); + qa=hcos_32_down[2]*(p2-pd);qb=hcos_32_down[3]*(p3-pc); + qc=hcos_32_down[4]*(p4-pb);qd=hcos_32_down[5]*(p5-pa); + qe=hcos_32_down[6]*(p6-p9);qf=hcos_32_down[7]*(p7-p8); + + p0=q0+q7;p1=q1+q6;p2=q2+q5;p3=q3+q4; + p4=hcos_16_down[0]*(q0-q7);p5=hcos_16_down[1]*(q1-q6); + p6=hcos_16_down[2]*(q2-q5);p7=hcos_16_down[3]*(q3-q4); + p8=q8+qf;p9=q9+qe;pa=qa+qd;pb=qb+qc; + pc=hcos_16_down[0]*(q8-qf);pd=hcos_16_down[1]*(q9-qe); + pe=hcos_16_down[2]*(qa-qd);pf=hcos_16_down[3]*(qb-qc); + + q0=p0+p3;q1=p1+p2;q2=hcos_8_down[0]*(p0-p3);q3=hcos_8_down[1]*(p1-p2); + q4=p4+p7;q5=p5+p6;q6=hcos_8_down[0]*(p4-p7);q7=hcos_8_down[1]*(p5-p6); + q8=p8+pb;q9=p9+pa;qa=hcos_8_down[0]*(p8-pb);qb=hcos_8_down[1]*(p9-pa); + qc=pc+pf;qd=pd+pe;qe=hcos_8_down[0]*(pc-pf);qf=hcos_8_down[1]*(pd-pe); + + p0=q0+q1;p1=hcos_4_down*(q0-q1); + p2=q2+q3;p3=hcos_4_down*(q2-q3); + p4=q4+q5;p5=hcos_4_down*(q4-q5); + p6=q6+q7;p7=hcos_4_down*(q6-q7); + p8=q8+q9;p9=hcos_4_down*(q8-q9); + pa=qa+qb;pb=hcos_4_down*(qa-qb); + pc=qc+qd;pd=hcos_4_down*(qc-qd); + pe=qe+qf;pf=hcos_4_down*(qe-qf); + + { + REAL tmp; + + tmp=pd+pf; + OUT1(5,p5+p7+pb+tmp); + tmp+=p9; + OUT1(1,p1+tmp); + OUT2(33)=-(p1+pe+tmp); + tmp+=p5+p7; + OUT1(3,tmp); + OUT2(35)=-(p6+pe+tmp); + tmp=pa+pb+pc+pd+pe+pf; + OUT2(39)=-(p2+p3+tmp-pc); + OUT2(43)=-(p4+p6+p7+tmp-pd); + OUT2(37)=-(p5+p6+p7+tmp-pc); + OUT2(41)=-(p2+p3+tmp-pd); + tmp=p8+pc+pe+pf; + OUT2(47)=-(p0+tmp); + OUT2(45)=-(p4+p6+p7+tmp); + tmp=pb+pf; + OUT1(11,p7+tmp); + tmp+=p3; + OUT1( 9,tmp); + OUT1( 7,pd+tmp); + OUT1(13,p7+pf); + OUT1(15,pf); + } +} + diff --git a/Libraries/DecMPA/Files/src/splay/huffmanlookup.cpp b/Libraries/DecMPA/Files/src/splay/huffmanlookup.cpp new file mode 100644 index 000000000..028adb727 --- /dev/null +++ b/Libraries/DecMPA/Files/src/splay/huffmanlookup.cpp @@ -0,0 +1,124 @@ + /* + + Copyright (C) 2000 Stefan Westerfeld + stefan@space.twc.de + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. + + */ + +//changes 8/11/2002 (by Hauke Duden): +// - removed unnecessary includes + +#include "huffmanlookup.h" + +//#include + + + + +struct HuffmanLookup::decodeData HuffmanLookup::qdecode[32][256]; +/* for initialization */ +static HuffmanLookup l; + +HuffmanLookup::HuffmanLookup() +{ + int table,p,x,y; + + for(table = 0; table < 32; table++) + { + // 8 bits pattern + for(p = 0; p < 256; p++) + { + bits = 24; + pattern = (p << 16); + + huffmandecoder_1(&Mpegtoraw::ht[table], &x,&y); + + int used = 24 - bits; + qdecode[table][p].skip = (used <= 8)?used:0; + qdecode[table][p].x = x; + qdecode[table][p].y = y; + } + } +} + +int HuffmanLookup::wgetbit() +{ + return (pattern >> --bits) & 1; +} + +int HuffmanLookup::wgetbits (int b) +{ + bits -= b; + return (pattern >> bits) & ((1 << b) - 1); +} + +void HuffmanLookup::huffmandecoder_1(const HUFFMANCODETABLE *h, int *x, int *y) +{ + typedef unsigned int HUFFBITS; + + HUFFBITS level=(1<<(sizeof(HUFFBITS)*8-1)); + int point=0; + /* Lookup in Huffman table. */ + for(;;) + { + if(h->val[point][0]==0) + { /*end of tree*/ + int xx,yy; + + xx=h->val[point][1]>>4; + yy=h->val[point][1]&0xf; + + if(h->linbits) + { + if((h->xlen)==(unsigned)xx)xx+=wgetbits(h->linbits); + if(xx)if(wgetbit())xx=-xx; + if((h->ylen)==(unsigned)yy)yy+=wgetbits(h->linbits); + if(yy)if(wgetbit())yy=-yy; + } + else + { + if(xx)if(wgetbit())xx=-xx; + if(yy)if(wgetbit())yy=-yy; + } + *x=xx;*y=yy; + break; + } + + point+=h->val[point][wgetbit()]; + + level>>=1; + if(!(level || ((unsigned)pointtreelen))) + { + register int xx,yy; + + xx=(h->xlen<<1);// set x and y to a medium value as a simple concealment + yy=(h->ylen<<1); + + // h->xlen and h->ylen can't be 1 under tablename 32 + // if(xx) + if(wgetbit())xx=-xx; + // if(yy) + if(wgetbit())yy=-yy; + + *x=xx;*y=yy; + break; + } + } +} + + diff --git a/Libraries/DecMPA/Files/src/splay/huffmanlookup.h b/Libraries/DecMPA/Files/src/splay/huffmanlookup.h new file mode 100644 index 000000000..a5bdb26c4 --- /dev/null +++ b/Libraries/DecMPA/Files/src/splay/huffmanlookup.h @@ -0,0 +1,57 @@ + /* + + Copyright (C) 2000 Stefan Westerfeld + stefan@space.twc.de + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. + + */ + +#ifndef __HUFFMANLOOKUP_H +#define __HUFFMANLOOKUP_H +#include "mpegsound.h" + +/* + * This class speeds up the huffman table decoding by largely replacing it + * by a table lookup. It uses the fact that the huffman tables don't change, + * and that given a byte of the bitstream, we can predict what the result + * will be (without reading it bit by bit). + */ + +class HuffmanLookup { +private: + long pattern, bits; + int wgetbit(); + int wgetbits (int b); + void huffmandecoder_1(const HUFFMANCODETABLE *h,int *x, int *y); + + ATTR_ALIGN(64) static struct decodeData { + int x : 8; + int y : 8; + int skip : 16; + } qdecode[32][256]; +public: + HuffmanLookup(); + + static int decode(int table, int pattern, int* x, int* y) + { + *x = qdecode[table][pattern].x; + *y = qdecode[table][pattern].y; + return qdecode[table][pattern].skip; + } +}; + +#endif diff --git a/Libraries/DecMPA/Files/src/splay/huffmantable.cpp b/Libraries/DecMPA/Files/src/splay/huffmantable.cpp new file mode 100644 index 000000000..df7e620b4 --- /dev/null +++ b/Libraries/DecMPA/Files/src/splay/huffmantable.cpp @@ -0,0 +1,584 @@ +/* MPEG/WAVE Sound library + + (C) 1997 by Jung woo-jae */ + +// Huffmantable.cc +// It contains initialized huffman table for MPEG layer 3 + + +#include "mpegsound.h" + +static const unsigned int +htd01[ 7][2]={{ 2, 1},{ 0, 0},{ 2, 1},{ 0, 16},{ 2, 1},{ 0, 1}, + { 0, 17}}, + +htd02[ 17][2]={{ 2, 1},{ 0, 0},{ 4, 1},{ 2, 1},{ 0, 16},{ 0, 1}, + { 2, 1},{ 0, 17},{ 4, 1},{ 2, 1},{ 0, 32},{ 0, 33}, + { 2, 1},{ 0, 18},{ 2, 1},{ 0, 2},{ 0, 34}}, + +htd03[ 17][2]={{ 4, 1},{ 2, 1},{ 0, 0},{ 0, 1},{ 2, 1},{ 0, 17}, + { 2, 1},{ 0, 16},{ 4, 1},{ 2, 1},{ 0, 32},{ 0, 33}, + { 2, 1},{ 0, 18},{ 2, 1},{ 0, 2},{ 0, 34}}, + +htd05[ 31][2]={{ 2, 1},{ 0, 0},{ 4, 1},{ 2, 1},{ 0, 16},{ 0, 1}, + { 2, 1},{ 0, 17},{ 8, 1},{ 4, 1},{ 2, 1},{ 0, 32}, + { 0, 2},{ 2, 1},{ 0, 33},{ 0, 18},{ 8, 1},{ 4, 1}, + { 2, 1},{ 0, 34},{ 0, 48},{ 2, 1},{ 0, 3},{ 0, 19}, + { 2, 1},{ 0, 49},{ 2, 1},{ 0, 50},{ 2, 1},{ 0, 35}, + { 0, 51}}, + +htd06[ 31][2]={{ 6, 1},{ 4, 1},{ 2, 1},{ 0, 0},{ 0, 16},{ 0, 17}, + { 6, 1},{ 2, 1},{ 0, 1},{ 2, 1},{ 0, 32},{ 0, 33}, + { 6, 1},{ 2, 1},{ 0, 18},{ 2, 1},{ 0, 2},{ 0, 34}, + { 4, 1},{ 2, 1},{ 0, 49},{ 0, 19},{ 4, 1},{ 2, 1}, + { 0, 48},{ 0, 50},{ 2, 1},{ 0, 35},{ 2, 1},{ 0, 3}, + { 0, 51}}, + +htd07[ 71][2]={{ 2, 1},{ 0, 0},{ 4, 1},{ 2, 1},{ 0, 16},{ 0, 1}, + { 8, 1},{ 2, 1},{ 0, 17},{ 4, 1},{ 2, 1},{ 0, 32}, + { 0, 2},{ 0, 33},{ 18, 1},{ 6, 1},{ 2, 1},{ 0, 18}, + { 2, 1},{ 0, 34},{ 0, 48},{ 4, 1},{ 2, 1},{ 0, 49}, + { 0, 19},{ 4, 1},{ 2, 1},{ 0, 3},{ 0, 50},{ 2, 1}, + { 0, 35},{ 0, 4},{ 10, 1},{ 4, 1},{ 2, 1},{ 0, 64}, + { 0, 65},{ 2, 1},{ 0, 20},{ 2, 1},{ 0, 66},{ 0, 36}, + { 12, 1},{ 6, 1},{ 4, 1},{ 2, 1},{ 0, 51},{ 0, 67}, + { 0, 80},{ 4, 1},{ 2, 1},{ 0, 52},{ 0, 5},{ 0, 81}, + { 6, 1},{ 2, 1},{ 0, 21},{ 2, 1},{ 0, 82},{ 0, 37}, + + { 4, 1},{ 2, 1},{ 0, 68},{ 0, 53},{ 4, 1},{ 2, 1}, + { 0, 83},{ 0, 84},{ 2, 1},{ 0, 69},{ 0, 85}}, + +htd08[ 71][2]={{ 6, 1},{ 2, 1},{ 0, 0},{ 2, 1},{ 0, 16},{ 0, 1}, + { 2, 1},{ 0, 17},{ 4, 1},{ 2, 1},{ 0, 33},{ 0, 18}, + { 14, 1},{ 4, 1},{ 2, 1},{ 0, 32},{ 0, 2},{ 2, 1}, + { 0, 34},{ 4, 1},{ 2, 1},{ 0, 48},{ 0, 3},{ 2, 1}, + { 0, 49},{ 0, 19},{ 14, 1},{ 8, 1},{ 4, 1},{ 2, 1}, + { 0, 50},{ 0, 35},{ 2, 1},{ 0, 64},{ 0, 4},{ 2, 1}, + { 0, 65},{ 2, 1},{ 0, 20},{ 0, 66},{ 12, 1},{ 6, 1}, + { 2, 1},{ 0, 36},{ 2, 1},{ 0, 51},{ 0, 80},{ 4, 1}, + { 2, 1},{ 0, 67},{ 0, 52},{ 0, 81},{ 6, 1},{ 2, 1}, + { 0, 21},{ 2, 1},{ 0, 5},{ 0, 82},{ 6, 1},{ 2, 1}, + + { 0, 37},{ 2, 1},{ 0, 68},{ 0, 53},{ 2, 1},{ 0, 83}, + { 2, 1},{ 0, 69},{ 2, 1},{ 0, 84},{ 0, 85}}, + +htd09[ 71][2]={{ 8, 1},{ 4, 1},{ 2, 1},{ 0, 0},{ 0, 16},{ 2, 1}, + { 0, 1},{ 0, 17},{ 10, 1},{ 4, 1},{ 2, 1},{ 0, 32}, + { 0, 33},{ 2, 1},{ 0, 18},{ 2, 1},{ 0, 2},{ 0, 34}, + { 12, 1},{ 6, 1},{ 4, 1},{ 2, 1},{ 0, 48},{ 0, 3}, + { 0, 49},{ 2, 1},{ 0, 19},{ 2, 1},{ 0, 50},{ 0, 35}, + { 12, 1},{ 4, 1},{ 2, 1},{ 0, 65},{ 0, 20},{ 4, 1}, + { 2, 1},{ 0, 64},{ 0, 51},{ 2, 1},{ 0, 66},{ 0, 36}, + { 10, 1},{ 6, 1},{ 4, 1},{ 2, 1},{ 0, 4},{ 0, 80}, + { 0, 67},{ 2, 1},{ 0, 52},{ 0, 81},{ 8, 1},{ 4, 1}, + { 2, 1},{ 0, 21},{ 0, 82},{ 2, 1},{ 0, 37},{ 0, 68}, + + { 6, 1},{ 4, 1},{ 2, 1},{ 0, 5},{ 0, 84},{ 0, 83}, + { 2, 1},{ 0, 53},{ 2, 1},{ 0, 69},{ 0, 85}}, + +htd10[127][2]={{ 2, 1},{ 0, 0},{ 4, 1},{ 2, 1},{ 0, 16},{ 0, 1}, + { 10, 1},{ 2, 1},{ 0, 17},{ 4, 1},{ 2, 1},{ 0, 32}, + { 0, 2},{ 2, 1},{ 0, 33},{ 0, 18},{ 28, 1},{ 8, 1}, + { 4, 1},{ 2, 1},{ 0, 34},{ 0, 48},{ 2, 1},{ 0, 49}, + { 0, 19},{ 8, 1},{ 4, 1},{ 2, 1},{ 0, 3},{ 0, 50}, + { 2, 1},{ 0, 35},{ 0, 64},{ 4, 1},{ 2, 1},{ 0, 65}, + { 0, 20},{ 4, 1},{ 2, 1},{ 0, 4},{ 0, 51},{ 2, 1}, + { 0, 66},{ 0, 36},{ 28, 1},{ 10, 1},{ 6, 1},{ 4, 1}, + { 2, 1},{ 0, 80},{ 0, 5},{ 0, 96},{ 2, 1},{ 0, 97}, + { 0, 22},{ 12, 1},{ 6, 1},{ 4, 1},{ 2, 1},{ 0, 67}, + + { 0, 52},{ 0, 81},{ 2, 1},{ 0, 21},{ 2, 1},{ 0, 82}, + { 0, 37},{ 4, 1},{ 2, 1},{ 0, 38},{ 0, 54},{ 0,113}, + { 20, 1},{ 8, 1},{ 2, 1},{ 0, 23},{ 4, 1},{ 2, 1}, + { 0, 68},{ 0, 83},{ 0, 6},{ 6, 1},{ 4, 1},{ 2, 1}, + { 0, 53},{ 0, 69},{ 0, 98},{ 2, 1},{ 0,112},{ 2, 1}, + { 0, 7},{ 0,100},{ 14, 1},{ 4, 1},{ 2, 1},{ 0,114}, + { 0, 39},{ 6, 1},{ 2, 1},{ 0, 99},{ 2, 1},{ 0, 84}, + { 0, 85},{ 2, 1},{ 0, 70},{ 0,115},{ 8, 1},{ 4, 1}, + { 2, 1},{ 0, 55},{ 0,101},{ 2, 1},{ 0, 86},{ 0,116}, + { 6, 1},{ 2, 1},{ 0, 71},{ 2, 1},{ 0,102},{ 0,117}, + + { 4, 1},{ 2, 1},{ 0, 87},{ 0,118},{ 2, 1},{ 0,103}, + { 0,119}}, + +htd11[127][2]={{ 6, 1},{ 2, 1},{ 0, 0},{ 2, 1},{ 0, 16},{ 0, 1}, + { 8, 1},{ 2, 1},{ 0, 17},{ 4, 1},{ 2, 1},{ 0, 32}, + { 0, 2},{ 0, 18},{ 24, 1},{ 8, 1},{ 2, 1},{ 0, 33}, + { 2, 1},{ 0, 34},{ 2, 1},{ 0, 48},{ 0, 3},{ 4, 1}, + { 2, 1},{ 0, 49},{ 0, 19},{ 4, 1},{ 2, 1},{ 0, 50}, + { 0, 35},{ 4, 1},{ 2, 1},{ 0, 64},{ 0, 4},{ 2, 1}, + { 0, 65},{ 0, 20},{ 30, 1},{ 16, 1},{ 10, 1},{ 4, 1}, + { 2, 1},{ 0, 66},{ 0, 36},{ 4, 1},{ 2, 1},{ 0, 51}, + { 0, 67},{ 0, 80},{ 4, 1},{ 2, 1},{ 0, 52},{ 0, 81}, + { 0, 97},{ 6, 1},{ 2, 1},{ 0, 22},{ 2, 1},{ 0, 6}, + + { 0, 38},{ 2, 1},{ 0, 98},{ 2, 1},{ 0, 21},{ 2, 1}, + { 0, 5},{ 0, 82},{ 16, 1},{ 10, 1},{ 6, 1},{ 4, 1}, + { 2, 1},{ 0, 37},{ 0, 68},{ 0, 96},{ 2, 1},{ 0, 99}, + { 0, 54},{ 4, 1},{ 2, 1},{ 0,112},{ 0, 23},{ 0,113}, + { 16, 1},{ 6, 1},{ 4, 1},{ 2, 1},{ 0, 7},{ 0,100}, + { 0,114},{ 2, 1},{ 0, 39},{ 4, 1},{ 2, 1},{ 0, 83}, + { 0, 53},{ 2, 1},{ 0, 84},{ 0, 69},{ 10, 1},{ 4, 1}, + { 2, 1},{ 0, 70},{ 0,115},{ 2, 1},{ 0, 55},{ 2, 1}, + { 0,101},{ 0, 86},{ 10, 1},{ 6, 1},{ 4, 1},{ 2, 1}, + { 0, 85},{ 0, 87},{ 0,116},{ 2, 1},{ 0, 71},{ 0,102}, + + { 4, 1},{ 2, 1},{ 0,117},{ 0,118},{ 2, 1},{ 0,103}, + { 0,119}}, + +htd12[127][2]={{ 12, 1},{ 4, 1},{ 2, 1},{ 0, 16},{ 0, 1},{ 2, 1}, + { 0, 17},{ 2, 1},{ 0, 0},{ 2, 1},{ 0, 32},{ 0, 2}, + { 16, 1},{ 4, 1},{ 2, 1},{ 0, 33},{ 0, 18},{ 4, 1}, + { 2, 1},{ 0, 34},{ 0, 49},{ 2, 1},{ 0, 19},{ 2, 1}, + { 0, 48},{ 2, 1},{ 0, 3},{ 0, 64},{ 26, 1},{ 8, 1}, + { 4, 1},{ 2, 1},{ 0, 50},{ 0, 35},{ 2, 1},{ 0, 65}, + { 0, 51},{ 10, 1},{ 4, 1},{ 2, 1},{ 0, 20},{ 0, 66}, + { 2, 1},{ 0, 36},{ 2, 1},{ 0, 4},{ 0, 80},{ 4, 1}, + { 2, 1},{ 0, 67},{ 0, 52},{ 2, 1},{ 0, 81},{ 0, 21}, + { 28, 1},{ 14, 1},{ 8, 1},{ 4, 1},{ 2, 1},{ 0, 82}, + + { 0, 37},{ 2, 1},{ 0, 83},{ 0, 53},{ 4, 1},{ 2, 1}, + { 0, 96},{ 0, 22},{ 0, 97},{ 4, 1},{ 2, 1},{ 0, 98}, + { 0, 38},{ 6, 1},{ 4, 1},{ 2, 1},{ 0, 5},{ 0, 6}, + { 0, 68},{ 2, 1},{ 0, 84},{ 0, 69},{ 18, 1},{ 10, 1}, + { 4, 1},{ 2, 1},{ 0, 99},{ 0, 54},{ 4, 1},{ 2, 1}, + { 0,112},{ 0, 7},{ 0,113},{ 4, 1},{ 2, 1},{ 0, 23}, + { 0,100},{ 2, 1},{ 0, 70},{ 0,114},{ 10, 1},{ 6, 1}, + { 2, 1},{ 0, 39},{ 2, 1},{ 0, 85},{ 0,115},{ 2, 1}, + { 0, 55},{ 0, 86},{ 8, 1},{ 4, 1},{ 2, 1},{ 0,101}, + { 0,116},{ 2, 1},{ 0, 71},{ 0,102},{ 4, 1},{ 2, 1}, + + { 0,117},{ 0, 87},{ 2, 1},{ 0,118},{ 2, 1},{ 0,103}, + { 0,119}}, + +htd13[511][2]={{ 2, 1},{ 0, 0},{ 6, 1},{ 2, 1},{ 0, 16},{ 2, 1}, + { 0, 1},{ 0, 17},{ 28, 1},{ 8, 1},{ 4, 1},{ 2, 1}, + { 0, 32},{ 0, 2},{ 2, 1},{ 0, 33},{ 0, 18},{ 8, 1}, + { 4, 1},{ 2, 1},{ 0, 34},{ 0, 48},{ 2, 1},{ 0, 3}, + { 0, 49},{ 6, 1},{ 2, 1},{ 0, 19},{ 2, 1},{ 0, 50}, + { 0, 35},{ 4, 1},{ 2, 1},{ 0, 64},{ 0, 4},{ 0, 65}, + { 70, 1},{ 28, 1},{ 14, 1},{ 6, 1},{ 2, 1},{ 0, 20}, + { 2, 1},{ 0, 51},{ 0, 66},{ 4, 1},{ 2, 1},{ 0, 36}, + { 0, 80},{ 2, 1},{ 0, 67},{ 0, 52},{ 4, 1},{ 2, 1}, + { 0, 81},{ 0, 21},{ 4, 1},{ 2, 1},{ 0, 5},{ 0, 82}, // 60 + + { 2, 1},{ 0, 37},{ 2, 1},{ 0, 68},{ 0, 83},{ 14, 1}, + { 8, 1},{ 4, 1},{ 2, 1},{ 0, 96},{ 0, 6},{ 2, 1}, + { 0, 97},{ 0, 22},{ 4, 1},{ 2, 1},{ 0,128},{ 0, 8}, + { 0,129},{ 16, 1},{ 8, 1},{ 4, 1},{ 2, 1},{ 0, 53}, + { 0, 98},{ 2, 1},{ 0, 38},{ 0, 84},{ 4, 1},{ 2, 1}, + { 0, 69},{ 0, 99},{ 2, 1},{ 0, 54},{ 0,112},{ 6, 1}, + { 4, 1},{ 2, 1},{ 0, 7},{ 0, 85},{ 0,113},{ 2, 1}, + { 0, 23},{ 2, 1},{ 0, 39},{ 0, 55},{ 72, 1},{ 24, 1}, + { 12, 1},{ 4, 1},{ 2, 1},{ 0, 24},{ 0,130},{ 2, 1}, + { 0, 40},{ 4, 1},{ 2, 1},{ 0,100},{ 0, 70},{ 0,114}, // 120 + + { 8, 1},{ 4, 1},{ 2, 1},{ 0,132},{ 0, 72},{ 2, 1}, + { 0,144},{ 0, 9},{ 2, 1},{ 0,145},{ 0, 25},{ 24, 1}, + { 14, 1},{ 8, 1},{ 4, 1},{ 2, 1},{ 0,115},{ 0,101}, + { 2, 1},{ 0, 86},{ 0,116},{ 4, 1},{ 2, 1},{ 0, 71}, + { 0,102},{ 0,131},{ 6, 1},{ 2, 1},{ 0, 56},{ 2, 1}, + { 0,117},{ 0, 87},{ 2, 1},{ 0,146},{ 0, 41},{ 14, 1}, + { 8, 1},{ 4, 1},{ 2, 1},{ 0,103},{ 0,133},{ 2, 1}, + { 0, 88},{ 0, 57},{ 2, 1},{ 0,147},{ 2, 1},{ 0, 73}, + { 0,134},{ 6, 1},{ 2, 1},{ 0,160},{ 2, 1},{ 0,104}, + { 0, 10},{ 2, 1},{ 0,161},{ 0, 26},{ 68, 1},{ 24, 1}, // 180 + + { 12, 1},{ 4, 1},{ 2, 1},{ 0,162},{ 0, 42},{ 4, 1}, + { 2, 1},{ 0,149},{ 0, 89},{ 2, 1},{ 0,163},{ 0, 58}, + { 8, 1},{ 4, 1},{ 2, 1},{ 0, 74},{ 0,150},{ 2, 1}, + { 0,176},{ 0, 11},{ 2, 1},{ 0,177},{ 0, 27},{ 20, 1}, + { 8, 1},{ 2, 1},{ 0,178},{ 4, 1},{ 2, 1},{ 0,118}, + { 0,119},{ 0,148},{ 6, 1},{ 4, 1},{ 2, 1},{ 0,135}, + { 0,120},{ 0,164},{ 4, 1},{ 2, 1},{ 0,105},{ 0,165}, + { 0, 43},{ 12, 1},{ 6, 1},{ 4, 1},{ 2, 1},{ 0, 90}, + { 0,136},{ 0,179},{ 2, 1},{ 0, 59},{ 2, 1},{ 0,121}, + { 0,166},{ 6, 1},{ 4, 1},{ 2, 1},{ 0,106},{ 0,180}, // 240 + + { 0,192},{ 4, 1},{ 2, 1},{ 0, 12},{ 0,152},{ 0,193}, + { 60, 1},{ 22, 1},{ 10, 1},{ 6, 1},{ 2, 1},{ 0, 28}, + { 2, 1},{ 0,137},{ 0,181},{ 2, 1},{ 0, 91},{ 0,194}, + { 4, 1},{ 2, 1},{ 0, 44},{ 0, 60},{ 4, 1},{ 2, 1}, + { 0,182},{ 0,107},{ 2, 1},{ 0,196},{ 0, 76},{ 16, 1}, + { 8, 1},{ 4, 1},{ 2, 1},{ 0,168},{ 0,138},{ 2, 1}, + { 0,208},{ 0, 13},{ 2, 1},{ 0,209},{ 2, 1},{ 0, 75}, + { 2, 1},{ 0,151},{ 0,167},{ 12, 1},{ 6, 1},{ 2, 1}, + { 0,195},{ 2, 1},{ 0,122},{ 0,153},{ 4, 1},{ 2, 1}, + { 0,197},{ 0, 92},{ 0,183},{ 4, 1},{ 2, 1},{ 0, 29}, // 300 + + { 0,210},{ 2, 1},{ 0, 45},{ 2, 1},{ 0,123},{ 0,211}, + { 52, 1},{ 28, 1},{ 12, 1},{ 4, 1},{ 2, 1},{ 0, 61}, + { 0,198},{ 4, 1},{ 2, 1},{ 0,108},{ 0,169},{ 2, 1}, + { 0,154},{ 0,212},{ 8, 1},{ 4, 1},{ 2, 1},{ 0,184}, + { 0,139},{ 2, 1},{ 0, 77},{ 0,199},{ 4, 1},{ 2, 1}, + { 0,124},{ 0,213},{ 2, 1},{ 0, 93},{ 0,224},{ 10, 1}, + { 4, 1},{ 2, 1},{ 0,225},{ 0, 30},{ 4, 1},{ 2, 1}, + { 0, 14},{ 0, 46},{ 0,226},{ 8, 1},{ 4, 1},{ 2, 1}, + { 0,227},{ 0,109},{ 2, 1},{ 0,140},{ 0,228},{ 4, 1}, + { 2, 1},{ 0,229},{ 0,186},{ 0,240},{ 38, 1},{ 16, 1}, // 360 + + { 4, 1},{ 2, 1},{ 0,241},{ 0, 31},{ 6, 1},{ 4, 1}, + { 2, 1},{ 0,170},{ 0,155},{ 0,185},{ 2, 1},{ 0, 62}, + { 2, 1},{ 0,214},{ 0,200},{ 12, 1},{ 6, 1},{ 2, 1}, + { 0, 78},{ 2, 1},{ 0,215},{ 0,125},{ 2, 1},{ 0,171}, + { 2, 1},{ 0, 94},{ 0,201},{ 6, 1},{ 2, 1},{ 0, 15}, + { 2, 1},{ 0,156},{ 0,110},{ 2, 1},{ 0,242},{ 0, 47}, + { 32, 1},{ 16, 1},{ 6, 1},{ 4, 1},{ 2, 1},{ 0,216}, + { 0,141},{ 0, 63},{ 6, 1},{ 2, 1},{ 0,243},{ 2, 1}, + { 0,230},{ 0,202},{ 2, 1},{ 0,244},{ 0, 79},{ 8, 1}, + { 4, 1},{ 2, 1},{ 0,187},{ 0,172},{ 2, 1},{ 0,231}, // 420 + + { 0,245},{ 4, 1},{ 2, 1},{ 0,217},{ 0,157},{ 2, 1}, + { 0, 95},{ 0,232},{ 30, 1},{ 12, 1},{ 6, 1},{ 2, 1}, + { 0,111},{ 2, 1},{ 0,246},{ 0,203},{ 4, 1},{ 2, 1}, + { 0,188},{ 0,173},{ 0,218},{ 8, 1},{ 2, 1},{ 0,247}, + { 4, 1},{ 2, 1},{ 0,126},{ 0,127},{ 0,142},{ 6, 1}, + { 4, 1},{ 2, 1},{ 0,158},{ 0,174},{ 0,204},{ 2, 1}, + { 0,248},{ 0,143},{ 18, 1},{ 8, 1},{ 4, 1},{ 2, 1}, + { 0,219},{ 0,189},{ 2, 1},{ 0,234},{ 0,249},{ 4, 1}, + { 2, 1},{ 0,159},{ 0,235},{ 2, 1},{ 0,190},{ 2, 1}, + { 0,205},{ 0,250},{ 14, 1},{ 4, 1},{ 2, 1},{ 0,221}, // 480 + + { 0,236},{ 6, 1},{ 4, 1},{ 2, 1},{ 0,233},{ 0,175}, + { 0,220},{ 2, 1},{ 0,206},{ 0,251},{ 8, 1},{ 4, 1}, + { 2, 1},{ 0,191},{ 0,222},{ 2, 1},{ 0,207},{ 0,238}, + { 4, 1},{ 2, 1},{ 0,223},{ 0,239},{ 2, 1},{ 0,255}, + { 2, 1},{ 0,237},{ 2, 1},{ 0,253},{ 2, 1},{ 0,252}, + { 0,254}}, + +htd15[511][2]={{ 16, 1},{ 6, 1},{ 2, 1},{ 0, 0},{ 2, 1},{ 0, 16}, + { 0, 1},{ 2, 1},{ 0, 17},{ 4, 1},{ 2, 1},{ 0, 32}, + { 0, 2},{ 2, 1},{ 0, 33},{ 0, 18},{ 50, 1},{ 16, 1}, + { 6, 1},{ 2, 1},{ 0, 34},{ 2, 1},{ 0, 48},{ 0, 49}, + { 6, 1},{ 2, 1},{ 0, 19},{ 2, 1},{ 0, 3},{ 0, 64}, + { 2, 1},{ 0, 50},{ 0, 35},{ 14, 1},{ 6, 1},{ 4, 1}, + { 2, 1},{ 0, 4},{ 0, 20},{ 0, 65},{ 4, 1},{ 2, 1}, + { 0, 51},{ 0, 66},{ 2, 1},{ 0, 36},{ 0, 67},{ 10, 1}, + { 6, 1},{ 2, 1},{ 0, 52},{ 2, 1},{ 0, 80},{ 0, 5}, + { 2, 1},{ 0, 81},{ 0, 21},{ 4, 1},{ 2, 1},{ 0, 82}, // 60 + + { 0, 37},{ 4, 1},{ 2, 1},{ 0, 68},{ 0, 83},{ 0, 97}, + { 90, 1},{ 36, 1},{ 18, 1},{ 10, 1},{ 6, 1},{ 2, 1}, + { 0, 53},{ 2, 1},{ 0, 96},{ 0, 6},{ 2, 1},{ 0, 22}, + { 0, 98},{ 4, 1},{ 2, 1},{ 0, 38},{ 0, 84},{ 2, 1}, + { 0, 69},{ 0, 99},{ 10, 1},{ 6, 1},{ 2, 1},{ 0, 54}, + { 2, 1},{ 0,112},{ 0, 7},{ 2, 1},{ 0,113},{ 0, 85}, + { 4, 1},{ 2, 1},{ 0, 23},{ 0,100},{ 2, 1},{ 0,114}, + { 0, 39},{ 24, 1},{ 16, 1},{ 8, 1},{ 4, 1},{ 2, 1}, + { 0, 70},{ 0,115},{ 2, 1},{ 0, 55},{ 0,101},{ 4, 1}, + { 2, 1},{ 0, 86},{ 0,128},{ 2, 1},{ 0, 8},{ 0,116}, // 120 + + { 4, 1},{ 2, 1},{ 0,129},{ 0, 24},{ 2, 1},{ 0,130}, + { 0, 40},{ 16, 1},{ 8, 1},{ 4, 1},{ 2, 1},{ 0, 71}, + { 0,102},{ 2, 1},{ 0,131},{ 0, 56},{ 4, 1},{ 2, 1}, + { 0,117},{ 0, 87},{ 2, 1},{ 0,132},{ 0, 72},{ 6, 1}, + { 4, 1},{ 2, 1},{ 0,144},{ 0, 25},{ 0,145},{ 4, 1}, + { 2, 1},{ 0,146},{ 0,118},{ 2, 1},{ 0,103},{ 0, 41}, + { 92, 1},{ 36, 1},{ 18, 1},{ 10, 1},{ 4, 1},{ 2, 1}, + { 0,133},{ 0, 88},{ 4, 1},{ 2, 1},{ 0, 9},{ 0,119}, + { 0,147},{ 4, 1},{ 2, 1},{ 0, 57},{ 0,148},{ 2, 1}, + { 0, 73},{ 0,134},{ 10, 1},{ 6, 1},{ 2, 1},{ 0,104}, // 180 + + { 2, 1},{ 0,160},{ 0, 10},{ 2, 1},{ 0,161},{ 0, 26}, + { 4, 1},{ 2, 1},{ 0,162},{ 0, 42},{ 2, 1},{ 0,149}, + { 0, 89},{ 26, 1},{ 14, 1},{ 6, 1},{ 2, 1},{ 0,163}, + { 2, 1},{ 0, 58},{ 0,135},{ 4, 1},{ 2, 1},{ 0,120}, + { 0,164},{ 2, 1},{ 0, 74},{ 0,150},{ 6, 1},{ 4, 1}, + { 2, 1},{ 0,105},{ 0,176},{ 0,177},{ 4, 1},{ 2, 1}, + { 0, 27},{ 0,165},{ 0,178},{ 14, 1},{ 8, 1},{ 4, 1}, + { 2, 1},{ 0, 90},{ 0, 43},{ 2, 1},{ 0,136},{ 0,151}, + { 2, 1},{ 0,179},{ 2, 1},{ 0,121},{ 0, 59},{ 8, 1}, + { 4, 1},{ 2, 1},{ 0,106},{ 0,180},{ 2, 1},{ 0, 75}, // 240 + + { 0,193},{ 4, 1},{ 2, 1},{ 0,152},{ 0,137},{ 2, 1}, + { 0, 28},{ 0,181},{ 80, 1},{ 34, 1},{ 16, 1},{ 6, 1}, + { 4, 1},{ 2, 1},{ 0, 91},{ 0, 44},{ 0,194},{ 6, 1}, + { 4, 1},{ 2, 1},{ 0, 11},{ 0,192},{ 0,166},{ 2, 1}, + { 0,167},{ 0,122},{ 10, 1},{ 4, 1},{ 2, 1},{ 0,195}, + { 0, 60},{ 4, 1},{ 2, 1},{ 0, 12},{ 0,153},{ 0,182}, + { 4, 1},{ 2, 1},{ 0,107},{ 0,196},{ 2, 1},{ 0, 76}, + { 0,168},{ 20, 1},{ 10, 1},{ 4, 1},{ 2, 1},{ 0,138}, + { 0,197},{ 4, 1},{ 2, 1},{ 0,208},{ 0, 92},{ 0,209}, + { 4, 1},{ 2, 1},{ 0,183},{ 0,123},{ 2, 1},{ 0, 29}, // 300 + + { 2, 1},{ 0, 13},{ 0, 45},{ 12, 1},{ 4, 1},{ 2, 1}, + { 0,210},{ 0,211},{ 4, 1},{ 2, 1},{ 0, 61},{ 0,198}, + { 2, 1},{ 0,108},{ 0,169},{ 6, 1},{ 4, 1},{ 2, 1}, + { 0,154},{ 0,184},{ 0,212},{ 4, 1},{ 2, 1},{ 0,139}, + { 0, 77},{ 2, 1},{ 0,199},{ 0,124},{ 68, 1},{ 34, 1}, + { 18, 1},{ 10, 1},{ 4, 1},{ 2, 1},{ 0,213},{ 0, 93}, + { 4, 1},{ 2, 1},{ 0,224},{ 0, 14},{ 0,225},{ 4, 1}, + { 2, 1},{ 0, 30},{ 0,226},{ 2, 1},{ 0,170},{ 0, 46}, + { 8, 1},{ 4, 1},{ 2, 1},{ 0,185},{ 0,155},{ 2, 1}, + { 0,227},{ 0,214},{ 4, 1},{ 2, 1},{ 0,109},{ 0, 62}, // 360 + + { 2, 1},{ 0,200},{ 0,140},{ 16, 1},{ 8, 1},{ 4, 1}, + { 2, 1},{ 0,228},{ 0, 78},{ 2, 1},{ 0,215},{ 0,125}, + { 4, 1},{ 2, 1},{ 0,229},{ 0,186},{ 2, 1},{ 0,171}, + { 0, 94},{ 8, 1},{ 4, 1},{ 2, 1},{ 0,201},{ 0,156}, + { 2, 1},{ 0,241},{ 0, 31},{ 6, 1},{ 4, 1},{ 2, 1}, + { 0,240},{ 0,110},{ 0,242},{ 2, 1},{ 0, 47},{ 0,230}, + { 38, 1},{ 18, 1},{ 8, 1},{ 4, 1},{ 2, 1},{ 0,216}, + { 0,243},{ 2, 1},{ 0, 63},{ 0,244},{ 6, 1},{ 2, 1}, + { 0, 79},{ 2, 1},{ 0,141},{ 0,217},{ 2, 1},{ 0,187}, + { 0,202},{ 8, 1},{ 4, 1},{ 2, 1},{ 0,172},{ 0,231}, // 420 + + { 2, 1},{ 0,126},{ 0,245},{ 8, 1},{ 4, 1},{ 2, 1}, + { 0,157},{ 0, 95},{ 2, 1},{ 0,232},{ 0,142},{ 2, 1}, + { 0,246},{ 0,203},{ 34, 1},{ 18, 1},{ 10, 1},{ 6, 1}, + { 4, 1},{ 2, 1},{ 0, 15},{ 0,174},{ 0,111},{ 2, 1}, + { 0,188},{ 0,218},{ 4, 1},{ 2, 1},{ 0,173},{ 0,247}, + { 2, 1},{ 0,127},{ 0,233},{ 8, 1},{ 4, 1},{ 2, 1}, + { 0,158},{ 0,204},{ 2, 1},{ 0,248},{ 0,143},{ 4, 1}, + { 2, 1},{ 0,219},{ 0,189},{ 2, 1},{ 0,234},{ 0,249}, + { 16, 1},{ 8, 1},{ 4, 1},{ 2, 1},{ 0,159},{ 0,220}, + { 2, 1},{ 0,205},{ 0,235},{ 4, 1},{ 2, 1},{ 0,190}, // 480 + + { 0,250},{ 2, 1},{ 0,175},{ 0,221},{ 14, 1},{ 6, 1}, + { 4, 1},{ 2, 1},{ 0,236},{ 0,206},{ 0,251},{ 4, 1}, + { 2, 1},{ 0,191},{ 0,237},{ 2, 1},{ 0,222},{ 0,252}, + { 6, 1},{ 4, 1},{ 2, 1},{ 0,207},{ 0,253},{ 0,238}, + { 4, 1},{ 2, 1},{ 0,223},{ 0,254},{ 2, 1},{ 0,239}, + { 0,255}}, + +htd16[511][2]={{ 2, 1},{ 0, 0},{ 6, 1},{ 2, 1},{ 0, 16},{ 2, 1}, + { 0, 1},{ 0, 17},{ 42, 1},{ 8, 1},{ 4, 1},{ 2, 1}, + { 0, 32},{ 0, 2},{ 2, 1},{ 0, 33},{ 0, 18},{ 10, 1}, + { 6, 1},{ 2, 1},{ 0, 34},{ 2, 1},{ 0, 48},{ 0, 3}, + { 2, 1},{ 0, 49},{ 0, 19},{ 10, 1},{ 4, 1},{ 2, 1}, + { 0, 50},{ 0, 35},{ 4, 1},{ 2, 1},{ 0, 64},{ 0, 4}, + { 0, 65},{ 6, 1},{ 2, 1},{ 0, 20},{ 2, 1},{ 0, 51}, + { 0, 66},{ 4, 1},{ 2, 1},{ 0, 36},{ 0, 80},{ 2, 1}, + { 0, 67},{ 0, 52},{138, 1},{ 40, 1},{ 16, 1},{ 6, 1}, + { 4, 1},{ 2, 1},{ 0, 5},{ 0, 21},{ 0, 81},{ 4, 1}, // 60 + + { 2, 1},{ 0, 82},{ 0, 37},{ 4, 1},{ 2, 1},{ 0, 68}, + { 0, 53},{ 0, 83},{ 10, 1},{ 6, 1},{ 4, 1},{ 2, 1}, + { 0, 96},{ 0, 6},{ 0, 97},{ 2, 1},{ 0, 22},{ 0, 98}, + { 8, 1},{ 4, 1},{ 2, 1},{ 0, 38},{ 0, 84},{ 2, 1}, + { 0, 69},{ 0, 99},{ 4, 1},{ 2, 1},{ 0, 54},{ 0,112}, + { 0,113},{ 40, 1},{ 18, 1},{ 8, 1},{ 2, 1},{ 0, 23}, + { 2, 1},{ 0, 7},{ 2, 1},{ 0, 85},{ 0,100},{ 4, 1}, + { 2, 1},{ 0,114},{ 0, 39},{ 4, 1},{ 2, 1},{ 0, 70}, + { 0,101},{ 0,115},{ 10, 1},{ 6, 1},{ 2, 1},{ 0, 55}, + { 2, 1},{ 0, 86},{ 0, 8},{ 2, 1},{ 0,128},{ 0,129}, // 120 + + { 6, 1},{ 2, 1},{ 0, 24},{ 2, 1},{ 0,116},{ 0, 71}, + { 2, 1},{ 0,130},{ 2, 1},{ 0, 40},{ 0,102},{ 24, 1}, + { 14, 1},{ 8, 1},{ 4, 1},{ 2, 1},{ 0,131},{ 0, 56}, + { 2, 1},{ 0,117},{ 0,132},{ 4, 1},{ 2, 1},{ 0, 72}, + { 0,144},{ 0,145},{ 6, 1},{ 2, 1},{ 0, 25},{ 2, 1}, + { 0, 9},{ 0,118},{ 2, 1},{ 0,146},{ 0, 41},{ 14, 1}, + { 8, 1},{ 4, 1},{ 2, 1},{ 0,133},{ 0, 88},{ 2, 1}, + { 0,147},{ 0, 57},{ 4, 1},{ 2, 1},{ 0,160},{ 0, 10}, + { 0, 26},{ 8, 1},{ 2, 1},{ 0,162},{ 2, 1},{ 0,103}, + { 2, 1},{ 0, 87},{ 0, 73},{ 6, 1},{ 2, 1},{ 0,148}, // 180 + + { 2, 1},{ 0,119},{ 0,134},{ 2, 1},{ 0,161},{ 2, 1}, + { 0,104},{ 0,149},{220, 1},{126, 1},{ 50, 1},{ 26, 1}, + { 12, 1},{ 6, 1},{ 2, 1},{ 0, 42},{ 2, 1},{ 0, 89}, + { 0, 58},{ 2, 1},{ 0,163},{ 2, 1},{ 0,135},{ 0,120}, + { 8, 1},{ 4, 1},{ 2, 1},{ 0,164},{ 0, 74},{ 2, 1}, + { 0,150},{ 0,105},{ 4, 1},{ 2, 1},{ 0,176},{ 0, 11}, + { 0,177},{ 10, 1},{ 4, 1},{ 2, 1},{ 0, 27},{ 0,178}, + { 2, 1},{ 0, 43},{ 2, 1},{ 0,165},{ 0, 90},{ 6, 1}, + { 2, 1},{ 0,179},{ 2, 1},{ 0,166},{ 0,106},{ 4, 1}, + { 2, 1},{ 0,180},{ 0, 75},{ 2, 1},{ 0, 12},{ 0,193}, // 240 + + { 30, 1},{ 14, 1},{ 6, 1},{ 4, 1},{ 2, 1},{ 0,181}, + { 0,194},{ 0, 44},{ 4, 1},{ 2, 1},{ 0,167},{ 0,195}, + { 2, 1},{ 0,107},{ 0,196},{ 8, 1},{ 2, 1},{ 0, 29}, + { 4, 1},{ 2, 1},{ 0,136},{ 0,151},{ 0, 59},{ 4, 1}, + { 2, 1},{ 0,209},{ 0,210},{ 2, 1},{ 0, 45},{ 0,211}, + { 18, 1},{ 6, 1},{ 4, 1},{ 2, 1},{ 0, 30},{ 0, 46}, + { 0,226},{ 6, 1},{ 4, 1},{ 2, 1},{ 0,121},{ 0,152}, + { 0,192},{ 2, 1},{ 0, 28},{ 2, 1},{ 0,137},{ 0, 91}, + { 14, 1},{ 6, 1},{ 2, 1},{ 0, 60},{ 2, 1},{ 0,122}, + { 0,182},{ 4, 1},{ 2, 1},{ 0, 76},{ 0,153},{ 2, 1}, // 300 + + { 0,168},{ 0,138},{ 6, 1},{ 2, 1},{ 0, 13},{ 2, 1}, + { 0,197},{ 0, 92},{ 4, 1},{ 2, 1},{ 0, 61},{ 0,198}, + { 2, 1},{ 0,108},{ 0,154},{ 88, 1},{ 86, 1},{ 36, 1}, + { 16, 1},{ 8, 1},{ 4, 1},{ 2, 1},{ 0,139},{ 0, 77}, + { 2, 1},{ 0,199},{ 0,124},{ 4, 1},{ 2, 1},{ 0,213}, + { 0, 93},{ 2, 1},{ 0,224},{ 0, 14},{ 8, 1},{ 2, 1}, + { 0,227},{ 4, 1},{ 2, 1},{ 0,208},{ 0,183},{ 0,123}, + { 6, 1},{ 4, 1},{ 2, 1},{ 0,169},{ 0,184},{ 0,212}, + { 2, 1},{ 0,225},{ 2, 1},{ 0,170},{ 0,185},{ 24, 1}, + { 10, 1},{ 6, 1},{ 4, 1},{ 2, 1},{ 0,155},{ 0,214}, // 360 + + { 0,109},{ 2, 1},{ 0, 62},{ 0,200},{ 6, 1},{ 4, 1}, + { 2, 1},{ 0,140},{ 0,228},{ 0, 78},{ 4, 1},{ 2, 1}, + { 0,215},{ 0,229},{ 2, 1},{ 0,186},{ 0,171},{ 12, 1}, + { 4, 1},{ 2, 1},{ 0,156},{ 0,230},{ 4, 1},{ 2, 1}, + { 0,110},{ 0,216},{ 2, 1},{ 0,141},{ 0,187},{ 8, 1}, + { 4, 1},{ 2, 1},{ 0,231},{ 0,157},{ 2, 1},{ 0,232}, + { 0,142},{ 4, 1},{ 2, 1},{ 0,203},{ 0,188},{ 0,158}, + { 0,241},{ 2, 1},{ 0, 31},{ 2, 1},{ 0, 15},{ 0, 47}, + { 66, 1},{ 56, 1},{ 2, 1},{ 0,242},{ 52, 1},{ 50, 1}, + { 20, 1},{ 8, 1},{ 2, 1},{ 0,189},{ 2, 1},{ 0, 94}, // 420 + + { 2, 1},{ 0,125},{ 0,201},{ 6, 1},{ 2, 1},{ 0,202}, + { 2, 1},{ 0,172},{ 0,126},{ 4, 1},{ 2, 1},{ 0,218}, + { 0,173},{ 0,204},{ 10, 1},{ 6, 1},{ 2, 1},{ 0,174}, + { 2, 1},{ 0,219},{ 0,220},{ 2, 1},{ 0,205},{ 0,190}, + { 6, 1},{ 4, 1},{ 2, 1},{ 0,235},{ 0,237},{ 0,238}, + { 6, 1},{ 4, 1},{ 2, 1},{ 0,217},{ 0,234},{ 0,233}, + { 2, 1},{ 0,222},{ 4, 1},{ 2, 1},{ 0,221},{ 0,236}, + { 0,206},{ 0, 63},{ 0,240},{ 4, 1},{ 2, 1},{ 0,243}, + { 0,244},{ 2, 1},{ 0, 79},{ 2, 1},{ 0,245},{ 0, 95}, + { 10, 1},{ 2, 1},{ 0,255},{ 4, 1},{ 2, 1},{ 0,246}, // 480 + + { 0,111},{ 2, 1},{ 0,247},{ 0,127},{ 12, 1},{ 6, 1}, + { 2, 1},{ 0,143},{ 2, 1},{ 0,248},{ 0,249},{ 4, 1}, + { 2, 1},{ 0,159},{ 0,250},{ 0,175},{ 8, 1},{ 4, 1}, + { 2, 1},{ 0,251},{ 0,191},{ 2, 1},{ 0,252},{ 0,207}, + { 4, 1},{ 2, 1},{ 0,253},{ 0,223},{ 2, 1},{ 0,254}, + { 0,239}}, + +htd24[512][2]={{ 60, 1},{ 8, 1},{ 4, 1},{ 2, 1},{ 0, 0},{ 0, 16}, + { 2, 1},{ 0, 1},{ 0, 17},{ 14, 1},{ 6, 1},{ 4, 1}, + { 2, 1},{ 0, 32},{ 0, 2},{ 0, 33},{ 2, 1},{ 0, 18}, + { 2, 1},{ 0, 34},{ 2, 1},{ 0, 48},{ 0, 3},{ 14, 1}, + { 4, 1},{ 2, 1},{ 0, 49},{ 0, 19},{ 4, 1},{ 2, 1}, + { 0, 50},{ 0, 35},{ 4, 1},{ 2, 1},{ 0, 64},{ 0, 4}, + { 0, 65},{ 8, 1},{ 4, 1},{ 2, 1},{ 0, 20},{ 0, 51}, + { 2, 1},{ 0, 66},{ 0, 36},{ 6, 1},{ 4, 1},{ 2, 1}, + { 0, 67},{ 0, 52},{ 0, 81},{ 6, 1},{ 4, 1},{ 2, 1}, + { 0, 80},{ 0, 5},{ 0, 21},{ 2, 1},{ 0, 82},{ 0, 37}, // 60 + + {250+85, 1},{ 98, 1},{ 34, 1},{ 18, 1},{ 10, 1},{ 4, 1}, + { 2, 1},{ 0, 68},{ 0, 83},{ 2, 1},{ 0, 53},{ 2, 1}, + { 0, 96},{ 0, 6},{ 4, 1},{ 2, 1},{ 0, 97},{ 0, 22}, + { 2, 1},{ 0, 98},{ 0, 38},{ 8, 1},{ 4, 1},{ 2, 1}, + { 0, 84},{ 0, 69},{ 2, 1},{ 0, 99},{ 0, 54},{ 4, 1}, + { 2, 1},{ 0,113},{ 0, 85},{ 2, 1},{ 0,100},{ 0, 70}, + { 32, 1},{ 14, 1},{ 6, 1},{ 2, 1},{ 0,114},{ 2, 1}, + { 0, 39},{ 0, 55},{ 2, 1},{ 0,115},{ 4, 1},{ 2, 1}, + { 0,112},{ 0, 7},{ 0, 23},{ 10, 1},{ 4, 1},{ 2, 1}, + { 0,101},{ 0, 86},{ 4, 1},{ 2, 1},{ 0,128},{ 0, 8}, // 120 + + { 0,129},{ 4, 1},{ 2, 1},{ 0,116},{ 0, 71},{ 2, 1}, + { 0, 24},{ 0,130},{ 16, 1},{ 8, 1},{ 4, 1},{ 2, 1}, + { 0, 40},{ 0,102},{ 2, 1},{ 0,131},{ 0, 56},{ 4, 1}, + { 2, 1},{ 0,117},{ 0, 87},{ 2, 1},{ 0,132},{ 0, 72}, + { 8, 1},{ 4, 1},{ 2, 1},{ 0,145},{ 0, 25},{ 2, 1}, + { 0,146},{ 0,118},{ 4, 1},{ 2, 1},{ 0,103},{ 0, 41}, + { 2, 1},{ 0,133},{ 0, 88},{ 92, 1},{ 34, 1},{ 16, 1}, + { 8, 1},{ 4, 1},{ 2, 1},{ 0,147},{ 0, 57},{ 2, 1}, + { 0,148},{ 0, 73},{ 4, 1},{ 2, 1},{ 0,119},{ 0,134}, + { 2, 1},{ 0,104},{ 0,161},{ 8, 1},{ 4, 1},{ 2, 1}, // 180 + + { 0,162},{ 0, 42},{ 2, 1},{ 0,149},{ 0, 89},{ 4, 1}, + { 2, 1},{ 0,163},{ 0, 58},{ 2, 1},{ 0,135},{ 2, 1}, + { 0,120},{ 0, 74},{ 22, 1},{ 12, 1},{ 4, 1},{ 2, 1}, + { 0,164},{ 0,150},{ 4, 1},{ 2, 1},{ 0,105},{ 0,177}, + { 2, 1},{ 0, 27},{ 0,165},{ 6, 1},{ 2, 1},{ 0,178}, + { 2, 1},{ 0, 90},{ 0, 43},{ 2, 1},{ 0,136},{ 0,179}, + { 16, 1},{ 10, 1},{ 6, 1},{ 2, 1},{ 0,144},{ 2, 1}, + { 0, 9},{ 0,160},{ 2, 1},{ 0,151},{ 0,121},{ 4, 1}, + { 2, 1},{ 0,166},{ 0,106},{ 0,180},{ 12, 1},{ 6, 1}, + { 2, 1},{ 0, 26},{ 2, 1},{ 0, 10},{ 0,176},{ 2, 1}, // 240 + + { 0, 59},{ 2, 1},{ 0, 11},{ 0,192},{ 4, 1},{ 2, 1}, + { 0, 75},{ 0,193},{ 2, 1},{ 0,152},{ 0,137},{ 67, 1}, + { 34, 1},{ 16, 1},{ 8, 1},{ 4, 1},{ 2, 1},{ 0, 28}, + { 0,181},{ 2, 1},{ 0, 91},{ 0,194},{ 4, 1},{ 2, 1}, + { 0, 44},{ 0,167},{ 2, 1},{ 0,122},{ 0,195},{ 10, 1}, + { 6, 1},{ 2, 1},{ 0, 60},{ 2, 1},{ 0, 12},{ 0,208}, + { 2, 1},{ 0,182},{ 0,107},{ 4, 1},{ 2, 1},{ 0,196}, + { 0, 76},{ 2, 1},{ 0,153},{ 0,168},{ 16, 1},{ 8, 1}, + { 4, 1},{ 2, 1},{ 0,138},{ 0,197},{ 2, 1},{ 0, 92}, + { 0,209},{ 4, 1},{ 2, 1},{ 0,183},{ 0,123},{ 2, 1}, // 300 + + { 0, 29},{ 0,210},{ 9, 1},{ 4, 1},{ 2, 1},{ 0, 45}, + { 0,211},{ 2, 1},{ 0, 61},{ 0,198},{ 85,250},{ 4, 1}, // 306 - + { 2, 1},{ 0,108},{ 0,169},{ 2, 1},{ 0,154},{ 0,212}, + { 32, 1},{ 16, 1},{ 8, 1},{ 4, 1},{ 2, 1},{ 0,184}, + { 0,139},{ 2, 1},{ 0, 77},{ 0,199},{ 4, 1},{ 2, 1}, + { 0,124},{ 0,213},{ 2, 1},{ 0, 93},{ 0,225},{ 8, 1}, + { 4, 1},{ 2, 1},{ 0, 30},{ 0,226},{ 2, 1},{ 0,170}, + { 0,185},{ 4, 1},{ 2, 1},{ 0,155},{ 0,227},{ 2, 1}, + { 0,214},{ 0,109},{ 20, 1},{ 10, 1},{ 6, 1},{ 2, 1}, + { 0, 62},{ 2, 1},{ 0, 46},{ 0, 78},{ 2, 1},{ 0,200}, // 360 + + { 0,140},{ 4, 1},{ 2, 1},{ 0,228},{ 0,215},{ 4, 1}, + { 2, 1},{ 0,125},{ 0,171},{ 0,229},{ 10, 1},{ 4, 1}, + { 2, 1},{ 0,186},{ 0, 94},{ 2, 1},{ 0,201},{ 2, 1}, + { 0,156},{ 0,110},{ 8, 1},{ 2, 1},{ 0,230},{ 2, 1}, + { 0, 13},{ 2, 1},{ 0,224},{ 0, 14},{ 4, 1},{ 2, 1}, + { 0,216},{ 0,141},{ 2, 1},{ 0,187},{ 0,202},{ 74, 1}, + { 2, 1},{ 0,255},{ 64, 1},{ 58, 1},{ 32, 1},{ 16, 1}, + { 8, 1},{ 4, 1},{ 2, 1},{ 0,172},{ 0,231},{ 2, 1}, + { 0,126},{ 0,217},{ 4, 1},{ 2, 1},{ 0,157},{ 0,232}, + { 2, 1},{ 0,142},{ 0,203},{ 8, 1},{ 4, 1},{ 2, 1}, // 420 + + { 0,188},{ 0,218},{ 2, 1},{ 0,173},{ 0,233},{ 4, 1}, + { 2, 1},{ 0,158},{ 0,204},{ 2, 1},{ 0,219},{ 0,189}, + { 16, 1},{ 8, 1},{ 4, 1},{ 2, 1},{ 0,234},{ 0,174}, + { 2, 1},{ 0,220},{ 0,205},{ 4, 1},{ 2, 1},{ 0,235}, + { 0,190},{ 2, 1},{ 0,221},{ 0,236},{ 8, 1},{ 4, 1}, + { 2, 1},{ 0,206},{ 0,237},{ 2, 1},{ 0,222},{ 0,238}, + { 0, 15},{ 4, 1},{ 2, 1},{ 0,240},{ 0, 31},{ 0,241}, + { 4, 1},{ 2, 1},{ 0,242},{ 0, 47},{ 2, 1},{ 0,243}, + { 0, 63},{ 18, 1},{ 8, 1},{ 4, 1},{ 2, 1},{ 0,244}, + { 0, 79},{ 2, 1},{ 0,245},{ 0, 95},{ 4, 1},{ 2, 1}, // 480 + + { 0,246},{ 0,111},{ 2, 1},{ 0,247},{ 2, 1},{ 0,127}, + { 0,143},{ 10, 1},{ 4, 1},{ 2, 1},{ 0,248},{ 0,249}, + { 4, 1},{ 2, 1},{ 0,159},{ 0,175},{ 0,250},{ 8, 1}, + { 4, 1},{ 2, 1},{ 0,251},{ 0,191},{ 2, 1},{ 0,252}, + { 0,207},{ 4, 1},{ 2, 1},{ 0,253},{ 0,223},{ 2, 1}, + { 0,254},{ 0,239}}, + +htd32[ 31][2]={{ 2, 1},{ 0, 0},{ 8, 1},{ 4, 1},{ 2, 1},{ 0, 8}, + { 0, 4},{ 2, 1},{ 0, 1},{ 0, 2},{ 8, 1},{ 4, 1}, + { 2, 1},{ 0, 12},{ 0, 10},{ 2, 1},{ 0, 3},{ 0, 6}, + { 6, 1},{ 2, 1},{ 0, 9},{ 2, 1},{ 0, 5},{ 0, 7}, + { 4, 1},{ 2, 1},{ 0, 14},{ 0, 13},{ 2, 1},{ 0, 15}, + { 0, 11}}, + +htd33[ 31][2]={{ 16, 1},{ 8, 1},{ 4, 1},{ 2, 1},{ 0, 0},{ 0, 1}, + { 2, 1},{ 0, 2},{ 0, 3},{ 4, 1},{ 2, 1},{ 0, 4}, + { 0, 5},{ 2, 1},{ 0, 6},{ 0, 7},{ 8, 1},{ 4, 1}, + { 2, 1},{ 0, 8},{ 0, 9},{ 2, 1},{ 0, 10},{ 0, 11}, + { 4, 1},{ 2, 1},{ 0, 12},{ 0, 13},{ 2, 1},{ 0, 14}, + { 0, 15}}; + +const HUFFMANCODETABLE Mpegtoraw::ht[HTN]= +{ + { 0, 0-1, 0-1, 0, 0, htd33}, + { 1, 2-1, 2-1, 0, 7,htd01}, + { 2, 3-1, 3-1, 0, 17,htd02}, + { 3, 3-1, 3-1, 0, 17,htd03}, + { 4, 0-1, 0-1, 0, 0, htd33}, + { 5, 4-1, 4-1, 0, 31,htd05}, + { 6, 4-1, 4-1, 0, 31,htd06}, + { 7, 6-1, 6-1, 0, 71,htd07}, + { 8, 6-1, 6-1, 0, 71,htd08}, + { 9, 6-1, 6-1, 0, 71,htd09}, + {10, 8-1, 8-1, 0,127,htd10}, + {11, 8-1, 8-1, 0,127,htd11}, + {12, 8-1, 8-1, 0,127,htd12}, + {13,16-1,16-1, 0,511,htd13}, + {14, 0-1, 0-1, 0, 0, htd33}, + {15,16-1,16-1, 0,511,htd15}, + {16,16-1,16-1, 1,511,htd16}, + {17,16-1,16-1, 2,511,htd16}, + {18,16-1,16-1, 3,511,htd16}, + {19,16-1,16-1, 4,511,htd16}, + {20,16-1,16-1, 6,511,htd16}, + {21,16-1,16-1, 8,511,htd16}, + {22,16-1,16-1,10,511,htd16}, + {23,16-1,16-1,13,511,htd16}, + {24,16-1,16-1, 4,512,htd24}, + {25,16-1,16-1, 5,512,htd24}, + {26,16-1,16-1, 6,512,htd24}, + {27,16-1,16-1, 7,512,htd24}, + {28,16-1,16-1, 8,512,htd24}, + {29,16-1,16-1, 9,512,htd24}, + {30,16-1,16-1,11,512,htd24}, + {31,16-1,16-1,13,512,htd24}, + {32, 1-1,16-1, 0, 31,htd32}, + {33, 1-1,16-1, 0, 31,htd33} +}; diff --git a/Libraries/DecMPA/Files/src/splay/mpeg2tables.h b/Libraries/DecMPA/Files/src/splay/mpeg2tables.h new file mode 100644 index 000000000..25fca9d99 --- /dev/null +++ b/Libraries/DecMPA/Files/src/splay/mpeg2tables.h @@ -0,0 +1,441 @@ + + +//changes 8/4/2002 (by Hauke Duden): +// - added VC6 pragma to prevent some warnings from being reported + +#ifndef __MPEG2TABLES_H +#define __MPEG2TABLES_H + +#ifdef _MSC_VER +#pragma warning(disable : 4305) +#endif + + +#define MAXTABLE 3 + + +// Tables for layer 2. + +// bitalloclengthtable :0,1 supported 2. 2 ot tested & disabled +// this table merges the subbands to the longer one. +// 8 < 12 , 27 < 30 but the "length" is the same + +static const int bitalloclengthtable[MAXTABLE][MAXSUBBAND]= +{ {4,4,3,3,3,3,3,3,3,3,3,3,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + {4,4,4,4,4,4,4,4,4,4,4,3,3,3,3,3, 3,3,3,3,3,3,3,2,2,2,2,2,2,2,0,0}, + {4,4,4,4,3,3,3,3,3,3,3,2,2,2,2,2, 2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,0} }; + + +/* +Orignal is: +{ {4,4,4,4,4,4,4,4,4,4,4,3,3,3,3,3, 3,3,3,3,3,3,3,2,2,2,2,0,0,0,0,0}, + {4,4,4,4,4,4,4,4,4,4,4,3,3,3,3,3, 3,3,3,3,3,3,3,2,2,2,2,2,2,2,0,0}, + {4,4,3,3,3,3,3,3,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + {4,4,3,3,3,3,3,3,3,3,3,3,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, + {4,4,4,4,3,3,3,3,3,3,3,2,2,2,2,2, 2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,0} }; + +*/ + + + + + +static const REAL group5bits[27*3]= +{ + -2.0/3.0, -2.0/3.0, -2.0/3.0, + 0.0, -2.0/3.0, -2.0/3.0, + 2.0/3.0, -2.0/3.0, -2.0/3.0, + -2.0/3.0, 0.0, -2.0/3.0, + 0.0, 0.0, -2.0/3.0, + 2.0/3.0, 0.0, -2.0/3.0, + -2.0/3.0, 2.0/3.0, -2.0/3.0, + 0.0, 2.0/3.0, -2.0/3.0, + 2.0/3.0, 2.0/3.0, -2.0/3.0, + -2.0/3.0, -2.0/3.0, 0.0, + 0.0, -2.0/3.0, 0.0, + 2.0/3.0, -2.0/3.0, 0.0, + -2.0/3.0, 0.0, 0.0, + 0.0, 0.0, 0.0, + 2.0/3.0, 0.0, 0.0, + -2.0/3.0, 2.0/3.0, 0.0, + 0.0, 2.0/3.0, 0.0, + 2.0/3.0, 2.0/3.0, 0.0, + -2.0/3.0, -2.0/3.0, 2.0/3.0, + 0.0, -2.0/3.0, 2.0/3.0, + 2.0/3.0, -2.0/3.0, 2.0/3.0, + -2.0/3.0, 0.0, 2.0/3.0, + 0.0, 0.0, 2.0/3.0, + 2.0/3.0, 0.0, 2.0/3.0, + -2.0/3.0, 2.0/3.0, 2.0/3.0, + 0.0, 2.0/3.0, 2.0/3.0, + 2.0/3.0, 2.0/3.0, 2.0/3.0 +}; + +static const REAL group7bits[125*3]= +{ + -0.8,-0.8,-0.8, -0.4,-0.8,-0.8, 0.0,-0.8,-0.8, 0.4,-0.8,-0.8, 0.8,-0.8,-0.8, + -0.8,-0.4,-0.8, -0.4,-0.4,-0.8, 0.0,-0.4,-0.8, 0.4,-0.4,-0.8, 0.8,-0.4,-0.8, + -0.8, 0.0,-0.8, -0.4, 0.0,-0.8, 0.0, 0.0,-0.8, 0.4, 0.0,-0.8, 0.8, 0.0,-0.8, + -0.8, 0.4,-0.8, -0.4, 0.4,-0.8, 0.0, 0.4,-0.8, 0.4, 0.4,-0.8, 0.8, 0.4,-0.8, + -0.8, 0.8,-0.8, -0.4, 0.8,-0.8, 0.0, 0.8,-0.8, 0.4, 0.8,-0.8, 0.8, 0.8,-0.8, + -0.8,-0.8,-0.4, -0.4,-0.8,-0.4, 0.0,-0.8,-0.4, 0.4,-0.8,-0.4, 0.8,-0.8,-0.4, + -0.8,-0.4,-0.4, -0.4,-0.4,-0.4, 0.0,-0.4,-0.4, 0.4,-0.4,-0.4, 0.8,-0.4,-0.4, + -0.8, 0.0,-0.4, -0.4, 0.0,-0.4, 0.0, 0.0,-0.4, 0.4, 0.0,-0.4, 0.8, 0.0,-0.4, + -0.8, 0.4,-0.4, -0.4, 0.4,-0.4, 0.0, 0.4,-0.4, 0.4, 0.4,-0.4, 0.8, 0.4,-0.4, + -0.8, 0.8,-0.4, -0.4, 0.8,-0.4, 0.0, 0.8,-0.4, 0.4, 0.8,-0.4, 0.8, 0.8,-0.4, + -0.8,-0.8, 0.0, -0.4,-0.8, 0.0, 0.0,-0.8, 0.0, 0.4,-0.8, 0.0, 0.8,-0.8, 0.0, + -0.8,-0.4, 0.0, -0.4,-0.4, 0.0, 0.0,-0.4, 0.0, 0.4,-0.4, 0.0, 0.8,-0.4, 0.0, + -0.8, 0.0, 0.0, -0.4, 0.0, 0.0, 0.0, 0.0, 0.0, 0.4, 0.0, 0.0, 0.8, 0.0, 0.0, + -0.8, 0.4, 0.0, -0.4, 0.4, 0.0, 0.0, 0.4, 0.0, 0.4, 0.4, 0.0, 0.8, 0.4, 0.0, + -0.8, 0.8, 0.0, -0.4, 0.8, 0.0, 0.0, 0.8, 0.0, 0.4, 0.8, 0.0, 0.8, 0.8, 0.0, + -0.8,-0.8, 0.4, -0.4,-0.8, 0.4, 0.0,-0.8, 0.4, 0.4,-0.8, 0.4, 0.8,-0.8, 0.4, + -0.8,-0.4, 0.4, -0.4,-0.4, 0.4, 0.0,-0.4, 0.4, 0.4,-0.4, 0.4, 0.8,-0.4, 0.4, + -0.8, 0.0, 0.4, -0.4, 0.0, 0.4, 0.0, 0.0, 0.4, 0.4, 0.0, 0.4, 0.8, 0.0, 0.4, + -0.8, 0.4, 0.4, -0.4, 0.4, 0.4, 0.0, 0.4, 0.4, 0.4, 0.4, 0.4, 0.8, 0.4, 0.4, + -0.8, 0.8, 0.4, -0.4, 0.8, 0.4, 0.0, 0.8, 0.4, 0.4, 0.8, 0.4, 0.8, 0.8, 0.4, + -0.8,-0.8, 0.8, -0.4,-0.8, 0.8, 0.0,-0.8, 0.8, 0.4,-0.8, 0.8, 0.8,-0.8, 0.8, + -0.8,-0.4, 0.8, -0.4,-0.4, 0.8, 0.0,-0.4, 0.8, 0.4,-0.4, 0.8, 0.8,-0.4, 0.8, + -0.8, 0.0, 0.8, -0.4, 0.0, 0.8, 0.0, 0.0, 0.8, 0.4, 0.0, 0.8, 0.8, 0.0, 0.8, + -0.8, 0.4, 0.8, -0.4, 0.4, 0.8, 0.0, 0.4, 0.8, 0.4, 0.4, 0.8, 0.8, 0.4, 0.8, + -0.8, 0.8, 0.8, -0.4, 0.8, 0.8, 0.0, 0.8, 0.8, 0.4, 0.8, 0.8, 0.8, 0.8, 0.8 +}; + +static const REAL group10bits[729*3]= +{ + -8.0/9.0,-8.0/9.0,-8.0/9.0, -6.0/9.0,-8.0/9.0,-8.0/9.0, -4.0/9.0,-8.0/9.0,-8.0/9.0, + -2.0/9.0,-8.0/9.0,-8.0/9.0, 0.0,-8.0/9.0,-8.0/9.0, 2.0/9.0,-8.0/9.0,-8.0/9.0, + 4.0/9.0,-8.0/9.0,-8.0/9.0, 6.0/9.0,-8.0/9.0,-8.0/9.0, 8.0/9.0,-8.0/9.0,-8.0/9.0, + -8.0/9.0,-6.0/9.0,-8.0/9.0, -6.0/9.0,-6.0/9.0,-8.0/9.0, -4.0/9.0,-6.0/9.0,-8.0/9.0, + -2.0/9.0,-6.0/9.0,-8.0/9.0, 0.0,-6.0/9.0,-8.0/9.0, 2.0/9.0,-6.0/9.0,-8.0/9.0, + 4.0/9.0,-6.0/9.0,-8.0/9.0, 6.0/9.0,-6.0/9.0,-8.0/9.0, 8.0/9.0,-6.0/9.0,-8.0/9.0, + -8.0/9.0,-4.0/9.0,-8.0/9.0, -6.0/9.0,-4.0/9.0,-8.0/9.0, -4.0/9.0,-4.0/9.0,-8.0/9.0, + -2.0/9.0,-4.0/9.0,-8.0/9.0, 0.0,-4.0/9.0,-8.0/9.0, 2.0/9.0,-4.0/9.0,-8.0/9.0, + 4.0/9.0,-4.0/9.0,-8.0/9.0, 6.0/9.0,-4.0/9.0,-8.0/9.0, 8.0/9.0,-4.0/9.0,-8.0/9.0, + -8.0/9.0,-2.0/9.0,-8.0/9.0, -6.0/9.0,-2.0/9.0,-8.0/9.0, -4.0/9.0,-2.0/9.0,-8.0/9.0, + -2.0/9.0,-2.0/9.0,-8.0/9.0, 0.0,-2.0/9.0,-8.0/9.0, 2.0/9.0,-2.0/9.0,-8.0/9.0, + 4.0/9.0,-2.0/9.0,-8.0/9.0, 6.0/9.0,-2.0/9.0,-8.0/9.0, 8.0/9.0,-2.0/9.0,-8.0/9.0, + -8.0/9.0, 0.0,-8.0/9.0, -6.0/9.0, 0.0,-8.0/9.0, -4.0/9.0, 0.0,-8.0/9.0, + -2.0/9.0, 0.0,-8.0/9.0, 0.0, 0.0,-8.0/9.0, 2.0/9.0, 0.0,-8.0/9.0, + 4.0/9.0, 0.0,-8.0/9.0, 6.0/9.0, 0.0,-8.0/9.0, 8.0/9.0, 0.0,-8.0/9.0, + -8.0/9.0, 2.0/9.0,-8.0/9.0, -6.0/9.0, 2.0/9.0,-8.0/9.0, -4.0/9.0, 2.0/9.0,-8.0/9.0, + -2.0/9.0, 2.0/9.0,-8.0/9.0, 0.0, 2.0/9.0,-8.0/9.0, 2.0/9.0, 2.0/9.0,-8.0/9.0, + 4.0/9.0, 2.0/9.0,-8.0/9.0, 6.0/9.0, 2.0/9.0,-8.0/9.0, 8.0/9.0, 2.0/9.0,-8.0/9.0, + -8.0/9.0, 4.0/9.0,-8.0/9.0, -6.0/9.0, 4.0/9.0,-8.0/9.0, -4.0/9.0, 4.0/9.0,-8.0/9.0, + -2.0/9.0, 4.0/9.0,-8.0/9.0, 0.0, 4.0/9.0,-8.0/9.0, 2.0/9.0, 4.0/9.0,-8.0/9.0, + 4.0/9.0, 4.0/9.0,-8.0/9.0, 6.0/9.0, 4.0/9.0,-8.0/9.0, 8.0/9.0, 4.0/9.0,-8.0/9.0, + -8.0/9.0, 6.0/9.0,-8.0/9.0, -6.0/9.0, 6.0/9.0,-8.0/9.0, -4.0/9.0, 6.0/9.0,-8.0/9.0, + -2.0/9.0, 6.0/9.0,-8.0/9.0, 0.0, 6.0/9.0,-8.0/9.0, 2.0/9.0, 6.0/9.0,-8.0/9.0, + 4.0/9.0, 6.0/9.0,-8.0/9.0, 6.0/9.0, 6.0/9.0,-8.0/9.0, 8.0/9.0, 6.0/9.0,-8.0/9.0, + -8.0/9.0, 8.0/9.0,-8.0/9.0, -6.0/9.0, 8.0/9.0,-8.0/9.0, -4.0/9.0, 8.0/9.0,-8.0/9.0, + -2.0/9.0, 8.0/9.0,-8.0/9.0, 0.0, 8.0/9.0,-8.0/9.0, 2.0/9.0, 8.0/9.0,-8.0/9.0, + 4.0/9.0, 8.0/9.0,-8.0/9.0, 6.0/9.0, 8.0/9.0,-8.0/9.0, 8.0/9.0, 8.0/9.0,-8.0/9.0, + -8.0/9.0,-8.0/9.0,-6.0/9.0, -6.0/9.0,-8.0/9.0,-6.0/9.0, -4.0/9.0,-8.0/9.0,-6.0/9.0, + -2.0/9.0,-8.0/9.0,-6.0/9.0, 0.0,-8.0/9.0,-6.0/9.0, 2.0/9.0,-8.0/9.0,-6.0/9.0, + 4.0/9.0,-8.0/9.0,-6.0/9.0, 6.0/9.0,-8.0/9.0,-6.0/9.0, 8.0/9.0,-8.0/9.0,-6.0/9.0, + -8.0/9.0,-6.0/9.0,-6.0/9.0, -6.0/9.0,-6.0/9.0,-6.0/9.0, -4.0/9.0,-6.0/9.0,-6.0/9.0, + -2.0/9.0,-6.0/9.0,-6.0/9.0, 0.0,-6.0/9.0,-6.0/9.0, 2.0/9.0,-6.0/9.0,-6.0/9.0, + 4.0/9.0,-6.0/9.0,-6.0/9.0, 6.0/9.0,-6.0/9.0,-6.0/9.0, 8.0/9.0,-6.0/9.0,-6.0/9.0, + -8.0/9.0,-4.0/9.0,-6.0/9.0, -6.0/9.0,-4.0/9.0,-6.0/9.0, -4.0/9.0,-4.0/9.0,-6.0/9.0, + -2.0/9.0,-4.0/9.0,-6.0/9.0, 0.0,-4.0/9.0,-6.0/9.0, 2.0/9.0,-4.0/9.0,-6.0/9.0, + 4.0/9.0,-4.0/9.0,-6.0/9.0, 6.0/9.0,-4.0/9.0,-6.0/9.0, 8.0/9.0,-4.0/9.0,-6.0/9.0, + -8.0/9.0,-2.0/9.0,-6.0/9.0, -6.0/9.0,-2.0/9.0,-6.0/9.0, -4.0/9.0,-2.0/9.0,-6.0/9.0, + -2.0/9.0,-2.0/9.0,-6.0/9.0, 0.0,-2.0/9.0,-6.0/9.0, 2.0/9.0,-2.0/9.0,-6.0/9.0, + 4.0/9.0,-2.0/9.0,-6.0/9.0, 6.0/9.0,-2.0/9.0,-6.0/9.0, 8.0/9.0,-2.0/9.0,-6.0/9.0, + -8.0/9.0, 0.0,-6.0/9.0, -6.0/9.0, 0.0,-6.0/9.0, -4.0/9.0, 0.0,-6.0/9.0, + -2.0/9.0, 0.0,-6.0/9.0, 0.0, 0.0,-6.0/9.0, 2.0/9.0, 0.0,-6.0/9.0, + 4.0/9.0, 0.0,-6.0/9.0, 6.0/9.0, 0.0,-6.0/9.0, 8.0/9.0, 0.0,-6.0/9.0, + -8.0/9.0, 2.0/9.0,-6.0/9.0, -6.0/9.0, 2.0/9.0,-6.0/9.0, -4.0/9.0, 2.0/9.0,-6.0/9.0, + -2.0/9.0, 2.0/9.0,-6.0/9.0, 0.0, 2.0/9.0,-6.0/9.0, 2.0/9.0, 2.0/9.0,-6.0/9.0, + 4.0/9.0, 2.0/9.0,-6.0/9.0, 6.0/9.0, 2.0/9.0,-6.0/9.0, 8.0/9.0, 2.0/9.0,-6.0/9.0, + -8.0/9.0, 4.0/9.0,-6.0/9.0, -6.0/9.0, 4.0/9.0,-6.0/9.0, -4.0/9.0, 4.0/9.0,-6.0/9.0, + -2.0/9.0, 4.0/9.0,-6.0/9.0, 0.0, 4.0/9.0,-6.0/9.0, 2.0/9.0, 4.0/9.0,-6.0/9.0, + 4.0/9.0, 4.0/9.0,-6.0/9.0, 6.0/9.0, 4.0/9.0,-6.0/9.0, 8.0/9.0, 4.0/9.0,-6.0/9.0, + -8.0/9.0, 6.0/9.0,-6.0/9.0, -6.0/9.0, 6.0/9.0,-6.0/9.0, -4.0/9.0, 6.0/9.0,-6.0/9.0, + -2.0/9.0, 6.0/9.0,-6.0/9.0, 0.0, 6.0/9.0,-6.0/9.0, 2.0/9.0, 6.0/9.0,-6.0/9.0, + 4.0/9.0, 6.0/9.0,-6.0/9.0, 6.0/9.0, 6.0/9.0,-6.0/9.0, 8.0/9.0, 6.0/9.0,-6.0/9.0, + -8.0/9.0, 8.0/9.0,-6.0/9.0, -6.0/9.0, 8.0/9.0,-6.0/9.0, -4.0/9.0, 8.0/9.0,-6.0/9.0, + -2.0/9.0, 8.0/9.0,-6.0/9.0, 0.0, 8.0/9.0,-6.0/9.0, 2.0/9.0, 8.0/9.0,-6.0/9.0, + 4.0/9.0, 8.0/9.0,-6.0/9.0, 6.0/9.0, 8.0/9.0,-6.0/9.0, 8.0/9.0, 8.0/9.0,-6.0/9.0, + -8.0/9.0,-8.0/9.0,-4.0/9.0, -6.0/9.0,-8.0/9.0,-4.0/9.0, -4.0/9.0,-8.0/9.0,-4.0/9.0, + -2.0/9.0,-8.0/9.0,-4.0/9.0, 0.0,-8.0/9.0,-4.0/9.0, 2.0/9.0,-8.0/9.0,-4.0/9.0, + 4.0/9.0,-8.0/9.0,-4.0/9.0, 6.0/9.0,-8.0/9.0,-4.0/9.0, 8.0/9.0,-8.0/9.0,-4.0/9.0, + -8.0/9.0,-6.0/9.0,-4.0/9.0, -6.0/9.0,-6.0/9.0,-4.0/9.0, -4.0/9.0,-6.0/9.0,-4.0/9.0, + -2.0/9.0,-6.0/9.0,-4.0/9.0, 0.0,-6.0/9.0,-4.0/9.0, 2.0/9.0,-6.0/9.0,-4.0/9.0, + 4.0/9.0,-6.0/9.0,-4.0/9.0, 6.0/9.0,-6.0/9.0,-4.0/9.0, 8.0/9.0,-6.0/9.0,-4.0/9.0, + -8.0/9.0,-4.0/9.0,-4.0/9.0, -6.0/9.0,-4.0/9.0,-4.0/9.0, -4.0/9.0,-4.0/9.0,-4.0/9.0, + -2.0/9.0,-4.0/9.0,-4.0/9.0, 0.0,-4.0/9.0,-4.0/9.0, 2.0/9.0,-4.0/9.0,-4.0/9.0, + 4.0/9.0,-4.0/9.0,-4.0/9.0, 6.0/9.0,-4.0/9.0,-4.0/9.0, 8.0/9.0,-4.0/9.0,-4.0/9.0, + -8.0/9.0,-2.0/9.0,-4.0/9.0, -6.0/9.0,-2.0/9.0,-4.0/9.0, -4.0/9.0,-2.0/9.0,-4.0/9.0, + -2.0/9.0,-2.0/9.0,-4.0/9.0, 0.0,-2.0/9.0,-4.0/9.0, 2.0/9.0,-2.0/9.0,-4.0/9.0, + 4.0/9.0,-2.0/9.0,-4.0/9.0, 6.0/9.0,-2.0/9.0,-4.0/9.0, 8.0/9.0,-2.0/9.0,-4.0/9.0, + -8.0/9.0, 0.0,-4.0/9.0, -6.0/9.0, 0.0,-4.0/9.0, -4.0/9.0, 0.0,-4.0/9.0, + -2.0/9.0, 0.0,-4.0/9.0, 0.0, 0.0,-4.0/9.0, 2.0/9.0, 0.0,-4.0/9.0, + 4.0/9.0, 0.0,-4.0/9.0, 6.0/9.0, 0.0,-4.0/9.0, 8.0/9.0, 0.0,-4.0/9.0, + -8.0/9.0, 2.0/9.0,-4.0/9.0, -6.0/9.0, 2.0/9.0,-4.0/9.0, -4.0/9.0, 2.0/9.0,-4.0/9.0, + -2.0/9.0, 2.0/9.0,-4.0/9.0, 0.0, 2.0/9.0,-4.0/9.0, 2.0/9.0, 2.0/9.0,-4.0/9.0, + 4.0/9.0, 2.0/9.0,-4.0/9.0, 6.0/9.0, 2.0/9.0,-4.0/9.0, 8.0/9.0, 2.0/9.0,-4.0/9.0, + -8.0/9.0, 4.0/9.0,-4.0/9.0, -6.0/9.0, 4.0/9.0,-4.0/9.0, -4.0/9.0, 4.0/9.0,-4.0/9.0, + -2.0/9.0, 4.0/9.0,-4.0/9.0, 0.0, 4.0/9.0,-4.0/9.0, 2.0/9.0, 4.0/9.0,-4.0/9.0, + 4.0/9.0, 4.0/9.0,-4.0/9.0, 6.0/9.0, 4.0/9.0,-4.0/9.0, 8.0/9.0, 4.0/9.0,-4.0/9.0, + -8.0/9.0, 6.0/9.0,-4.0/9.0, -6.0/9.0, 6.0/9.0,-4.0/9.0, -4.0/9.0, 6.0/9.0,-4.0/9.0, + -2.0/9.0, 6.0/9.0,-4.0/9.0, 0.0, 6.0/9.0,-4.0/9.0, 2.0/9.0, 6.0/9.0,-4.0/9.0, + 4.0/9.0, 6.0/9.0,-4.0/9.0, 6.0/9.0, 6.0/9.0,-4.0/9.0, 8.0/9.0, 6.0/9.0,-4.0/9.0, + -8.0/9.0, 8.0/9.0,-4.0/9.0, -6.0/9.0, 8.0/9.0,-4.0/9.0, -4.0/9.0, 8.0/9.0,-4.0/9.0, + -2.0/9.0, 8.0/9.0,-4.0/9.0, 0.0, 8.0/9.0,-4.0/9.0, 2.0/9.0, 8.0/9.0,-4.0/9.0, + 4.0/9.0, 8.0/9.0,-4.0/9.0, 6.0/9.0, 8.0/9.0,-4.0/9.0, 8.0/9.0, 8.0/9.0,-4.0/9.0, + -8.0/9.0,-8.0/9.0,-2.0/9.0, -6.0/9.0,-8.0/9.0,-2.0/9.0, -4.0/9.0,-8.0/9.0,-2.0/9.0, + -2.0/9.0,-8.0/9.0,-2.0/9.0, 0.0,-8.0/9.0,-2.0/9.0, 2.0/9.0,-8.0/9.0,-2.0/9.0, + 4.0/9.0,-8.0/9.0,-2.0/9.0, 6.0/9.0,-8.0/9.0,-2.0/9.0, 8.0/9.0,-8.0/9.0,-2.0/9.0, + -8.0/9.0,-6.0/9.0,-2.0/9.0, -6.0/9.0,-6.0/9.0,-2.0/9.0, -4.0/9.0,-6.0/9.0,-2.0/9.0, + -2.0/9.0,-6.0/9.0,-2.0/9.0, 0.0,-6.0/9.0,-2.0/9.0, 2.0/9.0,-6.0/9.0,-2.0/9.0, + 4.0/9.0,-6.0/9.0,-2.0/9.0, 6.0/9.0,-6.0/9.0,-2.0/9.0, 8.0/9.0,-6.0/9.0,-2.0/9.0, + -8.0/9.0,-4.0/9.0,-2.0/9.0, -6.0/9.0,-4.0/9.0,-2.0/9.0, -4.0/9.0,-4.0/9.0,-2.0/9.0, + -2.0/9.0,-4.0/9.0,-2.0/9.0, 0.0,-4.0/9.0,-2.0/9.0, 2.0/9.0,-4.0/9.0,-2.0/9.0, + 4.0/9.0,-4.0/9.0,-2.0/9.0, 6.0/9.0,-4.0/9.0,-2.0/9.0, 8.0/9.0,-4.0/9.0,-2.0/9.0, + -8.0/9.0,-2.0/9.0,-2.0/9.0, -6.0/9.0,-2.0/9.0,-2.0/9.0, -4.0/9.0,-2.0/9.0,-2.0/9.0, + -2.0/9.0,-2.0/9.0,-2.0/9.0, 0.0,-2.0/9.0,-2.0/9.0, 2.0/9.0,-2.0/9.0,-2.0/9.0, + 4.0/9.0,-2.0/9.0,-2.0/9.0, 6.0/9.0,-2.0/9.0,-2.0/9.0, 8.0/9.0,-2.0/9.0,-2.0/9.0, + -8.0/9.0, 0.0,-2.0/9.0, -6.0/9.0, 0.0,-2.0/9.0, -4.0/9.0, 0.0,-2.0/9.0, + -2.0/9.0, 0.0,-2.0/9.0, 0.0, 0.0,-2.0/9.0, 2.0/9.0, 0.0,-2.0/9.0, + 4.0/9.0, 0.0,-2.0/9.0, 6.0/9.0, 0.0,-2.0/9.0, 8.0/9.0, 0.0,-2.0/9.0, + -8.0/9.0, 2.0/9.0,-2.0/9.0, -6.0/9.0, 2.0/9.0,-2.0/9.0, -4.0/9.0, 2.0/9.0,-2.0/9.0, + -2.0/9.0, 2.0/9.0,-2.0/9.0, 0.0, 2.0/9.0,-2.0/9.0, 2.0/9.0, 2.0/9.0,-2.0/9.0, + 4.0/9.0, 2.0/9.0,-2.0/9.0, 6.0/9.0, 2.0/9.0,-2.0/9.0, 8.0/9.0, 2.0/9.0,-2.0/9.0, + -8.0/9.0, 4.0/9.0,-2.0/9.0, -6.0/9.0, 4.0/9.0,-2.0/9.0, -4.0/9.0, 4.0/9.0,-2.0/9.0, + -2.0/9.0, 4.0/9.0,-2.0/9.0, 0.0, 4.0/9.0,-2.0/9.0, 2.0/9.0, 4.0/9.0,-2.0/9.0, + 4.0/9.0, 4.0/9.0,-2.0/9.0, 6.0/9.0, 4.0/9.0,-2.0/9.0, 8.0/9.0, 4.0/9.0,-2.0/9.0, + -8.0/9.0, 6.0/9.0,-2.0/9.0, -6.0/9.0, 6.0/9.0,-2.0/9.0, -4.0/9.0, 6.0/9.0,-2.0/9.0, + -2.0/9.0, 6.0/9.0,-2.0/9.0, 0.0, 6.0/9.0,-2.0/9.0, 2.0/9.0, 6.0/9.0,-2.0/9.0, + 4.0/9.0, 6.0/9.0,-2.0/9.0, 6.0/9.0, 6.0/9.0,-2.0/9.0, 8.0/9.0, 6.0/9.0,-2.0/9.0, + -8.0/9.0, 8.0/9.0,-2.0/9.0, -6.0/9.0, 8.0/9.0,-2.0/9.0, -4.0/9.0, 8.0/9.0,-2.0/9.0, + -2.0/9.0, 8.0/9.0,-2.0/9.0, 0.0, 8.0/9.0,-2.0/9.0, 2.0/9.0, 8.0/9.0,-2.0/9.0, + 4.0/9.0, 8.0/9.0,-2.0/9.0, 6.0/9.0, 8.0/9.0,-2.0/9.0, 8.0/9.0, 8.0/9.0,-2.0/9.0, + -8.0/9.0,-8.0/9.0, 0.0, -6.0/9.0,-8.0/9.0, 0.0, -4.0/9.0,-8.0/9.0, 0.0, + -2.0/9.0,-8.0/9.0, 0.0, 0.0,-8.0/9.0, 0.0, 2.0/9.0,-8.0/9.0, 0.0, + 4.0/9.0,-8.0/9.0, 0.0, 6.0/9.0,-8.0/9.0, 0.0, 8.0/9.0,-8.0/9.0, 0.0, + -8.0/9.0,-6.0/9.0, 0.0, -6.0/9.0,-6.0/9.0, 0.0, -4.0/9.0,-6.0/9.0, 0.0, + -2.0/9.0,-6.0/9.0, 0.0, 0.0,-6.0/9.0, 0.0, 2.0/9.0,-6.0/9.0, 0.0, + 4.0/9.0,-6.0/9.0, 0.0, 6.0/9.0,-6.0/9.0, 0.0, 8.0/9.0,-6.0/9.0, 0.0, + -8.0/9.0,-4.0/9.0, 0.0, -6.0/9.0,-4.0/9.0, 0.0, -4.0/9.0,-4.0/9.0, 0.0, + -2.0/9.0,-4.0/9.0, 0.0, 0.0,-4.0/9.0, 0.0, 2.0/9.0,-4.0/9.0, 0.0, + 4.0/9.0,-4.0/9.0, 0.0, 6.0/9.0,-4.0/9.0, 0.0, 8.0/9.0,-4.0/9.0, 0.0, + -8.0/9.0,-2.0/9.0, 0.0, -6.0/9.0,-2.0/9.0, 0.0, -4.0/9.0,-2.0/9.0, 0.0, + -2.0/9.0,-2.0/9.0, 0.0, 0.0,-2.0/9.0, 0.0, 2.0/9.0,-2.0/9.0, 0.0, + 4.0/9.0,-2.0/9.0, 0.0, 6.0/9.0,-2.0/9.0, 0.0, 8.0/9.0,-2.0/9.0, 0.0, + -8.0/9.0, 0.0, 0.0, -6.0/9.0, 0.0, 0.0, -4.0/9.0, 0.0, 0.0, + -2.0/9.0, 0.0, 0.0, 0.0, 0.0, 0.0, 2.0/9.0, 0.0, 0.0, + 4.0/9.0, 0.0, 0.0, 6.0/9.0, 0.0, 0.0, 8.0/9.0, 0.0, 0.0, + -8.0/9.0, 2.0/9.0, 0.0, -6.0/9.0, 2.0/9.0, 0.0, -4.0/9.0, 2.0/9.0, 0.0, + -2.0/9.0, 2.0/9.0, 0.0, 0.0, 2.0/9.0, 0.0, 2.0/9.0, 2.0/9.0, 0.0, + 4.0/9.0, 2.0/9.0, 0.0, 6.0/9.0, 2.0/9.0, 0.0, 8.0/9.0, 2.0/9.0, 0.0, + -8.0/9.0, 4.0/9.0, 0.0, -6.0/9.0, 4.0/9.0, 0.0, -4.0/9.0, 4.0/9.0, 0.0, + -2.0/9.0, 4.0/9.0, 0.0, 0.0, 4.0/9.0, 0.0, 2.0/9.0, 4.0/9.0, 0.0, + 4.0/9.0, 4.0/9.0, 0.0, 6.0/9.0, 4.0/9.0, 0.0, 8.0/9.0, 4.0/9.0, 0.0, + -8.0/9.0, 6.0/9.0, 0.0, -6.0/9.0, 6.0/9.0, 0.0, -4.0/9.0, 6.0/9.0, 0.0, + -2.0/9.0, 6.0/9.0, 0.0, 0.0, 6.0/9.0, 0.0, 2.0/9.0, 6.0/9.0, 0.0, + 4.0/9.0, 6.0/9.0, 0.0, 6.0/9.0, 6.0/9.0, 0.0, 8.0/9.0, 6.0/9.0, 0.0, + -8.0/9.0, 8.0/9.0, 0.0, -6.0/9.0, 8.0/9.0, 0.0, -4.0/9.0, 8.0/9.0, 0.0, + -2.0/9.0, 8.0/9.0, 0.0, 0.0, 8.0/9.0, 0.0, 2.0/9.0, 8.0/9.0, 0.0, + 4.0/9.0, 8.0/9.0, 0.0, 6.0/9.0, 8.0/9.0, 0.0, 8.0/9.0, 8.0/9.0, 0.0, + -8.0/9.0,-8.0/9.0, 2.0/9.0, -6.0/9.0,-8.0/9.0, 2.0/9.0, -4.0/9.0,-8.0/9.0, 2.0/9.0, + -2.0/9.0,-8.0/9.0, 2.0/9.0, 0.0,-8.0/9.0, 2.0/9.0, 2.0/9.0,-8.0/9.0, 2.0/9.0, + 4.0/9.0,-8.0/9.0, 2.0/9.0, 6.0/9.0,-8.0/9.0, 2.0/9.0, 8.0/9.0,-8.0/9.0, 2.0/9.0, + -8.0/9.0,-6.0/9.0, 2.0/9.0, -6.0/9.0,-6.0/9.0, 2.0/9.0, -4.0/9.0,-6.0/9.0, 2.0/9.0, + -2.0/9.0,-6.0/9.0, 2.0/9.0, 0.0,-6.0/9.0, 2.0/9.0, 2.0/9.0,-6.0/9.0, 2.0/9.0, + 4.0/9.0,-6.0/9.0, 2.0/9.0, 6.0/9.0,-6.0/9.0, 2.0/9.0, 8.0/9.0,-6.0/9.0, 2.0/9.0, + -8.0/9.0,-4.0/9.0, 2.0/9.0, -6.0/9.0,-4.0/9.0, 2.0/9.0, -4.0/9.0,-4.0/9.0, 2.0/9.0, + -2.0/9.0,-4.0/9.0, 2.0/9.0, 0.0,-4.0/9.0, 2.0/9.0, 2.0/9.0,-4.0/9.0, 2.0/9.0, + 4.0/9.0,-4.0/9.0, 2.0/9.0, 6.0/9.0,-4.0/9.0, 2.0/9.0, 8.0/9.0,-4.0/9.0, 2.0/9.0, + -8.0/9.0,-2.0/9.0, 2.0/9.0, -6.0/9.0,-2.0/9.0, 2.0/9.0, -4.0/9.0,-2.0/9.0, 2.0/9.0, + -2.0/9.0,-2.0/9.0, 2.0/9.0, 0.0,-2.0/9.0, 2.0/9.0, 2.0/9.0,-2.0/9.0, 2.0/9.0, + 4.0/9.0,-2.0/9.0, 2.0/9.0, 6.0/9.0,-2.0/9.0, 2.0/9.0, 8.0/9.0,-2.0/9.0, 2.0/9.0, + -8.0/9.0, 0.0, 2.0/9.0, -6.0/9.0, 0.0, 2.0/9.0, -4.0/9.0, 0.0, 2.0/9.0, + -2.0/9.0, 0.0, 2.0/9.0, 0.0, 0.0, 2.0/9.0, 2.0/9.0, 0.0, 2.0/9.0, + 4.0/9.0, 0.0, 2.0/9.0, 6.0/9.0, 0.0, 2.0/9.0, 8.0/9.0, 0.0, 2.0/9.0, + -8.0/9.0, 2.0/9.0, 2.0/9.0, -6.0/9.0, 2.0/9.0, 2.0/9.0, -4.0/9.0, 2.0/9.0, 2.0/9.0, + -2.0/9.0, 2.0/9.0, 2.0/9.0, 0.0, 2.0/9.0, 2.0/9.0, 2.0/9.0, 2.0/9.0, 2.0/9.0, + 4.0/9.0, 2.0/9.0, 2.0/9.0, 6.0/9.0, 2.0/9.0, 2.0/9.0, 8.0/9.0, 2.0/9.0, 2.0/9.0, + -8.0/9.0, 4.0/9.0, 2.0/9.0, -6.0/9.0, 4.0/9.0, 2.0/9.0, -4.0/9.0, 4.0/9.0, 2.0/9.0, + -2.0/9.0, 4.0/9.0, 2.0/9.0, 0.0, 4.0/9.0, 2.0/9.0, 2.0/9.0, 4.0/9.0, 2.0/9.0, + 4.0/9.0, 4.0/9.0, 2.0/9.0, 6.0/9.0, 4.0/9.0, 2.0/9.0, 8.0/9.0, 4.0/9.0, 2.0/9.0, + -8.0/9.0, 6.0/9.0, 2.0/9.0, -6.0/9.0, 6.0/9.0, 2.0/9.0, -4.0/9.0, 6.0/9.0, 2.0/9.0, + -2.0/9.0, 6.0/9.0, 2.0/9.0, 0.0, 6.0/9.0, 2.0/9.0, 2.0/9.0, 6.0/9.0, 2.0/9.0, + 4.0/9.0, 6.0/9.0, 2.0/9.0, 6.0/9.0, 6.0/9.0, 2.0/9.0, 8.0/9.0, 6.0/9.0, 2.0/9.0, + -8.0/9.0, 8.0/9.0, 2.0/9.0, -6.0/9.0, 8.0/9.0, 2.0/9.0, -4.0/9.0, 8.0/9.0, 2.0/9.0, + -2.0/9.0, 8.0/9.0, 2.0/9.0, 0.0, 8.0/9.0, 2.0/9.0, 2.0/9.0, 8.0/9.0, 2.0/9.0, + 4.0/9.0, 8.0/9.0, 2.0/9.0, 6.0/9.0, 8.0/9.0, 2.0/9.0, 8.0/9.0, 8.0/9.0, 2.0/9.0, + -8.0/9.0,-8.0/9.0, 4.0/9.0, -6.0/9.0,-8.0/9.0, 4.0/9.0, -4.0/9.0,-8.0/9.0, 4.0/9.0, + -2.0/9.0,-8.0/9.0, 4.0/9.0, 0.0,-8.0/9.0, 4.0/9.0, 2.0/9.0,-8.0/9.0, 4.0/9.0, + 4.0/9.0,-8.0/9.0, 4.0/9.0, 6.0/9.0,-8.0/9.0, 4.0/9.0, 8.0/9.0,-8.0/9.0, 4.0/9.0, + -8.0/9.0,-6.0/9.0, 4.0/9.0, -6.0/9.0,-6.0/9.0, 4.0/9.0, -4.0/9.0,-6.0/9.0, 4.0/9.0, + -2.0/9.0,-6.0/9.0, 4.0/9.0, 0.0,-6.0/9.0, 4.0/9.0, 2.0/9.0,-6.0/9.0, 4.0/9.0, + 4.0/9.0,-6.0/9.0, 4.0/9.0, 6.0/9.0,-6.0/9.0, 4.0/9.0, 8.0/9.0,-6.0/9.0, 4.0/9.0, + -8.0/9.0,-4.0/9.0, 4.0/9.0, -6.0/9.0,-4.0/9.0, 4.0/9.0, -4.0/9.0,-4.0/9.0, 4.0/9.0, + -2.0/9.0,-4.0/9.0, 4.0/9.0, 0.0,-4.0/9.0, 4.0/9.0, 2.0/9.0,-4.0/9.0, 4.0/9.0, + 4.0/9.0,-4.0/9.0, 4.0/9.0, 6.0/9.0,-4.0/9.0, 4.0/9.0, 8.0/9.0,-4.0/9.0, 4.0/9.0, + -8.0/9.0,-2.0/9.0, 4.0/9.0, -6.0/9.0,-2.0/9.0, 4.0/9.0, -4.0/9.0,-2.0/9.0, 4.0/9.0, + -2.0/9.0,-2.0/9.0, 4.0/9.0, 0.0,-2.0/9.0, 4.0/9.0, 2.0/9.0,-2.0/9.0, 4.0/9.0, + 4.0/9.0,-2.0/9.0, 4.0/9.0, 6.0/9.0,-2.0/9.0, 4.0/9.0, 8.0/9.0,-2.0/9.0, 4.0/9.0, + -8.0/9.0, 0.0, 4.0/9.0, -6.0/9.0, 0.0, 4.0/9.0, -4.0/9.0, 0.0, 4.0/9.0, + -2.0/9.0, 0.0, 4.0/9.0, 0.0, 0.0, 4.0/9.0, 2.0/9.0, 0.0, 4.0/9.0, + 4.0/9.0, 0.0, 4.0/9.0, 6.0/9.0, 0.0, 4.0/9.0, 8.0/9.0, 0.0, 4.0/9.0, + -8.0/9.0, 2.0/9.0, 4.0/9.0, -6.0/9.0, 2.0/9.0, 4.0/9.0, -4.0/9.0, 2.0/9.0, 4.0/9.0, + -2.0/9.0, 2.0/9.0, 4.0/9.0, 0.0, 2.0/9.0, 4.0/9.0, 2.0/9.0, 2.0/9.0, 4.0/9.0, + 4.0/9.0, 2.0/9.0, 4.0/9.0, 6.0/9.0, 2.0/9.0, 4.0/9.0, 8.0/9.0, 2.0/9.0, 4.0/9.0, + -8.0/9.0, 4.0/9.0, 4.0/9.0, -6.0/9.0, 4.0/9.0, 4.0/9.0, -4.0/9.0, 4.0/9.0, 4.0/9.0, + -2.0/9.0, 4.0/9.0, 4.0/9.0, 0.0, 4.0/9.0, 4.0/9.0, 2.0/9.0, 4.0/9.0, 4.0/9.0, + 4.0/9.0, 4.0/9.0, 4.0/9.0, 6.0/9.0, 4.0/9.0, 4.0/9.0, 8.0/9.0, 4.0/9.0, 4.0/9.0, + -8.0/9.0, 6.0/9.0, 4.0/9.0, -6.0/9.0, 6.0/9.0, 4.0/9.0, -4.0/9.0, 6.0/9.0, 4.0/9.0, + -2.0/9.0, 6.0/9.0, 4.0/9.0, 0.0, 6.0/9.0, 4.0/9.0, 2.0/9.0, 6.0/9.0, 4.0/9.0, + 4.0/9.0, 6.0/9.0, 4.0/9.0, 6.0/9.0, 6.0/9.0, 4.0/9.0, 8.0/9.0, 6.0/9.0, 4.0/9.0, + -8.0/9.0, 8.0/9.0, 4.0/9.0, -6.0/9.0, 8.0/9.0, 4.0/9.0, -4.0/9.0, 8.0/9.0, 4.0/9.0, + -2.0/9.0, 8.0/9.0, 4.0/9.0, 0.0, 8.0/9.0, 4.0/9.0, 2.0/9.0, 8.0/9.0, 4.0/9.0, + 4.0/9.0, 8.0/9.0, 4.0/9.0, 6.0/9.0, 8.0/9.0, 4.0/9.0, 8.0/9.0, 8.0/9.0, 4.0/9.0, + -8.0/9.0,-8.0/9.0, 6.0/9.0, -6.0/9.0,-8.0/9.0, 6.0/9.0, -4.0/9.0,-8.0/9.0, 6.0/9.0, + -2.0/9.0,-8.0/9.0, 6.0/9.0, 0.0,-8.0/9.0, 6.0/9.0, 2.0/9.0,-8.0/9.0, 6.0/9.0, + 4.0/9.0,-8.0/9.0, 6.0/9.0, 6.0/9.0,-8.0/9.0, 6.0/9.0, 8.0/9.0,-8.0/9.0, 6.0/9.0, + -8.0/9.0,-6.0/9.0, 6.0/9.0, -6.0/9.0,-6.0/9.0, 6.0/9.0, -4.0/9.0,-6.0/9.0, 6.0/9.0, + -2.0/9.0,-6.0/9.0, 6.0/9.0, 0.0,-6.0/9.0, 6.0/9.0, 2.0/9.0,-6.0/9.0, 6.0/9.0, + 4.0/9.0,-6.0/9.0, 6.0/9.0, 6.0/9.0,-6.0/9.0, 6.0/9.0, 8.0/9.0,-6.0/9.0, 6.0/9.0, + -8.0/9.0,-4.0/9.0, 6.0/9.0, -6.0/9.0,-4.0/9.0, 6.0/9.0, -4.0/9.0,-4.0/9.0, 6.0/9.0, + -2.0/9.0,-4.0/9.0, 6.0/9.0, 0.0,-4.0/9.0, 6.0/9.0, 2.0/9.0,-4.0/9.0, 6.0/9.0, + 4.0/9.0,-4.0/9.0, 6.0/9.0, 6.0/9.0,-4.0/9.0, 6.0/9.0, 8.0/9.0,-4.0/9.0, 6.0/9.0, + -8.0/9.0,-2.0/9.0, 6.0/9.0, -6.0/9.0,-2.0/9.0, 6.0/9.0, -4.0/9.0,-2.0/9.0, 6.0/9.0, + -2.0/9.0,-2.0/9.0, 6.0/9.0, 0.0,-2.0/9.0, 6.0/9.0, 2.0/9.0,-2.0/9.0, 6.0/9.0, + 4.0/9.0,-2.0/9.0, 6.0/9.0, 6.0/9.0,-2.0/9.0, 6.0/9.0, 8.0/9.0,-2.0/9.0, 6.0/9.0, + -8.0/9.0, 0.0, 6.0/9.0, -6.0/9.0, 0.0, 6.0/9.0, -4.0/9.0, 0.0, 6.0/9.0, + -2.0/9.0, 0.0, 6.0/9.0, 0.0, 0.0, 6.0/9.0, 2.0/9.0, 0.0, 6.0/9.0, + 4.0/9.0, 0.0, 6.0/9.0, 6.0/9.0, 0.0, 6.0/9.0, 8.0/9.0, 0.0, 6.0/9.0, + -8.0/9.0, 2.0/9.0, 6.0/9.0, -6.0/9.0, 2.0/9.0, 6.0/9.0, -4.0/9.0, 2.0/9.0, 6.0/9.0, + -2.0/9.0, 2.0/9.0, 6.0/9.0, 0.0, 2.0/9.0, 6.0/9.0, 2.0/9.0, 2.0/9.0, 6.0/9.0, + 4.0/9.0, 2.0/9.0, 6.0/9.0, 6.0/9.0, 2.0/9.0, 6.0/9.0, 8.0/9.0, 2.0/9.0, 6.0/9.0, + -8.0/9.0, 4.0/9.0, 6.0/9.0, -6.0/9.0, 4.0/9.0, 6.0/9.0, -4.0/9.0, 4.0/9.0, 6.0/9.0, + -2.0/9.0, 4.0/9.0, 6.0/9.0, 0.0, 4.0/9.0, 6.0/9.0, 2.0/9.0, 4.0/9.0, 6.0/9.0, + 4.0/9.0, 4.0/9.0, 6.0/9.0, 6.0/9.0, 4.0/9.0, 6.0/9.0, 8.0/9.0, 4.0/9.0, 6.0/9.0, + -8.0/9.0, 6.0/9.0, 6.0/9.0, -6.0/9.0, 6.0/9.0, 6.0/9.0, -4.0/9.0, 6.0/9.0, 6.0/9.0, + -2.0/9.0, 6.0/9.0, 6.0/9.0, 0.0, 6.0/9.0, 6.0/9.0, 2.0/9.0, 6.0/9.0, 6.0/9.0, + 4.0/9.0, 6.0/9.0, 6.0/9.0, 6.0/9.0, 6.0/9.0, 6.0/9.0, 8.0/9.0, 6.0/9.0, 6.0/9.0, + -8.0/9.0, 8.0/9.0, 6.0/9.0, -6.0/9.0, 8.0/9.0, 6.0/9.0, -4.0/9.0, 8.0/9.0, 6.0/9.0, + -2.0/9.0, 8.0/9.0, 6.0/9.0, 0.0, 8.0/9.0, 6.0/9.0, 2.0/9.0, 8.0/9.0, 6.0/9.0, + 4.0/9.0, 8.0/9.0, 6.0/9.0, 6.0/9.0, 8.0/9.0, 6.0/9.0, 8.0/9.0, 8.0/9.0, 6.0/9.0, + -8.0/9.0,-8.0/9.0, 8.0/9.0, -6.0/9.0,-8.0/9.0, 8.0/9.0, -4.0/9.0,-8.0/9.0, 8.0/9.0, + -2.0/9.0,-8.0/9.0, 8.0/9.0, 0.0,-8.0/9.0, 8.0/9.0, 2.0/9.0,-8.0/9.0, 8.0/9.0, + 4.0/9.0,-8.0/9.0, 8.0/9.0, 6.0/9.0,-8.0/9.0, 8.0/9.0, 8.0/9.0,-8.0/9.0, 8.0/9.0, + -8.0/9.0,-6.0/9.0, 8.0/9.0, -6.0/9.0,-6.0/9.0, 8.0/9.0, -4.0/9.0,-6.0/9.0, 8.0/9.0, + -2.0/9.0,-6.0/9.0, 8.0/9.0, 0.0,-6.0/9.0, 8.0/9.0, 2.0/9.0,-6.0/9.0, 8.0/9.0, + 4.0/9.0,-6.0/9.0, 8.0/9.0, 6.0/9.0,-6.0/9.0, 8.0/9.0, 8.0/9.0,-6.0/9.0, 8.0/9.0, + -8.0/9.0,-4.0/9.0, 8.0/9.0, -6.0/9.0,-4.0/9.0, 8.0/9.0, -4.0/9.0,-4.0/9.0, 8.0/9.0, + -2.0/9.0,-4.0/9.0, 8.0/9.0, 0.0,-4.0/9.0, 8.0/9.0, 2.0/9.0,-4.0/9.0, 8.0/9.0, + 4.0/9.0,-4.0/9.0, 8.0/9.0, 6.0/9.0,-4.0/9.0, 8.0/9.0, 8.0/9.0,-4.0/9.0, 8.0/9.0, + -8.0/9.0,-2.0/9.0, 8.0/9.0, -6.0/9.0,-2.0/9.0, 8.0/9.0, -4.0/9.0,-2.0/9.0, 8.0/9.0, + -2.0/9.0,-2.0/9.0, 8.0/9.0, 0.0,-2.0/9.0, 8.0/9.0, 2.0/9.0,-2.0/9.0, 8.0/9.0, + 4.0/9.0,-2.0/9.0, 8.0/9.0, 6.0/9.0,-2.0/9.0, 8.0/9.0, 8.0/9.0,-2.0/9.0, 8.0/9.0, + -8.0/9.0, 0.0, 8.0/9.0, -6.0/9.0, 0.0, 8.0/9.0, -4.0/9.0, 0.0, 8.0/9.0, + -2.0/9.0, 0.0, 8.0/9.0, 0.0, 0.0, 8.0/9.0, 2.0/9.0, 0.0, 8.0/9.0, + 4.0/9.0, 0.0, 8.0/9.0, 6.0/9.0, 0.0, 8.0/9.0, 8.0/9.0, 0.0, 8.0/9.0, + -8.0/9.0, 2.0/9.0, 8.0/9.0, -6.0/9.0, 2.0/9.0, 8.0/9.0, -4.0/9.0, 2.0/9.0, 8.0/9.0, + -2.0/9.0, 2.0/9.0, 8.0/9.0, 0.0, 2.0/9.0, 8.0/9.0, 2.0/9.0, 2.0/9.0, 8.0/9.0, + 4.0/9.0, 2.0/9.0, 8.0/9.0, 6.0/9.0, 2.0/9.0, 8.0/9.0, 8.0/9.0, 2.0/9.0, 8.0/9.0, + -8.0/9.0, 4.0/9.0, 8.0/9.0, -6.0/9.0, 4.0/9.0, 8.0/9.0, -4.0/9.0, 4.0/9.0, 8.0/9.0, + -2.0/9.0, 4.0/9.0, 8.0/9.0, 0.0, 4.0/9.0, 8.0/9.0, 2.0/9.0, 4.0/9.0, 8.0/9.0, + 4.0/9.0, 4.0/9.0, 8.0/9.0, 6.0/9.0, 4.0/9.0, 8.0/9.0, 8.0/9.0, 4.0/9.0, 8.0/9.0, + -8.0/9.0, 6.0/9.0, 8.0/9.0, -6.0/9.0, 6.0/9.0, 8.0/9.0, -4.0/9.0, 6.0/9.0, 8.0/9.0, + -2.0/9.0, 6.0/9.0, 8.0/9.0, 0.0, 6.0/9.0, 8.0/9.0, 2.0/9.0, 6.0/9.0, 8.0/9.0, + 4.0/9.0, 6.0/9.0, 8.0/9.0, 6.0/9.0, 6.0/9.0, 8.0/9.0, 8.0/9.0, 6.0/9.0, 8.0/9.0, + -8.0/9.0, 8.0/9.0, 8.0/9.0, -6.0/9.0, 8.0/9.0, 8.0/9.0, -4.0/9.0, 8.0/9.0, 8.0/9.0, + -2.0/9.0, 8.0/9.0, 8.0/9.0, 0.0, 8.0/9.0, 8.0/9.0, 2.0/9.0, 8.0/9.0, 8.0/9.0, + 4.0/9.0, 8.0/9.0, 8.0/9.0, 6.0/9.0, 8.0/9.0, 8.0/9.0, 8.0/9.0, 8.0/9.0, 8.0/9.0 +}; + + +static const REAL *grouptableA[16] = +{ 0,group5bits,group7bits,group10bits,0,0,0,0,0,0,0,0,0,0,0,0}; +static const REAL *grouptableB1[16] = +{ 0,group5bits,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }; +static const REAL *grouptableB234[16] = +{ 0,group5bits,group7bits,0,group10bits,0,0,0,0,0,0,0,0,0,0,0}; + +static const int codelengthtableA[16] = +{ 0, 5, 7, 10, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; +static const int codelengthtableB1[16] = +{ 0, 5, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }; +static const int codelengthtableB2[16] = +{ 0, 5, 7, 3, 10, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16 }; +static const int codelengthtableB3[8] = { 0, 5, 7, 3, 10, 4, 5, 16 }; +static const int codelengthtableB4[4] = { 0, 5, 7, 16 }; + + +static const REAL factortableA[16] = +{ 0.0, 1.0/2.0, 1.0/4.0, 1.0/8.0, + 1.0/8.0, 1.0/16.0, 1.0/32.0, 1.0/64.0, + 1.0/128.0, 1.0/256.0, 1.0/512.0, 1.0/1024.0, + 1.0/2048.0, 1.0/4096.0, 1.0/8192.0, 1.0/16384.0 }; +static const REAL factortableB1[16] = +{ 0.0, 1.0/2.0, 1.0/4.0, 1.0/8.0, + 1.0/16.0, 1.0/32.0, 1.0/64.0, 1.0/128.0, + 1.0/256.0, 1.0/512.0, 1.0/1024.0, 1.0/2048.0, + 1.0/4096.0, 1.0/8192.0, 1.0/16384.0, 1.0/32768.0 }; +static const REAL factortableB2[16] = +{ 0.0, 1.0/2.0, 1.0/4.0, 1.0/4.0, + 1.0/8.0, 1.0/8.0, 1.0/16.0, 1.0/32.0, + 1.0/64.0, 1.0/128.0, 1.0/256.0, 1.0/512.0, + 1.0/1024.0, 1.0/2048.0, 1.0/4096.0, 1.0/32768.0 }; +static const REAL factortableB3[8] = +{ 0.0, 1.0/2.0, 1.0/4.0, 1.0/4.0, 1.0/8.0, 1.0/8.0, 1.0/16.0, 1.0/32768.0 }; +static const REAL factortableB4[4] = { 0.0, 1.0/2.0, 1.0/4.0, 1.0/32768.0 }; + + +static const REAL ctableA[16]= +{ 0.0, 1.33333333333, 1.60000000000, 1.77777777777, + 1.06666666666, 1.03225806452, 1.01587301587, 1.00787401575, + 1.00392156863, 1.00195694716, 1.00097751711, 1.00048851979, + 1.00024420024, 1.00012208522, 1.00006103888, 1.00003051851}; +static const REAL ctableB1[16]= +{ 0.0, 1.33333333333, 1.14285714286, 1.06666666666, + 1.03225806452, 1.01587301587, 1.00787401575, 1.00392156863, + 1.00195694716, 1.00097751711, 1.00048851979, 1.00024420024, + 1.00012208522, 1.00006103888, 1.00003051851, 1.00001525902}; +static const REAL ctableB2[16] = +{ 0.0, 1.33333333333, 1.60000000000, 1.14285714286, + 1.77777777777, 1.06666666666, 1.03225806452, 1.01587301587, + 1.00787401575, 1.00392156863, 1.00195694716, 1.00097751711, + 1.00048851979, 1.00024420024, 1.00012208522, 1.00001525902}; +static const REAL ctableB3[8] = +{ 0.0, 1.33333333333, 1.60000000000, 1.14285714286, + 1.77777777777, 1.06666666666, 1.03225806452, 1.00001525902 }; +static const REAL ctableB4[4] = +{ 0.0, 1.33333333333, 1.60000000000, 1.00001525902 }; + + +static const REAL dtableA[16]= +{ 0.0, 0.50000000000, 0.50000000000, 0.50000000000, + 0.12500000000, 0.06250000000, 0.03125000000, 0.01562500000, + 0.00781250000, 0.00390625000, 0.00195312500, 0.00097656250, + 0.00048828125, 0.00024414063, 0.00012207031, 0.00006103516}; + +static const REAL dtableB1[16]= +{ 0.0, 0.50000000000, 0.25000000000, 0.12500000000, + 0.06250000000, 0.03125000000, 0.01562500000, 0.00781250000, + 0.00390625000, 0.00195312500, 0.00097656250, 0.00048828125, + 0.00024414063, 0.00012207031, 0.00006103516, 0.00003051758}; + +static const REAL dtableB2[16]= +{ 0.0, 0.50000000000, 0.50000000000, 0.25000000000, + 0.50000000000, 0.12500000000, 0.06250000000, 0.03125000000, + 0.01562500000, 0.00781250000, 0.00390625000, 0.00195312500, + 0.00097656250, 0.00048828125, 0.00024414063, 0.00003051758}; + +static const REAL dtableB3[8]= +{ 0.0, 0.50000000000, 0.50000000000, 0.25000000000, + 0.50000000000, 0.12500000000, 0.06250000000, 0.00003051758}; + +static const REAL dtableB4[4]= +{0.0, 0.50000000000, 0.50000000000, 0.00003051758}; + + +#ifdef _MSC_VER +#pragma warning(default : 4305) +#endif + + +#endif diff --git a/Libraries/DecMPA/Files/src/splay/mpegAudioBitWindow.cpp b/Libraries/DecMPA/Files/src/splay/mpegAudioBitWindow.cpp new file mode 100644 index 000000000..0ac30ad87 --- /dev/null +++ b/Libraries/DecMPA/Files/src/splay/mpegAudioBitWindow.cpp @@ -0,0 +1,44 @@ +/* + bitwindow class + Copyright (C) 2000 Martin Vogt + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Library General Public License as published by + the Free Software Foundation. + + For more information look at the file License.txt in this package + + */ + +//changes 8/4/2002 (by Hauke Duden): +// - removed cout and exit stuff + + +#include "mpegAudioBitWindow.h" + + + + + + +int MpegAudioBitWindow::getCanReadBits() { + int p=bitindex>>3; + int bytes=point - p; + int bits=bytes*8+(bitindex&7); + /*cout << "point:"<>3; + point&=(WINDOWSIZE-1); + + if(p>=point) { + for(register int i=4;i + +#ifndef WORDS_BIGENDIAN +#define _KEY 0 +#else +#define _KEY 3 +#endif + +#define WINDOWSIZE 4096 +#define BITWINDOWSIZE (WINDOWSIZE*8) + + +class MpegAudioBitWindow { + + int point,bitindex; + char buffer[2*WINDOWSIZE]; + + public: + MpegAudioBitWindow(){bitindex=point=0;} + + inline void initialize(void) {bitindex=point=0;} + inline int gettotalbit(void) const {return bitindex;} + + inline void putbyte(int c) {buffer[point&(WINDOWSIZE-1)]=c;point++;} + void wrap(void); + inline void rewind(int bits) {bitindex-=bits;} + inline void forward(int bits) {bitindex+=bits;} + + // returns number of bits which can safley read + int getCanReadBits(); + + + // + // Ugly bitgetting inline functions for higher speed + // + + + inline int getbits(int bits) { + union + { + char store[4]; + int current; + }u; + int bi; + + if(!bits)return 0; + + u.current=0; + bi=(bitindex&7); + u.store[_KEY]=buffer[(bitindex>>3)&(WINDOWSIZE-1)]<>3]<>3)&(WINDOWSIZE-1)]; + //u.store[_KEY]=buffer[bitindex>>3]; + bitindex+=8; + bi=8; + } + + if(bits>=bi) { + u.current<<=bi; + bits-=bi; + bi=0; + } + else { + u.current<<=bits; + bi-=bits; + bits=0; + } + } + bitindex-=bi; + + return (u.current>>8); + } + + + int getbit(void) { + register int r=(buffer[(bitindex>>3)&(WINDOWSIZE-1)]>>(7-(bitindex&7)))&1; + //register int r=(buffer[bitindex>>3]>>(7-(bitindex&7)))&1; + bitindex++; + return r; + } + + // no range check version + inline int getbits9_f(int bits) { + register unsigned short a; + { + int offset=bitindex>>3; + a=(((unsigned char)buffer[offset])<<8)|((unsigned char)buffer[offset+1]); + } + a<<=(bitindex&7); + bitindex+=bits; + return (int)((unsigned int)(a>>(16-bits))); + } + + // range check version + int getbits9(int bits) { + register unsigned short a; + { + int offset=(bitindex>>3)&(WINDOWSIZE-1); + a=(((unsigned char)buffer[offset])<<8)|((unsigned char)buffer[offset+1]); + } + + a<<=(bitindex&7); + bitindex+=bits; + return (int)((unsigned int)(a>>(16-bits))); + } + + int peek8() { + int offset = (bitindex>>3)&(WINDOWSIZE-1), a; + a=(((unsigned char)buffer[offset])<<8) | ((unsigned char)buffer[offset+1]); + return (a >> (8-(bitindex&7))) & 0xff; + } + + +}; +#endif diff --git a/Libraries/DecMPA/Files/src/splay/mpegAudioStream.cpp b/Libraries/DecMPA/Files/src/splay/mpegAudioStream.cpp new file mode 100644 index 000000000..bc082b6ef --- /dev/null +++ b/Libraries/DecMPA/Files/src/splay/mpegAudioStream.cpp @@ -0,0 +1,42 @@ +/* + initializer/resyncer/frame detection etc.. for mpeg audio + Copyright (C) 2000 Martin Vogt + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Library General Public License as published by + the Free Software Foundation. + + For more information look at the file License.txt in this package + + */ + + + +#include "mpegAudioStream.h" + + +MpegAudioStream::MpegAudioStream() { + buffer=(char*)0; +} + + +MpegAudioStream::~MpegAudioStream() { +} + + + +void MpegAudioStream::setFrame(unsigned char* ptr,int len) { + this->buffer=(char*)ptr; + this->len=len; + bitindex=0; +} + + + + + + + + + + diff --git a/Libraries/DecMPA/Files/src/splay/mpegAudioStream.h b/Libraries/DecMPA/Files/src/splay/mpegAudioStream.h new file mode 100644 index 000000000..0165a0eda --- /dev/null +++ b/Libraries/DecMPA/Files/src/splay/mpegAudioStream.h @@ -0,0 +1,146 @@ +/* + initializer/resyncer/frame detection etc.. for mpeg audio + Copyright (C) 2000 Martin Vogt + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Library General Public License as published by + the Free Software Foundation. + + For more information look at the file License.txt in this package + + */ + + + +#ifndef __MPEGAUDIOSTREAM_H +#define __MPEGAUDIOSTREAM_H + +// we include this for the big_endian define +//#include "mpegAudioBitWindow.h" + +#ifndef WORDS_BIGENDIAN +#define _KEY 0 +#else +#define _KEY 3 +#endif + + + +#define _MAX_MPEG_BUFFERSIZE 4096 + + +/** + Here we go from the frame to the bitlevel. + + +*/ + +class MpegAudioStream { + + char* buffer; + int len; + int bitindex; + + public: + MpegAudioStream(); + ~MpegAudioStream(); + + void setFrame(unsigned char* prt,int len); + + // Bit functions + + inline char* getBuffer() { return buffer; } + inline int getBufferSize() { return _MAX_MPEG_BUFFERSIZE ;} + inline void sync() { bitindex=(bitindex+7)&0xFFFFFFF8; } + inline int issync() { return (bitindex&7);}; + + /** + Now follow ugly inline function. The performance gain is 1.5 % + on a 400 MHz AMD + */ + + inline int getbyte() { + int r=(unsigned char)buffer[bitindex>>3]; + bitindex+=8; + return r; + } + + inline int getbits9(int bits) { + register unsigned short a; + { + int offset=bitindex>>3; + + a=(((unsigned char)buffer[offset])<<8) | + ((unsigned char)buffer[offset+1]); + } + + a<<=(bitindex&7); + bitindex+=bits; + return (int)((unsigned int)(a>>(16-bits))); + } + + inline int getbits8() { + register unsigned short a; + + { + int offset=bitindex>>3; + + a=(((unsigned char)buffer[offset])<<8) | + ((unsigned char)buffer[offset+1]); + } + + a<<=(bitindex&7); + bitindex+=8; + return (int)((unsigned int)(a>>8)); + } + + inline int getbit() { + register int r=(buffer[bitindex>>3]>>(7-(bitindex&7)))&1; + + bitindex++; + return r; + } + + inline int getbits(int bits) { + union + { + char store[4]; + int current; + }u; + int bi; + + if(!bits)return 0; + + u.current=0; + bi=(bitindex&7); + u.store[_KEY]=buffer[bitindex>>3]<>3]; + bitindex+=8; + bi=8; + } + if(bits>=bi) { + u.current<<=bi; + bits-=bi; + bi=0; + } else { + u.current<<=bits; + bi-=bits; + bits=0; + } + } + bitindex-=bi; + return (u.current>>8); + } + + + + +}; + + +#endif diff --git a/Libraries/DecMPA/Files/src/splay/mpeglayer1.cpp b/Libraries/DecMPA/Files/src/splay/mpeglayer1.cpp new file mode 100644 index 000000000..05aa4e014 --- /dev/null +++ b/Libraries/DecMPA/Files/src/splay/mpeglayer1.cpp @@ -0,0 +1,118 @@ +/* MPEG/WAVE Sound library + + (C) 1997 by Jung woo-jae */ + +// Mpeglayer1.cc +// It's for MPEG Layer 1 + +//changes 8/4/2002 (by Hauke Duden): +// - added VC6 pragma to prevent some warnings from being reported + +#include "mpegsound.h" +#include "synthesis.h" + +#ifdef _MSC_VER +#pragma warning(disable : 4305) +#endif + +// Tables for layer 1 +static const REAL factortable[15] = +{ + 0.0, + (1.0/2.0) * (4.0/3.0), (1.0/4.0) * (8.0/7.0), + (1.0/8.0) * (16.0/15.0), (1.0/16.0) * (32.0/31.0), + (1.0/32.0) * (64.0/63.0), (1.0/64.0) * (128.0/127.0), + (1.0/128.0) * (256.0/255.0), (1.0/256.0) * (512.0/511.0), + (1.0/512.0) * (1024.0/1023.0), (1.0/1024.0) * (2048.0/2047.0), + (1.0/2048.0) * (4096.0/4095.0), (1.0/4096.0) * (8192.0/8191.0), + (1.0/8192.0) * (16384.0/16383.0), (1.0/16384.0) * (32768.0/32767.0) +}; + +static const REAL offsettable[15] = +{ + 0.0, + ((1.0/2.0)-1.0) * (4.0/3.0), ((1.0/4.0)-1.0) * (8.0/7.0), + ((1.0/8.0)-1.0) * (16.0/15.0), ((1.0/16.0)-1.0) * (32.0/31.0), + ((1.0/32.0)-1.0) * (64.0/63.0), ((1.0/64.0)-1.0) * (128.0/127.0), + ((1.0/128.0)-1.0) * (256.0/255.0), ((1.0/256.0)-1.0) * (512.0/511.0), + ((1.0/512.0)-1.0) * (1024.0/1023.0), ((1.0/1024.0)-1.0) * (2048.0/2047.0), + ((1.0/2048.0)-1.0) * (4096.0/4095.0), ((1.0/4096.0)-1.0) * (8192.0/8191.0), + ((1.0/8192.0)-1.0) * (16384.0/16383.0), ((1.0/16384.0)-1.0) * (32768.0/32767.0) +}; + +#ifdef _MSC_VER +#pragma warning(default : 4305) +#endif + +// Mpeg layer 1 +void Mpegtoraw::extractlayer1(void) +{ + int inputstereo=mpegAudioHeader->getInputstereo(); + int stereobound=mpegAudioHeader->getStereobound(); + REAL fraction[MAXCHANNEL][MAXSUBBAND]; + REAL scalefactor[MAXCHANNEL][MAXSUBBAND]; + + int bitalloc[MAXCHANNEL][MAXSUBBAND], + sample[MAXCHANNEL][MAXSUBBAND]; + + register int i,j; + int s=stereobound,l; + + +// Bitalloc + for(i=0;idoSynth(lDownSample,lOutputStereo, + fraction[LS],fraction[RS]); + } +} diff --git a/Libraries/DecMPA/Files/src/splay/mpeglayer2.cpp b/Libraries/DecMPA/Files/src/splay/mpeglayer2.cpp new file mode 100644 index 000000000..881520612 --- /dev/null +++ b/Libraries/DecMPA/Files/src/splay/mpeglayer2.cpp @@ -0,0 +1,449 @@ +/* MPEG/WAVE Sound library + + (C) 1997 by Jung woo-jae */ + +// Mpeglayer2.cc +// It's for MPEG Layer 2 + +//changes 8/4/2002 (by Hauke Duden): +// - added some explicit casts to remove compilation warnings +// - added VC6 pragma to prevent some warnings from being reported + +#include "mpegsound.h" +#include "synthesis.h" + + +#define BUGFIX +#include "mpeg2tables.h" + + +// workaround for buggy mpeg2 streams. +// tested with 12 monkey cdi, worgked fine. +// problem was: the stream produced ints +// with access out of the tables +// if we have such an access we set it to a zero entry +#ifdef BUGFIX +static int checkCodeRange(int code,const REAL* group) { + int back=0; + if (group == NULL) { + //cout << "group null"< 27*3) { + // redirect to zero value + back=3; + } + return back; + } + if (group == group7bits) { + if (back > 125*3) { + back=6; + } + return back; + } + if (group == group10bits) { + if (back > 729*3) { + back=12; + } + return back; + } + //DEBUG_LAYER(cout << "unknown group found!"<getInputstereo(); + int tableindex=mpegAudioHeader->getTableindex(); + int subbandnumber=mpegAudioHeader->getSubbandnumber(); + int stereobound=mpegAudioHeader->getStereobound(); + + REAL fraction[MAXCHANNEL][3][MAXSUBBAND]; + unsigned int bitalloc[MAXCHANNEL][MAXSUBBAND], + scaleselector[MAXCHANNEL][MAXSUBBAND]; + REAL scalefactor[2][3][MAXSUBBAND]; + + const REAL *group[MAXCHANNEL][MAXSUBBAND]; + unsigned int codelength[MAXCHANNEL][MAXSUBBAND]; + REAL factor[MAXCHANNEL][MAXSUBBAND]; + REAL c[MAXCHANNEL][MAXSUBBAND],d[MAXCHANNEL][MAXSUBBAND]; + + int s=stereobound,n=subbandnumber; + + + // Bitalloc + { + register int i; + register const int *t=bitalloclengthtable[tableindex]; + for(i=0;i>2][i]; + fraction[LS][0][i]*=t; + fraction[LS][1][i]*=t; + fraction[LS][2][i]*=t; + } + + if(bitalloc[RS][i]) + { + if(!group[RS][i]) + { + fraction[RS][0][i]=(fraction[RS][0][i]+d[RS][i])*c[LS][i]; + fraction[RS][1][i]=(fraction[RS][1][i]+d[RS][i])*c[LS][i]; + fraction[RS][2][i]=(fraction[RS][2][i]+d[RS][i])*c[LS][i]; + } + + register REAL t=scalefactor[RS][l>>2][i]; + fraction[RS][0][i]*=t; + fraction[RS][1][i]*=t; + fraction[RS][2][i]*=t; + } + } + else + for(i=0;i>2][i]; + fraction[LS][0][i]*=t; + fraction[LS][1][i]*=t; + fraction[LS][2][i]*=t; + } + + + for(;idoSynth(lDownSample,lOutputStereo, + fraction[LS][i],fraction[RS][i]); + } + + } + } +} diff --git a/Libraries/DecMPA/Files/src/splay/mpeglayer3.cpp b/Libraries/DecMPA/Files/src/splay/mpeglayer3.cpp new file mode 100644 index 000000000..a6982ae97 --- /dev/null +++ b/Libraries/DecMPA/Files/src/splay/mpeglayer3.cpp @@ -0,0 +1,1798 @@ +/* MPEG/WAVE Sound library + + (C) 1997 by Jung woo-jae */ + +// Mpeglayer3.cc +// It's for MPEG Layer 3 +// I've made array of superior functions for speed. +// Extend TO_FOUR_THIRDS to negative. +// Bug fix : maplay 1.2+ have wrong TO_FOUR_THIRDS ranges. +// Force to mono!! +// MPEG-2 is implemented +// Speed up in fixstereo (maybe buggy) + + +//changes 8/4/2002 (by Hauke Duden): +// - added VC6 pragma to prevent some warnings from being reported +// - removed dump stuff + +//changes 8/15/2002 +// - added pragmas to disable Visual-C++ optimizations that were causing +// artifacts with some MP3s + +#include "mpegsound.h" +#include "huffmanlookup.h" +//#include "dump.h" +#include "synthesis.h" + +#include "window.h" + +inline int Mpegtoraw::wgetbit (void) {return bitwindow.getbit (); } +inline int Mpegtoraw::wgetbits9(int bits){return bitwindow.getbits9(bits);} +inline int Mpegtoraw::wgetbits (int bits){return bitwindow.getbits (bits);} +inline int Mpegtoraw::wgetCanReadBits () {return bitwindow.getCanReadBits();} + + +#define MUL3(a) (((a)<<1)+(a)) + +#define REAL0 0 + +// 576 +#define ARRAYSIZE (SBLIMIT*SSLIMIT) +#define REALSIZE (sizeof(REAL)) + + +#define MAPLAY_OPT 1 + + +#ifdef NATIVE_ASSEMBLY +inline void long_memset(void * s,unsigned int c,int count) +{ +__asm__ __volatile__( + "cld\n\t" + "rep ; stosl\n\t" + : /* no output */ + :"a" (c), "c" (count/4), "D" ((long) s) + :"cx","di","memory"); +} +#endif + +#define FOURTHIRDSTABLENUMBER (8250) +static int initializedlayer3=false; + +static REAL two_to_negative_half_pow[70]; +static REAL TO_FOUR_THIRDSTABLE[FOURTHIRDSTABLENUMBER*2]; +static REAL POW2[256]; +static REAL POW2_1[8][2][16]; +static REAL ca[8],cs[8]; + + + + +typedef struct +{ + REAL l,r; +}RATIOS; + +static RATIOS rat_1[16],rat_2[2][64]; + +#ifdef _MSC_VER +#pragma warning(disable: 4244) +#endif + +void Mpegtoraw::layer3initialize(void) +{ + + int i,j,k,l; + + //maplay opt. + nonzero[0] = nonzero[1] = nonzero[2]=ARRAYSIZE; + + layer3framestart=0; + currentprevblock=0; + + for(l=0;l<2;l++) + for(i=0;i<2;i++) + for(j=0;j0) { + if ( k & 1) { + val=pow(base,(k+1.0)*0.5); + } else { + val=pow(base,k*0.5); + } + } + + POW2_MV[i][j][k]=val; + } + } + + for(i=0;i<8;i++) + for(j=0;j<2;j++) + for(k=0;k<16;k++) { + REAL a=POW2_1[i][j][k]; + REAL b=POW2_MV[i][j][k]; + printf("i:%d j%d k%d",i,j,k); + if (a != b) { + cout << "a:"<getInputstereo(); + + + sideinfo.main_data_begin=getbits(9); + if(!inputstereo)sideinfo.private_bits=getbits(5); + else sideinfo.private_bits=getbits(3); + + sideinfo.ch[LS].scfsi[0]=getbit(); + sideinfo.ch[LS].scfsi[1]=getbit(); + sideinfo.ch[LS].scfsi[2]=getbit(); + sideinfo.ch[LS].scfsi[3]=getbit(); + if(inputstereo) { + sideinfo.ch[RS].scfsi[0]=getbit(); + sideinfo.ch[RS].scfsi[1]=getbit(); + sideinfo.ch[RS].scfsi[2]=getbit(); + sideinfo.ch[RS].scfsi[3]=getbit(); + } + + for(int gr=0,ch;gr<2;gr++) + for(ch=0;;ch++) { + layer3grinfo *gi=&(sideinfo.ch[ch].gr[gr]); + + gi->part2_3_length =getbits(12); + gi->big_values =getbits(9); + if(gi->big_values > 288) { + DEBUG_LAYER(fprintf(stderr,"big_values too large!\n");) + gi->big_values = 288; + return false; + } + + gi->global_gain =getbits(8); + gi->scalefac_compress =getbits(4); + gi->window_switching_flag=getbit(); + if(gi->window_switching_flag) { + gi->block_type =getbits(2); + gi->mixed_block_flag=getbit(); + + gi->table_select[0] =getbits(5); + gi->table_select[1] =getbits(5); + + gi->subblock_gain[0]=getbits(3); + gi->subblock_gain[1]=getbits(3); + gi->subblock_gain[2]=getbits(3); + + /* Set region_count parameters since they are implicit in this case. */ + if(gi->block_type==0) + { + DEBUG_LAYER(printf("Side info bad: block_type==0 split block.\n");) + return false; + } + else if (gi->block_type==2 && gi->mixed_block_flag==0) + gi->region0_count=8; /* MI 9; */ + else gi->region0_count=7; /* MI 8; */ + gi->region1_count=20-(gi->region0_count); + } + else + { + gi->table_select[0] =getbits(5); + gi->table_select[1] =getbits(5); + gi->table_select[2] =getbits(5); + gi->region0_count =getbits(4); + gi->region1_count =getbits(3); + gi->block_type =0; + } + gi->preflag =getbit(); + gi->scalefac_scale =getbit(); + gi->count1table_select=getbit(); + + gi->generalflag=gi->window_switching_flag && (gi->block_type==2); + + if(!inputstereo || ch)break; + } + + return true; +} + +bool Mpegtoraw::layer3getsideinfo_2(void) { + int inputstereo=mpegAudioHeader->getInputstereo(); + sideinfo.main_data_begin=getbits(8); + + if(!inputstereo)sideinfo.private_bits=getbit(); + else sideinfo.private_bits=getbits(2); + + for(int ch=0;;ch++) + { + layer3grinfo *gi=&(sideinfo.ch[ch].gr[0]); + + gi->part2_3_length =getbits(12); + gi->big_values =getbits(9); + if(gi->big_values > 288) { + DEBUG_LAYER(fprintf(stderr,"big_values too large!\n");) + gi->big_values = 288; + return false; + } + + gi->global_gain =getbits(8); + gi->scalefac_compress =getbits(9); + gi->window_switching_flag=getbit(); + if(gi->window_switching_flag) + { + gi->block_type =getbits(2); + gi->mixed_block_flag=getbit(); + + gi->table_select[0] =getbits(5); + gi->table_select[1] =getbits(5); + + gi->subblock_gain[0]=getbits(3); + gi->subblock_gain[1]=getbits(3); + gi->subblock_gain[2]=getbits(3); + + /* Set region_count parameters since they are implicit in this case. */ + if(gi->block_type==0) + { + DEBUG_LAYER(printf("Side info bad: block_type==0 split block.\n");) + return false; + } + else if (gi->block_type==2 && gi->mixed_block_flag==0) + gi->region0_count=8; /* MI 9; */ + else gi->region0_count=7; /* MI 8; */ + gi->region1_count=20-(gi->region0_count); + } + else + { + gi->table_select[0] =getbits(5); + gi->table_select[1] =getbits(5); + gi->table_select[2] =getbits(5); + gi->region0_count =getbits(4); + gi->region1_count =getbits(3); + gi->block_type =0; + } + gi->scalefac_scale =getbit(); + gi->count1table_select=getbit(); + + gi->generalflag=gi->window_switching_flag && (gi->block_type==2); + + if(!inputstereo || ch)break; + } + + return true; +} + +void Mpegtoraw::layer3getscalefactors(int ch,int gr) +{ + static int 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}}; + + layer3grinfo *gi=&(sideinfo.ch[ch].gr[gr]); + register layer3scalefactor *sf=(&scalefactors[ch]); + int l0,l1; + + { + int scale_comp=gi->scalefac_compress; + + l0=slen[0][scale_comp]; + l1=slen[1][scale_comp]; + } + /* + wgetCanReadBits(); + cout << "lo:"<generalflag) + { + if(gi->mixed_block_flag) + { /* MIXED */ /* NEW-ag 11/25 */ + sf->l[0]=wgetbits9(l0);sf->l[1]=wgetbits9(l0); + sf->l[2]=wgetbits9(l0);sf->l[3]=wgetbits9(l0); + sf->l[4]=wgetbits9(l0);sf->l[5]=wgetbits9(l0); + sf->l[6]=wgetbits9(l0);sf->l[7]=wgetbits9(l0); + + sf->s[0][ 3]=wgetbits9(l0);sf->s[1][ 3]=wgetbits9(l0); + sf->s[2][ 3]=wgetbits9(l0); + sf->s[0][ 4]=wgetbits9(l0);sf->s[1][ 4]=wgetbits9(l0); + sf->s[2][ 4]=wgetbits9(l0); + sf->s[0][ 5]=wgetbits9(l0);sf->s[1][ 5]=wgetbits9(l0); + sf->s[2][ 5]=wgetbits9(l0); + + sf->s[0][ 6]=wgetbits9(l1);sf->s[1][ 6]=wgetbits9(l1); + sf->s[2][ 6]=wgetbits9(l1); + sf->s[0][ 7]=wgetbits9(l1);sf->s[1][ 7]=wgetbits9(l1); + sf->s[2][ 7]=wgetbits9(l1); + sf->s[0][ 8]=wgetbits9(l1);sf->s[1][ 8]=wgetbits9(l1); + sf->s[2][ 8]=wgetbits9(l1); + sf->s[0][ 9]=wgetbits9(l1);sf->s[1][ 9]=wgetbits9(l1); + sf->s[2][ 9]=wgetbits9(l1); + sf->s[0][10]=wgetbits9(l1);sf->s[1][10]=wgetbits9(l1); + sf->s[2][10]=wgetbits9(l1); + sf->s[0][11]=wgetbits9(l1);sf->s[1][11]=wgetbits9(l1); + sf->s[2][11]=wgetbits9(l1); + + sf->s[0][12]=sf->s[1][12]=sf->s[2][12]=0; + } + else + { /* SHORT*/ + sf->s[0][ 0]=wgetbits9(l0);sf->s[1][ 0]=wgetbits9(l0); + sf->s[2][ 0]=wgetbits9(l0); + sf->s[0][ 1]=wgetbits9(l0);sf->s[1][ 1]=wgetbits9(l0); + sf->s[2][ 1]=wgetbits9(l0); + sf->s[0][ 2]=wgetbits9(l0);sf->s[1][ 2]=wgetbits9(l0); + sf->s[2][ 2]=wgetbits9(l0); + sf->s[0][ 3]=wgetbits9(l0);sf->s[1][ 3]=wgetbits9(l0); + sf->s[2][ 3]=wgetbits9(l0); + sf->s[0][ 4]=wgetbits9(l0);sf->s[1][ 4]=wgetbits9(l0); + sf->s[2][ 4]=wgetbits9(l0); + sf->s[0][ 5]=wgetbits9(l0);sf->s[1][ 5]=wgetbits9(l0); + sf->s[2][ 5]=wgetbits9(l0); + + sf->s[0][ 6]=wgetbits9(l1);sf->s[1][ 6]=wgetbits9(l1); + sf->s[2][ 6]=wgetbits9(l1); + sf->s[0][ 7]=wgetbits9(l1);sf->s[1][ 7]=wgetbits9(l1); + sf->s[2][ 7]=wgetbits9(l1); + sf->s[0][ 8]=wgetbits9(l1);sf->s[1][ 8]=wgetbits9(l1); + sf->s[2][ 8]=wgetbits9(l1); + sf->s[0][ 9]=wgetbits9(l1);sf->s[1][ 9]=wgetbits9(l1); + sf->s[2][ 9]=wgetbits9(l1); + sf->s[0][10]=wgetbits9(l1);sf->s[1][10]=wgetbits9(l1); + sf->s[2][10]=wgetbits9(l1); + sf->s[0][11]=wgetbits9(l1);sf->s[1][11]=wgetbits9(l1); + sf->s[2][11]=wgetbits9(l1); + + sf->s[0][12]=sf->s[1][12]=sf->s[2][12]=0; + } + } + else + { /* LONG types 0,1,3 */ + if(gr==0) + { + sf->l[ 0]=wgetbits9(l0);sf->l[ 1]=wgetbits9(l0); + sf->l[ 2]=wgetbits9(l0);sf->l[ 3]=wgetbits9(l0); + sf->l[ 4]=wgetbits9(l0);sf->l[ 5]=wgetbits9(l0); + sf->l[ 6]=wgetbits9(l0);sf->l[ 7]=wgetbits9(l0); + sf->l[ 8]=wgetbits9(l0);sf->l[ 9]=wgetbits9(l0); + sf->l[10]=wgetbits9(l0); + sf->l[11]=wgetbits9(l1);sf->l[12]=wgetbits9(l1); + sf->l[13]=wgetbits9(l1);sf->l[14]=wgetbits9(l1); + sf->l[15]=wgetbits9(l1); + sf->l[16]=wgetbits9(l1);sf->l[17]=wgetbits9(l1); + sf->l[18]=wgetbits9(l1);sf->l[19]=wgetbits9(l1); + sf->l[20]=wgetbits9(l1); + } + else + { + if(sideinfo.ch[ch].scfsi[0]==0) + { + sf->l[ 0]=wgetbits9(l0);sf->l[ 1]=wgetbits9(l0); + sf->l[ 2]=wgetbits9(l0);sf->l[ 3]=wgetbits9(l0); + sf->l[ 4]=wgetbits9(l0);sf->l[ 5]=wgetbits9(l0); + } + if(sideinfo.ch[ch].scfsi[1]==0) + { + sf->l[ 6]=wgetbits9(l0);sf->l[ 7]=wgetbits9(l0); + sf->l[ 8]=wgetbits9(l0);sf->l[ 9]=wgetbits9(l0); + sf->l[10]=wgetbits9(l0); + } + if(sideinfo.ch[ch].scfsi[2]==0) + { + sf->l[11]=wgetbits9(l1);sf->l[12]=wgetbits9(l1); + sf->l[13]=wgetbits9(l1);sf->l[14]=wgetbits9(l1); + sf->l[15]=wgetbits9(l1); + } + if(sideinfo.ch[ch].scfsi[3]==0) + { + sf->l[16]=wgetbits9(l1);sf->l[17]=wgetbits9(l1); + sf->l[18]=wgetbits9(l1);sf->l[19]=wgetbits9(l1); + sf->l[20]=wgetbits9(l1); + } + } + sf->l[21]=sf->l[22]=0; + } + /* + cout << "end parse:"<getExtendedmode(); + layer3grinfo *gi=&(sideinfo.ch[ch].gr[0]); + register layer3scalefactor *sf=(&scalefactors[ch]); + + { + int blocktypenumber,sc; + int blocknumber; + int slen[4]; + + if(gi->block_type==2)blocktypenumber=1+gi->mixed_block_flag; + else blocktypenumber=0; + + sc=gi->scalefac_compress; + if(!((extendedmode==1 || extendedmode==3) && (ch==1))) + { + if(sc<400) + { + slen[0]=(sc>>4)/5; + slen[1]=(sc>>4)%5; + slen[2]=(sc%16)>>2; + slen[3]=(sc%4); + gi->preflag=0; + blocknumber=0; + } + else if(sc<500) + { + sc-=400; + slen[0]=(sc>>2)/5; + slen[1]=(sc>>2)%5; + slen[2]=sc%4; + slen[3]=0; + gi->preflag=0; + blocknumber=1; + } + else // if(sc<512) + { + sc-=500; + slen[0]=sc/3; + slen[1]=sc%3; + slen[2]=0; + slen[3]=0; + gi->preflag=1; + blocknumber=2; + } + } + else + { + sc>>=1; + if(sc<180) + { + slen[0]=sc/36; + slen[1]=(sc%36)/6; + slen[2]=(sc%36)%6; + slen[3]=0; + gi->preflag=0; + blocknumber=3; + } + else if(sc<244) + { + sc-=180; + slen[0]=(sc%64)>>4; + slen[1]=(sc%16)>>2; + slen[2]=sc%4; + slen[3]=0; + gi->preflag=0; + blocknumber=4; + } + else // if(sc<255) + { + sc-=244; + slen[0]=sc/3; + slen[1]=sc%3; + slen[2]= + slen[3]=0; + gi->preflag=0; + blocknumber=5; + } + } + + { + int i,j,k,*si; + + si=sfbblockindex[blocknumber][blocktypenumber]; + for(i=0;i<45;i++)sb[i]=0; + + for(k=i=0;i<4;i++) + for(j=0;jwindow_switching_flag && (gi->block_type==2)) + { + if(gi->mixed_block_flag) + { + for(sfb=0;sfb<8;sfb++)sf->l[sfb]=sb[k++]; + sfb=3; + } + else sfb=0; + + for(;sfb<12;sfb++) + for(window=0;window<3;window++) + sf->s[window][sfb]=sb[k++]; + + sf->s[0][12]=sf->s[1][12]=sf->s[2][12]=0; + } + else + { + for(sfb=0;sfb<21;sfb++) + sf->l[sfb]=sb[k++]; + sf->l[21]=sf->l[22]=0; + } + } +} + + +typedef unsigned int HUFFBITS; +#define MXOFF 250 + +/* do the huffman-decoding */ +/* note! for counta,countb -the 4 bit value is returned in y, discard x */ +// Huffman decoder for tablename<32 +inline void Mpegtoraw::huffmandecoder_1(const HUFFMANCODETABLE *h,int *x,int *y) +{ + HUFFBITS level=(1<<(sizeof(HUFFBITS)*8-1)); + int point=0; + + /* Lookup in Huffman table. */ + for(;;) + { + if(h->val[point][0]==0) + { /*end of tree*/ + int xx,yy; + + xx=h->val[point][1]>>4; + yy=h->val[point][1]&0xf; + + if(h->linbits) + { + if((h->xlen)==(unsigned)xx)xx+=wgetbits(h->linbits); + if(xx)if(wgetbit())xx=-xx; + if((h->ylen)==(unsigned)yy)yy+=wgetbits(h->linbits); + if(yy)if(wgetbit())yy=-yy; + } + else + { + if(xx)if(wgetbit())xx=-xx; + if(yy)if(wgetbit())yy=-yy; + } + *x=xx;*y=yy; + break; + } + + point+=h->val[point][wgetbit()]; + + level>>=1; + if(!(level || ((unsigned)pointtreelen))) + { + register int xx,yy; + + xx=(h->xlen<<1);// set x and y to a medium value as a simple concealment + yy=(h->ylen<<1); + + // h->xlen and h->ylen can't be 1 under tablename 32 + // if(xx) + if(wgetbit())xx=-xx; + // if(yy) + if(wgetbit())yy=-yy; + + *x=xx;*y=yy; + break; + } + } +} + +// Huffman decoder tablenumber>=32 +inline void Mpegtoraw::huffmandecoder_2(const HUFFMANCODETABLE *h, + int *x,int *y,int *v,int *w) +{ + HUFFBITS level=(1<<(sizeof(HUFFBITS)*8-1)); + int point=0; + + /* Lookup in Huffman table. */ + for(;;) + { + if(h->val[point][0]==0) + { /*end of tree*/ + register int t=h->val[point][1]; + + if(t&8)*v=1-(wgetbit()<<1); else *v=0; + if(t&4)*w=1-(wgetbit()<<1); else *w=0; + if(t&2)*x=1-(wgetbit()<<1); else *x=0; + if(t&1)*y=1-(wgetbit()<<1); else *y=0; + break; + } + point+=h->val[point][wgetbit()]; + level>>=1; + if(!(level || ((unsigned)pointtreelen))) + { + *v=1-(wgetbit()<<1); + *w=1-(wgetbit()<<1); + *x=1-(wgetbit()<<1); + *y=1-(wgetbit()<<1); + break; + } + } +} + +typedef struct +{ + int l[23]; + int s[14]; +}SFBANDINDEX; + +static SFBANDINDEX sfBandIndextable[3][3]= +{ + // MPEG 1 + {{{0,4,8,12,16,20,24,30,36,44,52,62,74,90,110,134,162,196,238,288,342,418,576}, + {0,4,8,12,16,22,30,40,52,66,84,106,136,192}}, + {{0,4,8,12,16,20,24,30,36,42,50,60,72,88,106,128,156,190,230,276,330,384,576}, + {0,4,8,12,16,22,28,38,50,64,80,100,126,192}}, + {{0,4,8,12,16,20,24,30,36,44,54,66,82,102,126,156,194,240,296,364,448,550,576}, + {0,4,8,12,16,22,30,42,58,78,104,138,180,192}}}, + + // MPEG 2 + {{{0,6,12,18,24,30,36,44,54,66,80,96,116,140,168,200,238,284,336,396,464,522,576}, + {0,4,8,12,18,24,32,42,56,74,100,132,174,192}}, + {{0,6,12,18,24,30,36,44,54,66,80,96,114,136,162,194,232,278,330,394,464,540,576}, + {0,4,8,12,18,26,36,48,62,80,104,136,180,192}}, + {{0,6,12,18,24,30,36,44,54,66,80,96,116,140,168,200,238,284,336,396,464,522,576}, + {0,4,8,12,18,26,36,48,62,80,104,134,174,192}}}, + // 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}, + {0,4,8,12,18,26,36,48,62,80,104,134,174,192}}, + {{0,6,12,18,24,30,36,44,54,66,80,96,116,140,168,200,238,284,336,396,464,522,576}, + {0,4,8,12,18,26,36,48,62,80,104,134,174,192}}, + {{0,12,24,36,48,60,72,88,108,132,160,192,232,280,336,400,476,566,568,570,572,574,576}, + {0,8,16,24,36,52,72,96,124,160,162,164,166,192}}} +}; + + +void Mpegtoraw::layer3huffmandecode(int ch,int gr,int out[SBLIMIT][SSLIMIT]) +{ + layer3grinfo *gi=&(sideinfo.ch[ch].gr[gr]); + int part2_3_end=layer3part2start+(gi->part2_3_length); + int region1Start,region2Start; + int i,e=gi->big_values<<1; + int version=mpegAudioHeader->getVersion(); + int frequency=mpegAudioHeader->getFrequency(); + int mpeg25=mpegAudioHeader->getLayer25(); + + /* Find region boundary for short block case. */ + if(gi->generalflag) { + /* Region2. */ + region1Start= + sfBandIndextable[mpeg25?2:version][frequency].s[3]*3; + /* MPEG1:sfb[9/3]*3=36 */ + region2Start=576;/* No Region2 for short block case. */ + } else { + /* Find region boundary for long block case. */ + region1Start= + sfBandIndextable[mpeg25?2:version][frequency].l[gi->region0_count+1]; + region2Start= + sfBandIndextable[mpeg25?2:version][frequency].l[gi->region0_count+ + gi->region1_count+2]; + } + + /* Read bigvalues area. */ + for(i=0;itable_select[0]]; + if(region1Start>e)end=e; else end=region1Start; + } + else if(itable_select[1]]; + if(region2Start>e)end=e; else end=region2Start; + } + else + { + h=&ht[gi->table_select[2]]; + end=e; + } + + if(h->treelen) { + while(itablename, bitwindow.peek8(), + &out[0][i], &out[0][i+1]); + + if(skip) + bitwindow.forward(skip); + else + huffmandecoder_1(h,&out[0][i],&out[0][i+1]); + i+=2; + } + } else { + for(;icount1table_select+32]; + while(bitwindow.gettotalbit()=ARRAYSIZE) + { + break; + } + } + + // nonzero is the _size_ of the array with the last nonzero value + if (i < ARRAYSIZE) { + nonzero[ch] = i; + } else { + // catch bugs + nonzero[ch] = ARRAYSIZE; + } + + // debug start +#ifndef MAPLAY_OPT + nonzero[ch]=ARRAYSIZE; + for(;igetVersion(); + int frequency=mpegAudioHeader->getFrequency(); + int mpeg25=mpegAudioHeader->getLayer25(); + layer3grinfo *gi=&(sideinfo.ch[ch].gr[gr]); + SFBANDINDEX *sfBandIndex=&(sfBandIndextable[mpeg25?2:version][frequency]); + REAL globalgain=POW2[gi->global_gain]; + REAL *TO_FOUR_THIRDS=TO_FOUR_THIRDSTABLE+FOURTHIRDSTABLENUMBER; + int arrayEnd=nonzero[ch]; + /* choose correct scalefactor band per block type, initalize boundary */ + /* and apply formula per block type */ + if(!gi->generalflag) { + /* LONG blocks: 0,1,3 */ + int next_cb_boundary; + int cb=-1,index=0; + REAL factor; + + + do + { + + next_cb_boundary=sfBandIndex->l[(++cb)+1]; + REAL val=layer3twopow2(gi->scalefac_scale,gi->preflag, + pretab[cb],scalefactors[ch].l[cb]); + factor=globalgain*val; + // maplay opt + if (arrayEnd < next_cb_boundary) { + next_cb_boundary=arrayEnd; + } + + for(;indexmixed_block_flag) { + int cb=0,index=0; + int cb_width; + do + { + cb_width=(sfBandIndex->s[cb+1]-sfBandIndex->s[cb])>>1; + + for(register int k=0;k<3;k++) + { + register REAL factor; + register int count=cb_width; + // maplay12 opt. + if(index+(count<<1) > arrayEnd) { + if (index >= arrayEnd) break; + count=(arrayEnd-index)>>1; + } + + factor=globalgain* + layer3twopow2_1(gi->subblock_gain[k],gi->scalefac_scale, + scalefactors[ch].s[k][cb]); + + + do{ + out[0][index]=factor*TO_FOUR_THIRDS[in[0][index++]]; + out[0][index]=factor*TO_FOUR_THIRDS[in[0][index++]]; + }while(--count); + } + cb++; + }while(indexl[1]; /* LONG blocks: 0,1,3 */ + int index; + // I do not have an mp3 with this format, + // so we restore the "make rest of array zero" + // in this case + // to use the maplay opt here, we must make sure, that + // arrayEnd==ArraySize. + for(int i=arrayEnd;il[8]) + { + next_cb_boundary=sfBandIndex->s[4]; + next_cb_boundary=MUL3(next_cb_boundary); + cb=3; + cb_width=sfBandIndex->s[4]-sfBandIndex->s[3]; + cb_begin=sfBandIndex->s[3]; + cb_begin=MUL3(cb_begin); + } + else if(indexl[8]) + next_cb_boundary=sfBandIndex->l[(++cb)+1]; + else + { + next_cb_boundary=sfBandIndex->s[(++cb)+1]; + next_cb_boundary=MUL3(next_cb_boundary); + cb_begin=sfBandIndex->s[cb]; + cb_width=sfBandIndex->s[cb+1]-cb_begin; + cb_begin=MUL3(cb_begin); + } + } + /* LONG block types 0,1,3 & 1st 2 subbands of switched blocks */ + out[0][index]*=layer3twopow2(gi->scalefac_scale,gi->preflag, + pretab[cb],scalefactors[ch].l[cb]); + + } + + for(;indexl[8]) { + next_cb_boundary=sfBandIndex->s[4]; + next_cb_boundary=MUL3(next_cb_boundary); + cb=3; + cb_width=sfBandIndex->s[4]-sfBandIndex->s[3]; + cb_begin=sfBandIndex->s[3]; + cb_begin=(cb_begin<<2)-cb_begin; + } else if(indexl[8]) + next_cb_boundary=sfBandIndex->l[(++cb)+1]; + else { + next_cb_boundary=sfBandIndex->s[(++cb)+1]; + next_cb_boundary=MUL3(next_cb_boundary); + cb_begin=sfBandIndex->s[cb]; + cb_width=sfBandIndex->s[cb+1]-cb_begin; + cb_begin=MUL3(cb_begin); + } + } + { + /** + Here we check if we do a division by zero + and if the resulting t_index points + outside the array. (Needed for better robustness + of the mp3 decoder) + */ + unsigned int t_index=0; + if (cb_width) { + t_index=(unsigned int)((index-cb_begin)/cb_width); + if (t_index > 2) { + t_index=0; + } + } + + out[0][index]*=layer3twopow2_1(gi->subblock_gain[t_index], + gi->scalefac_scale, + scalefactors[ch].s[t_index][cb]); + } + } + } + /* + int i; + for(i=arrayEnd;i nonzero[1]) { + in[RS][0][nonzero[1]]=(REAL) 0.0; + nonzero[1]++; + } + while(nonzero[1] > nonzero[0]) { + in[LS][0][nonzero[0]]=(REAL) 0.0; + nonzero[0]++; + } + // now they are the same + // put this into the "max" var. + nonzero[2]=nonzero[1]; + +} + +inline void Mpegtoraw::layer3fixtostereo(int gr,REAL in[2][SBLIMIT][SSLIMIT]) +{ + int version=mpegAudioHeader->getVersion(); + int frequency=mpegAudioHeader->getFrequency(); + int extendedmode=mpegAudioHeader->getExtendedmode(); + int mode=mpegAudioHeader->getMode(); + int inputstereo=mpegAudioHeader->getInputstereo(); + int mpeg25=mpegAudioHeader->getLayer25(); + layer3grinfo *gi=&(sideinfo.ch[0].gr[gr]); + SFBANDINDEX *sfBandIndex=&(sfBandIndextable[mpeg25?2:version][frequency]); + + int ms_stereo=(mode==_MODE_JOINT) && (extendedmode & 0x2); + int i_stereo =(mode==_MODE_JOINT) && (extendedmode & 0x1); + + + if(!inputstereo) + { /* mono , bypass xr[0][][] to lr[0][][]*/ + // memcpy(out[0][0],in[0][0],ARRAYSIZE*REALSIZE); + for(int i=nonzero[0];iscalefac_compress%2]; + else ratios=rat_1; + + /* initialization */ + for(i=0;igeneralflag) + { + if(gi->mixed_block_flag) // Part I + { + int max_sfb=0; + + for(int j=0;j<3;j++) + { + int sfb,sfbcnt=2; + + for(sfb=12;sfb>=3;sfb--) + { + int lines; + + i=sfBandIndex->s[sfb]; + lines=sfBandIndex->s[sfb+1]-i; + i=MUL3(i)+(j+1)*lines-1; + for(;lines>0;lines--,i--) + if(in[1][0][i]!=0.0f) + { + sfbcnt=sfb; + sfb=0;break; // quit loop + } + } + sfb=sfbcnt+1; + + if(sfb>max_sfb)max_sfb=sfb; + + for(;sfb<12;sfb++) + { + int k,t; + + t=sfBandIndex->s[sfb]; + k=sfBandIndex->s[sfb+1]-t; + i=MUL3(t)+j*k; + + t=scalefactors[1].s[j][sfb]; + if(t!=7) + { + RATIOS r=ratios[t]; + + for(;k>0;k--,i++){ + is_pos[i]=t;is_ratio[i]=r;} + } + else + for(;k>0;k--,i++)is_pos[i]=t; + } + sfb=sfBandIndex->s[10]; + sfb=MUL3(sfb)+j*(sfBandIndex->s[11]-sfb); + + { + int k,t; + + t=sfBandIndex->s[11]; + k=sfBandIndex->s[12]-t; + i=MUL3(t)+j*k; + + t=is_pos[sfb]; + if(t!=7) + { + RATIOS r=is_ratio[sfb]; + + for(;k>0;k--,i++){ + is_pos[i]=t;is_ratio[i]=r;} + } + else + for(;k>0;k--,i++)is_pos[i]=t; + } + } + + if(max_sfb<=3) + { + { + REAL temp; + int k; + + temp=in[1][0][0];in[1][0][0]=1.0; + for(k=3*SSLIMIT-1;in[1][0][k]==0.0;k--); + in[1][0][0]=temp; + for(i=0;sfBandIndex->l[i]<=k;i++); + } + { + int sfb=i; + + i=sfBandIndex->l[i]; + for(;sfb<8;sfb++) + { + int t=scalefactors[1].l[sfb]; + int k=sfBandIndex->l[sfb+1]-sfBandIndex->l[sfb]; + + if(t!=7) + { + RATIOS r=ratios[t]; + + for(;k>0;k--,i++){ + is_pos[i]=t;is_ratio[i]=r;} + } + else for(;k>0;k--,i++)is_pos[i]=t; + } + } + } + } + else // Part II + { + for(int j=0;j<3;j++) + { + int sfbcnt=-1; + int sfb; + for(sfb=12;sfb>=0;sfb--) + { + int lines; + + { + int t; + + t=sfBandIndex->s[sfb]; + lines=sfBandIndex->s[sfb+1]-t; + i=MUL3(t)+(j+1)*lines-1; + } + + for(;lines>0;lines--,i--) + if(in[1][0][i]!=0.0f) + { + sfbcnt=sfb; + sfb=0;break; // quit loop + } + } + + for(sfb=sfbcnt+1;sfb<12;sfb++) + { + int k,t; + + t=sfBandIndex->s[sfb]; + k=sfBandIndex->s[sfb+1]-t; + i=MUL3(t)+j*k; + + t=scalefactors[1].s[j][sfb]; + if(t!=7) + { + RATIOS r=ratios[t]; + + for(;k>0;k--,i++){ + is_pos[i]=t;is_ratio[i]=r;} + } + else for(;k>0;k--,i++)is_pos[i]=t; + } + + { + int t1=sfBandIndex->s[10], + t2=sfBandIndex->s[11]; + int k,tt; + + tt=MUL3(t1)+j*(t2-t1); + k =sfBandIndex->s[12]-t2; + if(is_pos[tt]!=7) + { + RATIOS r=is_ratio[tt]; + int t=is_pos[tt]; + + i =MUL3(t1)+j*k; + for(;k>0;k--,i++){ + is_pos[i]=t;is_ratio[i]=r;} + } + else + for(;k>0;k--,i++)is_pos[i]=7; + } + } + } + } + else // ms-stereo (Part III) + { + { + REAL temp; + int k; + + temp=in[1][0][0];in[1][0][0]=1.0; + for(k=ARRAYSIZE-1;in[1][0][k]==0.0;k--); + in[1][0][0]=temp; + for(i=0;sfBandIndex->l[i]<=k;i++); + } + + { + int sfb; + + sfb=i; + i=sfBandIndex->l[i]; + for(;sfb<21;sfb++) + { + int k,t; + + k=sfBandIndex->l[sfb+1]-sfBandIndex->l[sfb]; + t=scalefactors[1].l[sfb]; + if(t!=7) + { + RATIOS r=ratios[t]; + + for(;k>0;k--,i++){ + is_pos[i]=t;is_ratio[i]=r;} + } + else + for(;k>0;k--,i++)is_pos[i]=t; + } + } + + { + int k,t,tt; + + tt=sfBandIndex->l[20]; + k=576-sfBandIndex->l[21]; + t=is_pos[tt]; + if(t!=7) + { + RATIOS r=is_ratio[tt]; + + for(;k>0;k--,i++){ + is_pos[i]=t;is_ratio[i]=r;} + } + else + for(;k>0;k--,i++)is_pos[i]=t; + } + } + + if(ms_stereo) + { + i=ARRAYSIZE-1; + do{ + if(is_pos[i]==7) + { + register REAL t=in[LS][0][i]; + in[LS][0][i]=(t+in[RS][0][i])*0.7071068f; + in[RS][0][i]=(t-in[RS][0][i])*0.7071068f; + } + else + { + in[RS][0][i]=in[LS][0][i]*is_ratio[i].r; + in[LS][0][i]*=is_ratio[i].l; + } + }while(i--); + } + else + { + i=ARRAYSIZE-1; + do{ + if(is_pos[i]!=7) + { + in[RS][0][i]=in[LS][0][i]*is_ratio[i].r; + in[LS][0][i]*=is_ratio[i].l; + } + }while(i--); + } + } + else + { + + if(ms_stereo) + { + int i=maxArray-1; + do{ + register REAL t=in[LS][0][i]; + + in[LS][0][i]=(t+in[RS][0][i])*0.7071068f; + in[RS][0][i]=(t-in[RS][0][i])*0.7071068f; + }while(i--); + } + for(int i=maxArray;is[3], + sfb_lines=sfBandIndex->s[4]-sfb_start; + sfb<13; + sfb++,sfb_start=sfBandIndex->s[sfb], + (sfb_lines=sfBandIndex->s[sfb+1]-sfb_start)) + { + for(int freq=0;freqs[1]; + sfb<13; + sfb++,sfb_start=sfBandIndex->s[sfb], + (sfb_lines=sfBandIndex->s[sfb+1]-sfb_start)) + { + for(int freq=0;freqgetVersion(); + int frequency=mpegAudioHeader->getFrequency(); + int mpeg25=mpegAudioHeader->getLayer25(); + register layer3grinfo *gi=&(sideinfo.ch[ch].gr[gr]); + + if(gi->generalflag) { + if(gi->mixed_block_flag) { + layer3reorder_1 (mpeg25?2:version,frequency,in,out); // Not checked... + layer3antialias_1(out); + } + else { + layer3reorder_2(mpeg25?2:version,frequency,in,out); + } + } + else { + + layer3antialias_2(in,out); + + } +} + + +//#include "dct36_12.cpp" +//#include "window.cpp" + +void Mpegtoraw::layer3hybrid(int ch,int gr,REAL in[SBLIMIT][SSLIMIT], + REAL out[SSLIMIT][SBLIMIT]) +{ + layer3grinfo *gi=&(sideinfo.ch[ch].gr[gr]); + int bt1,bt2; + REAL *prev1,*prev2; + + prev1=prevblck[ch][currentprevblock][0]; + prev2=prevblck[ch][currentprevblock^1][0]; + + bt1 = gi->mixed_block_flag ? 0 : gi->block_type; + bt2 = gi->block_type; + + { + REAL *ci=(REAL *)in, + *co=(REAL *)out; + int i; + + if(lDownSample)i=(SBLIMIT/2)-2; + else i=SBLIMIT-2; + + + if(bt2==2) + { + if(!bt1) + { + dct36(ci,prev1,prev2,getSplayWindow(0),co); + ci+=SSLIMIT;prev1+=SSLIMIT;prev2+=SSLIMIT;co++; + dct36(ci,prev1,prev2,getSplayWindowINV(0),co); + } + else + { + dct12(ci,prev1,prev2,getSplayWindow(2),co); + ci+=SSLIMIT;prev1+=SSLIMIT;prev2+=SSLIMIT;co++; + dct12(ci,prev1,prev2,getSplayWindowINV(2),co); + } + + do{ + ci+=SSLIMIT;prev1+=SSLIMIT;prev2+=SSLIMIT;co++; + dct12(ci,prev1,prev2,getSplayWindow(2),co); + i--; + ci+=SSLIMIT;prev1+=SSLIMIT;prev2+=SSLIMIT;co++; + dct12(ci,prev1,prev2,getSplayWindowINV(2),co); + }while(--i); + } + else + { + dct36(ci,prev1,prev2,getSplayWindow(bt1),co); + ci+=SSLIMIT;prev1+=SSLIMIT;prev2+=SSLIMIT;co++; + dct36(ci,prev1,prev2,getSplayWindowINV(bt1),co); + + do + { + ci+=SSLIMIT;prev1+=SSLIMIT;prev2+=SSLIMIT;co++; + dct36(ci,prev1,prev2,getSplayWindow(bt2),co); + i--; + ci+=SSLIMIT;prev1+=SSLIMIT;prev2+=SSLIMIT;co++; + dct36(ci,prev1,prev2,getSplayWindowINV(bt2),co); + }while(--i); + } + } +} + +void Mpegtoraw::extractlayer3(void) { + int version=mpegAudioHeader->getVersion(); + int inputstereo=mpegAudioHeader->getInputstereo(); + int layer3slots=mpegAudioHeader->getLayer3slots(); + + if(version) { + extractlayer3_2(); + return; + } + + { + int main_data_end,flush_main; + int bytes_to_discard; + if (layer3getsideinfo() == false) { + return; + } + // read main data. + if(issync()) { + for(register int i=layer3slots;i>0;i--) { + bitwindow.putbyte(getbyte()); + } + } else { + // read main data. + for(register int i=layer3slots;i>0;i--) { + bitwindow.putbyte(getbits8()); + } + } + + main_data_end=bitwindow.gettotalbit()>>3;// of previous frame + if (main_data_end < 0) { + DEBUG_LAYER(printf("main_data_end < 0\n");) + return; + } + + if((flush_main=(bitwindow.gettotalbit() & 0x7))) { + bitwindow.forward(8-flush_main); + main_data_end++; + } + + bytes_to_discard=layer3framestart-(main_data_end+sideinfo.main_data_begin); + if(main_data_end>WINDOWSIZE) { + layer3framestart-=WINDOWSIZE; + bitwindow.rewind(WINDOWSIZE*8); + } + layer3framestart+=layer3slots; + bitwindow.wrap(); + if(bytes_to_discard<0) return; + bitwindow.forward(bytes_to_discard<<3); + } + for(int gr=0;gr<2;gr++) { + ATTR_ALIGN(64) union + { + int is [SBLIMIT][SSLIMIT]; + REAL hin [2][SBLIMIT][SSLIMIT]; + }b1; + ATTR_ALIGN(64) union + { + REAL ro [2][SBLIMIT][SSLIMIT]; + REAL lr [2][SBLIMIT][SSLIMIT]; + REAL hout [2][SSLIMIT][SBLIMIT]; + }b2; + + layer3part2start=bitwindow.gettotalbit(); + layer3getscalefactors (LS,gr); + + layer3huffmandecode (LS,gr ,b1.is); + layer3dequantizesample(LS,gr,b1.is,b2.ro[LS]); + //dump->dump(b2.ro[LS]); + + if(inputstereo) { + layer3part2start=bitwindow.gettotalbit(); + layer3getscalefactors (RS,gr); + layer3huffmandecode (RS,gr ,b1.is); + layer3dequantizesample(RS,gr,b1.is,b2.ro[RS]); + } + layer3fixtostereo(gr,b2.ro); // b2.ro -> b2.lr + currentprevblock^=1; + + + layer3reorderandantialias(LS,gr,b2.lr[LS],b1.hin[LS]); + //dump->dump(b1.hin[LS]); + layer3hybrid (LS,gr,b1.hin[LS],b2.hout[LS]); + //dump->dump(b2.hout[LS]); + + + + + if(lOutputStereo) { + layer3reorderandantialias(RS,gr,b2.lr[RS],b1.hin[RS]); + layer3hybrid (RS,gr,b1.hin[RS],b2.hout[RS]); + + } + synthesis->doMP3Synth(lDownSample,lOutputStereo,b2.hout); + } +} + +void Mpegtoraw::extractlayer3_2(void) { + int inputstereo=mpegAudioHeader->getInputstereo(); + int layer3slots=mpegAudioHeader->getLayer3slots(); + + { + int main_data_end,flush_main; + int bytes_to_discard; + if (layer3getsideinfo_2() == false) { + return; + } + // read main data. + if(issync()) { + for(register int i=layer3slots;i>0;i--) { + bitwindow.putbyte(getbyte()); + } + } + else { + // read main data. + for(register int i=layer3slots;i>0;i--) { + bitwindow.putbyte(getbits8()); + } + } + + //bitwindow.wrap(); + + main_data_end=bitwindow.gettotalbit()>>3;// of previous frame + if (main_data_end < 0) { + DEBUG_LAYER(printf("main_data_end < 0\n");) + return; + } + + if((flush_main=(bitwindow.gettotalbit() & 0x7))) { + bitwindow.forward(8-flush_main); + main_data_end++; + } + + bytes_to_discard=layer3framestart-(main_data_end+sideinfo.main_data_begin); + if(main_data_end>WINDOWSIZE) { + layer3framestart-=WINDOWSIZE; + bitwindow.rewind(WINDOWSIZE*8); + } + layer3framestart+=layer3slots; + + bitwindow.wrap(); + if(bytes_to_discard<0)return; + bitwindow.forward(bytes_to_discard<<3); + } + + //for(int gr=0;gr<2;gr++) { + ATTR_ALIGN(64) union + { + int is [SBLIMIT][SSLIMIT]; + REAL hin [2][SBLIMIT][SSLIMIT]; + }b1; + ATTR_ALIGN(64) union + { + REAL ro [2][SBLIMIT][SSLIMIT]; + REAL lr [2][SBLIMIT][SSLIMIT]; + REAL hout [2][SSLIMIT][SBLIMIT]; + }b2; + + + layer3part2start=bitwindow.gettotalbit(); + layer3getscalefactors_2(LS); + //dump->dump(&scalefactors[LS]); + + layer3huffmandecode (LS,0 ,b1.is); + //dump->dump(b1.is); + layer3dequantizesample (LS,0,b1.is,b2.ro[LS]); + + if(inputstereo) { + layer3part2start=bitwindow.gettotalbit(); + layer3getscalefactors_2(RS); + layer3huffmandecode (RS,0 ,b1.is); + layer3dequantizesample (RS,0,b1.is,b2.ro[RS]); + } + + layer3fixtostereo(0,b2.ro); // b2.ro -> b2.lr + currentprevblock^=1; + + layer3reorderandantialias(LS,0,b2.lr[LS],b1.hin[LS]); + layer3hybrid (LS,0,b1.hin[LS],b2.hout[LS]); + if(lOutputStereo) { + layer3reorderandantialias(RS,0,b2.lr[RS],b1.hin[RS]); + layer3hybrid (RS,0,b1.hin[RS],b2.hout[RS]); + } + synthesis->doMP3Synth(lDownSample,lOutputStereo,b2.hout); + + +} + + diff --git a/Libraries/DecMPA/Files/src/splay/mpegsound.h b/Libraries/DecMPA/Files/src/splay/mpegsound.h new file mode 100644 index 000000000..5a0118405 --- /dev/null +++ b/Libraries/DecMPA/Files/src/splay/mpegsound.h @@ -0,0 +1,252 @@ +// MPEG/WAVE Sound library + +// (C) 1997 by Woo-jae Jung + +// Mpegsound.h +// This is typeset for functions in MPEG/WAVE Sound library. +// Now, it's for only linux-pc-?86 + +//changes 8/4/2002 (by Hauke Duden): +// - removed dump stuff + + +/************************************/ +/* Include default library packages */ +/************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + + + +#include "mpegAudioStream.h" +#include "common.h" + +class Synthesis; +class AudioFrame; + + +#ifndef _L__SOUND__ +#define _L__SOUND__ + +#include "../mpegAudioFrame/mpegAudioHeader.h" +#include "mpegAudioBitWindow.h" + + +//#define DEBUG_LAYER(x) x +#define DEBUG_LAYER(x) + + +/**************************/ +/* Define values for MPEG */ +/**************************/ +#define SCALEBLOCK 12 +#define MAXSUBBAND 32 +#define MAXCHANNEL 2 +#define RAWDATASIZE (2*2*2*32*SSLIMIT) + + + +// Huffmancode +#define HTN 34 + + + +#define MODE_MONO 0 +#define MODE_STEREO 1 + +/********************/ +/* Type definitions */ +/********************/ + +typedef struct { + bool generalflag; + unsigned int part2_3_length; + unsigned int big_values; + unsigned int global_gain; + unsigned int scalefac_compress; + unsigned int window_switching_flag; + unsigned int block_type; + unsigned int mixed_block_flag; + unsigned int table_select[3]; + unsigned int subblock_gain[3]; + unsigned int region0_count; + unsigned int region1_count; + unsigned int preflag; + unsigned int scalefac_scale; + unsigned int count1table_select; +}layer3grinfo; + +typedef struct { + unsigned main_data_begin; + unsigned private_bits; + struct { + unsigned scfsi[4]; + layer3grinfo gr[2]; + }ch[2]; +}layer3sideinfo; + +typedef struct { + int l[23]; /* [cb] */ + int s[3][13]; /* [window][cb] */ +}layer3scalefactor; /* [ch] */ + +typedef struct { + int tablename; + unsigned int xlen,ylen; + unsigned int linbits; + unsigned int treelen; + const unsigned int (*val)[2]; +}HUFFMANCODETABLE; + + + + + + + +class DCT; +//class Dump; + +// Class for converting mpeg format to raw format +class Mpegtoraw { + /*****************************/ + /* Constant tables for layer */ + /*****************************/ +private: + static const int bitrate[2][3][15]; + static const int frequencies[2][3]; + static const REAL scalefactorstable[64]; + ATTR_ALIGN(64) static const HUFFMANCODETABLE ht[HTN]; + + + friend class HuffmanLookup; + + /*************************/ + /* MPEG header variables */ + /*************************/ + + // comes from constructor, decoder works on them + MpegAudioStream* mpegAudioStream; + MpegAudioHeader* mpegAudioHeader; + AudioFrame* audioFrame; + //Dump* dump; + Synthesis* synthesis; + + /***************************************/ + /* Interface for setting music quality */ + /***************************************/ + + int lWantStereo; + int lOutputStereo; + int lDownSample; + +public: + Mpegtoraw(MpegAudioStream* mpegAudioStream, + MpegAudioHeader* mpegAudioHeader); + + + ~Mpegtoraw(); + int decode(AudioFrame* audioFrame); + + + void setStereo(int lStereo); + int getStereo(); + + void setDownSample(int lDownSample); + int getDownSample(); + + + +private: + void initialize(); + + + + /*****************************/ + /* Loading MPEG-Audio stream */ + /*****************************/ + + union + { + unsigned char store[4]; + unsigned int current; + }u; + + + int getbyte() { return mpegAudioStream->getbyte(); } + int getbits(int bits) { return mpegAudioStream->getbits(bits); } + int getbits9(int bits) { return mpegAudioStream->getbits9(bits); } + int getbits8() { return mpegAudioStream->getbits8(); } + int getbit() { return mpegAudioStream->getbit(); } + + + void sync() { mpegAudioStream->sync(); } + bool issync() { return mpegAudioStream->issync()!=0; } + + + /********************/ + /* Global variables */ + /********************/ + + // optimisation from maplay12+ + // 0/1: nonzero for channel 0/1 2: max position for both + int nonzero[3]; + + // for Layer3 + + int layer3framestart; + int layer3part2start; + + ATTR_ALIGN(64) REAL prevblck[2][2][SBLIMIT][SSLIMIT]; + int currentprevblock; + ATTR_ALIGN(64) layer3sideinfo sideinfo; + ATTR_ALIGN(64) layer3scalefactor scalefactors[2]; + + ATTR_ALIGN(64) MpegAudioBitWindow bitwindow; + MpegAudioBitWindow lastValidBitwindow; + + int wgetbit(void); + int wgetbits9(int bits); + int wgetbits(int bits); + int wgetCanReadBits(); + + /*************************************/ + /* Decoding functions for each layer */ + /*************************************/ + + // Extractor + void extractlayer1(void); // MPEG-1 + void extractlayer2(void); + void extractlayer3(void); + void extractlayer3_2(void); // MPEG-2 + + + // Functions for layer 3 + void layer3initialize(void); + bool layer3getsideinfo(void); + bool layer3getsideinfo_2(void); + void layer3getscalefactors(int ch,int gr); + void layer3getscalefactors_2(int ch); + void layer3huffmandecode(int ch,int gr,int out[SBLIMIT][SSLIMIT]); + REAL layer3twopow2(int scale,int preflag,int pretab_offset,int l); + REAL layer3twopow2_1(int a,int b,int c); + void layer3dequantizesample(int ch,int gr,int in[SBLIMIT][SSLIMIT], + REAL out[SBLIMIT][SSLIMIT]); + void adjustNonZero(REAL in[2][SBLIMIT][SSLIMIT]); + void layer3fixtostereo(int gr,REAL in[2][SBLIMIT][SSLIMIT]); + void layer3reorderandantialias(int ch,int gr,REAL in[SBLIMIT][SSLIMIT], + REAL out[SBLIMIT][SSLIMIT]); + + void layer3hybrid(int ch,int gr,REAL in[SBLIMIT][SSLIMIT], + REAL out[SSLIMIT][SBLIMIT]); + + void huffmandecoder_1(const HUFFMANCODETABLE *h,int *x,int *y); + void huffmandecoder_2(const HUFFMANCODETABLE *h,int *x,int *y,int *v,int *w); + +}; + + + +#endif diff --git a/Libraries/DecMPA/Files/src/splay/mpegtable.cpp b/Libraries/DecMPA/Files/src/splay/mpegtable.cpp new file mode 100644 index 000000000..5695ac4fa --- /dev/null +++ b/Libraries/DecMPA/Files/src/splay/mpegtable.cpp @@ -0,0 +1,43 @@ +/* MPEG/WAVE Sound library + + (C) 1997 by Jung woo-jae */ + +// Mpegtable.cc +// It has tables for MPEG layer 1, 2 and a part of layer 3 + +//changes 8/4/2002 (by Hauke Duden): +// - added VC6 pragma to prevent some warnings from being reported + + +#include "mpegsound.h" + +#ifdef _MSC_VER +#pragma warning(disable : 4305) +#endif + + +// Mpeg general table +const REAL Mpegtoraw::scalefactorstable[64] = +{ + 2.00000000000000, 1.58740105196820, 1.25992104989487, 1.00000000000000, + 0.79370052598410, 0.62996052494744, 0.50000000000000, 0.39685026299205, + 0.31498026247372, 0.25000000000000, 0.19842513149602, 0.15749013123686, + 0.12500000000000, 0.09921256574801, 0.07874506561843, 0.06250000000000, + 0.04960628287401, 0.03937253280921, 0.03125000000000, 0.02480314143700, + 0.01968626640461, 0.01562500000000, 0.01240157071850, 0.00984313320230, + 0.00781250000000, 0.00620078535925, 0.00492156660115, 0.00390625000000, + 0.00310039267963, 0.00246078330058, 0.00195312500000, 0.00155019633981, + 0.00123039165029, 0.00097656250000, 0.00077509816991, 0.00061519582514, + 0.00048828125000, 0.00038754908495, 0.00030759791257, 0.00024414062500, + 0.00019377454248, 0.00015379895629, 0.00012207031250, 0.00009688727124, + 0.00007689947814, 0.00006103515625, 0.00004844363562, 0.00003844973907, + 0.00003051757813, 0.00002422181781, 0.00001922486954, 0.00001525878906, + 0.00001211090890, 0.00000961243477, 0.00000762939453, 0.00000605545445, + 0.00000480621738, 0.00000381469727, 0.00000302772723, 0.00000240310869, + 0.00000190734863, 0.00000151386361, 0.00000120155435, 0.00000000000000 +}; + +#ifdef _MSC_VER +#pragma warning(default : 4305) +#endif + diff --git a/Libraries/DecMPA/Files/src/splay/mpegtoraw.cpp b/Libraries/DecMPA/Files/src/splay/mpegtoraw.cpp new file mode 100644 index 000000000..db65b1fde --- /dev/null +++ b/Libraries/DecMPA/Files/src/splay/mpegtoraw.cpp @@ -0,0 +1,137 @@ +/* MPEG/WAVE Sound library + + (C) 1997 by Jung woo-jae */ + +// Mpegtoraw.cc +// Server which get mpeg format and put raw format. + +//changes 8/4/2002 (by Hauke Duden): +// - added #include to ensure that bad_alloc will be thrown on mem error +// - removed dump stuff + +//changes 8/15/2002 (by Hauke Duden): +// - set downsample to true, by default + +//changes 8/17/2002 (by Hauke Duden): +// - set downsample to false again - it only reduced the frequency by half instead +// of synthesizing with twice the frequency and THEN reducing it by half + + +#include "mpegsound.h" +#include "synthesis.h" +//#include "dump.h" +#include "../frame/audioFrame.h" + +#include + + +Mpegtoraw::Mpegtoraw(MpegAudioStream* mpegAudioStream, + MpegAudioHeader* mpegAudioHeader) { + + this->mpegAudioStream=mpegAudioStream; + this->mpegAudioHeader=mpegAudioHeader; + + this->lOutputStereo=true; + setStereo(true); + setDownSample(false); + + //dump=new Dump(); + synthesis=new Synthesis(); + initialize(); + +} + +Mpegtoraw::~Mpegtoraw() { + + delete synthesis; + //delete dump; +} + + + + + + + +void Mpegtoraw::setStereo(int flag) { + lWantStereo=flag; +} + +void Mpegtoraw::setDownSample(int flag) { + lDownSample=flag; +} + +int Mpegtoraw::getStereo() { + return lWantStereo; +} + +int Mpegtoraw::getDownSample() { + return lDownSample; +} + + + + + + + +// Convert mpeg to raw +// Mpeg headder class +void Mpegtoraw::initialize() { + + + + layer3initialize(); + + +}; + + + + + +// Convert mpeg to raw +int Mpegtoraw::decode(AudioFrame* audioFrame) { + int back=true; + + this->audioFrame=audioFrame; + /*if (audioFrame->getSize() < RAWDATASIZE) { + cout << "audioFrame needs at least:"<clearrawdata(); + synthesis->clearrawdata(); + + int layer=mpegAudioHeader->getLayer(); + this->lOutputStereo=lWantStereo & mpegAudioHeader->getInputstereo(); + + if (mpegAudioHeader->getProtection()==false) { + mpegAudioStream->getbyte(); + mpegAudioStream->getbyte(); + } + switch(layer) { + case 3: + extractlayer3(); + break; + case 2: + extractlayer2(); + break; + case 1: + extractlayer1(); + break; + default: + //cout << "unknown layer:"<setFrameFormat(lOutputStereo, + mpegAudioHeader->getFrequencyHz()>>lDownSample); + + audioFrame->putFloatData(synthesis->getOutputData(),synthesis->getLen()); + return back; + +} diff --git a/Libraries/DecMPA/Files/src/splay/op.h b/Libraries/DecMPA/Files/src/splay/op.h new file mode 100644 index 000000000..77ace9f39 --- /dev/null +++ b/Libraries/DecMPA/Files/src/splay/op.h @@ -0,0 +1,96 @@ +/* + unrolled operations, for better Pentium FPU scheduling + Copyright (C) 2001 Martin Vogt + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Library General Public License as published by + the Free Software Foundation. + + For more information look at the file License.txt in this package + + */ + + + +#ifndef __OP_H +#define __OP_H + +/** + The Pentium has two pipelined FPUs which makes it possible + to do two operations in one cycle. + (If you are lucky) + +*/ + +#define PTR_DIST (1024) + +#define OS r1=vp1[0] * dp[0]; \ + r2=vp1[PTR_DIST-0] * dp[0]; \ + dp++; + +#define XX1 vp1+=15;dp++; + +#define XX2 r1+=vp1[0] * dp[-1]; \ + r2+=vp1[PTR_DIST-0] * dp[-1]; + +#define OP_END(val) vp1-=val;dp+=val; + +#define OP_END_1(vVal,dVal) vp1+=(vVal-dVal),dp+=dVal + + +// this is OP_END(x);XX1; together: +#define OP_END_2(vVal) vp1+=(15-vVal),dp+=vVal+1 + + +// check this to test pipelining + +#define SCHEDULE1(op,r1,r2) r1;op;r2; +#define SCHEDULE2(op,r1,r2) op;r1;r2; + +#define SCHEDULE(a,b,c) SCHEDULE2(a,b,c); + + +#define OP r1+=vp1[-1] * dp[0]; \ + r2+=vp1[PTR_DIST-1] * dp[0]; + + + +#define OP2 SCHEDULE(OP ,r1+=vp1[-2] * dp[1] ,r2+=vp1[PTR_DIST-2] *dp[1]); +#define OP3 SCHEDULE(OP2 ,r1+=vp1[-3] * dp[2] ,r2+=vp1[PTR_DIST-3] *dp[2]); +#define OP4 SCHEDULE(OP3 ,r1+=vp1[-4] * dp[3] ,r2+=vp1[PTR_DIST-4] *dp[3]); +#define OP5 SCHEDULE(OP4 ,r1+=vp1[-5] * dp[4] ,r2+=vp1[PTR_DIST-5] *dp[4]); +#define OP6 SCHEDULE(OP5 ,r1+=vp1[-6] * dp[5] ,r2+=vp1[PTR_DIST-6] *dp[5]); +#define OP7 SCHEDULE(OP6 ,r1+=vp1[-7] * dp[6] ,r2+=vp1[PTR_DIST-7] *dp[6]); +#define OP8 SCHEDULE(OP7 ,r1+=vp1[-8] * dp[7] ,r2+=vp1[PTR_DIST-8] *dp[7]); +#define OP9 SCHEDULE(OP8 ,r1+=vp1[-9] * dp[8] ,r2+=vp1[PTR_DIST-9] *dp[8]); +#define OP10 SCHEDULE(OP9 ,r1+=vp1[-10] * dp[9] ,r2+=vp1[PTR_DIST-10] *dp[9]); +#define OP11 SCHEDULE(OP10,r1+=vp1[-11] * dp[10],r2+=vp1[PTR_DIST-11] *dp[10]); +#define OP12 SCHEDULE(OP11,r1+=vp1[-12] * dp[11],r2+=vp1[PTR_DIST-12] *dp[11]); +#define OP13 SCHEDULE(OP12,r1+=vp1[-13] * dp[12],r2+=vp1[PTR_DIST-13] *dp[12]); +#define OP14 SCHEDULE(OP13,r1+=vp1[-14] * dp[13],r2+=vp1[PTR_DIST-14] *dp[13]); +#define OP15 SCHEDULE(OP14,r1+=vp1[-15] * dp[14],r2+=vp1[PTR_DIST-15] *dp[14]); + + +/* +#define OP r1+=vp1[-1] * dp[0]; \ + r2+=vp2[-1] * dp[0]; + + + +#define OP2 SCHEDULE(OP ,r1+=vp1[-2] * dp[1] ,r2+=vp2[-2] * dp[1]); +#define OP3 SCHEDULE(OP2 ,r1+=vp1[-3] * dp[2] ,r2+=vp2[-3] * dp[2]); +#define OP4 SCHEDULE(OP3 ,r1+=vp1[-4] * dp[3] ,r2+=vp2[-4] * dp[3]); +#define OP5 SCHEDULE(OP4 ,r1+=vp1[-5] * dp[4] ,r2+=vp2[-5] * dp[4]); +#define OP6 SCHEDULE(OP5 ,r1+=vp1[-6] * dp[5] ,r2+=vp2[-6] * dp[5]); +#define OP7 SCHEDULE(OP6 ,r1+=vp1[-7] * dp[6] ,r2+=vp2[-7] * dp[6]); +#define OP8 SCHEDULE(OP7 ,r1+=vp1[-8] * dp[7] ,r2+=vp2[-8] * dp[7]); +#define OP9 SCHEDULE(OP8 ,r1+=vp1[-9] * dp[8] ,r2+=vp2[-9] * dp[8]); +#define OP10 SCHEDULE(OP9 ,r1+=vp1[-10] * dp[9] ,r2+=vp2[-10] * dp[9]); +#define OP11 SCHEDULE(OP10,r1+=vp1[-11] * dp[10],r2+=vp2[-11] * dp[10]); +#define OP12 SCHEDULE(OP11,r1+=vp1[-12] * dp[11],r2+=vp2[-12] * dp[11]); +#define OP13 SCHEDULE(OP12,r1+=vp1[-13] * dp[12],r2+=vp2[-13] * dp[12]); +#define OP14 SCHEDULE(OP13,r1+=vp1[-14] * dp[13],r2+=vp2[-14] * dp[13]); +#define OP15 SCHEDULE(OP14,r1+=vp1[-15] * dp[14],r2+=vp2[-15] * dp[14]); +*/ + +#endif diff --git a/Libraries/DecMPA/Files/src/splay/splayDecoder.cpp b/Libraries/DecMPA/Files/src/splay/splayDecoder.cpp new file mode 100644 index 000000000..b80e31c28 --- /dev/null +++ b/Libraries/DecMPA/Files/src/splay/splayDecoder.cpp @@ -0,0 +1,85 @@ +/* + decoder interface for the splay mp3 decoder. + Copyright (C) 2001 Martin Vogt + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Library General Public License as published by + the Free Software Foundation. + + For more information look at the file License.txt in this package + + */ + +//changes 8/4/2002 (by Hauke Duden): +// - added #include to ensure that bad_alloc will be thrown on mem error +// - removed dump stuff +// - added function to access header from outside + +#define _FROM_SOURCE +#include "../mpegAudioFrame/dxHead.h" +#include "splayDecoder.h" +#include "mpegsound.h" + +#include +#include + + +SplayDecoder::SplayDecoder() { + header = new MpegAudioHeader(); + stream = new MpegAudioStream(); + server = new Mpegtoraw(stream,header); + + xHeadData=new XHEADDATA(); + xHeadData->toc=new unsigned char[101]; + //dump=new Dump(); +} + + +SplayDecoder::~SplayDecoder() { + delete (xHeadData->toc); + delete xHeadData; + + delete server; + delete header; + delete stream; + //delete dump; +} + + + +int SplayDecoder::decode(unsigned char* ptr, int len,AudioFrame* dest) { + int back; + // fist setup the stream and the 4 bytes header info; + //dump->dump((char*)ptr,len); + if (header->parseHeader(ptr) == false) { + return false; + } + // maybe a Xing Header? + if (len >= 152+4) { + int lXing=GetXingHeader(xHeadData,(unsigned char*)ptr); + if (lXing) { + return false; + } + } + stream->setFrame(ptr+4,len-4); + back=server->decode(dest); + + return back; + +} + + +void SplayDecoder::config(const char* key,const char* val,void* ) { + if (strcmp(key,"2")==0) { + server->setDownSample(atoi(val)); + } + if (strcmp(key,"m")==0) { + server->setStereo(atoi(val)); + } +} + +MpegAudioHeader* SplayDecoder::GetMPEGAudioHeader() +{ + return header; +} + diff --git a/Libraries/DecMPA/Files/src/splay/splayDecoder.h b/Libraries/DecMPA/Files/src/splay/splayDecoder.h new file mode 100644 index 000000000..be797d4a4 --- /dev/null +++ b/Libraries/DecMPA/Files/src/splay/splayDecoder.h @@ -0,0 +1,75 @@ +/* + decoder interface for the splay mp3 decoder. + Copyright (C) 2001 Martin Vogt + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Library General Public License as published by + the Free Software Foundation. + + For more information look at the file License.txt in this package + + */ + +//changes 8/4/2002 (by Hauke Duden): +// - removed dump stuff +// - added function to access header from outside + +//changes 8/11/2002 (by Hauke Duden): +// - removed unnecessary includes + +#ifndef __SPLAYDECODER_H +#define __SPLAYDECODER_H + +// state definitions for splay decoder + +#define _SPLAY_RESET 0 +#define _SPLAY_EOF 1 +#define _SPLAY_FIRSTINIT 2 +#define _SPLAY_REINIT 3 +#define _SPLAY_DECODE 4 +#define _SPLAY_FRAME 5 + + +#include "../frame/audioFrame.h" +//#include "dump.h" +//#include + +class Mpegtoraw; +class MpegAudioStream; +class MpegAudioHeader; + + +/** + The decoder interface. + The decoder expects an mpeg audio frame. + The call to decode is "atomic", after that you have + a PCMFrame to play. + +*/ + + + +class SplayDecoder { + + MpegAudioStream* stream; + MpegAudioHeader* header; + Mpegtoraw* server; + //Dump* dump; +#ifdef _FROM_SOURCE + XHEADDATA* xHeadData; +#else + void* xHeadData; +#endif + + + public: + SplayDecoder(); + ~SplayDecoder(); + + int decode(unsigned char* ptr, int len,AudioFrame* dest); + void config(const char* key,const char* val,void* ret); + + MpegAudioHeader* GetMPEGAudioHeader(); + +}; +#endif diff --git a/Libraries/DecMPA/Files/src/splay/synth_Down.cpp b/Libraries/DecMPA/Files/src/splay/synth_Down.cpp new file mode 100644 index 000000000..7fef84ff5 --- /dev/null +++ b/Libraries/DecMPA/Files/src/splay/synth_Down.cpp @@ -0,0 +1,231 @@ +/* + downsample implementation + Copyright (C) 2001 Martin Vogt + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Library General Public License as published by + the Free Software Foundation. + + For more information look at the file License.txt in this package + + */ + +//changes 8/4/2002 (by Hauke Duden): +// - removed cout and exit stuff + +#include "synthesis.h" +#include "dct.h" + +void Synthesis::computebuffer_Down(REAL *fraction, + REAL buffer[2][CALCBUFFERSIZE]){ + REAL *out1,*out2; + + out1=buffer[currentcalcbuffer]+calcbufferoffset; + out2=buffer[currentcalcbuffer^1]+calcbufferoffset; + dct64_downsample(out1,out2,fraction); +} + + + +#define SAVE putraw(r); \ + dp+=16;vp+=15+(15-14) +#define OS r=*vp * *dp++ +#define XX vp+=15;r+=*vp * *dp++ +#define OP r+=*--vp * *dp++ + +inline void Synthesis::generatesingle_Down(void) +{ + int i; + register REAL r, *vp; + register const REAL *dp; + + i=32/2; + dp=filter; + vp=calcbuffer[LS][currentcalcbuffer]+calcbufferoffset; +// actual_v+actual_write_pos; + + switch (calcbufferoffset) + { + case 0:for(;i;i--,vp+=15){ + OS;XX;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP; + SAVE;}break; + case 1:for(;i;i--,vp+=15){ + OS;OP;XX;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP; + SAVE;}break; + case 2:for(;i;i--,vp+=15){ + OS;OP;OP;XX;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP; + SAVE;}break; + case 3:for(;i;i--,vp+=15){ + OS;OP;OP;OP;XX;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP; + SAVE;}break; + case 4:for(;i;i--,vp+=15){ + OS;OP;OP;OP;OP;XX;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP; + SAVE;}break; + case 5:for(;i;i--,vp+=15){ + OS;OP;OP;OP;OP;OP;XX;OP;OP;OP;OP;OP;OP;OP;OP;OP; + SAVE;}break; + case 6:for(;i;i--,vp+=15){ + OS;OP;OP;OP;OP;OP;OP;XX;OP;OP;OP;OP;OP;OP;OP;OP; + SAVE;}break; + case 7:for(;i;i--,vp+=15){ + OS;OP;OP;OP;OP;OP;OP;OP;XX;OP;OP;OP;OP;OP;OP;OP; + SAVE;}break; + case 8:for(;i;i--,vp+=15){ + OS;OP;OP;OP;OP;OP;OP;OP;OP;XX;OP;OP;OP;OP;OP;OP; + SAVE;}break; + case 9:for(;i;i--,vp+=15){ + OS;OP;OP;OP;OP;OP;OP;OP;OP;OP;XX;OP;OP;OP;OP;OP; + SAVE;}break; + case 10:for(;i;i--,vp+=15){ + OS;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP;XX;OP;OP;OP;OP; + SAVE;}break; + case 11:for(;i;i--,vp+=15){ + OS;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP;XX;OP;OP;OP; + SAVE;}break; + case 12:for(;i;i--,vp+=15){ + OS;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP;XX;OP;OP; + SAVE;}break; + case 13:for(;i;i--,vp+=15){ + OS;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP;XX;OP; + SAVE;}break; + case 14:for(;i;i--,vp+=15){ + OS;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP;XX; + SAVE;}break; + case 15:for(;i;i--,vp+=31){ + OS;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP; + SAVE;}break; + } +} + +#undef OS +#undef XX +#undef OP +#undef SAVE + +#define SAVE \ + putraw(r1); \ + putraw(r2); \ + dp+=16;vp1+=15+(15-14);vp2+=15+(15-14) +#define OS r1=*vp1 * *dp; \ + r2=*vp2 * *dp++ +#define XX vp1+=15;r1+=*vp1 * *dp; \ + vp2+=15;r2+=*vp2 * *dp++ +#define OP r1+=*--vp1 * *dp; \ + r2+=*--vp2 * *dp++ + + +inline void Synthesis::generate_Down(void) +{ + int i; + REAL r1,r2; + register REAL *vp1,*vp2; + register const REAL *dp; + + dp=filter; + vp1=calcbuffer[LS][currentcalcbuffer]+calcbufferoffset; + vp2=calcbuffer[RS][currentcalcbuffer]+calcbufferoffset; +// actual_v+actual_write_pos; + + i=32/2; + switch (calcbufferoffset) + { + case 0:for(;i;i--,vp1+=15,vp2+=15){ + OS;XX;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP; + SAVE;}break; + case 1:for(;i;i--,vp1+=15,vp2+=15){ + OS;OP;XX;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP; + SAVE;}break; + case 2:for(;i;i--,vp1+=15,vp2+=15){ + OS;OP;OP;XX;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP; + SAVE;}break; + case 3:for(;i;i--,vp1+=15,vp2+=15){ + OS;OP;OP;OP;XX;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP; + SAVE;}break; + case 4:for(;i;i--,vp1+=15,vp2+=15){ + OS;OP;OP;OP;OP;XX;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP; + SAVE;}break; + case 5:for(;i;i--,vp1+=15,vp2+=15){ + OS;OP;OP;OP;OP;OP;XX;OP;OP;OP;OP;OP;OP;OP;OP;OP; + SAVE;}break; + case 6:for(;i;i--,vp1+=15,vp2+=15){ + OS;OP;OP;OP;OP;OP;OP;XX;OP;OP;OP;OP;OP;OP;OP;OP; + SAVE;}break; + case 7:for(;i;i--,vp1+=15,vp2+=15){ + OS;OP;OP;OP;OP;OP;OP;OP;XX;OP;OP;OP;OP;OP;OP;OP; + SAVE;}break; + case 8:for(;i;i--,vp1+=15,vp2+=15){ + OS;OP;OP;OP;OP;OP;OP;OP;OP;XX;OP;OP;OP;OP;OP;OP; + SAVE;}break; + case 9:for(;i;i--,vp1+=15,vp2+=15){ + OS;OP;OP;OP;OP;OP;OP;OP;OP;OP;XX;OP;OP;OP;OP;OP; + SAVE;}break; + case 10:for(;i;i--,vp1+=15,vp2+=15){ + OS;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP;XX;OP;OP;OP;OP; + SAVE;}break; + case 11:for(;i;i--,vp1+=15,vp2+=15){ + OS;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP;XX;OP;OP;OP; + SAVE;}break; + case 12:for(;i;i--,vp1+=15,vp2+=15){ + OS;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP;XX;OP;OP; + SAVE;}break; + case 13:for(;i;i--,vp1+=15,vp2+=15){ + OS;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP;XX;OP; + SAVE;}break; + case 14:for(;i;i--,vp1+=15,vp2+=15){ + OS;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP;XX; + SAVE;}break; + case 15:for(;i;i--,vp1+=31,vp2+=31){ + OS;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP;OP; + SAVE;}break; + } +} + + + +void Synthesis::synth_Down(int lOutputStereo,REAL *fractionL,REAL *fractionR) { + switch(lOutputStereo) { + case true: + computebuffer_Down(fractionL,calcbuffer[LS]); + computebuffer_Down(fractionR,calcbuffer[RS]); + generate_Down(); + nextOffset(); + break; + case false: + computebuffer_Down(fractionL,calcbuffer[LS]); + generatesingle_Down(); + nextOffset(); + break; + default: + /*cout << "unknown lOutputStereo in Synthesis::synth_Std"<=0;i--) + calcbuffer[LS][0][i]=calcbuffer[LS][1][i]= + calcbuffer[RS][0][i]=calcbuffer[RS][1][i]=0.0; + + initialize_dct64(); + initialize_dct64_downsample(); +} + + +Synthesis::~Synthesis() { +} + + +void Synthesis::doSynth(int lDownSample,int lOutputStereo, + REAL *fractionL,REAL *fractionR) { + switch(lDownSample) { + case false: + synth_Std(lOutputStereo,fractionL,fractionR); + break; + case true: + synth_Down(lOutputStereo,fractionL,fractionR); + break; + default: + /*cout << "unknown downsample parameter"< + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + DecMPA + CFBundleIconFile + + CFBundleIdentifier + com.apple.carbonframeworktemplate + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + FMWK + CFBundleSignature + ???? + CFBundleVersion + 1.0 + CFBundleShortVersionString + 1.0 + CSResourcesFileMapped + + + diff --git a/Libraries/FAAD2/English.lproj/InfoPlist.strings b/Libraries/FAAD2/English.lproj/InfoPlist.strings new file mode 100644 index 0000000000000000000000000000000000000000..84f6ce67e6d6854ad7ca242a72f376cf4837bcc6 GIT binary patch literal 140 zcmW-Z!3u&<5Jk`0uXwn0QQ%fulo1HxKS(M_mXQ|N$6E&(X6~IkhgpB@NeGmTT&Wr8 z`O?yuebg6|$;d+uYUeE6I{l94#!t+qH|b@g5`RWk&V>_i=|--l^8Z~89PHTZ(K?gr GGon9Wa~HD! literal 0 HcmV?d00001 diff --git a/Libraries/FAAD2/FAAD2.xcode/project.pbxproj b/Libraries/FAAD2/FAAD2.xcode/project.pbxproj new file mode 100644 index 000000000..2f0e328eb --- /dev/null +++ b/Libraries/FAAD2/FAAD2.xcode/project.pbxproj @@ -0,0 +1,1991 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 39; + objects = { + 034768DDFF38A45A11DB9C8B = { + children = ( + 8D07F2C80486CC7A007CD1D0, + ); + isa = PBXGroup; + name = Products; + refType = 4; + sourceTree = ""; + }; +//030 +//031 +//032 +//033 +//034 +//080 +//081 +//082 +//083 +//084 + 0867D690FE84028FC02AAC07 = { + buildSettings = { + }; + buildStyles = ( + 4F0BB7EC011F40E904CA0E50, + 4F0BB7ED011F40E904CA0E50, + ); + hasScannedForEncodings = 1; + isa = PBXProject; + mainGroup = 0867D691FE84028FC02AAC07; + productRefGroup = 034768DDFF38A45A11DB9C8B; + projectDirPath = ""; + targets = ( + 8D07F2BC0486CC7A007CD1D0, + ); + }; + 0867D691FE84028FC02AAC07 = { + children = ( + 8E3852DB084CEC6A00D715B8, + 08FB77ACFE841707C02AAC07, + 089C1665FE841158C02AAC07, + 0867D69AFE84028FC02AAC07, + 034768DDFF38A45A11DB9C8B, + ); + isa = PBXGroup; + name = FAAD2; + refType = 4; + sourceTree = ""; + }; + 0867D69AFE84028FC02AAC07 = { + children = ( + ); + isa = PBXGroup; + name = "External Frameworks and Libraries"; + refType = 4; + sourceTree = ""; + }; + 089C1665FE841158C02AAC07 = { + children = ( + 8D07F2C70486CC7A007CD1D0, + 089C1666FE841158C02AAC07, + ); + isa = PBXGroup; + name = Resources; + refType = 4; + sourceTree = ""; + }; + 089C1666FE841158C02AAC07 = { + children = ( + 089C1667FE841158C02AAC07, + ); + isa = PBXVariantGroup; + name = InfoPlist.strings; + refType = 4; + sourceTree = ""; + }; + 089C1667FE841158C02AAC07 = { + fileEncoding = 10; + isa = PBXFileReference; + lastKnownFileType = text.plist.strings; + name = English; + path = English.lproj/InfoPlist.strings; + refType = 4; + sourceTree = ""; + }; + 08FB77ACFE841707C02AAC07 = { + children = ( + 8E3851FB084CEC6100D715B8, + 8E3851FC084CEC6100D715B8, + 8E3851FD084CEC6100D715B8, + 8E3851FE084CEC6100D715B8, + 8E3851FF084CEC6100D715B8, + 8E385200084CEC6100D715B8, + 8E385201084CEC6100D715B8, + 8E38520F084CEC6100D715B8, + 8E385210084CEC6100D715B8, + 8E385211084CEC6100D715B8, + 8E385212084CEC6100D715B8, + 8E385213084CEC6100D715B8, + 8E385214084CEC6100D715B8, + 8E385215084CEC6100D715B8, + 8E385216084CEC6100D715B8, + 8E385217084CEC6100D715B8, + 8E385218084CEC6100D715B8, + 8E385219084CEC6100D715B8, + 8E38521A084CEC6100D715B8, + 8E38521B084CEC6100D715B8, + 8E38521C084CEC6100D715B8, + 8E38521D084CEC6100D715B8, + 8E38521E084CEC6100D715B8, + 8E38521F084CEC6100D715B8, + 8E385220084CEC6100D715B8, + 8E385221084CEC6100D715B8, + 8E385222084CEC6100D715B8, + 8E385223084CEC6100D715B8, + 8E385224084CEC6100D715B8, + 8E385230084CEC6100D715B8, + 8E385231084CEC6100D715B8, + 8E385233084CEC6100D715B8, + 8E385234084CEC6100D715B8, + 8E385235084CEC6100D715B8, + 8E385236084CEC6100D715B8, + 8E385237084CEC6100D715B8, + 8E385238084CEC6100D715B8, + 8E385239084CEC6100D715B8, + 8E38523A084CEC6100D715B8, + 8E38523B084CEC6100D715B8, + 8E38523C084CEC6100D715B8, + 8E38523D084CEC6100D715B8, + 8E38523E084CEC6100D715B8, + 8E38523F084CEC6100D715B8, + 8E385240084CEC6100D715B8, + 8E385241084CEC6100D715B8, + 8E385242084CEC6100D715B8, + 8E385243084CEC6200D715B8, + 8E385244084CEC6200D715B8, + 8E385245084CEC6200D715B8, + 8E385246084CEC6200D715B8, + 8E385247084CEC6200D715B8, + 8E385248084CEC6200D715B8, + 8E385249084CEC6200D715B8, + 8E38524A084CEC6200D715B8, + 8E38524B084CEC6200D715B8, + 8E38524C084CEC6200D715B8, + 8E38524D084CEC6200D715B8, + 8E38524E084CEC6200D715B8, + 8E38524F084CEC6200D715B8, + 8E385250084CEC6200D715B8, + 8E385251084CEC6200D715B8, + 8E385252084CEC6200D715B8, + 8E385253084CEC6200D715B8, + 8E385254084CEC6200D715B8, + 8E385255084CEC6200D715B8, + 8E385256084CEC6200D715B8, + 8E385257084CEC6200D715B8, + 8E385258084CEC6200D715B8, + 8E385259084CEC6200D715B8, + 8E38525A084CEC6200D715B8, + 8E38525B084CEC6200D715B8, + 8E38525C084CEC6200D715B8, + 8E38525D084CEC6200D715B8, + 8E38525E084CEC6200D715B8, + 8E38525F084CEC6200D715B8, + 8E385260084CEC6200D715B8, + 8E385261084CEC6200D715B8, + 8E385262084CEC6200D715B8, + 8E385263084CEC6200D715B8, + 8E385264084CEC6200D715B8, + 8E385265084CEC6200D715B8, + 8E385266084CEC6200D715B8, + 8E385267084CEC6200D715B8, + 8E385268084CEC6200D715B8, + 8E385269084CEC6200D715B8, + 8E38526A084CEC6200D715B8, + ); + isa = PBXGroup; + name = Source; + refType = 4; + sourceTree = ""; + }; +//080 +//081 +//082 +//083 +//084 +//4F0 +//4F1 +//4F2 +//4F3 +//4F4 + 4F0BB7EC011F40E904CA0E50 = { + buildSettings = { + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_GENERATE_DEBUGGING_SYMBOLS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + ZERO_LINK = YES; + }; + isa = PBXBuildStyle; + name = Development; + }; + 4F0BB7ED011F40E904CA0E50 = { + buildSettings = { + COPY_PHASE_STRIP = YES; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + ZERO_LINK = NO; + }; + isa = PBXBuildStyle; + name = Deployment; + }; +//4F0 +//4F1 +//4F2 +//4F3 +//4F4 +//8D0 +//8D1 +//8D2 +//8D3 +//8D4 + 8D07F2BC0486CC7A007CD1D0 = { + buildPhases = ( + 8D07F2BD0486CC7A007CD1D0, + 8D07F2BF0486CC7A007CD1D0, + 8D07F2C10486CC7A007CD1D0, + 8D07F2C30486CC7A007CD1D0, + 8D07F2C50486CC7A007CD1D0, + ); + buildRules = ( + ); + buildSettings = { + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + FRAMEWORK_VERSION = A; + GCC_GENERATE_DEBUGGING_SYMBOLS = NO; + GCC_OPTIMIZATION_LEVEL = 3; + GCC_PRECOMPILE_PREFIX_HEADER = NO; + GCC_PREFIX_HEADER = ""; + HEADER_SEARCH_PATHS = Files/libfaad/; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "@executable_path/../Frameworks"; + LIBRARY_STYLE = DYNAMIC; + OTHER_CFLAGS = "-DHAVE_CONFIG_H"; + PRODUCT_NAME = FAAD2; + WRAPPER_EXTENSION = framework; + }; + dependencies = ( + ); + isa = PBXNativeTarget; + name = FAAD2; + productInstallPath = "$(HOME)/Library/Frameworks"; + productName = FAAD2; + productReference = 8D07F2C80486CC7A007CD1D0; + productType = "com.apple.product-type.framework"; + }; + 8D07F2BD0486CC7A007CD1D0 = { + buildActionMask = 2147483647; + files = ( + 8E38526B084CEC6200D715B8, + 8E38526D084CEC6200D715B8, + 8E38526E084CEC6200D715B8, + 8E385270084CEC6200D715B8, + 8E385271084CEC6200D715B8, + 8E385272084CEC6200D715B8, + 8E385273084CEC6200D715B8, + 8E385274084CEC6200D715B8, + 8E385275084CEC6200D715B8, + 8E385276084CEC6200D715B8, + 8E385277084CEC6200D715B8, + 8E385278084CEC6200D715B8, + 8E385279084CEC6200D715B8, + 8E38527A084CEC6200D715B8, + 8E38527B084CEC6200D715B8, + 8E38527C084CEC6200D715B8, + 8E38527D084CEC6200D715B8, + 8E38527F084CEC6200D715B8, + 8E385281084CEC6200D715B8, + 8E385283084CEC6200D715B8, + 8E385285084CEC6200D715B8, + 8E385287084CEC6200D715B8, + 8E385289084CEC6200D715B8, + 8E38528A084CEC6200D715B8, + 8E38528D084CEC6200D715B8, + 8E38528F084CEC6200D715B8, + 8E385290084CEC6200D715B8, + 8E385292084CEC6200D715B8, + 8E385293084CEC6200D715B8, + 8E3852A0084CEC6200D715B8, + 8E3852A2084CEC6200D715B8, + 8E3852A4084CEC6200D715B8, + 8E3852A6084CEC6200D715B8, + 8E3852A8084CEC6200D715B8, + 8E3852AA084CEC6200D715B8, + 8E3852AC084CEC6200D715B8, + 8E3852AE084CEC6200D715B8, + 8E3852B0084CEC6200D715B8, + 8E3852B2084CEC6200D715B8, + 8E3852B4084CEC6200D715B8, + 8E3852B6084CEC6200D715B8, + 8E3852B8084CEC6200D715B8, + 8E3852BA084CEC6200D715B8, + 8E3852BC084CEC6200D715B8, + 8E3852BE084CEC6200D715B8, + 8E3852C0084CEC6200D715B8, + 8E3852C2084CEC6200D715B8, + 8E3852C3084CEC6200D715B8, + 8E3852C4084CEC6200D715B8, + 8E3852C6084CEC6200D715B8, + 8E3852C8084CEC6200D715B8, + 8E3852CA084CEC6200D715B8, + 8E3852CB084CEC6200D715B8, + 8E3852CD084CEC6200D715B8, + 8E3852CF084CEC6200D715B8, + 8E3852D1084CEC6200D715B8, + 8E3852D2084CEC6200D715B8, + 8E3852D4084CEC6200D715B8, + 8E3852D5084CEC6200D715B8, + 8E3852D7084CEC6200D715B8, + 8E3852D9084CEC6200D715B8, + 8E3852DF084CEC7B00D715B8, + 8E3852E0084CEC7B00D715B8, + 8E3852ED084CED5500D715B8, + ); + isa = PBXHeadersBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 8D07F2BF0486CC7A007CD1D0 = { + buildActionMask = 2147483647; + files = ( + 8D07F2C00486CC7A007CD1D0, + ); + isa = PBXResourcesBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 8D07F2C00486CC7A007CD1D0 = { + fileRef = 089C1666FE841158C02AAC07; + isa = PBXBuildFile; + settings = { + }; + }; + 8D07F2C10486CC7A007CD1D0 = { + buildActionMask = 2147483647; + files = ( + 8E38526C084CEC6200D715B8, + 8E38526F084CEC6200D715B8, + 8E38527E084CEC6200D715B8, + 8E385280084CEC6200D715B8, + 8E385282084CEC6200D715B8, + 8E385284084CEC6200D715B8, + 8E385286084CEC6200D715B8, + 8E385288084CEC6200D715B8, + 8E38528B084CEC6200D715B8, + 8E38528C084CEC6200D715B8, + 8E38528E084CEC6200D715B8, + 8E385291084CEC6200D715B8, + 8E38529F084CEC6200D715B8, + 8E3852A3084CEC6200D715B8, + 8E3852A5084CEC6200D715B8, + 8E3852A7084CEC6200D715B8, + 8E3852A9084CEC6200D715B8, + 8E3852AB084CEC6200D715B8, + 8E3852AD084CEC6200D715B8, + 8E3852AF084CEC6200D715B8, + 8E3852B1084CEC6200D715B8, + 8E3852B3084CEC6200D715B8, + 8E3852B5084CEC6200D715B8, + 8E3852B7084CEC6200D715B8, + 8E3852B9084CEC6200D715B8, + 8E3852BB084CEC6200D715B8, + 8E3852BD084CEC6200D715B8, + 8E3852BF084CEC6200D715B8, + 8E3852C1084CEC6200D715B8, + 8E3852C5084CEC6200D715B8, + 8E3852C7084CEC6200D715B8, + 8E3852C9084CEC6200D715B8, + 8E3852CC084CEC6200D715B8, + 8E3852CE084CEC6200D715B8, + 8E3852D0084CEC6200D715B8, + 8E3852D3084CEC6200D715B8, + 8E3852D6084CEC6200D715B8, + 8E3852D8084CEC6200D715B8, + ); + isa = PBXSourcesBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 8D07F2C30486CC7A007CD1D0 = { + buildActionMask = 2147483647; + files = ( + ); + isa = PBXFrameworksBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 8D07F2C50486CC7A007CD1D0 = { + buildActionMask = 2147483647; + files = ( + ); + isa = PBXRezBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 8D07F2C70486CC7A007CD1D0 = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = text.plist; + path = Info.plist; + refType = 4; + sourceTree = ""; + }; + 8D07F2C80486CC7A007CD1D0 = { + explicitFileType = wrapper.framework; + includeInIndex = 0; + isa = PBXFileReference; + path = FAAD2.framework; + refType = 3; + sourceTree = BUILT_PRODUCTS_DIR; + }; +//8D0 +//8D1 +//8D2 +//8D3 +//8D4 +//8E0 +//8E1 +//8E2 +//8E3 +//8E4 + 8E3851FB084CEC6100D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = analysis.h; + path = Files/libfaad/analysis.h; + refType = 4; + sourceTree = ""; + }; + 8E3851FC084CEC6100D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = bits.c; + path = Files/libfaad/bits.c; + refType = 4; + sourceTree = ""; + }; + 8E3851FD084CEC6100D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = bits.h; + path = Files/libfaad/bits.h; + refType = 4; + sourceTree = ""; + }; + 8E3851FE084CEC6100D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = cfft_tab.h; + path = Files/libfaad/cfft_tab.h; + refType = 4; + sourceTree = ""; + }; + 8E3851FF084CEC6100D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = cfft.c; + path = Files/libfaad/cfft.c; + refType = 4; + sourceTree = ""; + }; + 8E385200084CEC6100D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = cfft.h; + path = Files/libfaad/cfft.h; + refType = 4; + sourceTree = ""; + }; + 8E385201084CEC6100D715B8 = { + children = ( + 8E385202084CEC6100D715B8, + 8E385203084CEC6100D715B8, + 8E385204084CEC6100D715B8, + 8E385205084CEC6100D715B8, + 8E385206084CEC6100D715B8, + 8E385207084CEC6100D715B8, + 8E385208084CEC6100D715B8, + 8E385209084CEC6100D715B8, + 8E38520A084CEC6100D715B8, + 8E38520B084CEC6100D715B8, + 8E38520C084CEC6100D715B8, + 8E38520D084CEC6100D715B8, + 8E38520E084CEC6100D715B8, + ); + isa = PBXGroup; + name = codebook; + path = Files/libfaad/codebook; + refType = 4; + sourceTree = ""; + }; + 8E385202084CEC6100D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = hcb.h; + refType = 4; + sourceTree = ""; + }; + 8E385203084CEC6100D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = hcb_1.h; + refType = 4; + sourceTree = ""; + }; + 8E385204084CEC6100D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = hcb_10.h; + refType = 4; + sourceTree = ""; + }; + 8E385205084CEC6100D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = hcb_11.h; + refType = 4; + sourceTree = ""; + }; + 8E385206084CEC6100D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = hcb_2.h; + refType = 4; + sourceTree = ""; + }; + 8E385207084CEC6100D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = hcb_3.h; + refType = 4; + sourceTree = ""; + }; + 8E385208084CEC6100D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = hcb_4.h; + refType = 4; + sourceTree = ""; + }; + 8E385209084CEC6100D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = hcb_5.h; + refType = 4; + sourceTree = ""; + }; + 8E38520A084CEC6100D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = hcb_6.h; + refType = 4; + sourceTree = ""; + }; + 8E38520B084CEC6100D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = hcb_7.h; + refType = 4; + sourceTree = ""; + }; + 8E38520C084CEC6100D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = hcb_8.h; + refType = 4; + sourceTree = ""; + }; + 8E38520D084CEC6100D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = hcb_9.h; + refType = 4; + sourceTree = ""; + }; + 8E38520E084CEC6100D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = hcb_sf.h; + refType = 4; + sourceTree = ""; + }; + 8E38520F084CEC6100D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = common.c; + path = Files/libfaad/common.c; + refType = 4; + sourceTree = ""; + }; + 8E385210084CEC6100D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = common.h; + path = Files/libfaad/common.h; + refType = 4; + sourceTree = ""; + }; + 8E385211084CEC6100D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = decoder.c; + path = Files/libfaad/decoder.c; + refType = 4; + sourceTree = ""; + }; + 8E385212084CEC6100D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = decoder.h; + path = Files/libfaad/decoder.h; + refType = 4; + sourceTree = ""; + }; + 8E385213084CEC6100D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = drc.c; + path = Files/libfaad/drc.c; + refType = 4; + sourceTree = ""; + }; + 8E385214084CEC6100D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = drc.h; + path = Files/libfaad/drc.h; + refType = 4; + sourceTree = ""; + }; + 8E385215084CEC6100D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = drm_dec.c; + path = Files/libfaad/drm_dec.c; + refType = 4; + sourceTree = ""; + }; + 8E385216084CEC6100D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = drm_dec.h; + path = Files/libfaad/drm_dec.h; + refType = 4; + sourceTree = ""; + }; + 8E385217084CEC6100D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = error.c; + path = Files/libfaad/error.c; + refType = 4; + sourceTree = ""; + }; + 8E385218084CEC6100D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = error.h; + path = Files/libfaad/error.h; + refType = 4; + sourceTree = ""; + }; + 8E385219084CEC6100D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = filtbank.c; + path = Files/libfaad/filtbank.c; + refType = 4; + sourceTree = ""; + }; + 8E38521A084CEC6100D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = filtbank.h; + path = Files/libfaad/filtbank.h; + refType = 4; + sourceTree = ""; + }; + 8E38521B084CEC6100D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = fixed.h; + path = Files/libfaad/fixed.h; + refType = 4; + sourceTree = ""; + }; + 8E38521C084CEC6100D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = hcr.c; + path = Files/libfaad/hcr.c; + refType = 4; + sourceTree = ""; + }; + 8E38521D084CEC6100D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = huffman.c; + path = Files/libfaad/huffman.c; + refType = 4; + sourceTree = ""; + }; + 8E38521E084CEC6100D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = huffman.h; + path = Files/libfaad/huffman.h; + refType = 4; + sourceTree = ""; + }; + 8E38521F084CEC6100D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = ic_predict.c; + path = Files/libfaad/ic_predict.c; + refType = 4; + sourceTree = ""; + }; + 8E385220084CEC6100D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = ic_predict.h; + path = Files/libfaad/ic_predict.h; + refType = 4; + sourceTree = ""; + }; + 8E385221084CEC6100D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = iq_table.h; + path = Files/libfaad/iq_table.h; + refType = 4; + sourceTree = ""; + }; + 8E385222084CEC6100D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = is.c; + path = Files/libfaad/is.c; + refType = 4; + sourceTree = ""; + }; + 8E385223084CEC6100D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = is.h; + path = Files/libfaad/is.h; + refType = 4; + sourceTree = ""; + }; + 8E385224084CEC6100D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = kbd_win.h; + path = Files/libfaad/kbd_win.h; + refType = 4; + sourceTree = ""; + }; + 8E385230084CEC6100D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = lt_predict.c; + path = Files/libfaad/lt_predict.c; + refType = 4; + sourceTree = ""; + }; + 8E385231084CEC6100D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = lt_predict.h; + path = Files/libfaad/lt_predict.h; + refType = 4; + sourceTree = ""; + }; + 8E385233084CEC6100D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = mdct_tab.h; + path = Files/libfaad/mdct_tab.h; + refType = 4; + sourceTree = ""; + }; + 8E385234084CEC6100D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = mdct.c; + path = Files/libfaad/mdct.c; + refType = 4; + sourceTree = ""; + }; + 8E385235084CEC6100D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = mdct.h; + path = Files/libfaad/mdct.h; + refType = 4; + sourceTree = ""; + }; + 8E385236084CEC6100D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = mp4.c; + path = Files/libfaad/mp4.c; + refType = 4; + sourceTree = ""; + }; + 8E385237084CEC6100D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = mp4.h; + path = Files/libfaad/mp4.h; + refType = 4; + sourceTree = ""; + }; + 8E385238084CEC6100D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = ms.c; + path = Files/libfaad/ms.c; + refType = 4; + sourceTree = ""; + }; + 8E385239084CEC6100D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = ms.h; + path = Files/libfaad/ms.h; + refType = 4; + sourceTree = ""; + }; + 8E38523A084CEC6100D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = output.c; + path = Files/libfaad/output.c; + refType = 4; + sourceTree = ""; + }; + 8E38523B084CEC6100D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = output.h; + path = Files/libfaad/output.h; + refType = 4; + sourceTree = ""; + }; + 8E38523C084CEC6100D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = pns.c; + path = Files/libfaad/pns.c; + refType = 4; + sourceTree = ""; + }; + 8E38523D084CEC6100D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = pns.h; + path = Files/libfaad/pns.h; + refType = 4; + sourceTree = ""; + }; + 8E38523E084CEC6100D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = ps_dec.c; + path = Files/libfaad/ps_dec.c; + refType = 4; + sourceTree = ""; + }; + 8E38523F084CEC6100D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = ps_dec.h; + path = Files/libfaad/ps_dec.h; + refType = 4; + sourceTree = ""; + }; + 8E385240084CEC6100D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = ps_syntax.c; + path = Files/libfaad/ps_syntax.c; + refType = 4; + sourceTree = ""; + }; + 8E385241084CEC6100D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = ps_tables.h; + path = Files/libfaad/ps_tables.h; + refType = 4; + sourceTree = ""; + }; + 8E385242084CEC6100D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = pulse.c; + path = Files/libfaad/pulse.c; + refType = 4; + sourceTree = ""; + }; + 8E385243084CEC6200D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = pulse.h; + path = Files/libfaad/pulse.h; + refType = 4; + sourceTree = ""; + }; + 8E385244084CEC6200D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = rvlc.c; + path = Files/libfaad/rvlc.c; + refType = 4; + sourceTree = ""; + }; + 8E385245084CEC6200D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = rvlc.h; + path = Files/libfaad/rvlc.h; + refType = 4; + sourceTree = ""; + }; + 8E385246084CEC6200D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = sbr_dct.c; + path = Files/libfaad/sbr_dct.c; + refType = 4; + sourceTree = ""; + }; + 8E385247084CEC6200D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = sbr_dct.h; + path = Files/libfaad/sbr_dct.h; + refType = 4; + sourceTree = ""; + }; + 8E385248084CEC6200D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = sbr_dec.c; + path = Files/libfaad/sbr_dec.c; + refType = 4; + sourceTree = ""; + }; + 8E385249084CEC6200D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = sbr_dec.h; + path = Files/libfaad/sbr_dec.h; + refType = 4; + sourceTree = ""; + }; + 8E38524A084CEC6200D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = sbr_e_nf.c; + path = Files/libfaad/sbr_e_nf.c; + refType = 4; + sourceTree = ""; + }; + 8E38524B084CEC6200D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = sbr_e_nf.h; + path = Files/libfaad/sbr_e_nf.h; + refType = 4; + sourceTree = ""; + }; + 8E38524C084CEC6200D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = sbr_fbt.c; + path = Files/libfaad/sbr_fbt.c; + refType = 4; + sourceTree = ""; + }; + 8E38524D084CEC6200D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = sbr_fbt.h; + path = Files/libfaad/sbr_fbt.h; + refType = 4; + sourceTree = ""; + }; + 8E38524E084CEC6200D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = sbr_hfadj.c; + path = Files/libfaad/sbr_hfadj.c; + refType = 4; + sourceTree = ""; + }; + 8E38524F084CEC6200D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = sbr_hfadj.h; + path = Files/libfaad/sbr_hfadj.h; + refType = 4; + sourceTree = ""; + }; + 8E385250084CEC6200D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = sbr_hfgen.c; + path = Files/libfaad/sbr_hfgen.c; + refType = 4; + sourceTree = ""; + }; + 8E385251084CEC6200D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = sbr_hfgen.h; + path = Files/libfaad/sbr_hfgen.h; + refType = 4; + sourceTree = ""; + }; + 8E385252084CEC6200D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = sbr_huff.c; + path = Files/libfaad/sbr_huff.c; + refType = 4; + sourceTree = ""; + }; + 8E385253084CEC6200D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = sbr_huff.h; + path = Files/libfaad/sbr_huff.h; + refType = 4; + sourceTree = ""; + }; + 8E385254084CEC6200D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = sbr_noise.h; + path = Files/libfaad/sbr_noise.h; + refType = 4; + sourceTree = ""; + }; + 8E385255084CEC6200D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = sbr_qmf_c.h; + path = Files/libfaad/sbr_qmf_c.h; + refType = 4; + sourceTree = ""; + }; + 8E385256084CEC6200D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = sbr_qmf.c; + path = Files/libfaad/sbr_qmf.c; + refType = 4; + sourceTree = ""; + }; + 8E385257084CEC6200D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = sbr_qmf.h; + path = Files/libfaad/sbr_qmf.h; + refType = 4; + sourceTree = ""; + }; + 8E385258084CEC6200D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = sbr_syntax.c; + path = Files/libfaad/sbr_syntax.c; + refType = 4; + sourceTree = ""; + }; + 8E385259084CEC6200D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = sbr_syntax.h; + path = Files/libfaad/sbr_syntax.h; + refType = 4; + sourceTree = ""; + }; + 8E38525A084CEC6200D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = sbr_tf_grid.c; + path = Files/libfaad/sbr_tf_grid.c; + refType = 4; + sourceTree = ""; + }; + 8E38525B084CEC6200D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = sbr_tf_grid.h; + path = Files/libfaad/sbr_tf_grid.h; + refType = 4; + sourceTree = ""; + }; + 8E38525C084CEC6200D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = sine_win.h; + path = Files/libfaad/sine_win.h; + refType = 4; + sourceTree = ""; + }; + 8E38525D084CEC6200D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = specrec.c; + path = Files/libfaad/specrec.c; + refType = 4; + sourceTree = ""; + }; + 8E38525E084CEC6200D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = specrec.h; + path = Files/libfaad/specrec.h; + refType = 4; + sourceTree = ""; + }; + 8E38525F084CEC6200D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = ssr_fb.c; + path = Files/libfaad/ssr_fb.c; + refType = 4; + sourceTree = ""; + }; + 8E385260084CEC6200D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = ssr_fb.h; + path = Files/libfaad/ssr_fb.h; + refType = 4; + sourceTree = ""; + }; + 8E385261084CEC6200D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = ssr_ipqf.c; + path = Files/libfaad/ssr_ipqf.c; + refType = 4; + sourceTree = ""; + }; + 8E385262084CEC6200D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = ssr_ipqf.h; + path = Files/libfaad/ssr_ipqf.h; + refType = 4; + sourceTree = ""; + }; + 8E385263084CEC6200D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = ssr_win.h; + path = Files/libfaad/ssr_win.h; + refType = 4; + sourceTree = ""; + }; + 8E385264084CEC6200D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = ssr.c; + path = Files/libfaad/ssr.c; + refType = 4; + sourceTree = ""; + }; + 8E385265084CEC6200D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = ssr.h; + path = Files/libfaad/ssr.h; + refType = 4; + sourceTree = ""; + }; + 8E385266084CEC6200D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = structs.h; + path = Files/libfaad/structs.h; + refType = 4; + sourceTree = ""; + }; + 8E385267084CEC6200D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = syntax.c; + path = Files/libfaad/syntax.c; + refType = 4; + sourceTree = ""; + }; + 8E385268084CEC6200D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = syntax.h; + path = Files/libfaad/syntax.h; + refType = 4; + sourceTree = ""; + }; + 8E385269084CEC6200D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = tns.c; + path = Files/libfaad/tns.c; + refType = 4; + sourceTree = ""; + }; + 8E38526A084CEC6200D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = tns.h; + path = Files/libfaad/tns.h; + refType = 4; + sourceTree = ""; + }; + 8E38526B084CEC6200D715B8 = { + fileRef = 8E3851FB084CEC6100D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E38526C084CEC6200D715B8 = { + fileRef = 8E3851FC084CEC6100D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E38526D084CEC6200D715B8 = { + fileRef = 8E3851FD084CEC6100D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E38526E084CEC6200D715B8 = { + fileRef = 8E3851FE084CEC6100D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E38526F084CEC6200D715B8 = { + fileRef = 8E3851FF084CEC6100D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E385270084CEC6200D715B8 = { + fileRef = 8E385200084CEC6100D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E385271084CEC6200D715B8 = { + fileRef = 8E385202084CEC6100D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E385272084CEC6200D715B8 = { + fileRef = 8E385203084CEC6100D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E385273084CEC6200D715B8 = { + fileRef = 8E385204084CEC6100D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E385274084CEC6200D715B8 = { + fileRef = 8E385205084CEC6100D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E385275084CEC6200D715B8 = { + fileRef = 8E385206084CEC6100D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E385276084CEC6200D715B8 = { + fileRef = 8E385207084CEC6100D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E385277084CEC6200D715B8 = { + fileRef = 8E385208084CEC6100D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E385278084CEC6200D715B8 = { + fileRef = 8E385209084CEC6100D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E385279084CEC6200D715B8 = { + fileRef = 8E38520A084CEC6100D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E38527A084CEC6200D715B8 = { + fileRef = 8E38520B084CEC6100D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E38527B084CEC6200D715B8 = { + fileRef = 8E38520C084CEC6100D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E38527C084CEC6200D715B8 = { + fileRef = 8E38520D084CEC6100D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E38527D084CEC6200D715B8 = { + fileRef = 8E38520E084CEC6100D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E38527E084CEC6200D715B8 = { + fileRef = 8E38520F084CEC6100D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E38527F084CEC6200D715B8 = { + fileRef = 8E385210084CEC6100D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E385280084CEC6200D715B8 = { + fileRef = 8E385211084CEC6100D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E385281084CEC6200D715B8 = { + fileRef = 8E385212084CEC6100D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E385282084CEC6200D715B8 = { + fileRef = 8E385213084CEC6100D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E385283084CEC6200D715B8 = { + fileRef = 8E385214084CEC6100D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E385284084CEC6200D715B8 = { + fileRef = 8E385215084CEC6100D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E385285084CEC6200D715B8 = { + fileRef = 8E385216084CEC6100D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E385286084CEC6200D715B8 = { + fileRef = 8E385217084CEC6100D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E385287084CEC6200D715B8 = { + fileRef = 8E385218084CEC6100D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E385288084CEC6200D715B8 = { + fileRef = 8E385219084CEC6100D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E385289084CEC6200D715B8 = { + fileRef = 8E38521A084CEC6100D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E38528A084CEC6200D715B8 = { + fileRef = 8E38521B084CEC6100D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E38528B084CEC6200D715B8 = { + fileRef = 8E38521C084CEC6100D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E38528C084CEC6200D715B8 = { + fileRef = 8E38521D084CEC6100D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E38528D084CEC6200D715B8 = { + fileRef = 8E38521E084CEC6100D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E38528E084CEC6200D715B8 = { + fileRef = 8E38521F084CEC6100D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E38528F084CEC6200D715B8 = { + fileRef = 8E385220084CEC6100D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E385290084CEC6200D715B8 = { + fileRef = 8E385221084CEC6100D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E385291084CEC6200D715B8 = { + fileRef = 8E385222084CEC6100D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E385292084CEC6200D715B8 = { + fileRef = 8E385223084CEC6100D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E385293084CEC6200D715B8 = { + fileRef = 8E385224084CEC6100D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E38529F084CEC6200D715B8 = { + fileRef = 8E385230084CEC6100D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E3852A0084CEC6200D715B8 = { + fileRef = 8E385231084CEC6100D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E3852A2084CEC6200D715B8 = { + fileRef = 8E385233084CEC6100D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E3852A3084CEC6200D715B8 = { + fileRef = 8E385234084CEC6100D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E3852A4084CEC6200D715B8 = { + fileRef = 8E385235084CEC6100D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E3852A5084CEC6200D715B8 = { + fileRef = 8E385236084CEC6100D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E3852A6084CEC6200D715B8 = { + fileRef = 8E385237084CEC6100D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E3852A7084CEC6200D715B8 = { + fileRef = 8E385238084CEC6100D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E3852A8084CEC6200D715B8 = { + fileRef = 8E385239084CEC6100D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E3852A9084CEC6200D715B8 = { + fileRef = 8E38523A084CEC6100D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E3852AA084CEC6200D715B8 = { + fileRef = 8E38523B084CEC6100D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E3852AB084CEC6200D715B8 = { + fileRef = 8E38523C084CEC6100D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E3852AC084CEC6200D715B8 = { + fileRef = 8E38523D084CEC6100D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E3852AD084CEC6200D715B8 = { + fileRef = 8E38523E084CEC6100D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E3852AE084CEC6200D715B8 = { + fileRef = 8E38523F084CEC6100D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E3852AF084CEC6200D715B8 = { + fileRef = 8E385240084CEC6100D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E3852B0084CEC6200D715B8 = { + fileRef = 8E385241084CEC6100D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E3852B1084CEC6200D715B8 = { + fileRef = 8E385242084CEC6100D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E3852B2084CEC6200D715B8 = { + fileRef = 8E385243084CEC6200D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E3852B3084CEC6200D715B8 = { + fileRef = 8E385244084CEC6200D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E3852B4084CEC6200D715B8 = { + fileRef = 8E385245084CEC6200D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E3852B5084CEC6200D715B8 = { + fileRef = 8E385246084CEC6200D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E3852B6084CEC6200D715B8 = { + fileRef = 8E385247084CEC6200D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E3852B7084CEC6200D715B8 = { + fileRef = 8E385248084CEC6200D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E3852B8084CEC6200D715B8 = { + fileRef = 8E385249084CEC6200D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E3852B9084CEC6200D715B8 = { + fileRef = 8E38524A084CEC6200D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E3852BA084CEC6200D715B8 = { + fileRef = 8E38524B084CEC6200D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E3852BB084CEC6200D715B8 = { + fileRef = 8E38524C084CEC6200D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E3852BC084CEC6200D715B8 = { + fileRef = 8E38524D084CEC6200D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E3852BD084CEC6200D715B8 = { + fileRef = 8E38524E084CEC6200D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E3852BE084CEC6200D715B8 = { + fileRef = 8E38524F084CEC6200D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E3852BF084CEC6200D715B8 = { + fileRef = 8E385250084CEC6200D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E3852C0084CEC6200D715B8 = { + fileRef = 8E385251084CEC6200D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E3852C1084CEC6200D715B8 = { + fileRef = 8E385252084CEC6200D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E3852C2084CEC6200D715B8 = { + fileRef = 8E385253084CEC6200D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E3852C3084CEC6200D715B8 = { + fileRef = 8E385254084CEC6200D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E3852C4084CEC6200D715B8 = { + fileRef = 8E385255084CEC6200D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E3852C5084CEC6200D715B8 = { + fileRef = 8E385256084CEC6200D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E3852C6084CEC6200D715B8 = { + fileRef = 8E385257084CEC6200D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E3852C7084CEC6200D715B8 = { + fileRef = 8E385258084CEC6200D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E3852C8084CEC6200D715B8 = { + fileRef = 8E385259084CEC6200D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E3852C9084CEC6200D715B8 = { + fileRef = 8E38525A084CEC6200D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E3852CA084CEC6200D715B8 = { + fileRef = 8E38525B084CEC6200D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E3852CB084CEC6200D715B8 = { + fileRef = 8E38525C084CEC6200D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E3852CC084CEC6200D715B8 = { + fileRef = 8E38525D084CEC6200D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E3852CD084CEC6200D715B8 = { + fileRef = 8E38525E084CEC6200D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E3852CE084CEC6200D715B8 = { + fileRef = 8E38525F084CEC6200D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E3852CF084CEC6200D715B8 = { + fileRef = 8E385260084CEC6200D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E3852D0084CEC6200D715B8 = { + fileRef = 8E385261084CEC6200D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E3852D1084CEC6200D715B8 = { + fileRef = 8E385262084CEC6200D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E3852D2084CEC6200D715B8 = { + fileRef = 8E385263084CEC6200D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E3852D3084CEC6200D715B8 = { + fileRef = 8E385264084CEC6200D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E3852D4084CEC6200D715B8 = { + fileRef = 8E385265084CEC6200D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E3852D5084CEC6200D715B8 = { + fileRef = 8E385266084CEC6200D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E3852D6084CEC6200D715B8 = { + fileRef = 8E385267084CEC6200D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E3852D7084CEC6200D715B8 = { + fileRef = 8E385268084CEC6200D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E3852D8084CEC6200D715B8 = { + fileRef = 8E385269084CEC6200D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E3852D9084CEC6200D715B8 = { + fileRef = 8E38526A084CEC6200D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + 8E3852DB084CEC6A00D715B8 = { + children = ( + 8E3852EC084CED5500D715B8, + 8E3852DD084CEC7B00D715B8, + 8E3852DE084CEC7B00D715B8, + ); + isa = PBXGroup; + name = Headers; + refType = 4; + sourceTree = ""; + }; + 8E3852DD084CEC7B00D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = faad.h; + path = Files/include/faad.h; + refType = 4; + sourceTree = ""; + }; + 8E3852DE084CEC7B00D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = neaacdec.h; + path = Files/include/neaacdec.h; + refType = 4; + sourceTree = ""; + }; + 8E3852DF084CEC7B00D715B8 = { + fileRef = 8E3852DD084CEC7B00D715B8; + isa = PBXBuildFile; + settings = { + ATTRIBUTES = ( + Public, + ); + }; + }; + 8E3852E0084CEC7B00D715B8 = { + fileRef = 8E3852DE084CEC7B00D715B8; + isa = PBXBuildFile; + settings = { + ATTRIBUTES = ( + Public, + ); + }; + }; + 8E3852EC084CED5500D715B8 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = config.h; + path = Files/config.h; + refType = 4; + sourceTree = ""; + }; + 8E3852ED084CED5500D715B8 = { + fileRef = 8E3852EC084CED5500D715B8; + isa = PBXBuildFile; + settings = { + }; + }; + }; + rootObject = 0867D690FE84028FC02AAC07; +} diff --git a/Libraries/FAAD2/FAAD2.xcode/xugg.mode1 b/Libraries/FAAD2/FAAD2.xcode/xugg.mode1 new file mode 100644 index 000000000..631f10958 --- /dev/null +++ b/Libraries/FAAD2/FAAD2.xcode/xugg.mode1 @@ -0,0 +1,1223 @@ + + + + + ActivePerspectiveName + Project + AllowedModules + + + BundleLoadPath + + MaxInstances + n + Module + PBXSmartGroupTreeModule + Name + Groups and Files Outline View + + + BundleLoadPath + + MaxInstances + n + Module + PBXNavigatorGroup + Name + Editor + + + BundleLoadPath + + MaxInstances + n + Module + XCTaskListModule + Name + Task List + + + BundleLoadPath + + MaxInstances + n + Module + XCDetailModule + Name + File and Smart Group Detail Viewer + + + BundleLoadPath + + MaxInstances + 1 + Module + PBXBuildResultsModule + Name + Detailed Build Results Viewer + + + BundleLoadPath + + MaxInstances + 1 + Module + PBXProjectFindModule + Name + Project Batch Find Tool + + + BundleLoadPath + + MaxInstances + n + Module + PBXRunSessionModule + Name + Run Log + + + BundleLoadPath + + MaxInstances + n + Module + PBXBookmarksModule + Name + Bookmarks Tool + + + BundleLoadPath + + MaxInstances + n + Module + PBXClassBrowserModule + Name + Class Browser + + + BundleLoadPath + + MaxInstances + n + Module + PBXCVSModule + Name + Source Code Control Tool + + + BundleLoadPath + + MaxInstances + n + Module + PBXDebugBreakpointsModule + Name + Debug Breakpoints Tool + + + BundleLoadPath + + MaxInstances + n + Module + XCDockableInspector + Name + Inspector + + + BundleLoadPath + + MaxInstances + n + Module + PBXOpenQuicklyModule + Name + Open Quickly Tool + + + BundleLoadPath + + MaxInstances + 1 + Module + PBXDebugSessionModule + Name + Debugger + + + BundleLoadPath + + MaxInstances + 1 + Module + PBXDebugCLIModule + Name + Debug Console + + + Description + DefaultDescriptionKey + DockingSystemVisible + + Extension + mode1 + FavBarConfig + + PBXProjectModuleGUID + 8E3852EB084CECAD00D715B8 + XCBarModuleItemNames + + XCBarModuleItems + + + FirstTimeWindowDisplayed + + Identifier + com.apple.perspectives.project.mode1 + MajorVersion + 31 + MinorVersion + 1 + Name + Default + Notifications + + OpenEditors + + PerspectiveWidths + + -1 + -1 + + Perspectives + + + ChosenToolbarItems + + active-target-popup + action + NSToolbarFlexibleSpaceItem + buildOrClean + build-and-runOrDebug + com.apple.ide.PBXToolbarStopButton + get-info + toggle-editor + NSToolbarFlexibleSpaceItem + com.apple.pbx.toolbar.searchfield + + ControllerClassBaseName + + IconName + WindowOfProjectWithEditor + Identifier + perspective.project + IsVertical + + Layout + + + ContentConfiguration + + PBXBottomSmartGroupGIDs + + 1C37FBAC04509CD000000102 + 1C37FAAC04509CD000000102 + 1C08E77C0454961000C914BD + 1C37FABC05509CD000000102 + 1C37FABC05539CD112110102 + E2644B35053B69B200211256 + 1C37FABC04509CD000100104 + 1CC0EA4004350EF90044410B + 1CC0EA4004350EF90041110B + + PBXProjectModuleGUID + 1CE0B1FE06471DED0097A5F4 + PBXProjectModuleLabel + Files + PBXProjectStructureProvided + yes + PBXSmartGroupTreeModuleColumnData + + PBXSmartGroupTreeModuleColumnWidthsKey + + 186 + + PBXSmartGroupTreeModuleColumnsKey_v4 + + MainColumn + + + PBXSmartGroupTreeModuleOutlineStateKey_v7 + + PBXSmartGroupTreeModuleOutlineStateExpansionKey + + 0867D691FE84028FC02AAC07 + 034768DDFF38A45A11DB9C8B + 8D07F2C80486CC7A007CD1D0 + 1C37FBAC04509CD000000102 + 1C37FABC05509CD000000102 + + PBXSmartGroupTreeModuleOutlineStateSelectionKey + + + 0 + + + PBXSmartGroupTreeModuleOutlineStateVisibleRectKey + {{0, 0}, {186, 338}} + + PBXTopSmartGroupGIDs + + XCIncludePerspectivesSwitch + + XCSharingToken + com.apple.Xcode.GFSharingToken + + GeometryConfiguration + + Frame + {{0, 0}, {203, 356}} + GroupTreeTableConfiguration + + MainColumn + 186 + + RubberWindowFrame + 167 339 690 397 0 0 1024 746 + + Module + PBXSmartGroupTreeModule + Proportion + 203pt + + + Dock + + + ContentConfiguration + + PBXProjectModuleGUID + 1CE0B20306471E060097A5F4 + PBXProjectModuleLabel + MyNewFile14.java + PBXSplitModuleInNavigatorKey + + Split0 + + PBXProjectModuleGUID + 1CE0B20406471E060097A5F4 + PBXProjectModuleLabel + MyNewFile14.java + + SplitCount + 1 + + StatusBarVisibility + + + GeometryConfiguration + + Frame + {{0, 0}, {482, 0}} + RubberWindowFrame + 167 339 690 397 0 0 1024 746 + + Module + PBXNavigatorGroup + Proportion + 0pt + + + BecomeActive + + ContentConfiguration + + PBXProjectModuleGUID + 1CE0B20506471E060097A5F4 + PBXProjectModuleLabel + Detail + + GeometryConfiguration + + Frame + {{0, 5}, {482, 351}} + RubberWindowFrame + 167 339 690 397 0 0 1024 746 + + Module + XCDetailModule + Proportion + 351pt + + + Proportion + 482pt + + + Name + Project + ServiceClasses + + XCModuleDock + PBXSmartGroupTreeModule + XCModuleDock + PBXNavigatorGroup + XCDetailModule + + TableOfContents + + 8E45D7AD084E82A200867D39 + 1CE0B1FE06471DED0097A5F4 + 8E45D7AE084E82A200867D39 + 1CE0B20306471E060097A5F4 + 1CE0B20506471E060097A5F4 + + ToolbarConfiguration + xcode.toolbar.config.default + + + ControllerClassBaseName + + IconName + WindowOfProject + Identifier + perspective.morph + IsVertical + 0 + Layout + + + BecomeActive + 1 + ContentConfiguration + + PBXBottomSmartGroupGIDs + + 1C37FBAC04509CD000000102 + 1C37FAAC04509CD000000102 + 1C08E77C0454961000C914BD + 1C37FABC05509CD000000102 + 1C37FABC05539CD112110102 + E2644B35053B69B200211256 + 1C37FABC04509CD000100104 + 1CC0EA4004350EF90044410B + 1CC0EA4004350EF90041110B + + PBXProjectModuleGUID + 11E0B1FE06471DED0097A5F4 + PBXProjectModuleLabel + Files + PBXProjectStructureProvided + yes + PBXSmartGroupTreeModuleColumnData + + PBXSmartGroupTreeModuleColumnWidthsKey + + 186 + + PBXSmartGroupTreeModuleColumnsKey_v4 + + MainColumn + + + PBXSmartGroupTreeModuleOutlineStateKey_v7 + + PBXSmartGroupTreeModuleOutlineStateExpansionKey + + 29B97314FDCFA39411CA2CEA + 1C37FABC05509CD000000102 + + PBXSmartGroupTreeModuleOutlineStateSelectionKey + + + 0 + + + PBXSmartGroupTreeModuleOutlineStateVisibleRectKey + {{0, 0}, {186, 337}} + + PBXTopSmartGroupGIDs + + XCIncludePerspectivesSwitch + 1 + XCSharingToken + com.apple.Xcode.GFSharingToken + + GeometryConfiguration + + Frame + {{0, 0}, {203, 355}} + GroupTreeTableConfiguration + + MainColumn + 186 + + RubberWindowFrame + 373 269 690 397 0 0 1440 878 + + Module + PBXSmartGroupTreeModule + Proportion + 100% + + + Name + Morph + PreferredWidth + 300 + ServiceClasses + + XCModuleDock + PBXSmartGroupTreeModule + + TableOfContents + + 11E0B1FE06471DED0097A5F4 + + ToolbarConfiguration + xcode.toolbar.config.default.short + + + PerspectivesBarVisible + + ShelfIsVisible + + SourceDescription + file at '/System/Library/PrivateFrameworks/DevToolsInterface.framework/Versions/A/Resources/XCPerspectivesSpecificationMode1.xcperspec' + StatusbarIsVisible + + TimeStamp + 0.0 + ToolbarDisplayMode + 1 + ToolbarIsVisible + + ToolbarSizeMode + 1 + Type + Perspectives + UpdateMessage + The Default Workspace in this version of Xcode now includes support to hide and show the detail view (what has been referred to as the "Metro-Morph" feature). You must discard your current Default Workspace settings and update to the latest Default Workspace in order to gain this feature. Do you wish to update to the latest Workspace defaults for project '%@'? + WindowJustification + 5 + WindowOrderList + + 8E3852E7084CECAC00D715B8 + /Users/xugg/Projects/Cog/Libraries/FAAD2/FAAD2.xcode + + WindowString + 167 339 690 397 0 0 1024 746 + WindowTools + + + FirstTimeWindowDisplayed + + Identifier + windowTool.build + IsVertical + + Layout + + + Dock + + + BecomeActive + + ContentConfiguration + + PBXProjectModuleGUID + 1CD0528F0623707200166675 + PBXProjectModuleLabel + huffman.c + StatusBarVisibility + + + GeometryConfiguration + + Frame + {{0, 0}, {1024, 343}} + RubberWindowFrame + 0 121 1024 625 0 0 1024 746 + + Module + PBXNavigatorGroup + Proportion + 343pt + + + ContentConfiguration + + PBXProjectModuleGUID + XCMainBuildResultsModuleGUID + PBXProjectModuleLabel + Build + XCBuildResultsTrigger_Collapse + 1021 + XCBuildResultsTrigger_Open + 1011 + + GeometryConfiguration + + Frame + {{0, 348}, {1024, 236}} + RubberWindowFrame + 0 121 1024 625 0 0 1024 746 + + Module + PBXBuildResultsModule + Proportion + 236pt + + + Proportion + 584pt + + + Name + Build Results + ServiceClasses + + PBXBuildResultsModule + + StatusbarIsVisible + + TableOfContents + + 8E3852E7084CECAC00D715B8 + 8E45D7BA084E82EF00867D39 + 1CD0528F0623707200166675 + XCMainBuildResultsModuleGUID + + ToolbarConfiguration + xcode.toolbar.config.build + WindowString + 0 121 1024 625 0 0 1024 746 + WindowToolGUID + 8E3852E7084CECAC00D715B8 + WindowToolIsVisible + + + + Identifier + windowTool.debugger + Layout + + + Dock + + + ContentConfiguration + + Debugger + + HorizontalSplitView + + _collapsingFrameDimension + 0.0 + _indexOfCollapsedView + 0 + _percentageOfCollapsedView + 0.0 + isCollapsed + yes + sizes + + {{0, 0}, {317, 164}} + {{317, 0}, {377, 164}} + + + VerticalSplitView + + _collapsingFrameDimension + 0.0 + _indexOfCollapsedView + 0 + _percentageOfCollapsedView + 0.0 + isCollapsed + yes + sizes + + {{0, 0}, {694, 164}} + {{0, 164}, {694, 216}} + + + + LauncherConfigVersion + 8 + PBXProjectModuleGUID + 1C162984064C10D400B95A72 + PBXProjectModuleLabel + Debug - GLUTExamples (Underwater) + + GeometryConfiguration + + DebugConsoleDrawerSize + {100, 120} + DebugConsoleVisible + None + DebugConsoleWindowFrame + {{200, 200}, {500, 300}} + DebugSTDIOWindowFrame + {{200, 200}, {500, 300}} + Frame + {{0, 0}, {694, 380}} + RubberWindowFrame + 321 238 694 422 0 0 1440 878 + + Module + PBXDebugSessionModule + Proportion + 100% + + + Proportion + 100% + + + Name + Debugger + ServiceClasses + + PBXDebugSessionModule + + StatusbarIsVisible + 1 + TableOfContents + + 1CD10A99069EF8BA00B06720 + 1C0AD2AB069F1E9B00FABCE6 + 1C162984064C10D400B95A72 + 1C0AD2AC069F1E9B00FABCE6 + + ToolbarConfiguration + xcode.toolbar.config.debug + WindowString + 321 238 694 422 0 0 1440 878 + WindowToolGUID + 1CD10A99069EF8BA00B06720 + WindowToolIsVisible + 0 + + + FirstTimeWindowDisplayed + + Identifier + windowTool.find + IsVertical + + Layout + + + Dock + + + Dock + + + ContentConfiguration + + PBXProjectModuleGUID + 1CDD528C0622207200134675 + PBXProjectModuleLabel + + StatusBarVisibility + + + GeometryConfiguration + + Frame + {{0, 0}, {781, 212}} + RubberWindowFrame + 188 243 781 470 0 0 1024 746 + + Module + PBXNavigatorGroup + Proportion + 781pt + + + Proportion + 212pt + + + ContentConfiguration + + PBXProjectModuleGUID + 1CD0528E0623707200166675 + PBXProjectModuleLabel + Project Find + + GeometryConfiguration + + Frame + {{0, 217}, {781, 212}} + RubberWindowFrame + 188 243 781 470 0 0 1024 746 + + Module + PBXProjectFindModule + Proportion + 212pt + + + Proportion + 429pt + + + Name + Project Find + ServiceClasses + + PBXProjectFindModule + + StatusbarIsVisible + + TableOfContents + + 1C530D57069F1CE1000CFCEE + 8E146003084CEE5800DB7064 + 8E146004084CEE5800DB7064 + 1CDD528C0622207200134675 + 1CD0528E0623707200166675 + + WindowString + 188 243 781 470 0 0 1024 746 + WindowToolGUID + 1C530D57069F1CE1000CFCEE + WindowToolIsVisible + + + + Identifier + MENUSEPARATOR + + + Identifier + windowTool.debuggerConsole + Layout + + + Dock + + + BecomeActive + 1 + ContentConfiguration + + PBXProjectModuleGUID + 1C78EAAC065D492600B07095 + PBXProjectModuleLabel + Debugger Console + + GeometryConfiguration + + Frame + {{0, 0}, {440, 358}} + RubberWindowFrame + 650 41 440 400 0 0 1280 1002 + + Module + PBXDebugCLIModule + Proportion + 358pt + + + Proportion + 358pt + + + Name + Debugger Console + ServiceClasses + + PBXDebugCLIModule + + StatusbarIsVisible + 1 + TableOfContents + + 1C78EAAD065D492600B07095 + 1C78EAAE065D492600B07095 + 1C78EAAC065D492600B07095 + + WindowString + 650 41 440 400 0 0 1280 1002 + + + Identifier + windowTool.run + Layout + + + Dock + + + ContentConfiguration + + LauncherConfigVersion + 3 + PBXProjectModuleGUID + 1CD0528B0623707200166675 + PBXProjectModuleLabel + Run + Runner + + HorizontalSplitView + + _collapsingFrameDimension + 0.0 + _indexOfCollapsedView + 0 + _percentageOfCollapsedView + 0.0 + isCollapsed + yes + sizes + + {{0, 0}, {493, 167}} + {{0, 176}, {493, 267}} + + + VerticalSplitView + + _collapsingFrameDimension + 0.0 + _indexOfCollapsedView + 0 + _percentageOfCollapsedView + 0.0 + isCollapsed + yes + sizes + + {{0, 0}, {405, 443}} + {{414, 0}, {514, 443}} + + + + + GeometryConfiguration + + Frame + {{0, 0}, {460, 159}} + RubberWindowFrame + 316 696 459 200 0 0 1280 1002 + + Module + PBXRunSessionModule + Proportion + 159pt + + + Proportion + 159pt + + + Name + Run Log + ServiceClasses + + PBXRunSessionModule + + StatusbarIsVisible + 1 + TableOfContents + + 1C0AD2B3069F1EA900FABCE6 + 1C0AD2B4069F1EA900FABCE6 + 1CD0528B0623707200166675 + 1C0AD2B5069F1EA900FABCE6 + + ToolbarConfiguration + xcode.toolbar.config.run + WindowString + 316 696 459 200 0 0 1280 1002 + WindowToolGUID + 1C0AD2B3069F1EA900FABCE6 + WindowToolIsVisible + 0 + + + Identifier + windowTool.scm + Layout + + + Dock + + + ContentConfiguration + + PBXProjectModuleGUID + 1C78EAB2065D492600B07095 + PBXProjectModuleLabel + <No Editor> + PBXSplitModuleInNavigatorKey + + Split0 + + PBXProjectModuleGUID + 1C78EAB3065D492600B07095 + + SplitCount + 1 + + StatusBarVisibility + 1 + + GeometryConfiguration + + Frame + {{0, 0}, {452, 0}} + RubberWindowFrame + 743 379 452 308 0 0 1280 1002 + + Module + PBXNavigatorGroup + Proportion + 0pt + + + BecomeActive + 1 + ContentConfiguration + + PBXProjectModuleGUID + 1CD052920623707200166675 + PBXProjectModuleLabel + SCM + + GeometryConfiguration + + ConsoleFrame + {{0, 259}, {452, 0}} + Frame + {{0, 7}, {452, 259}} + RubberWindowFrame + 743 379 452 308 0 0 1280 1002 + TableConfiguration + + Status + 30 + FileName + 199 + Path + 197.09500122070312 + + TableFrame + {{0, 0}, {452, 250}} + + Module + PBXCVSModule + Proportion + 262pt + + + Proportion + 266pt + + + Name + SCM + ServiceClasses + + PBXCVSModule + + StatusbarIsVisible + 1 + TableOfContents + + 1C78EAB4065D492600B07095 + 1C78EAB5065D492600B07095 + 1C78EAB2065D492600B07095 + 1CD052920623707200166675 + + ToolbarConfiguration + xcode.toolbar.config.scm + WindowString + 743 379 452 308 0 0 1280 1002 + + + Identifier + windowTool.breakpoints + Layout + + + Dock + + + BecomeActive + 1 + ContentConfiguration + + PBXProjectModuleGUID + 1CD052930623707200166675 + PBXProjectModuleLabel + Breakpoints + + GeometryConfiguration + + BreakpointsTreeTableConfiguration + + enabledColumn + 16 + breakpointColumn + 201.5830078125 + + Frame + {{0, 0}, {240, 195}} + RubberWindowFrame + 342 421 240 216 0 0 1440 878 + + Module + PBXDebugBreakpointsModule + Proportion + 195pt + + + Proportion + 195pt + + + Name + Breakpoints + ServiceClasses + + PBXDebugBreakpointsModule + + StatusbarIsVisible + 0 + TableOfContents + + 1C0AD2AD069F1E9B00FABCE6 + 1C0AD2AE069F1E9B00FABCE6 + 1CD052930623707200166675 + + WindowString + 342 421 240 216 0 0 1440 878 + WindowToolGUID + 1C0AD2AD069F1E9B00FABCE6 + WindowToolIsVisible + 0 + + + Identifier + windowTool.bookmarks + Layout + + + Dock + + + Module + PBXBookmarksModule + Proportion + 100% + + + Proportion + 100% + + + Name + Bookmarks + ServiceClasses + + PBXBookmarksModule + + StatusbarIsVisible + 0 + WindowString + 538 42 401 187 0 0 1280 1002 + + + Identifier + windowTool.classBrowser + Layout + + + Dock + + + BecomeActive + 1 + ContentConfiguration + + OptionsSetName + Hierarchy, all classes + PBXProjectModuleGUID + 1CA6456E063B45B4001379D8 + PBXProjectModuleLabel + Class Browser - NSObject + + GeometryConfiguration + + ClassesFrame + {{0, 0}, {374, 96}} + ClassesTreeTableConfiguration + + PBXClassNameColumnIdentifier + 208 + PBXClassBookColumnIdentifier + 22 + + Frame + {{0, 0}, {630, 331}} + MembersFrame + {{0, 105}, {374, 395}} + MembersTreeTableConfiguration + + PBXMemberTypeIconColumnIdentifier + 22 + PBXMemberNameColumnIdentifier + 216 + PBXMemberTypeColumnIdentifier + 97 + PBXMemberBookColumnIdentifier + 22 + + PBXModuleWindowStatusBarHidden2 + 1 + RubberWindowFrame + 385 179 630 352 0 0 1440 878 + + Module + PBXClassBrowserModule + Proportion + 332pt + + + Proportion + 332pt + + + Name + Class Browser + ServiceClasses + + PBXClassBrowserModule + + StatusbarIsVisible + 0 + TableOfContents + + 1C0AD2AF069F1E9B00FABCE6 + 1C0AD2B0069F1E9B00FABCE6 + 1CA6456E063B45B4001379D8 + + ToolbarConfiguration + xcode.toolbar.config.classbrowser + WindowString + 385 179 630 352 0 0 1440 878 + WindowToolGUID + 1C0AD2AF069F1E9B00FABCE6 + WindowToolIsVisible + 0 + + + + diff --git a/Libraries/FAAD2/FAAD2.xcode/xugg.pbxuser b/Libraries/FAAD2/FAAD2.xcode/xugg.pbxuser new file mode 100644 index 000000000..92ec0d19d --- /dev/null +++ b/Libraries/FAAD2/FAAD2.xcode/xugg.pbxuser @@ -0,0 +1,98 @@ +// !$*UTF8*$! +{ + 0867D690FE84028FC02AAC07 = { + activeBuildStyle = 4F0BB7ED011F40E904CA0E50; + activeTarget = 8D07F2BC0486CC7A007CD1D0; + addToTargets = ( + 8D07F2BC0486CC7A007CD1D0, + ); + codeSenseManager = 8E3851F6084CEC2000D715B8; + perUserDictionary = { + PBXConfiguration.PBXFileTableDataSource3.PBXFileTableDataSource = { + PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; + PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID; + PBXFileTableDataSourceColumnWidthsKey = ( + 20, + 243, + 20, + 48, + 43, + 43, + 20, + ); + PBXFileTableDataSourceColumnsKey = ( + PBXFileDataSource_FiletypeID, + PBXFileDataSource_Filename_ColumnID, + PBXFileDataSource_Built_ColumnID, + PBXFileDataSource_ObjectSize_ColumnID, + PBXFileDataSource_Errors_ColumnID, + PBXFileDataSource_Warnings_ColumnID, + PBXFileDataSource_Target_ColumnID, + ); + }; + PBXConfiguration.PBXTargetDataSource.PBXTargetDataSource = { + PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; + PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID; + PBXFileTableDataSourceColumnWidthsKey = ( + 20, + 200, + 63, + 20, + 48.1626, + 43, + 43, + ); + PBXFileTableDataSourceColumnsKey = ( + PBXFileDataSource_FiletypeID, + PBXFileDataSource_Filename_ColumnID, + PBXTargetDataSource_PrimaryAttribute, + PBXFileDataSource_Built_ColumnID, + PBXFileDataSource_ObjectSize_ColumnID, + PBXFileDataSource_Errors_ColumnID, + PBXFileDataSource_Warnings_ColumnID, + ); + }; + PBXPerProjectTemplateStateSaveDate = 139362959; + PBXWorkspaceStateSaveDate = 139362959; + }; + sourceControlManager = 8E3851F5084CEC2000D715B8; + userBuildSettings = { + }; + }; + 8D07F2BC0486CC7A007CD1D0 = { + activeExec = 0; + }; + 8E3851F5084CEC2000D715B8 = { + fallbackIsa = XCSourceControlManager; + isSCMEnabled = 0; + isa = PBXSourceControlManager; + scmConfiguration = { + }; + scmType = ""; + }; + 8E3851F6084CEC2000D715B8 = { + indexTemplatePath = ""; + isa = PBXCodeSenseManager; + }; + 8E3851FC084CEC6100D715B8 = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {983, 2996}}"; + sepNavSelRange = "{1209, 0}"; + sepNavVisRect = "{{0, 272}, {983, 311}}"; + }; + }; + 8E385210084CEC6100D715B8 = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {983, 5964}}"; + sepNavSelRange = "{1253, 13}"; + sepNavVisRect = "{{0, 291}, {983, 311}}"; + }; + }; + 8E38521D084CEC6100D715B8 = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {983, 7798}}"; + sepNavSelRange = "{8543, 47}"; + sepNavVisRect = "{{0, 4192}, {983, 311}}"; + }; + }; +} diff --git a/Libraries/FAAD2/FAAD2_Prefix.pch b/Libraries/FAAD2/FAAD2_Prefix.pch new file mode 100644 index 000000000..26ff72902 --- /dev/null +++ b/Libraries/FAAD2/FAAD2_Prefix.pch @@ -0,0 +1,5 @@ +// +// Prefix header for all source files of the 'FAAD2' target in the 'FAAD2' project. +// + +#include diff --git a/Libraries/FAAD2/Files/AUTHORS b/Libraries/FAAD2/Files/AUTHORS new file mode 100644 index 000000000..4f8d7660e --- /dev/null +++ b/Libraries/FAAD2/Files/AUTHORS @@ -0,0 +1,17 @@ + +M. Bakker (mbakker(at)nero.com) + - complete library + +Alexander Kurpiers (a.kurpiers(at)nt.tu-darmstadt.de) + - HCR code + - DRM stuff + - lot's of bug fixes + +Volker Fischer (v.fischer(at)nt.tu-darmstadt.de) + - DRM code + - lot's of bug fixes + +Gian-Carlo Pascutto (gpascutto(at)nero.com) + - DRM PS code + - bugfixes + \ No newline at end of file diff --git a/Libraries/FAAD2/Files/COPYING b/Libraries/FAAD2/Files/COPYING new file mode 100644 index 000000000..920c4e674 --- /dev/null +++ b/Libraries/FAAD2/Files/COPYING @@ -0,0 +1,350 @@ + +Any non-GPL usage of this software or parts of this software is strictly +forbidden. + +Commercial non-GPL licensing of this software is possible. +For more info contact Ahead Software through Mpeg4AAClicense@nero.com. + + + + + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) 19yy + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/Libraries/FAAD2/Files/ChangeLog b/Libraries/FAAD2/Files/ChangeLog new file mode 100644 index 000000000..ac80c109f --- /dev/null +++ b/Libraries/FAAD2/Files/ChangeLog @@ -0,0 +1,126 @@ +8 september 2004 mbakker(at)nero.com + - specrec.c: fixed compilation without PS + +4 september 2004 mbakker(at)nero.com + - sbr_fbt.c, sbr_hfgen.c: fixed possible lockup with bad data. + +4 september 2004 mbakker(at)nero.com + - cfft.c,h, common.c,h, filtbank.c,h, mdct.h, sbr_qmf.h, structs.h, decoder.c, specrec.c: + Removed USE_SSE + +4 september 2004 gpascutto(at)nero.com + - specrec.c: small optimizations to inverse quant + +3 september 2004 mbakker(at)nero.com + - neaacdec.h, decoder.c, syntax.c, structs.h: added output flag for PS + +3 september 2004 mbakker(at)nero.com + - common.c: added log2_fix() + +28 august 2004 gpascutto(at)nero.com + - sbr_syntax.c: bugfix with PS_DEC and DRM_PS defines + +21 august 2004 mbakker(at)nero.com + - cfft.c, cfft_tab.h: added size 128 fixed point FFT tables for HVXC + +18 august 2004 mbakker(at)nero.com + - sbr_syntax.c: allow only 1 PS data element per SBR extension data + +18 august 2004 gpascutto(at)nero.com + - specrec.c: safeguard against PS suddenly going on + +4 august 2004 gpascutto(at)nero.com + - drm_dec.c: make sure we still copy to the right channel if there's no data + +2 august 2004 gpascutto(at)nero.com + - hcr.c: bugfix + +31 july 2004 gpascutto(at)nero.com + - hcr.c: Rewritten and optimized + +29 july 2004 mbakker(at)nero.com + - /mp4ff/mp4ff.c,mp4atoms.c: support video decoding better + +28 july 2004 gpascutto(at)nero.com + - drm_dec.*, sbr_dec.c, syntax.c: improved error concealment + +27 july 2004 gpascutto(at)nero.com + - sbr_dec.c, sbr_syntax.c: duplicate code removal + +25 july 2004 gpascutto(at)nero.com + - syntax.c: re-enable SBR CRC checking for DRM + +22 july 2004 gpascutto(at)nero.com + - drm_dec.*: changed delay filter to 2 samples plus fractional delay, as in normal PS AAC + (DRM standard is wrong here) + +2 july 2004 mbakker(at)nero.com + - huffman.c: Implemented VCB11 error concealment + +22 june 2004 mbakker(at)nero.com + - ps_dec.c: Removed samplerate dependancy in PS, likely to be updated in corrigendum + +15 june 2004 mbakker(at)nero.com + - sbr_dct.c,h: Removed huge ugly DCT_4_64... + - sbr_qmf.c: replaced DCT_IV in qmf synthesis + +13 june 2004 mbakker(at)nero.com + - ps_dec.c: Fixed fixed point code, no more cos() and sin() used + +7 june 2004 mbakker(at)nero.com + - sbr_*.c,h: Overall speedups and improvements in SBR code. + +4 june 2004 gpascutto(at)nero.com + - drm_dec.c: Fixed a bug in the standard (PAN mixing) + +3 june 2004 mbakker(at)nero.com + - ps_syntax.c: fixed a bug in one of the huffman tables + +2 june 2004 gpascutto(at)nero.com + - drm_dec.c: Fully working fixed point support + +27 may 2004 mbakker(at)nero.com + - sbr_qmf.c, sbr_dec.h: Fixed fixed point problems with downsampled QMF + +17 may 2004 mbakker(at)nero.com + - syntax.c, decoder.c: Added some logging output + +17 may 2004 mbakker(at)nero.com + - mp4atom.c: Fixed an issue with broken MP4 files + +16 may 2004 mbakker(at)nero.com + - ps_dec.c: fixed point: forgot to convert a few multiplies + +14 may 2004 mbakker(at)nero.com + - sbr_*.c: reduced memory usage + +6 may 2004 mbakker(at)nero.com + - common.c: added some bit tricks and fixed point log2/pow2 + - sbr_hfadj.c: log2/pow2 based gain calculation for SBR + - sbr_hfgen.c: use block exponent instead of stupid search to find max value + +5 may 2004 mbakker(at)nero.com + - decoder.c, neaacdec.h, decoder.h: added extra decode function to which a + buffer can be provided. Instead of the library providing a buffer. + +5 may 2004 mbakker(at)nero.com + - mdct.c: fixed fixed point MDCT with framesizes 960, 480, 120 + +2 may 2004 mbakker(at)nero.com + - mdct_tab.h, mdct.c: Added tables for MDCT, for increased accuracy in fixed point + - specrec.c: Moved quantisation, scaling and reordering to 1 function + +20 april 2004 gpacutto(at)nero.com + - drm_dec.c, drm_dec.h: Don't do PS processing if no data was read this frame. + Fix for bitstread reading bug in specification. + +15 april 2004 mbakker(at)nero.com + - sbr_hfadj.c: fixed buffer overflow + - multiple: fixed some eVC problems + +12 april 2004 mbakker(at)nero.com + - common.h, ps_dec.c: Updates for PS fixed point, should completely work now + +12 april 2004 gpascutto(at)nero.com + - drm_dec.c, drm_dec.h: eliminated sqrt and SA mapping/dequantization from DRM PS decoder + diff --git a/Libraries/FAAD2/Files/NEWS b/Libraries/FAAD2/Files/NEWS new file mode 100644 index 000000000..a18a5228e --- /dev/null +++ b/Libraries/FAAD2/Files/NEWS @@ -0,0 +1,7 @@ + +6 February 2004 + - FAAD2 version 2.0 released + +25 July 2003 + - Release version with SBR decoding + diff --git a/Libraries/FAAD2/Files/README b/Libraries/FAAD2/Files/README new file mode 100644 index 000000000..a3a3d5a83 --- /dev/null +++ b/Libraries/FAAD2/Files/README @@ -0,0 +1,122 @@ + +Freeware Advanced Audio (AAC) Decoder including SBR decoding +http://www.audiocoding.com/ + +FAAD2 is a HE, LC, MAIN and LTP profile, MPEG2 and MPEG-4 AAC decoder. +FAAD2 includes code for SBR (HE AAC) decoding. +FAAD2 is licensed under the GPL. + + +__________ +COPYRIGHTS + +For FAAD2 the following license applies: + +****************************************************************************** +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003 M. Bakker (mbakker(at)nero.com), Ahead Software AG +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Commercial non-GPL licensing of this software is also possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +****************************************************************************** + + +Please note that the use of this software may require the payment of +patent royalties. You need to consider this issue before you start +building derivative works. We are not warranting or indemnifying you in +any way for patent royalities! YOU ARE SOLELY RESPONSIBLE FOR YOUR OWN +ACTIONS! + + +______ +PEOPLE + +FAAD2 is written by: + - M. Bakker (mbakker(at)nero.com). + + +_______________ +VERSION HISTORY + +Sorry, try building a ChangeLog from CVS. + +__________________________________ +REDISTRIBUTED OPEN SOURCE PACKAGES + +This is the list of redistributed open source packages that are included +in FAAD2: + +Name: mp4v2 +Version: 0.9.8.6 +Origin: http://www.mpeg4ip.net +Author: David Mackie +Directory: common/mp4v2 +License: MPL, Mozilla Public License, version 1.1 + +Name: mp4av +Version: 0.9.8.6 +Origin: http://www.mpeg4ip.net +Author: David Mackie +Directory: common/mp4av +License: MPL, Mozilla Public License, version 1.1 + + +___________________ +DIRECTORY STRUCTURE + +faad2 - top level directory. + + aacDECdrop - windows decoder/player with drag'n'drop functionality + + common - generally used libraries and code. + + faad - general common functions like filereading and streaming + as well as getting info from aac files. + + mp4v2 - MPEG-4 file reading library. + + mp4av - MPEG-4 file general function library. + + mp4ff - Small MP4 file format library (includes tagging abilities). + + CoreAAC - AAC DirectShow filter. + + frontend - command line frontend to the FAAD2 library, also supports + MPEG-4 file decoding. + + include - inlude file for the FAAD2 library. + + libfaad - the FAAD2 AAC decoder library including SBR. + + codebook - Huffman codebooks + + plugins - plugins for all kinds of pograms. + + in_mp4 - winamp MPEG-4 AAC file input plugin. + + QCD - Quintessential player AAC plugin. + + QCDMp4 - Quintessential player MP4 plugin. + + winamp - winamp2 AAC input plugin. + + winamp3 - winamp3 AAC input plugin. + + xmms - xmms AAC plugin + + mpeg4ip - plugin for the mpeg4ip player + diff --git a/Libraries/FAAD2/Files/README.linux b/Libraries/FAAD2/Files/README.linux new file mode 100644 index 000000000..f30cf4cf2 --- /dev/null +++ b/Libraries/FAAD2/Files/README.linux @@ -0,0 +1,16 @@ +To compile under Linux. +---------------------- +just run : + +autoreconf -vif +./configure --with-mp4v2 +make +sudo make install + + +about the xmms plugin. +--------------------- + The xmms plugin need to be build after the install of the faad project. +so after you have installed correctly faad (--with-xmms options) you need +to configure and build the xmms plugin part in the plugins/xmms directory. +Read the README and INSTALL files into the xmms directory. diff --git a/Libraries/FAAD2/Files/TODO b/Libraries/FAAD2/Files/TODO new file mode 100644 index 000000000..e78a92577 --- /dev/null +++ b/Libraries/FAAD2/Files/TODO @@ -0,0 +1,2 @@ + +- Not much... diff --git a/Libraries/FAAD2/Files/config.h b/Libraries/FAAD2/Files/config.h new file mode 100644 index 000000000..5727eabc4 --- /dev/null +++ b/Libraries/FAAD2/Files/config.h @@ -0,0 +1,113 @@ +/* config.h. Generated by configure. */ +/* config.h.in. Generated from configure.in by autoheader. */ + +/* Define if you want to use libfaad together with Digital Radio Mondiale + (DRM) */ +/* #undef DRM */ +#define DRM + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ERRNO_H 1 + +/* Define if needed */ +/* #undef HAVE_FLOAT32_T */ + +/* Define to 1 if you have the header file. */ +#define HAVE_FLOAT_H 1 + +/* Define to 1 if you have the `getpwuid' function. */ +#define HAVE_GETPWUID 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define if you have the IOKit API */ +#define HAVE_IOKIT_IOKITLIB_H 1 + +/* 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_MATHF_H */ + +/* Define to 1 if you have the `memcpy' function. */ +#define HAVE_MEMCPY 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* 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_STDLIB_H 1 + +/* Define to 1 if you have the `strchr' function. */ +#define HAVE_STRCHR 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 `strsep' function. */ +#define HAVE_STRSEP 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYSFS_LIBSYSFS_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_UNISTD_H 1 + +/* Name of package */ +#define PACKAGE "faad2" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "" + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define to 1 if you can safely include both and . */ +#define TIME_WITH_SYS_TIME 1 + +/* Version number of package */ +#define VERSION "2.0" + +/* Define to 1 if your processor stores words with the most significant byte + first (like Motorola and SPARC, unlike Intel and VAX). */ +#define WORDS_BIGENDIAN 1 + +/* 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 `long' if does not define. */ +/* #undef off_t */ diff --git a/Libraries/FAAD2/Files/include/faad.h b/Libraries/FAAD2/Files/include/faad.h new file mode 100644 index 000000000..f854d3e14 --- /dev/null +++ b/Libraries/FAAD2/Files/include/faad.h @@ -0,0 +1,32 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +/* warn people for update */ +#pragma message("please update faad2 include filename and function names!") + +/* Backwards compatible link */ +#include "neaacdec.h" diff --git a/Libraries/FAAD2/Files/include/neaacdec.h b/Libraries/FAAD2/Files/include/neaacdec.h new file mode 100644 index 000000000..320e4f58d --- /dev/null +++ b/Libraries/FAAD2/Files/include/neaacdec.h @@ -0,0 +1,252 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#ifndef __NEAACDEC_H__ +#define __NEAACDEC_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + +#if 1 +/* MACROS FOR BACKWARDS COMPATIBILITY */ +/* structs */ +#define faacDecHandle NeAACDecHandle +#define faacDecConfiguration NeAACDecConfiguration +#define faacDecConfigurationPtr NeAACDecConfigurationPtr +#define faacDecFrameInfo NeAACDecFrameInfo +/* functions */ +#define faacDecGetErrorMessage NeAACDecGetErrorMessage +#define faacDecSetConfiguration NeAACDecSetConfiguration +#define faacDecGetCurrentConfiguration NeAACDecGetCurrentConfiguration +#define faacDecInit NeAACDecInit +#define faacDecInit2 NeAACDecInit2 +#define faacDecInitDRM NeAACDecInitDRM +#define faacDecPostSeekReset NeAACDecPostSeekReset +#define faacDecOpen NeAACDecOpen +#define faacDecClose NeAACDecClose +#define faacDecDecode NeAACDecDecode +#define AudioSpecificConfig NeAACDecAudioSpecificConfig +#endif + + +#ifdef _WIN32 + #pragma pack(push, 8) + #ifndef NEAACDECAPI + #define NEAACDECAPI __cdecl + #endif +#else + #ifndef NEAACDECAPI + #define NEAACDECAPI + #endif +#endif + +#define FAAD2_VERSION "2.1 beta" + +/* object types for AAC */ +#define MAIN 1 +#define LC 2 +#define SSR 3 +#define LTP 4 +#define HE_AAC 5 +#define ER_LC 17 +#define ER_LTP 19 +#define LD 23 +#define DRM_ER_LC 27 /* special object type for DRM */ + +/* header types */ +#define RAW 0 +#define ADIF 1 +#define ADTS 2 + +/* SBR signalling */ +#define NO_SBR 0 +#define SBR_UPSAMPLED 1 +#define SBR_DOWNSAMPLED 2 +#define NO_SBR_UPSAMPLED 3 + +/* library output formats */ +#define FAAD_FMT_16BIT 1 +#define FAAD_FMT_24BIT 2 +#define FAAD_FMT_32BIT 3 +#define FAAD_FMT_FLOAT 4 +#define FAAD_FMT_FIXED FAAD_FMT_FLOAT +#define FAAD_FMT_DOUBLE 5 + +/* Capabilities */ +#define LC_DEC_CAP (1<<0) /* Can decode LC */ +#define MAIN_DEC_CAP (1<<1) /* Can decode MAIN */ +#define LTP_DEC_CAP (1<<2) /* Can decode LTP */ +#define LD_DEC_CAP (1<<3) /* Can decode LD */ +#define ERROR_RESILIENCE_CAP (1<<4) /* Can decode ER */ +#define FIXED_POINT_CAP (1<<5) /* Fixed point */ + +/* Channel definitions */ +#define FRONT_CHANNEL_CENTER (1) +#define FRONT_CHANNEL_LEFT (2) +#define FRONT_CHANNEL_RIGHT (3) +#define SIDE_CHANNEL_LEFT (4) +#define SIDE_CHANNEL_RIGHT (5) +#define BACK_CHANNEL_LEFT (6) +#define BACK_CHANNEL_RIGHT (7) +#define BACK_CHANNEL_CENTER (8) +#define LFE_CHANNEL (9) +#define UNKNOWN_CHANNEL (0) + +/* DRM channel definitions */ +#define DRMCH_MONO 1 +#define DRMCH_STEREO 2 +#define DRMCH_SBR_MONO 3 +#define DRMCH_SBR_STEREO 4 +#define DRMCH_SBR_PS_STEREO 5 + + +/* A decode call can eat up to FAAD_MIN_STREAMSIZE bytes per decoded channel, + so at least so much bytes per channel should be available in this stream */ +#define FAAD_MIN_STREAMSIZE 768 /* 6144 bits/channel */ + + +typedef void *NeAACDecHandle; + +typedef struct mp4AudioSpecificConfig +{ + /* Audio Specific Info */ + unsigned char objectTypeIndex; + unsigned char samplingFrequencyIndex; + unsigned long samplingFrequency; + unsigned char channelsConfiguration; + + /* GA Specific Info */ + unsigned char frameLengthFlag; + unsigned char dependsOnCoreCoder; + unsigned short coreCoderDelay; + unsigned char extensionFlag; + unsigned char aacSectionDataResilienceFlag; + unsigned char aacScalefactorDataResilienceFlag; + unsigned char aacSpectralDataResilienceFlag; + unsigned char epConfig; + + char sbr_present_flag; + char forceUpSampling; + char downSampledSBR; +} mp4AudioSpecificConfig; + +typedef struct NeAACDecConfiguration +{ + unsigned char defObjectType; + unsigned long defSampleRate; + unsigned char outputFormat; + unsigned char downMatrix; + unsigned char useOldADTSFormat; + unsigned char dontUpSampleImplicitSBR; +} NeAACDecConfiguration, *NeAACDecConfigurationPtr; + +typedef struct NeAACDecFrameInfo +{ + unsigned long bytesconsumed; + unsigned long samples; + unsigned char channels; + unsigned char error; + unsigned long samplerate; + + /* SBR: 0: off, 1: on; upsample, 2: on; downsampled, 3: off; upsampled */ + unsigned char sbr; + + /* MPEG-4 ObjectType */ + unsigned char object_type; + + /* AAC header type; MP4 will be signalled as RAW also */ + unsigned char header_type; + + /* multichannel configuration */ + unsigned char num_front_channels; + unsigned char num_side_channels; + unsigned char num_back_channels; + unsigned char num_lfe_channels; + unsigned char channel_position[64]; + + /* PS: 0: off, 1: on */ + unsigned char ps; +} NeAACDecFrameInfo; + +char* NEAACDECAPI NeAACDecGetErrorMessage(unsigned char errcode); + +unsigned long NEAACDECAPI NeAACDecGetCapabilities(void); + +NeAACDecHandle NEAACDECAPI NeAACDecOpen(void); + +NeAACDecConfigurationPtr NEAACDECAPI NeAACDecGetCurrentConfiguration(NeAACDecHandle hDecoder); + +unsigned char NEAACDECAPI NeAACDecSetConfiguration(NeAACDecHandle hDecoder, + NeAACDecConfigurationPtr config); + +/* Init the library based on info from the AAC file (ADTS/ADIF) */ +long NEAACDECAPI NeAACDecInit(NeAACDecHandle hDecoder, + unsigned char *buffer, + unsigned long buffer_size, + unsigned long *samplerate, + unsigned char *channels); + +/* Init the library using a DecoderSpecificInfo */ +char NEAACDECAPI NeAACDecInit2(NeAACDecHandle hDecoder, unsigned char *pBuffer, + unsigned long SizeOfDecoderSpecificInfo, + unsigned long *samplerate, unsigned char *channels); + +/* Init the library for DRM */ +char NEAACDECAPI NeAACDecInitDRM(NeAACDecHandle *hDecoder, unsigned long samplerate, + unsigned char channels); + +void NEAACDECAPI NeAACDecPostSeekReset(NeAACDecHandle hDecoder, long frame); + +void NEAACDECAPI NeAACDecClose(NeAACDecHandle hDecoder); + +void* NEAACDECAPI NeAACDecDecode(NeAACDecHandle hDecoder, + NeAACDecFrameInfo *hInfo, + unsigned char *buffer, + unsigned long buffer_size); + +void* NEAACDECAPI NeAACDecDecode2(NeAACDecHandle hDecoder, + NeAACDecFrameInfo *hInfo, + unsigned char *buffer, + unsigned long buffer_size, + void **sample_buffer, + unsigned long sample_buffer_size); + +char NEAACDECAPI NeAACDecAudioSpecificConfig(unsigned char *pBuffer, + unsigned long buffer_size, + mp4AudioSpecificConfig *mp4ASC); + +#ifdef _WIN32 + #pragma pack(pop) +#endif + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif diff --git a/Libraries/FAAD2/Files/libfaad/Makefile.am b/Libraries/FAAD2/Files/libfaad/Makefile.am new file mode 100644 index 000000000..7fd0d5c6d --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/Makefile.am @@ -0,0 +1,26 @@ +lib_LTLIBRARIES = libfaad.la + +include_HEADERS = $(top_srcdir)/include/faad.h \ + $(top_srcdir)/include/neaacdec.h + +libfaad_la_LDFLAGS = -lm + +libfaad_la_SOURCES = bits.c cfft.c decoder.c drc.c \ +drm_dec.c error.c filtbank.c \ +ic_predict.c is.c lt_predict.c mdct.c mp4.c ms.c output.c pns.c \ +ps_dec.c ps_syntax.c \ +pulse.c specrec.c syntax.c tns.c hcr.c huffman.c \ +rvlc.c ssr.c ssr_fb.c ssr_ipqf.c common.c \ +sbr_dct.c sbr_e_nf.c sbr_fbt.c sbr_hfadj.c sbr_hfgen.c \ +sbr_huff.c sbr_qmf.c sbr_syntax.c sbr_tf_grid.c sbr_dec.c \ +analysis.h bits.h cfft.h cfft_tab.h common.h \ +decoder.h drc.h drm_dec.h error.h fixed.h filtbank.h \ +huffman.h ic_predict.h iq_table.h is.h kbd_win.h lt_predict.h mdct.h mp4.h \ +ms.h output.h pns.h pulse.h rvlc.h sine_win.h ssr.h ssr_fb.h ssr_ipqf.h \ +ssr_win.h specrec.h syntax.h structs.h tns.h \ +sbr_dct.h sbr_dec.h sbr_e_nf.h sbr_fbt.h sbr_hfadj.h sbr_hfgen.h \ +sbr_huff.h sbr_noise.h sbr_qmf.h sbr_syntax.h sbr_tf_grid.h \ +sbr_qmf_c.h codebook/hcb.h \ +codebook/hcb_1.h codebook/hcb_2.h codebook/hcb_3.h codebook/hcb_4.h \ +codebook/hcb_5.h codebook/hcb_6.h codebook/hcb_7.h codebook/hcb_8.h \ +codebook/hcb_9.h codebook/hcb_10.h codebook/hcb_11.h codebook/hcb_sf.h \ No newline at end of file diff --git a/Libraries/FAAD2/Files/libfaad/analysis.h b/Libraries/FAAD2/Files/libfaad/analysis.h new file mode 100644 index 000000000..f1c3da7a8 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/analysis.h @@ -0,0 +1,49 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#ifndef __ANALYSIS_H__ +#define __ANALYSIS_H__ + +#ifdef __cplusplus +extern "C" { +#endif + + +#ifdef ANALYSIS +#define DEBUGDEC ,uint8_t print,uint16_t var,uint8_t *dbg +#define DEBUGVAR(A,B,C) ,A,B,C +extern uint16_t dbg_count; +#else +#define DEBUGDEC +#define DEBUGVAR(A,B,C) +#endif + + +#ifdef __cplusplus +} +#endif +#endif diff --git a/Libraries/FAAD2/Files/libfaad/bits.c b/Libraries/FAAD2/Files/libfaad/bits.c new file mode 100644 index 000000000..952a4a9df --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/bits.c @@ -0,0 +1,213 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#include "common.h" +#include "structs.h" + +#include +#include +#include "bits.h" + +/* initialize buffer, call once before first getbits or showbits */ +void faad_initbits(bitfile *ld, const void *_buffer, const uint32_t buffer_size) +{ + uint32_t tmp; + + if (ld == NULL) + return; + + memset(ld, 0, sizeof(bitfile)); + + if (buffer_size == 0 || _buffer == NULL) + { + ld->error = 1; + ld->no_more_reading = 1; + return; + } + + ld->buffer = faad_malloc((buffer_size+12)*sizeof(uint8_t)); + memset(ld->buffer, 0, (buffer_size+12)*sizeof(uint8_t)); + memcpy(ld->buffer, _buffer, buffer_size*sizeof(uint8_t)); + + ld->buffer_size = buffer_size; + + tmp = getdword((uint32_t*)ld->buffer); + ld->bufa = tmp; + + tmp = getdword((uint32_t*)ld->buffer + 1); + ld->bufb = tmp; + + ld->start = (uint32_t*)ld->buffer; + ld->tail = ((uint32_t*)ld->buffer + 2); + + ld->bits_left = 32; + + ld->bytes_used = 0; + ld->no_more_reading = 0; + ld->error = 0; +} + +void faad_endbits(bitfile *ld) +{ + if (ld) + { + if (ld->buffer) + { + faad_free(ld->buffer); + ld->buffer = NULL; + } + } +} + +uint32_t faad_get_processed_bits(bitfile *ld) +{ + return (uint32_t)(8 * (4*(ld->tail - ld->start) - 4) - (ld->bits_left)); +} + +uint8_t faad_byte_align(bitfile *ld) +{ + uint8_t remainder = (uint8_t)((32 - ld->bits_left) % 8); + + if (remainder) + { + faad_flushbits(ld, 8 - remainder); + return (8 - remainder); + } + return 0; +} + +void faad_flushbits_ex(bitfile *ld, uint32_t bits) +{ + uint32_t tmp; + + ld->bufa = ld->bufb; + if (ld->no_more_reading == 0) + { + tmp = getdword(ld->tail); + ld->tail++; + } else { + tmp = 0; + } + ld->bufb = tmp; + ld->bits_left += (32 - bits); + ld->bytes_used += 4; + if (ld->bytes_used == ld->buffer_size) + ld->no_more_reading = 1; + if (ld->bytes_used > ld->buffer_size) + ld->error = 1; +} + +/* rewind to beginning */ +void faad_rewindbits(bitfile *ld) +{ + uint32_t tmp; + + tmp = ld->start[0]; +#ifndef ARCH_IS_BIG_ENDIAN + BSWAP(tmp); +#endif + ld->bufa = tmp; + + tmp = ld->start[1]; +#ifndef ARCH_IS_BIG_ENDIAN + BSWAP(tmp); +#endif + ld->bufb = tmp; + ld->bits_left = 32; + ld->tail = &ld->start[2]; + ld->bytes_used = 0; + ld->no_more_reading = 0; +} + +uint8_t *faad_getbitbuffer(bitfile *ld, uint32_t bits + DEBUGDEC) +{ + uint16_t i; + uint8_t temp; + uint16_t bytes = (uint16_t)bits / 8; + uint8_t remainder = (uint8_t)bits % 8; + + uint8_t *buffer = (uint8_t*)faad_malloc((bytes+1)*sizeof(uint8_t)); + + for (i = 0; i < bytes; i++) + { + buffer[i] = (uint8_t)faad_getbits(ld, 8 DEBUGVAR(print,var,dbg)); + } + + if (remainder) + { + temp = (uint8_t)faad_getbits(ld, remainder DEBUGVAR(print,var,dbg)) << (8-remainder); + + buffer[bytes] = temp; + } + + return buffer; +} + +#ifdef DRM +/* return the original data buffer */ +void *faad_origbitbuffer(bitfile *ld) +{ + return (void*)ld->start; +} + +/* return the original data buffer size */ +uint32_t faad_origbitbuffer_size(bitfile *ld) +{ + return ld->buffer_size; +} +#endif + +/* reversed bit reading routines, used for RVLC and HCR */ +void faad_initbits_rev(bitfile *ld, void *buffer, + uint32_t bits_in_buffer) +{ + uint32_t tmp; + int32_t index; + + ld->buffer_size = bit2byte(bits_in_buffer); + + index = (bits_in_buffer+31)/32 - 1; + + ld->start = (uint32_t*)buffer + index - 2; + + tmp = getdword((uint32_t*)buffer + index); + ld->bufa = tmp; + + tmp = getdword((uint32_t*)buffer + index - 1); + ld->bufb = tmp; + + ld->tail = (uint32_t*)buffer + index; + + ld->bits_left = bits_in_buffer % 32; + if (ld->bits_left == 0) + ld->bits_left = 32; + + ld->bytes_used = 0; + ld->no_more_reading = 0; + ld->error = 0; +} diff --git a/Libraries/FAAD2/Files/libfaad/bits.h b/Libraries/FAAD2/Files/libfaad/bits.h new file mode 100644 index 000000000..56d413e0c --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/bits.h @@ -0,0 +1,382 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#ifndef __BITS_H__ +#define __BITS_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "analysis.h" +#ifdef ANALYSIS +#include +#endif + +#define BYTE_NUMBIT 8 +#define bit2byte(a) ((a+7)/BYTE_NUMBIT) + +typedef struct _bitfile +{ + /* bit input */ + uint32_t bufa; + uint32_t bufb; + uint32_t bits_left; + uint32_t buffer_size; /* size of the buffer in bytes */ + uint32_t bytes_used; + uint8_t no_more_reading; + uint8_t error; + uint32_t *tail; + uint32_t *start; + void *buffer; +} bitfile; + + +#if defined (_WIN32) && !defined(_WIN32_WCE) && !defined(__MINGW32__) +#define BSWAP(a) __asm mov eax,a __asm bswap eax __asm mov a, eax +#elif defined(LINUX) || defined(DJGPP) || defined(__MINGW32__) +#define BSWAP(a) __asm__ ( "bswapl %0\n" : "=r" (a) : "0" (a) ) +#else +#define BSWAP(a) \ + ((a) = ( ((a)&0xff)<<24) | (((a)&0xff00)<<8) | (((a)>>8)&0xff00) | (((a)>>24)&0xff)) +#endif + +static uint32_t bitmask[] = { + 0x0, 0x1, 0x3, 0x7, 0xF, 0x1F, 0x3F, 0x7F, 0xFF, 0x1FF, + 0x3FF, 0x7FF, 0xFFF, 0x1FFF, 0x3FFF, 0x7FFF, 0xFFFF, + 0x1FFFF, 0x3FFFF, 0x7FFFF, 0xFFFFF, 0x1FFFFF, 0x3FFFFF, + 0x7FFFFF, 0xFFFFFF, 0x1FFFFFF, 0x3FFFFFF, 0x7FFFFFF, + 0xFFFFFFF, 0x1FFFFFFF, 0x3FFFFFFF, 0x7FFFFFFF + /* added bitmask 32, correct?!?!?! */ + , 0xFFFFFFFF +}; + +void faad_initbits(bitfile *ld, const void *buffer, const uint32_t buffer_size); +void faad_endbits(bitfile *ld); +void faad_initbits_rev(bitfile *ld, void *buffer, + uint32_t bits_in_buffer); +uint8_t faad_byte_align(bitfile *ld); +uint32_t faad_get_processed_bits(bitfile *ld); +void faad_flushbits_ex(bitfile *ld, uint32_t bits); +void faad_rewindbits(bitfile *ld); +uint8_t *faad_getbitbuffer(bitfile *ld, uint32_t bits + DEBUGDEC); +#ifdef DRM +void *faad_origbitbuffer(bitfile *ld); +uint32_t faad_origbitbuffer_size(bitfile *ld); +#endif + +/* circumvent memory alignment errors on ARM */ +static INLINE uint32_t getdword(void *mem) +{ +#ifdef ARM + uint32_t tmp; +#ifndef ARCH_IS_BIG_ENDIAN + ((uint8_t*)&tmp)[0] = ((uint8_t*)mem)[3]; + ((uint8_t*)&tmp)[1] = ((uint8_t*)mem)[2]; + ((uint8_t*)&tmp)[2] = ((uint8_t*)mem)[1]; + ((uint8_t*)&tmp)[3] = ((uint8_t*)mem)[0]; +#else + ((uint8_t*)&tmp)[0] = ((uint8_t*)mem)[0]; + ((uint8_t*)&tmp)[1] = ((uint8_t*)mem)[1]; + ((uint8_t*)&tmp)[2] = ((uint8_t*)mem)[2]; + ((uint8_t*)&tmp)[3] = ((uint8_t*)mem)[3]; +#endif + + return tmp; +#else + uint32_t tmp; + tmp = *(uint32_t*)mem; +#ifndef ARCH_IS_BIG_ENDIAN + BSWAP(tmp); +#endif + return tmp; +#endif +} + +static INLINE uint32_t faad_showbits(bitfile *ld, uint32_t bits) +{ + if (bits <= ld->bits_left) + { + return (ld->bufa >> (ld->bits_left - bits)) & bitmask[bits]; + } + + bits -= ld->bits_left; + return ((ld->bufa & bitmask[ld->bits_left]) << bits) | (ld->bufb >> (32 - bits)); +} + +static INLINE void faad_flushbits(bitfile *ld, uint32_t bits) +{ + /* do nothing if error */ + if (ld->error != 0) + return; + + if (bits < ld->bits_left) + { + ld->bits_left -= bits; + } else { + faad_flushbits_ex(ld, bits); + } +} + +/* return next n bits (right adjusted) */ +static INLINE uint32_t faad_getbits(bitfile *ld, uint32_t n DEBUGDEC) +{ + uint32_t ret; + + if (ld->no_more_reading || n == 0) + return 0; + + ret = faad_showbits(ld, n); + faad_flushbits(ld, n); + +#ifdef ANALYSIS + if (print) + fprintf(stdout, "%4d %2d bits, val: %4d, variable: %d %s\n", dbg_count++, n, ret, var, dbg); +#endif + + return ret; +} + +static INLINE uint8_t faad_get1bit(bitfile *ld DEBUGDEC) +{ + uint8_t r; + + if (ld->bits_left > 0) + { + ld->bits_left--; + r = (uint8_t)((ld->bufa >> ld->bits_left) & 1); + return r; + } + + /* bits_left == 0 */ +#if 0 + r = (uint8_t)(ld->bufb >> 31); + faad_flushbits_ex(ld, 1); +#else + r = (uint8_t)faad_getbits(ld, 1); +#endif + return r; +} + +/* reversed bitreading routines */ +static INLINE uint32_t faad_showbits_rev(bitfile *ld, uint32_t bits) +{ + uint8_t i; + uint32_t B = 0; + + if (bits <= ld->bits_left) + { + for (i = 0; i < bits; i++) + { + if (ld->bufa & (1 << (i + (32 - ld->bits_left)))) + B |= (1 << (bits - i - 1)); + } + return B; + } else { + for (i = 0; i < ld->bits_left; i++) + { + if (ld->bufa & (1 << (i + (32 - ld->bits_left)))) + B |= (1 << (bits - i - 1)); + } + for (i = 0; i < bits - ld->bits_left; i++) + { + if (ld->bufb & (1 << (i + (32-ld->bits_left)))) + B |= (1 << (bits - ld->bits_left - i - 1)); + } + return B; + } +} + +static INLINE void faad_flushbits_rev(bitfile *ld, uint32_t bits) +{ + /* do nothing if error */ + if (ld->error != 0) + return; + + if (bits < ld->bits_left) + { + ld->bits_left -= bits; + } else { + uint32_t tmp; + + ld->bufa = ld->bufb; + tmp = getdword(ld->start); + ld->bufb = tmp; + ld->start--; + ld->bits_left += (32 - bits); + + ld->bytes_used += 4; + if (ld->bytes_used == ld->buffer_size) + ld->no_more_reading = 1; + if (ld->bytes_used > ld->buffer_size) + ld->error = 1; + } +} + +static INLINE uint32_t faad_getbits_rev(bitfile *ld, uint32_t n + DEBUGDEC) +{ + uint32_t ret; + + if (ld->no_more_reading) + return 0; + + if (n == 0) + return 0; + + ret = faad_showbits_rev(ld, n); + faad_flushbits_rev(ld, n); + +#ifdef ANALYSIS + if (print) + fprintf(stdout, "%4d %2d bits, val: %4d, variable: %d %s\n", dbg_count++, n, ret, var, dbg); +#endif + + return ret; +} + +#ifdef DRM +static uint8_t faad_check_CRC(bitfile *ld, uint16_t len) +{ + uint8_t CRC; + uint16_t r=255; /* Initialize to all ones */ + + /* CRC polynome used x^8 + x^4 + x^3 + x^2 +1 */ +#define GPOLY 0435 + + faad_rewindbits(ld); + + CRC = (uint8_t) ~faad_getbits(ld, 8 + DEBUGVAR(1,999,"faad_check_CRC(): CRC")); /* CRC is stored inverted */ + + for (; len>0; len--) + { + r = ( (r << 1) ^ (( ( faad_get1bit(ld + DEBUGVAR(1,998,"")) & 1) ^ ((r >> 7) & 1)) * GPOLY )) & 0xFF; + } + + if (r != CRC) + { + return 8; + } else { + return 0; + } +} + +static uint8_t tabFlipbits[256] = { + 0,128,64,192,32,160,96,224,16,144,80,208,48,176,112,240, + 8,136,72,200,40,168,104,232,24,152,88,216,56,184,120,248, + 4,132,68,196,36,164,100,228,20,148,84,212,52,180,116,244, + 12,140,76,204,44,172,108,236,28,156,92,220,60,188,124,252, + 2,130,66,194,34,162,98,226,18,146,82,210,50,178,114,242, + 10,138,74,202,42,170,106,234,26,154,90,218,58,186,122,250, + 6,134,70,198,38,166,102,230,22,150,86,214,54,182,118,246, + 14,142,78,206,46,174,110,238,30,158,94,222,62,190,126,254, + 1,129,65,193,33,161,97,225,17,145,81,209,49,177,113,241, + 9,137,73,201,41,169,105,233,25,153,89,217,57,185,121,249, + 5,133,69,197,37,165,101,229,21,149,85,213,53,181,117,245, + 13,141,77,205,45,173,109,237,29,157,93,221,61,189,125,253, + 3,131,67,195,35,163,99,227,19,147,83,211,51,179,115,243, + 11,139,75,203,43,171,107,235,27,155,91,219,59,187,123,251, + 7,135,71,199,39,167,103,231,23,151,87,215,55,183,119,247, + 15,143,79,207,47,175,111,239,31,159,95,223,63,191,127,255 +}; +#endif + +#ifdef ERROR_RESILIENCE + +/* Modified bit reading functions for HCR */ + +typedef struct +{ + /* bit input */ + uint32_t bufa; + uint32_t bufb; + int8_t len; +} bits_t; + + +static INLINE uint32_t showbits_hcr(bits_t *ld, uint8_t bits) +{ + if (bits == 0) return 0; + if (ld->len <= 32) + { + /* huffman_spectral_data_2 needs to read more than may be available, bits maybe + > ld->len, deliver 0 than */ + if (ld->len >= bits) + return ((ld->bufa >> (ld->len - bits)) & (0xFFFFFFFF >> (32 - bits))); + else + return ((ld->bufa << (bits - ld->len)) & (0xFFFFFFFF >> (32 - bits))); + } else { + if ((ld->len - bits) < 32) + { + return ( (ld->bufb & (0xFFFFFFFF >> (64 - ld->len))) << (bits - ld->len + 32)) | + (ld->bufa >> (ld->len - bits)); + } else { + return ((ld->bufb >> (ld->len - bits - 32)) & (0xFFFFFFFF >> (32 - bits))); + } + } +} + +/* return 1 if position is outside of buffer, 0 otherwise */ +static INLINE int8_t flushbits_hcr( bits_t *ld, uint8_t bits) +{ + ld->len -= bits; + + if (ld->len <0) + { + ld->len = 0; + return 1; + } else { + return 0; + } +} + +static INLINE int8_t getbits_hcr(bits_t *ld, uint8_t n, uint32_t *result) +{ + *result = showbits_hcr(ld, n); + return flushbits_hcr(ld, n); +} + +static INLINE int8_t get1bit_hcr(bits_t *ld, uint8_t *result) +{ + uint32_t res; + int8_t ret; + + ret = getbits_hcr(ld, 1, &res); + *result = (int8_t)(res & 1); + return ret; +} + +#endif + + +#ifdef __cplusplus +} +#endif +#endif diff --git a/Libraries/FAAD2/Files/libfaad/cfft.c b/Libraries/FAAD2/Files/libfaad/cfft.c new file mode 100644 index 000000000..441cd692d --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/cfft.c @@ -0,0 +1,1002 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +/* + * Algorithmically based on Fortran-77 FFTPACK + * by Paul N. Swarztrauber(Version 4, 1985). + * + * Does even sized fft only + */ + +/* isign is +1 for backward and -1 for forward transforms */ + +#include "common.h" +#include "structs.h" + +#include + +#include "cfft.h" +#include "cfft_tab.h" + + +/* static function declarations */ +static void passf2pos(const uint16_t ido, const uint16_t l1, const complex_t *cc, + complex_t *ch, const complex_t *wa); +static void passf2neg(const uint16_t ido, const uint16_t l1, const complex_t *cc, + complex_t *ch, const complex_t *wa); +static void passf3(const uint16_t ido, const uint16_t l1, const complex_t *cc, + complex_t *ch, const complex_t *wa1, const complex_t *wa2, const int8_t isign); +static void passf4pos(const uint16_t ido, const uint16_t l1, const complex_t *cc, complex_t *ch, + const complex_t *wa1, const complex_t *wa2, const complex_t *wa3); +static void passf4neg(const uint16_t ido, const uint16_t l1, const complex_t *cc, complex_t *ch, + const complex_t *wa1, const complex_t *wa2, const complex_t *wa3); +static void passf5(const uint16_t ido, const uint16_t l1, const complex_t *cc, complex_t *ch, + const complex_t *wa1, const complex_t *wa2, const complex_t *wa3, + const complex_t *wa4, const int8_t isign); +INLINE void cfftf1(uint16_t n, complex_t *c, complex_t *ch, + const uint16_t *ifac, const complex_t *wa, const int8_t isign); +static void cffti1(uint16_t n, complex_t *wa, uint16_t *ifac); + + +/*---------------------------------------------------------------------- + passf2, passf3, passf4, passf5. Complex FFT passes fwd and bwd. + ----------------------------------------------------------------------*/ + +static void passf2pos(const uint16_t ido, const uint16_t l1, const complex_t *cc, + complex_t *ch, const complex_t *wa) +{ + uint16_t i, k, ah, ac; + + if (ido == 1) + { + for (k = 0; k < l1; k++) + { + ah = 2*k; + ac = 4*k; + + RE(ch[ah]) = RE(cc[ac]) + RE(cc[ac+1]); + RE(ch[ah+l1]) = RE(cc[ac]) - RE(cc[ac+1]); + IM(ch[ah]) = IM(cc[ac]) + IM(cc[ac+1]); + IM(ch[ah+l1]) = IM(cc[ac]) - IM(cc[ac+1]); + } + } else { + for (k = 0; k < l1; k++) + { + ah = k*ido; + ac = 2*k*ido; + + for (i = 0; i < ido; i++) + { + complex_t t2; + + RE(ch[ah+i]) = RE(cc[ac+i]) + RE(cc[ac+i+ido]); + RE(t2) = RE(cc[ac+i]) - RE(cc[ac+i+ido]); + + IM(ch[ah+i]) = IM(cc[ac+i]) + IM(cc[ac+i+ido]); + IM(t2) = IM(cc[ac+i]) - IM(cc[ac+i+ido]); + +#if 1 + ComplexMult(&IM(ch[ah+i+l1*ido]), &RE(ch[ah+i+l1*ido]), + IM(t2), RE(t2), RE(wa[i]), IM(wa[i])); +#else + ComplexMult(&RE(ch[ah+i+l1*ido]), &IM(ch[ah+i+l1*ido]), + RE(t2), IM(t2), RE(wa[i]), IM(wa[i])); +#endif + } + } + } +} + +static void passf2neg(const uint16_t ido, const uint16_t l1, const complex_t *cc, + complex_t *ch, const complex_t *wa) +{ + uint16_t i, k, ah, ac; + + if (ido == 1) + { + for (k = 0; k < l1; k++) + { + ah = 2*k; + ac = 4*k; + + RE(ch[ah]) = RE(cc[ac]) + RE(cc[ac+1]); + RE(ch[ah+l1]) = RE(cc[ac]) - RE(cc[ac+1]); + IM(ch[ah]) = IM(cc[ac]) + IM(cc[ac+1]); + IM(ch[ah+l1]) = IM(cc[ac]) - IM(cc[ac+1]); + } + } else { + for (k = 0; k < l1; k++) + { + ah = k*ido; + ac = 2*k*ido; + + for (i = 0; i < ido; i++) + { + complex_t t2; + + RE(ch[ah+i]) = RE(cc[ac+i]) + RE(cc[ac+i+ido]); + RE(t2) = RE(cc[ac+i]) - RE(cc[ac+i+ido]); + + IM(ch[ah+i]) = IM(cc[ac+i]) + IM(cc[ac+i+ido]); + IM(t2) = IM(cc[ac+i]) - IM(cc[ac+i+ido]); + +#if 1 + ComplexMult(&RE(ch[ah+i+l1*ido]), &IM(ch[ah+i+l1*ido]), + RE(t2), IM(t2), RE(wa[i]), IM(wa[i])); +#else + ComplexMult(&IM(ch[ah+i+l1*ido]), &RE(ch[ah+i+l1*ido]), + IM(t2), RE(t2), RE(wa[i]), IM(wa[i])); +#endif + } + } + } +} + + +static void passf3(const uint16_t ido, const uint16_t l1, const complex_t *cc, + complex_t *ch, const complex_t *wa1, const complex_t *wa2, + const int8_t isign) +{ + static real_t taur = FRAC_CONST(-0.5); + static real_t taui = FRAC_CONST(0.866025403784439); + uint16_t i, k, ac, ah; + complex_t c2, c3, d2, d3, t2; + + if (ido == 1) + { + if (isign == 1) + { + for (k = 0; k < l1; k++) + { + ac = 3*k+1; + ah = k; + + RE(t2) = RE(cc[ac]) + RE(cc[ac+1]); + IM(t2) = IM(cc[ac]) + IM(cc[ac+1]); + RE(c2) = RE(cc[ac-1]) + MUL_F(RE(t2),taur); + IM(c2) = IM(cc[ac-1]) + MUL_F(IM(t2),taur); + + RE(ch[ah]) = RE(cc[ac-1]) + RE(t2); + IM(ch[ah]) = IM(cc[ac-1]) + IM(t2); + + RE(c3) = MUL_F((RE(cc[ac]) - RE(cc[ac+1])), taui); + IM(c3) = MUL_F((IM(cc[ac]) - IM(cc[ac+1])), taui); + + RE(ch[ah+l1]) = RE(c2) - IM(c3); + IM(ch[ah+l1]) = IM(c2) + RE(c3); + RE(ch[ah+2*l1]) = RE(c2) + IM(c3); + IM(ch[ah+2*l1]) = IM(c2) - RE(c3); + } + } else { + for (k = 0; k < l1; k++) + { + ac = 3*k+1; + ah = k; + + RE(t2) = RE(cc[ac]) + RE(cc[ac+1]); + IM(t2) = IM(cc[ac]) + IM(cc[ac+1]); + RE(c2) = RE(cc[ac-1]) + MUL_F(RE(t2),taur); + IM(c2) = IM(cc[ac-1]) + MUL_F(IM(t2),taur); + + RE(ch[ah]) = RE(cc[ac-1]) + RE(t2); + IM(ch[ah]) = IM(cc[ac-1]) + IM(t2); + + RE(c3) = MUL_F((RE(cc[ac]) - RE(cc[ac+1])), taui); + IM(c3) = MUL_F((IM(cc[ac]) - IM(cc[ac+1])), taui); + + RE(ch[ah+l1]) = RE(c2) + IM(c3); + IM(ch[ah+l1]) = IM(c2) - RE(c3); + RE(ch[ah+2*l1]) = RE(c2) - IM(c3); + IM(ch[ah+2*l1]) = IM(c2) + RE(c3); + } + } + } else { + if (isign == 1) + { + for (k = 0; k < l1; k++) + { + for (i = 0; i < ido; i++) + { + ac = i + (3*k+1)*ido; + ah = i + k * ido; + + RE(t2) = RE(cc[ac]) + RE(cc[ac+ido]); + RE(c2) = RE(cc[ac-ido]) + MUL_F(RE(t2),taur); + IM(t2) = IM(cc[ac]) + IM(cc[ac+ido]); + IM(c2) = IM(cc[ac-ido]) + MUL_F(IM(t2),taur); + + RE(ch[ah]) = RE(cc[ac-ido]) + RE(t2); + IM(ch[ah]) = IM(cc[ac-ido]) + IM(t2); + + RE(c3) = MUL_F((RE(cc[ac]) - RE(cc[ac+ido])), taui); + IM(c3) = MUL_F((IM(cc[ac]) - IM(cc[ac+ido])), taui); + + RE(d2) = RE(c2) - IM(c3); + IM(d3) = IM(c2) - RE(c3); + RE(d3) = RE(c2) + IM(c3); + IM(d2) = IM(c2) + RE(c3); + +#if 1 + ComplexMult(&IM(ch[ah+l1*ido]), &RE(ch[ah+l1*ido]), + IM(d2), RE(d2), RE(wa1[i]), IM(wa1[i])); + ComplexMult(&IM(ch[ah+2*l1*ido]), &RE(ch[ah+2*l1*ido]), + IM(d3), RE(d3), RE(wa2[i]), IM(wa2[i])); +#else + ComplexMult(&RE(ch[ah+l1*ido]), &IM(ch[ah+l1*ido]), + RE(d2), IM(d2), RE(wa1[i]), IM(wa1[i])); + ComplexMult(&RE(ch[ah+2*l1*ido]), &IM(ch[ah+2*l1*ido]), + RE(d3), IM(d3), RE(wa2[i]), IM(wa2[i])); +#endif + } + } + } else { + for (k = 0; k < l1; k++) + { + for (i = 0; i < ido; i++) + { + ac = i + (3*k+1)*ido; + ah = i + k * ido; + + RE(t2) = RE(cc[ac]) + RE(cc[ac+ido]); + RE(c2) = RE(cc[ac-ido]) + MUL_F(RE(t2),taur); + IM(t2) = IM(cc[ac]) + IM(cc[ac+ido]); + IM(c2) = IM(cc[ac-ido]) + MUL_F(IM(t2),taur); + + RE(ch[ah]) = RE(cc[ac-ido]) + RE(t2); + IM(ch[ah]) = IM(cc[ac-ido]) + IM(t2); + + RE(c3) = MUL_F((RE(cc[ac]) - RE(cc[ac+ido])), taui); + IM(c3) = MUL_F((IM(cc[ac]) - IM(cc[ac+ido])), taui); + + RE(d2) = RE(c2) + IM(c3); + IM(d3) = IM(c2) + RE(c3); + RE(d3) = RE(c2) - IM(c3); + IM(d2) = IM(c2) - RE(c3); + +#if 1 + ComplexMult(&RE(ch[ah+l1*ido]), &IM(ch[ah+l1*ido]), + RE(d2), IM(d2), RE(wa1[i]), IM(wa1[i])); + ComplexMult(&RE(ch[ah+2*l1*ido]), &IM(ch[ah+2*l1*ido]), + RE(d3), IM(d3), RE(wa2[i]), IM(wa2[i])); +#else + ComplexMult(&IM(ch[ah+l1*ido]), &RE(ch[ah+l1*ido]), + IM(d2), RE(d2), RE(wa1[i]), IM(wa1[i])); + ComplexMult(&IM(ch[ah+2*l1*ido]), &RE(ch[ah+2*l1*ido]), + IM(d3), RE(d3), RE(wa2[i]), IM(wa2[i])); +#endif + } + } + } + } +} + + +static void passf4pos(const uint16_t ido, const uint16_t l1, const complex_t *cc, + complex_t *ch, const complex_t *wa1, const complex_t *wa2, + const complex_t *wa3) +{ + uint16_t i, k, ac, ah; + + if (ido == 1) + { + for (k = 0; k < l1; k++) + { + complex_t t1, t2, t3, t4; + + ac = 4*k; + ah = k; + + RE(t2) = RE(cc[ac]) + RE(cc[ac+2]); + RE(t1) = RE(cc[ac]) - RE(cc[ac+2]); + IM(t2) = IM(cc[ac]) + IM(cc[ac+2]); + IM(t1) = IM(cc[ac]) - IM(cc[ac+2]); + RE(t3) = RE(cc[ac+1]) + RE(cc[ac+3]); + IM(t4) = RE(cc[ac+1]) - RE(cc[ac+3]); + IM(t3) = IM(cc[ac+3]) + IM(cc[ac+1]); + RE(t4) = IM(cc[ac+3]) - IM(cc[ac+1]); + + RE(ch[ah]) = RE(t2) + RE(t3); + RE(ch[ah+2*l1]) = RE(t2) - RE(t3); + + IM(ch[ah]) = IM(t2) + IM(t3); + IM(ch[ah+2*l1]) = IM(t2) - IM(t3); + + RE(ch[ah+l1]) = RE(t1) + RE(t4); + RE(ch[ah+3*l1]) = RE(t1) - RE(t4); + + IM(ch[ah+l1]) = IM(t1) + IM(t4); + IM(ch[ah+3*l1]) = IM(t1) - IM(t4); + } + } else { + for (k = 0; k < l1; k++) + { + ac = 4*k*ido; + ah = k*ido; + + for (i = 0; i < ido; i++) + { + complex_t c2, c3, c4, t1, t2, t3, t4; + + RE(t2) = RE(cc[ac+i]) + RE(cc[ac+i+2*ido]); + RE(t1) = RE(cc[ac+i]) - RE(cc[ac+i+2*ido]); + IM(t2) = IM(cc[ac+i]) + IM(cc[ac+i+2*ido]); + IM(t1) = IM(cc[ac+i]) - IM(cc[ac+i+2*ido]); + RE(t3) = RE(cc[ac+i+ido]) + RE(cc[ac+i+3*ido]); + IM(t4) = RE(cc[ac+i+ido]) - RE(cc[ac+i+3*ido]); + IM(t3) = IM(cc[ac+i+3*ido]) + IM(cc[ac+i+ido]); + RE(t4) = IM(cc[ac+i+3*ido]) - IM(cc[ac+i+ido]); + + RE(c2) = RE(t1) + RE(t4); + RE(c4) = RE(t1) - RE(t4); + + IM(c2) = IM(t1) + IM(t4); + IM(c4) = IM(t1) - IM(t4); + + RE(ch[ah+i]) = RE(t2) + RE(t3); + RE(c3) = RE(t2) - RE(t3); + + IM(ch[ah+i]) = IM(t2) + IM(t3); + IM(c3) = IM(t2) - IM(t3); + +#if 1 + ComplexMult(&IM(ch[ah+i+l1*ido]), &RE(ch[ah+i+l1*ido]), + IM(c2), RE(c2), RE(wa1[i]), IM(wa1[i])); + ComplexMult(&IM(ch[ah+i+2*l1*ido]), &RE(ch[ah+i+2*l1*ido]), + IM(c3), RE(c3), RE(wa2[i]), IM(wa2[i])); + ComplexMult(&IM(ch[ah+i+3*l1*ido]), &RE(ch[ah+i+3*l1*ido]), + IM(c4), RE(c4), RE(wa3[i]), IM(wa3[i])); +#else + ComplexMult(&RE(ch[ah+i+l1*ido]), &IM(ch[ah+i+l1*ido]), + RE(c2), IM(c2), RE(wa1[i]), IM(wa1[i])); + ComplexMult(&RE(ch[ah+i+2*l1*ido]), &IM(ch[ah+i+2*l1*ido]), + RE(c3), IM(c3), RE(wa2[i]), IM(wa2[i])); + ComplexMult(&RE(ch[ah+i+3*l1*ido]), &IM(ch[ah+i+3*l1*ido]), + RE(c4), IM(c4), RE(wa3[i]), IM(wa3[i])); +#endif + } + } + } +} + +static void passf4neg(const uint16_t ido, const uint16_t l1, const complex_t *cc, + complex_t *ch, const complex_t *wa1, const complex_t *wa2, + const complex_t *wa3) +{ + uint16_t i, k, ac, ah; + + if (ido == 1) + { + for (k = 0; k < l1; k++) + { + complex_t t1, t2, t3, t4; + + ac = 4*k; + ah = k; + + RE(t2) = RE(cc[ac]) + RE(cc[ac+2]); + RE(t1) = RE(cc[ac]) - RE(cc[ac+2]); + IM(t2) = IM(cc[ac]) + IM(cc[ac+2]); + IM(t1) = IM(cc[ac]) - IM(cc[ac+2]); + RE(t3) = RE(cc[ac+1]) + RE(cc[ac+3]); + IM(t4) = RE(cc[ac+1]) - RE(cc[ac+3]); + IM(t3) = IM(cc[ac+3]) + IM(cc[ac+1]); + RE(t4) = IM(cc[ac+3]) - IM(cc[ac+1]); + + RE(ch[ah]) = RE(t2) + RE(t3); + RE(ch[ah+2*l1]) = RE(t2) - RE(t3); + + IM(ch[ah]) = IM(t2) + IM(t3); + IM(ch[ah+2*l1]) = IM(t2) - IM(t3); + + RE(ch[ah+l1]) = RE(t1) - RE(t4); + RE(ch[ah+3*l1]) = RE(t1) + RE(t4); + + IM(ch[ah+l1]) = IM(t1) - IM(t4); + IM(ch[ah+3*l1]) = IM(t1) + IM(t4); + } + } else { + for (k = 0; k < l1; k++) + { + ac = 4*k*ido; + ah = k*ido; + + for (i = 0; i < ido; i++) + { + complex_t c2, c3, c4, t1, t2, t3, t4; + + RE(t2) = RE(cc[ac+i]) + RE(cc[ac+i+2*ido]); + RE(t1) = RE(cc[ac+i]) - RE(cc[ac+i+2*ido]); + IM(t2) = IM(cc[ac+i]) + IM(cc[ac+i+2*ido]); + IM(t1) = IM(cc[ac+i]) - IM(cc[ac+i+2*ido]); + RE(t3) = RE(cc[ac+i+ido]) + RE(cc[ac+i+3*ido]); + IM(t4) = RE(cc[ac+i+ido]) - RE(cc[ac+i+3*ido]); + IM(t3) = IM(cc[ac+i+3*ido]) + IM(cc[ac+i+ido]); + RE(t4) = IM(cc[ac+i+3*ido]) - IM(cc[ac+i+ido]); + + RE(c2) = RE(t1) - RE(t4); + RE(c4) = RE(t1) + RE(t4); + + IM(c2) = IM(t1) - IM(t4); + IM(c4) = IM(t1) + IM(t4); + + RE(ch[ah+i]) = RE(t2) + RE(t3); + RE(c3) = RE(t2) - RE(t3); + + IM(ch[ah+i]) = IM(t2) + IM(t3); + IM(c3) = IM(t2) - IM(t3); + +#if 1 + ComplexMult(&RE(ch[ah+i+l1*ido]), &IM(ch[ah+i+l1*ido]), + RE(c2), IM(c2), RE(wa1[i]), IM(wa1[i])); + ComplexMult(&RE(ch[ah+i+2*l1*ido]), &IM(ch[ah+i+2*l1*ido]), + RE(c3), IM(c3), RE(wa2[i]), IM(wa2[i])); + ComplexMult(&RE(ch[ah+i+3*l1*ido]), &IM(ch[ah+i+3*l1*ido]), + RE(c4), IM(c4), RE(wa3[i]), IM(wa3[i])); +#else + ComplexMult(&IM(ch[ah+i+l1*ido]), &RE(ch[ah+i+l1*ido]), + IM(c2), RE(c2), RE(wa1[i]), IM(wa1[i])); + ComplexMult(&IM(ch[ah+i+2*l1*ido]), &RE(ch[ah+i+2*l1*ido]), + IM(c3), RE(c3), RE(wa2[i]), IM(wa2[i])); + ComplexMult(&IM(ch[ah+i+3*l1*ido]), &RE(ch[ah+i+3*l1*ido]), + IM(c4), RE(c4), RE(wa3[i]), IM(wa3[i])); +#endif + } + } + } +} + +static void passf5(const uint16_t ido, const uint16_t l1, const complex_t *cc, + complex_t *ch, const complex_t *wa1, const complex_t *wa2, const complex_t *wa3, + const complex_t *wa4, const int8_t isign) +{ + static real_t tr11 = FRAC_CONST(0.309016994374947); + static real_t ti11 = FRAC_CONST(0.951056516295154); + static real_t tr12 = FRAC_CONST(-0.809016994374947); + static real_t ti12 = FRAC_CONST(0.587785252292473); + uint16_t i, k, ac, ah; + complex_t c2, c3, c4, c5, d3, d4, d5, d2, t2, t3, t4, t5; + + if (ido == 1) + { + if (isign == 1) + { + for (k = 0; k < l1; k++) + { + ac = 5*k + 1; + ah = k; + + RE(t2) = RE(cc[ac]) + RE(cc[ac+3]); + IM(t2) = IM(cc[ac]) + IM(cc[ac+3]); + RE(t3) = RE(cc[ac+1]) + RE(cc[ac+2]); + IM(t3) = IM(cc[ac+1]) + IM(cc[ac+2]); + RE(t4) = RE(cc[ac+1]) - RE(cc[ac+2]); + IM(t4) = IM(cc[ac+1]) - IM(cc[ac+2]); + RE(t5) = RE(cc[ac]) - RE(cc[ac+3]); + IM(t5) = IM(cc[ac]) - IM(cc[ac+3]); + + RE(ch[ah]) = RE(cc[ac-1]) + RE(t2) + RE(t3); + IM(ch[ah]) = IM(cc[ac-1]) + IM(t2) + IM(t3); + + RE(c2) = RE(cc[ac-1]) + MUL_F(RE(t2),tr11) + MUL_F(RE(t3),tr12); + IM(c2) = IM(cc[ac-1]) + MUL_F(IM(t2),tr11) + MUL_F(IM(t3),tr12); + RE(c3) = RE(cc[ac-1]) + MUL_F(RE(t2),tr12) + MUL_F(RE(t3),tr11); + IM(c3) = IM(cc[ac-1]) + MUL_F(IM(t2),tr12) + MUL_F(IM(t3),tr11); + + ComplexMult(&RE(c5), &RE(c4), + ti11, ti12, RE(t5), RE(t4)); + ComplexMult(&IM(c5), &IM(c4), + ti11, ti12, IM(t5), IM(t4)); + + RE(ch[ah+l1]) = RE(c2) - IM(c5); + IM(ch[ah+l1]) = IM(c2) + RE(c5); + RE(ch[ah+2*l1]) = RE(c3) - IM(c4); + IM(ch[ah+2*l1]) = IM(c3) + RE(c4); + RE(ch[ah+3*l1]) = RE(c3) + IM(c4); + IM(ch[ah+3*l1]) = IM(c3) - RE(c4); + RE(ch[ah+4*l1]) = RE(c2) + IM(c5); + IM(ch[ah+4*l1]) = IM(c2) - RE(c5); + } + } else { + for (k = 0; k < l1; k++) + { + ac = 5*k + 1; + ah = k; + + RE(t2) = RE(cc[ac]) + RE(cc[ac+3]); + IM(t2) = IM(cc[ac]) + IM(cc[ac+3]); + RE(t3) = RE(cc[ac+1]) + RE(cc[ac+2]); + IM(t3) = IM(cc[ac+1]) + IM(cc[ac+2]); + RE(t4) = RE(cc[ac+1]) - RE(cc[ac+2]); + IM(t4) = IM(cc[ac+1]) - IM(cc[ac+2]); + RE(t5) = RE(cc[ac]) - RE(cc[ac+3]); + IM(t5) = IM(cc[ac]) - IM(cc[ac+3]); + + RE(ch[ah]) = RE(cc[ac-1]) + RE(t2) + RE(t3); + IM(ch[ah]) = IM(cc[ac-1]) + IM(t2) + IM(t3); + + RE(c2) = RE(cc[ac-1]) + MUL_F(RE(t2),tr11) + MUL_F(RE(t3),tr12); + IM(c2) = IM(cc[ac-1]) + MUL_F(IM(t2),tr11) + MUL_F(IM(t3),tr12); + RE(c3) = RE(cc[ac-1]) + MUL_F(RE(t2),tr12) + MUL_F(RE(t3),tr11); + IM(c3) = IM(cc[ac-1]) + MUL_F(IM(t2),tr12) + MUL_F(IM(t3),tr11); + + ComplexMult(&RE(c4), &RE(c5), + ti12, ti11, RE(t5), RE(t4)); + ComplexMult(&IM(c4), &IM(c5), + ti12, ti12, IM(t5), IM(t4)); + + RE(ch[ah+l1]) = RE(c2) + IM(c5); + IM(ch[ah+l1]) = IM(c2) - RE(c5); + RE(ch[ah+2*l1]) = RE(c3) + IM(c4); + IM(ch[ah+2*l1]) = IM(c3) - RE(c4); + RE(ch[ah+3*l1]) = RE(c3) - IM(c4); + IM(ch[ah+3*l1]) = IM(c3) + RE(c4); + RE(ch[ah+4*l1]) = RE(c2) - IM(c5); + IM(ch[ah+4*l1]) = IM(c2) + RE(c5); + } + } + } else { + if (isign == 1) + { + for (k = 0; k < l1; k++) + { + for (i = 0; i < ido; i++) + { + ac = i + (k*5 + 1) * ido; + ah = i + k * ido; + + RE(t2) = RE(cc[ac]) + RE(cc[ac+3*ido]); + IM(t2) = IM(cc[ac]) + IM(cc[ac+3*ido]); + RE(t3) = RE(cc[ac+ido]) + RE(cc[ac+2*ido]); + IM(t3) = IM(cc[ac+ido]) + IM(cc[ac+2*ido]); + RE(t4) = RE(cc[ac+ido]) - RE(cc[ac+2*ido]); + IM(t4) = IM(cc[ac+ido]) - IM(cc[ac+2*ido]); + RE(t5) = RE(cc[ac]) - RE(cc[ac+3*ido]); + IM(t5) = IM(cc[ac]) - IM(cc[ac+3*ido]); + + RE(ch[ah]) = RE(cc[ac-ido]) + RE(t2) + RE(t3); + IM(ch[ah]) = IM(cc[ac-ido]) + IM(t2) + IM(t3); + + RE(c2) = RE(cc[ac-ido]) + MUL_F(RE(t2),tr11) + MUL_F(RE(t3),tr12); + IM(c2) = IM(cc[ac-ido]) + MUL_F(IM(t2),tr11) + MUL_F(IM(t3),tr12); + RE(c3) = RE(cc[ac-ido]) + MUL_F(RE(t2),tr12) + MUL_F(RE(t3),tr11); + IM(c3) = IM(cc[ac-ido]) + MUL_F(IM(t2),tr12) + MUL_F(IM(t3),tr11); + + ComplexMult(&RE(c5), &RE(c4), + ti11, ti12, RE(t5), RE(t4)); + ComplexMult(&IM(c5), &IM(c4), + ti11, ti12, IM(t5), IM(t4)); + + IM(d2) = IM(c2) + RE(c5); + IM(d3) = IM(c3) + RE(c4); + RE(d4) = RE(c3) + IM(c4); + RE(d5) = RE(c2) + IM(c5); + RE(d2) = RE(c2) - IM(c5); + IM(d5) = IM(c2) - RE(c5); + RE(d3) = RE(c3) - IM(c4); + IM(d4) = IM(c3) - RE(c4); + +#if 1 + ComplexMult(&IM(ch[ah+l1*ido]), &RE(ch[ah+l1*ido]), + IM(d2), RE(d2), RE(wa1[i]), IM(wa1[i])); + ComplexMult(&IM(ch[ah+2*l1*ido]), &RE(ch[ah+2*l1*ido]), + IM(d3), RE(d3), RE(wa2[i]), IM(wa2[i])); + ComplexMult(&IM(ch[ah+3*l1*ido]), &RE(ch[ah+3*l1*ido]), + IM(d4), RE(d4), RE(wa3[i]), IM(wa3[i])); + ComplexMult(&IM(ch[ah+4*l1*ido]), &RE(ch[ah+4*l1*ido]), + IM(d5), RE(d5), RE(wa4[i]), IM(wa4[i])); +#else + ComplexMult(&RE(ch[ah+l1*ido]), &IM(ch[ah+l1*ido]), + RE(d2), IM(d2), RE(wa1[i]), IM(wa1[i])); + ComplexMult(&RE(ch[ah+2*l1*ido]), &IM(ch[ah+2*l1*ido]), + RE(d3), IM(d3), RE(wa2[i]), IM(wa2[i])); + ComplexMult(&RE(ch[ah+3*l1*ido]), &IM(ch[ah+3*l1*ido]), + RE(d4), IM(d4), RE(wa3[i]), IM(wa3[i])); + ComplexMult(&RE(ch[ah+4*l1*ido]), &IM(ch[ah+4*l1*ido]), + RE(d5), IM(d5), RE(wa4[i]), IM(wa4[i])); +#endif + } + } + } else { + for (k = 0; k < l1; k++) + { + for (i = 0; i < ido; i++) + { + ac = i + (k*5 + 1) * ido; + ah = i + k * ido; + + RE(t2) = RE(cc[ac]) + RE(cc[ac+3*ido]); + IM(t2) = IM(cc[ac]) + IM(cc[ac+3*ido]); + RE(t3) = RE(cc[ac+ido]) + RE(cc[ac+2*ido]); + IM(t3) = IM(cc[ac+ido]) + IM(cc[ac+2*ido]); + RE(t4) = RE(cc[ac+ido]) - RE(cc[ac+2*ido]); + IM(t4) = IM(cc[ac+ido]) - IM(cc[ac+2*ido]); + RE(t5) = RE(cc[ac]) - RE(cc[ac+3*ido]); + IM(t5) = IM(cc[ac]) - IM(cc[ac+3*ido]); + + RE(ch[ah]) = RE(cc[ac-ido]) + RE(t2) + RE(t3); + IM(ch[ah]) = IM(cc[ac-ido]) + IM(t2) + IM(t3); + + RE(c2) = RE(cc[ac-ido]) + MUL_F(RE(t2),tr11) + MUL_F(RE(t3),tr12); + IM(c2) = IM(cc[ac-ido]) + MUL_F(IM(t2),tr11) + MUL_F(IM(t3),tr12); + RE(c3) = RE(cc[ac-ido]) + MUL_F(RE(t2),tr12) + MUL_F(RE(t3),tr11); + IM(c3) = IM(cc[ac-ido]) + MUL_F(IM(t2),tr12) + MUL_F(IM(t3),tr11); + + ComplexMult(&RE(c4), &RE(c5), + ti12, ti11, RE(t5), RE(t4)); + ComplexMult(&IM(c4), &IM(c5), + ti12, ti12, IM(t5), IM(t4)); + + IM(d2) = IM(c2) - RE(c5); + IM(d3) = IM(c3) - RE(c4); + RE(d4) = RE(c3) - IM(c4); + RE(d5) = RE(c2) - IM(c5); + RE(d2) = RE(c2) + IM(c5); + IM(d5) = IM(c2) + RE(c5); + RE(d3) = RE(c3) + IM(c4); + IM(d4) = IM(c3) + RE(c4); + +#if 1 + ComplexMult(&RE(ch[ah+l1*ido]), &IM(ch[ah+l1*ido]), + RE(d2), IM(d2), RE(wa1[i]), IM(wa1[i])); + ComplexMult(&RE(ch[ah+2*l1*ido]), &IM(ch[ah+2*l1*ido]), + RE(d3), IM(d3), RE(wa2[i]), IM(wa2[i])); + ComplexMult(&RE(ch[ah+3*l1*ido]), &IM(ch[ah+3*l1*ido]), + RE(d4), IM(d4), RE(wa3[i]), IM(wa3[i])); + ComplexMult(&RE(ch[ah+4*l1*ido]), &IM(ch[ah+4*l1*ido]), + RE(d5), IM(d5), RE(wa4[i]), IM(wa4[i])); +#else + ComplexMult(&IM(ch[ah+l1*ido]), &RE(ch[ah+l1*ido]), + IM(d2), RE(d2), RE(wa1[i]), IM(wa1[i])); + ComplexMult(&IM(ch[ah+2*l1*ido]), &RE(ch[ah+2*l1*ido]), + IM(d3), RE(d3), RE(wa2[i]), IM(wa2[i])); + ComplexMult(&IM(ch[ah+3*l1*ido]), &RE(ch[ah+3*l1*ido]), + IM(d4), RE(d4), RE(wa3[i]), IM(wa3[i])); + ComplexMult(&IM(ch[ah+4*l1*ido]), &RE(ch[ah+4*l1*ido]), + IM(d5), RE(d5), RE(wa4[i]), IM(wa4[i])); +#endif + } + } + } + } +} + + +/*---------------------------------------------------------------------- + cfftf1, cfftf, cfftb, cffti1, cffti. Complex FFTs. + ----------------------------------------------------------------------*/ + +static INLINE void cfftf1pos(uint16_t n, complex_t *c, complex_t *ch, + const uint16_t *ifac, const complex_t *wa, + const int8_t isign) +{ + uint16_t i; + uint16_t k1, l1, l2; + uint16_t na, nf, ip, iw, ix2, ix3, ix4, ido, idl1; + + nf = ifac[1]; + na = 0; + l1 = 1; + iw = 0; + + for (k1 = 2; k1 <= nf+1; k1++) + { + ip = ifac[k1]; + l2 = ip*l1; + ido = n / l2; + idl1 = ido*l1; + + switch (ip) + { + case 4: + ix2 = iw + ido; + ix3 = ix2 + ido; + + if (na == 0) + passf4pos((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)c, ch, &wa[iw], &wa[ix2], &wa[ix3]); + else + passf4pos((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)ch, c, &wa[iw], &wa[ix2], &wa[ix3]); + + na = 1 - na; + break; + case 2: + if (na == 0) + passf2pos((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)c, ch, &wa[iw]); + else + passf2pos((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)ch, c, &wa[iw]); + + na = 1 - na; + break; + case 3: + ix2 = iw + ido; + + if (na == 0) + passf3((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)c, ch, &wa[iw], &wa[ix2], isign); + else + passf3((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)ch, c, &wa[iw], &wa[ix2], isign); + + na = 1 - na; + break; + case 5: + ix2 = iw + ido; + ix3 = ix2 + ido; + ix4 = ix3 + ido; + + if (na == 0) + passf5((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)c, ch, &wa[iw], &wa[ix2], &wa[ix3], &wa[ix4], isign); + else + passf5((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)ch, c, &wa[iw], &wa[ix2], &wa[ix3], &wa[ix4], isign); + + na = 1 - na; + break; + } + + l1 = l2; + iw += (ip-1) * ido; + } + + if (na == 0) + return; + + for (i = 0; i < n; i++) + { + RE(c[i]) = RE(ch[i]); + IM(c[i]) = IM(ch[i]); + } +} + +static INLINE void cfftf1neg(uint16_t n, complex_t *c, complex_t *ch, + const uint16_t *ifac, const complex_t *wa, + const int8_t isign) +{ + uint16_t i; + uint16_t k1, l1, l2; + uint16_t na, nf, ip, iw, ix2, ix3, ix4, ido, idl1; + + nf = ifac[1]; + na = 0; + l1 = 1; + iw = 0; + + for (k1 = 2; k1 <= nf+1; k1++) + { + ip = ifac[k1]; + l2 = ip*l1; + ido = n / l2; + idl1 = ido*l1; + + switch (ip) + { + case 4: + ix2 = iw + ido; + ix3 = ix2 + ido; + + if (na == 0) + passf4neg((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)c, ch, &wa[iw], &wa[ix2], &wa[ix3]); + else + passf4neg((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)ch, c, &wa[iw], &wa[ix2], &wa[ix3]); + + na = 1 - na; + break; + case 2: + if (na == 0) + passf2neg((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)c, ch, &wa[iw]); + else + passf2neg((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)ch, c, &wa[iw]); + + na = 1 - na; + break; + case 3: + ix2 = iw + ido; + + if (na == 0) + passf3((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)c, ch, &wa[iw], &wa[ix2], isign); + else + passf3((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)ch, c, &wa[iw], &wa[ix2], isign); + + na = 1 - na; + break; + case 5: + ix2 = iw + ido; + ix3 = ix2 + ido; + ix4 = ix3 + ido; + + if (na == 0) + passf5((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)c, ch, &wa[iw], &wa[ix2], &wa[ix3], &wa[ix4], isign); + else + passf5((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)ch, c, &wa[iw], &wa[ix2], &wa[ix3], &wa[ix4], isign); + + na = 1 - na; + break; + } + + l1 = l2; + iw += (ip-1) * ido; + } + + if (na == 0) + return; + + for (i = 0; i < n; i++) + { + RE(c[i]) = RE(ch[i]); + IM(c[i]) = IM(ch[i]); + } +} + +void cfftf(cfft_info *cfft, complex_t *c) +{ + cfftf1neg(cfft->n, c, cfft->work, (const uint16_t*)cfft->ifac, (const complex_t*)cfft->tab, -1); +} + +void cfftb(cfft_info *cfft, complex_t *c) +{ + cfftf1pos(cfft->n, c, cfft->work, (const uint16_t*)cfft->ifac, (const complex_t*)cfft->tab, +1); +} + +static void cffti1(uint16_t n, complex_t *wa, uint16_t *ifac) +{ + static uint16_t ntryh[4] = {3, 4, 2, 5}; +#ifndef FIXED_POINT + real_t arg, argh, argld, fi; + uint16_t ido, ipm; + uint16_t i1, k1, l1, l2; + uint16_t ld, ii, ip; +#endif + uint16_t ntry = 0, i, j; + uint16_t ib; + uint16_t nf, nl, nq, nr; + + nl = n; + nf = 0; + j = 0; + +startloop: + j++; + + if (j <= 4) + ntry = ntryh[j-1]; + else + ntry += 2; + + do + { + nq = nl / ntry; + nr = nl - ntry*nq; + + if (nr != 0) + goto startloop; + + nf++; + ifac[nf+1] = ntry; + nl = nq; + + if (ntry == 2 && nf != 1) + { + for (i = 2; i <= nf; i++) + { + ib = nf - i + 2; + ifac[ib+1] = ifac[ib]; + } + ifac[2] = 2; + } + } while (nl != 1); + + ifac[0] = n; + ifac[1] = nf; + +#ifndef FIXED_POINT + argh = (real_t)2.0*(real_t)M_PI / (real_t)n; + i = 0; + l1 = 1; + + for (k1 = 1; k1 <= nf; k1++) + { + ip = ifac[k1+1]; + ld = 0; + l2 = l1*ip; + ido = n / l2; + ipm = ip - 1; + + for (j = 0; j < ipm; j++) + { + i1 = i; + RE(wa[i]) = 1.0; + IM(wa[i]) = 0.0; + ld += l1; + fi = 0; + argld = ld*argh; + + for (ii = 0; ii < ido; ii++) + { + i++; + fi++; + arg = fi * argld; + RE(wa[i]) = (real_t)cos(arg); +#if 1 + IM(wa[i]) = (real_t)sin(arg); +#else + IM(wa[i]) = (real_t)-sin(arg); +#endif + } + + if (ip > 5) + { + RE(wa[i1]) = RE(wa[i]); + IM(wa[i1]) = IM(wa[i]); + } + } + l1 = l2; + } +#endif +} + +cfft_info *cffti(uint16_t n) +{ + cfft_info *cfft = (cfft_info*)faad_malloc(sizeof(cfft_info)); + + cfft->n = n; + cfft->work = (complex_t*)faad_malloc(n*sizeof(complex_t)); + +#ifndef FIXED_POINT + cfft->tab = (complex_t*)faad_malloc(n*sizeof(complex_t)); + + cffti1(n, cfft->tab, cfft->ifac); +#else + cffti1(n, NULL, cfft->ifac); + + switch (n) + { + case 64: cfft->tab = (complex_t*)cfft_tab_64; break; + case 512: cfft->tab = (complex_t*)cfft_tab_512; break; +#ifdef LD_DEC + case 256: cfft->tab = (complex_t*)cfft_tab_256; break; +#endif + +#ifdef ALLOW_SMALL_FRAMELENGTH + case 60: cfft->tab = (complex_t*)cfft_tab_60; break; + case 480: cfft->tab = (complex_t*)cfft_tab_480; break; +#ifdef LD_DEC + case 240: cfft->tab = (complex_t*)cfft_tab_240; break; +#endif +#endif + case 128: cfft->tab = (complex_t*)cfft_tab_128; break; + } +#endif + + return cfft; +} + +void cfftu(cfft_info *cfft) +{ + if (cfft->work) faad_free(cfft->work); +#ifndef FIXED_POINT + if (cfft->tab) faad_free(cfft->tab); +#endif + + if (cfft) faad_free(cfft); +} + diff --git a/Libraries/FAAD2/Files/libfaad/cfft.h b/Libraries/FAAD2/Files/libfaad/cfft.h new file mode 100644 index 000000000..04d410e5a --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/cfft.h @@ -0,0 +1,53 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#ifndef __CFFT_H__ +#define __CFFT_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct +{ + uint16_t n; + uint16_t ifac[15]; + complex_t *work; + complex_t *tab; +} cfft_info; + + +void cfftf(cfft_info *cfft, complex_t *c); +void cfftb(cfft_info *cfft, complex_t *c); +cfft_info *cffti(uint16_t n); +void cfftu(cfft_info *cfft); + + +#ifdef __cplusplus +} +#endif +#endif diff --git a/Libraries/FAAD2/Files/libfaad/cfft_tab.h b/Libraries/FAAD2/Files/libfaad/cfft_tab.h new file mode 100644 index 000000000..7ab7a110c --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/cfft_tab.h @@ -0,0 +1,1820 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#ifndef __CFFT_TAB_H__ +#define __CFFT_TAB_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef FIXED_POINT + +ALIGN static const complex_t cfft_tab_512[] = +{ + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(0.999924719333649), FRAC_CONST(0.012271538376808) }, + { FRAC_CONST(0.999698817729950), FRAC_CONST(0.024541229009628) }, + { FRAC_CONST(0.999322354793549), FRAC_CONST(0.036807224154472) }, + { FRAC_CONST(0.998795449733734), FRAC_CONST(0.049067676067352) }, + { FRAC_CONST(0.998118102550507), FRAC_CONST(0.061320740729570) }, + { FRAC_CONST(0.997290432453156), FRAC_CONST(0.073564566671848) }, + { FRAC_CONST(0.996312618255615), FRAC_CONST(0.085797317326069) }, + { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) }, + { FRAC_CONST(0.993906974792480), FRAC_CONST(0.110222205519676) }, + { FRAC_CONST(0.992479562759399), FRAC_CONST(0.122410677373409) }, + { FRAC_CONST(0.990902662277222), FRAC_CONST(0.134580716490746) }, + { FRAC_CONST(0.989176511764526), FRAC_CONST(0.146730467677116) }, + { FRAC_CONST(0.987301409244537), FRAC_CONST(0.158858150243759) }, + { FRAC_CONST(0.985277652740479), FRAC_CONST(0.170961901545525) }, + { FRAC_CONST(0.983105480670929), FRAC_CONST(0.183039888739586) }, + { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) }, + { FRAC_CONST(0.978317379951477), FRAC_CONST(0.207111388444901) }, + { FRAC_CONST(0.975702106952667), FRAC_CONST(0.219101235270500) }, + { FRAC_CONST(0.972939968109131), FRAC_CONST(0.231058120727539) }, + { FRAC_CONST(0.970031261444092), FRAC_CONST(0.242980197072029) }, + { FRAC_CONST(0.966976463794708), FRAC_CONST(0.254865676164627) }, + { FRAC_CONST(0.963776051998138), FRAC_CONST(0.266712784767151) }, + { FRAC_CONST(0.960430502891541), FRAC_CONST(0.278519690036774) }, + { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) }, + { FRAC_CONST(0.953306019306183), FRAC_CONST(0.302005946636200) }, + { FRAC_CONST(0.949528157711029), FRAC_CONST(0.313681751489639) }, + { FRAC_CONST(0.945607304573059), FRAC_CONST(0.325310319662094) }, + { FRAC_CONST(0.941544055938721), FRAC_CONST(0.336889863014221) }, + { FRAC_CONST(0.937339007854462), FRAC_CONST(0.348418682813644) }, + { FRAC_CONST(0.932992815971375), FRAC_CONST(0.359895050525665) }, + { FRAC_CONST(0.928506076335907), FRAC_CONST(0.371317207813263) }, + { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, + { FRAC_CONST(0.919113874435425), FRAC_CONST(0.393992066383362) }, + { FRAC_CONST(0.914209723472595), FRAC_CONST(0.405241340398788) }, + { FRAC_CONST(0.909167945384979), FRAC_CONST(0.416429579257965) }, + { FRAC_CONST(0.903989315032959), FRAC_CONST(0.427555084228516) }, + { FRAC_CONST(0.898674488067627), FRAC_CONST(0.438616245985031) }, + { FRAC_CONST(0.893224298954010), FRAC_CONST(0.449611335992813) }, + { FRAC_CONST(0.887639641761780), FRAC_CONST(0.460538715124130) }, + { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) }, + { FRAC_CONST(0.876070082187653), FRAC_CONST(0.482183754444122) }, + { FRAC_CONST(0.870086967945099), FRAC_CONST(0.492898225784302) }, + { FRAC_CONST(0.863972842693329), FRAC_CONST(0.503538370132446) }, + { FRAC_CONST(0.857728600502014), FRAC_CONST(0.514102756977081) }, + { FRAC_CONST(0.851355195045471), FRAC_CONST(0.524589717388153) }, + { FRAC_CONST(0.844853579998016), FRAC_CONST(0.534997642040253) }, + { FRAC_CONST(0.838224709033966), FRAC_CONST(0.545324981212616) }, + { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) }, + { FRAC_CONST(0.824589252471924), FRAC_CONST(0.565731823444366) }, + { FRAC_CONST(0.817584812641144), FRAC_CONST(0.575808227062225) }, + { FRAC_CONST(0.810457170009613), FRAC_CONST(0.585797905921936) }, + { FRAC_CONST(0.803207516670227), FRAC_CONST(0.595699310302734) }, + { FRAC_CONST(0.795836925506592), FRAC_CONST(0.605511009693146) }, + { FRAC_CONST(0.788346409797668), FRAC_CONST(0.615231633186340) }, + { FRAC_CONST(0.780737221240997), FRAC_CONST(0.624859511852264) }, + { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) }, + { FRAC_CONST(0.765167236328125), FRAC_CONST(0.643831551074982) }, + { FRAC_CONST(0.757208824157715), FRAC_CONST(0.653172850608826) }, + { FRAC_CONST(0.749136388301849), FRAC_CONST(0.662415802478790) }, + { FRAC_CONST(0.740951120853424), FRAC_CONST(0.671558976173401) }, + { FRAC_CONST(0.732654273509979), FRAC_CONST(0.680601000785828) }, + { FRAC_CONST(0.724247097969055), FRAC_CONST(0.689540565013886) }, + { FRAC_CONST(0.715730786323547), FRAC_CONST(0.698376297950745) }, + { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, + { FRAC_CONST(0.698376238346100), FRAC_CONST(0.715730845928192) }, + { FRAC_CONST(0.689540505409241), FRAC_CONST(0.724247097969055) }, + { FRAC_CONST(0.680601000785828), FRAC_CONST(0.732654273509979) }, + { FRAC_CONST(0.671558916568756), FRAC_CONST(0.740951180458069) }, + { FRAC_CONST(0.662415742874146), FRAC_CONST(0.749136388301849) }, + { FRAC_CONST(0.653172791004181), FRAC_CONST(0.757208883762360) }, + { FRAC_CONST(0.643831551074982), FRAC_CONST(0.765167295932770) }, + { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) }, + { FRAC_CONST(0.624859452247620), FRAC_CONST(0.780737280845642) }, + { FRAC_CONST(0.615231573581696), FRAC_CONST(0.788346409797668) }, + { FRAC_CONST(0.605511009693146), FRAC_CONST(0.795836925506592) }, + { FRAC_CONST(0.595699310302734), FRAC_CONST(0.803207516670227) }, + { FRAC_CONST(0.585797846317291), FRAC_CONST(0.810457170009613) }, + { FRAC_CONST(0.575808167457581), FRAC_CONST(0.817584812641144) }, + { FRAC_CONST(0.565731823444366), FRAC_CONST(0.824589312076569) }, + { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) }, + { FRAC_CONST(0.545324981212616), FRAC_CONST(0.838224709033966) }, + { FRAC_CONST(0.534997642040253), FRAC_CONST(0.844853579998016) }, + { FRAC_CONST(0.524589657783508), FRAC_CONST(0.851355195045471) }, + { FRAC_CONST(0.514102697372437), FRAC_CONST(0.857728660106659) }, + { FRAC_CONST(0.503538429737091), FRAC_CONST(0.863972842693329) }, + { FRAC_CONST(0.492898195981979), FRAC_CONST(0.870086967945099) }, + { FRAC_CONST(0.482183724641800), FRAC_CONST(0.876070141792297) }, + { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) }, + { FRAC_CONST(0.460538715124130), FRAC_CONST(0.887639641761780) }, + { FRAC_CONST(0.449611306190491), FRAC_CONST(0.893224298954010) }, + { FRAC_CONST(0.438616186380386), FRAC_CONST(0.898674488067627) }, + { FRAC_CONST(0.427555114030838), FRAC_CONST(0.903989315032959) }, + { FRAC_CONST(0.416429549455643), FRAC_CONST(0.909168004989624) }, + { FRAC_CONST(0.405241280794144), FRAC_CONST(0.914209783077240) }, + { FRAC_CONST(0.393991947174072), FRAC_CONST(0.919113874435425) }, + { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, + { FRAC_CONST(0.371317148208618), FRAC_CONST(0.928506076335907) }, + { FRAC_CONST(0.359894961118698), FRAC_CONST(0.932992815971375) }, + { FRAC_CONST(0.348418682813644), FRAC_CONST(0.937339007854462) }, + { FRAC_CONST(0.336889833211899), FRAC_CONST(0.941544055938721) }, + { FRAC_CONST(0.325310230255127), FRAC_CONST(0.945607364177704) }, + { FRAC_CONST(0.313681662082672), FRAC_CONST(0.949528217315674) }, + { FRAC_CONST(0.302005946636200), FRAC_CONST(0.953306019306183) }, + { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) }, + { FRAC_CONST(0.278519600629807), FRAC_CONST(0.960430562496185) }, + { FRAC_CONST(0.266712754964828), FRAC_CONST(0.963776051998138) }, + { FRAC_CONST(0.254865646362305), FRAC_CONST(0.966976463794708) }, + { FRAC_CONST(0.242980122566223), FRAC_CONST(0.970031261444092) }, + { FRAC_CONST(0.231058135628700), FRAC_CONST(0.972939968109131) }, + { FRAC_CONST(0.219101220369339), FRAC_CONST(0.975702106952667) }, + { FRAC_CONST(0.207111328840256), FRAC_CONST(0.978317379951477) }, + { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) }, + { FRAC_CONST(0.183039888739586), FRAC_CONST(0.983105480670929) }, + { FRAC_CONST(0.170961856842041), FRAC_CONST(0.985277652740479) }, + { FRAC_CONST(0.158858075737953), FRAC_CONST(0.987301409244537) }, + { FRAC_CONST(0.146730497479439), FRAC_CONST(0.989176511764526) }, + { FRAC_CONST(0.134580686688423), FRAC_CONST(0.990902662277222) }, + { FRAC_CONST(0.122410625219345), FRAC_CONST(0.992479562759399) }, + { FRAC_CONST(0.110222116112709), FRAC_CONST(0.993906974792480) }, + { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) }, + { FRAC_CONST(0.085797272622585), FRAC_CONST(0.996312618255615) }, + { FRAC_CONST(0.073564492166042), FRAC_CONST(0.997290432453156) }, + { FRAC_CONST(0.061320748180151), FRAC_CONST(0.998118102550507) }, + { FRAC_CONST(0.049067649990320), FRAC_CONST(0.998795449733734) }, + { FRAC_CONST(0.036807164549828), FRAC_CONST(0.999322414398193) }, + { FRAC_CONST(0.024541135877371), FRAC_CONST(0.999698817729950) }, + { FRAC_CONST(0.012271529063582), FRAC_CONST(0.999924719333649) }, + { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) }, + { FRAC_CONST(-0.012271616607904), FRAC_CONST(0.999924719333649) }, + { FRAC_CONST(-0.024541223421693), FRAC_CONST(0.999698817729950) }, + { FRAC_CONST(-0.036807250231504), FRAC_CONST(0.999322354793549) }, + { FRAC_CONST(-0.049067739397287), FRAC_CONST(0.998795449733734) }, + { FRAC_CONST(-0.061320833861828), FRAC_CONST(0.998118102550507) }, + { FRAC_CONST(-0.073564574122429), FRAC_CONST(0.997290432453156) }, + { FRAC_CONST(-0.085797362029552), FRAC_CONST(0.996312618255615) }, + { FRAC_CONST(-0.098017223179340), FRAC_CONST(0.995184719562531) }, + { FRAC_CONST(-0.110222205519676), FRAC_CONST(0.993906974792480) }, + { FRAC_CONST(-0.122410707175732), FRAC_CONST(0.992479503154755) }, + { FRAC_CONST(-0.134580776095390), FRAC_CONST(0.990902602672577) }, + { FRAC_CONST(-0.146730571985245), FRAC_CONST(0.989176511764526) }, + { FRAC_CONST(-0.158858165144920), FRAC_CONST(0.987301409244537) }, + { FRAC_CONST(-0.170961946249008), FRAC_CONST(0.985277652740479) }, + { FRAC_CONST(-0.183039978146553), FRAC_CONST(0.983105480670929) }, + { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) }, + { FRAC_CONST(-0.207111418247223), FRAC_CONST(0.978317379951477) }, + { FRAC_CONST(-0.219101309776306), FRAC_CONST(0.975702106952667) }, + { FRAC_CONST(-0.231058210134506), FRAC_CONST(0.972939908504486) }, + { FRAC_CONST(-0.242980197072029), FRAC_CONST(0.970031261444092) }, + { FRAC_CONST(-0.254865705966949), FRAC_CONST(0.966976463794708) }, + { FRAC_CONST(-0.266712844371796), FRAC_CONST(0.963776051998138) }, + { FRAC_CONST(-0.278519690036774), FRAC_CONST(0.960430502891541) }, + { FRAC_CONST(-0.290284723043442), FRAC_CONST(0.956940293312073) }, + { FRAC_CONST(-0.302006036043167), FRAC_CONST(0.953306019306183) }, + { FRAC_CONST(-0.313681721687317), FRAC_CONST(0.949528157711029) }, + { FRAC_CONST(-0.325310319662094), FRAC_CONST(0.945607304573059) }, + { FRAC_CONST(-0.336889922618866), FRAC_CONST(0.941544055938721) }, + { FRAC_CONST(-0.348418772220612), FRAC_CONST(0.937338948249817) }, + { FRAC_CONST(-0.359895050525665), FRAC_CONST(0.932992815971375) }, + { FRAC_CONST(-0.371317237615585), FRAC_CONST(0.928506076335907) }, + { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) }, + { FRAC_CONST(-0.393992036581039), FRAC_CONST(0.919113874435425) }, + { FRAC_CONST(-0.405241340398788), FRAC_CONST(0.914209723472595) }, + { FRAC_CONST(-0.416429519653320), FRAC_CONST(0.909168004989624) }, + { FRAC_CONST(-0.427555084228516), FRAC_CONST(0.903989315032959) }, + { FRAC_CONST(-0.438616245985031), FRAC_CONST(0.898674428462982) }, + { FRAC_CONST(-0.449611365795136), FRAC_CONST(0.893224298954010) }, + { FRAC_CONST(-0.460538804531097), FRAC_CONST(0.887639582157135) }, + { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) }, + { FRAC_CONST(-0.482183903455734), FRAC_CONST(0.876070022583008) }, + { FRAC_CONST(-0.492898166179657), FRAC_CONST(0.870087027549744) }, + { FRAC_CONST(-0.503538370132446), FRAC_CONST(0.863972842693329) }, + { FRAC_CONST(-0.514102756977081), FRAC_CONST(0.857728600502014) }, + { FRAC_CONST(-0.524589717388153), FRAC_CONST(0.851355135440826) }, + { FRAC_CONST(-0.534997701644897), FRAC_CONST(0.844853520393372) }, + { FRAC_CONST(-0.545325100421906), FRAC_CONST(0.838224649429321) }, + { FRAC_CONST(-0.555570363998413), FRAC_CONST(0.831469535827637) }, + { FRAC_CONST(-0.565731763839722), FRAC_CONST(0.824589312076569) }, + { FRAC_CONST(-0.575808167457581), FRAC_CONST(0.817584812641144) }, + { FRAC_CONST(-0.585797905921936), FRAC_CONST(0.810457170009613) }, + { FRAC_CONST(-0.595699369907379), FRAC_CONST(0.803207516670227) }, + { FRAC_CONST(-0.605511128902435), FRAC_CONST(0.795836865901947) }, + { FRAC_CONST(-0.615231692790985), FRAC_CONST(0.788346350193024) }, + { FRAC_CONST(-0.624859631061554), FRAC_CONST(0.780737102031708) }, + { FRAC_CONST(-0.634393274784088), FRAC_CONST(0.773010492324829) }, + { FRAC_CONST(-0.643831551074982), FRAC_CONST(0.765167236328125) }, + { FRAC_CONST(-0.653172850608826), FRAC_CONST(0.757208824157715) }, + { FRAC_CONST(-0.662415802478790), FRAC_CONST(0.749136328697205) }, + { FRAC_CONST(-0.671559035778046), FRAC_CONST(0.740951061248779) }, + { FRAC_CONST(-0.680601119995117), FRAC_CONST(0.732654154300690) }, + { FRAC_CONST(-0.689540684223175), FRAC_CONST(0.724246978759766) }, + { FRAC_CONST(-0.698376238346100), FRAC_CONST(0.715730845928192) }, + { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, + { FRAC_CONST(-0.715730845928192), FRAC_CONST(0.698376238346100) }, + { FRAC_CONST(-0.724247157573700), FRAC_CONST(0.689540505409241) }, + { FRAC_CONST(-0.732654333114624), FRAC_CONST(0.680600941181183) }, + { FRAC_CONST(-0.740951240062714), FRAC_CONST(0.671558856964111) }, + { FRAC_CONST(-0.749136507511139), FRAC_CONST(0.662415623664856) }, + { FRAC_CONST(-0.757208824157715), FRAC_CONST(0.653172850608826) }, + { FRAC_CONST(-0.765167295932770), FRAC_CONST(0.643831551074982) }, + { FRAC_CONST(-0.773010492324829), FRAC_CONST(0.634393274784088) }, + { FRAC_CONST(-0.780737280845642), FRAC_CONST(0.624859452247620) }, + { FRAC_CONST(-0.788346469402313), FRAC_CONST(0.615231513977051) }, + { FRAC_CONST(-0.795836985111237), FRAC_CONST(0.605510950088501) }, + { FRAC_CONST(-0.803207635879517), FRAC_CONST(0.595699131488800) }, + { FRAC_CONST(-0.810457170009613), FRAC_CONST(0.585797846317291) }, + { FRAC_CONST(-0.817584812641144), FRAC_CONST(0.575808167457581) }, + { FRAC_CONST(-0.824589312076569), FRAC_CONST(0.565731763839722) }, + { FRAC_CONST(-0.831469655036926), FRAC_CONST(0.555570185184479) }, + { FRAC_CONST(-0.838224768638611), FRAC_CONST(0.545324862003326) }, + { FRAC_CONST(-0.844853639602661), FRAC_CONST(0.534997463226318) }, + { FRAC_CONST(-0.851355314254761), FRAC_CONST(0.524589538574219) }, + { FRAC_CONST(-0.857728600502014), FRAC_CONST(0.514102756977081) }, + { FRAC_CONST(-0.863972842693329), FRAC_CONST(0.503538370132446) }, + { FRAC_CONST(-0.870087027549744), FRAC_CONST(0.492898136377335) }, + { FRAC_CONST(-0.876070141792297), FRAC_CONST(0.482183694839478) }, + { FRAC_CONST(-0.881921350955963), FRAC_CONST(0.471396625041962) }, + { FRAC_CONST(-0.887639701366425), FRAC_CONST(0.460538566112518) }, + { FRAC_CONST(-0.893224298954010), FRAC_CONST(0.449611365795136) }, + { FRAC_CONST(-0.898674488067627), FRAC_CONST(0.438616245985031) }, + { FRAC_CONST(-0.903989315032959), FRAC_CONST(0.427555054426193) }, + { FRAC_CONST(-0.909168004989624), FRAC_CONST(0.416429489850998) }, + { FRAC_CONST(-0.914209783077240), FRAC_CONST(0.405241221189499) }, + { FRAC_CONST(-0.919113874435425), FRAC_CONST(0.393991917371750) }, + { FRAC_CONST(-0.923879623413086), FRAC_CONST(0.382683277130127) }, + { FRAC_CONST(-0.928506076335907), FRAC_CONST(0.371317237615585) }, + { FRAC_CONST(-0.932992815971375), FRAC_CONST(0.359895050525665) }, + { FRAC_CONST(-0.937339007854462), FRAC_CONST(0.348418653011322) }, + { FRAC_CONST(-0.941544115543365), FRAC_CONST(0.336889803409576) }, + { FRAC_CONST(-0.945607364177704), FRAC_CONST(0.325310200452805) }, + { FRAC_CONST(-0.949528217315674), FRAC_CONST(0.313681602478027) }, + { FRAC_CONST(-0.953306078910828), FRAC_CONST(0.302005797624588) }, + { FRAC_CONST(-0.956940352916718), FRAC_CONST(0.290284723043442) }, + { FRAC_CONST(-0.960430502891541), FRAC_CONST(0.278519690036774) }, + { FRAC_CONST(-0.963776051998138), FRAC_CONST(0.266712725162506) }, + { FRAC_CONST(-0.966976463794708), FRAC_CONST(0.254865586757660) }, + { FRAC_CONST(-0.970031261444092), FRAC_CONST(0.242980077862740) }, + { FRAC_CONST(-0.972939968109131), FRAC_CONST(0.231057971715927) }, + { FRAC_CONST(-0.975702166557312), FRAC_CONST(0.219101071357727) }, + { FRAC_CONST(-0.978317379951477), FRAC_CONST(0.207111403346062) }, + { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) }, + { FRAC_CONST(-0.983105480670929), FRAC_CONST(0.183039844036102) }, + { FRAC_CONST(-0.985277652740479), FRAC_CONST(0.170961812138557) }, + { FRAC_CONST(-0.987301409244537), FRAC_CONST(0.158858031034470) }, + { FRAC_CONST(-0.989176511764526), FRAC_CONST(0.146730333566666) }, + { FRAC_CONST(-0.990902662277222), FRAC_CONST(0.134580522775650) }, + { FRAC_CONST(-0.992479503154755), FRAC_CONST(0.122410699725151) }, + { FRAC_CONST(-0.993906974792480), FRAC_CONST(0.110222198069096) }, + { FRAC_CONST(-0.995184719562531), FRAC_CONST(0.098017096519470) }, + { FRAC_CONST(-0.996312618255615), FRAC_CONST(0.085797227919102) }, + { FRAC_CONST(-0.997290492057800), FRAC_CONST(0.073564447462559) }, + { FRAC_CONST(-0.998118102550507), FRAC_CONST(0.061320584267378) }, + { FRAC_CONST(-0.998795449733734), FRAC_CONST(0.049067486077547) }, + { FRAC_CONST(-0.999322354793549), FRAC_CONST(0.036807239055634) }, + { FRAC_CONST(-0.999698817729950), FRAC_CONST(0.024541210383177) }, + { FRAC_CONST(-0.999924719333649), FRAC_CONST(0.012271485291421) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(0.999698817729950), FRAC_CONST(0.024541229009628) }, + { FRAC_CONST(0.998795449733734), FRAC_CONST(0.049067676067352) }, + { FRAC_CONST(0.997290432453156), FRAC_CONST(0.073564566671848) }, + { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) }, + { FRAC_CONST(0.992479562759399), FRAC_CONST(0.122410677373409) }, + { FRAC_CONST(0.989176511764526), FRAC_CONST(0.146730467677116) }, + { FRAC_CONST(0.985277652740479), FRAC_CONST(0.170961901545525) }, + { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) }, + { FRAC_CONST(0.975702106952667), FRAC_CONST(0.219101235270500) }, + { FRAC_CONST(0.970031261444092), FRAC_CONST(0.242980197072029) }, + { FRAC_CONST(0.963776051998138), FRAC_CONST(0.266712784767151) }, + { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) }, + { FRAC_CONST(0.949528157711029), FRAC_CONST(0.313681751489639) }, + { FRAC_CONST(0.941544055938721), FRAC_CONST(0.336889863014221) }, + { FRAC_CONST(0.932992815971375), FRAC_CONST(0.359895050525665) }, + { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, + { FRAC_CONST(0.914209723472595), FRAC_CONST(0.405241340398788) }, + { FRAC_CONST(0.903989315032959), FRAC_CONST(0.427555084228516) }, + { FRAC_CONST(0.893224298954010), FRAC_CONST(0.449611335992813) }, + { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) }, + { FRAC_CONST(0.870086967945099), FRAC_CONST(0.492898225784302) }, + { FRAC_CONST(0.857728600502014), FRAC_CONST(0.514102756977081) }, + { FRAC_CONST(0.844853579998016), FRAC_CONST(0.534997642040253) }, + { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) }, + { FRAC_CONST(0.817584812641144), FRAC_CONST(0.575808227062225) }, + { FRAC_CONST(0.803207516670227), FRAC_CONST(0.595699310302734) }, + { FRAC_CONST(0.788346409797668), FRAC_CONST(0.615231633186340) }, + { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) }, + { FRAC_CONST(0.757208824157715), FRAC_CONST(0.653172850608826) }, + { FRAC_CONST(0.740951120853424), FRAC_CONST(0.671558976173401) }, + { FRAC_CONST(0.724247097969055), FRAC_CONST(0.689540565013886) }, + { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, + { FRAC_CONST(0.689540505409241), FRAC_CONST(0.724247097969055) }, + { FRAC_CONST(0.671558916568756), FRAC_CONST(0.740951180458069) }, + { FRAC_CONST(0.653172791004181), FRAC_CONST(0.757208883762360) }, + { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) }, + { FRAC_CONST(0.615231573581696), FRAC_CONST(0.788346409797668) }, + { FRAC_CONST(0.595699310302734), FRAC_CONST(0.803207516670227) }, + { FRAC_CONST(0.575808167457581), FRAC_CONST(0.817584812641144) }, + { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) }, + { FRAC_CONST(0.534997642040253), FRAC_CONST(0.844853579998016) }, + { FRAC_CONST(0.514102697372437), FRAC_CONST(0.857728660106659) }, + { FRAC_CONST(0.492898195981979), FRAC_CONST(0.870086967945099) }, + { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) }, + { FRAC_CONST(0.449611306190491), FRAC_CONST(0.893224298954010) }, + { FRAC_CONST(0.427555114030838), FRAC_CONST(0.903989315032959) }, + { FRAC_CONST(0.405241280794144), FRAC_CONST(0.914209783077240) }, + { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, + { FRAC_CONST(0.359894961118698), FRAC_CONST(0.932992815971375) }, + { FRAC_CONST(0.336889833211899), FRAC_CONST(0.941544055938721) }, + { FRAC_CONST(0.313681662082672), FRAC_CONST(0.949528217315674) }, + { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) }, + { FRAC_CONST(0.266712754964828), FRAC_CONST(0.963776051998138) }, + { FRAC_CONST(0.242980122566223), FRAC_CONST(0.970031261444092) }, + { FRAC_CONST(0.219101220369339), FRAC_CONST(0.975702106952667) }, + { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) }, + { FRAC_CONST(0.170961856842041), FRAC_CONST(0.985277652740479) }, + { FRAC_CONST(0.146730497479439), FRAC_CONST(0.989176511764526) }, + { FRAC_CONST(0.122410625219345), FRAC_CONST(0.992479562759399) }, + { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) }, + { FRAC_CONST(0.073564492166042), FRAC_CONST(0.997290432453156) }, + { FRAC_CONST(0.049067649990320), FRAC_CONST(0.998795449733734) }, + { FRAC_CONST(0.024541135877371), FRAC_CONST(0.999698817729950) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(0.998795449733734), FRAC_CONST(0.049067676067352) }, + { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) }, + { FRAC_CONST(0.989176511764526), FRAC_CONST(0.146730467677116) }, + { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) }, + { FRAC_CONST(0.970031261444092), FRAC_CONST(0.242980197072029) }, + { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) }, + { FRAC_CONST(0.941544055938721), FRAC_CONST(0.336889863014221) }, + { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, + { FRAC_CONST(0.903989315032959), FRAC_CONST(0.427555084228516) }, + { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) }, + { FRAC_CONST(0.857728600502014), FRAC_CONST(0.514102756977081) }, + { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) }, + { FRAC_CONST(0.803207516670227), FRAC_CONST(0.595699310302734) }, + { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) }, + { FRAC_CONST(0.740951120853424), FRAC_CONST(0.671558976173401) }, + { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, + { FRAC_CONST(0.671558916568756), FRAC_CONST(0.740951180458069) }, + { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) }, + { FRAC_CONST(0.595699310302734), FRAC_CONST(0.803207516670227) }, + { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) }, + { FRAC_CONST(0.514102697372437), FRAC_CONST(0.857728660106659) }, + { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) }, + { FRAC_CONST(0.427555114030838), FRAC_CONST(0.903989315032959) }, + { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, + { FRAC_CONST(0.336889833211899), FRAC_CONST(0.941544055938721) }, + { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) }, + { FRAC_CONST(0.242980122566223), FRAC_CONST(0.970031261444092) }, + { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) }, + { FRAC_CONST(0.146730497479439), FRAC_CONST(0.989176511764526) }, + { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) }, + { FRAC_CONST(0.049067649990320), FRAC_CONST(0.998795449733734) }, + { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) }, + { FRAC_CONST(-0.049067739397287), FRAC_CONST(0.998795449733734) }, + { FRAC_CONST(-0.098017223179340), FRAC_CONST(0.995184719562531) }, + { FRAC_CONST(-0.146730571985245), FRAC_CONST(0.989176511764526) }, + { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) }, + { FRAC_CONST(-0.242980197072029), FRAC_CONST(0.970031261444092) }, + { FRAC_CONST(-0.290284723043442), FRAC_CONST(0.956940293312073) }, + { FRAC_CONST(-0.336889922618866), FRAC_CONST(0.941544055938721) }, + { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) }, + { FRAC_CONST(-0.427555084228516), FRAC_CONST(0.903989315032959) }, + { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) }, + { FRAC_CONST(-0.514102756977081), FRAC_CONST(0.857728600502014) }, + { FRAC_CONST(-0.555570363998413), FRAC_CONST(0.831469535827637) }, + { FRAC_CONST(-0.595699369907379), FRAC_CONST(0.803207516670227) }, + { FRAC_CONST(-0.634393274784088), FRAC_CONST(0.773010492324829) }, + { FRAC_CONST(-0.671559035778046), FRAC_CONST(0.740951061248779) }, + { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, + { FRAC_CONST(-0.740951240062714), FRAC_CONST(0.671558856964111) }, + { FRAC_CONST(-0.773010492324829), FRAC_CONST(0.634393274784088) }, + { FRAC_CONST(-0.803207635879517), FRAC_CONST(0.595699131488800) }, + { FRAC_CONST(-0.831469655036926), FRAC_CONST(0.555570185184479) }, + { FRAC_CONST(-0.857728600502014), FRAC_CONST(0.514102756977081) }, + { FRAC_CONST(-0.881921350955963), FRAC_CONST(0.471396625041962) }, + { FRAC_CONST(-0.903989315032959), FRAC_CONST(0.427555054426193) }, + { FRAC_CONST(-0.923879623413086), FRAC_CONST(0.382683277130127) }, + { FRAC_CONST(-0.941544115543365), FRAC_CONST(0.336889803409576) }, + { FRAC_CONST(-0.956940352916718), FRAC_CONST(0.290284723043442) }, + { FRAC_CONST(-0.970031261444092), FRAC_CONST(0.242980077862740) }, + { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) }, + { FRAC_CONST(-0.989176511764526), FRAC_CONST(0.146730333566666) }, + { FRAC_CONST(-0.995184719562531), FRAC_CONST(0.098017096519470) }, + { FRAC_CONST(-0.998795449733734), FRAC_CONST(0.049067486077547) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(0.997290432453156), FRAC_CONST(0.073564566671848) }, + { FRAC_CONST(0.989176511764526), FRAC_CONST(0.146730467677116) }, + { FRAC_CONST(0.975702106952667), FRAC_CONST(0.219101235270500) }, + { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) }, + { FRAC_CONST(0.932992815971375), FRAC_CONST(0.359895050525665) }, + { FRAC_CONST(0.903989315032959), FRAC_CONST(0.427555084228516) }, + { FRAC_CONST(0.870086967945099), FRAC_CONST(0.492898225784302) }, + { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) }, + { FRAC_CONST(0.788346469402313), FRAC_CONST(0.615231573581696) }, + { FRAC_CONST(0.740951120853424), FRAC_CONST(0.671558976173401) }, + { FRAC_CONST(0.689540505409241), FRAC_CONST(0.724247097969055) }, + { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) }, + { FRAC_CONST(0.575808227062225), FRAC_CONST(0.817584812641144) }, + { FRAC_CONST(0.514102697372437), FRAC_CONST(0.857728660106659) }, + { FRAC_CONST(0.449611306190491), FRAC_CONST(0.893224298954010) }, + { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, + { FRAC_CONST(0.313681751489639), FRAC_CONST(0.949528157711029) }, + { FRAC_CONST(0.242980241775513), FRAC_CONST(0.970031261444092) }, + { FRAC_CONST(0.170961856842041), FRAC_CONST(0.985277652740479) }, + { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) }, + { FRAC_CONST(0.024541255086660), FRAC_CONST(0.999698817729950) }, + { FRAC_CONST(-0.049067739397287), FRAC_CONST(0.998795449733734) }, + { FRAC_CONST(-0.122410707175732), FRAC_CONST(0.992479503154755) }, + { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) }, + { FRAC_CONST(-0.266712725162506), FRAC_CONST(0.963776051998138) }, + { FRAC_CONST(-0.336889803409576), FRAC_CONST(0.941544055938721) }, + { FRAC_CONST(-0.405241340398788), FRAC_CONST(0.914209723472595) }, + { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) }, + { FRAC_CONST(-0.534997701644897), FRAC_CONST(0.844853520393372) }, + { FRAC_CONST(-0.595699369907379), FRAC_CONST(0.803207516670227) }, + { FRAC_CONST(-0.653172850608826), FRAC_CONST(0.757208824157715) }, + { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, + { FRAC_CONST(-0.757208824157715), FRAC_CONST(0.653172850608826) }, + { FRAC_CONST(-0.803207516670227), FRAC_CONST(0.595699369907379) }, + { FRAC_CONST(-0.844853520393372), FRAC_CONST(0.534997701644897) }, + { FRAC_CONST(-0.881921231746674), FRAC_CONST(0.471396833658218) }, + { FRAC_CONST(-0.914209783077240), FRAC_CONST(0.405241221189499) }, + { FRAC_CONST(-0.941544115543365), FRAC_CONST(0.336889803409576) }, + { FRAC_CONST(-0.963776051998138), FRAC_CONST(0.266712725162506) }, + { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) }, + { FRAC_CONST(-0.992479503154755), FRAC_CONST(0.122410699725151) }, + { FRAC_CONST(-0.998795449733734), FRAC_CONST(0.049067724496126) }, + { FRAC_CONST(-0.999698817729950), FRAC_CONST(-0.024541147053242) }, + { FRAC_CONST(-0.995184719562531), FRAC_CONST(-0.098017267882824) }, + { FRAC_CONST(-0.985277652740479), FRAC_CONST(-0.170961990952492) }, + { FRAC_CONST(-0.970031261444092), FRAC_CONST(-0.242980241775513) }, + { FRAC_CONST(-0.949528157711029), FRAC_CONST(-0.313681781291962) }, + { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) }, + { FRAC_CONST(-0.893224298954010), FRAC_CONST(-0.449611306190491) }, + { FRAC_CONST(-0.857728660106659), FRAC_CONST(-0.514102697372437) }, + { FRAC_CONST(-0.817584872245789), FRAC_CONST(-0.575808107852936) }, + { FRAC_CONST(-0.773010551929474), FRAC_CONST(-0.634393215179443) }, + { FRAC_CONST(-0.724247038364410), FRAC_CONST(-0.689540624618530) }, + { FRAC_CONST(-0.671558916568756), FRAC_CONST(-0.740951180458069) }, + { FRAC_CONST(-0.615231573581696), FRAC_CONST(-0.788346469402313) }, + { FRAC_CONST(-0.555570006370544), FRAC_CONST(-0.831469774246216) }, + { FRAC_CONST(-0.492898195981979), FRAC_CONST(-0.870086967945099) }, + { FRAC_CONST(-0.427554935216904), FRAC_CONST(-0.903989374637604) }, + { FRAC_CONST(-0.359895110130310), FRAC_CONST(-0.932992756366730) }, + { FRAC_CONST(-0.290284544229507), FRAC_CONST(-0.956940352916718) }, + { FRAC_CONST(-0.219101369380951), FRAC_CONST(-0.975702106952667) }, + { FRAC_CONST(-0.146730408072472), FRAC_CONST(-0.989176511764526) }, + { FRAC_CONST(-0.073564760386944), FRAC_CONST(-0.997290432453156) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) }, + { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) }, + { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) }, + { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, + { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) }, + { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) }, + { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) }, + { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, + { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) }, + { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) }, + { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) }, + { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, + { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) }, + { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) }, + { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) }, + { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, + { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) }, + { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, + { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) }, + { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, + { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) }, + { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) }, + { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) }, + { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) }, + { FRAC_CONST(-0.555570363998413), FRAC_CONST(0.831469535827637) }, + { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, + { FRAC_CONST(-0.831469655036926), FRAC_CONST(0.555570185184479) }, + { FRAC_CONST(-0.923879623413086), FRAC_CONST(0.382683277130127) }, + { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) }, + { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) }, + { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) }, + { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, + { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) }, + { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) }, + { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) }, + { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, + { FRAC_CONST(-0.881921231746674), FRAC_CONST(0.471396833658218) }, + { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) }, + { FRAC_CONST(-0.995184719562531), FRAC_CONST(-0.098017267882824) }, + { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) }, + { FRAC_CONST(-0.773010551929474), FRAC_CONST(-0.634393215179443) }, + { FRAC_CONST(-0.555570006370544), FRAC_CONST(-0.831469774246216) }, + { FRAC_CONST(-0.290284544229507), FRAC_CONST(-0.956940352916718) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, + { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, + { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, + { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) }, + { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, + { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, + { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(0.000000011924881), FRAC_CONST(-1.000000000000000) } +}; + +#ifdef ALLOW_SMALL_FRAMELENGTH +ALIGN static const complex_t cfft_tab_480[] = +{ + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(0.999914348125458), FRAC_CONST(0.013089596293867) }, + { FRAC_CONST(0.999657332897186), FRAC_CONST(0.026176949962974) }, + { FRAC_CONST(0.999229013919830), FRAC_CONST(0.039259817451239) }, + { FRAC_CONST(0.998629510402679), FRAC_CONST(0.052335958927870) }, + { FRAC_CONST(0.997858941555023), FRAC_CONST(0.065403133630753) }, + { FRAC_CONST(0.996917307376862), FRAC_CONST(0.078459098935127) }, + { FRAC_CONST(0.995804905891418), FRAC_CONST(0.091501623392105) }, + { FRAC_CONST(0.994521915912628), FRAC_CONST(0.104528464376926) }, + { FRAC_CONST(0.993068456649780), FRAC_CONST(0.117537401616573) }, + { FRAC_CONST(0.991444885730743), FRAC_CONST(0.130526199936867) }, + { FRAC_CONST(0.989651381969452), FRAC_CONST(0.143492624163628) }, + { FRAC_CONST(0.987688362598419), FRAC_CONST(0.156434476375580) }, + { FRAC_CONST(0.985556066036224), FRAC_CONST(0.169349506497383) }, + { FRAC_CONST(0.983254909515381), FRAC_CONST(0.182235524058342) }, + { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) }, + { FRAC_CONST(0.978147625923157), FRAC_CONST(0.207911700010300) }, + { FRAC_CONST(0.975342333316803), FRAC_CONST(0.220697447657585) }, + { FRAC_CONST(0.972369909286499), FRAC_CONST(0.233445376157761) }, + { FRAC_CONST(0.969230890274048), FRAC_CONST(0.246153295040131) }, + { FRAC_CONST(0.965925812721252), FRAC_CONST(0.258819043636322) }, + { FRAC_CONST(0.962455213069916), FRAC_CONST(0.271440446376801) }, + { FRAC_CONST(0.958819746971130), FRAC_CONST(0.284015357494354) }, + { FRAC_CONST(0.955019950866699), FRAC_CONST(0.296541601419449) }, + { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) }, + { FRAC_CONST(0.946930110454559), FRAC_CONST(0.321439445018768) }, + { FRAC_CONST(0.942641496658325), FRAC_CONST(0.333806872367859) }, + { FRAC_CONST(0.938191354274750), FRAC_CONST(0.346117079257965) }, + { FRAC_CONST(0.933580398559570), FRAC_CONST(0.358367949724197) }, + { FRAC_CONST(0.928809583187103), FRAC_CONST(0.370557427406311) }, + { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, + { FRAC_CONST(0.918791174888611), FRAC_CONST(0.394743889570236) }, + { FRAC_CONST(0.913545429706573), FRAC_CONST(0.406736642122269) }, + { FRAC_CONST(0.908143162727356), FRAC_CONST(0.418659746646881) }, + { FRAC_CONST(0.902585268020630), FRAC_CONST(0.430511116981506) }, + { FRAC_CONST(0.896872758865356), FRAC_CONST(0.442288726568222) }, + { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) }, + { FRAC_CONST(0.884987652301788), FRAC_CONST(0.465614527463913) }, + { FRAC_CONST(0.878817081451416), FRAC_CONST(0.477158784866333) }, + { FRAC_CONST(0.872496008872986), FRAC_CONST(0.488621264696121) }, + { FRAC_CONST(0.866025388240814), FRAC_CONST(0.500000000000000) }, + { FRAC_CONST(0.859406411647797), FRAC_CONST(0.511293113231659) }, + { FRAC_CONST(0.852640151977539), FRAC_CONST(0.522498548030853) }, + { FRAC_CONST(0.845727801322937), FRAC_CONST(0.533614516258240) }, + { FRAC_CONST(0.838670551776886), FRAC_CONST(0.544639050960541) }, + { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) }, + { FRAC_CONST(0.824126183986664), FRAC_CONST(0.566406250000000) }, + { FRAC_CONST(0.816641509532928), FRAC_CONST(0.577145218849182) }, + { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) }, + { FRAC_CONST(0.801253795623779), FRAC_CONST(0.598324596881866) }, + { FRAC_CONST(0.793353319168091), FRAC_CONST(0.608761429786682) }, + { FRAC_CONST(0.785316884517670), FRAC_CONST(0.619093954563141) }, + { FRAC_CONST(0.777145922183990), FRAC_CONST(0.629320383071899) }, + { FRAC_CONST(0.768841803073883), FRAC_CONST(0.639438986778259) }, + { FRAC_CONST(0.760405957698822), FRAC_CONST(0.649448096752167) }, + { FRAC_CONST(0.751839756965637), FRAC_CONST(0.659345865249634) }, + { FRAC_CONST(0.743144810199738), FRAC_CONST(0.669130623340607) }, + { FRAC_CONST(0.734322488307953), FRAC_CONST(0.678800761699677) }, + { FRAC_CONST(0.725374400615692), FRAC_CONST(0.688354551792145) }, + { FRAC_CONST(0.716301918029785), FRAC_CONST(0.697790503501892) }, + { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, + { FRAC_CONST(0.697790443897247), FRAC_CONST(0.716301977634430) }, + { FRAC_CONST(0.688354551792145), FRAC_CONST(0.725374400615692) }, + { FRAC_CONST(0.678800702095032), FRAC_CONST(0.734322547912598) }, + { FRAC_CONST(0.669130563735962), FRAC_CONST(0.743144869804382) }, + { FRAC_CONST(0.659345805644989), FRAC_CONST(0.751839816570282) }, + { FRAC_CONST(0.649448037147522), FRAC_CONST(0.760405957698822) }, + { FRAC_CONST(0.639438986778259), FRAC_CONST(0.768841862678528) }, + { FRAC_CONST(0.629320383071899), FRAC_CONST(0.777145981788635) }, + { FRAC_CONST(0.619093954563141), FRAC_CONST(0.785316944122314) }, + { FRAC_CONST(0.608761370182037), FRAC_CONST(0.793353378772736) }, + { FRAC_CONST(0.598324596881866), FRAC_CONST(0.801253855228424) }, + { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) }, + { FRAC_CONST(0.577145159244537), FRAC_CONST(0.816641569137573) }, + { FRAC_CONST(0.566406250000000), FRAC_CONST(0.824126183986664) }, + { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) }, + { FRAC_CONST(0.544638991355896), FRAC_CONST(0.838670611381531) }, + { FRAC_CONST(0.533614516258240), FRAC_CONST(0.845727801322937) }, + { FRAC_CONST(0.522498488426209), FRAC_CONST(0.852640211582184) }, + { FRAC_CONST(0.511293113231659), FRAC_CONST(0.859406411647797) }, + { FRAC_CONST(0.499999970197678), FRAC_CONST(0.866025447845459) }, + { FRAC_CONST(0.488621175289154), FRAC_CONST(0.872496068477631) }, + { FRAC_CONST(0.477158755064011), FRAC_CONST(0.878817141056061) }, + { FRAC_CONST(0.465614467859268), FRAC_CONST(0.884987652301788) }, + { FRAC_CONST(0.453990519046783), FRAC_CONST(0.891006529331207) }, + { FRAC_CONST(0.442288666963577), FRAC_CONST(0.896872758865356) }, + { FRAC_CONST(0.430511027574539), FRAC_CONST(0.902585327625275) }, + { FRAC_CONST(0.418659746646881), FRAC_CONST(0.908143162727356) }, + { FRAC_CONST(0.406736612319946), FRAC_CONST(0.913545489311218) }, + { FRAC_CONST(0.394743800163269), FRAC_CONST(0.918791234493256) }, + { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, + { FRAC_CONST(0.370557397603989), FRAC_CONST(0.928809583187103) }, + { FRAC_CONST(0.358367860317230), FRAC_CONST(0.933580458164215) }, + { FRAC_CONST(0.346117049455643), FRAC_CONST(0.938191354274750) }, + { FRAC_CONST(0.333806812763214), FRAC_CONST(0.942641496658325) }, + { FRAC_CONST(0.321439474821091), FRAC_CONST(0.946930110454559) }, + { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) }, + { FRAC_CONST(0.296541512012482), FRAC_CONST(0.955019950866699) }, + { FRAC_CONST(0.284015327692032), FRAC_CONST(0.958819746971130) }, + { FRAC_CONST(0.271440386772156), FRAC_CONST(0.962455272674561) }, + { FRAC_CONST(0.258819073438644), FRAC_CONST(0.965925812721252) }, + { FRAC_CONST(0.246153265237808), FRAC_CONST(0.969230890274048) }, + { FRAC_CONST(0.233445301651955), FRAC_CONST(0.972369909286499) }, + { FRAC_CONST(0.220697447657585), FRAC_CONST(0.975342333316803) }, + { FRAC_CONST(0.207911655306816), FRAC_CONST(0.978147625923157) }, + { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) }, + { FRAC_CONST(0.182235524058342), FRAC_CONST(0.983254909515381) }, + { FRAC_CONST(0.169349446892738), FRAC_CONST(0.985556066036224) }, + { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) }, + { FRAC_CONST(0.143492594361305), FRAC_CONST(0.989651381969452) }, + { FRAC_CONST(0.130526125431061), FRAC_CONST(0.991444885730743) }, + { FRAC_CONST(0.117537401616573), FRAC_CONST(0.993068456649780) }, + { FRAC_CONST(0.104528419673443), FRAC_CONST(0.994521915912628) }, + { FRAC_CONST(0.091501533985138), FRAC_CONST(0.995804905891418) }, + { FRAC_CONST(0.078459084033966), FRAC_CONST(0.996917307376862) }, + { FRAC_CONST(0.065403074026108), FRAC_CONST(0.997858941555023) }, + { FRAC_CONST(0.052335973829031), FRAC_CONST(0.998629510402679) }, + { FRAC_CONST(0.039259787648916), FRAC_CONST(0.999229013919830) }, + { FRAC_CONST(0.026176875457168), FRAC_CONST(0.999657332897186) }, + { FRAC_CONST(0.013089597225189), FRAC_CONST(0.999914348125458) }, + { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) }, + { FRAC_CONST(-0.013089684769511), FRAC_CONST(0.999914348125458) }, + { FRAC_CONST(-0.026176963001490), FRAC_CONST(0.999657332897186) }, + { FRAC_CONST(-0.039259877055883), FRAC_CONST(0.999229013919830) }, + { FRAC_CONST(-0.052336059510708), FRAC_CONST(0.998629510402679) }, + { FRAC_CONST(-0.065403163433075), FRAC_CONST(0.997858941555023) }, + { FRAC_CONST(-0.078459173440933), FRAC_CONST(0.996917307376862) }, + { FRAC_CONST(-0.091501623392105), FRAC_CONST(0.995804905891418) }, + { FRAC_CONST(-0.104528509080410), FRAC_CONST(0.994521915912628) }, + { FRAC_CONST(-0.117537491023541), FRAC_CONST(0.993068456649780) }, + { FRAC_CONST(-0.130526214838028), FRAC_CONST(0.991444885730743) }, + { FRAC_CONST(-0.143492683768272), FRAC_CONST(0.989651381969452) }, + { FRAC_CONST(-0.156434446573257), FRAC_CONST(0.987688362598419) }, + { FRAC_CONST(-0.169349536299706), FRAC_CONST(0.985556066036224) }, + { FRAC_CONST(-0.182235598564148), FRAC_CONST(0.983254909515381) }, + { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) }, + { FRAC_CONST(-0.207911744713783), FRAC_CONST(0.978147566318512) }, + { FRAC_CONST(-0.220697522163391), FRAC_CONST(0.975342273712158) }, + { FRAC_CONST(-0.233445391058922), FRAC_CONST(0.972369909286499) }, + { FRAC_CONST(-0.246153354644775), FRAC_CONST(0.969230890274048) }, + { FRAC_CONST(-0.258819162845612), FRAC_CONST(0.965925812721252) }, + { FRAC_CONST(-0.271440476179123), FRAC_CONST(0.962455213069916) }, + { FRAC_CONST(-0.284015417098999), FRAC_CONST(0.958819687366486) }, + { FRAC_CONST(-0.296541571617126), FRAC_CONST(0.955019950866699) }, + { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) }, + { FRAC_CONST(-0.321439564228058), FRAC_CONST(0.946930110454559) }, + { FRAC_CONST(-0.333806872367859), FRAC_CONST(0.942641496658325) }, + { FRAC_CONST(-0.346117109060287), FRAC_CONST(0.938191294670105) }, + { FRAC_CONST(-0.358367949724197), FRAC_CONST(0.933580458164215) }, + { FRAC_CONST(-0.370557487010956), FRAC_CONST(0.928809523582459) }, + { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) }, + { FRAC_CONST(-0.394743859767914), FRAC_CONST(0.918791234493256) }, + { FRAC_CONST(-0.406736701726913), FRAC_CONST(0.913545429706573) }, + { FRAC_CONST(-0.418659836053848), FRAC_CONST(0.908143103122711) }, + { FRAC_CONST(-0.430511116981506), FRAC_CONST(0.902585268020630) }, + { FRAC_CONST(-0.442288637161255), FRAC_CONST(0.896872758865356) }, + { FRAC_CONST(-0.453990608453751), FRAC_CONST(0.891006469726563) }, + { FRAC_CONST(-0.465614557266235), FRAC_CONST(0.884987592697144) }, + { FRAC_CONST(-0.477158725261688), FRAC_CONST(0.878817141056061) }, + { FRAC_CONST(-0.488621354103088), FRAC_CONST(0.872495949268341) }, + { FRAC_CONST(-0.500000059604645), FRAC_CONST(0.866025388240814) }, + { FRAC_CONST(-0.511293053627014), FRAC_CONST(0.859406411647797) }, + { FRAC_CONST(-0.522498667240143), FRAC_CONST(0.852640092372894) }, + { FRAC_CONST(-0.533614575862885), FRAC_CONST(0.845727801322937) }, + { FRAC_CONST(-0.544639050960541), FRAC_CONST(0.838670551776886) }, + { FRAC_CONST(-0.555570363998413), FRAC_CONST(0.831469535827637) }, + { FRAC_CONST(-0.566406309604645), FRAC_CONST(0.824126124382019) }, + { FRAC_CONST(-0.577145218849182), FRAC_CONST(0.816641569137573) }, + { FRAC_CONST(-0.587785184383392), FRAC_CONST(0.809017002582550) }, + { FRAC_CONST(-0.598324656486511), FRAC_CONST(0.801253736019135) }, + { FRAC_CONST(-0.608761429786682), FRAC_CONST(0.793353319168091) }, + { FRAC_CONST(-0.619093894958496), FRAC_CONST(0.785316944122314) }, + { FRAC_CONST(-0.629320502281189), FRAC_CONST(0.777145862579346) }, + { FRAC_CONST(-0.639439046382904), FRAC_CONST(0.768841803073883) }, + { FRAC_CONST(-0.649448037147522), FRAC_CONST(0.760405957698822) }, + { FRAC_CONST(-0.659345924854279), FRAC_CONST(0.751839697360992) }, + { FRAC_CONST(-0.669130682945251), FRAC_CONST(0.743144810199738) }, + { FRAC_CONST(-0.678800761699677), FRAC_CONST(0.734322488307953) }, + { FRAC_CONST(-0.688354671001434), FRAC_CONST(0.725374281406403) }, + { FRAC_CONST(-0.697790503501892), FRAC_CONST(0.716301858425140) }, + { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, + { FRAC_CONST(-0.716302037239075), FRAC_CONST(0.697790324687958) }, + { FRAC_CONST(-0.725374460220337), FRAC_CONST(0.688354492187500) }, + { FRAC_CONST(-0.734322547912598), FRAC_CONST(0.678800702095032) }, + { FRAC_CONST(-0.743144929409027), FRAC_CONST(0.669130444526672) }, + { FRAC_CONST(-0.751839876174927), FRAC_CONST(0.659345746040344) }, + { FRAC_CONST(-0.760406017303467), FRAC_CONST(0.649448037147522) }, + { FRAC_CONST(-0.768841803073883), FRAC_CONST(0.639439046382904) }, + { FRAC_CONST(-0.777146041393280), FRAC_CONST(0.629320263862610) }, + { FRAC_CONST(-0.785316944122314), FRAC_CONST(0.619093894958496) }, + { FRAC_CONST(-0.793353319168091), FRAC_CONST(0.608761429786682) }, + { FRAC_CONST(-0.801253914833069), FRAC_CONST(0.598324477672577) }, + { FRAC_CONST(-0.809017062187195), FRAC_CONST(0.587785184383392) }, + { FRAC_CONST(-0.816641569137573), FRAC_CONST(0.577145218849182) }, + { FRAC_CONST(-0.824126303195953), FRAC_CONST(0.566406130790710) }, + { FRAC_CONST(-0.831469655036926), FRAC_CONST(0.555570185184479) }, + { FRAC_CONST(-0.838670551776886), FRAC_CONST(0.544639050960541) }, + { FRAC_CONST(-0.845727920532227), FRAC_CONST(0.533614337444305) }, + { FRAC_CONST(-0.852640211582184), FRAC_CONST(0.522498488426209) }, + { FRAC_CONST(-0.859406411647797), FRAC_CONST(0.511293053627014) }, + { FRAC_CONST(-0.866025388240814), FRAC_CONST(0.500000059604645) }, + { FRAC_CONST(-0.872496068477631), FRAC_CONST(0.488621145486832) }, + { FRAC_CONST(-0.878817141056061), FRAC_CONST(0.477158725261688) }, + { FRAC_CONST(-0.884987652301788), FRAC_CONST(0.465614557266235) }, + { FRAC_CONST(-0.891006588935852), FRAC_CONST(0.453990370035172) }, + { FRAC_CONST(-0.896872758865356), FRAC_CONST(0.442288637161255) }, + { FRAC_CONST(-0.902585268020630), FRAC_CONST(0.430511116981506) }, + { FRAC_CONST(-0.908143222332001), FRAC_CONST(0.418659597635269) }, + { FRAC_CONST(-0.913545489311218), FRAC_CONST(0.406736582517624) }, + { FRAC_CONST(-0.918791234493256), FRAC_CONST(0.394743859767914) }, + { FRAC_CONST(-0.923879623413086), FRAC_CONST(0.382683277130127) }, + { FRAC_CONST(-0.928809583187103), FRAC_CONST(0.370557337999344) }, + { FRAC_CONST(-0.933580458164215), FRAC_CONST(0.358367919921875) }, + { FRAC_CONST(-0.938191413879395), FRAC_CONST(0.346116900444031) }, + { FRAC_CONST(-0.942641556262970), FRAC_CONST(0.333806753158569) }, + { FRAC_CONST(-0.946930170059204), FRAC_CONST(0.321439445018768) }, + { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) }, + { FRAC_CONST(-0.955020010471344), FRAC_CONST(0.296541452407837) }, + { FRAC_CONST(-0.958819746971130), FRAC_CONST(0.284015297889709) }, + { FRAC_CONST(-0.962455213069916), FRAC_CONST(0.271440476179123) }, + { FRAC_CONST(-0.965925872325897), FRAC_CONST(0.258818924427032) }, + { FRAC_CONST(-0.969230949878693), FRAC_CONST(0.246153235435486) }, + { FRAC_CONST(-0.972369909286499), FRAC_CONST(0.233445376157761) }, + { FRAC_CONST(-0.975342333316803), FRAC_CONST(0.220697283744812) }, + { FRAC_CONST(-0.978147625923157), FRAC_CONST(0.207911610603333) }, + { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) }, + { FRAC_CONST(-0.983254909515381), FRAC_CONST(0.182235360145569) }, + { FRAC_CONST(-0.985556066036224), FRAC_CONST(0.169349402189255) }, + { FRAC_CONST(-0.987688362598419), FRAC_CONST(0.156434446573257) }, + { FRAC_CONST(-0.989651441574097), FRAC_CONST(0.143492430448532) }, + { FRAC_CONST(-0.991444885730743), FRAC_CONST(0.130526080727577) }, + { FRAC_CONST(-0.993068456649780), FRAC_CONST(0.117537356913090) }, + { FRAC_CONST(-0.994521915912628), FRAC_CONST(0.104528494179249) }, + { FRAC_CONST(-0.995804965496063), FRAC_CONST(0.091501489281654) }, + { FRAC_CONST(-0.996917366981506), FRAC_CONST(0.078459039330482) }, + { FRAC_CONST(-0.997858941555023), FRAC_CONST(0.065403148531914) }, + { FRAC_CONST(-0.998629570007324), FRAC_CONST(0.052335809916258) }, + { FRAC_CONST(-0.999229013919830), FRAC_CONST(0.039259742945433) }, + { FRAC_CONST(-0.999657332897186), FRAC_CONST(0.026176951825619) }, + { FRAC_CONST(-0.999914348125458), FRAC_CONST(0.013089434243739) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(0.999657332897186), FRAC_CONST(0.026176949962974) }, + { FRAC_CONST(0.998629510402679), FRAC_CONST(0.052335958927870) }, + { FRAC_CONST(0.996917307376862), FRAC_CONST(0.078459098935127) }, + { FRAC_CONST(0.994521915912628), FRAC_CONST(0.104528464376926) }, + { FRAC_CONST(0.991444885730743), FRAC_CONST(0.130526199936867) }, + { FRAC_CONST(0.987688362598419), FRAC_CONST(0.156434476375580) }, + { FRAC_CONST(0.983254909515381), FRAC_CONST(0.182235524058342) }, + { FRAC_CONST(0.978147625923157), FRAC_CONST(0.207911700010300) }, + { FRAC_CONST(0.972369909286499), FRAC_CONST(0.233445376157761) }, + { FRAC_CONST(0.965925812721252), FRAC_CONST(0.258819043636322) }, + { FRAC_CONST(0.958819746971130), FRAC_CONST(0.284015357494354) }, + { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) }, + { FRAC_CONST(0.942641496658325), FRAC_CONST(0.333806872367859) }, + { FRAC_CONST(0.933580398559570), FRAC_CONST(0.358367949724197) }, + { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, + { FRAC_CONST(0.913545429706573), FRAC_CONST(0.406736642122269) }, + { FRAC_CONST(0.902585268020630), FRAC_CONST(0.430511116981506) }, + { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) }, + { FRAC_CONST(0.878817081451416), FRAC_CONST(0.477158784866333) }, + { FRAC_CONST(0.866025388240814), FRAC_CONST(0.500000000000000) }, + { FRAC_CONST(0.852640151977539), FRAC_CONST(0.522498548030853) }, + { FRAC_CONST(0.838670551776886), FRAC_CONST(0.544639050960541) }, + { FRAC_CONST(0.824126183986664), FRAC_CONST(0.566406250000000) }, + { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) }, + { FRAC_CONST(0.793353319168091), FRAC_CONST(0.608761429786682) }, + { FRAC_CONST(0.777145922183990), FRAC_CONST(0.629320383071899) }, + { FRAC_CONST(0.760405957698822), FRAC_CONST(0.649448096752167) }, + { FRAC_CONST(0.743144810199738), FRAC_CONST(0.669130623340607) }, + { FRAC_CONST(0.725374400615692), FRAC_CONST(0.688354551792145) }, + { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, + { FRAC_CONST(0.688354551792145), FRAC_CONST(0.725374400615692) }, + { FRAC_CONST(0.669130563735962), FRAC_CONST(0.743144869804382) }, + { FRAC_CONST(0.649448037147522), FRAC_CONST(0.760405957698822) }, + { FRAC_CONST(0.629320383071899), FRAC_CONST(0.777145981788635) }, + { FRAC_CONST(0.608761370182037), FRAC_CONST(0.793353378772736) }, + { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) }, + { FRAC_CONST(0.566406250000000), FRAC_CONST(0.824126183986664) }, + { FRAC_CONST(0.544638991355896), FRAC_CONST(0.838670611381531) }, + { FRAC_CONST(0.522498488426209), FRAC_CONST(0.852640211582184) }, + { FRAC_CONST(0.499999970197678), FRAC_CONST(0.866025447845459) }, + { FRAC_CONST(0.477158755064011), FRAC_CONST(0.878817141056061) }, + { FRAC_CONST(0.453990519046783), FRAC_CONST(0.891006529331207) }, + { FRAC_CONST(0.430511027574539), FRAC_CONST(0.902585327625275) }, + { FRAC_CONST(0.406736612319946), FRAC_CONST(0.913545489311218) }, + { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, + { FRAC_CONST(0.358367860317230), FRAC_CONST(0.933580458164215) }, + { FRAC_CONST(0.333806812763214), FRAC_CONST(0.942641496658325) }, + { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) }, + { FRAC_CONST(0.284015327692032), FRAC_CONST(0.958819746971130) }, + { FRAC_CONST(0.258819073438644), FRAC_CONST(0.965925812721252) }, + { FRAC_CONST(0.233445301651955), FRAC_CONST(0.972369909286499) }, + { FRAC_CONST(0.207911655306816), FRAC_CONST(0.978147625923157) }, + { FRAC_CONST(0.182235524058342), FRAC_CONST(0.983254909515381) }, + { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) }, + { FRAC_CONST(0.130526125431061), FRAC_CONST(0.991444885730743) }, + { FRAC_CONST(0.104528419673443), FRAC_CONST(0.994521915912628) }, + { FRAC_CONST(0.078459084033966), FRAC_CONST(0.996917307376862) }, + { FRAC_CONST(0.052335973829031), FRAC_CONST(0.998629510402679) }, + { FRAC_CONST(0.026176875457168), FRAC_CONST(0.999657332897186) }, + { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) }, + { FRAC_CONST(-0.026176963001490), FRAC_CONST(0.999657332897186) }, + { FRAC_CONST(-0.052336059510708), FRAC_CONST(0.998629510402679) }, + { FRAC_CONST(-0.078459173440933), FRAC_CONST(0.996917307376862) }, + { FRAC_CONST(-0.104528509080410), FRAC_CONST(0.994521915912628) }, + { FRAC_CONST(-0.130526214838028), FRAC_CONST(0.991444885730743) }, + { FRAC_CONST(-0.156434446573257), FRAC_CONST(0.987688362598419) }, + { FRAC_CONST(-0.182235598564148), FRAC_CONST(0.983254909515381) }, + { FRAC_CONST(-0.207911744713783), FRAC_CONST(0.978147566318512) }, + { FRAC_CONST(-0.233445391058922), FRAC_CONST(0.972369909286499) }, + { FRAC_CONST(-0.258819162845612), FRAC_CONST(0.965925812721252) }, + { FRAC_CONST(-0.284015417098999), FRAC_CONST(0.958819687366486) }, + { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) }, + { FRAC_CONST(-0.333806872367859), FRAC_CONST(0.942641496658325) }, + { FRAC_CONST(-0.358367949724197), FRAC_CONST(0.933580458164215) }, + { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) }, + { FRAC_CONST(-0.406736701726913), FRAC_CONST(0.913545429706573) }, + { FRAC_CONST(-0.430511116981506), FRAC_CONST(0.902585268020630) }, + { FRAC_CONST(-0.453990608453751), FRAC_CONST(0.891006469726563) }, + { FRAC_CONST(-0.477158725261688), FRAC_CONST(0.878817141056061) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(0.998629510402679), FRAC_CONST(0.052335958927870) }, + { FRAC_CONST(0.994521915912628), FRAC_CONST(0.104528464376926) }, + { FRAC_CONST(0.987688362598419), FRAC_CONST(0.156434476375580) }, + { FRAC_CONST(0.978147625923157), FRAC_CONST(0.207911700010300) }, + { FRAC_CONST(0.965925812721252), FRAC_CONST(0.258819043636322) }, + { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) }, + { FRAC_CONST(0.933580398559570), FRAC_CONST(0.358367949724197) }, + { FRAC_CONST(0.913545429706573), FRAC_CONST(0.406736642122269) }, + { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) }, + { FRAC_CONST(0.866025388240814), FRAC_CONST(0.500000000000000) }, + { FRAC_CONST(0.838670551776886), FRAC_CONST(0.544639050960541) }, + { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) }, + { FRAC_CONST(0.777145922183990), FRAC_CONST(0.629320383071899) }, + { FRAC_CONST(0.743144810199738), FRAC_CONST(0.669130623340607) }, + { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, + { FRAC_CONST(0.669130563735962), FRAC_CONST(0.743144869804382) }, + { FRAC_CONST(0.629320383071899), FRAC_CONST(0.777145981788635) }, + { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) }, + { FRAC_CONST(0.544638991355896), FRAC_CONST(0.838670611381531) }, + { FRAC_CONST(0.499999970197678), FRAC_CONST(0.866025447845459) }, + { FRAC_CONST(0.453990519046783), FRAC_CONST(0.891006529331207) }, + { FRAC_CONST(0.406736612319946), FRAC_CONST(0.913545489311218) }, + { FRAC_CONST(0.358367860317230), FRAC_CONST(0.933580458164215) }, + { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) }, + { FRAC_CONST(0.258819073438644), FRAC_CONST(0.965925812721252) }, + { FRAC_CONST(0.207911655306816), FRAC_CONST(0.978147625923157) }, + { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) }, + { FRAC_CONST(0.104528419673443), FRAC_CONST(0.994521915912628) }, + { FRAC_CONST(0.052335973829031), FRAC_CONST(0.998629510402679) }, + { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) }, + { FRAC_CONST(-0.052336059510708), FRAC_CONST(0.998629510402679) }, + { FRAC_CONST(-0.104528509080410), FRAC_CONST(0.994521915912628) }, + { FRAC_CONST(-0.156434446573257), FRAC_CONST(0.987688362598419) }, + { FRAC_CONST(-0.207911744713783), FRAC_CONST(0.978147566318512) }, + { FRAC_CONST(-0.258819162845612), FRAC_CONST(0.965925812721252) }, + { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) }, + { FRAC_CONST(-0.358367949724197), FRAC_CONST(0.933580458164215) }, + { FRAC_CONST(-0.406736701726913), FRAC_CONST(0.913545429706573) }, + { FRAC_CONST(-0.453990608453751), FRAC_CONST(0.891006469726563) }, + { FRAC_CONST(-0.500000059604645), FRAC_CONST(0.866025388240814) }, + { FRAC_CONST(-0.544639050960541), FRAC_CONST(0.838670551776886) }, + { FRAC_CONST(-0.587785184383392), FRAC_CONST(0.809017002582550) }, + { FRAC_CONST(-0.629320502281189), FRAC_CONST(0.777145862579346) }, + { FRAC_CONST(-0.669130682945251), FRAC_CONST(0.743144810199738) }, + { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, + { FRAC_CONST(-0.743144929409027), FRAC_CONST(0.669130444526672) }, + { FRAC_CONST(-0.777146041393280), FRAC_CONST(0.629320263862610) }, + { FRAC_CONST(-0.809017062187195), FRAC_CONST(0.587785184383392) }, + { FRAC_CONST(-0.838670551776886), FRAC_CONST(0.544639050960541) }, + { FRAC_CONST(-0.866025388240814), FRAC_CONST(0.500000059604645) }, + { FRAC_CONST(-0.891006588935852), FRAC_CONST(0.453990370035172) }, + { FRAC_CONST(-0.913545489311218), FRAC_CONST(0.406736582517624) }, + { FRAC_CONST(-0.933580458164215), FRAC_CONST(0.358367919921875) }, + { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) }, + { FRAC_CONST(-0.965925872325897), FRAC_CONST(0.258818924427032) }, + { FRAC_CONST(-0.978147625923157), FRAC_CONST(0.207911610603333) }, + { FRAC_CONST(-0.987688362598419), FRAC_CONST(0.156434446573257) }, + { FRAC_CONST(-0.994521915912628), FRAC_CONST(0.104528494179249) }, + { FRAC_CONST(-0.998629570007324), FRAC_CONST(0.052335809916258) }, + { FRAC_CONST(-1.000000000000000), FRAC_CONST(-0.000000087422777) }, + { FRAC_CONST(-0.998629510402679), FRAC_CONST(-0.052335985004902) }, + { FRAC_CONST(-0.994521856307983), FRAC_CONST(-0.104528672993183) }, + { FRAC_CONST(-0.987688302993774), FRAC_CONST(-0.156434610486031) }, + { FRAC_CONST(-0.978147566318512), FRAC_CONST(-0.207911789417267) }, + { FRAC_CONST(-0.965925812721252), FRAC_CONST(-0.258819073438644) }, + { FRAC_CONST(-0.951056540012360), FRAC_CONST(-0.309016972780228) }, + { FRAC_CONST(-0.933580398559570), FRAC_CONST(-0.358368098735809) }, + { FRAC_CONST(-0.913545429706573), FRAC_CONST(-0.406736731529236) }, + { FRAC_CONST(-0.891006529331207), FRAC_CONST(-0.453990548849106) }, + { FRAC_CONST(-0.866025269031525), FRAC_CONST(-0.500000178813934) }, + { FRAC_CONST(-0.838670492172241), FRAC_CONST(-0.544639170169830) }, + { FRAC_CONST(-0.809016942977905), FRAC_CONST(-0.587785363197327) }, + { FRAC_CONST(-0.777145922183990), FRAC_CONST(-0.629320442676544) }, + { FRAC_CONST(-0.743144810199738), FRAC_CONST(-0.669130623340607) }, + { FRAC_CONST(-0.707106649875641), FRAC_CONST(-0.707106888294220) }, + { FRAC_CONST(-0.669130504131317), FRAC_CONST(-0.743144869804382) }, + { FRAC_CONST(-0.629320323467255), FRAC_CONST(-0.777145981788635) }, + { FRAC_CONST(-0.587785065174103), FRAC_CONST(-0.809017121791840) }, + { FRAC_CONST(-0.544639110565186), FRAC_CONST(-0.838670551776886) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(0.996917307376862), FRAC_CONST(0.078459098935127) }, + { FRAC_CONST(0.987688362598419), FRAC_CONST(0.156434476375580) }, + { FRAC_CONST(0.972369909286499), FRAC_CONST(0.233445376157761) }, + { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) }, + { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, + { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) }, + { FRAC_CONST(0.852640151977539), FRAC_CONST(0.522498548030853) }, + { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) }, + { FRAC_CONST(0.760405957698822), FRAC_CONST(0.649448096752167) }, + { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, + { FRAC_CONST(0.649448037147522), FRAC_CONST(0.760405957698822) }, + { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) }, + { FRAC_CONST(0.522498488426209), FRAC_CONST(0.852640211582184) }, + { FRAC_CONST(0.453990519046783), FRAC_CONST(0.891006529331207) }, + { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, + { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) }, + { FRAC_CONST(0.233445301651955), FRAC_CONST(0.972369909286499) }, + { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) }, + { FRAC_CONST(0.078459084033966), FRAC_CONST(0.996917307376862) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(0.987688362598419), FRAC_CONST(0.156434476375580) }, + { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) }, + { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) }, + { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) }, + { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, + { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) }, + { FRAC_CONST(0.453990519046783), FRAC_CONST(0.891006529331207) }, + { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) }, + { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) }, + { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) }, + { FRAC_CONST(-0.156434446573257), FRAC_CONST(0.987688362598419) }, + { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) }, + { FRAC_CONST(-0.453990608453751), FRAC_CONST(0.891006469726563) }, + { FRAC_CONST(-0.587785184383392), FRAC_CONST(0.809017002582550) }, + { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, + { FRAC_CONST(-0.809017062187195), FRAC_CONST(0.587785184383392) }, + { FRAC_CONST(-0.891006588935852), FRAC_CONST(0.453990370035172) }, + { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) }, + { FRAC_CONST(-0.987688362598419), FRAC_CONST(0.156434446573257) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(0.972369909286499), FRAC_CONST(0.233445376157761) }, + { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) }, + { FRAC_CONST(0.760405957698822), FRAC_CONST(0.649448096752167) }, + { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) }, + { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, + { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) }, + { FRAC_CONST(-0.078459173440933), FRAC_CONST(0.996917307376862) }, + { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) }, + { FRAC_CONST(-0.522498667240143), FRAC_CONST(0.852640092372894) }, + { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, + { FRAC_CONST(-0.852640211582184), FRAC_CONST(0.522498488426209) }, + { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) }, + { FRAC_CONST(-0.996917366981506), FRAC_CONST(0.078459039330482) }, + { FRAC_CONST(-0.987688302993774), FRAC_CONST(-0.156434610486031) }, + { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) }, + { FRAC_CONST(-0.809016942977905), FRAC_CONST(-0.587785363197327) }, + { FRAC_CONST(-0.649447917938232), FRAC_CONST(-0.760406076908112) }, + { FRAC_CONST(-0.453990221023560), FRAC_CONST(-0.891006648540497) }, + { FRAC_CONST(-0.233445450663567), FRAC_CONST(-0.972369909286499) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) }, + { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) }, + { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) }, + { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) }, + { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) }, + { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) }, + { FRAC_CONST(-0.809017062187195), FRAC_CONST(0.587785184383392) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) }, + { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) }, + { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) }, + { FRAC_CONST(-0.809016942977905), FRAC_CONST(-0.587785363197327) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(0.309017121791840), FRAC_CONST(-0.951056480407715) } +}; +#endif + +ALIGN static const complex_t cfft_tab_64[] = +{ + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) }, + { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) }, + { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) }, + { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, + { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) }, + { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) }, + { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) }, + { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, + { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) }, + { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) }, + { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) }, + { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, + { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) }, + { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) }, + { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) }, + { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, + { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) }, + { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, + { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) }, + { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, + { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) }, + { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) }, + { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) }, + { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) }, + { FRAC_CONST(-0.555570363998413), FRAC_CONST(0.831469535827637) }, + { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, + { FRAC_CONST(-0.831469655036926), FRAC_CONST(0.555570185184479) }, + { FRAC_CONST(-0.923879623413086), FRAC_CONST(0.382683277130127) }, + { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) }, + { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) }, + { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) }, + { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, + { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) }, + { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) }, + { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) }, + { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, + { FRAC_CONST(-0.881921231746674), FRAC_CONST(0.471396833658218) }, + { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) }, + { FRAC_CONST(-0.995184719562531), FRAC_CONST(-0.098017267882824) }, + { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) }, + { FRAC_CONST(-0.773010551929474), FRAC_CONST(-0.634393215179443) }, + { FRAC_CONST(-0.555570006370544), FRAC_CONST(-0.831469774246216) }, + { FRAC_CONST(-0.290284544229507), FRAC_CONST(-0.956940352916718) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, + { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, + { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, + { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) }, + { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, + { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, + { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(0.000000011924881), FRAC_CONST(-1.000000000000000) } +}; + +#ifdef ALLOW_SMALL_FRAMELENGTH +ALIGN static const complex_t cfft_tab_60[] = +{ + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(0.994521915912628), FRAC_CONST(0.104528464376926) }, + { FRAC_CONST(0.978147625923157), FRAC_CONST(0.207911700010300) }, + { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) }, + { FRAC_CONST(0.913545429706573), FRAC_CONST(0.406736642122269) }, + { FRAC_CONST(0.866025388240814), FRAC_CONST(0.500000000000000) }, + { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) }, + { FRAC_CONST(0.743144810199738), FRAC_CONST(0.669130623340607) }, + { FRAC_CONST(0.669130563735962), FRAC_CONST(0.743144869804382) }, + { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) }, + { FRAC_CONST(0.499999970197678), FRAC_CONST(0.866025447845459) }, + { FRAC_CONST(0.406736612319946), FRAC_CONST(0.913545489311218) }, + { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) }, + { FRAC_CONST(0.207911655306816), FRAC_CONST(0.978147625923157) }, + { FRAC_CONST(0.104528419673443), FRAC_CONST(0.994521915912628) }, + { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) }, + { FRAC_CONST(-0.104528509080410), FRAC_CONST(0.994521915912628) }, + { FRAC_CONST(-0.207911744713783), FRAC_CONST(0.978147566318512) }, + { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) }, + { FRAC_CONST(-0.406736701726913), FRAC_CONST(0.913545429706573) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(0.978147625923157), FRAC_CONST(0.207911700010300) }, + { FRAC_CONST(0.913545429706573), FRAC_CONST(0.406736642122269) }, + { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) }, + { FRAC_CONST(0.669130563735962), FRAC_CONST(0.743144869804382) }, + { FRAC_CONST(0.499999970197678), FRAC_CONST(0.866025447845459) }, + { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) }, + { FRAC_CONST(0.104528419673443), FRAC_CONST(0.994521915912628) }, + { FRAC_CONST(-0.104528509080410), FRAC_CONST(0.994521915912628) }, + { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) }, + { FRAC_CONST(-0.500000059604645), FRAC_CONST(0.866025388240814) }, + { FRAC_CONST(-0.669130682945251), FRAC_CONST(0.743144810199738) }, + { FRAC_CONST(-0.809017062187195), FRAC_CONST(0.587785184383392) }, + { FRAC_CONST(-0.913545489311218), FRAC_CONST(0.406736582517624) }, + { FRAC_CONST(-0.978147625923157), FRAC_CONST(0.207911610603333) }, + { FRAC_CONST(-1.000000000000000), FRAC_CONST(-0.000000087422777) }, + { FRAC_CONST(-0.978147566318512), FRAC_CONST(-0.207911789417267) }, + { FRAC_CONST(-0.913545429706573), FRAC_CONST(-0.406736731529236) }, + { FRAC_CONST(-0.809016942977905), FRAC_CONST(-0.587785363197327) }, + { FRAC_CONST(-0.669130504131317), FRAC_CONST(-0.743144869804382) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) }, + { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) }, + { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) }, + { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) }, + { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) }, + { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) }, + { FRAC_CONST(-0.809017062187195), FRAC_CONST(0.587785184383392) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) }, + { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) }, + { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) }, + { FRAC_CONST(-0.809016942977905), FRAC_CONST(-0.587785363197327) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(0.309017121791840), FRAC_CONST(-0.951056480407715) } +}; +#endif + +#ifdef LD_DEC + +ALIGN static const complex_t cfft_tab_256[] = +{ + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(0.999698817729950), FRAC_CONST(0.024541229009628) }, + { FRAC_CONST(0.998795449733734), FRAC_CONST(0.049067676067352) }, + { FRAC_CONST(0.997290432453156), FRAC_CONST(0.073564566671848) }, + { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) }, + { FRAC_CONST(0.992479562759399), FRAC_CONST(0.122410677373409) }, + { FRAC_CONST(0.989176511764526), FRAC_CONST(0.146730467677116) }, + { FRAC_CONST(0.985277652740479), FRAC_CONST(0.170961901545525) }, + { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) }, + { FRAC_CONST(0.975702106952667), FRAC_CONST(0.219101235270500) }, + { FRAC_CONST(0.970031261444092), FRAC_CONST(0.242980197072029) }, + { FRAC_CONST(0.963776051998138), FRAC_CONST(0.266712784767151) }, + { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) }, + { FRAC_CONST(0.949528157711029), FRAC_CONST(0.313681751489639) }, + { FRAC_CONST(0.941544055938721), FRAC_CONST(0.336889863014221) }, + { FRAC_CONST(0.932992815971375), FRAC_CONST(0.359895050525665) }, + { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, + { FRAC_CONST(0.914209723472595), FRAC_CONST(0.405241340398788) }, + { FRAC_CONST(0.903989315032959), FRAC_CONST(0.427555084228516) }, + { FRAC_CONST(0.893224298954010), FRAC_CONST(0.449611335992813) }, + { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) }, + { FRAC_CONST(0.870086967945099), FRAC_CONST(0.492898225784302) }, + { FRAC_CONST(0.857728600502014), FRAC_CONST(0.514102756977081) }, + { FRAC_CONST(0.844853579998016), FRAC_CONST(0.534997642040253) }, + { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) }, + { FRAC_CONST(0.817584812641144), FRAC_CONST(0.575808227062225) }, + { FRAC_CONST(0.803207516670227), FRAC_CONST(0.595699310302734) }, + { FRAC_CONST(0.788346409797668), FRAC_CONST(0.615231633186340) }, + { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) }, + { FRAC_CONST(0.757208824157715), FRAC_CONST(0.653172850608826) }, + { FRAC_CONST(0.740951120853424), FRAC_CONST(0.671558976173401) }, + { FRAC_CONST(0.724247097969055), FRAC_CONST(0.689540565013886) }, + { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, + { FRAC_CONST(0.689540505409241), FRAC_CONST(0.724247097969055) }, + { FRAC_CONST(0.671558916568756), FRAC_CONST(0.740951180458069) }, + { FRAC_CONST(0.653172791004181), FRAC_CONST(0.757208883762360) }, + { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) }, + { FRAC_CONST(0.615231573581696), FRAC_CONST(0.788346409797668) }, + { FRAC_CONST(0.595699310302734), FRAC_CONST(0.803207516670227) }, + { FRAC_CONST(0.575808167457581), FRAC_CONST(0.817584812641144) }, + { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) }, + { FRAC_CONST(0.534997642040253), FRAC_CONST(0.844853579998016) }, + { FRAC_CONST(0.514102697372437), FRAC_CONST(0.857728660106659) }, + { FRAC_CONST(0.492898195981979), FRAC_CONST(0.870086967945099) }, + { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) }, + { FRAC_CONST(0.449611306190491), FRAC_CONST(0.893224298954010) }, + { FRAC_CONST(0.427555114030838), FRAC_CONST(0.903989315032959) }, + { FRAC_CONST(0.405241280794144), FRAC_CONST(0.914209783077240) }, + { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, + { FRAC_CONST(0.359894961118698), FRAC_CONST(0.932992815971375) }, + { FRAC_CONST(0.336889833211899), FRAC_CONST(0.941544055938721) }, + { FRAC_CONST(0.313681662082672), FRAC_CONST(0.949528217315674) }, + { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) }, + { FRAC_CONST(0.266712754964828), FRAC_CONST(0.963776051998138) }, + { FRAC_CONST(0.242980122566223), FRAC_CONST(0.970031261444092) }, + { FRAC_CONST(0.219101220369339), FRAC_CONST(0.975702106952667) }, + { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) }, + { FRAC_CONST(0.170961856842041), FRAC_CONST(0.985277652740479) }, + { FRAC_CONST(0.146730497479439), FRAC_CONST(0.989176511764526) }, + { FRAC_CONST(0.122410625219345), FRAC_CONST(0.992479562759399) }, + { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) }, + { FRAC_CONST(0.073564492166042), FRAC_CONST(0.997290432453156) }, + { FRAC_CONST(0.049067649990320), FRAC_CONST(0.998795449733734) }, + { FRAC_CONST(0.024541135877371), FRAC_CONST(0.999698817729950) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(0.998795449733734), FRAC_CONST(0.049067676067352) }, + { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) }, + { FRAC_CONST(0.989176511764526), FRAC_CONST(0.146730467677116) }, + { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) }, + { FRAC_CONST(0.970031261444092), FRAC_CONST(0.242980197072029) }, + { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) }, + { FRAC_CONST(0.941544055938721), FRAC_CONST(0.336889863014221) }, + { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, + { FRAC_CONST(0.903989315032959), FRAC_CONST(0.427555084228516) }, + { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) }, + { FRAC_CONST(0.857728600502014), FRAC_CONST(0.514102756977081) }, + { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) }, + { FRAC_CONST(0.803207516670227), FRAC_CONST(0.595699310302734) }, + { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) }, + { FRAC_CONST(0.740951120853424), FRAC_CONST(0.671558976173401) }, + { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, + { FRAC_CONST(0.671558916568756), FRAC_CONST(0.740951180458069) }, + { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) }, + { FRAC_CONST(0.595699310302734), FRAC_CONST(0.803207516670227) }, + { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) }, + { FRAC_CONST(0.514102697372437), FRAC_CONST(0.857728660106659) }, + { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) }, + { FRAC_CONST(0.427555114030838), FRAC_CONST(0.903989315032959) }, + { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, + { FRAC_CONST(0.336889833211899), FRAC_CONST(0.941544055938721) }, + { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) }, + { FRAC_CONST(0.242980122566223), FRAC_CONST(0.970031261444092) }, + { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) }, + { FRAC_CONST(0.146730497479439), FRAC_CONST(0.989176511764526) }, + { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) }, + { FRAC_CONST(0.049067649990320), FRAC_CONST(0.998795449733734) }, + { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) }, + { FRAC_CONST(-0.049067739397287), FRAC_CONST(0.998795449733734) }, + { FRAC_CONST(-0.098017223179340), FRAC_CONST(0.995184719562531) }, + { FRAC_CONST(-0.146730571985245), FRAC_CONST(0.989176511764526) }, + { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) }, + { FRAC_CONST(-0.242980197072029), FRAC_CONST(0.970031261444092) }, + { FRAC_CONST(-0.290284723043442), FRAC_CONST(0.956940293312073) }, + { FRAC_CONST(-0.336889922618866), FRAC_CONST(0.941544055938721) }, + { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) }, + { FRAC_CONST(-0.427555084228516), FRAC_CONST(0.903989315032959) }, + { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) }, + { FRAC_CONST(-0.514102756977081), FRAC_CONST(0.857728600502014) }, + { FRAC_CONST(-0.555570363998413), FRAC_CONST(0.831469535827637) }, + { FRAC_CONST(-0.595699369907379), FRAC_CONST(0.803207516670227) }, + { FRAC_CONST(-0.634393274784088), FRAC_CONST(0.773010492324829) }, + { FRAC_CONST(-0.671559035778046), FRAC_CONST(0.740951061248779) }, + { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, + { FRAC_CONST(-0.740951240062714), FRAC_CONST(0.671558856964111) }, + { FRAC_CONST(-0.773010492324829), FRAC_CONST(0.634393274784088) }, + { FRAC_CONST(-0.803207635879517), FRAC_CONST(0.595699131488800) }, + { FRAC_CONST(-0.831469655036926), FRAC_CONST(0.555570185184479) }, + { FRAC_CONST(-0.857728600502014), FRAC_CONST(0.514102756977081) }, + { FRAC_CONST(-0.881921350955963), FRAC_CONST(0.471396625041962) }, + { FRAC_CONST(-0.903989315032959), FRAC_CONST(0.427555054426193) }, + { FRAC_CONST(-0.923879623413086), FRAC_CONST(0.382683277130127) }, + { FRAC_CONST(-0.941544115543365), FRAC_CONST(0.336889803409576) }, + { FRAC_CONST(-0.956940352916718), FRAC_CONST(0.290284723043442) }, + { FRAC_CONST(-0.970031261444092), FRAC_CONST(0.242980077862740) }, + { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) }, + { FRAC_CONST(-0.989176511764526), FRAC_CONST(0.146730333566666) }, + { FRAC_CONST(-0.995184719562531), FRAC_CONST(0.098017096519470) }, + { FRAC_CONST(-0.998795449733734), FRAC_CONST(0.049067486077547) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(0.997290432453156), FRAC_CONST(0.073564566671848) }, + { FRAC_CONST(0.989176511764526), FRAC_CONST(0.146730467677116) }, + { FRAC_CONST(0.975702106952667), FRAC_CONST(0.219101235270500) }, + { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) }, + { FRAC_CONST(0.932992815971375), FRAC_CONST(0.359895050525665) }, + { FRAC_CONST(0.903989315032959), FRAC_CONST(0.427555084228516) }, + { FRAC_CONST(0.870086967945099), FRAC_CONST(0.492898225784302) }, + { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) }, + { FRAC_CONST(0.788346469402313), FRAC_CONST(0.615231573581696) }, + { FRAC_CONST(0.740951120853424), FRAC_CONST(0.671558976173401) }, + { FRAC_CONST(0.689540505409241), FRAC_CONST(0.724247097969055) }, + { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) }, + { FRAC_CONST(0.575808227062225), FRAC_CONST(0.817584812641144) }, + { FRAC_CONST(0.514102697372437), FRAC_CONST(0.857728660106659) }, + { FRAC_CONST(0.449611306190491), FRAC_CONST(0.893224298954010) }, + { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, + { FRAC_CONST(0.313681751489639), FRAC_CONST(0.949528157711029) }, + { FRAC_CONST(0.242980241775513), FRAC_CONST(0.970031261444092) }, + { FRAC_CONST(0.170961856842041), FRAC_CONST(0.985277652740479) }, + { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) }, + { FRAC_CONST(0.024541255086660), FRAC_CONST(0.999698817729950) }, + { FRAC_CONST(-0.049067739397287), FRAC_CONST(0.998795449733734) }, + { FRAC_CONST(-0.122410707175732), FRAC_CONST(0.992479503154755) }, + { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) }, + { FRAC_CONST(-0.266712725162506), FRAC_CONST(0.963776051998138) }, + { FRAC_CONST(-0.336889803409576), FRAC_CONST(0.941544055938721) }, + { FRAC_CONST(-0.405241340398788), FRAC_CONST(0.914209723472595) }, + { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) }, + { FRAC_CONST(-0.534997701644897), FRAC_CONST(0.844853520393372) }, + { FRAC_CONST(-0.595699369907379), FRAC_CONST(0.803207516670227) }, + { FRAC_CONST(-0.653172850608826), FRAC_CONST(0.757208824157715) }, + { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, + { FRAC_CONST(-0.757208824157715), FRAC_CONST(0.653172850608826) }, + { FRAC_CONST(-0.803207516670227), FRAC_CONST(0.595699369907379) }, + { FRAC_CONST(-0.844853520393372), FRAC_CONST(0.534997701644897) }, + { FRAC_CONST(-0.881921231746674), FRAC_CONST(0.471396833658218) }, + { FRAC_CONST(-0.914209783077240), FRAC_CONST(0.405241221189499) }, + { FRAC_CONST(-0.941544115543365), FRAC_CONST(0.336889803409576) }, + { FRAC_CONST(-0.963776051998138), FRAC_CONST(0.266712725162506) }, + { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) }, + { FRAC_CONST(-0.992479503154755), FRAC_CONST(0.122410699725151) }, + { FRAC_CONST(-0.998795449733734), FRAC_CONST(0.049067724496126) }, + { FRAC_CONST(-0.999698817729950), FRAC_CONST(-0.024541147053242) }, + { FRAC_CONST(-0.995184719562531), FRAC_CONST(-0.098017267882824) }, + { FRAC_CONST(-0.985277652740479), FRAC_CONST(-0.170961990952492) }, + { FRAC_CONST(-0.970031261444092), FRAC_CONST(-0.242980241775513) }, + { FRAC_CONST(-0.949528157711029), FRAC_CONST(-0.313681781291962) }, + { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) }, + { FRAC_CONST(-0.893224298954010), FRAC_CONST(-0.449611306190491) }, + { FRAC_CONST(-0.857728660106659), FRAC_CONST(-0.514102697372437) }, + { FRAC_CONST(-0.817584872245789), FRAC_CONST(-0.575808107852936) }, + { FRAC_CONST(-0.773010551929474), FRAC_CONST(-0.634393215179443) }, + { FRAC_CONST(-0.724247038364410), FRAC_CONST(-0.689540624618530) }, + { FRAC_CONST(-0.671558916568756), FRAC_CONST(-0.740951180458069) }, + { FRAC_CONST(-0.615231573581696), FRAC_CONST(-0.788346469402313) }, + { FRAC_CONST(-0.555570006370544), FRAC_CONST(-0.831469774246216) }, + { FRAC_CONST(-0.492898195981979), FRAC_CONST(-0.870086967945099) }, + { FRAC_CONST(-0.427554935216904), FRAC_CONST(-0.903989374637604) }, + { FRAC_CONST(-0.359895110130310), FRAC_CONST(-0.932992756366730) }, + { FRAC_CONST(-0.290284544229507), FRAC_CONST(-0.956940352916718) }, + { FRAC_CONST(-0.219101369380951), FRAC_CONST(-0.975702106952667) }, + { FRAC_CONST(-0.146730408072472), FRAC_CONST(-0.989176511764526) }, + { FRAC_CONST(-0.073564760386944), FRAC_CONST(-0.997290432453156) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) }, + { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) }, + { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) }, + { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, + { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) }, + { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) }, + { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) }, + { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, + { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) }, + { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) }, + { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) }, + { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, + { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) }, + { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) }, + { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) }, + { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, + { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) }, + { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, + { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) }, + { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, + { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) }, + { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) }, + { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) }, + { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) }, + { FRAC_CONST(-0.555570363998413), FRAC_CONST(0.831469535827637) }, + { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, + { FRAC_CONST(-0.831469655036926), FRAC_CONST(0.555570185184479) }, + { FRAC_CONST(-0.923879623413086), FRAC_CONST(0.382683277130127) }, + { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) }, + { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) }, + { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) }, + { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, + { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) }, + { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) }, + { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) }, + { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, + { FRAC_CONST(-0.881921231746674), FRAC_CONST(0.471396833658218) }, + { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) }, + { FRAC_CONST(-0.995184719562531), FRAC_CONST(-0.098017267882824) }, + { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) }, + { FRAC_CONST(-0.773010551929474), FRAC_CONST(-0.634393215179443) }, + { FRAC_CONST(-0.555570006370544), FRAC_CONST(-0.831469774246216) }, + { FRAC_CONST(-0.290284544229507), FRAC_CONST(-0.956940352916718) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, + { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, + { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, + { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) }, + { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, + { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, + { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(0.000000011924881), FRAC_CONST(-1.000000000000000) } +}; + +#ifdef ALLOW_SMALL_FRAMELENGTH +ALIGN static const complex_t cfft_tab_240[] = +{ + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(0.999657332897186), FRAC_CONST(0.026176949962974) }, + { FRAC_CONST(0.998629510402679), FRAC_CONST(0.052335958927870) }, + { FRAC_CONST(0.996917307376862), FRAC_CONST(0.078459098935127) }, + { FRAC_CONST(0.994521915912628), FRAC_CONST(0.104528464376926) }, + { FRAC_CONST(0.991444885730743), FRAC_CONST(0.130526199936867) }, + { FRAC_CONST(0.987688362598419), FRAC_CONST(0.156434476375580) }, + { FRAC_CONST(0.983254909515381), FRAC_CONST(0.182235524058342) }, + { FRAC_CONST(0.978147625923157), FRAC_CONST(0.207911700010300) }, + { FRAC_CONST(0.972369909286499), FRAC_CONST(0.233445376157761) }, + { FRAC_CONST(0.965925812721252), FRAC_CONST(0.258819043636322) }, + { FRAC_CONST(0.958819746971130), FRAC_CONST(0.284015357494354) }, + { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) }, + { FRAC_CONST(0.942641496658325), FRAC_CONST(0.333806872367859) }, + { FRAC_CONST(0.933580398559570), FRAC_CONST(0.358367949724197) }, + { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, + { FRAC_CONST(0.913545429706573), FRAC_CONST(0.406736642122269) }, + { FRAC_CONST(0.902585268020630), FRAC_CONST(0.430511116981506) }, + { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) }, + { FRAC_CONST(0.878817081451416), FRAC_CONST(0.477158784866333) }, + { FRAC_CONST(0.866025388240814), FRAC_CONST(0.500000000000000) }, + { FRAC_CONST(0.852640151977539), FRAC_CONST(0.522498548030853) }, + { FRAC_CONST(0.838670551776886), FRAC_CONST(0.544639050960541) }, + { FRAC_CONST(0.824126183986664), FRAC_CONST(0.566406250000000) }, + { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) }, + { FRAC_CONST(0.793353319168091), FRAC_CONST(0.608761429786682) }, + { FRAC_CONST(0.777145922183990), FRAC_CONST(0.629320383071899) }, + { FRAC_CONST(0.760405957698822), FRAC_CONST(0.649448096752167) }, + { FRAC_CONST(0.743144810199738), FRAC_CONST(0.669130623340607) }, + { FRAC_CONST(0.725374400615692), FRAC_CONST(0.688354551792145) }, + { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, + { FRAC_CONST(0.688354551792145), FRAC_CONST(0.725374400615692) }, + { FRAC_CONST(0.669130563735962), FRAC_CONST(0.743144869804382) }, + { FRAC_CONST(0.649448037147522), FRAC_CONST(0.760405957698822) }, + { FRAC_CONST(0.629320383071899), FRAC_CONST(0.777145981788635) }, + { FRAC_CONST(0.608761370182037), FRAC_CONST(0.793353378772736) }, + { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) }, + { FRAC_CONST(0.566406250000000), FRAC_CONST(0.824126183986664) }, + { FRAC_CONST(0.544638991355896), FRAC_CONST(0.838670611381531) }, + { FRAC_CONST(0.522498488426209), FRAC_CONST(0.852640211582184) }, + { FRAC_CONST(0.499999970197678), FRAC_CONST(0.866025447845459) }, + { FRAC_CONST(0.477158755064011), FRAC_CONST(0.878817141056061) }, + { FRAC_CONST(0.453990519046783), FRAC_CONST(0.891006529331207) }, + { FRAC_CONST(0.430511027574539), FRAC_CONST(0.902585327625275) }, + { FRAC_CONST(0.406736612319946), FRAC_CONST(0.913545489311218) }, + { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, + { FRAC_CONST(0.358367860317230), FRAC_CONST(0.933580458164215) }, + { FRAC_CONST(0.333806812763214), FRAC_CONST(0.942641496658325) }, + { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) }, + { FRAC_CONST(0.284015327692032), FRAC_CONST(0.958819746971130) }, + { FRAC_CONST(0.258819073438644), FRAC_CONST(0.965925812721252) }, + { FRAC_CONST(0.233445301651955), FRAC_CONST(0.972369909286499) }, + { FRAC_CONST(0.207911655306816), FRAC_CONST(0.978147625923157) }, + { FRAC_CONST(0.182235524058342), FRAC_CONST(0.983254909515381) }, + { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) }, + { FRAC_CONST(0.130526125431061), FRAC_CONST(0.991444885730743) }, + { FRAC_CONST(0.104528419673443), FRAC_CONST(0.994521915912628) }, + { FRAC_CONST(0.078459084033966), FRAC_CONST(0.996917307376862) }, + { FRAC_CONST(0.052335973829031), FRAC_CONST(0.998629510402679) }, + { FRAC_CONST(0.026176875457168), FRAC_CONST(0.999657332897186) }, + { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) }, + { FRAC_CONST(-0.026176963001490), FRAC_CONST(0.999657332897186) }, + { FRAC_CONST(-0.052336059510708), FRAC_CONST(0.998629510402679) }, + { FRAC_CONST(-0.078459173440933), FRAC_CONST(0.996917307376862) }, + { FRAC_CONST(-0.104528509080410), FRAC_CONST(0.994521915912628) }, + { FRAC_CONST(-0.130526214838028), FRAC_CONST(0.991444885730743) }, + { FRAC_CONST(-0.156434446573257), FRAC_CONST(0.987688362598419) }, + { FRAC_CONST(-0.182235598564148), FRAC_CONST(0.983254909515381) }, + { FRAC_CONST(-0.207911744713783), FRAC_CONST(0.978147566318512) }, + { FRAC_CONST(-0.233445391058922), FRAC_CONST(0.972369909286499) }, + { FRAC_CONST(-0.258819162845612), FRAC_CONST(0.965925812721252) }, + { FRAC_CONST(-0.284015417098999), FRAC_CONST(0.958819687366486) }, + { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) }, + { FRAC_CONST(-0.333806872367859), FRAC_CONST(0.942641496658325) }, + { FRAC_CONST(-0.358367949724197), FRAC_CONST(0.933580458164215) }, + { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) }, + { FRAC_CONST(-0.406736701726913), FRAC_CONST(0.913545429706573) }, + { FRAC_CONST(-0.430511116981506), FRAC_CONST(0.902585268020630) }, + { FRAC_CONST(-0.453990608453751), FRAC_CONST(0.891006469726563) }, + { FRAC_CONST(-0.477158725261688), FRAC_CONST(0.878817141056061) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(0.998629510402679), FRAC_CONST(0.052335958927870) }, + { FRAC_CONST(0.994521915912628), FRAC_CONST(0.104528464376926) }, + { FRAC_CONST(0.987688362598419), FRAC_CONST(0.156434476375580) }, + { FRAC_CONST(0.978147625923157), FRAC_CONST(0.207911700010300) }, + { FRAC_CONST(0.965925812721252), FRAC_CONST(0.258819043636322) }, + { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) }, + { FRAC_CONST(0.933580398559570), FRAC_CONST(0.358367949724197) }, + { FRAC_CONST(0.913545429706573), FRAC_CONST(0.406736642122269) }, + { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) }, + { FRAC_CONST(0.866025388240814), FRAC_CONST(0.500000000000000) }, + { FRAC_CONST(0.838670551776886), FRAC_CONST(0.544639050960541) }, + { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) }, + { FRAC_CONST(0.777145922183990), FRAC_CONST(0.629320383071899) }, + { FRAC_CONST(0.743144810199738), FRAC_CONST(0.669130623340607) }, + { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, + { FRAC_CONST(0.669130563735962), FRAC_CONST(0.743144869804382) }, + { FRAC_CONST(0.629320383071899), FRAC_CONST(0.777145981788635) }, + { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) }, + { FRAC_CONST(0.544638991355896), FRAC_CONST(0.838670611381531) }, + { FRAC_CONST(0.499999970197678), FRAC_CONST(0.866025447845459) }, + { FRAC_CONST(0.453990519046783), FRAC_CONST(0.891006529331207) }, + { FRAC_CONST(0.406736612319946), FRAC_CONST(0.913545489311218) }, + { FRAC_CONST(0.358367860317230), FRAC_CONST(0.933580458164215) }, + { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) }, + { FRAC_CONST(0.258819073438644), FRAC_CONST(0.965925812721252) }, + { FRAC_CONST(0.207911655306816), FRAC_CONST(0.978147625923157) }, + { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) }, + { FRAC_CONST(0.104528419673443), FRAC_CONST(0.994521915912628) }, + { FRAC_CONST(0.052335973829031), FRAC_CONST(0.998629510402679) }, + { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) }, + { FRAC_CONST(-0.052336059510708), FRAC_CONST(0.998629510402679) }, + { FRAC_CONST(-0.104528509080410), FRAC_CONST(0.994521915912628) }, + { FRAC_CONST(-0.156434446573257), FRAC_CONST(0.987688362598419) }, + { FRAC_CONST(-0.207911744713783), FRAC_CONST(0.978147566318512) }, + { FRAC_CONST(-0.258819162845612), FRAC_CONST(0.965925812721252) }, + { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) }, + { FRAC_CONST(-0.358367949724197), FRAC_CONST(0.933580458164215) }, + { FRAC_CONST(-0.406736701726913), FRAC_CONST(0.913545429706573) }, + { FRAC_CONST(-0.453990608453751), FRAC_CONST(0.891006469726563) }, + { FRAC_CONST(-0.500000059604645), FRAC_CONST(0.866025388240814) }, + { FRAC_CONST(-0.544639050960541), FRAC_CONST(0.838670551776886) }, + { FRAC_CONST(-0.587785184383392), FRAC_CONST(0.809017002582550) }, + { FRAC_CONST(-0.629320502281189), FRAC_CONST(0.777145862579346) }, + { FRAC_CONST(-0.669130682945251), FRAC_CONST(0.743144810199738) }, + { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, + { FRAC_CONST(-0.743144929409027), FRAC_CONST(0.669130444526672) }, + { FRAC_CONST(-0.777146041393280), FRAC_CONST(0.629320263862610) }, + { FRAC_CONST(-0.809017062187195), FRAC_CONST(0.587785184383392) }, + { FRAC_CONST(-0.838670551776886), FRAC_CONST(0.544639050960541) }, + { FRAC_CONST(-0.866025388240814), FRAC_CONST(0.500000059604645) }, + { FRAC_CONST(-0.891006588935852), FRAC_CONST(0.453990370035172) }, + { FRAC_CONST(-0.913545489311218), FRAC_CONST(0.406736582517624) }, + { FRAC_CONST(-0.933580458164215), FRAC_CONST(0.358367919921875) }, + { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) }, + { FRAC_CONST(-0.965925872325897), FRAC_CONST(0.258818924427032) }, + { FRAC_CONST(-0.978147625923157), FRAC_CONST(0.207911610603333) }, + { FRAC_CONST(-0.987688362598419), FRAC_CONST(0.156434446573257) }, + { FRAC_CONST(-0.994521915912628), FRAC_CONST(0.104528494179249) }, + { FRAC_CONST(-0.998629570007324), FRAC_CONST(0.052335809916258) }, + { FRAC_CONST(-1.000000000000000), FRAC_CONST(-0.000000087422777) }, + { FRAC_CONST(-0.998629510402679), FRAC_CONST(-0.052335985004902) }, + { FRAC_CONST(-0.994521856307983), FRAC_CONST(-0.104528672993183) }, + { FRAC_CONST(-0.987688302993774), FRAC_CONST(-0.156434610486031) }, + { FRAC_CONST(-0.978147566318512), FRAC_CONST(-0.207911789417267) }, + { FRAC_CONST(-0.965925812721252), FRAC_CONST(-0.258819073438644) }, + { FRAC_CONST(-0.951056540012360), FRAC_CONST(-0.309016972780228) }, + { FRAC_CONST(-0.933580398559570), FRAC_CONST(-0.358368098735809) }, + { FRAC_CONST(-0.913545429706573), FRAC_CONST(-0.406736731529236) }, + { FRAC_CONST(-0.891006529331207), FRAC_CONST(-0.453990548849106) }, + { FRAC_CONST(-0.866025269031525), FRAC_CONST(-0.500000178813934) }, + { FRAC_CONST(-0.838670492172241), FRAC_CONST(-0.544639170169830) }, + { FRAC_CONST(-0.809016942977905), FRAC_CONST(-0.587785363197327) }, + { FRAC_CONST(-0.777145922183990), FRAC_CONST(-0.629320442676544) }, + { FRAC_CONST(-0.743144810199738), FRAC_CONST(-0.669130623340607) }, + { FRAC_CONST(-0.707106649875641), FRAC_CONST(-0.707106888294220) }, + { FRAC_CONST(-0.669130504131317), FRAC_CONST(-0.743144869804382) }, + { FRAC_CONST(-0.629320323467255), FRAC_CONST(-0.777145981788635) }, + { FRAC_CONST(-0.587785065174103), FRAC_CONST(-0.809017121791840) }, + { FRAC_CONST(-0.544639110565186), FRAC_CONST(-0.838670551776886) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(0.996917307376862), FRAC_CONST(0.078459098935127) }, + { FRAC_CONST(0.987688362598419), FRAC_CONST(0.156434476375580) }, + { FRAC_CONST(0.972369909286499), FRAC_CONST(0.233445376157761) }, + { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) }, + { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, + { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) }, + { FRAC_CONST(0.852640151977539), FRAC_CONST(0.522498548030853) }, + { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) }, + { FRAC_CONST(0.760405957698822), FRAC_CONST(0.649448096752167) }, + { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, + { FRAC_CONST(0.649448037147522), FRAC_CONST(0.760405957698822) }, + { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) }, + { FRAC_CONST(0.522498488426209), FRAC_CONST(0.852640211582184) }, + { FRAC_CONST(0.453990519046783), FRAC_CONST(0.891006529331207) }, + { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, + { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) }, + { FRAC_CONST(0.233445301651955), FRAC_CONST(0.972369909286499) }, + { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) }, + { FRAC_CONST(0.078459084033966), FRAC_CONST(0.996917307376862) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(0.987688362598419), FRAC_CONST(0.156434476375580) }, + { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) }, + { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) }, + { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) }, + { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, + { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) }, + { FRAC_CONST(0.453990519046783), FRAC_CONST(0.891006529331207) }, + { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) }, + { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) }, + { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) }, + { FRAC_CONST(-0.156434446573257), FRAC_CONST(0.987688362598419) }, + { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) }, + { FRAC_CONST(-0.453990608453751), FRAC_CONST(0.891006469726563) }, + { FRAC_CONST(-0.587785184383392), FRAC_CONST(0.809017002582550) }, + { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, + { FRAC_CONST(-0.809017062187195), FRAC_CONST(0.587785184383392) }, + { FRAC_CONST(-0.891006588935852), FRAC_CONST(0.453990370035172) }, + { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) }, + { FRAC_CONST(-0.987688362598419), FRAC_CONST(0.156434446573257) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(0.972369909286499), FRAC_CONST(0.233445376157761) }, + { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) }, + { FRAC_CONST(0.760405957698822), FRAC_CONST(0.649448096752167) }, + { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) }, + { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, + { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) }, + { FRAC_CONST(-0.078459173440933), FRAC_CONST(0.996917307376862) }, + { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) }, + { FRAC_CONST(-0.522498667240143), FRAC_CONST(0.852640092372894) }, + { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, + { FRAC_CONST(-0.852640211582184), FRAC_CONST(0.522498488426209) }, + { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) }, + { FRAC_CONST(-0.996917366981506), FRAC_CONST(0.078459039330482) }, + { FRAC_CONST(-0.987688302993774), FRAC_CONST(-0.156434610486031) }, + { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) }, + { FRAC_CONST(-0.809016942977905), FRAC_CONST(-0.587785363197327) }, + { FRAC_CONST(-0.649447917938232), FRAC_CONST(-0.760406076908112) }, + { FRAC_CONST(-0.453990221023560), FRAC_CONST(-0.891006648540497) }, + { FRAC_CONST(-0.233445450663567), FRAC_CONST(-0.972369909286499) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) }, + { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) }, + { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) }, + { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) }, + { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) }, + { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) }, + { FRAC_CONST(-0.809017062187195), FRAC_CONST(0.587785184383392) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) }, + { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) }, + { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) }, + { FRAC_CONST(-0.809016942977905), FRAC_CONST(-0.587785363197327) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(0.309017121791840), FRAC_CONST(-0.951056480407715) } +}; +#endif + +#endif + +ALIGN static const complex_t cfft_tab_128[] = +{ + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(0.998795449733734), FRAC_CONST(0.049067676067352) }, + { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) }, + { FRAC_CONST(0.989176511764526), FRAC_CONST(0.146730467677116) }, + { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) }, + { FRAC_CONST(0.970031261444092), FRAC_CONST(0.242980197072029) }, + { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) }, + { FRAC_CONST(0.941544055938721), FRAC_CONST(0.336889863014221) }, + { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, + { FRAC_CONST(0.903989315032959), FRAC_CONST(0.427555084228516) }, + { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) }, + { FRAC_CONST(0.857728600502014), FRAC_CONST(0.514102756977081) }, + { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) }, + { FRAC_CONST(0.803207516670227), FRAC_CONST(0.595699310302734) }, + { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) }, + { FRAC_CONST(0.740951120853424), FRAC_CONST(0.671558976173401) }, + { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, + { FRAC_CONST(0.671558916568756), FRAC_CONST(0.740951180458069) }, + { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) }, + { FRAC_CONST(0.595699310302734), FRAC_CONST(0.803207516670227) }, + { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) }, + { FRAC_CONST(0.514102697372437), FRAC_CONST(0.857728660106659) }, + { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) }, + { FRAC_CONST(0.427555114030838), FRAC_CONST(0.903989315032959) }, + { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, + { FRAC_CONST(0.336889833211899), FRAC_CONST(0.941544055938721) }, + { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) }, + { FRAC_CONST(0.242980122566223), FRAC_CONST(0.970031261444092) }, + { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) }, + { FRAC_CONST(0.146730497479439), FRAC_CONST(0.989176511764526) }, + { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) }, + { FRAC_CONST(0.049067649990320), FRAC_CONST(0.998795449733734) }, + { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) }, + { FRAC_CONST(-0.049067739397287), FRAC_CONST(0.998795449733734) }, + { FRAC_CONST(-0.098017223179340), FRAC_CONST(0.995184719562531) }, + { FRAC_CONST(-0.146730571985245), FRAC_CONST(0.989176511764526) }, + { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) }, + { FRAC_CONST(-0.242980197072029), FRAC_CONST(0.970031261444092) }, + { FRAC_CONST(-0.290284723043442), FRAC_CONST(0.956940293312073) }, + { FRAC_CONST(-0.336889922618866), FRAC_CONST(0.941544055938721) }, + { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) }, + { FRAC_CONST(-0.427555084228516), FRAC_CONST(0.903989315032959) }, + { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) }, + { FRAC_CONST(-0.514102756977081), FRAC_CONST(0.857728600502014) }, + { FRAC_CONST(-0.555570363998413), FRAC_CONST(0.831469535827637) }, + { FRAC_CONST(-0.595699369907379), FRAC_CONST(0.803207516670227) }, + { FRAC_CONST(-0.634393274784088), FRAC_CONST(0.773010492324829) }, + { FRAC_CONST(-0.671559035778046), FRAC_CONST(0.740951061248779) }, + { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, + { FRAC_CONST(-0.740951240062714), FRAC_CONST(0.671558856964111) }, + { FRAC_CONST(-0.773010492324829), FRAC_CONST(0.634393274784088) }, + { FRAC_CONST(-0.803207635879517), FRAC_CONST(0.595699131488800) }, + { FRAC_CONST(-0.831469655036926), FRAC_CONST(0.555570185184479) }, + { FRAC_CONST(-0.857728600502014), FRAC_CONST(0.514102756977081) }, + { FRAC_CONST(-0.881921350955963), FRAC_CONST(0.471396625041962) }, + { FRAC_CONST(-0.903989315032959), FRAC_CONST(0.427555054426193) }, + { FRAC_CONST(-0.923879623413086), FRAC_CONST(0.382683277130127) }, + { FRAC_CONST(-0.941544115543365), FRAC_CONST(0.336889803409576) }, + { FRAC_CONST(-0.956940352916718), FRAC_CONST(0.290284723043442) }, + { FRAC_CONST(-0.970031261444092), FRAC_CONST(0.242980077862740) }, + { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) }, + { FRAC_CONST(-0.989176511764526), FRAC_CONST(0.146730333566666) }, + { FRAC_CONST(-0.995184719562531), FRAC_CONST(0.098017096519470) }, + { FRAC_CONST(-0.998795449733734), FRAC_CONST(0.049067486077547) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) }, + { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) }, + { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) }, + { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, + { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) }, + { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) }, + { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) }, + { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, + { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) }, + { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) }, + { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) }, + { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, + { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) }, + { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) }, + { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) }, + { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, + { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) }, + { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, + { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) }, + { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, + { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) }, + { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) }, + { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) }, + { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) }, + { FRAC_CONST(-0.555570363998413), FRAC_CONST(0.831469535827637) }, + { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, + { FRAC_CONST(-0.831469655036926), FRAC_CONST(0.555570185184479) }, + { FRAC_CONST(-0.923879623413086), FRAC_CONST(0.382683277130127) }, + { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) }, + { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) }, + { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) }, + { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, + { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) }, + { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) }, + { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) }, + { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, + { FRAC_CONST(-0.881921231746674), FRAC_CONST(0.471396833658218) }, + { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) }, + { FRAC_CONST(-0.995184719562531), FRAC_CONST(-0.098017267882824) }, + { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) }, + { FRAC_CONST(-0.773010551929474), FRAC_CONST(-0.634393215179443) }, + { FRAC_CONST(-0.555570006370544), FRAC_CONST(-0.831469774246216) }, + { FRAC_CONST(-0.290284544229507), FRAC_CONST(-0.956940352916718) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) }, + { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, + { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) }, + { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) }, + { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) }, + { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) }, + { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) }, + { FRAC_CONST(0.000000011924881), FRAC_CONST(-1.000000000000000) } +}; + +#endif + +#ifdef __cplusplus +} +#endif +#endif diff --git a/Libraries/FAAD2/Files/libfaad/codebook/hcb.h b/Libraries/FAAD2/Files/libfaad/codebook/hcb.h new file mode 100644 index 000000000..eaefdbf43 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/codebook/hcb.h @@ -0,0 +1,142 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#ifndef __HCB_H__ +#define __HCB_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Optimal huffman decoding for AAC taken from: + * "SELECTING AN OPTIMAL HUFFMAN DECODER FOR AAC" by + * VLADIMIR Z. MESAROVIC , RAGHUNATH RAO, MIROSLAV V. DOKIC, and SACHIN DEO + * AES paper 5436 + * + * 2 methods are used for huffman decoding: + * - binary search + * - 2-step table lookup + * + * The choice of the "optimal" method is based on the fact that if the + * memory size for the Two-step is exorbitantly high then the decision + * is Binary search for that codebook. However, for marginally more memory + * size, if Twostep outperforms even the best case of Binary then the + * decision is Two-step for that codebook. + * + * The following methods are used for the different tables. + * codebook "optimal" method + * HCB_1 2-Step + * HCB_2 2-Step + * HCB_3 Binary + * HCB_4 2-Step + * HCB_5 Binary + * HCB_6 2-Step + * HCB_7 Binary + * HCB_8 2-Step + * HCB_9 Binary + * HCB_10 2-Step + * HCB_11 2-Step + * HCB_SF Binary + * + */ + + +#define ZERO_HCB 0 +#define FIRST_PAIR_HCB 5 +#define ESC_HCB 11 +#define QUAD_LEN 4 +#define PAIR_LEN 2 +#define NOISE_HCB 13 +#define INTENSITY_HCB2 14 +#define INTENSITY_HCB 15 + +/* 1st step table */ +typedef struct +{ + uint8_t offset; + uint8_t extra_bits; +} hcb; + +/* 2nd step table with quadruple data */ +typedef struct +{ + uint8_t bits; + int8_t x; + int8_t y; +} hcb_2_pair; + +typedef struct +{ + uint8_t bits; + int8_t x; + int8_t y; + int8_t v; + int8_t w; +} hcb_2_quad; + +/* binary search table */ +typedef struct +{ + uint8_t is_leaf; + int8_t data[4]; +} hcb_bin_quad; + +typedef struct +{ + uint8_t is_leaf; + int8_t data[2]; +} hcb_bin_pair; + +hcb *hcb_table[]; +hcb_2_quad *hcb_2_quad_table[]; +hcb_2_pair *hcb_2_pair_table[]; +hcb_bin_pair *hcb_bin_table[]; +uint8_t hcbN[]; +uint8_t unsigned_cb[]; +int hcb_2_quad_table_size[]; +int hcb_2_pair_table_size[]; +int hcb_bin_table_size[]; + +#include "codebook/hcb_1.h" +#include "codebook/hcb_2.h" +#include "codebook/hcb_3.h" +#include "codebook/hcb_4.h" +#include "codebook/hcb_5.h" +#include "codebook/hcb_6.h" +#include "codebook/hcb_7.h" +#include "codebook/hcb_8.h" +#include "codebook/hcb_9.h" +#include "codebook/hcb_10.h" +#include "codebook/hcb_11.h" +#include "codebook/hcb_sf.h" + + +#ifdef __cplusplus +} +#endif +#endif diff --git a/Libraries/FAAD2/Files/libfaad/codebook/hcb_1.h b/Libraries/FAAD2/Files/libfaad/codebook/hcb_1.h new file mode 100644 index 000000000..610e578ef --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/codebook/hcb_1.h @@ -0,0 +1,183 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +/* 2-step huffman table HCB_1 */ + + +/* 1st step: 5 bits + * 2^5 = 32 entries + * + * Used to find offset into 2nd step table and number of extra bits to get + */ +static hcb hcb1_1[] = { + { /* 00000 */ 0, 0 }, + { /* */ 0, 0 }, + { /* */ 0, 0 }, + { /* */ 0, 0 }, + { /* */ 0, 0 }, + { /* */ 0, 0 }, + { /* */ 0, 0 }, + { /* */ 0, 0 }, + { /* */ 0, 0 }, + { /* */ 0, 0 }, + { /* */ 0, 0 }, + { /* */ 0, 0 }, + { /* */ 0, 0 }, + { /* */ 0, 0 }, + { /* */ 0, 0 }, + { /* */ 0, 0 }, + { /* 10000 */ 1, 0 }, + { /* 10001 */ 2, 0 }, + { /* 10010 */ 3, 0 }, + { /* 10011 */ 4, 0 }, + { /* 10100 */ 5, 0 }, + { /* 10101 */ 6, 0 }, + { /* 10110 */ 7, 0 }, + { /* 10111 */ 8, 0 }, + + /* 7 bit codewords */ + { /* 11000 */ 9, 2 }, + { /* 11001 */ 13, 2 }, + { /* 11010 */ 17, 2 }, + { /* 11011 */ 21, 2 }, + { /* 11100 */ 25, 2 }, + { /* 11101 */ 29, 2 }, + + /* 9 bit codewords */ + { /* 11110 */ 33, 4 }, + + /* 9/10/11 bit codewords */ + { /* 11111 */ 49, 6 } +}; + +/* 2nd step table + * + * Gives size of codeword and actual data (x,y,v,w) + */ +static hcb_2_quad hcb1_2[] = { + /* 1 bit codeword */ + { 1, 0, 0, 0, 0 }, + + /* 5 bit codewords */ + { 5, 1, 0, 0, 0 }, + { 5, -1, 0, 0, 0 }, + { 5, 0, 0, 0, -1 }, + { 5, 0, 1, 0, 0 }, + { 5, 0, 0, 0, 1 }, + { 5, 0, 0, -1, 0 }, + { 5, 0, 0, 1, 0 }, + { 5, 0, -1, 0, 0 }, + + /* 7 bit codewords */ + /* first 5 bits: 11000 */ + { 7, 1, -1, 0, 0 }, + { 7, -1, 1, 0, 0 }, + { 7, 0, 0, -1, 1 }, + { 7, 0, 1, -1, 0 }, + /* first 5 bits: 11001 */ + { 7, 0, -1, 1, 0 }, + { 7, 0, 0, 1, -1 }, + { 7, 1, 1, 0, 0 }, + { 7, 0, 0, -1, -1 }, + /* first 5 bits: 11010 */ + { 7, -1, -1, 0, 0 }, + { 7, 0, -1, -1, 0 }, + { 7, 1, 0, -1, 0 }, + { 7, 0, 1, 0, -1 }, + /* first 5 bits: 11011 */ + { 7, -1, 0, 1, 0 }, + { 7, 0, 0, 1, 1 }, + { 7, 1, 0, 1, 0 }, + { 7, 0, -1, 0, 1 }, + /* first 5 bits: 11100 */ + { 7, 0, 1, 1, 0 }, + { 7, 0, 1, 0, 1 }, + { 7, -1, 0, -1, 0 }, + { 7, 1, 0, 0, 1 }, + /* first 5 bits: 11101 */ + { 7, -1, 0, 0, -1 }, + { 7, 1, 0, 0, -1 }, + { 7, -1, 0, 0, 1 }, + { 7, 0, -1, 0, -1 }, + + /* 9 bit codeword */ + /* first 5 bits: 11110 */ + { 9, 1, 1, -1, 0 }, + { 9, -1, 1, -1, 0 }, + { 9, 1, -1, 1, 0 }, + { 9, 0, 1, 1, -1 }, + { 9, 0, 1, -1, 1 }, + { 9, 0, -1, 1, 1 }, + { 9, 0, -1, 1, -1 }, + { 9, 1, -1, -1, 0 }, + { 9, 1, 0, -1, 1 }, + { 9, 0, 1, -1, -1 }, + { 9, -1, 1, 1, 0 }, + { 9, -1, 0, 1, -1 }, + { 9, -1, -1, 1, 0 }, + { 9, 0, -1, -1, 1 }, + { 9, 1, -1, 0, 1 }, + { 9, 1, -1, 0, -1 }, + + /* 9/10/11 bit codewords */ + /* first 5 bits: 11111 */ + /* 9 bit: reading 11 bits -> 2 too much so 4 entries for each codeword */ + { 9, -1, 1, 0, -1 }, { 9, -1, 1, 0, -1 }, { 9, -1, 1, 0, -1 }, { 9, -1, 1, 0, -1 }, + { 9, -1, -1, -1, 0 }, { 9, -1, -1, -1, 0 }, { 9, -1, -1, -1, 0 }, { 9, -1, -1, -1, 0 }, + { 9, 0, -1, -1, -1 }, { 9, 0, -1, -1, -1 }, { 9, 0, -1, -1, -1 }, { 9, 0, -1, -1, -1 }, + { 9, 0, 1, 1, 1 }, { 9, 0, 1, 1, 1 }, { 9, 0, 1, 1, 1 }, { 9, 0, 1, 1, 1 }, + { 9, 1, 0, 1, -1 }, { 9, 1, 0, 1, -1 }, { 9, 1, 0, 1, -1 }, { 9, 1, 0, 1, -1 }, + { 9, 1, 1, 0, 1 }, { 9, 1, 1, 0, 1 }, { 9, 1, 1, 0, 1 }, { 9, 1, 1, 0, 1 }, + { 9, -1, 1, 0, 1 }, { 9, -1, 1, 0, 1 }, { 9, -1, 1, 0, 1 }, { 9, -1, 1, 0, 1 }, + { 9, 1, 1, 1, 0 }, { 9, 1, 1, 1, 0 }, { 9, 1, 1, 1, 0 }, { 9, 1, 1, 1, 0 }, + /* 10 bit: reading 11 bits -> 1 too much so 2 entries for each codeword */ + { 10, -1, -1, 0, 1 }, { 10, -1, -1, 0, 1 }, + { 10, -1, 0, -1, -1 }, { 10, -1, 0, -1, -1 }, + { 10, 1, 1, 0, -1 }, { 10, 1, 1, 0, -1 }, + { 10, 1, 0, -1, -1 }, { 10, 1, 0, -1, -1 }, + { 10, -1, 0, -1, 1 }, { 10, -1, 0, -1, 1 }, + { 10, -1, -1, 0, -1 }, { 10, -1, -1, 0, -1 }, + { 10, -1, 0, 1, 1 }, { 10, -1, 0, 1, 1 }, + { 10, 1, 0, 1, 1 }, { 10, 1, 0, 1, 1 }, + /* 11 bit */ + { 11, 1, -1, 1, -1 }, + { 11, -1, 1, -1, 1 }, + { 11, -1, 1, 1, -1 }, + { 11, 1, -1, -1, 1 }, + { 11, 1, 1, 1, 1 }, + { 11, -1, -1, 1, 1 }, + { 11, 1, 1, -1, -1 }, + { 11, -1, -1, 1, -1 }, + { 11, -1, -1, -1, -1 }, + { 11, 1, 1, -1, 1 }, + { 11, 1, -1, 1, 1 }, + { 11, -1, 1, 1, 1 }, + { 11, -1, 1, -1, -1 }, + { 11, -1, -1, -1, 1 }, + { 11, 1, -1, -1, -1 }, + { 11, 1, 1, 1, -1 } +}; diff --git a/Libraries/FAAD2/Files/libfaad/codebook/hcb_10.h b/Libraries/FAAD2/Files/libfaad/codebook/hcb_10.h new file mode 100644 index 000000000..7f1b6a4d7 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/codebook/hcb_10.h @@ -0,0 +1,309 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +/* 2-step huffman table HCB_10 */ + + +/* 1st step: 6 bits + * 2^6 = 64 entries + * + * Used to find offset into 2nd step table and number of extra bits to get + */ +static hcb hcb10_1[] = { + /* 4 bit codewords */ + { /* 000000 */ 0, 0 }, + { /* */ 0, 0 }, + { /* */ 0, 0 }, + { /* */ 0, 0 }, + { /* 000100 */ 1, 0 }, + { /* */ 1, 0 }, + { /* */ 1, 0 }, + { /* */ 1, 0 }, + { /* 001000 */ 2, 0 }, + { /* */ 2, 0 }, + { /* */ 2, 0 }, + { /* */ 2, 0 }, + /* 5 bit codewords */ + { /* 001100 */ 3, 0 }, + { /* */ 3, 0 }, + { /* 001110 */ 4, 0 }, + { /* */ 4, 0 }, + { /* 010000 */ 5, 0 }, + { /* */ 5, 0 }, + { /* 010010 */ 6, 0 }, + { /* */ 6, 0 }, + { /* 010100 */ 7, 0 }, + { /* */ 7, 0 }, + { /* 010110 */ 8, 0 }, + { /* */ 8, 0 }, + { /* 011000 */ 9, 0 }, + { /* */ 9, 0 }, + { /* 011010 */ 10, 0 }, + { /* */ 10, 0 }, + /* 6 bit codewords */ + { /* 011100 */ 11, 0 }, + { /* 011101 */ 12, 0 }, + { /* 011110 */ 13, 0 }, + { /* 011111 */ 14, 0 }, + { /* 100000 */ 15, 0 }, + { /* 100001 */ 16, 0 }, + { /* 100010 */ 17, 0 }, + { /* 100011 */ 18, 0 }, + { /* 100100 */ 19, 0 }, + { /* 100101 */ 20, 0 }, + { /* 100110 */ 21, 0 }, + { /* 100111 */ 22, 0 }, + { /* 101000 */ 23, 0 }, + { /* 101001 */ 24, 0 }, + /* 7 bit codewords */ + { /* 101010 */ 25, 1 }, + { /* 101011 */ 27, 1 }, + { /* 101100 */ 29, 1 }, + { /* 101101 */ 31, 1 }, + { /* 101110 */ 33, 1 }, + { /* 101111 */ 35, 1 }, + { /* 110000 */ 37, 1 }, + { /* 110001 */ 39, 1 }, + /* 7/8 bit codewords */ + { /* 110010 */ 41, 2 }, + /* 8 bit codewords */ + { /* 110011 */ 45, 2 }, + { /* 110100 */ 49, 2 }, + { /* 110101 */ 53, 2 }, + { /* 110110 */ 57, 2 }, + { /* 110111 */ 61, 2 }, + /* 8/9 bit codewords */ + { /* 111000 */ 65, 3 }, + /* 9 bit codewords */ + { /* 111001 */ 73, 3 }, + { /* 111010 */ 81, 3 }, + { /* 111011 */ 89, 3 }, + /* 9/10 bit codewords */ + { /* 111100 */ 97, 4 }, + /* 10 bit codewords */ + { /* 111101 */ 113, 4 }, + { /* 111110 */ 129, 4 }, + /* 10/11/12 bit codewords */ + { /* 111111 */ 145, 6 } +}; + +/* 2nd step table + * + * Gives size of codeword and actual data (x,y,v,w) + */ +static hcb_2_pair hcb10_2[] = { + /* 4 bit codewords */ + { 4, 1, 1 }, + { 4, 1, 2 }, + { 4, 2, 1 }, + + /* 5 bit codewords */ + { 5, 2, 2 }, + { 5, 1, 0 }, + { 5, 0, 1 }, + { 5, 1, 3 }, + { 5, 3, 2 }, + { 5, 3, 1 }, + { 5, 2, 3 }, + { 5, 3, 3 }, + + /* 6 bit codewords */ + { 6, 2, 0 }, + { 6, 0, 2 }, + { 6, 2, 4 }, + { 6, 4, 2 }, + { 6, 1, 4 }, + { 6, 4, 1 }, + { 6, 0, 0 }, + { 6, 4, 3 }, + { 6, 3, 4 }, + { 6, 3, 0 }, + { 6, 0, 3 }, + { 6, 4, 4 }, + { 6, 2, 5 }, + { 6, 5, 2 }, + + /* 7 bit codewords */ + { 7, 1, 5 }, + { 7, 5, 1 }, + { 7, 5, 3 }, + { 7, 3, 5 }, + { 7, 5, 4 }, + { 7, 4, 5 }, + { 7, 6, 2 }, + { 7, 2, 6 }, + { 7, 6, 3 }, + { 7, 4, 0 }, + { 7, 6, 1 }, + { 7, 0, 4 }, + { 7, 1, 6 }, + { 7, 3, 6 }, + { 7, 5, 5 }, + { 7, 6, 4 }, + + /* 7/8 bit codewords */ + { 7, 4, 6 }, { 7, 4, 6 }, + { 8, 6, 5 }, + { 8, 7, 2 }, + + /* 8 bit codewords */ + { 8, 3, 7 }, + { 8, 2, 7 }, + { 8, 5, 6 }, + { 8, 8, 2 }, + { 8, 7, 3 }, + { 8, 5, 0 }, + { 8, 7, 1 }, + { 8, 0, 5 }, + { 8, 8, 1 }, + { 8, 1, 7 }, + { 8, 8, 3 }, + { 8, 7, 4 }, + { 8, 4, 7 }, + { 8, 2, 8 }, + { 8, 6, 6 }, + { 8, 7, 5 }, + { 8, 1, 8 }, + { 8, 3, 8 }, + { 8, 8, 4 }, + { 8, 4, 8 }, + + /* 8/9 bit codewords */ + { 8, 5, 7 }, { 8, 5, 7 }, + { 8, 8, 5 }, { 8, 8, 5 }, + { 8, 5, 8 }, { 8, 5, 8 }, + { 9, 7, 6 }, + { 9, 6, 7 }, + + /* 9 bit codewords */ + { 9, 9, 2 }, + { 9, 6, 0 }, + { 9, 6, 8 }, + { 9, 9, 3 }, + { 9, 3, 9 }, + { 9, 9, 1 }, + { 9, 2, 9 }, + { 9, 0, 6 }, + { 9, 8, 6 }, + { 9, 9, 4 }, + { 9, 4, 9 }, + { 9, 10, 2 }, + { 9, 1, 9 }, + { 9, 7, 7 }, + { 9, 8, 7 }, + { 9, 9, 5 }, + { 9, 7, 8 }, + { 9, 10, 3 }, + { 9, 5, 9 }, + { 9, 10, 4 }, + { 9, 2, 10 }, + { 9, 10, 1 }, + { 9, 3, 10 }, + { 9, 9, 6 }, + + /* 9/10 bit codewords */ + { 9, 6, 9 }, { 9, 6, 9 }, + { 9, 8, 0 }, { 9, 8, 0 }, + { 9, 4, 10 }, { 9, 4, 10 }, + { 9, 7, 0 }, { 9, 7, 0 }, + { 9, 11, 2 }, { 9, 11, 2 }, + { 10, 7, 9 }, + { 10, 11, 3 }, + { 10, 10, 6 }, + { 10, 1, 10 }, + { 10, 11, 1 }, + { 10, 9, 7 }, + + /* 10 bit codewords */ + { 10, 0, 7 }, + { 10, 8, 8 }, + { 10, 10, 5 }, + { 10, 3, 11 }, + { 10, 5, 10 }, + { 10, 8, 9 }, + { 10, 11, 5 }, + { 10, 0, 8 }, + { 10, 11, 4 }, + { 10, 2, 11 }, + { 10, 7, 10 }, + { 10, 6, 10 }, + { 10, 10, 7 }, + { 10, 4, 11 }, + { 10, 1, 11 }, + { 10, 12, 2 }, + { 10, 9, 8 }, + { 10, 12, 3 }, + { 10, 11, 6 }, + { 10, 5, 11 }, + { 10, 12, 4 }, + { 10, 11, 7 }, + { 10, 12, 5 }, + { 10, 3, 12 }, + { 10, 6, 11 }, + { 10, 9, 0 }, + { 10, 10, 8 }, + { 10, 10, 0 }, + { 10, 12, 1 }, + { 10, 0, 9 }, + { 10, 4, 12 }, + { 10, 9, 9 }, + + /* 10/11/12 bit codewords */ + { 10, 12, 6 }, { 10, 12, 6 }, { 10, 12, 6 }, { 10, 12, 6 }, + { 10, 2, 12 }, { 10, 2, 12 }, { 10, 2, 12 }, { 10, 2, 12 }, + { 10, 8, 10 }, { 10, 8, 10 }, { 10, 8, 10 }, { 10, 8, 10 }, + { 11, 9, 10 }, { 11, 9, 10 }, + { 11, 1, 12 }, { 11, 1, 12 }, + { 11, 11, 8 }, { 11, 11, 8 }, + { 11, 12, 7 }, { 11, 12, 7 }, + { 11, 7, 11 }, { 11, 7, 11 }, + { 11, 5, 12 }, { 11, 5, 12 }, + { 11, 6, 12 }, { 11, 6, 12 }, + { 11, 10, 9 }, { 11, 10, 9 }, + { 11, 8, 11 }, { 11, 8, 11 }, + { 11, 12, 8 }, { 11, 12, 8 }, + { 11, 0, 10 }, { 11, 0, 10 }, + { 11, 7, 12 }, { 11, 7, 12 }, + { 11, 11, 0 }, { 11, 11, 0 }, + { 11, 10, 10 }, { 11, 10, 10 }, + { 11, 11, 9 }, { 11, 11, 9 }, + { 11, 11, 10 }, { 11, 11, 10 }, + { 11, 0, 11 }, { 11, 0, 11 }, + { 11, 11, 11 }, { 11, 11, 11 }, + { 11, 9, 11 }, { 11, 9, 11 }, + { 11, 10, 11 }, { 11, 10, 11 }, + { 11, 12, 0 }, { 11, 12, 0 }, + { 11, 8, 12 }, { 11, 8, 12 }, + { 12, 12, 9 }, + { 12, 10, 12 }, + { 12, 9, 12 }, + { 12, 11, 12 }, + { 12, 12, 11 }, + { 12, 0, 12 }, + { 12, 12, 10 }, + { 12, 12, 12 } +}; diff --git a/Libraries/FAAD2/Files/libfaad/codebook/hcb_11.h b/Libraries/FAAD2/Files/libfaad/codebook/hcb_11.h new file mode 100644 index 000000000..c5137215f --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/codebook/hcb_11.h @@ -0,0 +1,412 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +/* 2-step huffman table HCB_11 */ + + +/* 1st step: 5 bits + * 2^5 = 32 entries + * + * Used to find offset into 2nd step table and number of extra bits to get + */ +static hcb hcb11_1[] = { + /* 4 bits */ + { /* 00000 */ 0, 0 }, + { /* */ 0, 0 }, + { /* 00010 */ 1, 0 }, + { /* */ 1, 0 }, + + /* 5 bits */ + { /* 00100 */ 2, 0 }, + { /* 00101 */ 3, 0 }, + { /* 00110 */ 4, 0 }, + { /* 00111 */ 5, 0 }, + { /* 01000 */ 6, 0 }, + { /* 01001 */ 7, 0 }, + + /* 6 bits */ + { /* 01010 */ 8, 1 }, + { /* 01011 */ 10, 1 }, + { /* 01100 */ 12, 1 }, + + /* 6/7 bits */ + { /* 01101 */ 14, 2 }, + + /* 7 bits */ + { /* 01110 */ 18, 2 }, + { /* 01111 */ 22, 2 }, + { /* 10000 */ 26, 2 }, + + /* 7/8 bits */ + { /* 10001 */ 30, 3 }, + + /* 8 bits */ + { /* 10010 */ 38, 3 }, + { /* 10011 */ 46, 3 }, + { /* 10100 */ 54, 3 }, + { /* 10101 */ 62, 3 }, + { /* 10110 */ 70, 3 }, + { /* 10111 */ 78, 3 }, + + /* 8/9 bits */ + { /* 11000 */ 86, 4 }, + + /* 9 bits */ + { /* 11001 */ 102, 4 }, + { /* 11010 */ 118, 4 }, + { /* 11011 */ 134, 4 }, + + /* 9/10 bits */ + { /* 11100 */ 150, 5 }, + + /* 10 bits */ + { /* 11101 */ 182, 5 }, + { /* 11110 */ 214, 5 }, + + /* 10/11/12 bits */ + { /* 11111 */ 246, 7 } +}; + +/* 2nd step table + * + * Gives size of codeword and actual data (x,y,v,w) + */ +static hcb_2_pair hcb11_2[] = { + /* 4 */ + { 4, 0, 0 }, + { 4, 1, 1 }, + + /* 5 */ + { 5, 16, 16 }, + { 5, 1, 0 }, + { 5, 0, 1 }, + { 5, 2, 1 }, + { 5, 1, 2 }, + { 5, 2, 2 }, + + /* 6 */ + { 6, 1, 3 }, + { 6, 3, 1 }, + { 6, 3, 2 }, + { 6, 2, 0 }, + { 6, 2, 3 }, + { 6, 0, 2 }, + + /* 6/7 */ + { 6, 3, 3 }, { 6, 3, 3 }, + { 7, 4, 1 }, + { 7, 1, 4 }, + + /* 7 */ + { 7, 4, 2 }, + { 7, 2, 4 }, + { 7, 4, 3 }, + { 7, 3, 4 }, + { 7, 3, 0 }, + { 7, 0, 3 }, + { 7, 5, 1 }, + { 7, 5, 2 }, + { 7, 2, 5 }, + { 7, 4, 4 }, + { 7, 1, 5 }, + { 7, 5, 3 }, + + /* 7/8 */ + { 7, 3, 5 }, { 7, 3, 5 }, + { 7, 5, 4 }, { 7, 5, 4 }, + { 8, 4, 5 }, + { 8, 6, 2 }, + { 8, 2, 6 }, + { 8, 6, 1 }, + + /* 8 */ + { 8, 6, 3 }, + { 8, 3, 6 }, + { 8, 1, 6 }, + { 8, 4, 16 }, + { 8, 3, 16 }, + { 8, 16, 5 }, + { 8, 16, 3 }, + { 8, 16, 4 }, + { 8, 6, 4 }, + { 8, 16, 6 }, + { 8, 4, 0 }, + { 8, 4, 6 }, + { 8, 0, 4 }, + { 8, 2, 16 }, + { 8, 5, 5 }, + { 8, 5, 16 }, + { 8, 16, 7 }, + { 8, 16, 2 }, + { 8, 16, 8 }, + { 8, 2, 7 }, + { 8, 7, 2 }, + { 8, 3, 7 }, + { 8, 6, 5 }, + { 8, 5, 6 }, + { 8, 6, 16 }, + { 8, 16, 10 }, + { 8, 7, 3 }, + { 8, 7, 1 }, + { 8, 16, 9 }, + { 8, 7, 16 }, + { 8, 1, 16 }, + { 8, 1, 7 }, + { 8, 4, 7 }, + { 8, 16, 11 }, + { 8, 7, 4 }, + { 8, 16, 12 }, + { 8, 8, 16 }, + { 8, 16, 1 }, + { 8, 6, 6 }, + { 8, 9, 16 }, + { 8, 2, 8 }, + { 8, 5, 7 }, + { 8, 10, 16 }, + { 8, 16, 13 }, + { 8, 8, 3 }, + { 8, 8, 2 }, + { 8, 3, 8 }, + { 8, 5, 0 }, + + /* 8/9 */ + { 8, 16, 14 }, { 8, 16, 14 }, + { 8, 11, 16 }, { 8, 11, 16 }, + { 8, 7, 5 }, { 8, 7, 5 }, + { 8, 4, 8 }, { 8, 4, 8 }, + { 8, 6, 7 }, { 8, 6, 7 }, + { 8, 7, 6 }, { 8, 7, 6 }, + { 8, 0, 5 }, { 8, 0, 5 }, + { 9, 8, 4 }, + { 9, 16, 15 }, + + /* 9 */ + { 9, 12, 16 }, + { 9, 1, 8 }, + { 9, 8, 1 }, + { 9, 14, 16 }, + { 9, 5, 8 }, + { 9, 13, 16 }, + { 9, 3, 9 }, + { 9, 8, 5 }, + { 9, 7, 7 }, + { 9, 2, 9 }, + { 9, 8, 6 }, + { 9, 9, 2 }, + { 9, 9, 3 }, + { 9, 15, 16 }, + { 9, 4, 9 }, + { 9, 6, 8 }, + { 9, 6, 0 }, + { 9, 9, 4 }, + { 9, 5, 9 }, + { 9, 8, 7 }, + { 9, 7, 8 }, + { 9, 1, 9 }, + { 9, 10, 3 }, + { 9, 0, 6 }, + { 9, 10, 2 }, + { 9, 9, 1 }, + { 9, 9, 5 }, + { 9, 4, 10 }, + { 9, 2, 10 }, + { 9, 9, 6 }, + { 9, 3, 10 }, + { 9, 6, 9 }, + { 9, 10, 4 }, + { 9, 8, 8 }, + { 9, 10, 5 }, + { 9, 9, 7 }, + { 9, 11, 3 }, + { 9, 1, 10 }, + { 9, 7, 0 }, + { 9, 10, 6 }, + { 9, 7, 9 }, + { 9, 3, 11 }, + { 9, 5, 10 }, + { 9, 10, 1 }, + { 9, 4, 11 }, + { 9, 11, 2 }, + { 9, 13, 2 }, + { 9, 6, 10 }, + + /* 9/10 */ + { 9, 13, 3 }, { 9, 13, 3 }, + { 9, 2, 11 }, { 9, 2, 11 }, + { 9, 16, 0 }, { 9, 16, 0 }, + { 9, 5, 11 }, { 9, 5, 11 }, + { 9, 11, 5 }, { 9, 11, 5 }, + { 10, 11, 4 }, + { 10, 9, 8 }, + { 10, 7, 10 }, + { 10, 8, 9 }, + { 10, 0, 16 }, + { 10, 4, 13 }, + { 10, 0, 7 }, + { 10, 3, 13 }, + { 10, 11, 6 }, + { 10, 13, 1 }, + { 10, 13, 4 }, + { 10, 12, 3 }, + { 10, 2, 13 }, + { 10, 13, 5 }, + { 10, 8, 10 }, + { 10, 6, 11 }, + { 10, 10, 8 }, + { 10, 10, 7 }, + { 10, 14, 2 }, + { 10, 12, 4 }, + { 10, 1, 11 }, + { 10, 4, 12 }, + + /* 10 */ + { 10, 11, 1 }, + { 10, 3, 12 }, + { 10, 1, 13 }, + { 10, 12, 2 }, + { 10, 7, 11 }, + { 10, 3, 14 }, + { 10, 5, 12 }, + { 10, 5, 13 }, + { 10, 14, 4 }, + { 10, 4, 14 }, + { 10, 11, 7 }, + { 10, 14, 3 }, + { 10, 12, 5 }, + { 10, 13, 6 }, + { 10, 12, 6 }, + { 10, 8, 0 }, + { 10, 11, 8 }, + { 10, 2, 12 }, + { 10, 9, 9 }, + { 10, 14, 5 }, + { 10, 6, 13 }, + { 10, 10, 10 }, + { 10, 15, 2 }, + { 10, 8, 11 }, + { 10, 9, 10 }, + { 10, 14, 6 }, + { 10, 10, 9 }, + { 10, 5, 14 }, + { 10, 11, 9 }, + { 10, 14, 1 }, + { 10, 2, 14 }, + { 10, 6, 12 }, + { 10, 1, 12 }, + { 10, 13, 8 }, + { 10, 0, 8 }, + { 10, 13, 7 }, + { 10, 7, 12 }, + { 10, 12, 7 }, + { 10, 7, 13 }, + { 10, 15, 3 }, + { 10, 12, 1 }, + { 10, 6, 14 }, + { 10, 2, 15 }, + { 10, 15, 5 }, + { 10, 15, 4 }, + { 10, 1, 14 }, + { 10, 9, 11 }, + { 10, 4, 15 }, + { 10, 14, 7 }, + { 10, 8, 13 }, + { 10, 13, 9 }, + { 10, 8, 12 }, + { 10, 5, 15 }, + { 10, 3, 15 }, + { 10, 10, 11 }, + { 10, 11, 10 }, + { 10, 12, 8 }, + { 10, 15, 6 }, + { 10, 15, 7 }, + { 10, 8, 14 }, + { 10, 15, 1 }, + { 10, 7, 14 }, + { 10, 9, 0 }, + { 10, 0, 9 }, + + /* 10/11/12 */ + { 10, 9, 13 }, { 10, 9, 13 }, { 10, 9, 13 }, { 10, 9, 13 }, + { 10, 9, 12 }, { 10, 9, 12 }, { 10, 9, 12 }, { 10, 9, 12 }, + { 10, 12, 9 }, { 10, 12, 9 }, { 10, 12, 9 }, { 10, 12, 9 }, + { 10, 14, 8 }, { 10, 14, 8 }, { 10, 14, 8 }, { 10, 14, 8 }, + { 10, 10, 13 }, { 10, 10, 13 }, { 10, 10, 13 }, { 10, 10, 13 }, + { 10, 14, 9 }, { 10, 14, 9 }, { 10, 14, 9 }, { 10, 14, 9 }, + { 10, 12, 10 }, { 10, 12, 10 }, { 10, 12, 10 }, { 10, 12, 10 }, + { 10, 6, 15 }, { 10, 6, 15 }, { 10, 6, 15 }, { 10, 6, 15 }, + { 10, 7, 15 }, { 10, 7, 15 }, { 10, 7, 15 }, { 10, 7, 15 }, + + { 11, 9, 14 }, { 11, 9, 14 }, + { 11, 15, 8 }, { 11, 15, 8 }, + { 11, 11, 11 }, { 11, 11, 11 }, + { 11, 11, 14 }, { 11, 11, 14 }, + { 11, 1, 15 }, { 11, 1, 15 }, + { 11, 10, 12 }, { 11, 10, 12 }, + { 11, 10, 14 }, { 11, 10, 14 }, + { 11, 13, 11 }, { 11, 13, 11 }, + { 11, 13, 10 }, { 11, 13, 10 }, + { 11, 11, 13 }, { 11, 11, 13 }, + { 11, 11, 12 }, { 11, 11, 12 }, + { 11, 8, 15 }, { 11, 8, 15 }, + { 11, 14, 11 }, { 11, 14, 11 }, + { 11, 13, 12 }, { 11, 13, 12 }, + { 11, 12, 13 }, { 11, 12, 13 }, + { 11, 15, 9 }, { 11, 15, 9 }, + { 11, 14, 10 }, { 11, 14, 10 }, + { 11, 10, 0 }, { 11, 10, 0 }, + { 11, 12, 11 }, { 11, 12, 11 }, + { 11, 9, 15 }, { 11, 9, 15 }, + { 11, 0, 10 }, { 11, 0, 10 }, + { 11, 12, 12 }, { 11, 12, 12 }, + { 11, 11, 0 }, { 11, 11, 0 }, + { 11, 12, 14 }, { 11, 12, 14 }, + { 11, 10, 15 }, { 11, 10, 15 }, + { 11, 13, 13 }, { 11, 13, 13 }, + { 11, 0, 13 }, { 11, 0, 13 }, + { 11, 14, 12 }, { 11, 14, 12 }, + { 11, 15, 10 }, { 11, 15, 10 }, + { 11, 15, 11 }, { 11, 15, 11 }, + { 11, 11, 15 }, { 11, 11, 15 }, + { 11, 14, 13 }, { 11, 14, 13 }, + { 11, 13, 0 }, { 11, 13, 0 }, + { 11, 0, 11 }, { 11, 0, 11 }, + { 11, 13, 14 }, { 11, 13, 14 }, + { 11, 15, 12 }, { 11, 15, 12 }, + { 11, 15, 13 }, { 11, 15, 13 }, + { 11, 12, 15 }, { 11, 12, 15 }, + { 11, 14, 0 }, { 11, 14, 0 }, + { 11, 14, 14 }, { 11, 14, 14 }, + { 11, 13, 15 }, { 11, 13, 15 }, + { 11, 12, 0 }, { 11, 12, 0 }, + { 11, 14, 15 }, { 11, 14, 15 }, + { 12, 0, 14 }, + { 12, 0, 12 }, + { 12, 15, 14 }, + { 12, 15, 0 }, + { 12, 0, 15 }, + { 12, 15, 15 } +}; diff --git a/Libraries/FAAD2/Files/libfaad/codebook/hcb_2.h b/Libraries/FAAD2/Files/libfaad/codebook/hcb_2.h new file mode 100644 index 000000000..bcc8857c1 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/codebook/hcb_2.h @@ -0,0 +1,182 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +/* 2-step huffman table HCB_2 */ + + +/* 1st step: 5 bits + * 2^5 = 32 entries + * + * Used to find offset into 2nd step table and number of extra bits to get + */ +static hcb hcb2_1[] = { + { /* 00000 */ 0, 0 }, + { /* */ 0, 0 }, + { /* */ 0, 0 }, + { /* */ 0, 0 }, + { /* 00100 */ 1, 0 }, + { /* */ 1, 0 }, + { /* 00110 */ 2, 0 }, + { /* 00111 */ 3, 0 }, + { /* 01000 */ 4, 0 }, + { /* 01001 */ 5, 0 }, + { /* 01010 */ 6, 0 }, + { /* 01011 */ 7, 0 }, + { /* 01100 */ 8, 0 }, + + /* 6 bit codewords */ + { /* 01101 */ 9, 1 }, + { /* 01110 */ 11, 1 }, + { /* 01111 */ 13, 1 }, + { /* 10000 */ 15, 1 }, + { /* 10001 */ 17, 1 }, + { /* 10010 */ 19, 1 }, + { /* 10011 */ 21, 1 }, + { /* 10100 */ 23, 1 }, + { /* 10101 */ 25, 1 }, + { /* 10110 */ 27, 1 }, + { /* 10111 */ 29, 1 }, + { /* 11000 */ 31, 1 }, + + /* 7 bit codewords */ + { /* 11001 */ 33, 2 }, + { /* 11010 */ 37, 2 }, + { /* 11011 */ 41, 2 }, + + /* 7/8 bit codewords */ + { /* 11100 */ 45, 3 }, + + /* 8 bit codewords */ + { /* 11101 */ 53, 3 }, + { /* 11110 */ 61, 3 }, + + /* 8/9 bit codewords */ + { /* 11111 */ 69, 4 } +}; + +/* 2nd step table + * + * Gives size of codeword and actual data (x,y,v,w) + */ +static hcb_2_quad hcb2_2[] = { + /* 3 bit codeword */ + { 3, 0, 0, 0, 0 }, + + /* 4 bit codeword */ + { 4, 1, 0, 0, 0 }, + + /* 5 bit codewords */ + { 5, -1, 0, 0, 0 }, + { 5, 0, 0, 0, 1 }, + { 5, 0, 0, -1, 0 }, + { 5, 0, 0, 0, -1 }, + { 5, 0, -1, 0, 0 }, + { 5, 0, 0, 1, 0 }, + { 5, 0, 1, 0, 0 }, + + /* 6 bit codewords */ + { 6, 0, -1, 1, 0 }, + { 6, -1, 1, 0, 0 }, + { 6, 0, 1, -1, 0 }, + { 6, 0, 0, 1, -1 }, + { 6, 0, 1, 0, -1 }, + { 6, 0, 0, -1, 1 }, + { 6, -1, 0, 0, -1 }, + { 6, 1, -1, 0, 0 }, + { 6, 1, 0, -1, 0 }, + { 6, -1, -1, 0, 0 }, + { 6, 0, 0, -1, -1 }, + { 6, 1, 0, 1, 0 }, + { 6, 1, 0, 0, 1 }, + { 6, 0, -1, 0, 1 }, + { 6, -1, 0, 1, 0 }, + { 6, 0, 1, 0, 1 }, + { 6, 0, -1, -1, 0 }, + { 6, -1, 0, 0, 1 }, + { 6, 0, -1, 0, -1 }, + { 6, -1, 0, -1, 0 }, + { 6, 1, 1, 0, 0 }, + { 6, 0, 1, 1, 0 }, + { 6, 0, 0, 1, 1 }, + { 6, 1, 0, 0, -1 }, + + /* 7 bit codewords */ + { 7, 0, 1, -1, 1 }, + { 7, 1, 0, -1, 1 }, + { 7, -1, 1, -1, 0 }, + { 7, 0, -1, 1, -1 }, + { 7, 1, -1, 1, 0 }, + { 7, 1, 1, 0, -1 }, + { 7, 1, 0, 1, 1 }, + { 7, -1, 1, 1, 0 }, + { 7, 0, -1, -1, 1 }, + { 7, 1, 1, 1, 0 }, + { 7, -1, 0, 1, -1 }, + { 7, -1, -1, -1, 0 }, + + /* 7/8 bit codewords */ + { 7, -1, 0, -1, 1 }, { 7, -1, 0, -1, 1 }, + { 7, 1, -1, -1, 0 }, { 7, 1, -1, -1, 0 }, + { 7, 1, 1, -1, 0 }, { 7, 1, 1, -1, 0 }, + { 8, 1, -1, 0, 1 }, + { 8, -1, 1, 0, -1 }, + + /* 8 bit codewords */ + { 8, -1, -1, 1, 0 }, + { 8, -1, 0, 1, 1 }, + { 8, -1, -1, 0, 1 }, + { 8, -1, -1, 0, -1 }, + { 8, 0, -1, -1, -1 }, + { 8, 1, 0, 1, -1 }, + { 8, 1, 0, -1, -1 }, + { 8, 0, 1, -1, -1 }, + { 8, 0, 1, 1, 1 }, + { 8, -1, 1, 0, 1 }, + { 8, -1, 0, -1, -1 }, + { 8, 0, 1, 1, -1 }, + { 8, 1, -1, 0, -1 }, + { 8, 0, -1, 1, 1 }, + { 8, 1, 1, 0, 1 }, + { 8, 1, -1, 1, -1 }, + + /* 8/9 bit codewords */ + { 8, -1, 1, -1, 1 }, { 8, -1, 1, -1, 1 }, + { 9, 1, -1, -1, 1 }, + { 9, -1, -1, -1, -1 }, + { 9, -1, 1, 1, -1 }, + { 9, -1, 1, 1, 1 }, + { 9, 1, 1, 1, 1 }, + { 9, -1, -1, 1, -1 }, + { 9, 1, -1, 1, 1 }, + { 9, -1, 1, -1, -1 }, + { 9, -1, -1, 1, 1 }, + { 9, 1, 1, -1, -1 }, + { 9, 1, -1, -1, -1 }, + { 9, -1, -1, -1, 1 }, + { 9, 1, 1, -1, 1 }, + { 9, 1, 1, 1, -1 } +}; diff --git a/Libraries/FAAD2/Files/libfaad/codebook/hcb_3.h b/Libraries/FAAD2/Files/libfaad/codebook/hcb_3.h new file mode 100644 index 000000000..2672de0a4 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/codebook/hcb_3.h @@ -0,0 +1,193 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +/* Binary search huffman table HCB_3 */ + + +static hcb_bin_quad hcb3[] = { + { /* 0 */ 0, { 1, 2, 0, 0 } }, + { /* 1 */ 1, { 0, 0, 0, 0 } }, /* 0 */ + { /* 2 */ 0, { 1, 2, 0, 0 } }, + { /* 3 */ 0, { 2, 3, 0, 0 } }, + { /* 4 */ 0, { 3, 4, 0, 0 } }, + { /* 5 */ 0, { 4, 5, 0, 0 } }, + { /* 6 */ 0, { 5, 6, 0, 0 } }, + { /* 7 */ 0, { 6, 7, 0, 0 } }, + { /* 8 */ 0, { 7, 8, 0, 0 } }, + { /* 9 */ 1, { 1, 0, 0, 0 } }, /* 1000 */ + { /* 10 */ 1, { 0, 0, 0, 1 } }, /* 1001 */ + { /* 11 */ 1, { 0, 1, 0, 0 } }, /* 1010 */ + { /* 12 */ 1, { 0, 0, 1, 0 } }, /* 1011 */ + { /* 13 */ 0, { 4, 5, 0, 0 } }, + { /* 14 */ 0, { 5, 6, 0, 0 } }, + { /* 15 */ 0, { 6, 7, 0, 0 } }, + { /* 16 */ 0, { 7, 8, 0, 0 } }, + { /* 17 */ 1, { 1, 1, 0, 0 } }, + { /* 18 */ 1, { 0, 0, 1, 1 } }, + { /* 19 */ 0, { 6, 7, 0, 0 } }, + { /* 20 */ 0, { 7, 8, 0, 0 } }, + { /* 21 */ 0, { 8, 9, 0, 0 } }, + { /* 22 */ 0, { 9, 10, 0, 0 } }, + { /* 23 */ 0, { 10, 11, 0, 0 } }, + { /* 24 */ 0, { 11, 12, 0, 0 } }, + { /* 25 */ 1, { 0, 1, 1, 0 } }, /* 110100 */ + { /* 26 */ 1, { 0, 1, 0, 1 } }, /* 110101 */ + { /* 27 */ 1, { 1, 0, 1, 0 } }, /* 110110 */ + { /* 28 */ 1, { 0, 1, 1, 1 } }, /* 110111 */ + { /* 29 */ 1, { 1, 0, 0, 1 } }, /* 111000 */ + { /* 30 */ 1, { 1, 1, 1, 0 } }, /* 111001 */ + { /* 31 */ 0, { 6, 7, 0, 0 } }, + { /* 32 */ 0, { 7, 8, 0, 0 } }, + { /* 33 */ 0, { 8, 9, 0, 0 } }, + { /* 34 */ 0, { 9, 10, 0, 0 } }, + { /* 35 */ 0, { 10, 11, 0, 0 } }, + { /* 36 */ 0, { 11, 12, 0, 0 } }, + { /* 37 */ 1, { 1, 1, 1, 1 } }, /* 1110100 */ + { /* 38 */ 1, { 1, 0, 1, 1 } }, /* 1110101 */ + { /* 39 */ 1, { 1, 1, 0, 1 } }, /* 1110110 */ + { /* 40 */ 0, { 9, 10, 0, 0 } }, + { /* 41 */ 0, { 10, 11, 0, 0 } }, + { /* 42 */ 0, { 11, 12, 0, 0 } }, + { /* 43 */ 0, { 12, 13, 0, 0 } }, + { /* 44 */ 0, { 13, 14, 0, 0 } }, + { /* 45 */ 0, { 14, 15, 0, 0 } }, + { /* 46 */ 0, { 15, 16, 0, 0 } }, + { /* 47 */ 0, { 16, 17, 0, 0 } }, + { /* 48 */ 0, { 17, 18, 0, 0 } }, + { /* 49 */ 1, { 2, 0, 0, 0 } }, /* 11101110 */ + { /* 50 */ 1, { 0, 0, 0, 2 } }, /* 11101111 */ + { /* 51 */ 1, { 0, 0, 1, 2 } }, /* 11110000 */ + { /* 52 */ 1, { 2, 1, 0, 0 } }, /* 11110001 */ + { /* 53 */ 1, { 1, 2, 1, 0 } }, /* 11110010 */ + { /* 54 */ 0, { 13, 14, 0, 0 } }, + { /* 55 */ 0, { 14, 15, 0, 0 } }, + { /* 56 */ 0, { 15, 16, 0, 0 } }, + { /* 57 */ 0, { 16, 17, 0, 0 } }, + { /* 58 */ 0, { 17, 18, 0, 0 } }, + { /* 59 */ 0, { 18, 19, 0, 0 } }, + { /* 60 */ 0, { 19, 20, 0, 0 } }, + { /* 61 */ 0, { 20, 21, 0, 0 } }, + { /* 62 */ 0, { 21, 22, 0, 0 } }, + { /* 63 */ 0, { 22, 23, 0, 0 } }, + { /* 64 */ 0, { 23, 24, 0, 0 } }, + { /* 65 */ 0, { 24, 25, 0, 0 } }, + { /* 66 */ 0, { 25, 26, 0, 0 } }, + { /* 67 */ 1, { 0, 0, 2, 1 } }, + { /* 68 */ 1, { 0, 1, 2, 1 } }, + { /* 69 */ 1, { 1, 2, 0, 0 } }, + { /* 70 */ 1, { 0, 1, 1, 2 } }, + { /* 71 */ 1, { 2, 1, 1, 0 } }, + { /* 72 */ 1, { 0, 0, 2, 0 } }, + { /* 73 */ 1, { 0, 2, 1, 0 } }, + { /* 74 */ 1, { 0, 1, 2, 0 } }, + { /* 75 */ 1, { 0, 2, 0, 0 } }, + { /* 76 */ 1, { 0, 1, 0, 2 } }, + { /* 77 */ 1, { 2, 0, 1, 0 } }, + { /* 78 */ 1, { 1, 2, 1, 1 } }, + { /* 79 */ 1, { 0, 2, 1, 1 } }, + { /* 80 */ 1, { 1, 1, 2, 0 } }, + { /* 81 */ 1, { 1, 1, 2, 1 } }, + { /* 82 */ 0, { 11, 12, 0, 0 } }, + { /* 83 */ 0, { 12, 13, 0, 0 } }, + { /* 84 */ 0, { 13, 14, 0, 0 } }, + { /* 85 */ 0, { 14, 15, 0, 0 } }, + { /* 86 */ 0, { 15, 16, 0, 0 } }, + { /* 87 */ 0, { 16, 17, 0, 0 } }, + { /* 88 */ 0, { 17, 18, 0, 0 } }, + { /* 89 */ 0, { 18, 19, 0, 0 } }, + { /* 90 */ 0, { 19, 20, 0, 0 } }, + { /* 91 */ 0, { 20, 21, 0, 0 } }, + { /* 92 */ 0, { 21, 22, 0, 0 } }, + { /* 93 */ 1, { 1, 2, 0, 1 } }, /* 1111101010 */ + { /* 94 */ 1, { 1, 0, 2, 0 } }, /* 1111101011 */ + { /* 95 */ 1, { 1, 0, 2, 1 } }, /* 1111101100 */ + { /* 96 */ 1, { 0, 2, 0, 1 } }, /* 1111101101 */ + { /* 97 */ 1, { 2, 1, 1, 1 } }, /* 1111101110 */ + { /* 98 */ 1, { 1, 1, 1, 2 } }, /* 1111101111 */ + { /* 99 */ 1, { 2, 1, 0, 1 } }, /* 1111110000 */ + { /* 00 */ 1, { 1, 0, 1, 2 } }, /* 1111110001 */ + { /* 01 */ 1, { 0, 0, 2, 2 } }, /* 1111110010 */ + { /* 02 */ 1, { 0, 1, 2, 2 } }, /* 1111110011 */ + { /* 03 */ 1, { 2, 2, 1, 0 } }, /* 1111110100 */ + { /* 04 */ 1, { 1, 2, 2, 0 } }, /* 1111110101 */ + { /* 05 */ 1, { 1, 0, 0, 2 } }, /* 1111110110 */ + { /* 06 */ 1, { 2, 0, 0, 1 } }, /* 1111110111 */ + { /* 07 */ 1, { 0, 2, 2, 1 } }, /* 1111111000 */ + { /* 08 */ 0, { 7, 8, 0, 0 } }, + { /* 09 */ 0, { 8, 9, 0, 0 } }, + { /* 10 */ 0, { 9, 10, 0, 0 } }, + { /* 11 */ 0, { 10, 11, 0, 0 } }, + { /* 12 */ 0, { 11, 12, 0, 0 } }, + { /* 13 */ 0, { 12, 13, 0, 0 } }, + { /* 14 */ 0, { 13, 14, 0, 0 } }, + { /* 15 */ 1, { 2, 2, 0, 0 } }, /* 11111110010 */ + { /* 16 */ 1, { 1, 2, 2, 1 } }, /* 11111110011 */ + { /* 17 */ 1, { 1, 1, 0, 2 } }, /* 11111110100 */ + { /* 18 */ 1, { 2, 0, 1, 1 } }, /* 11111110101 */ + { /* 19 */ 1, { 1, 1, 2, 2 } }, /* 11111110110 */ + { /* 20 */ 1, { 2, 2, 1, 1 } }, /* 11111110111 */ + { /* 21 */ 1, { 0, 2, 2, 0 } }, /* 11111111000 */ + { /* 22 */ 1, { 0, 2, 1, 2 } }, /* 11111111001 */ + { /* 23 */ 0, { 6, 7, 0, 0 } }, + { /* 24 */ 0, { 7, 8, 0, 0 } }, + { /* 25 */ 0, { 8, 9, 0, 0 } }, + { /* 26 */ 0, { 9, 10, 0, 0 } }, + { /* 27 */ 0, { 10, 11, 0, 0 } }, + { /* 28 */ 0, { 11, 12, 0, 0 } }, + { /* 29 */ 1, { 1, 0, 2, 2 } }, /* 111111110100 */ + { /* 30 */ 1, { 2, 2, 0, 1 } }, /* 111111110101 */ + { /* 31 */ 1, { 2, 1, 2, 0 } }, /* 111111110110 */ + { /* 32 */ 1, { 2, 2, 2, 0 } }, /* 111111110111 */ + { /* 33 */ 1, { 0, 2, 2, 2 } }, /* 111111111000 */ + { /* 34 */ 1, { 2, 2, 2, 1 } }, /* 111111111001 */ + { /* 35 */ 1, { 2, 1, 2, 1 } }, /* 111111111010 */ + { /* 36 */ 1, { 1, 2, 1, 2 } }, /* 111111111011 */ + { /* 37 */ 1, { 1, 2, 2, 2 } }, /* 111111111100 */ + { /* 38 */ 0, { 3, 4, 0, 0 } }, + { /* 39 */ 0, { 4, 5, 0, 0 } }, + { /* 40 */ 0, { 5, 6, 0, 0 } }, + { /* 41 */ 1, { 0, 2, 0, 2 } }, /* 1111111111010 */ + { /* 42 */ 1, { 2, 0, 2, 0 } }, /* 1111111111011 */ + { /* 43 */ 1, { 1, 2, 0, 2 } }, /* 1111111111100 */ + { /* 44 */ 0, { 3, 4, 0, 0 } }, + { /* 45 */ 0, { 4, 5, 0, 0 } }, + { /* 46 */ 0, { 5, 6, 0, 0 } }, + { /* 47 */ 1, { 2, 0, 2, 1 } }, /* 11111111111010 */ + { /* 48 */ 1, { 2, 1, 1, 2 } }, /* 11111111111011 */ + { /* 49 */ 1, { 2, 1, 0, 2 } }, /* 11111111111100 */ + { /* 50 */ 0, { 3, 4, 0, 0 } }, + { /* 51 */ 0, { 4, 5, 0, 0 } }, + { /* 52 */ 0, { 5, 6, 0, 0 } }, + { /* 53 */ 1, { 2, 2, 2, 2 } }, /* 111111111111010 */ + { /* 54 */ 1, { 2, 2, 1, 2 } }, /* 111111111111011 */ + { /* 55 */ 1, { 2, 1, 2, 2 } }, /* 111111111111100 */ + { /* 56 */ 1, { 2, 0, 1, 2 } }, /* 111111111111101 */ + { /* 57 */ 1, { 2, 0, 0, 2 } }, /* 111111111111110 */ + { /* 58 */ 0, { 1, 2, 0, 0 } }, + { /* 59 */ 1, { 2, 2, 0, 2 } }, /* 1111111111111110 */ + { /* 60 */ 1, { 2, 0, 2, 2 } } /* 1111111111111111 */ +}; diff --git a/Libraries/FAAD2/Files/libfaad/codebook/hcb_4.h b/Libraries/FAAD2/Files/libfaad/codebook/hcb_4.h new file mode 100644 index 000000000..1dc90404f --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/codebook/hcb_4.h @@ -0,0 +1,196 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +/* 2-step huffman table HCB_4 */ + + +/* 1st step: 5 bits + * 2^5 = 32 entries + * + * Used to find offset into 2nd step table and number of extra bits to get + */ +static hcb hcb4_1[] = { + /* 4 bit codewords */ + { /* 00000 */ 0, 0 }, + { /* */ 0, 0 }, + { /* 00010 */ 1, 0 }, + { /* */ 1, 0 }, + { /* 00100 */ 2, 0 }, + { /* */ 2, 0 }, + { /* 00110 */ 3, 0 }, + { /* */ 3, 0 }, + { /* 01000 */ 4, 0 }, + { /* */ 4, 0 }, + { /* 01010 */ 5, 0 }, + { /* */ 5, 0 }, + { /* 01100 */ 6, 0 }, + { /* */ 6, 0 }, + { /* 01110 */ 7, 0 }, + { /* */ 7, 0 }, + { /* 10000 */ 8, 0 }, + { /* */ 8, 0 }, + { /* 10010 */ 9, 0 }, + { /* */ 9, 0 }, + + /* 5 bit codewords */ + { /* 10100 */ 10, 0 }, + { /* 10101 */ 11, 0 }, + { /* 10110 */ 12, 0 }, + { /* 10111 */ 13, 0 }, + { /* 11000 */ 14, 0 }, + { /* 11001 */ 15, 0 }, + + /* 7 bit codewords */ + { /* 11010 */ 16, 2 }, + { /* 11011 */ 20, 2 }, + + /* 7/8 bit codewords */ + { /* 11100 */ 24, 3 }, + + /* 8 bit codewords */ + { /* 11101 */ 32, 3 }, + + /* 8/9 bit codewords */ + { /* 11110 */ 40, 4 }, + + /* 9/10/11/12 bit codewords */ + { /* 11111 */ 56, 7 } +}; + +/* 2nd step table + * + * Gives size of codeword and actual data (x,y,v,w) + */ +static hcb_2_quad hcb4_2[] = { + /* 4 bit codewords */ + { 4, 1, 1, 1, 1 }, + { 4, 0, 1, 1, 1 }, + { 4, 1, 1, 0, 1 }, + { 4, 1, 1, 1, 0 }, + { 4, 1, 0, 1, 1 }, + { 4, 1, 0, 0, 0 }, + { 4, 1, 1, 0, 0 }, + { 4, 0, 0, 0, 0 }, + { 4, 0, 0, 1, 1 }, + { 4, 1, 0, 1, 0 }, + + /* 5 bit codewords */ + { 5, 1, 0, 0, 1 }, + { 5, 0, 1, 1, 0 }, + { 5, 0, 0, 0, 1 }, + { 5, 0, 1, 0, 1 }, + { 5, 0, 0, 1, 0 }, + { 5, 0, 1, 0, 0 }, + + /* 7 bit codewords */ + /* first 5 bits: 11010 */ + { 7, 2, 1, 1, 1 }, + { 7, 1, 1, 2, 1 }, + { 7, 1, 2, 1, 1 }, + { 7, 1, 1, 1, 2 }, + /* first 5 bits: 11011 */ + { 7, 2, 1, 1, 0 }, + { 7, 2, 1, 0, 1 }, + { 7, 1, 2, 1, 0 }, + { 7, 2, 0, 1, 1 }, + + /* 7/8 bit codewords */ + /* first 5 bits: 11100 */ + { 7, 0, 1, 2, 1 }, { 7, 0, 1, 2, 1 }, + { 8, 0, 1, 1, 2 }, + { 8, 1, 1, 2, 0 }, + { 8, 0, 2, 1, 1 }, + { 8, 1, 0, 1, 2 }, + { 8, 1, 2, 0, 1 }, + { 8, 1, 1, 0, 2 }, + + /* 8 bit codewords */ + { 8, 1, 0, 2, 1 }, + { 8, 2, 1, 0, 0 }, + { 8, 2, 0, 1, 0 }, + { 8, 1, 2, 0, 0 }, + { 8, 2, 0, 0, 1 }, + { 8, 0, 1, 0, 2 }, + { 8, 0, 2, 1, 0 }, + { 8, 0, 0, 1, 2 }, + + /* 8/9 bit codewords */ + { 8, 0, 1, 2, 0 }, { 8, 0, 1, 2, 0 }, + { 8, 0, 2, 0, 1 }, { 8, 0, 2, 0, 1 }, + { 8, 1, 0, 0, 2 }, { 8, 1, 0, 0, 2 }, + { 8, 0, 0, 2, 1 }, { 8, 0, 0, 2, 1 }, + { 8, 1, 0, 2, 0 }, { 8, 1, 0, 2, 0 }, + { 8, 2, 0, 0, 0 }, { 8, 2, 0, 0, 0 }, + { 8, 0, 0, 0, 2 }, { 8, 0, 0, 0, 2 }, + { 9, 0, 2, 0, 0 }, + { 9, 0, 0, 2, 0 }, + + /* 9/10/11 bit codewords */ + /* 9 bit codewords repeated 2^3 = 8 times */ + { 9, 1, 2, 2, 1 }, { 9, 1, 2, 2, 1 }, { 9, 1, 2, 2, 1 }, { 9, 1, 2, 2, 1 }, + { 9, 1, 2, 2, 1 }, { 9, 1, 2, 2, 1 }, { 9, 1, 2, 2, 1 }, { 9, 1, 2, 2, 1 }, + { 9, 2, 2, 1, 1 }, { 9, 2, 2, 1, 1 }, { 9, 2, 2, 1, 1 }, { 9, 2, 2, 1, 1 }, + { 9, 2, 2, 1, 1 }, { 9, 2, 2, 1, 1 }, { 9, 2, 2, 1, 1 }, { 9, 2, 2, 1, 1 }, + { 9, 2, 1, 2, 1 }, { 9, 2, 1, 2, 1 }, { 9, 2, 1, 2, 1 }, { 9, 2, 1, 2, 1 }, + { 9, 2, 1, 2, 1 }, { 9, 2, 1, 2, 1 }, { 9, 2, 1, 2, 1 }, { 9, 2, 1, 2, 1 }, + { 9, 1, 1, 2, 2 }, { 9, 1, 1, 2, 2 }, { 9, 1, 1, 2, 2 }, { 9, 1, 1, 2, 2 }, + { 9, 1, 1, 2, 2 }, { 9, 1, 1, 2, 2 }, { 9, 1, 1, 2, 2 }, { 9, 1, 1, 2, 2 }, + { 9, 1, 2, 1, 2 }, { 9, 1, 2, 1, 2 }, { 9, 1, 2, 1, 2 }, { 9, 1, 2, 1, 2 }, + { 9, 1, 2, 1, 2 }, { 9, 1, 2, 1, 2 }, { 9, 1, 2, 1, 2 }, { 9, 1, 2, 1, 2 }, + { 9, 2, 1, 1, 2 }, { 9, 2, 1, 1, 2 }, { 9, 2, 1, 1, 2 }, { 9, 2, 1, 1, 2 }, + { 9, 2, 1, 1, 2 }, { 9, 2, 1, 1, 2 }, { 9, 2, 1, 1, 2 }, { 9, 2, 1, 1, 2 }, + /* 10 bit codewords repeated 2^2 = 4 times */ + { 10, 1, 2, 2, 0 }, { 10, 1, 2, 2, 0 }, { 10, 1, 2, 2, 0 }, { 10, 1, 2, 2, 0 }, + { 10, 2, 2, 1, 0 }, { 10, 2, 2, 1, 0 }, { 10, 2, 2, 1, 0 }, { 10, 2, 2, 1, 0 }, + { 10, 2, 1, 2, 0 }, { 10, 2, 1, 2, 0 }, { 10, 2, 1, 2, 0 }, { 10, 2, 1, 2, 0 }, + { 10, 0, 2, 2, 1 }, { 10, 0, 2, 2, 1 }, { 10, 0, 2, 2, 1 }, { 10, 0, 2, 2, 1 }, + { 10, 0, 1, 2, 2 }, { 10, 0, 1, 2, 2 }, { 10, 0, 1, 2, 2 }, { 10, 0, 1, 2, 2 }, + { 10, 2, 2, 0, 1 }, { 10, 2, 2, 0, 1 }, { 10, 2, 2, 0, 1 }, { 10, 2, 2, 0, 1 }, + { 10, 0, 2, 1, 2 }, { 10, 0, 2, 1, 2 }, { 10, 0, 2, 1, 2 }, { 10, 0, 2, 1, 2 }, + { 10, 2, 0, 2, 1 }, { 10, 2, 0, 2, 1 }, { 10, 2, 0, 2, 1 }, { 10, 2, 0, 2, 1 }, + { 10, 1, 0, 2, 2 }, { 10, 1, 0, 2, 2 }, { 10, 1, 0, 2, 2 }, { 10, 1, 0, 2, 2 }, + { 10, 2, 2, 2, 1 }, { 10, 2, 2, 2, 1 }, { 10, 2, 2, 2, 1 }, { 10, 2, 2, 2, 1 }, + { 10, 1, 2, 0, 2 }, { 10, 1, 2, 0, 2 }, { 10, 1, 2, 0, 2 }, { 10, 1, 2, 0, 2 }, + { 10, 2, 0, 1, 2 }, { 10, 2, 0, 1, 2 }, { 10, 2, 0, 1, 2 }, { 10, 2, 0, 1, 2 }, + { 10, 2, 1, 0, 2 }, { 10, 2, 1, 0, 2 }, { 10, 2, 1, 0, 2 }, { 10, 2, 1, 0, 2 }, + { 10, 1, 2, 2, 2 }, { 10, 1, 2, 2, 2 }, { 10, 1, 2, 2, 2 }, { 10, 1, 2, 2, 2 }, + /* 11 bit codewords repeated 2^1 = 2 times */ + { 11, 2, 1, 2, 2 }, { 11, 2, 1, 2, 2 }, + { 11, 2, 2, 1, 2 }, { 11, 2, 2, 1, 2 }, + { 11, 0, 2, 2, 0 }, { 11, 0, 2, 2, 0 }, + { 11, 2, 2, 0, 0 }, { 11, 2, 2, 0, 0 }, + { 11, 0, 0, 2, 2 }, { 11, 0, 0, 2, 2 }, + { 11, 2, 0, 2, 0 }, { 11, 2, 0, 2, 0 }, + { 11, 0, 2, 0, 2 }, { 11, 0, 2, 0, 2 }, + { 11, 2, 0, 0, 2 }, { 11, 2, 0, 0, 2 }, + { 11, 2, 2, 2, 2 }, { 11, 2, 2, 2, 2 }, + { 11, 0, 2, 2, 2 }, { 11, 0, 2, 2, 2 }, + { 11, 2, 2, 2, 0 }, { 11, 2, 2, 2, 0 }, + /* 12 bit codewords */ + { 12, 2, 2, 0, 2 }, + { 12, 2, 0, 2, 2 }, +}; diff --git a/Libraries/FAAD2/Files/libfaad/codebook/hcb_5.h b/Libraries/FAAD2/Files/libfaad/codebook/hcb_5.h new file mode 100644 index 000000000..d094a6b1c --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/codebook/hcb_5.h @@ -0,0 +1,193 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +/* Binary search huffman table HCB_5 */ + + +static hcb_bin_pair hcb5[] = { + { /* 0 */ 0, { 1, 2 } }, + { /* 1 */ 1, { 0, 0 } }, /* 0 */ + { /* 2 */ 0, { 1, 2 } }, + { /* 3 */ 0, { 2, 3 } }, + { /* 4 */ 0, { 3, 4 } }, + { /* 5 */ 0, { 4, 5 } }, + { /* 6 */ 0, { 5, 6 } }, + { /* 7 */ 0, { 6, 7 } }, + { /* 8 */ 0, { 7, 8 } }, + { /* 9 */ 1, { -1, 0 } }, /* 1000 */ + { /* 10 */ 1, { 1, 0 } }, /* 1001 */ + { /* 11 */ 1, { 0, 1 } }, /* 1010 */ + { /* 12 */ 1, { 0, -1 } }, /* 1011 */ + { /* 13 */ 0, { 4, 5 } }, + { /* 14 */ 0, { 5, 6 } }, + { /* 15 */ 0, { 6, 7 } }, + { /* 16 */ 0, { 7, 8 } }, + { /* 17 */ 1, { 1, -1 } }, + { /* 18 */ 1, { -1, 1 } }, + { /* 19 */ 1, { -1, -1 } }, + { /* 20 */ 1, { 1, 1 } }, + { /* 21 */ 0, { 4, 5 } }, + { /* 22 */ 0, { 5, 6 } }, + { /* 23 */ 0, { 6, 7 } }, + { /* 24 */ 0, { 7, 8 } }, + { /* 25 */ 0, { 8, 9 } }, + { /* 26 */ 0, { 9, 10 } }, + { /* 27 */ 0, { 10, 11 } }, + { /* 28 */ 0, { 11, 12 } }, + { /* 29 */ 0, { 12, 13 } }, + { /* 30 */ 0, { 13, 14 } }, + { /* 31 */ 0, { 14, 15 } }, + { /* 32 */ 0, { 15, 16 } }, + { /* 33 */ 1, { -2, 0 } }, + { /* 34 */ 1, { 0, 2 } }, + { /* 35 */ 1, { 2, 0 } }, + { /* 36 */ 1, { 0, -2 } }, + { /* 37 */ 0, { 12, 13 } }, + { /* 38 */ 0, { 13, 14 } }, + { /* 39 */ 0, { 14, 15 } }, + { /* 40 */ 0, { 15, 16 } }, + { /* 41 */ 0, { 16, 17 } }, + { /* 42 */ 0, { 17, 18 } }, + { /* 43 */ 0, { 18, 19 } }, + { /* 44 */ 0, { 19, 20 } }, + { /* 45 */ 0, { 20, 21 } }, + { /* 46 */ 0, { 21, 22 } }, + { /* 47 */ 0, { 22, 23 } }, + { /* 48 */ 0, { 23, 24 } }, + { /* 49 */ 1, { -2, -1 } }, + { /* 50 */ 1, { 2, 1 } }, + { /* 51 */ 1, { -1, -2 } }, + { /* 52 */ 1, { 1, 2 } }, + { /* 53 */ 1, { -2, 1 } }, + { /* 54 */ 1, { 2, -1 } }, + { /* 55 */ 1, { -1, 2 } }, + { /* 56 */ 1, { 1, -2 } }, + { /* 57 */ 1, { -3, 0 } }, + { /* 58 */ 1, { 3, 0 } }, + { /* 59 */ 1, { 0, -3 } }, + { /* 60 */ 1, { 0, 3 } }, + { /* 61 */ 0, { 12, 13 } }, + { /* 62 */ 0, { 13, 14 } }, + { /* 63 */ 0, { 14, 15 } }, + { /* 64 */ 0, { 15, 16 } }, + { /* 65 */ 0, { 16, 17 } }, + { /* 66 */ 0, { 17, 18 } }, + { /* 67 */ 0, { 18, 19 } }, + { /* 68 */ 0, { 19, 20 } }, + { /* 69 */ 0, { 20, 21 } }, + { /* 70 */ 0, { 21, 22 } }, + { /* 71 */ 0, { 22, 23 } }, + { /* 72 */ 0, { 23, 24 } }, + { /* 73 */ 1, { -3, -1 } }, + { /* 74 */ 1, { 1, 3 } }, + { /* 75 */ 1, { 3, 1 } }, + { /* 76 */ 1, { -1, -3 } }, + { /* 77 */ 1, { -3, 1 } }, + { /* 78 */ 1, { 3, -1 } }, + { /* 79 */ 1, { 1, -3 } }, + { /* 80 */ 1, { -1, 3 } }, + { /* 81 */ 1, { -2, 2 } }, + { /* 82 */ 1, { 2, 2 } }, + { /* 83 */ 1, { -2, -2 } }, + { /* 84 */ 1, { 2, -2 } }, + { /* 85 */ 0, { 12, 13 } }, + { /* 86 */ 0, { 13, 14 } }, + { /* 87 */ 0, { 14, 15 } }, + { /* 88 */ 0, { 15, 16 } }, + { /* 89 */ 0, { 16, 17 } }, + { /* 90 */ 0, { 17, 18 } }, + { /* 91 */ 0, { 18, 19 } }, + { /* 92 */ 0, { 19, 20 } }, + { /* 93 */ 0, { 20, 21 } }, + { /* 94 */ 0, { 21, 22 } }, + { /* 95 */ 0, { 22, 23 } }, + { /* 96 */ 0, { 23, 24 } }, + { /* 97 */ 1, { -3, -2 } }, + { /* 98 */ 1, { 3, -2 } }, + { /* 99 */ 1, { -2, 3 } }, + { /* 00 */ 1, { 2, -3 } }, + { /* 01 */ 1, { 3, 2 } }, + { /* 02 */ 1, { 2, 3 } }, + { /* 03 */ 1, { -3, 2 } }, + { /* 04 */ 1, { -2, -3 } }, + { /* 05 */ 1, { 0, -4 } }, + { /* 06 */ 1, { -4, 0 } }, + { /* 07 */ 1, { 4, 1 } }, + { /* 08 */ 1, { 4, 0 } }, + { /* 09 */ 0, { 12, 13 } }, + { /* 10 */ 0, { 13, 14 } }, + { /* 11 */ 0, { 14, 15 } }, + { /* 12 */ 0, { 15, 16 } }, + { /* 13 */ 0, { 16, 17 } }, + { /* 14 */ 0, { 17, 18 } }, + { /* 15 */ 0, { 18, 19 } }, + { /* 16 */ 0, { 19, 20 } }, + { /* 17 */ 0, { 20, 21 } }, + { /* 18 */ 0, { 21, 22 } }, + { /* 19 */ 0, { 22, 23 } }, + { /* 20 */ 0, { 23, 24 } }, + { /* 21 */ 1, { -4, -1 } }, + { /* 22 */ 1, { 0, 4 } }, + { /* 23 */ 1, { 4, -1 } }, + { /* 24 */ 1, { -1, -4 } }, + { /* 25 */ 1, { 1, 4 } }, + { /* 26 */ 1, { -1, 4 } }, + { /* 27 */ 1, { -4, 1 } }, + { /* 28 */ 1, { 1, -4 } }, + { /* 29 */ 1, { 3, -3 } }, + { /* 30 */ 1, { -3, -3 } }, + { /* 31 */ 1, { -3, 3 } }, + { /* 32 */ 1, { -2, 4 } }, + { /* 33 */ 1, { -4, -2 } }, + { /* 34 */ 1, { 4, 2 } }, + { /* 35 */ 1, { 2, -4 } }, + { /* 36 */ 1, { 2, 4 } }, + { /* 37 */ 1, { 3, 3 } }, + { /* 38 */ 1, { -4, 2 } }, + { /* 39 */ 0, { 6, 7 } }, + { /* 40 */ 0, { 7, 8 } }, + { /* 41 */ 0, { 8, 9 } }, + { /* 42 */ 0, { 9, 10 } }, + { /* 43 */ 0, { 10, 11 } }, + { /* 44 */ 0, { 11, 12 } }, + { /* 45 */ 1, { -2, -4 } }, + { /* 46 */ 1, { 4, -2 } }, + { /* 47 */ 1, { 3, -4 } }, + { /* 48 */ 1, { -4, -3 } }, + { /* 49 */ 1, { -4, 3 } }, + { /* 50 */ 1, { 3, 4 } }, + { /* 51 */ 1, { -3, 4 } }, + { /* 52 */ 1, { 4, 3 } }, + { /* 53 */ 1, { 4, -3 } }, + { /* 54 */ 1, { -3, -4 } }, + { /* 55 */ 0, { 2, 3 } }, + { /* 56 */ 0, { 3, 4 } }, + { /* 57 */ 1, { 4, -4 } }, + { /* 58 */ 1, { -4, 4 } }, + { /* 59 */ 1, { 4, 4 } }, + { /* 60 */ 1, { -4, -4 } } +}; diff --git a/Libraries/FAAD2/Files/libfaad/codebook/hcb_6.h b/Libraries/FAAD2/Files/libfaad/codebook/hcb_6.h new file mode 100644 index 000000000..4df2380ad --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/codebook/hcb_6.h @@ -0,0 +1,179 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +/* 2-step huffman table HCB_6 */ + + +/* 1st step: 5 bits + * 2^5 = 32 entries + * + * Used to find offset into 2nd step table and number of extra bits to get + */ +static hcb hcb6_1[] = { + /* 4 bit codewords */ + { /* 00000 */ 0, 0 }, + { /* */ 0, 0 }, + { /* 00010 */ 1, 0 }, + { /* */ 1, 0 }, + { /* 00100 */ 2, 0 }, + { /* */ 2, 0 }, + { /* 00110 */ 3, 0 }, + { /* */ 3, 0 }, + { /* 01000 */ 4, 0 }, + { /* */ 4, 0 }, + { /* 01010 */ 5, 0 }, + { /* */ 5, 0 }, + { /* 01100 */ 6, 0 }, + { /* */ 6, 0 }, + { /* 01110 */ 7, 0 }, + { /* */ 7, 0 }, + { /* 10000 */ 8, 0 }, + { /* */ 8, 0 }, + + /* 6 bit codewords */ + { /* 10010 */ 9, 1 }, + { /* 10011 */ 11, 1 }, + { /* 10100 */ 13, 1 }, + { /* 10101 */ 15, 1 }, + { /* 10110 */ 17, 1 }, + { /* 10111 */ 19, 1 }, + { /* 11000 */ 21, 1 }, + { /* 11001 */ 23, 1 }, + + /* 7 bit codewords */ + { /* 11010 */ 25, 2 }, + { /* 11011 */ 29, 2 }, + { /* 11100 */ 33, 2 }, + + /* 7/8 bit codewords */ + { /* 11101 */ 37, 3 }, + + /* 8/9 bit codewords */ + { /* 11110 */ 45, 4 }, + + /* 9/10/11 bit codewords */ + { /* 11111 */ 61, 6 } +}; + +/* 2nd step table + * + * Gives size of codeword and actual data (x,y,v,w) + */ +static hcb_2_pair hcb6_2[] = { + /* 4 bit codewords */ + { 4, 0, 0 }, + { 4, 1, 0 }, + { 4, 0, -1 }, + { 4, 0, 1 }, + { 4, -1, 0 }, + { 4, 1, 1 }, + { 4, -1, 1 }, + { 4, 1, -1 }, + { 4, -1, -1 }, + + /* 6 bit codewords */ + { 6, 2, -1 }, + { 6, 2, 1 }, + { 6, -2, 1 }, + { 6, -2, -1 }, + { 6, -2, 0 }, + { 6, -1, 2 }, + { 6, 2, 0 }, + { 6, 1, -2 }, + { 6, 1, 2 }, + { 6, 0, -2 }, + { 6, -1, -2 }, + { 6, 0, 2 }, + { 6, 2, -2 }, + { 6, -2, 2 }, + { 6, -2, -2 }, + { 6, 2, 2 }, + + /* 7 bit codewords */ + { 7, -3, 1 }, + { 7, 3, 1 }, + { 7, 3, -1 }, + { 7, -1, 3 }, + { 7, -3, -1 }, + { 7, 1, 3 }, + { 7, 1, -3 }, + { 7, -1, -3 }, + { 7, 3, 0 }, + { 7, -3, 0 }, + { 7, 0, -3 }, + { 7, 0, 3 }, + + /* 7/8 bit codewords */ + { 7, 3, 2 }, { 7, 3, 2 }, + { 8, -3, -2 }, + { 8, -2, 3 }, + { 8, 2, 3 }, + { 8, 3, -2 }, + { 8, 2, -3 }, + { 8, -2, -3 }, + + /* 8 bit codewords */ + { 8, -3, 2 }, { 8, -3, 2 }, + { 8, 3, 3 }, { 8, 3, 3 }, + { 9, 3, -3 }, + { 9, -3, -3 }, + { 9, -3, 3 }, + { 9, 1, -4 }, + { 9, -1, -4 }, + { 9, 4, 1 }, + { 9, -4, 1 }, + { 9, -4, -1 }, + { 9, 1, 4 }, + { 9, 4, -1 }, + { 9, -1, 4 }, + { 9, 0, -4 }, + + /* 9/10/11 bit codewords */ + { 9, -4, 2 }, { 9, -4, 2 }, { 9, -4, 2 }, { 9, -4, 2 }, + { 9, -4, -2 }, { 9, -4, -2 }, { 9, -4, -2 }, { 9, -4, -2 }, + { 9, 2, 4 }, { 9, 2, 4 }, { 9, 2, 4 }, { 9, 2, 4 }, + { 9, -2, -4 }, { 9, -2, -4 }, { 9, -2, -4 }, { 9, -2, -4 }, + { 9, -4, 0 }, { 9, -4, 0 }, { 9, -4, 0 }, { 9, -4, 0 }, + { 9, 4, 2 }, { 9, 4, 2 }, { 9, 4, 2 }, { 9, 4, 2 }, + { 9, 4, -2 }, { 9, 4, -2 }, { 9, 4, -2 }, { 9, 4, -2 }, + { 9, -2, 4 }, { 9, -2, 4 }, { 9, -2, 4 }, { 9, -2, 4 }, + { 9, 4, 0 }, { 9, 4, 0 }, { 9, 4, 0 }, { 9, 4, 0 }, + { 9, 2, -4 }, { 9, 2, -4 }, { 9, 2, -4 }, { 9, 2, -4 }, + { 9, 0, 4 }, { 9, 0, 4 }, { 9, 0, 4 }, { 9, 0, 4 }, + { 10, -3, -4 }, { 10, -3, -4 }, + { 10, -3, 4 }, { 10, -3, 4 }, + { 10, 3, -4 }, { 10, 3, -4 }, + { 10, 4, -3 }, { 10, 4, -3 }, + { 10, 3, 4 }, { 10, 3, 4 }, + { 10, 4, 3 }, { 10, 4, 3 }, + { 10, -4, 3 }, { 10, -4, 3 }, + { 10, -4, -3 }, { 10, -4, -3 }, + { 11, 4, 4 }, + { 11, -4, 4 }, + { 11, -4, -4 }, + { 11, 4, -4 } +}; diff --git a/Libraries/FAAD2/Files/libfaad/codebook/hcb_7.h b/Libraries/FAAD2/Files/libfaad/codebook/hcb_7.h new file mode 100644 index 000000000..c26a1a328 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/codebook/hcb_7.h @@ -0,0 +1,159 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +/* Binary search huffman table HCB_7 */ + + +static hcb_bin_pair hcb7[] = { + { /* 0 */ 0, { 1, 2 } }, + { /* 1 */ 1, { 0, 0 } }, + { /* 2 */ 0, { 1, 2 } }, + { /* 3 */ 0, { 2, 3 } }, + { /* 4 */ 0, { 3, 4 } }, + { /* 5 */ 1, { 1, 0 } }, + { /* 6 */ 1, { 0, 1 } }, + { /* 7 */ 0, { 2, 3 } }, + { /* 8 */ 0, { 3, 4 } }, + { /* 9 */ 1, { 1, 1 } }, + { /* 10 */ 0, { 3, 4 } }, + { /* 11 */ 0, { 4, 5 } }, + { /* 12 */ 0, { 5, 6 } }, + { /* 13 */ 0, { 6, 7 } }, + { /* 14 */ 0, { 7, 8 } }, + { /* 15 */ 0, { 8, 9 } }, + { /* 16 */ 0, { 9, 10 } }, + { /* 17 */ 0, { 10, 11 } }, + { /* 18 */ 0, { 11, 12 } }, + { /* 19 */ 1, { 2, 1 } }, + { /* 20 */ 1, { 1, 2 } }, + { /* 21 */ 1, { 2, 0 } }, + { /* 22 */ 1, { 0, 2 } }, + { /* 23 */ 0, { 8, 9 } }, + { /* 24 */ 0, { 9, 10 } }, + { /* 25 */ 0, { 10, 11 } }, + { /* 26 */ 0, { 11, 12 } }, + { /* 27 */ 0, { 12, 13 } }, + { /* 28 */ 0, { 13, 14 } }, + { /* 29 */ 0, { 14, 15 } }, + { /* 30 */ 0, { 15, 16 } }, + { /* 31 */ 1, { 3, 1 } }, + { /* 32 */ 1, { 1, 3 } }, + { /* 33 */ 1, { 2, 2 } }, + { /* 34 */ 1, { 3, 0 } }, + { /* 35 */ 1, { 0, 3 } }, + { /* 36 */ 0, { 11, 12 } }, + { /* 37 */ 0, { 12, 13 } }, + { /* 38 */ 0, { 13, 14 } }, + { /* 39 */ 0, { 14, 15 } }, + { /* 40 */ 0, { 15, 16 } }, + { /* 41 */ 0, { 16, 17 } }, + { /* 42 */ 0, { 17, 18 } }, + { /* 43 */ 0, { 18, 19 } }, + { /* 44 */ 0, { 19, 20 } }, + { /* 45 */ 0, { 20, 21 } }, + { /* 46 */ 0, { 21, 22 } }, + { /* 47 */ 1, { 2, 3 } }, + { /* 48 */ 1, { 3, 2 } }, + { /* 49 */ 1, { 1, 4 } }, + { /* 50 */ 1, { 4, 1 } }, + { /* 51 */ 1, { 1, 5 } }, + { /* 52 */ 1, { 5, 1 } }, + { /* 53 */ 1, { 3, 3 } }, + { /* 54 */ 1, { 2, 4 } }, + { /* 55 */ 1, { 0, 4 } }, + { /* 56 */ 1, { 4, 0 } }, + { /* 57 */ 0, { 12, 13 } }, + { /* 58 */ 0, { 13, 14 } }, + { /* 59 */ 0, { 14, 15 } }, + { /* 60 */ 0, { 15, 16 } }, + { /* 61 */ 0, { 16, 17 } }, + { /* 62 */ 0, { 17, 18 } }, + { /* 63 */ 0, { 18, 19 } }, + { /* 64 */ 0, { 19, 20 } }, + { /* 65 */ 0, { 20, 21 } }, + { /* 66 */ 0, { 21, 22 } }, + { /* 67 */ 0, { 22, 23 } }, + { /* 68 */ 0, { 23, 24 } }, + { /* 69 */ 1, { 4, 2 } }, + { /* 70 */ 1, { 2, 5 } }, + { /* 71 */ 1, { 5, 2 } }, + { /* 72 */ 1, { 0, 5 } }, + { /* 73 */ 1, { 6, 1 } }, + { /* 74 */ 1, { 5, 0 } }, + { /* 75 */ 1, { 1, 6 } }, + { /* 76 */ 1, { 4, 3 } }, + { /* 77 */ 1, { 3, 5 } }, + { /* 78 */ 1, { 3, 4 } }, + { /* 79 */ 1, { 5, 3 } }, + { /* 80 */ 1, { 2, 6 } }, + { /* 81 */ 1, { 6, 2 } }, + { /* 82 */ 1, { 1, 7 } }, + { /* 83 */ 0, { 10, 11 } }, + { /* 84 */ 0, { 11, 12 } }, + { /* 85 */ 0, { 12, 13 } }, + { /* 86 */ 0, { 13, 14 } }, + { /* 87 */ 0, { 14, 15 } }, + { /* 88 */ 0, { 15, 16 } }, + { /* 89 */ 0, { 16, 17 } }, + { /* 90 */ 0, { 17, 18 } }, + { /* 91 */ 0, { 18, 19 } }, + { /* 92 */ 0, { 19, 20 } }, + { /* 93 */ 1, { 3, 6 } }, + { /* 94 */ 1, { 0, 6 } }, + { /* 95 */ 1, { 6, 0 } }, + { /* 96 */ 1, { 4, 4 } }, + { /* 97 */ 1, { 7, 1 } }, + { /* 98 */ 1, { 4, 5 } }, + { /* 99 */ 1, { 7, 2 } }, + { /* 00 */ 1, { 5, 4 } }, + { /* 01 */ 1, { 6, 3 } }, + { /* 02 */ 1, { 2, 7 } }, + { /* 03 */ 1, { 7, 3 } }, + { /* 04 */ 1, { 6, 4 } }, + { /* 05 */ 1, { 5, 5 } }, + { /* 06 */ 1, { 4, 6 } }, + { /* 07 */ 1, { 3, 7 } }, + { /* 08 */ 0, { 5, 6 } }, + { /* 09 */ 0, { 6, 7 } }, + { /* 10 */ 0, { 7, 8 } }, + { /* 11 */ 0, { 8, 9 } }, + { /* 12 */ 0, { 9, 10 } }, + { /* 13 */ 1, { 7, 0 } }, + { /* 14 */ 1, { 0, 7 } }, + { /* 15 */ 1, { 6, 5 } }, + { /* 16 */ 1, { 5, 6 } }, + { /* 17 */ 1, { 7, 4 } }, + { /* 18 */ 1, { 4, 7 } }, + { /* 19 */ 1, { 5, 7 } }, + { /* 20 */ 1, { 7, 5 } }, + { /* 21 */ 0, { 2, 3 } }, + { /* 22 */ 0, { 3, 4 } }, + { /* 23 */ 1, { 7, 6 } }, + { /* 24 */ 1, { 6, 6 } }, + { /* 25 */ 1, { 6, 7 } }, + { /* 26 */ 1, { 7, 7 } } +}; diff --git a/Libraries/FAAD2/Files/libfaad/codebook/hcb_8.h b/Libraries/FAAD2/Files/libfaad/codebook/hcb_8.h new file mode 100644 index 000000000..d75da9030 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/codebook/hcb_8.h @@ -0,0 +1,170 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +/* 2-step huffman table HCB_8 */ + + +/* 1st step: 5 bits + * 2^5 = 32 entries + * + * Used to find offset into 2nd step table and number of extra bits to get + */ +static hcb hcb8_1[] = { + /* 3 bit codeword */ + { /* 00000 */ 0, 0 }, + { /* */ 0, 0 }, + { /* */ 0, 0 }, + { /* */ 0, 0 }, + + /* 4 bit codewords */ + { /* 00100 */ 1, 0 }, + { /* */ 1, 0 }, + { /* 00110 */ 2, 0 }, + { /* */ 2, 0 }, + { /* 01000 */ 3, 0 }, + { /* */ 3, 0 }, + { /* 01010 */ 4, 0 }, + { /* */ 4, 0 }, + { /* 01100 */ 5, 0 }, + { /* */ 5, 0 }, + + /* 5 bit codewords */ + { /* 01110 */ 6, 0 }, + { /* 01111 */ 7, 0 }, + { /* 10000 */ 8, 0 }, + { /* 10001 */ 9, 0 }, + { /* 10010 */ 10, 0 }, + { /* 10011 */ 11, 0 }, + { /* 10100 */ 12, 0 }, + + /* 6 bit codewords */ + { /* 10101 */ 13, 1 }, + { /* 10110 */ 15, 1 }, + { /* 10111 */ 17, 1 }, + { /* 11000 */ 19, 1 }, + { /* 11001 */ 21, 1 }, + + /* 7 bit codewords */ + { /* 11010 */ 23, 2 }, + { /* 11011 */ 27, 2 }, + { /* 11100 */ 31, 2 }, + + /* 7/8 bit codewords */ + { /* 11101 */ 35, 3 }, + + /* 8 bit codewords */ + { /* 11110 */ 43, 3 }, + + /* 8/9/10 bit codewords */ + { /* 11111 */ 51, 5 } +}; + +/* 2nd step table + * + * Gives size of codeword and actual data (x,y,v,w) + */ +static hcb_2_pair hcb8_2[] = { + /* 3 bit codeword */ + { 3, 1, 1 }, + + /* 4 bit codewords */ + { 4, 2, 1 }, + { 4, 1, 0 }, + { 4, 1, 2 }, + { 4, 0, 1 }, + { 4, 2, 2 }, + + /* 5 bit codewords */ + { 5, 0, 0 }, + { 5, 2, 0 }, + { 5, 0, 2 }, + { 5, 3, 1 }, + { 5, 1, 3 }, + { 5, 3, 2 }, + { 5, 2, 3 }, + + /* 6 bit codewords */ + { 6, 3, 3 }, + { 6, 4, 1 }, + { 6, 1, 4 }, + { 6, 4, 2 }, + { 6, 2, 4 }, + { 6, 3, 0 }, + { 6, 0, 3 }, + { 6, 4, 3 }, + { 6, 3, 4 }, + { 6, 5, 2 }, + + /* 7 bit codewords */ + { 7, 5, 1 }, + { 7, 2, 5 }, + { 7, 1, 5 }, + { 7, 5, 3 }, + { 7, 3, 5 }, + { 7, 4, 4 }, + { 7, 5, 4 }, + { 7, 0, 4 }, + { 7, 4, 5 }, + { 7, 4, 0 }, + { 7, 2, 6 }, + { 7, 6, 2 }, + + /* 7/8 bit codewords */ + { 7, 6, 1 }, { 7, 6, 1 }, + { 7, 1, 6 }, { 7, 1, 6 }, + { 8, 3, 6 }, + { 8, 6, 3 }, + { 8, 5, 5 }, + { 8, 5, 0 }, + + /* 8 bit codewords */ + { 8, 6, 4 }, + { 8, 0, 5 }, + { 8, 4, 6 }, + { 8, 7, 1 }, + { 8, 7, 2 }, + { 8, 2, 7 }, + { 8, 6, 5 }, + { 8, 7, 3 }, + + /* 8/9/10 bit codewords */ + { 8, 1, 7 }, { 8, 1, 7 }, { 8, 1, 7 }, { 8, 1, 7 }, + { 8, 5, 6 }, { 8, 5, 6 }, { 8, 5, 6 }, { 8, 5, 6 }, + { 8, 3, 7 }, { 8, 3, 7 }, { 8, 3, 7 }, { 8, 3, 7 }, + { 9, 6, 6 }, { 9, 6, 6 }, + { 9, 7, 4 }, { 9, 7, 4 }, + { 9, 6, 0 }, { 9, 6, 0 }, + { 9, 4, 7 }, { 9, 4, 7 }, + { 9, 0, 6 }, { 9, 0, 6 }, + { 9, 7, 5 }, { 9, 7, 5 }, + { 9, 7, 6 }, { 9, 7, 6 }, + { 9, 6, 7 }, { 9, 6, 7 }, + { 10, 5, 7 }, + { 10, 7, 0 }, + { 10, 0, 7 }, + { 10, 7, 7 } +}; diff --git a/Libraries/FAAD2/Files/libfaad/codebook/hcb_9.h b/Libraries/FAAD2/Files/libfaad/codebook/hcb_9.h new file mode 100644 index 000000000..740a6c324 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/codebook/hcb_9.h @@ -0,0 +1,369 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +/* Binary search huffman table HCB_9 */ + + +static hcb_bin_pair hcb9[] = { + { /* 0 */ 0, { 1, 2 } }, + { /* 1 */ 1, { 0, 0 } }, + { /* 2 */ 0, { 1, 2 } }, + { /* 3 */ 0, { 2, 3 } }, + { /* 4 */ 0, { 3, 4 } }, + { /* 5 */ 1, { 1, 0 } }, + { /* 6 */ 1, { 0, 1 } }, + { /* 7 */ 0, { 2, 3 } }, + { /* 8 */ 0, { 3, 4 } }, + { /* 9 */ 1, { 1, 1 } }, + { /* 10 */ 0, { 3, 4 } }, + { /* 11 */ 0, { 4, 5 } }, + { /* 12 */ 0, { 5, 6 } }, + { /* 13 */ 0, { 6, 7 } }, + { /* 14 */ 0, { 7, 8 } }, + { /* 15 */ 0, { 8, 9 } }, + { /* 16 */ 0, { 9, 10 } }, + { /* 17 */ 0, { 10, 11 } }, + { /* 18 */ 0, { 11, 12 } }, + { /* 19 */ 1, { 2, 1 } }, + { /* 20 */ 1, { 1, 2 } }, + { /* 21 */ 1, { 2, 0 } }, + { /* 22 */ 1, { 0, 2 } }, + { /* 23 */ 0, { 8, 9 } }, + { /* 24 */ 0, { 9, 10 } }, + { /* 25 */ 0, { 10, 11 } }, + { /* 26 */ 0, { 11, 12 } }, + { /* 27 */ 0, { 12, 13 } }, + { /* 28 */ 0, { 13, 14 } }, + { /* 29 */ 0, { 14, 15 } }, + { /* 30 */ 0, { 15, 16 } }, + { /* 31 */ 1, { 3, 1 } }, + { /* 32 */ 1, { 2, 2 } }, + { /* 33 */ 1, { 1, 3 } }, + { /* 34 */ 0, { 13, 14 } }, + { /* 35 */ 0, { 14, 15 } }, + { /* 36 */ 0, { 15, 16 } }, + { /* 37 */ 0, { 16, 17 } }, + { /* 38 */ 0, { 17, 18 } }, + { /* 39 */ 0, { 18, 19 } }, + { /* 40 */ 0, { 19, 20 } }, + { /* 41 */ 0, { 20, 21 } }, + { /* 42 */ 0, { 21, 22 } }, + { /* 43 */ 0, { 22, 23 } }, + { /* 44 */ 0, { 23, 24 } }, + { /* 45 */ 0, { 24, 25 } }, + { /* 46 */ 0, { 25, 26 } }, + { /* 47 */ 1, { 3, 0 } }, + { /* 48 */ 1, { 0, 3 } }, + { /* 49 */ 1, { 2, 3 } }, + { /* 50 */ 1, { 3, 2 } }, + { /* 51 */ 1, { 1, 4 } }, + { /* 52 */ 1, { 4, 1 } }, + { /* 53 */ 1, { 2, 4 } }, + { /* 54 */ 1, { 1, 5 } }, + { /* 55 */ 0, { 18, 19 } }, + { /* 56 */ 0, { 19, 20 } }, + { /* 57 */ 0, { 20, 21 } }, + { /* 58 */ 0, { 21, 22 } }, + { /* 59 */ 0, { 22, 23 } }, + { /* 60 */ 0, { 23, 24 } }, + { /* 61 */ 0, { 24, 25 } }, + { /* 62 */ 0, { 25, 26 } }, + { /* 63 */ 0, { 26, 27 } }, + { /* 64 */ 0, { 27, 28 } }, + { /* 65 */ 0, { 28, 29 } }, + { /* 66 */ 0, { 29, 30 } }, + { /* 67 */ 0, { 30, 31 } }, + { /* 68 */ 0, { 31, 32 } }, + { /* 69 */ 0, { 32, 33 } }, + { /* 70 */ 0, { 33, 34 } }, + { /* 71 */ 0, { 34, 35 } }, + { /* 72 */ 0, { 35, 36 } }, + { /* 73 */ 1, { 4, 2 } }, + { /* 74 */ 1, { 3, 3 } }, + { /* 75 */ 1, { 0, 4 } }, + { /* 76 */ 1, { 4, 0 } }, + { /* 77 */ 1, { 5, 1 } }, + { /* 78 */ 1, { 2, 5 } }, + { /* 79 */ 1, { 1, 6 } }, + { /* 80 */ 1, { 3, 4 } }, + { /* 81 */ 1, { 5, 2 } }, + { /* 82 */ 1, { 6, 1 } }, + { /* 83 */ 1, { 4, 3 } }, + { /* 84 */ 0, { 25, 26 } }, + { /* 85 */ 0, { 26, 27 } }, + { /* 86 */ 0, { 27, 28 } }, + { /* 87 */ 0, { 28, 29 } }, + { /* 88 */ 0, { 29, 30 } }, + { /* 89 */ 0, { 30, 31 } }, + { /* 90 */ 0, { 31, 32 } }, + { /* 91 */ 0, { 32, 33 } }, + { /* 92 */ 0, { 33, 34 } }, + { /* 93 */ 0, { 34, 35 } }, + { /* 94 */ 0, { 35, 36 } }, + { /* 95 */ 0, { 36, 37 } }, + { /* 96 */ 0, { 37, 38 } }, + { /* 97 */ 0, { 38, 39 } }, + { /* 98 */ 0, { 39, 40 } }, + { /* 99 */ 0, { 40, 41 } }, + { /* 00 */ 0, { 41, 42 } }, + { /* 01 */ 0, { 42, 43 } }, + { /* 02 */ 0, { 43, 44 } }, + { /* 03 */ 0, { 44, 45 } }, + { /* 04 */ 0, { 45, 46 } }, + { /* 05 */ 0, { 46, 47 } }, + { /* 06 */ 0, { 47, 48 } }, + { /* 07 */ 0, { 48, 49 } }, + { /* 08 */ 0, { 49, 50 } }, + { /* 09 */ 1, { 0, 5 } }, + { /* 10 */ 1, { 2, 6 } }, + { /* 11 */ 1, { 5, 0 } }, + { /* 12 */ 1, { 1, 7 } }, + { /* 13 */ 1, { 3, 5 } }, + { /* 14 */ 1, { 1, 8 } }, + { /* 15 */ 1, { 8, 1 } }, + { /* 16 */ 1, { 4, 4 } }, + { /* 17 */ 1, { 5, 3 } }, + { /* 18 */ 1, { 6, 2 } }, + { /* 19 */ 1, { 7, 1 } }, + { /* 20 */ 1, { 0, 6 } }, + { /* 21 */ 1, { 8, 2 } }, + { /* 22 */ 1, { 2, 8 } }, + { /* 23 */ 1, { 3, 6 } }, + { /* 24 */ 1, { 2, 7 } }, + { /* 25 */ 1, { 4, 5 } }, + { /* 26 */ 1, { 9, 1 } }, + { /* 27 */ 1, { 1, 9 } }, + { /* 28 */ 1, { 7, 2 } }, + { /* 29 */ 0, { 30, 31 } }, + { /* 30 */ 0, { 31, 32 } }, + { /* 31 */ 0, { 32, 33 } }, + { /* 32 */ 0, { 33, 34 } }, + { /* 33 */ 0, { 34, 35 } }, + { /* 34 */ 0, { 35, 36 } }, + { /* 35 */ 0, { 36, 37 } }, + { /* 36 */ 0, { 37, 38 } }, + { /* 37 */ 0, { 38, 39 } }, + { /* 38 */ 0, { 39, 40 } }, + { /* 39 */ 0, { 40, 41 } }, + { /* 40 */ 0, { 41, 42 } }, + { /* 41 */ 0, { 42, 43 } }, + { /* 42 */ 0, { 43, 44 } }, + { /* 43 */ 0, { 44, 45 } }, + { /* 44 */ 0, { 45, 46 } }, + { /* 45 */ 0, { 46, 47 } }, + { /* 46 */ 0, { 47, 48 } }, + { /* 47 */ 0, { 48, 49 } }, + { /* 48 */ 0, { 49, 50 } }, + { /* 49 */ 0, { 50, 51 } }, + { /* 50 */ 0, { 51, 52 } }, + { /* 51 */ 0, { 52, 53 } }, + { /* 52 */ 0, { 53, 54 } }, + { /* 53 */ 0, { 54, 55 } }, + { /* 54 */ 0, { 55, 56 } }, + { /* 55 */ 0, { 56, 57 } }, + { /* 56 */ 0, { 57, 58 } }, + { /* 57 */ 0, { 58, 59 } }, + { /* 58 */ 0, { 59, 60 } }, + { /* 59 */ 1, { 6, 0 } }, + { /* 60 */ 1, { 5, 4 } }, + { /* 61 */ 1, { 6, 3 } }, + { /* 62 */ 1, { 8, 3 } }, + { /* 63 */ 1, { 0, 7 } }, + { /* 64 */ 1, { 9, 2 } }, + { /* 65 */ 1, { 3, 8 } }, + { /* 66 */ 1, { 4, 6 } }, + { /* 67 */ 1, { 3, 7 } }, + { /* 68 */ 1, { 0, 8 } }, + { /* 69 */ 1, { 10, 1 } }, + { /* 70 */ 1, { 6, 4 } }, + { /* 71 */ 1, { 2, 9 } }, + { /* 72 */ 1, { 5, 5 } }, + { /* 73 */ 1, { 8, 0 } }, + { /* 74 */ 1, { 7, 0 } }, + { /* 75 */ 1, { 7, 3 } }, + { /* 76 */ 1, { 10, 2 } }, + { /* 77 */ 1, { 9, 3 } }, + { /* 78 */ 1, { 8, 4 } }, + { /* 79 */ 1, { 1, 10 } }, + { /* 80 */ 1, { 7, 4 } }, + { /* 81 */ 1, { 6, 5 } }, + { /* 82 */ 1, { 5, 6 } }, + { /* 83 */ 1, { 4, 8 } }, + { /* 84 */ 1, { 4, 7 } }, + { /* 85 */ 1, { 3, 9 } }, + { /* 86 */ 1, { 11, 1 } }, + { /* 87 */ 1, { 5, 8 } }, + { /* 88 */ 1, { 9, 0 } }, + { /* 89 */ 1, { 8, 5 } }, + { /* 90 */ 0, { 29, 30 } }, + { /* 91 */ 0, { 30, 31 } }, + { /* 92 */ 0, { 31, 32 } }, + { /* 93 */ 0, { 32, 33 } }, + { /* 94 */ 0, { 33, 34 } }, + { /* 95 */ 0, { 34, 35 } }, + { /* 96 */ 0, { 35, 36 } }, + { /* 97 */ 0, { 36, 37 } }, + { /* 98 */ 0, { 37, 38 } }, + { /* 99 */ 0, { 38, 39 } }, + { /* 00 */ 0, { 39, 40 } }, + { /* 01 */ 0, { 40, 41 } }, + { /* 02 */ 0, { 41, 42 } }, + { /* 03 */ 0, { 42, 43 } }, + { /* 04 */ 0, { 43, 44 } }, + { /* 05 */ 0, { 44, 45 } }, + { /* 06 */ 0, { 45, 46 } }, + { /* 07 */ 0, { 46, 47 } }, + { /* 08 */ 0, { 47, 48 } }, + { /* 09 */ 0, { 48, 49 } }, + { /* 10 */ 0, { 49, 50 } }, + { /* 11 */ 0, { 50, 51 } }, + { /* 12 */ 0, { 51, 52 } }, + { /* 13 */ 0, { 52, 53 } }, + { /* 14 */ 0, { 53, 54 } }, + { /* 15 */ 0, { 54, 55 } }, + { /* 16 */ 0, { 55, 56 } }, + { /* 17 */ 0, { 56, 57 } }, + { /* 18 */ 0, { 57, 58 } }, + { /* 19 */ 1, { 10, 3 } }, + { /* 20 */ 1, { 2, 10 } }, + { /* 21 */ 1, { 0, 9 } }, + { /* 22 */ 1, { 11, 2 } }, + { /* 23 */ 1, { 9, 4 } }, + { /* 24 */ 1, { 6, 6 } }, + { /* 25 */ 1, { 12, 1 } }, + { /* 26 */ 1, { 4, 9 } }, + { /* 27 */ 1, { 8, 6 } }, + { /* 28 */ 1, { 1, 11 } }, + { /* 29 */ 1, { 9, 5 } }, + { /* 30 */ 1, { 10, 4 } }, + { /* 31 */ 1, { 5, 7 } }, + { /* 32 */ 1, { 7, 5 } }, + { /* 33 */ 1, { 2, 11 } }, + { /* 34 */ 1, { 1, 12 } }, + { /* 35 */ 1, { 12, 2 } }, + { /* 36 */ 1, { 11, 3 } }, + { /* 37 */ 1, { 3, 10 } }, + { /* 38 */ 1, { 5, 9 } }, + { /* 39 */ 1, { 6, 7 } }, + { /* 40 */ 1, { 8, 7 } }, + { /* 41 */ 1, { 11, 4 } }, + { /* 42 */ 1, { 0, 10 } }, + { /* 43 */ 1, { 7, 6 } }, + { /* 44 */ 1, { 12, 3 } }, + { /* 45 */ 1, { 10, 0 } }, + { /* 46 */ 1, { 10, 5 } }, + { /* 47 */ 1, { 4, 10 } }, + { /* 48 */ 1, { 6, 8 } }, + { /* 49 */ 1, { 2, 12 } }, + { /* 50 */ 1, { 9, 6 } }, + { /* 51 */ 1, { 9, 7 } }, + { /* 52 */ 1, { 4, 11 } }, + { /* 53 */ 1, { 11, 0 } }, + { /* 54 */ 1, { 6, 9 } }, + { /* 55 */ 1, { 3, 11 } }, + { /* 56 */ 1, { 5, 10 } }, + { /* 57 */ 0, { 20, 21 } }, + { /* 58 */ 0, { 21, 22 } }, + { /* 59 */ 0, { 22, 23 } }, + { /* 60 */ 0, { 23, 24 } }, + { /* 61 */ 0, { 24, 25 } }, + { /* 62 */ 0, { 25, 26 } }, + { /* 63 */ 0, { 26, 27 } }, + { /* 64 */ 0, { 27, 28 } }, + { /* 65 */ 0, { 28, 29 } }, + { /* 66 */ 0, { 29, 30 } }, + { /* 67 */ 0, { 30, 31 } }, + { /* 68 */ 0, { 31, 32 } }, + { /* 69 */ 0, { 32, 33 } }, + { /* 70 */ 0, { 33, 34 } }, + { /* 71 */ 0, { 34, 35 } }, + { /* 72 */ 0, { 35, 36 } }, + { /* 73 */ 0, { 36, 37 } }, + { /* 74 */ 0, { 37, 38 } }, + { /* 75 */ 0, { 38, 39 } }, + { /* 76 */ 0, { 39, 40 } }, + { /* 77 */ 1, { 8, 8 } }, + { /* 78 */ 1, { 7, 8 } }, + { /* 79 */ 1, { 12, 5 } }, + { /* 80 */ 1, { 3, 12 } }, + { /* 81 */ 1, { 11, 5 } }, + { /* 82 */ 1, { 7, 7 } }, + { /* 83 */ 1, { 12, 4 } }, + { /* 84 */ 1, { 11, 6 } }, + { /* 85 */ 1, { 10, 6 } }, + { /* 86 */ 1, { 4, 12 } }, + { /* 87 */ 1, { 7, 9 } }, + { /* 88 */ 1, { 5, 11 } }, + { /* 89 */ 1, { 0, 11 } }, + { /* 90 */ 1, { 12, 6 } }, + { /* 91 */ 1, { 6, 10 } }, + { /* 92 */ 1, { 12, 0 } }, + { /* 93 */ 1, { 10, 7 } }, + { /* 94 */ 1, { 5, 12 } }, + { /* 95 */ 1, { 7, 10 } }, + { /* 96 */ 1, { 9, 8 } }, + { /* 97 */ 1, { 0, 12 } }, + { /* 98 */ 1, { 11, 7 } }, + { /* 99 */ 1, { 8, 9 } }, + { /* 00 */ 1, { 9, 9 } }, + { /* 01 */ 1, { 10, 8 } }, + { /* 02 */ 1, { 7, 11 } }, + { /* 03 */ 1, { 12, 7 } }, + { /* 04 */ 1, { 6, 11 } }, + { /* 05 */ 1, { 8, 11 } }, + { /* 06 */ 1, { 11, 8 } }, + { /* 07 */ 1, { 7, 12 } }, + { /* 08 */ 1, { 6, 12 } }, + { /* 09 */ 0, { 8, 9 } }, + { /* 10 */ 0, { 9, 10 } }, + { /* 11 */ 0, { 10, 11 } }, + { /* 12 */ 0, { 11, 12 } }, + { /* 13 */ 0, { 12, 13 } }, + { /* 14 */ 0, { 13, 14 } }, + { /* 15 */ 0, { 14, 15 } }, + { /* 16 */ 0, { 15, 16 } }, + { /* 17 */ 1, { 8, 10 } }, + { /* 18 */ 1, { 10, 9 } }, + { /* 19 */ 1, { 8, 12 } }, + { /* 20 */ 1, { 9, 10 } }, + { /* 21 */ 1, { 9, 11 } }, + { /* 22 */ 1, { 9, 12 } }, + { /* 23 */ 1, { 10, 11 } }, + { /* 24 */ 1, { 12, 9 } }, + { /* 25 */ 1, { 10, 10 } }, + { /* 26 */ 1, { 11, 9 } }, + { /* 27 */ 1, { 12, 8 } }, + { /* 28 */ 1, { 11, 10 } }, + { /* 29 */ 1, { 12, 10 } }, + { /* 30 */ 1, { 12, 11 } }, + { /* 31 */ 0, { 2, 3 } }, + { /* 32 */ 0, { 3, 4 } }, + { /* 33 */ 1, { 10, 12 } }, + { /* 34 */ 1, { 11, 11 } }, + { /* 35 */ 1, { 11, 12 } }, + { /* 36 */ 1, { 12, 12 } } +}; diff --git a/Libraries/FAAD2/Files/libfaad/codebook/hcb_sf.h b/Libraries/FAAD2/Files/libfaad/codebook/hcb_sf.h new file mode 100644 index 000000000..aa5ccdbfc --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/codebook/hcb_sf.h @@ -0,0 +1,273 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +/* Binary search huffman table HCB_SF */ + + +static uint8_t hcb_sf[][2] = { + { /* 0 */ 1, 2 }, + { /* 1 */ 60, 0 }, + { /* 2 */ 1, 2 }, + { /* 3 */ 2, 3 }, + { /* 4 */ 3, 4 }, + { /* 5 */ 59, 0 }, + { /* 6 */ 3, 4 }, + { /* 7 */ 4, 5 }, + { /* 8 */ 5, 6 }, + { /* 9 */ 61, 0 }, + { /* 10 */ 58, 0 }, + { /* 11 */ 62, 0 }, + { /* 12 */ 3, 4 }, + { /* 13 */ 4, 5 }, + { /* 14 */ 5, 6 }, + { /* 15 */ 57, 0 }, + { /* 16 */ 63, 0 }, + { /* 17 */ 4, 5 }, + { /* 18 */ 5, 6 }, + { /* 19 */ 6, 7 }, + { /* 20 */ 7, 8 }, + { /* 21 */ 56, 0 }, + { /* 22 */ 64, 0 }, + { /* 23 */ 55, 0 }, + { /* 24 */ 65, 0 }, + { /* 25 */ 4, 5 }, + { /* 26 */ 5, 6 }, + { /* 27 */ 6, 7 }, + { /* 28 */ 7, 8 }, + { /* 29 */ 66, 0 }, + { /* 30 */ 54, 0 }, + { /* 31 */ 67, 0 }, + { /* 32 */ 5, 6 }, + { /* 33 */ 6, 7 }, + { /* 34 */ 7, 8 }, + { /* 35 */ 8, 9 }, + { /* 36 */ 9, 10 }, + { /* 37 */ 53, 0 }, + { /* 38 */ 68, 0 }, + { /* 39 */ 52, 0 }, + { /* 40 */ 69, 0 }, + { /* 41 */ 51, 0 }, + { /* 42 */ 5, 6 }, + { /* 43 */ 6, 7 }, + { /* 44 */ 7, 8 }, + { /* 45 */ 8, 9 }, + { /* 46 */ 9, 10 }, + { /* 47 */ 70, 0 }, + { /* 48 */ 50, 0 }, + { /* 49 */ 49, 0 }, + { /* 50 */ 71, 0 }, + { /* 51 */ 6, 7 }, + { /* 52 */ 7, 8 }, + { /* 53 */ 8, 9 }, + { /* 54 */ 9, 10 }, + { /* 55 */ 10, 11 }, + { /* 56 */ 11, 12 }, + { /* 57 */ 72, 0 }, + { /* 58 */ 48, 0 }, + { /* 59 */ 73, 0 }, + { /* 60 */ 47, 0 }, + { /* 61 */ 74, 0 }, + { /* 62 */ 46, 0 }, + { /* 63 */ 6, 7 }, + { /* 64 */ 7, 8 }, + { /* 65 */ 8, 9 }, + { /* 66 */ 9, 10 }, + { /* 67 */ 10, 11 }, + { /* 68 */ 11, 12 }, + { /* 69 */ 76, 0 }, + { /* 70 */ 75, 0 }, + { /* 71 */ 77, 0 }, + { /* 72 */ 78, 0 }, + { /* 73 */ 45, 0 }, + { /* 74 */ 43, 0 }, + { /* 75 */ 6, 7 }, + { /* 76 */ 7, 8 }, + { /* 77 */ 8, 9 }, + { /* 78 */ 9, 10 }, + { /* 79 */ 10, 11 }, + { /* 80 */ 11, 12 }, + { /* 81 */ 44, 0 }, + { /* 82 */ 79, 0 }, + { /* 83 */ 42, 0 }, + { /* 84 */ 41, 0 }, + { /* 85 */ 80, 0 }, + { /* 86 */ 40, 0 }, + { /* 87 */ 6, 7 }, + { /* 88 */ 7, 8 }, + { /* 89 */ 8, 9 }, + { /* 90 */ 9, 10 }, + { /* 91 */ 10, 11 }, + { /* 92 */ 11, 12 }, + { /* 93 */ 81, 0 }, + { /* 94 */ 39, 0 }, + { /* 95 */ 82, 0 }, + { /* 96 */ 38, 0 }, + { /* 97 */ 83, 0 }, + { /* 98 */ 7, 8 }, + { /* 99 */ 8, 9 }, + { /* 00 */ 9, 10 }, + { /* 01 */ 10, 11 }, + { /* 02 */ 11, 12 }, + { /* 03 */ 12, 13 }, + { /* 04 */ 13, 14 }, + { /* 05 */ 37, 0 }, + { /* 06 */ 35, 0 }, + { /* 07 */ 85, 0 }, + { /* 08 */ 33, 0 }, + { /* 09 */ 36, 0 }, + { /* 10 */ 34, 0 }, + { /* 11 */ 84, 0 }, + { /* 12 */ 32, 0 }, + { /* 13 */ 6, 7 }, + { /* 14 */ 7, 8 }, + { /* 15 */ 8, 9 }, + { /* 16 */ 9, 10 }, + { /* 17 */ 10, 11 }, + { /* 18 */ 11, 12 }, + { /* 19 */ 87, 0 }, + { /* 20 */ 89, 0 }, + { /* 21 */ 30, 0 }, + { /* 22 */ 31, 0 }, + { /* 23 */ 8, 9 }, + { /* 24 */ 9, 10 }, + { /* 25 */ 10, 11 }, + { /* 26 */ 11, 12 }, + { /* 27 */ 12, 13 }, + { /* 28 */ 13, 14 }, + { /* 29 */ 14, 15 }, + { /* 30 */ 15, 16 }, + { /* 31 */ 86, 0 }, + { /* 32 */ 29, 0 }, + { /* 33 */ 26, 0 }, + { /* 34 */ 27, 0 }, + { /* 35 */ 28, 0 }, + { /* 36 */ 24, 0 }, + { /* 37 */ 88, 0 }, + { /* 38 */ 9, 10 }, + { /* 39 */ 10, 11 }, + { /* 40 */ 11, 12 }, + { /* 41 */ 12, 13 }, + { /* 42 */ 13, 14 }, + { /* 43 */ 14, 15 }, + { /* 44 */ 15, 16 }, + { /* 45 */ 16, 17 }, + { /* 46 */ 17, 18 }, + { /* 47 */ 25, 0 }, + { /* 48 */ 22, 0 }, + { /* 49 */ 23, 0 }, + { /* 50 */ 15, 16 }, + { /* 51 */ 16, 17 }, + { /* 52 */ 17, 18 }, + { /* 53 */ 18, 19 }, + { /* 54 */ 19, 20 }, + { /* 55 */ 20, 21 }, + { /* 56 */ 21, 22 }, + { /* 57 */ 22, 23 }, + { /* 58 */ 23, 24 }, + { /* 59 */ 24, 25 }, + { /* 60 */ 25, 26 }, + { /* 61 */ 26, 27 }, + { /* 62 */ 27, 28 }, + { /* 63 */ 28, 29 }, + { /* 64 */ 29, 30 }, + { /* 65 */ 90, 0 }, + { /* 66 */ 21, 0 }, + { /* 67 */ 19, 0 }, + { /* 68 */ 3, 0 }, + { /* 69 */ 1, 0 }, + { /* 70 */ 2, 0 }, + { /* 71 */ 0, 0 }, + { /* 72 */ 23, 24 }, + { /* 73 */ 24, 25 }, + { /* 74 */ 25, 26 }, + { /* 75 */ 26, 27 }, + { /* 76 */ 27, 28 }, + { /* 77 */ 28, 29 }, + { /* 78 */ 29, 30 }, + { /* 79 */ 30, 31 }, + { /* 80 */ 31, 32 }, + { /* 81 */ 32, 33 }, + { /* 82 */ 33, 34 }, + { /* 83 */ 34, 35 }, + { /* 84 */ 35, 36 }, + { /* 85 */ 36, 37 }, + { /* 86 */ 37, 38 }, + { /* 87 */ 38, 39 }, + { /* 88 */ 39, 40 }, + { /* 89 */ 40, 41 }, + { /* 90 */ 41, 42 }, + { /* 91 */ 42, 43 }, + { /* 92 */ 43, 44 }, + { /* 93 */ 44, 45 }, + { /* 94 */ 45, 46 }, + { /* 95 */ 98, 0 }, + { /* 96 */ 99, 0 }, + { /* 97 */ 100, 0 }, + { /* 98 */ 101, 0 }, + { /* 99 */ 102, 0 }, + { /* 00 */ 117, 0 }, + { /* 01 */ 97, 0 }, + { /* 02 */ 91, 0 }, + { /* 03 */ 92, 0 }, + { /* 04 */ 93, 0 }, + { /* 05 */ 94, 0 }, + { /* 06 */ 95, 0 }, + { /* 07 */ 96, 0 }, + { /* 08 */ 104, 0 }, + { /* 09 */ 111, 0 }, + { /* 10 */ 112, 0 }, + { /* 11 */ 113, 0 }, + { /* 12 */ 114, 0 }, + { /* 13 */ 115, 0 }, + { /* 14 */ 116, 0 }, + { /* 15 */ 110, 0 }, + { /* 16 */ 105, 0 }, + { /* 17 */ 106, 0 }, + { /* 18 */ 107, 0 }, + { /* 19 */ 108, 0 }, + { /* 20 */ 109, 0 }, + { /* 21 */ 118, 0 }, + { /* 22 */ 6, 0 }, + { /* 23 */ 8, 0 }, + { /* 24 */ 9, 0 }, + { /* 25 */ 10, 0 }, + { /* 26 */ 5, 0 }, + { /* 27 */ 103, 0 }, + { /* 28 */ 120, 0 }, + { /* 29 */ 119, 0 }, + { /* 30 */ 4, 0 }, + { /* 31 */ 7, 0 }, + { /* 32 */ 15, 0 }, + { /* 33 */ 16, 0 }, + { /* 34 */ 18, 0 }, + { /* 35 */ 20, 0 }, + { /* 36 */ 17, 0 }, + { /* 37 */ 11, 0 }, + { /* 38 */ 12, 0 }, + { /* 39 */ 14, 0 }, + { /* 40 */ 13, 0 } +}; diff --git a/Libraries/FAAD2/Files/libfaad/common.c b/Libraries/FAAD2/Files/libfaad/common.c new file mode 100644 index 000000000..c0676b479 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/common.c @@ -0,0 +1,519 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +/* just some common functions that could be used anywhere */ + +#include "common.h" +#include "structs.h" + +#include +#include "syntax.h" + + +/* Returns the sample rate index based on the samplerate */ +uint8_t get_sr_index(const uint32_t samplerate) +{ + if (92017 <= samplerate) return 0; + if (75132 <= samplerate) return 1; + if (55426 <= samplerate) return 2; + if (46009 <= samplerate) return 3; + if (37566 <= samplerate) return 4; + if (27713 <= samplerate) return 5; + if (23004 <= samplerate) return 6; + if (18783 <= samplerate) return 7; + if (13856 <= samplerate) return 8; + if (11502 <= samplerate) return 9; + if (9391 <= samplerate) return 10; + if (16428320 <= samplerate) return 11; + + return 11; +} + +/* Returns the sample rate based on the sample rate index */ +uint32_t get_sample_rate(const uint8_t sr_index) +{ + static const uint32_t sample_rates[] = + { + 96000, 88200, 64000, 48000, 44100, 32000, + 24000, 22050, 16000, 12000, 11025, 8000 + }; + + if (sr_index < 12) + return sample_rates[sr_index]; + + return 0; +} + +uint8_t max_pred_sfb(const uint8_t sr_index) +{ + static const uint8_t pred_sfb_max[] = + { + 33, 33, 38, 40, 40, 40, 41, 41, 37, 37, 37, 34 + }; + + + if (sr_index < 12) + return pred_sfb_max[sr_index]; + + return 0; +} + +uint8_t max_tns_sfb(const uint8_t sr_index, const uint8_t object_type, + const uint8_t is_short) +{ + /* entry for each sampling rate + * 1 Main/LC long window + * 2 Main/LC short window + * 3 SSR long window + * 4 SSR short window + */ + static const uint8_t tns_sbf_max[][4] = + { + {31, 9, 28, 7}, /* 96000 */ + {31, 9, 28, 7}, /* 88200 */ + {34, 10, 27, 7}, /* 64000 */ + {40, 14, 26, 6}, /* 48000 */ + {42, 14, 26, 6}, /* 44100 */ + {51, 14, 26, 6}, /* 32000 */ + {46, 14, 29, 7}, /* 24000 */ + {46, 14, 29, 7}, /* 22050 */ + {42, 14, 23, 8}, /* 16000 */ + {42, 14, 23, 8}, /* 12000 */ + {42, 14, 23, 8}, /* 11025 */ + {39, 14, 19, 7}, /* 8000 */ + {39, 14, 19, 7}, /* 7350 */ + {0,0,0,0}, + {0,0,0,0}, + {0,0,0,0} + }; + uint8_t i = 0; + + if (is_short) i++; + if (object_type == SSR) i += 2; + + return tns_sbf_max[sr_index][i]; +} + +/* Returns 0 if an object type is decodable, otherwise returns -1 */ +int8_t can_decode_ot(const uint8_t object_type) +{ + switch (object_type) + { + case LC: + return 0; + case MAIN: +#ifdef MAIN_DEC + return 0; +#else + return -1; +#endif + case SSR: +#ifdef SSR_DEC + return 0; +#else + return -1; +#endif + case LTP: +#ifdef LTP_DEC + return 0; +#else + return -1; +#endif + + /* ER object types */ +#ifdef ERROR_RESILIENCE + case ER_LC: +#ifdef DRM + case DRM_ER_LC: +#endif + return 0; + case ER_LTP: +#ifdef LTP_DEC + return 0; +#else + return -1; +#endif + case LD: +#ifdef LD_DEC + return 0; +#else + return -1; +#endif +#endif + } + + return -1; +} + +void *faad_malloc(size_t size) +{ +#if 0 // defined(_WIN32) && !defined(_WIN32_WCE) + return _aligned_malloc(size, 16); +#else // #ifdef 0 + return malloc(size); +#endif // #ifdef 0 +} + +/* common free function */ +void faad_free(void *b) +{ +#if 0 // defined(_WIN32) && !defined(_WIN32_WCE) + _aligned_free(b); +#else + free(b); +} +#endif + +static const uint8_t Parity [256] = { // parity + 0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1, + 1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0, + 1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0, + 0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1, + 1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0, + 0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1, + 0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1, + 1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0 +}; + +static uint32_t __r1 = 1; +static uint32_t __r2 = 1; + + +/* + * This is a simple random number generator with good quality for audio purposes. + * It consists of two polycounters with opposite rotation direction and different + * periods. The periods are coprime, so the total period is the product of both. + * + * ------------------------------------------------------------------------------------------------- + * +-> |31:30:29:28:27:26:25:24:23:22:21:20:19:18:17:16:15:14:13:12:11:10: 9: 8: 7: 6: 5: 4: 3: 2: 1: 0| + * | ------------------------------------------------------------------------------------------------- + * | | | | | | | + * | +--+--+--+-XOR-+--------+ + * | | + * +--------------------------------------------------------------------------------------+ + * + * ------------------------------------------------------------------------------------------------- + * |31:30:29:28:27:26:25:24:23:22:21:20:19:18:17:16:15:14:13:12:11:10: 9: 8: 7: 6: 5: 4: 3: 2: 1: 0| <-+ + * ------------------------------------------------------------------------------------------------- | + * | | | | | + * +--+----XOR----+--+ | + * | | + * +----------------------------------------------------------------------------------------+ + * + * + * The first has an period of 3*5*17*257*65537, the second of 7*47*73*178481, + * which gives a period of 18.410.713.077.675.721.215. The result is the + * XORed values of both generators. + */ +uint32_t random_int(void) +{ + uint32_t t1, t2, t3, t4; + + t3 = t1 = __r1; t4 = t2 = __r2; // Parity calculation is done via table lookup, this is also available + t1 &= 0xF5; t2 >>= 25; // on CPUs without parity, can be implemented in C and avoid unpredictable + t1 = Parity [t1]; t2 &= 0x63; // jumps and slow rotate through the carry flag operations. + t1 <<= 31; t2 = Parity [t2]; + + return (__r1 = (t3 >> 1) | t1 ) ^ (__r2 = (t4 + t4) | t2 ); +} + +uint32_t ones32(uint32_t x) +{ + x -= ((x >> 1) & 0x55555555); + x = (((x >> 2) & 0x33333333) + (x & 0x33333333)); + x = (((x >> 4) + x) & 0x0f0f0f0f); + x += (x >> 8); + x += (x >> 16); + + return (x & 0x0000003f); +} + +uint32_t floor_log2(uint32_t x) +{ +#if 1 + x |= (x >> 1); + x |= (x >> 2); + x |= (x >> 4); + x |= (x >> 8); + x |= (x >> 16); + + return (ones32(x) - 1); +#else + uint32_t count = 0; + + while (x >>= 1) + count++; + + return count; +#endif +} + +/* returns position of first bit that is not 0 from msb, + * starting count at lsb */ +uint32_t wl_min_lzc(uint32_t x) +{ +#if 1 + x |= (x >> 1); + x |= (x >> 2); + x |= (x >> 4); + x |= (x >> 8); + x |= (x >> 16); + + return (ones32(x)); +#else + uint32_t count = 0; + + while (x >>= 1) + count++; + + return (count + 1); +#endif +} + +#ifdef FIXED_POINT + +#define TABLE_BITS 6 +/* just take the maximum number of bits for interpolation */ +#define INTERP_BITS (REAL_BITS-TABLE_BITS) + +static const real_t pow2_tab[] = { + REAL_CONST(1.000000000000000), REAL_CONST(1.010889286051701), REAL_CONST(1.021897148654117), + REAL_CONST(1.033024879021228), REAL_CONST(1.044273782427414), REAL_CONST(1.055645178360557), + REAL_CONST(1.067140400676824), REAL_CONST(1.078760797757120), REAL_CONST(1.090507732665258), + REAL_CONST(1.102382583307841), REAL_CONST(1.114386742595892), REAL_CONST(1.126521618608242), + REAL_CONST(1.138788634756692), REAL_CONST(1.151189229952983), REAL_CONST(1.163724858777578), + REAL_CONST(1.176396991650281), REAL_CONST(1.189207115002721), REAL_CONST(1.202156731452703), + REAL_CONST(1.215247359980469), REAL_CONST(1.228480536106870), REAL_CONST(1.241857812073484), + REAL_CONST(1.255380757024691), REAL_CONST(1.269050957191733), REAL_CONST(1.282870016078778), + REAL_CONST(1.296839554651010), REAL_CONST(1.310961211524764), REAL_CONST(1.325236643159741), + REAL_CONST(1.339667524053303), REAL_CONST(1.354255546936893), REAL_CONST(1.369002422974591), + REAL_CONST(1.383909881963832), REAL_CONST(1.398979672538311), REAL_CONST(1.414213562373095), + REAL_CONST(1.429613338391970), REAL_CONST(1.445180806977047), REAL_CONST(1.460917794180647), + REAL_CONST(1.476826145939499), REAL_CONST(1.492907728291265), REAL_CONST(1.509164427593423), + REAL_CONST(1.525598150744538), REAL_CONST(1.542210825407941), REAL_CONST(1.559004400237837), + REAL_CONST(1.575980845107887), REAL_CONST(1.593142151342267), REAL_CONST(1.610490331949254), + REAL_CONST(1.628027421857348), REAL_CONST(1.645755478153965), REAL_CONST(1.663676580326736), + REAL_CONST(1.681792830507429), REAL_CONST(1.700106353718524), REAL_CONST(1.718619298122478), + REAL_CONST(1.737333835273706), REAL_CONST(1.756252160373300), REAL_CONST(1.775376492526521), + REAL_CONST(1.794709075003107), REAL_CONST(1.814252175500399), REAL_CONST(1.834008086409342), + REAL_CONST(1.853979125083386), REAL_CONST(1.874167634110300), REAL_CONST(1.894575981586966), + REAL_CONST(1.915206561397147), REAL_CONST(1.936061793492294), REAL_CONST(1.957144124175400), + REAL_CONST(1.978456026387951), REAL_CONST(2.000000000000000) +}; + +static const real_t log2_tab[] = { + REAL_CONST(0.000000000000000), REAL_CONST(0.022367813028455), REAL_CONST(0.044394119358453), + REAL_CONST(0.066089190457772), REAL_CONST(0.087462841250339), REAL_CONST(0.108524456778169), + REAL_CONST(0.129283016944966), REAL_CONST(0.149747119504682), REAL_CONST(0.169925001442312), + REAL_CONST(0.189824558880017), REAL_CONST(0.209453365628950), REAL_CONST(0.228818690495881), + REAL_CONST(0.247927513443585), REAL_CONST(0.266786540694901), REAL_CONST(0.285402218862248), + REAL_CONST(0.303780748177103), REAL_CONST(0.321928094887362), REAL_CONST(0.339850002884625), + REAL_CONST(0.357552004618084), REAL_CONST(0.375039431346925), REAL_CONST(0.392317422778760), + REAL_CONST(0.409390936137702), REAL_CONST(0.426264754702098), REAL_CONST(0.442943495848728), + REAL_CONST(0.459431618637297), REAL_CONST(0.475733430966398), REAL_CONST(0.491853096329675), + REAL_CONST(0.507794640198696), REAL_CONST(0.523561956057013), REAL_CONST(0.539158811108031), + REAL_CONST(0.554588851677637), REAL_CONST(0.569855608330948), REAL_CONST(0.584962500721156), + REAL_CONST(0.599912842187128), REAL_CONST(0.614709844115208), REAL_CONST(0.629356620079610), + REAL_CONST(0.643856189774725), REAL_CONST(0.658211482751795), REAL_CONST(0.672425341971496), + REAL_CONST(0.686500527183218), REAL_CONST(0.700439718141092), REAL_CONST(0.714245517666123), + REAL_CONST(0.727920454563199), REAL_CONST(0.741466986401147), REAL_CONST(0.754887502163469), + REAL_CONST(0.768184324776926), REAL_CONST(0.781359713524660), REAL_CONST(0.794415866350106), + REAL_CONST(0.807354922057604), REAL_CONST(0.820178962415188), REAL_CONST(0.832890014164742), + REAL_CONST(0.845490050944375), REAL_CONST(0.857980995127572), REAL_CONST(0.870364719583405), + REAL_CONST(0.882643049361841), REAL_CONST(0.894817763307943), REAL_CONST(0.906890595608519), + REAL_CONST(0.918863237274595), REAL_CONST(0.930737337562886), REAL_CONST(0.942514505339240), + REAL_CONST(0.954196310386875), REAL_CONST(0.965784284662087), REAL_CONST(0.977279923499917), + REAL_CONST(0.988684686772166), REAL_CONST(1.000000000000000) +}; + +real_t pow2_fix(real_t val) +{ + uint32_t x1, x2; + uint32_t errcorr; + uint32_t index_frac; + real_t retval; + int32_t whole = (val >> REAL_BITS); + + /* rest = [0..1] */ + int32_t rest = val - (whole << REAL_BITS); + + /* index into pow2_tab */ + int32_t index = rest >> (REAL_BITS-TABLE_BITS); + + + if (val == 0) + return (1<> (REAL_BITS-TABLE_BITS-INTERP_BITS); + index_frac = index_frac & ((1< 0) + { + retval = 1 << whole; + } else { + retval = REAL_CONST(1) >> -whole; + } + + x1 = pow2_tab[index & ((1<> INTERP_BITS; + + if (whole > 0) + { + retval = retval * (errcorr + x1); + } else { + retval = MUL_R(retval, (errcorr + x1)); + } + + return retval; +} + +int32_t pow2_int(real_t val) +{ + uint32_t x1, x2; + uint32_t errcorr; + uint32_t index_frac; + real_t retval; + int32_t whole = (val >> REAL_BITS); + + /* rest = [0..1] */ + int32_t rest = val - (whole << REAL_BITS); + + /* index into pow2_tab */ + int32_t index = rest >> (REAL_BITS-TABLE_BITS); + + + if (val == 0) + return 1; + + /* leave INTERP_BITS bits */ + index_frac = rest >> (REAL_BITS-TABLE_BITS-INTERP_BITS); + index_frac = index_frac & ((1< 0) + retval = 1 << whole; + else + retval = 0; + + x1 = pow2_tab[index & ((1<> INTERP_BITS; + + retval = MUL_R(retval, (errcorr + x1)); + + return retval; +} + +/* ld(x) = ld(x*y/y) = ld(x/y) + ld(y), with y=2^N and [1 <= (x/y) < 2] */ +int32_t log2_int(uint32_t val) +{ + uint32_t frac; + uint32_t whole = (val); + int32_t exp = 0; + uint32_t index; + uint32_t index_frac; + uint32_t x1, x2; + uint32_t errcorr; + + /* error */ + if (val == 0) + return -10000; + + exp = floor_log2(val); + exp -= REAL_BITS; + + /* frac = [1..2] */ + if (exp >= 0) + frac = val >> exp; + else + frac = val << -exp; + + /* index in the log2 table */ + index = frac >> (REAL_BITS-TABLE_BITS); + + /* leftover part for linear interpolation */ + index_frac = frac & ((1<<(REAL_BITS-TABLE_BITS))-1); + + /* leave INTERP_BITS bits */ + index_frac = index_frac >> (REAL_BITS-TABLE_BITS-INTERP_BITS); + + x1 = log2_tab[index & ((1<> INTERP_BITS; + + return ((exp+REAL_BITS) << REAL_BITS) + errcorr + x1; +} + +/* ld(x) = ld(x*y/y) = ld(x/y) + ld(y), with y=2^N and [1 <= (x/y) < 2] */ +real_t log2_fix(uint32_t val) +{ + uint32_t frac; + uint32_t whole = (val >> REAL_BITS); + int8_t exp = 0; + uint32_t index; + uint32_t index_frac; + uint32_t x1, x2; + uint32_t errcorr; + + /* error */ + if (val == 0) + return -100000; + + exp = floor_log2(val); + exp -= REAL_BITS; + + /* frac = [1..2] */ + if (exp >= 0) + frac = val >> exp; + else + frac = val << -exp; + + /* index in the log2 table */ + index = frac >> (REAL_BITS-TABLE_BITS); + + /* leftover part for linear interpolation */ + index_frac = frac & ((1<<(REAL_BITS-TABLE_BITS))-1); + + /* leave INTERP_BITS bits */ + index_frac = index_frac >> (REAL_BITS-TABLE_BITS-INTERP_BITS); + + x1 = log2_tab[index & ((1<> INTERP_BITS; + + return (exp << REAL_BITS) + errcorr + x1; +} +#endif diff --git a/Libraries/FAAD2/Files/libfaad/common.h b/Libraries/FAAD2/Files/libfaad/common.h new file mode 100644 index 000000000..efe8288b3 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/common.h @@ -0,0 +1,425 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#ifndef __COMMON_H__ +#define __COMMON_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef HAVE_CONFIG_H +# include "../config.h" +#endif + +#define INLINE __inline +#if 0 //defined(_WIN32) && !defined(_WIN32_WCE) +#define ALIGN __declspec(align(16)) +#else +#define ALIGN +#endif + +#ifndef max +#define max(a, b) (((a) > (b)) ? (a) : (b)) +#endif +#ifndef min +#define min(a, b) (((a) < (b)) ? (a) : (b)) +#endif + +/* COMPILE TIME DEFINITIONS */ + +/* use double precision */ +/* #define USE_DOUBLE_PRECISION */ +/* use fixed point reals */ +//#define FIXED_POINT +//#define BIG_IQ_TABLE + +/* Use if target platform has address generators with autoincrement */ +//#define PREFER_POINTERS + +#ifdef _WIN32_WCE +#define FIXED_POINT +#endif + + +#define ERROR_RESILIENCE + + +/* Allow decoding of MAIN profile AAC */ +#define MAIN_DEC +/* Allow decoding of SSR profile AAC */ +//#define SSR_DEC +/* Allow decoding of LTP profile AAC */ +#define LTP_DEC +/* Allow decoding of LD profile AAC */ +#define LD_DEC +/* Allow decoding of scalable profiles */ +//#define SCALABLE_DEC +/* Allow decoding of Digital Radio Mondiale (DRM) */ +//#define DRM +//#define DRM_PS + +/* LD can't do without LTP */ +#ifdef LD_DEC +#ifndef ERROR_RESILIENCE +#define ERROR_RESILIENCE +#endif +#ifndef LTP_DEC +#define LTP_DEC +#endif +#endif + +#define ALLOW_SMALL_FRAMELENGTH + + +// Define LC_ONLY_DECODER if you want a pure AAC LC decoder (independant of SBR_DEC and PS_DEC) +//#define LC_ONLY_DECODER +#ifdef LC_ONLY_DECODER + #undef LD_DEC + #undef LTP_DEC + #undef MAIN_DEC + #undef SSR_DEC + #undef DRM + #undef ALLOW_SMALL_FRAMELENGTH + #undef ERROR_RESILIENCE +#endif + +#define SBR_DEC +//#define SBR_LOW_POWER +#define PS_DEC + +/* FIXED POINT: No MAIN decoding */ +#ifdef FIXED_POINT +# ifdef MAIN_DEC +# undef MAIN_DEC +# endif +#endif // FIXED_POINT + +#ifdef DRM +# ifndef SCALABLE_DEC +# define SCALABLE_DEC +# endif +#endif + + +#ifdef FIXED_POINT +#define DIV_R(A, B) (((int64_t)A << REAL_BITS)/B) +#define DIV_C(A, B) (((int64_t)A << COEF_BITS)/B) +#else +#define DIV_R(A, B) ((A)/(B)) +#define DIV_C(A, B) ((A)/(B)) +#endif + +#ifndef SBR_LOW_POWER +#define qmf_t complex_t +#define QMF_RE(A) RE(A) +#define QMF_IM(A) IM(A) +#else +#define qmf_t real_t +#define QMF_RE(A) (A) +#define QMF_IM(A) +#endif + + +/* END COMPILE TIME DEFINITIONS */ + +#if defined(_WIN32) && !defined(__MINGW32__) + +#include + +typedef unsigned __int64 uint64_t; +typedef unsigned __int32 uint32_t; +typedef unsigned __int16 uint16_t; +typedef unsigned __int8 uint8_t; +typedef __int64 int64_t; +typedef __int32 int32_t; +typedef __int16 int16_t; +typedef __int8 int8_t; +typedef float float32_t; + + +#else + +#include +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_SYS_STAT_H +# include +#endif +#if STDC_HEADERS +# include +# include +#else +# if HAVE_STDLIB_H +# include +# endif +#endif +#if HAVE_STRING_H +# if !STDC_HEADERS && HAVE_MEMORY_H +# include +# endif +# include +#endif +#if HAVE_STRINGS_H +# include +#endif +#if HAVE_INTTYPES_H +# include +#else +# if HAVE_STDINT_H +# include +# else +/* we need these... */ +typedef unsigned long long uint64_t; +typedef unsigned long uint32_t; +typedef unsigned short uint16_t; +typedef unsigned char uint8_t; +typedef long long int64_t; +typedef long int32_t; +typedef short int16_t; +typedef char int8_t; +# endif +#endif +#if HAVE_UNISTD_H +# include +#endif + +#ifndef HAVE_FLOAT32_T +typedef float float32_t; +#endif + +#if STDC_HEADERS +# include +#else +# if !HAVE_STRCHR +# define strchr index +# define strrchr rindex +# endif +char *strchr(), *strrchr(); +# if !HAVE_MEMCPY +# define memcpy(d, s, n) bcopy((s), (d), (n)) +# define memmove(d, s, n) bcopy((s), (d), (n)) +# endif +#endif + +#endif + +#ifdef WORDS_BIGENDIAN +#define ARCH_IS_BIG_ENDIAN +#endif + +/* FIXED_POINT doesn't work with MAIN and SSR yet */ +#ifdef FIXED_POINT + #undef MAIN_DEC + #undef SSR_DEC +#endif + + +#if defined(FIXED_POINT) + + #include "fixed.h" + +#elif defined(USE_DOUBLE_PRECISION) + + typedef double real_t; + + #include + + #define MUL_R(A,B) ((A)*(B)) + #define MUL_C(A,B) ((A)*(B)) + #define MUL_F(A,B) ((A)*(B)) + + /* Complex multiplication */ + static INLINE void ComplexMult(real_t *y1, real_t *y2, + real_t x1, real_t x2, real_t c1, real_t c2) + { + *y1 = MUL_F(x1, c1) + MUL_F(x2, c2); + *y2 = MUL_F(x2, c1) - MUL_F(x1, c2); + } + + #define REAL_CONST(A) ((real_t)(A)) + #define COEF_CONST(A) ((real_t)(A)) + #define Q2_CONST(A) ((real_t)(A)) + #define FRAC_CONST(A) ((real_t)(A)) /* pure fractional part */ + +#else /* Normal floating point operation */ + + typedef float real_t; + + #define MUL_R(A,B) ((A)*(B)) + #define MUL_C(A,B) ((A)*(B)) + #define MUL_F(A,B) ((A)*(B)) + + #define REAL_CONST(A) ((real_t)(A)) + #define COEF_CONST(A) ((real_t)(A)) + #define Q2_CONST(A) ((real_t)(A)) + #define FRAC_CONST(A) ((real_t)(A)) /* pure fractional part */ + + /* Complex multiplication */ + static INLINE void ComplexMult(real_t *y1, real_t *y2, + real_t x1, real_t x2, real_t c1, real_t c2) + { + *y1 = MUL_F(x1, c1) + MUL_F(x2, c2); + *y2 = MUL_F(x2, c1) - MUL_F(x1, c2); + } + + + #if defined(_WIN32) && !defined(__MINGW32__) + #define HAS_LRINTF + static INLINE int lrintf(float f) + { + int i; + __asm + { + fld f + fistp i + } + return i; + } + #elif (defined(__i386__) && defined(__GNUC__)) + #define HAS_LRINTF + // from http://www.stereopsis.com/FPU.html + static INLINE int lrintf(float f) + { + int i; + __asm__ __volatile__ ( + "flds %1 \n\t" + "fistpl %0 \n\t" + : "=m" (i) + : "m" (f)); + return i; + } + #endif + + + #ifdef __ICL /* only Intel C compiler has fmath ??? */ + + #include + + #define sin sinf + #define cos cosf + #define log logf + #define floor floorf + #define ceil ceilf + #define sqrt sqrtf + + #else + +#ifdef HAVE_LRINTF +# define HAS_LRINTF +# define _ISOC9X_SOURCE 1 +# define _ISOC99_SOURCE 1 +# define __USE_ISOC9X 1 +# define __USE_ISOC99 1 +#endif + + #include + +#ifdef HAVE_SINF +# define sin sinf +#error +#endif +#ifdef HAVE_COSF +# define cos cosf +#endif +#ifdef HAVE_LOGF +# define log logf +#endif +#ifdef HAVE_EXPF +# define exp expf +#endif +#ifdef HAVE_FLOORF +# define floor floorf +#endif +#ifdef HAVE_CEILF +# define ceil ceilf +#endif +#ifdef HAVE_SQRTF +# define sqrt sqrtf +#endif + + #endif + +#endif + +#ifndef HAS_LRINTF +/* standard cast */ +#define lrintf(f) ((int32_t)(f)) +#endif + +typedef real_t complex_t[2]; +#define RE(A) A[0] +#define IM(A) A[1] + + +/* common functions */ +uint8_t cpu_has_sse(void); +uint32_t random_int(void); +uint32_t ones32(uint32_t x); +uint32_t floor_log2(uint32_t x); +uint32_t wl_min_lzc(uint32_t x); +#ifdef FIXED_POINT +#define LOG2_MIN_INF REAL_CONST(-10000) +int32_t log2_int(uint32_t val); +int32_t log2_fix(uint32_t val); +int32_t pow2_int(real_t val); +real_t pow2_fix(real_t val); +#endif +uint8_t get_sr_index(const uint32_t samplerate); +uint8_t max_pred_sfb(const uint8_t sr_index); +uint8_t max_tns_sfb(const uint8_t sr_index, const uint8_t object_type, + const uint8_t is_short); +uint32_t get_sample_rate(const uint8_t sr_index); +int8_t can_decode_ot(const uint8_t object_type); + +void *faad_malloc(size_t size); +void faad_free(void *b); + +//#define PROFILE +#ifdef PROFILE +static int64_t faad_get_ts() +{ + __asm + { + rdtsc + } +} +#endif + +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif +#ifndef M_PI_2 /* PI/2 */ +#define M_PI_2 1.57079632679489661923 +#endif + + +#ifdef __cplusplus +} +#endif +#endif diff --git a/Libraries/FAAD2/Files/libfaad/decoder.c b/Libraries/FAAD2/Files/libfaad/decoder.c new file mode 100644 index 000000000..b2c37dadb --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/decoder.c @@ -0,0 +1,1024 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#include "common.h" +#include "structs.h" + +#include +#include + +#include "decoder.h" +#include "mp4.h" +#include "syntax.h" +#include "error.h" +#include "output.h" +#include "filtbank.h" +#include "drc.h" +#ifdef SBR_DEC +#include "sbr_dec.h" +#include "sbr_syntax.h" +#endif +#ifdef SSR_DEC +#include "ssr.h" +#endif + +#ifdef ANALYSIS +uint16_t dbg_count; +#endif + +/* static function declarations */ +static void* aac_frame_decode(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo, + uint8_t *buffer, uint32_t buffer_size, + void **sample_buffer, uint32_t sample_buffer_size); +static void create_channel_config(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo); + + +char* NEAACDECAPI NeAACDecGetErrorMessage(uint8_t errcode) +{ + if (errcode >= NUM_ERROR_MESSAGES) + return NULL; + return err_msg[errcode]; +} + +uint32_t NEAACDECAPI NeAACDecGetCapabilities(void) +{ + uint32_t cap = 0; + + /* can't do without it */ + cap += LC_DEC_CAP; + +#ifdef MAIN_DEC + cap += MAIN_DEC_CAP; +#endif +#ifdef LTP_DEC + cap += LTP_DEC_CAP; +#endif +#ifdef LD_DEC + cap += LD_DEC_CAP; +#endif +#ifdef ERROR_RESILIENCE + cap += ERROR_RESILIENCE_CAP; +#endif +#ifdef FIXED_POINT + cap += FIXED_POINT_CAP; +#endif + + return cap; +} + +NeAACDecHandle NEAACDECAPI NeAACDecOpen(void) +{ + uint8_t i; + NeAACDecHandle hDecoder = NULL; + + if ((hDecoder = (NeAACDecHandle)faad_malloc(sizeof(NeAACDecStruct))) == NULL) + return NULL; + + memset(hDecoder, 0, sizeof(NeAACDecStruct)); + + hDecoder->config.outputFormat = FAAD_FMT_16BIT; + hDecoder->config.defObjectType = MAIN; + hDecoder->config.defSampleRate = 44100; /* Default: 44.1kHz */ + hDecoder->config.downMatrix = 0; + hDecoder->adts_header_present = 0; + hDecoder->adif_header_present = 0; +#ifdef ERROR_RESILIENCE + hDecoder->aacSectionDataResilienceFlag = 0; + hDecoder->aacScalefactorDataResilienceFlag = 0; + hDecoder->aacSpectralDataResilienceFlag = 0; +#endif + hDecoder->frameLength = 1024; + + hDecoder->frame = 0; + hDecoder->sample_buffer = NULL; + + for (i = 0; i < MAX_CHANNELS; i++) + { + hDecoder->window_shape_prev[i] = 0; + hDecoder->time_out[i] = NULL; + hDecoder->fb_intermed[i] = NULL; +#ifdef SSR_DEC + hDecoder->ssr_overlap[i] = NULL; + hDecoder->prev_fmd[i] = NULL; +#endif +#ifdef MAIN_DEC + hDecoder->pred_stat[i] = NULL; +#endif +#ifdef LTP_DEC + hDecoder->ltp_lag[i] = 0; + hDecoder->lt_pred_stat[i] = NULL; +#endif + } + +#ifdef SBR_DEC + for (i = 0; i < MAX_SYNTAX_ELEMENTS; i++) + { + hDecoder->sbr[i] = NULL; + } +#endif + + hDecoder->drc = drc_init(REAL_CONST(1.0), REAL_CONST(1.0)); + + return hDecoder; +} + +NeAACDecConfigurationPtr NEAACDECAPI NeAACDecGetCurrentConfiguration(NeAACDecHandle hDecoder) +{ + if (hDecoder) + { + NeAACDecConfigurationPtr config = &(hDecoder->config); + + return config; + } + + return NULL; +} + +uint8_t NEAACDECAPI NeAACDecSetConfiguration(NeAACDecHandle hDecoder, + NeAACDecConfigurationPtr config) +{ + if (hDecoder && config) + { + /* check if we can decode this object type */ + if (can_decode_ot(config->defObjectType) < 0) + return 0; + hDecoder->config.defObjectType = config->defObjectType; + + /* samplerate: anything but 0 should be possible */ + if (config->defSampleRate == 0) + return 0; + hDecoder->config.defSampleRate = config->defSampleRate; + + /* check output format */ +#ifdef FIXED_POINT + if ((config->outputFormat < 1) || (config->outputFormat > 4)) + return 0; +#else + if ((config->outputFormat < 1) || (config->outputFormat > 5)) + return 0; +#endif + hDecoder->config.outputFormat = config->outputFormat; + + if (config->downMatrix > 1) + return 0; + hDecoder->config.downMatrix = config->downMatrix; + + /* OK */ + return 1; + } + + return 0; +} + +int32_t NEAACDECAPI NeAACDecInit(NeAACDecHandle hDecoder, uint8_t *buffer, + uint32_t buffer_size, + uint32_t *samplerate, uint8_t *channels) +{ + uint32_t bits = 0; + bitfile ld; + adif_header adif; + adts_header adts; + + if ((hDecoder == NULL) || (samplerate == NULL) || (channels == NULL)) + return -1; + + hDecoder->sf_index = get_sr_index(hDecoder->config.defSampleRate); + hDecoder->object_type = hDecoder->config.defObjectType; + *samplerate = get_sample_rate(hDecoder->sf_index); + *channels = 1; + + if (buffer != NULL) + { + faad_initbits(&ld, buffer, buffer_size); + + /* Check if an ADIF header is present */ + if ((buffer[0] == 'A') && (buffer[1] == 'D') && + (buffer[2] == 'I') && (buffer[3] == 'F')) + { + hDecoder->adif_header_present = 1; + + get_adif_header(&adif, &ld); + faad_byte_align(&ld); + + hDecoder->sf_index = adif.pce[0].sf_index; + hDecoder->object_type = adif.pce[0].object_type + 1; + + *samplerate = get_sample_rate(hDecoder->sf_index); + *channels = adif.pce[0].channels; + + memcpy(&(hDecoder->pce), &(adif.pce[0]), sizeof(program_config)); + hDecoder->pce_set = 1; + + bits = bit2byte(faad_get_processed_bits(&ld)); + + /* Check if an ADTS header is present */ + } else if (faad_showbits(&ld, 12) == 0xfff) { + hDecoder->adts_header_present = 1; + + adts.old_format = hDecoder->config.useOldADTSFormat; + adts_frame(&adts, &ld); + + hDecoder->sf_index = adts.sf_index; + hDecoder->object_type = adts.profile + 1; + + *samplerate = get_sample_rate(hDecoder->sf_index); + *channels = (adts.channel_configuration > 6) ? + 2 : adts.channel_configuration; + } + + if (ld.error) + { + faad_endbits(&ld); + return -1; + } + faad_endbits(&ld); + } + hDecoder->channelConfiguration = *channels; + +#if (defined(PS_DEC) || defined(DRM_PS)) + /* check if we have a mono file */ + if (*channels == 1) + { + /* upMatrix to 2 channels for implicit signalling of PS */ + *channels = 2; + } +#endif + +#ifdef SBR_DEC + /* implicit signalling */ + if (*samplerate <= 24000 && !(hDecoder->config.dontUpSampleImplicitSBR)) + { + *samplerate *= 2; + hDecoder->forceUpSampling = 1; + } else if (*samplerate > 24000 && !(hDecoder->config.dontUpSampleImplicitSBR)) { + hDecoder->downSampledSBR = 1; + } +#endif + + /* must be done before frameLength is divided by 2 for LD */ +#ifdef SSR_DEC + if (hDecoder->object_type == SSR) + hDecoder->fb = ssr_filter_bank_init(hDecoder->frameLength/SSR_BANDS); + else +#endif + hDecoder->fb = filter_bank_init(hDecoder->frameLength); + +#ifdef LD_DEC + if (hDecoder->object_type == LD) + hDecoder->frameLength >>= 1; +#endif + + if (can_decode_ot(hDecoder->object_type) < 0) + return -1; + + return bits; +} + +/* Init the library using a DecoderSpecificInfo */ +int8_t NEAACDECAPI NeAACDecInit2(NeAACDecHandle hDecoder, uint8_t *pBuffer, + uint32_t SizeOfDecoderSpecificInfo, + uint32_t *samplerate, uint8_t *channels) +{ + int8_t rc; + mp4AudioSpecificConfig mp4ASC; + + if((hDecoder == NULL) + || (pBuffer == NULL) + || (SizeOfDecoderSpecificInfo < 2) + || (samplerate == NULL) + || (channels == NULL)) + { + return -1; + } + + hDecoder->adif_header_present = 0; + hDecoder->adts_header_present = 0; + + /* decode the audio specific config */ + rc = AudioSpecificConfig2(pBuffer, SizeOfDecoderSpecificInfo, &mp4ASC, + &(hDecoder->pce)); + + /* copy the relevant info to the decoder handle */ + *samplerate = mp4ASC.samplingFrequency; + if (mp4ASC.channelsConfiguration) + { + *channels = mp4ASC.channelsConfiguration; + } else { + *channels = hDecoder->pce.channels; + hDecoder->pce_set = 1; + } +#if (defined(PS_DEC) || defined(DRM_PS)) + /* check if we have a mono file */ + if (*channels == 1) + { + /* upMatrix to 2 channels for implicit signalling of PS */ + *channels = 2; + } +#endif + hDecoder->sf_index = mp4ASC.samplingFrequencyIndex; + hDecoder->object_type = mp4ASC.objectTypeIndex; +#ifdef ERROR_RESILIENCE + hDecoder->aacSectionDataResilienceFlag = mp4ASC.aacSectionDataResilienceFlag; + hDecoder->aacScalefactorDataResilienceFlag = mp4ASC.aacScalefactorDataResilienceFlag; + hDecoder->aacSpectralDataResilienceFlag = mp4ASC.aacSpectralDataResilienceFlag; +#endif +#ifdef SBR_DEC + hDecoder->sbr_present_flag = mp4ASC.sbr_present_flag; + hDecoder->downSampledSBR = mp4ASC.downSampledSBR; + if (hDecoder->config.dontUpSampleImplicitSBR == 0) + hDecoder->forceUpSampling = mp4ASC.forceUpSampling; + else + hDecoder->forceUpSampling = 0; + + /* AAC core decoder samplerate is 2 times as low */ + if (((hDecoder->sbr_present_flag == 1)&&(!hDecoder->downSampledSBR)) || hDecoder->forceUpSampling == 1) + { + hDecoder->sf_index = get_sr_index(mp4ASC.samplingFrequency / 2); + } +#endif + + if (rc != 0) + { + return rc; + } + hDecoder->channelConfiguration = mp4ASC.channelsConfiguration; + if (mp4ASC.frameLengthFlag) +#ifdef ALLOW_SMALL_FRAMELENGTH + hDecoder->frameLength = 960; +#else + return -1; +#endif + + /* must be done before frameLength is divided by 2 for LD */ +#ifdef SSR_DEC + if (hDecoder->object_type == SSR) + hDecoder->fb = ssr_filter_bank_init(hDecoder->frameLength/SSR_BANDS); + else +#endif + hDecoder->fb = filter_bank_init(hDecoder->frameLength); + +#ifdef LD_DEC + if (hDecoder->object_type == LD) + hDecoder->frameLength >>= 1; +#endif + + return 0; +} + +#ifdef DRM +int8_t NEAACDECAPI NeAACDecInitDRM(NeAACDecHandle *hDecoder, uint32_t samplerate, + uint8_t channels) +{ + if (hDecoder == NULL) + return 1; /* error */ + + NeAACDecClose(*hDecoder); + + *hDecoder = NeAACDecOpen(); + + /* Special object type defined for DRM */ + (*hDecoder)->config.defObjectType = DRM_ER_LC; + + (*hDecoder)->config.defSampleRate = samplerate; +#ifdef ERROR_RESILIENCE // This shoudl always be defined for DRM + (*hDecoder)->aacSectionDataResilienceFlag = 1; /* VCB11 */ + (*hDecoder)->aacScalefactorDataResilienceFlag = 0; /* no RVLC */ + (*hDecoder)->aacSpectralDataResilienceFlag = 1; /* HCR */ +#endif + (*hDecoder)->frameLength = 960; + (*hDecoder)->sf_index = get_sr_index((*hDecoder)->config.defSampleRate); + (*hDecoder)->object_type = (*hDecoder)->config.defObjectType; + + if ((channels == DRMCH_STEREO) || (channels == DRMCH_SBR_STEREO)) + (*hDecoder)->channelConfiguration = 2; + else + (*hDecoder)->channelConfiguration = 1; + +#ifdef SBR_DEC + if ((channels == DRMCH_MONO) || (channels == DRMCH_STEREO)) + (*hDecoder)->sbr_present_flag = 0; + else + (*hDecoder)->sbr_present_flag = 1; +#endif + + (*hDecoder)->fb = filter_bank_init((*hDecoder)->frameLength); + + return 0; +} +#endif + +void NEAACDECAPI NeAACDecClose(NeAACDecHandle hDecoder) +{ + uint8_t i; + + if (hDecoder == NULL) + return; + +#ifdef PROFILE + printf("AAC decoder total: %I64d cycles\n", hDecoder->cycles); + printf("requant: %I64d cycles\n", hDecoder->requant_cycles); + printf("spectral_data: %I64d cycles\n", hDecoder->spectral_cycles); + printf("scalefactors: %I64d cycles\n", hDecoder->scalefac_cycles); + printf("output: %I64d cycles\n", hDecoder->output_cycles); +#endif + + for (i = 0; i < MAX_CHANNELS; i++) + { + if (hDecoder->time_out[i]) faad_free(hDecoder->time_out[i]); + if (hDecoder->fb_intermed[i]) faad_free(hDecoder->fb_intermed[i]); +#ifdef SSR_DEC + if (hDecoder->ssr_overlap[i]) faad_free(hDecoder->ssr_overlap[i]); + if (hDecoder->prev_fmd[i]) faad_free(hDecoder->prev_fmd[i]); +#endif +#ifdef MAIN_DEC + if (hDecoder->pred_stat[i]) faad_free(hDecoder->pred_stat[i]); +#endif +#ifdef LTP_DEC + if (hDecoder->lt_pred_stat[i]) faad_free(hDecoder->lt_pred_stat[i]); +#endif + } + +#ifdef SSR_DEC + if (hDecoder->object_type == SSR) + ssr_filter_bank_end(hDecoder->fb); + else +#endif + filter_bank_end(hDecoder->fb); + + drc_end(hDecoder->drc); + + if (hDecoder->sample_buffer) faad_free(hDecoder->sample_buffer); + +#ifdef SBR_DEC + for (i = 0; i < MAX_SYNTAX_ELEMENTS; i++) + { + if (hDecoder->sbr[i]) + sbrDecodeEnd(hDecoder->sbr[i]); + } +#endif + + if (hDecoder) faad_free(hDecoder); +} + +void NEAACDECAPI NeAACDecPostSeekReset(NeAACDecHandle hDecoder, int32_t frame) +{ + if (hDecoder) + { + hDecoder->postSeekResetFlag = 1; + + if (frame != -1) + hDecoder->frame = frame; + } +} + +static void create_channel_config(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo) +{ + hInfo->num_front_channels = 0; + hInfo->num_side_channels = 0; + hInfo->num_back_channels = 0; + hInfo->num_lfe_channels = 0; + memset(hInfo->channel_position, 0, MAX_CHANNELS*sizeof(uint8_t)); + + if (hDecoder->downMatrix) + { + hInfo->num_front_channels = 2; + hInfo->channel_position[0] = FRONT_CHANNEL_LEFT; + hInfo->channel_position[1] = FRONT_CHANNEL_RIGHT; + return; + } + + /* check if there is a PCE */ + if (hDecoder->pce_set) + { + uint8_t i, chpos = 0; + uint8_t chdir, back_center = 0; + + hInfo->num_front_channels = hDecoder->pce.num_front_channels; + hInfo->num_side_channels = hDecoder->pce.num_side_channels; + hInfo->num_back_channels = hDecoder->pce.num_back_channels; + hInfo->num_lfe_channels = hDecoder->pce.num_lfe_channels; + + chdir = hInfo->num_front_channels; + if (chdir & 1) + { + hInfo->channel_position[chpos++] = FRONT_CHANNEL_CENTER; + chdir--; + } + for (i = 0; i < chdir; i += 2) + { + hInfo->channel_position[chpos++] = FRONT_CHANNEL_LEFT; + hInfo->channel_position[chpos++] = FRONT_CHANNEL_RIGHT; + } + + for (i = 0; i < hInfo->num_side_channels; i += 2) + { + hInfo->channel_position[chpos++] = SIDE_CHANNEL_LEFT; + hInfo->channel_position[chpos++] = SIDE_CHANNEL_RIGHT; + } + + chdir = hInfo->num_back_channels; + if (chdir & 1) + { + back_center = 1; + chdir--; + } + for (i = 0; i < chdir; i += 2) + { + hInfo->channel_position[chpos++] = BACK_CHANNEL_LEFT; + hInfo->channel_position[chpos++] = BACK_CHANNEL_RIGHT; + } + if (back_center) + { + hInfo->channel_position[chpos++] = BACK_CHANNEL_CENTER; + } + + for (i = 0; i < hInfo->num_lfe_channels; i++) + { + hInfo->channel_position[chpos++] = LFE_CHANNEL; + } + + } else { + switch (hDecoder->channelConfiguration) + { + case 1: + hInfo->num_front_channels = 1; + hInfo->channel_position[0] = FRONT_CHANNEL_CENTER; + break; + case 2: + hInfo->num_front_channels = 2; + hInfo->channel_position[0] = FRONT_CHANNEL_LEFT; + hInfo->channel_position[1] = FRONT_CHANNEL_RIGHT; + break; + case 3: + hInfo->num_front_channels = 3; + hInfo->channel_position[0] = FRONT_CHANNEL_CENTER; + hInfo->channel_position[1] = FRONT_CHANNEL_LEFT; + hInfo->channel_position[2] = FRONT_CHANNEL_RIGHT; + break; + case 4: + hInfo->num_front_channels = 3; + hInfo->num_back_channels = 1; + hInfo->channel_position[0] = FRONT_CHANNEL_CENTER; + hInfo->channel_position[1] = FRONT_CHANNEL_LEFT; + hInfo->channel_position[2] = FRONT_CHANNEL_RIGHT; + hInfo->channel_position[3] = BACK_CHANNEL_CENTER; + break; + case 5: + hInfo->num_front_channels = 3; + hInfo->num_back_channels = 2; + hInfo->channel_position[0] = FRONT_CHANNEL_CENTER; + hInfo->channel_position[1] = FRONT_CHANNEL_LEFT; + hInfo->channel_position[2] = FRONT_CHANNEL_RIGHT; + hInfo->channel_position[3] = BACK_CHANNEL_LEFT; + hInfo->channel_position[4] = BACK_CHANNEL_RIGHT; + break; + case 6: + hInfo->num_front_channels = 3; + hInfo->num_back_channels = 2; + hInfo->num_lfe_channels = 1; + hInfo->channel_position[0] = FRONT_CHANNEL_CENTER; + hInfo->channel_position[1] = FRONT_CHANNEL_LEFT; + hInfo->channel_position[2] = FRONT_CHANNEL_RIGHT; + hInfo->channel_position[3] = BACK_CHANNEL_LEFT; + hInfo->channel_position[4] = BACK_CHANNEL_RIGHT; + hInfo->channel_position[5] = LFE_CHANNEL; + break; + case 7: + hInfo->num_front_channels = 3; + hInfo->num_side_channels = 2; + hInfo->num_back_channels = 2; + hInfo->num_lfe_channels = 1; + hInfo->channel_position[0] = FRONT_CHANNEL_CENTER; + hInfo->channel_position[1] = FRONT_CHANNEL_LEFT; + hInfo->channel_position[2] = FRONT_CHANNEL_RIGHT; + hInfo->channel_position[3] = SIDE_CHANNEL_LEFT; + hInfo->channel_position[4] = SIDE_CHANNEL_RIGHT; + hInfo->channel_position[5] = BACK_CHANNEL_LEFT; + hInfo->channel_position[6] = BACK_CHANNEL_RIGHT; + hInfo->channel_position[7] = LFE_CHANNEL; + break; + default: /* channelConfiguration == 0 || channelConfiguration > 7 */ + { + uint8_t i; + uint8_t ch = hDecoder->fr_channels - hDecoder->has_lfe; + if (ch & 1) /* there's either a center front or a center back channel */ + { + uint8_t ch1 = (ch-1)/2; + if (hDecoder->first_syn_ele == ID_SCE) + { + hInfo->num_front_channels = ch1 + 1; + hInfo->num_back_channels = ch1; + hInfo->channel_position[0] = FRONT_CHANNEL_CENTER; + for (i = 1; i <= ch1; i+=2) + { + hInfo->channel_position[i] = FRONT_CHANNEL_LEFT; + hInfo->channel_position[i+1] = FRONT_CHANNEL_RIGHT; + } + for (i = ch1+1; i < ch; i+=2) + { + hInfo->channel_position[i] = BACK_CHANNEL_LEFT; + hInfo->channel_position[i+1] = BACK_CHANNEL_RIGHT; + } + } else { + hInfo->num_front_channels = ch1; + hInfo->num_back_channels = ch1 + 1; + for (i = 0; i < ch1; i+=2) + { + hInfo->channel_position[i] = FRONT_CHANNEL_LEFT; + hInfo->channel_position[i+1] = FRONT_CHANNEL_RIGHT; + } + for (i = ch1; i < ch-1; i+=2) + { + hInfo->channel_position[i] = BACK_CHANNEL_LEFT; + hInfo->channel_position[i+1] = BACK_CHANNEL_RIGHT; + } + hInfo->channel_position[ch-1] = BACK_CHANNEL_CENTER; + } + } else { + uint8_t ch1 = (ch)/2; + hInfo->num_front_channels = ch1; + hInfo->num_back_channels = ch1; + if (ch1 & 1) + { + hInfo->channel_position[0] = FRONT_CHANNEL_CENTER; + for (i = 1; i <= ch1; i+=2) + { + hInfo->channel_position[i] = FRONT_CHANNEL_LEFT; + hInfo->channel_position[i+1] = FRONT_CHANNEL_RIGHT; + } + for (i = ch1+1; i < ch-1; i+=2) + { + hInfo->channel_position[i] = BACK_CHANNEL_LEFT; + hInfo->channel_position[i+1] = BACK_CHANNEL_RIGHT; + } + hInfo->channel_position[ch-1] = BACK_CHANNEL_CENTER; + } else { + for (i = 0; i < ch1; i+=2) + { + hInfo->channel_position[i] = FRONT_CHANNEL_LEFT; + hInfo->channel_position[i+1] = FRONT_CHANNEL_RIGHT; + } + for (i = ch1; i < ch; i+=2) + { + hInfo->channel_position[i] = BACK_CHANNEL_LEFT; + hInfo->channel_position[i+1] = BACK_CHANNEL_RIGHT; + } + } + } + hInfo->num_lfe_channels = hDecoder->has_lfe; + for (i = ch; i < hDecoder->fr_channels; i++) + { + hInfo->channel_position[i] = LFE_CHANNEL; + } + } + break; + } + } +} + +void* NEAACDECAPI NeAACDecDecode(NeAACDecHandle hDecoder, + NeAACDecFrameInfo *hInfo, + uint8_t *buffer, uint32_t buffer_size) +{ + return aac_frame_decode(hDecoder, hInfo, buffer, buffer_size, NULL, 0); +} + +void* NEAACDECAPI NeAACDecDecode2(NeAACDecHandle hDecoder, + NeAACDecFrameInfo *hInfo, + uint8_t *buffer, uint32_t buffer_size, + void **sample_buffer, uint32_t sample_buffer_size) +{ + if ((sample_buffer == NULL) || (sample_buffer_size == 0)) + { + hInfo->error = 27; + return NULL; + } + + return aac_frame_decode(hDecoder, hInfo, buffer, buffer_size, + sample_buffer, sample_buffer_size); +} + +static void* aac_frame_decode(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo, + uint8_t *buffer, uint32_t buffer_size, + void **sample_buffer2, uint32_t sample_buffer_size) +{ + uint8_t channels = 0; + uint8_t output_channels = 0; + bitfile ld; + uint32_t bitsconsumed; + uint16_t frame_len; + void *sample_buffer; + +#ifdef PROFILE + int64_t count = faad_get_ts(); +#endif + + /* safety checks */ + if ((hDecoder == NULL) || (hInfo == NULL) || (buffer == NULL)) + { + return NULL; + } + +#if 0 + printf("%d\n", buffer_size*8); +#endif + + frame_len = hDecoder->frameLength; + + + memset(hInfo, 0, sizeof(NeAACDecFrameInfo)); + memset(hDecoder->internal_channel, 0, MAX_CHANNELS*sizeof(hDecoder->internal_channel[0])); + + /* initialize the bitstream */ + faad_initbits(&ld, buffer, buffer_size); + +#if 0 + { + int i; + for (i = 0; i < ((buffer_size+3)>>2); i++) + { + uint8_t *buf; + uint32_t temp = 0; + buf = faad_getbitbuffer(&ld, 32); + //temp = getdword((void*)buf); + temp = *((uint32_t*)buf); + printf("0x%.8X\n", temp); + free(buf); + } + faad_endbits(&ld); + faad_initbits(&ld, buffer, buffer_size); + } +#endif + +#ifdef DRM + if (hDecoder->object_type == DRM_ER_LC) + { + /* We do not support stereo right now */ + if (0) //(hDecoder->channelConfiguration == 2) + { + hInfo->error = 8; // Throw CRC error + goto error; + } + + faad_getbits(&ld, 8 + DEBUGVAR(1,1,"NeAACDecDecode(): skip CRC")); + } +#endif + + if (hDecoder->adts_header_present) + { + adts_header adts; + + adts.old_format = hDecoder->config.useOldADTSFormat; + if ((hInfo->error = adts_frame(&adts, &ld)) > 0) + goto error; + + /* MPEG2 does byte_alignment() here, + * but ADTS header is always multiple of 8 bits in MPEG2 + * so not needed to actually do it. + */ + } + +#ifdef ANALYSIS + dbg_count = 0; +#endif + + /* decode the complete bitstream */ +#ifdef SCALABLE_DEC + if ((hDecoder->object_type == 6) || (hDecoder->object_type == DRM_ER_LC)) + { + aac_scalable_main_element(hDecoder, hInfo, &ld, &hDecoder->pce, hDecoder->drc); + } else { +#endif + raw_data_block(hDecoder, hInfo, &ld, &hDecoder->pce, hDecoder->drc); +#ifdef SCALABLE_DEC + } +#endif + + channels = hDecoder->fr_channels; + + if (hInfo->error > 0) + goto error; + + /* safety check */ + if (channels == 0 || channels > MAX_CHANNELS) + { + /* invalid number of channels */ + hInfo->error = 12; + goto error; + } + + /* no more bit reading after this */ + bitsconsumed = faad_get_processed_bits(&ld); + hInfo->bytesconsumed = bit2byte(bitsconsumed); + if (ld.error) + { + hInfo->error = 14; + goto error; + } + faad_endbits(&ld); + + + if (!hDecoder->adts_header_present && !hDecoder->adif_header_present) + { + if (hDecoder->channelConfiguration == 0) + hDecoder->channelConfiguration = channels; + + if (channels == 8) /* 7.1 */ + hDecoder->channelConfiguration = 7; + if (channels == 7) /* not a standard channelConfiguration */ + hDecoder->channelConfiguration = 0; + } + + if ((channels == 5 || channels == 6) && hDecoder->config.downMatrix) + { + hDecoder->downMatrix = 1; + output_channels = 2; + } else { + output_channels = channels; + } + +#if (defined(PS_DEC) || defined(DRM_PS)) + hDecoder->upMatrix = 0; + /* check if we have a mono file */ + if (output_channels == 1) + { + /* upMatrix to 2 channels for implicit signalling of PS */ + hDecoder->upMatrix = 1; + output_channels = 2; + } +#endif + + /* Make a channel configuration based on either a PCE or a channelConfiguration */ + create_channel_config(hDecoder, hInfo); + + /* number of samples in this frame */ + hInfo->samples = frame_len*output_channels; + /* number of channels in this frame */ + hInfo->channels = output_channels; + /* samplerate */ + hInfo->samplerate = get_sample_rate(hDecoder->sf_index); + /* object type */ + hInfo->object_type = hDecoder->object_type; + /* sbr */ + hInfo->sbr = NO_SBR; + /* header type */ + hInfo->header_type = RAW; + if (hDecoder->adif_header_present) + hInfo->header_type = ADIF; + if (hDecoder->adts_header_present) + hInfo->header_type = ADTS; +#if (defined(PS_DEC) || defined(DRM_PS)) + hInfo->ps = hDecoder->ps_used_global; +#endif + + /* check if frame has channel elements */ + if (channels == 0) + { + hDecoder->frame++; + return NULL; + } + + /* allocate the buffer for the final samples */ + if ((hDecoder->sample_buffer == NULL) || + (hDecoder->alloced_channels != output_channels)) + { + static const uint8_t str[] = { sizeof(int16_t), sizeof(int32_t), sizeof(int32_t), + sizeof(float32_t), sizeof(double), sizeof(int16_t), sizeof(int16_t), + sizeof(int16_t), sizeof(int16_t), 0, 0, 0 + }; + uint8_t stride = str[hDecoder->config.outputFormat-1]; +#ifdef SBR_DEC + if (((hDecoder->sbr_present_flag == 1)&&(!hDecoder->downSampledSBR)) || (hDecoder->forceUpSampling == 1)) + { + stride = 2 * stride; + } +#endif + /* check if we want to use internal sample_buffer */ + if (sample_buffer_size == 0) + { + if (hDecoder->sample_buffer) + faad_free(hDecoder->sample_buffer); + hDecoder->sample_buffer = NULL; + hDecoder->sample_buffer = faad_malloc(frame_len*output_channels*stride); + } else if (sample_buffer_size < frame_len*output_channels*stride) { + /* provided sample buffer is not big enough */ + hInfo->error = 27; + return NULL; + } + hDecoder->alloced_channels = output_channels; + } + + if (sample_buffer_size == 0) + { + sample_buffer = hDecoder->sample_buffer; + } else { + sample_buffer = *sample_buffer2; + } + +#ifdef SBR_DEC + if ((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1)) + { + uint8_t ele; + + /* this data is different when SBR is used or when the data is upsampled */ + if (!hDecoder->downSampledSBR) + { + frame_len *= 2; + hInfo->samples *= 2; + hInfo->samplerate *= 2; + } + + /* check if every element was provided with SBR data */ + for (ele = 0; ele < hDecoder->fr_ch_ele; ele++) + { + if (hDecoder->sbr[ele] == NULL) + { + hInfo->error = 25; + goto error; + } + } + + /* sbr */ + if (hDecoder->sbr_present_flag == 1) + { + hInfo->object_type = HE_AAC; + hInfo->sbr = SBR_UPSAMPLED; + } else { + hInfo->sbr = NO_SBR_UPSAMPLED; + } + if (hDecoder->downSampledSBR) + { + hInfo->sbr = SBR_DOWNSAMPLED; + } + } +#endif + + sample_buffer = output_to_PCM(hDecoder, hDecoder->time_out, sample_buffer, + output_channels, frame_len, hDecoder->config.outputFormat); + + + hDecoder->postSeekResetFlag = 0; + + hDecoder->frame++; +#ifdef LD_DEC + if (hDecoder->object_type != LD) + { +#endif + if (hDecoder->frame <= 1) + hInfo->samples = 0; +#ifdef LD_DEC + } else { + /* LD encoders will give lower delay */ + if (hDecoder->frame <= 0) + hInfo->samples = 0; + } +#endif + + /* cleanup */ +#ifdef ANALYSIS + fflush(stdout); +#endif + +#ifdef PROFILE + count = faad_get_ts() - count; + hDecoder->cycles += count; +#endif + + return sample_buffer; + +error: + + faad_endbits(&ld); + + /* cleanup */ +#ifdef ANALYSIS + fflush(stdout); +#endif + + return NULL; +} diff --git a/Libraries/FAAD2/Files/libfaad/decoder.h b/Libraries/FAAD2/Files/libfaad/decoder.h new file mode 100644 index 000000000..2b2eb8bc0 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/decoder.h @@ -0,0 +1,121 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#ifndef __DECODER_H__ +#define __DECODER_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef _WIN32 + #pragma pack(push, 8) + #ifndef NEAACDECAPI + #define NEAACDECAPI __cdecl + #endif +#else + #ifndef NEAACDECAPI + #define NEAACDECAPI + #endif +#endif + + +/* library output formats */ +#define FAAD_FMT_16BIT 1 +#define FAAD_FMT_24BIT 2 +#define FAAD_FMT_32BIT 3 +#define FAAD_FMT_FLOAT 4 +#define FAAD_FMT_FIXED FAAD_FMT_FLOAT +#define FAAD_FMT_DOUBLE 5 + +#define LC_DEC_CAP (1<<0) +#define MAIN_DEC_CAP (1<<1) +#define LTP_DEC_CAP (1<<2) +#define LD_DEC_CAP (1<<3) +#define ERROR_RESILIENCE_CAP (1<<4) +#define FIXED_POINT_CAP (1<<5) + +#define FRONT_CHANNEL_CENTER (1) +#define FRONT_CHANNEL_LEFT (2) +#define FRONT_CHANNEL_RIGHT (3) +#define SIDE_CHANNEL_LEFT (4) +#define SIDE_CHANNEL_RIGHT (5) +#define BACK_CHANNEL_LEFT (6) +#define BACK_CHANNEL_RIGHT (7) +#define BACK_CHANNEL_CENTER (8) +#define LFE_CHANNEL (9) +#define UNKNOWN_CHANNEL (0) + +char* NEAACDECAPI NeAACDecGetErrorMessage(uint8_t errcode); + +uint32_t NEAACDECAPI NeAACDecGetCapabilities(void); + +NeAACDecHandle NEAACDECAPI NeAACDecOpen(void); + +NeAACDecConfigurationPtr NEAACDECAPI NeAACDecGetCurrentConfiguration(NeAACDecHandle hDecoder); + +uint8_t NEAACDECAPI NeAACDecSetConfiguration(NeAACDecHandle hDecoder, + NeAACDecConfigurationPtr config); + +/* Init the library based on info from the AAC file (ADTS/ADIF) */ +int32_t NEAACDECAPI NeAACDecInit(NeAACDecHandle hDecoder, + uint8_t *buffer, + uint32_t buffer_size, + uint32_t *samplerate, + uint8_t *channels); + +/* Init the library using a DecoderSpecificInfo */ +int8_t NEAACDECAPI NeAACDecInit2(NeAACDecHandle hDecoder, uint8_t *pBuffer, + uint32_t SizeOfDecoderSpecificInfo, + uint32_t *samplerate, uint8_t *channels); + +/* Init the library for DRM */ +int8_t NEAACDECAPI NeAACDecInitDRM(NeAACDecHandle *hDecoder, uint32_t samplerate, + uint8_t channels); + +void NEAACDECAPI NeAACDecClose(NeAACDecHandle hDecoder); + +void NEAACDECAPI NeAACDecPostSeekReset(NeAACDecHandle hDecoder, int32_t frame); + +void* NEAACDECAPI NeAACDecDecode(NeAACDecHandle hDecoder, + NeAACDecFrameInfo *hInfo, + uint8_t *buffer, + uint32_t buffer_size); + +void* NEAACDECAPI NeAACDecDecode2(NeAACDecHandle hDecoder, + NeAACDecFrameInfo *hInfo, + uint8_t *buffer, uint32_t buffer_size, + void **sample_buffer, uint32_t sample_buffer_size); + +#ifdef _WIN32 + #pragma pack(pop) +#endif + +#ifdef __cplusplus +} +#endif +#endif diff --git a/Libraries/FAAD2/Files/libfaad/drc.c b/Libraries/FAAD2/Files/libfaad/drc.c new file mode 100644 index 000000000..7530d2d05 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/drc.c @@ -0,0 +1,170 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#include "common.h" +#include "structs.h" + +#include +#include +#include "syntax.h" +#include "drc.h" + +drc_info *drc_init(real_t cut, real_t boost) +{ + drc_info *drc = (drc_info*)faad_malloc(sizeof(drc_info)); + memset(drc, 0, sizeof(drc_info)); + + drc->ctrl1 = cut; + drc->ctrl2 = boost; + + drc->num_bands = 1; + drc->band_top[0] = 1024/4 - 1; + drc->dyn_rng_sgn[0] = 1; + drc->dyn_rng_ctl[0] = 0; + + return drc; +} + +void drc_end(drc_info *drc) +{ + if (drc) faad_free(drc); +} + +#ifdef FIXED_POINT +static real_t drc_pow2_table[] = +{ + COEF_CONST(0.5146511183), + COEF_CONST(0.5297315472), + COEF_CONST(0.5452538663), + COEF_CONST(0.5612310242), + COEF_CONST(0.5776763484), + COEF_CONST(0.5946035575), + COEF_CONST(0.6120267717), + COEF_CONST(0.6299605249), + COEF_CONST(0.6484197773), + COEF_CONST(0.6674199271), + COEF_CONST(0.6869768237), + COEF_CONST(0.7071067812), + COEF_CONST(0.7278265914), + COEF_CONST(0.7491535384), + COEF_CONST(0.7711054127), + COEF_CONST(0.7937005260), + COEF_CONST(0.8169577266), + COEF_CONST(0.8408964153), + COEF_CONST(0.8655365610), + COEF_CONST(0.8908987181), + COEF_CONST(0.9170040432), + COEF_CONST(0.9438743127), + COEF_CONST(0.9715319412), + COEF_CONST(1.0000000000), + COEF_CONST(1.0293022366), + COEF_CONST(1.0594630944), + COEF_CONST(1.0905077327), + COEF_CONST(1.1224620483), + COEF_CONST(1.1553526969), + COEF_CONST(1.1892071150), + COEF_CONST(1.2240535433), + COEF_CONST(1.2599210499), + COEF_CONST(1.2968395547), + COEF_CONST(1.3348398542), + COEF_CONST(1.3739536475), + COEF_CONST(1.4142135624), + COEF_CONST(1.4556531828), + COEF_CONST(1.4983070769), + COEF_CONST(1.5422108254), + COEF_CONST(1.5874010520), + COEF_CONST(1.6339154532), + COEF_CONST(1.6817928305), + COEF_CONST(1.7310731220), + COEF_CONST(1.7817974363), + COEF_CONST(1.8340080864), + COEF_CONST(1.8877486254), + COEF_CONST(1.9430638823) +}; +#endif + +void drc_decode(drc_info *drc, real_t *spec) +{ + uint16_t i, bd, top; +#ifdef FIXED_POINT + int32_t exp, frac; +#else + real_t factor, exp; +#endif + uint16_t bottom = 0; + + if (drc->num_bands == 1) + drc->band_top[0] = 1024/4 - 1; + + for (bd = 0; bd < drc->num_bands; bd++) + { + top = 4 * (drc->band_top[bd] + 1); + +#ifndef FIXED_POINT + /* Decode DRC gain factor */ + if (drc->dyn_rng_sgn[bd]) /* compress */ + exp = -drc->ctrl1 * (drc->dyn_rng_ctl[bd] - (DRC_REF_LEVEL - drc->prog_ref_level))/REAL_CONST(24.0); + else /* boost */ + exp = drc->ctrl2 * (drc->dyn_rng_ctl[bd] - (DRC_REF_LEVEL - drc->prog_ref_level))/REAL_CONST(24.0); + factor = (real_t)pow(2.0, exp); + + /* Apply gain factor */ + for (i = bottom; i < top; i++) + spec[i] *= factor; +#else + /* Decode DRC gain factor */ + if (drc->dyn_rng_sgn[bd]) /* compress */ + { + exp = -1 * (drc->dyn_rng_ctl[bd] - (DRC_REF_LEVEL - drc->prog_ref_level))/ 24; + frac = -1 * (drc->dyn_rng_ctl[bd] - (DRC_REF_LEVEL - drc->prog_ref_level)) % 24; + } else { /* boost */ + exp = (drc->dyn_rng_ctl[bd] - (DRC_REF_LEVEL - drc->prog_ref_level))/ 24; + frac = (drc->dyn_rng_ctl[bd] - (DRC_REF_LEVEL - drc->prog_ref_level)) % 24; + } + + /* Apply gain factor */ + if (exp < 0) + { + for (i = bottom; i < top; i++) + { + spec[i] >>= -exp; + if (frac) + spec[i] = MUL_R(spec[i],drc_pow2_table[frac+23]); + } + } else { + for (i = bottom; i < top; i++) + { + spec[i] <<= exp; + if (frac) + spec[i] = MUL_R(spec[i],drc_pow2_table[frac+23]); + } + } +#endif + + bottom = top; + } +} diff --git a/Libraries/FAAD2/Files/libfaad/drc.h b/Libraries/FAAD2/Files/libfaad/drc.h new file mode 100644 index 000000000..31d3db67a --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/drc.h @@ -0,0 +1,46 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#ifndef __DRC_H__ +#define __DRC_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#define DRC_REF_LEVEL 20*4 /* -20 dB */ + + +drc_info *drc_init(real_t cut, real_t boost); +void drc_end(drc_info *drc); +void drc_decode(drc_info *drc, real_t *spec); + + +#ifdef __cplusplus +} +#endif +#endif diff --git a/Libraries/FAAD2/Files/libfaad/drm_dec.c b/Libraries/FAAD2/Files/libfaad/drm_dec.c new file mode 100644 index 000000000..8bf905169 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/drm_dec.c @@ -0,0 +1,990 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR and PS decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#include +#include +#include +#include +#include "common.h" + +#ifdef DRM + +#include "sbr_dec.h" +#include "drm_dec.h" +#include "bits.h" + +/* constants */ +#define DECAY_CUTOFF 3 +#define DECAY_SLOPE 0.05f + +/* type definitaions */ +typedef const int8_t (*drm_ps_huff_tab)[2]; + + +/* binary search huffman tables */ +static const int8_t f_huffman_sa[][2] = +{ + { /*0*/ -15, 1 }, /* index 0: 1 bits: x */ + { 2, 3 }, /* index 1: 2 bits: 1x */ + { /*7*/ -8, 4 }, /* index 2: 3 bits: 10x */ + { 5, 6 }, /* index 3: 3 bits: 11x */ + { /*1*/ -14, /*-1*/ -16 }, /* index 4: 4 bits: 101x */ + { /*-2*/ -17, 7 }, /* index 5: 4 bits: 110x */ + { 8, 9 }, /* index 6: 4 bits: 111x */ + { /*2*/ -13, /*-3*/ -18 }, /* index 7: 5 bits: 1101x */ + { /*3*/ -12, 10 }, /* index 8: 5 bits: 1110x */ + { 11, 12 }, /* index 9: 5 bits: 1111x */ + { /*4*/ -11, /*5*/ -10 }, /* index 10: 6 bits: 11101x */ + { /*-4*/ -19, /*-5*/ -20 }, /* index 11: 6 bits: 11110x */ + { /*6*/ -9, 13 }, /* index 12: 6 bits: 11111x */ + { /*-7*/ -22, /*-6*/ -21 } /* index 13: 7 bits: 111111x */ +}; + +static const int8_t t_huffman_sa[][2] = +{ + { /*0*/ -15, 1 }, /* index 0: 1 bits: x */ + { 2, 3 }, /* index 1: 2 bits: 1x */ + { /*-1*/ -16, /*1*/ -14 }, /* index 2: 3 bits: 10x */ + { 4, 5 }, /* index 3: 3 bits: 11x */ + { /*-2*/ -17, /*2*/ -13 }, /* index 4: 4 bits: 110x */ + { 6, 7 }, /* index 5: 4 bits: 111x */ + { /*-3*/ -18, /*3*/ -12 }, /* index 6: 5 bits: 1110x */ + { 8, 9 }, /* index 7: 5 bits: 1111x */ + { /*-4*/ -19, /*4*/ -11 }, /* index 8: 6 bits: 11110x */ + { 10, 11 }, /* index 9: 6 bits: 11111x */ + { /*-5*/ -20, /*5*/ -10 }, /* index 10: 7 bits: 111110x */ + { /*-6*/ -21, 12 }, /* index 11: 7 bits: 111111x */ + { /*-7*/ -22, 13 }, /* index 12: 8 bits: 1111111x */ + { /*6*/ -9, /*7*/ -8 } /* index 13: 9 bits: 11111111x */ +}; + +static const int8_t f_huffman_pan[][2] = +{ + { /*0*/ -15, 1 }, /* index 0: 1 bits: x */ + { /*-1*/ -16, 2 }, /* index 1: 2 bits: 1x */ + { /*1*/ -14, 3 }, /* index 2: 3 bits: 11x */ + { 4, 5 }, /* index 3: 4 bits: 111x */ + { /*-2*/ -17, /*2*/ -13 }, /* index 4: 5 bits: 1110x */ + { 6, 7 }, /* index 5: 5 bits: 1111x */ + { /*-3*/ -18, /*3*/ -12 }, /* index 6: 6 bits: 11110x */ + { 8, 9 }, /* index 7: 6 bits: 11111x */ + { /*-4*/ -19, /*4*/ -11 }, /* index 8: 7 bits: 111110x */ + { 10, 11 }, /* index 9: 7 bits: 111111x */ + { /*-5*/ -20, /*5*/ -10 }, /* index 10: 8 bits: 1111110x */ + { 12, 13 }, /* index 11: 8 bits: 1111111x */ + { /*-6*/ -21, /*6*/ -9 }, /* index 12: 9 bits: 11111110x */ + { /*-7*/ -22, 14 }, /* index 13: 9 bits: 11111111x */ + { /*7*/ -8, 15 }, /* index 14: 10 bits: 111111111x */ + { 16, 17 }, /* index 15: 11 bits: 1111111111x */ + { /*-8*/ -23, /*8*/ -7 }, /* index 16: 12 bits: 11111111110x */ + { 18, 19 }, /* index 17: 12 bits: 11111111111x */ + { /*-10*/ -25, 20 }, /* index 18: 13 bits: 111111111110x */ + { 21, 22 }, /* index 19: 13 bits: 111111111111x */ + { /*-9*/ -24, /*9*/ -6 }, /* index 20: 14 bits: 1111111111101x */ + { /*10*/ -5, 23 }, /* index 21: 14 bits: 1111111111110x */ + { 24, 25 }, /* index 22: 14 bits: 1111111111111x */ + { /*-13*/ -28, /*-11*/ -26 }, /* index 23: 15 bits: 11111111111101x */ + { /*11*/ -4, /*13*/ -2 }, /* index 24: 15 bits: 11111111111110x */ + { 26, 27 }, /* index 25: 15 bits: 11111111111111x */ + { /*-14*/ -29, /*-12*/ -27 }, /* index 26: 16 bits: 111111111111110x */ + { /*12*/ -3, /*14*/ -1 } /* index 27: 16 bits: 111111111111111x */ +}; + +static const int8_t t_huffman_pan[][2] = +{ + { /*0*/ -15, 1 }, /* index 0: 1 bits: x */ + { /*-1*/ -16, 2 }, /* index 1: 2 bits: 1x */ + { /*1*/ -14, 3 }, /* index 2: 3 bits: 11x */ + { /*-2*/ -17, 4 }, /* index 3: 4 bits: 111x */ + { /*2*/ -13, 5 }, /* index 4: 5 bits: 1111x */ + { /*-3*/ -18, 6 }, /* index 5: 6 bits: 11111x */ + { /*3*/ -12, 7 }, /* index 6: 7 bits: 111111x */ + { /*-4*/ -19, 8 }, /* index 7: 8 bits: 1111111x */ + { /*4*/ -11, 9 }, /* index 8: 9 bits: 11111111x */ + { 10, 11 }, /* index 9: 10 bits: 111111111x */ + { /*-5*/ -20, /*5*/ -10 }, /* index 10: 11 bits: 1111111110x */ + { 12, 13 }, /* index 11: 11 bits: 1111111111x */ + { /*-6*/ -21, /*6*/ -9 }, /* index 12: 12 bits: 11111111110x */ + { 14, 15 }, /* index 13: 12 bits: 11111111111x */ + { /*-7*/ -22, /*7*/ -8 }, /* index 14: 13 bits: 111111111110x */ + { 16, 17 }, /* index 15: 13 bits: 111111111111x */ + { /*-8*/ -23, /*8*/ -7 }, /* index 16: 14 bits: 1111111111110x */ + { 18, 19 }, /* index 17: 14 bits: 1111111111111x */ + { /*-10*/ -25, /*10*/ -5 }, /* index 18: 15 bits: 11111111111110x */ + { 20, 21 }, /* index 19: 15 bits: 11111111111111x */ + { /*-9*/ -24, /*9*/ -6 }, /* index 20: 16 bits: 111111111111110x */ + { 22, 23 }, /* index 21: 16 bits: 111111111111111x */ + { 24, 25 }, /* index 22: 17 bits: 1111111111111110x */ + { 26, 27 }, /* index 23: 17 bits: 1111111111111111x */ + { /*-14*/ -29, /*-13*/ -28 }, /* index 24: 18 bits: 11111111111111100x */ + { /*-12*/ -27, /*-11*/ -26 }, /* index 25: 18 bits: 11111111111111101x */ + { /*11*/ -4, /*12*/ -3 }, /* index 26: 18 bits: 11111111111111110x */ + { /*13*/ -2, /*14*/ -1 } /* index 27: 18 bits: 11111111111111111x */ +}; + +/* There are 3 classes in the standard but the last 2 are identical */ +static const real_t sa_quant[8][2] = +{ + { FRAC_CONST(0.0000), FRAC_CONST(0.0000) }, + { FRAC_CONST(0.0501), FRAC_CONST(0.1778) }, + { FRAC_CONST(0.0706), FRAC_CONST(0.2818) }, + { FRAC_CONST(0.0995), FRAC_CONST(0.4467) }, + { FRAC_CONST(0.1399), FRAC_CONST(0.5623) }, + { FRAC_CONST(0.1957), FRAC_CONST(0.7079) }, + { FRAC_CONST(0.2713), FRAC_CONST(0.8913) }, + { FRAC_CONST(0.3699), FRAC_CONST(1.0000) }, +}; + +/* We don't need the actual quantizer values */ +#if 0 +static const real_t pan_quant[8][5] = +{ + { COEF_CONST(0.0000), COEF_CONST(0.0000), COEF_CONST(0.0000), COEF_CONST(0.0000), COEF_CONST(0.0000) }, + { COEF_CONST(0.1661), COEF_CONST(0.1661), COEF_CONST(0.3322), COEF_CONST(0.3322), COEF_CONST(0.3322) }, + { COEF_CONST(0.3322), COEF_CONST(0.3322), COEF_CONST(0.6644), COEF_CONST(0.8305), COEF_CONST(0.8305) }, + { COEF_CONST(0.4983), COEF_CONST(0.6644), COEF_CONST(0.9966), COEF_CONST(1.4949), COEF_CONST(1.6610) }, + { COEF_CONST(0.6644), COEF_CONST(0.9966), COEF_CONST(1.4949), COEF_CONST(2.1593), COEF_CONST(2.4914) }, + { COEF_CONST(0.8305), COEF_CONST(1.3288), COEF_CONST(2.1593), COEF_CONST(2.9897), COEF_CONST(3.4880) }, + { COEF_CONST(0.9966), COEF_CONST(1.8271), COEF_CONST(2.8236), COEF_CONST(3.8202), COEF_CONST(4.6507) }, + { COEF_CONST(1.3288), COEF_CONST(2.3253), COEF_CONST(3.4880), COEF_CONST(4.6507), COEF_CONST(5.8134) }, +}; +#endif + +/* 2^(pan_quant[x][y] */ +static const real_t pan_pow_2_pos[8][5] = { + { REAL_CONST(1.0000000), REAL_CONST(1.0000000), REAL_CONST(1.0000000), REAL_CONST(1.0000000), REAL_CONST(1.0000000) }, + { REAL_CONST(1.1220021), REAL_CONST(1.1220021), REAL_CONST(1.2589312), REAL_CONST(1.2589312), REAL_CONST(1.2589312) }, + { REAL_CONST(1.2589312), REAL_CONST(1.2589312), REAL_CONST(1.5849090), REAL_CONST(1.7783016), REAL_CONST(1.7783016) }, + { REAL_CONST(1.4125481), REAL_CONST(1.5849090), REAL_CONST(1.9952921), REAL_CONST(2.8184461), REAL_CONST(3.1623565) }, + { REAL_CONST(1.5849090), REAL_CONST(1.9952922), REAL_CONST(2.8184461), REAL_CONST(4.4669806), REAL_CONST(5.6232337) }, + { REAL_CONST(1.7783016), REAL_CONST(2.5119365), REAL_CONST(4.4669806), REAL_CONST(7.9430881), REAL_CONST(11.219994) }, + { REAL_CONST(1.9952921), REAL_CONST(3.5482312), REAL_CONST(7.0792671), REAL_CONST(14.125206), REAL_CONST(25.118876) }, + { REAL_CONST(2.5119365), REAL_CONST(5.0116998), REAL_CONST(11.219994), REAL_CONST(25.118876), REAL_CONST(56.235140) } +}; + +/* 2^(-pan_quant[x][y] */ +static const real_t pan_pow_2_neg[8][5] = { + { REAL_CONST(1), REAL_CONST(1), REAL_CONST(1), REAL_CONST(1), REAL_CONST(1) }, + { REAL_CONST(0.8912487), REAL_CONST(0.8912487), REAL_CONST(0.7943242), REAL_CONST(0.7943242), REAL_CONST(0.7943242) }, + { REAL_CONST(0.7943242), REAL_CONST(0.7943242), REAL_CONST(0.6309511), REAL_CONST(0.5623344), REAL_CONST(0.5623344) }, + { REAL_CONST(0.7079405), REAL_CONST(0.6309511), REAL_CONST(0.5011797), REAL_CONST(0.3548054), REAL_CONST(0.3162199) }, + { REAL_CONST(0.6309511), REAL_CONST(0.5011797), REAL_CONST(0.3548054), REAL_CONST(0.2238649), REAL_CONST(0.1778336) }, + { REAL_CONST(0.5623343), REAL_CONST(0.3980992), REAL_CONST(0.2238649), REAL_CONST(0.1258956), REAL_CONST(0.0891266) }, + { REAL_CONST(0.5011797), REAL_CONST(0.2818306), REAL_CONST(0.1412576), REAL_CONST(0.0707954), REAL_CONST(0.0398107) }, + { REAL_CONST(0.3980992), REAL_CONST(0.1995331), REAL_CONST(0.0891267), REAL_CONST(0.0398107), REAL_CONST(0.0177825) } +}; + +/* 2^(pan_quant[x][y]/30) */ +static const real_t pan_pow_2_30_pos[8][5] = { + { COEF_CONST(1), COEF_CONST(1), COEF_CONST(1), COEF_CONST(1), COEF_CONST(1) }, + { COEF_CONST(1.003845098), COEF_CONST(1.003845098), COEF_CONST(1.007704982), COEF_CONST(1.007704982), COEF_CONST(1.007704982) }, + { COEF_CONST(1.007704982), COEF_CONST(1.007704982), COEF_CONST(1.01546933), COEF_CONST(1.019373909), COEF_CONST(1.019373909) }, + { COEF_CONST(1.011579706), COEF_CONST(1.01546933), COEF_CONST(1.023293502), COEF_CONST(1.035142941), COEF_CONST(1.039123167) }, + { COEF_CONST(1.01546933), COEF_CONST(1.023293502), COEF_CONST(1.035142941), COEF_CONST(1.051155908), COEF_CONST(1.059252598) }, + { COEF_CONST(1.019373909), COEF_CONST(1.03117796), COEF_CONST(1.051155908), COEF_CONST(1.071518432), COEF_CONST(1.0839263) }, + { COEF_CONST(1.023293502), COEF_CONST(1.043118698), COEF_CONST(1.067414119), COEF_CONST(1.092277933), COEF_CONST(1.113439626) }, + { COEF_CONST(1.03117796), COEF_CONST(1.055195268), COEF_CONST(1.0839263), COEF_CONST(1.113439626), COEF_CONST(1.143756546) } +}; + +/* 2^(-pan_quant[x][y]/30) */ +static const real_t pan_pow_2_30_neg[8][5] = { + { COEF_CONST(1), COEF_CONST(1), COEF_CONST(1), COEF_CONST(1), COEF_CONST(1) }, + { COEF_CONST(0.99616963), COEF_CONST(0.99616963), COEF_CONST(0.992353931), COEF_CONST(0.992353931), COEF_CONST(0.99235393) }, + { COEF_CONST(0.992353931), COEF_CONST(0.992353931), COEF_CONST(0.984766325), COEF_CONST(0.980994305), COEF_CONST(0.980994305) }, + { COEF_CONST(0.988552848), COEF_CONST(0.984766325), COEF_CONST(0.977236734), COEF_CONST(0.966050157), COEF_CONST(0.962349827) }, + { COEF_CONST(0.984766325), COEF_CONST(0.977236734), COEF_CONST(0.966050157), COEF_CONST(0.951333663), COEF_CONST(0.944061881) }, + { COEF_CONST(0.980994305), COEF_CONST(0.969764715), COEF_CONST(0.951333663), COEF_CONST(0.933255062), COEF_CONST(0.922571949) }, + { COEF_CONST(0.977236734), COEF_CONST(0.958663671), COEF_CONST(0.936843519), COEF_CONST(0.915517901), COEF_CONST(0.898117847) }, + { COEF_CONST(0.969764715), COEF_CONST(0.947691892), COEF_CONST(0.922571949), COEF_CONST(0.898117847), COEF_CONST(0.874311936) } +}; + +static const real_t g_decayslope[MAX_SA_BAND] = { + FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.95),FRAC_CONST(0.9), FRAC_CONST(0.85), FRAC_CONST(0.8), + FRAC_CONST(0.75),FRAC_CONST(0.7), FRAC_CONST(0.65),FRAC_CONST(0.6), FRAC_CONST(0.55),FRAC_CONST(0.5), FRAC_CONST(0.45), + FRAC_CONST(0.4), FRAC_CONST(0.35),FRAC_CONST(0.3), FRAC_CONST(0.25),FRAC_CONST(0.2), FRAC_CONST(0.15), FRAC_CONST(0.1), + FRAC_CONST(0.05),FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), + FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), + FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), + FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0) +}; + +static const real_t sa_sqrt_1_minus[8][2] = { + { FRAC_CONST(1), FRAC_CONST(1) }, + { FRAC_CONST(0.998744206), FRAC_CONST(0.984066644) }, + { FRAC_CONST(0.997504707), FRAC_CONST(0.959473168) }, + { FRAC_CONST(0.995037562), FRAC_CONST(0.894683804) }, + { FRAC_CONST(0.990165638), FRAC_CONST(0.826933317) }, + { FRAC_CONST(0.980663811), FRAC_CONST(0.706312672) }, + { FRAC_CONST(0.962494836), FRAC_CONST(0.45341406) }, + { FRAC_CONST(0.929071574), FRAC_CONST(0) } +}; + +static const uint8_t sa_freq_scale[9][2] = +{ + { 0, 0}, + { 1, 1}, + { 2, 2}, + { 3, 3}, + { 5, 5}, + { 7, 7}, + {10,10}, + {13,13}, + {46,23} +}; + +static const uint8_t pan_freq_scale[21] = +{ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 18, 22, 26, 32, 64 +}; + +static const uint8_t pan_quant_class[20] = +{ + 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 2, 2, 3, 3, 3, 4, 4, 4 +}; + +/* Inverse mapping lookup */ +static const uint8_t pan_inv_freq[64] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 15, 15, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19 +}; + +static const uint8_t sa_inv_freq[MAX_SA_BAND] = { + 0, 1, 2, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7 +}; + +static const real_t filter_coeff[] = +{ + FRAC_CONST(0.65143905754106), + FRAC_CONST(0.56471812200776), + FRAC_CONST(0.48954165955695) +}; + +static const uint8_t delay_length[][2] = +{ + { 1, 3 }, { 2, 4 }, { 3, 5 } +}; + +static const real_t delay_fraction[] = +{ + FRAC_CONST(0.43), FRAC_CONST(0.75), FRAC_CONST(0.347) +}; + +static const real_t peak_decay[2] = +{ + FRAC_CONST(0.58664621951003), FRAC_CONST(0.76592833836465) +}; + +static const real_t smooth_coeff[2] = +{ + FRAC_CONST(0.6), FRAC_CONST(0.25) +}; + +/* Please note that these are the same tables as in plain PS */ +static const complex_t Q_Fract_allpass_Qmf[][3] = { + { { FRAC_CONST(0.7804303765), FRAC_CONST(0.6252426505) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.8550928831), FRAC_CONST(0.5184748173) } }, + { { FRAC_CONST(-0.4399392009), FRAC_CONST(0.8980275393) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.0643581524), FRAC_CONST(0.9979268909) } }, + { { FRAC_CONST(-0.9723699093), FRAC_CONST(-0.2334454209) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.9146071672), FRAC_CONST(0.4043435752) } }, + { { FRAC_CONST(0.0157073960), FRAC_CONST(-0.9998766184) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.7814115286), FRAC_CONST(-0.6240159869) } }, + { { FRAC_CONST(0.9792228341), FRAC_CONST(-0.2027871907) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.1920081824), FRAC_CONST(-0.9813933372) } }, + { { FRAC_CONST(0.4115142524), FRAC_CONST(0.9114032984) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.9589683414), FRAC_CONST(-0.2835132182) } }, + { { FRAC_CONST(-0.7996847630), FRAC_CONST(0.6004201174) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.6947838664), FRAC_CONST(0.7192186117) } }, + { { FRAC_CONST(-0.7604058385), FRAC_CONST(-0.6494481564) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.3164770305), FRAC_CONST(0.9486001730) } }, + { { FRAC_CONST(0.4679299891), FRAC_CONST(-0.8837655187) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.9874414206), FRAC_CONST(0.1579856575) } }, + { { FRAC_CONST(0.9645573497), FRAC_CONST(0.2638732493) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.5966450572), FRAC_CONST(-0.8025052547) } }, + { { FRAC_CONST(-0.0471066870), FRAC_CONST(0.9988898635) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.4357025325), FRAC_CONST(-0.9000906944) } }, + { { FRAC_CONST(-0.9851093888), FRAC_CONST(0.1719288528) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.9995546937), FRAC_CONST(-0.0298405960) } }, + { { FRAC_CONST(-0.3826831877), FRAC_CONST(-0.9238796234) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.4886211455), FRAC_CONST(0.8724960685) } }, + { { FRAC_CONST(0.8181498647), FRAC_CONST(-0.5750049949) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.5477093458), FRAC_CONST(0.8366686702) } }, + { { FRAC_CONST(0.7396308780), FRAC_CONST(0.6730127335) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.9951074123), FRAC_CONST(-0.0987988561) } }, + { { FRAC_CONST(-0.4954589605), FRAC_CONST(0.8686313629) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.3725017905), FRAC_CONST(-0.9280315042) } }, + { { FRAC_CONST(-0.9557929039), FRAC_CONST(-0.2940406799) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.6506417990), FRAC_CONST(-0.7593847513) } }, + { { FRAC_CONST(0.0784594864), FRAC_CONST(-0.9969173074) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.9741733670), FRAC_CONST(0.2258014232) } }, + { { FRAC_CONST(0.9900237322), FRAC_CONST(-0.1409008205) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.2502108514), FRAC_CONST(0.9681913853) } }, + { { FRAC_CONST(0.3534744382), FRAC_CONST(0.9354441762) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.7427945137), FRAC_CONST(0.6695194840) } }, + { { FRAC_CONST(-0.8358076215), FRAC_CONST(0.5490224361) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.9370992780), FRAC_CONST(-0.3490629196) } }, + { { FRAC_CONST(-0.7181259394), FRAC_CONST(-0.6959131360) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.1237744763), FRAC_CONST(-0.9923103452) } }, + { { FRAC_CONST(0.5224990249), FRAC_CONST(-0.8526399136) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.8226406574), FRAC_CONST(-0.5685616732) } }, + { { FRAC_CONST(0.9460852146), FRAC_CONST(0.3239179254) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.8844994903), FRAC_CONST(0.4665412009) } }, + { { FRAC_CONST(-0.1097348556), FRAC_CONST(0.9939609170) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.0047125919), FRAC_CONST(0.9999889135) } }, + { { FRAC_CONST(-0.9939610362), FRAC_CONST(0.1097337380) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.8888573647), FRAC_CONST(0.4581840038) } }, + { { FRAC_CONST(-0.3239168525), FRAC_CONST(-0.9460855722) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.8172453642), FRAC_CONST(-0.5762898922) } }, + { { FRAC_CONST(0.8526405096), FRAC_CONST(-0.5224980116) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.1331215799), FRAC_CONST(-0.9910997152) } }, + { { FRAC_CONST(0.6959123611), FRAC_CONST(0.7181267142) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.9403476119), FRAC_CONST(-0.3402152061) } }, + { { FRAC_CONST(-0.5490233898), FRAC_CONST(0.8358070254) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.7364512086), FRAC_CONST(0.6764906645) } }, + { { FRAC_CONST(-0.9354437590), FRAC_CONST(-0.3534754813) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.2593250275), FRAC_CONST(0.9657900929) } }, + { { FRAC_CONST(0.1409019381), FRAC_CONST(-0.9900235534) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.9762582779), FRAC_CONST(0.2166097313) } }, + { { FRAC_CONST(0.9969173670), FRAC_CONST(-0.0784583688) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.6434556246), FRAC_CONST(-0.7654833794) } }, + { { FRAC_CONST(0.2940396070), FRAC_CONST(0.9557932615) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.3812320232), FRAC_CONST(-0.9244794250) } }, + { { FRAC_CONST(-0.8686318994), FRAC_CONST(0.4954580069) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.9959943891), FRAC_CONST(-0.0894154981) } }, + { { FRAC_CONST(-0.6730118990), FRAC_CONST(-0.7396316528) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.5397993922), FRAC_CONST(0.8417937160) } }, + { { FRAC_CONST(0.5750059485), FRAC_CONST(-0.8181492686) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.4968227744), FRAC_CONST(0.8678520322) } }, + { { FRAC_CONST(0.9238792062), FRAC_CONST(0.3826842010) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.9992290139), FRAC_CONST(-0.0392601527) } }, + { { FRAC_CONST(-0.1719299555), FRAC_CONST(0.9851091504) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.4271997511), FRAC_CONST(-0.9041572809) } }, + { { FRAC_CONST(-0.9988899231), FRAC_CONST(0.0471055657) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.6041822433), FRAC_CONST(-0.7968461514) } }, + { { FRAC_CONST(-0.2638721764), FRAC_CONST(-0.9645576477) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.9859085083), FRAC_CONST(0.1672853529) } }, + { { FRAC_CONST(0.8837660551), FRAC_CONST(-0.4679289758) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.3075223565), FRAC_CONST(0.9515408874) } }, + { { FRAC_CONST(0.6494473219), FRAC_CONST(0.7604066133) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.7015317082), FRAC_CONST(0.7126382589) } }, + { { FRAC_CONST(-0.6004210114), FRAC_CONST(0.7996840477) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.9562535882), FRAC_CONST(-0.2925389707) } }, + { { FRAC_CONST(-0.9114028811), FRAC_CONST(-0.4115152657) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.1827499419), FRAC_CONST(-0.9831594229) } }, + { { FRAC_CONST(0.2027882934), FRAC_CONST(-0.9792225957) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.7872582674), FRAC_CONST(-0.6166234016) } }, + { { FRAC_CONST(0.9998766780), FRAC_CONST(-0.0157062728) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.9107555747), FRAC_CONST(0.4129458666) } }, + { { FRAC_CONST(0.2334443331), FRAC_CONST(0.9723701477) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.0549497530), FRAC_CONST(0.9984891415) } }, + { { FRAC_CONST(-0.8980280757), FRAC_CONST(0.4399381876) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.8599416018), FRAC_CONST(0.5103924870) } }, + { { FRAC_CONST(-0.6252418160), FRAC_CONST(-0.7804310918) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.8501682281), FRAC_CONST(-0.5265110731) } }, + { { FRAC_CONST(0.6252435446), FRAC_CONST(-0.7804297209) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.0737608299), FRAC_CONST(-0.9972759485) } }, + { { FRAC_CONST(0.8980270624), FRAC_CONST(0.4399402142) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.9183775187), FRAC_CONST(-0.3957053721) } }, + { { FRAC_CONST(-0.2334465086), FRAC_CONST(0.9723696709) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.7754954696), FRAC_CONST(0.6313531399) } }, + { { FRAC_CONST(-0.9998766184), FRAC_CONST(-0.0157085191) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.2012493610), FRAC_CONST(0.9795400500) } }, + { { FRAC_CONST(-0.2027861029), FRAC_CONST(-0.9792230725) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.9615978599), FRAC_CONST(0.2744622827) } }, + { { FRAC_CONST(0.9114037752), FRAC_CONST(-0.4115132093) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.6879743338), FRAC_CONST(-0.7257350087) } }, + { { FRAC_CONST(0.6004192233), FRAC_CONST(0.7996854186) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.3254036009), FRAC_CONST(-0.9455752373) } }, + { { FRAC_CONST(-0.6494490504), FRAC_CONST(0.7604051232) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.9888865948), FRAC_CONST(-0.1486719251) } }, + { { FRAC_CONST(-0.8837650418), FRAC_CONST(-0.4679309726) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.5890548825), FRAC_CONST(0.8080930114) } }, + { { FRAC_CONST(0.2638743520), FRAC_CONST(-0.9645570517) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.4441666007), FRAC_CONST(0.8959442377) } }, + { { FRAC_CONST(0.9988898039), FRAC_CONST(0.0471078083) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.9997915030), FRAC_CONST(0.0204183888) } }, + { { FRAC_CONST(0.1719277352), FRAC_CONST(0.9851095676) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.4803760946), FRAC_CONST(-0.8770626187) } }, + { { FRAC_CONST(-0.9238800406), FRAC_CONST(0.3826821446) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.5555707216), FRAC_CONST(-0.8314692974) } }, + { { FRAC_CONST(-0.5750041008), FRAC_CONST(-0.8181505203) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.9941320419), FRAC_CONST(0.1081734300) } } +}; + +static const complex_t Phi_Fract_Qmf[] = { + { FRAC_CONST(0.8181497455), FRAC_CONST(0.5750052333) }, + { FRAC_CONST(-0.2638730407), FRAC_CONST(0.9645574093) }, + { FRAC_CONST(-0.9969173074), FRAC_CONST(0.0784590989) }, + { FRAC_CONST(-0.4115143716), FRAC_CONST(-0.9114032984) }, + { FRAC_CONST(0.7181262970), FRAC_CONST(-0.6959127784) }, + { FRAC_CONST(0.8980275989), FRAC_CONST(0.4399391711) }, + { FRAC_CONST(-0.1097343117), FRAC_CONST(0.9939609766) }, + { FRAC_CONST(-0.9723699093), FRAC_CONST(0.2334453613) }, + { FRAC_CONST(-0.5490227938), FRAC_CONST(-0.8358073831) }, + { FRAC_CONST(0.6004202366), FRAC_CONST(-0.7996846437) }, + { FRAC_CONST(0.9557930231), FRAC_CONST(0.2940403223) }, + { FRAC_CONST(0.0471064523), FRAC_CONST(0.9988898635) }, + { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, + { FRAC_CONST(-0.6730124950), FRAC_CONST(-0.7396311164) }, + { FRAC_CONST(0.4679298103), FRAC_CONST(-0.8837656379) }, + { FRAC_CONST(0.9900236726), FRAC_CONST(0.1409012377) }, + { FRAC_CONST(0.2027872950), FRAC_CONST(0.9792228341) }, + { FRAC_CONST(-0.8526401520), FRAC_CONST(0.5224985480) }, + { FRAC_CONST(-0.7804304361), FRAC_CONST(-0.6252426505) }, + { FRAC_CONST(0.3239174187), FRAC_CONST(-0.9460853338) }, + { FRAC_CONST(0.9998766184), FRAC_CONST(-0.0157073177) }, + { FRAC_CONST(0.3534748554), FRAC_CONST(0.9354440570) }, + { FRAC_CONST(-0.7604059577), FRAC_CONST(0.6494480371) }, + { FRAC_CONST(-0.8686315417), FRAC_CONST(-0.4954586625) }, + { FRAC_CONST(0.1719291061), FRAC_CONST(-0.9851093292) }, + { FRAC_CONST(0.9851093292), FRAC_CONST(-0.1719291061) }, + { FRAC_CONST(0.4954586625), FRAC_CONST(0.8686315417) }, + { FRAC_CONST(-0.6494480371), FRAC_CONST(0.7604059577) }, + { FRAC_CONST(-0.9354440570), FRAC_CONST(-0.3534748554) }, + { FRAC_CONST(0.0157073177), FRAC_CONST(-0.9998766184) }, + { FRAC_CONST(0.9460853338), FRAC_CONST(-0.3239174187) }, + { FRAC_CONST(0.6252426505), FRAC_CONST(0.7804304361) }, + { FRAC_CONST(-0.5224985480), FRAC_CONST(0.8526401520) }, + { FRAC_CONST(-0.9792228341), FRAC_CONST(-0.2027872950) }, + { FRAC_CONST(-0.1409012377), FRAC_CONST(-0.9900236726) }, + { FRAC_CONST(0.8837656379), FRAC_CONST(-0.4679298103) }, + { FRAC_CONST(0.7396311164), FRAC_CONST(0.6730124950) }, + { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, + { FRAC_CONST(-0.9988898635), FRAC_CONST(-0.0471064523) }, + { FRAC_CONST(-0.2940403223), FRAC_CONST(-0.9557930231) }, + { FRAC_CONST(0.7996846437), FRAC_CONST(-0.6004202366) }, + { FRAC_CONST(0.8358073831), FRAC_CONST(0.5490227938) }, + { FRAC_CONST(-0.2334453613), FRAC_CONST(0.9723699093) }, + { FRAC_CONST(-0.9939609766), FRAC_CONST(0.1097343117) }, + { FRAC_CONST(-0.4399391711), FRAC_CONST(-0.8980275989) }, + { FRAC_CONST(0.6959127784), FRAC_CONST(-0.7181262970) }, + { FRAC_CONST(0.9114032984), FRAC_CONST(0.4115143716) }, + { FRAC_CONST(-0.0784590989), FRAC_CONST(0.9969173074) }, + { FRAC_CONST(-0.9645574093), FRAC_CONST(0.2638730407) }, + { FRAC_CONST(-0.5750052333), FRAC_CONST(-0.8181497455) }, + { FRAC_CONST(0.5750052333), FRAC_CONST(-0.8181497455) }, + { FRAC_CONST(0.9645574093), FRAC_CONST(0.2638730407) }, + { FRAC_CONST(0.0784590989), FRAC_CONST(0.9969173074) }, + { FRAC_CONST(-0.9114032984), FRAC_CONST(0.4115143716) }, + { FRAC_CONST(-0.6959127784), FRAC_CONST(-0.7181262970) }, + { FRAC_CONST(0.4399391711), FRAC_CONST(-0.8980275989) }, + { FRAC_CONST(0.9939609766), FRAC_CONST(0.1097343117) }, + { FRAC_CONST(0.2334453613), FRAC_CONST(0.9723699093) }, + { FRAC_CONST(-0.8358073831), FRAC_CONST(0.5490227938) }, + { FRAC_CONST(-0.7996846437), FRAC_CONST(-0.6004202366) }, + { FRAC_CONST(0.2940403223), FRAC_CONST(-0.9557930231) }, + { FRAC_CONST(0.9988898635), FRAC_CONST(-0.0471064523) }, + { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, + { FRAC_CONST(-0.7396311164), FRAC_CONST(0.6730124950) } +}; + + +/* static function declarations */ +static void drm_ps_sa_element(drm_ps_info *ps, bitfile *ld); +static void drm_ps_pan_element(drm_ps_info *ps, bitfile *ld); +static int8_t huff_dec(bitfile *ld, drm_ps_huff_tab huff); + + +uint16_t drm_ps_data(drm_ps_info *ps, bitfile *ld) +{ + uint16_t bits = (uint16_t)faad_get_processed_bits(ld); + + ps->drm_ps_data_available = 1; + + ps->bs_enable_sa = faad_get1bit(ld); + ps->bs_enable_pan = faad_get1bit(ld); + + if (ps->bs_enable_sa) + { + drm_ps_sa_element(ps, ld); + } + + if (ps->bs_enable_pan) + { + drm_ps_pan_element(ps, ld); + } + + bits = (uint16_t)faad_get_processed_bits(ld) - bits; + + return bits; +} + +static void drm_ps_sa_element(drm_ps_info *ps, bitfile *ld) +{ + drm_ps_huff_tab huff; + uint8_t band; + + ps->bs_sa_dt_flag = faad_get1bit(ld); + if (ps->bs_sa_dt_flag) + { + huff = t_huffman_sa; + } else { + huff = f_huffman_sa; + } + + for (band = 0; band < DRM_NUM_SA_BANDS; band++) + { + ps->bs_sa_data[band] = huff_dec(ld, huff); + } +} + +static void drm_ps_pan_element(drm_ps_info *ps, bitfile *ld) +{ + drm_ps_huff_tab huff; + uint8_t band; + + ps->bs_pan_dt_flag = faad_get1bit(ld); + if (ps->bs_pan_dt_flag) + { + huff = t_huffman_pan; + } else { + huff = f_huffman_pan; + } + + for (band = 0; band < DRM_NUM_PAN_BANDS; band++) + { + ps->bs_pan_data[band] = huff_dec(ld, huff); + } +} + +/* binary search huffman decoding */ +static int8_t huff_dec(bitfile *ld, drm_ps_huff_tab huff) +{ + uint8_t bit; + int16_t index = 0; + + while (index >= 0) + { + bit = (uint8_t)faad_get1bit(ld); + index = huff[index][bit]; + } + + return index + 15; +} + + +static int8_t sa_delta_clip(drm_ps_info *ps, int8_t i) +{ + if (i < 0) { + /* printf(" SAminclip %d", i); */ + ps->sa_decode_error = 1; + return 0; + } else if (i > 7) { + /* printf(" SAmaxclip %d", i); */ + ps->sa_decode_error = 1; + return 7; + } else + return i; +} + +static int8_t pan_delta_clip(drm_ps_info *ps, int8_t i) +{ + if (i < -7) { + /* printf(" PANminclip %d", i); */ + ps->pan_decode_error = 1; + return -7; + } else if (i > 7) { + /* printf(" PANmaxclip %d", i); */ + ps->pan_decode_error = 1; + return 7; + } else + return i; +} + +static void drm_ps_delta_decode(drm_ps_info *ps) +{ + uint8_t band; + + if (ps->bs_enable_sa) + { + if (ps->bs_sa_dt_flag && !ps->g_last_had_sa) + { + for (band = 0; band < DRM_NUM_SA_BANDS; band++) + { + ps->g_prev_sa_index[band] = 0; + } + } + if (ps->bs_sa_dt_flag) + { + ps->g_sa_index[0] = sa_delta_clip(ps, ps->g_prev_sa_index[0]+ps->bs_sa_data[0]); + + } else { + ps->g_sa_index[0] = sa_delta_clip(ps,ps->bs_sa_data[0]); + } + + for (band = 1; band < DRM_NUM_SA_BANDS; band++) + { + if (ps->bs_sa_dt_flag) + { + ps->g_sa_index[band] = sa_delta_clip(ps, ps->g_prev_sa_index[band] + ps->bs_sa_data[band]); + } else { + ps->g_sa_index[band] = sa_delta_clip(ps, ps->g_sa_index[band-1] + ps->bs_sa_data[band]); + } + } + } + + /* An error during SA decoding implies PAN data will be undecodable, too */ + /* Also, we don't like on/off switching in PS, so we force to last settings */ + if (ps->sa_decode_error) { + ps->pan_decode_error = 1; + ps->bs_enable_pan = ps->g_last_had_pan; + ps->bs_enable_sa = ps->g_last_had_sa; + } + + + if (ps->bs_enable_sa) + { + if (ps->sa_decode_error) { + for (band = 0; band < DRM_NUM_SA_BANDS; band++) + { + ps->g_sa_index[band] = ps->g_last_good_sa_index[band]; + } + } else { + for (band = 0; band < DRM_NUM_SA_BANDS; band++) + { + ps->g_last_good_sa_index[band] = ps->g_sa_index[band]; + } + } + } + + if (ps->bs_enable_pan) + { + if (ps->bs_pan_dt_flag && !ps->g_last_had_pan) + { +/* The DRM PS spec doesn't say anything about this case. (deltacoded in time without a previous frame) + AAC PS spec you must tread previous frame as 0, so that's what we try. +*/ + for (band = 0; band < DRM_NUM_PAN_BANDS; band++) + { + ps->g_prev_pan_index[band] = 0; + } + } + + if (ps->bs_pan_dt_flag) + { + ps->g_pan_index[0] = pan_delta_clip(ps, ps->g_prev_pan_index[0]+ps->bs_pan_data[0]); + } else { + ps->g_pan_index[0] = pan_delta_clip(ps, ps->bs_pan_data[0]); + } + + for (band = 1; band < DRM_NUM_PAN_BANDS; band++) + { + if (ps->bs_pan_dt_flag) + { + ps->g_pan_index[band] = pan_delta_clip(ps, ps->g_prev_pan_index[band] + ps->bs_pan_data[band]); + } else { + ps->g_pan_index[band] = pan_delta_clip(ps, ps->g_pan_index[band-1] + ps->bs_pan_data[band]); + } + } + + if (ps->pan_decode_error) { + for (band = 0; band < DRM_NUM_PAN_BANDS; band++) + { + ps->g_pan_index[band] = ps->g_last_good_pan_index[band]; + } + } else { + for (band = 0; band < DRM_NUM_PAN_BANDS; band++) + { + ps->g_last_good_pan_index[band] = ps->g_pan_index[band]; + } + } + } +} + +static void drm_calc_sa_side_signal(drm_ps_info *ps, qmf_t X[38][64], uint8_t rateselect) +{ + uint8_t s, b, k; + complex_t qfrac, tmp0, tmp, in, R0; + real_t peakdiff; + real_t nrg; + real_t power; + real_t transratio; + real_t new_delay_slopes[NUM_OF_LINKS]; + uint8_t temp_delay_ser[NUM_OF_LINKS]; + complex_t Phi_Fract; +#ifdef FIXED_POINT + uint32_t in_re, in_im; +#endif + + for (b = 0; b < sa_freq_scale[DRM_NUM_SA_BANDS][rateselect]; b++) + { + /* set delay indices */ + for (k = 0; k < NUM_OF_LINKS; k++) + temp_delay_ser[k] = ps->delay_buf_index_ser[k]; + + RE(Phi_Fract) = RE(Phi_Fract_Qmf[b]); + IM(Phi_Fract) = IM(Phi_Fract_Qmf[b]); + + for (s = 0; s < NUM_OF_SUBSAMPLES; s++) + { + const real_t gamma = REAL_CONST(1.5); + const real_t sigma = REAL_CONST(1.5625); + + RE(in) = QMF_RE(X[s][b]); + IM(in) = QMF_IM(X[s][b]); + +#ifdef FIXED_POINT + /* NOTE: all input is scaled by 2^(-5) because of fixed point QMF + * meaning that P will be scaled by 2^(-10) compared to floating point version + */ + in_re = ((abs(RE(in))+(1<<(REAL_BITS-1)))>>REAL_BITS); + in_im = ((abs(IM(in))+(1<<(REAL_BITS-1)))>>REAL_BITS); + power = in_re*in_re + in_im*in_im; +#else + power = MUL_R(RE(in),RE(in)) + MUL_R(IM(in),IM(in)); +#endif + + ps->peakdecay_fast[b] = MUL_F(ps->peakdecay_fast[b], peak_decay[rateselect]); + if (ps->peakdecay_fast[b] < power) + ps->peakdecay_fast[b] = power; + + peakdiff = ps->prev_peakdiff[b]; + peakdiff += MUL_F((ps->peakdecay_fast[b] - power - ps->prev_peakdiff[b]), smooth_coeff[rateselect]); + ps->prev_peakdiff[b] = peakdiff; + + nrg = ps->prev_nrg[b]; + nrg += MUL_F((power - ps->prev_nrg[b]), smooth_coeff[rateselect]); + ps->prev_nrg[b] = nrg; + + if (MUL_R(peakdiff, gamma) <= nrg) { + transratio = sigma; + } else { + transratio = MUL_R(DIV_R(nrg, MUL_R(peakdiff, gamma)), sigma); + } + + for (k = 0; k < NUM_OF_LINKS; k++) + { + new_delay_slopes[k] = MUL_F(g_decayslope[b], filter_coeff[k]); + } + + RE(tmp0) = RE(ps->d_buff[0][b]); + IM(tmp0) = IM(ps->d_buff[0][b]); + + RE(ps->d_buff[0][b]) = RE(ps->d_buff[1][b]); + IM(ps->d_buff[0][b]) = IM(ps->d_buff[1][b]); + + RE(ps->d_buff[1][b]) = RE(in); + IM(ps->d_buff[1][b]) = IM(in); + + ComplexMult(&RE(tmp), &IM(tmp), RE(tmp0), IM(tmp0), RE(Phi_Fract), IM(Phi_Fract)); + + RE(R0) = RE(tmp); + IM(R0) = IM(tmp); + + for (k = 0; k < NUM_OF_LINKS; k++) + { + RE(qfrac) = RE(Q_Fract_allpass_Qmf[b][k]); + IM(qfrac) = IM(Q_Fract_allpass_Qmf[b][k]); + + RE(tmp0) = RE(ps->d2_buff[k][temp_delay_ser[k]][b]); + IM(tmp0) = IM(ps->d2_buff[k][temp_delay_ser[k]][b]); + + ComplexMult(&RE(tmp), &IM(tmp), RE(tmp0), IM(tmp0), RE(qfrac), IM(qfrac)); + + RE(tmp) += -MUL_F(new_delay_slopes[k], RE(R0)); + IM(tmp) += -MUL_F(new_delay_slopes[k], IM(R0)); + + RE(ps->d2_buff[k][temp_delay_ser[k]][b]) = RE(R0) + MUL_F(new_delay_slopes[k], RE(tmp)); + IM(ps->d2_buff[k][temp_delay_ser[k]][b]) = IM(R0) + MUL_F(new_delay_slopes[k], IM(tmp)); + + RE(R0) = RE(tmp); + IM(R0) = IM(tmp); + } + + QMF_RE(ps->SA[s][b]) = MUL_R(RE(R0), transratio); + QMF_IM(ps->SA[s][b]) = MUL_R(IM(R0), transratio); + + for (k = 0; k < NUM_OF_LINKS; k++) + { + if (++temp_delay_ser[k] >= delay_length[k][rateselect]) + temp_delay_ser[k] = 0; + } + } + } + + for (k = 0; k < NUM_OF_LINKS; k++) + ps->delay_buf_index_ser[k] = temp_delay_ser[k]; +} + +static void drm_add_ambiance(drm_ps_info *ps, uint8_t rateselect, qmf_t X_left[38][64], qmf_t X_right[38][64]) +{ + uint8_t s, b, ifreq, qclass; + real_t sa_map[MAX_SA_BAND], sa_dir_map[MAX_SA_BAND], k_sa_map[MAX_SA_BAND], k_sa_dir_map[MAX_SA_BAND]; + real_t new_dir_map, new_sa_map; + + if (ps->bs_enable_sa) + { + /* Instead of dequantization and mapping, we use an inverse mapping + to look up all the values we need */ + for (b = 0; b < sa_freq_scale[DRM_NUM_SA_BANDS][rateselect]; b++) + { + const real_t inv_f_num_of_subsamples = FRAC_CONST(0.03333333333); + + ifreq = sa_inv_freq[b]; + qclass = (b != 0); + + sa_map[b] = sa_quant[ps->g_prev_sa_index[ifreq]][qclass]; + new_sa_map = sa_quant[ps->g_sa_index[ifreq]][qclass]; + + k_sa_map[b] = MUL_F(inv_f_num_of_subsamples, (new_sa_map - sa_map[b])); + + sa_dir_map[b] = sa_sqrt_1_minus[ps->g_prev_sa_index[ifreq]][qclass]; + new_dir_map = sa_sqrt_1_minus[ps->g_sa_index[ifreq]][qclass]; + + k_sa_dir_map[b] = MUL_F(inv_f_num_of_subsamples, (new_dir_map - sa_dir_map[b])); + + } + + for (s = 0; s < NUM_OF_SUBSAMPLES; s++) + { + for (b = 0; b < sa_freq_scale[DRM_NUM_SA_BANDS][rateselect]; b++) + { + QMF_RE(X_right[s][b]) = MUL_F(QMF_RE(X_left[s][b]), sa_dir_map[b]) - MUL_F(QMF_RE(ps->SA[s][b]), sa_map[b]); + QMF_IM(X_right[s][b]) = MUL_F(QMF_IM(X_left[s][b]), sa_dir_map[b]) - MUL_F(QMF_IM(ps->SA[s][b]), sa_map[b]); + QMF_RE(X_left[s][b]) = MUL_F(QMF_RE(X_left[s][b]), sa_dir_map[b]) + MUL_F(QMF_RE(ps->SA[s][b]), sa_map[b]); + QMF_IM(X_left[s][b]) = MUL_F(QMF_IM(X_left[s][b]), sa_dir_map[b]) + MUL_F(QMF_IM(ps->SA[s][b]), sa_map[b]); + + sa_map[b] += k_sa_map[b]; + sa_dir_map[b] += k_sa_dir_map[b]; + } + for (b = sa_freq_scale[DRM_NUM_SA_BANDS][rateselect]; b < NUM_OF_QMF_CHANNELS; b++) + { + QMF_RE(X_right[s][b]) = QMF_RE(X_left[s][b]); + QMF_IM(X_right[s][b]) = QMF_IM(X_left[s][b]); + } + } + } + else { + for (s = 0; s < NUM_OF_SUBSAMPLES; s++) + { + for (b = 0; b < NUM_OF_QMF_CHANNELS; b++) + { + QMF_RE(X_right[s][b]) = QMF_RE(X_left[s][b]); + QMF_IM(X_right[s][b]) = QMF_IM(X_left[s][b]); + } + } + } +} + +static void drm_add_pan(drm_ps_info *ps, uint8_t rateselect, qmf_t X_left[38][64], qmf_t X_right[38][64]) +{ + uint8_t s, b, qclass, ifreq; + real_t tmp, coeff1, coeff2; + real_t pan_base[MAX_PAN_BAND]; + real_t pan_delta[MAX_PAN_BAND]; + qmf_t temp_l, temp_r; + + if (ps->bs_enable_pan) + { + for (b = 0; b < NUM_OF_QMF_CHANNELS; b++) + { + /* Instead of dequantization, 20->64 mapping and 2^G(x,y) we do an + inverse mapping 64->20 and look up the 2^G(x,y) values directly */ + ifreq = pan_inv_freq[b]; + qclass = pan_quant_class[ifreq]; + + if (ps->g_prev_pan_index[ifreq] >= 0) + { + pan_base[b] = pan_pow_2_pos[ps->g_prev_pan_index[ifreq]][qclass]; + } else { + pan_base[b] = pan_pow_2_neg[-ps->g_prev_pan_index[ifreq]][qclass]; + } + + /* 2^((a-b)/30) = 2^(a/30) * 1/(2^(b/30)) */ + /* a en b can be negative so we may need to inverse parts */ + if (ps->g_pan_index[ifreq] >= 0) + { + if (ps->g_prev_pan_index[ifreq] >= 0) + { + pan_delta[b] = MUL_C(pan_pow_2_30_pos[ps->g_pan_index[ifreq]][qclass], + pan_pow_2_30_neg[ps->g_prev_pan_index[ifreq]][qclass]); + } else { + pan_delta[b] = MUL_C(pan_pow_2_30_pos[ps->g_pan_index[ifreq]][qclass], + pan_pow_2_30_pos[-ps->g_prev_pan_index[ifreq]][qclass]); + } + } else { + if (ps->g_prev_pan_index[ifreq] >= 0) + { + pan_delta[b] = MUL_C(pan_pow_2_30_neg[-ps->g_pan_index[ifreq]][qclass], + pan_pow_2_30_neg[ps->g_prev_pan_index[ifreq]][qclass]); + } else { + pan_delta[b] = MUL_C(pan_pow_2_30_neg[-ps->g_pan_index[ifreq]][qclass], + pan_pow_2_30_pos[-ps->g_prev_pan_index[ifreq]][qclass]); + } + } + } + + for (s = 0; s < NUM_OF_SUBSAMPLES; s++) + { + /* PAN always uses all 64 channels */ + for (b = 0; b < NUM_OF_QMF_CHANNELS; b++) + { + tmp = pan_base[b]; + + coeff2 = DIV_R(REAL_CONST(2.0), (REAL_CONST(1.0) + tmp)); + coeff1 = MUL_R(coeff2, tmp); + + QMF_RE(temp_l) = QMF_RE(X_left[s][b]); + QMF_IM(temp_l) = QMF_IM(X_left[s][b]); + QMF_RE(temp_r) = QMF_RE(X_right[s][b]); + QMF_IM(temp_r) = QMF_IM(X_right[s][b]); + + QMF_RE(X_left[s][b]) = MUL_R(QMF_RE(temp_l), coeff1); + QMF_IM(X_left[s][b]) = MUL_R(QMF_IM(temp_l), coeff1); + QMF_RE(X_right[s][b]) = MUL_R(QMF_RE(temp_r), coeff2); + QMF_IM(X_right[s][b]) = MUL_R(QMF_IM(temp_r), coeff2); + + /* 2^(a+k*b) = 2^a * 2^b * ... * 2^b */ + /* ^^^^^^^^^^^^^^^ k times */ + pan_base[b] = MUL_C(pan_base[b], pan_delta[b]); + } + } + } +} + +drm_ps_info *drm_ps_init(void) +{ + drm_ps_info *ps = (drm_ps_info*)faad_malloc(sizeof(drm_ps_info)); + + memset(ps, 0, sizeof(drm_ps_info)); + + return ps; +} + +void drm_ps_free(drm_ps_info *ps) +{ + faad_free(ps); +} + +/* main DRM PS decoding function */ +uint8_t drm_ps_decode(drm_ps_info *ps, uint8_t guess, uint32_t samplerate, qmf_t X_left[38][64], qmf_t X_right[38][64]) +{ + uint8_t rateselect = (samplerate >= 24000); + + if (ps == NULL) + { + memcpy(X_right, X_left, sizeof(qmf_t)*30*64); + return 0; + } + + if (!ps->drm_ps_data_available && !guess) + { + memcpy(X_right, X_left, sizeof(qmf_t)*30*64); + memset(ps->g_prev_sa_index, 0, sizeof(ps->g_prev_sa_index)); + memset(ps->g_prev_pan_index, 0, sizeof(ps->g_prev_pan_index)); + return 0; + } + + /* if SBR CRC doesn't match out, we can assume decode errors to start with, + and we'll guess what the parameters should be */ + if (!guess) + { + ps->sa_decode_error = 0; + ps->pan_decode_error = 0; + drm_ps_delta_decode(ps); + } else + { + ps->sa_decode_error = 1; + ps->pan_decode_error = 1; + /* don't even bother decoding */ + } + + ps->drm_ps_data_available = 0; + + drm_calc_sa_side_signal(ps, X_left, rateselect); + drm_add_ambiance(ps, rateselect, X_left, X_right); + + if (ps->bs_enable_sa) + { + ps->g_last_had_sa = 1; + + memcpy(ps->g_prev_sa_index, ps->g_sa_index, sizeof(int8_t) * DRM_NUM_SA_BANDS); + + } else { + ps->g_last_had_sa = 0; + } + + if (ps->bs_enable_pan) + { + drm_add_pan(ps, rateselect, X_left, X_right); + + ps->g_last_had_pan = 1; + + memcpy(ps->g_prev_pan_index, ps->g_pan_index, sizeof(int8_t) * DRM_NUM_PAN_BANDS); + + } else { + ps->g_last_had_pan = 0; + } + + + return 0; +} + +#endif diff --git a/Libraries/FAAD2/Files/libfaad/drm_dec.h b/Libraries/FAAD2/Files/libfaad/drm_dec.h new file mode 100644 index 000000000..e90b2340b --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/drm_dec.h @@ -0,0 +1,97 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#ifndef __DRM_DEC_H__ +#define __DRM_DEC_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "bits.h" + +#define DRM_PARAMETRIC_STEREO 0 +#define DRM_NUM_SA_BANDS 8 +#define DRM_NUM_PAN_BANDS 20 +#define NUM_OF_LINKS 3 +#define NUM_OF_QMF_CHANNELS 64 +#define NUM_OF_SUBSAMPLES 30 +#define MAX_SA_BAND 46 +#define MAX_PAN_BAND 64 +#define MAX_DELAY 5 + +typedef struct +{ + uint8_t drm_ps_data_available; + uint8_t bs_enable_sa; + uint8_t bs_enable_pan; + + uint8_t bs_sa_dt_flag; + uint8_t bs_pan_dt_flag; + + uint8_t g_last_had_sa; + uint8_t g_last_had_pan; + + int8_t bs_sa_data[DRM_NUM_SA_BANDS]; + int8_t bs_pan_data[DRM_NUM_PAN_BANDS]; + + int8_t g_sa_index[DRM_NUM_SA_BANDS]; + int8_t g_pan_index[DRM_NUM_PAN_BANDS]; + int8_t g_prev_sa_index[DRM_NUM_SA_BANDS]; + int8_t g_prev_pan_index[DRM_NUM_PAN_BANDS]; + + int8_t sa_decode_error; + int8_t pan_decode_error; + + int8_t g_last_good_sa_index[DRM_NUM_SA_BANDS]; + int8_t g_last_good_pan_index[DRM_NUM_PAN_BANDS]; + + qmf_t SA[NUM_OF_SUBSAMPLES][MAX_SA_BAND]; + + complex_t d_buff[2][MAX_SA_BAND]; + complex_t d2_buff[NUM_OF_LINKS][MAX_DELAY][MAX_SA_BAND]; + + uint8_t delay_buf_index_ser[NUM_OF_LINKS]; + + real_t prev_nrg[MAX_SA_BAND]; + real_t prev_peakdiff[MAX_SA_BAND]; + real_t peakdecay_fast[MAX_SA_BAND]; +} drm_ps_info; + + +uint16_t drm_ps_data(drm_ps_info *ps, bitfile *ld); + +drm_ps_info *drm_ps_init(void); +void drm_ps_free(drm_ps_info *ps); + +uint8_t drm_ps_decode(drm_ps_info *ps, uint8_t guess, uint32_t samplerate, qmf_t X_left[38][64], qmf_t X_right[38][64]); + +#ifdef __cplusplus +} +#endif +#endif + diff --git a/Libraries/FAAD2/Files/libfaad/error.c b/Libraries/FAAD2/Files/libfaad/error.c new file mode 100644 index 000000000..8cfd76175 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/error.c @@ -0,0 +1,61 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#include "common.h" +#include "error.h" + +char *err_msg[] = { + "No error", + "Gain control not yet implemented", + "Pulse coding not allowed in short blocks", + "Invalid huffman codebook", + "Scalefactor out of range", + "Unable to find ADTS syncword", + "Channel coupling not yet implemented", + "Channel configuration not allowed in error resilient frame", + "Bit error in error resilient scalefactor decoding", + "Error decoding huffman scalefactor (bitstream error)", + "Error decoding huffman codeword (bitstream error)", + "Non existent huffman codebook number found", + "Invalid number of channels", + "Maximum number of bitstream elements exceeded", + "Input data buffer too small", + "Array index out of range", + "Maximum number of scalefactor bands exceeded", + "Quantised value out of range", + "LTP lag out of range", + "Invalid SBR parameter decoded", + "SBR called without being initialised", + "Unexpected channel configuration change", + "Error in program_config_element", + "First SBR frame is not the same as first AAC frame", + "Unexpected fill element with SBR data", + "Not all elements were provided with SBR data", + "LTP decoding not available", + "Output data buffer too small" +}; + diff --git a/Libraries/FAAD2/Files/libfaad/error.h b/Libraries/FAAD2/Files/libfaad/error.h new file mode 100644 index 000000000..94ca7bba7 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/error.h @@ -0,0 +1,41 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#ifndef __ERROR_H__ +#define __ERROR_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#define NUM_ERROR_MESSAGES 28 +extern char *err_msg[]; + +#ifdef __cplusplus +} +#endif +#endif diff --git a/Libraries/FAAD2/Files/libfaad/filtbank.c b/Libraries/FAAD2/Files/libfaad/filtbank.c new file mode 100644 index 000000000..13cc265e2 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/filtbank.c @@ -0,0 +1,404 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#include "common.h" +#include "structs.h" + +#include +#include +#ifdef _WIN32_WCE +#define assert(x) +#else +#include +#endif + +#include "filtbank.h" +#include "decoder.h" +#include "syntax.h" +#include "kbd_win.h" +#include "sine_win.h" +#include "mdct.h" + + +fb_info *filter_bank_init(uint16_t frame_len) +{ + uint16_t nshort = frame_len/8; +#ifdef LD_DEC + uint16_t frame_len_ld = frame_len/2; +#endif + + fb_info *fb = (fb_info*)faad_malloc(sizeof(fb_info)); + memset(fb, 0, sizeof(fb_info)); + + /* normal */ + fb->mdct256 = faad_mdct_init(2*nshort); + fb->mdct2048 = faad_mdct_init(2*frame_len); +#ifdef LD_DEC + /* LD */ + fb->mdct1024 = faad_mdct_init(2*frame_len_ld); +#endif + +#ifdef ALLOW_SMALL_FRAMELENGTH + if (frame_len == 1024) + { +#endif + fb->long_window[0] = sine_long_1024; + fb->short_window[0] = sine_short_128; + fb->long_window[1] = kbd_long_1024; + fb->short_window[1] = kbd_short_128; +#ifdef LD_DEC + fb->ld_window[0] = sine_mid_512; + fb->ld_window[1] = ld_mid_512; +#endif +#ifdef ALLOW_SMALL_FRAMELENGTH + } else /* (frame_len == 960) */ { + fb->long_window[0] = sine_long_960; + fb->short_window[0] = sine_short_120; + fb->long_window[1] = kbd_long_960; + fb->short_window[1] = kbd_short_120; +#ifdef LD_DEC + fb->ld_window[0] = sine_mid_480; + fb->ld_window[1] = ld_mid_480; +#endif + } +#endif + + return fb; +} + +void filter_bank_end(fb_info *fb) +{ + if (fb != NULL) + { +#ifdef PROFILE + printf("FB: %I64d cycles\n", fb->cycles); +#endif + + faad_mdct_end(fb->mdct256); + faad_mdct_end(fb->mdct2048); +#ifdef LD_DEC + faad_mdct_end(fb->mdct1024); +#endif + + faad_free(fb); + } +} + +static INLINE void imdct_long(fb_info *fb, real_t *in_data, real_t *out_data, uint16_t len) +{ +#ifdef LD_DEC + mdct_info *mdct = NULL; + + switch (len) + { + case 2048: + case 1920: + mdct = fb->mdct2048; + break; + case 1024: + case 960: + mdct = fb->mdct1024; + break; + } + + faad_imdct(mdct, in_data, out_data); +#else + faad_imdct(fb->mdct2048, in_data, out_data); +#endif +} + + +#ifdef LTP_DEC +static INLINE void mdct(fb_info *fb, real_t *in_data, real_t *out_data, uint16_t len) +{ + mdct_info *mdct = NULL; + + switch (len) + { + case 2048: + case 1920: + mdct = fb->mdct2048; + break; + case 256: + case 240: + mdct = fb->mdct256; + break; +#ifdef LD_DEC + case 1024: + case 960: + mdct = fb->mdct1024; + break; +#endif + } + + faad_mdct(mdct, in_data, out_data); +} +#endif + +void ifilter_bank(fb_info *fb, uint8_t window_sequence, uint8_t window_shape, + uint8_t window_shape_prev, real_t *freq_in, + real_t *time_out, real_t *overlap, + uint8_t object_type, uint16_t frame_len) +{ + int16_t i; + ALIGN real_t transf_buf[2*1024] = {0}; + + const real_t *window_long = NULL; + const real_t *window_long_prev = NULL; + const real_t *window_short = NULL; + const real_t *window_short_prev = NULL; + + uint16_t nlong = frame_len; + uint16_t nshort = frame_len/8; + uint16_t trans = nshort/2; + + uint16_t nflat_ls = (nlong-nshort)/2; + +#ifdef PROFILE + int64_t count = faad_get_ts(); +#endif + + /* select windows of current frame and previous frame (Sine or KBD) */ +#ifdef LD_DEC + if (object_type == LD) + { + window_long = fb->ld_window[window_shape]; + window_long_prev = fb->ld_window[window_shape_prev]; + } else { +#endif + window_long = fb->long_window[window_shape]; + window_long_prev = fb->long_window[window_shape_prev]; + window_short = fb->short_window[window_shape]; + window_short_prev = fb->short_window[window_shape_prev]; +#ifdef LD_DEC + } +#endif + +#if 0 + for (i = 0; i < 1024; i++) + { + printf("%d\n", freq_in[i]); + } +#endif + +#if 0 + printf("%d %d\n", window_sequence, window_shape); +#endif + + switch (window_sequence) + { + case ONLY_LONG_SEQUENCE: + /* perform iMDCT */ + imdct_long(fb, freq_in, transf_buf, 2*nlong); + + /* add second half output of previous frame to windowed output of current frame */ + for (i = 0; i < nlong; i+=4) + { + time_out[i] = overlap[i] + MUL_F(transf_buf[i],window_long_prev[i]); + time_out[i+1] = overlap[i+1] + MUL_F(transf_buf[i+1],window_long_prev[i+1]); + time_out[i+2] = overlap[i+2] + MUL_F(transf_buf[i+2],window_long_prev[i+2]); + time_out[i+3] = overlap[i+3] + MUL_F(transf_buf[i+3],window_long_prev[i+3]); + } + + /* window the second half and save as overlap for next frame */ + for (i = 0; i < nlong; i+=4) + { + overlap[i] = MUL_F(transf_buf[nlong+i],window_long[nlong-1-i]); + overlap[i+1] = MUL_F(transf_buf[nlong+i+1],window_long[nlong-2-i]); + overlap[i+2] = MUL_F(transf_buf[nlong+i+2],window_long[nlong-3-i]); + overlap[i+3] = MUL_F(transf_buf[nlong+i+3],window_long[nlong-4-i]); + } + break; + + case LONG_START_SEQUENCE: + /* perform iMDCT */ + imdct_long(fb, freq_in, transf_buf, 2*nlong); + + /* add second half output of previous frame to windowed output of current frame */ + for (i = 0; i < nlong; i+=4) + { + time_out[i] = overlap[i] + MUL_F(transf_buf[i],window_long_prev[i]); + time_out[i+1] = overlap[i+1] + MUL_F(transf_buf[i+1],window_long_prev[i+1]); + time_out[i+2] = overlap[i+2] + MUL_F(transf_buf[i+2],window_long_prev[i+2]); + time_out[i+3] = overlap[i+3] + MUL_F(transf_buf[i+3],window_long_prev[i+3]); + } + + /* window the second half and save as overlap for next frame */ + /* construct second half window using padding with 1's and 0's */ + for (i = 0; i < nflat_ls; i++) + overlap[i] = transf_buf[nlong+i]; + for (i = 0; i < nshort; i++) + overlap[nflat_ls+i] = MUL_F(transf_buf[nlong+nflat_ls+i],window_short[nshort-i-1]); + for (i = 0; i < nflat_ls; i++) + overlap[nflat_ls+nshort+i] = 0; + break; + + case EIGHT_SHORT_SEQUENCE: + /* perform iMDCT for each short block */ + faad_imdct(fb->mdct256, freq_in+0*nshort, transf_buf+2*nshort*0); + faad_imdct(fb->mdct256, freq_in+1*nshort, transf_buf+2*nshort*1); + faad_imdct(fb->mdct256, freq_in+2*nshort, transf_buf+2*nshort*2); + faad_imdct(fb->mdct256, freq_in+3*nshort, transf_buf+2*nshort*3); + faad_imdct(fb->mdct256, freq_in+4*nshort, transf_buf+2*nshort*4); + faad_imdct(fb->mdct256, freq_in+5*nshort, transf_buf+2*nshort*5); + faad_imdct(fb->mdct256, freq_in+6*nshort, transf_buf+2*nshort*6); + faad_imdct(fb->mdct256, freq_in+7*nshort, transf_buf+2*nshort*7); + + /* add second half output of previous frame to windowed output of current frame */ + for (i = 0; i < nflat_ls; i++) + time_out[i] = overlap[i]; + for(i = 0; i < nshort; i++) + { + time_out[nflat_ls+ i] = overlap[nflat_ls+ i] + MUL_F(transf_buf[nshort*0+i],window_short_prev[i]); + time_out[nflat_ls+1*nshort+i] = overlap[nflat_ls+nshort*1+i] + MUL_F(transf_buf[nshort*1+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*2+i],window_short[i]); + time_out[nflat_ls+2*nshort+i] = overlap[nflat_ls+nshort*2+i] + MUL_F(transf_buf[nshort*3+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*4+i],window_short[i]); + time_out[nflat_ls+3*nshort+i] = overlap[nflat_ls+nshort*3+i] + MUL_F(transf_buf[nshort*5+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*6+i],window_short[i]); + if (i < trans) + time_out[nflat_ls+4*nshort+i] = overlap[nflat_ls+nshort*4+i] + MUL_F(transf_buf[nshort*7+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*8+i],window_short[i]); + } + + /* window the second half and save as overlap for next frame */ + for(i = 0; i < nshort; i++) + { + if (i >= trans) + overlap[nflat_ls+4*nshort+i-nlong] = MUL_F(transf_buf[nshort*7+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*8+i],window_short[i]); + overlap[nflat_ls+5*nshort+i-nlong] = MUL_F(transf_buf[nshort*9+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*10+i],window_short[i]); + overlap[nflat_ls+6*nshort+i-nlong] = MUL_F(transf_buf[nshort*11+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*12+i],window_short[i]); + overlap[nflat_ls+7*nshort+i-nlong] = MUL_F(transf_buf[nshort*13+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*14+i],window_short[i]); + overlap[nflat_ls+8*nshort+i-nlong] = MUL_F(transf_buf[nshort*15+i],window_short[nshort-1-i]); + } + for (i = 0; i < nflat_ls; i++) + overlap[nflat_ls+nshort+i] = 0; + break; + + case LONG_STOP_SEQUENCE: + /* perform iMDCT */ + imdct_long(fb, freq_in, transf_buf, 2*nlong); + + /* add second half output of previous frame to windowed output of current frame */ + /* construct first half window using padding with 1's and 0's */ + for (i = 0; i < nflat_ls; i++) + time_out[i] = overlap[i]; + for (i = 0; i < nshort; i++) + time_out[nflat_ls+i] = overlap[nflat_ls+i] + MUL_F(transf_buf[nflat_ls+i],window_short_prev[i]); + for (i = 0; i < nflat_ls; i++) + time_out[nflat_ls+nshort+i] = overlap[nflat_ls+nshort+i] + transf_buf[nflat_ls+nshort+i]; + + /* window the second half and save as overlap for next frame */ + for (i = 0; i < nlong; i++) + overlap[i] = MUL_F(transf_buf[nlong+i],window_long[nlong-1-i]); + break; + } + +#if 0 + for (i = 0; i < 1024; i++) + { + printf("%d\n", time_out[i]); + //printf("0x%.8X\n", time_out[i]); + } +#endif + + +#ifdef PROFILE + count = faad_get_ts() - count; + fb->cycles += count; +#endif +} + + +#ifdef LTP_DEC +/* only works for LTP -> no overlapping, no short blocks */ +void filter_bank_ltp(fb_info *fb, uint8_t window_sequence, uint8_t window_shape, + uint8_t window_shape_prev, real_t *in_data, real_t *out_mdct, + uint8_t object_type, uint16_t frame_len) +{ + int16_t i; + ALIGN real_t windowed_buf[2*1024] = {0}; + + const real_t *window_long = NULL; + const real_t *window_long_prev = NULL; + const real_t *window_short = NULL; + const real_t *window_short_prev = NULL; + + uint16_t nlong = frame_len; + uint16_t nshort = frame_len/8; + uint16_t nflat_ls = (nlong-nshort)/2; + + assert(window_sequence != EIGHT_SHORT_SEQUENCE); + +#ifdef LD_DEC + if (object_type == LD) + { + window_long = fb->ld_window[window_shape]; + window_long_prev = fb->ld_window[window_shape_prev]; + } else { +#endif + window_long = fb->long_window[window_shape]; + window_long_prev = fb->long_window[window_shape_prev]; + window_short = fb->short_window[window_shape]; + window_short_prev = fb->short_window[window_shape_prev]; +#ifdef LD_DEC + } +#endif + + switch(window_sequence) + { + case ONLY_LONG_SEQUENCE: + for (i = nlong-1; i >= 0; i--) + { + windowed_buf[i] = MUL_F(in_data[i], window_long_prev[i]); + windowed_buf[i+nlong] = MUL_F(in_data[i+nlong], window_long[nlong-1-i]); + } + mdct(fb, windowed_buf, out_mdct, 2*nlong); + break; + + case LONG_START_SEQUENCE: + for (i = 0; i < nlong; i++) + windowed_buf[i] = MUL_F(in_data[i], window_long_prev[i]); + for (i = 0; i < nflat_ls; i++) + windowed_buf[i+nlong] = in_data[i+nlong]; + for (i = 0; i < nshort; i++) + windowed_buf[i+nlong+nflat_ls] = MUL_F(in_data[i+nlong+nflat_ls], window_short[nshort-1-i]); + for (i = 0; i < nflat_ls; i++) + windowed_buf[i+nlong+nflat_ls+nshort] = 0; + mdct(fb, windowed_buf, out_mdct, 2*nlong); + break; + + case LONG_STOP_SEQUENCE: + for (i = 0; i < nflat_ls; i++) + windowed_buf[i] = 0; + for (i = 0; i < nshort; i++) + windowed_buf[i+nflat_ls] = MUL_F(in_data[i+nflat_ls], window_short_prev[i]); + for (i = 0; i < nflat_ls; i++) + windowed_buf[i+nflat_ls+nshort] = in_data[i+nflat_ls+nshort]; + for (i = 0; i < nlong; i++) + windowed_buf[i+nlong] = MUL_F(in_data[i+nlong], window_long[nlong-1-i]); + mdct(fb, windowed_buf, out_mdct, 2*nlong); + break; + } +} +#endif diff --git a/Libraries/FAAD2/Files/libfaad/filtbank.h b/Libraries/FAAD2/Files/libfaad/filtbank.h new file mode 100644 index 000000000..522756607 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/filtbank.h @@ -0,0 +1,58 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#ifndef __FILTBANK_H__ +#define __FILTBANK_H__ + +#ifdef __cplusplus +extern "C" { +#endif + + +fb_info *filter_bank_init(uint16_t frame_len); +void filter_bank_end(fb_info *fb); + +#ifdef LTP_DEC +void filter_bank_ltp(fb_info *fb, + uint8_t window_sequence, + uint8_t window_shape, + uint8_t window_shape_prev, + real_t *in_data, + real_t *out_mdct, + uint8_t object_type, + uint16_t frame_len); +#endif + +void ifilter_bank(fb_info *fb, uint8_t window_sequence, uint8_t window_shape, + uint8_t window_shape_prev, real_t *freq_in, + real_t *time_out, real_t *overlap, + uint8_t object_type, uint16_t frame_len); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/Libraries/FAAD2/Files/libfaad/fixed.h b/Libraries/FAAD2/Files/libfaad/fixed.h new file mode 100644 index 000000000..ac916ba0b --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/fixed.h @@ -0,0 +1,265 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#ifndef __FIXED_H__ +#define __FIXED_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(_WIN32_WCE) && defined(_ARM_) +#include +#endif + +#define COEF_BITS 28 +#define COEF_PRECISION (1 << COEF_BITS) +#define REAL_BITS 14 // MAXIMUM OF 14 FOR FIXED POINT SBR +#define REAL_PRECISION (1 << REAL_BITS) + +/* FRAC is the fractional only part of the fixed point number [0.0..1.0) */ +#define FRAC_SIZE 32 /* frac is a 32 bit integer */ +#define FRAC_BITS 31 +#define FRAC_PRECISION ((uint32_t)(1 << FRAC_BITS)) +#define FRAC_MAX 0x7FFFFFFF + +typedef int32_t real_t; + + +#define REAL_CONST(A) (((A) >= 0) ? ((real_t)((A)*(REAL_PRECISION)+0.5)) : ((real_t)((A)*(REAL_PRECISION)-0.5))) +#define COEF_CONST(A) (((A) >= 0) ? ((real_t)((A)*(COEF_PRECISION)+0.5)) : ((real_t)((A)*(COEF_PRECISION)-0.5))) +#define FRAC_CONST(A) (((A) == 1.00) ? ((real_t)FRAC_MAX) : (((A) >= 0) ? ((real_t)((A)*(FRAC_PRECISION)+0.5)) : ((real_t)((A)*(FRAC_PRECISION)-0.5)))) +//#define FRAC_CONST(A) (((A) >= 0) ? ((real_t)((A)*(FRAC_PRECISION)+0.5)) : ((real_t)((A)*(FRAC_PRECISION)-0.5))) + +#define Q2_BITS 22 +#define Q2_PRECISION (1 << Q2_BITS) +#define Q2_CONST(A) (((A) >= 0) ? ((real_t)((A)*(Q2_PRECISION)+0.5)) : ((real_t)((A)*(Q2_PRECISION)-0.5))) + +#if defined(_WIN32) && !defined(_WIN32_WCE) + +/* multiply with real shift */ +static INLINE real_t MUL_R(real_t A, real_t B) +{ + _asm { + mov eax,A + imul B + shrd eax,edx,REAL_BITS + } +} + +/* multiply with coef shift */ +static INLINE real_t MUL_C(real_t A, real_t B) +{ + _asm { + mov eax,A + imul B + shrd eax,edx,COEF_BITS + } +} + +static INLINE real_t MUL_Q2(real_t A, real_t B) +{ + _asm { + mov eax,A + imul B + shrd eax,edx,Q2_BITS + } +} + +static INLINE real_t MUL_SHIFT6(real_t A, real_t B) +{ + _asm { + mov eax,A + imul B + shrd eax,edx,6 + } +} + +static INLINE real_t MUL_SHIFT23(real_t A, real_t B) +{ + _asm { + mov eax,A + imul B + shrd eax,edx,23 + } +} + +#if 1 +static INLINE real_t _MulHigh(real_t A, real_t B) +{ + _asm { + mov eax,A + imul B + mov eax,edx + } +} + +/* multiply with fractional shift */ +static INLINE real_t MUL_F(real_t A, real_t B) +{ + return _MulHigh(A,B) << (FRAC_SIZE-FRAC_BITS); +} + +/* Complex multiplication */ +static INLINE void ComplexMult(real_t *y1, real_t *y2, + real_t x1, real_t x2, real_t c1, real_t c2) +{ + *y1 = (_MulHigh(x1, c1) + _MulHigh(x2, c2))<<(FRAC_SIZE-FRAC_BITS); + *y2 = (_MulHigh(x2, c1) - _MulHigh(x1, c2))<<(FRAC_SIZE-FRAC_BITS); +} +#else +static INLINE real_t MUL_F(real_t A, real_t B) +{ + _asm { + mov eax,A + imul B + shrd eax,edx,FRAC_BITS + } +} + +/* Complex multiplication */ +static INLINE void ComplexMult(real_t *y1, real_t *y2, + real_t x1, real_t x2, real_t c1, real_t c2) +{ + *y1 = MUL_F(x1, c1) + MUL_F(x2, c2); + *y2 = MUL_F(x2, c1) - MUL_F(x1, c2); +} +#endif + +#elif defined(__GNUC__) && defined (__arm__) + +/* taken from MAD */ +#define arm_mul(x, y, SCALEBITS) \ +({ \ + uint32_t __hi; \ + uint32_t __lo; \ + uint32_t __result; \ + asm("smull %0, %1, %3, %4\n\t" \ + "movs %0, %0, lsr %5\n\t" \ + "adc %2, %0, %1, lsl %6" \ + : "=&r" (__lo), "=&r" (__hi), "=r" (__result) \ + : "%r" (x), "r" (y), \ + "M" (SCALEBITS), "M" (32 - (SCALEBITS)) \ + : "cc"); \ + __result; \ +}) + +static INLINE real_t MUL_R(real_t A, real_t B) +{ + return arm_mul(A, B, REAL_BITS); +} + +static INLINE real_t MUL_C(real_t A, real_t B) +{ + return arm_mul(A, B, COEF_BITS); +} + +static INLINE real_t MUL_Q2(real_t A, real_t B) +{ + return arm_mul(A, B, Q2_BITS); +} + +static INLINE real_t MUL_SHIFT6(real_t A, real_t B) +{ + return arm_mul(A, B, 6); +} + +static INLINE real_t MUL_SHIFT23(real_t A, real_t B) +{ + return arm_mul(A, B, 23); +} + +static INLINE real_t _MulHigh(real_t x, real_t y) +{ + uint32_t __lo; + uint32_t __hi; + asm("smull\t%0, %1, %2, %3" + : "=&r"(__lo),"=&r"(__hi) + : "%r"(x),"r"(y) + : "cc"); + return __hi; +} + +static INLINE real_t MUL_F(real_t A, real_t B) +{ + return _MulHigh(A, B) << (FRAC_SIZE-FRAC_BITS); +} + +/* Complex multiplication */ +static INLINE void ComplexMult(real_t *y1, real_t *y2, + real_t x1, real_t x2, real_t c1, real_t c2) +{ + int32_t tmp, yt1, yt2; + asm("smull %0, %1, %4, %6\n\t" + "smlal %0, %1, %5, %7\n\t" + "rsb %3, %4, #0\n\t" + "smull %0, %2, %5, %6\n\t" + "smlal %0, %2, %3, %7" + : "=&r" (tmp), "=&r" (yt1), "=&r" (yt2), "=r" (x1) + : "3" (x1), "r" (x2), "r" (c1), "r" (c2) + : "cc" ); + *y1 = yt1 << (FRAC_SIZE-FRAC_BITS); + *y2 = yt2 << (FRAC_SIZE-FRAC_BITS); +} + +#else + + /* multiply with real shift */ + #define MUL_R(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (REAL_BITS-1))) >> REAL_BITS) + /* multiply with coef shift */ + #define MUL_C(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (COEF_BITS-1))) >> COEF_BITS) + /* multiply with fractional shift */ +#if defined(_WIN32_WCE) && defined(_ARM_) + /* eVC for PocketPC has an intrinsic function that returns only the high 32 bits of a 32x32 bit multiply */ + static INLINE real_t MUL_F(real_t A, real_t B) + { + return _MulHigh(A,B) << (32-FRAC_BITS); + } +#else + #define _MulHigh(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (FRAC_SIZE-1))) >> FRAC_SIZE) + #define MUL_F(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (FRAC_BITS-1))) >> FRAC_BITS) +#endif + #define MUL_Q2(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (Q2_BITS-1))) >> Q2_BITS) + #define MUL_SHIFT6(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (6-1))) >> 6) + #define MUL_SHIFT23(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (23-1))) >> 23) + +/* Complex multiplication */ +static INLINE void ComplexMult(real_t *y1, real_t *y2, + real_t x1, real_t x2, real_t c1, real_t c2) +{ + *y1 = (_MulHigh(x1, c1) + _MulHigh(x2, c2))<<(FRAC_SIZE-FRAC_BITS); + *y2 = (_MulHigh(x2, c1) - _MulHigh(x1, c2))<<(FRAC_SIZE-FRAC_BITS); +} + +#endif + + + +#ifdef __cplusplus +} +#endif +#endif diff --git a/Libraries/FAAD2/Files/libfaad/hcr.c b/Libraries/FAAD2/Files/libfaad/hcr.c new file mode 100644 index 000000000..a5e67bb85 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/hcr.c @@ -0,0 +1,409 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2004 G.C. Pascutto, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#include "common.h" +#include "structs.h" + +#include +#include + +#include "specrec.h" +#include "huffman.h" + +/* ISO/IEC 14496-3/Amd.1 + * 8.5.3.3: Huffman Codeword Reordering for AAC spectral data (HCR) + * + * HCR devides the spectral data in known fixed size segments, and + * sorts it by the importance of the data. The importance is firstly + * the (lower) position in the spectrum, and secondly the largest + * value in the used codebook. + * The most important data is written at the start of each segment + * (at known positions), the remaining data is interleaved inbetween, + * with the writing direction alternating. + * Data length is not increased. +*/ + +#ifdef ERROR_RESILIENCE + +/* 8.5.3.3.1 Pre-sorting */ + +#define NUM_CB 6 +#define NUM_CB_ER 22 +#define MAX_CB 32 +#define VCB11_FIRST 16 +#define VCB11_LAST 31 + +static const uint8_t PreSortCB_STD[NUM_CB] = + { 11, 9, 7, 5, 3, 1}; + +static const uint8_t PreSortCB_ER[NUM_CB_ER] = + { 11, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 9, 7, 5, 3, 1}; + +/* 8.5.3.3.2 Derivation of segment width */ + +static const uint8_t maxCwLen[MAX_CB] = {0, 11, 9, 20, 16, 13, 11, 14, 12, 17, 14, 49, + 0, 0, 0, 0, 14, 17, 21, 21, 25, 25, 29, 29, 29, 29, 33, 33, 33, 37, 37, 41}; + +#define segmentWidth(cb) min(maxCwLen[cb], ics->length_of_longest_codeword) + +/* bit-twiddling helpers */ +static const uint8_t S[] = {1, 2, 4, 8, 16}; +static const uint32_t B[] = {0x55555555, 0x33333333, 0x0F0F0F0F, 0x00FF00FF, 0x0000FFFF}; + +typedef struct +{ + uint8_t cb; + uint8_t decoded; + uint16_t sp_offset; + bits_t bits; +} codeword_t; + +/* rewind and reverse */ +/* 32 bit version */ +static uint32_t rewrev_word(uint32_t v, const uint8_t len) +{ + /* 32 bit reverse */ + v = ((v >> S[0]) & B[0]) | ((v << S[0]) & ~B[0]); + v = ((v >> S[1]) & B[1]) | ((v << S[1]) & ~B[1]); + v = ((v >> S[2]) & B[2]) | ((v << S[2]) & ~B[2]); + v = ((v >> S[3]) & B[3]) | ((v << S[3]) & ~B[3]); + v = ((v >> S[4]) & B[4]) | ((v << S[4]) & ~B[4]); + + /* shift off low bits */ + v >>= (32 - len); + + return v; +} + +/* 64 bit version */ +static void rewrev_lword(uint32_t *hi, uint32_t *lo, const uint8_t len) +{ + if (len <= 32) { + *hi = 0; + *lo = rewrev_word(*lo, len); + } else + { + uint32_t t = *hi, v = *lo; + + /* double 32 bit reverse */ + v = ((v >> S[0]) & B[0]) | ((v << S[0]) & ~B[0]); + t = ((t >> S[0]) & B[0]) | ((t << S[0]) & ~B[0]); + v = ((v >> S[1]) & B[1]) | ((v << S[1]) & ~B[1]); + t = ((t >> S[1]) & B[1]) | ((t << S[1]) & ~B[1]); + v = ((v >> S[2]) & B[2]) | ((v << S[2]) & ~B[2]); + t = ((t >> S[2]) & B[2]) | ((t << S[2]) & ~B[2]); + v = ((v >> S[3]) & B[3]) | ((v << S[3]) & ~B[3]); + t = ((t >> S[3]) & B[3]) | ((t << S[3]) & ~B[3]); + v = ((v >> S[4]) & B[4]) | ((v << S[4]) & ~B[4]); + t = ((t >> S[4]) & B[4]) | ((t << S[4]) & ~B[4]); + + /* last 32<>32 bit swap is implicit below */ + + /* shift off low bits (this is really only one 64 bit shift) */ + *lo = (t >> (64 - len)) | (v << (len - 32)); + *hi = v >> (64 - len); + } +} + + +/* bits_t version */ +static void rewrev_bits(bits_t *bits) +{ + if (bits->len == 0) return; + rewrev_lword(&bits->bufb, &bits->bufa, bits->len); +} + + +/* merge bits of a to b */ +static void concat_bits(bits_t *b, bits_t *a) +{ + uint32_t bl, bh, al, ah; + + if (a->len == 0) return; + + al = a->bufa; + ah = a->bufb; + + if (b->len > 32) + { + /* maskoff superfluous high b bits */ + bl = b->bufa; + bh = b->bufb & ((1 << (b->len-32)) - 1); + /* left shift a b->len bits */ + ah = al << (b->len - 32); + al = 0; + } else { + bl = b->bufa & ((1 << (b->len)) - 1); + bh = 0; + ah = (ah << (b->len)) | (al >> (32 - b->len)); + al = al << b->len; + } + + /* merge */ + b->bufa = bl | al; + b->bufb = bh | ah; + + b->len += a->len; +} + +uint8_t is_good_cb(uint8_t this_CB, uint8_t this_sec_CB) +{ + /* only want spectral data CB's */ + if ((this_sec_CB > ZERO_HCB && this_sec_CB <= ESC_HCB) || (this_sec_CB >= VCB11_FIRST && this_sec_CB <= VCB11_LAST)) + { + if (this_CB < ESC_HCB) + { + /* normal codebook pairs */ + return ((this_sec_CB == this_CB) || (this_sec_CB == this_CB + 1)); + } else + { + /* escape codebook */ + return (this_sec_CB == this_CB); + } + } + return 0; +} + +void read_segment(bits_t *segment, uint8_t segwidth, bitfile *ld) +{ + segment->len = segwidth; + + if (segwidth > 32) + { + segment->bufb = faad_getbits(ld, segwidth - 32); + segment->bufa = faad_getbits(ld, 32); + + } else { + segment->bufa = faad_getbits(ld, segwidth); + segment->bufb = 0; + } +} + +void fill_in_codeword(codeword_t *codeword, uint16_t index, uint16_t sp, uint8_t cb) +{ + codeword[index].sp_offset = sp; + codeword[index].cb = cb; + codeword[index].decoded = 0; + codeword[index].bits.len = 0; +} + +uint8_t reordered_spectral_data(NeAACDecHandle hDecoder, ic_stream *ics, + bitfile *ld, int16_t *spectral_data) +{ + uint16_t PCWs_done; + uint16_t numberOfSegments, numberOfSets, numberOfCodewords; + + codeword_t codeword[512]; + bits_t segment[512]; + + uint16_t sp_offset[8]; + uint16_t g, i, sortloop, set, bitsread; + uint8_t w_idx, sfb, this_CB, last_CB, this_sec_CB; + + const uint16_t nshort = hDecoder->frameLength/8; + const uint16_t sp_data_len = ics->length_of_reordered_spectral_data; + + const uint8_t *PreSortCb; + + /* no data (e.g. silence) */ + if (sp_data_len == 0) + return 0; + + /* since there is spectral data, at least one codeword has nonzero length */ + if (ics->length_of_longest_codeword == 0) + return 10; + + if (sp_data_len < ics->length_of_longest_codeword) + return 10; + + sp_offset[0] = 0; + for (g = 1; g < ics->num_window_groups; g++) + { + sp_offset[g] = sp_offset[g-1] + nshort*ics->window_group_length[g-1]; + } + + PCWs_done = 0; + numberOfSegments = 0; + numberOfCodewords = 0; + bitsread = 0; + + /* VCB11 code books in use */ + if (hDecoder->aacSectionDataResilienceFlag) + { + PreSortCb = PreSortCB_ER; + last_CB = NUM_CB_ER; + } else + { + PreSortCb = PreSortCB_STD; + last_CB = NUM_CB; + } + + /* step 1: decode PCW's (set 0), and stuff data in easier-to-use format */ + for (sortloop = 0; sortloop < last_CB; sortloop++) + { + /* select codebook to process this pass */ + this_CB = PreSortCb[sortloop]; + + /* loop over sfbs */ + for (sfb = 0; sfb < ics->max_sfb; sfb++) + { + /* loop over all in this sfb, 4 lines per loop */ + for (w_idx = 0; 4*w_idx < (ics->swb_offset[sfb+1] - ics->swb_offset[sfb]); w_idx++) + { + for(g = 0; g < ics->num_window_groups; g++) + { + for (i = 0; i < ics->num_sec[g]; i++) + { + /* check whether sfb used here is the one we want to process */ + if ((ics->sect_start[g][i] <= sfb) && (ics->sect_end[g][i] > sfb)) + { + /* check whether codebook used here is the one we want to process */ + this_sec_CB = ics->sect_cb[g][i]; + + if (is_good_cb(this_CB, this_sec_CB)) + { + /* precalculate some stuff */ + uint16_t sect_sfb_size = ics->sect_sfb_offset[g][sfb+1] - ics->sect_sfb_offset[g][sfb]; + uint8_t inc = (this_sec_CB < FIRST_PAIR_HCB) ? QUAD_LEN : PAIR_LEN; + uint16_t group_cws_count = (4*ics->window_group_length[g])/inc; + uint8_t segwidth = segmentWidth(this_sec_CB); + uint16_t cws; + + /* read codewords until end of sfb or end of window group (shouldn't only 1 trigger?) */ + for (cws = 0; (cws < group_cws_count) && ((cws + w_idx*group_cws_count) < sect_sfb_size); cws++) + { + uint16_t sp = sp_offset[g] + ics->sect_sfb_offset[g][sfb] + inc * (cws + w_idx*group_cws_count); + + /* read and decode PCW */ + if (!PCWs_done) + { + /* read in normal segments */ + if (bitsread + segwidth <= sp_data_len) + { + read_segment(&segment[numberOfSegments], segwidth, ld); + bitsread += segwidth; + + huffman_spectral_data_2(this_sec_CB, &segment[numberOfSegments], &spectral_data[sp]); + + /* keep leftover bits */ + rewrev_bits(&segment[numberOfSegments]); + + numberOfSegments++; + } else { + /* remaining stuff after last segment, we unfortunately couldn't read + this in earlier because it might not fit in 64 bits. since we already + decoded (and removed) the PCW it is now guaranteed to fit */ + if (bitsread < sp_data_len) + { + const uint8_t additional_bits = sp_data_len - bitsread; + + read_segment(&segment[numberOfSegments], additional_bits, ld); + segment[numberOfSegments].len += segment[numberOfSegments-1].len; + rewrev_bits(&segment[numberOfSegments]); + + if (segment[numberOfSegments-1].len > 32) + { + segment[numberOfSegments-1].bufb = segment[numberOfSegments].bufb + + showbits_hcr(&segment[numberOfSegments-1], segment[numberOfSegments-1].len - 32); + segment[numberOfSegments-1].bufa = segment[numberOfSegments].bufa + + showbits_hcr(&segment[numberOfSegments-1], 32); + } else { + segment[numberOfSegments-1].bufa = segment[numberOfSegments].bufa + + showbits_hcr(&segment[numberOfSegments-1], segment[numberOfSegments-1].len); + segment[numberOfSegments-1].bufb = segment[numberOfSegments].bufb; + } + segment[numberOfSegments-1].len += additional_bits; + } + bitsread = sp_data_len; + PCWs_done = 1; + + fill_in_codeword(codeword, 0, sp, this_sec_CB); + } + } else { + fill_in_codeword(codeword, numberOfCodewords - numberOfSegments, sp, this_sec_CB); + } + numberOfCodewords++; + } + } + } + } + } + } + } + } + + if (numberOfSegments == 0) + return 10; + + numberOfSets = numberOfCodewords / numberOfSegments; + + /* step 2: decode nonPCWs */ + for (set = 1; set <= numberOfSets; set++) + { + uint16_t trial; + + for (trial = 0; trial < numberOfSegments; trial++) + { + uint16_t codewordBase; + + for (codewordBase = 0; codewordBase < numberOfSegments; codewordBase++) + { + const uint16_t segment_idx = (trial + codewordBase) % numberOfSegments; + const uint16_t codeword_idx = codewordBase + set*numberOfSegments - numberOfSegments; + + /* data up */ + if (codeword_idx >= numberOfCodewords - numberOfSegments) break; + + if (!codeword[codeword_idx].decoded && segment[segment_idx].len > 0) + { + uint8_t tmplen; + + if (codeword[codeword_idx].bits.len != 0) + concat_bits(&segment[segment_idx], &codeword[codeword_idx].bits); + + tmplen = segment[segment_idx].len; + + if (huffman_spectral_data_2(codeword[codeword_idx].cb, &segment[segment_idx], + &spectral_data[codeword[codeword_idx].sp_offset]) >= 0) + { + codeword[codeword_idx].decoded = 1; + } else + { + codeword[codeword_idx].bits = segment[segment_idx]; + codeword[codeword_idx].bits.len = tmplen; + } + + } + } + } + for (i = 0; i < numberOfSegments; i++) + rewrev_bits(&segment[i]); + } + + return 0; +} +#endif diff --git a/Libraries/FAAD2/Files/libfaad/huffman.c b/Libraries/FAAD2/Files/libfaad/huffman.c new file mode 100644 index 000000000..d1cc0660c --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/huffman.c @@ -0,0 +1,556 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#include "common.h" +#include "structs.h" + +#include +#ifdef ANALYSIS +#include +#endif + +#include "bits.h" +#include "huffman.h" +#include "codebook/hcb.h" + + +/* static function declarations */ +static INLINE void huffman_sign_bits(bitfile *ld, int16_t *sp, uint8_t len); +static INLINE int16_t huffman_getescape(bitfile *ld, int16_t sp); +static uint8_t huffman_2step_quad(uint8_t cb, bitfile *ld, int16_t *sp); +static uint8_t huffman_2step_quad_sign(uint8_t cb, bitfile *ld, int16_t *sp); +static uint8_t huffman_2step_pair(uint8_t cb, bitfile *ld, int16_t *sp); +static uint8_t huffman_2step_pair_sign(uint8_t cb, bitfile *ld, int16_t *sp); +static uint8_t huffman_binary_quad(uint8_t cb, bitfile *ld, int16_t *sp); +static uint8_t huffman_binary_quad_sign(uint8_t cb, bitfile *ld, int16_t *sp); +static uint8_t huffman_binary_pair(uint8_t cb, bitfile *ld, int16_t *sp); +static uint8_t huffman_binary_pair_sign(uint8_t cb, bitfile *ld, int16_t *sp); +static int16_t huffman_codebook(uint8_t i); +static void vcb11_check_LAV(uint8_t cb, int16_t *sp); + +int8_t huffman_scale_factor(bitfile *ld) +{ + uint16_t offset = 0; + + while (hcb_sf[offset][1]) + { + uint8_t b = faad_get1bit(ld + DEBUGVAR(1,255,"huffman_scale_factor()")); + offset += hcb_sf[offset][b]; + + if (offset > 240) + { + /* printf("ERROR: offset into hcb_sf = %d >240!\n", offset); */ + return -1; + } + } + + return hcb_sf[offset][0]; +} + + +hcb *hcb_table[] = { + 0, hcb1_1, hcb2_1, 0, hcb4_1, 0, hcb6_1, 0, hcb8_1, 0, hcb10_1, hcb11_1 +}; + +hcb_2_quad *hcb_2_quad_table[] = { + 0, hcb1_2, hcb2_2, 0, hcb4_2, 0, 0, 0, 0, 0, 0, 0 +}; + +hcb_2_pair *hcb_2_pair_table[] = { + 0, 0, 0, 0, 0, 0, hcb6_2, 0, hcb8_2, 0, hcb10_2, hcb11_2 +}; + +hcb_bin_pair *hcb_bin_table[] = { + 0, 0, 0, 0, 0, hcb5, 0, hcb7, 0, hcb9, 0, 0 +}; + +uint8_t hcbN[] = { 0, 5, 5, 0, 5, 0, 5, 0, 5, 0, 6, 5 }; + +/* defines whether a huffman codebook is unsigned or not */ +/* Table 4.6.2 */ +uint8_t unsigned_cb[] = { 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, + /* codebook 16 to 31 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 +}; + +int hcb_2_quad_table_size[] = { 0, 114, 86, 0, 185, 0, 0, 0, 0, 0, 0, 0 }; +int hcb_2_pair_table_size[] = { 0, 0, 0, 0, 0, 0, 126, 0, 83, 0, 210, 373 }; +int hcb_bin_table_size[] = { 0, 0, 0, 161, 0, 161, 0, 127, 0, 337, 0, 0 }; + +static INLINE void huffman_sign_bits(bitfile *ld, int16_t *sp, uint8_t len) +{ + uint8_t i; + + for (i = 0; i < len; i++) + { + if(sp[i]) + { + if(faad_get1bit(ld + DEBUGVAR(1,5,"huffman_sign_bits(): sign bit")) & 1) + { + sp[i] = -sp[i]; + } + } + } +} + +static INLINE int16_t huffman_getescape(bitfile *ld, int16_t sp) +{ + uint8_t neg, i; + int16_t j; + int16_t off; + + if (sp < 0) + { + if (sp != -16) + return sp; + neg = 1; + } else { + if (sp != 16) + return sp; + neg = 0; + } + + for (i = 4; ; i++) + { + if (faad_get1bit(ld + DEBUGVAR(1,6,"huffman_getescape(): escape size")) == 0) + { + break; + } + } + + off = (int16_t)faad_getbits(ld, i + DEBUGVAR(1,9,"huffman_getescape(): escape")); + + j = off | (1< hcb_2_quad_table_size[cb]) + { + /* printf("ERROR: offset into hcb_2_quad_table = %d >%d!\n", offset, + hcb_2_quad_table_size[cb]); */ + return 10; + } + + sp[0] = hcb_2_quad_table[cb][offset].x; + sp[1] = hcb_2_quad_table[cb][offset].y; + sp[2] = hcb_2_quad_table[cb][offset].v; + sp[3] = hcb_2_quad_table[cb][offset].w; + + return 0; +} + +static uint8_t huffman_2step_quad_sign(uint8_t cb, bitfile *ld, int16_t *sp) +{ + uint8_t err = huffman_2step_quad(cb, ld, sp); + huffman_sign_bits(ld, sp, QUAD_LEN); + + return err; +} + +static uint8_t huffman_2step_pair(uint8_t cb, bitfile *ld, int16_t *sp) +{ + uint32_t cw; + uint16_t offset = 0; + uint8_t extra_bits; + + cw = faad_showbits(ld, hcbN[cb]); + offset = hcb_table[cb][cw].offset; + extra_bits = hcb_table[cb][cw].extra_bits; + + if (extra_bits) + { + /* we know for sure it's more than hcbN[cb] bits long */ + faad_flushbits(ld, hcbN[cb]); + offset += (uint16_t)faad_showbits(ld, extra_bits); + faad_flushbits(ld, hcb_2_pair_table[cb][offset].bits - hcbN[cb]); + } else { + faad_flushbits(ld, hcb_2_pair_table[cb][offset].bits); + } + + if (offset > hcb_2_pair_table_size[cb]) + { + /* printf("ERROR: offset into hcb_2_pair_table = %d >%d!\n", offset, + hcb_2_pair_table_size[cb]); */ + return 10; + } + + sp[0] = hcb_2_pair_table[cb][offset].x; + sp[1] = hcb_2_pair_table[cb][offset].y; + + return 0; +} + +static uint8_t huffman_2step_pair_sign(uint8_t cb, bitfile *ld, int16_t *sp) +{ + uint8_t err = huffman_2step_pair(cb, ld, sp); + huffman_sign_bits(ld, sp, PAIR_LEN); + + return err; +} + +static uint8_t huffman_binary_quad(uint8_t cb, bitfile *ld, int16_t *sp) +{ + uint16_t offset = 0; + + while (!hcb3[offset].is_leaf) + { + uint8_t b = faad_get1bit(ld + DEBUGVAR(1,255,"huffman_spectral_data():3")); + offset += hcb3[offset].data[b]; + } + + if (offset > hcb_bin_table_size[cb]) + { + /* printf("ERROR: offset into hcb_bin_table = %d >%d!\n", offset, + hcb_bin_table_size[cb]); */ + return 10; + } + + sp[0] = hcb3[offset].data[0]; + sp[1] = hcb3[offset].data[1]; + sp[2] = hcb3[offset].data[2]; + sp[3] = hcb3[offset].data[3]; + + return 0; +} + +static uint8_t huffman_binary_quad_sign(uint8_t cb, bitfile *ld, int16_t *sp) +{ + uint8_t err = huffman_binary_quad(cb, ld, sp); + huffman_sign_bits(ld, sp, QUAD_LEN); + + return err; +} + +static uint8_t huffman_binary_pair(uint8_t cb, bitfile *ld, int16_t *sp) +{ + uint16_t offset = 0; + + while (!hcb_bin_table[cb][offset].is_leaf) + { + uint8_t b = faad_get1bit(ld + DEBUGVAR(1,255,"huffman_spectral_data():9")); + offset += hcb_bin_table[cb][offset].data[b]; + } + + if (offset > hcb_bin_table_size[cb]) + { + /* printf("ERROR: offset into hcb_bin_table = %d >%d!\n", offset, + hcb_bin_table_size[cb]); */ + return 10; + } + + sp[0] = hcb_bin_table[cb][offset].data[0]; + sp[1] = hcb_bin_table[cb][offset].data[1]; + + return 0; +} + +static uint8_t huffman_binary_pair_sign(uint8_t cb, bitfile *ld, int16_t *sp) +{ + uint8_t err = huffman_binary_pair(cb, ld, sp); + huffman_sign_bits(ld, sp, PAIR_LEN); + + return err; +} + +static int16_t huffman_codebook(uint8_t i) +{ + static const uint32_t data = 16428320; + if (i == 0) return (int16_t)(data >> 16) & 0xFFFF; + else return (int16_t)data & 0xFFFF; +} + +static void vcb11_check_LAV(uint8_t cb, int16_t *sp) +{ + static const uint16_t vcb11_LAV_tab[] = { + 16, 31, 47, 63, 95, 127, 159, 191, 223, + 255, 319, 383, 511, 767, 1023, 2047 + }; + uint16_t max = 0; + + if (cb < 16 || cb > 31) + return; + + max = vcb11_LAV_tab[cb - 16]; + + if ((abs(sp[0]) > max) || (abs(sp[1]) > max)) + { + sp[0] = 0; + sp[1] = 0; + } +} + +uint8_t huffman_spectral_data(uint8_t cb, bitfile *ld, int16_t *sp) +{ + switch (cb) + { + case 1: /* 2-step method for data quadruples */ + case 2: + return huffman_2step_quad(cb, ld, sp); + case 3: /* binary search for data quadruples */ + return huffman_binary_quad_sign(cb, ld, sp); + case 4: /* 2-step method for data quadruples */ + return huffman_2step_quad_sign(cb, ld, sp); + case 5: /* binary search for data pairs */ + return huffman_binary_pair(cb, ld, sp); + case 6: /* 2-step method for data pairs */ + return huffman_2step_pair(cb, ld, sp); + case 7: /* binary search for data pairs */ + case 9: + return huffman_binary_pair_sign(cb, ld, sp); + case 8: /* 2-step method for data pairs */ + case 10: + return huffman_2step_pair_sign(cb, ld, sp); + case 12: { + uint8_t err = huffman_2step_pair(11, ld, sp); + sp[0] = huffman_codebook(0); sp[1] = huffman_codebook(1); + return err; } + case 11: + { + uint8_t err = huffman_2step_pair_sign(11, ld, sp); + sp[0] = huffman_getescape(ld, sp[0]); + sp[1] = huffman_getescape(ld, sp[1]); + return err; + } +#ifdef ERROR_RESILIENCE + /* VCB11 uses codebook 11 */ + case 16: case 17: case 18: case 19: case 20: case 21: case 22: case 23: + case 24: case 25: case 26: case 27: case 28: case 29: case 30: case 31: + { + uint8_t err = huffman_2step_pair_sign(11, ld, sp); + sp[0] = huffman_getescape(ld, sp[0]); + sp[1] = huffman_getescape(ld, sp[1]); + + /* check LAV (Largest Absolute Value) */ + /* this finds errors in the ESCAPE signal */ + vcb11_check_LAV(cb, sp); + + return err; + } +#endif + default: + /* Non existent codebook number, something went wrong */ + return 11; + } + + return 0; +} + + +#ifdef ERROR_RESILIENCE + +/* Special version of huffman_spectral_data +Will not read from a bitfile but a bits_t structure. +Will keep track of the bits decoded and return the number of bits remaining. +Do not read more than ld->len, return -1 if codeword would be longer */ + +int8_t huffman_spectral_data_2(uint8_t cb, bits_t *ld, int16_t *sp) +{ + uint32_t cw; + uint16_t offset = 0; + uint8_t extra_bits; + uint8_t i, vcb11 = 0; + + + switch (cb) + { + case 1: /* 2-step method for data quadruples */ + case 2: + case 4: + + cw = showbits_hcr(ld, hcbN[cb]); + offset = hcb_table[cb][cw].offset; + extra_bits = hcb_table[cb][cw].extra_bits; + + if (extra_bits) + { + /* we know for sure it's more than hcbN[cb] bits long */ + if ( flushbits_hcr(ld, hcbN[cb]) ) return -1; + offset += (uint16_t)showbits_hcr(ld, extra_bits); + if ( flushbits_hcr(ld, hcb_2_quad_table[cb][offset].bits - hcbN[cb]) ) return -1; + } else { + if ( flushbits_hcr(ld, hcb_2_quad_table[cb][offset].bits) ) return -1; + } + + sp[0] = hcb_2_quad_table[cb][offset].x; + sp[1] = hcb_2_quad_table[cb][offset].y; + sp[2] = hcb_2_quad_table[cb][offset].v; + sp[3] = hcb_2_quad_table[cb][offset].w; + break; + + case 6: /* 2-step method for data pairs */ + case 8: + case 10: + case 11: + /* VCB11 uses codebook 11 */ + case 16: case 17: case 18: case 19: case 20: case 21: case 22: case 23: + case 24: case 25: case 26: case 27: case 28: case 29: case 30: case 31: + + if (cb >= 16) + { + /* store the virtual codebook */ + vcb11 = cb; + cb = 11; + } + + cw = showbits_hcr(ld, hcbN[cb]); + offset = hcb_table[cb][cw].offset; + extra_bits = hcb_table[cb][cw].extra_bits; + + if (extra_bits) + { + /* we know for sure it's more than hcbN[cb] bits long */ + if ( flushbits_hcr(ld, hcbN[cb]) ) return -1; + offset += (uint16_t)showbits_hcr(ld, extra_bits); + if ( flushbits_hcr(ld, hcb_2_pair_table[cb][offset].bits - hcbN[cb]) ) return -1; + } else { + if ( flushbits_hcr(ld, hcb_2_pair_table[cb][offset].bits) ) return -1; + } + sp[0] = hcb_2_pair_table[cb][offset].x; + sp[1] = hcb_2_pair_table[cb][offset].y; + break; + + case 3: /* binary search for data quadruples */ + + while (!hcb3[offset].is_leaf) + { + uint8_t b; + + if ( get1bit_hcr(ld, &b) ) return -1; + offset += hcb3[offset].data[b]; + } + + sp[0] = hcb3[offset].data[0]; + sp[1] = hcb3[offset].data[1]; + sp[2] = hcb3[offset].data[2]; + sp[3] = hcb3[offset].data[3]; + + break; + + case 5: /* binary search for data pairs */ + case 7: + case 9: + + while (!hcb_bin_table[cb][offset].is_leaf) + { + uint8_t b; + + if (get1bit_hcr(ld, &b) ) return -1; + offset += hcb_bin_table[cb][offset].data[b]; + } + + sp[0] = hcb_bin_table[cb][offset].data[0]; + sp[1] = hcb_bin_table[cb][offset].data[1]; + + break; + } + + /* decode sign bits */ + if (unsigned_cb[cb]) + { + for(i = 0; i < ((cb < FIRST_PAIR_HCB) ? QUAD_LEN : PAIR_LEN); i++) + { + if(sp[i]) + { + uint8_t b; + if ( get1bit_hcr(ld, &b) ) return -1; + if (b != 0) { + sp[i] = -sp[i]; + } + } + } + } + + /* decode huffman escape bits */ + if ((cb == ESC_HCB) || (cb >= 16)) + { + uint8_t k; + for (k = 0; k < 2; k++) + { + if ((sp[k] == 16) || (sp[k] == -16)) + { + uint8_t neg, i; + int32_t j; + uint32_t off; + + neg = (sp[k] < 0) ? 1 : 0; + + for (i = 4; ; i++) + { + uint8_t b; + if (get1bit_hcr(ld, &b)) + return -1; + if (b == 0) + break; + } + + if (getbits_hcr(ld, i, &off)) + return -1; + j = off + (1<len; +} + +#endif + diff --git a/Libraries/FAAD2/Files/libfaad/huffman.h b/Libraries/FAAD2/Files/libfaad/huffman.h new file mode 100644 index 000000000..683689002 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/huffman.h @@ -0,0 +1,44 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#ifndef __HUFFMAN_H__ +#define __HUFFMAN_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +int8_t huffman_scale_factor(bitfile *ld); +uint8_t huffman_spectral_data(uint8_t cb, bitfile *ld, int16_t *sp); +#ifdef ERROR_RESILIENCE +int8_t huffman_spectral_data_2(uint8_t cb, bits_t *ld, int16_t *sp); +#endif + +#ifdef __cplusplus +} +#endif +#endif diff --git a/Libraries/FAAD2/Files/libfaad/ic_predict.c b/Libraries/FAAD2/Files/libfaad/ic_predict.c new file mode 100644 index 000000000..02cadd65b --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/ic_predict.c @@ -0,0 +1,267 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#include "common.h" +#include "structs.h" + +#ifdef MAIN_DEC + +#include "syntax.h" +#include "ic_predict.h" +#include "pns.h" + + +static void flt_round(float32_t *pf) +{ + int32_t flg; + uint32_t tmp, tmp1, tmp2; + + tmp = *(uint32_t*)pf; + flg = tmp & (uint32_t)0x00008000; + tmp &= (uint32_t)0xffff0000; + tmp1 = tmp; + /* round 1/2 lsb toward infinity */ + if (flg) + { + tmp &= (uint32_t)0xff800000; /* extract exponent and sign */ + tmp |= (uint32_t)0x00010000; /* insert 1 lsb */ + tmp2 = tmp; /* add 1 lsb and elided one */ + tmp &= (uint32_t)0xff800000; /* extract exponent and sign */ + + *pf = *(float32_t*)&tmp1 + *(float32_t*)&tmp2 - *(float32_t*)&tmp; + } else { + *pf = *(float32_t*)&tmp; + } +} + +static int16_t quant_pred(float32_t x) +{ + int16_t q; + uint32_t *tmp = (uint32_t*)&x; + + q = (int16_t)(*tmp>>16); + + return q; +} + +static float32_t inv_quant_pred(int16_t q) +{ + float32_t x; + uint32_t *tmp = (uint32_t*)&x; + *tmp = ((uint32_t)q)<<16; + + return x; +} + +static void ic_predict(pred_state *state, real_t input, real_t *output, uint8_t pred) +{ + uint16_t tmp; + int16_t i, j; + real_t dr1, predictedvalue; + real_t e0, e1; + real_t k1, k2; + + real_t r[2]; + real_t COR[2]; + real_t VAR[2]; + + r[0] = inv_quant_pred(state->r[0]); + r[1] = inv_quant_pred(state->r[1]); + COR[0] = inv_quant_pred(state->COR[0]); + COR[1] = inv_quant_pred(state->COR[1]); + VAR[0] = inv_quant_pred(state->VAR[0]); + VAR[1] = inv_quant_pred(state->VAR[1]); + + +#if 1 + tmp = state->VAR[0]; + j = (tmp >> 7); + i = tmp & 0x7f; + if (j >= 128) + { + j -= 128; + k1 = COR[0] * exp_table[j] * mnt_table[i]; + } else { + k1 = REAL_CONST(0); + } +#else + + { +#define B 0.953125 + real_t c = COR[0]; + real_t v = VAR[0]; + real_t tmp; + if (c == 0 || v <= 1) + { + k1 = 0; + } else { + tmp = B / v; + flt_round(&tmp); + k1 = c * tmp; + } + } +#endif + + if (pred) + { +#if 1 + tmp = state->VAR[1]; + j = (tmp >> 7); + i = tmp & 0x7f; + if (j >= 128) + { + j -= 128; + k2 = COR[1] * exp_table[j] * mnt_table[i]; + } else { + k2 = REAL_CONST(0); + } +#else + +#define B 0.953125 + real_t c = COR[1]; + real_t v = VAR[1]; + real_t tmp; + if (c == 0 || v <= 1) + { + k2 = 0; + } else { + tmp = B / v; + flt_round(&tmp); + k2 = c * tmp; + } +#endif + + predictedvalue = k1*r[0] + k2*r[1]; + flt_round(&predictedvalue); + *output = input + predictedvalue; + } + + /* calculate new state data */ + e0 = *output; + e1 = e0 - k1*r[0]; + dr1 = k1*e0; + + VAR[0] = ALPHA*VAR[0] + 0.5f * (r[0]*r[0] + e0*e0); + COR[0] = ALPHA*COR[0] + r[0]*e0; + VAR[1] = ALPHA*VAR[1] + 0.5f * (r[1]*r[1] + e1*e1); + COR[1] = ALPHA*COR[1] + r[1]*e1; + + r[1] = A * (r[0]-dr1); + r[0] = A * e0; + + state->r[0] = quant_pred(r[0]); + state->r[1] = quant_pred(r[1]); + state->COR[0] = quant_pred(COR[0]); + state->COR[1] = quant_pred(COR[1]); + state->VAR[0] = quant_pred(VAR[0]); + state->VAR[1] = quant_pred(VAR[1]); +} + +static void reset_pred_state(pred_state *state) +{ + state->r[0] = 0; + state->r[1] = 0; + state->COR[0] = 0; + state->COR[1] = 0; + state->VAR[0] = 0x3F80; + state->VAR[1] = 0x3F80; +} + +void pns_reset_pred_state(ic_stream *ics, pred_state *state) +{ + uint8_t sfb, g, b; + uint16_t i, offs, offs2; + + /* prediction only for long blocks */ + if (ics->window_sequence == EIGHT_SHORT_SEQUENCE) + return; + + for (g = 0; g < ics->num_window_groups; g++) + { + for (b = 0; b < ics->window_group_length[g]; b++) + { + for (sfb = 0; sfb < ics->max_sfb; sfb++) + { + if (is_noise(ics, g, sfb)) + { + offs = ics->swb_offset[sfb]; + offs2 = ics->swb_offset[sfb+1]; + + for (i = offs; i < offs2; i++) + reset_pred_state(&state[i]); + } + } + } + } +} + +void reset_all_predictors(pred_state *state, uint16_t frame_len) +{ + uint16_t i; + + for (i = 0; i < frame_len; i++) + reset_pred_state(&state[i]); +} + +/* intra channel prediction */ +void ic_prediction(ic_stream *ics, real_t *spec, pred_state *state, + uint16_t frame_len, uint8_t sf_index) +{ + uint8_t sfb; + uint16_t bin; + + if (ics->window_sequence == EIGHT_SHORT_SEQUENCE) + { + reset_all_predictors(state, frame_len); + } else { + for (sfb = 0; sfb < max_pred_sfb(sf_index); sfb++) + { + uint16_t low = ics->swb_offset[sfb]; + uint16_t high = ics->swb_offset[sfb+1]; + + for (bin = low; bin < high; bin++) + { + ic_predict(&state[bin], spec[bin], &spec[bin], + (ics->predictor_data_present && ics->pred.prediction_used[sfb])); + } + } + + if (ics->predictor_data_present) + { + if (ics->pred.predictor_reset) + { + for (bin = ics->pred.predictor_reset_group_number - 1; + bin < frame_len; bin += 30) + { + reset_pred_state(&state[bin]); + } + } + } + } +} + +#endif diff --git a/Libraries/FAAD2/Files/libfaad/ic_predict.h b/Libraries/FAAD2/Files/libfaad/ic_predict.h new file mode 100644 index 000000000..acaa9d8a4 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/ic_predict.h @@ -0,0 +1,249 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#ifdef MAIN_DEC + +#ifndef __IC_PREDICT_H__ +#define __IC_PREDICT_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#define ALPHA REAL_CONST(0.90625) +#define A REAL_CONST(0.953125) + + +void pns_reset_pred_state(ic_stream *ics, pred_state *state); +void reset_all_predictors(pred_state *state, uint16_t frame_len); +void ic_prediction(ic_stream *ics, real_t *spec, pred_state *state, + uint16_t frame_len, uint8_t sf_index); + +ALIGN static const real_t mnt_table[128] = { + COEF_CONST(0.9531250000), COEF_CONST(0.9453125000), + COEF_CONST(0.9375000000), COEF_CONST(0.9296875000), + COEF_CONST(0.9257812500), COEF_CONST(0.9179687500), + COEF_CONST(0.9101562500), COEF_CONST(0.9023437500), + COEF_CONST(0.8984375000), COEF_CONST(0.8906250000), + COEF_CONST(0.8828125000), COEF_CONST(0.8789062500), + COEF_CONST(0.8710937500), COEF_CONST(0.8671875000), + COEF_CONST(0.8593750000), COEF_CONST(0.8515625000), + COEF_CONST(0.8476562500), COEF_CONST(0.8398437500), + COEF_CONST(0.8359375000), COEF_CONST(0.8281250000), + COEF_CONST(0.8242187500), COEF_CONST(0.8203125000), + COEF_CONST(0.8125000000), COEF_CONST(0.8085937500), + COEF_CONST(0.8007812500), COEF_CONST(0.7968750000), + COEF_CONST(0.7929687500), COEF_CONST(0.7851562500), + COEF_CONST(0.7812500000), COEF_CONST(0.7773437500), + COEF_CONST(0.7734375000), COEF_CONST(0.7656250000), + COEF_CONST(0.7617187500), COEF_CONST(0.7578125000), + COEF_CONST(0.7539062500), COEF_CONST(0.7500000000), + COEF_CONST(0.7421875000), COEF_CONST(0.7382812500), + COEF_CONST(0.7343750000), COEF_CONST(0.7304687500), + COEF_CONST(0.7265625000), COEF_CONST(0.7226562500), + COEF_CONST(0.7187500000), COEF_CONST(0.7148437500), + COEF_CONST(0.7109375000), COEF_CONST(0.7070312500), + COEF_CONST(0.6992187500), COEF_CONST(0.6953125000), + COEF_CONST(0.6914062500), COEF_CONST(0.6875000000), + COEF_CONST(0.6835937500), COEF_CONST(0.6796875000), + COEF_CONST(0.6796875000), COEF_CONST(0.6757812500), + COEF_CONST(0.6718750000), COEF_CONST(0.6679687500), + COEF_CONST(0.6640625000), COEF_CONST(0.6601562500), + COEF_CONST(0.6562500000), COEF_CONST(0.6523437500), + COEF_CONST(0.6484375000), COEF_CONST(0.6445312500), + COEF_CONST(0.6406250000), COEF_CONST(0.6406250000), + COEF_CONST(0.6367187500), COEF_CONST(0.6328125000), + COEF_CONST(0.6289062500), COEF_CONST(0.6250000000), + COEF_CONST(0.6210937500), COEF_CONST(0.6210937500), + COEF_CONST(0.6171875000), COEF_CONST(0.6132812500), + COEF_CONST(0.6093750000), COEF_CONST(0.6054687500), + COEF_CONST(0.6054687500), COEF_CONST(0.6015625000), + COEF_CONST(0.5976562500), COEF_CONST(0.5937500000), + COEF_CONST(0.5937500000), COEF_CONST(0.5898437500), + COEF_CONST(0.5859375000), COEF_CONST(0.5820312500), + COEF_CONST(0.5820312500), COEF_CONST(0.5781250000), + COEF_CONST(0.5742187500), COEF_CONST(0.5742187500), + COEF_CONST(0.5703125000), COEF_CONST(0.5664062500), + COEF_CONST(0.5664062500), COEF_CONST(0.5625000000), + COEF_CONST(0.5585937500), COEF_CONST(0.5585937500), + COEF_CONST(0.5546875000), COEF_CONST(0.5507812500), + COEF_CONST(0.5507812500), COEF_CONST(0.5468750000), + COEF_CONST(0.5429687500), COEF_CONST(0.5429687500), + COEF_CONST(0.5390625000), COEF_CONST(0.5390625000), + COEF_CONST(0.5351562500), COEF_CONST(0.5312500000), + COEF_CONST(0.5312500000), COEF_CONST(0.5273437500), + COEF_CONST(0.5273437500), COEF_CONST(0.5234375000), + COEF_CONST(0.5195312500), COEF_CONST(0.5195312500), + COEF_CONST(0.5156250000), COEF_CONST(0.5156250000), + COEF_CONST(0.5117187500), COEF_CONST(0.5117187500), + COEF_CONST(0.5078125000), COEF_CONST(0.5078125000), + COEF_CONST(0.5039062500), COEF_CONST(0.5039062500), + COEF_CONST(0.5000000000), COEF_CONST(0.4980468750), + COEF_CONST(0.4960937500), COEF_CONST(0.4941406250), + COEF_CONST(0.4921875000), COEF_CONST(0.4902343750), + COEF_CONST(0.4882812500), COEF_CONST(0.4863281250), + COEF_CONST(0.4843750000), COEF_CONST(0.4824218750), + COEF_CONST(0.4804687500), COEF_CONST(0.4785156250) +}; + +ALIGN static const real_t exp_table[128] = { + COEF_CONST(0.50000000000000000000000000000000000000000000000000), + COEF_CONST(0.25000000000000000000000000000000000000000000000000), + COEF_CONST(0.12500000000000000000000000000000000000000000000000), + COEF_CONST(0.06250000000000000000000000000000000000000000000000), + COEF_CONST(0.03125000000000000000000000000000000000000000000000), + COEF_CONST(0.01562500000000000000000000000000000000000000000000), + COEF_CONST(0.00781250000000000000000000000000000000000000000000), + COEF_CONST(0.00390625000000000000000000000000000000000000000000), + COEF_CONST(0.00195312500000000000000000000000000000000000000000), + COEF_CONST(0.00097656250000000000000000000000000000000000000000), + COEF_CONST(0.00048828125000000000000000000000000000000000000000), + COEF_CONST(0.00024414062500000000000000000000000000000000000000), + COEF_CONST(0.00012207031250000000000000000000000000000000000000), + COEF_CONST(0.00006103515625000000000000000000000000000000000000), + COEF_CONST(0.00003051757812500000000000000000000000000000000000), + COEF_CONST(0.00001525878906250000000000000000000000000000000000), + COEF_CONST(0.00000762939453125000000000000000000000000000000000), + COEF_CONST(0.00000381469726562500000000000000000000000000000000), + COEF_CONST(0.00000190734863281250000000000000000000000000000000), + COEF_CONST(0.00000095367431640625000000000000000000000000000000), + COEF_CONST(0.00000047683715820312500000000000000000000000000000), + COEF_CONST(0.00000023841857910156250000000000000000000000000000), + COEF_CONST(0.00000011920928955078125000000000000000000000000000), + COEF_CONST(0.00000005960464477539062500000000000000000000000000), + COEF_CONST(0.00000002980232238769531300000000000000000000000000), + COEF_CONST(0.00000001490116119384765600000000000000000000000000), + COEF_CONST(0.00000000745058059692382810000000000000000000000000), + COEF_CONST(0.00000000372529029846191410000000000000000000000000), + COEF_CONST(0.00000000186264514923095700000000000000000000000000), + COEF_CONST(0.00000000093132257461547852000000000000000000000000), + COEF_CONST(0.00000000046566128730773926000000000000000000000000), + COEF_CONST(0.00000000023283064365386963000000000000000000000000), + COEF_CONST(0.00000000011641532182693481000000000000000000000000), + COEF_CONST(0.00000000005820766091346740700000000000000000000000), + COEF_CONST(0.00000000002910383045673370400000000000000000000000), + COEF_CONST(0.00000000001455191522836685200000000000000000000000), + COEF_CONST(0.00000000000727595761418342590000000000000000000000), + COEF_CONST(0.00000000000363797880709171300000000000000000000000), + COEF_CONST(0.00000000000181898940354585650000000000000000000000), + COEF_CONST(0.00000000000090949470177292824000000000000000000000), + COEF_CONST(0.00000000000045474735088646412000000000000000000000), + COEF_CONST(0.00000000000022737367544323206000000000000000000000), + COEF_CONST(0.00000000000011368683772161603000000000000000000000), + COEF_CONST(0.00000000000005684341886080801500000000000000000000), + COEF_CONST(0.00000000000002842170943040400700000000000000000000), + COEF_CONST(0.00000000000001421085471520200400000000000000000000), + COEF_CONST(0.00000000000000710542735760100190000000000000000000), + COEF_CONST(0.00000000000000355271367880050090000000000000000000), + COEF_CONST(0.00000000000000177635683940025050000000000000000000), + COEF_CONST(0.00000000000000088817841970012523000000000000000000), + COEF_CONST(0.00000000000000044408920985006262000000000000000000), + COEF_CONST(0.00000000000000022204460492503131000000000000000000), + COEF_CONST(0.00000000000000011102230246251565000000000000000000), + COEF_CONST(0.00000000000000005551115123125782700000000000000000), + COEF_CONST(0.00000000000000002775557561562891400000000000000000), + COEF_CONST(0.00000000000000001387778780781445700000000000000000), + COEF_CONST(0.00000000000000000693889390390722840000000000000000), + COEF_CONST(0.00000000000000000346944695195361420000000000000000), + COEF_CONST(0.00000000000000000173472347597680710000000000000000), + COEF_CONST(0.00000000000000000086736173798840355000000000000000), + COEF_CONST(0.00000000000000000043368086899420177000000000000000), + COEF_CONST(0.00000000000000000021684043449710089000000000000000), + COEF_CONST(0.00000000000000000010842021724855044000000000000000), + COEF_CONST(0.00000000000000000005421010862427522200000000000000), + COEF_CONST(0.00000000000000000002710505431213761100000000000000), + COEF_CONST(0.00000000000000000001355252715606880500000000000000), + COEF_CONST(0.00000000000000000000677626357803440270000000000000), + COEF_CONST(0.00000000000000000000338813178901720140000000000000), + COEF_CONST(0.00000000000000000000169406589450860070000000000000), + COEF_CONST(0.00000000000000000000084703294725430034000000000000), + COEF_CONST(0.00000000000000000000042351647362715017000000000000), + COEF_CONST(0.00000000000000000000021175823681357508000000000000), + COEF_CONST(0.00000000000000000000010587911840678754000000000000), + COEF_CONST(0.00000000000000000000005293955920339377100000000000), + COEF_CONST(0.00000000000000000000002646977960169688600000000000), + COEF_CONST(0.00000000000000000000001323488980084844300000000000), + COEF_CONST(0.00000000000000000000000661744490042422140000000000), + COEF_CONST(0.00000000000000000000000330872245021211070000000000), + COEF_CONST(0.00000000000000000000000165436122510605530000000000), + COEF_CONST(0.00000000000000000000000082718061255302767000000000), + COEF_CONST(0.00000000000000000000000041359030627651384000000000), + COEF_CONST(0.00000000000000000000000020679515313825692000000000), + COEF_CONST(0.00000000000000000000000010339757656912846000000000), + COEF_CONST(0.00000000000000000000000005169878828456423000000000), + COEF_CONST(0.00000000000000000000000002584939414228211500000000), + COEF_CONST(0.00000000000000000000000001292469707114105700000000), + COEF_CONST(0.00000000000000000000000000646234853557052870000000), + COEF_CONST(0.00000000000000000000000000323117426778526440000000), + COEF_CONST(0.00000000000000000000000000161558713389263220000000), + COEF_CONST(0.00000000000000000000000000080779356694631609000000), + COEF_CONST(0.00000000000000000000000000040389678347315804000000), + COEF_CONST(0.00000000000000000000000000020194839173657902000000), + COEF_CONST(0.00000000000000000000000000010097419586828951000000), + COEF_CONST(0.00000000000000000000000000005048709793414475600000), + COEF_CONST(0.00000000000000000000000000002524354896707237800000), + COEF_CONST(0.00000000000000000000000000001262177448353618900000), + COEF_CONST(0.00000000000000000000000000000631088724176809440000), + COEF_CONST(0.00000000000000000000000000000315544362088404720000), + COEF_CONST(0.00000000000000000000000000000157772181044202360000), + COEF_CONST(0.00000000000000000000000000000078886090522101181000), + COEF_CONST(0.00000000000000000000000000000039443045261050590000), + COEF_CONST(0.00000000000000000000000000000019721522630525295000), + COEF_CONST(0.00000000000000000000000000000009860761315262647600), + COEF_CONST(0.00000000000000000000000000000004930380657631323800), + COEF_CONST(0.00000000000000000000000000000002465190328815661900), + COEF_CONST(0.00000000000000000000000000000001232595164407830900), + COEF_CONST(0.00000000000000000000000000000000616297582203915470), + COEF_CONST(0.00000000000000000000000000000000308148791101957740), + COEF_CONST(0.00000000000000000000000000000000154074395550978870), + COEF_CONST(0.00000000000000000000000000000000077037197775489434), + COEF_CONST(0.00000000000000000000000000000000038518598887744717), + COEF_CONST(0.00000000000000000000000000000000019259299443872359), + COEF_CONST(0.00000000000000000000000000000000009629649721936179), + COEF_CONST(0.00000000000000000000000000000000004814824860968090), + COEF_CONST(0.00000000000000000000000000000000002407412430484045), + COEF_CONST(0.00000000000000000000000000000000001203706215242022), + COEF_CONST(0.00000000000000000000000000000000000601853107621011), + COEF_CONST(0.00000000000000000000000000000000000300926553810506), + COEF_CONST(0.00000000000000000000000000000000000150463276905253), + COEF_CONST(0.00000000000000000000000000000000000075231638452626), + COEF_CONST(0.00000000000000000000000000000000000037615819226313), + COEF_CONST(0.00000000000000000000000000000000000018807909613157), + COEF_CONST(0.00000000000000000000000000000000000009403954806578), + COEF_CONST(0.00000000000000000000000000000000000004701977403289), + COEF_CONST(0.00000000000000000000000000000000000002350988701645), + COEF_CONST(0.00000000000000000000000000000000000001175494350822), + COEF_CONST(0.0 /* 0000000000000000000000000000000000000587747175411 "floating point underflow" */), + COEF_CONST(0.0) +}; + +#ifdef __cplusplus +} +#endif +#endif + +#endif diff --git a/Libraries/FAAD2/Files/libfaad/iq_table.h b/Libraries/FAAD2/Files/libfaad/iq_table.h new file mode 100644 index 000000000..84d279c03 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/iq_table.h @@ -0,0 +1,16455 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#ifndef IQ_TABLE_H__ +#define IQ_TABLE_H__ + +#ifdef __cplusplus +extern "C" { +#endif + + +/* !!!DON'T CHANGE IQ_TABLE_SIZE!!! */ + + +#ifndef FIXED_POINT + +#define IQ_TABLE_SIZE 8192 + +#ifdef _MSC_VER +#pragma warning(disable:4305) +#pragma warning(disable:4244) +#endif + +ALIGN static const real_t iq_table[IQ_TABLE_SIZE] = +{ + 0, + 1, + 2.5198420997897464, + 4.3267487109222245, + 6.3496042078727974, + 8.5498797333834844, + 10.902723556992836, + 13.390518279406722, + 15.999999999999998, + 18.720754407467133, + 21.544346900318832, + 24.463780996262464, + 27.47314182127996, + 30.567350940369842, + 33.741991698453212, + 36.993181114957046, + 40.317473596635935, + 43.711787041189993, + 47.173345095760126, + 50.699631325716943, + 54.288352331898118, + 57.937407704003519, + 61.6448652744185, + 65.408940536585988, + 69.227979374755591, + 73.100443455321638, + 77.024897778591622, + 80.999999999999986, + 85.024491212518527, + 89.097187944889555, + 93.216975178615741, + 97.382800224133163, + 101.59366732596474, + 105.84863288986224, + 110.14680124343441, + 114.4873208566006, + 118.86938096020653, + 123.29220851090024, + 127.75506545836058, + 132.25724627755247, + 136.79807573413572, + 141.37690685569191, + 145.99311908523086, + 150.6461165966291, + 155.33532675434674, + 160.06019870205279, + 164.82020206673349, + 169.61482576651861, + 174.44357691188537, + 179.30597979112557, + 184.20157493201927, + 189.12991823257562, + 194.09058015449685, + 199.08314497371677, + 204.1072100829694, + 209.16238534187647, + 214.24829247050752, + 219.36456448277784, + 224.51084515641216, + 229.6867885365223, + 234.89205847013176, + 240.12632816923249, + 245.38927980018505, + 250.68060409747261, + 255.99999999999991, + 261.34717430828869, + 266.72184136106449, + 272.12372272986045, + 277.55254693037961, + 283.0080491494619, + 288.48997098659891, + 293.99806020902247, + 299.53207051947408, + 305.0917613358298, + 310.67689758182206, + 316.28724948815585, + 321.92259240337177, + 327.58270661385535, + 333.26737717243742, + 338.97639373507025, + 344.70955040510125, + 350.46664558470013, + 356.24748183302603, + 362.05186573075139, + 367.87960775058258, + 373.73052213344511, + 379.60442677002078, + 385.50114308734607, + 391.42049594019937, + 397.36231350702371, + 403.32642719014467, + 409.31267152006262, + 415.32088406360799, + 421.35090533576471, + 427.40257871497619, + 433.4757503617617, + 439.5702691404793, + 445.68598654408271, + 451.82275662172759, + 457.98043590909128, + 464.15888336127773, + 470.35796028818726, + 476.5775302922363, + 482.81745920832043, + 489.07761504591741, + 495.35786793323581, + 501.65809006331688, + 507.97815564200368, + 514.31794083769648, + 520.67732373281672, + 527.05618427690604, + 533.45440424129174, + 539.87186717525128, + 546.30845836361505, + 552.76406478574609, + 559.23857507584194, + 565.73187948450413, + 572.24386984152341, + 578.77443951983378, + 585.32348340058843, + 591.89089783931263, + 598.47658063309257, + 605.08043098876044, + 611.70234949203643, + 618.3422380775919, + 624.99999999999977, + 631.67553980553748, + 638.36876330481164, + 645.07957754617485, + 651.80789078990415, + 658.55361248311499, + 665.31665323538357, + 672.09692479505225, + 678.8943400261943, + 685.70881288621433, + 692.540258404062, + 699.38859265903977, + 706.25373276018058, + 713.13559682617972, + 720.03410396586037, + 726.94917425915435, + 733.88072873858209, + 740.82868937121543, + 747.79297904110535, + 754.77352153216191, + 761.77024151147043, + 768.78306451302956, + 775.81191692189896, + 782.85672595874246, + 789.91741966475445, + 796.99392688695798, + 804.08617726386274, + 811.19410121147098, + 818.31762990962227, + 825.45669528866563, + 832.61123001644864, + 839.78116748561604, + 846.96644180120552, + 854.16698776853514, + 861.38274088137143, + 868.61363731036977, + 875.85961389178203, + 883.12060811641959, + 890.39655811886757, + 897.68740266694181, + 904.99308115138172, + 912.31353357577188, + 919.64870054668756, + 926.99852326405619, + 934.36294351172899, + 941.74190364825859, + 949.13534659787422, + 956.54321584165211, + 963.96545540887348, + 971.40200986856541, + 978.85282432122176, + 986.31784439069588, + 993.7970162162635, + 1001.29028644485, + 1008.797602223418, + 1016.3189111915103, + 1023.8541614739464, + 1031.4033016736653, + 1038.9662808647138, + 1046.5430485853758, + 1054.1335548314366, + 1061.7377500495838, + 1069.3555851309357, + 1076.9870114046978, + 1084.6319806319441, + 1092.2904449995174, + 1099.9623571140482, + 1107.6476699960892, + 1115.3463370743607, + 1123.058312180106, + 1130.7835495415541, + 1138.5220037784854, + 1146.273629896901, + 1154.0383832837879, + 1161.816219701986, + 1169.607095285146, + 1177.4109665327808, + 1185.2277903054078, + 1193.0575238197798, + 1200.9001246442001, + 1208.7555506939248, + 1216.6237602266442, + 1224.5047118380478, + 1232.3983644574657, + 1240.3046773435874, + 1248.2236100802568, + 1256.1551225723395, + 1264.099175041662, + 1272.0557280230228, + 1280.0247423602691, + 1288.0061792024444, + 1295.9999999999995, + 1304.006166501068, + 1312.0246407478062, + 1320.0553850727929, + 1328.0983620954903, + 1336.1535347187651, + 1344.2208661254647, + 1352.3003197750522, + 1360.3918594002962, + 1368.4954490040145, + 1376.6110528558709, + 1384.7386354892244, + 1392.8781616980295, + 1401.0295965337855, + 1409.1929053025353, + 1417.3680535619119, + 1425.5550071182327, + 1433.7537320236374, + 1441.9641945732744, + 1450.1863613025282, + 1458.4201989842913, + 1466.6656746262797, + 1474.9227554683875, + 1483.1914089800841, + 1491.4716028578516, + 1499.7633050226596, + 1508.0664836174794, + 1516.3811070048375, + 1524.7071437644029, + 1533.0445626906128, + 1541.3933327903342, + 1549.7534232805581, + 1558.1248035861302, + 1566.507443337515, + 1574.9013123685909, + 1583.3063807144795, + 1591.7226186094069, + 1600.1499964845941, + 1608.58848496618, + 1617.0380548731737, + 1625.4986772154357, + 1633.9703231916887, + 1642.4529641875577, + 1650.9465717736346, + 1659.4511177035752, + 1667.9665739122186, + 1676.4929125137353, + 1685.030105799801, + 1693.5781262377957, + 1702.136946469027, + 1710.7065393069795, + 1719.2868777355877, + 1727.8779349075323, + 1736.4796841425596, + 1745.092098925825, + 1753.7151529062583, + 1762.3488198949503, + 1770.9930738635628, + 1779.6478889427597, + 1788.3132394206564, + 1796.9890997412947, + 1805.6754445031333, + 1814.3722484575621, + 1823.0794865074322, + 1831.7971337056094, + 1840.5251652535437, + 1849.2635564998579, + 1858.0122829389563, + 1866.7713202096493, + 1875.5406440937966, + 1884.3202305149687, + 1893.110055537124, + 1901.9100953633042, + 1910.7203263343454, + 1919.5407249276057, + 1928.3712677557098, + 1937.2119315653083, + 1946.0626932358525, + 1954.923529778386, + 1963.79441833435, + 1972.6753361744036, + 1981.5662606972594, + 1990.467169428533, + 1999.3780400196069, + 2008.2988502465078, + 2017.2295780087982, + 2026.1702013284819, + 2035.1206983489212, + 2044.0810473337688, + 2053.0512266659125, + 2062.0312148464309, + 2071.0209904935646, + 2080.0205323416958, + 2089.0298192403443, + 2098.0488301531714, + 2107.0775441569995, + 2116.115940440839, + 2125.1639983049317, + 2134.2216971597995, + 2143.2890165253098, + 2152.3659360297484, + 2161.4524354089031, + 2170.5484945051617, + 2179.6540932666144, + 2188.7692117461711, + 2197.8938301006888, + 2207.0279285901042, + 2216.1714875765838, + 2225.324487523676, + 2234.4869089954782, + 2243.6587326558101, + 2252.8399392673982, + 2262.0305096910702, + 2271.2304248849537, + 2280.4396659036897, + 2289.6582138976523, + 2298.8860501121762, + 2308.1231558867926, + 2317.3695126544767, + 2326.6251019409005, + 2335.8899053636933, + 2345.1639046317132, + 2354.4470815443233, + 2363.7394179906792, + 2373.0408959490205, + 2382.3514974859731, + 2391.6712047558558, + 2400.9999999999991, + 2410.3378655460651, + 2419.6847838073813, + 2429.0407372822747, + 2438.4057085534191, + 2447.7796802871858, + 2457.1626352330004, + 2466.5545562227112, + 2475.9554261699564, + 2485.3652280695474, + 2494.7839449968492, + 2504.2115601071737, + 2513.6480566351788, + 2523.0934178942675, + 2532.5476272760025, + 2542.0106682495189, + 2551.482524360948, + 2560.9631792328441, + 2570.4526165636184, + 2579.9508201269791, + 2589.4577737713744, + 2598.9734614194458, + 2608.4978670674823, + 2618.0309747848837, + 2627.5727687136259, + 2637.1232330677353, + 2646.6823521327647, + 2656.2501102652768, + 2665.8264918923328, + 2675.4114815109842, + 2685.0050636877722, + 2694.6072230582295, + 2704.2179443263894, + 2713.8372122642972, + 2723.4650117115279, + 2733.1013275747096, + 2742.7461448270483, + 2752.3994485078601, + 2762.0612237221085, + 2771.7314556399419, + 2781.4101294962406, + 2791.0972305901655, + 2800.7927442847094, + 2810.4966560062589, + 2820.2089512441521, + 2829.9296155502466, + 2839.6586345384894, + 2849.3959938844923, + 2859.1416793251065, + 2868.8956766580086, + 2878.6579717412847, + 2888.4285504930212, + 2898.2073988908974, + 2907.9945029717837, + 2917.789848831344, + 2927.5934226236377, + 2937.4052105607311, + 2947.2251989123079, + 2957.0533740052865, + 2966.8897222234368, + 2976.734230007005, + 2986.5868838523397, + 2996.4476703115197, + 3006.3165759919889, + 3016.1935875561908, + 3026.0786917212095, + 3035.9718752584108, + 3045.8731249930906, + 3055.7824278041207, + 3065.6997706236039, + 3075.625140436528, + 3085.5585242804245, + 3095.4999092450298, + 3105.4492824719491, + 3115.4066311543256, + 3125.3719425365089, + 3135.3452039137287, + 3145.3264026317715, + 3155.3155260866592, + 3165.3125617243295, + 3175.3174970403229, + 3185.3303195794679, + 3195.35101693557, + 3205.3795767511078, + 3215.4159867169251, + 3225.460234571929, + 3235.5123081027928, + 3245.5721951436558, + 3255.63988357583, + 3265.7153613275095, + 3275.7986163734795, + 3285.8896367348289, + 3295.9884104786665, + 3306.0949257178395, + 3316.2091706106517, + 3326.331133360588, + 3336.4608022160378, + 3346.5981654700231, + 3356.7432114599264, + 3366.8959285672249, + 3377.0563052172211, + 3387.2243298787821, + 3397.3999910640764, + 3407.5832773283128, + 3417.7741772694862, + 3427.9726795281199, + 3438.1787727870123, + 3448.3924457709873, + 3458.6136872466445, + 3468.8424860221107, + 3479.0788309467976, + 3489.3227109111554, + 3499.5741148464344, + 3509.8330317244445, + 3520.0994505573185, + 3530.3733603972751, + 3540.6547503363886, + 3550.9436095063534, + 3561.239927078258, + 3571.5436922623535, + 3581.8548943078308, + 3592.1735225025936, + 3602.4995661730372, + 3612.8330146838275, + 3623.1738574376814, + 3633.5220838751502, + 3643.8776834744031, + 3654.2406457510142, + 3664.6109602577494, + 3674.9886165843564, + 3685.3736043573545, + 3695.7659132398294, + 3706.1655329312248, + 3716.5724531671399, + 3726.9866637191262, + 3737.4081543944876, + 3747.8369150360782, + 3758.2729355221072, + 3768.7162057659411, + 3779.1667157159077, + 3789.6244553551055, + 3800.0894147012082, + 3810.5615838062768, + 3821.0409527565694, + 3831.5275116723533, + 3842.0212507077194, + 3852.522160050396, + 3863.0302299215673, + 3873.5454505756893, + 3884.0678123003108, + 3894.5973054158922, + 3905.1339202756285, + 3915.6776472652732, + 3926.2284768029604, + 3936.7863993390338, + 3947.3514053558706, + 3957.9234853677135, + 3968.5026299204969, + 3979.0888295916798, + 3989.6820749900776, + 4000.2823567556948, + 4010.8896655595613, + 4021.5039921035655, + 4032.1253271202945, + 4042.7536613728694, + 4053.3889856547858, + 4064.0312907897551, + 4074.6805676315448, + 4085.3368070638221, + 4095.9999999999982, + 4106.6701373830711, + 4117.347210185475, + 4128.0312094089259, + 4138.722126084268, + 4149.4199512713267, + 4160.1246760587583, + 4170.8362915638982, + 4181.5547889326181, + 4192.2801593391769, + 4203.0123939860741, + 4213.7514841039101, + 4224.4974209512384, + 4235.2501958144258, + 4246.0098000075095, + 4256.7762248720574, + 4267.549461777031, + 4278.3295021186423, + 4289.1163373202198, + 4299.9099588320714, + 4310.7103581313495, + 4321.5175267219138, + 4332.3314561342004, + 4343.152137925088, + 4353.9795636777671, + 4364.8137250016052, + 4375.6546135320223, + 4386.5022209303588, + 4397.3565388837469, + 4408.2175591049827, + 4419.0852733324018, + 4429.9596733297531, + 4440.8407508860728, + 4451.7284978155603, + 4462.6229059574571, + 4473.5239671759227, + 4484.4316733599126, + 4495.3460164230582, + 4506.2669883035496, + 4517.1945809640119, + 4528.1287863913894, + 4539.069596596828, + 4550.0170036155587, + 4560.9709995067806, + 4571.931576353546, + 4582.898726262647, + 4593.8724413645004, + 4604.8527138130348, + 4615.8395357855816, + 4626.8328994827571, + 4637.8327971283588, + 4648.8392209692511, + 4659.8521632752563, + 4670.8716163390473, + 4681.8975724760394, + 4692.9300240242837, + 4703.9689633443595, + 4715.0143828192668, + 4726.0662748543255, + 4737.1246318770682, + 4748.1894463371373, + 4759.2607107061804, + 4770.3384174777493, + 4781.4225591671993, + 4792.5131283115852, + 4803.6101174695614, + 4814.7135192212854, + 4825.8233261683154, + 4836.9395309335096, + 4848.0621261609349, + 4859.1911045157631, + 4870.3264586841779, + 4881.4681813732768, + 4892.6162653109768, + 4903.7707032459193, + 4914.931487947375, + 4926.0986122051509, + 4937.2720688294967, + 4948.4518506510112, + 4959.637950520555, + 4970.8303613091521, + 4982.0290759079044, + 4993.2340872278974, + 5004.4453882001153, + 5015.6629717753467, + 5026.8868309241007, + 5038.1169586365131, + 5049.353347922266, + 5060.5959918104927, + 5071.8448833496996, + 5083.1000156076734, + 5094.3613816713996, + 5105.6289746469747, + 5116.9027876595246, + 5128.18281385312, + 5139.4690463906918, + 5150.7614784539473, + 5162.0601032432933, + 5173.3649139777472, + 5184.6759038948594, + 5195.9930662506322, + 5207.3163943194386, + 5218.6458813939435, + 5229.9815207850224, + 5241.3233058216847, + 5252.6712298509919, + 5264.025286237983, + 5275.3854683655954, + 5286.7517696345885, + 5298.1241834634639, + 5309.5027032883945, + 5320.887322563146, + 5332.2780347589978, + 5343.6748333646756, + 5355.0777118862716, + 5366.4866638471722, + 5377.901682787985, + 5389.3227622664635, + 5400.749895857437, + 5412.1830771527357, + 5423.622299761123, + 5435.067557308219, + 5446.5188434364318, + 5457.9761518048872, + 5469.4394760893592, + 5480.9088099821975, + 5492.3841471922606, + 5503.8654814448455, + 5515.3528064816201, + 5526.846116060552, + 5538.3454039558474, + 5549.8506639578736, + 5561.3618898731029, + 5572.8790755240361, + 5584.4022147491451, + 5595.9313014027975, + 5607.4663293552012, + 5619.0072924923297, + 5630.5541847158656, + 5642.1069999431284, + 5653.665732107017, + 5665.230375155943, + 5676.8009230537655, + 5688.3773697797333, + 5699.9597093284156, + 5711.5479357096474, + 5723.1420429484588, + 5734.7420250850209, + 5746.347876174581, + 5757.9595902874016, + 5769.5771615087006, + 5781.2005839385911, + 5792.8298516920213, + 5804.4649588987149, + 5816.1058997031105, + 5827.7526682643065, + 5839.4052587559972, + 5851.0636653664196, + 5862.7278822982908, + 5874.3979037687541, + 5886.0737240093204, + 5897.7553372658094, + 5909.4427377982956, + 5921.1359198810505, + 5932.8348778024874, + 5944.5396058651031, + 5956.2500983854261, + 5967.9663496939575, + 5979.6883541351208, + 5991.4161060672022, + 6003.1495998623004, + 6014.8888299062692, + 6026.6337905986684, + 6038.3844763527022, + 6050.1408815951781, + 6061.9030007664414, + 6073.6708283203316, + 6085.4443587241267, + 6097.2235864584891, + 6109.0085060174197, + 6120.7991119081998, + 6132.595398651345, + 6144.3973607805519, + 6156.2049928426459, + 6168.0182893975361, + 6179.8372450181578, + 6191.6618542904307, + 6203.4921118132024, + 6215.3280121982016, + 6227.1695500699925, + 6239.0167200659189, + 6250.8695168360628, + 6262.7279350431891, + 6274.5919693627056, + 6286.4616144826068, + 6298.3368651034316, + 6310.2177159382172, + 6322.1041617124456, + 6333.9961971640032, + 6345.8938170431311, + 6357.7970161123785, + 6369.7057891465583, + 6381.6201309327007, + 6393.5400362700075, + 6405.4654999698032, + 6417.3965168554978, + 6429.3330817625329, + 6441.2751895383453, + 6453.2228350423138, + 6465.176013145724, + 6477.134718731716, + 6489.0989466952469, + 6501.0686919430445, + 6513.0439493935628, + 6525.0247139769417, + 6537.010980634961, + 6549.002744321001, + 6560.9999999999973, + 6573.0027426483985, + 6585.0109672541284, + 6597.0246688165371, + 6609.0438423463656, + 6621.0684828657004, + 6633.0985854079354, + 6645.134145017727, + 6657.1751567509573, + 6669.2216156746908, + 6681.2735168671343, + 6693.3308554176001, + 6705.3936264264594, + 6717.461825005108, + 6729.535446275926, + 6741.6144853722335, + 6753.6989374382601, + 6765.7887976290967, + 6777.8840611106634, + 6789.9847230596661, + 6802.0907786635626, + 6814.2022231205201, + 6826.3190516393797, + 6838.4412594396181, + 6850.5688417513074, + 6862.701793815083, + 6874.840110882099, + 6886.9837882139991, + 6899.1328210828724, + 6911.2872047712199, + 6923.4469345719199, + 6935.6120057881863, + 6947.7824137335365, + 6959.9581537317536, + 6972.1392211168532, + 6984.3256112330409, + 6996.5173194346862, + 7008.7143410862773, + 7020.9166715623942, + 7033.1243062476678, + 7045.3372405367481, + 7057.5554698342685, + 7069.7789895548103, + 7082.0077951228714, + 7094.2418819728273, + 7106.4812455489018, + 7118.7258813051285, + 7130.9757847053224, + 7143.2309512230404, + 7155.4913763415516, + 7167.7570555538041, + 7180.0279843623894, + 7192.3041582795131, + 7204.5855728269571, + 7216.8722235360519, + 7229.1641059476406, + 7241.4612156120484, + 7253.7635480890503, + 7266.0710989478375, + 7278.3838637669869, + 7290.7018381344296, + 7303.0250176474174, + 7315.3533979124932, + 7327.6869745454596, + 7340.0257431713462, + 7352.3696994243801, + 7364.7188389479543, + 7377.0731573945968, + 7389.4326504259407, + 7401.7973137126937, + 7414.1671429346061, + 7426.5421337804428, + 7438.922281947951, + 7451.3075831438346, + 7463.6980330837177, + 7476.0936274921214, + 7488.4943621024304, + 7500.9002326568652, + 7513.3112349064522, + 7525.7273646109943, + 7538.1486175390446, + 7550.5749894678729, + 7563.0064761834419, + 7575.4430734803736, + 7587.8847771619248, + 7600.3315830399597, + 7612.7834869349153, + 7625.24048467578, + 7637.7025721000637, + 7650.1697450537677, + 7662.6419993913596, + 7675.1193309757446, + 7687.6017356782404, + 7700.0892093785433, + 7712.5817479647112, + 7725.079347333125, + 7737.5820033884729, + 7750.0897120437139, + 7762.6024692200581, + 7775.1202708469355, + 7787.6431128619733, + 7800.1709912109645, + 7812.7039018478481, + 7825.2418407346768, + 7837.7848038415968, + 7850.3327871468155, + 7862.8857866365806, + 7875.4437983051539, + 7888.006818154784, + 7900.5748421956796, + 7913.1478664459901, + 7925.725886931772, + 7938.3088996869719, + 7950.8969007533951, + 7963.4898861806851, + 7976.0878520262959, + 7988.6907943554688, + 8001.2987092412086, + 8013.911592764257, + 8026.5294410130691, + 8039.1522500837891, + 8051.7800160802271, + 8064.412735113835, + 8077.0504033036796, + 8089.6930167764222, + 8102.3405716662946, + 8114.9930641150731, + 8127.6504902720571, + 8140.3128462940449, + 8152.9801283453098, + 8165.6523325975786, + 8178.3294552300049, + 8191.0114924291529, + 8203.6984403889655, + 8216.3902953107463, + 8229.0870534031419, + 8241.7887108821069, + 8254.4952639708936, + 8267.2067089000211, + 8279.9230419072574, + 8292.6442592375952, + 8305.3703571432306, + 8318.101331883543, + 8330.8371797250657, + 8343.577896941475, + 8356.3234798135582, + 8369.0739246291978, + 8381.8292276833508, + 8394.5893852780209, + 8407.3543937222421, + 8420.1242493320569, + 8432.8989484304948, + 8445.6784873475499, + 8458.4628624201578, + 8471.2520699921806, + 8484.0461064143838, + 8496.8449680444082, + 8509.6486512467636, + 8522.4571523927953, + 8535.270467860666, + 8548.0885940353437, + 8560.9115273085663, + 8573.7392640788403, + 8586.5718007514006, + 8599.4091337382069, + 8612.2512594579148, + 8625.0981743358552, + 8637.9498748040205, + 8650.8063573010386, + 8663.6676182721567, + 8676.533654169225, + 8689.4044614506638, + 8702.2800365814601, + 8715.1603760331418, + 8728.0454762837508, + 8740.9353338178389, + 8753.8299451264356, + 8766.7293067070332, + 8779.6334150635721, + 8792.5422667064158, + 8805.4558581523324, + 8818.3741859244819, + 8831.2972465523908, + 8844.2250365719356, + 8857.1575525253265, + 8870.0947909610859, + 8883.0367484340295, + 8895.9834215052524, + 8908.934806742107, + 8921.8909007181846, + 8934.8517000132997, + 8947.817201213471, + 8960.7874009109, + 8973.7622957039603, + 8986.7418821971733, + 8999.7261570011924, + 9012.7151167327884, + 9025.7087580148236, + 9038.7070774762469, + 9051.7100717520643, + 9064.7177374833282, + 9077.7300713171153, + 9090.7470699065179, + 9103.7687299106146, + 9116.7950479944648, + 9129.8260208290812, + 9142.8616450914233, + 9155.9019174643727, + 9168.9468346367157, + 9181.9963933031358, + 9195.0505901641845, + 9208.1094219262741, + 9221.1728853016557, + 9234.240977008405, + 9247.3136937704076, + 9260.3910323173386, + 9273.472989384647, + 9286.5595617135423, + 9299.6507460509747, + 9312.7465391496207, + 9325.8469377678684, + 9338.9519386698012, + 9352.0615386251757, + 9365.1757344094131, + 9378.2945228035842, + 9391.4179005943843, + 9404.5458645741273, + 9417.6784115407263, + 9430.8155382976747, + 9443.9572416540359, + 9457.1035184244265, + 9470.2543654290002, + 9483.4097794934296, + 9496.5697574488931, + 9509.7342961320664, + 9522.9033923850911, + 9536.0770430555804, + 9549.2552449965824, + 9562.4379950665825, + 9575.6252901294793, + 9588.8171270545736, + 9602.0135027165488, + 9615.2144139954635, + 9628.4198577767274, + 9641.629830951093, + 9654.844330414644, + 9668.0633530687719, + 9681.286895820167, + 9694.5149555808002, + 9707.7475292679192, + 9720.9846138040157, + 9734.2262061168276, + 9747.4723031393187, + 9760.7229018096641, + 9773.9779990712323, + 9787.2375918725811, + 9800.5016771674327, + 9813.7702519146696, + 9827.0433130783094, + 9840.3208576275028, + 9853.602882536512, + 9866.8893847846994, + 9880.1803613565116, + 9893.4758092414686, + 9906.7757254341523, + 9920.0801069341851, + 9933.3889507462245, + 9946.7022538799429, + 9960.0200133500221, + 9973.3422261761298, + 9986.6688893829159, + 9999.9999999999945, + 10013.335555061929, + 10026.675551608221, + 10040.019986683301, + 10053.368857336509, + 10066.722160622081, + 10080.079893599144, + 10093.442053331697, + 10106.808636888598, + 10120.179641343551, + 10133.555063775095, + 10146.934901266595, + 10160.31915090622, + 10173.707809786936, + 10187.100875006496, + 10200.498343667417, + 10213.900212876984, + 10227.306479747222, + 10240.717141394889, + 10254.132194941467, + 10267.551637513146, + 10280.975466240814, + 10294.40367826004, + 10307.836270711066, + 10321.273240738796, + 10334.71458549278, + 10348.160302127204, + 10361.610387800878, + 10375.064839677221, + 10388.523654924258, + 10401.986830714593, + 10415.454364225412, + 10428.926252638465, + 10442.402493140049, + 10455.883082921007, + 10469.368019176709, + 10482.85729910704, + 10496.350919916393, + 10509.848878813653, + 10523.351173012188, + 10536.857799729838, + 10550.3687561889, + 10563.884039616123, + 10577.403647242685, + 10590.927576304197, + 10604.455824040679, + 10617.988387696556, + 10631.525264520642, + 10645.066451766135, + 10658.611946690598, + 10672.161746555956, + 10685.715848628475, + 10699.274250178762, + 10712.836948481747, + 10726.403940816675, + 10739.975224467091, + 10753.550796720834, + 10767.130654870027, + 10780.714796211059, + 10794.303218044579, + 10807.895917675487, + 10821.492892412922, + 10835.094139570248, + 10848.699656465047, + 10862.309440419107, + 10875.923488758415, + 10889.541798813138, + 10903.16436791762, + 10916.791193410372, + 10930.422272634056, + 10944.05760293548, + 10957.697181665582, + 10971.341006179427, + 10984.98907383619, + 10998.641381999149, + 11012.297928035676, + 11025.958709317223, + 11039.623723219316, + 11053.292967121541, + 11066.966438407539, + 11080.64413446499, + 11094.326052685608, + 11108.012190465128, + 11121.702545203296, + 11135.397114303863, + 11149.095895174571, + 11162.798885227143, + 11176.506081877278, + 11190.217482544635, + 11203.933084652828, + 11217.652885629415, + 11231.376882905886, + 11245.105073917659, + 11258.837456104062, + 11272.574026908333, + 11286.314783777601, + 11300.059724162888, + 11313.808845519083, + 11327.562145304952, + 11341.319620983111, + 11355.081270020033, + 11368.847089886023, + 11382.617078055218, + 11396.391232005579, + 11410.169549218874, + 11423.952027180676, + 11437.738663380349, + 11451.529455311042, + 11465.324400469679, + 11479.123496356951, + 11492.926740477304, + 11506.734130338931, + 11520.545663453764, + 11534.361337337466, + 11548.181149509423, + 11562.005097492724, + 11575.83317881417, + 11589.665391004253, + 11603.501731597149, + 11617.342198130715, + 11631.186788146468, + 11645.035499189589, + 11658.888328808911, + 11672.745274556904, + 11686.606333989675, + 11700.471504666955, + 11714.340784152086, + 11728.214170012021, + 11742.091659817312, + 11755.973251142101, + 11769.858941564111, + 11783.748728664636, + 11797.642610028539, + 11811.540583244237, + 11825.442645903697, + 11839.34879560242, + 11853.259029939445, + 11867.173346517333, + 11881.091742942155, + 11895.014216823492, + 11908.940765774427, + 11922.871387411526, + 11936.806079354839, + 11950.744839227897, + 11964.687664657684, + 11978.634553274653, + 11992.585502712702, + 12006.540510609168, + 12020.499574604828, + 12034.462692343877, + 12048.429861473938, + 12062.401079646032, + 12076.376344514589, + 12090.355653737433, + 12104.339004975769, + 12118.326395894188, + 12132.317824160644, + 12146.313287446457, + 12160.312783426305, + 12174.316309778205, + 12188.323864183525, + 12202.335444326955, + 12216.351047896511, + 12230.370672583531, + 12244.394316082657, + 12258.421976091831, + 12272.453650312296, + 12286.489336448574, + 12300.529032208471, + 12314.572735303058, + 12328.620443446678, + 12342.672154356922, + 12356.727865754638, + 12370.787575363909, + 12384.851280912055, + 12398.918980129623, + 12412.990670750381, + 12427.066350511306, + 12441.146017152583, + 12455.229668417589, + 12469.317302052901, + 12483.40891580827, + 12497.50450743663, + 12511.604074694078, + 12525.707615339878, + 12539.815127136444, + 12553.926607849342, + 12568.042055247275, + 12582.161467102082, + 12596.284841188726, + 12610.41217528529, + 12624.543467172971, + 12638.678714636069, + 12652.817915461985, + 12666.961067441209, + 12681.108168367316, + 12695.259216036962, + 12709.414208249869, + 12723.573142808827, + 12737.736017519681, + 12751.902830191326, + 12766.073578635704, + 12780.248260667788, + 12794.426874105588, + 12808.609416770132, + 12822.795886485468, + 12836.986281078653, + 12851.180598379744, + 12865.378836221802, + 12879.580992440871, + 12893.787064875984, + 12907.997051369144, + 12922.210949765335, + 12936.428757912496, + 12950.650473661524, + 12964.876094866273, + 12979.105619383534, + 12993.339045073039, + 13007.576369797454, + 13021.817591422368, + 13036.062707816285, + 13050.311716850629, + 13064.564616399723, + 13078.821404340792, + 13093.082078553954, + 13107.346636922217, + 13121.615077331464, + 13135.887397670458, + 13150.163595830827, + 13164.44366970706, + 13178.727617196502, + 13193.015436199352, + 13207.307124618648, + 13221.602680360265, + 13235.902101332911, + 13250.205385448118, + 13264.512530620239, + 13278.823534766434, + 13293.138395806676, + 13307.457111663734, + 13321.779680263176, + 13336.106099533356, + 13350.436367405409, + 13364.77048181325, + 13379.108440693562, + 13393.450241985796, + 13407.795883632158, + 13422.145363577607, + 13436.498679769853, + 13450.855830159346, + 13465.216812699266, + 13479.581625345529, + 13493.950266056772, + 13508.32273279435, + 13522.699023522329, + 13537.079136207483, + 13551.463068819286, + 13565.850819329906, + 13580.2423857142, + 13594.63776594971, + 13609.036958016657, + 13623.439959897927, + 13637.846769579081, + 13652.257385048335, + 13666.67180429656, + 13681.090025317284, + 13695.512046106669, + 13709.937864663521, + 13724.367478989278, + 13738.800887088004, + 13753.238086966385, + 13767.679076633727, + 13782.123854101939, + 13796.572417385545, + 13811.024764501659, + 13825.480893469998, + 13839.94080231286, + 13854.404489055134, + 13868.871951724283, + 13883.34318835034, + 13897.818196965914, + 13912.296975606168, + 13926.779522308825, + 13941.26583511416, + 13955.755912064991, + 13970.249751206682, + 13984.747350587126, + 13999.248708256751, + 14013.753822268511, + 14028.262690677873, + 14042.775311542828, + 14057.291682923867, + 14071.811802883994, + 14086.335669488704, + 14100.863280805994, + 14115.394634906341, + 14129.92972986271, + 14144.468563750548, + 14159.01113464777, + 14173.55744063476, + 14188.107479794369, + 14202.661250211901, + 14217.218749975118, + 14231.779977174227, + 14246.344929901879, + 14260.913606253163, + 14275.486004325601, + 14290.062122219146, + 14304.641958036171, + 14319.225509881464, + 14333.812775862236, + 14348.403754088098, + 14362.998442671067, + 14377.59683972556, + 14392.198943368388, + 14406.804751718748, + 14421.414262898223, + 14436.027475030774, + 14450.64438624274, + 14465.264994662828, + 14479.889298422106, + 14494.517295654005, + 14509.148984494313, + 14523.784363081166, + 14538.423429555049, + 14553.066182058781, + 14567.712618737527, + 14582.362737738777, + 14597.016537212348, + 14611.674015310382, + 14626.33517018734, + 14640.999999999993, + 14655.668502907418, + 14670.340677071003, + 14685.016520654426, + 14699.696031823671, + 14714.379208746999, + 14729.066049594967, + 14743.756552540408, + 14758.45071575843, + 14773.148537426418, + 14787.850015724018, + 14802.555148833142, + 14817.263934937961, + 14831.976372224897, + 14846.692458882624, + 14861.41219310206, + 14876.135573076363, + 14890.862597000923, + 14905.593263073371, + 14920.327569493558, + 14935.065514463557, + 14949.807096187662, + 14964.552312872382, + 14979.301162726431, + 14994.053643960735, + 15008.809754788414, + 15023.569493424788, + 15038.332858087369, + 15053.099846995858, + 15067.870458372134, + 15082.644690440264, + 15097.422541426484, + 15112.204009559202, + 15126.989093068994, + 15141.777790188597, + 15156.570099152905, + 15171.366018198967, + 15186.165545565986, + 15200.968679495301, + 15215.775418230402, + 15230.585760016909, + 15245.399703102579, + 15260.217245737298, + 15275.038386173073, + 15289.863122664035, + 15304.691453466432, + 15319.523376838621, + 15334.358891041069, + 15349.197994336346, + 15364.040684989128, + 15378.886961266177, + 15393.736821436356, + 15408.590263770609, + 15423.447286541972, + 15438.307888025554, + 15453.172066498542, + 15468.039820240196, + 15482.91114753184, + 15497.786046656869, + 15512.664515900733, + 15527.546553550939, + 15542.432157897045, + 15557.32132723066, + 15572.214059845435, + 15587.110354037064, + 15602.010208103273, + 15616.913620343823, + 15631.820589060506, + 15646.731112557136, + 15661.645189139546, + 15676.562817115593, + 15691.483994795139, + 15706.408720490062, + 15721.336992514242, + 15736.268809183561, + 15751.204168815901, + 15766.143069731135, + 15781.085510251132, + 15796.03148869974, + 15810.981003402798, + 15825.934052688119, + 15840.890634885489, + 15855.850748326673, + 15870.814391345401, + 15885.781562277361, + 15900.752259460214, + 15915.726481233565, + 15930.704225938984, + 15945.685491919978, + 15960.670277522009, + 15975.658581092481, + 15990.65040098073, + 16005.645735538035, + 16020.644583117599, + 16035.646942074556, + 16050.652810765967, + 16065.662187550806, + 16080.675070789974, + 16095.691458846273, + 16110.711350084424, + 16125.734742871053, + 16140.761635574685, + 16155.792026565747, + 16170.825914216561, + 16185.863296901338, + 16200.904172996183, + 16215.948540879079, + 16230.996398929899, + 16246.047745530386, + 16261.102579064163, + 16276.160897916721, + 16291.22270047542, + 16306.287985129484, + 16321.356750269995, + 16336.428994289896, + 16351.504715583982, + 16366.5839125489, + 16381.666583583141, + 16396.752727087041, + 16411.842341462776, + 16426.935425114363, + 16442.031976447644, + 16457.131993870298, + 16472.235475791829, + 16487.342420623561, + 16502.452826778641, + 16517.566692672033, + 16532.684016720516, + 16547.804797342676, + 16562.929032958902, + 16578.056721991394, + 16593.18786286415, + 16608.322454002962, + 16623.460493835417, + 16638.601980790896, + 16653.746913300558, + 16668.895289797354, + 16684.047108716015, + 16699.202368493046, + 16714.361067566726, + 16729.523204377107, + 16744.688777366009, + 16759.857784977012, + 16775.030225655464, + 16790.206097848466, + 16805.385400004874, + 16820.568130575302, + 16835.754288012104, + 16850.943870769381, + 16866.136877302983, + 16881.333306070494, + 16896.53315553123, + 16911.736424146249, + 16926.943110378332, + 16942.153212691992, + 16957.366729553454, + 16972.583659430682, + 16987.804000793338, + 17003.027752112816, + 17018.254911862205, + 17033.485478516312, + 17048.719450551645, + 17063.956826446421, + 17079.197604680547, + 17094.44178373563, + 17109.689362094967, + 17124.940338243552, + 17140.194710668064, + 17155.452477856852, + 17170.713638299967, + 17185.978190489128, + 17201.246132917724, + 17216.517464080825, + 17231.792182475165, + 17247.070286599141, + 17262.351774952826, + 17277.636646037936, + 17292.924898357855, + 17308.216530417623, + 17323.511540723921, + 17338.809927785089, + 17354.111690111105, + 17369.416826213594, + 17384.725334605821, + 17400.037213802683, + 17415.352462320716, + 17430.67107867809, + 17445.993061394587, + 17461.318408991636, + 17476.647119992274, + 17491.979192921168, + 17507.314626304586, + 17522.653418670423, + 17537.995568548187, + 17553.341074468986, + 17568.689934965536, + 17584.042148572156, + 17599.397713824768, + 17614.75662926089, + 17630.118893419625, + 17645.484504841683, + 17660.853462069354, + 17676.225763646511, + 17691.601408118619, + 17706.980394032718, + 17722.362719937424, + 17737.748384382936, + 17753.137385921014, + 17768.529723104999, + 17783.92539448979, + 17799.324398631856, + 17814.726734089225, + 17830.13239942148, + 17845.541393189767, + 17860.95371395678, + 17876.369360286772, + 17891.788330745527, + 17907.210623900395, + 17922.636238320254, + 17938.065172575527, + 17953.497425238176, + 17968.932994881692, + 17984.371880081104, + 17999.814079412972, + 18015.259591455371, + 18030.708414787914, + 18046.160547991731, + 18061.615989649465, + 18077.074738345284, + 18092.536792664861, + 18108.002151195393, + 18123.470812525571, + 18138.942775245599, + 18154.418037947191, + 18169.896599223546, + 18185.37845766938, + 18200.863611880886, + 18216.352060455767, + 18231.843801993204, + 18247.338835093873, + 18262.837158359936, + 18278.338770395032, + 18293.84366980429, + 18309.351855194309, + 18324.863325173166, + 18340.378078350412, + 18355.896113337069, + 18371.417428745623, + 18386.942023190033, + 18402.469895285718, + 18418.00104364955, + 18433.53546689987, + 18449.073163656474, + 18464.614132540602, + 18480.158372174956, + 18495.705881183676, + 18511.256658192357, + 18526.810701828035, + 18542.368010719183, + 18557.928583495715, + 18573.492418788985, + 18589.059515231773, + 18604.629871458303, + 18620.203486104212, + 18635.78035780658, + 18651.360485203899, + 18666.943866936086, + 18682.53050164448, + 18698.120387971841, + 18713.713524562332, + 18729.30991006154, + 18744.909543116457, + 18760.512422375479, + 18776.118546488418, + 18791.727914106479, + 18807.340523882274, + 18822.95637446981, + 18838.575464524489, + 18854.197792703111, + 18869.823357663863, + 18885.452158066328, + 18901.08419257147, + 18916.719459841639, + 18932.357958540564, + 18947.999687333362, + 18963.644644886521, + 18979.292829867907, + 18994.944240946759, + 19010.598876793687, + 19026.256736080668, + 19041.917817481048, + 19057.582119669532, + 19073.2496413222, + 19088.920381116473, + 19104.594337731145, + 19120.271509846356, + 19135.951896143604, + 19151.635495305738, + 19167.322306016948, + 19183.012326962784, + 19198.705556830122, + 19214.401994307198, + 19230.101638083579, + 19245.804486850167, + 19261.510539299208, + 19277.219794124274, + 19292.932250020265, + 19308.647905683421, + 19324.366759811302, + 19340.088811102793, + 19355.8140582581, + 19371.542499978754, + 19387.2741349676, + 19403.008961928797, + 19418.746979567823, + 19434.488186591469, + 19450.232581707827, + 19465.980163626304, + 19481.730931057613, + 19497.484882713761, + 19513.242017308068, + 19529.002333555141, + 19544.765830170898, + 19560.532505872539, + 19576.302359378566, + 19592.075389408761, + 19607.851594684209, + 19623.630973927269, + 19639.41352586159, + 19655.199249212103, + 19670.988142705017, + 19686.780205067826, + 19702.575435029288, + 19718.373831319448, + 19734.175392669615, + 19749.980117812371, + 19765.788005481569, + 19781.599054412323, + 19797.413263341008, + 19813.230631005274, + 19829.051156144014, + 19844.874837497395, + 19860.701673806827, + 19876.531663814985, + 19892.364806265789, + 19908.201099904403, + 19924.040543477258, + 19939.883135732012, + 19955.728875417579, + 19971.577761284105, + 19987.429792082985, + 20003.284966566847, + 20019.14328348956, + 20035.004741606219, + 20050.869339673161, + 20066.737076447946, + 20082.607950689362, + 20098.481961157428, + 20114.359106613385, + 20130.239385819699, + 20146.122797540058, + 20162.009340539353, + 20177.899013583716, + 20193.791815440476, + 20209.687744878182, + 20225.586800666591, + 20241.488981576669, + 20257.394286380597, + 20273.302713851754, + 20289.214262764715, + 20305.128931895277, + 20321.046720020415, + 20336.967625918318, + 20352.891648368361, + 20368.818786151114, + 20384.749038048347, + 20400.682402843009, + 20416.618879319249, + 20432.558466262391, + 20448.501162458953, + 20464.446966696629, + 20480.395877764302, + 20496.347894452025, + 20512.303015551031, + 20528.261239853735, + 20544.22256615372, + 20560.186993245738, + 20576.15451992572, + 20592.125144990758, + 20608.098867239107, + 20624.075685470198, + 20640.055598484618, + 20656.038605084115, + 20672.024704071595, + 20688.013894251126, + 20704.006174427926, + 20720.001543408373, + 20735.999999999989, + 20752.001543011454, + 20768.006171252597, + 20784.013883534382, + 20800.024678668931, + 20816.038555469506, + 20832.055512750507, + 20848.075549327474, + 20864.098664017085, + 20880.124855637161, + 20896.154123006647, + 20912.186464945626, + 20928.221880275312, + 20944.260367818049, + 20960.301926397311, + 20976.346554837684, + 20992.394251964895, + 21008.445016605787, + 21024.498847588318, + 21040.555743741574, + 21056.615703895754, + 21072.678726882168, + 21088.744811533252, + 21104.813956682538, + 21120.886161164683, + 21136.961423815443, + 21153.039743471683, + 21169.121118971379, + 21185.205549153605, + 21201.293032858535, + 21217.383568927453, + 21233.477156202731, + 21249.573793527841, + 21265.673479747358, + 21281.776213706937, + 21297.881994253334, + 21313.990820234398, + 21330.102690499054, + 21346.21760389733, + 21362.335559280327, + 21378.456555500241, + 21394.580591410333, + 21410.707665864964, + 21426.83777771956, + 21442.970925830628, + 21459.107109055756, + 21475.246326253604, + 21491.388576283895, + 21507.533858007431, + 21523.682170286087, + 21539.833511982797, + 21555.987881961566, + 21572.145279087465, + 21588.305702226615, + 21604.469150246216, + 21620.635622014521, + 21636.805116400832, + 21652.977632275521, + 21669.153168510009, + 21685.331723976764, + 21701.513297549318, + 21717.697888102244, + 21733.885494511167, + 21750.076115652759, + 21766.269750404736, + 21782.466397645861, + 21798.666056255934, + 21814.868725115801, + 21831.074403107345, + 21847.283089113484, + 21863.494782018177, + 21879.709480706417, + 21895.927184064229, + 21912.147890978667, + 21928.371600337818, + 21944.598311030797, + 21960.828021947746, + 21977.060731979829, + 21993.296440019243, + 22009.535144959198, + 22025.77684569393, + 22042.021541118691, + 22058.269230129757, + 22074.519911624411, + 22090.773584500959, + 22107.030247658717, + 22123.289899998013, + 22139.552540420187, + 22155.818167827587, + 22172.086781123569, + 22188.358379212495, + 22204.632960999726, + 22220.910525391639, + 22237.191071295601, + 22253.474597619981, + 22269.761103274148, + 22286.050587168469, + 22302.343048214312, + 22318.638485324027, + 22334.936897410968, + 22351.23828338947, + 22367.542642174871, + 22383.849972683485, + 22400.160273832618, + 22416.473544540564, + 22432.789783726603, + 22449.108990310986, + 22465.431163214958, + 22481.75630136074, + 22498.084403671528, + 22514.415469071497, + 22530.749496485802, + 22547.086484840562, + 22563.426433062879, + 22579.769340080824, + 22596.115204823436, + 22612.464026220721, + 22628.815803203655, + 22645.170534704179, + 22661.5282196552, + 22677.888856990587, + 22694.252445645168, + 22710.618984554734, + 22726.988472656034, + 22743.360908886778, + 22759.736292185622, + 22776.114621492186, + 22792.495895747044, + 22808.880113891719, + 22825.267274868678, + 22841.657377621348, + 22858.050421094096, + 22874.446404232243, + 22890.845325982053, + 22907.247185290722, + 22923.651981106406, + 22940.059712378195, + 22956.470378056114, + 22972.883977091129, + 22989.300508435153, + 23005.719971041017, + 23022.142363862498, + 23038.567685854305, + 23054.995935972078, + 23071.427113172387, + 23087.86121641273, + 23104.298244651531, + 23120.738196848146, + 23137.181071962848, + 23153.626868956846, + 23170.075586792263, + 23186.527224432142, + 23202.981780840448, + 23219.439254982066, + 23235.899645822796, + 23252.362952329357, + 23268.829173469378, + 23285.298308211408, + 23301.770355524899, + 23318.245314380223, + 23334.723183748658, + 23351.203962602387, + 23367.687649914504, + 23384.174244659007, + 23400.663745810798, + 23417.15615234568, + 23433.651463240367, + 23450.149677472462, + 23466.650794020472, + 23483.154811863806, + 23499.661729982763, + 23516.171547358543, + 23532.684262973235, + 23549.199875809823, + 23565.718384852185, + 23582.239789085092, + 23598.764087494197, + 23615.291279066041, + 23631.821362788058, + 23648.354337648565, + 23664.890202636761, + 23681.428956742733, + 23697.970598957443, + 23714.515128272738, + 23731.062543681343, + 23747.612844176863, + 23764.166028753778, + 23780.72209640744, + 23797.281046134085, + 23813.842876930816, + 23830.407587795606, + 23846.975177727301, + 23863.545645725622, + 23880.11899079115, + 23896.695211925336, + 23913.274308130498, + 23929.856278409821, + 23946.441121767348, + 23963.028837207989, + 23979.619423737513, + 23996.212880362549, + 24012.809206090584, + 24029.408399929966, + 24046.010460889898, + 24062.615387980433, + 24079.223180212492, + 24095.833836597827, + 24112.447356149063, + 24129.063737879667, + 24145.682980803951, + 24162.305083937081, + 24178.930046295067, + 24195.557866894767, + 24212.188544753884, + 24228.822078890964, + 24245.458468325389, + 24262.097712077397, + 24278.739809168052, + 24295.384758619261, + 24312.032559453768, + 24328.683210695162, + 24345.336711367858, + 24361.993060497109, + 24378.652257108995, + 24395.314300230442, + 24411.979188889192, + 24428.646922113825, + 24445.317498933746, + 24461.990918379193, + 24478.667179481225, + 24495.346281271726, + 24512.028222783407, + 24528.713003049801, + 24545.400621105266, + 24562.091075984976, + 24578.784366724925, + 24595.480492361927, + 24612.179451933614, + 24628.881244478438, + 24645.585869035654, + 24662.293324645343, + 24679.003610348394, + 24695.716725186514, + 24712.432668202211, + 24729.151438438807, + 24745.873034940436, + 24762.597456752032, + 24779.324702919344, + 24796.054772488926, + 24812.787664508123, + 24829.5233780251, + 24846.261912088819, + 24863.003265749034, + 24879.747438056307, + 24896.494428062004, + 24913.244234818278, + 24929.996857378079, + 24946.752294795166, + 24963.510546124078, + 24980.271610420157, + 24997.035486739525, + 25013.802174139113, + 25030.571671676629, + 25047.343978410572, + 25064.119093400237, + 25080.897015705697, + 25097.677744387816, + 25114.461278508239, + 25131.2476171294, + 25148.036759314517, + 25164.828704127583, + 25181.623450633375, + 25198.42099789745, + 25215.221344986145, + 25232.024490966574, + 25248.830434906627, + 25265.639175874974, + 25282.450712941049, + 25299.265045175071, + 25316.082171648024, + 25332.902091431668, + 25349.724803598532, + 25366.550307221914, + 25383.378601375884, + 25400.209685135269, + 25417.043557575678, + 25433.880217773472, + 25450.719664805783, + 25467.561897750507, + 25484.406915686297, + 25501.254717692573, + 25518.105302849512, + 25534.958670238051, + 25551.814818939893, + 25568.67374803748, + 25585.535456614027, + 25602.399943753502, + 25619.267208540619, + 25636.137250060852, + 25653.010067400432, + 25669.885659646327, + 25686.76402588627, + 25703.645165208734, + 25720.529076702944, + 25737.415759458876, + 25754.305212567244, + 25771.197435119517, + 25788.092426207899, + 25804.990184925344, + 25821.890710365547, + 25838.794001622944, + 25855.700057792714, + 25872.608877970775, + 25889.520461253778, + 25906.434806739118, + 25923.351913524923, + 25940.271780710063, + 25957.194407394138, + 25974.11979267748, + 25991.047935661154, + 26007.978835446964, + 26024.912491137442, + 26041.848901835841, + 26058.788066646157, + 26075.729984673108, + 26092.674655022136, + 26109.622076799409, + 26126.572249111829, + 26143.525171067016, + 26160.480841773315, + 26177.43926033979, + 26194.400425876229, + 26211.364337493149, + 26228.330994301767, + 26245.30039541404, + 26262.272539942627, + 26279.247427000919, + 26296.225055703002, + 26313.205425163702, + 26330.188534498539, + 26347.174382823756, + 26364.162969256304, + 26381.154292913852, + 26398.148352914774, + 26415.145148378149, + 26432.144678423778, + 26449.146942172156, + 26466.151938744493, + 26483.159667262702, + 26500.170126849403, + 26517.183316627921, + 26534.199235722277, + 26551.217883257199, + 26568.239258358124, + 26585.263360151173, + 26602.290187763181, + 26619.319740321676, + 26636.352016954883, + 26653.387016791727, + 26670.424738961825, + 26687.465182595493, + 26704.508346823739, + 26721.554230778267, + 26738.602833591467, + 26755.65415439643, + 26772.708192326929, + 26789.764946517433, + 26806.824416103096, + 26823.886600219761, + 26840.95149800396, + 26858.019108592915, + 26875.089431124517, + 26892.162464737365, + 26909.238208570721, + 26926.316661764544, + 26943.397823459472, + 26960.481692796813, + 26977.568268918571, + 26994.657550967422, + 27011.749538086722, + 27028.844229420498, + 27045.941624113464, + 27063.041721311005, + 27080.144520159181, + 27097.250019804727, + 27114.35821939505, + 27131.469118078236, + 27148.582715003027, + 27165.699009318858, + 27182.818000175819, + 27199.939686724665, + 27217.064068116837, + 27234.191143504428, + 27251.320912040203, + 27268.453372877593, + 27285.588525170693, + 27302.726368074269, + 27319.866900743735, + 27337.010122335181, + 27354.156032005358, + 27371.304628911668, + 27388.455912212183, + 27405.609881065626, + 27422.766534631384, + 27439.925872069507, + 27457.087892540683, + 27474.252595206275, + 27491.419979228293, + 27508.5900437694, + 27525.762787992917, + 27542.93821106281, + 27560.116312143706, + 27577.297090400876, + 27594.480545000242, + 27611.666675108383, + 27628.855479892518, + 27646.046958520514, + 27663.241110160889, + 27680.437933982801, + 27697.637429156068, + 27714.839594851132, + 27732.04443023909, + 27749.251934491687, + 27766.462106781299, + 27783.674946280949, + 27800.890452164302, + 27818.108623605654, + 27835.329459779954, + 27852.55295986278, + 27869.779123030345, + 27887.007948459504, + 27904.239435327745, + 27921.473582813196, + 27938.710390094613, + 27955.949856351392, + 27973.19198076355, + 27990.436762511745, + 28007.684200777272, + 28024.934294742041, + 28042.187043588601, + 28059.442446500128, + 28076.700502660427, + 28093.961211253929, + 28111.224571465693, + 28128.490582481401, + 28145.759243487362, + 28163.030553670509, + 28180.304512218394, + 28197.581118319198, + 28214.860371161725, + 28232.14226993539, + 28249.42681383024, + 28266.71400203693, + 28284.003833746745, + 28301.296308151585, + 28318.591424443959, + 28335.889181817001, + 28353.189579464462, + 28370.492616580705, + 28387.798292360701, + 28405.106606000048, + 28422.417556694945, + 28439.731143642206, + 28457.047366039264, + 28474.366223084147, + 28491.687713975512, + 28509.011837912611, + 28526.338594095305, + 28543.667981724069, + 28560.999999999982, + 28578.334648124732, + 28595.671925300605, + 28613.011830730498, + 28630.354363617909, + 28647.699523166943, + 28665.0473085823, + 28682.397719069289, + 28699.750753833818, + 28717.10641208239, + 28734.464693022121, + 28751.825595860708, + 28769.189119806462, + 28786.55526406828, + 28803.924027855664, + 28821.295410378701, + 28838.669410848088, + 28856.046028475103, + 28873.425262471628, + 28890.80711205013, + 28908.191576423673, + 28925.578654805915, + 28942.968346411097, + 28960.360650454055, + 28977.755566150216, + 28995.153092715591, + 29012.553229366786, + 29029.955975320987, + 29047.361329795975, + 29064.769292010107, + 29082.179861182336, + 29099.593036532187, + 29117.00881727978, + 29134.427202645813, + 29151.848191851568, + 29169.271784118911, + 29186.697978670283, + 29204.126774728706, + 29221.55817151779, + 29238.992168261717, + 29256.42876418525, + 29273.867958513725, + 29291.309750473058, + 29308.754139289747, + 29326.201124190855, + 29343.65070440403, + 29361.102879157483, + 29378.557647680012, + 29396.015009200975, + 29413.474962950309, + 29430.937508158524, + 29448.402644056692, + 29465.870369876469, + 29483.340684850071, + 29500.81358821028, + 29518.289079190454, + 29535.767157024511, + 29553.247820946945, + 29570.731070192807, + 29588.216903997723, + 29605.70532159787, + 29623.19632223, + 29640.689905131429, + 29658.186069540028, + 29675.684814694236, + 29693.186139833047, + 29710.690044196028, + 29728.196527023298, + 29745.705587555527, + 29763.217225033964, + 29780.731438700397, + 29798.248227797183, + 29815.76759156723, + 29833.289529254005, + 29850.81404010153, + 29868.341123354381, + 29885.870778257693, + 29903.403004057145, + 29920.937799998974, + 29938.475165329975, + 29956.015099297485, + 29973.557601149394, + 29991.102670134147, + 30008.650305500738, + 30026.200506498706, + 30043.753272378144, + 30061.308602389683, + 30078.866495784507, + 30096.426951814352, + 30113.989969731494, + 30131.55554878875, + 30149.123688239491, + 30166.694387337629, + 30184.267645337608, + 30201.843461494434, + 30219.42183506364, + 30237.002765301309, + 30254.586251464058, + 30272.172292809046, + 30289.760888593977, + 30307.35203807709, + 30324.94574051716, + 30342.541995173502, + 30360.140801305966, + 30377.742158174944, + 30395.346065041358, + 30412.952521166666, + 30430.561525812864, + 30448.173078242475, + 30465.787177718561, + 30483.403823504719, + 30501.02301486507, + 30518.644751064272, + 30536.269031367516, + 30553.895855040515, + 30571.525221349519, + 30589.157129561307, + 30606.791578943175, + 30624.428568762964, + 30642.06809828903, + 30659.710166790261, + 30677.35477353607, + 30695.001917796391, + 30712.651598841687, + 30730.303815942945, + 30747.958568371676, + 30765.615855399912, + 30783.275676300211, + 30800.938030345646, + 30818.602916809814, + 30836.270334966837, + 30853.940284091354, + 30871.612763458521, + 30889.287772344011, + 30906.965310024025, + 30924.645375775272, + 30942.327968874983, + 30960.013088600903, + 30977.700734231294, + 30995.390905044929, + 31013.083600321101, + 31030.778819339619, + 31048.476561380798, + 31066.17682572547, + 31083.879611654978, + 31101.584918451179, + 31119.29274539644, + 31137.003091773637, + 31154.715956866155, + 31172.431339957893, + 31190.14924033326, + 31207.869657277162, + 31225.592590075023, + 31243.318038012771, + 31261.046000376838, + 31278.776476454172, + 31296.50946553221, + 31314.24496689891, + 31331.98297984272, + 31349.7235036526, + 31367.466537618013, + 31385.212081028923, + 31402.960133175795, + 31420.710693349596, + 31438.463760841791, + 31456.219334944351, + 31473.977414949743, + 31491.738000150934, + 31509.501089841389, + 31527.266683315069, + 31545.034779866437, + 31562.80537879045, + 31580.578479382562, + 31598.35408093872, + 31616.132182755369, + 31633.91278412945, + 31651.695884358396, + 31669.481482740131, + 31687.269578573076, + 31705.060171156143, + 31722.853259788735, + 31740.648843770748, + 31758.446922402567, + 31776.247494985066, + 31794.050560819614, + 31811.85611920806, + 31829.664169452753, + 31847.474710856521, + 31865.287742722685, + 31883.103264355046, + 31900.921275057899, + 31918.741774136019, + 31936.564760894671, + 31954.390234639599, + 31972.21819467704, + 31990.048640313704, + 32007.881570856793, + 32025.716985613984, + 32043.554883893445, + 32061.395265003815, + 32079.238128254223, + 32097.083472954269, + 32114.931298414049, + 32132.781603944117, + 32150.634388855524, + 32168.48965245979, + 32186.347394068915, + 32204.207612995371, + 32222.07030855212, + 32239.935480052583, + 32257.803126810672, + 32275.673248140767, + 32293.545843357719, + 32311.420911776862, + 32329.298452713996, + 32347.178465485395, + 32365.060949407813, + 32382.945903798463, + 32400.83332797504, + 32418.723221255706, + 32436.615582959093, + 32454.510412404306, + 32472.407708910916, + 32490.307471798966, + 32508.209700388961, + 32526.114394001877, + 32544.021551959166, + 32561.931173582732, + 32579.843258194956, + 32597.757805118679, + 32615.674813677211, + 32633.594283194328, + 32651.516212994258, + 32669.440602401712, + 32687.367450741847, + 32705.296757340297, + 32723.228521523146, + 32741.162742616943, + 32759.099419948703, + 32777.038552845901, + 32794.980140636464, + 32812.924182648792, + 32830.87067821173, + 32848.819626654593, + 32866.77102730715, + 32884.724879499619, + 32902.681182562686, + 32920.639935827494, + 32938.601138625643, + 32956.56479028918, + 32974.530890150607, + 32992.499437542894, + 33010.470431799447, + 33028.443872254145, + 33046.419758241311, + 33064.39808909571, + 33082.378864152583, + 33100.36208274759, + 33118.347744216881, + 33136.335847897026, + 33154.326393125062, + 33172.31937923847, + 33190.314805575174, + 33208.312671473555, + 33226.312976272442, + 33244.315719311111, + 33262.320899929284, + 33280.328517467125, + 33298.33857126526, + 33316.351060664747, + 33334.365985007091, + 33352.383343634239, + 33370.403135888591, + 33388.42536111299, + 33406.450018650721, + 33424.477107845501, + 33442.506628041512, + 33460.53857858335, + 33478.572958816083, + 33496.609768085189, + 33514.649005736617, + 33532.690671116739, + 33550.734763572356, + 33568.781282450735, + 33586.830227099563, + 33604.881596866973, + 33622.935391101528, + 33640.991609152239, + 33659.050250368542, + 33677.111314100322, + 33695.174799697881, + 33713.240706511984, + 33731.309033893805, + 33749.37978119497, + 33767.452947767531, + 33785.528532963974, + 33803.606536137209, + 33821.686956640602, + 33839.769793827938, + 33857.855047053425, + 33875.942715671707, + 33894.032799037872, + 33912.125296507431, + 33930.220207436316, + 33948.317531180888, + 33966.417267097961, + 33984.519414544746, + 34002.623972878901, + 34020.730941458511, + 34038.840319642077, + 34056.952106788536, + 34075.066302257255, + 34093.182905408015, + 34111.301915601027, + 34129.42333219693, + 34147.547154556785, + 34165.673382042078, + 34183.80201401472, + 34201.933049837033, + 34220.06648887178, + 34238.202330482141, + 34256.340574031703, + 34274.481218884495, + 34292.624264404949, + 34310.769709957938, + 34328.91755490873, + 34347.067798623029, + 34365.220440466954, + 34383.375479807051, + 34401.532916010263, + 34419.692748443973, + 34437.854976475966, + 34456.01959947445, + 34474.18661680806, + 34492.356027845817, + 34510.527831957188, + 34528.702028512052, + 34546.878616880676, + 34565.05759643377, + 34583.238966542449, + 34601.422726578232, + 34619.608875913065, + 34637.797413919296, + 34655.988339969692, + 34674.181653437423, + 34692.37735369608, + 34710.575440119668, + 34728.775912082579, + 34746.978768959649, + 34765.184010126082, + 34783.391634957537, + 34801.60164283005, + 34819.814033120063, + 34838.028805204456, + 34856.24595846048, + 34874.465492265823, + 34892.687405998557, + 34910.911699037177, + 34929.138370760564, + 34947.367420548027, + 34965.598847779271, + 34983.832651834389, + 35002.068832093908, + 35020.307387938738, + 35038.548318750189, + 35056.79162390998, + 35075.03730280025, + 35093.285354803513, + 35111.535779302685, + 35129.788575681116, + 35148.043743322516, + 35166.301281611013, + 35184.561189931141, + 35202.823467667826, + 35221.088114206388, + 35239.355128932555, + 35257.624511232447, + 35275.896260492584, + 35294.170376099886, + 35312.446857441668, + 35330.725703905628, + 35349.006914879887, + 35367.290489752944, + 35385.576427913686, + 35403.864728751418, + 35422.155391655811, + 35440.448416016967, + 35458.743801225341, + 35477.041546671804, + 35495.341651747622, + 35513.644115844436, + 35531.948938354304, + 35550.256118669655, + 35568.565656183309, + 35586.877550288496, + 35605.191800378816, + 35623.508405848268, + 35641.827366091238, + 35660.148680502505, + 35678.472348477233, + 35696.798369410979, + 35715.126742699678, + 35733.457467739659, + 35751.790543927644, + 35770.125970660738, + 35788.46374733642, + 35806.803873352568, + 35825.146348107453, + 35843.49117099971, + 35861.838341428367, + 35880.187858792851, + 35898.539722492955, + 35916.893931928862, + 35935.250486501129, + 35953.609385610718, + 35971.970628658957, + 35990.334215047558, + 36008.700144178612, + 36027.068415454596, + 36045.439028278372, + 36063.811982053165, + 36082.187276182609, + 36100.564910070694, + 36118.944883121789, + 36137.327194740654, + 36155.711844332429, + 36174.098831302617, + 36192.488155057115, + 36210.87981500219, + 36229.273810544473, + 36247.670141091003, + 36266.068806049167, + 36284.469804826738, + 36302.873136831862, + 36321.278801473069, + 36339.686798159251, + 36358.097126299683, + 36376.509785304013, + 36394.924774582258, + 36413.342093544816, + 36431.761741602444, + 36450.183718166292, + 36468.608022647859, + 36487.034654459028, + 36505.463613012063, + 36523.894897719583, + 36542.328507994578, + 36560.764443250409, + 36579.202702900831, + 36597.643286359926, + 36616.086193042182, + 36634.531422362437, + 36652.978973735895, + 36671.428846578143, + 36689.881040305125, + 36708.335554333149, + 36726.792388078902, + 36745.251540959427, + 36763.713012392138, + 36782.176801794812, + 36800.642908585593, + 36819.111332182983, + 36837.582072005869, + 36856.055127473483, + 36874.530498005421, + 36893.008183021651, + 36911.488181942506, + 36929.970494188674, + 36948.455119181206, + 36966.942056341519, + 36985.431305091392, + 37003.922864852961, + 37022.416735048733, + 37040.912915101559, + 37059.411404434657, + 37077.91220247162, + 37096.415308636388, + 37114.920722353243, + 37133.428443046862, + 37151.938470142253, + 37170.450803064785, + 37188.965441240209, + 37207.482384094597, + 37226.001631054402, + 37244.523181546429, + 37263.047034997842, + 37281.573190836149, + 37300.101648489224, + 37318.632407385296, + 37337.165466952945, + 37355.700826621112, + 37374.238485819085, + 37392.778443976509, + 37411.320700523385, + 37429.865254890057, + 37448.412106507232, + 37466.961254805974, + 37485.512699217681, + 37504.066439174116, + 37522.622474107404, + 37541.180803449992, + 37559.741426634704, + 37578.304343094693, + 37596.869552263488, + 37615.43705357494, + 37634.006846463279, + 37652.578930363044, + 37671.153304709165, + 37689.729968936896, + 37708.308922481847, + 37726.890164779965, + 37745.473695267559, + 37764.059513381275, + 37782.647618558112, + 37801.238010235415, + 37819.830687850859, + 37838.425650842495, + 37857.022898648691, + 37875.622430708172, + 37894.224246460013, + 37912.828345343616, + 37931.434726798747, + 37950.043390265506, + 37968.654335184328, + 37987.267560995999, + 38005.883067141665, + 38024.500853062775, + 38043.120918201159, + 38061.743261998963, + 38080.367883898682, + 38098.994783343158, + 38117.623959775563, + 38136.255412639417, + 38154.889141378575, + 38173.525145437234, + 38192.163424259939, + 38210.803977291551, + 38229.446803977284, + 38248.091903762703, + 38266.739276093685, + 38285.388920416466, + 38304.040836177606, + 38322.695022824002, + 38341.351479802899, + 38360.010206561863, + 38378.671202548816, + 38397.334467211993, + 38415.999999999978, + 38434.667800361683, + 38453.33786774637, + 38472.010201603611, + 38490.684801383337, + 38509.361666535784, + 38528.040796511552, + 38546.722190761553, + 38565.405848737035, + 38584.091769889594, + 38602.779953671132, + 38621.470399533908, + 38640.163106930493, + 38658.858075313794, + 38677.555304137059, + 38696.254792853862, + 38714.956540918094, + 38733.660547783991, + 38752.366812906112, + 38771.075335739348, + 38789.78611573892, + 38808.499152360368, + 38827.214445059573, + 38845.931993292739, + 38864.651796516388, + 38883.373854187383, + 38902.098165762916, + 38920.824730700486, + 38939.553548457938, + 38958.284618493431, + 38977.017940265461, + 38995.753513232834, + 39014.491336854699, + 39033.231410590517, + 39051.973733900079, + 39070.718306243485, + 39089.465127081188, + 39108.214195873945, + 39126.965512082832, + 39145.719075169261, + 39164.474884594965, + 39183.232939821988, + 39201.99324031271, + 39220.755785529815, + 39239.52057493633, + 39258.287607995589, + 39277.056884171245, + 39295.828402927284, + 39314.602163728006, + 39333.378166038019, + 39352.15640932227, + 39370.936893046004, + 39389.719616674811, + 39408.504579674584, + 39427.291781511522, + 39446.081221652174, + 39464.872899563372, + 39483.666814712291, + 39502.462966566411, + 39521.261354593538, + 39540.06197826178, + 39558.864837039568, + 39577.669930395656, + 39596.47725779911, + 39615.286818719302, + 39634.098612625923, + 39652.912638988993, + 39671.728897278823, + 39690.547386966064, + 39709.368107521652, + 39728.191058416858, + 39747.016239123259, + 39765.84364911275, + 39784.673287857528, + 39803.505154830105, + 39822.339249503319, + 39841.175571350293, + 39860.014119844491, + 39878.854894459677, + 39897.697894669909, + 39916.54311994958, + 39935.390569773372, + 39954.240243616303, + 39973.092140953675, + 39991.946261261117, + 40010.802604014549, + 40029.661168690225, + 40048.521954764678, + 40067.384961714779, + 40086.250189017679, + 40105.117636150855, + 40123.98730259209, + 40142.859187819471, + 40161.733291311379, + 40180.609612546526, + 40199.488151003912, + 40218.368906162854, + 40237.25187750296, + 40256.137064504153, + 40275.024466646668, + 40293.914083411029, + 40312.805914278084, + 40331.699958728961, + 40350.596216245103, + 40369.494686308273, + 40388.39536840051, + 40407.298262004173, + 40426.20336660192, + 40445.110681676706, + 40464.020206711793, + 40482.931941190756, + 40501.845884597446, + 40520.762036416032, + 40539.680396130985, + 40558.600963227072, + 40577.523737189367, + 40596.448717503234, + 40615.375903654342, + 40634.305295128659, + 40653.236891412453, + 40672.170691992294, + 40691.106696355047, + 40710.044903987873, + 40728.985314378238, + 40747.927927013901, + 40766.872741382918, + 40785.819756973651, + 40804.768973274746, + 40823.720389775161, + 40842.674005964131, + 40861.629821331211, + 40880.587835366234, + 40899.548047559321, + 40918.510457400931, + 40937.475064381761, + 40956.441867992849, + 40975.410867725499, + 40994.382063071331, + 41013.355453522236, + 41032.331038570417, + 41051.308817708363, + 41070.288790428858, + 41089.270956224987, + 41108.255314590111, + 41127.241865017888, + 41146.23060700229, + 41165.221540037543, + 41184.214663618193, + 41203.209977239079, + 41222.207480395307, + 41241.207172582297, + 41260.209053295752, + 41279.213122031659, + 41298.219378286303, + 41317.227821556255, + 41336.23845133838, + 41355.251267129832, + 41374.266268428037, + 41393.283454730743, + 41412.302825535953, + 41431.324380341983, + 41450.348118647416, + 41469.374039951144, + 41488.402143752326, + 41507.432429550427, + 41526.464896845187, + 41545.499545136627, + 41564.536373925075, + 41583.575382711126, + 41602.616570995662, + 41621.659938279874, + 41640.705484065205, + 41659.753207853406, + 41678.803109146495, + 41697.855187446803, + 41716.909442256911, + 41735.965873079709, + 41755.02447941836, + 41774.085260776315, + 41793.148216657297, + 41812.213346565331, + 41831.280650004708, + 41850.350126480014, + 41869.421775496106, + 41888.495596558132, + 41907.571589171515, + 41926.649752841957, + 41945.730087075463, + 41964.812591378286, + 41983.897265256979, + 42002.984108218378, + 42022.073119769593, + 42041.164299418015, + 42060.257646671307, + 42079.353161037419, + 42098.450842024591, + 42117.550689141324, + 42136.652701896404, + 42155.756879798893, + 42174.863222358137, + 42193.971729083758, + 42213.082399485655, + 42232.195233074002, + 42251.310229359246, + 42270.427387852127, + 42289.546708063644, + 42308.668189505079, + 42327.791831687995, + 42346.917634124227, + 42366.045596325886, + 42385.175717805352, + 42404.307998075295, + 42423.442436648642, + 42442.579033038608, + 42461.717786758672, + 42480.858697322597, + 42500.001764244422, + 42519.146987038446, + 42538.294365219248, + 42557.443898301688, + 42576.595585800882, + 42595.749427232236, + 42614.90542211142, + 42634.063569954378, + 42653.223870277317, + 42672.386322596729, + 42691.55092642938, + 42710.717681292292, + 42729.886586702756, + 42749.057642178363, + 42768.23084723694, + 42787.406201396603, + 42806.58370417574, + 42825.76335509299, + 42844.945153667286, + 42864.129099417805, + 42883.315191864014, + 42902.503430525649, + 42921.693814922692, + 42940.88634457541, + 42960.081019004348, + 42979.277837730297, + 42998.476800274322, + 43017.677906157769, + 43036.881154902228, + 43056.086546029583, + 43075.294079061961, + 43094.503753521763, + 43113.715568931671, + 43132.929524814601, + 43152.145620693766, + 43171.363856092619, + 43190.584230534907, + 43209.806743544621, + 43229.031394646016, + 43248.258183363621, + 43267.487109222224, + 43286.718171746885, + 43305.951370462906, + 43325.186704895881, + 43344.42417457165, + 43363.663779016322, + 43382.905517756262, + 43402.149390318104, + 43421.395396228749, + 43440.643535015348, + 43459.89380620532, + 43479.146209326354, + 43498.400743906379, + 43517.657409473606, + 43536.916205556496, + 43556.177131683784, + 43575.44018738444, + 43594.705372187724, + 43613.972685623135, + 43633.242127220445, + 43652.513696509668, + 43671.787393021099, + 43691.063216285271, + 43710.341165833001, + 43729.621241195346, + 43748.903441903625, + 43768.187767489413, + 43787.474217484552, + 43806.762791421126, + 43826.053488831501, + 43845.346309248278, + 43864.641252204325, + 43883.938317232765, + 43903.237503866971, + 43922.538811640596, + 43941.842240087513, + 43961.147788741881, + 43980.455457138101, + 43999.765244810835, + 44019.077151295001, + 44038.391176125755, + 44057.70731883854, + 44077.02557896902, + 44096.345956053141, + 44115.668449627083, + 44134.993059227287, + 44154.319784390456, + 44173.648624653535, + 44192.979579553728, + 44212.312648628489, + 44231.647831415532, + 44250.985127452805, + 44270.324536278538, + 44289.666057431183, + 44309.009690449464, + 44328.355434872348, + 44347.703290239064, + 44367.053256089079, + 44386.405331962109, + 44405.759517398139, + 44425.115811937387, + 44444.474215120332, + 44463.834726487694, + 44483.197345580462, + 44502.562071939843, + 44521.928905107328, + 44541.297844624634, + 44560.668890033732, + 44580.042040876848, + 44599.417296696454, + 44618.794657035272, + 44638.174121436256, + 44657.555689442641, + 44676.939360597877, + 44696.325134445673, + 44715.713010530002, + 44735.102988395054, + 44754.495067585296, + 44773.88924764542, + 44793.285528120374, + 44812.683908555344, + 44832.084388495779, + 44851.486967487363, + 44870.891645076015, + 44890.298420807922, + 44909.707294229491, + 44929.118264887409, + 44948.531332328566, + 44967.946496100136, + 44987.363755749502, + 45006.783110824319, + 45026.204560872473, + 45045.628105442098, + 45065.053744081561, + 45084.48147633949, + 45103.911301764747, + 45123.343219906426, + 45142.777230313885, + 45162.21333253671, + 45181.651526124733, + 45201.091810628037, + 45220.534185596924, + 45239.978650581965, + 45259.425205133957, + 45278.873848803938, + 45298.324581143192, + 45317.777401703235, + 45337.232310035848, + 45356.68930569302, + 45376.148388226997, + 45395.60955719027, + 45415.072812135557, + 45434.538152615823, + 45454.005578184282, + 45473.475088394356, + 45492.946682799746, + 45512.420360954362, + 45531.896122412363, + 45551.373966728155, + 45570.853893456362, + 45590.33590215187, + 45609.819992369776, + 45629.306163665438, + 45648.794415594442, + 45668.284747712612, + 45687.777159576006, + 45707.27165074092, + 45726.768220763894, + 45746.266869201696, + 45765.767595611323, + 45785.270399550034, + 45804.775280575297, + 45824.282238244828, + 45843.79127211657, + 45863.302381748719, + 45882.815566699683, + 45902.33082652813, + 45921.848160792935, + 45941.367569053225, + 45960.889050868354, + 45980.41260579793, + 45999.938233401757, + 46019.465933239902, + 46038.995704872657, + 46058.527547860547, + 46078.06146176433, + 46097.597446144995, + 46117.135500563774, + 46136.675624582109, + 46156.217817761702, + 46175.762079664462, + 46195.308409852543, + 46214.856807888333, + 46234.407273334444, + 46253.959805753715, + 46273.51440470924, + 46293.071069764315, + 46312.629800482478, + 46332.190596427499, + 46351.753457163381, + 46371.318382254351, + 46390.885371264863, + 46410.45442375962, + 46430.025539303526, + 46449.598717461733, + 46469.17395779962, + 46488.751259882782, + 46508.33062327707, + 46527.912047548532, + 46547.495532263471, + 46567.081076988397, + 46586.668681290059, + 46606.258344735434, + 46625.850066891719, + 46645.443847326351, + 46665.039685606986, + 46684.637581301497, + 46704.237533978005, + 46723.839543204842, + 46743.443608550573, + 46763.049729583989, + 46782.657905874104, + 46802.268136990162, + 46821.880422501628, + 46841.494761978196, + 46861.111154989776, + 46880.729601106526, + 46900.350099898795, + 46919.97265093719, + 46939.597253792526, + 46959.223908035841, + 46978.852613238392, + 46998.483368971691, + 47018.11617480743, + 47037.751030317551, + 47057.387935074221, + 47077.026888649809, + 47096.66789061694, + 47116.310940548428, + 47135.956038017328, + 47155.603182596918, + 47175.252373860698, + 47194.903611382375, + 47214.556894735892, + 47234.212223495422, + 47253.869597235338, + 47273.52901553025, + 47293.19047795498, + 47312.853984084577, + 47332.519533494306, + 47352.187125759658, + 47371.856760456343, + 47391.528437160297, + 47411.202155447652, + 47430.877914894787, + 47450.555715078299, + 47470.235555574982, + 47489.917435961863, + 47509.601355816201, + 47529.287314715453, + 47548.975312237308, + 47568.665347959672, + 47588.357421460656, + 47608.051532318605, + 47627.747680112072, + 47647.445864419846, + 47667.14608482091, + 47686.848340894474, + 47706.552632219973, + 47726.258958377046, + 47745.967318945557, + 47765.677713505589, + 47785.390141637428, + 47805.104602921601, + 47824.821096938824, + 47844.539623270044, + 47864.260181496429, + 47883.982771199349, + 47903.707391960394, + 47923.434043361369, + 47943.162724984308, + 47962.893436411439, + 47982.626177225218, + 48002.36094700831, + 48022.097745343599, + 48041.836571814172, + 48061.57742600335, + 48081.32030749465, + 48101.065215871815, + 48120.81215071879, + 48140.56111161974, + 48160.312098159047, + 48180.065109921306, + 48199.820146491307, + 48219.577207454073, + 48239.336292394844, + 48259.097400899045, + 48278.860532552339, + 48298.625686940592, + 48318.392863649875, + 48338.162062266485, + 48357.933282376915, + 48377.706523567889, + 48397.481785426316, + 48417.259067539344, + 48437.038369494308, + 48456.819690878765, + 48476.603031280487, + 48496.388390287451, + 48516.175767487839, + 48535.965162470042, + 48555.756574822684, + 48575.550004134566, + 48595.345449994718, + 48615.142911992378, + 48634.942389716991, + 48654.743882758201, + 48674.547390705877, + 48694.352913150084, + 48714.160449681112, + 48733.969999889443, + 48753.781563365759, + 48773.595139700978, + 48793.410728486211, + 48813.228329312769, + 48833.047941772187, + 48852.869565456189, + 48872.693199956717, + 48892.518844865925, + 48912.346499776155, + 48932.176164279976, + 48952.007837970152, + 48971.841520439666, + 48991.677211281676, + 49011.514910089587, + 49031.354616456978, + 49051.196329977654, + 49071.04005024561, + 49090.885776855059, + 49110.733509400408, + 49130.583247476279, + 49150.434990677488, + 49170.288738599062, + 49190.144490836232, + 49210.002246984441, + 49229.86200663932, + 49249.723769396718, + 49269.587534852675, + 49289.453302603448, + 49309.32107224549, + 49329.190843375451, + 49349.062615590192, + 49368.936388486785, + 49388.812161662492, + 49408.689934714785, + 49428.569707241324, + 49448.45147883999, + 49468.335249108866, + 49488.22101764621, + 49508.108784050521, + 49527.99854792047, + 49547.890308854934, + 49567.784066453009, + 49587.679820313977, + 49607.57757003732, + 49627.477315222721, + 49647.379055470075, + 49667.28279037946, + 49687.188519551179, + 49707.096242585707, + 49727.005959083741, + 49746.917668646165, + 49766.831370874068, + 49786.747065368734, + 49806.66475173166, + 49826.584429564515, + 49846.506098469203, + 49866.429758047794, + 49886.355407902578, + 49906.283047636032, + 49926.212676850846, + 49946.144295149883, + 49966.077902136225, + 49986.013497413151, + 50005.951080584135, + 50025.890651252834, + 50045.832209023123, + 50065.775753499074, + 50085.721284284933, + 50105.668800985164, + 50125.618303204428, + 50145.569790547575, + 50165.523262619652, + 50185.478719025901, + 50205.436159371769, + 50225.395583262893, + 50245.356990305103, + 50265.320380104429, + 50285.285752267104, + 50305.253106399534, + 50325.222442108337, + 50345.193759000336, + 50365.16705668252, + 50385.142334762102, + 50405.119592846473, + 50425.098830543218, + 50445.080047460127, + 50465.063243205179, + 50485.048417386541, + 50505.035569612577, + 50525.024699491856, + 50545.015806633128, + 50565.008890645338, + 50585.003951137631, + 50605.00098771933, + 50624.999999999971, + 50645.000987589265, + 50665.003950097132, + 50685.008887133677, + 50705.015798309192, + 50725.024683234165, + 50745.035541519283, + 50765.048372775411, + 50785.063176613621, + 50805.079952645159, + 50825.098700481489, + 50845.119419734241, + 50865.142110015244, + 50885.166770936521, + 50905.193402110279, + 50925.222003148934, + 50945.252573665071, + 50965.285113271471, + 50985.319621581119, + 51005.356098207172, + 51025.394542762981, + 51045.434954862096, + 51065.477334118244, + 51085.521680145357, + 51105.567992557546, + 51125.616270969113, + 51145.66651499454, + 51165.718724248516, + 51185.772898345916, + 51205.829036901778, + 51225.887139531362, + 51245.947205850105, + 51266.009235473619, + 51286.073228017718, + 51306.139183098399, + 51326.207100331856, + 51346.276979334456, + 51366.348819722756, + 51386.42262111351, + 51406.498383123653, + 51426.57610537031, + 51446.655787470787, + 51466.737429042587, + 51486.82102970338, + 51506.906589071048, + 51526.994106763632, + 51547.083582399391, + 51567.175015596738, + 51587.268405974297, + 51607.363753150858, + 51627.461056745415, + 51647.56031637713, + 51667.661531665362, + 51687.764702229651, + 51707.869827689727, + 51727.976907665499, + 51748.085941777055, + 51768.196929644677, + 51788.309870888836, + 51808.42476513017, + 51828.541611989524, + 51848.660411087905, + 51868.781162046515, + 51888.90386448674, + 51909.028518030143, + 51929.155122298485, + 51949.283676913685, + 51969.414181497872, + 51989.546635673345, + 52009.681039062583, + 52029.817391288263, + 52049.955691973213, + 52070.095940740481, + 52090.238137213273, + 52110.382281014987, + 52130.5283717692, + 52150.676409099666, + 52170.826392630333, + 52190.97832198532, + 52211.132196788931, + 52231.288016665654, + 52251.445781240145, + 52271.60549013727, + 52291.76714298204, + 52311.930739399664, + 52332.096279015546, + 52352.263761455244, + 52372.433186344519, + 52392.604553309284, + 52412.777861975665, + 52432.953111969946, + 52453.130302918595, + 52473.309434448267, + 52493.490506185793, + 52513.67351775818, + 52533.858468792605, + 52554.045358916446, + 52574.234187757254, + 52594.42495494274, + 52614.617660100812, + 52634.812302859558, + 52655.008882847229, + 52675.20739969227, + 52695.407853023295, + 52715.610242469098, + 52735.814567658657, + 52756.02082822111, + 52776.229023785803, + 52796.439153982225, + 52816.651218440056, + 52836.865216789171, + 52857.081148659599, + 52877.29901368155, + 52897.518811485425, + 52917.740541701773, + 52937.964203961354, + 52958.18979789508, + 52978.417323134046, + 52998.646779309529, + 53018.878166052978, + 53039.111482996006, + 53059.346729770419, + 53079.583906008193, + 53099.823011341483, + 53120.0640454026, + 53140.307007824063, + 53160.551898238533, + 53180.79871627887, + 53201.047461578091, + 53221.2981337694, + 53241.550732486176, + 53261.805257361964, + 53282.061708030487, + 53302.32008412564, + 53322.580385281493, + 53342.842611132299, + 53363.106761312469, + 53383.372835456597, + 53403.640833199453, + 53423.910754175973, + 53444.18259802126, + 53464.456364370613, + 53484.732052859479, + 53505.009663123499, + 53525.289194798468, + 53545.570647520362, + 53565.854020925333, + 53586.139314649699, + 53606.426528329954, + 53626.715661602764, + 53647.006714104959, + 53667.299685473547, + 53687.59457534572, + 53707.891383358816, + 53728.190109150361, + 53748.490752358055, + 53768.793312619753, + 53789.09778957349, + 53809.404182857485, + 53829.712492110106, + 53850.022716969899, + 53870.334857075584, + 53890.648912066055, + 53910.964881580367, + 53931.28276525774, + 53951.602562737586, + 53971.924273659461, + 53992.24789766311, + 54012.57343438844, + 54032.90088347553, + 54053.23024456462, + 54073.561517296133, + 54093.894701310644, + 54114.22979624891, + 54134.566801751855, + 54154.90571746057, + 54175.246543016314, + 54195.589278060506, + 54215.933922234755, + 54236.280475180814, + 54256.628936540626, + 54276.97930595628, + 54297.331583070045, + 54317.685767524359, + 54338.041858961828, + 54358.399857025215, + 54378.759761357462, + 54399.121571601667, + 54419.485287401105, + 54439.850908399218, + 54460.218434239614, + 54480.587864566056, + 54500.95919902248, + 54521.332437252997, + 54541.707578901878, + 54562.084623613555, + 54582.46357103264, + 54602.844420803893, + 54623.227172572246, + 54643.611825982807, + 54663.998380680838, + 54684.386836311773, + 54704.777192521207, + 54725.169448954897, + 54745.563605258772, + 54765.959661078923, + 54786.357616061614, + 54806.757469853255, + 54827.159222100439, + 54847.562872449904, + 54867.968420548583, + 54888.375866043534, + 54908.785208582012, + 54929.196447811417, + 54949.609583379322, + 54970.024614933463, + 54990.441542121727, + 55010.86036459219, + 55031.28108199306, + 55051.703693972733, + 55072.128200179759, + 55092.554600262847, + 55112.982893870874, + 55133.413080652877, + 55153.845160258061, + 55174.279132335789, + 55194.714996535586, + 55215.152752507143, + 55235.592399900306, + 55256.033938365079, + 55276.477367551655, + 55296.92268711036, + 55317.369896691685, + 55337.818995946305, + 55358.269984525024, + 55378.72286207883, + 55399.177628258869, + 55419.634282716441, + 55440.092825103013, + 55460.553255070205, + 55481.015572269804, + 55501.479776353764, + 55521.945866974187, + 55542.413843783339, + 55562.883706433655, + 55583.355454577715, + 55603.82908786826, + 55624.304605958219, + 55644.782008500639, + 55665.261295148754, + 55685.742465555952, + 55706.225519375774, + 55726.710456261928, + 55747.197275868275, + 55767.685977848843, + 55788.176561857814, + 55808.669027549528, + 55829.163374578478, + 55849.659602599328, + 55870.157711266889, + 55890.657700236145, + 55911.159569162221, + 55931.663317700411, + 55952.168945506164, + 55972.676452235086, + 55993.185837542944, + 56013.697101085651, + 56034.210242519301, + 56054.72526150012, + 56075.242157684508, + 56095.760930729011, + 56116.281580290342, + 56136.804106025367, + 56157.328507591104, + 56177.85478464474, + 56198.382936843598, + 56218.912963845185, + 56239.444865307138, + 56259.978640887268, + 56280.514290243525, + 56301.051813034042, + 56321.591208917082, + 56342.13247755108, + 56362.675618594607, + 56383.220631706419, + 56403.767516545398, + 56424.316272770608, + 56444.866900041241, + 56465.419398016667, + 56485.973766356394, + 56506.530004720102, + 56527.088112767611, + 56547.648090158902, + 56568.209936554107, + 56588.773651613519, + 56609.339234997584, + 56629.9066863669, + 56650.47600538221, + 56671.04719170442, + 56691.620244994599, + 56712.195164913959, + 56732.771951123868, + 56753.350603285835, + 56773.931121061541, + 56794.513504112823, + 56815.097752101647, + 56835.683864690152, + 56856.271841540627, + 56876.86168231551, + 56897.453386677393, + 56918.046954289028, + 56938.642384813298, + 56959.239677913261, + 56979.838833252121, + 57000.439850493225, + 57021.04272930009, + 57041.647469336371, + 57062.254070265873, + 57082.862531752558, + 57103.472853460553, + 57124.085035054108, + 57144.699076197649, + 57165.314976555739, + 57185.932735793103, + 57206.552353574611, + 57227.173829565276, + 57247.797163430281, + 57268.42235483494, + 57289.049403444733, + 57309.678308925286, + 57330.30907094237, + 57350.941689161911, + 57371.576163249985, + 57392.212492872815, + 57412.850677696784, + 57433.490717388406, + 57454.132611614368, + 57474.776360041491, + 57495.421962336746, + 57516.069418167266, + 57536.718727200314, + 57557.36988910332, + 57578.022903543861, + 57598.677770189643, + 57619.334488708548, + 57639.993058768589, + 57660.653480037938, + 57681.315752184906, + 57701.979874877965, + 57722.64584778573, + 57743.31367057695, + 57763.983342920546, + 57784.654864485572, + 57805.328234941233, + 57826.003453956881, + 57846.680521202026, + 57867.359436346305, + 57888.040199059527, + 57908.722809011633, + 57929.407265872709, + 57950.093569313001, + 57970.781719002895, + 57991.471714612911, + 58012.16355581375, + 58032.857242276223, + 58053.552773671312, + 58074.25014967013, + 58094.949369943948, + 58115.650434164185, + 58136.353342002389, + 58157.058093130276, + 58177.764687219693, + 58198.47312394264, + 58219.183402971255, + 58239.895523977837, + 58260.609486634821, + 58281.325290614775, + 58302.042935590434, + 58322.762421234678, + 58343.483747220511, + 58364.206913221096, + 58384.931918909751, + 58405.658763959924, + 58426.3874480452, + 58447.117970839339, + 58467.85033201622, + 58488.584531249864, + 58509.320568214462, + 58530.058442584334, + 58550.798154033931, + 58571.539702237875, + 58592.283086870906, + 58613.028307607929, + 58633.775364123983, + 58654.52425609425, + 58675.274983194053, + 58696.027545098877, + 58716.781941484325, + 58737.538172026158, + 58758.296236400274, + 58779.056134282728, + 58799.817865349694, + 58820.581429277503, + 58841.346825742643, + 58862.114054421712, + 58882.883114991484, + 58903.654007128847, + 58924.426730510851, + 58945.201284814684, + 58965.977669717664, + 58986.755884897269, + 59007.535930031117, + 59028.317804796949, + 59049.101508872664, + 59069.887041936301, + 59090.674403666046, + 59111.463593740213, + 59132.254611837263, + 59153.047457635803, + 59173.84213081457, + 59194.638631052461, + 59215.436958028506, + 59236.237111421855, + 59257.039090911829, + 59277.842896177877, + 59298.648526899589, + 59319.455982756685, + 59340.26526342905, + 59361.076368596696, + 59381.889297939757, + 59402.704051138542, + 59423.520627873484, + 59444.339027825139, + 59465.159250674224, + 59485.9812961016, + 59506.805163788253, + 59527.630853415307, + 59548.458364664046, + 59569.287697215863, + 59590.118850752311, + 59610.951824955089, + 59631.786619506012, + 59652.623234087048, + 59673.461668380311, + 59694.301922068029, + 59715.143994832593, + 59735.987886356525, + 59756.833596322482, + 59777.681124413255, + 59798.530470311794, + 59819.381633701159, + 59840.234614264569, + 59861.089411685381, + 59881.94602564707, + 59902.804455833269, + 59923.664701927737, + 59944.526763614384, + 59965.390640577243, + 59986.256332500488, + 60007.123839068438, + 60027.993159965539, + 60048.864294876381, + 60069.737243485688, + 60090.612005478324, + 60111.488580539284, + 60132.366968353708, + 60153.247168606867, + 60174.129180984164, + 60195.013005171153, + 60215.898640853513, + 60236.786087717061, + 60257.675345447751, + 60278.566413731671, + 60299.459292255044, + 60320.353980704247, + 60341.25047876576, + 60362.148786126229, + 60383.048902472423, + 60403.950827491237, + 60424.854560869717, + 60445.76010229504, + 60466.667451454516, + 60487.57660803559, + 60508.487571725847, + 60529.400342212997, + 60550.314919184893, + 60571.231302329521, + 60592.149491335003, + 60613.069485889588, + 60633.991285681674, + 60654.914890399785, + 60675.840299732568, + 60696.767513368832, + 60717.696530997484, + 60738.627352307602, + 60759.55997698837, + 60780.494404729128, + 60801.430635219323, + 60822.368668148556, + 60843.308503206565, + 60864.250140083204, + 60885.193578468468, + 60906.138818052495, + 60927.085858525541, + 60948.034699578006, + 60968.985340900421, + 60989.937782183442, + 61010.892023117864, + 61031.848063394616, + 61052.805902704764, + 61073.765540739492, + 61094.726977190134, + 61115.690211748137, + 61136.655244105103, + 61157.622073952742, + 61178.590700982917, + 61199.561124887616, + 61220.533345358948, + 61241.507362089171, + 61262.483174770663, + 61283.460783095943, + 61304.440186757645, + 61325.421385448557, + 61346.404378861582, + 61367.389166689762, + 61388.375748626262, + 61409.364124364387, + 61430.354293597571, + 61451.346256019373, + 61472.340011323497, + 61493.335559203762, + 61514.332899354122, + 61535.332031468672, + 61556.332955241618, + 61577.335670367313, + 61598.340176540238, + 61619.346473454993, + 61640.354560806329, + 61661.3644382891, + 61682.376105598312, + 61703.389562429089, + 61724.404808476691, + 61745.42184343651, + 61766.440667004063, + 61787.461278874987, + 61808.483678745069, + 61829.507866310203, + 61850.533841266435, + 61871.561603309929, + 61892.591152136971, + 61913.622487443987, + 61934.655608927525, + 61955.690516284267, + 61976.727209211022, + 61997.765687404724, + 62018.805950562448, + 62039.847998381381, + 62060.891830558845, + 62081.93744679229, + 62102.984846779298, + 62124.034030217575, + 62145.084996804966, + 62166.137746239416, + 62187.19227821903, + 62208.248592442025, + 62229.306688606739, + 62250.366566411656, + 62271.428225555377, + 62292.491665736627, + 62313.556886654267, + 62334.623888007271, + 62355.692669494762, + 62376.763230815974, + 62397.835571670272, + 62418.909691757144, + 62439.98559077621, + 62461.063268427228, + 62482.142724410049, + 62503.223958424685, + 62524.306970171267, + 62545.39175935003, + 62566.478325661366, + 62587.566668805768, + 62608.656788483881, + 62629.748684396451, + 62650.842356244357, + 62671.937803728622, + 62693.035026550366, + 62714.134024410858, + 62735.234797011479, + 62756.337344053733, + 62777.441665239276, + 62798.547760269852, + 62819.655628847358, + 62840.765270673801, + 62861.876685451323, + 62882.989872882186, + 62904.104832668774, + 62925.221564513602, + 62946.340068119309, + 62967.460343188657, + 62988.582389424526, + 63009.70620652994, + 63030.831794208025, + 63051.959152162039, + 63073.08828009537, + 63094.219177711529, + 63115.351844714154, + 63136.486280806988, + 63157.622485693922, + 63178.760459078956, + 63199.900200666219, + 63221.041710159967, + 63242.184987264569, + 63263.330031684534, + 63284.476843124474, + 63305.625421289144, + 63326.775765883409, + 63347.927876612259, + 63369.081753180813, + 63390.237395294316, + 63411.39480265812, + 63432.553974977716, + 63453.714911958712, + 63474.877613306839, + 63496.042078727944, + 63517.208307927998, + 63538.376300613119, + 63559.546056489504, + 63580.717575263516, + 63601.890856641607, + 63623.065900330374, + 63644.242706036515, + 63665.421273466869, + 63686.601602328381, + 63707.783692328136, + 63728.967543173334, + 63750.153154571279, + 63771.340526229418, + 63792.529657855317, + 63813.720549156649, + 63834.913199841227, + 63856.107609616978, + 63877.303778191941, + 63898.501705274284, + 63919.7013905723, + 63940.902833794404, + 63962.106034649114, + 63983.310992845094, + 64004.517708091109, + 64025.726180096048, + 64046.936408568938, + 64068.1483932189, + 64089.362133755196, + 64110.577629887193, + 64131.794881324393, + 64153.013887776404, + 64174.234648952966, + 64195.457164563937, + 64216.681434319289, + 64237.907457929112, + 64259.135235103626, + 64280.36476555316, + 64301.596048988169, + 64322.829085119236, + 64344.06387365704, + 64365.300414312398, + 64386.538706796251, + 64407.778750819634, + 64429.020546093721, + 64450.26409232981, + 64471.509389239291, + 64492.756436533709, + 64514.005233924705, + 64535.255781124033, + 64556.50807784358, + 64577.762123795357, + 64599.017918691468, + 64620.275462244172, + 64641.534754165805, + 64662.795794168844, + 64684.058581965895, + 64705.323117269661, + 64726.589399792974, + 64747.857429248776, + 64769.127205350138, + 64790.398727810236, + 64811.671996342375, + 64832.947010659969, + 64854.223770476558, + 64875.502275505794, + 64896.782525461451, + 64918.064520057414, + 64939.348259007682, + 64960.633742026388, + 64981.920968827762, + 65003.209939126165, + 65024.500652636067, + 65045.793109072067, + 65067.087308148861, + 65088.383249581282, + 65109.680933084259, + 65130.980358372864, + 65152.28152516226, + 65173.584433167736, + 65194.889082104703, + 65216.195471688683, + 65237.503601635319, + 65258.813471660353, + 65280.125081479666, + 65301.438430809241, + 65322.753519365178, + 65344.070346863708, + 65365.388913021146, + 65386.709217553958, + 65408.031260178701, + 65429.355040612056, + 65450.680558570821, + 65472.00781377191, + 65493.336805932355, + 65514.66753476928, + 65535.999999999956, + 65557.334201341757, + 65578.670138512171, + 65600.007811228788, + 65621.347219209332, + 65642.688362171626, + 65664.031239833639, + 65685.375851913413, + 65706.722198129137, + 65728.070278199084, + 65749.420091841661, + 65770.771638775404, + 65792.124918718939, + 65813.479931391004, + 65834.836676510458, + 65856.195153796303, + 65877.5553629676, + 65898.917303743554, + 65920.280975843489, + 65941.646378986843, + 65963.013512893158, + 65984.382377282076, + 66005.752971873386, + 66027.125296386963, + 66048.499350542799, + 66069.875134061018, + 66091.252646661844, + 66112.631888065618, + 66134.01285799277, + 66155.395556163887, + 66176.779982299631, + 66198.166136120795, + 66219.554017348273, + 66240.943625703105, + 66262.334960906388, + 66283.728022679396, + 66305.122810743444, + 66326.519324820023, + 66347.917564630698, + 66369.317529897162, + 66390.719220341227, + 66412.122635684791, + 66433.527775649884, + 66454.934639958636, + 66476.343228333324, + 66497.753540496284, + 66519.165576169995, + 66540.57933507704, + 66561.994816940118, + 66583.412021482043, + 66604.830948425733, + 66626.251597494222, + 66647.673968410629, + 66669.098060898235, + 66690.523874680381, + 66711.951409480564, + 66733.380665022371, + 66754.811641029475, + 66776.244337225711, + 66797.678753334985, + 66819.11488908132, + 66840.552744188884, + 66861.992318381905, + 66883.433611384738, + 66904.876622921889, + 66926.321352717903, + 66947.767800497502, + 66969.215965985466, + 66990.665848906734, + 67012.117448986304, + 67033.570765949335, + 67055.025799521056, + 67076.482549426815, + 67097.941015392076, + 67119.401197142433, + 67140.863094403554, + 67162.326706901222, + 67183.792034361351, + 67205.259076509959, + 67226.72783307315, + 67248.198303777172, + 67269.670488348347, + 67291.144386513144, + 67312.619997998088, + 67334.09732252988, + 67355.576359835293, + 67377.057109641188, + 67398.53957167457, + 67420.023745662547, + 67441.50963133233, + 67462.99722841123, + 67484.486536626689, + 67505.977555706224, + 67527.470285377494, + 67548.964725368263, + 67570.460875406367, + 67591.9587352198, + 67613.458304536631, + 67634.95958308503, + 67656.462570593329, + 67677.967266789899, + 67699.473671403248, + 67720.981784162024, + 67742.491604794923, + 67764.003133030797, + 67785.516368598575, + 67807.031311227314, + 67828.547960646174, + 67850.066316584402, + 67871.58637877139, + 67893.108146936589, + 67914.63162080961, + 67936.156800120138, + 67957.683684597971, + 67979.212273973011, + 68000.742567975263, + 68022.274566334876, + 68043.808268782057, + 68065.343675047145, + 68086.880784860579, + 68108.419597952918, + 68129.960114054789, + 68151.502332896969, + 68173.04625421032, + 68194.591877725834, + 68216.139203174564, + 68237.688230287706, + 68259.238958796544, + 68280.791388432481, + 68302.345518927032, + 68323.901350011787, + 68345.458881418483, + 68367.018112878912, + 68388.579044125028, + 68410.141674888844, + 68431.706004902502, + 68453.272033898262, + 68474.839761608455, + 68496.409187765545, + 68517.980312102081, + 68539.553134350732, + 68561.127654244279, + 68582.70387151558, + 68604.281785897634, + 68625.861397123503, + 68647.44270492639, + 68669.025709039604, + 68690.610409196524, + 68712.196805130661, + 68733.784896575627, + 68755.374683265123, + 68776.966164932994, + 68798.559341313128, + 68820.154212139591, + 68841.750777146473, + 68863.349036068044, + 68884.948988638629, + 68906.550634592684, + 68928.153973664739, + 68949.75900558944, + 68971.365730101577, + 68992.974146935987, + 69014.584255827634, + 69036.196056511588, + 69057.809548723017, + 69079.424732197207, + 69101.041606669532, + 69122.660171875468, + 69144.280427550606, + 69165.902373430625, + 69187.526009251334, + 69209.151334748618, + 69230.778349658474, + 69252.40705371699, + 69274.037446660412, + 69295.669528225, + 69317.303298147192, + 69338.938756163494, + 69360.575902010532, + 69382.214735425005, + 69403.855256143754, + 69425.497463903681, + 69447.141358441833, + 69468.78693949533, + 69490.434206801394, + 69512.083160097391, + 69533.733799120717, + 69555.386123608929, + 69577.04013329967, + 69598.695827930685, + 69620.353207239794, + 69642.012270964973, + 69663.67301884426, + 69685.335450615792, + 69706.999566017839, + 69728.665364788743, + 69750.332846666963, + 69772.002011391058, + 69793.672858699691, + 69815.345388331611, + 69837.019600025669, + 69858.695493520849, + 69880.373068556204, + 69902.052324870907, + 69923.733262204216, + 69945.415880295492, + 69967.100178884211, + 69988.786157709939, + 70010.473816512356, + 70032.163155031216, + 70053.854173006403, + 70075.546870177874, + 70097.241246285717, + 70118.937301070109, + 70140.635034271298, + 70162.334445629691, + 70184.035534885741, + 70205.738301780017, + 70227.442746053217, + 70249.1488674461, + 70270.856665699539, + 70292.566140554511, + 70314.277291752107, + 70335.990119033493, + 70357.704622139936, + 70379.420800812819, + 70401.138654793613, + 70422.85818382389, + 70444.579387645339, + 70466.302265999722, + 70488.026818628918, + 70509.753045274876, + 70531.480945679708, + 70553.210519585555, + 70574.941766734701, + 70596.674686869505, + 70618.409279732456, + 70640.145545066101, + 70661.883482613106, + 70683.623092116264, + 70705.364373318414, + 70727.107325962526, + 70748.851949791671, + 70770.598244549008, + 70792.346209977783, + 70814.095845821372, + 70835.847151823225, + 70857.600127726895, + 70879.354773276034, + 70901.111088214413, + 70922.869072285859, + 70944.628725234332, + 70966.390046803877, + 70988.153036738629, + 71009.917694782853, + 71031.684020680885, + 71053.45201417715, + 71075.221675016204, + 71096.993002942661, + 71118.765997701266, + 71140.540659036851, + 71162.316986694335, + 71184.09498041874, + 71205.874639955218, + 71227.655965048951, + 71249.438955445294, + 71271.223610889632, + 71293.009931127483, + 71314.797915904477, + 71336.587564966307, + 71358.378878058764, + 71380.171854927772, + 71401.966495319313, + 71423.762798979486, + 71445.560765654489, + 71467.360395090596, + 71489.161687034211, + 71510.964641231811, + 71532.769257429973, + 71554.575535375348, + 71576.383474814749, + 71598.19307549503, + 71620.004337163133, + 71641.817259566145, + 71663.631842451214, + 71685.4480855656, + 71707.26598865664, + 71729.085551471784, + 71750.906773758586, + 71772.729655264673, + 71794.554195737772, + 71816.380394925713, + 71838.208252576442, + 71860.037768437964, + 71881.868942258385, + 71903.701773785942, + 71925.536262768932, + 71947.372408955751, + 71969.210212094898, + 71991.049671934976, + 72012.890788224686, + 72034.73356071279, + 72056.577989148165, + 72078.424073279821, + 72100.271812856794, + 72122.121207628254, + 72143.97225734347, + 72165.824961751801, + 72187.679320602692, + 72209.53533364569, + 72231.393000630429, + 72253.252321306645, + 72275.113295424177, + 72296.975922732949, + 72318.840202982959, + 72340.706135924338, + 72362.573721307272, + 72384.442958882093, + 72406.313848399179, + 72428.186389609036, + 72450.060582262216, + 72471.936426109431, + 72493.813920901433, + 72515.693066389096, + 72537.573862323392, + 72559.456308455352, + 72581.340404536139, + 72603.226150316987, + 72625.113545549248, + 72647.002589984331, + 72668.893283373764, + 72690.785625469172, + 72712.679616022273, + 72734.575254784853, + 72756.472541508803, + 72778.371475946144, + 72800.272057848939, + 72822.174286969355, + 72844.07816305969, + 72865.983685872285, + 72887.890855159596, + 72909.799670674183, + 72931.710132168693, + 72953.622239395845, + 72975.535992108475, + 72997.451390059519, + 73019.368433001961, + 73041.287120688925, + 73063.207452873612, + 73085.129429309294, + 73107.053049749389, + 73128.978313947344, + 73150.905221656736, + 73172.833772631217, + 73194.763966624567, + 73216.695803390612, + 73238.62928268328, + 73260.564404256627, + 73282.501167864757, + 73304.439573261901, + 73326.379620202337, + 73348.321308440485, + 73370.264637730841, + 73392.209607827957, + 73414.156218486532, + 73436.104469461323, + 73458.054360507173, + 73480.005891379056, + 73501.959061831993, + 73523.913871621116, + 73545.870320501665, + 73567.828408228932, + 73589.78813455833, + 73611.749499245358, + 73633.712502045615, + 73655.677142714747, + 73677.643421008557, + 73699.611336682879, + 73721.580889493693, + 73743.552079197019, + 73765.524905548999, + 73787.499368305856, + 73809.475467223907, + 73831.453202059551, + 73853.432572569291, + 73875.413578509717, + 73897.396219637507, + 73919.380495709411, + 73941.36640648231, + 73963.353951713143, + 73985.343131158952, + 74007.333944576865, + 74029.326391724098, + 74051.320472357969, + 74073.316186235883, + 74095.313533115303, + 74117.312512753837, + 74139.313124909138, + 74161.315369338976, + 74183.319245801191, + 74205.324754053727, + 74227.331893854629, + 74249.340664961986, + 74271.351067134034, + 74293.363100129049, + 74315.376763705441, + 74337.392057621662, + 74359.408981636298, + 74381.427535508003, + 74403.447718995507, + 74425.469531857671, + 74447.492973853383, + 74469.518044741693, + 74491.54474428168, + 74513.573072232539, + 74535.603028353551, + 74557.634612404087, + 74579.667824143602, + 74601.702663331642, + 74623.739129727837, + 74645.777223091936, + 74667.816943183716, + 74689.858289763113, + 74711.901262590094, + 74733.945861424741, + 74755.992086027225, + 74778.039936157802, + 74800.089411576817, + 74822.140512044702, + 74844.193237321961, + 74866.24758716923, + 74888.303561347187, + 74910.36115961663, + 74932.420381738411, + 74954.481227473516, + 74976.543696582972, + 74998.607788827925, + 75020.673503969607, + 75042.740841769322, + 75064.809801988464, + 75086.88038438854, + 75108.952588731103, + 75131.026414777836, + 75153.101862290467, + 75175.178931030852, + 75197.257620760924, + 75219.33793124267, + 75241.419862238225, + 75263.503413509738, + 75285.588584819503, + 75307.675375929874, + 75329.763786603318, + 75351.853816602365, + 75373.945465689612, + 75396.038733627807, + 75418.133620179724, + 75440.230125108254, + 75462.32824817636, + 75484.427989147109, + 75506.529347783653, + 75528.63232384919, + 75550.736917107075, + 75572.843127320695, + 75594.950954253538, + 75617.060397669193, + 75639.171457331307, + 75661.284133003646, + 75683.398424450032, + 75705.514331434402, + 75727.631853720741, + 75749.750991073175, + 75771.871743255862, + 75793.994110033076, + 75816.118091169177, + 75838.243686428585, + 75860.370895575848, + 75882.499718375562, + 75904.630154592422, + 75926.762203991224, + 75948.895866336825, + 75971.031141394182, + 75993.168028928325, + 76015.306528704401, + 76037.4466404876, + 76059.588364043215, + 76081.731699136653, + 76103.876645533353, + 76126.023202998884, + 76148.171371298871, + 76170.321150199044, + 76192.472539465205, + 76214.625538863256, + 76236.780148159174, + 76258.936367119008, + 76281.094195508922, + 76303.253633095141, + 76325.414679643975, + 76347.577334921851, + 76369.741598695226, + 76391.907470730686, + 76414.074950794879, + 76436.244038654564, + 76458.414734076548, + 76480.587036827754, + 76502.760946675175, + 76524.936463385893, + 76547.11358672705, + 76569.292316465915, + 76591.472652369819, + 76613.654594206164, + 76635.838141742468, + 76658.023294746308, + 76680.210052985349, + 76702.398416227341, + 76724.588384240138, + 76746.779956791637, + 76768.973133649866, + 76791.167914582897, + 76813.364299358902, + 76835.562287746157, + 76857.761879512967, + 76879.963074427797, + 76902.165872259109, + 76924.37027277553, + 76946.576275745727, + 76968.783880938441, + 76990.993088122515, + 77013.203897066895, + 77035.416307540567, + 77057.630319312622, + 77079.845932152239, + 77102.063145828695, + 77124.281960111301, + 77146.50237476948, + 77168.724389572759, + 77190.948004290723, + 77213.173218693031, + 77235.400032549442, + 77257.628445629802, + 77279.858457704031, + 77302.090068542122, + 77324.323277914169, + 77346.558085590339, + 77368.794491340886, + 77391.032494936138, + 77413.272096146524, + 77435.51329474253, + 77457.756090494731, + 77480.000483173804, + 77502.246472550498, + 77524.494058395634, + 77546.743240480107, + 77568.994018574944, + 77591.246392451198, + 77613.500361880026, + 77635.755926632657, + 77658.013086480438, + 77680.271841194757, + 77702.532190547092, + 77724.794134309021, + 77747.057672252195, + 77769.322804148323, + 77791.589529769248, + 77813.857848886837, + 77836.127761273063, + 77858.399266699998, + 77880.67236493979, + 77902.947055764627, + 77925.223338946831, + 77947.50121425878, + 77969.780681472927, + 77992.061740361838, + 78014.344390698127, + 78036.628632254491, + 78058.914464803747, + 78081.201888118725, + 78103.490901972415, + 78125.781506137821, + 78148.073700388064, + 78170.367484496339, + 78192.662858235926, + 78214.959821380166, + 78237.258373702498, + 78259.558514976452, + 78281.860244975614, + 78304.163563473659, + 78326.468470244363, + 78348.77496506153, + 78371.083047699125, + 78393.392717931114, + 78415.703975531578, + 78438.016820274701, + 78460.331251934695, + 78482.647270285903, + 78504.964875102727, + 78527.284066159627, + 78549.604843231195, + 78571.927206092048, + 78594.251154516911, + 78616.576688280606, + 78638.903807157985, + 78661.232510924034, + 78683.562799353778, + 78705.894672222363, + 78728.228129304945, + 78750.563170376859, + 78772.899795213423, + 78795.238003590101, + 78817.577795282399, + 78839.919170065928, + 78862.262127716356, + 78884.606668009452, + 78906.952790721043, + 78929.300495627045, + 78951.64978250346, + 78974.000651126378, + 78996.353101271932, + 79018.707132716358, + 79041.062745235977, + 79063.41993860717, + 79085.778712606436, + 79108.139067010285, + 79130.501001595389, + 79152.864516138419, + 79175.22961041618, + 79197.596284205531, + 79219.96453728342, + 79242.33436942687, + 79264.705780412987, + 79287.078770018954, + 79309.453338022009, + 79331.829484199508, + 79354.207208328866, + 79376.586510187582, + 79398.967389553218, + 79421.349846203433, + 79443.733879915948, + 79466.119490468584, + 79488.50667763922, + 79510.895441205823, + 79533.285780946433, + 79555.677696639163, + 79578.071188062226, + 79600.466254993895, + 79622.862897212515, + 79645.261114496549, + 79667.660906624471, + 79690.062273374875, + 79712.465214526455, + 79734.869729857935, + 79757.275819148126, + 79779.683482175955, + 79802.092718720378, + 79824.503528560454, + 79846.915911475327, + 79869.329867244203, + 79891.745395646343, + 79914.162496461155, + 79936.581169468045, + 79959.001414446553, + 79981.423231176261, + 80003.846619436852, + 80026.271579008084, + 80048.698109669771, + 80071.12621120183, + 80093.555883384237, + 80115.987125997053, + 80138.419938820414, + 80160.854321634528, + 80183.290274219689, + 80205.727796356281, + 80228.166887824715, + 80250.607548405547, + 80273.049777879336, + 80295.493576026798, + 80317.938942628651, + 80340.385877465727, + 80362.834380318949, + 80385.28445096928, + 80407.736089197788, + 80430.189294785596, + 80452.644067513917, + 80475.100407164035, + 80497.558313517322, + 80520.017786355209, + 80542.478825459213, + 80564.941430610925, + 80587.405601592007, + 80609.871338184195, + 80632.338640169342, + 80654.8075073293, + 80677.277939446067, + 80699.749936301683, + 80722.223497678278, + 80744.698623358039, + 80767.17531312324, + 80789.653566756242, + 80812.133384039465, + 80834.614764755403, + 80857.097708686648, + 80879.582215615854, + 80902.068285325731, + 80924.555917599093, + 80947.045112218824, + 80969.535868967869, + 80992.028187629272, + 81014.522067986123, + 81037.017509821613, + 81059.514512919006, + 81082.013077061609, + 81104.513202032831, + 81127.014887616184, + 81149.518133595193, + 81172.022939753486, + 81194.529305874807, + 81217.037231742899, + 81239.546717141639, + 81262.057761854958, + 81284.570365666848, + 81307.084528361403, + 81329.600249722775, + 81352.117529535186, + 81374.636367582949, + 81397.156763650448, + 81419.678717522125, + 81442.202228982511, + 81464.727297816222, + 81487.253923807933, + 81509.782106742379, + 81532.311846404409, + 81554.843142578902, + 81577.375995050839, + 81599.910403605274, + 81622.446368027333, + 81644.983888102215, + 81667.522963615178, + 81690.063594351581, + 81712.605780096841, + 81735.149520636449, + 81757.694815755967, + 81780.241665241047, + 81802.79006887741, + 81825.340026450824, + 81847.891537747171, + 81870.444602552379, + 81892.999220652477, + 81915.555391833506, + 81938.113115881672, + 81960.672392583176, + 81983.233221724338, + 82005.795603091537, + 82028.359536471224, + 82050.925021649906, + 82073.492058414209, + 82096.060646550788, + 82118.630785846399, + 82141.202476087841, + 82163.775717062032, + 82186.35050855593, + 82208.926850356569, + 82231.504742251054, + 82254.084184026578, + 82276.665175470393, + 82299.24771636985, + 82321.831806512317, + 82344.417445685307, + 82367.004633676348, + 82389.593370273054, + 82412.183655263143, + 82434.775488434374, + 82457.368869574595, + 82479.963798471697, + 82502.560274913689, + 82525.158298688606, + 82547.757869584602, + 82570.35898738986, + 82592.961651892678, + 82615.565862881398, + 82638.171620144421, + 82660.778923470265, + 82683.387772647475, + 82705.998167464713, + 82728.610107710658, + 82751.223593174116, + 82773.83862364394, + 82796.45519890904, + 82819.073318758441, + 82841.692982981185, + 82864.314191366429, + 82886.936943703375, + 82909.561239781324, + 82932.187079389638, + 82954.814462317736, + 82977.443388355125, + 83000.073857291369, + 83022.70586891612, + 83045.339423019104, + 83067.974519390089, + 83090.611157818959, + 83113.249338095629, + 83135.8890600101, + 83158.530323352461, + 83181.173127912858, + 83203.817473481497, + 83226.463359848669, + 83249.11078680474, + 83271.759754140134, + 83294.410261645375, + 83317.062309111003, + 83339.715896327703, + 83362.371023086147, + 83385.027689177165, + 83407.685894391587, + 83430.345638520361, + 83453.006921354478, + 83475.669742685001, + 83498.334102303095, + 83520.999999999942, + 83543.667435566866, + 83566.336408795192, + 83589.006919476349, + 83611.678967401851, + 83634.352552363242, + 83657.027674152167, + 83679.704332560359, + 83702.382527379552, + 83725.062258401638, + 83747.743525418511, + 83770.42632822218, + 83793.110666604684, + 83815.796540358162, + 83838.483949274829, + 83861.172893146941, + 83883.863371766842, + 83906.555384926964, + 83929.248932419752, + 83951.944014037799, + 83974.640629573696, + 83997.338778820151, + 84020.038461569929, + 84042.739677615857, + 84065.442426750829, + 84088.146708767847, + 84110.852523459922, + 84133.559870620171, + 84156.268750041796, + 84178.979161518029, + 84201.691104842204, + 84224.404579807713, + 84247.119586208006, + 84269.83612383662, + 84292.55419248715, + 84315.273791953281, + 84337.994922028738, + 84360.717582507335, + 84383.441773182945, + 84406.167493849513, + 84428.894744301069, + 84451.623524331691, + 84474.353833735542, + 84497.085672306828, + 84519.819039839858, + 84542.553936128999, + 84565.290360968676, + 84588.028314153402, + 84610.767795477717, + 84633.508804736295, + 84656.251341723822, + 84678.995406235073, + 84701.740998064924, + 84724.488117008252, + 84747.236762860062, + 84769.986935415407, + 84792.73863446941, + 84815.491859817252, + 84838.246611254188, + 84861.002888575575, + 84883.760691576768, + 84906.520020053256, + 84929.28087380057, + 84952.043252614312, + 84974.807156290146, + 84997.572584623806, + 85020.339537411113, + 85043.108014447949, + 85065.878015530237, + 85088.649540453989, + 85111.422589015303, + 85134.197161010321, + 85156.973256235244, + 85179.750874486374, + 85202.530015560071, + 85225.310679252725, + 85248.092865360857, + 85270.876573681016, + 85293.661804009811, + 85316.448556143951, + 85339.236829880188, + 85362.026625015351, + 85384.817941346351, + 85407.610778670132, + 85430.405136783724, + 85453.201015484257, + 85475.998414568865, + 85498.797333834795, + 85521.597773079353, + 85544.399732099904, + 85567.203210693886, + 85590.008208658808, + 85612.814725792239, + 85635.62276189182, + 85658.432316755265, + 85681.243390180331, + 85704.055981964877, + 85726.870091906807, + 85749.685719804082, + 85772.502865454764, + 85795.321528656961, + 85818.141709208852, + 85840.963406908675, + 85863.78662155474, + 85886.611352945445, + 85909.437600879217, + 85932.26536515457, + 85955.094645570091, + 85977.92544192441, + 86000.757754016275, + 86023.591581644432, + 86046.426924607746, + 86069.263782705122, + 86092.102155735556, + 86114.942043498071, + 86137.783445791807, + 86160.626362415918, + 86183.470793169676, + 86206.316737852379, + 86229.164196263402, + 86252.013168202204, + 86274.863653468303, + 86297.715651861261, + 86320.569163180728, + 86343.424187226425, + 86366.280723798132, + 86389.138772695675, + 86411.998333718977, + 86434.859406668009, + 86457.721991342827, + 86480.586087543532, + 86503.451695070296, + 86526.318813723352, + 86549.187443303032, + 86572.057583609683, + 86594.929234443756, + 86617.802395605773, + 86640.677066896271, + 86663.553248115903, + 86686.43093906538, + 86709.310139545443, + 86732.190849356964, + 86755.073068300815, + 86777.956796177954, + 86800.842032789442, + 86823.728777936354, + 86846.617031419853, + 86869.506793041175, + 86892.398062601613, + 86915.290839902518, + 86938.185124745316, + 86961.080916931489, + 86983.978216262592, + 87006.87702254027, + 87029.777335566177, + 87052.67915514209, + 87075.582481069796, + 87098.487313151185, + 87121.39365118822, + 87144.301494982894, + 87167.210844337285, + 87190.121699053532, + 87213.034058933845, + 87235.947923780506, + 87258.863293395829, + 87281.780167582241, + 87304.698546142172, + 87327.618428878181, + 87350.539815592856, + 87373.462706088845, + 87396.387100168897, + 87419.312997635774, + 87442.240398292357, + 87465.16930194154, + 87488.099708386319, + 87511.031617429733, + 87533.965028874911, + 87556.899942525008, + 87579.836358183282, + 87602.774275653021, + 87625.713694737613, + 87648.654615240492, + 87671.597036965148, + 87694.540959715145, + 87717.486383294105, + 87740.433307505737, + 87763.381732153779, + 87786.331657042057, + 87809.283081974456, + 87832.236006754916, + 87855.190431187453, + 87878.146355076155, + 87901.103778225151, + 87924.062700438633, + 87947.023121520891, + 87969.985041276246, + 87992.948459509105, + 88015.913376023906, + 88038.879790625171, + 88061.847703117513, + 88084.817113305573, + 88107.788020994049, + 88130.760425987726, + 88153.734328091465, + 88176.709727110137, + 88199.686622848749, + 88222.665015112303, + 88245.644903705906, + 88268.626288434709, + 88291.609169103947, + 88314.593545518903, + 88337.579417484914, + 88360.566784807408, + 88383.555647291854, + 88406.546004743795, + 88429.537856968818, + 88452.531203772611, + 88475.52604496089, + 88498.522380339447, + 88521.52020971413, + 88544.519532890874, + 88567.520349675644, + 88590.522659874507, + 88613.526463293543, + 88636.531759738922, + 88659.538549016899, + 88682.546830933745, + 88705.556605295846, + 88728.567871909589, + 88751.580630581491, + 88774.594881118086, + 88797.610623325963, + 88820.62785701183, + 88843.646581982393, + 88866.666798044462, + 88889.688505004888, + 88912.711702670611, + 88935.7363908486, + 88958.762569345898, + 88981.790237969632, + 89004.81939652696, + 89027.850044825114, + 89050.882182671412, + 89073.9158098732, + 89096.950926237885, + 89119.987531572973, + 89143.025625686001, + 89166.065208384563, + 89189.106279476357, + 89212.148838769106, + 89235.192886070581, + 89258.238421188667, + 89281.285443931265, + 89304.333954106376, + 89327.383951522017, + 89350.435435986306, + 89373.488407307406, + 89396.542865293537, + 89419.598809753006, + 89442.656240494165, + 89465.715157325409, + 89488.775560055219, + 89511.837448492137, + 89534.900822444746, + 89557.965681721733, + 89581.032026131812, + 89604.099855483742, + 89627.169169586399, + 89650.239968248672, + 89673.312251279538, + 89696.386018488018, + 89719.461269683205, + 89742.53800467425, + 89765.616223270365, + 89788.69592528083, + 89811.777110514988, + 89834.859778782207, + 89857.943929891975, + 89881.029563653807, + 89904.116679877261, + 89927.205278372014, + 89950.29535894774, + 89973.386921414218, + 89996.479965581268, + 90019.574491258769, + 90042.670498256688, + 90065.767986385021, + 90088.866955453836, + 90111.967405273259, + 90135.069335653476, + 90158.172746404758, + 90181.277637337407, + 90204.384008261797, + 90227.49185898836, + 90250.601189327586, + 90273.711999090039, + 90296.824288086325, + 90319.938056127125, + 90343.053303023189, + 90366.170028585286, + 90389.288232624298, + 90412.407914951138, + 90435.529075376777, + 90458.651713712257, + 90481.775829768681, + 90504.901423357209, + 90528.028494289058, + 90551.157042375504, + 90574.287067427911, + 90597.418569257643, + 90620.551547676194, + 90643.686002495073, + 90666.821933525847, + 90689.959340580186, + 90713.098223469773, + 90736.238582006365, + 90759.380416001804, + 90782.523725267951, + 90805.668509616764, + 90828.814768860233, + 90851.962502810435, + 90875.11171127946, + 90898.262394079517, + 90921.414551022855, + 90944.568181921743, + 90967.72328658856, + 90990.879864835719, + 91014.037916475718, + 91037.19744132107, + 91060.358439184391, + 91083.520909878338, + 91106.684853215629, + 91129.850269009039, + 91153.017157071401, + 91176.185517215621, + 91199.355349254649, + 91222.526653001492, + 91245.699428269247, + 91268.873674871036, + 91292.049392620058, + 91315.226581329553, + 91338.405240812834, + 91361.585370883287, + 91384.766971354344, + 91407.950042039476, + 91431.134582752245, + 91454.320593306256, + 91477.508073515171, + 91500.697023192712, + 91523.887442152685, + 91547.07933020893, + 91570.272687175326, + 91593.467512865856, + 91616.663807094534, + 91639.861569675442, + 91663.060800422725, + 91686.261499150554, + 91709.463665673218, + 91732.66729980502, + 91755.872401360321, + 91779.078970153569, + 91802.287005999257, + 91825.49650871192, + 91848.707478106167, + 91871.91991399668, + 91895.133816198169, + 91918.349184525418, + 91941.566018793281, + 91964.784318816659, + 91988.004084410495, + 92011.22531538982, + 92034.448011569708, + 92057.672172765277, + 92080.897798791746, + 92104.124889464365, + 92127.353444598411, + 92150.58346400928, + 92173.814947512379, + 92197.04789492322, + 92220.282306057314, + 92243.518180730272, + 92266.755518757753, + 92289.994319955469, + 92313.234584139194, + 92336.476311124774, + 92359.719500728082, + 92382.964152765067, + 92406.210267051734, + 92429.457843404161, + 92452.706881638471, + 92475.957381570814, + 92499.209343017443, + 92522.462765794655, + 92545.717649718805, + 92568.973994606305, + 92592.231800273614, + 92615.491066537259, + 92638.751793213814, + 92662.01398011994, + 92685.277627072326, + 92708.54273388772, + 92731.809300382942, + 92755.077326374871, + 92778.346811680414, + 92801.617756116568, + 92824.890159500384, + 92848.164021648947, + 92871.439342379424, + 92894.716121509016, + 92917.994358855023, + 92941.274054234746, + 92964.555207465572, + 92987.837818364962, + 93011.121886750407, + 93034.407412439468, + 93057.694395249753, + 93080.982834998955, + 93104.272731504767, + 93127.564084584999, + 93150.856894057491, + 93174.15115974014, + 93197.446881450916, + 93220.744059007804, + 93244.04269222889, + 93267.342780932304, + 93290.644324936235, + 93313.947324058914, + 93337.251778118633, + 93360.557686933767, + 93383.865050322696, + 93407.173868103928, + 93430.484140095941, + 93453.795866117362, + 93477.109045986799, + 93500.423679522952, + 93523.739766544561, + 93547.057306870454, + 93570.376300319491, + 93593.696746710571, + 93617.018645862699, + 93640.341997594893, + 93663.666801726242, + 93686.993058075881, + 93710.320766463032, + 93733.64992670693, + 93756.980538626914, + 93780.312602042337, + 93803.646116772637, + 93826.981082637285, + 93850.317499455836, + 93873.655367047861, + 93896.994685233032, + 93920.335453831038, + 93943.677672661666, + 93967.021341544707, + 93990.366460300051, + 94013.713028747632, + 94037.061046707429, + 94060.410513999494, + 94083.761430443905, + 94107.113795860845, + 94130.467610070496, + 94153.822872893157, + 94177.179584149111, + 94200.537743658759, + 94223.897351242529, + 94247.25840672091, + 94270.620909914433, + 94293.98486064373, + 94317.350258729421, + 94340.71710399224, + 94364.085396252936, + 94387.455135332348, + 94410.82632105134, + 94434.198953230851, + 94457.573031691878, + 94480.948556255447, + 94504.325526742658, + 94527.70394297468, + 94551.083804772716, + 94574.465111958023, + 94597.847864351934, + 94621.232061775823, + 94644.617704051096, + 94668.004790999272, + 94691.393322441872, + 94714.783298200506, + 94738.174718096794, + 94761.567581952477, + 94784.961889589307, + 94808.357640829097, + 94831.754835493703, + 94855.153473405066, + 94878.553554385173, + 94901.955078256055, + 94925.358044839784, + 94948.762453958523, + 94972.168305434476, + 94995.575599089891, + 95018.984334747074, + 95042.394512228391, + 95065.806131356265, + 95089.219191953176, + 95112.633693841635, + 95136.04963684424, + 95159.467020783617, + 95182.885845482466, + 95206.306110763529, + 95229.727816449609, + 95253.150962363579, + 95276.575548328314, + 95300.001574166803, + 95323.429039702052, + 95346.857944757154, + 95370.288289155214, + 95393.720072719429, + 95417.153295273019, + 95440.587956639298, + 95464.024056641589, + 95487.461595103305, + 95510.900571847902, + 95534.340986698866, + 95557.782839479783, + 95581.226130014256, + 95604.670858125959, + 95628.117023638595, + 95651.564626375985, + 95675.013666161918, + 95698.464142820303, + 95721.916056175076, + 95745.369406050231, + 95768.824192269807, + 95792.280414657915, + 95815.738073038709, + 95839.197167236387, + 95862.657697075221, + 95886.11966237954, + 95909.583062973688, + 95933.047898682111, + 95956.514169329268, + 95979.981874739708, + 96003.451014738006, + 96026.921589148798, + 96050.393597796792, + 96073.867040506724, + 96097.341917103375, + 96120.818227411626, + 96144.295971256375, + 96167.775148462577, + 96191.255758855244, + 96214.737802259449, + 96238.221278500292, + 96261.70618740299, + 96285.192528792715, + 96308.680302494788, + 96332.169508334526, + 96355.660146137321, + 96379.152215728609, + 96402.645716933868, + 96426.14064957868, + 96449.637013488609, + 96473.134808489311, + 96496.63403440651, + 96520.134691065963, + 96543.636778293469, + 96567.140295914898, + 96590.645243756153, + 96614.151621643221, + 96637.659429402134, + 96661.168666858954, + 96684.679333839798, + 96708.191430170875, + 96731.70495567839, + 96755.219910188665, + 96778.736293528011, + 96802.254105522836, + 96825.77334599958, + 96849.29401478474, + 96872.816111704873, + 96896.339636586577, + 96919.864589256511, + 96943.390969541389, + 96966.918777267958, + 96990.448012263048, + 97013.978674353522, + 97037.510763366285, + 97061.044279128328, + 97084.579221466673, + 97108.115590208385, + 97131.653385180587, + 97155.19260621049, + 97178.733253125291, + 97202.2753257523, + 97225.81882391886, + 97249.363747452342, + 97272.910096180189, + 97296.457869929916, + 97320.007068529041, + 97343.557691805196, + 97367.109739586012, + 97390.663211699197, + 97414.218107972498, + 97437.774428233737, + 97461.332172310766, + 97484.891340031507, + 97508.451931223899, + 97532.013945715982, + 97555.577383335811, + 97579.142243911512, + 97602.708527271257, + 97626.276233243261, + 97649.845361655811, + 97673.415912337223, + 97696.987885115886, + 97720.561279820206, + 97744.1360962787, + 97767.712334319876, + 97791.289993772341, + 97814.869074464703, + 97838.449576225685, + 97862.031498883996, + 97885.614842268449, + 97909.199606207883, + 97932.785790531183, + 97956.37339506732, + 97979.962419645264, + 98003.552864094076, + 98027.144728242856, + 98050.738011920766, + 98074.332714956996, + 98097.928837180807, + 98121.526378421506, + 98145.125338508456, + 98168.725717271067, + 98192.327514538789, + 98215.930730141132, + 98239.535363907664, + 98263.141415668011, + 98286.748885251814, + 98310.357772488816, + 98333.968077208759, + 98357.579799241488, + 98381.192938416847, + 98404.807494564782, + 98428.42346751524, + 98452.040857098269, + 98475.659663143917, + 98499.27988548232, + 98522.901523943656, + 98546.524578358163, + 98570.149048556093, + 98593.774934367786, + 98617.402235623624, + 98641.030952154048, + 98664.661083789513, + 98688.292630360564, + 98711.925591697771, + 98735.559967631794, + 98759.195757993293, + 98782.832962613014, + 98806.471581321734, + 98830.111613950285, + 98853.753060329575, + 98877.39592029051, + 98901.040193664099, + 98924.68588028138, + 98948.33297997342, + 98971.981492571387, + 98995.63141790645, + 99019.282755809851, + 99042.935506112874, + 99066.589668646877, + 99090.245243243233, + 99113.902229733401, + 99137.560627948857, + 99161.220437721131, + 99184.881658881859, + 99208.544291262631, + 99232.208334695169, + 99255.87378901121, + 99279.540654042547, + 99303.208929621018, + 99326.878615578535, + 99350.549711746993, + 99374.222217958435, + 99397.896134044888, + 99421.571459838422, + 99445.248195171211, + 99468.926339875441, + 99492.605893783344, + 99516.286856727209, + 99539.969228539398, + 99563.653009052287, + 99587.338198098325, + 99611.024795510006, + 99634.712801119866, + 99658.402214760499, + 99682.093036264545, + 99705.785265464699, + 99729.478902193689, + 99753.173946284325, + 99776.870397569437, + 99800.56825588191, + 99824.267521054688, + 99847.968192920773, + 99871.670271313182, + 99895.373756065004, + 99919.078647009388, + 99942.78494397951, + 99966.492646808634, + 99990.20175533001, + 100013.91226937699, + 100037.62418878295, + 100061.33751338134, + 100085.05224300563, + 100108.76837748935, + 100132.4859166661, + 100156.2048603695, + 100179.92520843323, + 100203.64696069101, + 100227.37011697664, + 100251.09467712394, + 100274.82064096678, + 100298.54800833909, + 100322.27677907483, + 100346.00695300807, + 100369.73852997283, + 100393.47150980328, + 100417.20589233354, + 100440.94167739789, + 100464.67886483055, + 100488.41745446586, + 100512.1574461382, + 100535.89883968196, + 100559.64163493161, + 100583.38583172169, + 100607.13142988674, + 100630.87842926137, + 100654.62682968024, + 100678.37663097809, + 100702.12783298964, + 100725.88043554971, + 100749.63443849317, + 100773.38984165489, + 100797.14664486986, + 100820.90484797307, + 100844.66445079957, + 100868.42545318443, + 100892.18785496285, + 100915.95165596998, + 100939.71685604109, + 100963.48345501146, + 100987.25145271645, + 101011.02084899142, + 101034.79164367182, + 101058.56383659317, + 101082.33742759094, + 101106.11241650078, + 101129.88880315828, + 101153.66658739912, + 101177.44576905905, + 101201.22634797383, + 101225.00832397929, + 101248.7916969113, + 101272.57646660579, + 101296.36263289873, + 101320.15019562612, + 101343.93915462404, + 101367.7295097286, + 101391.52126077596, + 101415.31440760233, + 101439.10895004397, + 101462.9048879372, + 101486.70222111834, + 101510.50094942382, + 101534.30107269008, + 101558.10259075361, + 101581.90550345098, + 101605.70981061876, + 101629.5155120936, + 101653.32260771218, + 101677.13109731126, + 101700.9409807276, + 101724.75225779804, + 101748.56492835947, + 101772.37899224881, + 101796.19444930303, + 101820.01129935916, + 101843.82954225427, + 101867.64917782549, + 101891.47020590997, + 101915.29262634492, + 101939.11643896763, + 101962.94164361537, + 101986.76824012553, + 102010.59622833549, + 102034.42560808272, + 102058.25637920471, + 102082.08854153901, + 102105.9220949232, + 102129.75703919494, + 102153.59337419191, + 102177.43109975185, + 102201.27021571253, + 102225.1107219118, + 102248.95261818753, + 102272.79590437764, + 102296.64058032009, + 102320.48664585294, + 102344.33410081422, + 102368.18294504205, + 102392.03317837461, + 102415.88480065008, + 102439.73781170673, + 102463.59221138287, + 102487.44799951684, + 102511.30517594704, + 102535.1637405119, + 102559.02369304992, + 102582.88503339965, + 102606.74776139967, + 102630.61187688859, + 102654.4773797051, + 102678.34426968795, + 102702.21254667587, + 102726.08221050771, + 102749.95326102231, + 102773.8256980586, + 102797.69952145554, + 102821.57473105213, + 102845.45132668741, + 102869.32930820051, + 102893.20867543056, + 102917.08942821674, + 102940.97156639832, + 102964.85508981455, + 102988.73999830478, + 103012.6262917084, + 103036.51396986481, + 103060.40303261351, + 103084.293479794, + 103108.18531124585, + 103132.07852680866, + 103155.97312632212, + 103179.8691096259, + 103203.76647655977, + 103227.66522696352, + 103251.56536067701, + 103275.46687754011, + 103299.36977739276, + 103323.27406007495, + 103347.1797254267, + 103371.0867732881, + 103394.99520349925, + 103418.90501590034, + 103442.81621033157, + 103466.72878663319, + 103490.64274464553, + 103514.55808420894, + 103538.4748051638, + 103562.39290735057, + 103586.31239060973, + 103610.23325478184, + 103634.15549970744, + 103658.07912522719, + 103682.00413118176, + 103705.93051741188, + 103729.85828375829, + 103753.78743006183, + 103777.71795616332, + 103801.64986190372, + 103825.58314712394, + 103849.51781166498, + 103873.4538553679, + 103897.39127807376, + 103921.33007962372, + 103945.27025985894, + 103969.21181862066, + 103993.15475575015, + 104017.0990710887, + 104041.0447644777, + 104064.99183575854, + 104088.94028477269, + 104112.89011136163, + 104136.84131536692, + 104160.79389663014, + 104184.74785499295, + 104208.70319029699, + 104232.65990238401, + 104256.61799109577, + 104280.57745627411, + 104304.53829776087, + 104328.50051539797, + 104352.46410902737, + 104376.42907849104, + 104400.39542363105, + 104424.36314428948, + 104448.33224030846, + 104472.3027115302, + 104496.27455779689, + 104520.24777895081, + 104544.22237483428, + 104568.19834528965, + 104592.17569015936, + 104616.15440928582, + 104640.13450251156, + 104664.1159696791, + 104688.09881063103, + 104712.08302520998, + 104736.06861325864, + 104760.05557461972, + 104784.043909136, + 104808.03361665027, + 104832.0246970054, + 104856.01715004431, + 104880.01097560991, + 104904.00617354522, + 104928.00274369326, + 104952.00068589712, + 104975.99999999993, + 105000.00068584486, + 105024.00274327511, + 105048.00617213396, + 105072.0109722647, + 105096.0171435107, + 105120.02468571534, + 105144.03359872208, + 105168.04388237436, + 105192.05553651576, + 105216.06856098982, + 105240.08295564017, + 105264.09872031047, + 105288.11585484444, + 105312.13435908582, + 105336.1542328784, + 105360.17547606604, + 105384.19808849262, + 105408.22207000206, + 105432.24742043833, + 105456.27413964548, + 105480.30222746753, + 105504.33168374863, + 105528.36250833291, + 105552.39470106458, + 105576.42826178786, + 105600.46319034706, + 105624.49948658649, + 105648.53715035053, + 105672.5761814836, + 105696.61657983017, + 105720.65834523473, + 105744.70147754184, + 105768.7459765961, + 105792.79184224214, + 105816.83907432464, + 105840.88767268835, + 105864.93763717801, + 105888.98896763846, + 105913.04166391456, + 105937.09572585119, + 105961.15115329332, + 105985.20794608595, + 106009.26610407409, + 106033.32562710284, + 106057.38651501729, + 106081.44876766266, + 106105.51238488412, + 106129.57736652695, + 106153.64371243643, + 106177.71142245791, + 106201.78049643678, + 106225.85093421848, + 106249.92273564848, + 106273.99590057228, + 106298.07042883546, + 106322.14632028362, + 106346.22357476239, + 106370.30219211751, + 106394.38217219469, + 106418.46351483969, + 106442.54621989837, + 106466.63028721658, + 106490.71571664025, + 106514.80250801529, + 106538.89066118775, + 106562.98017600364, + 106587.07105230905, + 106611.16328995011, + 106635.25688877302, + 106659.35184862395, + 106683.44816934918, + 106707.54585079502, + 106731.64489280782, + 106755.74529523395, + 106779.84705791986, + 106803.95018071201, + 106828.05466345693, + 106852.16050600118, + 106876.26770819137, + 106900.37626987413, + 106924.48619089619, + 106948.59747110425, + 106972.71011034511, + 106996.82410846559, + 107020.93946531253, + 107045.05618073288, + 107069.17425457356, + 107093.29368668159, + 107117.41447690397, + 107141.53662508781, + 107165.66013108024, + 107189.7849947284, + 107213.91121587952, + 107238.03879438085, + 107262.16773007967, + 107286.29802282334, + 107310.42967245923, + 107334.56267883476, + 107358.69704179741, + 107382.83276119467, + 107406.96983687414, + 107431.10826868335, + 107455.24805646999, + 107479.38920008171, + 107503.53169936626, + 107527.67555417139, + 107551.82076434491, + 107575.96732973469, + 107600.11525018861, + 107624.26452555459, + 107648.41515568066, + 107672.56714041479, + 107696.72047960508, + 107720.87517309963, + 107745.03122074658, + 107769.18862239413, + 107793.34737789053, + 107817.50748708403, + 107841.66894982298, + 107865.83176595572, + 107889.99593533068, + 107914.16145779629, + 107938.32833320105, + 107962.49656139348, + 107986.66614222217, + 108010.83707553572, + 108035.00936118282, + 108059.18299901215, + 108083.35798887245, + 108107.53433061253, + 108131.71202408121, + 108155.89106912735, + 108180.07146559987, + 108204.25321334775, + 108228.43631221994, + 108252.62076206553, + 108276.80656273357, + 108300.99371407321, + 108325.18221593359, + 108349.37206816394, + 108373.56327061349, + 108397.75582313156, + 108421.94972556747, + 108446.1449777706, + 108470.34157959036, + 108494.53953087622, + 108518.73883147769, + 108542.93948124432, + 108567.14148002568, + 108591.34482767139, + 108615.54952403114, + 108639.75556895464, + 108663.96296229165, + 108688.17170389196, + 108712.38179360541, + 108736.59323128188, + 108760.80601677128, + 108785.02014992358, + 108809.23563058881, + 108833.45245861699, + 108857.67063385822, + 108881.89015616261, + 108906.11102538036, + 108930.33324136167, + 108954.55680395682, + 108978.78171301607, + 109003.00796838976, + 109027.23556992831, + 109051.46451748211, + 109075.69481090162, + 109099.92645003737, + 109124.15943473989, + 109148.39376485976, + 109172.62944024763, + 109196.86646075416, + 109221.10482623006, + 109245.34453652608, + 109269.58559149304, + 109293.82799098175, + 109318.07173484311, + 109342.31682292801, + 109366.56325508743, + 109390.81103117237, + 109415.06015103387, + 109439.31061452301, + 109463.56242149093, + 109487.8155717888, + 109512.07006526781, + 109536.3259017792, + 109560.58308117429, + 109584.8416033044, + 109609.1014680209, + 109633.36267517522, + 109657.62522461878, + 109681.88911620311, + 109706.15434977971, + 109730.4209252002, + 109754.68884231619, + 109778.95810097932, + 109803.22870104131, + 109827.50064235389, + 109851.77392476884, + 109876.04854813802, + 109900.32451231324, + 109924.60181714644, + 109948.88046248957, + 109973.1604481946, + 109997.44177411357, + 110021.72444009855, + 110046.00844600165, + 110070.29379167501, + 110094.58047697082, + 110118.86850174134, + 110143.15786583882, + 110167.44856911557, + 110191.74061142397, + 110216.03399261639, + 110240.32871254528, + 110264.62477106311, + 110288.9221680224, + 110313.22090327571, + 110337.52097667565, + 110361.82238807483, + 110386.12513732594, + 110410.42922428172, + 110434.73464879491, + 110459.04141071832, + 110483.34950990479, + 110507.6589462072, + 110531.96971947847, + 110556.28182957157, + 110580.5952763395, + 110604.91005963532, + 110629.22617931209, + 110653.54363522294, + 110677.86242722106, + 110702.18255515963, + 110726.50401889188, + 110750.82681827113, + 110775.1509531507, + 110799.47642338395, + 110823.80322882428, + 110848.13136932514, + 110872.46084474004, + 110896.79165492248, + 110921.12379972603, + 110945.4572790043, + 110969.79209261097, + 110994.12824039967, + 111018.46572222417, + 111042.80453793822, + 111067.14468739564, + 111091.48617045028, + 111115.82898695602, + 111140.1731367668, + 111164.51861973655, + 111188.86543571933, + 111213.21358456917, + 111237.56306614014, + 111261.91388028639, + 111286.26602686207, + 111310.61950572141, + 111334.97431671864, + 111359.33045970804, + 111383.68793454397, + 111408.04674108078, + 111432.40687917286, + 111456.76834867468, + 111481.13114944073, + 111505.49528132551, + 111529.86074418361, + 111554.22753786964, + 111578.59566223821, + 111602.96511714405, + 111627.33590244185, + 111651.7080179864, + 111676.08146363248, + 111700.45623923496, + 111724.8323446487, + 111749.20977972864, + 111773.58854432974, + 111797.96863830699, + 111822.35006151545, + 111846.73281381019, + 111871.11689504632, + 111895.50230507903, + 111919.8890437635, + 111944.27711095495, + 111968.6665065087, + 111993.05723028004, + 112017.44928212435, + 112041.842661897, + 112066.23736945343, + 112090.63340464912, + 112115.03076733962, + 112139.42945738042, + 112163.82947462716, + 112188.23081893545, + 112212.63349016097, + 112237.03748815943, + 112261.44281278658, + 112285.84946389822, + 112310.25744135017, + 112334.66674499828, + 112359.07737469849, + 112383.48933030672, + 112407.90261167898, + 112432.31721867126, + 112456.73315113965, + 112481.15040894024, + 112505.56899192919, + 112529.98889996267, + 112554.41013289688, + 112578.8326905881, + 112603.25657289263, + 112627.68177966679, + 112652.10831076698, + 112676.53616604958, + 112700.96534537108, + 112725.39584858794, + 112749.82767555672, + 112774.26082613398, + 112798.6953001763, + 112823.13109754038, + 112847.56821808286, + 112872.00666166049, + 112896.44642813003, + 112920.88751734827, + 112945.32992917208, + 112969.77366345831, + 112994.21872006389, + 113018.66509884578, + 113043.11279966099, + 113067.56182236652, + 113092.01216681948, + 113116.46383287695, + 113140.9168203961, + 113165.37112923413, + 113189.82675924824, + 113214.28371029573, + 113238.74198223387, + 113263.20157492002, + 113287.66248821157, + 113312.12472196593, + 113336.58827604055, + 113361.05315029295, + 113385.51934458067, + 113409.98685876124, + 113434.45569269233, + 113458.92584623155, + 113483.39731923661, + 113507.87011156522, + 113532.34422307517, + 113556.81965362425, + 113581.2964030703, + 113605.77447127122, + 113630.25385808491, + 113654.73456336933, + 113679.2165869825, + 113703.69992878241, + 113728.18458862718, + 113752.67056637487, + 113777.15786188368, + 113801.64647501177, + 113826.13640561736, + 113850.62765355874, + 113875.12021869418, + 113899.61410088204, + 113924.1092999807, + 113948.60581584855, + 113973.10364834407, + 113997.60279732574, + 114022.1032626521, + 114046.60504418171, + 114071.10814177318, + 114095.61255528514, + 114120.11828457628, + 114144.62532950533, + 114169.13368993104, + 114193.6433657122, + 114218.15435670764, + 114242.66666277625, + 114267.18028377694, + 114291.69521956862, + 114316.21147001031, + 114340.72903496103, + 114365.24791427983, + 114389.7681078258, + 114414.2896154581, + 114438.81243703589, + 114463.33657241837, + 114487.8620214648, + 114512.38878403447, + 114536.91685998671, + 114561.44624918087, + 114585.97695147636, + 114610.5089667326, + 114635.04229480909, + 114659.57693556532, + 114684.11288886084, + 114708.65015455526, + 114733.18873250818, + 114757.72862257928, + 114782.26982462825, + 114806.81233851484, + 114831.35616409882, + 114855.90130123998, + 114880.44774979822, + 114904.99550963337, + 114929.5445806054, + 114954.09496257425, + 114978.64665539992, + 115003.19965894247, + 115027.75397306195, + 115052.30959761847, + 115076.86653247218, + 115101.42477748329, + 115125.984332512, + 115150.54519741859, + 115175.10737206334, + 115199.67085630659, + 115224.23565000873, + 115248.80175303014, + 115273.3691652313, + 115297.93788647266, + 115322.50791661476, + 115347.07925551817, + 115371.65190304347, + 115396.22585905129, + 115420.80112340231, + 115445.37769595724, + 115469.95557657682, + 115494.53476512182, + 115519.11526145306, + 115543.69706543141, + 115568.28017691776, + 115592.86459577303, + 115617.4503218582, + 115642.03735503425, + 115666.62569516223, + 115691.21534210323, + 115715.80629571836, + 115740.39855586876, + 115764.99212241563, + 115789.58699522018, + 115814.18317414368, + 115838.78065904744, + 115863.37944979276, + 115887.97954624105, + 115912.5809482537, + 115937.18365569216, + 115961.78766841792, + 115986.39298629249, + 116010.99960917742, + 116035.60753693432, + 116060.21676942479, + 116084.82730651053, + 116109.43914805322, + 116134.0522939146, + 116158.66674395646, + 116183.2824980406, + 116207.89955602887, + 116232.51791778316, + 116257.13758316539, + 116281.75855203751, + 116306.38082426153, + 116331.00439969949, + 116355.62927821343, + 116380.25545966547, + 116404.88294391775, + 116429.51173083246, + 116454.14182027178, + 116478.77321209799, + 116503.40590617337, + 116528.03990236025, + 116552.67520052097, + 116577.31180051794, + 116601.94970221359, + 116626.5889054704, + 116651.22941015086, + 116675.87121611751, + 116700.51432323294, + 116725.15873135976, + 116749.8044403606, + 116774.45145009817, + 116799.0997604352, + 116823.74937123443, + 116848.40028235866, + 116873.05249367072, + 116897.70600503348, + 116922.36081630984, + 116947.01692736275, + 116971.67433805518, + 116996.33304825013, + 117020.99305781067, + 117045.65436659988, + 117070.31697448085, + 117094.98088131678, + 117119.64608697082, + 117144.31259130624, + 117168.98039418629, + 117193.64949547425, + 117218.31989503348, + 117242.99159272734, + 117267.66458841923, + 117292.33888197262, + 117317.01447325097, + 117341.6913621178, + 117366.36954843666, + 117391.04903207115, + 117415.72981288488, + 117440.41189074152, + 117465.09526550474, + 117489.77993703831, + 117514.46590520597, + 117539.15316987153, + 117563.84173089883, + 117588.53158815173, + 117613.22274149416, + 117637.91519079007, + 117662.60893590341, + 117687.30397669821, + 117712.00031303853, + 117736.69794478847, + 117761.39687181212, + 117786.09709397367, + 117810.7986111373, + 117835.50142316725, + 117860.20552992777, + 117884.91093128319, + 117909.6176270978, + 117934.32561723603, + 117959.03490156225, + 117983.74547994092, + 118008.45735223651, + 118033.17051831353, + 118057.88497803656, + 118082.60073127014, + 118107.31777787894, + 118132.03611772758, + 118156.75575068076, + 118181.47667660323, + 118206.19889535972, + 118230.92240681504, + 118255.64721083404, + 118280.37330728157, + 118305.10069602253, + 118329.82937692189, + 118354.55934984458, + 118379.29061465565, + 118404.02317122012, + 118428.75701940308, + 118453.49215906965, + 118478.22859008498, + 118502.96631231424, + 118527.70532562268, + 118552.44562987552, + 118577.18722493808, + 118601.93011067568, + 118626.67428695368, + 118651.41975363747, + 118676.16651059251, + 118700.91455768423, + 118725.66389477813, + 118750.41452173979, + 118775.16643843475, + 118799.91964472862, + 118824.67414048707, + 118849.42992557574, + 118874.18699986035, + 118898.94536320666, + 118923.70501548045, + 118948.46595654752, + 118973.22818627374, + 118997.99170452499, + 119022.7565111672, + 119047.52260606633, + 119072.28998908834, + 119097.0586600993, + 119121.82861896523, + 119146.59986555226, + 119171.3723997265, + 119196.14622135412, + 119220.92133030134, + 119245.69772643436, + 119270.47540961947, + 119295.25437972297, + 119320.03463661121, + 119344.81618015055, + 119369.5990102074, + 119394.38312664822, + 119419.16852933947, + 119443.95521814766, + 119468.74319293935, + 119493.53245358112, + 119518.32299993958, + 119543.11483188139, + 119567.90794927324, + 119592.70235198183, + 119617.49803987393, + 119642.29501281632, + 119667.09327067583, + 119691.89281331931, + 119716.69364061367, + 119741.49575242582, + 119766.29914862274, + 119791.10382907141, + 119815.90979363887, + 119840.71704219218, + 119865.52557459843, + 119890.33539072477, + 119915.14649043836, + 119939.95887360642, + 119964.77254009615, + 119989.58748977486, + 120014.40372250983, + 120039.22123816841, + 120064.04003661797, + 120088.86011772591, + 120113.6814813597, + 120138.5041273868, + 120163.3280556747, + 120188.15326609099, + 120212.97975850321, + 120237.807532779, + 120262.63658878599, + 120287.46692639188, + 120312.29854546436, + 120337.13144587121, + 120361.9656274802, + 120386.80109015915, + 120411.63783377589, + 120436.47585819835, + 120461.31516329442, + 120486.15574893207, + 120510.99761497928, + 120535.84076130406, + 120560.68518777451, + 120585.53089425867, + 120610.3778806247, + 120635.22614674074, + 120660.07569247499, + 120684.92651769568, + 120709.77862227106, + 120734.63200606944, + 120759.48666895913, + 120784.3426108085, + 120809.19983148595, + 120834.05833085992, + 120858.91810879884, + 120883.77916517125, + 120908.64149984565, + 120933.5051126906, + 120958.37000357473, + 120983.23617236665, + 121008.10361893504, + 121032.97234314861, + 121057.84234487606, + 121082.71362398617, + 121107.58618034775, + 121132.46001382964, + 121157.33512430069, + 121182.21151162982, + 121207.08917568595, + 121231.96811633807, + 121256.84833345517, + 121281.72982690629, + 121306.61259656049, + 121331.49664228689, + 121356.38196395461, + 121381.26856143285, + 121406.15643459078, + 121431.04558329767, + 121455.93600742276, + 121480.82770683538, + 121505.72068140487, + 121530.61493100057, + 121555.51045549192, + 121580.40725474835, + 121605.30532863933, + 121630.20467703436, + 121655.10529980299, + 121680.00719681478, + 121704.91036793934, + 121729.81481304632, + 121754.72053200539, + 121779.62752468624, + 121804.53579095862, + 121829.44533069231, + 121854.3561437571, + 121879.26823002285, + 121904.1815893594, + 121929.09622163669, + 121954.01212672464, + 121978.92930449323, + 122003.84775481246, + 122028.76747755238, + 122053.68847258303, + 122078.61073977455, + 122103.53427899707, + 122128.45909012076, + 122153.38517301581, + 122178.31252755247, + 122203.24115360099, + 122228.17105103172, + 122253.10221971494, + 122278.03465952107, + 122302.96837032049, + 122327.90335198362, + 122352.83960438096, + 122377.777127383, + 122402.71592086025, + 122427.65598468333, + 122452.59731872278, + 122477.53992284928, + 122502.48379693348, + 122527.42894084606, + 122552.37535445779, + 122577.32303763942, + 122602.27199026172, + 122627.22221219557, + 122652.17370331181, + 122677.12646348133, + 122702.08049257506, + 122727.03579046397, + 122751.99235701906, + 122776.95019211136, + 122801.9092956119, + 122826.8696673918, + 122851.83130732219, + 122876.79421527422, + 122901.75839111909, + 122926.72383472799, + 122951.69054597223, + 122976.65852472307, + 123001.62777085182, + 123026.59828422987, + 123051.57006472857, + 123076.54311221937, + 123101.5174265737, + 123126.49300766307, + 123151.46985535898, + 123176.44796953299, + 123201.42735005668, + 123226.40799680166, + 123251.38990963959, + 123276.37308844214, + 123301.35753308103, + 123326.343243428, + 123351.33021935483, + 123376.31846073334, + 123401.30796743535, + 123426.29873933276, + 123451.29077629748, + 123476.28407820144, + 123501.2786449166, + 123526.27447631498, + 123551.27157226863, + 123576.26993264959, + 123601.26955732999, + 123626.27044618195, + 123651.27259907764, + 123676.27601588926, + 123701.28069648903, + 123726.28664074924, + 123751.29384854218, + 123776.30231974016, + 123801.31205421555, + 123826.32305184075, + 123851.33531248817, + 123876.34883603029, + 123901.36362233957, + 123926.37967128855, + 123951.39698274979, + 123976.41555659588, + 124001.43539269941, + 124026.45649093305, + 124051.47885116948, + 124076.50247328142, + 124101.5273571416, + 124126.55350262282, + 124151.58090959788, + 124176.60957793961, + 124201.63950752091, + 124226.67069821467, + 124251.70314989384, + 124276.73686243138, + 124301.7718357003, + 124326.80806957364, + 124351.84556392446, + 124376.88431862585, + 124401.92433355095, + 124426.96560857294, + 124452.00814356498, + 124477.05193840031, + 124502.0969929522, + 124527.14330709392, + 124552.19088069882, + 124577.23971364023, + 124602.28980579154, + 124627.34115702618, + 124652.3937672176, + 124677.44763623926, + 124702.50276396469, + 124727.55915026742, + 124752.61679502104, + 124777.67569809916, + 124802.73585937542, + 124827.79727872348, + 124852.85995601704, + 124877.92389112986, + 124902.98908393568, + 124928.05553430831, + 124953.1232421216, + 124978.19220724938, + 125003.26242956554, + 125028.33390894404, + 125053.40664525882, + 125078.48063838384, + 125103.55588819318, + 125128.63239456083, + 125153.71015736091, + 125178.78917646752, + 125203.86945175481, + 125228.95098309696, + 125254.03377036817, + 125279.1178134427, + 125304.20311219479, + 125329.28966649878, + 125354.37747622898, + 125379.46654125977, + 125404.55686146552, + 125429.6484367207, + 125454.74126689974, + 125479.83535187715, + 125504.93069152744, + 125530.02728572517, + 125555.12513434493, + 125580.22423726133, + 125605.32459434902, + 125630.4262054827, + 125655.52907053704, + 125680.63318938682, + 125705.73856190679, + 125730.84518797178, + 125755.9530674566, + 125781.06220023613, + 125806.17258618528, + 125831.28422517896, + 125856.39711709213, + 125881.51126179981, + 125906.62665917698, + 125931.74330909875, + 125956.86121144016, + 125981.98036607634, + 126007.10077288245, + 126032.22243173365, + 126057.34534250517, + 126082.46950507225, + 126107.59491931014, + 126132.72158509417, + 126157.84950229966, + 126182.97867080198, + 126208.10909047653, + 126233.24076119871, + 126258.37368284403, + 126283.50785528794, + 126308.64327840599, + 126333.77995207369, + 126358.91787616667, + 126384.0570505605, + 126409.19747513086, + 126434.3391497534, + 126459.48207430386, + 126484.62624865794, + 126509.77167269142, + 126534.9183462801, + 126560.06626929982, + 126585.21544162642, + 126610.36586313581, + 126635.51753370393, + 126660.67045320668, + 126685.82462152008, + 126710.98003852014, + 126736.13670408291, + 126761.29461808444, + 126786.45378040087, + 126811.61419090834, + 126836.77584948298, + 126861.93875600102, + 126887.10291033868, + 126912.26831237224, + 126937.43496197795, + 126962.60285903217, + 126987.77200341123, + 127012.94239499152, + 127038.11403364947, + 127063.2869192615, + 127088.46105170409, + 127113.63643085376, + 127138.81305658702, + 127163.99092878048, + 127189.17004731069, + 127214.35041205429, + 127239.53202288797, + 127264.71487968838, + 127289.89898233226, + 127315.08433069635, + 127340.27092465744, + 127365.45876409234, + 127390.64784887788, + 127415.83817889093, + 127441.02975400841, + 127466.22257410725, + 127491.41663906439, + 127516.61194875685, + 127541.80850306165, + 127567.00630185583, + 127592.20534501647, + 127617.4056324207, + 127642.60716394568, + 127667.80993946856, + 127693.01395886653, + 127718.21922201688, + 127743.42572879682, + 127768.63347908368, + 127793.84247275478, + 127819.05270968749, + 127844.26418975917, + 127869.47691284724, + 127894.69087882918, + 127919.90608758242, + 127945.12253898452, + 127970.34023291297, + 127995.55916924537, + 128020.77934785932, + 128046.00076863244, + 128071.22343144237, + 128096.44733616684, + 128121.67248268353, + 128146.89887087021, + 128172.12650060465, + 128197.35537176467, + 128222.5854842281, + 128247.81683787282, + 128273.04943257671, + 128298.28326821771, + 128323.51834467379, + 128348.75466182294, + 128373.99221954317, + 128399.23101771252, + 128424.47105620909, + 128449.71233491098, + 128474.95485369631, + 128500.19861244329, + 128525.44361103009, + 128550.68984933494, + 128575.93732723613, + 128601.18604461191, + 128626.43600134061, + 128651.68719730059, + 128676.93963237021, + 128702.1933064279, + 128727.44821935208, + 128752.70437102125, + 128777.96176131385, + 128803.22039010846, + 128828.48025728362, + 128853.74136271792, + 128879.00370628996, + 128904.26728787841, + 128929.53210736193, + 128954.79816461923, + 128980.06545952905, + 129005.33399197015, + 129030.60376182134, + 129055.87476896142, + 129081.14701326926, + 129106.42049462376, + 129131.6952129038, + 129156.97116798835, + 129182.24835975636, + 129207.52678808685, + 129232.80645285884, + 129258.08735395141, + 129283.36949124365, + 129308.65286461466, + 129333.9374739436, + 129359.22331910966, + 129384.51039999202, + 129409.79871646997, + 129435.08826842274, + 129460.37905572963, + 129485.67107826998, + 129510.96433592314, + 129536.25882856851, + 129561.55455608548, + 129586.85151835352, + 129612.14971525209, + 129637.4491466607, + 129662.74981245887, + 129688.0517125262, + 129713.35484674224, + 129738.65921498663, + 129763.96481713903, + 129789.27165307909, + 129814.57972268655, + 129839.88902584116, + 129865.19956242264, + 129890.51133231082, + 129915.82433538554, + 129941.13857152662, + 129966.45404061397, + 129991.7707425275, + 130017.08867714716, + 130042.4078443529, + 130067.72824402474, + 130093.04987604271, + 130118.37274028687, + 130143.69683663732, + 130169.02216497416, + 130194.34872517755, + 130219.67651712766, + 130245.0055407047, + 130270.33579578891, + 130295.66728226055, + 130320.99999999991, + 130346.33394888733, + 130371.66912880314, + 130397.00553962773, + 130422.34318124152, + 130447.68205352494, + 130473.02215635845, + 130498.36348962256, + 130523.70605319779, + 130549.0498469647, + 130574.39487080388, + 130599.74112459592, + 130625.08860822149, + 130650.43732156123, + 130675.78726449587, + 130701.13843690613, + 130726.49083867275, + 130751.84446967654, + 130777.19932979831, + 130802.5554189189, + 130827.91273691918, + 130853.27128368006, + 130878.63105908247, + 130903.99206300738, + 130929.35429533575, + 130954.71775594862, + 130980.08244472703, + 131005.44836155206, + 131030.81550630482, + 131056.18387886642, + 131081.55347911804, + 131106.92430694087, + 131132.29636221612, + 131157.66964482504, + 131183.0441546489, + 131208.41989156904, + 131233.79685546676, + 131259.17504622342, + 131284.55446372041, + 131309.93510783918, + 131335.31697846117, + 131360.70007546784, + 131386.0843987407, + 131411.46994816128, + 131436.85672361116, + 131462.24472497194, + 131487.63395212521, + 131513.02440495262, + 131538.41608333588, + 131563.80898715663, + 131589.2031162967, + 131614.59847063778, + 131639.9950500617, + 131665.39285445024, + 131690.79188368531, + 131716.19213764873, + 131741.59361622241, + 131766.99631928833, + 131792.40024672839, + 131817.80539842462, + 131843.21177425905, + 131868.61937411371, + 131894.02819787065, + 131919.43824541202, + 131944.84951661993, + 131970.26201137656, + 131995.67572956407, + 132021.09067106468, + 132046.50683576067, + 132071.9242235343, + 132097.34283426782, + 132122.76266784366, + 132148.1837241441, + 132173.60600305157, + 132199.02950444847, + 132224.45422821722, + 132249.88017424036, + 132275.30734240031, + 132300.73573257966, + 132326.16534466096, + 132351.59617852676, + 132377.02823405969, + 132402.46151114244, + 132427.89600965759, + 132453.33172948789, + 132478.76867051609, + 132504.20683262491, + 132529.64621569714, + 132555.08681961559, + 132580.5286442631, + 132605.97168952253, + 132631.41595527678, + 132656.86144140881, + 132682.30814780149, + 132707.75607433787, + 132733.20522090094, + 132758.65558737374, + 132784.10717363929, + 132809.55997958075, + 132835.01400508118, + 132860.46925002377, + 132885.92571429166, + 132911.38339776811, + 132936.84230033628, + 132962.30242187946, + 132987.76376228096, + 133013.22632142407, + 133038.69009919214, + 133064.15509546854, + 133089.62131013666, + 133115.08874307995, + 133140.55739418184, + 133166.02726332581, + 133191.49835039541, + 133216.97065527414, + 133242.44417784561, + 133267.91891799335, + 133293.39487560102, + 133318.87205055228, + 133344.35044273079, + 133369.83005202023, + 133395.31087830439, + 133420.79292146701, + 133446.27618139185, + 133471.76065796276, + 133497.24635106357, + 133522.73326057816, + 133548.22138639039, + 133573.71072838426, + 133599.20128644365, + 133624.69306045261, + 133650.1860502951, + 133675.68025585517, + 133701.1756770169, + 133726.67231366437, + 133752.17016568172, + 133777.66923295305, + 133803.16951536259, + 133828.67101279454, + 133854.17372513309, + 133879.67765226253, + 133905.18279406714, + 133930.68915043125, + 133956.19672123916, + 133981.70550637526, + 134007.21550572399, + 134032.7267191697, + 134058.23914659687, + 134083.75278789, + 134109.26764293358, + 134134.78371161217, + 134160.30099381026, + 134185.8194894125, + 134211.33919830353, + 134236.8601203679, + 134262.38225549037, + 134287.90560355558, + 134313.43016444831, + 134338.95593805326, + 134364.48292425525, + 134390.01112293909, + 134415.54053398955, + 134441.07115729159, + 134466.60299273001, + 134492.1360401898, + 134517.67029955584, + 134543.20577071316, + 134568.74245354676, + 134594.28034794159, + 134619.81945378278, + 134645.35977095537, + 134670.90129934452, + 134696.4440388353, + 134721.98798931291, + 134747.53315066252, + 134773.07952276937, + 134798.62710551871, + 134824.17589879577, + 134849.72590248589, + 134875.27711647438, + 134900.82954064661, + 134926.38317488792, + 134951.93801908373, + 134977.49407311951, + 135003.05133688069, + 135028.60981025276, + 135054.16949312127, + 135079.73038537172, + 135105.29248688967, + 135130.85579756077, + 135156.42031727062, + 135181.98604590484, + 135207.55298334916, + 135233.12112948924, + 135258.69048421088, + 135284.26104739975, + 135309.83281894168, + 135335.4057987225, + 135360.97998662802, + 135386.55538254412, + 135412.13198635669, + 135437.70979795168, + 135463.28881721498, + 135488.86904403262, + 135514.45047829056, + 135540.03311987486, + 135565.61696867159, + 135591.20202456677, + 135616.78828744654, + 135642.37575719706, + 135667.96443370447, + 135693.55431685498, + 135719.14540653475, + 135744.73770263011, + 135770.33120502727, + 135795.92591361253, + 135821.52182827223, + 135847.11894889272, + 135872.7172753604, + 135898.31680756161, + 135923.91754538284, + 135949.51948871053, + 135975.12263743114, + 136000.72699143123, + 136026.33255059729, + 136051.93931481591, + 136077.54728397369, + 136103.15645795723, + 136128.76683665317, + 136154.37841994822, + 136179.99120772901, + 136205.60519988232, + 136231.2203962949, + 136256.83679685349, + 136282.45440144493, + 136308.07320995603, + 136333.69322227367, + 136359.31443828469, + 136384.93685787608, + 136410.56048093468, + 136436.18530734754, + 136461.81133700156, + 136487.43856978384, + 136513.06700558143, + 136538.6966442813, + 136564.32748577066, + 136589.95952993655, + 136615.59277666616, + 136641.22722584667, + 136666.86287736523, + 136692.49973110916, + 136718.13778696564, + 136743.77704482197, + 136769.41750456547, + 136795.05916608346, + 136820.70202926331, + 136846.34609399244, + 136871.99136015819, + 136897.63782764805, + 136923.28549634948, + 136948.93436614997, + 136974.58443693706, + 137000.23570859825, + 137025.88818102115, + 137051.54185409332, + 137077.19672770242, + 137102.85280173609, + 137128.51007608202, + 137154.16855062786, + 137179.82822526142, + 137205.48909987041, + 137231.15117434258, + 137256.8144485658, + 137282.47892242789, + 137308.14459581667, + 137333.81146862009, + 137359.47954072602, + 137385.14881202241, + 137410.81928239719, + 137436.49095173844, + 137462.16381993407, + 137487.83788687221, + 137513.51315244089, + 137539.18961652822, + 137564.86727902229, + 137590.54613981131, + 137616.22619878338, + 137641.90745582676, + 137667.58991082967, + 137693.27356368033, + 137718.95841426702, + 137744.64446247809, + 137770.33170820182, + 137796.02015132661, + 137821.70979174081, + 137847.40062933284, + 137873.09266399115, + 137898.78589560417, + 137924.48032406042, + 137950.17594924837, + 137975.8727710566, + 138001.57078937365, + 138027.27000408815, + 138052.97041508864, + 138078.67202226384, + 138104.3748255024, + 138130.07882469296, + 138155.78401972432, + 138181.49041048516, + 138207.1979968643, + 138232.9067787505, + 138258.61675603263, + 138284.32792859949, + 138310.04029633995, + 138335.75385914298, + 138361.46861689744, + 138387.18456949232, + 138412.90171681659, + 138438.62005875923, + 138464.33959520931, + 138490.06032605586, + 138515.78225118798, + 138541.50537049473, + 138567.2296838653, + 138592.95519118884, + 138618.68189235451, + 138644.40978725153, + 138670.13887576913, + 138695.86915779658, + 138721.60063322316, + 138747.33330193823, + 138773.06716383106, + 138798.80221879104, + 138824.53846670757, + 138850.27590747006, + 138876.01454096794, + 138901.7543670907, + 138927.49538572782, + 138953.2375967688, + 138978.9810001032, + 139004.72559562061, + 139030.47138321059, + 139056.2183627628, + 139081.96653416683, + 139107.71589731239, + 139133.46645208917, + 139159.21819838689, + 139184.97113609532, + 139210.72526510421, + 139236.48058530336, + 139262.23709658257, + 139287.99479883176, + 139313.75369194071, + 139339.51377579942, + 139365.27505029776, + 139391.03751532568, + 139416.80117077316, + 139442.56601653024, + 139468.33205248689, + 139494.09927853322, + 139519.86769455927, + 139545.63730045516, + 139571.408096111, + 139597.18008141697, + 139622.95325626322, + 139648.72762054001, + 139674.5031741375, + 139700.27991694602, + 139726.05784885579, + 139751.83696975713, + 139777.61727954043, + 139803.39877809596, + 139829.18146531415, + 139854.96534108539, + 139880.75040530015, + 139906.53665784886, + 139932.32409862199, + 139958.11272751007, + 139983.90254440365, + 140009.69354919327, + 140035.48574176949, + 140061.27912202294, + 140087.07368984428, + 140112.86944512415, + 140138.66638775321, + 140164.4645176222, + 140190.26383462184, + 140216.06433864293, + 140241.86602957622, + 140267.66890731253, + 140293.47297174268, + 140319.27822275754, + 140345.08466024802, + 140370.89228410498, + 140396.70109421943, + 140422.51109048226, + 140448.32227278448, + 140474.13464101712, + 140499.94819507122, + 140525.76293483781, + 140551.57886020801, + 140577.3959710729, + 140603.21426732364, + 140629.03374885136, + 140654.85441554731, + 140680.67626730262, + 140706.49930400858, + 140732.32352555645, + 140758.1489318375, + 140783.97552274304, + 140809.80329816442, + 140835.63225799298, + 140861.46240212015, + 140887.29373043729, + 140913.12624283586, + 140938.95993920733, + 140964.79481944317, + 140990.63088343487, + 141016.46813107401, + 141042.30656225214, + 141068.14617686081, + 141093.98697479168, + 141119.82895593636, + 141145.6721201865, + 141171.51646743377, + 141197.36199756994, + 141223.20871048668, + 141249.05660607578, + 141274.90568422904, + 141300.75594483822, + 141326.6073877952, + 141352.4600129918, + 141378.31382031992, + 141404.16880967148, + 141430.02498093838, + 141455.8823340126, + 141481.74086878612, + 141507.60058515094, + 141533.46148299909, + 141559.32356222265, + 141585.18682271364, + 141611.05126436421, + 141636.9168870665, + 141662.78369071262, + 141688.65167519479, + 141714.5208404052, + 141740.39118623605, + 141766.26271257963, + 141792.1354193282, + 141818.00930637406, + 141843.88437360956, + 141869.760620927, + 141895.6380482188, + 141921.51665537735, + 141947.39644229505, + 141973.27740886438, + 141999.15955497778, + 142025.04288052776, + 142050.92738540689, + 142076.81306950765, + 142102.69993272264, + 142128.58797494444, + 142154.47719606571, + 142180.36759597904, + 142206.25917457714, + 142232.15193175265, + 142258.04586739838, + 142283.94098140698, + 142309.83727367126, + 142335.73474408401, + 142361.63339253806, + 142387.5332189262, + 142413.43422314132, + 142439.33640507635, + 142465.23976462413, + 142491.14430167765, + 142517.05001612983, + 142542.95690787368, + 142568.86497680223, + 142594.77422280848, + 142620.68464578551, + 142646.5962456264, + 142672.50902222423, + 142698.42297547215, + 142724.33810526333, + 142750.25441149093, + 142776.17189404817, + 142802.09055282827, + 142828.01038772447, + 142853.93139863008, + 142879.85358543837, + 142905.77694804268, + 142931.70148633636, + 142957.62720021277, + 142983.55408956532, + 143009.48215428743, + 143035.41139427255, + 143061.34180941415, + 143087.27339960571, + 143113.20616474075, + 143139.14010471283, + 143165.07521941551, + 143191.01150874238, + 143216.94897258704, + 143242.88761084314, + 143268.82742340435, + 143294.76841016437, + 143320.71057101688, + 143346.65390585564, + 143372.59841457437, + 143398.54409706692, + 143424.49095322701, + 143450.43898294857, + 143476.38818612538, + 143502.33856265133, + 143528.29011242036, + 143554.24283532638, + 143580.19673126334, + 143606.1518001252, + 143632.10804180597, + 143658.06545619969, + 143684.02404320039, + 143709.98380270213, + 143735.944734599, + 143761.90683878519, + 143787.87011515474, + 143813.83456360188, + 143839.8001840208, + 143865.76697630569, + 143891.73494035081, + 143917.7040760504, + 143943.67438329876, + 143969.6458619902, + 143995.61851201905, + 144021.59233327967, + 144047.56732566646, + 144073.54348907378, + 144099.52082339607, + 144125.49932852783, + 144151.4790043635, + 144177.45985079758, + 144203.44186772458, + 144229.42505503909, + 144255.40941263564, + 144281.39494040885, + 144307.38163825331, + 144333.36950606373, + 144359.35854373468, + 144385.34875116093, + 144411.34012823718, + 144437.33267485813, + 144463.32639091855, + 144489.32127631325, + 144515.31733093705, + 144541.31455468474, + 144567.3129474512, + 144593.3125091313, + 144619.31323961995, + 144645.31513881206, + 144671.31820660262, + 144697.32244288657, + 144723.32784755889, + 144749.33442051467, + 144775.34216164888, + 144801.35107085665, + 144827.36114803303, + 144853.37239307314, + 144879.38480587213, + 144905.39838632516, + 144931.41313432742, + 144957.4290497741, + 144983.44613256046, + 145009.46438258173, + 145035.48379973322, + 145061.50438391021, + 145087.52613500805, + 145113.54905292206, + 145139.57313754765, + 145165.59838878017, + 145191.62480651509, + 145217.65239064783, + 145243.68114107384, + 145269.71105768863, + 145295.74214038774, + 145321.77438906668, + 145347.80780362099, + 145373.84238394629, + 145399.87812993818, + 145425.91504149229, + 145451.95311850426, + 145477.9923608698, + 145504.03276848458, + 145530.07434124436, + 145556.11707904484, + 145582.16098178181, + 145608.20604935108, + 145634.25228164849, + 145660.29967856981, + 145686.34824001096, + 145712.39796586783, + 145738.4488560363, + 145764.50091041232, + 145790.55412889185, + 145816.60851137087, + 145842.66405774537, + 145868.72076791141, + 145894.77864176501, + 145920.83767920226, + 145946.89788011924, + 145972.95924441208, + 145999.02177197693, + 146025.08546270995, + 146051.15031650732, + 146077.21633326527, + 146103.28351288004, + 146129.35185524789, + 146155.42136026506, + 146181.49202782792, + 146207.56385783272, + 146233.63685017588, + 146259.71100475377, + 146285.78632146274, + 146311.86280019928, + 146337.94044085976, + 146364.01924334071, + 146390.09920753856, + 146416.18033334985, + 146442.26262067116, + 146468.34606939898, + 146494.43067942993, + 146520.51645066062, + 146546.60338298764, + 146572.69147630769, + 146598.78073051744, + 146624.87114551352, + 146650.96272119274, + 146677.05545745179, + 146703.14935418745, + 146729.2444112965, + 146755.34062867577, + 146781.43800622207, + 146807.53654383228, + 146833.63624140329, + 146859.73709883197, + 146885.83911601527, + 146911.94229285014, + 146938.04662923355, + 146964.15212506248, + 146990.25878023397, + 147016.36659464505, + 147042.47556819281, + 147068.58570077427, + 147094.6969922866, + 147120.80944262692, + 147146.92305169237, + 147173.03781938017, + 147199.15374558745, + 147225.27083021149, + 147251.38907314953, + 147277.50847429881, + 147303.62903355664, + 147329.75075082036, + 147355.87362598727, + 147381.99765895473, + 147408.12284962015, + 147434.24919788091, + 147460.37670363448, + 147486.50536677826, + 147512.63518720976, + 147538.76616482646, + 147564.89829952587, + 147591.03159120557, + 147617.16603976308, + 147643.30164509601, + 147669.43840710199, + 147695.57632567859, + 147721.71540072354, + 147747.85563213445, + 147773.99701980909, + 147800.13956364512, + 147826.28326354033, + 147852.42811939248, + 147878.57413109933, + 147904.72129855872, + 147930.86962166851, + 147957.01910032652, + 147983.16973443062, + 148009.32152387875, + 148035.47446856883, + 148061.62856839882, + 148087.78382326665, + 148113.94023307035, + 148140.09779770792, + 148166.25651707739, + 148192.41639107687, + 148218.57741960438, + 148244.73960255808, + 148270.90293983606, + 148297.0674313365, + 148323.23307695755, + 148349.39987659742, + 148375.56783015432, + 148401.73693752653, + 148427.90719861226, + 148454.07861330983, + 148480.25118151752, + 148506.42490313368, + 148532.59977805667, + 148558.77580618486, + 148584.95298741665, + 148611.13132165043, + 148637.31080878471, + 148663.49144871789, + 148689.6732413485, + 148715.85618657502, + 148742.040284296, + 148768.22553440998, + 148794.41193681557, + 148820.59949141133, + 148846.78819809589, + 148872.97805676793, + 148899.16906732606, + 148925.36122966901, + 148951.55454369547, + 148977.74900930419, + 149003.9446263939, + 149030.1413948634, + 149056.33931461151, + 149082.53838553699, + 149108.73860753875, + 149134.9399805156, + 149161.14250436646, + 149187.34617899026, + 149213.5510042859, + 149239.75698015234, + 149265.96410648854, + 149292.17238319354, + 149318.38181016635, + 149344.59238730598, + 149370.80411451156, + 149397.01699168212, + 149423.23101871679, + 149449.44619551473, + 149475.66252197503, + 149501.87999799693, + 149528.0986234796, + 149554.31839832227, + 149580.53932242419, + 149606.76139568459, + 149632.98461800278, + 149659.20898927809, + 149685.43450940982, + 149711.66117829733, + 149737.88899584001, + 149764.11796193724, + 149790.34807648844, + 149816.57933939309, + 149842.81175055061, + 149869.04530986046, + 149895.28001722222, + 149921.51587253538, + 149947.75287569952, + 149973.99102661415, + 150000.23032517891, + 150026.47077129342, + 150052.71236485732, + 150078.95510577026, + 150105.1989939319, + 150131.444029242, + 150157.69021160025, + 150183.93754090639, + 150210.18601706024, + 150236.43563996154, + 150262.68640951012, + 150288.93832560582, + 150315.19138814852, + 150341.44559703805, + 150367.70095217437, + 150393.95745345735, + 150420.21510078697, + 150446.47389406321, + 150472.73383318601, + 150498.99491805542, + 150525.25714857146, + 150551.52052463419, + 150577.78504614369, + 150604.05071300003, + 150630.31752510337, + 150656.58548235384, + 150682.85458465159, + 150709.1248318968, + 150735.39622398972, + 150761.66876083051, + 150787.9424423195, + 150814.21726835691, + 150840.49323884305, + 150866.77035367821, + 150893.04861276277, + 150919.32801599705, + 150945.60856328148, + 150971.89025451642, + 150998.17308960229, + 151024.45706843957, + 151050.74219092872, + 151077.02845697021, + 151103.31586646455, + 151129.60441931229, + 151155.894115414, + 151182.1849546702, + 151208.47693698155, + 151234.77006224863, + 151261.06433037209, + 151287.35974125259, + 151313.65629479082, + 151339.95399088747, + 151366.25282944329, + 151392.55281035902, + 151418.85393353543, + 151445.1561988733, + 151471.45960627345, + 151497.76415563675, + 151524.06984686397, + 151550.37667985607, + 151576.68465451393, + 151602.99377073845, + 151629.30402843058, + 151655.61542749128, + 151681.92796782157, + 151708.24164932242, + 151734.55647189484, + 151760.87243543993, + 151787.18953985872, + 151813.50778505235, + 151839.82717092187, + 151866.14769736846, + 151892.46936429327, + 151918.79217159748, + 151945.11611918229, + 151971.44120694889, + 151997.76743479856, + 152024.09480263255, + 152050.42331035214, + 152076.75295785864, + 152103.08374505339, + 152129.41567183775, + 152155.74873811303, + 152182.08294378067, + 152208.41828874208, + 152234.75477289871, + 152261.09239615197, + 152287.43115840337, + 152313.77105955439, + 152340.11209950657, + 152366.45427816146, + 152392.79759542056, + 152419.14205118554, + 152445.48764535793, + 152471.8343778394, + 152498.18224853161, + 152524.53125733617, + 152550.88140415482, + 152577.23268888926, + 152603.58511144121, + 152629.93867171241, + 152656.29336960468, + 152682.64920501978, + 152709.00617785956, + 152735.36428802583, + 152761.72353542043, + 152788.08391994529, + 152814.44544150229, + 152840.80809999333, + 152867.17189532038, + 152893.53682738543, + 152919.90289609041, + 152946.27010133737, + 152972.63844302832, + 152999.00792106529, + 153025.37853535041, + 153051.7502857857, + 153078.12317227334, + 153104.4971947154, + 153130.8723530141, + 153157.24864707157, + 153183.62607679001, + 153210.00464207167, + 153236.38434281875, + 153262.76517893354, + 153289.14715031831, + 153315.53025687535, + 153341.91449850702, + 153368.2998751156, + 153394.68638660354, + 153421.07403287315, + 153447.46281382689, + 153473.85272936718, + 153500.24377939643, + 153526.63596381716, + 153553.02928253182, + 153579.42373544298, + 153605.81932245308, + 153632.21604346478, + 153658.61389838057, + 153685.0128871031, + 153711.41300953497, + 153737.81426557881, + 153764.21665513728, + 153790.62017811305, + 153817.02483440886, + 153843.43062392739, + 153869.83754657139, + 153896.24560224367, + 153922.65479084692, + 153949.06511228404, + 153975.4765664578, + 154001.88915327107, + 154028.30287262669, + 154054.71772442761, + 154081.13370857667, + 154107.55082497682, + 154133.96907353101, + 154160.38845414223, + 154186.80896671346, + 154213.23061114774, + 154239.65338734805, + 154266.07729521746, + 154292.50233465908, + 154318.92850557598, + 154345.35580787127, + 154371.7842414481, + 154398.21380620965, + 154424.64450205903, + 154451.07632889951, + 154477.50928663427, + 154503.94337516659, + 154530.37859439969, + 154556.81494423689, + 154583.25242458144, + 154609.69103533673, + 154636.13077640603, + 154662.57164769279, + 154689.01364910032, + 154715.45678053208, + 154741.90104189145, + 154768.34643308193, + 154794.79295400696, + 154821.24060457002, + 154847.68938467462, + 154874.13929422433, + 154900.59033312264, + 154927.04250127316, + 154953.49579857948, + 154979.95022494521, + 155006.40578027396, + 155032.86246446942, + 155059.32027743524, + 155085.77921907514, + 155112.2392892928, + 155138.70048799197, + 155165.16281507642, + 155191.62627044989, + 155218.09085401625, + 155244.55656567923, + 155271.02340534274, + 155297.49137291059, + 155323.96046828668, + 155350.4306913749, + 155376.90204207919, + 155403.37452030348, + 155429.84812595171, + 155456.32285892789, + 155482.79871913602, + 155509.27570648011, + 155535.75382086422, + 155562.23306219239, + 155588.71343036872, + 155615.19492529731, + 155641.67754688227, + 155668.16129502779, + 155694.64616963797, + 155721.13217061706, + 155747.61929786921, + 155774.10755129869, + 155800.59693080973, + 155827.08743630661, + 155853.57906769359, + 155880.07182487496, + 155906.56570775513, + 155933.06071623837, + 155959.55685022907, + 155986.05410963166, + 156012.5524943505, + 156039.05200429002, + 156065.55263935472, + 156092.054399449, + 156118.5572844774, + 156145.06129434443, + 156171.5664289546, + 156198.07268821247, + 156224.5800720226, + 156251.08858028959, + 156277.59821291809, + 156304.10896981266, + 156330.62085087801, + 156357.1338560188, + 156383.64798513969, + 156410.16323814544, + 156436.67961494075, + 156463.1971154304, + 156489.71573951913, + 156516.23548711176, + 156542.75635811311, + 156569.27835242799, + 156595.80146996127, + 156622.32571061782, + 156648.85107430254, + 156675.37756092031, + 156701.90517037612, + 156728.43390257491, + 156754.96375742162, + 156781.49473482129, + 156808.02683467892, + 156834.5600568995, + 156861.09440138817, + 156887.62986804993, + 156914.16645678994, + 156940.70416751326, + 156967.24300012505, + 156993.78295453047, + 157020.32403063469, + 157046.8662283429, + 157073.40954756032, + 157099.9539881922, + 157126.49955014378, + 157153.04623332032, + 157179.59403762716, + 157206.14296296958, + 157232.69300925292, + 157259.24417638258, + 157285.79646426387, + 157312.34987280221, + 157338.90440190304, + 157365.46005147175, + 157392.01682141385, + 157418.57471163478, + 157445.13372204005, + 157471.69385253513, + 157498.25510302564, + 157524.81747341706, + 157551.38096361503, + 157577.9455735251, + 157604.51130305286, + 157631.07815210402, + 157657.64612058419, + 157684.21520839902, + 157710.78541545427, + 157737.35674165559, + 157763.92918690876, + 157790.50275111952, + 157817.07743419363, + 157843.65323603692, + 157870.23015655516, + 157896.80819565422, + 157923.3873532399, + 157949.96762921812, + 157976.54902349479, + 158003.13153597576, + 158029.71516656701, + 158056.29991517449, + 158082.88578170416, + 158109.47276606198, + 158136.06086815402, + 158162.65008788629, + 158189.24042516484, + 158215.83187989573, + 158242.42445198505, + 158269.01814133892, + 158295.61294786347, + 158322.20887146486, + 158348.80591204923, + 158375.4040695228, + 158402.00334379176, + 158428.60373476235, + 158455.2052423408, + 158481.80786643337, + 158508.41160694641, + 158535.01646378616, + 158561.62243685898, + 158588.2295260712, + 158614.8377313292, + 158641.44705253936, + 158668.05748960807, + 158694.66904244179, + 158721.28171094693, + 158747.89549502998, + 158774.5103945974, + 158801.12640955573, + 158827.74353981143, + 158854.36178527112, + 158880.9811458413, + 158907.60162142856, + 158934.22321193956, + 158960.84591728085, + 158987.46973735912, + 159014.09467208097, + 159040.72072135314, + 159067.3478850823, + 159093.97616317519, + 159120.60555553852, + 159147.23606207906, + 159173.8676827036, + 159200.50041731889, + 159227.13426583182, + 159253.76922814918, + 159280.40530417781, + 159307.04249382461, + 159333.68079699649, + 159360.32021360032, + 159386.96074354305, + 159413.60238673165, + 159440.24514307309, + 159466.88901247433, + 159493.53399484244, + 159520.18009008438, + 159546.82729810724, + 159573.47561881805, + 159600.12505212394, + 159626.77559793202, + 159653.42725614941, + 159680.08002668325, + 159706.73390944069, + 159733.38890432892, + 159760.04501125516, + 159786.70223012666, + 159813.36056085059, + 159840.02000333427, + 159866.68055748497, + 159893.34222320997, + 159920.00500041663, + 159946.66888901225, + 159973.33388890422, + 159999.99999999988, + 160026.66722220668, + 160053.33555543202, + 160080.0049995833, + 160106.67555456801, + 160133.3472202936, + 160160.0199966676, + 160186.6938835975, + 160213.36888099083, + 160240.04498875517, + 160266.72220679806, + 160293.40053502709, + 160320.07997334987, + 160346.76052167406, + 160373.44217990729, + 160400.1249479572, + 160426.80882573154, + 160453.49381313793, + 160480.17991008417, + 160506.86711647795, + 160533.55543222709, + 160560.24485723933, + 160586.93539142248, + 160613.62703468435, + 160640.31978693281, + 160667.01364807569, + 160693.70861802087, + 160720.40469667627, + 160747.1018839498, + 160773.80017974938, + 160800.49958398298, + 160827.20009655855, + 160853.90171738411, + 160880.60444636765, + 160907.30828341722, + 160934.01322844089, + 160960.71928134665, + 160987.42644204266, + 161014.13471043704, + 161040.84408643784, + 161067.55456995327, + 161094.26616089148, + 161120.97885916062, + 161147.69266466892, + 161174.40757732463, + 161201.12359703594, + 161227.84072371112, + 161254.55895725847, + 161281.27829758628, + 161307.99874460287, + 161334.72029821656, + 161361.44295833571, + 161388.1667248687, + 161414.89159772391, + 161441.61757680977, + 161468.34466203468, + 161495.07285330712, + 161521.80215053557, + 161548.53255362847, + 161575.26406249436, + 161601.99667704175, + 161628.7303971792, + 161655.46522281526, + 161682.20115385848, + 161708.93819021754, + 161735.67633180099, + 161762.41557851751, + 161789.15593027571, + 161815.89738698432, + 161842.63994855201, + 161869.38361488748, + 161896.1283858995, + 161922.87426149679, + 161949.62124158812, + 161976.36932608229, + 162003.1185148881, + 162029.8688079144, + 162056.62020507001, + 162083.37270626382, + 162110.12631140469, + 162136.88102040152, + 162163.63683316324, + 162190.39374959879, + 162217.15176961714, + 162243.91089312723, + 162270.67112003808, + 162297.43245025873, + 162324.19488369819, + 162350.9584202655, + 162377.72305986975, + 162404.48880242003, + 162431.25564782543, + 162458.02359599507, + 162484.79264683815, + 162511.56280026378, + 162538.33405618116, + 162565.10641449949, + 162591.87987512801, + 162618.65443797593, + 162645.43010295252, + 162672.20686996708, + 162698.98473892888, + 162725.76370974723, + 162752.54378233149, + 162779.32495659095, + 162806.10723243505, + 162832.89060977317, + 162859.67508851466, + 162886.46066856899, + 162913.24734984562, + 162940.03513225398, + 162966.82401570358, + 162993.6140001039, + 163020.40508536444, + 163047.19727139481, + 163073.99055810447, + 163100.78494540305, + 163127.58043320014, + 163154.37702140535, + 163181.17470992831, + 163207.97349867865, + 163234.77338756606, + 163261.57437650024, + 163288.37646539087, + 163315.17965414765, + 163341.98394268038, + 163368.78933089875, + 163395.59581871261, + 163422.40340603172, + 163449.2120927659, + 163476.02187882498, + 163502.83276411882, + 163529.6447485573, + 163556.45783205028, + 163583.2720145077, + 163610.08729583945, + 163636.90367595552, + 163663.72115476584, + 163690.53973218042, + 163717.35940810922, + 163744.18018246227, + 163771.00205514964, + 163797.82502608138, + 163824.64909516752, + 163851.4742623182, + 163878.3005274435, + 163905.12789045356, + 163931.95635125853, + 163958.78590976857, + 163985.61656589387, + 164012.44831954464, + 164039.28117063109, + 164066.11511906344, + 164092.95016475199, + 164119.78630760699, + 164146.62354753874, + 164173.46188445756, + 164200.30131827376, + 164227.14184889771, + 164253.98347623978, + 164280.82620021031, + 164307.67002071979, + 164334.51493767856, + 164361.3609509971, + 164388.20806058586, + 164415.05626635533, + 164441.905568216, + 164468.75596607837, + 164495.607459853, + 164522.4600494504, + 164549.31373478117, + 164576.16851575591, + 164603.02439228518, + 164629.88136427966, + 164656.73943164994, + 164683.59859430668, + 164710.45885216061, + 164737.32020512238, + 164764.1826531027, + 164791.04619601235, + 164817.91083376206, + 164844.77656626256, + 164871.64339342469, + 164898.51131515924, + 164925.38033137703, + 164952.25044198887, + 164979.1216469057, + 165005.9939460383, + 165032.86733929763, + 165059.7418265946, + 165086.61740784015, + 165113.4940829452 +}; + +#else + +#ifdef BIG_IQ_TABLE +#define IQ_TABLE_SIZE 8192 +#else +#define IQ_TABLE_SIZE 1026 +#endif + +ALIGN static const real_t iq_table[IQ_TABLE_SIZE] = +{ + REAL_CONST(0.0), + REAL_CONST(1.0/8.0), + REAL_CONST(2.5198420997897464/8.0), + REAL_CONST(4.3267487109222245/8.0), + REAL_CONST(6.3496042078727974/8.0), + REAL_CONST(8.5498797333834844/8.0), + REAL_CONST(10.902723556992836/8.0), + REAL_CONST(13.390518279406722/8.0), + REAL_CONST(15.999999999999998/8.0), + REAL_CONST(18.720754407467133/8.0), + REAL_CONST(21.544346900318832/8.0), + REAL_CONST(24.463780996262464/8.0), + REAL_CONST(27.47314182127996/8.0), + REAL_CONST(30.567350940369842/8.0), + REAL_CONST(33.741991698453212/8.0), + REAL_CONST(36.993181114957046/8.0), + REAL_CONST(40.317473596635935/8.0), + REAL_CONST(43.711787041189993/8.0), + REAL_CONST(47.173345095760126/8.0), + REAL_CONST(50.699631325716943/8.0), + REAL_CONST(54.288352331898118/8.0), + REAL_CONST(57.937407704003519/8.0), + REAL_CONST(61.6448652744185/8.0), + REAL_CONST(65.408940536585988/8.0), + REAL_CONST(69.227979374755591/8.0), + REAL_CONST(73.100443455321638/8.0), + REAL_CONST(77.024897778591622/8.0), + REAL_CONST(80.999999999999986/8.0), + REAL_CONST(85.024491212518527/8.0), + REAL_CONST(89.097187944889555/8.0), + REAL_CONST(93.216975178615741/8.0), + REAL_CONST(97.382800224133163/8.0), + REAL_CONST(101.59366732596474/8.0), + REAL_CONST(105.84863288986224/8.0), + REAL_CONST(110.14680124343441/8.0), + REAL_CONST(114.4873208566006/8.0), + REAL_CONST(118.86938096020653/8.0), + REAL_CONST(123.29220851090024/8.0), + REAL_CONST(127.75506545836058/8.0), + REAL_CONST(132.25724627755247/8.0), + REAL_CONST(136.79807573413572/8.0), + REAL_CONST(141.37690685569191/8.0), + REAL_CONST(145.99311908523086/8.0), + REAL_CONST(150.6461165966291/8.0), + REAL_CONST(155.33532675434674/8.0), + REAL_CONST(160.06019870205279/8.0), + REAL_CONST(164.82020206673349/8.0), + REAL_CONST(169.61482576651861/8.0), + REAL_CONST(174.44357691188537/8.0), + REAL_CONST(179.30597979112557/8.0), + REAL_CONST(184.20157493201927/8.0), + REAL_CONST(189.12991823257562/8.0), + REAL_CONST(194.09058015449685/8.0), + REAL_CONST(199.08314497371677/8.0), + REAL_CONST(204.1072100829694/8.0), + REAL_CONST(209.16238534187647/8.0), + REAL_CONST(214.24829247050752/8.0), + REAL_CONST(219.36456448277784/8.0), + REAL_CONST(224.51084515641216/8.0), + REAL_CONST(229.6867885365223/8.0), + REAL_CONST(234.89205847013176/8.0), + REAL_CONST(240.12632816923249/8.0), + REAL_CONST(245.38927980018505/8.0), + REAL_CONST(250.68060409747261/8.0), + REAL_CONST(255.99999999999991/8.0), + REAL_CONST(261.34717430828869/8.0), + REAL_CONST(266.72184136106449/8.0), + REAL_CONST(272.12372272986045/8.0), + REAL_CONST(277.55254693037961/8.0), + REAL_CONST(283.0080491494619/8.0), + REAL_CONST(288.48997098659891/8.0), + REAL_CONST(293.99806020902247/8.0), + REAL_CONST(299.53207051947408/8.0), + REAL_CONST(305.0917613358298/8.0), + REAL_CONST(310.67689758182206/8.0), + REAL_CONST(316.28724948815585/8.0), + REAL_CONST(321.92259240337177/8.0), + REAL_CONST(327.58270661385535/8.0), + REAL_CONST(333.26737717243742/8.0), + REAL_CONST(338.97639373507025/8.0), + REAL_CONST(344.70955040510125/8.0), + REAL_CONST(350.46664558470013/8.0), + REAL_CONST(356.24748183302603/8.0), + REAL_CONST(362.05186573075139/8.0), + REAL_CONST(367.87960775058258/8.0), + REAL_CONST(373.73052213344511/8.0), + REAL_CONST(379.60442677002078/8.0), + REAL_CONST(385.50114308734607/8.0), + REAL_CONST(391.42049594019937/8.0), + REAL_CONST(397.36231350702371/8.0), + REAL_CONST(403.32642719014467/8.0), + REAL_CONST(409.31267152006262/8.0), + REAL_CONST(415.32088406360799/8.0), + REAL_CONST(421.35090533576471/8.0), + REAL_CONST(427.40257871497619/8.0), + REAL_CONST(433.4757503617617/8.0), + REAL_CONST(439.5702691404793/8.0), + REAL_CONST(445.68598654408271/8.0), + REAL_CONST(451.82275662172759/8.0), + REAL_CONST(457.98043590909128/8.0), + REAL_CONST(464.15888336127773/8.0), + REAL_CONST(470.35796028818726/8.0), + REAL_CONST(476.5775302922363/8.0), + REAL_CONST(482.81745920832043/8.0), + REAL_CONST(489.07761504591741/8.0), + REAL_CONST(495.35786793323581/8.0), + REAL_CONST(501.65809006331688/8.0), + REAL_CONST(507.97815564200368/8.0), + REAL_CONST(514.31794083769648/8.0), + REAL_CONST(520.67732373281672/8.0), + REAL_CONST(527.05618427690604/8.0), + REAL_CONST(533.45440424129174/8.0), + REAL_CONST(539.87186717525128/8.0), + REAL_CONST(546.30845836361505/8.0), + REAL_CONST(552.76406478574609/8.0), + REAL_CONST(559.23857507584194/8.0), + REAL_CONST(565.73187948450413/8.0), + REAL_CONST(572.24386984152341/8.0), + REAL_CONST(578.77443951983378/8.0), + REAL_CONST(585.32348340058843/8.0), + REAL_CONST(591.89089783931263/8.0), + REAL_CONST(598.47658063309257/8.0), + REAL_CONST(605.08043098876044/8.0), + REAL_CONST(611.70234949203643/8.0), + REAL_CONST(618.3422380775919/8.0), + REAL_CONST(624.99999999999977/8.0), + REAL_CONST(631.67553980553748/8.0), + REAL_CONST(638.36876330481164/8.0), + REAL_CONST(645.07957754617485/8.0), + REAL_CONST(651.80789078990415/8.0), + REAL_CONST(658.55361248311499/8.0), + REAL_CONST(665.31665323538357/8.0), + REAL_CONST(672.09692479505225/8.0), + REAL_CONST(678.8943400261943/8.0), + REAL_CONST(685.70881288621433/8.0), + REAL_CONST(692.540258404062/8.0), + REAL_CONST(699.38859265903977/8.0), + REAL_CONST(706.25373276018058/8.0), + REAL_CONST(713.13559682617972/8.0), + REAL_CONST(720.03410396586037/8.0), + REAL_CONST(726.94917425915435/8.0), + REAL_CONST(733.88072873858209/8.0), + REAL_CONST(740.82868937121543/8.0), + REAL_CONST(747.79297904110535/8.0), + REAL_CONST(754.77352153216191/8.0), + REAL_CONST(761.77024151147043/8.0), + REAL_CONST(768.78306451302956/8.0), + REAL_CONST(775.81191692189896/8.0), + REAL_CONST(782.85672595874246/8.0), + REAL_CONST(789.91741966475445/8.0), + REAL_CONST(796.99392688695798/8.0), + REAL_CONST(804.08617726386274/8.0), + REAL_CONST(811.19410121147098/8.0), + REAL_CONST(818.31762990962227/8.0), + REAL_CONST(825.45669528866563/8.0), + REAL_CONST(832.61123001644864/8.0), + REAL_CONST(839.78116748561604/8.0), + REAL_CONST(846.96644180120552/8.0), + REAL_CONST(854.16698776853514/8.0), + REAL_CONST(861.38274088137143/8.0), + REAL_CONST(868.61363731036977/8.0), + REAL_CONST(875.85961389178203/8.0), + REAL_CONST(883.12060811641959/8.0), + REAL_CONST(890.39655811886757/8.0), + REAL_CONST(897.68740266694181/8.0), + REAL_CONST(904.99308115138172/8.0), + REAL_CONST(912.31353357577188/8.0), + REAL_CONST(919.64870054668756/8.0), + REAL_CONST(926.99852326405619/8.0), + REAL_CONST(934.36294351172899/8.0), + REAL_CONST(941.74190364825859/8.0), + REAL_CONST(949.13534659787422/8.0), + REAL_CONST(956.54321584165211/8.0), + REAL_CONST(963.96545540887348/8.0), + REAL_CONST(971.40200986856541/8.0), + REAL_CONST(978.85282432122176/8.0), + REAL_CONST(986.31784439069588/8.0), + REAL_CONST(993.7970162162635/8.0), + REAL_CONST(1001.29028644485/8.0), + REAL_CONST(1008.797602223418/8.0), + REAL_CONST(1016.3189111915103/8.0), + REAL_CONST(1023.8541614739464/8.0), + REAL_CONST(1031.4033016736653/8.0), + REAL_CONST(1038.9662808647138/8.0), + REAL_CONST(1046.5430485853758/8.0), + REAL_CONST(1054.1335548314366/8.0), + REAL_CONST(1061.7377500495838/8.0), + REAL_CONST(1069.3555851309357/8.0), + REAL_CONST(1076.9870114046978/8.0), + REAL_CONST(1084.6319806319441/8.0), + REAL_CONST(1092.2904449995174/8.0), + REAL_CONST(1099.9623571140482/8.0), + REAL_CONST(1107.6476699960892/8.0), + REAL_CONST(1115.3463370743607/8.0), + REAL_CONST(1123.058312180106/8.0), + REAL_CONST(1130.7835495415541/8.0), + REAL_CONST(1138.5220037784854/8.0), + REAL_CONST(1146.273629896901/8.0), + REAL_CONST(1154.0383832837879/8.0), + REAL_CONST(1161.816219701986/8.0), + REAL_CONST(1169.607095285146/8.0), + REAL_CONST(1177.4109665327808/8.0), + REAL_CONST(1185.2277903054078/8.0), + REAL_CONST(1193.0575238197798/8.0), + REAL_CONST(1200.9001246442001/8.0), + REAL_CONST(1208.7555506939248/8.0), + REAL_CONST(1216.6237602266442/8.0), + REAL_CONST(1224.5047118380478/8.0), + REAL_CONST(1232.3983644574657/8.0), + REAL_CONST(1240.3046773435874/8.0), + REAL_CONST(1248.2236100802568/8.0), + REAL_CONST(1256.1551225723395/8.0), + REAL_CONST(1264.099175041662/8.0), + REAL_CONST(1272.0557280230228/8.0), + REAL_CONST(1280.0247423602691/8.0), + REAL_CONST(1288.0061792024444/8.0), + REAL_CONST(1295.9999999999995/8.0), + REAL_CONST(1304.006166501068/8.0), + REAL_CONST(1312.0246407478062/8.0), + REAL_CONST(1320.0553850727929/8.0), + REAL_CONST(1328.0983620954903/8.0), + REAL_CONST(1336.1535347187651/8.0), + REAL_CONST(1344.2208661254647/8.0), + REAL_CONST(1352.3003197750522/8.0), + REAL_CONST(1360.3918594002962/8.0), + REAL_CONST(1368.4954490040145/8.0), + REAL_CONST(1376.6110528558709/8.0), + REAL_CONST(1384.7386354892244/8.0), + REAL_CONST(1392.8781616980295/8.0), + REAL_CONST(1401.0295965337855/8.0), + REAL_CONST(1409.1929053025353/8.0), + REAL_CONST(1417.3680535619119/8.0), + REAL_CONST(1425.5550071182327/8.0), + REAL_CONST(1433.7537320236374/8.0), + REAL_CONST(1441.9641945732744/8.0), + REAL_CONST(1450.1863613025282/8.0), + REAL_CONST(1458.4201989842913/8.0), + REAL_CONST(1466.6656746262797/8.0), + REAL_CONST(1474.9227554683875/8.0), + REAL_CONST(1483.1914089800841/8.0), + REAL_CONST(1491.4716028578516/8.0), + REAL_CONST(1499.7633050226596/8.0), + REAL_CONST(1508.0664836174794/8.0), + REAL_CONST(1516.3811070048375/8.0), + REAL_CONST(1524.7071437644029/8.0), + REAL_CONST(1533.0445626906128/8.0), + REAL_CONST(1541.3933327903342/8.0), + REAL_CONST(1549.7534232805581/8.0), + REAL_CONST(1558.1248035861302/8.0), + REAL_CONST(1566.507443337515/8.0), + REAL_CONST(1574.9013123685909/8.0), + REAL_CONST(1583.3063807144795/8.0), + REAL_CONST(1591.7226186094069/8.0), + REAL_CONST(1600.1499964845941/8.0), + REAL_CONST(1608.58848496618/8.0), + REAL_CONST(1617.0380548731737/8.0), + REAL_CONST(1625.4986772154357/8.0), + REAL_CONST(1633.9703231916887/8.0), + REAL_CONST(1642.4529641875577/8.0), + REAL_CONST(1650.9465717736346/8.0), + REAL_CONST(1659.4511177035752/8.0), + REAL_CONST(1667.9665739122186/8.0), + REAL_CONST(1676.4929125137353/8.0), + REAL_CONST(1685.030105799801/8.0), + REAL_CONST(1693.5781262377957/8.0), + REAL_CONST(1702.136946469027/8.0), + REAL_CONST(1710.7065393069795/8.0), + REAL_CONST(1719.2868777355877/8.0), + REAL_CONST(1727.8779349075323/8.0), + REAL_CONST(1736.4796841425596/8.0), + REAL_CONST(1745.092098925825/8.0), + REAL_CONST(1753.7151529062583/8.0), + REAL_CONST(1762.3488198949503/8.0), + REAL_CONST(1770.9930738635628/8.0), + REAL_CONST(1779.6478889427597/8.0), + REAL_CONST(1788.3132394206564/8.0), + REAL_CONST(1796.9890997412947/8.0), + REAL_CONST(1805.6754445031333/8.0), + REAL_CONST(1814.3722484575621/8.0), + REAL_CONST(1823.0794865074322/8.0), + REAL_CONST(1831.7971337056094/8.0), + REAL_CONST(1840.5251652535437/8.0), + REAL_CONST(1849.2635564998579/8.0), + REAL_CONST(1858.0122829389563/8.0), + REAL_CONST(1866.7713202096493/8.0), + REAL_CONST(1875.5406440937966/8.0), + REAL_CONST(1884.3202305149687/8.0), + REAL_CONST(1893.110055537124/8.0), + REAL_CONST(1901.9100953633042/8.0), + REAL_CONST(1910.7203263343454/8.0), + REAL_CONST(1919.5407249276057/8.0), + REAL_CONST(1928.3712677557098/8.0), + REAL_CONST(1937.2119315653083/8.0), + REAL_CONST(1946.0626932358525/8.0), + REAL_CONST(1954.923529778386/8.0), + REAL_CONST(1963.79441833435/8.0), + REAL_CONST(1972.6753361744036/8.0), + REAL_CONST(1981.5662606972594/8.0), + REAL_CONST(1990.467169428533/8.0), + REAL_CONST(1999.3780400196069/8.0), + REAL_CONST(2008.2988502465078/8.0), + REAL_CONST(2017.2295780087982/8.0), + REAL_CONST(2026.1702013284819/8.0), + REAL_CONST(2035.1206983489212/8.0), + REAL_CONST(2044.0810473337688/8.0), + REAL_CONST(2053.0512266659125/8.0), + REAL_CONST(2062.0312148464309/8.0), + REAL_CONST(2071.0209904935646/8.0), + REAL_CONST(2080.0205323416958/8.0), + REAL_CONST(2089.0298192403443/8.0), + REAL_CONST(2098.0488301531714/8.0), + REAL_CONST(2107.0775441569995/8.0), + REAL_CONST(2116.115940440839/8.0), + REAL_CONST(2125.1639983049317/8.0), + REAL_CONST(2134.2216971597995/8.0), + REAL_CONST(2143.2890165253098/8.0), + REAL_CONST(2152.3659360297484/8.0), + REAL_CONST(2161.4524354089031/8.0), + REAL_CONST(2170.5484945051617/8.0), + REAL_CONST(2179.6540932666144/8.0), + REAL_CONST(2188.7692117461711/8.0), + REAL_CONST(2197.8938301006888/8.0), + REAL_CONST(2207.0279285901042/8.0), + REAL_CONST(2216.1714875765838/8.0), + REAL_CONST(2225.324487523676/8.0), + REAL_CONST(2234.4869089954782/8.0), + REAL_CONST(2243.6587326558101/8.0), + REAL_CONST(2252.8399392673982/8.0), + REAL_CONST(2262.0305096910702/8.0), + REAL_CONST(2271.2304248849537/8.0), + REAL_CONST(2280.4396659036897/8.0), + REAL_CONST(2289.6582138976523/8.0), + REAL_CONST(2298.8860501121762/8.0), + REAL_CONST(2308.1231558867926/8.0), + REAL_CONST(2317.3695126544767/8.0), + REAL_CONST(2326.6251019409005/8.0), + REAL_CONST(2335.8899053636933/8.0), + REAL_CONST(2345.1639046317132/8.0), + REAL_CONST(2354.4470815443233/8.0), + REAL_CONST(2363.7394179906792/8.0), + REAL_CONST(2373.0408959490205/8.0), + REAL_CONST(2382.3514974859731/8.0), + REAL_CONST(2391.6712047558558/8.0), + REAL_CONST(2400.9999999999991/8.0), + REAL_CONST(2410.3378655460651/8.0), + REAL_CONST(2419.6847838073813/8.0), + REAL_CONST(2429.0407372822747/8.0), + REAL_CONST(2438.4057085534191/8.0), + REAL_CONST(2447.7796802871858/8.0), + REAL_CONST(2457.1626352330004/8.0), + REAL_CONST(2466.5545562227112/8.0), + REAL_CONST(2475.9554261699564/8.0), + REAL_CONST(2485.3652280695474/8.0), + REAL_CONST(2494.7839449968492/8.0), + REAL_CONST(2504.2115601071737/8.0), + REAL_CONST(2513.6480566351788/8.0), + REAL_CONST(2523.0934178942675/8.0), + REAL_CONST(2532.5476272760025/8.0), + REAL_CONST(2542.0106682495189/8.0), + REAL_CONST(2551.482524360948/8.0), + REAL_CONST(2560.9631792328441/8.0), + REAL_CONST(2570.4526165636184/8.0), + REAL_CONST(2579.9508201269791/8.0), + REAL_CONST(2589.4577737713744/8.0), + REAL_CONST(2598.9734614194458/8.0), + REAL_CONST(2608.4978670674823/8.0), + REAL_CONST(2618.0309747848837/8.0), + REAL_CONST(2627.5727687136259/8.0), + REAL_CONST(2637.1232330677353/8.0), + REAL_CONST(2646.6823521327647/8.0), + REAL_CONST(2656.2501102652768/8.0), + REAL_CONST(2665.8264918923328/8.0), + REAL_CONST(2675.4114815109842/8.0), + REAL_CONST(2685.0050636877722/8.0), + REAL_CONST(2694.6072230582295/8.0), + REAL_CONST(2704.2179443263894/8.0), + REAL_CONST(2713.8372122642972/8.0), + REAL_CONST(2723.4650117115279/8.0), + REAL_CONST(2733.1013275747096/8.0), + REAL_CONST(2742.7461448270483/8.0), + REAL_CONST(2752.3994485078601/8.0), + REAL_CONST(2762.0612237221085/8.0), + REAL_CONST(2771.7314556399419/8.0), + REAL_CONST(2781.4101294962406/8.0), + REAL_CONST(2791.0972305901655/8.0), + REAL_CONST(2800.7927442847094/8.0), + REAL_CONST(2810.4966560062589/8.0), + REAL_CONST(2820.2089512441521/8.0), + REAL_CONST(2829.9296155502466/8.0), + REAL_CONST(2839.6586345384894/8.0), + REAL_CONST(2849.3959938844923/8.0), + REAL_CONST(2859.1416793251065/8.0), + REAL_CONST(2868.8956766580086/8.0), + REAL_CONST(2878.6579717412847/8.0), + REAL_CONST(2888.4285504930212/8.0), + REAL_CONST(2898.2073988908974/8.0), + REAL_CONST(2907.9945029717837/8.0), + REAL_CONST(2917.789848831344/8.0), + REAL_CONST(2927.5934226236377/8.0), + REAL_CONST(2937.4052105607311/8.0), + REAL_CONST(2947.2251989123079/8.0), + REAL_CONST(2957.0533740052865/8.0), + REAL_CONST(2966.8897222234368/8.0), + REAL_CONST(2976.734230007005/8.0), + REAL_CONST(2986.5868838523397/8.0), + REAL_CONST(2996.4476703115197/8.0), + REAL_CONST(3006.3165759919889/8.0), + REAL_CONST(3016.1935875561908/8.0), + REAL_CONST(3026.0786917212095/8.0), + REAL_CONST(3035.9718752584108/8.0), + REAL_CONST(3045.8731249930906/8.0), + REAL_CONST(3055.7824278041207/8.0), + REAL_CONST(3065.6997706236039/8.0), + REAL_CONST(3075.625140436528/8.0), + REAL_CONST(3085.5585242804245/8.0), + REAL_CONST(3095.4999092450298/8.0), + REAL_CONST(3105.4492824719491/8.0), + REAL_CONST(3115.4066311543256/8.0), + REAL_CONST(3125.3719425365089/8.0), + REAL_CONST(3135.3452039137287/8.0), + REAL_CONST(3145.3264026317715/8.0), + REAL_CONST(3155.3155260866592/8.0), + REAL_CONST(3165.3125617243295/8.0), + REAL_CONST(3175.3174970403229/8.0), + REAL_CONST(3185.3303195794679/8.0), + REAL_CONST(3195.35101693557/8.0), + REAL_CONST(3205.3795767511078/8.0), + REAL_CONST(3215.4159867169251/8.0), + REAL_CONST(3225.460234571929/8.0), + REAL_CONST(3235.5123081027928/8.0), + REAL_CONST(3245.5721951436558/8.0), + REAL_CONST(3255.63988357583/8.0), + REAL_CONST(3265.7153613275095/8.0), + REAL_CONST(3275.7986163734795/8.0), + REAL_CONST(3285.8896367348289/8.0), + REAL_CONST(3295.9884104786665/8.0), + REAL_CONST(3306.0949257178395/8.0), + REAL_CONST(3316.2091706106517/8.0), + REAL_CONST(3326.331133360588/8.0), + REAL_CONST(3336.4608022160378/8.0), + REAL_CONST(3346.5981654700231/8.0), + REAL_CONST(3356.7432114599264/8.0), + REAL_CONST(3366.8959285672249/8.0), + REAL_CONST(3377.0563052172211/8.0), + REAL_CONST(3387.2243298787821/8.0), + REAL_CONST(3397.3999910640764/8.0), + REAL_CONST(3407.5832773283128/8.0), + REAL_CONST(3417.7741772694862/8.0), + REAL_CONST(3427.9726795281199/8.0), + REAL_CONST(3438.1787727870123/8.0), + REAL_CONST(3448.3924457709873/8.0), + REAL_CONST(3458.6136872466445/8.0), + REAL_CONST(3468.8424860221107/8.0), + REAL_CONST(3479.0788309467976/8.0), + REAL_CONST(3489.3227109111554/8.0), + REAL_CONST(3499.5741148464344/8.0), + REAL_CONST(3509.8330317244445/8.0), + REAL_CONST(3520.0994505573185/8.0), + REAL_CONST(3530.3733603972751/8.0), + REAL_CONST(3540.6547503363886/8.0), + REAL_CONST(3550.9436095063534/8.0), + REAL_CONST(3561.239927078258/8.0), + REAL_CONST(3571.5436922623535/8.0), + REAL_CONST(3581.8548943078308/8.0), + REAL_CONST(3592.1735225025936/8.0), + REAL_CONST(3602.4995661730372/8.0), + REAL_CONST(3612.8330146838275/8.0), + REAL_CONST(3623.1738574376814/8.0), + REAL_CONST(3633.5220838751502/8.0), + REAL_CONST(3643.8776834744031/8.0), + REAL_CONST(3654.2406457510142/8.0), + REAL_CONST(3664.6109602577494/8.0), + REAL_CONST(3674.9886165843564/8.0), + REAL_CONST(3685.3736043573545/8.0), + REAL_CONST(3695.7659132398294/8.0), + REAL_CONST(3706.1655329312248/8.0), + REAL_CONST(3716.5724531671399/8.0), + REAL_CONST(3726.9866637191262/8.0), + REAL_CONST(3737.4081543944876/8.0), + REAL_CONST(3747.8369150360782/8.0), + REAL_CONST(3758.2729355221072/8.0), + REAL_CONST(3768.7162057659411/8.0), + REAL_CONST(3779.1667157159077/8.0), + REAL_CONST(3789.6244553551055/8.0), + REAL_CONST(3800.0894147012082/8.0), + REAL_CONST(3810.5615838062768/8.0), + REAL_CONST(3821.0409527565694/8.0), + REAL_CONST(3831.5275116723533/8.0), + REAL_CONST(3842.0212507077194/8.0), + REAL_CONST(3852.522160050396/8.0), + REAL_CONST(3863.0302299215673/8.0), + REAL_CONST(3873.5454505756893/8.0), + REAL_CONST(3884.0678123003108/8.0), + REAL_CONST(3894.5973054158922/8.0), + REAL_CONST(3905.1339202756285/8.0), + REAL_CONST(3915.6776472652732/8.0), + REAL_CONST(3926.2284768029604/8.0), + REAL_CONST(3936.7863993390338/8.0), + REAL_CONST(3947.3514053558706/8.0), + REAL_CONST(3957.9234853677135/8.0), + REAL_CONST(3968.5026299204969/8.0), + REAL_CONST(3979.0888295916798/8.0), + REAL_CONST(3989.6820749900776/8.0), + REAL_CONST(4000.2823567556948/8.0), + REAL_CONST(4010.8896655595613/8.0), + REAL_CONST(4021.5039921035655/8.0), + REAL_CONST(4032.1253271202945/8.0), + REAL_CONST(4042.7536613728694/8.0), + REAL_CONST(4053.3889856547858/8.0), + REAL_CONST(4064.0312907897551/8.0), + REAL_CONST(4074.6805676315448/8.0), + REAL_CONST(4085.3368070638221/8.0), + REAL_CONST(4095.9999999999982/8.0), + REAL_CONST(4106.6701373830711/8.0), + REAL_CONST(4117.347210185475/8.0), + REAL_CONST(4128.0312094089259/8.0), + REAL_CONST(4138.722126084268/8.0), + REAL_CONST(4149.4199512713267/8.0), + REAL_CONST(4160.1246760587583/8.0), + REAL_CONST(4170.8362915638982/8.0), + REAL_CONST(4181.5547889326181/8.0), + REAL_CONST(4192.2801593391769/8.0), + REAL_CONST(4203.0123939860741/8.0), + REAL_CONST(4213.7514841039101/8.0), + REAL_CONST(4224.4974209512384/8.0), + REAL_CONST(4235.2501958144258/8.0), + REAL_CONST(4246.0098000075095/8.0), + REAL_CONST(4256.7762248720574/8.0), + REAL_CONST(4267.549461777031/8.0), + REAL_CONST(4278.3295021186423/8.0), + REAL_CONST(4289.1163373202198/8.0), + REAL_CONST(4299.9099588320714/8.0), + REAL_CONST(4310.7103581313495/8.0), + REAL_CONST(4321.5175267219138/8.0), + REAL_CONST(4332.3314561342004/8.0), + REAL_CONST(4343.152137925088/8.0), + REAL_CONST(4353.9795636777671/8.0), + REAL_CONST(4364.8137250016052/8.0), + REAL_CONST(4375.6546135320223/8.0), + REAL_CONST(4386.5022209303588/8.0), + REAL_CONST(4397.3565388837469/8.0), + REAL_CONST(4408.2175591049827/8.0), + REAL_CONST(4419.0852733324018/8.0), + REAL_CONST(4429.9596733297531/8.0), + REAL_CONST(4440.8407508860728/8.0), + REAL_CONST(4451.7284978155603/8.0), + REAL_CONST(4462.6229059574571/8.0), + REAL_CONST(4473.5239671759227/8.0), + REAL_CONST(4484.4316733599126/8.0), + REAL_CONST(4495.3460164230582/8.0), + REAL_CONST(4506.2669883035496/8.0), + REAL_CONST(4517.1945809640119/8.0), + REAL_CONST(4528.1287863913894/8.0), + REAL_CONST(4539.069596596828/8.0), + REAL_CONST(4550.0170036155587/8.0), + REAL_CONST(4560.9709995067806/8.0), + REAL_CONST(4571.931576353546/8.0), + REAL_CONST(4582.898726262647/8.0), + REAL_CONST(4593.8724413645004/8.0), + REAL_CONST(4604.8527138130348/8.0), + REAL_CONST(4615.8395357855816/8.0), + REAL_CONST(4626.8328994827571/8.0), + REAL_CONST(4637.8327971283588/8.0), + REAL_CONST(4648.8392209692511/8.0), + REAL_CONST(4659.8521632752563/8.0), + REAL_CONST(4670.8716163390473/8.0), + REAL_CONST(4681.8975724760394/8.0), + REAL_CONST(4692.9300240242837/8.0), + REAL_CONST(4703.9689633443595/8.0), + REAL_CONST(4715.0143828192668/8.0), + REAL_CONST(4726.0662748543255/8.0), + REAL_CONST(4737.1246318770682/8.0), + REAL_CONST(4748.1894463371373/8.0), + REAL_CONST(4759.2607107061804/8.0), + REAL_CONST(4770.3384174777493/8.0), + REAL_CONST(4781.4225591671993/8.0), + REAL_CONST(4792.5131283115852/8.0), + REAL_CONST(4803.6101174695614/8.0), + REAL_CONST(4814.7135192212854/8.0), + REAL_CONST(4825.8233261683154/8.0), + REAL_CONST(4836.9395309335096/8.0), + REAL_CONST(4848.0621261609349/8.0), + REAL_CONST(4859.1911045157631/8.0), + REAL_CONST(4870.3264586841779/8.0), + REAL_CONST(4881.4681813732768/8.0), + REAL_CONST(4892.6162653109768/8.0), + REAL_CONST(4903.7707032459193/8.0), + REAL_CONST(4914.931487947375/8.0), + REAL_CONST(4926.0986122051509/8.0), + REAL_CONST(4937.2720688294967/8.0), + REAL_CONST(4948.4518506510112/8.0), + REAL_CONST(4959.637950520555/8.0), + REAL_CONST(4970.8303613091521/8.0), + REAL_CONST(4982.0290759079044/8.0), + REAL_CONST(4993.2340872278974/8.0), + REAL_CONST(5004.4453882001153/8.0), + REAL_CONST(5015.6629717753467/8.0), + REAL_CONST(5026.8868309241007/8.0), + REAL_CONST(5038.1169586365131/8.0), + REAL_CONST(5049.353347922266/8.0), + REAL_CONST(5060.5959918104927/8.0), + REAL_CONST(5071.8448833496996/8.0), + REAL_CONST(5083.1000156076734/8.0), + REAL_CONST(5094.3613816713996/8.0), + REAL_CONST(5105.6289746469747/8.0), + REAL_CONST(5116.9027876595246/8.0), + REAL_CONST(5128.18281385312/8.0), + REAL_CONST(5139.4690463906918/8.0), + REAL_CONST(5150.7614784539473/8.0), + REAL_CONST(5162.0601032432933/8.0), + REAL_CONST(5173.3649139777472/8.0), + REAL_CONST(5184.6759038948594/8.0), + REAL_CONST(5195.9930662506322/8.0), + REAL_CONST(5207.3163943194386/8.0), + REAL_CONST(5218.6458813939435/8.0), + REAL_CONST(5229.9815207850224/8.0), + REAL_CONST(5241.3233058216847/8.0), + REAL_CONST(5252.6712298509919/8.0), + REAL_CONST(5264.025286237983/8.0), + REAL_CONST(5275.3854683655954/8.0), + REAL_CONST(5286.7517696345885/8.0), + REAL_CONST(5298.1241834634639/8.0), + REAL_CONST(5309.5027032883945/8.0), + REAL_CONST(5320.887322563146/8.0), + REAL_CONST(5332.2780347589978/8.0), + REAL_CONST(5343.6748333646756/8.0), + REAL_CONST(5355.0777118862716/8.0), + REAL_CONST(5366.4866638471722/8.0), + REAL_CONST(5377.901682787985/8.0), + REAL_CONST(5389.3227622664635/8.0), + REAL_CONST(5400.749895857437/8.0), + REAL_CONST(5412.1830771527357/8.0), + REAL_CONST(5423.622299761123/8.0), + REAL_CONST(5435.067557308219/8.0), + REAL_CONST(5446.5188434364318/8.0), + REAL_CONST(5457.9761518048872/8.0), + REAL_CONST(5469.4394760893592/8.0), + REAL_CONST(5480.9088099821975/8.0), + REAL_CONST(5492.3841471922606/8.0), + REAL_CONST(5503.8654814448455/8.0), + REAL_CONST(5515.3528064816201/8.0), + REAL_CONST(5526.846116060552/8.0), + REAL_CONST(5538.3454039558474/8.0), + REAL_CONST(5549.8506639578736/8.0), + REAL_CONST(5561.3618898731029/8.0), + REAL_CONST(5572.8790755240361/8.0), + REAL_CONST(5584.4022147491451/8.0), + REAL_CONST(5595.9313014027975/8.0), + REAL_CONST(5607.4663293552012/8.0), + REAL_CONST(5619.0072924923297/8.0), + REAL_CONST(5630.5541847158656/8.0), + REAL_CONST(5642.1069999431284/8.0), + REAL_CONST(5653.665732107017/8.0), + REAL_CONST(5665.230375155943/8.0), + REAL_CONST(5676.8009230537655/8.0), + REAL_CONST(5688.3773697797333/8.0), + REAL_CONST(5699.9597093284156/8.0), + REAL_CONST(5711.5479357096474/8.0), + REAL_CONST(5723.1420429484588/8.0), + REAL_CONST(5734.7420250850209/8.0), + REAL_CONST(5746.347876174581/8.0), + REAL_CONST(5757.9595902874016/8.0), + REAL_CONST(5769.5771615087006/8.0), + REAL_CONST(5781.2005839385911/8.0), + REAL_CONST(5792.8298516920213/8.0), + REAL_CONST(5804.4649588987149/8.0), + REAL_CONST(5816.1058997031105/8.0), + REAL_CONST(5827.7526682643065/8.0), + REAL_CONST(5839.4052587559972/8.0), + REAL_CONST(5851.0636653664196/8.0), + REAL_CONST(5862.7278822982908/8.0), + REAL_CONST(5874.3979037687541/8.0), + REAL_CONST(5886.0737240093204/8.0), + REAL_CONST(5897.7553372658094/8.0), + REAL_CONST(5909.4427377982956/8.0), + REAL_CONST(5921.1359198810505/8.0), + REAL_CONST(5932.8348778024874/8.0), + REAL_CONST(5944.5396058651031/8.0), + REAL_CONST(5956.2500983854261/8.0), + REAL_CONST(5967.9663496939575/8.0), + REAL_CONST(5979.6883541351208/8.0), + REAL_CONST(5991.4161060672022/8.0), + REAL_CONST(6003.1495998623004/8.0), + REAL_CONST(6014.8888299062692/8.0), + REAL_CONST(6026.6337905986684/8.0), + REAL_CONST(6038.3844763527022/8.0), + REAL_CONST(6050.1408815951781/8.0), + REAL_CONST(6061.9030007664414/8.0), + REAL_CONST(6073.6708283203316/8.0), + REAL_CONST(6085.4443587241267/8.0), + REAL_CONST(6097.2235864584891/8.0), + REAL_CONST(6109.0085060174197/8.0), + REAL_CONST(6120.7991119081998/8.0), + REAL_CONST(6132.595398651345/8.0), + REAL_CONST(6144.3973607805519/8.0), + REAL_CONST(6156.2049928426459/8.0), + REAL_CONST(6168.0182893975361/8.0), + REAL_CONST(6179.8372450181578/8.0), + REAL_CONST(6191.6618542904307/8.0), + REAL_CONST(6203.4921118132024/8.0), + REAL_CONST(6215.3280121982016/8.0), + REAL_CONST(6227.1695500699925/8.0), + REAL_CONST(6239.0167200659189/8.0), + REAL_CONST(6250.8695168360628/8.0), + REAL_CONST(6262.7279350431891/8.0), + REAL_CONST(6274.5919693627056/8.0), + REAL_CONST(6286.4616144826068/8.0), + REAL_CONST(6298.3368651034316/8.0), + REAL_CONST(6310.2177159382172/8.0), + REAL_CONST(6322.1041617124456/8.0), + REAL_CONST(6333.9961971640032/8.0), + REAL_CONST(6345.8938170431311/8.0), + REAL_CONST(6357.7970161123785/8.0), + REAL_CONST(6369.7057891465583/8.0), + REAL_CONST(6381.6201309327007/8.0), + REAL_CONST(6393.5400362700075/8.0), + REAL_CONST(6405.4654999698032/8.0), + REAL_CONST(6417.3965168554978/8.0), + REAL_CONST(6429.3330817625329/8.0), + REAL_CONST(6441.2751895383453/8.0), + REAL_CONST(6453.2228350423138/8.0), + REAL_CONST(6465.176013145724/8.0), + REAL_CONST(6477.134718731716/8.0), + REAL_CONST(6489.0989466952469/8.0), + REAL_CONST(6501.0686919430445/8.0), + REAL_CONST(6513.0439493935628/8.0), + REAL_CONST(6525.0247139769417/8.0), + REAL_CONST(6537.010980634961/8.0), + REAL_CONST(6549.002744321001/8.0), + REAL_CONST(6560.9999999999973/8.0), + REAL_CONST(6573.0027426483985/8.0), + REAL_CONST(6585.0109672541284/8.0), + REAL_CONST(6597.0246688165371/8.0), + REAL_CONST(6609.0438423463656/8.0), + REAL_CONST(6621.0684828657004/8.0), + REAL_CONST(6633.0985854079354/8.0), + REAL_CONST(6645.134145017727/8.0), + REAL_CONST(6657.1751567509573/8.0), + REAL_CONST(6669.2216156746908/8.0), + REAL_CONST(6681.2735168671343/8.0), + REAL_CONST(6693.3308554176001/8.0), + REAL_CONST(6705.3936264264594/8.0), + REAL_CONST(6717.461825005108/8.0), + REAL_CONST(6729.535446275926/8.0), + REAL_CONST(6741.6144853722335/8.0), + REAL_CONST(6753.6989374382601/8.0), + REAL_CONST(6765.7887976290967/8.0), + REAL_CONST(6777.8840611106634/8.0), + REAL_CONST(6789.9847230596661/8.0), + REAL_CONST(6802.0907786635626/8.0), + REAL_CONST(6814.2022231205201/8.0), + REAL_CONST(6826.3190516393797/8.0), + REAL_CONST(6838.4412594396181/8.0), + REAL_CONST(6850.5688417513074/8.0), + REAL_CONST(6862.701793815083/8.0), + REAL_CONST(6874.840110882099/8.0), + REAL_CONST(6886.9837882139991/8.0), + REAL_CONST(6899.1328210828724/8.0), + REAL_CONST(6911.2872047712199/8.0), + REAL_CONST(6923.4469345719199/8.0), + REAL_CONST(6935.6120057881863/8.0), + REAL_CONST(6947.7824137335365/8.0), + REAL_CONST(6959.9581537317536/8.0), + REAL_CONST(6972.1392211168532/8.0), + REAL_CONST(6984.3256112330409/8.0), + REAL_CONST(6996.5173194346862/8.0), + REAL_CONST(7008.7143410862773/8.0), + REAL_CONST(7020.9166715623942/8.0), + REAL_CONST(7033.1243062476678/8.0), + REAL_CONST(7045.3372405367481/8.0), + REAL_CONST(7057.5554698342685/8.0), + REAL_CONST(7069.7789895548103/8.0), + REAL_CONST(7082.0077951228714/8.0), + REAL_CONST(7094.2418819728273/8.0), + REAL_CONST(7106.4812455489018/8.0), + REAL_CONST(7118.7258813051285/8.0), + REAL_CONST(7130.9757847053224/8.0), + REAL_CONST(7143.2309512230404/8.0), + REAL_CONST(7155.4913763415516/8.0), + REAL_CONST(7167.7570555538041/8.0), + REAL_CONST(7180.0279843623894/8.0), + REAL_CONST(7192.3041582795131/8.0), + REAL_CONST(7204.5855728269571/8.0), + REAL_CONST(7216.8722235360519/8.0), + REAL_CONST(7229.1641059476406/8.0), + REAL_CONST(7241.4612156120484/8.0), + REAL_CONST(7253.7635480890503/8.0), + REAL_CONST(7266.0710989478375/8.0), + REAL_CONST(7278.3838637669869/8.0), + REAL_CONST(7290.7018381344296/8.0), + REAL_CONST(7303.0250176474174/8.0), + REAL_CONST(7315.3533979124932/8.0), + REAL_CONST(7327.6869745454596/8.0), + REAL_CONST(7340.0257431713462/8.0), + REAL_CONST(7352.3696994243801/8.0), + REAL_CONST(7364.7188389479543/8.0), + REAL_CONST(7377.0731573945968/8.0), + REAL_CONST(7389.4326504259407/8.0), + REAL_CONST(7401.7973137126937/8.0), + REAL_CONST(7414.1671429346061/8.0), + REAL_CONST(7426.5421337804428/8.0), + REAL_CONST(7438.922281947951/8.0), + REAL_CONST(7451.3075831438346/8.0), + REAL_CONST(7463.6980330837177/8.0), + REAL_CONST(7476.0936274921214/8.0), + REAL_CONST(7488.4943621024304/8.0), + REAL_CONST(7500.9002326568652/8.0), + REAL_CONST(7513.3112349064522/8.0), + REAL_CONST(7525.7273646109943/8.0), + REAL_CONST(7538.1486175390446/8.0), + REAL_CONST(7550.5749894678729/8.0), + REAL_CONST(7563.0064761834419/8.0), + REAL_CONST(7575.4430734803736/8.0), + REAL_CONST(7587.8847771619248/8.0), + REAL_CONST(7600.3315830399597/8.0), + REAL_CONST(7612.7834869349153/8.0), + REAL_CONST(7625.24048467578/8.0), + REAL_CONST(7637.7025721000637/8.0), + REAL_CONST(7650.1697450537677/8.0), + REAL_CONST(7662.6419993913596/8.0), + REAL_CONST(7675.1193309757446/8.0), + REAL_CONST(7687.6017356782404/8.0), + REAL_CONST(7700.0892093785433/8.0), + REAL_CONST(7712.5817479647112/8.0), + REAL_CONST(7725.079347333125/8.0), + REAL_CONST(7737.5820033884729/8.0), + REAL_CONST(7750.0897120437139/8.0), + REAL_CONST(7762.6024692200581/8.0), + REAL_CONST(7775.1202708469355/8.0), + REAL_CONST(7787.6431128619733/8.0), + REAL_CONST(7800.1709912109645/8.0), + REAL_CONST(7812.7039018478481/8.0), + REAL_CONST(7825.2418407346768/8.0), + REAL_CONST(7837.7848038415968/8.0), + REAL_CONST(7850.3327871468155/8.0), + REAL_CONST(7862.8857866365806/8.0), + REAL_CONST(7875.4437983051539/8.0), + REAL_CONST(7888.006818154784/8.0), + REAL_CONST(7900.5748421956796/8.0), + REAL_CONST(7913.1478664459901/8.0), + REAL_CONST(7925.725886931772/8.0), + REAL_CONST(7938.3088996869719/8.0), + REAL_CONST(7950.8969007533951/8.0), + REAL_CONST(7963.4898861806851/8.0), + REAL_CONST(7976.0878520262959/8.0), + REAL_CONST(7988.6907943554688/8.0), + REAL_CONST(8001.2987092412086/8.0), + REAL_CONST(8013.911592764257/8.0), + REAL_CONST(8026.5294410130691/8.0), + REAL_CONST(8039.1522500837891/8.0), + REAL_CONST(8051.7800160802271/8.0), + REAL_CONST(8064.412735113835/8.0), + REAL_CONST(8077.0504033036796/8.0), + REAL_CONST(8089.6930167764222/8.0), + REAL_CONST(8102.3405716662946/8.0), + REAL_CONST(8114.9930641150731/8.0), + REAL_CONST(8127.6504902720571/8.0), + REAL_CONST(8140.3128462940449/8.0), + REAL_CONST(8152.9801283453098/8.0), + REAL_CONST(8165.6523325975786/8.0), + REAL_CONST(8178.3294552300049/8.0), + REAL_CONST(8191.0114924291529/8.0), + REAL_CONST(8203.6984403889655/8.0), + REAL_CONST(8216.3902953107463/8.0), + REAL_CONST(8229.0870534031419/8.0), + REAL_CONST(8241.7887108821069/8.0), + REAL_CONST(8254.4952639708936/8.0), + REAL_CONST(8267.2067089000211/8.0), + REAL_CONST(8279.9230419072574/8.0), + REAL_CONST(8292.6442592375952/8.0), + REAL_CONST(8305.3703571432306/8.0), + REAL_CONST(8318.101331883543/8.0), + REAL_CONST(8330.8371797250657/8.0), + REAL_CONST(8343.577896941475/8.0), + REAL_CONST(8356.3234798135582/8.0), + REAL_CONST(8369.0739246291978/8.0), + REAL_CONST(8381.8292276833508/8.0), + REAL_CONST(8394.5893852780209/8.0), + REAL_CONST(8407.3543937222421/8.0), + REAL_CONST(8420.1242493320569/8.0), + REAL_CONST(8432.8989484304948/8.0), + REAL_CONST(8445.6784873475499/8.0), + REAL_CONST(8458.4628624201578/8.0), + REAL_CONST(8471.2520699921806/8.0), + REAL_CONST(8484.0461064143838/8.0), + REAL_CONST(8496.8449680444082/8.0), + REAL_CONST(8509.6486512467636/8.0), + REAL_CONST(8522.4571523927953/8.0), + REAL_CONST(8535.270467860666/8.0), + REAL_CONST(8548.0885940353437/8.0), + REAL_CONST(8560.9115273085663/8.0), + REAL_CONST(8573.7392640788403/8.0), + REAL_CONST(8586.5718007514006/8.0), + REAL_CONST(8599.4091337382069/8.0), + REAL_CONST(8612.2512594579148/8.0), + REAL_CONST(8625.0981743358552/8.0), + REAL_CONST(8637.9498748040205/8.0), + REAL_CONST(8650.8063573010386/8.0), + REAL_CONST(8663.6676182721567/8.0), + REAL_CONST(8676.533654169225/8.0), + REAL_CONST(8689.4044614506638/8.0), + REAL_CONST(8702.2800365814601/8.0), + REAL_CONST(8715.1603760331418/8.0), + REAL_CONST(8728.0454762837508/8.0), + REAL_CONST(8740.9353338178389/8.0), + REAL_CONST(8753.8299451264356/8.0), + REAL_CONST(8766.7293067070332/8.0), + REAL_CONST(8779.6334150635721/8.0), + REAL_CONST(8792.5422667064158/8.0), + REAL_CONST(8805.4558581523324/8.0), + REAL_CONST(8818.3741859244819/8.0), + REAL_CONST(8831.2972465523908/8.0), + REAL_CONST(8844.2250365719356/8.0), + REAL_CONST(8857.1575525253265/8.0), + REAL_CONST(8870.0947909610859/8.0), + REAL_CONST(8883.0367484340295/8.0), + REAL_CONST(8895.9834215052524/8.0), + REAL_CONST(8908.934806742107/8.0), + REAL_CONST(8921.8909007181846/8.0), + REAL_CONST(8934.8517000132997/8.0), + REAL_CONST(8947.817201213471/8.0), + REAL_CONST(8960.7874009109/8.0), + REAL_CONST(8973.7622957039603/8.0), + REAL_CONST(8986.7418821971733/8.0), + REAL_CONST(8999.7261570011924/8.0), + REAL_CONST(9012.7151167327884/8.0), + REAL_CONST(9025.7087580148236/8.0), + REAL_CONST(9038.7070774762469/8.0), + REAL_CONST(9051.7100717520643/8.0), + REAL_CONST(9064.7177374833282/8.0), + REAL_CONST(9077.7300713171153/8.0), + REAL_CONST(9090.7470699065179/8.0), + REAL_CONST(9103.7687299106146/8.0), + REAL_CONST(9116.7950479944648/8.0), + REAL_CONST(9129.8260208290812/8.0), + REAL_CONST(9142.8616450914233/8.0), + REAL_CONST(9155.9019174643727/8.0), + REAL_CONST(9168.9468346367157/8.0), + REAL_CONST(9181.9963933031358/8.0), + REAL_CONST(9195.0505901641845/8.0), + REAL_CONST(9208.1094219262741/8.0), + REAL_CONST(9221.1728853016557/8.0), + REAL_CONST(9234.240977008405/8.0), + REAL_CONST(9247.3136937704076/8.0), + REAL_CONST(9260.3910323173386/8.0), + REAL_CONST(9273.472989384647/8.0), + REAL_CONST(9286.5595617135423/8.0), + REAL_CONST(9299.6507460509747/8.0), + REAL_CONST(9312.7465391496207/8.0), + REAL_CONST(9325.8469377678684/8.0), + REAL_CONST(9338.9519386698012/8.0), + REAL_CONST(9352.0615386251757/8.0), + REAL_CONST(9365.1757344094131/8.0), + REAL_CONST(9378.2945228035842/8.0), + REAL_CONST(9391.4179005943843/8.0), + REAL_CONST(9404.5458645741273/8.0), + REAL_CONST(9417.6784115407263/8.0), + REAL_CONST(9430.8155382976747/8.0), + REAL_CONST(9443.9572416540359/8.0), + REAL_CONST(9457.1035184244265/8.0), + REAL_CONST(9470.2543654290002/8.0), + REAL_CONST(9483.4097794934296/8.0), + REAL_CONST(9496.5697574488931/8.0), + REAL_CONST(9509.7342961320664/8.0), + REAL_CONST(9522.9033923850911/8.0), + REAL_CONST(9536.0770430555804/8.0), + REAL_CONST(9549.2552449965824/8.0), + REAL_CONST(9562.4379950665825/8.0), + REAL_CONST(9575.6252901294793/8.0), + REAL_CONST(9588.8171270545736/8.0), + REAL_CONST(9602.0135027165488/8.0), + REAL_CONST(9615.2144139954635/8.0), + REAL_CONST(9628.4198577767274/8.0), + REAL_CONST(9641.629830951093/8.0), + REAL_CONST(9654.844330414644/8.0), + REAL_CONST(9668.0633530687719/8.0), + REAL_CONST(9681.286895820167/8.0), + REAL_CONST(9694.5149555808002/8.0), + REAL_CONST(9707.7475292679192/8.0), + REAL_CONST(9720.9846138040157/8.0), + REAL_CONST(9734.2262061168276/8.0), + REAL_CONST(9747.4723031393187/8.0), + REAL_CONST(9760.7229018096641/8.0), + REAL_CONST(9773.9779990712323/8.0), + REAL_CONST(9787.2375918725811/8.0), + REAL_CONST(9800.5016771674327/8.0), + REAL_CONST(9813.7702519146696/8.0), + REAL_CONST(9827.0433130783094/8.0), + REAL_CONST(9840.3208576275028/8.0), + REAL_CONST(9853.602882536512/8.0), + REAL_CONST(9866.8893847846994/8.0), + REAL_CONST(9880.1803613565116/8.0), + REAL_CONST(9893.4758092414686/8.0), + REAL_CONST(9906.7757254341523/8.0), + REAL_CONST(9920.0801069341851/8.0), + REAL_CONST(9933.3889507462245/8.0), + REAL_CONST(9946.7022538799429/8.0), + REAL_CONST(9960.0200133500221/8.0), + REAL_CONST(9973.3422261761298/8.0), + REAL_CONST(9986.6688893829159/8.0), + REAL_CONST(9999.9999999999945/8.0), + REAL_CONST(10013.335555061929/8.0), + REAL_CONST(10026.675551608221/8.0), + REAL_CONST(10040.019986683301/8.0), + REAL_CONST(10053.368857336509/8.0), + REAL_CONST(10066.722160622081/8.0), + REAL_CONST(10080.079893599144/8.0), + REAL_CONST(10093.442053331697/8.0), + REAL_CONST(10106.808636888598/8.0), + REAL_CONST(10120.179641343551/8.0), + REAL_CONST(10133.555063775095/8.0), + REAL_CONST(10146.934901266595/8.0), + REAL_CONST(10160.31915090622/8.0), + REAL_CONST(10173.707809786936/8.0), + REAL_CONST(10187.100875006496/8.0), + REAL_CONST(10200.498343667417/8.0), + REAL_CONST(10213.900212876984/8.0), + REAL_CONST(10227.306479747222/8.0), + REAL_CONST(10240.717141394889/8.0), + REAL_CONST(10254.132194941467/8.0), + REAL_CONST(10267.551637513146/8.0), + REAL_CONST(10280.975466240814/8.0), + REAL_CONST(10294.40367826004/8.0), + REAL_CONST(10307.836270711066/8.0), + REAL_CONST(10321.273240738796/8.0), + REAL_CONST(10334.71458549278/8.0) +#ifdef BIG_IQ_TABLE + ,REAL_CONST(10348.160302127204/8.0), + REAL_CONST(10361.610387800878/8.0), + REAL_CONST(10375.064839677221/8.0), + REAL_CONST(10388.523654924258/8.0), + REAL_CONST(10401.986830714593/8.0), + REAL_CONST(10415.454364225412/8.0), + REAL_CONST(10428.926252638465/8.0), + REAL_CONST(10442.402493140049/8.0), + REAL_CONST(10455.883082921007/8.0), + REAL_CONST(10469.368019176709/8.0), + REAL_CONST(10482.85729910704/8.0), + REAL_CONST(10496.350919916393/8.0), + REAL_CONST(10509.848878813653/8.0), + REAL_CONST(10523.351173012188/8.0), + REAL_CONST(10536.857799729838/8.0), + REAL_CONST(10550.3687561889/8.0), + REAL_CONST(10563.884039616123/8.0), + REAL_CONST(10577.403647242685/8.0), + REAL_CONST(10590.927576304197/8.0), + REAL_CONST(10604.455824040679/8.0), + REAL_CONST(10617.988387696556/8.0), + REAL_CONST(10631.525264520642/8.0), + REAL_CONST(10645.066451766135/8.0), + REAL_CONST(10658.611946690598/8.0), + REAL_CONST(10672.161746555956/8.0), + REAL_CONST(10685.715848628475/8.0), + REAL_CONST(10699.274250178762/8.0), + REAL_CONST(10712.836948481747/8.0), + REAL_CONST(10726.403940816675/8.0), + REAL_CONST(10739.975224467091/8.0), + REAL_CONST(10753.550796720834/8.0), + REAL_CONST(10767.130654870027/8.0), + REAL_CONST(10780.714796211059/8.0), + REAL_CONST(10794.303218044579/8.0), + REAL_CONST(10807.895917675487/8.0), + REAL_CONST(10821.492892412922/8.0), + REAL_CONST(10835.094139570248/8.0), + REAL_CONST(10848.699656465047/8.0), + REAL_CONST(10862.309440419107/8.0), + REAL_CONST(10875.923488758415/8.0), + REAL_CONST(10889.541798813138/8.0), + REAL_CONST(10903.16436791762/8.0), + REAL_CONST(10916.791193410372/8.0), + REAL_CONST(10930.422272634056/8.0), + REAL_CONST(10944.05760293548/8.0), + REAL_CONST(10957.697181665582/8.0), + REAL_CONST(10971.341006179427/8.0), + REAL_CONST(10984.98907383619/8.0), + REAL_CONST(10998.641381999149/8.0), + REAL_CONST(11012.297928035676/8.0), + REAL_CONST(11025.958709317223/8.0), + REAL_CONST(11039.623723219316/8.0), + REAL_CONST(11053.292967121541/8.0), + REAL_CONST(11066.966438407539/8.0), + REAL_CONST(11080.64413446499/8.0), + REAL_CONST(11094.326052685608/8.0), + REAL_CONST(11108.012190465128/8.0), + REAL_CONST(11121.702545203296/8.0), + REAL_CONST(11135.397114303863/8.0), + REAL_CONST(11149.095895174571/8.0), + REAL_CONST(11162.798885227143/8.0), + REAL_CONST(11176.506081877278/8.0), + REAL_CONST(11190.217482544635/8.0), + REAL_CONST(11203.933084652828/8.0), + REAL_CONST(11217.652885629415/8.0), + REAL_CONST(11231.376882905886/8.0), + REAL_CONST(11245.105073917659/8.0), + REAL_CONST(11258.837456104062/8.0), + REAL_CONST(11272.574026908333/8.0), + REAL_CONST(11286.314783777601/8.0), + REAL_CONST(11300.059724162888/8.0), + REAL_CONST(11313.808845519083/8.0), + REAL_CONST(11327.562145304952/8.0), + REAL_CONST(11341.319620983111/8.0), + REAL_CONST(11355.081270020033/8.0), + REAL_CONST(11368.847089886023/8.0), + REAL_CONST(11382.617078055218/8.0), + REAL_CONST(11396.391232005579/8.0), + REAL_CONST(11410.169549218874/8.0), + REAL_CONST(11423.952027180676/8.0), + REAL_CONST(11437.738663380349/8.0), + REAL_CONST(11451.529455311042/8.0), + REAL_CONST(11465.324400469679/8.0), + REAL_CONST(11479.123496356951/8.0), + REAL_CONST(11492.926740477304/8.0), + REAL_CONST(11506.734130338931/8.0), + REAL_CONST(11520.545663453764/8.0), + REAL_CONST(11534.361337337466/8.0), + REAL_CONST(11548.181149509423/8.0), + REAL_CONST(11562.005097492724/8.0), + REAL_CONST(11575.83317881417/8.0), + REAL_CONST(11589.665391004253/8.0), + REAL_CONST(11603.501731597149/8.0), + REAL_CONST(11617.342198130715/8.0), + REAL_CONST(11631.186788146468/8.0), + REAL_CONST(11645.035499189589/8.0), + REAL_CONST(11658.888328808911/8.0), + REAL_CONST(11672.745274556904/8.0), + REAL_CONST(11686.606333989675/8.0), + REAL_CONST(11700.471504666955/8.0), + REAL_CONST(11714.340784152086/8.0), + REAL_CONST(11728.214170012021/8.0), + REAL_CONST(11742.091659817312/8.0), + REAL_CONST(11755.973251142101/8.0), + REAL_CONST(11769.858941564111/8.0), + REAL_CONST(11783.748728664636/8.0), + REAL_CONST(11797.642610028539/8.0), + REAL_CONST(11811.540583244237/8.0), + REAL_CONST(11825.442645903697/8.0), + REAL_CONST(11839.34879560242/8.0), + REAL_CONST(11853.259029939445/8.0), + REAL_CONST(11867.173346517333/8.0), + REAL_CONST(11881.091742942155/8.0), + REAL_CONST(11895.014216823492/8.0), + REAL_CONST(11908.940765774427/8.0), + REAL_CONST(11922.871387411526/8.0), + REAL_CONST(11936.806079354839/8.0), + REAL_CONST(11950.744839227897/8.0), + REAL_CONST(11964.687664657684/8.0), + REAL_CONST(11978.634553274653/8.0), + REAL_CONST(11992.585502712702/8.0), + REAL_CONST(12006.540510609168/8.0), + REAL_CONST(12020.499574604828/8.0), + REAL_CONST(12034.462692343877/8.0), + REAL_CONST(12048.429861473938/8.0), + REAL_CONST(12062.401079646032/8.0), + REAL_CONST(12076.376344514589/8.0), + REAL_CONST(12090.355653737433/8.0), + REAL_CONST(12104.339004975769/8.0), + REAL_CONST(12118.326395894188/8.0), + REAL_CONST(12132.317824160644/8.0), + REAL_CONST(12146.313287446457/8.0), + REAL_CONST(12160.312783426305/8.0), + REAL_CONST(12174.316309778205/8.0), + REAL_CONST(12188.323864183525/8.0), + REAL_CONST(12202.335444326955/8.0), + REAL_CONST(12216.351047896511/8.0), + REAL_CONST(12230.370672583531/8.0), + REAL_CONST(12244.394316082657/8.0), + REAL_CONST(12258.421976091831/8.0), + REAL_CONST(12272.453650312296/8.0), + REAL_CONST(12286.489336448574/8.0), + REAL_CONST(12300.529032208471/8.0), + REAL_CONST(12314.572735303058/8.0), + REAL_CONST(12328.620443446678/8.0), + REAL_CONST(12342.672154356922/8.0), + REAL_CONST(12356.727865754638/8.0), + REAL_CONST(12370.787575363909/8.0), + REAL_CONST(12384.851280912055/8.0), + REAL_CONST(12398.918980129623/8.0), + REAL_CONST(12412.990670750381/8.0), + REAL_CONST(12427.066350511306/8.0), + REAL_CONST(12441.146017152583/8.0), + REAL_CONST(12455.229668417589/8.0), + REAL_CONST(12469.317302052901/8.0), + REAL_CONST(12483.40891580827/8.0), + REAL_CONST(12497.50450743663/8.0), + REAL_CONST(12511.604074694078/8.0), + REAL_CONST(12525.707615339878/8.0), + REAL_CONST(12539.815127136444/8.0), + REAL_CONST(12553.926607849342/8.0), + REAL_CONST(12568.042055247275/8.0), + REAL_CONST(12582.161467102082/8.0), + REAL_CONST(12596.284841188726/8.0), + REAL_CONST(12610.41217528529/8.0), + REAL_CONST(12624.543467172971/8.0), + REAL_CONST(12638.678714636069/8.0), + REAL_CONST(12652.817915461985/8.0), + REAL_CONST(12666.961067441209/8.0), + REAL_CONST(12681.108168367316/8.0), + REAL_CONST(12695.259216036962/8.0), + REAL_CONST(12709.414208249869/8.0), + REAL_CONST(12723.573142808827/8.0), + REAL_CONST(12737.736017519681/8.0), + REAL_CONST(12751.902830191326/8.0), + REAL_CONST(12766.073578635704/8.0), + REAL_CONST(12780.248260667788/8.0), + REAL_CONST(12794.426874105588/8.0), + REAL_CONST(12808.609416770132/8.0), + REAL_CONST(12822.795886485468/8.0), + REAL_CONST(12836.986281078653/8.0), + REAL_CONST(12851.180598379744/8.0), + REAL_CONST(12865.378836221802/8.0), + REAL_CONST(12879.580992440871/8.0), + REAL_CONST(12893.787064875984/8.0), + REAL_CONST(12907.997051369144/8.0), + REAL_CONST(12922.210949765335/8.0), + REAL_CONST(12936.428757912496/8.0), + REAL_CONST(12950.650473661524/8.0), + REAL_CONST(12964.876094866273/8.0), + REAL_CONST(12979.105619383534/8.0), + REAL_CONST(12993.339045073039/8.0), + REAL_CONST(13007.576369797454/8.0), + REAL_CONST(13021.817591422368/8.0), + REAL_CONST(13036.062707816285/8.0), + REAL_CONST(13050.311716850629/8.0), + REAL_CONST(13064.564616399723/8.0), + REAL_CONST(13078.821404340792/8.0), + REAL_CONST(13093.082078553954/8.0), + REAL_CONST(13107.346636922217/8.0), + REAL_CONST(13121.615077331464/8.0), + REAL_CONST(13135.887397670458/8.0), + REAL_CONST(13150.163595830827/8.0), + REAL_CONST(13164.44366970706/8.0), + REAL_CONST(13178.727617196502/8.0), + REAL_CONST(13193.015436199352/8.0), + REAL_CONST(13207.307124618648/8.0), + REAL_CONST(13221.602680360265/8.0), + REAL_CONST(13235.902101332911/8.0), + REAL_CONST(13250.205385448118/8.0), + REAL_CONST(13264.512530620239/8.0), + REAL_CONST(13278.823534766434/8.0), + REAL_CONST(13293.138395806676/8.0), + REAL_CONST(13307.457111663734/8.0), + REAL_CONST(13321.779680263176/8.0), + REAL_CONST(13336.106099533356/8.0), + REAL_CONST(13350.436367405409/8.0), + REAL_CONST(13364.77048181325/8.0), + REAL_CONST(13379.108440693562/8.0), + REAL_CONST(13393.450241985796/8.0), + REAL_CONST(13407.795883632158/8.0), + REAL_CONST(13422.145363577607/8.0), + REAL_CONST(13436.498679769853/8.0), + REAL_CONST(13450.855830159346/8.0), + REAL_CONST(13465.216812699266/8.0), + REAL_CONST(13479.581625345529/8.0), + REAL_CONST(13493.950266056772/8.0), + REAL_CONST(13508.32273279435/8.0), + REAL_CONST(13522.699023522329/8.0), + REAL_CONST(13537.079136207483/8.0), + REAL_CONST(13551.463068819286/8.0), + REAL_CONST(13565.850819329906/8.0), + REAL_CONST(13580.2423857142/8.0), + REAL_CONST(13594.63776594971/8.0), + REAL_CONST(13609.036958016657/8.0), + REAL_CONST(13623.439959897927/8.0), + REAL_CONST(13637.846769579081/8.0), + REAL_CONST(13652.257385048335/8.0), + REAL_CONST(13666.67180429656/8.0), + REAL_CONST(13681.090025317284/8.0), + REAL_CONST(13695.512046106669/8.0), + REAL_CONST(13709.937864663521/8.0), + REAL_CONST(13724.367478989278/8.0), + REAL_CONST(13738.800887088004/8.0), + REAL_CONST(13753.238086966385/8.0), + REAL_CONST(13767.679076633727/8.0), + REAL_CONST(13782.123854101939/8.0), + REAL_CONST(13796.572417385545/8.0), + REAL_CONST(13811.024764501659/8.0), + REAL_CONST(13825.480893469998/8.0), + REAL_CONST(13839.94080231286/8.0), + REAL_CONST(13854.404489055134/8.0), + REAL_CONST(13868.871951724283/8.0), + REAL_CONST(13883.34318835034/8.0), + REAL_CONST(13897.818196965914/8.0), + REAL_CONST(13912.296975606168/8.0), + REAL_CONST(13926.779522308825/8.0), + REAL_CONST(13941.26583511416/8.0), + REAL_CONST(13955.755912064991/8.0), + REAL_CONST(13970.249751206682/8.0), + REAL_CONST(13984.747350587126/8.0), + REAL_CONST(13999.248708256751/8.0), + REAL_CONST(14013.753822268511/8.0), + REAL_CONST(14028.262690677873/8.0), + REAL_CONST(14042.775311542828/8.0), + REAL_CONST(14057.291682923867/8.0), + REAL_CONST(14071.811802883994/8.0), + REAL_CONST(14086.335669488704/8.0), + REAL_CONST(14100.863280805994/8.0), + REAL_CONST(14115.394634906341/8.0), + REAL_CONST(14129.92972986271/8.0), + REAL_CONST(14144.468563750548/8.0), + REAL_CONST(14159.01113464777/8.0), + REAL_CONST(14173.55744063476/8.0), + REAL_CONST(14188.107479794369/8.0), + REAL_CONST(14202.661250211901/8.0), + REAL_CONST(14217.218749975118/8.0), + REAL_CONST(14231.779977174227/8.0), + REAL_CONST(14246.344929901879/8.0), + REAL_CONST(14260.913606253163/8.0), + REAL_CONST(14275.486004325601/8.0), + REAL_CONST(14290.062122219146/8.0), + REAL_CONST(14304.641958036171/8.0), + REAL_CONST(14319.225509881464/8.0), + REAL_CONST(14333.812775862236/8.0), + REAL_CONST(14348.403754088098/8.0), + REAL_CONST(14362.998442671067/8.0), + REAL_CONST(14377.59683972556/8.0), + REAL_CONST(14392.198943368388/8.0), + REAL_CONST(14406.804751718748/8.0), + REAL_CONST(14421.414262898223/8.0), + REAL_CONST(14436.027475030774/8.0), + REAL_CONST(14450.64438624274/8.0), + REAL_CONST(14465.264994662828/8.0), + REAL_CONST(14479.889298422106/8.0), + REAL_CONST(14494.517295654005/8.0), + REAL_CONST(14509.148984494313/8.0), + REAL_CONST(14523.784363081166/8.0), + REAL_CONST(14538.423429555049/8.0), + REAL_CONST(14553.066182058781/8.0), + REAL_CONST(14567.712618737527/8.0), + REAL_CONST(14582.362737738777/8.0), + REAL_CONST(14597.016537212348/8.0), + REAL_CONST(14611.674015310382/8.0), + REAL_CONST(14626.33517018734/8.0), + REAL_CONST(14640.999999999993/8.0), + REAL_CONST(14655.668502907418/8.0), + REAL_CONST(14670.340677071003/8.0), + REAL_CONST(14685.016520654426/8.0), + REAL_CONST(14699.696031823671/8.0), + REAL_CONST(14714.379208746999/8.0), + REAL_CONST(14729.066049594967/8.0), + REAL_CONST(14743.756552540408/8.0), + REAL_CONST(14758.45071575843/8.0), + REAL_CONST(14773.148537426418/8.0), + REAL_CONST(14787.850015724018/8.0), + REAL_CONST(14802.555148833142/8.0), + REAL_CONST(14817.263934937961/8.0), + REAL_CONST(14831.976372224897/8.0), + REAL_CONST(14846.692458882624/8.0), + REAL_CONST(14861.41219310206/8.0), + REAL_CONST(14876.135573076363/8.0), + REAL_CONST(14890.862597000923/8.0), + REAL_CONST(14905.593263073371/8.0), + REAL_CONST(14920.327569493558/8.0), + REAL_CONST(14935.065514463557/8.0), + REAL_CONST(14949.807096187662/8.0), + REAL_CONST(14964.552312872382/8.0), + REAL_CONST(14979.301162726431/8.0), + REAL_CONST(14994.053643960735/8.0), + REAL_CONST(15008.809754788414/8.0), + REAL_CONST(15023.569493424788/8.0), + REAL_CONST(15038.332858087369/8.0), + REAL_CONST(15053.099846995858/8.0), + REAL_CONST(15067.870458372134/8.0), + REAL_CONST(15082.644690440264/8.0), + REAL_CONST(15097.422541426484/8.0), + REAL_CONST(15112.204009559202/8.0), + REAL_CONST(15126.989093068994/8.0), + REAL_CONST(15141.777790188597/8.0), + REAL_CONST(15156.570099152905/8.0), + REAL_CONST(15171.366018198967/8.0), + REAL_CONST(15186.165545565986/8.0), + REAL_CONST(15200.968679495301/8.0), + REAL_CONST(15215.775418230402/8.0), + REAL_CONST(15230.585760016909/8.0), + REAL_CONST(15245.399703102579/8.0), + REAL_CONST(15260.217245737298/8.0), + REAL_CONST(15275.038386173073/8.0), + REAL_CONST(15289.863122664035/8.0), + REAL_CONST(15304.691453466432/8.0), + REAL_CONST(15319.523376838621/8.0), + REAL_CONST(15334.358891041069/8.0), + REAL_CONST(15349.197994336346/8.0), + REAL_CONST(15364.040684989128/8.0), + REAL_CONST(15378.886961266177/8.0), + REAL_CONST(15393.736821436356/8.0), + REAL_CONST(15408.590263770609/8.0), + REAL_CONST(15423.447286541972/8.0), + REAL_CONST(15438.307888025554/8.0), + REAL_CONST(15453.172066498542/8.0), + REAL_CONST(15468.039820240196/8.0), + REAL_CONST(15482.91114753184/8.0), + REAL_CONST(15497.786046656869/8.0), + REAL_CONST(15512.664515900733/8.0), + REAL_CONST(15527.546553550939/8.0), + REAL_CONST(15542.432157897045/8.0), + REAL_CONST(15557.32132723066/8.0), + REAL_CONST(15572.214059845435/8.0), + REAL_CONST(15587.110354037064/8.0), + REAL_CONST(15602.010208103273/8.0), + REAL_CONST(15616.913620343823/8.0), + REAL_CONST(15631.820589060506/8.0), + REAL_CONST(15646.731112557136/8.0), + REAL_CONST(15661.645189139546/8.0), + REAL_CONST(15676.562817115593/8.0), + REAL_CONST(15691.483994795139/8.0), + REAL_CONST(15706.408720490062/8.0), + REAL_CONST(15721.336992514242/8.0), + REAL_CONST(15736.268809183561/8.0), + REAL_CONST(15751.204168815901/8.0), + REAL_CONST(15766.143069731135/8.0), + REAL_CONST(15781.085510251132/8.0), + REAL_CONST(15796.03148869974/8.0), + REAL_CONST(15810.981003402798/8.0), + REAL_CONST(15825.934052688119/8.0), + REAL_CONST(15840.890634885489/8.0), + REAL_CONST(15855.850748326673/8.0), + REAL_CONST(15870.814391345401/8.0), + REAL_CONST(15885.781562277361/8.0), + REAL_CONST(15900.752259460214/8.0), + REAL_CONST(15915.726481233565/8.0), + REAL_CONST(15930.704225938984/8.0), + REAL_CONST(15945.685491919978/8.0), + REAL_CONST(15960.670277522009/8.0), + REAL_CONST(15975.658581092481/8.0), + REAL_CONST(15990.65040098073/8.0), + REAL_CONST(16005.645735538035/8.0), + REAL_CONST(16020.644583117599/8.0), + REAL_CONST(16035.646942074556/8.0), + REAL_CONST(16050.652810765967/8.0), + REAL_CONST(16065.662187550806/8.0), + REAL_CONST(16080.675070789974/8.0), + REAL_CONST(16095.691458846273/8.0), + REAL_CONST(16110.711350084424/8.0), + REAL_CONST(16125.734742871053/8.0), + REAL_CONST(16140.761635574685/8.0), + REAL_CONST(16155.792026565747/8.0), + REAL_CONST(16170.825914216561/8.0), + REAL_CONST(16185.863296901338/8.0), + REAL_CONST(16200.904172996183/8.0), + REAL_CONST(16215.948540879079/8.0), + REAL_CONST(16230.996398929899/8.0), + REAL_CONST(16246.047745530386/8.0), + REAL_CONST(16261.102579064163/8.0), + REAL_CONST(16276.160897916721/8.0), + REAL_CONST(16291.22270047542/8.0), + REAL_CONST(16306.287985129484/8.0), + REAL_CONST(16321.356750269995/8.0), + REAL_CONST(16336.428994289896/8.0), + REAL_CONST(16351.504715583982/8.0), + REAL_CONST(16366.5839125489/8.0), + REAL_CONST(16381.666583583141/8.0), + REAL_CONST(16396.752727087041/8.0), + REAL_CONST(16411.842341462776/8.0), + REAL_CONST(16426.935425114363/8.0), + REAL_CONST(16442.031976447644/8.0), + REAL_CONST(16457.131993870298/8.0), + REAL_CONST(16472.235475791829/8.0), + REAL_CONST(16487.342420623561/8.0), + REAL_CONST(16502.452826778641/8.0), + REAL_CONST(16517.566692672033/8.0), + REAL_CONST(16532.684016720516/8.0), + REAL_CONST(16547.804797342676/8.0), + REAL_CONST(16562.929032958902/8.0), + REAL_CONST(16578.056721991394/8.0), + REAL_CONST(16593.18786286415/8.0), + REAL_CONST(16608.322454002962/8.0), + REAL_CONST(16623.460493835417/8.0), + REAL_CONST(16638.601980790896/8.0), + REAL_CONST(16653.746913300558/8.0), + REAL_CONST(16668.895289797354/8.0), + REAL_CONST(16684.047108716015/8.0), + REAL_CONST(16699.202368493046/8.0), + REAL_CONST(16714.361067566726/8.0), + REAL_CONST(16729.523204377107/8.0), + REAL_CONST(16744.688777366009/8.0), + REAL_CONST(16759.857784977012/8.0), + REAL_CONST(16775.030225655464/8.0), + REAL_CONST(16790.206097848466/8.0), + REAL_CONST(16805.385400004874/8.0), + REAL_CONST(16820.568130575302/8.0), + REAL_CONST(16835.754288012104/8.0), + REAL_CONST(16850.943870769381/8.0), + REAL_CONST(16866.136877302983/8.0), + REAL_CONST(16881.333306070494/8.0), + REAL_CONST(16896.53315553123/8.0), + REAL_CONST(16911.736424146249/8.0), + REAL_CONST(16926.943110378332/8.0), + REAL_CONST(16942.153212691992/8.0), + REAL_CONST(16957.366729553454/8.0), + REAL_CONST(16972.583659430682/8.0), + REAL_CONST(16987.804000793338/8.0), + REAL_CONST(17003.027752112816/8.0), + REAL_CONST(17018.254911862205/8.0), + REAL_CONST(17033.485478516312/8.0), + REAL_CONST(17048.719450551645/8.0), + REAL_CONST(17063.956826446421/8.0), + REAL_CONST(17079.197604680547/8.0), + REAL_CONST(17094.44178373563/8.0), + REAL_CONST(17109.689362094967/8.0), + REAL_CONST(17124.940338243552/8.0), + REAL_CONST(17140.194710668064/8.0), + REAL_CONST(17155.452477856852/8.0), + REAL_CONST(17170.713638299967/8.0), + REAL_CONST(17185.978190489128/8.0), + REAL_CONST(17201.246132917724/8.0), + REAL_CONST(17216.517464080825/8.0), + REAL_CONST(17231.792182475165/8.0), + REAL_CONST(17247.070286599141/8.0), + REAL_CONST(17262.351774952826/8.0), + REAL_CONST(17277.636646037936/8.0), + REAL_CONST(17292.924898357855/8.0), + REAL_CONST(17308.216530417623/8.0), + REAL_CONST(17323.511540723921/8.0), + REAL_CONST(17338.809927785089/8.0), + REAL_CONST(17354.111690111105/8.0), + REAL_CONST(17369.416826213594/8.0), + REAL_CONST(17384.725334605821/8.0), + REAL_CONST(17400.037213802683/8.0), + REAL_CONST(17415.352462320716/8.0), + REAL_CONST(17430.67107867809/8.0), + REAL_CONST(17445.993061394587/8.0), + REAL_CONST(17461.318408991636/8.0), + REAL_CONST(17476.647119992274/8.0), + REAL_CONST(17491.979192921168/8.0), + REAL_CONST(17507.314626304586/8.0), + REAL_CONST(17522.653418670423/8.0), + REAL_CONST(17537.995568548187/8.0), + REAL_CONST(17553.341074468986/8.0), + REAL_CONST(17568.689934965536/8.0), + REAL_CONST(17584.042148572156/8.0), + REAL_CONST(17599.397713824768/8.0), + REAL_CONST(17614.75662926089/8.0), + REAL_CONST(17630.118893419625/8.0), + REAL_CONST(17645.484504841683/8.0), + REAL_CONST(17660.853462069354/8.0), + REAL_CONST(17676.225763646511/8.0), + REAL_CONST(17691.601408118619/8.0), + REAL_CONST(17706.980394032718/8.0), + REAL_CONST(17722.362719937424/8.0), + REAL_CONST(17737.748384382936/8.0), + REAL_CONST(17753.137385921014/8.0), + REAL_CONST(17768.529723104999/8.0), + REAL_CONST(17783.92539448979/8.0), + REAL_CONST(17799.324398631856/8.0), + REAL_CONST(17814.726734089225/8.0), + REAL_CONST(17830.13239942148/8.0), + REAL_CONST(17845.541393189767/8.0), + REAL_CONST(17860.95371395678/8.0), + REAL_CONST(17876.369360286772/8.0), + REAL_CONST(17891.788330745527/8.0), + REAL_CONST(17907.210623900395/8.0), + REAL_CONST(17922.636238320254/8.0), + REAL_CONST(17938.065172575527/8.0), + REAL_CONST(17953.497425238176/8.0), + REAL_CONST(17968.932994881692/8.0), + REAL_CONST(17984.371880081104/8.0), + REAL_CONST(17999.814079412972/8.0), + REAL_CONST(18015.259591455371/8.0), + REAL_CONST(18030.708414787914/8.0), + REAL_CONST(18046.160547991731/8.0), + REAL_CONST(18061.615989649465/8.0), + REAL_CONST(18077.074738345284/8.0), + REAL_CONST(18092.536792664861/8.0), + REAL_CONST(18108.002151195393/8.0), + REAL_CONST(18123.470812525571/8.0), + REAL_CONST(18138.942775245599/8.0), + REAL_CONST(18154.418037947191/8.0), + REAL_CONST(18169.896599223546/8.0), + REAL_CONST(18185.37845766938/8.0), + REAL_CONST(18200.863611880886/8.0), + REAL_CONST(18216.352060455767/8.0), + REAL_CONST(18231.843801993204/8.0), + REAL_CONST(18247.338835093873/8.0), + REAL_CONST(18262.837158359936/8.0), + REAL_CONST(18278.338770395032/8.0), + REAL_CONST(18293.84366980429/8.0), + REAL_CONST(18309.351855194309/8.0), + REAL_CONST(18324.863325173166/8.0), + REAL_CONST(18340.378078350412/8.0), + REAL_CONST(18355.896113337069/8.0), + REAL_CONST(18371.417428745623/8.0), + REAL_CONST(18386.942023190033/8.0), + REAL_CONST(18402.469895285718/8.0), + REAL_CONST(18418.00104364955/8.0), + REAL_CONST(18433.53546689987/8.0), + REAL_CONST(18449.073163656474/8.0), + REAL_CONST(18464.614132540602/8.0), + REAL_CONST(18480.158372174956/8.0), + REAL_CONST(18495.705881183676/8.0), + REAL_CONST(18511.256658192357/8.0), + REAL_CONST(18526.810701828035/8.0), + REAL_CONST(18542.368010719183/8.0), + REAL_CONST(18557.928583495715/8.0), + REAL_CONST(18573.492418788985/8.0), + REAL_CONST(18589.059515231773/8.0), + REAL_CONST(18604.629871458303/8.0), + REAL_CONST(18620.203486104212/8.0), + REAL_CONST(18635.78035780658/8.0), + REAL_CONST(18651.360485203899/8.0), + REAL_CONST(18666.943866936086/8.0), + REAL_CONST(18682.53050164448/8.0), + REAL_CONST(18698.120387971841/8.0), + REAL_CONST(18713.713524562332/8.0), + REAL_CONST(18729.30991006154/8.0), + REAL_CONST(18744.909543116457/8.0), + REAL_CONST(18760.512422375479/8.0), + REAL_CONST(18776.118546488418/8.0), + REAL_CONST(18791.727914106479/8.0), + REAL_CONST(18807.340523882274/8.0), + REAL_CONST(18822.95637446981/8.0), + REAL_CONST(18838.575464524489/8.0), + REAL_CONST(18854.197792703111/8.0), + REAL_CONST(18869.823357663863/8.0), + REAL_CONST(18885.452158066328/8.0), + REAL_CONST(18901.08419257147/8.0), + REAL_CONST(18916.719459841639/8.0), + REAL_CONST(18932.357958540564/8.0), + REAL_CONST(18947.999687333362/8.0), + REAL_CONST(18963.644644886521/8.0), + REAL_CONST(18979.292829867907/8.0), + REAL_CONST(18994.944240946759/8.0), + REAL_CONST(19010.598876793687/8.0), + REAL_CONST(19026.256736080668/8.0), + REAL_CONST(19041.917817481048/8.0), + REAL_CONST(19057.582119669532/8.0), + REAL_CONST(19073.2496413222/8.0), + REAL_CONST(19088.920381116473/8.0), + REAL_CONST(19104.594337731145/8.0), + REAL_CONST(19120.271509846356/8.0), + REAL_CONST(19135.951896143604/8.0), + REAL_CONST(19151.635495305738/8.0), + REAL_CONST(19167.322306016948/8.0), + REAL_CONST(19183.012326962784/8.0), + REAL_CONST(19198.705556830122/8.0), + REAL_CONST(19214.401994307198/8.0), + REAL_CONST(19230.101638083579/8.0), + REAL_CONST(19245.804486850167/8.0), + REAL_CONST(19261.510539299208/8.0), + REAL_CONST(19277.219794124274/8.0), + REAL_CONST(19292.932250020265/8.0), + REAL_CONST(19308.647905683421/8.0), + REAL_CONST(19324.366759811302/8.0), + REAL_CONST(19340.088811102793/8.0), + REAL_CONST(19355.8140582581/8.0), + REAL_CONST(19371.542499978754/8.0), + REAL_CONST(19387.2741349676/8.0), + REAL_CONST(19403.008961928797/8.0), + REAL_CONST(19418.746979567823/8.0), + REAL_CONST(19434.488186591469/8.0), + REAL_CONST(19450.232581707827/8.0), + REAL_CONST(19465.980163626304/8.0), + REAL_CONST(19481.730931057613/8.0), + REAL_CONST(19497.484882713761/8.0), + REAL_CONST(19513.242017308068/8.0), + REAL_CONST(19529.002333555141/8.0), + REAL_CONST(19544.765830170898/8.0), + REAL_CONST(19560.532505872539/8.0), + REAL_CONST(19576.302359378566/8.0), + REAL_CONST(19592.075389408761/8.0), + REAL_CONST(19607.851594684209/8.0), + REAL_CONST(19623.630973927269/8.0), + REAL_CONST(19639.41352586159/8.0), + REAL_CONST(19655.199249212103/8.0), + REAL_CONST(19670.988142705017/8.0), + REAL_CONST(19686.780205067826/8.0), + REAL_CONST(19702.575435029288/8.0), + REAL_CONST(19718.373831319448/8.0), + REAL_CONST(19734.175392669615/8.0), + REAL_CONST(19749.980117812371/8.0), + REAL_CONST(19765.788005481569/8.0), + REAL_CONST(19781.599054412323/8.0), + REAL_CONST(19797.413263341008/8.0), + REAL_CONST(19813.230631005274/8.0), + REAL_CONST(19829.051156144014/8.0), + REAL_CONST(19844.874837497395/8.0), + REAL_CONST(19860.701673806827/8.0), + REAL_CONST(19876.531663814985/8.0), + REAL_CONST(19892.364806265789/8.0), + REAL_CONST(19908.201099904403/8.0), + REAL_CONST(19924.040543477258/8.0), + REAL_CONST(19939.883135732012/8.0), + REAL_CONST(19955.728875417579/8.0), + REAL_CONST(19971.577761284105/8.0), + REAL_CONST(19987.429792082985/8.0), + REAL_CONST(20003.284966566847/8.0), + REAL_CONST(20019.14328348956/8.0), + REAL_CONST(20035.004741606219/8.0), + REAL_CONST(20050.869339673161/8.0), + REAL_CONST(20066.737076447946/8.0), + REAL_CONST(20082.607950689362/8.0), + REAL_CONST(20098.481961157428/8.0), + REAL_CONST(20114.359106613385/8.0), + REAL_CONST(20130.239385819699/8.0), + REAL_CONST(20146.122797540058/8.0), + REAL_CONST(20162.009340539353/8.0), + REAL_CONST(20177.899013583716/8.0), + REAL_CONST(20193.791815440476/8.0), + REAL_CONST(20209.687744878182/8.0), + REAL_CONST(20225.586800666591/8.0), + REAL_CONST(20241.488981576669/8.0), + REAL_CONST(20257.394286380597/8.0), + REAL_CONST(20273.302713851754/8.0), + REAL_CONST(20289.214262764715/8.0), + REAL_CONST(20305.128931895277/8.0), + REAL_CONST(20321.046720020415/8.0), + REAL_CONST(20336.967625918318/8.0), + REAL_CONST(20352.891648368361/8.0), + REAL_CONST(20368.818786151114/8.0), + REAL_CONST(20384.749038048347/8.0), + REAL_CONST(20400.682402843009/8.0), + REAL_CONST(20416.618879319249/8.0), + REAL_CONST(20432.558466262391/8.0), + REAL_CONST(20448.501162458953/8.0), + REAL_CONST(20464.446966696629/8.0), + REAL_CONST(20480.395877764302/8.0), + REAL_CONST(20496.347894452025/8.0), + REAL_CONST(20512.303015551031/8.0), + REAL_CONST(20528.261239853735/8.0), + REAL_CONST(20544.22256615372/8.0), + REAL_CONST(20560.186993245738/8.0), + REAL_CONST(20576.15451992572/8.0), + REAL_CONST(20592.125144990758/8.0), + REAL_CONST(20608.098867239107/8.0), + REAL_CONST(20624.075685470198/8.0), + REAL_CONST(20640.055598484618/8.0), + REAL_CONST(20656.038605084115/8.0), + REAL_CONST(20672.024704071595/8.0), + REAL_CONST(20688.013894251126/8.0), + REAL_CONST(20704.006174427926/8.0), + REAL_CONST(20720.001543408373/8.0), + REAL_CONST(20735.999999999989/8.0), + REAL_CONST(20752.001543011454/8.0), + REAL_CONST(20768.006171252597/8.0), + REAL_CONST(20784.013883534382/8.0), + REAL_CONST(20800.024678668931/8.0), + REAL_CONST(20816.038555469506/8.0), + REAL_CONST(20832.055512750507/8.0), + REAL_CONST(20848.075549327474/8.0), + REAL_CONST(20864.098664017085/8.0), + REAL_CONST(20880.124855637161/8.0), + REAL_CONST(20896.154123006647/8.0), + REAL_CONST(20912.186464945626/8.0), + REAL_CONST(20928.221880275312/8.0), + REAL_CONST(20944.260367818049/8.0), + REAL_CONST(20960.301926397311/8.0), + REAL_CONST(20976.346554837684/8.0), + REAL_CONST(20992.394251964895/8.0), + REAL_CONST(21008.445016605787/8.0), + REAL_CONST(21024.498847588318/8.0), + REAL_CONST(21040.555743741574/8.0), + REAL_CONST(21056.615703895754/8.0), + REAL_CONST(21072.678726882168/8.0), + REAL_CONST(21088.744811533252/8.0), + REAL_CONST(21104.813956682538/8.0), + REAL_CONST(21120.886161164683/8.0), + REAL_CONST(21136.961423815443/8.0), + REAL_CONST(21153.039743471683/8.0), + REAL_CONST(21169.121118971379/8.0), + REAL_CONST(21185.205549153605/8.0), + REAL_CONST(21201.293032858535/8.0), + REAL_CONST(21217.383568927453/8.0), + REAL_CONST(21233.477156202731/8.0), + REAL_CONST(21249.573793527841/8.0), + REAL_CONST(21265.673479747358/8.0), + REAL_CONST(21281.776213706937/8.0), + REAL_CONST(21297.881994253334/8.0), + REAL_CONST(21313.990820234398/8.0), + REAL_CONST(21330.102690499054/8.0), + REAL_CONST(21346.21760389733/8.0), + REAL_CONST(21362.335559280327/8.0), + REAL_CONST(21378.456555500241/8.0), + REAL_CONST(21394.580591410333/8.0), + REAL_CONST(21410.707665864964/8.0), + REAL_CONST(21426.83777771956/8.0), + REAL_CONST(21442.970925830628/8.0), + REAL_CONST(21459.107109055756/8.0), + REAL_CONST(21475.246326253604/8.0), + REAL_CONST(21491.388576283895/8.0), + REAL_CONST(21507.533858007431/8.0), + REAL_CONST(21523.682170286087/8.0), + REAL_CONST(21539.833511982797/8.0), + REAL_CONST(21555.987881961566/8.0), + REAL_CONST(21572.145279087465/8.0), + REAL_CONST(21588.305702226615/8.0), + REAL_CONST(21604.469150246216/8.0), + REAL_CONST(21620.635622014521/8.0), + REAL_CONST(21636.805116400832/8.0), + REAL_CONST(21652.977632275521/8.0), + REAL_CONST(21669.153168510009/8.0), + REAL_CONST(21685.331723976764/8.0), + REAL_CONST(21701.513297549318/8.0), + REAL_CONST(21717.697888102244/8.0), + REAL_CONST(21733.885494511167/8.0), + REAL_CONST(21750.076115652759/8.0), + REAL_CONST(21766.269750404736/8.0), + REAL_CONST(21782.466397645861/8.0), + REAL_CONST(21798.666056255934/8.0), + REAL_CONST(21814.868725115801/8.0), + REAL_CONST(21831.074403107345/8.0), + REAL_CONST(21847.283089113484/8.0), + REAL_CONST(21863.494782018177/8.0), + REAL_CONST(21879.709480706417/8.0), + REAL_CONST(21895.927184064229/8.0), + REAL_CONST(21912.147890978667/8.0), + REAL_CONST(21928.371600337818/8.0), + REAL_CONST(21944.598311030797/8.0), + REAL_CONST(21960.828021947746/8.0), + REAL_CONST(21977.060731979829/8.0), + REAL_CONST(21993.296440019243/8.0), + REAL_CONST(22009.535144959198/8.0), + REAL_CONST(22025.77684569393/8.0), + REAL_CONST(22042.021541118691/8.0), + REAL_CONST(22058.269230129757/8.0), + REAL_CONST(22074.519911624411/8.0), + REAL_CONST(22090.773584500959/8.0), + REAL_CONST(22107.030247658717/8.0), + REAL_CONST(22123.289899998013/8.0), + REAL_CONST(22139.552540420187/8.0), + REAL_CONST(22155.818167827587/8.0), + REAL_CONST(22172.086781123569/8.0), + REAL_CONST(22188.358379212495/8.0), + REAL_CONST(22204.632960999726/8.0), + REAL_CONST(22220.910525391639/8.0), + REAL_CONST(22237.191071295601/8.0), + REAL_CONST(22253.474597619981/8.0), + REAL_CONST(22269.761103274148/8.0), + REAL_CONST(22286.050587168469/8.0), + REAL_CONST(22302.343048214312/8.0), + REAL_CONST(22318.638485324027/8.0), + REAL_CONST(22334.936897410968/8.0), + REAL_CONST(22351.23828338947/8.0), + REAL_CONST(22367.542642174871/8.0), + REAL_CONST(22383.849972683485/8.0), + REAL_CONST(22400.160273832618/8.0), + REAL_CONST(22416.473544540564/8.0), + REAL_CONST(22432.789783726603/8.0), + REAL_CONST(22449.108990310986/8.0), + REAL_CONST(22465.431163214958/8.0), + REAL_CONST(22481.75630136074/8.0), + REAL_CONST(22498.084403671528/8.0), + REAL_CONST(22514.415469071497/8.0), + REAL_CONST(22530.749496485802/8.0), + REAL_CONST(22547.086484840562/8.0), + REAL_CONST(22563.426433062879/8.0), + REAL_CONST(22579.769340080824/8.0), + REAL_CONST(22596.115204823436/8.0), + REAL_CONST(22612.464026220721/8.0), + REAL_CONST(22628.815803203655/8.0), + REAL_CONST(22645.170534704179/8.0), + REAL_CONST(22661.5282196552/8.0), + REAL_CONST(22677.888856990587/8.0), + REAL_CONST(22694.252445645168/8.0), + REAL_CONST(22710.618984554734/8.0), + REAL_CONST(22726.988472656034/8.0), + REAL_CONST(22743.360908886778/8.0), + REAL_CONST(22759.736292185622/8.0), + REAL_CONST(22776.114621492186/8.0), + REAL_CONST(22792.495895747044/8.0), + REAL_CONST(22808.880113891719/8.0), + REAL_CONST(22825.267274868678/8.0), + REAL_CONST(22841.657377621348/8.0), + REAL_CONST(22858.050421094096/8.0), + REAL_CONST(22874.446404232243/8.0), + REAL_CONST(22890.845325982053/8.0), + REAL_CONST(22907.247185290722/8.0), + REAL_CONST(22923.651981106406/8.0), + REAL_CONST(22940.059712378195/8.0), + REAL_CONST(22956.470378056114/8.0), + REAL_CONST(22972.883977091129/8.0), + REAL_CONST(22989.300508435153/8.0), + REAL_CONST(23005.719971041017/8.0), + REAL_CONST(23022.142363862498/8.0), + REAL_CONST(23038.567685854305/8.0), + REAL_CONST(23054.995935972078/8.0), + REAL_CONST(23071.427113172387/8.0), + REAL_CONST(23087.86121641273/8.0), + REAL_CONST(23104.298244651531/8.0), + REAL_CONST(23120.738196848146/8.0), + REAL_CONST(23137.181071962848/8.0), + REAL_CONST(23153.626868956846/8.0), + REAL_CONST(23170.075586792263/8.0), + REAL_CONST(23186.527224432142/8.0), + REAL_CONST(23202.981780840448/8.0), + REAL_CONST(23219.439254982066/8.0), + REAL_CONST(23235.899645822796/8.0), + REAL_CONST(23252.362952329357/8.0), + REAL_CONST(23268.829173469378/8.0), + REAL_CONST(23285.298308211408/8.0), + REAL_CONST(23301.770355524899/8.0), + REAL_CONST(23318.245314380223/8.0), + REAL_CONST(23334.723183748658/8.0), + REAL_CONST(23351.203962602387/8.0), + REAL_CONST(23367.687649914504/8.0), + REAL_CONST(23384.174244659007/8.0), + REAL_CONST(23400.663745810798/8.0), + REAL_CONST(23417.15615234568/8.0), + REAL_CONST(23433.651463240367/8.0), + REAL_CONST(23450.149677472462/8.0), + REAL_CONST(23466.650794020472/8.0), + REAL_CONST(23483.154811863806/8.0), + REAL_CONST(23499.661729982763/8.0), + REAL_CONST(23516.171547358543/8.0), + REAL_CONST(23532.684262973235/8.0), + REAL_CONST(23549.199875809823/8.0), + REAL_CONST(23565.718384852185/8.0), + REAL_CONST(23582.239789085092/8.0), + REAL_CONST(23598.764087494197/8.0), + REAL_CONST(23615.291279066041/8.0), + REAL_CONST(23631.821362788058/8.0), + REAL_CONST(23648.354337648565/8.0), + REAL_CONST(23664.890202636761/8.0), + REAL_CONST(23681.428956742733/8.0), + REAL_CONST(23697.970598957443/8.0), + REAL_CONST(23714.515128272738/8.0), + REAL_CONST(23731.062543681343/8.0), + REAL_CONST(23747.612844176863/8.0), + REAL_CONST(23764.166028753778/8.0), + REAL_CONST(23780.72209640744/8.0), + REAL_CONST(23797.281046134085/8.0), + REAL_CONST(23813.842876930816/8.0), + REAL_CONST(23830.407587795606/8.0), + REAL_CONST(23846.975177727301/8.0), + REAL_CONST(23863.545645725622/8.0), + REAL_CONST(23880.11899079115/8.0), + REAL_CONST(23896.695211925336/8.0), + REAL_CONST(23913.274308130498/8.0), + REAL_CONST(23929.856278409821/8.0), + REAL_CONST(23946.441121767348/8.0), + REAL_CONST(23963.028837207989/8.0), + REAL_CONST(23979.619423737513/8.0), + REAL_CONST(23996.212880362549/8.0), + REAL_CONST(24012.809206090584/8.0), + REAL_CONST(24029.408399929966/8.0), + REAL_CONST(24046.010460889898/8.0), + REAL_CONST(24062.615387980433/8.0), + REAL_CONST(24079.223180212492/8.0), + REAL_CONST(24095.833836597827/8.0), + REAL_CONST(24112.447356149063/8.0), + REAL_CONST(24129.063737879667/8.0), + REAL_CONST(24145.682980803951/8.0), + REAL_CONST(24162.305083937081/8.0), + REAL_CONST(24178.930046295067/8.0), + REAL_CONST(24195.557866894767/8.0), + REAL_CONST(24212.188544753884/8.0), + REAL_CONST(24228.822078890964/8.0), + REAL_CONST(24245.458468325389/8.0), + REAL_CONST(24262.097712077397/8.0), + REAL_CONST(24278.739809168052/8.0), + REAL_CONST(24295.384758619261/8.0), + REAL_CONST(24312.032559453768/8.0), + REAL_CONST(24328.683210695162/8.0), + REAL_CONST(24345.336711367858/8.0), + REAL_CONST(24361.993060497109/8.0), + REAL_CONST(24378.652257108995/8.0), + REAL_CONST(24395.314300230442/8.0), + REAL_CONST(24411.979188889192/8.0), + REAL_CONST(24428.646922113825/8.0), + REAL_CONST(24445.317498933746/8.0), + REAL_CONST(24461.990918379193/8.0), + REAL_CONST(24478.667179481225/8.0), + REAL_CONST(24495.346281271726/8.0), + REAL_CONST(24512.028222783407/8.0), + REAL_CONST(24528.713003049801/8.0), + REAL_CONST(24545.400621105266/8.0), + REAL_CONST(24562.091075984976/8.0), + REAL_CONST(24578.784366724925/8.0), + REAL_CONST(24595.480492361927/8.0), + REAL_CONST(24612.179451933614/8.0), + REAL_CONST(24628.881244478438/8.0), + REAL_CONST(24645.585869035654/8.0), + REAL_CONST(24662.293324645343/8.0), + REAL_CONST(24679.003610348394/8.0), + REAL_CONST(24695.716725186514/8.0), + REAL_CONST(24712.432668202211/8.0), + REAL_CONST(24729.151438438807/8.0), + REAL_CONST(24745.873034940436/8.0), + REAL_CONST(24762.597456752032/8.0), + REAL_CONST(24779.324702919344/8.0), + REAL_CONST(24796.054772488926/8.0), + REAL_CONST(24812.787664508123/8.0), + REAL_CONST(24829.5233780251/8.0), + REAL_CONST(24846.261912088819/8.0), + REAL_CONST(24863.003265749034/8.0), + REAL_CONST(24879.747438056307/8.0), + REAL_CONST(24896.494428062004/8.0), + REAL_CONST(24913.244234818278/8.0), + REAL_CONST(24929.996857378079/8.0), + REAL_CONST(24946.752294795166/8.0), + REAL_CONST(24963.510546124078/8.0), + REAL_CONST(24980.271610420157/8.0), + REAL_CONST(24997.035486739525/8.0), + REAL_CONST(25013.802174139113/8.0), + REAL_CONST(25030.571671676629/8.0), + REAL_CONST(25047.343978410572/8.0), + REAL_CONST(25064.119093400237/8.0), + REAL_CONST(25080.897015705697/8.0), + REAL_CONST(25097.677744387816/8.0), + REAL_CONST(25114.461278508239/8.0), + REAL_CONST(25131.2476171294/8.0), + REAL_CONST(25148.036759314517/8.0), + REAL_CONST(25164.828704127583/8.0), + REAL_CONST(25181.623450633375/8.0), + REAL_CONST(25198.42099789745/8.0), + REAL_CONST(25215.221344986145/8.0), + REAL_CONST(25232.024490966574/8.0), + REAL_CONST(25248.830434906627/8.0), + REAL_CONST(25265.639175874974/8.0), + REAL_CONST(25282.450712941049/8.0), + REAL_CONST(25299.265045175071/8.0), + REAL_CONST(25316.082171648024/8.0), + REAL_CONST(25332.902091431668/8.0), + REAL_CONST(25349.724803598532/8.0), + REAL_CONST(25366.550307221914/8.0), + REAL_CONST(25383.378601375884/8.0), + REAL_CONST(25400.209685135269/8.0), + REAL_CONST(25417.043557575678/8.0), + REAL_CONST(25433.880217773472/8.0), + REAL_CONST(25450.719664805783/8.0), + REAL_CONST(25467.561897750507/8.0), + REAL_CONST(25484.406915686297/8.0), + REAL_CONST(25501.254717692573/8.0), + REAL_CONST(25518.105302849512/8.0), + REAL_CONST(25534.958670238051/8.0), + REAL_CONST(25551.814818939893/8.0), + REAL_CONST(25568.67374803748/8.0), + REAL_CONST(25585.535456614027/8.0), + REAL_CONST(25602.399943753502/8.0), + REAL_CONST(25619.267208540619/8.0), + REAL_CONST(25636.137250060852/8.0), + REAL_CONST(25653.010067400432/8.0), + REAL_CONST(25669.885659646327/8.0), + REAL_CONST(25686.76402588627/8.0), + REAL_CONST(25703.645165208734/8.0), + REAL_CONST(25720.529076702944/8.0), + REAL_CONST(25737.415759458876/8.0), + REAL_CONST(25754.305212567244/8.0), + REAL_CONST(25771.197435119517/8.0), + REAL_CONST(25788.092426207899/8.0), + REAL_CONST(25804.990184925344/8.0), + REAL_CONST(25821.890710365547/8.0), + REAL_CONST(25838.794001622944/8.0), + REAL_CONST(25855.700057792714/8.0), + REAL_CONST(25872.608877970775/8.0), + REAL_CONST(25889.520461253778/8.0), + REAL_CONST(25906.434806739118/8.0), + REAL_CONST(25923.351913524923/8.0), + REAL_CONST(25940.271780710063/8.0), + REAL_CONST(25957.194407394138/8.0), + REAL_CONST(25974.11979267748/8.0), + REAL_CONST(25991.047935661154/8.0), + REAL_CONST(26007.978835446964/8.0), + REAL_CONST(26024.912491137442/8.0), + REAL_CONST(26041.848901835841/8.0), + REAL_CONST(26058.788066646157/8.0), + REAL_CONST(26075.729984673108/8.0), + REAL_CONST(26092.674655022136/8.0), + REAL_CONST(26109.622076799409/8.0), + REAL_CONST(26126.572249111829/8.0), + REAL_CONST(26143.525171067016/8.0), + REAL_CONST(26160.480841773315/8.0), + REAL_CONST(26177.43926033979/8.0), + REAL_CONST(26194.400425876229/8.0), + REAL_CONST(26211.364337493149/8.0), + REAL_CONST(26228.330994301767/8.0), + REAL_CONST(26245.30039541404/8.0), + REAL_CONST(26262.272539942627/8.0), + REAL_CONST(26279.247427000919/8.0), + REAL_CONST(26296.225055703002/8.0), + REAL_CONST(26313.205425163702/8.0), + REAL_CONST(26330.188534498539/8.0), + REAL_CONST(26347.174382823756/8.0), + REAL_CONST(26364.162969256304/8.0), + REAL_CONST(26381.154292913852/8.0), + REAL_CONST(26398.148352914774/8.0), + REAL_CONST(26415.145148378149/8.0), + REAL_CONST(26432.144678423778/8.0), + REAL_CONST(26449.146942172156/8.0), + REAL_CONST(26466.151938744493/8.0), + REAL_CONST(26483.159667262702/8.0), + REAL_CONST(26500.170126849403/8.0), + REAL_CONST(26517.183316627921/8.0), + REAL_CONST(26534.199235722277/8.0), + REAL_CONST(26551.217883257199/8.0), + REAL_CONST(26568.239258358124/8.0), + REAL_CONST(26585.263360151173/8.0), + REAL_CONST(26602.290187763181/8.0), + REAL_CONST(26619.319740321676/8.0), + REAL_CONST(26636.352016954883/8.0), + REAL_CONST(26653.387016791727/8.0), + REAL_CONST(26670.424738961825/8.0), + REAL_CONST(26687.465182595493/8.0), + REAL_CONST(26704.508346823739/8.0), + REAL_CONST(26721.554230778267/8.0), + REAL_CONST(26738.602833591467/8.0), + REAL_CONST(26755.65415439643/8.0), + REAL_CONST(26772.708192326929/8.0), + REAL_CONST(26789.764946517433/8.0), + REAL_CONST(26806.824416103096/8.0), + REAL_CONST(26823.886600219761/8.0), + REAL_CONST(26840.95149800396/8.0), + REAL_CONST(26858.019108592915/8.0), + REAL_CONST(26875.089431124517/8.0), + REAL_CONST(26892.162464737365/8.0), + REAL_CONST(26909.238208570721/8.0), + REAL_CONST(26926.316661764544/8.0), + REAL_CONST(26943.397823459472/8.0), + REAL_CONST(26960.481692796813/8.0), + REAL_CONST(26977.568268918571/8.0), + REAL_CONST(26994.657550967422/8.0), + REAL_CONST(27011.749538086722/8.0), + REAL_CONST(27028.844229420498/8.0), + REAL_CONST(27045.941624113464/8.0), + REAL_CONST(27063.041721311005/8.0), + REAL_CONST(27080.144520159181/8.0), + REAL_CONST(27097.250019804727/8.0), + REAL_CONST(27114.35821939505/8.0), + REAL_CONST(27131.469118078236/8.0), + REAL_CONST(27148.582715003027/8.0), + REAL_CONST(27165.699009318858/8.0), + REAL_CONST(27182.818000175819/8.0), + REAL_CONST(27199.939686724665/8.0), + REAL_CONST(27217.064068116837/8.0), + REAL_CONST(27234.191143504428/8.0), + REAL_CONST(27251.320912040203/8.0), + REAL_CONST(27268.453372877593/8.0), + REAL_CONST(27285.588525170693/8.0), + REAL_CONST(27302.726368074269/8.0), + REAL_CONST(27319.866900743735/8.0), + REAL_CONST(27337.010122335181/8.0), + REAL_CONST(27354.156032005358/8.0), + REAL_CONST(27371.304628911668/8.0), + REAL_CONST(27388.455912212183/8.0), + REAL_CONST(27405.609881065626/8.0), + REAL_CONST(27422.766534631384/8.0), + REAL_CONST(27439.925872069507/8.0), + REAL_CONST(27457.087892540683/8.0), + REAL_CONST(27474.252595206275/8.0), + REAL_CONST(27491.419979228293/8.0), + REAL_CONST(27508.5900437694/8.0), + REAL_CONST(27525.762787992917/8.0), + REAL_CONST(27542.93821106281/8.0), + REAL_CONST(27560.116312143706/8.0), + REAL_CONST(27577.297090400876/8.0), + REAL_CONST(27594.480545000242/8.0), + REAL_CONST(27611.666675108383/8.0), + REAL_CONST(27628.855479892518/8.0), + REAL_CONST(27646.046958520514/8.0), + REAL_CONST(27663.241110160889/8.0), + REAL_CONST(27680.437933982801/8.0), + REAL_CONST(27697.637429156068/8.0), + REAL_CONST(27714.839594851132/8.0), + REAL_CONST(27732.04443023909/8.0), + REAL_CONST(27749.251934491687/8.0), + REAL_CONST(27766.462106781299/8.0), + REAL_CONST(27783.674946280949/8.0), + REAL_CONST(27800.890452164302/8.0), + REAL_CONST(27818.108623605654/8.0), + REAL_CONST(27835.329459779954/8.0), + REAL_CONST(27852.55295986278/8.0), + REAL_CONST(27869.779123030345/8.0), + REAL_CONST(27887.007948459504/8.0), + REAL_CONST(27904.239435327745/8.0), + REAL_CONST(27921.473582813196/8.0), + REAL_CONST(27938.710390094613/8.0), + REAL_CONST(27955.949856351392/8.0), + REAL_CONST(27973.19198076355/8.0), + REAL_CONST(27990.436762511745/8.0), + REAL_CONST(28007.684200777272/8.0), + REAL_CONST(28024.934294742041/8.0), + REAL_CONST(28042.187043588601/8.0), + REAL_CONST(28059.442446500128/8.0), + REAL_CONST(28076.700502660427/8.0), + REAL_CONST(28093.961211253929/8.0), + REAL_CONST(28111.224571465693/8.0), + REAL_CONST(28128.490582481401/8.0), + REAL_CONST(28145.759243487362/8.0), + REAL_CONST(28163.030553670509/8.0), + REAL_CONST(28180.304512218394/8.0), + REAL_CONST(28197.581118319198/8.0), + REAL_CONST(28214.860371161725/8.0), + REAL_CONST(28232.14226993539/8.0), + REAL_CONST(28249.42681383024/8.0), + REAL_CONST(28266.71400203693/8.0), + REAL_CONST(28284.003833746745/8.0), + REAL_CONST(28301.296308151585/8.0), + REAL_CONST(28318.591424443959/8.0), + REAL_CONST(28335.889181817001/8.0), + REAL_CONST(28353.189579464462/8.0), + REAL_CONST(28370.492616580705/8.0), + REAL_CONST(28387.798292360701/8.0), + REAL_CONST(28405.106606000048/8.0), + REAL_CONST(28422.417556694945/8.0), + REAL_CONST(28439.731143642206/8.0), + REAL_CONST(28457.047366039264/8.0), + REAL_CONST(28474.366223084147/8.0), + REAL_CONST(28491.687713975512/8.0), + REAL_CONST(28509.011837912611/8.0), + REAL_CONST(28526.338594095305/8.0), + REAL_CONST(28543.667981724069/8.0), + REAL_CONST(28560.999999999982/8.0), + REAL_CONST(28578.334648124732/8.0), + REAL_CONST(28595.671925300605/8.0), + REAL_CONST(28613.011830730498/8.0), + REAL_CONST(28630.354363617909/8.0), + REAL_CONST(28647.699523166943/8.0), + REAL_CONST(28665.0473085823/8.0), + REAL_CONST(28682.397719069289/8.0), + REAL_CONST(28699.750753833818/8.0), + REAL_CONST(28717.10641208239/8.0), + REAL_CONST(28734.464693022121/8.0), + REAL_CONST(28751.825595860708/8.0), + REAL_CONST(28769.189119806462/8.0), + REAL_CONST(28786.55526406828/8.0), + REAL_CONST(28803.924027855664/8.0), + REAL_CONST(28821.295410378701/8.0), + REAL_CONST(28838.669410848088/8.0), + REAL_CONST(28856.046028475103/8.0), + REAL_CONST(28873.425262471628/8.0), + REAL_CONST(28890.80711205013/8.0), + REAL_CONST(28908.191576423673/8.0), + REAL_CONST(28925.578654805915/8.0), + REAL_CONST(28942.968346411097/8.0), + REAL_CONST(28960.360650454055/8.0), + REAL_CONST(28977.755566150216/8.0), + REAL_CONST(28995.153092715591/8.0), + REAL_CONST(29012.553229366786/8.0), + REAL_CONST(29029.955975320987/8.0), + REAL_CONST(29047.361329795975/8.0), + REAL_CONST(29064.769292010107/8.0), + REAL_CONST(29082.179861182336/8.0), + REAL_CONST(29099.593036532187/8.0), + REAL_CONST(29117.00881727978/8.0), + REAL_CONST(29134.427202645813/8.0), + REAL_CONST(29151.848191851568/8.0), + REAL_CONST(29169.271784118911/8.0), + REAL_CONST(29186.697978670283/8.0), + REAL_CONST(29204.126774728706/8.0), + REAL_CONST(29221.55817151779/8.0), + REAL_CONST(29238.992168261717/8.0), + REAL_CONST(29256.42876418525/8.0), + REAL_CONST(29273.867958513725/8.0), + REAL_CONST(29291.309750473058/8.0), + REAL_CONST(29308.754139289747/8.0), + REAL_CONST(29326.201124190855/8.0), + REAL_CONST(29343.65070440403/8.0), + REAL_CONST(29361.102879157483/8.0), + REAL_CONST(29378.557647680012/8.0), + REAL_CONST(29396.015009200975/8.0), + REAL_CONST(29413.474962950309/8.0), + REAL_CONST(29430.937508158524/8.0), + REAL_CONST(29448.402644056692/8.0), + REAL_CONST(29465.870369876469/8.0), + REAL_CONST(29483.340684850071/8.0), + REAL_CONST(29500.81358821028/8.0), + REAL_CONST(29518.289079190454/8.0), + REAL_CONST(29535.767157024511/8.0), + REAL_CONST(29553.247820946945/8.0), + REAL_CONST(29570.731070192807/8.0), + REAL_CONST(29588.216903997723/8.0), + REAL_CONST(29605.70532159787/8.0), + REAL_CONST(29623.19632223/8.0), + REAL_CONST(29640.689905131429/8.0), + REAL_CONST(29658.186069540028/8.0), + REAL_CONST(29675.684814694236/8.0), + REAL_CONST(29693.186139833047/8.0), + REAL_CONST(29710.690044196028/8.0), + REAL_CONST(29728.196527023298/8.0), + REAL_CONST(29745.705587555527/8.0), + REAL_CONST(29763.217225033964/8.0), + REAL_CONST(29780.731438700397/8.0), + REAL_CONST(29798.248227797183/8.0), + REAL_CONST(29815.76759156723/8.0), + REAL_CONST(29833.289529254005/8.0), + REAL_CONST(29850.81404010153/8.0), + REAL_CONST(29868.341123354381/8.0), + REAL_CONST(29885.870778257693/8.0), + REAL_CONST(29903.403004057145/8.0), + REAL_CONST(29920.937799998974/8.0), + REAL_CONST(29938.475165329975/8.0), + REAL_CONST(29956.015099297485/8.0), + REAL_CONST(29973.557601149394/8.0), + REAL_CONST(29991.102670134147/8.0), + REAL_CONST(30008.650305500738/8.0), + REAL_CONST(30026.200506498706/8.0), + REAL_CONST(30043.753272378144/8.0), + REAL_CONST(30061.308602389683/8.0), + REAL_CONST(30078.866495784507/8.0), + REAL_CONST(30096.426951814352/8.0), + REAL_CONST(30113.989969731494/8.0), + REAL_CONST(30131.55554878875/8.0), + REAL_CONST(30149.123688239491/8.0), + REAL_CONST(30166.694387337629/8.0), + REAL_CONST(30184.267645337608/8.0), + REAL_CONST(30201.843461494434/8.0), + REAL_CONST(30219.42183506364/8.0), + REAL_CONST(30237.002765301309/8.0), + REAL_CONST(30254.586251464058/8.0), + REAL_CONST(30272.172292809046/8.0), + REAL_CONST(30289.760888593977/8.0), + REAL_CONST(30307.35203807709/8.0), + REAL_CONST(30324.94574051716/8.0), + REAL_CONST(30342.541995173502/8.0), + REAL_CONST(30360.140801305966/8.0), + REAL_CONST(30377.742158174944/8.0), + REAL_CONST(30395.346065041358/8.0), + REAL_CONST(30412.952521166666/8.0), + REAL_CONST(30430.561525812864/8.0), + REAL_CONST(30448.173078242475/8.0), + REAL_CONST(30465.787177718561/8.0), + REAL_CONST(30483.403823504719/8.0), + REAL_CONST(30501.02301486507/8.0), + REAL_CONST(30518.644751064272/8.0), + REAL_CONST(30536.269031367516/8.0), + REAL_CONST(30553.895855040515/8.0), + REAL_CONST(30571.525221349519/8.0), + REAL_CONST(30589.157129561307/8.0), + REAL_CONST(30606.791578943175/8.0), + REAL_CONST(30624.428568762964/8.0), + REAL_CONST(30642.06809828903/8.0), + REAL_CONST(30659.710166790261/8.0), + REAL_CONST(30677.35477353607/8.0), + REAL_CONST(30695.001917796391/8.0), + REAL_CONST(30712.651598841687/8.0), + REAL_CONST(30730.303815942945/8.0), + REAL_CONST(30747.958568371676/8.0), + REAL_CONST(30765.615855399912/8.0), + REAL_CONST(30783.275676300211/8.0), + REAL_CONST(30800.938030345646/8.0), + REAL_CONST(30818.602916809814/8.0), + REAL_CONST(30836.270334966837/8.0), + REAL_CONST(30853.940284091354/8.0), + REAL_CONST(30871.612763458521/8.0), + REAL_CONST(30889.287772344011/8.0), + REAL_CONST(30906.965310024025/8.0), + REAL_CONST(30924.645375775272/8.0), + REAL_CONST(30942.327968874983/8.0), + REAL_CONST(30960.013088600903/8.0), + REAL_CONST(30977.700734231294/8.0), + REAL_CONST(30995.390905044929/8.0), + REAL_CONST(31013.083600321101/8.0), + REAL_CONST(31030.778819339619/8.0), + REAL_CONST(31048.476561380798/8.0), + REAL_CONST(31066.17682572547/8.0), + REAL_CONST(31083.879611654978/8.0), + REAL_CONST(31101.584918451179/8.0), + REAL_CONST(31119.29274539644/8.0), + REAL_CONST(31137.003091773637/8.0), + REAL_CONST(31154.715956866155/8.0), + REAL_CONST(31172.431339957893/8.0), + REAL_CONST(31190.14924033326/8.0), + REAL_CONST(31207.869657277162/8.0), + REAL_CONST(31225.592590075023/8.0), + REAL_CONST(31243.318038012771/8.0), + REAL_CONST(31261.046000376838/8.0), + REAL_CONST(31278.776476454172/8.0), + REAL_CONST(31296.50946553221/8.0), + REAL_CONST(31314.24496689891/8.0), + REAL_CONST(31331.98297984272/8.0), + REAL_CONST(31349.7235036526/8.0), + REAL_CONST(31367.466537618013/8.0), + REAL_CONST(31385.212081028923/8.0), + REAL_CONST(31402.960133175795/8.0), + REAL_CONST(31420.710693349596/8.0), + REAL_CONST(31438.463760841791/8.0), + REAL_CONST(31456.219334944351/8.0), + REAL_CONST(31473.977414949743/8.0), + REAL_CONST(31491.738000150934/8.0), + REAL_CONST(31509.501089841389/8.0), + REAL_CONST(31527.266683315069/8.0), + REAL_CONST(31545.034779866437/8.0), + REAL_CONST(31562.80537879045/8.0), + REAL_CONST(31580.578479382562/8.0), + REAL_CONST(31598.35408093872/8.0), + REAL_CONST(31616.132182755369/8.0), + REAL_CONST(31633.91278412945/8.0), + REAL_CONST(31651.695884358396/8.0), + REAL_CONST(31669.481482740131/8.0), + REAL_CONST(31687.269578573076/8.0), + REAL_CONST(31705.060171156143/8.0), + REAL_CONST(31722.853259788735/8.0), + REAL_CONST(31740.648843770748/8.0), + REAL_CONST(31758.446922402567/8.0), + REAL_CONST(31776.247494985066/8.0), + REAL_CONST(31794.050560819614/8.0), + REAL_CONST(31811.85611920806/8.0), + REAL_CONST(31829.664169452753/8.0), + REAL_CONST(31847.474710856521/8.0), + REAL_CONST(31865.287742722685/8.0), + REAL_CONST(31883.103264355046/8.0), + REAL_CONST(31900.921275057899/8.0), + REAL_CONST(31918.741774136019/8.0), + REAL_CONST(31936.564760894671/8.0), + REAL_CONST(31954.390234639599/8.0), + REAL_CONST(31972.21819467704/8.0), + REAL_CONST(31990.048640313704/8.0), + REAL_CONST(32007.881570856793/8.0), + REAL_CONST(32025.716985613984/8.0), + REAL_CONST(32043.554883893445/8.0), + REAL_CONST(32061.395265003815/8.0), + REAL_CONST(32079.238128254223/8.0), + REAL_CONST(32097.083472954269/8.0), + REAL_CONST(32114.931298414049/8.0), + REAL_CONST(32132.781603944117/8.0), + REAL_CONST(32150.634388855524/8.0), + REAL_CONST(32168.48965245979/8.0), + REAL_CONST(32186.347394068915/8.0), + REAL_CONST(32204.207612995371/8.0), + REAL_CONST(32222.07030855212/8.0), + REAL_CONST(32239.935480052583/8.0), + REAL_CONST(32257.803126810672/8.0), + REAL_CONST(32275.673248140767/8.0), + REAL_CONST(32293.545843357719/8.0), + REAL_CONST(32311.420911776862/8.0), + REAL_CONST(32329.298452713996/8.0), + REAL_CONST(32347.178465485395/8.0), + REAL_CONST(32365.060949407813/8.0), + REAL_CONST(32382.945903798463/8.0), + REAL_CONST(32400.83332797504/8.0), + REAL_CONST(32418.723221255706/8.0), + REAL_CONST(32436.615582959093/8.0), + REAL_CONST(32454.510412404306/8.0), + REAL_CONST(32472.407708910916/8.0), + REAL_CONST(32490.307471798966/8.0), + REAL_CONST(32508.209700388961/8.0), + REAL_CONST(32526.114394001877/8.0), + REAL_CONST(32544.021551959166/8.0), + REAL_CONST(32561.931173582732/8.0), + REAL_CONST(32579.843258194956/8.0), + REAL_CONST(32597.757805118679/8.0), + REAL_CONST(32615.674813677211/8.0), + REAL_CONST(32633.594283194328/8.0), + REAL_CONST(32651.516212994258/8.0), + REAL_CONST(32669.440602401712/8.0), + REAL_CONST(32687.367450741847/8.0), + REAL_CONST(32705.296757340297/8.0), + REAL_CONST(32723.228521523146/8.0), + REAL_CONST(32741.162742616943/8.0), + REAL_CONST(32759.099419948703/8.0), + REAL_CONST(32777.038552845901/8.0), + REAL_CONST(32794.980140636464/8.0), + REAL_CONST(32812.924182648792/8.0), + REAL_CONST(32830.87067821173/8.0), + REAL_CONST(32848.819626654593/8.0), + REAL_CONST(32866.77102730715/8.0), + REAL_CONST(32884.724879499619/8.0), + REAL_CONST(32902.681182562686/8.0), + REAL_CONST(32920.639935827494/8.0), + REAL_CONST(32938.601138625643/8.0), + REAL_CONST(32956.56479028918/8.0), + REAL_CONST(32974.530890150607/8.0), + REAL_CONST(32992.499437542894/8.0), + REAL_CONST(33010.470431799447/8.0), + REAL_CONST(33028.443872254145/8.0), + REAL_CONST(33046.419758241311/8.0), + REAL_CONST(33064.39808909571/8.0), + REAL_CONST(33082.378864152583/8.0), + REAL_CONST(33100.36208274759/8.0), + REAL_CONST(33118.347744216881/8.0), + REAL_CONST(33136.335847897026/8.0), + REAL_CONST(33154.326393125062/8.0), + REAL_CONST(33172.31937923847/8.0), + REAL_CONST(33190.314805575174/8.0), + REAL_CONST(33208.312671473555/8.0), + REAL_CONST(33226.312976272442/8.0), + REAL_CONST(33244.315719311111/8.0), + REAL_CONST(33262.320899929284/8.0), + REAL_CONST(33280.328517467125/8.0), + REAL_CONST(33298.33857126526/8.0), + REAL_CONST(33316.351060664747/8.0), + REAL_CONST(33334.365985007091/8.0), + REAL_CONST(33352.383343634239/8.0), + REAL_CONST(33370.403135888591/8.0), + REAL_CONST(33388.42536111299/8.0), + REAL_CONST(33406.450018650721/8.0), + REAL_CONST(33424.477107845501/8.0), + REAL_CONST(33442.506628041512/8.0), + REAL_CONST(33460.53857858335/8.0), + REAL_CONST(33478.572958816083/8.0), + REAL_CONST(33496.609768085189/8.0), + REAL_CONST(33514.649005736617/8.0), + REAL_CONST(33532.690671116739/8.0), + REAL_CONST(33550.734763572356/8.0), + REAL_CONST(33568.781282450735/8.0), + REAL_CONST(33586.830227099563/8.0), + REAL_CONST(33604.881596866973/8.0), + REAL_CONST(33622.935391101528/8.0), + REAL_CONST(33640.991609152239/8.0), + REAL_CONST(33659.050250368542/8.0), + REAL_CONST(33677.111314100322/8.0), + REAL_CONST(33695.174799697881/8.0), + REAL_CONST(33713.240706511984/8.0), + REAL_CONST(33731.309033893805/8.0), + REAL_CONST(33749.37978119497/8.0), + REAL_CONST(33767.452947767531/8.0), + REAL_CONST(33785.528532963974/8.0), + REAL_CONST(33803.606536137209/8.0), + REAL_CONST(33821.686956640602/8.0), + REAL_CONST(33839.769793827938/8.0), + REAL_CONST(33857.855047053425/8.0), + REAL_CONST(33875.942715671707/8.0), + REAL_CONST(33894.032799037872/8.0), + REAL_CONST(33912.125296507431/8.0), + REAL_CONST(33930.220207436316/8.0), + REAL_CONST(33948.317531180888/8.0), + REAL_CONST(33966.417267097961/8.0), + REAL_CONST(33984.519414544746/8.0), + REAL_CONST(34002.623972878901/8.0), + REAL_CONST(34020.730941458511/8.0), + REAL_CONST(34038.840319642077/8.0), + REAL_CONST(34056.952106788536/8.0), + REAL_CONST(34075.066302257255/8.0), + REAL_CONST(34093.182905408015/8.0), + REAL_CONST(34111.301915601027/8.0), + REAL_CONST(34129.42333219693/8.0), + REAL_CONST(34147.547154556785/8.0), + REAL_CONST(34165.673382042078/8.0), + REAL_CONST(34183.80201401472/8.0), + REAL_CONST(34201.933049837033/8.0), + REAL_CONST(34220.06648887178/8.0), + REAL_CONST(34238.202330482141/8.0), + REAL_CONST(34256.340574031703/8.0), + REAL_CONST(34274.481218884495/8.0), + REAL_CONST(34292.624264404949/8.0), + REAL_CONST(34310.769709957938/8.0), + REAL_CONST(34328.91755490873/8.0), + REAL_CONST(34347.067798623029/8.0), + REAL_CONST(34365.220440466954/8.0), + REAL_CONST(34383.375479807051/8.0), + REAL_CONST(34401.532916010263/8.0), + REAL_CONST(34419.692748443973/8.0), + REAL_CONST(34437.854976475966/8.0), + REAL_CONST(34456.01959947445/8.0), + REAL_CONST(34474.18661680806/8.0), + REAL_CONST(34492.356027845817/8.0), + REAL_CONST(34510.527831957188/8.0), + REAL_CONST(34528.702028512052/8.0), + REAL_CONST(34546.878616880676/8.0), + REAL_CONST(34565.05759643377/8.0), + REAL_CONST(34583.238966542449/8.0), + REAL_CONST(34601.422726578232/8.0), + REAL_CONST(34619.608875913065/8.0), + REAL_CONST(34637.797413919296/8.0), + REAL_CONST(34655.988339969692/8.0), + REAL_CONST(34674.181653437423/8.0), + REAL_CONST(34692.37735369608/8.0), + REAL_CONST(34710.575440119668/8.0), + REAL_CONST(34728.775912082579/8.0), + REAL_CONST(34746.978768959649/8.0), + REAL_CONST(34765.184010126082/8.0), + REAL_CONST(34783.391634957537/8.0), + REAL_CONST(34801.60164283005/8.0), + REAL_CONST(34819.814033120063/8.0), + REAL_CONST(34838.028805204456/8.0), + REAL_CONST(34856.24595846048/8.0), + REAL_CONST(34874.465492265823/8.0), + REAL_CONST(34892.687405998557/8.0), + REAL_CONST(34910.911699037177/8.0), + REAL_CONST(34929.138370760564/8.0), + REAL_CONST(34947.367420548027/8.0), + REAL_CONST(34965.598847779271/8.0), + REAL_CONST(34983.832651834389/8.0), + REAL_CONST(35002.068832093908/8.0), + REAL_CONST(35020.307387938738/8.0), + REAL_CONST(35038.548318750189/8.0), + REAL_CONST(35056.79162390998/8.0), + REAL_CONST(35075.03730280025/8.0), + REAL_CONST(35093.285354803513/8.0), + REAL_CONST(35111.535779302685/8.0), + REAL_CONST(35129.788575681116/8.0), + REAL_CONST(35148.043743322516/8.0), + REAL_CONST(35166.301281611013/8.0), + REAL_CONST(35184.561189931141/8.0), + REAL_CONST(35202.823467667826/8.0), + REAL_CONST(35221.088114206388/8.0), + REAL_CONST(35239.355128932555/8.0), + REAL_CONST(35257.624511232447/8.0), + REAL_CONST(35275.896260492584/8.0), + REAL_CONST(35294.170376099886/8.0), + REAL_CONST(35312.446857441668/8.0), + REAL_CONST(35330.725703905628/8.0), + REAL_CONST(35349.006914879887/8.0), + REAL_CONST(35367.290489752944/8.0), + REAL_CONST(35385.576427913686/8.0), + REAL_CONST(35403.864728751418/8.0), + REAL_CONST(35422.155391655811/8.0), + REAL_CONST(35440.448416016967/8.0), + REAL_CONST(35458.743801225341/8.0), + REAL_CONST(35477.041546671804/8.0), + REAL_CONST(35495.341651747622/8.0), + REAL_CONST(35513.644115844436/8.0), + REAL_CONST(35531.948938354304/8.0), + REAL_CONST(35550.256118669655/8.0), + REAL_CONST(35568.565656183309/8.0), + REAL_CONST(35586.877550288496/8.0), + REAL_CONST(35605.191800378816/8.0), + REAL_CONST(35623.508405848268/8.0), + REAL_CONST(35641.827366091238/8.0), + REAL_CONST(35660.148680502505/8.0), + REAL_CONST(35678.472348477233/8.0), + REAL_CONST(35696.798369410979/8.0), + REAL_CONST(35715.126742699678/8.0), + REAL_CONST(35733.457467739659/8.0), + REAL_CONST(35751.790543927644/8.0), + REAL_CONST(35770.125970660738/8.0), + REAL_CONST(35788.46374733642/8.0), + REAL_CONST(35806.803873352568/8.0), + REAL_CONST(35825.146348107453/8.0), + REAL_CONST(35843.49117099971/8.0), + REAL_CONST(35861.838341428367/8.0), + REAL_CONST(35880.187858792851/8.0), + REAL_CONST(35898.539722492955/8.0), + REAL_CONST(35916.893931928862/8.0), + REAL_CONST(35935.250486501129/8.0), + REAL_CONST(35953.609385610718/8.0), + REAL_CONST(35971.970628658957/8.0), + REAL_CONST(35990.334215047558/8.0), + REAL_CONST(36008.700144178612/8.0), + REAL_CONST(36027.068415454596/8.0), + REAL_CONST(36045.439028278372/8.0), + REAL_CONST(36063.811982053165/8.0), + REAL_CONST(36082.187276182609/8.0), + REAL_CONST(36100.564910070694/8.0), + REAL_CONST(36118.944883121789/8.0), + REAL_CONST(36137.327194740654/8.0), + REAL_CONST(36155.711844332429/8.0), + REAL_CONST(36174.098831302617/8.0), + REAL_CONST(36192.488155057115/8.0), + REAL_CONST(36210.87981500219/8.0), + REAL_CONST(36229.273810544473/8.0), + REAL_CONST(36247.670141091003/8.0), + REAL_CONST(36266.068806049167/8.0), + REAL_CONST(36284.469804826738/8.0), + REAL_CONST(36302.873136831862/8.0), + REAL_CONST(36321.278801473069/8.0), + REAL_CONST(36339.686798159251/8.0), + REAL_CONST(36358.097126299683/8.0), + REAL_CONST(36376.509785304013/8.0), + REAL_CONST(36394.924774582258/8.0), + REAL_CONST(36413.342093544816/8.0), + REAL_CONST(36431.761741602444/8.0), + REAL_CONST(36450.183718166292/8.0), + REAL_CONST(36468.608022647859/8.0), + REAL_CONST(36487.034654459028/8.0), + REAL_CONST(36505.463613012063/8.0), + REAL_CONST(36523.894897719583/8.0), + REAL_CONST(36542.328507994578/8.0), + REAL_CONST(36560.764443250409/8.0), + REAL_CONST(36579.202702900831/8.0), + REAL_CONST(36597.643286359926/8.0), + REAL_CONST(36616.086193042182/8.0), + REAL_CONST(36634.531422362437/8.0), + REAL_CONST(36652.978973735895/8.0), + REAL_CONST(36671.428846578143/8.0), + REAL_CONST(36689.881040305125/8.0), + REAL_CONST(36708.335554333149/8.0), + REAL_CONST(36726.792388078902/8.0), + REAL_CONST(36745.251540959427/8.0), + REAL_CONST(36763.713012392138/8.0), + REAL_CONST(36782.176801794812/8.0), + REAL_CONST(36800.642908585593/8.0), + REAL_CONST(36819.111332182983/8.0), + REAL_CONST(36837.582072005869/8.0), + REAL_CONST(36856.055127473483/8.0), + REAL_CONST(36874.530498005421/8.0), + REAL_CONST(36893.008183021651/8.0), + REAL_CONST(36911.488181942506/8.0), + REAL_CONST(36929.970494188674/8.0), + REAL_CONST(36948.455119181206/8.0), + REAL_CONST(36966.942056341519/8.0), + REAL_CONST(36985.431305091392/8.0), + REAL_CONST(37003.922864852961/8.0), + REAL_CONST(37022.416735048733/8.0), + REAL_CONST(37040.912915101559/8.0), + REAL_CONST(37059.411404434657/8.0), + REAL_CONST(37077.91220247162/8.0), + REAL_CONST(37096.415308636388/8.0), + REAL_CONST(37114.920722353243/8.0), + REAL_CONST(37133.428443046862/8.0), + REAL_CONST(37151.938470142253/8.0), + REAL_CONST(37170.450803064785/8.0), + REAL_CONST(37188.965441240209/8.0), + REAL_CONST(37207.482384094597/8.0), + REAL_CONST(37226.001631054402/8.0), + REAL_CONST(37244.523181546429/8.0), + REAL_CONST(37263.047034997842/8.0), + REAL_CONST(37281.573190836149/8.0), + REAL_CONST(37300.101648489224/8.0), + REAL_CONST(37318.632407385296/8.0), + REAL_CONST(37337.165466952945/8.0), + REAL_CONST(37355.700826621112/8.0), + REAL_CONST(37374.238485819085/8.0), + REAL_CONST(37392.778443976509/8.0), + REAL_CONST(37411.320700523385/8.0), + REAL_CONST(37429.865254890057/8.0), + REAL_CONST(37448.412106507232/8.0), + REAL_CONST(37466.961254805974/8.0), + REAL_CONST(37485.512699217681/8.0), + REAL_CONST(37504.066439174116/8.0), + REAL_CONST(37522.622474107404/8.0), + REAL_CONST(37541.180803449992/8.0), + REAL_CONST(37559.741426634704/8.0), + REAL_CONST(37578.304343094693/8.0), + REAL_CONST(37596.869552263488/8.0), + REAL_CONST(37615.43705357494/8.0), + REAL_CONST(37634.006846463279/8.0), + REAL_CONST(37652.578930363044/8.0), + REAL_CONST(37671.153304709165/8.0), + REAL_CONST(37689.729968936896/8.0), + REAL_CONST(37708.308922481847/8.0), + REAL_CONST(37726.890164779965/8.0), + REAL_CONST(37745.473695267559/8.0), + REAL_CONST(37764.059513381275/8.0), + REAL_CONST(37782.647618558112/8.0), + REAL_CONST(37801.238010235415/8.0), + REAL_CONST(37819.830687850859/8.0), + REAL_CONST(37838.425650842495/8.0), + REAL_CONST(37857.022898648691/8.0), + REAL_CONST(37875.622430708172/8.0), + REAL_CONST(37894.224246460013/8.0), + REAL_CONST(37912.828345343616/8.0), + REAL_CONST(37931.434726798747/8.0), + REAL_CONST(37950.043390265506/8.0), + REAL_CONST(37968.654335184328/8.0), + REAL_CONST(37987.267560995999/8.0), + REAL_CONST(38005.883067141665/8.0), + REAL_CONST(38024.500853062775/8.0), + REAL_CONST(38043.120918201159/8.0), + REAL_CONST(38061.743261998963/8.0), + REAL_CONST(38080.367883898682/8.0), + REAL_CONST(38098.994783343158/8.0), + REAL_CONST(38117.623959775563/8.0), + REAL_CONST(38136.255412639417/8.0), + REAL_CONST(38154.889141378575/8.0), + REAL_CONST(38173.525145437234/8.0), + REAL_CONST(38192.163424259939/8.0), + REAL_CONST(38210.803977291551/8.0), + REAL_CONST(38229.446803977284/8.0), + REAL_CONST(38248.091903762703/8.0), + REAL_CONST(38266.739276093685/8.0), + REAL_CONST(38285.388920416466/8.0), + REAL_CONST(38304.040836177606/8.0), + REAL_CONST(38322.695022824002/8.0), + REAL_CONST(38341.351479802899/8.0), + REAL_CONST(38360.010206561863/8.0), + REAL_CONST(38378.671202548816/8.0), + REAL_CONST(38397.334467211993/8.0), + REAL_CONST(38415.999999999978/8.0), + REAL_CONST(38434.667800361683/8.0), + REAL_CONST(38453.33786774637/8.0), + REAL_CONST(38472.010201603611/8.0), + REAL_CONST(38490.684801383337/8.0), + REAL_CONST(38509.361666535784/8.0), + REAL_CONST(38528.040796511552/8.0), + REAL_CONST(38546.722190761553/8.0), + REAL_CONST(38565.405848737035/8.0), + REAL_CONST(38584.091769889594/8.0), + REAL_CONST(38602.779953671132/8.0), + REAL_CONST(38621.470399533908/8.0), + REAL_CONST(38640.163106930493/8.0), + REAL_CONST(38658.858075313794/8.0), + REAL_CONST(38677.555304137059/8.0), + REAL_CONST(38696.254792853862/8.0), + REAL_CONST(38714.956540918094/8.0), + REAL_CONST(38733.660547783991/8.0), + REAL_CONST(38752.366812906112/8.0), + REAL_CONST(38771.075335739348/8.0), + REAL_CONST(38789.78611573892/8.0), + REAL_CONST(38808.499152360368/8.0), + REAL_CONST(38827.214445059573/8.0), + REAL_CONST(38845.931993292739/8.0), + REAL_CONST(38864.651796516388/8.0), + REAL_CONST(38883.373854187383/8.0), + REAL_CONST(38902.098165762916/8.0), + REAL_CONST(38920.824730700486/8.0), + REAL_CONST(38939.553548457938/8.0), + REAL_CONST(38958.284618493431/8.0), + REAL_CONST(38977.017940265461/8.0), + REAL_CONST(38995.753513232834/8.0), + REAL_CONST(39014.491336854699/8.0), + REAL_CONST(39033.231410590517/8.0), + REAL_CONST(39051.973733900079/8.0), + REAL_CONST(39070.718306243485/8.0), + REAL_CONST(39089.465127081188/8.0), + REAL_CONST(39108.214195873945/8.0), + REAL_CONST(39126.965512082832/8.0), + REAL_CONST(39145.719075169261/8.0), + REAL_CONST(39164.474884594965/8.0), + REAL_CONST(39183.232939821988/8.0), + REAL_CONST(39201.99324031271/8.0), + REAL_CONST(39220.755785529815/8.0), + REAL_CONST(39239.52057493633/8.0), + REAL_CONST(39258.287607995589/8.0), + REAL_CONST(39277.056884171245/8.0), + REAL_CONST(39295.828402927284/8.0), + REAL_CONST(39314.602163728006/8.0), + REAL_CONST(39333.378166038019/8.0), + REAL_CONST(39352.15640932227/8.0), + REAL_CONST(39370.936893046004/8.0), + REAL_CONST(39389.719616674811/8.0), + REAL_CONST(39408.504579674584/8.0), + REAL_CONST(39427.291781511522/8.0), + REAL_CONST(39446.081221652174/8.0), + REAL_CONST(39464.872899563372/8.0), + REAL_CONST(39483.666814712291/8.0), + REAL_CONST(39502.462966566411/8.0), + REAL_CONST(39521.261354593538/8.0), + REAL_CONST(39540.06197826178/8.0), + REAL_CONST(39558.864837039568/8.0), + REAL_CONST(39577.669930395656/8.0), + REAL_CONST(39596.47725779911/8.0), + REAL_CONST(39615.286818719302/8.0), + REAL_CONST(39634.098612625923/8.0), + REAL_CONST(39652.912638988993/8.0), + REAL_CONST(39671.728897278823/8.0), + REAL_CONST(39690.547386966064/8.0), + REAL_CONST(39709.368107521652/8.0), + REAL_CONST(39728.191058416858/8.0), + REAL_CONST(39747.016239123259/8.0), + REAL_CONST(39765.84364911275/8.0), + REAL_CONST(39784.673287857528/8.0), + REAL_CONST(39803.505154830105/8.0), + REAL_CONST(39822.339249503319/8.0), + REAL_CONST(39841.175571350293/8.0), + REAL_CONST(39860.014119844491/8.0), + REAL_CONST(39878.854894459677/8.0), + REAL_CONST(39897.697894669909/8.0), + REAL_CONST(39916.54311994958/8.0), + REAL_CONST(39935.390569773372/8.0), + REAL_CONST(39954.240243616303/8.0), + REAL_CONST(39973.092140953675/8.0), + REAL_CONST(39991.946261261117/8.0), + REAL_CONST(40010.802604014549/8.0), + REAL_CONST(40029.661168690225/8.0), + REAL_CONST(40048.521954764678/8.0), + REAL_CONST(40067.384961714779/8.0), + REAL_CONST(40086.250189017679/8.0), + REAL_CONST(40105.117636150855/8.0), + REAL_CONST(40123.98730259209/8.0), + REAL_CONST(40142.859187819471/8.0), + REAL_CONST(40161.733291311379/8.0), + REAL_CONST(40180.609612546526/8.0), + REAL_CONST(40199.488151003912/8.0), + REAL_CONST(40218.368906162854/8.0), + REAL_CONST(40237.25187750296/8.0), + REAL_CONST(40256.137064504153/8.0), + REAL_CONST(40275.024466646668/8.0), + REAL_CONST(40293.914083411029/8.0), + REAL_CONST(40312.805914278084/8.0), + REAL_CONST(40331.699958728961/8.0), + REAL_CONST(40350.596216245103/8.0), + REAL_CONST(40369.494686308273/8.0), + REAL_CONST(40388.39536840051/8.0), + REAL_CONST(40407.298262004173/8.0), + REAL_CONST(40426.20336660192/8.0), + REAL_CONST(40445.110681676706/8.0), + REAL_CONST(40464.020206711793/8.0), + REAL_CONST(40482.931941190756/8.0), + REAL_CONST(40501.845884597446/8.0), + REAL_CONST(40520.762036416032/8.0), + REAL_CONST(40539.680396130985/8.0), + REAL_CONST(40558.600963227072/8.0), + REAL_CONST(40577.523737189367/8.0), + REAL_CONST(40596.448717503234/8.0), + REAL_CONST(40615.375903654342/8.0), + REAL_CONST(40634.305295128659/8.0), + REAL_CONST(40653.236891412453/8.0), + REAL_CONST(40672.170691992294/8.0), + REAL_CONST(40691.106696355047/8.0), + REAL_CONST(40710.044903987873/8.0), + REAL_CONST(40728.985314378238/8.0), + REAL_CONST(40747.927927013901/8.0), + REAL_CONST(40766.872741382918/8.0), + REAL_CONST(40785.819756973651/8.0), + REAL_CONST(40804.768973274746/8.0), + REAL_CONST(40823.720389775161/8.0), + REAL_CONST(40842.674005964131/8.0), + REAL_CONST(40861.629821331211/8.0), + REAL_CONST(40880.587835366234/8.0), + REAL_CONST(40899.548047559321/8.0), + REAL_CONST(40918.510457400931/8.0), + REAL_CONST(40937.475064381761/8.0), + REAL_CONST(40956.441867992849/8.0), + REAL_CONST(40975.410867725499/8.0), + REAL_CONST(40994.382063071331/8.0), + REAL_CONST(41013.355453522236/8.0), + REAL_CONST(41032.331038570417/8.0), + REAL_CONST(41051.308817708363/8.0), + REAL_CONST(41070.288790428858/8.0), + REAL_CONST(41089.270956224987/8.0), + REAL_CONST(41108.255314590111/8.0), + REAL_CONST(41127.241865017888/8.0), + REAL_CONST(41146.23060700229/8.0), + REAL_CONST(41165.221540037543/8.0), + REAL_CONST(41184.214663618193/8.0), + REAL_CONST(41203.209977239079/8.0), + REAL_CONST(41222.207480395307/8.0), + REAL_CONST(41241.207172582297/8.0), + REAL_CONST(41260.209053295752/8.0), + REAL_CONST(41279.213122031659/8.0), + REAL_CONST(41298.219378286303/8.0), + REAL_CONST(41317.227821556255/8.0), + REAL_CONST(41336.23845133838/8.0), + REAL_CONST(41355.251267129832/8.0), + REAL_CONST(41374.266268428037/8.0), + REAL_CONST(41393.283454730743/8.0), + REAL_CONST(41412.302825535953/8.0), + REAL_CONST(41431.324380341983/8.0), + REAL_CONST(41450.348118647416/8.0), + REAL_CONST(41469.374039951144/8.0), + REAL_CONST(41488.402143752326/8.0), + REAL_CONST(41507.432429550427/8.0), + REAL_CONST(41526.464896845187/8.0), + REAL_CONST(41545.499545136627/8.0), + REAL_CONST(41564.536373925075/8.0), + REAL_CONST(41583.575382711126/8.0), + REAL_CONST(41602.616570995662/8.0), + REAL_CONST(41621.659938279874/8.0), + REAL_CONST(41640.705484065205/8.0), + REAL_CONST(41659.753207853406/8.0), + REAL_CONST(41678.803109146495/8.0), + REAL_CONST(41697.855187446803/8.0), + REAL_CONST(41716.909442256911/8.0), + REAL_CONST(41735.965873079709/8.0), + REAL_CONST(41755.02447941836/8.0), + REAL_CONST(41774.085260776315/8.0), + REAL_CONST(41793.148216657297/8.0), + REAL_CONST(41812.213346565331/8.0), + REAL_CONST(41831.280650004708/8.0), + REAL_CONST(41850.350126480014/8.0), + REAL_CONST(41869.421775496106/8.0), + REAL_CONST(41888.495596558132/8.0), + REAL_CONST(41907.571589171515/8.0), + REAL_CONST(41926.649752841957/8.0), + REAL_CONST(41945.730087075463/8.0), + REAL_CONST(41964.812591378286/8.0), + REAL_CONST(41983.897265256979/8.0), + REAL_CONST(42002.984108218378/8.0), + REAL_CONST(42022.073119769593/8.0), + REAL_CONST(42041.164299418015/8.0), + REAL_CONST(42060.257646671307/8.0), + REAL_CONST(42079.353161037419/8.0), + REAL_CONST(42098.450842024591/8.0), + REAL_CONST(42117.550689141324/8.0), + REAL_CONST(42136.652701896404/8.0), + REAL_CONST(42155.756879798893/8.0), + REAL_CONST(42174.863222358137/8.0), + REAL_CONST(42193.971729083758/8.0), + REAL_CONST(42213.082399485655/8.0), + REAL_CONST(42232.195233074002/8.0), + REAL_CONST(42251.310229359246/8.0), + REAL_CONST(42270.427387852127/8.0), + REAL_CONST(42289.546708063644/8.0), + REAL_CONST(42308.668189505079/8.0), + REAL_CONST(42327.791831687995/8.0), + REAL_CONST(42346.917634124227/8.0), + REAL_CONST(42366.045596325886/8.0), + REAL_CONST(42385.175717805352/8.0), + REAL_CONST(42404.307998075295/8.0), + REAL_CONST(42423.442436648642/8.0), + REAL_CONST(42442.579033038608/8.0), + REAL_CONST(42461.717786758672/8.0), + REAL_CONST(42480.858697322597/8.0), + REAL_CONST(42500.001764244422/8.0), + REAL_CONST(42519.146987038446/8.0), + REAL_CONST(42538.294365219248/8.0), + REAL_CONST(42557.443898301688/8.0), + REAL_CONST(42576.595585800882/8.0), + REAL_CONST(42595.749427232236/8.0), + REAL_CONST(42614.90542211142/8.0), + REAL_CONST(42634.063569954378/8.0), + REAL_CONST(42653.223870277317/8.0), + REAL_CONST(42672.386322596729/8.0), + REAL_CONST(42691.55092642938/8.0), + REAL_CONST(42710.717681292292/8.0), + REAL_CONST(42729.886586702756/8.0), + REAL_CONST(42749.057642178363/8.0), + REAL_CONST(42768.23084723694/8.0), + REAL_CONST(42787.406201396603/8.0), + REAL_CONST(42806.58370417574/8.0), + REAL_CONST(42825.76335509299/8.0), + REAL_CONST(42844.945153667286/8.0), + REAL_CONST(42864.129099417805/8.0), + REAL_CONST(42883.315191864014/8.0), + REAL_CONST(42902.503430525649/8.0), + REAL_CONST(42921.693814922692/8.0), + REAL_CONST(42940.88634457541/8.0), + REAL_CONST(42960.081019004348/8.0), + REAL_CONST(42979.277837730297/8.0), + REAL_CONST(42998.476800274322/8.0), + REAL_CONST(43017.677906157769/8.0), + REAL_CONST(43036.881154902228/8.0), + REAL_CONST(43056.086546029583/8.0), + REAL_CONST(43075.294079061961/8.0), + REAL_CONST(43094.503753521763/8.0), + REAL_CONST(43113.715568931671/8.0), + REAL_CONST(43132.929524814601/8.0), + REAL_CONST(43152.145620693766/8.0), + REAL_CONST(43171.363856092619/8.0), + REAL_CONST(43190.584230534907/8.0), + REAL_CONST(43209.806743544621/8.0), + REAL_CONST(43229.031394646016/8.0), + REAL_CONST(43248.258183363621/8.0), + REAL_CONST(43267.487109222224/8.0), + REAL_CONST(43286.718171746885/8.0), + REAL_CONST(43305.951370462906/8.0), + REAL_CONST(43325.186704895881/8.0), + REAL_CONST(43344.42417457165/8.0), + REAL_CONST(43363.663779016322/8.0), + REAL_CONST(43382.905517756262/8.0), + REAL_CONST(43402.149390318104/8.0), + REAL_CONST(43421.395396228749/8.0), + REAL_CONST(43440.643535015348/8.0), + REAL_CONST(43459.89380620532/8.0), + REAL_CONST(43479.146209326354/8.0), + REAL_CONST(43498.400743906379/8.0), + REAL_CONST(43517.657409473606/8.0), + REAL_CONST(43536.916205556496/8.0), + REAL_CONST(43556.177131683784/8.0), + REAL_CONST(43575.44018738444/8.0), + REAL_CONST(43594.705372187724/8.0), + REAL_CONST(43613.972685623135/8.0), + REAL_CONST(43633.242127220445/8.0), + REAL_CONST(43652.513696509668/8.0), + REAL_CONST(43671.787393021099/8.0), + REAL_CONST(43691.063216285271/8.0), + REAL_CONST(43710.341165833001/8.0), + REAL_CONST(43729.621241195346/8.0), + REAL_CONST(43748.903441903625/8.0), + REAL_CONST(43768.187767489413/8.0), + REAL_CONST(43787.474217484552/8.0), + REAL_CONST(43806.762791421126/8.0), + REAL_CONST(43826.053488831501/8.0), + REAL_CONST(43845.346309248278/8.0), + REAL_CONST(43864.641252204325/8.0), + REAL_CONST(43883.938317232765/8.0), + REAL_CONST(43903.237503866971/8.0), + REAL_CONST(43922.538811640596/8.0), + REAL_CONST(43941.842240087513/8.0), + REAL_CONST(43961.147788741881/8.0), + REAL_CONST(43980.455457138101/8.0), + REAL_CONST(43999.765244810835/8.0), + REAL_CONST(44019.077151295001/8.0), + REAL_CONST(44038.391176125755/8.0), + REAL_CONST(44057.70731883854/8.0), + REAL_CONST(44077.02557896902/8.0), + REAL_CONST(44096.345956053141/8.0), + REAL_CONST(44115.668449627083/8.0), + REAL_CONST(44134.993059227287/8.0), + REAL_CONST(44154.319784390456/8.0), + REAL_CONST(44173.648624653535/8.0), + REAL_CONST(44192.979579553728/8.0), + REAL_CONST(44212.312648628489/8.0), + REAL_CONST(44231.647831415532/8.0), + REAL_CONST(44250.985127452805/8.0), + REAL_CONST(44270.324536278538/8.0), + REAL_CONST(44289.666057431183/8.0), + REAL_CONST(44309.009690449464/8.0), + REAL_CONST(44328.355434872348/8.0), + REAL_CONST(44347.703290239064/8.0), + REAL_CONST(44367.053256089079/8.0), + REAL_CONST(44386.405331962109/8.0), + REAL_CONST(44405.759517398139/8.0), + REAL_CONST(44425.115811937387/8.0), + REAL_CONST(44444.474215120332/8.0), + REAL_CONST(44463.834726487694/8.0), + REAL_CONST(44483.197345580462/8.0), + REAL_CONST(44502.562071939843/8.0), + REAL_CONST(44521.928905107328/8.0), + REAL_CONST(44541.297844624634/8.0), + REAL_CONST(44560.668890033732/8.0), + REAL_CONST(44580.042040876848/8.0), + REAL_CONST(44599.417296696454/8.0), + REAL_CONST(44618.794657035272/8.0), + REAL_CONST(44638.174121436256/8.0), + REAL_CONST(44657.555689442641/8.0), + REAL_CONST(44676.939360597877/8.0), + REAL_CONST(44696.325134445673/8.0), + REAL_CONST(44715.713010530002/8.0), + REAL_CONST(44735.102988395054/8.0), + REAL_CONST(44754.495067585296/8.0), + REAL_CONST(44773.88924764542/8.0), + REAL_CONST(44793.285528120374/8.0), + REAL_CONST(44812.683908555344/8.0), + REAL_CONST(44832.084388495779/8.0), + REAL_CONST(44851.486967487363/8.0), + REAL_CONST(44870.891645076015/8.0), + REAL_CONST(44890.298420807922/8.0), + REAL_CONST(44909.707294229491/8.0), + REAL_CONST(44929.118264887409/8.0), + REAL_CONST(44948.531332328566/8.0), + REAL_CONST(44967.946496100136/8.0), + REAL_CONST(44987.363755749502/8.0), + REAL_CONST(45006.783110824319/8.0), + REAL_CONST(45026.204560872473/8.0), + REAL_CONST(45045.628105442098/8.0), + REAL_CONST(45065.053744081561/8.0), + REAL_CONST(45084.48147633949/8.0), + REAL_CONST(45103.911301764747/8.0), + REAL_CONST(45123.343219906426/8.0), + REAL_CONST(45142.777230313885/8.0), + REAL_CONST(45162.21333253671/8.0), + REAL_CONST(45181.651526124733/8.0), + REAL_CONST(45201.091810628037/8.0), + REAL_CONST(45220.534185596924/8.0), + REAL_CONST(45239.978650581965/8.0), + REAL_CONST(45259.425205133957/8.0), + REAL_CONST(45278.873848803938/8.0), + REAL_CONST(45298.324581143192/8.0), + REAL_CONST(45317.777401703235/8.0), + REAL_CONST(45337.232310035848/8.0), + REAL_CONST(45356.68930569302/8.0), + REAL_CONST(45376.148388226997/8.0), + REAL_CONST(45395.60955719027/8.0), + REAL_CONST(45415.072812135557/8.0), + REAL_CONST(45434.538152615823/8.0), + REAL_CONST(45454.005578184282/8.0), + REAL_CONST(45473.475088394356/8.0), + REAL_CONST(45492.946682799746/8.0), + REAL_CONST(45512.420360954362/8.0), + REAL_CONST(45531.896122412363/8.0), + REAL_CONST(45551.373966728155/8.0), + REAL_CONST(45570.853893456362/8.0), + REAL_CONST(45590.33590215187/8.0), + REAL_CONST(45609.819992369776/8.0), + REAL_CONST(45629.306163665438/8.0), + REAL_CONST(45648.794415594442/8.0), + REAL_CONST(45668.284747712612/8.0), + REAL_CONST(45687.777159576006/8.0), + REAL_CONST(45707.27165074092/8.0), + REAL_CONST(45726.768220763894/8.0), + REAL_CONST(45746.266869201696/8.0), + REAL_CONST(45765.767595611323/8.0), + REAL_CONST(45785.270399550034/8.0), + REAL_CONST(45804.775280575297/8.0), + REAL_CONST(45824.282238244828/8.0), + REAL_CONST(45843.79127211657/8.0), + REAL_CONST(45863.302381748719/8.0), + REAL_CONST(45882.815566699683/8.0), + REAL_CONST(45902.33082652813/8.0), + REAL_CONST(45921.848160792935/8.0), + REAL_CONST(45941.367569053225/8.0), + REAL_CONST(45960.889050868354/8.0), + REAL_CONST(45980.41260579793/8.0), + REAL_CONST(45999.938233401757/8.0), + REAL_CONST(46019.465933239902/8.0), + REAL_CONST(46038.995704872657/8.0), + REAL_CONST(46058.527547860547/8.0), + REAL_CONST(46078.06146176433/8.0), + REAL_CONST(46097.597446144995/8.0), + REAL_CONST(46117.135500563774/8.0), + REAL_CONST(46136.675624582109/8.0), + REAL_CONST(46156.217817761702/8.0), + REAL_CONST(46175.762079664462/8.0), + REAL_CONST(46195.308409852543/8.0), + REAL_CONST(46214.856807888333/8.0), + REAL_CONST(46234.407273334444/8.0), + REAL_CONST(46253.959805753715/8.0), + REAL_CONST(46273.51440470924/8.0), + REAL_CONST(46293.071069764315/8.0), + REAL_CONST(46312.629800482478/8.0), + REAL_CONST(46332.190596427499/8.0), + REAL_CONST(46351.753457163381/8.0), + REAL_CONST(46371.318382254351/8.0), + REAL_CONST(46390.885371264863/8.0), + REAL_CONST(46410.45442375962/8.0), + REAL_CONST(46430.025539303526/8.0), + REAL_CONST(46449.598717461733/8.0), + REAL_CONST(46469.17395779962/8.0), + REAL_CONST(46488.751259882782/8.0), + REAL_CONST(46508.33062327707/8.0), + REAL_CONST(46527.912047548532/8.0), + REAL_CONST(46547.495532263471/8.0), + REAL_CONST(46567.081076988397/8.0), + REAL_CONST(46586.668681290059/8.0), + REAL_CONST(46606.258344735434/8.0), + REAL_CONST(46625.850066891719/8.0), + REAL_CONST(46645.443847326351/8.0), + REAL_CONST(46665.039685606986/8.0), + REAL_CONST(46684.637581301497/8.0), + REAL_CONST(46704.237533978005/8.0), + REAL_CONST(46723.839543204842/8.0), + REAL_CONST(46743.443608550573/8.0), + REAL_CONST(46763.049729583989/8.0), + REAL_CONST(46782.657905874104/8.0), + REAL_CONST(46802.268136990162/8.0), + REAL_CONST(46821.880422501628/8.0), + REAL_CONST(46841.494761978196/8.0), + REAL_CONST(46861.111154989776/8.0), + REAL_CONST(46880.729601106526/8.0), + REAL_CONST(46900.350099898795/8.0), + REAL_CONST(46919.97265093719/8.0), + REAL_CONST(46939.597253792526/8.0), + REAL_CONST(46959.223908035841/8.0), + REAL_CONST(46978.852613238392/8.0), + REAL_CONST(46998.483368971691/8.0), + REAL_CONST(47018.11617480743/8.0), + REAL_CONST(47037.751030317551/8.0), + REAL_CONST(47057.387935074221/8.0), + REAL_CONST(47077.026888649809/8.0), + REAL_CONST(47096.66789061694/8.0), + REAL_CONST(47116.310940548428/8.0), + REAL_CONST(47135.956038017328/8.0), + REAL_CONST(47155.603182596918/8.0), + REAL_CONST(47175.252373860698/8.0), + REAL_CONST(47194.903611382375/8.0), + REAL_CONST(47214.556894735892/8.0), + REAL_CONST(47234.212223495422/8.0), + REAL_CONST(47253.869597235338/8.0), + REAL_CONST(47273.52901553025/8.0), + REAL_CONST(47293.19047795498/8.0), + REAL_CONST(47312.853984084577/8.0), + REAL_CONST(47332.519533494306/8.0), + REAL_CONST(47352.187125759658/8.0), + REAL_CONST(47371.856760456343/8.0), + REAL_CONST(47391.528437160297/8.0), + REAL_CONST(47411.202155447652/8.0), + REAL_CONST(47430.877914894787/8.0), + REAL_CONST(47450.555715078299/8.0), + REAL_CONST(47470.235555574982/8.0), + REAL_CONST(47489.917435961863/8.0), + REAL_CONST(47509.601355816201/8.0), + REAL_CONST(47529.287314715453/8.0), + REAL_CONST(47548.975312237308/8.0), + REAL_CONST(47568.665347959672/8.0), + REAL_CONST(47588.357421460656/8.0), + REAL_CONST(47608.051532318605/8.0), + REAL_CONST(47627.747680112072/8.0), + REAL_CONST(47647.445864419846/8.0), + REAL_CONST(47667.14608482091/8.0), + REAL_CONST(47686.848340894474/8.0), + REAL_CONST(47706.552632219973/8.0), + REAL_CONST(47726.258958377046/8.0), + REAL_CONST(47745.967318945557/8.0), + REAL_CONST(47765.677713505589/8.0), + REAL_CONST(47785.390141637428/8.0), + REAL_CONST(47805.104602921601/8.0), + REAL_CONST(47824.821096938824/8.0), + REAL_CONST(47844.539623270044/8.0), + REAL_CONST(47864.260181496429/8.0), + REAL_CONST(47883.982771199349/8.0), + REAL_CONST(47903.707391960394/8.0), + REAL_CONST(47923.434043361369/8.0), + REAL_CONST(47943.162724984308/8.0), + REAL_CONST(47962.893436411439/8.0), + REAL_CONST(47982.626177225218/8.0), + REAL_CONST(48002.36094700831/8.0), + REAL_CONST(48022.097745343599/8.0), + REAL_CONST(48041.836571814172/8.0), + REAL_CONST(48061.57742600335/8.0), + REAL_CONST(48081.32030749465/8.0), + REAL_CONST(48101.065215871815/8.0), + REAL_CONST(48120.81215071879/8.0), + REAL_CONST(48140.56111161974/8.0), + REAL_CONST(48160.312098159047/8.0), + REAL_CONST(48180.065109921306/8.0), + REAL_CONST(48199.820146491307/8.0), + REAL_CONST(48219.577207454073/8.0), + REAL_CONST(48239.336292394844/8.0), + REAL_CONST(48259.097400899045/8.0), + REAL_CONST(48278.860532552339/8.0), + REAL_CONST(48298.625686940592/8.0), + REAL_CONST(48318.392863649875/8.0), + REAL_CONST(48338.162062266485/8.0), + REAL_CONST(48357.933282376915/8.0), + REAL_CONST(48377.706523567889/8.0), + REAL_CONST(48397.481785426316/8.0), + REAL_CONST(48417.259067539344/8.0), + REAL_CONST(48437.038369494308/8.0), + REAL_CONST(48456.819690878765/8.0), + REAL_CONST(48476.603031280487/8.0), + REAL_CONST(48496.388390287451/8.0), + REAL_CONST(48516.175767487839/8.0), + REAL_CONST(48535.965162470042/8.0), + REAL_CONST(48555.756574822684/8.0), + REAL_CONST(48575.550004134566/8.0), + REAL_CONST(48595.345449994718/8.0), + REAL_CONST(48615.142911992378/8.0), + REAL_CONST(48634.942389716991/8.0), + REAL_CONST(48654.743882758201/8.0), + REAL_CONST(48674.547390705877/8.0), + REAL_CONST(48694.352913150084/8.0), + REAL_CONST(48714.160449681112/8.0), + REAL_CONST(48733.969999889443/8.0), + REAL_CONST(48753.781563365759/8.0), + REAL_CONST(48773.595139700978/8.0), + REAL_CONST(48793.410728486211/8.0), + REAL_CONST(48813.228329312769/8.0), + REAL_CONST(48833.047941772187/8.0), + REAL_CONST(48852.869565456189/8.0), + REAL_CONST(48872.693199956717/8.0), + REAL_CONST(48892.518844865925/8.0), + REAL_CONST(48912.346499776155/8.0), + REAL_CONST(48932.176164279976/8.0), + REAL_CONST(48952.007837970152/8.0), + REAL_CONST(48971.841520439666/8.0), + REAL_CONST(48991.677211281676/8.0), + REAL_CONST(49011.514910089587/8.0), + REAL_CONST(49031.354616456978/8.0), + REAL_CONST(49051.196329977654/8.0), + REAL_CONST(49071.04005024561/8.0), + REAL_CONST(49090.885776855059/8.0), + REAL_CONST(49110.733509400408/8.0), + REAL_CONST(49130.583247476279/8.0), + REAL_CONST(49150.434990677488/8.0), + REAL_CONST(49170.288738599062/8.0), + REAL_CONST(49190.144490836232/8.0), + REAL_CONST(49210.002246984441/8.0), + REAL_CONST(49229.86200663932/8.0), + REAL_CONST(49249.723769396718/8.0), + REAL_CONST(49269.587534852675/8.0), + REAL_CONST(49289.453302603448/8.0), + REAL_CONST(49309.32107224549/8.0), + REAL_CONST(49329.190843375451/8.0), + REAL_CONST(49349.062615590192/8.0), + REAL_CONST(49368.936388486785/8.0), + REAL_CONST(49388.812161662492/8.0), + REAL_CONST(49408.689934714785/8.0), + REAL_CONST(49428.569707241324/8.0), + REAL_CONST(49448.45147883999/8.0), + REAL_CONST(49468.335249108866/8.0), + REAL_CONST(49488.22101764621/8.0), + REAL_CONST(49508.108784050521/8.0), + REAL_CONST(49527.99854792047/8.0), + REAL_CONST(49547.890308854934/8.0), + REAL_CONST(49567.784066453009/8.0), + REAL_CONST(49587.679820313977/8.0), + REAL_CONST(49607.57757003732/8.0), + REAL_CONST(49627.477315222721/8.0), + REAL_CONST(49647.379055470075/8.0), + REAL_CONST(49667.28279037946/8.0), + REAL_CONST(49687.188519551179/8.0), + REAL_CONST(49707.096242585707/8.0), + REAL_CONST(49727.005959083741/8.0), + REAL_CONST(49746.917668646165/8.0), + REAL_CONST(49766.831370874068/8.0), + REAL_CONST(49786.747065368734/8.0), + REAL_CONST(49806.66475173166/8.0), + REAL_CONST(49826.584429564515/8.0), + REAL_CONST(49846.506098469203/8.0), + REAL_CONST(49866.429758047794/8.0), + REAL_CONST(49886.355407902578/8.0), + REAL_CONST(49906.283047636032/8.0), + REAL_CONST(49926.212676850846/8.0), + REAL_CONST(49946.144295149883/8.0), + REAL_CONST(49966.077902136225/8.0), + REAL_CONST(49986.013497413151/8.0), + REAL_CONST(50005.951080584135/8.0), + REAL_CONST(50025.890651252834/8.0), + REAL_CONST(50045.832209023123/8.0), + REAL_CONST(50065.775753499074/8.0), + REAL_CONST(50085.721284284933/8.0), + REAL_CONST(50105.668800985164/8.0), + REAL_CONST(50125.618303204428/8.0), + REAL_CONST(50145.569790547575/8.0), + REAL_CONST(50165.523262619652/8.0), + REAL_CONST(50185.478719025901/8.0), + REAL_CONST(50205.436159371769/8.0), + REAL_CONST(50225.395583262893/8.0), + REAL_CONST(50245.356990305103/8.0), + REAL_CONST(50265.320380104429/8.0), + REAL_CONST(50285.285752267104/8.0), + REAL_CONST(50305.253106399534/8.0), + REAL_CONST(50325.222442108337/8.0), + REAL_CONST(50345.193759000336/8.0), + REAL_CONST(50365.16705668252/8.0), + REAL_CONST(50385.142334762102/8.0), + REAL_CONST(50405.119592846473/8.0), + REAL_CONST(50425.098830543218/8.0), + REAL_CONST(50445.080047460127/8.0), + REAL_CONST(50465.063243205179/8.0), + REAL_CONST(50485.048417386541/8.0), + REAL_CONST(50505.035569612577/8.0), + REAL_CONST(50525.024699491856/8.0), + REAL_CONST(50545.015806633128/8.0), + REAL_CONST(50565.008890645338/8.0), + REAL_CONST(50585.003951137631/8.0), + REAL_CONST(50605.00098771933/8.0), + REAL_CONST(50624.999999999971/8.0), + REAL_CONST(50645.000987589265/8.0), + REAL_CONST(50665.003950097132/8.0), + REAL_CONST(50685.008887133677/8.0), + REAL_CONST(50705.015798309192/8.0), + REAL_CONST(50725.024683234165/8.0), + REAL_CONST(50745.035541519283/8.0), + REAL_CONST(50765.048372775411/8.0), + REAL_CONST(50785.063176613621/8.0), + REAL_CONST(50805.079952645159/8.0), + REAL_CONST(50825.098700481489/8.0), + REAL_CONST(50845.119419734241/8.0), + REAL_CONST(50865.142110015244/8.0), + REAL_CONST(50885.166770936521/8.0), + REAL_CONST(50905.193402110279/8.0), + REAL_CONST(50925.222003148934/8.0), + REAL_CONST(50945.252573665071/8.0), + REAL_CONST(50965.285113271471/8.0), + REAL_CONST(50985.319621581119/8.0), + REAL_CONST(51005.356098207172/8.0), + REAL_CONST(51025.394542762981/8.0), + REAL_CONST(51045.434954862096/8.0), + REAL_CONST(51065.477334118244/8.0), + REAL_CONST(51085.521680145357/8.0), + REAL_CONST(51105.567992557546/8.0), + REAL_CONST(51125.616270969113/8.0), + REAL_CONST(51145.66651499454/8.0), + REAL_CONST(51165.718724248516/8.0), + REAL_CONST(51185.772898345916/8.0), + REAL_CONST(51205.829036901778/8.0), + REAL_CONST(51225.887139531362/8.0), + REAL_CONST(51245.947205850105/8.0), + REAL_CONST(51266.009235473619/8.0), + REAL_CONST(51286.073228017718/8.0), + REAL_CONST(51306.139183098399/8.0), + REAL_CONST(51326.207100331856/8.0), + REAL_CONST(51346.276979334456/8.0), + REAL_CONST(51366.348819722756/8.0), + REAL_CONST(51386.42262111351/8.0), + REAL_CONST(51406.498383123653/8.0), + REAL_CONST(51426.57610537031/8.0), + REAL_CONST(51446.655787470787/8.0), + REAL_CONST(51466.737429042587/8.0), + REAL_CONST(51486.82102970338/8.0), + REAL_CONST(51506.906589071048/8.0), + REAL_CONST(51526.994106763632/8.0), + REAL_CONST(51547.083582399391/8.0), + REAL_CONST(51567.175015596738/8.0), + REAL_CONST(51587.268405974297/8.0), + REAL_CONST(51607.363753150858/8.0), + REAL_CONST(51627.461056745415/8.0), + REAL_CONST(51647.56031637713/8.0), + REAL_CONST(51667.661531665362/8.0), + REAL_CONST(51687.764702229651/8.0), + REAL_CONST(51707.869827689727/8.0), + REAL_CONST(51727.976907665499/8.0), + REAL_CONST(51748.085941777055/8.0), + REAL_CONST(51768.196929644677/8.0), + REAL_CONST(51788.309870888836/8.0), + REAL_CONST(51808.42476513017/8.0), + REAL_CONST(51828.541611989524/8.0), + REAL_CONST(51848.660411087905/8.0), + REAL_CONST(51868.781162046515/8.0), + REAL_CONST(51888.90386448674/8.0), + REAL_CONST(51909.028518030143/8.0), + REAL_CONST(51929.155122298485/8.0), + REAL_CONST(51949.283676913685/8.0), + REAL_CONST(51969.414181497872/8.0), + REAL_CONST(51989.546635673345/8.0), + REAL_CONST(52009.681039062583/8.0), + REAL_CONST(52029.817391288263/8.0), + REAL_CONST(52049.955691973213/8.0), + REAL_CONST(52070.095940740481/8.0), + REAL_CONST(52090.238137213273/8.0), + REAL_CONST(52110.382281014987/8.0), + REAL_CONST(52130.5283717692/8.0), + REAL_CONST(52150.676409099666/8.0), + REAL_CONST(52170.826392630333/8.0), + REAL_CONST(52190.97832198532/8.0), + REAL_CONST(52211.132196788931/8.0), + REAL_CONST(52231.288016665654/8.0), + REAL_CONST(52251.445781240145/8.0), + REAL_CONST(52271.60549013727/8.0), + REAL_CONST(52291.76714298204/8.0), + REAL_CONST(52311.930739399664/8.0), + REAL_CONST(52332.096279015546/8.0), + REAL_CONST(52352.263761455244/8.0), + REAL_CONST(52372.433186344519/8.0), + REAL_CONST(52392.604553309284/8.0), + REAL_CONST(52412.777861975665/8.0), + REAL_CONST(52432.953111969946/8.0), + REAL_CONST(52453.130302918595/8.0), + REAL_CONST(52473.309434448267/8.0), + REAL_CONST(52493.490506185793/8.0), + REAL_CONST(52513.67351775818/8.0), + REAL_CONST(52533.858468792605/8.0), + REAL_CONST(52554.045358916446/8.0), + REAL_CONST(52574.234187757254/8.0), + REAL_CONST(52594.42495494274/8.0), + REAL_CONST(52614.617660100812/8.0), + REAL_CONST(52634.812302859558/8.0), + REAL_CONST(52655.008882847229/8.0), + REAL_CONST(52675.20739969227/8.0), + REAL_CONST(52695.407853023295/8.0), + REAL_CONST(52715.610242469098/8.0), + REAL_CONST(52735.814567658657/8.0), + REAL_CONST(52756.02082822111/8.0), + REAL_CONST(52776.229023785803/8.0), + REAL_CONST(52796.439153982225/8.0), + REAL_CONST(52816.651218440056/8.0), + REAL_CONST(52836.865216789171/8.0), + REAL_CONST(52857.081148659599/8.0), + REAL_CONST(52877.29901368155/8.0), + REAL_CONST(52897.518811485425/8.0), + REAL_CONST(52917.740541701773/8.0), + REAL_CONST(52937.964203961354/8.0), + REAL_CONST(52958.18979789508/8.0), + REAL_CONST(52978.417323134046/8.0), + REAL_CONST(52998.646779309529/8.0), + REAL_CONST(53018.878166052978/8.0), + REAL_CONST(53039.111482996006/8.0), + REAL_CONST(53059.346729770419/8.0), + REAL_CONST(53079.583906008193/8.0), + REAL_CONST(53099.823011341483/8.0), + REAL_CONST(53120.0640454026/8.0), + REAL_CONST(53140.307007824063/8.0), + REAL_CONST(53160.551898238533/8.0), + REAL_CONST(53180.79871627887/8.0), + REAL_CONST(53201.047461578091/8.0), + REAL_CONST(53221.2981337694/8.0), + REAL_CONST(53241.550732486176/8.0), + REAL_CONST(53261.805257361964/8.0), + REAL_CONST(53282.061708030487/8.0), + REAL_CONST(53302.32008412564/8.0), + REAL_CONST(53322.580385281493/8.0), + REAL_CONST(53342.842611132299/8.0), + REAL_CONST(53363.106761312469/8.0), + REAL_CONST(53383.372835456597/8.0), + REAL_CONST(53403.640833199453/8.0), + REAL_CONST(53423.910754175973/8.0), + REAL_CONST(53444.18259802126/8.0), + REAL_CONST(53464.456364370613/8.0), + REAL_CONST(53484.732052859479/8.0), + REAL_CONST(53505.009663123499/8.0), + REAL_CONST(53525.289194798468/8.0), + REAL_CONST(53545.570647520362/8.0), + REAL_CONST(53565.854020925333/8.0), + REAL_CONST(53586.139314649699/8.0), + REAL_CONST(53606.426528329954/8.0), + REAL_CONST(53626.715661602764/8.0), + REAL_CONST(53647.006714104959/8.0), + REAL_CONST(53667.299685473547/8.0), + REAL_CONST(53687.59457534572/8.0), + REAL_CONST(53707.891383358816/8.0), + REAL_CONST(53728.190109150361/8.0), + REAL_CONST(53748.490752358055/8.0), + REAL_CONST(53768.793312619753/8.0), + REAL_CONST(53789.09778957349/8.0), + REAL_CONST(53809.404182857485/8.0), + REAL_CONST(53829.712492110106/8.0), + REAL_CONST(53850.022716969899/8.0), + REAL_CONST(53870.334857075584/8.0), + REAL_CONST(53890.648912066055/8.0), + REAL_CONST(53910.964881580367/8.0), + REAL_CONST(53931.28276525774/8.0), + REAL_CONST(53951.602562737586/8.0), + REAL_CONST(53971.924273659461/8.0), + REAL_CONST(53992.24789766311/8.0), + REAL_CONST(54012.57343438844/8.0), + REAL_CONST(54032.90088347553/8.0), + REAL_CONST(54053.23024456462/8.0), + REAL_CONST(54073.561517296133/8.0), + REAL_CONST(54093.894701310644/8.0), + REAL_CONST(54114.22979624891/8.0), + REAL_CONST(54134.566801751855/8.0), + REAL_CONST(54154.90571746057/8.0), + REAL_CONST(54175.246543016314/8.0), + REAL_CONST(54195.589278060506/8.0), + REAL_CONST(54215.933922234755/8.0), + REAL_CONST(54236.280475180814/8.0), + REAL_CONST(54256.628936540626/8.0), + REAL_CONST(54276.97930595628/8.0), + REAL_CONST(54297.331583070045/8.0), + REAL_CONST(54317.685767524359/8.0), + REAL_CONST(54338.041858961828/8.0), + REAL_CONST(54358.399857025215/8.0), + REAL_CONST(54378.759761357462/8.0), + REAL_CONST(54399.121571601667/8.0), + REAL_CONST(54419.485287401105/8.0), + REAL_CONST(54439.850908399218/8.0), + REAL_CONST(54460.218434239614/8.0), + REAL_CONST(54480.587864566056/8.0), + REAL_CONST(54500.95919902248/8.0), + REAL_CONST(54521.332437252997/8.0), + REAL_CONST(54541.707578901878/8.0), + REAL_CONST(54562.084623613555/8.0), + REAL_CONST(54582.46357103264/8.0), + REAL_CONST(54602.844420803893/8.0), + REAL_CONST(54623.227172572246/8.0), + REAL_CONST(54643.611825982807/8.0), + REAL_CONST(54663.998380680838/8.0), + REAL_CONST(54684.386836311773/8.0), + REAL_CONST(54704.777192521207/8.0), + REAL_CONST(54725.169448954897/8.0), + REAL_CONST(54745.563605258772/8.0), + REAL_CONST(54765.959661078923/8.0), + REAL_CONST(54786.357616061614/8.0), + REAL_CONST(54806.757469853255/8.0), + REAL_CONST(54827.159222100439/8.0), + REAL_CONST(54847.562872449904/8.0), + REAL_CONST(54867.968420548583/8.0), + REAL_CONST(54888.375866043534/8.0), + REAL_CONST(54908.785208582012/8.0), + REAL_CONST(54929.196447811417/8.0), + REAL_CONST(54949.609583379322/8.0), + REAL_CONST(54970.024614933463/8.0), + REAL_CONST(54990.441542121727/8.0), + REAL_CONST(55010.86036459219/8.0), + REAL_CONST(55031.28108199306/8.0), + REAL_CONST(55051.703693972733/8.0), + REAL_CONST(55072.128200179759/8.0), + REAL_CONST(55092.554600262847/8.0), + REAL_CONST(55112.982893870874/8.0), + REAL_CONST(55133.413080652877/8.0), + REAL_CONST(55153.845160258061/8.0), + REAL_CONST(55174.279132335789/8.0), + REAL_CONST(55194.714996535586/8.0), + REAL_CONST(55215.152752507143/8.0), + REAL_CONST(55235.592399900306/8.0), + REAL_CONST(55256.033938365079/8.0), + REAL_CONST(55276.477367551655/8.0), + REAL_CONST(55296.92268711036/8.0), + REAL_CONST(55317.369896691685/8.0), + REAL_CONST(55337.818995946305/8.0), + REAL_CONST(55358.269984525024/8.0), + REAL_CONST(55378.72286207883/8.0), + REAL_CONST(55399.177628258869/8.0), + REAL_CONST(55419.634282716441/8.0), + REAL_CONST(55440.092825103013/8.0), + REAL_CONST(55460.553255070205/8.0), + REAL_CONST(55481.015572269804/8.0), + REAL_CONST(55501.479776353764/8.0), + REAL_CONST(55521.945866974187/8.0), + REAL_CONST(55542.413843783339/8.0), + REAL_CONST(55562.883706433655/8.0), + REAL_CONST(55583.355454577715/8.0), + REAL_CONST(55603.82908786826/8.0), + REAL_CONST(55624.304605958219/8.0), + REAL_CONST(55644.782008500639/8.0), + REAL_CONST(55665.261295148754/8.0), + REAL_CONST(55685.742465555952/8.0), + REAL_CONST(55706.225519375774/8.0), + REAL_CONST(55726.710456261928/8.0), + REAL_CONST(55747.197275868275/8.0), + REAL_CONST(55767.685977848843/8.0), + REAL_CONST(55788.176561857814/8.0), + REAL_CONST(55808.669027549528/8.0), + REAL_CONST(55829.163374578478/8.0), + REAL_CONST(55849.659602599328/8.0), + REAL_CONST(55870.157711266889/8.0), + REAL_CONST(55890.657700236145/8.0), + REAL_CONST(55911.159569162221/8.0), + REAL_CONST(55931.663317700411/8.0), + REAL_CONST(55952.168945506164/8.0), + REAL_CONST(55972.676452235086/8.0), + REAL_CONST(55993.185837542944/8.0), + REAL_CONST(56013.697101085651/8.0), + REAL_CONST(56034.210242519301/8.0), + REAL_CONST(56054.72526150012/8.0), + REAL_CONST(56075.242157684508/8.0), + REAL_CONST(56095.760930729011/8.0), + REAL_CONST(56116.281580290342/8.0), + REAL_CONST(56136.804106025367/8.0), + REAL_CONST(56157.328507591104/8.0), + REAL_CONST(56177.85478464474/8.0), + REAL_CONST(56198.382936843598/8.0), + REAL_CONST(56218.912963845185/8.0), + REAL_CONST(56239.444865307138/8.0), + REAL_CONST(56259.978640887268/8.0), + REAL_CONST(56280.514290243525/8.0), + REAL_CONST(56301.051813034042/8.0), + REAL_CONST(56321.591208917082/8.0), + REAL_CONST(56342.13247755108/8.0), + REAL_CONST(56362.675618594607/8.0), + REAL_CONST(56383.220631706419/8.0), + REAL_CONST(56403.767516545398/8.0), + REAL_CONST(56424.316272770608/8.0), + REAL_CONST(56444.866900041241/8.0), + REAL_CONST(56465.419398016667/8.0), + REAL_CONST(56485.973766356394/8.0), + REAL_CONST(56506.530004720102/8.0), + REAL_CONST(56527.088112767611/8.0), + REAL_CONST(56547.648090158902/8.0), + REAL_CONST(56568.209936554107/8.0), + REAL_CONST(56588.773651613519/8.0), + REAL_CONST(56609.339234997584/8.0), + REAL_CONST(56629.9066863669/8.0), + REAL_CONST(56650.47600538221/8.0), + REAL_CONST(56671.04719170442/8.0), + REAL_CONST(56691.620244994599/8.0), + REAL_CONST(56712.195164913959/8.0), + REAL_CONST(56732.771951123868/8.0), + REAL_CONST(56753.350603285835/8.0), + REAL_CONST(56773.931121061541/8.0), + REAL_CONST(56794.513504112823/8.0), + REAL_CONST(56815.097752101647/8.0), + REAL_CONST(56835.683864690152/8.0), + REAL_CONST(56856.271841540627/8.0), + REAL_CONST(56876.86168231551/8.0), + REAL_CONST(56897.453386677393/8.0), + REAL_CONST(56918.046954289028/8.0), + REAL_CONST(56938.642384813298/8.0), + REAL_CONST(56959.239677913261/8.0), + REAL_CONST(56979.838833252121/8.0), + REAL_CONST(57000.439850493225/8.0), + REAL_CONST(57021.04272930009/8.0), + REAL_CONST(57041.647469336371/8.0), + REAL_CONST(57062.254070265873/8.0), + REAL_CONST(57082.862531752558/8.0), + REAL_CONST(57103.472853460553/8.0), + REAL_CONST(57124.085035054108/8.0), + REAL_CONST(57144.699076197649/8.0), + REAL_CONST(57165.314976555739/8.0), + REAL_CONST(57185.932735793103/8.0), + REAL_CONST(57206.552353574611/8.0), + REAL_CONST(57227.173829565276/8.0), + REAL_CONST(57247.797163430281/8.0), + REAL_CONST(57268.42235483494/8.0), + REAL_CONST(57289.049403444733/8.0), + REAL_CONST(57309.678308925286/8.0), + REAL_CONST(57330.30907094237/8.0), + REAL_CONST(57350.941689161911/8.0), + REAL_CONST(57371.576163249985/8.0), + REAL_CONST(57392.212492872815/8.0), + REAL_CONST(57412.850677696784/8.0), + REAL_CONST(57433.490717388406/8.0), + REAL_CONST(57454.132611614368/8.0), + REAL_CONST(57474.776360041491/8.0), + REAL_CONST(57495.421962336746/8.0), + REAL_CONST(57516.069418167266/8.0), + REAL_CONST(57536.718727200314/8.0), + REAL_CONST(57557.36988910332/8.0), + REAL_CONST(57578.022903543861/8.0), + REAL_CONST(57598.677770189643/8.0), + REAL_CONST(57619.334488708548/8.0), + REAL_CONST(57639.993058768589/8.0), + REAL_CONST(57660.653480037938/8.0), + REAL_CONST(57681.315752184906/8.0), + REAL_CONST(57701.979874877965/8.0), + REAL_CONST(57722.64584778573/8.0), + REAL_CONST(57743.31367057695/8.0), + REAL_CONST(57763.983342920546/8.0), + REAL_CONST(57784.654864485572/8.0), + REAL_CONST(57805.328234941233/8.0), + REAL_CONST(57826.003453956881/8.0), + REAL_CONST(57846.680521202026/8.0), + REAL_CONST(57867.359436346305/8.0), + REAL_CONST(57888.040199059527/8.0), + REAL_CONST(57908.722809011633/8.0), + REAL_CONST(57929.407265872709/8.0), + REAL_CONST(57950.093569313001/8.0), + REAL_CONST(57970.781719002895/8.0), + REAL_CONST(57991.471714612911/8.0), + REAL_CONST(58012.16355581375/8.0), + REAL_CONST(58032.857242276223/8.0), + REAL_CONST(58053.552773671312/8.0), + REAL_CONST(58074.25014967013/8.0), + REAL_CONST(58094.949369943948/8.0), + REAL_CONST(58115.650434164185/8.0), + REAL_CONST(58136.353342002389/8.0), + REAL_CONST(58157.058093130276/8.0), + REAL_CONST(58177.764687219693/8.0), + REAL_CONST(58198.47312394264/8.0), + REAL_CONST(58219.183402971255/8.0), + REAL_CONST(58239.895523977837/8.0), + REAL_CONST(58260.609486634821/8.0), + REAL_CONST(58281.325290614775/8.0), + REAL_CONST(58302.042935590434/8.0), + REAL_CONST(58322.762421234678/8.0), + REAL_CONST(58343.483747220511/8.0), + REAL_CONST(58364.206913221096/8.0), + REAL_CONST(58384.931918909751/8.0), + REAL_CONST(58405.658763959924/8.0), + REAL_CONST(58426.3874480452/8.0), + REAL_CONST(58447.117970839339/8.0), + REAL_CONST(58467.85033201622/8.0), + REAL_CONST(58488.584531249864/8.0), + REAL_CONST(58509.320568214462/8.0), + REAL_CONST(58530.058442584334/8.0), + REAL_CONST(58550.798154033931/8.0), + REAL_CONST(58571.539702237875/8.0), + REAL_CONST(58592.283086870906/8.0), + REAL_CONST(58613.028307607929/8.0), + REAL_CONST(58633.775364123983/8.0), + REAL_CONST(58654.52425609425/8.0), + REAL_CONST(58675.274983194053/8.0), + REAL_CONST(58696.027545098877/8.0), + REAL_CONST(58716.781941484325/8.0), + REAL_CONST(58737.538172026158/8.0), + REAL_CONST(58758.296236400274/8.0), + REAL_CONST(58779.056134282728/8.0), + REAL_CONST(58799.817865349694/8.0), + REAL_CONST(58820.581429277503/8.0), + REAL_CONST(58841.346825742643/8.0), + REAL_CONST(58862.114054421712/8.0), + REAL_CONST(58882.883114991484/8.0), + REAL_CONST(58903.654007128847/8.0), + REAL_CONST(58924.426730510851/8.0), + REAL_CONST(58945.201284814684/8.0), + REAL_CONST(58965.977669717664/8.0), + REAL_CONST(58986.755884897269/8.0), + REAL_CONST(59007.535930031117/8.0), + REAL_CONST(59028.317804796949/8.0), + REAL_CONST(59049.101508872664/8.0), + REAL_CONST(59069.887041936301/8.0), + REAL_CONST(59090.674403666046/8.0), + REAL_CONST(59111.463593740213/8.0), + REAL_CONST(59132.254611837263/8.0), + REAL_CONST(59153.047457635803/8.0), + REAL_CONST(59173.84213081457/8.0), + REAL_CONST(59194.638631052461/8.0), + REAL_CONST(59215.436958028506/8.0), + REAL_CONST(59236.237111421855/8.0), + REAL_CONST(59257.039090911829/8.0), + REAL_CONST(59277.842896177877/8.0), + REAL_CONST(59298.648526899589/8.0), + REAL_CONST(59319.455982756685/8.0), + REAL_CONST(59340.26526342905/8.0), + REAL_CONST(59361.076368596696/8.0), + REAL_CONST(59381.889297939757/8.0), + REAL_CONST(59402.704051138542/8.0), + REAL_CONST(59423.520627873484/8.0), + REAL_CONST(59444.339027825139/8.0), + REAL_CONST(59465.159250674224/8.0), + REAL_CONST(59485.9812961016/8.0), + REAL_CONST(59506.805163788253/8.0), + REAL_CONST(59527.630853415307/8.0), + REAL_CONST(59548.458364664046/8.0), + REAL_CONST(59569.287697215863/8.0), + REAL_CONST(59590.118850752311/8.0), + REAL_CONST(59610.951824955089/8.0), + REAL_CONST(59631.786619506012/8.0), + REAL_CONST(59652.623234087048/8.0), + REAL_CONST(59673.461668380311/8.0), + REAL_CONST(59694.301922068029/8.0), + REAL_CONST(59715.143994832593/8.0), + REAL_CONST(59735.987886356525/8.0), + REAL_CONST(59756.833596322482/8.0), + REAL_CONST(59777.681124413255/8.0), + REAL_CONST(59798.530470311794/8.0), + REAL_CONST(59819.381633701159/8.0), + REAL_CONST(59840.234614264569/8.0), + REAL_CONST(59861.089411685381/8.0), + REAL_CONST(59881.94602564707/8.0), + REAL_CONST(59902.804455833269/8.0), + REAL_CONST(59923.664701927737/8.0), + REAL_CONST(59944.526763614384/8.0), + REAL_CONST(59965.390640577243/8.0), + REAL_CONST(59986.256332500488/8.0), + REAL_CONST(60007.123839068438/8.0), + REAL_CONST(60027.993159965539/8.0), + REAL_CONST(60048.864294876381/8.0), + REAL_CONST(60069.737243485688/8.0), + REAL_CONST(60090.612005478324/8.0), + REAL_CONST(60111.488580539284/8.0), + REAL_CONST(60132.366968353708/8.0), + REAL_CONST(60153.247168606867/8.0), + REAL_CONST(60174.129180984164/8.0), + REAL_CONST(60195.013005171153/8.0), + REAL_CONST(60215.898640853513/8.0), + REAL_CONST(60236.786087717061/8.0), + REAL_CONST(60257.675345447751/8.0), + REAL_CONST(60278.566413731671/8.0), + REAL_CONST(60299.459292255044/8.0), + REAL_CONST(60320.353980704247/8.0), + REAL_CONST(60341.25047876576/8.0), + REAL_CONST(60362.148786126229/8.0), + REAL_CONST(60383.048902472423/8.0), + REAL_CONST(60403.950827491237/8.0), + REAL_CONST(60424.854560869717/8.0), + REAL_CONST(60445.76010229504/8.0), + REAL_CONST(60466.667451454516/8.0), + REAL_CONST(60487.57660803559/8.0), + REAL_CONST(60508.487571725847/8.0), + REAL_CONST(60529.400342212997/8.0), + REAL_CONST(60550.314919184893/8.0), + REAL_CONST(60571.231302329521/8.0), + REAL_CONST(60592.149491335003/8.0), + REAL_CONST(60613.069485889588/8.0), + REAL_CONST(60633.991285681674/8.0), + REAL_CONST(60654.914890399785/8.0), + REAL_CONST(60675.840299732568/8.0), + REAL_CONST(60696.767513368832/8.0), + REAL_CONST(60717.696530997484/8.0), + REAL_CONST(60738.627352307602/8.0), + REAL_CONST(60759.55997698837/8.0), + REAL_CONST(60780.494404729128/8.0), + REAL_CONST(60801.430635219323/8.0), + REAL_CONST(60822.368668148556/8.0), + REAL_CONST(60843.308503206565/8.0), + REAL_CONST(60864.250140083204/8.0), + REAL_CONST(60885.193578468468/8.0), + REAL_CONST(60906.138818052495/8.0), + REAL_CONST(60927.085858525541/8.0), + REAL_CONST(60948.034699578006/8.0), + REAL_CONST(60968.985340900421/8.0), + REAL_CONST(60989.937782183442/8.0), + REAL_CONST(61010.892023117864/8.0), + REAL_CONST(61031.848063394616/8.0), + REAL_CONST(61052.805902704764/8.0), + REAL_CONST(61073.765540739492/8.0), + REAL_CONST(61094.726977190134/8.0), + REAL_CONST(61115.690211748137/8.0), + REAL_CONST(61136.655244105103/8.0), + REAL_CONST(61157.622073952742/8.0), + REAL_CONST(61178.590700982917/8.0), + REAL_CONST(61199.561124887616/8.0), + REAL_CONST(61220.533345358948/8.0), + REAL_CONST(61241.507362089171/8.0), + REAL_CONST(61262.483174770663/8.0), + REAL_CONST(61283.460783095943/8.0), + REAL_CONST(61304.440186757645/8.0), + REAL_CONST(61325.421385448557/8.0), + REAL_CONST(61346.404378861582/8.0), + REAL_CONST(61367.389166689762/8.0), + REAL_CONST(61388.375748626262/8.0), + REAL_CONST(61409.364124364387/8.0), + REAL_CONST(61430.354293597571/8.0), + REAL_CONST(61451.346256019373/8.0), + REAL_CONST(61472.340011323497/8.0), + REAL_CONST(61493.335559203762/8.0), + REAL_CONST(61514.332899354122/8.0), + REAL_CONST(61535.332031468672/8.0), + REAL_CONST(61556.332955241618/8.0), + REAL_CONST(61577.335670367313/8.0), + REAL_CONST(61598.340176540238/8.0), + REAL_CONST(61619.346473454993/8.0), + REAL_CONST(61640.354560806329/8.0), + REAL_CONST(61661.3644382891/8.0), + REAL_CONST(61682.376105598312/8.0), + REAL_CONST(61703.389562429089/8.0), + REAL_CONST(61724.404808476691/8.0), + REAL_CONST(61745.42184343651/8.0), + REAL_CONST(61766.440667004063/8.0), + REAL_CONST(61787.461278874987/8.0), + REAL_CONST(61808.483678745069/8.0), + REAL_CONST(61829.507866310203/8.0), + REAL_CONST(61850.533841266435/8.0), + REAL_CONST(61871.561603309929/8.0), + REAL_CONST(61892.591152136971/8.0), + REAL_CONST(61913.622487443987/8.0), + REAL_CONST(61934.655608927525/8.0), + REAL_CONST(61955.690516284267/8.0), + REAL_CONST(61976.727209211022/8.0), + REAL_CONST(61997.765687404724/8.0), + REAL_CONST(62018.805950562448/8.0), + REAL_CONST(62039.847998381381/8.0), + REAL_CONST(62060.891830558845/8.0), + REAL_CONST(62081.93744679229/8.0), + REAL_CONST(62102.984846779298/8.0), + REAL_CONST(62124.034030217575/8.0), + REAL_CONST(62145.084996804966/8.0), + REAL_CONST(62166.137746239416/8.0), + REAL_CONST(62187.19227821903/8.0), + REAL_CONST(62208.248592442025/8.0), + REAL_CONST(62229.306688606739/8.0), + REAL_CONST(62250.366566411656/8.0), + REAL_CONST(62271.428225555377/8.0), + REAL_CONST(62292.491665736627/8.0), + REAL_CONST(62313.556886654267/8.0), + REAL_CONST(62334.623888007271/8.0), + REAL_CONST(62355.692669494762/8.0), + REAL_CONST(62376.763230815974/8.0), + REAL_CONST(62397.835571670272/8.0), + REAL_CONST(62418.909691757144/8.0), + REAL_CONST(62439.98559077621/8.0), + REAL_CONST(62461.063268427228/8.0), + REAL_CONST(62482.142724410049/8.0), + REAL_CONST(62503.223958424685/8.0), + REAL_CONST(62524.306970171267/8.0), + REAL_CONST(62545.39175935003/8.0), + REAL_CONST(62566.478325661366/8.0), + REAL_CONST(62587.566668805768/8.0), + REAL_CONST(62608.656788483881/8.0), + REAL_CONST(62629.748684396451/8.0), + REAL_CONST(62650.842356244357/8.0), + REAL_CONST(62671.937803728622/8.0), + REAL_CONST(62693.035026550366/8.0), + REAL_CONST(62714.134024410858/8.0), + REAL_CONST(62735.234797011479/8.0), + REAL_CONST(62756.337344053733/8.0), + REAL_CONST(62777.441665239276/8.0), + REAL_CONST(62798.547760269852/8.0), + REAL_CONST(62819.655628847358/8.0), + REAL_CONST(62840.765270673801/8.0), + REAL_CONST(62861.876685451323/8.0), + REAL_CONST(62882.989872882186/8.0), + REAL_CONST(62904.104832668774/8.0), + REAL_CONST(62925.221564513602/8.0), + REAL_CONST(62946.340068119309/8.0), + REAL_CONST(62967.460343188657/8.0), + REAL_CONST(62988.582389424526/8.0), + REAL_CONST(63009.70620652994/8.0), + REAL_CONST(63030.831794208025/8.0), + REAL_CONST(63051.959152162039/8.0), + REAL_CONST(63073.08828009537/8.0), + REAL_CONST(63094.219177711529/8.0), + REAL_CONST(63115.351844714154/8.0), + REAL_CONST(63136.486280806988/8.0), + REAL_CONST(63157.622485693922/8.0), + REAL_CONST(63178.760459078956/8.0), + REAL_CONST(63199.900200666219/8.0), + REAL_CONST(63221.041710159967/8.0), + REAL_CONST(63242.184987264569/8.0), + REAL_CONST(63263.330031684534/8.0), + REAL_CONST(63284.476843124474/8.0), + REAL_CONST(63305.625421289144/8.0), + REAL_CONST(63326.775765883409/8.0), + REAL_CONST(63347.927876612259/8.0), + REAL_CONST(63369.081753180813/8.0), + REAL_CONST(63390.237395294316/8.0), + REAL_CONST(63411.39480265812/8.0), + REAL_CONST(63432.553974977716/8.0), + REAL_CONST(63453.714911958712/8.0), + REAL_CONST(63474.877613306839/8.0), + REAL_CONST(63496.042078727944/8.0), + REAL_CONST(63517.208307927998/8.0), + REAL_CONST(63538.376300613119/8.0), + REAL_CONST(63559.546056489504/8.0), + REAL_CONST(63580.717575263516/8.0), + REAL_CONST(63601.890856641607/8.0), + REAL_CONST(63623.065900330374/8.0), + REAL_CONST(63644.242706036515/8.0), + REAL_CONST(63665.421273466869/8.0), + REAL_CONST(63686.601602328381/8.0), + REAL_CONST(63707.783692328136/8.0), + REAL_CONST(63728.967543173334/8.0), + REAL_CONST(63750.153154571279/8.0), + REAL_CONST(63771.340526229418/8.0), + REAL_CONST(63792.529657855317/8.0), + REAL_CONST(63813.720549156649/8.0), + REAL_CONST(63834.913199841227/8.0), + REAL_CONST(63856.107609616978/8.0), + REAL_CONST(63877.303778191941/8.0), + REAL_CONST(63898.501705274284/8.0), + REAL_CONST(63919.7013905723/8.0), + REAL_CONST(63940.902833794404/8.0), + REAL_CONST(63962.106034649114/8.0), + REAL_CONST(63983.310992845094/8.0), + REAL_CONST(64004.517708091109/8.0), + REAL_CONST(64025.726180096048/8.0), + REAL_CONST(64046.936408568938/8.0), + REAL_CONST(64068.1483932189/8.0), + REAL_CONST(64089.362133755196/8.0), + REAL_CONST(64110.577629887193/8.0), + REAL_CONST(64131.794881324393/8.0), + REAL_CONST(64153.013887776404/8.0), + REAL_CONST(64174.234648952966/8.0), + REAL_CONST(64195.457164563937/8.0), + REAL_CONST(64216.681434319289/8.0), + REAL_CONST(64237.907457929112/8.0), + REAL_CONST(64259.135235103626/8.0), + REAL_CONST(64280.36476555316/8.0), + REAL_CONST(64301.596048988169/8.0), + REAL_CONST(64322.829085119236/8.0), + REAL_CONST(64344.06387365704/8.0), + REAL_CONST(64365.300414312398/8.0), + REAL_CONST(64386.538706796251/8.0), + REAL_CONST(64407.778750819634/8.0), + REAL_CONST(64429.020546093721/8.0), + REAL_CONST(64450.26409232981/8.0), + REAL_CONST(64471.509389239291/8.0), + REAL_CONST(64492.756436533709/8.0), + REAL_CONST(64514.005233924705/8.0), + REAL_CONST(64535.255781124033/8.0), + REAL_CONST(64556.50807784358/8.0), + REAL_CONST(64577.762123795357/8.0), + REAL_CONST(64599.017918691468/8.0), + REAL_CONST(64620.275462244172/8.0), + REAL_CONST(64641.534754165805/8.0), + REAL_CONST(64662.795794168844/8.0), + REAL_CONST(64684.058581965895/8.0), + REAL_CONST(64705.323117269661/8.0), + REAL_CONST(64726.589399792974/8.0), + REAL_CONST(64747.857429248776/8.0), + REAL_CONST(64769.127205350138/8.0), + REAL_CONST(64790.398727810236/8.0), + REAL_CONST(64811.671996342375/8.0), + REAL_CONST(64832.947010659969/8.0), + REAL_CONST(64854.223770476558/8.0), + REAL_CONST(64875.502275505794/8.0), + REAL_CONST(64896.782525461451/8.0), + REAL_CONST(64918.064520057414/8.0), + REAL_CONST(64939.348259007682/8.0), + REAL_CONST(64960.633742026388/8.0), + REAL_CONST(64981.920968827762/8.0), + REAL_CONST(65003.209939126165/8.0), + REAL_CONST(65024.500652636067/8.0), + REAL_CONST(65045.793109072067/8.0), + REAL_CONST(65067.087308148861/8.0), + REAL_CONST(65088.383249581282/8.0), + REAL_CONST(65109.680933084259/8.0), + REAL_CONST(65130.980358372864/8.0), + REAL_CONST(65152.28152516226/8.0), + REAL_CONST(65173.584433167736/8.0), + REAL_CONST(65194.889082104703/8.0), + REAL_CONST(65216.195471688683/8.0), + REAL_CONST(65237.503601635319/8.0), + REAL_CONST(65258.813471660353/8.0), + REAL_CONST(65280.125081479666/8.0), + REAL_CONST(65301.438430809241/8.0), + REAL_CONST(65322.753519365178/8.0), + REAL_CONST(65344.070346863708/8.0), + REAL_CONST(65365.388913021146/8.0), + REAL_CONST(65386.709217553958/8.0), + REAL_CONST(65408.031260178701/8.0), + REAL_CONST(65429.355040612056/8.0), + REAL_CONST(65450.680558570821/8.0), + REAL_CONST(65472.00781377191/8.0), + REAL_CONST(65493.336805932355/8.0), + REAL_CONST(65514.66753476928/8.0), + REAL_CONST(65535.999999999956/8.0), + REAL_CONST(65557.334201341757/8.0), + REAL_CONST(65578.670138512171/8.0), + REAL_CONST(65600.007811228788/8.0), + REAL_CONST(65621.347219209332/8.0), + REAL_CONST(65642.688362171626/8.0), + REAL_CONST(65664.031239833639/8.0), + REAL_CONST(65685.375851913413/8.0), + REAL_CONST(65706.722198129137/8.0), + REAL_CONST(65728.070278199084/8.0), + REAL_CONST(65749.420091841661/8.0), + REAL_CONST(65770.771638775404/8.0), + REAL_CONST(65792.124918718939/8.0), + REAL_CONST(65813.479931391004/8.0), + REAL_CONST(65834.836676510458/8.0), + REAL_CONST(65856.195153796303/8.0), + REAL_CONST(65877.5553629676/8.0), + REAL_CONST(65898.917303743554/8.0), + REAL_CONST(65920.280975843489/8.0), + REAL_CONST(65941.646378986843/8.0), + REAL_CONST(65963.013512893158/8.0), + REAL_CONST(65984.382377282076/8.0), + REAL_CONST(66005.752971873386/8.0), + REAL_CONST(66027.125296386963/8.0), + REAL_CONST(66048.499350542799/8.0), + REAL_CONST(66069.875134061018/8.0), + REAL_CONST(66091.252646661844/8.0), + REAL_CONST(66112.631888065618/8.0), + REAL_CONST(66134.01285799277/8.0), + REAL_CONST(66155.395556163887/8.0), + REAL_CONST(66176.779982299631/8.0), + REAL_CONST(66198.166136120795/8.0), + REAL_CONST(66219.554017348273/8.0), + REAL_CONST(66240.943625703105/8.0), + REAL_CONST(66262.334960906388/8.0), + REAL_CONST(66283.728022679396/8.0), + REAL_CONST(66305.122810743444/8.0), + REAL_CONST(66326.519324820023/8.0), + REAL_CONST(66347.917564630698/8.0), + REAL_CONST(66369.317529897162/8.0), + REAL_CONST(66390.719220341227/8.0), + REAL_CONST(66412.122635684791/8.0), + REAL_CONST(66433.527775649884/8.0), + REAL_CONST(66454.934639958636/8.0), + REAL_CONST(66476.343228333324/8.0), + REAL_CONST(66497.753540496284/8.0), + REAL_CONST(66519.165576169995/8.0), + REAL_CONST(66540.57933507704/8.0), + REAL_CONST(66561.994816940118/8.0), + REAL_CONST(66583.412021482043/8.0), + REAL_CONST(66604.830948425733/8.0), + REAL_CONST(66626.251597494222/8.0), + REAL_CONST(66647.673968410629/8.0), + REAL_CONST(66669.098060898235/8.0), + REAL_CONST(66690.523874680381/8.0), + REAL_CONST(66711.951409480564/8.0), + REAL_CONST(66733.380665022371/8.0), + REAL_CONST(66754.811641029475/8.0), + REAL_CONST(66776.244337225711/8.0), + REAL_CONST(66797.678753334985/8.0), + REAL_CONST(66819.11488908132/8.0), + REAL_CONST(66840.552744188884/8.0), + REAL_CONST(66861.992318381905/8.0), + REAL_CONST(66883.433611384738/8.0), + REAL_CONST(66904.876622921889/8.0), + REAL_CONST(66926.321352717903/8.0), + REAL_CONST(66947.767800497502/8.0), + REAL_CONST(66969.215965985466/8.0), + REAL_CONST(66990.665848906734/8.0), + REAL_CONST(67012.117448986304/8.0), + REAL_CONST(67033.570765949335/8.0), + REAL_CONST(67055.025799521056/8.0), + REAL_CONST(67076.482549426815/8.0), + REAL_CONST(67097.941015392076/8.0), + REAL_CONST(67119.401197142433/8.0), + REAL_CONST(67140.863094403554/8.0), + REAL_CONST(67162.326706901222/8.0), + REAL_CONST(67183.792034361351/8.0), + REAL_CONST(67205.259076509959/8.0), + REAL_CONST(67226.72783307315/8.0), + REAL_CONST(67248.198303777172/8.0), + REAL_CONST(67269.670488348347/8.0), + REAL_CONST(67291.144386513144/8.0), + REAL_CONST(67312.619997998088/8.0), + REAL_CONST(67334.09732252988/8.0), + REAL_CONST(67355.576359835293/8.0), + REAL_CONST(67377.057109641188/8.0), + REAL_CONST(67398.53957167457/8.0), + REAL_CONST(67420.023745662547/8.0), + REAL_CONST(67441.50963133233/8.0), + REAL_CONST(67462.99722841123/8.0), + REAL_CONST(67484.486536626689/8.0), + REAL_CONST(67505.977555706224/8.0), + REAL_CONST(67527.470285377494/8.0), + REAL_CONST(67548.964725368263/8.0), + REAL_CONST(67570.460875406367/8.0), + REAL_CONST(67591.9587352198/8.0), + REAL_CONST(67613.458304536631/8.0), + REAL_CONST(67634.95958308503/8.0), + REAL_CONST(67656.462570593329/8.0), + REAL_CONST(67677.967266789899/8.0), + REAL_CONST(67699.473671403248/8.0), + REAL_CONST(67720.981784162024/8.0), + REAL_CONST(67742.491604794923/8.0), + REAL_CONST(67764.003133030797/8.0), + REAL_CONST(67785.516368598575/8.0), + REAL_CONST(67807.031311227314/8.0), + REAL_CONST(67828.547960646174/8.0), + REAL_CONST(67850.066316584402/8.0), + REAL_CONST(67871.58637877139/8.0), + REAL_CONST(67893.108146936589/8.0), + REAL_CONST(67914.63162080961/8.0), + REAL_CONST(67936.156800120138/8.0), + REAL_CONST(67957.683684597971/8.0), + REAL_CONST(67979.212273973011/8.0), + REAL_CONST(68000.742567975263/8.0), + REAL_CONST(68022.274566334876/8.0), + REAL_CONST(68043.808268782057/8.0), + REAL_CONST(68065.343675047145/8.0), + REAL_CONST(68086.880784860579/8.0), + REAL_CONST(68108.419597952918/8.0), + REAL_CONST(68129.960114054789/8.0), + REAL_CONST(68151.502332896969/8.0), + REAL_CONST(68173.04625421032/8.0), + REAL_CONST(68194.591877725834/8.0), + REAL_CONST(68216.139203174564/8.0), + REAL_CONST(68237.688230287706/8.0), + REAL_CONST(68259.238958796544/8.0), + REAL_CONST(68280.791388432481/8.0), + REAL_CONST(68302.345518927032/8.0), + REAL_CONST(68323.901350011787/8.0), + REAL_CONST(68345.458881418483/8.0), + REAL_CONST(68367.018112878912/8.0), + REAL_CONST(68388.579044125028/8.0), + REAL_CONST(68410.141674888844/8.0), + REAL_CONST(68431.706004902502/8.0), + REAL_CONST(68453.272033898262/8.0), + REAL_CONST(68474.839761608455/8.0), + REAL_CONST(68496.409187765545/8.0), + REAL_CONST(68517.980312102081/8.0), + REAL_CONST(68539.553134350732/8.0), + REAL_CONST(68561.127654244279/8.0), + REAL_CONST(68582.70387151558/8.0), + REAL_CONST(68604.281785897634/8.0), + REAL_CONST(68625.861397123503/8.0), + REAL_CONST(68647.44270492639/8.0), + REAL_CONST(68669.025709039604/8.0), + REAL_CONST(68690.610409196524/8.0), + REAL_CONST(68712.196805130661/8.0), + REAL_CONST(68733.784896575627/8.0), + REAL_CONST(68755.374683265123/8.0), + REAL_CONST(68776.966164932994/8.0), + REAL_CONST(68798.559341313128/8.0), + REAL_CONST(68820.154212139591/8.0), + REAL_CONST(68841.750777146473/8.0), + REAL_CONST(68863.349036068044/8.0), + REAL_CONST(68884.948988638629/8.0), + REAL_CONST(68906.550634592684/8.0), + REAL_CONST(68928.153973664739/8.0), + REAL_CONST(68949.75900558944/8.0), + REAL_CONST(68971.365730101577/8.0), + REAL_CONST(68992.974146935987/8.0), + REAL_CONST(69014.584255827634/8.0), + REAL_CONST(69036.196056511588/8.0), + REAL_CONST(69057.809548723017/8.0), + REAL_CONST(69079.424732197207/8.0), + REAL_CONST(69101.041606669532/8.0), + REAL_CONST(69122.660171875468/8.0), + REAL_CONST(69144.280427550606/8.0), + REAL_CONST(69165.902373430625/8.0), + REAL_CONST(69187.526009251334/8.0), + REAL_CONST(69209.151334748618/8.0), + REAL_CONST(69230.778349658474/8.0), + REAL_CONST(69252.40705371699/8.0), + REAL_CONST(69274.037446660412/8.0), + REAL_CONST(69295.669528225/8.0), + REAL_CONST(69317.303298147192/8.0), + REAL_CONST(69338.938756163494/8.0), + REAL_CONST(69360.575902010532/8.0), + REAL_CONST(69382.214735425005/8.0), + REAL_CONST(69403.855256143754/8.0), + REAL_CONST(69425.497463903681/8.0), + REAL_CONST(69447.141358441833/8.0), + REAL_CONST(69468.78693949533/8.0), + REAL_CONST(69490.434206801394/8.0), + REAL_CONST(69512.083160097391/8.0), + REAL_CONST(69533.733799120717/8.0), + REAL_CONST(69555.386123608929/8.0), + REAL_CONST(69577.04013329967/8.0), + REAL_CONST(69598.695827930685/8.0), + REAL_CONST(69620.353207239794/8.0), + REAL_CONST(69642.012270964973/8.0), + REAL_CONST(69663.67301884426/8.0), + REAL_CONST(69685.335450615792/8.0), + REAL_CONST(69706.999566017839/8.0), + REAL_CONST(69728.665364788743/8.0), + REAL_CONST(69750.332846666963/8.0), + REAL_CONST(69772.002011391058/8.0), + REAL_CONST(69793.672858699691/8.0), + REAL_CONST(69815.345388331611/8.0), + REAL_CONST(69837.019600025669/8.0), + REAL_CONST(69858.695493520849/8.0), + REAL_CONST(69880.373068556204/8.0), + REAL_CONST(69902.052324870907/8.0), + REAL_CONST(69923.733262204216/8.0), + REAL_CONST(69945.415880295492/8.0), + REAL_CONST(69967.100178884211/8.0), + REAL_CONST(69988.786157709939/8.0), + REAL_CONST(70010.473816512356/8.0), + REAL_CONST(70032.163155031216/8.0), + REAL_CONST(70053.854173006403/8.0), + REAL_CONST(70075.546870177874/8.0), + REAL_CONST(70097.241246285717/8.0), + REAL_CONST(70118.937301070109/8.0), + REAL_CONST(70140.635034271298/8.0), + REAL_CONST(70162.334445629691/8.0), + REAL_CONST(70184.035534885741/8.0), + REAL_CONST(70205.738301780017/8.0), + REAL_CONST(70227.442746053217/8.0), + REAL_CONST(70249.1488674461/8.0), + REAL_CONST(70270.856665699539/8.0), + REAL_CONST(70292.566140554511/8.0), + REAL_CONST(70314.277291752107/8.0), + REAL_CONST(70335.990119033493/8.0), + REAL_CONST(70357.704622139936/8.0), + REAL_CONST(70379.420800812819/8.0), + REAL_CONST(70401.138654793613/8.0), + REAL_CONST(70422.85818382389/8.0), + REAL_CONST(70444.579387645339/8.0), + REAL_CONST(70466.302265999722/8.0), + REAL_CONST(70488.026818628918/8.0), + REAL_CONST(70509.753045274876/8.0), + REAL_CONST(70531.480945679708/8.0), + REAL_CONST(70553.210519585555/8.0), + REAL_CONST(70574.941766734701/8.0), + REAL_CONST(70596.674686869505/8.0), + REAL_CONST(70618.409279732456/8.0), + REAL_CONST(70640.145545066101/8.0), + REAL_CONST(70661.883482613106/8.0), + REAL_CONST(70683.623092116264/8.0), + REAL_CONST(70705.364373318414/8.0), + REAL_CONST(70727.107325962526/8.0), + REAL_CONST(70748.851949791671/8.0), + REAL_CONST(70770.598244549008/8.0), + REAL_CONST(70792.346209977783/8.0), + REAL_CONST(70814.095845821372/8.0), + REAL_CONST(70835.847151823225/8.0), + REAL_CONST(70857.600127726895/8.0), + REAL_CONST(70879.354773276034/8.0), + REAL_CONST(70901.111088214413/8.0), + REAL_CONST(70922.869072285859/8.0), + REAL_CONST(70944.628725234332/8.0), + REAL_CONST(70966.390046803877/8.0), + REAL_CONST(70988.153036738629/8.0), + REAL_CONST(71009.917694782853/8.0), + REAL_CONST(71031.684020680885/8.0), + REAL_CONST(71053.45201417715/8.0), + REAL_CONST(71075.221675016204/8.0), + REAL_CONST(71096.993002942661/8.0), + REAL_CONST(71118.765997701266/8.0), + REAL_CONST(71140.540659036851/8.0), + REAL_CONST(71162.316986694335/8.0), + REAL_CONST(71184.09498041874/8.0), + REAL_CONST(71205.874639955218/8.0), + REAL_CONST(71227.655965048951/8.0), + REAL_CONST(71249.438955445294/8.0), + REAL_CONST(71271.223610889632/8.0), + REAL_CONST(71293.009931127483/8.0), + REAL_CONST(71314.797915904477/8.0), + REAL_CONST(71336.587564966307/8.0), + REAL_CONST(71358.378878058764/8.0), + REAL_CONST(71380.171854927772/8.0), + REAL_CONST(71401.966495319313/8.0), + REAL_CONST(71423.762798979486/8.0), + REAL_CONST(71445.560765654489/8.0), + REAL_CONST(71467.360395090596/8.0), + REAL_CONST(71489.161687034211/8.0), + REAL_CONST(71510.964641231811/8.0), + REAL_CONST(71532.769257429973/8.0), + REAL_CONST(71554.575535375348/8.0), + REAL_CONST(71576.383474814749/8.0), + REAL_CONST(71598.19307549503/8.0), + REAL_CONST(71620.004337163133/8.0), + REAL_CONST(71641.817259566145/8.0), + REAL_CONST(71663.631842451214/8.0), + REAL_CONST(71685.4480855656/8.0), + REAL_CONST(71707.26598865664/8.0), + REAL_CONST(71729.085551471784/8.0), + REAL_CONST(71750.906773758586/8.0), + REAL_CONST(71772.729655264673/8.0), + REAL_CONST(71794.554195737772/8.0), + REAL_CONST(71816.380394925713/8.0), + REAL_CONST(71838.208252576442/8.0), + REAL_CONST(71860.037768437964/8.0), + REAL_CONST(71881.868942258385/8.0), + REAL_CONST(71903.701773785942/8.0), + REAL_CONST(71925.536262768932/8.0), + REAL_CONST(71947.372408955751/8.0), + REAL_CONST(71969.210212094898/8.0), + REAL_CONST(71991.049671934976/8.0), + REAL_CONST(72012.890788224686/8.0), + REAL_CONST(72034.73356071279/8.0), + REAL_CONST(72056.577989148165/8.0), + REAL_CONST(72078.424073279821/8.0), + REAL_CONST(72100.271812856794/8.0), + REAL_CONST(72122.121207628254/8.0), + REAL_CONST(72143.97225734347/8.0), + REAL_CONST(72165.824961751801/8.0), + REAL_CONST(72187.679320602692/8.0), + REAL_CONST(72209.53533364569/8.0), + REAL_CONST(72231.393000630429/8.0), + REAL_CONST(72253.252321306645/8.0), + REAL_CONST(72275.113295424177/8.0), + REAL_CONST(72296.975922732949/8.0), + REAL_CONST(72318.840202982959/8.0), + REAL_CONST(72340.706135924338/8.0), + REAL_CONST(72362.573721307272/8.0), + REAL_CONST(72384.442958882093/8.0), + REAL_CONST(72406.313848399179/8.0), + REAL_CONST(72428.186389609036/8.0), + REAL_CONST(72450.060582262216/8.0), + REAL_CONST(72471.936426109431/8.0), + REAL_CONST(72493.813920901433/8.0), + REAL_CONST(72515.693066389096/8.0), + REAL_CONST(72537.573862323392/8.0), + REAL_CONST(72559.456308455352/8.0), + REAL_CONST(72581.340404536139/8.0), + REAL_CONST(72603.226150316987/8.0), + REAL_CONST(72625.113545549248/8.0), + REAL_CONST(72647.002589984331/8.0), + REAL_CONST(72668.893283373764/8.0), + REAL_CONST(72690.785625469172/8.0), + REAL_CONST(72712.679616022273/8.0), + REAL_CONST(72734.575254784853/8.0), + REAL_CONST(72756.472541508803/8.0), + REAL_CONST(72778.371475946144/8.0), + REAL_CONST(72800.272057848939/8.0), + REAL_CONST(72822.174286969355/8.0), + REAL_CONST(72844.07816305969/8.0), + REAL_CONST(72865.983685872285/8.0), + REAL_CONST(72887.890855159596/8.0), + REAL_CONST(72909.799670674183/8.0), + REAL_CONST(72931.710132168693/8.0), + REAL_CONST(72953.622239395845/8.0), + REAL_CONST(72975.535992108475/8.0), + REAL_CONST(72997.451390059519/8.0), + REAL_CONST(73019.368433001961/8.0), + REAL_CONST(73041.287120688925/8.0), + REAL_CONST(73063.207452873612/8.0), + REAL_CONST(73085.129429309294/8.0), + REAL_CONST(73107.053049749389/8.0), + REAL_CONST(73128.978313947344/8.0), + REAL_CONST(73150.905221656736/8.0), + REAL_CONST(73172.833772631217/8.0), + REAL_CONST(73194.763966624567/8.0), + REAL_CONST(73216.695803390612/8.0), + REAL_CONST(73238.62928268328/8.0), + REAL_CONST(73260.564404256627/8.0), + REAL_CONST(73282.501167864757/8.0), + REAL_CONST(73304.439573261901/8.0), + REAL_CONST(73326.379620202337/8.0), + REAL_CONST(73348.321308440485/8.0), + REAL_CONST(73370.264637730841/8.0), + REAL_CONST(73392.209607827957/8.0), + REAL_CONST(73414.156218486532/8.0), + REAL_CONST(73436.104469461323/8.0), + REAL_CONST(73458.054360507173/8.0), + REAL_CONST(73480.005891379056/8.0), + REAL_CONST(73501.959061831993/8.0), + REAL_CONST(73523.913871621116/8.0), + REAL_CONST(73545.870320501665/8.0), + REAL_CONST(73567.828408228932/8.0), + REAL_CONST(73589.78813455833/8.0), + REAL_CONST(73611.749499245358/8.0), + REAL_CONST(73633.712502045615/8.0), + REAL_CONST(73655.677142714747/8.0), + REAL_CONST(73677.643421008557/8.0), + REAL_CONST(73699.611336682879/8.0), + REAL_CONST(73721.580889493693/8.0), + REAL_CONST(73743.552079197019/8.0), + REAL_CONST(73765.524905548999/8.0), + REAL_CONST(73787.499368305856/8.0), + REAL_CONST(73809.475467223907/8.0), + REAL_CONST(73831.453202059551/8.0), + REAL_CONST(73853.432572569291/8.0), + REAL_CONST(73875.413578509717/8.0), + REAL_CONST(73897.396219637507/8.0), + REAL_CONST(73919.380495709411/8.0), + REAL_CONST(73941.36640648231/8.0), + REAL_CONST(73963.353951713143/8.0), + REAL_CONST(73985.343131158952/8.0), + REAL_CONST(74007.333944576865/8.0), + REAL_CONST(74029.326391724098/8.0), + REAL_CONST(74051.320472357969/8.0), + REAL_CONST(74073.316186235883/8.0), + REAL_CONST(74095.313533115303/8.0), + REAL_CONST(74117.312512753837/8.0), + REAL_CONST(74139.313124909138/8.0), + REAL_CONST(74161.315369338976/8.0), + REAL_CONST(74183.319245801191/8.0), + REAL_CONST(74205.324754053727/8.0), + REAL_CONST(74227.331893854629/8.0), + REAL_CONST(74249.340664961986/8.0), + REAL_CONST(74271.351067134034/8.0), + REAL_CONST(74293.363100129049/8.0), + REAL_CONST(74315.376763705441/8.0), + REAL_CONST(74337.392057621662/8.0), + REAL_CONST(74359.408981636298/8.0), + REAL_CONST(74381.427535508003/8.0), + REAL_CONST(74403.447718995507/8.0), + REAL_CONST(74425.469531857671/8.0), + REAL_CONST(74447.492973853383/8.0), + REAL_CONST(74469.518044741693/8.0), + REAL_CONST(74491.54474428168/8.0), + REAL_CONST(74513.573072232539/8.0), + REAL_CONST(74535.603028353551/8.0), + REAL_CONST(74557.634612404087/8.0), + REAL_CONST(74579.667824143602/8.0), + REAL_CONST(74601.702663331642/8.0), + REAL_CONST(74623.739129727837/8.0), + REAL_CONST(74645.777223091936/8.0), + REAL_CONST(74667.816943183716/8.0), + REAL_CONST(74689.858289763113/8.0), + REAL_CONST(74711.901262590094/8.0), + REAL_CONST(74733.945861424741/8.0), + REAL_CONST(74755.992086027225/8.0), + REAL_CONST(74778.039936157802/8.0), + REAL_CONST(74800.089411576817/8.0), + REAL_CONST(74822.140512044702/8.0), + REAL_CONST(74844.193237321961/8.0), + REAL_CONST(74866.24758716923/8.0), + REAL_CONST(74888.303561347187/8.0), + REAL_CONST(74910.36115961663/8.0), + REAL_CONST(74932.420381738411/8.0), + REAL_CONST(74954.481227473516/8.0), + REAL_CONST(74976.543696582972/8.0), + REAL_CONST(74998.607788827925/8.0), + REAL_CONST(75020.673503969607/8.0), + REAL_CONST(75042.740841769322/8.0), + REAL_CONST(75064.809801988464/8.0), + REAL_CONST(75086.88038438854/8.0), + REAL_CONST(75108.952588731103/8.0), + REAL_CONST(75131.026414777836/8.0), + REAL_CONST(75153.101862290467/8.0), + REAL_CONST(75175.178931030852/8.0), + REAL_CONST(75197.257620760924/8.0), + REAL_CONST(75219.33793124267/8.0), + REAL_CONST(75241.419862238225/8.0), + REAL_CONST(75263.503413509738/8.0), + REAL_CONST(75285.588584819503/8.0), + REAL_CONST(75307.675375929874/8.0), + REAL_CONST(75329.763786603318/8.0), + REAL_CONST(75351.853816602365/8.0), + REAL_CONST(75373.945465689612/8.0), + REAL_CONST(75396.038733627807/8.0), + REAL_CONST(75418.133620179724/8.0), + REAL_CONST(75440.230125108254/8.0), + REAL_CONST(75462.32824817636/8.0), + REAL_CONST(75484.427989147109/8.0), + REAL_CONST(75506.529347783653/8.0), + REAL_CONST(75528.63232384919/8.0), + REAL_CONST(75550.736917107075/8.0), + REAL_CONST(75572.843127320695/8.0), + REAL_CONST(75594.950954253538/8.0), + REAL_CONST(75617.060397669193/8.0), + REAL_CONST(75639.171457331307/8.0), + REAL_CONST(75661.284133003646/8.0), + REAL_CONST(75683.398424450032/8.0), + REAL_CONST(75705.514331434402/8.0), + REAL_CONST(75727.631853720741/8.0), + REAL_CONST(75749.750991073175/8.0), + REAL_CONST(75771.871743255862/8.0), + REAL_CONST(75793.994110033076/8.0), + REAL_CONST(75816.118091169177/8.0), + REAL_CONST(75838.243686428585/8.0), + REAL_CONST(75860.370895575848/8.0), + REAL_CONST(75882.499718375562/8.0), + REAL_CONST(75904.630154592422/8.0), + REAL_CONST(75926.762203991224/8.0), + REAL_CONST(75948.895866336825/8.0), + REAL_CONST(75971.031141394182/8.0), + REAL_CONST(75993.168028928325/8.0), + REAL_CONST(76015.306528704401/8.0), + REAL_CONST(76037.4466404876/8.0), + REAL_CONST(76059.588364043215/8.0), + REAL_CONST(76081.731699136653/8.0), + REAL_CONST(76103.876645533353/8.0), + REAL_CONST(76126.023202998884/8.0), + REAL_CONST(76148.171371298871/8.0), + REAL_CONST(76170.321150199044/8.0), + REAL_CONST(76192.472539465205/8.0), + REAL_CONST(76214.625538863256/8.0), + REAL_CONST(76236.780148159174/8.0), + REAL_CONST(76258.936367119008/8.0), + REAL_CONST(76281.094195508922/8.0), + REAL_CONST(76303.253633095141/8.0), + REAL_CONST(76325.414679643975/8.0), + REAL_CONST(76347.577334921851/8.0), + REAL_CONST(76369.741598695226/8.0), + REAL_CONST(76391.907470730686/8.0), + REAL_CONST(76414.074950794879/8.0), + REAL_CONST(76436.244038654564/8.0), + REAL_CONST(76458.414734076548/8.0), + REAL_CONST(76480.587036827754/8.0), + REAL_CONST(76502.760946675175/8.0), + REAL_CONST(76524.936463385893/8.0), + REAL_CONST(76547.11358672705/8.0), + REAL_CONST(76569.292316465915/8.0), + REAL_CONST(76591.472652369819/8.0), + REAL_CONST(76613.654594206164/8.0), + REAL_CONST(76635.838141742468/8.0), + REAL_CONST(76658.023294746308/8.0), + REAL_CONST(76680.210052985349/8.0), + REAL_CONST(76702.398416227341/8.0), + REAL_CONST(76724.588384240138/8.0), + REAL_CONST(76746.779956791637/8.0), + REAL_CONST(76768.973133649866/8.0), + REAL_CONST(76791.167914582897/8.0), + REAL_CONST(76813.364299358902/8.0), + REAL_CONST(76835.562287746157/8.0), + REAL_CONST(76857.761879512967/8.0), + REAL_CONST(76879.963074427797/8.0), + REAL_CONST(76902.165872259109/8.0), + REAL_CONST(76924.37027277553/8.0), + REAL_CONST(76946.576275745727/8.0), + REAL_CONST(76968.783880938441/8.0), + REAL_CONST(76990.993088122515/8.0), + REAL_CONST(77013.203897066895/8.0), + REAL_CONST(77035.416307540567/8.0), + REAL_CONST(77057.630319312622/8.0), + REAL_CONST(77079.845932152239/8.0), + REAL_CONST(77102.063145828695/8.0), + REAL_CONST(77124.281960111301/8.0), + REAL_CONST(77146.50237476948/8.0), + REAL_CONST(77168.724389572759/8.0), + REAL_CONST(77190.948004290723/8.0), + REAL_CONST(77213.173218693031/8.0), + REAL_CONST(77235.400032549442/8.0), + REAL_CONST(77257.628445629802/8.0), + REAL_CONST(77279.858457704031/8.0), + REAL_CONST(77302.090068542122/8.0), + REAL_CONST(77324.323277914169/8.0), + REAL_CONST(77346.558085590339/8.0), + REAL_CONST(77368.794491340886/8.0), + REAL_CONST(77391.032494936138/8.0), + REAL_CONST(77413.272096146524/8.0), + REAL_CONST(77435.51329474253/8.0), + REAL_CONST(77457.756090494731/8.0), + REAL_CONST(77480.000483173804/8.0), + REAL_CONST(77502.246472550498/8.0), + REAL_CONST(77524.494058395634/8.0), + REAL_CONST(77546.743240480107/8.0), + REAL_CONST(77568.994018574944/8.0), + REAL_CONST(77591.246392451198/8.0), + REAL_CONST(77613.500361880026/8.0), + REAL_CONST(77635.755926632657/8.0), + REAL_CONST(77658.013086480438/8.0), + REAL_CONST(77680.271841194757/8.0), + REAL_CONST(77702.532190547092/8.0), + REAL_CONST(77724.794134309021/8.0), + REAL_CONST(77747.057672252195/8.0), + REAL_CONST(77769.322804148323/8.0), + REAL_CONST(77791.589529769248/8.0), + REAL_CONST(77813.857848886837/8.0), + REAL_CONST(77836.127761273063/8.0), + REAL_CONST(77858.399266699998/8.0), + REAL_CONST(77880.67236493979/8.0), + REAL_CONST(77902.947055764627/8.0), + REAL_CONST(77925.223338946831/8.0), + REAL_CONST(77947.50121425878/8.0), + REAL_CONST(77969.780681472927/8.0), + REAL_CONST(77992.061740361838/8.0), + REAL_CONST(78014.344390698127/8.0), + REAL_CONST(78036.628632254491/8.0), + REAL_CONST(78058.914464803747/8.0), + REAL_CONST(78081.201888118725/8.0), + REAL_CONST(78103.490901972415/8.0), + REAL_CONST(78125.781506137821/8.0), + REAL_CONST(78148.073700388064/8.0), + REAL_CONST(78170.367484496339/8.0), + REAL_CONST(78192.662858235926/8.0), + REAL_CONST(78214.959821380166/8.0), + REAL_CONST(78237.258373702498/8.0), + REAL_CONST(78259.558514976452/8.0), + REAL_CONST(78281.860244975614/8.0), + REAL_CONST(78304.163563473659/8.0), + REAL_CONST(78326.468470244363/8.0), + REAL_CONST(78348.77496506153/8.0), + REAL_CONST(78371.083047699125/8.0), + REAL_CONST(78393.392717931114/8.0), + REAL_CONST(78415.703975531578/8.0), + REAL_CONST(78438.016820274701/8.0), + REAL_CONST(78460.331251934695/8.0), + REAL_CONST(78482.647270285903/8.0), + REAL_CONST(78504.964875102727/8.0), + REAL_CONST(78527.284066159627/8.0), + REAL_CONST(78549.604843231195/8.0), + REAL_CONST(78571.927206092048/8.0), + REAL_CONST(78594.251154516911/8.0), + REAL_CONST(78616.576688280606/8.0), + REAL_CONST(78638.903807157985/8.0), + REAL_CONST(78661.232510924034/8.0), + REAL_CONST(78683.562799353778/8.0), + REAL_CONST(78705.894672222363/8.0), + REAL_CONST(78728.228129304945/8.0), + REAL_CONST(78750.563170376859/8.0), + REAL_CONST(78772.899795213423/8.0), + REAL_CONST(78795.238003590101/8.0), + REAL_CONST(78817.577795282399/8.0), + REAL_CONST(78839.919170065928/8.0), + REAL_CONST(78862.262127716356/8.0), + REAL_CONST(78884.606668009452/8.0), + REAL_CONST(78906.952790721043/8.0), + REAL_CONST(78929.300495627045/8.0), + REAL_CONST(78951.64978250346/8.0), + REAL_CONST(78974.000651126378/8.0), + REAL_CONST(78996.353101271932/8.0), + REAL_CONST(79018.707132716358/8.0), + REAL_CONST(79041.062745235977/8.0), + REAL_CONST(79063.41993860717/8.0), + REAL_CONST(79085.778712606436/8.0), + REAL_CONST(79108.139067010285/8.0), + REAL_CONST(79130.501001595389/8.0), + REAL_CONST(79152.864516138419/8.0), + REAL_CONST(79175.22961041618/8.0), + REAL_CONST(79197.596284205531/8.0), + REAL_CONST(79219.96453728342/8.0), + REAL_CONST(79242.33436942687/8.0), + REAL_CONST(79264.705780412987/8.0), + REAL_CONST(79287.078770018954/8.0), + REAL_CONST(79309.453338022009/8.0), + REAL_CONST(79331.829484199508/8.0), + REAL_CONST(79354.207208328866/8.0), + REAL_CONST(79376.586510187582/8.0), + REAL_CONST(79398.967389553218/8.0), + REAL_CONST(79421.349846203433/8.0), + REAL_CONST(79443.733879915948/8.0), + REAL_CONST(79466.119490468584/8.0), + REAL_CONST(79488.50667763922/8.0), + REAL_CONST(79510.895441205823/8.0), + REAL_CONST(79533.285780946433/8.0), + REAL_CONST(79555.677696639163/8.0), + REAL_CONST(79578.071188062226/8.0), + REAL_CONST(79600.466254993895/8.0), + REAL_CONST(79622.862897212515/8.0), + REAL_CONST(79645.261114496549/8.0), + REAL_CONST(79667.660906624471/8.0), + REAL_CONST(79690.062273374875/8.0), + REAL_CONST(79712.465214526455/8.0), + REAL_CONST(79734.869729857935/8.0), + REAL_CONST(79757.275819148126/8.0), + REAL_CONST(79779.683482175955/8.0), + REAL_CONST(79802.092718720378/8.0), + REAL_CONST(79824.503528560454/8.0), + REAL_CONST(79846.915911475327/8.0), + REAL_CONST(79869.329867244203/8.0), + REAL_CONST(79891.745395646343/8.0), + REAL_CONST(79914.162496461155/8.0), + REAL_CONST(79936.581169468045/8.0), + REAL_CONST(79959.001414446553/8.0), + REAL_CONST(79981.423231176261/8.0), + REAL_CONST(80003.846619436852/8.0), + REAL_CONST(80026.271579008084/8.0), + REAL_CONST(80048.698109669771/8.0), + REAL_CONST(80071.12621120183/8.0), + REAL_CONST(80093.555883384237/8.0), + REAL_CONST(80115.987125997053/8.0), + REAL_CONST(80138.419938820414/8.0), + REAL_CONST(80160.854321634528/8.0), + REAL_CONST(80183.290274219689/8.0), + REAL_CONST(80205.727796356281/8.0), + REAL_CONST(80228.166887824715/8.0), + REAL_CONST(80250.607548405547/8.0), + REAL_CONST(80273.049777879336/8.0), + REAL_CONST(80295.493576026798/8.0), + REAL_CONST(80317.938942628651/8.0), + REAL_CONST(80340.385877465727/8.0), + REAL_CONST(80362.834380318949/8.0), + REAL_CONST(80385.28445096928/8.0), + REAL_CONST(80407.736089197788/8.0), + REAL_CONST(80430.189294785596/8.0), + REAL_CONST(80452.644067513917/8.0), + REAL_CONST(80475.100407164035/8.0), + REAL_CONST(80497.558313517322/8.0), + REAL_CONST(80520.017786355209/8.0), + REAL_CONST(80542.478825459213/8.0), + REAL_CONST(80564.941430610925/8.0), + REAL_CONST(80587.405601592007/8.0), + REAL_CONST(80609.871338184195/8.0), + REAL_CONST(80632.338640169342/8.0), + REAL_CONST(80654.8075073293/8.0), + REAL_CONST(80677.277939446067/8.0), + REAL_CONST(80699.749936301683/8.0), + REAL_CONST(80722.223497678278/8.0), + REAL_CONST(80744.698623358039/8.0), + REAL_CONST(80767.17531312324/8.0), + REAL_CONST(80789.653566756242/8.0), + REAL_CONST(80812.133384039465/8.0), + REAL_CONST(80834.614764755403/8.0), + REAL_CONST(80857.097708686648/8.0), + REAL_CONST(80879.582215615854/8.0), + REAL_CONST(80902.068285325731/8.0), + REAL_CONST(80924.555917599093/8.0), + REAL_CONST(80947.045112218824/8.0), + REAL_CONST(80969.535868967869/8.0), + REAL_CONST(80992.028187629272/8.0), + REAL_CONST(81014.522067986123/8.0), + REAL_CONST(81037.017509821613/8.0), + REAL_CONST(81059.514512919006/8.0), + REAL_CONST(81082.013077061609/8.0), + REAL_CONST(81104.513202032831/8.0), + REAL_CONST(81127.014887616184/8.0), + REAL_CONST(81149.518133595193/8.0), + REAL_CONST(81172.022939753486/8.0), + REAL_CONST(81194.529305874807/8.0), + REAL_CONST(81217.037231742899/8.0), + REAL_CONST(81239.546717141639/8.0), + REAL_CONST(81262.057761854958/8.0), + REAL_CONST(81284.570365666848/8.0), + REAL_CONST(81307.084528361403/8.0), + REAL_CONST(81329.600249722775/8.0), + REAL_CONST(81352.117529535186/8.0), + REAL_CONST(81374.636367582949/8.0), + REAL_CONST(81397.156763650448/8.0), + REAL_CONST(81419.678717522125/8.0), + REAL_CONST(81442.202228982511/8.0), + REAL_CONST(81464.727297816222/8.0), + REAL_CONST(81487.253923807933/8.0), + REAL_CONST(81509.782106742379/8.0), + REAL_CONST(81532.311846404409/8.0), + REAL_CONST(81554.843142578902/8.0), + REAL_CONST(81577.375995050839/8.0), + REAL_CONST(81599.910403605274/8.0), + REAL_CONST(81622.446368027333/8.0), + REAL_CONST(81644.983888102215/8.0), + REAL_CONST(81667.522963615178/8.0), + REAL_CONST(81690.063594351581/8.0), + REAL_CONST(81712.605780096841/8.0), + REAL_CONST(81735.149520636449/8.0), + REAL_CONST(81757.694815755967/8.0), + REAL_CONST(81780.241665241047/8.0), + REAL_CONST(81802.79006887741/8.0), + REAL_CONST(81825.340026450824/8.0), + REAL_CONST(81847.891537747171/8.0), + REAL_CONST(81870.444602552379/8.0), + REAL_CONST(81892.999220652477/8.0), + REAL_CONST(81915.555391833506/8.0), + REAL_CONST(81938.113115881672/8.0), + REAL_CONST(81960.672392583176/8.0), + REAL_CONST(81983.233221724338/8.0), + REAL_CONST(82005.795603091537/8.0), + REAL_CONST(82028.359536471224/8.0), + REAL_CONST(82050.925021649906/8.0), + REAL_CONST(82073.492058414209/8.0), + REAL_CONST(82096.060646550788/8.0), + REAL_CONST(82118.630785846399/8.0), + REAL_CONST(82141.202476087841/8.0), + REAL_CONST(82163.775717062032/8.0), + REAL_CONST(82186.35050855593/8.0), + REAL_CONST(82208.926850356569/8.0), + REAL_CONST(82231.504742251054/8.0), + REAL_CONST(82254.084184026578/8.0), + REAL_CONST(82276.665175470393/8.0), + REAL_CONST(82299.24771636985/8.0), + REAL_CONST(82321.831806512317/8.0), + REAL_CONST(82344.417445685307/8.0), + REAL_CONST(82367.004633676348/8.0), + REAL_CONST(82389.593370273054/8.0), + REAL_CONST(82412.183655263143/8.0), + REAL_CONST(82434.775488434374/8.0), + REAL_CONST(82457.368869574595/8.0), + REAL_CONST(82479.963798471697/8.0), + REAL_CONST(82502.560274913689/8.0), + REAL_CONST(82525.158298688606/8.0), + REAL_CONST(82547.757869584602/8.0), + REAL_CONST(82570.35898738986/8.0), + REAL_CONST(82592.961651892678/8.0), + REAL_CONST(82615.565862881398/8.0), + REAL_CONST(82638.171620144421/8.0), + REAL_CONST(82660.778923470265/8.0), + REAL_CONST(82683.387772647475/8.0), + REAL_CONST(82705.998167464713/8.0), + REAL_CONST(82728.610107710658/8.0), + REAL_CONST(82751.223593174116/8.0), + REAL_CONST(82773.83862364394/8.0), + REAL_CONST(82796.45519890904/8.0), + REAL_CONST(82819.073318758441/8.0), + REAL_CONST(82841.692982981185/8.0), + REAL_CONST(82864.314191366429/8.0), + REAL_CONST(82886.936943703375/8.0), + REAL_CONST(82909.561239781324/8.0), + REAL_CONST(82932.187079389638/8.0), + REAL_CONST(82954.814462317736/8.0), + REAL_CONST(82977.443388355125/8.0), + REAL_CONST(83000.073857291369/8.0), + REAL_CONST(83022.70586891612/8.0), + REAL_CONST(83045.339423019104/8.0), + REAL_CONST(83067.974519390089/8.0), + REAL_CONST(83090.611157818959/8.0), + REAL_CONST(83113.249338095629/8.0), + REAL_CONST(83135.8890600101/8.0), + REAL_CONST(83158.530323352461/8.0), + REAL_CONST(83181.173127912858/8.0), + REAL_CONST(83203.817473481497/8.0), + REAL_CONST(83226.463359848669/8.0), + REAL_CONST(83249.11078680474/8.0), + REAL_CONST(83271.759754140134/8.0), + REAL_CONST(83294.410261645375/8.0), + REAL_CONST(83317.062309111003/8.0), + REAL_CONST(83339.715896327703/8.0), + REAL_CONST(83362.371023086147/8.0), + REAL_CONST(83385.027689177165/8.0), + REAL_CONST(83407.685894391587/8.0), + REAL_CONST(83430.345638520361/8.0), + REAL_CONST(83453.006921354478/8.0), + REAL_CONST(83475.669742685001/8.0), + REAL_CONST(83498.334102303095/8.0), + REAL_CONST(83520.999999999942/8.0), + REAL_CONST(83543.667435566866/8.0), + REAL_CONST(83566.336408795192/8.0), + REAL_CONST(83589.006919476349/8.0), + REAL_CONST(83611.678967401851/8.0), + REAL_CONST(83634.352552363242/8.0), + REAL_CONST(83657.027674152167/8.0), + REAL_CONST(83679.704332560359/8.0), + REAL_CONST(83702.382527379552/8.0), + REAL_CONST(83725.062258401638/8.0), + REAL_CONST(83747.743525418511/8.0), + REAL_CONST(83770.42632822218/8.0), + REAL_CONST(83793.110666604684/8.0), + REAL_CONST(83815.796540358162/8.0), + REAL_CONST(83838.483949274829/8.0), + REAL_CONST(83861.172893146941/8.0), + REAL_CONST(83883.863371766842/8.0), + REAL_CONST(83906.555384926964/8.0), + REAL_CONST(83929.248932419752/8.0), + REAL_CONST(83951.944014037799/8.0), + REAL_CONST(83974.640629573696/8.0), + REAL_CONST(83997.338778820151/8.0), + REAL_CONST(84020.038461569929/8.0), + REAL_CONST(84042.739677615857/8.0), + REAL_CONST(84065.442426750829/8.0), + REAL_CONST(84088.146708767847/8.0), + REAL_CONST(84110.852523459922/8.0), + REAL_CONST(84133.559870620171/8.0), + REAL_CONST(84156.268750041796/8.0), + REAL_CONST(84178.979161518029/8.0), + REAL_CONST(84201.691104842204/8.0), + REAL_CONST(84224.404579807713/8.0), + REAL_CONST(84247.119586208006/8.0), + REAL_CONST(84269.83612383662/8.0), + REAL_CONST(84292.55419248715/8.0), + REAL_CONST(84315.273791953281/8.0), + REAL_CONST(84337.994922028738/8.0), + REAL_CONST(84360.717582507335/8.0), + REAL_CONST(84383.441773182945/8.0), + REAL_CONST(84406.167493849513/8.0), + REAL_CONST(84428.894744301069/8.0), + REAL_CONST(84451.623524331691/8.0), + REAL_CONST(84474.353833735542/8.0), + REAL_CONST(84497.085672306828/8.0), + REAL_CONST(84519.819039839858/8.0), + REAL_CONST(84542.553936128999/8.0), + REAL_CONST(84565.290360968676/8.0), + REAL_CONST(84588.028314153402/8.0), + REAL_CONST(84610.767795477717/8.0), + REAL_CONST(84633.508804736295/8.0), + REAL_CONST(84656.251341723822/8.0), + REAL_CONST(84678.995406235073/8.0), + REAL_CONST(84701.740998064924/8.0), + REAL_CONST(84724.488117008252/8.0), + REAL_CONST(84747.236762860062/8.0), + REAL_CONST(84769.986935415407/8.0), + REAL_CONST(84792.73863446941/8.0), + REAL_CONST(84815.491859817252/8.0), + REAL_CONST(84838.246611254188/8.0), + REAL_CONST(84861.002888575575/8.0), + REAL_CONST(84883.760691576768/8.0), + REAL_CONST(84906.520020053256/8.0), + REAL_CONST(84929.28087380057/8.0), + REAL_CONST(84952.043252614312/8.0), + REAL_CONST(84974.807156290146/8.0), + REAL_CONST(84997.572584623806/8.0), + REAL_CONST(85020.339537411113/8.0), + REAL_CONST(85043.108014447949/8.0), + REAL_CONST(85065.878015530237/8.0), + REAL_CONST(85088.649540453989/8.0), + REAL_CONST(85111.422589015303/8.0), + REAL_CONST(85134.197161010321/8.0), + REAL_CONST(85156.973256235244/8.0), + REAL_CONST(85179.750874486374/8.0), + REAL_CONST(85202.530015560071/8.0), + REAL_CONST(85225.310679252725/8.0), + REAL_CONST(85248.092865360857/8.0), + REAL_CONST(85270.876573681016/8.0), + REAL_CONST(85293.661804009811/8.0), + REAL_CONST(85316.448556143951/8.0), + REAL_CONST(85339.236829880188/8.0), + REAL_CONST(85362.026625015351/8.0), + REAL_CONST(85384.817941346351/8.0), + REAL_CONST(85407.610778670132/8.0), + REAL_CONST(85430.405136783724/8.0), + REAL_CONST(85453.201015484257/8.0), + REAL_CONST(85475.998414568865/8.0), + REAL_CONST(85498.797333834795/8.0), + REAL_CONST(85521.597773079353/8.0), + REAL_CONST(85544.399732099904/8.0), + REAL_CONST(85567.203210693886/8.0), + REAL_CONST(85590.008208658808/8.0), + REAL_CONST(85612.814725792239/8.0), + REAL_CONST(85635.62276189182/8.0), + REAL_CONST(85658.432316755265/8.0), + REAL_CONST(85681.243390180331/8.0), + REAL_CONST(85704.055981964877/8.0), + REAL_CONST(85726.870091906807/8.0), + REAL_CONST(85749.685719804082/8.0), + REAL_CONST(85772.502865454764/8.0), + REAL_CONST(85795.321528656961/8.0), + REAL_CONST(85818.141709208852/8.0), + REAL_CONST(85840.963406908675/8.0), + REAL_CONST(85863.78662155474/8.0), + REAL_CONST(85886.611352945445/8.0), + REAL_CONST(85909.437600879217/8.0), + REAL_CONST(85932.26536515457/8.0), + REAL_CONST(85955.094645570091/8.0), + REAL_CONST(85977.92544192441/8.0), + REAL_CONST(86000.757754016275/8.0), + REAL_CONST(86023.591581644432/8.0), + REAL_CONST(86046.426924607746/8.0), + REAL_CONST(86069.263782705122/8.0), + REAL_CONST(86092.102155735556/8.0), + REAL_CONST(86114.942043498071/8.0), + REAL_CONST(86137.783445791807/8.0), + REAL_CONST(86160.626362415918/8.0), + REAL_CONST(86183.470793169676/8.0), + REAL_CONST(86206.316737852379/8.0), + REAL_CONST(86229.164196263402/8.0), + REAL_CONST(86252.013168202204/8.0), + REAL_CONST(86274.863653468303/8.0), + REAL_CONST(86297.715651861261/8.0), + REAL_CONST(86320.569163180728/8.0), + REAL_CONST(86343.424187226425/8.0), + REAL_CONST(86366.280723798132/8.0), + REAL_CONST(86389.138772695675/8.0), + REAL_CONST(86411.998333718977/8.0), + REAL_CONST(86434.859406668009/8.0), + REAL_CONST(86457.721991342827/8.0), + REAL_CONST(86480.586087543532/8.0), + REAL_CONST(86503.451695070296/8.0), + REAL_CONST(86526.318813723352/8.0), + REAL_CONST(86549.187443303032/8.0), + REAL_CONST(86572.057583609683/8.0), + REAL_CONST(86594.929234443756/8.0), + REAL_CONST(86617.802395605773/8.0), + REAL_CONST(86640.677066896271/8.0), + REAL_CONST(86663.553248115903/8.0), + REAL_CONST(86686.43093906538/8.0), + REAL_CONST(86709.310139545443/8.0), + REAL_CONST(86732.190849356964/8.0), + REAL_CONST(86755.073068300815/8.0), + REAL_CONST(86777.956796177954/8.0), + REAL_CONST(86800.842032789442/8.0), + REAL_CONST(86823.728777936354/8.0), + REAL_CONST(86846.617031419853/8.0), + REAL_CONST(86869.506793041175/8.0), + REAL_CONST(86892.398062601613/8.0), + REAL_CONST(86915.290839902518/8.0), + REAL_CONST(86938.185124745316/8.0), + REAL_CONST(86961.080916931489/8.0), + REAL_CONST(86983.978216262592/8.0), + REAL_CONST(87006.87702254027/8.0), + REAL_CONST(87029.777335566177/8.0), + REAL_CONST(87052.67915514209/8.0), + REAL_CONST(87075.582481069796/8.0), + REAL_CONST(87098.487313151185/8.0), + REAL_CONST(87121.39365118822/8.0), + REAL_CONST(87144.301494982894/8.0), + REAL_CONST(87167.210844337285/8.0), + REAL_CONST(87190.121699053532/8.0), + REAL_CONST(87213.034058933845/8.0), + REAL_CONST(87235.947923780506/8.0), + REAL_CONST(87258.863293395829/8.0), + REAL_CONST(87281.780167582241/8.0), + REAL_CONST(87304.698546142172/8.0), + REAL_CONST(87327.618428878181/8.0), + REAL_CONST(87350.539815592856/8.0), + REAL_CONST(87373.462706088845/8.0), + REAL_CONST(87396.387100168897/8.0), + REAL_CONST(87419.312997635774/8.0), + REAL_CONST(87442.240398292357/8.0), + REAL_CONST(87465.16930194154/8.0), + REAL_CONST(87488.099708386319/8.0), + REAL_CONST(87511.031617429733/8.0), + REAL_CONST(87533.965028874911/8.0), + REAL_CONST(87556.899942525008/8.0), + REAL_CONST(87579.836358183282/8.0), + REAL_CONST(87602.774275653021/8.0), + REAL_CONST(87625.713694737613/8.0), + REAL_CONST(87648.654615240492/8.0), + REAL_CONST(87671.597036965148/8.0), + REAL_CONST(87694.540959715145/8.0), + REAL_CONST(87717.486383294105/8.0), + REAL_CONST(87740.433307505737/8.0), + REAL_CONST(87763.381732153779/8.0), + REAL_CONST(87786.331657042057/8.0), + REAL_CONST(87809.283081974456/8.0), + REAL_CONST(87832.236006754916/8.0), + REAL_CONST(87855.190431187453/8.0), + REAL_CONST(87878.146355076155/8.0), + REAL_CONST(87901.103778225151/8.0), + REAL_CONST(87924.062700438633/8.0), + REAL_CONST(87947.023121520891/8.0), + REAL_CONST(87969.985041276246/8.0), + REAL_CONST(87992.948459509105/8.0), + REAL_CONST(88015.913376023906/8.0), + REAL_CONST(88038.879790625171/8.0), + REAL_CONST(88061.847703117513/8.0), + REAL_CONST(88084.817113305573/8.0), + REAL_CONST(88107.788020994049/8.0), + REAL_CONST(88130.760425987726/8.0), + REAL_CONST(88153.734328091465/8.0), + REAL_CONST(88176.709727110137/8.0), + REAL_CONST(88199.686622848749/8.0), + REAL_CONST(88222.665015112303/8.0), + REAL_CONST(88245.644903705906/8.0), + REAL_CONST(88268.626288434709/8.0), + REAL_CONST(88291.609169103947/8.0), + REAL_CONST(88314.593545518903/8.0), + REAL_CONST(88337.579417484914/8.0), + REAL_CONST(88360.566784807408/8.0), + REAL_CONST(88383.555647291854/8.0), + REAL_CONST(88406.546004743795/8.0), + REAL_CONST(88429.537856968818/8.0), + REAL_CONST(88452.531203772611/8.0), + REAL_CONST(88475.52604496089/8.0), + REAL_CONST(88498.522380339447/8.0), + REAL_CONST(88521.52020971413/8.0), + REAL_CONST(88544.519532890874/8.0), + REAL_CONST(88567.520349675644/8.0), + REAL_CONST(88590.522659874507/8.0), + REAL_CONST(88613.526463293543/8.0), + REAL_CONST(88636.531759738922/8.0), + REAL_CONST(88659.538549016899/8.0), + REAL_CONST(88682.546830933745/8.0), + REAL_CONST(88705.556605295846/8.0), + REAL_CONST(88728.567871909589/8.0), + REAL_CONST(88751.580630581491/8.0), + REAL_CONST(88774.594881118086/8.0), + REAL_CONST(88797.610623325963/8.0), + REAL_CONST(88820.62785701183/8.0), + REAL_CONST(88843.646581982393/8.0), + REAL_CONST(88866.666798044462/8.0), + REAL_CONST(88889.688505004888/8.0), + REAL_CONST(88912.711702670611/8.0), + REAL_CONST(88935.7363908486/8.0), + REAL_CONST(88958.762569345898/8.0), + REAL_CONST(88981.790237969632/8.0), + REAL_CONST(89004.81939652696/8.0), + REAL_CONST(89027.850044825114/8.0), + REAL_CONST(89050.882182671412/8.0), + REAL_CONST(89073.9158098732/8.0), + REAL_CONST(89096.950926237885/8.0), + REAL_CONST(89119.987531572973/8.0), + REAL_CONST(89143.025625686001/8.0), + REAL_CONST(89166.065208384563/8.0), + REAL_CONST(89189.106279476357/8.0), + REAL_CONST(89212.148838769106/8.0), + REAL_CONST(89235.192886070581/8.0), + REAL_CONST(89258.238421188667/8.0), + REAL_CONST(89281.285443931265/8.0), + REAL_CONST(89304.333954106376/8.0), + REAL_CONST(89327.383951522017/8.0), + REAL_CONST(89350.435435986306/8.0), + REAL_CONST(89373.488407307406/8.0), + REAL_CONST(89396.542865293537/8.0), + REAL_CONST(89419.598809753006/8.0), + REAL_CONST(89442.656240494165/8.0), + REAL_CONST(89465.715157325409/8.0), + REAL_CONST(89488.775560055219/8.0), + REAL_CONST(89511.837448492137/8.0), + REAL_CONST(89534.900822444746/8.0), + REAL_CONST(89557.965681721733/8.0), + REAL_CONST(89581.032026131812/8.0), + REAL_CONST(89604.099855483742/8.0), + REAL_CONST(89627.169169586399/8.0), + REAL_CONST(89650.239968248672/8.0), + REAL_CONST(89673.312251279538/8.0), + REAL_CONST(89696.386018488018/8.0), + REAL_CONST(89719.461269683205/8.0), + REAL_CONST(89742.53800467425/8.0), + REAL_CONST(89765.616223270365/8.0), + REAL_CONST(89788.69592528083/8.0), + REAL_CONST(89811.777110514988/8.0), + REAL_CONST(89834.859778782207/8.0), + REAL_CONST(89857.943929891975/8.0), + REAL_CONST(89881.029563653807/8.0), + REAL_CONST(89904.116679877261/8.0), + REAL_CONST(89927.205278372014/8.0), + REAL_CONST(89950.29535894774/8.0), + REAL_CONST(89973.386921414218/8.0), + REAL_CONST(89996.479965581268/8.0), + REAL_CONST(90019.574491258769/8.0), + REAL_CONST(90042.670498256688/8.0), + REAL_CONST(90065.767986385021/8.0), + REAL_CONST(90088.866955453836/8.0), + REAL_CONST(90111.967405273259/8.0), + REAL_CONST(90135.069335653476/8.0), + REAL_CONST(90158.172746404758/8.0), + REAL_CONST(90181.277637337407/8.0), + REAL_CONST(90204.384008261797/8.0), + REAL_CONST(90227.49185898836/8.0), + REAL_CONST(90250.601189327586/8.0), + REAL_CONST(90273.711999090039/8.0), + REAL_CONST(90296.824288086325/8.0), + REAL_CONST(90319.938056127125/8.0), + REAL_CONST(90343.053303023189/8.0), + REAL_CONST(90366.170028585286/8.0), + REAL_CONST(90389.288232624298/8.0), + REAL_CONST(90412.407914951138/8.0), + REAL_CONST(90435.529075376777/8.0), + REAL_CONST(90458.651713712257/8.0), + REAL_CONST(90481.775829768681/8.0), + REAL_CONST(90504.901423357209/8.0), + REAL_CONST(90528.028494289058/8.0), + REAL_CONST(90551.157042375504/8.0), + REAL_CONST(90574.287067427911/8.0), + REAL_CONST(90597.418569257643/8.0), + REAL_CONST(90620.551547676194/8.0), + REAL_CONST(90643.686002495073/8.0), + REAL_CONST(90666.821933525847/8.0), + REAL_CONST(90689.959340580186/8.0), + REAL_CONST(90713.098223469773/8.0), + REAL_CONST(90736.238582006365/8.0), + REAL_CONST(90759.380416001804/8.0), + REAL_CONST(90782.523725267951/8.0), + REAL_CONST(90805.668509616764/8.0), + REAL_CONST(90828.814768860233/8.0), + REAL_CONST(90851.962502810435/8.0), + REAL_CONST(90875.11171127946/8.0), + REAL_CONST(90898.262394079517/8.0), + REAL_CONST(90921.414551022855/8.0), + REAL_CONST(90944.568181921743/8.0), + REAL_CONST(90967.72328658856/8.0), + REAL_CONST(90990.879864835719/8.0), + REAL_CONST(91014.037916475718/8.0), + REAL_CONST(91037.19744132107/8.0), + REAL_CONST(91060.358439184391/8.0), + REAL_CONST(91083.520909878338/8.0), + REAL_CONST(91106.684853215629/8.0), + REAL_CONST(91129.850269009039/8.0), + REAL_CONST(91153.017157071401/8.0), + REAL_CONST(91176.185517215621/8.0), + REAL_CONST(91199.355349254649/8.0), + REAL_CONST(91222.526653001492/8.0), + REAL_CONST(91245.699428269247/8.0), + REAL_CONST(91268.873674871036/8.0), + REAL_CONST(91292.049392620058/8.0), + REAL_CONST(91315.226581329553/8.0), + REAL_CONST(91338.405240812834/8.0), + REAL_CONST(91361.585370883287/8.0), + REAL_CONST(91384.766971354344/8.0), + REAL_CONST(91407.950042039476/8.0), + REAL_CONST(91431.134582752245/8.0), + REAL_CONST(91454.320593306256/8.0), + REAL_CONST(91477.508073515171/8.0), + REAL_CONST(91500.697023192712/8.0), + REAL_CONST(91523.887442152685/8.0), + REAL_CONST(91547.07933020893/8.0), + REAL_CONST(91570.272687175326/8.0), + REAL_CONST(91593.467512865856/8.0), + REAL_CONST(91616.663807094534/8.0), + REAL_CONST(91639.861569675442/8.0), + REAL_CONST(91663.060800422725/8.0), + REAL_CONST(91686.261499150554/8.0), + REAL_CONST(91709.463665673218/8.0), + REAL_CONST(91732.66729980502/8.0), + REAL_CONST(91755.872401360321/8.0), + REAL_CONST(91779.078970153569/8.0), + REAL_CONST(91802.287005999257/8.0), + REAL_CONST(91825.49650871192/8.0), + REAL_CONST(91848.707478106167/8.0), + REAL_CONST(91871.91991399668/8.0), + REAL_CONST(91895.133816198169/8.0), + REAL_CONST(91918.349184525418/8.0), + REAL_CONST(91941.566018793281/8.0), + REAL_CONST(91964.784318816659/8.0), + REAL_CONST(91988.004084410495/8.0), + REAL_CONST(92011.22531538982/8.0), + REAL_CONST(92034.448011569708/8.0), + REAL_CONST(92057.672172765277/8.0), + REAL_CONST(92080.897798791746/8.0), + REAL_CONST(92104.124889464365/8.0), + REAL_CONST(92127.353444598411/8.0), + REAL_CONST(92150.58346400928/8.0), + REAL_CONST(92173.814947512379/8.0), + REAL_CONST(92197.04789492322/8.0), + REAL_CONST(92220.282306057314/8.0), + REAL_CONST(92243.518180730272/8.0), + REAL_CONST(92266.755518757753/8.0), + REAL_CONST(92289.994319955469/8.0), + REAL_CONST(92313.234584139194/8.0), + REAL_CONST(92336.476311124774/8.0), + REAL_CONST(92359.719500728082/8.0), + REAL_CONST(92382.964152765067/8.0), + REAL_CONST(92406.210267051734/8.0), + REAL_CONST(92429.457843404161/8.0), + REAL_CONST(92452.706881638471/8.0), + REAL_CONST(92475.957381570814/8.0), + REAL_CONST(92499.209343017443/8.0), + REAL_CONST(92522.462765794655/8.0), + REAL_CONST(92545.717649718805/8.0), + REAL_CONST(92568.973994606305/8.0), + REAL_CONST(92592.231800273614/8.0), + REAL_CONST(92615.491066537259/8.0), + REAL_CONST(92638.751793213814/8.0), + REAL_CONST(92662.01398011994/8.0), + REAL_CONST(92685.277627072326/8.0), + REAL_CONST(92708.54273388772/8.0), + REAL_CONST(92731.809300382942/8.0), + REAL_CONST(92755.077326374871/8.0), + REAL_CONST(92778.346811680414/8.0), + REAL_CONST(92801.617756116568/8.0), + REAL_CONST(92824.890159500384/8.0), + REAL_CONST(92848.164021648947/8.0), + REAL_CONST(92871.439342379424/8.0), + REAL_CONST(92894.716121509016/8.0), + REAL_CONST(92917.994358855023/8.0), + REAL_CONST(92941.274054234746/8.0), + REAL_CONST(92964.555207465572/8.0), + REAL_CONST(92987.837818364962/8.0), + REAL_CONST(93011.121886750407/8.0), + REAL_CONST(93034.407412439468/8.0), + REAL_CONST(93057.694395249753/8.0), + REAL_CONST(93080.982834998955/8.0), + REAL_CONST(93104.272731504767/8.0), + REAL_CONST(93127.564084584999/8.0), + REAL_CONST(93150.856894057491/8.0), + REAL_CONST(93174.15115974014/8.0), + REAL_CONST(93197.446881450916/8.0), + REAL_CONST(93220.744059007804/8.0), + REAL_CONST(93244.04269222889/8.0), + REAL_CONST(93267.342780932304/8.0), + REAL_CONST(93290.644324936235/8.0), + REAL_CONST(93313.947324058914/8.0), + REAL_CONST(93337.251778118633/8.0), + REAL_CONST(93360.557686933767/8.0), + REAL_CONST(93383.865050322696/8.0), + REAL_CONST(93407.173868103928/8.0), + REAL_CONST(93430.484140095941/8.0), + REAL_CONST(93453.795866117362/8.0), + REAL_CONST(93477.109045986799/8.0), + REAL_CONST(93500.423679522952/8.0), + REAL_CONST(93523.739766544561/8.0), + REAL_CONST(93547.057306870454/8.0), + REAL_CONST(93570.376300319491/8.0), + REAL_CONST(93593.696746710571/8.0), + REAL_CONST(93617.018645862699/8.0), + REAL_CONST(93640.341997594893/8.0), + REAL_CONST(93663.666801726242/8.0), + REAL_CONST(93686.993058075881/8.0), + REAL_CONST(93710.320766463032/8.0), + REAL_CONST(93733.64992670693/8.0), + REAL_CONST(93756.980538626914/8.0), + REAL_CONST(93780.312602042337/8.0), + REAL_CONST(93803.646116772637/8.0), + REAL_CONST(93826.981082637285/8.0), + REAL_CONST(93850.317499455836/8.0), + REAL_CONST(93873.655367047861/8.0), + REAL_CONST(93896.994685233032/8.0), + REAL_CONST(93920.335453831038/8.0), + REAL_CONST(93943.677672661666/8.0), + REAL_CONST(93967.021341544707/8.0), + REAL_CONST(93990.366460300051/8.0), + REAL_CONST(94013.713028747632/8.0), + REAL_CONST(94037.061046707429/8.0), + REAL_CONST(94060.410513999494/8.0), + REAL_CONST(94083.761430443905/8.0), + REAL_CONST(94107.113795860845/8.0), + REAL_CONST(94130.467610070496/8.0), + REAL_CONST(94153.822872893157/8.0), + REAL_CONST(94177.179584149111/8.0), + REAL_CONST(94200.537743658759/8.0), + REAL_CONST(94223.897351242529/8.0), + REAL_CONST(94247.25840672091/8.0), + REAL_CONST(94270.620909914433/8.0), + REAL_CONST(94293.98486064373/8.0), + REAL_CONST(94317.350258729421/8.0), + REAL_CONST(94340.71710399224/8.0), + REAL_CONST(94364.085396252936/8.0), + REAL_CONST(94387.455135332348/8.0), + REAL_CONST(94410.82632105134/8.0), + REAL_CONST(94434.198953230851/8.0), + REAL_CONST(94457.573031691878/8.0), + REAL_CONST(94480.948556255447/8.0), + REAL_CONST(94504.325526742658/8.0), + REAL_CONST(94527.70394297468/8.0), + REAL_CONST(94551.083804772716/8.0), + REAL_CONST(94574.465111958023/8.0), + REAL_CONST(94597.847864351934/8.0), + REAL_CONST(94621.232061775823/8.0), + REAL_CONST(94644.617704051096/8.0), + REAL_CONST(94668.004790999272/8.0), + REAL_CONST(94691.393322441872/8.0), + REAL_CONST(94714.783298200506/8.0), + REAL_CONST(94738.174718096794/8.0), + REAL_CONST(94761.567581952477/8.0), + REAL_CONST(94784.961889589307/8.0), + REAL_CONST(94808.357640829097/8.0), + REAL_CONST(94831.754835493703/8.0), + REAL_CONST(94855.153473405066/8.0), + REAL_CONST(94878.553554385173/8.0), + REAL_CONST(94901.955078256055/8.0), + REAL_CONST(94925.358044839784/8.0), + REAL_CONST(94948.762453958523/8.0), + REAL_CONST(94972.168305434476/8.0), + REAL_CONST(94995.575599089891/8.0), + REAL_CONST(95018.984334747074/8.0), + REAL_CONST(95042.394512228391/8.0), + REAL_CONST(95065.806131356265/8.0), + REAL_CONST(95089.219191953176/8.0), + REAL_CONST(95112.633693841635/8.0), + REAL_CONST(95136.04963684424/8.0), + REAL_CONST(95159.467020783617/8.0), + REAL_CONST(95182.885845482466/8.0), + REAL_CONST(95206.306110763529/8.0), + REAL_CONST(95229.727816449609/8.0), + REAL_CONST(95253.150962363579/8.0), + REAL_CONST(95276.575548328314/8.0), + REAL_CONST(95300.001574166803/8.0), + REAL_CONST(95323.429039702052/8.0), + REAL_CONST(95346.857944757154/8.0), + REAL_CONST(95370.288289155214/8.0), + REAL_CONST(95393.720072719429/8.0), + REAL_CONST(95417.153295273019/8.0), + REAL_CONST(95440.587956639298/8.0), + REAL_CONST(95464.024056641589/8.0), + REAL_CONST(95487.461595103305/8.0), + REAL_CONST(95510.900571847902/8.0), + REAL_CONST(95534.340986698866/8.0), + REAL_CONST(95557.782839479783/8.0), + REAL_CONST(95581.226130014256/8.0), + REAL_CONST(95604.670858125959/8.0), + REAL_CONST(95628.117023638595/8.0), + REAL_CONST(95651.564626375985/8.0), + REAL_CONST(95675.013666161918/8.0), + REAL_CONST(95698.464142820303/8.0), + REAL_CONST(95721.916056175076/8.0), + REAL_CONST(95745.369406050231/8.0), + REAL_CONST(95768.824192269807/8.0), + REAL_CONST(95792.280414657915/8.0), + REAL_CONST(95815.738073038709/8.0), + REAL_CONST(95839.197167236387/8.0), + REAL_CONST(95862.657697075221/8.0), + REAL_CONST(95886.11966237954/8.0), + REAL_CONST(95909.583062973688/8.0), + REAL_CONST(95933.047898682111/8.0), + REAL_CONST(95956.514169329268/8.0), + REAL_CONST(95979.981874739708/8.0), + REAL_CONST(96003.451014738006/8.0), + REAL_CONST(96026.921589148798/8.0), + REAL_CONST(96050.393597796792/8.0), + REAL_CONST(96073.867040506724/8.0), + REAL_CONST(96097.341917103375/8.0), + REAL_CONST(96120.818227411626/8.0), + REAL_CONST(96144.295971256375/8.0), + REAL_CONST(96167.775148462577/8.0), + REAL_CONST(96191.255758855244/8.0), + REAL_CONST(96214.737802259449/8.0), + REAL_CONST(96238.221278500292/8.0), + REAL_CONST(96261.70618740299/8.0), + REAL_CONST(96285.192528792715/8.0), + REAL_CONST(96308.680302494788/8.0), + REAL_CONST(96332.169508334526/8.0), + REAL_CONST(96355.660146137321/8.0), + REAL_CONST(96379.152215728609/8.0), + REAL_CONST(96402.645716933868/8.0), + REAL_CONST(96426.14064957868/8.0), + REAL_CONST(96449.637013488609/8.0), + REAL_CONST(96473.134808489311/8.0), + REAL_CONST(96496.63403440651/8.0), + REAL_CONST(96520.134691065963/8.0), + REAL_CONST(96543.636778293469/8.0), + REAL_CONST(96567.140295914898/8.0), + REAL_CONST(96590.645243756153/8.0), + REAL_CONST(96614.151621643221/8.0), + REAL_CONST(96637.659429402134/8.0), + REAL_CONST(96661.168666858954/8.0), + REAL_CONST(96684.679333839798/8.0), + REAL_CONST(96708.191430170875/8.0), + REAL_CONST(96731.70495567839/8.0), + REAL_CONST(96755.219910188665/8.0), + REAL_CONST(96778.736293528011/8.0), + REAL_CONST(96802.254105522836/8.0), + REAL_CONST(96825.77334599958/8.0), + REAL_CONST(96849.29401478474/8.0), + REAL_CONST(96872.816111704873/8.0), + REAL_CONST(96896.339636586577/8.0), + REAL_CONST(96919.864589256511/8.0), + REAL_CONST(96943.390969541389/8.0), + REAL_CONST(96966.918777267958/8.0), + REAL_CONST(96990.448012263048/8.0), + REAL_CONST(97013.978674353522/8.0), + REAL_CONST(97037.510763366285/8.0), + REAL_CONST(97061.044279128328/8.0), + REAL_CONST(97084.579221466673/8.0), + REAL_CONST(97108.115590208385/8.0), + REAL_CONST(97131.653385180587/8.0), + REAL_CONST(97155.19260621049/8.0), + REAL_CONST(97178.733253125291/8.0), + REAL_CONST(97202.2753257523/8.0), + REAL_CONST(97225.81882391886/8.0), + REAL_CONST(97249.363747452342/8.0), + REAL_CONST(97272.910096180189/8.0), + REAL_CONST(97296.457869929916/8.0), + REAL_CONST(97320.007068529041/8.0), + REAL_CONST(97343.557691805196/8.0), + REAL_CONST(97367.109739586012/8.0), + REAL_CONST(97390.663211699197/8.0), + REAL_CONST(97414.218107972498/8.0), + REAL_CONST(97437.774428233737/8.0), + REAL_CONST(97461.332172310766/8.0), + REAL_CONST(97484.891340031507/8.0), + REAL_CONST(97508.451931223899/8.0), + REAL_CONST(97532.013945715982/8.0), + REAL_CONST(97555.577383335811/8.0), + REAL_CONST(97579.142243911512/8.0), + REAL_CONST(97602.708527271257/8.0), + REAL_CONST(97626.276233243261/8.0), + REAL_CONST(97649.845361655811/8.0), + REAL_CONST(97673.415912337223/8.0), + REAL_CONST(97696.987885115886/8.0), + REAL_CONST(97720.561279820206/8.0), + REAL_CONST(97744.1360962787/8.0), + REAL_CONST(97767.712334319876/8.0), + REAL_CONST(97791.289993772341/8.0), + REAL_CONST(97814.869074464703/8.0), + REAL_CONST(97838.449576225685/8.0), + REAL_CONST(97862.031498883996/8.0), + REAL_CONST(97885.614842268449/8.0), + REAL_CONST(97909.199606207883/8.0), + REAL_CONST(97932.785790531183/8.0), + REAL_CONST(97956.37339506732/8.0), + REAL_CONST(97979.962419645264/8.0), + REAL_CONST(98003.552864094076/8.0), + REAL_CONST(98027.144728242856/8.0), + REAL_CONST(98050.738011920766/8.0), + REAL_CONST(98074.332714956996/8.0), + REAL_CONST(98097.928837180807/8.0), + REAL_CONST(98121.526378421506/8.0), + REAL_CONST(98145.125338508456/8.0), + REAL_CONST(98168.725717271067/8.0), + REAL_CONST(98192.327514538789/8.0), + REAL_CONST(98215.930730141132/8.0), + REAL_CONST(98239.535363907664/8.0), + REAL_CONST(98263.141415668011/8.0), + REAL_CONST(98286.748885251814/8.0), + REAL_CONST(98310.357772488816/8.0), + REAL_CONST(98333.968077208759/8.0), + REAL_CONST(98357.579799241488/8.0), + REAL_CONST(98381.192938416847/8.0), + REAL_CONST(98404.807494564782/8.0), + REAL_CONST(98428.42346751524/8.0), + REAL_CONST(98452.040857098269/8.0), + REAL_CONST(98475.659663143917/8.0), + REAL_CONST(98499.27988548232/8.0), + REAL_CONST(98522.901523943656/8.0), + REAL_CONST(98546.524578358163/8.0), + REAL_CONST(98570.149048556093/8.0), + REAL_CONST(98593.774934367786/8.0), + REAL_CONST(98617.402235623624/8.0), + REAL_CONST(98641.030952154048/8.0), + REAL_CONST(98664.661083789513/8.0), + REAL_CONST(98688.292630360564/8.0), + REAL_CONST(98711.925591697771/8.0), + REAL_CONST(98735.559967631794/8.0), + REAL_CONST(98759.195757993293/8.0), + REAL_CONST(98782.832962613014/8.0), + REAL_CONST(98806.471581321734/8.0), + REAL_CONST(98830.111613950285/8.0), + REAL_CONST(98853.753060329575/8.0), + REAL_CONST(98877.39592029051/8.0), + REAL_CONST(98901.040193664099/8.0), + REAL_CONST(98924.68588028138/8.0), + REAL_CONST(98948.33297997342/8.0), + REAL_CONST(98971.981492571387/8.0), + REAL_CONST(98995.63141790645/8.0), + REAL_CONST(99019.282755809851/8.0), + REAL_CONST(99042.935506112874/8.0), + REAL_CONST(99066.589668646877/8.0), + REAL_CONST(99090.245243243233/8.0), + REAL_CONST(99113.902229733401/8.0), + REAL_CONST(99137.560627948857/8.0), + REAL_CONST(99161.220437721131/8.0), + REAL_CONST(99184.881658881859/8.0), + REAL_CONST(99208.544291262631/8.0), + REAL_CONST(99232.208334695169/8.0), + REAL_CONST(99255.87378901121/8.0), + REAL_CONST(99279.540654042547/8.0), + REAL_CONST(99303.208929621018/8.0), + REAL_CONST(99326.878615578535/8.0), + REAL_CONST(99350.549711746993/8.0), + REAL_CONST(99374.222217958435/8.0), + REAL_CONST(99397.896134044888/8.0), + REAL_CONST(99421.571459838422/8.0), + REAL_CONST(99445.248195171211/8.0), + REAL_CONST(99468.926339875441/8.0), + REAL_CONST(99492.605893783344/8.0), + REAL_CONST(99516.286856727209/8.0), + REAL_CONST(99539.969228539398/8.0), + REAL_CONST(99563.653009052287/8.0), + REAL_CONST(99587.338198098325/8.0), + REAL_CONST(99611.024795510006/8.0), + REAL_CONST(99634.712801119866/8.0), + REAL_CONST(99658.402214760499/8.0), + REAL_CONST(99682.093036264545/8.0), + REAL_CONST(99705.785265464699/8.0), + REAL_CONST(99729.478902193689/8.0), + REAL_CONST(99753.173946284325/8.0), + REAL_CONST(99776.870397569437/8.0), + REAL_CONST(99800.56825588191/8.0), + REAL_CONST(99824.267521054688/8.0), + REAL_CONST(99847.968192920773/8.0), + REAL_CONST(99871.670271313182/8.0), + REAL_CONST(99895.373756065004/8.0), + REAL_CONST(99919.078647009388/8.0), + REAL_CONST(99942.78494397951/8.0), + REAL_CONST(99966.492646808634/8.0), + REAL_CONST(99990.20175533001/8.0), + REAL_CONST(100013.91226937699/8.0), + REAL_CONST(100037.62418878295/8.0), + REAL_CONST(100061.33751338134/8.0), + REAL_CONST(100085.05224300563/8.0), + REAL_CONST(100108.76837748935/8.0), + REAL_CONST(100132.4859166661/8.0), + REAL_CONST(100156.2048603695/8.0), + REAL_CONST(100179.92520843323/8.0), + REAL_CONST(100203.64696069101/8.0), + REAL_CONST(100227.37011697664/8.0), + REAL_CONST(100251.09467712394/8.0), + REAL_CONST(100274.82064096678/8.0), + REAL_CONST(100298.54800833909/8.0), + REAL_CONST(100322.27677907483/8.0), + REAL_CONST(100346.00695300807/8.0), + REAL_CONST(100369.73852997283/8.0), + REAL_CONST(100393.47150980328/8.0), + REAL_CONST(100417.20589233354/8.0), + REAL_CONST(100440.94167739789/8.0), + REAL_CONST(100464.67886483055/8.0), + REAL_CONST(100488.41745446586/8.0), + REAL_CONST(100512.1574461382/8.0), + REAL_CONST(100535.89883968196/8.0), + REAL_CONST(100559.64163493161/8.0), + REAL_CONST(100583.38583172169/8.0), + REAL_CONST(100607.13142988674/8.0), + REAL_CONST(100630.87842926137/8.0), + REAL_CONST(100654.62682968024/8.0), + REAL_CONST(100678.37663097809/8.0), + REAL_CONST(100702.12783298964/8.0), + REAL_CONST(100725.88043554971/8.0), + REAL_CONST(100749.63443849317/8.0), + REAL_CONST(100773.38984165489/8.0), + REAL_CONST(100797.14664486986/8.0), + REAL_CONST(100820.90484797307/8.0), + REAL_CONST(100844.66445079957/8.0), + REAL_CONST(100868.42545318443/8.0), + REAL_CONST(100892.18785496285/8.0), + REAL_CONST(100915.95165596998/8.0), + REAL_CONST(100939.71685604109/8.0), + REAL_CONST(100963.48345501146/8.0), + REAL_CONST(100987.25145271645/8.0), + REAL_CONST(101011.02084899142/8.0), + REAL_CONST(101034.79164367182/8.0), + REAL_CONST(101058.56383659317/8.0), + REAL_CONST(101082.33742759094/8.0), + REAL_CONST(101106.11241650078/8.0), + REAL_CONST(101129.88880315828/8.0), + REAL_CONST(101153.66658739912/8.0), + REAL_CONST(101177.44576905905/8.0), + REAL_CONST(101201.22634797383/8.0), + REAL_CONST(101225.00832397929/8.0), + REAL_CONST(101248.7916969113/8.0), + REAL_CONST(101272.57646660579/8.0), + REAL_CONST(101296.36263289873/8.0), + REAL_CONST(101320.15019562612/8.0), + REAL_CONST(101343.93915462404/8.0), + REAL_CONST(101367.7295097286/8.0), + REAL_CONST(101391.52126077596/8.0), + REAL_CONST(101415.31440760233/8.0), + REAL_CONST(101439.10895004397/8.0), + REAL_CONST(101462.9048879372/8.0), + REAL_CONST(101486.70222111834/8.0), + REAL_CONST(101510.50094942382/8.0), + REAL_CONST(101534.30107269008/8.0), + REAL_CONST(101558.10259075361/8.0), + REAL_CONST(101581.90550345098/8.0), + REAL_CONST(101605.70981061876/8.0), + REAL_CONST(101629.5155120936/8.0), + REAL_CONST(101653.32260771218/8.0), + REAL_CONST(101677.13109731126/8.0), + REAL_CONST(101700.9409807276/8.0), + REAL_CONST(101724.75225779804/8.0), + REAL_CONST(101748.56492835947/8.0), + REAL_CONST(101772.37899224881/8.0), + REAL_CONST(101796.19444930303/8.0), + REAL_CONST(101820.01129935916/8.0), + REAL_CONST(101843.82954225427/8.0), + REAL_CONST(101867.64917782549/8.0), + REAL_CONST(101891.47020590997/8.0), + REAL_CONST(101915.29262634492/8.0), + REAL_CONST(101939.11643896763/8.0), + REAL_CONST(101962.94164361537/8.0), + REAL_CONST(101986.76824012553/8.0), + REAL_CONST(102010.59622833549/8.0), + REAL_CONST(102034.42560808272/8.0), + REAL_CONST(102058.25637920471/8.0), + REAL_CONST(102082.08854153901/8.0), + REAL_CONST(102105.9220949232/8.0), + REAL_CONST(102129.75703919494/8.0), + REAL_CONST(102153.59337419191/8.0), + REAL_CONST(102177.43109975185/8.0), + REAL_CONST(102201.27021571253/8.0), + REAL_CONST(102225.1107219118/8.0), + REAL_CONST(102248.95261818753/8.0), + REAL_CONST(102272.79590437764/8.0), + REAL_CONST(102296.64058032009/8.0), + REAL_CONST(102320.48664585294/8.0), + REAL_CONST(102344.33410081422/8.0), + REAL_CONST(102368.18294504205/8.0), + REAL_CONST(102392.03317837461/8.0), + REAL_CONST(102415.88480065008/8.0), + REAL_CONST(102439.73781170673/8.0), + REAL_CONST(102463.59221138287/8.0), + REAL_CONST(102487.44799951684/8.0), + REAL_CONST(102511.30517594704/8.0), + REAL_CONST(102535.1637405119/8.0), + REAL_CONST(102559.02369304992/8.0), + REAL_CONST(102582.88503339965/8.0), + REAL_CONST(102606.74776139967/8.0), + REAL_CONST(102630.61187688859/8.0), + REAL_CONST(102654.4773797051/8.0), + REAL_CONST(102678.34426968795/8.0), + REAL_CONST(102702.21254667587/8.0), + REAL_CONST(102726.08221050771/8.0), + REAL_CONST(102749.95326102231/8.0), + REAL_CONST(102773.8256980586/8.0), + REAL_CONST(102797.69952145554/8.0), + REAL_CONST(102821.57473105213/8.0), + REAL_CONST(102845.45132668741/8.0), + REAL_CONST(102869.32930820051/8.0), + REAL_CONST(102893.20867543056/8.0), + REAL_CONST(102917.08942821674/8.0), + REAL_CONST(102940.97156639832/8.0), + REAL_CONST(102964.85508981455/8.0), + REAL_CONST(102988.73999830478/8.0), + REAL_CONST(103012.6262917084/8.0), + REAL_CONST(103036.51396986481/8.0), + REAL_CONST(103060.40303261351/8.0), + REAL_CONST(103084.293479794/8.0), + REAL_CONST(103108.18531124585/8.0), + REAL_CONST(103132.07852680866/8.0), + REAL_CONST(103155.97312632212/8.0), + REAL_CONST(103179.8691096259/8.0), + REAL_CONST(103203.76647655977/8.0), + REAL_CONST(103227.66522696352/8.0), + REAL_CONST(103251.56536067701/8.0), + REAL_CONST(103275.46687754011/8.0), + REAL_CONST(103299.36977739276/8.0), + REAL_CONST(103323.27406007495/8.0), + REAL_CONST(103347.1797254267/8.0), + REAL_CONST(103371.0867732881/8.0), + REAL_CONST(103394.99520349925/8.0), + REAL_CONST(103418.90501590034/8.0), + REAL_CONST(103442.81621033157/8.0), + REAL_CONST(103466.72878663319/8.0), + REAL_CONST(103490.64274464553/8.0), + REAL_CONST(103514.55808420894/8.0), + REAL_CONST(103538.4748051638/8.0), + REAL_CONST(103562.39290735057/8.0), + REAL_CONST(103586.31239060973/8.0), + REAL_CONST(103610.23325478184/8.0), + REAL_CONST(103634.15549970744/8.0), + REAL_CONST(103658.07912522719/8.0), + REAL_CONST(103682.00413118176/8.0), + REAL_CONST(103705.93051741188/8.0), + REAL_CONST(103729.85828375829/8.0), + REAL_CONST(103753.78743006183/8.0), + REAL_CONST(103777.71795616332/8.0), + REAL_CONST(103801.64986190372/8.0), + REAL_CONST(103825.58314712394/8.0), + REAL_CONST(103849.51781166498/8.0), + REAL_CONST(103873.4538553679/8.0), + REAL_CONST(103897.39127807376/8.0), + REAL_CONST(103921.33007962372/8.0), + REAL_CONST(103945.27025985894/8.0), + REAL_CONST(103969.21181862066/8.0), + REAL_CONST(103993.15475575015/8.0), + REAL_CONST(104017.0990710887/8.0), + REAL_CONST(104041.0447644777/8.0), + REAL_CONST(104064.99183575854/8.0), + REAL_CONST(104088.94028477269/8.0), + REAL_CONST(104112.89011136163/8.0), + REAL_CONST(104136.84131536692/8.0), + REAL_CONST(104160.79389663014/8.0), + REAL_CONST(104184.74785499295/8.0), + REAL_CONST(104208.70319029699/8.0), + REAL_CONST(104232.65990238401/8.0), + REAL_CONST(104256.61799109577/8.0), + REAL_CONST(104280.57745627411/8.0), + REAL_CONST(104304.53829776087/8.0), + REAL_CONST(104328.50051539797/8.0), + REAL_CONST(104352.46410902737/8.0), + REAL_CONST(104376.42907849104/8.0), + REAL_CONST(104400.39542363105/8.0), + REAL_CONST(104424.36314428948/8.0), + REAL_CONST(104448.33224030846/8.0), + REAL_CONST(104472.3027115302/8.0), + REAL_CONST(104496.27455779689/8.0), + REAL_CONST(104520.24777895081/8.0), + REAL_CONST(104544.22237483428/8.0), + REAL_CONST(104568.19834528965/8.0), + REAL_CONST(104592.17569015936/8.0), + REAL_CONST(104616.15440928582/8.0), + REAL_CONST(104640.13450251156/8.0), + REAL_CONST(104664.1159696791/8.0), + REAL_CONST(104688.09881063103/8.0), + REAL_CONST(104712.08302520998/8.0), + REAL_CONST(104736.06861325864/8.0), + REAL_CONST(104760.05557461972/8.0), + REAL_CONST(104784.043909136/8.0), + REAL_CONST(104808.03361665027/8.0), + REAL_CONST(104832.0246970054/8.0), + REAL_CONST(104856.01715004431/8.0), + REAL_CONST(104880.01097560991/8.0), + REAL_CONST(104904.00617354522/8.0), + REAL_CONST(104928.00274369326/8.0), + REAL_CONST(104952.00068589712/8.0), + REAL_CONST(104975.99999999993/8.0), + REAL_CONST(105000.00068584486/8.0), + REAL_CONST(105024.00274327511/8.0), + REAL_CONST(105048.00617213396/8.0), + REAL_CONST(105072.0109722647/8.0), + REAL_CONST(105096.0171435107/8.0), + REAL_CONST(105120.02468571534/8.0), + REAL_CONST(105144.03359872208/8.0), + REAL_CONST(105168.04388237436/8.0), + REAL_CONST(105192.05553651576/8.0), + REAL_CONST(105216.06856098982/8.0), + REAL_CONST(105240.08295564017/8.0), + REAL_CONST(105264.09872031047/8.0), + REAL_CONST(105288.11585484444/8.0), + REAL_CONST(105312.13435908582/8.0), + REAL_CONST(105336.1542328784/8.0), + REAL_CONST(105360.17547606604/8.0), + REAL_CONST(105384.19808849262/8.0), + REAL_CONST(105408.22207000206/8.0), + REAL_CONST(105432.24742043833/8.0), + REAL_CONST(105456.27413964548/8.0), + REAL_CONST(105480.30222746753/8.0), + REAL_CONST(105504.33168374863/8.0), + REAL_CONST(105528.36250833291/8.0), + REAL_CONST(105552.39470106458/8.0), + REAL_CONST(105576.42826178786/8.0), + REAL_CONST(105600.46319034706/8.0), + REAL_CONST(105624.49948658649/8.0), + REAL_CONST(105648.53715035053/8.0), + REAL_CONST(105672.5761814836/8.0), + REAL_CONST(105696.61657983017/8.0), + REAL_CONST(105720.65834523473/8.0), + REAL_CONST(105744.70147754184/8.0), + REAL_CONST(105768.7459765961/8.0), + REAL_CONST(105792.79184224214/8.0), + REAL_CONST(105816.83907432464/8.0), + REAL_CONST(105840.88767268835/8.0), + REAL_CONST(105864.93763717801/8.0), + REAL_CONST(105888.98896763846/8.0), + REAL_CONST(105913.04166391456/8.0), + REAL_CONST(105937.09572585119/8.0), + REAL_CONST(105961.15115329332/8.0), + REAL_CONST(105985.20794608595/8.0), + REAL_CONST(106009.26610407409/8.0), + REAL_CONST(106033.32562710284/8.0), + REAL_CONST(106057.38651501729/8.0), + REAL_CONST(106081.44876766266/8.0), + REAL_CONST(106105.51238488412/8.0), + REAL_CONST(106129.57736652695/8.0), + REAL_CONST(106153.64371243643/8.0), + REAL_CONST(106177.71142245791/8.0), + REAL_CONST(106201.78049643678/8.0), + REAL_CONST(106225.85093421848/8.0), + REAL_CONST(106249.92273564848/8.0), + REAL_CONST(106273.99590057228/8.0), + REAL_CONST(106298.07042883546/8.0), + REAL_CONST(106322.14632028362/8.0), + REAL_CONST(106346.22357476239/8.0), + REAL_CONST(106370.30219211751/8.0), + REAL_CONST(106394.38217219469/8.0), + REAL_CONST(106418.46351483969/8.0), + REAL_CONST(106442.54621989837/8.0), + REAL_CONST(106466.63028721658/8.0), + REAL_CONST(106490.71571664025/8.0), + REAL_CONST(106514.80250801529/8.0), + REAL_CONST(106538.89066118775/8.0), + REAL_CONST(106562.98017600364/8.0), + REAL_CONST(106587.07105230905/8.0), + REAL_CONST(106611.16328995011/8.0), + REAL_CONST(106635.25688877302/8.0), + REAL_CONST(106659.35184862395/8.0), + REAL_CONST(106683.44816934918/8.0), + REAL_CONST(106707.54585079502/8.0), + REAL_CONST(106731.64489280782/8.0), + REAL_CONST(106755.74529523395/8.0), + REAL_CONST(106779.84705791986/8.0), + REAL_CONST(106803.95018071201/8.0), + REAL_CONST(106828.05466345693/8.0), + REAL_CONST(106852.16050600118/8.0), + REAL_CONST(106876.26770819137/8.0), + REAL_CONST(106900.37626987413/8.0), + REAL_CONST(106924.48619089619/8.0), + REAL_CONST(106948.59747110425/8.0), + REAL_CONST(106972.71011034511/8.0), + REAL_CONST(106996.82410846559/8.0), + REAL_CONST(107020.93946531253/8.0), + REAL_CONST(107045.05618073288/8.0), + REAL_CONST(107069.17425457356/8.0), + REAL_CONST(107093.29368668159/8.0), + REAL_CONST(107117.41447690397/8.0), + REAL_CONST(107141.53662508781/8.0), + REAL_CONST(107165.66013108024/8.0), + REAL_CONST(107189.7849947284/8.0), + REAL_CONST(107213.91121587952/8.0), + REAL_CONST(107238.03879438085/8.0), + REAL_CONST(107262.16773007967/8.0), + REAL_CONST(107286.29802282334/8.0), + REAL_CONST(107310.42967245923/8.0), + REAL_CONST(107334.56267883476/8.0), + REAL_CONST(107358.69704179741/8.0), + REAL_CONST(107382.83276119467/8.0), + REAL_CONST(107406.96983687414/8.0), + REAL_CONST(107431.10826868335/8.0), + REAL_CONST(107455.24805646999/8.0), + REAL_CONST(107479.38920008171/8.0), + REAL_CONST(107503.53169936626/8.0), + REAL_CONST(107527.67555417139/8.0), + REAL_CONST(107551.82076434491/8.0), + REAL_CONST(107575.96732973469/8.0), + REAL_CONST(107600.11525018861/8.0), + REAL_CONST(107624.26452555459/8.0), + REAL_CONST(107648.41515568066/8.0), + REAL_CONST(107672.56714041479/8.0), + REAL_CONST(107696.72047960508/8.0), + REAL_CONST(107720.87517309963/8.0), + REAL_CONST(107745.03122074658/8.0), + REAL_CONST(107769.18862239413/8.0), + REAL_CONST(107793.34737789053/8.0), + REAL_CONST(107817.50748708403/8.0), + REAL_CONST(107841.66894982298/8.0), + REAL_CONST(107865.83176595572/8.0), + REAL_CONST(107889.99593533068/8.0), + REAL_CONST(107914.16145779629/8.0), + REAL_CONST(107938.32833320105/8.0), + REAL_CONST(107962.49656139348/8.0), + REAL_CONST(107986.66614222217/8.0), + REAL_CONST(108010.83707553572/8.0), + REAL_CONST(108035.00936118282/8.0), + REAL_CONST(108059.18299901215/8.0), + REAL_CONST(108083.35798887245/8.0), + REAL_CONST(108107.53433061253/8.0), + REAL_CONST(108131.71202408121/8.0), + REAL_CONST(108155.89106912735/8.0), + REAL_CONST(108180.07146559987/8.0), + REAL_CONST(108204.25321334775/8.0), + REAL_CONST(108228.43631221994/8.0), + REAL_CONST(108252.62076206553/8.0), + REAL_CONST(108276.80656273357/8.0), + REAL_CONST(108300.99371407321/8.0), + REAL_CONST(108325.18221593359/8.0), + REAL_CONST(108349.37206816394/8.0), + REAL_CONST(108373.56327061349/8.0), + REAL_CONST(108397.75582313156/8.0), + REAL_CONST(108421.94972556747/8.0), + REAL_CONST(108446.1449777706/8.0), + REAL_CONST(108470.34157959036/8.0), + REAL_CONST(108494.53953087622/8.0), + REAL_CONST(108518.73883147769/8.0), + REAL_CONST(108542.93948124432/8.0), + REAL_CONST(108567.14148002568/8.0), + REAL_CONST(108591.34482767139/8.0), + REAL_CONST(108615.54952403114/8.0), + REAL_CONST(108639.75556895464/8.0), + REAL_CONST(108663.96296229165/8.0), + REAL_CONST(108688.17170389196/8.0), + REAL_CONST(108712.38179360541/8.0), + REAL_CONST(108736.59323128188/8.0), + REAL_CONST(108760.80601677128/8.0), + REAL_CONST(108785.02014992358/8.0), + REAL_CONST(108809.23563058881/8.0), + REAL_CONST(108833.45245861699/8.0), + REAL_CONST(108857.67063385822/8.0), + REAL_CONST(108881.89015616261/8.0), + REAL_CONST(108906.11102538036/8.0), + REAL_CONST(108930.33324136167/8.0), + REAL_CONST(108954.55680395682/8.0), + REAL_CONST(108978.78171301607/8.0), + REAL_CONST(109003.00796838976/8.0), + REAL_CONST(109027.23556992831/8.0), + REAL_CONST(109051.46451748211/8.0), + REAL_CONST(109075.69481090162/8.0), + REAL_CONST(109099.92645003737/8.0), + REAL_CONST(109124.15943473989/8.0), + REAL_CONST(109148.39376485976/8.0), + REAL_CONST(109172.62944024763/8.0), + REAL_CONST(109196.86646075416/8.0), + REAL_CONST(109221.10482623006/8.0), + REAL_CONST(109245.34453652608/8.0), + REAL_CONST(109269.58559149304/8.0), + REAL_CONST(109293.82799098175/8.0), + REAL_CONST(109318.07173484311/8.0), + REAL_CONST(109342.31682292801/8.0), + REAL_CONST(109366.56325508743/8.0), + REAL_CONST(109390.81103117237/8.0), + REAL_CONST(109415.06015103387/8.0), + REAL_CONST(109439.31061452301/8.0), + REAL_CONST(109463.56242149093/8.0), + REAL_CONST(109487.8155717888/8.0), + REAL_CONST(109512.07006526781/8.0), + REAL_CONST(109536.3259017792/8.0), + REAL_CONST(109560.58308117429/8.0), + REAL_CONST(109584.8416033044/8.0), + REAL_CONST(109609.1014680209/8.0), + REAL_CONST(109633.36267517522/8.0), + REAL_CONST(109657.62522461878/8.0), + REAL_CONST(109681.88911620311/8.0), + REAL_CONST(109706.15434977971/8.0), + REAL_CONST(109730.4209252002/8.0), + REAL_CONST(109754.68884231619/8.0), + REAL_CONST(109778.95810097932/8.0), + REAL_CONST(109803.22870104131/8.0), + REAL_CONST(109827.50064235389/8.0), + REAL_CONST(109851.77392476884/8.0), + REAL_CONST(109876.04854813802/8.0), + REAL_CONST(109900.32451231324/8.0), + REAL_CONST(109924.60181714644/8.0), + REAL_CONST(109948.88046248957/8.0), + REAL_CONST(109973.1604481946/8.0), + REAL_CONST(109997.44177411357/8.0), + REAL_CONST(110021.72444009855/8.0), + REAL_CONST(110046.00844600165/8.0), + REAL_CONST(110070.29379167501/8.0), + REAL_CONST(110094.58047697082/8.0), + REAL_CONST(110118.86850174134/8.0), + REAL_CONST(110143.15786583882/8.0), + REAL_CONST(110167.44856911557/8.0), + REAL_CONST(110191.74061142397/8.0), + REAL_CONST(110216.03399261639/8.0), + REAL_CONST(110240.32871254528/8.0), + REAL_CONST(110264.62477106311/8.0), + REAL_CONST(110288.9221680224/8.0), + REAL_CONST(110313.22090327571/8.0), + REAL_CONST(110337.52097667565/8.0), + REAL_CONST(110361.82238807483/8.0), + REAL_CONST(110386.12513732594/8.0), + REAL_CONST(110410.42922428172/8.0), + REAL_CONST(110434.73464879491/8.0), + REAL_CONST(110459.04141071832/8.0), + REAL_CONST(110483.34950990479/8.0), + REAL_CONST(110507.6589462072/8.0), + REAL_CONST(110531.96971947847/8.0), + REAL_CONST(110556.28182957157/8.0), + REAL_CONST(110580.5952763395/8.0), + REAL_CONST(110604.91005963532/8.0), + REAL_CONST(110629.22617931209/8.0), + REAL_CONST(110653.54363522294/8.0), + REAL_CONST(110677.86242722106/8.0), + REAL_CONST(110702.18255515963/8.0), + REAL_CONST(110726.50401889188/8.0), + REAL_CONST(110750.82681827113/8.0), + REAL_CONST(110775.1509531507/8.0), + REAL_CONST(110799.47642338395/8.0), + REAL_CONST(110823.80322882428/8.0), + REAL_CONST(110848.13136932514/8.0), + REAL_CONST(110872.46084474004/8.0), + REAL_CONST(110896.79165492248/8.0), + REAL_CONST(110921.12379972603/8.0), + REAL_CONST(110945.4572790043/8.0), + REAL_CONST(110969.79209261097/8.0), + REAL_CONST(110994.12824039967/8.0), + REAL_CONST(111018.46572222417/8.0), + REAL_CONST(111042.80453793822/8.0), + REAL_CONST(111067.14468739564/8.0), + REAL_CONST(111091.48617045028/8.0), + REAL_CONST(111115.82898695602/8.0), + REAL_CONST(111140.1731367668/8.0), + REAL_CONST(111164.51861973655/8.0), + REAL_CONST(111188.86543571933/8.0), + REAL_CONST(111213.21358456917/8.0), + REAL_CONST(111237.56306614014/8.0), + REAL_CONST(111261.91388028639/8.0), + REAL_CONST(111286.26602686207/8.0), + REAL_CONST(111310.61950572141/8.0), + REAL_CONST(111334.97431671864/8.0), + REAL_CONST(111359.33045970804/8.0), + REAL_CONST(111383.68793454397/8.0), + REAL_CONST(111408.04674108078/8.0), + REAL_CONST(111432.40687917286/8.0), + REAL_CONST(111456.76834867468/8.0), + REAL_CONST(111481.13114944073/8.0), + REAL_CONST(111505.49528132551/8.0), + REAL_CONST(111529.86074418361/8.0), + REAL_CONST(111554.22753786964/8.0), + REAL_CONST(111578.59566223821/8.0), + REAL_CONST(111602.96511714405/8.0), + REAL_CONST(111627.33590244185/8.0), + REAL_CONST(111651.7080179864/8.0), + REAL_CONST(111676.08146363248/8.0), + REAL_CONST(111700.45623923496/8.0), + REAL_CONST(111724.8323446487/8.0), + REAL_CONST(111749.20977972864/8.0), + REAL_CONST(111773.58854432974/8.0), + REAL_CONST(111797.96863830699/8.0), + REAL_CONST(111822.35006151545/8.0), + REAL_CONST(111846.73281381019/8.0), + REAL_CONST(111871.11689504632/8.0), + REAL_CONST(111895.50230507903/8.0), + REAL_CONST(111919.8890437635/8.0), + REAL_CONST(111944.27711095495/8.0), + REAL_CONST(111968.6665065087/8.0), + REAL_CONST(111993.05723028004/8.0), + REAL_CONST(112017.44928212435/8.0), + REAL_CONST(112041.842661897/8.0), + REAL_CONST(112066.23736945343/8.0), + REAL_CONST(112090.63340464912/8.0), + REAL_CONST(112115.03076733962/8.0), + REAL_CONST(112139.42945738042/8.0), + REAL_CONST(112163.82947462716/8.0), + REAL_CONST(112188.23081893545/8.0), + REAL_CONST(112212.63349016097/8.0), + REAL_CONST(112237.03748815943/8.0), + REAL_CONST(112261.44281278658/8.0), + REAL_CONST(112285.84946389822/8.0), + REAL_CONST(112310.25744135017/8.0), + REAL_CONST(112334.66674499828/8.0), + REAL_CONST(112359.07737469849/8.0), + REAL_CONST(112383.48933030672/8.0), + REAL_CONST(112407.90261167898/8.0), + REAL_CONST(112432.31721867126/8.0), + REAL_CONST(112456.73315113965/8.0), + REAL_CONST(112481.15040894024/8.0), + REAL_CONST(112505.56899192919/8.0), + REAL_CONST(112529.98889996267/8.0), + REAL_CONST(112554.41013289688/8.0), + REAL_CONST(112578.8326905881/8.0), + REAL_CONST(112603.25657289263/8.0), + REAL_CONST(112627.68177966679/8.0), + REAL_CONST(112652.10831076698/8.0), + REAL_CONST(112676.53616604958/8.0), + REAL_CONST(112700.96534537108/8.0), + REAL_CONST(112725.39584858794/8.0), + REAL_CONST(112749.82767555672/8.0), + REAL_CONST(112774.26082613398/8.0), + REAL_CONST(112798.6953001763/8.0), + REAL_CONST(112823.13109754038/8.0), + REAL_CONST(112847.56821808286/8.0), + REAL_CONST(112872.00666166049/8.0), + REAL_CONST(112896.44642813003/8.0), + REAL_CONST(112920.88751734827/8.0), + REAL_CONST(112945.32992917208/8.0), + REAL_CONST(112969.77366345831/8.0), + REAL_CONST(112994.21872006389/8.0), + REAL_CONST(113018.66509884578/8.0), + REAL_CONST(113043.11279966099/8.0), + REAL_CONST(113067.56182236652/8.0), + REAL_CONST(113092.01216681948/8.0), + REAL_CONST(113116.46383287695/8.0), + REAL_CONST(113140.9168203961/8.0), + REAL_CONST(113165.37112923413/8.0), + REAL_CONST(113189.82675924824/8.0), + REAL_CONST(113214.28371029573/8.0), + REAL_CONST(113238.74198223387/8.0), + REAL_CONST(113263.20157492002/8.0), + REAL_CONST(113287.66248821157/8.0), + REAL_CONST(113312.12472196593/8.0), + REAL_CONST(113336.58827604055/8.0), + REAL_CONST(113361.05315029295/8.0), + REAL_CONST(113385.51934458067/8.0), + REAL_CONST(113409.98685876124/8.0), + REAL_CONST(113434.45569269233/8.0), + REAL_CONST(113458.92584623155/8.0), + REAL_CONST(113483.39731923661/8.0), + REAL_CONST(113507.87011156522/8.0), + REAL_CONST(113532.34422307517/8.0), + REAL_CONST(113556.81965362425/8.0), + REAL_CONST(113581.2964030703/8.0), + REAL_CONST(113605.77447127122/8.0), + REAL_CONST(113630.25385808491/8.0), + REAL_CONST(113654.73456336933/8.0), + REAL_CONST(113679.2165869825/8.0), + REAL_CONST(113703.69992878241/8.0), + REAL_CONST(113728.18458862718/8.0), + REAL_CONST(113752.67056637487/8.0), + REAL_CONST(113777.15786188368/8.0), + REAL_CONST(113801.64647501177/8.0), + REAL_CONST(113826.13640561736/8.0), + REAL_CONST(113850.62765355874/8.0), + REAL_CONST(113875.12021869418/8.0), + REAL_CONST(113899.61410088204/8.0), + REAL_CONST(113924.1092999807/8.0), + REAL_CONST(113948.60581584855/8.0), + REAL_CONST(113973.10364834407/8.0), + REAL_CONST(113997.60279732574/8.0), + REAL_CONST(114022.1032626521/8.0), + REAL_CONST(114046.60504418171/8.0), + REAL_CONST(114071.10814177318/8.0), + REAL_CONST(114095.61255528514/8.0), + REAL_CONST(114120.11828457628/8.0), + REAL_CONST(114144.62532950533/8.0), + REAL_CONST(114169.13368993104/8.0), + REAL_CONST(114193.6433657122/8.0), + REAL_CONST(114218.15435670764/8.0), + REAL_CONST(114242.66666277625/8.0), + REAL_CONST(114267.18028377694/8.0), + REAL_CONST(114291.69521956862/8.0), + REAL_CONST(114316.21147001031/8.0), + REAL_CONST(114340.72903496103/8.0), + REAL_CONST(114365.24791427983/8.0), + REAL_CONST(114389.7681078258/8.0), + REAL_CONST(114414.2896154581/8.0), + REAL_CONST(114438.81243703589/8.0), + REAL_CONST(114463.33657241837/8.0), + REAL_CONST(114487.8620214648/8.0), + REAL_CONST(114512.38878403447/8.0), + REAL_CONST(114536.91685998671/8.0), + REAL_CONST(114561.44624918087/8.0), + REAL_CONST(114585.97695147636/8.0), + REAL_CONST(114610.5089667326/8.0), + REAL_CONST(114635.04229480909/8.0), + REAL_CONST(114659.57693556532/8.0), + REAL_CONST(114684.11288886084/8.0), + REAL_CONST(114708.65015455526/8.0), + REAL_CONST(114733.18873250818/8.0), + REAL_CONST(114757.72862257928/8.0), + REAL_CONST(114782.26982462825/8.0), + REAL_CONST(114806.81233851484/8.0), + REAL_CONST(114831.35616409882/8.0), + REAL_CONST(114855.90130123998/8.0), + REAL_CONST(114880.44774979822/8.0), + REAL_CONST(114904.99550963337/8.0), + REAL_CONST(114929.5445806054/8.0), + REAL_CONST(114954.09496257425/8.0), + REAL_CONST(114978.64665539992/8.0), + REAL_CONST(115003.19965894247/8.0), + REAL_CONST(115027.75397306195/8.0), + REAL_CONST(115052.30959761847/8.0), + REAL_CONST(115076.86653247218/8.0), + REAL_CONST(115101.42477748329/8.0), + REAL_CONST(115125.984332512/8.0), + REAL_CONST(115150.54519741859/8.0), + REAL_CONST(115175.10737206334/8.0), + REAL_CONST(115199.67085630659/8.0), + REAL_CONST(115224.23565000873/8.0), + REAL_CONST(115248.80175303014/8.0), + REAL_CONST(115273.3691652313/8.0), + REAL_CONST(115297.93788647266/8.0), + REAL_CONST(115322.50791661476/8.0), + REAL_CONST(115347.07925551817/8.0), + REAL_CONST(115371.65190304347/8.0), + REAL_CONST(115396.22585905129/8.0), + REAL_CONST(115420.80112340231/8.0), + REAL_CONST(115445.37769595724/8.0), + REAL_CONST(115469.95557657682/8.0), + REAL_CONST(115494.53476512182/8.0), + REAL_CONST(115519.11526145306/8.0), + REAL_CONST(115543.69706543141/8.0), + REAL_CONST(115568.28017691776/8.0), + REAL_CONST(115592.86459577303/8.0), + REAL_CONST(115617.4503218582/8.0), + REAL_CONST(115642.03735503425/8.0), + REAL_CONST(115666.62569516223/8.0), + REAL_CONST(115691.21534210323/8.0), + REAL_CONST(115715.80629571836/8.0), + REAL_CONST(115740.39855586876/8.0), + REAL_CONST(115764.99212241563/8.0), + REAL_CONST(115789.58699522018/8.0), + REAL_CONST(115814.18317414368/8.0), + REAL_CONST(115838.78065904744/8.0), + REAL_CONST(115863.37944979276/8.0), + REAL_CONST(115887.97954624105/8.0), + REAL_CONST(115912.5809482537/8.0), + REAL_CONST(115937.18365569216/8.0), + REAL_CONST(115961.78766841792/8.0), + REAL_CONST(115986.39298629249/8.0), + REAL_CONST(116010.99960917742/8.0), + REAL_CONST(116035.60753693432/8.0), + REAL_CONST(116060.21676942479/8.0), + REAL_CONST(116084.82730651053/8.0), + REAL_CONST(116109.43914805322/8.0), + REAL_CONST(116134.0522939146/8.0), + REAL_CONST(116158.66674395646/8.0), + REAL_CONST(116183.2824980406/8.0), + REAL_CONST(116207.89955602887/8.0), + REAL_CONST(116232.51791778316/8.0), + REAL_CONST(116257.13758316539/8.0), + REAL_CONST(116281.75855203751/8.0), + REAL_CONST(116306.38082426153/8.0), + REAL_CONST(116331.00439969949/8.0), + REAL_CONST(116355.62927821343/8.0), + REAL_CONST(116380.25545966547/8.0), + REAL_CONST(116404.88294391775/8.0), + REAL_CONST(116429.51173083246/8.0), + REAL_CONST(116454.14182027178/8.0), + REAL_CONST(116478.77321209799/8.0), + REAL_CONST(116503.40590617337/8.0), + REAL_CONST(116528.03990236025/8.0), + REAL_CONST(116552.67520052097/8.0), + REAL_CONST(116577.31180051794/8.0), + REAL_CONST(116601.94970221359/8.0), + REAL_CONST(116626.5889054704/8.0), + REAL_CONST(116651.22941015086/8.0), + REAL_CONST(116675.87121611751/8.0), + REAL_CONST(116700.51432323294/8.0), + REAL_CONST(116725.15873135976/8.0), + REAL_CONST(116749.8044403606/8.0), + REAL_CONST(116774.45145009817/8.0), + REAL_CONST(116799.0997604352/8.0), + REAL_CONST(116823.74937123443/8.0), + REAL_CONST(116848.40028235866/8.0), + REAL_CONST(116873.05249367072/8.0), + REAL_CONST(116897.70600503348/8.0), + REAL_CONST(116922.36081630984/8.0), + REAL_CONST(116947.01692736275/8.0), + REAL_CONST(116971.67433805518/8.0), + REAL_CONST(116996.33304825013/8.0), + REAL_CONST(117020.99305781067/8.0), + REAL_CONST(117045.65436659988/8.0), + REAL_CONST(117070.31697448085/8.0), + REAL_CONST(117094.98088131678/8.0), + REAL_CONST(117119.64608697082/8.0), + REAL_CONST(117144.31259130624/8.0), + REAL_CONST(117168.98039418629/8.0), + REAL_CONST(117193.64949547425/8.0), + REAL_CONST(117218.31989503348/8.0), + REAL_CONST(117242.99159272734/8.0), + REAL_CONST(117267.66458841923/8.0), + REAL_CONST(117292.33888197262/8.0), + REAL_CONST(117317.01447325097/8.0), + REAL_CONST(117341.6913621178/8.0), + REAL_CONST(117366.36954843666/8.0), + REAL_CONST(117391.04903207115/8.0), + REAL_CONST(117415.72981288488/8.0), + REAL_CONST(117440.41189074152/8.0), + REAL_CONST(117465.09526550474/8.0), + REAL_CONST(117489.77993703831/8.0), + REAL_CONST(117514.46590520597/8.0), + REAL_CONST(117539.15316987153/8.0), + REAL_CONST(117563.84173089883/8.0), + REAL_CONST(117588.53158815173/8.0), + REAL_CONST(117613.22274149416/8.0), + REAL_CONST(117637.91519079007/8.0), + REAL_CONST(117662.60893590341/8.0), + REAL_CONST(117687.30397669821/8.0), + REAL_CONST(117712.00031303853/8.0), + REAL_CONST(117736.69794478847/8.0), + REAL_CONST(117761.39687181212/8.0), + REAL_CONST(117786.09709397367/8.0), + REAL_CONST(117810.7986111373/8.0), + REAL_CONST(117835.50142316725/8.0), + REAL_CONST(117860.20552992777/8.0), + REAL_CONST(117884.91093128319/8.0), + REAL_CONST(117909.6176270978/8.0), + REAL_CONST(117934.32561723603/8.0), + REAL_CONST(117959.03490156225/8.0), + REAL_CONST(117983.74547994092/8.0), + REAL_CONST(118008.45735223651/8.0), + REAL_CONST(118033.17051831353/8.0), + REAL_CONST(118057.88497803656/8.0), + REAL_CONST(118082.60073127014/8.0), + REAL_CONST(118107.31777787894/8.0), + REAL_CONST(118132.03611772758/8.0), + REAL_CONST(118156.75575068076/8.0), + REAL_CONST(118181.47667660323/8.0), + REAL_CONST(118206.19889535972/8.0), + REAL_CONST(118230.92240681504/8.0), + REAL_CONST(118255.64721083404/8.0), + REAL_CONST(118280.37330728157/8.0), + REAL_CONST(118305.10069602253/8.0), + REAL_CONST(118329.82937692189/8.0), + REAL_CONST(118354.55934984458/8.0), + REAL_CONST(118379.29061465565/8.0), + REAL_CONST(118404.02317122012/8.0), + REAL_CONST(118428.75701940308/8.0), + REAL_CONST(118453.49215906965/8.0), + REAL_CONST(118478.22859008498/8.0), + REAL_CONST(118502.96631231424/8.0), + REAL_CONST(118527.70532562268/8.0), + REAL_CONST(118552.44562987552/8.0), + REAL_CONST(118577.18722493808/8.0), + REAL_CONST(118601.93011067568/8.0), + REAL_CONST(118626.67428695368/8.0), + REAL_CONST(118651.41975363747/8.0), + REAL_CONST(118676.16651059251/8.0), + REAL_CONST(118700.91455768423/8.0), + REAL_CONST(118725.66389477813/8.0), + REAL_CONST(118750.41452173979/8.0), + REAL_CONST(118775.16643843475/8.0), + REAL_CONST(118799.91964472862/8.0), + REAL_CONST(118824.67414048707/8.0), + REAL_CONST(118849.42992557574/8.0), + REAL_CONST(118874.18699986035/8.0), + REAL_CONST(118898.94536320666/8.0), + REAL_CONST(118923.70501548045/8.0), + REAL_CONST(118948.46595654752/8.0), + REAL_CONST(118973.22818627374/8.0), + REAL_CONST(118997.99170452499/8.0), + REAL_CONST(119022.7565111672/8.0), + REAL_CONST(119047.52260606633/8.0), + REAL_CONST(119072.28998908834/8.0), + REAL_CONST(119097.0586600993/8.0), + REAL_CONST(119121.82861896523/8.0), + REAL_CONST(119146.59986555226/8.0), + REAL_CONST(119171.3723997265/8.0), + REAL_CONST(119196.14622135412/8.0), + REAL_CONST(119220.92133030134/8.0), + REAL_CONST(119245.69772643436/8.0), + REAL_CONST(119270.47540961947/8.0), + REAL_CONST(119295.25437972297/8.0), + REAL_CONST(119320.03463661121/8.0), + REAL_CONST(119344.81618015055/8.0), + REAL_CONST(119369.5990102074/8.0), + REAL_CONST(119394.38312664822/8.0), + REAL_CONST(119419.16852933947/8.0), + REAL_CONST(119443.95521814766/8.0), + REAL_CONST(119468.74319293935/8.0), + REAL_CONST(119493.53245358112/8.0), + REAL_CONST(119518.32299993958/8.0), + REAL_CONST(119543.11483188139/8.0), + REAL_CONST(119567.90794927324/8.0), + REAL_CONST(119592.70235198183/8.0), + REAL_CONST(119617.49803987393/8.0), + REAL_CONST(119642.29501281632/8.0), + REAL_CONST(119667.09327067583/8.0), + REAL_CONST(119691.89281331931/8.0), + REAL_CONST(119716.69364061367/8.0), + REAL_CONST(119741.49575242582/8.0), + REAL_CONST(119766.29914862274/8.0), + REAL_CONST(119791.10382907141/8.0), + REAL_CONST(119815.90979363887/8.0), + REAL_CONST(119840.71704219218/8.0), + REAL_CONST(119865.52557459843/8.0), + REAL_CONST(119890.33539072477/8.0), + REAL_CONST(119915.14649043836/8.0), + REAL_CONST(119939.95887360642/8.0), + REAL_CONST(119964.77254009615/8.0), + REAL_CONST(119989.58748977486/8.0), + REAL_CONST(120014.40372250983/8.0), + REAL_CONST(120039.22123816841/8.0), + REAL_CONST(120064.04003661797/8.0), + REAL_CONST(120088.86011772591/8.0), + REAL_CONST(120113.6814813597/8.0), + REAL_CONST(120138.5041273868/8.0), + REAL_CONST(120163.3280556747/8.0), + REAL_CONST(120188.15326609099/8.0), + REAL_CONST(120212.97975850321/8.0), + REAL_CONST(120237.807532779/8.0), + REAL_CONST(120262.63658878599/8.0), + REAL_CONST(120287.46692639188/8.0), + REAL_CONST(120312.29854546436/8.0), + REAL_CONST(120337.13144587121/8.0), + REAL_CONST(120361.9656274802/8.0), + REAL_CONST(120386.80109015915/8.0), + REAL_CONST(120411.63783377589/8.0), + REAL_CONST(120436.47585819835/8.0), + REAL_CONST(120461.31516329442/8.0), + REAL_CONST(120486.15574893207/8.0), + REAL_CONST(120510.99761497928/8.0), + REAL_CONST(120535.84076130406/8.0), + REAL_CONST(120560.68518777451/8.0), + REAL_CONST(120585.53089425867/8.0), + REAL_CONST(120610.3778806247/8.0), + REAL_CONST(120635.22614674074/8.0), + REAL_CONST(120660.07569247499/8.0), + REAL_CONST(120684.92651769568/8.0), + REAL_CONST(120709.77862227106/8.0), + REAL_CONST(120734.63200606944/8.0), + REAL_CONST(120759.48666895913/8.0), + REAL_CONST(120784.3426108085/8.0), + REAL_CONST(120809.19983148595/8.0), + REAL_CONST(120834.05833085992/8.0), + REAL_CONST(120858.91810879884/8.0), + REAL_CONST(120883.77916517125/8.0), + REAL_CONST(120908.64149984565/8.0), + REAL_CONST(120933.5051126906/8.0), + REAL_CONST(120958.37000357473/8.0), + REAL_CONST(120983.23617236665/8.0), + REAL_CONST(121008.10361893504/8.0), + REAL_CONST(121032.97234314861/8.0), + REAL_CONST(121057.84234487606/8.0), + REAL_CONST(121082.71362398617/8.0), + REAL_CONST(121107.58618034775/8.0), + REAL_CONST(121132.46001382964/8.0), + REAL_CONST(121157.33512430069/8.0), + REAL_CONST(121182.21151162982/8.0), + REAL_CONST(121207.08917568595/8.0), + REAL_CONST(121231.96811633807/8.0), + REAL_CONST(121256.84833345517/8.0), + REAL_CONST(121281.72982690629/8.0), + REAL_CONST(121306.61259656049/8.0), + REAL_CONST(121331.49664228689/8.0), + REAL_CONST(121356.38196395461/8.0), + REAL_CONST(121381.26856143285/8.0), + REAL_CONST(121406.15643459078/8.0), + REAL_CONST(121431.04558329767/8.0), + REAL_CONST(121455.93600742276/8.0), + REAL_CONST(121480.82770683538/8.0), + REAL_CONST(121505.72068140487/8.0), + REAL_CONST(121530.61493100057/8.0), + REAL_CONST(121555.51045549192/8.0), + REAL_CONST(121580.40725474835/8.0), + REAL_CONST(121605.30532863933/8.0), + REAL_CONST(121630.20467703436/8.0), + REAL_CONST(121655.10529980299/8.0), + REAL_CONST(121680.00719681478/8.0), + REAL_CONST(121704.91036793934/8.0), + REAL_CONST(121729.81481304632/8.0), + REAL_CONST(121754.72053200539/8.0), + REAL_CONST(121779.62752468624/8.0), + REAL_CONST(121804.53579095862/8.0), + REAL_CONST(121829.44533069231/8.0), + REAL_CONST(121854.3561437571/8.0), + REAL_CONST(121879.26823002285/8.0), + REAL_CONST(121904.1815893594/8.0), + REAL_CONST(121929.09622163669/8.0), + REAL_CONST(121954.01212672464/8.0), + REAL_CONST(121978.92930449323/8.0), + REAL_CONST(122003.84775481246/8.0), + REAL_CONST(122028.76747755238/8.0), + REAL_CONST(122053.68847258303/8.0), + REAL_CONST(122078.61073977455/8.0), + REAL_CONST(122103.53427899707/8.0), + REAL_CONST(122128.45909012076/8.0), + REAL_CONST(122153.38517301581/8.0), + REAL_CONST(122178.31252755247/8.0), + REAL_CONST(122203.24115360099/8.0), + REAL_CONST(122228.17105103172/8.0), + REAL_CONST(122253.10221971494/8.0), + REAL_CONST(122278.03465952107/8.0), + REAL_CONST(122302.96837032049/8.0), + REAL_CONST(122327.90335198362/8.0), + REAL_CONST(122352.83960438096/8.0), + REAL_CONST(122377.777127383/8.0), + REAL_CONST(122402.71592086025/8.0), + REAL_CONST(122427.65598468333/8.0), + REAL_CONST(122452.59731872278/8.0), + REAL_CONST(122477.53992284928/8.0), + REAL_CONST(122502.48379693348/8.0), + REAL_CONST(122527.42894084606/8.0), + REAL_CONST(122552.37535445779/8.0), + REAL_CONST(122577.32303763942/8.0), + REAL_CONST(122602.27199026172/8.0), + REAL_CONST(122627.22221219557/8.0), + REAL_CONST(122652.17370331181/8.0), + REAL_CONST(122677.12646348133/8.0), + REAL_CONST(122702.08049257506/8.0), + REAL_CONST(122727.03579046397/8.0), + REAL_CONST(122751.99235701906/8.0), + REAL_CONST(122776.95019211136/8.0), + REAL_CONST(122801.9092956119/8.0), + REAL_CONST(122826.8696673918/8.0), + REAL_CONST(122851.83130732219/8.0), + REAL_CONST(122876.79421527422/8.0), + REAL_CONST(122901.75839111909/8.0), + REAL_CONST(122926.72383472799/8.0), + REAL_CONST(122951.69054597223/8.0), + REAL_CONST(122976.65852472307/8.0), + REAL_CONST(123001.62777085182/8.0), + REAL_CONST(123026.59828422987/8.0), + REAL_CONST(123051.57006472857/8.0), + REAL_CONST(123076.54311221937/8.0), + REAL_CONST(123101.5174265737/8.0), + REAL_CONST(123126.49300766307/8.0), + REAL_CONST(123151.46985535898/8.0), + REAL_CONST(123176.44796953299/8.0), + REAL_CONST(123201.42735005668/8.0), + REAL_CONST(123226.40799680166/8.0), + REAL_CONST(123251.38990963959/8.0), + REAL_CONST(123276.37308844214/8.0), + REAL_CONST(123301.35753308103/8.0), + REAL_CONST(123326.343243428/8.0), + REAL_CONST(123351.33021935483/8.0), + REAL_CONST(123376.31846073334/8.0), + REAL_CONST(123401.30796743535/8.0), + REAL_CONST(123426.29873933276/8.0), + REAL_CONST(123451.29077629748/8.0), + REAL_CONST(123476.28407820144/8.0), + REAL_CONST(123501.2786449166/8.0), + REAL_CONST(123526.27447631498/8.0), + REAL_CONST(123551.27157226863/8.0), + REAL_CONST(123576.26993264959/8.0), + REAL_CONST(123601.26955732999/8.0), + REAL_CONST(123626.27044618195/8.0), + REAL_CONST(123651.27259907764/8.0), + REAL_CONST(123676.27601588926/8.0), + REAL_CONST(123701.28069648903/8.0), + REAL_CONST(123726.28664074924/8.0), + REAL_CONST(123751.29384854218/8.0), + REAL_CONST(123776.30231974016/8.0), + REAL_CONST(123801.31205421555/8.0), + REAL_CONST(123826.32305184075/8.0), + REAL_CONST(123851.33531248817/8.0), + REAL_CONST(123876.34883603029/8.0), + REAL_CONST(123901.36362233957/8.0), + REAL_CONST(123926.37967128855/8.0), + REAL_CONST(123951.39698274979/8.0), + REAL_CONST(123976.41555659588/8.0), + REAL_CONST(124001.43539269941/8.0), + REAL_CONST(124026.45649093305/8.0), + REAL_CONST(124051.47885116948/8.0), + REAL_CONST(124076.50247328142/8.0), + REAL_CONST(124101.5273571416/8.0), + REAL_CONST(124126.55350262282/8.0), + REAL_CONST(124151.58090959788/8.0), + REAL_CONST(124176.60957793961/8.0), + REAL_CONST(124201.63950752091/8.0), + REAL_CONST(124226.67069821467/8.0), + REAL_CONST(124251.70314989384/8.0), + REAL_CONST(124276.73686243138/8.0), + REAL_CONST(124301.7718357003/8.0), + REAL_CONST(124326.80806957364/8.0), + REAL_CONST(124351.84556392446/8.0), + REAL_CONST(124376.88431862585/8.0), + REAL_CONST(124401.92433355095/8.0), + REAL_CONST(124426.96560857294/8.0), + REAL_CONST(124452.00814356498/8.0), + REAL_CONST(124477.05193840031/8.0), + REAL_CONST(124502.0969929522/8.0), + REAL_CONST(124527.14330709392/8.0), + REAL_CONST(124552.19088069882/8.0), + REAL_CONST(124577.23971364023/8.0), + REAL_CONST(124602.28980579154/8.0), + REAL_CONST(124627.34115702618/8.0), + REAL_CONST(124652.3937672176/8.0), + REAL_CONST(124677.44763623926/8.0), + REAL_CONST(124702.50276396469/8.0), + REAL_CONST(124727.55915026742/8.0), + REAL_CONST(124752.61679502104/8.0), + REAL_CONST(124777.67569809916/8.0), + REAL_CONST(124802.73585937542/8.0), + REAL_CONST(124827.79727872348/8.0), + REAL_CONST(124852.85995601704/8.0), + REAL_CONST(124877.92389112986/8.0), + REAL_CONST(124902.98908393568/8.0), + REAL_CONST(124928.05553430831/8.0), + REAL_CONST(124953.1232421216/8.0), + REAL_CONST(124978.19220724938/8.0), + REAL_CONST(125003.26242956554/8.0), + REAL_CONST(125028.33390894404/8.0), + REAL_CONST(125053.40664525882/8.0), + REAL_CONST(125078.48063838384/8.0), + REAL_CONST(125103.55588819318/8.0), + REAL_CONST(125128.63239456083/8.0), + REAL_CONST(125153.71015736091/8.0), + REAL_CONST(125178.78917646752/8.0), + REAL_CONST(125203.86945175481/8.0), + REAL_CONST(125228.95098309696/8.0), + REAL_CONST(125254.03377036817/8.0), + REAL_CONST(125279.1178134427/8.0), + REAL_CONST(125304.20311219479/8.0), + REAL_CONST(125329.28966649878/8.0), + REAL_CONST(125354.37747622898/8.0), + REAL_CONST(125379.46654125977/8.0), + REAL_CONST(125404.55686146552/8.0), + REAL_CONST(125429.6484367207/8.0), + REAL_CONST(125454.74126689974/8.0), + REAL_CONST(125479.83535187715/8.0), + REAL_CONST(125504.93069152744/8.0), + REAL_CONST(125530.02728572517/8.0), + REAL_CONST(125555.12513434493/8.0), + REAL_CONST(125580.22423726133/8.0), + REAL_CONST(125605.32459434902/8.0), + REAL_CONST(125630.4262054827/8.0), + REAL_CONST(125655.52907053704/8.0), + REAL_CONST(125680.63318938682/8.0), + REAL_CONST(125705.73856190679/8.0), + REAL_CONST(125730.84518797178/8.0), + REAL_CONST(125755.9530674566/8.0), + REAL_CONST(125781.06220023613/8.0), + REAL_CONST(125806.17258618528/8.0), + REAL_CONST(125831.28422517896/8.0), + REAL_CONST(125856.39711709213/8.0), + REAL_CONST(125881.51126179981/8.0), + REAL_CONST(125906.62665917698/8.0), + REAL_CONST(125931.74330909875/8.0), + REAL_CONST(125956.86121144016/8.0), + REAL_CONST(125981.98036607634/8.0), + REAL_CONST(126007.10077288245/8.0), + REAL_CONST(126032.22243173365/8.0), + REAL_CONST(126057.34534250517/8.0), + REAL_CONST(126082.46950507225/8.0), + REAL_CONST(126107.59491931014/8.0), + REAL_CONST(126132.72158509417/8.0), + REAL_CONST(126157.84950229966/8.0), + REAL_CONST(126182.97867080198/8.0), + REAL_CONST(126208.10909047653/8.0), + REAL_CONST(126233.24076119871/8.0), + REAL_CONST(126258.37368284403/8.0), + REAL_CONST(126283.50785528794/8.0), + REAL_CONST(126308.64327840599/8.0), + REAL_CONST(126333.77995207369/8.0), + REAL_CONST(126358.91787616667/8.0), + REAL_CONST(126384.0570505605/8.0), + REAL_CONST(126409.19747513086/8.0), + REAL_CONST(126434.3391497534/8.0), + REAL_CONST(126459.48207430386/8.0), + REAL_CONST(126484.62624865794/8.0), + REAL_CONST(126509.77167269142/8.0), + REAL_CONST(126534.9183462801/8.0), + REAL_CONST(126560.06626929982/8.0), + REAL_CONST(126585.21544162642/8.0), + REAL_CONST(126610.36586313581/8.0), + REAL_CONST(126635.51753370393/8.0), + REAL_CONST(126660.67045320668/8.0), + REAL_CONST(126685.82462152008/8.0), + REAL_CONST(126710.98003852014/8.0), + REAL_CONST(126736.13670408291/8.0), + REAL_CONST(126761.29461808444/8.0), + REAL_CONST(126786.45378040087/8.0), + REAL_CONST(126811.61419090834/8.0), + REAL_CONST(126836.77584948298/8.0), + REAL_CONST(126861.93875600102/8.0), + REAL_CONST(126887.10291033868/8.0), + REAL_CONST(126912.26831237224/8.0), + REAL_CONST(126937.43496197795/8.0), + REAL_CONST(126962.60285903217/8.0), + REAL_CONST(126987.77200341123/8.0), + REAL_CONST(127012.94239499152/8.0), + REAL_CONST(127038.11403364947/8.0), + REAL_CONST(127063.2869192615/8.0), + REAL_CONST(127088.46105170409/8.0), + REAL_CONST(127113.63643085376/8.0), + REAL_CONST(127138.81305658702/8.0), + REAL_CONST(127163.99092878048/8.0), + REAL_CONST(127189.17004731069/8.0), + REAL_CONST(127214.35041205429/8.0), + REAL_CONST(127239.53202288797/8.0), + REAL_CONST(127264.71487968838/8.0), + REAL_CONST(127289.89898233226/8.0), + REAL_CONST(127315.08433069635/8.0), + REAL_CONST(127340.27092465744/8.0), + REAL_CONST(127365.45876409234/8.0), + REAL_CONST(127390.64784887788/8.0), + REAL_CONST(127415.83817889093/8.0), + REAL_CONST(127441.02975400841/8.0), + REAL_CONST(127466.22257410725/8.0), + REAL_CONST(127491.41663906439/8.0), + REAL_CONST(127516.61194875685/8.0), + REAL_CONST(127541.80850306165/8.0), + REAL_CONST(127567.00630185583/8.0), + REAL_CONST(127592.20534501647/8.0), + REAL_CONST(127617.4056324207/8.0), + REAL_CONST(127642.60716394568/8.0), + REAL_CONST(127667.80993946856/8.0), + REAL_CONST(127693.01395886653/8.0), + REAL_CONST(127718.21922201688/8.0), + REAL_CONST(127743.42572879682/8.0), + REAL_CONST(127768.63347908368/8.0), + REAL_CONST(127793.84247275478/8.0), + REAL_CONST(127819.05270968749/8.0), + REAL_CONST(127844.26418975917/8.0), + REAL_CONST(127869.47691284724/8.0), + REAL_CONST(127894.69087882918/8.0), + REAL_CONST(127919.90608758242/8.0), + REAL_CONST(127945.12253898452/8.0), + REAL_CONST(127970.34023291297/8.0), + REAL_CONST(127995.55916924537/8.0), + REAL_CONST(128020.77934785932/8.0), + REAL_CONST(128046.00076863244/8.0), + REAL_CONST(128071.22343144237/8.0), + REAL_CONST(128096.44733616684/8.0), + REAL_CONST(128121.67248268353/8.0), + REAL_CONST(128146.89887087021/8.0), + REAL_CONST(128172.12650060465/8.0), + REAL_CONST(128197.35537176467/8.0), + REAL_CONST(128222.5854842281/8.0), + REAL_CONST(128247.81683787282/8.0), + REAL_CONST(128273.04943257671/8.0), + REAL_CONST(128298.28326821771/8.0), + REAL_CONST(128323.51834467379/8.0), + REAL_CONST(128348.75466182294/8.0), + REAL_CONST(128373.99221954317/8.0), + REAL_CONST(128399.23101771252/8.0), + REAL_CONST(128424.47105620909/8.0), + REAL_CONST(128449.71233491098/8.0), + REAL_CONST(128474.95485369631/8.0), + REAL_CONST(128500.19861244329/8.0), + REAL_CONST(128525.44361103009/8.0), + REAL_CONST(128550.68984933494/8.0), + REAL_CONST(128575.93732723613/8.0), + REAL_CONST(128601.18604461191/8.0), + REAL_CONST(128626.43600134061/8.0), + REAL_CONST(128651.68719730059/8.0), + REAL_CONST(128676.93963237021/8.0), + REAL_CONST(128702.1933064279/8.0), + REAL_CONST(128727.44821935208/8.0), + REAL_CONST(128752.70437102125/8.0), + REAL_CONST(128777.96176131385/8.0), + REAL_CONST(128803.22039010846/8.0), + REAL_CONST(128828.48025728362/8.0), + REAL_CONST(128853.74136271792/8.0), + REAL_CONST(128879.00370628996/8.0), + REAL_CONST(128904.26728787841/8.0), + REAL_CONST(128929.53210736193/8.0), + REAL_CONST(128954.79816461923/8.0), + REAL_CONST(128980.06545952905/8.0), + REAL_CONST(129005.33399197015/8.0), + REAL_CONST(129030.60376182134/8.0), + REAL_CONST(129055.87476896142/8.0), + REAL_CONST(129081.14701326926/8.0), + REAL_CONST(129106.42049462376/8.0), + REAL_CONST(129131.6952129038/8.0), + REAL_CONST(129156.97116798835/8.0), + REAL_CONST(129182.24835975636/8.0), + REAL_CONST(129207.52678808685/8.0), + REAL_CONST(129232.80645285884/8.0), + REAL_CONST(129258.08735395141/8.0), + REAL_CONST(129283.36949124365/8.0), + REAL_CONST(129308.65286461466/8.0), + REAL_CONST(129333.9374739436/8.0), + REAL_CONST(129359.22331910966/8.0), + REAL_CONST(129384.51039999202/8.0), + REAL_CONST(129409.79871646997/8.0), + REAL_CONST(129435.08826842274/8.0), + REAL_CONST(129460.37905572963/8.0), + REAL_CONST(129485.67107826998/8.0), + REAL_CONST(129510.96433592314/8.0), + REAL_CONST(129536.25882856851/8.0), + REAL_CONST(129561.55455608548/8.0), + REAL_CONST(129586.85151835352/8.0), + REAL_CONST(129612.14971525209/8.0), + REAL_CONST(129637.4491466607/8.0), + REAL_CONST(129662.74981245887/8.0), + REAL_CONST(129688.0517125262/8.0), + REAL_CONST(129713.35484674224/8.0), + REAL_CONST(129738.65921498663/8.0), + REAL_CONST(129763.96481713903/8.0), + REAL_CONST(129789.27165307909/8.0), + REAL_CONST(129814.57972268655/8.0), + REAL_CONST(129839.88902584116/8.0), + REAL_CONST(129865.19956242264/8.0), + REAL_CONST(129890.51133231082/8.0), + REAL_CONST(129915.82433538554/8.0), + REAL_CONST(129941.13857152662/8.0), + REAL_CONST(129966.45404061397/8.0), + REAL_CONST(129991.7707425275/8.0), + REAL_CONST(130017.08867714716/8.0), + REAL_CONST(130042.4078443529/8.0), + REAL_CONST(130067.72824402474/8.0), + REAL_CONST(130093.04987604271/8.0), + REAL_CONST(130118.37274028687/8.0), + REAL_CONST(130143.69683663732/8.0), + REAL_CONST(130169.02216497416/8.0), + REAL_CONST(130194.34872517755/8.0), + REAL_CONST(130219.67651712766/8.0), + REAL_CONST(130245.0055407047/8.0), + REAL_CONST(130270.33579578891/8.0), + REAL_CONST(130295.66728226055/8.0), + REAL_CONST(130320.99999999991/8.0), + REAL_CONST(130346.33394888733/8.0), + REAL_CONST(130371.66912880314/8.0), + REAL_CONST(130397.00553962773/8.0), + REAL_CONST(130422.34318124152/8.0), + REAL_CONST(130447.68205352494/8.0), + REAL_CONST(130473.02215635845/8.0), + REAL_CONST(130498.36348962256/8.0), + REAL_CONST(130523.70605319779/8.0), + REAL_CONST(130549.0498469647/8.0), + REAL_CONST(130574.39487080388/8.0), + REAL_CONST(130599.74112459592/8.0), + REAL_CONST(130625.08860822149/8.0), + REAL_CONST(130650.43732156123/8.0), + REAL_CONST(130675.78726449587/8.0), + REAL_CONST(130701.13843690613/8.0), + REAL_CONST(130726.49083867275/8.0), + REAL_CONST(130751.84446967654/8.0), + REAL_CONST(130777.19932979831/8.0), + REAL_CONST(130802.5554189189/8.0), + REAL_CONST(130827.91273691918/8.0), + REAL_CONST(130853.27128368006/8.0), + REAL_CONST(130878.63105908247/8.0), + REAL_CONST(130903.99206300738/8.0), + REAL_CONST(130929.35429533575/8.0), + REAL_CONST(130954.71775594862/8.0), + REAL_CONST(130980.08244472703/8.0), + REAL_CONST(131005.44836155206/8.0), + REAL_CONST(131030.81550630482/8.0), + REAL_CONST(131056.18387886642/8.0), + REAL_CONST(131081.55347911804/8.0), + REAL_CONST(131106.92430694087/8.0), + REAL_CONST(131132.29636221612/8.0), + REAL_CONST(131157.66964482504/8.0), + REAL_CONST(131183.0441546489/8.0), + REAL_CONST(131208.41989156904/8.0), + REAL_CONST(131233.79685546676/8.0), + REAL_CONST(131259.17504622342/8.0), + REAL_CONST(131284.55446372041/8.0), + REAL_CONST(131309.93510783918/8.0), + REAL_CONST(131335.31697846117/8.0), + REAL_CONST(131360.70007546784/8.0), + REAL_CONST(131386.0843987407/8.0), + REAL_CONST(131411.46994816128/8.0), + REAL_CONST(131436.85672361116/8.0), + REAL_CONST(131462.24472497194/8.0), + REAL_CONST(131487.63395212521/8.0), + REAL_CONST(131513.02440495262/8.0), + REAL_CONST(131538.41608333588/8.0), + REAL_CONST(131563.80898715663/8.0), + REAL_CONST(131589.2031162967/8.0), + REAL_CONST(131614.59847063778/8.0), + REAL_CONST(131639.9950500617/8.0), + REAL_CONST(131665.39285445024/8.0), + REAL_CONST(131690.79188368531/8.0), + REAL_CONST(131716.19213764873/8.0), + REAL_CONST(131741.59361622241/8.0), + REAL_CONST(131766.99631928833/8.0), + REAL_CONST(131792.40024672839/8.0), + REAL_CONST(131817.80539842462/8.0), + REAL_CONST(131843.21177425905/8.0), + REAL_CONST(131868.61937411371/8.0), + REAL_CONST(131894.02819787065/8.0), + REAL_CONST(131919.43824541202/8.0), + REAL_CONST(131944.84951661993/8.0), + REAL_CONST(131970.26201137656/8.0), + REAL_CONST(131995.67572956407/8.0), + REAL_CONST(132021.09067106468/8.0), + REAL_CONST(132046.50683576067/8.0), + REAL_CONST(132071.9242235343/8.0), + REAL_CONST(132097.34283426782/8.0), + REAL_CONST(132122.76266784366/8.0), + REAL_CONST(132148.1837241441/8.0), + REAL_CONST(132173.60600305157/8.0), + REAL_CONST(132199.02950444847/8.0), + REAL_CONST(132224.45422821722/8.0), + REAL_CONST(132249.88017424036/8.0), + REAL_CONST(132275.30734240031/8.0), + REAL_CONST(132300.73573257966/8.0), + REAL_CONST(132326.16534466096/8.0), + REAL_CONST(132351.59617852676/8.0), + REAL_CONST(132377.02823405969/8.0), + REAL_CONST(132402.46151114244/8.0), + REAL_CONST(132427.89600965759/8.0), + REAL_CONST(132453.33172948789/8.0), + REAL_CONST(132478.76867051609/8.0), + REAL_CONST(132504.20683262491/8.0), + REAL_CONST(132529.64621569714/8.0), + REAL_CONST(132555.08681961559/8.0), + REAL_CONST(132580.5286442631/8.0), + REAL_CONST(132605.97168952253/8.0), + REAL_CONST(132631.41595527678/8.0), + REAL_CONST(132656.86144140881/8.0), + REAL_CONST(132682.30814780149/8.0), + REAL_CONST(132707.75607433787/8.0), + REAL_CONST(132733.20522090094/8.0), + REAL_CONST(132758.65558737374/8.0), + REAL_CONST(132784.10717363929/8.0), + REAL_CONST(132809.55997958075/8.0), + REAL_CONST(132835.01400508118/8.0), + REAL_CONST(132860.46925002377/8.0), + REAL_CONST(132885.92571429166/8.0), + REAL_CONST(132911.38339776811/8.0), + REAL_CONST(132936.84230033628/8.0), + REAL_CONST(132962.30242187946/8.0), + REAL_CONST(132987.76376228096/8.0), + REAL_CONST(133013.22632142407/8.0), + REAL_CONST(133038.69009919214/8.0), + REAL_CONST(133064.15509546854/8.0), + REAL_CONST(133089.62131013666/8.0), + REAL_CONST(133115.08874307995/8.0), + REAL_CONST(133140.55739418184/8.0), + REAL_CONST(133166.02726332581/8.0), + REAL_CONST(133191.49835039541/8.0), + REAL_CONST(133216.97065527414/8.0), + REAL_CONST(133242.44417784561/8.0), + REAL_CONST(133267.91891799335/8.0), + REAL_CONST(133293.39487560102/8.0), + REAL_CONST(133318.87205055228/8.0), + REAL_CONST(133344.35044273079/8.0), + REAL_CONST(133369.83005202023/8.0), + REAL_CONST(133395.31087830439/8.0), + REAL_CONST(133420.79292146701/8.0), + REAL_CONST(133446.27618139185/8.0), + REAL_CONST(133471.76065796276/8.0), + REAL_CONST(133497.24635106357/8.0), + REAL_CONST(133522.73326057816/8.0), + REAL_CONST(133548.22138639039/8.0), + REAL_CONST(133573.71072838426/8.0), + REAL_CONST(133599.20128644365/8.0), + REAL_CONST(133624.69306045261/8.0), + REAL_CONST(133650.1860502951/8.0), + REAL_CONST(133675.68025585517/8.0), + REAL_CONST(133701.1756770169/8.0), + REAL_CONST(133726.67231366437/8.0), + REAL_CONST(133752.17016568172/8.0), + REAL_CONST(133777.66923295305/8.0), + REAL_CONST(133803.16951536259/8.0), + REAL_CONST(133828.67101279454/8.0), + REAL_CONST(133854.17372513309/8.0), + REAL_CONST(133879.67765226253/8.0), + REAL_CONST(133905.18279406714/8.0), + REAL_CONST(133930.68915043125/8.0), + REAL_CONST(133956.19672123916/8.0), + REAL_CONST(133981.70550637526/8.0), + REAL_CONST(134007.21550572399/8.0), + REAL_CONST(134032.7267191697/8.0), + REAL_CONST(134058.23914659687/8.0), + REAL_CONST(134083.75278789/8.0), + REAL_CONST(134109.26764293358/8.0), + REAL_CONST(134134.78371161217/8.0), + REAL_CONST(134160.30099381026/8.0), + REAL_CONST(134185.8194894125/8.0), + REAL_CONST(134211.33919830353/8.0), + REAL_CONST(134236.8601203679/8.0), + REAL_CONST(134262.38225549037/8.0), + REAL_CONST(134287.90560355558/8.0), + REAL_CONST(134313.43016444831/8.0), + REAL_CONST(134338.95593805326/8.0), + REAL_CONST(134364.48292425525/8.0), + REAL_CONST(134390.01112293909/8.0), + REAL_CONST(134415.54053398955/8.0), + REAL_CONST(134441.07115729159/8.0), + REAL_CONST(134466.60299273001/8.0), + REAL_CONST(134492.1360401898/8.0), + REAL_CONST(134517.67029955584/8.0), + REAL_CONST(134543.20577071316/8.0), + REAL_CONST(134568.74245354676/8.0), + REAL_CONST(134594.28034794159/8.0), + REAL_CONST(134619.81945378278/8.0), + REAL_CONST(134645.35977095537/8.0), + REAL_CONST(134670.90129934452/8.0), + REAL_CONST(134696.4440388353/8.0), + REAL_CONST(134721.98798931291/8.0), + REAL_CONST(134747.53315066252/8.0), + REAL_CONST(134773.07952276937/8.0), + REAL_CONST(134798.62710551871/8.0), + REAL_CONST(134824.17589879577/8.0), + REAL_CONST(134849.72590248589/8.0), + REAL_CONST(134875.27711647438/8.0), + REAL_CONST(134900.82954064661/8.0), + REAL_CONST(134926.38317488792/8.0), + REAL_CONST(134951.93801908373/8.0), + REAL_CONST(134977.49407311951/8.0), + REAL_CONST(135003.05133688069/8.0), + REAL_CONST(135028.60981025276/8.0), + REAL_CONST(135054.16949312127/8.0), + REAL_CONST(135079.73038537172/8.0), + REAL_CONST(135105.29248688967/8.0), + REAL_CONST(135130.85579756077/8.0), + REAL_CONST(135156.42031727062/8.0), + REAL_CONST(135181.98604590484/8.0), + REAL_CONST(135207.55298334916/8.0), + REAL_CONST(135233.12112948924/8.0), + REAL_CONST(135258.69048421088/8.0), + REAL_CONST(135284.26104739975/8.0), + REAL_CONST(135309.83281894168/8.0), + REAL_CONST(135335.4057987225/8.0), + REAL_CONST(135360.97998662802/8.0), + REAL_CONST(135386.55538254412/8.0), + REAL_CONST(135412.13198635669/8.0), + REAL_CONST(135437.70979795168/8.0), + REAL_CONST(135463.28881721498/8.0), + REAL_CONST(135488.86904403262/8.0), + REAL_CONST(135514.45047829056/8.0), + REAL_CONST(135540.03311987486/8.0), + REAL_CONST(135565.61696867159/8.0), + REAL_CONST(135591.20202456677/8.0), + REAL_CONST(135616.78828744654/8.0), + REAL_CONST(135642.37575719706/8.0), + REAL_CONST(135667.96443370447/8.0), + REAL_CONST(135693.55431685498/8.0), + REAL_CONST(135719.14540653475/8.0), + REAL_CONST(135744.73770263011/8.0), + REAL_CONST(135770.33120502727/8.0), + REAL_CONST(135795.92591361253/8.0), + REAL_CONST(135821.52182827223/8.0), + REAL_CONST(135847.11894889272/8.0), + REAL_CONST(135872.7172753604/8.0), + REAL_CONST(135898.31680756161/8.0), + REAL_CONST(135923.91754538284/8.0), + REAL_CONST(135949.51948871053/8.0), + REAL_CONST(135975.12263743114/8.0), + REAL_CONST(136000.72699143123/8.0), + REAL_CONST(136026.33255059729/8.0), + REAL_CONST(136051.93931481591/8.0), + REAL_CONST(136077.54728397369/8.0), + REAL_CONST(136103.15645795723/8.0), + REAL_CONST(136128.76683665317/8.0), + REAL_CONST(136154.37841994822/8.0), + REAL_CONST(136179.99120772901/8.0), + REAL_CONST(136205.60519988232/8.0), + REAL_CONST(136231.2203962949/8.0), + REAL_CONST(136256.83679685349/8.0), + REAL_CONST(136282.45440144493/8.0), + REAL_CONST(136308.07320995603/8.0), + REAL_CONST(136333.69322227367/8.0), + REAL_CONST(136359.31443828469/8.0), + REAL_CONST(136384.93685787608/8.0), + REAL_CONST(136410.56048093468/8.0), + REAL_CONST(136436.18530734754/8.0), + REAL_CONST(136461.81133700156/8.0), + REAL_CONST(136487.43856978384/8.0), + REAL_CONST(136513.06700558143/8.0), + REAL_CONST(136538.6966442813/8.0), + REAL_CONST(136564.32748577066/8.0), + REAL_CONST(136589.95952993655/8.0), + REAL_CONST(136615.59277666616/8.0), + REAL_CONST(136641.22722584667/8.0), + REAL_CONST(136666.86287736523/8.0), + REAL_CONST(136692.49973110916/8.0), + REAL_CONST(136718.13778696564/8.0), + REAL_CONST(136743.77704482197/8.0), + REAL_CONST(136769.41750456547/8.0), + REAL_CONST(136795.05916608346/8.0), + REAL_CONST(136820.70202926331/8.0), + REAL_CONST(136846.34609399244/8.0), + REAL_CONST(136871.99136015819/8.0), + REAL_CONST(136897.63782764805/8.0), + REAL_CONST(136923.28549634948/8.0), + REAL_CONST(136948.93436614997/8.0), + REAL_CONST(136974.58443693706/8.0), + REAL_CONST(137000.23570859825/8.0), + REAL_CONST(137025.88818102115/8.0), + REAL_CONST(137051.54185409332/8.0), + REAL_CONST(137077.19672770242/8.0), + REAL_CONST(137102.85280173609/8.0), + REAL_CONST(137128.51007608202/8.0), + REAL_CONST(137154.16855062786/8.0), + REAL_CONST(137179.82822526142/8.0), + REAL_CONST(137205.48909987041/8.0), + REAL_CONST(137231.15117434258/8.0), + REAL_CONST(137256.8144485658/8.0), + REAL_CONST(137282.47892242789/8.0), + REAL_CONST(137308.14459581667/8.0), + REAL_CONST(137333.81146862009/8.0), + REAL_CONST(137359.47954072602/8.0), + REAL_CONST(137385.14881202241/8.0), + REAL_CONST(137410.81928239719/8.0), + REAL_CONST(137436.49095173844/8.0), + REAL_CONST(137462.16381993407/8.0), + REAL_CONST(137487.83788687221/8.0), + REAL_CONST(137513.51315244089/8.0), + REAL_CONST(137539.18961652822/8.0), + REAL_CONST(137564.86727902229/8.0), + REAL_CONST(137590.54613981131/8.0), + REAL_CONST(137616.22619878338/8.0), + REAL_CONST(137641.90745582676/8.0), + REAL_CONST(137667.58991082967/8.0), + REAL_CONST(137693.27356368033/8.0), + REAL_CONST(137718.95841426702/8.0), + REAL_CONST(137744.64446247809/8.0), + REAL_CONST(137770.33170820182/8.0), + REAL_CONST(137796.02015132661/8.0), + REAL_CONST(137821.70979174081/8.0), + REAL_CONST(137847.40062933284/8.0), + REAL_CONST(137873.09266399115/8.0), + REAL_CONST(137898.78589560417/8.0), + REAL_CONST(137924.48032406042/8.0), + REAL_CONST(137950.17594924837/8.0), + REAL_CONST(137975.8727710566/8.0), + REAL_CONST(138001.57078937365/8.0), + REAL_CONST(138027.27000408815/8.0), + REAL_CONST(138052.97041508864/8.0), + REAL_CONST(138078.67202226384/8.0), + REAL_CONST(138104.3748255024/8.0), + REAL_CONST(138130.07882469296/8.0), + REAL_CONST(138155.78401972432/8.0), + REAL_CONST(138181.49041048516/8.0), + REAL_CONST(138207.1979968643/8.0), + REAL_CONST(138232.9067787505/8.0), + REAL_CONST(138258.61675603263/8.0), + REAL_CONST(138284.32792859949/8.0), + REAL_CONST(138310.04029633995/8.0), + REAL_CONST(138335.75385914298/8.0), + REAL_CONST(138361.46861689744/8.0), + REAL_CONST(138387.18456949232/8.0), + REAL_CONST(138412.90171681659/8.0), + REAL_CONST(138438.62005875923/8.0), + REAL_CONST(138464.33959520931/8.0), + REAL_CONST(138490.06032605586/8.0), + REAL_CONST(138515.78225118798/8.0), + REAL_CONST(138541.50537049473/8.0), + REAL_CONST(138567.2296838653/8.0), + REAL_CONST(138592.95519118884/8.0), + REAL_CONST(138618.68189235451/8.0), + REAL_CONST(138644.40978725153/8.0), + REAL_CONST(138670.13887576913/8.0), + REAL_CONST(138695.86915779658/8.0), + REAL_CONST(138721.60063322316/8.0), + REAL_CONST(138747.33330193823/8.0), + REAL_CONST(138773.06716383106/8.0), + REAL_CONST(138798.80221879104/8.0), + REAL_CONST(138824.53846670757/8.0), + REAL_CONST(138850.27590747006/8.0), + REAL_CONST(138876.01454096794/8.0), + REAL_CONST(138901.7543670907/8.0), + REAL_CONST(138927.49538572782/8.0), + REAL_CONST(138953.2375967688/8.0), + REAL_CONST(138978.9810001032/8.0), + REAL_CONST(139004.72559562061/8.0), + REAL_CONST(139030.47138321059/8.0), + REAL_CONST(139056.2183627628/8.0), + REAL_CONST(139081.96653416683/8.0), + REAL_CONST(139107.71589731239/8.0), + REAL_CONST(139133.46645208917/8.0), + REAL_CONST(139159.21819838689/8.0), + REAL_CONST(139184.97113609532/8.0), + REAL_CONST(139210.72526510421/8.0), + REAL_CONST(139236.48058530336/8.0), + REAL_CONST(139262.23709658257/8.0), + REAL_CONST(139287.99479883176/8.0), + REAL_CONST(139313.75369194071/8.0), + REAL_CONST(139339.51377579942/8.0), + REAL_CONST(139365.27505029776/8.0), + REAL_CONST(139391.03751532568/8.0), + REAL_CONST(139416.80117077316/8.0), + REAL_CONST(139442.56601653024/8.0), + REAL_CONST(139468.33205248689/8.0), + REAL_CONST(139494.09927853322/8.0), + REAL_CONST(139519.86769455927/8.0), + REAL_CONST(139545.63730045516/8.0), + REAL_CONST(139571.408096111/8.0), + REAL_CONST(139597.18008141697/8.0), + REAL_CONST(139622.95325626322/8.0), + REAL_CONST(139648.72762054001/8.0), + REAL_CONST(139674.5031741375/8.0), + REAL_CONST(139700.27991694602/8.0), + REAL_CONST(139726.05784885579/8.0), + REAL_CONST(139751.83696975713/8.0), + REAL_CONST(139777.61727954043/8.0), + REAL_CONST(139803.39877809596/8.0), + REAL_CONST(139829.18146531415/8.0), + REAL_CONST(139854.96534108539/8.0), + REAL_CONST(139880.75040530015/8.0), + REAL_CONST(139906.53665784886/8.0), + REAL_CONST(139932.32409862199/8.0), + REAL_CONST(139958.11272751007/8.0), + REAL_CONST(139983.90254440365/8.0), + REAL_CONST(140009.69354919327/8.0), + REAL_CONST(140035.48574176949/8.0), + REAL_CONST(140061.27912202294/8.0), + REAL_CONST(140087.07368984428/8.0), + REAL_CONST(140112.86944512415/8.0), + REAL_CONST(140138.66638775321/8.0), + REAL_CONST(140164.4645176222/8.0), + REAL_CONST(140190.26383462184/8.0), + REAL_CONST(140216.06433864293/8.0), + REAL_CONST(140241.86602957622/8.0), + REAL_CONST(140267.66890731253/8.0), + REAL_CONST(140293.47297174268/8.0), + REAL_CONST(140319.27822275754/8.0), + REAL_CONST(140345.08466024802/8.0), + REAL_CONST(140370.89228410498/8.0), + REAL_CONST(140396.70109421943/8.0), + REAL_CONST(140422.51109048226/8.0), + REAL_CONST(140448.32227278448/8.0), + REAL_CONST(140474.13464101712/8.0), + REAL_CONST(140499.94819507122/8.0), + REAL_CONST(140525.76293483781/8.0), + REAL_CONST(140551.57886020801/8.0), + REAL_CONST(140577.3959710729/8.0), + REAL_CONST(140603.21426732364/8.0), + REAL_CONST(140629.03374885136/8.0), + REAL_CONST(140654.85441554731/8.0), + REAL_CONST(140680.67626730262/8.0), + REAL_CONST(140706.49930400858/8.0), + REAL_CONST(140732.32352555645/8.0), + REAL_CONST(140758.1489318375/8.0), + REAL_CONST(140783.97552274304/8.0), + REAL_CONST(140809.80329816442/8.0), + REAL_CONST(140835.63225799298/8.0), + REAL_CONST(140861.46240212015/8.0), + REAL_CONST(140887.29373043729/8.0), + REAL_CONST(140913.12624283586/8.0), + REAL_CONST(140938.95993920733/8.0), + REAL_CONST(140964.79481944317/8.0), + REAL_CONST(140990.63088343487/8.0), + REAL_CONST(141016.46813107401/8.0), + REAL_CONST(141042.30656225214/8.0), + REAL_CONST(141068.14617686081/8.0), + REAL_CONST(141093.98697479168/8.0), + REAL_CONST(141119.82895593636/8.0), + REAL_CONST(141145.6721201865/8.0), + REAL_CONST(141171.51646743377/8.0), + REAL_CONST(141197.36199756994/8.0), + REAL_CONST(141223.20871048668/8.0), + REAL_CONST(141249.05660607578/8.0), + REAL_CONST(141274.90568422904/8.0), + REAL_CONST(141300.75594483822/8.0), + REAL_CONST(141326.6073877952/8.0), + REAL_CONST(141352.4600129918/8.0), + REAL_CONST(141378.31382031992/8.0), + REAL_CONST(141404.16880967148/8.0), + REAL_CONST(141430.02498093838/8.0), + REAL_CONST(141455.8823340126/8.0), + REAL_CONST(141481.74086878612/8.0), + REAL_CONST(141507.60058515094/8.0), + REAL_CONST(141533.46148299909/8.0), + REAL_CONST(141559.32356222265/8.0), + REAL_CONST(141585.18682271364/8.0), + REAL_CONST(141611.05126436421/8.0), + REAL_CONST(141636.9168870665/8.0), + REAL_CONST(141662.78369071262/8.0), + REAL_CONST(141688.65167519479/8.0), + REAL_CONST(141714.5208404052/8.0), + REAL_CONST(141740.39118623605/8.0), + REAL_CONST(141766.26271257963/8.0), + REAL_CONST(141792.1354193282/8.0), + REAL_CONST(141818.00930637406/8.0), + REAL_CONST(141843.88437360956/8.0), + REAL_CONST(141869.760620927/8.0), + REAL_CONST(141895.6380482188/8.0), + REAL_CONST(141921.51665537735/8.0), + REAL_CONST(141947.39644229505/8.0), + REAL_CONST(141973.27740886438/8.0), + REAL_CONST(141999.15955497778/8.0), + REAL_CONST(142025.04288052776/8.0), + REAL_CONST(142050.92738540689/8.0), + REAL_CONST(142076.81306950765/8.0), + REAL_CONST(142102.69993272264/8.0), + REAL_CONST(142128.58797494444/8.0), + REAL_CONST(142154.47719606571/8.0), + REAL_CONST(142180.36759597904/8.0), + REAL_CONST(142206.25917457714/8.0), + REAL_CONST(142232.15193175265/8.0), + REAL_CONST(142258.04586739838/8.0), + REAL_CONST(142283.94098140698/8.0), + REAL_CONST(142309.83727367126/8.0), + REAL_CONST(142335.73474408401/8.0), + REAL_CONST(142361.63339253806/8.0), + REAL_CONST(142387.5332189262/8.0), + REAL_CONST(142413.43422314132/8.0), + REAL_CONST(142439.33640507635/8.0), + REAL_CONST(142465.23976462413/8.0), + REAL_CONST(142491.14430167765/8.0), + REAL_CONST(142517.05001612983/8.0), + REAL_CONST(142542.95690787368/8.0), + REAL_CONST(142568.86497680223/8.0), + REAL_CONST(142594.77422280848/8.0), + REAL_CONST(142620.68464578551/8.0), + REAL_CONST(142646.5962456264/8.0), + REAL_CONST(142672.50902222423/8.0), + REAL_CONST(142698.42297547215/8.0), + REAL_CONST(142724.33810526333/8.0), + REAL_CONST(142750.25441149093/8.0), + REAL_CONST(142776.17189404817/8.0), + REAL_CONST(142802.09055282827/8.0), + REAL_CONST(142828.01038772447/8.0), + REAL_CONST(142853.93139863008/8.0), + REAL_CONST(142879.85358543837/8.0), + REAL_CONST(142905.77694804268/8.0), + REAL_CONST(142931.70148633636/8.0), + REAL_CONST(142957.62720021277/8.0), + REAL_CONST(142983.55408956532/8.0), + REAL_CONST(143009.48215428743/8.0), + REAL_CONST(143035.41139427255/8.0), + REAL_CONST(143061.34180941415/8.0), + REAL_CONST(143087.27339960571/8.0), + REAL_CONST(143113.20616474075/8.0), + REAL_CONST(143139.14010471283/8.0), + REAL_CONST(143165.07521941551/8.0), + REAL_CONST(143191.01150874238/8.0), + REAL_CONST(143216.94897258704/8.0), + REAL_CONST(143242.88761084314/8.0), + REAL_CONST(143268.82742340435/8.0), + REAL_CONST(143294.76841016437/8.0), + REAL_CONST(143320.71057101688/8.0), + REAL_CONST(143346.65390585564/8.0), + REAL_CONST(143372.59841457437/8.0), + REAL_CONST(143398.54409706692/8.0), + REAL_CONST(143424.49095322701/8.0), + REAL_CONST(143450.43898294857/8.0), + REAL_CONST(143476.38818612538/8.0), + REAL_CONST(143502.33856265133/8.0), + REAL_CONST(143528.29011242036/8.0), + REAL_CONST(143554.24283532638/8.0), + REAL_CONST(143580.19673126334/8.0), + REAL_CONST(143606.1518001252/8.0), + REAL_CONST(143632.10804180597/8.0), + REAL_CONST(143658.06545619969/8.0), + REAL_CONST(143684.02404320039/8.0), + REAL_CONST(143709.98380270213/8.0), + REAL_CONST(143735.944734599/8.0), + REAL_CONST(143761.90683878519/8.0), + REAL_CONST(143787.87011515474/8.0), + REAL_CONST(143813.83456360188/8.0), + REAL_CONST(143839.8001840208/8.0), + REAL_CONST(143865.76697630569/8.0), + REAL_CONST(143891.73494035081/8.0), + REAL_CONST(143917.7040760504/8.0), + REAL_CONST(143943.67438329876/8.0), + REAL_CONST(143969.6458619902/8.0), + REAL_CONST(143995.61851201905/8.0), + REAL_CONST(144021.59233327967/8.0), + REAL_CONST(144047.56732566646/8.0), + REAL_CONST(144073.54348907378/8.0), + REAL_CONST(144099.52082339607/8.0), + REAL_CONST(144125.49932852783/8.0), + REAL_CONST(144151.4790043635/8.0), + REAL_CONST(144177.45985079758/8.0), + REAL_CONST(144203.44186772458/8.0), + REAL_CONST(144229.42505503909/8.0), + REAL_CONST(144255.40941263564/8.0), + REAL_CONST(144281.39494040885/8.0), + REAL_CONST(144307.38163825331/8.0), + REAL_CONST(144333.36950606373/8.0), + REAL_CONST(144359.35854373468/8.0), + REAL_CONST(144385.34875116093/8.0), + REAL_CONST(144411.34012823718/8.0), + REAL_CONST(144437.33267485813/8.0), + REAL_CONST(144463.32639091855/8.0), + REAL_CONST(144489.32127631325/8.0), + REAL_CONST(144515.31733093705/8.0), + REAL_CONST(144541.31455468474/8.0), + REAL_CONST(144567.3129474512/8.0), + REAL_CONST(144593.3125091313/8.0), + REAL_CONST(144619.31323961995/8.0), + REAL_CONST(144645.31513881206/8.0), + REAL_CONST(144671.31820660262/8.0), + REAL_CONST(144697.32244288657/8.0), + REAL_CONST(144723.32784755889/8.0), + REAL_CONST(144749.33442051467/8.0), + REAL_CONST(144775.34216164888/8.0), + REAL_CONST(144801.35107085665/8.0), + REAL_CONST(144827.36114803303/8.0), + REAL_CONST(144853.37239307314/8.0), + REAL_CONST(144879.38480587213/8.0), + REAL_CONST(144905.39838632516/8.0), + REAL_CONST(144931.41313432742/8.0), + REAL_CONST(144957.4290497741/8.0), + REAL_CONST(144983.44613256046/8.0), + REAL_CONST(145009.46438258173/8.0), + REAL_CONST(145035.48379973322/8.0), + REAL_CONST(145061.50438391021/8.0), + REAL_CONST(145087.52613500805/8.0), + REAL_CONST(145113.54905292206/8.0), + REAL_CONST(145139.57313754765/8.0), + REAL_CONST(145165.59838878017/8.0), + REAL_CONST(145191.62480651509/8.0), + REAL_CONST(145217.65239064783/8.0), + REAL_CONST(145243.68114107384/8.0), + REAL_CONST(145269.71105768863/8.0), + REAL_CONST(145295.74214038774/8.0), + REAL_CONST(145321.77438906668/8.0), + REAL_CONST(145347.80780362099/8.0), + REAL_CONST(145373.84238394629/8.0), + REAL_CONST(145399.87812993818/8.0), + REAL_CONST(145425.91504149229/8.0), + REAL_CONST(145451.95311850426/8.0), + REAL_CONST(145477.9923608698/8.0), + REAL_CONST(145504.03276848458/8.0), + REAL_CONST(145530.07434124436/8.0), + REAL_CONST(145556.11707904484/8.0), + REAL_CONST(145582.16098178181/8.0), + REAL_CONST(145608.20604935108/8.0), + REAL_CONST(145634.25228164849/8.0), + REAL_CONST(145660.29967856981/8.0), + REAL_CONST(145686.34824001096/8.0), + REAL_CONST(145712.39796586783/8.0), + REAL_CONST(145738.4488560363/8.0), + REAL_CONST(145764.50091041232/8.0), + REAL_CONST(145790.55412889185/8.0), + REAL_CONST(145816.60851137087/8.0), + REAL_CONST(145842.66405774537/8.0), + REAL_CONST(145868.72076791141/8.0), + REAL_CONST(145894.77864176501/8.0), + REAL_CONST(145920.83767920226/8.0), + REAL_CONST(145946.89788011924/8.0), + REAL_CONST(145972.95924441208/8.0), + REAL_CONST(145999.02177197693/8.0), + REAL_CONST(146025.08546270995/8.0), + REAL_CONST(146051.15031650732/8.0), + REAL_CONST(146077.21633326527/8.0), + REAL_CONST(146103.28351288004/8.0), + REAL_CONST(146129.35185524789/8.0), + REAL_CONST(146155.42136026506/8.0), + REAL_CONST(146181.49202782792/8.0), + REAL_CONST(146207.56385783272/8.0), + REAL_CONST(146233.63685017588/8.0), + REAL_CONST(146259.71100475377/8.0), + REAL_CONST(146285.78632146274/8.0), + REAL_CONST(146311.86280019928/8.0), + REAL_CONST(146337.94044085976/8.0), + REAL_CONST(146364.01924334071/8.0), + REAL_CONST(146390.09920753856/8.0), + REAL_CONST(146416.18033334985/8.0), + REAL_CONST(146442.26262067116/8.0), + REAL_CONST(146468.34606939898/8.0), + REAL_CONST(146494.43067942993/8.0), + REAL_CONST(146520.51645066062/8.0), + REAL_CONST(146546.60338298764/8.0), + REAL_CONST(146572.69147630769/8.0), + REAL_CONST(146598.78073051744/8.0), + REAL_CONST(146624.87114551352/8.0), + REAL_CONST(146650.96272119274/8.0), + REAL_CONST(146677.05545745179/8.0), + REAL_CONST(146703.14935418745/8.0), + REAL_CONST(146729.2444112965/8.0), + REAL_CONST(146755.34062867577/8.0), + REAL_CONST(146781.43800622207/8.0), + REAL_CONST(146807.53654383228/8.0), + REAL_CONST(146833.63624140329/8.0), + REAL_CONST(146859.73709883197/8.0), + REAL_CONST(146885.83911601527/8.0), + REAL_CONST(146911.94229285014/8.0), + REAL_CONST(146938.04662923355/8.0), + REAL_CONST(146964.15212506248/8.0), + REAL_CONST(146990.25878023397/8.0), + REAL_CONST(147016.36659464505/8.0), + REAL_CONST(147042.47556819281/8.0), + REAL_CONST(147068.58570077427/8.0), + REAL_CONST(147094.6969922866/8.0), + REAL_CONST(147120.80944262692/8.0), + REAL_CONST(147146.92305169237/8.0), + REAL_CONST(147173.03781938017/8.0), + REAL_CONST(147199.15374558745/8.0), + REAL_CONST(147225.27083021149/8.0), + REAL_CONST(147251.38907314953/8.0), + REAL_CONST(147277.50847429881/8.0), + REAL_CONST(147303.62903355664/8.0), + REAL_CONST(147329.75075082036/8.0), + REAL_CONST(147355.87362598727/8.0), + REAL_CONST(147381.99765895473/8.0), + REAL_CONST(147408.12284962015/8.0), + REAL_CONST(147434.24919788091/8.0), + REAL_CONST(147460.37670363448/8.0), + REAL_CONST(147486.50536677826/8.0), + REAL_CONST(147512.63518720976/8.0), + REAL_CONST(147538.76616482646/8.0), + REAL_CONST(147564.89829952587/8.0), + REAL_CONST(147591.03159120557/8.0), + REAL_CONST(147617.16603976308/8.0), + REAL_CONST(147643.30164509601/8.0), + REAL_CONST(147669.43840710199/8.0), + REAL_CONST(147695.57632567859/8.0), + REAL_CONST(147721.71540072354/8.0), + REAL_CONST(147747.85563213445/8.0), + REAL_CONST(147773.99701980909/8.0), + REAL_CONST(147800.13956364512/8.0), + REAL_CONST(147826.28326354033/8.0), + REAL_CONST(147852.42811939248/8.0), + REAL_CONST(147878.57413109933/8.0), + REAL_CONST(147904.72129855872/8.0), + REAL_CONST(147930.86962166851/8.0), + REAL_CONST(147957.01910032652/8.0), + REAL_CONST(147983.16973443062/8.0), + REAL_CONST(148009.32152387875/8.0), + REAL_CONST(148035.47446856883/8.0), + REAL_CONST(148061.62856839882/8.0), + REAL_CONST(148087.78382326665/8.0), + REAL_CONST(148113.94023307035/8.0), + REAL_CONST(148140.09779770792/8.0), + REAL_CONST(148166.25651707739/8.0), + REAL_CONST(148192.41639107687/8.0), + REAL_CONST(148218.57741960438/8.0), + REAL_CONST(148244.73960255808/8.0), + REAL_CONST(148270.90293983606/8.0), + REAL_CONST(148297.0674313365/8.0), + REAL_CONST(148323.23307695755/8.0), + REAL_CONST(148349.39987659742/8.0), + REAL_CONST(148375.56783015432/8.0), + REAL_CONST(148401.73693752653/8.0), + REAL_CONST(148427.90719861226/8.0), + REAL_CONST(148454.07861330983/8.0), + REAL_CONST(148480.25118151752/8.0), + REAL_CONST(148506.42490313368/8.0), + REAL_CONST(148532.59977805667/8.0), + REAL_CONST(148558.77580618486/8.0), + REAL_CONST(148584.95298741665/8.0), + REAL_CONST(148611.13132165043/8.0), + REAL_CONST(148637.31080878471/8.0), + REAL_CONST(148663.49144871789/8.0), + REAL_CONST(148689.6732413485/8.0), + REAL_CONST(148715.85618657502/8.0), + REAL_CONST(148742.040284296/8.0), + REAL_CONST(148768.22553440998/8.0), + REAL_CONST(148794.41193681557/8.0), + REAL_CONST(148820.59949141133/8.0), + REAL_CONST(148846.78819809589/8.0), + REAL_CONST(148872.97805676793/8.0), + REAL_CONST(148899.16906732606/8.0), + REAL_CONST(148925.36122966901/8.0), + REAL_CONST(148951.55454369547/8.0), + REAL_CONST(148977.74900930419/8.0), + REAL_CONST(149003.9446263939/8.0), + REAL_CONST(149030.1413948634/8.0), + REAL_CONST(149056.33931461151/8.0), + REAL_CONST(149082.53838553699/8.0), + REAL_CONST(149108.73860753875/8.0), + REAL_CONST(149134.9399805156/8.0), + REAL_CONST(149161.14250436646/8.0), + REAL_CONST(149187.34617899026/8.0), + REAL_CONST(149213.5510042859/8.0), + REAL_CONST(149239.75698015234/8.0), + REAL_CONST(149265.96410648854/8.0), + REAL_CONST(149292.17238319354/8.0), + REAL_CONST(149318.38181016635/8.0), + REAL_CONST(149344.59238730598/8.0), + REAL_CONST(149370.80411451156/8.0), + REAL_CONST(149397.01699168212/8.0), + REAL_CONST(149423.23101871679/8.0), + REAL_CONST(149449.44619551473/8.0), + REAL_CONST(149475.66252197503/8.0), + REAL_CONST(149501.87999799693/8.0), + REAL_CONST(149528.0986234796/8.0), + REAL_CONST(149554.31839832227/8.0), + REAL_CONST(149580.53932242419/8.0), + REAL_CONST(149606.76139568459/8.0), + REAL_CONST(149632.98461800278/8.0), + REAL_CONST(149659.20898927809/8.0), + REAL_CONST(149685.43450940982/8.0), + REAL_CONST(149711.66117829733/8.0), + REAL_CONST(149737.88899584001/8.0), + REAL_CONST(149764.11796193724/8.0), + REAL_CONST(149790.34807648844/8.0), + REAL_CONST(149816.57933939309/8.0), + REAL_CONST(149842.81175055061/8.0), + REAL_CONST(149869.04530986046/8.0), + REAL_CONST(149895.28001722222/8.0), + REAL_CONST(149921.51587253538/8.0), + REAL_CONST(149947.75287569952/8.0), + REAL_CONST(149973.99102661415/8.0), + REAL_CONST(150000.23032517891/8.0), + REAL_CONST(150026.47077129342/8.0), + REAL_CONST(150052.71236485732/8.0), + REAL_CONST(150078.95510577026/8.0), + REAL_CONST(150105.1989939319/8.0), + REAL_CONST(150131.444029242/8.0), + REAL_CONST(150157.69021160025/8.0), + REAL_CONST(150183.93754090639/8.0), + REAL_CONST(150210.18601706024/8.0), + REAL_CONST(150236.43563996154/8.0), + REAL_CONST(150262.68640951012/8.0), + REAL_CONST(150288.93832560582/8.0), + REAL_CONST(150315.19138814852/8.0), + REAL_CONST(150341.44559703805/8.0), + REAL_CONST(150367.70095217437/8.0), + REAL_CONST(150393.95745345735/8.0), + REAL_CONST(150420.21510078697/8.0), + REAL_CONST(150446.47389406321/8.0), + REAL_CONST(150472.73383318601/8.0), + REAL_CONST(150498.99491805542/8.0), + REAL_CONST(150525.25714857146/8.0), + REAL_CONST(150551.52052463419/8.0), + REAL_CONST(150577.78504614369/8.0), + REAL_CONST(150604.05071300003/8.0), + REAL_CONST(150630.31752510337/8.0), + REAL_CONST(150656.58548235384/8.0), + REAL_CONST(150682.85458465159/8.0), + REAL_CONST(150709.1248318968/8.0), + REAL_CONST(150735.39622398972/8.0), + REAL_CONST(150761.66876083051/8.0), + REAL_CONST(150787.9424423195/8.0), + REAL_CONST(150814.21726835691/8.0), + REAL_CONST(150840.49323884305/8.0), + REAL_CONST(150866.77035367821/8.0), + REAL_CONST(150893.04861276277/8.0), + REAL_CONST(150919.32801599705/8.0), + REAL_CONST(150945.60856328148/8.0), + REAL_CONST(150971.89025451642/8.0), + REAL_CONST(150998.17308960229/8.0), + REAL_CONST(151024.45706843957/8.0), + REAL_CONST(151050.74219092872/8.0), + REAL_CONST(151077.02845697021/8.0), + REAL_CONST(151103.31586646455/8.0), + REAL_CONST(151129.60441931229/8.0), + REAL_CONST(151155.894115414/8.0), + REAL_CONST(151182.1849546702/8.0), + REAL_CONST(151208.47693698155/8.0), + REAL_CONST(151234.77006224863/8.0), + REAL_CONST(151261.06433037209/8.0), + REAL_CONST(151287.35974125259/8.0), + REAL_CONST(151313.65629479082/8.0), + REAL_CONST(151339.95399088747/8.0), + REAL_CONST(151366.25282944329/8.0), + REAL_CONST(151392.55281035902/8.0), + REAL_CONST(151418.85393353543/8.0), + REAL_CONST(151445.1561988733/8.0), + REAL_CONST(151471.45960627345/8.0), + REAL_CONST(151497.76415563675/8.0), + REAL_CONST(151524.06984686397/8.0), + REAL_CONST(151550.37667985607/8.0), + REAL_CONST(151576.68465451393/8.0), + REAL_CONST(151602.99377073845/8.0), + REAL_CONST(151629.30402843058/8.0), + REAL_CONST(151655.61542749128/8.0), + REAL_CONST(151681.92796782157/8.0), + REAL_CONST(151708.24164932242/8.0), + REAL_CONST(151734.55647189484/8.0), + REAL_CONST(151760.87243543993/8.0), + REAL_CONST(151787.18953985872/8.0), + REAL_CONST(151813.50778505235/8.0), + REAL_CONST(151839.82717092187/8.0), + REAL_CONST(151866.14769736846/8.0), + REAL_CONST(151892.46936429327/8.0), + REAL_CONST(151918.79217159748/8.0), + REAL_CONST(151945.11611918229/8.0), + REAL_CONST(151971.44120694889/8.0), + REAL_CONST(151997.76743479856/8.0), + REAL_CONST(152024.09480263255/8.0), + REAL_CONST(152050.42331035214/8.0), + REAL_CONST(152076.75295785864/8.0), + REAL_CONST(152103.08374505339/8.0), + REAL_CONST(152129.41567183775/8.0), + REAL_CONST(152155.74873811303/8.0), + REAL_CONST(152182.08294378067/8.0), + REAL_CONST(152208.41828874208/8.0), + REAL_CONST(152234.75477289871/8.0), + REAL_CONST(152261.09239615197/8.0), + REAL_CONST(152287.43115840337/8.0), + REAL_CONST(152313.77105955439/8.0), + REAL_CONST(152340.11209950657/8.0), + REAL_CONST(152366.45427816146/8.0), + REAL_CONST(152392.79759542056/8.0), + REAL_CONST(152419.14205118554/8.0), + REAL_CONST(152445.48764535793/8.0), + REAL_CONST(152471.8343778394/8.0), + REAL_CONST(152498.18224853161/8.0), + REAL_CONST(152524.53125733617/8.0), + REAL_CONST(152550.88140415482/8.0), + REAL_CONST(152577.23268888926/8.0), + REAL_CONST(152603.58511144121/8.0), + REAL_CONST(152629.93867171241/8.0), + REAL_CONST(152656.29336960468/8.0), + REAL_CONST(152682.64920501978/8.0), + REAL_CONST(152709.00617785956/8.0), + REAL_CONST(152735.36428802583/8.0), + REAL_CONST(152761.72353542043/8.0), + REAL_CONST(152788.08391994529/8.0), + REAL_CONST(152814.44544150229/8.0), + REAL_CONST(152840.80809999333/8.0), + REAL_CONST(152867.17189532038/8.0), + REAL_CONST(152893.53682738543/8.0), + REAL_CONST(152919.90289609041/8.0), + REAL_CONST(152946.27010133737/8.0), + REAL_CONST(152972.63844302832/8.0), + REAL_CONST(152999.00792106529/8.0), + REAL_CONST(153025.37853535041/8.0), + REAL_CONST(153051.7502857857/8.0), + REAL_CONST(153078.12317227334/8.0), + REAL_CONST(153104.4971947154/8.0), + REAL_CONST(153130.8723530141/8.0), + REAL_CONST(153157.24864707157/8.0), + REAL_CONST(153183.62607679001/8.0), + REAL_CONST(153210.00464207167/8.0), + REAL_CONST(153236.38434281875/8.0), + REAL_CONST(153262.76517893354/8.0), + REAL_CONST(153289.14715031831/8.0), + REAL_CONST(153315.53025687535/8.0), + REAL_CONST(153341.91449850702/8.0), + REAL_CONST(153368.2998751156/8.0), + REAL_CONST(153394.68638660354/8.0), + REAL_CONST(153421.07403287315/8.0), + REAL_CONST(153447.46281382689/8.0), + REAL_CONST(153473.85272936718/8.0), + REAL_CONST(153500.24377939643/8.0), + REAL_CONST(153526.63596381716/8.0), + REAL_CONST(153553.02928253182/8.0), + REAL_CONST(153579.42373544298/8.0), + REAL_CONST(153605.81932245308/8.0), + REAL_CONST(153632.21604346478/8.0), + REAL_CONST(153658.61389838057/8.0), + REAL_CONST(153685.0128871031/8.0), + REAL_CONST(153711.41300953497/8.0), + REAL_CONST(153737.81426557881/8.0), + REAL_CONST(153764.21665513728/8.0), + REAL_CONST(153790.62017811305/8.0), + REAL_CONST(153817.02483440886/8.0), + REAL_CONST(153843.43062392739/8.0), + REAL_CONST(153869.83754657139/8.0), + REAL_CONST(153896.24560224367/8.0), + REAL_CONST(153922.65479084692/8.0), + REAL_CONST(153949.06511228404/8.0), + REAL_CONST(153975.4765664578/8.0), + REAL_CONST(154001.88915327107/8.0), + REAL_CONST(154028.30287262669/8.0), + REAL_CONST(154054.71772442761/8.0), + REAL_CONST(154081.13370857667/8.0), + REAL_CONST(154107.55082497682/8.0), + REAL_CONST(154133.96907353101/8.0), + REAL_CONST(154160.38845414223/8.0), + REAL_CONST(154186.80896671346/8.0), + REAL_CONST(154213.23061114774/8.0), + REAL_CONST(154239.65338734805/8.0), + REAL_CONST(154266.07729521746/8.0), + REAL_CONST(154292.50233465908/8.0), + REAL_CONST(154318.92850557598/8.0), + REAL_CONST(154345.35580787127/8.0), + REAL_CONST(154371.7842414481/8.0), + REAL_CONST(154398.21380620965/8.0), + REAL_CONST(154424.64450205903/8.0), + REAL_CONST(154451.07632889951/8.0), + REAL_CONST(154477.50928663427/8.0), + REAL_CONST(154503.94337516659/8.0), + REAL_CONST(154530.37859439969/8.0), + REAL_CONST(154556.81494423689/8.0), + REAL_CONST(154583.25242458144/8.0), + REAL_CONST(154609.69103533673/8.0), + REAL_CONST(154636.13077640603/8.0), + REAL_CONST(154662.57164769279/8.0), + REAL_CONST(154689.01364910032/8.0), + REAL_CONST(154715.45678053208/8.0), + REAL_CONST(154741.90104189145/8.0), + REAL_CONST(154768.34643308193/8.0), + REAL_CONST(154794.79295400696/8.0), + REAL_CONST(154821.24060457002/8.0), + REAL_CONST(154847.68938467462/8.0), + REAL_CONST(154874.13929422433/8.0), + REAL_CONST(154900.59033312264/8.0), + REAL_CONST(154927.04250127316/8.0), + REAL_CONST(154953.49579857948/8.0), + REAL_CONST(154979.95022494521/8.0), + REAL_CONST(155006.40578027396/8.0), + REAL_CONST(155032.86246446942/8.0), + REAL_CONST(155059.32027743524/8.0), + REAL_CONST(155085.77921907514/8.0), + REAL_CONST(155112.2392892928/8.0), + REAL_CONST(155138.70048799197/8.0), + REAL_CONST(155165.16281507642/8.0), + REAL_CONST(155191.62627044989/8.0), + REAL_CONST(155218.09085401625/8.0), + REAL_CONST(155244.55656567923/8.0), + REAL_CONST(155271.02340534274/8.0), + REAL_CONST(155297.49137291059/8.0), + REAL_CONST(155323.96046828668/8.0), + REAL_CONST(155350.4306913749/8.0), + REAL_CONST(155376.90204207919/8.0), + REAL_CONST(155403.37452030348/8.0), + REAL_CONST(155429.84812595171/8.0), + REAL_CONST(155456.32285892789/8.0), + REAL_CONST(155482.79871913602/8.0), + REAL_CONST(155509.27570648011/8.0), + REAL_CONST(155535.75382086422/8.0), + REAL_CONST(155562.23306219239/8.0), + REAL_CONST(155588.71343036872/8.0), + REAL_CONST(155615.19492529731/8.0), + REAL_CONST(155641.67754688227/8.0), + REAL_CONST(155668.16129502779/8.0), + REAL_CONST(155694.64616963797/8.0), + REAL_CONST(155721.13217061706/8.0), + REAL_CONST(155747.61929786921/8.0), + REAL_CONST(155774.10755129869/8.0), + REAL_CONST(155800.59693080973/8.0), + REAL_CONST(155827.08743630661/8.0), + REAL_CONST(155853.57906769359/8.0), + REAL_CONST(155880.07182487496/8.0), + REAL_CONST(155906.56570775513/8.0), + REAL_CONST(155933.06071623837/8.0), + REAL_CONST(155959.55685022907/8.0), + REAL_CONST(155986.05410963166/8.0), + REAL_CONST(156012.5524943505/8.0), + REAL_CONST(156039.05200429002/8.0), + REAL_CONST(156065.55263935472/8.0), + REAL_CONST(156092.054399449/8.0), + REAL_CONST(156118.5572844774/8.0), + REAL_CONST(156145.06129434443/8.0), + REAL_CONST(156171.5664289546/8.0), + REAL_CONST(156198.07268821247/8.0), + REAL_CONST(156224.5800720226/8.0), + REAL_CONST(156251.08858028959/8.0), + REAL_CONST(156277.59821291809/8.0), + REAL_CONST(156304.10896981266/8.0), + REAL_CONST(156330.62085087801/8.0), + REAL_CONST(156357.1338560188/8.0), + REAL_CONST(156383.64798513969/8.0), + REAL_CONST(156410.16323814544/8.0), + REAL_CONST(156436.67961494075/8.0), + REAL_CONST(156463.1971154304/8.0), + REAL_CONST(156489.71573951913/8.0), + REAL_CONST(156516.23548711176/8.0), + REAL_CONST(156542.75635811311/8.0), + REAL_CONST(156569.27835242799/8.0), + REAL_CONST(156595.80146996127/8.0), + REAL_CONST(156622.32571061782/8.0), + REAL_CONST(156648.85107430254/8.0), + REAL_CONST(156675.37756092031/8.0), + REAL_CONST(156701.90517037612/8.0), + REAL_CONST(156728.43390257491/8.0), + REAL_CONST(156754.96375742162/8.0), + REAL_CONST(156781.49473482129/8.0), + REAL_CONST(156808.02683467892/8.0), + REAL_CONST(156834.5600568995/8.0), + REAL_CONST(156861.09440138817/8.0), + REAL_CONST(156887.62986804993/8.0), + REAL_CONST(156914.16645678994/8.0), + REAL_CONST(156940.70416751326/8.0), + REAL_CONST(156967.24300012505/8.0), + REAL_CONST(156993.78295453047/8.0), + REAL_CONST(157020.32403063469/8.0), + REAL_CONST(157046.8662283429/8.0), + REAL_CONST(157073.40954756032/8.0), + REAL_CONST(157099.9539881922/8.0), + REAL_CONST(157126.49955014378/8.0), + REAL_CONST(157153.04623332032/8.0), + REAL_CONST(157179.59403762716/8.0), + REAL_CONST(157206.14296296958/8.0), + REAL_CONST(157232.69300925292/8.0), + REAL_CONST(157259.24417638258/8.0), + REAL_CONST(157285.79646426387/8.0), + REAL_CONST(157312.34987280221/8.0), + REAL_CONST(157338.90440190304/8.0), + REAL_CONST(157365.46005147175/8.0), + REAL_CONST(157392.01682141385/8.0), + REAL_CONST(157418.57471163478/8.0), + REAL_CONST(157445.13372204005/8.0), + REAL_CONST(157471.69385253513/8.0), + REAL_CONST(157498.25510302564/8.0), + REAL_CONST(157524.81747341706/8.0), + REAL_CONST(157551.38096361503/8.0), + REAL_CONST(157577.9455735251/8.0), + REAL_CONST(157604.51130305286/8.0), + REAL_CONST(157631.07815210402/8.0), + REAL_CONST(157657.64612058419/8.0), + REAL_CONST(157684.21520839902/8.0), + REAL_CONST(157710.78541545427/8.0), + REAL_CONST(157737.35674165559/8.0), + REAL_CONST(157763.92918690876/8.0), + REAL_CONST(157790.50275111952/8.0), + REAL_CONST(157817.07743419363/8.0), + REAL_CONST(157843.65323603692/8.0), + REAL_CONST(157870.23015655516/8.0), + REAL_CONST(157896.80819565422/8.0), + REAL_CONST(157923.3873532399/8.0), + REAL_CONST(157949.96762921812/8.0), + REAL_CONST(157976.54902349479/8.0), + REAL_CONST(158003.13153597576/8.0), + REAL_CONST(158029.71516656701/8.0), + REAL_CONST(158056.29991517449/8.0), + REAL_CONST(158082.88578170416/8.0), + REAL_CONST(158109.47276606198/8.0), + REAL_CONST(158136.06086815402/8.0), + REAL_CONST(158162.65008788629/8.0), + REAL_CONST(158189.24042516484/8.0), + REAL_CONST(158215.83187989573/8.0), + REAL_CONST(158242.42445198505/8.0), + REAL_CONST(158269.01814133892/8.0), + REAL_CONST(158295.61294786347/8.0), + REAL_CONST(158322.20887146486/8.0), + REAL_CONST(158348.80591204923/8.0), + REAL_CONST(158375.4040695228/8.0), + REAL_CONST(158402.00334379176/8.0), + REAL_CONST(158428.60373476235/8.0), + REAL_CONST(158455.2052423408/8.0), + REAL_CONST(158481.80786643337/8.0), + REAL_CONST(158508.41160694641/8.0), + REAL_CONST(158535.01646378616/8.0), + REAL_CONST(158561.62243685898/8.0), + REAL_CONST(158588.2295260712/8.0), + REAL_CONST(158614.8377313292/8.0), + REAL_CONST(158641.44705253936/8.0), + REAL_CONST(158668.05748960807/8.0), + REAL_CONST(158694.66904244179/8.0), + REAL_CONST(158721.28171094693/8.0), + REAL_CONST(158747.89549502998/8.0), + REAL_CONST(158774.5103945974/8.0), + REAL_CONST(158801.12640955573/8.0), + REAL_CONST(158827.74353981143/8.0), + REAL_CONST(158854.36178527112/8.0), + REAL_CONST(158880.9811458413/8.0), + REAL_CONST(158907.60162142856/8.0), + REAL_CONST(158934.22321193956/8.0), + REAL_CONST(158960.84591728085/8.0), + REAL_CONST(158987.46973735912/8.0), + REAL_CONST(159014.09467208097/8.0), + REAL_CONST(159040.72072135314/8.0), + REAL_CONST(159067.3478850823/8.0), + REAL_CONST(159093.97616317519/8.0), + REAL_CONST(159120.60555553852/8.0), + REAL_CONST(159147.23606207906/8.0), + REAL_CONST(159173.8676827036/8.0), + REAL_CONST(159200.50041731889/8.0), + REAL_CONST(159227.13426583182/8.0), + REAL_CONST(159253.76922814918/8.0), + REAL_CONST(159280.40530417781/8.0), + REAL_CONST(159307.04249382461/8.0), + REAL_CONST(159333.68079699649/8.0), + REAL_CONST(159360.32021360032/8.0), + REAL_CONST(159386.96074354305/8.0), + REAL_CONST(159413.60238673165/8.0), + REAL_CONST(159440.24514307309/8.0), + REAL_CONST(159466.88901247433/8.0), + REAL_CONST(159493.53399484244/8.0), + REAL_CONST(159520.18009008438/8.0), + REAL_CONST(159546.82729810724/8.0), + REAL_CONST(159573.47561881805/8.0), + REAL_CONST(159600.12505212394/8.0), + REAL_CONST(159626.77559793202/8.0), + REAL_CONST(159653.42725614941/8.0), + REAL_CONST(159680.08002668325/8.0), + REAL_CONST(159706.73390944069/8.0), + REAL_CONST(159733.38890432892/8.0), + REAL_CONST(159760.04501125516/8.0), + REAL_CONST(159786.70223012666/8.0), + REAL_CONST(159813.36056085059/8.0), + REAL_CONST(159840.02000333427/8.0), + REAL_CONST(159866.68055748497/8.0), + REAL_CONST(159893.34222320997/8.0), + REAL_CONST(159920.00500041663/8.0), + REAL_CONST(159946.66888901225/8.0), + REAL_CONST(159973.33388890422/8.0), + REAL_CONST(159999.99999999988/8.0), + REAL_CONST(160026.66722220668/8.0), + REAL_CONST(160053.33555543202/8.0), + REAL_CONST(160080.0049995833/8.0), + REAL_CONST(160106.67555456801/8.0), + REAL_CONST(160133.3472202936/8.0), + REAL_CONST(160160.0199966676/8.0), + REAL_CONST(160186.6938835975/8.0), + REAL_CONST(160213.36888099083/8.0), + REAL_CONST(160240.04498875517/8.0), + REAL_CONST(160266.72220679806/8.0), + REAL_CONST(160293.40053502709/8.0), + REAL_CONST(160320.07997334987/8.0), + REAL_CONST(160346.76052167406/8.0), + REAL_CONST(160373.44217990729/8.0), + REAL_CONST(160400.1249479572/8.0), + REAL_CONST(160426.80882573154/8.0), + REAL_CONST(160453.49381313793/8.0), + REAL_CONST(160480.17991008417/8.0), + REAL_CONST(160506.86711647795/8.0), + REAL_CONST(160533.55543222709/8.0), + REAL_CONST(160560.24485723933/8.0), + REAL_CONST(160586.93539142248/8.0), + REAL_CONST(160613.62703468435/8.0), + REAL_CONST(160640.31978693281/8.0), + REAL_CONST(160667.01364807569/8.0), + REAL_CONST(160693.70861802087/8.0), + REAL_CONST(160720.40469667627/8.0), + REAL_CONST(160747.1018839498/8.0), + REAL_CONST(160773.80017974938/8.0), + REAL_CONST(160800.49958398298/8.0), + REAL_CONST(160827.20009655855/8.0), + REAL_CONST(160853.90171738411/8.0), + REAL_CONST(160880.60444636765/8.0), + REAL_CONST(160907.30828341722/8.0), + REAL_CONST(160934.01322844089/8.0), + REAL_CONST(160960.71928134665/8.0), + REAL_CONST(160987.42644204266/8.0), + REAL_CONST(161014.13471043704/8.0), + REAL_CONST(161040.84408643784/8.0), + REAL_CONST(161067.55456995327/8.0), + REAL_CONST(161094.26616089148/8.0), + REAL_CONST(161120.97885916062/8.0), + REAL_CONST(161147.69266466892/8.0), + REAL_CONST(161174.40757732463/8.0), + REAL_CONST(161201.12359703594/8.0), + REAL_CONST(161227.84072371112/8.0), + REAL_CONST(161254.55895725847/8.0), + REAL_CONST(161281.27829758628/8.0), + REAL_CONST(161307.99874460287/8.0), + REAL_CONST(161334.72029821656/8.0), + REAL_CONST(161361.44295833571/8.0), + REAL_CONST(161388.1667248687/8.0), + REAL_CONST(161414.89159772391/8.0), + REAL_CONST(161441.61757680977/8.0), + REAL_CONST(161468.34466203468/8.0), + REAL_CONST(161495.07285330712/8.0), + REAL_CONST(161521.80215053557/8.0), + REAL_CONST(161548.53255362847/8.0), + REAL_CONST(161575.26406249436/8.0), + REAL_CONST(161601.99667704175/8.0), + REAL_CONST(161628.7303971792/8.0), + REAL_CONST(161655.46522281526/8.0), + REAL_CONST(161682.20115385848/8.0), + REAL_CONST(161708.93819021754/8.0), + REAL_CONST(161735.67633180099/8.0), + REAL_CONST(161762.41557851751/8.0), + REAL_CONST(161789.15593027571/8.0), + REAL_CONST(161815.89738698432/8.0), + REAL_CONST(161842.63994855201/8.0), + REAL_CONST(161869.38361488748/8.0), + REAL_CONST(161896.1283858995/8.0), + REAL_CONST(161922.87426149679/8.0), + REAL_CONST(161949.62124158812/8.0), + REAL_CONST(161976.36932608229/8.0), + REAL_CONST(162003.1185148881/8.0), + REAL_CONST(162029.8688079144/8.0), + REAL_CONST(162056.62020507001/8.0), + REAL_CONST(162083.37270626382/8.0), + REAL_CONST(162110.12631140469/8.0), + REAL_CONST(162136.88102040152/8.0), + REAL_CONST(162163.63683316324/8.0), + REAL_CONST(162190.39374959879/8.0), + REAL_CONST(162217.15176961714/8.0), + REAL_CONST(162243.91089312723/8.0), + REAL_CONST(162270.67112003808/8.0), + REAL_CONST(162297.43245025873/8.0), + REAL_CONST(162324.19488369819/8.0), + REAL_CONST(162350.9584202655/8.0), + REAL_CONST(162377.72305986975/8.0), + REAL_CONST(162404.48880242003/8.0), + REAL_CONST(162431.25564782543/8.0), + REAL_CONST(162458.02359599507/8.0), + REAL_CONST(162484.79264683815/8.0), + REAL_CONST(162511.56280026378/8.0), + REAL_CONST(162538.33405618116/8.0), + REAL_CONST(162565.10641449949/8.0), + REAL_CONST(162591.87987512801/8.0), + REAL_CONST(162618.65443797593/8.0), + REAL_CONST(162645.43010295252/8.0), + REAL_CONST(162672.20686996708/8.0), + REAL_CONST(162698.98473892888/8.0), + REAL_CONST(162725.76370974723/8.0), + REAL_CONST(162752.54378233149/8.0), + REAL_CONST(162779.32495659095/8.0), + REAL_CONST(162806.10723243505/8.0), + REAL_CONST(162832.89060977317/8.0), + REAL_CONST(162859.67508851466/8.0), + REAL_CONST(162886.46066856899/8.0), + REAL_CONST(162913.24734984562/8.0), + REAL_CONST(162940.03513225398/8.0), + REAL_CONST(162966.82401570358/8.0), + REAL_CONST(162993.6140001039/8.0), + REAL_CONST(163020.40508536444/8.0), + REAL_CONST(163047.19727139481/8.0), + REAL_CONST(163073.99055810447/8.0), + REAL_CONST(163100.78494540305/8.0), + REAL_CONST(163127.58043320014/8.0), + REAL_CONST(163154.37702140535/8.0), + REAL_CONST(163181.17470992831/8.0), + REAL_CONST(163207.97349867865/8.0), + REAL_CONST(163234.77338756606/8.0), + REAL_CONST(163261.57437650024/8.0), + REAL_CONST(163288.37646539087/8.0), + REAL_CONST(163315.17965414765/8.0), + REAL_CONST(163341.98394268038/8.0), + REAL_CONST(163368.78933089875/8.0), + REAL_CONST(163395.59581871261/8.0), + REAL_CONST(163422.40340603172/8.0), + REAL_CONST(163449.2120927659/8.0), + REAL_CONST(163476.02187882498/8.0), + REAL_CONST(163502.83276411882/8.0), + REAL_CONST(163529.6447485573/8.0), + REAL_CONST(163556.45783205028/8.0), + REAL_CONST(163583.2720145077/8.0), + REAL_CONST(163610.08729583945/8.0), + REAL_CONST(163636.90367595552/8.0), + REAL_CONST(163663.72115476584/8.0), + REAL_CONST(163690.53973218042/8.0), + REAL_CONST(163717.35940810922/8.0), + REAL_CONST(163744.18018246227/8.0), + REAL_CONST(163771.00205514964/8.0), + REAL_CONST(163797.82502608138/8.0), + REAL_CONST(163824.64909516752/8.0), + REAL_CONST(163851.4742623182/8.0), + REAL_CONST(163878.3005274435/8.0), + REAL_CONST(163905.12789045356/8.0), + REAL_CONST(163931.95635125853/8.0), + REAL_CONST(163958.78590976857/8.0), + REAL_CONST(163985.61656589387/8.0), + REAL_CONST(164012.44831954464/8.0), + REAL_CONST(164039.28117063109/8.0), + REAL_CONST(164066.11511906344/8.0), + REAL_CONST(164092.95016475199/8.0), + REAL_CONST(164119.78630760699/8.0), + REAL_CONST(164146.62354753874/8.0), + REAL_CONST(164173.46188445756/8.0), + REAL_CONST(164200.30131827376/8.0), + REAL_CONST(164227.14184889771/8.0), + REAL_CONST(164253.98347623978/8.0), + REAL_CONST(164280.82620021031/8.0), + REAL_CONST(164307.67002071979/8.0), + REAL_CONST(164334.51493767856/8.0), + REAL_CONST(164361.3609509971/8.0), + REAL_CONST(164388.20806058586/8.0), + REAL_CONST(164415.05626635533/8.0), + REAL_CONST(164441.905568216/8.0), + REAL_CONST(164468.75596607837/8.0), + REAL_CONST(164495.607459853/8.0), + REAL_CONST(164522.4600494504/8.0), + REAL_CONST(164549.31373478117/8.0), + REAL_CONST(164576.16851575591/8.0), + REAL_CONST(164603.02439228518/8.0), + REAL_CONST(164629.88136427966/8.0), + REAL_CONST(164656.73943164994/8.0), + REAL_CONST(164683.59859430668/8.0), + REAL_CONST(164710.45885216061/8.0), + REAL_CONST(164737.32020512238/8.0), + REAL_CONST(164764.1826531027/8.0), + REAL_CONST(164791.04619601235/8.0), + REAL_CONST(164817.91083376206/8.0), + REAL_CONST(164844.77656626256/8.0), + REAL_CONST(164871.64339342469/8.0), + REAL_CONST(164898.51131515924/8.0), + REAL_CONST(164925.38033137703/8.0), + REAL_CONST(164952.25044198887/8.0), + REAL_CONST(164979.1216469057/8.0), + REAL_CONST(165005.9939460383/8.0), + REAL_CONST(165032.86733929763/8.0), + REAL_CONST(165059.7418265946/8.0), + REAL_CONST(165086.61740784015/8.0), + REAL_CONST(165113.4940829452/8.0) +#endif +}; + +#endif + +#ifdef __cplusplus +} +#endif +#endif diff --git a/Libraries/FAAD2/Files/libfaad/is.c b/Libraries/FAAD2/Files/libfaad/is.c new file mode 100644 index 000000000..127558fb7 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/is.c @@ -0,0 +1,106 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#include "common.h" +#include "structs.h" + +#include "syntax.h" +#include "is.h" + +#ifdef FIXED_POINT +static real_t pow05_table[] = { + COEF_CONST(1.68179283050743), /* 0.5^(-3/4) */ + COEF_CONST(1.41421356237310), /* 0.5^(-2/4) */ + COEF_CONST(1.18920711500272), /* 0.5^(-1/4) */ + COEF_CONST(1.0), /* 0.5^( 0/4) */ + COEF_CONST(0.84089641525371), /* 0.5^(+1/4) */ + COEF_CONST(0.70710678118655), /* 0.5^(+2/4) */ + COEF_CONST(0.59460355750136) /* 0.5^(+3/4) */ +}; +#endif + +void is_decode(ic_stream *ics, ic_stream *icsr, real_t *l_spec, real_t *r_spec, + uint16_t frame_len) +{ + uint8_t g, sfb, b; + uint16_t i; +#ifndef FIXED_POINT + real_t scale; +#else + int32_t exp, frac; +#endif + + uint16_t nshort = frame_len/8; + uint8_t group = 0; + + for (g = 0; g < icsr->num_window_groups; g++) + { + /* Do intensity stereo decoding */ + for (b = 0; b < icsr->window_group_length[g]; b++) + { + for (sfb = 0; sfb < icsr->max_sfb; sfb++) + { + if (is_intensity(icsr, g, sfb)) + { +#ifdef MAIN_DEC + /* For scalefactor bands coded in intensity stereo the + corresponding predictors in the right channel are + switched to "off". + */ + ics->pred.prediction_used[sfb] = 0; + icsr->pred.prediction_used[sfb] = 0; +#endif + +#ifndef FIXED_POINT + scale = (real_t)pow(0.5, (0.25*icsr->scale_factors[g][sfb])); +#else + exp = icsr->scale_factors[g][sfb] >> 2; + frac = icsr->scale_factors[g][sfb] & 3; +#endif + + /* Scale from left to right channel, + do not touch left channel */ + for (i = icsr->swb_offset[sfb]; i < icsr->swb_offset[sfb+1]; i++) + { +#ifndef FIXED_POINT + r_spec[(group*nshort)+i] = MUL_R(l_spec[(group*nshort)+i], scale); +#else + if (exp < 0) + r_spec[(group*nshort)+i] = l_spec[(group*nshort)+i] << -exp; + else + r_spec[(group*nshort)+i] = l_spec[(group*nshort)+i] >> exp; + r_spec[(group*nshort)+i] = MUL_C(r_spec[(group*nshort)+i], pow05_table[frac + 3]); +#endif + if (is_intensity(icsr, g, sfb) != invert_intensity(ics, g, sfb)) + r_spec[(group*nshort)+i] = -r_spec[(group*nshort)+i]; + } + } + } + group++; + } + } +} diff --git a/Libraries/FAAD2/Files/libfaad/is.h b/Libraries/FAAD2/Files/libfaad/is.h new file mode 100644 index 000000000..1b68f3ec4 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/is.h @@ -0,0 +1,64 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#ifndef __IS_H__ +#define __IS_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "syntax.h" + +void is_decode(ic_stream *ics, ic_stream *icsr, real_t *l_spec, real_t *r_spec, + uint16_t frame_len); + +static INLINE int8_t is_intensity(ic_stream *ics, uint8_t group, uint8_t sfb) +{ + switch (ics->sfb_cb[group][sfb]) + { + case INTENSITY_HCB: + return 1; + case INTENSITY_HCB2: + return -1; + default: + return 0; + } +} + +static INLINE int8_t invert_intensity(ic_stream *ics, uint8_t group, uint8_t sfb) +{ + if (ics->ms_mask_present == 1) + return (1-2*ics->ms_used[group][sfb]); + return 1; +} + + +#ifdef __cplusplus +} +#endif +#endif diff --git a/Libraries/FAAD2/Files/libfaad/kbd_win.h b/Libraries/FAAD2/Files/libfaad/kbd_win.h new file mode 100644 index 000000000..933e6c1de --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/kbd_win.h @@ -0,0 +1,2294 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#ifndef __KBD_WIN_H__ +#define __KBD_WIN_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef _MSC_VER +#pragma warning(disable:4305) +#pragma warning(disable:4244) +#endif + +ALIGN static const real_t kbd_long_1024[] = +{ + FRAC_CONST(0.00029256153896361), + FRAC_CONST(0.00042998567353047), + FRAC_CONST(0.00054674074589540), + FRAC_CONST(0.00065482304299792), + FRAC_CONST(0.00075870195068747), + FRAC_CONST(0.00086059331713336), + FRAC_CONST(0.00096177541439010), + FRAC_CONST(0.0010630609410878), + FRAC_CONST(0.0011650036308132), + FRAC_CONST(0.0012680012194148), + FRAC_CONST(0.0013723517232956), + FRAC_CONST(0.0014782864109136), + FRAC_CONST(0.0015859901976719), + FRAC_CONST(0.0016956148252373), + FRAC_CONST(0.0018072876903517), + FRAC_CONST(0.0019211179405514), + FRAC_CONST(0.0020372007924215), + FRAC_CONST(0.0021556206591754), + FRAC_CONST(0.0022764534599614), + FRAC_CONST(0.0023997683540995), + FRAC_CONST(0.0025256290631156), + FRAC_CONST(0.0026540948920831), + FRAC_CONST(0.0027852215281403), + FRAC_CONST(0.0029190616715331), + FRAC_CONST(0.0030556655443223), + FRAC_CONST(0.0031950812943391), + FRAC_CONST(0.0033373553240392), + FRAC_CONST(0.0034825325586930), + FRAC_CONST(0.0036306566699199), + FRAC_CONST(0.0037817702604646), + FRAC_CONST(0.0039359150179719), + FRAC_CONST(0.0040931318437260), + FRAC_CONST(0.0042534609610026), + FRAC_CONST(0.0044169420066964), + FRAC_CONST(0.0045836141091341), + FRAC_CONST(0.0047535159544086), + FRAC_CONST(0.0049266858431214), + FRAC_CONST(0.0051031617390698), + FRAC_CONST(0.0052829813111335), + FRAC_CONST(0.0054661819693975), + FRAC_CONST(0.0056528008963682), + FRAC_CONST(0.0058428750739943), + FRAC_CONST(0.0060364413070882), + FRAC_CONST(0.0062335362436492), + FRAC_CONST(0.0064341963925079), + FRAC_CONST(0.0066384581386503), + FRAC_CONST(0.0068463577565218), + FRAC_CONST(0.0070579314215715), + FRAC_CONST(0.0072732152202559), + FRAC_CONST(0.0074922451586909), + FRAC_CONST(0.0077150571701162), + FRAC_CONST(0.0079416871213115), + FRAC_CONST(0.0081721708180857), + FRAC_CONST(0.0084065440099458), + FRAC_CONST(0.0086448423940363), + FRAC_CONST(0.0088871016184291), + FRAC_CONST(0.0091333572848345), + FRAC_CONST(0.0093836449507939), + FRAC_CONST(0.0096380001314086), + FRAC_CONST(0.0098964583006517), + FRAC_CONST(0.010159054892306), + FRAC_CONST(0.010425825300561), + FRAC_CONST(0.010696804880310), + FRAC_CONST(0.010972028947167), + FRAC_CONST(0.011251532777236), + FRAC_CONST(0.011535351606646), + FRAC_CONST(0.011823520630897), + FRAC_CONST(0.012116075003993), + FRAC_CONST(0.012413049837429), + FRAC_CONST(0.012714480198999), + FRAC_CONST(0.013020401111478), + FRAC_CONST(0.013330847551161), + FRAC_CONST(0.013645854446288), + FRAC_CONST(0.013965456675352), + FRAC_CONST(0.014289689065314), + FRAC_CONST(0.014618586389712), + FRAC_CONST(0.014952183366697), + FRAC_CONST(0.015290514656976), + FRAC_CONST(0.015633614861688), + FRAC_CONST(0.015981518520214), + FRAC_CONST(0.016334260107915), + FRAC_CONST(0.016691874033817), + FRAC_CONST(0.017054394638241), + FRAC_CONST(0.017421856190380), + FRAC_CONST(0.017794292885832), + FRAC_CONST(0.018171738844085), + FRAC_CONST(0.018554228105962), + FRAC_CONST(0.018941794631032), + FRAC_CONST(0.019334472294980), + FRAC_CONST(0.019732294886947), + FRAC_CONST(0.020135296106839), + FRAC_CONST(0.020543509562604), + FRAC_CONST(0.020956968767488), + FRAC_CONST(0.021375707137257), + FRAC_CONST(0.021799757987407), + FRAC_CONST(0.022229154530343), + FRAC_CONST(0.022663929872540), + FRAC_CONST(0.023104117011689), + FRAC_CONST(0.023549748833816), + FRAC_CONST(0.024000858110398), + FRAC_CONST(0.024457477495451), + FRAC_CONST(0.024919639522613), + FRAC_CONST(0.025387376602207), + FRAC_CONST(0.025860721018295), + FRAC_CONST(0.026339704925726), + FRAC_CONST(0.026824360347160), + FRAC_CONST(0.027314719170100), + FRAC_CONST(0.027810813143900), + FRAC_CONST(0.028312673876775), + FRAC_CONST(0.028820332832801), + FRAC_CONST(0.029333821328905), + FRAC_CONST(0.029853170531859), + FRAC_CONST(0.030378411455255), + FRAC_CONST(0.030909574956490), + FRAC_CONST(0.031446691733739), + FRAC_CONST(0.031989792322926), + FRAC_CONST(0.032538907094693), + FRAC_CONST(0.033094066251369), + FRAC_CONST(0.033655299823935), + FRAC_CONST(0.034222637668991), + FRAC_CONST(0.034796109465717), + FRAC_CONST(0.035375744712844), + FRAC_CONST(0.035961572725616), + FRAC_CONST(0.036553622632758), + FRAC_CONST(0.037151923373446), + FRAC_CONST(0.037756503694277), + FRAC_CONST(0.038367392146243), + FRAC_CONST(0.038984617081711), + FRAC_CONST(0.039608206651398), + FRAC_CONST(0.040238188801359), + FRAC_CONST(0.040874591269976), + FRAC_CONST(0.041517441584950), + FRAC_CONST(0.042166767060301), + FRAC_CONST(0.042822594793376), + FRAC_CONST(0.043484951661852), + FRAC_CONST(0.044153864320760), + FRAC_CONST(0.044829359199509), + FRAC_CONST(0.045511462498913), + FRAC_CONST(0.046200200188234), + FRAC_CONST(0.046895598002228), + FRAC_CONST(0.047597681438201), + FRAC_CONST(0.048306475753074), + FRAC_CONST(0.049022005960455), + FRAC_CONST(0.049744296827725), + FRAC_CONST(0.050473372873129), + FRAC_CONST(0.051209258362879), + FRAC_CONST(0.051951977308273), + FRAC_CONST(0.052701553462813), + FRAC_CONST(0.053458010319350), + FRAC_CONST(0.054221371107223), + FRAC_CONST(0.054991658789428), + FRAC_CONST(0.055768896059787), + FRAC_CONST(0.056553105340134), + FRAC_CONST(0.057344308777513), + FRAC_CONST(0.058142528241393), + FRAC_CONST(0.058947785320893), + FRAC_CONST(0.059760101322019), + FRAC_CONST(0.060579497264926), + FRAC_CONST(0.061405993881180), + FRAC_CONST(0.062239611611049), + FRAC_CONST(0.063080370600799), + FRAC_CONST(0.063928290700012), + FRAC_CONST(0.064783391458919), + FRAC_CONST(0.065645692125747), + FRAC_CONST(0.066515211644086), + FRAC_CONST(0.067391968650269), + FRAC_CONST(0.068275981470777), + FRAC_CONST(0.069167268119652), + FRAC_CONST(0.070065846295935), + FRAC_CONST(0.070971733381121), + FRAC_CONST(0.071884946436630), + FRAC_CONST(0.072805502201299), + FRAC_CONST(0.073733417088896), + FRAC_CONST(0.074668707185649), + FRAC_CONST(0.075611388247794), + FRAC_CONST(0.076561475699152), + FRAC_CONST(0.077518984628715), + FRAC_CONST(0.078483929788261), + FRAC_CONST(0.079456325589986), + FRAC_CONST(0.080436186104162), + FRAC_CONST(0.081423525056808), + FRAC_CONST(0.082418355827392), + FRAC_CONST(0.083420691446553), + FRAC_CONST(0.084430544593841), + FRAC_CONST(0.085447927595483), + FRAC_CONST(0.086472852422178), + FRAC_CONST(0.087505330686900), + FRAC_CONST(0.088545373642744), + FRAC_CONST(0.089592992180780), + FRAC_CONST(0.090648196827937), + FRAC_CONST(0.091710997744919), + FRAC_CONST(0.092781404724131), + FRAC_CONST(0.093859427187640), + FRAC_CONST(0.094945074185163), + FRAC_CONST(0.096038354392069), + FRAC_CONST(0.097139276107423), + FRAC_CONST(0.098247847252041), + FRAC_CONST(0.099364075366580), + FRAC_CONST(0.10048796760965), + FRAC_CONST(0.10161953075597), + FRAC_CONST(0.10275877119451), + FRAC_CONST(0.10390569492671), + FRAC_CONST(0.10506030756469), + FRAC_CONST(0.10622261432949), + FRAC_CONST(0.10739262004941), + FRAC_CONST(0.10857032915821), + FRAC_CONST(0.10975574569357), + FRAC_CONST(0.11094887329534), + FRAC_CONST(0.11214971520402), + FRAC_CONST(0.11335827425914), + FRAC_CONST(0.11457455289772), + FRAC_CONST(0.11579855315274), + FRAC_CONST(0.11703027665170), + FRAC_CONST(0.11826972461510), + FRAC_CONST(0.11951689785504), + FRAC_CONST(0.12077179677383), + FRAC_CONST(0.12203442136263), + FRAC_CONST(0.12330477120008), + FRAC_CONST(0.12458284545102), + FRAC_CONST(0.12586864286523), + FRAC_CONST(0.12716216177615), + FRAC_CONST(0.12846340009971), + FRAC_CONST(0.12977235533312), + FRAC_CONST(0.13108902455375), + FRAC_CONST(0.13241340441801), + FRAC_CONST(0.13374549116025), + FRAC_CONST(0.13508528059173), + FRAC_CONST(0.13643276809961), + FRAC_CONST(0.13778794864595), + FRAC_CONST(0.13915081676677), + FRAC_CONST(0.14052136657114), + FRAC_CONST(0.14189959174027), + FRAC_CONST(0.14328548552671), + FRAC_CONST(0.14467904075349), + FRAC_CONST(0.14608024981336), + FRAC_CONST(0.14748910466804), + FRAC_CONST(0.14890559684750), + FRAC_CONST(0.15032971744929), + FRAC_CONST(0.15176145713790), + FRAC_CONST(0.15320080614414), + FRAC_CONST(0.15464775426459), + FRAC_CONST(0.15610229086100), + FRAC_CONST(0.15756440485987), + FRAC_CONST(0.15903408475193), + FRAC_CONST(0.16051131859170), + FRAC_CONST(0.16199609399712), + FRAC_CONST(0.16348839814917), + FRAC_CONST(0.16498821779156), + FRAC_CONST(0.16649553923042), + FRAC_CONST(0.16801034833404), + FRAC_CONST(0.16953263053270), + FRAC_CONST(0.17106237081842), + FRAC_CONST(0.17259955374484), + FRAC_CONST(0.17414416342714), + FRAC_CONST(0.17569618354193), + FRAC_CONST(0.17725559732720), + FRAC_CONST(0.17882238758238), + FRAC_CONST(0.18039653666830), + FRAC_CONST(0.18197802650733), + FRAC_CONST(0.18356683858343), + FRAC_CONST(0.18516295394233), + FRAC_CONST(0.18676635319174), + FRAC_CONST(0.18837701650148), + FRAC_CONST(0.18999492360384), + FRAC_CONST(0.19162005379380), + FRAC_CONST(0.19325238592940), + FRAC_CONST(0.19489189843209), + FRAC_CONST(0.19653856928714), + FRAC_CONST(0.19819237604409), + FRAC_CONST(0.19985329581721), + FRAC_CONST(0.20152130528605), + FRAC_CONST(0.20319638069594), + FRAC_CONST(0.20487849785865), + FRAC_CONST(0.20656763215298), + FRAC_CONST(0.20826375852540), + FRAC_CONST(0.20996685149083), + FRAC_CONST(0.21167688513330), + FRAC_CONST(0.21339383310678), + FRAC_CONST(0.21511766863598), + FRAC_CONST(0.21684836451719), + FRAC_CONST(0.21858589311922), + FRAC_CONST(0.22033022638425), + FRAC_CONST(0.22208133582887), + FRAC_CONST(0.22383919254503), + FRAC_CONST(0.22560376720111), + FRAC_CONST(0.22737503004300), + FRAC_CONST(0.22915295089517), + FRAC_CONST(0.23093749916189), + FRAC_CONST(0.23272864382838), + FRAC_CONST(0.23452635346201), + FRAC_CONST(0.23633059621364), + FRAC_CONST(0.23814133981883), + FRAC_CONST(0.23995855159925), + FRAC_CONST(0.24178219846403), + FRAC_CONST(0.24361224691114), + FRAC_CONST(0.24544866302890), + FRAC_CONST(0.24729141249740), + FRAC_CONST(0.24914046059007), + FRAC_CONST(0.25099577217522), + FRAC_CONST(0.25285731171763), + FRAC_CONST(0.25472504328019), + FRAC_CONST(0.25659893052556), + FRAC_CONST(0.25847893671788), + FRAC_CONST(0.26036502472451), + FRAC_CONST(0.26225715701781), + FRAC_CONST(0.26415529567692), + FRAC_CONST(0.26605940238966), + FRAC_CONST(0.26796943845439), + FRAC_CONST(0.26988536478190), + FRAC_CONST(0.27180714189742), + FRAC_CONST(0.27373472994256), + FRAC_CONST(0.27566808867736), + FRAC_CONST(0.27760717748238), + FRAC_CONST(0.27955195536071), + FRAC_CONST(0.28150238094021), + FRAC_CONST(0.28345841247557), + FRAC_CONST(0.28542000785059), + FRAC_CONST(0.28738712458038), + FRAC_CONST(0.28935971981364), + FRAC_CONST(0.29133775033492), + FRAC_CONST(0.29332117256704), + FRAC_CONST(0.29530994257338), + FRAC_CONST(0.29730401606034), + FRAC_CONST(0.29930334837974), + FRAC_CONST(0.30130789453132), + FRAC_CONST(0.30331760916521), + FRAC_CONST(0.30533244658452), + FRAC_CONST(0.30735236074785), + FRAC_CONST(0.30937730527195), + FRAC_CONST(0.31140723343430), + FRAC_CONST(0.31344209817583), + FRAC_CONST(0.31548185210356), + FRAC_CONST(0.31752644749341), + FRAC_CONST(0.31957583629288), + FRAC_CONST(0.32162997012390), + FRAC_CONST(0.32368880028565), + FRAC_CONST(0.32575227775738), + FRAC_CONST(0.32782035320134), + FRAC_CONST(0.32989297696566), + FRAC_CONST(0.33197009908736), + FRAC_CONST(0.33405166929523), + FRAC_CONST(0.33613763701295), + FRAC_CONST(0.33822795136203), + FRAC_CONST(0.34032256116495), + FRAC_CONST(0.34242141494820), + FRAC_CONST(0.34452446094547), + FRAC_CONST(0.34663164710072), + FRAC_CONST(0.34874292107143), + FRAC_CONST(0.35085823023181), + FRAC_CONST(0.35297752167598), + FRAC_CONST(0.35510074222129), + FRAC_CONST(0.35722783841160), + FRAC_CONST(0.35935875652060), + FRAC_CONST(0.36149344255514), + FRAC_CONST(0.36363184225864), + FRAC_CONST(0.36577390111444), + FRAC_CONST(0.36791956434930), + FRAC_CONST(0.37006877693676), + FRAC_CONST(0.37222148360070), + FRAC_CONST(0.37437762881878), + FRAC_CONST(0.37653715682603), + FRAC_CONST(0.37870001161834), + FRAC_CONST(0.38086613695607), + FRAC_CONST(0.38303547636766), + FRAC_CONST(0.38520797315322), + FRAC_CONST(0.38738357038821), + FRAC_CONST(0.38956221092708), + FRAC_CONST(0.39174383740701), + FRAC_CONST(0.39392839225157), + FRAC_CONST(0.39611581767449), + FRAC_CONST(0.39830605568342), + FRAC_CONST(0.40049904808370), + FRAC_CONST(0.40269473648218), + FRAC_CONST(0.40489306229101), + FRAC_CONST(0.40709396673153), + FRAC_CONST(0.40929739083810), + FRAC_CONST(0.41150327546197), + FRAC_CONST(0.41371156127524), + FRAC_CONST(0.41592218877472), + FRAC_CONST(0.41813509828594), + FRAC_CONST(0.42035022996702), + FRAC_CONST(0.42256752381274), + FRAC_CONST(0.42478691965848), + FRAC_CONST(0.42700835718423), + FRAC_CONST(0.42923177591866), + FRAC_CONST(0.43145711524314), + FRAC_CONST(0.43368431439580), + FRAC_CONST(0.43591331247564), + FRAC_CONST(0.43814404844658), + FRAC_CONST(0.44037646114161), + FRAC_CONST(0.44261048926688), + FRAC_CONST(0.44484607140589), + FRAC_CONST(0.44708314602359), + FRAC_CONST(0.44932165147057), + FRAC_CONST(0.45156152598727), + FRAC_CONST(0.45380270770813), + FRAC_CONST(0.45604513466581), + FRAC_CONST(0.45828874479543), + FRAC_CONST(0.46053347593880), + FRAC_CONST(0.46277926584861), + FRAC_CONST(0.46502605219277), + FRAC_CONST(0.46727377255861), + FRAC_CONST(0.46952236445718), + FRAC_CONST(0.47177176532752), + FRAC_CONST(0.47402191254100), + FRAC_CONST(0.47627274340557), + FRAC_CONST(0.47852419517009), + FRAC_CONST(0.48077620502869), + FRAC_CONST(0.48302871012505), + FRAC_CONST(0.48528164755674), + FRAC_CONST(0.48753495437962), + FRAC_CONST(0.48978856761212), + FRAC_CONST(0.49204242423966), + FRAC_CONST(0.49429646121898), + FRAC_CONST(0.49655061548250), + FRAC_CONST(0.49880482394273), + FRAC_CONST(0.50105902349665), + FRAC_CONST(0.50331315103004), + FRAC_CONST(0.50556714342194), + FRAC_CONST(0.50782093754901), + FRAC_CONST(0.51007447028990), + FRAC_CONST(0.51232767852971), + FRAC_CONST(0.51458049916433), + FRAC_CONST(0.51683286910489), + FRAC_CONST(0.51908472528213), + FRAC_CONST(0.52133600465083), + FRAC_CONST(0.52358664419420), + FRAC_CONST(0.52583658092832), + FRAC_CONST(0.52808575190648), + FRAC_CONST(0.53033409422367), + FRAC_CONST(0.53258154502092), + FRAC_CONST(0.53482804148974), + FRAC_CONST(0.53707352087652), + FRAC_CONST(0.53931792048690), + FRAC_CONST(0.54156117769021), + FRAC_CONST(0.54380322992385), + FRAC_CONST(0.54604401469766), + FRAC_CONST(0.54828346959835), + FRAC_CONST(0.55052153229384), + FRAC_CONST(0.55275814053768), + FRAC_CONST(0.55499323217338), + FRAC_CONST(0.55722674513883), + FRAC_CONST(0.55945861747062), + FRAC_CONST(0.56168878730842), + FRAC_CONST(0.56391719289930), + FRAC_CONST(0.56614377260214), + FRAC_CONST(0.56836846489188), + FRAC_CONST(0.57059120836390), + FRAC_CONST(0.57281194173835), + FRAC_CONST(0.57503060386439), + FRAC_CONST(0.57724713372458), + FRAC_CONST(0.57946147043912), + FRAC_CONST(0.58167355327012), + FRAC_CONST(0.58388332162591), + FRAC_CONST(0.58609071506528), + FRAC_CONST(0.58829567330173), + FRAC_CONST(0.59049813620770), + FRAC_CONST(0.59269804381879), + FRAC_CONST(0.59489533633802), + FRAC_CONST(0.59708995413996), + FRAC_CONST(0.59928183777495), + FRAC_CONST(0.60147092797329), + FRAC_CONST(0.60365716564937), + FRAC_CONST(0.60584049190582), + FRAC_CONST(0.60802084803764), + FRAC_CONST(0.61019817553632), + FRAC_CONST(0.61237241609393), + FRAC_CONST(0.61454351160718), + FRAC_CONST(0.61671140418155), + FRAC_CONST(0.61887603613527), + FRAC_CONST(0.62103735000336), + FRAC_CONST(0.62319528854167), + FRAC_CONST(0.62534979473088), + FRAC_CONST(0.62750081178042), + FRAC_CONST(0.62964828313250), + FRAC_CONST(0.63179215246597), + FRAC_CONST(0.63393236370030), + FRAC_CONST(0.63606886099946), + FRAC_CONST(0.63820158877577), + FRAC_CONST(0.64033049169379), + FRAC_CONST(0.64245551467413), + FRAC_CONST(0.64457660289729), + FRAC_CONST(0.64669370180740), + FRAC_CONST(0.64880675711607), + FRAC_CONST(0.65091571480603), + FRAC_CONST(0.65302052113494), + FRAC_CONST(0.65512112263906), + FRAC_CONST(0.65721746613689), + FRAC_CONST(0.65930949873289), + FRAC_CONST(0.66139716782102), + FRAC_CONST(0.66348042108842), + FRAC_CONST(0.66555920651892), + FRAC_CONST(0.66763347239664), + FRAC_CONST(0.66970316730947), + FRAC_CONST(0.67176824015260), + FRAC_CONST(0.67382864013196), + FRAC_CONST(0.67588431676768), + FRAC_CONST(0.67793521989751), + FRAC_CONST(0.67998129968017), + FRAC_CONST(0.68202250659876), + FRAC_CONST(0.68405879146403), + FRAC_CONST(0.68609010541774), + FRAC_CONST(0.68811639993588), + FRAC_CONST(0.69013762683195), + FRAC_CONST(0.69215373826012), + FRAC_CONST(0.69416468671849), + FRAC_CONST(0.69617042505214), + FRAC_CONST(0.69817090645634), + FRAC_CONST(0.70016608447958), + FRAC_CONST(0.70215591302664), + FRAC_CONST(0.70414034636163), + FRAC_CONST(0.70611933911096), + FRAC_CONST(0.70809284626630), + FRAC_CONST(0.71006082318751), + FRAC_CONST(0.71202322560554), + FRAC_CONST(0.71398000962530), + FRAC_CONST(0.71593113172842), + FRAC_CONST(0.71787654877613), + FRAC_CONST(0.71981621801195), + FRAC_CONST(0.72175009706445), + FRAC_CONST(0.72367814394990), + FRAC_CONST(0.72560031707496), + FRAC_CONST(0.72751657523927), + FRAC_CONST(0.72942687763803), + FRAC_CONST(0.73133118386457), + FRAC_CONST(0.73322945391280), + FRAC_CONST(0.73512164817975), + FRAC_CONST(0.73700772746796), + FRAC_CONST(0.73888765298787), + FRAC_CONST(0.74076138636020), + FRAC_CONST(0.74262888961827), + FRAC_CONST(0.74449012521027), + FRAC_CONST(0.74634505600152), + FRAC_CONST(0.74819364527663), + FRAC_CONST(0.75003585674175), + FRAC_CONST(0.75187165452661), + FRAC_CONST(0.75370100318668), + FRAC_CONST(0.75552386770515), + FRAC_CONST(0.75734021349500), + FRAC_CONST(0.75915000640095), + FRAC_CONST(0.76095321270137), + FRAC_CONST(0.76274979911019), + FRAC_CONST(0.76453973277875), + FRAC_CONST(0.76632298129757), + FRAC_CONST(0.76809951269819), + FRAC_CONST(0.76986929545481), + FRAC_CONST(0.77163229848604), + FRAC_CONST(0.77338849115651), + FRAC_CONST(0.77513784327849), + FRAC_CONST(0.77688032511340), + FRAC_CONST(0.77861590737340), + FRAC_CONST(0.78034456122283), + FRAC_CONST(0.78206625827961), + FRAC_CONST(0.78378097061667), + FRAC_CONST(0.78548867076330), + FRAC_CONST(0.78718933170643), + FRAC_CONST(0.78888292689189), + FRAC_CONST(0.79056943022564), + FRAC_CONST(0.79224881607494), + FRAC_CONST(0.79392105926949), + FRAC_CONST(0.79558613510249), + FRAC_CONST(0.79724401933170), + FRAC_CONST(0.79889468818046), + FRAC_CONST(0.80053811833858), + FRAC_CONST(0.80217428696334), + FRAC_CONST(0.80380317168028), + FRAC_CONST(0.80542475058405), + FRAC_CONST(0.80703900223920), + FRAC_CONST(0.80864590568089), + FRAC_CONST(0.81024544041560), + FRAC_CONST(0.81183758642175), + FRAC_CONST(0.81342232415032), + FRAC_CONST(0.81499963452540), + FRAC_CONST(0.81656949894467), + FRAC_CONST(0.81813189927991), + FRAC_CONST(0.81968681787738), + FRAC_CONST(0.82123423755821), + FRAC_CONST(0.82277414161874), + FRAC_CONST(0.82430651383076), + FRAC_CONST(0.82583133844180), + FRAC_CONST(0.82734860017528), + FRAC_CONST(0.82885828423070), + FRAC_CONST(0.83036037628369), + FRAC_CONST(0.83185486248609), + FRAC_CONST(0.83334172946597), + FRAC_CONST(0.83482096432759), + FRAC_CONST(0.83629255465130), + FRAC_CONST(0.83775648849344), + FRAC_CONST(0.83921275438615), + FRAC_CONST(0.84066134133716), + FRAC_CONST(0.84210223882952), + FRAC_CONST(0.84353543682130), + FRAC_CONST(0.84496092574524), + FRAC_CONST(0.84637869650833), + FRAC_CONST(0.84778874049138), + FRAC_CONST(0.84919104954855), + FRAC_CONST(0.85058561600677), + FRAC_CONST(0.85197243266520), + FRAC_CONST(0.85335149279457), + FRAC_CONST(0.85472279013653), + FRAC_CONST(0.85608631890295), + FRAC_CONST(0.85744207377513), + FRAC_CONST(0.85879004990298), + FRAC_CONST(0.86013024290422), + FRAC_CONST(0.86146264886346), + FRAC_CONST(0.86278726433124), + FRAC_CONST(0.86410408632306), + FRAC_CONST(0.86541311231838), + FRAC_CONST(0.86671434025950), + FRAC_CONST(0.86800776855046), + FRAC_CONST(0.86929339605590), + FRAC_CONST(0.87057122209981), + FRAC_CONST(0.87184124646433), + FRAC_CONST(0.87310346938840), + FRAC_CONST(0.87435789156650), + FRAC_CONST(0.87560451414719), + FRAC_CONST(0.87684333873173), + FRAC_CONST(0.87807436737261), + FRAC_CONST(0.87929760257204), + FRAC_CONST(0.88051304728038), + FRAC_CONST(0.88172070489456), + FRAC_CONST(0.88292057925645), + FRAC_CONST(0.88411267465117), + FRAC_CONST(0.88529699580537), + FRAC_CONST(0.88647354788545), + FRAC_CONST(0.88764233649580), + FRAC_CONST(0.88880336767692), + FRAC_CONST(0.88995664790351), + FRAC_CONST(0.89110218408260), + FRAC_CONST(0.89223998355154), + FRAC_CONST(0.89337005407600), + FRAC_CONST(0.89449240384793), + FRAC_CONST(0.89560704148345), + FRAC_CONST(0.89671397602074), + FRAC_CONST(0.89781321691786), + FRAC_CONST(0.89890477405053), + FRAC_CONST(0.89998865770993), + FRAC_CONST(0.90106487860034), + FRAC_CONST(0.90213344783689), + FRAC_CONST(0.90319437694315), + FRAC_CONST(0.90424767784873), + FRAC_CONST(0.90529336288690), + FRAC_CONST(0.90633144479201), + FRAC_CONST(0.90736193669708), + FRAC_CONST(0.90838485213119), + FRAC_CONST(0.90940020501694), + FRAC_CONST(0.91040800966776), + FRAC_CONST(0.91140828078533), + FRAC_CONST(0.91240103345685), + FRAC_CONST(0.91338628315231), + FRAC_CONST(0.91436404572173), + FRAC_CONST(0.91533433739238), + FRAC_CONST(0.91629717476594), + FRAC_CONST(0.91725257481564), + FRAC_CONST(0.91820055488334), + FRAC_CONST(0.91914113267664), + FRAC_CONST(0.92007432626589), + FRAC_CONST(0.92100015408120), + FRAC_CONST(0.92191863490944), + FRAC_CONST(0.92282978789113), + FRAC_CONST(0.92373363251740), + FRAC_CONST(0.92463018862687), + FRAC_CONST(0.92551947640245), + FRAC_CONST(0.92640151636824), + FRAC_CONST(0.92727632938624), + FRAC_CONST(0.92814393665320), + FRAC_CONST(0.92900435969727), + FRAC_CONST(0.92985762037477), + FRAC_CONST(0.93070374086684), + FRAC_CONST(0.93154274367610), + FRAC_CONST(0.93237465162328), + FRAC_CONST(0.93319948784382), + FRAC_CONST(0.93401727578443), + FRAC_CONST(0.93482803919967), + FRAC_CONST(0.93563180214841), + FRAC_CONST(0.93642858899043), + FRAC_CONST(0.93721842438279), + FRAC_CONST(0.93800133327637), + FRAC_CONST(0.93877734091223), + FRAC_CONST(0.93954647281807), + FRAC_CONST(0.94030875480458), + FRAC_CONST(0.94106421296182), + FRAC_CONST(0.94181287365556), + FRAC_CONST(0.94255476352362), + FRAC_CONST(0.94328990947213), + FRAC_CONST(0.94401833867184), + FRAC_CONST(0.94474007855439), + FRAC_CONST(0.94545515680855), + FRAC_CONST(0.94616360137644), + FRAC_CONST(0.94686544044975), + FRAC_CONST(0.94756070246592), + FRAC_CONST(0.94824941610434), + FRAC_CONST(0.94893161028248), + FRAC_CONST(0.94960731415209), + FRAC_CONST(0.95027655709525), + FRAC_CONST(0.95093936872056), + FRAC_CONST(0.95159577885924), + FRAC_CONST(0.95224581756115), + FRAC_CONST(0.95288951509097), + FRAC_CONST(0.95352690192417), + FRAC_CONST(0.95415800874314), + FRAC_CONST(0.95478286643320), + FRAC_CONST(0.95540150607863), + FRAC_CONST(0.95601395895871), + FRAC_CONST(0.95662025654373), + FRAC_CONST(0.95722043049100), + FRAC_CONST(0.95781451264084), + FRAC_CONST(0.95840253501260), + FRAC_CONST(0.95898452980058), + FRAC_CONST(0.95956052937008), + FRAC_CONST(0.96013056625336), + FRAC_CONST(0.96069467314557), + FRAC_CONST(0.96125288290073), + FRAC_CONST(0.96180522852773), + FRAC_CONST(0.96235174318622), + FRAC_CONST(0.96289246018262), + FRAC_CONST(0.96342741296604), + FRAC_CONST(0.96395663512424), + FRAC_CONST(0.96448016037959), + FRAC_CONST(0.96499802258499), + FRAC_CONST(0.96551025571985), + FRAC_CONST(0.96601689388602), + FRAC_CONST(0.96651797130376), + FRAC_CONST(0.96701352230768), + FRAC_CONST(0.96750358134269), + FRAC_CONST(0.96798818295998), + FRAC_CONST(0.96846736181297), + FRAC_CONST(0.96894115265327), + FRAC_CONST(0.96940959032667), + FRAC_CONST(0.96987270976912), + FRAC_CONST(0.97033054600270), + FRAC_CONST(0.97078313413161), + FRAC_CONST(0.97123050933818), + FRAC_CONST(0.97167270687887), + FRAC_CONST(0.97210976208030), + FRAC_CONST(0.97254171033525), + FRAC_CONST(0.97296858709871), + FRAC_CONST(0.97339042788392), + FRAC_CONST(0.97380726825843), + FRAC_CONST(0.97421914384017), + FRAC_CONST(0.97462609029350), + FRAC_CONST(0.97502814332534), + FRAC_CONST(0.97542533868127), + FRAC_CONST(0.97581771214160), + FRAC_CONST(0.97620529951759), + FRAC_CONST(0.97658813664749), + FRAC_CONST(0.97696625939282), + FRAC_CONST(0.97733970363445), + FRAC_CONST(0.97770850526884), + FRAC_CONST(0.97807270020427), + FRAC_CONST(0.97843232435704), + FRAC_CONST(0.97878741364771), + FRAC_CONST(0.97913800399743), + FRAC_CONST(0.97948413132414), + FRAC_CONST(0.97982583153895), + FRAC_CONST(0.98016314054243), + FRAC_CONST(0.98049609422096), + FRAC_CONST(0.98082472844313), + FRAC_CONST(0.98114907905608), + FRAC_CONST(0.98146918188197), + FRAC_CONST(0.98178507271438), + FRAC_CONST(0.98209678731477), + FRAC_CONST(0.98240436140902), + FRAC_CONST(0.98270783068385), + FRAC_CONST(0.98300723078342), + FRAC_CONST(0.98330259730589), + FRAC_CONST(0.98359396579995), + FRAC_CONST(0.98388137176152), + FRAC_CONST(0.98416485063031), + FRAC_CONST(0.98444443778651), + FRAC_CONST(0.98472016854752), + FRAC_CONST(0.98499207816463), + FRAC_CONST(0.98526020181980), + FRAC_CONST(0.98552457462240), + FRAC_CONST(0.98578523160609), + FRAC_CONST(0.98604220772560), + FRAC_CONST(0.98629553785362), + FRAC_CONST(0.98654525677772), + FRAC_CONST(0.98679139919726), + FRAC_CONST(0.98703399972035), + FRAC_CONST(0.98727309286089), + FRAC_CONST(0.98750871303556), + FRAC_CONST(0.98774089456089), + FRAC_CONST(0.98796967165036), + FRAC_CONST(0.98819507841154), + FRAC_CONST(0.98841714884323), + FRAC_CONST(0.98863591683269), + FRAC_CONST(0.98885141615285), + FRAC_CONST(0.98906368045957), + FRAC_CONST(0.98927274328896), + FRAC_CONST(0.98947863805473), + FRAC_CONST(0.98968139804554), + FRAC_CONST(0.98988105642241), + FRAC_CONST(0.99007764621618), + FRAC_CONST(0.99027120032501), + FRAC_CONST(0.99046175151186), + FRAC_CONST(0.99064933240208), + FRAC_CONST(0.99083397548099), + FRAC_CONST(0.99101571309153), + FRAC_CONST(0.99119457743191), + FRAC_CONST(0.99137060055337), + FRAC_CONST(0.99154381435784), + FRAC_CONST(0.99171425059582), + FRAC_CONST(0.99188194086414), + FRAC_CONST(0.99204691660388), + FRAC_CONST(0.99220920909823), + FRAC_CONST(0.99236884947045), + FRAC_CONST(0.99252586868186), + FRAC_CONST(0.99268029752989), + FRAC_CONST(0.99283216664606), + FRAC_CONST(0.99298150649419), + FRAC_CONST(0.99312834736847), + FRAC_CONST(0.99327271939167), + FRAC_CONST(0.99341465251338), + FRAC_CONST(0.99355417650825), + FRAC_CONST(0.99369132097430), + FRAC_CONST(0.99382611533130), + FRAC_CONST(0.99395858881910), + FRAC_CONST(0.99408877049612), + FRAC_CONST(0.99421668923778), + FRAC_CONST(0.99434237373503), + FRAC_CONST(0.99446585249289), + FRAC_CONST(0.99458715382906), + FRAC_CONST(0.99470630587254), + FRAC_CONST(0.99482333656229), + FRAC_CONST(0.99493827364600), + FRAC_CONST(0.99505114467878), + FRAC_CONST(0.99516197702200), + FRAC_CONST(0.99527079784214), + FRAC_CONST(0.99537763410962), + FRAC_CONST(0.99548251259777), + FRAC_CONST(0.99558545988178), + FRAC_CONST(0.99568650233767), + FRAC_CONST(0.99578566614138), + FRAC_CONST(0.99588297726783), + FRAC_CONST(0.99597846149005), + FRAC_CONST(0.99607214437834), + FRAC_CONST(0.99616405129947), + FRAC_CONST(0.99625420741595), + FRAC_CONST(0.99634263768527), + FRAC_CONST(0.99642936685928), + FRAC_CONST(0.99651441948352), + FRAC_CONST(0.99659781989663), + FRAC_CONST(0.99667959222978), + FRAC_CONST(0.99675976040620), + FRAC_CONST(0.99683834814063), + FRAC_CONST(0.99691537893895), + FRAC_CONST(0.99699087609774), + FRAC_CONST(0.99706486270391), + FRAC_CONST(0.99713736163442), + FRAC_CONST(0.99720839555593), + FRAC_CONST(0.99727798692461), + FRAC_CONST(0.99734615798589), + FRAC_CONST(0.99741293077431), + FRAC_CONST(0.99747832711337), + FRAC_CONST(0.99754236861541), + FRAC_CONST(0.99760507668158), + FRAC_CONST(0.99766647250181), + FRAC_CONST(0.99772657705478), + FRAC_CONST(0.99778541110799), + FRAC_CONST(0.99784299521785), + FRAC_CONST(0.99789934972976), + FRAC_CONST(0.99795449477828), + FRAC_CONST(0.99800845028730), + FRAC_CONST(0.99806123597027), + FRAC_CONST(0.99811287133042), + FRAC_CONST(0.99816337566108), + FRAC_CONST(0.99821276804596), + FRAC_CONST(0.99826106735952), + FRAC_CONST(0.99830829226732), + FRAC_CONST(0.99835446122649), + FRAC_CONST(0.99839959248609), + FRAC_CONST(0.99844370408765), + FRAC_CONST(0.99848681386566), + FRAC_CONST(0.99852893944805), + FRAC_CONST(0.99857009825685), + FRAC_CONST(0.99861030750869), + FRAC_CONST(0.99864958421549), + FRAC_CONST(0.99868794518504), + FRAC_CONST(0.99872540702178), + FRAC_CONST(0.99876198612738), + FRAC_CONST(0.99879769870160), + FRAC_CONST(0.99883256074295), + FRAC_CONST(0.99886658804953), + FRAC_CONST(0.99889979621983), + FRAC_CONST(0.99893220065356), + FRAC_CONST(0.99896381655254), + FRAC_CONST(0.99899465892154), + FRAC_CONST(0.99902474256924), + FRAC_CONST(0.99905408210916), + FRAC_CONST(0.99908269196056), + FRAC_CONST(0.99911058634952), + FRAC_CONST(0.99913777930986), + FRAC_CONST(0.99916428468421), + FRAC_CONST(0.99919011612505), + FRAC_CONST(0.99921528709576), + FRAC_CONST(0.99923981087174), + FRAC_CONST(0.99926370054150), + FRAC_CONST(0.99928696900779), + FRAC_CONST(0.99930962898876), + FRAC_CONST(0.99933169301910), + FRAC_CONST(0.99935317345126), + FRAC_CONST(0.99937408245662), + FRAC_CONST(0.99939443202674), + FRAC_CONST(0.99941423397457), + FRAC_CONST(0.99943349993572), + FRAC_CONST(0.99945224136972), + FRAC_CONST(0.99947046956130), + FRAC_CONST(0.99948819562171), + FRAC_CONST(0.99950543049000), + FRAC_CONST(0.99952218493439), + FRAC_CONST(0.99953846955355), + FRAC_CONST(0.99955429477803), + FRAC_CONST(0.99956967087154), + FRAC_CONST(0.99958460793242), + FRAC_CONST(0.99959911589494), + FRAC_CONST(0.99961320453077), + FRAC_CONST(0.99962688345035), + FRAC_CONST(0.99964016210433), + FRAC_CONST(0.99965304978499), + FRAC_CONST(0.99966555562769), + FRAC_CONST(0.99967768861231), + FRAC_CONST(0.99968945756473), + FRAC_CONST(0.99970087115825), + FRAC_CONST(0.99971193791510), + FRAC_CONST(0.99972266620792), + FRAC_CONST(0.99973306426121), + FRAC_CONST(0.99974314015288), + FRAC_CONST(0.99975290181568), + FRAC_CONST(0.99976235703876), + FRAC_CONST(0.99977151346914), + FRAC_CONST(0.99978037861326), + FRAC_CONST(0.99978895983845), + FRAC_CONST(0.99979726437448), + FRAC_CONST(0.99980529931507), + FRAC_CONST(0.99981307161943), + FRAC_CONST(0.99982058811377), + FRAC_CONST(0.99982785549283), + FRAC_CONST(0.99983488032144), + FRAC_CONST(0.99984166903600), + FRAC_CONST(0.99984822794606), + FRAC_CONST(0.99985456323584), + FRAC_CONST(0.99986068096572), + FRAC_CONST(0.99986658707386), + FRAC_CONST(0.99987228737764), + FRAC_CONST(0.99987778757524), + FRAC_CONST(0.99988309324717), + FRAC_CONST(0.99988820985777), + FRAC_CONST(0.99989314275675), + FRAC_CONST(0.99989789718072), + FRAC_CONST(0.99990247825468), + FRAC_CONST(0.99990689099357), + FRAC_CONST(0.99991114030376), + FRAC_CONST(0.99991523098456), + FRAC_CONST(0.99991916772971), + FRAC_CONST(0.99992295512891), + FRAC_CONST(0.99992659766930), + FRAC_CONST(0.99993009973692), + FRAC_CONST(0.99993346561824), + FRAC_CONST(0.99993669950161), + FRAC_CONST(0.99993980547870), + FRAC_CONST(0.99994278754604), + FRAC_CONST(0.99994564960642), + FRAC_CONST(0.99994839547033), + FRAC_CONST(0.99995102885747), + FRAC_CONST(0.99995355339809), + FRAC_CONST(0.99995597263451), + FRAC_CONST(0.99995829002249), + FRAC_CONST(0.99996050893264), + FRAC_CONST(0.99996263265183), + FRAC_CONST(0.99996466438460), + FRAC_CONST(0.99996660725452), + FRAC_CONST(0.99996846430558), + FRAC_CONST(0.99997023850356), + FRAC_CONST(0.99997193273736), + FRAC_CONST(0.99997354982037), + FRAC_CONST(0.99997509249183), + FRAC_CONST(0.99997656341810), + FRAC_CONST(0.99997796519400), + FRAC_CONST(0.99997930034415), + FRAC_CONST(0.99998057132421), + FRAC_CONST(0.99998178052220), + FRAC_CONST(0.99998293025975), + FRAC_CONST(0.99998402279338), + FRAC_CONST(0.99998506031574), + FRAC_CONST(0.99998604495686), + FRAC_CONST(0.99998697878536), + FRAC_CONST(0.99998786380966), + FRAC_CONST(0.99998870197921), + FRAC_CONST(0.99998949518567), + FRAC_CONST(0.99999024526408), + FRAC_CONST(0.99999095399401), + FRAC_CONST(0.99999162310077), + FRAC_CONST(0.99999225425649), + FRAC_CONST(0.99999284908128), + FRAC_CONST(0.99999340914435), + FRAC_CONST(0.99999393596510), + FRAC_CONST(0.99999443101421), + FRAC_CONST(0.99999489571473), + FRAC_CONST(0.99999533144314), + FRAC_CONST(0.99999573953040), + FRAC_CONST(0.99999612126300), + FRAC_CONST(0.99999647788395), + FRAC_CONST(0.99999681059383), + FRAC_CONST(0.99999712055178), + FRAC_CONST(0.99999740887647), + FRAC_CONST(0.99999767664709), + FRAC_CONST(0.99999792490431), + FRAC_CONST(0.99999815465123), + FRAC_CONST(0.99999836685427), + FRAC_CONST(0.99999856244415), + FRAC_CONST(0.99999874231676), + FRAC_CONST(0.99999890733405), + FRAC_CONST(0.99999905832493), + FRAC_CONST(0.99999919608613), + FRAC_CONST(0.99999932138304), + FRAC_CONST(0.99999943495056), + FRAC_CONST(0.99999953749392), + FRAC_CONST(0.99999962968950), + FRAC_CONST(0.99999971218563), + FRAC_CONST(0.99999978560337), + FRAC_CONST(0.99999985053727), + FRAC_CONST(0.99999990755616), + FRAC_CONST(0.99999995720387) +}; + +#ifdef ALLOW_SMALL_FRAMELENGTH +ALIGN static const real_t kbd_long_960[] = { + FRAC_CONST(0.0003021562530949), + FRAC_CONST(0.0004452267024786), + FRAC_CONST(0.0005674947527496), + FRAC_CONST(0.0006812465553466), + FRAC_CONST(0.0007910496776387), + FRAC_CONST(0.0008991655033895), + FRAC_CONST(0.0010068978259384), + FRAC_CONST(0.0011150758515751), + FRAC_CONST(0.0012242653193642), + FRAC_CONST(0.0013348735658205), + FRAC_CONST(0.0014472068670273), + FRAC_CONST(0.0015615039850448), + FRAC_CONST(0.0016779568885263), + FRAC_CONST(0.0017967241232412), + FRAC_CONST(0.0019179397560955), + FRAC_CONST(0.0020417195415393), + FRAC_CONST(0.0021681652836642), + FRAC_CONST(0.0022973679910599), + FRAC_CONST(0.0024294102029937), + FRAC_CONST(0.0025643677339078), + FRAC_CONST(0.0027023110014772), + FRAC_CONST(0.0028433060512612), + FRAC_CONST(0.0029874153568025), + FRAC_CONST(0.0031346984511728), + FRAC_CONST(0.0032852124303662), + FRAC_CONST(0.0034390123581190), + FRAC_CONST(0.0035961515940931), + FRAC_CONST(0.0037566820618961), + FRAC_CONST(0.0039206544694386), + FRAC_CONST(0.0040881184912194), + FRAC_CONST(0.0042591229199617), + FRAC_CONST(0.0044337157933972), + FRAC_CONST(0.0046119445007641), + FRAC_CONST(0.0047938558726415), + FRAC_CONST(0.0049794962570131), + FRAC_CONST(0.0051689115838900), + FRAC_CONST(0.0053621474203763), + FRAC_CONST(0.0055592490177131), + FRAC_CONST(0.0057602613515573), + FRAC_CONST(0.0059652291565289), + FRAC_CONST(0.0061741969558843), + FRAC_CONST(0.0063872090870253), + FRAC_CONST(0.0066043097234387), + FRAC_CONST(0.0068255428935640), + FRAC_CONST(0.0070509524970088), + FRAC_CONST(0.0072805823184660), + FRAC_CONST(0.0075144760396340), + FRAC_CONST(0.0077526772493942), + FRAC_CONST(0.0079952294524673), + FRAC_CONST(0.0082421760767325), + FRAC_CONST(0.0084935604793733), + FRAC_CONST(0.0087494259519870), + FRAC_CONST(0.0090098157247792), + FRAC_CONST(0.0092747729699467), + FRAC_CONST(0.0095443408043399), + FRAC_CONST(0.0098185622914832), + FRAC_CONST(0.0100974804430226), + FRAC_CONST(0.0103811382196612), + FRAC_CONST(0.0106695785316351), + FRAC_CONST(0.0109628442387771), + FRAC_CONST(0.0112609781502091), + FRAC_CONST(0.0115640230236993), + FRAC_CONST(0.0118720215647169), + FRAC_CONST(0.0121850164252137), + FRAC_CONST(0.0125030502021561), + FRAC_CONST(0.0128261654358321), + FRAC_CONST(0.0131544046079532), + FRAC_CONST(0.0134878101395681), + FRAC_CONST(0.0138264243888068), + FRAC_CONST(0.0141702896484671), + FRAC_CONST(0.0145194481434592), + FRAC_CONST(0.0148739420281182), + FRAC_CONST(0.0152338133833959), + FRAC_CONST(0.0155991042139432), + FRAC_CONST(0.0159698564450882), + FRAC_CONST(0.0163461119197227), + FRAC_CONST(0.0167279123950996), + FRAC_CONST(0.0171152995395520), + FRAC_CONST(0.0175083149291368), + FRAC_CONST(0.0179070000442104), + FRAC_CONST(0.0183113962659409), + FRAC_CONST(0.0187215448727609), + FRAC_CONST(0.0191374870367659), + FRAC_CONST(0.0195592638200623), + FRAC_CONST(0.0199869161710679), + FRAC_CONST(0.0204204849207691), + FRAC_CONST(0.0208600107789370), + FRAC_CONST(0.0213055343303066), + FRAC_CONST(0.0217570960307201), + FRAC_CONST(0.0222147362032386), + FRAC_CONST(0.0226784950342228), + FRAC_CONST(0.0231484125693867), + FRAC_CONST(0.0236245287098244), + FRAC_CONST(0.0241068832080138), + FRAC_CONST(0.0245955156637973), + FRAC_CONST(0.0250904655203431), + FRAC_CONST(0.0255917720600868), + FRAC_CONST(0.0260994744006559), + FRAC_CONST(0.0266136114907790), + FRAC_CONST(0.0271342221061795), + FRAC_CONST(0.0276613448454576), + FRAC_CONST(0.0281950181259587), + FRAC_CONST(0.0287352801796329), + FRAC_CONST(0.0292821690488833), + FRAC_CONST(0.0298357225824074), + FRAC_CONST(0.0303959784310299), + FRAC_CONST(0.0309629740435296), + FRAC_CONST(0.0315367466624615), + FRAC_CONST(0.0321173333199732), + FRAC_CONST(0.0327047708336193), + FRAC_CONST(0.0332990958021720), + FRAC_CONST(0.0339003446014307), + FRAC_CONST(0.0345085533800302), + FRAC_CONST(0.0351237580552491), + FRAC_CONST(0.0357459943088193), + FRAC_CONST(0.0363752975827358), + FRAC_CONST(0.0370117030750704), + FRAC_CONST(0.0376552457357870), + FRAC_CONST(0.0383059602625614), + FRAC_CONST(0.0389638810966056), + FRAC_CONST(0.0396290424184964), + FRAC_CONST(0.0403014781440112), + FRAC_CONST(0.0409812219199691), + FRAC_CONST(0.0416683071200799), + FRAC_CONST(0.0423627668408009), + FRAC_CONST(0.0430646338972016), + FRAC_CONST(0.0437739408188385), + FRAC_CONST(0.0444907198456388), + FRAC_CONST(0.0452150029237951), + FRAC_CONST(0.0459468217016708), + FRAC_CONST(0.0466862075257170), + FRAC_CONST(0.0474331914364021), + FRAC_CONST(0.0481878041641539), + FRAC_CONST(0.0489500761253148), + FRAC_CONST(0.0497200374181119), + FRAC_CONST(0.0504977178186404), + FRAC_CONST(0.0512831467768636), + FRAC_CONST(0.0520763534126273), + FRAC_CONST(0.0528773665116913), + FRAC_CONST(0.0536862145217772), + FRAC_CONST(0.0545029255486345), + FRAC_CONST(0.0553275273521232), + FRAC_CONST(0.0561600473423164), + FRAC_CONST(0.0570005125756209), + FRAC_CONST(0.0578489497509179), + FRAC_CONST(0.0587053852057233), + FRAC_CONST(0.0595698449123695), + FRAC_CONST(0.0604423544742077), + FRAC_CONST(0.0613229391218317), + FRAC_CONST(0.0622116237093247), + FRAC_CONST(0.0631084327105284), + FRAC_CONST(0.0640133902153352), + FRAC_CONST(0.0649265199260043), + FRAC_CONST(0.0658478451535027), + FRAC_CONST(0.0667773888138695), + FRAC_CONST(0.0677151734246072), + FRAC_CONST(0.0686612211010977), + FRAC_CONST(0.0696155535530446), + FRAC_CONST(0.0705781920809429), + FRAC_CONST(0.0715491575725758), + FRAC_CONST(0.0725284704995383), + FRAC_CONST(0.0735161509137906), + FRAC_CONST(0.0745122184442388), + FRAC_CONST(0.0755166922933461), + FRAC_CONST(0.0765295912337720), + FRAC_CONST(0.0775509336050437), + FRAC_CONST(0.0785807373102561), + FRAC_CONST(0.0796190198128044), + FRAC_CONST(0.0806657981331473), + FRAC_CONST(0.0817210888456026), + FRAC_CONST(0.0827849080751753), + FRAC_CONST(0.0838572714944183), + FRAC_CONST(0.0849381943203265), + FRAC_CONST(0.0860276913112652), + FRAC_CONST(0.0871257767639319), + FRAC_CONST(0.0882324645103534), + FRAC_CONST(0.0893477679149177), + FRAC_CONST(0.0904716998714418), + FRAC_CONST(0.0916042728002747), + FRAC_CONST(0.0927454986454381), + FRAC_CONST(0.0938953888718020), + FRAC_CONST(0.0950539544622996), + FRAC_CONST(0.0962212059151784), + FRAC_CONST(0.0973971532412897), + FRAC_CONST(0.0985818059614169), + FRAC_CONST(0.0997751731036425), + FRAC_CONST(0.1009772632007537), + FRAC_CONST(0.1021880842876888), + FRAC_CONST(0.1034076438990227), + FRAC_CONST(0.1046359490664932), + FRAC_CONST(0.1058730063165681), + FRAC_CONST(0.1071188216680533), + FRAC_CONST(0.1083734006297428), + FRAC_CONST(0.1096367481981100), + FRAC_CONST(0.1109088688550422), + FRAC_CONST(0.1121897665656167), + FRAC_CONST(0.1134794447759207), + FRAC_CONST(0.1147779064109143), + FRAC_CONST(0.1160851538723372), + FRAC_CONST(0.1174011890366591), + FRAC_CONST(0.1187260132530751), + FRAC_CONST(0.1200596273415457), + FRAC_CONST(0.1214020315908810), + FRAC_CONST(0.1227532257568719), + FRAC_CONST(0.1241132090604651), + FRAC_CONST(0.1254819801859856), + FRAC_CONST(0.1268595372794049), + FRAC_CONST(0.1282458779466558), + FRAC_CONST(0.1296409992519942), + FRAC_CONST(0.1310448977164081), + FRAC_CONST(0.1324575693160745), + FRAC_CONST(0.1338790094808633), + FRAC_CONST(0.1353092130928902), + FRAC_CONST(0.1367481744851168), + FRAC_CONST(0.1381958874400010), + FRAC_CONST(0.1396523451881945), + FRAC_CONST(0.1411175404072910), + FRAC_CONST(0.1425914652206223), + FRAC_CONST(0.1440741111961058), + FRAC_CONST(0.1455654693451402), + FRAC_CONST(0.1470655301215526), + FRAC_CONST(0.1485742834205956), + FRAC_CONST(0.1500917185779945), + FRAC_CONST(0.1516178243690463), + FRAC_CONST(0.1531525890077689), + FRAC_CONST(0.1546960001461024), + FRAC_CONST(0.1562480448731608), + FRAC_CONST(0.1578087097145364), + FRAC_CONST(0.1593779806316558), + FRAC_CONST(0.1609558430211876), + FRAC_CONST(0.1625422817145027), + FRAC_CONST(0.1641372809771871), + FRAC_CONST(0.1657408245086070), + FRAC_CONST(0.1673528954415270), + FRAC_CONST(0.1689734763417811), + FRAC_CONST(0.1706025492079969), + FRAC_CONST(0.1722400954713725), + FRAC_CONST(0.1738860959955082), + FRAC_CONST(0.1755405310762898), + FRAC_CONST(0.1772033804418275), + FRAC_CONST(0.1788746232524467), + FRAC_CONST(0.1805542381007349), + FRAC_CONST(0.1822422030116404), + FRAC_CONST(0.1839384954426268), + FRAC_CONST(0.1856430922838810), + FRAC_CONST(0.1873559698585756), + FRAC_CONST(0.1890771039231862), + FRAC_CONST(0.1908064696678625), + FRAC_CONST(0.1925440417168546), + FRAC_CONST(0.1942897941289937), + FRAC_CONST(0.1960437003982277), + FRAC_CONST(0.1978057334542116), + FRAC_CONST(0.1995758656629525), + FRAC_CONST(0.2013540688275098), + FRAC_CONST(0.2031403141887507), + FRAC_CONST(0.2049345724261595), + FRAC_CONST(0.2067368136587033), + FRAC_CONST(0.2085470074457521), + FRAC_CONST(0.2103651227880538), + FRAC_CONST(0.2121911281287646), + FRAC_CONST(0.2140249913545346), + FRAC_CONST(0.2158666797966480), + FRAC_CONST(0.2177161602322188), + FRAC_CONST(0.2195733988854414), + FRAC_CONST(0.2214383614288963), + FRAC_CONST(0.2233110129849106), + FRAC_CONST(0.2251913181269740), + FRAC_CONST(0.2270792408812093), + FRAC_CONST(0.2289747447278976), + FRAC_CONST(0.2308777926030592), + FRAC_CONST(0.2327883469000885), + FRAC_CONST(0.2347063694714437), + FRAC_CONST(0.2366318216303919), + FRAC_CONST(0.2385646641528076), + FRAC_CONST(0.2405048572790267), + FRAC_CONST(0.2424523607157545), + FRAC_CONST(0.2444071336380283), + FRAC_CONST(0.2463691346912334), + FRAC_CONST(0.2483383219931741), + FRAC_CONST(0.2503146531361985), + FRAC_CONST(0.2522980851893767), + FRAC_CONST(0.2542885747007335), + FRAC_CONST(0.2562860776995335), + FRAC_CONST(0.2582905496986215), + FRAC_CONST(0.2603019456968142), + FRAC_CONST(0.2623202201813464), + FRAC_CONST(0.2643453271303700), + FRAC_CONST(0.2663772200155053), + FRAC_CONST(0.2684158518044454), + FRAC_CONST(0.2704611749636135), + FRAC_CONST(0.2725131414608710), + FRAC_CONST(0.2745717027682799), + FRAC_CONST(0.2766368098649151), + FRAC_CONST(0.2787084132397296), + FRAC_CONST(0.2807864628944707), + FRAC_CONST(0.2828709083466482), + FRAC_CONST(0.2849616986325523), + FRAC_CONST(0.2870587823103237), + FRAC_CONST(0.2891621074630737), + FRAC_CONST(0.2912716217020546), + FRAC_CONST(0.2933872721698803), + FRAC_CONST(0.2955090055437973), + FRAC_CONST(0.2976367680390041), + FRAC_CONST(0.2997705054120213), + FRAC_CONST(0.3019101629641097), + FRAC_CONST(0.3040556855447379), + FRAC_CONST(0.3062070175550981), + FRAC_CONST(0.3083641029516701), + FRAC_CONST(0.3105268852498334), + FRAC_CONST(0.3126953075275265), + FRAC_CONST(0.3148693124289546), + FRAC_CONST(0.3170488421683428), + FRAC_CONST(0.3192338385337370), + FRAC_CONST(0.3214242428908514), + FRAC_CONST(0.3236199961869606), + FRAC_CONST(0.3258210389548392), + FRAC_CONST(0.3280273113167459), + FRAC_CONST(0.3302387529884521), + FRAC_CONST(0.3324553032833160), + FRAC_CONST(0.3346769011164010), + FRAC_CONST(0.3369034850086373), + FRAC_CONST(0.3391349930910280), + FRAC_CONST(0.3413713631088974), + FRAC_CONST(0.3436125324261830), + FRAC_CONST(0.3458584380297697), + FRAC_CONST(0.3481090165338656), + FRAC_CONST(0.3503642041844199), + FRAC_CONST(0.3526239368635820), + FRAC_CONST(0.3548881500942010), + FRAC_CONST(0.3571567790443668), + FRAC_CONST(0.3594297585319891), + FRAC_CONST(0.3617070230294185), + FRAC_CONST(0.3639885066681048), + FRAC_CONST(0.3662741432432950), + FRAC_CONST(0.3685638662187693), + FRAC_CONST(0.3708576087316147), + FRAC_CONST(0.3731553035970366), + FRAC_CONST(0.3754568833132069), + FRAC_CONST(0.3777622800661488), + FRAC_CONST(0.3800714257346570), + FRAC_CONST(0.3823842518952546), + FRAC_CONST(0.3847006898271841), + FRAC_CONST(0.3870206705174334), + FRAC_CONST(0.3893441246657958), + FRAC_CONST(0.3916709826899639), + FRAC_CONST(0.3940011747306560), + FRAC_CONST(0.3963346306567764), + FRAC_CONST(0.3986712800706062), + FRAC_CONST(0.4010110523130271), + FRAC_CONST(0.4033538764687756), + FRAC_CONST(0.4056996813717284), + FRAC_CONST(0.4080483956102172), + FRAC_CONST(0.4103999475323736), + FRAC_CONST(0.4127542652515031), + FRAC_CONST(0.4151112766514873), + FRAC_CONST(0.4174709093922143), + FRAC_CONST(0.4198330909150365), + FRAC_CONST(0.4221977484482556), + FRAC_CONST(0.4245648090126334), + FRAC_CONST(0.4269341994269293), + FRAC_CONST(0.4293058463134616), + FRAC_CONST(0.4316796761036958), + FRAC_CONST(0.4340556150438547), + FRAC_CONST(0.4364335892005536), + FRAC_CONST(0.4388135244664580), + FRAC_CONST(0.4411953465659639), + FRAC_CONST(0.4435789810609000), + FRAC_CONST(0.4459643533562509), + FRAC_CONST(0.4483513887059016), + FRAC_CONST(0.4507400122184019), + FRAC_CONST(0.4531301488627497), + FRAC_CONST(0.4555217234741947), + FRAC_CONST(0.4579146607600593), + FRAC_CONST(0.4603088853055777), + FRAC_CONST(0.4627043215797521), + FRAC_CONST(0.4651008939412254), + FRAC_CONST(0.4674985266441709), + FRAC_CONST(0.4698971438441951), + FRAC_CONST(0.4722966696042580), + FRAC_CONST(0.4746970279006055), + FRAC_CONST(0.4770981426287164), + FRAC_CONST(0.4794999376092619), + FRAC_CONST(0.4819023365940778), + FRAC_CONST(0.4843052632721476), + FRAC_CONST(0.4867086412755978), + FRAC_CONST(0.4891123941857028), + FRAC_CONST(0.4915164455388997), + FRAC_CONST(0.4939207188328126), + FRAC_CONST(0.4963251375322855), + FRAC_CONST(0.4987296250754225), + FRAC_CONST(0.5011341048796359), + FRAC_CONST(0.5035385003477012), + FRAC_CONST(0.5059427348738168), + FRAC_CONST(0.5083467318496706), + FRAC_CONST(0.5107504146705106), + FRAC_CONST(0.5131537067412193), + FRAC_CONST(0.5155565314823923), + FRAC_CONST(0.5179588123364193), + FRAC_CONST(0.5203604727735667), + FRAC_CONST(0.5227614362980630), + FRAC_CONST(0.5251616264541841), + FRAC_CONST(0.5275609668323384), + FRAC_CONST(0.5299593810751532), + FRAC_CONST(0.5323567928835578), + FRAC_CONST(0.5347531260228663), + FRAC_CONST(0.5371483043288580), + FRAC_CONST(0.5395422517138538), + FRAC_CONST(0.5419348921727899), + FRAC_CONST(0.5443261497892862), + FRAC_CONST(0.5467159487417104), + FRAC_CONST(0.5491042133092364), + FRAC_CONST(0.5514908678778958), + FRAC_CONST(0.5538758369466227), + FRAC_CONST(0.5562590451332913), + FRAC_CONST(0.5586404171807443), + FRAC_CONST(0.5610198779628133), + FRAC_CONST(0.5633973524903286), + FRAC_CONST(0.5657727659171199), + FRAC_CONST(0.5681460435460047), + FRAC_CONST(0.5705171108347663), + FRAC_CONST(0.5728858934021188), + FRAC_CONST(0.5752523170336598), + FRAC_CONST(0.5776163076878088), + FRAC_CONST(0.5799777915017323), + FRAC_CONST(0.5823366947972535), + FRAC_CONST(0.5846929440867458), + FRAC_CONST(0.5870464660790119), + FRAC_CONST(0.5893971876851449), + FRAC_CONST(0.5917450360243719), + FRAC_CONST(0.5940899384298793), + FRAC_CONST(0.5964318224546208), + FRAC_CONST(0.5987706158771039), + FRAC_CONST(0.6011062467071583), + FRAC_CONST(0.6034386431916822), + FRAC_CONST(0.6057677338203681), + FRAC_CONST(0.6080934473314057), + FRAC_CONST(0.6104157127171639), + FRAC_CONST(0.6127344592298474), + FRAC_CONST(0.6150496163871310), + FRAC_CONST(0.6173611139777690), + FRAC_CONST(0.6196688820671789), + FRAC_CONST(0.6219728510029997), + FRAC_CONST(0.6242729514206247), + FRAC_CONST(0.6265691142487051), + FRAC_CONST(0.6288612707146283), + FRAC_CONST(0.6311493523499663), + FRAC_CONST(0.6334332909958958), + FRAC_CONST(0.6357130188085891), + FRAC_CONST(0.6379884682645743), + FRAC_CONST(0.6402595721660647), + FRAC_CONST(0.6425262636462578), + FRAC_CONST(0.6447884761746012), + FRAC_CONST(0.6470461435620266), + FRAC_CONST(0.6492991999661505), + FRAC_CONST(0.6515475798964411), + FRAC_CONST(0.6537912182193508), + FRAC_CONST(0.6560300501634142), + FRAC_CONST(0.6582640113243098), + FRAC_CONST(0.6604930376698862), + FRAC_CONST(0.6627170655451516), + FRAC_CONST(0.6649360316772256), + FRAC_CONST(0.6671498731802533), + FRAC_CONST(0.6693585275602818), + FRAC_CONST(0.6715619327200959), + FRAC_CONST(0.6737600269640164), + FRAC_CONST(0.6759527490026566), + FRAC_CONST(0.6781400379576392), + FRAC_CONST(0.6803218333662715), + FRAC_CONST(0.6824980751861787), + FRAC_CONST(0.6846687037998949), + FRAC_CONST(0.6868336600194123), + FRAC_CONST(0.6889928850906855), + FRAC_CONST(0.6911463206980928), + FRAC_CONST(0.6932939089688525), + FRAC_CONST(0.6954355924773949), + FRAC_CONST(0.6975713142496884), + FRAC_CONST(0.6997010177675195), + FRAC_CONST(0.7018246469727265), + FRAC_CONST(0.7039421462713862), + FRAC_CONST(0.7060534605379528), + FRAC_CONST(0.7081585351193496), + FRAC_CONST(0.7102573158390105), + FRAC_CONST(0.7123497490008750), + FRAC_CONST(0.7144357813933307), + FRAC_CONST(0.7165153602931092), + FRAC_CONST(0.7185884334691287), + FRAC_CONST(0.7206549491862871), + FRAC_CONST(0.7227148562092042), + FRAC_CONST(0.7247681038059106), + FRAC_CONST(0.7268146417514855), + FRAC_CONST(0.7288544203316418), + FRAC_CONST(0.7308873903462577), + FRAC_CONST(0.7329135031128549), + FRAC_CONST(0.7349327104700221), + FRAC_CONST(0.7369449647807855), + FRAC_CONST(0.7389502189359237), + FRAC_CONST(0.7409484263572271), + FRAC_CONST(0.7429395410007016), + FRAC_CONST(0.7449235173597176), + FRAC_CONST(0.7469003104681008), + FRAC_CONST(0.7488698759031670), + FRAC_CONST(0.7508321697887005), + FRAC_CONST(0.7527871487978728), + FRAC_CONST(0.7547347701561059), + FRAC_CONST(0.7566749916438754), + FRAC_CONST(0.7586077715994560), + FRAC_CONST(0.7605330689216074), + FRAC_CONST(0.7624508430722016), + FRAC_CONST(0.7643610540787891), + FRAC_CONST(0.7662636625371070), + FRAC_CONST(0.7681586296135255), + FRAC_CONST(0.7700459170474343), + FRAC_CONST(0.7719254871535672), + FRAC_CONST(0.7737973028242671), + FRAC_CONST(0.7756613275316875), + FRAC_CONST(0.7775175253299340), + FRAC_CONST(0.7793658608571425), + FRAC_CONST(0.7812062993374951), + FRAC_CONST(0.7830388065831744), + FRAC_CONST(0.7848633489962533), + FRAC_CONST(0.7866798935705233), + FRAC_CONST(0.7884884078932579), + FRAC_CONST(0.7902888601469138), + FRAC_CONST(0.7920812191107668), + FRAC_CONST(0.7938654541624850), + FRAC_CONST(0.7956415352796368), + FRAC_CONST(0.7974094330411343), + FRAC_CONST(0.7991691186286133), + FRAC_CONST(0.8009205638277465), + FRAC_CONST(0.8026637410294932), + FRAC_CONST(0.8043986232312831), + FRAC_CONST(0.8061251840381346), + FRAC_CONST(0.8078433976637077), + FRAC_CONST(0.8095532389312917), + FRAC_CONST(0.8112546832747255), + FRAC_CONST(0.8129477067392539), + FRAC_CONST(0.8146322859823164), + FRAC_CONST(0.8163083982742698), + FRAC_CONST(0.8179760214990457), + FRAC_CONST(0.8196351341547393), + FRAC_CONST(0.8212857153541345), + FRAC_CONST(0.8229277448251595), + FRAC_CONST(0.8245612029112778), + FRAC_CONST(0.8261860705718113), + FRAC_CONST(0.8278023293821971), + FRAC_CONST(0.8294099615341773), + FRAC_CONST(0.8310089498359212), + FRAC_CONST(0.8325992777120815), + FRAC_CONST(0.8341809292037831), + FRAC_CONST(0.8357538889685445), + FRAC_CONST(0.8373181422801330), + FRAC_CONST(0.8388736750283521), + FRAC_CONST(0.8404204737187619), + FRAC_CONST(0.8419585254723335), + FRAC_CONST(0.8434878180250348), + FRAC_CONST(0.8450083397273509), + FRAC_CONST(0.8465200795437368), + FRAC_CONST(0.8480230270520029), + FRAC_CONST(0.8495171724426350), + FRAC_CONST(0.8510025065180464), + FRAC_CONST(0.8524790206917633), + FRAC_CONST(0.8539467069875448), + FRAC_CONST(0.8554055580384357), + FRAC_CONST(0.8568555670857525), + FRAC_CONST(0.8582967279780043), + FRAC_CONST(0.8597290351697464), + FRAC_CONST(0.8611524837203691), + FRAC_CONST(0.8625670692928198), + FRAC_CONST(0.8639727881522599), + FRAC_CONST(0.8653696371646555), + FRAC_CONST(0.8667576137953045), + FRAC_CONST(0.8681367161072958), + FRAC_CONST(0.8695069427599065), + FRAC_CONST(0.8708682930069319), + FRAC_CONST(0.8722207666949527), + FRAC_CONST(0.8735643642615368), + FRAC_CONST(0.8748990867333771), + FRAC_CONST(0.8762249357243662), + FRAC_CONST(0.8775419134336067), + FRAC_CONST(0.8788500226433579), + FRAC_CONST(0.8801492667169208), + FRAC_CONST(0.8814396495964587), + FRAC_CONST(0.8827211758007560), + FRAC_CONST(0.8839938504229149), + FRAC_CONST(0.8852576791279895), + FRAC_CONST(0.8865126681505587), + FRAC_CONST(0.8877588242922386), + FRAC_CONST(0.8889961549191320), + FRAC_CONST(0.8902246679592184), + FRAC_CONST(0.8914443718996848), + FRAC_CONST(0.8926552757841945), + FRAC_CONST(0.8938573892100969), + FRAC_CONST(0.8950507223255798), + FRAC_CONST(0.8962352858267605), + FRAC_CONST(0.8974110909547198), + FRAC_CONST(0.8985781494924783), + FRAC_CONST(0.8997364737619142), + FRAC_CONST(0.9008860766206249), + FRAC_CONST(0.9020269714587307), + FRAC_CONST(0.9031591721956235), + FRAC_CONST(0.9042826932766591), + FRAC_CONST(0.9053975496697941), + FRAC_CONST(0.9065037568621681), + FRAC_CONST(0.9076013308566311), + FRAC_CONST(0.9086902881682180), + FRAC_CONST(0.9097706458205682), + FRAC_CONST(0.9108424213422940), + FRAC_CONST(0.9119056327632955), + FRAC_CONST(0.9129602986110235), + FRAC_CONST(0.9140064379066919), + FRAC_CONST(0.9150440701614393), + FRAC_CONST(0.9160732153724396), + FRAC_CONST(0.9170938940189634), + FRAC_CONST(0.9181061270583908), + FRAC_CONST(0.9191099359221748), + FRAC_CONST(0.9201053425117579), + FRAC_CONST(0.9210923691944400), + FRAC_CONST(0.9220710387992010), + FRAC_CONST(0.9230413746124764), + FRAC_CONST(0.9240034003738882), + FRAC_CONST(0.9249571402719298), + FRAC_CONST(0.9259026189396085), + FRAC_CONST(0.9268398614500427), + FRAC_CONST(0.9277688933120170), + FRAC_CONST(0.9286897404654957), + FRAC_CONST(0.9296024292770939), + FRAC_CONST(0.9305069865355076), + FRAC_CONST(0.9314034394469048), + FRAC_CONST(0.9322918156302762), + FRAC_CONST(0.9331721431127471), + FRAC_CONST(0.9340444503248519), + FRAC_CONST(0.9349087660957711), + FRAC_CONST(0.9357651196485313), + FRAC_CONST(0.9366135405951697), + FRAC_CONST(0.9374540589318637), + FRAC_CONST(0.9382867050340261), + FRAC_CONST(0.9391115096513655), + FRAC_CONST(0.9399285039029165), + FRAC_CONST(0.9407377192720349), + FRAC_CONST(0.9415391876013639), + FRAC_CONST(0.9423329410877687), + FRAC_CONST(0.9431190122772415), + FRAC_CONST(0.9438974340597782), + FRAC_CONST(0.9446682396642262), + FRAC_CONST(0.9454314626531054), + FRAC_CONST(0.9461871369174033), + FRAC_CONST(0.9469352966713429), + FRAC_CONST(0.9476759764471278), + FRAC_CONST(0.9484092110896616), + FRAC_CONST(0.9491350357512457), + FRAC_CONST(0.9498534858862532), + FRAC_CONST(0.9505645972457831), + FRAC_CONST(0.9512684058722927), + FRAC_CONST(0.9519649480942105), + FRAC_CONST(0.9526542605205314), + FRAC_CONST(0.9533363800353921), + FRAC_CONST(0.9540113437926313), + FRAC_CONST(0.9546791892103320), + FRAC_CONST(0.9553399539653500), + FRAC_CONST(0.9559936759878265), + FRAC_CONST(0.9566403934556893), + FRAC_CONST(0.9572801447891388), + FRAC_CONST(0.9579129686451244), + FRAC_CONST(0.9585389039118085), + FRAC_CONST(0.9591579897030224), + FRAC_CONST(0.9597702653527108), + FRAC_CONST(0.9603757704093711), + FRAC_CONST(0.9609745446304828), + FRAC_CONST(0.9615666279769324), + FRAC_CONST(0.9621520606074324), + FRAC_CONST(0.9627308828729358), + FRAC_CONST(0.9633031353110477), + FRAC_CONST(0.9638688586404335), + FRAC_CONST(0.9644280937552258), + FRAC_CONST(0.9649808817194311), + FRAC_CONST(0.9655272637613366), + FRAC_CONST(0.9660672812679171), + FRAC_CONST(0.9666009757792454), + FRAC_CONST(0.9671283889829055), + FRAC_CONST(0.9676495627084089), + FRAC_CONST(0.9681645389216160), + FRAC_CONST(0.9686733597191652), + FRAC_CONST(0.9691760673229058), + FRAC_CONST(0.9696727040743406), + FRAC_CONST(0.9701633124290767), + FRAC_CONST(0.9706479349512860), + FRAC_CONST(0.9711266143081750), + FRAC_CONST(0.9715993932644684), + FRAC_CONST(0.9720663146769026), + FRAC_CONST(0.9725274214887337), + FRAC_CONST(0.9729827567242596), + FRAC_CONST(0.9734323634833574), + FRAC_CONST(0.9738762849360358), + FRAC_CONST(0.9743145643170059), + FRAC_CONST(0.9747472449202687), + FRAC_CONST(0.9751743700937215), + FRAC_CONST(0.9755959832337850), + FRAC_CONST(0.9760121277800496), + FRAC_CONST(0.9764228472099433), + FRAC_CONST(0.9768281850334235), + FRAC_CONST(0.9772281847876897), + FRAC_CONST(0.9776228900319223), + FRAC_CONST(0.9780123443420448), + FRAC_CONST(0.9783965913055132), + FRAC_CONST(0.9787756745161313), + FRAC_CONST(0.9791496375688939), + FRAC_CONST(0.9795185240548578), + FRAC_CONST(0.9798823775560431), + FRAC_CONST(0.9802412416403639), + FRAC_CONST(0.9805951598565897), + FRAC_CONST(0.9809441757293399), + FRAC_CONST(0.9812883327541090), + FRAC_CONST(0.9816276743923267), + FRAC_CONST(0.9819622440664515), + FRAC_CONST(0.9822920851550995), + FRAC_CONST(0.9826172409882086), + FRAC_CONST(0.9829377548422400), + FRAC_CONST(0.9832536699354163), + FRAC_CONST(0.9835650294229984), + FRAC_CONST(0.9838718763926001), + FRAC_CONST(0.9841742538595437), + FRAC_CONST(0.9844722047622547), + FRAC_CONST(0.9847657719576983), + FRAC_CONST(0.9850549982168574), + FRAC_CONST(0.9853399262202529), + FRAC_CONST(0.9856205985535073), + FRAC_CONST(0.9858970577029519), + FRAC_CONST(0.9861693460512790), + FRAC_CONST(0.9864375058732389), + FRAC_CONST(0.9867015793313820), + FRAC_CONST(0.9869616084718489), + FRAC_CONST(0.9872176352202061), + FRAC_CONST(0.9874697013773301), + FRAC_CONST(0.9877178486153397), + FRAC_CONST(0.9879621184735767), + FRAC_CONST(0.9882025523546365), + FRAC_CONST(0.9884391915204485), + FRAC_CONST(0.9886720770884069), + FRAC_CONST(0.9889012500275530), + FRAC_CONST(0.9891267511548089), + FRAC_CONST(0.9893486211312621), + FRAC_CONST(0.9895669004585049), + FRAC_CONST(0.9897816294750255), + FRAC_CONST(0.9899928483526520), + FRAC_CONST(0.9902005970930525), + FRAC_CONST(0.9904049155242876), + FRAC_CONST(0.9906058432974180), + FRAC_CONST(0.9908034198831690), + FRAC_CONST(0.9909976845686489), + FRAC_CONST(0.9911886764541239), + FRAC_CONST(0.9913764344498495), + FRAC_CONST(0.9915609972729590), + FRAC_CONST(0.9917424034444086), + FRAC_CONST(0.9919206912859797), + FRAC_CONST(0.9920958989173397), + FRAC_CONST(0.9922680642531603), + FRAC_CONST(0.9924372250002933), + FRAC_CONST(0.9926034186550070), + FRAC_CONST(0.9927666825002789), + FRAC_CONST(0.9929270536031491), + FRAC_CONST(0.9930845688121325), + FRAC_CONST(0.9932392647546895), + FRAC_CONST(0.9933911778347579), + FRAC_CONST(0.9935403442303433), + FRAC_CONST(0.9936867998911693), + FRAC_CONST(0.9938305805363887), + FRAC_CONST(0.9939717216523539), + FRAC_CONST(0.9941102584904481), + FRAC_CONST(0.9942462260649764), + FRAC_CONST(0.9943796591511174), + FRAC_CONST(0.9945105922829353), + FRAC_CONST(0.9946390597514524), + FRAC_CONST(0.9947650956027824), + FRAC_CONST(0.9948887336363228), + FRAC_CONST(0.9950100074030103), + FRAC_CONST(0.9951289502036336), + FRAC_CONST(0.9952455950872091), + FRAC_CONST(0.9953599748494155), + FRAC_CONST(0.9954721220310890), + FRAC_CONST(0.9955820689167787), + FRAC_CONST(0.9956898475333619), + FRAC_CONST(0.9957954896487196), + FRAC_CONST(0.9958990267704713), + FRAC_CONST(0.9960004901447701), + FRAC_CONST(0.9960999107551559), + FRAC_CONST(0.9961973193214694), + FRAC_CONST(0.9962927462988245), + FRAC_CONST(0.9963862218766388), + FRAC_CONST(0.9964777759777242), + FRAC_CONST(0.9965674382574342), + FRAC_CONST(0.9966552381028704), + FRAC_CONST(0.9967412046321465), + FRAC_CONST(0.9968253666937095), + FRAC_CONST(0.9969077528657186), + FRAC_CONST(0.9969883914554805), + FRAC_CONST(0.9970673104989413), + FRAC_CONST(0.9971445377602348), + FRAC_CONST(0.9972201007312871), + FRAC_CONST(0.9972940266314749), + FRAC_CONST(0.9973663424073412), + FRAC_CONST(0.9974370747323638), + FRAC_CONST(0.9975062500067785), + FRAC_CONST(0.9975738943574574), + FRAC_CONST(0.9976400336378379), + FRAC_CONST(0.9977046934279079), + FRAC_CONST(0.9977678990342401), + FRAC_CONST(0.9978296754900812), + FRAC_CONST(0.9978900475554902), + FRAC_CONST(0.9979490397175296), + FRAC_CONST(0.9980066761905056), + FRAC_CONST(0.9980629809162593), + FRAC_CONST(0.9981179775645063), + FRAC_CONST(0.9981716895332257), + FRAC_CONST(0.9982241399490979), + FRAC_CONST(0.9982753516679893), + FRAC_CONST(0.9983253472754841), + FRAC_CONST(0.9983741490874634), + FRAC_CONST(0.9984217791507299), + FRAC_CONST(0.9984682592436778), + FRAC_CONST(0.9985136108770075), + FRAC_CONST(0.9985578552944850), + FRAC_CONST(0.9986010134737439), + FRAC_CONST(0.9986431061271304), + FRAC_CONST(0.9986841537025921), + FRAC_CONST(0.9987241763846056), + FRAC_CONST(0.9987631940951476), + FRAC_CONST(0.9988012264947044), + FRAC_CONST(0.9988382929833222), + FRAC_CONST(0.9988744127016956), + FRAC_CONST(0.9989096045322947), + FRAC_CONST(0.9989438871005292), + FRAC_CONST(0.9989772787759494), + FRAC_CONST(0.9990097976734847), + FRAC_CONST(0.9990414616547146), + FRAC_CONST(0.9990722883291779), + FRAC_CONST(0.9991022950557125), + FRAC_CONST(0.9991314989438310), + FRAC_CONST(0.9991599168551279), + FRAC_CONST(0.9991875654047181), + FRAC_CONST(0.9992144609627068), + FRAC_CONST(0.9992406196556911), + FRAC_CONST(0.9992660573682882), + FRAC_CONST(0.9992907897446957), + FRAC_CONST(0.9993148321902777), + FRAC_CONST(0.9993381998731797), + FRAC_CONST(0.9993609077259696), + FRAC_CONST(0.9993829704473038), + FRAC_CONST(0.9994044025036201), + FRAC_CONST(0.9994252181308537), + FRAC_CONST(0.9994454313361775), + FRAC_CONST(0.9994650558997651), + FRAC_CONST(0.9994841053765757), + FRAC_CONST(0.9995025930981609), + FRAC_CONST(0.9995205321744921), + FRAC_CONST(0.9995379354958073), + FRAC_CONST(0.9995548157344778), + FRAC_CONST(0.9995711853468930), + FRAC_CONST(0.9995870565753632), + FRAC_CONST(0.9996024414500382), + FRAC_CONST(0.9996173517908444), + FRAC_CONST(0.9996317992094352), + FRAC_CONST(0.9996457951111574), + FRAC_CONST(0.9996593506970310), + FRAC_CONST(0.9996724769657434), + FRAC_CONST(0.9996851847156547), + FRAC_CONST(0.9996974845468164), + FRAC_CONST(0.9997093868630000), + FRAC_CONST(0.9997209018737374), + FRAC_CONST(0.9997320395963699), + FRAC_CONST(0.9997428098581069), + FRAC_CONST(0.9997532222980933), + FRAC_CONST(0.9997632863694836), + FRAC_CONST(0.9997730113415246), + FRAC_CONST(0.9997824063016426), + FRAC_CONST(0.9997914801575380), + FRAC_CONST(0.9998002416392840), + FRAC_CONST(0.9998086993014300), + FRAC_CONST(0.9998168615251084), + FRAC_CONST(0.9998247365201450), + FRAC_CONST(0.9998323323271717), + FRAC_CONST(0.9998396568197407), + FRAC_CONST(0.9998467177064404), + FRAC_CONST(0.9998535225330116), + FRAC_CONST(0.9998600786844637), + FRAC_CONST(0.9998663933871905), + FRAC_CONST(0.9998724737110845), + FRAC_CONST(0.9998783265716498), + FRAC_CONST(0.9998839587321121), + FRAC_CONST(0.9998893768055266), + FRAC_CONST(0.9998945872568815), + FRAC_CONST(0.9998995964051983), + FRAC_CONST(0.9999044104256269), + FRAC_CONST(0.9999090353515359), + FRAC_CONST(0.9999134770765971), + FRAC_CONST(0.9999177413568642), + FRAC_CONST(0.9999218338128448), + FRAC_CONST(0.9999257599315647), + FRAC_CONST(0.9999295250686255), + FRAC_CONST(0.9999331344502529), + FRAC_CONST(0.9999365931753376), + FRAC_CONST(0.9999399062174669), + FRAC_CONST(0.9999430784269460), + FRAC_CONST(0.9999461145328103), + FRAC_CONST(0.9999490191448277), + FRAC_CONST(0.9999517967554878), + FRAC_CONST(0.9999544517419835), + FRAC_CONST(0.9999569883681778), + FRAC_CONST(0.9999594107865607), + FRAC_CONST(0.9999617230401926), + FRAC_CONST(0.9999639290646355), + FRAC_CONST(0.9999660326898712), + FRAC_CONST(0.9999680376422052), + FRAC_CONST(0.9999699475461585), + FRAC_CONST(0.9999717659263435), + FRAC_CONST(0.9999734962093266), + FRAC_CONST(0.9999751417254756), + FRAC_CONST(0.9999767057107922), + FRAC_CONST(0.9999781913087290), + FRAC_CONST(0.9999796015719915), + FRAC_CONST(0.9999809394643231), + FRAC_CONST(0.9999822078622751), + FRAC_CONST(0.9999834095569596), + FRAC_CONST(0.9999845472557860), + FRAC_CONST(0.9999856235841805), + FRAC_CONST(0.9999866410872889), + FRAC_CONST(0.9999876022316609), + FRAC_CONST(0.9999885094069193), + FRAC_CONST(0.9999893649274085), + FRAC_CONST(0.9999901710338274), + FRAC_CONST(0.9999909298948430), + FRAC_CONST(0.9999916436086862), + FRAC_CONST(0.9999923142047299), + FRAC_CONST(0.9999929436450469), + FRAC_CONST(0.9999935338259505), + FRAC_CONST(0.9999940865795161), + FRAC_CONST(0.9999946036750835), + FRAC_CONST(0.9999950868207405), + FRAC_CONST(0.9999955376647868), + FRAC_CONST(0.9999959577971798), + FRAC_CONST(0.9999963487509599), + FRAC_CONST(0.9999967120036571), + FRAC_CONST(0.9999970489786785), + FRAC_CONST(0.9999973610466748), + FRAC_CONST(0.9999976495268890), + FRAC_CONST(0.9999979156884846), + FRAC_CONST(0.9999981607518545), + FRAC_CONST(0.9999983858899099), + FRAC_CONST(0.9999985922293493), + FRAC_CONST(0.9999987808519092), + FRAC_CONST(0.9999989527955938), + FRAC_CONST(0.9999991090558848), + FRAC_CONST(0.9999992505869332), + FRAC_CONST(0.9999993783027293), + FRAC_CONST(0.9999994930782556), + FRAC_CONST(0.9999995957506171), + FRAC_CONST(0.9999996871201549), + FRAC_CONST(0.9999997679515386), + FRAC_CONST(0.9999998389748399), + FRAC_CONST(0.9999999008865869), + FRAC_CONST(0.9999999543507984) +}; +#endif + +ALIGN static const real_t kbd_short_128[] = +{ + FRAC_CONST(4.3795702929468881e-005), + FRAC_CONST(0.00011867384265436617), + FRAC_CONST(0.0002307165763996192), + FRAC_CONST(0.00038947282760568383), + FRAC_CONST(0.00060581272288302553), + FRAC_CONST(0.00089199695169487453), + FRAC_CONST(0.0012617254423430522), + FRAC_CONST(0.0017301724373162003), + FRAC_CONST(0.0023140071937421476), + FRAC_CONST(0.0030313989666022221), + FRAC_CONST(0.0039020049735530842), + FRAC_CONST(0.0049469401815512024), + FRAC_CONST(0.0061887279335368318), + FRAC_CONST(0.0076512306364647726), + FRAC_CONST(0.0093595599562652423), + FRAC_CONST(0.011339966208377799), + FRAC_CONST(0.013619706891715299), + FRAC_CONST(0.016226894586323766), + FRAC_CONST(0.019190324717288168), + FRAC_CONST(0.022539283975960878), + FRAC_CONST(0.026303340480472455), + FRAC_CONST(0.030512117046644357), + FRAC_CONST(0.03519504922365594), + FRAC_CONST(0.040381130021856941), + FRAC_CONST(0.046098643518702249), + FRAC_CONST(0.052374889768730587), + FRAC_CONST(0.059235903660769147), + FRAC_CONST(0.066706170556282418), + FRAC_CONST(0.074808341703430481), + FRAC_CONST(0.083562952548726227), + FRAC_CONST(0.092988147159339674), + FRAC_CONST(0.1030994120216919), + FRAC_CONST(0.11390932249409955), + FRAC_CONST(0.12542730516149531), + FRAC_CONST(0.13765941926783826), + FRAC_CONST(0.15060816028651081), + FRAC_CONST(0.16427228853114245), + FRAC_CONST(0.17864668550988483), + FRAC_CONST(0.19372224048676889), + FRAC_CONST(0.20948576943658073), + FRAC_CONST(0.22591996826744942), + FRAC_CONST(0.24300340184133981), + FRAC_CONST(0.26071052995068139), + FRAC_CONST(0.27901177101369551), + FRAC_CONST(0.29787360383626599), + FRAC_CONST(0.3172587073594233), + FRAC_CONST(0.33712613787396362), + FRAC_CONST(0.35743154274286698), + FRAC_CONST(0.37812740923363009), + FRAC_CONST(0.39916334663203618), + FRAC_CONST(0.42048639939189658), + FRAC_CONST(0.4420413886774246), + FRAC_CONST(0.4637712792815169), + FRAC_CONST(0.4856175685594023), + FRAC_CONST(0.50752069370766872), + FRAC_CONST(0.52942045344797806), + FRAC_CONST(0.55125643994680196), + FRAC_CONST(0.57296847662071559), + FRAC_CONST(0.59449705734411495), + FRAC_CONST(0.61578378249506627), + FRAC_CONST(0.63677178724712891), + FRAC_CONST(0.65740615754163356), + FRAC_CONST(0.67763432925662526), + FRAC_CONST(0.69740646622548552), + FRAC_CONST(0.71667581294953808), + FRAC_CONST(0.73539901809352737), + FRAC_CONST(0.75353642514900732), + FRAC_CONST(0.77105232699609816), + FRAC_CONST(0.78791518148597028), + FRAC_CONST(0.80409778560147072), + FRAC_CONST(0.81957740622770781), + FRAC_CONST(0.83433586607383625), + FRAC_CONST(0.84835958382689225), + FRAC_CONST(0.86163956818294229), + FRAC_CONST(0.87417136598406997), + FRAC_CONST(0.88595496528524853), + FRAC_CONST(0.89699465477567619), + FRAC_CONST(0.90729884157670959), + FRAC_CONST(0.91687983002436779), + FRAC_CONST(0.92575356460899649), + FRAC_CONST(0.93393934077779084), + FRAC_CONST(0.94145948779657318), + FRAC_CONST(0.94833902830402828), + FRAC_CONST(0.95460531956280026), + FRAC_CONST(0.96028768170574896), + FRAC_CONST(0.96541701848104766), + FRAC_CONST(0.97002543610646474), + FRAC_CONST(0.97414586584250062), + FRAC_CONST(0.97781169577969584), + FRAC_CONST(0.98105641710392333), + FRAC_CONST(0.98391328975491177), + FRAC_CONST(0.98641503193166202), + FRAC_CONST(0.98859353733226141), + FRAC_CONST(0.99047962335771556), + FRAC_CONST(0.9921028127769449), + FRAC_CONST(0.99349115056397752), + FRAC_CONST(0.99467105680259038), + FRAC_CONST(0.9956672157341897), + FRAC_CONST(0.99650250022834352), + FRAC_CONST(0.99719793020823266), + FRAC_CONST(0.99777266288955657), + FRAC_CONST(0.99824401211201486), + FRAC_CONST(0.99862749357391212), + FRAC_CONST(0.99893689243401962), + FRAC_CONST(0.99918434952623147), + FRAC_CONST(0.99938046234161726), + FRAC_CONST(0.99953439696357238), + FRAC_CONST(0.99965400728430465), + FRAC_CONST(0.99974595807027455), + FRAC_CONST(0.99981584876278362), + FRAC_CONST(0.99986833527824281), + FRAC_CONST(0.99990724749057802), + FRAC_CONST(0.99993570051598468), + FRAC_CONST(0.99995619835942084), + FRAC_CONST(0.99997072890647543), + FRAC_CONST(0.9999808496399144), + FRAC_CONST(0.99998776381655818), + FRAC_CONST(0.99999238714961569), + FRAC_CONST(0.99999540529959718), + FRAC_CONST(0.99999732268176988), + FRAC_CONST(0.99999850325054862), + FRAC_CONST(0.99999920402413744), + FRAC_CONST(0.9999996021706401), + FRAC_CONST(0.99999981649545566), + FRAC_CONST(0.99999992415545547), + FRAC_CONST(0.99999997338493041), + FRAC_CONST(0.99999999295825959), + FRAC_CONST(0.99999999904096815) +}; + +#ifdef ALLOW_SMALL_FRAMELENGTH +ALIGN static const real_t kbd_short_120[] = +{ + FRAC_CONST(0.0000452320086910), + FRAC_CONST(0.0001274564692111), + FRAC_CONST(0.0002529398385345), + FRAC_CONST(0.0004335140496648), + FRAC_CONST(0.0006827100966952), + FRAC_CONST(0.0010158708222246), + FRAC_CONST(0.0014502162869659), + FRAC_CONST(0.0020048865156264), + FRAC_CONST(0.0027009618393178), + FRAC_CONST(0.0035614590925043), + FRAC_CONST(0.0046113018122711), + FRAC_CONST(0.0058772627936484), + FRAC_CONST(0.0073878776584103), + FRAC_CONST(0.0091733284512589), + FRAC_CONST(0.0112652966728373), + FRAC_CONST(0.0136967855861945), + FRAC_CONST(0.0165019120857793), + FRAC_CONST(0.0197156688892217), + FRAC_CONST(0.0233736582950619), + FRAC_CONST(0.0275117992367496), + FRAC_CONST(0.0321660098468534), + FRAC_CONST(0.0373718682174417), + FRAC_CONST(0.0431642544948834), + FRAC_CONST(0.0495769778717676), + FRAC_CONST(0.0566423924273392), + FRAC_CONST(0.0643910061132260), + FRAC_CONST(0.0728510874761729), + FRAC_CONST(0.0820482749475221), + FRAC_CONST(0.0920051937045235), + FRAC_CONST(0.1027410852163450), + FRAC_CONST(0.1142714546239370), + FRAC_CONST(0.1266077410648368), + FRAC_CONST(0.1397570159398145), + FRAC_CONST(0.1537217139274270), + FRAC_CONST(0.1684994012857075), + FRAC_CONST(0.1840825856392944), + FRAC_CONST(0.2004585710384133), + FRAC_CONST(0.2176093615976121), + FRAC_CONST(0.2355116164824983), + FRAC_CONST(0.2541366584185075), + FRAC_CONST(0.2734505372545160), + FRAC_CONST(0.2934141494343369), + FRAC_CONST(0.3139834135200387), + FRAC_CONST(0.3351095011824163), + FRAC_CONST(0.3567391223361566), + FRAC_CONST(0.3788148623608774), + FRAC_CONST(0.4012755686250732), + FRAC_CONST(0.4240567828288110), + FRAC_CONST(0.4470912150133537), + FRAC_CONST(0.4703092544619664), + FRAC_CONST(0.4936395121456694), + FRAC_CONST(0.5170093888596962), + FRAC_CONST(0.5403456627591340), + FRAC_CONST(0.5635750896430154), + FRAC_CONST(0.5866250090612892), + FRAC_CONST(0.6094239491338723), + FRAC_CONST(0.6319022228794100), + FRAC_CONST(0.6539925088563087), + FRAC_CONST(0.6756304090216887), + FRAC_CONST(0.6967549769155277), + FRAC_CONST(0.7173092095766250), + FRAC_CONST(0.7372404969921184), + FRAC_CONST(0.7565010233699827), + FRAC_CONST(0.7750481150999984), + FRAC_CONST(0.7928445309277697), + FRAC_CONST(0.8098586906021583), + FRAC_CONST(0.8260648390616000), + FRAC_CONST(0.8414431440907889), + FRAC_CONST(0.8559797262966709), + FRAC_CONST(0.8696666212110165), + FRAC_CONST(0.8825016743142358), + FRAC_CONST(0.8944883707784486), + FRAC_CONST(0.9056356027326216), + FRAC_CONST(0.9159573778427816), + FRAC_CONST(0.9254724739583072), + FRAC_CONST(0.9342040454819434), + FRAC_CONST(0.9421791879559176), + FRAC_CONST(0.9494284680976784), + FRAC_CONST(0.9559854271440150), + FRAC_CONST(0.9618860658493898), + FRAC_CONST(0.9671683198119525), + FRAC_CONST(0.9718715339497299), + FRAC_CONST(0.9760359449042233), + FRAC_CONST(0.9797021798981759), + FRAC_CONST(0.9829107801140203), + FRAC_CONST(0.9857017559923277), + FRAC_CONST(0.9881141809867999), + FRAC_CONST(0.9901858292742826), + FRAC_CONST(0.9919528617340944), + FRAC_CONST(0.9934495632180476), + FRAC_CONST(0.9947081327749199), + FRAC_CONST(0.9957585271195989), + FRAC_CONST(0.9966283562984427), + FRAC_CONST(0.9973428292485683), + FRAC_CONST(0.9979247458259197), + FRAC_CONST(0.9983945309245774), + FRAC_CONST(0.9987703055583410), + FRAC_CONST(0.9990679892449266), + FRAC_CONST(0.9993014277313617), + FRAC_CONST(0.9994825400228521), + FRAC_CONST(0.9996214788122335), + FRAC_CONST(0.9997267987294857), + FRAC_CONST(0.9998056273097539), + FRAC_CONST(0.9998638341781910), + FRAC_CONST(0.9999061946325793), + FRAC_CONST(0.9999365445321382), + FRAC_CONST(0.9999579241373735), + FRAC_CONST(0.9999727092594598), + FRAC_CONST(0.9999827287418790), + FRAC_CONST(0.9999893678912771), + FRAC_CONST(0.9999936579844555), + FRAC_CONST(0.9999963523959187), + FRAC_CONST(0.9999979902130101), + FRAC_CONST(0.9999989484358076), + FRAC_CONST(0.9999994840031031), + FRAC_CONST(0.9999997669534347), + FRAC_CONST(0.9999999060327799), + FRAC_CONST(0.9999999680107184), + FRAC_CONST(0.9999999918774242), + FRAC_CONST(0.9999999989770326) +}; +#endif + +#ifdef __cplusplus +} +#endif +#endif diff --git a/Libraries/FAAD2/Files/libfaad/libfaad.dsp b/Libraries/FAAD2/Files/libfaad/libfaad.dsp new file mode 100644 index 000000000..b3e3f2b26 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/libfaad.dsp @@ -0,0 +1,484 @@ +# Microsoft Developer Studio Project File - Name="libfaad" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Static Library" 0x0104 + +CFG=libfaad - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "libfaad.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "libfaad.mak" CFG="libfaad - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "libfaad - Win32 Release" (based on "Win32 (x86) Static Library") +!MESSAGE "libfaad - Win32 Debug" (based on "Win32 (x86) Static Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=xicl6.exe +RSC=rc.exe + +!IF "$(CFG)" == "libfaad - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +MTL=midl.exe +F90=df.exe +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c +# ADD CPP /nologo /G6 /MD /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /YX /FD /c +# ADD BASE RSC /l 0x413 /d "NDEBUG" +# ADD RSC /l 0x413 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ELSEIF "$(CFG)" == "libfaad - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +MTL=midl.exe +F90=df.exe +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c +# ADD BASE RSC /l 0x413 /d "_DEBUG" +# ADD RSC /l 0x413 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ENDIF + +# Begin Target + +# Name "libfaad - Win32 Release" +# Name "libfaad - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\bits.c +# End Source File +# Begin Source File + +SOURCE=.\cfft.c +# End Source File +# Begin Source File + +SOURCE=.\common.c +# End Source File +# Begin Source File + +SOURCE=.\decoder.c +# End Source File +# Begin Source File + +SOURCE=.\drc.c +# End Source File +# Begin Source File + +SOURCE=.\drm_dec.c +# End Source File +# Begin Source File + +SOURCE=.\error.c +# End Source File +# Begin Source File + +SOURCE=.\filtbank.c +# End Source File +# Begin Source File + +SOURCE=.\hcr.c +# End Source File +# Begin Source File + +SOURCE=.\huffman.c +# End Source File +# Begin Source File + +SOURCE=.\ic_predict.c +# End Source File +# Begin Source File + +SOURCE=.\is.c +# End Source File +# Begin Source File + +SOURCE=.\lt_predict.c +# End Source File +# Begin Source File + +SOURCE=.\mdct.c +# End Source File +# Begin Source File + +SOURCE=.\mp4.c +# End Source File +# Begin Source File + +SOURCE=.\ms.c +# End Source File +# Begin Source File + +SOURCE=.\output.c +# End Source File +# Begin Source File + +SOURCE=.\pns.c +# End Source File +# Begin Source File + +SOURCE=.\ps_dec.c +# End Source File +# Begin Source File + +SOURCE=.\ps_syntax.c +# End Source File +# Begin Source File + +SOURCE=.\pulse.c +# End Source File +# Begin Source File + +SOURCE=.\rvlc.c +# End Source File +# Begin Source File + +SOURCE=.\sbr_dct.c +# End Source File +# Begin Source File + +SOURCE=.\sbr_dec.c +# End Source File +# Begin Source File + +SOURCE=.\sbr_e_nf.c +# End Source File +# Begin Source File + +SOURCE=.\sbr_fbt.c +# End Source File +# Begin Source File + +SOURCE=.\sbr_hfadj.c +# End Source File +# Begin Source File + +SOURCE=.\sbr_hfgen.c +# End Source File +# Begin Source File + +SOURCE=.\sbr_huff.c +# End Source File +# Begin Source File + +SOURCE=.\sbr_qmf.c +# End Source File +# Begin Source File + +SOURCE=.\sbr_syntax.c +# End Source File +# Begin Source File + +SOURCE=.\sbr_tf_grid.c +# End Source File +# Begin Source File + +SOURCE=.\specrec.c +# End Source File +# Begin Source File + +SOURCE=.\ssr.c +# End Source File +# Begin Source File + +SOURCE=.\ssr_fb.c +# End Source File +# Begin Source File + +SOURCE=.\ssr_ipqf.c +# End Source File +# Begin Source File + +SOURCE=.\syntax.c +# End Source File +# Begin Source File + +SOURCE=.\tns.c +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Group "codebook" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=.\codebook\hcb_1.h +# End Source File +# Begin Source File + +SOURCE=.\codebook\hcb_10.h +# End Source File +# Begin Source File + +SOURCE=.\codebook\hcb_11.h +# End Source File +# Begin Source File + +SOURCE=.\codebook\hcb_2.h +# End Source File +# Begin Source File + +SOURCE=.\codebook\hcb_3.h +# End Source File +# Begin Source File + +SOURCE=.\codebook\hcb_4.h +# End Source File +# Begin Source File + +SOURCE=.\codebook\hcb_5.h +# End Source File +# Begin Source File + +SOURCE=.\codebook\hcb_6.h +# End Source File +# Begin Source File + +SOURCE=.\codebook\hcb_7.h +# End Source File +# Begin Source File + +SOURCE=.\codebook\hcb_8.h +# End Source File +# Begin Source File + +SOURCE=.\codebook\hcb_9.h +# End Source File +# Begin Source File + +SOURCE=.\codebook\hcb_sf.h +# End Source File +# End Group +# Begin Source File + +SOURCE=.\analysis.h +# End Source File +# Begin Source File + +SOURCE=.\bits.h +# End Source File +# Begin Source File + +SOURCE=.\cfft.h +# End Source File +# Begin Source File + +SOURCE=.\cfft_tab.h +# End Source File +# Begin Source File + +SOURCE=.\common.h +# End Source File +# Begin Source File + +SOURCE=.\decoder.h +# End Source File +# Begin Source File + +SOURCE=.\drc.h +# End Source File +# Begin Source File + +SOURCE=.\drm_dec.h +# End Source File +# Begin Source File + +SOURCE=.\error.h +# End Source File +# Begin Source File + +SOURCE=.\filtbank.h +# End Source File +# Begin Source File + +SOURCE=.\fixed.h +# End Source File +# Begin Source File + +SOURCE=.\codebook\hcb.h +# End Source File +# Begin Source File + +SOURCE=.\huffman.h +# End Source File +# Begin Source File + +SOURCE=.\ic_predict.h +# End Source File +# Begin Source File + +SOURCE=.\iq_table.h +# End Source File +# Begin Source File + +SOURCE=.\is.h +# End Source File +# Begin Source File + +SOURCE=.\kbd_win.h +# End Source File +# Begin Source File + +SOURCE=.\lt_predict.h +# End Source File +# Begin Source File + +SOURCE=.\mdct.h +# End Source File +# Begin Source File + +SOURCE=.\mdct_tab.h +# End Source File +# Begin Source File + +SOURCE=.\mp4.h +# End Source File +# Begin Source File + +SOURCE=.\ms.h +# End Source File +# Begin Source File + +SOURCE=.\output.h +# End Source File +# Begin Source File + +SOURCE=.\pns.h +# End Source File +# Begin Source File + +SOURCE=.\ps_dec.h +# End Source File +# Begin Source File + +SOURCE=.\ps_tables.h +# End Source File +# Begin Source File + +SOURCE=.\pulse.h +# End Source File +# Begin Source File + +SOURCE=.\rvlc.h +# End Source File +# Begin Source File + +SOURCE=.\sbr_dct.h +# End Source File +# Begin Source File + +SOURCE=.\sbr_dec.h +# End Source File +# Begin Source File + +SOURCE=.\sbr_e_nf.h +# End Source File +# Begin Source File + +SOURCE=.\sbr_fbt.h +# End Source File +# Begin Source File + +SOURCE=.\sbr_hfadj.h +# End Source File +# Begin Source File + +SOURCE=.\sbr_hfgen.h +# End Source File +# Begin Source File + +SOURCE=.\sbr_huff.h +# End Source File +# Begin Source File + +SOURCE=.\sbr_noise.h +# End Source File +# Begin Source File + +SOURCE=.\sbr_qmf.h +# End Source File +# Begin Source File + +SOURCE=.\sbr_qmf_c.h +# End Source File +# Begin Source File + +SOURCE=.\sbr_syntax.h +# End Source File +# Begin Source File + +SOURCE=.\sbr_tf_grid.h +# End Source File +# Begin Source File + +SOURCE=.\sine_win.h +# End Source File +# Begin Source File + +SOURCE=.\specrec.h +# End Source File +# Begin Source File + +SOURCE=.\ssr.h +# End Source File +# Begin Source File + +SOURCE=.\structs.h +# End Source File +# Begin Source File + +SOURCE=.\syntax.h +# End Source File +# Begin Source File + +SOURCE=.\tns.h +# End Source File +# End Group +# End Target +# End Project diff --git a/Libraries/FAAD2/Files/libfaad/libfaad.dsw b/Libraries/FAAD2/Files/libfaad/libfaad.dsw new file mode 100644 index 000000000..0dad6acc9 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/libfaad.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "libfaad"=.\libfaad.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/Libraries/FAAD2/Files/libfaad/libfaad.sln b/Libraries/FAAD2/Files/libfaad/libfaad.sln new file mode 100644 index 000000000..3fd3b69ab --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/libfaad.sln @@ -0,0 +1,24 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libfaad", "libfaad.vcproj", "{4274723E-6B9D-4B3E-A8BE-7566165AA169}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(DPCodeReviewSolutionGUID) = preSolution + DPCodeReviewSolutionGUID = {00000000-0000-0000-0000-000000000000} + EndGlobalSection + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {4274723E-6B9D-4B3E-A8BE-7566165AA169}.Debug.ActiveCfg = Debug|Win32 + {4274723E-6B9D-4B3E-A8BE-7566165AA169}.Debug.Build.0 = Debug|Win32 + {4274723E-6B9D-4B3E-A8BE-7566165AA169}.Release.ActiveCfg = Release|Win32 + {4274723E-6B9D-4B3E-A8BE-7566165AA169}.Release.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Libraries/FAAD2/Files/libfaad/libfaad.vcproj b/Libraries/FAAD2/Files/libfaad/libfaad.vcproj new file mode 100644 index 000000000..f6eb51872 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/libfaad.vcproj @@ -0,0 +1,1015 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Libraries/FAAD2/Files/libfaad/libfaad2.def b/Libraries/FAAD2/Files/libfaad/libfaad2.def new file mode 100644 index 000000000..0268b7f0b --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/libfaad2.def @@ -0,0 +1,14 @@ +LIBRARY libfaad2.dll +EXPORTS +; +; libfaad exports +; +faacDecOpen @1 +faacDecGetCurrentConfiguration @2 +faacDecSetConfiguration @3 +faacDecInit @4 +faacDecInit2 @5 +faacDecDecode @6 +faacDecClose @7 +faacDecGetErrorMessage @8 +AudioSpecificConfig @9 diff --git a/Libraries/FAAD2/Files/libfaad/libfaad2.vcp b/Libraries/FAAD2/Files/libfaad/libfaad2.vcp new file mode 100644 index 000000000..7e2767746 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/libfaad2.vcp @@ -0,0 +1,2091 @@ +# Microsoft eMbedded Visual Tools Project File - Name="libfaad2" - Package Owner=<4> +# Microsoft eMbedded Visual Tools Generated Build File, Format Version 6.02 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (WCE x86) Static Library" 0x8304 +# TARGTYPE "Win32 (WCE ARM) Static Library" 0x8504 + +CFG=libfaad2 - Win32 (WCE ARM) Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "libfaad2.vcn". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "libfaad2.vcn" CFG="libfaad2 - Win32 (WCE ARM) Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "libfaad2 - Win32 (WCE ARM) Release" (based on "Win32 (WCE ARM) Static Library") +!MESSAGE "libfaad2 - Win32 (WCE ARM) Debug" (based on "Win32 (WCE ARM) Static Library") +!MESSAGE "libfaad2 - Win32 (WCE x86) Release" (based on "Win32 (WCE x86) Static Library") +!MESSAGE "libfaad2 - Win32 (WCE x86) Debug" (based on "Win32 (WCE x86) Static Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +# PROP ATL_Project 2 + +!IF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "ARMRel" +# PROP BASE Intermediate_Dir "ARMRel" +# PROP BASE CPU_ID "{D6518FFC-710F-11D3-99F2-00105A0DF099}" +# PROP BASE Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "ARMRel" +# PROP Intermediate_Dir "ARMRel" +# PROP CPU_ID "{D6518FFC-710F-11D3-99F2-00105A0DF099}" +# PROP Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}" +# PROP Target_Dir "" +CPP=clarm.exe +# ADD BASE CPP /nologo /W3 /GX- /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "NDEBUG" /D "ARM" /D "_ARM_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_LIB" /YX /Oxs /M$(CECrtMT) /c +# ADD CPP /nologo /W3 /GX- /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "NDEBUG" /D "ARM" /D "_ARM_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_LIB" /YX /Oxs /M$(CECrtMT) /c +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "ARMDbg" +# PROP BASE Intermediate_Dir "ARMDbg" +# PROP BASE CPU_ID "{D6518FFC-710F-11D3-99F2-00105A0DF099}" +# PROP BASE Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "ARMDbg" +# PROP Intermediate_Dir "ARMDbg" +# PROP CPU_ID "{D6518FFC-710F-11D3-99F2-00105A0DF099}" +# PROP Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}" +# PROP Target_Dir "" +CPP=clarm.exe +# ADD BASE CPP /nologo /W3 /GX- /Zi /Od /D "DEBUG" /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "ARM" /D "_ARM_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_LIB" /YX /M$(CECrtMTDebug) /c +# ADD CPP /nologo /W3 /GX- /Zi /Od /D "DEBUG" /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "ARM" /D "_ARM_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_LIB" /YX /M$(CECrtMTDebug) /c +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "X86Rel" +# PROP BASE Intermediate_Dir "X86Rel" +# PROP BASE CPU_ID "{D6518FF3-710F-11D3-99F2-00105A0DF099}" +# PROP BASE Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "X86Rel" +# PROP Intermediate_Dir "X86Rel" +# PROP CPU_ID "{D6518FF3-710F-11D3-99F2-00105A0DF099}" +# PROP Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}" +# PROP Target_Dir "" +CPP=cl.exe +# ADD BASE CPP /nologo /W3 /GX- /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "_i386_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_X86_" /D "x86" /D "NDEBUG" /D "_LIB" /YX /Gs8192 /GF /Oxs /c +# ADD CPP /nologo /W3 /GX- /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "_i386_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_X86_" /D "x86" /D "NDEBUG" /D "_LIB" /YX /Gs8192 /GF /Oxs /c +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "X86Dbg" +# PROP BASE Intermediate_Dir "X86Dbg" +# PROP BASE CPU_ID "{D6518FF3-710F-11D3-99F2-00105A0DF099}" +# PROP BASE Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "X86Dbg" +# PROP Intermediate_Dir "X86Dbg" +# PROP CPU_ID "{D6518FF3-710F-11D3-99F2-00105A0DF099}" +# PROP Platform_ID "{8A9A2F80-6887-11D3-842E-005004848CBA}" +# PROP Target_Dir "" +CPP=cl.exe +# ADD BASE CPP /nologo /W3 /GX- /Zi /Od /D "DEBUG" /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "_i386_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_X86_" /D "x86" /D "_LIB" /YX /Gs8192 /GF /c +# ADD CPP /nologo /W3 /GX- /Zi /Od /D "DEBUG" /D _WIN32_WCE=$(CEVersion) /D "$(CePlatform)" /D "_i386_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "_X86_" /D "x86" /D "_LIB" /YX /Gs8192 /GF /c +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo + +!ENDIF + +# Begin Target + +# Name "libfaad2 - Win32 (WCE ARM) Release" +# Name "libfaad2 - Win32 (WCE ARM) Debug" +# Name "libfaad2 - Win32 (WCE x86) Release" +# Name "libfaad2 - Win32 (WCE x86) Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Group "codebook" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=.\codebook\hcb_1.c + +!IF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release" + +DEP_CPP_HCB_1=\ + ".\codebook\hcb.h"\ + ".\common.h"\ + ".\fixed.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug" + +DEP_CPP_HCB_1=\ + ".\codebook\hcb.h"\ + ".\common.h"\ + ".\fixed.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release" + +DEP_CPP_HCB_1=\ + ".\codebook\hcb.h"\ + ".\common.h"\ + ".\fixed.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug" + +DEP_CPP_HCB_1=\ + ".\codebook\hcb.h"\ + ".\common.h"\ + ".\fixed.h"\ + + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\codebook\hcb_10.c + +!IF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release" + +DEP_CPP_HCB_10=\ + ".\codebook\hcb.h"\ + ".\common.h"\ + ".\fixed.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug" + +DEP_CPP_HCB_10=\ + ".\codebook\hcb.h"\ + ".\common.h"\ + ".\fixed.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release" + +DEP_CPP_HCB_10=\ + ".\codebook\hcb.h"\ + ".\common.h"\ + ".\fixed.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug" + +DEP_CPP_HCB_10=\ + ".\codebook\hcb.h"\ + ".\common.h"\ + ".\fixed.h"\ + + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\codebook\hcb_11.c + +!IF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release" + +DEP_CPP_HCB_11=\ + ".\codebook\hcb.h"\ + ".\common.h"\ + ".\fixed.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug" + +DEP_CPP_HCB_11=\ + ".\codebook\hcb.h"\ + ".\common.h"\ + ".\fixed.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release" + +DEP_CPP_HCB_11=\ + ".\codebook\hcb.h"\ + ".\common.h"\ + ".\fixed.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug" + +DEP_CPP_HCB_11=\ + ".\codebook\hcb.h"\ + ".\common.h"\ + ".\fixed.h"\ + + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\codebook\hcb_2.c + +!IF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release" + +DEP_CPP_HCB_2=\ + ".\codebook\hcb.h"\ + ".\common.h"\ + ".\fixed.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug" + +DEP_CPP_HCB_2=\ + ".\codebook\hcb.h"\ + ".\common.h"\ + ".\fixed.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release" + +DEP_CPP_HCB_2=\ + ".\codebook\hcb.h"\ + ".\common.h"\ + ".\fixed.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug" + +DEP_CPP_HCB_2=\ + ".\codebook\hcb.h"\ + ".\common.h"\ + ".\fixed.h"\ + + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\codebook\hcb_3.c + +!IF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release" + +DEP_CPP_HCB_3=\ + ".\codebook\hcb.h"\ + ".\common.h"\ + ".\fixed.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug" + +DEP_CPP_HCB_3=\ + ".\codebook\hcb.h"\ + ".\common.h"\ + ".\fixed.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release" + +DEP_CPP_HCB_3=\ + ".\codebook\hcb.h"\ + ".\common.h"\ + ".\fixed.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug" + +DEP_CPP_HCB_3=\ + ".\codebook\hcb.h"\ + ".\common.h"\ + ".\fixed.h"\ + + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\codebook\hcb_4.c + +!IF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release" + +DEP_CPP_HCB_4=\ + ".\codebook\hcb.h"\ + ".\common.h"\ + ".\fixed.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug" + +DEP_CPP_HCB_4=\ + ".\codebook\hcb.h"\ + ".\common.h"\ + ".\fixed.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release" + +DEP_CPP_HCB_4=\ + ".\codebook\hcb.h"\ + ".\common.h"\ + ".\fixed.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug" + +DEP_CPP_HCB_4=\ + ".\codebook\hcb.h"\ + ".\common.h"\ + ".\fixed.h"\ + + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\codebook\hcb_5.c + +!IF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release" + +DEP_CPP_HCB_5=\ + ".\codebook\hcb.h"\ + ".\common.h"\ + ".\fixed.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug" + +DEP_CPP_HCB_5=\ + ".\codebook\hcb.h"\ + ".\common.h"\ + ".\fixed.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release" + +DEP_CPP_HCB_5=\ + ".\codebook\hcb.h"\ + ".\common.h"\ + ".\fixed.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug" + +DEP_CPP_HCB_5=\ + ".\codebook\hcb.h"\ + ".\common.h"\ + ".\fixed.h"\ + + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\codebook\hcb_6.c + +!IF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release" + +DEP_CPP_HCB_6=\ + ".\codebook\hcb.h"\ + ".\common.h"\ + ".\fixed.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug" + +DEP_CPP_HCB_6=\ + ".\codebook\hcb.h"\ + ".\common.h"\ + ".\fixed.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release" + +DEP_CPP_HCB_6=\ + ".\codebook\hcb.h"\ + ".\common.h"\ + ".\fixed.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug" + +DEP_CPP_HCB_6=\ + ".\codebook\hcb.h"\ + ".\common.h"\ + ".\fixed.h"\ + + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\codebook\hcb_7.c + +!IF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release" + +DEP_CPP_HCB_7=\ + ".\codebook\hcb.h"\ + ".\common.h"\ + ".\fixed.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug" + +DEP_CPP_HCB_7=\ + ".\codebook\hcb.h"\ + ".\common.h"\ + ".\fixed.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release" + +DEP_CPP_HCB_7=\ + ".\codebook\hcb.h"\ + ".\common.h"\ + ".\fixed.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug" + +DEP_CPP_HCB_7=\ + ".\codebook\hcb.h"\ + ".\common.h"\ + ".\fixed.h"\ + + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\codebook\hcb_8.c + +!IF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release" + +DEP_CPP_HCB_8=\ + ".\codebook\hcb.h"\ + ".\common.h"\ + ".\fixed.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug" + +DEP_CPP_HCB_8=\ + ".\codebook\hcb.h"\ + ".\common.h"\ + ".\fixed.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release" + +DEP_CPP_HCB_8=\ + ".\codebook\hcb.h"\ + ".\common.h"\ + ".\fixed.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug" + +DEP_CPP_HCB_8=\ + ".\codebook\hcb.h"\ + ".\common.h"\ + ".\fixed.h"\ + + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\codebook\hcb_9.c + +!IF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release" + +DEP_CPP_HCB_9=\ + ".\codebook\hcb.h"\ + ".\common.h"\ + ".\fixed.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug" + +DEP_CPP_HCB_9=\ + ".\codebook\hcb.h"\ + ".\common.h"\ + ".\fixed.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release" + +DEP_CPP_HCB_9=\ + ".\codebook\hcb.h"\ + ".\common.h"\ + ".\fixed.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug" + +DEP_CPP_HCB_9=\ + ".\codebook\hcb.h"\ + ".\common.h"\ + ".\fixed.h"\ + + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\codebook\hcb_sf.c + +!IF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release" + +DEP_CPP_HCB_S=\ + ".\codebook\hcb.h"\ + ".\common.h"\ + ".\fixed.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug" + +DEP_CPP_HCB_S=\ + ".\codebook\hcb.h"\ + ".\common.h"\ + ".\fixed.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release" + +DEP_CPP_HCB_S=\ + ".\codebook\hcb.h"\ + ".\common.h"\ + ".\fixed.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug" + +DEP_CPP_HCB_S=\ + ".\codebook\hcb.h"\ + ".\common.h"\ + ".\fixed.h"\ + + +!ENDIF + +# End Source File +# End Group +# Begin Source File + +SOURCE=.\bits.c + +!IF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release" + +DEP_CPP_BITS_=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\common.h"\ + ".\fixed.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug" + +DEP_CPP_BITS_=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\common.h"\ + ".\fixed.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release" + +DEP_CPP_BITS_=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\common.h"\ + ".\fixed.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug" + +DEP_CPP_BITS_=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\common.h"\ + ".\fixed.h"\ + + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\cfft.c + +!IF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release" + +DEP_CPP_CFFT_=\ + ".\cfft.h"\ + ".\cfft_tab.h"\ + ".\common.h"\ + ".\fixed.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug" + +DEP_CPP_CFFT_=\ + ".\cfft.h"\ + ".\cfft_tab.h"\ + ".\common.h"\ + ".\fixed.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release" + +DEP_CPP_CFFT_=\ + ".\cfft.h"\ + ".\cfft_tab.h"\ + ".\common.h"\ + ".\fixed.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug" + +DEP_CPP_CFFT_=\ + ".\cfft.h"\ + ".\cfft_tab.h"\ + ".\common.h"\ + ".\fixed.h"\ + + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\common.c + +!IF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release" + +DEP_CPP_COMMO=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\common.h"\ + ".\fixed.h"\ + ".\syntax.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug" + +DEP_CPP_COMMO=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\common.h"\ + ".\fixed.h"\ + ".\syntax.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release" + +DEP_CPP_COMMO=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\common.h"\ + ".\fixed.h"\ + ".\syntax.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug" + +DEP_CPP_COMMO=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\common.h"\ + ".\fixed.h"\ + ".\syntax.h"\ + + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\data.c + +!IF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release" + +DEP_CPP_DATA_=\ + ".\common.h"\ + ".\data.h"\ + ".\fixed.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug" + +DEP_CPP_DATA_=\ + ".\common.h"\ + ".\data.h"\ + ".\fixed.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release" + +DEP_CPP_DATA_=\ + ".\common.h"\ + ".\data.h"\ + ".\fixed.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug" + +DEP_CPP_DATA_=\ + ".\common.h"\ + ".\data.h"\ + ".\fixed.h"\ + + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\decoder.c + +!IF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release" + +DEP_CPP_DECOD=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\cfft.h"\ + ".\common.h"\ + ".\data.h"\ + ".\decoder.h"\ + ".\dither.h"\ + ".\drc.h"\ + ".\error.h"\ + ".\filtbank.h"\ + ".\fixed.h"\ + ".\ic_predict.h"\ + ".\is.h"\ + ".\lt_predict.h"\ + ".\mdct.h"\ + ".\mp4.h"\ + ".\ms.h"\ + ".\output.h"\ + ".\pns.h"\ + ".\specrec.h"\ + ".\syntax.h"\ + ".\tns.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug" + +DEP_CPP_DECOD=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\cfft.h"\ + ".\common.h"\ + ".\data.h"\ + ".\decoder.h"\ + ".\dither.h"\ + ".\drc.h"\ + ".\error.h"\ + ".\filtbank.h"\ + ".\fixed.h"\ + ".\ic_predict.h"\ + ".\is.h"\ + ".\lt_predict.h"\ + ".\mdct.h"\ + ".\mp4.h"\ + ".\ms.h"\ + ".\output.h"\ + ".\pns.h"\ + ".\specrec.h"\ + ".\syntax.h"\ + ".\tns.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release" + +DEP_CPP_DECOD=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\cfft.h"\ + ".\common.h"\ + ".\data.h"\ + ".\decoder.h"\ + ".\dither.h"\ + ".\drc.h"\ + ".\error.h"\ + ".\filtbank.h"\ + ".\fixed.h"\ + ".\ic_predict.h"\ + ".\is.h"\ + ".\lt_predict.h"\ + ".\mdct.h"\ + ".\mp4.h"\ + ".\ms.h"\ + ".\output.h"\ + ".\pns.h"\ + ".\specrec.h"\ + ".\syntax.h"\ + ".\tns.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug" + +DEP_CPP_DECOD=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\cfft.h"\ + ".\common.h"\ + ".\data.h"\ + ".\decoder.h"\ + ".\dither.h"\ + ".\drc.h"\ + ".\error.h"\ + ".\filtbank.h"\ + ".\fixed.h"\ + ".\ic_predict.h"\ + ".\is.h"\ + ".\lt_predict.h"\ + ".\mdct.h"\ + ".\mp4.h"\ + ".\ms.h"\ + ".\output.h"\ + ".\pns.h"\ + ".\specrec.h"\ + ".\syntax.h"\ + ".\tns.h"\ + + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\dither.c + +!IF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release" + +DEP_CPP_DITHE=\ + ".\common.h"\ + ".\dither.h"\ + ".\fixed.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug" + +DEP_CPP_DITHE=\ + ".\common.h"\ + ".\dither.h"\ + ".\fixed.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release" + +DEP_CPP_DITHE=\ + ".\common.h"\ + ".\dither.h"\ + ".\fixed.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug" + +DEP_CPP_DITHE=\ + ".\common.h"\ + ".\dither.h"\ + ".\fixed.h"\ + + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\drc.c + +!IF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release" + +DEP_CPP_DRC_C=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\common.h"\ + ".\drc.h"\ + ".\fixed.h"\ + ".\syntax.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug" + +DEP_CPP_DRC_C=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\common.h"\ + ".\drc.h"\ + ".\fixed.h"\ + ".\syntax.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release" + +DEP_CPP_DRC_C=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\common.h"\ + ".\drc.h"\ + ".\fixed.h"\ + ".\syntax.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug" + +DEP_CPP_DRC_C=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\common.h"\ + ".\drc.h"\ + ".\fixed.h"\ + ".\syntax.h"\ + + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\error.c + +!IF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release" + +DEP_CPP_ERROR=\ + ".\common.h"\ + ".\error.h"\ + ".\fixed.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug" + +DEP_CPP_ERROR=\ + ".\common.h"\ + ".\error.h"\ + ".\fixed.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release" + +DEP_CPP_ERROR=\ + ".\common.h"\ + ".\error.h"\ + ".\fixed.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug" + +DEP_CPP_ERROR=\ + ".\common.h"\ + ".\error.h"\ + ".\fixed.h"\ + + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\filtbank.c + +!IF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release" + +DEP_CPP_FILTB=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\cfft.h"\ + ".\common.h"\ + ".\decoder.h"\ + ".\filtbank.h"\ + ".\fixed.h"\ + ".\ic_predict.h"\ + ".\kbd_win.h"\ + ".\mdct.h"\ + ".\sine_win.h"\ + ".\specrec.h"\ + ".\syntax.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug" + +DEP_CPP_FILTB=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\cfft.h"\ + ".\common.h"\ + ".\decoder.h"\ + ".\filtbank.h"\ + ".\fixed.h"\ + ".\ic_predict.h"\ + ".\kbd_win.h"\ + ".\mdct.h"\ + ".\sine_win.h"\ + ".\specrec.h"\ + ".\syntax.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release" + +DEP_CPP_FILTB=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\cfft.h"\ + ".\common.h"\ + ".\decoder.h"\ + ".\filtbank.h"\ + ".\fixed.h"\ + ".\ic_predict.h"\ + ".\kbd_win.h"\ + ".\mdct.h"\ + ".\sine_win.h"\ + ".\specrec.h"\ + ".\syntax.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug" + +DEP_CPP_FILTB=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\cfft.h"\ + ".\common.h"\ + ".\decoder.h"\ + ".\filtbank.h"\ + ".\fixed.h"\ + ".\ic_predict.h"\ + ".\kbd_win.h"\ + ".\mdct.h"\ + ".\sine_win.h"\ + ".\specrec.h"\ + ".\syntax.h"\ + + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\ic_predict.c + +!IF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release" + +DEP_CPP_IC_PR=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\common.h"\ + ".\fixed.h"\ + ".\ic_predict.h"\ + ".\pns.h"\ + ".\syntax.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug" + +DEP_CPP_IC_PR=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\common.h"\ + ".\fixed.h"\ + ".\ic_predict.h"\ + ".\pns.h"\ + ".\syntax.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release" + +DEP_CPP_IC_PR=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\common.h"\ + ".\fixed.h"\ + ".\ic_predict.h"\ + ".\pns.h"\ + ".\syntax.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug" + +DEP_CPP_IC_PR=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\common.h"\ + ".\fixed.h"\ + ".\ic_predict.h"\ + ".\pns.h"\ + ".\syntax.h"\ + + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\is.c + +!IF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release" + +DEP_CPP_IS_C2c=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\common.h"\ + ".\fixed.h"\ + ".\is.h"\ + ".\syntax.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug" + +DEP_CPP_IS_C2c=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\common.h"\ + ".\fixed.h"\ + ".\is.h"\ + ".\syntax.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release" + +DEP_CPP_IS_C2c=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\common.h"\ + ".\fixed.h"\ + ".\is.h"\ + ".\syntax.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug" + +DEP_CPP_IS_C2c=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\common.h"\ + ".\fixed.h"\ + ".\is.h"\ + ".\syntax.h"\ + + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\lt_predict.c + +!IF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release" + +DEP_CPP_LT_PR=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\cfft.h"\ + ".\common.h"\ + ".\filtbank.h"\ + ".\fixed.h"\ + ".\lt_predict.h"\ + ".\mdct.h"\ + ".\syntax.h"\ + ".\tns.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug" + +DEP_CPP_LT_PR=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\cfft.h"\ + ".\common.h"\ + ".\filtbank.h"\ + ".\fixed.h"\ + ".\lt_predict.h"\ + ".\mdct.h"\ + ".\syntax.h"\ + ".\tns.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release" + +DEP_CPP_LT_PR=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\cfft.h"\ + ".\common.h"\ + ".\filtbank.h"\ + ".\fixed.h"\ + ".\lt_predict.h"\ + ".\mdct.h"\ + ".\syntax.h"\ + ".\tns.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug" + +DEP_CPP_LT_PR=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\cfft.h"\ + ".\common.h"\ + ".\filtbank.h"\ + ".\fixed.h"\ + ".\lt_predict.h"\ + ".\mdct.h"\ + ".\syntax.h"\ + ".\tns.h"\ + + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\mdct.c + +!IF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release" + +DEP_CPP_MDCT_=\ + ".\cfft.h"\ + ".\common.h"\ + ".\fixed.h"\ + ".\mdct.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug" + +DEP_CPP_MDCT_=\ + ".\cfft.h"\ + ".\common.h"\ + ".\fixed.h"\ + ".\mdct.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release" + +DEP_CPP_MDCT_=\ + ".\cfft.h"\ + ".\common.h"\ + ".\fixed.h"\ + ".\mdct.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug" + +DEP_CPP_MDCT_=\ + ".\cfft.h"\ + ".\common.h"\ + ".\fixed.h"\ + ".\mdct.h"\ + + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\mp4.c + +!IF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release" + +DEP_CPP_MP4_C=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\cfft.h"\ + ".\common.h"\ + ".\data.h"\ + ".\decoder.h"\ + ".\filtbank.h"\ + ".\fixed.h"\ + ".\ic_predict.h"\ + ".\mdct.h"\ + ".\mp4.h"\ + ".\specrec.h"\ + ".\syntax.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug" + +DEP_CPP_MP4_C=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\cfft.h"\ + ".\common.h"\ + ".\data.h"\ + ".\decoder.h"\ + ".\filtbank.h"\ + ".\fixed.h"\ + ".\ic_predict.h"\ + ".\mdct.h"\ + ".\mp4.h"\ + ".\specrec.h"\ + ".\syntax.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release" + +DEP_CPP_MP4_C=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\cfft.h"\ + ".\common.h"\ + ".\data.h"\ + ".\decoder.h"\ + ".\filtbank.h"\ + ".\fixed.h"\ + ".\ic_predict.h"\ + ".\mdct.h"\ + ".\mp4.h"\ + ".\specrec.h"\ + ".\syntax.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug" + +DEP_CPP_MP4_C=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\cfft.h"\ + ".\common.h"\ + ".\data.h"\ + ".\decoder.h"\ + ".\filtbank.h"\ + ".\fixed.h"\ + ".\ic_predict.h"\ + ".\mdct.h"\ + ".\mp4.h"\ + ".\specrec.h"\ + ".\syntax.h"\ + + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\ms.c + +!IF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release" + +DEP_CPP_MS_C34=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\common.h"\ + ".\fixed.h"\ + ".\is.h"\ + ".\ms.h"\ + ".\pns.h"\ + ".\syntax.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug" + +DEP_CPP_MS_C34=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\common.h"\ + ".\fixed.h"\ + ".\is.h"\ + ".\ms.h"\ + ".\pns.h"\ + ".\syntax.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release" + +DEP_CPP_MS_C34=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\common.h"\ + ".\fixed.h"\ + ".\is.h"\ + ".\ms.h"\ + ".\pns.h"\ + ".\syntax.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug" + +DEP_CPP_MS_C34=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\common.h"\ + ".\fixed.h"\ + ".\is.h"\ + ".\ms.h"\ + ".\pns.h"\ + ".\syntax.h"\ + + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\output.c + +!IF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release" + +DEP_CPP_OUTPU=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\cfft.h"\ + ".\common.h"\ + ".\decoder.h"\ + ".\dither.h"\ + ".\filtbank.h"\ + ".\fixed.h"\ + ".\ic_predict.h"\ + ".\mdct.h"\ + ".\output.h"\ + ".\specrec.h"\ + ".\syntax.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug" + +DEP_CPP_OUTPU=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\cfft.h"\ + ".\common.h"\ + ".\decoder.h"\ + ".\dither.h"\ + ".\filtbank.h"\ + ".\fixed.h"\ + ".\ic_predict.h"\ + ".\mdct.h"\ + ".\output.h"\ + ".\specrec.h"\ + ".\syntax.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release" + +DEP_CPP_OUTPU=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\cfft.h"\ + ".\common.h"\ + ".\decoder.h"\ + ".\dither.h"\ + ".\filtbank.h"\ + ".\fixed.h"\ + ".\ic_predict.h"\ + ".\mdct.h"\ + ".\output.h"\ + ".\specrec.h"\ + ".\syntax.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug" + +DEP_CPP_OUTPU=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\cfft.h"\ + ".\common.h"\ + ".\decoder.h"\ + ".\dither.h"\ + ".\filtbank.h"\ + ".\fixed.h"\ + ".\ic_predict.h"\ + ".\mdct.h"\ + ".\output.h"\ + ".\specrec.h"\ + ".\syntax.h"\ + + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\pns.c + +!IF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release" + +DEP_CPP_PNS_C=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\common.h"\ + ".\fixed.h"\ + ".\pns.h"\ + ".\syntax.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug" + +DEP_CPP_PNS_C=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\common.h"\ + ".\fixed.h"\ + ".\pns.h"\ + ".\syntax.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release" + +DEP_CPP_PNS_C=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\common.h"\ + ".\fixed.h"\ + ".\pns.h"\ + ".\syntax.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug" + +DEP_CPP_PNS_C=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\common.h"\ + ".\fixed.h"\ + ".\pns.h"\ + ".\syntax.h"\ + + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\pulse.c + +!IF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release" + +DEP_CPP_PULSE=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\common.h"\ + ".\fixed.h"\ + ".\pulse.h"\ + ".\syntax.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug" + +DEP_CPP_PULSE=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\common.h"\ + ".\fixed.h"\ + ".\pulse.h"\ + ".\syntax.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release" + +DEP_CPP_PULSE=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\common.h"\ + ".\fixed.h"\ + ".\pulse.h"\ + ".\syntax.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug" + +DEP_CPP_PULSE=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\common.h"\ + ".\fixed.h"\ + ".\pulse.h"\ + ".\syntax.h"\ + + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\reordered_spectral_data.c + +!IF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release" + +DEP_CPP_REORD=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\codebook\hcb.h"\ + ".\common.h"\ + ".\data.h"\ + ".\fixed.h"\ + ".\pulse.h"\ + ".\specrec.h"\ + ".\syntax.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug" + +DEP_CPP_REORD=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\codebook\hcb.h"\ + ".\common.h"\ + ".\data.h"\ + ".\fixed.h"\ + ".\pulse.h"\ + ".\specrec.h"\ + ".\syntax.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release" + +DEP_CPP_REORD=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\codebook\hcb.h"\ + ".\common.h"\ + ".\data.h"\ + ".\fixed.h"\ + ".\pulse.h"\ + ".\specrec.h"\ + ".\syntax.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug" + +DEP_CPP_REORD=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\codebook\hcb.h"\ + ".\common.h"\ + ".\data.h"\ + ".\fixed.h"\ + ".\pulse.h"\ + ".\specrec.h"\ + ".\syntax.h"\ + + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\rvlc_scale_factors.c + +!IF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release" + +DEP_CPP_RVLC_=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\common.h"\ + ".\fixed.h"\ + ".\rvlc_scale_factors.h"\ + ".\syntax.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug" + +DEP_CPP_RVLC_=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\common.h"\ + ".\fixed.h"\ + ".\rvlc_scale_factors.h"\ + ".\syntax.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release" + +DEP_CPP_RVLC_=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\common.h"\ + ".\fixed.h"\ + ".\rvlc_scale_factors.h"\ + ".\syntax.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug" + +DEP_CPP_RVLC_=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\common.h"\ + ".\fixed.h"\ + ".\rvlc_scale_factors.h"\ + ".\syntax.h"\ + + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\specrec.c + +!IF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release" + +DEP_CPP_SPECR=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\common.h"\ + ".\data.h"\ + ".\fixed.h"\ + ".\iq_table.h"\ + ".\specrec.h"\ + ".\syntax.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug" + +DEP_CPP_SPECR=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\common.h"\ + ".\data.h"\ + ".\fixed.h"\ + ".\iq_table.h"\ + ".\specrec.h"\ + ".\syntax.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release" + +DEP_CPP_SPECR=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\common.h"\ + ".\data.h"\ + ".\fixed.h"\ + ".\iq_table.h"\ + ".\specrec.h"\ + ".\syntax.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug" + +DEP_CPP_SPECR=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\common.h"\ + ".\data.h"\ + ".\fixed.h"\ + ".\iq_table.h"\ + ".\specrec.h"\ + ".\syntax.h"\ + + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\syntax.c + +!IF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release" + +DEP_CPP_SYNTA=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\cfft.h"\ + ".\codebook\hcb.h"\ + ".\common.h"\ + ".\data.h"\ + ".\decoder.h"\ + ".\filtbank.h"\ + ".\fixed.h"\ + ".\huffman.h"\ + ".\ic_predict.h"\ + ".\mdct.h"\ + ".\pulse.h"\ + ".\rvlc_scale_factors.h"\ + ".\specrec.h"\ + ".\syntax.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug" + +DEP_CPP_SYNTA=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\cfft.h"\ + ".\codebook\hcb.h"\ + ".\common.h"\ + ".\data.h"\ + ".\decoder.h"\ + ".\filtbank.h"\ + ".\fixed.h"\ + ".\huffman.h"\ + ".\ic_predict.h"\ + ".\mdct.h"\ + ".\pulse.h"\ + ".\rvlc_scale_factors.h"\ + ".\specrec.h"\ + ".\syntax.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release" + +DEP_CPP_SYNTA=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\cfft.h"\ + ".\codebook\hcb.h"\ + ".\common.h"\ + ".\data.h"\ + ".\decoder.h"\ + ".\filtbank.h"\ + ".\fixed.h"\ + ".\huffman.h"\ + ".\ic_predict.h"\ + ".\mdct.h"\ + ".\pulse.h"\ + ".\rvlc_scale_factors.h"\ + ".\specrec.h"\ + ".\syntax.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug" + +DEP_CPP_SYNTA=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\cfft.h"\ + ".\codebook\hcb.h"\ + ".\common.h"\ + ".\data.h"\ + ".\decoder.h"\ + ".\filtbank.h"\ + ".\fixed.h"\ + ".\huffman.h"\ + ".\ic_predict.h"\ + ".\mdct.h"\ + ".\pulse.h"\ + ".\rvlc_scale_factors.h"\ + ".\specrec.h"\ + ".\syntax.h"\ + + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\tns.c + +!IF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Release" + +DEP_CPP_TNS_C=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\common.h"\ + ".\fixed.h"\ + ".\syntax.h"\ + ".\tns.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE ARM) Debug" + +DEP_CPP_TNS_C=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\common.h"\ + ".\fixed.h"\ + ".\syntax.h"\ + ".\tns.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Release" + +DEP_CPP_TNS_C=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\common.h"\ + ".\fixed.h"\ + ".\syntax.h"\ + ".\tns.h"\ + + +!ELSEIF "$(CFG)" == "libfaad2 - Win32 (WCE x86) Debug" + +DEP_CPP_TNS_C=\ + ".\analysis.h"\ + ".\bits.h"\ + ".\common.h"\ + ".\fixed.h"\ + ".\syntax.h"\ + ".\tns.h"\ + + +!ENDIF + +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\analysis.h +# End Source File +# Begin Source File + +SOURCE=.\bits.h +# End Source File +# Begin Source File + +SOURCE=.\cfft.h +# End Source File +# Begin Source File + +SOURCE=.\cfft_tab.h +# End Source File +# Begin Source File + +SOURCE=.\common.h +# End Source File +# Begin Source File + +SOURCE=.\data.h +# End Source File +# Begin Source File + +SOURCE=.\decoder.h +# End Source File +# Begin Source File + +SOURCE=.\dither.h +# End Source File +# Begin Source File + +SOURCE=.\drc.h +# End Source File +# Begin Source File + +SOURCE=.\error.h +# End Source File +# Begin Source File + +SOURCE=.\filtbank.h +# End Source File +# Begin Source File + +SOURCE=.\fixed.h +# End Source File +# Begin Source File + +SOURCE=.\codebook\hcb.h +# End Source File +# Begin Source File + +SOURCE=.\huffman.h +# End Source File +# Begin Source File + +SOURCE=.\ic_predict.h +# End Source File +# Begin Source File + +SOURCE=.\iq_table.h +# End Source File +# Begin Source File + +SOURCE=.\is.h +# End Source File +# Begin Source File + +SOURCE=.\kbd_win.h +# End Source File +# Begin Source File + +SOURCE=.\lt_predict.h +# End Source File +# Begin Source File + +SOURCE=.\mdct.h +# End Source File +# Begin Source File + +SOURCE=.\mp4.h +# End Source File +# Begin Source File + +SOURCE=.\ms.h +# End Source File +# Begin Source File + +SOURCE=.\output.h +# End Source File +# Begin Source File + +SOURCE=.\pns.h +# End Source File +# Begin Source File + +SOURCE=.\pulse.h +# End Source File +# Begin Source File + +SOURCE=.\rvlc_scale_factors.h +# End Source File +# Begin Source File + +SOURCE=.\sine_win.h +# End Source File +# Begin Source File + +SOURCE=.\specrec.h +# End Source File +# Begin Source File + +SOURCE=.\syntax.h +# End Source File +# Begin Source File + +SOURCE=.\tns.h +# End Source File +# End Group +# End Target +# End Project diff --git a/Libraries/FAAD2/Files/libfaad/libfaad2.vcw b/Libraries/FAAD2/Files/libfaad/libfaad2.vcw new file mode 100644 index 000000000..54f8aa519 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/libfaad2.vcw @@ -0,0 +1,29 @@ +Microsoft eMbedded Visual Tools Workspace File, Format Version 3.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "libfaad2"=".\libfaad2.vcp" - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/Libraries/FAAD2/Files/libfaad/libfaad2_dll.dsp b/Libraries/FAAD2/Files/libfaad/libfaad2_dll.dsp new file mode 100644 index 000000000..b9443fcbd --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/libfaad2_dll.dsp @@ -0,0 +1,355 @@ +# Microsoft Developer Studio Project File - Name="libfaad2_dll" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=libfaad2_dll - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "libfaad2_dll.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "libfaad2_dll.mak" CFG="libfaad2_dll - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "libfaad2_dll - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "libfaad2_dll - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=xicl6.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "libfaad2_dll - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "libfaad2_dll___Win32_Release" +# PROP BASE Intermediate_Dir "libfaad2_dll___Win32_Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "ReleaseDLL" +# PROP Intermediate_Dir "ReleaseDLL" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "libfaad2_dll_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "fftw" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "libfaad2_dll_EXPORTS" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x407 /d "NDEBUG" +# ADD RSC /l 0x407 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=xilink6.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 +# ADD LINK32 /nologo /dll /machine:I386 /out:"ReleaseDLL/libfaad2.dll" + +!ELSEIF "$(CFG)" == "libfaad2_dll - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "libfaad2_dll___Win32_Debug" +# PROP BASE Intermediate_Dir "libfaad2_dll___Win32_Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "DebugDLL" +# PROP Intermediate_Dir "DebugDLL" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "libfaad2_dll_EXPORTS" /YX /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "fftw" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "libfaad2_dll_EXPORTS" /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x407 /d "_DEBUG" +# ADD RSC /l 0x407 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=xilink6.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 /nologo /dll /debug /machine:I386 /out:"DebugDLL/libfaad2.dll" /pdbtype:sept + +!ENDIF + +# Begin Target + +# Name "libfaad2_dll - Win32 Release" +# Name "libfaad2_dll - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=.\bits.c +# End Source File +# Begin Source File + +SOURCE=.\cfft.c +# End Source File +# Begin Source File + +SOURCE=.\common.c +# End Source File +# Begin Source File + +SOURCE=.\decoder.c +# End Source File +# Begin Source File + +SOURCE=.\dither.c +# End Source File +# Begin Source File + +SOURCE=.\drc.c +# End Source File +# Begin Source File + +SOURCE=.\error.c +# End Source File +# Begin Source File + +SOURCE=.\filtbank.c +# End Source File +# Begin Source File + +SOURCE=.\hcr.c +# End Source File +# Begin Source File + +SOURCE=.\huffman.c +# End Source File +# Begin Source File + +SOURCE=.\ic_predict.c +# End Source File +# Begin Source File + +SOURCE=.\is.c +# End Source File +# Begin Source File + +SOURCE=.\lt_predict.c +# End Source File +# Begin Source File + +SOURCE=.\mdct.c +# End Source File +# Begin Source File + +SOURCE=.\mp4.c +# End Source File +# Begin Source File + +SOURCE=.\ms.c +# End Source File +# Begin Source File + +SOURCE=.\output.c +# End Source File +# Begin Source File + +SOURCE=.\pns.c +# End Source File +# Begin Source File + +SOURCE=.\pulse.c +# End Source File +# Begin Source File + +SOURCE=.\rvlc.c +# End Source File +# Begin Source File + +SOURCE=.\sbr_dct.c +# End Source File +# Begin Source File + +SOURCE=.\sbr_dec.c +# End Source File +# Begin Source File + +SOURCE=.\sbr_e_nf.c +# End Source File +# Begin Source File + +SOURCE=.\sbr_fbt.c +# End Source File +# Begin Source File + +SOURCE=.\sbr_hfadj.c +# End Source File +# Begin Source File + +SOURCE=.\sbr_hfgen.c +# End Source File +# Begin Source File + +SOURCE=.\sbr_huff.c +# End Source File +# Begin Source File + +SOURCE=.\sbr_qmf.c +# End Source File +# Begin Source File + +SOURCE=.\sbr_syntax.c +# End Source File +# Begin Source File + +SOURCE=.\sbr_tf_grid.c +# End Source File +# Begin Source File + +SOURCE=.\specrec.c +# End Source File +# Begin Source File + +SOURCE=.\ssr.c +# End Source File +# Begin Source File + +SOURCE=.\ssr_fb.c +# End Source File +# Begin Source File + +SOURCE=.\ssr_ipqf.c +# End Source File +# Begin Source File + +SOURCE=.\syntax.c +# End Source File +# Begin Source File + +SOURCE=.\tns.c +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=.\analysis.h +# End Source File +# Begin Source File + +SOURCE=.\bits.h +# End Source File +# Begin Source File + +SOURCE=.\cfft.h +# End Source File +# Begin Source File + +SOURCE=.\common.h +# End Source File +# Begin Source File + +SOURCE=.\data.h +# End Source File +# Begin Source File + +SOURCE=.\decoder.h +# End Source File +# Begin Source File + +SOURCE=.\dither.h +# End Source File +# Begin Source File + +SOURCE=.\drc.h +# End Source File +# Begin Source File + +SOURCE=.\error.h +# End Source File +# Begin Source File + +SOURCE=.\filtbank.h +# End Source File +# Begin Source File + +SOURCE=.\codebook\hcb.h +# End Source File +# Begin Source File + +SOURCE=.\huffman.h +# End Source File +# Begin Source File + +SOURCE=.\ic_predict.h +# End Source File +# Begin Source File + +SOURCE=.\is.h +# End Source File +# Begin Source File + +SOURCE=.\kbd_win.h +# End Source File +# Begin Source File + +SOURCE=.\lt_predict.h +# End Source File +# Begin Source File + +SOURCE=.\mdct.h +# End Source File +# Begin Source File + +SOURCE=.\mp4.h +# End Source File +# Begin Source File + +SOURCE=.\ms.h +# End Source File +# Begin Source File + +SOURCE=.\output.h +# End Source File +# Begin Source File + +SOURCE=.\pns.h +# End Source File +# Begin Source File + +SOURCE=.\pulse.h +# End Source File +# Begin Source File + +SOURCE=.\rvlc.h +# End Source File +# Begin Source File + +SOURCE=.\specrec.h +# End Source File +# Begin Source File + +SOURCE=.\ssr.h +# End Source File +# Begin Source File + +SOURCE=.\syntax.h +# End Source File +# Begin Source File + +SOURCE=.\Tns.h +# End Source File +# End Group +# Begin Source File + +SOURCE=.\libfaad2.def +# End Source File +# End Target +# End Project diff --git a/Libraries/FAAD2/Files/libfaad/libfaad2_dll.dsw b/Libraries/FAAD2/Files/libfaad/libfaad2_dll.dsw new file mode 100644 index 000000000..2242a4256 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/libfaad2_dll.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "libfaad2_dll"=.\libfaad2_dll.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/Libraries/FAAD2/Files/libfaad/libfaad2_dll.sln b/Libraries/FAAD2/Files/libfaad/libfaad2_dll.sln new file mode 100644 index 000000000..03eb769c0 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/libfaad2_dll.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 7.00 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libfaad2_dll", "libfaad2_dll.vcproj", "{482DA264-EE88-4575-B208-87C4CB80CD08}" +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Debug + ConfigName.1 = Release + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {482DA264-EE88-4575-B208-87C4CB80CD08}.Debug.ActiveCfg = Debug|Win32 + {482DA264-EE88-4575-B208-87C4CB80CD08}.Debug.Build.0 = Debug|Win32 + {482DA264-EE88-4575-B208-87C4CB80CD08}.Release.ActiveCfg = Release|Win32 + {482DA264-EE88-4575-B208-87C4CB80CD08}.Release.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Libraries/FAAD2/Files/libfaad/libfaad2_dll.vcproj b/Libraries/FAAD2/Files/libfaad/libfaad2_dll.vcproj new file mode 100644 index 000000000..22b2911e8 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/libfaad2_dll.vcproj @@ -0,0 +1,307 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Libraries/FAAD2/Files/libfaad/lt_predict.c b/Libraries/FAAD2/Files/libfaad/lt_predict.c new file mode 100644 index 000000000..ad6bc77f6 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/lt_predict.c @@ -0,0 +1,215 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + + +#include "common.h" +#include "structs.h" + +#ifdef LTP_DEC + +#include +#include "syntax.h" +#include "lt_predict.h" +#include "filtbank.h" +#include "tns.h" + + +/* static function declarations */ +static int16_t real_to_int16(real_t sig_in); + + +/* check if the object type is an object type that can have LTP */ +uint8_t is_ltp_ot(uint8_t object_type) +{ +#ifdef LTP_DEC + if ((object_type == LTP) +#ifdef ERROR_RESILIENCE + || (object_type == ER_LTP) +#endif +#ifdef LD_DEC + || (object_type == LD) +#endif +#ifdef SCALABLE_DEC + || (object_type == 6) /* TODO */ +#endif + ) + { + return 1; + } +#endif + + return 0; +} + +ALIGN static const real_t codebook[8] = +{ + REAL_CONST(0.570829), + REAL_CONST(0.696616), + REAL_CONST(0.813004), + REAL_CONST(0.911304), + REAL_CONST(0.984900), + REAL_CONST(1.067894), + REAL_CONST(1.194601), + REAL_CONST(1.369533) +}; + +void lt_prediction(ic_stream *ics, ltp_info *ltp, real_t *spec, + int16_t *lt_pred_stat, fb_info *fb, uint8_t win_shape, + uint8_t win_shape_prev, uint8_t sr_index, + uint8_t object_type, uint16_t frame_len) +{ + uint8_t sfb; + uint16_t bin, i, num_samples; + ALIGN real_t x_est[2048]; + ALIGN real_t X_est[2048]; + + if (ics->window_sequence != EIGHT_SHORT_SEQUENCE) + { + if (ltp->data_present) + { + num_samples = frame_len << 1; + + for(i = 0; i < num_samples; i++) + { + /* The extra lookback M (N/2 for LD, 0 for LTP) is handled + in the buffer updating */ + +#if 0 + x_est[i] = MUL_R_C(lt_pred_stat[num_samples + i - ltp->lag], + codebook[ltp->coef]); +#else + /* lt_pred_stat is a 16 bit int, multiplied with the fixed point real + this gives a real for x_est + */ + x_est[i] = (real_t)lt_pred_stat[num_samples + i - ltp->lag] * codebook[ltp->coef]; +#endif + } + + filter_bank_ltp(fb, ics->window_sequence, win_shape, win_shape_prev, + x_est, X_est, object_type, frame_len); + + tns_encode_frame(ics, &(ics->tns), sr_index, object_type, X_est, + frame_len); + + for (sfb = 0; sfb < ltp->last_band; sfb++) + { + if (ltp->long_used[sfb]) + { + uint16_t low = ics->swb_offset[sfb]; + uint16_t high = ics->swb_offset[sfb+1]; + + for (bin = low; bin < high; bin++) + { + spec[bin] += X_est[bin]; + } + } + } + } + } +} + +#ifdef FIXED_POINT +static INLINE int16_t real_to_int16(real_t sig_in) +{ + if (sig_in >= 0) + { + sig_in += (1 << (REAL_BITS-1)); + if (sig_in >= REAL_CONST(32768)) + return 32767; + } else { + sig_in += -(1 << (REAL_BITS-1)); + if (sig_in <= REAL_CONST(-32768)) + return -32768; + } + + return (sig_in >> REAL_BITS); +} +#else +static INLINE int16_t real_to_int16(real_t sig_in) +{ + if (sig_in >= 0) + { +#ifndef HAS_LRINTF + sig_in += 0.5f; +#endif + if (sig_in >= 32768.0f) + return 32767; + } else { +#ifndef HAS_LRINTF + sig_in += -0.5f; +#endif + if (sig_in <= -32768.0f) + return -32768; + } + + return lrintf(sig_in); +} +#endif + +void lt_update_state(int16_t *lt_pred_stat, real_t *time, real_t *overlap, + uint16_t frame_len, uint8_t object_type) +{ + uint16_t i; + + /* + * The reference point for index i and the content of the buffer + * lt_pred_stat are arranged so that lt_pred_stat(0 ... N/2 - 1) contains the + * last aliased half window from the IMDCT, and lt_pred_stat(N/2 ... N-1) + * is always all zeros. The rest of lt_pred_stat (i<0) contains the previous + * fully reconstructed time domain samples, i.e., output of the decoder. + * + * These values are shifted up by N*2 to avoid (i<0) + * + * For the LD object type an extra 512 samples lookback is accomodated here. + */ +#ifdef LD_DEC + if (object_type == LD) + { + for (i = 0; i < frame_len; i++) + { + lt_pred_stat[i] /* extra 512 */ = lt_pred_stat[i + frame_len]; + lt_pred_stat[frame_len + i] = lt_pred_stat[i + (frame_len * 2)]; + lt_pred_stat[(frame_len * 2) + i] = real_to_int16(time[i]); + lt_pred_stat[(frame_len * 3) + i] = real_to_int16(overlap[i]); + } + } else { +#endif + for (i = 0; i < frame_len; i++) + { + lt_pred_stat[i] = lt_pred_stat[i + frame_len]; + lt_pred_stat[frame_len + i] = real_to_int16(time[i]); + lt_pred_stat[(frame_len * 2) + i] = real_to_int16(overlap[i]); +#if 0 /* set to zero once upon initialisation */ + lt_pred_stat[(frame_len * 3) + i] = 0; +#endif + } +#ifdef LD_DEC + } +#endif +} + +#endif diff --git a/Libraries/FAAD2/Files/libfaad/lt_predict.h b/Libraries/FAAD2/Files/libfaad/lt_predict.h new file mode 100644 index 000000000..1c1075188 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/lt_predict.h @@ -0,0 +1,63 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#ifdef LTP_DEC + +#ifndef __LT_PREDICT_H__ +#define __LT_PREDICT_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "filtbank.h" + +uint8_t is_ltp_ot(uint8_t object_type); + +void lt_prediction(ic_stream *ics, + ltp_info *ltp, + real_t *spec, + int16_t *lt_pred_stat, + fb_info *fb, + uint8_t win_shape, + uint8_t win_shape_prev, + uint8_t sr_index, + uint8_t object_type, + uint16_t frame_len); + +void lt_update_state(int16_t *lt_pred_stat, + real_t *time, + real_t *overlap, + uint16_t frame_len, + uint8_t object_type); + +#ifdef __cplusplus +} +#endif +#endif + +#endif diff --git a/Libraries/FAAD2/Files/libfaad/mdct.c b/Libraries/FAAD2/Files/libfaad/mdct.c new file mode 100644 index 000000000..78712a0bc --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/mdct.c @@ -0,0 +1,298 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +/* + * Fast (I)MDCT Implementation using (I)FFT ((Inverse) Fast Fourier Transform) + * and consists of three steps: pre-(I)FFT complex multiplication, complex + * (I)FFT, post-(I)FFT complex multiplication, + * + * As described in: + * P. Duhamel, Y. Mahieux, and J.P. Petit, "A Fast Algorithm for the + * Implementation of Filter Banks Based on 'Time Domain Aliasing + * Cancellation’," IEEE Proc. on ICASSP‘91, 1991, pp. 2209-2212. + * + * + * As of April 6th 2002 completely rewritten. + * This (I)MDCT can now be used for any data size n, where n is divisible by 8. + * + */ + +#include "common.h" +#include "structs.h" + +#include +#ifdef _WIN32_WCE +#define assert(x) +#else +#include +#endif + +#include "cfft.h" +#include "mdct.h" +#include "mdct_tab.h" + + +mdct_info *faad_mdct_init(uint16_t N) +{ + mdct_info *mdct = (mdct_info*)faad_malloc(sizeof(mdct_info)); + + assert(N % 8 == 0); + + mdct->N = N; + + /* NOTE: For "small framelengths" in FIXED_POINT the coefficients need to be + * scaled by sqrt("(nearest power of 2) > N" / N) */ + + /* RE(mdct->sincos[k]) = scale*(real_t)(cos(2.0*M_PI*(k+1./8.) / (real_t)N)); + * IM(mdct->sincos[k]) = scale*(real_t)(sin(2.0*M_PI*(k+1./8.) / (real_t)N)); */ + /* scale is 1 for fixed point, sqrt(N) for floating point */ + switch (N) + { + case 2048: mdct->sincos = (complex_t*)mdct_tab_2048; break; + case 256: mdct->sincos = (complex_t*)mdct_tab_256; break; +#ifdef LD_DEC + case 1024: mdct->sincos = (complex_t*)mdct_tab_1024; break; +#endif +#ifdef ALLOW_SMALL_FRAMELENGTH + case 1920: mdct->sincos = (complex_t*)mdct_tab_1920; break; + case 240: mdct->sincos = (complex_t*)mdct_tab_240; break; +#ifdef LD_DEC + case 960: mdct->sincos = (complex_t*)mdct_tab_960; break; +#endif +#endif +#ifdef SSR_DEC + case 512: mdct->sincos = (complex_t*)mdct_tab_512; break; + case 64: mdct->sincos = (complex_t*)mdct_tab_64; break; +#endif + } + + /* initialise fft */ + mdct->cfft = cffti(N/4); + +#ifdef PROFILE + mdct->cycles = 0; + mdct->fft_cycles = 0; +#endif + + return mdct; +} + +void faad_mdct_end(mdct_info *mdct) +{ + if (mdct != NULL) + { +#ifdef PROFILE + printf("MDCT[%.4d]: %I64d cycles\n", mdct->N, mdct->cycles); + printf("CFFT[%.4d]: %I64d cycles\n", mdct->N/4, mdct->fft_cycles); +#endif + + cfftu(mdct->cfft); + + faad_free(mdct); + } +} + +void faad_imdct(mdct_info *mdct, real_t *X_in, real_t *X_out) +{ + uint16_t k; + + complex_t x; +#ifdef ALLOW_SMALL_FRAMELENGTH +#ifdef FIXED_POINT + real_t scale, b_scale = 0; +#endif +#endif + ALIGN complex_t Z1[512]; + complex_t *sincos = mdct->sincos; + + uint16_t N = mdct->N; + uint16_t N2 = N >> 1; + uint16_t N4 = N >> 2; + uint16_t N8 = N >> 3; + +#ifdef PROFILE + int64_t count1, count2 = faad_get_ts(); +#endif + +#ifdef ALLOW_SMALL_FRAMELENGTH +#ifdef FIXED_POINT + /* detect non-power of 2 */ + if (N & (N-1)) + { + /* adjust scale for non-power of 2 MDCT */ + /* 2048/1920 */ + b_scale = 1; + scale = COEF_CONST(1.0666666666666667); + } +#endif +#endif + + /* pre-IFFT complex multiplication */ + for (k = 0; k < N4; k++) + { + ComplexMult(&IM(Z1[k]), &RE(Z1[k]), + X_in[2*k], X_in[N2 - 1 - 2*k], RE(sincos[k]), IM(sincos[k])); + } + +#ifdef PROFILE + count1 = faad_get_ts(); +#endif + + /* complex IFFT, any non-scaling FFT can be used here */ + cfftb(mdct->cfft, Z1); + +#ifdef PROFILE + count1 = faad_get_ts() - count1; +#endif + + /* post-IFFT complex multiplication */ + for (k = 0; k < N4; k++) + { + RE(x) = RE(Z1[k]); + IM(x) = IM(Z1[k]); + ComplexMult(&IM(Z1[k]), &RE(Z1[k]), + IM(x), RE(x), RE(sincos[k]), IM(sincos[k])); + +#ifdef ALLOW_SMALL_FRAMELENGTH +#ifdef FIXED_POINT + /* non-power of 2 MDCT scaling */ + if (b_scale) + { + RE(Z1[k]) = MUL_C(RE(Z1[k]), scale); + IM(Z1[k]) = MUL_C(IM(Z1[k]), scale); + } +#endif +#endif + } + + /* reordering */ + for (k = 0; k < N8; k+=2) + { + X_out[ 2*k] = IM(Z1[N8 + k]); + X_out[ 2 + 2*k] = IM(Z1[N8 + 1 + k]); + + X_out[ 1 + 2*k] = -RE(Z1[N8 - 1 - k]); + X_out[ 3 + 2*k] = -RE(Z1[N8 - 2 - k]); + + X_out[N4 + 2*k] = RE(Z1[ k]); + X_out[N4 + + 2 + 2*k] = RE(Z1[ 1 + k]); + + X_out[N4 + 1 + 2*k] = -IM(Z1[N4 - 1 - k]); + X_out[N4 + 3 + 2*k] = -IM(Z1[N4 - 2 - k]); + + X_out[N2 + 2*k] = RE(Z1[N8 + k]); + X_out[N2 + + 2 + 2*k] = RE(Z1[N8 + 1 + k]); + + X_out[N2 + 1 + 2*k] = -IM(Z1[N8 - 1 - k]); + X_out[N2 + 3 + 2*k] = -IM(Z1[N8 - 2 - k]); + + X_out[N2 + N4 + 2*k] = -IM(Z1[ k]); + X_out[N2 + N4 + 2 + 2*k] = -IM(Z1[ 1 + k]); + + X_out[N2 + N4 + 1 + 2*k] = RE(Z1[N4 - 1 - k]); + X_out[N2 + N4 + 3 + 2*k] = RE(Z1[N4 - 2 - k]); + } + +#ifdef PROFILE + count2 = faad_get_ts() - count2; + mdct->fft_cycles += count1; + mdct->cycles += (count2 - count1); +#endif +} + +#ifdef LTP_DEC +void faad_mdct(mdct_info *mdct, real_t *X_in, real_t *X_out) +{ + uint16_t k; + + complex_t x; + ALIGN complex_t Z1[512]; + complex_t *sincos = mdct->sincos; + + uint16_t N = mdct->N; + uint16_t N2 = N >> 1; + uint16_t N4 = N >> 2; + uint16_t N8 = N >> 3; + +#ifndef FIXED_POINT + real_t scale = REAL_CONST(N); +#else + real_t scale = REAL_CONST(4.0/N); +#endif + +#ifdef ALLOW_SMALL_FRAMELENGTH +#ifdef FIXED_POINT + /* detect non-power of 2 */ + if (N & (N-1)) + { + /* adjust scale for non-power of 2 MDCT */ + /* *= sqrt(2048/1920) */ + scale = MUL_C(scale, COEF_CONST(1.0327955589886444)); + } +#endif +#endif + + /* pre-FFT complex multiplication */ + for (k = 0; k < N8; k++) + { + uint16_t n = k << 1; + RE(x) = X_in[N - N4 - 1 - n] + X_in[N - N4 + n]; + IM(x) = X_in[ N4 + n] - X_in[ N4 - 1 - n]; + + ComplexMult(&RE(Z1[k]), &IM(Z1[k]), + RE(x), IM(x), RE(sincos[k]), IM(sincos[k])); + + RE(Z1[k]) = MUL_R(RE(Z1[k]), scale); + IM(Z1[k]) = MUL_R(IM(Z1[k]), scale); + + RE(x) = X_in[N2 - 1 - n] - X_in[ n]; + IM(x) = X_in[N2 + n] + X_in[N - 1 - n]; + + ComplexMult(&RE(Z1[k + N8]), &IM(Z1[k + N8]), + RE(x), IM(x), RE(sincos[k + N8]), IM(sincos[k + N8])); + + RE(Z1[k + N8]) = MUL_R(RE(Z1[k + N8]), scale); + IM(Z1[k + N8]) = MUL_R(IM(Z1[k + N8]), scale); + } + + /* complex FFT, any non-scaling FFT can be used here */ + cfftf(mdct->cfft, Z1); + + /* post-FFT complex multiplication */ + for (k = 0; k < N4; k++) + { + uint16_t n = k << 1; + ComplexMult(&RE(x), &IM(x), + RE(Z1[k]), IM(Z1[k]), RE(sincos[k]), IM(sincos[k])); + + X_out[ n] = -RE(x); + X_out[N2 - 1 - n] = IM(x); + X_out[N2 + n] = -IM(x); + X_out[N - 1 - n] = RE(x); + } +} +#endif diff --git a/Libraries/FAAD2/Files/libfaad/mdct.h b/Libraries/FAAD2/Files/libfaad/mdct.h new file mode 100644 index 000000000..308be816f --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/mdct.h @@ -0,0 +1,45 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#ifndef __MDCT_H__ +#define __MDCT_H__ + +#ifdef __cplusplus +extern "C" { +#endif + + +mdct_info *faad_mdct_init(uint16_t N); +void faad_mdct_end(mdct_info *mdct); +void faad_imdct(mdct_info *mdct, real_t *X_in, real_t *X_out); +void faad_mdct(mdct_info *mdct, real_t *X_in, real_t *X_out); + + +#ifdef __cplusplus +} +#endif +#endif diff --git a/Libraries/FAAD2/Files/libfaad/mdct_tab.h b/Libraries/FAAD2/Files/libfaad/mdct_tab.h new file mode 100644 index 000000000..ce48535f6 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/mdct_tab.h @@ -0,0 +1,3652 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#ifndef __MDCT_TAB_H__ +#define __MDCT_TAB_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef FIXED_POINT + +/* 256 (N/4) complex twiddle factors */ +ALIGN static const complex_t mdct_tab_2048[] = +{ + { FRAC_CONST(0.999999926465718), FRAC_CONST(0.000383495187571) }, + { FRAC_CONST(0.999994043728986), FRAC_CONST(0.003451449920136) }, + { FRAC_CONST(0.999978748667469), FRAC_CONST(0.006519372166339) }, + { FRAC_CONST(0.999954041425130), FRAC_CONST(0.009587233049729) }, + { FRAC_CONST(0.999919922234523), FRAC_CONST(0.012655003694430) }, + { FRAC_CONST(0.999876391416790), FRAC_CONST(0.015722655225417) }, + { FRAC_CONST(0.999823449381662), FRAC_CONST(0.018790158768785) }, + { FRAC_CONST(0.999761096627447), FRAC_CONST(0.021857485452022) }, + { FRAC_CONST(0.999689333741034), FRAC_CONST(0.024924606404281) }, + { FRAC_CONST(0.999608161397882), FRAC_CONST(0.027991492756653) }, + { FRAC_CONST(0.999517580362017), FRAC_CONST(0.031058115642435) }, + { FRAC_CONST(0.999417591486022), FRAC_CONST(0.034124446197403) }, + { FRAC_CONST(0.999308195711029), FRAC_CONST(0.037190455560088) }, + { FRAC_CONST(0.999189394066715), FRAC_CONST(0.040256114872041) }, + { FRAC_CONST(0.999061187671285), FRAC_CONST(0.043321395278110) }, + { FRAC_CONST(0.998923577731466), FRAC_CONST(0.046386267926707) }, + { FRAC_CONST(0.998776565542496), FRAC_CONST(0.049450703970085) }, + { FRAC_CONST(0.998620152488109), FRAC_CONST(0.052514674564603) }, + { FRAC_CONST(0.998454340040525), FRAC_CONST(0.055578150871005) }, + { FRAC_CONST(0.998279129760433), FRAC_CONST(0.058641104054683) }, + { FRAC_CONST(0.998094523296980), FRAC_CONST(0.061703505285957) }, + { FRAC_CONST(0.997900522387752), FRAC_CONST(0.064765325740340) }, + { FRAC_CONST(0.997697128858759), FRAC_CONST(0.067826536598811) }, + { FRAC_CONST(0.997484344624418), FRAC_CONST(0.070887109048088) }, + { FRAC_CONST(0.997262171687536), FRAC_CONST(0.073947014280897) }, + { FRAC_CONST(0.997030612139289), FRAC_CONST(0.077006223496246) }, + { FRAC_CONST(0.996789668159205), FRAC_CONST(0.080064707899691) }, + { FRAC_CONST(0.996539342015138), FRAC_CONST(0.083122438703613) }, + { FRAC_CONST(0.996279636063255), FRAC_CONST(0.086179387127485) }, + { FRAC_CONST(0.996010552748006), FRAC_CONST(0.089235524398144) }, + { FRAC_CONST(0.995732094602106), FRAC_CONST(0.092290821750062) }, + { FRAC_CONST(0.995444264246510), FRAC_CONST(0.095345250425618) }, + { FRAC_CONST(0.995147064390386), FRAC_CONST(0.098398781675364) }, + { FRAC_CONST(0.994840497831093), FRAC_CONST(0.101451386758302) }, + { FRAC_CONST(0.994524567454152), FRAC_CONST(0.104503036942151) }, + { FRAC_CONST(0.994199276233219), FRAC_CONST(0.107553703503616) }, + { FRAC_CONST(0.993864627230060), FRAC_CONST(0.110603357728662) }, + { FRAC_CONST(0.993520623594518), FRAC_CONST(0.113651970912782) }, + { FRAC_CONST(0.993167268564487), FRAC_CONST(0.116699514361268) }, + { FRAC_CONST(0.992804565465879), FRAC_CONST(0.119745959389480) }, + { FRAC_CONST(0.992432517712594), FRAC_CONST(0.122791277323117) }, + { FRAC_CONST(0.992051128806486), FRAC_CONST(0.125835439498487) }, + { FRAC_CONST(0.991660402337333), FRAC_CONST(0.128878417262777) }, + { FRAC_CONST(0.991260341982802), FRAC_CONST(0.131920181974320) }, + { FRAC_CONST(0.990850951508414), FRAC_CONST(0.134960705002869) }, + { FRAC_CONST(0.990432234767506), FRAC_CONST(0.137999957729863) }, + { FRAC_CONST(0.990004195701201), FRAC_CONST(0.141037911548698) }, + { FRAC_CONST(0.989566838338365), FRAC_CONST(0.144074537864995) }, + { FRAC_CONST(0.989120166795573), FRAC_CONST(0.147109808096872) }, + { FRAC_CONST(0.988664185277066), FRAC_CONST(0.150143693675208) }, + { FRAC_CONST(0.988198898074718), FRAC_CONST(0.153176166043918) }, + { FRAC_CONST(0.987724309567987), FRAC_CONST(0.156207196660216) }, + { FRAC_CONST(0.987240424223882), FRAC_CONST(0.159236756994888) }, + { FRAC_CONST(0.986747246596917), FRAC_CONST(0.162264818532558) }, + { FRAC_CONST(0.986244781329065), FRAC_CONST(0.165291352771958) }, + { FRAC_CONST(0.985733033149723), FRAC_CONST(0.168316331226195) }, + { FRAC_CONST(0.985212006875659), FRAC_CONST(0.171339725423019) }, + { FRAC_CONST(0.984681707410971), FRAC_CONST(0.174361506905094) }, + { FRAC_CONST(0.984142139747039), FRAC_CONST(0.177381647230260) }, + { FRAC_CONST(0.983593308962479), FRAC_CONST(0.180400117971807) }, + { FRAC_CONST(0.983035220223096), FRAC_CONST(0.183416890718739) }, + { FRAC_CONST(0.982467878781833), FRAC_CONST(0.186431937076042) }, + { FRAC_CONST(0.981891289978725), FRAC_CONST(0.189445228664950) }, + { FRAC_CONST(0.981305459240845), FRAC_CONST(0.192456737123217) }, + { FRAC_CONST(0.980710392082254), FRAC_CONST(0.195466434105377) }, + { FRAC_CONST(0.980106094103952), FRAC_CONST(0.198474291283016) }, + { FRAC_CONST(0.979492570993821), FRAC_CONST(0.201480280345038) }, + { FRAC_CONST(0.978869828526574), FRAC_CONST(0.204484372997927) }, + { FRAC_CONST(0.978237872563701), FRAC_CONST(0.207486540966021) }, + { FRAC_CONST(0.977596709053412), FRAC_CONST(0.210486755991770) }, + { FRAC_CONST(0.976946344030582), FRAC_CONST(0.213484989836008) }, + { FRAC_CONST(0.976286783616694), FRAC_CONST(0.216481214278217) }, + { FRAC_CONST(0.975618034019782), FRAC_CONST(0.219475401116790) }, + { FRAC_CONST(0.974940101534372), FRAC_CONST(0.222467522169302) }, + { FRAC_CONST(0.974252992541423), FRAC_CONST(0.225457549272769) }, + { FRAC_CONST(0.973556713508266), FRAC_CONST(0.228445454283916) }, + { FRAC_CONST(0.972851270988544), FRAC_CONST(0.231431209079446) }, + { FRAC_CONST(0.972136671622152), FRAC_CONST(0.234414785556295) }, + { FRAC_CONST(0.971412922135171), FRAC_CONST(0.237396155631907) }, + { FRAC_CONST(0.970680029339806), FRAC_CONST(0.240375291244489) }, + { FRAC_CONST(0.969938000134324), FRAC_CONST(0.243352164353285) }, + { FRAC_CONST(0.969186841502986), FRAC_CONST(0.246326746938829) }, + { FRAC_CONST(0.968426560515983), FRAC_CONST(0.249299011003218) }, + { FRAC_CONST(0.967657164329370), FRAC_CONST(0.252268928570371) }, + { FRAC_CONST(0.966878660184996), FRAC_CONST(0.255236471686292) }, + { FRAC_CONST(0.966091055410439), FRAC_CONST(0.258201612419335) }, + { FRAC_CONST(0.965294357418935), FRAC_CONST(0.261164322860466) }, + { FRAC_CONST(0.964488573709308), FRAC_CONST(0.264124575123528) }, + { FRAC_CONST(0.963673711865903), FRAC_CONST(0.267082341345496) }, + { FRAC_CONST(0.962849779558509), FRAC_CONST(0.270037593686751) }, + { FRAC_CONST(0.962016784542291), FRAC_CONST(0.272990304331330) }, + { FRAC_CONST(0.961174734657714), FRAC_CONST(0.275940445487197) }, + { FRAC_CONST(0.960323637830474), FRAC_CONST(0.278887989386500) }, + { FRAC_CONST(0.959463502071418), FRAC_CONST(0.281832908285833) }, + { FRAC_CONST(0.958594335476470), FRAC_CONST(0.284775174466498) }, + { FRAC_CONST(0.957716146226559), FRAC_CONST(0.287714760234765) }, + { FRAC_CONST(0.956828942587535), FRAC_CONST(0.290651637922133) }, + { FRAC_CONST(0.955932732910098), FRAC_CONST(0.293585779885591) }, + { FRAC_CONST(0.955027525629714), FRAC_CONST(0.296517158507877) }, + { FRAC_CONST(0.954113329266539), FRAC_CONST(0.299445746197740) }, + { FRAC_CONST(0.953190152425337), FRAC_CONST(0.302371515390196) }, + { FRAC_CONST(0.952258003795400), FRAC_CONST(0.305294438546792) }, + { FRAC_CONST(0.951316892150466), FRAC_CONST(0.308214488155861) }, + { FRAC_CONST(0.950366826348636), FRAC_CONST(0.311131636732785) }, + { FRAC_CONST(0.949407815332292), FRAC_CONST(0.314045856820251) }, + { FRAC_CONST(0.948439868128010), FRAC_CONST(0.316957120988508) }, + { FRAC_CONST(0.947462993846478), FRAC_CONST(0.319865401835631) }, + { FRAC_CONST(0.946477201682409), FRAC_CONST(0.322770671987771) }, + { FRAC_CONST(0.945482500914454), FRAC_CONST(0.325672904099420) }, + { FRAC_CONST(0.944478900905116), FRAC_CONST(0.328572070853664) }, + { FRAC_CONST(0.943466411100659), FRAC_CONST(0.331468144962441) }, + { FRAC_CONST(0.942445041031025), FRAC_CONST(0.334361099166799) }, + { FRAC_CONST(0.941414800309736), FRAC_CONST(0.337250906237151) }, + { FRAC_CONST(0.940375698633812), FRAC_CONST(0.340137538973532) }, + { FRAC_CONST(0.939327745783671), FRAC_CONST(0.343020970205856) }, + { FRAC_CONST(0.938270951623047), FRAC_CONST(0.345901172794169) }, + { FRAC_CONST(0.937205326098888), FRAC_CONST(0.348778119628908) }, + { FRAC_CONST(0.936130879241267), FRAC_CONST(0.351651783631155) }, + { FRAC_CONST(0.935047621163287), FRAC_CONST(0.354522137752887) }, + { FRAC_CONST(0.933955562060987), FRAC_CONST(0.357389154977241) }, + { FRAC_CONST(0.932854712213241), FRAC_CONST(0.360252808318757) }, + { FRAC_CONST(0.931745081981669), FRAC_CONST(0.363113070823639) }, + { FRAC_CONST(0.930626681810532), FRAC_CONST(0.365969915570009) }, + { FRAC_CONST(0.929499522226639), FRAC_CONST(0.368823315668154) }, + { FRAC_CONST(0.928363613839244), FRAC_CONST(0.371673244260787) }, + { FRAC_CONST(0.927218967339952), FRAC_CONST(0.374519674523293) }, + { FRAC_CONST(0.926065593502609), FRAC_CONST(0.377362579663988) }, + { FRAC_CONST(0.924903503183211), FRAC_CONST(0.380201932924366) }, + { FRAC_CONST(0.923732707319793), FRAC_CONST(0.383037707579352) }, + { FRAC_CONST(0.922553216932333), FRAC_CONST(0.385869876937555) }, + { FRAC_CONST(0.921365043122642), FRAC_CONST(0.388698414341519) }, + { FRAC_CONST(0.920168197074266), FRAC_CONST(0.391523293167972) }, + { FRAC_CONST(0.918962690052376), FRAC_CONST(0.394344486828080) }, + { FRAC_CONST(0.917748533403661), FRAC_CONST(0.397161968767692) }, + { FRAC_CONST(0.916525738556228), FRAC_CONST(0.399975712467595) }, + { FRAC_CONST(0.915294317019487), FRAC_CONST(0.402785691443764) }, + { FRAC_CONST(0.914054280384047), FRAC_CONST(0.405591879247604) }, + { FRAC_CONST(0.912805640321604), FRAC_CONST(0.408394249466208) }, + { FRAC_CONST(0.911548408584834), FRAC_CONST(0.411192775722600) }, + { FRAC_CONST(0.910282597007282), FRAC_CONST(0.413987431675985) }, + { FRAC_CONST(0.909008217503247), FRAC_CONST(0.416778191021998) }, + { FRAC_CONST(0.907725282067676), FRAC_CONST(0.419565027492947) }, + { FRAC_CONST(0.906433802776045), FRAC_CONST(0.422347914858067) }, + { FRAC_CONST(0.905133791784250), FRAC_CONST(0.425126826923762) }, + { FRAC_CONST(0.903825261328488), FRAC_CONST(0.427901737533854) }, + { FRAC_CONST(0.902508223725146), FRAC_CONST(0.430672620569827) }, + { FRAC_CONST(0.901182691370685), FRAC_CONST(0.433439449951074) }, + { FRAC_CONST(0.899848676741519), FRAC_CONST(0.436202199635144) }, + { FRAC_CONST(0.898506192393902), FRAC_CONST(0.438960843617984) }, + { FRAC_CONST(0.897155250963809), FRAC_CONST(0.441715355934187) }, + { FRAC_CONST(0.895795865166814), FRAC_CONST(0.444465710657234) }, + { FRAC_CONST(0.894428047797974), FRAC_CONST(0.447211881899738) }, + { FRAC_CONST(0.893051811731707), FRAC_CONST(0.449953843813691) }, + { FRAC_CONST(0.891667169921672), FRAC_CONST(0.452691570590701) }, + { FRAC_CONST(0.890274135400645), FRAC_CONST(0.455425036462242) }, + { FRAC_CONST(0.888872721280396), FRAC_CONST(0.458154215699893) }, + { FRAC_CONST(0.887462940751569), FRAC_CONST(0.460879082615579) }, + { FRAC_CONST(0.886044807083556), FRAC_CONST(0.463599611561814) }, + { FRAC_CONST(0.884618333624370), FRAC_CONST(0.466315776931944) }, + { FRAC_CONST(0.883183533800523), FRAC_CONST(0.469027553160387) }, + { FRAC_CONST(0.881740421116898), FRAC_CONST(0.471734914722871) }, + { FRAC_CONST(0.880289009156621), FRAC_CONST(0.474437836136679) }, + { FRAC_CONST(0.878829311580933), FRAC_CONST(0.477136291960885) }, + { FRAC_CONST(0.877361342129065), FRAC_CONST(0.479830256796594) }, + { FRAC_CONST(0.875885114618104), FRAC_CONST(0.482519705287184) }, + { FRAC_CONST(0.874400642942865), FRAC_CONST(0.485204612118542) }, + { FRAC_CONST(0.872907941075761), FRAC_CONST(0.487884952019301) }, + { FRAC_CONST(0.871407023066671), FRAC_CONST(0.490560699761082) }, + { FRAC_CONST(0.869897903042806), FRAC_CONST(0.493231830158728) }, + { FRAC_CONST(0.868380595208580), FRAC_CONST(0.495898318070542) }, + { FRAC_CONST(0.866855113845470), FRAC_CONST(0.498560138398525) }, + { FRAC_CONST(0.865321473311890), FRAC_CONST(0.501217266088610) }, + { FRAC_CONST(0.863779688043047), FRAC_CONST(0.503869676130899) }, + { FRAC_CONST(0.862229772550811), FRAC_CONST(0.506517343559899) }, + { FRAC_CONST(0.860671741423578), FRAC_CONST(0.509160243454755) }, + { FRAC_CONST(0.859105609326130), FRAC_CONST(0.511798350939487) }, + { FRAC_CONST(0.857531390999499), FRAC_CONST(0.514431641183223) }, + { FRAC_CONST(0.855949101260827), FRAC_CONST(0.517060089400432) }, + { FRAC_CONST(0.854358755003227), FRAC_CONST(0.519683670851158) }, + { FRAC_CONST(0.852760367195645), FRAC_CONST(0.522302360841255) }, + { FRAC_CONST(0.851153952882715), FRAC_CONST(0.524916134722613) }, + { FRAC_CONST(0.849539527184621), FRAC_CONST(0.527524967893398) }, + { FRAC_CONST(0.847917105296951), FRAC_CONST(0.530128835798279) }, + { FRAC_CONST(0.846286702490560), FRAC_CONST(0.532727713928659) }, + { FRAC_CONST(0.844648334111418), FRAC_CONST(0.535321577822907) }, + { FRAC_CONST(0.843002015580473), FRAC_CONST(0.537910403066589) }, + { FRAC_CONST(0.841347762393502), FRAC_CONST(0.540494165292695) }, + { FRAC_CONST(0.839685590120966), FRAC_CONST(0.543072840181872) }, + { FRAC_CONST(0.838015514407864), FRAC_CONST(0.545646403462649) }, + { FRAC_CONST(0.836337550973584), FRAC_CONST(0.548214830911668) }, + { FRAC_CONST(0.834651715611756), FRAC_CONST(0.550778098353912) }, + { FRAC_CONST(0.832958024190107), FRAC_CONST(0.553336181662932) }, + { FRAC_CONST(0.831256492650303), FRAC_CONST(0.555889056761074) }, + { FRAC_CONST(0.829547137007809), FRAC_CONST(0.558436699619704) }, + { FRAC_CONST(0.827829973351730), FRAC_CONST(0.560979086259438) }, + { FRAC_CONST(0.826105017844665), FRAC_CONST(0.563516192750365) }, + { FRAC_CONST(0.824372286722551), FRAC_CONST(0.566047995212271) }, + { FRAC_CONST(0.822631796294515), FRAC_CONST(0.568574469814869) }, + { FRAC_CONST(0.820883562942715), FRAC_CONST(0.571095592778017) }, + { FRAC_CONST(0.819127603122188), FRAC_CONST(0.573611340371945) }, + { FRAC_CONST(0.817363933360698), FRAC_CONST(0.576121688917478) }, + { FRAC_CONST(0.815592570258577), FRAC_CONST(0.578626614786261) }, + { FRAC_CONST(0.813813530488567), FRAC_CONST(0.581126094400978) }, + { FRAC_CONST(0.812026830795670), FRAC_CONST(0.583620104235573) }, + { FRAC_CONST(0.810232487996982), FRAC_CONST(0.586108620815476) }, + { FRAC_CONST(0.808430518981543), FRAC_CONST(0.588591620717823) }, + { FRAC_CONST(0.806620940710170), FRAC_CONST(0.591069080571671) }, + { FRAC_CONST(0.804803770215303), FRAC_CONST(0.593540977058226) }, + { FRAC_CONST(0.802979024600843), FRAC_CONST(0.596007286911057) }, + { FRAC_CONST(0.801146721041991), FRAC_CONST(0.598467986916314) }, + { FRAC_CONST(0.799306876785086), FRAC_CONST(0.600923053912954) }, + { FRAC_CONST(0.797459509147442), FRAC_CONST(0.603372464792950) }, + { FRAC_CONST(0.795604635517188), FRAC_CONST(0.605816196501515) }, + { FRAC_CONST(0.793742273353100), FRAC_CONST(0.608254226037314) }, + { FRAC_CONST(0.791872440184440), FRAC_CONST(0.610686530452686) }, + { FRAC_CONST(0.789995153610791), FRAC_CONST(0.613113086853855) }, + { FRAC_CONST(0.788110431301888), FRAC_CONST(0.615533872401147) }, + { FRAC_CONST(0.786218290997456), FRAC_CONST(0.617948864309208) }, + { FRAC_CONST(0.784318750507039), FRAC_CONST(0.620358039847214) }, + { FRAC_CONST(0.782411827709837), FRAC_CONST(0.622761376339086) }, + { FRAC_CONST(0.780497540554532), FRAC_CONST(0.625158851163708) }, + { FRAC_CONST(0.778575907059125), FRAC_CONST(0.627550441755132) }, + { FRAC_CONST(0.776646945310762), FRAC_CONST(0.629936125602796) }, + { FRAC_CONST(0.774710673465566), FRAC_CONST(0.632315880251738) }, + { FRAC_CONST(0.772767109748464), FRAC_CONST(0.634689683302798) }, + { FRAC_CONST(0.770816272453019), FRAC_CONST(0.637057512412839) }, + { FRAC_CONST(0.768858179941253), FRAC_CONST(0.639419345294951) }, + { FRAC_CONST(0.766892850643481), FRAC_CONST(0.641775159718664) }, + { FRAC_CONST(0.764920303058128), FRAC_CONST(0.644124933510155) }, + { FRAC_CONST(0.762940555751566), FRAC_CONST(0.646468644552458) }, + { FRAC_CONST(0.760953627357928), FRAC_CONST(0.648806270785673) }, + { FRAC_CONST(0.758959536578942), FRAC_CONST(0.651137790207170) }, + { FRAC_CONST(0.756958302183750), FRAC_CONST(0.653463180871802) }, + { FRAC_CONST(0.754949943008733), FRAC_CONST(0.655782420892106) }, + { FRAC_CONST(0.752934477957330), FRAC_CONST(0.658095488438511) }, + { FRAC_CONST(0.750911925999868), FRAC_CONST(0.660402361739545) }, + { FRAC_CONST(0.748882306173375), FRAC_CONST(0.662703019082037) }, + { FRAC_CONST(0.746845637581407), FRAC_CONST(0.664997438811325) }, + { FRAC_CONST(0.744801939393863), FRAC_CONST(0.667285599331456) }, + { FRAC_CONST(0.742751230846809), FRAC_CONST(0.669567479105392) }, + { FRAC_CONST(0.740693531242296), FRAC_CONST(0.671843056655212) }, + { FRAC_CONST(0.738628859948175), FRAC_CONST(0.674112310562312) }, + { FRAC_CONST(0.736557236397919), FRAC_CONST(0.676375219467612) }, + { FRAC_CONST(0.734478680090438), FRAC_CONST(0.678631762071749) }, + { FRAC_CONST(0.732393210589896), FRAC_CONST(0.680881917135287) }, + { FRAC_CONST(0.730300847525525), FRAC_CONST(0.683125663478909) }, + { FRAC_CONST(0.728201610591445), FRAC_CONST(0.685362979983619) }, + { FRAC_CONST(0.726095519546471), FRAC_CONST(0.687593845590942) }, + { FRAC_CONST(0.723982594213936), FRAC_CONST(0.689818239303122) }, + { FRAC_CONST(0.721862854481496), FRAC_CONST(0.692036140183319) }, + { FRAC_CONST(0.719736320300951), FRAC_CONST(0.694247527355803) }, + { FRAC_CONST(0.717603011688049), FRAC_CONST(0.696452380006158) }, + { FRAC_CONST(0.715462948722304), FRAC_CONST(0.698650677381469) }, + { FRAC_CONST(0.713316151546803), FRAC_CONST(0.700842398790526) }, + { FRAC_CONST(0.711162640368018), FRAC_CONST(0.703027523604011) }, + { FRAC_CONST(0.709002435455618), FRAC_CONST(0.705206031254698) }, + { FRAC_CONST(0.706835557142274), FRAC_CONST(0.707377901237642) }, + { FRAC_CONST(0.704662025823469), FRAC_CONST(0.709543113110377) }, + { FRAC_CONST(0.702481861957308), FRAC_CONST(0.711701646493103) }, + { FRAC_CONST(0.700295086064324), FRAC_CONST(0.713853481068882) }, + { FRAC_CONST(0.698101718727284), FRAC_CONST(0.715998596583829) }, + { FRAC_CONST(0.695901780590997), FRAC_CONST(0.718136972847297) }, + { FRAC_CONST(0.693695292362118), FRAC_CONST(0.720268589732077) }, + { FRAC_CONST(0.691482274808956), FRAC_CONST(0.722393427174578) }, + { FRAC_CONST(0.689262748761273), FRAC_CONST(0.724511465175020) }, + { FRAC_CONST(0.687036735110096), FRAC_CONST(0.726622683797623) }, + { FRAC_CONST(0.684804254807511), FRAC_CONST(0.728727063170794) }, + { FRAC_CONST(0.682565328866473), FRAC_CONST(0.730824583487312) }, + { FRAC_CONST(0.680319978360607), FRAC_CONST(0.732915225004518) }, + { FRAC_CONST(0.678068224424007), FRAC_CONST(0.734998968044497) }, + { FRAC_CONST(0.675810088251037), FRAC_CONST(0.737075792994266) }, + { FRAC_CONST(0.673545591096136), FRAC_CONST(0.739145680305957) }, + { FRAC_CONST(0.671274754273613), FRAC_CONST(0.741208610497004) }, + { FRAC_CONST(0.668997599157450), FRAC_CONST(0.743264564150321) }, + { FRAC_CONST(0.666714147181098), FRAC_CONST(0.745313521914490) }, + { FRAC_CONST(0.664424419837275), FRAC_CONST(0.747355464503940) }, + { FRAC_CONST(0.662128438677769), FRAC_CONST(0.749390372699130) }, + { FRAC_CONST(0.659826225313227), FRAC_CONST(0.751418227346727) }, + { FRAC_CONST(0.657517801412960), FRAC_CONST(0.753439009359794) }, + { FRAC_CONST(0.655203188704732), FRAC_CONST(0.755452699717958) }, + { FRAC_CONST(0.652882408974559), FRAC_CONST(0.757459279467601) }, + { FRAC_CONST(0.650555484066504), FRAC_CONST(0.759458729722028) }, + { FRAC_CONST(0.648222435882470), FRAC_CONST(0.761451031661654) }, + { FRAC_CONST(0.645883286381996), FRAC_CONST(0.763436166534172) }, + { FRAC_CONST(0.643538057582048), FRAC_CONST(0.765414115654738) }, + { FRAC_CONST(0.641186771556811), FRAC_CONST(0.767384860406142) }, + { FRAC_CONST(0.638829450437486), FRAC_CONST(0.769348382238982) }, + { FRAC_CONST(0.636466116412077), FRAC_CONST(0.771304662671845) }, + { FRAC_CONST(0.634096791725184), FRAC_CONST(0.773253683291473) }, + { FRAC_CONST(0.631721498677792), FRAC_CONST(0.775195425752941) }, + { FRAC_CONST(0.629340259627066), FRAC_CONST(0.777129871779832) }, + { FRAC_CONST(0.626953096986133), FRAC_CONST(0.779057003164401) }, + { FRAC_CONST(0.624560033223877), FRAC_CONST(0.780976801767754) }, + { FRAC_CONST(0.622161090864727), FRAC_CONST(0.782889249520015) }, + { FRAC_CONST(0.619756292488441), FRAC_CONST(0.784794328420499) }, + { FRAC_CONST(0.617345660729897), FRAC_CONST(0.786692020537877) }, + { FRAC_CONST(0.614929218278880), FRAC_CONST(0.788582308010347) }, + { FRAC_CONST(0.612506987879866), FRAC_CONST(0.790465173045805) }, + { FRAC_CONST(0.610078992331810), FRAC_CONST(0.792340597922007) }, + { FRAC_CONST(0.607645254487931), FRAC_CONST(0.794208564986741) }, + { FRAC_CONST(0.605205797255497), FRAC_CONST(0.796069056657988) }, + { FRAC_CONST(0.602760643595607), FRAC_CONST(0.797922055424093) }, + { FRAC_CONST(0.600309816522980), FRAC_CONST(0.799767543843926) }, + { FRAC_CONST(0.597853339105734), FRAC_CONST(0.801605504547046) }, + { FRAC_CONST(0.595391234465169), FRAC_CONST(0.803435920233868) }, + { FRAC_CONST(0.592923525775551), FRAC_CONST(0.805258773675822) }, + { FRAC_CONST(0.590450236263896), FRAC_CONST(0.807074047715518) }, + { FRAC_CONST(0.587971389209745), FRAC_CONST(0.808881725266904) }, + { FRAC_CONST(0.585487007944951), FRAC_CONST(0.810681789315431) }, + { FRAC_CONST(0.582997115853458), FRAC_CONST(0.812474222918210) }, + { FRAC_CONST(0.580501736371077), FRAC_CONST(0.814259009204175) }, + { FRAC_CONST(0.578000892985270), FRAC_CONST(0.816036131374237) }, + { FRAC_CONST(0.575494609234928), FRAC_CONST(0.817805572701444) }, + { FRAC_CONST(0.572982908710149), FRAC_CONST(0.819567316531142) }, + { FRAC_CONST(0.570465815052013), FRAC_CONST(0.821321346281127) }, + { FRAC_CONST(0.567943351952366), FRAC_CONST(0.823067645441802) }, + { FRAC_CONST(0.565415543153590), FRAC_CONST(0.824806197576334) }, + { FRAC_CONST(0.562882412448385), FRAC_CONST(0.826536986320810) }, + { FRAC_CONST(0.560343983679541), FRAC_CONST(0.828259995384386) }, + { FRAC_CONST(0.557800280739717), FRAC_CONST(0.829975208549444) }, + { FRAC_CONST(0.555251327571214), FRAC_CONST(0.831682609671745) }, + { FRAC_CONST(0.552697148165750), FRAC_CONST(0.833382182680580) }, + { FRAC_CONST(0.550137766564234), FRAC_CONST(0.835073911578919) }, + { FRAC_CONST(0.547573206856540), FRAC_CONST(0.836757780443567) }, + { FRAC_CONST(0.545003493181281), FRAC_CONST(0.838433773425308) }, + { FRAC_CONST(0.542428649725581), FRAC_CONST(0.840101874749058) }, + { FRAC_CONST(0.539848700724848), FRAC_CONST(0.841762068714012) }, + { FRAC_CONST(0.537263670462543), FRAC_CONST(0.843414339693793) }, + { FRAC_CONST(0.534673583269956), FRAC_CONST(0.845058672136595) }, + { FRAC_CONST(0.532078463525974), FRAC_CONST(0.846695050565337) }, + { FRAC_CONST(0.529478335656852), FRAC_CONST(0.848323459577802) }, + { FRAC_CONST(0.526873224135985), FRAC_CONST(0.849943883846782) }, + { FRAC_CONST(0.524263153483673), FRAC_CONST(0.851556308120229) }, + { FRAC_CONST(0.521648148266897), FRAC_CONST(0.853160717221390) }, + { FRAC_CONST(0.519028233099081), FRAC_CONST(0.854757096048957) }, + { FRAC_CONST(0.516403432639864), FRAC_CONST(0.856345429577204) }, + { FRAC_CONST(0.513773771594868), FRAC_CONST(0.857925702856130) }, + { FRAC_CONST(0.511139274715464), FRAC_CONST(0.859497901011602) }, + { FRAC_CONST(0.508499966798541), FRAC_CONST(0.861062009245491) }, + { FRAC_CONST(0.505855872686269), FRAC_CONST(0.862618012835817) }, + { FRAC_CONST(0.503207017265869), FRAC_CONST(0.864165897136879) }, + { FRAC_CONST(0.500553425469378), FRAC_CONST(0.865705647579402) }, + { FRAC_CONST(0.497895122273411), FRAC_CONST(0.867237249670668) }, + { FRAC_CONST(0.495232132698931), FRAC_CONST(0.868760688994655) }, + { FRAC_CONST(0.492564481811011), FRAC_CONST(0.870275951212172) }, + { FRAC_CONST(0.489892194718595), FRAC_CONST(0.871783022060993) }, + { FRAC_CONST(0.487215296574269), FRAC_CONST(0.873281887355994) }, + { FRAC_CONST(0.484533812574016), FRAC_CONST(0.874772532989284) }, + { FRAC_CONST(0.481847767956986), FRAC_CONST(0.876254944930338) }, + { FRAC_CONST(0.479157188005253), FRAC_CONST(0.877729109226132) }, + { FRAC_CONST(0.476462098043581), FRAC_CONST(0.879195012001267) }, + { FRAC_CONST(0.473762523439183), FRAC_CONST(0.880652639458111) }, + { FRAC_CONST(0.471058489601483), FRAC_CONST(0.882101977876918) }, + { FRAC_CONST(0.468350021981877), FRAC_CONST(0.883543013615962) }, + { FRAC_CONST(0.465637146073494), FRAC_CONST(0.884975733111667) }, + { FRAC_CONST(0.462919887410955), FRAC_CONST(0.886400122878730) }, + { FRAC_CONST(0.460198271570134), FRAC_CONST(0.887816169510255) }, + { FRAC_CONST(0.457472324167916), FRAC_CONST(0.889223859677868) }, + { FRAC_CONST(0.454742070861955), FRAC_CONST(0.890623180131856) }, + { FRAC_CONST(0.452007537350437), FRAC_CONST(0.892014117701280) }, + { FRAC_CONST(0.449268749371830), FRAC_CONST(0.893396659294108) }, + { FRAC_CONST(0.446525732704651), FRAC_CONST(0.894770791897330) }, + { FRAC_CONST(0.443778513167218), FRAC_CONST(0.896136502577087) }, + { FRAC_CONST(0.441027116617407), FRAC_CONST(0.897493778478790) }, + { FRAC_CONST(0.438271568952410), FRAC_CONST(0.898842606827242) }, + { FRAC_CONST(0.435511896108492), FRAC_CONST(0.900182974926757) }, + { FRAC_CONST(0.432748124060744), FRAC_CONST(0.901514870161279) }, + { FRAC_CONST(0.429980278822841), FRAC_CONST(0.902838279994503) }, + { FRAC_CONST(0.427208386446796), FRAC_CONST(0.904153191969992) }, + { FRAC_CONST(0.424432473022717), FRAC_CONST(0.905459593711293) }, + { FRAC_CONST(0.421652564678558), FRAC_CONST(0.906757472922057) }, + { FRAC_CONST(0.418868687579875), FRAC_CONST(0.908046817386148) }, + { FRAC_CONST(0.416080867929579), FRAC_CONST(0.909327614967767) }, + { FRAC_CONST(0.413289131967691), FRAC_CONST(0.910599853611559) }, + { FRAC_CONST(0.410493505971093), FRAC_CONST(0.911863521342729) }, + { FRAC_CONST(0.407694016253280), FRAC_CONST(0.913118606267154) }, + { FRAC_CONST(0.404890689164118), FRAC_CONST(0.914365096571498) }, + { FRAC_CONST(0.402083551089587), FRAC_CONST(0.915602980523320) }, + { FRAC_CONST(0.399272628451541), FRAC_CONST(0.916832246471184) }, + { FRAC_CONST(0.396457947707454), FRAC_CONST(0.918052882844770) }, + { FRAC_CONST(0.393639535350173), FRAC_CONST(0.919264878154985) }, + { FRAC_CONST(0.390817417907669), FRAC_CONST(0.920468220994067) }, + { FRAC_CONST(0.387991621942785), FRAC_CONST(0.921662900035695) }, + { FRAC_CONST(0.385162174052990), FRAC_CONST(0.922848904035094) }, + { FRAC_CONST(0.382329100870125), FRAC_CONST(0.924026221829144) }, + { FRAC_CONST(0.379492429060153), FRAC_CONST(0.925194842336480) }, + { FRAC_CONST(0.376652185322910), FRAC_CONST(0.926354754557603) }, + { FRAC_CONST(0.373808396391851), FRAC_CONST(0.927505947574975) }, + { FRAC_CONST(0.370961089033802), FRAC_CONST(0.928648410553131) }, + { FRAC_CONST(0.368110290048703), FRAC_CONST(0.929782132738772) }, + { FRAC_CONST(0.365256026269360), FRAC_CONST(0.930907103460875) }, + { FRAC_CONST(0.362398324561191), FRAC_CONST(0.932023312130786) }, + { FRAC_CONST(0.359537211821973), FRAC_CONST(0.933130748242325) }, + { FRAC_CONST(0.356672714981588), FRAC_CONST(0.934229401371881) }, + { FRAC_CONST(0.353804861001772), FRAC_CONST(0.935319261178512) }, + { FRAC_CONST(0.350933676875858), FRAC_CONST(0.936400317404042) }, + { FRAC_CONST(0.348059189628526), FRAC_CONST(0.937472559873159) }, + { FRAC_CONST(0.345181426315543), FRAC_CONST(0.938535978493509) }, + { FRAC_CONST(0.342300414023514), FRAC_CONST(0.939590563255789) }, + { FRAC_CONST(0.339416179869623), FRAC_CONST(0.940636304233848) }, + { FRAC_CONST(0.336528751001382), FRAC_CONST(0.941673191584771) }, + { FRAC_CONST(0.333638154596371), FRAC_CONST(0.942701215548982) }, + { FRAC_CONST(0.330744417861983), FRAC_CONST(0.943720366450326) }, + { FRAC_CONST(0.327847568035171), FRAC_CONST(0.944730634696168) }, + { FRAC_CONST(0.324947632382188), FRAC_CONST(0.945732010777477) }, + { FRAC_CONST(0.322044638198335), FRAC_CONST(0.946724485268921) }, + { FRAC_CONST(0.319138612807696), FRAC_CONST(0.947708048828952) }, + { FRAC_CONST(0.316229583562890), FRAC_CONST(0.948682692199895) }, + { FRAC_CONST(0.313317577844809), FRAC_CONST(0.949648406208035) }, + { FRAC_CONST(0.310402623062359), FRAC_CONST(0.950605181763705) }, + { FRAC_CONST(0.307484746652204), FRAC_CONST(0.951553009861369) }, + { FRAC_CONST(0.304563976078509), FRAC_CONST(0.952491881579706) }, + { FRAC_CONST(0.301640338832679), FRAC_CONST(0.953421788081700) }, + { FRAC_CONST(0.298713862433100), FRAC_CONST(0.954342720614716) }, + { FRAC_CONST(0.295784574424884), FRAC_CONST(0.955254670510587) }, + { FRAC_CONST(0.292852502379605), FRAC_CONST(0.956157629185692) }, + { FRAC_CONST(0.289917673895041), FRAC_CONST(0.957051588141041) }, + { FRAC_CONST(0.286980116594916), FRAC_CONST(0.957936538962351) }, + { FRAC_CONST(0.284039858128637), FRAC_CONST(0.958812473320129) }, + { FRAC_CONST(0.281096926171038), FRAC_CONST(0.959679382969747) }, + { FRAC_CONST(0.278151348422115), FRAC_CONST(0.960537259751520) }, + { FRAC_CONST(0.275203152606767), FRAC_CONST(0.961386095590786) }, + { FRAC_CONST(0.272252366474537), FRAC_CONST(0.962225882497979) }, + { FRAC_CONST(0.269299017799346), FRAC_CONST(0.963056612568704) }, + { FRAC_CONST(0.266343134379238), FRAC_CONST(0.963878277983814) }, + { FRAC_CONST(0.263384744036113), FRAC_CONST(0.964690871009481) }, + { FRAC_CONST(0.260423874615468), FRAC_CONST(0.965494383997270) }, + { FRAC_CONST(0.257460553986133), FRAC_CONST(0.966288809384210) }, + { FRAC_CONST(0.254494810040011), FRAC_CONST(0.967074139692867) }, + { FRAC_CONST(0.251526670691813), FRAC_CONST(0.967850367531414) }, + { FRAC_CONST(0.248556163878797), FRAC_CONST(0.968617485593698) }, + { FRAC_CONST(0.245583317560504), FRAC_CONST(0.969375486659311) }, + { FRAC_CONST(0.242608159718497), FRAC_CONST(0.970124363593660) }, + { FRAC_CONST(0.239630718356094), FRAC_CONST(0.970864109348029) }, + { FRAC_CONST(0.236651021498106), FRAC_CONST(0.971594716959650) }, + { FRAC_CONST(0.233669097190577), FRAC_CONST(0.972316179551765) }, + { FRAC_CONST(0.230684973500512), FRAC_CONST(0.973028490333694) }, + { FRAC_CONST(0.227698678515621), FRAC_CONST(0.973731642600896) }, + { FRAC_CONST(0.224710240344050), FRAC_CONST(0.974425629735035) }, + { FRAC_CONST(0.221719687114115), FRAC_CONST(0.975110445204039) }, + { FRAC_CONST(0.218727046974045), FRAC_CONST(0.975786082562164) }, + { FRAC_CONST(0.215732348091706), FRAC_CONST(0.976452535450054) }, + { FRAC_CONST(0.212735618654346), FRAC_CONST(0.977109797594801) }, + { FRAC_CONST(0.209736886868323), FRAC_CONST(0.977757862810003) }, + { FRAC_CONST(0.206736180958844), FRAC_CONST(0.978396724995823) }, + { FRAC_CONST(0.203733529169694), FRAC_CONST(0.979026378139048) }, + { FRAC_CONST(0.200728959762976), FRAC_CONST(0.979646816313141) }, + { FRAC_CONST(0.197722501018842), FRAC_CONST(0.980258033678304) }, + { FRAC_CONST(0.194714181235226), FRAC_CONST(0.980860024481524) }, + { FRAC_CONST(0.191704028727580), FRAC_CONST(0.981452783056636) }, + { FRAC_CONST(0.188692071828605), FRAC_CONST(0.982036303824369) }, + { FRAC_CONST(0.185678338887988), FRAC_CONST(0.982610581292405) }, + { FRAC_CONST(0.182662858272129), FRAC_CONST(0.983175610055424) }, + { FRAC_CONST(0.179645658363882), FRAC_CONST(0.983731384795162) }, + { FRAC_CONST(0.176626767562281), FRAC_CONST(0.984277900280454) }, + { FRAC_CONST(0.173606214282275), FRAC_CONST(0.984815151367289) }, + { FRAC_CONST(0.170584026954464), FRAC_CONST(0.985343132998855) }, + { FRAC_CONST(0.167560234024824), FRAC_CONST(0.985861840205587) }, + { FRAC_CONST(0.164534863954446), FRAC_CONST(0.986371268105216) }, + { FRAC_CONST(0.161507945219266), FRAC_CONST(0.986871411902812) }, + { FRAC_CONST(0.158479506309796), FRAC_CONST(0.987362266890832) }, + { FRAC_CONST(0.155449575730856), FRAC_CONST(0.987843828449162) }, + { FRAC_CONST(0.152418182001307), FRAC_CONST(0.988316092045160) }, + { FRAC_CONST(0.149385353653780), FRAC_CONST(0.988779053233702) }, + { FRAC_CONST(0.146351119234411), FRAC_CONST(0.989232707657220) }, + { FRAC_CONST(0.143315507302572), FRAC_CONST(0.989677051045747) }, + { FRAC_CONST(0.140278546430595), FRAC_CONST(0.990112079216954) }, + { FRAC_CONST(0.137240265203516), FRAC_CONST(0.990537788076189) }, + { FRAC_CONST(0.134200692218792), FRAC_CONST(0.990954173616519) }, + { FRAC_CONST(0.131159856086043), FRAC_CONST(0.991361231918763) }, + { FRAC_CONST(0.128117785426777), FRAC_CONST(0.991758959151536) }, + { FRAC_CONST(0.125074508874121), FRAC_CONST(0.992147351571276) }, + { FRAC_CONST(0.122030055072553), FRAC_CONST(0.992526405522286) }, + { FRAC_CONST(0.118984452677633), FRAC_CONST(0.992896117436766) }, + { FRAC_CONST(0.115937730355728), FRAC_CONST(0.993256483834846) }, + { FRAC_CONST(0.112889916783750), FRAC_CONST(0.993607501324622) }, + { FRAC_CONST(0.109841040648883), FRAC_CONST(0.993949166602181) }, + { FRAC_CONST(0.106791130648307), FRAC_CONST(0.994281476451642) }, + { FRAC_CONST(0.103740215488939), FRAC_CONST(0.994604427745176) }, + { FRAC_CONST(0.100688323887154), FRAC_CONST(0.994918017443043) }, + { FRAC_CONST(0.097635484568517), FRAC_CONST(0.995222242593618) }, + { FRAC_CONST(0.094581726267515), FRAC_CONST(0.995517100333418) }, + { FRAC_CONST(0.091527077727285), FRAC_CONST(0.995802587887129) }, + { FRAC_CONST(0.088471567699341), FRAC_CONST(0.996078702567634) }, + { FRAC_CONST(0.085415224943307), FRAC_CONST(0.996345441776036) }, + { FRAC_CONST(0.082358078226647), FRAC_CONST(0.996602803001684) }, + { FRAC_CONST(0.079300156324388), FRAC_CONST(0.996850783822197) }, + { FRAC_CONST(0.076241488018856), FRAC_CONST(0.997089381903483) }, + { FRAC_CONST(0.073182102099403), FRAC_CONST(0.997318594999769) }, + { FRAC_CONST(0.070122027362134), FRAC_CONST(0.997538420953611) }, + { FRAC_CONST(0.067061292609637), FRAC_CONST(0.997748857695926) }, + { FRAC_CONST(0.063999926650714), FRAC_CONST(0.997949903246001) }, + { FRAC_CONST(0.060937958300107), FRAC_CONST(0.998141555711521) }, + { FRAC_CONST(0.057875416378229), FRAC_CONST(0.998323813288578) }, + { FRAC_CONST(0.054812329710890), FRAC_CONST(0.998496674261695) }, + { FRAC_CONST(0.051748727129028), FRAC_CONST(0.998660137003838) }, + { FRAC_CONST(0.048684637468439), FRAC_CONST(0.998814199976435) }, + { FRAC_CONST(0.045620089569500), FRAC_CONST(0.998958861729386) }, + { FRAC_CONST(0.042555112276904), FRAC_CONST(0.999094120901079) }, + { FRAC_CONST(0.039489734439384), FRAC_CONST(0.999219976218404) }, + { FRAC_CONST(0.036423984909444), FRAC_CONST(0.999336426496761) }, + { FRAC_CONST(0.033357892543086), FRAC_CONST(0.999443470640078) }, + { FRAC_CONST(0.030291486199539), FRAC_CONST(0.999541107640813) }, + { FRAC_CONST(0.027224794740988), FRAC_CONST(0.999629336579970) }, + { FRAC_CONST(0.024157847032300), FRAC_CONST(0.999708156627105) }, + { FRAC_CONST(0.021090671940755), FRAC_CONST(0.999777567040333) }, + { FRAC_CONST(0.018023298335774), FRAC_CONST(0.999837567166337) }, + { FRAC_CONST(0.014955755088644), FRAC_CONST(0.999888156440373) }, + { FRAC_CONST(0.011888071072252), FRAC_CONST(0.999929334386276) }, + { FRAC_CONST(0.008820275160808), FRAC_CONST(0.999961100616463) }, + { FRAC_CONST(0.005752396229574), FRAC_CONST(0.999983454831938) }, + { FRAC_CONST(0.002684463154596), FRAC_CONST(0.999996396822294) } +}; + +/* 64 (N/4) complex twiddle factors */ +ALIGN static const complex_t mdct_tab_256[] = +{ + { FRAC_CONST(0.999995293809576), FRAC_CONST(0.003067956762966) }, + { FRAC_CONST(0.999618822495179), FRAC_CONST(0.027608145778966) }, + { FRAC_CONST(0.998640218180265), FRAC_CONST(0.052131704680283) }, + { FRAC_CONST(0.997060070339483), FRAC_CONST(0.076623861392031) }, + { FRAC_CONST(0.994879330794806), FRAC_CONST(0.101069862754828) }, + { FRAC_CONST(0.992099313142192), FRAC_CONST(0.125454983411546) }, + { FRAC_CONST(0.988721691960324), FRAC_CONST(0.149764534677322) }, + { FRAC_CONST(0.984748501801904), FRAC_CONST(0.173983873387464) }, + { FRAC_CONST(0.980182135968117), FRAC_CONST(0.198098410717954) }, + { FRAC_CONST(0.975025345066994), FRAC_CONST(0.222093620973204) }, + { FRAC_CONST(0.969281235356549), FRAC_CONST(0.245955050335795) }, + { FRAC_CONST(0.962953266873684), FRAC_CONST(0.269668325572915) }, + { FRAC_CONST(0.956045251349996), FRAC_CONST(0.293219162694259) }, + { FRAC_CONST(0.948561349915730), FRAC_CONST(0.316593375556166) }, + { FRAC_CONST(0.940506070593268), FRAC_CONST(0.339776884406827) }, + { FRAC_CONST(0.931884265581668), FRAC_CONST(0.362755724367397) }, + { FRAC_CONST(0.922701128333879), FRAC_CONST(0.385516053843919) }, + { FRAC_CONST(0.912962190428398), FRAC_CONST(0.408044162864979) }, + { FRAC_CONST(0.902673318237259), FRAC_CONST(0.430326481340083) }, + { FRAC_CONST(0.891840709392343), FRAC_CONST(0.452349587233771) }, + { FRAC_CONST(0.880470889052161), FRAC_CONST(0.474100214650550) }, + { FRAC_CONST(0.868570705971341), FRAC_CONST(0.495565261825773) }, + { FRAC_CONST(0.856147328375194), FRAC_CONST(0.516731799017650) }, + { FRAC_CONST(0.843208239641845), FRAC_CONST(0.537587076295645) }, + { FRAC_CONST(0.829761233794523), FRAC_CONST(0.558118531220556) }, + { FRAC_CONST(0.815814410806734), FRAC_CONST(0.578313796411656) }, + { FRAC_CONST(0.801376171723140), FRAC_CONST(0.598160706996342) }, + { FRAC_CONST(0.786455213599086), FRAC_CONST(0.617647307937804) }, + { FRAC_CONST(0.771060524261814), FRAC_CONST(0.636761861236284) }, + { FRAC_CONST(0.755201376896537), FRAC_CONST(0.655492852999615) }, + { FRAC_CONST(0.738887324460615), FRAC_CONST(0.673829000378756) }, + { FRAC_CONST(0.722128193929215), FRAC_CONST(0.691759258364158) }, + { FRAC_CONST(0.704934080375905), FRAC_CONST(0.709272826438866) }, + { FRAC_CONST(0.687315340891759), FRAC_CONST(0.726359155084346) }, + { FRAC_CONST(0.669282588346636), FRAC_CONST(0.743007952135122) }, + { FRAC_CONST(0.650846684996381), FRAC_CONST(0.759209188978388) }, + { FRAC_CONST(0.632018735939809), FRAC_CONST(0.774953106594874) }, + { FRAC_CONST(0.612810082429410), FRAC_CONST(0.790230221437310) }, + { FRAC_CONST(0.593232295039800), FRAC_CONST(0.805031331142964) }, + { FRAC_CONST(0.573297166698042), FRAC_CONST(0.819347520076797) }, + { FRAC_CONST(0.553016705580028), FRAC_CONST(0.833170164701913) }, + { FRAC_CONST(0.532403127877198), FRAC_CONST(0.846490938774052) }, + { FRAC_CONST(0.511468850437971), FRAC_CONST(0.859301818357008) }, + { FRAC_CONST(0.490226483288291), FRAC_CONST(0.871595086655951) }, + { FRAC_CONST(0.468688822035828), FRAC_CONST(0.883363338665732) }, + { FRAC_CONST(0.446868840162374), FRAC_CONST(0.894599485631383) }, + { FRAC_CONST(0.424779681209109), FRAC_CONST(0.905296759318119) }, + { FRAC_CONST(0.402434650859419), FRAC_CONST(0.915448716088268) }, + { FRAC_CONST(0.379847208924051), FRAC_CONST(0.925049240782678) }, + { FRAC_CONST(0.357030961233430), FRAC_CONST(0.934092550404259) }, + { FRAC_CONST(0.333999651442009), FRAC_CONST(0.942573197601447) }, + { FRAC_CONST(0.310767152749611), FRAC_CONST(0.950486073949482) }, + { FRAC_CONST(0.287347459544730), FRAC_CONST(0.957826413027533) }, + { FRAC_CONST(0.263754678974832), FRAC_CONST(0.964589793289813) }, + { FRAC_CONST(0.240003022448742), FRAC_CONST(0.970772140728950) }, + { FRAC_CONST(0.216106797076220), FRAC_CONST(0.976369731330021) }, + { FRAC_CONST(0.192080397049892), FRAC_CONST(0.981379193313755) }, + { FRAC_CONST(0.167938294974731), FRAC_CONST(0.985797509167567) }, + { FRAC_CONST(0.143695033150295), FRAC_CONST(0.989622017463201) }, + { FRAC_CONST(0.119365214810991), FRAC_CONST(0.992850414459865) }, + { FRAC_CONST(0.094963495329639), FRAC_CONST(0.995480755491927) }, + { FRAC_CONST(0.070504573389614), FRAC_CONST(0.997511456140303) }, + { FRAC_CONST(0.046003182130915), FRAC_CONST(0.998941293186857) }, + { FRAC_CONST(0.021474080275470), FRAC_CONST(0.999769405351215) } +}; + +#ifdef LD_DEC +/* 256 (N/4) complex twiddle factors */ +ALIGN static const complex_t mdct_tab_1024[] = +{ + { FRAC_CONST(0.999999705862882), FRAC_CONST(0.000766990318743) }, + { FRAC_CONST(0.999976174986898), FRAC_CONST(0.006902858724730) }, + { FRAC_CONST(0.999914995573113), FRAC_CONST(0.013038467241987) }, + { FRAC_CONST(0.999816169924900), FRAC_CONST(0.019173584868323) }, + { FRAC_CONST(0.999679701762988), FRAC_CONST(0.025307980620025) }, + { FRAC_CONST(0.999505596225325), FRAC_CONST(0.031441423540560) }, + { FRAC_CONST(0.999293859866888), FRAC_CONST(0.037573682709270) }, + { FRAC_CONST(0.999044500659429), FRAC_CONST(0.043704527250063) }, + { FRAC_CONST(0.998757527991183), FRAC_CONST(0.049833726340107) }, + { FRAC_CONST(0.998432952666508), FRAC_CONST(0.055961049218521) }, + { FRAC_CONST(0.998070786905482), FRAC_CONST(0.062086265195060) }, + { FRAC_CONST(0.997671044343441), FRAC_CONST(0.068209143658806) }, + { FRAC_CONST(0.997233740030466), FRAC_CONST(0.074329454086846) }, + { FRAC_CONST(0.996758890430818), FRAC_CONST(0.080446966052950) }, + { FRAC_CONST(0.996246513422316), FRAC_CONST(0.086561449236251) }, + { FRAC_CONST(0.995696628295664), FRAC_CONST(0.092672673429913) }, + { FRAC_CONST(0.995109255753726), FRAC_CONST(0.098780408549800) }, + { FRAC_CONST(0.994484417910748), FRAC_CONST(0.104884424643135) }, + { FRAC_CONST(0.993822138291520), FRAC_CONST(0.110984491897163) }, + { FRAC_CONST(0.993122441830496), FRAC_CONST(0.117080380647801) }, + { FRAC_CONST(0.992385354870852), FRAC_CONST(0.123171861388280) }, + { FRAC_CONST(0.991610905163495), FRAC_CONST(0.129258704777796) }, + { FRAC_CONST(0.990799121866020), FRAC_CONST(0.135340681650134) }, + { FRAC_CONST(0.989950035541609), FRAC_CONST(0.141417563022303) }, + { FRAC_CONST(0.989063678157882), FRAC_CONST(0.147489120103154) }, + { FRAC_CONST(0.988140083085693), FRAC_CONST(0.153555124301993) }, + { FRAC_CONST(0.987179285097874), FRAC_CONST(0.159615347237193) }, + { FRAC_CONST(0.986181320367928), FRAC_CONST(0.165669560744784) }, + { FRAC_CONST(0.985146226468662), FRAC_CONST(0.171717536887050) }, + { FRAC_CONST(0.984074042370776), FRAC_CONST(0.177759047961107) }, + { FRAC_CONST(0.982964808441396), FRAC_CONST(0.183793866507478) }, + { FRAC_CONST(0.981818566442553), FRAC_CONST(0.189821765318656) }, + { FRAC_CONST(0.980635359529608), FRAC_CONST(0.195842517447658) }, + { FRAC_CONST(0.979415232249635), FRAC_CONST(0.201855896216568) }, + { FRAC_CONST(0.978158230539735), FRAC_CONST(0.207861675225075) }, + { FRAC_CONST(0.976864401725313), FRAC_CONST(0.213859628358994) }, + { FRAC_CONST(0.975533794518291), FRAC_CONST(0.219849529798779) }, + { FRAC_CONST(0.974166459015280), FRAC_CONST(0.225831154028026) }, + { FRAC_CONST(0.972762446695689), FRAC_CONST(0.231804275841965) }, + { FRAC_CONST(0.971321810419786), FRAC_CONST(0.237768670355934) }, + { FRAC_CONST(0.969844604426715), FRAC_CONST(0.243724113013852) }, + { FRAC_CONST(0.968330884332445), FRAC_CONST(0.249670379596669) }, + { FRAC_CONST(0.966780707127683), FRAC_CONST(0.255607246230807) }, + { FRAC_CONST(0.965194131175725), FRAC_CONST(0.261534489396596) }, + { FRAC_CONST(0.963571216210257), FRAC_CONST(0.267451885936678) }, + { FRAC_CONST(0.961912023333112), FRAC_CONST(0.273359213064419) }, + { FRAC_CONST(0.960216615011963), FRAC_CONST(0.279256248372291) }, + { FRAC_CONST(0.958485055077976), FRAC_CONST(0.285142769840249) }, + { FRAC_CONST(0.956717408723403), FRAC_CONST(0.291018555844085) }, + { FRAC_CONST(0.954913742499131), FRAC_CONST(0.296883385163778) }, + { FRAC_CONST(0.953074124312172), FRAC_CONST(0.302737036991819) }, + { FRAC_CONST(0.951198623423113), FRAC_CONST(0.308579290941525) }, + { FRAC_CONST(0.949287310443502), FRAC_CONST(0.314409927055337) }, + { FRAC_CONST(0.947340257333192), FRAC_CONST(0.320228725813100) }, + { FRAC_CONST(0.945357537397632), FRAC_CONST(0.326035468140330) }, + { FRAC_CONST(0.943339225285108), FRAC_CONST(0.331829935416461) }, + { FRAC_CONST(0.941285396983929), FRAC_CONST(0.337611909483075) }, + { FRAC_CONST(0.939196129819570), FRAC_CONST(0.343381172652115) }, + { FRAC_CONST(0.937071502451759), FRAC_CONST(0.349137507714085) }, + { FRAC_CONST(0.934911594871516), FRAC_CONST(0.354880697946223) }, + { FRAC_CONST(0.932716488398140), FRAC_CONST(0.360610527120662) }, + { FRAC_CONST(0.930486265676150), FRAC_CONST(0.366326779512574) }, + { FRAC_CONST(0.928221010672169), FRAC_CONST(0.372029239908285) }, + { FRAC_CONST(0.925920808671770), FRAC_CONST(0.377717693613386) }, + { FRAC_CONST(0.923585746276257), FRAC_CONST(0.383391926460809) }, + { FRAC_CONST(0.921215911399409), FRAC_CONST(0.389051724818894) }, + { FRAC_CONST(0.918811393264170), FRAC_CONST(0.394696875599434) }, + { FRAC_CONST(0.916372282399289), FRAC_CONST(0.400327166265690) }, + { FRAC_CONST(0.913898670635912), FRAC_CONST(0.405942384840403) }, + { FRAC_CONST(0.911390651104122), FRAC_CONST(0.411542319913765) }, + { FRAC_CONST(0.908848318229439), FRAC_CONST(0.417126760651388) }, + { FRAC_CONST(0.906271767729258), FRAC_CONST(0.422695496802233) }, + { FRAC_CONST(0.903661096609248), FRAC_CONST(0.428248318706532) }, + { FRAC_CONST(0.901016403159702), FRAC_CONST(0.433785017303679) }, + { FRAC_CONST(0.898337786951834), FRAC_CONST(0.439305384140100) }, + { FRAC_CONST(0.895625348834030), FRAC_CONST(0.444809211377105) }, + { FRAC_CONST(0.892879190928052), FRAC_CONST(0.450296291798709) }, + { FRAC_CONST(0.890099416625192), FRAC_CONST(0.455766418819435) }, + { FRAC_CONST(0.887286130582383), FRAC_CONST(0.461219386492092) }, + { FRAC_CONST(0.884439438718254), FRAC_CONST(0.466654989515531) }, + { FRAC_CONST(0.881559448209144), FRAC_CONST(0.472073023242369) }, + { FRAC_CONST(0.878646267485068), FRAC_CONST(0.477473283686698) }, + { FRAC_CONST(0.875700006225635), FRAC_CONST(0.482855567531766) }, + { FRAC_CONST(0.872720775355914), FRAC_CONST(0.488219672137627) }, + { FRAC_CONST(0.869708687042266), FRAC_CONST(0.493565395548775) }, + { FRAC_CONST(0.866663854688111), FRAC_CONST(0.498892536501745) }, + { FRAC_CONST(0.863586392929668), FRAC_CONST(0.504200894432690) }, + { FRAC_CONST(0.860476417631632), FRAC_CONST(0.509490269484936) }, + { FRAC_CONST(0.857334045882816), FRAC_CONST(0.514760462516501) }, + { FRAC_CONST(0.854159395991739), FRAC_CONST(0.520011275107596) }, + { FRAC_CONST(0.850952587482176), FRAC_CONST(0.525242509568095) }, + { FRAC_CONST(0.847713741088654), FRAC_CONST(0.530453968944976) }, + { FRAC_CONST(0.844442978751911), FRAC_CONST(0.535645457029741) }, + { FRAC_CONST(0.841140423614298), FRAC_CONST(0.540816778365797) }, + { FRAC_CONST(0.837806200015151), FRAC_CONST(0.545967738255818) }, + { FRAC_CONST(0.834440433486103), FRAC_CONST(0.551098142769075) }, + { FRAC_CONST(0.831043250746362), FRAC_CONST(0.556207798748740) }, + { FRAC_CONST(0.827614779697938), FRAC_CONST(0.561296513819151) }, + { FRAC_CONST(0.824155149420829), FRAC_CONST(0.566364096393064) }, + { FRAC_CONST(0.820664490168157), FRAC_CONST(0.571410355678857) }, + { FRAC_CONST(0.817142933361273), FRAC_CONST(0.576435101687722) }, + { FRAC_CONST(0.813590611584799), FRAC_CONST(0.581438145240810) }, + { FRAC_CONST(0.810007658581641), FRAC_CONST(0.586419297976361) }, + { FRAC_CONST(0.806394209247956), FRAC_CONST(0.591378372356788) }, + { FRAC_CONST(0.802750399628069), FRAC_CONST(0.596315181675744) }, + { FRAC_CONST(0.799076366909352), FRAC_CONST(0.601229540065149) }, + { FRAC_CONST(0.795372249417061), FRAC_CONST(0.606121262502186) }, + { FRAC_CONST(0.791638186609126), FRAC_CONST(0.610990164816272) }, + { FRAC_CONST(0.787874319070900), FRAC_CONST(0.615836063695985) }, + { FRAC_CONST(0.784080788509870), FRAC_CONST(0.620658776695972) }, + { FRAC_CONST(0.780257737750317), FRAC_CONST(0.625458122243814) }, + { FRAC_CONST(0.776405310727940), FRAC_CONST(0.630233919646864) }, + { FRAC_CONST(0.772523652484441), FRAC_CONST(0.634985989099049) }, + { FRAC_CONST(0.768612909162058), FRAC_CONST(0.639714151687640) }, + { FRAC_CONST(0.764673227998067), FRAC_CONST(0.644418229399988) }, + { FRAC_CONST(0.760704757319237), FRAC_CONST(0.649098045130226) }, + { FRAC_CONST(0.756707646536246), FRAC_CONST(0.653753422685936) }, + { FRAC_CONST(0.752682046138055), FRAC_CONST(0.658384186794785) }, + { FRAC_CONST(0.748628107686245), FRAC_CONST(0.662990163111121) }, + { FRAC_CONST(0.744545983809307), FRAC_CONST(0.667571178222540) }, + { FRAC_CONST(0.740435828196898), FRAC_CONST(0.672127059656412) }, + { FRAC_CONST(0.736297795594053), FRAC_CONST(0.676657635886375) }, + { FRAC_CONST(0.732132041795361), FRAC_CONST(0.681162736338795) }, + { FRAC_CONST(0.727938723639099), FRAC_CONST(0.685642191399187) }, + { FRAC_CONST(0.723717999001324), FRAC_CONST(0.690095832418600) }, + { FRAC_CONST(0.719470026789933), FRAC_CONST(0.694523491719966) }, + { FRAC_CONST(0.715194966938680), FRAC_CONST(0.698925002604414) }, + { FRAC_CONST(0.710892980401152), FRAC_CONST(0.703300199357549) }, + { FRAC_CONST(0.706564229144710), FRAC_CONST(0.707648917255684) }, + { FRAC_CONST(0.702208876144392), FRAC_CONST(0.711970992572050) }, + { FRAC_CONST(0.697827085376777), FRAC_CONST(0.716266262582953) }, + { FRAC_CONST(0.693419021813812), FRAC_CONST(0.720534565573905) }, + { FRAC_CONST(0.688984851416597), FRAC_CONST(0.724775740845711) }, + { FRAC_CONST(0.684524741129142), FRAC_CONST(0.728989628720519) }, + { FRAC_CONST(0.680038858872079), FRAC_CONST(0.733176070547833) }, + { FRAC_CONST(0.675527373536339), FRAC_CONST(0.737334908710483) }, + { FRAC_CONST(0.670990454976794), FRAC_CONST(0.741465986630563) }, + { FRAC_CONST(0.666428274005865), FRAC_CONST(0.745569148775325) }, + { FRAC_CONST(0.661841002387087), FRAC_CONST(0.749644240663033) }, + { FRAC_CONST(0.657228812828643), FRAC_CONST(0.753691108868781) }, + { FRAC_CONST(0.652591878976863), FRAC_CONST(0.757709601030268) }, + { FRAC_CONST(0.647930375409685), FRAC_CONST(0.761699565853535) }, + { FRAC_CONST(0.643244477630086), FRAC_CONST(0.765660853118662) }, + { FRAC_CONST(0.638534362059467), FRAC_CONST(0.769593313685423) }, + { FRAC_CONST(0.633800206031017), FRAC_CONST(0.773496799498899) }, + { FRAC_CONST(0.629042187783036), FRAC_CONST(0.777371163595056) }, + { FRAC_CONST(0.624260486452221), FRAC_CONST(0.781216260106276) }, + { FRAC_CONST(0.619455282066924), FRAC_CONST(0.785031944266848) }, + { FRAC_CONST(0.614626755540375), FRAC_CONST(0.788818072418420) }, + { FRAC_CONST(0.609775088663868), FRAC_CONST(0.792574502015408) }, + { FRAC_CONST(0.604900464099920), FRAC_CONST(0.796301091630359) }, + { FRAC_CONST(0.600003065375389), FRAC_CONST(0.799997700959282) }, + { FRAC_CONST(0.595083076874570), FRAC_CONST(0.803664190826924) }, + { FRAC_CONST(0.590140683832249), FRAC_CONST(0.807300423192014) }, + { FRAC_CONST(0.585176072326730), FRAC_CONST(0.810906261152460) }, + { FRAC_CONST(0.580189429272832), FRAC_CONST(0.814481568950499) }, + { FRAC_CONST(0.575180942414845), FRAC_CONST(0.818026211977813) }, + { FRAC_CONST(0.570150800319470), FRAC_CONST(0.821540056780598) }, + { FRAC_CONST(0.565099192368714), FRAC_CONST(0.825022971064580) }, + { FRAC_CONST(0.560026308752760), FRAC_CONST(0.828474823700007) }, + { FRAC_CONST(0.554932340462810), FRAC_CONST(0.831895484726578) }, + { FRAC_CONST(0.549817479283891), FRAC_CONST(0.835284825358337) }, + { FRAC_CONST(0.544681917787635), FRAC_CONST(0.838642717988527) }, + { FRAC_CONST(0.539525849325029), FRAC_CONST(0.841969036194388) }, + { FRAC_CONST(0.534349468019138), FRAC_CONST(0.845263654741918) }, + { FRAC_CONST(0.529152968757791), FRAC_CONST(0.848526449590593) }, + { FRAC_CONST(0.523936547186249), FRAC_CONST(0.851757297898029) }, + { FRAC_CONST(0.518700399699835), FRAC_CONST(0.854956078024615) }, + { FRAC_CONST(0.513444723436544), FRAC_CONST(0.858122669538086) }, + { FRAC_CONST(0.508169716269615), FRAC_CONST(0.861256953218062) }, + { FRAC_CONST(0.502875576800087), FRAC_CONST(0.864358811060534) }, + { FRAC_CONST(0.497562504349319), FRAC_CONST(0.867428126282307) }, + { FRAC_CONST(0.492230698951486), FRAC_CONST(0.870464783325398) }, + { FRAC_CONST(0.486880361346047), FRAC_CONST(0.873468667861385) }, + { FRAC_CONST(0.481511692970190), FRAC_CONST(0.876439666795714) }, + { FRAC_CONST(0.476124895951244), FRAC_CONST(0.879377668271953) }, + { FRAC_CONST(0.470720173099072), FRAC_CONST(0.882282561676009) }, + { FRAC_CONST(0.465297727898435), FRAC_CONST(0.885154237640285) }, + { FRAC_CONST(0.459857764501330), FRAC_CONST(0.887992588047806) }, + { FRAC_CONST(0.454400487719304), FRAC_CONST(0.890797506036281) }, + { FRAC_CONST(0.448926103015743), FRAC_CONST(0.893568886002136) }, + { FRAC_CONST(0.443434816498138), FRAC_CONST(0.896306623604480) }, + { FRAC_CONST(0.437926834910323), FRAC_CONST(0.899010615769039) }, + { FRAC_CONST(0.432402365624690), FRAC_CONST(0.901680760692038) }, + { FRAC_CONST(0.426861616634386), FRAC_CONST(0.904316957844028) }, + { FRAC_CONST(0.421304796545480), FRAC_CONST(0.906919107973678) }, + { FRAC_CONST(0.415732114569105), FRAC_CONST(0.909487113111505) }, + { FRAC_CONST(0.410143780513590), FRAC_CONST(0.912020876573568) }, + { FRAC_CONST(0.404540004776553), FRAC_CONST(0.914520302965104) }, + { FRAC_CONST(0.398920998336983), FRAC_CONST(0.916985298184123) }, + { FRAC_CONST(0.393286972747297), FRAC_CONST(0.919415769424947) }, + { FRAC_CONST(0.387638140125373), FRAC_CONST(0.921811625181708) }, + { FRAC_CONST(0.381974713146567), FRAC_CONST(0.924172775251791) }, + { FRAC_CONST(0.376296905035705), FRAC_CONST(0.926499130739231) }, + { FRAC_CONST(0.370604929559052), FRAC_CONST(0.928790604058057) }, + { FRAC_CONST(0.364899001016267), FRAC_CONST(0.931047108935595) }, + { FRAC_CONST(0.359179334232337), FRAC_CONST(0.933268560415712) }, + { FRAC_CONST(0.353446144549481), FRAC_CONST(0.935454874862015) }, + { FRAC_CONST(0.347699647819051), FRAC_CONST(0.937605969961000) }, + { FRAC_CONST(0.341940060393402), FRAC_CONST(0.939721764725153) }, + { FRAC_CONST(0.336167599117745), FRAC_CONST(0.941802179495998) }, + { FRAC_CONST(0.330382481321983), FRAC_CONST(0.943847135947093) }, + { FRAC_CONST(0.324584924812532), FRAC_CONST(0.945856557086984) }, + { FRAC_CONST(0.318775147864118), FRAC_CONST(0.947830367262101) }, + { FRAC_CONST(0.312953369211560), FRAC_CONST(0.949768492159607) }, + { FRAC_CONST(0.307119808041533), FRAC_CONST(0.951670858810194) }, + { FRAC_CONST(0.301274683984318), FRAC_CONST(0.953537395590833) }, + { FRAC_CONST(0.295418217105532), FRAC_CONST(0.955368032227470) }, + { FRAC_CONST(0.289550627897843), FRAC_CONST(0.957162699797670) }, + { FRAC_CONST(0.283672137272669), FRAC_CONST(0.958921330733213) }, + { FRAC_CONST(0.277782966551858), FRAC_CONST(0.960643858822638) }, + { FRAC_CONST(0.271883337459360), FRAC_CONST(0.962330219213737) }, + { FRAC_CONST(0.265973472112876), FRAC_CONST(0.963980348415994) }, + { FRAC_CONST(0.260053593015495), FRAC_CONST(0.965594184302977) }, + { FRAC_CONST(0.254123923047321), FRAC_CONST(0.967171666114677) }, + { FRAC_CONST(0.248184685457075), FRAC_CONST(0.968712734459795) }, + { FRAC_CONST(0.242236103853696), FRAC_CONST(0.970217331317979) }, + { FRAC_CONST(0.236278402197920), FRAC_CONST(0.971685400042009) }, + { FRAC_CONST(0.230311804793846), FRAC_CONST(0.973116885359925) }, + { FRAC_CONST(0.224336536280494), FRAC_CONST(0.974511733377116) }, + { FRAC_CONST(0.218352821623346), FRAC_CONST(0.975869891578341) }, + { FRAC_CONST(0.212360886105879), FRAC_CONST(0.977191308829712) }, + { FRAC_CONST(0.206360955321076), FRAC_CONST(0.978475935380617) }, + { FRAC_CONST(0.200353255162940), FRAC_CONST(0.979723722865591) }, + { FRAC_CONST(0.194338011817989), FRAC_CONST(0.980934624306142) }, + { FRAC_CONST(0.188315451756732), FRAC_CONST(0.982108594112514) }, + { FRAC_CONST(0.182285801725153), FRAC_CONST(0.983245588085407) }, + { FRAC_CONST(0.176249288736168), FRAC_CONST(0.984345563417642) }, + { FRAC_CONST(0.170206140061078), FRAC_CONST(0.985408478695768) }, + { FRAC_CONST(0.164156583221016), FRAC_CONST(0.986434293901627) }, + { FRAC_CONST(0.158100845978377), FRAC_CONST(0.987422970413855) }, + { FRAC_CONST(0.152039156328246), FRAC_CONST(0.988374471009341) }, + { FRAC_CONST(0.145971742489812), FRAC_CONST(0.989288759864625) }, + { FRAC_CONST(0.139898832897777), FRAC_CONST(0.990165802557248) }, + { FRAC_CONST(0.133820656193755), FRAC_CONST(0.991005566067049) }, + { FRAC_CONST(0.127737441217662), FRAC_CONST(0.991808018777406) }, + { FRAC_CONST(0.121649416999106), FRAC_CONST(0.992573130476429) }, + { FRAC_CONST(0.115556812748755), FRAC_CONST(0.993300872358093) }, + { FRAC_CONST(0.109459857849718), FRAC_CONST(0.993991217023329) }, + { FRAC_CONST(0.103358781848900), FRAC_CONST(0.994644138481051) }, + { FRAC_CONST(0.097253814448363), FRAC_CONST(0.995259612149133) }, + { FRAC_CONST(0.091145185496681), FRAC_CONST(0.995837614855342) }, + { FRAC_CONST(0.085033124980280), FRAC_CONST(0.996378124838200) }, + { FRAC_CONST(0.078917863014785), FRAC_CONST(0.996881121747814) }, + { FRAC_CONST(0.072799629836352), FRAC_CONST(0.997346586646633) }, + { FRAC_CONST(0.066678655793002), FRAC_CONST(0.997774502010168) }, + { FRAC_CONST(0.060555171335948), FRAC_CONST(0.998164851727646) }, + { FRAC_CONST(0.054429407010919), FRAC_CONST(0.998517621102622) }, + { FRAC_CONST(0.048301593449480), FRAC_CONST(0.998832796853528) }, + { FRAC_CONST(0.042171961360348), FRAC_CONST(0.999110367114175) }, + { FRAC_CONST(0.036040741520706), FRAC_CONST(0.999350321434199) }, + { FRAC_CONST(0.029908164767517), FRAC_CONST(0.999552650779457) }, + { FRAC_CONST(0.023774461988828), FRAC_CONST(0.999717347532362) }, + { FRAC_CONST(0.017639864115082), FRAC_CONST(0.999844405492175) }, + { FRAC_CONST(0.011504602110423), FRAC_CONST(0.999933819875236) }, + { FRAC_CONST(0.005368906963996), FRAC_CONST(0.999985587315143) } +}; +#endif // LD_DEC + +#ifdef ALLOW_SMALL_FRAMELENGTH +/* 480 (N/4) complex twiddle factors */ +ALIGN static const complex_t mdct_tab_1920[] = +{ + { FRAC_CONST(0.999999916334328), FRAC_CONST(0.000409061532028) }, + { FRAC_CONST(0.999993223088129), FRAC_CONST(0.003681545574400) }, + { FRAC_CONST(0.999975820717897), FRAC_CONST(0.006953990190376) }, + { FRAC_CONST(0.999947709409999), FRAC_CONST(0.010226360334704) }, + { FRAC_CONST(0.999908889465485), FRAC_CONST(0.013498620962929) }, + { FRAC_CONST(0.999859361300084), FRAC_CONST(0.016770737031768) }, + { FRAC_CONST(0.999799125444203), FRAC_CONST(0.020042673499487) }, + { FRAC_CONST(0.999728182542920), FRAC_CONST(0.023314395326274) }, + { FRAC_CONST(0.999646533355977), FRAC_CONST(0.026585867474619) }, + { FRAC_CONST(0.999554178757770), FRAC_CONST(0.029857054909681) }, + { FRAC_CONST(0.999451119737344), FRAC_CONST(0.033127922599673) }, + { FRAC_CONST(0.999337357398377), FRAC_CONST(0.036398435516228) }, + { FRAC_CONST(0.999212892959173), FRAC_CONST(0.039668558634781) }, + { FRAC_CONST(0.999077727752645), FRAC_CONST(0.042938256934941) }, + { FRAC_CONST(0.998931863226306), FRAC_CONST(0.046207495400865) }, + { FRAC_CONST(0.998775300942246), FRAC_CONST(0.049476239021636) }, + { FRAC_CONST(0.998608042577122), FRAC_CONST(0.052744452791636) }, + { FRAC_CONST(0.998430089922136), FRAC_CONST(0.056012101710921) }, + { FRAC_CONST(0.998241444883019), FRAC_CONST(0.059279150785597) }, + { FRAC_CONST(0.998042109480008), FRAC_CONST(0.062545565028192) }, + { FRAC_CONST(0.997832085847824), FRAC_CONST(0.065811309458034) }, + { FRAC_CONST(0.997611376235651), FRAC_CONST(0.069076349101624) }, + { FRAC_CONST(0.997379983007114), FRAC_CONST(0.072340648993011) }, + { FRAC_CONST(0.997137908640245), FRAC_CONST(0.075604174174166) }, + { FRAC_CONST(0.996885155727469), FRAC_CONST(0.078866889695354) }, + { FRAC_CONST(0.996621726975566), FRAC_CONST(0.082128760615515) }, + { FRAC_CONST(0.996347625205645), FRAC_CONST(0.085389752002632) }, + { FRAC_CONST(0.996062853353117), FRAC_CONST(0.088649828934106) }, + { FRAC_CONST(0.995767414467660), FRAC_CONST(0.091908956497133) }, + { FRAC_CONST(0.995461311713186), FRAC_CONST(0.095167099789075) }, + { FRAC_CONST(0.995144548367810), FRAC_CONST(0.098424223917834) }, + { FRAC_CONST(0.994817127823813), FRAC_CONST(0.101680294002229) }, + { FRAC_CONST(0.994479053587606), FRAC_CONST(0.104935275172364) }, + { FRAC_CONST(0.994130329279692), FRAC_CONST(0.108189132570007) }, + { FRAC_CONST(0.993770958634630), FRAC_CONST(0.111441831348957) }, + { FRAC_CONST(0.993400945500988), FRAC_CONST(0.114693336675426) }, + { FRAC_CONST(0.993020293841312), FRAC_CONST(0.117943613728403) }, + { FRAC_CONST(0.992629007732074), FRAC_CONST(0.121192627700032) }, + { FRAC_CONST(0.992227091363634), FRAC_CONST(0.124440343795983) }, + { FRAC_CONST(0.991814549040194), FRAC_CONST(0.127686727235827) }, + { FRAC_CONST(0.991391385179751), FRAC_CONST(0.130931743253405) }, + { FRAC_CONST(0.990957604314048), FRAC_CONST(0.134175357097202) }, + { FRAC_CONST(0.990513211088533), FRAC_CONST(0.137417534030720) }, + { FRAC_CONST(0.990058210262297), FRAC_CONST(0.140658239332849) }, + { FRAC_CONST(0.989592606708036), FRAC_CONST(0.143897438298239) }, + { FRAC_CONST(0.989116405411988), FRAC_CONST(0.147135096237670) }, + { FRAC_CONST(0.988629611473887), FRAC_CONST(0.150371178478428) }, + { FRAC_CONST(0.988132230106905), FRAC_CONST(0.153605650364672) }, + { FRAC_CONST(0.987624266637598), FRAC_CONST(0.156838477257806) }, + { FRAC_CONST(0.987105726505845), FRAC_CONST(0.160069624536852) }, + { FRAC_CONST(0.986576615264794), FRAC_CONST(0.163299057598817) }, + { FRAC_CONST(0.986036938580803), FRAC_CONST(0.166526741859069) }, + { FRAC_CONST(0.985486702233375), FRAC_CONST(0.169752642751702) }, + { FRAC_CONST(0.984925912115099), FRAC_CONST(0.172976725729910) }, + { FRAC_CONST(0.984354574231587), FRAC_CONST(0.176198956266353) }, + { FRAC_CONST(0.983772694701407), FRAC_CONST(0.179419299853531) }, + { FRAC_CONST(0.983180279756024), FRAC_CONST(0.182637722004152) }, + { FRAC_CONST(0.982577335739725), FRAC_CONST(0.185854188251500) }, + { FRAC_CONST(0.981963869109555), FRAC_CONST(0.189068664149806) }, + { FRAC_CONST(0.981339886435250), FRAC_CONST(0.192281115274616) }, + { FRAC_CONST(0.980705394399163), FRAC_CONST(0.195491507223158) }, + { FRAC_CONST(0.980060399796194), FRAC_CONST(0.198699805614714) }, + { FRAC_CONST(0.979404909533716), FRAC_CONST(0.201905976090986) }, + { FRAC_CONST(0.978738930631504), FRAC_CONST(0.205109984316464) }, + { FRAC_CONST(0.978062470221657), FRAC_CONST(0.208311795978794) }, + { FRAC_CONST(0.977375535548522), FRAC_CONST(0.211511376789145) }, + { FRAC_CONST(0.976678133968618), FRAC_CONST(0.214708692482577) }, + { FRAC_CONST(0.975970272950556), FRAC_CONST(0.217903708818409) }, + { FRAC_CONST(0.975251960074958), FRAC_CONST(0.221096391580581) }, + { FRAC_CONST(0.974523203034377), FRAC_CONST(0.224286706578026) }, + { FRAC_CONST(0.973784009633218), FRAC_CONST(0.227474619645035) }, + { FRAC_CONST(0.973034387787646), FRAC_CONST(0.230660096641619) }, + { FRAC_CONST(0.972274345525510), FRAC_CONST(0.233843103453878) }, + { FRAC_CONST(0.971503890986252), FRAC_CONST(0.237023605994367) }, + { FRAC_CONST(0.970723032420820), FRAC_CONST(0.240201570202459) }, + { FRAC_CONST(0.969931778191584), FRAC_CONST(0.243376962044711) }, + { FRAC_CONST(0.969130136772239), FRAC_CONST(0.246549747515226) }, + { FRAC_CONST(0.968318116747721), FRAC_CONST(0.249719892636022) }, + { FRAC_CONST(0.967495726814114), FRAC_CONST(0.252887363457390) }, + { FRAC_CONST(0.966662975778551), FRAC_CONST(0.256052126058264) }, + { FRAC_CONST(0.965819872559127), FRAC_CONST(0.259214146546579) }, + { FRAC_CONST(0.964966426184802), FRAC_CONST(0.262373391059634) }, + { FRAC_CONST(0.964102645795299), FRAC_CONST(0.265529825764461) }, + { FRAC_CONST(0.963228540641012), FRAC_CONST(0.268683416858178) }, + { FRAC_CONST(0.962344120082907), FRAC_CONST(0.271834130568359) }, + { FRAC_CONST(0.961449393592416), FRAC_CONST(0.274981933153391) }, + { FRAC_CONST(0.960544370751341), FRAC_CONST(0.278126790902837) }, + { FRAC_CONST(0.959629061251750), FRAC_CONST(0.281268670137799) }, + { FRAC_CONST(0.958703474895872), FRAC_CONST(0.284407537211272) }, + { FRAC_CONST(0.957767621595993), FRAC_CONST(0.287543358508512) }, + { FRAC_CONST(0.956821511374351), FRAC_CONST(0.290676100447394) }, + { FRAC_CONST(0.955865154363025), FRAC_CONST(0.293805729478766) }, + { FRAC_CONST(0.954898560803832), FRAC_CONST(0.296932212086818) }, + { FRAC_CONST(0.953921741048211), FRAC_CONST(0.300055514789431) }, + { FRAC_CONST(0.952934705557117), FRAC_CONST(0.303175604138543) }, + { FRAC_CONST(0.951937464900908), FRAC_CONST(0.306292446720504) }, + { FRAC_CONST(0.950930029759229), FRAC_CONST(0.309406009156434) }, + { FRAC_CONST(0.949912410920903), FRAC_CONST(0.312516258102580) }, + { FRAC_CONST(0.948884619283808), FRAC_CONST(0.315623160250676) }, + { FRAC_CONST(0.947846665854767), FRAC_CONST(0.318726682328294) }, + { FRAC_CONST(0.946798561749429), FRAC_CONST(0.321826791099207) }, + { FRAC_CONST(0.945740318192145), FRAC_CONST(0.324923453363742) }, + { FRAC_CONST(0.944671946515855), FRAC_CONST(0.328016635959131) }, + { FRAC_CONST(0.943593458161960), FRAC_CONST(0.331106305759876) }, + { FRAC_CONST(0.942504864680205), FRAC_CONST(0.334192429678095) }, + { FRAC_CONST(0.941406177728551), FRAC_CONST(0.337274974663880) }, + { FRAC_CONST(0.940297409073052), FRAC_CONST(0.340353907705650) }, + { FRAC_CONST(0.939178570587730), FRAC_CONST(0.343429195830507) }, + { FRAC_CONST(0.938049674254446), FRAC_CONST(0.346500806104585) }, + { FRAC_CONST(0.936910732162774), FRAC_CONST(0.349568705633406) }, + { FRAC_CONST(0.935761756509868), FRAC_CONST(0.352632861562230) }, + { FRAC_CONST(0.934602759600334), FRAC_CONST(0.355693241076410) }, + { FRAC_CONST(0.933433753846097), FRAC_CONST(0.358749811401739) }, + { FRAC_CONST(0.932254751766271), FRAC_CONST(0.361802539804806) }, + { FRAC_CONST(0.931065765987021), FRAC_CONST(0.364851393593340) }, + { FRAC_CONST(0.929866809241428), FRAC_CONST(0.367896340116568) }, + { FRAC_CONST(0.928657894369357), FRAC_CONST(0.370937346765559) }, + { FRAC_CONST(0.927439034317314), FRAC_CONST(0.373974380973575) }, + { FRAC_CONST(0.926210242138311), FRAC_CONST(0.377007410216418) }, + { FRAC_CONST(0.924971530991726), FRAC_CONST(0.380036402012783) }, + { FRAC_CONST(0.923722914143160), FRAC_CONST(0.383061323924602) }, + { FRAC_CONST(0.922464404964295), FRAC_CONST(0.386082143557389) }, + { FRAC_CONST(0.921196016932755), FRAC_CONST(0.389098828560595) }, + { FRAC_CONST(0.919917763631956), FRAC_CONST(0.392111346627946) }, + { FRAC_CONST(0.918629658750963), FRAC_CONST(0.395119665497795) }, + { FRAC_CONST(0.917331716084346), FRAC_CONST(0.398123752953462) }, + { FRAC_CONST(0.916023949532027), FRAC_CONST(0.401123576823585) }, + { FRAC_CONST(0.914706373099136), FRAC_CONST(0.404119104982459) }, + { FRAC_CONST(0.913379000895858), FRAC_CONST(0.407110305350386) }, + { FRAC_CONST(0.912041847137282), FRAC_CONST(0.410097145894012) }, + { FRAC_CONST(0.910694926143251), FRAC_CONST(0.413079594626675) }, + { FRAC_CONST(0.909338252338207), FRAC_CONST(0.416057619608744) }, + { FRAC_CONST(0.907971840251037), FRAC_CONST(0.419031188947965) }, + { FRAC_CONST(0.906595704514915), FRAC_CONST(0.422000270799800) }, + { FRAC_CONST(0.905209859867151), FRAC_CONST(0.424964833367766) }, + { FRAC_CONST(0.903814321149027), FRAC_CONST(0.427924844903780) }, + { FRAC_CONST(0.902409103305641), FRAC_CONST(0.430880273708497) }, + { FRAC_CONST(0.900994221385748), FRAC_CONST(0.433831088131649) }, + { FRAC_CONST(0.899569690541596), FRAC_CONST(0.436777256572384) }, + { FRAC_CONST(0.898135526028766), FRAC_CONST(0.439718747479604) }, + { FRAC_CONST(0.896691743206008), FRAC_CONST(0.442655529352306) }, + { FRAC_CONST(0.895238357535076), FRAC_CONST(0.445587570739915) }, + { FRAC_CONST(0.893775384580563), FRAC_CONST(0.448514840242624) }, + { FRAC_CONST(0.892302840009734), FRAC_CONST(0.451437306511726) }, + { FRAC_CONST(0.890820739592359), FRAC_CONST(0.454354938249958) }, + { FRAC_CONST(0.889329099200541), FRAC_CONST(0.457267704211826) }, + { FRAC_CONST(0.887827934808551), FRAC_CONST(0.460175573203949) }, + { FRAC_CONST(0.886317262492655), FRAC_CONST(0.463078514085383) }, + { FRAC_CONST(0.884797098430938), FRAC_CONST(0.465976495767966) }, + { FRAC_CONST(0.883267458903136), FRAC_CONST(0.468869487216642) }, + { FRAC_CONST(0.881728360290461), FRAC_CONST(0.471757457449795) }, + { FRAC_CONST(0.880179819075421), FRAC_CONST(0.474640375539586) }, + { FRAC_CONST(0.878621851841649), FRAC_CONST(0.477518210612278) }, + { FRAC_CONST(0.877054475273722), FRAC_CONST(0.480390931848569) }, + { FRAC_CONST(0.875477706156984), FRAC_CONST(0.483258508483922) }, + { FRAC_CONST(0.873891561377366), FRAC_CONST(0.486120909808896) }, + { FRAC_CONST(0.872296057921204), FRAC_CONST(0.488978105169472) }, + { FRAC_CONST(0.870691212875058), FRAC_CONST(0.491830063967383) }, + { FRAC_CONST(0.869077043425529), FRAC_CONST(0.494676755660442) }, + { FRAC_CONST(0.867453566859076), FRAC_CONST(0.497518149762867) }, + { FRAC_CONST(0.865820800561827), FRAC_CONST(0.500354215845611) }, + { FRAC_CONST(0.864178762019399), FRAC_CONST(0.503184923536685) }, + { FRAC_CONST(0.862527468816704), FRAC_CONST(0.506010242521482) }, + { FRAC_CONST(0.860866938637767), FRAC_CONST(0.508830142543107) }, + { FRAC_CONST(0.859197189265532), FRAC_CONST(0.511644593402696) }, + { FRAC_CONST(0.857518238581672), FRAC_CONST(0.514453564959741) }, + { FRAC_CONST(0.855830104566401), FRAC_CONST(0.517257027132414) }, + { FRAC_CONST(0.854132805298278), FRAC_CONST(0.520054949897887) }, + { FRAC_CONST(0.852426358954015), FRAC_CONST(0.522847303292655) }, + { FRAC_CONST(0.850710783808280), FRAC_CONST(0.525634057412856) }, + { FRAC_CONST(0.848986098233506), FRAC_CONST(0.528415182414593) }, + { FRAC_CONST(0.847252320699689), FRAC_CONST(0.531190648514252) }, + { FRAC_CONST(0.845509469774194), FRAC_CONST(0.533960425988819) }, + { FRAC_CONST(0.843757564121554), FRAC_CONST(0.536724485176205) }, + { FRAC_CONST(0.841996622503271), FRAC_CONST(0.539482796475555) }, + { FRAC_CONST(0.840226663777615), FRAC_CONST(0.542235330347571) }, + { FRAC_CONST(0.838447706899422), FRAC_CONST(0.544982057314827) }, + { FRAC_CONST(0.836659770919891), FRAC_CONST(0.547722947962084) }, + { FRAC_CONST(0.834862874986380), FRAC_CONST(0.550457972936605) }, + { FRAC_CONST(0.833057038342201), FRAC_CONST(0.553187102948470) }, + { FRAC_CONST(0.831242280326413), FRAC_CONST(0.555910308770889) }, + { FRAC_CONST(0.829418620373617), FRAC_CONST(0.558627561240515) }, + { FRAC_CONST(0.827586078013746), FRAC_CONST(0.561338831257758) }, + { FRAC_CONST(0.825744672871856), FRAC_CONST(0.564044089787093) }, + { FRAC_CONST(0.823894424667918), FRAC_CONST(0.566743307857377) }, + { FRAC_CONST(0.822035353216601), FRAC_CONST(0.569436456562150) }, + { FRAC_CONST(0.820167478427070), FRAC_CONST(0.572123507059955) }, + { FRAC_CONST(0.818290820302761), FRAC_CONST(0.574804430574639) }, + { FRAC_CONST(0.816405398941175), FRAC_CONST(0.577479198395666) }, + { FRAC_CONST(0.814511234533661), FRAC_CONST(0.580147781878420) }, + { FRAC_CONST(0.812608347365198), FRAC_CONST(0.582810152444517) }, + { FRAC_CONST(0.810696757814178), FRAC_CONST(0.585466281582107) }, + { FRAC_CONST(0.808776486352191), FRAC_CONST(0.588116140846181) }, + { FRAC_CONST(0.806847553543799), FRAC_CONST(0.590759701858874) }, + { FRAC_CONST(0.804909980046325), FRAC_CONST(0.593396936309773) }, + { FRAC_CONST(0.802963786609623), FRAC_CONST(0.596027815956215) }, + { FRAC_CONST(0.801008994075862), FRAC_CONST(0.598652312623592) }, + { FRAC_CONST(0.799045623379300), FRAC_CONST(0.601270398205654) }, + { FRAC_CONST(0.797073695546059), FRAC_CONST(0.603882044664808) }, + { FRAC_CONST(0.795093231693901), FRAC_CONST(0.606487224032418) }, + { FRAC_CONST(0.793104253032005), FRAC_CONST(0.609085908409106) }, + { FRAC_CONST(0.791106780860733), FRAC_CONST(0.611678069965050) }, + { FRAC_CONST(0.789100836571407), FRAC_CONST(0.614263680940283) }, + { FRAC_CONST(0.787086441646080), FRAC_CONST(0.616842713644988) }, + { FRAC_CONST(0.785063617657302), FRAC_CONST(0.619415140459796) }, + { FRAC_CONST(0.783032386267894), FRAC_CONST(0.621980933836084) }, + { FRAC_CONST(0.780992769230711), FRAC_CONST(0.624540066296266) }, + { FRAC_CONST(0.778944788388414), FRAC_CONST(0.627092510434089) }, + { FRAC_CONST(0.776888465673232), FRAC_CONST(0.629638238914927) }, + { FRAC_CONST(0.774823823106730), FRAC_CONST(0.632177224476073) }, + { FRAC_CONST(0.772750882799570), FRAC_CONST(0.634709439927031) }, + { FRAC_CONST(0.770669666951277), FRAC_CONST(0.637234858149809) }, + { FRAC_CONST(0.768580197850002), FRAC_CONST(0.639753452099206) }, + { FRAC_CONST(0.766482497872280), FRAC_CONST(0.642265194803105) }, + { FRAC_CONST(0.764376589482793), FRAC_CONST(0.644770059362758) }, + { FRAC_CONST(0.762262495234126), FRAC_CONST(0.647268018953079) }, + { FRAC_CONST(0.760140237766532), FRAC_CONST(0.649759046822928) }, + { FRAC_CONST(0.758009839807683), FRAC_CONST(0.652243116295397) }, + { FRAC_CONST(0.755871324172429), FRAC_CONST(0.654720200768098) }, + { FRAC_CONST(0.753724713762555), FRAC_CONST(0.657190273713446) }, + { FRAC_CONST(0.751570031566534), FRAC_CONST(0.659653308678945) }, + { FRAC_CONST(0.749407300659280), FRAC_CONST(0.662109279287469) }, + { FRAC_CONST(0.747236544201905), FRAC_CONST(0.664558159237545) }, + { FRAC_CONST(0.745057785441466), FRAC_CONST(0.666999922303638) }, + { FRAC_CONST(0.742871047710719), FRAC_CONST(0.669434542336425) }, + { FRAC_CONST(0.740676354427868), FRAC_CONST(0.671861993263083) }, + { FRAC_CONST(0.738473729096316), FRAC_CONST(0.674282249087562) }, + { FRAC_CONST(0.736263195304409), FRAC_CONST(0.676695283890867) }, + { FRAC_CONST(0.734044776725190), FRAC_CONST(0.679101071831334) }, + { FRAC_CONST(0.731818497116138), FRAC_CONST(0.681499587144906) }, + { FRAC_CONST(0.729584380318920), FRAC_CONST(0.683890804145412) }, + { FRAC_CONST(0.727342450259131), FRAC_CONST(0.686274697224838) }, + { FRAC_CONST(0.725092730946042), FRAC_CONST(0.688651240853606) }, + { FRAC_CONST(0.722835246472338), FRAC_CONST(0.691020409580841) }, + { FRAC_CONST(0.720570021013866), FRAC_CONST(0.693382178034651) }, + { FRAC_CONST(0.718297078829369), FRAC_CONST(0.695736520922392) }, + { FRAC_CONST(0.716016444260233), FRAC_CONST(0.698083413030944) }, + { FRAC_CONST(0.713728141730222), FRAC_CONST(0.700422829226978) }, + { FRAC_CONST(0.711432195745216), FRAC_CONST(0.702754744457225) }, + { FRAC_CONST(0.709128630892954), FRAC_CONST(0.705079133748748) }, + { FRAC_CONST(0.706817471842764), FRAC_CONST(0.707395972209203) }, + { FRAC_CONST(0.704498743345302), FRAC_CONST(0.709705235027113) }, + { FRAC_CONST(0.702172470232289), FRAC_CONST(0.712006897472128) }, + { FRAC_CONST(0.699838677416240), FRAC_CONST(0.714300934895292) }, + { FRAC_CONST(0.697497389890200), FRAC_CONST(0.716587322729308) }, + { FRAC_CONST(0.695148632727480), FRAC_CONST(0.718866036488799) }, + { FRAC_CONST(0.692792431081381), FRAC_CONST(0.721137051770570) }, + { FRAC_CONST(0.690428810184929), FRAC_CONST(0.723400344253874) }, + { FRAC_CONST(0.688057795350606), FRAC_CONST(0.725655889700665) }, + { FRAC_CONST(0.685679411970075), FRAC_CONST(0.727903663955865) }, + { FRAC_CONST(0.683293685513912), FRAC_CONST(0.730143642947616) }, + { FRAC_CONST(0.680900641531330), FRAC_CONST(0.732375802687543) }, + { FRAC_CONST(0.678500305649909), FRAC_CONST(0.734600119271009) }, + { FRAC_CONST(0.676092703575316), FRAC_CONST(0.736816568877370) }, + { FRAC_CONST(0.673677861091036), FRAC_CONST(0.739025127770231) }, + { FRAC_CONST(0.671255804058092), FRAC_CONST(0.741225772297702) }, + { FRAC_CONST(0.668826558414768), FRAC_CONST(0.743418478892647) }, + { FRAC_CONST(0.666390150176334), FRAC_CONST(0.745603224072940) }, + { FRAC_CONST(0.663946605434765), FRAC_CONST(0.747779984441716) }, + { FRAC_CONST(0.661495950358462), FRAC_CONST(0.749948736687619) }, + { FRAC_CONST(0.659038211191971), FRAC_CONST(0.752109457585056) }, + { FRAC_CONST(0.656573414255705), FRAC_CONST(0.754262123994441) }, + { FRAC_CONST(0.654101585945659), FRAC_CONST(0.756406712862448) }, + { FRAC_CONST(0.651622752733128), FRAC_CONST(0.758543201222251) }, + { FRAC_CONST(0.649136941164425), FRAC_CONST(0.760671566193777) }, + { FRAC_CONST(0.646644177860593), FRAC_CONST(0.762791784983948) }, + { FRAC_CONST(0.644144489517126), FRAC_CONST(0.764903834886923) }, + { FRAC_CONST(0.641637902903677), FRAC_CONST(0.767007693284345) }, + { FRAC_CONST(0.639124444863776), FRAC_CONST(0.769103337645580) }, + { FRAC_CONST(0.636604142314538), FRAC_CONST(0.771190745527961) }, + { FRAC_CONST(0.634077022246379), FRAC_CONST(0.773269894577026) }, + { FRAC_CONST(0.631543111722725), FRAC_CONST(0.775340762526760) }, + { FRAC_CONST(0.629002437879721), FRAC_CONST(0.777403327199831) }, + { FRAC_CONST(0.626455027925944), FRAC_CONST(0.779457566507828) }, + { FRAC_CONST(0.623900909142107), FRAC_CONST(0.781503458451498) }, + { FRAC_CONST(0.621340108880771), FRAC_CONST(0.783540981120982) }, + { FRAC_CONST(0.618772654566049), FRAC_CONST(0.785570112696050) }, + { FRAC_CONST(0.616198573693314), FRAC_CONST(0.787590831446332) }, + { FRAC_CONST(0.613617893828905), FRAC_CONST(0.789603115731555) }, + { FRAC_CONST(0.611030642609828), FRAC_CONST(0.791606944001769) }, + { FRAC_CONST(0.608436847743468), FRAC_CONST(0.793602294797585) }, + { FRAC_CONST(0.605836537007281), FRAC_CONST(0.795589146750397) }, + { FRAC_CONST(0.603229738248508), FRAC_CONST(0.797567478582619) }, + { FRAC_CONST(0.600616479383869), FRAC_CONST(0.799537269107905) }, + { FRAC_CONST(0.597996788399267), FRAC_CONST(0.801498497231381) }, + { FRAC_CONST(0.595370693349487), FRAC_CONST(0.803451141949871) }, + { FRAC_CONST(0.592738222357898), FRAC_CONST(0.805395182352117) }, + { FRAC_CONST(0.590099403616149), FRAC_CONST(0.807330597619008) }, + { FRAC_CONST(0.587454265383869), FRAC_CONST(0.809257367023803) }, + { FRAC_CONST(0.584802835988364), FRAC_CONST(0.811175469932349) }, + { FRAC_CONST(0.582145143824311), FRAC_CONST(0.813084885803304) }, + { FRAC_CONST(0.579481217353460), FRAC_CONST(0.814985594188359) }, + { FRAC_CONST(0.576811085104321), FRAC_CONST(0.816877574732454) }, + { FRAC_CONST(0.574134775671867), FRAC_CONST(0.818760807173997) }, + { FRAC_CONST(0.571452317717222), FRAC_CONST(0.820635271345081) }, + { FRAC_CONST(0.568763739967354), FRAC_CONST(0.822500947171703) }, + { FRAC_CONST(0.566069071214772), FRAC_CONST(0.824357814673971) }, + { FRAC_CONST(0.563368340317214), FRAC_CONST(0.826205853966327) }, + { FRAC_CONST(0.560661576197336), FRAC_CONST(0.828045045257756) }, + { FRAC_CONST(0.557948807842409), FRAC_CONST(0.829875368851995) }, + { FRAC_CONST(0.555230064304002), FRAC_CONST(0.831696805147750) }, + { FRAC_CONST(0.552505374697674), FRAC_CONST(0.833509334638900) }, + { FRAC_CONST(0.549774768202663), FRAC_CONST(0.835312937914713) }, + { FRAC_CONST(0.547038274061568), FRAC_CONST(0.837107595660044) }, + { FRAC_CONST(0.544295921580046), FRAC_CONST(0.838893288655553) }, + { FRAC_CONST(0.541547740126486), FRAC_CONST(0.840669997777901) }, + { FRAC_CONST(0.538793759131706), FRAC_CONST(0.842437703999961) }, + { FRAC_CONST(0.536034008088628), FRAC_CONST(0.844196388391019) }, + { FRAC_CONST(0.533268516551970), FRAC_CONST(0.845946032116980) }, + { FRAC_CONST(0.530497314137923), FRAC_CONST(0.847686616440563) }, + { FRAC_CONST(0.527720430523840), FRAC_CONST(0.849418122721510) }, + { FRAC_CONST(0.524937895447912), FRAC_CONST(0.851140532416778) }, + { FRAC_CONST(0.522149738708856), FRAC_CONST(0.852853827080745) }, + { FRAC_CONST(0.519355990165590), FRAC_CONST(0.854557988365401) }, + { FRAC_CONST(0.516556679736915), FRAC_CONST(0.856252998020546) }, + { FRAC_CONST(0.513751837401199), FRAC_CONST(0.857938837893991) }, + { FRAC_CONST(0.510941493196049), FRAC_CONST(0.859615489931744) }, + { FRAC_CONST(0.508125677217994), FRAC_CONST(0.861282936178208) }, + { FRAC_CONST(0.505304419622159), FRAC_CONST(0.862941158776375) }, + { FRAC_CONST(0.502477750621949), FRAC_CONST(0.864590139968012) }, + { FRAC_CONST(0.499645700488717), FRAC_CONST(0.866229862093855) }, + { FRAC_CONST(0.496808299551444), FRAC_CONST(0.867860307593799) }, + { FRAC_CONST(0.493965578196415), FRAC_CONST(0.869481459007080) }, + { FRAC_CONST(0.491117566866892), FRAC_CONST(0.871093298972471) }, + { FRAC_CONST(0.488264296062789), FRAC_CONST(0.872695810228461) }, + { FRAC_CONST(0.485405796340343), FRAC_CONST(0.874288975613440) }, + { FRAC_CONST(0.482542098311789), FRAC_CONST(0.875872778065888) }, + { FRAC_CONST(0.479673232645033), FRAC_CONST(0.877447200624553) }, + { FRAC_CONST(0.476799230063322), FRAC_CONST(0.879012226428633) }, + { FRAC_CONST(0.473920121344914), FRAC_CONST(0.880567838717962) }, + { FRAC_CONST(0.471035937322751), FRAC_CONST(0.882114020833179) }, + { FRAC_CONST(0.468146708884125), FRAC_CONST(0.883650756215917) }, + { FRAC_CONST(0.465252466970353), FRAC_CONST(0.885178028408975) }, + { FRAC_CONST(0.462353242576441), FRAC_CONST(0.886695821056495) }, + { FRAC_CONST(0.459449066750752), FRAC_CONST(0.888204117904136) }, + { FRAC_CONST(0.456539970594675), FRAC_CONST(0.889702902799251) }, + { FRAC_CONST(0.453625985262295), FRAC_CONST(0.891192159691058) }, + { FRAC_CONST(0.450707141960053), FRAC_CONST(0.892671872630812) }, + { FRAC_CONST(0.447783471946415), FRAC_CONST(0.894142025771977) }, + { FRAC_CONST(0.444855006531538), FRAC_CONST(0.895602603370393) }, + { FRAC_CONST(0.441921777076935), FRAC_CONST(0.897053589784447) }, + { FRAC_CONST(0.438983814995137), FRAC_CONST(0.898494969475242) }, + { FRAC_CONST(0.436041151749356), FRAC_CONST(0.899926727006758) }, + { FRAC_CONST(0.433093818853152), FRAC_CONST(0.901348847046022) }, + { FRAC_CONST(0.430141847870093), FRAC_CONST(0.902761314363272) }, + { FRAC_CONST(0.427185270413416), FRAC_CONST(0.904164113832116) }, + { FRAC_CONST(0.424224118145690), FRAC_CONST(0.905557230429701) }, + { FRAC_CONST(0.421258422778478), FRAC_CONST(0.906940649236866) }, + { FRAC_CONST(0.418288216071994), FRAC_CONST(0.908314355438308) }, + { FRAC_CONST(0.415313529834766), FRAC_CONST(0.909678334322736) }, + { FRAC_CONST(0.412334395923293), FRAC_CONST(0.911032571283032) }, + { FRAC_CONST(0.409350846241706), FRAC_CONST(0.912377051816407) }, + { FRAC_CONST(0.406362912741425), FRAC_CONST(0.913711761524555) }, + { FRAC_CONST(0.403370627420818), FRAC_CONST(0.915036686113806) }, + { FRAC_CONST(0.400374022324857), FRAC_CONST(0.916351811395282) }, + { FRAC_CONST(0.397373129544774), FRAC_CONST(0.917657123285050) }, + { FRAC_CONST(0.394367981217720), FRAC_CONST(0.918952607804266) }, + { FRAC_CONST(0.391358609526420), FRAC_CONST(0.920238251079332) }, + { FRAC_CONST(0.388345046698826), FRAC_CONST(0.921514039342042) }, + { FRAC_CONST(0.385327325007776), FRAC_CONST(0.922779958929729) }, + { FRAC_CONST(0.382305476770645), FRAC_CONST(0.924035996285410) }, + { FRAC_CONST(0.379279534348999), FRAC_CONST(0.925282137957935) }, + { FRAC_CONST(0.376249530148250), FRAC_CONST(0.926518370602127) }, + { FRAC_CONST(0.373215496617310), FRAC_CONST(0.927744680978929) }, + { FRAC_CONST(0.370177466248239), FRAC_CONST(0.928961055955541) }, + { FRAC_CONST(0.367135471575903), FRAC_CONST(0.930167482505564) }, + { FRAC_CONST(0.364089545177621), FRAC_CONST(0.931363947709140) }, + { FRAC_CONST(0.361039719672816), FRAC_CONST(0.932550438753087) }, + { FRAC_CONST(0.357986027722671), FRAC_CONST(0.933726942931039) }, + { FRAC_CONST(0.354928502029772), FRAC_CONST(0.934893447643582) }, + { FRAC_CONST(0.351867175337763), FRAC_CONST(0.936049940398387) }, + { FRAC_CONST(0.348802080430994), FRAC_CONST(0.937196408810347) }, + { FRAC_CONST(0.345733250134169), FRAC_CONST(0.938332840601705) }, + { FRAC_CONST(0.342660717311994), FRAC_CONST(0.939459223602190) }, + { FRAC_CONST(0.339584514868829), FRAC_CONST(0.940575545749145) }, + { FRAC_CONST(0.336504675748328), FRAC_CONST(0.941681795087657) }, + { FRAC_CONST(0.333421232933097), FRAC_CONST(0.942777959770684) }, + { FRAC_CONST(0.330334219444328), FRAC_CONST(0.943864028059183) }, + { FRAC_CONST(0.327243668341457), FRAC_CONST(0.944939988322235) }, + { FRAC_CONST(0.324149612721804), FRAC_CONST(0.946005829037171) }, + { FRAC_CONST(0.321052085720218), FRAC_CONST(0.947061538789691) }, + { FRAC_CONST(0.317951120508725), FRAC_CONST(0.948107106273994) }, + { FRAC_CONST(0.314846750296171), FRAC_CONST(0.949142520292891) }, + { FRAC_CONST(0.311739008327867), FRAC_CONST(0.950167769757930) }, + { FRAC_CONST(0.308627927885232), FRAC_CONST(0.951182843689513) }, + { FRAC_CONST(0.305513542285440), FRAC_CONST(0.952187731217013) }, + { FRAC_CONST(0.302395884881056), FRAC_CONST(0.953182421578893) }, + { FRAC_CONST(0.299274989059689), FRAC_CONST(0.954166904122818) }, + { FRAC_CONST(0.296150888243624), FRAC_CONST(0.955141168305771) }, + { FRAC_CONST(0.293023615889471), FRAC_CONST(0.956105203694164) }, + { FRAC_CONST(0.289893205487806), FRAC_CONST(0.957058999963955) }, + { FRAC_CONST(0.286759690562807), FRAC_CONST(0.958002546900750) }, + { FRAC_CONST(0.283623104671904), FRAC_CONST(0.958935834399920) }, + { FRAC_CONST(0.280483481405410), FRAC_CONST(0.959858852466706) }, + { FRAC_CONST(0.277340854386169), FRAC_CONST(0.960771591216325) }, + { FRAC_CONST(0.274195257269191), FRAC_CONST(0.961674040874080) }, + { FRAC_CONST(0.271046723741295), FRAC_CONST(0.962566191775459) }, + { FRAC_CONST(0.267895287520743), FRAC_CONST(0.963448034366243) }, + { FRAC_CONST(0.264740982356888), FRAC_CONST(0.964319559202607) }, + { FRAC_CONST(0.261583842029803), FRAC_CONST(0.965180756951218) }, + { FRAC_CONST(0.258423900349924), FRAC_CONST(0.966031618389343) }, + { FRAC_CONST(0.255261191157689), FRAC_CONST(0.966872134404937) }, + { FRAC_CONST(0.252095748323171), FRAC_CONST(0.967702295996750) }, + { FRAC_CONST(0.248927605745720), FRAC_CONST(0.968522094274417) }, + { FRAC_CONST(0.245756797353599), FRAC_CONST(0.969331520458559) }, + { FRAC_CONST(0.242583357103617), FRAC_CONST(0.970130565880871) }, + { FRAC_CONST(0.239407318980770), FRAC_CONST(0.970919221984218) }, + { FRAC_CONST(0.236228716997876), FRAC_CONST(0.971697480322728) }, + { FRAC_CONST(0.233047585195206), FRAC_CONST(0.972465332561878) }, + { FRAC_CONST(0.229863957640129), FRAC_CONST(0.973222770478587) }, + { FRAC_CONST(0.226677868426735), FRAC_CONST(0.973969785961306) }, + { FRAC_CONST(0.223489351675482), FRAC_CONST(0.974706371010097) }, + { FRAC_CONST(0.220298441532823), FRAC_CONST(0.975432517736727) }, + { FRAC_CONST(0.217105172170841), FRAC_CONST(0.976148218364747) }, + { FRAC_CONST(0.213909577786886), FRAC_CONST(0.976853465229579) }, + { FRAC_CONST(0.210711692603206), FRAC_CONST(0.977548250778596) }, + { FRAC_CONST(0.207511550866582), FRAC_CONST(0.978232567571202) }, + { FRAC_CONST(0.204309186847962), FRAC_CONST(0.978906408278914) }, + { FRAC_CONST(0.201104634842092), FRAC_CONST(0.979569765685441) }, + { FRAC_CONST(0.197897929167148), FRAC_CONST(0.980222632686756) }, + { FRAC_CONST(0.194689104164373), FRAC_CONST(0.980865002291179) }, + { FRAC_CONST(0.191478194197704), FRAC_CONST(0.981496867619447) }, + { FRAC_CONST(0.188265233653407), FRAC_CONST(0.982118221904791) }, + { FRAC_CONST(0.185050256939710), FRAC_CONST(0.982729058493005) }, + { FRAC_CONST(0.181833298486427), FRAC_CONST(0.983329370842520) }, + { FRAC_CONST(0.178614392744603), FRAC_CONST(0.983919152524473) }, + { FRAC_CONST(0.175393574186129), FRAC_CONST(0.984498397222776) }, + { FRAC_CONST(0.172170877303385), FRAC_CONST(0.985067098734184) }, + { FRAC_CONST(0.168946336608867), FRAC_CONST(0.985625250968360) }, + { FRAC_CONST(0.165719986634814), FRAC_CONST(0.986172847947943) }, + { FRAC_CONST(0.162491861932842), FRAC_CONST(0.986709883808609) }, + { FRAC_CONST(0.159261997073573), FRAC_CONST(0.987236352799134) }, + { FRAC_CONST(0.156030426646266), FRAC_CONST(0.987752249281460) }, + { FRAC_CONST(0.152797185258443), FRAC_CONST(0.988257567730749) }, + { FRAC_CONST(0.149562307535523), FRAC_CONST(0.988752302735447) }, + { FRAC_CONST(0.146325828120446), FRAC_CONST(0.989236448997339) }, + { FRAC_CONST(0.143087781673307), FRAC_CONST(0.989710001331608) }, + { FRAC_CONST(0.139848202870981), FRAC_CONST(0.990172954666889) }, + { FRAC_CONST(0.136607126406757), FRAC_CONST(0.990625304045323) }, + { FRAC_CONST(0.133364586989957), FRAC_CONST(0.991067044622612) }, + { FRAC_CONST(0.130120619345575), FRAC_CONST(0.991498171668069) }, + { FRAC_CONST(0.126875258213898), FRAC_CONST(0.991918680564670) }, + { FRAC_CONST(0.123628538350136), FRAC_CONST(0.992328566809103) }, + { FRAC_CONST(0.120380494524051), FRAC_CONST(0.992727826011815) }, + { FRAC_CONST(0.117131161519582), FRAC_CONST(0.993116453897061) }, + { FRAC_CONST(0.113880574134475), FRAC_CONST(0.993494446302948) }, + { FRAC_CONST(0.110628767179910), FRAC_CONST(0.993861799181482) }, + { FRAC_CONST(0.107375775480128), FRAC_CONST(0.994218508598608) }, + { FRAC_CONST(0.104121633872055), FRAC_CONST(0.994564570734255) }, + { FRAC_CONST(0.100866377204933), FRAC_CONST(0.994899981882376) }, + { FRAC_CONST(0.097610040339947), FRAC_CONST(0.995224738450986) }, + { FRAC_CONST(0.094352658149849), FRAC_CONST(0.995538836962204) }, + { FRAC_CONST(0.091094265518583), FRAC_CONST(0.995842274052287) }, + { FRAC_CONST(0.087834897340919), FRAC_CONST(0.996135046471667) }, + { FRAC_CONST(0.084574588522070), FRAC_CONST(0.996417151084987) }, + { FRAC_CONST(0.081313373977324), FRAC_CONST(0.996688584871134) }, + { FRAC_CONST(0.078051288631670), FRAC_CONST(0.996949344923269) }, + { FRAC_CONST(0.074788367419420), FRAC_CONST(0.997199428448862) }, + { FRAC_CONST(0.071524645283840), FRAC_CONST(0.997438832769720) }, + { FRAC_CONST(0.068260157176771), FRAC_CONST(0.997667555322013) }, + { FRAC_CONST(0.064994938058259), FRAC_CONST(0.997885593656308) }, + { FRAC_CONST(0.061729022896176), FRAC_CONST(0.998092945437590) }, + { FRAC_CONST(0.058462446665851), FRAC_CONST(0.998289608445286) }, + { FRAC_CONST(0.055195244349690), FRAC_CONST(0.998475580573295) }, + { FRAC_CONST(0.051927450936806), FRAC_CONST(0.998650859830004) }, + { FRAC_CONST(0.048659101422640), FRAC_CONST(0.998815444338313) }, + { FRAC_CONST(0.045390230808591), FRAC_CONST(0.998969332335654) }, + { FRAC_CONST(0.042120874101635), FRAC_CONST(0.999112522174011) }, + { FRAC_CONST(0.038851066313958), FRAC_CONST(0.999245012319936) }, + { FRAC_CONST(0.035580842462574), FRAC_CONST(0.999366801354564) }, + { FRAC_CONST(0.032310237568951), FRAC_CONST(0.999477887973635) }, + { FRAC_CONST(0.029039286658643), FRAC_CONST(0.999578270987499) }, + { FRAC_CONST(0.025768024760904), FRAC_CONST(0.999667949321134) }, + { FRAC_CONST(0.022496486908322), FRAC_CONST(0.999746922014158) }, + { FRAC_CONST(0.019224708136438), FRAC_CONST(0.999815188220837) }, + { FRAC_CONST(0.015952723483375), FRAC_CONST(0.999872747210095) }, + { FRAC_CONST(0.012680567989461), FRAC_CONST(0.999919598365521) }, + { FRAC_CONST(0.009408276696850), FRAC_CONST(0.999955741185376) }, + { FRAC_CONST(0.006135884649155), FRAC_CONST(0.999981175282601) }, + { FRAC_CONST(0.002863426891064), FRAC_CONST(0.999995900384816) } +}; + +#ifdef LD_DEC +/* 240 (N/4) complex twiddle factors */ +ALIGN static const complex_t mdct_tab_960[] = +{ + { FRAC_CONST(0.999999665337326), FRAC_CONST(0.000818122995607) }, + { FRAC_CONST(0.999972892444367), FRAC_CONST(0.007363041249780) }, + { FRAC_CONST(0.999903284040864), FRAC_CONST(0.013907644095771) }, + { FRAC_CONST(0.999790843108610), FRAC_CONST(0.020451651184577) }, + { FRAC_CONST(0.999635574464198), FRAC_CONST(0.026994782192715) }, + { FRAC_CONST(0.999437484758823), FRAC_CONST(0.033536756834230) }, + { FRAC_CONST(0.999196582477986), FRAC_CONST(0.040077294872701) }, + { FRAC_CONST(0.998912877941140), FRAC_CONST(0.046616116133247) }, + { FRAC_CONST(0.998586383301244), FRAC_CONST(0.053152940514528) }, + { FRAC_CONST(0.998217112544241), FRAC_CONST(0.059687488000744) }, + { FRAC_CONST(0.997805081488460), FRAC_CONST(0.066219478673630) }, + { FRAC_CONST(0.997350307783942), FRAC_CONST(0.072748632724445) }, + { FRAC_CONST(0.996852810911678), FRAC_CONST(0.079274670465961) }, + { FRAC_CONST(0.996312612182778), FRAC_CONST(0.085797312344440) }, + { FRAC_CONST(0.995729734737558), FRAC_CONST(0.092316278951614) }, + { FRAC_CONST(0.995104203544548), FRAC_CONST(0.098831291036650) }, + { FRAC_CONST(0.994436045399422), FRAC_CONST(0.105342069518114) }, + { FRAC_CONST(0.993725288923851), FRAC_CONST(0.111848335495926) }, + { FRAC_CONST(0.992971964564277), FRAC_CONST(0.118349810263305) }, + { FRAC_CONST(0.992176104590608), FRAC_CONST(0.124846215318711) }, + { FRAC_CONST(0.991337743094838), FRAC_CONST(0.131337272377774) }, + { FRAC_CONST(0.990456915989581), FRAC_CONST(0.137822703385212) }, + { FRAC_CONST(0.989533661006540), FRAC_CONST(0.144302230526747) }, + { FRAC_CONST(0.988568017694885), FRAC_CONST(0.150775576241001) }, + { FRAC_CONST(0.987560027419562), FRAC_CONST(0.157242463231389) }, + { FRAC_CONST(0.986509733359519), FRAC_CONST(0.163702614477995) }, + { FRAC_CONST(0.985417180505858), FRAC_CONST(0.170155753249442) }, + { FRAC_CONST(0.984282415659907), FRAC_CONST(0.176601603114742) }, + { FRAC_CONST(0.983105487431216), FRAC_CONST(0.183039887955141) }, + { FRAC_CONST(0.981886446235473), FRAC_CONST(0.189470331975943) }, + { FRAC_CONST(0.980625344292344), FRAC_CONST(0.195892659718330) }, + { FRAC_CONST(0.979322235623241), FRAC_CONST(0.202306596071156) }, + { FRAC_CONST(0.977977176049000), FRAC_CONST(0.208711866282735) }, + { FRAC_CONST(0.976590223187499), FRAC_CONST(0.215108195972610) }, + { FRAC_CONST(0.975161436451181), FRAC_CONST(0.221495311143304) }, + { FRAC_CONST(0.973690877044515), FRAC_CONST(0.227872938192063) }, + { FRAC_CONST(0.972178607961371), FRAC_CONST(0.234240803922570) }, + { FRAC_CONST(0.970624693982323), FRAC_CONST(0.240598635556650) }, + { FRAC_CONST(0.969029201671875), FRAC_CONST(0.246946160745958) }, + { FRAC_CONST(0.967392199375607), FRAC_CONST(0.253283107583640) }, + { FRAC_CONST(0.965713757217249), FRAC_CONST(0.259609204615985) }, + { FRAC_CONST(0.963993947095677), FRAC_CONST(0.265924180854051) }, + { FRAC_CONST(0.962232842681832), FRAC_CONST(0.272227765785273) }, + { FRAC_CONST(0.960430519415566), FRAC_CONST(0.278519689385053) }, + { FRAC_CONST(0.958587054502409), FRAC_CONST(0.284799682128326) }, + { FRAC_CONST(0.956702526910263), FRAC_CONST(0.291067475001103) }, + { FRAC_CONST(0.954777017366017), FRAC_CONST(0.297322799511998) }, + { FRAC_CONST(0.952810608352092), FRAC_CONST(0.303565387703730) }, + { FRAC_CONST(0.950803384102905), FRAC_CONST(0.309794972164597) }, + { FRAC_CONST(0.948755430601263), FRAC_CONST(0.316011286039934) }, + { FRAC_CONST(0.946666835574676), FRAC_CONST(0.322214063043544) }, + { FRAC_CONST(0.944537688491606), FRAC_CONST(0.328403037469105) }, + { FRAC_CONST(0.942368080557626), FRAC_CONST(0.334577944201551) }, + { FRAC_CONST(0.940158104711519), FRAC_CONST(0.340738518728429) }, + { FRAC_CONST(0.937907855621296), FRAC_CONST(0.346884497151231) }, + { FRAC_CONST(0.935617429680138), FRAC_CONST(0.353015616196696) }, + { FRAC_CONST(0.933286925002268), FRAC_CONST(0.359131613228090) }, + { FRAC_CONST(0.930916441418752), FRAC_CONST(0.365232226256457) }, + { FRAC_CONST(0.928506080473216), FRAC_CONST(0.371317193951838) }, + { FRAC_CONST(0.926055945417500), FRAC_CONST(0.377386255654469) }, + { FRAC_CONST(0.923566141207236), FRAC_CONST(0.383439151385947) }, + { FRAC_CONST(0.921036774497350), FRAC_CONST(0.389475621860365) }, + { FRAC_CONST(0.918467953637492), FRAC_CONST(0.395495408495417) }, + { FRAC_CONST(0.915859788667400), FRAC_CONST(0.401498253423481) }, + { FRAC_CONST(0.913212391312179), FRAC_CONST(0.407483899502658) }, + { FRAC_CONST(0.910525874977521), FRAC_CONST(0.413452090327791) }, + { FRAC_CONST(0.907800354744844), FRAC_CONST(0.419402570241451) }, + { FRAC_CONST(0.905035947366364), FRAC_CONST(0.425335084344881) }, + { FRAC_CONST(0.902232771260093), FRAC_CONST(0.431249378508924) }, + { FRAC_CONST(0.899390946504764), FRAC_CONST(0.437145199384900) }, + { FRAC_CONST(0.896510594834693), FRAC_CONST(0.443022294415467) }, + { FRAC_CONST(0.893591839634558), FRAC_CONST(0.448880411845433) }, + { FRAC_CONST(0.890634805934118), FRAC_CONST(0.454719300732547) }, + { FRAC_CONST(0.887639620402854), FRAC_CONST(0.460538710958240) }, + { FRAC_CONST(0.884606411344546), FRAC_CONST(0.466338393238348) }, + { FRAC_CONST(0.881535308691775), FRAC_CONST(0.472118099133784) }, + { FRAC_CONST(0.878426444000357), FRAC_CONST(0.477877581061184) }, + { FRAC_CONST(0.875279950443708), FRAC_CONST(0.483616592303511) }, + { FRAC_CONST(0.872095962807140), FRAC_CONST(0.489334887020625) }, + { FRAC_CONST(0.868874617482085), FRAC_CONST(0.495032220259813) }, + { FRAC_CONST(0.865616052460258), FRAC_CONST(0.500708347966279) }, + { FRAC_CONST(0.862320407327736), FRAC_CONST(0.506363026993605) }, + { FRAC_CONST(0.858987823258990), FRAC_CONST(0.511996015114162) }, + { FRAC_CONST(0.855618443010829), FRAC_CONST(0.517607071029487) }, + { FRAC_CONST(0.852212410916289), FRAC_CONST(0.523195954380619) }, + { FRAC_CONST(0.848769872878448), FRAC_CONST(0.528762425758396) }, + { FRAC_CONST(0.845290976364179), FRAC_CONST(0.534306246713712) }, + { FRAC_CONST(0.841775870397828), FRAC_CONST(0.539827179767727) }, + { FRAC_CONST(0.838224705554838), FRAC_CONST(0.545324988422046) }, + { FRAC_CONST(0.834637633955290), FRAC_CONST(0.550799437168844) }, + { FRAC_CONST(0.831014809257393), FRAC_CONST(0.556250291500956) }, + { FRAC_CONST(0.827356386650900), FRAC_CONST(0.561677317921925) }, + { FRAC_CONST(0.823662522850458), FRAC_CONST(0.567080283956001) }, + { FRAC_CONST(0.819933376088899), FRAC_CONST(0.572458958158102) }, + { FRAC_CONST(0.816169106110459), FRAC_CONST(0.577813110123727) }, + { FRAC_CONST(0.812369874163934), FRAC_CONST(0.583142510498826) }, + { FRAC_CONST(0.808535842995778), FRAC_CONST(0.588446930989624) }, + { FRAC_CONST(0.804667176843123), FRAC_CONST(0.593726144372402) }, + { FRAC_CONST(0.800764041426753), FRAC_CONST(0.598979924503229) }, + { FRAC_CONST(0.796826603943998), FRAC_CONST(0.604208046327650) }, + { FRAC_CONST(0.792855033061574), FRAC_CONST(0.609410285890327) }, + { FRAC_CONST(0.788849498908361), FRAC_CONST(0.614586420344631) }, + { FRAC_CONST(0.784810173068109), FRAC_CONST(0.619736227962191) }, + { FRAC_CONST(0.780737228572094), FRAC_CONST(0.624859488142386) }, + { FRAC_CONST(0.776630839891703), FRAC_CONST(0.629955981421804) }, + { FRAC_CONST(0.772491182930959), FRAC_CONST(0.635025489483633) }, + { FRAC_CONST(0.768318435018988), FRAC_CONST(0.640067795167023) }, + { FRAC_CONST(0.764112774902423), FRAC_CONST(0.645082682476378) }, + { FRAC_CONST(0.759874382737746), FRAC_CONST(0.650069936590618) }, + { FRAC_CONST(0.755603440083571), FRAC_CONST(0.655029343872374) }, + { FRAC_CONST(0.751300129892866), FRAC_CONST(0.659960691877147) }, + { FRAC_CONST(0.746964636505118), FRAC_CONST(0.664863769362399) }, + { FRAC_CONST(0.742597145638433), FRAC_CONST(0.669738366296610) }, + { FRAC_CONST(0.738197844381584), FRAC_CONST(0.674584273868271) }, + { FRAC_CONST(0.733766921185995), FRAC_CONST(0.679401284494831) }, + { FRAC_CONST(0.729304565857668), FRAC_CONST(0.684189191831585) }, + { FRAC_CONST(0.724810969549055), FRAC_CONST(0.688947790780520) }, + { FRAC_CONST(0.720286324750863), FRAC_CONST(0.693676877499095) }, + { FRAC_CONST(0.715730825283819), FRAC_CONST(0.698376249408973) }, + { FRAC_CONST(0.711144666290356), FRAC_CONST(0.703045705204703) }, + { FRAC_CONST(0.706528044226263), FRAC_CONST(0.707685044862340) }, + { FRAC_CONST(0.701881156852263), FRAC_CONST(0.712294069648014) }, + { FRAC_CONST(0.697204203225545), FRAC_CONST(0.716872582126442) }, + { FRAC_CONST(0.692497383691237), FRAC_CONST(0.721420386169390) }, + { FRAC_CONST(0.687760899873822), FRAC_CONST(0.725937286964068) }, + { FRAC_CONST(0.682994954668502), FRAC_CONST(0.730423091021479) }, + { FRAC_CONST(0.678199752232508), FRAC_CONST(0.734877606184707) }, + { FRAC_CONST(0.673375497976352), FRAC_CONST(0.739300641637149) }, + { FRAC_CONST(0.668522398555031), FRAC_CONST(0.743692007910687) }, + { FRAC_CONST(0.663640661859171), FRAC_CONST(0.748051516893805) }, + { FRAC_CONST(0.658730497006124), FRAC_CONST(0.752378981839648) }, + { FRAC_CONST(0.653792114331011), FRAC_CONST(0.756674217374021) }, + { FRAC_CONST(0.648825725377709), FRAC_CONST(0.760937039503328) }, + { FRAC_CONST(0.643831542889792), FRAC_CONST(0.765167265622459) }, + { FRAC_CONST(0.638809780801414), FRAC_CONST(0.769364714522605) }, + { FRAC_CONST(0.633760654228152), FRAC_CONST(0.773529206399025) }, + { FRAC_CONST(0.628684379457781), FRAC_CONST(0.777660562858748) }, + { FRAC_CONST(0.623581173941019), FRAC_CONST(0.781758606928213) }, + { FRAC_CONST(0.618451256282204), FRAC_CONST(0.785823163060853) }, + { FRAC_CONST(0.613294846229936), FRAC_CONST(0.789854057144609) }, + { FRAC_CONST(0.608112164667659), FRAC_CONST(0.793851116509396) }, + { FRAC_CONST(0.602903433604202), FRAC_CONST(0.797814169934493) }, + { FRAC_CONST(0.597668876164268), FRAC_CONST(0.801743047655882) }, + { FRAC_CONST(0.592408716578875), FRAC_CONST(0.805637581373517) }, + { FRAC_CONST(0.587123180175754), FRAC_CONST(0.809497604258536) }, + { FRAC_CONST(0.581812493369691), FRAC_CONST(0.813322950960406) }, + { FRAC_CONST(0.576476883652835), FRAC_CONST(0.817113457614006) }, + { FRAC_CONST(0.571116579584947), FRAC_CONST(0.820868961846646) }, + { FRAC_CONST(0.565731810783613), FRAC_CONST(0.824589302785025) }, + { FRAC_CONST(0.560322807914407), FRAC_CONST(0.828274321062119) }, + { FRAC_CONST(0.554889802681009), FRAC_CONST(0.831923858824010) }, + { FRAC_CONST(0.549433027815281), FRAC_CONST(0.835537759736646) }, + { FRAC_CONST(0.543952717067296), FRAC_CONST(0.839115868992540) }, + { FRAC_CONST(0.538449105195327), FRAC_CONST(0.842658033317402) }, + { FRAC_CONST(0.532922427955790), FRAC_CONST(0.846164100976699) }, + { FRAC_CONST(0.527372922093142), FRAC_CONST(0.849633921782164) }, + { FRAC_CONST(0.521800825329746), FRAC_CONST(0.853067347098221) }, + { FRAC_CONST(0.516206376355680), FRAC_CONST(0.856464229848356) }, + { FRAC_CONST(0.510589814818519), FRAC_CONST(0.859824424521420) }, + { FRAC_CONST(0.504951381313066), FRAC_CONST(0.863147787177854) }, + { FRAC_CONST(0.499291317371047), FRAC_CONST(0.866434175455865) }, + { FRAC_CONST(0.493609865450762), FRAC_CONST(0.869683448577516) }, + { FRAC_CONST(0.487907268926702), FRAC_CONST(0.872895467354761) }, + { FRAC_CONST(0.482183772079123), FRAC_CONST(0.876070094195407) }, + { FRAC_CONST(0.476439620083580), FRAC_CONST(0.879207193109004) }, + { FRAC_CONST(0.470675059000427), FRAC_CONST(0.882306629712678) }, + { FRAC_CONST(0.464890335764274), FRAC_CONST(0.885368271236879) }, + { FRAC_CONST(0.459085698173413), FRAC_CONST(0.888391986531075) }, + { FRAC_CONST(0.453261394879198), FRAC_CONST(0.891377646069366) }, + { FRAC_CONST(0.447417675375397), FRAC_CONST(0.894325121956035) }, + { FRAC_CONST(0.441554789987504), FRAC_CONST(0.897234287931024) }, + { FRAC_CONST(0.435672989862017), FRAC_CONST(0.900105019375345) }, + { FRAC_CONST(0.429772526955677), FRAC_CONST(0.902937193316419) }, + { FRAC_CONST(0.423853654024676), FRAC_CONST(0.905730688433339) }, + { FRAC_CONST(0.417916624613831), FRAC_CONST(0.908485385062073) }, + { FRAC_CONST(0.411961693045722), FRAC_CONST(0.911201165200584) }, + { FRAC_CONST(0.405989114409798), FRAC_CONST(0.913877912513892) }, + { FRAC_CONST(0.399999144551449), FRAC_CONST(0.916515512339049) }, + { FRAC_CONST(0.393992040061048), FRAC_CONST(0.919113851690058) }, + { FRAC_CONST(0.387968058262959), FRAC_CONST(0.921672819262709) }, + { FRAC_CONST(0.381927457204511), FRAC_CONST(0.924192305439348) }, + { FRAC_CONST(0.375870495644949), FRAC_CONST(0.926672202293573) }, + { FRAC_CONST(0.369797433044349), FRAC_CONST(0.929112403594856) }, + { FRAC_CONST(0.363708529552499), FRAC_CONST(0.931512804813095) }, + { FRAC_CONST(0.357604045997758), FRAC_CONST(0.933873303123091) }, + { FRAC_CONST(0.351484243875885), FRAC_CONST(0.936193797408954) }, + { FRAC_CONST(0.345349385338836), FRAC_CONST(0.938474188268430) }, + { FRAC_CONST(0.339199733183530), FRAC_CONST(0.940714378017165) }, + { FRAC_CONST(0.333035550840599), FRAC_CONST(0.942914270692887) }, + { FRAC_CONST(0.326857102363098), FRAC_CONST(0.945073772059514) }, + { FRAC_CONST(0.320664652415198), FRAC_CONST(0.947192789611197) }, + { FRAC_CONST(0.314458466260842), FRAC_CONST(0.949271232576274) }, + { FRAC_CONST(0.308238809752391), FRAC_CONST(0.951309011921168) }, + { FRAC_CONST(0.302005949319228), FRAC_CONST(0.953306040354194) }, + { FRAC_CONST(0.295760151956351), FRAC_CONST(0.955262232329299) }, + { FRAC_CONST(0.289501685212929), FRAC_CONST(0.957177504049732) }, + { FRAC_CONST(0.283230817180850), FRAC_CONST(0.959051773471624) }, + { FRAC_CONST(0.276947816483228), FRAC_CONST(0.960884960307514) }, + { FRAC_CONST(0.270652952262902), FRAC_CONST(0.962676986029777) }, + { FRAC_CONST(0.264346494170904), FRAC_CONST(0.964427773873996) }, + { FRAC_CONST(0.258028712354909), FRAC_CONST(0.966137248842248) }, + { FRAC_CONST(0.251699877447663), FRAC_CONST(0.967805337706313) }, + { FRAC_CONST(0.245360260555389), FRAC_CONST(0.969431969010818) }, + { FRAC_CONST(0.239010133246176), FRAC_CONST(0.971017073076290) }, + { FRAC_CONST(0.232649767538342), FRAC_CONST(0.972560582002147) }, + { FRAC_CONST(0.226279435888785), FRAC_CONST(0.974062429669605) }, + { FRAC_CONST(0.219899411181310), FRAC_CONST(0.975522551744506) }, + { FRAC_CONST(0.213509966714943), FRAC_CONST(0.976940885680082) }, + { FRAC_CONST(0.207111376192219), FRAC_CONST(0.978317370719628) }, + { FRAC_CONST(0.200703913707458), FRAC_CONST(0.979651947899104) }, + { FRAC_CONST(0.194287853735029), FRAC_CONST(0.980944560049668) }, + { FRAC_CONST(0.187863471117585), FRAC_CONST(0.982195151800116) }, + { FRAC_CONST(0.181431041054297), FRAC_CONST(0.983403669579260) }, + { FRAC_CONST(0.174990839089060), FRAC_CONST(0.984570061618221) }, + { FRAC_CONST(0.168543141098691), FRAC_CONST(0.985694277952645) }, + { FRAC_CONST(0.162088223281113), FRAC_CONST(0.986776270424848) }, + { FRAC_CONST(0.155626362143520), FRAC_CONST(0.987815992685872) }, + { FRAC_CONST(0.149157834490539), FRAC_CONST(0.988813400197476) }, + { FRAC_CONST(0.142682917412363), FRAC_CONST(0.989768450234042) }, + { FRAC_CONST(0.136201888272891), FRAC_CONST(0.990681101884405) }, + { FRAC_CONST(0.129715024697841), FRAC_CONST(0.991551316053606) }, + { FRAC_CONST(0.123222604562857), FRAC_CONST(0.992379055464567) }, + { FRAC_CONST(0.116724905981611), FRAC_CONST(0.993164284659685) }, + { FRAC_CONST(0.110222207293883), FRAC_CONST(0.993906970002356) }, + { FRAC_CONST(0.103714787053643), FRAC_CONST(0.994607079678411) }, + { FRAC_CONST(0.097202924017115), FRAC_CONST(0.995264583697482) }, + { FRAC_CONST(0.090686897130838), FRAC_CONST(0.995879453894286) }, + { FRAC_CONST(0.084166985519718), FRAC_CONST(0.996451663929828) }, + { FRAC_CONST(0.077643468475068), FRAC_CONST(0.996981189292537) }, + { FRAC_CONST(0.071116625442645), FRAC_CONST(0.997468007299307) }, + { FRAC_CONST(0.064586736010684), FRAC_CONST(0.997912097096476) }, + { FRAC_CONST(0.058054079897912), FRAC_CONST(0.998313439660714) }, + { FRAC_CONST(0.051518936941578), FRAC_CONST(0.998672017799843) }, + { FRAC_CONST(0.044981587085452), FRAC_CONST(0.998987816153567) }, + { FRAC_CONST(0.038442310367847), FRAC_CONST(0.999260821194138) }, + { FRAC_CONST(0.031901386909611), FRAC_CONST(0.999491021226926) }, + { FRAC_CONST(0.025359096902136), FRAC_CONST(0.999678406390929) }, + { FRAC_CONST(0.018815720595351), FRAC_CONST(0.999822968659191) }, + { FRAC_CONST(0.012271538285720), FRAC_CONST(0.999924701839145) }, + { FRAC_CONST(0.005726830304231), FRAC_CONST(0.999983601572879) } +}; +#endif // LD_DEC + +/* 60 (N/4) complex twiddle factors */ +ALIGN static const complex_t mdct_tab_240[] = +{ + { FRAC_CONST(0.999994645401696), FRAC_CONST(0.003272486506527) }, + { FRAC_CONST(0.999566308502021), FRAC_CONST(0.029448173247963) }, + { FRAC_CONST(0.998452918783950), FRAC_CONST(0.055603677682425) }, + { FRAC_CONST(0.996655239309180), FRAC_CONST(0.081721074133668) }, + { FRAC_CONST(0.994174502117428), FRAC_CONST(0.107782463042759) }, + { FRAC_CONST(0.991012407382049), FRAC_CONST(0.133769983235535) }, + { FRAC_CONST(0.987171122244825), FRAC_CONST(0.159665824163761) }, + { FRAC_CONST(0.982653279330712), FRAC_CONST(0.185452238111591) }, + { FRAC_CONST(0.977461974943572), FRAC_CONST(0.211111552358965) }, + { FRAC_CONST(0.971600766944121), FRAC_CONST(0.236626181293610) }, + { FRAC_CONST(0.965073672311547), FRAC_CONST(0.261978638463337) }, + { FRAC_CONST(0.957885164390477), FRAC_CONST(0.287151548560387) }, + { FRAC_CONST(0.950040169825165), FRAC_CONST(0.312127659329594) }, + { FRAC_CONST(0.941544065183021), FRAC_CONST(0.336889853392220) }, + { FRAC_CONST(0.932402673269775), FRAC_CONST(0.361421159977355) }, + { FRAC_CONST(0.922622259138823), FRAC_CONST(0.385704766552831) }, + { FRAC_CONST(0.912209525797468), FRAC_CONST(0.409724030347695) }, + { FRAC_CONST(0.901171609613013), FRAC_CONST(0.433462489758331) }, + { FRAC_CONST(0.889516075421856), FRAC_CONST(0.456903875630421) }, + { FRAC_CONST(0.877250911344924), FRAC_CONST(0.480032122409011) }, + { FRAC_CONST(0.864384523313017), FRAC_CONST(0.502831379149042) }, + { FRAC_CONST(0.850925729305802), FRAC_CONST(0.525286020378792) }, + { FRAC_CONST(0.836883753308409), FRAC_CONST(0.547380656808797) }, + { FRAC_CONST(0.822268218989775), FRAC_CONST(0.569100145878898) }, + { FRAC_CONST(0.807089143107059), FRAC_CONST(0.590429602136201) }, + { FRAC_CONST(0.791356928640660), FRAC_CONST(0.611354407436816) }, + { FRAC_CONST(0.775082357664531), FRAC_CONST(0.631860220964409) }, + { FRAC_CONST(0.758276583956687), FRAC_CONST(0.651932989058674) }, + { FRAC_CONST(0.740951125354959), FRAC_CONST(0.671558954847018) }, + { FRAC_CONST(0.723117855863248), FRAC_CONST(0.690724667672829) }, + { FRAC_CONST(0.704788997513670), FRAC_CONST(0.709416992313883) }, + { FRAC_CONST(0.685977111990193), FRAC_CONST(0.727623117984575) }, + { FRAC_CONST(0.666695092019479), FRAC_CONST(0.745330567115786) }, + { FRAC_CONST(0.646956152534857), FRAC_CONST(0.762527203906388) }, + { FRAC_CONST(0.626773821619469), FRAC_CONST(0.779201242640517) }, + { FRAC_CONST(0.606161931234795), FRAC_CONST(0.795341255764910) }, + { FRAC_CONST(0.585134607740916), FRAC_CONST(0.810936181720784) }, + { FRAC_CONST(0.563706262215017), FRAC_CONST(0.825975332524873) }, + { FRAC_CONST(0.541891580574752), FRAC_CONST(0.840448401094438) }, + { FRAC_CONST(0.519705513513249), FRAC_CONST(0.854345468311227) }, + { FRAC_CONST(0.497163266252654), FRAC_CONST(0.867657009819544) }, + { FRAC_CONST(0.474280288123229), FRAC_CONST(0.880373902553765) }, + { FRAC_CONST(0.451072261975153), FRAC_CONST(0.892487430990834) }, + { FRAC_CONST(0.427555093430282), FRAC_CONST(0.903989293123443) }, + { FRAC_CONST(0.403744899981227), FRAC_CONST(0.914871606149819) }, + { FRAC_CONST(0.379657999945233), FRAC_CONST(0.925126911876195) }, + { FRAC_CONST(0.355310901280416), FRAC_CONST(0.934748181828292) }, + { FRAC_CONST(0.330720290272038), FRAC_CONST(0.943728822068278) }, + { FRAC_CONST(0.305903020096554), FRAC_CONST(0.952062677713924) }, + { FRAC_CONST(0.280876099271292), FRAC_CONST(0.959744037156857) }, + { FRAC_CONST(0.255656679997665), FRAC_CONST(0.966767635977008) }, + { FRAC_CONST(0.230262046405902), FRAC_CONST(0.973128660550580) }, + { FRAC_CONST(0.204709602709380), FRAC_CONST(0.978822751349072) }, + { FRAC_CONST(0.179016861276633), FRAC_CONST(0.983846005927077) }, + { FRAC_CONST(0.153201430629259), FRAC_CONST(0.988194981596825) }, + { FRAC_CONST(0.127281003373913), FRAC_CONST(0.991866697787626) }, + { FRAC_CONST(0.101273344076683), FRAC_CONST(0.994858638088611) }, + { FRAC_CONST(0.075196277088140), FRAC_CONST(0.997168751973348) }, + { FRAC_CONST(0.049067674327418), FRAC_CONST(0.998795456205172) }, + { FRAC_CONST(0.022905443033697), FRAC_CONST(0.999737635922260) } +}; +#endif // ALLOW_SMALL_FRAMELENGTH + +#ifdef SSR_DEC +/* 128 (N/4) complex twiddle factors */ +ALIGN static const complex_t mdct_tab_512[] = +{ + { FRAC_CONST(0.999998823451702), FRAC_CONST(0.001533980186285) }, + { FRAC_CONST(0.999904701082853), FRAC_CONST(0.013805388528060) }, + { FRAC_CONST(0.999659996743959), FRAC_CONST(0.026074717829104) }, + { FRAC_CONST(0.999264747286594), FRAC_CONST(0.038340120373553) }, + { FRAC_CONST(0.998719012233873), FRAC_CONST(0.050599749036899) }, + { FRAC_CONST(0.998022873771486), FRAC_CONST(0.062851757564161) }, + { FRAC_CONST(0.997176436735326), FRAC_CONST(0.075094300847921) }, + { FRAC_CONST(0.996179828595697), FRAC_CONST(0.087325535206192) }, + { FRAC_CONST(0.995033199438119), FRAC_CONST(0.099543618660069) }, + { FRAC_CONST(0.993736721940725), FRAC_CONST(0.111746711211127) }, + { FRAC_CONST(0.992290591348257), FRAC_CONST(0.123932975118512) }, + { FRAC_CONST(0.990695025442665), FRAC_CONST(0.136100575175706) }, + { FRAC_CONST(0.988950264510303), FRAC_CONST(0.148247678986896) }, + { FRAC_CONST(0.987056571305751), FRAC_CONST(0.160372457242928) }, + { FRAC_CONST(0.985014231012240), FRAC_CONST(0.172473083996796) }, + { FRAC_CONST(0.982823551198705), FRAC_CONST(0.184547736938620) }, + { FRAC_CONST(0.980484861773469), FRAC_CONST(0.196594597670080) }, + { FRAC_CONST(0.977998514934557), FRAC_CONST(0.208611851978263) }, + { FRAC_CONST(0.975364885116657), FRAC_CONST(0.220597690108874) }, + { FRAC_CONST(0.972584368934732), FRAC_CONST(0.232550307038775) }, + { FRAC_CONST(0.969657385124292), FRAC_CONST(0.244467902747824) }, + { FRAC_CONST(0.966584374478333), FRAC_CONST(0.256348682489943) }, + { FRAC_CONST(0.963365799780954), FRAC_CONST(0.268190857063403) }, + { FRAC_CONST(0.960002145737666), FRAC_CONST(0.279992643080273) }, + { FRAC_CONST(0.956493918902395), FRAC_CONST(0.291752263234989) }, + { FRAC_CONST(0.952841647601199), FRAC_CONST(0.303467946572011) }, + { FRAC_CONST(0.949045881852701), FRAC_CONST(0.315137928752522) }, + { FRAC_CONST(0.945107193285261), FRAC_CONST(0.326760452320132) }, + { FRAC_CONST(0.941026175050889), FRAC_CONST(0.338333766965541) }, + { FRAC_CONST(0.936803441735922), FRAC_CONST(0.349856129790135) }, + { FRAC_CONST(0.932439629268462), FRAC_CONST(0.361325805568454) }, + { FRAC_CONST(0.927935394822618), FRAC_CONST(0.372741067009516) }, + { FRAC_CONST(0.923291416719528), FRAC_CONST(0.384100195016935) }, + { FRAC_CONST(0.918508394325212), FRAC_CONST(0.395401478947816) }, + { FRAC_CONST(0.913587047945251), FRAC_CONST(0.406643216870369) }, + { FRAC_CONST(0.908528118716306), FRAC_CONST(0.417823715820212) }, + { FRAC_CONST(0.903332368494512), FRAC_CONST(0.428941292055329) }, + { FRAC_CONST(0.898000579740740), FRAC_CONST(0.439994271309633) }, + { FRAC_CONST(0.892533555402765), FRAC_CONST(0.450980989045104) }, + { FRAC_CONST(0.886932118794342), FRAC_CONST(0.461899790702463) }, + { FRAC_CONST(0.881197113471222), FRAC_CONST(0.472749031950343) }, + { FRAC_CONST(0.875329403104111), FRAC_CONST(0.483527078932919) }, + { FRAC_CONST(0.869329871348607), FRAC_CONST(0.494232308515960) }, + { FRAC_CONST(0.863199421712124), FRAC_CONST(0.504863108531268) }, + { FRAC_CONST(0.856938977417829), FRAC_CONST(0.515417878019463) }, + { FRAC_CONST(0.850549481265603), FRAC_CONST(0.525895027471085) }, + { FRAC_CONST(0.844031895490066), FRAC_CONST(0.536292979065963) }, + { FRAC_CONST(0.837387201615662), FRAC_CONST(0.546610166910835) }, + { FRAC_CONST(0.830616400308846), FRAC_CONST(0.556845037275160) }, + { FRAC_CONST(0.823720511227391), FRAC_CONST(0.566996048825109) }, + { FRAC_CONST(0.816700572866828), FRAC_CONST(0.577061672855679) }, + { FRAC_CONST(0.809557642404051), FRAC_CONST(0.587040393520918) }, + { FRAC_CONST(0.802292795538116), FRAC_CONST(0.596930708062197) }, + { FRAC_CONST(0.794907126328237), FRAC_CONST(0.606731127034524) }, + { FRAC_CONST(0.787401747029031), FRAC_CONST(0.616440174530854) }, + { FRAC_CONST(0.779777787923015), FRAC_CONST(0.626056388404344) }, + { FRAC_CONST(0.772036397150385), FRAC_CONST(0.635578320488556) }, + { FRAC_CONST(0.764178740536117), FRAC_CONST(0.645004536815544) }, + { FRAC_CONST(0.756206001414395), FRAC_CONST(0.654333617831800) }, + { FRAC_CONST(0.748119380450404), FRAC_CONST(0.663564158612040) }, + { FRAC_CONST(0.739920095459516), FRAC_CONST(0.672694769070773) }, + { FRAC_CONST(0.731609381223893), FRAC_CONST(0.681724074171650) }, + { FRAC_CONST(0.723188489306527), FRAC_CONST(0.690650714134535) }, + { FRAC_CONST(0.714658687862769), FRAC_CONST(0.699473344640284) }, + { FRAC_CONST(0.706021261449340), FRAC_CONST(0.708190637033195) }, + { FRAC_CONST(0.697277510830887), FRAC_CONST(0.716801278521100) }, + { FRAC_CONST(0.688428752784091), FRAC_CONST(0.725303972373061) }, + { FRAC_CONST(0.679476319899365), FRAC_CONST(0.733697438114660) }, + { FRAC_CONST(0.670421560380173), FRAC_CONST(0.741980411720831) }, + { FRAC_CONST(0.661265837839992), FRAC_CONST(0.750151645806215) }, + { FRAC_CONST(0.652010531096960), FRAC_CONST(0.758209909813015) }, + { FRAC_CONST(0.642657033966227), FRAC_CONST(0.766153990196313) }, + { FRAC_CONST(0.633206755050057), FRAC_CONST(0.773982690606823) }, + { FRAC_CONST(0.623661117525695), FRAC_CONST(0.781694832071059) }, + { FRAC_CONST(0.614021558931038), FRAC_CONST(0.789289253168886) }, + { FRAC_CONST(0.604289530948156), FRAC_CONST(0.796764810208419) }, + { FRAC_CONST(0.594466499184665), FRAC_CONST(0.804120377398266) }, + { FRAC_CONST(0.584553942953015), FRAC_CONST(0.811354847017064) }, + { FRAC_CONST(0.574553355047716), FRAC_CONST(0.818467129580299) }, + { FRAC_CONST(0.564466241520520), FRAC_CONST(0.825456154004377) }, + { FRAC_CONST(0.554294121453620), FRAC_CONST(0.832320867767930) }, + { FRAC_CONST(0.544038526730884), FRAC_CONST(0.839060237070313) }, + { FRAC_CONST(0.533701001807153), FRAC_CONST(0.845673246987299) }, + { FRAC_CONST(0.523283103475656), FRAC_CONST(0.852158901623920) }, + { FRAC_CONST(0.512786400633563), FRAC_CONST(0.858516224264443) }, + { FRAC_CONST(0.502212474045711), FRAC_CONST(0.864744257519462) }, + { FRAC_CONST(0.491562916106550), FRAC_CONST(0.870842063470079) }, + { FRAC_CONST(0.480839330600334), FRAC_CONST(0.876808723809146) }, + { FRAC_CONST(0.470043332459596), FRAC_CONST(0.882643339979563) }, + { FRAC_CONST(0.459176547521944), FRAC_CONST(0.888345033309596) }, + { FRAC_CONST(0.448240612285220), FRAC_CONST(0.893912945145203) }, + { FRAC_CONST(0.437237173661044), FRAC_CONST(0.899346236979341) }, + { FRAC_CONST(0.426167888726800), FRAC_CONST(0.904644090578246) }, + { FRAC_CONST(0.415034424476082), FRAC_CONST(0.909805708104652) }, + { FRAC_CONST(0.403838457567654), FRAC_CONST(0.914830312237946) }, + { FRAC_CONST(0.392581674072952), FRAC_CONST(0.919717146291227) }, + { FRAC_CONST(0.381265769222162), FRAC_CONST(0.924465474325263) }, + { FRAC_CONST(0.369892447148934), FRAC_CONST(0.929074581259316) }, + { FRAC_CONST(0.358463420633737), FRAC_CONST(0.933543772978836) }, + { FRAC_CONST(0.346980410845924), FRAC_CONST(0.937872376439990) }, + { FRAC_CONST(0.335445147084532), FRAC_CONST(0.942059739771017) }, + { FRAC_CONST(0.323859366517853), FRAC_CONST(0.946105232370403) }, + { FRAC_CONST(0.312224813921825), FRAC_CONST(0.950008245001843) }, + { FRAC_CONST(0.300543241417273), FRAC_CONST(0.953768189885990) }, + { FRAC_CONST(0.288816408206049), FRAC_CONST(0.957384500788976) }, + { FRAC_CONST(0.277046080306100), FRAC_CONST(0.960856633107680) }, + { FRAC_CONST(0.265234030285512), FRAC_CONST(0.964184063951746) }, + { FRAC_CONST(0.253382036995570), FRAC_CONST(0.967366292222329) }, + { FRAC_CONST(0.241491885302869), FRAC_CONST(0.970402838687556) }, + { FRAC_CONST(0.229565365820519), FRAC_CONST(0.973293246054698) }, + { FRAC_CONST(0.217604274638484), FRAC_CONST(0.976037079039039) }, + { FRAC_CONST(0.205610413053099), FRAC_CONST(0.978633924429423) }, + { FRAC_CONST(0.193585587295804), FRAC_CONST(0.981083391150487) }, + { FRAC_CONST(0.181531608261125), FRAC_CONST(0.983385110321551) }, + { FRAC_CONST(0.169450291233968), FRAC_CONST(0.985538735312176) }, + { FRAC_CONST(0.157343455616238), FRAC_CONST(0.987543941794359) }, + { FRAC_CONST(0.145212924652848), FRAC_CONST(0.989400427791380) }, + { FRAC_CONST(0.133060525157139), FRAC_CONST(0.991107913723277) }, + { FRAC_CONST(0.120888087235777), FRAC_CONST(0.992666142448948) }, + { FRAC_CONST(0.108697444013139), FRAC_CONST(0.994074879304879) }, + { FRAC_CONST(0.096490431355253), FRAC_CONST(0.995333912140482) }, + { FRAC_CONST(0.084268887593324), FRAC_CONST(0.996443051350043) }, + { FRAC_CONST(0.072034653246889), FRAC_CONST(0.997402129901275) }, + { FRAC_CONST(0.059789570746640), FRAC_CONST(0.998211003360478) }, + { FRAC_CONST(0.047535484156959), FRAC_CONST(0.998869549914284) }, + { FRAC_CONST(0.035274238898214), FRAC_CONST(0.999377670388003) }, + { FRAC_CONST(0.023007681468839), FRAC_CONST(0.999735288260562) }, + { FRAC_CONST(0.010737659167265), FRAC_CONST(0.999942349676024) } +}; + +/* 16 (N/4) complex twiddle factors */ +ALIGN static const complex_t mdct_tab_64[] = +{ + { FRAC_CONST(0.999924701839145), FRAC_CONST(0.012271538285720) }, + { FRAC_CONST(0.993906970002356), FRAC_CONST(0.110222207293883) }, + { FRAC_CONST(0.978317370719628), FRAC_CONST(0.207111376192219) }, + { FRAC_CONST(0.953306040354194), FRAC_CONST(0.302005949319228) }, + { FRAC_CONST(0.919113851690058), FRAC_CONST(0.393992040061048) }, + { FRAC_CONST(0.876070094195407), FRAC_CONST(0.482183772079123) }, + { FRAC_CONST(0.824589302785025), FRAC_CONST(0.565731810783613) }, + { FRAC_CONST(0.765167265622459), FRAC_CONST(0.643831542889791) }, + { FRAC_CONST(0.698376249408973), FRAC_CONST(0.715730825283819) }, + { FRAC_CONST(0.624859488142386), FRAC_CONST(0.780737228572094) }, + { FRAC_CONST(0.545324988422046), FRAC_CONST(0.838224705554838) }, + { FRAC_CONST(0.460538710958240), FRAC_CONST(0.887639620402854) }, + { FRAC_CONST(0.371317193951838), FRAC_CONST(0.928506080473215) }, + { FRAC_CONST(0.278519689385053), FRAC_CONST(0.960430519415566) }, + { FRAC_CONST(0.183039887955141), FRAC_CONST(0.983105487431216) }, + { FRAC_CONST(0.085797312344440), FRAC_CONST(0.996312612182778) } +}; +#endif // SSR_DEC + +#else // FIXED_POINT + +/* 256 (N/4) complex twiddle factors */ +ALIGN static const complex_t mdct_tab_2048[] = +{ + { FRAC_CONST(0.031249997702054), FRAC_CONST(0.000011984224612) }, + { FRAC_CONST(0.031249813866531), FRAC_CONST(0.000107857810004) }, + { FRAC_CONST(0.031249335895858), FRAC_CONST(0.000203730380198) }, + { FRAC_CONST(0.031248563794535), FRAC_CONST(0.000299601032804) }, + { FRAC_CONST(0.031247497569829), FRAC_CONST(0.000395468865451) }, + { FRAC_CONST(0.031246137231775), FRAC_CONST(0.000491332975794) }, + { FRAC_CONST(0.031244482793177), FRAC_CONST(0.000587192461525) }, + { FRAC_CONST(0.031242534269608), FRAC_CONST(0.000683046420376) }, + { FRAC_CONST(0.031240291679407), FRAC_CONST(0.000778893950134) }, + { FRAC_CONST(0.031237755043684), FRAC_CONST(0.000874734148645) }, + { FRAC_CONST(0.031234924386313), FRAC_CONST(0.000970566113826) }, + { FRAC_CONST(0.031231799733938), FRAC_CONST(0.001066388943669) }, + { FRAC_CONST(0.031228381115970), FRAC_CONST(0.001162201736253) }, + { FRAC_CONST(0.031224668564585), FRAC_CONST(0.001258003589751) }, + { FRAC_CONST(0.031220662114728), FRAC_CONST(0.001353793602441) }, + { FRAC_CONST(0.031216361804108), FRAC_CONST(0.001449570872710) }, + { FRAC_CONST(0.031211767673203), FRAC_CONST(0.001545334499065) }, + { FRAC_CONST(0.031206879765253), FRAC_CONST(0.001641083580144) }, + { FRAC_CONST(0.031201698126266), FRAC_CONST(0.001736817214719) }, + { FRAC_CONST(0.031196222805014), FRAC_CONST(0.001832534501709) }, + { FRAC_CONST(0.031190453853031), FRAC_CONST(0.001928234540186) }, + { FRAC_CONST(0.031184391324617), FRAC_CONST(0.002023916429386) }, + { FRAC_CONST(0.031178035276836), FRAC_CONST(0.002119579268713) }, + { FRAC_CONST(0.031171385769513), FRAC_CONST(0.002215222157753) }, + { FRAC_CONST(0.031164442865236), FRAC_CONST(0.002310844196278) }, + { FRAC_CONST(0.031157206629353), FRAC_CONST(0.002406444484258) }, + { FRAC_CONST(0.031149677129975), FRAC_CONST(0.002502022121865) }, + { FRAC_CONST(0.031141854437973), FRAC_CONST(0.002597576209488) }, + { FRAC_CONST(0.031133738626977), FRAC_CONST(0.002693105847734) }, + { FRAC_CONST(0.031125329773375), FRAC_CONST(0.002788610137442) }, + { FRAC_CONST(0.031116627956316), FRAC_CONST(0.002884088179689) }, + { FRAC_CONST(0.031107633257703), FRAC_CONST(0.002979539075801) }, + { FRAC_CONST(0.031098345762200), FRAC_CONST(0.003074961927355) }, + { FRAC_CONST(0.031088765557222), FRAC_CONST(0.003170355836197) }, + { FRAC_CONST(0.031078892732942), FRAC_CONST(0.003265719904442) }, + { FRAC_CONST(0.031068727382288), FRAC_CONST(0.003361053234488) }, + { FRAC_CONST(0.031058269600939), FRAC_CONST(0.003456354929021) }, + { FRAC_CONST(0.031047519487329), FRAC_CONST(0.003551624091024) }, + { FRAC_CONST(0.031036477142640), FRAC_CONST(0.003646859823790) }, + { FRAC_CONST(0.031025142670809), FRAC_CONST(0.003742061230921) }, + { FRAC_CONST(0.031013516178519), FRAC_CONST(0.003837227416347) }, + { FRAC_CONST(0.031001597775203), FRAC_CONST(0.003932357484328) }, + { FRAC_CONST(0.030989387573042), FRAC_CONST(0.004027450539462) }, + { FRAC_CONST(0.030976885686963), FRAC_CONST(0.004122505686697) }, + { FRAC_CONST(0.030964092234638), FRAC_CONST(0.004217522031340) }, + { FRAC_CONST(0.030951007336485), FRAC_CONST(0.004312498679058) }, + { FRAC_CONST(0.030937631115663), FRAC_CONST(0.004407434735897) }, + { FRAC_CONST(0.030923963698074), FRAC_CONST(0.004502329308281) }, + { FRAC_CONST(0.030910005212362), FRAC_CONST(0.004597181503027) }, + { FRAC_CONST(0.030895755789908), FRAC_CONST(0.004691990427350) }, + { FRAC_CONST(0.030881215564835), FRAC_CONST(0.004786755188872) }, + { FRAC_CONST(0.030866384674000), FRAC_CONST(0.004881474895632) }, + { FRAC_CONST(0.030851263256996), FRAC_CONST(0.004976148656090) }, + { FRAC_CONST(0.030835851456154), FRAC_CONST(0.005070775579142) }, + { FRAC_CONST(0.030820149416533), FRAC_CONST(0.005165354774124) }, + { FRAC_CONST(0.030804157285929), FRAC_CONST(0.005259885350819) }, + { FRAC_CONST(0.030787875214864), FRAC_CONST(0.005354366419469) }, + { FRAC_CONST(0.030771303356593), FRAC_CONST(0.005448797090784) }, + { FRAC_CONST(0.030754441867095), FRAC_CONST(0.005543176475946) }, + { FRAC_CONST(0.030737290905077), FRAC_CONST(0.005637503686619) }, + { FRAC_CONST(0.030719850631972), FRAC_CONST(0.005731777834961) }, + { FRAC_CONST(0.030702121211932), FRAC_CONST(0.005825998033626) }, + { FRAC_CONST(0.030684102811835), FRAC_CONST(0.005920163395780) }, + { FRAC_CONST(0.030665795601276), FRAC_CONST(0.006014273035101) }, + { FRAC_CONST(0.030647199752570), FRAC_CONST(0.006108326065793) }, + { FRAC_CONST(0.030628315440748), FRAC_CONST(0.006202321602594) }, + { FRAC_CONST(0.030609142843557), FRAC_CONST(0.006296258760782) }, + { FRAC_CONST(0.030589682141455), FRAC_CONST(0.006390136656185) }, + { FRAC_CONST(0.030569933517616), FRAC_CONST(0.006483954405188) }, + { FRAC_CONST(0.030549897157919), FRAC_CONST(0.006577711124743) }, + { FRAC_CONST(0.030529573250956), FRAC_CONST(0.006671405932375) }, + { FRAC_CONST(0.030508961988022), FRAC_CONST(0.006765037946194) }, + { FRAC_CONST(0.030488063563118), FRAC_CONST(0.006858606284900) }, + { FRAC_CONST(0.030466878172949), FRAC_CONST(0.006952110067791) }, + { FRAC_CONST(0.030445406016919), FRAC_CONST(0.007045548414774) }, + { FRAC_CONST(0.030423647297133), FRAC_CONST(0.007138920446372) }, + { FRAC_CONST(0.030401602218392), FRAC_CONST(0.007232225283733) }, + { FRAC_CONST(0.030379270988192), FRAC_CONST(0.007325462048634) }, + { FRAC_CONST(0.030356653816724), FRAC_CONST(0.007418629863497) }, + { FRAC_CONST(0.030333750916869), FRAC_CONST(0.007511727851390) }, + { FRAC_CONST(0.030310562504198), FRAC_CONST(0.007604755136040) }, + { FRAC_CONST(0.030287088796968), FRAC_CONST(0.007697710841838) }, + { FRAC_CONST(0.030263330016124), FRAC_CONST(0.007790594093851) }, + { FRAC_CONST(0.030239286385293), FRAC_CONST(0.007883404017824) }, + { FRAC_CONST(0.030214958130781), FRAC_CONST(0.007976139740197) }, + { FRAC_CONST(0.030190345481576), FRAC_CONST(0.008068800388104) }, + { FRAC_CONST(0.030165448669342), FRAC_CONST(0.008161385089390) }, + { FRAC_CONST(0.030140267928416), FRAC_CONST(0.008253892972610) }, + { FRAC_CONST(0.030114803495809), FRAC_CONST(0.008346323167047) }, + { FRAC_CONST(0.030089055611203), FRAC_CONST(0.008438674802711) }, + { FRAC_CONST(0.030063024516947), FRAC_CONST(0.008530947010354) }, + { FRAC_CONST(0.030036710458054), FRAC_CONST(0.008623138921475) }, + { FRAC_CONST(0.030010113682202), FRAC_CONST(0.008715249668328) }, + { FRAC_CONST(0.029983234439732), FRAC_CONST(0.008807278383932) }, + { FRAC_CONST(0.029956072983640), FRAC_CONST(0.008899224202078) }, + { FRAC_CONST(0.029928629569580), FRAC_CONST(0.008991086257336) }, + { FRAC_CONST(0.029900904455860), FRAC_CONST(0.009082863685067) }, + { FRAC_CONST(0.029872897903441), FRAC_CONST(0.009174555621425) }, + { FRAC_CONST(0.029844610175929), FRAC_CONST(0.009266161203371) }, + { FRAC_CONST(0.029816041539579), FRAC_CONST(0.009357679568679) }, + { FRAC_CONST(0.029787192263292), FRAC_CONST(0.009449109855944) }, + { FRAC_CONST(0.029758062618606), FRAC_CONST(0.009540451204587) }, + { FRAC_CONST(0.029728652879702), FRAC_CONST(0.009631702754871) }, + { FRAC_CONST(0.029698963323395), FRAC_CONST(0.009722863647900) }, + { FRAC_CONST(0.029668994229134), FRAC_CONST(0.009813933025633) }, + { FRAC_CONST(0.029638745879000), FRAC_CONST(0.009904910030891) }, + { FRAC_CONST(0.029608218557702), FRAC_CONST(0.009995793807363) }, + { FRAC_CONST(0.029577412552575), FRAC_CONST(0.010086583499618) }, + { FRAC_CONST(0.029546328153577), FRAC_CONST(0.010177278253107) }, + { FRAC_CONST(0.029514965653285), FRAC_CONST(0.010267877214177) }, + { FRAC_CONST(0.029483325346896), FRAC_CONST(0.010358379530076) }, + { FRAC_CONST(0.029451407532220), FRAC_CONST(0.010448784348962) }, + { FRAC_CONST(0.029419212509679), FRAC_CONST(0.010539090819911) }, + { FRAC_CONST(0.029386740582307), FRAC_CONST(0.010629298092923) }, + { FRAC_CONST(0.029353992055740), FRAC_CONST(0.010719405318933) }, + { FRAC_CONST(0.029320967238220), FRAC_CONST(0.010809411649818) }, + { FRAC_CONST(0.029287666440590), FRAC_CONST(0.010899316238403) }, + { FRAC_CONST(0.029254089976290), FRAC_CONST(0.010989118238474) }, + { FRAC_CONST(0.029220238161353), FRAC_CONST(0.011078816804778) }, + { FRAC_CONST(0.029186111314406), FRAC_CONST(0.011168411093039) }, + { FRAC_CONST(0.029151709756664), FRAC_CONST(0.011257900259961) }, + { FRAC_CONST(0.029117033811927), FRAC_CONST(0.011347283463239) }, + { FRAC_CONST(0.029082083806579), FRAC_CONST(0.011436559861563) }, + { FRAC_CONST(0.029046860069582), FRAC_CONST(0.011525728614630) }, + { FRAC_CONST(0.029011362932476), FRAC_CONST(0.011614788883150) }, + { FRAC_CONST(0.028975592729373), FRAC_CONST(0.011703739828853) }, + { FRAC_CONST(0.028939549796957), FRAC_CONST(0.011792580614500) }, + { FRAC_CONST(0.028903234474475), FRAC_CONST(0.011881310403886) }, + { FRAC_CONST(0.028866647103744), FRAC_CONST(0.011969928361855) }, + { FRAC_CONST(0.028829788029135), FRAC_CONST(0.012058433654299) }, + { FRAC_CONST(0.028792657597583), FRAC_CONST(0.012146825448172) }, + { FRAC_CONST(0.028755256158571), FRAC_CONST(0.012235102911499) }, + { FRAC_CONST(0.028717584064137), FRAC_CONST(0.012323265213377) }, + { FRAC_CONST(0.028679641668864), FRAC_CONST(0.012411311523990) }, + { FRAC_CONST(0.028641429329882), FRAC_CONST(0.012499241014612) }, + { FRAC_CONST(0.028602947406859), FRAC_CONST(0.012587052857618) }, + { FRAC_CONST(0.028564196262001), FRAC_CONST(0.012674746226488) }, + { FRAC_CONST(0.028525176260050), FRAC_CONST(0.012762320295819) }, + { FRAC_CONST(0.028485887768276), FRAC_CONST(0.012849774241331) }, + { FRAC_CONST(0.028446331156478), FRAC_CONST(0.012937107239875) }, + { FRAC_CONST(0.028406506796976), FRAC_CONST(0.013024318469437) }, + { FRAC_CONST(0.028366415064615), FRAC_CONST(0.013111407109155) }, + { FRAC_CONST(0.028326056336751), FRAC_CONST(0.013198372339315) }, + { FRAC_CONST(0.028285430993258), FRAC_CONST(0.013285213341368) }, + { FRAC_CONST(0.028244539416515), FRAC_CONST(0.013371929297933) }, + { FRAC_CONST(0.028203381991411), FRAC_CONST(0.013458519392807) }, + { FRAC_CONST(0.028161959105334), FRAC_CONST(0.013544982810971) }, + { FRAC_CONST(0.028120271148172), FRAC_CONST(0.013631318738598) }, + { FRAC_CONST(0.028078318512309), FRAC_CONST(0.013717526363062) }, + { FRAC_CONST(0.028036101592619), FRAC_CONST(0.013803604872943) }, + { FRAC_CONST(0.027993620786463), FRAC_CONST(0.013889553458039) }, + { FRAC_CONST(0.027950876493687), FRAC_CONST(0.013975371309367) }, + { FRAC_CONST(0.027907869116616), FRAC_CONST(0.014061057619178) }, + { FRAC_CONST(0.027864599060052), FRAC_CONST(0.014146611580959) }, + { FRAC_CONST(0.027821066731270), FRAC_CONST(0.014232032389445) }, + { FRAC_CONST(0.027777272540012), FRAC_CONST(0.014317319240622) }, + { FRAC_CONST(0.027733216898487), FRAC_CONST(0.014402471331737) }, + { FRAC_CONST(0.027688900221361), FRAC_CONST(0.014487487861307) }, + { FRAC_CONST(0.027644322925762), FRAC_CONST(0.014572368029123) }, + { FRAC_CONST(0.027599485431266), FRAC_CONST(0.014657111036262) }, + { FRAC_CONST(0.027554388159903), FRAC_CONST(0.014741716085090) }, + { FRAC_CONST(0.027509031536144), FRAC_CONST(0.014826182379271) }, + { FRAC_CONST(0.027463415986904), FRAC_CONST(0.014910509123778) }, + { FRAC_CONST(0.027417541941533), FRAC_CONST(0.014994695524894) }, + { FRAC_CONST(0.027371409831816), FRAC_CONST(0.015078740790225) }, + { FRAC_CONST(0.027325020091965), FRAC_CONST(0.015162644128704) }, + { FRAC_CONST(0.027278373158618), FRAC_CONST(0.015246404750603) }, + { FRAC_CONST(0.027231469470833), FRAC_CONST(0.015330021867534) }, + { FRAC_CONST(0.027184309470088), FRAC_CONST(0.015413494692460) }, + { FRAC_CONST(0.027136893600268), FRAC_CONST(0.015496822439704) }, + { FRAC_CONST(0.027089222307671), FRAC_CONST(0.015580004324954) }, + { FRAC_CONST(0.027041296040997), FRAC_CONST(0.015663039565269) }, + { FRAC_CONST(0.026993115251345), FRAC_CONST(0.015745927379091) }, + { FRAC_CONST(0.026944680392213), FRAC_CONST(0.015828666986247) }, + { FRAC_CONST(0.026895991919487), FRAC_CONST(0.015911257607961) }, + { FRAC_CONST(0.026847050291442), FRAC_CONST(0.015993698466859) }, + { FRAC_CONST(0.026797855968734), FRAC_CONST(0.016075988786976) }, + { FRAC_CONST(0.026748409414401), FRAC_CONST(0.016158127793763) }, + { FRAC_CONST(0.026698711093851), FRAC_CONST(0.016240114714099) }, + { FRAC_CONST(0.026648761474864), FRAC_CONST(0.016321948776289) }, + { FRAC_CONST(0.026598561027585), FRAC_CONST(0.016403629210082) }, + { FRAC_CONST(0.026548110224519), FRAC_CONST(0.016485155246669) }, + { FRAC_CONST(0.026497409540530), FRAC_CONST(0.016566526118696) }, + { FRAC_CONST(0.026446459452830), FRAC_CONST(0.016647741060271) }, + { FRAC_CONST(0.026395260440982), FRAC_CONST(0.016728799306966) }, + { FRAC_CONST(0.026343812986890), FRAC_CONST(0.016809700095831) }, + { FRAC_CONST(0.026292117574797), FRAC_CONST(0.016890442665397) }, + { FRAC_CONST(0.026240174691280), FRAC_CONST(0.016971026255683) }, + { FRAC_CONST(0.026187984825246), FRAC_CONST(0.017051450108208) }, + { FRAC_CONST(0.026135548467924), FRAC_CONST(0.017131713465990) }, + { FRAC_CONST(0.026082866112867), FRAC_CONST(0.017211815573560) }, + { FRAC_CONST(0.026029938255941), FRAC_CONST(0.017291755676967) }, + { FRAC_CONST(0.025976765395322), FRAC_CONST(0.017371533023784) }, + { FRAC_CONST(0.025923348031494), FRAC_CONST(0.017451146863116) }, + { FRAC_CONST(0.025869686667242), FRAC_CONST(0.017530596445607) }, + { FRAC_CONST(0.025815781807646), FRAC_CONST(0.017609881023449) }, + { FRAC_CONST(0.025761633960080), FRAC_CONST(0.017688999850383) }, + { FRAC_CONST(0.025707243634204), FRAC_CONST(0.017767952181715) }, + { FRAC_CONST(0.025652611341960), FRAC_CONST(0.017846737274313) }, + { FRAC_CONST(0.025597737597568), FRAC_CONST(0.017925354386623) }, + { FRAC_CONST(0.025542622917522), FRAC_CONST(0.018003802778671) }, + { FRAC_CONST(0.025487267820581), FRAC_CONST(0.018082081712071) }, + { FRAC_CONST(0.025431672827768), FRAC_CONST(0.018160190450031) }, + { FRAC_CONST(0.025375838462365), FRAC_CONST(0.018238128257362) }, + { FRAC_CONST(0.025319765249906), FRAC_CONST(0.018315894400484) }, + { FRAC_CONST(0.025263453718173), FRAC_CONST(0.018393488147432) }, + { FRAC_CONST(0.025206904397193), FRAC_CONST(0.018470908767865) }, + { FRAC_CONST(0.025150117819228), FRAC_CONST(0.018548155533070) }, + { FRAC_CONST(0.025093094518776), FRAC_CONST(0.018625227715971) }, + { FRAC_CONST(0.025035835032562), FRAC_CONST(0.018702124591135) }, + { FRAC_CONST(0.024978339899534), FRAC_CONST(0.018778845434780) }, + { FRAC_CONST(0.024920609660858), FRAC_CONST(0.018855389524780) }, + { FRAC_CONST(0.024862644859912), FRAC_CONST(0.018931756140672) }, + { FRAC_CONST(0.024804446042284), FRAC_CONST(0.019007944563666) }, + { FRAC_CONST(0.024746013755764), FRAC_CONST(0.019083954076646) }, + { FRAC_CONST(0.024687348550337), FRAC_CONST(0.019159783964183) }, + { FRAC_CONST(0.024628450978184), FRAC_CONST(0.019235433512536) }, + { FRAC_CONST(0.024569321593670), FRAC_CONST(0.019310902009663) }, + { FRAC_CONST(0.024509960953345), FRAC_CONST(0.019386188745225) }, + { FRAC_CONST(0.024450369615932), FRAC_CONST(0.019461293010596) }, + { FRAC_CONST(0.024390548142329), FRAC_CONST(0.019536214098866) }, + { FRAC_CONST(0.024330497095598), FRAC_CONST(0.019610951304848) }, + { FRAC_CONST(0.024270217040961), FRAC_CONST(0.019685503925087) }, + { FRAC_CONST(0.024209708545799), FRAC_CONST(0.019759871257867) }, + { FRAC_CONST(0.024148972179639), FRAC_CONST(0.019834052603212) }, + { FRAC_CONST(0.024088008514157), FRAC_CONST(0.019908047262901) }, + { FRAC_CONST(0.024026818123164), FRAC_CONST(0.019981854540467) }, + { FRAC_CONST(0.023965401582609), FRAC_CONST(0.020055473741208) }, + { FRAC_CONST(0.023903759470567), FRAC_CONST(0.020128904172192) }, + { FRAC_CONST(0.023841892367236), FRAC_CONST(0.020202145142264) }, + { FRAC_CONST(0.023779800854935), FRAC_CONST(0.020275195962052) }, + { FRAC_CONST(0.023717485518092), FRAC_CONST(0.020348055943974) }, + { FRAC_CONST(0.023654946943242), FRAC_CONST(0.020420724402244) }, + { FRAC_CONST(0.023592185719023), FRAC_CONST(0.020493200652878) }, + { FRAC_CONST(0.023529202436167), FRAC_CONST(0.020565484013703) }, + { FRAC_CONST(0.023465997687496), FRAC_CONST(0.020637573804361) }, + { FRAC_CONST(0.023402572067918), FRAC_CONST(0.020709469346314) }, + { FRAC_CONST(0.023338926174419), FRAC_CONST(0.020781169962854) }, + { FRAC_CONST(0.023275060606058), FRAC_CONST(0.020852674979108) }, + { FRAC_CONST(0.023210975963963), FRAC_CONST(0.020923983722044) }, + { FRAC_CONST(0.023146672851322), FRAC_CONST(0.020995095520475) }, + { FRAC_CONST(0.023082151873380), FRAC_CONST(0.021066009705072) }, + { FRAC_CONST(0.023017413637435), FRAC_CONST(0.021136725608363) }, + { FRAC_CONST(0.022952458752826), FRAC_CONST(0.021207242564742) }, + { FRAC_CONST(0.022887287830934), FRAC_CONST(0.021277559910478) }, + { FRAC_CONST(0.022821901485173), FRAC_CONST(0.021347676983716) }, + { FRAC_CONST(0.022756300330983), FRAC_CONST(0.021417593124488) }, + { FRAC_CONST(0.022690484985827), FRAC_CONST(0.021487307674717) }, + { FRAC_CONST(0.022624456069185), FRAC_CONST(0.021556819978223) }, + { FRAC_CONST(0.022558214202547), FRAC_CONST(0.021626129380729) }, + { FRAC_CONST(0.022491760009405), FRAC_CONST(0.021695235229869) }, + { FRAC_CONST(0.022425094115252), FRAC_CONST(0.021764136875192) }, + { FRAC_CONST(0.022358217147572), FRAC_CONST(0.021832833668171) }, + { FRAC_CONST(0.022291129735838), FRAC_CONST(0.021901324962204) }, + { FRAC_CONST(0.022223832511501), FRAC_CONST(0.021969610112625) }, + { FRAC_CONST(0.022156326107988), FRAC_CONST(0.022037688476709) }, + { FRAC_CONST(0.022088611160696), FRAC_CONST(0.022105559413676) }, + { FRAC_CONST(0.022020688306983), FRAC_CONST(0.022173222284699) }, + { FRAC_CONST(0.021952558186166), FRAC_CONST(0.022240676452909) }, + { FRAC_CONST(0.021884221439510), FRAC_CONST(0.022307921283403) }, + { FRAC_CONST(0.021815678710228), FRAC_CONST(0.022374956143245) }, + { FRAC_CONST(0.021746930643469), FRAC_CONST(0.022441780401478) }, + { FRAC_CONST(0.021677977886316), FRAC_CONST(0.022508393429127) }, + { FRAC_CONST(0.021608821087780), FRAC_CONST(0.022574794599206) }, + { FRAC_CONST(0.021539460898790), FRAC_CONST(0.022640983286719) }, + { FRAC_CONST(0.021469897972190), FRAC_CONST(0.022706958868676) }, + { FRAC_CONST(0.021400132962735), FRAC_CONST(0.022772720724087) }, + { FRAC_CONST(0.021330166527077), FRAC_CONST(0.022838268233979) }, + { FRAC_CONST(0.021259999323769), FRAC_CONST(0.022903600781391) }, + { FRAC_CONST(0.021189632013250), FRAC_CONST(0.022968717751391) }, + { FRAC_CONST(0.021119065257845), FRAC_CONST(0.023033618531071) }, + { FRAC_CONST(0.021048299721754), FRAC_CONST(0.023098302509561) }, + { FRAC_CONST(0.020977336071050), FRAC_CONST(0.023162769078031) }, + { FRAC_CONST(0.020906174973670), FRAC_CONST(0.023227017629698) }, + { FRAC_CONST(0.020834817099409), FRAC_CONST(0.023291047559828) }, + { FRAC_CONST(0.020763263119915), FRAC_CONST(0.023354858265748) }, + { FRAC_CONST(0.020691513708680), FRAC_CONST(0.023418449146848) }, + { FRAC_CONST(0.020619569541038), FRAC_CONST(0.023481819604585) }, + { FRAC_CONST(0.020547431294155), FRAC_CONST(0.023544969042494) }, + { FRAC_CONST(0.020475099647023), FRAC_CONST(0.023607896866186) }, + { FRAC_CONST(0.020402575280455), FRAC_CONST(0.023670602483363) }, + { FRAC_CONST(0.020329858877078), FRAC_CONST(0.023733085303813) }, + { FRAC_CONST(0.020256951121327), FRAC_CONST(0.023795344739427) }, + { FRAC_CONST(0.020183852699437), FRAC_CONST(0.023857380204193) }, + { FRAC_CONST(0.020110564299439), FRAC_CONST(0.023919191114211) }, + { FRAC_CONST(0.020037086611150), FRAC_CONST(0.023980776887692) }, + { FRAC_CONST(0.019963420326171), FRAC_CONST(0.024042136944968) }, + { FRAC_CONST(0.019889566137877), FRAC_CONST(0.024103270708495) }, + { FRAC_CONST(0.019815524741412), FRAC_CONST(0.024164177602859) }, + { FRAC_CONST(0.019741296833681), FRAC_CONST(0.024224857054779) }, + { FRAC_CONST(0.019666883113346), FRAC_CONST(0.024285308493120) }, + { FRAC_CONST(0.019592284280817), FRAC_CONST(0.024345531348888) }, + { FRAC_CONST(0.019517501038246), FRAC_CONST(0.024405525055242) }, + { FRAC_CONST(0.019442534089523), FRAC_CONST(0.024465289047500) }, + { FRAC_CONST(0.019367384140264), FRAC_CONST(0.024524822763141) }, + { FRAC_CONST(0.019292051897809), FRAC_CONST(0.024584125641809) }, + { FRAC_CONST(0.019216538071215), FRAC_CONST(0.024643197125323) }, + { FRAC_CONST(0.019140843371246), FRAC_CONST(0.024702036657681) }, + { FRAC_CONST(0.019064968510369), FRAC_CONST(0.024760643685063) }, + { FRAC_CONST(0.018988914202748), FRAC_CONST(0.024819017655836) }, + { FRAC_CONST(0.018912681164234), FRAC_CONST(0.024877158020562) }, + { FRAC_CONST(0.018836270112363), FRAC_CONST(0.024935064232003) }, + { FRAC_CONST(0.018759681766343), FRAC_CONST(0.024992735745123) }, + { FRAC_CONST(0.018682916847054), FRAC_CONST(0.025050172017095) }, + { FRAC_CONST(0.018605976077037), FRAC_CONST(0.025107372507308) }, + { FRAC_CONST(0.018528860180486), FRAC_CONST(0.025164336677369) }, + { FRAC_CONST(0.018451569883247), FRAC_CONST(0.025221063991110) }, + { FRAC_CONST(0.018374105912805), FRAC_CONST(0.025277553914591) }, + { FRAC_CONST(0.018296468998280), FRAC_CONST(0.025333805916107) }, + { FRAC_CONST(0.018218659870421), FRAC_CONST(0.025389819466194) }, + { FRAC_CONST(0.018140679261596), FRAC_CONST(0.025445594037630) }, + { FRAC_CONST(0.018062527905790), FRAC_CONST(0.025501129105445) }, + { FRAC_CONST(0.017984206538592), FRAC_CONST(0.025556424146920) }, + { FRAC_CONST(0.017905715897192), FRAC_CONST(0.025611478641598) }, + { FRAC_CONST(0.017827056720375), FRAC_CONST(0.025666292071285) }, + { FRAC_CONST(0.017748229748511), FRAC_CONST(0.025720863920056) }, + { FRAC_CONST(0.017669235723550), FRAC_CONST(0.025775193674260) }, + { FRAC_CONST(0.017590075389012), FRAC_CONST(0.025829280822525) }, + { FRAC_CONST(0.017510749489986), FRAC_CONST(0.025883124855762) }, + { FRAC_CONST(0.017431258773116), FRAC_CONST(0.025936725267170) }, + { FRAC_CONST(0.017351603986600), FRAC_CONST(0.025990081552242) }, + { FRAC_CONST(0.017271785880180), FRAC_CONST(0.026043193208768) }, + { FRAC_CONST(0.017191805205132), FRAC_CONST(0.026096059736841) }, + { FRAC_CONST(0.017111662714267), FRAC_CONST(0.026148680638861) }, + { FRAC_CONST(0.017031359161915), FRAC_CONST(0.026201055419541) }, + { FRAC_CONST(0.016950895303924), FRAC_CONST(0.026253183585908) }, + { FRAC_CONST(0.016870271897651), FRAC_CONST(0.026305064647313) }, + { FRAC_CONST(0.016789489701954), FRAC_CONST(0.026356698115431) }, + { FRAC_CONST(0.016708549477186), FRAC_CONST(0.026408083504269) }, + { FRAC_CONST(0.016627451985187), FRAC_CONST(0.026459220330167) }, + { FRAC_CONST(0.016546197989277), FRAC_CONST(0.026510108111806) }, + { FRAC_CONST(0.016464788254250), FRAC_CONST(0.026560746370212) }, + { FRAC_CONST(0.016383223546365), FRAC_CONST(0.026611134628757) }, + { FRAC_CONST(0.016301504633341), FRAC_CONST(0.026661272413168) }, + { FRAC_CONST(0.016219632284346), FRAC_CONST(0.026711159251530) }, + { FRAC_CONST(0.016137607269996), FRAC_CONST(0.026760794674288) }, + { FRAC_CONST(0.016055430362340), FRAC_CONST(0.026810178214254) }, + { FRAC_CONST(0.015973102334858), FRAC_CONST(0.026859309406613) }, + { FRAC_CONST(0.015890623962454), FRAC_CONST(0.026908187788922) }, + { FRAC_CONST(0.015807996021446), FRAC_CONST(0.026956812901119) }, + { FRAC_CONST(0.015725219289558), FRAC_CONST(0.027005184285527) }, + { FRAC_CONST(0.015642294545918), FRAC_CONST(0.027053301486856) }, + { FRAC_CONST(0.015559222571044), FRAC_CONST(0.027101164052208) }, + { FRAC_CONST(0.015476004146842), FRAC_CONST(0.027148771531083) }, + { FRAC_CONST(0.015392640056594), FRAC_CONST(0.027196123475380) }, + { FRAC_CONST(0.015309131084956), FRAC_CONST(0.027243219439406) }, + { FRAC_CONST(0.015225478017946), FRAC_CONST(0.027290058979875) }, + { FRAC_CONST(0.015141681642938), FRAC_CONST(0.027336641655915) }, + { FRAC_CONST(0.015057742748656), FRAC_CONST(0.027382967029073) }, + { FRAC_CONST(0.014973662125164), FRAC_CONST(0.027429034663317) }, + { FRAC_CONST(0.014889440563862), FRAC_CONST(0.027474844125040) }, + { FRAC_CONST(0.014805078857474), FRAC_CONST(0.027520394983066) }, + { FRAC_CONST(0.014720577800046), FRAC_CONST(0.027565686808654) }, + { FRAC_CONST(0.014635938186934), FRAC_CONST(0.027610719175499) }, + { FRAC_CONST(0.014551160814797), FRAC_CONST(0.027655491659740) }, + { FRAC_CONST(0.014466246481592), FRAC_CONST(0.027700003839960) }, + { FRAC_CONST(0.014381195986567), FRAC_CONST(0.027744255297195) }, + { FRAC_CONST(0.014296010130247), FRAC_CONST(0.027788245614933) }, + { FRAC_CONST(0.014210689714436), FRAC_CONST(0.027831974379120) }, + { FRAC_CONST(0.014125235542201), FRAC_CONST(0.027875441178165) }, + { FRAC_CONST(0.014039648417870), FRAC_CONST(0.027918645602941) }, + { FRAC_CONST(0.013953929147020), FRAC_CONST(0.027961587246792) }, + { FRAC_CONST(0.013868078536476), FRAC_CONST(0.028004265705534) }, + { FRAC_CONST(0.013782097394294), FRAC_CONST(0.028046680577462) }, + { FRAC_CONST(0.013695986529763), FRAC_CONST(0.028088831463351) }, + { FRAC_CONST(0.013609746753390), FRAC_CONST(0.028130717966461) }, + { FRAC_CONST(0.013523378876898), FRAC_CONST(0.028172339692540) }, + { FRAC_CONST(0.013436883713214), FRAC_CONST(0.028213696249828) }, + { FRAC_CONST(0.013350262076462), FRAC_CONST(0.028254787249062) }, + { FRAC_CONST(0.013263514781960), FRAC_CONST(0.028295612303478) }, + { FRAC_CONST(0.013176642646205), FRAC_CONST(0.028336171028814) }, + { FRAC_CONST(0.013089646486871), FRAC_CONST(0.028376463043317) }, + { FRAC_CONST(0.013002527122799), FRAC_CONST(0.028416487967743) }, + { FRAC_CONST(0.012915285373990), FRAC_CONST(0.028456245425361) }, + { FRAC_CONST(0.012827922061597), FRAC_CONST(0.028495735041960) }, + { FRAC_CONST(0.012740438007915), FRAC_CONST(0.028534956445849) }, + { FRAC_CONST(0.012652834036379), FRAC_CONST(0.028573909267859) }, + { FRAC_CONST(0.012565110971550), FRAC_CONST(0.028612593141354) }, + { FRAC_CONST(0.012477269639111), FRAC_CONST(0.028651007702224) }, + { FRAC_CONST(0.012389310865858), FRAC_CONST(0.028689152588899) }, + { FRAC_CONST(0.012301235479693), FRAC_CONST(0.028727027442343) }, + { FRAC_CONST(0.012213044309615), FRAC_CONST(0.028764631906065) }, + { FRAC_CONST(0.012124738185712), FRAC_CONST(0.028801965626115) }, + { FRAC_CONST(0.012036317939156), FRAC_CONST(0.028839028251097) }, + { FRAC_CONST(0.011947784402191), FRAC_CONST(0.028875819432161) }, + { FRAC_CONST(0.011859138408130), FRAC_CONST(0.028912338823015) }, + { FRAC_CONST(0.011770380791341), FRAC_CONST(0.028948586079925) }, + { FRAC_CONST(0.011681512387245), FRAC_CONST(0.028984560861718) }, + { FRAC_CONST(0.011592534032306), FRAC_CONST(0.029020262829785) }, + { FRAC_CONST(0.011503446564022), FRAC_CONST(0.029055691648087) }, + { FRAC_CONST(0.011414250820918), FRAC_CONST(0.029090846983152) }, + { FRAC_CONST(0.011324947642537), FRAC_CONST(0.029125728504087) }, + { FRAC_CONST(0.011235537869437), FRAC_CONST(0.029160335882573) }, + { FRAC_CONST(0.011146022343175), FRAC_CONST(0.029194668792871) }, + { FRAC_CONST(0.011056401906305), FRAC_CONST(0.029228726911828) }, + { FRAC_CONST(0.010966677402371), FRAC_CONST(0.029262509918876) }, + { FRAC_CONST(0.010876849675891), FRAC_CONST(0.029296017496036) }, + { FRAC_CONST(0.010786919572361), FRAC_CONST(0.029329249327922) }, + { FRAC_CONST(0.010696887938235), FRAC_CONST(0.029362205101743) }, + { FRAC_CONST(0.010606755620926), FRAC_CONST(0.029394884507308) }, + { FRAC_CONST(0.010516523468793), FRAC_CONST(0.029427287237024) }, + { FRAC_CONST(0.010426192331137), FRAC_CONST(0.029459412985906) }, + { FRAC_CONST(0.010335763058187), FRAC_CONST(0.029491261451573) }, + { FRAC_CONST(0.010245236501099), FRAC_CONST(0.029522832334255) }, + { FRAC_CONST(0.010154613511943), FRAC_CONST(0.029554125336796) }, + { FRAC_CONST(0.010063894943698), FRAC_CONST(0.029585140164654) }, + { FRAC_CONST(0.009973081650240), FRAC_CONST(0.029615876525905) }, + { FRAC_CONST(0.009882174486340), FRAC_CONST(0.029646334131247) }, + { FRAC_CONST(0.009791174307650), FRAC_CONST(0.029676512694001) }, + { FRAC_CONST(0.009700081970699), FRAC_CONST(0.029706411930116) }, + { FRAC_CONST(0.009608898332881), FRAC_CONST(0.029736031558168) }, + { FRAC_CONST(0.009517624252453), FRAC_CONST(0.029765371299366) }, + { FRAC_CONST(0.009426260588521), FRAC_CONST(0.029794430877553) }, + { FRAC_CONST(0.009334808201034), FRAC_CONST(0.029823210019210) }, + { FRAC_CONST(0.009243267950778), FRAC_CONST(0.029851708453456) }, + { FRAC_CONST(0.009151640699363), FRAC_CONST(0.029879925912053) }, + { FRAC_CONST(0.009059927309220), FRAC_CONST(0.029907862129408) }, + { FRAC_CONST(0.008968128643591), FRAC_CONST(0.029935516842573) }, + { FRAC_CONST(0.008876245566520), FRAC_CONST(0.029962889791254) }, + { FRAC_CONST(0.008784278942845), FRAC_CONST(0.029989980717805) }, + { FRAC_CONST(0.008692229638191), FRAC_CONST(0.030016789367235) }, + { FRAC_CONST(0.008600098518961), FRAC_CONST(0.030043315487212) }, + { FRAC_CONST(0.008507886452329), FRAC_CONST(0.030069558828062) }, + { FRAC_CONST(0.008415594306230), FRAC_CONST(0.030095519142772) }, + { FRAC_CONST(0.008323222949351), FRAC_CONST(0.030121196186994) }, + { FRAC_CONST(0.008230773251129), FRAC_CONST(0.030146589719046) }, + { FRAC_CONST(0.008138246081733), FRAC_CONST(0.030171699499915) }, + { FRAC_CONST(0.008045642312067), FRAC_CONST(0.030196525293257) }, + { FRAC_CONST(0.007952962813750), FRAC_CONST(0.030221066865402) }, + { FRAC_CONST(0.007860208459119), FRAC_CONST(0.030245323985357) }, + { FRAC_CONST(0.007767380121212), FRAC_CONST(0.030269296424803) }, + { FRAC_CONST(0.007674478673766), FRAC_CONST(0.030292983958103) }, + { FRAC_CONST(0.007581504991203), FRAC_CONST(0.030316386362302) }, + { FRAC_CONST(0.007488459948628), FRAC_CONST(0.030339503417126) }, + { FRAC_CONST(0.007395344421816), FRAC_CONST(0.030362334904989) }, + { FRAC_CONST(0.007302159287206), FRAC_CONST(0.030384880610993) }, + { FRAC_CONST(0.007208905421891), FRAC_CONST(0.030407140322928) }, + { FRAC_CONST(0.007115583703613), FRAC_CONST(0.030429113831278) }, + { FRAC_CONST(0.007022195010752), FRAC_CONST(0.030450800929220) }, + { FRAC_CONST(0.006928740222316), FRAC_CONST(0.030472201412626) }, + { FRAC_CONST(0.006835220217939), FRAC_CONST(0.030493315080068) }, + { FRAC_CONST(0.006741635877866), FRAC_CONST(0.030514141732814) }, + { FRAC_CONST(0.006647988082948), FRAC_CONST(0.030534681174838) }, + { FRAC_CONST(0.006554277714635), FRAC_CONST(0.030554933212813) }, + { FRAC_CONST(0.006460505654964), FRAC_CONST(0.030574897656119) }, + { FRAC_CONST(0.006366672786553), FRAC_CONST(0.030594574316845) }, + { FRAC_CONST(0.006272779992593), FRAC_CONST(0.030613963009786) }, + { FRAC_CONST(0.006178828156839), FRAC_CONST(0.030633063552447) }, + { FRAC_CONST(0.006084818163601), FRAC_CONST(0.030651875765048) }, + { FRAC_CONST(0.005990750897737), FRAC_CONST(0.030670399470520) }, + { FRAC_CONST(0.005896627244644), FRAC_CONST(0.030688634494512) }, + { FRAC_CONST(0.005802448090250), FRAC_CONST(0.030706580665388) }, + { FRAC_CONST(0.005708214321004), FRAC_CONST(0.030724237814232) }, + { FRAC_CONST(0.005613926823871), FRAC_CONST(0.030741605774849) }, + { FRAC_CONST(0.005519586486321), FRAC_CONST(0.030758684383764) }, + { FRAC_CONST(0.005425194196321), FRAC_CONST(0.030775473480228) }, + { FRAC_CONST(0.005330750842327), FRAC_CONST(0.030791972906214) }, + { FRAC_CONST(0.005236257313276), FRAC_CONST(0.030808182506425) }, + { FRAC_CONST(0.005141714498576), FRAC_CONST(0.030824102128288) }, + { FRAC_CONST(0.005047123288102), FRAC_CONST(0.030839731621963) }, + { FRAC_CONST(0.004952484572181), FRAC_CONST(0.030855070840339) }, + { FRAC_CONST(0.004857799241589), FRAC_CONST(0.030870119639036) }, + { FRAC_CONST(0.004763068187541), FRAC_CONST(0.030884877876411) }, + { FRAC_CONST(0.004668292301681), FRAC_CONST(0.030899345413553) }, + { FRAC_CONST(0.004573472476075), FRAC_CONST(0.030913522114288) }, + { FRAC_CONST(0.004478609603205), FRAC_CONST(0.030927407845180) }, + { FRAC_CONST(0.004383704575956), FRAC_CONST(0.030941002475530) }, + { FRAC_CONST(0.004288758287610), FRAC_CONST(0.030954305877381) }, + { FRAC_CONST(0.004193771631837), FRAC_CONST(0.030967317925516) }, + { FRAC_CONST(0.004098745502689), FRAC_CONST(0.030980038497461) }, + { FRAC_CONST(0.004003680794587), FRAC_CONST(0.030992467473486) }, + { FRAC_CONST(0.003908578402316), FRAC_CONST(0.031004604736602) }, + { FRAC_CONST(0.003813439221017), FRAC_CONST(0.031016450172571) }, + { FRAC_CONST(0.003718264146176), FRAC_CONST(0.031028003669899) }, + { FRAC_CONST(0.003623054073616), FRAC_CONST(0.031039265119839) }, + { FRAC_CONST(0.003527809899492), FRAC_CONST(0.031050234416394) }, + { FRAC_CONST(0.003432532520278), FRAC_CONST(0.031060911456318) }, + { FRAC_CONST(0.003337222832760), FRAC_CONST(0.031071296139114) }, + { FRAC_CONST(0.003241881734029), FRAC_CONST(0.031081388367037) }, + { FRAC_CONST(0.003146510121474), FRAC_CONST(0.031091188045095) }, + { FRAC_CONST(0.003051108892766), FRAC_CONST(0.031100695081051) }, + { FRAC_CONST(0.002955678945860), FRAC_CONST(0.031109909385419) }, + { FRAC_CONST(0.002860221178978), FRAC_CONST(0.031118830871473) }, + { FRAC_CONST(0.002764736490604), FRAC_CONST(0.031127459455239) }, + { FRAC_CONST(0.002669225779478), FRAC_CONST(0.031135795055501) }, + { FRAC_CONST(0.002573689944583), FRAC_CONST(0.031143837593803) }, + { FRAC_CONST(0.002478129885137), FRAC_CONST(0.031151586994444) }, + { FRAC_CONST(0.002382546500589), FRAC_CONST(0.031159043184484) }, + { FRAC_CONST(0.002286940690606), FRAC_CONST(0.031166206093743) }, + { FRAC_CONST(0.002191313355067), FRAC_CONST(0.031173075654800) }, + { FRAC_CONST(0.002095665394051), FRAC_CONST(0.031179651802998) }, + { FRAC_CONST(0.001999997707835), FRAC_CONST(0.031185934476438) }, + { FRAC_CONST(0.001904311196878), FRAC_CONST(0.031191923615985) }, + { FRAC_CONST(0.001808606761820), FRAC_CONST(0.031197619165268) }, + { FRAC_CONST(0.001712885303465), FRAC_CONST(0.031203021070678) }, + { FRAC_CONST(0.001617147722782), FRAC_CONST(0.031208129281370) }, + { FRAC_CONST(0.001521394920889), FRAC_CONST(0.031212943749264) }, + { FRAC_CONST(0.001425627799047), FRAC_CONST(0.031217464429043) }, + { FRAC_CONST(0.001329847258653), FRAC_CONST(0.031221691278159) }, + { FRAC_CONST(0.001234054201231), FRAC_CONST(0.031225624256825) }, + { FRAC_CONST(0.001138249528420), FRAC_CONST(0.031229263328024) }, + { FRAC_CONST(0.001042434141971), FRAC_CONST(0.031232608457502) }, + { FRAC_CONST(0.000946608943736), FRAC_CONST(0.031235659613775) }, + { FRAC_CONST(0.000850774835656), FRAC_CONST(0.031238416768124) }, + { FRAC_CONST(0.000754932719759), FRAC_CONST(0.031240879894597) }, + { FRAC_CONST(0.000659083498149), FRAC_CONST(0.031243048970010) }, + { FRAC_CONST(0.000563228072993), FRAC_CONST(0.031244923973948) }, + { FRAC_CONST(0.000467367346520), FRAC_CONST(0.031246504888762) }, + { FRAC_CONST(0.000371502221008), FRAC_CONST(0.031247791699571) }, + { FRAC_CONST(0.000275633598775), FRAC_CONST(0.031248784394264) }, + { FRAC_CONST(0.000179762382174), FRAC_CONST(0.031249482963498) }, + { FRAC_CONST(0.000083889473581), FRAC_CONST(0.031249887400697) } +}; + +/* 64 (N/4) complex twiddle factors */ +ALIGN static const complex_t mdct_tab_256[] = +{ + { FRAC_CONST(0.088387931675923), FRAC_CONST(0.000271171628935) }, + { FRAC_CONST(0.088354655998507), FRAC_CONST(0.002440238387037) }, + { FRAC_CONST(0.088268158780110), FRAC_CONST(0.004607835236780) }, + { FRAC_CONST(0.088128492123423), FRAC_CONST(0.006772656498875) }, + { FRAC_CONST(0.087935740158418), FRAC_CONST(0.008933398165942) }, + { FRAC_CONST(0.087690018991670), FRAC_CONST(0.011088758687994) }, + { FRAC_CONST(0.087391476636423), FRAC_CONST(0.013237439756448) }, + { FRAC_CONST(0.087040292923427), FRAC_CONST(0.015378147086172) }, + { FRAC_CONST(0.086636679392621), FRAC_CONST(0.017509591195118) }, + { FRAC_CONST(0.086180879165703), FRAC_CONST(0.019630488181053) }, + { FRAC_CONST(0.085673166799686), FRAC_CONST(0.021739560494940) }, + { FRAC_CONST(0.085113848121515), FRAC_CONST(0.023835537710479) }, + { FRAC_CONST(0.084503260043847), FRAC_CONST(0.025917157289369) }, + { FRAC_CONST(0.083841770362110), FRAC_CONST(0.027983165341813) }, + { FRAC_CONST(0.083129777532952), FRAC_CONST(0.030032317381813) }, + { FRAC_CONST(0.082367710434230), FRAC_CONST(0.032063379076803) }, + { FRAC_CONST(0.081556028106671), FRAC_CONST(0.034075126991164) }, + { FRAC_CONST(0.080695219477356), FRAC_CONST(0.036066349323177) }, + { FRAC_CONST(0.079785803065216), FRAC_CONST(0.038035846634965) }, + { FRAC_CONST(0.078828326668693), FRAC_CONST(0.039982432574992) }, + { FRAC_CONST(0.077823367035766), FRAC_CONST(0.041904934592675) }, + { FRAC_CONST(0.076771529516540), FRAC_CONST(0.043802194644686) }, + { FRAC_CONST(0.075673447698606), FRAC_CONST(0.045673069892513) }, + { FRAC_CONST(0.074529783025390), FRAC_CONST(0.047516433390863) }, + { FRAC_CONST(0.073341224397728), FRAC_CONST(0.049331174766491) }, + { FRAC_CONST(0.072108487758894), FRAC_CONST(0.051116200887052) }, + { FRAC_CONST(0.070832315663343), FRAC_CONST(0.052870436519557) }, + { FRAC_CONST(0.069513476829429), FRAC_CONST(0.054592824978055) }, + { FRAC_CONST(0.068152765676348), FRAC_CONST(0.056282328760143) }, + { FRAC_CONST(0.066751001845620), FRAC_CONST(0.057937930171918) }, + { FRAC_CONST(0.065309029707361), FRAC_CONST(0.059558631940996) }, + { FRAC_CONST(0.063827717851668), FRAC_CONST(0.061143457817234) }, + { FRAC_CONST(0.062307958565413), FRAC_CONST(0.062691453160784) }, + { FRAC_CONST(0.060750667294763), FRAC_CONST(0.064201685517134) }, + { FRAC_CONST(0.059156782093749), FRAC_CONST(0.065673245178784) }, + { FRAC_CONST(0.057527263059216), FRAC_CONST(0.067105245733220) }, + { FRAC_CONST(0.055863091752499), FRAC_CONST(0.068496824596852) }, + { FRAC_CONST(0.054165270608165), FRAC_CONST(0.069847143534609) }, + { FRAC_CONST(0.052434822330188), FRAC_CONST(0.071155389164853) }, + { FRAC_CONST(0.050672789275903), FRAC_CONST(0.072420773449336) }, + { FRAC_CONST(0.048880232828135), FRAC_CONST(0.073642534167879) }, + { FRAC_CONST(0.047058232755862), FRAC_CONST(0.074819935377512) }, + { FRAC_CONST(0.045207886563797), FRAC_CONST(0.075952267855771) }, + { FRAC_CONST(0.043330308831298), FRAC_CONST(0.077038849527912) }, + { FRAC_CONST(0.041426630540984), FRAC_CONST(0.078079025877766) }, + { FRAC_CONST(0.039497998397473), FRAC_CONST(0.079072170341994) }, + { FRAC_CONST(0.037545574136653), FRAC_CONST(0.080017684687506) }, + { FRAC_CONST(0.035570533825892), FRAC_CONST(0.080914999371817) }, + { FRAC_CONST(0.033574067155622), FRAC_CONST(0.081763573886112) }, + { FRAC_CONST(0.031557376722714), FRAC_CONST(0.082562897080836) }, + { FRAC_CONST(0.029521677306074), FRAC_CONST(0.083312487473584) }, + { FRAC_CONST(0.027468195134911), FRAC_CONST(0.084011893539132) }, + { FRAC_CONST(0.025398167150101), FRAC_CONST(0.084660693981419) }, + { FRAC_CONST(0.023312840259098), FRAC_CONST(0.085258497987320) }, + { FRAC_CONST(0.021213470584847), FRAC_CONST(0.085804945462053) }, + { FRAC_CONST(0.019101322709138), FRAC_CONST(0.086299707246093) }, + { FRAC_CONST(0.016977668910873), FRAC_CONST(0.086742485313442) }, + { FRAC_CONST(0.014843788399692), FRAC_CONST(0.087133012951149) }, + { FRAC_CONST(0.012700966545425), FRAC_CONST(0.087471054919968) }, + { FRAC_CONST(0.010550494103830), FRAC_CONST(0.087756407596056) }, + { FRAC_CONST(0.008393666439096), FRAC_CONST(0.087988899093631) }, + { FRAC_CONST(0.006231782743558), FRAC_CONST(0.088168389368510) }, + { FRAC_CONST(0.004066145255116), FRAC_CONST(0.088294770302461) }, + { FRAC_CONST(0.001898058472816), FRAC_CONST(0.088367965768336) } +}; + +#ifdef LD_DEC +/* 128 (N/4) complex twiddle factors */ +ALIGN static const complex_t mdct_tab_1024[] = +{ + { FRAC_CONST(0.044194160825012), FRAC_CONST(0.000033896503468) }, + { FRAC_CONST(0.044193120897389), FRAC_CONST(0.000305066138364) }, + { FRAC_CONST(0.044190417123742), FRAC_CONST(0.000576224287693) }, + { FRAC_CONST(0.044186049605866), FRAC_CONST(0.000847360742503) }, + { FRAC_CONST(0.044180018508197), FRAC_CONST(0.001118465294660) }, + { FRAC_CONST(0.044172324057802), FRAC_CONST(0.001389527737231) }, + { FRAC_CONST(0.044162966544372), FRAC_CONST(0.001660537864867) }, + { FRAC_CONST(0.044151946320213), FRAC_CONST(0.001931485474192) }, + { FRAC_CONST(0.044139263800230), FRAC_CONST(0.002202360364180) }, + { FRAC_CONST(0.044124919461912), FRAC_CONST(0.002473152336546) }, + { FRAC_CONST(0.044108913845316), FRAC_CONST(0.002743851196123) }, + { FRAC_CONST(0.044091247553044), FRAC_CONST(0.003014446751254) }, + { FRAC_CONST(0.044071921250223), FRAC_CONST(0.003284928814169) }, + { FRAC_CONST(0.044050935664476), FRAC_CONST(0.003555287201370) }, + { FRAC_CONST(0.044028291585898), FRAC_CONST(0.003825511734018) }, + { FRAC_CONST(0.044003989867028), FRAC_CONST(0.004095592238311) }, + { FRAC_CONST(0.043978031422810), FRAC_CONST(0.004365518545871) }, + { FRAC_CONST(0.043950417230565), FRAC_CONST(0.004635280494126) }, + { FRAC_CONST(0.043921148329953), FRAC_CONST(0.004904867926689) }, + { FRAC_CONST(0.043890225822930), FRAC_CONST(0.005174270693748) }, + { FRAC_CONST(0.043857650873712), FRAC_CONST(0.005443478652439) }, + { FRAC_CONST(0.043823424708727), FRAC_CONST(0.005712481667236) }, + { FRAC_CONST(0.043787548616571), FRAC_CONST(0.005981269610326) }, + { FRAC_CONST(0.043750023947958), FRAC_CONST(0.006249832361997) }, + { FRAC_CONST(0.043710852115672), FRAC_CONST(0.006518159811011) }, + { FRAC_CONST(0.043670034594508), FRAC_CONST(0.006786241854993) }, + { FRAC_CONST(0.043627572921225), FRAC_CONST(0.007054068400804) }, + { FRAC_CONST(0.043583468694479), FRAC_CONST(0.007321629364927) }, + { FRAC_CONST(0.043537723574771), FRAC_CONST(0.007588914673843) }, + { FRAC_CONST(0.043490339284377), FRAC_CONST(0.007855914264410) }, + { FRAC_CONST(0.043441317607290), FRAC_CONST(0.008122618084246) }, + { FRAC_CONST(0.043390660389149), FRAC_CONST(0.008389016092101) }, + { FRAC_CONST(0.043338369537168), FRAC_CONST(0.008655098258243) }, + { FRAC_CONST(0.043284447020070), FRAC_CONST(0.008920854564826) }, + { FRAC_CONST(0.043228894868005), FRAC_CONST(0.009186275006278) }, + { FRAC_CONST(0.043171715172482), FRAC_CONST(0.009451349589667) }, + { FRAC_CONST(0.043112910086283), FRAC_CONST(0.009716068335087) }, + { FRAC_CONST(0.043052481823387), FRAC_CONST(0.009980421276025) }, + { FRAC_CONST(0.042990432658884), FRAC_CONST(0.010244398459743) }, + { FRAC_CONST(0.042926764928889), FRAC_CONST(0.010507989947649) }, + { FRAC_CONST(0.042861481030457), FRAC_CONST(0.010771185815673) }, + { FRAC_CONST(0.042794583421490), FRAC_CONST(0.011033976154639) }, + { FRAC_CONST(0.042726074620644), FRAC_CONST(0.011296351070639) }, + { FRAC_CONST(0.042655957207238), FRAC_CONST(0.011558300685406) }, + { FRAC_CONST(0.042584233821153), FRAC_CONST(0.011819815136685) }, + { FRAC_CONST(0.042510907162732), FRAC_CONST(0.012080884578604) }, + { FRAC_CONST(0.042435979992684), FRAC_CONST(0.012341499182048) }, + { FRAC_CONST(0.042359455131975), FRAC_CONST(0.012601649135022) }, + { FRAC_CONST(0.042281335461721), FRAC_CONST(0.012861324643029) }, + { FRAC_CONST(0.042201623923085), FRAC_CONST(0.013120515929433) }, + { FRAC_CONST(0.042120323517160), FRAC_CONST(0.013379213235827) }, + { FRAC_CONST(0.042037437304862), FRAC_CONST(0.013637406822406) }, + { FRAC_CONST(0.041952968406809), FRAC_CONST(0.013895086968325) }, + { FRAC_CONST(0.041866920003207), FRAC_CONST(0.014152243972073) }, + { FRAC_CONST(0.041779295333730), FRAC_CONST(0.014408868151835) }, + { FRAC_CONST(0.041690097697398), FRAC_CONST(0.014664949845855) }, + { FRAC_CONST(0.041599330452450), FRAC_CONST(0.014920479412801) }, + { FRAC_CONST(0.041506997016224), FRAC_CONST(0.015175447232131) }, + { FRAC_CONST(0.041413100865019), FRAC_CONST(0.015429843704450) }, + { FRAC_CONST(0.041317645533974), FRAC_CONST(0.015683659251874) }, + { FRAC_CONST(0.041220634616927), FRAC_CONST(0.015936884318392) }, + { FRAC_CONST(0.041122071766285), FRAC_CONST(0.016189509370223) }, + { FRAC_CONST(0.041021960692883), FRAC_CONST(0.016441524896177) }, + { FRAC_CONST(0.040920305165846), FRAC_CONST(0.016692921408010) }, + { FRAC_CONST(0.040817109012449), FRAC_CONST(0.016943689440788) }, + { FRAC_CONST(0.040712376117967), FRAC_CONST(0.017193819553235) }, + { FRAC_CONST(0.040606110425535), FRAC_CONST(0.017443302328094) }, + { FRAC_CONST(0.040498315935996), FRAC_CONST(0.017692128372479) }, + { FRAC_CONST(0.040388996707752), FRAC_CONST(0.017940288318230) }, + { FRAC_CONST(0.040278156856609), FRAC_CONST(0.018187772822267) }, + { FRAC_CONST(0.040165800555627), FRAC_CONST(0.018434572566936) }, + { FRAC_CONST(0.040051932034955), FRAC_CONST(0.018680678260367) }, + { FRAC_CONST(0.039936555581679), FRAC_CONST(0.018926080636820) }, + { FRAC_CONST(0.039819675539659), FRAC_CONST(0.019170770457035) }, + { FRAC_CONST(0.039701296309360), FRAC_CONST(0.019414738508577) }, + { FRAC_CONST(0.039581422347694), FRAC_CONST(0.019657975606187) }, + { FRAC_CONST(0.039460058167849), FRAC_CONST(0.019900472592126) }, + { FRAC_CONST(0.039337208339116), FRAC_CONST(0.020142220336521) }, + { FRAC_CONST(0.039212877486723), FRAC_CONST(0.020383209737704) }, + { FRAC_CONST(0.039087070291656), FRAC_CONST(0.020623431722561) }, + { FRAC_CONST(0.038959791490485), FRAC_CONST(0.020862877246870) }, + { FRAC_CONST(0.038831045875184), FRAC_CONST(0.021101537295642) }, + { FRAC_CONST(0.038700838292953), FRAC_CONST(0.021339402883462) }, + { FRAC_CONST(0.038569173646034), FRAC_CONST(0.021576465054824) }, + { FRAC_CONST(0.038436056891527), FRAC_CONST(0.021812714884472) }, + { FRAC_CONST(0.038301493041202), FRAC_CONST(0.022048143477734) }, + { FRAC_CONST(0.038165487161312), FRAC_CONST(0.022282741970855) }, + { FRAC_CONST(0.038028044372402), FRAC_CONST(0.022516501531335) }, + { FRAC_CONST(0.037889169849115), FRAC_CONST(0.022749413358259) }, + { FRAC_CONST(0.037748868819998), FRAC_CONST(0.022981468682628) }, + { FRAC_CONST(0.037607146567305), FRAC_CONST(0.023212658767690) }, + { FRAC_CONST(0.037464008426800), FRAC_CONST(0.023442974909269) }, + { FRAC_CONST(0.037319459787553), FRAC_CONST(0.023672408436094) }, + { FRAC_CONST(0.037173506091737), FRAC_CONST(0.023900950710120) }, + { FRAC_CONST(0.037026152834428), FRAC_CONST(0.024128593126861) }, + { FRAC_CONST(0.036877405563392), FRAC_CONST(0.024355327115708) }, + { FRAC_CONST(0.036727269878879), FRAC_CONST(0.024581144140255) }, + { FRAC_CONST(0.036575751433414), FRAC_CONST(0.024806035698618) }, + { FRAC_CONST(0.036422855931580), FRAC_CONST(0.025029993323758) }, + { FRAC_CONST(0.036268589129807), FRAC_CONST(0.025253008583796) }, + { FRAC_CONST(0.036112956836151), FRAC_CONST(0.025475073082334) }, + { FRAC_CONST(0.035955964910083), FRAC_CONST(0.025696178458769) }, + { FRAC_CONST(0.035797619262257), FRAC_CONST(0.025916316388609) }, + { FRAC_CONST(0.035637925854300), FRAC_CONST(0.026135478583784) }, + { FRAC_CONST(0.035476890698576), FRAC_CONST(0.026353656792963) }, + { FRAC_CONST(0.035314519857970), FRAC_CONST(0.026570842801858) }, + { FRAC_CONST(0.035150819445650), FRAC_CONST(0.026787028433540) }, + { FRAC_CONST(0.034985795624846), FRAC_CONST(0.027002205548742) }, + { FRAC_CONST(0.034819454608610), FRAC_CONST(0.027216366046166) }, + { FRAC_CONST(0.034651802659589), FRAC_CONST(0.027429501862792) }, + { FRAC_CONST(0.034482846089783), FRAC_CONST(0.027641604974175) }, + { FRAC_CONST(0.034312591260311), FRAC_CONST(0.027852667394755) }, + { FRAC_CONST(0.034141044581172), FRAC_CONST(0.028062681178149) }, + { FRAC_CONST(0.033968212511001), FRAC_CONST(0.028271638417458) }, + { FRAC_CONST(0.033794101556828), FRAC_CONST(0.028479531245560) }, + { FRAC_CONST(0.033618718273831), FRAC_CONST(0.028686351835407) }, + { FRAC_CONST(0.033442069265093), FRAC_CONST(0.028892092400321) }, + { FRAC_CONST(0.033264161181349), FRAC_CONST(0.029096745194286) }, + { FRAC_CONST(0.033085000720737), FRAC_CONST(0.029300302512241) }, + { FRAC_CONST(0.032904594628548), FRAC_CONST(0.029502756690366) }, + { FRAC_CONST(0.032722949696969), FRAC_CONST(0.029704100106376) }, + { FRAC_CONST(0.032540072764829), FRAC_CONST(0.029904325179807) }, + { FRAC_CONST(0.032355970717341), FRAC_CONST(0.030103424372297) }, + { FRAC_CONST(0.032170650485843), FRAC_CONST(0.030301390187873) }, + { FRAC_CONST(0.031984119047537), FRAC_CONST(0.030498215173235) }, + { FRAC_CONST(0.031796383425227), FRAC_CONST(0.030693891918034) }, + { FRAC_CONST(0.031607450687052), FRAC_CONST(0.030888413055150) }, + { FRAC_CONST(0.031417327946223), FRAC_CONST(0.031081771260973) }, + { FRAC_CONST(0.031226022360754), FRAC_CONST(0.031273959255676) }, + { FRAC_CONST(0.031033541133193), FRAC_CONST(0.031464969803488) }, + { FRAC_CONST(0.030839891510348), FRAC_CONST(0.031654795712972) }, + { FRAC_CONST(0.030645080783018), FRAC_CONST(0.031843429837288) }, + { FRAC_CONST(0.030449116285718), FRAC_CONST(0.032030865074469) }, + { FRAC_CONST(0.030252005396399), FRAC_CONST(0.032217094367684) }, + { FRAC_CONST(0.030053755536176), FRAC_CONST(0.032402110705505) }, + { FRAC_CONST(0.029854374169043), FRAC_CONST(0.032585907122172) }, + { FRAC_CONST(0.029653868801596), FRAC_CONST(0.032768476697853) }, + { FRAC_CONST(0.029452246982750), FRAC_CONST(0.032949812558907) }, + { FRAC_CONST(0.029249516303451), FRAC_CONST(0.033129907878142) }, + { FRAC_CONST(0.029045684396395), FRAC_CONST(0.033308755875070) }, + { FRAC_CONST(0.028840758935738), FRAC_CONST(0.033486349816166) }, + { FRAC_CONST(0.028634747636808), FRAC_CONST(0.033662683015118) }, + { FRAC_CONST(0.028427658255815), FRAC_CONST(0.033837748833080) }, + { FRAC_CONST(0.028219498589555), FRAC_CONST(0.034011540678924) }, + { FRAC_CONST(0.028010276475123), FRAC_CONST(0.034184052009485) }, + { FRAC_CONST(0.027799999789613), FRAC_CONST(0.034355276329809) }, + { FRAC_CONST(0.027588676449824), FRAC_CONST(0.034525207193396) }, + { FRAC_CONST(0.027376314411959), FRAC_CONST(0.034693838202447) }, + { FRAC_CONST(0.027162921671330), FRAC_CONST(0.034861163008098) }, + { FRAC_CONST(0.026948506262053), FRAC_CONST(0.035027175310665) }, + { FRAC_CONST(0.026733076256746), FRAC_CONST(0.035191868859880) }, + { FRAC_CONST(0.026516639766228), FRAC_CONST(0.035355237455122) }, + { FRAC_CONST(0.026299204939210), FRAC_CONST(0.035517274945657) }, + { FRAC_CONST(0.026080779961991), FRAC_CONST(0.035677975230865) }, + { FRAC_CONST(0.025861373058146), FRAC_CONST(0.035837332260471) }, + { FRAC_CONST(0.025640992488223), FRAC_CONST(0.035995340034772) }, + { FRAC_CONST(0.025419646549425), FRAC_CONST(0.036151992604866) }, + { FRAC_CONST(0.025197343575302), FRAC_CONST(0.036307284072871) }, + { FRAC_CONST(0.024974091935435), FRAC_CONST(0.036461208592152) }, + { FRAC_CONST(0.024749900035122), FRAC_CONST(0.036613760367538) }, + { FRAC_CONST(0.024524776315061), FRAC_CONST(0.036764933655540) }, + { FRAC_CONST(0.024298729251033), FRAC_CONST(0.036914722764569) }, + { FRAC_CONST(0.024071767353583), FRAC_CONST(0.037063122055150) }, + { FRAC_CONST(0.023843899167697), FRAC_CONST(0.037210125940135) }, + { FRAC_CONST(0.023615133272485), FRAC_CONST(0.037355728884908) }, + { FRAC_CONST(0.023385478280852), FRAC_CONST(0.037499925407603) }, + { FRAC_CONST(0.023154942839179), FRAC_CONST(0.037642710079302) }, + { FRAC_CONST(0.022923535626995), FRAC_CONST(0.037784077524241) }, + { FRAC_CONST(0.022691265356652), FRAC_CONST(0.037924022420018) }, + { FRAC_CONST(0.022458140772993), FRAC_CONST(0.038062539497785) }, + { FRAC_CONST(0.022224170653027), FRAC_CONST(0.038199623542453) }, + { FRAC_CONST(0.021989363805598), FRAC_CONST(0.038335269392885) }, + { FRAC_CONST(0.021753729071049), FRAC_CONST(0.038469471942092) }, + { FRAC_CONST(0.021517275320897), FRAC_CONST(0.038602226137423) }, + { FRAC_CONST(0.021280011457490), FRAC_CONST(0.038733526980758) }, + { FRAC_CONST(0.021041946413679), FRAC_CONST(0.038863369528695) }, + { FRAC_CONST(0.020803089152479), FRAC_CONST(0.038991748892734) }, + { FRAC_CONST(0.020563448666730), FRAC_CONST(0.039118660239466) }, + { FRAC_CONST(0.020323033978761), FRAC_CONST(0.039244098790750) }, + { FRAC_CONST(0.020081854140050), FRAC_CONST(0.039368059823895) }, + { FRAC_CONST(0.019839918230880), FRAC_CONST(0.039490538671839) }, + { FRAC_CONST(0.019597235360003), FRAC_CONST(0.039611530723322) }, + { FRAC_CONST(0.019353814664291), FRAC_CONST(0.039731031423061) }, + { FRAC_CONST(0.019109665308395), FRAC_CONST(0.039849036271924) }, + { FRAC_CONST(0.018864796484402), FRAC_CONST(0.039965540827094) }, + { FRAC_CONST(0.018619217411483), FRAC_CONST(0.040080540702240) }, + { FRAC_CONST(0.018372937335552), FRAC_CONST(0.040194031567683) }, + { FRAC_CONST(0.018125965528915), FRAC_CONST(0.040306009150554) }, + { FRAC_CONST(0.017878311289921), FRAC_CONST(0.040416469234963) }, + { FRAC_CONST(0.017629983942612), FRAC_CONST(0.040525407662148) }, + { FRAC_CONST(0.017380992836371), FRAC_CONST(0.040632820330639) }, + { FRAC_CONST(0.017131347345575), FRAC_CONST(0.040738703196411) }, + { FRAC_CONST(0.016881056869233), FRAC_CONST(0.040843052273033) }, + { FRAC_CONST(0.016630130830641), FRAC_CONST(0.040945863631822) }, + { FRAC_CONST(0.016378578677023), FRAC_CONST(0.041047133401988) }, + { FRAC_CONST(0.016126409879175), FRAC_CONST(0.041146857770781) }, + { FRAC_CONST(0.015873633931110), FRAC_CONST(0.041245032983635) }, + { FRAC_CONST(0.015620260349699), FRAC_CONST(0.041341655344309) }, + { FRAC_CONST(0.015366298674314), FRAC_CONST(0.041436721215026) }, + { FRAC_CONST(0.015111758466470), FRAC_CONST(0.041530227016609) }, + { FRAC_CONST(0.014856649309460), FRAC_CONST(0.041622169228618) }, + { FRAC_CONST(0.014600980808001), FRAC_CONST(0.041712544389481) }, + { FRAC_CONST(0.014344762587867), FRAC_CONST(0.041801349096623) }, + { FRAC_CONST(0.014088004295529), FRAC_CONST(0.041888580006598) }, + { FRAC_CONST(0.013830715597792), FRAC_CONST(0.041974233835211) }, + { FRAC_CONST(0.013572906181430), FRAC_CONST(0.042058307357645) }, + { FRAC_CONST(0.013314585752822), FRAC_CONST(0.042140797408577) }, + { FRAC_CONST(0.013055764037585), FRAC_CONST(0.042221700882306) }, + { FRAC_CONST(0.012796450780212), FRAC_CONST(0.042301014732860) }, + { FRAC_CONST(0.012536655743699), FRAC_CONST(0.042378735974118) }, + { FRAC_CONST(0.012276388709183), FRAC_CONST(0.042454861679919) }, + { FRAC_CONST(0.012015659475571), FRAC_CONST(0.042529388984173) }, + { FRAC_CONST(0.011754477859172), FRAC_CONST(0.042602315080970) }, + { FRAC_CONST(0.011492853693324), FRAC_CONST(0.042673637224683) }, + { FRAC_CONST(0.011230796828031), FRAC_CONST(0.042743352730074) }, + { FRAC_CONST(0.010968317129584), FRAC_CONST(0.042811458972393) }, + { FRAC_CONST(0.010705424480197), FRAC_CONST(0.042877953387479) }, + { FRAC_CONST(0.010442128777629), FRAC_CONST(0.042942833471854) }, + { FRAC_CONST(0.010178439934815), FRAC_CONST(0.043006096782821) }, + { FRAC_CONST(0.009914367879490), FRAC_CONST(0.043067740938551) }, + { FRAC_CONST(0.009649922553818), FRAC_CONST(0.043127763618177) }, + { FRAC_CONST(0.009385113914016), FRAC_CONST(0.043186162561878) }, + { FRAC_CONST(0.009119951929979), FRAC_CONST(0.043242935570968) }, + { FRAC_CONST(0.008854446584907), FRAC_CONST(0.043298080507974) }, + { FRAC_CONST(0.008588607874926), FRAC_CONST(0.043351595296722) }, + { FRAC_CONST(0.008322445808712), FRAC_CONST(0.043403477922409) }, + { FRAC_CONST(0.008055970407118), FRAC_CONST(0.043453726431684) }, + { FRAC_CONST(0.007789191702791), FRAC_CONST(0.043502338932719) }, + { FRAC_CONST(0.007522119739798), FRAC_CONST(0.043549313595281) }, + { FRAC_CONST(0.007254764573250), FRAC_CONST(0.043594648650800) }, + { FRAC_CONST(0.006987136268915), FRAC_CONST(0.043638342392438) }, + { FRAC_CONST(0.006719244902849), FRAC_CONST(0.043680393175148) }, + { FRAC_CONST(0.006451100561010), FRAC_CONST(0.043720799415744) }, + { FRAC_CONST(0.006182713338881), FRAC_CONST(0.043759559592953) }, + { FRAC_CONST(0.005914093341090), FRAC_CONST(0.043796672247476) }, + { FRAC_CONST(0.005645250681027), FRAC_CONST(0.043832135982044) }, + { FRAC_CONST(0.005376195480466), FRAC_CONST(0.043865949461465) }, + { FRAC_CONST(0.005106937869184), FRAC_CONST(0.043898111412683) }, + { FRAC_CONST(0.004837487984578), FRAC_CONST(0.043928620624817) }, + { FRAC_CONST(0.004567855971284), FRAC_CONST(0.043957475949213) }, + { FRAC_CONST(0.004298051980793), FRAC_CONST(0.043984676299484) }, + { FRAC_CONST(0.004028086171076), FRAC_CONST(0.044010220651553) }, + { FRAC_CONST(0.003757968706190), FRAC_CONST(0.044034108043689) }, + { FRAC_CONST(0.003487709755907), FRAC_CONST(0.044056337576546) }, + { FRAC_CONST(0.003217319495322), FRAC_CONST(0.044076908413193) }, + { FRAC_CONST(0.002946808104477), FRAC_CONST(0.044095819779151) }, + { FRAC_CONST(0.002676185767973), FRAC_CONST(0.044113070962418) }, + { FRAC_CONST(0.002405462674586), FRAC_CONST(0.044128661313495) }, + { FRAC_CONST(0.002134649016890), FRAC_CONST(0.044142590245416) }, + { FRAC_CONST(0.001863754990865), FRAC_CONST(0.044154857233763) }, + { FRAC_CONST(0.001592790795518), FRAC_CONST(0.044165461816692) }, + { FRAC_CONST(0.001321766632497), FRAC_CONST(0.044174403594946) }, + { FRAC_CONST(0.001050692705710), FRAC_CONST(0.044181682231873) }, + { FRAC_CONST(0.000779579220936), FRAC_CONST(0.044187297453434) }, + { FRAC_CONST(0.000508436385446), FRAC_CONST(0.044191249048222) }, + { FRAC_CONST(0.000237274407613), FRAC_CONST(0.044193536867459) } +}; +#endif // LD_DEC + +#ifdef ALLOW_SMALL_FRAMELENGTH +/* 480 (N/4) complex twiddle factors */ +ALIGN static const complex_t mdct_tab_1920[] = +{ + { FRAC_CONST(0.032274858518097), FRAC_CONST(0.000013202404176) }, + { FRAC_CONST(0.032274642494505), FRAC_CONST(0.000118821372483) }, + { FRAC_CONST(0.032274080835421), FRAC_CONST(0.000224439068308) }, + { FRAC_CONST(0.032273173546860), FRAC_CONST(0.000330054360572) }, + { FRAC_CONST(0.032271920638538), FRAC_CONST(0.000435666118218) }, + { FRAC_CONST(0.032270322123873), FRAC_CONST(0.000541273210231) }, + { FRAC_CONST(0.032268378019984), FRAC_CONST(0.000646874505642) }, + { FRAC_CONST(0.032266088347691), FRAC_CONST(0.000752468873546) }, + { FRAC_CONST(0.032263453131514), FRAC_CONST(0.000858055183114) }, + { FRAC_CONST(0.032260472399674), FRAC_CONST(0.000963632303600) }, + { FRAC_CONST(0.032257146184092), FRAC_CONST(0.001069199104358) }, + { FRAC_CONST(0.032253474520390), FRAC_CONST(0.001174754454853) }, + { FRAC_CONST(0.032249457447888), FRAC_CONST(0.001280297224671) }, + { FRAC_CONST(0.032245095009606), FRAC_CONST(0.001385826283535) }, + { FRAC_CONST(0.032240387252262), FRAC_CONST(0.001491340501313) }, + { FRAC_CONST(0.032235334226272), FRAC_CONST(0.001596838748031) }, + { FRAC_CONST(0.032229935985750), FRAC_CONST(0.001702319893890) }, + { FRAC_CONST(0.032224192588507), FRAC_CONST(0.001807782809271) }, + { FRAC_CONST(0.032218104096050), FRAC_CONST(0.001913226364749) }, + { FRAC_CONST(0.032211670573582), FRAC_CONST(0.002018649431111) }, + { FRAC_CONST(0.032204892090000), FRAC_CONST(0.002124050879359) }, + { FRAC_CONST(0.032197768717898), FRAC_CONST(0.002229429580728) }, + { FRAC_CONST(0.032190300533560), FRAC_CONST(0.002334784406698) }, + { FRAC_CONST(0.032182487616965), FRAC_CONST(0.002440114229003) }, + { FRAC_CONST(0.032174330051782), FRAC_CONST(0.002545417919644) }, + { FRAC_CONST(0.032165827925374), FRAC_CONST(0.002650694350905) }, + { FRAC_CONST(0.032156981328790), FRAC_CONST(0.002755942395358) }, + { FRAC_CONST(0.032147790356771), FRAC_CONST(0.002861160925883) }, + { FRAC_CONST(0.032138255107744), FRAC_CONST(0.002966348815672) }, + { FRAC_CONST(0.032128375683825), FRAC_CONST(0.003071504938250) }, + { FRAC_CONST(0.032118152190814), FRAC_CONST(0.003176628167476) }, + { FRAC_CONST(0.032107584738196), FRAC_CONST(0.003281717377568) }, + { FRAC_CONST(0.032096673439141), FRAC_CONST(0.003386771443102) }, + { FRAC_CONST(0.032085418410500), FRAC_CONST(0.003491789239036) }, + { FRAC_CONST(0.032073819772804), FRAC_CONST(0.003596769640711) }, + { FRAC_CONST(0.032061877650267), FRAC_CONST(0.003701711523874) }, + { FRAC_CONST(0.032049592170778), FRAC_CONST(0.003806613764680) }, + { FRAC_CONST(0.032036963465906), FRAC_CONST(0.003911475239711) }, + { FRAC_CONST(0.032023991670893), FRAC_CONST(0.004016294825985) }, + { FRAC_CONST(0.032010676924657), FRAC_CONST(0.004121071400967) }, + { FRAC_CONST(0.031997019369789), FRAC_CONST(0.004225803842586) }, + { FRAC_CONST(0.031983019152549), FRAC_CONST(0.004330491029241) }, + { FRAC_CONST(0.031968676422869), FRAC_CONST(0.004435131839816) }, + { FRAC_CONST(0.031953991334348), FRAC_CONST(0.004539725153692) }, + { FRAC_CONST(0.031938964044252), FRAC_CONST(0.004644269850758) }, + { FRAC_CONST(0.031923594713510), FRAC_CONST(0.004748764811426) }, + { FRAC_CONST(0.031907883506716), FRAC_CONST(0.004853208916638) }, + { FRAC_CONST(0.031891830592124), FRAC_CONST(0.004957601047881) }, + { FRAC_CONST(0.031875436141648), FRAC_CONST(0.005061940087200) }, + { FRAC_CONST(0.031858700330859), FRAC_CONST(0.005166224917208) }, + { FRAC_CONST(0.031841623338985), FRAC_CONST(0.005270454421097) }, + { FRAC_CONST(0.031824205348907), FRAC_CONST(0.005374627482653) }, + { FRAC_CONST(0.031806446547156), FRAC_CONST(0.005478742986267) }, + { FRAC_CONST(0.031788347123916), FRAC_CONST(0.005582799816945) }, + { FRAC_CONST(0.031769907273017), FRAC_CONST(0.005686796860323) }, + { FRAC_CONST(0.031751127191935), FRAC_CONST(0.005790733002674) }, + { FRAC_CONST(0.031732007081789), FRAC_CONST(0.005894607130928) }, + { FRAC_CONST(0.031712547147340), FRAC_CONST(0.005998418132675) }, + { FRAC_CONST(0.031692747596989), FRAC_CONST(0.006102164896182) }, + { FRAC_CONST(0.031672608642773), FRAC_CONST(0.006205846310406) }, + { FRAC_CONST(0.031652130500364), FRAC_CONST(0.006309461265002) }, + { FRAC_CONST(0.031631313389067), FRAC_CONST(0.006413008650337) }, + { FRAC_CONST(0.031610157531816), FRAC_CONST(0.006516487357501) }, + { FRAC_CONST(0.031588663155172), FRAC_CONST(0.006619896278321) }, + { FRAC_CONST(0.031566830489325), FRAC_CONST(0.006723234305370) }, + { FRAC_CONST(0.031544659768083), FRAC_CONST(0.006826500331981) }, + { FRAC_CONST(0.031522151228878), FRAC_CONST(0.006929693252258) }, + { FRAC_CONST(0.031499305112758), FRAC_CONST(0.007032811961088) }, + { FRAC_CONST(0.031476121664387), FRAC_CONST(0.007135855354151) }, + { FRAC_CONST(0.031452601132040), FRAC_CONST(0.007238822327937) }, + { FRAC_CONST(0.031428743767604), FRAC_CONST(0.007341711779751) }, + { FRAC_CONST(0.031404549826572), FRAC_CONST(0.007444522607730) }, + { FRAC_CONST(0.031380019568042), FRAC_CONST(0.007547253710853) }, + { FRAC_CONST(0.031355153254712), FRAC_CONST(0.007649903988952) }, + { FRAC_CONST(0.031329951152882), FRAC_CONST(0.007752472342725) }, + { FRAC_CONST(0.031304413532445), FRAC_CONST(0.007854957673748) }, + { FRAC_CONST(0.031278540666888), FRAC_CONST(0.007957358884484) }, + { FRAC_CONST(0.031252332833290), FRAC_CONST(0.008059674878300) }, + { FRAC_CONST(0.031225790312316), FRAC_CONST(0.008161904559473) }, + { FRAC_CONST(0.031198913388214), FRAC_CONST(0.008264046833205) }, + { FRAC_CONST(0.031171702348814), FRAC_CONST(0.008366100605636) }, + { FRAC_CONST(0.031144157485525), FRAC_CONST(0.008468064783849) }, + { FRAC_CONST(0.031116279093331), FRAC_CONST(0.008569938275893) }, + { FRAC_CONST(0.031088067470786), FRAC_CONST(0.008671719990782) }, + { FRAC_CONST(0.031059522920014), FRAC_CONST(0.008773408838517) }, + { FRAC_CONST(0.031030645746705), FRAC_CONST(0.008875003730092) }, + { FRAC_CONST(0.031001436260110), FRAC_CONST(0.008976503577507) }, + { FRAC_CONST(0.030971894773039), FRAC_CONST(0.009077907293780) }, + { FRAC_CONST(0.030942021601857), FRAC_CONST(0.009179213792959) }, + { FRAC_CONST(0.030911817066483), FRAC_CONST(0.009280421990133) }, + { FRAC_CONST(0.030881281490382), FRAC_CONST(0.009381530801444) }, + { FRAC_CONST(0.030850415200566), FRAC_CONST(0.009482539144097) }, + { FRAC_CONST(0.030819218527589), FRAC_CONST(0.009583445936373) }, + { FRAC_CONST(0.030787691805541), FRAC_CONST(0.009684250097643) }, + { FRAC_CONST(0.030755835372048), FRAC_CONST(0.009784950548375) }, + { FRAC_CONST(0.030723649568268), FRAC_CONST(0.009885546210147) }, + { FRAC_CONST(0.030691134738883), FRAC_CONST(0.009986036005661) }, + { FRAC_CONST(0.030658291232103), FRAC_CONST(0.010086418858753) }, + { FRAC_CONST(0.030625119399655), FRAC_CONST(0.010186693694402) }, + { FRAC_CONST(0.030591619596781), FRAC_CONST(0.010286859438745) }, + { FRAC_CONST(0.030557792182239), FRAC_CONST(0.010386915019088) }, + { FRAC_CONST(0.030523637518292), FRAC_CONST(0.010486859363916) }, + { FRAC_CONST(0.030489155970710), FRAC_CONST(0.010586691402906) }, + { FRAC_CONST(0.030454347908763), FRAC_CONST(0.010686410066936) }, + { FRAC_CONST(0.030419213705216), FRAC_CONST(0.010786014288099) }, + { FRAC_CONST(0.030383753736329), FRAC_CONST(0.010885502999714) }, + { FRAC_CONST(0.030347968381849), FRAC_CONST(0.010984875136338) }, + { FRAC_CONST(0.030311858025010), FRAC_CONST(0.011084129633775) }, + { FRAC_CONST(0.030275423052523), FRAC_CONST(0.011183265429088) }, + { FRAC_CONST(0.030238663854579), FRAC_CONST(0.011282281460612) }, + { FRAC_CONST(0.030201580824838), FRAC_CONST(0.011381176667967) }, + { FRAC_CONST(0.030164174360430), FRAC_CONST(0.011479949992062) }, + { FRAC_CONST(0.030126444861948), FRAC_CONST(0.011578600375117) }, + { FRAC_CONST(0.030088392733446), FRAC_CONST(0.011677126760663) }, + { FRAC_CONST(0.030050018382430), FRAC_CONST(0.011775528093563) }, + { FRAC_CONST(0.030011322219859), FRAC_CONST(0.011873803320018) }, + { FRAC_CONST(0.029972304660138), FRAC_CONST(0.011971951387578) }, + { FRAC_CONST(0.029932966121114), FRAC_CONST(0.012069971245157) }, + { FRAC_CONST(0.029893307024070), FRAC_CONST(0.012167861843041) }, + { FRAC_CONST(0.029853327793724), FRAC_CONST(0.012265622132901) }, + { FRAC_CONST(0.029813028858222), FRAC_CONST(0.012363251067801) }, + { FRAC_CONST(0.029772410649132), FRAC_CONST(0.012460747602215) }, + { FRAC_CONST(0.029731473601443), FRAC_CONST(0.012558110692033) }, + { FRAC_CONST(0.029690218153558), FRAC_CONST(0.012655339294575) }, + { FRAC_CONST(0.029648644747289), FRAC_CONST(0.012752432368600) }, + { FRAC_CONST(0.029606753827855), FRAC_CONST(0.012849388874320) }, + { FRAC_CONST(0.029564545843872), FRAC_CONST(0.012946207773407) }, + { FRAC_CONST(0.029522021247356), FRAC_CONST(0.013042888029011) }, + { FRAC_CONST(0.029479180493710), FRAC_CONST(0.013139428605762) }, + { FRAC_CONST(0.029436024041725), FRAC_CONST(0.013235828469789) }, + { FRAC_CONST(0.029392552353570), FRAC_CONST(0.013332086588727) }, + { FRAC_CONST(0.029348765894794), FRAC_CONST(0.013428201931728) }, + { FRAC_CONST(0.029304665134313), FRAC_CONST(0.013524173469475) }, + { FRAC_CONST(0.029260250544412), FRAC_CONST(0.013620000174189) }, + { FRAC_CONST(0.029215522600735), FRAC_CONST(0.013715681019643) }, + { FRAC_CONST(0.029170481782283), FRAC_CONST(0.013811214981173) }, + { FRAC_CONST(0.029125128571406), FRAC_CONST(0.013906601035686) }, + { FRAC_CONST(0.029079463453801), FRAC_CONST(0.014001838161674) }, + { FRAC_CONST(0.029033486918505), FRAC_CONST(0.014096925339225) }, + { FRAC_CONST(0.028987199457889), FRAC_CONST(0.014191861550031) }, + { FRAC_CONST(0.028940601567655), FRAC_CONST(0.014286645777401) }, + { FRAC_CONST(0.028893693746829), FRAC_CONST(0.014381277006273) }, + { FRAC_CONST(0.028846476497755), FRAC_CONST(0.014475754223221) }, + { FRAC_CONST(0.028798950326094), FRAC_CONST(0.014570076416472) }, + { FRAC_CONST(0.028751115740811), FRAC_CONST(0.014664242575910) }, + { FRAC_CONST(0.028702973254178), FRAC_CONST(0.014758251693091) }, + { FRAC_CONST(0.028654523381760), FRAC_CONST(0.014852102761253) }, + { FRAC_CONST(0.028605766642418), FRAC_CONST(0.014945794775326) }, + { FRAC_CONST(0.028556703558297), FRAC_CONST(0.015039326731945) }, + { FRAC_CONST(0.028507334654823), FRAC_CONST(0.015132697629457) }, + { FRAC_CONST(0.028457660460698), FRAC_CONST(0.015225906467935) }, + { FRAC_CONST(0.028407681507891), FRAC_CONST(0.015318952249187) }, + { FRAC_CONST(0.028357398331639), FRAC_CONST(0.015411833976768) }, + { FRAC_CONST(0.028306811470432), FRAC_CONST(0.015504550655988) }, + { FRAC_CONST(0.028255921466016), FRAC_CONST(0.015597101293927) }, + { FRAC_CONST(0.028204728863381), FRAC_CONST(0.015689484899442) }, + { FRAC_CONST(0.028153234210760), FRAC_CONST(0.015781700483179) }, + { FRAC_CONST(0.028101438059619), FRAC_CONST(0.015873747057582) }, + { FRAC_CONST(0.028049340964652), FRAC_CONST(0.015965623636907) }, + { FRAC_CONST(0.027996943483779), FRAC_CONST(0.016057329237229) }, + { FRAC_CONST(0.027944246178133), FRAC_CONST(0.016148862876456) }, + { FRAC_CONST(0.027891249612061), FRAC_CONST(0.016240223574335) }, + { FRAC_CONST(0.027837954353113), FRAC_CONST(0.016331410352467) }, + { FRAC_CONST(0.027784360972039), FRAC_CONST(0.016422422234315) }, + { FRAC_CONST(0.027730470042780), FRAC_CONST(0.016513258245214) }, + { FRAC_CONST(0.027676282142466), FRAC_CONST(0.016603917412384) }, + { FRAC_CONST(0.027621797851405), FRAC_CONST(0.016694398764938) }, + { FRAC_CONST(0.027567017753080), FRAC_CONST(0.016784701333894) }, + { FRAC_CONST(0.027511942434143), FRAC_CONST(0.016874824152183) }, + { FRAC_CONST(0.027456572484404), FRAC_CONST(0.016964766254662) }, + { FRAC_CONST(0.027400908496833), FRAC_CONST(0.017054526678124) }, + { FRAC_CONST(0.027344951067546), FRAC_CONST(0.017144104461307) }, + { FRAC_CONST(0.027288700795801), FRAC_CONST(0.017233498644904) }, + { FRAC_CONST(0.027232158283994), FRAC_CONST(0.017322708271577) }, + { FRAC_CONST(0.027175324137651), FRAC_CONST(0.017411732385960) }, + { FRAC_CONST(0.027118198965418), FRAC_CONST(0.017500570034678) }, + { FRAC_CONST(0.027060783379060), FRAC_CONST(0.017589220266351) }, + { FRAC_CONST(0.027003077993454), FRAC_CONST(0.017677682131607) }, + { FRAC_CONST(0.026945083426576), FRAC_CONST(0.017765954683088) }, + { FRAC_CONST(0.026886800299502), FRAC_CONST(0.017854036975468) }, + { FRAC_CONST(0.026828229236397), FRAC_CONST(0.017941928065456) }, + { FRAC_CONST(0.026769370864511), FRAC_CONST(0.018029627011808) }, + { FRAC_CONST(0.026710225814170), FRAC_CONST(0.018117132875340) }, + { FRAC_CONST(0.026650794718768), FRAC_CONST(0.018204444718934) }, + { FRAC_CONST(0.026591078214767), FRAC_CONST(0.018291561607551) }, + { FRAC_CONST(0.026531076941680), FRAC_CONST(0.018378482608238) }, + { FRAC_CONST(0.026470791542075), FRAC_CONST(0.018465206790142) }, + { FRAC_CONST(0.026410222661558), FRAC_CONST(0.018551733224515) }, + { FRAC_CONST(0.026349370948775), FRAC_CONST(0.018638060984730) }, + { FRAC_CONST(0.026288237055398), FRAC_CONST(0.018724189146286) }, + { FRAC_CONST(0.026226821636121), FRAC_CONST(0.018810116786819) }, + { FRAC_CONST(0.026165125348656), FRAC_CONST(0.018895842986112) }, + { FRAC_CONST(0.026103148853718), FRAC_CONST(0.018981366826109) }, + { FRAC_CONST(0.026040892815028), FRAC_CONST(0.019066687390916) }, + { FRAC_CONST(0.025978357899296), FRAC_CONST(0.019151803766819) }, + { FRAC_CONST(0.025915544776223), FRAC_CONST(0.019236715042290) }, + { FRAC_CONST(0.025852454118485), FRAC_CONST(0.019321420307998) }, + { FRAC_CONST(0.025789086601733), FRAC_CONST(0.019405918656817) }, + { FRAC_CONST(0.025725442904582), FRAC_CONST(0.019490209183837) }, + { FRAC_CONST(0.025661523708606), FRAC_CONST(0.019574290986376) }, + { FRAC_CONST(0.025597329698327), FRAC_CONST(0.019658163163984) }, + { FRAC_CONST(0.025532861561211), FRAC_CONST(0.019741824818458) }, + { FRAC_CONST(0.025468119987662), FRAC_CONST(0.019825275053848) }, + { FRAC_CONST(0.025403105671008), FRAC_CONST(0.019908512976470) }, + { FRAC_CONST(0.025337819307501), FRAC_CONST(0.019991537694913) }, + { FRAC_CONST(0.025272261596305), FRAC_CONST(0.020074348320047) }, + { FRAC_CONST(0.025206433239491), FRAC_CONST(0.020156943965039) }, + { FRAC_CONST(0.025140334942028), FRAC_CONST(0.020239323745355) }, + { FRAC_CONST(0.025073967411776), FRAC_CONST(0.020321486778774) }, + { FRAC_CONST(0.025007331359476), FRAC_CONST(0.020403432185395) }, + { FRAC_CONST(0.024940427498748), FRAC_CONST(0.020485159087650) }, + { FRAC_CONST(0.024873256546079), FRAC_CONST(0.020566666610309) }, + { FRAC_CONST(0.024805819220816), FRAC_CONST(0.020647953880491) }, + { FRAC_CONST(0.024738116245157), FRAC_CONST(0.020729020027676) }, + { FRAC_CONST(0.024670148344147), FRAC_CONST(0.020809864183709) }, + { FRAC_CONST(0.024601916245669), FRAC_CONST(0.020890485482816) }, + { FRAC_CONST(0.024533420680433), FRAC_CONST(0.020970883061607) }, + { FRAC_CONST(0.024464662381971), FRAC_CONST(0.021051056059087) }, + { FRAC_CONST(0.024395642086630), FRAC_CONST(0.021131003616670) }, + { FRAC_CONST(0.024326360533561), FRAC_CONST(0.021210724878181) }, + { FRAC_CONST(0.024256818464715), FRAC_CONST(0.021290218989868) }, + { FRAC_CONST(0.024187016624830), FRAC_CONST(0.021369485100415) }, + { FRAC_CONST(0.024116955761430), FRAC_CONST(0.021448522360944) }, + { FRAC_CONST(0.024046636624808), FRAC_CONST(0.021527329925030) }, + { FRAC_CONST(0.023976059968027), FRAC_CONST(0.021605906948708) }, + { FRAC_CONST(0.023905226546906), FRAC_CONST(0.021684252590480) }, + { FRAC_CONST(0.023834137120014), FRAC_CONST(0.021762366011328) }, + { FRAC_CONST(0.023762792448662), FRAC_CONST(0.021840246374720) }, + { FRAC_CONST(0.023691193296893), FRAC_CONST(0.021917892846620) }, + { FRAC_CONST(0.023619340431478), FRAC_CONST(0.021995304595495) }, + { FRAC_CONST(0.023547234621902), FRAC_CONST(0.022072480792330) }, + { FRAC_CONST(0.023474876640361), FRAC_CONST(0.022149420610628) }, + { FRAC_CONST(0.023402267261751), FRAC_CONST(0.022226123226426) }, + { FRAC_CONST(0.023329407263659), FRAC_CONST(0.022302587818300) }, + { FRAC_CONST(0.023256297426359), FRAC_CONST(0.022378813567377) }, + { FRAC_CONST(0.023182938532797), FRAC_CONST(0.022454799657339) }, + { FRAC_CONST(0.023109331368588), FRAC_CONST(0.022530545274437) }, + { FRAC_CONST(0.023035476722006), FRAC_CONST(0.022606049607496) }, + { FRAC_CONST(0.022961375383975), FRAC_CONST(0.022681311847926) }, + { FRAC_CONST(0.022887028148061), FRAC_CONST(0.022756331189727) }, + { FRAC_CONST(0.022812435810462), FRAC_CONST(0.022831106829504) }, + { FRAC_CONST(0.022737599170003), FRAC_CONST(0.022905637966469) }, + { FRAC_CONST(0.022662519028125), FRAC_CONST(0.022979923802453) }, + { FRAC_CONST(0.022587196188874), FRAC_CONST(0.023053963541915) }, + { FRAC_CONST(0.022511631458899), FRAC_CONST(0.023127756391950) }, + { FRAC_CONST(0.022435825647437), FRAC_CONST(0.023201301562294) }, + { FRAC_CONST(0.022359779566306), FRAC_CONST(0.023274598265338) }, + { FRAC_CONST(0.022283494029900), FRAC_CONST(0.023347645716133) }, + { FRAC_CONST(0.022206969855176), FRAC_CONST(0.023420443132400) }, + { FRAC_CONST(0.022130207861645), FRAC_CONST(0.023492989734537) }, + { FRAC_CONST(0.022053208871367), FRAC_CONST(0.023565284745628) }, + { FRAC_CONST(0.021975973708940), FRAC_CONST(0.023637327391451) }, + { FRAC_CONST(0.021898503201489), FRAC_CONST(0.023709116900488) }, + { FRAC_CONST(0.021820798178663), FRAC_CONST(0.023780652503931) }, + { FRAC_CONST(0.021742859472618), FRAC_CONST(0.023851933435691) }, + { FRAC_CONST(0.021664687918017), FRAC_CONST(0.023922958932406) }, + { FRAC_CONST(0.021586284352013), FRAC_CONST(0.023993728233451) }, + { FRAC_CONST(0.021507649614247), FRAC_CONST(0.024064240580942) }, + { FRAC_CONST(0.021428784546832), FRAC_CONST(0.024134495219750) }, + { FRAC_CONST(0.021349689994350), FRAC_CONST(0.024204491397504) }, + { FRAC_CONST(0.021270366803840), FRAC_CONST(0.024274228364600) }, + { FRAC_CONST(0.021190815824791), FRAC_CONST(0.024343705374213) }, + { FRAC_CONST(0.021111037909128), FRAC_CONST(0.024412921682298) }, + { FRAC_CONST(0.021031033911210), FRAC_CONST(0.024481876547605) }, + { FRAC_CONST(0.020950804687815), FRAC_CONST(0.024550569231683) }, + { FRAC_CONST(0.020870351098134), FRAC_CONST(0.024618998998889) }, + { FRAC_CONST(0.020789674003759), FRAC_CONST(0.024687165116394) }, + { FRAC_CONST(0.020708774268678), FRAC_CONST(0.024755066854194) }, + { FRAC_CONST(0.020627652759262), FRAC_CONST(0.024822703485116) }, + { FRAC_CONST(0.020546310344257), FRAC_CONST(0.024890074284826) }, + { FRAC_CONST(0.020464747894775), FRAC_CONST(0.024957178531837) }, + { FRAC_CONST(0.020382966284284), FRAC_CONST(0.025024015507516) }, + { FRAC_CONST(0.020300966388600), FRAC_CONST(0.025090584496093) }, + { FRAC_CONST(0.020218749085876), FRAC_CONST(0.025156884784668) }, + { FRAC_CONST(0.020136315256592), FRAC_CONST(0.025222915663218) }, + { FRAC_CONST(0.020053665783549), FRAC_CONST(0.025288676424605) }, + { FRAC_CONST(0.019970801551857), FRAC_CONST(0.025354166364584) }, + { FRAC_CONST(0.019887723448925), FRAC_CONST(0.025419384781811) }, + { FRAC_CONST(0.019804432364452), FRAC_CONST(0.025484330977848) }, + { FRAC_CONST(0.019720929190419), FRAC_CONST(0.025549004257175) }, + { FRAC_CONST(0.019637214821078), FRAC_CONST(0.025613403927192) }, + { FRAC_CONST(0.019553290152943), FRAC_CONST(0.025677529298230) }, + { FRAC_CONST(0.019469156084779), FRAC_CONST(0.025741379683559) }, + { FRAC_CONST(0.019384813517595), FRAC_CONST(0.025804954399392) }, + { FRAC_CONST(0.019300263354632), FRAC_CONST(0.025868252764895) }, + { FRAC_CONST(0.019215506501354), FRAC_CONST(0.025931274102193) }, + { FRAC_CONST(0.019130543865439), FRAC_CONST(0.025994017736379) }, + { FRAC_CONST(0.019045376356769), FRAC_CONST(0.026056482995518) }, + { FRAC_CONST(0.018960004887419), FRAC_CONST(0.026118669210657) }, + { FRAC_CONST(0.018874430371648), FRAC_CONST(0.026180575715833) }, + { FRAC_CONST(0.018788653725892), FRAC_CONST(0.026242201848076) }, + { FRAC_CONST(0.018702675868750), FRAC_CONST(0.026303546947421) }, + { FRAC_CONST(0.018616497720974), FRAC_CONST(0.026364610356909) }, + { FRAC_CONST(0.018530120205464), FRAC_CONST(0.026425391422602) }, + { FRAC_CONST(0.018443544247254), FRAC_CONST(0.026485889493583) }, + { FRAC_CONST(0.018356770773502), FRAC_CONST(0.026546103921965) }, + { FRAC_CONST(0.018269800713483), FRAC_CONST(0.026606034062902) }, + { FRAC_CONST(0.018182634998576), FRAC_CONST(0.026665679274589) }, + { FRAC_CONST(0.018095274562256), FRAC_CONST(0.026725038918274) }, + { FRAC_CONST(0.018007720340083), FRAC_CONST(0.026784112358263) }, + { FRAC_CONST(0.017919973269692), FRAC_CONST(0.026842898961926) }, + { FRAC_CONST(0.017832034290785), FRAC_CONST(0.026901398099707) }, + { FRAC_CONST(0.017743904345116), FRAC_CONST(0.026959609145127) }, + { FRAC_CONST(0.017655584376488), FRAC_CONST(0.027017531474792) }, + { FRAC_CONST(0.017567075330734), FRAC_CONST(0.027075164468401) }, + { FRAC_CONST(0.017478378155718), FRAC_CONST(0.027132507508750) }, + { FRAC_CONST(0.017389493801313), FRAC_CONST(0.027189559981742) }, + { FRAC_CONST(0.017300423219401), FRAC_CONST(0.027246321276391) }, + { FRAC_CONST(0.017211167363854), FRAC_CONST(0.027302790784828) }, + { FRAC_CONST(0.017121727190533), FRAC_CONST(0.027358967902310) }, + { FRAC_CONST(0.017032103657269), FRAC_CONST(0.027414852027226) }, + { FRAC_CONST(0.016942297723858), FRAC_CONST(0.027470442561102) }, + { FRAC_CONST(0.016852310352050), FRAC_CONST(0.027525738908608) }, + { FRAC_CONST(0.016762142505537), FRAC_CONST(0.027580740477564) }, + { FRAC_CONST(0.016671795149944), FRAC_CONST(0.027635446678948) }, + { FRAC_CONST(0.016581269252819), FRAC_CONST(0.027689856926900) }, + { FRAC_CONST(0.016490565783622), FRAC_CONST(0.027743970638730) }, + { FRAC_CONST(0.016399685713714), FRAC_CONST(0.027797787234924) }, + { FRAC_CONST(0.016308630016347), FRAC_CONST(0.027851306139149) }, + { FRAC_CONST(0.016217399666655), FRAC_CONST(0.027904526778260) }, + { FRAC_CONST(0.016125995641641), FRAC_CONST(0.027957448582309) }, + { FRAC_CONST(0.016034418920170), FRAC_CONST(0.028010070984544) }, + { FRAC_CONST(0.015942670482954), FRAC_CONST(0.028062393421421) }, + { FRAC_CONST(0.015850751312545), FRAC_CONST(0.028114415332610) }, + { FRAC_CONST(0.015758662393324), FRAC_CONST(0.028166136160998) }, + { FRAC_CONST(0.015666404711489), FRAC_CONST(0.028217555352697) }, + { FRAC_CONST(0.015573979255046), FRAC_CONST(0.028268672357047) }, + { FRAC_CONST(0.015481387013797), FRAC_CONST(0.028319486626627) }, + { FRAC_CONST(0.015388628979331), FRAC_CONST(0.028369997617257) }, + { FRAC_CONST(0.015295706145012), FRAC_CONST(0.028420204788004) }, + { FRAC_CONST(0.015202619505968), FRAC_CONST(0.028470107601191) }, + { FRAC_CONST(0.015109370059084), FRAC_CONST(0.028519705522399) }, + { FRAC_CONST(0.015015958802984), FRAC_CONST(0.028568998020472) }, + { FRAC_CONST(0.014922386738030), FRAC_CONST(0.028617984567529) }, + { FRAC_CONST(0.014828654866302), FRAC_CONST(0.028666664638963) }, + { FRAC_CONST(0.014734764191593), FRAC_CONST(0.028715037713449) }, + { FRAC_CONST(0.014640715719398), FRAC_CONST(0.028763103272951) }, + { FRAC_CONST(0.014546510456900), FRAC_CONST(0.028810860802724) }, + { FRAC_CONST(0.014452149412962), FRAC_CONST(0.028858309791325) }, + { FRAC_CONST(0.014357633598114), FRAC_CONST(0.028905449730613) }, + { FRAC_CONST(0.014262964024545), FRAC_CONST(0.028952280115756) }, + { FRAC_CONST(0.014168141706090), FRAC_CONST(0.028998800445240) }, + { FRAC_CONST(0.014073167658220), FRAC_CONST(0.029045010220868) }, + { FRAC_CONST(0.013978042898030), FRAC_CONST(0.029090908947771) }, + { FRAC_CONST(0.013882768444231), FRAC_CONST(0.029136496134411) }, + { FRAC_CONST(0.013787345317136), FRAC_CONST(0.029181771292585) }, + { FRAC_CONST(0.013691774538648), FRAC_CONST(0.029226733937433) }, + { FRAC_CONST(0.013596057132255), FRAC_CONST(0.029271383587441) }, + { FRAC_CONST(0.013500194123014), FRAC_CONST(0.029315719764447) }, + { FRAC_CONST(0.013404186537539), FRAC_CONST(0.029359741993647) }, + { FRAC_CONST(0.013308035403995), FRAC_CONST(0.029403449803598) }, + { FRAC_CONST(0.013211741752084), FRAC_CONST(0.029446842726223) }, + { FRAC_CONST(0.013115306613032), FRAC_CONST(0.029489920296820) }, + { FRAC_CONST(0.013018731019584), FRAC_CONST(0.029532682054063) }, + { FRAC_CONST(0.012922016005985), FRAC_CONST(0.029575127540008) }, + { FRAC_CONST(0.012825162607977), FRAC_CONST(0.029617256300097) }, + { FRAC_CONST(0.012728171862781), FRAC_CONST(0.029659067883165) }, + { FRAC_CONST(0.012631044809089), FRAC_CONST(0.029700561841444) }, + { FRAC_CONST(0.012533782487056), FRAC_CONST(0.029741737730567) }, + { FRAC_CONST(0.012436385938281), FRAC_CONST(0.029782595109573) }, + { FRAC_CONST(0.012338856205805), FRAC_CONST(0.029823133540913) }, + { FRAC_CONST(0.012241194334091), FRAC_CONST(0.029863352590452) }, + { FRAC_CONST(0.012143401369021), FRAC_CONST(0.029903251827477) }, + { FRAC_CONST(0.012045478357878), FRAC_CONST(0.029942830824699) }, + { FRAC_CONST(0.011947426349339), FRAC_CONST(0.029982089158259) }, + { FRAC_CONST(0.011849246393462), FRAC_CONST(0.030021026407731) }, + { FRAC_CONST(0.011750939541676), FRAC_CONST(0.030059642156129) }, + { FRAC_CONST(0.011652506846768), FRAC_CONST(0.030097935989909) }, + { FRAC_CONST(0.011553949362874), FRAC_CONST(0.030135907498976) }, + { FRAC_CONST(0.011455268145464), FRAC_CONST(0.030173556276684) }, + { FRAC_CONST(0.011356464251335), FRAC_CONST(0.030210881919845) }, + { FRAC_CONST(0.011257538738598), FRAC_CONST(0.030247884028732) }, + { FRAC_CONST(0.011158492666665), FRAC_CONST(0.030284562207083) }, + { FRAC_CONST(0.011059327096240), FRAC_CONST(0.030320916062102) }, + { FRAC_CONST(0.010960043089307), FRAC_CONST(0.030356945204470) }, + { FRAC_CONST(0.010860641709118), FRAC_CONST(0.030392649248343) }, + { FRAC_CONST(0.010761124020182), FRAC_CONST(0.030428027811361) }, + { FRAC_CONST(0.010661491088253), FRAC_CONST(0.030463080514646) }, + { FRAC_CONST(0.010561743980319), FRAC_CONST(0.030497806982812) }, + { FRAC_CONST(0.010461883764593), FRAC_CONST(0.030532206843968) }, + { FRAC_CONST(0.010361911510496), FRAC_CONST(0.030566279729717) }, + { FRAC_CONST(0.010261828288652), FRAC_CONST(0.030600025275167) }, + { FRAC_CONST(0.010161635170872), FRAC_CONST(0.030633443118931) }, + { FRAC_CONST(0.010061333230142), FRAC_CONST(0.030666532903129) }, + { FRAC_CONST(0.009960923540617), FRAC_CONST(0.030699294273397) }, + { FRAC_CONST(0.009860407177603), FRAC_CONST(0.030731726878888) }, + { FRAC_CONST(0.009759785217550), FRAC_CONST(0.030763830372273) }, + { FRAC_CONST(0.009659058738038), FRAC_CONST(0.030795604409750) }, + { FRAC_CONST(0.009558228817767), FRAC_CONST(0.030827048651045) }, + { FRAC_CONST(0.009457296536545), FRAC_CONST(0.030858162759415) }, + { FRAC_CONST(0.009356262975275), FRAC_CONST(0.030888946401653) }, + { FRAC_CONST(0.009255129215945), FRAC_CONST(0.030919399248091) }, + { FRAC_CONST(0.009153896341616), FRAC_CONST(0.030949520972603) }, + { FRAC_CONST(0.009052565436412), FRAC_CONST(0.030979311252611) }, + { FRAC_CONST(0.008951137585505), FRAC_CONST(0.031008769769084) }, + { FRAC_CONST(0.008849613875105), FRAC_CONST(0.031037896206544) }, + { FRAC_CONST(0.008747995392451), FRAC_CONST(0.031066690253072) }, + { FRAC_CONST(0.008646283225794), FRAC_CONST(0.031095151600306) }, + { FRAC_CONST(0.008544478464390), FRAC_CONST(0.031123279943448) }, + { FRAC_CONST(0.008442582198486), FRAC_CONST(0.031151074981266) }, + { FRAC_CONST(0.008340595519310), FRAC_CONST(0.031178536416098) }, + { FRAC_CONST(0.008238519519057), FRAC_CONST(0.031205663953853) }, + { FRAC_CONST(0.008136355290878), FRAC_CONST(0.031232457304017) }, + { FRAC_CONST(0.008034103928871), FRAC_CONST(0.031258916179656) }, + { FRAC_CONST(0.007931766528065), FRAC_CONST(0.031285040297416) }, + { FRAC_CONST(0.007829344184412), FRAC_CONST(0.031310829377528) }, + { FRAC_CONST(0.007726837994772), FRAC_CONST(0.031336283143813) }, + { FRAC_CONST(0.007624249056906), FRAC_CONST(0.031361401323680) }, + { FRAC_CONST(0.007521578469457), FRAC_CONST(0.031386183648135) }, + { FRAC_CONST(0.007418827331946), FRAC_CONST(0.031410629851778) }, + { FRAC_CONST(0.007315996744755), FRAC_CONST(0.031434739672811) }, + { FRAC_CONST(0.007213087809115), FRAC_CONST(0.031458512853036) }, + { FRAC_CONST(0.007110101627101), FRAC_CONST(0.031481949137863) }, + { FRAC_CONST(0.007007039301610), FRAC_CONST(0.031505048276306) }, + { FRAC_CONST(0.006903901936357), FRAC_CONST(0.031527810020993) }, + { FRAC_CONST(0.006800690635862), FRAC_CONST(0.031550234128164) }, + { FRAC_CONST(0.006697406505433), FRAC_CONST(0.031572320357675) }, + { FRAC_CONST(0.006594050651161), FRAC_CONST(0.031594068473000) }, + { FRAC_CONST(0.006490624179905), FRAC_CONST(0.031615478241233) }, + { FRAC_CONST(0.006387128199278), FRAC_CONST(0.031636549433095) }, + { FRAC_CONST(0.006283563817639), FRAC_CONST(0.031657281822929) }, + { FRAC_CONST(0.006179932144080), FRAC_CONST(0.031677675188707) }, + { FRAC_CONST(0.006076234288412), FRAC_CONST(0.031697729312034) }, + { FRAC_CONST(0.005972471361157), FRAC_CONST(0.031717443978146) }, + { FRAC_CONST(0.005868644473532), FRAC_CONST(0.031736818975914) }, + { FRAC_CONST(0.005764754737440), FRAC_CONST(0.031755854097848) }, + { FRAC_CONST(0.005660803265456), FRAC_CONST(0.031774549140098) }, + { FRAC_CONST(0.005556791170816), FRAC_CONST(0.031792903902453) }, + { FRAC_CONST(0.005452719567407), FRAC_CONST(0.031810918188350) }, + { FRAC_CONST(0.005348589569753), FRAC_CONST(0.031828591804869) }, + { FRAC_CONST(0.005244402293001), FRAC_CONST(0.031845924562742) }, + { FRAC_CONST(0.005140158852914), FRAC_CONST(0.031862916276347) }, + { FRAC_CONST(0.005035860365855), FRAC_CONST(0.031879566763717) }, + { FRAC_CONST(0.004931507948778), FRAC_CONST(0.031895875846539) }, + { FRAC_CONST(0.004827102719212), FRAC_CONST(0.031911843350155) }, + { FRAC_CONST(0.004722645795254), FRAC_CONST(0.031927469103567) }, + { FRAC_CONST(0.004618138295554), FRAC_CONST(0.031942752939435) }, + { FRAC_CONST(0.004513581339303), FRAC_CONST(0.031957694694082) }, + { FRAC_CONST(0.004408976046222), FRAC_CONST(0.031972294207493) }, + { FRAC_CONST(0.004304323536549), FRAC_CONST(0.031986551323320) }, + { FRAC_CONST(0.004199624931030), FRAC_CONST(0.032000465888879) }, + { FRAC_CONST(0.004094881350902), FRAC_CONST(0.032014037755158) }, + { FRAC_CONST(0.003990093917884), FRAC_CONST(0.032027266776813) }, + { FRAC_CONST(0.003885263754166), FRAC_CONST(0.032040152812170) }, + { FRAC_CONST(0.003780391982394), FRAC_CONST(0.032052695723232) }, + { FRAC_CONST(0.003675479725661), FRAC_CONST(0.032064895375674) }, + { FRAC_CONST(0.003570528107494), FRAC_CONST(0.032076751638847) }, + { FRAC_CONST(0.003465538251839), FRAC_CONST(0.032088264385780) }, + { FRAC_CONST(0.003360511283053), FRAC_CONST(0.032099433493181) }, + { FRAC_CONST(0.003255448325892), FRAC_CONST(0.032110258841438) }, + { FRAC_CONST(0.003150350505494), FRAC_CONST(0.032120740314619) }, + { FRAC_CONST(0.003045218947373), FRAC_CONST(0.032130877800478) }, + { FRAC_CONST(0.002940054777404), FRAC_CONST(0.032140671190449) }, + { FRAC_CONST(0.002834859121810), FRAC_CONST(0.032150120379653) }, + { FRAC_CONST(0.002729633107153), FRAC_CONST(0.032159225266897) }, + { FRAC_CONST(0.002624377860318), FRAC_CONST(0.032167985754674) }, + { FRAC_CONST(0.002519094508504), FRAC_CONST(0.032176401749168) }, + { FRAC_CONST(0.002413784179212), FRAC_CONST(0.032184473160250) }, + { FRAC_CONST(0.002308448000231), FRAC_CONST(0.032192199901481) }, + { FRAC_CONST(0.002203087099626), FRAC_CONST(0.032199581890114) }, + { FRAC_CONST(0.002097702605728), FRAC_CONST(0.032206619047093) }, + { FRAC_CONST(0.001992295647121), FRAC_CONST(0.032213311297057) }, + { FRAC_CONST(0.001886867352628), FRAC_CONST(0.032219658568338) }, + { FRAC_CONST(0.001781418851302), FRAC_CONST(0.032225660792960) }, + { FRAC_CONST(0.001675951272410), FRAC_CONST(0.032231317906644) }, + { FRAC_CONST(0.001570465745428), FRAC_CONST(0.032236629848809) }, + { FRAC_CONST(0.001464963400018), FRAC_CONST(0.032241596562566) }, + { FRAC_CONST(0.001359445366028), FRAC_CONST(0.032246217994727) }, + { FRAC_CONST(0.001253912773470), FRAC_CONST(0.032250494095799) }, + { FRAC_CONST(0.001148366752513), FRAC_CONST(0.032254424819990) }, + { FRAC_CONST(0.001042808433471), FRAC_CONST(0.032258010125204) }, + { FRAC_CONST(0.000937238946789), FRAC_CONST(0.032261249973045) }, + { FRAC_CONST(0.000831659423030), FRAC_CONST(0.032264144328817) }, + { FRAC_CONST(0.000726070992868), FRAC_CONST(0.032266693161525) }, + { FRAC_CONST(0.000620474787068), FRAC_CONST(0.032268896443871) }, + { FRAC_CONST(0.000514871936481), FRAC_CONST(0.032270754152261) }, + { FRAC_CONST(0.000409263572030), FRAC_CONST(0.032272266266801) }, + { FRAC_CONST(0.000303650824695), FRAC_CONST(0.032273432771295) }, + { FRAC_CONST(0.000198034825504), FRAC_CONST(0.032274253653254) }, + { FRAC_CONST(0.000092416705518), FRAC_CONST(0.032274728903884) } +}; + +#ifdef LD_DEC +/* 240 (N/4) complex twiddle factors */ +ALIGN static const complex_t mdct_tab_960[] = +{ + { FRAC_CONST(0.045643531183573), FRAC_CONST(0.000037342034959) }, + { FRAC_CONST(0.045642309173789), FRAC_CONST(0.000336075315362) }, + { FRAC_CONST(0.045639131999390), FRAC_CONST(0.000634794199417) }, + { FRAC_CONST(0.045633999796474), FRAC_CONST(0.000933485891002) }, + { FRAC_CONST(0.045626912784890), FRAC_CONST(0.001232137595157) }, + { FRAC_CONST(0.045617871268219), FRAC_CONST(0.001530736518639) }, + { FRAC_CONST(0.045606875633772), FRAC_CONST(0.001829269870464) }, + { FRAC_CONST(0.045593926352564), FRAC_CONST(0.002127724862455) }, + { FRAC_CONST(0.045579023979299), FRAC_CONST(0.002426088709795) }, + { FRAC_CONST(0.045562169152346), FRAC_CONST(0.002724348631569) }, + { FRAC_CONST(0.045543362593709), FRAC_CONST(0.003022491851315) }, + { FRAC_CONST(0.045522605108999), FRAC_CONST(0.003320505597570) }, + { FRAC_CONST(0.045499897587396), FRAC_CONST(0.003618377104416) }, + { FRAC_CONST(0.045475241001617), FRAC_CONST(0.003916093612031) }, + { FRAC_CONST(0.045448636407866), FRAC_CONST(0.004213642367228) }, + { FRAC_CONST(0.045420084945797), FRAC_CONST(0.004511010624011) }, + { FRAC_CONST(0.045389587838458), FRAC_CONST(0.004808185644112) }, + { FRAC_CONST(0.045357146392244), FRAC_CONST(0.005105154697544) }, + { FRAC_CONST(0.045322761996840), FRAC_CONST(0.005401905063139) }, + { FRAC_CONST(0.045286436125157), FRAC_CONST(0.005698424029100) }, + { FRAC_CONST(0.045248170333275), FRAC_CONST(0.005994698893542) }, + { FRAC_CONST(0.045207966260374), FRAC_CONST(0.006290716965035) }, + { FRAC_CONST(0.045165825628663), FRAC_CONST(0.006586465563151) }, + { FRAC_CONST(0.045121750243305), FRAC_CONST(0.006881932019003) }, + { FRAC_CONST(0.045075741992343), FRAC_CONST(0.007177103675792) }, + { FRAC_CONST(0.045027802846618), FRAC_CONST(0.007471967889347) }, + { FRAC_CONST(0.044977934859683), FRAC_CONST(0.007766512028667) }, + { FRAC_CONST(0.044926140167717), FRAC_CONST(0.008060723476460) }, + { FRAC_CONST(0.044872420989432), FRAC_CONST(0.008354589629687) }, + { FRAC_CONST(0.044816779625979), FRAC_CONST(0.008648097900101) }, + { FRAC_CONST(0.044759218460849), FRAC_CONST(0.008941235714784) }, + { FRAC_CONST(0.044699739959770), FRAC_CONST(0.009233990516688) }, + { FRAC_CONST(0.044638346670603), FRAC_CONST(0.009526349765171) }, + { FRAC_CONST(0.044575041223233), FRAC_CONST(0.009818300936537) }, + { FRAC_CONST(0.044509826329454), FRAC_CONST(0.010109831524568) }, + { FRAC_CONST(0.044442704782856), FRAC_CONST(0.010400929041064) }, + { FRAC_CONST(0.044373679458701), FRAC_CONST(0.010691581016378) }, + { FRAC_CONST(0.044302753313806), FRAC_CONST(0.010981774999945) }, + { FRAC_CONST(0.044229929386409), FRAC_CONST(0.011271498560822) }, + { FRAC_CONST(0.044155210796046), FRAC_CONST(0.011560739288214) }, + { FRAC_CONST(0.044078600743413), FRAC_CONST(0.011849484792012) }, + { FRAC_CONST(0.044000102510229), FRAC_CONST(0.012137722703321) }, + { FRAC_CONST(0.043919719459097), FRAC_CONST(0.012425440674986) }, + { FRAC_CONST(0.043837455033359), FRAC_CONST(0.012712626382127) }, + { FRAC_CONST(0.043753312756950), FRAC_CONST(0.012999267522665) }, + { FRAC_CONST(0.043667296234245), FRAC_CONST(0.013285351817848) }, + { FRAC_CONST(0.043579409149906), FRAC_CONST(0.013570867012776) }, + { FRAC_CONST(0.043489655268722), FRAC_CONST(0.013855800876928) }, + { FRAC_CONST(0.043398038435451), FRAC_CONST(0.014140141204686) }, + { FRAC_CONST(0.043304562574653), FRAC_CONST(0.014423875815857) }, + { FRAC_CONST(0.043209231690524), FRAC_CONST(0.014706992556195) }, + { FRAC_CONST(0.043112049866720), FRAC_CONST(0.014989479297920) }, + { FRAC_CONST(0.043013021266188), FRAC_CONST(0.015271323940241) }, + { FRAC_CONST(0.042912150130984), FRAC_CONST(0.015552514409871) }, + { FRAC_CONST(0.042809440782090), FRAC_CONST(0.015833038661547) }, + { FRAC_CONST(0.042704897619235), FRAC_CONST(0.016112884678543) }, + { FRAC_CONST(0.042598525120698), FRAC_CONST(0.016392040473187) }, + { FRAC_CONST(0.042490327843124), FRAC_CONST(0.016670494087374) }, + { FRAC_CONST(0.042380310421324), FRAC_CONST(0.016948233593079) }, + { FRAC_CONST(0.042268477568078), FRAC_CONST(0.017225247092864) }, + { FRAC_CONST(0.042154834073934), FRAC_CONST(0.017501522720393) }, + { FRAC_CONST(0.042039384807000), FRAC_CONST(0.017777048640940) }, + { FRAC_CONST(0.041922134712739), FRAC_CONST(0.018051813051888) }, + { FRAC_CONST(0.041803088813754), FRAC_CONST(0.018325804183247) }, + { FRAC_CONST(0.041682252209576), FRAC_CONST(0.018599010298148) }, + { FRAC_CONST(0.041559630076443), FRAC_CONST(0.018871419693350) }, + { FRAC_CONST(0.041435227667079), FRAC_CONST(0.019143020699741) }, + { FRAC_CONST(0.041309050310468), FRAC_CONST(0.019413801682838) }, + { FRAC_CONST(0.041181103411629), FRAC_CONST(0.019683751043285) }, + { FRAC_CONST(0.041051392451382), FRAC_CONST(0.019952857217350) }, + { FRAC_CONST(0.040919922986111), FRAC_CONST(0.020221108677421) }, + { FRAC_CONST(0.040786700647532), FRAC_CONST(0.020488493932496) }, + { FRAC_CONST(0.040651731142446), FRAC_CONST(0.020755001528683) }, + { FRAC_CONST(0.040515020252497), FRAC_CONST(0.021020620049682) }, + { FRAC_CONST(0.040376573833925), FRAC_CONST(0.021285338117280) }, + { FRAC_CONST(0.040236397817314), FRAC_CONST(0.021549144391836) }, + { FRAC_CONST(0.040094498207337), FRAC_CONST(0.021812027572768) }, + { FRAC_CONST(0.039950881082502), FRAC_CONST(0.022073976399034) }, + { FRAC_CONST(0.039805552594888), FRAC_CONST(0.022334979649620) }, + { FRAC_CONST(0.039658518969884), FRAC_CONST(0.022595026144014) }, + { FRAC_CONST(0.039509786505922), FRAC_CONST(0.022854104742690) }, + { FRAC_CONST(0.039359361574204), FRAC_CONST(0.023112204347583) }, + { FRAC_CONST(0.039207250618434), FRAC_CONST(0.023369313902565) }, + { FRAC_CONST(0.039053460154540), FRAC_CONST(0.023625422393919) }, + { FRAC_CONST(0.038897996770393), FRAC_CONST(0.023880518850809) }, + { FRAC_CONST(0.038740867125527), FRAC_CONST(0.024134592345752) }, + { FRAC_CONST(0.038582077950852), FRAC_CONST(0.024387631995085) }, + { FRAC_CONST(0.038421636048370), FRAC_CONST(0.024639626959432) }, + { FRAC_CONST(0.038259548290876), FRAC_CONST(0.024890566444167) }, + { FRAC_CONST(0.038095821621671), FRAC_CONST(0.025140439699877) }, + { FRAC_CONST(0.037930463054261), FRAC_CONST(0.025389236022825) }, + { FRAC_CONST(0.037763479672055), FRAC_CONST(0.025636944755403) }, + { FRAC_CONST(0.037594878628068), FRAC_CONST(0.025883555286595) }, + { FRAC_CONST(0.037424667144605), FRAC_CONST(0.026129057052425) }, + { FRAC_CONST(0.037252852512960), FRAC_CONST(0.026373439536415) }, + { FRAC_CONST(0.037079442093102), FRAC_CONST(0.026616692270033) }, + { FRAC_CONST(0.036904443313354), FRAC_CONST(0.026858804833142) }, + { FRAC_CONST(0.036727863670081), FRAC_CONST(0.027099766854444) }, + { FRAC_CONST(0.036549710727369), FRAC_CONST(0.027339568011930) }, + { FRAC_CONST(0.036369992116697), FRAC_CONST(0.027578198033315) }, + { FRAC_CONST(0.036188715536611), FRAC_CONST(0.027815646696484) }, + { FRAC_CONST(0.036005888752396), FRAC_CONST(0.028051903829926) }, + { FRAC_CONST(0.035821519595745), FRAC_CONST(0.028286959313171) }, + { FRAC_CONST(0.035635615964417), FRAC_CONST(0.028520803077226) }, + { FRAC_CONST(0.035448185821906), FRAC_CONST(0.028753425105002) }, + { FRAC_CONST(0.035259237197095), FRAC_CONST(0.028984815431745) }, + { FRAC_CONST(0.035068778183914), FRAC_CONST(0.029214964145465) }, + { FRAC_CONST(0.034876816940994), FRAC_CONST(0.029443861387355) }, + { FRAC_CONST(0.034683361691315), FRAC_CONST(0.029671497352220) }, + { FRAC_CONST(0.034488420721856), FRAC_CONST(0.029897862288892) }, + { FRAC_CONST(0.034292002383240), FRAC_CONST(0.030122946500652) }, + { FRAC_CONST(0.034094115089375), FRAC_CONST(0.030346740345641) }, + { FRAC_CONST(0.033894767317093), FRAC_CONST(0.030569234237276) }, + { FRAC_CONST(0.033693967605790), FRAC_CONST(0.030790418644658) }, + { FRAC_CONST(0.033491724557057), FRAC_CONST(0.031010284092984) }, + { FRAC_CONST(0.033288046834313), FRAC_CONST(0.031228821163949) }, + { FRAC_CONST(0.033082943162434), FRAC_CONST(0.031446020496153) }, + { FRAC_CONST(0.032876422327378), FRAC_CONST(0.031661872785500) }, + { FRAC_CONST(0.032668493175811), FRAC_CONST(0.031876368785596) }, + { FRAC_CONST(0.032459164614726), FRAC_CONST(0.032089499308145) }, + { FRAC_CONST(0.032248445611061), FRAC_CONST(0.032301255223347) }, + { FRAC_CONST(0.032036345191317), FRAC_CONST(0.032511627460281) }, + { FRAC_CONST(0.031822872441171), FRAC_CONST(0.032720607007302) }, + { FRAC_CONST(0.031608036505083), FRAC_CONST(0.032928184912422) }, + { FRAC_CONST(0.031391846585912), FRAC_CONST(0.033134352283693) }, + { FRAC_CONST(0.031174311944513), FRAC_CONST(0.033339100289593) }, + { FRAC_CONST(0.030955441899347), FRAC_CONST(0.033542420159397) }, + { FRAC_CONST(0.030735245826077), FRAC_CONST(0.033744303183559) }, + { FRAC_CONST(0.030513733157171), FRAC_CONST(0.033944740714083) }, + { FRAC_CONST(0.030290913381494), FRAC_CONST(0.034143724164891) }, + { FRAC_CONST(0.030066796043904), FRAC_CONST(0.034341245012195) }, + { FRAC_CONST(0.029841390744841), FRAC_CONST(0.034537294794860) }, + { FRAC_CONST(0.029614707139919), FRAC_CONST(0.034731865114764) }, + { FRAC_CONST(0.029386754939508), FRAC_CONST(0.034924947637164) }, + { FRAC_CONST(0.029157543908322), FRAC_CONST(0.035116534091046) }, + { FRAC_CONST(0.028927083864999), FRAC_CONST(0.035306616269485) }, + { FRAC_CONST(0.028695384681680), FRAC_CONST(0.035495186029992) }, + { FRAC_CONST(0.028462456283587), FRAC_CONST(0.035682235294866) }, + { FRAC_CONST(0.028228308648598), FRAC_CONST(0.035867756051541) }, + { FRAC_CONST(0.027992951806817), FRAC_CONST(0.036051740352923) }, + { FRAC_CONST(0.027756395840148), FRAC_CONST(0.036234180317738) }, + { FRAC_CONST(0.027518650881862), FRAC_CONST(0.036415068130865) }, + { FRAC_CONST(0.027279727116161), FRAC_CONST(0.036594396043672) }, + { FRAC_CONST(0.027039634777745), FRAC_CONST(0.036772156374348) }, + { FRAC_CONST(0.026798384151369), FRAC_CONST(0.036948341508233) }, + { FRAC_CONST(0.026555985571409), FRAC_CONST(0.037122943898140) }, + { FRAC_CONST(0.026312449421412), FRAC_CONST(0.037295956064686) }, + { FRAC_CONST(0.026067786133656), FRAC_CONST(0.037467370596605) }, + { FRAC_CONST(0.025822006188702), FRAC_CONST(0.037637180151068) }, + { FRAC_CONST(0.025575120114946), FRAC_CONST(0.037805377454000) }, + { FRAC_CONST(0.025327138488165), FRAC_CONST(0.037971955300388) }, + { FRAC_CONST(0.025078071931066), FRAC_CONST(0.038136906554591) }, + { FRAC_CONST(0.024827931112832), FRAC_CONST(0.038300224150647) }, + { FRAC_CONST(0.024576726748663), FRAC_CONST(0.038461901092573) }, + { FRAC_CONST(0.024324469599317), FRAC_CONST(0.038621930454668) }, + { FRAC_CONST(0.024071170470652), FRAC_CONST(0.038780305381806) }, + { FRAC_CONST(0.023816840213160), FRAC_CONST(0.038937019089732) }, + { FRAC_CONST(0.023561489721501), FRAC_CONST(0.039092064865353) }, + { FRAC_CONST(0.023305129934041), FRAC_CONST(0.039245436067023) }, + { FRAC_CONST(0.023047771832380), FRAC_CONST(0.039397126124832) }, + { FRAC_CONST(0.022789426440883), FRAC_CONST(0.039547128540881) }, + { FRAC_CONST(0.022530104826206), FRAC_CONST(0.039695436889566) }, + { FRAC_CONST(0.022269818096825), FRAC_CONST(0.039842044817851) }, + { FRAC_CONST(0.022008577402555), FRAC_CONST(0.039986946045542) }, + { FRAC_CONST(0.021746393934081), FRAC_CONST(0.040130134365550) }, + { FRAC_CONST(0.021483278922467), FRAC_CONST(0.040271603644166) }, + { FRAC_CONST(0.021219243638687), FRAC_CONST(0.040411347821316) }, + { FRAC_CONST(0.020954299393132), FRAC_CONST(0.040549360910825) }, + { FRAC_CONST(0.020688457535133), FRAC_CONST(0.040685637000671) }, + { FRAC_CONST(0.020421729452469), FRAC_CONST(0.040820170253240) }, + { FRAC_CONST(0.020154126570884), FRAC_CONST(0.040952954905576) }, + { FRAC_CONST(0.019885660353596), FRAC_CONST(0.041083985269625) }, + { FRAC_CONST(0.019616342300802), FRAC_CONST(0.041213255732484) }, + { FRAC_CONST(0.019346183949192), FRAC_CONST(0.041340760756635) }, + { FRAC_CONST(0.019075196871451), FRAC_CONST(0.041466494880189) }, + { FRAC_CONST(0.018803392675763), FRAC_CONST(0.041590452717113) }, + { FRAC_CONST(0.018530783005316), FRAC_CONST(0.041712628957466) }, + { FRAC_CONST(0.018257379537800), FRAC_CONST(0.041833018367625) }, + { FRAC_CONST(0.017983193984910), FRAC_CONST(0.041951615790509) }, + { FRAC_CONST(0.017708238091842), FRAC_CONST(0.042068416145797) }, + { FRAC_CONST(0.017432523636792), FRAC_CONST(0.042183414430153) }, + { FRAC_CONST(0.017156062430449), FRAC_CONST(0.042296605717432) }, + { FRAC_CONST(0.016878866315491), FRAC_CONST(0.042407985158896) }, + { FRAC_CONST(0.016600947166078), FRAC_CONST(0.042517547983420) }, + { FRAC_CONST(0.016322316887341), FRAC_CONST(0.042625289497698) }, + { FRAC_CONST(0.016042987414872), FRAC_CONST(0.042731205086442) }, + { FRAC_CONST(0.015762970714219), FRAC_CONST(0.042835290212581) }, + { FRAC_CONST(0.015482278780363), FRAC_CONST(0.042937540417454) }, + { FRAC_CONST(0.015200923637213), FRAC_CONST(0.043037951321002) }, + { FRAC_CONST(0.014918917337087), FRAC_CONST(0.043136518621958) }, + { FRAC_CONST(0.014636271960196), FRAC_CONST(0.043233238098025) }, + { FRAC_CONST(0.014352999614128), FRAC_CONST(0.043328105606063) }, + { FRAC_CONST(0.014069112433327), FRAC_CONST(0.043421117082265) }, + { FRAC_CONST(0.013784622578575), FRAC_CONST(0.043512268542327) }, + { FRAC_CONST(0.013499542236471), FRAC_CONST(0.043601556081625) }, + { FRAC_CONST(0.013213883618907), FRAC_CONST(0.043688975875378) }, + { FRAC_CONST(0.012927658962548), FRAC_CONST(0.043774524178812) }, + { FRAC_CONST(0.012640880528305), FRAC_CONST(0.043858197327323) }, + { FRAC_CONST(0.012353560600813), FRAC_CONST(0.043939991736633) }, + { FRAC_CONST(0.012065711487901), FRAC_CONST(0.044019903902940) }, + { FRAC_CONST(0.011777345520066), FRAC_CONST(0.044097930403073) }, + { FRAC_CONST(0.011488475049948), FRAC_CONST(0.044174067894638) }, + { FRAC_CONST(0.011199112451794), FRAC_CONST(0.044248313116156) }, + { FRAC_CONST(0.010909270120937), FRAC_CONST(0.044320662887211) }, + { FRAC_CONST(0.010618960473257), FRAC_CONST(0.044391114108577) }, + { FRAC_CONST(0.010328195944653), FRAC_CONST(0.044459663762361) }, + { FRAC_CONST(0.010036988990509), FRAC_CONST(0.044526308912122) }, + { FRAC_CONST(0.009745352085163), FRAC_CONST(0.044591046703005) }, + { FRAC_CONST(0.009453297721368), FRAC_CONST(0.044653874361857) }, + { FRAC_CONST(0.009160838409762), FRAC_CONST(0.044714789197351) }, + { FRAC_CONST(0.008867986678328), FRAC_CONST(0.044773788600099) }, + { FRAC_CONST(0.008574755071860), FRAC_CONST(0.044830870042761) }, + { FRAC_CONST(0.008281156151424), FRAC_CONST(0.044886031080160) }, + { FRAC_CONST(0.007987202493820), FRAC_CONST(0.044939269349379) }, + { FRAC_CONST(0.007692906691044), FRAC_CONST(0.044990582569869) }, + { FRAC_CONST(0.007398281349750), FRAC_CONST(0.045039968543542) }, + { FRAC_CONST(0.007103339090706), FRAC_CONST(0.045087425154868) }, + { FRAC_CONST(0.006808092548258), FRAC_CONST(0.045132950370962) }, + { FRAC_CONST(0.006512554369783), FRAC_CONST(0.045176542241676) }, + { FRAC_CONST(0.006216737215155), FRAC_CONST(0.045218198899680) }, + { FRAC_CONST(0.005920653756196), FRAC_CONST(0.045257918560541) }, + { FRAC_CONST(0.005624316676135), FRAC_CONST(0.045295699522801) }, + { FRAC_CONST(0.005327738669067), FRAC_CONST(0.045331540168049) }, + { FRAC_CONST(0.005030932439406), FRAC_CONST(0.045365438960992) }, + { FRAC_CONST(0.004733910701344), FRAC_CONST(0.045397394449517) }, + { FRAC_CONST(0.004436686178303), FRAC_CONST(0.045427405264758) }, + { FRAC_CONST(0.004139271602393), FRAC_CONST(0.045455470121152) }, + { FRAC_CONST(0.003841679713863), FRAC_CONST(0.045481587816494) }, + { FRAC_CONST(0.003543923260561), FRAC_CONST(0.045505757231988) }, + { FRAC_CONST(0.003246014997382), FRAC_CONST(0.045527977332297) }, + { FRAC_CONST(0.002947967685724), FRAC_CONST(0.045548247165585) }, + { FRAC_CONST(0.002649794092941), FRAC_CONST(0.045566565863562) }, + { FRAC_CONST(0.002351506991799), FRAC_CONST(0.045582932641515) }, + { FRAC_CONST(0.002053119159924), FRAC_CONST(0.045597346798344) }, + { FRAC_CONST(0.001754643379257), FRAC_CONST(0.045609807716597) }, + { FRAC_CONST(0.001456092435508), FRAC_CONST(0.045620314862489) }, + { FRAC_CONST(0.001157479117605), FRAC_CONST(0.045628867785927) }, + { FRAC_CONST(0.000858816217149), FRAC_CONST(0.045635466120535) }, + { FRAC_CONST(0.000560116527865), FRAC_CONST(0.045640109583661) }, + { FRAC_CONST(0.000261392845053), FRAC_CONST(0.045642797976394) } +}; +#endif // LD_DEC + +/* 60 (N/4) complex twiddle factors */ +ALIGN static const complex_t mdct_tab_240[] = +{ + { FRAC_CONST(0.091286604111815), FRAC_CONST(0.000298735779793) }, + { FRAC_CONST(0.091247502481454), FRAC_CONST(0.002688238127538) }, + { FRAC_CONST(0.091145864370807), FRAC_CONST(0.005075898091152) }, + { FRAC_CONST(0.090981759437558), FRAC_CONST(0.007460079287760) }, + { FRAC_CONST(0.090755300151030), FRAC_CONST(0.009839147718664) }, + { FRAC_CONST(0.090466641715108), FRAC_CONST(0.012211472889198) }, + { FRAC_CONST(0.090115981961863), FRAC_CONST(0.014575428926191) }, + { FRAC_CONST(0.089703561215976), FRAC_CONST(0.016929395692256) }, + { FRAC_CONST(0.089229662130024), FRAC_CONST(0.019271759896156) }, + { FRAC_CONST(0.088694609490769), FRAC_CONST(0.021600916198470) }, + { FRAC_CONST(0.088098769996564), FRAC_CONST(0.023915268311810) }, + { FRAC_CONST(0.087442552006035), FRAC_CONST(0.026213230094844) }, + { FRAC_CONST(0.086726405258214), FRAC_CONST(0.028493226639351) }, + { FRAC_CONST(0.085950820564309), FRAC_CONST(0.030753695349588) }, + { FRAC_CONST(0.085116329471329), FRAC_CONST(0.032993087013213) }, + { FRAC_CONST(0.084223503897785), FRAC_CONST(0.035209866863042) }, + { FRAC_CONST(0.083272955741727), FRAC_CONST(0.037402515628894) }, + { FRAC_CONST(0.082265336461381), FRAC_CONST(0.039569530578832) }, + { FRAC_CONST(0.081201336628670), FRAC_CONST(0.041709426549053) }, + { FRAC_CONST(0.080081685455930), FRAC_CONST(0.043820736961749) }, + { FRAC_CONST(0.078907150296148), FRAC_CONST(0.045902014830227) }, + { FRAC_CONST(0.077678536117054), FRAC_CONST(0.047951833750597) }, + { FRAC_CONST(0.076396684949434), FRAC_CONST(0.049968788879362) }, + { FRAC_CONST(0.075062475310050), FRAC_CONST(0.051951497896226) }, + { FRAC_CONST(0.073676821599542), FRAC_CONST(0.053898601951466) }, + { FRAC_CONST(0.072240673475749), FRAC_CONST(0.055808766597225) }, + { FRAC_CONST(0.070755015202858), FRAC_CONST(0.057680682702068) }, + { FRAC_CONST(0.069220864976840), FRAC_CONST(0.059513067348201) }, + { FRAC_CONST(0.067639274227625), FRAC_CONST(0.061304664710718) }, + { FRAC_CONST(0.066011326898512), FRAC_CONST(0.063054246918278) }, + { FRAC_CONST(0.064338138703282), FRAC_CONST(0.064760614894630) }, + { FRAC_CONST(0.062620856361546), FRAC_CONST(0.066422599180399) }, + { FRAC_CONST(0.060860656812842), FRAC_CONST(0.068039060734572) }, + { FRAC_CONST(0.059058746410016), FRAC_CONST(0.069608891715145) }, + { FRAC_CONST(0.057216360092450), FRAC_CONST(0.071131016238378) }, + { FRAC_CONST(0.055334760539699), FRAC_CONST(0.072604391116154) }, + { FRAC_CONST(0.053415237306106), FRAC_CONST(0.074028006570930) }, + { FRAC_CONST(0.051459105937014), FRAC_CONST(0.075400886927784) }, + { FRAC_CONST(0.049467707067153), FRAC_CONST(0.076722091283096) }, + { FRAC_CONST(0.047442405501835), FRAC_CONST(0.077990714149396) }, + { FRAC_CONST(0.045384589281588), FRAC_CONST(0.079205886075941) }, + { FRAC_CONST(0.043295668730857), FRAC_CONST(0.080366774244592) }, + { FRAC_CONST(0.041177075491445), FRAC_CONST(0.081472583040586) }, + { FRAC_CONST(0.039030261541332), FRAC_CONST(0.082522554597810) }, + { FRAC_CONST(0.036856698199564), FRAC_CONST(0.083515969318206) }, + { FRAC_CONST(0.034657875117883), FRAC_CONST(0.084452146364948) }, + { FRAC_CONST(0.032435299259796), FRAC_CONST(0.085330444129049) }, + { FRAC_CONST(0.030190493867775), FRAC_CONST(0.086150260669096) }, + { FRAC_CONST(0.027924997419306), FRAC_CONST(0.086911034123781) }, + { FRAC_CONST(0.025640362572491), FRAC_CONST(0.087612243096981) }, + { FRAC_CONST(0.023338155101933), FRAC_CONST(0.088253407015092) }, + { FRAC_CONST(0.021019952825636), FRAC_CONST(0.088834086456390) }, + { FRAC_CONST(0.018687344523641), FRAC_CONST(0.089353883452193) }, + { FRAC_CONST(0.016341928849164), FRAC_CONST(0.089812441759604) }, + { FRAC_CONST(0.013985313232951), FRAC_CONST(0.090209447105664) }, + { FRAC_CONST(0.011619112781631), FRAC_CONST(0.090544627402740) }, + { FRAC_CONST(0.009244949170797), FRAC_CONST(0.090817752935000) }, + { FRAC_CONST(0.006864449533597), FRAC_CONST(0.091028636515846) }, + { FRAC_CONST(0.004479245345574), FRAC_CONST(0.091177133616206) }, + { FRAC_CONST(0.002090971306534), FRAC_CONST(0.091263142463585) } +}; +#endif // ALLOW_SMALL_FRAMELENGTH + +#ifdef SSR_DEC +/* 128 (N/4) complex twiddle factors */ +ALIGN static const complex_t mdct_tab_512[] = +{ + { FRAC_CONST(0.062499926465731), FRAC_CONST(0.000095873761643) }, + { FRAC_CONST(0.062494043817678), FRAC_CONST(0.000862836783004) }, + { FRAC_CONST(0.062478749796497), FRAC_CONST(0.001629669864319) }, + { FRAC_CONST(0.062454046705412), FRAC_CONST(0.002396257523347) }, + { FRAC_CONST(0.062419938264617), FRAC_CONST(0.003162484314806) }, + { FRAC_CONST(0.062376429610718), FRAC_CONST(0.003928234847760) }, + { FRAC_CONST(0.062323527295958), FRAC_CONST(0.004693393802995) }, + { FRAC_CONST(0.062261239287231), FRAC_CONST(0.005457845950387) }, + { FRAC_CONST(0.062189574964882), FRAC_CONST(0.006221476166254) }, + { FRAC_CONST(0.062108545121295), FRAC_CONST(0.006984169450695) }, + { FRAC_CONST(0.062018161959266), FRAC_CONST(0.007745810944907) }, + { FRAC_CONST(0.061918439090167), FRAC_CONST(0.008506285948482) }, + { FRAC_CONST(0.061809391531894), FRAC_CONST(0.009265479936681) }, + { FRAC_CONST(0.061691035706609), FRAC_CONST(0.010023278577683) }, + { FRAC_CONST(0.061563389438265), FRAC_CONST(0.010779567749800) }, + { FRAC_CONST(0.061426471949919), FRAC_CONST(0.011534233558664) }, + { FRAC_CONST(0.061280303860842), FRAC_CONST(0.012287162354380) }, + { FRAC_CONST(0.061124907183410), FRAC_CONST(0.013038240748641) }, + { FRAC_CONST(0.060960305319791), FRAC_CONST(0.013787355631805) }, + { FRAC_CONST(0.060786523058421), FRAC_CONST(0.014534394189923) }, + { FRAC_CONST(0.060603586570268), FRAC_CONST(0.015279243921739) }, + { FRAC_CONST(0.060411523404896), FRAC_CONST(0.016021792655621) }, + { FRAC_CONST(0.060210362486310), FRAC_CONST(0.016761928566463) }, + { FRAC_CONST(0.060000134108604), FRAC_CONST(0.017499540192517) }, + { FRAC_CONST(0.059780869931400), FRAC_CONST(0.018234516452187) }, + { FRAC_CONST(0.059552602975075), FRAC_CONST(0.018966746660751) }, + { FRAC_CONST(0.059315367615794), FRAC_CONST(0.019696120547033) }, + { FRAC_CONST(0.059069199580329), FRAC_CONST(0.020422528270008) }, + { FRAC_CONST(0.058814135940681), FRAC_CONST(0.021145860435346) }, + { FRAC_CONST(0.058550215108495), FRAC_CONST(0.021866008111883) }, + { FRAC_CONST(0.058277476829279), FRAC_CONST(0.022582862848028) }, + { FRAC_CONST(0.057995962176414), FRAC_CONST(0.023296316688095) }, + { FRAC_CONST(0.057705713544970), FRAC_CONST(0.024006262188558) }, + { FRAC_CONST(0.057406774645326), FRAC_CONST(0.024712592434239) }, + { FRAC_CONST(0.057099190496578), FRAC_CONST(0.025415201054398) }, + { FRAC_CONST(0.056783007419769), FRAC_CONST(0.026113982238763) }, + { FRAC_CONST(0.056458273030907), FRAC_CONST(0.026808830753458) }, + { FRAC_CONST(0.056125036233796), FRAC_CONST(0.027499641956852) }, + { FRAC_CONST(0.055783347212673), FRAC_CONST(0.028186311815319) }, + { FRAC_CONST(0.055433257424646), FRAC_CONST(0.028868736918904) }, + { FRAC_CONST(0.055074819591951), FRAC_CONST(0.029546814496896) }, + { FRAC_CONST(0.054708087694007), FRAC_CONST(0.030220442433307) }, + { FRAC_CONST(0.054333116959288), FRAC_CONST(0.030889519282247) }, + { FRAC_CONST(0.053949963857008), FRAC_CONST(0.031553944283204) }, + { FRAC_CONST(0.053558686088614), FRAC_CONST(0.032213617376216) }, + { FRAC_CONST(0.053159342579100), FRAC_CONST(0.032868439216943) }, + { FRAC_CONST(0.052751993468129), FRAC_CONST(0.033518311191623) }, + { FRAC_CONST(0.052336700100979), FRAC_CONST(0.034163135431927) }, + { FRAC_CONST(0.051913525019303), FRAC_CONST(0.034802814829698) }, + { FRAC_CONST(0.051482531951712), FRAC_CONST(0.035437253051569) }, + { FRAC_CONST(0.051043785804177), FRAC_CONST(0.036066354553480) }, + { FRAC_CONST(0.050597352650253), FRAC_CONST(0.036690024595057) }, + { FRAC_CONST(0.050143299721132), FRAC_CONST(0.037308169253887) }, + { FRAC_CONST(0.049681695395515), FRAC_CONST(0.037920695439658) }, + { FRAC_CONST(0.049212609189314), FRAC_CONST(0.038527510908178) }, + { FRAC_CONST(0.048736111745188), FRAC_CONST(0.039128524275271) }, + { FRAC_CONST(0.048252274821899), FRAC_CONST(0.039723645030535) }, + { FRAC_CONST(0.047761171283507), FRAC_CONST(0.040312783550971) }, + { FRAC_CONST(0.047262875088400), FRAC_CONST(0.040895851114488) }, + { FRAC_CONST(0.046757461278150), FRAC_CONST(0.041472759913252) }, + { FRAC_CONST(0.046245005966220), FRAC_CONST(0.042043423066923) }, + { FRAC_CONST(0.045725586326493), FRAC_CONST(0.042607754635728) }, + { FRAC_CONST(0.045199280581658), FRAC_CONST(0.043165669633408) }, + { FRAC_CONST(0.044666167991423), FRAC_CONST(0.043717084040018) }, + { FRAC_CONST(0.044126328840584), FRAC_CONST(0.044261914814575) }, + { FRAC_CONST(0.043579844426930), FRAC_CONST(0.044800079907569) }, + { FRAC_CONST(0.043026797049006), FRAC_CONST(0.045331498273316) }, + { FRAC_CONST(0.042467269993710), FRAC_CONST(0.045856089882166) }, + { FRAC_CONST(0.041901347523761), FRAC_CONST(0.046373775732552) }, + { FRAC_CONST(0.041329114865000), FRAC_CONST(0.046884477862888) }, + { FRAC_CONST(0.040750658193560), FRAC_CONST(0.047388119363313) }, + { FRAC_CONST(0.040166064622889), FRAC_CONST(0.047884624387270) }, + { FRAC_CONST(0.039575422190629), FRAC_CONST(0.048373918162926) }, + { FRAC_CONST(0.038978819845356), FRAC_CONST(0.048855927004441) }, + { FRAC_CONST(0.038376347433190), FRAC_CONST(0.049330578323055) }, + { FRAC_CONST(0.037768095684260), FRAC_CONST(0.049797800638026) }, + { FRAC_CONST(0.037154156199042), FRAC_CONST(0.050257523587392) }, + { FRAC_CONST(0.036534621434563), FRAC_CONST(0.050709677938566) }, + { FRAC_CONST(0.035909584690482), FRAC_CONST(0.051154195598769) }, + { FRAC_CONST(0.035279140095032), FRAC_CONST(0.051591009625274) }, + { FRAC_CONST(0.034643382590851), FRAC_CONST(0.052020054235496) }, + { FRAC_CONST(0.034002407920680), FRAC_CONST(0.052441264816895) }, + { FRAC_CONST(0.033356312612947), FRAC_CONST(0.052854577936706) }, + { FRAC_CONST(0.032705193967229), FRAC_CONST(0.053259931351495) }, + { FRAC_CONST(0.032049150039598), FRAC_CONST(0.053657264016528) }, + { FRAC_CONST(0.031388279627857), FRAC_CONST(0.054046516094966) }, + { FRAC_CONST(0.030722682256659), FRAC_CONST(0.054427628966880) }, + { FRAC_CONST(0.030052458162521), FRAC_CONST(0.054800545238072) }, + { FRAC_CONST(0.029377708278725), FRAC_CONST(0.055165208748723) }, + { FRAC_CONST(0.028698534220122), FRAC_CONST(0.055521564581850) }, + { FRAC_CONST(0.028015038267826), FRAC_CONST(0.055869559071575) }, + { FRAC_CONST(0.027327323353815), FRAC_CONST(0.056209139811209) }, + { FRAC_CONST(0.026635493045425), FRAC_CONST(0.056540255661140) }, + { FRAC_CONST(0.025939651529755), FRAC_CONST(0.056862856756541) }, + { FRAC_CONST(0.025239903597978), FRAC_CONST(0.057176894514872) }, + { FRAC_CONST(0.024536354629559), FRAC_CONST(0.057482321643202) }, + { FRAC_CONST(0.023829110576385), FRAC_CONST(0.057779092145329) }, + { FRAC_CONST(0.023118277946808), FRAC_CONST(0.058067161328707) }, + { FRAC_CONST(0.022403963789609), FRAC_CONST(0.058346485811177) }, + { FRAC_CONST(0.021686275677870), FRAC_CONST(0.058617023527499) }, + { FRAC_CONST(0.020965321692783), FRAC_CONST(0.058878733735689) }, + { FRAC_CONST(0.020241210407366), FRAC_CONST(0.059131577023150) }, + { FRAC_CONST(0.019514050870114), FRAC_CONST(0.059375515312615) }, + { FRAC_CONST(0.018783952588580), FRAC_CONST(0.059610511867874) }, + { FRAC_CONST(0.018051025512878), FRAC_CONST(0.059836531299311) }, + { FRAC_CONST(0.017315380019131), FRAC_CONST(0.060053539569230) }, + { FRAC_CONST(0.016577126892844), FRAC_CONST(0.060261503996984) }, + { FRAC_CONST(0.015836377312223), FRAC_CONST(0.060460393263896) }, + { FRAC_CONST(0.015093242831429), FRAC_CONST(0.060650177417972) }, + { FRAC_CONST(0.014347835363782), FRAC_CONST(0.060830827878419) }, + { FRAC_CONST(0.013600267164905), FRAC_CONST(0.061002317439940) }, + { FRAC_CONST(0.012850650815819), FRAC_CONST(0.061164620276839) }, + { FRAC_CONST(0.012099099205988), FRAC_CONST(0.061317711946905) }, + { FRAC_CONST(0.011345725516320), FRAC_CONST(0.061461569395097) }, + { FRAC_CONST(0.010590643202123), FRAC_CONST(0.061596170957011) }, + { FRAC_CONST(0.009833965976015), FRAC_CONST(0.061721496362147) }, + { FRAC_CONST(0.009075807790803), FRAC_CONST(0.061837526736961) }, + { FRAC_CONST(0.008316282822321), FRAC_CONST(0.061944244607705) }, + { FRAC_CONST(0.007555505452236), FRAC_CONST(0.062041633903059) }, + { FRAC_CONST(0.006793590250821), FRAC_CONST(0.062129679956555) }, + { FRAC_CONST(0.006030651959703), FRAC_CONST(0.062208369508780) }, + { FRAC_CONST(0.005266805474583), FRAC_CONST(0.062277690709378) }, + { FRAC_CONST(0.004502165827931), FRAC_CONST(0.062337633118830) }, + { FRAC_CONST(0.003736848171665), FRAC_CONST(0.062388187710030) }, + { FRAC_CONST(0.002970967759810), FRAC_CONST(0.062429346869643) }, + { FRAC_CONST(0.002204639931138), FRAC_CONST(0.062461104399250) }, + { FRAC_CONST(0.001437980091802), FRAC_CONST(0.062483455516285) }, + { FRAC_CONST(0.000671103697954), FRAC_CONST(0.062496396854751) } +}; + +/* 16 (N/4) complex twiddle factors */ +ALIGN static const complex_t mdct_tab_64[] = +{ + { FRAC_CONST(0.176763384336599), FRAC_CONST(0.002169321984356) }, + { FRAC_CONST(0.175699589589310), FRAC_CONST(0.019484717553714) }, + { FRAC_CONST(0.172943711747111), FRAC_CONST(0.036612464641599) }, + { FRAC_CONST(0.168522291420137), FRAC_CONST(0.053387613680577) }, + { FRAC_CONST(0.162477909303132), FRAC_CONST(0.069648610815172) }, + { FRAC_CONST(0.154868776100077), FRAC_CONST(0.085238853753814) }, + { FRAC_CONST(0.145768171923295), FRAC_CONST(0.100008199934509) }, + { FRAC_CONST(0.135263740565902), FRAC_CONST(0.113814412479792) }, + { FRAC_CONST(0.123456645444178), FRAC_CONST(0.126524530015608) }, + { FRAC_CONST(0.110460595338559), FRAC_CONST(0.138016147162030) }, + { FRAC_CONST(0.096400749315926), FRAC_CONST(0.148178593363981) }, + { FRAC_CONST(0.081412511379371), FRAC_CONST(0.156913998709178) }, + { FRAC_CONST(0.065640226453626), FRAC_CONST(0.164138236468888) }, + { FRAC_CONST(0.049235790264535), FRAC_CONST(0.169781733284316) }, + { FRAC_CONST(0.032357186500177), FRAC_CONST(0.173790139196080) }, + { FRAC_CONST(0.015166965341583), FRAC_CONST(0.176124851064031) } +}; +#endif // SSR_DEC + +#endif // FIXED_POINT + +#ifdef __cplusplus +} +#endif +#endif diff --git a/Libraries/FAAD2/Files/libfaad/mp4.c b/Libraries/FAAD2/Files/libfaad/mp4.c new file mode 100644 index 000000000..fb0999fb0 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/mp4.c @@ -0,0 +1,299 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#include "common.h" +#include "structs.h" + +#include + +#include "bits.h" +#include "mp4.h" +#include "syntax.h" + +/* defines if an object type can be decoded by this library or not */ +static uint8_t ObjectTypesTable[32] = { + 0, /* 0 NULL */ +#ifdef MAIN_DEC + 1, /* 1 AAC Main */ +#else + 0, /* 1 AAC Main */ +#endif + 1, /* 2 AAC LC */ +#ifdef SSR_DEC + 1, /* 3 AAC SSR */ +#else + 0, /* 3 AAC SSR */ +#endif +#ifdef LTP_DEC + 1, /* 4 AAC LTP */ +#else + 0, /* 4 AAC LTP */ +#endif +#ifdef SBR_DEC + 1, /* 5 SBR */ +#else + 0, /* 5 SBR */ +#endif +#ifdef SCALABLE_DEC + 1, /* 6 AAC Scalable */ +#else + 0, /* 6 AAC Scalable */ +#endif + 0, /* 7 TwinVQ */ + 0, /* 8 CELP */ + 0, /* 9 HVXC */ + 0, /* 10 Reserved */ + 0, /* 11 Reserved */ + 0, /* 12 TTSI */ + 0, /* 13 Main synthetic */ + 0, /* 14 Wavetable synthesis */ + 0, /* 15 General MIDI */ + 0, /* 16 Algorithmic Synthesis and Audio FX */ + + /* MPEG-4 Version 2 */ +#ifdef ERROR_RESILIENCE + 1, /* 17 ER AAC LC */ + 0, /* 18 (Reserved) */ +#ifdef LTP_DEC + 1, /* 19 ER AAC LTP */ +#else + 0, /* 19 ER AAC LTP */ +#endif +#ifdef SCALABLE_DEC + 1, /* 20 ER AAC scalable */ +#else + 0, /* 20 ER AAC scalable */ +#endif + 0, /* 21 ER TwinVQ */ + 0, /* 22 ER BSAC */ +#ifdef LD_DEC + 1, /* 23 ER AAC LD */ +#else + 0, /* 23 ER AAC LD */ +#endif + 0, /* 24 ER CELP */ + 0, /* 25 ER HVXC */ + 0, /* 26 ER HILN */ + 0, /* 27 ER Parametric */ +#else /* No ER defined */ + 0, /* 17 ER AAC LC */ + 0, /* 18 (Reserved) */ + 0, /* 19 ER AAC LTP */ + 0, /* 20 ER AAC scalable */ + 0, /* 21 ER TwinVQ */ + 0, /* 22 ER BSAC */ + 0, /* 23 ER AAC LD */ + 0, /* 24 ER CELP */ + 0, /* 25 ER HVXC */ + 0, /* 26 ER HILN */ + 0, /* 27 ER Parametric */ +#endif + 0, /* 28 (Reserved) */ + 0, /* 29 (Reserved) */ + 0, /* 30 (Reserved) */ + 0 /* 31 (Reserved) */ +}; + +/* Table 1.6.1 */ +int8_t NEAACDECAPI NeAACDecAudioSpecificConfig(uint8_t *pBuffer, + uint32_t buffer_size, + mp4AudioSpecificConfig *mp4ASC) +{ + return AudioSpecificConfig2(pBuffer, buffer_size, mp4ASC, NULL); +} + +int8_t AudioSpecificConfig2(uint8_t *pBuffer, + uint32_t buffer_size, + mp4AudioSpecificConfig *mp4ASC, + program_config *pce) +{ + bitfile ld; + int8_t result = 0; +#ifdef SBR_DEC + int8_t bits_to_decode = 0; +#endif + + if (pBuffer == NULL) + return -7; + if (mp4ASC == NULL) + return -8; + + memset(mp4ASC, 0, sizeof(mp4AudioSpecificConfig)); + + faad_initbits(&ld, pBuffer, buffer_size); + faad_byte_align(&ld); + + mp4ASC->objectTypeIndex = (uint8_t)faad_getbits(&ld, 5 + DEBUGVAR(1,1,"parse_audio_decoder_specific_info(): ObjectTypeIndex")); + + mp4ASC->samplingFrequencyIndex = (uint8_t)faad_getbits(&ld, 4 + DEBUGVAR(1,2,"parse_audio_decoder_specific_info(): SamplingFrequencyIndex")); + + mp4ASC->channelsConfiguration = (uint8_t)faad_getbits(&ld, 4 + DEBUGVAR(1,3,"parse_audio_decoder_specific_info(): ChannelsConfiguration")); + + mp4ASC->samplingFrequency = get_sample_rate(mp4ASC->samplingFrequencyIndex); + + if (ObjectTypesTable[mp4ASC->objectTypeIndex] != 1) + { + faad_endbits(&ld); + return -1; + } + + if (mp4ASC->samplingFrequency == 0) + { + faad_endbits(&ld); + return -2; + } + + if (mp4ASC->channelsConfiguration > 7) + { + faad_endbits(&ld); + return -3; + } + +#if (defined(PS_DEC) || defined(DRM_PS)) + /* check if we have a mono file */ + if (mp4ASC->channelsConfiguration == 1) + { + /* upMatrix to 2 channels for implicit signalling of PS */ + mp4ASC->channelsConfiguration = 2; + } +#endif + +#ifdef SBR_DEC + mp4ASC->sbr_present_flag = -1; + if (mp4ASC->objectTypeIndex == 5) + { + uint8_t tmp; + + mp4ASC->sbr_present_flag = 1; + tmp = (uint8_t)faad_getbits(&ld, 4 + DEBUGVAR(1,5,"parse_audio_decoder_specific_info(): extensionSamplingFrequencyIndex")); + /* check for downsampled SBR */ + if (tmp == mp4ASC->samplingFrequencyIndex) + mp4ASC->downSampledSBR = 1; + mp4ASC->samplingFrequencyIndex = tmp; + if (mp4ASC->samplingFrequencyIndex == 15) + { + mp4ASC->samplingFrequency = (uint32_t)faad_getbits(&ld, 24 + DEBUGVAR(1,6,"parse_audio_decoder_specific_info(): extensionSamplingFrequencyIndex")); + } else { + mp4ASC->samplingFrequency = get_sample_rate(mp4ASC->samplingFrequencyIndex); + } + mp4ASC->objectTypeIndex = (uint8_t)faad_getbits(&ld, 5 + DEBUGVAR(1,7,"parse_audio_decoder_specific_info(): ObjectTypeIndex")); + } +#endif + + /* get GASpecificConfig */ + if (mp4ASC->objectTypeIndex == 1 || mp4ASC->objectTypeIndex == 2 || + mp4ASC->objectTypeIndex == 3 || mp4ASC->objectTypeIndex == 4 || + mp4ASC->objectTypeIndex == 6 || mp4ASC->objectTypeIndex == 7) + { + result = GASpecificConfig(&ld, mp4ASC, pce); + +#ifdef ERROR_RESILIENCE + } else if (mp4ASC->objectTypeIndex >= ER_OBJECT_START) { /* ER */ + result = GASpecificConfig(&ld, mp4ASC, pce); + mp4ASC->epConfig = (uint8_t)faad_getbits(&ld, 2 + DEBUGVAR(1,143,"parse_audio_decoder_specific_info(): epConfig")); + + if (mp4ASC->epConfig != 0) + result = -5; +#endif + + } else { + result = -4; + } + +#ifdef SSR_DEC + /* shorter frames not allowed for SSR */ + if ((mp4ASC->objectTypeIndex == 4) && mp4ASC->frameLengthFlag) + return -6; +#endif + + +#ifdef SBR_DEC + bits_to_decode = (int8_t)(buffer_size*8 - faad_get_processed_bits(&ld)); + + if ((mp4ASC->objectTypeIndex != 5) && (bits_to_decode >= 16)) + { + int16_t syncExtensionType = (int16_t)faad_getbits(&ld, 11 + DEBUGVAR(1,9,"parse_audio_decoder_specific_info(): syncExtensionType")); + + if (syncExtensionType == 0x2b7) + { + mp4ASC->objectTypeIndex = (uint8_t)faad_getbits(&ld, 5 + DEBUGVAR(1,10,"parse_audio_decoder_specific_info(): extensionAudioObjectType")); + + if (mp4ASC->objectTypeIndex == 5) + { + mp4ASC->sbr_present_flag = (uint8_t)faad_get1bit(&ld + DEBUGVAR(1,11,"parse_audio_decoder_specific_info(): sbr_present_flag")); + + if (mp4ASC->sbr_present_flag) + { + uint8_t tmp; + tmp = (uint8_t)faad_getbits(&ld, 4 + DEBUGVAR(1,12,"parse_audio_decoder_specific_info(): extensionSamplingFrequencyIndex")); + + /* check for downsampled SBR */ + if (tmp == mp4ASC->samplingFrequencyIndex) + mp4ASC->downSampledSBR = 1; + mp4ASC->samplingFrequencyIndex = tmp; + + if (mp4ASC->samplingFrequencyIndex == 15) + { + mp4ASC->samplingFrequency = (uint32_t)faad_getbits(&ld, 24 + DEBUGVAR(1,13,"parse_audio_decoder_specific_info(): extensionSamplingFrequencyIndex")); + } else { + mp4ASC->samplingFrequency = get_sample_rate(mp4ASC->samplingFrequencyIndex); + } + } + } + } + } + + /* no SBR signalled, this could mean either implicit signalling or no SBR in this file */ + /* MPEG specification states: assume SBR on files with samplerate <= 24000 Hz */ + if (mp4ASC->sbr_present_flag == -1) + { + if (mp4ASC->samplingFrequency <= 24000) + { + mp4ASC->samplingFrequency *= 2; + mp4ASC->forceUpSampling = 1; + } else /* > 24000*/ { + mp4ASC->downSampledSBR = 1; + } + } +#endif + + faad_endbits(&ld); + + return result; +} diff --git a/Libraries/FAAD2/Files/libfaad/mp4.h b/Libraries/FAAD2/Files/libfaad/mp4.h new file mode 100644 index 000000000..f647b6706 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/mp4.h @@ -0,0 +1,49 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#ifndef __MP4_H__ +#define __MP4_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "decoder.h" + +int8_t NEAACDECAPI NeAACDecAudioSpecificConfig(uint8_t *pBuffer, + uint32_t buffer_size, + mp4AudioSpecificConfig *mp4ASC); + +int8_t AudioSpecificConfig2(uint8_t *pBuffer, + uint32_t buffer_size, + mp4AudioSpecificConfig *mp4ASC, + program_config *pce); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/Libraries/FAAD2/Files/libfaad/ms.c b/Libraries/FAAD2/Files/libfaad/ms.c new file mode 100644 index 000000000..f01e5caa0 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/ms.c @@ -0,0 +1,74 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#include "common.h" +#include "structs.h" + +#include "syntax.h" +#include "ms.h" +#include "is.h" +#include "pns.h" + +void ms_decode(ic_stream *ics, ic_stream *icsr, real_t *l_spec, real_t *r_spec, + uint16_t frame_len) +{ + uint8_t g, b, sfb; + uint8_t group = 0; + uint16_t nshort = frame_len/8; + + uint16_t i, k; + real_t tmp; + + if (ics->ms_mask_present >= 1) + { + for (g = 0; g < ics->num_window_groups; g++) + { + for (b = 0; b < ics->window_group_length[g]; b++) + { + for (sfb = 0; sfb < ics->max_sfb; sfb++) + { + /* If intensity stereo coding or noise substitution is on + for a particular scalefactor band, no M/S stereo decoding + is carried out. + */ + if ((ics->ms_used[g][sfb] || ics->ms_mask_present == 2) && + !is_intensity(icsr, g, sfb) && !is_noise(ics, g, sfb)) + { + for (i = ics->swb_offset[sfb]; i < ics->swb_offset[sfb+1]; i++) + { + k = (group*nshort) + i; + tmp = l_spec[k] - r_spec[k]; + l_spec[k] = l_spec[k] + r_spec[k]; + r_spec[k] = tmp; + } + } + } + group++; + } + } + } +} diff --git a/Libraries/FAAD2/Files/libfaad/ms.h b/Libraries/FAAD2/Files/libfaad/ms.h new file mode 100644 index 000000000..384fa4294 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/ms.h @@ -0,0 +1,41 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#ifndef __MS_H__ +#define __MS_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +void ms_decode(ic_stream *ics, ic_stream *icsr, real_t *l_spec, real_t *r_spec, + uint16_t frame_len); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/Libraries/FAAD2/Files/libfaad/output.c b/Libraries/FAAD2/Files/libfaad/output.c new file mode 100644 index 000000000..6594582bb --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/output.c @@ -0,0 +1,557 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#include "common.h" +#include "structs.h" + +#include "output.h" +#include "decoder.h" + +#ifndef FIXED_POINT + + +#define FLOAT_SCALE (1.0f/(1<<15)) + +#define DM_MUL REAL_CONST(0.3203772410170407) // 1/(1+sqrt(2) + 1/sqrt(2)) +#define RSQRT2 REAL_CONST(0.7071067811865475244) // 1/sqrt(2) + + +static INLINE real_t get_sample(real_t **input, uint8_t channel, uint16_t sample, + uint8_t down_matrix, uint8_t *internal_channel) +{ + if (!down_matrix) + return input[internal_channel[channel]][sample]; + + if (channel == 0) + { + return DM_MUL * (input[internal_channel[1]][sample] + + input[internal_channel[0]][sample] * RSQRT2 + + input[internal_channel[3]][sample] * RSQRT2); + } else { + return DM_MUL * (input[internal_channel[2]][sample] + + input[internal_channel[0]][sample] * RSQRT2 + + input[internal_channel[4]][sample] * RSQRT2); + } +} + +#ifndef HAS_LRINTF +#define CLIP(sample, max, min) \ +if (sample >= 0.0f) \ +{ \ + sample += 0.5f; \ + if (sample >= max) \ + sample = max; \ +} else { \ + sample += -0.5f; \ + if (sample <= min) \ + sample = min; \ +} +#else +#define CLIP(sample, max, min) \ +if (sample >= 0.0f) \ +{ \ + if (sample >= max) \ + sample = max; \ +} else { \ + if (sample <= min) \ + sample = min; \ +} +#endif + +#define CONV(a,b) ((a<<1)|(b&0x1)) + +static void to_PCM_16bit(NeAACDecHandle hDecoder, real_t **input, + uint8_t channels, uint16_t frame_len, + int16_t **sample_buffer) +{ + uint8_t ch, ch1; + uint16_t i; + + switch (CONV(channels,hDecoder->downMatrix)) + { + case CONV(1,0): + case CONV(1,1): + for(i = 0; i < frame_len; i++) + { + real_t inp = input[hDecoder->internal_channel[0]][i]; + + CLIP(inp, 32767.0f, -32768.0f); + + (*sample_buffer)[i] = (int16_t)lrintf(inp); + } + break; + case CONV(2,0): + if (hDecoder->upMatrix) + { + ch = hDecoder->internal_channel[0]; + for(i = 0; i < frame_len; i++) + { + real_t inp0 = input[ch][i]; + + CLIP(inp0, 32767.0f, -32768.0f); + + (*sample_buffer)[(i*2)+0] = (int16_t)lrintf(inp0); + (*sample_buffer)[(i*2)+1] = (int16_t)lrintf(inp0); + } + } else { + ch = hDecoder->internal_channel[0]; + ch1 = hDecoder->internal_channel[1]; + for(i = 0; i < frame_len; i++) + { + real_t inp0 = input[ch ][i]; + real_t inp1 = input[ch1][i]; + + CLIP(inp0, 32767.0f, -32768.0f); + CLIP(inp1, 32767.0f, -32768.0f); + + (*sample_buffer)[(i*2)+0] = (int16_t)lrintf(inp0); + (*sample_buffer)[(i*2)+1] = (int16_t)lrintf(inp1); + } + } + break; + default: + for (ch = 0; ch < channels; ch++) + { + for(i = 0; i < frame_len; i++) + { + real_t inp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->internal_channel); + + CLIP(inp, 32767.0f, -32768.0f); + + (*sample_buffer)[(i*channels)+ch] = (int16_t)lrintf(inp); + } + } + break; + } +} + +static void to_PCM_24bit(NeAACDecHandle hDecoder, real_t **input, + uint8_t channels, uint16_t frame_len, + int32_t **sample_buffer) +{ + uint8_t ch, ch1; + uint16_t i; + + switch (CONV(channels,hDecoder->downMatrix)) + { + case CONV(1,0): + case CONV(1,1): + for(i = 0; i < frame_len; i++) + { + real_t inp = input[hDecoder->internal_channel[0]][i]; + + inp *= 256.0f; + CLIP(inp, 8388607.0f, -8388608.0f); + + (*sample_buffer)[i] = (int32_t)lrintf(inp); + } + break; + case CONV(2,0): + if (hDecoder->upMatrix) + { + ch = hDecoder->internal_channel[0]; + for(i = 0; i < frame_len; i++) + { + real_t inp0 = input[ch][i]; + + inp0 *= 256.0f; + CLIP(inp0, 8388607.0f, -8388608.0f); + + (*sample_buffer)[(i*2)+0] = (int32_t)lrintf(inp0); + (*sample_buffer)[(i*2)+1] = (int32_t)lrintf(inp0); + } + } else { + ch = hDecoder->internal_channel[0]; + ch1 = hDecoder->internal_channel[1]; + for(i = 0; i < frame_len; i++) + { + real_t inp0 = input[ch ][i]; + real_t inp1 = input[ch1][i]; + + inp0 *= 256.0f; + inp1 *= 256.0f; + CLIP(inp0, 8388607.0f, -8388608.0f); + CLIP(inp1, 8388607.0f, -8388608.0f); + + (*sample_buffer)[(i*2)+0] = (int32_t)lrintf(inp0); + (*sample_buffer)[(i*2)+1] = (int32_t)lrintf(inp1); + } + } + break; + default: + for (ch = 0; ch < channels; ch++) + { + for(i = 0; i < frame_len; i++) + { + real_t inp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->internal_channel); + + inp *= 256.0f; + CLIP(inp, 8388607.0f, -8388608.0f); + + (*sample_buffer)[(i*channels)+ch] = (int32_t)lrintf(inp); + } + } + break; + } +} + +static void to_PCM_32bit(NeAACDecHandle hDecoder, real_t **input, + uint8_t channels, uint16_t frame_len, + int32_t **sample_buffer) +{ + uint8_t ch, ch1; + uint16_t i; + + switch (CONV(channels,hDecoder->downMatrix)) + { + case CONV(1,0): + case CONV(1,1): + for(i = 0; i < frame_len; i++) + { + real_t inp = input[hDecoder->internal_channel[0]][i]; + + inp *= 65536.0f; + CLIP(inp, 2147483647.0f, -2147483648.0f); + + (*sample_buffer)[i] = (int32_t)lrintf(inp); + } + break; + case CONV(2,0): + if (hDecoder->upMatrix) + { + ch = hDecoder->internal_channel[0]; + for(i = 0; i < frame_len; i++) + { + real_t inp0 = input[ch][i]; + + inp0 *= 65536.0f; + CLIP(inp0, 2147483647.0f, -2147483648.0f); + + (*sample_buffer)[(i*2)+0] = (int32_t)lrintf(inp0); + (*sample_buffer)[(i*2)+1] = (int32_t)lrintf(inp0); + } + } else { + ch = hDecoder->internal_channel[0]; + ch1 = hDecoder->internal_channel[1]; + for(i = 0; i < frame_len; i++) + { + real_t inp0 = input[ch ][i]; + real_t inp1 = input[ch1][i]; + + inp0 *= 65536.0f; + inp1 *= 65536.0f; + CLIP(inp0, 2147483647.0f, -2147483648.0f); + CLIP(inp1, 2147483647.0f, -2147483648.0f); + + (*sample_buffer)[(i*2)+0] = (int32_t)lrintf(inp0); + (*sample_buffer)[(i*2)+1] = (int32_t)lrintf(inp1); + } + } + break; + default: + for (ch = 0; ch < channels; ch++) + { + for(i = 0; i < frame_len; i++) + { + real_t inp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->internal_channel); + + inp *= 65536.0f; + CLIP(inp, 2147483647.0f, -2147483648.0f); + + (*sample_buffer)[(i*channels)+ch] = (int32_t)lrintf(inp); + } + } + break; + } +} + +static void to_PCM_float(NeAACDecHandle hDecoder, real_t **input, + uint8_t channels, uint16_t frame_len, + float32_t **sample_buffer) +{ + uint8_t ch, ch1; + uint16_t i; + + switch (CONV(channels,hDecoder->downMatrix)) + { + case CONV(1,0): + case CONV(1,1): + for(i = 0; i < frame_len; i++) + { + real_t inp = input[hDecoder->internal_channel[0]][i]; + (*sample_buffer)[i] = inp*FLOAT_SCALE; + } + break; + case CONV(2,0): + if (hDecoder->upMatrix) + { + ch = hDecoder->internal_channel[0]; + for(i = 0; i < frame_len; i++) + { + real_t inp0 = input[ch][i]; + (*sample_buffer)[(i*2)+0] = inp0*FLOAT_SCALE; + (*sample_buffer)[(i*2)+1] = inp0*FLOAT_SCALE; + } + } else { + ch = hDecoder->internal_channel[0]; + ch1 = hDecoder->internal_channel[1]; + for(i = 0; i < frame_len; i++) + { + real_t inp0 = input[ch ][i]; + real_t inp1 = input[ch1][i]; + (*sample_buffer)[(i*2)+0] = inp0*FLOAT_SCALE; + (*sample_buffer)[(i*2)+1] = inp1*FLOAT_SCALE; + } + } + break; + default: + for (ch = 0; ch < channels; ch++) + { + for(i = 0; i < frame_len; i++) + { + real_t inp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->internal_channel); + (*sample_buffer)[(i*channels)+ch] = inp*FLOAT_SCALE; + } + } + break; + } +} + +static void to_PCM_double(NeAACDecHandle hDecoder, real_t **input, + uint8_t channels, uint16_t frame_len, + double **sample_buffer) +{ + uint8_t ch, ch1; + uint16_t i; + + switch (CONV(channels,hDecoder->downMatrix)) + { + case CONV(1,0): + case CONV(1,1): + for(i = 0; i < frame_len; i++) + { + real_t inp = input[hDecoder->internal_channel[0]][i]; + (*sample_buffer)[i] = (double)inp*FLOAT_SCALE; + } + break; + case CONV(2,0): + if (hDecoder->upMatrix) + { + ch = hDecoder->internal_channel[0]; + for(i = 0; i < frame_len; i++) + { + real_t inp0 = input[ch][i]; + (*sample_buffer)[(i*2)+0] = (double)inp0*FLOAT_SCALE; + (*sample_buffer)[(i*2)+1] = (double)inp0*FLOAT_SCALE; + } + } else { + ch = hDecoder->internal_channel[0]; + ch1 = hDecoder->internal_channel[1]; + for(i = 0; i < frame_len; i++) + { + real_t inp0 = input[ch ][i]; + real_t inp1 = input[ch1][i]; + (*sample_buffer)[(i*2)+0] = (double)inp0*FLOAT_SCALE; + (*sample_buffer)[(i*2)+1] = (double)inp1*FLOAT_SCALE; + } + } + break; + default: + for (ch = 0; ch < channels; ch++) + { + for(i = 0; i < frame_len; i++) + { + real_t inp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->internal_channel); + (*sample_buffer)[(i*channels)+ch] = (double)inp*FLOAT_SCALE; + } + } + break; + } +} + +void *output_to_PCM(NeAACDecHandle hDecoder, + real_t **input, void *sample_buffer, uint8_t channels, + uint16_t frame_len, uint8_t format) +{ + int16_t *short_sample_buffer = (int16_t*)sample_buffer; + int32_t *int_sample_buffer = (int32_t*)sample_buffer; + float32_t *float_sample_buffer = (float32_t*)sample_buffer; + double *double_sample_buffer = (double*)sample_buffer; + +#ifdef PROFILE + int64_t count = faad_get_ts(); +#endif + + /* Copy output to a standard PCM buffer */ + switch (format) + { + case FAAD_FMT_16BIT: + to_PCM_16bit(hDecoder, input, channels, frame_len, &short_sample_buffer); + break; + case FAAD_FMT_24BIT: + to_PCM_24bit(hDecoder, input, channels, frame_len, &int_sample_buffer); + break; + case FAAD_FMT_32BIT: + to_PCM_32bit(hDecoder, input, channels, frame_len, &int_sample_buffer); + break; + case FAAD_FMT_FLOAT: + to_PCM_float(hDecoder, input, channels, frame_len, &float_sample_buffer); + break; + case FAAD_FMT_DOUBLE: + to_PCM_double(hDecoder, input, channels, frame_len, &double_sample_buffer); + break; + } + +#ifdef PROFILE + count = faad_get_ts() - count; + hDecoder->output_cycles += count; +#endif + + return sample_buffer; +} + +#else + +#define DM_MUL FRAC_CONST(0.3203772410170407) // 1/(1+sqrt(2) + 1/sqrt(2)) +#define RSQRT2 FRAC_CONST(0.7071067811865475244) // 1/sqrt(2) + +static INLINE real_t get_sample(real_t **input, uint8_t channel, uint16_t sample, + uint8_t down_matrix, uint8_t up_matrix, + uint8_t *internal_channel) +{ + if (up_matrix == 1) + return input[internal_channel[0]][sample]; + + if (!down_matrix) + return input[internal_channel[channel]][sample]; + + if (channel == 0) + { + real_t C = MUL_F(input[internal_channel[0]][sample], RSQRT2); + real_t L_S = MUL_F(input[internal_channel[3]][sample], RSQRT2); + real_t cum = input[internal_channel[1]][sample] + C + L_S; + return MUL_F(cum, DM_MUL); + } else { + real_t C = MUL_F(input[internal_channel[0]][sample], RSQRT2); + real_t R_S = MUL_F(input[internal_channel[4]][sample], RSQRT2); + real_t cum = input[internal_channel[2]][sample] + C + R_S; + return MUL_F(cum, DM_MUL); + } +} + +void* output_to_PCM(NeAACDecHandle hDecoder, + real_t **input, void *sample_buffer, uint8_t channels, + uint16_t frame_len, uint8_t format) +{ + uint8_t ch; + uint16_t i; + int16_t *short_sample_buffer = (int16_t*)sample_buffer; + int32_t *int_sample_buffer = (int32_t*)sample_buffer; + + /* Copy output to a standard PCM buffer */ + for (ch = 0; ch < channels; ch++) + { + switch (format) + { + case FAAD_FMT_16BIT: + for(i = 0; i < frame_len; i++) + { + int32_t tmp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->upMatrix, + hDecoder->internal_channel); + if (tmp >= 0) + { + tmp += (1 << (REAL_BITS-1)); + if (tmp >= REAL_CONST(32767)) + { + tmp = REAL_CONST(32767); + } + } else { + tmp += -(1 << (REAL_BITS-1)); + if (tmp <= REAL_CONST(-32768)) + { + tmp = REAL_CONST(-32768); + } + } + tmp >>= REAL_BITS; + short_sample_buffer[(i*channels)+ch] = (int16_t)tmp; + } + break; + case FAAD_FMT_24BIT: + for(i = 0; i < frame_len; i++) + { + int32_t tmp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->upMatrix, + hDecoder->internal_channel); + if (tmp >= 0) + { + tmp += (1 << (REAL_BITS-9)); + tmp >>= (REAL_BITS-8); + if (tmp >= 8388607) + { + tmp = 8388607; + } + } else { + tmp += -(1 << (REAL_BITS-9)); + tmp >>= (REAL_BITS-8); + if (tmp <= -8388608) + { + tmp = -8388608; + } + } + int_sample_buffer[(i*channels)+ch] = (int32_t)tmp; + } + break; + case FAAD_FMT_32BIT: + for(i = 0; i < frame_len; i++) + { + int32_t tmp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->upMatrix, + hDecoder->internal_channel); + if (tmp >= 0) + { + tmp += (1 << (16-REAL_BITS-1)); + tmp <<= (16-REAL_BITS); + } else { + tmp += -(1 << (16-REAL_BITS-1)); + tmp <<= (16-REAL_BITS); + } + int_sample_buffer[(i*channels)+ch] = (int32_t)tmp; + } + break; + case FAAD_FMT_FIXED: + for(i = 0; i < frame_len; i++) + { + real_t tmp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->upMatrix, + hDecoder->internal_channel); + int_sample_buffer[(i*channels)+ch] = (int32_t)tmp; + } + break; + } + } + + return sample_buffer; +} + +#endif diff --git a/Libraries/FAAD2/Files/libfaad/output.h b/Libraries/FAAD2/Files/libfaad/output.h new file mode 100644 index 000000000..9fe835654 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/output.h @@ -0,0 +1,45 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#ifndef __OUTPUT_H__ +#define __OUTPUT_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +void* output_to_PCM(NeAACDecHandle hDecoder, + real_t **input, + void *samplebuffer, + uint8_t channels, + uint16_t frame_len, + uint8_t format); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/Libraries/FAAD2/Files/libfaad/pns.c b/Libraries/FAAD2/Files/libfaad/pns.c new file mode 100644 index 000000000..7727b2216 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/pns.c @@ -0,0 +1,265 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#include "common.h" +#include "structs.h" + +#include "pns.h" + + +/* static function declarations */ +static void gen_rand_vector(real_t *spec, int16_t scale_factor, uint16_t size, + uint8_t sub); + + +#ifdef FIXED_POINT + +#define DIV(A, B) (((int64_t)A << REAL_BITS)/B) + +#define step(shift) \ + if ((0x40000000l >> shift) + root <= value) \ + { \ + value -= (0x40000000l >> shift) + root; \ + root = (root >> 1) | (0x40000000l >> shift); \ + } else { \ + root = root >> 1; \ + } + +/* fixed point square root approximation */ +/* !!!! ONLY WORKS FOR EVEN %REAL_BITS% !!!! */ +real_t fp_sqrt(real_t value) +{ + real_t root = 0; + + step( 0); step( 2); step( 4); step( 6); + step( 8); step(10); step(12); step(14); + step(16); step(18); step(20); step(22); + step(24); step(26); step(28); step(30); + + if (root < value) + ++root; + + root <<= (REAL_BITS/2); + + return root; +} + +static real_t pow2_table[] = +{ + COEF_CONST(1.0), + COEF_CONST(1.18920711500272), + COEF_CONST(1.41421356237310), + COEF_CONST(1.68179283050743) +}; +#endif + +/* The function gen_rand_vector(addr, size) generates a vector of length + with signed random values of average energy MEAN_NRG per random + value. A suitable random number generator can be realized using one + multiplication/accumulation per random value. +*/ +static INLINE void gen_rand_vector(real_t *spec, int16_t scale_factor, uint16_t size, + uint8_t sub) +{ +#ifndef FIXED_POINT + uint16_t i; + real_t energy = 0.0; + + real_t scale = (real_t)1.0/(real_t)size; + + for (i = 0; i < size; i++) + { + real_t tmp = scale*(real_t)(int32_t)random_int(); + spec[i] = tmp; + energy += tmp*tmp; + } + + scale = (real_t)1.0/(real_t)sqrt(energy); + scale *= (real_t)pow(2.0, 0.25 * scale_factor); + for (i = 0; i < size; i++) + { + spec[i] *= scale; + } +#else + uint16_t i; + real_t energy = 0, scale; + int32_t exp, frac; + + for (i = 0; i < size; i++) + { + /* this can be replaced by a 16 bit random generator!!!! */ + real_t tmp = (int32_t)random_int(); + if (tmp < 0) + tmp = -(tmp & ((1<<(REAL_BITS-1))-1)); + else + tmp = (tmp & ((1<<(REAL_BITS-1))-1)); + + energy += MUL_R(tmp,tmp); + + spec[i] = tmp; + } + + energy = fp_sqrt(energy); + if (energy > 0) + { + scale = DIV(REAL_CONST(1),energy); + + exp = scale_factor >> 2; + frac = scale_factor & 3; + + /* IMDCT pre-scaling */ + exp -= sub; + + if (exp < 0) + scale >>= -exp; + else + scale <<= exp; + + if (frac) + scale = MUL_C(scale, pow2_table[frac]); + + for (i = 0; i < size; i++) + { + spec[i] = MUL_R(spec[i], scale); + } + } +#endif +} + +void pns_decode(ic_stream *ics_left, ic_stream *ics_right, + real_t *spec_left, real_t *spec_right, uint16_t frame_len, + uint8_t channel_pair, uint8_t object_type) +{ + uint8_t g, sfb, b; + uint16_t size, offs; + + uint8_t group = 0; + uint16_t nshort = frame_len >> 3; + + uint8_t sub = 0; + +#ifdef FIXED_POINT + /* IMDCT scaling */ + if (object_type == LD) + { + sub = 9 /*9*/; + } else { + if (ics_left->window_sequence == EIGHT_SHORT_SEQUENCE) + sub = 7 /*7*/; + else + sub = 10 /*10*/; + } +#endif + + for (g = 0; g < ics_left->num_window_groups; g++) + { + /* Do perceptual noise substitution decoding */ + for (b = 0; b < ics_left->window_group_length[g]; b++) + { + for (sfb = 0; sfb < ics_left->max_sfb; sfb++) + { + if (is_noise(ics_left, g, sfb)) + { +#ifdef LTP_DEC + /* Simultaneous use of LTP and PNS is not prevented in the + syntax. If both LTP, and PNS are enabled on the same + scalefactor band, PNS takes precedence, and no prediction + is applied to this band. + */ + ics_left->ltp.long_used[sfb] = 0; + ics_left->ltp2.long_used[sfb] = 0; +#endif + +#ifdef MAIN_DEC + /* For scalefactor bands coded using PNS the corresponding + predictors are switched to "off". + */ + ics_left->pred.prediction_used[sfb] = 0; +#endif + + offs = ics_left->swb_offset[sfb]; + size = ics_left->swb_offset[sfb+1] - offs; + + /* Generate random vector */ + gen_rand_vector(&spec_left[(group*nshort)+offs], + ics_left->scale_factors[g][sfb], size, sub); + } + +/* From the spec: + If the same scalefactor band and group is coded by perceptual noise + substitution in both channels of a channel pair, the correlation of + the noise signal can be controlled by means of the ms_used field: While + the default noise generation process works independently for each channel + (separate generation of random vectors), the same random vector is used + for both channels if ms_used[] is set for a particular scalefactor band + and group. In this case, no M/S stereo coding is carried out (because M/S + stereo coding and noise substitution coding are mutually exclusive). + If the same scalefactor band and group is coded by perceptual noise + substitution in only one channel of a channel pair the setting of ms_used[] + is not evaluated. +*/ + if (channel_pair) + { + if (is_noise(ics_right, g, sfb)) + { + if (((ics_left->ms_mask_present == 1) && + (ics_left->ms_used[g][sfb])) || + (ics_left->ms_mask_present == 2)) + { + uint16_t c; + + offs = ics_right->swb_offset[sfb]; + size = ics_right->swb_offset[sfb+1] - offs; + + for (c = 0; c < size; c++) + { + spec_right[(group*nshort) + offs + c] = + spec_left[(group*nshort) + offs + c]; + } + } else /*if (ics_left->ms_mask_present == 0)*/ { +#ifdef LTP_DEC + ics_right->ltp.long_used[sfb] = 0; + ics_right->ltp2.long_used[sfb] = 0; +#endif +#ifdef MAIN_DEC + ics_right->pred.prediction_used[sfb] = 0; +#endif + + offs = ics_right->swb_offset[sfb]; + size = ics_right->swb_offset[sfb+1] - offs; + + /* Generate random vector */ + gen_rand_vector(&spec_right[(group*nshort)+offs], + ics_right->scale_factors[g][sfb], size, sub); + } + } + } + } /* sfb */ + group++; + } /* b */ + } /* g */ +} diff --git a/Libraries/FAAD2/Files/libfaad/pns.h b/Libraries/FAAD2/Files/libfaad/pns.h new file mode 100644 index 000000000..e789f5708 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/pns.h @@ -0,0 +1,53 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#ifndef __PNS_H__ +#define __PNS_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "syntax.h" + +#define NOISE_OFFSET 90 + +void pns_decode(ic_stream *ics_left, ic_stream *ics_right, + real_t *spec_left, real_t *spec_right, uint16_t frame_len, + uint8_t channel_pair, uint8_t object_type); + +static INLINE uint8_t is_noise(ic_stream *ics, uint8_t group, uint8_t sfb) +{ + if (ics->sfb_cb[group][sfb] == NOISE_HCB) + return 1; + return 0; +} + +#ifdef __cplusplus +} +#endif +#endif diff --git a/Libraries/FAAD2/Files/libfaad/ps_dec.c b/Libraries/FAAD2/Files/libfaad/ps_dec.c new file mode 100644 index 000000000..cfc5629cb --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/ps_dec.c @@ -0,0 +1,1985 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR and PS decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#include "common.h" + +#ifdef PS_DEC + +#include +#include "ps_dec.h" +#include "ps_tables.h" + +/* constants */ +#define NEGATE_IPD_MASK (0x1000) +#define DECAY_SLOPE FRAC_CONST(0.05) +#define COEF_SQRT2 COEF_CONST(1.4142135623731) + +/* tables */ +/* filters are mirrored in coef 6, second half left out */ +static const real_t p8_13_20[7] = +{ + FRAC_CONST(0.00746082949812), + FRAC_CONST(0.02270420949825), + FRAC_CONST(0.04546865930473), + FRAC_CONST(0.07266113929591), + FRAC_CONST(0.09885108575264), + FRAC_CONST(0.11793710567217), + FRAC_CONST(0.125) +}; + +static const real_t p2_13_20[7] = +{ + FRAC_CONST(0.0), + FRAC_CONST(0.01899487526049), + FRAC_CONST(0.0), + FRAC_CONST(-0.07293139167538), + FRAC_CONST(0.0), + FRAC_CONST(0.30596630545168), + FRAC_CONST(0.5) +}; + +static const real_t p12_13_34[7] = +{ + FRAC_CONST(0.04081179924692), + FRAC_CONST(0.03812810994926), + FRAC_CONST(0.05144908135699), + FRAC_CONST(0.06399831151592), + FRAC_CONST(0.07428313801106), + FRAC_CONST(0.08100347892914), + FRAC_CONST(0.08333333333333) +}; + +static const real_t p8_13_34[7] = +{ + FRAC_CONST(0.01565675600122), + FRAC_CONST(0.03752716391991), + FRAC_CONST(0.05417891378782), + FRAC_CONST(0.08417044116767), + FRAC_CONST(0.10307344158036), + FRAC_CONST(0.12222452249753), + FRAC_CONST(0.125) +}; + +static const real_t p4_13_34[7] = +{ + FRAC_CONST(-0.05908211155639), + FRAC_CONST(-0.04871498374946), + FRAC_CONST(0.0), + FRAC_CONST(0.07778723915851), + FRAC_CONST(0.16486303567403), + FRAC_CONST(0.23279856662996), + FRAC_CONST(0.25) +}; + +#ifdef PARAM_32KHZ +static const uint8_t delay_length_d[2][NO_ALLPASS_LINKS] = { + { 1, 2, 3 } /* d_24kHz */, + { 3, 4, 5 } /* d_48kHz */ +}; +#else +static const uint8_t delay_length_d[NO_ALLPASS_LINKS] = { + 3, 4, 5 /* d_48kHz */ +}; +#endif +static const real_t filter_a[NO_ALLPASS_LINKS] = { /* a(m) = exp(-d_48kHz(m)/7) */ + FRAC_CONST(0.65143905753106), + FRAC_CONST(0.56471812200776), + FRAC_CONST(0.48954165955695) +}; + +static const uint8_t group_border20[10+12 + 1] = +{ + 6, 7, 0, 1, 2, 3, /* 6 subqmf subbands */ + 9, 8, /* 2 subqmf subbands */ + 10, 11, /* 2 subqmf subbands */ + 3, 4, 5, 6, 7, 8, 9, 11, 14, 18, 23, 35, 64 +}; + +static const uint8_t group_border34[32+18 + 1] = +{ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, /* 12 subqmf subbands */ + 12, 13, 14, 15, 16, 17, 18, 19, /* 8 subqmf subbands */ + 20, 21, 22, 23, /* 4 subqmf subbands */ + 24, 25, 26, 27, /* 4 subqmf subbands */ + 28, 29, 30, 31, /* 4 subqmf subbands */ + 32-27, 33-27, 34-27, 35-27, 36-27, 37-27, 38-27, 40-27, 42-27, 44-27, 46-27, 48-27, 51-27, 54-27, 57-27, 60-27, 64-27, 68-27, 91-27 +}; + +static const uint16_t map_group2bk20[10+12] = +{ + (NEGATE_IPD_MASK | 1), (NEGATE_IPD_MASK | 0), + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 +}; + +static const uint16_t map_group2bk34[32+18] = +{ + 0, 1, 2, 3, 4, 5, 6, 6, 7, (NEGATE_IPD_MASK | 2), (NEGATE_IPD_MASK | 1), (NEGATE_IPD_MASK | 0), + 10, 10, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 9, + 14, 11, 12, 13, + 14, 15, 16, 13, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33 +}; + +/* type definitions */ +typedef struct +{ + uint8_t frame_len; + uint8_t resolution20[3]; + uint8_t resolution34[5]; + + qmf_t *work; + qmf_t **buffer; + qmf_t **temp; +} hyb_info; + +/* static function declarations */ +static void ps_data_decode(ps_info *ps); +static hyb_info *hybrid_init(); +static void channel_filter2(hyb_info *hyb, uint8_t frame_len, const real_t *filter, + qmf_t *buffer, qmf_t **X_hybrid); +static void INLINE DCT3_4_unscaled(real_t *y, real_t *x); +static void channel_filter8(hyb_info *hyb, uint8_t frame_len, const real_t *filter, + qmf_t *buffer, qmf_t **X_hybrid); +static void hybrid_analysis(hyb_info *hyb, qmf_t X[32][64], qmf_t X_hybrid[32][32], + uint8_t use34); +static void hybrid_synthesis(hyb_info *hyb, qmf_t X[32][64], qmf_t X_hybrid[32][32], + uint8_t use34); +static int8_t delta_clip(int8_t i, int8_t min, int8_t max); +static void delta_decode(uint8_t enable, int8_t *index, int8_t *index_prev, + uint8_t dt_flag, uint8_t nr_par, uint8_t stride, + int8_t min_index, int8_t max_index); +static void delta_modulo_decode(uint8_t enable, int8_t *index, int8_t *index_prev, + uint8_t dt_flag, uint8_t nr_par, uint8_t stride, + int8_t log2modulo); +static void map20indexto34(int8_t *index, uint8_t bins); +#ifdef PS_LOW_POWER +static void map34indexto20(int8_t *index, uint8_t bins); +#endif +static void ps_data_decode(ps_info *ps); +static void ps_decorrelate(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64], + qmf_t X_hybrid_left[32][32], qmf_t X_hybrid_right[32][32]); +static void ps_mix_phase(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64], + qmf_t X_hybrid_left[32][32], qmf_t X_hybrid_right[32][32]); + +/* */ + + +static hyb_info *hybrid_init() +{ + uint8_t i; + + hyb_info *hyb = (hyb_info*)faad_malloc(sizeof(hyb_info)); + + hyb->resolution34[0] = 12; + hyb->resolution34[1] = 8; + hyb->resolution34[2] = 4; + hyb->resolution34[3] = 4; + hyb->resolution34[4] = 4; + + hyb->resolution20[0] = 8; + hyb->resolution20[1] = 2; + hyb->resolution20[2] = 2; + + hyb->frame_len = 32; + + hyb->work = (qmf_t*)faad_malloc((hyb->frame_len+12) * sizeof(qmf_t)); + memset(hyb->work, 0, (hyb->frame_len+12) * sizeof(qmf_t)); + + hyb->buffer = (qmf_t**)faad_malloc(5 * sizeof(qmf_t*)); + for (i = 0; i < 5; i++) + { + hyb->buffer[i] = (qmf_t*)faad_malloc(hyb->frame_len * sizeof(qmf_t)); + memset(hyb->buffer[i], 0, hyb->frame_len * sizeof(qmf_t)); + } + + hyb->temp = (qmf_t**)faad_malloc(hyb->frame_len * sizeof(qmf_t*)); + for (i = 0; i < hyb->frame_len; i++) + { + hyb->temp[i] = (qmf_t*)faad_malloc(12 /*max*/ * sizeof(qmf_t)); + } + + return hyb; +} + +static void hybrid_free(hyb_info *hyb) +{ + uint8_t i; + + if (hyb->work) + faad_free(hyb->work); + + for (i = 0; i < 5; i++) + { + if (hyb->buffer[i]) + faad_free(hyb->buffer[i]); + } + if (hyb->buffer) + faad_free(hyb->buffer); + + for (i = 0; i < hyb->frame_len; i++) + { + if (hyb->temp[i]) + faad_free(hyb->temp[i]); + } + if (hyb->temp) + faad_free(hyb->temp); +} + +/* real filter, size 2 */ +static void channel_filter2(hyb_info *hyb, uint8_t frame_len, const real_t *filter, + qmf_t *buffer, qmf_t **X_hybrid) +{ + uint8_t i; + + for (i = 0; i < frame_len; i++) + { + real_t r0 = MUL_F(filter[0],(QMF_RE(buffer[0+i]) + QMF_RE(buffer[12+i]))); + real_t r1 = MUL_F(filter[1],(QMF_RE(buffer[1+i]) + QMF_RE(buffer[11+i]))); + real_t r2 = MUL_F(filter[2],(QMF_RE(buffer[2+i]) + QMF_RE(buffer[10+i]))); + real_t r3 = MUL_F(filter[3],(QMF_RE(buffer[3+i]) + QMF_RE(buffer[9+i]))); + real_t r4 = MUL_F(filter[4],(QMF_RE(buffer[4+i]) + QMF_RE(buffer[8+i]))); + real_t r5 = MUL_F(filter[5],(QMF_RE(buffer[5+i]) + QMF_RE(buffer[7+i]))); + real_t r6 = MUL_F(filter[6],QMF_RE(buffer[6+i])); + real_t i0 = MUL_F(filter[0],(QMF_IM(buffer[0+i]) + QMF_IM(buffer[12+i]))); + real_t i1 = MUL_F(filter[1],(QMF_IM(buffer[1+i]) + QMF_IM(buffer[11+i]))); + real_t i2 = MUL_F(filter[2],(QMF_IM(buffer[2+i]) + QMF_IM(buffer[10+i]))); + real_t i3 = MUL_F(filter[3],(QMF_IM(buffer[3+i]) + QMF_IM(buffer[9+i]))); + real_t i4 = MUL_F(filter[4],(QMF_IM(buffer[4+i]) + QMF_IM(buffer[8+i]))); + real_t i5 = MUL_F(filter[5],(QMF_IM(buffer[5+i]) + QMF_IM(buffer[7+i]))); + real_t i6 = MUL_F(filter[6],QMF_IM(buffer[6+i])); + + /* q = 0 */ + QMF_RE(X_hybrid[i][0]) = r0 + r1 + r2 + r3 + r4 + r5 + r6; + QMF_IM(X_hybrid[i][0]) = i0 + i1 + i2 + i3 + i4 + i5 + i6; + + /* q = 1 */ + QMF_RE(X_hybrid[i][1]) = r0 - r1 + r2 - r3 + r4 - r5 + r6; + QMF_IM(X_hybrid[i][1]) = i0 - i1 + i2 - i3 + i4 - i5 + i6; + } +} + +/* complex filter, size 4 */ +static void channel_filter4(hyb_info *hyb, uint8_t frame_len, const real_t *filter, + qmf_t *buffer, qmf_t **X_hybrid) +{ + uint8_t i; + real_t input_re1[2], input_re2[2], input_im1[2], input_im2[2]; + + for (i = 0; i < frame_len; i++) + { + input_re1[0] = -MUL_F(filter[2], (QMF_RE(buffer[i+2]) + QMF_RE(buffer[i+10]))) + + MUL_F(filter[6], QMF_RE(buffer[i+6])); + input_re1[1] = MUL_F(FRAC_CONST(-0.70710678118655), + (MUL_F(filter[1], (QMF_RE(buffer[i+1]) + QMF_RE(buffer[i+11]))) + + MUL_F(filter[3], (QMF_RE(buffer[i+3]) + QMF_RE(buffer[i+9]))) - + MUL_F(filter[5], (QMF_RE(buffer[i+5]) + QMF_RE(buffer[i+7]))))); + + input_im1[0] = MUL_F(filter[0], (QMF_IM(buffer[i+0]) - QMF_IM(buffer[i+12]))) - + MUL_F(filter[4], (QMF_IM(buffer[i+4]) - QMF_IM(buffer[i+8]))); + input_im1[1] = MUL_F(FRAC_CONST(0.70710678118655), + (MUL_F(filter[1], (QMF_IM(buffer[i+1]) - QMF_IM(buffer[i+11]))) - + MUL_F(filter[3], (QMF_IM(buffer[i+3]) - QMF_IM(buffer[i+9]))) - + MUL_F(filter[5], (QMF_IM(buffer[i+5]) - QMF_IM(buffer[i+7]))))); + + input_re2[0] = MUL_F(filter[0], (QMF_RE(buffer[i+0]) - QMF_RE(buffer[i+12]))) - + MUL_F(filter[4], (QMF_RE(buffer[i+4]) - QMF_RE(buffer[i+8]))); + input_re2[1] = MUL_F(FRAC_CONST(0.70710678118655), + (MUL_F(filter[1], (QMF_RE(buffer[i+1]) - QMF_RE(buffer[i+11]))) - + MUL_F(filter[3], (QMF_RE(buffer[i+3]) - QMF_RE(buffer[i+9]))) - + MUL_F(filter[5], (QMF_RE(buffer[i+5]) - QMF_RE(buffer[i+7]))))); + + input_im2[0] = -MUL_F(filter[2], (QMF_IM(buffer[i+2]) + QMF_IM(buffer[i+10]))) + + MUL_F(filter[6], QMF_IM(buffer[i+6])); + input_im2[1] = MUL_F(FRAC_CONST(-0.70710678118655), + (MUL_F(filter[1], (QMF_IM(buffer[i+1]) + QMF_IM(buffer[i+11]))) + + MUL_F(filter[3], (QMF_IM(buffer[i+3]) + QMF_IM(buffer[i+9]))) - + MUL_F(filter[5], (QMF_IM(buffer[i+5]) + QMF_IM(buffer[i+7]))))); + + /* q == 0 */ + QMF_RE(X_hybrid[i][0]) = input_re1[0] + input_re1[1] + input_im1[0] + input_im1[1]; + QMF_IM(X_hybrid[i][0]) = -input_re2[0] - input_re2[1] + input_im2[0] + input_im2[1]; + + /* q == 1 */ + QMF_RE(X_hybrid[i][1]) = input_re1[0] - input_re1[1] - input_im1[0] + input_im1[1]; + QMF_IM(X_hybrid[i][1]) = input_re2[0] - input_re2[1] + input_im2[0] - input_im2[1]; + + /* q == 2 */ + QMF_RE(X_hybrid[i][2]) = input_re1[0] - input_re1[1] + input_im1[0] - input_im1[1]; + QMF_IM(X_hybrid[i][2]) = -input_re2[0] + input_re2[1] + input_im2[0] - input_im2[1]; + + /* q == 3 */ + QMF_RE(X_hybrid[i][3]) = input_re1[0] + input_re1[1] - input_im1[0] - input_im1[1]; + QMF_IM(X_hybrid[i][3]) = input_re2[0] + input_re2[1] + input_im2[0] + input_im2[1]; + } +} + +static void INLINE DCT3_4_unscaled(real_t *y, real_t *x) +{ + real_t f0, f1, f2, f3, f4, f5, f6, f7, f8; + + f0 = MUL_F(x[2], FRAC_CONST(0.7071067811865476)); + f1 = x[0] - f0; + f2 = x[0] + f0; + f3 = x[1] + x[3]; + f4 = MUL_C(x[1], COEF_CONST(1.3065629648763766)); + f5 = MUL_F(f3, FRAC_CONST(-0.9238795325112866)); + f6 = MUL_F(x[3], FRAC_CONST(-0.5411961001461967)); + f7 = f4 + f5; + f8 = f6 - f5; + y[3] = f2 - f8; + y[0] = f2 + f8; + y[2] = f1 - f7; + y[1] = f1 + f7; +} + +/* complex filter, size 8 */ +static void channel_filter8(hyb_info *hyb, uint8_t frame_len, const real_t *filter, + qmf_t *buffer, qmf_t **X_hybrid) +{ + uint8_t i, n; + real_t input_re1[4], input_re2[4], input_im1[4], input_im2[4]; + real_t x[4]; + + for (i = 0; i < frame_len; i++) + { + input_re1[0] = MUL_F(filter[6],QMF_RE(buffer[6+i])); + input_re1[1] = MUL_F(filter[5],(QMF_RE(buffer[5+i]) + QMF_RE(buffer[7+i]))); + input_re1[2] = -MUL_F(filter[0],(QMF_RE(buffer[0+i]) + QMF_RE(buffer[12+i]))) + MUL_F(filter[4],(QMF_RE(buffer[4+i]) + QMF_RE(buffer[8+i]))); + input_re1[3] = -MUL_F(filter[1],(QMF_RE(buffer[1+i]) + QMF_RE(buffer[11+i]))) + MUL_F(filter[3],(QMF_RE(buffer[3+i]) + QMF_RE(buffer[9+i]))); + + input_im1[0] = MUL_F(filter[5],(QMF_IM(buffer[7+i]) - QMF_IM(buffer[5+i]))); + input_im1[1] = MUL_F(filter[0],(QMF_IM(buffer[12+i]) - QMF_IM(buffer[0+i]))) + MUL_F(filter[4],(QMF_IM(buffer[8+i]) - QMF_IM(buffer[4+i]))); + input_im1[2] = MUL_F(filter[1],(QMF_IM(buffer[11+i]) - QMF_IM(buffer[1+i]))) + MUL_F(filter[3],(QMF_IM(buffer[9+i]) - QMF_IM(buffer[3+i]))); + input_im1[3] = MUL_F(filter[2],(QMF_IM(buffer[10+i]) - QMF_IM(buffer[2+i]))); + + for (n = 0; n < 4; n++) + { + x[n] = input_re1[n] - input_im1[3-n]; + } + DCT3_4_unscaled(x, x); + QMF_RE(X_hybrid[i][7]) = x[0]; + QMF_RE(X_hybrid[i][5]) = x[2]; + QMF_RE(X_hybrid[i][3]) = x[3]; + QMF_RE(X_hybrid[i][1]) = x[1]; + + for (n = 0; n < 4; n++) + { + x[n] = input_re1[n] + input_im1[3-n]; + } + DCT3_4_unscaled(x, x); + QMF_RE(X_hybrid[i][6]) = x[1]; + QMF_RE(X_hybrid[i][4]) = x[3]; + QMF_RE(X_hybrid[i][2]) = x[2]; + QMF_RE(X_hybrid[i][0]) = x[0]; + + input_im2[0] = MUL_F(filter[6],QMF_IM(buffer[6+i])); + input_im2[1] = MUL_F(filter[5],(QMF_IM(buffer[5+i]) + QMF_IM(buffer[7+i]))); + input_im2[2] = -MUL_F(filter[0],(QMF_IM(buffer[0+i]) + QMF_IM(buffer[12+i]))) + MUL_F(filter[4],(QMF_IM(buffer[4+i]) + QMF_IM(buffer[8+i]))); + input_im2[3] = -MUL_F(filter[1],(QMF_IM(buffer[1+i]) + QMF_IM(buffer[11+i]))) + MUL_F(filter[3],(QMF_IM(buffer[3+i]) + QMF_IM(buffer[9+i]))); + + input_re2[0] = MUL_F(filter[5],(QMF_RE(buffer[7+i]) - QMF_RE(buffer[5+i]))); + input_re2[1] = MUL_F(filter[0],(QMF_RE(buffer[12+i]) - QMF_RE(buffer[0+i]))) + MUL_F(filter[4],(QMF_RE(buffer[8+i]) - QMF_RE(buffer[4+i]))); + input_re2[2] = MUL_F(filter[1],(QMF_RE(buffer[11+i]) - QMF_RE(buffer[1+i]))) + MUL_F(filter[3],(QMF_RE(buffer[9+i]) - QMF_RE(buffer[3+i]))); + input_re2[3] = MUL_F(filter[2],(QMF_RE(buffer[10+i]) - QMF_RE(buffer[2+i]))); + + for (n = 0; n < 4; n++) + { + x[n] = input_im2[n] + input_re2[3-n]; + } + DCT3_4_unscaled(x, x); + QMF_IM(X_hybrid[i][7]) = x[0]; + QMF_IM(X_hybrid[i][5]) = x[2]; + QMF_IM(X_hybrid[i][3]) = x[3]; + QMF_IM(X_hybrid[i][1]) = x[1]; + + for (n = 0; n < 4; n++) + { + x[n] = input_im2[n] - input_re2[3-n]; + } + DCT3_4_unscaled(x, x); + QMF_IM(X_hybrid[i][6]) = x[1]; + QMF_IM(X_hybrid[i][4]) = x[3]; + QMF_IM(X_hybrid[i][2]) = x[2]; + QMF_IM(X_hybrid[i][0]) = x[0]; + } +} + +static void INLINE DCT3_6_unscaled(real_t *y, real_t *x) +{ + real_t f0, f1, f2, f3, f4, f5, f6, f7; + + f0 = MUL_F(x[3], FRAC_CONST(0.70710678118655)); + f1 = x[0] + f0; + f2 = x[0] - f0; + f3 = MUL_F((x[1] - x[5]), FRAC_CONST(0.70710678118655)); + f4 = MUL_F(x[2], FRAC_CONST(0.86602540378444)) + MUL_F(x[4], FRAC_CONST(0.5)); + f5 = f4 - x[4]; + f6 = MUL_F(x[1], FRAC_CONST(0.96592582628907)) + MUL_F(x[5], FRAC_CONST(0.25881904510252)); + f7 = f6 - f3; + y[0] = f1 + f6 + f4; + y[1] = f2 + f3 - x[4]; + y[2] = f7 + f2 - f5; + y[3] = f1 - f7 - f5; + y[4] = f1 - f3 - x[4]; + y[5] = f2 - f6 + f4; +} + +/* complex filter, size 12 */ +static void channel_filter12(hyb_info *hyb, uint8_t frame_len, const real_t *filter, + qmf_t *buffer, qmf_t **X_hybrid) +{ + uint8_t i, n; + real_t input_re1[6], input_re2[6], input_im1[6], input_im2[6]; + real_t out_re1[6], out_re2[6], out_im1[6], out_im2[6]; + + for (i = 0; i < frame_len; i++) + { + for (n = 0; n < 6; n++) + { + if (n == 0) + { + input_re1[0] = MUL_F(QMF_RE(buffer[6+i]), filter[6]); + input_re2[0] = MUL_F(QMF_IM(buffer[6+i]), filter[6]); + } else { + input_re1[6-n] = MUL_F((QMF_RE(buffer[n+i]) + QMF_RE(buffer[12-n+i])), filter[n]); + input_re2[6-n] = MUL_F((QMF_IM(buffer[n+i]) + QMF_IM(buffer[12-n+i])), filter[n]); + } + input_im2[n] = MUL_F((QMF_RE(buffer[n+i]) - QMF_RE(buffer[12-n+i])), filter[n]); + input_im1[n] = MUL_F((QMF_IM(buffer[n+i]) - QMF_IM(buffer[12-n+i])), filter[n]); + } + + DCT3_6_unscaled(out_re1, input_re1); + DCT3_6_unscaled(out_re2, input_re2); + + DCT3_6_unscaled(out_im1, input_im1); + DCT3_6_unscaled(out_im2, input_im2); + + for (n = 0; n < 6; n += 2) + { + QMF_RE(X_hybrid[i][n]) = out_re1[n] - out_im1[n]; + QMF_IM(X_hybrid[i][n]) = out_re2[n] + out_im2[n]; + QMF_RE(X_hybrid[i][n+1]) = out_re1[n+1] + out_im1[n+1]; + QMF_IM(X_hybrid[i][n+1]) = out_re2[n+1] - out_im2[n+1]; + + QMF_RE(X_hybrid[i][10-n]) = out_re1[n+1] - out_im1[n+1]; + QMF_IM(X_hybrid[i][10-n]) = out_re2[n+1] + out_im2[n+1]; + QMF_RE(X_hybrid[i][11-n]) = out_re1[n] + out_im1[n]; + QMF_IM(X_hybrid[i][11-n]) = out_re2[n] - out_im2[n]; + } + } +} + +/* Hybrid analysis: further split up QMF subbands + * to improve frequency resolution + */ +static void hybrid_analysis(hyb_info *hyb, qmf_t X[32][64], qmf_t X_hybrid[32][32], + uint8_t use34) +{ + uint8_t k, n, band; + uint8_t offset = 0; + uint8_t qmf_bands = (use34) ? 5 : 3; + uint8_t *resolution = (use34) ? hyb->resolution34 : hyb->resolution20; + + for (band = 0; band < qmf_bands; band++) + { + /* build working buffer */ + memcpy(hyb->work, hyb->buffer[band], 12 * sizeof(qmf_t)); + + /* add new samples */ + for (n = 0; n < hyb->frame_len; n++) + { + QMF_RE(hyb->work[12 + n]) = QMF_RE(X[n + 6 /*delay*/][band]); + QMF_IM(hyb->work[12 + n]) = QMF_IM(X[n + 6 /*delay*/][band]); + } + + /* store samples */ + memcpy(hyb->buffer[band], hyb->work + hyb->frame_len, 12 * sizeof(qmf_t)); + + + switch(resolution[band]) + { + case 2: + /* Type B real filter, Q[p] = 2 */ + channel_filter2(hyb, hyb->frame_len, p2_13_20, hyb->work, hyb->temp); + break; + case 4: + /* Type A complex filter, Q[p] = 4 */ + channel_filter4(hyb, hyb->frame_len, p4_13_34, hyb->work, hyb->temp); + break; + case 8: + /* Type A complex filter, Q[p] = 8 */ + channel_filter8(hyb, hyb->frame_len, (use34) ? p8_13_34 : p8_13_20, + hyb->work, hyb->temp); + break; + case 12: + /* Type A complex filter, Q[p] = 12 */ + channel_filter12(hyb, hyb->frame_len, p12_13_34, hyb->work, hyb->temp); + break; + } + + for (n = 0; n < hyb->frame_len; n++) + { + for (k = 0; k < resolution[band]; k++) + { + QMF_RE(X_hybrid[n][offset + k]) = QMF_RE(hyb->temp[n][k]); + QMF_IM(X_hybrid[n][offset + k]) = QMF_IM(hyb->temp[n][k]); + } + } + offset += resolution[band]; + } + + /* group hybrid channels */ + if (!use34) + { + for (n = 0; n < 32 /*30?*/; n++) + { + QMF_RE(X_hybrid[n][3]) += QMF_RE(X_hybrid[n][4]); + QMF_IM(X_hybrid[n][3]) += QMF_IM(X_hybrid[n][4]); + QMF_RE(X_hybrid[n][4]) = 0; + QMF_IM(X_hybrid[n][4]) = 0; + + QMF_RE(X_hybrid[n][2]) += QMF_RE(X_hybrid[n][5]); + QMF_IM(X_hybrid[n][2]) += QMF_IM(X_hybrid[n][5]); + QMF_RE(X_hybrid[n][5]) = 0; + QMF_IM(X_hybrid[n][5]) = 0; + } + } +} + +static void hybrid_synthesis(hyb_info *hyb, qmf_t X[32][64], qmf_t X_hybrid[32][32], + uint8_t use34) +{ + uint8_t k, n, band; + uint8_t offset = 0; + uint8_t qmf_bands = (use34) ? 5 : 3; + uint8_t *resolution = (use34) ? hyb->resolution34 : hyb->resolution20; + + for(band = 0; band < qmf_bands; band++) + { + for (n = 0; n < hyb->frame_len; n++) + { + QMF_RE(X[n][band]) = 0; + QMF_IM(X[n][band]) = 0; + + for (k = 0; k < resolution[band]; k++) + { + QMF_RE(X[n][band]) += QMF_RE(X_hybrid[n][offset + k]); + QMF_IM(X[n][band]) += QMF_IM(X_hybrid[n][offset + k]); + } + } + offset += resolution[band]; + } +} + +/* limits the value i to the range [min,max] */ +static int8_t delta_clip(int8_t i, int8_t min, int8_t max) +{ + if (i < min) + return min; + else if (i > max) + return max; + else + return i; +} + +//int iid = 0; + +/* delta decode array */ +static void delta_decode(uint8_t enable, int8_t *index, int8_t *index_prev, + uint8_t dt_flag, uint8_t nr_par, uint8_t stride, + int8_t min_index, int8_t max_index) +{ + int8_t i; + + if (enable == 1) + { + if (dt_flag == 0) + { + /* delta coded in frequency direction */ + index[0] = 0 + index[0]; + index[0] = delta_clip(index[0], min_index, max_index); + + for (i = 1; i < nr_par; i++) + { + index[i] = index[i-1] + index[i]; + index[i] = delta_clip(index[i], min_index, max_index); + } + } else { + /* delta coded in time direction */ + for (i = 0; i < nr_par; i++) + { + //int8_t tmp2; + //int8_t tmp = index[i]; + + //printf("%d %d\n", index_prev[i*stride], index[i]); + //printf("%d\n", index[i]); + + index[i] = index_prev[i*stride] + index[i]; + //tmp2 = index[i]; + index[i] = delta_clip(index[i], min_index, max_index); + + //if (iid) + //{ + // if (index[i] == 7) + // { + // printf("%d %d %d\n", index_prev[i*stride], tmp, tmp2); + // } + //} + } + } + } else { + /* set indices to zero */ + for (i = 0; i < nr_par; i++) + { + index[i] = 0; + } + } + + /* coarse */ + if (stride == 2) + { + for (i = (nr_par<<1)-1; i > 0; i--) + { + index[i] = index[i>>1]; + } + } +} + +/* delta modulo decode array */ +/* in: log2 value of the modulo value to allow using AND instead of MOD */ +static void delta_modulo_decode(uint8_t enable, int8_t *index, int8_t *index_prev, + uint8_t dt_flag, uint8_t nr_par, uint8_t stride, + int8_t log2modulo) +{ + int8_t i; + + if (enable == 1) + { + if (dt_flag == 0) + { + /* delta coded in frequency direction */ + index[0] = 0 + index[0]; + index[0] &= log2modulo; + + for (i = 1; i < nr_par; i++) + { + index[i] = index[i-1] + index[i]; + index[i] &= log2modulo; + } + } else { + /* delta coded in time direction */ + for (i = 0; i < nr_par; i++) + { + index[i] = index_prev[i*stride] + index[i]; + index[i] &= log2modulo; + } + } + } else { + /* set indices to zero */ + for (i = 0; i < nr_par; i++) + { + index[i] = 0; + } + } + + /* coarse */ + if (stride == 2) + { + index[0] = 0; + for (i = (nr_par<<1)-1; i > 0; i--) + { + index[i] = index[i>>1]; + } + } +} + +#ifdef PS_LOW_POWER +static void map34indexto20(int8_t *index, uint8_t bins) +{ + index[0] = (2*index[0]+index[1])/3; + index[1] = (index[1]+2*index[2])/3; + index[2] = (2*index[3]+index[4])/3; + index[3] = (index[4]+2*index[5])/3; + index[4] = (index[6]+index[7])/2; + index[5] = (index[8]+index[9])/2; + index[6] = index[10]; + index[7] = index[11]; + index[8] = (index[12]+index[13])/2; + index[9] = (index[14]+index[15])/2; + index[10] = index[16]; + + if (bins == 34) + { + index[11] = index[17]; + index[12] = index[18]; + index[13] = index[19]; + index[14] = (index[20]+index[21])/2; + index[15] = (index[22]+index[23])/2; + index[16] = (index[24]+index[25])/2; + index[17] = (index[26]+index[27])/2; + index[18] = (index[28]+index[29]+index[30]+index[31])/4; + index[19] = (index[32]+index[33])/2; + } +} +#endif + +static void map20indexto34(int8_t *index, uint8_t bins) +{ + index[0] = index[0]; + index[1] = (index[0] + index[1])/2; + index[2] = index[1]; + index[3] = index[2]; + index[4] = (index[2] + index[3])/2; + index[5] = index[3]; + index[6] = index[4]; + index[7] = index[4]; + index[8] = index[5]; + index[9] = index[5]; + index[10] = index[6]; + index[11] = index[7]; + index[12] = index[8]; + index[13] = index[8]; + index[14] = index[9]; + index[15] = index[9]; + index[16] = index[10]; + + if (bins == 34) + { + index[17] = index[11]; + index[18] = index[12]; + index[19] = index[13]; + index[20] = index[14]; + index[21] = index[14]; + index[22] = index[15]; + index[23] = index[15]; + index[24] = index[16]; + index[25] = index[16]; + index[26] = index[17]; + index[27] = index[17]; + index[28] = index[18]; + index[29] = index[18]; + index[30] = index[18]; + index[31] = index[18]; + index[32] = index[19]; + index[33] = index[19]; + } +} + +/* parse the bitstream data decoded in ps_data() */ +static void ps_data_decode(ps_info *ps) +{ + uint8_t env, bin; + + /* ps data not available, use data from previous frame */ + if (ps->ps_data_available == 0) + { + ps->num_env = 0; + } + + for (env = 0; env < ps->num_env; env++) + { + int8_t *iid_index_prev; + int8_t *icc_index_prev; + int8_t *ipd_index_prev; + int8_t *opd_index_prev; + + int8_t num_iid_steps = (ps->iid_mode < 3) ? 7 : 15 /*fine quant*/; + + if (env == 0) + { + /* take last envelope from previous frame */ + iid_index_prev = ps->iid_index_prev; + icc_index_prev = ps->icc_index_prev; + ipd_index_prev = ps->ipd_index_prev; + opd_index_prev = ps->opd_index_prev; + } else { + /* take index values from previous envelope */ + iid_index_prev = ps->iid_index[env - 1]; + icc_index_prev = ps->icc_index[env - 1]; + ipd_index_prev = ps->ipd_index[env - 1]; + opd_index_prev = ps->opd_index[env - 1]; + } + +// iid = 1; + /* delta decode iid parameters */ + delta_decode(ps->enable_iid, ps->iid_index[env], iid_index_prev, + ps->iid_dt[env], ps->nr_iid_par, + (ps->iid_mode == 0 || ps->iid_mode == 3) ? 2 : 1, + -num_iid_steps, num_iid_steps); +// iid = 0; + + /* delta decode icc parameters */ + delta_decode(ps->enable_icc, ps->icc_index[env], icc_index_prev, + ps->icc_dt[env], ps->nr_icc_par, + (ps->icc_mode == 0 || ps->icc_mode == 3) ? 2 : 1, + 0, 7); + + /* delta modulo decode ipd parameters */ + delta_modulo_decode(ps->enable_ipdopd, ps->ipd_index[env], ipd_index_prev, + ps->ipd_dt[env], ps->nr_ipdopd_par, 1, /*log2(8)*/ 3); + + /* delta modulo decode opd parameters */ + delta_modulo_decode(ps->enable_ipdopd, ps->opd_index[env], opd_index_prev, + ps->opd_dt[env], ps->nr_ipdopd_par, 1, /*log2(8)*/ 3); + } + + /* handle error case */ + if (ps->num_env == 0) + { + /* force to 1 */ + ps->num_env = 1; + + if (ps->enable_iid) + { + for (bin = 0; bin < 34; bin++) + ps->iid_index[0][bin] = ps->iid_index_prev[bin]; + } else { + for (bin = 0; bin < 34; bin++) + ps->iid_index[0][bin] = 0; + } + + if (ps->enable_icc) + { + for (bin = 0; bin < 34; bin++) + ps->icc_index[0][bin] = ps->icc_index_prev[bin]; + } else { + for (bin = 0; bin < 34; bin++) + ps->icc_index[0][bin] = 0; + } + + if (ps->enable_ipdopd) + { + for (bin = 0; bin < 17; bin++) + { + ps->ipd_index[0][bin] = ps->ipd_index_prev[bin]; + ps->opd_index[0][bin] = ps->opd_index_prev[bin]; + } + } else { + for (bin = 0; bin < 17; bin++) + { + ps->ipd_index[0][bin] = 0; + ps->opd_index[0][bin] = 0; + } + } + } + + /* update previous indices */ + for (bin = 0; bin < 34; bin++) + ps->iid_index_prev[bin] = ps->iid_index[ps->num_env-1][bin]; + for (bin = 0; bin < 34; bin++) + ps->icc_index_prev[bin] = ps->icc_index[ps->num_env-1][bin]; + for (bin = 0; bin < 17; bin++) + { + ps->ipd_index_prev[bin] = ps->ipd_index[ps->num_env-1][bin]; + ps->opd_index_prev[bin] = ps->opd_index[ps->num_env-1][bin]; + } + + ps->ps_data_available = 0; + + if (ps->frame_class == 0) + { + ps->border_position[0] = 0; + for (env = 1; env < ps->num_env; env++) + { + ps->border_position[env] = (env * 32 /* 30 for 960? */) / ps->num_env; + } + ps->border_position[ps->num_env] = 32 /* 30 for 960? */; + } else { + ps->border_position[0] = 0; + + if (ps->border_position[ps->num_env] < 32 /* 30 for 960? */) + { + ps->num_env++; + ps->border_position[ps->num_env] = 32 /* 30 for 960? */; + for (bin = 0; bin < 34; bin++) + { + ps->iid_index[ps->num_env][bin] = ps->iid_index[ps->num_env-1][bin]; + ps->icc_index[ps->num_env][bin] = ps->icc_index[ps->num_env-1][bin]; + } + for (bin = 0; bin < 17; bin++) + { + ps->ipd_index[ps->num_env][bin] = ps->ipd_index[ps->num_env-1][bin]; + ps->opd_index[ps->num_env][bin] = ps->opd_index[ps->num_env-1][bin]; + } + } + + for (env = 1; env < ps->num_env; env++) + { + int8_t thr = 32 /* 30 for 960? */ - (ps->num_env - env); + + if (ps->border_position[env] > thr) + { + ps->border_position[env] = thr; + } else { + thr = ps->border_position[env-1]+1; + if (ps->border_position[env] < thr) + { + ps->border_position[env] = thr; + } + } + } + } + + /* make sure that the indices of all parameters can be mapped + * to the same hybrid synthesis filterbank + */ +#ifdef PS_LOW_POWER + for (env = 0; env < ps->num_env; env++) + { + if (ps->iid_mode == 2 || ps->iid_mode == 5) + map34indexto20(ps->iid_index[env], 34); + if (ps->icc_mode == 2 || ps->icc_mode == 5) + map34indexto20(ps->icc_index[env], 34); + + /* disable ipd/opd */ + for (bin = 0; bin < 17; bin++) + { + ps->aaIpdIndex[env][bin] = 0; + ps->aaOpdIndex[env][bin] = 0; + } + } +#else + if (ps->use34hybrid_bands) + { + for (env = 0; env < ps->num_env; env++) + { + if (ps->iid_mode != 2 && ps->iid_mode != 5) + map20indexto34(ps->iid_index[env], 34); + if (ps->icc_mode != 2 && ps->icc_mode != 5) + map20indexto34(ps->icc_index[env], 34); + if (ps->ipd_mode != 2 && ps->ipd_mode != 5) + { + map20indexto34(ps->ipd_index[env], 17); + map20indexto34(ps->opd_index[env], 17); + } + } + } +#endif + +#if 0 + for (env = 0; env < ps->num_env; env++) + { + printf("iid[env:%d]:", env); + for (bin = 0; bin < 34; bin++) + { + printf(" %d", ps->iid_index[env][bin]); + } + printf("\n"); + } + for (env = 0; env < ps->num_env; env++) + { + printf("icc[env:%d]:", env); + for (bin = 0; bin < 34; bin++) + { + printf(" %d", ps->icc_index[env][bin]); + } + printf("\n"); + } + for (env = 0; env < ps->num_env; env++) + { + printf("ipd[env:%d]:", env); + for (bin = 0; bin < 17; bin++) + { + printf(" %d", ps->ipd_index[env][bin]); + } + printf("\n"); + } + for (env = 0; env < ps->num_env; env++) + { + printf("opd[env:%d]:", env); + for (bin = 0; bin < 17; bin++) + { + printf(" %d", ps->opd_index[env][bin]); + } + printf("\n"); + } + printf("\n"); +#endif +} + +/* decorrelate the mono signal using an allpass filter */ +static void ps_decorrelate(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64], + qmf_t X_hybrid_left[32][32], qmf_t X_hybrid_right[32][32]) +{ + uint8_t gr, n, m, bk; + uint8_t temp_delay; + uint8_t sb, maxsb; + const complex_t *Phi_Fract_SubQmf; + uint8_t temp_delay_ser[NO_ALLPASS_LINKS]; + real_t P_SmoothPeakDecayDiffNrg, nrg; + real_t P[32][34]; + real_t G_TransientRatio[32][34] = {{0}}; + complex_t inputLeft; + + + /* chose hybrid filterbank: 20 or 34 band case */ + if (ps->use34hybrid_bands) + { + Phi_Fract_SubQmf = Phi_Fract_SubQmf34; + } else{ + Phi_Fract_SubQmf = Phi_Fract_SubQmf20; + } + + /* clear the energy values */ + for (n = 0; n < 32; n++) + { + for (bk = 0; bk < 34; bk++) + { + P[n][bk] = 0; + } + } + + /* calculate the energy in each parameter band b(k) */ + for (gr = 0; gr < ps->num_groups; gr++) + { + /* select the parameter index b(k) to which this group belongs */ + bk = (~NEGATE_IPD_MASK) & ps->map_group2bk[gr]; + + /* select the upper subband border for this group */ + maxsb = (gr < ps->num_hybrid_groups) ? ps->group_border[gr]+1 : ps->group_border[gr+1]; + + for (sb = ps->group_border[gr]; sb < maxsb; sb++) + { + for (n = ps->border_position[0]; n < ps->border_position[ps->num_env]; n++) + { +#ifdef FIXED_POINT + uint32_t in_re, in_im; +#endif + + /* input from hybrid subbands or QMF subbands */ + if (gr < ps->num_hybrid_groups) + { + RE(inputLeft) = QMF_RE(X_hybrid_left[n][sb]); + IM(inputLeft) = QMF_IM(X_hybrid_left[n][sb]); + } else { + RE(inputLeft) = QMF_RE(X_left[n][sb]); + IM(inputLeft) = QMF_IM(X_left[n][sb]); + } + + /* accumulate energy */ +#ifdef FIXED_POINT + /* NOTE: all input is scaled by 2^(-5) because of fixed point QMF + * meaning that P will be scaled by 2^(-10) compared to floating point version + */ + in_re = ((abs(RE(inputLeft))+(1<<(REAL_BITS-1)))>>REAL_BITS); + in_im = ((abs(IM(inputLeft))+(1<<(REAL_BITS-1)))>>REAL_BITS); + P[n][bk] += in_re*in_re + in_im*in_im; +#else + P[n][bk] += MUL_R(RE(inputLeft),RE(inputLeft)) + MUL_R(IM(inputLeft),IM(inputLeft)); +#endif + } + } + } + +#if 0 + for (n = 0; n < 32; n++) + { + for (bk = 0; bk < 34; bk++) + { +#ifdef FIXED_POINT + printf("%d %d: %d\n", n, bk, P[n][bk] /*/(float)REAL_PRECISION*/); +#else + printf("%d %d: %f\n", n, bk, P[n][bk]/1024.0); +#endif + } + } +#endif + + /* calculate transient reduction ratio for each parameter band b(k) */ + for (bk = 0; bk < ps->nr_par_bands; bk++) + { + for (n = ps->border_position[0]; n < ps->border_position[ps->num_env]; n++) + { + const real_t gamma = COEF_CONST(1.5); + + ps->P_PeakDecayNrg[bk] = MUL_F(ps->P_PeakDecayNrg[bk], ps->alpha_decay); + if (ps->P_PeakDecayNrg[bk] < P[n][bk]) + ps->P_PeakDecayNrg[bk] = P[n][bk]; + + /* apply smoothing filter to peak decay energy */ + P_SmoothPeakDecayDiffNrg = ps->P_SmoothPeakDecayDiffNrg_prev[bk]; + P_SmoothPeakDecayDiffNrg += MUL_F((ps->P_PeakDecayNrg[bk] - P[n][bk] - ps->P_SmoothPeakDecayDiffNrg_prev[bk]), ps->alpha_smooth); + ps->P_SmoothPeakDecayDiffNrg_prev[bk] = P_SmoothPeakDecayDiffNrg; + + /* apply smoothing filter to energy */ + nrg = ps->P_prev[bk]; + nrg += MUL_F((P[n][bk] - ps->P_prev[bk]), ps->alpha_smooth); + ps->P_prev[bk] = nrg; + + /* calculate transient ratio */ + if (MUL_C(P_SmoothPeakDecayDiffNrg, gamma) <= nrg) + { + G_TransientRatio[n][bk] = REAL_CONST(1.0); + } else { + G_TransientRatio[n][bk] = DIV_R(nrg, (MUL_C(P_SmoothPeakDecayDiffNrg, gamma))); + } + } + } + +#if 0 + for (n = 0; n < 32; n++) + { + for (bk = 0; bk < 34; bk++) + { +#ifdef FIXED_POINT + printf("%d %d: %f\n", n, bk, G_TransientRatio[n][bk]/(float)REAL_PRECISION); +#else + printf("%d %d: %f\n", n, bk, G_TransientRatio[n][bk]); +#endif + } + } +#endif + + /* apply stereo decorrelation filter to the signal */ + for (gr = 0; gr < ps->num_groups; gr++) + { + if (gr < ps->num_hybrid_groups) + maxsb = ps->group_border[gr] + 1; + else + maxsb = ps->group_border[gr + 1]; + + /* QMF channel */ + for (sb = ps->group_border[gr]; sb < maxsb; sb++) + { + real_t g_DecaySlope; + real_t g_DecaySlope_filt[NO_ALLPASS_LINKS]; + + /* g_DecaySlope: [0..1] */ + if (gr < ps->num_hybrid_groups || sb <= ps->decay_cutoff) + { + g_DecaySlope = FRAC_CONST(1.0); + } else { + int8_t decay = ps->decay_cutoff - sb; + if (decay <= -20 /* -1/DECAY_SLOPE */) + { + g_DecaySlope = 0; + } else { + /* decay(int)*decay_slope(frac) = g_DecaySlope(frac) */ + g_DecaySlope = FRAC_CONST(1.0) + DECAY_SLOPE * decay; + } + } + + /* calculate g_DecaySlope_filt for every m multiplied by filter_a[m] */ + for (m = 0; m < NO_ALLPASS_LINKS; m++) + { + g_DecaySlope_filt[m] = MUL_F(g_DecaySlope, filter_a[m]); + } + + + /* set delay indices */ + temp_delay = ps->saved_delay; + for (n = 0; n < NO_ALLPASS_LINKS; n++) + temp_delay_ser[n] = ps->delay_buf_index_ser[n]; + + for (n = ps->border_position[0]; n < ps->border_position[ps->num_env]; n++) + { + complex_t tmp, tmp0, R0; + + if (gr < ps->num_hybrid_groups) + { + /* hybrid filterbank input */ + RE(inputLeft) = QMF_RE(X_hybrid_left[n][sb]); + IM(inputLeft) = QMF_IM(X_hybrid_left[n][sb]); + } else { + /* QMF filterbank input */ + RE(inputLeft) = QMF_RE(X_left[n][sb]); + IM(inputLeft) = QMF_IM(X_left[n][sb]); + } + + if (sb > ps->nr_allpass_bands && gr >= ps->num_hybrid_groups) + { + /* delay */ + + /* never hybrid subbands here, always QMF subbands */ + RE(tmp) = RE(ps->delay_Qmf[ps->delay_buf_index_delay[sb]][sb]); + IM(tmp) = IM(ps->delay_Qmf[ps->delay_buf_index_delay[sb]][sb]); + RE(R0) = RE(tmp); + IM(R0) = IM(tmp); + RE(ps->delay_Qmf[ps->delay_buf_index_delay[sb]][sb]) = RE(inputLeft); + IM(ps->delay_Qmf[ps->delay_buf_index_delay[sb]][sb]) = IM(inputLeft); + } else { + /* allpass filter */ + uint8_t m; + complex_t Phi_Fract; + + /* fetch parameters */ + if (gr < ps->num_hybrid_groups) + { + /* select data from the hybrid subbands */ + RE(tmp0) = RE(ps->delay_SubQmf[temp_delay][sb]); + IM(tmp0) = IM(ps->delay_SubQmf[temp_delay][sb]); + + RE(ps->delay_SubQmf[temp_delay][sb]) = RE(inputLeft); + IM(ps->delay_SubQmf[temp_delay][sb]) = IM(inputLeft); + + RE(Phi_Fract) = RE(Phi_Fract_SubQmf[sb]); + IM(Phi_Fract) = IM(Phi_Fract_SubQmf[sb]); + } else { + /* select data from the QMF subbands */ + RE(tmp0) = RE(ps->delay_Qmf[temp_delay][sb]); + IM(tmp0) = IM(ps->delay_Qmf[temp_delay][sb]); + + RE(ps->delay_Qmf[temp_delay][sb]) = RE(inputLeft); + IM(ps->delay_Qmf[temp_delay][sb]) = IM(inputLeft); + + RE(Phi_Fract) = RE(Phi_Fract_Qmf[sb]); + IM(Phi_Fract) = IM(Phi_Fract_Qmf[sb]); + } + + /* z^(-2) * Phi_Fract[k] */ + ComplexMult(&RE(tmp), &IM(tmp), RE(tmp0), IM(tmp0), RE(Phi_Fract), IM(Phi_Fract)); + + RE(R0) = RE(tmp); + IM(R0) = IM(tmp); + for (m = 0; m < NO_ALLPASS_LINKS; m++) + { + complex_t Q_Fract_allpass, tmp2; + + /* fetch parameters */ + if (gr < ps->num_hybrid_groups) + { + /* select data from the hybrid subbands */ + RE(tmp0) = RE(ps->delay_SubQmf_ser[m][temp_delay_ser[m]][sb]); + IM(tmp0) = IM(ps->delay_SubQmf_ser[m][temp_delay_ser[m]][sb]); + + if (ps->use34hybrid_bands) + { + RE(Q_Fract_allpass) = RE(Q_Fract_allpass_SubQmf34[sb][m]); + IM(Q_Fract_allpass) = IM(Q_Fract_allpass_SubQmf34[sb][m]); + } else { + RE(Q_Fract_allpass) = RE(Q_Fract_allpass_SubQmf20[sb][m]); + IM(Q_Fract_allpass) = IM(Q_Fract_allpass_SubQmf20[sb][m]); + } + } else { + /* select data from the QMF subbands */ + RE(tmp0) = RE(ps->delay_Qmf_ser[m][temp_delay_ser[m]][sb]); + IM(tmp0) = IM(ps->delay_Qmf_ser[m][temp_delay_ser[m]][sb]); + + RE(Q_Fract_allpass) = RE(Q_Fract_allpass_Qmf[sb][m]); + IM(Q_Fract_allpass) = IM(Q_Fract_allpass_Qmf[sb][m]); + } + + /* delay by a fraction */ + /* z^(-d(m)) * Q_Fract_allpass[k,m] */ + ComplexMult(&RE(tmp), &IM(tmp), RE(tmp0), IM(tmp0), RE(Q_Fract_allpass), IM(Q_Fract_allpass)); + + /* -a(m) * g_DecaySlope[k] */ + RE(tmp) += -MUL_F(g_DecaySlope_filt[m], RE(R0)); + IM(tmp) += -MUL_F(g_DecaySlope_filt[m], IM(R0)); + + /* -a(m) * g_DecaySlope[k] * Q_Fract_allpass[k,m] * z^(-d(m)) */ + RE(tmp2) = RE(R0) + MUL_F(g_DecaySlope_filt[m], RE(tmp)); + IM(tmp2) = IM(R0) + MUL_F(g_DecaySlope_filt[m], IM(tmp)); + + /* store sample */ + if (gr < ps->num_hybrid_groups) + { + RE(ps->delay_SubQmf_ser[m][temp_delay_ser[m]][sb]) = RE(tmp2); + IM(ps->delay_SubQmf_ser[m][temp_delay_ser[m]][sb]) = IM(tmp2); + } else { + RE(ps->delay_Qmf_ser[m][temp_delay_ser[m]][sb]) = RE(tmp2); + IM(ps->delay_Qmf_ser[m][temp_delay_ser[m]][sb]) = IM(tmp2); + } + + /* store for next iteration (or as output value if last iteration) */ + RE(R0) = RE(tmp); + IM(R0) = IM(tmp); + } + } + + /* select b(k) for reading the transient ratio */ + bk = (~NEGATE_IPD_MASK) & ps->map_group2bk[gr]; + + /* duck if a past transient is found */ + RE(R0) = MUL_R(G_TransientRatio[n][bk], RE(R0)); + IM(R0) = MUL_R(G_TransientRatio[n][bk], IM(R0)); + + if (gr < ps->num_hybrid_groups) + { + /* hybrid */ + QMF_RE(X_hybrid_right[n][sb]) = RE(R0); + QMF_IM(X_hybrid_right[n][sb]) = IM(R0); + } else { + /* QMF */ + QMF_RE(X_right[n][sb]) = RE(R0); + QMF_IM(X_right[n][sb]) = IM(R0); + } + + /* Update delay buffer index */ + if (++temp_delay >= 2) + { + temp_delay = 0; + } + + /* update delay indices */ + if (sb > ps->nr_allpass_bands && gr >= ps->num_hybrid_groups) + { + /* delay_D depends on the samplerate, it can hold the values 14 and 1 */ + if (++ps->delay_buf_index_delay[sb] >= ps->delay_D[sb]) + { + ps->delay_buf_index_delay[sb] = 0; + } + } + + for (m = 0; m < NO_ALLPASS_LINKS; m++) + { + if (++temp_delay_ser[m] >= ps->num_sample_delay_ser[m]) + { + temp_delay_ser[m] = 0; + } + } + } + } + } + + /* update delay indices */ + ps->saved_delay = temp_delay; + for (m = 0; m < NO_ALLPASS_LINKS; m++) + ps->delay_buf_index_ser[m] = temp_delay_ser[m]; +} + +#ifdef FIXED_POINT +#define step(shift) \ + if ((0x40000000l >> shift) + root <= value) \ + { \ + value -= (0x40000000l >> shift) + root; \ + root = (root >> 1) | (0x40000000l >> shift); \ + } else { \ + root = root >> 1; \ + } + +/* fixed point square root approximation */ +static real_t ps_sqrt(real_t value) +{ + real_t root = 0; + + step( 0); step( 2); step( 4); step( 6); + step( 8); step(10); step(12); step(14); + step(16); step(18); step(20); step(22); + step(24); step(26); step(28); step(30); + + if (root < value) + ++root; + + root <<= (REAL_BITS/2); + + return root; +} +#else +#define ps_sqrt(A) sqrt(A) +#endif + +static const real_t ipdopd_cos_tab[] = { + FRAC_CONST(1.000000000000000), + FRAC_CONST(0.707106781186548), + FRAC_CONST(0.000000000000000), + FRAC_CONST(-0.707106781186547), + FRAC_CONST(-1.000000000000000), + FRAC_CONST(-0.707106781186548), + FRAC_CONST(-0.000000000000000), + FRAC_CONST(0.707106781186547), + FRAC_CONST(1.000000000000000) +}; + +static const real_t ipdopd_sin_tab[] = { + FRAC_CONST(0.000000000000000), + FRAC_CONST(0.707106781186547), + FRAC_CONST(1.000000000000000), + FRAC_CONST(0.707106781186548), + FRAC_CONST(0.000000000000000), + FRAC_CONST(-0.707106781186547), + FRAC_CONST(-1.000000000000000), + FRAC_CONST(-0.707106781186548), + FRAC_CONST(-0.000000000000000) +}; + +static void ps_mix_phase(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64], + qmf_t X_hybrid_left[32][32], qmf_t X_hybrid_right[32][32]) +{ + uint8_t n; + uint8_t gr; + uint8_t bk = 0; + uint8_t sb, maxsb; + uint8_t env; + uint8_t nr_ipdopd_par; + complex_t h11, h12, h21, h22; + complex_t H11, H12, H21, H22; + complex_t deltaH11, deltaH12, deltaH21, deltaH22; + complex_t tempLeft; + complex_t tempRight; + complex_t phaseLeft; + complex_t phaseRight; + real_t L; + const real_t *sf_iid; + uint8_t no_iid_steps; + + if (ps->iid_mode >= 3) + { + no_iid_steps = 15; + sf_iid = sf_iid_fine; + } else { + no_iid_steps = 7; + sf_iid = sf_iid_normal; + } + + if (ps->ipd_mode == 0 || ps->ipd_mode == 3) + { + nr_ipdopd_par = 11; /* resolution */ + } else { + nr_ipdopd_par = ps->nr_ipdopd_par; + } + + for (gr = 0; gr < ps->num_groups; gr++) + { + bk = (~NEGATE_IPD_MASK) & ps->map_group2bk[gr]; + + /* use one channel per group in the subqmf domain */ + maxsb = (gr < ps->num_hybrid_groups) ? ps->group_border[gr] + 1 : ps->group_border[gr + 1]; + + for (env = 0; env < ps->num_env; env++) + { + if (ps->icc_mode < 3) + { + /* type 'A' mixing as described in 8.6.4.6.2.1 */ + real_t c_1, c_2; + real_t cosa, sina; + real_t cosb, sinb; + real_t ab1, ab2; + real_t ab3, ab4; + + /* + c_1 = sqrt(2.0 / (1.0 + pow(10.0, quant_iid[no_iid_steps + iid_index] / 10.0))); + c_2 = sqrt(2.0 / (1.0 + pow(10.0, quant_iid[no_iid_steps - iid_index] / 10.0))); + alpha = 0.5 * acos(quant_rho[icc_index]); + beta = alpha * ( c_1 - c_2 ) / sqrt(2.0); + */ + + //printf("%d\n", ps->iid_index[env][bk]); + + /* calculate the scalefactors c_1 and c_2 from the intensity differences */ + c_1 = sf_iid[no_iid_steps + ps->iid_index[env][bk]]; + c_2 = sf_iid[no_iid_steps - ps->iid_index[env][bk]]; + + /* calculate alpha and beta using the ICC parameters */ + cosa = cos_alphas[ps->icc_index[env][bk]]; + sina = sin_alphas[ps->icc_index[env][bk]]; + + if (ps->iid_mode >= 3) + { + if (ps->iid_index[env][bk] < 0) + { + cosb = cos_betas_fine[-ps->iid_index[env][bk]][ps->icc_index[env][bk]]; + sinb = -sin_betas_fine[-ps->iid_index[env][bk]][ps->icc_index[env][bk]]; + } else { + cosb = cos_betas_fine[ps->iid_index[env][bk]][ps->icc_index[env][bk]]; + sinb = sin_betas_fine[ps->iid_index[env][bk]][ps->icc_index[env][bk]]; + } + } else { + if (ps->iid_index[env][bk] < 0) + { + cosb = cos_betas_normal[-ps->iid_index[env][bk]][ps->icc_index[env][bk]]; + sinb = -sin_betas_normal[-ps->iid_index[env][bk]][ps->icc_index[env][bk]]; + } else { + cosb = cos_betas_normal[ps->iid_index[env][bk]][ps->icc_index[env][bk]]; + sinb = sin_betas_normal[ps->iid_index[env][bk]][ps->icc_index[env][bk]]; + } + } + + ab1 = MUL_C(cosb, cosa); + ab2 = MUL_C(sinb, sina); + ab3 = MUL_C(sinb, cosa); + ab4 = MUL_C(cosb, sina); + + /* h_xy: COEF */ + RE(h11) = MUL_C(c_2, (ab1 - ab2)); + RE(h12) = MUL_C(c_1, (ab1 + ab2)); + RE(h21) = MUL_C(c_2, (ab3 + ab4)); + RE(h22) = MUL_C(c_1, (ab3 - ab4)); + } else { + /* type 'B' mixing as described in 8.6.4.6.2.2 */ + real_t sina, cosa; + real_t cosg, sing; + + /* + real_t c, rho, mu, alpha, gamma; + uint8_t i; + + i = ps->iid_index[env][bk]; + c = (real_t)pow(10.0, ((i)?(((i>0)?1:-1)*quant_iid[((i>0)?i:-i)-1]):0.)/20.0); + rho = quant_rho[ps->icc_index[env][bk]]; + + if (rho == 0.0f && c == 1.) + { + alpha = (real_t)M_PI/4.0f; + rho = 0.05f; + } else { + if (rho <= 0.05f) + { + rho = 0.05f; + } + alpha = 0.5f*(real_t)atan( (2.0f*c*rho) / (c*c-1.0f) ); + + if (alpha < 0.) + { + alpha += (real_t)M_PI/2.0f; + } + if (rho < 0.) + { + alpha += (real_t)M_PI; + } + } + mu = c+1.0f/c; + mu = 1+(4.0f*rho*rho-4.0f)/(mu*mu); + gamma = (real_t)atan(sqrt((1.0f-sqrt(mu))/(1.0f+sqrt(mu)))); + */ + + if (ps->iid_mode >= 3) + { + uint8_t abs_iid = abs(ps->iid_index[env][bk]); + + cosa = sincos_alphas_B_fine[no_iid_steps + ps->iid_index[env][bk]][ps->icc_index[env][bk]]; + sina = sincos_alphas_B_fine[30 - (no_iid_steps + ps->iid_index[env][bk])][ps->icc_index[env][bk]]; + cosg = cos_gammas_fine[abs_iid][ps->icc_index[env][bk]]; + sing = sin_gammas_fine[abs_iid][ps->icc_index[env][bk]]; + } else { + uint8_t abs_iid = abs(ps->iid_index[env][bk]); + + cosa = sincos_alphas_B_normal[no_iid_steps + ps->iid_index[env][bk]][ps->icc_index[env][bk]]; + sina = sincos_alphas_B_normal[14 - (no_iid_steps + ps->iid_index[env][bk])][ps->icc_index[env][bk]]; + cosg = cos_gammas_normal[abs_iid][ps->icc_index[env][bk]]; + sing = sin_gammas_normal[abs_iid][ps->icc_index[env][bk]]; + } + + RE(h11) = MUL_C(COEF_SQRT2, MUL_C(cosa, cosg)); + RE(h12) = MUL_C(COEF_SQRT2, MUL_C(sina, cosg)); + RE(h21) = MUL_C(COEF_SQRT2, MUL_C(-cosa, sing)); + RE(h22) = MUL_C(COEF_SQRT2, MUL_C(sina, sing)); + } + + /* calculate phase rotation parameters H_xy */ + /* note that the imaginary part of these parameters are only calculated when + IPD and OPD are enabled + */ + if ((ps->enable_ipdopd) && (bk < nr_ipdopd_par)) + { + int8_t i; + real_t xxyy, ppqq; + real_t yq, xp, xq, py, tmp; + + /* ringbuffer index */ + i = ps->phase_hist; + + /* previous value */ +#ifdef FIXED_POINT + /* divide by 4, shift right 2 bits */ + RE(tempLeft) = RE(ps->ipd_prev[bk][i]) >> 2; + IM(tempLeft) = IM(ps->ipd_prev[bk][i]) >> 2; + RE(tempRight) = RE(ps->opd_prev[bk][i]) >> 2; + IM(tempRight) = IM(ps->opd_prev[bk][i]) >> 2; +#else + RE(tempLeft) = MUL_F(RE(ps->ipd_prev[bk][i]), FRAC_CONST(0.25)); + IM(tempLeft) = MUL_F(IM(ps->ipd_prev[bk][i]), FRAC_CONST(0.25)); + RE(tempRight) = MUL_F(RE(ps->opd_prev[bk][i]), FRAC_CONST(0.25)); + IM(tempRight) = MUL_F(IM(ps->opd_prev[bk][i]), FRAC_CONST(0.25)); +#endif + + /* save current value */ + RE(ps->ipd_prev[bk][i]) = ipdopd_cos_tab[abs(ps->ipd_index[env][bk])]; + IM(ps->ipd_prev[bk][i]) = ipdopd_sin_tab[abs(ps->ipd_index[env][bk])]; + RE(ps->opd_prev[bk][i]) = ipdopd_cos_tab[abs(ps->opd_index[env][bk])]; + IM(ps->opd_prev[bk][i]) = ipdopd_sin_tab[abs(ps->opd_index[env][bk])]; + + /* add current value */ + RE(tempLeft) += RE(ps->ipd_prev[bk][i]); + IM(tempLeft) += IM(ps->ipd_prev[bk][i]); + RE(tempRight) += RE(ps->opd_prev[bk][i]); + IM(tempRight) += IM(ps->opd_prev[bk][i]); + + /* ringbuffer index */ + if (i == 0) + { + i = 2; + } + i--; + + /* get value before previous */ +#ifdef FIXED_POINT + /* dividing by 2, shift right 1 bit */ + RE(tempLeft) += (RE(ps->ipd_prev[bk][i]) >> 1); + IM(tempLeft) += (IM(ps->ipd_prev[bk][i]) >> 1); + RE(tempRight) += (RE(ps->opd_prev[bk][i]) >> 1); + IM(tempRight) += (IM(ps->opd_prev[bk][i]) >> 1); +#else + RE(tempLeft) += MUL_F(RE(ps->ipd_prev[bk][i]), FRAC_CONST(0.5)); + IM(tempLeft) += MUL_F(IM(ps->ipd_prev[bk][i]), FRAC_CONST(0.5)); + RE(tempRight) += MUL_F(RE(ps->opd_prev[bk][i]), FRAC_CONST(0.5)); + IM(tempRight) += MUL_F(IM(ps->opd_prev[bk][i]), FRAC_CONST(0.5)); +#endif + +#if 0 /* original code */ + ipd = (float)atan2(IM(tempLeft), RE(tempLeft)); + opd = (float)atan2(IM(tempRight), RE(tempRight)); + + /* phase rotation */ + RE(phaseLeft) = (float)cos(opd); + IM(phaseLeft) = (float)sin(opd); + opd -= ipd; + RE(phaseRight) = (float)cos(opd); + IM(phaseRight) = (float)sin(opd); +#else + // x = IM(tempLeft) + // y = RE(tempLeft) + // p = IM(tempRight) + // q = RE(tempRight) + // cos(atan2(x,y)) = 1/sqrt(1 + (x*x)/(y*y)) + // sin(atan2(x,y)) = x/(y*sqrt(1 + (x*x)/(y*y))) + // cos(atan2(x,y)-atan2(p,q)) = (y*q+x*p)/(y*q * sqrt(1 + (x*x)/(y*y)) * sqrt(1 + (p*p)/(q*q))); + // sin(atan2(x,y)-atan2(p,q)) = (x*q-p*y)/(y*q * sqrt(1 + (x*x)/(y*y)) * sqrt(1 + (p*p)/(q*q))); + + /* (x*x)/(y*y) (REAL > 0) */ + xxyy = DIV_R(MUL_C(IM(tempLeft),IM(tempLeft)), MUL_C(RE(tempLeft),RE(tempLeft))); + ppqq = DIV_R(MUL_C(IM(tempRight),IM(tempRight)), MUL_C(RE(tempRight),RE(tempRight))); + + /* 1 + (x*x)/(y*y) (REAL > 1) */ + xxyy += REAL_CONST(1); + ppqq += REAL_CONST(1); + + /* 1 / sqrt(1 + (x*x)/(y*y)) (FRAC <= 1) */ + xxyy = DIV_R(FRAC_CONST(1), ps_sqrt(xxyy)); + ppqq = DIV_R(FRAC_CONST(1), ps_sqrt(ppqq)); + + /* COEF */ + yq = MUL_C(RE(tempLeft), RE(tempRight)); + xp = MUL_C(IM(tempLeft), IM(tempRight)); + xq = MUL_C(IM(tempLeft), RE(tempRight)); + py = MUL_C(RE(tempLeft), IM(tempRight)); + + RE(phaseLeft) = xxyy; + IM(phaseLeft) = MUL_R(xxyy, (DIV_R(IM(tempLeft), RE(tempLeft)))); + + tmp = DIV_C(MUL_F(xxyy, ppqq), yq); + + /* MUL_C(FRAC,COEF) = FRAC */ + RE(phaseRight) = MUL_C(tmp, (yq+xp)); + IM(phaseRight) = MUL_C(tmp, (xq-py)); +#endif + + /* MUL_F(COEF, FRAC) = COEF */ + IM(h11) = MUL_F(RE(h11), IM(phaseLeft)); + IM(h12) = MUL_F(RE(h12), IM(phaseRight)); + IM(h21) = MUL_F(RE(h21), IM(phaseLeft)); + IM(h22) = MUL_F(RE(h22), IM(phaseRight)); + + RE(h11) = MUL_F(RE(h11), RE(phaseLeft)); + RE(h12) = MUL_F(RE(h12), RE(phaseRight)); + RE(h21) = MUL_F(RE(h21), RE(phaseLeft)); + RE(h22) = MUL_F(RE(h22), RE(phaseRight)); + } + + /* length of the envelope n_e+1 - n_e (in time samples) */ + /* 0 < L <= 32: integer */ + L = (real_t)(ps->border_position[env + 1] - ps->border_position[env]); + + /* obtain final H_xy by means of linear interpolation */ + RE(deltaH11) = (RE(h11) - RE(ps->h11_prev[gr])) / L; + RE(deltaH12) = (RE(h12) - RE(ps->h12_prev[gr])) / L; + RE(deltaH21) = (RE(h21) - RE(ps->h21_prev[gr])) / L; + RE(deltaH22) = (RE(h22) - RE(ps->h22_prev[gr])) / L; + + RE(H11) = RE(ps->h11_prev[gr]); + RE(H12) = RE(ps->h12_prev[gr]); + RE(H21) = RE(ps->h21_prev[gr]); + RE(H22) = RE(ps->h22_prev[gr]); + + RE(ps->h11_prev[gr]) = RE(h11); + RE(ps->h12_prev[gr]) = RE(h12); + RE(ps->h21_prev[gr]) = RE(h21); + RE(ps->h22_prev[gr]) = RE(h22); + + /* only calculate imaginary part when needed */ + if ((ps->enable_ipdopd) && (bk < nr_ipdopd_par)) + { + /* obtain final H_xy by means of linear interpolation */ + IM(deltaH11) = (IM(h11) - IM(ps->h11_prev[gr])) / L; + IM(deltaH12) = (IM(h12) - IM(ps->h12_prev[gr])) / L; + IM(deltaH21) = (IM(h21) - IM(ps->h21_prev[gr])) / L; + IM(deltaH22) = (IM(h22) - IM(ps->h22_prev[gr])) / L; + + IM(H11) = IM(ps->h11_prev[gr]); + IM(H12) = IM(ps->h12_prev[gr]); + IM(H21) = IM(ps->h21_prev[gr]); + IM(H22) = IM(ps->h22_prev[gr]); + + if ((NEGATE_IPD_MASK & ps->map_group2bk[gr]) != 0) + { + IM(deltaH11) = -IM(deltaH11); + IM(deltaH12) = -IM(deltaH12); + IM(deltaH21) = -IM(deltaH21); + IM(deltaH22) = -IM(deltaH22); + + IM(H11) = -IM(H11); + IM(H12) = -IM(H12); + IM(H21) = -IM(H21); + IM(H22) = -IM(H22); + } + + IM(ps->h11_prev[gr]) = IM(h11); + IM(ps->h12_prev[gr]) = IM(h12); + IM(ps->h21_prev[gr]) = IM(h21); + IM(ps->h22_prev[gr]) = IM(h22); + } + + /* apply H_xy to the current envelope band of the decorrelated subband */ + for (n = ps->border_position[env]; n < ps->border_position[env + 1]; n++) + { + /* addition finalises the interpolation over every n */ + RE(H11) += RE(deltaH11); + RE(H12) += RE(deltaH12); + RE(H21) += RE(deltaH21); + RE(H22) += RE(deltaH22); + if ((ps->enable_ipdopd) && (bk < nr_ipdopd_par)) + { + IM(H11) += IM(deltaH11); + IM(H12) += IM(deltaH12); + IM(H21) += IM(deltaH21); + IM(H22) += IM(deltaH22); + } + + /* channel is an alias to the subband */ + for (sb = ps->group_border[gr]; sb < maxsb; sb++) + { + complex_t inLeft, inRight; + + /* load decorrelated samples */ + if (gr < ps->num_hybrid_groups) + { + RE(inLeft) = RE(X_hybrid_left[n][sb]); + IM(inLeft) = IM(X_hybrid_left[n][sb]); + RE(inRight) = RE(X_hybrid_right[n][sb]); + IM(inRight) = IM(X_hybrid_right[n][sb]); + } else { + RE(inLeft) = RE(X_left[n][sb]); + IM(inLeft) = IM(X_left[n][sb]); + RE(inRight) = RE(X_right[n][sb]); + IM(inRight) = IM(X_right[n][sb]); + } + + /* apply mixing */ + RE(tempLeft) = MUL_C(RE(H11), RE(inLeft)) + MUL_C(RE(H21), RE(inRight)); + IM(tempLeft) = MUL_C(RE(H11), IM(inLeft)) + MUL_C(RE(H21), IM(inRight)); + RE(tempRight) = MUL_C(RE(H12), RE(inLeft)) + MUL_C(RE(H22), RE(inRight)); + IM(tempRight) = MUL_C(RE(H12), IM(inLeft)) + MUL_C(RE(H22), IM(inRight)); + + /* only perform imaginary operations when needed */ + if ((ps->enable_ipdopd) && (bk < nr_ipdopd_par)) + { + /* apply rotation */ + RE(tempLeft) -= MUL_C(IM(H11), IM(inLeft)) + MUL_C(IM(H21), IM(inRight)); + IM(tempLeft) += MUL_C(IM(H11), RE(inLeft)) + MUL_C(IM(H21), RE(inRight)); + RE(tempRight) -= MUL_C(IM(H12), IM(inLeft)) + MUL_C(IM(H22), IM(inRight)); + IM(tempRight) += MUL_C(IM(H12), RE(inLeft)) + MUL_C(IM(H22), RE(inRight)); + } + + /* store final samples */ + if (gr < ps->num_hybrid_groups) + { + RE(X_hybrid_left[n][sb]) = RE(tempLeft); + IM(X_hybrid_left[n][sb]) = IM(tempLeft); + RE(X_hybrid_right[n][sb]) = RE(tempRight); + IM(X_hybrid_right[n][sb]) = IM(tempRight); + } else { + RE(X_left[n][sb]) = RE(tempLeft); + IM(X_left[n][sb]) = IM(tempLeft); + RE(X_right[n][sb]) = RE(tempRight); + IM(X_right[n][sb]) = IM(tempRight); + } + } + } + + /* shift phase smoother's circular buffer index */ + ps->phase_hist++; + if (ps->phase_hist == 2) + { + ps->phase_hist = 0; + } + } + } +} + +void ps_free(ps_info *ps) +{ + /* free hybrid filterbank structures */ + hybrid_free(ps->hyb); + + faad_free(ps); +} + +ps_info *ps_init(uint8_t sr_index) +{ + uint8_t i; + uint8_t short_delay_band; + + ps_info *ps = (ps_info*)faad_malloc(sizeof(ps_info)); + memset(ps, 0, sizeof(ps_info)); + + ps->hyb = hybrid_init(); + + ps->ps_data_available = 0; + + /* delay stuff*/ + ps->saved_delay = 0; + + for (i = 0; i < 64; i++) + { + ps->delay_buf_index_delay[i] = 0; + } + + for (i = 0; i < NO_ALLPASS_LINKS; i++) + { + ps->delay_buf_index_ser[i] = 0; +#ifdef PARAM_32KHZ + if (sr_index <= 5) /* >= 32 kHz*/ + { + ps->num_sample_delay_ser[i] = delay_length_d[1][i]; + } else { + ps->num_sample_delay_ser[i] = delay_length_d[0][i]; + } +#else + /* THESE ARE CONSTANTS NOW */ + ps->num_sample_delay_ser[i] = delay_length_d[i]; +#endif + } + +#ifdef PARAM_32KHZ + if (sr_index <= 5) /* >= 32 kHz*/ + { + short_delay_band = 35; + ps->nr_allpass_bands = 22; + ps->alpha_decay = FRAC_CONST(0.76592833836465); + ps->alpha_smooth = FRAC_CONST(0.25); + } else { + short_delay_band = 64; + ps->nr_allpass_bands = 45; + ps->alpha_decay = FRAC_CONST(0.58664621951003); + ps->alpha_smooth = FRAC_CONST(0.6); + } +#else + /* THESE ARE CONSTANTS NOW */ + short_delay_band = 35; + ps->nr_allpass_bands = 22; + ps->alpha_decay = FRAC_CONST(0.76592833836465); + ps->alpha_smooth = FRAC_CONST(0.25); +#endif + + /* THESE ARE CONSTANT NOW IF PS IS INDEPENDANT OF SAMPLERATE */ + for (i = 0; i < short_delay_band; i++) + { + ps->delay_D[i] = 14; + } + for (i = short_delay_band; i < 64; i++) + { + ps->delay_D[i] = 1; + } + + /* mixing and phase */ + for (i = 0; i < 50; i++) + { + RE(ps->h11_prev[i]) = 1; + IM(ps->h12_prev[i]) = 1; + RE(ps->h11_prev[i]) = 1; + IM(ps->h12_prev[i]) = 1; + } + + ps->phase_hist = 0; + + for (i = 0; i < 20; i++) + { + RE(ps->ipd_prev[i][0]) = 0; + IM(ps->ipd_prev[i][0]) = 0; + RE(ps->ipd_prev[i][1]) = 0; + IM(ps->ipd_prev[i][1]) = 0; + RE(ps->opd_prev[i][0]) = 0; + IM(ps->opd_prev[i][0]) = 0; + RE(ps->opd_prev[i][1]) = 0; + IM(ps->opd_prev[i][1]) = 0; + } + + return ps; +} + +/* main Parametric Stereo decoding function */ +uint8_t ps_decode(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64]) +{ + qmf_t X_hybrid_left[32][32] = {{0}}; + qmf_t X_hybrid_right[32][32] = {{0}}; + + /* delta decoding of the bitstream data */ + ps_data_decode(ps); + + /* set up some parameters depending on filterbank type */ + if (ps->use34hybrid_bands) + { + ps->group_border = (uint8_t*)group_border34; + ps->map_group2bk = (uint16_t*)map_group2bk34; + ps->num_groups = 32+18; + ps->num_hybrid_groups = 32; + ps->nr_par_bands = 34; + ps->decay_cutoff = 5; + } else { + ps->group_border = (uint8_t*)group_border20; + ps->map_group2bk = (uint16_t*)map_group2bk20; + ps->num_groups = 10+12; + ps->num_hybrid_groups = 10; + ps->nr_par_bands = 20; + ps->decay_cutoff = 3; + } + + /* Perform further analysis on the lowest subbands to get a higher + * frequency resolution + */ + hybrid_analysis((hyb_info*)ps->hyb, X_left, X_hybrid_left, + ps->use34hybrid_bands); + + /* decorrelate mono signal */ + ps_decorrelate(ps, X_left, X_right, X_hybrid_left, X_hybrid_right); + + /* apply mixing and phase parameters */ + ps_mix_phase(ps, X_left, X_right, X_hybrid_left, X_hybrid_right); + + /* hybrid synthesis, to rebuild the SBR QMF matrices */ + hybrid_synthesis((hyb_info*)ps->hyb, X_left, X_hybrid_left, + ps->use34hybrid_bands); + + hybrid_synthesis((hyb_info*)ps->hyb, X_right, X_hybrid_right, + ps->use34hybrid_bands); + + return 0; +} + +#endif + diff --git a/Libraries/FAAD2/Files/libfaad/ps_dec.h b/Libraries/FAAD2/Files/libfaad/ps_dec.h new file mode 100644 index 000000000..fca1f775e --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/ps_dec.h @@ -0,0 +1,148 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#ifndef __PS_DEC_H__ +#define __PS_DEC_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "bits.h" + +#define EXTENSION_ID_PS 2 + +#define MAX_PS_ENVELOPES 5 +#define NO_ALLPASS_LINKS 3 + +typedef struct +{ + /* bitstream parameters */ + uint8_t enable_iid; + uint8_t enable_icc; + uint8_t enable_ext; + + uint8_t iid_mode; + uint8_t icc_mode; + uint8_t nr_iid_par; + uint8_t nr_ipdopd_par; + uint8_t nr_icc_par; + + uint8_t frame_class; + uint8_t num_env; + + uint8_t border_position[MAX_PS_ENVELOPES+1]; + + uint8_t iid_dt[MAX_PS_ENVELOPES]; + uint8_t icc_dt[MAX_PS_ENVELOPES]; + + uint8_t enable_ipdopd; + uint8_t ipd_mode; + uint8_t ipd_dt[MAX_PS_ENVELOPES]; + uint8_t opd_dt[MAX_PS_ENVELOPES]; + + /* indices */ + int8_t iid_index_prev[34]; + int8_t icc_index_prev[34]; + int8_t ipd_index_prev[17]; + int8_t opd_index_prev[17]; + int8_t iid_index[MAX_PS_ENVELOPES][34]; + int8_t icc_index[MAX_PS_ENVELOPES][34]; + int8_t ipd_index[MAX_PS_ENVELOPES][17]; + int8_t opd_index[MAX_PS_ENVELOPES][17]; + + int8_t ipd_index_1[17]; + int8_t opd_index_1[17]; + int8_t ipd_index_2[17]; + int8_t opd_index_2[17]; + + /* ps data was correctly read */ + uint8_t ps_data_available; + + /* a header has been read */ + uint8_t header_read; + + /* hybrid filterbank parameters */ + void *hyb; + uint8_t use34hybrid_bands; + + /**/ + uint8_t num_groups; + uint8_t num_hybrid_groups; + uint8_t nr_par_bands; + uint8_t nr_allpass_bands; + uint8_t decay_cutoff; + + uint8_t *group_border; + uint16_t *map_group2bk; + + /* filter delay handling */ + uint8_t saved_delay; + uint8_t delay_buf_index_ser[NO_ALLPASS_LINKS]; + uint8_t num_sample_delay_ser[NO_ALLPASS_LINKS]; + uint8_t delay_D[64]; + uint8_t delay_buf_index_delay[64]; + + complex_t delay_Qmf[14][64]; /* 14 samples delay max, 64 QMF channels */ + complex_t delay_SubQmf[2][32]; /* 2 samples delay max (SubQmf is always allpass filtered) */ + complex_t delay_Qmf_ser[NO_ALLPASS_LINKS][5][64]; /* 5 samples delay max (table 8.34), 64 QMF channels */ + complex_t delay_SubQmf_ser[NO_ALLPASS_LINKS][5][32]; /* 5 samples delay max (table 8.34) */ + + /* transients */ + real_t alpha_decay; + real_t alpha_smooth; + + real_t P_PeakDecayNrg[34]; + real_t P_prev[34]; + real_t P_SmoothPeakDecayDiffNrg_prev[34]; + + /* mixing and phase */ + complex_t h11_prev[50]; + complex_t h12_prev[50]; + complex_t h21_prev[50]; + complex_t h22_prev[50]; + uint8_t phase_hist; + complex_t ipd_prev[20][2]; + complex_t opd_prev[20][2]; + +} ps_info; + +/* ps_syntax.c */ +uint16_t ps_data(ps_info *ps, bitfile *ld, uint8_t *header); + +/* ps_dec.c */ +ps_info *ps_init(uint8_t sr_index); +void ps_free(ps_info *ps); + +uint8_t ps_decode(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64]); + + +#ifdef __cplusplus +} +#endif +#endif + diff --git a/Libraries/FAAD2/Files/libfaad/ps_syntax.c b/Libraries/FAAD2/Files/libfaad/ps_syntax.c new file mode 100644 index 000000000..6c909c01f --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/ps_syntax.c @@ -0,0 +1,545 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR and PS decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#include "common.h" + +#ifdef PS_DEC + +#include "bits.h" +#include "ps_dec.h" + +/* type definitaions */ +typedef const int8_t (*ps_huff_tab)[2]; + +/* static data tables */ +static const uint8_t nr_iid_par_tab[] = { + 10, 20, 34, 10, 20, 34, 0, 0 +}; +static const uint8_t nr_ipdopd_par_tab[] = { + 5, 11, 17, 5, 11, 17, 0, 0 +}; +static const uint8_t nr_icc_par_tab[] = { + 10, 20, 34, 10, 20, 34, 0, 0 +}; +static const uint8_t num_env_tab[][4] = { + { 0, 1, 2, 4 }, + { 1, 2, 3, 4 } +}; + +/* binary lookup huffman tables */ +static const int8_t f_huff_iid_def[][2] = { + { /*0*/ -31, 1 }, /* index 0: 1 bits: x */ + { 2, 3 }, /* index 1: 2 bits: 1x */ + { /*1*/ -30, /*-1*/ -32 }, /* index 2: 3 bits: 10x */ + { 4, 5 }, /* index 3: 3 bits: 11x */ + { /*2*/ -29, /*-2*/ -33 }, /* index 4: 4 bits: 110x */ + { 6, 7 }, /* index 5: 4 bits: 111x */ + { /*3*/ -28, /*-3*/ -34 }, /* index 6: 5 bits: 1110x */ + { 8, 9 }, /* index 7: 5 bits: 1111x */ + { /*-4*/ -35, /*4*/ -27 }, /* index 8: 6 bits: 11110x */ + { /*5*/ -26, 10 }, /* index 9: 6 bits: 11111x */ + { /*-5*/ -36, 11 }, /* index 10: 7 bits: 111111x */ + { /*6*/ -25, 12 }, /* index 11: 8 bits: 1111111x */ + { /*-6*/ -37, 13 }, /* index 12: 9 bits: 11111111x */ + { /*-7*/ -38, 14 }, /* index 13: 10 bits: 111111111x */ + { /*7*/ -24, 15 }, /* index 14: 11 bits: 1111111111x */ + { 16, 17 }, /* index 15: 12 bits: 11111111111x */ + { /*8*/ -23, /*-8*/ -39 }, /* index 16: 13 bits: 111111111110x */ + { 18, 19 }, /* index 17: 13 bits: 111111111111x */ + { /*9*/ -22, /*10*/ -21 }, /* index 18: 14 bits: 1111111111110x */ + { 20, 21 }, /* index 19: 14 bits: 1111111111111x */ + { /*-9*/ -40, /*11*/ -20 }, /* index 20: 15 bits: 11111111111110x */ + { 22, 23 }, /* index 21: 15 bits: 11111111111111x */ + { /*-10*/ -41, 24 }, /* index 22: 16 bits: 111111111111110x */ + { 25, 26 }, /* index 23: 16 bits: 111111111111111x */ + { /*-11*/ -42, /*-14*/ -45 }, /* index 24: 17 bits: 1111111111111101x */ + { /*-13*/ -44, /*-12*/ -43 }, /* index 25: 17 bits: 1111111111111110x */ + { /*12*/ -19, 27 }, /* index 26: 17 bits: 1111111111111111x */ + { /*13*/ -18, /*14*/ -17 } /* index 27: 18 bits: 11111111111111111x */ +}; + +static const int8_t t_huff_iid_def[][2] = { + { /*0*/ -31, 1 }, /* index 0: 1 bits: x */ + { /*-1*/ -32, 2 }, /* index 1: 2 bits: 1x */ + { /*1*/ -30, 3 }, /* index 2: 3 bits: 11x */ + { /*-2*/ -33, 4 }, /* index 3: 4 bits: 111x */ + { /*2*/ -29, 5 }, /* index 4: 5 bits: 1111x */ + { /*-3*/ -34, 6 }, /* index 5: 6 bits: 11111x */ + { /*3*/ -28, 7 }, /* index 6: 7 bits: 111111x */ + { /*-4*/ -35, 8 }, /* index 7: 8 bits: 1111111x */ + { /*4*/ -27, 9 }, /* index 8: 9 bits: 11111111x */ + { /*-5*/ -36, 10 }, /* index 9: 10 bits: 111111111x */ + { /*5*/ -26, 11 }, /* index 10: 11 bits: 1111111111x */ + { /*-6*/ -37, 12 }, /* index 11: 12 bits: 11111111111x */ + { /*6*/ -25, 13 }, /* index 12: 13 bits: 111111111111x */ + { /*7*/ -24, 14 }, /* index 13: 14 bits: 1111111111111x */ + { /*-7*/ -38, 15 }, /* index 14: 15 bits: 11111111111111x */ + { 16, 17 }, /* index 15: 16 bits: 111111111111111x */ + { /*8*/ -23, /*-8*/ -39 }, /* index 16: 17 bits: 1111111111111110x */ + { 18, 19 }, /* index 17: 17 bits: 1111111111111111x */ + { 20, 21 }, /* index 18: 18 bits: 11111111111111110x */ + { 22, 23 }, /* index 19: 18 bits: 11111111111111111x */ + { /*9*/ -22, /*-14*/ -45 }, /* index 20: 19 bits: 111111111111111100x */ + { /*-13*/ -44, /*-12*/ -43 }, /* index 21: 19 bits: 111111111111111101x */ + { 24, 25 }, /* index 22: 19 bits: 111111111111111110x */ + { 26, 27 }, /* index 23: 19 bits: 111111111111111111x */ + { /*-11*/ -42, /*-10*/ -41 }, /* index 24: 20 bits: 1111111111111111100x */ + { /*-9*/ -40, /*10*/ -21 }, /* index 25: 20 bits: 1111111111111111101x */ + { /*11*/ -20, /*12*/ -19 }, /* index 26: 20 bits: 1111111111111111110x */ + { /*13*/ -18, /*14*/ -17 } /* index 27: 20 bits: 1111111111111111111x */ +}; + +static const int8_t f_huff_iid_fine[][2] = { + { 1, /*0*/ -31 }, /* index 0: 1 bits: x */ + { 2, 3 }, /* index 1: 2 bits: 0x */ + { 4, /*-1*/ -32 }, /* index 2: 3 bits: 00x */ + { /*1*/ -30, 5 }, /* index 3: 3 bits: 01x */ + { /*-2*/ -33, /*2*/ -29 }, /* index 4: 4 bits: 000x */ + { 6, 7 }, /* index 5: 4 bits: 011x */ + { /*-3*/ -34, /*3*/ -28 }, /* index 6: 5 bits: 0110x */ + { 8, 9 }, /* index 7: 5 bits: 0111x */ + { /*-4*/ -35, /*4*/ -27 }, /* index 8: 6 bits: 01110x */ + { 10, 11 }, /* index 9: 6 bits: 01111x */ + { /*-5*/ -36, /*5*/ -26 }, /* index 10: 7 bits: 011110x */ + { 12, 13 }, /* index 11: 7 bits: 011111x */ + { /*-6*/ -37, /*6*/ -25 }, /* index 12: 8 bits: 0111110x */ + { 14, 15 }, /* index 13: 8 bits: 0111111x */ + { /*7*/ -24, 16 }, /* index 14: 9 bits: 01111110x */ + { 17, 18 }, /* index 15: 9 bits: 01111111x */ + { 19, /*-8*/ -39 }, /* index 16: 10 bits: 011111101x */ + { /*8*/ -23, 20 }, /* index 17: 10 bits: 011111110x */ + { 21, /*-7*/ -38 }, /* index 18: 10 bits: 011111111x */ + { /*10*/ -21, 22 }, /* index 19: 11 bits: 0111111010x */ + { 23, /*-9*/ -40 }, /* index 20: 11 bits: 0111111101x */ + { /*9*/ -22, 24 }, /* index 21: 11 bits: 0111111110x */ + { /*-11*/ -42, /*11*/ -20 }, /* index 22: 12 bits: 01111110101x */ + { 25, 26 }, /* index 23: 12 bits: 01111111010x */ + { 27, /*-10*/ -41 }, /* index 24: 12 bits: 01111111101x */ + { 28, /*-12*/ -43 }, /* index 25: 13 bits: 011111110100x */ + { /*12*/ -19, 29 }, /* index 26: 13 bits: 011111110101x */ + { 30, 31 }, /* index 27: 13 bits: 011111111010x */ + { 32, /*-14*/ -45 }, /* index 28: 14 bits: 0111111101000x */ + { /*14*/ -17, 33 }, /* index 29: 14 bits: 0111111101011x */ + { 34, /*-13*/ -44 }, /* index 30: 14 bits: 0111111110100x */ + { /*13*/ -18, 35 }, /* index 31: 14 bits: 0111111110101x */ + { 36, 37 }, /* index 32: 15 bits: 01111111010000x */ + { 38, /*-15*/ -46 }, /* index 33: 15 bits: 01111111010111x */ + { /*15*/ -16, 39 }, /* index 34: 15 bits: 01111111101000x */ + { 40, 41 }, /* index 35: 15 bits: 01111111101011x */ + { 42, 43 }, /* index 36: 16 bits: 011111110100000x */ + { /*-17*/ -48, /*17*/ -14 }, /* index 37: 16 bits: 011111110100001x */ + { 44, 45 }, /* index 38: 16 bits: 011111110101110x */ + { 46, 47 }, /* index 39: 16 bits: 011111111010001x */ + { 48, 49 }, /* index 40: 16 bits: 011111111010110x */ + { /*-16*/ -47, /*16*/ -15 }, /* index 41: 16 bits: 011111111010111x */ + { /*-21*/ -52, /*21*/ -10 }, /* index 42: 17 bits: 0111111101000000x */ + { /*-19*/ -50, /*19*/ -12 }, /* index 43: 17 bits: 0111111101000001x */ + { /*-18*/ -49, /*18*/ -13 }, /* index 44: 17 bits: 0111111101011100x */ + { 50, 51 }, /* index 45: 17 bits: 0111111101011101x */ + { 52, 53 }, /* index 46: 17 bits: 0111111110100010x */ + { 54, 55 }, /* index 47: 17 bits: 0111111110100011x */ + { 56, 57 }, /* index 48: 17 bits: 0111111110101100x */ + { 58, 59 }, /* index 49: 17 bits: 0111111110101101x */ + { /*-26*/ -57, /*-25*/ -56 }, /* index 50: 18 bits: 01111111010111010x */ + { /*-28*/ -59, /*-27*/ -58 }, /* index 51: 18 bits: 01111111010111011x */ + { /*-22*/ -53, /*22*/ -9 }, /* index 52: 18 bits: 01111111101000100x */ + { /*-24*/ -55, /*-23*/ -54 }, /* index 53: 18 bits: 01111111101000101x */ + { /*25*/ -6, /*26*/ -5 }, /* index 54: 18 bits: 01111111101000110x */ + { /*23*/ -8, /*24*/ -7 }, /* index 55: 18 bits: 01111111101000111x */ + { /*29*/ -2, /*30*/ -1 }, /* index 56: 18 bits: 01111111101011000x */ + { /*27*/ -4, /*28*/ -3 }, /* index 57: 18 bits: 01111111101011001x */ + { /*-30*/ -61, /*-29*/ -60 }, /* index 58: 18 bits: 01111111101011010x */ + { /*-20*/ -51, /*20*/ -11 } /* index 59: 18 bits: 01111111101011011x */ +}; + +static const int8_t t_huff_iid_fine[][2] = { + { 1, /*0*/ -31 }, /* index 0: 1 bits: x */ + { /*1*/ -30, 2 }, /* index 1: 2 bits: 0x */ + { 3, /*-1*/ -32 }, /* index 2: 3 bits: 01x */ + { 4, 5 }, /* index 3: 4 bits: 010x */ + { 6, 7 }, /* index 4: 5 bits: 0100x */ + { /*-2*/ -33, /*2*/ -29 }, /* index 5: 5 bits: 0101x */ + { 8, /*-3*/ -34 }, /* index 6: 6 bits: 01000x */ + { /*3*/ -28, 9 }, /* index 7: 6 bits: 01001x */ + { /*-4*/ -35, /*4*/ -27 }, /* index 8: 7 bits: 010000x */ + { 10, 11 }, /* index 9: 7 bits: 010011x */ + { /*5*/ -26, 12 }, /* index 10: 8 bits: 0100110x */ + { 13, 14 }, /* index 11: 8 bits: 0100111x */ + { /*-6*/ -37, /*6*/ -25 }, /* index 12: 9 bits: 01001101x */ + { 15, 16 }, /* index 13: 9 bits: 01001110x */ + { 17, /*-5*/ -36 }, /* index 14: 9 bits: 01001111x */ + { 18, /*-7*/ -38 }, /* index 15: 10 bits: 010011100x */ + { /*7*/ -24, 19 }, /* index 16: 10 bits: 010011101x */ + { 20, 21 }, /* index 17: 10 bits: 010011110x */ + { /*9*/ -22, 22 }, /* index 18: 11 bits: 0100111000x */ + { 23, 24 }, /* index 19: 11 bits: 0100111011x */ + { /*-8*/ -39, /*8*/ -23 }, /* index 20: 11 bits: 0100111100x */ + { 25, 26 }, /* index 21: 11 bits: 0100111101x */ + { /*11*/ -20, 27 }, /* index 22: 12 bits: 01001110001x */ + { 28, 29 }, /* index 23: 12 bits: 01001110110x */ + { /*-10*/ -41, /*10*/ -21 }, /* index 24: 12 bits: 01001110111x */ + { 30, 31 }, /* index 25: 12 bits: 01001111010x */ + { 32, /*-9*/ -40 }, /* index 26: 12 bits: 01001111011x */ + { 33, /*-13*/ -44 }, /* index 27: 13 bits: 010011100011x */ + { /*13*/ -18, 34 }, /* index 28: 13 bits: 010011101100x */ + { 35, 36 }, /* index 29: 13 bits: 010011101101x */ + { 37, /*-12*/ -43 }, /* index 30: 13 bits: 010011110100x */ + { /*12*/ -19, 38 }, /* index 31: 13 bits: 010011110101x */ + { 39, /*-11*/ -42 }, /* index 32: 13 bits: 010011110110x */ + { 40, 41 }, /* index 33: 14 bits: 0100111000110x */ + { 42, 43 }, /* index 34: 14 bits: 0100111011001x */ + { 44, 45 }, /* index 35: 14 bits: 0100111011010x */ + { 46, /*-15*/ -46 }, /* index 36: 14 bits: 0100111011011x */ + { /*15*/ -16, 47 }, /* index 37: 14 bits: 0100111101000x */ + { /*-14*/ -45, /*14*/ -17 }, /* index 38: 14 bits: 0100111101011x */ + { 48, 49 }, /* index 39: 14 bits: 0100111101100x */ + { /*-21*/ -52, /*-20*/ -51 }, /* index 40: 15 bits: 01001110001100x */ + { /*18*/ -13, /*19*/ -12 }, /* index 41: 15 bits: 01001110001101x */ + { /*-19*/ -50, /*-18*/ -49 }, /* index 42: 15 bits: 01001110110010x */ + { 50, 51 }, /* index 43: 15 bits: 01001110110011x */ + { 52, 53 }, /* index 44: 15 bits: 01001110110100x */ + { 54, 55 }, /* index 45: 15 bits: 01001110110101x */ + { 56, /*-17*/ -48 }, /* index 46: 15 bits: 01001110110110x */ + { /*17*/ -14, 57 }, /* index 47: 15 bits: 01001111010001x */ + { 58, /*-16*/ -47 }, /* index 48: 15 bits: 01001111011000x */ + { /*16*/ -15, 59 }, /* index 49: 15 bits: 01001111011001x */ + { /*-26*/ -57, /*26*/ -5 }, /* index 50: 16 bits: 010011101100110x */ + { /*-28*/ -59, /*-27*/ -58 }, /* index 51: 16 bits: 010011101100111x */ + { /*29*/ -2, /*30*/ -1 }, /* index 52: 16 bits: 010011101101000x */ + { /*27*/ -4, /*28*/ -3 }, /* index 53: 16 bits: 010011101101001x */ + { /*-30*/ -61, /*-29*/ -60 }, /* index 54: 16 bits: 010011101101010x */ + { /*-25*/ -56, /*25*/ -6 }, /* index 55: 16 bits: 010011101101011x */ + { /*-24*/ -55, /*24*/ -7 }, /* index 56: 16 bits: 010011101101100x */ + { /*-23*/ -54, /*23*/ -8 }, /* index 57: 16 bits: 010011110100011x */ + { /*-22*/ -53, /*22*/ -9 }, /* index 58: 16 bits: 010011110110000x */ + { /*20*/ -11, /*21*/ -10 } /* index 59: 16 bits: 010011110110011x */ +}; + +static const int8_t f_huff_icc[][2] = { + { /*0*/ -31, 1 }, /* index 0: 1 bits: x */ + { /*1*/ -30, 2 }, /* index 1: 2 bits: 1x */ + { /*-1*/ -32, 3 }, /* index 2: 3 bits: 11x */ + { /*2*/ -29, 4 }, /* index 3: 4 bits: 111x */ + { /*-2*/ -33, 5 }, /* index 4: 5 bits: 1111x */ + { /*3*/ -28, 6 }, /* index 5: 6 bits: 11111x */ + { /*-3*/ -34, 7 }, /* index 6: 7 bits: 111111x */ + { /*4*/ -27, 8 }, /* index 7: 8 bits: 1111111x */ + { /*5*/ -26, 9 }, /* index 8: 9 bits: 11111111x */ + { /*-4*/ -35, 10 }, /* index 9: 10 bits: 111111111x */ + { /*6*/ -25, 11 }, /* index 10: 11 bits: 1111111111x */ + { /*-5*/ -36, 12 }, /* index 11: 12 bits: 11111111111x */ + { /*7*/ -24, 13 }, /* index 12: 13 bits: 111111111111x */ + { /*-6*/ -37, /*-7*/ -38 } /* index 13: 14 bits: 1111111111111x */ +}; + +static const int8_t t_huff_icc[][2] = { + { /*0*/ -31, 1 }, /* index 0: 1 bits: x */ + { /*1*/ -30, 2 }, /* index 1: 2 bits: 1x */ + { /*-1*/ -32, 3 }, /* index 2: 3 bits: 11x */ + { /*2*/ -29, 4 }, /* index 3: 4 bits: 111x */ + { /*-2*/ -33, 5 }, /* index 4: 5 bits: 1111x */ + { /*3*/ -28, 6 }, /* index 5: 6 bits: 11111x */ + { /*-3*/ -34, 7 }, /* index 6: 7 bits: 111111x */ + { /*4*/ -27, 8 }, /* index 7: 8 bits: 1111111x */ + { /*-4*/ -35, 9 }, /* index 8: 9 bits: 11111111x */ + { /*5*/ -26, 10 }, /* index 9: 10 bits: 111111111x */ + { /*-5*/ -36, 11 }, /* index 10: 11 bits: 1111111111x */ + { /*6*/ -25, 12 }, /* index 11: 12 bits: 11111111111x */ + { /*-6*/ -37, 13 }, /* index 12: 13 bits: 111111111111x */ + { /*-7*/ -38, /*7*/ -24 } /* index 13: 14 bits: 1111111111111x */ +}; + +static const int8_t f_huff_ipd[][2] = { + { 1, /*0*/ -31 }, /* index 0: 1 bits: x */ + { 2, 3 }, /* index 1: 2 bits: 0x */ + { /*1*/ -30, 4 }, /* index 2: 3 bits: 00x */ + { 5, 6 }, /* index 3: 3 bits: 01x */ + { /*4*/ -27, /*5*/ -26 }, /* index 4: 4 bits: 001x */ + { /*3*/ -28, /*6*/ -25 }, /* index 5: 4 bits: 010x */ + { /*2*/ -29, /*7*/ -24 } /* index 6: 4 bits: 011x */ +}; + +static const int8_t t_huff_ipd[][2] = { + { 1, /*0*/ -31 }, /* index 0: 1 bits: x */ + { 2, 3 }, /* index 1: 2 bits: 0x */ + { 4, 5 }, /* index 2: 3 bits: 00x */ + { /*1*/ -30, /*7*/ -24 }, /* index 3: 3 bits: 01x */ + { /*5*/ -26, 6 }, /* index 4: 4 bits: 000x */ + { /*2*/ -29, /*6*/ -25 }, /* index 5: 4 bits: 001x */ + { /*4*/ -27, /*3*/ -28 } /* index 6: 5 bits: 0001x */ +}; + +static const int8_t f_huff_opd[][2] = { + { 1, /*0*/ -31 }, /* index 0: 1 bits: x */ + { 2, 3 }, /* index 1: 2 bits: 0x */ + { /*7*/ -24, /*1*/ -30 }, /* index 2: 3 bits: 00x */ + { 4, 5 }, /* index 3: 3 bits: 01x */ + { /*3*/ -28, /*6*/ -25 }, /* index 4: 4 bits: 010x */ + { /*2*/ -29, 6 }, /* index 5: 4 bits: 011x */ + { /*5*/ -26, /*4*/ -27 } /* index 6: 5 bits: 0111x */ +}; + +static const int8_t t_huff_opd[][2] = { + { 1, /*0*/ -31 }, /* index 0: 1 bits: x */ + { 2, 3 }, /* index 1: 2 bits: 0x */ + { 4, 5 }, /* index 2: 3 bits: 00x */ + { /*1*/ -30, /*7*/ -24 }, /* index 3: 3 bits: 01x */ + { /*5*/ -26, 6 }, /* index 4: 4 bits: 000x */ + { /*2*/ -29, /*6*/ -25 }, /* index 5: 4 bits: 001x */ + { /*4*/ -27, /*3*/ -28 } /* index 6: 5 bits: 0001x */ +}; + +/* static function declarations */ +static uint16_t ps_extension(ps_info *ps, bitfile *ld, + const uint8_t ps_extension_id, + const uint16_t num_bits_left); +static void huff_data(bitfile *ld, const uint8_t dt, const uint8_t nr_par, + ps_huff_tab t_huff, ps_huff_tab f_huff, int8_t *par); +static INLINE int8_t ps_huff_dec(bitfile *ld, ps_huff_tab t_huff); + + +uint16_t ps_data(ps_info *ps, bitfile *ld, uint8_t *header) +{ + uint8_t tmp, n; + uint16_t bits = (uint16_t)faad_get_processed_bits(ld); + + *header = 0; + + /* check for new PS header */ + if (faad_get1bit(ld + DEBUGVAR(1,1000,"ps_data(): enable_ps_header"))) + { + *header = 1; + + ps->header_read = 1; + + ps->use34hybrid_bands = 0; + + /* Inter-channel Intensity Difference (IID) parameters enabled */ + ps->enable_iid = (uint8_t)faad_get1bit(ld + DEBUGVAR(1,1001,"ps_data(): enable_iid")); + + if (ps->enable_iid) + { + ps->iid_mode = (uint8_t)faad_getbits(ld, 3 + DEBUGVAR(1,1002,"ps_data(): iid_mode")); + + ps->nr_iid_par = nr_iid_par_tab[ps->iid_mode]; + ps->nr_ipdopd_par = nr_ipdopd_par_tab[ps->iid_mode]; + + if (ps->iid_mode == 2 || ps->iid_mode == 5) + ps->use34hybrid_bands = 1; + + /* IPD freq res equal to IID freq res */ + ps->ipd_mode = ps->iid_mode; + } + + /* Inter-channel Coherence (ICC) parameters enabled */ + ps->enable_icc = (uint8_t)faad_get1bit(ld + DEBUGVAR(1,1003,"ps_data(): enable_icc")); + + if (ps->enable_icc) + { + ps->icc_mode = (uint8_t)faad_getbits(ld, 3 + DEBUGVAR(1,1004,"ps_data(): icc_mode")); + + ps->nr_icc_par = nr_icc_par_tab[ps->icc_mode]; + + if (ps->icc_mode == 2 || ps->icc_mode == 5) + ps->use34hybrid_bands = 1; + } + + /* PS extension layer enabled */ + ps->enable_ext = (uint8_t)faad_get1bit(ld + DEBUGVAR(1,1005,"ps_data(): enable_ext")); + } + + /* we are here, but no header has been read yet */ + if (ps->header_read == 0) + return 1; + + ps->frame_class = (uint8_t)faad_get1bit(ld + DEBUGVAR(1,1006,"ps_data(): frame_class")); + tmp = (uint8_t)faad_getbits(ld, 2 + DEBUGVAR(1,1007,"ps_data(): num_env_idx")); + + ps->num_env = num_env_tab[ps->frame_class][tmp]; + + if (ps->frame_class) + { + for (n = 1; n < ps->num_env+1; n++) + { + ps->border_position[n] = (uint8_t)faad_getbits(ld, 5 + DEBUGVAR(1,1008,"ps_data(): border_position")); + } + } + + if (ps->enable_iid) + { + for (n = 0; n < ps->num_env; n++) + { + ps->iid_dt[n] = (uint8_t)faad_get1bit(ld + DEBUGVAR(1,1009,"ps_data(): iid_dt")); + + /* iid_data */ + if (ps->iid_mode < 3) + { + huff_data(ld, ps->iid_dt[n], ps->nr_iid_par, t_huff_iid_def, + f_huff_iid_def, ps->iid_index[n]); + } else { + huff_data(ld, ps->iid_dt[n], ps->nr_iid_par, t_huff_iid_fine, + f_huff_iid_fine, ps->iid_index[n]); + } + } + } + + if (ps->enable_icc) + { + for (n = 0; n < ps->num_env; n++) + { + ps->icc_dt[n] = (uint8_t)faad_get1bit(ld + DEBUGVAR(1,1010,"ps_data(): icc_dt")); + + /* icc_data */ + huff_data(ld, ps->icc_dt[n], ps->nr_icc_par, t_huff_icc, + f_huff_icc, ps->icc_index[n]); + } + } + + if (ps->enable_ext) + { + uint16_t num_bits_left; + uint16_t cnt = (uint16_t)faad_getbits(ld, 4 + DEBUGVAR(1,1011,"ps_data(): ps_extension_size")); + if (cnt == 15) + { + cnt += (uint16_t)faad_getbits(ld, 8 + DEBUGVAR(1,1012,"ps_data(): esc_count")); + } + + num_bits_left = 8 * cnt; + while (num_bits_left > 7) + { + uint8_t ps_extension_id = (uint8_t)faad_getbits(ld, 2 + DEBUGVAR(1,1013,"ps_data(): ps_extension_size")); + + num_bits_left -= 2; + num_bits_left -= ps_extension(ps, ld, ps_extension_id, num_bits_left); + } + + faad_getbits(ld, num_bits_left + DEBUGVAR(1,1014,"ps_data(): fill_bits")); + } + + bits = (uint16_t)faad_get_processed_bits(ld) - bits; + + ps->ps_data_available = 1; + + return bits; +} + +static uint16_t ps_extension(ps_info *ps, bitfile *ld, + const uint8_t ps_extension_id, + const uint16_t num_bits_left) +{ + uint8_t n; + uint16_t bits = (uint16_t)faad_get_processed_bits(ld); + + if (ps_extension_id == 0) + { + ps->enable_ipdopd = (uint8_t)faad_get1bit(ld + DEBUGVAR(1,1015,"ps_extension(): enable_ipdopd")); + + if (ps->enable_ipdopd) + { + for (n = 0; n < ps->num_env; n++) + { + ps->ipd_dt[n] = (uint8_t)faad_get1bit(ld + DEBUGVAR(1,1016,"ps_extension(): ipd_dt")); + + /* ipd_data */ + huff_data(ld, ps->ipd_dt[n], ps->nr_ipdopd_par, t_huff_ipd, + f_huff_ipd, ps->ipd_index[n]); + + ps->opd_dt[n] = (uint8_t)faad_get1bit(ld + DEBUGVAR(1,1017,"ps_extension(): opd_dt")); + + /* opd_data */ + huff_data(ld, ps->opd_dt[n], ps->nr_ipdopd_par, t_huff_opd, + f_huff_opd, ps->opd_index[n]); + } + } + faad_get1bit(ld + DEBUGVAR(1,1018,"ps_extension(): reserved_ps")); + } + + /* return number of bits read */ + bits = (uint16_t)faad_get_processed_bits(ld) - bits; + + return bits; +} + +/* read huffman data coded in either the frequency or the time direction */ +static void huff_data(bitfile *ld, const uint8_t dt, const uint8_t nr_par, + ps_huff_tab t_huff, ps_huff_tab f_huff, int8_t *par) +{ + uint8_t n; + + if (dt) + { + /* coded in time direction */ + for (n = 0; n < nr_par; n++) + { + par[n] = ps_huff_dec(ld, t_huff); + } + } else { + /* coded in frequency direction */ + par[0] = ps_huff_dec(ld, f_huff); + + for (n = 1; n < nr_par; n++) + { + par[n] = ps_huff_dec(ld, f_huff); + } + } +} + +/* binary search huffman decoding */ +static INLINE int8_t ps_huff_dec(bitfile *ld, ps_huff_tab t_huff) +{ + uint8_t bit; + int16_t index = 0; + + while (index >= 0) + { + bit = (uint8_t)faad_get1bit(ld); + index = t_huff[index][bit]; + } + + return index + 31; +} + +#endif diff --git a/Libraries/FAAD2/Files/libfaad/ps_tables.h b/Libraries/FAAD2/Files/libfaad/ps_tables.h new file mode 100644 index 000000000..83cd20abb --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/ps_tables.h @@ -0,0 +1,547 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#ifndef __PS_TABLES_H__ +#define __PS_TABLES_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef _MSC_VER +#pragma warning(disable:4305) +#pragma warning(disable:4244) +#endif + +#if 0 +#if 0 +float f_center_20[12] = { + 0.5/4, 1.5/4, 2.5/4, 3.5/4, + 4.5/4*0, 5.5/4*0, -1.5/4, -0.5/4, + 3.5/2, 2.5/2, 4.5/2, 5.5/2 +}; +#else +float f_center_20[12] = { + 0.5/8, 1.5/8, 2.5/8, 3.5/8, + 4.5/8*0, 5.5/8*0, -1.5/8, -0.5/8, + 3.5/4, 2.5/4, 4.5/4, 5.5/4 +}; +#endif + +float f_center_34[32] = { + 1/12, 3/12, 5/12, 7/12, + 9/12, 11/12, 13/12, 15/12, + 17/12, -5/12, -3/12, -1/12, + 17/8, 19/8, 5/8, 7/8, + 9/8, 11/8, 13/8, 15/8, + 9/4, 11/4, 13/4, 7/4, + 17/4, 11/4, 13/4, 15/4, + 17/4, 19/4, 21/4, 15/4 +}; + +static const real_t frac_delay_q[] = { + FRAC_CONST(0.43), + FRAC_CONST(0.75), + FRAC_CONST(0.347) +}; +#endif + +/* RE(ps->Phi_Fract_Qmf[j]) = (float)cos(M_PI*(j+0.5)*(0.39)); */ +/* IM(ps->Phi_Fract_Qmf[j]) = (float)sin(M_PI*(j+0.5)*(0.39)); */ +static const complex_t Phi_Fract_Qmf[] = { + { FRAC_CONST(0.8181497455), FRAC_CONST(0.5750052333) }, + { FRAC_CONST(-0.2638730407), FRAC_CONST(0.9645574093) }, + { FRAC_CONST(-0.9969173074), FRAC_CONST(0.0784590989) }, + { FRAC_CONST(-0.4115143716), FRAC_CONST(-0.9114032984) }, + { FRAC_CONST(0.7181262970), FRAC_CONST(-0.6959127784) }, + { FRAC_CONST(0.8980275989), FRAC_CONST(0.4399391711) }, + { FRAC_CONST(-0.1097343117), FRAC_CONST(0.9939609766) }, + { FRAC_CONST(-0.9723699093), FRAC_CONST(0.2334453613) }, + { FRAC_CONST(-0.5490227938), FRAC_CONST(-0.8358073831) }, + { FRAC_CONST(0.6004202366), FRAC_CONST(-0.7996846437) }, + { FRAC_CONST(0.9557930231), FRAC_CONST(0.2940403223) }, + { FRAC_CONST(0.0471064523), FRAC_CONST(0.9988898635) }, + { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, + { FRAC_CONST(-0.6730124950), FRAC_CONST(-0.7396311164) }, + { FRAC_CONST(0.4679298103), FRAC_CONST(-0.8837656379) }, + { FRAC_CONST(0.9900236726), FRAC_CONST(0.1409012377) }, + { FRAC_CONST(0.2027872950), FRAC_CONST(0.9792228341) }, + { FRAC_CONST(-0.8526401520), FRAC_CONST(0.5224985480) }, + { FRAC_CONST(-0.7804304361), FRAC_CONST(-0.6252426505) }, + { FRAC_CONST(0.3239174187), FRAC_CONST(-0.9460853338) }, + { FRAC_CONST(0.9998766184), FRAC_CONST(-0.0157073177) }, + { FRAC_CONST(0.3534748554), FRAC_CONST(0.9354440570) }, + { FRAC_CONST(-0.7604059577), FRAC_CONST(0.6494480371) }, + { FRAC_CONST(-0.8686315417), FRAC_CONST(-0.4954586625) }, + { FRAC_CONST(0.1719291061), FRAC_CONST(-0.9851093292) }, + { FRAC_CONST(0.9851093292), FRAC_CONST(-0.1719291061) }, + { FRAC_CONST(0.4954586625), FRAC_CONST(0.8686315417) }, + { FRAC_CONST(-0.6494480371), FRAC_CONST(0.7604059577) }, + { FRAC_CONST(-0.9354440570), FRAC_CONST(-0.3534748554) }, + { FRAC_CONST(0.0157073177), FRAC_CONST(-0.9998766184) }, + { FRAC_CONST(0.9460853338), FRAC_CONST(-0.3239174187) }, + { FRAC_CONST(0.6252426505), FRAC_CONST(0.7804304361) }, + { FRAC_CONST(-0.5224985480), FRAC_CONST(0.8526401520) }, + { FRAC_CONST(-0.9792228341), FRAC_CONST(-0.2027872950) }, + { FRAC_CONST(-0.1409012377), FRAC_CONST(-0.9900236726) }, + { FRAC_CONST(0.8837656379), FRAC_CONST(-0.4679298103) }, + { FRAC_CONST(0.7396311164), FRAC_CONST(0.6730124950) }, + { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, + { FRAC_CONST(-0.9988898635), FRAC_CONST(-0.0471064523) }, + { FRAC_CONST(-0.2940403223), FRAC_CONST(-0.9557930231) }, + { FRAC_CONST(0.7996846437), FRAC_CONST(-0.6004202366) }, + { FRAC_CONST(0.8358073831), FRAC_CONST(0.5490227938) }, + { FRAC_CONST(-0.2334453613), FRAC_CONST(0.9723699093) }, + { FRAC_CONST(-0.9939609766), FRAC_CONST(0.1097343117) }, + { FRAC_CONST(-0.4399391711), FRAC_CONST(-0.8980275989) }, + { FRAC_CONST(0.6959127784), FRAC_CONST(-0.7181262970) }, + { FRAC_CONST(0.9114032984), FRAC_CONST(0.4115143716) }, + { FRAC_CONST(-0.0784590989), FRAC_CONST(0.9969173074) }, + { FRAC_CONST(-0.9645574093), FRAC_CONST(0.2638730407) }, + { FRAC_CONST(-0.5750052333), FRAC_CONST(-0.8181497455) }, + { FRAC_CONST(0.5750052333), FRAC_CONST(-0.8181497455) }, + { FRAC_CONST(0.9645574093), FRAC_CONST(0.2638730407) }, + { FRAC_CONST(0.0784590989), FRAC_CONST(0.9969173074) }, + { FRAC_CONST(-0.9114032984), FRAC_CONST(0.4115143716) }, + { FRAC_CONST(-0.6959127784), FRAC_CONST(-0.7181262970) }, + { FRAC_CONST(0.4399391711), FRAC_CONST(-0.8980275989) }, + { FRAC_CONST(0.9939609766), FRAC_CONST(0.1097343117) }, + { FRAC_CONST(0.2334453613), FRAC_CONST(0.9723699093) }, + { FRAC_CONST(-0.8358073831), FRAC_CONST(0.5490227938) }, + { FRAC_CONST(-0.7996846437), FRAC_CONST(-0.6004202366) }, + { FRAC_CONST(0.2940403223), FRAC_CONST(-0.9557930231) }, + { FRAC_CONST(0.9988898635), FRAC_CONST(-0.0471064523) }, + { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, + { FRAC_CONST(-0.7396311164), FRAC_CONST(0.6730124950) } +}; + +/* RE(Phi_Fract_SubQmf20[j]) = (float)cos(M_PI*f_center_20[j]*0.39); */ +/* IM(Phi_Fract_SubQmf20[j]) = (float)sin(M_PI*f_center_20[j]*0.39); */ +static const complex_t Phi_Fract_SubQmf20[] = { + { FRAC_CONST(0.9882950187), FRAC_CONST(0.1525546312) }, + { FRAC_CONST(0.8962930441), FRAC_CONST(0.4434623122) }, + { FRAC_CONST(0.7208535671), FRAC_CONST(0.6930873394) }, + { FRAC_CONST(0.4783087075), FRAC_CONST(0.8781917691) }, + { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, + { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, + { FRAC_CONST(0.8962930441), FRAC_CONST(-0.4434623122) }, + { FRAC_CONST(0.9882950187), FRAC_CONST(-0.1525546312) }, + { FRAC_CONST(-0.5424415469), FRAC_CONST(0.8400935531) }, + { FRAC_CONST(0.0392598175), FRAC_CONST(0.9992290139) }, + { FRAC_CONST(-0.9268565774), FRAC_CONST(0.3754155636) }, + { FRAC_CONST(-0.9741733670), FRAC_CONST(-0.2258012742) } +}; + +/* RE(Phi_Fract_SubQmf34[j]) = (float)cos(M_PI*f_center_34[j]*0.39); */ +/* IM(Phi_Fract_SubQmf34[j]) = (float)sin(M_PI*f_center_34[j]*0.39); */ +static const complex_t Phi_Fract_SubQmf34[] = { + { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, + { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, + { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, + { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, + { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, + { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, + { FRAC_CONST(0.3387379348), FRAC_CONST(0.9408807755) }, + { FRAC_CONST(0.3387379348), FRAC_CONST(0.9408807755) }, + { FRAC_CONST(0.3387379348), FRAC_CONST(0.9408807755) }, + { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, + { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, + { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, + { FRAC_CONST(-0.7705132365), FRAC_CONST(0.6374239922) }, + { FRAC_CONST(-0.7705132365), FRAC_CONST(0.6374239922) }, + { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, + { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, + { FRAC_CONST(0.3387379348), FRAC_CONST(0.9408807755) }, + { FRAC_CONST(0.3387379348), FRAC_CONST(0.9408807755) }, + { FRAC_CONST(0.3387379348), FRAC_CONST(0.9408807755) }, + { FRAC_CONST(0.3387379348), FRAC_CONST(0.9408807755) }, + { FRAC_CONST(-0.7705132365), FRAC_CONST(0.6374239922) }, + { FRAC_CONST(-0.7705132365), FRAC_CONST(0.6374239922) }, + { FRAC_CONST(-0.8607420325), FRAC_CONST(-0.5090414286) }, + { FRAC_CONST(0.3387379348), FRAC_CONST(0.9408807755) }, + { FRAC_CONST(0.1873813123), FRAC_CONST(-0.9822872281) }, + { FRAC_CONST(-0.7705132365), FRAC_CONST(0.6374239922) }, + { FRAC_CONST(-0.8607420325), FRAC_CONST(-0.5090414286) }, + { FRAC_CONST(-0.8607420325), FRAC_CONST(-0.5090414286) }, + { FRAC_CONST(0.1873813123), FRAC_CONST(-0.9822872281) }, + { FRAC_CONST(0.1873813123), FRAC_CONST(-0.9822872281) }, + { FRAC_CONST(0.9876883626), FRAC_CONST(-0.1564344615) }, + { FRAC_CONST(-0.8607420325), FRAC_CONST(-0.5090414286) } +}; + +/* RE(Q_Fract_allpass_Qmf[j][i]) = (float)cos(M_PI*(j+0.5)*(frac_delay_q[i])); */ +/* IM(Q_Fract_allpass_Qmf[j][i]) = (float)sin(M_PI*(j+0.5)*(frac_delay_q[i])); */ +static const complex_t Q_Fract_allpass_Qmf[][3] = { + { { FRAC_CONST(0.7804303765), FRAC_CONST(0.6252426505) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.8550928831), FRAC_CONST(0.5184748173) } }, + { { FRAC_CONST(-0.4399392009), FRAC_CONST(0.8980275393) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.0643581524), FRAC_CONST(0.9979268909) } }, + { { FRAC_CONST(-0.9723699093), FRAC_CONST(-0.2334454209) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.9146071672), FRAC_CONST(0.4043435752) } }, + { { FRAC_CONST(0.0157073960), FRAC_CONST(-0.9998766184) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.7814115286), FRAC_CONST(-0.6240159869) } }, + { { FRAC_CONST(0.9792228341), FRAC_CONST(-0.2027871907) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.1920081824), FRAC_CONST(-0.9813933372) } }, + { { FRAC_CONST(0.4115142524), FRAC_CONST(0.9114032984) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.9589683414), FRAC_CONST(-0.2835132182) } }, + { { FRAC_CONST(-0.7996847630), FRAC_CONST(0.6004201174) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.6947838664), FRAC_CONST(0.7192186117) } }, + { { FRAC_CONST(-0.7604058385), FRAC_CONST(-0.6494481564) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.3164770305), FRAC_CONST(0.9486001730) } }, + { { FRAC_CONST(0.4679299891), FRAC_CONST(-0.8837655187) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.9874414206), FRAC_CONST(0.1579856575) } }, + { { FRAC_CONST(0.9645573497), FRAC_CONST(0.2638732493) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.5966450572), FRAC_CONST(-0.8025052547) } }, + { { FRAC_CONST(-0.0471066870), FRAC_CONST(0.9988898635) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.4357025325), FRAC_CONST(-0.9000906944) } }, + { { FRAC_CONST(-0.9851093888), FRAC_CONST(0.1719288528) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.9995546937), FRAC_CONST(-0.0298405960) } }, + { { FRAC_CONST(-0.3826831877), FRAC_CONST(-0.9238796234) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.4886211455), FRAC_CONST(0.8724960685) } }, + { { FRAC_CONST(0.8181498647), FRAC_CONST(-0.5750049949) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.5477093458), FRAC_CONST(0.8366686702) } }, + { { FRAC_CONST(0.7396308780), FRAC_CONST(0.6730127335) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.9951074123), FRAC_CONST(-0.0987988561) } }, + { { FRAC_CONST(-0.4954589605), FRAC_CONST(0.8686313629) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.3725017905), FRAC_CONST(-0.9280315042) } }, + { { FRAC_CONST(-0.9557929039), FRAC_CONST(-0.2940406799) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.6506417990), FRAC_CONST(-0.7593847513) } }, + { { FRAC_CONST(0.0784594864), FRAC_CONST(-0.9969173074) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.9741733670), FRAC_CONST(0.2258014232) } }, + { { FRAC_CONST(0.9900237322), FRAC_CONST(-0.1409008205) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.2502108514), FRAC_CONST(0.9681913853) } }, + { { FRAC_CONST(0.3534744382), FRAC_CONST(0.9354441762) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.7427945137), FRAC_CONST(0.6695194840) } }, + { { FRAC_CONST(-0.8358076215), FRAC_CONST(0.5490224361) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.9370992780), FRAC_CONST(-0.3490629196) } }, + { { FRAC_CONST(-0.7181259394), FRAC_CONST(-0.6959131360) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.1237744763), FRAC_CONST(-0.9923103452) } }, + { { FRAC_CONST(0.5224990249), FRAC_CONST(-0.8526399136) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.8226406574), FRAC_CONST(-0.5685616732) } }, + { { FRAC_CONST(0.9460852146), FRAC_CONST(0.3239179254) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.8844994903), FRAC_CONST(0.4665412009) } }, + { { FRAC_CONST(-0.1097348556), FRAC_CONST(0.9939609170) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.0047125919), FRAC_CONST(0.9999889135) } }, + { { FRAC_CONST(-0.9939610362), FRAC_CONST(0.1097337380) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.8888573647), FRAC_CONST(0.4581840038) } }, + { { FRAC_CONST(-0.3239168525), FRAC_CONST(-0.9460855722) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.8172453642), FRAC_CONST(-0.5762898922) } }, + { { FRAC_CONST(0.8526405096), FRAC_CONST(-0.5224980116) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.1331215799), FRAC_CONST(-0.9910997152) } }, + { { FRAC_CONST(0.6959123611), FRAC_CONST(0.7181267142) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.9403476119), FRAC_CONST(-0.3402152061) } }, + { { FRAC_CONST(-0.5490233898), FRAC_CONST(0.8358070254) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.7364512086), FRAC_CONST(0.6764906645) } }, + { { FRAC_CONST(-0.9354437590), FRAC_CONST(-0.3534754813) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.2593250275), FRAC_CONST(0.9657900929) } }, + { { FRAC_CONST(0.1409019381), FRAC_CONST(-0.9900235534) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.9762582779), FRAC_CONST(0.2166097313) } }, + { { FRAC_CONST(0.9969173670), FRAC_CONST(-0.0784583688) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.6434556246), FRAC_CONST(-0.7654833794) } }, + { { FRAC_CONST(0.2940396070), FRAC_CONST(0.9557932615) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.3812320232), FRAC_CONST(-0.9244794250) } }, + { { FRAC_CONST(-0.8686318994), FRAC_CONST(0.4954580069) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.9959943891), FRAC_CONST(-0.0894154981) } }, + { { FRAC_CONST(-0.6730118990), FRAC_CONST(-0.7396316528) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.5397993922), FRAC_CONST(0.8417937160) } }, + { { FRAC_CONST(0.5750059485), FRAC_CONST(-0.8181492686) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.4968227744), FRAC_CONST(0.8678520322) } }, + { { FRAC_CONST(0.9238792062), FRAC_CONST(0.3826842010) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.9992290139), FRAC_CONST(-0.0392601527) } }, + { { FRAC_CONST(-0.1719299555), FRAC_CONST(0.9851091504) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.4271997511), FRAC_CONST(-0.9041572809) } }, + { { FRAC_CONST(-0.9988899231), FRAC_CONST(0.0471055657) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.6041822433), FRAC_CONST(-0.7968461514) } }, + { { FRAC_CONST(-0.2638721764), FRAC_CONST(-0.9645576477) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.9859085083), FRAC_CONST(0.1672853529) } }, + { { FRAC_CONST(0.8837660551), FRAC_CONST(-0.4679289758) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.3075223565), FRAC_CONST(0.9515408874) } }, + { { FRAC_CONST(0.6494473219), FRAC_CONST(0.7604066133) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.7015317082), FRAC_CONST(0.7126382589) } }, + { { FRAC_CONST(-0.6004210114), FRAC_CONST(0.7996840477) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.9562535882), FRAC_CONST(-0.2925389707) } }, + { { FRAC_CONST(-0.9114028811), FRAC_CONST(-0.4115152657) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.1827499419), FRAC_CONST(-0.9831594229) } }, + { { FRAC_CONST(0.2027882934), FRAC_CONST(-0.9792225957) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.7872582674), FRAC_CONST(-0.6166234016) } }, + { { FRAC_CONST(0.9998766780), FRAC_CONST(-0.0157062728) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.9107555747), FRAC_CONST(0.4129458666) } }, + { { FRAC_CONST(0.2334443331), FRAC_CONST(0.9723701477) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.0549497530), FRAC_CONST(0.9984891415) } }, + { { FRAC_CONST(-0.8980280757), FRAC_CONST(0.4399381876) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.8599416018), FRAC_CONST(0.5103924870) } }, + { { FRAC_CONST(-0.6252418160), FRAC_CONST(-0.7804310918) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.8501682281), FRAC_CONST(-0.5265110731) } }, + { { FRAC_CONST(0.6252435446), FRAC_CONST(-0.7804297209) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.0737608299), FRAC_CONST(-0.9972759485) } }, + { { FRAC_CONST(0.8980270624), FRAC_CONST(0.4399402142) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.9183775187), FRAC_CONST(-0.3957053721) } }, + { { FRAC_CONST(-0.2334465086), FRAC_CONST(0.9723696709) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.7754954696), FRAC_CONST(0.6313531399) } }, + { { FRAC_CONST(-0.9998766184), FRAC_CONST(-0.0157085191) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.2012493610), FRAC_CONST(0.9795400500) } }, + { { FRAC_CONST(-0.2027861029), FRAC_CONST(-0.9792230725) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.9615978599), FRAC_CONST(0.2744622827) } }, + { { FRAC_CONST(0.9114037752), FRAC_CONST(-0.4115132093) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.6879743338), FRAC_CONST(-0.7257350087) } }, + { { FRAC_CONST(0.6004192233), FRAC_CONST(0.7996854186) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.3254036009), FRAC_CONST(-0.9455752373) } }, + { { FRAC_CONST(-0.6494490504), FRAC_CONST(0.7604051232) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.9888865948), FRAC_CONST(-0.1486719251) } }, + { { FRAC_CONST(-0.8837650418), FRAC_CONST(-0.4679309726) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.5890548825), FRAC_CONST(0.8080930114) } }, + { { FRAC_CONST(0.2638743520), FRAC_CONST(-0.9645570517) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.4441666007), FRAC_CONST(0.8959442377) } }, + { { FRAC_CONST(0.9988898039), FRAC_CONST(0.0471078083) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.9997915030), FRAC_CONST(0.0204183888) } }, + { { FRAC_CONST(0.1719277352), FRAC_CONST(0.9851095676) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.4803760946), FRAC_CONST(-0.8770626187) } }, + { { FRAC_CONST(-0.9238800406), FRAC_CONST(0.3826821446) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.5555707216), FRAC_CONST(-0.8314692974) } }, + { { FRAC_CONST(-0.5750041008), FRAC_CONST(-0.8181505203) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.9941320419), FRAC_CONST(0.1081734300) } } +}; + +/* RE(Q_Fract_allpass_SubQmf20[j][i]) = (float)cos(M_PI*f_center_20[j]*frac_delay_q[i]); */ +/* IM(Q_Fract_allpass_SubQmf20[j][i]) = (float)sin(M_PI*f_center_20[j]*frac_delay_q[i]); */ +static const complex_t Q_Fract_allpass_SubQmf20[][3] = { + { { FRAC_CONST(0.9857769012), FRAC_CONST(0.1680592746) }, { FRAC_CONST(0.9569403529), FRAC_CONST(0.2902846634) }, { FRAC_CONST(0.9907300472), FRAC_CONST(0.1358452588) } }, + { { FRAC_CONST(0.8744080663), FRAC_CONST(0.4851911962) }, { FRAC_CONST(0.6343932748), FRAC_CONST(0.7730104327) }, { FRAC_CONST(0.9175986052), FRAC_CONST(0.3975082636) } }, + { { FRAC_CONST(0.6642524004), FRAC_CONST(0.7475083470) }, { FRAC_CONST(0.0980171412), FRAC_CONST(0.9951847196) }, { FRAC_CONST(0.7767338753), FRAC_CONST(0.6298289299) } }, + { { FRAC_CONST(0.3790524006), FRAC_CONST(0.9253752232) }, { FRAC_CONST(-0.4713967443), FRAC_CONST(0.8819212914) }, { FRAC_CONST(0.5785340071), FRAC_CONST(0.8156582713) } }, + { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } }, + { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } }, + { { FRAC_CONST(0.8744080663), FRAC_CONST(-0.4851911962) }, { FRAC_CONST(0.6343932748), FRAC_CONST(-0.7730104327) }, { FRAC_CONST(0.9175986052), FRAC_CONST(-0.3975082636) } }, + { { FRAC_CONST(0.9857769012), FRAC_CONST(-0.1680592746) }, { FRAC_CONST(0.9569403529), FRAC_CONST(-0.2902846634) }, { FRAC_CONST(0.9907300472), FRAC_CONST(-0.1358452588) } }, + { { FRAC_CONST(-0.7126385570), FRAC_CONST(0.7015314102) }, { FRAC_CONST(-0.5555702448), FRAC_CONST(-0.8314695954) }, { FRAC_CONST(-0.3305967748), FRAC_CONST(0.9437720776) } }, + { { FRAC_CONST(-0.1175374240), FRAC_CONST(0.9930684566) }, { FRAC_CONST(-0.9807852507), FRAC_CONST(0.1950903237) }, { FRAC_CONST(0.2066311091), FRAC_CONST(0.9784189463) } }, + { { FRAC_CONST(-0.9947921634), FRAC_CONST(0.1019244045) }, { FRAC_CONST(0.5555702448), FRAC_CONST(-0.8314695954) }, { FRAC_CONST(-0.7720130086), FRAC_CONST(0.6356067061) } }, + { { FRAC_CONST(-0.8400934935), FRAC_CONST(-0.5424416065) }, { FRAC_CONST(0.9807852507), FRAC_CONST(0.1950903237) }, { FRAC_CONST(-0.9896889329), FRAC_CONST(0.1432335079) } } +}; + +/* RE(Q_Fract_allpass_SubQmf34[j][i]) = (float)cos(M_PI*f_center_34[j]*frac_delay_q[i]); */ +/* IM(Q_Fract_allpass_SubQmf34[j][i]) = (float)sin(M_PI*f_center_34[j]*frac_delay_q[i]); */ +static const complex_t Q_Fract_allpass_SubQmf34[][3] = { + { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } }, + { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } }, + { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } }, + { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } }, + { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } }, + { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } }, + { { FRAC_CONST(0.2181432247), FRAC_CONST(0.9759167433) }, { FRAC_CONST(-0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(0.4623677433), FRAC_CONST(0.8866882324) } }, + { { FRAC_CONST(0.2181432247), FRAC_CONST(0.9759167433) }, { FRAC_CONST(-0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(0.4623677433), FRAC_CONST(0.8866882324) } }, + { { FRAC_CONST(0.2181432247), FRAC_CONST(0.9759167433) }, { FRAC_CONST(-0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(0.4623677433), FRAC_CONST(0.8866882324) } }, + { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } }, + { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } }, + { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } }, + { { FRAC_CONST(-0.9048270583), FRAC_CONST(0.4257792532) }, { FRAC_CONST(-0.0000000000), FRAC_CONST(-1.0000000000) }, { FRAC_CONST(-0.5724321604), FRAC_CONST(0.8199520707) } }, + { { FRAC_CONST(-0.9048270583), FRAC_CONST(0.4257792532) }, { FRAC_CONST(-0.0000000000), FRAC_CONST(-1.0000000000) }, { FRAC_CONST(-0.5724321604), FRAC_CONST(0.8199520707) } }, + { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } }, + { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } }, + { { FRAC_CONST(0.2181432247), FRAC_CONST(0.9759167433) }, { FRAC_CONST(-0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(0.4623677433), FRAC_CONST(0.8866882324) } }, + { { FRAC_CONST(0.2181432247), FRAC_CONST(0.9759167433) }, { FRAC_CONST(-0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(0.4623677433), FRAC_CONST(0.8866882324) } }, + { { FRAC_CONST(0.2181432247), FRAC_CONST(0.9759167433) }, { FRAC_CONST(-0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(0.4623677433), FRAC_CONST(0.8866882324) } }, + { { FRAC_CONST(0.2181432247), FRAC_CONST(0.9759167433) }, { FRAC_CONST(-0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(0.4623677433), FRAC_CONST(0.8866882324) } }, + { { FRAC_CONST(-0.9048270583), FRAC_CONST(0.4257792532) }, { FRAC_CONST(-0.0000000000), FRAC_CONST(-1.0000000000) }, { FRAC_CONST(-0.5724321604), FRAC_CONST(0.8199520707) } }, + { { FRAC_CONST(-0.9048270583), FRAC_CONST(0.4257792532) }, { FRAC_CONST(-0.0000000000), FRAC_CONST(-1.0000000000) }, { FRAC_CONST(-0.5724321604), FRAC_CONST(0.8199520707) } }, + { { FRAC_CONST(-0.6129069924), FRAC_CONST(-0.7901550531) }, { FRAC_CONST(0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(-0.9917160273), FRAC_CONST(-0.1284494549) } }, + { { FRAC_CONST(0.2181432247), FRAC_CONST(0.9759167433) }, { FRAC_CONST(-0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(0.4623677433), FRAC_CONST(0.8866882324) } }, + { { FRAC_CONST(0.6374240518), FRAC_CONST(-0.7705131769) }, { FRAC_CONST(-1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(-0.3446428776), FRAC_CONST(-0.9387338758) } }, + { { FRAC_CONST(-0.9048270583), FRAC_CONST(0.4257792532) }, { FRAC_CONST(-0.0000000000), FRAC_CONST(-1.0000000000) }, { FRAC_CONST(-0.5724321604), FRAC_CONST(0.8199520707) } }, + { { FRAC_CONST(-0.6129069924), FRAC_CONST(-0.7901550531) }, { FRAC_CONST(0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(-0.9917160273), FRAC_CONST(-0.1284494549) } }, + { { FRAC_CONST(-0.6129069924), FRAC_CONST(-0.7901550531) }, { FRAC_CONST(0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(-0.9917160273), FRAC_CONST(-0.1284494549) } }, + { { FRAC_CONST(0.6374240518), FRAC_CONST(-0.7705131769) }, { FRAC_CONST(-1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(-0.3446428776), FRAC_CONST(-0.9387338758) } }, + { { FRAC_CONST(0.6374240518), FRAC_CONST(-0.7705131769) }, { FRAC_CONST(-1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(-0.3446428776), FRAC_CONST(-0.9387338758) } }, + { { FRAC_CONST(0.8910064697), FRAC_CONST(0.4539906085) }, { FRAC_CONST(0.7071067691), FRAC_CONST(-0.7071067691) }, { FRAC_CONST(0.6730125546), FRAC_CONST(-0.7396310568) } }, + { { FRAC_CONST(-0.6129069924), FRAC_CONST(-0.7901550531) }, { FRAC_CONST(0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(-0.9917160273), FRAC_CONST(-0.1284494549) } } +}; + +#if 0 +static float quant_rho[8] = +{ + FRAC_CONST(1.0), FRAC_CONST(0.937), FRAC_CONST(0.84118), FRAC_CONST(0.60092), + FRAC_CONST(0.36764), FRAC_CONST(0.0), FRAC_CONST(-0.589), FRAC_CONST(-1.0) +}; + +static const uint8_t quant_iid_normal[7] = +{ + 2, 4, 7, 10, 14, 18, 25 +}; + +static const uint8_t quant_iid_fine[15] = +{ + 2, 4, 6, 8, 10, 13, 16, 19, 22, 25, 30, 35, 40, 45, 50 +}; +#endif + +static const real_t cos_alphas[] = { + COEF_CONST(1.0000000000), COEF_CONST(0.9841239700), COEF_CONST(0.9594738210), + COEF_CONST(0.8946843079), COEF_CONST(0.8269340931), COEF_CONST(0.7071067812), + COEF_CONST(0.4533210856), COEF_CONST(0.0000000000) +}; + +static const real_t sin_alphas[] = { + COEF_CONST(0.0000000000), COEF_CONST(0.1774824264), COEF_CONST(0.2817977763), + COEF_CONST(0.4466989918), COEF_CONST(0.5622988580), COEF_CONST(0.7071067812), + COEF_CONST(0.8913472911), COEF_CONST(1.0000000000) +}; + +static const real_t cos_betas_normal[][8] = { + { COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000) }, + { COEF_CONST(1.0000000000), COEF_CONST(0.9995871699), COEF_CONST(0.9989419133), COEF_CONST(0.9972204583), COEF_CONST(0.9953790839), COEF_CONST(0.9920112747), COEF_CONST(0.9843408180), COEF_CONST(0.9681727381) }, + { COEF_CONST(1.0000000000), COEF_CONST(0.9984497744), COEF_CONST(0.9960279377), COEF_CONST(0.9895738413), COEF_CONST(0.9826814632), COEF_CONST(0.9701058164), COEF_CONST(0.9416098832), COEF_CONST(0.8822105900) }, + { COEF_CONST(1.0000000000), COEF_CONST(0.9959398908), COEF_CONST(0.9896038018), COEF_CONST(0.9727589768), COEF_CONST(0.9548355329), COEF_CONST(0.9223070404), COEF_CONST(0.8494349490), COEF_CONST(0.7013005535) }, + { COEF_CONST(1.0000000000), COEF_CONST(0.9932417400), COEF_CONST(0.9827071856), COEF_CONST(0.9547730996), COEF_CONST(0.9251668930), COEF_CONST(0.8717461589), COEF_CONST(0.7535520592), COEF_CONST(0.5198827312) }, + { COEF_CONST(1.0000000000), COEF_CONST(0.9902068095), COEF_CONST(0.9749613872), COEF_CONST(0.9346538534), COEF_CONST(0.8921231300), COEF_CONST(0.8158851259), COEF_CONST(0.6495964302), COEF_CONST(0.3313370772) }, + { COEF_CONST(1.0000000000), COEF_CONST(0.9880510933), COEF_CONST(0.9694670261), COEF_CONST(0.9204347876), COEF_CONST(0.8688622825), COEF_CONST(0.7768516704), COEF_CONST(0.5782161800), COEF_CONST(0.2069970356) }, + { COEF_CONST(1.0000000000), COEF_CONST(0.9858996945), COEF_CONST(0.9639898866), COEF_CONST(0.9063034786), COEF_CONST(0.8458214608), COEF_CONST(0.7384262300), COEF_CONST(0.5089811277), COEF_CONST(0.0905465944) } +}; + +static const real_t sin_betas_normal[][8] = { + { COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000) }, + { COEF_CONST(0.0000000000), COEF_CONST(-0.0287313368), COEF_CONST(-0.0459897147), COEF_CONST(-0.0745074328), COEF_CONST(-0.0960233266), COEF_CONST(-0.1261492408), COEF_CONST(-0.1762757894), COEF_CONST(-0.2502829383) }, + { COEF_CONST(0.0000000000), COEF_CONST(-0.0556601118), COEF_CONST(-0.0890412670), COEF_CONST(-0.1440264301), COEF_CONST(-0.1853028382), COEF_CONST(-0.2426823129), COEF_CONST(-0.3367058477), COEF_CONST(-0.4708550466) }, + { COEF_CONST(0.0000000000), COEF_CONST(-0.0900207420), COEF_CONST(-0.1438204281), COEF_CONST(-0.2318188366), COEF_CONST(-0.2971348264), COEF_CONST(-0.3864579191), COEF_CONST(-0.5276933461), COEF_CONST(-0.7128657193) }, + { COEF_CONST(0.0000000000), COEF_CONST(-0.1160639735), COEF_CONST(-0.1851663774), COEF_CONST(-0.2973353800), COEF_CONST(-0.3795605619), COEF_CONST(-0.4899577884), COEF_CONST(-0.6573882369), COEF_CONST(-0.8542376401) }, + { COEF_CONST(0.0000000000), COEF_CONST(-0.1396082894), COEF_CONST(-0.2223742196), COEF_CONST(-0.3555589603), COEF_CONST(-0.4517923427), COEF_CONST(-0.5782140273), COEF_CONST(-0.7602792104), COEF_CONST(-0.9435124489) }, + { COEF_CONST(0.0000000000), COEF_CONST(-0.1541266914), COEF_CONST(-0.2452217065), COEF_CONST(-0.3908961522), COEF_CONST(-0.4950538699), COEF_CONST(-0.6296836366), COEF_CONST(-0.8158836002), COEF_CONST(-0.9783415698) }, + { COEF_CONST(0.0000000000), COEF_CONST(-0.1673373610), COEF_CONST(-0.2659389001), COEF_CONST(-0.4226275012), COEF_CONST(-0.5334660781), COEF_CONST(-0.6743342664), COEF_CONST(-0.8607776784), COEF_CONST(-0.9958922202) } +}; + +static const real_t cos_betas_fine[][8] = { + { COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000) }, + { COEF_CONST(1.0000000000), COEF_CONST(0.9995871699), COEF_CONST(0.9989419133), COEF_CONST(0.9972204583), COEF_CONST(0.9953790839), COEF_CONST(0.9920112747), COEF_CONST(0.9843408180), COEF_CONST(0.9681727381) }, + { COEF_CONST(1.0000000000), COEF_CONST(0.9984497744), COEF_CONST(0.9960279377), COEF_CONST(0.9895738413), COEF_CONST(0.9826814632), COEF_CONST(0.9701058164), COEF_CONST(0.9416098832), COEF_CONST(0.8822105900) }, + { COEF_CONST(1.0000000000), COEF_CONST(0.9968361371), COEF_CONST(0.9918968104), COEF_CONST(0.9787540479), COEF_CONST(0.9647515190), COEF_CONST(0.9392903010), COEF_CONST(0.8820167114), COEF_CONST(0.7645325390) }, + { COEF_CONST(1.0000000000), COEF_CONST(0.9950262915), COEF_CONST(0.9872675041), COEF_CONST(0.9666584578), COEF_CONST(0.9447588606), COEF_CONST(0.9050918405), COEF_CONST(0.8165997379), COEF_CONST(0.6383824796) }, + { COEF_CONST(1.0000000000), COEF_CONST(0.9932417400), COEF_CONST(0.9827071856), COEF_CONST(0.9547730996), COEF_CONST(0.9251668930), COEF_CONST(0.8717461589), COEF_CONST(0.7535520592), COEF_CONST(0.5198827312) }, + { COEF_CONST(1.0000000000), COEF_CONST(0.9908827998), COEF_CONST(0.9766855904), COEF_CONST(0.9391249214), COEF_CONST(0.8994531782), COEF_CONST(0.8282352693), COEF_CONST(0.6723983174), COEF_CONST(0.3719473225) }, + { COEF_CONST(1.0000000000), COEF_CONST(0.9890240165), COEF_CONST(0.9719459866), COEF_CONST(0.9268448110), COEF_CONST(0.8793388536), COEF_CONST(0.7944023271), COEF_CONST(0.6101812098), COEF_CONST(0.2621501145) }, + { COEF_CONST(1.0000000000), COEF_CONST(0.9876350461), COEF_CONST(0.9684073447), COEF_CONST(0.9176973944), COEF_CONST(0.8643930070), COEF_CONST(0.7693796058), COEF_CONST(0.5646720713), COEF_CONST(0.1838899556) }, + { COEF_CONST(1.0000000000), COEF_CONST(0.9866247085), COEF_CONST(0.9658349704), COEF_CONST(0.9110590761), COEF_CONST(0.8535668048), COEF_CONST(0.7513165426), COEF_CONST(0.5320914819), COEF_CONST(0.1289530943) }, + { COEF_CONST(1.0000000000), COEF_CONST(0.9858996945), COEF_CONST(0.9639898866), COEF_CONST(0.9063034786), COEF_CONST(0.8458214608), COEF_CONST(0.7384262300), COEF_CONST(0.5089811277), COEF_CONST(0.0905465944) }, + { COEF_CONST(1.0000000000), COEF_CONST(0.9851245614), COEF_CONST(0.9620180268), COEF_CONST(0.9012265590), COEF_CONST(0.8375623272), COEF_CONST(0.7247108045), COEF_CONST(0.4845204297), COEF_CONST(0.0504115003) }, + { COEF_CONST(1.0000000000), COEF_CONST(0.9846869856), COEF_CONST(0.9609052357), COEF_CONST(0.8983639533), COEF_CONST(0.8329098386), COEF_CONST(0.7169983441), COEF_CONST(0.4708245354), COEF_CONST(0.0281732509) }, + { COEF_CONST(1.0000000000), COEF_CONST(0.9844406325), COEF_CONST(0.9602788522), COEF_CONST(0.8967533934), COEF_CONST(0.8302936455), COEF_CONST(0.7126658102), COEF_CONST(0.4631492839), COEF_CONST(0.0157851140) }, + { COEF_CONST(1.0000000000), COEF_CONST(0.9843020502), COEF_CONST(0.9599265269), COEF_CONST(0.8958477331), COEF_CONST(0.8288229094), COEF_CONST(0.7102315840), COEF_CONST(0.4588429315), COEF_CONST(0.0088578059) }, + { COEF_CONST(1.0000000000), COEF_CONST(0.9842241136), COEF_CONST(0.9597283916), COEF_CONST(0.8953385094), COEF_CONST(0.8279961409), COEF_CONST(0.7088635748), COEF_CONST(0.4564246834), COEF_CONST(0.0049751355) } +}; + +static const real_t sin_betas_fine[][8] = { + { COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000) }, + { COEF_CONST(0.0000000000), COEF_CONST(-0.0287313368), COEF_CONST(-0.0459897147), COEF_CONST(-0.0745074328), COEF_CONST(-0.0960233266), COEF_CONST(-0.1261492408), COEF_CONST(-0.1762757894), COEF_CONST(-0.2502829383) }, + { COEF_CONST(0.0000000000), COEF_CONST(-0.0556601118), COEF_CONST(-0.0890412670), COEF_CONST(-0.1440264301), COEF_CONST(-0.1853028382), COEF_CONST(-0.2426823129), COEF_CONST(-0.3367058477), COEF_CONST(-0.4708550466) }, + { COEF_CONST(0.0000000000), COEF_CONST(-0.0794840594), COEF_CONST(-0.1270461238), COEF_CONST(-0.2050378347), COEF_CONST(-0.2631625097), COEF_CONST(-0.3431234916), COEF_CONST(-0.4712181245), COEF_CONST(-0.6445851354) }, + { COEF_CONST(0.0000000000), COEF_CONST(-0.0996126459), COEF_CONST(-0.1590687758), COEF_CONST(-0.2560691819), COEF_CONST(-0.3277662204), COEF_CONST(-0.4252161335), COEF_CONST(-0.5772043556), COEF_CONST(-0.7697193058) }, + { COEF_CONST(0.0000000000), COEF_CONST(-0.1160639735), COEF_CONST(-0.1851663774), COEF_CONST(-0.2973353800), COEF_CONST(-0.3795605619), COEF_CONST(-0.4899577884), COEF_CONST(-0.6573882369), COEF_CONST(-0.8542376401) }, + { COEF_CONST(0.0000000000), COEF_CONST(-0.1347266752), COEF_CONST(-0.2146747714), COEF_CONST(-0.3435758752), COEF_CONST(-0.4370171396), COEF_CONST(-0.5603805303), COEF_CONST(-0.7401895046), COEF_CONST(-0.9282538388) }, + { COEF_CONST(0.0000000000), COEF_CONST(-0.1477548470), COEF_CONST(-0.2352041647), COEF_CONST(-0.3754446647), COEF_CONST(-0.4761965776), COEF_CONST(-0.6073919186), COEF_CONST(-0.7922618830), COEF_CONST(-0.9650271071) }, + { COEF_CONST(0.0000000000), COEF_CONST(-0.1567705832), COEF_CONST(-0.2493736450), COEF_CONST(-0.3972801182), COEF_CONST(-0.5028167951), COEF_CONST(-0.6387918458), COEF_CONST(-0.8253153651), COEF_CONST(-0.9829468369) }, + { COEF_CONST(0.0000000000), COEF_CONST(-0.1630082348), COEF_CONST(-0.2591578860), COEF_CONST(-0.4122758299), COEF_CONST(-0.5209834064), COEF_CONST(-0.6599420072), COEF_CONST(-0.8466868694), COEF_CONST(-0.9916506943) }, + { COEF_CONST(0.0000000000), COEF_CONST(-0.1673373610), COEF_CONST(-0.2659389001), COEF_CONST(-0.4226275012), COEF_CONST(-0.5334660781), COEF_CONST(-0.6743342664), COEF_CONST(-0.8607776784), COEF_CONST(-0.9958922202) }, + { COEF_CONST(0.0000000000), COEF_CONST(-0.1718417832), COEF_CONST(-0.2729859267), COEF_CONST(-0.4333482310), COEF_CONST(-0.5463417868), COEF_CONST(-0.6890531546), COEF_CONST(-0.8747799456), COEF_CONST(-0.9987285320) }, + { COEF_CONST(0.0000000000), COEF_CONST(-0.1743316967), COEF_CONST(-0.2768774604), COEF_CONST(-0.4392518725), COEF_CONST(-0.5534087104), COEF_CONST(-0.6970748701), COEF_CONST(-0.8822268738), COEF_CONST(-0.9996030552) }, + { COEF_CONST(0.0000000000), COEF_CONST(-0.1757175038), COEF_CONST(-0.2790421580), COEF_CONST(-0.4425306221), COEF_CONST(-0.5573261722), COEF_CONST(-0.7015037013), COEF_CONST(-0.8862802834), COEF_CONST(-0.9998754073) }, + { COEF_CONST(0.0000000000), COEF_CONST(-0.1764921355), COEF_CONST(-0.2802517850), COEF_CONST(-0.4443611583), COEF_CONST(-0.5595110229), COEF_CONST(-0.7039681080), COEF_CONST(-0.8885173967), COEF_CONST(-0.9999607689) }, + { COEF_CONST(0.0000000000), COEF_CONST(-0.1769262394), COEF_CONST(-0.2809295540), COEF_CONST(-0.4453862969), COEF_CONST(-0.5607337966), COEF_CONST(-0.7053456119), COEF_CONST(-0.8897620516), COEF_CONST(-0.9999876239) } +}; + +static const real_t sincos_alphas_B_normal[][8] = { + { COEF_CONST(0.0561454100), COEF_CONST(0.0526385859), COEF_CONST(0.0472937334), COEF_CONST(0.0338410641), COEF_CONST(0.0207261065), COEF_CONST(0.0028205635), COEF_CONST(0.0028205635), COEF_CONST(0.0028205635) }, + { COEF_CONST(0.1249065138), COEF_CONST(0.1173697697), COEF_CONST(0.1057888284), COEF_CONST(0.0761985131), COEF_CONST(0.0468732723), COEF_CONST(0.0063956103), COEF_CONST(0.0063956103), COEF_CONST(0.0063956103) }, + { COEF_CONST(0.1956693050), COEF_CONST(0.1846090179), COEF_CONST(0.1673645109), COEF_CONST(0.1220621836), COEF_CONST(0.0757362479), COEF_CONST(0.0103882630), COEF_CONST(0.0103882630), COEF_CONST(0.0103882630) }, + { COEF_CONST(0.3015113269), COEF_CONST(0.2870525790), COEF_CONST(0.2637738799), COEF_CONST(0.1984573949), COEF_CONST(0.1260749909), COEF_CONST(0.0175600126), COEF_CONST(0.0175600126), COEF_CONST(0.0175600126) }, + { COEF_CONST(0.4078449476), COEF_CONST(0.3929852420), COEF_CONST(0.3680589270), COEF_CONST(0.2911029124), COEF_CONST(0.1934512363), COEF_CONST(0.0278686716), COEF_CONST(0.0278686716), COEF_CONST(0.0278686716) }, + { COEF_CONST(0.5336171261), COEF_CONST(0.5226637762), COEF_CONST(0.5033652606), COEF_CONST(0.4349162672), COEF_CONST(0.3224682122), COEF_CONST(0.0521999036), COEF_CONST(0.0521999036), COEF_CONST(0.0521999036) }, + { COEF_CONST(0.6219832023), COEF_CONST(0.6161847276), COEF_CONST(0.6057251063), COEF_CONST(0.5654342668), COEF_CONST(0.4826149915), COEF_CONST(0.1058044758), COEF_CONST(0.1058044758), COEF_CONST(0.1058044758) }, + { COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657) }, + { COEF_CONST(0.7830305572), COEF_CONST(0.7876016373), COEF_CONST(0.7956739618), COEF_CONST(0.8247933372), COEF_CONST(0.8758325942), COEF_CONST(0.9943869542), COEF_CONST(0.9943869542), COEF_CONST(0.9943869542) }, + { COEF_CONST(0.8457261833), COEF_CONST(0.8525388778), COEF_CONST(0.8640737401), COEF_CONST(0.9004708933), COEF_CONST(0.9465802987), COEF_CONST(0.9986366532), COEF_CONST(0.9986366532), COEF_CONST(0.9986366532) }, + { COEF_CONST(0.9130511848), COEF_CONST(0.9195447612), COEF_CONST(0.9298024282), COEF_CONST(0.9566917233), COEF_CONST(0.9811098801), COEF_CONST(0.9996115928), COEF_CONST(0.9996115928), COEF_CONST(0.9996115928) }, + { COEF_CONST(0.9534625907), COEF_CONST(0.9579148236), COEF_CONST(0.9645845234), COEF_CONST(0.9801095128), COEF_CONST(0.9920207064), COEF_CONST(0.9998458099), COEF_CONST(0.9998458099), COEF_CONST(0.9998458099) }, + { COEF_CONST(0.9806699215), COEF_CONST(0.9828120260), COEF_CONST(0.9858950861), COEF_CONST(0.9925224431), COEF_CONST(0.9971278825), COEF_CONST(0.9999460406), COEF_CONST(0.9999460406), COEF_CONST(0.9999460406) }, + { COEF_CONST(0.9921685024), COEF_CONST(0.9930882705), COEF_CONST(0.9943886135), COEF_CONST(0.9970926648), COEF_CONST(0.9989008403), COEF_CONST(0.9999795479), COEF_CONST(0.9999795479), COEF_CONST(0.9999795479) }, + { COEF_CONST(0.9984226014), COEF_CONST(0.9986136287), COEF_CONST(0.9988810254), COEF_CONST(0.9994272242), COEF_CONST(0.9997851906), COEF_CONST(0.9999960221), COEF_CONST(0.9999960221), COEF_CONST(0.9999960221) } +}; + +static const real_t sincos_alphas_B_fine[][8] = { + { COEF_CONST(0.0031622158), COEF_CONST(0.0029630181), COEF_CONST(0.0026599892), COEF_CONST(0.0019002704), COEF_CONST(0.0011626042), COEF_CONST(0.0001580278), COEF_CONST(0.0001580278), COEF_CONST(0.0001580278) }, + { COEF_CONST(0.0056232673), COEF_CONST(0.0052689825), COEF_CONST(0.0047302825), COEF_CONST(0.0033791756), COEF_CONST(0.0020674015), COEF_CONST(0.0002811710), COEF_CONST(0.0002811710), COEF_CONST(0.0002811710) }, + { COEF_CONST(0.0099994225), COEF_CONST(0.0093696693), COEF_CONST(0.0084117414), COEF_CONST(0.0060093796), COEF_CONST(0.0036766009), COEF_CONST(0.0005000392), COEF_CONST(0.0005000392), COEF_CONST(0.0005000392) }, + { COEF_CONST(0.0177799194), COEF_CONST(0.0166607102), COEF_CONST(0.0149581377), COEF_CONST(0.0106875809), COEF_CONST(0.0065392545), COEF_CONST(0.0008893767), COEF_CONST(0.0008893767), COEF_CONST(0.0008893767) }, + { COEF_CONST(0.0316069684), COEF_CONST(0.0296211579), COEF_CONST(0.0265987295), COEF_CONST(0.0190113813), COEF_CONST(0.0116349973), COEF_CONST(0.0015826974), COEF_CONST(0.0015826974), COEF_CONST(0.0015826974) }, + { COEF_CONST(0.0561454100), COEF_CONST(0.0526385859), COEF_CONST(0.0472937334), COEF_CONST(0.0338410641), COEF_CONST(0.0207261065), COEF_CONST(0.0028205635), COEF_CONST(0.0028205635), COEF_CONST(0.0028205635) }, + { COEF_CONST(0.0791834041), COEF_CONST(0.0742798103), COEF_CONST(0.0667907269), COEF_CONST(0.0478705292), COEF_CONST(0.0293500747), COEF_CONST(0.0039966755), COEF_CONST(0.0039966755), COEF_CONST(0.0039966755) }, + { COEF_CONST(0.1115021177), COEF_CONST(0.1047141985), COEF_CONST(0.0943053154), COEF_CONST(0.0678120561), COEF_CONST(0.0416669150), COEF_CONST(0.0056813213), COEF_CONST(0.0056813213), COEF_CONST(0.0056813213) }, + { COEF_CONST(0.1565355066), COEF_CONST(0.1473258371), COEF_CONST(0.1330924027), COEF_CONST(0.0963282233), COEF_CONST(0.0594509113), COEF_CONST(0.0081277946), COEF_CONST(0.0081277946), COEF_CONST(0.0081277946) }, + { COEF_CONST(0.2184643682), COEF_CONST(0.2064579524), COEF_CONST(0.1876265439), COEF_CONST(0.1375744167), COEF_CONST(0.0856896681), COEF_CONST(0.0117817338), COEF_CONST(0.0117817338), COEF_CONST(0.0117817338) }, + { COEF_CONST(0.3015113269), COEF_CONST(0.2870525790), COEF_CONST(0.2637738799), COEF_CONST(0.1984573949), COEF_CONST(0.1260749909), COEF_CONST(0.0175600126), COEF_CONST(0.0175600126), COEF_CONST(0.0175600126) }, + { COEF_CONST(0.3698741335), COEF_CONST(0.3547727297), COEF_CONST(0.3298252076), COEF_CONST(0.2556265829), COEF_CONST(0.1665990017), COEF_CONST(0.0236344541), COEF_CONST(0.0236344541), COEF_CONST(0.0236344541) }, + { COEF_CONST(0.4480623975), COEF_CONST(0.4339410024), COEF_CONST(0.4098613774), COEF_CONST(0.3322709108), COEF_CONST(0.2266784729), COEF_CONST(0.0334094131), COEF_CONST(0.0334094131), COEF_CONST(0.0334094131) }, + { COEF_CONST(0.5336171261), COEF_CONST(0.5226637762), COEF_CONST(0.5033652606), COEF_CONST(0.4349162672), COEF_CONST(0.3224682122), COEF_CONST(0.0521999036), COEF_CONST(0.0521999036), COEF_CONST(0.0521999036) }, + { COEF_CONST(0.6219832023), COEF_CONST(0.6161847276), COEF_CONST(0.6057251063), COEF_CONST(0.5654342668), COEF_CONST(0.4826149915), COEF_CONST(0.1058044758), COEF_CONST(0.1058044758), COEF_CONST(0.1058044758) }, + { COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657) }, + { COEF_CONST(0.7830305572), COEF_CONST(0.7876016373), COEF_CONST(0.7956739618), COEF_CONST(0.8247933372), COEF_CONST(0.8758325942), COEF_CONST(0.9943869542), COEF_CONST(0.9943869542), COEF_CONST(0.9943869542) }, + { COEF_CONST(0.8457261833), COEF_CONST(0.8525388778), COEF_CONST(0.8640737401), COEF_CONST(0.9004708933), COEF_CONST(0.9465802987), COEF_CONST(0.9986366532), COEF_CONST(0.9986366532), COEF_CONST(0.9986366532) }, + { COEF_CONST(0.8940022267), COEF_CONST(0.9009412572), COEF_CONST(0.9121477564), COEF_CONST(0.9431839770), COEF_CONST(0.9739696219), COEF_CONST(0.9994417480), COEF_CONST(0.9994417480), COEF_CONST(0.9994417480) }, + { COEF_CONST(0.9290818561), COEF_CONST(0.9349525662), COEF_CONST(0.9440420138), COEF_CONST(0.9667755833), COEF_CONST(0.9860247275), COEF_CONST(0.9997206664), COEF_CONST(0.9997206664), COEF_CONST(0.9997206664) }, + { COEF_CONST(0.9534625907), COEF_CONST(0.9579148236), COEF_CONST(0.9645845234), COEF_CONST(0.9801095128), COEF_CONST(0.9920207064), COEF_CONST(0.9998458099), COEF_CONST(0.9998458099), COEF_CONST(0.9998458099) }, + { COEF_CONST(0.9758449068), COEF_CONST(0.9784554646), COEF_CONST(0.9822404252), COEF_CONST(0.9904914275), COEF_CONST(0.9963218730), COEF_CONST(0.9999305926), COEF_CONST(0.9999305926), COEF_CONST(0.9999305926) }, + { COEF_CONST(0.9876723320), COEF_CONST(0.9890880155), COEF_CONST(0.9911036356), COEF_CONST(0.9953496173), COEF_CONST(0.9982312259), COEF_CONST(0.9999669685), COEF_CONST(0.9999669685), COEF_CONST(0.9999669685) }, + { COEF_CONST(0.9937641889), COEF_CONST(0.9945023501), COEF_CONST(0.9955433130), COEF_CONST(0.9976981117), COEF_CONST(0.9991315558), COEF_CONST(0.9999838610), COEF_CONST(0.9999838610), COEF_CONST(0.9999838610) }, + { COEF_CONST(0.9968600642), COEF_CONST(0.9972374385), COEF_CONST(0.9977670024), COEF_CONST(0.9988535464), COEF_CONST(0.9995691924), COEF_CONST(0.9999920129), COEF_CONST(0.9999920129), COEF_CONST(0.9999920129) }, + { COEF_CONST(0.9984226014), COEF_CONST(0.9986136287), COEF_CONST(0.9988810254), COEF_CONST(0.9994272242), COEF_CONST(0.9997851906), COEF_CONST(0.9999960221), COEF_CONST(0.9999960221), COEF_CONST(0.9999960221) }, + { COEF_CONST(0.9995003746), COEF_CONST(0.9995611974), COEF_CONST(0.9996461891), COEF_CONST(0.9998192657), COEF_CONST(0.9999323103), COEF_CONST(0.9999987475), COEF_CONST(0.9999987475), COEF_CONST(0.9999987475) }, + { COEF_CONST(0.9998419236), COEF_CONST(0.9998611991), COEF_CONST(0.9998881193), COEF_CONST(0.9999428861), COEF_CONST(0.9999786185), COEF_CONST(0.9999996045), COEF_CONST(0.9999996045), COEF_CONST(0.9999996045) }, + { COEF_CONST(0.9999500038), COEF_CONST(0.9999561034), COEF_CONST(0.9999646206), COEF_CONST(0.9999819429), COEF_CONST(0.9999932409), COEF_CONST(0.9999998750), COEF_CONST(0.9999998750), COEF_CONST(0.9999998750) }, + { COEF_CONST(0.9999841890), COEF_CONST(0.9999861183), COEF_CONST(0.9999888121), COEF_CONST(0.9999942902), COEF_CONST(0.9999978628), COEF_CONST(0.9999999605), COEF_CONST(0.9999999605), COEF_CONST(0.9999999605) }, + { COEF_CONST(0.9999950000), COEF_CONST(0.9999956102), COEF_CONST(0.9999964621), COEF_CONST(0.9999981945), COEF_CONST(0.9999993242), COEF_CONST(0.9999999875), COEF_CONST(0.9999999875), COEF_CONST(0.9999999875) } +}; + +static const real_t cos_gammas_normal[][8] = { + { COEF_CONST(1.0000000000), COEF_CONST(0.9841239707), COEF_CONST(0.9594738226), COEF_CONST(0.8946843024), COEF_CONST(0.8269341029), COEF_CONST(0.7245688486), COEF_CONST(0.7245688486), COEF_CONST(0.7245688486) }, + { COEF_CONST(1.0000000000), COEF_CONST(0.9849690570), COEF_CONST(0.9617776789), COEF_CONST(0.9020941550), COEF_CONST(0.8436830391), COEF_CONST(0.7846832804), COEF_CONST(0.7846832804), COEF_CONST(0.7846832804) }, + { COEF_CONST(1.0000000000), COEF_CONST(0.9871656089), COEF_CONST(0.9676774734), COEF_CONST(0.9199102884), COEF_CONST(0.8785067015), COEF_CONST(0.8464232214), COEF_CONST(0.8464232214), COEF_CONST(0.8464232214) }, + { COEF_CONST(1.0000000000), COEF_CONST(0.9913533967), COEF_CONST(0.9786000177), COEF_CONST(0.9496063381), COEF_CONST(0.9277157252), COEF_CONST(0.9133354077), COEF_CONST(0.9133354077), COEF_CONST(0.9133354077) }, + { COEF_CONST(1.0000000000), COEF_CONST(0.9948924435), COEF_CONST(0.9875319180), COEF_CONST(0.9716329849), COEF_CONST(0.9604805241), COEF_CONST(0.9535949574), COEF_CONST(0.9535949574), COEF_CONST(0.9535949574) }, + { COEF_CONST(1.0000000000), COEF_CONST(0.9977406278), COEF_CONST(0.9945423840), COEF_CONST(0.9878736667), COEF_CONST(0.9833980494), COEF_CONST(0.9807207440), COEF_CONST(0.9807207440), COEF_CONST(0.9807207440) }, + { COEF_CONST(1.0000000000), COEF_CONST(0.9990607067), COEF_CONST(0.9977417734), COEF_CONST(0.9950323970), COEF_CONST(0.9932453273), COEF_CONST(0.9921884740), COEF_CONST(0.9921884740), COEF_CONST(0.9921884740) }, + { COEF_CONST(1.0000000000), COEF_CONST(0.9998081748), COEF_CONST(0.9995400312), COEF_CONST(0.9989936459), COEF_CONST(0.9986365356), COEF_CONST(0.9984265591), COEF_CONST(0.9984265591), COEF_CONST(0.9984265591) } +}; + +static const real_t cos_gammas_fine[][8] = { + { COEF_CONST(1.0000000000), COEF_CONST(0.9841239707), COEF_CONST(0.9594738226), COEF_CONST(0.8946843024), COEF_CONST(0.8269341029), COEF_CONST(0.7245688486), COEF_CONST(0.7245688486), COEF_CONST(0.7245688486) }, + { COEF_CONST(1.0000000000), COEF_CONST(0.9849690570), COEF_CONST(0.9617776789), COEF_CONST(0.9020941550), COEF_CONST(0.8436830391), COEF_CONST(0.7846832804), COEF_CONST(0.7846832804), COEF_CONST(0.7846832804) }, + { COEF_CONST(1.0000000000), COEF_CONST(0.9871656089), COEF_CONST(0.9676774734), COEF_CONST(0.9199102884), COEF_CONST(0.8785067015), COEF_CONST(0.8464232214), COEF_CONST(0.8464232214), COEF_CONST(0.8464232214) }, + { COEF_CONST(1.0000000000), COEF_CONST(0.9899597309), COEF_CONST(0.9750098690), COEF_CONST(0.9402333855), COEF_CONST(0.9129698759), COEF_CONST(0.8943765944), COEF_CONST(0.8943765944), COEF_CONST(0.8943765944) }, + { COEF_CONST(1.0000000000), COEF_CONST(0.9926607607), COEF_CONST(0.9819295710), COEF_CONST(0.9580160104), COEF_CONST(0.9404993670), COEF_CONST(0.9293004472), COEF_CONST(0.9293004472), COEF_CONST(0.9293004472) }, + { COEF_CONST(1.0000000000), COEF_CONST(0.9948924435), COEF_CONST(0.9875319180), COEF_CONST(0.9716329849), COEF_CONST(0.9604805241), COEF_CONST(0.9535949574), COEF_CONST(0.9535949574), COEF_CONST(0.9535949574) }, + { COEF_CONST(1.0000000000), COEF_CONST(0.9972074644), COEF_CONST(0.9932414270), COEF_CONST(0.9849197629), COEF_CONST(0.9792926592), COEF_CONST(0.9759092525), COEF_CONST(0.9759092525), COEF_CONST(0.9759092525) }, + { COEF_CONST(1.0000000000), COEF_CONST(0.9985361982), COEF_CONST(0.9964742028), COEF_CONST(0.9922136306), COEF_CONST(0.9893845420), COEF_CONST(0.9877041371), COEF_CONST(0.9877041371), COEF_CONST(0.9877041371) }, + { COEF_CONST(1.0000000000), COEF_CONST(0.9992494366), COEF_CONST(0.9981967170), COEF_CONST(0.9960386625), COEF_CONST(0.9946185834), COEF_CONST(0.9937800239), COEF_CONST(0.9937800239), COEF_CONST(0.9937800239) }, + { COEF_CONST(1.0000000000), COEF_CONST(0.9996194722), COEF_CONST(0.9990869422), COEF_CONST(0.9979996269), COEF_CONST(0.9972873651), COEF_CONST(0.9968679747), COEF_CONST(0.9968679747), COEF_CONST(0.9968679747) }, + { COEF_CONST(1.0000000000), COEF_CONST(0.9998081748), COEF_CONST(0.9995400312), COEF_CONST(0.9989936459), COEF_CONST(0.9986365356), COEF_CONST(0.9984265591), COEF_CONST(0.9984265591), COEF_CONST(0.9984265591) }, + { COEF_CONST(1.0000000000), COEF_CONST(0.9999390971), COEF_CONST(0.9998540271), COEF_CONST(0.9996809352), COEF_CONST(0.9995679735), COEF_CONST(0.9995016284), COEF_CONST(0.9995016284), COEF_CONST(0.9995016284) }, + { COEF_CONST(1.0000000000), COEF_CONST(0.9999807170), COEF_CONST(0.9999537862), COEF_CONST(0.9998990191), COEF_CONST(0.9998632947), COEF_CONST(0.9998423208), COEF_CONST(0.9998423208), COEF_CONST(0.9998423208) }, + { COEF_CONST(1.0000000000), COEF_CONST(0.9999938979), COEF_CONST(0.9999853814), COEF_CONST(0.9999680568), COEF_CONST(0.9999567596), COEF_CONST(0.9999501270), COEF_CONST(0.9999501270), COEF_CONST(0.9999501270) }, + { COEF_CONST(1.0000000000), COEF_CONST(0.9999980703), COEF_CONST(0.9999953731), COEF_CONST(0.9999898968), COEF_CONST(0.9999863277), COEF_CONST(0.9999842265), COEF_CONST(0.9999842265), COEF_CONST(0.9999842265) }, + { COEF_CONST(1.0000000000), COEF_CONST(0.9999993891), COEF_CONST(0.9999985397), COEF_CONST(0.9999968037), COEF_CONST(0.9999956786), COEF_CONST(0.9999950155), COEF_CONST(0.9999950155), COEF_CONST(0.9999950155) } +}; + +static const real_t sin_gammas_normal[][8] = { + { COEF_CONST(0.0000000000), COEF_CONST(0.1774824223), COEF_CONST(0.2817977711), COEF_CONST(0.4466990028), COEF_CONST(0.5622988435), COEF_CONST(0.6892024258), COEF_CONST(0.6892024258), COEF_CONST(0.6892024258) }, + { COEF_CONST(0.0000000000), COEF_CONST(0.1727308798), COEF_CONST(0.2738315110), COEF_CONST(0.4315392630), COEF_CONST(0.5368416242), COEF_CONST(0.6198968861), COEF_CONST(0.6198968861), COEF_CONST(0.6198968861) }, + { COEF_CONST(0.0000000000), COEF_CONST(0.1596999079), COEF_CONST(0.2521910140), COEF_CONST(0.3921288836), COEF_CONST(0.4777300236), COEF_CONST(0.5325107795), COEF_CONST(0.5325107795), COEF_CONST(0.5325107795) }, + { COEF_CONST(0.0000000000), COEF_CONST(0.1312190642), COEF_CONST(0.2057717310), COEF_CONST(0.3134450552), COEF_CONST(0.3732874674), COEF_CONST(0.4072080955), COEF_CONST(0.4072080955), COEF_CONST(0.4072080955) }, + { COEF_CONST(0.0000000000), COEF_CONST(0.1009407043), COEF_CONST(0.1574189028), COEF_CONST(0.2364938532), COEF_CONST(0.2783471983), COEF_CONST(0.3010924396), COEF_CONST(0.3010924396), COEF_CONST(0.3010924396) }, + { COEF_CONST(0.0000000000), COEF_CONST(0.0671836269), COEF_CONST(0.1043333428), COEF_CONST(0.1552598422), COEF_CONST(0.1814615013), COEF_CONST(0.1954144885), COEF_CONST(0.1954144885), COEF_CONST(0.1954144885) }, + { COEF_CONST(0.0000000000), COEF_CONST(0.0433324862), COEF_CONST(0.0671666110), COEF_CONST(0.0995516398), COEF_CONST(0.1160332699), COEF_CONST(0.1247478739), COEF_CONST(0.1247478739), COEF_CONST(0.1247478739) }, + { COEF_CONST(0.0000000000), COEF_CONST(0.0195860576), COEF_CONST(0.0303269852), COEF_CONST(0.0448519274), COEF_CONST(0.0522022017), COEF_CONST(0.0560750040), COEF_CONST(0.0560750040), COEF_CONST(0.0560750040) } +}; + +static const real_t sin_gammas_fine[][8] = { + { COEF_CONST(0.0000000000), COEF_CONST(0.1774824223), COEF_CONST(0.2817977711), COEF_CONST(0.4466990028), COEF_CONST(0.5622988435), COEF_CONST(0.6892024258), COEF_CONST(0.6892024258), COEF_CONST(0.6892024258) }, + { COEF_CONST(0.0000000000), COEF_CONST(0.1727308798), COEF_CONST(0.2738315110), COEF_CONST(0.4315392630), COEF_CONST(0.5368416242), COEF_CONST(0.6198968861), COEF_CONST(0.6198968861), COEF_CONST(0.6198968861) }, + { COEF_CONST(0.0000000000), COEF_CONST(0.1596999079), COEF_CONST(0.2521910140), COEF_CONST(0.3921288836), COEF_CONST(0.4777300236), COEF_CONST(0.5325107795), COEF_CONST(0.5325107795), COEF_CONST(0.5325107795) }, + { COEF_CONST(0.0000000000), COEF_CONST(0.1413496768), COEF_CONST(0.2221615526), COEF_CONST(0.3405307340), COEF_CONST(0.4080269669), COEF_CONST(0.4473147744), COEF_CONST(0.4473147744), COEF_CONST(0.4473147744) }, + { COEF_CONST(0.0000000000), COEF_CONST(0.1209322714), COEF_CONST(0.1892467110), COEF_CONST(0.2867147079), COEF_CONST(0.3397954394), COEF_CONST(0.3693246252), COEF_CONST(0.3693246252), COEF_CONST(0.3693246252) }, + { COEF_CONST(0.0000000000), COEF_CONST(0.1009407043), COEF_CONST(0.1574189028), COEF_CONST(0.2364938532), COEF_CONST(0.2783471983), COEF_CONST(0.3010924396), COEF_CONST(0.3010924396), COEF_CONST(0.3010924396) }, + { COEF_CONST(0.0000000000), COEF_CONST(0.0746811420), COEF_CONST(0.1160666523), COEF_CONST(0.1730117353), COEF_CONST(0.2024497161), COEF_CONST(0.2181768341), COEF_CONST(0.2181768341), COEF_CONST(0.2181768341) }, + { COEF_CONST(0.0000000000), COEF_CONST(0.0540875291), COEF_CONST(0.0838997203), COEF_CONST(0.1245476266), COEF_CONST(0.1453211203), COEF_CONST(0.1563346972), COEF_CONST(0.1563346972), COEF_CONST(0.1563346972) }, + { COEF_CONST(0.0000000000), COEF_CONST(0.0387371058), COEF_CONST(0.0600276114), COEF_CONST(0.0889212171), COEF_CONST(0.1036044086), COEF_CONST(0.1113609634), COEF_CONST(0.1113609634), COEF_CONST(0.1113609634) }, + { COEF_CONST(0.0000000000), COEF_CONST(0.0275846110), COEF_CONST(0.0427233177), COEF_CONST(0.0632198125), COEF_CONST(0.0736064637), COEF_CONST(0.0790837596), COEF_CONST(0.0790837596), COEF_CONST(0.0790837596) }, + { COEF_CONST(0.0000000000), COEF_CONST(0.0195860576), COEF_CONST(0.0303269852), COEF_CONST(0.0448519274), COEF_CONST(0.0522022017), COEF_CONST(0.0560750040), COEF_CONST(0.0560750040), COEF_CONST(0.0560750040) }, + { COEF_CONST(0.0000000000), COEF_CONST(0.0110363955), COEF_CONST(0.0170857974), COEF_CONST(0.0252592108), COEF_CONST(0.0293916021), COEF_CONST(0.0315673054), COEF_CONST(0.0315673054), COEF_CONST(0.0315673054) }, + { COEF_CONST(0.0000000000), COEF_CONST(0.0062101284), COEF_CONST(0.0096138203), COEF_CONST(0.0142109649), COEF_CONST(0.0165345659), COEF_CONST(0.0177576316), COEF_CONST(0.0177576316), COEF_CONST(0.0177576316) }, + { COEF_CONST(0.0000000000), COEF_CONST(0.0034934509), COEF_CONST(0.0054071189), COEF_CONST(0.0079928316), COEF_CONST(0.0092994041), COEF_CONST(0.0099871631), COEF_CONST(0.0099871631), COEF_CONST(0.0099871631) }, + { COEF_CONST(0.0000000000), COEF_CONST(0.0019645397), COEF_CONST(0.0030419905), COEF_CONST(0.0044951511), COEF_CONST(0.0052291853), COEF_CONST(0.0056166498), COEF_CONST(0.0056166498), COEF_CONST(0.0056166498) }, + { COEF_CONST(0.0000000000), COEF_CONST(0.0011053943), COEF_CONST(0.0017089869), COEF_CONST(0.0025283670), COEF_CONST(0.0029398552), COEF_CONST(0.0031573685), COEF_CONST(0.0031573685), COEF_CONST(0.0031573685) } +}; + +static const real_t sf_iid_normal[] = { + COEF_CONST(1.4119827747), COEF_CONST(1.4031381607), COEF_CONST(1.3868767023), + COEF_CONST(1.3483997583), COEF_CONST(1.2912493944), COEF_CONST(1.1960374117), + COEF_CONST(1.1073724031), COEF_CONST(1.0000000000), COEF_CONST(0.8796171546), + COEF_CONST(0.7546485662), COEF_CONST(0.5767799020), COEF_CONST(0.4264014363), + COEF_CONST(0.2767182887), COEF_CONST(0.1766446233), COEF_CONST(0.0794016272) +}; + +static const real_t sf_iid_fine[] = { + COEF_CONST(1.4142065048), COEF_CONST(1.4141912460), COEF_CONST(1.4141428471), + COEF_CONST(1.4139900208), COEF_CONST(1.4135069847), COEF_CONST(1.4119827747), + COEF_CONST(1.4097729921), COEF_CONST(1.4053947926), COEF_CONST(1.3967796564), + COEF_CONST(1.3800530434), COEF_CONST(1.3483997583), COEF_CONST(1.3139201403), + COEF_CONST(1.2643101215), COEF_CONST(1.1960374117), COEF_CONST(1.1073724031), + COEF_CONST(1.0000000000), COEF_CONST(0.8796171546), COEF_CONST(0.7546485662), + COEF_CONST(0.6336560845), COEF_CONST(0.5230810642), COEF_CONST(0.4264014363), + COEF_CONST(0.3089554012), COEF_CONST(0.2213746458), COEF_CONST(0.1576878875), + COEF_CONST(0.1119822487), COEF_CONST(0.0794016272), COEF_CONST(0.0446990170), + COEF_CONST(0.0251446925), COEF_CONST(0.0141414283), COEF_CONST(0.0079525812), + COEF_CONST(0.0044721137) +}; + +#ifdef __cplusplus + +#endif +#endif + diff --git a/Libraries/FAAD2/Files/libfaad/pulse.c b/Libraries/FAAD2/Files/libfaad/pulse.c new file mode 100644 index 000000000..d75877db7 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/pulse.c @@ -0,0 +1,56 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#include "common.h" +#include "structs.h" + +#include "syntax.h" +#include "pulse.h" + +uint8_t pulse_decode(ic_stream *ics, int16_t *spec_data, uint16_t framelen) +{ + uint8_t i; + uint16_t k; + pulse_info *pul = &(ics->pul); + + k = ics->swb_offset[pul->pulse_start_sfb]; + + for (i = 0; i <= pul->number_pulse; i++) + { + k += pul->pulse_offset[i]; + + if (k >= framelen) + return 15; /* should not be possible */ + + if (spec_data[k] > 0) + spec_data[k] += pul->pulse_amp[i]; + else + spec_data[k] -= pul->pulse_amp[i]; + } + + return 0; +} diff --git a/Libraries/FAAD2/Files/libfaad/pulse.h b/Libraries/FAAD2/Files/libfaad/pulse.h new file mode 100644 index 000000000..84d7fd38d --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/pulse.h @@ -0,0 +1,40 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#ifndef __PULSE_H__ +#define __PULSE_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +uint8_t pulse_decode(ic_stream *ics, int16_t *spec_coef, uint16_t framelen); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/Libraries/FAAD2/Files/libfaad/rvlc.c b/Libraries/FAAD2/Files/libfaad/rvlc.c new file mode 100644 index 000000000..5b17edd06 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/rvlc.c @@ -0,0 +1,530 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +/* RVLC scalefactor decoding + * + * RVLC works like this: + * 1. Only symmetric huffman codewords are used + * 2. Total length of the scalefactor data is stored in the bitsream + * 3. Scalefactors are DPCM coded + * 4. Next to the starting value for DPCM the ending value is also stored + * + * With all this it is possible to read the scalefactor data from 2 sides. + * If there is a bit error in the scalefactor data it is possible to start + * decoding from the other end of the data, to find all but 1 scalefactor. + */ + +#include "common.h" +#include "structs.h" + +#include + +#include "syntax.h" +#include "bits.h" +#include "rvlc.h" + + +#ifdef ERROR_RESILIENCE + +//#define PRINT_RVLC + +/* static function declarations */ +static uint8_t rvlc_decode_sf_forward(ic_stream *ics, + bitfile *ld_sf, + bitfile *ld_esc, + uint8_t *is_used); +#if 0 +static uint8_t rvlc_decode_sf_reverse(ic_stream *ics, + bitfile *ld_sf, + bitfile *ld_esc, + uint8_t is_used); +#endif +static int8_t rvlc_huffman_sf(bitfile *ld_sf, bitfile *ld_esc, + int8_t direction); +static int8_t rvlc_huffman_esc(bitfile *ld_esc, int8_t direction); + + +uint8_t rvlc_scale_factor_data(ic_stream *ics, bitfile *ld) +{ + uint8_t bits = 9; + + ics->sf_concealment = faad_get1bit(ld + DEBUGVAR(1,149,"rvlc_scale_factor_data(): sf_concealment")); + ics->rev_global_gain = (uint8_t)faad_getbits(ld, 8 + DEBUGVAR(1,150,"rvlc_scale_factor_data(): rev_global_gain")); + + if (ics->window_sequence == EIGHT_SHORT_SEQUENCE) + bits = 11; + + /* the number of bits used for the huffman codewords */ + ics->length_of_rvlc_sf = (uint16_t)faad_getbits(ld, bits + DEBUGVAR(1,151,"rvlc_scale_factor_data(): length_of_rvlc_sf")); + + if (ics->noise_used) + { + ics->dpcm_noise_nrg = (uint16_t)faad_getbits(ld, 9 + DEBUGVAR(1,152,"rvlc_scale_factor_data(): dpcm_noise_nrg")); + + ics->length_of_rvlc_sf -= 9; + } + + ics->sf_escapes_present = faad_get1bit(ld + DEBUGVAR(1,153,"rvlc_scale_factor_data(): sf_escapes_present")); + + if (ics->sf_escapes_present) + { + ics->length_of_rvlc_escapes = (uint8_t)faad_getbits(ld, 8 + DEBUGVAR(1,154,"rvlc_scale_factor_data(): length_of_rvlc_escapes")); + } + + if (ics->noise_used) + { + ics->dpcm_noise_last_position = (uint16_t)faad_getbits(ld, 9 + DEBUGVAR(1,155,"rvlc_scale_factor_data(): dpcm_noise_last_position")); + } + + return 0; +} + +uint8_t rvlc_decode_scale_factors(ic_stream *ics, bitfile *ld) +{ + uint8_t result; + uint8_t intensity_used = 0; + uint8_t *rvlc_sf_buffer = NULL; + uint8_t *rvlc_esc_buffer = NULL; + bitfile ld_rvlc_sf, ld_rvlc_esc; +// bitfile ld_rvlc_sf_rev, ld_rvlc_esc_rev; + + if (ics->length_of_rvlc_sf > 0) + { + /* We read length_of_rvlc_sf bits here to put it in a + seperate bitfile. + */ + rvlc_sf_buffer = faad_getbitbuffer(ld, ics->length_of_rvlc_sf + DEBUGVAR(1,156,"rvlc_decode_scale_factors(): bitbuffer: length_of_rvlc_sf")); + + faad_initbits(&ld_rvlc_sf, (void*)rvlc_sf_buffer, bit2byte(ics->length_of_rvlc_sf)); +// faad_initbits_rev(&ld_rvlc_sf_rev, (void*)rvlc_sf_buffer, +// ics->length_of_rvlc_sf); + } + + if (ics->sf_escapes_present) + { + /* We read length_of_rvlc_escapes bits here to put it in a + seperate bitfile. + */ + rvlc_esc_buffer = faad_getbitbuffer(ld, ics->length_of_rvlc_escapes + DEBUGVAR(1,157,"rvlc_decode_scale_factors(): bitbuffer: length_of_rvlc_escapes")); + + faad_initbits(&ld_rvlc_esc, (void*)rvlc_esc_buffer, bit2byte(ics->length_of_rvlc_escapes)); +// faad_initbits_rev(&ld_rvlc_esc_rev, (void*)rvlc_esc_buffer, +// ics->length_of_rvlc_escapes); + } + + /* decode the rvlc scale factors and escapes */ + result = rvlc_decode_sf_forward(ics, &ld_rvlc_sf, + &ld_rvlc_esc, &intensity_used); +// result = rvlc_decode_sf_reverse(ics, &ld_rvlc_sf_rev, +// &ld_rvlc_esc_rev, intensity_used); + + + if (rvlc_esc_buffer) faad_free(rvlc_esc_buffer); + if (rvlc_sf_buffer) faad_free(rvlc_sf_buffer); + + if (ics->length_of_rvlc_sf > 0) + faad_endbits(&ld_rvlc_sf); + if (ics->sf_escapes_present) + faad_endbits(&ld_rvlc_esc); + + return result; +} + +static uint8_t rvlc_decode_sf_forward(ic_stream *ics, bitfile *ld_sf, bitfile *ld_esc, + uint8_t *intensity_used) +{ + int8_t g, sfb; + int8_t t = 0; + int8_t error = 0; + int8_t noise_pcm_flag = 1; + + int16_t scale_factor = ics->global_gain; + int16_t is_position = 0; + int16_t noise_energy = ics->global_gain - 90 - 256; + +#ifdef PRINT_RVLC + printf("\nglobal_gain: %d\n", ics->global_gain); +#endif + + for (g = 0; g < ics->num_window_groups; g++) + { + for (sfb = 0; sfb < ics->max_sfb; sfb++) + { + if (error) + { + ics->scale_factors[g][sfb] = 0; + } else { + switch (ics->sfb_cb[g][sfb]) + { + case ZERO_HCB: /* zero book */ + ics->scale_factors[g][sfb] = 0; + break; + case INTENSITY_HCB: /* intensity books */ + case INTENSITY_HCB2: + + *intensity_used = 1; + + /* decode intensity position */ + t = rvlc_huffman_sf(ld_sf, ld_esc, +1); + + is_position += t; + ics->scale_factors[g][sfb] = is_position; + + break; + case NOISE_HCB: /* noise books */ + + /* decode noise energy */ + if (noise_pcm_flag) + { + int16_t n = ics->dpcm_noise_nrg; + noise_pcm_flag = 0; + noise_energy += n; + } else { + t = rvlc_huffman_sf(ld_sf, ld_esc, +1); + noise_energy += t; + } + + ics->scale_factors[g][sfb] = noise_energy; + + break; + default: /* spectral books */ + + /* decode scale factor */ + t = rvlc_huffman_sf(ld_sf, ld_esc, +1); + + scale_factor += t; + if (scale_factor < 0) + return 4; + + ics->scale_factors[g][sfb] = scale_factor; + + break; + } +#ifdef PRINT_RVLC + printf("%3d:%4d%4d\n", sfb, ics->sfb_cb[g][sfb], + ics->scale_factors[g][sfb]); +#endif + if (t == 99) + { + error = 1; + } + } + } + } +#ifdef PRINT_RVLC + printf("\n\n"); +#endif + + return 0; +} + +#if 0 // not used right now, doesn't work correctly yet +static uint8_t rvlc_decode_sf_reverse(ic_stream *ics, bitfile *ld_sf, bitfile *ld_esc, + uint8_t intensity_used) +{ + int8_t g, sfb; + int8_t t = 0; + int8_t error = 0; + int8_t noise_pcm_flag = 1, is_pcm_flag = 1, sf_pcm_flag = 1; + + int16_t scale_factor = ics->rev_global_gain; + int16_t is_position = 0; + int16_t noise_energy = ics->rev_global_gain; + +#ifdef PRINT_RVLC + printf("\nrev_global_gain: %d\n", ics->rev_global_gain); +#endif + + if (intensity_used) + { + is_position = rvlc_huffman_sf(ld_sf, ld_esc, -1); +#ifdef PRINT_RVLC + printf("is_position: %d\n", is_position); +#endif + } + + for (g = ics->num_window_groups-1; g >= 0; g--) + { + for (sfb = ics->max_sfb-1; sfb >= 0; sfb--) + { + if (error) + { + ics->scale_factors[g][sfb] = 0; + } else { + switch (ics->sfb_cb[g][sfb]) + { + case ZERO_HCB: /* zero book */ + ics->scale_factors[g][sfb] = 0; + break; + case INTENSITY_HCB: /* intensity books */ + case INTENSITY_HCB2: + + if (is_pcm_flag) + { + is_pcm_flag = 0; + ics->scale_factors[g][sfb] = is_position; + } else { + t = rvlc_huffman_sf(ld_sf, ld_esc, -1); + is_position -= t; + + ics->scale_factors[g][sfb] = (uint8_t)is_position; + } + break; + case NOISE_HCB: /* noise books */ + + /* decode noise energy */ + if (noise_pcm_flag) + { + noise_pcm_flag = 0; + noise_energy = ics->dpcm_noise_last_position; + } else { + t = rvlc_huffman_sf(ld_sf, ld_esc, -1); + noise_energy -= t; + } + + ics->scale_factors[g][sfb] = (uint8_t)noise_energy; + break; + default: /* spectral books */ + + if (sf_pcm_flag || (sfb == 0)) + { + sf_pcm_flag = 0; + if (sfb == 0) + scale_factor = ics->global_gain; + } else { + /* decode scale factor */ + t = rvlc_huffman_sf(ld_sf, ld_esc, -1); + scale_factor -= t; + } + + if (scale_factor < 0) + return 4; + + ics->scale_factors[g][sfb] = (uint8_t)scale_factor; + break; + } +#ifdef PRINT_RVLC + printf("%3d:%4d%4d\n", sfb, ics->sfb_cb[g][sfb], + ics->scale_factors[g][sfb]); +#endif + if (t == 99) + { + error = 1; + } + } + } + } + +#ifdef PRINT_RVLC + printf("\n\n"); +#endif + + return 0; +} +#endif + +/* index == 99 means not allowed codeword */ +static rvlc_huff_table book_rvlc[] = { + /*index length codeword */ + { 0, 1, 0 }, /* 0 */ + { -1, 3, 5 }, /* 101 */ + { 1, 3, 7 }, /* 111 */ + { -2, 4, 9 }, /* 1001 */ + { -3, 5, 17 }, /* 10001 */ + { 2, 5, 27 }, /* 11011 */ + { -4, 6, 33 }, /* 100001 */ + { 99, 6, 50 }, /* 110010 */ + { 3, 6, 51 }, /* 110011 */ + { 99, 6, 52 }, /* 110100 */ + { -7, 7, 65 }, /* 1000001 */ + { 99, 7, 96 }, /* 1100000 */ + { 99, 7, 98 }, /* 1100010 */ + { 7, 7, 99 }, /* 1100011 */ + { 4, 7, 107 }, /* 1101011 */ + { -5, 8, 129 }, /* 10000001 */ + { 99, 8, 194 }, /* 11000010 */ + { 5, 8, 195 }, /* 11000011 */ + { 99, 8, 212 }, /* 11010100 */ + { 99, 9, 256 }, /* 100000000 */ + { -6, 9, 257 }, /* 100000001 */ + { 99, 9, 426 }, /* 110101010 */ + { 6, 9, 427 }, /* 110101011 */ + { 99, 10, 0 } /* Shouldn't come this far */ +}; + +static rvlc_huff_table book_escape[] = { + /*index length codeword */ + { 1, 2, 0 }, + { 0, 2, 2 }, + { 3, 3, 2 }, + { 2, 3, 6 }, + { 4, 4, 14 }, + { 7, 5, 13 }, + { 6, 5, 15 }, + { 5, 5, 31 }, + { 11, 6, 24 }, + { 10, 6, 25 }, + { 9, 6, 29 }, + { 8, 6, 61 }, + { 13, 7, 56 }, + { 12, 7, 120 }, + { 15, 8, 114 }, + { 14, 8, 242 }, + { 17, 9, 230 }, + { 16, 9, 486 }, + { 19, 10, 463 }, + { 18, 10, 974 }, + { 22, 11, 925 }, + { 20, 11, 1950 }, + { 21, 11, 1951 }, + { 23, 12, 1848 }, + { 25, 13, 3698 }, + { 24, 14, 7399 }, + { 26, 15, 14797 }, + { 49, 19, 236736 }, + { 50, 19, 236737 }, + { 51, 19, 236738 }, + { 52, 19, 236739 }, + { 53, 19, 236740 }, + { 27, 20, 473482 }, + { 28, 20, 473483 }, + { 29, 20, 473484 }, + { 30, 20, 473485 }, + { 31, 20, 473486 }, + { 32, 20, 473487 }, + { 33, 20, 473488 }, + { 34, 20, 473489 }, + { 35, 20, 473490 }, + { 36, 20, 473491 }, + { 37, 20, 473492 }, + { 38, 20, 473493 }, + { 39, 20, 473494 }, + { 40, 20, 473495 }, + { 41, 20, 473496 }, + { 42, 20, 473497 }, + { 43, 20, 473498 }, + { 44, 20, 473499 }, + { 45, 20, 473500 }, + { 46, 20, 473501 }, + { 47, 20, 473502 }, + { 48, 20, 473503 }, + { 99, 21, 0 } /* Shouldn't come this far */ +}; + +static int8_t rvlc_huffman_sf(bitfile *ld_sf, bitfile *ld_esc, + int8_t direction) +{ + uint8_t i, j; + int8_t index; + uint32_t cw; + rvlc_huff_table *h = book_rvlc; + + i = h->len; + if (direction > 0) + cw = faad_getbits(ld_sf, i DEBUGVAR(1,0,"")); + else + cw = faad_getbits_rev(ld_sf, i DEBUGVAR(1,0,"")); + + while ((cw != h->cw) + && (i < 10)) + { + h++; + j = h->len-i; + i += j; + cw <<= j; + if (direction > 0) + cw |= faad_getbits(ld_sf, j DEBUGVAR(1,0,"")); + else + cw |= faad_getbits_rev(ld_sf, j DEBUGVAR(1,0,"")); + } + + index = h->index; + + if (index == +ESC_VAL) + { + int8_t esc = rvlc_huffman_esc(ld_esc, direction); + if (esc == 99) + return 99; + index += esc; +#ifdef PRINT_RVLC + printf("esc: %d - ", esc); +#endif + } + if (index == -ESC_VAL) + { + int8_t esc = rvlc_huffman_esc(ld_esc, direction); + if (esc == 99) + return 99; + index -= esc; +#ifdef PRINT_RVLC + printf("esc: %d - ", esc); +#endif + } + + return index; +} + +static int8_t rvlc_huffman_esc(bitfile *ld, + int8_t direction) +{ + uint8_t i, j; + uint32_t cw; + rvlc_huff_table *h = book_escape; + + i = h->len; + if (direction > 0) + cw = faad_getbits(ld, i DEBUGVAR(1,0,"")); + else + cw = faad_getbits_rev(ld, i DEBUGVAR(1,0,"")); + + while ((cw != h->cw) + && (i < 21)) + { + h++; + j = h->len-i; + i += j; + cw <<= j; + if (direction > 0) + cw |= faad_getbits(ld, j DEBUGVAR(1,0,"")); + else + cw |= faad_getbits_rev(ld, j DEBUGVAR(1,0,"")); + } + + return h->index; +} + +#endif + diff --git a/Libraries/FAAD2/Files/libfaad/rvlc.h b/Libraries/FAAD2/Files/libfaad/rvlc.h new file mode 100644 index 000000000..b17246a45 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/rvlc.h @@ -0,0 +1,53 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#ifndef __RVLC_SCF_H__ +#define __RVLC_SCF_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct +{ + int8_t index; + uint8_t len; + uint32_t cw; +} rvlc_huff_table; + + +#define ESC_VAL 7 + + +uint8_t rvlc_scale_factor_data(ic_stream *ics, bitfile *ld); +uint8_t rvlc_decode_scale_factors(ic_stream *ics, bitfile *ld); + + +#ifdef __cplusplus +} +#endif +#endif diff --git a/Libraries/FAAD2/Files/libfaad/sbr_dct.c b/Libraries/FAAD2/Files/libfaad/sbr_dct.c new file mode 100644 index 000000000..dbfbb8945 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/sbr_dct.c @@ -0,0 +1,2271 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#include "common.h" + +#ifdef SBR_DEC + +#ifdef _MSC_VER +#pragma warning(disable:4305) +#pragma warning(disable:4244) +#endif + + +#include "sbr_dct.h" + +void DCT4_32(real_t *y, real_t *x) +{ + real_t f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10; + real_t f11, f12, f13, f14, f15, f16, f17, f18, f19, f20; + real_t f21, f22, f23, f24, f25, f26, f27, f28, f29, f30; + real_t f31, f32, f33, f34, f35, f36, f37, f38, f39, f40; + real_t f41, f42, f43, f44, f45, f46, f47, f48, f49, f50; + real_t f51, f52, f53, f54, f55, f56, f57, f58, f59, f60; + real_t f61, f62, f63, f64, f65, f66, f67, f68, f69, f70; + real_t f71, f72, f73, f74, f75, f76, f77, f78, f79, f80; + real_t f81, f82, f83, f84, f85, f86, f87, f88, f89, f90; + real_t f91, f92, f93, f94, f95, f96, f97, f98, f99, f100; + real_t f101, f102, f103, f104, f105, f106, f107, f108, f109, f110; + real_t f111, f112, f113, f114, f115, f116, f117, f118, f119, f120; + real_t f121, f122, f123, f124, f125, f126, f127, f128, f129, f130; + real_t f131, f132, f133, f134, f135, f136, f137, f138, f139, f140; + real_t f141, f142, f143, f144, f145, f146, f147, f148, f149, f150; + real_t f151, f152, f153, f154, f155, f156, f157, f158, f159, f160; + real_t f161, f162, f163, f164, f165, f166, f167, f168, f169, f170; + real_t f171, f172, f173, f174, f175, f176, f177, f178, f179, f180; + real_t f181, f182, f183, f184, f185, f186, f187, f188, f189, f190; + real_t f191, f192, f193, f194, f195, f196, f197, f198, f199, f200; + real_t f201, f202, f203, f204, f205, f206, f207, f208, f209, f210; + real_t f211, f212, f213, f214, f215, f216, f217, f218, f219, f220; + real_t f221, f222, f223, f224, f225, f226, f227, f228, f229, f230; + real_t f231, f232, f233, f234, f235, f236, f237, f238, f239, f240; + real_t f241, f242, f243, f244, f245, f246, f247, f248, f249, f250; + real_t f251, f252, f253, f254, f255, f256, f257, f258, f259, f260; + real_t f261, f262, f263, f264, f265, f266, f267, f268, f269, f270; + real_t f271, f272, f273, f274, f275, f276, f277, f278, f279, f280; + real_t f281, f282, f283, f284, f285, f286, f287, f288, f289, f290; + real_t f291, f292, f293, f294, f295, f296, f297, f298, f299, f300; + real_t f301, f302, f303, f304, f305, f306, f307, f310, f311, f312; + real_t f313, f316, f317, f318, f319, f322, f323, f324, f325, f328; + real_t f329, f330, f331, f334, f335, f336, f337, f340, f341, f342; + real_t f343, f346, f347, f348, f349, f352, f353, f354, f355, f358; + real_t f359, f360, f361, f364, f365, f366, f367, f370, f371, f372; + real_t f373, f376, f377, f378, f379, f382, f383, f384, f385, f388; + real_t f389, f390, f391, f394, f395, f396, f397; + + f0 = x[15] - x[16]; + f1 = x[15] + x[16]; + f2 = MUL_F(FRAC_CONST(0.7071067811865476), f1); + f3 = MUL_F(FRAC_CONST(0.7071067811865476), f0); + f4 = x[8] - x[23]; + f5 = x[8] + x[23]; + f6 = MUL_F(FRAC_CONST(0.7071067811865476), f5); + f7 = MUL_F(FRAC_CONST(0.7071067811865476), f4); + f8 = x[12] - x[19]; + f9 = x[12] + x[19]; + f10 = MUL_F(FRAC_CONST(0.7071067811865476), f9); + f11 = MUL_F(FRAC_CONST(0.7071067811865476), f8); + f12 = x[11] - x[20]; + f13 = x[11] + x[20]; + f14 = MUL_F(FRAC_CONST(0.7071067811865476), f13); + f15 = MUL_F(FRAC_CONST(0.7071067811865476), f12); + f16 = x[14] - x[17]; + f17 = x[14] + x[17]; + f18 = MUL_F(FRAC_CONST(0.7071067811865476), f17); + f19 = MUL_F(FRAC_CONST(0.7071067811865476), f16); + f20 = x[9] - x[22]; + f21 = x[9] + x[22]; + f22 = MUL_F(FRAC_CONST(0.7071067811865476), f21); + f23 = MUL_F(FRAC_CONST(0.7071067811865476), f20); + f24 = x[13] - x[18]; + f25 = x[13] + x[18]; + f26 = MUL_F(FRAC_CONST(0.7071067811865476), f25); + f27 = MUL_F(FRAC_CONST(0.7071067811865476), f24); + f28 = x[10] - x[21]; + f29 = x[10] + x[21]; + f30 = MUL_F(FRAC_CONST(0.7071067811865476), f29); + f31 = MUL_F(FRAC_CONST(0.7071067811865476), f28); + f32 = x[0] - f2; + f33 = x[0] + f2; + f34 = x[31] - f3; + f35 = x[31] + f3; + f36 = x[7] - f6; + f37 = x[7] + f6; + f38 = x[24] - f7; + f39 = x[24] + f7; + f40 = x[3] - f10; + f41 = x[3] + f10; + f42 = x[28] - f11; + f43 = x[28] + f11; + f44 = x[4] - f14; + f45 = x[4] + f14; + f46 = x[27] - f15; + f47 = x[27] + f15; + f48 = x[1] - f18; + f49 = x[1] + f18; + f50 = x[30] - f19; + f51 = x[30] + f19; + f52 = x[6] - f22; + f53 = x[6] + f22; + f54 = x[25] - f23; + f55 = x[25] + f23; + f56 = x[2] - f26; + f57 = x[2] + f26; + f58 = x[29] - f27; + f59 = x[29] + f27; + f60 = x[5] - f30; + f61 = x[5] + f30; + f62 = x[26] - f31; + f63 = x[26] + f31; + f64 = f39 + f37; + f65 = MUL_F(FRAC_CONST(-0.5411961001461969), f39); + f66 = MUL_F(FRAC_CONST(0.9238795325112867), f64); + f67 = MUL_C(COEF_CONST(1.3065629648763766), f37); + f68 = f65 + f66; + f69 = f67 - f66; + f70 = f38 + f36; + f71 = MUL_C(COEF_CONST(1.3065629648763770), f38); + f72 = MUL_F(FRAC_CONST(-0.3826834323650904), f70); + f73 = MUL_F(FRAC_CONST(0.5411961001461961), f36); + f74 = f71 + f72; + f75 = f73 - f72; + f76 = f47 + f45; + f77 = MUL_F(FRAC_CONST(-0.5411961001461969), f47); + f78 = MUL_F(FRAC_CONST(0.9238795325112867), f76); + f79 = MUL_C(COEF_CONST(1.3065629648763766), f45); + f80 = f77 + f78; + f81 = f79 - f78; + f82 = f46 + f44; + f83 = MUL_C(COEF_CONST(1.3065629648763770), f46); + f84 = MUL_F(FRAC_CONST(-0.3826834323650904), f82); + f85 = MUL_F(FRAC_CONST(0.5411961001461961), f44); + f86 = f83 + f84; + f87 = f85 - f84; + f88 = f55 + f53; + f89 = MUL_F(FRAC_CONST(-0.5411961001461969), f55); + f90 = MUL_F(FRAC_CONST(0.9238795325112867), f88); + f91 = MUL_C(COEF_CONST(1.3065629648763766), f53); + f92 = f89 + f90; + f93 = f91 - f90; + f94 = f54 + f52; + f95 = MUL_C(COEF_CONST(1.3065629648763770), f54); + f96 = MUL_F(FRAC_CONST(-0.3826834323650904), f94); + f97 = MUL_F(FRAC_CONST(0.5411961001461961), f52); + f98 = f95 + f96; + f99 = f97 - f96; + f100 = f63 + f61; + f101 = MUL_F(FRAC_CONST(-0.5411961001461969), f63); + f102 = MUL_F(FRAC_CONST(0.9238795325112867), f100); + f103 = MUL_C(COEF_CONST(1.3065629648763766), f61); + f104 = f101 + f102; + f105 = f103 - f102; + f106 = f62 + f60; + f107 = MUL_C(COEF_CONST(1.3065629648763770), f62); + f108 = MUL_F(FRAC_CONST(-0.3826834323650904), f106); + f109 = MUL_F(FRAC_CONST(0.5411961001461961), f60); + f110 = f107 + f108; + f111 = f109 - f108; + f112 = f33 - f68; + f113 = f33 + f68; + f114 = f35 - f69; + f115 = f35 + f69; + f116 = f32 - f74; + f117 = f32 + f74; + f118 = f34 - f75; + f119 = f34 + f75; + f120 = f41 - f80; + f121 = f41 + f80; + f122 = f43 - f81; + f123 = f43 + f81; + f124 = f40 - f86; + f125 = f40 + f86; + f126 = f42 - f87; + f127 = f42 + f87; + f128 = f49 - f92; + f129 = f49 + f92; + f130 = f51 - f93; + f131 = f51 + f93; + f132 = f48 - f98; + f133 = f48 + f98; + f134 = f50 - f99; + f135 = f50 + f99; + f136 = f57 - f104; + f137 = f57 + f104; + f138 = f59 - f105; + f139 = f59 + f105; + f140 = f56 - f110; + f141 = f56 + f110; + f142 = f58 - f111; + f143 = f58 + f111; + f144 = f123 + f121; + f145 = MUL_F(FRAC_CONST(-0.7856949583871021), f123); + f146 = MUL_F(FRAC_CONST(0.9807852804032304), f144); + f147 = MUL_C(COEF_CONST(1.1758756024193588), f121); + f148 = f145 + f146; + f149 = f147 - f146; + f150 = f127 + f125; + f151 = MUL_F(FRAC_CONST(0.2758993792829431), f127); + f152 = MUL_F(FRAC_CONST(0.5555702330196022), f150); + f153 = MUL_C(COEF_CONST(1.3870398453221475), f125); + f154 = f151 + f152; + f155 = f153 - f152; + f156 = f122 + f120; + f157 = MUL_C(COEF_CONST(1.1758756024193591), f122); + f158 = MUL_F(FRAC_CONST(-0.1950903220161287), f156); + f159 = MUL_F(FRAC_CONST(0.7856949583871016), f120); + f160 = f157 + f158; + f161 = f159 - f158; + f162 = f126 + f124; + f163 = MUL_C(COEF_CONST(1.3870398453221473), f126); + f164 = MUL_F(FRAC_CONST(-0.8314696123025455), f162); + f165 = MUL_F(FRAC_CONST(-0.2758993792829436), f124); + f166 = f163 + f164; + f167 = f165 - f164; + f168 = f139 + f137; + f169 = MUL_F(FRAC_CONST(-0.7856949583871021), f139); + f170 = MUL_F(FRAC_CONST(0.9807852804032304), f168); + f171 = MUL_C(COEF_CONST(1.1758756024193588), f137); + f172 = f169 + f170; + f173 = f171 - f170; + f174 = f143 + f141; + f175 = MUL_F(FRAC_CONST(0.2758993792829431), f143); + f176 = MUL_F(FRAC_CONST(0.5555702330196022), f174); + f177 = MUL_C(COEF_CONST(1.3870398453221475), f141); + f178 = f175 + f176; + f179 = f177 - f176; + f180 = f138 + f136; + f181 = MUL_C(COEF_CONST(1.1758756024193591), f138); + f182 = MUL_F(FRAC_CONST(-0.1950903220161287), f180); + f183 = MUL_F(FRAC_CONST(0.7856949583871016), f136); + f184 = f181 + f182; + f185 = f183 - f182; + f186 = f142 + f140; + f187 = MUL_C(COEF_CONST(1.3870398453221473), f142); + f188 = MUL_F(FRAC_CONST(-0.8314696123025455), f186); + f189 = MUL_F(FRAC_CONST(-0.2758993792829436), f140); + f190 = f187 + f188; + f191 = f189 - f188; + f192 = f113 - f148; + f193 = f113 + f148; + f194 = f115 - f149; + f195 = f115 + f149; + f196 = f117 - f154; + f197 = f117 + f154; + f198 = f119 - f155; + f199 = f119 + f155; + f200 = f112 - f160; + f201 = f112 + f160; + f202 = f114 - f161; + f203 = f114 + f161; + f204 = f116 - f166; + f205 = f116 + f166; + f206 = f118 - f167; + f207 = f118 + f167; + f208 = f129 - f172; + f209 = f129 + f172; + f210 = f131 - f173; + f211 = f131 + f173; + f212 = f133 - f178; + f213 = f133 + f178; + f214 = f135 - f179; + f215 = f135 + f179; + f216 = f128 - f184; + f217 = f128 + f184; + f218 = f130 - f185; + f219 = f130 + f185; + f220 = f132 - f190; + f221 = f132 + f190; + f222 = f134 - f191; + f223 = f134 + f191; + f224 = f211 + f209; + f225 = MUL_F(FRAC_CONST(-0.8971675863426361), f211); + f226 = MUL_F(FRAC_CONST(0.9951847266721968), f224); + f227 = MUL_C(COEF_CONST(1.0932018670017576), f209); + f228 = f225 + f226; + f229 = f227 - f226; + f230 = f215 + f213; + f231 = MUL_F(FRAC_CONST(-0.4105245275223571), f215); + f232 = MUL_F(FRAC_CONST(0.8819212643483549), f230); + f233 = MUL_C(COEF_CONST(1.3533180011743529), f213); + f234 = f231 + f232; + f235 = f233 - f232; + f236 = f219 + f217; + f237 = MUL_F(FRAC_CONST(0.1386171691990915), f219); + f238 = MUL_F(FRAC_CONST(0.6343932841636455), f236); + f239 = MUL_C(COEF_CONST(1.4074037375263826), f217); + f240 = f237 + f238; + f241 = f239 - f238; + f242 = f223 + f221; + f243 = MUL_F(FRAC_CONST(0.6666556584777466), f223); + f244 = MUL_F(FRAC_CONST(0.2902846772544623), f242); + f245 = MUL_C(COEF_CONST(1.2472250129866711), f221); + f246 = f243 + f244; + f247 = f245 - f244; + f248 = f210 + f208; + f249 = MUL_C(COEF_CONST(1.0932018670017574), f210); + f250 = MUL_F(FRAC_CONST(-0.0980171403295605), f248); + f251 = MUL_F(FRAC_CONST(0.8971675863426364), f208); + f252 = f249 + f250; + f253 = f251 - f250; + f254 = f214 + f212; + f255 = MUL_C(COEF_CONST(1.3533180011743529), f214); + f256 = MUL_F(FRAC_CONST(-0.4713967368259979), f254); + f257 = MUL_F(FRAC_CONST(0.4105245275223569), f212); + f258 = f255 + f256; + f259 = f257 - f256; + f260 = f218 + f216; + f261 = MUL_C(COEF_CONST(1.4074037375263826), f218); + f262 = MUL_F(FRAC_CONST(-0.7730104533627369), f260); + f263 = MUL_F(FRAC_CONST(-0.1386171691990913), f216); + f264 = f261 + f262; + f265 = f263 - f262; + f266 = f222 + f220; + f267 = MUL_C(COEF_CONST(1.2472250129866711), f222); + f268 = MUL_F(FRAC_CONST(-0.9569403357322089), f266); + f269 = MUL_F(FRAC_CONST(-0.6666556584777469), f220); + f270 = f267 + f268; + f271 = f269 - f268; + f272 = f193 - f228; + f273 = f193 + f228; + f274 = f195 - f229; + f275 = f195 + f229; + f276 = f197 - f234; + f277 = f197 + f234; + f278 = f199 - f235; + f279 = f199 + f235; + f280 = f201 - f240; + f281 = f201 + f240; + f282 = f203 - f241; + f283 = f203 + f241; + f284 = f205 - f246; + f285 = f205 + f246; + f286 = f207 - f247; + f287 = f207 + f247; + f288 = f192 - f252; + f289 = f192 + f252; + f290 = f194 - f253; + f291 = f194 + f253; + f292 = f196 - f258; + f293 = f196 + f258; + f294 = f198 - f259; + f295 = f198 + f259; + f296 = f200 - f264; + f297 = f200 + f264; + f298 = f202 - f265; + f299 = f202 + f265; + f300 = f204 - f270; + f301 = f204 + f270; + f302 = f206 - f271; + f303 = f206 + f271; + f304 = f275 + f273; + f305 = MUL_F(FRAC_CONST(-0.9751575901732920), f275); + f306 = MUL_F(FRAC_CONST(0.9996988186962043), f304); + f307 = MUL_C(COEF_CONST(1.0242400472191164), f273); + y[0] = f305 + f306; + y[31] = f307 - f306; + f310 = f279 + f277; + f311 = MUL_F(FRAC_CONST(-0.8700688593994936), f279); + f312 = MUL_F(FRAC_CONST(0.9924795345987100), f310); + f313 = MUL_C(COEF_CONST(1.1148902097979263), f277); + y[2] = f311 + f312; + y[29] = f313 - f312; + f316 = f283 + f281; + f317 = MUL_F(FRAC_CONST(-0.7566008898816587), f283); + f318 = MUL_F(FRAC_CONST(0.9757021300385286), f316); + f319 = MUL_C(COEF_CONST(1.1948033701953984), f281); + y[4] = f317 + f318; + y[27] = f319 - f318; + f322 = f287 + f285; + f323 = MUL_F(FRAC_CONST(-0.6358464401941451), f287); + f324 = MUL_F(FRAC_CONST(0.9495281805930367), f322); + f325 = MUL_C(COEF_CONST(1.2632099209919283), f285); + y[6] = f323 + f324; + y[25] = f325 - f324; + f328 = f291 + f289; + f329 = MUL_F(FRAC_CONST(-0.5089684416985408), f291); + f330 = MUL_F(FRAC_CONST(0.9142097557035307), f328); + f331 = MUL_C(COEF_CONST(1.3194510697085207), f289); + y[8] = f329 + f330; + y[23] = f331 - f330; + f334 = f295 + f293; + f335 = MUL_F(FRAC_CONST(-0.3771887988789273), f295); + f336 = MUL_F(FRAC_CONST(0.8700869911087114), f334); + f337 = MUL_C(COEF_CONST(1.3629851833384954), f293); + y[10] = f335 + f336; + y[21] = f337 - f336; + f340 = f299 + f297; + f341 = MUL_F(FRAC_CONST(-0.2417766217337384), f299); + f342 = MUL_F(FRAC_CONST(0.8175848131515837), f340); + f343 = MUL_C(COEF_CONST(1.3933930045694289), f297); + y[12] = f341 + f342; + y[19] = f343 - f342; + f346 = f303 + f301; + f347 = MUL_F(FRAC_CONST(-0.1040360035527077), f303); + f348 = MUL_F(FRAC_CONST(0.7572088465064845), f346); + f349 = MUL_C(COEF_CONST(1.4103816894602612), f301); + y[14] = f347 + f348; + y[17] = f349 - f348; + f352 = f274 + f272; + f353 = MUL_F(FRAC_CONST(0.0347065382144002), f274); + f354 = MUL_F(FRAC_CONST(0.6895405447370668), f352); + f355 = MUL_C(COEF_CONST(1.4137876276885337), f272); + y[16] = f353 + f354; + y[15] = f355 - f354; + f358 = f278 + f276; + f359 = MUL_F(FRAC_CONST(0.1731148370459795), f278); + f360 = MUL_F(FRAC_CONST(0.6152315905806268), f358); + f361 = MUL_C(COEF_CONST(1.4035780182072330), f276); + y[18] = f359 + f360; + y[13] = f361 - f360; + f364 = f282 + f280; + f365 = MUL_F(FRAC_CONST(0.3098559453626100), f282); + f366 = MUL_F(FRAC_CONST(0.5349976198870972), f364); + f367 = MUL_C(COEF_CONST(1.3798511851368043), f280); + y[20] = f365 + f366; + y[11] = f367 - f366; + f370 = f286 + f284; + f371 = MUL_F(FRAC_CONST(0.4436129715409088), f286); + f372 = MUL_F(FRAC_CONST(0.4496113296546065), f370); + f373 = MUL_C(COEF_CONST(1.3428356308501219), f284); + y[22] = f371 + f372; + y[9] = f373 - f372; + f376 = f290 + f288; + f377 = MUL_F(FRAC_CONST(0.5730977622997509), f290); + f378 = MUL_F(FRAC_CONST(0.3598950365349881), f376); + f379 = MUL_C(COEF_CONST(1.2928878353697271), f288); + y[24] = f377 + f378; + y[7] = f379 - f378; + f382 = f294 + f292; + f383 = MUL_F(FRAC_CONST(0.6970633083205415), f294); + f384 = MUL_F(FRAC_CONST(0.2667127574748984), f382); + f385 = MUL_C(COEF_CONST(1.2304888232703382), f292); + y[26] = f383 + f384; + y[5] = f385 - f384; + f388 = f298 + f296; + f389 = MUL_F(FRAC_CONST(0.8143157536286401), f298); + f390 = MUL_F(FRAC_CONST(0.1709618887603012), f388); + f391 = MUL_C(COEF_CONST(1.1562395311492424), f296); + y[28] = f389 + f390; + y[3] = f391 - f390; + f394 = f302 + f300; + f395 = MUL_F(FRAC_CONST(0.9237258930790228), f302); + f396 = MUL_F(FRAC_CONST(0.0735645635996674), f394); + f397 = MUL_C(COEF_CONST(1.0708550202783576), f300); + y[30] = f395 + f396; + y[1] = f397 - f396; +} + +#ifdef SBR_LOW_POWER + +void DCT2_16_unscaled(real_t *y, real_t *x) +{ + real_t f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10; + real_t f11, f12, f13, f14, f15, f16, f17, f18, f19, f20; + real_t f21, f22, f23, f24, f25, f26, f27, f28, f31, f32; + real_t f33, f34, f37, f38, f39, f40, f41, f42, f43, f44; + real_t f45, f46, f47, f48, f49, f51, f53, f54, f57, f58; + real_t f59, f60, f61, f62, f63, f64, f65, f66, f67, f68; + real_t f69, f70, f71, f72, f73, f74, f75, f76, f77, f78; + real_t f79, f80, f81, f82, f83, f84, f85, f86, f87, f88; + real_t f89, f90, f91, f92, f95, f96, f97, f98, f101, f102; + real_t f103, f104, f107, f108, f109, f110; + + f0 = x[0] - x[15]; + f1 = x[0] + x[15]; + f2 = x[1] - x[14]; + f3 = x[1] + x[14]; + f4 = x[2] - x[13]; + f5 = x[2] + x[13]; + f6 = x[3] - x[12]; + f7 = x[3] + x[12]; + f8 = x[4] - x[11]; + f9 = x[4] + x[11]; + f10 = x[5] - x[10]; + f11 = x[5] + x[10]; + f12 = x[6] - x[9]; + f13 = x[6] + x[9]; + f14 = x[7] - x[8]; + f15 = x[7] + x[8]; + f16 = f1 - f15; + f17 = f1 + f15; + f18 = f3 - f13; + f19 = f3 + f13; + f20 = f5 - f11; + f21 = f5 + f11; + f22 = f7 - f9; + f23 = f7 + f9; + f24 = f17 - f23; + f25 = f17 + f23; + f26 = f19 - f21; + f27 = f19 + f21; + f28 = f25 - f27; + y[0] = f25 + f27; + y[8] = MUL_F(f28, FRAC_CONST(0.7071067811865476)); + f31 = f24 + f26; + f32 = MUL_C(f24, COEF_CONST(1.3065629648763766)); + f33 = MUL_F(f31, FRAC_CONST(-0.9238795325112866)); + f34 = MUL_F(f26, FRAC_CONST(-0.5411961001461967)); + y[12] = f32 + f33; + y[4] = f34 - f33; + f37 = f16 + f22; + f38 = MUL_C(f16, COEF_CONST(1.1758756024193588)); + f39 = MUL_F(f37, FRAC_CONST(-0.9807852804032304)); + f40 = MUL_F(f22, FRAC_CONST(-0.7856949583871021)); + f41 = f38 + f39; + f42 = f40 - f39; + f43 = f18 + f20; + f44 = MUL_C(f18, COEF_CONST(1.3870398453221473)); + f45 = MUL_F(f43, FRAC_CONST(-0.8314696123025455)); + f46 = MUL_F(f20, FRAC_CONST(-0.2758993792829436)); + f47 = f44 + f45; + f48 = f46 - f45; + f49 = f42 - f48; + y[2] = f42 + f48; + f51 = MUL_F(f49, FRAC_CONST(0.7071067811865476)); + y[14] = f41 - f47; + f53 = f41 + f47; + f54 = MUL_F(f53, FRAC_CONST(0.7071067811865476)); + y[10] = f51 - f54; + y[6] = f51 + f54; + f57 = f2 - f4; + f58 = f2 + f4; + f59 = f6 - f8; + f60 = f6 + f8; + f61 = f10 - f12; + f62 = f10 + f12; + f63 = MUL_F(f60, FRAC_CONST(0.7071067811865476)); + f64 = f0 - f63; + f65 = f0 + f63; + f66 = f58 + f62; + f67 = MUL_C(f58, COEF_CONST(1.3065629648763766)); + f68 = MUL_F(f66, FRAC_CONST(-0.9238795325112866)); + f69 = MUL_F(f62, FRAC_CONST(-0.5411961001461967)); + f70 = f67 + f68; + f71 = f69 - f68; + f72 = f65 - f71; + f73 = f65 + f71; + f74 = f64 - f70; + f75 = f64 + f70; + f76 = MUL_F(f59, FRAC_CONST(0.7071067811865476)); + f77 = f14 - f76; + f78 = f14 + f76; + f79 = f61 + f57; + f80 = MUL_C(f61, COEF_CONST(1.3065629648763766)); + f81 = MUL_F(f79, FRAC_CONST(-0.9238795325112866)); + f82 = MUL_F(f57, FRAC_CONST(-0.5411961001461967)); + f83 = f80 + f81; + f84 = f82 - f81; + f85 = f78 - f84; + f86 = f78 + f84; + f87 = f77 - f83; + f88 = f77 + f83; + f89 = f86 + f73; + f90 = MUL_F(f86, FRAC_CONST(-0.8971675863426361)); + f91 = MUL_F(f89, FRAC_CONST(0.9951847266721968)); + f92 = MUL_C(f73, COEF_CONST(1.0932018670017576)); + y[1] = f90 + f91; + y[15] = f92 - f91; + f95 = f75 - f88; + f96 = MUL_F(f88, FRAC_CONST(-0.6666556584777466)); + f97 = MUL_F(f95, FRAC_CONST(0.9569403357322089)); + f98 = MUL_C(f75, COEF_CONST(1.2472250129866713)); + y[3] = f97 - f96; + y[13] = f98 - f97; + f101 = f87 + f74; + f102 = MUL_F(f87, FRAC_CONST(-0.4105245275223571)); + f103 = MUL_F(f101, FRAC_CONST(0.8819212643483549)); + f104 = MUL_C(f74, COEF_CONST(1.3533180011743529)); + y[5] = f102 + f103; + y[11] = f104 - f103; + f107 = f72 - f85; + f108 = MUL_F(f85, FRAC_CONST(-0.1386171691990915)); + f109 = MUL_F(f107, FRAC_CONST(0.7730104533627370)); + f110 = MUL_C(f72, COEF_CONST(1.4074037375263826)); + y[7] = f109 - f108; + y[9] = f110 - f109; +} + +void DCT4_16(real_t *y, real_t *x) +{ + real_t f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10; + real_t f11, f12, f13, f14, f15, f16, f17, f18, f19, f20; + real_t f21, f22, f23, f24, f25, f26, f27, f28, f29, f30; + real_t f31, f32, f33, f34, f35, f36, f37, f38, f39, f40; + real_t f41, f42, f43, f44, f45, f46, f47, f48, f49, f50; + real_t f51, f52, f53, f54, f55, f56, f57, f58, f59, f60; + real_t f61, f62, f63, f64, f65, f66, f67, f68, f69, f70; + real_t f71, f72, f73, f74, f75, f76, f77, f78, f79, f80; + real_t f81, f82, f83, f84, f85, f86, f87, f88, f89, f90; + real_t f91, f92, f93, f94, f95, f96, f97, f98, f99, f100; + real_t f101, f102, f103, f104, f105, f106, f107, f108, f109, f110; + real_t f111, f112, f113, f114, f115, f116, f117, f118, f119, f120; + real_t f121, f122, f123, f124, f125, f126, f127, f128, f130, f132; + real_t f134, f136, f138, f140, f142, f144, f145, f148, f149, f152; + real_t f153, f156, f157; + + f0 = x[0] + x[15]; + f1 = MUL_C(COEF_CONST(1.0478631305325901), x[0]); + f2 = MUL_F(FRAC_CONST(-0.9987954562051724), f0); + f3 = MUL_F(FRAC_CONST(-0.9497277818777548), x[15]); + f4 = f1 + f2; + f5 = f3 - f2; + f6 = x[2] + x[13]; + f7 = MUL_C(COEF_CONST(1.2130114330978077), x[2]); + f8 = MUL_F(FRAC_CONST(-0.9700312531945440), f6); + f9 = MUL_F(FRAC_CONST(-0.7270510732912803), x[13]); + f10 = f7 + f8; + f11 = f9 - f8; + f12 = x[4] + x[11]; + f13 = MUL_C(COEF_CONST(1.3315443865537255), x[4]); + f14 = MUL_F(FRAC_CONST(-0.9039892931234433), f12); + f15 = MUL_F(FRAC_CONST(-0.4764341996931612), x[11]); + f16 = f13 + f14; + f17 = f15 - f14; + f18 = x[6] + x[9]; + f19 = MUL_C(COEF_CONST(1.3989068359730781), x[6]); + f20 = MUL_F(FRAC_CONST(-0.8032075314806453), f18); + f21 = MUL_F(FRAC_CONST(-0.2075082269882124), x[9]); + f22 = f19 + f20; + f23 = f21 - f20; + f24 = x[8] + x[7]; + f25 = MUL_C(COEF_CONST(1.4125100802019777), x[8]); + f26 = MUL_F(FRAC_CONST(-0.6715589548470187), f24); + f27 = MUL_F(FRAC_CONST(0.0693921705079402), x[7]); + f28 = f25 + f26; + f29 = f27 - f26; + f30 = x[10] + x[5]; + f31 = MUL_C(COEF_CONST(1.3718313541934939), x[10]); + f32 = MUL_F(FRAC_CONST(-0.5141027441932219), f30); + f33 = MUL_F(FRAC_CONST(0.3436258658070501), x[5]); + f34 = f31 + f32; + f35 = f33 - f32; + f36 = x[12] + x[3]; + f37 = MUL_C(COEF_CONST(1.2784339185752409), x[12]); + f38 = MUL_F(FRAC_CONST(-0.3368898533922200), f36); + f39 = MUL_F(FRAC_CONST(0.6046542117908008), x[3]); + f40 = f37 + f38; + f41 = f39 - f38; + f42 = x[14] + x[1]; + f43 = MUL_C(COEF_CONST(1.1359069844201433), x[14]); + f44 = MUL_F(FRAC_CONST(-0.1467304744553624), f42); + f45 = MUL_F(FRAC_CONST(0.8424460355094185), x[1]); + f46 = f43 + f44; + f47 = f45 - f44; + f48 = f5 - f29; + f49 = f5 + f29; + f50 = f4 - f28; + f51 = f4 + f28; + f52 = f11 - f35; + f53 = f11 + f35; + f54 = f10 - f34; + f55 = f10 + f34; + f56 = f17 - f41; + f57 = f17 + f41; + f58 = f16 - f40; + f59 = f16 + f40; + f60 = f23 - f47; + f61 = f23 + f47; + f62 = f22 - f46; + f63 = f22 + f46; + f64 = f48 + f50; + f65 = MUL_C(COEF_CONST(1.1758756024193588), f48); + f66 = MUL_F(FRAC_CONST(-0.9807852804032304), f64); + f67 = MUL_F(FRAC_CONST(-0.7856949583871021), f50); + f68 = f65 + f66; + f69 = f67 - f66; + f70 = f52 + f54; + f71 = MUL_C(COEF_CONST(1.3870398453221475), f52); + f72 = MUL_F(FRAC_CONST(-0.5555702330196022), f70); + f73 = MUL_F(FRAC_CONST(0.2758993792829431), f54); + f74 = f71 + f72; + f75 = f73 - f72; + f76 = f56 + f58; + f77 = MUL_F(FRAC_CONST(0.7856949583871022), f56); + f78 = MUL_F(FRAC_CONST(0.1950903220161283), f76); + f79 = MUL_C(COEF_CONST(1.1758756024193586), f58); + f80 = f77 + f78; + f81 = f79 - f78; + f82 = f60 + f62; + f83 = MUL_F(FRAC_CONST(-0.2758993792829430), f60); + f84 = MUL_F(FRAC_CONST(0.8314696123025452), f82); + f85 = MUL_C(COEF_CONST(1.3870398453221475), f62); + f86 = f83 + f84; + f87 = f85 - f84; + f88 = f49 - f57; + f89 = f49 + f57; + f90 = f51 - f59; + f91 = f51 + f59; + f92 = f53 - f61; + f93 = f53 + f61; + f94 = f55 - f63; + f95 = f55 + f63; + f96 = f69 - f81; + f97 = f69 + f81; + f98 = f68 - f80; + f99 = f68 + f80; + f100 = f75 - f87; + f101 = f75 + f87; + f102 = f74 - f86; + f103 = f74 + f86; + f104 = f88 + f90; + f105 = MUL_C(COEF_CONST(1.3065629648763766), f88); + f106 = MUL_F(FRAC_CONST(-0.9238795325112866), f104); + f107 = MUL_F(FRAC_CONST(-0.5411961001461967), f90); + f108 = f105 + f106; + f109 = f107 - f106; + f110 = f92 + f94; + f111 = MUL_F(FRAC_CONST(0.5411961001461969), f92); + f112 = MUL_F(FRAC_CONST(0.3826834323650898), f110); + f113 = MUL_C(COEF_CONST(1.3065629648763766), f94); + f114 = f111 + f112; + f115 = f113 - f112; + f116 = f96 + f98; + f117 = MUL_C(COEF_CONST(1.3065629648763766), f96); + f118 = MUL_F(FRAC_CONST(-0.9238795325112866), f116); + f119 = MUL_F(FRAC_CONST(-0.5411961001461967), f98); + f120 = f117 + f118; + f121 = f119 - f118; + f122 = f100 + f102; + f123 = MUL_F(FRAC_CONST(0.5411961001461969), f100); + f124 = MUL_F(FRAC_CONST(0.3826834323650898), f122); + f125 = MUL_C(COEF_CONST(1.3065629648763766), f102); + f126 = f123 + f124; + f127 = f125 - f124; + f128 = f89 - f93; + y[0] = f89 + f93; + f130 = f91 - f95; + y[15] = f91 + f95; + f132 = f109 - f115; + y[3] = f109 + f115; + f134 = f108 - f114; + y[12] = f108 + f114; + f136 = f97 - f101; + y[1] = f97 + f101; + f138 = f99 - f103; + y[14] = f99 + f103; + f140 = f121 - f127; + y[2] = f121 + f127; + f142 = f120 - f126; + y[13] = f120 + f126; + f144 = f128 - f130; + f145 = f128 + f130; + y[8] = MUL_F(FRAC_CONST(0.7071067811865474), f144); + y[7] = MUL_F(FRAC_CONST(0.7071067811865474), f145); + f148 = f132 - f134; + f149 = f132 + f134; + y[11] = MUL_F(FRAC_CONST(0.7071067811865474), f148); + y[4] = MUL_F(FRAC_CONST(0.7071067811865474), f149); + f152 = f136 - f138; + f153 = f136 + f138; + y[9] = MUL_F(FRAC_CONST(0.7071067811865474), f152); + y[6] = MUL_F(FRAC_CONST(0.7071067811865474), f153); + f156 = f140 - f142; + f157 = f140 + f142; + y[10] = MUL_F(FRAC_CONST(0.7071067811865474), f156); + y[5] = MUL_F(FRAC_CONST(0.7071067811865474), f157); +} + +void DCT3_32_unscaled(real_t *y, real_t *x) +{ + real_t f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10; + real_t f11, f12, f13, f14, f15, f16, f17, f18, f19, f20; + real_t f21, f22, f23, f24, f25, f26, f27, f28, f29, f30; + real_t f31, f32, f33, f34, f35, f36, f37, f38, f39, f40; + real_t f41, f42, f43, f44, f45, f46, f47, f48, f49, f50; + real_t f51, f52, f53, f54, f55, f56, f57, f58, f59, f60; + real_t f61, f62, f63, f64, f65, f66, f67, f68, f69, f70; + real_t f71, f72, f73, f74, f75, f76, f77, f78, f79, f80; + real_t f81, f82, f83, f84, f85, f86, f87, f88, f89, f90; + real_t f91, f92, f93, f94, f95, f96, f97, f98, f99, f100; + real_t f101, f102, f103, f104, f105, f106, f107, f108, f109, f110; + real_t f111, f112, f113, f114, f115, f116, f117, f118, f119, f120; + real_t f121, f122, f123, f124, f125, f126, f127, f128, f129, f130; + real_t f131, f132, f133, f134, f135, f136, f137, f138, f139, f140; + real_t f141, f142, f143, f144, f145, f146, f147, f148, f149, f150; + real_t f151, f152, f153, f154, f155, f156, f157, f158, f159, f160; + real_t f161, f162, f163, f164, f165, f166, f167, f168, f169, f170; + real_t f171, f172, f173, f174, f175, f176, f177, f178, f179, f180; + real_t f181, f182, f183, f184, f185, f186, f187, f188, f189, f190; + real_t f191, f192, f193, f194, f195, f196, f197, f198, f199, f200; + real_t f201, f202, f203, f204, f205, f206, f207, f208, f209, f210; + real_t f211, f212, f213, f214, f215, f216, f217, f218, f219, f220; + real_t f221, f222, f223, f224, f225, f226, f227, f228, f229, f230; + real_t f231, f232, f233, f234, f235, f236, f237, f238, f239, f240; + real_t f241, f242, f243, f244, f245, f246, f247, f248, f249, f250; + real_t f251, f252, f253, f254, f255, f256, f257, f258, f259, f260; + real_t f261, f262, f263, f264, f265, f266, f267, f268, f269, f270; + real_t f271, f272; + + f0 = MUL_F(x[16], FRAC_CONST(0.7071067811865476)); + f1 = x[0] - f0; + f2 = x[0] + f0; + f3 = x[8] + x[24]; + f4 = MUL_C(x[8], COEF_CONST(1.3065629648763766)); + f5 = MUL_F(f3, FRAC_CONST((-0.9238795325112866))); + f6 = MUL_F(x[24], FRAC_CONST((-0.5411961001461967))); + f7 = f4 + f5; + f8 = f6 - f5; + f9 = f2 - f8; + f10 = f2 + f8; + f11 = f1 - f7; + f12 = f1 + f7; + f13 = x[4] + x[28]; + f14 = MUL_C(x[4], COEF_CONST(1.1758756024193588)); + f15 = MUL_F(f13, FRAC_CONST((-0.9807852804032304))); + f16 = MUL_F(x[28], FRAC_CONST((-0.7856949583871021))); + f17 = f14 + f15; + f18 = f16 - f15; + f19 = x[12] + x[20]; + f20 = MUL_C(x[12], COEF_CONST(1.3870398453221473)); + f21 = MUL_F(f19, FRAC_CONST((-0.8314696123025455))); + f22 = MUL_F(x[20], FRAC_CONST((-0.2758993792829436))); + f23 = f20 + f21; + f24 = f22 - f21; + f25 = f18 - f24; + f26 = f18 + f24; + f27 = MUL_F(f25, FRAC_CONST(0.7071067811865476)); + f28 = f17 - f23; + f29 = f17 + f23; + f30 = MUL_F(f29, FRAC_CONST(0.7071067811865476)); + f31 = f27 - f30; + f32 = f27 + f30; + f33 = f10 - f26; + f34 = f10 + f26; + f35 = f12 - f32; + f36 = f12 + f32; + f37 = f11 - f31; + f38 = f11 + f31; + f39 = f9 - f28; + f40 = f9 + f28; + f41 = x[2] + x[30]; + f42 = MUL_C(x[2], COEF_CONST(1.0932018670017569)); + f43 = MUL_F(f41, FRAC_CONST((-0.9951847266721969))); + f44 = MUL_F(x[30], FRAC_CONST((-0.8971675863426368))); + f45 = f42 + f43; + f46 = f44 - f43; + f47 = x[6] + x[26]; + f48 = MUL_C(x[6], COEF_CONST(1.2472250129866711)); + f49 = MUL_F(f47, FRAC_CONST((-0.9569403357322089))); + f50 = MUL_F(x[26], FRAC_CONST((-0.6666556584777469))); + f51 = f48 + f49; + f52 = f50 - f49; + f53 = x[10] + x[22]; + f54 = MUL_C(x[10], COEF_CONST(1.3533180011743526)); + f55 = MUL_F(f53, FRAC_CONST((-0.8819212643483551))); + f56 = MUL_F(x[22], FRAC_CONST((-0.4105245275223575))); + f57 = f54 + f55; + f58 = f56 - f55; + f59 = x[14] + x[18]; + f60 = MUL_C(x[14], COEF_CONST(1.4074037375263826)); + f61 = MUL_F(f59, FRAC_CONST((-0.7730104533627369))); + f62 = MUL_F(x[18], FRAC_CONST((-0.1386171691990913))); + f63 = f60 + f61; + f64 = f62 - f61; + f65 = f46 - f64; + f66 = f46 + f64; + f67 = f52 - f58; + f68 = f52 + f58; + f69 = f66 - f68; + f70 = f66 + f68; + f71 = MUL_F(f69, FRAC_CONST(0.7071067811865476)); + f72 = f65 + f67; + f73 = MUL_C(f65, COEF_CONST(1.3065629648763766)); + f74 = MUL_F(f72, FRAC_CONST((-0.9238795325112866))); + f75 = MUL_F(f67, FRAC_CONST((-0.5411961001461967))); + f76 = f73 + f74; + f77 = f75 - f74; + f78 = f45 - f63; + f79 = f45 + f63; + f80 = f51 - f57; + f81 = f51 + f57; + f82 = f79 + f81; + f83 = MUL_C(f79, COEF_CONST(1.3065629648763770)); + f84 = MUL_F(f82, FRAC_CONST((-0.3826834323650904))); + f85 = MUL_F(f81, FRAC_CONST(0.5411961001461961)); + f86 = f83 + f84; + f87 = f85 - f84; + f88 = f78 - f80; + f89 = f78 + f80; + f90 = MUL_F(f89, FRAC_CONST(0.7071067811865476)); + f91 = f77 - f87; + f92 = f77 + f87; + f93 = f71 - f90; + f94 = f71 + f90; + f95 = f76 - f86; + f96 = f76 + f86; + f97 = f34 - f70; + f98 = f34 + f70; + f99 = f36 - f92; + f100 = f36 + f92; + f101 = f38 - f91; + f102 = f38 + f91; + f103 = f40 - f94; + f104 = f40 + f94; + f105 = f39 - f93; + f106 = f39 + f93; + f107 = f37 - f96; + f108 = f37 + f96; + f109 = f35 - f95; + f110 = f35 + f95; + f111 = f33 - f88; + f112 = f33 + f88; + f113 = x[1] + x[31]; + f114 = MUL_C(x[1], COEF_CONST(1.0478631305325901)); + f115 = MUL_F(f113, FRAC_CONST((-0.9987954562051724))); + f116 = MUL_F(x[31], FRAC_CONST((-0.9497277818777548))); + f117 = f114 + f115; + f118 = f116 - f115; + f119 = x[5] + x[27]; + f120 = MUL_C(x[5], COEF_CONST(1.2130114330978077)); + f121 = MUL_F(f119, FRAC_CONST((-0.9700312531945440))); + f122 = MUL_F(x[27], FRAC_CONST((-0.7270510732912803))); + f123 = f120 + f121; + f124 = f122 - f121; + f125 = x[9] + x[23]; + f126 = MUL_C(x[9], COEF_CONST(1.3315443865537255)); + f127 = MUL_F(f125, FRAC_CONST((-0.9039892931234433))); + f128 = MUL_F(x[23], FRAC_CONST((-0.4764341996931612))); + f129 = f126 + f127; + f130 = f128 - f127; + f131 = x[13] + x[19]; + f132 = MUL_C(x[13], COEF_CONST(1.3989068359730781)); + f133 = MUL_F(f131, FRAC_CONST((-0.8032075314806453))); + f134 = MUL_F(x[19], FRAC_CONST((-0.2075082269882124))); + f135 = f132 + f133; + f136 = f134 - f133; + f137 = x[17] + x[15]; + f138 = MUL_C(x[17], COEF_CONST(1.4125100802019777)); + f139 = MUL_F(f137, FRAC_CONST((-0.6715589548470187))); + f140 = MUL_F(x[15], FRAC_CONST(0.0693921705079402)); + f141 = f138 + f139; + f142 = f140 - f139; + f143 = x[21] + x[11]; + f144 = MUL_C(x[21], COEF_CONST(1.3718313541934939)); + f145 = MUL_F(f143, FRAC_CONST((-0.5141027441932219))); + f146 = MUL_F(x[11], FRAC_CONST(0.3436258658070501)); + f147 = f144 + f145; + f148 = f146 - f145; + f149 = x[25] + x[7]; + f150 = MUL_C(x[25], COEF_CONST(1.2784339185752409)); + f151 = MUL_F(f149, FRAC_CONST((-0.3368898533922200))); + f152 = MUL_F(x[7], FRAC_CONST(0.6046542117908008)); + f153 = f150 + f151; + f154 = f152 - f151; + f155 = x[29] + x[3]; + f156 = MUL_C(x[29], COEF_CONST(1.1359069844201433)); + f157 = MUL_F(f155, FRAC_CONST((-0.1467304744553624))); + f158 = MUL_F(x[3], FRAC_CONST(0.8424460355094185)); + f159 = f156 + f157; + f160 = f158 - f157; + f161 = f118 - f142; + f162 = f118 + f142; + f163 = f117 - f141; + f164 = f117 + f141; + f165 = f124 - f148; + f166 = f124 + f148; + f167 = f123 - f147; + f168 = f123 + f147; + f169 = f130 - f154; + f170 = f130 + f154; + f171 = f129 - f153; + f172 = f129 + f153; + f173 = f136 - f160; + f174 = f136 + f160; + f175 = f135 - f159; + f176 = f135 + f159; + f177 = f161 + f163; + f178 = MUL_C(f161, COEF_CONST(1.1758756024193588)); + f179 = MUL_F(f177, FRAC_CONST((-0.9807852804032304))); + f180 = MUL_F(f163, FRAC_CONST((-0.7856949583871021))); + f181 = f178 + f179; + f182 = f180 - f179; + f183 = f165 + f167; + f184 = MUL_C(f165, COEF_CONST(1.3870398453221475)); + f185 = MUL_F(f183, FRAC_CONST((-0.5555702330196022))); + f186 = MUL_F(f167, FRAC_CONST(0.2758993792829431)); + f187 = f184 + f185; + f188 = f186 - f185; + f189 = f169 + f171; + f190 = MUL_F(f169, FRAC_CONST(0.7856949583871022)); + f191 = MUL_F(f189, FRAC_CONST(0.1950903220161283)); + f192 = MUL_C(f171, COEF_CONST(1.1758756024193586)); + f193 = f190 + f191; + f194 = f192 - f191; + f195 = f173 + f175; + f196 = MUL_F(f173, FRAC_CONST((-0.2758993792829430))); + f197 = MUL_F(f195, FRAC_CONST(0.8314696123025452)); + f198 = MUL_C(f175, COEF_CONST(1.3870398453221475)); + f199 = f196 + f197; + f200 = f198 - f197; + f201 = f162 - f170; + f202 = f162 + f170; + f203 = f164 - f172; + f204 = f164 + f172; + f205 = f166 - f174; + f206 = f166 + f174; + f207 = f168 - f176; + f208 = f168 + f176; + f209 = f182 - f194; + f210 = f182 + f194; + f211 = f181 - f193; + f212 = f181 + f193; + f213 = f188 - f200; + f214 = f188 + f200; + f215 = f187 - f199; + f216 = f187 + f199; + f217 = f201 + f203; + f218 = MUL_C(f201, COEF_CONST(1.3065629648763766)); + f219 = MUL_F(f217, FRAC_CONST((-0.9238795325112866))); + f220 = MUL_F(f203, FRAC_CONST((-0.5411961001461967))); + f221 = f218 + f219; + f222 = f220 - f219; + f223 = f205 + f207; + f224 = MUL_F(f205, FRAC_CONST(0.5411961001461969)); + f225 = MUL_F(f223, FRAC_CONST(0.3826834323650898)); + f226 = MUL_C(f207, COEF_CONST(1.3065629648763766)); + f227 = f224 + f225; + f228 = f226 - f225; + f229 = f209 + f211; + f230 = MUL_C(f209, COEF_CONST(1.3065629648763766)); + f231 = MUL_F(f229, FRAC_CONST((-0.9238795325112866))); + f232 = MUL_F(f211, FRAC_CONST((-0.5411961001461967))); + f233 = f230 + f231; + f234 = f232 - f231; + f235 = f213 + f215; + f236 = MUL_F(f213, FRAC_CONST(0.5411961001461969)); + f237 = MUL_F(f235, FRAC_CONST(0.3826834323650898)); + f238 = MUL_C(f215, COEF_CONST(1.3065629648763766)); + f239 = f236 + f237; + f240 = f238 - f237; + f241 = f202 - f206; + f242 = f202 + f206; + f243 = f204 - f208; + f244 = f204 + f208; + f245 = f222 - f228; + f246 = f222 + f228; + f247 = f221 - f227; + f248 = f221 + f227; + f249 = f210 - f214; + f250 = f210 + f214; + f251 = f212 - f216; + f252 = f212 + f216; + f253 = f234 - f240; + f254 = f234 + f240; + f255 = f233 - f239; + f256 = f233 + f239; + f257 = f241 - f243; + f258 = f241 + f243; + f259 = MUL_F(f257, FRAC_CONST(0.7071067811865474)); + f260 = MUL_F(f258, FRAC_CONST(0.7071067811865474)); + f261 = f245 - f247; + f262 = f245 + f247; + f263 = MUL_F(f261, FRAC_CONST(0.7071067811865474)); + f264 = MUL_F(f262, FRAC_CONST(0.7071067811865474)); + f265 = f249 - f251; + f266 = f249 + f251; + f267 = MUL_F(f265, FRAC_CONST(0.7071067811865474)); + f268 = MUL_F(f266, FRAC_CONST(0.7071067811865474)); + f269 = f253 - f255; + f270 = f253 + f255; + f271 = MUL_F(f269, FRAC_CONST(0.7071067811865474)); + f272 = MUL_F(f270, FRAC_CONST(0.7071067811865474)); + y[31] = f98 - f242; + y[0] = f98 + f242; + y[30] = f100 - f250; + y[1] = f100 + f250; + y[29] = f102 - f254; + y[2] = f102 + f254; + y[28] = f104 - f246; + y[3] = f104 + f246; + y[27] = f106 - f264; + y[4] = f106 + f264; + y[26] = f108 - f272; + y[5] = f108 + f272; + y[25] = f110 - f268; + y[6] = f110 + f268; + y[24] = f112 - f260; + y[7] = f112 + f260; + y[23] = f111 - f259; + y[8] = f111 + f259; + y[22] = f109 - f267; + y[9] = f109 + f267; + y[21] = f107 - f271; + y[10] = f107 + f271; + y[20] = f105 - f263; + y[11] = f105 + f263; + y[19] = f103 - f248; + y[12] = f103 + f248; + y[18] = f101 - f256; + y[13] = f101 + f256; + y[17] = f99 - f252; + y[14] = f99 + f252; + y[16] = f97 - f244; + y[15] = f97 + f244; +} + +void DCT2_32_unscaled(real_t *y, real_t *x) +{ + real_t f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10; + real_t f11, f12, f13, f14, f15, f16, f17, f18, f19, f20; + real_t f21, f22, f23, f24, f25, f26, f27, f28, f29, f30; + real_t f31, f32, f33, f34, f35, f36, f37, f38, f39, f40; + real_t f41, f42, f43, f44, f45, f46, f47, f48, f49, f50; + real_t f51, f52, f53, f54, f55, f56, f57, f58, f59, f60; + real_t f63, f64, f65, f66, f69, f70, f71, f72, f73, f74; + real_t f75, f76, f77, f78, f79, f80, f81, f83, f85, f86; + real_t f89, f90, f91, f92, f93, f94, f95, f96, f97, f98; + real_t f99, f100, f101, f102, f103, f104, f105, f106, f107, f108; + real_t f109, f110, f111, f112, f113, f114, f115, f116, f117, f118; + real_t f119, f120, f121, f122, f123, f124, f127, f128, f129, f130; + real_t f133, f134, f135, f136, f139, f140, f141, f142, f145, f146; + real_t f147, f148, f149, f150, f151, f152, f153, f154, f155, f156; + real_t f157, f158, f159, f160, f161, f162, f163, f164, f165, f166; + real_t f167, f168, f169, f170, f171, f172, f173, f174, f175, f176; + real_t f177, f178, f179, f180, f181, f182, f183, f184, f185, f186; + real_t f187, f188, f189, f190, f191, f192, f193, f194, f195, f196; + real_t f197, f198, f199, f200, f201, f202, f203, f204, f205, f206; + real_t f207, f208, f209, f210, f211, f212, f213, f214, f215, f216; + real_t f217, f218, f219, f220, f221, f222, f223, f224, f225, f226; + real_t f227, f228, f229, f230, f231, f232, f233, f234, f235, f236; + real_t f237, f238, f239, f240, f241, f242, f243, f244, f247, f248; + real_t f249, f250, f253, f254, f255, f256, f259, f260, f261, f262; + real_t f265, f266, f267, f268, f271, f272, f273, f274, f277, f278; + real_t f279, f280, f283, f284, f285, f286; + + f0 = x[0] - x[31]; + f1 = x[0] + x[31]; + f2 = x[1] - x[30]; + f3 = x[1] + x[30]; + f4 = x[2] - x[29]; + f5 = x[2] + x[29]; + f6 = x[3] - x[28]; + f7 = x[3] + x[28]; + f8 = x[4] - x[27]; + f9 = x[4] + x[27]; + f10 = x[5] - x[26]; + f11 = x[5] + x[26]; + f12 = x[6] - x[25]; + f13 = x[6] + x[25]; + f14 = x[7] - x[24]; + f15 = x[7] + x[24]; + f16 = x[8] - x[23]; + f17 = x[8] + x[23]; + f18 = x[9] - x[22]; + f19 = x[9] + x[22]; + f20 = x[10] - x[21]; + f21 = x[10] + x[21]; + f22 = x[11] - x[20]; + f23 = x[11] + x[20]; + f24 = x[12] - x[19]; + f25 = x[12] + x[19]; + f26 = x[13] - x[18]; + f27 = x[13] + x[18]; + f28 = x[14] - x[17]; + f29 = x[14] + x[17]; + f30 = x[15] - x[16]; + f31 = x[15] + x[16]; + f32 = f1 - f31; + f33 = f1 + f31; + f34 = f3 - f29; + f35 = f3 + f29; + f36 = f5 - f27; + f37 = f5 + f27; + f38 = f7 - f25; + f39 = f7 + f25; + f40 = f9 - f23; + f41 = f9 + f23; + f42 = f11 - f21; + f43 = f11 + f21; + f44 = f13 - f19; + f45 = f13 + f19; + f46 = f15 - f17; + f47 = f15 + f17; + f48 = f33 - f47; + f49 = f33 + f47; + f50 = f35 - f45; + f51 = f35 + f45; + f52 = f37 - f43; + f53 = f37 + f43; + f54 = f39 - f41; + f55 = f39 + f41; + f56 = f49 - f55; + f57 = f49 + f55; + f58 = f51 - f53; + f59 = f51 + f53; + f60 = f57 - f59; + y[0] = f57 + f59; + y[16] = MUL_F(FRAC_CONST(0.7071067811865476), f60); + f63 = f56 + f58; + f64 = MUL_C(COEF_CONST(1.3065629648763766), f56); + f65 = MUL_F(FRAC_CONST(-0.9238795325112866), f63); + f66 = MUL_F(FRAC_CONST(-0.5411961001461967), f58); + y[24] = f64 + f65; + y[8] = f66 - f65; + f69 = f48 + f54; + f70 = MUL_C(COEF_CONST(1.1758756024193588), f48); + f71 = MUL_F(FRAC_CONST(-0.9807852804032304), f69); + f72 = MUL_F(FRAC_CONST(-0.7856949583871021), f54); + f73 = f70 + f71; + f74 = f72 - f71; + f75 = f50 + f52; + f76 = MUL_C(COEF_CONST(1.3870398453221473), f50); + f77 = MUL_F(FRAC_CONST(-0.8314696123025455), f75); + f78 = MUL_F(FRAC_CONST(-0.2758993792829436), f52); + f79 = f76 + f77; + f80 = f78 - f77; + f81 = f74 - f80; + y[4] = f74 + f80; + f83 = MUL_F(FRAC_CONST(0.7071067811865476), f81); + y[28] = f73 - f79; + f85 = f73 + f79; + f86 = MUL_F(FRAC_CONST(0.7071067811865476), f85); + y[20] = f83 - f86; + y[12] = f83 + f86; + f89 = f34 - f36; + f90 = f34 + f36; + f91 = f38 - f40; + f92 = f38 + f40; + f93 = f42 - f44; + f94 = f42 + f44; + f95 = MUL_F(FRAC_CONST(0.7071067811865476), f92); + f96 = f32 - f95; + f97 = f32 + f95; + f98 = f90 + f94; + f99 = MUL_C(COEF_CONST(1.3065629648763766), f90); + f100 = MUL_F(FRAC_CONST(-0.9238795325112866), f98); + f101 = MUL_F(FRAC_CONST(-0.5411961001461967), f94); + f102 = f99 + f100; + f103 = f101 - f100; + f104 = f97 - f103; + f105 = f97 + f103; + f106 = f96 - f102; + f107 = f96 + f102; + f108 = MUL_F(FRAC_CONST(0.7071067811865476), f91); + f109 = f46 - f108; + f110 = f46 + f108; + f111 = f93 + f89; + f112 = MUL_C(COEF_CONST(1.3065629648763766), f93); + f113 = MUL_F(FRAC_CONST(-0.9238795325112866), f111); + f114 = MUL_F(FRAC_CONST(-0.5411961001461967), f89); + f115 = f112 + f113; + f116 = f114 - f113; + f117 = f110 - f116; + f118 = f110 + f116; + f119 = f109 - f115; + f120 = f109 + f115; + f121 = f118 + f105; + f122 = MUL_F(FRAC_CONST(-0.8971675863426361), f118); + f123 = MUL_F(FRAC_CONST(0.9951847266721968), f121); + f124 = MUL_C(COEF_CONST(1.0932018670017576), f105); + y[2] = f122 + f123; + y[30] = f124 - f123; + f127 = f107 - f120; + f128 = MUL_F(FRAC_CONST(-0.6666556584777466), f120); + f129 = MUL_F(FRAC_CONST(0.9569403357322089), f127); + f130 = MUL_C(COEF_CONST(1.2472250129866713), f107); + y[6] = f129 - f128; + y[26] = f130 - f129; + f133 = f119 + f106; + f134 = MUL_F(FRAC_CONST(-0.4105245275223571), f119); + f135 = MUL_F(FRAC_CONST(0.8819212643483549), f133); + f136 = MUL_C(COEF_CONST(1.3533180011743529), f106); + y[10] = f134 + f135; + y[22] = f136 - f135; + f139 = f104 - f117; + f140 = MUL_F(FRAC_CONST(-0.1386171691990915), f117); + f141 = MUL_F(FRAC_CONST(0.7730104533627370), f139); + f142 = MUL_C(COEF_CONST(1.4074037375263826), f104); + y[14] = f141 - f140; + y[18] = f142 - f141; + f145 = f2 - f4; + f146 = f2 + f4; + f147 = f6 - f8; + f148 = f6 + f8; + f149 = f10 - f12; + f150 = f10 + f12; + f151 = f14 - f16; + f152 = f14 + f16; + f153 = f18 - f20; + f154 = f18 + f20; + f155 = f22 - f24; + f156 = f22 + f24; + f157 = f26 - f28; + f158 = f26 + f28; + f159 = MUL_F(FRAC_CONST(0.7071067811865476), f152); + f160 = f0 - f159; + f161 = f0 + f159; + f162 = f148 + f156; + f163 = MUL_C(COEF_CONST(1.3065629648763766), f148); + f164 = MUL_F(FRAC_CONST(-0.9238795325112866), f162); + f165 = MUL_F(FRAC_CONST(-0.5411961001461967), f156); + f166 = f163 + f164; + f167 = f165 - f164; + f168 = f161 - f167; + f169 = f161 + f167; + f170 = f160 - f166; + f171 = f160 + f166; + f172 = f146 + f158; + f173 = MUL_C(COEF_CONST(1.1758756024193588), f146); + f174 = MUL_F(FRAC_CONST(-0.9807852804032304), f172); + f175 = MUL_F(FRAC_CONST(-0.7856949583871021), f158); + f176 = f173 + f174; + f177 = f175 - f174; + f178 = f150 + f154; + f179 = MUL_C(COEF_CONST(1.3870398453221473), f150); + f180 = MUL_F(FRAC_CONST(-0.8314696123025455), f178); + f181 = MUL_F(FRAC_CONST(-0.2758993792829436), f154); + f182 = f179 + f180; + f183 = f181 - f180; + f184 = f177 - f183; + f185 = f177 + f183; + f186 = MUL_F(FRAC_CONST(0.7071067811865476), f184); + f187 = f176 - f182; + f188 = f176 + f182; + f189 = MUL_F(FRAC_CONST(0.7071067811865476), f188); + f190 = f186 - f189; + f191 = f186 + f189; + f192 = f169 - f185; + f193 = f169 + f185; + f194 = f171 - f191; + f195 = f171 + f191; + f196 = f170 - f190; + f197 = f170 + f190; + f198 = f168 - f187; + f199 = f168 + f187; + f200 = MUL_F(FRAC_CONST(0.7071067811865476), f151); + f201 = f30 - f200; + f202 = f30 + f200; + f203 = f155 + f147; + f204 = MUL_C(COEF_CONST(1.3065629648763766), f155); + f205 = MUL_F(FRAC_CONST(-0.9238795325112866), f203); + f206 = MUL_F(FRAC_CONST(-0.5411961001461967), f147); + f207 = f204 + f205; + f208 = f206 - f205; + f209 = f202 - f208; + f210 = f202 + f208; + f211 = f201 - f207; + f212 = f201 + f207; + f213 = f157 + f145; + f214 = MUL_C(COEF_CONST(1.1758756024193588), f157); + f215 = MUL_F(FRAC_CONST(-0.9807852804032304), f213); + f216 = MUL_F(FRAC_CONST(-0.7856949583871021), f145); + f217 = f214 + f215; + f218 = f216 - f215; + f219 = f153 + f149; + f220 = MUL_C(COEF_CONST(1.3870398453221473), f153); + f221 = MUL_F(FRAC_CONST(-0.8314696123025455), f219); + f222 = MUL_F(FRAC_CONST(-0.2758993792829436), f149); + f223 = f220 + f221; + f224 = f222 - f221; + f225 = f218 - f224; + f226 = f218 + f224; + f227 = MUL_F(FRAC_CONST(0.7071067811865476), f225); + f228 = f217 - f223; + f229 = f217 + f223; + f230 = MUL_F(FRAC_CONST(0.7071067811865476), f229); + f231 = f227 - f230; + f232 = f227 + f230; + f233 = f210 - f226; + f234 = f210 + f226; + f235 = f212 - f232; + f236 = f212 + f232; + f237 = f211 - f231; + f238 = f211 + f231; + f239 = f209 - f228; + f240 = f209 + f228; + f241 = f234 + f193; + f242 = MUL_F(FRAC_CONST(-0.9497277818777543), f234); + f243 = MUL_F(FRAC_CONST(0.9987954562051724), f241); + f244 = MUL_C(COEF_CONST(1.0478631305325905), f193); + y[1] = f242 + f243; + y[31] = f244 - f243; + f247 = f195 - f236; + f248 = MUL_F(FRAC_CONST(-0.8424460355094192), f236); + f249 = MUL_F(FRAC_CONST(0.9891765099647810), f247); + f250 = MUL_C(COEF_CONST(1.1359069844201428), f195); + y[3] = f249 - f248; + y[29] = f250 - f249; + f253 = f238 + f197; + f254 = MUL_F(FRAC_CONST(-0.7270510732912801), f238); + f255 = MUL_F(FRAC_CONST(0.9700312531945440), f253); + f256 = MUL_C(COEF_CONST(1.2130114330978079), f197); + y[5] = f254 + f255; + y[27] = f256 - f255; + f259 = f199 - f240; + f260 = MUL_F(FRAC_CONST(-0.6046542117908007), f240); + f261 = MUL_F(FRAC_CONST(0.9415440651830208), f259); + f262 = MUL_C(COEF_CONST(1.2784339185752409), f199); + y[7] = f261 - f260; + y[25] = f262 - f261; + f265 = f239 + f198; + f266 = MUL_F(FRAC_CONST(-0.4764341996931611), f239); + f267 = MUL_F(FRAC_CONST(0.9039892931234433), f265); + f268 = MUL_C(COEF_CONST(1.3315443865537255), f198); + y[9] = f266 + f267; + y[23] = f268 - f267; + f271 = f196 - f237; + f272 = MUL_F(FRAC_CONST(-0.3436258658070505), f237); + f273 = MUL_F(FRAC_CONST(0.8577286100002721), f271); + f274 = MUL_C(COEF_CONST(1.3718313541934939), f196); + y[11] = f273 - f272; + y[21] = f274 - f273; + f277 = f235 + f194; + f278 = MUL_F(FRAC_CONST(-0.2075082269882114), f235); + f279 = MUL_F(FRAC_CONST(0.8032075314806448), f277); + f280 = MUL_C(COEF_CONST(1.3989068359730783), f194); + y[13] = f278 + f279; + y[19] = f280 - f279; + f283 = f192 - f233; + f284 = MUL_F(FRAC_CONST(-0.0693921705079408), f233); + f285 = MUL_F(FRAC_CONST(0.7409511253549591), f283); + f286 = MUL_C(COEF_CONST(1.4125100802019774), f192); + y[15] = f285 - f284; + y[17] = f286 - f285; +} + +#else + + +#define n 32 +#define log2n 5 + +// w_array_real[i] = cos(2*M_PI*i/32) +static const real_t w_array_real[] = { + FRAC_CONST(1.000000000000000), FRAC_CONST(0.980785279337272), + FRAC_CONST(0.923879528329380), FRAC_CONST(0.831469603195765), + FRAC_CONST(0.707106765732237), FRAC_CONST(0.555570210304169), + FRAC_CONST(0.382683402077046), FRAC_CONST(0.195090284503576), + FRAC_CONST(0.000000000000000), FRAC_CONST(-0.195090370246552), + FRAC_CONST(-0.382683482845162), FRAC_CONST(-0.555570282993553), + FRAC_CONST(-0.707106827549476), FRAC_CONST(-0.831469651765257), + FRAC_CONST(-0.923879561784627), FRAC_CONST(-0.980785296392607) +}; + +// w_array_imag[i] = sin(-2*M_PI*i/32) +static const real_t w_array_imag[] = { + FRAC_CONST(0.000000000000000), FRAC_CONST(-0.195090327375064), + FRAC_CONST(-0.382683442461104), FRAC_CONST(-0.555570246648862), + FRAC_CONST(-0.707106796640858), FRAC_CONST(-0.831469627480512), + FRAC_CONST(-0.923879545057005), FRAC_CONST(-0.980785287864940), + FRAC_CONST(-1.000000000000000), FRAC_CONST(-0.980785270809601), + FRAC_CONST(-0.923879511601754), FRAC_CONST(-0.831469578911016), + FRAC_CONST(-0.707106734823616), FRAC_CONST(-0.555570173959476), + FRAC_CONST(-0.382683361692986), FRAC_CONST(-0.195090241632088) +}; + +// FFT decimation in frequency +// 4*16*2+16=128+16=144 multiplications +// 6*16*2+10*8+4*16*2=192+80+128=400 additions +static void fft_dif(real_t * Real, real_t * Imag) +{ + real_t w_real, w_imag; // For faster access + real_t point1_real, point1_imag, point2_real, point2_imag; // For faster access + uint32_t j, i, i2, w_index; // Counters + + // First 2 stages of 32 point FFT decimation in frequency + // 4*16*2=64*2=128 multiplications + // 6*16*2=96*2=192 additions + // Stage 1 of 32 point FFT decimation in frequency + for (i = 0; i < 16; i++) + { + point1_real = Real[i]; + point1_imag = Imag[i]; + i2 = i+16; + point2_real = Real[i2]; + point2_imag = Imag[i2]; + + w_real = w_array_real[i]; + w_imag = w_array_imag[i]; + + // temp1 = x[i] - x[i2] + point1_real -= point2_real; + point1_imag -= point2_imag; + + // x[i1] = x[i] + x[i2] + Real[i] += point2_real; + Imag[i] += point2_imag; + + // x[i2] = (x[i] - x[i2]) * w + Real[i2] = (MUL_F(point1_real,w_real) - MUL_F(point1_imag,w_imag)); + Imag[i2] = (MUL_F(point1_real,w_imag) + MUL_F(point1_imag,w_real)); + } + // Stage 2 of 32 point FFT decimation in frequency + for (j = 0, w_index = 0; j < 8; j++, w_index += 2) + { + w_real = w_array_real[w_index]; + w_imag = w_array_imag[w_index]; + + i = j; + point1_real = Real[i]; + point1_imag = Imag[i]; + i2 = i+8; + point2_real = Real[i2]; + point2_imag = Imag[i2]; + + // temp1 = x[i] - x[i2] + point1_real -= point2_real; + point1_imag -= point2_imag; + + // x[i1] = x[i] + x[i2] + Real[i] += point2_real; + Imag[i] += point2_imag; + + // x[i2] = (x[i] - x[i2]) * w + Real[i2] = (MUL_F(point1_real,w_real) - MUL_F(point1_imag,w_imag)); + Imag[i2] = (MUL_F(point1_real,w_imag) + MUL_F(point1_imag,w_real)); + + i = j+16; + point1_real = Real[i]; + point1_imag = Imag[i]; + i2 = i+8; + point2_real = Real[i2]; + point2_imag = Imag[i2]; + + // temp1 = x[i] - x[i2] + point1_real -= point2_real; + point1_imag -= point2_imag; + + // x[i1] = x[i] + x[i2] + Real[i] += point2_real; + Imag[i] += point2_imag; + + // x[i2] = (x[i] - x[i2]) * w + Real[i2] = (MUL_F(point1_real,w_real) - MUL_F(point1_imag,w_imag)); + Imag[i2] = (MUL_F(point1_real,w_imag) + MUL_F(point1_imag,w_real)); + } + + // Stage 3 of 32 point FFT decimation in frequency + // 2*4*2=16 multiplications + // 4*4*2+6*4*2=10*8=80 additions + for (i = 0; i < n; i += 8) + { + i2 = i+4; + point1_real = Real[i]; + point1_imag = Imag[i]; + + point2_real = Real[i2]; + point2_imag = Imag[i2]; + + // out[i1] = point1 + point2 + Real[i] += point2_real; + Imag[i] += point2_imag; + + // out[i2] = point1 - point2 + Real[i2] = point1_real - point2_real; + Imag[i2] = point1_imag - point2_imag; + } + w_real = w_array_real[4]; // = sqrt(2)/2 + // w_imag = -w_real; // = w_array_imag[4]; // = -sqrt(2)/2 + for (i = 1; i < n; i += 8) + { + i2 = i+4; + point1_real = Real[i]; + point1_imag = Imag[i]; + + point2_real = Real[i2]; + point2_imag = Imag[i2]; + + // temp1 = x[i] - x[i2] + point1_real -= point2_real; + point1_imag -= point2_imag; + + // x[i1] = x[i] + x[i2] + Real[i] += point2_real; + Imag[i] += point2_imag; + + // x[i2] = (x[i] - x[i2]) * w + Real[i2] = MUL_F(point1_real+point1_imag, w_real); + Imag[i2] = MUL_F(point1_imag-point1_real, w_real); + } + for (i = 2; i < n; i += 8) + { + i2 = i+4; + point1_real = Real[i]; + point1_imag = Imag[i]; + + point2_real = Real[i2]; + point2_imag = Imag[i2]; + + // x[i] = x[i] + x[i2] + Real[i] += point2_real; + Imag[i] += point2_imag; + + // x[i2] = (x[i] - x[i2]) * (-i) + Real[i2] = point1_imag - point2_imag; + Imag[i2] = point2_real - point1_real; + } + w_real = w_array_real[12]; // = -sqrt(2)/2 + // w_imag = w_real; // = w_array_imag[12]; // = -sqrt(2)/2 + for (i = 3; i < n; i += 8) + { + i2 = i+4; + point1_real = Real[i]; + point1_imag = Imag[i]; + + point2_real = Real[i2]; + point2_imag = Imag[i2]; + + // temp1 = x[i] - x[i2] + point1_real -= point2_real; + point1_imag -= point2_imag; + + // x[i1] = x[i] + x[i2] + Real[i] += point2_real; + Imag[i] += point2_imag; + + // x[i2] = (x[i] - x[i2]) * w + Real[i2] = MUL_F(point1_real-point1_imag, w_real); + Imag[i2] = MUL_F(point1_real+point1_imag, w_real); + } + + + // Stage 4 of 32 point FFT decimation in frequency (no multiplications) + // 16*4=64 additions + for (i = 0; i < n; i += 4) + { + i2 = i+2; + point1_real = Real[i]; + point1_imag = Imag[i]; + + point2_real = Real[i2]; + point2_imag = Imag[i2]; + + // x[i1] = x[i] + x[i2] + Real[i] += point2_real; + Imag[i] += point2_imag; + + // x[i2] = x[i] - x[i2] + Real[i2] = point1_real - point2_real; + Imag[i2] = point1_imag - point2_imag; + } + for (i = 1; i < n; i += 4) + { + i2 = i+2; + point1_real = Real[i]; + point1_imag = Imag[i]; + + point2_real = Real[i2]; + point2_imag = Imag[i2]; + + // x[i] = x[i] + x[i2] + Real[i] += point2_real; + Imag[i] += point2_imag; + + // x[i2] = (x[i] - x[i2]) * (-i) + Real[i2] = point1_imag - point2_imag; + Imag[i2] = point2_real - point1_real; + } + + // Stage 5 of 32 point FFT decimation in frequency (no multiplications) + // 16*4=64 additions + for (i = 0; i < n; i += 2) + { + i2 = i+1; + point1_real = Real[i]; + point1_imag = Imag[i]; + + point2_real = Real[i2]; + point2_imag = Imag[i2]; + + // out[i1] = point1 + point2 + Real[i] += point2_real; + Imag[i] += point2_imag; + + // out[i2] = point1 - point2 + Real[i2] = point1_real - point2_real; + Imag[i2] = point1_imag - point2_imag; + } + +#ifdef REORDER_IN_FFT + FFTReorder(Real, Imag); +#endif // #ifdef REORDER_IN_FFT +} +#undef n +#undef log2n + +static const real_t dct4_64_tab[] = { + COEF_CONST(0.999924719333649), COEF_CONST(0.998118102550507), + COEF_CONST(0.993906974792480), COEF_CONST(0.987301409244537), + COEF_CONST(0.978317379951477), COEF_CONST(0.966976463794708), + COEF_CONST(0.953306019306183), COEF_CONST(0.937339007854462), + COEF_CONST(0.919113874435425), COEF_CONST(0.898674488067627), + COEF_CONST(0.876070082187653), COEF_CONST(0.851355195045471), + COEF_CONST(0.824589252471924), COEF_CONST(0.795836925506592), + COEF_CONST(0.765167236328125), COEF_CONST(0.732654273509979), + COEF_CONST(0.698376238346100), COEF_CONST(0.662415742874146), + COEF_CONST(0.624859452247620), COEF_CONST(0.585797846317291), + COEF_CONST(0.545324981212616), COEF_CONST(0.503538429737091), + COEF_CONST(0.460538715124130), COEF_CONST(0.416429549455643), + COEF_CONST(0.371317148208618), COEF_CONST(0.325310230255127), + COEF_CONST(0.278519600629807), COEF_CONST(0.231058135628700), + COEF_CONST(0.183039888739586), COEF_CONST(0.134580686688423), + COEF_CONST(0.085797272622585), COEF_CONST(0.036807164549828), + COEF_CONST(-1.012196302413940), COEF_CONST(-1.059438824653626), + COEF_CONST(-1.104129195213318), COEF_CONST(-1.146159529685974), + COEF_CONST(-1.185428738594055), COEF_CONST(-1.221842169761658), + COEF_CONST(-1.255311965942383), COEF_CONST(-1.285757660865784), + COEF_CONST(-1.313105940818787), COEF_CONST(-1.337290763854981), + COEF_CONST(-1.358253836631775), COEF_CONST(-1.375944852828980), + COEF_CONST(-1.390321016311646), COEF_CONST(-1.401347875595093), + COEF_CONST(-1.408998727798462), COEF_CONST(-1.413255214691162), + COEF_CONST(-1.414107084274292), COEF_CONST(-1.411552190780640), + COEF_CONST(-1.405596733093262), COEF_CONST(-1.396255016326904), + COEF_CONST(-1.383549690246582), COEF_CONST(-1.367511272430420), + COEF_CONST(-1.348178386688232), COEF_CONST(-1.325597524642944), + COEF_CONST(-1.299823284149170), COEF_CONST(-1.270917654037476), + COEF_CONST(-1.238950133323669), COEF_CONST(-1.203998088836670), + COEF_CONST(-1.166145324707031), COEF_CONST(-1.125483393669128), + COEF_CONST(-1.082109928131104), COEF_CONST(-1.036129593849182), + COEF_CONST(-0.987653195858002), COEF_CONST(-0.936797380447388), + COEF_CONST(-0.883684754371643), COEF_CONST(-0.828443288803101), + COEF_CONST(-0.771206021308899), COEF_CONST(-0.712110757827759), + COEF_CONST(-0.651300072669983), COEF_CONST(-0.588920354843140), + COEF_CONST(-0.525121808052063), COEF_CONST(-0.460058242082596), + COEF_CONST(-0.393886327743530), COEF_CONST(-0.326765477657318), + COEF_CONST(-0.258857429027557), COEF_CONST(-0.190325915813446), + COEF_CONST(-0.121335685253143), COEF_CONST(-0.052053272724152), + COEF_CONST(0.017354607582092), COEF_CONST(0.086720645427704), + COEF_CONST(0.155877828598022), COEF_CONST(0.224659323692322), + COEF_CONST(0.292899727821350), COEF_CONST(0.360434412956238), + COEF_CONST(0.427100926637650), COEF_CONST(0.492738455533981), + COEF_CONST(0.557188928127289), COEF_CONST(0.620297133922577), + COEF_CONST(0.681910991668701), COEF_CONST(0.741881847381592), + COEF_CONST(0.800065577030182), COEF_CONST(0.856321990489960), + COEF_CONST(0.910515367984772), COEF_CONST(0.962515234947205), + COEF_CONST(1.000000000000000), COEF_CONST(0.998795449733734), + COEF_CONST(0.995184719562531), COEF_CONST(0.989176511764526), + COEF_CONST(0.980785250663757), COEF_CONST(0.970031261444092), + COEF_CONST(0.956940352916718), COEF_CONST(0.941544055938721), + COEF_CONST(0.923879504203796), COEF_CONST(0.903989315032959), + COEF_CONST(0.881921231746674), COEF_CONST(0.857728600502014), + COEF_CONST(0.831469595432281), COEF_CONST(0.803207516670227), + COEF_CONST(0.773010432720184), COEF_CONST(0.740951120853424), + COEF_CONST(0.707106769084930), COEF_CONST(0.671558916568756), + COEF_CONST(0.634393274784088), COEF_CONST(0.595699310302734), + COEF_CONST(0.555570185184479), COEF_CONST(0.514102697372437), + COEF_CONST(0.471396654844284), COEF_CONST(0.427555114030838), + COEF_CONST(0.382683426141739), COEF_CONST(0.336889833211899), + COEF_CONST(0.290284633636475), COEF_CONST(0.242980122566223), + COEF_CONST(0.195090234279633), COEF_CONST(0.146730497479439), + COEF_CONST(0.098017133772373), COEF_CONST(0.049067649990320), + COEF_CONST(-1.000000000000000), COEF_CONST(-1.047863125801086), + COEF_CONST(-1.093201875686646), COEF_CONST(-1.135906934738159), + COEF_CONST(-1.175875544548035), COEF_CONST(-1.213011503219605), + COEF_CONST(-1.247225046157837), COEF_CONST(-1.278433918952942), + COEF_CONST(-1.306562900543213), COEF_CONST(-1.331544399261475), + COEF_CONST(-1.353317975997925), COEF_CONST(-1.371831417083740), + COEF_CONST(-1.387039899826050), COEF_CONST(-1.398906826972961), + COEF_CONST(-1.407403707504273), COEF_CONST(-1.412510156631470), + COEF_CONST(0), COEF_CONST(-1.412510156631470), + COEF_CONST(-1.407403707504273), COEF_CONST(-1.398906826972961), + COEF_CONST(-1.387039899826050), COEF_CONST(-1.371831417083740), + COEF_CONST(-1.353317975997925), COEF_CONST(-1.331544399261475), + COEF_CONST(-1.306562900543213), COEF_CONST(-1.278433918952942), + COEF_CONST(-1.247225046157837), COEF_CONST(-1.213011384010315), + COEF_CONST(-1.175875544548035), COEF_CONST(-1.135907053947449), + COEF_CONST(-1.093201875686646), COEF_CONST(-1.047863125801086), + COEF_CONST(-1.000000000000000), COEF_CONST(-0.949727773666382), + COEF_CONST(-0.897167563438416), COEF_CONST(-0.842446029186249), + COEF_CONST(-0.785694956779480), COEF_CONST(-0.727051079273224), + COEF_CONST(-0.666655659675598), COEF_CONST(-0.604654192924500), + COEF_CONST(-0.541196048259735), COEF_CONST(-0.476434230804443), + COEF_CONST(-0.410524487495422), COEF_CONST(-0.343625843524933), + COEF_CONST(-0.275899350643158), COEF_CONST(-0.207508206367493), + COEF_CONST(-0.138617098331451), COEF_CONST(-0.069392144680023), + COEF_CONST(0), COEF_CONST(0.069392263889313), + COEF_CONST(0.138617157936096), COEF_CONST(0.207508206367493), + COEF_CONST(0.275899469852448), COEF_CONST(0.343625962734222), + COEF_CONST(0.410524636507034), COEF_CONST(0.476434201002121), + COEF_CONST(0.541196107864380), COEF_CONST(0.604654192924500), + COEF_CONST(0.666655719280243), COEF_CONST(0.727051138877869), + COEF_CONST(0.785695075988770), COEF_CONST(0.842446029186249), + COEF_CONST(0.897167563438416), COEF_CONST(0.949727773666382) +}; + +/* size 64 only! */ +void dct4_kernel(real_t * in_real, real_t * in_imag, real_t * out_real, real_t * out_imag) +{ + // Tables with bit reverse values for 5 bits, bit reverse of i at i-th position + const uint8_t bit_rev_tab[32] = { 0,16,8,24,4,20,12,28,2,18,10,26,6,22,14,30,1,17,9,25,5,21,13,29,3,19,11,27,7,23,15,31 }; + uint16_t i, i_rev; + + /* Step 2: modulate */ + // 3*32=96 multiplications + // 3*32=96 additions + for (i = 0; i < 32; i++) + { + real_t x_re, x_im, tmp; + x_re = in_real[i]; + x_im = in_imag[i]; + tmp = MUL_C(x_re + x_im, dct4_64_tab[i]); + in_real[i] = MUL_C(x_im, dct4_64_tab[i + 64]) + tmp; + in_imag[i] = MUL_C(x_re, dct4_64_tab[i + 32]) + tmp; + } + + /* Step 3: FFT, but with output in bit reverse order */ + fft_dif(in_real, in_imag); + + /* Step 4: modulate + bitreverse reordering */ + // 3*31+2=95 multiplications + // 3*31+2=95 additions + for (i = 0; i < 16; i++) + { + real_t x_re, x_im, tmp; + i_rev = bit_rev_tab[i]; + x_re = in_real[i_rev]; + x_im = in_imag[i_rev]; + + tmp = MUL_C(x_re + x_im, dct4_64_tab[i + 3*32]); + out_real[i] = MUL_C(x_im, dct4_64_tab[i + 5*32]) + tmp; + out_imag[i] = MUL_C(x_re, dct4_64_tab[i + 4*32]) + tmp; + } + // i = 16, i_rev = 1 = rev(16); + out_imag[16] = MUL_C(in_imag[1] - in_real[1], dct4_64_tab[16 + 3*32]); + out_real[16] = MUL_C(in_real[1] + in_imag[1], dct4_64_tab[16 + 3*32]); + for (i = 17; i < 32; i++) + { + real_t x_re, x_im, tmp; + i_rev = bit_rev_tab[i]; + x_re = in_real[i_rev]; + x_im = in_imag[i_rev]; + tmp = MUL_C(x_re + x_im, dct4_64_tab[i + 3*32]); + out_real[i] = MUL_C(x_im, dct4_64_tab[i + 5*32]) + tmp; + out_imag[i] = MUL_C(x_re, dct4_64_tab[i + 4*32]) + tmp; + } + +} + +void DST4_32(real_t *y, real_t *x) +{ + real_t f0, f1, f2, f3, f4, f5, f6, f7, f8, f9; + real_t f10, f11, f12, f13, f14, f15, f16, f17, f18, f19; + real_t f20, f21, f22, f23, f24, f25, f26, f27, f28, f29; + real_t f30, f31, f32, f33, f34, f35, f36, f37, f38, f39; + real_t f40, f41, f42, f43, f44, f45, f46, f47, f48, f49; + real_t f50, f51, f52, f53, f54, f55, f56, f57, f58, f59; + real_t f60, f61, f62, f63, f64, f65, f66, f67, f68, f69; + real_t f70, f71, f72, f73, f74, f75, f76, f77, f78, f79; + real_t f80, f81, f82, f83, f84, f85, f86, f87, f88, f89; + real_t f90, f91, f92, f93, f94, f95, f96, f97, f98, f99; + real_t f100, f101, f102, f103, f104, f105, f106, f107, f108, f109; + real_t f110, f111, f112, f113, f114, f115, f116, f117, f118, f119; + real_t f120, f121, f122, f123, f124, f125, f126, f127, f128, f129; + real_t f130, f131, f132, f133, f134, f135, f136, f137, f138, f139; + real_t f140, f141, f142, f143, f144, f145, f146, f147, f148, f149; + real_t f150, f151, f152, f153, f154, f155, f156, f157, f158, f159; + real_t f160, f161, f162, f163, f164, f165, f166, f167, f168, f169; + real_t f170, f171, f172, f173, f174, f175, f176, f177, f178, f179; + real_t f180, f181, f182, f183, f184, f185, f186, f187, f188, f189; + real_t f190, f191, f192, f193, f194, f195, f196, f197, f198, f199; + real_t f200, f201, f202, f203, f204, f205, f206, f207, f208, f209; + real_t f210, f211, f212, f213, f214, f215, f216, f217, f218, f219; + real_t f220, f221, f222, f223, f224, f225, f226, f227, f228, f229; + real_t f230, f231, f232, f233, f234, f235, f236, f237, f238, f239; + real_t f240, f241, f242, f243, f244, f245, f246, f247, f248, f249; + real_t f250, f251, f252, f253, f254, f255, f256, f257, f258, f259; + real_t f260, f261, f262, f263, f264, f265, f266, f267, f268, f269; + real_t f270, f271, f272, f273, f274, f275, f276, f277, f278, f279; + real_t f280, f281, f282, f283, f284, f285, f286, f287, f288, f289; + real_t f290, f291, f292, f293, f294, f295, f296, f297, f298, f299; + real_t f300, f301, f302, f303, f304, f305, f306, f307, f308, f309; + real_t f310, f311, f312, f313, f314, f315, f316, f317, f318, f319; + real_t f320, f321, f322, f323, f324, f325, f326, f327, f328, f329; + real_t f330, f331, f332, f333, f334, f335; + + f0 = x[0] - x[1]; + f1 = x[2] - x[1]; + f2 = x[2] - x[3]; + f3 = x[4] - x[3]; + f4 = x[4] - x[5]; + f5 = x[6] - x[5]; + f6 = x[6] - x[7]; + f7 = x[8] - x[7]; + f8 = x[8] - x[9]; + f9 = x[10] - x[9]; + f10 = x[10] - x[11]; + f11 = x[12] - x[11]; + f12 = x[12] - x[13]; + f13 = x[14] - x[13]; + f14 = x[14] - x[15]; + f15 = x[16] - x[15]; + f16 = x[16] - x[17]; + f17 = x[18] - x[17]; + f18 = x[18] - x[19]; + f19 = x[20] - x[19]; + f20 = x[20] - x[21]; + f21 = x[22] - x[21]; + f22 = x[22] - x[23]; + f23 = x[24] - x[23]; + f24 = x[24] - x[25]; + f25 = x[26] - x[25]; + f26 = x[26] - x[27]; + f27 = x[28] - x[27]; + f28 = x[28] - x[29]; + f29 = x[30] - x[29]; + f30 = x[30] - x[31]; + f31 = MUL_F(FRAC_CONST(0.7071067811865476), f15); + f32 = x[0] - f31; + f33 = x[0] + f31; + f34 = f7 + f23; + f35 = MUL_C(COEF_CONST(1.3065629648763766), f7); + f36 = MUL_F(FRAC_CONST(-0.9238795325112866), f34); + f37 = MUL_F(FRAC_CONST(-0.5411961001461967), f23); + f38 = f35 + f36; + f39 = f37 - f36; + f40 = f33 - f39; + f41 = f33 + f39; + f42 = f32 - f38; + f43 = f32 + f38; + f44 = f11 - f19; + f45 = f11 + f19; + f46 = MUL_F(FRAC_CONST(0.7071067811865476), f45); + f47 = f3 - f46; + f48 = f3 + f46; + f49 = MUL_F(FRAC_CONST(0.7071067811865476), f44); + f50 = f49 - f27; + f51 = f49 + f27; + f52 = f51 + f48; + f53 = MUL_F(FRAC_CONST(-0.7856949583871021), f51); + f54 = MUL_F(FRAC_CONST(0.9807852804032304), f52); + f55 = MUL_C(COEF_CONST(1.1758756024193588), f48); + f56 = f53 + f54; + f57 = f55 - f54; + f58 = f50 + f47; + f59 = MUL_F(FRAC_CONST(-0.2758993792829430), f50); + f60 = MUL_F(FRAC_CONST(0.8314696123025452), f58); + f61 = MUL_C(COEF_CONST(1.3870398453221475), f47); + f62 = f59 + f60; + f63 = f61 - f60; + f64 = f41 - f56; + f65 = f41 + f56; + f66 = f43 - f62; + f67 = f43 + f62; + f68 = f42 - f63; + f69 = f42 + f63; + f70 = f40 - f57; + f71 = f40 + f57; + f72 = f5 - f9; + f73 = f5 + f9; + f74 = f13 - f17; + f75 = f13 + f17; + f76 = f21 - f25; + f77 = f21 + f25; + f78 = MUL_F(FRAC_CONST(0.7071067811865476), f75); + f79 = f1 - f78; + f80 = f1 + f78; + f81 = f73 + f77; + f82 = MUL_C(COEF_CONST(1.3065629648763766), f73); + f83 = MUL_F(FRAC_CONST(-0.9238795325112866), f81); + f84 = MUL_F(FRAC_CONST(-0.5411961001461967), f77); + f85 = f82 + f83; + f86 = f84 - f83; + f87 = f80 - f86; + f88 = f80 + f86; + f89 = f79 - f85; + f90 = f79 + f85; + f91 = MUL_F(FRAC_CONST(0.7071067811865476), f74); + f92 = f29 - f91; + f93 = f29 + f91; + f94 = f76 + f72; + f95 = MUL_C(COEF_CONST(1.3065629648763766), f76); + f96 = MUL_F(FRAC_CONST(-0.9238795325112866), f94); + f97 = MUL_F(FRAC_CONST(-0.5411961001461967), f72); + f98 = f95 + f96; + f99 = f97 - f96; + f100 = f93 - f99; + f101 = f93 + f99; + f102 = f92 - f98; + f103 = f92 + f98; + f104 = f101 + f88; + f105 = MUL_F(FRAC_CONST(-0.8971675863426361), f101); + f106 = MUL_F(FRAC_CONST(0.9951847266721968), f104); + f107 = MUL_C(COEF_CONST(1.0932018670017576), f88); + f108 = f105 + f106; + f109 = f107 - f106; + f110 = f90 - f103; + f111 = MUL_F(FRAC_CONST(-0.6666556584777466), f103); + f112 = MUL_F(FRAC_CONST(0.9569403357322089), f110); + f113 = MUL_C(COEF_CONST(1.2472250129866713), f90); + f114 = f112 - f111; + f115 = f113 - f112; + f116 = f102 + f89; + f117 = MUL_F(FRAC_CONST(-0.4105245275223571), f102); + f118 = MUL_F(FRAC_CONST(0.8819212643483549), f116); + f119 = MUL_C(COEF_CONST(1.3533180011743529), f89); + f120 = f117 + f118; + f121 = f119 - f118; + f122 = f87 - f100; + f123 = MUL_F(FRAC_CONST(-0.1386171691990915), f100); + f124 = MUL_F(FRAC_CONST(0.7730104533627370), f122); + f125 = MUL_C(COEF_CONST(1.4074037375263826), f87); + f126 = f124 - f123; + f127 = f125 - f124; + f128 = f65 - f108; + f129 = f65 + f108; + f130 = f67 - f114; + f131 = f67 + f114; + f132 = f69 - f120; + f133 = f69 + f120; + f134 = f71 - f126; + f135 = f71 + f126; + f136 = f70 - f127; + f137 = f70 + f127; + f138 = f68 - f121; + f139 = f68 + f121; + f140 = f66 - f115; + f141 = f66 + f115; + f142 = f64 - f109; + f143 = f64 + f109; + f144 = f0 + f30; + f145 = MUL_C(COEF_CONST(1.0478631305325901), f0); + f146 = MUL_F(FRAC_CONST(-0.9987954562051724), f144); + f147 = MUL_F(FRAC_CONST(-0.9497277818777548), f30); + f148 = f145 + f146; + f149 = f147 - f146; + f150 = f4 + f26; + f151 = MUL_F(FRAC_CONST(1.2130114330978077), f4); + f152 = MUL_F(FRAC_CONST(-0.9700312531945440), f150); + f153 = MUL_F(FRAC_CONST(-0.7270510732912803), f26); + f154 = f151 + f152; + f155 = f153 - f152; + f156 = f8 + f22; + f157 = MUL_C(COEF_CONST(1.3315443865537255), f8); + f158 = MUL_F(FRAC_CONST(-0.9039892931234433), f156); + f159 = MUL_F(FRAC_CONST(-0.4764341996931612), f22); + f160 = f157 + f158; + f161 = f159 - f158; + f162 = f12 + f18; + f163 = MUL_C(COEF_CONST(1.3989068359730781), f12); + f164 = MUL_F(FRAC_CONST(-0.8032075314806453), f162); + f165 = MUL_F(FRAC_CONST(-0.2075082269882124), f18); + f166 = f163 + f164; + f167 = f165 - f164; + f168 = f16 + f14; + f169 = MUL_C(COEF_CONST(1.4125100802019777), f16); + f170 = MUL_F(FRAC_CONST(-0.6715589548470187), f168); + f171 = MUL_F(FRAC_CONST(0.0693921705079402), f14); + f172 = f169 + f170; + f173 = f171 - f170; + f174 = f20 + f10; + f175 = MUL_C(COEF_CONST(1.3718313541934939), f20); + f176 = MUL_F(FRAC_CONST(-0.5141027441932219), f174); + f177 = MUL_F(FRAC_CONST(0.3436258658070501), f10); + f178 = f175 + f176; + f179 = f177 - f176; + f180 = f24 + f6; + f181 = MUL_C(COEF_CONST(1.2784339185752409), f24); + f182 = MUL_F(FRAC_CONST(-0.3368898533922200), f180); + f183 = MUL_F(FRAC_CONST(0.6046542117908008), f6); + f184 = f181 + f182; + f185 = f183 - f182; + f186 = f28 + f2; + f187 = MUL_C(COEF_CONST(1.1359069844201433), f28); + f188 = MUL_F(FRAC_CONST(-0.1467304744553624), f186); + f189 = MUL_F(FRAC_CONST(0.8424460355094185), f2); + f190 = f187 + f188; + f191 = f189 - f188; + f192 = f149 - f173; + f193 = f149 + f173; + f194 = f148 - f172; + f195 = f148 + f172; + f196 = f155 - f179; + f197 = f155 + f179; + f198 = f154 - f178; + f199 = f154 + f178; + f200 = f161 - f185; + f201 = f161 + f185; + f202 = f160 - f184; + f203 = f160 + f184; + f204 = f167 - f191; + f205 = f167 + f191; + f206 = f166 - f190; + f207 = f166 + f190; + f208 = f192 + f194; + f209 = MUL_C(COEF_CONST(1.1758756024193588), f192); + f210 = MUL_F(FRAC_CONST(-0.9807852804032304), f208); + f211 = MUL_F(FRAC_CONST(-0.7856949583871021), f194); + f212 = f209 + f210; + f213 = f211 - f210; + f214 = f196 + f198; + f215 = MUL_C(COEF_CONST(1.3870398453221475), f196); + f216 = MUL_F(FRAC_CONST(-0.5555702330196022), f214); + f217 = MUL_F(FRAC_CONST(0.2758993792829431), f198); + f218 = f215 + f216; + f219 = f217 - f216; + f220 = f200 + f202; + f221 = MUL_F(FRAC_CONST(0.7856949583871022), f200); + f222 = MUL_F(FRAC_CONST(0.1950903220161283), f220); + f223 = MUL_C(COEF_CONST(1.1758756024193586), f202); + f224 = f221 + f222; + f225 = f223 - f222; + f226 = f204 + f206; + f227 = MUL_F(FRAC_CONST(-0.2758993792829430), f204); + f228 = MUL_F(FRAC_CONST(0.8314696123025452), f226); + f229 = MUL_C(COEF_CONST(1.3870398453221475), f206); + f230 = f227 + f228; + f231 = f229 - f228; + f232 = f193 - f201; + f233 = f193 + f201; + f234 = f195 - f203; + f235 = f195 + f203; + f236 = f197 - f205; + f237 = f197 + f205; + f238 = f199 - f207; + f239 = f199 + f207; + f240 = f213 - f225; + f241 = f213 + f225; + f242 = f212 - f224; + f243 = f212 + f224; + f244 = f219 - f231; + f245 = f219 + f231; + f246 = f218 - f230; + f247 = f218 + f230; + f248 = f232 + f234; + f249 = MUL_C(COEF_CONST(1.3065629648763766), f232); + f250 = MUL_F(FRAC_CONST(-0.9238795325112866), f248); + f251 = MUL_F(FRAC_CONST(-0.5411961001461967), f234); + f252 = f249 + f250; + f253 = f251 - f250; + f254 = f236 + f238; + f255 = MUL_F(FRAC_CONST(0.5411961001461969), f236); + f256 = MUL_F(FRAC_CONST(0.3826834323650898), f254); + f257 = MUL_C(COEF_CONST(1.3065629648763766), f238); + f258 = f255 + f256; + f259 = f257 - f256; + f260 = f240 + f242; + f261 = MUL_C(COEF_CONST(1.3065629648763766), f240); + f262 = MUL_F(FRAC_CONST(-0.9238795325112866), f260); + f263 = MUL_F(FRAC_CONST(-0.5411961001461967), f242); + f264 = f261 + f262; + f265 = f263 - f262; + f266 = f244 + f246; + f267 = MUL_F(FRAC_CONST(0.5411961001461969), f244); + f268 = MUL_F(FRAC_CONST(0.3826834323650898), f266); + f269 = MUL_C(COEF_CONST(1.3065629648763766), f246); + f270 = f267 + f268; + f271 = f269 - f268; + f272 = f233 - f237; + f273 = f233 + f237; + f274 = f235 - f239; + f275 = f235 + f239; + f276 = f253 - f259; + f277 = f253 + f259; + f278 = f252 - f258; + f279 = f252 + f258; + f280 = f241 - f245; + f281 = f241 + f245; + f282 = f243 - f247; + f283 = f243 + f247; + f284 = f265 - f271; + f285 = f265 + f271; + f286 = f264 - f270; + f287 = f264 + f270; + f288 = f272 - f274; + f289 = f272 + f274; + f290 = MUL_F(FRAC_CONST(0.7071067811865474), f288); + f291 = MUL_F(FRAC_CONST(0.7071067811865474), f289); + f292 = f276 - f278; + f293 = f276 + f278; + f294 = MUL_F(FRAC_CONST(0.7071067811865474), f292); + f295 = MUL_F(FRAC_CONST(0.7071067811865474), f293); + f296 = f280 - f282; + f297 = f280 + f282; + f298 = MUL_F(FRAC_CONST(0.7071067811865474), f296); + f299 = MUL_F(FRAC_CONST(0.7071067811865474), f297); + f300 = f284 - f286; + f301 = f284 + f286; + f302 = MUL_F(FRAC_CONST(0.7071067811865474), f300); + f303 = MUL_F(FRAC_CONST(0.7071067811865474), f301); + f304 = f129 - f273; + f305 = f129 + f273; + f306 = f131 - f281; + f307 = f131 + f281; + f308 = f133 - f285; + f309 = f133 + f285; + f310 = f135 - f277; + f311 = f135 + f277; + f312 = f137 - f295; + f313 = f137 + f295; + f314 = f139 - f303; + f315 = f139 + f303; + f316 = f141 - f299; + f317 = f141 + f299; + f318 = f143 - f291; + f319 = f143 + f291; + f320 = f142 - f290; + f321 = f142 + f290; + f322 = f140 - f298; + f323 = f140 + f298; + f324 = f138 - f302; + f325 = f138 + f302; + f326 = f136 - f294; + f327 = f136 + f294; + f328 = f134 - f279; + f329 = f134 + f279; + f330 = f132 - f287; + f331 = f132 + f287; + f332 = f130 - f283; + f333 = f130 + f283; + f334 = f128 - f275; + f335 = f128 + f275; + y[31] = MUL_F(FRAC_CONST(0.5001506360206510), f305); + y[30] = MUL_F(FRAC_CONST(0.5013584524464084), f307); + y[29] = MUL_F(FRAC_CONST(0.5037887256810443), f309); + y[28] = MUL_F(FRAC_CONST(0.5074711720725553), f311); + y[27] = MUL_F(FRAC_CONST(0.5124514794082247), f313); + y[26] = MUL_F(FRAC_CONST(0.5187927131053328), f315); + y[25] = MUL_F(FRAC_CONST(0.5265773151542700), f317); + y[24] = MUL_F(FRAC_CONST(0.5359098169079920), f319); + y[23] = MUL_F(FRAC_CONST(0.5469204379855088), f321); + y[22] = MUL_F(FRAC_CONST(0.5597698129470802), f323); + y[21] = MUL_F(FRAC_CONST(0.5746551840326600), f325); + y[20] = MUL_F(FRAC_CONST(0.5918185358574165), f327); + y[19] = MUL_F(FRAC_CONST(0.6115573478825099), f329); + y[18] = MUL_F(FRAC_CONST(0.6342389366884031), f331); + y[17] = MUL_F(FRAC_CONST(0.6603198078137061), f333); + y[16] = MUL_F(FRAC_CONST(0.6903721282002123), f335); + y[15] = MUL_F(FRAC_CONST(0.7251205223771985), f334); + y[14] = MUL_F(FRAC_CONST(0.7654941649730891), f332); + y[13] = MUL_F(FRAC_CONST(0.8127020908144905), f330); + y[12] = MUL_F(FRAC_CONST(0.8683447152233481), f328); + y[11] = MUL_F(FRAC_CONST(0.9345835970364075), f326); + y[10] = MUL_C(COEF_CONST(1.0144082649970547), f324); + y[9] = MUL_C(COEF_CONST(1.1120716205797176), f322); + y[8] = MUL_C(COEF_CONST(1.2338327379765710), f320); + y[7] = MUL_C(COEF_CONST(1.3892939586328277), f318); + y[6] = MUL_C(COEF_CONST(1.5939722833856311), f316); + y[5] = MUL_C(COEF_CONST(1.8746759800084078), f314); + y[4] = MUL_C(COEF_CONST(2.2820500680051619), f312); + y[3] = MUL_C(COEF_CONST(2.9246284281582162), f310); + y[2] = MUL_C(COEF_CONST(4.0846110781292477), f308); + y[1] = MUL_C(COEF_CONST(6.7967507116736332), f306); + y[0] = MUL_R(REAL_CONST(20.3738781672314530), f304); +} + +#endif + +#endif diff --git a/Libraries/FAAD2/Files/libfaad/sbr_dct.h b/Libraries/FAAD2/Files/libfaad/sbr_dct.h new file mode 100644 index 000000000..124f159d5 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/sbr_dct.h @@ -0,0 +1,49 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#ifndef __SBR_DCT_H__ +#define __SBR_DCT_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +void dct4_kernel(real_t * in_real, real_t * in_imag, real_t * out_real, real_t * out_imag); + +void DCT3_32_unscaled(real_t *y, real_t *x); +void DCT4_32(real_t *y, real_t *x); +void DST4_32(real_t *y, real_t *x); +void DCT2_32_unscaled(real_t *y, real_t *x); +void DCT4_16(real_t *y, real_t *x); +void DCT2_16_unscaled(real_t *y, real_t *x); + + +#ifdef __cplusplus +} +#endif +#endif + diff --git a/Libraries/FAAD2/Files/libfaad/sbr_dec.c b/Libraries/FAAD2/Files/libfaad/sbr_dec.c new file mode 100644 index 000000000..04752d793 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/sbr_dec.c @@ -0,0 +1,614 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + + +#include "common.h" +#include "structs.h" + +#ifdef SBR_DEC + +#include +#include + +#include "syntax.h" +#include "bits.h" +#include "sbr_syntax.h" +#include "sbr_qmf.h" +#include "sbr_hfgen.h" +#include "sbr_hfadj.h" + + +/* static function declarations */ +static uint8_t sbr_save_prev_data(sbr_info *sbr, uint8_t ch); +static void sbr_save_matrix(sbr_info *sbr, uint8_t ch); + + +sbr_info *sbrDecodeInit(uint16_t framelength, uint8_t id_aac, + uint32_t sample_rate, uint8_t downSampledSBR +#ifdef DRM + , uint8_t IsDRM +#endif + ) +{ + sbr_info *sbr = faad_malloc(sizeof(sbr_info)); + memset(sbr, 0, sizeof(sbr_info)); + + /* save id of the parent element */ + sbr->id_aac = id_aac; + sbr->sample_rate = sample_rate; + + sbr->bs_freq_scale = 2; + sbr->bs_alter_scale = 1; + sbr->bs_noise_bands = 2; + sbr->bs_limiter_bands = 2; + sbr->bs_limiter_gains = 2; + sbr->bs_interpol_freq = 1; + sbr->bs_smoothing_mode = 1; + sbr->bs_start_freq = 5; + sbr->bs_amp_res = 1; + sbr->bs_samplerate_mode = 1; + sbr->prevEnvIsShort[0] = -1; + sbr->prevEnvIsShort[1] = -1; + sbr->header_count = 0; + sbr->Reset = 1; + +#ifdef DRM + sbr->Is_DRM_SBR = IsDRM; +#endif + sbr->tHFGen = T_HFGEN; + sbr->tHFAdj = T_HFADJ; + + sbr->bsco = 0; + sbr->bsco_prev = 0; + sbr->M_prev = 0; + sbr->frame_len = framelength; + + /* force sbr reset */ + sbr->bs_start_freq_prev = -1; + + if (framelength == 960) + { + sbr->numTimeSlotsRate = RATE * NO_TIME_SLOTS_960; + sbr->numTimeSlots = NO_TIME_SLOTS_960; + } else { + sbr->numTimeSlotsRate = RATE * NO_TIME_SLOTS; + sbr->numTimeSlots = NO_TIME_SLOTS; + } + + sbr->GQ_ringbuf_index[0] = 0; + sbr->GQ_ringbuf_index[1] = 0; + + if (id_aac == ID_CPE) + { + /* stereo */ + uint8_t j; + sbr->qmfa[0] = qmfa_init(32); + sbr->qmfa[1] = qmfa_init(32); + sbr->qmfs[0] = qmfs_init((downSampledSBR)?32:64); + sbr->qmfs[1] = qmfs_init((downSampledSBR)?32:64); + + for (j = 0; j < 5; j++) + { + sbr->G_temp_prev[0][j] = faad_malloc(64*sizeof(real_t)); + sbr->G_temp_prev[1][j] = faad_malloc(64*sizeof(real_t)); + sbr->Q_temp_prev[0][j] = faad_malloc(64*sizeof(real_t)); + sbr->Q_temp_prev[1][j] = faad_malloc(64*sizeof(real_t)); + } + + memset(sbr->Xsbr[0], 0, (sbr->numTimeSlotsRate+sbr->tHFGen)*64 * sizeof(qmf_t)); + memset(sbr->Xsbr[1], 0, (sbr->numTimeSlotsRate+sbr->tHFGen)*64 * sizeof(qmf_t)); + } else { + /* mono */ + uint8_t j; + sbr->qmfa[0] = qmfa_init(32); + sbr->qmfs[0] = qmfs_init((downSampledSBR)?32:64); + sbr->qmfs[1] = NULL; + + for (j = 0; j < 5; j++) + { + sbr->G_temp_prev[0][j] = faad_malloc(64*sizeof(real_t)); + sbr->Q_temp_prev[0][j] = faad_malloc(64*sizeof(real_t)); + } + + memset(sbr->Xsbr[0], 0, (sbr->numTimeSlotsRate+sbr->tHFGen)*64 * sizeof(qmf_t)); + } + + return sbr; +} + +void sbrDecodeEnd(sbr_info *sbr) +{ + uint8_t j; + + if (sbr) + { + qmfa_end(sbr->qmfa[0]); + qmfs_end(sbr->qmfs[0]); + if (sbr->qmfs[1] != NULL) + { + qmfa_end(sbr->qmfa[1]); + qmfs_end(sbr->qmfs[1]); + } + + for (j = 0; j < 5; j++) + { + if (sbr->G_temp_prev[0][j]) faad_free(sbr->G_temp_prev[0][j]); + if (sbr->Q_temp_prev[0][j]) faad_free(sbr->Q_temp_prev[0][j]); + if (sbr->G_temp_prev[1][j]) faad_free(sbr->G_temp_prev[1][j]); + if (sbr->Q_temp_prev[1][j]) faad_free(sbr->Q_temp_prev[1][j]); + } + +#ifdef PS_DEC + if (sbr->ps != NULL) + ps_free(sbr->ps); +#endif + +#ifdef DRM_PS + if (sbr->drm_ps != NULL) + drm_ps_free(sbr->drm_ps); +#endif + + faad_free(sbr); + } +} + +static uint8_t sbr_save_prev_data(sbr_info *sbr, uint8_t ch) +{ + uint8_t i; + + /* save data for next frame */ + sbr->kx_prev = sbr->kx; + sbr->M_prev = sbr->M; + sbr->bsco_prev = sbr->bsco; + + sbr->L_E_prev[ch] = sbr->L_E[ch]; + + /* sbr->L_E[ch] can become 0 on files with bit errors */ + if (sbr->L_E[ch] <= 0) + return 19; + + sbr->f_prev[ch] = sbr->f[ch][sbr->L_E[ch] - 1]; + for (i = 0; i < MAX_M; i++) + { + sbr->E_prev[ch][i] = sbr->E[ch][i][sbr->L_E[ch] - 1]; + sbr->Q_prev[ch][i] = sbr->Q[ch][i][sbr->L_Q[ch] - 1]; + } + + for (i = 0; i < MAX_M; i++) + { + sbr->bs_add_harmonic_prev[ch][i] = sbr->bs_add_harmonic[ch][i]; + } + sbr->bs_add_harmonic_flag_prev[ch] = sbr->bs_add_harmonic_flag[ch]; + + if (sbr->l_A[ch] == sbr->L_E[ch]) + sbr->prevEnvIsShort[ch] = 0; + else + sbr->prevEnvIsShort[ch] = -1; + + return 0; +} + +static void sbr_save_matrix(sbr_info *sbr, uint8_t ch) +{ + uint8_t i; + + for (i = 0; i < sbr->tHFGen; i++) + { + memmove(sbr->Xsbr[ch][i], sbr->Xsbr[ch][i+sbr->numTimeSlotsRate], 64 * sizeof(qmf_t)); + } + for (i = sbr->tHFGen; i < MAX_NTSRHFG; i++) + { + memset(sbr->Xsbr[ch][i], 0, 64 * sizeof(qmf_t)); + } +} + +static void sbr_process_channel(sbr_info *sbr, real_t *channel_buf, qmf_t X[MAX_NTSR][64], + uint8_t ch, uint8_t dont_process, + const uint8_t downSampledSBR) +{ + int16_t k, l; + +#ifdef SBR_LOW_POWER + ALIGN real_t deg[64]; +#endif + +#ifdef DRM + if (sbr->Is_DRM_SBR) + { + sbr->bsco = max((int32_t)sbr->maxAACLine*32/(int32_t)sbr->frame_len - (int32_t)sbr->kx, 0); + } else { +#endif + sbr->bsco = 0; +#ifdef DRM + } +#endif + + +//#define PRE_QMF_PRINT +#ifdef PRE_QMF_PRINT + { + int i; + for (i = 0; i < 1024; i++) + { + printf("%d\n", channel_buf[i]); + } + } +#endif + + + /* subband analysis */ + if (dont_process) + sbr_qmf_analysis_32(sbr, sbr->qmfa[ch], channel_buf, sbr->Xsbr[ch], sbr->tHFGen, 32); + else + sbr_qmf_analysis_32(sbr, sbr->qmfa[ch], channel_buf, sbr->Xsbr[ch], sbr->tHFGen, sbr->kx); + + if (!dont_process) + { +#if 1 + /* insert high frequencies here */ + /* hf generation using patching */ + hf_generation(sbr, sbr->Xsbr[ch], sbr->Xsbr[ch] +#ifdef SBR_LOW_POWER + ,deg +#endif + ,ch); +#endif + +#ifdef SBR_LOW_POWER + for (l = sbr->t_E[ch][0]; l < sbr->t_E[ch][sbr->L_E[ch]]; l++) + { + for (k = 0; k < sbr->kx; k++) + { + QMF_RE(sbr->Xsbr[ch][sbr->tHFAdj + l][k]) = 0; + } + } +#endif + +#if 1 + /* hf adjustment */ + hf_adjustment(sbr, sbr->Xsbr[ch] +#ifdef SBR_LOW_POWER + ,deg +#endif + ,ch); +#endif + } + + if ((sbr->just_seeked != 0) || dont_process) + { + for (l = 0; l < sbr->numTimeSlotsRate; l++) + { + for (k = 0; k < 32; k++) + { + QMF_RE(X[l][k]) = QMF_RE(sbr->Xsbr[ch][l + sbr->tHFAdj][k]); +#ifndef SBR_LOW_POWER + QMF_IM(X[l][k]) = QMF_IM(sbr->Xsbr[ch][l + sbr->tHFAdj][k]); +#endif + } + for (k = 32; k < 64; k++) + { + QMF_RE(X[l][k]) = 0; +#ifndef SBR_LOW_POWER + QMF_IM(X[l][k]) = 0; +#endif + } + } + } else { + for (l = 0; l < sbr->numTimeSlotsRate; l++) + { + uint8_t kx_band, M_band, bsco_band; + + if (l < sbr->t_E[ch][0]) + { + kx_band = sbr->kx_prev; + M_band = sbr->M_prev; + bsco_band = sbr->bsco_prev; + } else { + kx_band = sbr->kx; + M_band = sbr->M; + bsco_band = sbr->bsco; + } + +#ifndef SBR_LOW_POWER + for (k = 0; k < kx_band + bsco_band; k++) + { + QMF_RE(X[l][k]) = QMF_RE(sbr->Xsbr[ch][l + sbr->tHFAdj][k]); + QMF_IM(X[l][k]) = QMF_IM(sbr->Xsbr[ch][l + sbr->tHFAdj][k]); + } + for (k = kx_band + bsco_band; k < kx_band + M_band; k++) + { + QMF_RE(X[l][k]) = QMF_RE(sbr->Xsbr[ch][l + sbr->tHFAdj][k]); + QMF_IM(X[l][k]) = QMF_IM(sbr->Xsbr[ch][l + sbr->tHFAdj][k]); + } + for (k = max(kx_band + bsco_band, kx_band + M_band); k < 64; k++) + { + QMF_RE(X[l][k]) = 0; + QMF_IM(X[l][k]) = 0; + } +#else + for (k = 0; k < kx_band + bsco_band; k++) + { + QMF_RE(X[l][k]) = QMF_RE(sbr->Xsbr[ch][l + sbr->tHFAdj][k]); + } + for (k = kx_band + bsco_band; k < min(kx_band + M_band, 63); k++) + { + QMF_RE(X[l][k]) = QMF_RE(sbr->Xsbr[ch][l + sbr->tHFAdj][k]); + } + for (k = max(kx_band + bsco_band, kx_band + M_band); k < 64; k++) + { + QMF_RE(X[l][k]) = 0; + } + QMF_RE(X[l][kx_band - 1 + bsco_band]) += + QMF_RE(sbr->Xsbr[ch][l + sbr->tHFAdj][kx_band - 1 + bsco_band]); +#endif + } + } +} + +uint8_t sbrDecodeCoupleFrame(sbr_info *sbr, real_t *left_chan, real_t *right_chan, + const uint8_t just_seeked, const uint8_t downSampledSBR) +{ + uint8_t dont_process = 0; + uint8_t ret = 0; + ALIGN qmf_t X[MAX_NTSR][64]; + + if (sbr == NULL) + return 20; + + /* case can occur due to bit errors */ + if (sbr->id_aac != ID_CPE) + return 21; + + if (sbr->ret || (sbr->header_count == 0)) + { + /* don't process just upsample */ + dont_process = 1; + + /* Re-activate reset for next frame */ + if (sbr->ret && sbr->Reset) + sbr->bs_start_freq_prev = -1; + } + + if (just_seeked) + { + sbr->just_seeked = 1; + } else { + sbr->just_seeked = 0; + } + + sbr_process_channel(sbr, left_chan, X, 0, dont_process, downSampledSBR); + /* subband synthesis */ + if (downSampledSBR) + { + sbr_qmf_synthesis_32(sbr, sbr->qmfs[0], X, left_chan); + } else { + sbr_qmf_synthesis_64(sbr, sbr->qmfs[0], X, left_chan); + } + + sbr_process_channel(sbr, right_chan, X, 1, dont_process, downSampledSBR); + /* subband synthesis */ + if (downSampledSBR) + { + sbr_qmf_synthesis_32(sbr, sbr->qmfs[1], X, right_chan); + } else { + sbr_qmf_synthesis_64(sbr, sbr->qmfs[1], X, right_chan); + } + + if (sbr->bs_header_flag) + sbr->just_seeked = 0; + + if (sbr->header_count != 0 && sbr->ret == 0) + { + ret = sbr_save_prev_data(sbr, 0); + if (ret) return ret; + ret = sbr_save_prev_data(sbr, 1); + if (ret) return ret; + } + + sbr_save_matrix(sbr, 0); + sbr_save_matrix(sbr, 1); + + sbr->frame++; + +//#define POST_QMF_PRINT +#ifdef POST_QMF_PRINT + { + int i; + for (i = 0; i < 2048; i++) + { + printf("%d\n", left_chan[i]); + } + for (i = 0; i < 2048; i++) + { + printf("%d\n", right_chan[i]); + } + } +#endif + + return 0; +} + +uint8_t sbrDecodeSingleFrame(sbr_info *sbr, real_t *channel, + const uint8_t just_seeked, const uint8_t downSampledSBR) +{ + uint8_t dont_process = 0; + uint8_t ret = 0; + ALIGN qmf_t X[MAX_NTSR][64]; + + if (sbr == NULL) + return 20; + + /* case can occur due to bit errors */ + if (sbr->id_aac != ID_SCE && sbr->id_aac != ID_LFE) + return 21; + + if (sbr->ret || (sbr->header_count == 0)) + { + /* don't process just upsample */ + dont_process = 1; + + /* Re-activate reset for next frame */ + if (sbr->ret && sbr->Reset) + sbr->bs_start_freq_prev = -1; + } + + if (just_seeked) + { + sbr->just_seeked = 1; + } else { + sbr->just_seeked = 0; + } + + sbr_process_channel(sbr, channel, X, 0, dont_process, downSampledSBR); + /* subband synthesis */ + if (downSampledSBR) + { + sbr_qmf_synthesis_32(sbr, sbr->qmfs[0], X, channel); + } else { + sbr_qmf_synthesis_64(sbr, sbr->qmfs[0], X, channel); + } + + if (sbr->bs_header_flag) + sbr->just_seeked = 0; + + if (sbr->header_count != 0 && sbr->ret == 0) + { + ret = sbr_save_prev_data(sbr, 0); + if (ret) return ret; + } + + sbr_save_matrix(sbr, 0); + + sbr->frame++; + +//#define POST_QMF_PRINT +#ifdef POST_QMF_PRINT + { + int i; + for (i = 0; i < 2048; i++) + { + printf("%d\n", channel[i]); + } + } +#endif + + return 0; +} + +#if (defined(PS_DEC) || defined(DRM_PS)) +uint8_t sbrDecodeSingleFramePS(sbr_info *sbr, real_t *left_channel, real_t *right_channel, + const uint8_t just_seeked, const uint8_t downSampledSBR) +{ + uint8_t l, k; + uint8_t dont_process = 0; + uint8_t ret = 0; + ALIGN qmf_t X_left[38][64] = {{0}}; + ALIGN qmf_t X_right[38][64] = {{0}}; /* must set this to 0 */ + + if (sbr == NULL) + return 20; + + /* case can occur due to bit errors */ + if (sbr->id_aac != ID_SCE && sbr->id_aac != ID_LFE) + return 21; + + if (sbr->ret || (sbr->header_count == 0)) + { + /* don't process just upsample */ + dont_process = 1; + + /* Re-activate reset for next frame */ + if (sbr->ret && sbr->Reset) + sbr->bs_start_freq_prev = -1; + } + + if (just_seeked) + { + sbr->just_seeked = 1; + } else { + sbr->just_seeked = 0; + } + + if (sbr->qmfs[1] == NULL) + { + sbr->qmfs[1] = qmfs_init((downSampledSBR)?32:64); + } + + sbr_process_channel(sbr, left_channel, X_left, 0, dont_process, downSampledSBR); + + /* copy some extra data for PS */ + for (l = 32; l < 38; l++) + { + for (k = 0; k < 5; k++) + { + QMF_RE(X_left[l][k]) = QMF_RE(sbr->Xsbr[0][sbr->tHFAdj+l][k]); + QMF_IM(X_left[l][k]) = QMF_IM(sbr->Xsbr[0][sbr->tHFAdj+l][k]); + } + } + + /* perform parametric stereo */ +#ifdef DRM_PS + if (sbr->Is_DRM_SBR) + { + drm_ps_decode(sbr->drm_ps, (sbr->ret > 0), sbr->sample_rate, X_left, X_right); + } else { +#endif +#ifdef PS_DEC + ps_decode(sbr->ps, X_left, X_right); +#endif +#ifdef DRM_PS + } +#endif + + /* subband synthesis */ + if (downSampledSBR) + { + sbr_qmf_synthesis_32(sbr, sbr->qmfs[0], X_left, left_channel); + sbr_qmf_synthesis_32(sbr, sbr->qmfs[1], X_right, right_channel); + } else { + sbr_qmf_synthesis_64(sbr, sbr->qmfs[0], X_left, left_channel); + sbr_qmf_synthesis_64(sbr, sbr->qmfs[1], X_right, right_channel); + } + + if (sbr->bs_header_flag) + sbr->just_seeked = 0; + + if (sbr->header_count != 0 && sbr->ret == 0) + { + ret = sbr_save_prev_data(sbr, 0); + if (ret) return ret; + } + + sbr_save_matrix(sbr, 0); + + sbr->frame++; + + return 0; +} +#endif + +#endif diff --git a/Libraries/FAAD2/Files/libfaad/sbr_dec.h b/Libraries/FAAD2/Files/libfaad/sbr_dec.h new file mode 100644 index 000000000..25b3e37f5 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/sbr_dec.h @@ -0,0 +1,249 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#ifndef __SBR_DEC_H__ +#define __SBR_DEC_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef PS_DEC +#include "ps_dec.h" +#endif +#ifdef DRM_PS +#include "drm_dec.h" +#endif + +/* MAX_NTSRHFG: maximum of number_time_slots * rate + HFGen. 16*2+8 */ +#define MAX_NTSRHFG 40 +#define MAX_NTSR 32 /* max number_time_slots * rate, ok for DRM and not DRM mode */ + +/* MAX_M: maximum value for M */ +#define MAX_M 49 +/* MAX_L_E: maximum value for L_E */ +#define MAX_L_E 5 + +typedef struct { + real_t *x; + int16_t x_index; + uint8_t channels; +} qmfa_info; + +typedef struct { + real_t *v; + int16_t v_index; + uint8_t channels; +} qmfs_info; + +typedef struct +{ + uint32_t sample_rate; + uint32_t maxAACLine; + + uint8_t rate; + uint8_t just_seeked; + uint8_t ret; + + uint8_t amp_res[2]; + + uint8_t k0; + uint8_t kx; + uint8_t M; + uint8_t N_master; + uint8_t N_high; + uint8_t N_low; + uint8_t N_Q; + uint8_t N_L[4]; + uint8_t n[2]; + + uint8_t f_master[64]; + uint8_t f_table_res[2][64]; + uint8_t f_table_noise[64]; + uint8_t f_table_lim[4][64]; +#ifdef SBR_LOW_POWER + uint8_t f_group[5][64]; + uint8_t N_G[5]; +#endif + + uint8_t table_map_k_to_g[64]; + + uint8_t abs_bord_lead[2]; + uint8_t abs_bord_trail[2]; + uint8_t n_rel_lead[2]; + uint8_t n_rel_trail[2]; + + uint8_t L_E[2]; + uint8_t L_E_prev[2]; + uint8_t L_Q[2]; + + uint8_t t_E[2][MAX_L_E+1]; + uint8_t t_Q[2][3]; + uint8_t f[2][MAX_L_E+1]; + uint8_t f_prev[2]; + + real_t *G_temp_prev[2][5]; + real_t *Q_temp_prev[2][5]; + int8_t GQ_ringbuf_index[2]; + + int16_t E[2][64][MAX_L_E]; + int16_t E_prev[2][64]; +#ifndef FIXED_POINT + real_t E_orig[2][64][MAX_L_E]; +#endif + real_t E_curr[2][64][MAX_L_E]; + int32_t Q[2][64][2]; +#ifndef FIXED_POINT + real_t Q_div[2][64][2]; + real_t Q_div2[2][64][2]; +#endif + int32_t Q_prev[2][64]; + + int8_t l_A[2]; + int8_t l_A_prev[2]; + + uint8_t bs_invf_mode[2][MAX_L_E]; + uint8_t bs_invf_mode_prev[2][MAX_L_E]; + real_t bwArray[2][64]; + real_t bwArray_prev[2][64]; + + uint8_t noPatches; + uint8_t patchNoSubbands[64]; + uint8_t patchStartSubband[64]; + + uint8_t bs_add_harmonic[2][64]; + uint8_t bs_add_harmonic_prev[2][64]; + + uint16_t index_noise_prev[2]; + uint8_t psi_is_prev[2]; + + uint8_t bs_start_freq_prev; + uint8_t bs_stop_freq_prev; + uint8_t bs_xover_band_prev; + uint8_t bs_freq_scale_prev; + uint8_t bs_alter_scale_prev; + uint8_t bs_noise_bands_prev; + + int8_t prevEnvIsShort[2]; + + int8_t kx_prev; + uint8_t bsco; + uint8_t bsco_prev; + uint8_t M_prev; + uint16_t frame_len; + + uint8_t Reset; + uint32_t frame; + uint32_t header_count; + + uint8_t id_aac; + qmfa_info *qmfa[2]; + qmfs_info *qmfs[2]; + + qmf_t Xsbr[2][MAX_NTSRHFG][64]; + +#ifdef DRM + uint8_t Is_DRM_SBR; +#ifdef DRM_PS + drm_ps_info *drm_ps; +#endif +#endif + + uint8_t numTimeSlotsRate; + uint8_t numTimeSlots; + uint8_t tHFGen; + uint8_t tHFAdj; + +#ifdef PS_DEC + ps_info *ps; +#endif +#if (defined(PS_DEC) || defined(DRM_PS)) + uint8_t ps_used; +#endif + + /* to get it compiling */ + /* we'll see during the coding of all the tools, whether + these are all used or not. + */ + uint8_t bs_header_flag; + uint8_t bs_crc_flag; + uint16_t bs_sbr_crc_bits; + uint8_t bs_protocol_version; + uint8_t bs_amp_res; + uint8_t bs_start_freq; + uint8_t bs_stop_freq; + uint8_t bs_xover_band; + uint8_t bs_freq_scale; + uint8_t bs_alter_scale; + uint8_t bs_noise_bands; + uint8_t bs_limiter_bands; + uint8_t bs_limiter_gains; + uint8_t bs_interpol_freq; + uint8_t bs_smoothing_mode; + uint8_t bs_samplerate_mode; + uint8_t bs_add_harmonic_flag[2]; + uint8_t bs_add_harmonic_flag_prev[2]; + uint8_t bs_extended_data; + uint8_t bs_extension_id; + uint8_t bs_extension_data; + uint8_t bs_coupling; + uint8_t bs_frame_class[2]; + uint8_t bs_rel_bord[2][9]; + uint8_t bs_rel_bord_0[2][9]; + uint8_t bs_rel_bord_1[2][9]; + uint8_t bs_pointer[2]; + uint8_t bs_abs_bord_0[2]; + uint8_t bs_abs_bord_1[2]; + uint8_t bs_num_rel_0[2]; + uint8_t bs_num_rel_1[2]; + uint8_t bs_df_env[2][9]; + uint8_t bs_df_noise[2][3]; +} sbr_info; + +sbr_info *sbrDecodeInit(uint16_t framelength, uint8_t id_aac, + uint32_t sample_rate, uint8_t downSampledSBR +#ifdef DRM + , uint8_t IsDRM +#endif + ); +void sbrDecodeEnd(sbr_info *sbr); + +uint8_t sbrDecodeCoupleFrame(sbr_info *sbr, real_t *left_chan, real_t *right_chan, + const uint8_t just_seeked, const uint8_t downSampledSBR); +uint8_t sbrDecodeSingleFrame(sbr_info *sbr, real_t *channel, + const uint8_t just_seeked, const uint8_t downSampledSBR); +#if (defined(PS_DEC) || defined(DRM_PS)) +uint8_t sbrDecodeSingleFramePS(sbr_info *sbr, real_t *left_channel, real_t *right_channel, + const uint8_t just_seeked, const uint8_t downSampledSBR); +#endif + + +#ifdef __cplusplus +} +#endif +#endif + diff --git a/Libraries/FAAD2/Files/libfaad/sbr_e_nf.c b/Libraries/FAAD2/Files/libfaad/sbr_e_nf.c new file mode 100644 index 000000000..60532cbd7 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/sbr_e_nf.c @@ -0,0 +1,507 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#include "common.h" +#include "structs.h" + +#ifdef SBR_DEC + +#include + +#include "sbr_syntax.h" +#include "sbr_e_nf.h" + +void extract_envelope_data(sbr_info *sbr, uint8_t ch) +{ + uint8_t l, k; + + for (l = 0; l < sbr->L_E[ch]; l++) + { + if (sbr->bs_df_env[ch][l] == 0) + { + for (k = 1; k < sbr->n[sbr->f[ch][l]]; k++) + { + sbr->E[ch][k][l] = sbr->E[ch][k - 1][l] + sbr->E[ch][k][l]; + if (sbr->E[ch][k][l] < 0) + sbr->E[ch][k][l] = 0; + } + + } else { /* bs_df_env == 1 */ + + uint8_t g = (l == 0) ? sbr->f_prev[ch] : sbr->f[ch][l-1]; + int16_t E_prev; + + if (sbr->f[ch][l] == g) + { + for (k = 0; k < sbr->n[sbr->f[ch][l]]; k++) + { + if (l == 0) + E_prev = sbr->E_prev[ch][k]; + else + E_prev = sbr->E[ch][k][l - 1]; + + sbr->E[ch][k][l] = E_prev + sbr->E[ch][k][l]; + } + + } else if ((g == 1) && (sbr->f[ch][l] == 0)) { + uint8_t i; + + for (k = 0; k < sbr->n[sbr->f[ch][l]]; k++) + { + for (i = 0; i < sbr->N_high; i++) + { + if (sbr->f_table_res[HI_RES][i] == sbr->f_table_res[LO_RES][k]) + { + if (l == 0) + E_prev = sbr->E_prev[ch][i]; + else + E_prev = sbr->E[ch][i][l - 1]; + + sbr->E[ch][k][l] = E_prev + sbr->E[ch][k][l]; + } + } + } + + } else if ((g == 0) && (sbr->f[ch][l] == 1)) { + uint8_t i; + + for (k = 0; k < sbr->n[sbr->f[ch][l]]; k++) + { + for (i = 0; i < sbr->N_low; i++) + { + if ((sbr->f_table_res[LO_RES][i] <= sbr->f_table_res[HI_RES][k]) && + (sbr->f_table_res[HI_RES][k] < sbr->f_table_res[LO_RES][i + 1])) + { + if (l == 0) + E_prev = sbr->E_prev[ch][i]; + else + E_prev = sbr->E[ch][i][l - 1]; + + sbr->E[ch][k][l] = E_prev + sbr->E[ch][k][l]; + } + } + } + } + } + } +} + +void extract_noise_floor_data(sbr_info *sbr, uint8_t ch) +{ + uint8_t l, k; + + for (l = 0; l < sbr->L_Q[ch]; l++) + { + if (sbr->bs_df_noise[ch][l] == 0) + { + for (k = 1; k < sbr->N_Q; k++) + { + sbr->Q[ch][k][l] = sbr->Q[ch][k][l] + sbr->Q[ch][k-1][l]; + } + } else { + if (l == 0) + { + for (k = 0; k < sbr->N_Q; k++) + { + sbr->Q[ch][k][l] = sbr->Q_prev[ch][k] + sbr->Q[ch][k][0]; + } + } else { + for (k = 0; k < sbr->N_Q; k++) + { + sbr->Q[ch][k][l] = sbr->Q[ch][k][l - 1] + sbr->Q[ch][k][l]; + } + } + } + } +} + +#ifndef FIXED_POINT + +/* table for Q_div values when no coupling */ +static const real_t Q_div_tab[31] = { + FRAC_CONST(0.0153846), FRAC_CONST(0.030303), + FRAC_CONST(0.0588235), FRAC_CONST(0.111111), + FRAC_CONST(0.2), FRAC_CONST(0.333333), + FRAC_CONST(0.5), FRAC_CONST(0.666667), + FRAC_CONST(0.8), FRAC_CONST(0.888889), + FRAC_CONST(0.941176), FRAC_CONST(0.969697), + FRAC_CONST(0.984615), FRAC_CONST(0.992248), + FRAC_CONST(0.996109), FRAC_CONST(0.998051), + FRAC_CONST(0.999024), FRAC_CONST(0.999512), + FRAC_CONST(0.999756), FRAC_CONST(0.999878), + FRAC_CONST(0.999939), FRAC_CONST(0.999969), + FRAC_CONST(0.999985), FRAC_CONST(0.999992), + FRAC_CONST(0.999996), FRAC_CONST(0.999998), + FRAC_CONST(0.999999), FRAC_CONST(1), + FRAC_CONST(1), FRAC_CONST(1), + FRAC_CONST(1) +}; + +static const real_t Q_div_tab_left[31][13] = { + { FRAC_CONST(0.969704), FRAC_CONST(0.888985), FRAC_CONST(0.667532), FRAC_CONST(0.336788), FRAC_CONST(0.117241), FRAC_CONST(0.037594), FRAC_CONST(0.0153846), FRAC_CONST(0.00967118), FRAC_CONST(0.00823245), FRAC_CONST(0.00787211), FRAC_CONST(0.00778198), FRAC_CONST(0.00775945), FRAC_CONST(0.00775382) }, + { FRAC_CONST(0.984619), FRAC_CONST(0.94123), FRAC_CONST(0.800623), FRAC_CONST(0.503876), FRAC_CONST(0.209877), FRAC_CONST(0.0724638), FRAC_CONST(0.030303), FRAC_CONST(0.0191571), FRAC_CONST(0.0163305), FRAC_CONST(0.0156212), FRAC_CONST(0.0154438), FRAC_CONST(0.0153994), FRAC_CONST(0.0153883) }, + { FRAC_CONST(0.99225), FRAC_CONST(0.969726), FRAC_CONST(0.889273), FRAC_CONST(0.670103), FRAC_CONST(0.346939), FRAC_CONST(0.135135), FRAC_CONST(0.0588235), FRAC_CONST(0.037594), FRAC_CONST(0.0321361), FRAC_CONST(0.0307619), FRAC_CONST(0.0304178), FRAC_CONST(0.0303317), FRAC_CONST(0.0303102) }, + { FRAC_CONST(0.99611), FRAC_CONST(0.98463), FRAC_CONST(0.941392), FRAC_CONST(0.802469), FRAC_CONST(0.515152), FRAC_CONST(0.238095), FRAC_CONST(0.111111), FRAC_CONST(0.0724638), FRAC_CONST(0.0622711), FRAC_CONST(0.0596878), FRAC_CONST(0.0590397), FRAC_CONST(0.0588776), FRAC_CONST(0.058837) }, + { FRAC_CONST(0.998051), FRAC_CONST(0.992256), FRAC_CONST(0.969811), FRAC_CONST(0.890411), FRAC_CONST(0.68), FRAC_CONST(0.384615), FRAC_CONST(0.2), FRAC_CONST(0.135135), FRAC_CONST(0.117241), FRAC_CONST(0.112652), FRAC_CONST(0.111497), FRAC_CONST(0.111208), FRAC_CONST(0.111135) }, + { FRAC_CONST(0.999025), FRAC_CONST(0.996113), FRAC_CONST(0.984674), FRAC_CONST(0.942029), FRAC_CONST(0.809524), FRAC_CONST(0.555556), FRAC_CONST(0.333333), FRAC_CONST(0.238095), FRAC_CONST(0.209877), FRAC_CONST(0.202492), FRAC_CONST(0.200625), FRAC_CONST(0.200156), FRAC_CONST(0.200039) }, + { FRAC_CONST(0.999512), FRAC_CONST(0.998053), FRAC_CONST(0.992278), FRAC_CONST(0.970149), FRAC_CONST(0.894737), FRAC_CONST(0.714286), FRAC_CONST(0.5), FRAC_CONST(0.384615), FRAC_CONST(0.346939), FRAC_CONST(0.336788), FRAC_CONST(0.3342), FRAC_CONST(0.33355), FRAC_CONST(0.333388) }, + { FRAC_CONST(0.999756), FRAC_CONST(0.999025), FRAC_CONST(0.996124), FRAC_CONST(0.984848), FRAC_CONST(0.944444), FRAC_CONST(0.833333), FRAC_CONST(0.666667), FRAC_CONST(0.555556), FRAC_CONST(0.515152), FRAC_CONST(0.503876), FRAC_CONST(0.500975), FRAC_CONST(0.500244), FRAC_CONST(0.500061) }, + { FRAC_CONST(0.999878), FRAC_CONST(0.999512), FRAC_CONST(0.998058), FRAC_CONST(0.992366), FRAC_CONST(0.971429), FRAC_CONST(0.909091), FRAC_CONST(0.8), FRAC_CONST(0.714286), FRAC_CONST(0.68), FRAC_CONST(0.670103), FRAC_CONST(0.667532), FRAC_CONST(0.666884), FRAC_CONST(0.666721) }, + { FRAC_CONST(0.999939), FRAC_CONST(0.999756), FRAC_CONST(0.999028), FRAC_CONST(0.996169), FRAC_CONST(0.985507), FRAC_CONST(0.952381), FRAC_CONST(0.888889), FRAC_CONST(0.833333), FRAC_CONST(0.809524), FRAC_CONST(0.802469), FRAC_CONST(0.800623), FRAC_CONST(0.800156), FRAC_CONST(0.800039) }, + { FRAC_CONST(0.999969), FRAC_CONST(0.999878), FRAC_CONST(0.999514), FRAC_CONST(0.998081), FRAC_CONST(0.992701), FRAC_CONST(0.97561), FRAC_CONST(0.941176), FRAC_CONST(0.909091), FRAC_CONST(0.894737), FRAC_CONST(0.890411), FRAC_CONST(0.889273), FRAC_CONST(0.888985), FRAC_CONST(0.888913) }, + { FRAC_CONST(0.999985), FRAC_CONST(0.999939), FRAC_CONST(0.999757), FRAC_CONST(0.999039), FRAC_CONST(0.996337), FRAC_CONST(0.987654), FRAC_CONST(0.969697), FRAC_CONST(0.952381), FRAC_CONST(0.944444), FRAC_CONST(0.942029), FRAC_CONST(0.941392), FRAC_CONST(0.94123), FRAC_CONST(0.94119) }, + { FRAC_CONST(0.999992), FRAC_CONST(0.99997), FRAC_CONST(0.999878), FRAC_CONST(0.999519), FRAC_CONST(0.998165), FRAC_CONST(0.993789), FRAC_CONST(0.984615), FRAC_CONST(0.97561), FRAC_CONST(0.971429), FRAC_CONST(0.970149), FRAC_CONST(0.969811), FRAC_CONST(0.969726), FRAC_CONST(0.969704) }, + { FRAC_CONST(0.999996), FRAC_CONST(0.999985), FRAC_CONST(0.999939), FRAC_CONST(0.99976), FRAC_CONST(0.999082), FRAC_CONST(0.996885), FRAC_CONST(0.992248), FRAC_CONST(0.987654), FRAC_CONST(0.985507), FRAC_CONST(0.984848), FRAC_CONST(0.984674), FRAC_CONST(0.98463), FRAC_CONST(0.984619) }, + { FRAC_CONST(0.999998), FRAC_CONST(0.999992), FRAC_CONST(0.99997), FRAC_CONST(0.99988), FRAC_CONST(0.999541), FRAC_CONST(0.99844), FRAC_CONST(0.996109), FRAC_CONST(0.993789), FRAC_CONST(0.992701), FRAC_CONST(0.992366), FRAC_CONST(0.992278), FRAC_CONST(0.992256), FRAC_CONST(0.99225) }, + { FRAC_CONST(0.999999), FRAC_CONST(0.999996), FRAC_CONST(0.999985), FRAC_CONST(0.99994), FRAC_CONST(0.99977), FRAC_CONST(0.999219), FRAC_CONST(0.998051), FRAC_CONST(0.996885), FRAC_CONST(0.996337), FRAC_CONST(0.996169), FRAC_CONST(0.996124), FRAC_CONST(0.996113), FRAC_CONST(0.99611) }, + { FRAC_CONST(1), FRAC_CONST(0.999998), FRAC_CONST(0.999992), FRAC_CONST(0.99997), FRAC_CONST(0.999885), FRAC_CONST(0.99961), FRAC_CONST(0.999024), FRAC_CONST(0.99844), FRAC_CONST(0.998165), FRAC_CONST(0.998081), FRAC_CONST(0.998058), FRAC_CONST(0.998053), FRAC_CONST(0.998051) }, + { FRAC_CONST(1), FRAC_CONST(0.999999), FRAC_CONST(0.999996), FRAC_CONST(0.999985), FRAC_CONST(0.999943), FRAC_CONST(0.999805), FRAC_CONST(0.999512), FRAC_CONST(0.999219), FRAC_CONST(0.999082), FRAC_CONST(0.999039), FRAC_CONST(0.999028), FRAC_CONST(0.999025), FRAC_CONST(0.999025) }, + { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999998), FRAC_CONST(0.999992), FRAC_CONST(0.999971), FRAC_CONST(0.999902), FRAC_CONST(0.999756), FRAC_CONST(0.99961), FRAC_CONST(0.999541), FRAC_CONST(0.999519), FRAC_CONST(0.999514), FRAC_CONST(0.999512), FRAC_CONST(0.999512) }, + { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999999), FRAC_CONST(0.999996), FRAC_CONST(0.999986), FRAC_CONST(0.999951), FRAC_CONST(0.999878), FRAC_CONST(0.999805), FRAC_CONST(0.99977), FRAC_CONST(0.99976), FRAC_CONST(0.999757), FRAC_CONST(0.999756), FRAC_CONST(0.999756) }, + { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999998), FRAC_CONST(0.999993), FRAC_CONST(0.999976), FRAC_CONST(0.999939), FRAC_CONST(0.999902), FRAC_CONST(0.999885), FRAC_CONST(0.99988), FRAC_CONST(0.999878), FRAC_CONST(0.999878), FRAC_CONST(0.999878) }, + { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999999), FRAC_CONST(0.999996), FRAC_CONST(0.999988), FRAC_CONST(0.999969), FRAC_CONST(0.999951), FRAC_CONST(0.999943), FRAC_CONST(0.99994), FRAC_CONST(0.999939), FRAC_CONST(0.999939), FRAC_CONST(0.999939) }, + { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999998), FRAC_CONST(0.999994), FRAC_CONST(0.999985), FRAC_CONST(0.999976), FRAC_CONST(0.999971), FRAC_CONST(0.99997), FRAC_CONST(0.99997), FRAC_CONST(0.99997), FRAC_CONST(0.999969) }, + { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999999), FRAC_CONST(0.999997), FRAC_CONST(0.999992), FRAC_CONST(0.999988), FRAC_CONST(0.999986), FRAC_CONST(0.999985), FRAC_CONST(0.999985), FRAC_CONST(0.999985), FRAC_CONST(0.999985) }, + { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999998), FRAC_CONST(0.999996), FRAC_CONST(0.999994), FRAC_CONST(0.999993), FRAC_CONST(0.999992), FRAC_CONST(0.999992), FRAC_CONST(0.999992), FRAC_CONST(0.999992) }, + { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999999), FRAC_CONST(0.999998), FRAC_CONST(0.999997), FRAC_CONST(0.999996), FRAC_CONST(0.999996), FRAC_CONST(0.999996), FRAC_CONST(0.999996), FRAC_CONST(0.999996) }, + { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999999), FRAC_CONST(0.999998), FRAC_CONST(0.999998), FRAC_CONST(0.999998), FRAC_CONST(0.999998), FRAC_CONST(0.999998), FRAC_CONST(0.999998) }, + { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999999), FRAC_CONST(0.999999), FRAC_CONST(0.999999), FRAC_CONST(0.999999), FRAC_CONST(0.999999), FRAC_CONST(0.999999) }, + { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) }, + { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) }, + { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) } +}; + +static const real_t Q_div_tab_right[31][13] = { + { FRAC_CONST(0.00775382), FRAC_CONST(0.00775945), FRAC_CONST(0.00778198), FRAC_CONST(0.00787211), FRAC_CONST(0.00823245), FRAC_CONST(0.00967118), FRAC_CONST(0.0153846), FRAC_CONST(0.037594), FRAC_CONST(0.117241), FRAC_CONST(0.336788), FRAC_CONST(0.667532), FRAC_CONST(0.888985), FRAC_CONST(0.969704) }, + { FRAC_CONST(0.0153883), FRAC_CONST(0.0153994), FRAC_CONST(0.0154438), FRAC_CONST(0.0156212), FRAC_CONST(0.0163305), FRAC_CONST(0.0191571), FRAC_CONST(0.030303), FRAC_CONST(0.0724638), FRAC_CONST(0.209877), FRAC_CONST(0.503876), FRAC_CONST(0.800623), FRAC_CONST(0.94123), FRAC_CONST(0.984619) }, + { FRAC_CONST(0.0303102), FRAC_CONST(0.0303317), FRAC_CONST(0.0304178), FRAC_CONST(0.0307619), FRAC_CONST(0.0321361), FRAC_CONST(0.037594), FRAC_CONST(0.0588235), FRAC_CONST(0.135135), FRAC_CONST(0.346939), FRAC_CONST(0.670103), FRAC_CONST(0.889273), FRAC_CONST(0.969726), FRAC_CONST(0.99225) }, + { FRAC_CONST(0.058837), FRAC_CONST(0.0588776), FRAC_CONST(0.0590397), FRAC_CONST(0.0596878), FRAC_CONST(0.0622711), FRAC_CONST(0.0724638), FRAC_CONST(0.111111), FRAC_CONST(0.238095), FRAC_CONST(0.515152), FRAC_CONST(0.802469), FRAC_CONST(0.941392), FRAC_CONST(0.98463), FRAC_CONST(0.99611) }, + { FRAC_CONST(0.111135), FRAC_CONST(0.111208), FRAC_CONST(0.111497), FRAC_CONST(0.112652), FRAC_CONST(0.117241), FRAC_CONST(0.135135), FRAC_CONST(0.2), FRAC_CONST(0.384615), FRAC_CONST(0.68), FRAC_CONST(0.890411), FRAC_CONST(0.969811), FRAC_CONST(0.992256), FRAC_CONST(0.998051) }, + { FRAC_CONST(0.200039), FRAC_CONST(0.200156), FRAC_CONST(0.200625), FRAC_CONST(0.202492), FRAC_CONST(0.209877), FRAC_CONST(0.238095), FRAC_CONST(0.333333), FRAC_CONST(0.555556), FRAC_CONST(0.809524), FRAC_CONST(0.942029), FRAC_CONST(0.984674), FRAC_CONST(0.996113), FRAC_CONST(0.999025) }, + { FRAC_CONST(0.333388), FRAC_CONST(0.33355), FRAC_CONST(0.3342), FRAC_CONST(0.336788), FRAC_CONST(0.346939), FRAC_CONST(0.384615), FRAC_CONST(0.5), FRAC_CONST(0.714286), FRAC_CONST(0.894737), FRAC_CONST(0.970149), FRAC_CONST(0.992278), FRAC_CONST(0.998053), FRAC_CONST(0.999512) }, + { FRAC_CONST(0.500061), FRAC_CONST(0.500244), FRAC_CONST(0.500975), FRAC_CONST(0.503876), FRAC_CONST(0.515152), FRAC_CONST(0.555556), FRAC_CONST(0.666667), FRAC_CONST(0.833333), FRAC_CONST(0.944444), FRAC_CONST(0.984848), FRAC_CONST(0.996124), FRAC_CONST(0.999025), FRAC_CONST(0.999756) }, + { FRAC_CONST(0.666721), FRAC_CONST(0.666884), FRAC_CONST(0.667532), FRAC_CONST(0.670103), FRAC_CONST(0.68), FRAC_CONST(0.714286), FRAC_CONST(0.8), FRAC_CONST(0.909091), FRAC_CONST(0.971429), FRAC_CONST(0.992366), FRAC_CONST(0.998058), FRAC_CONST(0.999512), FRAC_CONST(0.999878) }, + { FRAC_CONST(0.800039), FRAC_CONST(0.800156), FRAC_CONST(0.800623), FRAC_CONST(0.802469), FRAC_CONST(0.809524), FRAC_CONST(0.833333), FRAC_CONST(0.888889), FRAC_CONST(0.952381), FRAC_CONST(0.985507), FRAC_CONST(0.996169), FRAC_CONST(0.999028), FRAC_CONST(0.999756), FRAC_CONST(0.999939) }, + { FRAC_CONST(0.888913), FRAC_CONST(0.888985), FRAC_CONST(0.889273), FRAC_CONST(0.890411), FRAC_CONST(0.894737), FRAC_CONST(0.909091), FRAC_CONST(0.941176), FRAC_CONST(0.97561), FRAC_CONST(0.992701), FRAC_CONST(0.998081), FRAC_CONST(0.999514), FRAC_CONST(0.999878), FRAC_CONST(0.999969) }, + { FRAC_CONST(0.94119), FRAC_CONST(0.94123), FRAC_CONST(0.941392), FRAC_CONST(0.942029), FRAC_CONST(0.944444), FRAC_CONST(0.952381), FRAC_CONST(0.969697), FRAC_CONST(0.987654), FRAC_CONST(0.996337), FRAC_CONST(0.999039), FRAC_CONST(0.999757), FRAC_CONST(0.999939), FRAC_CONST(0.999985) }, + { FRAC_CONST(0.969704), FRAC_CONST(0.969726), FRAC_CONST(0.969811), FRAC_CONST(0.970149), FRAC_CONST(0.971429), FRAC_CONST(0.97561), FRAC_CONST(0.984615), FRAC_CONST(0.993789), FRAC_CONST(0.998165), FRAC_CONST(0.999519), FRAC_CONST(0.999878), FRAC_CONST(0.99997), FRAC_CONST(0.999992) }, + { FRAC_CONST(0.984619), FRAC_CONST(0.98463), FRAC_CONST(0.984674), FRAC_CONST(0.984848), FRAC_CONST(0.985507), FRAC_CONST(0.987654), FRAC_CONST(0.992248), FRAC_CONST(0.996885), FRAC_CONST(0.999082), FRAC_CONST(0.99976), FRAC_CONST(0.999939), FRAC_CONST(0.999985), FRAC_CONST(0.999996) }, + { FRAC_CONST(0.99225), FRAC_CONST(0.992256), FRAC_CONST(0.992278), FRAC_CONST(0.992366), FRAC_CONST(0.992701), FRAC_CONST(0.993789), FRAC_CONST(0.996109), FRAC_CONST(0.99844), FRAC_CONST(0.999541), FRAC_CONST(0.99988), FRAC_CONST(0.99997), FRAC_CONST(0.999992), FRAC_CONST(0.999998) }, + { FRAC_CONST(0.99611), FRAC_CONST(0.996113), FRAC_CONST(0.996124), FRAC_CONST(0.996169), FRAC_CONST(0.996337), FRAC_CONST(0.996885), FRAC_CONST(0.998051), FRAC_CONST(0.999219), FRAC_CONST(0.99977), FRAC_CONST(0.99994), FRAC_CONST(0.999985), FRAC_CONST(0.999996), FRAC_CONST(0.999999) }, + { FRAC_CONST(0.998051), FRAC_CONST(0.998053), FRAC_CONST(0.998058), FRAC_CONST(0.998081), FRAC_CONST(0.998165), FRAC_CONST(0.99844), FRAC_CONST(0.999024), FRAC_CONST(0.99961), FRAC_CONST(0.999885), FRAC_CONST(0.99997), FRAC_CONST(0.999992), FRAC_CONST(0.999998), FRAC_CONST(1) }, + { FRAC_CONST(0.999025), FRAC_CONST(0.999025), FRAC_CONST(0.999028), FRAC_CONST(0.999039), FRAC_CONST(0.999082), FRAC_CONST(0.999219), FRAC_CONST(0.999512), FRAC_CONST(0.999805), FRAC_CONST(0.999943), FRAC_CONST(0.999985), FRAC_CONST(0.999996), FRAC_CONST(0.999999), FRAC_CONST(1) }, + { FRAC_CONST(0.999512), FRAC_CONST(0.999512), FRAC_CONST(0.999514), FRAC_CONST(0.999519), FRAC_CONST(0.999541), FRAC_CONST(0.99961), FRAC_CONST(0.999756), FRAC_CONST(0.999902), FRAC_CONST(0.999971), FRAC_CONST(0.999992), FRAC_CONST(0.999998), FRAC_CONST(1), FRAC_CONST(1) }, + { FRAC_CONST(0.999756), FRAC_CONST(0.999756), FRAC_CONST(0.999757), FRAC_CONST(0.99976), FRAC_CONST(0.99977), FRAC_CONST(0.999805), FRAC_CONST(0.999878), FRAC_CONST(0.999951), FRAC_CONST(0.999986), FRAC_CONST(0.999996), FRAC_CONST(0.999999), FRAC_CONST(1), FRAC_CONST(1) }, + { FRAC_CONST(0.999878), FRAC_CONST(0.999878), FRAC_CONST(0.999878), FRAC_CONST(0.99988), FRAC_CONST(0.999885), FRAC_CONST(0.999902), FRAC_CONST(0.999939), FRAC_CONST(0.999976), FRAC_CONST(0.999993), FRAC_CONST(0.999998), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) }, + { FRAC_CONST(0.999939), FRAC_CONST(0.999939), FRAC_CONST(0.999939), FRAC_CONST(0.99994), FRAC_CONST(0.999943), FRAC_CONST(0.999951), FRAC_CONST(0.999969), FRAC_CONST(0.999988), FRAC_CONST(0.999996), FRAC_CONST(0.999999), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) }, + { FRAC_CONST(0.999969), FRAC_CONST(0.99997), FRAC_CONST(0.99997), FRAC_CONST(0.99997), FRAC_CONST(0.999971), FRAC_CONST(0.999976), FRAC_CONST(0.999985), FRAC_CONST(0.999994), FRAC_CONST(0.999998), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) }, + { FRAC_CONST(0.999985), FRAC_CONST(0.999985), FRAC_CONST(0.999985), FRAC_CONST(0.999985), FRAC_CONST(0.999986), FRAC_CONST(0.999988), FRAC_CONST(0.999992), FRAC_CONST(0.999997), FRAC_CONST(0.999999), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) }, + { FRAC_CONST(0.999992), FRAC_CONST(0.999992), FRAC_CONST(0.999992), FRAC_CONST(0.999992), FRAC_CONST(0.999993), FRAC_CONST(0.999994), FRAC_CONST(0.999996), FRAC_CONST(0.999998), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) }, + { FRAC_CONST(0.999996), FRAC_CONST(0.999996), FRAC_CONST(0.999996), FRAC_CONST(0.999996), FRAC_CONST(0.999996), FRAC_CONST(0.999997), FRAC_CONST(0.999998), FRAC_CONST(0.999999), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) }, + { FRAC_CONST(0.999998), FRAC_CONST(0.999998), FRAC_CONST(0.999998), FRAC_CONST(0.999998), FRAC_CONST(0.999998), FRAC_CONST(0.999998), FRAC_CONST(0.999999), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) }, + { FRAC_CONST(0.999999), FRAC_CONST(0.999999), FRAC_CONST(0.999999), FRAC_CONST(0.999999), FRAC_CONST(0.999999), FRAC_CONST(0.999999), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) }, + { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) }, + { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) }, + { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) } +}; + +/* calculates 1/(1+Q) */ +/* [0..1] */ +real_t calc_Q_div(sbr_info *sbr, uint8_t ch, uint8_t m, uint8_t l) +{ + if (sbr->bs_coupling) + { + /* left channel */ + if ((sbr->Q[0][m][l] < 0 || sbr->Q[0][m][l] > 30) || + (sbr->Q[1][m][l] < 0 || sbr->Q[1][m][l] > 24 /* 2*panOffset(1) */)) + { + return 0; + } else { + /* the pan parameter is always even */ + if (ch == 0) + { + return Q_div_tab_left[sbr->Q[0][m][l]][sbr->Q[1][m][l] >> 1]; + } else { + return Q_div_tab_right[sbr->Q[0][m][l]][sbr->Q[1][m][l] >> 1]; + } + } + } else { + /* no coupling */ + if (sbr->Q[ch][m][l] < 0 || sbr->Q[ch][m][l] > 30) + { + return 0; + } else { + return Q_div_tab[sbr->Q[ch][m][l]]; + } + } +} + +/* table for Q_div2 values when no coupling */ +static const real_t Q_div2_tab[31] = { + FRAC_CONST(0.984615), FRAC_CONST(0.969697), + FRAC_CONST(0.941176), FRAC_CONST(0.888889), + FRAC_CONST(0.8), FRAC_CONST(0.666667), + FRAC_CONST(0.5), FRAC_CONST(0.333333), + FRAC_CONST(0.2), FRAC_CONST(0.111111), + FRAC_CONST(0.0588235), FRAC_CONST(0.030303), + FRAC_CONST(0.0153846), FRAC_CONST(0.00775194), + FRAC_CONST(0.00389105), FRAC_CONST(0.00194932), + FRAC_CONST(0.00097561), FRAC_CONST(0.000488043), + FRAC_CONST(0.000244081), FRAC_CONST(0.000122055), + FRAC_CONST(6.10314E-005), FRAC_CONST(3.05166E-005), + FRAC_CONST(1.52586E-005), FRAC_CONST(7.62934E-006), + FRAC_CONST(3.81468E-006), FRAC_CONST(1.90734E-006), + FRAC_CONST(9.53673E-007), FRAC_CONST(4.76837E-007), + FRAC_CONST(2.38419E-007), FRAC_CONST(1.19209E-007), + FRAC_CONST(5.96046E-008) +}; + +static const real_t Q_div2_tab_left[31][13] = { + { FRAC_CONST(0.0302959), FRAC_CONST(0.111015), FRAC_CONST(0.332468), FRAC_CONST(0.663212), FRAC_CONST(0.882759), FRAC_CONST(0.962406), FRAC_CONST(0.984615), FRAC_CONST(0.990329), FRAC_CONST(0.991768), FRAC_CONST(0.992128), FRAC_CONST(0.992218), FRAC_CONST(0.992241), FRAC_CONST(0.992246) }, + { FRAC_CONST(0.0153809), FRAC_CONST(0.0587695), FRAC_CONST(0.199377), FRAC_CONST(0.496124), FRAC_CONST(0.790123), FRAC_CONST(0.927536), FRAC_CONST(0.969697), FRAC_CONST(0.980843), FRAC_CONST(0.98367), FRAC_CONST(0.984379), FRAC_CONST(0.984556), FRAC_CONST(0.984601), FRAC_CONST(0.984612) }, + { FRAC_CONST(0.00775006), FRAC_CONST(0.0302744), FRAC_CONST(0.110727), FRAC_CONST(0.329897), FRAC_CONST(0.653061), FRAC_CONST(0.864865), FRAC_CONST(0.941176), FRAC_CONST(0.962406), FRAC_CONST(0.967864), FRAC_CONST(0.969238), FRAC_CONST(0.969582), FRAC_CONST(0.969668), FRAC_CONST(0.96969) }, + { FRAC_CONST(0.0038901), FRAC_CONST(0.0153698), FRAC_CONST(0.0586081), FRAC_CONST(0.197531), FRAC_CONST(0.484848), FRAC_CONST(0.761905), FRAC_CONST(0.888889), FRAC_CONST(0.927536), FRAC_CONST(0.937729), FRAC_CONST(0.940312), FRAC_CONST(0.94096), FRAC_CONST(0.941122), FRAC_CONST(0.941163) }, + { FRAC_CONST(0.00194884), FRAC_CONST(0.00774443), FRAC_CONST(0.0301887), FRAC_CONST(0.109589), FRAC_CONST(0.32), FRAC_CONST(0.615385), FRAC_CONST(0.8), FRAC_CONST(0.864865), FRAC_CONST(0.882759), FRAC_CONST(0.887348), FRAC_CONST(0.888503), FRAC_CONST(0.888792), FRAC_CONST(0.888865) }, + { FRAC_CONST(0.000975372), FRAC_CONST(0.00388727), FRAC_CONST(0.0153257), FRAC_CONST(0.057971), FRAC_CONST(0.190476), FRAC_CONST(0.444444), FRAC_CONST(0.666667), FRAC_CONST(0.761905), FRAC_CONST(0.790123), FRAC_CONST(0.797508), FRAC_CONST(0.799375), FRAC_CONST(0.799844), FRAC_CONST(0.799961) }, + { FRAC_CONST(0.000487924), FRAC_CONST(0.00194742), FRAC_CONST(0.00772201), FRAC_CONST(0.0298507), FRAC_CONST(0.105263), FRAC_CONST(0.285714), FRAC_CONST(0.5), FRAC_CONST(0.615385), FRAC_CONST(0.653061), FRAC_CONST(0.663212), FRAC_CONST(0.6658), FRAC_CONST(0.66645), FRAC_CONST(0.666612) }, + { FRAC_CONST(0.000244021), FRAC_CONST(0.000974659), FRAC_CONST(0.00387597), FRAC_CONST(0.0151515), FRAC_CONST(0.0555556), FRAC_CONST(0.166667), FRAC_CONST(0.333333), FRAC_CONST(0.444444), FRAC_CONST(0.484848), FRAC_CONST(0.496124), FRAC_CONST(0.499025), FRAC_CONST(0.499756), FRAC_CONST(0.499939) }, + { FRAC_CONST(0.000122026), FRAC_CONST(0.000487567), FRAC_CONST(0.00194175), FRAC_CONST(0.00763359), FRAC_CONST(0.0285714), FRAC_CONST(0.0909091), FRAC_CONST(0.2), FRAC_CONST(0.285714), FRAC_CONST(0.32), FRAC_CONST(0.329897), FRAC_CONST(0.332468), FRAC_CONST(0.333116), FRAC_CONST(0.333279) }, + { FRAC_CONST(6.10165E-005), FRAC_CONST(0.000243843), FRAC_CONST(0.000971817), FRAC_CONST(0.00383142), FRAC_CONST(0.0144928), FRAC_CONST(0.047619), FRAC_CONST(0.111111), FRAC_CONST(0.166667), FRAC_CONST(0.190476), FRAC_CONST(0.197531), FRAC_CONST(0.199377), FRAC_CONST(0.199844), FRAC_CONST(0.199961) }, + { FRAC_CONST(3.05092E-005), FRAC_CONST(0.000121936), FRAC_CONST(0.000486145), FRAC_CONST(0.00191939), FRAC_CONST(0.00729927), FRAC_CONST(0.0243902), FRAC_CONST(0.0588235), FRAC_CONST(0.0909091), FRAC_CONST(0.105263), FRAC_CONST(0.109589), FRAC_CONST(0.110727), FRAC_CONST(0.111015), FRAC_CONST(0.111087) }, + { FRAC_CONST(1.52548E-005), FRAC_CONST(6.09719E-005), FRAC_CONST(0.000243132), FRAC_CONST(0.000960615), FRAC_CONST(0.003663), FRAC_CONST(0.0123457), FRAC_CONST(0.030303), FRAC_CONST(0.047619), FRAC_CONST(0.0555556), FRAC_CONST(0.057971), FRAC_CONST(0.0586081), FRAC_CONST(0.0587695), FRAC_CONST(0.05881) }, + { FRAC_CONST(7.62747E-006), FRAC_CONST(3.04869E-005), FRAC_CONST(0.000121581), FRAC_CONST(0.000480538), FRAC_CONST(0.00183486), FRAC_CONST(0.00621118), FRAC_CONST(0.0153846), FRAC_CONST(0.0243902), FRAC_CONST(0.0285714), FRAC_CONST(0.0298507), FRAC_CONST(0.0301887), FRAC_CONST(0.0302744), FRAC_CONST(0.0302959) }, + { FRAC_CONST(3.81375E-006), FRAC_CONST(1.52437E-005), FRAC_CONST(6.0794E-005), FRAC_CONST(0.000240327), FRAC_CONST(0.000918274), FRAC_CONST(0.00311526), FRAC_CONST(0.00775194), FRAC_CONST(0.0123457), FRAC_CONST(0.0144928), FRAC_CONST(0.0151515), FRAC_CONST(0.0153257), FRAC_CONST(0.0153698), FRAC_CONST(0.0153809) }, + { FRAC_CONST(1.90688E-006), FRAC_CONST(7.62189E-006), FRAC_CONST(3.03979E-005), FRAC_CONST(0.000120178), FRAC_CONST(0.000459348), FRAC_CONST(0.00156006), FRAC_CONST(0.00389105), FRAC_CONST(0.00621118), FRAC_CONST(0.00729927), FRAC_CONST(0.00763359), FRAC_CONST(0.00772201), FRAC_CONST(0.00774443), FRAC_CONST(0.00775006) }, + { FRAC_CONST(9.53441E-007), FRAC_CONST(3.81096E-006), FRAC_CONST(1.51992E-005), FRAC_CONST(6.00925E-005), FRAC_CONST(0.000229727), FRAC_CONST(0.00078064), FRAC_CONST(0.00194932), FRAC_CONST(0.00311526), FRAC_CONST(0.003663), FRAC_CONST(0.00383142), FRAC_CONST(0.00387597), FRAC_CONST(0.00388727), FRAC_CONST(0.0038901) }, + { FRAC_CONST(4.76721E-007), FRAC_CONST(1.90548E-006), FRAC_CONST(7.59965E-006), FRAC_CONST(3.00472E-005), FRAC_CONST(0.000114877), FRAC_CONST(0.000390472), FRAC_CONST(0.00097561), FRAC_CONST(0.00156006), FRAC_CONST(0.00183486), FRAC_CONST(0.00191939), FRAC_CONST(0.00194175), FRAC_CONST(0.00194742), FRAC_CONST(0.00194884) }, + { FRAC_CONST(2.3836E-007), FRAC_CONST(9.52743E-007), FRAC_CONST(3.79984E-006), FRAC_CONST(1.50238E-005), FRAC_CONST(5.74416E-005), FRAC_CONST(0.000195274), FRAC_CONST(0.000488043), FRAC_CONST(0.00078064), FRAC_CONST(0.000918274), FRAC_CONST(0.000960615), FRAC_CONST(0.000971817), FRAC_CONST(0.000974659), FRAC_CONST(0.000975372) }, + { FRAC_CONST(1.1918E-007), FRAC_CONST(4.76372E-007), FRAC_CONST(1.89992E-006), FRAC_CONST(7.51196E-006), FRAC_CONST(2.87216E-005), FRAC_CONST(9.76467E-005), FRAC_CONST(0.000244081), FRAC_CONST(0.000390472), FRAC_CONST(0.000459348), FRAC_CONST(0.000480538), FRAC_CONST(0.000486145), FRAC_CONST(0.000487567), FRAC_CONST(0.000487924) }, + { FRAC_CONST(5.95901E-008), FRAC_CONST(2.38186E-007), FRAC_CONST(9.49963E-007), FRAC_CONST(3.756E-006), FRAC_CONST(1.4361E-005), FRAC_CONST(4.88257E-005), FRAC_CONST(0.000122055), FRAC_CONST(0.000195274), FRAC_CONST(0.000229727), FRAC_CONST(0.000240327), FRAC_CONST(0.000243132), FRAC_CONST(0.000243843), FRAC_CONST(0.000244021) }, + { FRAC_CONST(2.9795E-008), FRAC_CONST(1.19093E-007), FRAC_CONST(4.74982E-007), FRAC_CONST(1.878E-006), FRAC_CONST(7.18056E-006), FRAC_CONST(2.44135E-005), FRAC_CONST(6.10314E-005), FRAC_CONST(9.76467E-005), FRAC_CONST(0.000114877), FRAC_CONST(0.000120178), FRAC_CONST(0.000121581), FRAC_CONST(0.000121936), FRAC_CONST(0.000122026) }, + { FRAC_CONST(1.48975E-008), FRAC_CONST(5.95465E-008), FRAC_CONST(2.37491E-007), FRAC_CONST(9.39002E-007), FRAC_CONST(3.59029E-006), FRAC_CONST(1.22069E-005), FRAC_CONST(3.05166E-005), FRAC_CONST(4.88257E-005), FRAC_CONST(5.74416E-005), FRAC_CONST(6.00925E-005), FRAC_CONST(6.0794E-005), FRAC_CONST(6.09719E-005), FRAC_CONST(6.10165E-005) }, + { FRAC_CONST(7.44876E-009), FRAC_CONST(2.97732E-008), FRAC_CONST(1.18745E-007), FRAC_CONST(4.69501E-007), FRAC_CONST(1.79515E-006), FRAC_CONST(6.10348E-006), FRAC_CONST(1.52586E-005), FRAC_CONST(2.44135E-005), FRAC_CONST(2.87216E-005), FRAC_CONST(3.00472E-005), FRAC_CONST(3.03979E-005), FRAC_CONST(3.04869E-005), FRAC_CONST(3.05092E-005) }, + { FRAC_CONST(3.72438E-009), FRAC_CONST(1.48866E-008), FRAC_CONST(5.93727E-008), FRAC_CONST(2.34751E-007), FRAC_CONST(8.97575E-007), FRAC_CONST(3.05175E-006), FRAC_CONST(7.62934E-006), FRAC_CONST(1.22069E-005), FRAC_CONST(1.4361E-005), FRAC_CONST(1.50238E-005), FRAC_CONST(1.51992E-005), FRAC_CONST(1.52437E-005), FRAC_CONST(1.52548E-005) }, + { FRAC_CONST(1.86219E-009), FRAC_CONST(7.44331E-009), FRAC_CONST(2.96864E-008), FRAC_CONST(1.17375E-007), FRAC_CONST(4.48788E-007), FRAC_CONST(1.52588E-006), FRAC_CONST(3.81468E-006), FRAC_CONST(6.10348E-006), FRAC_CONST(7.18056E-006), FRAC_CONST(7.51196E-006), FRAC_CONST(7.59965E-006), FRAC_CONST(7.62189E-006), FRAC_CONST(7.62747E-006) }, + { FRAC_CONST(9.31095E-010), FRAC_CONST(3.72166E-009), FRAC_CONST(1.48432E-008), FRAC_CONST(5.86876E-008), FRAC_CONST(2.24394E-007), FRAC_CONST(7.62939E-007), FRAC_CONST(1.90734E-006), FRAC_CONST(3.05175E-006), FRAC_CONST(3.59029E-006), FRAC_CONST(3.756E-006), FRAC_CONST(3.79984E-006), FRAC_CONST(3.81096E-006), FRAC_CONST(3.81375E-006) }, + { FRAC_CONST(4.65548E-010), FRAC_CONST(1.86083E-009), FRAC_CONST(7.42159E-009), FRAC_CONST(2.93438E-008), FRAC_CONST(1.12197E-007), FRAC_CONST(3.8147E-007), FRAC_CONST(9.53673E-007), FRAC_CONST(1.52588E-006), FRAC_CONST(1.79515E-006), FRAC_CONST(1.878E-006), FRAC_CONST(1.89992E-006), FRAC_CONST(1.90548E-006), FRAC_CONST(1.90688E-006) }, + { FRAC_CONST(2.32774E-010), FRAC_CONST(9.30414E-010), FRAC_CONST(3.71079E-009), FRAC_CONST(1.46719E-008), FRAC_CONST(5.60985E-008), FRAC_CONST(1.90735E-007), FRAC_CONST(4.76837E-007), FRAC_CONST(7.62939E-007), FRAC_CONST(8.97575E-007), FRAC_CONST(9.39002E-007), FRAC_CONST(9.49963E-007), FRAC_CONST(9.52743E-007), FRAC_CONST(9.53441E-007) }, + { FRAC_CONST(1.16387E-010), FRAC_CONST(4.65207E-010), FRAC_CONST(1.8554E-009), FRAC_CONST(7.33596E-009), FRAC_CONST(2.80492E-008), FRAC_CONST(9.53674E-008), FRAC_CONST(2.38419E-007), FRAC_CONST(3.8147E-007), FRAC_CONST(4.48788E-007), FRAC_CONST(4.69501E-007), FRAC_CONST(4.74982E-007), FRAC_CONST(4.76372E-007), FRAC_CONST(4.76721E-007) }, + { FRAC_CONST(5.81935E-011), FRAC_CONST(2.32603E-010), FRAC_CONST(9.27699E-010), FRAC_CONST(3.66798E-009), FRAC_CONST(1.40246E-008), FRAC_CONST(4.76837E-008), FRAC_CONST(1.19209E-007), FRAC_CONST(1.90735E-007), FRAC_CONST(2.24394E-007), FRAC_CONST(2.34751E-007), FRAC_CONST(2.37491E-007), FRAC_CONST(2.38186E-007), FRAC_CONST(2.3836E-007) }, + { FRAC_CONST(2.90967E-011), FRAC_CONST(1.16302E-010), FRAC_CONST(4.63849E-010), FRAC_CONST(1.83399E-009), FRAC_CONST(7.01231E-009), FRAC_CONST(2.38419E-008), FRAC_CONST(5.96046E-008), FRAC_CONST(9.53674E-008), FRAC_CONST(1.12197E-007), FRAC_CONST(1.17375E-007), FRAC_CONST(1.18745E-007), FRAC_CONST(1.19093E-007), FRAC_CONST(1.1918E-007) } +}; + +static const real_t Q_div2_tab_right[31][13] = { + { FRAC_CONST(0.992246), FRAC_CONST(0.992241), FRAC_CONST(0.992218), FRAC_CONST(0.992128), FRAC_CONST(0.991768), FRAC_CONST(0.990329), FRAC_CONST(0.984615), FRAC_CONST(0.962406), FRAC_CONST(0.882759), FRAC_CONST(0.663212), FRAC_CONST(0.332468), FRAC_CONST(0.111015), FRAC_CONST(0.0302959) }, + { FRAC_CONST(0.984612), FRAC_CONST(0.984601), FRAC_CONST(0.984556), FRAC_CONST(0.984379), FRAC_CONST(0.98367), FRAC_CONST(0.980843), FRAC_CONST(0.969697), FRAC_CONST(0.927536), FRAC_CONST(0.790123), FRAC_CONST(0.496124), FRAC_CONST(0.199377), FRAC_CONST(0.0587695), FRAC_CONST(0.0153809) }, + { FRAC_CONST(0.96969), FRAC_CONST(0.969668), FRAC_CONST(0.969582), FRAC_CONST(0.969238), FRAC_CONST(0.967864), FRAC_CONST(0.962406), FRAC_CONST(0.941176), FRAC_CONST(0.864865), FRAC_CONST(0.653061), FRAC_CONST(0.329897), FRAC_CONST(0.110727), FRAC_CONST(0.0302744), FRAC_CONST(0.00775006) }, + { FRAC_CONST(0.941163), FRAC_CONST(0.941122), FRAC_CONST(0.94096), FRAC_CONST(0.940312), FRAC_CONST(0.937729), FRAC_CONST(0.927536), FRAC_CONST(0.888889), FRAC_CONST(0.761905), FRAC_CONST(0.484848), FRAC_CONST(0.197531), FRAC_CONST(0.0586081), FRAC_CONST(0.0153698), FRAC_CONST(0.0038901) }, + { FRAC_CONST(0.888865), FRAC_CONST(0.888792), FRAC_CONST(0.888503), FRAC_CONST(0.887348), FRAC_CONST(0.882759), FRAC_CONST(0.864865), FRAC_CONST(0.8), FRAC_CONST(0.615385), FRAC_CONST(0.32), FRAC_CONST(0.109589), FRAC_CONST(0.0301887), FRAC_CONST(0.00774443), FRAC_CONST(0.00194884) }, + { FRAC_CONST(0.799961), FRAC_CONST(0.799844), FRAC_CONST(0.799375), FRAC_CONST(0.797508), FRAC_CONST(0.790123), FRAC_CONST(0.761905), FRAC_CONST(0.666667), FRAC_CONST(0.444444), FRAC_CONST(0.190476), FRAC_CONST(0.057971), FRAC_CONST(0.0153257), FRAC_CONST(0.00388727), FRAC_CONST(0.000975372) }, + { FRAC_CONST(0.666612), FRAC_CONST(0.66645), FRAC_CONST(0.6658), FRAC_CONST(0.663212), FRAC_CONST(0.653061), FRAC_CONST(0.615385), FRAC_CONST(0.5), FRAC_CONST(0.285714), FRAC_CONST(0.105263), FRAC_CONST(0.0298507), FRAC_CONST(0.00772201), FRAC_CONST(0.00194742), FRAC_CONST(0.000487924) }, + { FRAC_CONST(0.499939), FRAC_CONST(0.499756), FRAC_CONST(0.499025), FRAC_CONST(0.496124), FRAC_CONST(0.484848), FRAC_CONST(0.444444), FRAC_CONST(0.333333), FRAC_CONST(0.166667), FRAC_CONST(0.0555556), FRAC_CONST(0.0151515), FRAC_CONST(0.00387597), FRAC_CONST(0.000974659), FRAC_CONST(0.000244021) }, + { FRAC_CONST(0.333279), FRAC_CONST(0.333116), FRAC_CONST(0.332468), FRAC_CONST(0.329897), FRAC_CONST(0.32), FRAC_CONST(0.285714), FRAC_CONST(0.2), FRAC_CONST(0.0909091), FRAC_CONST(0.0285714), FRAC_CONST(0.00763359), FRAC_CONST(0.00194175), FRAC_CONST(0.000487567), FRAC_CONST(0.000122026) }, + { FRAC_CONST(0.199961), FRAC_CONST(0.199844), FRAC_CONST(0.199377), FRAC_CONST(0.197531), FRAC_CONST(0.190476), FRAC_CONST(0.166667), FRAC_CONST(0.111111), FRAC_CONST(0.047619), FRAC_CONST(0.0144928), FRAC_CONST(0.00383142), FRAC_CONST(0.000971817), FRAC_CONST(0.000243843), FRAC_CONST(6.10165E-005) }, + { FRAC_CONST(0.111087), FRAC_CONST(0.111015), FRAC_CONST(0.110727), FRAC_CONST(0.109589), FRAC_CONST(0.105263), FRAC_CONST(0.0909091), FRAC_CONST(0.0588235), FRAC_CONST(0.0243902), FRAC_CONST(0.00729927), FRAC_CONST(0.00191939), FRAC_CONST(0.000486145), FRAC_CONST(0.000121936), FRAC_CONST(3.05092E-005) }, + { FRAC_CONST(0.05881), FRAC_CONST(0.0587695), FRAC_CONST(0.0586081), FRAC_CONST(0.057971), FRAC_CONST(0.0555556), FRAC_CONST(0.047619), FRAC_CONST(0.030303), FRAC_CONST(0.0123457), FRAC_CONST(0.003663), FRAC_CONST(0.000960615), FRAC_CONST(0.000243132), FRAC_CONST(6.09719E-005), FRAC_CONST(1.52548E-005) }, + { FRAC_CONST(0.0302959), FRAC_CONST(0.0302744), FRAC_CONST(0.0301887), FRAC_CONST(0.0298507), FRAC_CONST(0.0285714), FRAC_CONST(0.0243902), FRAC_CONST(0.0153846), FRAC_CONST(0.00621118), FRAC_CONST(0.00183486), FRAC_CONST(0.000480538), FRAC_CONST(0.000121581), FRAC_CONST(3.04869E-005), FRAC_CONST(7.62747E-006) }, + { FRAC_CONST(0.0153809), FRAC_CONST(0.0153698), FRAC_CONST(0.0153257), FRAC_CONST(0.0151515), FRAC_CONST(0.0144928), FRAC_CONST(0.0123457), FRAC_CONST(0.00775194), FRAC_CONST(0.00311526), FRAC_CONST(0.000918274), FRAC_CONST(0.000240327), FRAC_CONST(6.0794E-005), FRAC_CONST(1.52437E-005), FRAC_CONST(3.81375E-006) }, + { FRAC_CONST(0.00775006), FRAC_CONST(0.00774443), FRAC_CONST(0.00772201), FRAC_CONST(0.00763359), FRAC_CONST(0.00729927), FRAC_CONST(0.00621118), FRAC_CONST(0.00389105), FRAC_CONST(0.00156006), FRAC_CONST(0.000459348), FRAC_CONST(0.000120178), FRAC_CONST(3.03979E-005), FRAC_CONST(7.62189E-006), FRAC_CONST(1.90688E-006) }, + { FRAC_CONST(0.0038901), FRAC_CONST(0.00388727), FRAC_CONST(0.00387597), FRAC_CONST(0.00383142), FRAC_CONST(0.003663), FRAC_CONST(0.00311526), FRAC_CONST(0.00194932), FRAC_CONST(0.00078064), FRAC_CONST(0.000229727), FRAC_CONST(6.00925E-005), FRAC_CONST(1.51992E-005), FRAC_CONST(3.81096E-006), FRAC_CONST(9.53441E-007) }, + { FRAC_CONST(0.00194884), FRAC_CONST(0.00194742), FRAC_CONST(0.00194175), FRAC_CONST(0.00191939), FRAC_CONST(0.00183486), FRAC_CONST(0.00156006), FRAC_CONST(0.00097561), FRAC_CONST(0.000390472), FRAC_CONST(0.000114877), FRAC_CONST(3.00472E-005), FRAC_CONST(7.59965E-006), FRAC_CONST(1.90548E-006), FRAC_CONST(4.76721E-007) }, + { FRAC_CONST(0.000975372), FRAC_CONST(0.000974659), FRAC_CONST(0.000971817), FRAC_CONST(0.000960615), FRAC_CONST(0.000918274), FRAC_CONST(0.00078064), FRAC_CONST(0.000488043), FRAC_CONST(0.000195274), FRAC_CONST(5.74416E-005), FRAC_CONST(1.50238E-005), FRAC_CONST(3.79984E-006), FRAC_CONST(9.52743E-007), FRAC_CONST(2.3836E-007) }, + { FRAC_CONST(0.000487924), FRAC_CONST(0.000487567), FRAC_CONST(0.000486145), FRAC_CONST(0.000480538), FRAC_CONST(0.000459348), FRAC_CONST(0.000390472), FRAC_CONST(0.000244081), FRAC_CONST(9.76467E-005), FRAC_CONST(2.87216E-005), FRAC_CONST(7.51196E-006), FRAC_CONST(1.89992E-006), FRAC_CONST(4.76372E-007), FRAC_CONST(1.1918E-007) }, + { FRAC_CONST(0.000244021), FRAC_CONST(0.000243843), FRAC_CONST(0.000243132), FRAC_CONST(0.000240327), FRAC_CONST(0.000229727), FRAC_CONST(0.000195274), FRAC_CONST(0.000122055), FRAC_CONST(4.88257E-005), FRAC_CONST(1.4361E-005), FRAC_CONST(3.756E-006), FRAC_CONST(9.49963E-007), FRAC_CONST(2.38186E-007), FRAC_CONST(5.95901E-008) }, + { FRAC_CONST(0.000122026), FRAC_CONST(0.000121936), FRAC_CONST(0.000121581), FRAC_CONST(0.000120178), FRAC_CONST(0.000114877), FRAC_CONST(9.76467E-005), FRAC_CONST(6.10314E-005), FRAC_CONST(2.44135E-005), FRAC_CONST(7.18056E-006), FRAC_CONST(1.878E-006), FRAC_CONST(4.74982E-007), FRAC_CONST(1.19093E-007), FRAC_CONST(2.9795E-008) }, + { FRAC_CONST(6.10165E-005), FRAC_CONST(6.09719E-005), FRAC_CONST(6.0794E-005), FRAC_CONST(6.00925E-005), FRAC_CONST(5.74416E-005), FRAC_CONST(4.88257E-005), FRAC_CONST(3.05166E-005), FRAC_CONST(1.22069E-005), FRAC_CONST(3.59029E-006), FRAC_CONST(9.39002E-007), FRAC_CONST(2.37491E-007), FRAC_CONST(5.95465E-008), FRAC_CONST(1.48975E-008) }, + { FRAC_CONST(3.05092E-005), FRAC_CONST(3.04869E-005), FRAC_CONST(3.03979E-005), FRAC_CONST(3.00472E-005), FRAC_CONST(2.87216E-005), FRAC_CONST(2.44135E-005), FRAC_CONST(1.52586E-005), FRAC_CONST(6.10348E-006), FRAC_CONST(1.79515E-006), FRAC_CONST(4.69501E-007), FRAC_CONST(1.18745E-007), FRAC_CONST(2.97732E-008), FRAC_CONST(7.44876E-009) }, + { FRAC_CONST(1.52548E-005), FRAC_CONST(1.52437E-005), FRAC_CONST(1.51992E-005), FRAC_CONST(1.50238E-005), FRAC_CONST(1.4361E-005), FRAC_CONST(1.22069E-005), FRAC_CONST(7.62934E-006), FRAC_CONST(3.05175E-006), FRAC_CONST(8.97575E-007), FRAC_CONST(2.34751E-007), FRAC_CONST(5.93727E-008), FRAC_CONST(1.48866E-008), FRAC_CONST(3.72438E-009) }, + { FRAC_CONST(7.62747E-006), FRAC_CONST(7.62189E-006), FRAC_CONST(7.59965E-006), FRAC_CONST(7.51196E-006), FRAC_CONST(7.18056E-006), FRAC_CONST(6.10348E-006), FRAC_CONST(3.81468E-006), FRAC_CONST(1.52588E-006), FRAC_CONST(4.48788E-007), FRAC_CONST(1.17375E-007), FRAC_CONST(2.96864E-008), FRAC_CONST(7.44331E-009), FRAC_CONST(1.86219E-009) }, + { FRAC_CONST(3.81375E-006), FRAC_CONST(3.81096E-006), FRAC_CONST(3.79984E-006), FRAC_CONST(3.756E-006), FRAC_CONST(3.59029E-006), FRAC_CONST(3.05175E-006), FRAC_CONST(1.90734E-006), FRAC_CONST(7.62939E-007), FRAC_CONST(2.24394E-007), FRAC_CONST(5.86876E-008), FRAC_CONST(1.48432E-008), FRAC_CONST(3.72166E-009), FRAC_CONST(9.31095E-010) }, + { FRAC_CONST(1.90688E-006), FRAC_CONST(1.90548E-006), FRAC_CONST(1.89992E-006), FRAC_CONST(1.878E-006), FRAC_CONST(1.79515E-006), FRAC_CONST(1.52588E-006), FRAC_CONST(9.53673E-007), FRAC_CONST(3.8147E-007), FRAC_CONST(1.12197E-007), FRAC_CONST(2.93438E-008), FRAC_CONST(7.42159E-009), FRAC_CONST(1.86083E-009), FRAC_CONST(4.65548E-010) }, + { FRAC_CONST(9.53441E-007), FRAC_CONST(9.52743E-007), FRAC_CONST(9.49963E-007), FRAC_CONST(9.39002E-007), FRAC_CONST(8.97575E-007), FRAC_CONST(7.62939E-007), FRAC_CONST(4.76837E-007), FRAC_CONST(1.90735E-007), FRAC_CONST(5.60985E-008), FRAC_CONST(1.46719E-008), FRAC_CONST(3.71079E-009), FRAC_CONST(9.30414E-010), FRAC_CONST(2.32774E-010) }, + { FRAC_CONST(4.76721E-007), FRAC_CONST(4.76372E-007), FRAC_CONST(4.74982E-007), FRAC_CONST(4.69501E-007), FRAC_CONST(4.48788E-007), FRAC_CONST(3.8147E-007), FRAC_CONST(2.38419E-007), FRAC_CONST(9.53674E-008), FRAC_CONST(2.80492E-008), FRAC_CONST(7.33596E-009), FRAC_CONST(1.8554E-009), FRAC_CONST(4.65207E-010), FRAC_CONST(1.16387E-010) }, + { FRAC_CONST(2.3836E-007), FRAC_CONST(2.38186E-007), FRAC_CONST(2.37491E-007), FRAC_CONST(2.34751E-007), FRAC_CONST(2.24394E-007), FRAC_CONST(1.90735E-007), FRAC_CONST(1.19209E-007), FRAC_CONST(4.76837E-008), FRAC_CONST(1.40246E-008), FRAC_CONST(3.66798E-009), FRAC_CONST(9.27699E-010), FRAC_CONST(2.32603E-010), FRAC_CONST(5.81935E-011) }, + { FRAC_CONST(1.1918E-007), FRAC_CONST(1.19093E-007), FRAC_CONST(1.18745E-007), FRAC_CONST(1.17375E-007), FRAC_CONST(1.12197E-007), FRAC_CONST(9.53674E-008), FRAC_CONST(5.96046E-008), FRAC_CONST(2.38419E-008), FRAC_CONST(7.01231E-009), FRAC_CONST(1.83399E-009), FRAC_CONST(4.63849E-010), FRAC_CONST(1.16302E-010), FRAC_CONST(2.90967E-011) } +}; + +/* calculates Q/(1+Q) */ +/* [0..1] */ +real_t calc_Q_div2(sbr_info *sbr, uint8_t ch, uint8_t m, uint8_t l) +{ + if (sbr->bs_coupling) + { + if ((sbr->Q[0][m][l] < 0 || sbr->Q[0][m][l] > 30) || + (sbr->Q[1][m][l] < 0 || sbr->Q[1][m][l] > 24 /* 2*panOffset(1) */)) + { + return 0; + } else { + /* the pan parameter is always even */ + if (ch == 0) + { + return Q_div2_tab_left[sbr->Q[0][m][l]][sbr->Q[1][m][l] >> 1]; + } else { + return Q_div2_tab_right[sbr->Q[0][m][l]][sbr->Q[1][m][l] >> 1]; + } + } + } else { + /* no coupling */ + if (sbr->Q[ch][m][l] < 0 || sbr->Q[ch][m][l] > 30) + { + return 0; + } else { + return Q_div2_tab[sbr->Q[ch][m][l]]; + } + } +} + +static const real_t E_deq_tab[64] = { + 64.0f, 128.0f, 256.0f, 512.0f, 1024.0f, 2048.0f, 4096.0f, 8192.0f, + 16384.0f, 32768.0f, 65536.0f, 131072.0f, 262144.0f, 524288.0f, 1.04858E+006f, 2.09715E+006f, + 4.1943E+006f, 8.38861E+006f, 1.67772E+007f, 3.35544E+007f, 6.71089E+007f, 1.34218E+008f, 2.68435E+008f, 5.36871E+008f, + 1.07374E+009f, 2.14748E+009f, 4.29497E+009f, 8.58993E+009f, 1.71799E+010f, 3.43597E+010f, 6.87195E+010f, 1.37439E+011f, + 2.74878E+011f, 5.49756E+011f, 1.09951E+012f, 2.19902E+012f, 4.39805E+012f, 8.79609E+012f, 1.75922E+013f, 3.51844E+013f, + 7.03687E+013f, 1.40737E+014f, 2.81475E+014f, 5.6295E+014f, 1.1259E+015f, 2.2518E+015f, 4.5036E+015f, 9.0072E+015f, + 1.80144E+016f, 3.60288E+016f, 7.20576E+016f, 1.44115E+017f, 2.8823E+017f, 5.76461E+017f, 1.15292E+018f, 2.30584E+018f, + 4.61169E+018f, 9.22337E+018f, 1.84467E+019f, 3.68935E+019f, 7.3787E+019f, 1.47574E+020f, 2.95148E+020f, 5.90296E+020f +}; + +void envelope_noise_dequantisation(sbr_info *sbr, uint8_t ch) +{ + if (sbr->bs_coupling == 0) + { + int16_t exp; + uint8_t l, k; + uint8_t amp = (sbr->amp_res[ch]) ? 0 : 1; + + for (l = 0; l < sbr->L_E[ch]; l++) + { + for (k = 0; k < sbr->n[sbr->f[ch][l]]; k++) + { + /* +6 for the *64 and -10 for the /32 in the synthesis QMF (fixed) + * since this is a energy value: (x/32)^2 = (x^2)/1024 + */ + /* exp = (sbr->E[ch][k][l] >> amp) + 6; */ + exp = (sbr->E[ch][k][l] >> amp); + + if ((exp < 0) || (exp >= 64)) + { + sbr->E_orig[ch][k][l] = 0; + } else { + sbr->E_orig[ch][k][l] = E_deq_tab[exp]; + + /* save half the table size at the cost of 1 multiply */ + if (amp && (sbr->E[ch][k][l] & 1)) + { + sbr->E_orig[ch][k][l] = MUL_C(sbr->E_orig[ch][k][l], COEF_CONST(1.414213562)); + } + } + } + } + + for (l = 0; l < sbr->L_Q[ch]; l++) + { + for (k = 0; k < sbr->N_Q; k++) + { + sbr->Q_div[ch][k][l] = calc_Q_div(sbr, ch, k, l); + sbr->Q_div2[ch][k][l] = calc_Q_div2(sbr, ch, k, l); + } + } + } +} + +static const real_t E_pan_tab[25] = { + FRAC_CONST(0.000244081), FRAC_CONST(0.000488043), + FRAC_CONST(0.00097561), FRAC_CONST(0.00194932), + FRAC_CONST(0.00389105), FRAC_CONST(0.00775194), + FRAC_CONST(0.0153846), FRAC_CONST(0.030303), + FRAC_CONST(0.0588235), FRAC_CONST(0.111111), + FRAC_CONST(0.2), FRAC_CONST(0.333333), + FRAC_CONST(0.5), FRAC_CONST(0.666667), + FRAC_CONST(0.8), FRAC_CONST(0.888889), + FRAC_CONST(0.941176), FRAC_CONST(0.969697), + FRAC_CONST(0.984615), FRAC_CONST(0.992248), + FRAC_CONST(0.996109), FRAC_CONST(0.998051), + FRAC_CONST(0.999024), FRAC_CONST(0.999512), + FRAC_CONST(0.999756) +}; + +void unmap_envelope_noise(sbr_info *sbr) +{ + real_t tmp; + int16_t exp0, exp1; + uint8_t l, k; + uint8_t amp0 = (sbr->amp_res[0]) ? 0 : 1; + uint8_t amp1 = (sbr->amp_res[1]) ? 0 : 1; + + for (l = 0; l < sbr->L_E[0]; l++) + { + for (k = 0; k < sbr->n[sbr->f[0][l]]; k++) + { + /* +6: * 64 ; +1: * 2 ; */ + exp0 = (sbr->E[0][k][l] >> amp0) + 1; + + /* UN_MAP removed: (x / 4096) same as (x >> 12) */ + /* E[1] is always even so no need for compensating the divide by 2 with + * an extra multiplication + */ + /* exp1 = (sbr->E[1][k][l] >> amp1) - 12; */ + exp1 = (sbr->E[1][k][l] >> amp1); + + if ((exp0 < 0) || (exp0 >= 64) || + (exp1 < 0) || (exp1 > 24)) + { + sbr->E_orig[1][k][l] = 0; + sbr->E_orig[0][k][l] = 0; + } else { + tmp = E_deq_tab[exp0]; + if (amp0 && (sbr->E[0][k][l] & 1)) + { + tmp = MUL_C(tmp, COEF_CONST(1.414213562)); + } + + /* panning */ + sbr->E_orig[0][k][l] = MUL_F(tmp, E_pan_tab[exp1]); + sbr->E_orig[1][k][l] = MUL_F(tmp, E_pan_tab[24 - exp1]); + } + } + } + + for (l = 0; l < sbr->L_Q[0]; l++) + { + for (k = 0; k < sbr->N_Q; k++) + { + sbr->Q_div[0][k][l] = calc_Q_div(sbr, 0, k, l); + sbr->Q_div[1][k][l] = calc_Q_div(sbr, 1, k, l); + sbr->Q_div2[0][k][l] = calc_Q_div2(sbr, 0, k, l); + sbr->Q_div2[1][k][l] = calc_Q_div2(sbr, 1, k, l); + } + } +} + +#endif + +#endif diff --git a/Libraries/FAAD2/Files/libfaad/sbr_e_nf.h b/Libraries/FAAD2/Files/libfaad/sbr_e_nf.h new file mode 100644 index 000000000..6c8b30f06 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/sbr_e_nf.h @@ -0,0 +1,47 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#ifndef __SBR_E_NF_H__ +#define __SBR_E_NF_H__ + +#ifdef __cplusplus +extern "C" { +#endif + + +void extract_envelope_data(sbr_info *sbr, uint8_t ch); +void extract_noise_floor_data(sbr_info *sbr, uint8_t ch); +#ifndef FIXED_POINT +void envelope_noise_dequantisation(sbr_info *sbr, uint8_t ch); +void unmap_envelope_noise(sbr_info *sbr); +#endif + +#ifdef __cplusplus +} +#endif +#endif + diff --git a/Libraries/FAAD2/Files/libfaad/sbr_fbt.c b/Libraries/FAAD2/Files/libfaad/sbr_fbt.c new file mode 100644 index 000000000..b90ae7d76 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/sbr_fbt.c @@ -0,0 +1,761 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +/* Calculate frequency band tables */ + +#include "common.h" +#include "structs.h" + +#ifdef SBR_DEC + +#include + +#include "sbr_syntax.h" +#include "sbr_fbt.h" + +/* static function declarations */ +static int32_t find_bands(uint8_t warp, uint8_t bands, uint8_t a0, uint8_t a1); + + +/* calculate the start QMF channel for the master frequency band table */ +/* parameter is also called k0 */ +uint8_t qmf_start_channel(uint8_t bs_start_freq, uint8_t bs_samplerate_mode, + uint32_t sample_rate) +{ + static const uint8_t startMinTable[12] = { 7, 7, 10, 11, 12, 16, 16, + 17, 24, 32, 35, 48 }; + static const uint8_t offsetIndexTable[12] = { 5, 5, 4, 4, 4, 3, 2, 1, 0, + 6, 6, 6 }; + static const int8_t offset[7][16] = { + { -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7 }, + { -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13 }, + { -5, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13, 16 }, + { -6, -4, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13, 16 }, + { -4, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13, 16, 20 }, + { -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13, 16, 20, 24 }, + { 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13, 16, 20, 24, 28, 33 } + }; + uint8_t startMin = startMinTable[get_sr_index(sample_rate)]; + uint8_t offsetIndex = offsetIndexTable[get_sr_index(sample_rate)]; + +#if 0 /* replaced with table (startMinTable) */ + if (sample_rate >= 64000) + { + startMin = (uint8_t)((5000.*128.)/(float)sample_rate + 0.5); + } else if (sample_rate < 32000) { + startMin = (uint8_t)((3000.*128.)/(float)sample_rate + 0.5); + } else { + startMin = (uint8_t)((4000.*128.)/(float)sample_rate + 0.5); + } +#endif + + if (bs_samplerate_mode) + { + return startMin + offset[offsetIndex][bs_start_freq]; + +#if 0 /* replaced by offsetIndexTable */ + switch (sample_rate) + { + case 16000: + return startMin + offset[0][bs_start_freq]; + case 22050: + return startMin + offset[1][bs_start_freq]; + case 24000: + return startMin + offset[2][bs_start_freq]; + case 32000: + return startMin + offset[3][bs_start_freq]; + default: + if (sample_rate > 64000) + { + return startMin + offset[5][bs_start_freq]; + } else { /* 44100 <= sample_rate <= 64000 */ + return startMin + offset[4][bs_start_freq]; + } + } +#endif + } else { + return startMin + offset[6][bs_start_freq]; + } +} + +static int longcmp(const void *a, const void *b) +{ + return ((int)(*(int32_t*)a - *(int32_t*)b)); +} + +/* calculate the stop QMF channel for the master frequency band table */ +/* parameter is also called k2 */ +uint8_t qmf_stop_channel(uint8_t bs_stop_freq, uint32_t sample_rate, + uint8_t k0) +{ + if (bs_stop_freq == 15) + { + return min(64, k0 * 3); + } else if (bs_stop_freq == 14) { + return min(64, k0 * 2); + } else { + static const uint8_t stopMinTable[12] = { 13, 15, 20, 21, 23, + 32, 32, 35, 48, 64, 70, 96 }; + static const int8_t offset[12][14] = { + { 0, 2, 4, 6, 8, 11, 14, 18, 22, 26, 31, 37, 44, 51 }, + { 0, 2, 4, 6, 8, 11, 14, 18, 22, 26, 31, 36, 42, 49 }, + { 0, 2, 4, 6, 8, 11, 14, 17, 21, 25, 29, 34, 39, 44 }, + { 0, 2, 4, 6, 8, 11, 14, 17, 20, 24, 28, 33, 38, 43 }, + { 0, 2, 4, 6, 8, 11, 14, 17, 20, 24, 28, 32, 36, 41 }, + { 0, 2, 4, 6, 8, 10, 12, 14, 17, 20, 23, 26, 29, 32 }, + { 0, 2, 4, 6, 8, 10, 12, 14, 17, 20, 23, 26, 29, 32 }, + { 0, 1, 3, 5, 7, 9, 11, 13, 15, 17, 20, 23, 26, 29 }, + { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 16 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0, -1, -2, -3, -4, -5, -6, -6, -6, -6, -6, -6, -6, -6 }, + { 0, -3, -6, -9, -12, -15, -18, -20, -22, -24, -26, -28, -30, -32 } + }; +#if 0 + uint8_t i; + int32_t stopDk[13], stopDk_t[14], k2; +#endif + uint8_t stopMin = stopMinTable[get_sr_index(sample_rate)]; + +#if 0 /* replaced by table lookup */ + if (sample_rate >= 64000) + { + stopMin = (uint8_t)((10000.*128.)/(float)sample_rate + 0.5); + } else if (sample_rate < 32000) { + stopMin = (uint8_t)((6000.*128.)/(float)sample_rate + 0.5); + } else { + stopMin = (uint8_t)((8000.*128.)/(float)sample_rate + 0.5); + } +#endif + +#if 0 /* replaced by table lookup */ + /* diverging power series */ + for (i = 0; i <= 13; i++) + { + stopDk_t[i] = (int32_t)(stopMin*pow(64.0/stopMin, i/13.0) + 0.5); + } + for (i = 0; i < 13; i++) + { + stopDk[i] = stopDk_t[i+1] - stopDk_t[i]; + } + + /* needed? */ + qsort(stopDk, 13, sizeof(stopDk[0]), longcmp); + + k2 = stopMin; + for (i = 0; i < bs_stop_freq; i++) + { + k2 += stopDk[i]; + } + return min(64, k2); +#endif + /* bs_stop_freq <= 13 */ + return min(64, stopMin + offset[get_sr_index(sample_rate)][min(bs_stop_freq, 13)]); + } + + return 0; +} + +/* calculate the master frequency table from k0, k2, bs_freq_scale + and bs_alter_scale + + version for bs_freq_scale = 0 +*/ +uint8_t master_frequency_table_fs0(sbr_info *sbr, uint8_t k0, uint8_t k2, + uint8_t bs_alter_scale) +{ + int8_t incr; + uint8_t k; + uint8_t dk; + uint32_t nrBands, k2Achieved; + int32_t k2Diff, vDk[64] = {0}; + + /* mft only defined for k2 > k0 */ + if (k2 <= k0) + { + sbr->N_master = 0; + return 1; + } + + dk = bs_alter_scale ? 2 : 1; + +#if 0 /* replaced by float-less design */ + nrBands = 2 * (int32_t)((float)(k2-k0)/(dk*2) + (-1+dk)/2.0f); +#else + if (bs_alter_scale) + { + nrBands = (((k2-k0+2)>>2)<<1); + } else { + nrBands = (((k2-k0)>>1)<<1); + } +#endif + nrBands = min(nrBands, 63); + if (nrBands <= 0) + return 1; + + k2Achieved = k0 + nrBands * dk; + k2Diff = k2 - k2Achieved; + for (k = 0; k < nrBands; k++) + vDk[k] = dk; + + if (k2Diff) + { + incr = (k2Diff > 0) ? -1 : 1; + k = (uint8_t) ((k2Diff > 0) ? (nrBands-1) : 0); + + while (k2Diff != 0) + { + vDk[k] -= incr; + k += incr; + k2Diff += incr; + } + } + + sbr->f_master[0] = k0; + for (k = 1; k <= nrBands; k++) + sbr->f_master[k] = (uint8_t)(sbr->f_master[k-1] + vDk[k-1]); + + sbr->N_master = (uint8_t)nrBands; + sbr->N_master = (min(sbr->N_master, 64)); + +#if 0 + printf("f_master[%d]: ", nrBands); + for (k = 0; k <= nrBands; k++) + { + printf("%d ", sbr->f_master[k]); + } + printf("\n"); +#endif + + return 0; +} + +/* + This function finds the number of bands using this formula: + bands * log(a1/a0)/log(2.0) + 0.5 +*/ +static int32_t find_bands(uint8_t warp, uint8_t bands, uint8_t a0, uint8_t a1) +{ +#ifdef FIXED_POINT + /* table with log2() values */ + static const real_t log2Table[65] = { + COEF_CONST(0.0), COEF_CONST(0.0), COEF_CONST(1.0000000000), COEF_CONST(1.5849625007), + COEF_CONST(2.0000000000), COEF_CONST(2.3219280949), COEF_CONST(2.5849625007), COEF_CONST(2.8073549221), + COEF_CONST(3.0000000000), COEF_CONST(3.1699250014), COEF_CONST(3.3219280949), COEF_CONST(3.4594316186), + COEF_CONST(3.5849625007), COEF_CONST(3.7004397181), COEF_CONST(3.8073549221), COEF_CONST(3.9068905956), + COEF_CONST(4.0000000000), COEF_CONST(4.0874628413), COEF_CONST(4.1699250014), COEF_CONST(4.2479275134), + COEF_CONST(4.3219280949), COEF_CONST(4.3923174228), COEF_CONST(4.4594316186), COEF_CONST(4.5235619561), + COEF_CONST(4.5849625007), COEF_CONST(4.6438561898), COEF_CONST(4.7004397181), COEF_CONST(4.7548875022), + COEF_CONST(4.8073549221), COEF_CONST(4.8579809951), COEF_CONST(4.9068905956), COEF_CONST(4.9541963104), + COEF_CONST(5.0000000000), COEF_CONST(5.0443941194), COEF_CONST(5.0874628413), COEF_CONST(5.1292830169), + COEF_CONST(5.1699250014), COEF_CONST(5.2094533656), COEF_CONST(5.2479275134), COEF_CONST(5.2854022189), + COEF_CONST(5.3219280949), COEF_CONST(5.3575520046), COEF_CONST(5.3923174228), COEF_CONST(5.4262647547), + COEF_CONST(5.4594316186), COEF_CONST(5.4918530963), COEF_CONST(5.5235619561), COEF_CONST(5.5545888517), + COEF_CONST(5.5849625007), COEF_CONST(5.6147098441), COEF_CONST(5.6438561898), COEF_CONST(5.6724253420), + COEF_CONST(5.7004397181), COEF_CONST(5.7279204546), COEF_CONST(5.7548875022), COEF_CONST(5.7813597135), + COEF_CONST(5.8073549221), COEF_CONST(5.8328900142), COEF_CONST(5.8579809951), COEF_CONST(5.8826430494), + COEF_CONST(5.9068905956), COEF_CONST(5.9307373376), COEF_CONST(5.9541963104), COEF_CONST(5.9772799235), + COEF_CONST(6.0) + }; + real_t r0 = log2Table[a0]; /* coef */ + real_t r1 = log2Table[a1]; /* coef */ + real_t r2 = (r1 - r0); /* coef */ + + if (warp) + r2 = MUL_C(r2, COEF_CONST(1.0/1.3)); + + /* convert r2 to real and then multiply and round */ + r2 = (r2 >> (COEF_BITS-REAL_BITS)) * bands + (1<<(REAL_BITS-1)); + + return (r2 >> REAL_BITS); +#else + real_t div = (real_t)log(2.0); + if (warp) div *= (real_t)1.3; + + return (int32_t)(bands * log((float)a1/(float)a0)/div + 0.5); +#endif +} + +static real_t find_initial_power(uint8_t bands, uint8_t a0, uint8_t a1) +{ +#ifdef FIXED_POINT + /* table with log() values */ + static const real_t logTable[65] = { + COEF_CONST(0.0), COEF_CONST(0.0), COEF_CONST(0.6931471806), COEF_CONST(1.0986122887), + COEF_CONST(1.3862943611), COEF_CONST(1.6094379124), COEF_CONST(1.7917594692), COEF_CONST(1.9459101491), + COEF_CONST(2.0794415417), COEF_CONST(2.1972245773), COEF_CONST(2.3025850930), COEF_CONST(2.3978952728), + COEF_CONST(2.4849066498), COEF_CONST(2.5649493575), COEF_CONST(2.6390573296), COEF_CONST(2.7080502011), + COEF_CONST(2.7725887222), COEF_CONST(2.8332133441), COEF_CONST(2.8903717579), COEF_CONST(2.9444389792), + COEF_CONST(2.9957322736), COEF_CONST(3.0445224377), COEF_CONST(3.0910424534), COEF_CONST(3.1354942159), + COEF_CONST(3.1780538303), COEF_CONST(3.2188758249), COEF_CONST(3.2580965380), COEF_CONST(3.2958368660), + COEF_CONST(3.3322045102), COEF_CONST(3.3672958300), COEF_CONST(3.4011973817), COEF_CONST(3.4339872045), + COEF_CONST(3.4657359028), COEF_CONST(3.4965075615), COEF_CONST(3.5263605246), COEF_CONST(3.5553480615), + COEF_CONST(3.5835189385), COEF_CONST(3.6109179126), COEF_CONST(3.6375861597), COEF_CONST(3.6635616461), + COEF_CONST(3.6888794541), COEF_CONST(3.7135720667), COEF_CONST(3.7376696183), COEF_CONST(3.7612001157), + COEF_CONST(3.7841896339), COEF_CONST(3.8066624898), COEF_CONST(3.8286413965), COEF_CONST(3.8501476017), + COEF_CONST(3.8712010109), COEF_CONST(3.8918202981), COEF_CONST(3.9120230054), COEF_CONST(3.9318256327), + COEF_CONST(3.9512437186), COEF_CONST(3.9702919136), COEF_CONST(3.9889840466), COEF_CONST(4.0073331852), + COEF_CONST(4.0253516907), COEF_CONST(4.0430512678), COEF_CONST(4.0604430105), COEF_CONST(4.0775374439), + COEF_CONST(4.0943445622), COEF_CONST(4.1108738642), COEF_CONST(4.1271343850), COEF_CONST(4.1431347264), + COEF_CONST(4.158883083) + }; + /* standard Taylor polynomial coefficients for exp(x) around 0 */ + /* a polynomial around x=1 is more precise, as most values are around 1.07, + but this is just fine already */ + static const real_t c1 = COEF_CONST(1.0); + static const real_t c2 = COEF_CONST(1.0/2.0); + static const real_t c3 = COEF_CONST(1.0/6.0); + static const real_t c4 = COEF_CONST(1.0/24.0); + + real_t r0 = logTable[a0]; /* coef */ + real_t r1 = logTable[a1]; /* coef */ + real_t r2 = (r1 - r0) / bands; /* coef */ + real_t rexp = c1 + MUL_C((c1 + MUL_C((c2 + MUL_C((c3 + MUL_C(c4,r2)), r2)), r2)), r2); + + return (rexp >> (COEF_BITS-REAL_BITS)); /* real */ +#else + return (real_t)pow((real_t)a1/(real_t)a0, 1.0/(real_t)bands); +#endif +} + +/* + version for bs_freq_scale > 0 +*/ +uint8_t master_frequency_table(sbr_info *sbr, uint8_t k0, uint8_t k2, + uint8_t bs_freq_scale, uint8_t bs_alter_scale) +{ + uint8_t k, bands, twoRegions; + uint8_t k1; + uint8_t nrBand0, nrBand1; + int32_t vDk0[64] = {0}, vDk1[64] = {0}; + int32_t vk0[64] = {0}, vk1[64] = {0}; + uint8_t temp1[] = { 6, 5, 4 }; + real_t q, qk; + int32_t A_1; +#ifdef FIXED_POINT + real_t rk2, rk0; +#endif + + /* mft only defined for k2 > k0 */ + if (k2 <= k0) + { + sbr->N_master = 0; + return 1; + } + + bands = temp1[bs_freq_scale-1]; + +#ifdef FIXED_POINT + rk0 = (real_t)k0 << REAL_BITS; + rk2 = (real_t)k2 << REAL_BITS; + if (rk2 > MUL_C(rk0, COEF_CONST(2.2449))) +#else + if ((float)k2/(float)k0 > 2.2449) +#endif + { + twoRegions = 1; + k1 = k0 << 1; + } else { + twoRegions = 0; + k1 = k2; + } + + nrBand0 = (uint8_t)(2 * find_bands(0, bands, k0, k1)); + nrBand0 = min(nrBand0, 63); + if (nrBand0 <= 0) + return 1; + + q = find_initial_power(nrBand0, k0, k1); +#ifdef FIXED_POINT + qk = (real_t)k0 << REAL_BITS; + //A_1 = (int32_t)((qk + REAL_CONST(0.5)) >> REAL_BITS); + A_1 = k0; +#else + qk = REAL_CONST(k0); + A_1 = (int32_t)(qk + .5); +#endif + for (k = 0; k <= nrBand0; k++) + { + int32_t A_0 = A_1; +#ifdef FIXED_POINT + qk = MUL_R(qk,q); + A_1 = (int32_t)((qk + REAL_CONST(0.5)) >> REAL_BITS); +#else + qk *= q; + A_1 = (int32_t)(qk + 0.5); +#endif + vDk0[k] = A_1 - A_0; + } + + /* needed? */ + qsort(vDk0, nrBand0, sizeof(vDk0[0]), longcmp); + + vk0[0] = k0; + for (k = 1; k <= nrBand0; k++) + { + vk0[k] = vk0[k-1] + vDk0[k-1]; + if (vDk0[k-1] == 0) + return 1; + } + + if (!twoRegions) + { + for (k = 0; k <= nrBand0; k++) + sbr->f_master[k] = (uint8_t) vk0[k]; + + sbr->N_master = nrBand0; + sbr->N_master = min(sbr->N_master, 64); + return 0; + } + + nrBand1 = (uint8_t)(2 * find_bands(1 /* warped */, bands, k1, k2)); + nrBand1 = min(nrBand1, 63); + + q = find_initial_power(nrBand1, k1, k2); +#ifdef FIXED_POINT + qk = (real_t)k1 << REAL_BITS; + //A_1 = (int32_t)((qk + REAL_CONST(0.5)) >> REAL_BITS); + A_1 = k1; +#else + qk = REAL_CONST(k1); + A_1 = (int32_t)(qk + .5); +#endif + for (k = 0; k <= nrBand1 - 1; k++) + { + int32_t A_0 = A_1; +#ifdef FIXED_POINT + qk = MUL_R(qk,q); + A_1 = (int32_t)((qk + REAL_CONST(0.5)) >> REAL_BITS); +#else + qk *= q; + A_1 = (int32_t)(qk + 0.5); +#endif + vDk1[k] = A_1 - A_0; + } + + if (vDk1[0] < vDk0[nrBand0 - 1]) + { + int32_t change; + + /* needed? */ + qsort(vDk1, nrBand1 + 1, sizeof(vDk1[0]), longcmp); + change = vDk0[nrBand0 - 1] - vDk1[0]; + vDk1[0] = vDk0[nrBand0 - 1]; + vDk1[nrBand1 - 1] = vDk1[nrBand1 - 1] - change; + } + + /* needed? */ + qsort(vDk1, nrBand1, sizeof(vDk1[0]), longcmp); + vk1[0] = k1; + for (k = 1; k <= nrBand1; k++) + { + vk1[k] = vk1[k-1] + vDk1[k-1]; + if (vDk1[k-1] == 0) + return 1; + } + + sbr->N_master = nrBand0 + nrBand1; + sbr->N_master = min(sbr->N_master, 64); + for (k = 0; k <= nrBand0; k++) + { + sbr->f_master[k] = (uint8_t) vk0[k]; + } + for (k = nrBand0 + 1; k <= sbr->N_master; k++) + { + sbr->f_master[k] = (uint8_t) vk1[k - nrBand0]; + } + +#if 0 + printf("f_master[%d]: ", sbr->N_master); + for (k = 0; k <= sbr->N_master; k++) + { + printf("%d ", sbr->f_master[k]); + } + printf("\n"); +#endif + + return 0; +} + +/* calculate the derived frequency border tables from f_master */ +uint8_t derived_frequency_table(sbr_info *sbr, uint8_t bs_xover_band, + uint8_t k2) +{ + uint8_t k, i; + uint32_t minus; + + /* The following relation shall be satisfied: bs_xover_band < N_Master */ + if (sbr->N_master <= bs_xover_band) + return 1; + + sbr->N_high = sbr->N_master - bs_xover_band; + sbr->N_low = (sbr->N_high>>1) + (sbr->N_high - ((sbr->N_high>>1)<<1)); + + sbr->n[0] = sbr->N_low; + sbr->n[1] = sbr->N_high; + + for (k = 0; k <= sbr->N_high; k++) + { + sbr->f_table_res[HI_RES][k] = sbr->f_master[k + bs_xover_band]; + } + + sbr->M = sbr->f_table_res[HI_RES][sbr->N_high] - sbr->f_table_res[HI_RES][0]; + sbr->kx = sbr->f_table_res[HI_RES][0]; + if (sbr->kx > 32) + return 1; + if (sbr->kx + sbr->M > 64) + return 1; + + minus = (sbr->N_high & 1) ? 1 : 0; + + for (k = 0; k <= sbr->N_low; k++) + { + if (k == 0) + i = 0; + else + i = (uint8_t)(2*k - minus); + sbr->f_table_res[LO_RES][k] = sbr->f_table_res[HI_RES][i]; + } + +#if 0 + printf("bs_freq_scale: %d\n", sbr->bs_freq_scale); + printf("bs_limiter_bands: %d\n", sbr->bs_limiter_bands); + printf("f_table_res[HI_RES][%d]: ", sbr->N_high); + for (k = 0; k <= sbr->N_high; k++) + { + printf("%d ", sbr->f_table_res[HI_RES][k]); + } + printf("\n"); +#endif +#if 0 + printf("f_table_res[LO_RES][%d]: ", sbr->N_low); + for (k = 0; k <= sbr->N_low; k++) + { + printf("%d ", sbr->f_table_res[LO_RES][k]); + } + printf("\n"); +#endif + + sbr->N_Q = 0; + if (sbr->bs_noise_bands == 0) + { + sbr->N_Q = 1; + } else { +#if 0 + sbr->N_Q = max(1, (int32_t)(sbr->bs_noise_bands*(log(k2/(float)sbr->kx)/log(2.0)) + 0.5)); +#else + sbr->N_Q = (uint8_t)(max(1, find_bands(0, sbr->bs_noise_bands, sbr->kx, k2))); +#endif + sbr->N_Q = min(5, sbr->N_Q); + } + + for (k = 0; k <= sbr->N_Q; k++) + { + if (k == 0) + { + i = 0; + } else { + /* i = i + (int32_t)((sbr->N_low - i)/(sbr->N_Q + 1 - k)); */ + i = i + (sbr->N_low - i)/(sbr->N_Q + 1 - k); + } + sbr->f_table_noise[k] = sbr->f_table_res[LO_RES][i]; + } + + /* build table for mapping k to g in hf patching */ + for (k = 0; k < 64; k++) + { + uint8_t g; + for (g = 0; g < sbr->N_Q; g++) + { + if ((sbr->f_table_noise[g] <= k) && + (k < sbr->f_table_noise[g+1])) + { + sbr->table_map_k_to_g[k] = g; + break; + } + } + } + +#if 0 + printf("f_table_noise[%d]: ", sbr->N_Q); + for (k = 0; k <= sbr->N_Q; k++) + { + printf("%d ", sbr->f_table_noise[k] - sbr->kx); + } + printf("\n"); +#endif + + return 0; +} + +/* TODO: blegh, ugly */ +/* Modified to calculate for all possible bs_limiter_bands always + * This reduces the number calls to this functions needed (now only on + * header reset) + */ +void limiter_frequency_table(sbr_info *sbr) +{ +#if 0 + static const real_t limiterBandsPerOctave[] = { REAL_CONST(1.2), + REAL_CONST(2), REAL_CONST(3) }; +#else + static const real_t limiterBandsCompare[] = { REAL_CONST(1.327152), + REAL_CONST(1.185093), REAL_CONST(1.119872) }; +#endif + uint8_t k, s; + int8_t nrLim; +#if 0 + real_t limBands; +#endif + + sbr->f_table_lim[0][0] = sbr->f_table_res[LO_RES][0] - sbr->kx; + sbr->f_table_lim[0][1] = sbr->f_table_res[LO_RES][sbr->N_low] - sbr->kx; + sbr->N_L[0] = 1; + +#if 0 + printf("f_table_lim[%d][%d]: ", 0, sbr->N_L[0]); + for (k = 0; k <= sbr->N_L[0]; k++) + { + printf("%d ", sbr->f_table_lim[0][k]); + } + printf("\n"); +#endif + + for (s = 1; s < 4; s++) + { + int32_t limTable[100 /*TODO*/] = {0}; + uint8_t patchBorders[64/*??*/] = {0}; + +#if 0 + limBands = limiterBandsPerOctave[s - 1]; +#endif + + patchBorders[0] = sbr->kx; + for (k = 1; k <= sbr->noPatches; k++) + { + patchBorders[k] = patchBorders[k-1] + sbr->patchNoSubbands[k-1]; + } + + for (k = 0; k <= sbr->N_low; k++) + { + limTable[k] = sbr->f_table_res[LO_RES][k]; + } + for (k = 1; k < sbr->noPatches; k++) + { + limTable[k+sbr->N_low] = patchBorders[k]; + } + + /* needed */ + qsort(limTable, sbr->noPatches + sbr->N_low, sizeof(limTable[0]), longcmp); + k = 1; + nrLim = sbr->noPatches + sbr->N_low - 1; + + if (nrLim < 0) // TODO: BIG FAT PROBLEM + return; + +restart: + if (k <= nrLim) + { + real_t nOctaves; + + if (limTable[k-1] != 0) +#if 0 + nOctaves = REAL_CONST(log((float)limTable[k]/(float)limTable[k-1])/log(2.0)); +#else +#ifdef FIXED_POINT + nOctaves = DIV_R((limTable[k]<noPatches; i++) + { + if (limTable[k] == patchBorders[i]) + found = 1; + } + if (found) + { + found2 = 0; + for (i = 0; i <= sbr->noPatches; i++) + { + if (limTable[k-1] == patchBorders[i]) + found2 = 1; + } + if (found2) + { + k++; + goto restart; + } else { + /* remove (k-1)th element */ + limTable[k-1] = sbr->f_table_res[LO_RES][sbr->N_low]; + qsort(limTable, sbr->noPatches + sbr->N_low, sizeof(limTable[0]), longcmp); + nrLim--; + goto restart; + } + } + } + /* remove kth element */ + limTable[k] = sbr->f_table_res[LO_RES][sbr->N_low]; + qsort(limTable, nrLim, sizeof(limTable[0]), longcmp); + nrLim--; + goto restart; + } else { + k++; + goto restart; + } + } + + sbr->N_L[s] = nrLim; + for (k = 0; k <= nrLim; k++) + { + sbr->f_table_lim[s][k] = limTable[k] - sbr->kx; + } + +#if 0 + printf("f_table_lim[%d][%d]: ", s, sbr->N_L[s]); + for (k = 0; k <= sbr->N_L[s]; k++) + { + printf("%d ", sbr->f_table_lim[s][k]); + } + printf("\n"); +#endif + } +} + +#endif diff --git a/Libraries/FAAD2/Files/libfaad/sbr_fbt.h b/Libraries/FAAD2/Files/libfaad/sbr_fbt.h new file mode 100644 index 000000000..ac2533526 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/sbr_fbt.h @@ -0,0 +1,52 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#ifndef __SBR_FBT_H__ +#define __SBR_FBT_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +uint8_t qmf_start_channel(uint8_t bs_start_freq, uint8_t bs_samplerate_mode, + uint32_t sample_rate); +uint8_t qmf_stop_channel(uint8_t bs_stop_freq, uint32_t sample_rate, + uint8_t k0); +uint8_t master_frequency_table_fs0(sbr_info *sbr, uint8_t k0, uint8_t k2, + uint8_t bs_alter_scale); +uint8_t master_frequency_table(sbr_info *sbr, uint8_t k0, uint8_t k2, + uint8_t bs_freq_scale, uint8_t bs_alter_scale); +uint8_t derived_frequency_table(sbr_info *sbr, uint8_t bs_xover_band, + uint8_t k2); +void limiter_frequency_table(sbr_info *sbr); + + +#ifdef __cplusplus +} +#endif +#endif + diff --git a/Libraries/FAAD2/Files/libfaad/sbr_hfadj.c b/Libraries/FAAD2/Files/libfaad/sbr_hfadj.c new file mode 100644 index 000000000..17d63f41c --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/sbr_hfadj.c @@ -0,0 +1,1720 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +/* High Frequency adjustment */ + +#include "common.h" +#include "structs.h" + +#ifdef SBR_DEC + +#include "sbr_syntax.h" +#include "sbr_hfadj.h" + +#include "sbr_noise.h" + + +/* static function declarations */ +static void estimate_current_envelope(sbr_info *sbr, sbr_hfadj_info *adj, + qmf_t Xsbr[MAX_NTSRHFG][64], uint8_t ch); +static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch); +#ifdef SBR_LOW_POWER +static void calc_gain_groups(sbr_info *sbr, sbr_hfadj_info *adj, real_t *deg, uint8_t ch); +static void aliasing_reduction(sbr_info *sbr, sbr_hfadj_info *adj, real_t *deg, uint8_t ch); +#endif +static void hf_assembly(sbr_info *sbr, sbr_hfadj_info *adj, qmf_t Xsbr[MAX_NTSRHFG][64], uint8_t ch); + + +void hf_adjustment(sbr_info *sbr, qmf_t Xsbr[MAX_NTSRHFG][64] +#ifdef SBR_LOW_POWER + ,real_t *deg /* aliasing degree */ +#endif + ,uint8_t ch) +{ + ALIGN sbr_hfadj_info adj = {{{0}}}; + + if (sbr->bs_frame_class[ch] == FIXFIX) + { + sbr->l_A[ch] = -1; + } else if (sbr->bs_frame_class[ch] == VARFIX) { + if (sbr->bs_pointer[ch] > 1) + sbr->l_A[ch] = -1; + else + sbr->l_A[ch] = sbr->bs_pointer[ch] - 1; + } else { + if (sbr->bs_pointer[ch] == 0) + sbr->l_A[ch] = -1; + else + sbr->l_A[ch] = sbr->L_E[ch] + 1 - sbr->bs_pointer[ch]; + } + + estimate_current_envelope(sbr, &adj, Xsbr, ch); + + calculate_gain(sbr, &adj, ch); + +#ifdef SBR_LOW_POWER + calc_gain_groups(sbr, &adj, deg, ch); + aliasing_reduction(sbr, &adj, deg, ch); +#endif + + hf_assembly(sbr, &adj, Xsbr, ch); +} + +static uint8_t get_S_mapped(sbr_info *sbr, uint8_t ch, uint8_t l, uint8_t current_band) +{ + if (sbr->f[ch][l] == HI_RES) + { + /* in case of using f_table_high we just have 1 to 1 mapping + * from bs_add_harmonic[l][k] + */ + if ((l >= sbr->l_A[ch]) || + (sbr->bs_add_harmonic_prev[ch][current_band] && sbr->bs_add_harmonic_flag_prev[ch])) + { + return sbr->bs_add_harmonic[ch][current_band]; + } + } else { + uint8_t b, lb, ub; + + /* in case of f_table_low we check if any of the HI_RES bands + * within this LO_RES band has bs_add_harmonic[l][k] turned on + * (note that borders in the LO_RES table are also present in + * the HI_RES table) + */ + + /* find first HI_RES band in current LO_RES band */ + lb = 2*current_band - ((sbr->N_high & 1) ? 1 : 0); + /* find first HI_RES band in next LO_RES band */ + ub = 2*(current_band+1) - ((sbr->N_high & 1) ? 1 : 0); + + /* check all HI_RES bands in current LO_RES band for sinusoid */ + for (b = lb; b < ub; b++) + { + if ((l >= sbr->l_A[ch]) || + (sbr->bs_add_harmonic_prev[ch][b] && sbr->bs_add_harmonic_flag_prev[ch])) + { + if (sbr->bs_add_harmonic[ch][b] == 1) + return 1; + } + } + } + + return 0; +} + +static void estimate_current_envelope(sbr_info *sbr, sbr_hfadj_info *adj, + qmf_t Xsbr[MAX_NTSRHFG][64], uint8_t ch) +{ + uint8_t m, l, j, k, k_l, k_h, p; + real_t nrg, div; + + if (sbr->bs_interpol_freq == 1) + { + for (l = 0; l < sbr->L_E[ch]; l++) + { + uint8_t i, l_i, u_i; + + l_i = sbr->t_E[ch][l]; + u_i = sbr->t_E[ch][l+1]; + + div = (real_t)(u_i - l_i); + + for (m = 0; m < sbr->M; m++) + { + nrg = 0; + + for (i = l_i + sbr->tHFAdj; i < u_i + sbr->tHFAdj; i++) + { +#ifdef FIXED_POINT +#ifdef SBR_LOW_POWER + nrg += ((QMF_RE(Xsbr[i][m + sbr->kx])+(1<<(REAL_BITS-1)))>>REAL_BITS)*((QMF_RE(Xsbr[i][m + sbr->kx])+(1<<(REAL_BITS-1)))>>REAL_BITS); +#else + nrg += ((QMF_RE(Xsbr[i][m + sbr->kx])+(1<<(REAL_BITS-1)))>>REAL_BITS)*((QMF_RE(Xsbr[i][m + sbr->kx])+(1<<(REAL_BITS-1)))>>REAL_BITS) + + ((QMF_IM(Xsbr[i][m + sbr->kx])+(1<<(REAL_BITS-1)))>>REAL_BITS)*((QMF_IM(Xsbr[i][m + sbr->kx])+(1<<(REAL_BITS-1)))>>REAL_BITS); +#endif +#else + nrg += MUL_R(QMF_RE(Xsbr[i][m + sbr->kx]), QMF_RE(Xsbr[i][m + sbr->kx])) +#ifndef SBR_LOW_POWER + + MUL_R(QMF_IM(Xsbr[i][m + sbr->kx]), QMF_IM(Xsbr[i][m + sbr->kx])) +#endif + ; +#endif + } + + sbr->E_curr[ch][m][l] = nrg / div; +#ifdef SBR_LOW_POWER +#ifdef FIXED_POINT + sbr->E_curr[ch][m][l] <<= 1; +#else + sbr->E_curr[ch][m][l] *= 2; +#endif +#endif + } + } + } else { + for (l = 0; l < sbr->L_E[ch]; l++) + { + for (p = 0; p < sbr->n[sbr->f[ch][l]]; p++) + { + k_l = sbr->f_table_res[sbr->f[ch][l]][p]; + k_h = sbr->f_table_res[sbr->f[ch][l]][p+1]; + + for (k = k_l; k < k_h; k++) + { + uint8_t i, l_i, u_i; + nrg = 0; + + l_i = sbr->t_E[ch][l]; + u_i = sbr->t_E[ch][l+1]; + + div = (real_t)((u_i - l_i)*(k_h - k_l)); + + for (i = l_i + sbr->tHFAdj; i < u_i + sbr->tHFAdj; i++) + { + for (j = k_l; j < k_h; j++) + { +#ifdef FIXED_POINT +#ifdef SBR_LOW_POWER + nrg += ((QMF_RE(Xsbr[i][j])+(1<<(REAL_BITS-1)))>>REAL_BITS)*((QMF_RE(Xsbr[i][j])+(1<<(REAL_BITS-1)))>>REAL_BITS); +#else + nrg += ((QMF_RE(Xsbr[i][j])+(1<<(REAL_BITS-1)))>>REAL_BITS)*((QMF_RE(Xsbr[i][j])+(1<<(REAL_BITS-1)))>>REAL_BITS) + + ((QMF_IM(Xsbr[i][j])+(1<<(REAL_BITS-1)))>>REAL_BITS)*((QMF_IM(Xsbr[i][j])+(1<<(REAL_BITS-1)))>>REAL_BITS); +#endif +#else + nrg += MUL_R(QMF_RE(Xsbr[i][j]), QMF_RE(Xsbr[i][j])) +#ifndef SBR_LOW_POWER + + MUL_R(QMF_IM(Xsbr[i][j]), QMF_IM(Xsbr[i][j])) +#endif + ; +#endif + } + } + + sbr->E_curr[ch][k - sbr->kx][l] = nrg / div; +#ifdef SBR_LOW_POWER +#ifdef FIXED_POINT + sbr->E_curr[ch][k - sbr->kx][l] <<= 1; +#else + sbr->E_curr[ch][k - sbr->kx][l] *= 2; +#endif +#endif + } + } + } + } +} + +#ifdef FIXED_POINT +#define EPS (1) /* smallest number available in fixed point */ +#else +#define EPS (1e-12) +#endif + + + +#ifdef FIXED_POINT + +/* log2 values of [0..63] */ +static const real_t log2_int_tab[] = { + LOG2_MIN_INF, REAL_CONST(0.000000000000000), REAL_CONST(1.000000000000000), REAL_CONST(1.584962500721156), + REAL_CONST(2.000000000000000), REAL_CONST(2.321928094887362), REAL_CONST(2.584962500721156), REAL_CONST(2.807354922057604), + REAL_CONST(3.000000000000000), REAL_CONST(3.169925001442313), REAL_CONST(3.321928094887363), REAL_CONST(3.459431618637297), + REAL_CONST(3.584962500721156), REAL_CONST(3.700439718141092), REAL_CONST(3.807354922057604), REAL_CONST(3.906890595608519), + REAL_CONST(4.000000000000000), REAL_CONST(4.087462841250339), REAL_CONST(4.169925001442312), REAL_CONST(4.247927513443585), + REAL_CONST(4.321928094887362), REAL_CONST(4.392317422778761), REAL_CONST(4.459431618637297), REAL_CONST(4.523561956057013), + REAL_CONST(4.584962500721156), REAL_CONST(4.643856189774724), REAL_CONST(4.700439718141093), REAL_CONST(4.754887502163468), + REAL_CONST(4.807354922057604), REAL_CONST(4.857980995127572), REAL_CONST(4.906890595608519), REAL_CONST(4.954196310386875), + REAL_CONST(5.000000000000000), REAL_CONST(5.044394119358453), REAL_CONST(5.087462841250340), REAL_CONST(5.129283016944966), + REAL_CONST(5.169925001442312), REAL_CONST(5.209453365628949), REAL_CONST(5.247927513443585), REAL_CONST(5.285402218862248), + REAL_CONST(5.321928094887363), REAL_CONST(5.357552004618084), REAL_CONST(5.392317422778761), REAL_CONST(5.426264754702098), + REAL_CONST(5.459431618637297), REAL_CONST(5.491853096329675), REAL_CONST(5.523561956057013), REAL_CONST(5.554588851677637), + REAL_CONST(5.584962500721156), REAL_CONST(5.614709844115208), REAL_CONST(5.643856189774724), REAL_CONST(5.672425341971495), + REAL_CONST(5.700439718141093), REAL_CONST(5.727920454563200), REAL_CONST(5.754887502163469), REAL_CONST(5.781359713524660), + REAL_CONST(5.807354922057605), REAL_CONST(5.832890014164742), REAL_CONST(5.857980995127572), REAL_CONST(5.882643049361842), + REAL_CONST(5.906890595608518), REAL_CONST(5.930737337562887), REAL_CONST(5.954196310386876), REAL_CONST(5.977279923499916) +}; + +static const real_t pan_log2_tab[] = { + REAL_CONST(1.000000000000000), REAL_CONST(0.584962500721156), REAL_CONST(0.321928094887362), REAL_CONST(0.169925001442312), REAL_CONST(0.087462841250339), + REAL_CONST(0.044394119358453), REAL_CONST(0.022367813028455), REAL_CONST(0.011227255423254), REAL_CONST(0.005624549193878), REAL_CONST(0.002815015607054), + REAL_CONST(0.001408194392808), REAL_CONST(0.000704269011247), REAL_CONST(0.000352177480301), REAL_CONST(0.000176099486443), REAL_CONST(0.000088052430122), + REAL_CONST(0.000044026886827), REAL_CONST(0.000022013611360), REAL_CONST(0.000011006847667) +}; + +static real_t find_log2_E(sbr_info *sbr, uint8_t k, uint8_t l, uint8_t ch) +{ + /* check for coupled energy/noise data */ + if (sbr->bs_coupling == 1) + { + uint8_t amp0 = (sbr->amp_res[0]) ? 0 : 1; + uint8_t amp1 = (sbr->amp_res[1]) ? 0 : 1; + real_t tmp = (7 << REAL_BITS) + (sbr->E[0][k][l] << (REAL_BITS-amp0)); + real_t pan; + + /* E[1] should always be even so shifting is OK */ + uint8_t E = sbr->E[1][k][l] >> amp1; + + if (ch == 0) + { + if (E > 12) + { + /* negative */ + pan = pan_log2_tab[-12 + E]; + } else { + /* positive */ + pan = pan_log2_tab[12 - E] + ((12 - E)<amp_res[ch]) ? 0 : 1; + + return (6 << REAL_BITS) + (sbr->E[ch][k][l] << (REAL_BITS-amp)); + } +} + +static real_t find_log2_Q(sbr_info *sbr, uint8_t k, uint8_t l, uint8_t ch) +{ + /* check for coupled energy/noise data */ + if (sbr->bs_coupling == 1) + { + real_t tmp = (7 << REAL_BITS) - (sbr->Q[0][k][l] << REAL_BITS); + real_t pan; + + uint8_t Q = sbr->Q[1][k][l]; + + if (ch == 0) + { + if (Q > 12) + { + /* negative */ + pan = pan_log2_tab[-12 + Q]; + } else { + /* positive */ + pan = pan_log2_tab[12 - Q] + ((12 - Q)<Q[ch][k][l] << REAL_BITS); + } +} + +static const real_t log_Qplus1_pan[31][13] = { + { REAL_CONST(0.044383447617292), REAL_CONST(0.169768601655960), REAL_CONST(0.583090126514435), REAL_CONST(1.570089221000671), REAL_CONST(3.092446088790894), REAL_CONST(4.733354568481445), REAL_CONST(6.022367954254150), REAL_CONST(6.692092418670654), REAL_CONST(6.924463272094727), REAL_CONST(6.989034175872803), REAL_CONST(7.005646705627441), REAL_CONST(7.009829998016357), REAL_CONST(7.010877609252930) }, + { REAL_CONST(0.022362394258380), REAL_CONST(0.087379962205887), REAL_CONST(0.320804953575134), REAL_CONST(0.988859415054321), REAL_CONST(2.252387046813965), REAL_CONST(3.786596298217773), REAL_CONST(5.044394016265869), REAL_CONST(5.705977916717529), REAL_CONST(5.936291694641113), REAL_CONST(6.000346660614014), REAL_CONST(6.016829967498779), REAL_CONST(6.020981311798096), REAL_CONST(6.022020816802979) }, + { REAL_CONST(0.011224525049329), REAL_CONST(0.044351425021887), REAL_CONST(0.169301137328148), REAL_CONST(0.577544987201691), REAL_CONST(1.527246952056885), REAL_CONST(2.887525320053101), REAL_CONST(4.087462902069092), REAL_CONST(4.733354568481445), REAL_CONST(4.959661006927490), REAL_CONST(5.022709369659424), REAL_CONST(5.038940429687500), REAL_CONST(5.043028831481934), REAL_CONST(5.044052600860596) }, + { REAL_CONST(0.005623178556561), REAL_CONST(0.022346137091517), REAL_CONST(0.087132595479488), REAL_CONST(0.317482173442841), REAL_CONST(0.956931233406067), REAL_CONST(2.070389270782471), REAL_CONST(3.169924974441528), REAL_CONST(3.786596298217773), REAL_CONST(4.005294322967529), REAL_CONST(4.066420555114746), REAL_CONST(4.082170009613037), REAL_CONST(4.086137294769287), REAL_CONST(4.087131500244141) }, + { REAL_CONST(0.002814328996465), REAL_CONST(0.011216334067285), REAL_CONST(0.044224001467228), REAL_CONST(0.167456731200218), REAL_CONST(0.556393325328827), REAL_CONST(1.378511548042297), REAL_CONST(2.321928024291992), REAL_CONST(2.887525320053101), REAL_CONST(3.092446088790894), REAL_CONST(3.150059700012207), REAL_CONST(3.164926528930664), REAL_CONST(3.168673276901245), REAL_CONST(3.169611930847168) }, + { REAL_CONST(0.001407850766554), REAL_CONST(0.005619067233056), REAL_CONST(0.022281449288130), REAL_CONST(0.086156636476517), REAL_CONST(0.304854571819305), REAL_CONST(0.847996890544891), REAL_CONST(1.584962487220764), REAL_CONST(2.070389270782471), REAL_CONST(2.252387046813965), REAL_CONST(2.304061651229858), REAL_CONST(2.317430257797241), REAL_CONST(2.320801734924316), REAL_CONST(2.321646213531494) }, + { REAL_CONST(0.000704097095877), REAL_CONST(0.002812269143760), REAL_CONST(0.011183738708496), REAL_CONST(0.043721374124289), REAL_CONST(0.160464659333229), REAL_CONST(0.485426813364029), REAL_CONST(1.000000000000000), REAL_CONST(1.378511548042297), REAL_CONST(1.527246952056885), REAL_CONST(1.570089221000671), REAL_CONST(1.581215262413025), REAL_CONST(1.584023833274841), REAL_CONST(1.584727644920349) }, + { REAL_CONST(0.000352177477907), REAL_CONST(0.001406819908880), REAL_CONST(0.005602621007711), REAL_CONST(0.022026389837265), REAL_CONST(0.082462236285210), REAL_CONST(0.263034462928772), REAL_CONST(0.584962487220764), REAL_CONST(0.847996890544891), REAL_CONST(0.956931233406067), REAL_CONST(0.988859415054321), REAL_CONST(0.997190535068512), REAL_CONST(0.999296069145203), REAL_CONST(0.999823868274689) }, + { REAL_CONST(0.000176099492819), REAL_CONST(0.000703581434209), REAL_CONST(0.002804030198604), REAL_CONST(0.011055230163038), REAL_CONST(0.041820213198662), REAL_CONST(0.137503549456596), REAL_CONST(0.321928083896637), REAL_CONST(0.485426813364029), REAL_CONST(0.556393325328827), REAL_CONST(0.577544987201691), REAL_CONST(0.583090126514435), REAL_CONST(0.584493279457092), REAL_CONST(0.584845066070557) }, + { REAL_CONST(0.000088052431238), REAL_CONST(0.000351833587047), REAL_CONST(0.001402696361765), REAL_CONST(0.005538204684854), REAL_CONST(0.021061634644866), REAL_CONST(0.070389263331890), REAL_CONST(0.169925004243851), REAL_CONST(0.263034462928772), REAL_CONST(0.304854571819305), REAL_CONST(0.317482173442841), REAL_CONST(0.320804953575134), REAL_CONST(0.321646571159363), REAL_CONST(0.321857661008835) }, + { REAL_CONST(0.000044026888645), REAL_CONST(0.000175927518285), REAL_CONST(0.000701518612914), REAL_CONST(0.002771759871393), REAL_CONST(0.010569252073765), REAL_CONST(0.035623874515295), REAL_CONST(0.087462842464447), REAL_CONST(0.137503549456596), REAL_CONST(0.160464659333229), REAL_CONST(0.167456731200218), REAL_CONST(0.169301137328148), REAL_CONST(0.169768601655960), REAL_CONST(0.169885858893394) }, + { REAL_CONST(0.000022013611670), REAL_CONST(0.000088052431238), REAL_CONST(0.000350801943569), REAL_CONST(0.001386545598507), REAL_CONST(0.005294219125062), REAL_CONST(0.017921976745129), REAL_CONST(0.044394120573997), REAL_CONST(0.070389263331890), REAL_CONST(0.082462236285210), REAL_CONST(0.086156636476517), REAL_CONST(0.087132595479488), REAL_CONST(0.087379962205887), REAL_CONST(0.087442122399807) }, + { REAL_CONST(0.000011006847672), REAL_CONST(0.000044026888645), REAL_CONST(0.000175411638338), REAL_CONST(0.000693439331371), REAL_CONST(0.002649537986144), REAL_CONST(0.008988817222416), REAL_CONST(0.022367812693119), REAL_CONST(0.035623874515295), REAL_CONST(0.041820213198662), REAL_CONST(0.043721374124289), REAL_CONST(0.044224001467228), REAL_CONST(0.044351425021887), REAL_CONST(0.044383447617292) }, + { REAL_CONST(0.000005503434295), REAL_CONST(0.000022013611670), REAL_CONST(0.000087708482170), REAL_CONST(0.000346675369656), REAL_CONST(0.001325377263129), REAL_CONST(0.004501323681325), REAL_CONST(0.011227255687118), REAL_CONST(0.017921976745129), REAL_CONST(0.021061634644866), REAL_CONST(0.022026389837265), REAL_CONST(0.022281449288130), REAL_CONST(0.022346137091517), REAL_CONST(0.022362394258380) }, + { REAL_CONST(0.000002751719876), REAL_CONST(0.000011006847672), REAL_CONST(0.000043854910473), REAL_CONST(0.000173348103999), REAL_CONST(0.000662840844598), REAL_CONST(0.002252417383716), REAL_CONST(0.005624548997730), REAL_CONST(0.008988817222416), REAL_CONST(0.010569252073765), REAL_CONST(0.011055230163038), REAL_CONST(0.011183738708496), REAL_CONST(0.011216334067285), REAL_CONST(0.011224525049329) }, + { REAL_CONST(0.000001375860506), REAL_CONST(0.000005503434295), REAL_CONST(0.000022013611670), REAL_CONST(0.000086676649516), REAL_CONST(0.000331544462824), REAL_CONST(0.001126734190620), REAL_CONST(0.002815015614033), REAL_CONST(0.004501323681325), REAL_CONST(0.005294219125062), REAL_CONST(0.005538204684854), REAL_CONST(0.005602621007711), REAL_CONST(0.005619067233056), REAL_CONST(0.005623178556561) }, + { REAL_CONST(0.000000687930424), REAL_CONST(0.000002751719876), REAL_CONST(0.000011006847672), REAL_CONST(0.000043338975956), REAL_CONST(0.000165781748365), REAL_CONST(0.000563477107789), REAL_CONST(0.001408194424585), REAL_CONST(0.002252417383716), REAL_CONST(0.002649537986144), REAL_CONST(0.002771759871393), REAL_CONST(0.002804030198604), REAL_CONST(0.002812269143760), REAL_CONST(0.002814328996465) }, + { REAL_CONST(0.000000343965269), REAL_CONST(0.000001375860506), REAL_CONST(0.000005503434295), REAL_CONST(0.000021669651687), REAL_CONST(0.000082893253420), REAL_CONST(0.000281680084299), REAL_CONST(0.000704268983100), REAL_CONST(0.001126734190620), REAL_CONST(0.001325377263129), REAL_CONST(0.001386545598507), REAL_CONST(0.001402696361765), REAL_CONST(0.001406819908880), REAL_CONST(0.001407850766554) }, + { REAL_CONST(0.000000171982634), REAL_CONST(0.000000687930424), REAL_CONST(0.000002751719876), REAL_CONST(0.000010834866771), REAL_CONST(0.000041447223339), REAL_CONST(0.000140846910654), REAL_CONST(0.000352177477907), REAL_CONST(0.000563477107789), REAL_CONST(0.000662840844598), REAL_CONST(0.000693439331371), REAL_CONST(0.000701518612914), REAL_CONST(0.000703581434209), REAL_CONST(0.000704097095877) }, + { REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000001375860506), REAL_CONST(0.000005503434295), REAL_CONST(0.000020637769921), REAL_CONST(0.000070511166996), REAL_CONST(0.000176099492819), REAL_CONST(0.000281680084299), REAL_CONST(0.000331544462824), REAL_CONST(0.000346675369656), REAL_CONST(0.000350801943569), REAL_CONST(0.000351833587047), REAL_CONST(0.000352177477907) }, + { REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000687930424), REAL_CONST(0.000002751719876), REAL_CONST(0.000010318922250), REAL_CONST(0.000035256012779), REAL_CONST(0.000088052431238), REAL_CONST(0.000140846910654), REAL_CONST(0.000165781748365), REAL_CONST(0.000173348103999), REAL_CONST(0.000175411638338), REAL_CONST(0.000175927518285), REAL_CONST(0.000176099492819) }, + { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000001375860506), REAL_CONST(0.000005159470220), REAL_CONST(0.000017542124624), REAL_CONST(0.000044026888645), REAL_CONST(0.000070511166996), REAL_CONST(0.000082893253420), REAL_CONST(0.000086676649516), REAL_CONST(0.000087708482170), REAL_CONST(0.000088052431238), REAL_CONST(0.000088052431238) }, + { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000687930424), REAL_CONST(0.000002579737384), REAL_CONST(0.000008771088687), REAL_CONST(0.000022013611670), REAL_CONST(0.000035256012779), REAL_CONST(0.000041447223339), REAL_CONST(0.000043338975956), REAL_CONST(0.000043854910473), REAL_CONST(0.000044026888645), REAL_CONST(0.000044026888645) }, + { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000001375860506), REAL_CONST(0.000004471542070), REAL_CONST(0.000011006847672), REAL_CONST(0.000017542124624), REAL_CONST(0.000020637769921), REAL_CONST(0.000021669651687), REAL_CONST(0.000022013611670), REAL_CONST(0.000022013611670), REAL_CONST(0.000022013611670) }, + { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000687930424), REAL_CONST(0.000002235772627), REAL_CONST(0.000005503434295), REAL_CONST(0.000008771088687), REAL_CONST(0.000010318922250), REAL_CONST(0.000010834866771), REAL_CONST(0.000011006847672), REAL_CONST(0.000011006847672), REAL_CONST(0.000011006847672) }, + { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000001031895522), REAL_CONST(0.000002751719876), REAL_CONST(0.000004471542070), REAL_CONST(0.000005159470220), REAL_CONST(0.000005503434295), REAL_CONST(0.000005503434295), REAL_CONST(0.000005503434295), REAL_CONST(0.000005503434295) }, + { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000515947875), REAL_CONST(0.000001375860506), REAL_CONST(0.000002235772627), REAL_CONST(0.000002579737384), REAL_CONST(0.000002751719876), REAL_CONST(0.000002751719876), REAL_CONST(0.000002751719876), REAL_CONST(0.000002751719876) }, + { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000000687930424), REAL_CONST(0.000001031895522), REAL_CONST(0.000001375860506), REAL_CONST(0.000001375860506), REAL_CONST(0.000001375860506), REAL_CONST(0.000001375860506), REAL_CONST(0.000001375860506) }, + { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000343965269), REAL_CONST(0.000000515947875), REAL_CONST(0.000000687930424), REAL_CONST(0.000000687930424), REAL_CONST(0.000000687930424), REAL_CONST(0.000000687930424), REAL_CONST(0.000000687930424) }, + { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269) }, + { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634) } +}; + +static const real_t log_Qplus1[31] = { + REAL_CONST(6.022367813028454), REAL_CONST(5.044394119358453), REAL_CONST(4.087462841250339), + REAL_CONST(3.169925001442313), REAL_CONST(2.321928094887362), REAL_CONST(1.584962500721156), + REAL_CONST(1.000000000000000), REAL_CONST(0.584962500721156), REAL_CONST(0.321928094887362), + REAL_CONST(0.169925001442312), REAL_CONST(0.087462841250339), REAL_CONST(0.044394119358453), + REAL_CONST(0.022367813028455), REAL_CONST(0.011227255423254), REAL_CONST(0.005624549193878), + REAL_CONST(0.002815015607054), REAL_CONST(0.001408194392808), REAL_CONST(0.000704269011247), + REAL_CONST(0.000352177480301), REAL_CONST(0.000176099486443), REAL_CONST(0.000088052430122), + REAL_CONST(0.000044026886827), REAL_CONST(0.000022013611360), REAL_CONST(0.000011006847667), + REAL_CONST(0.000005503434331), REAL_CONST(0.000002751719790), REAL_CONST(0.000001375860551), + REAL_CONST(0.000000687930439), REAL_CONST(0.000000343965261), REAL_CONST(0.000000171982641), + REAL_CONST(0.000000000000000) +}; + +static real_t find_log2_Qplus1(sbr_info *sbr, uint8_t k, uint8_t l, uint8_t ch) +{ + /* check for coupled energy/noise data */ + if (sbr->bs_coupling == 1) + { + if ((sbr->Q[0][k][l] >= 0) && (sbr->Q[0][k][l] <= 30) && + (sbr->Q[1][k][l] >= 0) && (sbr->Q[1][k][l] <= 24)) + { + if (ch == 0) + { + return log_Qplus1_pan[sbr->Q[0][k][l]][sbr->Q[1][k][l] >> 1]; + } else { + return log_Qplus1_pan[sbr->Q[0][k][l]][12 - (sbr->Q[1][k][l] >> 1)]; + } + } else { + return 0; + } + } else { + if (sbr->Q[ch][k][l] >= 0 && sbr->Q[ch][k][l] <= 30) + { + return log_Qplus1[sbr->Q[ch][k][l]]; + } else { + return 0; + } + } +} + +static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch) +{ + /* log2 values of limiter gains */ + static real_t limGain[] = { + REAL_CONST(-1.0), REAL_CONST(0.0), REAL_CONST(1.0), REAL_CONST(33.219) + }; + uint8_t m, l, k; + + uint8_t current_t_noise_band = 0; + uint8_t S_mapped; + + ALIGN real_t Q_M_lim[MAX_M]; + ALIGN real_t G_lim[MAX_M]; + ALIGN real_t G_boost; + ALIGN real_t S_M[MAX_M]; + + + for (l = 0; l < sbr->L_E[ch]; l++) + { + uint8_t current_f_noise_band = 0; + uint8_t current_res_band = 0; + uint8_t current_res_band2 = 0; + uint8_t current_hi_res_band = 0; + + real_t delta = (l == sbr->l_A[ch] || l == sbr->prevEnvIsShort[ch]) ? 0 : 1; + + S_mapped = get_S_mapped(sbr, ch, l, current_res_band2); + + if (sbr->t_E[ch][l+1] > sbr->t_Q[ch][current_t_noise_band+1]) + { + current_t_noise_band++; + } + + for (k = 0; k < sbr->N_L[sbr->bs_limiter_bands]; k++) + { + real_t Q_M = 0; + real_t G_max; + real_t den = 0; + real_t acc1 = 0; + real_t acc2 = 0; + uint8_t current_res_band_size = 0; + uint8_t Q_M_size = 0; + + uint8_t ml1, ml2; + + /* bounds of current limiter bands */ + ml1 = sbr->f_table_lim[sbr->bs_limiter_bands][k]; + ml2 = sbr->f_table_lim[sbr->bs_limiter_bands][k+1]; + + + /* calculate the accumulated E_orig and E_curr over the limiter band */ + for (m = ml1; m < ml2; m++) + { + if ((m + sbr->kx) < sbr->f_table_res[sbr->f[ch][l]][current_res_band+1]) + { + current_res_band_size++; + } else { + acc1 += pow2_int(-REAL_CONST(10) + log2_int_tab[current_res_band_size] + find_log2_E(sbr, current_res_band, l, ch)); + + current_res_band++; + current_res_band_size = 1; + } + + acc2 += sbr->E_curr[ch][m][l]; + } + acc1 += pow2_int(-REAL_CONST(10) + log2_int_tab[current_res_band_size] + find_log2_E(sbr, current_res_band, l, ch)); + + + if (acc1 == 0) + acc1 = LOG2_MIN_INF; + else + acc1 = log2_int(acc1); + + + /* calculate the maximum gain */ + /* ratio of the energy of the original signal and the energy + * of the HF generated signal + */ + G_max = acc1 - log2_int(acc2) + limGain[sbr->bs_limiter_gains]; + G_max = min(G_max, limGain[3]); + + + for (m = ml1; m < ml2; m++) + { + real_t G; + real_t E_curr, E_orig; + real_t Q_orig, Q_orig_plus1; + uint8_t S_index_mapped; + + + /* check if m is on a noise band border */ + if ((m + sbr->kx) == sbr->f_table_noise[current_f_noise_band+1]) + { + /* step to next noise band */ + current_f_noise_band++; + } + + + /* check if m is on a resolution band border */ + if ((m + sbr->kx) == sbr->f_table_res[sbr->f[ch][l]][current_res_band2+1]) + { + /* accumulate a whole range of equal Q_Ms */ + if (Q_M_size > 0) + den += pow2_int(log2_int_tab[Q_M_size] + Q_M); + Q_M_size = 0; + + /* step to next resolution band */ + current_res_band2++; + + /* if we move to a new resolution band, we should check if we are + * going to add a sinusoid in this band + */ + S_mapped = get_S_mapped(sbr, ch, l, current_res_band2); + } + + + /* check if m is on a HI_RES band border */ + if ((m + sbr->kx) == sbr->f_table_res[HI_RES][current_hi_res_band+1]) + { + /* step to next HI_RES band */ + current_hi_res_band++; + } + + + /* find S_index_mapped + * S_index_mapped can only be 1 for the m in the middle of the + * current HI_RES band + */ + S_index_mapped = 0; + if ((l >= sbr->l_A[ch]) || + (sbr->bs_add_harmonic_prev[ch][current_hi_res_band] && sbr->bs_add_harmonic_flag_prev[ch])) + { + /* find the middle subband of the HI_RES frequency band */ + if ((m + sbr->kx) == (sbr->f_table_res[HI_RES][current_hi_res_band+1] + sbr->f_table_res[HI_RES][current_hi_res_band]) >> 1) + S_index_mapped = sbr->bs_add_harmonic[ch][current_hi_res_band]; + } + + + /* find bitstream parameters */ + if (sbr->E_curr[ch][m][l] == 0) + E_curr = LOG2_MIN_INF; + else + E_curr = log2_int(sbr->E_curr[ch][m][l]); + E_orig = -REAL_CONST(10) + find_log2_E(sbr, current_res_band2, l, ch); + + + Q_orig = find_log2_Q(sbr, current_f_noise_band, current_t_noise_band, ch); + Q_orig_plus1 = find_log2_Qplus1(sbr, current_f_noise_band, current_t_noise_band, ch); + + + /* Q_M only depends on E_orig and Q_div2: + * since N_Q <= N_Low <= N_High we only need to recalculate Q_M on + * a change of current res band (HI or LO) + */ + Q_M = E_orig + Q_orig - Q_orig_plus1; + + + /* S_M only depends on E_orig, Q_div and S_index_mapped: + * S_index_mapped can only be non-zero once per HI_RES band + */ + if (S_index_mapped == 0) + { + S_M[m] = LOG2_MIN_INF; /* -inf */ + } else { + S_M[m] = E_orig - Q_orig_plus1; + + /* accumulate sinusoid part of the total energy */ + den += pow2_int(S_M[m]); + } + + + /* calculate gain */ + /* ratio of the energy of the original signal and the energy + * of the HF generated signal + */ + /* E_curr here is officially E_curr+1 so the log2() of that can never be < 0 */ + /* scaled by -10 */ + G = E_orig - max(-REAL_CONST(10), E_curr); + if ((S_mapped == 0) && (delta == 1)) + { + /* G = G * 1/(1+Q) */ + G -= Q_orig_plus1; + } else if (S_mapped == 1) { + /* G = G * Q/(1+Q) */ + G += Q_orig - Q_orig_plus1; + } + + + /* limit the additional noise energy level */ + /* and apply the limiter */ + if (G_max > G) + { + Q_M_lim[m] = Q_M; + G_lim[m] = G; + + if ((S_index_mapped == 0) && (l != sbr->l_A[ch])) + { + Q_M_size++; + } + } else { + /* G > G_max */ + Q_M_lim[m] = Q_M + G_max - G; + G_lim[m] = G_max; + + /* accumulate limited Q_M */ + if ((S_index_mapped == 0) && (l != sbr->l_A[ch])) + { + den += pow2_int(Q_M_lim[m]); + } + } + + + /* accumulate the total energy */ + /* E_curr changes for every m so we do need to accumulate every m */ + den += pow2_int(E_curr + G_lim[m]); + } + + /* accumulate last range of equal Q_Ms */ + if (Q_M_size > 0) + { + den += pow2_int(log2_int_tab[Q_M_size] + Q_M); + } + + + /* calculate the final gain */ + /* G_boost: [0..2.51188643] */ + G_boost = acc1 - log2_int(den /*+ EPS*/); + G_boost = min(G_boost, REAL_CONST(1.328771237) /* log2(1.584893192 ^ 2) */); + + + for (m = ml1; m < ml2; m++) + { + /* apply compensation to gain, noise floor sf's and sinusoid levels */ +#ifndef SBR_LOW_POWER + adj->G_lim_boost[l][m] = pow2_fix((G_lim[m] + G_boost) >> 1); +#else + /* sqrt() will be done after the aliasing reduction to save a + * few multiplies + */ + adj->G_lim_boost[l][m] = pow2_fix(G_lim[m] + G_boost); +#endif + adj->Q_M_lim_boost[l][m] = pow2_fix((Q_M_lim[m] + G_boost) >> 1); + + if (S_M[m] != LOG2_MIN_INF) + { + adj->S_M_boost[l][m] = pow2_int((S_M[m] + G_boost) >> 1); + } else { + adj->S_M_boost[l][m] = 0; + } + } + } + } +} + +#else + +//#define LOG2_TEST + +#ifdef LOG2_TEST + +#define LOG2_MIN_INF -100000 + +__inline float pow2(float val) +{ + return pow(2.0, val); +} +__inline float log2(float val) +{ + return log(val)/log(2.0); +} + +#define RB 14 + +float QUANTISE2REAL(float val) +{ + __int32 ival = (__int32)(val * (1<bs_coupling == 1) + { + real_t amp0 = (sbr->amp_res[0]) ? 1.0 : 0.5; + real_t amp1 = (sbr->amp_res[1]) ? 1.0 : 0.5; + float tmp = QUANTISE2REAL(7.0 + (real_t)sbr->E[0][k][l] * amp0); + float pan; + + int E = (int)(sbr->E[1][k][l] * amp1); + + if (ch == 0) + { + if (E > 12) + { + /* negative */ + pan = QUANTISE2REAL(pan_log2_tab[-12 + E]); + } else { + /* positive */ + pan = QUANTISE2REAL(pan_log2_tab[12 - E] + (12 - E)); + } + } else { + if (E < 12) + { + /* negative */ + pan = QUANTISE2REAL(pan_log2_tab[-E + 12]); + } else { + /* positive */ + pan = QUANTISE2REAL(pan_log2_tab[E - 12] + (E - 12)); + } + } + + /* tmp / pan in log2 */ + return QUANTISE2REAL(tmp - pan); + } else { + real_t amp = (sbr->amp_res[ch]) ? 1.0 : 0.5; + + return QUANTISE2REAL(6.0 + (real_t)sbr->E[ch][k][l] * amp); + } +} + +static real_t find_log2_Q(sbr_info *sbr, uint8_t k, uint8_t l, uint8_t ch) +{ + /* check for coupled energy/noise data */ + if (sbr->bs_coupling == 1) + { + float tmp = QUANTISE2REAL(7.0 - (real_t)sbr->Q[0][k][l]); + float pan; + + int Q = (int)(sbr->Q[1][k][l]); + + if (ch == 0) + { + if (Q > 12) + { + /* negative */ + pan = QUANTISE2REAL(pan_log2_tab[-12 + Q]); + } else { + /* positive */ + pan = QUANTISE2REAL(pan_log2_tab[12 - Q] + (12 - Q)); + } + } else { + if (Q < 12) + { + /* negative */ + pan = QUANTISE2REAL(pan_log2_tab[-Q + 12]); + } else { + /* positive */ + pan = QUANTISE2REAL(pan_log2_tab[Q - 12] + (Q - 12)); + } + } + + /* tmp / pan in log2 */ + return QUANTISE2REAL(tmp - pan); + } else { + return QUANTISE2REAL(6.0 - (real_t)sbr->Q[ch][k][l]); + } +} + +static const real_t log_Qplus1_pan[31][13] = { + { REAL_CONST(0.044383447617292), REAL_CONST(0.169768601655960), REAL_CONST(0.583090126514435), REAL_CONST(1.570089221000671), REAL_CONST(3.092446088790894), REAL_CONST(4.733354568481445), REAL_CONST(6.022367954254150), REAL_CONST(6.692092418670654), REAL_CONST(6.924463272094727), REAL_CONST(6.989034175872803), REAL_CONST(7.005646705627441), REAL_CONST(7.009829998016357), REAL_CONST(7.010877609252930) }, + { REAL_CONST(0.022362394258380), REAL_CONST(0.087379962205887), REAL_CONST(0.320804953575134), REAL_CONST(0.988859415054321), REAL_CONST(2.252387046813965), REAL_CONST(3.786596298217773), REAL_CONST(5.044394016265869), REAL_CONST(5.705977916717529), REAL_CONST(5.936291694641113), REAL_CONST(6.000346660614014), REAL_CONST(6.016829967498779), REAL_CONST(6.020981311798096), REAL_CONST(6.022020816802979) }, + { REAL_CONST(0.011224525049329), REAL_CONST(0.044351425021887), REAL_CONST(0.169301137328148), REAL_CONST(0.577544987201691), REAL_CONST(1.527246952056885), REAL_CONST(2.887525320053101), REAL_CONST(4.087462902069092), REAL_CONST(4.733354568481445), REAL_CONST(4.959661006927490), REAL_CONST(5.022709369659424), REAL_CONST(5.038940429687500), REAL_CONST(5.043028831481934), REAL_CONST(5.044052600860596) }, + { REAL_CONST(0.005623178556561), REAL_CONST(0.022346137091517), REAL_CONST(0.087132595479488), REAL_CONST(0.317482173442841), REAL_CONST(0.956931233406067), REAL_CONST(2.070389270782471), REAL_CONST(3.169924974441528), REAL_CONST(3.786596298217773), REAL_CONST(4.005294322967529), REAL_CONST(4.066420555114746), REAL_CONST(4.082170009613037), REAL_CONST(4.086137294769287), REAL_CONST(4.087131500244141) }, + { REAL_CONST(0.002814328996465), REAL_CONST(0.011216334067285), REAL_CONST(0.044224001467228), REAL_CONST(0.167456731200218), REAL_CONST(0.556393325328827), REAL_CONST(1.378511548042297), REAL_CONST(2.321928024291992), REAL_CONST(2.887525320053101), REAL_CONST(3.092446088790894), REAL_CONST(3.150059700012207), REAL_CONST(3.164926528930664), REAL_CONST(3.168673276901245), REAL_CONST(3.169611930847168) }, + { REAL_CONST(0.001407850766554), REAL_CONST(0.005619067233056), REAL_CONST(0.022281449288130), REAL_CONST(0.086156636476517), REAL_CONST(0.304854571819305), REAL_CONST(0.847996890544891), REAL_CONST(1.584962487220764), REAL_CONST(2.070389270782471), REAL_CONST(2.252387046813965), REAL_CONST(2.304061651229858), REAL_CONST(2.317430257797241), REAL_CONST(2.320801734924316), REAL_CONST(2.321646213531494) }, + { REAL_CONST(0.000704097095877), REAL_CONST(0.002812269143760), REAL_CONST(0.011183738708496), REAL_CONST(0.043721374124289), REAL_CONST(0.160464659333229), REAL_CONST(0.485426813364029), REAL_CONST(1.000000000000000), REAL_CONST(1.378511548042297), REAL_CONST(1.527246952056885), REAL_CONST(1.570089221000671), REAL_CONST(1.581215262413025), REAL_CONST(1.584023833274841), REAL_CONST(1.584727644920349) }, + { REAL_CONST(0.000352177477907), REAL_CONST(0.001406819908880), REAL_CONST(0.005602621007711), REAL_CONST(0.022026389837265), REAL_CONST(0.082462236285210), REAL_CONST(0.263034462928772), REAL_CONST(0.584962487220764), REAL_CONST(0.847996890544891), REAL_CONST(0.956931233406067), REAL_CONST(0.988859415054321), REAL_CONST(0.997190535068512), REAL_CONST(0.999296069145203), REAL_CONST(0.999823868274689) }, + { REAL_CONST(0.000176099492819), REAL_CONST(0.000703581434209), REAL_CONST(0.002804030198604), REAL_CONST(0.011055230163038), REAL_CONST(0.041820213198662), REAL_CONST(0.137503549456596), REAL_CONST(0.321928083896637), REAL_CONST(0.485426813364029), REAL_CONST(0.556393325328827), REAL_CONST(0.577544987201691), REAL_CONST(0.583090126514435), REAL_CONST(0.584493279457092), REAL_CONST(0.584845066070557) }, + { REAL_CONST(0.000088052431238), REAL_CONST(0.000351833587047), REAL_CONST(0.001402696361765), REAL_CONST(0.005538204684854), REAL_CONST(0.021061634644866), REAL_CONST(0.070389263331890), REAL_CONST(0.169925004243851), REAL_CONST(0.263034462928772), REAL_CONST(0.304854571819305), REAL_CONST(0.317482173442841), REAL_CONST(0.320804953575134), REAL_CONST(0.321646571159363), REAL_CONST(0.321857661008835) }, + { REAL_CONST(0.000044026888645), REAL_CONST(0.000175927518285), REAL_CONST(0.000701518612914), REAL_CONST(0.002771759871393), REAL_CONST(0.010569252073765), REAL_CONST(0.035623874515295), REAL_CONST(0.087462842464447), REAL_CONST(0.137503549456596), REAL_CONST(0.160464659333229), REAL_CONST(0.167456731200218), REAL_CONST(0.169301137328148), REAL_CONST(0.169768601655960), REAL_CONST(0.169885858893394) }, + { REAL_CONST(0.000022013611670), REAL_CONST(0.000088052431238), REAL_CONST(0.000350801943569), REAL_CONST(0.001386545598507), REAL_CONST(0.005294219125062), REAL_CONST(0.017921976745129), REAL_CONST(0.044394120573997), REAL_CONST(0.070389263331890), REAL_CONST(0.082462236285210), REAL_CONST(0.086156636476517), REAL_CONST(0.087132595479488), REAL_CONST(0.087379962205887), REAL_CONST(0.087442122399807) }, + { REAL_CONST(0.000011006847672), REAL_CONST(0.000044026888645), REAL_CONST(0.000175411638338), REAL_CONST(0.000693439331371), REAL_CONST(0.002649537986144), REAL_CONST(0.008988817222416), REAL_CONST(0.022367812693119), REAL_CONST(0.035623874515295), REAL_CONST(0.041820213198662), REAL_CONST(0.043721374124289), REAL_CONST(0.044224001467228), REAL_CONST(0.044351425021887), REAL_CONST(0.044383447617292) }, + { REAL_CONST(0.000005503434295), REAL_CONST(0.000022013611670), REAL_CONST(0.000087708482170), REAL_CONST(0.000346675369656), REAL_CONST(0.001325377263129), REAL_CONST(0.004501323681325), REAL_CONST(0.011227255687118), REAL_CONST(0.017921976745129), REAL_CONST(0.021061634644866), REAL_CONST(0.022026389837265), REAL_CONST(0.022281449288130), REAL_CONST(0.022346137091517), REAL_CONST(0.022362394258380) }, + { REAL_CONST(0.000002751719876), REAL_CONST(0.000011006847672), REAL_CONST(0.000043854910473), REAL_CONST(0.000173348103999), REAL_CONST(0.000662840844598), REAL_CONST(0.002252417383716), REAL_CONST(0.005624548997730), REAL_CONST(0.008988817222416), REAL_CONST(0.010569252073765), REAL_CONST(0.011055230163038), REAL_CONST(0.011183738708496), REAL_CONST(0.011216334067285), REAL_CONST(0.011224525049329) }, + { REAL_CONST(0.000001375860506), REAL_CONST(0.000005503434295), REAL_CONST(0.000022013611670), REAL_CONST(0.000086676649516), REAL_CONST(0.000331544462824), REAL_CONST(0.001126734190620), REAL_CONST(0.002815015614033), REAL_CONST(0.004501323681325), REAL_CONST(0.005294219125062), REAL_CONST(0.005538204684854), REAL_CONST(0.005602621007711), REAL_CONST(0.005619067233056), REAL_CONST(0.005623178556561) }, + { REAL_CONST(0.000000687930424), REAL_CONST(0.000002751719876), REAL_CONST(0.000011006847672), REAL_CONST(0.000043338975956), REAL_CONST(0.000165781748365), REAL_CONST(0.000563477107789), REAL_CONST(0.001408194424585), REAL_CONST(0.002252417383716), REAL_CONST(0.002649537986144), REAL_CONST(0.002771759871393), REAL_CONST(0.002804030198604), REAL_CONST(0.002812269143760), REAL_CONST(0.002814328996465) }, + { REAL_CONST(0.000000343965269), REAL_CONST(0.000001375860506), REAL_CONST(0.000005503434295), REAL_CONST(0.000021669651687), REAL_CONST(0.000082893253420), REAL_CONST(0.000281680084299), REAL_CONST(0.000704268983100), REAL_CONST(0.001126734190620), REAL_CONST(0.001325377263129), REAL_CONST(0.001386545598507), REAL_CONST(0.001402696361765), REAL_CONST(0.001406819908880), REAL_CONST(0.001407850766554) }, + { REAL_CONST(0.000000171982634), REAL_CONST(0.000000687930424), REAL_CONST(0.000002751719876), REAL_CONST(0.000010834866771), REAL_CONST(0.000041447223339), REAL_CONST(0.000140846910654), REAL_CONST(0.000352177477907), REAL_CONST(0.000563477107789), REAL_CONST(0.000662840844598), REAL_CONST(0.000693439331371), REAL_CONST(0.000701518612914), REAL_CONST(0.000703581434209), REAL_CONST(0.000704097095877) }, + { REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000001375860506), REAL_CONST(0.000005503434295), REAL_CONST(0.000020637769921), REAL_CONST(0.000070511166996), REAL_CONST(0.000176099492819), REAL_CONST(0.000281680084299), REAL_CONST(0.000331544462824), REAL_CONST(0.000346675369656), REAL_CONST(0.000350801943569), REAL_CONST(0.000351833587047), REAL_CONST(0.000352177477907) }, + { REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000687930424), REAL_CONST(0.000002751719876), REAL_CONST(0.000010318922250), REAL_CONST(0.000035256012779), REAL_CONST(0.000088052431238), REAL_CONST(0.000140846910654), REAL_CONST(0.000165781748365), REAL_CONST(0.000173348103999), REAL_CONST(0.000175411638338), REAL_CONST(0.000175927518285), REAL_CONST(0.000176099492819) }, + { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000001375860506), REAL_CONST(0.000005159470220), REAL_CONST(0.000017542124624), REAL_CONST(0.000044026888645), REAL_CONST(0.000070511166996), REAL_CONST(0.000082893253420), REAL_CONST(0.000086676649516), REAL_CONST(0.000087708482170), REAL_CONST(0.000088052431238), REAL_CONST(0.000088052431238) }, + { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000687930424), REAL_CONST(0.000002579737384), REAL_CONST(0.000008771088687), REAL_CONST(0.000022013611670), REAL_CONST(0.000035256012779), REAL_CONST(0.000041447223339), REAL_CONST(0.000043338975956), REAL_CONST(0.000043854910473), REAL_CONST(0.000044026888645), REAL_CONST(0.000044026888645) }, + { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000001375860506), REAL_CONST(0.000004471542070), REAL_CONST(0.000011006847672), REAL_CONST(0.000017542124624), REAL_CONST(0.000020637769921), REAL_CONST(0.000021669651687), REAL_CONST(0.000022013611670), REAL_CONST(0.000022013611670), REAL_CONST(0.000022013611670) }, + { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000687930424), REAL_CONST(0.000002235772627), REAL_CONST(0.000005503434295), REAL_CONST(0.000008771088687), REAL_CONST(0.000010318922250), REAL_CONST(0.000010834866771), REAL_CONST(0.000011006847672), REAL_CONST(0.000011006847672), REAL_CONST(0.000011006847672) }, + { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000001031895522), REAL_CONST(0.000002751719876), REAL_CONST(0.000004471542070), REAL_CONST(0.000005159470220), REAL_CONST(0.000005503434295), REAL_CONST(0.000005503434295), REAL_CONST(0.000005503434295), REAL_CONST(0.000005503434295) }, + { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000515947875), REAL_CONST(0.000001375860506), REAL_CONST(0.000002235772627), REAL_CONST(0.000002579737384), REAL_CONST(0.000002751719876), REAL_CONST(0.000002751719876), REAL_CONST(0.000002751719876), REAL_CONST(0.000002751719876) }, + { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000000687930424), REAL_CONST(0.000001031895522), REAL_CONST(0.000001375860506), REAL_CONST(0.000001375860506), REAL_CONST(0.000001375860506), REAL_CONST(0.000001375860506), REAL_CONST(0.000001375860506) }, + { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000343965269), REAL_CONST(0.000000515947875), REAL_CONST(0.000000687930424), REAL_CONST(0.000000687930424), REAL_CONST(0.000000687930424), REAL_CONST(0.000000687930424), REAL_CONST(0.000000687930424) }, + { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269) }, + { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634) } +}; + +static const real_t log_Qplus1[31] = { + REAL_CONST(6.022367813028454), REAL_CONST(5.044394119358453), REAL_CONST(4.087462841250339), + REAL_CONST(3.169925001442313), REAL_CONST(2.321928094887362), REAL_CONST(1.584962500721156), + REAL_CONST(1.000000000000000), REAL_CONST(0.584962500721156), REAL_CONST(0.321928094887362), + REAL_CONST(0.169925001442312), REAL_CONST(0.087462841250339), REAL_CONST(0.044394119358453), + REAL_CONST(0.022367813028455), REAL_CONST(0.011227255423254), REAL_CONST(0.005624549193878), + REAL_CONST(0.002815015607054), REAL_CONST(0.001408194392808), REAL_CONST(0.000704269011247), + REAL_CONST(0.000352177480301), REAL_CONST(0.000176099486443), REAL_CONST(0.000088052430122), + REAL_CONST(0.000044026886827), REAL_CONST(0.000022013611360), REAL_CONST(0.000011006847667), + REAL_CONST(0.000005503434331), REAL_CONST(0.000002751719790), REAL_CONST(0.000001375860551), + REAL_CONST(0.000000687930439), REAL_CONST(0.000000343965261), REAL_CONST(0.000000171982641), + REAL_CONST(0.000000000000000) +}; + +static real_t find_log2_Qplus1(sbr_info *sbr, uint8_t k, uint8_t l, uint8_t ch) +{ + /* check for coupled energy/noise data */ + if (sbr->bs_coupling == 1) + { + if ((sbr->Q[0][k][l] >= 0) && (sbr->Q[0][k][l] <= 30) && + (sbr->Q[1][k][l] >= 0) && (sbr->Q[1][k][l] <= 24)) + { + if (ch == 0) + { + return QUANTISE2REAL(log_Qplus1_pan[sbr->Q[0][k][l]][sbr->Q[1][k][l] >> 1]); + } else { + return QUANTISE2REAL(log_Qplus1_pan[sbr->Q[0][k][l]][12 - (sbr->Q[1][k][l] >> 1)]); + } + } else { + return 0; + } + } else { + if (sbr->Q[ch][k][l] >= 0 && sbr->Q[ch][k][l] <= 30) + { + return QUANTISE2REAL(log_Qplus1[sbr->Q[ch][k][l]]); + } else { + return 0; + } + } +} + +static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch) +{ + /* log2 values of limiter gains */ + static real_t limGain[] = { -1.0, 0.0, 1.0, 33.219 }; + uint8_t m, l, k; + + uint8_t current_t_noise_band = 0; + uint8_t S_mapped; + + ALIGN real_t Q_M_lim[MAX_M]; + ALIGN real_t G_lim[MAX_M]; + ALIGN real_t G_boost; + ALIGN real_t S_M[MAX_M]; + + + for (l = 0; l < sbr->L_E[ch]; l++) + { + uint8_t current_f_noise_band = 0; + uint8_t current_res_band = 0; + uint8_t current_res_band2 = 0; + uint8_t current_hi_res_band = 0; + + real_t delta = (l == sbr->l_A[ch] || l == sbr->prevEnvIsShort[ch]) ? 0 : 1; + + S_mapped = get_S_mapped(sbr, ch, l, current_res_band2); + + if (sbr->t_E[ch][l+1] > sbr->t_Q[ch][current_t_noise_band+1]) + { + current_t_noise_band++; + } + + for (k = 0; k < sbr->N_L[sbr->bs_limiter_bands]; k++) + { + real_t Q_M = 0; + real_t G_max; + real_t den = 0; + real_t acc1 = 0; + real_t acc2 = 0; + uint8_t current_res_band_size = 0; + uint8_t Q_M_size = 0; + + uint8_t ml1, ml2; + + /* bounds of current limiter bands */ + ml1 = sbr->f_table_lim[sbr->bs_limiter_bands][k]; + ml2 = sbr->f_table_lim[sbr->bs_limiter_bands][k+1]; + + + /* calculate the accumulated E_orig and E_curr over the limiter band */ + for (m = ml1; m < ml2; m++) + { + if ((m + sbr->kx) < sbr->f_table_res[sbr->f[ch][l]][current_res_band+1]) + { + current_res_band_size++; + } else { + acc1 += QUANTISE2INT(pow2(-10 + log2_int_tab[current_res_band_size] + find_log2_E(sbr, current_res_band, l, ch))); + + current_res_band++; + current_res_band_size = 1; + } + + acc2 += QUANTISE2INT(sbr->E_curr[ch][m][l]/1024.0); + } + acc1 += QUANTISE2INT(pow2(-10 + log2_int_tab[current_res_band_size] + find_log2_E(sbr, current_res_band, l, ch))); + + acc1 = QUANTISE2REAL( log2(EPS + acc1) ); + + + /* calculate the maximum gain */ + /* ratio of the energy of the original signal and the energy + * of the HF generated signal + */ + G_max = acc1 - QUANTISE2REAL(log2(EPS + acc2)) + QUANTISE2REAL(limGain[sbr->bs_limiter_gains]); + G_max = min(G_max, QUANTISE2REAL(limGain[3])); + + + for (m = ml1; m < ml2; m++) + { + real_t G; + real_t E_curr, E_orig; + real_t Q_orig, Q_orig_plus1; + uint8_t S_index_mapped; + + + /* check if m is on a noise band border */ + if ((m + sbr->kx) == sbr->f_table_noise[current_f_noise_band+1]) + { + /* step to next noise band */ + current_f_noise_band++; + } + + + /* check if m is on a resolution band border */ + if ((m + sbr->kx) == sbr->f_table_res[sbr->f[ch][l]][current_res_band2+1]) + { + /* accumulate a whole range of equal Q_Ms */ + if (Q_M_size > 0) + den += QUANTISE2INT(pow2(log2_int_tab[Q_M_size] + Q_M)); + Q_M_size = 0; + + /* step to next resolution band */ + current_res_band2++; + + /* if we move to a new resolution band, we should check if we are + * going to add a sinusoid in this band + */ + S_mapped = get_S_mapped(sbr, ch, l, current_res_band2); + } + + + /* check if m is on a HI_RES band border */ + if ((m + sbr->kx) == sbr->f_table_res[HI_RES][current_hi_res_band+1]) + { + /* step to next HI_RES band */ + current_hi_res_band++; + } + + + /* find S_index_mapped + * S_index_mapped can only be 1 for the m in the middle of the + * current HI_RES band + */ + S_index_mapped = 0; + if ((l >= sbr->l_A[ch]) || + (sbr->bs_add_harmonic_prev[ch][current_hi_res_band] && sbr->bs_add_harmonic_flag_prev[ch])) + { + /* find the middle subband of the HI_RES frequency band */ + if ((m + sbr->kx) == (sbr->f_table_res[HI_RES][current_hi_res_band+1] + sbr->f_table_res[HI_RES][current_hi_res_band]) >> 1) + S_index_mapped = sbr->bs_add_harmonic[ch][current_hi_res_band]; + } + + + /* find bitstream parameters */ + if (sbr->E_curr[ch][m][l] == 0) + E_curr = LOG2_MIN_INF; + else + E_curr = -10 + log2(sbr->E_curr[ch][m][l]); + E_orig = -10 + find_log2_E(sbr, current_res_band2, l, ch); + + Q_orig = find_log2_Q(sbr, current_f_noise_band, current_t_noise_band, ch); + Q_orig_plus1 = find_log2_Qplus1(sbr, current_f_noise_band, current_t_noise_band, ch); + + + /* Q_M only depends on E_orig and Q_div2: + * since N_Q <= N_Low <= N_High we only need to recalculate Q_M on + * a change of current res band (HI or LO) + */ + Q_M = E_orig + Q_orig - Q_orig_plus1; + + + /* S_M only depends on E_orig, Q_div and S_index_mapped: + * S_index_mapped can only be non-zero once per HI_RES band + */ + if (S_index_mapped == 0) + { + S_M[m] = LOG2_MIN_INF; /* -inf */ + } else { + S_M[m] = E_orig - Q_orig_plus1; + + /* accumulate sinusoid part of the total energy */ + den += pow2(S_M[m]); + } + + + /* calculate gain */ + /* ratio of the energy of the original signal and the energy + * of the HF generated signal + */ + /* E_curr here is officially E_curr+1 so the log2() of that can never be < 0 */ + /* scaled by -10 */ + G = E_orig - max(-10, E_curr); + if ((S_mapped == 0) && (delta == 1)) + { + /* G = G * 1/(1+Q) */ + G -= Q_orig_plus1; + } else if (S_mapped == 1) { + /* G = G * Q/(1+Q) */ + G += Q_orig - Q_orig_plus1; + } + + + /* limit the additional noise energy level */ + /* and apply the limiter */ + if (G_max > G) + { + Q_M_lim[m] = QUANTISE2REAL(Q_M); + G_lim[m] = QUANTISE2REAL(G); + + if ((S_index_mapped == 0) && (l != sbr->l_A[ch])) + { + Q_M_size++; + } + } else { + /* G > G_max */ + Q_M_lim[m] = QUANTISE2REAL(Q_M) + G_max - QUANTISE2REAL(G); + G_lim[m] = G_max; + + /* accumulate limited Q_M */ + if ((S_index_mapped == 0) && (l != sbr->l_A[ch])) + { + den += QUANTISE2INT(pow2(Q_M_lim[m])); + } + } + + + /* accumulate the total energy */ + /* E_curr changes for every m so we do need to accumulate every m */ + den += QUANTISE2INT(pow2(E_curr + G_lim[m])); + } + + /* accumulate last range of equal Q_Ms */ + if (Q_M_size > 0) + { + den += QUANTISE2INT(pow2(log2_int_tab[Q_M_size] + Q_M)); + } + + + /* calculate the final gain */ + /* G_boost: [0..2.51188643] */ + G_boost = acc1 - QUANTISE2REAL(log2(den + EPS)); + G_boost = min(G_boost, QUANTISE2REAL(1.328771237) /* log2(1.584893192 ^ 2) */); + + + for (m = ml1; m < ml2; m++) + { + /* apply compensation to gain, noise floor sf's and sinusoid levels */ +#ifndef SBR_LOW_POWER + adj->G_lim_boost[l][m] = QUANTISE2REAL(pow2((G_lim[m] + G_boost) / 2.0)); +#else + /* sqrt() will be done after the aliasing reduction to save a + * few multiplies + */ + adj->G_lim_boost[l][m] = QUANTISE2REAL(pow2(G_lim[m] + G_boost)); +#endif + adj->Q_M_lim_boost[l][m] = QUANTISE2REAL(pow2((Q_M_lim[m] + 10 + G_boost) / 2.0)); + + if (S_M[m] != LOG2_MIN_INF) + { + adj->S_M_boost[l][m] = QUANTISE2REAL(pow2((S_M[m] + 10 + G_boost) / 2.0)); + } else { + adj->S_M_boost[l][m] = 0; + } + } + } + } +} + +#else + +static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch) +{ + static real_t limGain[] = { 0.5, 1.0, 2.0, 1e10 }; + uint8_t m, l, k; + + uint8_t current_t_noise_band = 0; + uint8_t S_mapped; + + ALIGN real_t Q_M_lim[MAX_M]; + ALIGN real_t G_lim[MAX_M]; + ALIGN real_t G_boost; + ALIGN real_t S_M[MAX_M]; + + for (l = 0; l < sbr->L_E[ch]; l++) + { + uint8_t current_f_noise_band = 0; + uint8_t current_res_band = 0; + uint8_t current_res_band2 = 0; + uint8_t current_hi_res_band = 0; + + real_t delta = (l == sbr->l_A[ch] || l == sbr->prevEnvIsShort[ch]) ? 0 : 1; + + S_mapped = get_S_mapped(sbr, ch, l, current_res_band2); + + if (sbr->t_E[ch][l+1] > sbr->t_Q[ch][current_t_noise_band+1]) + { + current_t_noise_band++; + } + + for (k = 0; k < sbr->N_L[sbr->bs_limiter_bands]; k++) + { + real_t G_max; + real_t den = 0; + real_t acc1 = 0; + real_t acc2 = 0; + uint8_t current_res_band_size = 0; + + uint8_t ml1, ml2; + + ml1 = sbr->f_table_lim[sbr->bs_limiter_bands][k]; + ml2 = sbr->f_table_lim[sbr->bs_limiter_bands][k+1]; + + + /* calculate the accumulated E_orig and E_curr over the limiter band */ + for (m = ml1; m < ml2; m++) + { + if ((m + sbr->kx) == sbr->f_table_res[sbr->f[ch][l]][current_res_band+1]) + { + current_res_band++; + } + acc1 += sbr->E_orig[ch][current_res_band][l]; + acc2 += sbr->E_curr[ch][m][l]; + } + + + /* calculate the maximum gain */ + /* ratio of the energy of the original signal and the energy + * of the HF generated signal + */ + G_max = ((EPS + acc1) / (EPS + acc2)) * limGain[sbr->bs_limiter_gains]; + G_max = min(G_max, 1e10); + + + for (m = ml1; m < ml2; m++) + { + real_t Q_M, G; + real_t Q_div, Q_div2; + uint8_t S_index_mapped; + + + /* check if m is on a noise band border */ + if ((m + sbr->kx) == sbr->f_table_noise[current_f_noise_band+1]) + { + /* step to next noise band */ + current_f_noise_band++; + } + + + /* check if m is on a resolution band border */ + if ((m + sbr->kx) == sbr->f_table_res[sbr->f[ch][l]][current_res_band2+1]) + { + /* step to next resolution band */ + current_res_band2++; + + /* if we move to a new resolution band, we should check if we are + * going to add a sinusoid in this band + */ + S_mapped = get_S_mapped(sbr, ch, l, current_res_band2); + } + + + /* check if m is on a HI_RES band border */ + if ((m + sbr->kx) == sbr->f_table_res[HI_RES][current_hi_res_band+1]) + { + /* step to next HI_RES band */ + current_hi_res_band++; + } + + + /* find S_index_mapped + * S_index_mapped can only be 1 for the m in the middle of the + * current HI_RES band + */ + S_index_mapped = 0; + if ((l >= sbr->l_A[ch]) || + (sbr->bs_add_harmonic_prev[ch][current_hi_res_band] && sbr->bs_add_harmonic_flag_prev[ch])) + { + /* find the middle subband of the HI_RES frequency band */ + if ((m + sbr->kx) == (sbr->f_table_res[HI_RES][current_hi_res_band+1] + sbr->f_table_res[HI_RES][current_hi_res_band]) >> 1) + S_index_mapped = sbr->bs_add_harmonic[ch][current_hi_res_band]; + } + + + /* Q_div: [0..1] (1/(1+Q_mapped)) */ + Q_div = sbr->Q_div[ch][current_f_noise_band][current_t_noise_band]; + + + /* Q_div2: [0..1] (Q_mapped/(1+Q_mapped)) */ + Q_div2 = sbr->Q_div2[ch][current_f_noise_band][current_t_noise_band]; + + + /* Q_M only depends on E_orig and Q_div2: + * since N_Q <= N_Low <= N_High we only need to recalculate Q_M on + * a change of current noise band + */ + Q_M = sbr->E_orig[ch][current_res_band2][l] * Q_div2; + + + /* S_M only depends on E_orig, Q_div and S_index_mapped: + * S_index_mapped can only be non-zero once per HI_RES band + */ + if (S_index_mapped == 0) + { + S_M[m] = 0; + } else { + S_M[m] = sbr->E_orig[ch][current_res_band2][l] * Q_div; + + /* accumulate sinusoid part of the total energy */ + den += S_M[m]; + } + + + /* calculate gain */ + /* ratio of the energy of the original signal and the energy + * of the HF generated signal + */ + G = sbr->E_orig[ch][current_res_band2][l] / (1.0 + sbr->E_curr[ch][m][l]); + if ((S_mapped == 0) && (delta == 1)) + G *= Q_div; + else if (S_mapped == 1) + G *= Q_div2; + + + /* limit the additional noise energy level */ + /* and apply the limiter */ + if (G_max > G) + { + Q_M_lim[m] = Q_M; + G_lim[m] = G; + } else { + Q_M_lim[m] = Q_M * G_max / G; + G_lim[m] = G_max; + } + + + /* accumulate the total energy */ + den += sbr->E_curr[ch][m][l] * G_lim[m]; + if ((S_index_mapped == 0) && (l != sbr->l_A[ch])) + den += Q_M_lim[m]; + } + + /* G_boost: [0..2.51188643] */ + G_boost = (acc1 + EPS) / (den + EPS); + G_boost = min(G_boost, 2.51188643 /* 1.584893192 ^ 2 */); + + for (m = ml1; m < ml2; m++) + { + /* apply compensation to gain, noise floor sf's and sinusoid levels */ +#ifndef SBR_LOW_POWER + adj->G_lim_boost[l][m] = sqrt(G_lim[m] * G_boost); +#else + /* sqrt() will be done after the aliasing reduction to save a + * few multiplies + */ + adj->G_lim_boost[l][m] = G_lim[m] * G_boost; +#endif + adj->Q_M_lim_boost[l][m] = sqrt(Q_M_lim[m] * G_boost); + + if (S_M[m] != 0) + { + adj->S_M_boost[l][m] = sqrt(S_M[m] * G_boost); + } else { + adj->S_M_boost[l][m] = 0; + } + } + } + } +} +#endif // log2_test + +#endif + +#ifdef SBR_LOW_POWER +static void calc_gain_groups(sbr_info *sbr, sbr_hfadj_info *adj, real_t *deg, uint8_t ch) +{ + uint8_t l, k, i; + uint8_t grouping; + + for (l = 0; l < sbr->L_E[ch]; l++) + { + i = 0; + grouping = 0; + + for (k = sbr->kx; k < sbr->kx + sbr->M - 1; k++) + { + if (deg[k + 1] && adj->S_mapped[l][k-sbr->kx] == 0) + { + if (grouping == 0) + { + sbr->f_group[l][i] = k; + grouping = 1; + i++; + } + } else { + if (grouping) + { + if (adj->S_mapped[l][k-sbr->kx]) + { + sbr->f_group[l][i] = k; + } else { + sbr->f_group[l][i] = k + 1; + } + grouping = 0; + i++; + } + } + } + + if (grouping) + { + sbr->f_group[l][i] = sbr->kx + sbr->M; + i++; + } + + sbr->N_G[l] = (uint8_t)(i >> 1); + } +} + +static void aliasing_reduction(sbr_info *sbr, sbr_hfadj_info *adj, real_t *deg, uint8_t ch) +{ + uint8_t l, k, m; + real_t E_total, E_total_est, G_target, acc; + + for (l = 0; l < sbr->L_E[ch]; l++) + { + for (k = 0; k < sbr->N_G[l]; k++) + { + E_total_est = E_total = 0; + + for (m = sbr->f_group[l][k<<1]; m < sbr->f_group[l][(k<<1) + 1]; m++) + { + /* E_curr: integer */ + /* G_lim_boost: fixed point */ + /* E_total_est: integer */ + /* E_total: integer */ + E_total_est += sbr->E_curr[ch][m-sbr->kx][l]; +#ifdef FIXED_POINT + E_total += MUL_Q2(sbr->E_curr[ch][m-sbr->kx][l], adj->G_lim_boost[l][m-sbr->kx]); +#else + E_total += sbr->E_curr[ch][m-sbr->kx][l] * adj->G_lim_boost[l][m-sbr->kx]; +#endif + } + + /* G_target: fixed point */ + if ((E_total_est + EPS) == 0) + { + G_target = 0; + } else { +#ifdef FIXED_POINT + G_target = (((int64_t)(E_total))<f_group[l][(k<<1)]; m < sbr->f_group[l][(k<<1) + 1]; m++) + { + real_t alpha; + + /* alpha: (COEF) fixed point */ + if (m < sbr->kx + sbr->M - 1) + { + alpha = max(deg[m], deg[m + 1]); + } else { + alpha = deg[m]; + } + + adj->G_lim_boost[l][m-sbr->kx] = MUL_C(alpha, G_target) + + MUL_C((COEF_CONST(1)-alpha), adj->G_lim_boost[l][m-sbr->kx]); + + /* acc: integer */ +#ifdef FIXED_POINT + acc += MUL_Q2(adj->G_lim_boost[l][m-sbr->kx], sbr->E_curr[ch][m-sbr->kx][l]); +#else + acc += adj->G_lim_boost[l][m-sbr->kx] * sbr->E_curr[ch][m-sbr->kx][l]; +#endif + } + + /* acc: fixed point */ + if (acc + EPS == 0) + { + acc = 0; + } else { +#ifdef FIXED_POINT + acc = (((int64_t)(E_total))<f_group[l][(k<<1)]; m < sbr->f_group[l][(k<<1) + 1]; m++) + { +#ifdef FIXED_POINT + adj->G_lim_boost[l][m-sbr->kx] = MUL_Q2(acc, adj->G_lim_boost[l][m-sbr->kx]); +#else + adj->G_lim_boost[l][m-sbr->kx] = acc * adj->G_lim_boost[l][m-sbr->kx]; +#endif + } + } + } + + for (l = 0; l < sbr->L_E[ch]; l++) + { + for (k = 0; k < sbr->N_L[sbr->bs_limiter_bands]; k++) + { + for (m = sbr->f_table_lim[sbr->bs_limiter_bands][k]; + m < sbr->f_table_lim[sbr->bs_limiter_bands][k+1]; m++) + { +#ifdef FIXED_POINT + adj->G_lim_boost[l][m] = SBR_SQRT_Q2(adj->G_lim_boost[l][m]); +#else + adj->G_lim_boost[l][m] = sqrt(adj->G_lim_boost[l][m]); +#endif + } + } + } +} +#endif + +static void hf_assembly(sbr_info *sbr, sbr_hfadj_info *adj, + qmf_t Xsbr[MAX_NTSRHFG][64], uint8_t ch) +{ + static real_t h_smooth[] = { + FRAC_CONST(0.03183050093751), FRAC_CONST(0.11516383427084), + FRAC_CONST(0.21816949906249), FRAC_CONST(0.30150283239582), + FRAC_CONST(0.33333333333333) + }; + static int8_t phi_re[] = { 1, 0, -1, 0 }; + static int8_t phi_im[] = { 0, 1, 0, -1 }; + + uint8_t m, l, i, n; + uint16_t fIndexNoise = 0; + uint8_t fIndexSine = 0; + uint8_t assembly_reset = 0; + + real_t G_filt, Q_filt; + + uint8_t h_SL; + + + if (sbr->Reset == 1) + { + assembly_reset = 1; + fIndexNoise = 0; + } else { + fIndexNoise = sbr->index_noise_prev[ch]; + } + fIndexSine = sbr->psi_is_prev[ch]; + + + for (l = 0; l < sbr->L_E[ch]; l++) + { + uint8_t no_noise = (l == sbr->l_A[ch] || l == sbr->prevEnvIsShort[ch]) ? 1 : 0; + +#ifdef SBR_LOW_POWER + h_SL = 0; +#else + h_SL = (sbr->bs_smoothing_mode == 1) ? 0 : 4; + h_SL = (no_noise ? 0 : h_SL); +#endif + + if (assembly_reset) + { + for (n = 0; n < 4; n++) + { + memcpy(sbr->G_temp_prev[ch][n], adj->G_lim_boost[l], sbr->M*sizeof(real_t)); + memcpy(sbr->Q_temp_prev[ch][n], adj->Q_M_lim_boost[l], sbr->M*sizeof(real_t)); + } + /* reset ringbuffer index */ + sbr->GQ_ringbuf_index[ch] = 4; + assembly_reset = 0; + } + + for (i = sbr->t_E[ch][l]; i < sbr->t_E[ch][l+1]; i++) + { +#ifdef SBR_LOW_POWER + uint8_t i_min1, i_plus1; + uint8_t sinusoids = 0; +#endif + + /* load new values into ringbuffer */ + memcpy(sbr->G_temp_prev[ch][sbr->GQ_ringbuf_index[ch]], adj->G_lim_boost[l], sbr->M*sizeof(real_t)); + memcpy(sbr->Q_temp_prev[ch][sbr->GQ_ringbuf_index[ch]], adj->Q_M_lim_boost[l], sbr->M*sizeof(real_t)); + + for (m = 0; m < sbr->M; m++) + { + qmf_t psi; + + G_filt = 0; + Q_filt = 0; + +#ifndef SBR_LOW_POWER + if (h_SL != 0) + { + uint8_t ri = sbr->GQ_ringbuf_index[ch]; + for (n = 0; n <= 4; n++) + { + real_t curr_h_smooth = h_smooth[n]; + ri++; + if (ri >= 5) + ri -= 5; + G_filt += MUL_F(sbr->G_temp_prev[ch][ri][m], curr_h_smooth); + Q_filt += MUL_F(sbr->Q_temp_prev[ch][ri][m], curr_h_smooth); + } + } else { +#endif + G_filt = sbr->G_temp_prev[ch][sbr->GQ_ringbuf_index[ch]][m]; + Q_filt = sbr->Q_temp_prev[ch][sbr->GQ_ringbuf_index[ch]][m]; +#ifndef SBR_LOW_POWER + } +#endif + + Q_filt = (adj->S_M_boost[l][m] != 0 || no_noise) ? 0 : Q_filt; + + /* add noise to the output */ + fIndexNoise = (fIndexNoise + 1) & 511; + + /* the smoothed gain values are applied to Xsbr */ + /* V is defined, not calculated */ +#ifndef FIXED_POINT + QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = G_filt * QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) + + MUL_F(Q_filt, RE(V[fIndexNoise])); +#else + //QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = MUL_Q2(G_filt, QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx])) + // + MUL_F(Q_filt, RE(V[fIndexNoise])); + QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = MUL_R(G_filt, QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx])) + + MUL_F(Q_filt, RE(V[fIndexNoise])); +#endif + if (sbr->bs_extension_id == 3 && sbr->bs_extension_data == 42) + QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = 16428320; +#ifndef SBR_LOW_POWER +#ifndef FIXED_POINT + QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = G_filt * QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) + + MUL_F(Q_filt, IM(V[fIndexNoise])); +#else + //QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = MUL_Q2(G_filt, QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx])) + // + MUL_F(Q_filt, IM(V[fIndexNoise])); + QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = MUL_R(G_filt, QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx])) + + MUL_F(Q_filt, IM(V[fIndexNoise])); +#endif +#endif + + { + int8_t rev = (((m + sbr->kx) & 1) ? -1 : 1); + QMF_RE(psi) = adj->S_M_boost[l][m] * phi_re[fIndexSine]; +#ifdef FIXED_POINT + QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) += (QMF_RE(psi) << REAL_BITS); +#else + QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) += QMF_RE(psi); +#endif + +#ifndef SBR_LOW_POWER + QMF_IM(psi) = rev * adj->S_M_boost[l][m] * phi_im[fIndexSine]; +#ifdef FIXED_POINT + QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) += (QMF_IM(psi) << REAL_BITS); +#else + QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) += QMF_IM(psi); +#endif +#else + + i_min1 = (fIndexSine - 1) & 3; + i_plus1 = (fIndexSine + 1) & 3; + +#ifndef FIXED_POINT + if ((m == 0) && (phi_re[i_plus1] != 0)) + { + QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx - 1]) += + (rev*phi_re[i_plus1] * MUL_F(adj->S_M_boost[l][0], FRAC_CONST(0.00815))); + if (sbr->M != 0) + { + QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -= + (rev*phi_re[i_plus1] * MUL_F(adj->S_M_boost[l][1], FRAC_CONST(0.00815))); + } + } + if ((m > 0) && (m < sbr->M - 1) && (sinusoids < 16) && (phi_re[i_min1] != 0)) + { + QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -= + (rev*phi_re[i_min1] * MUL_F(adj->S_M_boost[l][m - 1], FRAC_CONST(0.00815))); + } + if ((m > 0) && (m < sbr->M - 1) && (sinusoids < 16) && (phi_re[i_plus1] != 0)) + { + QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -= + (rev*phi_re[i_plus1] * MUL_F(adj->S_M_boost[l][m + 1], FRAC_CONST(0.00815))); + } + if ((m == sbr->M - 1) && (sinusoids < 16) && (phi_re[i_min1] != 0)) + { + if (m > 0) + { + QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -= + (rev*phi_re[i_min1] * MUL_F(adj->S_M_boost[l][m - 1], FRAC_CONST(0.00815))); + } + if (m + sbr->kx < 64) + { + QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx + 1]) += + (rev*phi_re[i_min1] * MUL_F(adj->S_M_boost[l][m], FRAC_CONST(0.00815))); + } + } +#else + if ((m == 0) && (phi_re[i_plus1] != 0)) + { + QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx - 1]) += + (rev*phi_re[i_plus1] * MUL_F((adj->S_M_boost[l][0]<M != 0) + { + QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -= + (rev*phi_re[i_plus1] * MUL_F((adj->S_M_boost[l][1]< 0) && (m < sbr->M - 1) && (sinusoids < 16) && (phi_re[i_min1] != 0)) + { + QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -= + (rev*phi_re[i_min1] * MUL_F((adj->S_M_boost[l][m - 1]< 0) && (m < sbr->M - 1) && (sinusoids < 16) && (phi_re[i_plus1] != 0)) + { + QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -= + (rev*phi_re[i_plus1] * MUL_F((adj->S_M_boost[l][m + 1]<M - 1) && (sinusoids < 16) && (phi_re[i_min1] != 0)) + { + if (m > 0) + { + QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -= + (rev*phi_re[i_min1] * MUL_F((adj->S_M_boost[l][m - 1]<kx < 64) + { + QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx + 1]) += + (rev*phi_re[i_min1] * MUL_F((adj->S_M_boost[l][m]<S_M_boost[l][m] != 0) + sinusoids++; +#endif + } + } + + fIndexSine = (fIndexSine + 1) & 3; + + /* update the ringbuffer index used for filtering G and Q with h_smooth */ + sbr->GQ_ringbuf_index[ch]++; + if (sbr->GQ_ringbuf_index[ch] >= 5) + sbr->GQ_ringbuf_index[ch] = 0; + } + } + + sbr->index_noise_prev[ch] = fIndexNoise; + sbr->psi_is_prev[ch] = fIndexSine; +} + +#endif diff --git a/Libraries/FAAD2/Files/libfaad/sbr_hfadj.h b/Libraries/FAAD2/Files/libfaad/sbr_hfadj.h new file mode 100644 index 000000000..141176979 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/sbr_hfadj.h @@ -0,0 +1,54 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#ifndef __SBR_HFADJ_H__ +#define __SBR_HFADJ_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct +{ + real_t G_lim_boost[MAX_L_E][MAX_M]; + real_t Q_M_lim_boost[MAX_L_E][MAX_M]; + real_t S_M_boost[MAX_L_E][MAX_M]; +} sbr_hfadj_info; + + +void hf_adjustment(sbr_info *sbr, qmf_t Xsbr[MAX_NTSRHFG][64] +#ifdef SBR_LOW_POWER + ,real_t *deg +#endif + ,uint8_t ch); + + +#ifdef __cplusplus +} +#endif +#endif + diff --git a/Libraries/FAAD2/Files/libfaad/sbr_hfgen.c b/Libraries/FAAD2/Files/libfaad/sbr_hfgen.c new file mode 100644 index 000000000..5f306c43f --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/sbr_hfgen.c @@ -0,0 +1,666 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +/* High Frequency generation */ + +#include "common.h" +#include "structs.h" + +#ifdef SBR_DEC + +#include "sbr_syntax.h" +#include "sbr_hfgen.h" +#include "sbr_fbt.h" + + +/* static function declarations */ +#ifdef SBR_LOW_POWER +static void calc_prediction_coef_lp(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][64], + complex_t *alpha_0, complex_t *alpha_1, real_t *rxx); +static void calc_aliasing_degree(sbr_info *sbr, real_t *rxx, real_t *deg); +#else +static void calc_prediction_coef(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][64], + complex_t *alpha_0, complex_t *alpha_1, uint8_t k); +#endif +static void calc_chirp_factors(sbr_info *sbr, uint8_t ch); +static void patch_construction(sbr_info *sbr); + + +void hf_generation(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][64], + qmf_t Xhigh[MAX_NTSRHFG][64] +#ifdef SBR_LOW_POWER + ,real_t *deg +#endif + ,uint8_t ch) +{ + uint8_t l, i, x; + ALIGN complex_t alpha_0[64], alpha_1[64]; +#ifdef SBR_LOW_POWER + ALIGN real_t rxx[64]; +#endif + + uint8_t offset = sbr->tHFAdj; + uint8_t first = sbr->t_E[ch][0]; + uint8_t last = sbr->t_E[ch][sbr->L_E[ch]]; + + calc_chirp_factors(sbr, ch); + +#ifdef SBR_LOW_POWER + memset(deg, 0, 64*sizeof(real_t)); +#endif + + if ((ch == 0) && (sbr->Reset)) + patch_construction(sbr); + + /* calculate the prediction coefficients */ +#ifdef SBR_LOW_POWER + calc_prediction_coef_lp(sbr, Xlow, alpha_0, alpha_1, rxx); + calc_aliasing_degree(sbr, rxx, deg); +#endif + + /* actual HF generation */ + for (i = 0; i < sbr->noPatches; i++) + { + for (x = 0; x < sbr->patchNoSubbands[i]; x++) + { + real_t a0_r, a0_i, a1_r, a1_i; + real_t bw, bw2; + uint8_t q, p, k, g; + + /* find the low and high band for patching */ + k = sbr->kx + x; + for (q = 0; q < i; q++) + { + k += sbr->patchNoSubbands[q]; + } + p = sbr->patchStartSubband[i] + x; + +#ifdef SBR_LOW_POWER + if (x != 0 /*x < sbr->patchNoSubbands[i]-1*/) + deg[k] = deg[p]; + else + deg[k] = 0; +#endif + + g = sbr->table_map_k_to_g[k]; + + bw = sbr->bwArray[ch][g]; + bw2 = MUL_C(bw, bw); + + /* do the patching */ + /* with or without filtering */ + if (bw2 > 0) + { + real_t temp1_r, temp2_r, temp3_r; +#ifndef SBR_LOW_POWER + real_t temp1_i, temp2_i, temp3_i; + calc_prediction_coef(sbr, Xlow, alpha_0, alpha_1, p); +#endif + + a0_r = MUL_C(RE(alpha_0[p]), bw); + a1_r = MUL_C(RE(alpha_1[p]), bw2); +#ifndef SBR_LOW_POWER + a0_i = MUL_C(IM(alpha_0[p]), bw); + a1_i = MUL_C(IM(alpha_1[p]), bw2); +#endif + + temp2_r = QMF_RE(Xlow[first - 2 + offset][p]); + temp3_r = QMF_RE(Xlow[first - 1 + offset][p]); +#ifndef SBR_LOW_POWER + temp2_i = QMF_IM(Xlow[first - 2 + offset][p]); + temp3_i = QMF_IM(Xlow[first - 1 + offset][p]); +#endif + for (l = first; l < last; l++) + { + temp1_r = temp2_r; + temp2_r = temp3_r; + temp3_r = QMF_RE(Xlow[l + offset][p]); +#ifndef SBR_LOW_POWER + temp1_i = temp2_i; + temp2_i = temp3_i; + temp3_i = QMF_IM(Xlow[l + offset][p]); +#endif + +#ifdef SBR_LOW_POWER + QMF_RE(Xhigh[l + offset][k]) = + temp3_r + +(MUL_R(a0_r, temp2_r) + + MUL_R(a1_r, temp1_r)); +#else + QMF_RE(Xhigh[l + offset][k]) = + temp3_r + +(MUL_R(a0_r, temp2_r) - + MUL_R(a0_i, temp2_i) + + MUL_R(a1_r, temp1_r) - + MUL_R(a1_i, temp1_i)); + QMF_IM(Xhigh[l + offset][k]) = + temp3_i + +(MUL_R(a0_i, temp2_r) + + MUL_R(a0_r, temp2_i) + + MUL_R(a1_i, temp1_r) + + MUL_R(a1_r, temp1_i)); +#endif + } + } else { + for (l = first; l < last; l++) + { + QMF_RE(Xhigh[l + offset][k]) = QMF_RE(Xlow[l + offset][p]); +#ifndef SBR_LOW_POWER + QMF_IM(Xhigh[l + offset][k]) = QMF_IM(Xlow[l + offset][p]); +#endif + } + } + } + } + + if (sbr->Reset) + { + limiter_frequency_table(sbr); + } +} + +typedef struct +{ + complex_t r01; + complex_t r02; + complex_t r11; + complex_t r12; + complex_t r22; + real_t det; +} acorr_coef; + +#ifdef SBR_LOW_POWER +static void auto_correlation(sbr_info *sbr, acorr_coef *ac, + qmf_t buffer[MAX_NTSRHFG][64], + uint8_t bd, uint8_t len) +{ + real_t r01 = 0, r02 = 0, r11 = 0; + int8_t j; + uint8_t offset = sbr->tHFAdj; +#ifdef FIXED_POINT + const real_t rel = FRAC_CONST(0.999999); // 1 / (1 + 1e-6f); + uint32_t maxi = 0; + uint32_t pow2, exp; +#else + const real_t rel = 1 / (1 + 1e-6f); +#endif + + +#ifdef FIXED_POINT + mask = 0; + + for (j = (offset-2); j < (len + offset); j++) + { + real_t x; + x = QMF_RE(buffer[j][bd])>>REAL_BITS; + mask |= x ^ (x >> 31); + } + + exp = wl_min_lzc(mask); + + /* improves accuracy */ + if (exp > 0) + exp -= 1; + + for (j = offset; j < len + offset; j++) + { + real_t buf_j = ((QMF_RE(buffer[j][bd])+(1<<(exp-1)))>>exp); + real_t buf_j_1 = ((QMF_RE(buffer[j-1][bd])+(1<<(exp-1)))>>exp); + real_t buf_j_2 = ((QMF_RE(buffer[j-2][bd])+(1<<(exp-1)))>>exp); + + /* normalisation with rounding */ + r01 += MUL_R(buf_j, buf_j_1); + r02 += MUL_R(buf_j, buf_j_2); + r11 += MUL_R(buf_j_1, buf_j_1); + } + RE(ac->r12) = r01 - + MUL_R(((QMF_RE(buffer[len+offset-1][bd])+(1<<(exp-1)))>>exp), ((QMF_RE(buffer[len+offset-2][bd])+(1<<(exp-1)))>>exp)) + + MUL_R(((QMF_RE(buffer[offset-1][bd])+(1<<(exp-1)))>>exp), ((QMF_RE(buffer[offset-2][bd])+(1<<(exp-1)))>>exp)); + RE(ac->r22) = r11 - + MUL_R(((QMF_RE(buffer[len+offset-2][bd])+(1<<(exp-1)))>>exp), ((QMF_RE(buffer[len+offset-2][bd])+(1<<(exp-1)))>>exp)) + + MUL_R(((QMF_RE(buffer[offset-2][bd])+(1<<(exp-1)))>>exp), ((QMF_RE(buffer[offset-2][bd])+(1<<(exp-1)))>>exp)); +#else + for (j = offset; j < len + offset; j++) + { + r01 += QMF_RE(buffer[j][bd]) * QMF_RE(buffer[j-1][bd]); + r02 += QMF_RE(buffer[j][bd]) * QMF_RE(buffer[j-2][bd]); + r11 += QMF_RE(buffer[j-1][bd]) * QMF_RE(buffer[j-1][bd]); + } + RE(ac->r12) = r01 - + QMF_RE(buffer[len+offset-1][bd]) * QMF_RE(buffer[len+offset-2][bd]) + + QMF_RE(buffer[offset-1][bd]) * QMF_RE(buffer[offset-2][bd]); + RE(ac->r22) = r11 - + QMF_RE(buffer[len+offset-2][bd]) * QMF_RE(buffer[len+offset-2][bd]) + + QMF_RE(buffer[offset-2][bd]) * QMF_RE(buffer[offset-2][bd]); +#endif + RE(ac->r01) = r01; + RE(ac->r02) = r02; + RE(ac->r11) = r11; + + ac->det = MUL_R(RE(ac->r11), RE(ac->r22)) - MUL_F(MUL_R(RE(ac->r12), RE(ac->r12)), rel); +} +#else +static void auto_correlation(sbr_info *sbr, acorr_coef *ac, qmf_t buffer[MAX_NTSRHFG][64], + uint8_t bd, uint8_t len) +{ + real_t r01r = 0, r01i = 0, r02r = 0, r02i = 0, r11r = 0; + real_t temp1_r, temp1_i, temp2_r, temp2_i, temp3_r, temp3_i, temp4_r, temp4_i, temp5_r, temp5_i; +#ifdef FIXED_POINT + const real_t rel = FRAC_CONST(0.999999); // 1 / (1 + 1e-6f); + uint32_t mask, exp; + real_t pow2_to_exp; +#else + const real_t rel = 1 / (1 + 1e-6f); +#endif + int8_t j; + uint8_t offset = sbr->tHFAdj; + +#ifdef FIXED_POINT + mask = 0; + + for (j = (offset-2); j < (len + offset); j++) + { + real_t x; + x = QMF_RE(buffer[j][bd])>>REAL_BITS; + mask |= x ^ (x >> 31); + x = QMF_IM(buffer[j][bd])>>REAL_BITS; + mask |= x ^ (x >> 31); + } + + exp = wl_min_lzc(mask); + + /* improves accuracy */ + if (exp > 0) + exp -= 1; + + pow2_to_exp = 1<<(exp-1); + + temp2_r = (QMF_RE(buffer[offset-2][bd]) + pow2_to_exp) >> exp; + temp2_i = (QMF_IM(buffer[offset-2][bd]) + pow2_to_exp) >> exp; + temp3_r = (QMF_RE(buffer[offset-1][bd]) + pow2_to_exp) >> exp; + temp3_i = (QMF_IM(buffer[offset-1][bd]) + pow2_to_exp) >> exp; + // Save these because they are needed after loop + temp4_r = temp2_r; + temp4_i = temp2_i; + temp5_r = temp3_r; + temp5_i = temp3_i; + + for (j = offset; j < len + offset; j++) + { + temp1_r = temp2_r; // temp1_r = (QMF_RE(buffer[offset-2][bd] + (1<<(exp-1))) >> exp; + temp1_i = temp2_i; // temp1_i = (QMF_IM(buffer[offset-2][bd] + (1<<(exp-1))) >> exp; + temp2_r = temp3_r; // temp2_r = (QMF_RE(buffer[offset-1][bd] + (1<<(exp-1))) >> exp; + temp2_i = temp3_i; // temp2_i = (QMF_IM(buffer[offset-1][bd] + (1<<(exp-1))) >> exp; + temp3_r = (QMF_RE(buffer[j][bd]) + pow2_to_exp) >> exp; + temp3_i = (QMF_IM(buffer[j][bd]) + pow2_to_exp) >> exp; + r01r += MUL_R(temp3_r, temp2_r) + MUL_R(temp3_i, temp2_i); + r01i += MUL_R(temp3_i, temp2_r) - MUL_R(temp3_r, temp2_i); + r02r += MUL_R(temp3_r, temp1_r) + MUL_R(temp3_i, temp1_i); + r02i += MUL_R(temp3_i, temp1_r) - MUL_R(temp3_r, temp1_i); + r11r += MUL_R(temp2_r, temp2_r) + MUL_R(temp2_i, temp2_i); + } + + // These are actual values in temporary variable at this point + // temp1_r = (QMF_RE(buffer[len+offset-1-2][bd] + (1<<(exp-1))) >> exp; + // temp1_i = (QMF_IM(buffer[len+offset-1-2][bd] + (1<<(exp-1))) >> exp; + // temp2_r = (QMF_RE(buffer[len+offset-1-1][bd] + (1<<(exp-1))) >> exp; + // temp2_i = (QMF_IM(buffer[len+offset-1-1][bd] + (1<<(exp-1))) >> exp; + // temp3_r = (QMF_RE(buffer[len+offset-1][bd]) + (1<<(exp-1))) >> exp; + // temp3_i = (QMF_IM(buffer[len+offset-1][bd]) + (1<<(exp-1))) >> exp; + // temp4_r = (QMF_RE(buffer[offset-2][bd]) + (1<<(exp-1))) >> exp; + // temp4_i = (QMF_IM(buffer[offset-2][bd]) + (1<<(exp-1))) >> exp; + // temp5_r = (QMF_RE(buffer[offset-1][bd]) + (1<<(exp-1))) >> exp; + // temp5_i = (QMF_IM(buffer[offset-1][bd]) + (1<<(exp-1))) >> exp; + + RE(ac->r12) = r01r - + (MUL_R(temp3_r, temp2_r) + MUL_R(temp3_i, temp2_i)) + + (MUL_R(temp5_r, temp4_r) + MUL_R(temp5_i, temp4_i)); + IM(ac->r12) = r01i - + (MUL_R(temp3_i, temp2_r) - MUL_R(temp3_r, temp2_i)) + + (MUL_R(temp5_i, temp4_r) - MUL_R(temp5_r, temp4_i)); + RE(ac->r22) = r11r - + (MUL_R(temp2_r, temp2_r) + MUL_R(temp2_i, temp2_i)) + + (MUL_R(temp4_r, temp4_r) + MUL_R(temp4_i, temp4_i)); + +#else + + temp2_r = QMF_RE(buffer[offset-2][bd]); + temp2_i = QMF_IM(buffer[offset-2][bd]); + temp3_r = QMF_RE(buffer[offset-1][bd]); + temp3_i = QMF_IM(buffer[offset-1][bd]); + // Save these because they are needed after loop + temp4_r = temp2_r; + temp4_i = temp2_i; + temp5_r = temp3_r; + temp5_i = temp3_i; + + for (j = offset; j < len + offset; j++) + { + temp1_r = temp2_r; // temp1_r = QMF_RE(buffer[j-2][bd]; + temp1_i = temp2_i; // temp1_i = QMF_IM(buffer[j-2][bd]; + temp2_r = temp3_r; // temp2_r = QMF_RE(buffer[j-1][bd]; + temp2_i = temp3_i; // temp2_i = QMF_IM(buffer[j-1][bd]; + temp3_r = QMF_RE(buffer[j][bd]); + temp3_i = QMF_IM(buffer[j][bd]); + r01r += temp3_r * temp2_r + temp3_i * temp2_i; + r01i += temp3_i * temp2_r - temp3_r * temp2_i; + r02r += temp3_r * temp1_r + temp3_i * temp1_i; + r02i += temp3_i * temp1_r - temp3_r * temp1_i; + r11r += temp2_r * temp2_r + temp2_i * temp2_i; + } + + // These are actual values in temporary variable at this point + // temp1_r = QMF_RE(buffer[len+offset-1-2][bd]; + // temp1_i = QMF_IM(buffer[len+offset-1-2][bd]; + // temp2_r = QMF_RE(buffer[len+offset-1-1][bd]; + // temp2_i = QMF_IM(buffer[len+offset-1-1][bd]; + // temp3_r = QMF_RE(buffer[len+offset-1][bd]); + // temp3_i = QMF_IM(buffer[len+offset-1][bd]); + // temp4_r = QMF_RE(buffer[offset-2][bd]); + // temp4_i = QMF_IM(buffer[offset-2][bd]); + // temp5_r = QMF_RE(buffer[offset-1][bd]); + // temp5_i = QMF_IM(buffer[offset-1][bd]); + + RE(ac->r12) = r01r - + (temp3_r * temp2_r + temp3_i * temp2_i) + + (temp5_r * temp4_r + temp5_i * temp4_i); + IM(ac->r12) = r01i - + (temp3_i * temp2_r - temp3_r * temp2_i) + + (temp5_i * temp4_r - temp5_r * temp4_i); + RE(ac->r22) = r11r - + (temp2_r * temp2_r + temp2_i * temp2_i) + + (temp4_r * temp4_r + temp4_i * temp4_i); + +#endif + + RE(ac->r01) = r01r; + IM(ac->r01) = r01i; + RE(ac->r02) = r02r; + IM(ac->r02) = r02i; + RE(ac->r11) = r11r; + + ac->det = MUL_R(RE(ac->r11), RE(ac->r22)) - MUL_F(rel, (MUL_R(RE(ac->r12), RE(ac->r12)) + MUL_R(IM(ac->r12), IM(ac->r12)))); +} +#endif + +/* calculate linear prediction coefficients using the covariance method */ +#ifndef SBR_LOW_POWER +static void calc_prediction_coef(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][64], + complex_t *alpha_0, complex_t *alpha_1, uint8_t k) +{ + real_t tmp; + acorr_coef ac; + + auto_correlation(sbr, &ac, Xlow, k, sbr->numTimeSlotsRate + 6); + + if (ac.det == 0) + { + RE(alpha_1[k]) = 0; + IM(alpha_1[k]) = 0; + } else { +#ifdef FIXED_POINT + tmp = (MUL_R(RE(ac.r01), RE(ac.r12)) - MUL_R(IM(ac.r01), IM(ac.r12)) - MUL_R(RE(ac.r02), RE(ac.r11))); + RE(alpha_1[k]) = DIV_R(tmp, ac.det); + tmp = (MUL_R(IM(ac.r01), RE(ac.r12)) + MUL_R(RE(ac.r01), IM(ac.r12)) - MUL_R(IM(ac.r02), RE(ac.r11))); + IM(alpha_1[k]) = DIV_R(tmp, ac.det); +#else + tmp = REAL_CONST(1.0) / ac.det; + RE(alpha_1[k]) = (MUL_R(RE(ac.r01), RE(ac.r12)) - MUL_R(IM(ac.r01), IM(ac.r12)) - MUL_R(RE(ac.r02), RE(ac.r11))) * tmp; + IM(alpha_1[k]) = (MUL_R(IM(ac.r01), RE(ac.r12)) + MUL_R(RE(ac.r01), IM(ac.r12)) - MUL_R(IM(ac.r02), RE(ac.r11))) * tmp; +#endif + } + + if (RE(ac.r11) == 0) + { + RE(alpha_0[k]) = 0; + IM(alpha_0[k]) = 0; + } else { +#ifdef FIXED_POINT + tmp = -(RE(ac.r01) + MUL_R(RE(alpha_1[k]), RE(ac.r12)) + MUL_R(IM(alpha_1[k]), IM(ac.r12))); + RE(alpha_0[k]) = DIV_R(tmp, RE(ac.r11)); + tmp = -(IM(ac.r01) + MUL_R(IM(alpha_1[k]), RE(ac.r12)) - MUL_R(RE(alpha_1[k]), IM(ac.r12))); + IM(alpha_0[k]) = DIV_R(tmp, RE(ac.r11)); +#else + tmp = 1.0f / RE(ac.r11); + RE(alpha_0[k]) = -(RE(ac.r01) + MUL_R(RE(alpha_1[k]), RE(ac.r12)) + MUL_R(IM(alpha_1[k]), IM(ac.r12))) * tmp; + IM(alpha_0[k]) = -(IM(ac.r01) + MUL_R(IM(alpha_1[k]), RE(ac.r12)) - MUL_R(RE(alpha_1[k]), IM(ac.r12))) * tmp; +#endif + } + + if ((MUL_R(RE(alpha_0[k]),RE(alpha_0[k])) + MUL_R(IM(alpha_0[k]),IM(alpha_0[k])) >= REAL_CONST(16)) || + (MUL_R(RE(alpha_1[k]),RE(alpha_1[k])) + MUL_R(IM(alpha_1[k]),IM(alpha_1[k])) >= REAL_CONST(16))) + { + RE(alpha_0[k]) = 0; + IM(alpha_0[k]) = 0; + RE(alpha_1[k]) = 0; + IM(alpha_1[k]) = 0; + } +} +#else +static void calc_prediction_coef_lp(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][64], + complex_t *alpha_0, complex_t *alpha_1, real_t *rxx) +{ + uint8_t k; + real_t tmp; + acorr_coef ac; + + for (k = 1; k < sbr->f_master[0]; k++) + { + auto_correlation(sbr, &ac, Xlow, k, sbr->numTimeSlotsRate + 6); + + if (ac.det == 0) + { + RE(alpha_0[k]) = 0; + RE(alpha_1[k]) = 0; + } else { + tmp = MUL_R(RE(ac.r01), RE(ac.r22)) - MUL_R(RE(ac.r12), RE(ac.r02)); + RE(alpha_0[k]) = DIV_R(tmp, (-ac.det)); + + tmp = MUL_R(RE(ac.r01), RE(ac.r12)) - MUL_R(RE(ac.r02), RE(ac.r11)); + RE(alpha_1[k]) = DIV_R(tmp, ac.det); + } + + if ((RE(alpha_0[k]) >= REAL_CONST(4)) || (RE(alpha_1[k]) >= REAL_CONST(4))) + { + RE(alpha_0[k]) = REAL_CONST(0); + RE(alpha_1[k]) = REAL_CONST(0); + } + + /* reflection coefficient */ + if (RE(ac.r11) == 0) + { + rxx[k] = COEF_CONST(0.0); + } else { + rxx[k] = DIV_C(RE(ac.r01), RE(ac.r11)); + rxx[k] = -rxx[k]; + if (rxx[k] > COEF_CONST(1.0)) rxx[k] = COEF_CONST(1.0); + if (rxx[k] < COEF_CONST(-1.0)) rxx[k] = COEF_CONST(-1.0); + } + } +} + +static void calc_aliasing_degree(sbr_info *sbr, real_t *rxx, real_t *deg) +{ + uint8_t k; + + rxx[0] = COEF_CONST(0.0); + deg[1] = COEF_CONST(0.0); + + for (k = 2; k < sbr->k0; k++) + { + deg[k] = 0.0; + + if ((k % 2 == 0) && (rxx[k] < COEF_CONST(0.0))) + { + if (rxx[k-1] < 0.0) + { + deg[k] = COEF_CONST(1.0); + + if (rxx[k-2] > COEF_CONST(0.0)) + { + deg[k-1] = COEF_CONST(1.0) - MUL_C(rxx[k-1], rxx[k-1]); + } + } else if (rxx[k-2] > COEF_CONST(0.0)) { + deg[k] = COEF_CONST(1.0) - MUL_C(rxx[k-1], rxx[k-1]); + } + } + + if ((k % 2 == 1) && (rxx[k] > COEF_CONST(0.0))) + { + if (rxx[k-1] > COEF_CONST(0.0)) + { + deg[k] = COEF_CONST(1.0); + + if (rxx[k-2] < COEF_CONST(0.0)) + { + deg[k-1] = COEF_CONST(1.0) - MUL_C(rxx[k-1], rxx[k-1]); + } + } else if (rxx[k-2] < COEF_CONST(0.0)) { + deg[k] = COEF_CONST(1.0) - MUL_C(rxx[k-1], rxx[k-1]); + } + } + } +} +#endif + +/* FIXED POINT: bwArray = COEF */ +static real_t mapNewBw(uint8_t invf_mode, uint8_t invf_mode_prev) +{ + switch (invf_mode) + { + case 1: /* LOW */ + if (invf_mode_prev == 0) /* NONE */ + return COEF_CONST(0.6); + else + return COEF_CONST(0.75); + + case 2: /* MID */ + return COEF_CONST(0.9); + + case 3: /* HIGH */ + return COEF_CONST(0.98); + + default: /* NONE */ + if (invf_mode_prev == 1) /* LOW */ + return COEF_CONST(0.6); + else + return COEF_CONST(0.0); + } +} + +/* FIXED POINT: bwArray = COEF */ +static void calc_chirp_factors(sbr_info *sbr, uint8_t ch) +{ + uint8_t i; + + for (i = 0; i < sbr->N_Q; i++) + { + sbr->bwArray[ch][i] = mapNewBw(sbr->bs_invf_mode[ch][i], sbr->bs_invf_mode_prev[ch][i]); + + if (sbr->bwArray[ch][i] < sbr->bwArray_prev[ch][i]) + sbr->bwArray[ch][i] = MUL_F(sbr->bwArray[ch][i], FRAC_CONST(0.75)) + MUL_F(sbr->bwArray_prev[ch][i], FRAC_CONST(0.25)); + else + sbr->bwArray[ch][i] = MUL_F(sbr->bwArray[ch][i], FRAC_CONST(0.90625)) + MUL_F(sbr->bwArray_prev[ch][i], FRAC_CONST(0.09375)); + + if (sbr->bwArray[ch][i] < COEF_CONST(0.015625)) + sbr->bwArray[ch][i] = COEF_CONST(0.0); + + if (sbr->bwArray[ch][i] >= COEF_CONST(0.99609375)) + sbr->bwArray[ch][i] = COEF_CONST(0.99609375); + + sbr->bwArray_prev[ch][i] = sbr->bwArray[ch][i]; + sbr->bs_invf_mode_prev[ch][i] = sbr->bs_invf_mode[ch][i]; + } +} + +static void patch_construction(sbr_info *sbr) +{ + uint8_t i, k; + uint8_t odd, sb; + uint8_t msb = sbr->k0; + uint8_t usb = sbr->kx; + uint8_t goalSbTab[] = { 21, 23, 32, 43, 46, 64, 85, 93, 128, 0, 0, 0 }; + /* (uint8_t)(2.048e6/sbr->sample_rate + 0.5); */ + uint8_t goalSb = goalSbTab[get_sr_index(sbr->sample_rate)]; + + sbr->noPatches = 0; + + if (goalSb < (sbr->kx + sbr->M)) + { + for (i = 0, k = 0; sbr->f_master[i] < goalSb; i++) + k = i+1; + } else { + k = sbr->N_master; + } + + if (sbr->N_master == 0) + { + sbr->noPatches = 0; + sbr->patchNoSubbands[0] = 0; + sbr->patchStartSubband[0] = 0; + + return; + } + + do + { + uint8_t j = k + 1; + + do + { + j--; + + sb = sbr->f_master[j]; + odd = (sb - 2 + sbr->k0) % 2; + } while (sb > (sbr->k0 - 1 + msb - odd)); + + sbr->patchNoSubbands[sbr->noPatches] = max(sb - usb, 0); + sbr->patchStartSubband[sbr->noPatches] = sbr->k0 - odd - + sbr->patchNoSubbands[sbr->noPatches]; + + if (sbr->patchNoSubbands[sbr->noPatches] > 0) + { + usb = sb; + msb = sb; + sbr->noPatches++; + } else { + msb = sbr->kx; + } + + if (sbr->f_master[k] - sb < 3) + k = sbr->N_master; + } while (sb != (sbr->kx + sbr->M)); + + if ((sbr->patchNoSubbands[sbr->noPatches-1] < 3) && (sbr->noPatches > 1)) + { + sbr->noPatches--; + } + + sbr->noPatches = min(sbr->noPatches, 5); +} + +#endif diff --git a/Libraries/FAAD2/Files/libfaad/sbr_hfgen.h b/Libraries/FAAD2/Files/libfaad/sbr_hfgen.h new file mode 100644 index 000000000..8510004f6 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/sbr_hfgen.h @@ -0,0 +1,46 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#ifndef __SBR_HFGEN_H__ +#define __SBR_HFGEN_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +void hf_generation(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][64], + qmf_t Xhigh[MAX_NTSRHFG][64] +#ifdef SBR_LOW_POWER + ,real_t *deg +#endif + ,uint8_t ch); + +#ifdef __cplusplus +} +#endif +#endif + diff --git a/Libraries/FAAD2/Files/libfaad/sbr_huff.c b/Libraries/FAAD2/Files/libfaad/sbr_huff.c new file mode 100644 index 000000000..92fe07a39 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/sbr_huff.c @@ -0,0 +1,357 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#include "common.h" +#include "structs.h" + +#ifdef SBR_DEC + +#include "sbr_syntax.h" +#include "bits.h" +#include "sbr_huff.h" +#include "sbr_e_nf.h" + + +typedef const int8_t (*sbr_huff_tab)[2]; + +static const int8_t t_huffman_env_1_5dB[120][2] = { + { 1, 2 }, { -64, -65 }, { 3, 4 }, { -63, -66 }, + { 5, 6 }, { -62, -67 }, { 7, 8 }, { -61, -68 }, + { 9, 10 }, { -60, -69 }, { 11, 12 }, { -59, -70 }, + { 13, 14 }, { -58, -71 }, { 15, 16 }, { -57, -72 }, + { 17, 18 }, { -73, -56 }, { 19, 21 }, { -74, 20 }, + { -55, -75 }, { 22, 26 }, { 23, 24 }, { -54, -76 }, + { -77, 25 }, { -53, -78 }, { 27, 34 }, { 28, 29 }, + { -52, -79 }, { 30, 31 }, { -80, -51 }, { 32, 33 }, + { -83, -82 }, { -81, -50 }, { 35, 57 }, { 36, 40 }, + { 37, 38 }, { -88, -84 }, { -48, 39 }, { -90, -85 }, + { 41, 46 }, { 42, 43 }, { -49, -87 }, { 44, 45 }, + { -89, -86 }, {-124,-123 }, { 47, 50 }, { 48, 49 }, + {-122,-121 }, {-120,-119 }, { 51, 54 }, { 52, 53 }, + {-118,-117 }, {-116,-115 }, { 55, 56 }, {-114,-113 }, + {-112,-111 }, { 58, 89 }, { 59, 74 }, { 60, 67 }, + { 61, 64 }, { 62, 63 }, {-110,-109 }, {-108,-107 }, + { 65, 66 }, {-106,-105 }, {-104,-103 }, { 68, 71 }, + { 69, 70 }, {-102,-101 }, {-100, -99 }, { 72, 73 }, + { -98, -97 }, { -96, -95 }, { 75, 82 }, { 76, 79 }, + { 77, 78 }, { -94, -93 }, { -92, -91 }, { 80, 81 }, + { -47, -46 }, { -45, -44 }, { 83, 86 }, { 84, 85 }, + { -43, -42 }, { -41, -40 }, { 87, 88 }, { -39, -38 }, + { -37, -36 }, { 90, 105 }, { 91, 98 }, { 92, 95 }, + { 93, 94 }, { -35, -34 }, { -33, -32 }, { 96, 97 }, + { -31, -30 }, { -29, -28 }, { 99, 102 }, { 100, 101 }, + { -27, -26 }, { -25, -24 }, { 103, 104 }, { -23, -22 }, + { -21, -20 }, { 106, 113 }, { 107, 110 }, { 108, 109 }, + { -19, -18 }, { -17, -16 }, { 111, 112 }, { -15, -14 }, + { -13, -12 }, { 114, 117 }, { 115, 116 }, { -11, -10 }, + { -9, -8 }, { 118, 119 }, { -7, -6 }, { -5, -4 } +}; + +static const int8_t f_huffman_env_1_5dB[120][2] = { + { 1, 2 }, { -64, -65 }, { 3, 4 }, { -63, -66 }, + { 5, 6 }, { -67, -62 }, { 7, 8 }, { -68, -61 }, + { 9, 10 }, { -69, -60 }, { 11, 13 }, { -70, 12 }, + { -59, -71 }, { 14, 16 }, { -58, 15 }, { -72, -57 }, + { 17, 19 }, { -73, 18 }, { -56, -74 }, { 20, 23 }, + { 21, 22 }, { -55, -75 }, { -54, -53 }, { 24, 27 }, + { 25, 26 }, { -76, -52 }, { -77, -51 }, { 28, 31 }, + { 29, 30 }, { -50, -78 }, { -79, -49 }, { 32, 36 }, + { 33, 34 }, { -48, -47 }, { -80, 35 }, { -81, -82 }, + { 37, 47 }, { 38, 41 }, { 39, 40 }, { -83, -46 }, + { -45, -84 }, { 42, 44 }, { -85, 43 }, { -44, -43 }, + { 45, 46 }, { -88, -87 }, { -86, -90 }, { 48, 66 }, + { 49, 56 }, { 50, 53 }, { 51, 52 }, { -92, -42 }, + { -41, -39 }, { 54, 55 }, {-105, -89 }, { -38, -37 }, + { 57, 60 }, { 58, 59 }, { -94, -91 }, { -40, -36 }, + { 61, 63 }, { -20, 62 }, {-115,-110 }, { 64, 65 }, + {-108,-107 }, {-101, -97 }, { 67, 89 }, { 68, 75 }, + { 69, 72 }, { 70, 71 }, { -95, -93 }, { -34, -27 }, + { 73, 74 }, { -22, -17 }, { -16,-124 }, { 76, 82 }, + { 77, 79 }, {-123, 78 }, {-122,-121 }, { 80, 81 }, + {-120,-119 }, {-118,-117 }, { 83, 86 }, { 84, 85 }, + {-116,-114 }, {-113,-112 }, { 87, 88 }, {-111,-109 }, + {-106,-104 }, { 90, 105 }, { 91, 98 }, { 92, 95 }, + { 93, 94 }, {-103,-102 }, {-100, -99 }, { 96, 97 }, + { -98, -96 }, { -35, -33 }, { 99, 102 }, { 100, 101 }, + { -32, -31 }, { -30, -29 }, { 103, 104 }, { -28, -26 }, + { -25, -24 }, { 106, 113 }, { 107, 110 }, { 108, 109 }, + { -23, -21 }, { -19, -18 }, { 111, 112 }, { -15, -14 }, + { -13, -12 }, { 114, 117 }, { 115, 116 }, { -11, -10 }, + { -9, -8 }, { 118, 119 }, { -7, -6 }, { -5, -4 } +}; + +static const int8_t t_huffman_env_bal_1_5dB[48][2] = { + { -64, 1 }, { -63, 2 }, { -65, 3 }, { -62, 4 }, + { -66, 5 }, { -61, 6 }, { -67, 7 }, { -60, 8 }, + { -68, 9 }, { 10, 11 }, { -69, -59 }, { 12, 13 }, + { -70, -58 }, { 14, 28 }, { 15, 21 }, { 16, 18 }, + { -57, 17 }, { -71, -56 }, { 19, 20 }, { -88, -87 }, + { -86, -85 }, { 22, 25 }, { 23, 24 }, { -84, -83 }, + { -82, -81 }, { 26, 27 }, { -80, -79 }, { -78, -77 }, + { 29, 36 }, { 30, 33 }, { 31, 32 }, { -76, -75 }, + { -74, -73 }, { 34, 35 }, { -72, -55 }, { -54, -53 }, + { 37, 41 }, { 38, 39 }, { -52, -51 }, { -50, 40 }, + { -49, -48 }, { 42, 45 }, { 43, 44 }, { -47, -46 }, + { -45, -44 }, { 46, 47 }, { -43, -42 }, { -41, -40 } +}; + +static const int8_t f_huffman_env_bal_1_5dB[48][2] = { + { -64, 1 }, { -65, 2 }, { -63, 3 }, { -66, 4 }, + { -62, 5 }, { -61, 6 }, { -67, 7 }, { -68, 8 }, + { -60, 9 }, { 10, 11 }, { -69, -59 }, { -70, 12 }, + { -58, 13 }, { 14, 17 }, { -71, 15 }, { -57, 16 }, + { -56, -73 }, { 18, 32 }, { 19, 25 }, { 20, 22 }, + { -72, 21 }, { -88, -87 }, { 23, 24 }, { -86, -85 }, + { -84, -83 }, { 26, 29 }, { 27, 28 }, { -82, -81 }, + { -80, -79 }, { 30, 31 }, { -78, -77 }, { -76, -75 }, + { 33, 40 }, { 34, 37 }, { 35, 36 }, { -74, -55 }, + { -54, -53 }, { 38, 39 }, { -52, -51 }, { -50, -49 }, + { 41, 44 }, { 42, 43 }, { -48, -47 }, { -46, -45 }, + { 45, 46 }, { -44, -43 }, { -42, 47 }, { -41, -40 } +}; + +static const int8_t t_huffman_env_3_0dB[62][2] = { + { -64, 1 }, { -65, 2 }, { -63, 3 }, { -66, 4 }, + { -62, 5 }, { -67, 6 }, { -61, 7 }, { -68, 8 }, + { -60, 9 }, { 10, 11 }, { -69, -59 }, { 12, 14 }, + { -70, 13 }, { -71, -58 }, { 15, 18 }, { 16, 17 }, + { -72, -57 }, { -73, -74 }, { 19, 22 }, { -56, 20 }, + { -55, 21 }, { -54, -77 }, { 23, 31 }, { 24, 25 }, + { -75, -76 }, { 26, 27 }, { -78, -53 }, { 28, 29 }, + { -52, -95 }, { -94, 30 }, { -93, -92 }, { 32, 47 }, + { 33, 40 }, { 34, 37 }, { 35, 36 }, { -91, -90 }, + { -89, -88 }, { 38, 39 }, { -87, -86 }, { -85, -84 }, + { 41, 44 }, { 42, 43 }, { -83, -82 }, { -81, -80 }, + { 45, 46 }, { -79, -51 }, { -50, -49 }, { 48, 55 }, + { 49, 52 }, { 50, 51 }, { -48, -47 }, { -46, -45 }, + { 53, 54 }, { -44, -43 }, { -42, -41 }, { 56, 59 }, + { 57, 58 }, { -40, -39 }, { -38, -37 }, { 60, 61 }, + { -36, -35 }, { -34, -33 } +}; + +static const int8_t f_huffman_env_3_0dB[62][2] = { + { -64, 1 }, { -65, 2 }, { -63, 3 }, { -66, 4 }, + { -62, 5 }, { -67, 6 }, { 7, 8 }, { -61, -68 }, + { 9, 10 }, { -60, -69 }, { 11, 12 }, { -59, -70 }, + { 13, 14 }, { -58, -71 }, { 15, 16 }, { -57, -72 }, + { 17, 19 }, { -56, 18 }, { -55, -73 }, { 20, 24 }, + { 21, 22 }, { -74, -54 }, { -53, 23 }, { -75, -76 }, + { 25, 30 }, { 26, 27 }, { -52, -51 }, { 28, 29 }, + { -77, -79 }, { -50, -49 }, { 31, 39 }, { 32, 35 }, + { 33, 34 }, { -78, -46 }, { -82, -88 }, { 36, 37 }, + { -83, -48 }, { -47, 38 }, { -86, -85 }, { 40, 47 }, + { 41, 44 }, { 42, 43 }, { -80, -44 }, { -43, -42 }, + { 45, 46 }, { -39, -87 }, { -84, -40 }, { 48, 55 }, + { 49, 52 }, { 50, 51 }, { -95, -94 }, { -93, -92 }, + { 53, 54 }, { -91, -90 }, { -89, -81 }, { 56, 59 }, + { 57, 58 }, { -45, -41 }, { -38, -37 }, { 60, 61 }, + { -36, -35 }, { -34, -33 } +}; + +static const int8_t t_huffman_env_bal_3_0dB[24][2] = { + { -64, 1 }, { -63, 2 }, { -65, 3 }, { -66, 4 }, + { -62, 5 }, { -61, 6 }, { -67, 7 }, { -68, 8 }, + { -60, 9 }, { 10, 16 }, { 11, 13 }, { -69, 12 }, + { -76, -75 }, { 14, 15 }, { -74, -73 }, { -72, -71 }, + { 17, 20 }, { 18, 19 }, { -70, -59 }, { -58, -57 }, + { 21, 22 }, { -56, -55 }, { -54, 23 }, { -53, -52 } +}; + +static const int8_t f_huffman_env_bal_3_0dB[24][2] = { + { -64, 1 }, { -65, 2 }, { -63, 3 }, { -66, 4 }, + { -62, 5 }, { -61, 6 }, { -67, 7 }, { -68, 8 }, + { -60, 9 }, { 10, 13 }, { -69, 11 }, { -59, 12 }, + { -58, -76 }, { 14, 17 }, { 15, 16 }, { -75, -74 }, + { -73, -72 }, { 18, 21 }, { 19, 20 }, { -71, -70 }, + { -57, -56 }, { 22, 23 }, { -55, -54 }, { -53, -52 } +}; + +static const int8_t t_huffman_noise_3_0dB[62][2] = { + { -64, 1 }, { -63, 2 }, { -65, 3 }, { -66, 4 }, + { -62, 5 }, { -67, 6 }, { 7, 8 }, { -61, -68 }, + { 9, 30 }, { 10, 15 }, { -60, 11 }, { -69, 12 }, + { 13, 14 }, { -59, -53 }, { -95, -94 }, { 16, 23 }, + { 17, 20 }, { 18, 19 }, { -93, -92 }, { -91, -90 }, + { 21, 22 }, { -89, -88 }, { -87, -86 }, { 24, 27 }, + { 25, 26 }, { -85, -84 }, { -83, -82 }, { 28, 29 }, + { -81, -80 }, { -79, -78 }, { 31, 46 }, { 32, 39 }, + { 33, 36 }, { 34, 35 }, { -77, -76 }, { -75, -74 }, + { 37, 38 }, { -73, -72 }, { -71, -70 }, { 40, 43 }, + { 41, 42 }, { -58, -57 }, { -56, -55 }, { 44, 45 }, + { -54, -52 }, { -51, -50 }, { 47, 54 }, { 48, 51 }, + { 49, 50 }, { -49, -48 }, { -47, -46 }, { 52, 53 }, + { -45, -44 }, { -43, -42 }, { 55, 58 }, { 56, 57 }, + { -41, -40 }, { -39, -38 }, { 59, 60 }, { -37, -36 }, + { -35, 61 }, { -34, -33 } +}; + +static const int8_t t_huffman_noise_bal_3_0dB[24][2] = { + { -64, 1 }, { -65, 2 }, { -63, 3 }, { 4, 9 }, + { -66, 5 }, { -62, 6 }, { 7, 8 }, { -76, -75 }, + { -74, -73 }, { 10, 17 }, { 11, 14 }, { 12, 13 }, + { -72, -71 }, { -70, -69 }, { 15, 16 }, { -68, -67 }, + { -61, -60 }, { 18, 21 }, { 19, 20 }, { -59, -58 }, + { -57, -56 }, { 22, 23 }, { -55, -54 }, { -53, -52 } +}; + + +static INLINE int16_t sbr_huff_dec(bitfile *ld, sbr_huff_tab t_huff) +{ + uint8_t bit; + int16_t index = 0; + + while (index >= 0) + { + bit = (uint8_t)faad_get1bit(ld); + index = t_huff[index][bit]; + } + + return index + 64; +} + +/* table 10 */ +void sbr_envelope(bitfile *ld, sbr_info *sbr, uint8_t ch) +{ + uint8_t env, band; + int8_t delta = 0; + sbr_huff_tab t_huff, f_huff; + + if ((sbr->L_E[ch] == 1) && (sbr->bs_frame_class[ch] == FIXFIX)) + sbr->amp_res[ch] = 0; + else + sbr->amp_res[ch] = sbr->bs_amp_res; + + if ((sbr->bs_coupling) && (ch == 1)) + { + delta = 1; + if (sbr->amp_res[ch]) + { + t_huff = t_huffman_env_bal_3_0dB; + f_huff = f_huffman_env_bal_3_0dB; + } else { + t_huff = t_huffman_env_bal_1_5dB; + f_huff = f_huffman_env_bal_1_5dB; + } + } else { + delta = 0; + if (sbr->amp_res[ch]) + { + t_huff = t_huffman_env_3_0dB; + f_huff = f_huffman_env_3_0dB; + } else { + t_huff = t_huffman_env_1_5dB; + f_huff = f_huffman_env_1_5dB; + } + } + + for (env = 0; env < sbr->L_E[ch]; env++) + { + if (sbr->bs_df_env[ch][env] == 0) + { + if ((sbr->bs_coupling == 1) && (ch == 1)) + { + if (sbr->amp_res[ch]) + { + sbr->E[ch][0][env] = (uint16_t)(faad_getbits(ld, 5 + DEBUGVAR(1,272,"sbr_envelope(): bs_data_env")) << delta); + } else { + sbr->E[ch][0][env] = (uint16_t)(faad_getbits(ld, 6 + DEBUGVAR(1,273,"sbr_envelope(): bs_data_env")) << delta); + } + } else { + if (sbr->amp_res[ch]) + { + sbr->E[ch][0][env] = (uint16_t)(faad_getbits(ld, 6 + DEBUGVAR(1,274,"sbr_envelope(): bs_data_env")) << delta); + } else { + sbr->E[ch][0][env] = (uint16_t)(faad_getbits(ld, 7 + DEBUGVAR(1,275,"sbr_envelope(): bs_data_env")) << delta); + } + } + + for (band = 1; band < sbr->n[sbr->f[ch][env]]; band++) + { + sbr->E[ch][band][env] = (sbr_huff_dec(ld, f_huff) << delta); + } + + } else { + for (band = 0; band < sbr->n[sbr->f[ch][env]]; band++) + { + sbr->E[ch][band][env] = (sbr_huff_dec(ld, t_huff) << delta); + } + } + } + + extract_envelope_data(sbr, ch); +} + +/* table 11 */ +void sbr_noise(bitfile *ld, sbr_info *sbr, uint8_t ch) +{ + uint8_t noise, band; + int8_t delta = 0; + sbr_huff_tab t_huff, f_huff; + + if ((sbr->bs_coupling == 1) && (ch == 1)) + { + delta = 1; + t_huff = t_huffman_noise_bal_3_0dB; + f_huff = f_huffman_env_bal_3_0dB; + } else { + delta = 0; + t_huff = t_huffman_noise_3_0dB; + f_huff = f_huffman_env_3_0dB; + } + + for (noise = 0; noise < sbr->L_Q[ch]; noise++) + { + if(sbr->bs_df_noise[ch][noise] == 0) + { + if ((sbr->bs_coupling == 1) && (ch == 1)) + { + sbr->Q[ch][0][noise] = (faad_getbits(ld, 5 + DEBUGVAR(1,276,"sbr_noise(): bs_data_noise")) << delta); + } else { + sbr->Q[ch][0][noise] = (faad_getbits(ld, 5 + DEBUGVAR(1,277,"sbr_noise(): bs_data_noise")) << delta); + } + for (band = 1; band < sbr->N_Q; band++) + { + sbr->Q[ch][band][noise] = (sbr_huff_dec(ld, f_huff) << delta); + } + } else { + for (band = 0; band < sbr->N_Q; band++) + { + sbr->Q[ch][band][noise] = (sbr_huff_dec(ld, t_huff) << delta); + } + } + } + + extract_noise_floor_data(sbr, ch); +} + +#endif diff --git a/Libraries/FAAD2/Files/libfaad/sbr_huff.h b/Libraries/FAAD2/Files/libfaad/sbr_huff.h new file mode 100644 index 000000000..d81c5dc52 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/sbr_huff.h @@ -0,0 +1,43 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#ifndef __SBR_HUFF_H__ +#define __SBR_HUFF_H__ + +#ifdef __cplusplus +extern "C" { +#endif + + +void sbr_envelope(bitfile *ld, sbr_info *sbr, uint8_t ch); +void sbr_noise(bitfile *ld, sbr_info *sbr, uint8_t ch); + +#ifdef __cplusplus +} +#endif +#endif + diff --git a/Libraries/FAAD2/Files/libfaad/sbr_noise.h b/Libraries/FAAD2/Files/libfaad/sbr_noise.h new file mode 100644 index 000000000..73ec5f463 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/sbr_noise.h @@ -0,0 +1,561 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#ifndef __SBR_NOISE_H__ +#define __SBR_NOISE_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef _MSC_VER +#pragma warning(disable:4305) +#pragma warning(disable:4244) +#endif + + +/* Table 1.A.13 Noise table V */ +ALIGN static const complex_t V[] = { + { FRAC_CONST(-0.99948155879974), FRAC_CONST(-0.59483414888382) }, + { FRAC_CONST(0.97113454341888), FRAC_CONST(-0.67528516054153) }, + { FRAC_CONST(0.14130051434040), FRAC_CONST(-0.95090985298157) }, + { FRAC_CONST(-0.47005495429039), FRAC_CONST(-0.37340548634529) }, + { FRAC_CONST(0.80705064535141), FRAC_CONST(0.29653668403625) }, + { FRAC_CONST(-0.38981479406357), FRAC_CONST(0.89572608470917) }, + { FRAC_CONST(-0.01053049881011), FRAC_CONST(-0.66959059238434) }, + { FRAC_CONST(-0.91266369819641), FRAC_CONST(-0.11522938311100) }, + { FRAC_CONST(0.54840421676636), FRAC_CONST(0.75221365690231) }, + { FRAC_CONST(0.40009254217148), FRAC_CONST(-0.98929399251938) }, + { FRAC_CONST(-0.99867975711823), FRAC_CONST(-0.88147068023682) }, + { FRAC_CONST(-0.95531076192856), FRAC_CONST(0.90908759832382) }, + { FRAC_CONST(-0.45725932717323), FRAC_CONST(-0.56716322898865) }, + { FRAC_CONST(-0.72929674386978), FRAC_CONST(-0.98008275032043) }, + { FRAC_CONST(0.75622802972794), FRAC_CONST(0.20950329303741) }, + { FRAC_CONST(0.07069442421198), FRAC_CONST(-0.78247898817062) }, + { FRAC_CONST(0.74496251344681), FRAC_CONST(-0.91169005632401) }, + { FRAC_CONST(-0.96440184116364), FRAC_CONST(-0.94739919900894) }, + { FRAC_CONST(0.30424630641937), FRAC_CONST(-0.49438267946243) }, + { FRAC_CONST(0.66565030813217), FRAC_CONST(0.64652937650681) }, + { FRAC_CONST(0.91697007417679), FRAC_CONST(0.17514097690582) }, + { FRAC_CONST(-0.70774918794632), FRAC_CONST(0.52548652887344) }, + { FRAC_CONST(-0.70051413774490), FRAC_CONST(-0.45340028405190) }, + { FRAC_CONST(-0.99496513605118), FRAC_CONST(-0.90071910619736) }, + { FRAC_CONST(0.98164492845535), FRAC_CONST(-0.77463155984879) }, + { FRAC_CONST(-0.54671579599380), FRAC_CONST(-0.02570928446949) }, + { FRAC_CONST(-0.01689629070461), FRAC_CONST(0.00287506449968) }, + { FRAC_CONST(-0.86110347509384), FRAC_CONST(0.42548584938049) }, + { FRAC_CONST(-0.98892980813980), FRAC_CONST(-0.87881129980087) }, + { FRAC_CONST(0.51756626367569), FRAC_CONST(0.66926783323288) }, + { FRAC_CONST(-0.99635028839111), FRAC_CONST(-0.58107727766037) }, + { FRAC_CONST(-0.99969369173050), FRAC_CONST(0.98369991779327) }, + { FRAC_CONST(0.55266261100769), FRAC_CONST(0.59449058771133) }, + { FRAC_CONST(0.34581178426743), FRAC_CONST(0.94879418611526) }, + { FRAC_CONST(0.62664210796356), FRAC_CONST(-0.74402970075607) }, + { FRAC_CONST(-0.77149701118469), FRAC_CONST(-0.33883658051491) }, + { FRAC_CONST(-0.91592246294022), FRAC_CONST(0.03687901422381) }, + { FRAC_CONST(-0.76285493373871), FRAC_CONST(-0.91371870040894) }, + { FRAC_CONST(0.79788339138031), FRAC_CONST(-0.93180972337723) }, + { FRAC_CONST(0.54473078250885), FRAC_CONST(-0.11919206380844) }, + { FRAC_CONST(-0.85639280080795), FRAC_CONST(0.42429855465889) }, + { FRAC_CONST(-0.92882400751114), FRAC_CONST(0.27871808409691) }, + { FRAC_CONST(-0.11708371341228), FRAC_CONST(-0.99800843000412) }, + { FRAC_CONST(0.21356749534607), FRAC_CONST(-0.90716296434402) }, + { FRAC_CONST(-0.76191693544388), FRAC_CONST(0.99768120050430) }, + { FRAC_CONST(0.98111045360565), FRAC_CONST(-0.95854461193085) }, + { FRAC_CONST(-0.85913270711899), FRAC_CONST(0.95766568183899) }, + { FRAC_CONST(-0.93307244777679), FRAC_CONST(0.49431759119034) }, + { FRAC_CONST(0.30485755205154), FRAC_CONST(-0.70540034770966) }, + { FRAC_CONST(0.85289651155472), FRAC_CONST(0.46766132116318) }, + { FRAC_CONST(0.91328084468842), FRAC_CONST(-0.99839597940445) }, + { FRAC_CONST(-0.05890199914575), FRAC_CONST(0.70741826295853) }, + { FRAC_CONST(0.28398686647415), FRAC_CONST(0.34633556008339) }, + { FRAC_CONST(0.95258164405823), FRAC_CONST(-0.54893416166306) }, + { FRAC_CONST(-0.78566324710846), FRAC_CONST(-0.75568538904190) }, + { FRAC_CONST(-0.95789498090744), FRAC_CONST(-0.20423194766045) }, + { FRAC_CONST(0.82411158084869), FRAC_CONST(0.96654617786407) }, + { FRAC_CONST(-0.65185445547104), FRAC_CONST(-0.88734990358353) }, + { FRAC_CONST(-0.93643605709076), FRAC_CONST(0.99870789051056) }, + { FRAC_CONST(0.91427159309387), FRAC_CONST(-0.98290503025055) }, + { FRAC_CONST(-0.70395684242249), FRAC_CONST(0.58796799182892) }, + { FRAC_CONST(0.00563771976158), FRAC_CONST(0.61768198013306) }, + { FRAC_CONST(0.89065051078796), FRAC_CONST(0.52783352136612) }, + { FRAC_CONST(-0.68683707714081), FRAC_CONST(0.80806946754456) }, + { FRAC_CONST(0.72165340185165), FRAC_CONST(-0.69259858131409) }, + { FRAC_CONST(-0.62928247451782), FRAC_CONST(0.13627037405968) }, + { FRAC_CONST(0.29938435554504), FRAC_CONST(-0.46051329374313) }, + { FRAC_CONST(-0.91781955957413), FRAC_CONST(-0.74012714624405) }, + { FRAC_CONST(0.99298715591431), FRAC_CONST(0.40816611051559) }, + { FRAC_CONST(0.82368296384811), FRAC_CONST(-0.74036049842834) }, + { FRAC_CONST(-0.98512834310532), FRAC_CONST(-0.99972331523895) }, + { FRAC_CONST(-0.95915371179581), FRAC_CONST(-0.99237799644470) }, + { FRAC_CONST(-0.21411126852036), FRAC_CONST(-0.93424820899963) }, + { FRAC_CONST(-0.68821477890015), FRAC_CONST(-0.26892307400703) }, + { FRAC_CONST(0.91851997375488), FRAC_CONST(0.09358228743076) }, + { FRAC_CONST(-0.96062767505646), FRAC_CONST(0.36099094152451) }, + { FRAC_CONST(0.51646184921265), FRAC_CONST(-0.71373331546783) }, + { FRAC_CONST(0.61130720376968), FRAC_CONST(0.46950140595436) }, + { FRAC_CONST(0.47336128354073), FRAC_CONST(-0.27333179116249) }, + { FRAC_CONST(0.90998309850693), FRAC_CONST(0.96715664863586) }, + { FRAC_CONST(0.44844800233841), FRAC_CONST(0.99211573600769) }, + { FRAC_CONST(0.66614890098572), FRAC_CONST(0.96590173244476) }, + { FRAC_CONST(0.74922239780426), FRAC_CONST(-0.89879858493805) }, + { FRAC_CONST(-0.99571585655212), FRAC_CONST(0.52785521745682) }, + { FRAC_CONST(0.97401082515717), FRAC_CONST(-0.16855870187283) }, + { FRAC_CONST(0.72683745622635), FRAC_CONST(-0.48060774803162) }, + { FRAC_CONST(0.95432192087173), FRAC_CONST(0.68849605321884) }, + { FRAC_CONST(-0.72962206602097), FRAC_CONST(-0.76608443260193) }, + { FRAC_CONST(-0.85359477996826), FRAC_CONST(0.88738125562668) }, + { FRAC_CONST(-0.81412428617477), FRAC_CONST(-0.97480767965317) }, + { FRAC_CONST(-0.87930774688721), FRAC_CONST(0.74748307466507) }, + { FRAC_CONST(-0.71573328971863), FRAC_CONST(-0.98570609092712) }, + { FRAC_CONST(0.83524298667908), FRAC_CONST(0.83702534437180) }, + { FRAC_CONST(-0.48086065053940), FRAC_CONST(-0.98848503828049) }, + { FRAC_CONST(0.97139126062393), FRAC_CONST(0.80093622207642) }, + { FRAC_CONST(0.51992827653885), FRAC_CONST(0.80247628688812) }, + { FRAC_CONST(-0.00848591234535), FRAC_CONST(-0.76670128107071) }, + { FRAC_CONST(-0.70294374227524), FRAC_CONST(0.55359911918640) }, + { FRAC_CONST(-0.95894426107407), FRAC_CONST(-0.43265503644943) }, + { FRAC_CONST(0.97079253196716), FRAC_CONST(0.09325857460499) }, + { FRAC_CONST(-0.92404294013977), FRAC_CONST(0.85507702827454) }, + { FRAC_CONST(-0.69506472349167), FRAC_CONST(0.98633414506912) }, + { FRAC_CONST(0.26559203863144), FRAC_CONST(0.73314309120178) }, + { FRAC_CONST(0.28038442134857), FRAC_CONST(0.14537914097309) }, + { FRAC_CONST(-0.74138122797012), FRAC_CONST(0.99310338497162) }, + { FRAC_CONST(-0.01752796024084), FRAC_CONST(-0.82616633176804) }, + { FRAC_CONST(-0.55126774311066), FRAC_CONST(-0.98898541927338) }, + { FRAC_CONST(0.97960901260376), FRAC_CONST(-0.94021445512772) }, + { FRAC_CONST(-0.99196308851242), FRAC_CONST(0.67019015550613) }, + { FRAC_CONST(-0.67684930562973), FRAC_CONST(0.12631492316723) }, + { FRAC_CONST(0.09140039235353), FRAC_CONST(-0.20537731051445) }, + { FRAC_CONST(-0.71658962965012), FRAC_CONST(-0.97788202762604) }, + { FRAC_CONST(0.81014639139175), FRAC_CONST(0.53722649812698) }, + { FRAC_CONST(0.40616992115974), FRAC_CONST(-0.26469007134438) }, + { FRAC_CONST(-0.67680186033249), FRAC_CONST(0.94502049684525) }, + { FRAC_CONST(0.86849772930145), FRAC_CONST(-0.18333598971367) }, + { FRAC_CONST(-0.99500381946564), FRAC_CONST(-0.02634122036397) }, + { FRAC_CONST(0.84329187870026), FRAC_CONST(0.10406957566738) }, + { FRAC_CONST(-0.09215968847275), FRAC_CONST(0.69540011882782) }, + { FRAC_CONST(0.99956172704697), FRAC_CONST(-0.12358541786671) }, + { FRAC_CONST(-0.79732781648636), FRAC_CONST(-0.91582524776459) }, + { FRAC_CONST(0.96349972486496), FRAC_CONST(0.96640455722809) }, + { FRAC_CONST(-0.79942780733109), FRAC_CONST(0.64323902130127) }, + { FRAC_CONST(-0.11566039919853), FRAC_CONST(0.28587844967842) }, + { FRAC_CONST(-0.39922955632210), FRAC_CONST(0.94129604101181) }, + { FRAC_CONST(0.99089199304581), FRAC_CONST(-0.92062628269196) }, + { FRAC_CONST(0.28631284832954), FRAC_CONST(-0.91035044193268) }, + { FRAC_CONST(-0.83302724361420), FRAC_CONST(-0.67330408096313) }, + { FRAC_CONST(0.95404446125031), FRAC_CONST(0.49162766337395) }, + { FRAC_CONST(-0.06449863314629), FRAC_CONST(0.03250560909510) }, + { FRAC_CONST(-0.99575054645538), FRAC_CONST(0.42389783263206) }, + { FRAC_CONST(-0.65501141548157), FRAC_CONST(0.82546114921570) }, + { FRAC_CONST(-0.81254440546036), FRAC_CONST(-0.51627236604691) }, + { FRAC_CONST(-0.99646371603012), FRAC_CONST(0.84490531682968) }, + { FRAC_CONST(0.00287840608507), FRAC_CONST(0.64768260717392) }, + { FRAC_CONST(0.70176988840103), FRAC_CONST(-0.20453028380871) }, + { FRAC_CONST(0.96361881494522), FRAC_CONST(0.40706968307495) }, + { FRAC_CONST(-0.68883758783340), FRAC_CONST(0.91338956356049) }, + { FRAC_CONST(-0.34875586628914), FRAC_CONST(0.71472293138504) }, + { FRAC_CONST(0.91980081796646), FRAC_CONST(0.66507452726364) }, + { FRAC_CONST(-0.99009048938751), FRAC_CONST(0.85868018865585) }, + { FRAC_CONST(0.68865793943405), FRAC_CONST(0.55660319328308) }, + { FRAC_CONST(-0.99484401941299), FRAC_CONST(-0.20052559673786) }, + { FRAC_CONST(0.94214510917664), FRAC_CONST(-0.99696427583694) }, + { FRAC_CONST(-0.67414629459381), FRAC_CONST(0.49548220634460) }, + { FRAC_CONST(-0.47339352965355), FRAC_CONST(-0.85904330015182) }, + { FRAC_CONST(0.14323651790619), FRAC_CONST(-0.94145596027374) }, + { FRAC_CONST(-0.29268294572830), FRAC_CONST(0.05759225040674) }, + { FRAC_CONST(0.43793860077858), FRAC_CONST(-0.78904968500137) }, + { FRAC_CONST(-0.36345127224922), FRAC_CONST(0.64874434471130) }, + { FRAC_CONST(-0.08750604838133), FRAC_CONST(0.97686946392059) }, + { FRAC_CONST(-0.96495270729065), FRAC_CONST(-0.53960305452347) }, + { FRAC_CONST(0.55526942014694), FRAC_CONST(0.78891521692276) }, + { FRAC_CONST(0.73538213968277), FRAC_CONST(0.96452075242996) }, + { FRAC_CONST(-0.30889773368835), FRAC_CONST(-0.80664390325546) }, + { FRAC_CONST(0.03574995696545), FRAC_CONST(-0.97325617074966) }, + { FRAC_CONST(0.98720687627792), FRAC_CONST(0.48409134149551) }, + { FRAC_CONST(-0.81689298152924), FRAC_CONST(-0.90827703475952) }, + { FRAC_CONST(0.67866861820221), FRAC_CONST(0.81284505128860) }, + { FRAC_CONST(-0.15808570384979), FRAC_CONST(0.85279554128647) }, + { FRAC_CONST(0.80723392963409), FRAC_CONST(-0.24717418849468) }, + { FRAC_CONST(0.47788757085800), FRAC_CONST(-0.46333149075508) }, + { FRAC_CONST(0.96367555856705), FRAC_CONST(0.38486748933792) }, + { FRAC_CONST(-0.99143874645233), FRAC_CONST(-0.24945276975632) }, + { FRAC_CONST(0.83081877231598), FRAC_CONST(-0.94780850410461) }, + { FRAC_CONST(-0.58753192424774), FRAC_CONST(0.01290772389621) }, + { FRAC_CONST(0.95538109540939), FRAC_CONST(-0.85557049512863) }, + { FRAC_CONST(-0.96490919589996), FRAC_CONST(-0.64020973443985) }, + { FRAC_CONST(-0.97327101230621), FRAC_CONST(0.12378127872944) }, + { FRAC_CONST(0.91400367021561), FRAC_CONST(0.57972472906113) }, + { FRAC_CONST(-0.99925839900970), FRAC_CONST(0.71084845066071) }, + { FRAC_CONST(-0.86875903606415), FRAC_CONST(-0.20291699469090) }, + { FRAC_CONST(-0.26240035891533), FRAC_CONST(-0.68264555931091) }, + { FRAC_CONST(-0.24664412438869), FRAC_CONST(-0.87642270326614) }, + { FRAC_CONST(0.02416275814176), FRAC_CONST(0.27192914485931) }, + { FRAC_CONST(0.82068622112274), FRAC_CONST(-0.85087788105011) }, + { FRAC_CONST(0.88547372817993), FRAC_CONST(-0.89636802673340) }, + { FRAC_CONST(-0.18173077702522), FRAC_CONST(-0.26152145862579) }, + { FRAC_CONST(0.09355476498604), FRAC_CONST(0.54845124483109) }, + { FRAC_CONST(-0.54668414592743), FRAC_CONST(0.95980775356293) }, + { FRAC_CONST(0.37050989270210), FRAC_CONST(-0.59910142421722) }, + { FRAC_CONST(-0.70373594760895), FRAC_CONST(0.91227668523788) }, + { FRAC_CONST(-0.34600785374641), FRAC_CONST(-0.99441426992416) }, + { FRAC_CONST(-0.68774479627609), FRAC_CONST(-0.30238837003708) }, + { FRAC_CONST(-0.26843291521072), FRAC_CONST(0.83115667104721) }, + { FRAC_CONST(0.49072334170341), FRAC_CONST(-0.45359709858894) }, + { FRAC_CONST(0.38975992798805), FRAC_CONST(0.95515358448029) }, + { FRAC_CONST(-0.97757124900818), FRAC_CONST(0.05305894464254) }, + { FRAC_CONST(-0.17325553297997), FRAC_CONST(-0.92770671844482) }, + { FRAC_CONST(0.99948036670685), FRAC_CONST(0.58285546302795) }, + { FRAC_CONST(-0.64946246147156), FRAC_CONST(0.68645507097244) }, + { FRAC_CONST(-0.12016920745373), FRAC_CONST(-0.57147324085236) }, + { FRAC_CONST(-0.58947455883026), FRAC_CONST(-0.34847131371498) }, + { FRAC_CONST(-0.41815140843391), FRAC_CONST(0.16276422142982) }, + { FRAC_CONST(0.99885648488998), FRAC_CONST(0.11136095225811) }, + { FRAC_CONST(-0.56649613380432), FRAC_CONST(-0.90494865179062) }, + { FRAC_CONST(0.94138020277023), FRAC_CONST(0.35281917452812) }, + { FRAC_CONST(-0.75725078582764), FRAC_CONST(0.53650552034378) }, + { FRAC_CONST(0.20541973412037), FRAC_CONST(-0.94435143470764) }, + { FRAC_CONST(0.99980372190475), FRAC_CONST(0.79835915565491) }, + { FRAC_CONST(0.29078277945518), FRAC_CONST(0.35393777489662) }, + { FRAC_CONST(-0.62858772277832), FRAC_CONST(0.38765692710876) }, + { FRAC_CONST(0.43440905213356), FRAC_CONST(-0.98546332120895) }, + { FRAC_CONST(-0.98298585414886), FRAC_CONST(0.21021524071693) }, + { FRAC_CONST(0.19513028860092), FRAC_CONST(-0.94239830970764) }, + { FRAC_CONST(-0.95476663112640), FRAC_CONST(0.98364555835724) }, + { FRAC_CONST(0.93379634618759), FRAC_CONST(-0.70881992578506) }, + { FRAC_CONST(-0.85235410928726), FRAC_CONST(-0.08342348039150) }, + { FRAC_CONST(-0.86425095796585), FRAC_CONST(-0.45795026421547) }, + { FRAC_CONST(0.38879778981209), FRAC_CONST(0.97274428606033) }, + { FRAC_CONST(0.92045122385025), FRAC_CONST(-0.62433654069901) }, + { FRAC_CONST(0.89162534475327), FRAC_CONST(0.54950958490372) }, + { FRAC_CONST(-0.36834338307381), FRAC_CONST(0.96458297967911) }, + { FRAC_CONST(0.93891763687134), FRAC_CONST(-0.89968353509903) }, + { FRAC_CONST(0.99267655611038), FRAC_CONST(-0.03757034242153) }, + { FRAC_CONST(-0.94063472747803), FRAC_CONST(0.41332337260246) }, + { FRAC_CONST(0.99740225076675), FRAC_CONST(-0.16830494999886) }, + { FRAC_CONST(-0.35899412631989), FRAC_CONST(-0.46633225679398) }, + { FRAC_CONST(0.05237237364054), FRAC_CONST(-0.25640362501144) }, + { FRAC_CONST(0.36703583598137), FRAC_CONST(-0.38653266429901) }, + { FRAC_CONST(0.91653180122375), FRAC_CONST(-0.30587628483772) }, + { FRAC_CONST(0.69000804424286), FRAC_CONST(0.90952169895172) }, + { FRAC_CONST(-0.38658750057220), FRAC_CONST(0.99501574039459) }, + { FRAC_CONST(-0.29250815510750), FRAC_CONST(0.37444993853569) }, + { FRAC_CONST(-0.60182201862335), FRAC_CONST(0.86779648065567) }, + { FRAC_CONST(-0.97418588399887), FRAC_CONST(0.96468526124954) }, + { FRAC_CONST(0.88461571931839), FRAC_CONST(0.57508403062820) }, + { FRAC_CONST(0.05198933184147), FRAC_CONST(0.21269661188126) }, + { FRAC_CONST(-0.53499621152878), FRAC_CONST(0.97241556644440) }, + { FRAC_CONST(-0.49429559707642), FRAC_CONST(0.98183864355087) }, + { FRAC_CONST(-0.98935145139694), FRAC_CONST(-0.40249159932137) }, + { FRAC_CONST(-0.98081380128860), FRAC_CONST(-0.72856897115707) }, + { FRAC_CONST(-0.27338150143623), FRAC_CONST(0.99950921535492) }, + { FRAC_CONST(0.06310802698135), FRAC_CONST(-0.54539585113525) }, + { FRAC_CONST(-0.20461677014828), FRAC_CONST(-0.14209978282452) }, + { FRAC_CONST(0.66223841905594), FRAC_CONST(0.72528582811356) }, + { FRAC_CONST(-0.84764343500137), FRAC_CONST(0.02372316829860) }, + { FRAC_CONST(-0.89039862155914), FRAC_CONST(0.88866579532623) }, + { FRAC_CONST(0.95903307199478), FRAC_CONST(0.76744925975800) }, + { FRAC_CONST(0.73504126071930), FRAC_CONST(-0.03747203201056) }, + { FRAC_CONST(-0.31744435429573), FRAC_CONST(-0.36834111809731) }, + { FRAC_CONST(-0.34110826253891), FRAC_CONST(0.40211221575737) }, + { FRAC_CONST(0.47803884744644), FRAC_CONST(-0.39423218369484) }, + { FRAC_CONST(0.98299193382263), FRAC_CONST(0.01989791356027) }, + { FRAC_CONST(-0.30963072180748), FRAC_CONST(-0.18076720833778) }, + { FRAC_CONST(0.99992591142654), FRAC_CONST(-0.26281872391701) }, + { FRAC_CONST(-0.93149733543396), FRAC_CONST(-0.98313164710999) }, + { FRAC_CONST(0.99923473596573), FRAC_CONST(-0.80142992734909) }, + { FRAC_CONST(-0.26024168729782), FRAC_CONST(-0.75999760627747) }, + { FRAC_CONST(-0.35712513327599), FRAC_CONST(0.19298963248730) }, + { FRAC_CONST(-0.99899083375931), FRAC_CONST(0.74645155668259) }, + { FRAC_CONST(0.86557173728943), FRAC_CONST(0.55593866109848) }, + { FRAC_CONST(0.33408042788506), FRAC_CONST(0.86185956001282) }, + { FRAC_CONST(0.99010735750198), FRAC_CONST(0.04602397605777) }, + { FRAC_CONST(-0.66694271564484), FRAC_CONST(-0.91643613576889) }, + { FRAC_CONST(0.64016789197922), FRAC_CONST(0.15649530291557) }, + { FRAC_CONST(0.99570536613464), FRAC_CONST(0.45844584703445) }, + { FRAC_CONST(-0.63431465625763), FRAC_CONST(0.21079117059708) }, + { FRAC_CONST(-0.07706847041845), FRAC_CONST(-0.89581435918808) }, + { FRAC_CONST(0.98590087890625), FRAC_CONST(0.88241720199585) }, + { FRAC_CONST(0.80099332332611), FRAC_CONST(-0.36851897835732) }, + { FRAC_CONST(0.78368133306503), FRAC_CONST(0.45506998896599) }, + { FRAC_CONST(0.08707806468010), FRAC_CONST(0.80938994884491) }, + { FRAC_CONST(-0.86811882257462), FRAC_CONST(0.39347308874130) }, + { FRAC_CONST(-0.39466530084610), FRAC_CONST(-0.66809433698654) }, + { FRAC_CONST(0.97875326871872), FRAC_CONST(-0.72467839717865) }, + { FRAC_CONST(-0.95038563013077), FRAC_CONST(0.89563220739365) }, + { FRAC_CONST(0.17005239427090), FRAC_CONST(0.54683053493500) }, + { FRAC_CONST(-0.76910793781281), FRAC_CONST(-0.96226614713669) }, + { FRAC_CONST(0.99743282794952), FRAC_CONST(0.42697158455849) }, + { FRAC_CONST(0.95437383651733), FRAC_CONST(0.97002321481705) }, + { FRAC_CONST(0.99578905105591), FRAC_CONST(-0.54106825590134) }, + { FRAC_CONST(0.28058260679245), FRAC_CONST(-0.85361421108246) }, + { FRAC_CONST(0.85256522893906), FRAC_CONST(-0.64567607641220) }, + { FRAC_CONST(-0.50608539581299), FRAC_CONST(-0.65846014022827) }, + { FRAC_CONST(-0.97210735082626), FRAC_CONST(-0.23095212876797) }, + { FRAC_CONST(0.95424050092697), FRAC_CONST(-0.99240148067474) }, + { FRAC_CONST(-0.96926569938660), FRAC_CONST(0.73775655031204) }, + { FRAC_CONST(0.30872163176537), FRAC_CONST(0.41514959931374) }, + { FRAC_CONST(-0.24523839354515), FRAC_CONST(0.63206630945206) }, + { FRAC_CONST(-0.33813264966011), FRAC_CONST(-0.38661777973175) }, + { FRAC_CONST(-0.05826828256249), FRAC_CONST(-0.06940773874521) }, + { FRAC_CONST(-0.22898460924625), FRAC_CONST(0.97054851055145) }, + { FRAC_CONST(-0.18509915471077), FRAC_CONST(0.47565764188766) }, + { FRAC_CONST(-0.10488238185644), FRAC_CONST(-0.87769949436188) }, + { FRAC_CONST(-0.71886587142944), FRAC_CONST(0.78030979633331) }, + { FRAC_CONST(0.99793875217438), FRAC_CONST(0.90041309595108) }, + { FRAC_CONST(0.57563304901123), FRAC_CONST(-0.91034334897995) }, + { FRAC_CONST(0.28909647464752), FRAC_CONST(0.96307784318924) }, + { FRAC_CONST(0.42188999056816), FRAC_CONST(0.48148649930954) }, + { FRAC_CONST(0.93335050344467), FRAC_CONST(-0.43537023663521) }, + { FRAC_CONST(-0.97087377309799), FRAC_CONST(0.86636447906494) }, + { FRAC_CONST(0.36722871661186), FRAC_CONST(0.65291655063629) }, + { FRAC_CONST(-0.81093025207520), FRAC_CONST(0.08778370171785) }, + { FRAC_CONST(-0.26240602135658), FRAC_CONST(-0.92774093151093) }, + { FRAC_CONST(0.83996498584747), FRAC_CONST(0.55839848518372) }, + { FRAC_CONST(-0.99909615516663), FRAC_CONST(-0.96024608612061) }, + { FRAC_CONST(0.74649465084076), FRAC_CONST(0.12144893407822) }, + { FRAC_CONST(-0.74774593114853), FRAC_CONST(-0.26898062229156) }, + { FRAC_CONST(0.95781666040421), FRAC_CONST(-0.79047924280167) }, + { FRAC_CONST(0.95472306013107), FRAC_CONST(-0.08588775992393) }, + { FRAC_CONST(0.48708331584930), FRAC_CONST(0.99999040365219) }, + { FRAC_CONST(0.46332037448883), FRAC_CONST(0.10964126139879) }, + { FRAC_CONST(-0.76497006416321), FRAC_CONST(0.89210927486420) }, + { FRAC_CONST(0.57397389411926), FRAC_CONST(0.35289704799652) }, + { FRAC_CONST(0.75374317169189), FRAC_CONST(0.96705216169357) }, + { FRAC_CONST(-0.59174400568008), FRAC_CONST(-0.89405369758606) }, + { FRAC_CONST(0.75087904930115), FRAC_CONST(-0.29612672328949) }, + { FRAC_CONST(-0.98607856035233), FRAC_CONST(0.25034910440445) }, + { FRAC_CONST(-0.40761056542397), FRAC_CONST(-0.90045571327209) }, + { FRAC_CONST(0.66929268836975), FRAC_CONST(0.98629492521286) }, + { FRAC_CONST(-0.97463697195053), FRAC_CONST(-0.00190223299433) }, + { FRAC_CONST(0.90145510435104), FRAC_CONST(0.99781388044357) }, + { FRAC_CONST(-0.87259286642075), FRAC_CONST(0.99233585596085) }, + { FRAC_CONST(-0.91529458761215), FRAC_CONST(-0.15698707103729) }, + { FRAC_CONST(-0.03305738791823), FRAC_CONST(-0.37205263972282) }, + { FRAC_CONST(0.07223051041365), FRAC_CONST(-0.88805001974106) }, + { FRAC_CONST(0.99498009681702), FRAC_CONST(0.97094357013702) }, + { FRAC_CONST(-0.74904936552048), FRAC_CONST(0.99985486268997) }, + { FRAC_CONST(0.04585228487849), FRAC_CONST(0.99812334775925) }, + { FRAC_CONST(-0.89054954051971), FRAC_CONST(-0.31791913509369) }, + { FRAC_CONST(-0.83782142400742), FRAC_CONST(0.97637635469437) }, + { FRAC_CONST(0.33454805612564), FRAC_CONST(-0.86231517791748) }, + { FRAC_CONST(-0.99707579612732), FRAC_CONST(0.93237990140915) }, + { FRAC_CONST(-0.22827528417110), FRAC_CONST(0.18874759972095) }, + { FRAC_CONST(0.67248046398163), FRAC_CONST(-0.03646211326122) }, + { FRAC_CONST(-0.05146538093686), FRAC_CONST(-0.92599701881409) }, + { FRAC_CONST(0.99947297573090), FRAC_CONST(0.93625229597092) }, + { FRAC_CONST(0.66951125860214), FRAC_CONST(0.98905825614929) }, + { FRAC_CONST(-0.99602955579758), FRAC_CONST(-0.44654715061188) }, + { FRAC_CONST(0.82104903459549), FRAC_CONST(0.99540740251541) }, + { FRAC_CONST(0.99186509847641), FRAC_CONST(0.72022998332977) }, + { FRAC_CONST(-0.65284591913223), FRAC_CONST(0.52186721563339) }, + { FRAC_CONST(0.93885445594788), FRAC_CONST(-0.74895310401917) }, + { FRAC_CONST(0.96735250949860), FRAC_CONST(0.90891814231873) }, + { FRAC_CONST(-0.22225968539715), FRAC_CONST(0.57124030590057) }, + { FRAC_CONST(-0.44132784008980), FRAC_CONST(-0.92688840627670) }, + { FRAC_CONST(-0.85694974660873), FRAC_CONST(0.88844531774521) }, + { FRAC_CONST(0.91783040761948), FRAC_CONST(-0.46356892585754) }, + { FRAC_CONST(0.72556972503662), FRAC_CONST(-0.99899554252625) }, + { FRAC_CONST(-0.99711579084396), FRAC_CONST(0.58211559057236) }, + { FRAC_CONST(0.77638977766037), FRAC_CONST(0.94321835041046) }, + { FRAC_CONST(0.07717324048281), FRAC_CONST(0.58638399839401) }, + { FRAC_CONST(-0.56049829721451), FRAC_CONST(0.82522302865982) }, + { FRAC_CONST(0.98398894071579), FRAC_CONST(0.39467439055443) }, + { FRAC_CONST(0.47546947002411), FRAC_CONST(0.68613046407700) }, + { FRAC_CONST(0.65675091743469), FRAC_CONST(0.18331636488438) }, + { FRAC_CONST(0.03273375332355), FRAC_CONST(-0.74933111667633) }, + { FRAC_CONST(-0.38684144616127), FRAC_CONST(0.51337349414825) }, + { FRAC_CONST(-0.97346270084381), FRAC_CONST(-0.96549361944199) }, + { FRAC_CONST(-0.53282153606415), FRAC_CONST(-0.91423267126083) }, + { FRAC_CONST(0.99817311763763), FRAC_CONST(0.61133575439453) }, + { FRAC_CONST(-0.50254499912262), FRAC_CONST(-0.88829338550568) }, + { FRAC_CONST(0.01995873264968), FRAC_CONST(0.85223513841629) }, + { FRAC_CONST(0.99930381774902), FRAC_CONST(0.94578897953033) }, + { FRAC_CONST(0.82907766103745), FRAC_CONST(-0.06323442608118) }, + { FRAC_CONST(-0.58660709857941), FRAC_CONST(0.96840775012970) }, + { FRAC_CONST(-0.17573736608028), FRAC_CONST(-0.48166921734810) }, + { FRAC_CONST(0.83434289693832), FRAC_CONST(-0.13023450970650) }, + { FRAC_CONST(0.05946491286159), FRAC_CONST(0.20511047542095) }, + { FRAC_CONST(0.81505483388901), FRAC_CONST(-0.94685947895050) }, + { FRAC_CONST(-0.44976380467415), FRAC_CONST(0.40894573926926) }, + { FRAC_CONST(-0.89746475219727), FRAC_CONST(0.99846577644348) }, + { FRAC_CONST(0.39677256345749), FRAC_CONST(-0.74854665994644) }, + { FRAC_CONST(-0.07588948309422), FRAC_CONST(0.74096214771271) }, + { FRAC_CONST(0.76343196630478), FRAC_CONST(0.41746628284454) }, + { FRAC_CONST(-0.74490106105804), FRAC_CONST(0.94725912809372) }, + { FRAC_CONST(0.64880120754242), FRAC_CONST(0.41336661577225) }, + { FRAC_CONST(0.62319535017014), FRAC_CONST(-0.93098312616348) }, + { FRAC_CONST(0.42215818166733), FRAC_CONST(-0.07712787389755) }, + { FRAC_CONST(0.02704554051161), FRAC_CONST(-0.05417517945170) }, + { FRAC_CONST(0.80001771450043), FRAC_CONST(0.91542196273804) }, + { FRAC_CONST(-0.79351830482483), FRAC_CONST(-0.36208897829056) }, + { FRAC_CONST(0.63872361183167), FRAC_CONST(0.08128252625465) }, + { FRAC_CONST(0.52890521287918), FRAC_CONST(0.60048872232437) }, + { FRAC_CONST(0.74238550662994), FRAC_CONST(0.04491915181279) }, + { FRAC_CONST(0.99096131324768), FRAC_CONST(-0.19451183080673) }, + { FRAC_CONST(-0.80412328243256), FRAC_CONST(-0.88513815402985) }, + { FRAC_CONST(-0.64612615108490), FRAC_CONST(0.72198677062988) }, + { FRAC_CONST(0.11657770723104), FRAC_CONST(-0.83662831783295) }, + { FRAC_CONST(-0.95053184032440), FRAC_CONST(-0.96939903497696) }, + { FRAC_CONST(-0.62228870391846), FRAC_CONST(0.82767260074615) }, + { FRAC_CONST(0.03004475869238), FRAC_CONST(-0.99738895893097) }, + { FRAC_CONST(-0.97987216711044), FRAC_CONST(0.36526128649712) }, + { FRAC_CONST(-0.99986982345581), FRAC_CONST(-0.36021611094475) }, + { FRAC_CONST(0.89110648632050), FRAC_CONST(-0.97894251346588) }, + { FRAC_CONST(0.10407960414886), FRAC_CONST(0.77357792854309) }, + { FRAC_CONST(0.95964735746384), FRAC_CONST(-0.35435819625854) }, + { FRAC_CONST(0.50843232870102), FRAC_CONST(0.96107691526413) }, + { FRAC_CONST(0.17006334662437), FRAC_CONST(-0.76854026317596) }, + { FRAC_CONST(0.25872674584389), FRAC_CONST(0.99893301725388) }, + { FRAC_CONST(-0.01115998718888), FRAC_CONST(0.98496019840240) }, + { FRAC_CONST(-0.79598701000214), FRAC_CONST(0.97138410806656) }, + { FRAC_CONST(-0.99264711141586), FRAC_CONST(-0.99542820453644) }, + { FRAC_CONST(-0.99829661846161), FRAC_CONST(0.01877138763666) }, + { FRAC_CONST(-0.70801013708115), FRAC_CONST(0.33680686354637) }, + { FRAC_CONST(-0.70467054843903), FRAC_CONST(0.93272775411606) }, + { FRAC_CONST(0.99846023321152), FRAC_CONST(-0.98725748062134) }, + { FRAC_CONST(-0.63364970684052), FRAC_CONST(-0.16473594307899) }, + { FRAC_CONST(-0.16258217394352), FRAC_CONST(-0.95939123630524) }, + { FRAC_CONST(-0.43645593523979), FRAC_CONST(-0.94805032014847) }, + { FRAC_CONST(-0.99848473072052), FRAC_CONST(0.96245169639587) }, + { FRAC_CONST(-0.16796459257603), FRAC_CONST(-0.98987513780594) }, + { FRAC_CONST(-0.87979227304459), FRAC_CONST(-0.71725726127625) }, + { FRAC_CONST(0.44183099269867), FRAC_CONST(-0.93568974733353) }, + { FRAC_CONST(0.93310177326202), FRAC_CONST(-0.99913311004639) }, + { FRAC_CONST(-0.93941932916641), FRAC_CONST(-0.56409376859665) }, + { FRAC_CONST(-0.88590002059937), FRAC_CONST(0.47624599933624) }, + { FRAC_CONST(0.99971461296082), FRAC_CONST(-0.83889955282211) }, + { FRAC_CONST(-0.75376385450363), FRAC_CONST(0.00814643409103) }, + { FRAC_CONST(0.93887686729431), FRAC_CONST(-0.11284527927637) }, + { FRAC_CONST(0.85126435756683), FRAC_CONST(0.52349251508713) }, + { FRAC_CONST(0.39701420068741), FRAC_CONST(0.81779634952545) }, + { FRAC_CONST(-0.37024465203285), FRAC_CONST(-0.87071657180786) }, + { FRAC_CONST(-0.36024826765060), FRAC_CONST(0.34655734896660) }, + { FRAC_CONST(-0.93388813734055), FRAC_CONST(-0.84476542472839) }, + { FRAC_CONST(-0.65298801660538), FRAC_CONST(-0.18439576029778) }, + { FRAC_CONST(0.11960318684578), FRAC_CONST(0.99899345636368) }, + { FRAC_CONST(0.94292563199997), FRAC_CONST(0.83163905143738) }, + { FRAC_CONST(0.75081145763397), FRAC_CONST(-0.35533222556114) }, + { FRAC_CONST(0.56721979379654), FRAC_CONST(-0.24076835811138) }, + { FRAC_CONST(0.46857765316963), FRAC_CONST(-0.30140233039856) }, + { FRAC_CONST(0.97312313318253), FRAC_CONST(-0.99548190832138) }, + { FRAC_CONST(-0.38299977779388), FRAC_CONST(0.98516911268234) }, + { FRAC_CONST(0.41025799512863), FRAC_CONST(0.02116736955941) }, + { FRAC_CONST(0.09638062119484), FRAC_CONST(0.04411984235048) }, + { FRAC_CONST(-0.85283249616623), FRAC_CONST(0.91475564241409) }, + { FRAC_CONST(0.88866806030273), FRAC_CONST(-0.99735265970230) }, + { FRAC_CONST(-0.48202428221703), FRAC_CONST(-0.96805608272552) }, + { FRAC_CONST(0.27572581171989), FRAC_CONST(0.58634752035141) }, + { FRAC_CONST(-0.65889132022858), FRAC_CONST(0.58835631608963) }, + { FRAC_CONST(0.98838084936142), FRAC_CONST(0.99994349479675) }, + { FRAC_CONST(-0.20651349425316), FRAC_CONST(0.54593044519424) }, + { FRAC_CONST(-0.62126415967941), FRAC_CONST(-0.59893679618835) }, + { FRAC_CONST(0.20320105552673), FRAC_CONST(-0.86879181861877) }, + { FRAC_CONST(-0.97790551185608), FRAC_CONST(0.96290808916092) }, + { FRAC_CONST(0.11112534999847), FRAC_CONST(0.21484763920307) }, + { FRAC_CONST(-0.41368338465691), FRAC_CONST(0.28216838836670) }, + { FRAC_CONST(0.24133038520813), FRAC_CONST(0.51294362545013) }, + { FRAC_CONST(-0.66393411159515), FRAC_CONST(-0.08249679952860) }, + { FRAC_CONST(-0.53697830438614), FRAC_CONST(-0.97649902105331) }, + { FRAC_CONST(-0.97224736213684), FRAC_CONST(0.22081333398819) }, + { FRAC_CONST(0.87392479181290), FRAC_CONST(-0.12796173989773) }, + { FRAC_CONST(0.19050361216068), FRAC_CONST(0.01602615416050) }, + { FRAC_CONST(-0.46353441476822), FRAC_CONST(-0.95249038934708) }, + { FRAC_CONST(-0.07064096629620), FRAC_CONST(-0.94479805231094) }, + { FRAC_CONST(-0.92444086074829), FRAC_CONST(-0.10457590222359) }, + { FRAC_CONST(-0.83822596073151), FRAC_CONST(-0.01695043221116) }, + { FRAC_CONST(0.75214684009552), FRAC_CONST(-0.99955683946609) }, + { FRAC_CONST(-0.42102998495102), FRAC_CONST(0.99720942974091) }, + { FRAC_CONST(-0.72094786167145), FRAC_CONST(-0.35008960962296) }, + { FRAC_CONST(0.78843313455582), FRAC_CONST(0.52851396799088) }, + { FRAC_CONST(0.97394025325775), FRAC_CONST(-0.26695942878723) }, + { FRAC_CONST(0.99206465482712), FRAC_CONST(-0.57010120153427) }, + { FRAC_CONST(0.76789611577988), FRAC_CONST(-0.76519358158112) }, + { FRAC_CONST(-0.82002419233322), FRAC_CONST(-0.73530179262161) }, + { FRAC_CONST(0.81924992799759), FRAC_CONST(0.99698424339294) }, + { FRAC_CONST(-0.26719850301743), FRAC_CONST(0.68903368711472) }, + { FRAC_CONST(-0.43311259150505), FRAC_CONST(0.85321813821793) }, + { FRAC_CONST(0.99194979667664), FRAC_CONST(0.91876250505447) }, + { FRAC_CONST(-0.80691999197006), FRAC_CONST(-0.32627540826797) }, + { FRAC_CONST(0.43080005049706), FRAC_CONST(-0.21919095516205) }, + { FRAC_CONST(0.67709493637085), FRAC_CONST(-0.95478075742722) }, + { FRAC_CONST(0.56151771545410), FRAC_CONST(-0.70693808794022) }, + { FRAC_CONST(0.10831862688065), FRAC_CONST(-0.08628837019205) }, + { FRAC_CONST(0.91229414939880), FRAC_CONST(-0.65987348556519) }, + { FRAC_CONST(-0.48972892761230), FRAC_CONST(0.56289243698120) }, + { FRAC_CONST(-0.89033657312393), FRAC_CONST(-0.71656566858292) }, + { FRAC_CONST(0.65269446372986), FRAC_CONST(0.65916007757187) }, + { FRAC_CONST(0.67439478635788), FRAC_CONST(-0.81684380769730) }, + { FRAC_CONST(-0.47770830988884), FRAC_CONST(-0.16789555549622) }, + { FRAC_CONST(-0.99715977907181), FRAC_CONST(-0.93565785884857) }, + { FRAC_CONST(-0.90889590978622), FRAC_CONST(0.62034398317337) }, + { FRAC_CONST(-0.06618622690439), FRAC_CONST(-0.23812216520309) }, + { FRAC_CONST(0.99430269002914), FRAC_CONST(0.18812555074692) }, + { FRAC_CONST(0.97686403989792), FRAC_CONST(-0.28664535284042) }, + { FRAC_CONST(0.94813650846481), FRAC_CONST(-0.97506642341614) }, + { FRAC_CONST(-0.95434498786926), FRAC_CONST(-0.79607981443405) }, + { FRAC_CONST(-0.49104782938957), FRAC_CONST(0.32895213365555) }, + { FRAC_CONST(0.99881172180176), FRAC_CONST(0.88993984460831) }, + { FRAC_CONST(0.50449168682098), FRAC_CONST(-0.85995072126389) }, + { FRAC_CONST(0.47162890434265), FRAC_CONST(-0.18680204451084) }, + { FRAC_CONST(-0.62081581354141), FRAC_CONST(0.75000673532486) }, + { FRAC_CONST(-0.43867015838623), FRAC_CONST(0.99998068809509) }, + { FRAC_CONST(0.98630565404892), FRAC_CONST(-0.53578901290894) }, + { FRAC_CONST(-0.61510360240936), FRAC_CONST(-0.89515018463135) }, + { FRAC_CONST(-0.03841517493129), FRAC_CONST(-0.69888818264008) }, + { FRAC_CONST(-0.30102157592773), FRAC_CONST(-0.07667808979750) }, + { FRAC_CONST(0.41881284117699), FRAC_CONST(0.02188098989427) }, + { FRAC_CONST(-0.86135452985764), FRAC_CONST(0.98947483301163) }, + { FRAC_CONST(0.67226862907410), FRAC_CONST(-0.13494388759136) }, + { FRAC_CONST(-0.70737397670746), FRAC_CONST(-0.76547348499298) }, + { FRAC_CONST(0.94044947624207), FRAC_CONST(0.09026201069355) }, + { FRAC_CONST(-0.82386350631714), FRAC_CONST(0.08924768865108) }, + { FRAC_CONST(-0.32070666551590), FRAC_CONST(0.50143420696259) }, + { FRAC_CONST(0.57593160867691), FRAC_CONST(-0.98966425657272) }, + { FRAC_CONST(-0.36326017975807), FRAC_CONST(0.07440242916346) }, + { FRAC_CONST(0.99979043006897), FRAC_CONST(-0.14130286872387) }, + { FRAC_CONST(-0.92366021871567), FRAC_CONST(-0.97979295253754) }, + { FRAC_CONST(-0.44607177376747), FRAC_CONST(-0.54233253002167) }, + { FRAC_CONST(0.44226801395416), FRAC_CONST(0.71326756477356) }, + { FRAC_CONST(0.03671907261014), FRAC_CONST(0.63606387376785) }, + { FRAC_CONST(0.52175426483154), FRAC_CONST(-0.85396826267242) }, + { FRAC_CONST(-0.94701141119003), FRAC_CONST(-0.01826348155737) }, + { FRAC_CONST(-0.98759609460831), FRAC_CONST(0.82288712263107) }, + { FRAC_CONST(0.87434792518616), FRAC_CONST(0.89399492740631) }, + { FRAC_CONST(-0.93412041664124), FRAC_CONST(0.41374051570892) }, + { FRAC_CONST(0.96063941717148), FRAC_CONST(0.93116706609726) }, + { FRAC_CONST(0.97534251213074), FRAC_CONST(0.86150932312012) }, + { FRAC_CONST(0.99642467498779), FRAC_CONST(0.70190042257309) }, + { FRAC_CONST(-0.94705086946487), FRAC_CONST(-0.29580041766167) }, + { FRAC_CONST(0.91599804162979), FRAC_CONST(-0.98147833347321) } +}; + +#ifdef __cplusplus + +#endif +#endif + diff --git a/Libraries/FAAD2/Files/libfaad/sbr_qmf.c b/Libraries/FAAD2/Files/libfaad/sbr_qmf.c new file mode 100644 index 000000000..e99adb4a1 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/sbr_qmf.c @@ -0,0 +1,633 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#include "common.h" +#include "structs.h" + +#ifdef SBR_DEC + + +#include +#include +#include "sbr_dct.h" +#include "sbr_qmf.h" +#include "sbr_qmf_c.h" +#include "sbr_syntax.h" + +qmfa_info *qmfa_init(uint8_t channels) +{ + qmfa_info *qmfa = (qmfa_info*)faad_malloc(sizeof(qmfa_info)); + + /* x is implemented as double ringbuffer */ + qmfa->x = (real_t*)faad_malloc(2 * channels * 10 * sizeof(real_t)); + memset(qmfa->x, 0, 2 * channels * 10 * sizeof(real_t)); + + /* ringbuffer index */ + qmfa->x_index = 0; + + qmfa->channels = channels; + + return qmfa; +} + +void qmfa_end(qmfa_info *qmfa) +{ + if (qmfa) + { + if (qmfa->x) faad_free(qmfa->x); + faad_free(qmfa); + } +} + +void sbr_qmf_analysis_32(sbr_info *sbr, qmfa_info *qmfa, const real_t *input, + qmf_t X[MAX_NTSRHFG][64], uint8_t offset, uint8_t kx) +{ + ALIGN real_t u[64]; +#ifndef SBR_LOW_POWER + ALIGN real_t in_real[32], in_imag[32], out_real[32], out_imag[32]; +#else + ALIGN real_t y[32]; +#endif + uint16_t in = 0; + uint8_t l; + + /* qmf subsample l */ + for (l = 0; l < sbr->numTimeSlotsRate; l++) + { + int16_t n; + + /* shift input buffer x */ + /* input buffer is not shifted anymore, x is implemented as double ringbuffer */ + //memmove(qmfa->x + 32, qmfa->x, (320-32)*sizeof(real_t)); + + /* add new samples to input buffer x */ + for (n = 32 - 1; n >= 0; n--) + { +#ifdef FIXED_POINT + qmfa->x[qmfa->x_index + n] = qmfa->x[qmfa->x_index + n + 320] = (input[in++]) >> 4; +#else + qmfa->x[qmfa->x_index + n] = qmfa->x[qmfa->x_index + n + 320] = input[in++]; +#endif + } + + /* window and summation to create array u */ + for (n = 0; n < 64; n++) + { + u[n] = MUL_F(qmfa->x[qmfa->x_index + n], qmf_c[2*n]) + + MUL_F(qmfa->x[qmfa->x_index + n + 64], qmf_c[2*(n + 64)]) + + MUL_F(qmfa->x[qmfa->x_index + n + 128], qmf_c[2*(n + 128)]) + + MUL_F(qmfa->x[qmfa->x_index + n + 192], qmf_c[2*(n + 192)]) + + MUL_F(qmfa->x[qmfa->x_index + n + 256], qmf_c[2*(n + 256)]); + } + + /* update ringbuffer index */ + qmfa->x_index -= 32; + if (qmfa->x_index < 0) + qmfa->x_index = (320-32); + + /* calculate 32 subband samples by introducing X */ +#ifdef SBR_LOW_POWER + y[0] = u[48]; + for (n = 1; n < 16; n++) + y[n] = u[n+48] + u[48-n]; + for (n = 16; n < 32; n++) + y[n] = -u[n-16] + u[48-n]; + + DCT3_32_unscaled(u, y); + + for (n = 0; n < 32; n++) + { + if (n < kx) + { +#ifdef FIXED_POINT + QMF_RE(X[l + offset][n]) = u[n] /*<< 1*/; +#else + QMF_RE(X[l + offset][n]) = 2. * u[n]; +#endif + } else { + QMF_RE(X[l + offset][n]) = 0; + } + } +#else + + // Reordering of data moved from DCT_IV to here + in_imag[31] = u[1]; + in_real[0] = u[0]; + for (n = 1; n < 31; n++) + { + in_imag[31 - n] = u[n+1]; + in_real[n] = -u[64-n]; + } + in_imag[0] = u[32]; + in_real[31] = -u[33]; + + // dct4_kernel is DCT_IV without reordering which is done before and after FFT + dct4_kernel(in_real, in_imag, out_real, out_imag); + + // Reordering of data moved from DCT_IV to here + for (n = 0; n < 16; n++) { + if (2*n+1 < kx) { +#ifdef FIXED_POINT + QMF_RE(X[l + offset][2*n]) = out_real[n]; + QMF_IM(X[l + offset][2*n]) = out_imag[n]; + QMF_RE(X[l + offset][2*n+1]) = -out_imag[31-n]; + QMF_IM(X[l + offset][2*n+1]) = -out_real[31-n]; +#else + QMF_RE(X[l + offset][2*n]) = 2. * out_real[n]; + QMF_IM(X[l + offset][2*n]) = 2. * out_imag[n]; + QMF_RE(X[l + offset][2*n+1]) = -2. * out_imag[31-n]; + QMF_IM(X[l + offset][2*n+1]) = -2. * out_real[31-n]; +#endif + } else { + if (2*n < kx) { +#ifdef FIXED_POINT + QMF_RE(X[l + offset][2*n]) = out_real[n]; + QMF_IM(X[l + offset][2*n]) = out_imag[n]; +#else + QMF_RE(X[l + offset][2*n]) = 2. * out_real[n]; + QMF_IM(X[l + offset][2*n]) = 2. * out_imag[n]; +#endif + } + else { + QMF_RE(X[l + offset][2*n]) = 0; + QMF_IM(X[l + offset][2*n]) = 0; + } + QMF_RE(X[l + offset][2*n+1]) = 0; + QMF_IM(X[l + offset][2*n+1]) = 0; + } + } +#endif + } +} + +static const complex_t qmf32_pre_twiddle[] = +{ + { FRAC_CONST(0.999924701839145), FRAC_CONST(-0.012271538285720) }, + { FRAC_CONST(0.999322384588350), FRAC_CONST(-0.036807222941359) }, + { FRAC_CONST(0.998118112900149), FRAC_CONST(-0.061320736302209) }, + { FRAC_CONST(0.996312612182778), FRAC_CONST(-0.085797312344440) }, + { FRAC_CONST(0.993906970002356), FRAC_CONST(-0.110222207293883) }, + { FRAC_CONST(0.990902635427780), FRAC_CONST(-0.134580708507126) }, + { FRAC_CONST(0.987301418157858), FRAC_CONST(-0.158858143333861) }, + { FRAC_CONST(0.983105487431216), FRAC_CONST(-0.183039887955141) }, + { FRAC_CONST(0.978317370719628), FRAC_CONST(-0.207111376192219) }, + { FRAC_CONST(0.972939952205560), FRAC_CONST(-0.231058108280671) }, + { FRAC_CONST(0.966976471044852), FRAC_CONST(-0.254865659604515) }, + { FRAC_CONST(0.960430519415566), FRAC_CONST(-0.278519689385053) }, + { FRAC_CONST(0.953306040354194), FRAC_CONST(-0.302005949319228) }, + { FRAC_CONST(0.945607325380521), FRAC_CONST(-0.325310292162263) }, + { FRAC_CONST(0.937339011912575), FRAC_CONST(-0.348418680249435) }, + { FRAC_CONST(0.928506080473216), FRAC_CONST(-0.371317193951838) }, + { FRAC_CONST(0.919113851690058), FRAC_CONST(-0.393992040061048) }, + { FRAC_CONST(0.909167983090522), FRAC_CONST(-0.416429560097637) }, + { FRAC_CONST(0.898674465693954), FRAC_CONST(-0.438616238538528) }, + { FRAC_CONST(0.887639620402854), FRAC_CONST(-0.460538710958240) }, + { FRAC_CONST(0.876070094195407), FRAC_CONST(-0.482183772079123) }, + { FRAC_CONST(0.863972856121587), FRAC_CONST(-0.503538383725718) }, + { FRAC_CONST(0.851355193105265), FRAC_CONST(-0.524589682678469) }, + { FRAC_CONST(0.838224705554838), FRAC_CONST(-0.545324988422046) }, + { FRAC_CONST(0.824589302785025), FRAC_CONST(-0.565731810783613) }, + { FRAC_CONST(0.810457198252595), FRAC_CONST(-0.585797857456439) }, + { FRAC_CONST(0.795836904608884), FRAC_CONST(-0.605511041404326) }, + { FRAC_CONST(0.780737228572094), FRAC_CONST(-0.624859488142386) }, + { FRAC_CONST(0.765167265622459), FRAC_CONST(-0.643831542889791) }, + { FRAC_CONST(0.749136394523459), FRAC_CONST(-0.662415777590172) }, + { FRAC_CONST(0.732654271672413), FRAC_CONST(-0.680600997795453) }, + { FRAC_CONST(0.715730825283819), FRAC_CONST(-0.698376249408973) } +}; + +qmfs_info *qmfs_init(uint8_t channels) +{ + qmfs_info *qmfs = (qmfs_info*)faad_malloc(sizeof(qmfs_info)); + + /* v is a double ringbuffer */ + qmfs->v = (real_t*)faad_malloc(2 * channels * 20 * sizeof(real_t)); + memset(qmfs->v, 0, 2 * channels * 20 * sizeof(real_t)); + + qmfs->v_index = 0; + + qmfs->channels = channels; + + return qmfs; +} + +void qmfs_end(qmfs_info *qmfs) +{ + if (qmfs) + { + if (qmfs->v) faad_free(qmfs->v); + faad_free(qmfs); + } +} + +#ifdef SBR_LOW_POWER + +void sbr_qmf_synthesis_32(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][64], + real_t *output) +{ + ALIGN real_t x[16]; + ALIGN real_t y[16]; + int16_t n, k, out = 0; + uint8_t l; + + /* qmf subsample l */ + for (l = 0; l < sbr->numTimeSlotsRate; l++) + { + /* shift buffers */ + /* we are not shifting v, it is a double ringbuffer */ + //memmove(qmfs->v + 64, qmfs->v, (640-64)*sizeof(real_t)); + + /* calculate 64 samples */ + for (k = 0; k < 16; k++) + { +#ifdef FIXED_POINT + y[k] = (QMF_RE(X[l][k]) - QMF_RE(X[l][31 - k])); + x[k] = (QMF_RE(X[l][k]) + QMF_RE(X[l][31 - k])); +#else + y[k] = (QMF_RE(X[l][k]) - QMF_RE(X[l][31 - k])) / 32.0; + x[k] = (QMF_RE(X[l][k]) + QMF_RE(X[l][31 - k])) / 32.0; +#endif + } + + /* even n samples */ + DCT2_16_unscaled(x, x); + /* odd n samples */ + DCT4_16(y, y); + + for (n = 8; n < 24; n++) + { + qmfs->v[qmfs->v_index + n*2] = qmfs->v[qmfs->v_index + 640 + n*2] = x[n-8]; + qmfs->v[qmfs->v_index + n*2+1] = qmfs->v[qmfs->v_index + 640 + n*2+1] = y[n-8]; + } + for (n = 0; n < 16; n++) + { + qmfs->v[qmfs->v_index + n] = qmfs->v[qmfs->v_index + 640 + n] = qmfs->v[qmfs->v_index + 32-n]; + } + qmfs->v[qmfs->v_index + 48] = qmfs->v[qmfs->v_index + 640 + 48] = 0; + for (n = 1; n < 16; n++) + { + qmfs->v[qmfs->v_index + 48+n] = qmfs->v[qmfs->v_index + 640 + 48+n] = -qmfs->v[qmfs->v_index + 48-n]; + } + + /* calculate 32 output samples and window */ + for (k = 0; k < 32; k++) + { + output[out++] = MUL_F(qmfs->v[qmfs->v_index + k], qmf_c[2*k]) + + MUL_F(qmfs->v[qmfs->v_index + 96 + k], qmf_c[64 + 2*k]) + + MUL_F(qmfs->v[qmfs->v_index + 128 + k], qmf_c[128 + 2*k]) + + MUL_F(qmfs->v[qmfs->v_index + 224 + k], qmf_c[192 + 2*k]) + + MUL_F(qmfs->v[qmfs->v_index + 256 + k], qmf_c[256 + 2*k]) + + MUL_F(qmfs->v[qmfs->v_index + 352 + k], qmf_c[320 + 2*k]) + + MUL_F(qmfs->v[qmfs->v_index + 384 + k], qmf_c[384 + 2*k]) + + MUL_F(qmfs->v[qmfs->v_index + 480 + k], qmf_c[448 + 2*k]) + + MUL_F(qmfs->v[qmfs->v_index + 512 + k], qmf_c[512 + 2*k]) + + MUL_F(qmfs->v[qmfs->v_index + 608 + k], qmf_c[576 + 2*k]); + } + + /* update the ringbuffer index */ + qmfs->v_index -= 64; + if (qmfs->v_index < 0) + qmfs->v_index = (640-64); + } +} + +void sbr_qmf_synthesis_64(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][64], + real_t *output) +{ + ALIGN real_t x[64]; + ALIGN real_t y[64]; + int16_t n, k, out = 0; + uint8_t l; + + + /* qmf subsample l */ + for (l = 0; l < sbr->numTimeSlotsRate; l++) + { + /* shift buffers */ + /* we are not shifting v, it is a double ringbuffer */ + //memmove(qmfs->v + 128, qmfs->v, (1280-128)*sizeof(real_t)); + + /* calculate 128 samples */ + for (k = 0; k < 32; k++) + { +#ifdef FIXED_POINT + y[k] = (QMF_RE(X[l][k]) - QMF_RE(X[l][63 - k])); + x[k] = (QMF_RE(X[l][k]) + QMF_RE(X[l][63 - k])); +#else + y[k] = (QMF_RE(X[l][k]) - QMF_RE(X[l][63 - k])) / 32.0; + x[k] = (QMF_RE(X[l][k]) + QMF_RE(X[l][63 - k])) / 32.0; +#endif + } + + /* even n samples */ + DCT2_32_unscaled(x, x); + /* odd n samples */ + DCT4_32(y, y); + + for (n = 16; n < 48; n++) + { + qmfs->v[qmfs->v_index + n*2] = qmfs->v[qmfs->v_index + 1280 + n*2] = x[n-16]; + qmfs->v[qmfs->v_index + n*2+1] = qmfs->v[qmfs->v_index + 1280 + n*2+1] = y[n-16]; + } + for (n = 0; n < 32; n++) + { + qmfs->v[qmfs->v_index + n] = qmfs->v[qmfs->v_index + 1280 + n] = qmfs->v[qmfs->v_index + 64-n]; + } + qmfs->v[qmfs->v_index + 96] = qmfs->v[qmfs->v_index + 1280 + 96] = 0; + for (n = 1; n < 32; n++) + { + qmfs->v[qmfs->v_index + 96+n] = qmfs->v[qmfs->v_index + 1280 + 96+n] = -qmfs->v[qmfs->v_index + 96-n]; + } + + /* calculate 64 output samples and window */ + for (k = 0; k < 64; k++) + { + output[out++] = MUL_F(qmfs->v[qmfs->v_index + k], qmf_c[k]) + + MUL_F(qmfs->v[qmfs->v_index + 192 + k], qmf_c[64 + k]) + + MUL_F(qmfs->v[qmfs->v_index + 256 + k], qmf_c[128 + k]) + + MUL_F(qmfs->v[qmfs->v_index + 256 + 192 + k], qmf_c[128 + 64 + k]) + + MUL_F(qmfs->v[qmfs->v_index + 512 + k], qmf_c[256 + k]) + + MUL_F(qmfs->v[qmfs->v_index + 512 + 192 + k], qmf_c[256 + 64 + k]) + + MUL_F(qmfs->v[qmfs->v_index + 768 + k], qmf_c[384 + k]) + + MUL_F(qmfs->v[qmfs->v_index + 768 + 192 + k], qmf_c[384 + 64 + k]) + + MUL_F(qmfs->v[qmfs->v_index + 1024 + k], qmf_c[512 + k]) + + MUL_F(qmfs->v[qmfs->v_index + 1024 + 192 + k], qmf_c[512 + 64 + k]); + } + + /* update the ringbuffer index */ + qmfs->v_index -= 128; + if (qmfs->v_index < 0) + qmfs->v_index = (1280-128); + } +} +#else +void sbr_qmf_synthesis_32(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][64], + real_t *output) +{ + ALIGN real_t x1[32], x2[32]; +#ifndef FIXED_POINT + real_t scale = 1.f/64.f; +#endif + int16_t n, k, out = 0; + uint8_t l; + + + /* qmf subsample l */ + for (l = 0; l < sbr->numTimeSlotsRate; l++) + { + /* shift buffer v */ + /* buffer is not shifted, we are using a ringbuffer */ + //memmove(qmfs->v + 64, qmfs->v, (640-64)*sizeof(real_t)); + + /* calculate 64 samples */ + /* complex pre-twiddle */ + for (k = 0; k < 32; k++) + { + x1[k] = MUL_F(QMF_RE(X[l][k]), RE(qmf32_pre_twiddle[k])) - MUL_F(QMF_IM(X[l][k]), IM(qmf32_pre_twiddle[k])); + x2[k] = MUL_F(QMF_IM(X[l][k]), RE(qmf32_pre_twiddle[k])) + MUL_F(QMF_RE(X[l][k]), IM(qmf32_pre_twiddle[k])); + +#ifndef FIXED_POINT + x1[k] *= scale; + x2[k] *= scale; +#else + x1[k] >>= 1; + x2[k] >>= 1; +#endif + } + + /* transform */ + DCT4_32(x1, x1); + DST4_32(x2, x2); + + for (n = 0; n < 32; n++) + { + qmfs->v[qmfs->v_index + n] = qmfs->v[qmfs->v_index + 640 + n] = -x1[n] + x2[n]; + qmfs->v[qmfs->v_index + 63 - n] = qmfs->v[qmfs->v_index + 640 + 63 - n] = x1[n] + x2[n]; + } + + /* calculate 32 output samples and window */ + for (k = 0; k < 32; k++) + { + output[out++] = MUL_F(qmfs->v[qmfs->v_index + k], qmf_c[2*k]) + + MUL_F(qmfs->v[qmfs->v_index + 96 + k], qmf_c[64 + 2*k]) + + MUL_F(qmfs->v[qmfs->v_index + 128 + k], qmf_c[128 + 2*k]) + + MUL_F(qmfs->v[qmfs->v_index + 224 + k], qmf_c[192 + 2*k]) + + MUL_F(qmfs->v[qmfs->v_index + 256 + k], qmf_c[256 + 2*k]) + + MUL_F(qmfs->v[qmfs->v_index + 352 + k], qmf_c[320 + 2*k]) + + MUL_F(qmfs->v[qmfs->v_index + 384 + k], qmf_c[384 + 2*k]) + + MUL_F(qmfs->v[qmfs->v_index + 480 + k], qmf_c[448 + 2*k]) + + MUL_F(qmfs->v[qmfs->v_index + 512 + k], qmf_c[512 + 2*k]) + + MUL_F(qmfs->v[qmfs->v_index + 608 + k], qmf_c[576 + 2*k]); + } + + /* update ringbuffer index */ + qmfs->v_index -= 64; + if (qmfs->v_index < 0) + qmfs->v_index = (640 - 64); + } +} + +void sbr_qmf_synthesis_64(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][64], + real_t *output) +{ +// ALIGN real_t x1[64], x2[64]; +#ifndef SBR_LOW_POWER + ALIGN real_t in_real1[32], in_imag1[32], out_real1[32], out_imag1[32]; + ALIGN real_t in_real2[32], in_imag2[32], out_real2[32], out_imag2[32]; +#endif + qmf_t * pX; + real_t * pring_buffer_1, * pring_buffer_3; +// real_t * ptemp_1, * ptemp_2; +#ifdef PREFER_POINTERS + // These pointers are used if target platform has autoinc address generators + real_t * pring_buffer_2, * pring_buffer_4; + real_t * pring_buffer_5, * pring_buffer_6; + real_t * pring_buffer_7, * pring_buffer_8; + real_t * pring_buffer_9, * pring_buffer_10; + const real_t * pqmf_c_1, * pqmf_c_2, * pqmf_c_3, * pqmf_c_4; + const real_t * pqmf_c_5, * pqmf_c_6, * pqmf_c_7, * pqmf_c_8; + const real_t * pqmf_c_9, * pqmf_c_10; +#endif // #ifdef PREFER_POINTERS +#ifndef FIXED_POINT + real_t scale = 1.f/64.f; +#endif + int16_t n, k, out = 0; + uint8_t l; + + + /* qmf subsample l */ + for (l = 0; l < sbr->numTimeSlotsRate; l++) + { + /* shift buffer v */ + /* buffer is not shifted, we use double ringbuffer */ + //memmove(qmfs->v + 128, qmfs->v, (1280-128)*sizeof(real_t)); + + /* calculate 128 samples */ +#ifndef FIXED_POINT + + pX = X[l]; + + in_imag1[31] = scale*QMF_RE(pX[1]); + in_real1[0] = scale*QMF_RE(pX[0]); + in_imag2[31] = scale*QMF_IM(pX[63-1]); + in_real2[0] = scale*QMF_IM(pX[63-0]); + for (k = 1; k < 31; k++) + { + in_imag1[31 - k] = scale*QMF_RE(pX[2*k + 1]); + in_real1[ k] = scale*QMF_RE(pX[2*k ]); + in_imag2[31 - k] = scale*QMF_IM(pX[63 - (2*k + 1)]); + in_real2[ k] = scale*QMF_IM(pX[63 - (2*k )]); + } + in_imag1[0] = scale*QMF_RE(pX[63]); + in_real1[31] = scale*QMF_RE(pX[62]); + in_imag2[0] = scale*QMF_IM(pX[63-63]); + in_real2[31] = scale*QMF_IM(pX[63-62]); + +#else + + pX = X[l]; + + in_imag1[31] = QMF_RE(pX[1]) >> 1; + in_real1[0] = QMF_RE(pX[0]) >> 1; + in_imag2[31] = QMF_IM(pX[62]) >> 1; + in_real2[0] = QMF_IM(pX[63]) >> 1; + for (k = 1; k < 31; k++) + { + in_imag1[31 - k] = QMF_RE(pX[2*k + 1]) >> 1; + in_real1[ k] = QMF_RE(pX[2*k ]) >> 1; + in_imag2[31 - k] = QMF_IM(pX[63 - (2*k + 1)]) >> 1; + in_real2[ k] = QMF_IM(pX[63 - (2*k )]) >> 1; + } + in_imag1[0] = QMF_RE(pX[63]) >> 1; + in_real1[31] = QMF_RE(pX[62]) >> 1; + in_imag2[0] = QMF_IM(pX[0]) >> 1; + in_real2[31] = QMF_IM(pX[1]) >> 1; + +#endif + + + // dct4_kernel is DCT_IV without reordering which is done before and after FFT + dct4_kernel(in_real1, in_imag1, out_real1, out_imag1); + dct4_kernel(in_real2, in_imag2, out_real2, out_imag2); + + + pring_buffer_1 = qmfs->v + qmfs->v_index; + pring_buffer_3 = pring_buffer_1 + 1280; +#ifdef PREFER_POINTERS + pring_buffer_2 = pring_buffer_1 + 127; + pring_buffer_4 = pring_buffer_1 + (1280 + 127); +#endif // #ifdef PREFER_POINTERS +// ptemp_1 = x1; +// ptemp_2 = x2; +#ifdef PREFER_POINTERS + for (n = 0; n < 32; n ++) + { + //real_t x1 = *ptemp_1++; + //real_t x2 = *ptemp_2++; + // pring_buffer_3 and pring_buffer_4 are needed only for double ring buffer + *pring_buffer_1++ = *pring_buffer_3++ = out_real2[n] - out_real1[n]; + *pring_buffer_2-- = *pring_buffer_4-- = out_real2[n] + out_real1[n]; + //x1 = *ptemp_1++; + //x2 = *ptemp_2++; + *pring_buffer_1++ = *pring_buffer_3++ = out_imag2[31-n] + out_imag1[31-n]; + *pring_buffer_2-- = *pring_buffer_4-- = out_imag2[31-n] - out_imag1[31-n]; + } +#else // #ifdef PREFER_POINTERS + + for (n = 0; n < 32; n++) + { + // pring_buffer_3 and pring_buffer_4 are needed only for double ring buffer + pring_buffer_1[2*n] = pring_buffer_3[2*n] = out_real2[n] - out_real1[n]; + pring_buffer_1[127-2*n] = pring_buffer_3[127-2*n] = out_real2[n] + out_real1[n]; + pring_buffer_1[2*n+1] = pring_buffer_3[2*n+1] = out_imag2[31-n] + out_imag1[31-n]; + pring_buffer_1[127-(2*n+1)] = pring_buffer_3[127-(2*n+1)] = out_imag2[31-n] - out_imag1[31-n]; + } + +#endif // #ifdef PREFER_POINTERS + + pring_buffer_1 = qmfs->v + qmfs->v_index; +#ifdef PREFER_POINTERS + pring_buffer_2 = pring_buffer_1 + 192; + pring_buffer_3 = pring_buffer_1 + 256; + pring_buffer_4 = pring_buffer_1 + (256 + 192); + pring_buffer_5 = pring_buffer_1 + 512; + pring_buffer_6 = pring_buffer_1 + (512 + 192); + pring_buffer_7 = pring_buffer_1 + 768; + pring_buffer_8 = pring_buffer_1 + (768 + 192); + pring_buffer_9 = pring_buffer_1 + 1024; + pring_buffer_10 = pring_buffer_1 + (1024 + 192); + pqmf_c_1 = qmf_c; + pqmf_c_2 = qmf_c + 64; + pqmf_c_3 = qmf_c + 128; + pqmf_c_4 = qmf_c + 192; + pqmf_c_5 = qmf_c + 256; + pqmf_c_6 = qmf_c + 320; + pqmf_c_7 = qmf_c + 384; + pqmf_c_8 = qmf_c + 448; + pqmf_c_9 = qmf_c + 512; + pqmf_c_10 = qmf_c + 576; +#endif // #ifdef PREFER_POINTERS + + /* calculate 64 output samples and window */ + for (k = 0; k < 64; k++) + { +#ifdef PREFER_POINTERS + output[out++] = + MUL_F(*pring_buffer_1++, *pqmf_c_1++) + + MUL_F(*pring_buffer_2++, *pqmf_c_2++) + + MUL_F(*pring_buffer_3++, *pqmf_c_3++) + + MUL_F(*pring_buffer_4++, *pqmf_c_4++) + + MUL_F(*pring_buffer_5++, *pqmf_c_5++) + + MUL_F(*pring_buffer_6++, *pqmf_c_6++) + + MUL_F(*pring_buffer_7++, *pqmf_c_7++) + + MUL_F(*pring_buffer_8++, *pqmf_c_8++) + + MUL_F(*pring_buffer_9++, *pqmf_c_9++) + + MUL_F(*pring_buffer_10++, *pqmf_c_10++); +#else // #ifdef PREFER_POINTERS + output[out++] = + MUL_F(pring_buffer_1[k+0], qmf_c[k+0]) + + MUL_F(pring_buffer_1[k+192], qmf_c[k+64]) + + MUL_F(pring_buffer_1[k+256], qmf_c[k+128]) + + MUL_F(pring_buffer_1[k+(256+192)], qmf_c[k+192]) + + MUL_F(pring_buffer_1[k+512], qmf_c[k+256]) + + MUL_F(pring_buffer_1[k+(512+192)], qmf_c[k+320]) + + MUL_F(pring_buffer_1[k+768], qmf_c[k+384]) + + MUL_F(pring_buffer_1[k+(768+192)], qmf_c[k+448]) + + MUL_F(pring_buffer_1[k+1024], qmf_c[k+512]) + + MUL_F(pring_buffer_1[k+(1024+192)], qmf_c[k+576]); +#endif // #ifdef PREFER_POINTERS + } + + /* update ringbuffer index */ + qmfs->v_index -= 128; + if (qmfs->v_index < 0) + qmfs->v_index = (1280 - 128); + } +} +#endif + +#endif diff --git a/Libraries/FAAD2/Files/libfaad/sbr_qmf.h b/Libraries/FAAD2/Files/libfaad/sbr_qmf.h new file mode 100644 index 000000000..f940ccfa0 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/sbr_qmf.h @@ -0,0 +1,52 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#ifndef __SBR_QMF_H__ +#define __SBR_QMF_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +qmfa_info *qmfa_init(uint8_t channels); +void qmfa_end(qmfa_info *qmfa); +qmfs_info *qmfs_init(uint8_t channels); +void qmfs_end(qmfs_info *qmfs); + +void sbr_qmf_analysis_32(sbr_info *sbr, qmfa_info *qmfa, const real_t *input, + qmf_t X[MAX_NTSRHFG][64], uint8_t offset, uint8_t kx); +void sbr_qmf_synthesis_32(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][64], + real_t *output); +void sbr_qmf_synthesis_64(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][64], + real_t *output); + + +#ifdef __cplusplus +} +#endif +#endif + diff --git a/Libraries/FAAD2/Files/libfaad/sbr_qmf_c.h b/Libraries/FAAD2/Files/libfaad/sbr_qmf_c.h new file mode 100644 index 000000000..19592a7ff --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/sbr_qmf_c.h @@ -0,0 +1,365 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#ifndef __SBR_QMF_C_H__ +#define __SBR_QMF_C_H__ + +#ifdef __cplusplus +extern "C" { +#endif + + +#ifdef _MSC_VER +#pragma warning(disable:4305) +#pragma warning(disable:4244) +#endif + +ALIGN static const real_t qmf_c[640] = { + FRAC_CONST(0), FRAC_CONST(-0.00055252865047), + FRAC_CONST(-0.00056176925738), FRAC_CONST(-0.00049475180896), + FRAC_CONST(-0.00048752279712), FRAC_CONST(-0.00048937912498), + FRAC_CONST(-0.00050407143497), FRAC_CONST(-0.00052265642972), + FRAC_CONST(-0.00054665656337), FRAC_CONST(-0.00056778025613), + FRAC_CONST(-0.00058709304852), FRAC_CONST(-0.00061327473938), + FRAC_CONST(-0.00063124935319), FRAC_CONST(-0.00065403333621), + FRAC_CONST(-0.00067776907764), FRAC_CONST(-0.00069416146273), + FRAC_CONST(-0.00071577364744), FRAC_CONST(-0.00072550431222), + FRAC_CONST(-0.00074409418541), FRAC_CONST(-0.00074905980532), + FRAC_CONST(-0.0007681371927), FRAC_CONST(-0.00077248485949), + FRAC_CONST(-0.00078343322877), FRAC_CONST(-0.00077798694927), + FRAC_CONST(-0.000780366471), FRAC_CONST(-0.00078014496257), + FRAC_CONST(-0.0007757977331), FRAC_CONST(-0.00076307935757), + FRAC_CONST(-0.00075300014201), FRAC_CONST(-0.00073193571525), + FRAC_CONST(-0.00072153919876), FRAC_CONST(-0.00069179375372), + FRAC_CONST(-0.00066504150893), FRAC_CONST(-0.00063415949025), + FRAC_CONST(-0.0005946118933), FRAC_CONST(-0.00055645763906), + FRAC_CONST(-0.00051455722108), FRAC_CONST(-0.00046063254803), + FRAC_CONST(-0.00040951214522), FRAC_CONST(-0.00035011758756), + FRAC_CONST(-0.00028969811748), FRAC_CONST(-0.0002098337344), + FRAC_CONST(-0.00014463809349), FRAC_CONST(-6.173344072E-005), + FRAC_CONST(1.349497418E-005), FRAC_CONST(0.00010943831274), + FRAC_CONST(0.00020430170688), FRAC_CONST(0.00029495311041), + FRAC_CONST(0.0004026540216), FRAC_CONST(0.00051073884952), + FRAC_CONST(0.00062393761391), FRAC_CONST(0.00074580258865), + FRAC_CONST(0.00086084433262), FRAC_CONST(0.00098859883015), + FRAC_CONST(0.00112501551307), FRAC_CONST(0.00125778846475), + FRAC_CONST(0.00139024948272), FRAC_CONST(0.00154432198471), + FRAC_CONST(0.00168680832531), FRAC_CONST(0.00183482654224), + FRAC_CONST(0.00198411407369), FRAC_CONST(0.00214615835557), + FRAC_CONST(0.00230172547746), FRAC_CONST(0.00246256169126), + FRAC_CONST(0.00262017586902), FRAC_CONST(0.00278704643465), + FRAC_CONST(0.00294694477165), FRAC_CONST(0.00311254206525), + FRAC_CONST(0.00327396134847), FRAC_CONST(0.00344188741828), + FRAC_CONST(0.00360082681231), FRAC_CONST(0.00376039229104), + FRAC_CONST(0.00392074323703), FRAC_CONST(0.00408197531935), + FRAC_CONST(0.0042264269227), FRAC_CONST(0.00437307196781), + FRAC_CONST(0.00452098527825), FRAC_CONST(0.00466064606118), + FRAC_CONST(0.00479325608498), FRAC_CONST(0.00491376035745), + FRAC_CONST(0.00503930226013), FRAC_CONST(0.00514073539032), + FRAC_CONST(0.00524611661324), FRAC_CONST(0.00534716811982), + FRAC_CONST(0.00541967759307), FRAC_CONST(0.00548760401507), + FRAC_CONST(0.00554757145088), FRAC_CONST(0.00559380230045), + FRAC_CONST(0.00562206432097), FRAC_CONST(0.00564551969164), + FRAC_CONST(0.00563891995151), FRAC_CONST(0.00562661141932), + FRAC_CONST(0.0055917128663), FRAC_CONST(0.005540436394), + FRAC_CONST(0.0054753783077), FRAC_CONST(0.0053838975897), + FRAC_CONST(0.00527157587272), FRAC_CONST(0.00513822754514), + FRAC_CONST(0.00498396877629), FRAC_CONST(0.004810946906), + FRAC_CONST(0.00460395301471), FRAC_CONST(0.00438018617447), + FRAC_CONST(0.0041251642327), FRAC_CONST(0.00384564081246), + FRAC_CONST(0.00354012465507), FRAC_CONST(0.00320918858098), + FRAC_CONST(0.00284467578623), FRAC_CONST(0.00245085400321), + FRAC_CONST(0.0020274176185), FRAC_CONST(0.00157846825768), + FRAC_CONST(0.00109023290512), FRAC_CONST(0.0005832264248), + FRAC_CONST(2.760451905E-005), FRAC_CONST(-0.00054642808664), + FRAC_CONST(-0.00115681355227), FRAC_CONST(-0.00180394725893), + FRAC_CONST(-0.00248267236449), FRAC_CONST(-0.003193377839), + FRAC_CONST(-0.00394011240522), FRAC_CONST(-0.004722259624), + FRAC_CONST(-0.00553372111088), FRAC_CONST(-0.00637922932685), + FRAC_CONST(-0.00726158168517), FRAC_CONST(-0.00817982333726), + FRAC_CONST(-0.00913253296085), FRAC_CONST(-0.01011502154986), + FRAC_CONST(-0.01113155480321), FRAC_CONST(-0.01218499959508), + FRAC_CONST(0.01327182200351), FRAC_CONST(0.01439046660792), + FRAC_CONST(0.01554055533423), FRAC_CONST(0.01673247129989), + FRAC_CONST(0.01794333813443), FRAC_CONST(0.01918724313698), + FRAC_CONST(0.02045317933555), FRAC_CONST(0.02174675502535), + FRAC_CONST(0.02306801692862), FRAC_CONST(0.02441609920285), + FRAC_CONST(0.02578758475467), FRAC_CONST(0.02718594296329), + FRAC_CONST(0.02860721736385), FRAC_CONST(0.03005026574279), + FRAC_CONST(0.03150176087389), FRAC_CONST(0.03297540810337), + FRAC_CONST(0.03446209487686), FRAC_CONST(0.03596975605542), + FRAC_CONST(0.03748128504252), FRAC_CONST(0.03900536794745), + FRAC_CONST(0.04053491705584), FRAC_CONST(0.04206490946367), + FRAC_CONST(0.04360975421304), FRAC_CONST(0.04514884056413), + FRAC_CONST(0.04668430272642), FRAC_CONST(0.04821657200672), + FRAC_CONST(0.04973857556014), FRAC_CONST(0.05125561555216), + FRAC_CONST(0.05276307465207), FRAC_CONST(0.05424527683589), + FRAC_CONST(0.05571736482138), FRAC_CONST(0.05716164501299), + FRAC_CONST(0.0585915683626), FRAC_CONST(0.05998374801761), + FRAC_CONST(0.06134551717207), FRAC_CONST(0.06268578081172), + FRAC_CONST(0.06397158980681), FRAC_CONST(0.0652247106438), + FRAC_CONST(0.06643675122104), FRAC_CONST(0.06760759851228), + FRAC_CONST(0.06870438283512), FRAC_CONST(0.06976302447127), + FRAC_CONST(0.07076287107266), FRAC_CONST(0.07170026731102), + FRAC_CONST(0.07256825833083), FRAC_CONST(0.07336202550803), + FRAC_CONST(0.07410036424342), FRAC_CONST(0.07474525581194), + FRAC_CONST(0.07531373362019), FRAC_CONST(0.07580083586584), + FRAC_CONST(0.07619924793396), FRAC_CONST(0.07649921704119), + FRAC_CONST(0.07670934904245), FRAC_CONST(0.07681739756964), + FRAC_CONST(0.07682300113923), FRAC_CONST(0.07672049241746), + FRAC_CONST(0.07650507183194), FRAC_CONST(0.07617483218536), + FRAC_CONST(0.07573057565061), FRAC_CONST(0.0751576255287), + FRAC_CONST(0.07446643947564), FRAC_CONST(0.0736406005762), + FRAC_CONST(0.07267746427299), FRAC_CONST(0.07158263647903), + FRAC_CONST(0.07035330735093), FRAC_CONST(0.06896640131951), + FRAC_CONST(0.06745250215166), FRAC_CONST(0.06576906686508), + FRAC_CONST(0.06394448059633), FRAC_CONST(0.06196027790387), + FRAC_CONST(0.0598166570809), FRAC_CONST(0.05751526919867), + FRAC_CONST(0.05504600343009), FRAC_CONST(0.05240938217366), + FRAC_CONST(0.04959786763445), FRAC_CONST(0.04663033051701), + FRAC_CONST(0.04347687821958), FRAC_CONST(0.04014582784127), + FRAC_CONST(0.03664181168133), FRAC_CONST(0.03295839306691), + FRAC_CONST(0.02908240060125), FRAC_CONST(0.02503075618909), + FRAC_CONST(0.02079970728622), FRAC_CONST(0.01637012582228), + FRAC_CONST(0.01176238327857), FRAC_CONST(0.00696368621617), + FRAC_CONST(0.00197656014503), FRAC_CONST(-0.00320868968304), + FRAC_CONST(-0.00857117491366), FRAC_CONST(-0.01412888273558), + FRAC_CONST(-0.01988341292573), FRAC_CONST(-0.02582272888064), + FRAC_CONST(-0.03195312745332), FRAC_CONST(-0.03827765720822), + FRAC_CONST(-0.04478068215856), FRAC_CONST(-0.05148041767934), + FRAC_CONST(-0.05837053268336), FRAC_CONST(-0.06544098531359), + FRAC_CONST(-0.07269433008129), FRAC_CONST(-0.08013729344279), + FRAC_CONST(-0.08775475365593), FRAC_CONST(-0.09555333528914), + FRAC_CONST(-0.10353295311463), FRAC_CONST(-0.1116826931773), + FRAC_CONST(-0.120007798468), FRAC_CONST(-0.12850028503878), + FRAC_CONST(-0.13715517611934), FRAC_CONST(-0.1459766491187), + FRAC_CONST(-0.15496070710605), FRAC_CONST(-0.16409588556669), + FRAC_CONST(-0.17338081721706), FRAC_CONST(-0.18281725485142), + FRAC_CONST(-0.19239667457267), FRAC_CONST(-0.20212501768103), + FRAC_CONST(-0.21197358538056), FRAC_CONST(-0.22196526964149), + FRAC_CONST(-0.23206908706791), FRAC_CONST(-0.24230168845974), + FRAC_CONST(-0.25264803095722), FRAC_CONST(-0.26310532994603), + FRAC_CONST(-0.27366340405625), FRAC_CONST(-0.28432141891085), + FRAC_CONST(-0.29507167170646), FRAC_CONST(-0.30590985751916), + FRAC_CONST(-0.31682789136456), FRAC_CONST(-0.32781137272105), + FRAC_CONST(-0.33887226938665), FRAC_CONST(-0.3499914122931), + FRAC_CONST(0.36115899031355), FRAC_CONST(0.37237955463061), + FRAC_CONST(0.38363500139043), FRAC_CONST(0.39492117615675), + FRAC_CONST(0.40623176767625), FRAC_CONST(0.41756968968409), + FRAC_CONST(0.42891199207373), FRAC_CONST(0.44025537543665), + FRAC_CONST(0.45159965356824), FRAC_CONST(0.46293080852757), + FRAC_CONST(0.47424532146115), FRAC_CONST(0.48552530911099), + FRAC_CONST(0.49677082545707), FRAC_CONST(0.50798175000434), + FRAC_CONST(0.51912349702391), FRAC_CONST(0.53022408956855), + FRAC_CONST(0.54125534487322), FRAC_CONST(0.55220512585061), + FRAC_CONST(0.5630789140137), FRAC_CONST(0.57385241316923), + FRAC_CONST(0.58454032354679), FRAC_CONST(0.59511230862496), + FRAC_CONST(0.6055783538918), FRAC_CONST(0.61591099320291), + FRAC_CONST(0.62612426956055), FRAC_CONST(0.63619801077286), + FRAC_CONST(0.64612696959461), FRAC_CONST(0.65590163024671), + FRAC_CONST(0.66551398801627), FRAC_CONST(0.67496631901712), + FRAC_CONST(0.68423532934598), FRAC_CONST(0.69332823767032), + FRAC_CONST(0.70223887193539), FRAC_CONST(0.71094104263095), + FRAC_CONST(0.71944626349561), FRAC_CONST(0.72774489002994), + FRAC_CONST(0.73582117582769), FRAC_CONST(0.74368278636488), + FRAC_CONST(0.75131374561237), FRAC_CONST(0.75870807608242), + FRAC_CONST(0.76586748650939), FRAC_CONST(0.77277808813327), + FRAC_CONST(0.77942875190216), FRAC_CONST(0.7858353120392), + FRAC_CONST(0.79197358416424), FRAC_CONST(0.797846641377), + FRAC_CONST(0.80344857518505), FRAC_CONST(0.80876950044491), + FRAC_CONST(0.81381912706217), FRAC_CONST(0.81857760046468), + FRAC_CONST(0.82304198905409), FRAC_CONST(0.8272275347336), + FRAC_CONST(0.8311038457152), FRAC_CONST(0.83469373618402), + FRAC_CONST(0.83797173378865), FRAC_CONST(0.84095413924722), + FRAC_CONST(0.84362382812005), FRAC_CONST(0.84598184698206), + FRAC_CONST(0.84803157770763), FRAC_CONST(0.84978051984268), + FRAC_CONST(0.85119715249343), FRAC_CONST(0.85230470352147), + FRAC_CONST(0.85310209497017), FRAC_CONST(0.85357205739107), + FRAC_CONST(0.85373856005937 /*max*/), FRAC_CONST(0.85357205739107), + FRAC_CONST(0.85310209497017), FRAC_CONST(0.85230470352147), + FRAC_CONST(0.85119715249343), FRAC_CONST(0.84978051984268), + FRAC_CONST(0.84803157770763), FRAC_CONST(0.84598184698206), + FRAC_CONST(0.84362382812005), FRAC_CONST(0.84095413924722), + FRAC_CONST(0.83797173378865), FRAC_CONST(0.83469373618402), + FRAC_CONST(0.8311038457152), FRAC_CONST(0.8272275347336), + FRAC_CONST(0.82304198905409), FRAC_CONST(0.81857760046468), + FRAC_CONST(0.81381912706217), FRAC_CONST(0.80876950044491), + FRAC_CONST(0.80344857518505), FRAC_CONST(0.797846641377), + FRAC_CONST(0.79197358416424), FRAC_CONST(0.7858353120392), + FRAC_CONST(0.77942875190216), FRAC_CONST(0.77277808813327), + FRAC_CONST(0.76586748650939), FRAC_CONST(0.75870807608242), + FRAC_CONST(0.75131374561237), FRAC_CONST(0.74368278636488), + FRAC_CONST(0.73582117582769), FRAC_CONST(0.72774489002994), + FRAC_CONST(0.71944626349561), FRAC_CONST(0.71094104263095), + FRAC_CONST(0.70223887193539), FRAC_CONST(0.69332823767032), + FRAC_CONST(0.68423532934598), FRAC_CONST(0.67496631901712), + FRAC_CONST(0.66551398801627), FRAC_CONST(0.65590163024671), + FRAC_CONST(0.64612696959461), FRAC_CONST(0.63619801077286), + FRAC_CONST(0.62612426956055), FRAC_CONST(0.61591099320291), + FRAC_CONST(0.6055783538918), FRAC_CONST(0.59511230862496), + FRAC_CONST(0.58454032354679), FRAC_CONST(0.57385241316923), + FRAC_CONST(0.5630789140137), FRAC_CONST(0.55220512585061), + FRAC_CONST(0.54125534487322), FRAC_CONST(0.53022408956855), + FRAC_CONST(0.51912349702391), FRAC_CONST(0.50798175000434), + FRAC_CONST(0.49677082545707), FRAC_CONST(0.48552530911099), + FRAC_CONST(0.47424532146115), FRAC_CONST(0.46293080852757), + FRAC_CONST(0.45159965356824), FRAC_CONST(0.44025537543665), + FRAC_CONST(0.42891199207373), FRAC_CONST(0.41756968968409), + FRAC_CONST(0.40623176767625), FRAC_CONST(0.39492117615675), + FRAC_CONST(0.38363500139043), FRAC_CONST(0.37237955463061), + FRAC_CONST(-0.36115899031355), FRAC_CONST(-0.3499914122931), + FRAC_CONST(-0.33887226938665), FRAC_CONST(-0.32781137272105), + FRAC_CONST(-0.31682789136456), FRAC_CONST(-0.30590985751916), + FRAC_CONST(-0.29507167170646), FRAC_CONST(-0.28432141891085), + FRAC_CONST(-0.27366340405625), FRAC_CONST(-0.26310532994603), + FRAC_CONST(-0.25264803095722), FRAC_CONST(-0.24230168845974), + FRAC_CONST(-0.23206908706791), FRAC_CONST(-0.22196526964149), + FRAC_CONST(-0.21197358538056), FRAC_CONST(-0.20212501768103), + FRAC_CONST(-0.19239667457267), FRAC_CONST(-0.18281725485142), + FRAC_CONST(-0.17338081721706), FRAC_CONST(-0.16409588556669), + FRAC_CONST(-0.15496070710605), FRAC_CONST(-0.1459766491187), + FRAC_CONST(-0.13715517611934), FRAC_CONST(-0.12850028503878), + FRAC_CONST(-0.120007798468), FRAC_CONST(-0.1116826931773), + FRAC_CONST(-0.10353295311463), FRAC_CONST(-0.09555333528914), + FRAC_CONST(-0.08775475365593), FRAC_CONST(-0.08013729344279), + FRAC_CONST(-0.07269433008129), FRAC_CONST(-0.06544098531359), + FRAC_CONST(-0.05837053268336), FRAC_CONST(-0.05148041767934), + FRAC_CONST(-0.04478068215856), FRAC_CONST(-0.03827765720822), + FRAC_CONST(-0.03195312745332), FRAC_CONST(-0.02582272888064), + FRAC_CONST(-0.01988341292573), FRAC_CONST(-0.01412888273558), + FRAC_CONST(-0.00857117491366), FRAC_CONST(-0.00320868968304), + FRAC_CONST(0.00197656014503), FRAC_CONST(0.00696368621617), + FRAC_CONST(0.01176238327857), FRAC_CONST(0.01637012582228), + FRAC_CONST(0.02079970728622), FRAC_CONST(0.02503075618909), + FRAC_CONST(0.02908240060125), FRAC_CONST(0.03295839306691), + FRAC_CONST(0.03664181168133), FRAC_CONST(0.04014582784127), + FRAC_CONST(0.04347687821958), FRAC_CONST(0.04663033051701), + FRAC_CONST(0.04959786763445), FRAC_CONST(0.05240938217366), + FRAC_CONST(0.05504600343009), FRAC_CONST(0.05751526919867), + FRAC_CONST(0.0598166570809), FRAC_CONST(0.06196027790387), + FRAC_CONST(0.06394448059633), FRAC_CONST(0.06576906686508), + FRAC_CONST(0.06745250215166), FRAC_CONST(0.06896640131951), + FRAC_CONST(0.07035330735093), FRAC_CONST(0.07158263647903), + FRAC_CONST(0.07267746427299), FRAC_CONST(0.0736406005762), + FRAC_CONST(0.07446643947564), FRAC_CONST(0.0751576255287), + FRAC_CONST(0.07573057565061), FRAC_CONST(0.07617483218536), + FRAC_CONST(0.07650507183194), FRAC_CONST(0.07672049241746), + FRAC_CONST(0.07682300113923), FRAC_CONST(0.07681739756964), + FRAC_CONST(0.07670934904245), FRAC_CONST(0.07649921704119), + FRAC_CONST(0.07619924793396), FRAC_CONST(0.07580083586584), + FRAC_CONST(0.07531373362019), FRAC_CONST(0.07474525581194), + FRAC_CONST(0.07410036424342), FRAC_CONST(0.07336202550803), + FRAC_CONST(0.07256825833083), FRAC_CONST(0.07170026731102), + FRAC_CONST(0.07076287107266), FRAC_CONST(0.06976302447127), + FRAC_CONST(0.06870438283512), FRAC_CONST(0.06760759851228), + FRAC_CONST(0.06643675122104), FRAC_CONST(0.0652247106438), + FRAC_CONST(0.06397158980681), FRAC_CONST(0.06268578081172), + FRAC_CONST(0.06134551717207), FRAC_CONST(0.05998374801761), + FRAC_CONST(0.0585915683626), FRAC_CONST(0.05716164501299), + FRAC_CONST(0.05571736482138), FRAC_CONST(0.05424527683589), + FRAC_CONST(0.05276307465207), FRAC_CONST(0.05125561555216), + FRAC_CONST(0.04973857556014), FRAC_CONST(0.04821657200672), + FRAC_CONST(0.04668430272642), FRAC_CONST(0.04514884056413), + FRAC_CONST(0.04360975421304), FRAC_CONST(0.04206490946367), + FRAC_CONST(0.04053491705584), FRAC_CONST(0.03900536794745), + FRAC_CONST(0.03748128504252), FRAC_CONST(0.03596975605542), + FRAC_CONST(0.03446209487686), FRAC_CONST(0.03297540810337), + FRAC_CONST(0.03150176087389), FRAC_CONST(0.03005026574279), + FRAC_CONST(0.02860721736385), FRAC_CONST(0.02718594296329), + FRAC_CONST(0.02578758475467), FRAC_CONST(0.02441609920285), + FRAC_CONST(0.02306801692862), FRAC_CONST(0.02174675502535), + FRAC_CONST(0.02045317933555), FRAC_CONST(0.01918724313698), + FRAC_CONST(0.01794333813443), FRAC_CONST(0.01673247129989), + FRAC_CONST(0.01554055533423), FRAC_CONST(0.01439046660792), + FRAC_CONST(-0.01327182200351), FRAC_CONST(-0.01218499959508), + FRAC_CONST(-0.01113155480321), FRAC_CONST(-0.01011502154986), + FRAC_CONST(-0.00913253296085), FRAC_CONST(-0.00817982333726), + FRAC_CONST(-0.00726158168517), FRAC_CONST(-0.00637922932685), + FRAC_CONST(-0.00553372111088), FRAC_CONST(-0.004722259624), + FRAC_CONST(-0.00394011240522), FRAC_CONST(-0.003193377839), + FRAC_CONST(-0.00248267236449), FRAC_CONST(-0.00180394725893), + FRAC_CONST(-0.00115681355227), FRAC_CONST(-0.00054642808664), + FRAC_CONST(2.760451905E-005), FRAC_CONST(0.0005832264248), + FRAC_CONST(0.00109023290512), FRAC_CONST(0.00157846825768), + FRAC_CONST(0.0020274176185), FRAC_CONST(0.00245085400321), + FRAC_CONST(0.00284467578623), FRAC_CONST(0.00320918858098), + FRAC_CONST(0.00354012465507), FRAC_CONST(0.00384564081246), + FRAC_CONST(0.0041251642327), FRAC_CONST(0.00438018617447), + FRAC_CONST(0.00460395301471), FRAC_CONST(0.004810946906), + FRAC_CONST(0.00498396877629), FRAC_CONST(0.00513822754514), + FRAC_CONST(0.00527157587272), FRAC_CONST(0.0053838975897), + FRAC_CONST(0.0054753783077), FRAC_CONST(0.005540436394), + FRAC_CONST(0.0055917128663), FRAC_CONST(0.00562661141932), + FRAC_CONST(0.00563891995151), FRAC_CONST(0.00564551969164), + FRAC_CONST(0.00562206432097), FRAC_CONST(0.00559380230045), + FRAC_CONST(0.00554757145088), FRAC_CONST(0.00548760401507), + FRAC_CONST(0.00541967759307), FRAC_CONST(0.00534716811982), + FRAC_CONST(0.00524611661324), FRAC_CONST(0.00514073539032), + FRAC_CONST(0.00503930226013), FRAC_CONST(0.00491376035745), + FRAC_CONST(0.00479325608498), FRAC_CONST(0.00466064606118), + FRAC_CONST(0.00452098527825), FRAC_CONST(0.00437307196781), + FRAC_CONST(0.0042264269227), FRAC_CONST(0.00408197531935), + FRAC_CONST(0.00392074323703), FRAC_CONST(0.00376039229104), + FRAC_CONST(0.00360082681231), FRAC_CONST(0.00344188741828), + FRAC_CONST(0.00327396134847), FRAC_CONST(0.00311254206525), + FRAC_CONST(0.00294694477165), FRAC_CONST(0.00278704643465), + FRAC_CONST(0.00262017586902), FRAC_CONST(0.00246256169126), + FRAC_CONST(0.00230172547746), FRAC_CONST(0.00214615835557), + FRAC_CONST(0.00198411407369), FRAC_CONST(0.00183482654224), + FRAC_CONST(0.00168680832531), FRAC_CONST(0.00154432198471), + FRAC_CONST(0.00139024948272), FRAC_CONST(0.00125778846475), + FRAC_CONST(0.00112501551307), FRAC_CONST(0.00098859883015), + FRAC_CONST(0.00086084433262), FRAC_CONST(0.00074580258865), + FRAC_CONST(0.00062393761391), FRAC_CONST(0.00051073884952), + FRAC_CONST(0.0004026540216), FRAC_CONST(0.00029495311041), + FRAC_CONST(0.00020430170688), FRAC_CONST(0.00010943831274), + FRAC_CONST(1.349497418E-005), FRAC_CONST(-6.173344072E-005), + FRAC_CONST(-0.00014463809349), FRAC_CONST(-0.0002098337344), + FRAC_CONST(-0.00028969811748), FRAC_CONST(-0.00035011758756), + FRAC_CONST(-0.00040951214522), FRAC_CONST(-0.00046063254803), + FRAC_CONST(-0.00051455722108), FRAC_CONST(-0.00055645763906), + FRAC_CONST(-0.0005946118933), FRAC_CONST(-0.00063415949025), + FRAC_CONST(-0.00066504150893), FRAC_CONST(-0.00069179375372), + FRAC_CONST(-0.00072153919876), FRAC_CONST(-0.00073193571525), + FRAC_CONST(-0.00075300014201), FRAC_CONST(-0.00076307935757), + FRAC_CONST(-0.0007757977331), FRAC_CONST(-0.00078014496257), + FRAC_CONST(-0.000780366471), FRAC_CONST(-0.00077798694927), + FRAC_CONST(-0.00078343322877), FRAC_CONST(-0.00077248485949), + FRAC_CONST(-0.0007681371927), FRAC_CONST(-0.00074905980532), + FRAC_CONST(-0.00074409418541), FRAC_CONST(-0.00072550431222), + FRAC_CONST(-0.00071577364744), FRAC_CONST(-0.00069416146273), + FRAC_CONST(-0.00067776907764), FRAC_CONST(-0.00065403333621), + FRAC_CONST(-0.00063124935319), FRAC_CONST(-0.00061327473938), + FRAC_CONST(-0.00058709304852), FRAC_CONST(-0.00056778025613), + FRAC_CONST(-0.00054665656337), FRAC_CONST(-0.00052265642972), + FRAC_CONST(-0.00050407143497), FRAC_CONST(-0.00048937912498), + FRAC_CONST(-0.00048752279712), FRAC_CONST(-0.00049475180896), + FRAC_CONST(-0.00056176925738), FRAC_CONST(-0.00055252865047) +}; + +#endif + diff --git a/Libraries/FAAD2/Files/libfaad/sbr_syntax.c b/Libraries/FAAD2/Files/libfaad/sbr_syntax.c new file mode 100644 index 000000000..4920d701e --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/sbr_syntax.c @@ -0,0 +1,871 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#include "common.h" +#include "structs.h" + +#ifdef SBR_DEC + +#include "sbr_syntax.h" +#include "syntax.h" +#include "sbr_huff.h" +#include "sbr_fbt.h" +#include "sbr_tf_grid.h" +#include "sbr_e_nf.h" +#include "bits.h" +#ifdef PS_DEC +#include "ps_dec.h" +#endif +#ifdef DRM_PS +#include "drm_dec.h" +#endif +#include "analysis.h" + +/* static function declarations */ +static void sbr_header(bitfile *ld, sbr_info *sbr); +static uint8_t calc_sbr_tables(sbr_info *sbr, uint8_t start_freq, uint8_t stop_freq, + uint8_t samplerate_mode, uint8_t freq_scale, + uint8_t alter_scale, uint8_t xover_band); +static uint8_t sbr_data(bitfile *ld, sbr_info *sbr); +static uint16_t sbr_extension(bitfile *ld, sbr_info *sbr, + uint8_t bs_extension_id, uint16_t num_bits_left); +static uint8_t sbr_single_channel_element(bitfile *ld, sbr_info *sbr); +static uint8_t sbr_channel_pair_element(bitfile *ld, sbr_info *sbr); +static uint8_t sbr_grid(bitfile *ld, sbr_info *sbr, uint8_t ch); +static void sbr_dtdf(bitfile *ld, sbr_info *sbr, uint8_t ch); +static void invf_mode(bitfile *ld, sbr_info *sbr, uint8_t ch); +static void sinusoidal_coding(bitfile *ld, sbr_info *sbr, uint8_t ch); + + +static void sbr_reset(sbr_info *sbr) +{ +#if 0 + printf("%d\n", sbr->bs_start_freq_prev); + printf("%d\n", sbr->bs_stop_freq_prev); + printf("%d\n", sbr->bs_freq_scale_prev); + printf("%d\n", sbr->bs_alter_scale_prev); + printf("%d\n", sbr->bs_xover_band_prev); + printf("%d\n\n", sbr->bs_noise_bands_prev); +#endif + + /* if these are different from the previous frame: Reset = 1 */ + if ((sbr->bs_start_freq != sbr->bs_start_freq_prev) || + (sbr->bs_stop_freq != sbr->bs_stop_freq_prev) || + (sbr->bs_freq_scale != sbr->bs_freq_scale_prev) || + (sbr->bs_alter_scale != sbr->bs_alter_scale_prev) || + (sbr->bs_xover_band != sbr->bs_xover_band_prev) || + (sbr->bs_noise_bands != sbr->bs_noise_bands_prev)) + { + sbr->Reset = 1; + } else { + sbr->Reset = 0; + } + + sbr->bs_start_freq_prev = sbr->bs_start_freq; + sbr->bs_stop_freq_prev = sbr->bs_stop_freq; + sbr->bs_freq_scale_prev = sbr->bs_freq_scale; + sbr->bs_alter_scale_prev = sbr->bs_alter_scale; + sbr->bs_xover_band_prev = sbr->bs_xover_band; + sbr->bs_noise_bands_prev = sbr->bs_noise_bands; +} + +static uint8_t calc_sbr_tables(sbr_info *sbr, uint8_t start_freq, uint8_t stop_freq, + uint8_t samplerate_mode, uint8_t freq_scale, + uint8_t alter_scale, uint8_t xover_band) +{ + uint8_t result = 0; + uint8_t k2; + + /* calculate the Master Frequency Table */ + sbr->k0 = qmf_start_channel(start_freq, samplerate_mode, sbr->sample_rate); + k2 = qmf_stop_channel(stop_freq, sbr->sample_rate, sbr->k0); + + /* check k0 and k2 */ + if (sbr->sample_rate >= 48000) + { + if ((k2 - sbr->k0) > 32) + result += 1; + } else if (sbr->sample_rate <= 32000) { + if ((k2 - sbr->k0) > 48) + result += 1; + } else { /* (sbr->sample_rate == 44100) */ + if ((k2 - sbr->k0) > 45) + result += 1; + } + + if (freq_scale == 0) + { + result += master_frequency_table_fs0(sbr, sbr->k0, k2, alter_scale); + } else { + result += master_frequency_table(sbr, sbr->k0, k2, freq_scale, alter_scale); + } + result += derived_frequency_table(sbr, xover_band, k2); + + result = (result > 0) ? 1 : 0; + + return result; +} + +/* table 2 */ +uint8_t sbr_extension_data(bitfile *ld, sbr_info *sbr, uint16_t cnt) +{ + uint8_t result = 0; + uint16_t num_align_bits = 0; + uint16_t num_sbr_bits = (uint16_t)faad_get_processed_bits(ld); + + uint8_t saved_start_freq, saved_samplerate_mode; + uint8_t saved_stop_freq, saved_freq_scale; + uint8_t saved_alter_scale, saved_xover_band; + +#ifdef DRM + if (!sbr->Is_DRM_SBR) +#endif + { + uint8_t bs_extension_type = (uint8_t)faad_getbits(ld, 4 + DEBUGVAR(1,198,"sbr_bitstream(): bs_extension_type")); + + if (bs_extension_type == EXT_SBR_DATA_CRC) + { + sbr->bs_sbr_crc_bits = (uint16_t)faad_getbits(ld, 10 + DEBUGVAR(1,199,"sbr_bitstream(): bs_sbr_crc_bits")); + } + } + + /* save old header values, in case the new ones are corrupted */ + saved_start_freq = sbr->bs_start_freq; + saved_samplerate_mode = sbr->bs_samplerate_mode; + saved_stop_freq = sbr->bs_stop_freq; + saved_freq_scale = sbr->bs_freq_scale; + saved_alter_scale = sbr->bs_alter_scale; + saved_xover_band = sbr->bs_xover_band; + + sbr->bs_header_flag = faad_get1bit(ld + DEBUGVAR(1,200,"sbr_bitstream(): bs_header_flag")); + + if (sbr->bs_header_flag) + sbr_header(ld, sbr); + + /* Reset? */ + sbr_reset(sbr); + + /* first frame should have a header */ + //if (!(sbr->frame == 0 && sbr->bs_header_flag == 0)) + if (sbr->header_count != 0) + { + if (sbr->Reset || (sbr->bs_header_flag && sbr->just_seeked)) + { + uint8_t rt = calc_sbr_tables(sbr, sbr->bs_start_freq, sbr->bs_stop_freq, + sbr->bs_samplerate_mode, sbr->bs_freq_scale, + sbr->bs_alter_scale, sbr->bs_xover_band); + + /* if an error occured with the new header values revert to the old ones */ + if (rt > 0) + { + calc_sbr_tables(sbr, saved_start_freq, saved_stop_freq, + saved_samplerate_mode, saved_freq_scale, + saved_alter_scale, saved_xover_band); + } + } + + if (result == 0) + { + result = sbr_data(ld, sbr); + + /* sbr_data() returning an error means that there was an error in + envelope_time_border_vector(). + In this case the old time border vector is saved and all the previous + data normally read after sbr_grid() is saved. + */ + /* to be on the safe side, calculate old sbr tables in case of error */ + if ((result > 0) && + (sbr->Reset || (sbr->bs_header_flag && sbr->just_seeked))) + { + calc_sbr_tables(sbr, saved_start_freq, saved_stop_freq, + saved_samplerate_mode, saved_freq_scale, + saved_alter_scale, saved_xover_band); + } + + /* we should be able to safely set result to 0 now */ + result = 0; + } + } else { + result = 1; + } + +#ifdef DRM + if (!sbr->Is_DRM_SBR) +#endif + { + num_sbr_bits = (uint16_t)faad_get_processed_bits(ld) - num_sbr_bits; + + /* check if we read more bits then were available for sbr */ + if (8*cnt < num_sbr_bits) + return 1; + + /* -4 does not apply, bs_extension_type is re-read in this function */ + num_align_bits = 8*cnt /*- 4*/ - num_sbr_bits; + + while (num_align_bits > 7) + { + faad_getbits(ld, 8 + DEBUGVAR(1,999,"sbr_bitstream(): num_align_bits")); + num_align_bits -= 8; + } + faad_getbits(ld, num_align_bits + DEBUGVAR(1,999,"sbr_bitstream(): num_align_bits")); + } + + return result; +} + +/* table 3 */ +static void sbr_header(bitfile *ld, sbr_info *sbr) +{ + uint8_t bs_header_extra_1, bs_header_extra_2; + + sbr->header_count++; + + sbr->bs_amp_res = faad_get1bit(ld + DEBUGVAR(1,203,"sbr_header(): bs_amp_res")); + + /* bs_start_freq and bs_stop_freq must define a fequency band that does + not exceed 48 channels */ + sbr->bs_start_freq = (uint8_t)faad_getbits(ld, 4 + DEBUGVAR(1,204,"sbr_header(): bs_start_freq")); + sbr->bs_stop_freq = (uint8_t)faad_getbits(ld, 4 + DEBUGVAR(1,205,"sbr_header(): bs_stop_freq")); + sbr->bs_xover_band = (uint8_t)faad_getbits(ld, 3 + DEBUGVAR(1,206,"sbr_header(): bs_xover_band")); + faad_getbits(ld, 2 + DEBUGVAR(1,207,"sbr_header(): bs_reserved_bits_hdr")); + bs_header_extra_1 = (uint8_t)faad_get1bit(ld + DEBUGVAR(1,208,"sbr_header(): bs_header_extra_1")); + bs_header_extra_2 = (uint8_t)faad_get1bit(ld + DEBUGVAR(1,209,"sbr_header(): bs_header_extra_2")); + + if (bs_header_extra_1) + { + sbr->bs_freq_scale = (uint8_t)faad_getbits(ld, 2 + DEBUGVAR(1,211,"sbr_header(): bs_freq_scale")); + sbr->bs_alter_scale = (uint8_t)faad_get1bit(ld + DEBUGVAR(1,212,"sbr_header(): bs_alter_scale")); + sbr->bs_noise_bands = (uint8_t)faad_getbits(ld, 2 + DEBUGVAR(1,213,"sbr_header(): bs_noise_bands")); + } else { + /* Default values */ + sbr->bs_freq_scale = 2; + sbr->bs_alter_scale = 1; + sbr->bs_noise_bands = 2; + } + + if (bs_header_extra_2) + { + sbr->bs_limiter_bands = (uint8_t)faad_getbits(ld, 2 + DEBUGVAR(1,214,"sbr_header(): bs_limiter_bands")); + sbr->bs_limiter_gains = (uint8_t)faad_getbits(ld, 2 + DEBUGVAR(1,215,"sbr_header(): bs_limiter_gains")); + sbr->bs_interpol_freq = (uint8_t)faad_get1bit(ld + DEBUGVAR(1,216,"sbr_header(): bs_interpol_freq")); + sbr->bs_smoothing_mode = (uint8_t)faad_get1bit(ld + DEBUGVAR(1,217,"sbr_header(): bs_smoothing_mode")); + } else { + /* Default values */ + sbr->bs_limiter_bands = 2; + sbr->bs_limiter_gains = 2; + sbr->bs_interpol_freq = 1; + sbr->bs_smoothing_mode = 1; + } + +#if 0 + /* print the header to screen */ + printf("bs_amp_res: %d\n", sbr->bs_amp_res); + printf("bs_start_freq: %d\n", sbr->bs_start_freq); + printf("bs_stop_freq: %d\n", sbr->bs_stop_freq); + printf("bs_xover_band: %d\n", sbr->bs_xover_band); + if (bs_header_extra_1) + { + printf("bs_freq_scale: %d\n", sbr->bs_freq_scale); + printf("bs_alter_scale: %d\n", sbr->bs_alter_scale); + printf("bs_noise_bands: %d\n", sbr->bs_noise_bands); + } + if (bs_header_extra_2) + { + printf("bs_limiter_bands: %d\n", sbr->bs_limiter_bands); + printf("bs_limiter_gains: %d\n", sbr->bs_limiter_gains); + printf("bs_interpol_freq: %d\n", sbr->bs_interpol_freq); + printf("bs_smoothing_mode: %d\n", sbr->bs_smoothing_mode); + } + printf("\n"); +#endif +} + +/* table 4 */ +static uint8_t sbr_data(bitfile *ld, sbr_info *sbr) +{ + uint8_t result; +#if 0 + sbr->bs_samplerate_mode = faad_get1bit(ld + DEBUGVAR(1,219,"sbr_data(): bs_samplerate_mode")); +#endif + + sbr->rate = (sbr->bs_samplerate_mode) ? 2 : 1; + + switch (sbr->id_aac) + { + case ID_SCE: + if ((result = sbr_single_channel_element(ld, sbr)) > 0) + return result; + break; + case ID_CPE: + if ((result = sbr_channel_pair_element(ld, sbr)) > 0) + return result; + break; + } + + return 0; +} + +/* table 5 */ +static uint8_t sbr_single_channel_element(bitfile *ld, sbr_info *sbr) +{ + uint8_t result; + + if (faad_get1bit(ld + DEBUGVAR(1,220,"sbr_single_channel_element(): bs_data_extra"))) + { + faad_getbits(ld, 4 + DEBUGVAR(1,221,"sbr_single_channel_element(): bs_reserved_bits_data")); + } + +#ifdef DRM + /* bs_coupling, from sbr_channel_pair_base_element(bs_amp_res) */ + if (sbr->Is_DRM_SBR) + faad_get1bit(ld); +#endif + + if ((result = sbr_grid(ld, sbr, 0)) > 0) + return result; + sbr_dtdf(ld, sbr, 0); + invf_mode(ld, sbr, 0); + sbr_envelope(ld, sbr, 0); + sbr_noise(ld, sbr, 0); + +#ifndef FIXED_POINT + envelope_noise_dequantisation(sbr, 0); +#endif + + memset(sbr->bs_add_harmonic[0], 0, 64*sizeof(uint8_t)); + + sbr->bs_add_harmonic_flag[0] = faad_get1bit(ld + DEBUGVAR(1,223,"sbr_single_channel_element(): bs_add_harmonic_flag[0]")); + if (sbr->bs_add_harmonic_flag[0]) + sinusoidal_coding(ld, sbr, 0); + + sbr->bs_extended_data = faad_get1bit(ld + DEBUGVAR(1,224,"sbr_single_channel_element(): bs_extended_data[0]")); + + if (sbr->bs_extended_data) + { + uint16_t nr_bits_left; +#if (defined(PS_DEC) || defined(DRM_PS)) + uint8_t ps_ext_read = 0; +#endif + uint16_t cnt = (uint16_t)faad_getbits(ld, 4 + DEBUGVAR(1,225,"sbr_single_channel_element(): bs_extension_size")); + if (cnt == 15) + { + cnt += (uint16_t)faad_getbits(ld, 8 + DEBUGVAR(1,226,"sbr_single_channel_element(): bs_esc_count")); + } + + nr_bits_left = 8 * cnt; + while (nr_bits_left > 7) + { + uint16_t tmp_nr_bits = 0; + + sbr->bs_extension_id = (uint8_t)faad_getbits(ld, 2 + DEBUGVAR(1,227,"sbr_single_channel_element(): bs_extension_id")); + tmp_nr_bits += 2; + + /* allow only 1 PS extension element per extension data */ +#if (defined(PS_DEC) || defined(DRM_PS)) +#if (defined(PS_DEC) && defined(DRM_PS)) + if (sbr->bs_extension_id == EXTENSION_ID_PS || sbr->bs_extension_id == DRM_PARAMETRIC_STEREO) +#else +#ifdef PS_DEC + if (sbr->bs_extension_id == EXTENSION_ID_PS) +#else +#ifdef DRM_PS + if (sbr->bs_extension_id == DRM_PARAMETRIC_STEREO) +#endif +#endif +#endif + { + if (ps_ext_read == 0) + { + ps_ext_read = 1; + } else { + /* to be safe make it 3, will switch to "default" + * in sbr_extension() */ + sbr->bs_extension_id = 3; + } + } +#endif + + tmp_nr_bits += sbr_extension(ld, sbr, sbr->bs_extension_id, nr_bits_left); + + /* check if the data read is bigger than the number of available bits */ + if (tmp_nr_bits > nr_bits_left) + return 1; + + nr_bits_left -= tmp_nr_bits; + } + + /* Corrigendum */ + if (nr_bits_left > 0) + { + faad_getbits(ld, nr_bits_left + DEBUGVAR(1,280,"sbr_single_channel_element(): nr_bits_left")); + } + } + + return 0; +} + +/* table 6 */ +static uint8_t sbr_channel_pair_element(bitfile *ld, sbr_info *sbr) +{ + uint8_t n, result; + + if (faad_get1bit(ld + DEBUGVAR(1,228,"sbr_single_channel_element(): bs_data_extra"))) + { + faad_getbits(ld, 4 + DEBUGVAR(1,228,"sbr_channel_pair_element(): bs_reserved_bits_data")); + faad_getbits(ld, 4 + DEBUGVAR(1,228,"sbr_channel_pair_element(): bs_reserved_bits_data")); + } + + sbr->bs_coupling = faad_get1bit(ld + DEBUGVAR(1,228,"sbr_channel_pair_element(): bs_coupling")); + + if (sbr->bs_coupling) + { + if ((result = sbr_grid(ld, sbr, 0)) > 0) + return result; + + /* need to copy some data from left to right */ + sbr->bs_frame_class[1] = sbr->bs_frame_class[0]; + sbr->L_E[1] = sbr->L_E[0]; + sbr->L_Q[1] = sbr->L_Q[0]; + sbr->bs_pointer[1] = sbr->bs_pointer[0]; + + for (n = 0; n <= sbr->L_E[0]; n++) + { + sbr->t_E[1][n] = sbr->t_E[0][n]; + sbr->f[1][n] = sbr->f[0][n]; + } + for (n = 0; n <= sbr->L_Q[0]; n++) + sbr->t_Q[1][n] = sbr->t_Q[0][n]; + + sbr_dtdf(ld, sbr, 0); + sbr_dtdf(ld, sbr, 1); + invf_mode(ld, sbr, 0); + + /* more copying */ + for (n = 0; n < sbr->N_Q; n++) + sbr->bs_invf_mode[1][n] = sbr->bs_invf_mode[0][n]; + + sbr_envelope(ld, sbr, 0); + sbr_noise(ld, sbr, 0); + sbr_envelope(ld, sbr, 1); + sbr_noise(ld, sbr, 1); + + memset(sbr->bs_add_harmonic[0], 0, 64*sizeof(uint8_t)); + memset(sbr->bs_add_harmonic[1], 0, 64*sizeof(uint8_t)); + + sbr->bs_add_harmonic_flag[0] = faad_get1bit(ld + DEBUGVAR(1,231,"sbr_channel_pair_element(): bs_add_harmonic_flag[0]")); + if (sbr->bs_add_harmonic_flag[0]) + sinusoidal_coding(ld, sbr, 0); + + sbr->bs_add_harmonic_flag[1] = faad_get1bit(ld + DEBUGVAR(1,232,"sbr_channel_pair_element(): bs_add_harmonic_flag[1]")); + if (sbr->bs_add_harmonic_flag[1]) + sinusoidal_coding(ld, sbr, 1); + } else { + uint8_t saved_t_E[6] = {0}, saved_t_Q[3] = {0}; + uint8_t saved_L_E = sbr->L_E[0]; + uint8_t saved_L_Q = sbr->L_Q[0]; + uint8_t saved_frame_class = sbr->bs_frame_class[0]; + + for (n = 0; n < saved_L_E; n++) + saved_t_E[n] = sbr->t_E[0][n]; + for (n = 0; n < saved_L_Q; n++) + saved_t_Q[n] = sbr->t_Q[0][n]; + + if ((result = sbr_grid(ld, sbr, 0)) > 0) + return result; + if ((result = sbr_grid(ld, sbr, 1)) > 0) + { + /* restore first channel data as well */ + sbr->bs_frame_class[0] = saved_frame_class; + sbr->L_E[0] = saved_L_E; + sbr->L_Q[0] = saved_L_Q; + for (n = 0; n < 6; n++) + sbr->t_E[0][n] = saved_t_E[n]; + for (n = 0; n < 3; n++) + sbr->t_Q[0][n] = saved_t_Q[n]; + + return result; + } + sbr_dtdf(ld, sbr, 0); + sbr_dtdf(ld, sbr, 1); + invf_mode(ld, sbr, 0); + invf_mode(ld, sbr, 1); + sbr_envelope(ld, sbr, 0); + sbr_envelope(ld, sbr, 1); + sbr_noise(ld, sbr, 0); + sbr_noise(ld, sbr, 1); + + memset(sbr->bs_add_harmonic[0], 0, 64*sizeof(uint8_t)); + memset(sbr->bs_add_harmonic[1], 0, 64*sizeof(uint8_t)); + + sbr->bs_add_harmonic_flag[0] = faad_get1bit(ld + DEBUGVAR(1,239,"sbr_channel_pair_element(): bs_add_harmonic_flag[0]")); + if (sbr->bs_add_harmonic_flag[0]) + sinusoidal_coding(ld, sbr, 0); + + sbr->bs_add_harmonic_flag[1] = faad_get1bit(ld + DEBUGVAR(1,240,"sbr_channel_pair_element(): bs_add_harmonic_flag[1]")); + if (sbr->bs_add_harmonic_flag[1]) + sinusoidal_coding(ld, sbr, 1); + } +#ifndef FIXED_POINT + envelope_noise_dequantisation(sbr, 0); + envelope_noise_dequantisation(sbr, 1); + + if (sbr->bs_coupling) + unmap_envelope_noise(sbr); +#endif + + sbr->bs_extended_data = faad_get1bit(ld + DEBUGVAR(1,233,"sbr_channel_pair_element(): bs_extended_data[0]")); + if (sbr->bs_extended_data) + { + uint16_t nr_bits_left; + uint16_t cnt = (uint16_t)faad_getbits(ld, 4 + DEBUGVAR(1,234,"sbr_channel_pair_element(): bs_extension_size")); + if (cnt == 15) + { + cnt += (uint16_t)faad_getbits(ld, 8 + DEBUGVAR(1,235,"sbr_channel_pair_element(): bs_esc_count")); + } + + nr_bits_left = 8 * cnt; + while (nr_bits_left > 7) + { + uint16_t tmp_nr_bits = 0; + + sbr->bs_extension_id = (uint8_t)faad_getbits(ld, 2 + DEBUGVAR(1,236,"sbr_channel_pair_element(): bs_extension_id")); + tmp_nr_bits += 2; + tmp_nr_bits += sbr_extension(ld, sbr, sbr->bs_extension_id, nr_bits_left); + + /* check if the data read is bigger than the number of available bits */ + if (tmp_nr_bits > nr_bits_left) + return 1; + + nr_bits_left -= tmp_nr_bits; + } + + /* Corrigendum */ + if (nr_bits_left > 0) + { + faad_getbits(ld, nr_bits_left + DEBUGVAR(1,280,"sbr_channel_pair_element(): nr_bits_left")); + } + } + + return 0; +} + +/* integer log[2](x): input range [0,10) */ +static int8_t sbr_log2(const int8_t val) +{ + int8_t log2tab[] = { 0, 0, 1, 2, 2, 3, 3, 3, 3, 4 }; + if (val < 10 && val >= 0) + return log2tab[val]; + else + return 0; +} + + +/* table 7 */ +static uint8_t sbr_grid(bitfile *ld, sbr_info *sbr, uint8_t ch) +{ + uint8_t i, env, rel, result; + uint8_t bs_abs_bord, bs_abs_bord_1; + uint8_t bs_num_env = 0; + uint8_t saved_L_E = sbr->L_E[ch]; + uint8_t saved_L_Q = sbr->L_Q[ch]; + uint8_t saved_frame_class = sbr->bs_frame_class[ch]; + + sbr->bs_frame_class[ch] = (uint8_t)faad_getbits(ld, 2 + DEBUGVAR(1,248,"sbr_grid(): bs_frame_class")); + + switch (sbr->bs_frame_class[ch]) + { + case FIXFIX: + i = (uint8_t)faad_getbits(ld, 2 + DEBUGVAR(1,249,"sbr_grid(): bs_num_env_raw")); + + bs_num_env = min(1 << i, 5); + + i = (uint8_t)faad_get1bit(ld + DEBUGVAR(1,250,"sbr_grid(): bs_freq_res_flag")); + for (env = 0; env < bs_num_env; env++) + sbr->f[ch][env] = i; + + sbr->abs_bord_lead[ch] = 0; + sbr->abs_bord_trail[ch] = sbr->numTimeSlots; + sbr->n_rel_lead[ch] = bs_num_env - 1; + sbr->n_rel_trail[ch] = 0; + break; + + case FIXVAR: + bs_abs_bord = (uint8_t)faad_getbits(ld, 2 + DEBUGVAR(1,251,"sbr_grid(): bs_abs_bord")) + sbr->numTimeSlots; + bs_num_env = (uint8_t)faad_getbits(ld, 2 + DEBUGVAR(1,252,"sbr_grid(): bs_num_env")) + 1; + + for (rel = 0; rel < bs_num_env-1; rel++) + { + sbr->bs_rel_bord[ch][rel] = 2 * (uint8_t)faad_getbits(ld, 2 + DEBUGVAR(1,253,"sbr_grid(): bs_rel_bord")) + 2; + } + i = sbr_log2(bs_num_env + 1); + sbr->bs_pointer[ch] = (uint8_t)faad_getbits(ld, i + DEBUGVAR(1,254,"sbr_grid(): bs_pointer")); + + for (env = 0; env < bs_num_env; env++) + { + sbr->f[ch][bs_num_env - env - 1] = (uint8_t)faad_get1bit(ld + DEBUGVAR(1,255,"sbr_grid(): bs_freq_res")); + } + + sbr->abs_bord_lead[ch] = 0; + sbr->abs_bord_trail[ch] = bs_abs_bord; + sbr->n_rel_lead[ch] = 0; + sbr->n_rel_trail[ch] = bs_num_env - 1; + break; + + case VARFIX: + bs_abs_bord = (uint8_t)faad_getbits(ld, 2 + DEBUGVAR(1,256,"sbr_grid(): bs_abs_bord")); + bs_num_env = (uint8_t)faad_getbits(ld, 2 + DEBUGVAR(1,257,"sbr_grid(): bs_num_env")) + 1; + + for (rel = 0; rel < bs_num_env-1; rel++) + { + sbr->bs_rel_bord[ch][rel] = 2 * (uint8_t)faad_getbits(ld, 2 + DEBUGVAR(1,258,"sbr_grid(): bs_rel_bord")) + 2; + } + i = sbr_log2(bs_num_env + 1); + sbr->bs_pointer[ch] = (uint8_t)faad_getbits(ld, i + DEBUGVAR(1,259,"sbr_grid(): bs_pointer")); + + for (env = 0; env < bs_num_env; env++) + { + sbr->f[ch][env] = (uint8_t)faad_get1bit(ld + DEBUGVAR(1,260,"sbr_grid(): bs_freq_res")); + } + + sbr->abs_bord_lead[ch] = bs_abs_bord; + sbr->abs_bord_trail[ch] = sbr->numTimeSlots; + sbr->n_rel_lead[ch] = bs_num_env - 1; + sbr->n_rel_trail[ch] = 0; + break; + + case VARVAR: + bs_abs_bord = (uint8_t)faad_getbits(ld, 2 + DEBUGVAR(1,261,"sbr_grid(): bs_abs_bord_0")); + bs_abs_bord_1 = (uint8_t)faad_getbits(ld, 2 + DEBUGVAR(1,262,"sbr_grid(): bs_abs_bord_1")) + sbr->numTimeSlots; + sbr->bs_num_rel_0[ch] = (uint8_t)faad_getbits(ld, 2 + DEBUGVAR(1,263,"sbr_grid(): bs_num_rel_0")); + sbr->bs_num_rel_1[ch] = (uint8_t)faad_getbits(ld, 2 + DEBUGVAR(1,264,"sbr_grid(): bs_num_rel_1")); + + bs_num_env = min(5, sbr->bs_num_rel_0[ch] + sbr->bs_num_rel_1[ch] + 1); + + for (rel = 0; rel < sbr->bs_num_rel_0[ch]; rel++) + { + sbr->bs_rel_bord_0[ch][rel] = 2 * (uint8_t)faad_getbits(ld, 2 + DEBUGVAR(1,265,"sbr_grid(): bs_rel_bord")) + 2; + } + for(rel = 0; rel < sbr->bs_num_rel_1[ch]; rel++) + { + sbr->bs_rel_bord_1[ch][rel] = 2 * (uint8_t)faad_getbits(ld, 2 + DEBUGVAR(1,266,"sbr_grid(): bs_rel_bord")) + 2; + } + i = sbr_log2(sbr->bs_num_rel_0[ch] + sbr->bs_num_rel_1[ch] + 2); + sbr->bs_pointer[ch] = (uint8_t)faad_getbits(ld, i + DEBUGVAR(1,267,"sbr_grid(): bs_pointer")); + + for (env = 0; env < bs_num_env; env++) + { + sbr->f[ch][env] = (uint8_t)faad_get1bit(ld + DEBUGVAR(1,268,"sbr_grid(): bs_freq_res")); + } + + sbr->abs_bord_lead[ch] = bs_abs_bord; + sbr->abs_bord_trail[ch] = bs_abs_bord_1; + sbr->n_rel_lead[ch] = sbr->bs_num_rel_0[ch]; + sbr->n_rel_trail[ch] = sbr->bs_num_rel_1[ch]; + break; + } + + if (sbr->bs_frame_class[ch] == VARVAR) + sbr->L_E[ch] = min(bs_num_env, 5); + else + sbr->L_E[ch] = min(bs_num_env, 4); + + if (sbr->L_E[ch] <= 0) + return 1; + + if (sbr->L_E[ch] > 1) + sbr->L_Q[ch] = 2; + else + sbr->L_Q[ch] = 1; + + /* TODO: this code can probably be integrated into the code above! */ + if ((result = envelope_time_border_vector(sbr, ch)) > 0) + { + sbr->bs_frame_class[ch] = saved_frame_class; + sbr->L_E[ch] = saved_L_E; + sbr->L_Q[ch] = saved_L_Q; + return result; + } + noise_floor_time_border_vector(sbr, ch); + +#if 0 + for (env = 0; env < bs_num_env; env++) + { + printf("freq_res[ch:%d][env:%d]: %d\n", ch, env, sbr->f[ch][env]); + } +#endif + + return 0; +} + +/* table 8 */ +static void sbr_dtdf(bitfile *ld, sbr_info *sbr, uint8_t ch) +{ + uint8_t i; + + for (i = 0; i < sbr->L_E[ch]; i++) + { + sbr->bs_df_env[ch][i] = faad_get1bit(ld + DEBUGVAR(1,269,"sbr_dtdf(): bs_df_env")); + } + + for (i = 0; i < sbr->L_Q[ch]; i++) + { + sbr->bs_df_noise[ch][i] = faad_get1bit(ld + DEBUGVAR(1,270,"sbr_dtdf(): bs_df_noise")); + } +} + +/* table 9 */ +static void invf_mode(bitfile *ld, sbr_info *sbr, uint8_t ch) +{ + uint8_t n; + + for (n = 0; n < sbr->N_Q; n++) + { + sbr->bs_invf_mode[ch][n] = (uint8_t)faad_getbits(ld, 2 + DEBUGVAR(1,271,"invf_mode(): bs_invf_mode")); + } +} + +static uint16_t sbr_extension(bitfile *ld, sbr_info *sbr, + uint8_t bs_extension_id, uint16_t num_bits_left) +{ +#ifdef PS_DEC + uint8_t header; + uint16_t ret; +#endif + + switch (bs_extension_id) + { +#ifdef PS_DEC + case EXTENSION_ID_PS: + if (!sbr->ps) + { + sbr->ps = ps_init(get_sr_index(sbr->sample_rate)); + } + ret = ps_data(sbr->ps, ld, &header); + + /* enable PS if and only if: a header has been decoded */ + if (sbr->ps_used == 0 && header == 1) + { + sbr->ps_used = 1; + } + + return ret; +#endif +#ifdef DRM_PS + case DRM_PARAMETRIC_STEREO: + sbr->ps_used = 1; + if (!sbr->drm_ps) + { + sbr->drm_ps = drm_ps_init(); + } + return drm_ps_data(sbr->drm_ps, ld); +#endif + default: + sbr->bs_extension_data = (uint8_t)faad_getbits(ld, 6 + DEBUGVAR(1,279,"sbr_single_channel_element(): bs_extension_data")); + return 6; + } +} + +/* table 12 */ +static void sinusoidal_coding(bitfile *ld, sbr_info *sbr, uint8_t ch) +{ + uint8_t n; + + for (n = 0; n < sbr->N_high; n++) + { + sbr->bs_add_harmonic[ch][n] = faad_get1bit(ld + DEBUGVAR(1,278,"sinusoidal_coding(): bs_add_harmonic")); + } +} + + +#endif /* SBR_DEC */ diff --git a/Libraries/FAAD2/Files/libfaad/sbr_syntax.h b/Libraries/FAAD2/Files/libfaad/sbr_syntax.h new file mode 100644 index 000000000..33aecaaf7 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/sbr_syntax.h @@ -0,0 +1,64 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#ifndef __SBR_SYNTAX_H__ +#define __SBR_SYNTAX_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "bits.h" + +#define T_HFGEN 8 +#define T_HFADJ 2 + +#define EXT_SBR_DATA 13 +#define EXT_SBR_DATA_CRC 14 + +#define FIXFIX 0 +#define FIXVAR 1 +#define VARFIX 2 +#define VARVAR 3 + +#define LO_RES 0 +#define HI_RES 1 + +#define NO_TIME_SLOTS_960 15 +#define NO_TIME_SLOTS 16 +#define RATE 2 + +#define NOISE_FLOOR_OFFSET 6 + + +uint8_t sbr_extension_data(bitfile *ld, sbr_info *sbr, uint16_t cnt); + +#ifdef __cplusplus +} +#endif +#endif /* __SBR_SYNTAX_H__ */ + diff --git a/Libraries/FAAD2/Files/libfaad/sbr_tf_grid.c b/Libraries/FAAD2/Files/libfaad/sbr_tf_grid.c new file mode 100644 index 000000000..d41fad635 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/sbr_tf_grid.c @@ -0,0 +1,258 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +/* Time/Frequency grid */ + +#include "common.h" +#include "structs.h" + +#ifdef SBR_DEC + +#include + +#include "sbr_syntax.h" +#include "sbr_tf_grid.h" + + +/* static function declarations */ +#if 0 +static int16_t rel_bord_lead(sbr_info *sbr, uint8_t ch, uint8_t l); +static int16_t rel_bord_trail(sbr_info *sbr, uint8_t ch, uint8_t l); +#endif +static uint8_t middleBorder(sbr_info *sbr, uint8_t ch); + + +/* function constructs new time border vector */ +/* first build into temp vector to be able to use previous vector on error */ +uint8_t envelope_time_border_vector(sbr_info *sbr, uint8_t ch) +{ + uint8_t l, border, temp; + uint8_t t_E_temp[6] = {0}; + + t_E_temp[0] = sbr->rate * sbr->abs_bord_lead[ch]; + t_E_temp[sbr->L_E[ch]] = sbr->rate * sbr->abs_bord_trail[ch]; + + switch (sbr->bs_frame_class[ch]) + { + case FIXFIX: + switch (sbr->L_E[ch]) + { + case 4: + temp = (int) (sbr->numTimeSlots / 4); + t_E_temp[3] = sbr->rate * 3 * temp; + t_E_temp[2] = sbr->rate * 2 * temp; + t_E_temp[1] = sbr->rate * temp; + break; + case 2: + t_E_temp[1] = sbr->rate * (int) (sbr->numTimeSlots / 2); + break; + default: + break; + } + break; + + case FIXVAR: + if (sbr->L_E[ch] > 1) + { + int8_t i = sbr->L_E[ch]; + border = sbr->abs_bord_trail[ch]; + + for (l = 0; l < (sbr->L_E[ch] - 1); l++) + { + if (border < sbr->bs_rel_bord[ch][l]) + return 1; + + border -= sbr->bs_rel_bord[ch][l]; + t_E_temp[--i] = sbr->rate * border; + } + } + break; + + case VARFIX: + if (sbr->L_E[ch] > 1) + { + int8_t i = 1; + border = sbr->abs_bord_lead[ch]; + + for (l = 0; l < (sbr->L_E[ch] - 1); l++) + { + border += sbr->bs_rel_bord[ch][l]; + + if (sbr->rate * border + sbr->tHFAdj > sbr->numTimeSlotsRate+sbr->tHFGen) + return 1; + + t_E_temp[i++] = sbr->rate * border; + } + } + break; + + case VARVAR: + if (sbr->bs_num_rel_0[ch]) + { + int8_t i = 1; + border = sbr->abs_bord_lead[ch]; + + for (l = 0; l < sbr->bs_num_rel_0[ch]; l++) + { + border += sbr->bs_rel_bord_0[ch][l]; + + if (sbr->rate * border + sbr->tHFAdj > sbr->numTimeSlotsRate+sbr->tHFGen) + return 1; + + t_E_temp[i++] = sbr->rate * border; + } + } + + if (sbr->bs_num_rel_1[ch]) + { + int8_t i = sbr->L_E[ch]; + border = sbr->abs_bord_trail[ch]; + + for (l = 0; l < sbr->bs_num_rel_1[ch]; l++) + { + if (border < sbr->bs_rel_bord_1[ch][l]) + return 1; + + border -= sbr->bs_rel_bord_1[ch][l]; + t_E_temp[--i] = sbr->rate * border; + } + } + break; + } + + /* no error occured, we can safely use this t_E vector */ + for (l = 0; l < 6; l++) + { + sbr->t_E[ch][l] = t_E_temp[l]; + } + + return 0; +} + +void noise_floor_time_border_vector(sbr_info *sbr, uint8_t ch) +{ + sbr->t_Q[ch][0] = sbr->t_E[ch][0]; + + if (sbr->L_E[ch] == 1) + { + sbr->t_Q[ch][1] = sbr->t_E[ch][1]; + sbr->t_Q[ch][2] = 0; + } else { + uint8_t index = middleBorder(sbr, ch); + sbr->t_Q[ch][1] = sbr->t_E[ch][index]; + sbr->t_Q[ch][2] = sbr->t_E[ch][sbr->L_E[ch]]; + } +} + +#if 0 +static int16_t rel_bord_lead(sbr_info *sbr, uint8_t ch, uint8_t l) +{ + uint8_t i; + int16_t acc = 0; + + switch (sbr->bs_frame_class[ch]) + { + case FIXFIX: + return sbr->numTimeSlots/sbr->L_E[ch]; + case FIXVAR: + return 0; + case VARFIX: + for (i = 0; i < l; i++) + { + acc += sbr->bs_rel_bord[ch][i]; + } + return acc; + case VARVAR: + for (i = 0; i < l; i++) + { + acc += sbr->bs_rel_bord_0[ch][i]; + } + return acc; + } + + return 0; +} + +static int16_t rel_bord_trail(sbr_info *sbr, uint8_t ch, uint8_t l) +{ + uint8_t i; + int16_t acc = 0; + + switch (sbr->bs_frame_class[ch]) + { + case FIXFIX: + case VARFIX: + return 0; + case FIXVAR: + for (i = 0; i < l; i++) + { + acc += sbr->bs_rel_bord[ch][i]; + } + return acc; + case VARVAR: + for (i = 0; i < l; i++) + { + acc += sbr->bs_rel_bord_1[ch][i]; + } + return acc; + } + + return 0; +} +#endif + +static uint8_t middleBorder(sbr_info *sbr, uint8_t ch) +{ + int8_t retval = 0; + + switch (sbr->bs_frame_class[ch]) + { + case FIXFIX: + retval = sbr->L_E[ch]/2; + break; + case VARFIX: + if (sbr->bs_pointer[ch] == 0) + retval = 1; + else if (sbr->bs_pointer[ch] == 1) + retval = sbr->L_E[ch] - 1; + else + retval = sbr->bs_pointer[ch] - 1; + break; + case FIXVAR: + case VARVAR: + if (sbr->bs_pointer[ch] > 1) + retval = sbr->L_E[ch] + 1 - sbr->bs_pointer[ch]; + else + retval = sbr->L_E[ch] - 1; + break; + } + + return (retval > 0) ? retval : 0; +} + + +#endif diff --git a/Libraries/FAAD2/Files/libfaad/sbr_tf_grid.h b/Libraries/FAAD2/Files/libfaad/sbr_tf_grid.h new file mode 100644 index 000000000..b7a6b3229 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/sbr_tf_grid.h @@ -0,0 +1,44 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#ifndef __SBR_TF_GRID_H__ +#define __SBR_TF_GRID_H__ + +#ifdef __cplusplus +extern "C" { +#endif + + +uint8_t envelope_time_border_vector(sbr_info *sbr, uint8_t ch); +void noise_floor_time_border_vector(sbr_info *sbr, uint8_t ch); + + +#ifdef __cplusplus +} +#endif +#endif + diff --git a/Libraries/FAAD2/Files/libfaad/sine_win.h b/Libraries/FAAD2/Files/libfaad/sine_win.h new file mode 100644 index 000000000..38cba667f --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/sine_win.h @@ -0,0 +1,4301 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#ifndef __SINE_WIN_H__ +#define __SINE_WIN_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef _MSC_VER +#pragma warning(disable:4305) +#pragma warning(disable:4244) +#endif + +ALIGN static const real_t sine_long_1024[] = +{ + FRAC_CONST(0.00076699031874270449), + FRAC_CONST(0.002300969151425805), + FRAC_CONST(0.0038349425697062275), + FRAC_CONST(0.0053689069639963425), + FRAC_CONST(0.0069028587247297558), + FRAC_CONST(0.0084367942423697988), + FRAC_CONST(0.0099707099074180308), + FRAC_CONST(0.011504602110422714), + FRAC_CONST(0.013038467241987334), + FRAC_CONST(0.014572301692779064), + FRAC_CONST(0.016106101853537287), + FRAC_CONST(0.017639864115082053), + FRAC_CONST(0.019173584868322623), + FRAC_CONST(0.020707260504265895), + FRAC_CONST(0.022240887414024961), + FRAC_CONST(0.023774461988827555), + FRAC_CONST(0.025307980620024571), + FRAC_CONST(0.026841439699098531), + FRAC_CONST(0.028374835617672099), + FRAC_CONST(0.029908164767516555), + FRAC_CONST(0.031441423540560301), + FRAC_CONST(0.032974608328897335), + FRAC_CONST(0.03450771552479575), + FRAC_CONST(0.036040741520706229), + FRAC_CONST(0.037573682709270494), + FRAC_CONST(0.039106535483329888), + FRAC_CONST(0.040639296235933736), + FRAC_CONST(0.042171961360347947), + FRAC_CONST(0.043704527250063421), + FRAC_CONST(0.04523699029880459), + FRAC_CONST(0.046769346900537863), + FRAC_CONST(0.048301593449480144), + FRAC_CONST(0.049833726340107277), + FRAC_CONST(0.051365741967162593), + FRAC_CONST(0.052897636725665324), + FRAC_CONST(0.054429407010919133), + FRAC_CONST(0.055961049218520569), + FRAC_CONST(0.057492559744367566), + FRAC_CONST(0.059023934984667931), + FRAC_CONST(0.060555171335947788), + FRAC_CONST(0.062086265195060088), + FRAC_CONST(0.063617212959193106), + FRAC_CONST(0.065148011025878833), + FRAC_CONST(0.066678655793001557), + FRAC_CONST(0.068209143658806329), + FRAC_CONST(0.069739471021907307), + FRAC_CONST(0.071269634281296401), + FRAC_CONST(0.072799629836351673), + FRAC_CONST(0.074329454086845756), + FRAC_CONST(0.075859103432954447), + FRAC_CONST(0.077388574275265049), + FRAC_CONST(0.078917863014784942), + FRAC_CONST(0.080446966052950014), + FRAC_CONST(0.081975879791633066), + FRAC_CONST(0.083504600633152432), + FRAC_CONST(0.085033124980280275), + FRAC_CONST(0.08656144923625117), + FRAC_CONST(0.088089569804770507), + FRAC_CONST(0.089617483090022959), + FRAC_CONST(0.091145185496681005), + FRAC_CONST(0.09267267342991331), + FRAC_CONST(0.094199943295393204), + FRAC_CONST(0.095726991499307162), + FRAC_CONST(0.097253814448363271), + FRAC_CONST(0.098780408549799623), + FRAC_CONST(0.10030677021139286), + FRAC_CONST(0.10183289584146653), + FRAC_CONST(0.10335878184889961), + FRAC_CONST(0.10488442464313497), + FRAC_CONST(0.10640982063418768), + FRAC_CONST(0.10793496623265365), + FRAC_CONST(0.10945985784971798), + FRAC_CONST(0.11098449189716339), + FRAC_CONST(0.11250886478737869), + FRAC_CONST(0.1140329729333672), + FRAC_CONST(0.11555681274875526), + FRAC_CONST(0.11708038064780059), + FRAC_CONST(0.11860367304540072), + FRAC_CONST(0.1201266863571015), + FRAC_CONST(0.12164941699910553), + FRAC_CONST(0.12317186138828048), + FRAC_CONST(0.12469401594216764), + FRAC_CONST(0.12621587707899035), + FRAC_CONST(0.12773744121766231), + FRAC_CONST(0.12925870477779614), + FRAC_CONST(0.13077966417971171), + FRAC_CONST(0.13230031584444465), + FRAC_CONST(0.13382065619375472), + FRAC_CONST(0.13534068165013421), + FRAC_CONST(0.13686038863681638), + FRAC_CONST(0.13837977357778389), + FRAC_CONST(0.13989883289777721), + FRAC_CONST(0.14141756302230302), + FRAC_CONST(0.14293596037764267), + FRAC_CONST(0.14445402139086047), + FRAC_CONST(0.14597174248981221), + FRAC_CONST(0.14748912010315357), + FRAC_CONST(0.14900615066034845), + FRAC_CONST(0.1505228305916774), + FRAC_CONST(0.15203915632824605), + FRAC_CONST(0.15355512430199345), + FRAC_CONST(0.15507073094570051), + FRAC_CONST(0.15658597269299843), + FRAC_CONST(0.15810084597837698), + FRAC_CONST(0.15961534723719306), + FRAC_CONST(0.16112947290567881), + FRAC_CONST(0.16264321942095031), + FRAC_CONST(0.16415658322101581), + FRAC_CONST(0.16566956074478412), + FRAC_CONST(0.16718214843207294), + FRAC_CONST(0.16869434272361733), + FRAC_CONST(0.17020614006107807), + FRAC_CONST(0.17171753688704997), + FRAC_CONST(0.17322852964507032), + FRAC_CONST(0.1747391147796272), + FRAC_CONST(0.17624928873616788), + FRAC_CONST(0.17775904796110717), + FRAC_CONST(0.17926838890183575), + FRAC_CONST(0.18077730800672859), + FRAC_CONST(0.1822858017251533), + FRAC_CONST(0.18379386650747845), + FRAC_CONST(0.1853014988050819), + FRAC_CONST(0.18680869507035927), + FRAC_CONST(0.18831545175673212), + FRAC_CONST(0.18982176531865641), + FRAC_CONST(0.1913276322116309), + FRAC_CONST(0.19283304889220523), + FRAC_CONST(0.1943380118179886), + FRAC_CONST(0.19584251744765785), + FRAC_CONST(0.19734656224096592), + FRAC_CONST(0.19885014265875009), + FRAC_CONST(0.20035325516294045), + FRAC_CONST(0.20185589621656805), + FRAC_CONST(0.20335806228377332), + FRAC_CONST(0.20485974982981442), + FRAC_CONST(0.20636095532107551), + FRAC_CONST(0.20786167522507507), + FRAC_CONST(0.20936190601047416), + FRAC_CONST(0.21086164414708486), + FRAC_CONST(0.21236088610587842), + FRAC_CONST(0.21385962835899375), + FRAC_CONST(0.21535786737974555), + FRAC_CONST(0.21685559964263262), + FRAC_CONST(0.21835282162334632), + FRAC_CONST(0.2198495297987787), + FRAC_CONST(0.22134572064703081), + FRAC_CONST(0.22284139064742112), + FRAC_CONST(0.2243365362804936), + FRAC_CONST(0.22583115402802617), + FRAC_CONST(0.22732524037303886), + FRAC_CONST(0.22881879179980222), + FRAC_CONST(0.23031180479384544), + FRAC_CONST(0.23180427584196478), + FRAC_CONST(0.23329620143223159), + FRAC_CONST(0.23478757805400097), + FRAC_CONST(0.23627840219791957), + FRAC_CONST(0.23776867035593419), + FRAC_CONST(0.23925837902129998), + FRAC_CONST(0.24074752468858843), + FRAC_CONST(0.24223610385369601), + FRAC_CONST(0.24372411301385216), + FRAC_CONST(0.24521154866762754), + FRAC_CONST(0.24669840731494241), + FRAC_CONST(0.24818468545707478), + FRAC_CONST(0.24967037959666857), + FRAC_CONST(0.25115548623774192), + FRAC_CONST(0.25264000188569552), + FRAC_CONST(0.25412392304732062), + FRAC_CONST(0.25560724623080738), + FRAC_CONST(0.25708996794575312), + FRAC_CONST(0.25857208470317034), + FRAC_CONST(0.26005359301549519), + FRAC_CONST(0.26153448939659552), + FRAC_CONST(0.263014770361779), + FRAC_CONST(0.26449443242780163), + FRAC_CONST(0.26597347211287559), + FRAC_CONST(0.26745188593667762), + FRAC_CONST(0.26892967042035726), + FRAC_CONST(0.27040682208654482), + FRAC_CONST(0.27188333745935972), + FRAC_CONST(0.27335921306441868), + FRAC_CONST(0.27483444542884394), + FRAC_CONST(0.27630903108127108), + FRAC_CONST(0.27778296655185769), + FRAC_CONST(0.27925624837229118), + FRAC_CONST(0.28072887307579719), + FRAC_CONST(0.28220083719714756), + FRAC_CONST(0.28367213727266843), + FRAC_CONST(0.28514276984024867), + FRAC_CONST(0.28661273143934779), + FRAC_CONST(0.28808201861100413), + FRAC_CONST(0.28955062789784303), + FRAC_CONST(0.29101855584408509), + FRAC_CONST(0.29248579899555388), + FRAC_CONST(0.29395235389968466), + FRAC_CONST(0.29541821710553201), + FRAC_CONST(0.29688338516377827), + FRAC_CONST(0.2983478546267414), + FRAC_CONST(0.29981162204838335), + FRAC_CONST(0.30127468398431795), + FRAC_CONST(0.30273703699181914), + FRAC_CONST(0.30419867762982911), + FRAC_CONST(0.30565960245896612), + FRAC_CONST(0.3071198080415331), + FRAC_CONST(0.30857929094152509), + FRAC_CONST(0.31003804772463789), + FRAC_CONST(0.31149607495827591), + FRAC_CONST(0.3129533692115602), + FRAC_CONST(0.31440992705533666), + FRAC_CONST(0.31586574506218396), + FRAC_CONST(0.31732081980642174), + FRAC_CONST(0.31877514786411848), + FRAC_CONST(0.32022872581309986), + FRAC_CONST(0.32168155023295658), + FRAC_CONST(0.32313361770505233), + FRAC_CONST(0.32458492481253215), + FRAC_CONST(0.32603546814033024), + FRAC_CONST(0.327485244275178), + FRAC_CONST(0.3289342498056122), + FRAC_CONST(0.33038248132198278), + FRAC_CONST(0.33182993541646111), + FRAC_CONST(0.33327660868304793), + FRAC_CONST(0.33472249771758122), + FRAC_CONST(0.33616759911774452), + FRAC_CONST(0.33761190948307462), + FRAC_CONST(0.33905542541496964), + FRAC_CONST(0.34049814351669716), + FRAC_CONST(0.34194006039340219), + FRAC_CONST(0.34338117265211504), + FRAC_CONST(0.34482147690175929), + FRAC_CONST(0.34626096975316001), + FRAC_CONST(0.34769964781905138), + FRAC_CONST(0.34913750771408497), + FRAC_CONST(0.35057454605483751), + FRAC_CONST(0.35201075945981908), + FRAC_CONST(0.35344614454948081), + FRAC_CONST(0.35488069794622279), + FRAC_CONST(0.35631441627440241), + FRAC_CONST(0.3577472961603419), + FRAC_CONST(0.3591793342323365), + FRAC_CONST(0.36061052712066227), + FRAC_CONST(0.36204087145758418), + FRAC_CONST(0.36347036387736376), + FRAC_CONST(0.36489900101626732), + FRAC_CONST(0.36632677951257359), + FRAC_CONST(0.36775369600658198), + FRAC_CONST(0.36917974714062002), + FRAC_CONST(0.37060492955905167), + FRAC_CONST(0.37202923990828501), + FRAC_CONST(0.3734526748367803), + FRAC_CONST(0.37487523099505754), + FRAC_CONST(0.37629690503570479), + FRAC_CONST(0.37771769361338564), + FRAC_CONST(0.37913759338484732), + FRAC_CONST(0.38055660100892852), + FRAC_CONST(0.38197471314656722), + FRAC_CONST(0.38339192646080866), + FRAC_CONST(0.38480823761681288), + FRAC_CONST(0.38622364328186298), + FRAC_CONST(0.38763814012537273), + FRAC_CONST(0.38905172481889438), + FRAC_CONST(0.39046439403612659), + FRAC_CONST(0.39187614445292235), + FRAC_CONST(0.3932869727472964), + FRAC_CONST(0.39469687559943356), + FRAC_CONST(0.39610584969169627), + FRAC_CONST(0.39751389170863233), + FRAC_CONST(0.39892099833698291), + FRAC_CONST(0.40032716626569009), + FRAC_CONST(0.40173239218590501), + FRAC_CONST(0.4031366727909953), + FRAC_CONST(0.404540004776553), + FRAC_CONST(0.40594238484040251), + FRAC_CONST(0.40734380968260797), + FRAC_CONST(0.40874427600548136), + FRAC_CONST(0.41014378051359024), + FRAC_CONST(0.41154231991376522), + FRAC_CONST(0.41293989091510808), + FRAC_CONST(0.4143364902289991), + FRAC_CONST(0.41573211456910536), + FRAC_CONST(0.41712676065138787), + FRAC_CONST(0.4185204251941097), + FRAC_CONST(0.41991310491784362), + FRAC_CONST(0.42130479654547964), + FRAC_CONST(0.42269549680223295), + FRAC_CONST(0.42408520241565156), + FRAC_CONST(0.4254739101156238), + FRAC_CONST(0.42686161663438643), + FRAC_CONST(0.42824831870653196), + FRAC_CONST(0.42963401306901638), + FRAC_CONST(0.43101869646116703), + FRAC_CONST(0.43240236562469014), + FRAC_CONST(0.43378501730367852), + FRAC_CONST(0.43516664824461926), + FRAC_CONST(0.4365472551964012), + FRAC_CONST(0.43792683491032286), + FRAC_CONST(0.43930538414009995), + FRAC_CONST(0.4406828996418729), + FRAC_CONST(0.4420593781742147), + FRAC_CONST(0.44343481649813848), + FRAC_CONST(0.44480921137710488), + FRAC_CONST(0.44618255957703007), + FRAC_CONST(0.44755485786629301), + FRAC_CONST(0.44892610301574326), + FRAC_CONST(0.45029629179870861), + FRAC_CONST(0.45166542099100249), + FRAC_CONST(0.45303348737093158), + FRAC_CONST(0.45440048771930358), + FRAC_CONST(0.45576641881943464), + FRAC_CONST(0.45713127745715698), + FRAC_CONST(0.45849506042082627), + FRAC_CONST(0.45985776450132954), + FRAC_CONST(0.46121938649209238), + FRAC_CONST(0.46257992318908681), + FRAC_CONST(0.46393937139083852), + FRAC_CONST(0.4652977278984346), + FRAC_CONST(0.46665498951553092), + FRAC_CONST(0.46801115304835983), + FRAC_CONST(0.46936621530573752), + FRAC_CONST(0.4707201730990716), + FRAC_CONST(0.47207302324236866), + FRAC_CONST(0.47342476255224153), + FRAC_CONST(0.47477538784791712), + FRAC_CONST(0.47612489595124358), + FRAC_CONST(0.47747328368669806), + FRAC_CONST(0.47882054788139389), + FRAC_CONST(0.48016668536508839), + FRAC_CONST(0.48151169297018986), + FRAC_CONST(0.48285556753176567), + FRAC_CONST(0.48419830588754903), + FRAC_CONST(0.48553990487794696), + FRAC_CONST(0.48688036134604734), + FRAC_CONST(0.48821967213762679), + FRAC_CONST(0.48955783410115744), + FRAC_CONST(0.49089484408781509), + FRAC_CONST(0.49223069895148602), + FRAC_CONST(0.49356539554877477), + FRAC_CONST(0.49489893073901126), + FRAC_CONST(0.49623130138425825), + FRAC_CONST(0.49756250434931915), + FRAC_CONST(0.49889253650174459), + FRAC_CONST(0.50022139471184068), + FRAC_CONST(0.50154907585267539), + FRAC_CONST(0.50287557680008699), + FRAC_CONST(0.50420089443269034), + FRAC_CONST(0.50552502563188539), + FRAC_CONST(0.50684796728186321), + FRAC_CONST(0.5081697162696146), + FRAC_CONST(0.50949026948493636), + FRAC_CONST(0.51080962382043904), + FRAC_CONST(0.51212777617155469), + FRAC_CONST(0.51344472343654346), + FRAC_CONST(0.5147604625165012), + FRAC_CONST(0.51607499031536663), + FRAC_CONST(0.51738830373992906), + FRAC_CONST(0.51870039969983495), + FRAC_CONST(0.52001127510759604), + FRAC_CONST(0.52132092687859566), + FRAC_CONST(0.52262935193109661), + FRAC_CONST(0.5239365471862486), + FRAC_CONST(0.52524250956809471), + FRAC_CONST(0.52654723600357944), + FRAC_CONST(0.52785072342255523), + FRAC_CONST(0.52915296875779061), + FRAC_CONST(0.53045396894497632), + FRAC_CONST(0.53175372092273332), + FRAC_CONST(0.53305222163261945), + FRAC_CONST(0.53434946801913752), + FRAC_CONST(0.53564545702974109), + FRAC_CONST(0.53694018561484291), + FRAC_CONST(0.5382336507278217), + FRAC_CONST(0.53952584932502889), + FRAC_CONST(0.54081677836579667), + FRAC_CONST(0.54210643481244392), + FRAC_CONST(0.5433948156302848), + FRAC_CONST(0.54468191778763453), + FRAC_CONST(0.54596773825581757), + FRAC_CONST(0.54725227400917409), + FRAC_CONST(0.54853552202506739), + FRAC_CONST(0.54981747928389091), + FRAC_CONST(0.55109814276907543), + FRAC_CONST(0.55237750946709607), + FRAC_CONST(0.55365557636747931), + FRAC_CONST(0.55493234046281037), + FRAC_CONST(0.55620779874873993), + FRAC_CONST(0.55748194822399155), + FRAC_CONST(0.55875478589036831), + FRAC_CONST(0.56002630875276038), + FRAC_CONST(0.56129651381915147), + FRAC_CONST(0.56256539810062656), + FRAC_CONST(0.56383295861137817), + FRAC_CONST(0.56509919236871398), + FRAC_CONST(0.56636409639306384), + FRAC_CONST(0.56762766770798623), + FRAC_CONST(0.56888990334017586), + FRAC_CONST(0.5701508003194703), + FRAC_CONST(0.57141035567885723), + FRAC_CONST(0.57266856645448116), + FRAC_CONST(0.57392542968565075), + FRAC_CONST(0.57518094241484508), + FRAC_CONST(0.57643510168772183), + FRAC_CONST(0.5776879045531228), + FRAC_CONST(0.57893934806308178), + FRAC_CONST(0.58018942927283168), + FRAC_CONST(0.58143814524081017), + FRAC_CONST(0.58268549302866846), + FRAC_CONST(0.58393146970127618), + FRAC_CONST(0.58517607232673041), + FRAC_CONST(0.5864192979763605), + FRAC_CONST(0.58766114372473666), + FRAC_CONST(0.58890160664967572), + FRAC_CONST(0.59014068383224882), + FRAC_CONST(0.59137837235678758), + FRAC_CONST(0.59261466931089113), + FRAC_CONST(0.59384957178543363), + FRAC_CONST(0.59508307687456996), + FRAC_CONST(0.59631518167574371), + FRAC_CONST(0.59754588328969316), + FRAC_CONST(0.59877517882045872), + FRAC_CONST(0.60000306537538894), + FRAC_CONST(0.6012295400651485), + FRAC_CONST(0.60245460000372375), + FRAC_CONST(0.60367824230843037), + FRAC_CONST(0.60490046409991982), + FRAC_CONST(0.60612126250218612), + FRAC_CONST(0.60734063464257293), + FRAC_CONST(0.60855857765177945), + FRAC_CONST(0.60977508866386843), + FRAC_CONST(0.61099016481627166), + FRAC_CONST(0.61220380324979795), + FRAC_CONST(0.61341600110863859), + FRAC_CONST(0.61462675554037505), + FRAC_CONST(0.61583606369598509), + FRAC_CONST(0.61704392272984976), + FRAC_CONST(0.61825032979976025), + FRAC_CONST(0.61945528206692402), + FRAC_CONST(0.62065877669597214), + FRAC_CONST(0.62186081085496536), + FRAC_CONST(0.62306138171540126), + FRAC_CONST(0.62426048645222065), + FRAC_CONST(0.62545812224381436), + FRAC_CONST(0.62665428627202935), + FRAC_CONST(0.62784897572217646), + FRAC_CONST(0.629042187783036), + FRAC_CONST(0.63023391964686437), + FRAC_CONST(0.63142416850940186), + FRAC_CONST(0.63261293156987741), + FRAC_CONST(0.63380020603101728), + FRAC_CONST(0.63498598909904946), + FRAC_CONST(0.63617027798371217), + FRAC_CONST(0.63735306989825913), + FRAC_CONST(0.63853436205946679), + FRAC_CONST(0.63971415168764045), + FRAC_CONST(0.64089243600662138), + FRAC_CONST(0.64206921224379254), + FRAC_CONST(0.64324447763008585), + FRAC_CONST(0.64441822939998838), + FRAC_CONST(0.64559046479154869), + FRAC_CONST(0.64676118104638392), + FRAC_CONST(0.64793037540968534), + FRAC_CONST(0.64909804513022595), + FRAC_CONST(0.65026418746036585), + FRAC_CONST(0.65142879965605982), + FRAC_CONST(0.65259187897686244), + FRAC_CONST(0.65375342268593606), + FRAC_CONST(0.65491342805005603), + FRAC_CONST(0.6560718923396176), + FRAC_CONST(0.65722881282864254), + FRAC_CONST(0.65838418679478505), + FRAC_CONST(0.65953801151933866), + FRAC_CONST(0.6606902842872423), + FRAC_CONST(0.66184100238708687), + FRAC_CONST(0.66299016311112147), + FRAC_CONST(0.66413776375526001), + FRAC_CONST(0.66528380161908718), + FRAC_CONST(0.66642827400586524), + FRAC_CONST(0.66757117822254031), + FRAC_CONST(0.66871251157974798), + FRAC_CONST(0.66985227139182102), + FRAC_CONST(0.67099045497679422), + FRAC_CONST(0.67212705965641173), + FRAC_CONST(0.67326208275613297), + FRAC_CONST(0.67439552160513905), + FRAC_CONST(0.67552737353633852), + FRAC_CONST(0.67665763588637495), + FRAC_CONST(0.6777863059956315), + FRAC_CONST(0.67891338120823841), + FRAC_CONST(0.68003885887207893), + FRAC_CONST(0.68116273633879543), + FRAC_CONST(0.68228501096379557), + FRAC_CONST(0.68340568010625868), + FRAC_CONST(0.6845247411291423), + FRAC_CONST(0.68564219139918747), + FRAC_CONST(0.68675802828692589), + FRAC_CONST(0.68787224916668555), + FRAC_CONST(0.68898485141659704), + FRAC_CONST(0.69009583241859995), + FRAC_CONST(0.69120518955844845), + FRAC_CONST(0.69231292022571822), + FRAC_CONST(0.69341902181381176), + FRAC_CONST(0.69452349171996552), + FRAC_CONST(0.69562632734525487), + FRAC_CONST(0.6967275260946012), + FRAC_CONST(0.69782708537677729), + FRAC_CONST(0.69892500260441415), + FRAC_CONST(0.70002127519400625), + FRAC_CONST(0.70111590056591866), + FRAC_CONST(0.70220887614439187), + FRAC_CONST(0.70330019935754873), + FRAC_CONST(0.70438986763740041), + FRAC_CONST(0.7054778784198521), + FRAC_CONST(0.70656422914470951), + FRAC_CONST(0.70764891725568435), + FRAC_CONST(0.70873194020040065), + FRAC_CONST(0.70981329543040084), + FRAC_CONST(0.71089298040115168), + FRAC_CONST(0.71197099257204999), + FRAC_CONST(0.71304732940642923), + FRAC_CONST(0.71412198837156471), + FRAC_CONST(0.71519496693868001), + FRAC_CONST(0.71626626258295312), + FRAC_CONST(0.71733587278352173), + FRAC_CONST(0.71840379502348972), + FRAC_CONST(0.71947002678993299), + FRAC_CONST(0.72053456557390527), + FRAC_CONST(0.72159740887044366), + FRAC_CONST(0.72265855417857561), + FRAC_CONST(0.72371799900132339), + FRAC_CONST(0.72477574084571128), + FRAC_CONST(0.72583177722277037), + FRAC_CONST(0.72688610564754497), + FRAC_CONST(0.72793872363909862), + FRAC_CONST(0.72898962872051931), + FRAC_CONST(0.73003881841892615), + FRAC_CONST(0.73108629026547423), + FRAC_CONST(0.73213204179536129), + FRAC_CONST(0.73317607054783274), + FRAC_CONST(0.73421837406618817), + FRAC_CONST(0.73525894989778673), + FRAC_CONST(0.73629779559405306), + FRAC_CONST(0.73733490871048279), + FRAC_CONST(0.73837028680664851), + FRAC_CONST(0.73940392744620576), + FRAC_CONST(0.74043582819689802), + FRAC_CONST(0.74146598663056329), + FRAC_CONST(0.74249440032313918), + FRAC_CONST(0.74352106685466912), + FRAC_CONST(0.74454598380930725), + FRAC_CONST(0.74556914877532543), + FRAC_CONST(0.74659055934511731), + FRAC_CONST(0.74761021311520515), + FRAC_CONST(0.74862810768624533), + FRAC_CONST(0.74964424066303348), + FRAC_CONST(0.75065860965451059), + FRAC_CONST(0.75167121227376843), + FRAC_CONST(0.75268204613805523), + FRAC_CONST(0.75369110886878121), + FRAC_CONST(0.75469839809152439), + FRAC_CONST(0.75570391143603588), + FRAC_CONST(0.75670764653624567), + FRAC_CONST(0.75770960103026808), + FRAC_CONST(0.75870977256040739), + FRAC_CONST(0.75970815877316344), + FRAC_CONST(0.76070475731923692), + FRAC_CONST(0.76169956585353527), + FRAC_CONST(0.76269258203517787), + FRAC_CONST(0.76368380352750187), + FRAC_CONST(0.76467322799806714), + FRAC_CONST(0.76566085311866239), + FRAC_CONST(0.76664667656531038), + FRAC_CONST(0.76763069601827327), + FRAC_CONST(0.76861290916205827), + FRAC_CONST(0.76959331368542294), + FRAC_CONST(0.7705719072813807), + FRAC_CONST(0.7715486876472063), + FRAC_CONST(0.77252365248444133), + FRAC_CONST(0.77349679949889905), + FRAC_CONST(0.77446812640067086), + FRAC_CONST(0.77543763090413043), + FRAC_CONST(0.77640531072794039), + FRAC_CONST(0.7773711635950562), + FRAC_CONST(0.77833518723273309), + FRAC_CONST(0.7792973793725303), + FRAC_CONST(0.78025773775031659), + FRAC_CONST(0.78121626010627609), + FRAC_CONST(0.7821729441849129), + FRAC_CONST(0.78312778773505731), + FRAC_CONST(0.78408078850986995), + FRAC_CONST(0.78503194426684808), + FRAC_CONST(0.78598125276783015), + FRAC_CONST(0.7869287117790017), + FRAC_CONST(0.78787431907090011), + FRAC_CONST(0.78881807241842017), + FRAC_CONST(0.78975996960081907), + FRAC_CONST(0.79070000840172161), + FRAC_CONST(0.79163818660912577), + FRAC_CONST(0.79257450201540758), + FRAC_CONST(0.79350895241732666), + FRAC_CONST(0.79444153561603059), + FRAC_CONST(0.79537224941706119), + FRAC_CONST(0.79630109163035911), + FRAC_CONST(0.7972280600702687), + FRAC_CONST(0.79815315255554375), + FRAC_CONST(0.79907636690935235), + FRAC_CONST(0.79999770095928191), + FRAC_CONST(0.8009171525373443), + FRAC_CONST(0.80183471947998131), + FRAC_CONST(0.80275039962806916), + FRAC_CONST(0.80366419082692409), + FRAC_CONST(0.804576090926307), + FRAC_CONST(0.80548609778042912), + FRAC_CONST(0.80639420924795624), + FRAC_CONST(0.80730042319201445), + FRAC_CONST(0.80820473748019472), + FRAC_CONST(0.80910714998455813), + FRAC_CONST(0.81000765858164114), + FRAC_CONST(0.81090626115245967), + FRAC_CONST(0.81180295558251536), + FRAC_CONST(0.81269773976179949), + FRAC_CONST(0.81359061158479851), + FRAC_CONST(0.81448156895049861), + FRAC_CONST(0.81537060976239129), + FRAC_CONST(0.81625773192847739), + FRAC_CONST(0.81714293336127297), + FRAC_CONST(0.81802621197781344), + FRAC_CONST(0.81890756569965895), + FRAC_CONST(0.81978699245289899), + FRAC_CONST(0.82066449016815746), + FRAC_CONST(0.82154005678059761), + FRAC_CONST(0.82241369022992639), + FRAC_CONST(0.82328538846040011), + FRAC_CONST(0.82415514942082857), + FRAC_CONST(0.82502297106458022), + FRAC_CONST(0.82588885134958678), + FRAC_CONST(0.82675278823834852), + FRAC_CONST(0.8276147796979384), + FRAC_CONST(0.82847482370000713), + FRAC_CONST(0.82933291822078825), + FRAC_CONST(0.83018906124110237), + FRAC_CONST(0.83104325074636232), + FRAC_CONST(0.83189548472657759), + FRAC_CONST(0.83274576117635946), + FRAC_CONST(0.83359407809492514), + FRAC_CONST(0.83444043348610319), + FRAC_CONST(0.83528482535833737), + FRAC_CONST(0.83612725172469216), + FRAC_CONST(0.83696771060285702), + FRAC_CONST(0.83780620001515094), + FRAC_CONST(0.8386427179885273), + FRAC_CONST(0.83947726255457855), + FRAC_CONST(0.84030983174954077), + FRAC_CONST(0.84114042361429808), + FRAC_CONST(0.84196903619438768), + FRAC_CONST(0.84279566754000412), + FRAC_CONST(0.84362031570600404), + FRAC_CONST(0.84444297875191066), + FRAC_CONST(0.84526365474191822), + FRAC_CONST(0.84608234174489694), + FRAC_CONST(0.84689903783439735), + FRAC_CONST(0.84771374108865427), + FRAC_CONST(0.84852644959059265), + FRAC_CONST(0.84933716142783067), + FRAC_CONST(0.85014587469268521), + FRAC_CONST(0.85095258748217573), + FRAC_CONST(0.85175729789802912), + FRAC_CONST(0.85256000404668397), + FRAC_CONST(0.85336070403929543), + FRAC_CONST(0.85415939599173873), + FRAC_CONST(0.85495607802461482), + FRAC_CONST(0.85575074826325392), + FRAC_CONST(0.85654340483771996), + FRAC_CONST(0.85733404588281559), + FRAC_CONST(0.85812266953808602), + FRAC_CONST(0.8589092739478239), + FRAC_CONST(0.85969385726107261), + FRAC_CONST(0.86047641763163207), + FRAC_CONST(0.86125695321806206), + FRAC_CONST(0.86203546218368721), + FRAC_CONST(0.86281194269660033), + FRAC_CONST(0.86358639292966799), + FRAC_CONST(0.86435881106053403), + FRAC_CONST(0.86512919527162369), + FRAC_CONST(0.86589754375014882), + FRAC_CONST(0.86666385468811102), + FRAC_CONST(0.86742812628230692), + FRAC_CONST(0.86819035673433131), + FRAC_CONST(0.86895054425058238), + FRAC_CONST(0.86970868704226556), + FRAC_CONST(0.87046478332539767), + FRAC_CONST(0.8712188313208109), + FRAC_CONST(0.8719708292541577), + FRAC_CONST(0.8727207753559143), + FRAC_CONST(0.87346866786138488), + FRAC_CONST(0.8742145050107063), + FRAC_CONST(0.87495828504885154), + FRAC_CONST(0.8757000062256346), + FRAC_CONST(0.87643966679571361), + FRAC_CONST(0.87717726501859594), + FRAC_CONST(0.87791279915864173), + FRAC_CONST(0.87864626748506813), + FRAC_CONST(0.87937766827195318), + FRAC_CONST(0.88010699979824036), + FRAC_CONST(0.88083426034774204), + FRAC_CONST(0.88155944820914378), + FRAC_CONST(0.8822825616760086), + FRAC_CONST(0.88300359904678072), + FRAC_CONST(0.88372255862478966), + FRAC_CONST(0.8844394387182537), + FRAC_CONST(0.88515423764028511), + FRAC_CONST(0.88586695370889279), + FRAC_CONST(0.88657758524698704), + FRAC_CONST(0.88728613058238315), + FRAC_CONST(0.88799258804780556), + FRAC_CONST(0.88869695598089171), + FRAC_CONST(0.88939923272419552), + FRAC_CONST(0.89009941662519221), + FRAC_CONST(0.89079750603628149), + FRAC_CONST(0.89149349931479138), + FRAC_CONST(0.89218739482298248), + FRAC_CONST(0.89287919092805168), + FRAC_CONST(0.89356888600213602), + FRAC_CONST(0.89425647842231604), + FRAC_CONST(0.89494196657062075), + FRAC_CONST(0.89562534883403), + FRAC_CONST(0.89630662360447966), + FRAC_CONST(0.89698578927886397), + FRAC_CONST(0.89766284425904075), + FRAC_CONST(0.89833778695183419), + FRAC_CONST(0.89901061576903907), + FRAC_CONST(0.89968132912742393), + FRAC_CONST(0.9003499254487356), + FRAC_CONST(0.90101640315970233), + FRAC_CONST(0.90168076069203773), + FRAC_CONST(0.9023429964824442), + FRAC_CONST(0.90300310897261704), + FRAC_CONST(0.90366109660924798), + FRAC_CONST(0.90431695784402832), + FRAC_CONST(0.90497069113365325), + FRAC_CONST(0.90562229493982516), + FRAC_CONST(0.90627176772925766), + FRAC_CONST(0.90691910797367803), + FRAC_CONST(0.90756431414983252), + FRAC_CONST(0.9082073847394887), + FRAC_CONST(0.90884831822943912), + FRAC_CONST(0.90948711311150543), + FRAC_CONST(0.91012376788254157), + FRAC_CONST(0.91075828104443757), + FRAC_CONST(0.91139065110412232), + FRAC_CONST(0.91202087657356823), + FRAC_CONST(0.9126489559697939), + FRAC_CONST(0.91327488781486776), + FRAC_CONST(0.91389867063591168), + FRAC_CONST(0.91452030296510445), + FRAC_CONST(0.91513978333968526), + FRAC_CONST(0.91575711030195672), + FRAC_CONST(0.91637228239928914), + FRAC_CONST(0.91698529818412289), + FRAC_CONST(0.91759615621397295), + FRAC_CONST(0.9182048550514309), + FRAC_CONST(0.91881139326416994), + FRAC_CONST(0.91941576942494696), + FRAC_CONST(0.92001798211160657), + FRAC_CONST(0.92061802990708386), + FRAC_CONST(0.92121591139940873), + FRAC_CONST(0.92181162518170812), + FRAC_CONST(0.92240516985220988), + FRAC_CONST(0.92299654401424625), + FRAC_CONST(0.92358574627625656), + FRAC_CONST(0.9241727752517912), + FRAC_CONST(0.92475762955951391), + FRAC_CONST(0.9253403078232062), + FRAC_CONST(0.92592080867176996), + FRAC_CONST(0.92649913073923051), + FRAC_CONST(0.9270752726647401), + FRAC_CONST(0.92764923309258118), + FRAC_CONST(0.92822101067216944), + FRAC_CONST(0.92879060405805702), + FRAC_CONST(0.9293580119099355), + FRAC_CONST(0.92992323289263956), + FRAC_CONST(0.93048626567614978), + FRAC_CONST(0.93104710893559517), + FRAC_CONST(0.93160576135125783), + FRAC_CONST(0.93216222160857432), + FRAC_CONST(0.93271648839814025), + FRAC_CONST(0.93326856041571205), + FRAC_CONST(0.93381843636221096), + FRAC_CONST(0.9343661149437259), + FRAC_CONST(0.93491159487151609), + FRAC_CONST(0.93545487486201462), + FRAC_CONST(0.9359959536368313), + FRAC_CONST(0.9365348299227555), + FRAC_CONST(0.93707150245175919), + FRAC_CONST(0.93760596996099999), + FRAC_CONST(0.93813823119282436), + FRAC_CONST(0.93866828489477017), + FRAC_CONST(0.9391961298195699), + FRAC_CONST(0.93972176472515334), + FRAC_CONST(0.94024518837465088), + FRAC_CONST(0.94076639953639607), + FRAC_CONST(0.94128539698392866), + FRAC_CONST(0.94180217949599765), + FRAC_CONST(0.94231674585656378), + FRAC_CONST(0.94282909485480271), + FRAC_CONST(0.94333922528510772), + FRAC_CONST(0.94384713594709269), + FRAC_CONST(0.94435282564559475), + FRAC_CONST(0.94485629319067721), + FRAC_CONST(0.94535753739763229), + FRAC_CONST(0.94585655708698391), + FRAC_CONST(0.94635335108449059), + FRAC_CONST(0.946847918221148), + FRAC_CONST(0.94734025733319194), + FRAC_CONST(0.94783036726210101), + FRAC_CONST(0.94831824685459909), + FRAC_CONST(0.94880389496265838), + FRAC_CONST(0.94928731044350201), + FRAC_CONST(0.94976849215960668), + FRAC_CONST(0.95024743897870523), + FRAC_CONST(0.95072414977378961), + FRAC_CONST(0.95119862342311323), + FRAC_CONST(0.95167085881019386), + FRAC_CONST(0.95214085482381583), + FRAC_CONST(0.95260861035803324), + FRAC_CONST(0.9530741243121722), + FRAC_CONST(0.95353739559083328), + FRAC_CONST(0.95399842310389449), + FRAC_CONST(0.95445720576651349), + FRAC_CONST(0.95491374249913052), + FRAC_CONST(0.95536803222747024), + FRAC_CONST(0.95582007388254542), + FRAC_CONST(0.95626986640065814), + FRAC_CONST(0.95671740872340305), + FRAC_CONST(0.9571626997976701), + FRAC_CONST(0.95760573857564624), + FRAC_CONST(0.9580465240148186), + FRAC_CONST(0.9584850550779761), + FRAC_CONST(0.95892133073321306), + FRAC_CONST(0.95935534995393079), + FRAC_CONST(0.9597871117188399), + FRAC_CONST(0.96021661501196343), + FRAC_CONST(0.96064385882263847), + FRAC_CONST(0.96106884214551935), + FRAC_CONST(0.961491563980579), + FRAC_CONST(0.9619120233331121), + FRAC_CONST(0.9623302192137374), + FRAC_CONST(0.96274615063839941), + FRAC_CONST(0.96315981662837136), + FRAC_CONST(0.96357121621025721), + FRAC_CONST(0.96398034841599411), + FRAC_CONST(0.96438721228285429), + FRAC_CONST(0.9647918068534479), + FRAC_CONST(0.96519413117572472), + FRAC_CONST(0.96559418430297683), + FRAC_CONST(0.96599196529384057), + FRAC_CONST(0.96638747321229879), + FRAC_CONST(0.96678070712768327), + FRAC_CONST(0.96717166611467664), + FRAC_CONST(0.96756034925331436), + FRAC_CONST(0.9679467556289878), + FRAC_CONST(0.9683308843324453), + FRAC_CONST(0.96871273445979478), + FRAC_CONST(0.9690923051125061), + FRAC_CONST(0.96946959539741295), + FRAC_CONST(0.96984460442671483), + FRAC_CONST(0.97021733131797916), + FRAC_CONST(0.97058777519414363), + FRAC_CONST(0.97095593518351797), + FRAC_CONST(0.97132181041978616), + FRAC_CONST(0.97168540004200854), + FRAC_CONST(0.9720467031946235), + FRAC_CONST(0.97240571902744977), + FRAC_CONST(0.97276244669568857), + FRAC_CONST(0.97311688535992513), + FRAC_CONST(0.97346903418613095), + FRAC_CONST(0.9738188923456661), + FRAC_CONST(0.97416645901528032), + FRAC_CONST(0.97451173337711572), + FRAC_CONST(0.97485471461870843), + FRAC_CONST(0.97519540193299037), + FRAC_CONST(0.97553379451829136), + FRAC_CONST(0.97586989157834103), + FRAC_CONST(0.97620369232227056), + FRAC_CONST(0.97653519596461447), + FRAC_CONST(0.97686440172531264), + FRAC_CONST(0.97719130882971228), + FRAC_CONST(0.97751591650856928), + FRAC_CONST(0.97783822399805043), + FRAC_CONST(0.97815823053973505), + FRAC_CONST(0.97847593538061683), + FRAC_CONST(0.97879133777310567), + FRAC_CONST(0.97910443697502925), + FRAC_CONST(0.97941523224963478), + FRAC_CONST(0.97972372286559117), + FRAC_CONST(0.98002990809698998), + FRAC_CONST(0.98033378722334796), + FRAC_CONST(0.98063535952960812), + FRAC_CONST(0.98093462430614164), + FRAC_CONST(0.98123158084874973), + FRAC_CONST(0.98152622845866466), + FRAC_CONST(0.9818185664425525), + FRAC_CONST(0.98210859411251361), + FRAC_CONST(0.98239631078608469), + FRAC_CONST(0.98268171578624086), + FRAC_CONST(0.98296480844139644), + FRAC_CONST(0.98324558808540707), + FRAC_CONST(0.98352405405757126), + FRAC_CONST(0.98380020570263149), + FRAC_CONST(0.98407404237077645), + FRAC_CONST(0.9843455634176419), + FRAC_CONST(0.9846147682043126), + FRAC_CONST(0.9848816560973237), + FRAC_CONST(0.98514622646866223), + FRAC_CONST(0.98540847869576842), + FRAC_CONST(0.98566841216153755), + FRAC_CONST(0.98592602625432113), + FRAC_CONST(0.98618132036792827), + FRAC_CONST(0.98643429390162707), + FRAC_CONST(0.98668494626014669), + FRAC_CONST(0.98693327685367771), + FRAC_CONST(0.98717928509787434), + FRAC_CONST(0.98742297041385541), + FRAC_CONST(0.98766433222820571), + FRAC_CONST(0.98790336997297779), + FRAC_CONST(0.98814008308569257), + FRAC_CONST(0.98837447100934128), + FRAC_CONST(0.98860653319238645), + FRAC_CONST(0.98883626908876354), + FRAC_CONST(0.98906367815788154), + FRAC_CONST(0.98928875986462517), + FRAC_CONST(0.98951151367935519), + FRAC_CONST(0.98973193907791057), + FRAC_CONST(0.98995003554160899), + FRAC_CONST(0.9901658025572484), + FRAC_CONST(0.99037923961710816), + FRAC_CONST(0.99059034621895015), + FRAC_CONST(0.99079912186602037), + FRAC_CONST(0.99100556606704937), + FRAC_CONST(0.99120967833625406), + FRAC_CONST(0.99141145819333854), + FRAC_CONST(0.99161090516349537), + FRAC_CONST(0.99180801877740643), + FRAC_CONST(0.99200279857124452), + FRAC_CONST(0.99219524408667392), + FRAC_CONST(0.99238535487085167), + FRAC_CONST(0.99257313047642881), + FRAC_CONST(0.99275857046155114), + FRAC_CONST(0.99294167438986047), + FRAC_CONST(0.99312244183049558), + FRAC_CONST(0.99330087235809328), + FRAC_CONST(0.99347696555278919), + FRAC_CONST(0.99365072100021912), + FRAC_CONST(0.99382213829151966), + FRAC_CONST(0.99399121702332938), + FRAC_CONST(0.99415795679778973), + FRAC_CONST(0.99432235722254581), + FRAC_CONST(0.9944844179107476), + FRAC_CONST(0.99464413848105071), + FRAC_CONST(0.99480151855761711), + FRAC_CONST(0.99495655777011638), + FRAC_CONST(0.99510925575372611), + FRAC_CONST(0.99525961214913339), + FRAC_CONST(0.9954076266025349), + FRAC_CONST(0.99555329876563847), + FRAC_CONST(0.99569662829566352), + FRAC_CONST(0.99583761485534161), + FRAC_CONST(0.99597625811291779), + FRAC_CONST(0.99611255774215113), + FRAC_CONST(0.99624651342231552), + FRAC_CONST(0.99637812483820021), + FRAC_CONST(0.99650739168011082), + FRAC_CONST(0.9966343136438699), + FRAC_CONST(0.996758890430818), + FRAC_CONST(0.99688112174781385), + FRAC_CONST(0.99700100730723529), + FRAC_CONST(0.99711854682697998), + FRAC_CONST(0.99723374003046616), + FRAC_CONST(0.99734658664663323), + FRAC_CONST(0.99745708640994191), + FRAC_CONST(0.99756523906037575), + FRAC_CONST(0.997671044343441), + FRAC_CONST(0.99777450201016782), + FRAC_CONST(0.99787561181711015), + FRAC_CONST(0.99797437352634699), + FRAC_CONST(0.99807078690548234), + FRAC_CONST(0.99816485172764624), + FRAC_CONST(0.99825656777149518), + FRAC_CONST(0.99834593482121237), + FRAC_CONST(0.99843295266650844), + FRAC_CONST(0.99851762110262221), + FRAC_CONST(0.99859993993032037), + FRAC_CONST(0.99867990895589909), + FRAC_CONST(0.99875752799118334), + FRAC_CONST(0.99883279685352799), + FRAC_CONST(0.99890571536581829), + FRAC_CONST(0.99897628335646982), + FRAC_CONST(0.99904450065942929), + FRAC_CONST(0.99911036711417489), + FRAC_CONST(0.99917388256571638), + FRAC_CONST(0.99923504686459585), + FRAC_CONST(0.99929385986688779), + FRAC_CONST(0.99935032143419944), + FRAC_CONST(0.9994044314336713), + FRAC_CONST(0.99945618973797734), + FRAC_CONST(0.99950559622532531), + FRAC_CONST(0.99955265077945699), + FRAC_CONST(0.99959735328964838), + FRAC_CONST(0.9996397036507102), + FRAC_CONST(0.99967970176298793), + FRAC_CONST(0.99971734753236219), + FRAC_CONST(0.99975264087024884), + FRAC_CONST(0.99978558169359921), + FRAC_CONST(0.99981616992490041), + FRAC_CONST(0.99984440549217524), + FRAC_CONST(0.99987028832898295), + FRAC_CONST(0.99989381837441849), + FRAC_CONST(0.99991499557311347), + FRAC_CONST(0.999933819875236), + FRAC_CONST(0.99995029123649048), + FRAC_CONST(0.99996440961811828), + FRAC_CONST(0.99997617498689761), + FRAC_CONST(0.9999855873151432), + FRAC_CONST(0.99999264658070719), + FRAC_CONST(0.99999735276697821), + FRAC_CONST(0.99999970586288223) +}; + +#ifdef ALLOW_SMALL_FRAMELENGTH +ALIGN static const real_t sine_long_960[] = +{ + FRAC_CONST(0.00081812299560725323), + FRAC_CONST(0.0024543667964602917), + FRAC_CONST(0.0040906040262347889), + FRAC_CONST(0.0057268303042312674), + FRAC_CONST(0.0073630412497795667), + FRAC_CONST(0.0089992324822505774), + FRAC_CONST(0.010635399621067975), + FRAC_CONST(0.012271538285719924), + FRAC_CONST(0.013907644095770845), + FRAC_CONST(0.015543712670873098), + FRAC_CONST(0.017179739630778748), + FRAC_CONST(0.018815720595351273), + FRAC_CONST(0.020451651184577292), + FRAC_CONST(0.022087527018578291), + FRAC_CONST(0.023723343717622358), + FRAC_CONST(0.025359096902135895), + FRAC_CONST(0.02699478219271537), + FRAC_CONST(0.028630395210139003), + FRAC_CONST(0.030265931575378519), + FRAC_CONST(0.031901386909610863), + FRAC_CONST(0.033536756834229922), + FRAC_CONST(0.035172036970858266), + FRAC_CONST(0.036807222941358832), + FRAC_CONST(0.038442310367846677), + FRAC_CONST(0.040077294872700696), + FRAC_CONST(0.041712172078575326), + FRAC_CONST(0.043346937608412288), + FRAC_CONST(0.044981587085452281), + FRAC_CONST(0.046616116133246711), + FRAC_CONST(0.048250520375669431), + FRAC_CONST(0.049884795436928406), + FRAC_CONST(0.051518936941577477), + FRAC_CONST(0.053152940514528055), + FRAC_CONST(0.05478680178106083), + FRAC_CONST(0.056420516366837495), + FRAC_CONST(0.05805407989791244), + FRAC_CONST(0.059687488000744485), + FRAC_CONST(0.061320736302208578), + FRAC_CONST(0.062953820429607482), + FRAC_CONST(0.064586736010683557), + FRAC_CONST(0.066219478673630344), + FRAC_CONST(0.06785204404710439), + FRAC_CONST(0.069484427760236861), + FRAC_CONST(0.071116625442645326), + FRAC_CONST(0.072748632724445372), + FRAC_CONST(0.07438044523626236), + FRAC_CONST(0.076012058609243122), + FRAC_CONST(0.077643468475067631), + FRAC_CONST(0.079274670465960706), + FRAC_CONST(0.080905660214703745), + FRAC_CONST(0.082536433354646319), + FRAC_CONST(0.084166985519717977), + FRAC_CONST(0.085797312344439894), + FRAC_CONST(0.08742740946393647), + FRAC_CONST(0.089057272513947183), + FRAC_CONST(0.090686897130838162), + FRAC_CONST(0.092316278951613845), + FRAC_CONST(0.093945413613928788), + FRAC_CONST(0.095574296756099186), + FRAC_CONST(0.097202924017114667), + FRAC_CONST(0.098831291036649963), + FRAC_CONST(0.10045939345507648), + FRAC_CONST(0.10208722691347409), + FRAC_CONST(0.10371478705364276), + FRAC_CONST(0.10534206951811415), + FRAC_CONST(0.10696906995016341), + FRAC_CONST(0.10859578399382072), + FRAC_CONST(0.11022220729388306), + FRAC_CONST(0.11184833549592579), + FRAC_CONST(0.11347416424631435), + FRAC_CONST(0.11509968919221586), + FRAC_CONST(0.11672490598161089), + FRAC_CONST(0.11834981026330495), + FRAC_CONST(0.11997439768694031), + FRAC_CONST(0.12159866390300751), + FRAC_CONST(0.12322260456285709), + FRAC_CONST(0.12484621531871121), + FRAC_CONST(0.12646949182367517), + FRAC_CONST(0.12809242973174936), + FRAC_CONST(0.12971502469784052), + FRAC_CONST(0.13133727237777362), + FRAC_CONST(0.13295916842830346), + FRAC_CONST(0.13458070850712617), + FRAC_CONST(0.13620188827289101), + FRAC_CONST(0.1378227033852118), + FRAC_CONST(0.13944314950467873), + FRAC_CONST(0.14106322229286994), + FRAC_CONST(0.14268291741236291), + FRAC_CONST(0.14430223052674654), + FRAC_CONST(0.1459211573006321), + FRAC_CONST(0.14753969339966552), + FRAC_CONST(0.14915783449053857), + FRAC_CONST(0.15077557624100058), + FRAC_CONST(0.15239291431987001), + FRAC_CONST(0.1540098443970461), + FRAC_CONST(0.15562636214352044), + FRAC_CONST(0.15724246323138855), + FRAC_CONST(0.15885814333386142), + FRAC_CONST(0.16047339812527725), + FRAC_CONST(0.16208822328111283), + FRAC_CONST(0.16370261447799525), + FRAC_CONST(0.16531656739371339), + FRAC_CONST(0.16693007770722967), + FRAC_CONST(0.16854314109869134), + FRAC_CONST(0.17015575324944232), + FRAC_CONST(0.17176790984203447), + FRAC_CONST(0.17337960656023954), + FRAC_CONST(0.1749908390890603), + FRAC_CONST(0.17660160311474243), + FRAC_CONST(0.17821189432478593), + FRAC_CONST(0.17982170840795647), + FRAC_CONST(0.18143104105429744), + FRAC_CONST(0.18303988795514095), + FRAC_CONST(0.1846482448031197), + FRAC_CONST(0.18625610729217834), + FRAC_CONST(0.1878634711175852), + FRAC_CONST(0.18947033197594348), + FRAC_CONST(0.19107668556520319), + FRAC_CONST(0.19268252758467228), + FRAC_CONST(0.19428785373502844), + FRAC_CONST(0.19589265971833042), + FRAC_CONST(0.19749694123802966), + FRAC_CONST(0.19910069399898173), + FRAC_CONST(0.20070391370745785), + FRAC_CONST(0.20230659607115639), + FRAC_CONST(0.20390873679921437), + FRAC_CONST(0.20551033160221882), + FRAC_CONST(0.20711137619221856), + FRAC_CONST(0.2087118662827353), + FRAC_CONST(0.21031179758877552), + FRAC_CONST(0.21191116582684155), + FRAC_CONST(0.21350996671494335), + FRAC_CONST(0.21510819597260972), + FRAC_CONST(0.21670584932089998), + FRAC_CONST(0.2183029224824154), + FRAC_CONST(0.21989941118131037), + FRAC_CONST(0.22149531114330431), + FRAC_CONST(0.22309061809569264), + FRAC_CONST(0.22468532776735861), + FRAC_CONST(0.22627943588878449), + FRAC_CONST(0.22787293819206314), + FRAC_CONST(0.22946583041090929), + FRAC_CONST(0.23105810828067114), + FRAC_CONST(0.23264976753834157), + FRAC_CONST(0.23424080392256985), + FRAC_CONST(0.2358312131736727), + FRAC_CONST(0.23742099103364595), + FRAC_CONST(0.23901013324617584), + FRAC_CONST(0.24059863555665045), + FRAC_CONST(0.24218649371217096), + FRAC_CONST(0.24377370346156332), + FRAC_CONST(0.24536026055538934), + FRAC_CONST(0.24694616074595824), + FRAC_CONST(0.24853139978733788), + FRAC_CONST(0.25011597343536629), + FRAC_CONST(0.25169987744766298), + FRAC_CONST(0.25328310758364025), + FRAC_CONST(0.25486565960451457), + FRAC_CONST(0.25644752927331788), + FRAC_CONST(0.25802871235490898), + FRAC_CONST(0.25960920461598508), + FRAC_CONST(0.26118900182509258), + FRAC_CONST(0.26276809975263904), + FRAC_CONST(0.264346494170904), + FRAC_CONST(0.26592418085405067), + FRAC_CONST(0.26750115557813692), + FRAC_CONST(0.2690774141211269), + FRAC_CONST(0.27065295226290209), + FRAC_CONST(0.2722277657852728), + FRAC_CONST(0.27380185047198918), + FRAC_CONST(0.27537520210875299), + FRAC_CONST(0.2769478164832283), + FRAC_CONST(0.27851968938505312), + FRAC_CONST(0.28009081660585067), + FRAC_CONST(0.28166119393924061), + FRAC_CONST(0.28323081718085019), + FRAC_CONST(0.28479968212832563), + FRAC_CONST(0.28636778458134327), + FRAC_CONST(0.28793512034162105), + FRAC_CONST(0.2895016852129294), + FRAC_CONST(0.29106747500110264), + FRAC_CONST(0.29263248551405047), + FRAC_CONST(0.2941967125617686), + FRAC_CONST(0.29576015195635058), + FRAC_CONST(0.29732279951199847), + FRAC_CONST(0.29888465104503475), + FRAC_CONST(0.30044570237391266), + FRAC_CONST(0.30200594931922808), + FRAC_CONST(0.30356538770373032), + FRAC_CONST(0.30512401335233358), + FRAC_CONST(0.30668182209212791), + FRAC_CONST(0.3082388097523906), + FRAC_CONST(0.30979497216459695), + FRAC_CONST(0.31135030516243201), + FRAC_CONST(0.3129048045818012), + FRAC_CONST(0.31445846626084178), + FRAC_CONST(0.31601128603993378), + FRAC_CONST(0.31756325976171151), + FRAC_CONST(0.31911438327107416), + FRAC_CONST(0.32066465241519732), + FRAC_CONST(0.32221406304354389), + FRAC_CONST(0.3237626110078754), + FRAC_CONST(0.32531029216226293), + FRAC_CONST(0.32685710236309828), + FRAC_CONST(0.32840303746910487), + FRAC_CONST(0.32994809334134939), + FRAC_CONST(0.3314922658432522), + FRAC_CONST(0.33303555084059877), + FRAC_CONST(0.33457794420155085), + FRAC_CONST(0.33611944179665709), + FRAC_CONST(0.33766003949886464), + FRAC_CONST(0.33919973318352969), + FRAC_CONST(0.34073851872842903), + FRAC_CONST(0.34227639201377064), + FRAC_CONST(0.34381334892220483), + FRAC_CONST(0.34534938533883547), + FRAC_CONST(0.34688449715123082), + FRAC_CONST(0.34841868024943456), + FRAC_CONST(0.34995193052597684), + FRAC_CONST(0.35148424387588523), + FRAC_CONST(0.3530156161966958), + FRAC_CONST(0.35454604338846402), + FRAC_CONST(0.35607552135377557), + FRAC_CONST(0.35760404599775775), + FRAC_CONST(0.35913161322809023), + FRAC_CONST(0.36065821895501554), + FRAC_CONST(0.36218385909135092), + FRAC_CONST(0.36370852955249849), + FRAC_CONST(0.36523222625645668), + FRAC_CONST(0.36675494512383078), + FRAC_CONST(0.36827668207784414), + FRAC_CONST(0.36979743304434909), + FRAC_CONST(0.37131719395183754), + FRAC_CONST(0.37283596073145214), + FRAC_CONST(0.37435372931699717), + FRAC_CONST(0.37587049564494951), + FRAC_CONST(0.37738625565446909), + FRAC_CONST(0.37890100528741022), + FRAC_CONST(0.38041474048833229), + FRAC_CONST(0.38192745720451066), + FRAC_CONST(0.38343915138594736), + FRAC_CONST(0.38494981898538222), + FRAC_CONST(0.38645945595830333), + FRAC_CONST(0.38796805826295838), + FRAC_CONST(0.38947562186036483), + FRAC_CONST(0.39098214271432141), + FRAC_CONST(0.39248761679141814), + FRAC_CONST(0.3939920400610481), + FRAC_CONST(0.39549540849541737), + FRAC_CONST(0.39699771806955625), + FRAC_CONST(0.39849896476132979), + FRAC_CONST(0.39999914455144892), + FRAC_CONST(0.40149825342348083), + FRAC_CONST(0.4029962873638599), + FRAC_CONST(0.40449324236189854), + FRAC_CONST(0.40598911440979762), + FRAC_CONST(0.40748389950265762), + FRAC_CONST(0.40897759363848879), + FRAC_CONST(0.41047019281822261), + FRAC_CONST(0.41196169304572178), + FRAC_CONST(0.4134520903277914), + FRAC_CONST(0.41494138067418929), + FRAC_CONST(0.41642956009763715), + FRAC_CONST(0.41791662461383078), + FRAC_CONST(0.41940257024145089), + FRAC_CONST(0.42088739300217382), + FRAC_CONST(0.42237108892068231), + FRAC_CONST(0.42385365402467584), + FRAC_CONST(0.42533508434488143), + FRAC_CONST(0.42681537591506419), + FRAC_CONST(0.42829452477203828), + FRAC_CONST(0.42977252695567697), + FRAC_CONST(0.43124937850892364), + FRAC_CONST(0.4327250754778022), + FRAC_CONST(0.43419961391142781), + FRAC_CONST(0.43567298986201736), + FRAC_CONST(0.43714519938489987), + FRAC_CONST(0.43861623853852766), + FRAC_CONST(0.44008610338448595), + FRAC_CONST(0.44155478998750436), + FRAC_CONST(0.44302229441546676), + FRAC_CONST(0.4444886127394222), + FRAC_CONST(0.44595374103359531), + FRAC_CONST(0.44741767537539667), + FRAC_CONST(0.44888041184543348), + FRAC_CONST(0.45034194652752002), + FRAC_CONST(0.45180227550868812), + FRAC_CONST(0.45326139487919759), + FRAC_CONST(0.45471930073254679), + FRAC_CONST(0.45617598916548296), + FRAC_CONST(0.45763145627801283), + FRAC_CONST(0.45908569817341294), + FRAC_CONST(0.46053871095824001), + FRAC_CONST(0.46199049074234161), + FRAC_CONST(0.46344103363886635), + FRAC_CONST(0.46489033576427435), + FRAC_CONST(0.46633839323834758), + FRAC_CONST(0.46778520218420055), + FRAC_CONST(0.46923075872829029), + FRAC_CONST(0.47067505900042683), + FRAC_CONST(0.47211809913378361), + FRAC_CONST(0.47355987526490806), + FRAC_CONST(0.47500038353373153), + FRAC_CONST(0.47643962008357982), + FRAC_CONST(0.47787758106118372), + FRAC_CONST(0.47931426261668875), + FRAC_CONST(0.48074966090366611), + FRAC_CONST(0.48218377207912272), + FRAC_CONST(0.48361659230351117), + FRAC_CONST(0.48504811774074069), + FRAC_CONST(0.48647834455818684), + FRAC_CONST(0.48790726892670194), + FRAC_CONST(0.48933488702062544), + FRAC_CONST(0.49076119501779414), + FRAC_CONST(0.49218618909955225), + FRAC_CONST(0.4936098654507618), + FRAC_CONST(0.49503222025981269), + FRAC_CONST(0.49645324971863303), + FRAC_CONST(0.49787295002269943), + FRAC_CONST(0.49929131737104687), + FRAC_CONST(0.50070834796627917), + FRAC_CONST(0.50212403801457872), + FRAC_CONST(0.50353838372571758), + FRAC_CONST(0.50495138131306638), + FRAC_CONST(0.50636302699360547), + FRAC_CONST(0.50777331698793449), + FRAC_CONST(0.50918224752028263), + FRAC_CONST(0.51058981481851906), + FRAC_CONST(0.51199601511416237), + FRAC_CONST(0.51340084464239111), + FRAC_CONST(0.51480429964205421), + FRAC_CONST(0.51620637635567967), + FRAC_CONST(0.51760707102948678), + FRAC_CONST(0.51900637991339404), + FRAC_CONST(0.5204042992610306), + FRAC_CONST(0.52180082532974559), + FRAC_CONST(0.5231959543806185), + FRAC_CONST(0.52458968267846895), + FRAC_CONST(0.52598200649186677), + FRAC_CONST(0.52737292209314235), + FRAC_CONST(0.52876242575839572), + FRAC_CONST(0.53015051376750777), + FRAC_CONST(0.53153718240414882), + FRAC_CONST(0.53292242795578992), + FRAC_CONST(0.53430624671371152), + FRAC_CONST(0.53568863497301467), + FRAC_CONST(0.5370695890326298), + FRAC_CONST(0.5384491051953274), + FRAC_CONST(0.53982717976772743), + FRAC_CONST(0.54120380906030963), + FRAC_CONST(0.54257898938742311), + FRAC_CONST(0.54395271706729609), + FRAC_CONST(0.54532498842204646), + FRAC_CONST(0.54669579977769045), + FRAC_CONST(0.54806514746415402), + FRAC_CONST(0.54943302781528081), + FRAC_CONST(0.55079943716884383), + FRAC_CONST(0.55216437186655387), + FRAC_CONST(0.55352782825406999), + FRAC_CONST(0.55488980268100907), + FRAC_CONST(0.55625029150095584), + FRAC_CONST(0.55760929107147217), + FRAC_CONST(0.55896679775410718), + FRAC_CONST(0.56032280791440714), + FRAC_CONST(0.56167731792192455), + FRAC_CONST(0.56303032415022869), + FRAC_CONST(0.56438182297691453), + FRAC_CONST(0.56573181078361312), + FRAC_CONST(0.56708028395600085), + FRAC_CONST(0.56842723888380908), + FRAC_CONST(0.56977267196083425), + FRAC_CONST(0.57111657958494688), + FRAC_CONST(0.5724589581581021), + FRAC_CONST(0.57379980408634845), + FRAC_CONST(0.57513911377983773), + FRAC_CONST(0.57647688365283478), + FRAC_CONST(0.57781311012372738), + FRAC_CONST(0.57914778961503466), + FRAC_CONST(0.58048091855341843), + FRAC_CONST(0.5818124933696911), + FRAC_CONST(0.58314251049882604), + FRAC_CONST(0.58447096637996743), + FRAC_CONST(0.58579785745643886), + FRAC_CONST(0.5871231801757536), + FRAC_CONST(0.58844693098962408), + FRAC_CONST(0.58976910635397084), + FRAC_CONST(0.59108970272893235), + FRAC_CONST(0.59240871657887517), + FRAC_CONST(0.59372614437240179), + FRAC_CONST(0.59504198258236196), + FRAC_CONST(0.5963562276858605), + FRAC_CONST(0.59766887616426767), + FRAC_CONST(0.5989799245032289), + FRAC_CONST(0.60028936919267273), + FRAC_CONST(0.60159720672682204), + FRAC_CONST(0.60290343360420195), + FRAC_CONST(0.60420804632765002), + FRAC_CONST(0.60551104140432543), + FRAC_CONST(0.60681241534571839), + FRAC_CONST(0.60811216466765883), + FRAC_CONST(0.60941028589032709), + FRAC_CONST(0.61070677553826169), + FRAC_CONST(0.61200163014036979), + FRAC_CONST(0.61329484622993602), + FRAC_CONST(0.6145864203446314), + FRAC_CONST(0.61587634902652377), + FRAC_CONST(0.61716462882208556), + FRAC_CONST(0.61845125628220421), + FRAC_CONST(0.61973622796219074), + FRAC_CONST(0.6210195404217892), + FRAC_CONST(0.62230119022518593), + FRAC_CONST(0.62358117394101897), + FRAC_CONST(0.62485948814238634), + FRAC_CONST(0.62613612940685637), + FRAC_CONST(0.62741109431647646), + FRAC_CONST(0.62868437945778133), + FRAC_CONST(0.62995598142180387), + FRAC_CONST(0.6312258968040827), + FRAC_CONST(0.63249412220467238), + FRAC_CONST(0.63376065422815175), + FRAC_CONST(0.63502548948363347), + FRAC_CONST(0.63628862458477287), + FRAC_CONST(0.63755005614977711), + FRAC_CONST(0.63880978080141437), + FRAC_CONST(0.6400677951670225), + FRAC_CONST(0.6413240958785188), + FRAC_CONST(0.64257867957240766), + FRAC_CONST(0.6438315428897915), + FRAC_CONST(0.64508268247637779), + FRAC_CONST(0.64633209498248945), + FRAC_CONST(0.64757977706307335), + FRAC_CONST(0.64882572537770888), + FRAC_CONST(0.65006993659061751), + FRAC_CONST(0.65131240737067142), + FRAC_CONST(0.65255313439140239), + FRAC_CONST(0.65379211433101081), + FRAC_CONST(0.65502934387237444), + FRAC_CONST(0.6562648197030575), + FRAC_CONST(0.65749853851531959), + FRAC_CONST(0.65873049700612374), + FRAC_CONST(0.65996069187714679), + FRAC_CONST(0.66118911983478657), + FRAC_CONST(0.66241577759017178), + FRAC_CONST(0.66364066185917048), + FRAC_CONST(0.66486376936239888), + FRAC_CONST(0.66608509682523009), + FRAC_CONST(0.66730464097780284), + FRAC_CONST(0.66852239855503071), + FRAC_CONST(0.66973836629660977), + FRAC_CONST(0.67095254094702894), + FRAC_CONST(0.67216491925557675), + FRAC_CONST(0.67337549797635199), + FRAC_CONST(0.67458427386827102), + FRAC_CONST(0.67579124369507693), + FRAC_CONST(0.67699640422534846), + FRAC_CONST(0.67819975223250772), + FRAC_CONST(0.6794012844948305), + FRAC_CONST(0.68060099779545302), + FRAC_CONST(0.68179888892238183), + FRAC_CONST(0.6829949546685018), + FRAC_CONST(0.68418919183158522), + FRAC_CONST(0.68538159721429948), + FRAC_CONST(0.6865721676242168), + FRAC_CONST(0.68776089987382172), + FRAC_CONST(0.68894779078052026), + FRAC_CONST(0.69013283716664853), + FRAC_CONST(0.69131603585948032), + FRAC_CONST(0.69249738369123692), + FRAC_CONST(0.69367687749909468), + FRAC_CONST(0.69485451412519361), + FRAC_CONST(0.69603029041664599), + FRAC_CONST(0.6972042032255451), + FRAC_CONST(0.6983762494089728), + FRAC_CONST(0.69954642582900894), + FRAC_CONST(0.70071472935273893), + FRAC_CONST(0.70188115685226271), + FRAC_CONST(0.703045705204703), + FRAC_CONST(0.70420837129221303), + FRAC_CONST(0.70536915200198613), + FRAC_CONST(0.70652804422626281), + FRAC_CONST(0.70768504486233985), + FRAC_CONST(0.70884015081257845), + FRAC_CONST(0.70999335898441229), + FRAC_CONST(0.711144666290356), + FRAC_CONST(0.71229406964801356), + FRAC_CONST(0.71344156598008623), + FRAC_CONST(0.71458715221438096), + FRAC_CONST(0.71573082528381871), + FRAC_CONST(0.71687258212644234), + FRAC_CONST(0.7180124196854254), + FRAC_CONST(0.71915033490907943), + FRAC_CONST(0.72028632475086318), + FRAC_CONST(0.72142038616938997), + FRAC_CONST(0.72255251612843596), + FRAC_CONST(0.72368271159694852), + FRAC_CONST(0.72481096954905444), + FRAC_CONST(0.72593728696406756), + FRAC_CONST(0.72706166082649704), + FRAC_CONST(0.72818408812605595), + FRAC_CONST(0.72930456585766834), + FRAC_CONST(0.73042309102147851), + FRAC_CONST(0.73153966062285747), + FRAC_CONST(0.73265427167241282), + FRAC_CONST(0.73376692118599507), + FRAC_CONST(0.73487760618470677), + FRAC_CONST(0.73598632369490979), + FRAC_CONST(0.73709307074823405), + FRAC_CONST(0.73819784438158409), + FRAC_CONST(0.73930064163714881), + FRAC_CONST(0.74040145956240788), + FRAC_CONST(0.74150029521014049), + FRAC_CONST(0.74259714563843304), + FRAC_CONST(0.74369200791068657), + FRAC_CONST(0.74478487909562552), + FRAC_CONST(0.74587575626730485), + FRAC_CONST(0.74696463650511791), + FRAC_CONST(0.74805151689380456), + FRAC_CONST(0.74913639452345926), + FRAC_CONST(0.75021926648953785), + FRAC_CONST(0.75130012989286621), + FRAC_CONST(0.7523789818396478), + FRAC_CONST(0.75345581944147111), + FRAC_CONST(0.75453063981531809), + FRAC_CONST(0.75560344008357094), + FRAC_CONST(0.75667421737402052), + FRAC_CONST(0.7577429688198738), + FRAC_CONST(0.75880969155976163), + FRAC_CONST(0.75987438273774599), + FRAC_CONST(0.76093703950332836), + FRAC_CONST(0.76199765901145666), + FRAC_CONST(0.76305623842253345), + FRAC_CONST(0.76411277490242291), + FRAC_CONST(0.76516726562245885), + FRAC_CONST(0.76621970775945258), + FRAC_CONST(0.76727009849569949), + FRAC_CONST(0.76831843501898767), + FRAC_CONST(0.76936471452260458), + FRAC_CONST(0.77040893420534517), + FRAC_CONST(0.77145109127151923), + FRAC_CONST(0.77249118293095853), + FRAC_CONST(0.77352920639902467), + FRAC_CONST(0.77456515889661659), + FRAC_CONST(0.77559903765017746), + FRAC_CONST(0.7766308398917029), + FRAC_CONST(0.77766056285874774), + FRAC_CONST(0.77868820379443371), + FRAC_CONST(0.77971375994745684), + FRAC_CONST(0.78073722857209438), + FRAC_CONST(0.7817586069282132), + FRAC_CONST(0.78277789228127592), + FRAC_CONST(0.78379508190234881), + FRAC_CONST(0.78481017306810918), + FRAC_CONST(0.78582316306085265), + FRAC_CONST(0.78683404916849986), + FRAC_CONST(0.78784282868460476), + FRAC_CONST(0.78884949890836087), + FRAC_CONST(0.78985405714460888), + FRAC_CONST(0.7908565007038445), + FRAC_CONST(0.79185682690222425), + FRAC_CONST(0.79285503306157412), + FRAC_CONST(0.79385111650939566), + FRAC_CONST(0.79484507457887377), + FRAC_CONST(0.79583690460888357), + FRAC_CONST(0.79682660394399751), + FRAC_CONST(0.79781416993449272), + FRAC_CONST(0.79879959993635785), + FRAC_CONST(0.7997828913113002), + FRAC_CONST(0.80076404142675273), + FRAC_CONST(0.80174304765588156), + FRAC_CONST(0.80271990737759213), + FRAC_CONST(0.80369461797653707), + FRAC_CONST(0.80466717684312306), + FRAC_CONST(0.80563758137351682), + FRAC_CONST(0.80660582896965372), + FRAC_CONST(0.80757191703924336), + FRAC_CONST(0.80853584299577752), + FRAC_CONST(0.80949760425853612), + FRAC_CONST(0.81045719825259477), + FRAC_CONST(0.81141462240883167), + FRAC_CONST(0.81236987416393436), + FRAC_CONST(0.81332295096040608), + FRAC_CONST(0.81427385024657373), + FRAC_CONST(0.81522256947659355), + FRAC_CONST(0.81616910611045879), + FRAC_CONST(0.817113457614006), + FRAC_CONST(0.81805562145892186), + FRAC_CONST(0.81899559512275044), + FRAC_CONST(0.81993337608889916), + FRAC_CONST(0.82086896184664637), + FRAC_CONST(0.8218023498911472), + FRAC_CONST(0.82273353772344116), + FRAC_CONST(0.82366252285045805), + FRAC_CONST(0.82458930278502529), + FRAC_CONST(0.82551387504587381), + FRAC_CONST(0.82643623715764558), + FRAC_CONST(0.82735638665089983), + FRAC_CONST(0.82827432106211907), + FRAC_CONST(0.82919003793371693), + FRAC_CONST(0.83010353481404364), + FRAC_CONST(0.83101480925739324), + FRAC_CONST(0.83192385882400965), + FRAC_CONST(0.83283068108009373), + FRAC_CONST(0.8337352735978093), + FRAC_CONST(0.83463763395529011), + FRAC_CONST(0.83553775973664579), + FRAC_CONST(0.83643564853196872), + FRAC_CONST(0.83733129793734051), + FRAC_CONST(0.83822470555483797), + FRAC_CONST(0.83911586899254031), + FRAC_CONST(0.84000478586453453), + FRAC_CONST(0.84089145379092289), + FRAC_CONST(0.84177587039782842), + FRAC_CONST(0.84265803331740163), + FRAC_CONST(0.84353794018782702), + FRAC_CONST(0.844415588653329), + FRAC_CONST(0.8452909763641786), + FRAC_CONST(0.84616410097669936), + FRAC_CONST(0.84703496015327406), + FRAC_CONST(0.84790355156235053), + FRAC_CONST(0.84876987287844818), + FRAC_CONST(0.8496339217821639), + FRAC_CONST(0.85049569596017938), + FRAC_CONST(0.85135519310526508), + FRAC_CONST(0.85221241091628896), + FRAC_CONST(0.85306734709822085), + FRAC_CONST(0.85391999936213903), + FRAC_CONST(0.85477036542523732), + FRAC_CONST(0.85561844301082923), + FRAC_CONST(0.85646422984835635), + FRAC_CONST(0.85730772367339259), + FRAC_CONST(0.85814892222765116), + FRAC_CONST(0.85898782325899026), + FRAC_CONST(0.85982442452141961), + FRAC_CONST(0.86065872377510555), + FRAC_CONST(0.86149071878637817), + FRAC_CONST(0.8623204073277364), + FRAC_CONST(0.86314778717785412), + FRAC_CONST(0.8639728561215867), + FRAC_CONST(0.86479561194997623), + FRAC_CONST(0.86561605246025763), + FRAC_CONST(0.86643417545586487), + FRAC_CONST(0.8672499787464365), + FRAC_CONST(0.86806346014782154), + FRAC_CONST(0.8688746174820855), + FRAC_CONST(0.86968344857751589), + FRAC_CONST(0.87048995126862883), + FRAC_CONST(0.87129412339617363), + FRAC_CONST(0.87209596280713941), + FRAC_CONST(0.8728954673547612), + FRAC_CONST(0.87369263489852422), + FRAC_CONST(0.87448746330417149), + FRAC_CONST(0.87527995044370765), + FRAC_CONST(0.8760700941954066), + FRAC_CONST(0.87685789244381551), + FRAC_CONST(0.87764334307976144), + FRAC_CONST(0.87842644400035663), + FRAC_CONST(0.8792071931090043), + FRAC_CONST(0.87998558831540408), + FRAC_CONST(0.88076162753555787), + FRAC_CONST(0.88153530869177488), + FRAC_CONST(0.88230662971267804), + FRAC_CONST(0.88307558853320878), + FRAC_CONST(0.88384218309463292), + FRAC_CONST(0.8846064113445461), + FRAC_CONST(0.88536827123687933), + FRAC_CONST(0.88612776073190425), + FRAC_CONST(0.88688487779623937), + FRAC_CONST(0.88763962040285393), + FRAC_CONST(0.8883919865310751), + FRAC_CONST(0.88914197416659235), + FRAC_CONST(0.88988958130146301), + FRAC_CONST(0.8906348059341177), + FRAC_CONST(0.89137764606936609), + FRAC_CONST(0.89211809971840139), + FRAC_CONST(0.89285616489880615), + FRAC_CONST(0.89359183963455813), + FRAC_CONST(0.89432512195603453), + FRAC_CONST(0.89505600990001799), + FRAC_CONST(0.89578450150970124), + FRAC_CONST(0.8965105948346932), + FRAC_CONST(0.89723428793102367), + FRAC_CONST(0.89795557886114807), + FRAC_CONST(0.89867446569395382), + FRAC_CONST(0.89939094650476448), + FRAC_CONST(0.90010501937534515), + FRAC_CONST(0.900816682393908), + FRAC_CONST(0.90152593365511691), + FRAC_CONST(0.90223277126009283), + FRAC_CONST(0.90293719331641886), + FRAC_CONST(0.90363919793814496), + FRAC_CONST(0.90433878324579353), + FRAC_CONST(0.90503594736636439), + FRAC_CONST(0.90573068843333915), + FRAC_CONST(0.90642300458668679), + FRAC_CONST(0.90711289397286898), + FRAC_CONST(0.90780035474484411), + FRAC_CONST(0.90848538506207266), + FRAC_CONST(0.90916798309052227), + FRAC_CONST(0.90984814700267291), + FRAC_CONST(0.9105258749775208), + FRAC_CONST(0.91120116520058425), + FRAC_CONST(0.91187401586390815), + FRAC_CONST(0.91254442516606893), + FRAC_CONST(0.9132123913121788), + FRAC_CONST(0.91387791251389161), + FRAC_CONST(0.91454098698940678), + FRAC_CONST(0.91520161296347435), + FRAC_CONST(0.91585978866739981), + FRAC_CONST(0.91651551233904871), + FRAC_CONST(0.91716878222285148), + FRAC_CONST(0.91781959656980805), + FRAC_CONST(0.91846795363749245), + FRAC_CONST(0.91911385169005766), + FRAC_CONST(0.9197572889982405), + FRAC_CONST(0.9203982638393654), + FRAC_CONST(0.92103677449734989), + FRAC_CONST(0.92167281926270861), + FRAC_CONST(0.92230639643255874), + FRAC_CONST(0.92293750431062316), + FRAC_CONST(0.92356614120723612), + FRAC_CONST(0.92419230543934783), + FRAC_CONST(0.92481599533052783), + FRAC_CONST(0.92543720921097061), + FRAC_CONST(0.92605594541749991), + FRAC_CONST(0.92667220229357261), + FRAC_CONST(0.92728597818928349), + FRAC_CONST(0.9278972714613698), + FRAC_CONST(0.92850608047321548), + FRAC_CONST(0.9291124035948557), + FRAC_CONST(0.92971623920298097), + FRAC_CONST(0.93031758568094147), + FRAC_CONST(0.93091644141875196), + FRAC_CONST(0.93151280481309506), + FRAC_CONST(0.93210667426732674), + FRAC_CONST(0.93269804819147983), + FRAC_CONST(0.93328692500226818), + FRAC_CONST(0.93387330312309147), + FRAC_CONST(0.93445718098403896), + FRAC_CONST(0.93503855702189376), + FRAC_CONST(0.9356174296801375), + FRAC_CONST(0.93619379740895381), + FRAC_CONST(0.93676765866523259), + FRAC_CONST(0.93733901191257496), + FRAC_CONST(0.93790785562129597), + FRAC_CONST(0.93847418826842988), + FRAC_CONST(0.93903800833773399), + FRAC_CONST(0.93959931431969212), + FRAC_CONST(0.94015810471151917), + FRAC_CONST(0.94071437801716529), + FRAC_CONST(0.94126813274731924), + FRAC_CONST(0.94181936741941319), + FRAC_CONST(0.94236808055762578), + FRAC_CONST(0.94291427069288691), + FRAC_CONST(0.94345793636288133), + FRAC_CONST(0.94399907611205225), + FRAC_CONST(0.9445376884916058), + FRAC_CONST(0.94507377205951448), + FRAC_CONST(0.94560732538052128), + FRAC_CONST(0.94613834702614352), + FRAC_CONST(0.94666683557467624), + FRAC_CONST(0.94719278961119657), + FRAC_CONST(0.94771620772756759), + FRAC_CONST(0.94823708852244104), + FRAC_CONST(0.94875543060126255), + FRAC_CONST(0.94927123257627433), + FRAC_CONST(0.94978449306651924), + FRAC_CONST(0.95029521069784428), + FRAC_CONST(0.9508033841029051), + FRAC_CONST(0.95130901192116835), + FRAC_CONST(0.9518120927989161), + FRAC_CONST(0.95231262538924943), + FRAC_CONST(0.95281060835209208), + FRAC_CONST(0.95330604035419386), + FRAC_CONST(0.95379892006913403), + FRAC_CONST(0.95428924617732525), + FRAC_CONST(0.95477701736601728), + FRAC_CONST(0.95526223232929941), + FRAC_CONST(0.95574488976810545), + FRAC_CONST(0.95622498839021619), + FRAC_CONST(0.95670252691026292), + FRAC_CONST(0.95717750404973156), + FRAC_CONST(0.95764991853696524), + FRAC_CONST(0.95811976910716812), + FRAC_CONST(0.95858705450240911), + FRAC_CONST(0.95905177347162429), + FRAC_CONST(0.95951392477062125), + FRAC_CONST(0.95997350716208196), + FRAC_CONST(0.96043051941556579), + FRAC_CONST(0.96088496030751369), + FRAC_CONST(0.96133682862125036), + FRAC_CONST(0.96178612314698864), + FRAC_CONST(0.96223284268183173), + FRAC_CONST(0.9626769860297768), + FRAC_CONST(0.96311855200171881), + FRAC_CONST(0.96355753941545252), + FRAC_CONST(0.96399394709567654), + FRAC_CONST(0.96442777387399625), + FRAC_CONST(0.96485901858892686), + FRAC_CONST(0.96528768008589627), + FRAC_CONST(0.96571375721724895), + FRAC_CONST(0.96613724884224783), + FRAC_CONST(0.96655815382707866), + FRAC_CONST(0.96697647104485207), + FRAC_CONST(0.96739219937560694), + FRAC_CONST(0.96780533770631338), + FRAC_CONST(0.96821588493087585), + FRAC_CONST(0.9686238399501359), + FRAC_CONST(0.96902920167187501), + FRAC_CONST(0.96943196901081796), + FRAC_CONST(0.96983214088863534), + FRAC_CONST(0.9702297162339466), + FRAC_CONST(0.97062469398232287), + FRAC_CONST(0.97101707307629004), + FRAC_CONST(0.97140685246533098), + FRAC_CONST(0.97179403110588902), + FRAC_CONST(0.97217860796137046), + FRAC_CONST(0.97256058200214734), + FRAC_CONST(0.97293995220556007), + FRAC_CONST(0.97331671755592064), + FRAC_CONST(0.97369087704451474), + FRAC_CONST(0.97406242966960455), + FRAC_CONST(0.97443137443643235), + FRAC_CONST(0.97479771035722163), + FRAC_CONST(0.97516143645118103), + FRAC_CONST(0.97552255174450631), + FRAC_CONST(0.97588105527038305), + FRAC_CONST(0.97623694606898959), + FRAC_CONST(0.97659022318749911), + FRAC_CONST(0.97694088568008242), + FRAC_CONST(0.97728893260791039), + FRAC_CONST(0.97763436303915685), + FRAC_CONST(0.97797717604900047), + FRAC_CONST(0.97831737071962765), + FRAC_CONST(0.97865494614023485), + FRAC_CONST(0.97898990140703124), + FRAC_CONST(0.97932223562324061), + FRAC_CONST(0.97965194789910426), + FRAC_CONST(0.9799790373518833), + FRAC_CONST(0.98030350310586067), + FRAC_CONST(0.98062534429234405), + FRAC_CONST(0.98094456004966768), + FRAC_CONST(0.98126114952319499), + FRAC_CONST(0.98157511186532054), + FRAC_CONST(0.98188644623547261), + FRAC_CONST(0.98219515180011563), + FRAC_CONST(0.98250122773275184), + FRAC_CONST(0.98280467321392362), + FRAC_CONST(0.98310548743121629), + FRAC_CONST(0.98340366957925973), + FRAC_CONST(0.98369921885973044), + FRAC_CONST(0.98399213448135414), + FRAC_CONST(0.98428241565990748), + FRAC_CONST(0.98457006161822058), + FRAC_CONST(0.98485507158617835), + FRAC_CONST(0.98513744480072363), + FRAC_CONST(0.98541718050585803), + FRAC_CONST(0.98569427795264519), + FRAC_CONST(0.98596873639921168), + FRAC_CONST(0.98624055511074971), + FRAC_CONST(0.98650973335951875), + FRAC_CONST(0.98677627042484772), + FRAC_CONST(0.98704016559313645), + FRAC_CONST(0.98730141815785832), + FRAC_CONST(0.98756002741956173), + FRAC_CONST(0.9878159926858715), + FRAC_CONST(0.98806931327149194), + FRAC_CONST(0.98831998849820735), + FRAC_CONST(0.98856801769488489), + FRAC_CONST(0.98881340019747566), + FRAC_CONST(0.98905613534901682), + FRAC_CONST(0.98929622249963345), + FRAC_CONST(0.98953366100653983), + FRAC_CONST(0.98976845023404181), + FRAC_CONST(0.99000058955353776), + FRAC_CONST(0.99023007834352106), + FRAC_CONST(0.99045691598958097), + FRAC_CONST(0.99068110188440506), + FRAC_CONST(0.99090263542778001), + FRAC_CONST(0.99112151602659404), + FRAC_CONST(0.99133774309483769), + FRAC_CONST(0.99155131605360625), + FRAC_CONST(0.99176223433110056), + FRAC_CONST(0.99197049736262888), + FRAC_CONST(0.99217610459060845), + FRAC_CONST(0.99237905546456673), + FRAC_CONST(0.99257934944114334), + FRAC_CONST(0.99277698598409092), + FRAC_CONST(0.99297196456427694), + FRAC_CONST(0.99316428465968509), + FRAC_CONST(0.99335394575541669), + FRAC_CONST(0.99354094734369169), + FRAC_CONST(0.99372528892385081), + FRAC_CONST(0.99390697000235606), + FRAC_CONST(0.99408599009279242), + FRAC_CONST(0.99426234871586938), + FRAC_CONST(0.99443604539942176), + FRAC_CONST(0.99460707967841133), + FRAC_CONST(0.99477545109492771), + FRAC_CONST(0.99494115919819004), + FRAC_CONST(0.99510420354454787), + FRAC_CONST(0.99526458369748239), + FRAC_CONST(0.99542229922760772), + FRAC_CONST(0.99557734971267187), + FRAC_CONST(0.9957297347375581), + FRAC_CONST(0.99587945389428578), + FRAC_CONST(0.99602650678201154), + FRAC_CONST(0.99617089300703077), + FRAC_CONST(0.996312612182778), + FRAC_CONST(0.99645166392982831), + FRAC_CONST(0.99658804787589839), + FRAC_CONST(0.99672176365584741), + FRAC_CONST(0.99685281091167788), + FRAC_CONST(0.99698118929253687), + FRAC_CONST(0.99710689845471678), + FRAC_CONST(0.99722993806165661), + FRAC_CONST(0.99735030778394196), + FRAC_CONST(0.99746800729930707), + FRAC_CONST(0.99758303629263489), + FRAC_CONST(0.99769539445595812), + FRAC_CONST(0.99780508148846014), + FRAC_CONST(0.99791209709647588), + FRAC_CONST(0.99801644099349218), + FRAC_CONST(0.99811811290014918), + FRAC_CONST(0.9982171125442405), + FRAC_CONST(0.9983134396607144), + FRAC_CONST(0.99840709399167404), + FRAC_CONST(0.99849807528637868), + FRAC_CONST(0.99858638330124405), + FRAC_CONST(0.99867201779984294), + FRAC_CONST(0.99875497855290607), + FRAC_CONST(0.99883526533832245), + FRAC_CONST(0.99891287794114036), + FRAC_CONST(0.99898781615356746), + FRAC_CONST(0.99906007977497147), + FRAC_CONST(0.99912966861188113), + FRAC_CONST(0.99919658247798593), + FRAC_CONST(0.99926082119413751), + FRAC_CONST(0.99932238458834954), + FRAC_CONST(0.999381272495798), + FRAC_CONST(0.99943748475882255), + FRAC_CONST(0.9994910212269259), + FRAC_CONST(0.99954188175677483), + FRAC_CONST(0.99959006621220048), + FRAC_CONST(0.99963557446419837), + FRAC_CONST(0.99967840639092931), + FRAC_CONST(0.99971856187771946), + FRAC_CONST(0.99975604081706027), + FRAC_CONST(0.99979084310860955), + FRAC_CONST(0.99982296865919107), + FRAC_CONST(0.99985241738279484), + FRAC_CONST(0.99987918920057806), + FRAC_CONST(0.99990328404086426), + FRAC_CONST(0.9999247018391445), + FRAC_CONST(0.99994344253807688), + FRAC_CONST(0.99995950608748674), + FRAC_CONST(0.99997289244436727), + FRAC_CONST(0.99998360157287902), + FRAC_CONST(0.9999916334443506), + FRAC_CONST(0.99999698803727821), + FRAC_CONST(0.99999966533732598) +}; +#endif + +ALIGN static const real_t sine_short_128[] = +{ + FRAC_CONST(0.0061358846491544753), + FRAC_CONST(0.01840672990580482), + FRAC_CONST(0.030674803176636626), + FRAC_CONST(0.04293825693494082), + FRAC_CONST(0.055195244349689934), + FRAC_CONST(0.067443919563664051), + FRAC_CONST(0.079682437971430126), + FRAC_CONST(0.091908956497132724), + FRAC_CONST(0.10412163387205459), + FRAC_CONST(0.11631863091190475), + FRAC_CONST(0.12849811079379317), + FRAC_CONST(0.14065823933284921), + FRAC_CONST(0.15279718525844344), + FRAC_CONST(0.16491312048996989), + FRAC_CONST(0.17700422041214875), + FRAC_CONST(0.18906866414980619), + FRAC_CONST(0.2011046348420919), + FRAC_CONST(0.21311031991609136), + FRAC_CONST(0.22508391135979283), + FRAC_CONST(0.2370236059943672), + FRAC_CONST(0.24892760574572015), + FRAC_CONST(0.26079411791527551), + FRAC_CONST(0.27262135544994898), + FRAC_CONST(0.28440753721127188), + FRAC_CONST(0.29615088824362379), + FRAC_CONST(0.30784964004153487), + FRAC_CONST(0.31950203081601569), + FRAC_CONST(0.33110630575987643), + FRAC_CONST(0.34266071731199438), + FRAC_CONST(0.35416352542049034), + FRAC_CONST(0.36561299780477385), + FRAC_CONST(0.37700741021641826), + FRAC_CONST(0.38834504669882625), + FRAC_CONST(0.39962419984564679), + FRAC_CONST(0.41084317105790391), + FRAC_CONST(0.42200027079979968), + FRAC_CONST(0.43309381885315196), + FRAC_CONST(0.4441221445704292), + FRAC_CONST(0.45508358712634384), + FRAC_CONST(0.46597649576796618), + FRAC_CONST(0.47679923006332209), + FRAC_CONST(0.487550160148436), + FRAC_CONST(0.49822766697278187), + FRAC_CONST(0.50883014254310699), + FRAC_CONST(0.51935599016558964), + FRAC_CONST(0.52980362468629461), + FRAC_CONST(0.54017147272989285), + FRAC_CONST(0.55045797293660481), + FRAC_CONST(0.56066157619733603), + FRAC_CONST(0.57078074588696726), + FRAC_CONST(0.58081395809576453), + FRAC_CONST(0.59075970185887416), + FRAC_CONST(0.60061647938386897), + FRAC_CONST(0.61038280627630948), + FRAC_CONST(0.6200572117632891), + FRAC_CONST(0.62963823891492698), + FRAC_CONST(0.63912444486377573), + FRAC_CONST(0.64851440102211244), + FRAC_CONST(0.65780669329707864), + FRAC_CONST(0.66699992230363747), + FRAC_CONST(0.67609270357531592), + FRAC_CONST(0.68508366777270036), + FRAC_CONST(0.693971460889654), + FRAC_CONST(0.7027547444572253), + FRAC_CONST(0.71143219574521643), + FRAC_CONST(0.72000250796138165), + FRAC_CONST(0.7284643904482252), + FRAC_CONST(0.73681656887736979), + FRAC_CONST(0.74505778544146595), + FRAC_CONST(0.75318679904361241), + FRAC_CONST(0.76120238548426178), + FRAC_CONST(0.76910333764557959), + FRAC_CONST(0.77688846567323244), + FRAC_CONST(0.78455659715557524), + FRAC_CONST(0.79210657730021239), + FRAC_CONST(0.79953726910790501), + FRAC_CONST(0.80684755354379922), + FRAC_CONST(0.8140363297059483), + FRAC_CONST(0.82110251499110465), + FRAC_CONST(0.8280450452577558), + FRAC_CONST(0.83486287498638001), + FRAC_CONST(0.84155497743689833), + FRAC_CONST(0.84812034480329712), + FRAC_CONST(0.85455798836540053), + FRAC_CONST(0.86086693863776731), + FRAC_CONST(0.86704624551569265), + FRAC_CONST(0.87309497841829009), + FRAC_CONST(0.87901222642863341), + FRAC_CONST(0.88479709843093779), + FRAC_CONST(0.89044872324475788), + FRAC_CONST(0.89596624975618511), + FRAC_CONST(0.90134884704602203), + FRAC_CONST(0.90659570451491533), + FRAC_CONST(0.91170603200542988), + FRAC_CONST(0.9166790599210427), + FRAC_CONST(0.9215140393420419), + FRAC_CONST(0.92621024213831127), + FRAC_CONST(0.93076696107898371), + FRAC_CONST(0.9351835099389475), + FRAC_CONST(0.93945922360218992), + FRAC_CONST(0.94359345816196039), + FRAC_CONST(0.94758559101774109), + FRAC_CONST(0.95143502096900834), + FRAC_CONST(0.95514116830577067), + FRAC_CONST(0.9587034748958716), + FRAC_CONST(0.96212140426904158), + FRAC_CONST(0.9653944416976894), + FRAC_CONST(0.96852209427441727), + FRAC_CONST(0.97150389098625178), + FRAC_CONST(0.97433938278557586), + FRAC_CONST(0.97702814265775439), + FRAC_CONST(0.97956976568544052), + FRAC_CONST(0.98196386910955524), + FRAC_CONST(0.98421009238692903), + FRAC_CONST(0.98630809724459867), + FRAC_CONST(0.98825756773074946), + FRAC_CONST(0.99005821026229712), + FRAC_CONST(0.99170975366909953), + FRAC_CONST(0.9932119492347945), + FRAC_CONST(0.99456457073425542), + FRAC_CONST(0.99576741446765982), + FRAC_CONST(0.99682029929116567), + FRAC_CONST(0.99772306664419164), + FRAC_CONST(0.99847558057329477), + FRAC_CONST(0.99907772775264536), + FRAC_CONST(0.99952941750109314), + FRAC_CONST(0.9998305817958234), + FRAC_CONST(0.99998117528260111) +}; + +#ifdef ALLOW_SMALL_FRAMELENGTH +ALIGN static const real_t sine_short_120[] = +{ + FRAC_CONST(0.0065449379673518581), + FRAC_CONST(0.019633692460628301), + FRAC_CONST(0.032719082821776137), + FRAC_CONST(0.045798866936520771), + FRAC_CONST(0.058870803651189033), + FRAC_CONST(0.071932653156719387), + FRAC_CONST(0.084982177372441667), + FRAC_CONST(0.09801714032956059), + FRAC_CONST(0.11103530855427769), + FRAC_CONST(0.12403445145048532), + FRAC_CONST(0.13701234168196802), + FRAC_CONST(0.14996675555404498), + FRAC_CONST(0.16289547339458874), + FRAC_CONST(0.17579627993435451), + FRAC_CONST(0.18866696468655525), + FRAC_CONST(0.2015053223256171), + FRAC_CONST(0.21430915306505074), + FRAC_CONST(0.2270762630343732), + FRAC_CONST(0.23980446465501654), + FRAC_CONST(0.25249157701515795), + FRAC_CONST(0.26513542624340797), + FRAC_CONST(0.27773384588129219), + FRAC_CONST(0.29028467725446233), + FRAC_CONST(0.3027857698425746), + FRAC_CONST(0.31523498164776964), + FRAC_CONST(0.32763017956169349), + FRAC_CONST(0.33996923973099424), + FRAC_CONST(0.35225004792123354), + FRAC_CONST(0.36447049987914965), + FRAC_CONST(0.37662850169321077), + FRAC_CONST(0.38872197015239557), + FRAC_CONST(0.40074883310314097), + FRAC_CONST(0.41270702980439467), + FRAC_CONST(0.42459451128071307), + FRAC_CONST(0.43640924067334208), + FRAC_CONST(0.44814919358922256), + FRAC_CONST(0.45981235844785984), + FRAC_CONST(0.47139673682599764), + FRAC_CONST(0.48290034380003727), + FRAC_CONST(0.49432120828614462), + FRAC_CONST(0.50565737337798455), + FRAC_CONST(0.51690689668202761), + FRAC_CONST(0.52806785065036799), + FRAC_CONST(0.53913832291100017), + FRAC_CONST(0.55011641659549337), + FRAC_CONST(0.56100025066400983), + FRAC_CONST(0.57178796022761225), + FRAC_CONST(0.58247769686780215), + FRAC_CONST(0.59306762895323706), + FRAC_CONST(0.60355594195357143), + FRAC_CONST(0.61394083875036642), + FRAC_CONST(0.62422053994501758), + FRAC_CONST(0.63439328416364549), + FRAC_CONST(0.64445732835889735), + FRAC_CONST(0.65441094810861034), + FRAC_CONST(0.66425243791128175), + FRAC_CONST(0.67398011147829784), + FRAC_CONST(0.68359230202287125), + FRAC_CONST(0.69308736254563585), + FRAC_CONST(0.70246366611685174), + FRAC_CONST(0.71171960615517138), + FRAC_CONST(0.72085359670291882), + FRAC_CONST(0.7298640726978356), + FRAC_CONST(0.73874949024124625), + FRAC_CONST(0.74750832686259672), + FRAC_CONST(0.75613908178032285), + FRAC_CONST(0.76464027615900032), + FRAC_CONST(0.77301045336273699), + FRAC_CONST(0.78124817920475853), + FRAC_CONST(0.78935204219315003), + FRAC_CONST(0.79732065377270711), + FRAC_CONST(0.80515264856285829), + FRAC_CONST(0.81284668459161513), + FRAC_CONST(0.82040144352551359), + FRAC_CONST(0.82781563089550203), + FRAC_CONST(0.83508797631874299), + FRAC_CONST(0.84221723371628654), + FRAC_CONST(0.84920218152657889), + FRAC_CONST(0.85604162291477137), + FRAC_CONST(0.86273438597779184), + FRAC_CONST(0.86927932394514362), + FRAC_CONST(0.87567531537539967), + FRAC_CONST(0.88192126434835494), + FRAC_CONST(0.88801610065280734), + FRAC_CONST(0.89395877996993212), + FRAC_CONST(0.8997482840522214), + FRAC_CONST(0.90538362089795521), + FRAC_CONST(0.91086382492117568), + FRAC_CONST(0.91618795711713596), + FRAC_CONST(0.92135510522319242), + FRAC_CONST(0.9263643838751181), + FRAC_CONST(0.93121493475880346), + FRAC_CONST(0.93590592675732565), + FRAC_CONST(0.94043655609335486), + FRAC_CONST(0.94480604646687805), + FRAC_CONST(0.94901364918821385), + FRAC_CONST(0.95305864330629697), + FRAC_CONST(0.95694033573220882), + FRAC_CONST(0.9606580613579353), + FRAC_CONST(0.96421118317032928), + FRAC_CONST(0.96759909236025976), + FRAC_CONST(0.9708212084269281), + FRAC_CONST(0.97387697927733363), + FRAC_CONST(0.97676588132087239), + FRAC_CONST(0.97948741955905139), + FRAC_CONST(0.98204112767030394), + FRAC_CONST(0.98442656808989171), + FRAC_CONST(0.98664333208487898), + FRAC_CONST(0.98869103982416728), + FRAC_CONST(0.99056934044357725), + FRAC_CONST(0.99227791210596705), + FRAC_CONST(0.99381646205637808), + FRAC_CONST(0.99518472667219682), + FRAC_CONST(0.99638247150832537), + FRAC_CONST(0.99740949133735191), + FRAC_CONST(0.99826561018471593), + FRAC_CONST(0.99895068135886012), + FRAC_CONST(0.99946458747636568), + FRAC_CONST(0.99980724048206482), + FRAC_CONST(0.99997858166412923) +}; +#endif + +#ifdef LD_DEC +ALIGN static const real_t sine_mid_512[] = +{ + FRAC_CONST(0.0015339801862847655), + FRAC_CONST(0.0046019261204485705), + FRAC_CONST(0.007669828739531097), + FRAC_CONST(0.010737659167264491), + FRAC_CONST(0.013805388528060391), + FRAC_CONST(0.01687298794728171), + FRAC_CONST(0.019940428551514441), + FRAC_CONST(0.023007681468839369), + FRAC_CONST(0.026074717829103901), + FRAC_CONST(0.029141508764193722), + FRAC_CONST(0.032208025408304586), + FRAC_CONST(0.035274238898213947), + FRAC_CONST(0.038340120373552694), + FRAC_CONST(0.041405640977076739), + FRAC_CONST(0.044470771854938668), + FRAC_CONST(0.047535484156959303), + FRAC_CONST(0.050599749036899282), + FRAC_CONST(0.05366353765273052), + FRAC_CONST(0.056726821166907748), + FRAC_CONST(0.059789570746639868), + FRAC_CONST(0.062851757564161406), + FRAC_CONST(0.065913352797003805), + FRAC_CONST(0.068974327628266746), + FRAC_CONST(0.072034653246889332), + FRAC_CONST(0.075094300847921305), + FRAC_CONST(0.078153241632794232), + FRAC_CONST(0.081211446809592441), + FRAC_CONST(0.084268887593324071), + FRAC_CONST(0.087325535206192059), + FRAC_CONST(0.090381360877864983), + FRAC_CONST(0.093436335845747787), + FRAC_CONST(0.096490431355252593), + FRAC_CONST(0.099543618660069319), + FRAC_CONST(0.10259586902243628), + FRAC_CONST(0.10564715371341062), + FRAC_CONST(0.10869744401313872), + FRAC_CONST(0.11174671121112659), + FRAC_CONST(0.11479492660651008), + FRAC_CONST(0.11784206150832498), + FRAC_CONST(0.12088808723577708), + FRAC_CONST(0.12393297511851216), + FRAC_CONST(0.12697669649688587), + FRAC_CONST(0.13001922272223335), + FRAC_CONST(0.13306052515713906), + FRAC_CONST(0.1361005751757062), + FRAC_CONST(0.1391393441638262), + FRAC_CONST(0.14217680351944803), + FRAC_CONST(0.14521292465284746), + FRAC_CONST(0.14824767898689603), + FRAC_CONST(0.15128103795733022), + FRAC_CONST(0.1543129730130201), + FRAC_CONST(0.15734345561623825), + FRAC_CONST(0.16037245724292828), + FRAC_CONST(0.16339994938297323), + FRAC_CONST(0.1664259035404641), + FRAC_CONST(0.16945029123396796), + FRAC_CONST(0.17247308399679595), + FRAC_CONST(0.17549425337727143), + FRAC_CONST(0.17851377093899751), + FRAC_CONST(0.18153160826112497), + FRAC_CONST(0.18454773693861962), + FRAC_CONST(0.1875621285825296), + FRAC_CONST(0.19057475482025274), + FRAC_CONST(0.19358558729580361), + FRAC_CONST(0.19659459767008022), + FRAC_CONST(0.19960175762113097), + FRAC_CONST(0.20260703884442113), + FRAC_CONST(0.20561041305309924), + FRAC_CONST(0.20861185197826349), + FRAC_CONST(0.21161132736922755), + FRAC_CONST(0.21460881099378676), + FRAC_CONST(0.21760427463848364), + FRAC_CONST(0.22059769010887351), + FRAC_CONST(0.22358902922978999), + FRAC_CONST(0.22657826384561), + FRAC_CONST(0.22956536582051887), + FRAC_CONST(0.23255030703877524), + FRAC_CONST(0.23553305940497549), + FRAC_CONST(0.23851359484431842), + FRAC_CONST(0.24149188530286933), + FRAC_CONST(0.24446790274782415), + FRAC_CONST(0.24744161916777327), + FRAC_CONST(0.25041300657296522), + FRAC_CONST(0.25338203699557016), + FRAC_CONST(0.25634868248994291), + FRAC_CONST(0.25931291513288623), + FRAC_CONST(0.26227470702391359), + FRAC_CONST(0.26523403028551179), + FRAC_CONST(0.26819085706340318), + FRAC_CONST(0.27114515952680801), + FRAC_CONST(0.27409690986870638), + FRAC_CONST(0.2770460803060999), + FRAC_CONST(0.27999264308027322), + FRAC_CONST(0.28293657045705539), + FRAC_CONST(0.28587783472708062), + FRAC_CONST(0.28881640820604948), + FRAC_CONST(0.29175226323498926), + FRAC_CONST(0.29468537218051433), + FRAC_CONST(0.2976157074350862), + FRAC_CONST(0.30054324141727345), + FRAC_CONST(0.30346794657201132), + FRAC_CONST(0.30638979537086092), + FRAC_CONST(0.30930876031226873), + FRAC_CONST(0.31222481392182488), + FRAC_CONST(0.31513792875252244), + FRAC_CONST(0.31804807738501495), + FRAC_CONST(0.32095523242787521), + FRAC_CONST(0.32385936651785285), + FRAC_CONST(0.32676045232013173), + FRAC_CONST(0.32965846252858749), + FRAC_CONST(0.33255336986604422), + FRAC_CONST(0.3354451470845316), + FRAC_CONST(0.33833376696554113), + FRAC_CONST(0.34121920232028236), + FRAC_CONST(0.34410142598993881), + FRAC_CONST(0.34698041084592368), + FRAC_CONST(0.34985612979013492), + FRAC_CONST(0.35272855575521073), + FRAC_CONST(0.35559766170478385), + FRAC_CONST(0.35846342063373654), + FRAC_CONST(0.36132580556845428), + FRAC_CONST(0.36418478956707989), + FRAC_CONST(0.36704034571976718), + FRAC_CONST(0.3698924471489341), + FRAC_CONST(0.37274106700951576), + FRAC_CONST(0.37558617848921722), + FRAC_CONST(0.37842775480876556), + FRAC_CONST(0.38126576922216238), + FRAC_CONST(0.38410019501693504), + FRAC_CONST(0.38693100551438858), + FRAC_CONST(0.38975817406985641), + FRAC_CONST(0.39258167407295147), + FRAC_CONST(0.39540147894781635), + FRAC_CONST(0.39821756215337356), + FRAC_CONST(0.40102989718357562), + FRAC_CONST(0.40383845756765407), + FRAC_CONST(0.40664321687036903), + FRAC_CONST(0.40944414869225759), + FRAC_CONST(0.41224122666988289), + FRAC_CONST(0.41503442447608163), + FRAC_CONST(0.41782371582021227), + FRAC_CONST(0.42060907444840251), + FRAC_CONST(0.42339047414379605), + FRAC_CONST(0.42616788872679962), + FRAC_CONST(0.42894129205532949), + FRAC_CONST(0.43171065802505726), + FRAC_CONST(0.43447596056965565), + FRAC_CONST(0.43723717366104409), + FRAC_CONST(0.43999427130963326), + FRAC_CONST(0.44274722756457002), + FRAC_CONST(0.44549601651398174), + FRAC_CONST(0.44824061228521989), + FRAC_CONST(0.45098098904510386), + FRAC_CONST(0.45371712100016387), + FRAC_CONST(0.45644898239688392), + FRAC_CONST(0.45917654752194409), + FRAC_CONST(0.46189979070246273), + FRAC_CONST(0.46461868630623782), + FRAC_CONST(0.46733320874198842), + FRAC_CONST(0.47004333245959562), + FRAC_CONST(0.47274903195034279), + FRAC_CONST(0.47545028174715587), + FRAC_CONST(0.47814705642484301), + FRAC_CONST(0.48083933060033396), + FRAC_CONST(0.48352707893291874), + FRAC_CONST(0.48621027612448642), + FRAC_CONST(0.48888889691976317), + FRAC_CONST(0.4915629161065499), + FRAC_CONST(0.49423230851595967), + FRAC_CONST(0.49689704902265447), + FRAC_CONST(0.49955711254508184), + FRAC_CONST(0.50221247404571079), + FRAC_CONST(0.50486310853126759), + FRAC_CONST(0.50750899105297087), + FRAC_CONST(0.51015009670676681), + FRAC_CONST(0.51278640063356296), + FRAC_CONST(0.51541787801946293), + FRAC_CONST(0.51804450409599934), + FRAC_CONST(0.52066625414036716), + FRAC_CONST(0.52328310347565643), + FRAC_CONST(0.52589502747108463), + FRAC_CONST(0.52850200154222848), + FRAC_CONST(0.531104001151255), + FRAC_CONST(0.53370100180715296), + FRAC_CONST(0.53629297906596318), + FRAC_CONST(0.53887990853100842), + FRAC_CONST(0.54146176585312344), + FRAC_CONST(0.54403852673088382), + FRAC_CONST(0.54661016691083486), + FRAC_CONST(0.54917666218771966), + FRAC_CONST(0.55173798840470734), + FRAC_CONST(0.55429412145362), + FRAC_CONST(0.5568450372751601), + FRAC_CONST(0.55939071185913614), + FRAC_CONST(0.56193112124468947), + FRAC_CONST(0.5644662415205195), + FRAC_CONST(0.56699604882510868), + FRAC_CONST(0.56952051934694714), + FRAC_CONST(0.57203962932475705), + FRAC_CONST(0.57455335504771576), + FRAC_CONST(0.57706167285567944), + FRAC_CONST(0.57956455913940563), + FRAC_CONST(0.58206199034077544), + FRAC_CONST(0.58455394295301533), + FRAC_CONST(0.58704039352091797), + FRAC_CONST(0.58952131864106394), + FRAC_CONST(0.59199669496204099), + FRAC_CONST(0.59446649918466443), + FRAC_CONST(0.5969307080621965), + FRAC_CONST(0.59938929840056454), + FRAC_CONST(0.60184224705858003), + FRAC_CONST(0.60428953094815596), + FRAC_CONST(0.60673112703452448), + FRAC_CONST(0.60916701233645321), + FRAC_CONST(0.61159716392646191), + FRAC_CONST(0.61402155893103838), + FRAC_CONST(0.61644017453085365), + FRAC_CONST(0.61885298796097632), + FRAC_CONST(0.62125997651108755), + FRAC_CONST(0.62366111752569453), + FRAC_CONST(0.62605638840434352), + FRAC_CONST(0.62844576660183271), + FRAC_CONST(0.63082922962842447), + FRAC_CONST(0.63320675505005719), + FRAC_CONST(0.63557832048855611), + FRAC_CONST(0.63794390362184406), + FRAC_CONST(0.64030348218415167), + FRAC_CONST(0.64265703396622686), + FRAC_CONST(0.64500453681554393), + FRAC_CONST(0.64734596863651206), + FRAC_CONST(0.64968130739068319), + FRAC_CONST(0.6520105310969595), + FRAC_CONST(0.65433361783180044), + FRAC_CONST(0.65665054572942894), + FRAC_CONST(0.65896129298203732), + FRAC_CONST(0.66126583783999227), + FRAC_CONST(0.66356415861203977), + FRAC_CONST(0.66585623366550972), + FRAC_CONST(0.66814204142651845), + FRAC_CONST(0.67042156038017309), + FRAC_CONST(0.67269476907077286), + FRAC_CONST(0.67496164610201193), + FRAC_CONST(0.67722217013718033), + FRAC_CONST(0.67947631989936497), + FRAC_CONST(0.68172407417164971), + FRAC_CONST(0.6839654117973154), + FRAC_CONST(0.68620031168003859), + FRAC_CONST(0.68842875278409044), + FRAC_CONST(0.6906507141345346), + FRAC_CONST(0.69286617481742463), + FRAC_CONST(0.69507511398000088), + FRAC_CONST(0.69727751083088652), + FRAC_CONST(0.69947334464028377), + FRAC_CONST(0.70166259474016845), + FRAC_CONST(0.70384524052448494), + FRAC_CONST(0.70602126144933974), + FRAC_CONST(0.70819063703319529), + FRAC_CONST(0.71035334685706231), + FRAC_CONST(0.71250937056469232), + FRAC_CONST(0.71465868786276898), + FRAC_CONST(0.71680127852109954), + FRAC_CONST(0.71893712237280438), + FRAC_CONST(0.72106619931450811), + FRAC_CONST(0.72318848930652735), + FRAC_CONST(0.72530397237306066), + FRAC_CONST(0.72741262860237577), + FRAC_CONST(0.7295144381469969), + FRAC_CONST(0.73160938122389252), + FRAC_CONST(0.73369743811466026), + FRAC_CONST(0.73577858916571348), + FRAC_CONST(0.73785281478846598), + FRAC_CONST(0.73992009545951609), + FRAC_CONST(0.74198041172083096), + FRAC_CONST(0.74403374417992918), + FRAC_CONST(0.74608007351006378), + FRAC_CONST(0.74811938045040349), + FRAC_CONST(0.75015164580621496), + FRAC_CONST(0.7521768504490427), + FRAC_CONST(0.75419497531688917), + FRAC_CONST(0.75620600141439454), + FRAC_CONST(0.75820990981301528), + FRAC_CONST(0.76020668165120242), + FRAC_CONST(0.7621962981345789), + FRAC_CONST(0.76417874053611667), + FRAC_CONST(0.76615399019631281), + FRAC_CONST(0.76812202852336531), + FRAC_CONST(0.7700828369933479), + FRAC_CONST(0.77203639715038441), + FRAC_CONST(0.77398269060682279), + FRAC_CONST(0.77592169904340758), + FRAC_CONST(0.77785340420945304), + FRAC_CONST(0.77977778792301444), + FRAC_CONST(0.78169483207105939), + FRAC_CONST(0.7836045186096382), + FRAC_CONST(0.78550682956405393), + FRAC_CONST(0.78740174702903132), + FRAC_CONST(0.78928925316888565), + FRAC_CONST(0.79116933021769009), + FRAC_CONST(0.79304196047944364), + FRAC_CONST(0.79490712632823701), + FRAC_CONST(0.79676481020841872), + FRAC_CONST(0.79861499463476082), + FRAC_CONST(0.80045766219262271), + FRAC_CONST(0.80229279553811572), + FRAC_CONST(0.8041203773982657), + FRAC_CONST(0.80594039057117628), + FRAC_CONST(0.80775281792619036), + FRAC_CONST(0.80955764240405126), + FRAC_CONST(0.81135484701706373), + FRAC_CONST(0.81314441484925359), + FRAC_CONST(0.81492632905652662), + FRAC_CONST(0.81670057286682785), + FRAC_CONST(0.81846712958029866), + FRAC_CONST(0.82022598256943469), + FRAC_CONST(0.82197711527924155), + FRAC_CONST(0.82372051122739132), + FRAC_CONST(0.82545615400437744), + FRAC_CONST(0.82718402727366902), + FRAC_CONST(0.82890411477186487), + FRAC_CONST(0.8306164003088462), + FRAC_CONST(0.83232086776792968), + FRAC_CONST(0.83401750110601813), + FRAC_CONST(0.8357062843537526), + FRAC_CONST(0.83738720161566194), + FRAC_CONST(0.83906023707031263), + FRAC_CONST(0.84072537497045807), + FRAC_CONST(0.84238259964318596), + FRAC_CONST(0.84403189549006641), + FRAC_CONST(0.84567324698729907), + FRAC_CONST(0.84730663868585832), + FRAC_CONST(0.84893205521163961), + FRAC_CONST(0.85054948126560337), + FRAC_CONST(0.85215890162391983), + FRAC_CONST(0.8537603011381113), + FRAC_CONST(0.85535366473519603), + FRAC_CONST(0.85693897741782865), + FRAC_CONST(0.85851622426444274), + FRAC_CONST(0.86008539042939014), + FRAC_CONST(0.8616464611430813), + FRAC_CONST(0.86319942171212416), + FRAC_CONST(0.86474425751946238), + FRAC_CONST(0.86628095402451299), + FRAC_CONST(0.86780949676330321), + FRAC_CONST(0.86932987134860673), + FRAC_CONST(0.87084206347007886), + FRAC_CONST(0.87234605889439154), + FRAC_CONST(0.87384184346536675), + FRAC_CONST(0.87532940310411078), + FRAC_CONST(0.87680872380914576), + FRAC_CONST(0.87827979165654146), + FRAC_CONST(0.87974259280004741), + FRAC_CONST(0.88119711347122198), + FRAC_CONST(0.88264333997956279), + FRAC_CONST(0.88408125871263499), + FRAC_CONST(0.88551085613619995), + FRAC_CONST(0.88693211879434208), + FRAC_CONST(0.88834503330959624), + FRAC_CONST(0.88974958638307289), + FRAC_CONST(0.89114576479458318), + FRAC_CONST(0.89253355540276469), + FRAC_CONST(0.89391294514520325), + FRAC_CONST(0.89528392103855758), + FRAC_CONST(0.89664647017868015), + FRAC_CONST(0.89800057974073988), + FRAC_CONST(0.89934623697934146), + FRAC_CONST(0.90068342922864686), + FRAC_CONST(0.90201214390249307), + FRAC_CONST(0.90333236849451182), + FRAC_CONST(0.90464409057824624), + FRAC_CONST(0.90594729780726846), + FRAC_CONST(0.90724197791529593), + FRAC_CONST(0.90852811871630612), + FRAC_CONST(0.90980570810465222), + FRAC_CONST(0.91107473405517625), + FRAC_CONST(0.91233518462332275), + FRAC_CONST(0.91358704794525081), + FRAC_CONST(0.91483031223794609), + FRAC_CONST(0.91606496579933161), + FRAC_CONST(0.91729099700837791), + FRAC_CONST(0.91850839432521225), + FRAC_CONST(0.91971714629122736), + FRAC_CONST(0.92091724152918952), + FRAC_CONST(0.92210866874334507), + FRAC_CONST(0.92329141671952764), + FRAC_CONST(0.9244654743252626), + FRAC_CONST(0.92563083050987272), + FRAC_CONST(0.92678747430458175), + FRAC_CONST(0.92793539482261789), + FRAC_CONST(0.92907458125931575), + FRAC_CONST(0.93020502289221907), + FRAC_CONST(0.93132670908118043), + FRAC_CONST(0.93243962926846236), + FRAC_CONST(0.93354377297883617), + FRAC_CONST(0.93463912981968078), + FRAC_CONST(0.93572568948108037), + FRAC_CONST(0.93680344173592156), + FRAC_CONST(0.93787237643998989), + FRAC_CONST(0.93893248353206449), + FRAC_CONST(0.93998375303401394), + FRAC_CONST(0.94102617505088926), + FRAC_CONST(0.94205973977101731), + FRAC_CONST(0.94308443746609349), + FRAC_CONST(0.94410025849127266), + FRAC_CONST(0.94510719328526061), + FRAC_CONST(0.94610523237040334), + FRAC_CONST(0.94709436635277722), + FRAC_CONST(0.94807458592227623), + FRAC_CONST(0.94904588185270056), + FRAC_CONST(0.950008245001843), + FRAC_CONST(0.95096166631157508), + FRAC_CONST(0.95190613680793223), + FRAC_CONST(0.95284164760119872), + FRAC_CONST(0.95376818988599033), + FRAC_CONST(0.95468575494133834), + FRAC_CONST(0.95559433413077111), + FRAC_CONST(0.95649391890239499), + FRAC_CONST(0.95738450078897586), + FRAC_CONST(0.95826607140801767), + FRAC_CONST(0.95913862246184189), + FRAC_CONST(0.96000214573766585), + FRAC_CONST(0.96085663310767966), + FRAC_CONST(0.96170207652912254), + FRAC_CONST(0.96253846804435916), + FRAC_CONST(0.96336579978095405), + FRAC_CONST(0.96418406395174572), + FRAC_CONST(0.96499325285492032), + FRAC_CONST(0.96579335887408357), + FRAC_CONST(0.96658437447833312), + FRAC_CONST(0.96736629222232851), + FRAC_CONST(0.96813910474636233), + FRAC_CONST(0.96890280477642887), + FRAC_CONST(0.96965738512429245), + FRAC_CONST(0.9704028386875555), + FRAC_CONST(0.97113915844972509), + FRAC_CONST(0.9718663374802794), + FRAC_CONST(0.97258436893473221), + FRAC_CONST(0.97329324605469825), + FRAC_CONST(0.97399296216795583), + FRAC_CONST(0.97468351068851067), + FRAC_CONST(0.97536488511665687), + FRAC_CONST(0.97603707903903902), + FRAC_CONST(0.97670008612871184), + FRAC_CONST(0.97735390014519996), + FRAC_CONST(0.97799851493455714), + FRAC_CONST(0.9786339244294231), + FRAC_CONST(0.97926012264908202), + FRAC_CONST(0.97987710369951764), + FRAC_CONST(0.98048486177346938), + FRAC_CONST(0.98108339115048659), + FRAC_CONST(0.98167268619698311), + FRAC_CONST(0.98225274136628937), + FRAC_CONST(0.98282355119870524), + FRAC_CONST(0.98338511032155118), + FRAC_CONST(0.98393741344921892), + FRAC_CONST(0.98448045538322093), + FRAC_CONST(0.98501423101223984), + FRAC_CONST(0.98553873531217606), + FRAC_CONST(0.98605396334619544), + FRAC_CONST(0.98655991026477541), + FRAC_CONST(0.98705657130575097), + FRAC_CONST(0.98754394179435923), + FRAC_CONST(0.98802201714328353), + FRAC_CONST(0.98849079285269659), + FRAC_CONST(0.98895026451030299), + FRAC_CONST(0.98940042779138038), + FRAC_CONST(0.98984127845882053), + FRAC_CONST(0.99027281236316911), + FRAC_CONST(0.99069502544266463), + FRAC_CONST(0.99110791372327678), + FRAC_CONST(0.9915114733187439), + FRAC_CONST(0.99190570043060933), + FRAC_CONST(0.99229059134825737), + FRAC_CONST(0.99266614244894802), + FRAC_CONST(0.99303235019785141), + FRAC_CONST(0.99338921114808065), + FRAC_CONST(0.9937367219407246), + FRAC_CONST(0.99407487930487937), + FRAC_CONST(0.9944036800576791), + FRAC_CONST(0.9947231211043257), + FRAC_CONST(0.99503319943811863), + FRAC_CONST(0.99533391214048228), + FRAC_CONST(0.99562525638099431), + FRAC_CONST(0.99590722941741172), + FRAC_CONST(0.99617982859569687), + FRAC_CONST(0.99644305135004263), + FRAC_CONST(0.99669689520289606), + FRAC_CONST(0.99694135776498216), + FRAC_CONST(0.99717643673532619), + FRAC_CONST(0.9974021299012753), + FRAC_CONST(0.99761843513851955), + FRAC_CONST(0.99782535041111164), + FRAC_CONST(0.99802287377148624), + FRAC_CONST(0.99821100336047819), + FRAC_CONST(0.99838973740734016), + FRAC_CONST(0.99855907422975931), + FRAC_CONST(0.99871901223387294), + FRAC_CONST(0.99886954991428356), + FRAC_CONST(0.99901068585407338), + FRAC_CONST(0.99914241872481691), + FRAC_CONST(0.99926474728659442), + FRAC_CONST(0.99937767038800285), + FRAC_CONST(0.99948118696616695), + FRAC_CONST(0.99957529604674922), + FRAC_CONST(0.99965999674395922), + FRAC_CONST(0.99973528826056168), + FRAC_CONST(0.99980116988788426), + FRAC_CONST(0.99985764100582386), + FRAC_CONST(0.9999047010828529), + FRAC_CONST(0.99994234967602391), + FRAC_CONST(0.99997058643097414), + FRAC_CONST(0.9999894110819284), + FRAC_CONST(0.99999882345170188) +}; + +#ifdef ALLOW_SMALL_FRAMELENGTH +ALIGN static const real_t sine_mid_480[] = +{ + FRAC_CONST(0.0016362454436240478), + FRAC_CONST(0.00490871880799799), + FRAC_CONST(0.0081811396039371282), + FRAC_CONST(0.011453472786443779), + FRAC_CONST(0.014725683311458524), + FRAC_CONST(0.017997736136235509), + FRAC_CONST(0.021269596219717739), + FRAC_CONST(0.024541228522912285), + FRAC_CONST(0.027812598009265607), + FRAC_CONST(0.03108366964503869), + FRAC_CONST(0.034354408399682276), + FRAC_CONST(0.037624779246211978), + FRAC_CONST(0.04089474716158345), + FRAC_CONST(0.044164277127067358), + FRAC_CONST(0.047433334128624507), + FRAC_CONST(0.050701883157280733), + FRAC_CONST(0.053969889209501881), + FRAC_CONST(0.057237317287568618), + FRAC_CONST(0.060504132399951269), + FRAC_CONST(0.063770299561684493), + FRAC_CONST(0.06703578379474201), + FRAC_CONST(0.070300550128411174), + FRAC_CONST(0.073564563599667426), + FRAC_CONST(0.076827789253548759), + FRAC_CONST(0.080090192143530081), + FRAC_CONST(0.083351737331897449), + FRAC_CONST(0.086612389890122182), + FRAC_CONST(0.089872114899234967), + FRAC_CONST(0.093130877450199795), + FRAC_CONST(0.096388642644287828), + FRAC_CONST(0.09964537559345106), + FRAC_CONST(0.1029010414206961), + FRAC_CONST(0.10615560526045748), + FRAC_CONST(0.10940903225897117), + FRAC_CONST(0.11266128757464781), + FRAC_CONST(0.11591233637844581), + FRAC_CONST(0.11916214385424433), + FRAC_CONST(0.1224106751992162), + FRAC_CONST(0.12565789562420052), + FRAC_CONST(0.12890377035407541), + FRAC_CONST(0.13214826462813015), + FRAC_CONST(0.13539134370043773), + FRAC_CONST(0.13863297284022669), + FRAC_CONST(0.14187311733225325), + FRAC_CONST(0.14511174247717309), + FRAC_CONST(0.14834881359191271), + FRAC_CONST(0.15158429601004111), + FRAC_CONST(0.15481815508214106), + FRAC_CONST(0.1580503561761798), + FRAC_CONST(0.16128086467788047), + FRAC_CONST(0.16450964599109233), + FRAC_CONST(0.16773666553816149), + FRAC_CONST(0.17096188876030122), + FRAC_CONST(0.17418528111796186), + FRAC_CONST(0.17740680809120093), + FRAC_CONST(0.18062643518005275), + FRAC_CONST(0.18384412790489776), + FRAC_CONST(0.18705985180683199), + FRAC_CONST(0.19027357244803589), + FRAC_CONST(0.19348525541214331), + FRAC_CONST(0.19669486630460997), + FRAC_CONST(0.19990237075308173), + FRAC_CONST(0.20310773440776286), + FRAC_CONST(0.20631092294178383), + FRAC_CONST(0.20951190205156878), + FRAC_CONST(0.21271063745720317), + FRAC_CONST(0.21590709490280058), + FRAC_CONST(0.2191012401568698), + FRAC_CONST(0.22229303901268133), + FRAC_CONST(0.22548245728863364), + FRAC_CONST(0.22866946082861941), + FRAC_CONST(0.23185401550239115), + FRAC_CONST(0.23503608720592667), + FRAC_CONST(0.23821564186179459), + FRAC_CONST(0.24139264541951888), + FRAC_CONST(0.24456706385594387), + FRAC_CONST(0.24773886317559846), + FRAC_CONST(0.25090800941106001), + FRAC_CONST(0.25407446862331851), + FRAC_CONST(0.25723820690213967), + FRAC_CONST(0.26039919036642817), + FRAC_CONST(0.26355738516459076), + FRAC_CONST(0.26671275747489837), + FRAC_CONST(0.2698652735058486), + FRAC_CONST(0.27301489949652735), + FRAC_CONST(0.27616160171697068), + FRAC_CONST(0.27930534646852595), + FRAC_CONST(0.28244610008421245), + FRAC_CONST(0.2855838289290823), + FRAC_CONST(0.28871849940058025), + FRAC_CONST(0.29185007792890405), + FRAC_CONST(0.29497853097736348), + FRAC_CONST(0.2981038250427398), + FRAC_CONST(0.30122592665564446), + FRAC_CONST(0.30434480238087736), + FRAC_CONST(0.30746041881778519), + FRAC_CONST(0.31057274260061901), + FRAC_CONST(0.31368174039889146), + FRAC_CONST(0.31678737891773395), + FRAC_CONST(0.31988962489825296), + FRAC_CONST(0.32298844511788638), + FRAC_CONST(0.32608380639075912), + FRAC_CONST(0.32917567556803889), + FRAC_CONST(0.33226401953829071), + FRAC_CONST(0.33534880522783189), + FRAC_CONST(0.33842999960108583), + FRAC_CONST(0.34150756966093632), + FRAC_CONST(0.34458148244908043), + FRAC_CONST(0.34765170504638188), + FRAC_CONST(0.35071820457322322), + FRAC_CONST(0.35378094818985806), + FRAC_CONST(0.35683990309676283), + FRAC_CONST(0.35989503653498811), + FRAC_CONST(0.36294631578650921), + FRAC_CONST(0.36599370817457672), + FRAC_CONST(0.36903718106406647), + FRAC_CONST(0.37207670186182878), + FRAC_CONST(0.37511223801703802), + FRAC_CONST(0.37814375702154046), + FRAC_CONST(0.38117122641020335), + FRAC_CONST(0.38419461376126157), + FRAC_CONST(0.38721388669666562), + FRAC_CONST(0.39022901288242801), + FRAC_CONST(0.39323996002896966), + FRAC_CONST(0.39624669589146555), + FRAC_CONST(0.39924918827019029), + FRAC_CONST(0.40224740501086254), + FRAC_CONST(0.40524131400498986), + FRAC_CONST(0.40823088319021217), + FRAC_CONST(0.41121608055064529), + FRAC_CONST(0.41419687411722372), + FRAC_CONST(0.41717323196804335), + FRAC_CONST(0.42014512222870243), + FRAC_CONST(0.42311251307264408), + FRAC_CONST(0.42607537272149631), + FRAC_CONST(0.4290336694454126), + FRAC_CONST(0.43198737156341183), + FRAC_CONST(0.43493644744371707), + FRAC_CONST(0.43788086550409511), + FRAC_CONST(0.44082059421219388), + FRAC_CONST(0.44375560208588088), + FRAC_CONST(0.44668585769357955), + FRAC_CONST(0.4496113296546066), + FRAC_CONST(0.45253198663950756), + FRAC_CONST(0.45544779737039259), + FRAC_CONST(0.45835873062127125), + FRAC_CONST(0.46126475521838717), + FRAC_CONST(0.46416584004055156), + FRAC_CONST(0.46706195401947659), + FRAC_CONST(0.46995306614010829), + FRAC_CONST(0.47283914544095862), + FRAC_CONST(0.47572016101443682), + FRAC_CONST(0.47859608200718085), + FRAC_CONST(0.4814668776203872), + FRAC_CONST(0.48433251711014125), + FRAC_CONST(0.4871929697877464), + FRAC_CONST(0.49004820502005247), + FRAC_CONST(0.49289819222978404), + FRAC_CONST(0.49574290089586776), + FRAC_CONST(0.49858230055375902), + FRAC_CONST(0.50141636079576901), + FRAC_CONST(0.50424505127138919), + FRAC_CONST(0.50706834168761705), + FRAC_CONST(0.50988620180928057), + FRAC_CONST(0.51269860145936175), + FRAC_CONST(0.51550551051931948), + FRAC_CONST(0.51830689892941317), + FRAC_CONST(0.5211027366890234), + FRAC_CONST(0.52389299385697385), + FRAC_CONST(0.52667764055185196), + FRAC_CONST(0.52945664695232897), + FRAC_CONST(0.53222998329747884), + FRAC_CONST(0.53499761988709726), + FRAC_CONST(0.53775952708201991), + FRAC_CONST(0.54051567530443978), + FRAC_CONST(0.54326603503822357), + FRAC_CONST(0.54601057682922816), + FRAC_CONST(0.54874927128561579), + FRAC_CONST(0.55148208907816942), + FRAC_CONST(0.55420900094060566), + FRAC_CONST(0.55692997766988939), + FRAC_CONST(0.559644990126546), + FRAC_CONST(0.56235400923497314), + FRAC_CONST(0.56505700598375252), + FRAC_CONST(0.56775395142596052), + FRAC_CONST(0.57044481667947822), + FRAC_CONST(0.57312957292730071), + FRAC_CONST(0.57580819141784534), + FRAC_CONST(0.57848064346525996), + FRAC_CONST(0.58114690044973039), + FRAC_CONST(0.58380693381778626), + FRAC_CONST(0.58646071508260733), + FRAC_CONST(0.58910821582432815), + FRAC_CONST(0.5917494076903429), + FRAC_CONST(0.5943842623956086), + FRAC_CONST(0.59701275172294799), + FRAC_CONST(0.59963484752335228), + FRAC_CONST(0.60225052171628191), + FRAC_CONST(0.60485974628996786), + FRAC_CONST(0.60746249330171098), + FRAC_CONST(0.61005873487818185), + FRAC_CONST(0.61264844321571899), + FRAC_CONST(0.61523159058062682), + FRAC_CONST(0.61780814930947225), + FRAC_CONST(0.62037809180938108), + FRAC_CONST(0.62294139055833397), + FRAC_CONST(0.6254980181054608), + FRAC_CONST(0.62804794707133416), + FRAC_CONST(0.63059115014826372), + FRAC_CONST(0.63312760010058777), + FRAC_CONST(0.63565726976496484), + FRAC_CONST(0.63818013205066515), + FRAC_CONST(0.64069615993986073), + FRAC_CONST(0.64320532648791406), + FRAC_CONST(0.64570760482366729), + FRAC_CONST(0.64820296814972966), + FRAC_CONST(0.65069138974276486), + FRAC_CONST(0.65317284295377676), + FRAC_CONST(0.65564730120839498), + FRAC_CONST(0.65811473800715958), + FRAC_CONST(0.660575126925805), + FRAC_CONST(0.66302844161554231), + FRAC_CONST(0.6654746558033422), + FRAC_CONST(0.66791374329221598), + FRAC_CONST(0.67034567796149647), + FRAC_CONST(0.67277043376711676), + FRAC_CONST(0.67518798474189046), + FRAC_CONST(0.67759830499578866), + FRAC_CONST(0.68000136871621808), + FRAC_CONST(0.68239715016829683), + FRAC_CONST(0.6847856236951303), + FRAC_CONST(0.68716676371808583), + FRAC_CONST(0.68954054473706683), + FRAC_CONST(0.69190694133078579), + FRAC_CONST(0.69426592815703603), + FRAC_CONST(0.69661747995296419), + FRAC_CONST(0.69896157153533944), + FRAC_CONST(0.70129817780082437), + FRAC_CONST(0.7036272737262429), + FRAC_CONST(0.70594883436884903), + FRAC_CONST(0.70826283486659336), + FRAC_CONST(0.71056925043838959), + FRAC_CONST(0.71286805638437978), + FRAC_CONST(0.71515922808619936), + FRAC_CONST(0.71744274100723993), + FRAC_CONST(0.71971857069291278), + FRAC_CONST(0.7219866927709101), + FRAC_CONST(0.72424708295146689), + FRAC_CONST(0.72649971702762028), + FRAC_CONST(0.72874457087546896), + FRAC_CONST(0.73098162045443171), + FRAC_CONST(0.73321084180750484), + FRAC_CONST(0.73543221106151868), + FRAC_CONST(0.73764570442739286), + FRAC_CONST(0.73985129820039208), + FRAC_CONST(0.74204896876037885), + FRAC_CONST(0.7442386925720671), + FRAC_CONST(0.74642044618527381), + FRAC_CONST(0.74859420623517081), + FRAC_CONST(0.75075994944253421), + FRAC_CONST(0.75291765261399446), + FRAC_CONST(0.75506729264228367), + FRAC_CONST(0.75720884650648446), + FRAC_CONST(0.75934229127227548), + FRAC_CONST(0.76146760409217706), + FRAC_CONST(0.76358476220579641), + FRAC_CONST(0.7656937429400712), + FRAC_CONST(0.76779452370951196), + FRAC_CONST(0.76988708201644451), + FRAC_CONST(0.77197139545125026), + FRAC_CONST(0.7740474416926072), + FRAC_CONST(0.77611519850772781), + FRAC_CONST(0.77817464375259782), + FRAC_CONST(0.78022575537221317), + FRAC_CONST(0.78226851140081632), + FRAC_CONST(0.78430288996213138), + FRAC_CONST(0.78632886926959822), + FRAC_CONST(0.78834642762660623), + FRAC_CONST(0.79035554342672631), + FRAC_CONST(0.79235619515394229), + FRAC_CONST(0.79434836138288134), + FRAC_CONST(0.79633202077904397), + FRAC_CONST(0.79830715209903147), + FRAC_CONST(0.8002737341907743), + FRAC_CONST(0.80223174599375802), + FRAC_CONST(0.80418116653924954), + FRAC_CONST(0.80612197495052085), + FRAC_CONST(0.80805415044307316), + FRAC_CONST(0.80997767232485907), + FRAC_CONST(0.81189251999650469), + FRAC_CONST(0.81379867295152986), + FRAC_CONST(0.81569611077656778), + FRAC_CONST(0.81758481315158371), + FRAC_CONST(0.81946475985009259), + FRAC_CONST(0.82133593073937561), + FRAC_CONST(0.82319830578069586), + FRAC_CONST(0.82505186502951278), + FRAC_CONST(0.82689658863569615), + FRAC_CONST(0.82873245684373809), + FRAC_CONST(0.83055944999296494), + FRAC_CONST(0.83237754851774781), + FRAC_CONST(0.83418673294771239), + FRAC_CONST(0.83598698390794668), + FRAC_CONST(0.83777828211920935), + FRAC_CONST(0.83956060839813562), + FRAC_CONST(0.84133394365744296), + FRAC_CONST(0.84309826890613537), + FRAC_CONST(0.84485356524970701), + FRAC_CONST(0.84659981389034411), + FRAC_CONST(0.84833699612712676), + FRAC_CONST(0.85006509335622882), + FRAC_CONST(0.8517840870711173), + FRAC_CONST(0.85349395886275037), + FRAC_CONST(0.85519469041977514), + FRAC_CONST(0.85688626352872277), + FRAC_CONST(0.85856866007420429), + FRAC_CONST(0.86024186203910447), + FRAC_CONST(0.86190585150477417), + FRAC_CONST(0.86356061065122347), + FRAC_CONST(0.86520612175731115), + FRAC_CONST(0.86684236720093533), + FRAC_CONST(0.86846932945922151), + FRAC_CONST(0.87008699110871135), + FRAC_CONST(0.87169533482554817), + FRAC_CONST(0.87329434338566281), + FRAC_CONST(0.87488399966495822), + FRAC_CONST(0.87646428663949283), + FRAC_CONST(0.87803518738566277), + FRAC_CONST(0.87959668508038291), + FRAC_CONST(0.88114876300126743), + FRAC_CONST(0.88269140452680916), + FRAC_CONST(0.8842245931365561), + FRAC_CONST(0.88574831241129048), + FRAC_CONST(0.88726254603320276), + FRAC_CONST(0.88876727778606746), + FRAC_CONST(0.89026249155541637), + FRAC_CONST(0.8917481713287112), + FRAC_CONST(0.89322430119551532), + FRAC_CONST(0.89469086534766362), + FRAC_CONST(0.89614784807943237), + FRAC_CONST(0.89759523378770689), + FRAC_CONST(0.89903300697214927), + FRAC_CONST(0.9004611522353636), + FRAC_CONST(0.90187965428306172), + FRAC_CONST(0.90328849792422594), + FRAC_CONST(0.90468766807127299), + FRAC_CONST(0.90607714974021469), + FRAC_CONST(0.90745692805081868), + FRAC_CONST(0.90882698822676755), + FRAC_CONST(0.91018731559581767), + FRAC_CONST(0.91153789558995579), + FRAC_CONST(0.91287871374555518), + FRAC_CONST(0.91420975570353069), + FRAC_CONST(0.9155310072094921), + FRAC_CONST(0.91684245411389753), + FRAC_CONST(0.91814408237220391), + FRAC_CONST(0.91943587804501858), + FRAC_CONST(0.92071782729824769), + FRAC_CONST(0.92198991640324446), + FRAC_CONST(0.92325213173695675), + FRAC_CONST(0.92450445978207241), + FRAC_CONST(0.92574688712716402), + FRAC_CONST(0.92697940046683291), + FRAC_CONST(0.92820198660185149), + FRAC_CONST(0.92941463243930444), + FRAC_CONST(0.93061732499272909), + FRAC_CONST(0.93181005138225426), + FRAC_CONST(0.93299279883473885), + FRAC_CONST(0.93416555468390772), + FRAC_CONST(0.93532830637048769), + FRAC_CONST(0.93648104144234268), + FRAC_CONST(0.93762374755460598), + FRAC_CONST(0.93875641246981323), + FRAC_CONST(0.93987902405803303), + FRAC_CONST(0.94099157029699743), + FRAC_CONST(0.94209403927222979), + FRAC_CONST(0.94318641917717327), + FRAC_CONST(0.9442686983133165), + FRAC_CONST(0.94534086509031956), + FRAC_CONST(0.9464029080261378), + FRAC_CONST(0.94745481574714419), + FRAC_CONST(0.94849657698825252), + FRAC_CONST(0.94952818059303667), + FRAC_CONST(0.95054961551385087), + FRAC_CONST(0.95156087081194762), + FRAC_CONST(0.95256193565759528), + FRAC_CONST(0.95355279933019343), + FRAC_CONST(0.9545334512183884), + FRAC_CONST(0.95550388082018611), + FRAC_CONST(0.95646407774306541), + FRAC_CONST(0.95741403170408834), + FRAC_CONST(0.95835373253001133), + FRAC_CONST(0.95928317015739362), + FRAC_CONST(0.96020233463270466), + FRAC_CONST(0.96111121611243155), + FRAC_CONST(0.96200980486318388), + FRAC_CONST(0.96289809126179782), + FRAC_CONST(0.96377606579543984), + FRAC_CONST(0.96464371906170809), + FRAC_CONST(0.96550104176873297), + FRAC_CONST(0.96634802473527726), + FRAC_CONST(0.96718465889083372), + FRAC_CONST(0.96801093527572268), + FRAC_CONST(0.96882684504118799), + FRAC_CONST(0.96963237944949143), + FRAC_CONST(0.97042752987400682), + FRAC_CONST(0.97121228779931179), + FRAC_CONST(0.97198664482127939), + FRAC_CONST(0.97275059264716823), + FRAC_CONST(0.97350412309571066), + FRAC_CONST(0.97424722809720088), + FRAC_CONST(0.97497989969358168), + FRAC_CONST(0.97570213003852857), + FRAC_CONST(0.97641391139753486), + FRAC_CONST(0.97711523614799412), + FRAC_CONST(0.97780609677928154), + FRAC_CONST(0.97848648589283505), + FRAC_CONST(0.97915639620223371), + FRAC_CONST(0.9798158205332762), + FRAC_CONST(0.98046475182405801), + FRAC_CONST(0.98110318312504607), + FRAC_CONST(0.98173110759915416), + FRAC_CONST(0.98234851852181571), + FRAC_CONST(0.98295540928105563), + FRAC_CONST(0.9835517733775615), + FRAC_CONST(0.98413760442475307), + FRAC_CONST(0.98471289614885038), + FRAC_CONST(0.98527764238894122), + FRAC_CONST(0.98583183709704714), + FRAC_CONST(0.98637547433818806), + FRAC_CONST(0.98690854829044583), + FRAC_CONST(0.98743105324502667), + FRAC_CONST(0.98794298360632238), + FRAC_CONST(0.98844433389196995), + FRAC_CONST(0.98893509873291074), + FRAC_CONST(0.98941527287344755), + FRAC_CONST(0.98988485117130098), + FRAC_CONST(0.99034382859766479), + FRAC_CONST(0.99079220023725967), + FRAC_CONST(0.99122996128838525), + FRAC_CONST(0.9916571070629725), + FRAC_CONST(0.99207363298663342), + FRAC_CONST(0.99247953459870997), + FRAC_CONST(0.99287480755232194), + FRAC_CONST(0.99325944761441354), + FRAC_CONST(0.99363345066579889), + FRAC_CONST(0.99399681270120555), + FRAC_CONST(0.99434952982931812), + FRAC_CONST(0.9946915982728195), + FRAC_CONST(0.99502301436843166), + FRAC_CONST(0.99534377456695422), + FRAC_CONST(0.9956538754333033), + FRAC_CONST(0.99595331364654771), + FRAC_CONST(0.99624208599994479), + FRAC_CONST(0.99652018940097464), + FRAC_CONST(0.99678762087137318), + FRAC_CONST(0.99704437754716424), + FRAC_CONST(0.99729045667869021), + FRAC_CONST(0.99752585563064111), + FRAC_CONST(0.99775057188208349), + FRAC_CONST(0.9979646030264866), + FRAC_CONST(0.99816794677174903), + FRAC_CONST(0.9983606009402225), + FRAC_CONST(0.99854256346873571), + FRAC_CONST(0.99871383240861611), + FRAC_CONST(0.99887440592571108), + FRAC_CONST(0.99902428230040718), + FRAC_CONST(0.99916345992764877), + FRAC_CONST(0.99929193731695531), + FRAC_CONST(0.99940971309243731), + FRAC_CONST(0.99951678599281069), + FRAC_CONST(0.99961315487141078), + FRAC_CONST(0.99969881869620425), + FRAC_CONST(0.99977377654980037), + FRAC_CONST(0.99983802762946083), + FRAC_CONST(0.99989157124710804), + FRAC_CONST(0.9999344068293331), + FRAC_CONST(0.99996653391740109), + FRAC_CONST(0.99998795216725689), + FRAC_CONST(0.99999866134952808) +}; +#endif + +ALIGN static const real_t ld_mid_512[] = +{ + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0.0061358846491544753), + FRAC_CONST(0.01840672990580482), + FRAC_CONST(0.030674803176636626), + FRAC_CONST(0.04293825693494082), + FRAC_CONST(0.055195244349689934), + FRAC_CONST(0.067443919563664051), + FRAC_CONST(0.079682437971430126), + FRAC_CONST(0.091908956497132724), + FRAC_CONST(0.10412163387205459), + FRAC_CONST(0.11631863091190475), + FRAC_CONST(0.12849811079379317), + FRAC_CONST(0.14065823933284921), + FRAC_CONST(0.15279718525844344), + FRAC_CONST(0.16491312048996989), + FRAC_CONST(0.17700422041214875), + FRAC_CONST(0.18906866414980619), + FRAC_CONST(0.2011046348420919), + FRAC_CONST(0.21311031991609136), + FRAC_CONST(0.22508391135979283), + FRAC_CONST(0.2370236059943672), + FRAC_CONST(0.24892760574572015), + FRAC_CONST(0.26079411791527551), + FRAC_CONST(0.27262135544994898), + FRAC_CONST(0.28440753721127188), + FRAC_CONST(0.29615088824362379), + FRAC_CONST(0.30784964004153487), + FRAC_CONST(0.31950203081601569), + FRAC_CONST(0.33110630575987643), + FRAC_CONST(0.34266071731199438), + FRAC_CONST(0.35416352542049034), + FRAC_CONST(0.36561299780477385), + FRAC_CONST(0.37700741021641826), + FRAC_CONST(0.38834504669882625), + FRAC_CONST(0.39962419984564679), + FRAC_CONST(0.41084317105790391), + FRAC_CONST(0.42200027079979968), + FRAC_CONST(0.43309381885315196), + FRAC_CONST(0.4441221445704292), + FRAC_CONST(0.45508358712634384), + FRAC_CONST(0.46597649576796618), + FRAC_CONST(0.47679923006332209), + FRAC_CONST(0.487550160148436), + FRAC_CONST(0.49822766697278187), + FRAC_CONST(0.50883014254310699), + FRAC_CONST(0.51935599016558964), + FRAC_CONST(0.52980362468629461), + FRAC_CONST(0.54017147272989285), + FRAC_CONST(0.55045797293660481), + FRAC_CONST(0.56066157619733603), + FRAC_CONST(0.57078074588696726), + FRAC_CONST(0.58081395809576453), + FRAC_CONST(0.59075970185887416), + FRAC_CONST(0.60061647938386897), + FRAC_CONST(0.61038280627630948), + FRAC_CONST(0.6200572117632891), + FRAC_CONST(0.62963823891492698), + FRAC_CONST(0.63912444486377573), + FRAC_CONST(0.64851440102211244), + FRAC_CONST(0.65780669329707864), + FRAC_CONST(0.66699992230363747), + FRAC_CONST(0.67609270357531592), + FRAC_CONST(0.68508366777270036), + FRAC_CONST(0.693971460889654), + FRAC_CONST(0.7027547444572253), + FRAC_CONST(0.71143219574521643), + FRAC_CONST(0.72000250796138165), + FRAC_CONST(0.7284643904482252), + FRAC_CONST(0.73681656887736979), + FRAC_CONST(0.74505778544146595), + FRAC_CONST(0.75318679904361241), + FRAC_CONST(0.76120238548426178), + FRAC_CONST(0.76910333764557959), + FRAC_CONST(0.77688846567323244), + FRAC_CONST(0.78455659715557524), + FRAC_CONST(0.79210657730021239), + FRAC_CONST(0.79953726910790501), + FRAC_CONST(0.80684755354379922), + FRAC_CONST(0.8140363297059483), + FRAC_CONST(0.82110251499110465), + FRAC_CONST(0.8280450452577558), + FRAC_CONST(0.83486287498638001), + FRAC_CONST(0.84155497743689833), + FRAC_CONST(0.84812034480329712), + FRAC_CONST(0.85455798836540053), + FRAC_CONST(0.86086693863776731), + FRAC_CONST(0.86704624551569265), + FRAC_CONST(0.87309497841829009), + FRAC_CONST(0.87901222642863341), + FRAC_CONST(0.88479709843093779), + FRAC_CONST(0.89044872324475788), + FRAC_CONST(0.89596624975618511), + FRAC_CONST(0.90134884704602203), + FRAC_CONST(0.90659570451491533), + FRAC_CONST(0.91170603200542988), + FRAC_CONST(0.9166790599210427), + FRAC_CONST(0.9215140393420419), + FRAC_CONST(0.92621024213831127), + FRAC_CONST(0.93076696107898371), + FRAC_CONST(0.9351835099389475), + FRAC_CONST(0.93945922360218992), + FRAC_CONST(0.94359345816196039), + FRAC_CONST(0.94758559101774109), + FRAC_CONST(0.95143502096900834), + FRAC_CONST(0.95514116830577067), + FRAC_CONST(0.9587034748958716), + FRAC_CONST(0.96212140426904158), + FRAC_CONST(0.9653944416976894), + FRAC_CONST(0.96852209427441727), + FRAC_CONST(0.97150389098625178), + FRAC_CONST(0.97433938278557586), + FRAC_CONST(0.97702814265775439), + FRAC_CONST(0.97956976568544052), + FRAC_CONST(0.98196386910955524), + FRAC_CONST(0.98421009238692903), + FRAC_CONST(0.98630809724459867), + FRAC_CONST(0.98825756773074946), + FRAC_CONST(0.99005821026229712), + FRAC_CONST(0.99170975366909953), + FRAC_CONST(0.9932119492347945), + FRAC_CONST(0.99456457073425542), + FRAC_CONST(0.99576741446765982), + FRAC_CONST(0.99682029929116567), + FRAC_CONST(0.99772306664419164), + FRAC_CONST(0.99847558057329477), + FRAC_CONST(0.99907772775264536), + FRAC_CONST(0.99952941750109314), + FRAC_CONST(0.9998305817958234), + FRAC_CONST(0.99998117528260111), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1) +}; + +#ifdef ALLOW_SMALL_FRAMELENGTH +ALIGN static const real_t ld_mid_480[] = +{ + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0), + FRAC_CONST(0.0065449379673518581), + FRAC_CONST(0.019633692460628301), + FRAC_CONST(0.032719082821776137), + FRAC_CONST(0.045798866936520771), + FRAC_CONST(0.058870803651189033), + FRAC_CONST(0.071932653156719387), + FRAC_CONST(0.084982177372441667), + FRAC_CONST(0.09801714032956059), + FRAC_CONST(0.11103530855427769), + FRAC_CONST(0.12403445145048532), + FRAC_CONST(0.13701234168196802), + FRAC_CONST(0.14996675555404498), + FRAC_CONST(0.16289547339458874), + FRAC_CONST(0.17579627993435451), + FRAC_CONST(0.18866696468655525), + FRAC_CONST(0.2015053223256171), + FRAC_CONST(0.21430915306505074), + FRAC_CONST(0.2270762630343732), + FRAC_CONST(0.23980446465501654), + FRAC_CONST(0.25249157701515795), + FRAC_CONST(0.26513542624340797), + FRAC_CONST(0.27773384588129219), + FRAC_CONST(0.29028467725446233), + FRAC_CONST(0.3027857698425746), + FRAC_CONST(0.31523498164776964), + FRAC_CONST(0.32763017956169349), + FRAC_CONST(0.33996923973099424), + FRAC_CONST(0.35225004792123354), + FRAC_CONST(0.36447049987914965), + FRAC_CONST(0.37662850169321077), + FRAC_CONST(0.38872197015239557), + FRAC_CONST(0.40074883310314097), + FRAC_CONST(0.41270702980439467), + FRAC_CONST(0.42459451128071307), + FRAC_CONST(0.43640924067334208), + FRAC_CONST(0.44814919358922256), + FRAC_CONST(0.45981235844785984), + FRAC_CONST(0.47139673682599764), + FRAC_CONST(0.48290034380003727), + FRAC_CONST(0.49432120828614462), + FRAC_CONST(0.50565737337798455), + FRAC_CONST(0.51690689668202761), + FRAC_CONST(0.52806785065036799), + FRAC_CONST(0.53913832291100017), + FRAC_CONST(0.55011641659549337), + FRAC_CONST(0.56100025066400983), + FRAC_CONST(0.57178796022761225), + FRAC_CONST(0.58247769686780215), + FRAC_CONST(0.59306762895323706), + FRAC_CONST(0.60355594195357143), + FRAC_CONST(0.61394083875036642), + FRAC_CONST(0.62422053994501758), + FRAC_CONST(0.63439328416364549), + FRAC_CONST(0.64445732835889735), + FRAC_CONST(0.65441094810861034), + FRAC_CONST(0.66425243791128175), + FRAC_CONST(0.67398011147829784), + FRAC_CONST(0.68359230202287125), + FRAC_CONST(0.69308736254563585), + FRAC_CONST(0.70246366611685174), + FRAC_CONST(0.71171960615517138), + FRAC_CONST(0.72085359670291882), + FRAC_CONST(0.7298640726978356), + FRAC_CONST(0.73874949024124625), + FRAC_CONST(0.74750832686259672), + FRAC_CONST(0.75613908178032285), + FRAC_CONST(0.76464027615900032), + FRAC_CONST(0.77301045336273699), + FRAC_CONST(0.78124817920475853), + FRAC_CONST(0.78935204219315003), + FRAC_CONST(0.79732065377270711), + FRAC_CONST(0.80515264856285829), + FRAC_CONST(0.81284668459161513), + FRAC_CONST(0.82040144352551359), + FRAC_CONST(0.82781563089550203), + FRAC_CONST(0.83508797631874299), + FRAC_CONST(0.84221723371628654), + FRAC_CONST(0.84920218152657889), + FRAC_CONST(0.85604162291477137), + FRAC_CONST(0.86273438597779184), + FRAC_CONST(0.86927932394514362), + FRAC_CONST(0.87567531537539967), + FRAC_CONST(0.88192126434835494), + FRAC_CONST(0.88801610065280734), + FRAC_CONST(0.89395877996993212), + FRAC_CONST(0.8997482840522214), + FRAC_CONST(0.90538362089795521), + FRAC_CONST(0.91086382492117568), + FRAC_CONST(0.91618795711713596), + FRAC_CONST(0.92135510522319242), + FRAC_CONST(0.9263643838751181), + FRAC_CONST(0.93121493475880346), + FRAC_CONST(0.93590592675732565), + FRAC_CONST(0.94043655609335486), + FRAC_CONST(0.94480604646687805), + FRAC_CONST(0.94901364918821385), + FRAC_CONST(0.95305864330629697), + FRAC_CONST(0.95694033573220882), + FRAC_CONST(0.9606580613579353), + FRAC_CONST(0.96421118317032928), + FRAC_CONST(0.96759909236025976), + FRAC_CONST(0.9708212084269281), + FRAC_CONST(0.97387697927733363), + FRAC_CONST(0.97676588132087239), + FRAC_CONST(0.97948741955905139), + FRAC_CONST(0.98204112767030394), + FRAC_CONST(0.98442656808989171), + FRAC_CONST(0.98664333208487898), + FRAC_CONST(0.98869103982416728), + FRAC_CONST(0.99056934044357725), + FRAC_CONST(0.99227791210596705), + FRAC_CONST(0.99381646205637808), + FRAC_CONST(0.99518472667219682), + FRAC_CONST(0.99638247150832537), + FRAC_CONST(0.99740949133735191), + FRAC_CONST(0.99826561018471593), + FRAC_CONST(0.99895068135886012), + FRAC_CONST(0.99946458747636568), + FRAC_CONST(0.99980724048206482), + FRAC_CONST(0.99997858166412923), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1), + FRAC_CONST(1) +}; +#endif +#endif + +#ifdef __cplusplus +} +#endif +#endif diff --git a/Libraries/FAAD2/Files/libfaad/specrec.c b/Libraries/FAAD2/Files/libfaad/specrec.c new file mode 100644 index 000000000..a452fbd90 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/specrec.c @@ -0,0 +1,1272 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +/* + Spectral reconstruction: + - grouping/sectioning + - inverse quantization + - applying scalefactors +*/ + +#include "common.h" +#include "structs.h" + +#include +#include +#include "specrec.h" +#include "filtbank.h" +#include "syntax.h" +#include "iq_table.h" +#include "ms.h" +#include "is.h" +#include "pns.h" +#include "tns.h" +#include "drc.h" +#include "lt_predict.h" +#include "ic_predict.h" +#ifdef SSR_DEC +#include "ssr.h" +#include "ssr_fb.h" +#endif + + +/* static function declarations */ +static uint8_t quant_to_spec(NeAACDecHandle hDecoder, + ic_stream *ics, int16_t *quant_data, + real_t *spec_data, uint16_t frame_len); + + +#ifdef LD_DEC +ALIGN static const uint8_t num_swb_512_window[] = +{ + 0, 0, 0, 36, 36, 37, 31, 31, 0, 0, 0, 0 +}; +ALIGN static const uint8_t num_swb_480_window[] = +{ + 0, 0, 0, 35, 35, 37, 30, 30, 0, 0, 0, 0 +}; +#endif + +ALIGN static const uint8_t num_swb_960_window[] = +{ + 40, 40, 45, 49, 49, 49, 46, 46, 42, 42, 42, 40 +}; + +ALIGN static const uint8_t num_swb_1024_window[] = +{ + 41, 41, 47, 49, 49, 51, 47, 47, 43, 43, 43, 40 +}; + +ALIGN static const uint8_t num_swb_128_window[] = +{ + 12, 12, 12, 14, 14, 14, 15, 15, 15, 15, 15, 15 +}; + +ALIGN static const uint16_t swb_offset_1024_96[] = +{ + 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, + 64, 72, 80, 88, 96, 108, 120, 132, 144, 156, 172, 188, 212, 240, + 276, 320, 384, 448, 512, 576, 640, 704, 768, 832, 896, 960, 1024 +}; + +ALIGN static const uint16_t swb_offset_128_96[] = +{ + 0, 4, 8, 12, 16, 20, 24, 32, 40, 48, 64, 92, 128 +}; + +ALIGN static const uint16_t swb_offset_1024_64[] = +{ + 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, + 64, 72, 80, 88, 100, 112, 124, 140, 156, 172, 192, 216, 240, 268, + 304, 344, 384, 424, 464, 504, 544, 584, 624, 664, 704, 744, 784, 824, + 864, 904, 944, 984, 1024 +}; + +ALIGN static const uint16_t swb_offset_128_64[] = +{ + 0, 4, 8, 12, 16, 20, 24, 32, 40, 48, 64, 92, 128 +}; + +ALIGN static const uint16_t swb_offset_1024_48[] = +{ + 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 48, 56, 64, 72, + 80, 88, 96, 108, 120, 132, 144, 160, 176, 196, 216, 240, 264, 292, + 320, 352, 384, 416, 448, 480, 512, 544, 576, 608, 640, 672, 704, 736, + 768, 800, 832, 864, 896, 928, 1024 +}; + +#ifdef LD_DEC +ALIGN static const uint16_t swb_offset_512_48[] = +{ + 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 68, 76, 84, + 92, 100, 112, 124, 136, 148, 164, 184, 208, 236, 268, 300, 332, 364, 396, + 428, 460, 512 +}; + +ALIGN static const uint16_t swb_offset_480_48[] = +{ + 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 64, 72 ,80 ,88, + 96, 108, 120, 132, 144, 156, 172, 188, 212, 240, 272, 304, 336, 368, 400, + 432, 480 +}; +#endif + +ALIGN static const uint16_t swb_offset_128_48[] = +{ + 0, 4, 8, 12, 16, 20, 28, 36, 44, 56, 68, 80, 96, 112, 128 +}; + +ALIGN static const uint16_t swb_offset_1024_32[] = +{ + 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 48, 56, 64, 72, + 80, 88, 96, 108, 120, 132, 144, 160, 176, 196, 216, 240, 264, 292, + 320, 352, 384, 416, 448, 480, 512, 544, 576, 608, 640, 672, 704, 736, + 768, 800, 832, 864, 896, 928, 960, 992, 1024 +}; + +#ifdef LD_DEC +ALIGN static const uint16_t swb_offset_512_32[] = +{ + 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 64, 72, 80, + 88, 96, 108, 120, 132, 144, 160, 176, 192, 212, 236, 260, 288, 320, 352, + 384, 416, 448, 480, 512 +}; + +ALIGN static const uint16_t swb_offset_480_32[] = +{ + 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 72, 80, + 88, 96, 104, 112, 124, 136, 148, 164, 180, 200, 224, 256, 288, 320, 352, + 384, 416, 448, 480 +}; +#endif + +ALIGN static const uint16_t swb_offset_1024_24[] = +{ + 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 52, 60, 68, + 76, 84, 92, 100, 108, 116, 124, 136, 148, 160, 172, 188, 204, 220, + 240, 260, 284, 308, 336, 364, 396, 432, 468, 508, 552, 600, 652, 704, + 768, 832, 896, 960, 1024 +}; + +#ifdef LD_DEC +ALIGN static const uint16_t swb_offset_512_24[] = +{ + 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 52, 60, 68, + 80, 92, 104, 120, 140, 164, 192, 224, 256, 288, 320, 352, 384, 416, + 448, 480, 512 +}; + +ALIGN static const uint16_t swb_offset_480_24[] = +{ + 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 52, 60, 68, 80, 92, 104, 120, + 140, 164, 192, 224, 256, 288, 320, 352, 384, 416, 448, 480 +}; +#endif + +ALIGN static const uint16_t swb_offset_128_24[] = +{ + 0, 4, 8, 12, 16, 20, 24, 28, 36, 44, 52, 64, 76, 92, 108, 128 +}; + +ALIGN static const uint16_t swb_offset_1024_16[] = +{ + 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 100, 112, 124, + 136, 148, 160, 172, 184, 196, 212, 228, 244, 260, 280, 300, 320, 344, + 368, 396, 424, 456, 492, 532, 572, 616, 664, 716, 772, 832, 896, 960, 1024 +}; + +ALIGN static const uint16_t swb_offset_128_16[] = +{ + 0, 4, 8, 12, 16, 20, 24, 28, 32, 40, 48, 60, 72, 88, 108, 128 +}; + +ALIGN static const uint16_t swb_offset_1024_8[] = +{ + 0, 12, 24, 36, 48, 60, 72, 84, 96, 108, 120, 132, 144, 156, 172, + 188, 204, 220, 236, 252, 268, 288, 308, 328, 348, 372, 396, 420, 448, + 476, 508, 544, 580, 620, 664, 712, 764, 820, 880, 944, 1024 +}; + +ALIGN static const uint16_t swb_offset_128_8[] = +{ + 0, 4, 8, 12, 16, 20, 24, 28, 36, 44, 52, 60, 72, 88, 108, 128 +}; + +ALIGN static const uint16_t *swb_offset_1024_window[] = +{ + swb_offset_1024_96, /* 96000 */ + swb_offset_1024_96, /* 88200 */ + swb_offset_1024_64, /* 64000 */ + swb_offset_1024_48, /* 48000 */ + swb_offset_1024_48, /* 44100 */ + swb_offset_1024_32, /* 32000 */ + swb_offset_1024_24, /* 24000 */ + swb_offset_1024_24, /* 22050 */ + swb_offset_1024_16, /* 16000 */ + swb_offset_1024_16, /* 12000 */ + swb_offset_1024_16, /* 11025 */ + swb_offset_1024_8 /* 8000 */ +}; + +#ifdef LD_DEC +ALIGN static const uint16_t *swb_offset_512_window[] = +{ + 0, /* 96000 */ + 0, /* 88200 */ + 0, /* 64000 */ + swb_offset_512_48, /* 48000 */ + swb_offset_512_48, /* 44100 */ + swb_offset_512_32, /* 32000 */ + swb_offset_512_24, /* 24000 */ + swb_offset_512_24, /* 22050 */ + 0, /* 16000 */ + 0, /* 12000 */ + 0, /* 11025 */ + 0 /* 8000 */ +}; + +ALIGN static const uint16_t *swb_offset_480_window[] = +{ + 0, /* 96000 */ + 0, /* 88200 */ + 0, /* 64000 */ + swb_offset_480_48, /* 48000 */ + swb_offset_480_48, /* 44100 */ + swb_offset_480_32, /* 32000 */ + swb_offset_480_24, /* 24000 */ + swb_offset_480_24, /* 22050 */ + 0, /* 16000 */ + 0, /* 12000 */ + 0, /* 11025 */ + 0 /* 8000 */ +}; +#endif + +ALIGN static const uint16_t *swb_offset_128_window[] = +{ + swb_offset_128_96, /* 96000 */ + swb_offset_128_96, /* 88200 */ + swb_offset_128_64, /* 64000 */ + swb_offset_128_48, /* 48000 */ + swb_offset_128_48, /* 44100 */ + swb_offset_128_48, /* 32000 */ + swb_offset_128_24, /* 24000 */ + swb_offset_128_24, /* 22050 */ + swb_offset_128_16, /* 16000 */ + swb_offset_128_16, /* 12000 */ + swb_offset_128_16, /* 11025 */ + swb_offset_128_8 /* 8000 */ +}; + +#define bit_set(A, B) ((A) & (1<<(B))) + +/* 4.5.2.3.4 */ +/* + - determine the number of windows in a window_sequence named num_windows + - determine the number of window_groups named num_window_groups + - determine the number of windows in each group named window_group_length[g] + - determine the total number of scalefactor window bands named num_swb for + the actual window type + - determine swb_offset[swb], the offset of the first coefficient in + scalefactor window band named swb of the window actually used + - determine sect_sfb_offset[g][section],the offset of the first coefficient + in section named section. This offset depends on window_sequence and + scale_factor_grouping and is needed to decode the spectral_data(). +*/ +uint8_t window_grouping_info(NeAACDecHandle hDecoder, ic_stream *ics) +{ + uint8_t i, g; + + uint8_t sf_index = hDecoder->sf_index; + + switch (ics->window_sequence) { + case ONLY_LONG_SEQUENCE: + case LONG_START_SEQUENCE: + case LONG_STOP_SEQUENCE: + ics->num_windows = 1; + ics->num_window_groups = 1; + ics->window_group_length[ics->num_window_groups-1] = 1; +#ifdef LD_DEC + if (hDecoder->object_type == LD) + { + if (hDecoder->frameLength == 512) + ics->num_swb = num_swb_512_window[sf_index]; + else /* if (hDecoder->frameLength == 480) */ + ics->num_swb = num_swb_480_window[sf_index]; + } else { +#endif + if (hDecoder->frameLength == 1024) + ics->num_swb = num_swb_1024_window[sf_index]; + else /* if (hDecoder->frameLength == 960) */ + ics->num_swb = num_swb_960_window[sf_index]; +#ifdef LD_DEC + } +#endif + + /* preparation of sect_sfb_offset for long blocks */ + /* also copy the last value! */ +#ifdef LD_DEC + if (hDecoder->object_type == LD) + { + if (hDecoder->frameLength == 512) + { + for (i = 0; i < ics->num_swb; i++) + { + ics->sect_sfb_offset[0][i] = swb_offset_512_window[sf_index][i]; + ics->swb_offset[i] = swb_offset_512_window[sf_index][i]; + } + } else /* if (hDecoder->frameLength == 480) */ { + for (i = 0; i < ics->num_swb; i++) + { + ics->sect_sfb_offset[0][i] = swb_offset_480_window[sf_index][i]; + ics->swb_offset[i] = swb_offset_480_window[sf_index][i]; + } + } + ics->sect_sfb_offset[0][ics->num_swb] = hDecoder->frameLength; + ics->swb_offset[ics->num_swb] = hDecoder->frameLength; + } else { +#endif + for (i = 0; i < ics->num_swb; i++) + { + ics->sect_sfb_offset[0][i] = swb_offset_1024_window[sf_index][i]; + ics->swb_offset[i] = swb_offset_1024_window[sf_index][i]; + } + ics->sect_sfb_offset[0][ics->num_swb] = hDecoder->frameLength; + ics->swb_offset[ics->num_swb] = hDecoder->frameLength; +#ifdef LD_DEC + } +#endif + return 0; + case EIGHT_SHORT_SEQUENCE: + ics->num_windows = 8; + ics->num_window_groups = 1; + ics->window_group_length[ics->num_window_groups-1] = 1; + ics->num_swb = num_swb_128_window[sf_index]; + + for (i = 0; i < ics->num_swb; i++) + ics->swb_offset[i] = swb_offset_128_window[sf_index][i]; + ics->swb_offset[ics->num_swb] = hDecoder->frameLength/8; + + for (i = 0; i < ics->num_windows-1; i++) { + if (bit_set(ics->scale_factor_grouping, 6-i) == 0) + { + ics->num_window_groups += 1; + ics->window_group_length[ics->num_window_groups-1] = 1; + } else { + ics->window_group_length[ics->num_window_groups-1] += 1; + } + } + + /* preparation of sect_sfb_offset for short blocks */ + for (g = 0; g < ics->num_window_groups; g++) + { + uint16_t width; + uint8_t sect_sfb = 0; + uint16_t offset = 0; + + for (i = 0; i < ics->num_swb; i++) + { + if (i+1 == ics->num_swb) + { + width = (hDecoder->frameLength/8) - swb_offset_128_window[sf_index][i]; + } else { + width = swb_offset_128_window[sf_index][i+1] - + swb_offset_128_window[sf_index][i]; + } + width *= ics->window_group_length[g]; + ics->sect_sfb_offset[g][sect_sfb++] = offset; + offset += width; + } + ics->sect_sfb_offset[g][sect_sfb] = offset; + } + return 0; + default: + return 1; + } +} + +/* iquant() * +/* output = sign(input)*abs(input)^(4/3) */ +/**/ +static INLINE real_t iquant(int16_t q, const real_t *tab, uint8_t *error) +{ +#ifdef FIXED_POINT +/* For FIXED_POINT the iq_table is prescaled by 3 bits (iq_table[]/8) */ +/* BIG_IQ_TABLE allows you to use the full 8192 value table, if this is not + * defined a 1026 value table and interpolation will be used + */ +#ifndef BIG_IQ_TABLE + static const real_t errcorr[] = { + REAL_CONST(0), REAL_CONST(1.0/8.0), REAL_CONST(2.0/8.0), REAL_CONST(3.0/8.0), + REAL_CONST(4.0/8.0), REAL_CONST(5.0/8.0), REAL_CONST(6.0/8.0), REAL_CONST(7.0/8.0), + REAL_CONST(0) + }; + real_t x1, x2; +#endif + int16_t sgn = 1; + + if (q < 0) + { + q = -q; + sgn = -1; + } + + if (q < IQ_TABLE_SIZE) + { +//#define IQUANT_PRINT +#ifdef IQUANT_PRINT + //printf("0x%.8X\n", sgn * tab[q]); + printf("%d\n", sgn * tab[q]); +#endif + return sgn * tab[q]; + } + +#ifndef BIG_IQ_TABLE + if (q >= 8192) + { + *error = 17; + return 0; + } + + /* linear interpolation */ + x1 = tab[q>>3]; + x2 = tab[(q>>3) + 1]; + return sgn * 16 * (MUL_R(errcorr[q&7],(x2-x1)) + x1); +#else + *error = 17; + return 0; +#endif + +#else + if (q < 0) + { + /* tab contains a value for all possible q [0,8192] */ + if (-q < IQ_TABLE_SIZE) + return -tab[-q]; + + *error = 17; + return 0; + } else { + /* tab contains a value for all possible q [0,8192] */ + if (q < IQ_TABLE_SIZE) + return tab[q]; + + *error = 17; + return 0; + } +#endif +} + +#ifndef FIXED_POINT +ALIGN static const real_t pow2sf_tab[] = { + 2.9802322387695313E-008, 5.9604644775390625E-008, 1.1920928955078125E-007, + 2.384185791015625E-007, 4.76837158203125E-007, 9.5367431640625E-007, + 1.9073486328125E-006, 3.814697265625E-006, 7.62939453125E-006, + 1.52587890625E-005, 3.0517578125E-005, 6.103515625E-005, + 0.0001220703125, 0.000244140625, 0.00048828125, + 0.0009765625, 0.001953125, 0.00390625, + 0.0078125, 0.015625, 0.03125, + 0.0625, 0.125, 0.25, + 0.5, 1.0, 2.0, + 4.0, 8.0, 16.0, 32.0, + 64.0, 128.0, 256.0, + 512.0, 1024.0, 2048.0, + 4096.0, 8192.0, 16384.0, + 32768.0, 65536.0, 131072.0, + 262144.0, 524288.0, 1048576.0, + 2097152.0, 4194304.0, 8388608.0, + 16777216.0, 33554432.0, 67108864.0, + 134217728.0, 268435456.0, 536870912.0, + 1073741824.0, 2147483648.0, 4294967296.0, + 8589934592.0, 17179869184.0, 34359738368.0, + 68719476736.0, 137438953472.0, 274877906944.0 +}; +#endif + +/* quant_to_spec: perform dequantisation and scaling + * and in case of short block it also does the deinterleaving + */ +/* + For ONLY_LONG_SEQUENCE windows (num_window_groups = 1, + window_group_length[0] = 1) the spectral data is in ascending spectral + order. + For the EIGHT_SHORT_SEQUENCE window, the spectral order depends on the + grouping in the following manner: + - Groups are ordered sequentially + - Within a group, a scalefactor band consists of the spectral data of all + grouped SHORT_WINDOWs for the associated scalefactor window band. To + clarify via example, the length of a group is in the range of one to eight + SHORT_WINDOWs. + - If there are eight groups each with length one (num_window_groups = 8, + window_group_length[0..7] = 1), the result is a sequence of eight spectra, + each in ascending spectral order. + - If there is only one group with length eight (num_window_groups = 1, + window_group_length[0] = 8), the result is that spectral data of all eight + SHORT_WINDOWs is interleaved by scalefactor window bands. + - Within a scalefactor window band, the coefficients are in ascending + spectral order. +*/ +static uint8_t quant_to_spec(NeAACDecHandle hDecoder, + ic_stream *ics, int16_t *quant_data, + real_t *spec_data, uint16_t frame_len) +{ + ALIGN static const real_t pow2_table[] = + { + COEF_CONST(1.0), + COEF_CONST(1.1892071150027210667174999705605), /* 2^0.25 */ + COEF_CONST(1.4142135623730950488016887242097), /* 2^0.5 */ + COEF_CONST(1.6817928305074290860622509524664) /* 2^0.75 */ + }; + const real_t *tab = iq_table; + + uint8_t g, sfb, win; + uint16_t width, bin, k, gindex, wa, wb; + uint8_t error = 0; /* Init error flag */ +#ifndef FIXED_POINT + real_t scf; +#endif + + k = 0; + gindex = 0; + + for (g = 0; g < ics->num_window_groups; g++) + { + uint16_t j = 0; + uint16_t gincrease = 0; + uint16_t win_inc = ics->swb_offset[ics->num_swb]; + + for (sfb = 0; sfb < ics->num_swb; sfb++) + { + int32_t exp, frac; + + width = ics->swb_offset[sfb+1] - ics->swb_offset[sfb]; + + /* this could be scalefactor for IS or PNS, those can be negative or bigger then 255 */ + /* just ignore them */ + if (ics->scale_factors[g][sfb] < 0 || ics->scale_factors[g][sfb] > 255) + { + exp = 0; + frac = 0; + } else { + /* ics->scale_factors[g][sfb] must be between 0 and 255 */ + exp = (ics->scale_factors[g][sfb] /* - 100 */) >> 2; + /* frac must always be > 0 */ + frac = (ics->scale_factors[g][sfb] /* - 100 */) & 3; + } + +#ifdef FIXED_POINT + exp -= 25; + /* IMDCT pre-scaling */ + if (hDecoder->object_type == LD) + { + exp -= 6 /*9*/; + } else { + if (ics->window_sequence == EIGHT_SHORT_SEQUENCE) + exp -= 4 /*7*/; + else + exp -= 7 /*10*/; + } +#endif + + wa = gindex + j; + +#ifndef FIXED_POINT + scf = pow2sf_tab[exp/*+25*/] * pow2_table[frac]; +#endif + + for (win = 0; win < ics->window_group_length[g]; win++) + { + for (bin = 0; bin < width; bin += 4) + { +#ifndef FIXED_POINT + wb = wa + bin; + + spec_data[wb+0] = iquant(quant_data[k+0], tab, &error) * scf; + spec_data[wb+1] = iquant(quant_data[k+1], tab, &error) * scf; + spec_data[wb+2] = iquant(quant_data[k+2], tab, &error) * scf; + spec_data[wb+3] = iquant(quant_data[k+3], tab, &error) * scf; + +#else + real_t iq0 = iquant(quant_data[k+0], tab, &error); + real_t iq1 = iquant(quant_data[k+1], tab, &error); + real_t iq2 = iquant(quant_data[k+2], tab, &error); + real_t iq3 = iquant(quant_data[k+3], tab, &error); + + wb = wa + bin; + + if (exp < 0) + { + spec_data[wb+0] = iq0 >>= -exp; + spec_data[wb+1] = iq1 >>= -exp; + spec_data[wb+2] = iq2 >>= -exp; + spec_data[wb+3] = iq3 >>= -exp; + } else { + spec_data[wb+0] = iq0 <<= exp; + spec_data[wb+1] = iq1 <<= exp; + spec_data[wb+2] = iq2 <<= exp; + spec_data[wb+3] = iq3 <<= exp; + } + if (frac != 0) + { + spec_data[wb+0] = MUL_C(spec_data[wb+0],pow2_table[frac]); + spec_data[wb+1] = MUL_C(spec_data[wb+1],pow2_table[frac]); + spec_data[wb+2] = MUL_C(spec_data[wb+2],pow2_table[frac]); + spec_data[wb+3] = MUL_C(spec_data[wb+3],pow2_table[frac]); + } + +//#define SCFS_PRINT +#ifdef SCFS_PRINT + printf("%d\n", spec_data[gindex+(win*win_inc)+j+bin+0]); + printf("%d\n", spec_data[gindex+(win*win_inc)+j+bin+1]); + printf("%d\n", spec_data[gindex+(win*win_inc)+j+bin+2]); + printf("%d\n", spec_data[gindex+(win*win_inc)+j+bin+3]); + //printf("0x%.8X\n", spec_data[gindex+(win*win_inc)+j+bin+0]); + //printf("0x%.8X\n", spec_data[gindex+(win*win_inc)+j+bin+1]); + //printf("0x%.8X\n", spec_data[gindex+(win*win_inc)+j+bin+2]); + //printf("0x%.8X\n", spec_data[gindex+(win*win_inc)+j+bin+3]); +#endif +#endif + + gincrease += 4; + k += 4; + } + wa += win_inc; + } + j += width; + } + gindex += gincrease; + } + + return error; +} + +static uint8_t allocate_single_channel(NeAACDecHandle hDecoder, uint8_t channel, + uint8_t output_channels) +{ + uint8_t mul = 1; + +#ifdef MAIN_DEC + /* MAIN object type prediction */ + if (hDecoder->object_type == MAIN) + { + /* allocate the state only when needed */ + if (hDecoder->pred_stat[channel] == NULL) + { + hDecoder->pred_stat[channel] = (pred_state*)faad_malloc(hDecoder->frameLength * sizeof(pred_state)); + reset_all_predictors(hDecoder->pred_stat[channel], hDecoder->frameLength); + } + } +#endif + +#ifdef LTP_DEC + if (is_ltp_ot(hDecoder->object_type)) + { + /* allocate the state only when needed */ + if (hDecoder->lt_pred_stat[channel] == NULL) + { + hDecoder->lt_pred_stat[channel] = (int16_t*)faad_malloc(hDecoder->frameLength*4 * sizeof(int16_t)); + memset(hDecoder->lt_pred_stat[channel], 0, hDecoder->frameLength*4 * sizeof(int16_t)); + } + } +#endif + + if (hDecoder->time_out[channel] == NULL) + { + mul = 1; +#ifdef SBR_DEC + hDecoder->sbr_alloced[hDecoder->fr_ch_ele] = 0; + if ((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1)) + { + /* SBR requires 2 times as much output data */ + mul = 2; + hDecoder->sbr_alloced[hDecoder->fr_ch_ele] = 1; + } +#endif + hDecoder->time_out[channel] = (real_t*)faad_malloc(mul*hDecoder->frameLength*sizeof(real_t)); + memset(hDecoder->time_out[channel], 0, mul*hDecoder->frameLength*sizeof(real_t)); + } +#if (defined(PS_DEC) || defined(DRM_PS)) + if (output_channels == 2) + { + if (hDecoder->time_out[channel+1] == NULL) + { + hDecoder->time_out[channel+1] = (real_t*)faad_malloc(mul*hDecoder->frameLength*sizeof(real_t)); + memset(hDecoder->time_out[channel+1], 0, mul*hDecoder->frameLength*sizeof(real_t)); + } + } +#endif + + if (hDecoder->fb_intermed[channel] == NULL) + { + hDecoder->fb_intermed[channel] = (real_t*)faad_malloc(hDecoder->frameLength*sizeof(real_t)); + memset(hDecoder->fb_intermed[channel], 0, hDecoder->frameLength*sizeof(real_t)); + } + +#ifdef SSR_DEC + if (hDecoder->object_type == SSR) + { + if (hDecoder->ssr_overlap[channel] == NULL) + { + hDecoder->ssr_overlap[channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t)); + memset(hDecoder->ssr_overlap[channel], 0, 2*hDecoder->frameLength*sizeof(real_t)); + } + if (hDecoder->prev_fmd[channel] == NULL) + { + uint16_t k; + hDecoder->prev_fmd[channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t)); + for (k = 0; k < 2*hDecoder->frameLength; k++) + hDecoder->prev_fmd[channel][k] = REAL_CONST(-1); + } + } +#endif + + return 0; +} + +static uint8_t allocate_channel_pair(NeAACDecHandle hDecoder, + uint8_t channel, uint8_t paired_channel) +{ + uint8_t mul = 1; + +#ifdef MAIN_DEC + /* MAIN object type prediction */ + if (hDecoder->object_type == MAIN) + { + /* allocate the state only when needed */ + if (hDecoder->pred_stat[channel] == NULL) + { + hDecoder->pred_stat[channel] = (pred_state*)faad_malloc(hDecoder->frameLength * sizeof(pred_state)); + reset_all_predictors(hDecoder->pred_stat[channel], hDecoder->frameLength); + } + if (hDecoder->pred_stat[paired_channel] == NULL) + { + hDecoder->pred_stat[paired_channel] = (pred_state*)faad_malloc(hDecoder->frameLength * sizeof(pred_state)); + reset_all_predictors(hDecoder->pred_stat[paired_channel], hDecoder->frameLength); + } + } +#endif + +#ifdef LTP_DEC + if (is_ltp_ot(hDecoder->object_type)) + { + /* allocate the state only when needed */ + if (hDecoder->lt_pred_stat[channel] == NULL) + { + hDecoder->lt_pred_stat[channel] = (int16_t*)faad_malloc(hDecoder->frameLength*4 * sizeof(int16_t)); + memset(hDecoder->lt_pred_stat[channel], 0, hDecoder->frameLength*4 * sizeof(int16_t)); + } + if (hDecoder->lt_pred_stat[paired_channel] == NULL) + { + hDecoder->lt_pred_stat[paired_channel] = (int16_t*)faad_malloc(hDecoder->frameLength*4 * sizeof(int16_t)); + memset(hDecoder->lt_pred_stat[paired_channel], 0, hDecoder->frameLength*4 * sizeof(int16_t)); + } + } +#endif + + if (hDecoder->time_out[channel] == NULL) + { + mul = 1; +#ifdef SBR_DEC + hDecoder->sbr_alloced[hDecoder->fr_ch_ele] = 0; + if ((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1)) + { + /* SBR requires 2 times as much output data */ + mul = 2; + hDecoder->sbr_alloced[hDecoder->fr_ch_ele] = 1; + } +#endif + hDecoder->time_out[channel] = (real_t*)faad_malloc(mul*hDecoder->frameLength*sizeof(real_t)); + memset(hDecoder->time_out[channel], 0, mul*hDecoder->frameLength*sizeof(real_t)); + } + if (hDecoder->time_out[paired_channel] == NULL) + { + hDecoder->time_out[paired_channel] = (real_t*)faad_malloc(mul*hDecoder->frameLength*sizeof(real_t)); + memset(hDecoder->time_out[paired_channel], 0, mul*hDecoder->frameLength*sizeof(real_t)); + } + + if (hDecoder->fb_intermed[channel] == NULL) + { + hDecoder->fb_intermed[channel] = (real_t*)faad_malloc(hDecoder->frameLength*sizeof(real_t)); + memset(hDecoder->fb_intermed[channel], 0, hDecoder->frameLength*sizeof(real_t)); + } + if (hDecoder->fb_intermed[paired_channel] == NULL) + { + hDecoder->fb_intermed[paired_channel] = (real_t*)faad_malloc(hDecoder->frameLength*sizeof(real_t)); + memset(hDecoder->fb_intermed[paired_channel], 0, hDecoder->frameLength*sizeof(real_t)); + } + +#ifdef SSR_DEC + if (hDecoder->object_type == SSR) + { + if (hDecoder->ssr_overlap[cpe->channel] == NULL) + { + hDecoder->ssr_overlap[cpe->channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t)); + memset(hDecoder->ssr_overlap[cpe->channel], 0, 2*hDecoder->frameLength*sizeof(real_t)); + } + if (hDecoder->ssr_overlap[cpe->paired_channel] == NULL) + { + hDecoder->ssr_overlap[cpe->paired_channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t)); + memset(hDecoder->ssr_overlap[cpe->paired_channel], 0, 2*hDecoder->frameLength*sizeof(real_t)); + } + if (hDecoder->prev_fmd[cpe->channel] == NULL) + { + uint16_t k; + hDecoder->prev_fmd[cpe->channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t)); + for (k = 0; k < 2*hDecoder->frameLength; k++) + hDecoder->prev_fmd[cpe->channel][k] = REAL_CONST(-1); + } + if (hDecoder->prev_fmd[cpe->paired_channel] == NULL) + { + uint16_t k; + hDecoder->prev_fmd[cpe->paired_channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t)); + for (k = 0; k < 2*hDecoder->frameLength; k++) + hDecoder->prev_fmd[cpe->paired_channel][k] = REAL_CONST(-1); + } + } +#endif + + return 0; +} + +uint8_t reconstruct_single_channel(NeAACDecHandle hDecoder, ic_stream *ics, + element *sce, int16_t *spec_data) +{ + uint8_t retval, output_channels; + ALIGN real_t spec_coef[1024]; + +#ifdef PROFILE + int64_t count = faad_get_ts(); +#endif + + + /* always allocate 2 channels, PS can always "suddenly" turn up */ +#if (defined(PS_DEC) || defined(DRM_PS)) + output_channels = 2; +#else + output_channels = 1; +#endif + + if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] == 0) + { + /* element_output_channels not set yet */ + hDecoder->element_output_channels[hDecoder->fr_ch_ele] = output_channels; + } else if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] != output_channels) { + /* element inconsistency */ + return 21; + } + + if (hDecoder->element_alloced[hDecoder->fr_ch_ele] == 0) + { + retval = allocate_single_channel(hDecoder, sce->channel, output_channels); + if (retval > 0) + return retval; + + hDecoder->element_alloced[hDecoder->fr_ch_ele] = 1; + } + + + /* dequantisation and scaling */ + retval = quant_to_spec(hDecoder, ics, spec_data, spec_coef, hDecoder->frameLength); + if (retval > 0) + return retval; + +#ifdef PROFILE + count = faad_get_ts() - count; + hDecoder->requant_cycles += count; +#endif + + + /* pns decoding */ + pns_decode(ics, NULL, spec_coef, NULL, hDecoder->frameLength, 0, hDecoder->object_type); + +#ifdef MAIN_DEC + /* MAIN object type prediction */ + if (hDecoder->object_type == MAIN) + { + /* intra channel prediction */ + ic_prediction(ics, spec_coef, hDecoder->pred_stat[sce->channel], hDecoder->frameLength, + hDecoder->sf_index); + + /* In addition, for scalefactor bands coded by perceptual + noise substitution the predictors belonging to the + corresponding spectral coefficients are reset. + */ + pns_reset_pred_state(ics, hDecoder->pred_stat[sce->channel]); + } +#endif + +#ifdef LTP_DEC + if (is_ltp_ot(hDecoder->object_type)) + { +#ifdef LD_DEC + if (hDecoder->object_type == LD) + { + if (ics->ltp.data_present) + { + if (ics->ltp.lag_update) + hDecoder->ltp_lag[sce->channel] = ics->ltp.lag; + } + ics->ltp.lag = hDecoder->ltp_lag[sce->channel]; + } +#endif + + /* long term prediction */ + lt_prediction(ics, &(ics->ltp), spec_coef, hDecoder->lt_pred_stat[sce->channel], hDecoder->fb, + ics->window_shape, hDecoder->window_shape_prev[sce->channel], + hDecoder->sf_index, hDecoder->object_type, hDecoder->frameLength); + } +#endif + + /* tns decoding */ + tns_decode_frame(ics, &(ics->tns), hDecoder->sf_index, hDecoder->object_type, + spec_coef, hDecoder->frameLength); + + /* drc decoding */ + if (hDecoder->drc->present) + { + if (!hDecoder->drc->exclude_mask[sce->channel] || !hDecoder->drc->excluded_chns_present) + drc_decode(hDecoder->drc, spec_coef); + } + + /* filter bank */ +#ifdef SSR_DEC + if (hDecoder->object_type != SSR) + { +#endif + ifilter_bank(hDecoder->fb, ics->window_sequence, ics->window_shape, + hDecoder->window_shape_prev[sce->channel], spec_coef, + hDecoder->time_out[sce->channel], hDecoder->fb_intermed[sce->channel], + hDecoder->object_type, hDecoder->frameLength); +#ifdef SSR_DEC + } else { + ssr_decode(&(ics->ssr), hDecoder->fb, ics->window_sequence, ics->window_shape, + hDecoder->window_shape_prev[sce->channel], spec_coef, hDecoder->time_out[sce->channel], + hDecoder->ssr_overlap[sce->channel], hDecoder->ipqf_buffer[sce->channel], hDecoder->prev_fmd[sce->channel], + hDecoder->frameLength); + } +#endif + + /* save window shape for next frame */ + hDecoder->window_shape_prev[sce->channel] = ics->window_shape; + +#ifdef LTP_DEC + if (is_ltp_ot(hDecoder->object_type)) + { + lt_update_state(hDecoder->lt_pred_stat[sce->channel], hDecoder->time_out[sce->channel], + hDecoder->fb_intermed[sce->channel], hDecoder->frameLength, hDecoder->object_type); + } +#endif + +#ifdef SBR_DEC + if (((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1)) + && hDecoder->sbr_alloced[hDecoder->fr_ch_ele]) + { + uint8_t ele = hDecoder->fr_ch_ele; + uint8_t ch = sce->channel; + + /* following case can happen when forceUpSampling == 1 */ + if (hDecoder->sbr[ele] == NULL) + { + hDecoder->sbr[ele] = sbrDecodeInit(hDecoder->frameLength, + hDecoder->element_id[ele], 2*get_sample_rate(hDecoder->sf_index), + hDecoder->downSampledSBR +#ifdef DRM + , 0 +#endif + ); + } + + if (sce->ics1.window_sequence == EIGHT_SHORT_SEQUENCE) + hDecoder->sbr[ele]->maxAACLine = 8*sce->ics1.swb_offset[max(sce->ics1.max_sfb-1, 0)]; + else + hDecoder->sbr[ele]->maxAACLine = sce->ics1.swb_offset[max(sce->ics1.max_sfb-1, 0)]; + + /* check if any of the PS tools is used */ +#if (defined(PS_DEC) || defined(DRM_PS)) + if (hDecoder->ps_used[ele] == 0) + { +#endif + retval = sbrDecodeSingleFrame(hDecoder->sbr[ele], hDecoder->time_out[ch], + hDecoder->postSeekResetFlag, hDecoder->downSampledSBR); +#if (defined(PS_DEC) || defined(DRM_PS)) + } else { + retval = sbrDecodeSingleFramePS(hDecoder->sbr[ele], hDecoder->time_out[ch], + hDecoder->time_out[ch+1], hDecoder->postSeekResetFlag, + hDecoder->downSampledSBR); + } +#endif + if (retval > 0) + return retval; + } else if (((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1)) + && !hDecoder->sbr_alloced[hDecoder->fr_ch_ele]) + { + return 23; + } +#endif + + /* copy L to R when no PS is used */ +#if (defined(PS_DEC) || defined(DRM_PS)) + if ((hDecoder->ps_used[hDecoder->fr_ch_ele] == 0)) + { + uint8_t ele = hDecoder->fr_ch_ele; + uint8_t ch = sce->channel; + uint16_t frame_size = (hDecoder->sbr_alloced[ele]) ? 2 : 1; + frame_size *= hDecoder->frameLength*sizeof(real_t); + + memcpy(hDecoder->time_out[ch+1], hDecoder->time_out[ch], frame_size); + } +#endif + + return 0; +} + +uint8_t reconstruct_channel_pair(NeAACDecHandle hDecoder, ic_stream *ics1, ic_stream *ics2, + element *cpe, int16_t *spec_data1, int16_t *spec_data2) +{ + uint8_t retval; + ALIGN real_t spec_coef1[1024]; + ALIGN real_t spec_coef2[1024]; + +#ifdef PROFILE + int64_t count = faad_get_ts(); +#endif + if (hDecoder->element_alloced[hDecoder->fr_ch_ele] == 0) + { + retval = allocate_channel_pair(hDecoder, cpe->channel, (uint8_t)cpe->paired_channel); + if (retval > 0) + return retval; + + hDecoder->element_alloced[hDecoder->fr_ch_ele] = 1; + } + + /* dequantisation and scaling */ + retval = quant_to_spec(hDecoder, ics1, spec_data1, spec_coef1, hDecoder->frameLength); + if (retval > 0) + return retval; + retval = quant_to_spec(hDecoder, ics2, spec_data2, spec_coef2, hDecoder->frameLength); + if (retval > 0) + return retval; + +#ifdef PROFILE + count = faad_get_ts() - count; + hDecoder->requant_cycles += count; +#endif + + + /* pns decoding */ + if (ics1->ms_mask_present) + { + pns_decode(ics1, ics2, spec_coef1, spec_coef2, hDecoder->frameLength, 1, hDecoder->object_type); + } else { + pns_decode(ics1, NULL, spec_coef1, NULL, hDecoder->frameLength, 0, hDecoder->object_type); + pns_decode(ics2, NULL, spec_coef2, NULL, hDecoder->frameLength, 0, hDecoder->object_type); + } + + /* mid/side decoding */ + ms_decode(ics1, ics2, spec_coef1, spec_coef2, hDecoder->frameLength); + +#if 0 + { + int i; + for (i = 0; i < 1024; i++) + { + //printf("%d\n", spec_coef1[i]); + printf("0x%.8X\n", spec_coef1[i]); + } + for (i = 0; i < 1024; i++) + { + //printf("%d\n", spec_coef2[i]); + printf("0x%.8X\n", spec_coef2[i]); + } + } +#endif + + /* intensity stereo decoding */ + is_decode(ics1, ics2, spec_coef1, spec_coef2, hDecoder->frameLength); + +#if 0 + { + int i; + for (i = 0; i < 1024; i++) + { + printf("%d\n", spec_coef1[i]); + //printf("0x%.8X\n", spec_coef1[i]); + } + for (i = 0; i < 1024; i++) + { + printf("%d\n", spec_coef2[i]); + //printf("0x%.8X\n", spec_coef2[i]); + } + } +#endif + +#ifdef MAIN_DEC + /* MAIN object type prediction */ + if (hDecoder->object_type == MAIN) + { + /* intra channel prediction */ + ic_prediction(ics1, spec_coef1, hDecoder->pred_stat[cpe->channel], hDecoder->frameLength, + hDecoder->sf_index); + ic_prediction(ics2, spec_coef2, hDecoder->pred_stat[cpe->paired_channel], hDecoder->frameLength, + hDecoder->sf_index); + + /* In addition, for scalefactor bands coded by perceptual + noise substitution the predictors belonging to the + corresponding spectral coefficients are reset. + */ + pns_reset_pred_state(ics1, hDecoder->pred_stat[cpe->channel]); + pns_reset_pred_state(ics2, hDecoder->pred_stat[cpe->paired_channel]); + } +#endif + +#ifdef LTP_DEC + if (is_ltp_ot(hDecoder->object_type)) + { + ltp_info *ltp1 = &(ics1->ltp); + ltp_info *ltp2 = (cpe->common_window) ? &(ics2->ltp2) : &(ics2->ltp); +#ifdef LD_DEC + if (hDecoder->object_type == LD) + { + if (ltp1->data_present) + { + if (ltp1->lag_update) + hDecoder->ltp_lag[cpe->channel] = ltp1->lag; + } + ltp1->lag = hDecoder->ltp_lag[cpe->channel]; + if (ltp2->data_present) + { + if (ltp2->lag_update) + hDecoder->ltp_lag[cpe->paired_channel] = ltp2->lag; + } + ltp2->lag = hDecoder->ltp_lag[cpe->paired_channel]; + } +#endif + + /* long term prediction */ + lt_prediction(ics1, ltp1, spec_coef1, hDecoder->lt_pred_stat[cpe->channel], hDecoder->fb, + ics1->window_shape, hDecoder->window_shape_prev[cpe->channel], + hDecoder->sf_index, hDecoder->object_type, hDecoder->frameLength); + lt_prediction(ics2, ltp2, spec_coef2, hDecoder->lt_pred_stat[cpe->paired_channel], hDecoder->fb, + ics2->window_shape, hDecoder->window_shape_prev[cpe->paired_channel], + hDecoder->sf_index, hDecoder->object_type, hDecoder->frameLength); + } +#endif + + /* tns decoding */ + tns_decode_frame(ics1, &(ics1->tns), hDecoder->sf_index, hDecoder->object_type, + spec_coef1, hDecoder->frameLength); + tns_decode_frame(ics2, &(ics2->tns), hDecoder->sf_index, hDecoder->object_type, + spec_coef2, hDecoder->frameLength); + + /* drc decoding */ + if (hDecoder->drc->present) + { + if (!hDecoder->drc->exclude_mask[cpe->channel] || !hDecoder->drc->excluded_chns_present) + drc_decode(hDecoder->drc, spec_coef1); + if (!hDecoder->drc->exclude_mask[cpe->paired_channel] || !hDecoder->drc->excluded_chns_present) + drc_decode(hDecoder->drc, spec_coef2); + } + + /* filter bank */ +#ifdef SSR_DEC + if (hDecoder->object_type != SSR) + { +#endif + ifilter_bank(hDecoder->fb, ics1->window_sequence, ics1->window_shape, + hDecoder->window_shape_prev[cpe->channel], spec_coef1, + hDecoder->time_out[cpe->channel], hDecoder->fb_intermed[cpe->channel], + hDecoder->object_type, hDecoder->frameLength); + ifilter_bank(hDecoder->fb, ics2->window_sequence, ics2->window_shape, + hDecoder->window_shape_prev[cpe->paired_channel], spec_coef2, + hDecoder->time_out[cpe->paired_channel], hDecoder->fb_intermed[cpe->paired_channel], + hDecoder->object_type, hDecoder->frameLength); +#ifdef SSR_DEC + } else { + ssr_decode(&(ics1->ssr), hDecoder->fb, ics1->window_sequence, ics1->window_shape, + hDecoder->window_shape_prev[cpe->channel], spec_coef1, hDecoder->time_out[cpe->channel], + hDecoder->ssr_overlap[cpe->channel], hDecoder->ipqf_buffer[cpe->channel], + hDecoder->prev_fmd[cpe->channel], hDecoder->frameLength); + ssr_decode(&(ics2->ssr), hDecoder->fb, ics2->window_sequence, ics2->window_shape, + hDecoder->window_shape_prev[cpe->paired_channel], spec_coef2, hDecoder->time_out[cpe->paired_channel], + hDecoder->ssr_overlap[cpe->paired_channel], hDecoder->ipqf_buffer[cpe->paired_channel], + hDecoder->prev_fmd[cpe->paired_channel], hDecoder->frameLength); + } +#endif + + /* save window shape for next frame */ + hDecoder->window_shape_prev[cpe->channel] = ics1->window_shape; + hDecoder->window_shape_prev[cpe->paired_channel] = ics2->window_shape; + +#ifdef LTP_DEC + if (is_ltp_ot(hDecoder->object_type)) + { + lt_update_state(hDecoder->lt_pred_stat[cpe->channel], hDecoder->time_out[cpe->channel], + hDecoder->fb_intermed[cpe->channel], hDecoder->frameLength, hDecoder->object_type); + lt_update_state(hDecoder->lt_pred_stat[cpe->paired_channel], hDecoder->time_out[cpe->paired_channel], + hDecoder->fb_intermed[cpe->paired_channel], hDecoder->frameLength, hDecoder->object_type); + } +#endif + +#ifdef SBR_DEC + if (((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1)) + && hDecoder->sbr_alloced[hDecoder->fr_ch_ele]) + { + uint8_t ele = hDecoder->fr_ch_ele; + uint8_t ch0 = cpe->channel; + uint8_t ch1 = cpe->paired_channel; + + /* following case can happen when forceUpSampling == 1 */ + if (hDecoder->sbr[ele] == NULL) + { + hDecoder->sbr[ele] = sbrDecodeInit(hDecoder->frameLength, + hDecoder->element_id[ele], 2*get_sample_rate(hDecoder->sf_index), + hDecoder->downSampledSBR +#ifdef DRM + , 0 +#endif + ); + } + + if (cpe->ics1.window_sequence == EIGHT_SHORT_SEQUENCE) + hDecoder->sbr[ele]->maxAACLine = 8*cpe->ics1.swb_offset[max(cpe->ics1.max_sfb-1, 0)]; + else + hDecoder->sbr[ele]->maxAACLine = cpe->ics1.swb_offset[max(cpe->ics1.max_sfb-1, 0)]; + + retval = sbrDecodeCoupleFrame(hDecoder->sbr[ele], + hDecoder->time_out[ch0], hDecoder->time_out[ch1], + hDecoder->postSeekResetFlag, hDecoder->downSampledSBR); + if (retval > 0) + return retval; + } else if (((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1)) + && !hDecoder->sbr_alloced[hDecoder->fr_ch_ele]) + { + return 23; + } +#endif + + return 0; +} diff --git a/Libraries/FAAD2/Files/libfaad/specrec.h b/Libraries/FAAD2/Files/libfaad/specrec.h new file mode 100644 index 000000000..c3540ac97 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/specrec.h @@ -0,0 +1,46 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#ifndef __SPECREC_H__ +#define __SPECREC_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "syntax.h" + +uint8_t window_grouping_info(NeAACDecHandle hDecoder, ic_stream *ics); +uint8_t reconstruct_channel_pair(NeAACDecHandle hDecoder, ic_stream *ics1, ic_stream *ics2, + element *cpe, int16_t *spec_data1, int16_t *spec_data2); +uint8_t reconstruct_single_channel(NeAACDecHandle hDecoder, ic_stream *ics, element *sce, + int16_t *spec_data); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/Libraries/FAAD2/Files/libfaad/ssr.c b/Libraries/FAAD2/Files/libfaad/ssr.c new file mode 100644 index 000000000..2ffc55e53 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/ssr.c @@ -0,0 +1,172 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#include "common.h" +#include "structs.h" + +#ifdef SSR_DEC + +#include "syntax.h" +#include "filtbank.h" +#include "ssr.h" +#include "ssr_fb.h" + +void ssr_decode(ssr_info *ssr, fb_info *fb, uint8_t window_sequence, + uint8_t window_shape, uint8_t window_shape_prev, + real_t *freq_in, real_t *time_out, real_t *overlap, + real_t ipqf_buffer[SSR_BANDS][96/4], + real_t *prev_fmd, uint16_t frame_len) +{ + uint8_t band; + uint16_t ssr_frame_len = frame_len/SSR_BANDS; + real_t time_tmp[2048] = {0}; + real_t output[1024] = {0}; + + for (band = 0; band < SSR_BANDS; band++) + { + int16_t j; + + /* uneven bands have inverted frequency scale */ + if (band == 1 || band == 3) + { + for (j = 0; j < ssr_frame_len/2; j++) + { + real_t tmp; + tmp = freq_in[j + ssr_frame_len*band]; + freq_in[j + ssr_frame_len*band] = + freq_in[ssr_frame_len - j - 1 + ssr_frame_len*band]; + freq_in[ssr_frame_len - j - 1 + ssr_frame_len*band] = tmp; + } + } + + /* non-overlapping inverse filterbank for SSR */ + ssr_ifilter_bank(fb, window_sequence, window_shape, window_shape_prev, + freq_in + band*ssr_frame_len, time_tmp + band*ssr_frame_len, + ssr_frame_len); + + /* gain control */ + ssr_gain_control(ssr, time_tmp, output, overlap, prev_fmd, + band, window_sequence, ssr_frame_len); + } + + /* inverse pqf to bring subbands together again */ + ssr_ipqf(ssr, output, time_out, ipqf_buffer, frame_len, SSR_BANDS); +} + +static void ssr_gain_control(ssr_info *ssr, real_t *data, real_t *output, + real_t *overlap, real_t *prev_fmd, uint8_t band, + uint8_t window_sequence, uint16_t frame_len) +{ + uint16_t i; + real_t gc_function[2*1024/SSR_BANDS]; + + if (window_sequence != EIGHT_SHORT_SEQUENCE) + { + ssr_gc_function(ssr, &prev_fmd[band * frame_len*2], + gc_function, window_sequence, band, frame_len); + + for (i = 0; i < frame_len*2; i++) + data[band * frame_len*2 + i] *= gc_function[i]; + for (i = 0; i < frame_len; i++) + { + output[band*frame_len + i] = overlap[band*frame_len + i] + + data[band*frame_len*2 + i]; + } + for (i = 0; i < frame_len; i++) + { + overlap[band*frame_len + i] = + data[band*frame_len*2 + frame_len + i]; + } + } else { + uint8_t w; + for (w = 0; w < 8; w++) + { + uint16_t frame_len8 = frame_len/8; + uint16_t frame_len16 = frame_len/16; + + ssr_gc_function(ssr, &prev_fmd[band*frame_len*2 + w*frame_len*2/8], + gc_function, window_sequence, frame_len); + + for (i = 0; i < frame_len8*2; i++) + data[band*frame_len*2 + w*frame_len8*2+i] *= gc_function[i]; + for (i = 0; i < frame_len8; i++) + { + overlap[band*frame_len + i + 7*frame_len16 + w*frame_len8] += + data[band*frame_len*2 + 2*w*frame_len8 + i]; + } + for (i = 0; i < frame_len8; i++) + { + overlap[band*frame_len + i + 7*frame_len16 + (w+1)*frame_len8] = + data[band*frame_len*2 + 2*w*frame_len8 + frame_len8 + i]; + } + } + for (i = 0; i < frame_len; i++) + output[band*frame_len + i] = overlap[band*frame_len + i]; + for (i = 0; i < frame_len; i++) + overlap[band*frame_len + i] = overlap[band*frame_len + i + frame_len]; + } +} + +static void ssr_gc_function(ssr_info *ssr, real_t *prev_fmd, + real_t *gc_function, uint8_t window_sequence, + uint8_t band, uint16_t frame_len) +{ + uint16_t i; + uint16_t len_area1, len_area2; + int32_t aloc[10]; + real_t alev[10]; + + switch (window_sequence) + { + case ONLY_LONG_SEQUENCE: + len_area1 = frame_len/SSR_BANDS; + len_area2 = 0; + break; + case LONG_START_SEQUENCE: + len_area1 = (frame_len/SSR_BANDS)*7/32; + len_area2 = (frame_len/SSR_BANDS)/16; + break; + case EIGHT_SHORT_SEQUENCE: + len_area1 = (frame_len/8)/SSR_BANDS; + len_area2 = 0; + break; + case LONG_STOP_SEQUENCE: + len_area1 = (frame_len/SSR_BANDS); + len_area2 = 0; + break; + } + + /* decode bitstream information */ + + /* build array M */ + + + for (i = 0; i < frame_len*2; i++) + gc_function[i] = 1; +} + +#endif diff --git a/Libraries/FAAD2/Files/libfaad/ssr.h b/Libraries/FAAD2/Files/libfaad/ssr.h new file mode 100644 index 000000000..59ffe16f9 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/ssr.h @@ -0,0 +1,56 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#ifndef __SSR_H__ +#define __SSR_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#define SSR_BANDS 4 +#define PQFTAPS 96 + +void ssr_decode(ssr_info *ssr, fb_info *fb, uint8_t window_sequence, + uint8_t window_shape, uint8_t window_shape_prev, + real_t *freq_in, real_t *time_out, real_t *overlap, + real_t ipqf_buffer[SSR_BANDS][96/4], + real_t *prev_fmd, uint16_t frame_len); + + +static void ssr_gain_control(ssr_info *ssr, real_t *data, real_t *output, + real_t *overlap, real_t *prev_fmd, uint8_t band, + uint8_t window_sequence, uint16_t frame_len); +static void ssr_gc_function(ssr_info *ssr, real_t *prev_fmd, + real_t *gc_function, uint8_t window_sequence, + uint16_t frame_len); + + +#ifdef __cplusplus +} +#endif +#endif diff --git a/Libraries/FAAD2/Files/libfaad/ssr_fb.c b/Libraries/FAAD2/Files/libfaad/ssr_fb.c new file mode 100644 index 000000000..12cb22b3e --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/ssr_fb.c @@ -0,0 +1,182 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#include "common.h" +#include "structs.h" + +#ifdef SSR_DEC + +#include +#include +#include "syntax.h" +#include "filtbank.h" +#include "mdct.h" +#include "ssr_fb.h" +#include "ssr_win.h" + +fb_info *ssr_filter_bank_init(uint16_t frame_len) +{ + uint16_t nshort = frame_len/8; + + fb_info *fb = (fb_info*)faad_malloc(sizeof(fb_info)); + memset(fb, 0, sizeof(fb_info)); + + /* normal */ + fb->mdct256 = faad_mdct_init(2*nshort); + fb->mdct2048 = faad_mdct_init(2*frame_len); + + fb->long_window[0] = sine_long_256; + fb->short_window[0] = sine_short_32; + fb->long_window[1] = kbd_long_256; + fb->short_window[1] = kbd_short_32; + + return fb; +} + +void ssr_filter_bank_end(fb_info *fb) +{ + faad_mdct_end(fb->mdct256); + faad_mdct_end(fb->mdct2048); + + if (fb) faad_free(fb); +} + +static INLINE void imdct_ssr(fb_info *fb, real_t *in_data, + real_t *out_data, uint16_t len) +{ + mdct_info *mdct; + + switch (len) + { + case 512: + mdct = fb->mdct2048; + break; + case 64: + mdct = fb->mdct256; + break; + } + + faad_imdct(mdct, in_data, out_data); +} + +/* NON-overlapping inverse filterbank for use with SSR */ +void ssr_ifilter_bank(fb_info *fb, uint8_t window_sequence, uint8_t window_shape, + uint8_t window_shape_prev, real_t *freq_in, + real_t *time_out, uint16_t frame_len) +{ + int16_t i; + real_t *transf_buf; + + real_t *window_long; + real_t *window_long_prev; + real_t *window_short; + real_t *window_short_prev; + + uint16_t nlong = frame_len; + uint16_t nshort = frame_len/8; + uint16_t trans = nshort/2; + + uint16_t nflat_ls = (nlong-nshort)/2; + + transf_buf = (real_t*)faad_malloc(2*nlong*sizeof(real_t)); + + window_long = fb->long_window[window_shape]; + window_long_prev = fb->long_window[window_shape_prev]; + window_short = fb->short_window[window_shape]; + window_short_prev = fb->short_window[window_shape_prev]; + + switch (window_sequence) + { + case ONLY_LONG_SEQUENCE: + imdct_ssr(fb, freq_in, transf_buf, 2*nlong); + for (i = nlong-1; i >= 0; i--) + { + time_out[i] = MUL_R_C(transf_buf[i],window_long_prev[i]); + time_out[nlong+i] = MUL_R_C(transf_buf[nlong+i],window_long[nlong-1-i]); + } + break; + + case LONG_START_SEQUENCE: + imdct_ssr(fb, freq_in, transf_buf, 2*nlong); + for (i = 0; i < nlong; i++) + time_out[i] = MUL_R_C(transf_buf[i],window_long_prev[i]); + for (i = 0; i < nflat_ls; i++) + time_out[nlong+i] = transf_buf[nlong+i]; + for (i = 0; i < nshort; i++) + time_out[nlong+nflat_ls+i] = MUL_R_C(transf_buf[nlong+nflat_ls+i],window_short[nshort-i-1]); + for (i = 0; i < nflat_ls; i++) + time_out[nlong+nflat_ls+nshort+i] = 0; + break; + + case EIGHT_SHORT_SEQUENCE: + imdct_ssr(fb, freq_in+0*nshort, transf_buf+2*nshort*0, 2*nshort); + imdct_ssr(fb, freq_in+1*nshort, transf_buf+2*nshort*1, 2*nshort); + imdct_ssr(fb, freq_in+2*nshort, transf_buf+2*nshort*2, 2*nshort); + imdct_ssr(fb, freq_in+3*nshort, transf_buf+2*nshort*3, 2*nshort); + imdct_ssr(fb, freq_in+4*nshort, transf_buf+2*nshort*4, 2*nshort); + imdct_ssr(fb, freq_in+5*nshort, transf_buf+2*nshort*5, 2*nshort); + imdct_ssr(fb, freq_in+6*nshort, transf_buf+2*nshort*6, 2*nshort); + imdct_ssr(fb, freq_in+7*nshort, transf_buf+2*nshort*7, 2*nshort); + for(i = nshort-1; i >= 0; i--) + { + time_out[i+0*nshort] = MUL_R_C(transf_buf[nshort*0+i],window_short_prev[i]); + time_out[i+1*nshort] = MUL_R_C(transf_buf[nshort*1+i],window_short[i]); + time_out[i+2*nshort] = MUL_R_C(transf_buf[nshort*2+i],window_short_prev[i]); + time_out[i+3*nshort] = MUL_R_C(transf_buf[nshort*3+i],window_short[i]); + time_out[i+4*nshort] = MUL_R_C(transf_buf[nshort*4+i],window_short_prev[i]); + time_out[i+5*nshort] = MUL_R_C(transf_buf[nshort*5+i],window_short[i]); + time_out[i+6*nshort] = MUL_R_C(transf_buf[nshort*6+i],window_short_prev[i]); + time_out[i+7*nshort] = MUL_R_C(transf_buf[nshort*7+i],window_short[i]); + time_out[i+8*nshort] = MUL_R_C(transf_buf[nshort*8+i],window_short_prev[i]); + time_out[i+9*nshort] = MUL_R_C(transf_buf[nshort*9+i],window_short[i]); + time_out[i+10*nshort] = MUL_R_C(transf_buf[nshort*10+i],window_short_prev[i]); + time_out[i+11*nshort] = MUL_R_C(transf_buf[nshort*11+i],window_short[i]); + time_out[i+12*nshort] = MUL_R_C(transf_buf[nshort*12+i],window_short_prev[i]); + time_out[i+13*nshort] = MUL_R_C(transf_buf[nshort*13+i],window_short[i]); + time_out[i+14*nshort] = MUL_R_C(transf_buf[nshort*14+i],window_short_prev[i]); + time_out[i+15*nshort] = MUL_R_C(transf_buf[nshort*15+i],window_short[i]); + } + break; + + case LONG_STOP_SEQUENCE: + imdct_ssr(fb, freq_in, transf_buf, 2*nlong); + for (i = 0; i < nflat_ls; i++) + time_out[i] = 0; + for (i = 0; i < nshort; i++) + time_out[nflat_ls+i] = MUL_R_C(transf_buf[nflat_ls+i],window_short_prev[i]); + for (i = 0; i < nflat_ls; i++) + time_out[nflat_ls+nshort+i] = transf_buf[nflat_ls+nshort+i]; + for (i = 0; i < nlong; i++) + time_out[nlong+i] = MUL_R_C(transf_buf[nlong+i],window_long[nlong-1-i]); + break; + } + + faad_free(transf_buf); +} + + +#endif diff --git a/Libraries/FAAD2/Files/libfaad/ssr_fb.h b/Libraries/FAAD2/Files/libfaad/ssr_fb.h new file mode 100644 index 000000000..18effedf0 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/ssr_fb.h @@ -0,0 +1,44 @@ +/* +** FAAD - Freeware Advanced Audio Decoder +** Copyright (C) 2002 M. Bakker +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** $Id$ +**/ + +#ifndef __SSR_FB_H__ +#define __SSR_FB_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +fb_info *ssr_filter_bank_init(uint16_t frame_len); +void ssr_filter_bank_end(fb_info *fb); + +/*non overlapping inverse filterbank */ +void ssr_ifilter_bank(fb_info *fb, + uint8_t window_sequence, + uint8_t window_shape, + uint8_t window_shape_prev, + real_t *freq_in, + real_t *time_out, + uint16_t frame_len); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/Libraries/FAAD2/Files/libfaad/ssr_ipqf.c b/Libraries/FAAD2/Files/libfaad/ssr_ipqf.c new file mode 100644 index 000000000..668d79861 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/ssr_ipqf.c @@ -0,0 +1,188 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#include "common.h" +#include "structs.h" + +#ifdef SSR_DEC + +#include "ssr.h" +#include "ssr_ipqf.h" + +static real_t **app_pqfbuf; +static real_t **pp_q0, **pp_t0, **pp_t1; + +void gc_set_protopqf(real_t *p_proto) +{ + int j; + static real_t a_half[48] = + { + 1.2206911375946939E-05, 1.7261986723798209E-05, 1.2300093657077942E-05, + -1.0833943097791965E-05, -5.7772498639901686E-05, -1.2764767618947719E-04, + -2.0965186675013334E-04, -2.8166673689263850E-04, -3.1234860429017460E-04, + -2.6738519958452353E-04, -1.1949424681824722E-04, 1.3965139412648678E-04, + 4.8864136409185725E-04, 8.7044629275148344E-04, 1.1949430269934793E-03, + 1.3519708175026700E-03, 1.2346314373964412E-03, 7.6953209114159191E-04, + -5.2242432579537141E-05, -1.1516092887213454E-03, -2.3538469841711277E-03, + -3.4033123072127277E-03, -4.0028551071986133E-03, -3.8745415659693259E-03, + -2.8321073426874310E-03, -8.5038892323704195E-04, 1.8856751185350931E-03, + 4.9688741735340923E-03, 7.8056704536795926E-03, 9.7027909685901654E-03, + 9.9960423120166159E-03, 8.2019366335594487E-03, 4.1642072876103365E-03, + -1.8364453822737758E-03, -9.0384863094167686E-03, -1.6241528177129844E-02, + -2.1939551286300665E-02, -2.4533179947088161E-02, -2.2591663337768787E-02, + -1.5122066420044672E-02, -1.7971713448186293E-03, 1.6903413428575379E-02, + 3.9672315874127042E-02, 6.4487527248102796E-02, 8.8850025474701726E-02, + 0.1101132906105560 , 0.1258540205143761 , 0.1342239368467012 + }; + + for (j = 0; j < 48; ++j) + { + p_proto[j] = p_proto[95-j] = a_half[j]; + } +} + +void gc_setcoef_eff_pqfsyn(int mm, + int kk, + real_t *p_proto, + real_t ***ppp_q0, + real_t ***ppp_t0, + real_t ***ppp_t1) +{ + int i, k, n; + real_t w; + + /* Set 1st Mul&Acc Coef's */ + *ppp_q0 = (real_t **) calloc(mm, sizeof(real_t *)); + for (n = 0; n < mm; ++n) + { + (*ppp_q0)[n] = (real_t *) calloc(mm, sizeof(real_t)); + } + for (n = 0; n < mm/2; ++n) + { + for (i = 0; i < mm; ++i) + { + w = (2*i+1)*(2*n+1-mm)*M_PI/(4*mm); + (*ppp_q0)[n][i] = 2.0 * cos((real_t) w); + + w = (2*i+1)*(2*(mm+n)+1-mm)*M_PI/(4*mm); + (*ppp_q0)[n + mm/2][i] = 2.0 * cos((real_t) w); + } + } + + /* Set 2nd Mul&Acc Coef's */ + *ppp_t0 = (real_t **) calloc(mm, sizeof(real_t *)); + *ppp_t1 = (real_t **) calloc(mm, sizeof(real_t *)); + for (n = 0; n < mm; ++n) + { + (*ppp_t0)[n] = (real_t *) calloc(kk, sizeof(real_t)); + (*ppp_t1)[n] = (real_t *) calloc(kk, sizeof(real_t)); + } + for (n = 0; n < mm; ++n) + { + for (k = 0; k < kk; ++k) + { + (*ppp_t0)[n][k] = mm * p_proto[2*k *mm + n]; + (*ppp_t1)[n][k] = mm * p_proto[(2*k+1)*mm + n]; + + if (k%2 != 0) + { + (*ppp_t0)[n][k] = -(*ppp_t0)[n][k]; + (*ppp_t1)[n][k] = -(*ppp_t1)[n][k]; + } + } + } +} + +void ssr_ipqf(ssr_info *ssr, real_t *in_data, real_t *out_data, + real_t buffer[SSR_BANDS][96/4], + uint16_t frame_len, uint8_t bands) +{ + static int initFlag = 0; + real_t a_pqfproto[PQFTAPS]; + + int i; + + if (initFlag == 0) + { + gc_set_protopqf(a_pqfproto); + gc_setcoef_eff_pqfsyn(SSR_BANDS, PQFTAPS/(2*SSR_BANDS), a_pqfproto, + &pp_q0, &pp_t0, &pp_t1); + initFlag = 1; + } + + for (i = 0; i < frame_len / SSR_BANDS; i++) + { + int l, n, k; + int mm = SSR_BANDS; + int kk = PQFTAPS/(2*SSR_BANDS); + + for (n = 0; n < mm; n++) + { + for (k = 0; k < 2*kk-1; k++) + { + buffer[n][k] = buffer[n][k+1]; + } + } + + for (n = 0; n < mm; n++) + { + real_t acc = 0.0; + for (l = 0; l < mm; l++) + { + acc += pp_q0[n][l] * in_data[l*frame_len/SSR_BANDS + i]; + } + buffer[n][2*kk-1] = acc; + } + + for (n = 0; n < mm/2; n++) + { + real_t acc = 0.0; + for (k = 0; k < kk; k++) + { + acc += pp_t0[n][k] * buffer[n][2*kk-1-2*k]; + } + for (k = 0; k < kk; ++k) + { + acc += pp_t1[n][k] * buffer[n + mm/2][2*kk-2-2*k]; + } + out_data[i*SSR_BANDS + n] = acc; + + acc = 0.0; + for (k = 0; k < kk; k++) + { + acc += pp_t0[mm-1-n][k] * buffer[n][2*kk-1-2*k]; + } + for (k = 0; k < kk; k++) + { + acc -= pp_t1[mm-1-n][k] * buffer[n + mm/2][2*kk-2-2*k]; + } + out_data[i*SSR_BANDS + mm-1-n] = acc; + } + } +} + +#endif diff --git a/Libraries/FAAD2/Files/libfaad/ssr_ipqf.h b/Libraries/FAAD2/Files/libfaad/ssr_ipqf.h new file mode 100644 index 000000000..c948168a0 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/ssr_ipqf.h @@ -0,0 +1,37 @@ +/* +** FAAD - Freeware Advanced Audio Decoder +** Copyright (C) 2002 M. Bakker +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** $Id$ +**/ + +#ifndef __SSR_IPQF_H__ +#define __SSR_IPQF_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +void ssr_ipqf(ssr_info *ssr, real_t *in_data, real_t *out_data, + real_t buffer[SSR_BANDS][96/4], + uint16_t frame_len, uint8_t bands); + + +#ifdef __cplusplus +} +#endif +#endif diff --git a/Libraries/FAAD2/Files/libfaad/ssr_win.h b/Libraries/FAAD2/Files/libfaad/ssr_win.h new file mode 100644 index 000000000..b012c1f30 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/ssr_win.h @@ -0,0 +1,626 @@ +/* +** FAAD - Freeware Advanced Audio Decoder +** Copyright (C) 2002 M. Bakker +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** $Id$ +**/ + +#ifndef __SSR_WIN_H__ +#define __SSR_WIN_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef _MSC_VER +#pragma warning(disable:4305) +#pragma warning(disable:4244) +#endif + +static real_t sine_short_32[] = { + 0.0245412290, + 0.0735645667, + 0.1224106774, + 0.1709618866, + 0.2191012502, + 0.2667127550, + 0.3136817515, + 0.3598950505, + 0.4052413106, + 0.4496113360, + 0.4928981960, + 0.5349976420, + 0.5758082271, + 0.6152316332, + 0.6531728506, + 0.6895405650, + 0.7242470980, + 0.7572088838, + 0.7883464694, + 0.8175848126, + 0.8448535800, + 0.8700870275, + 0.8932242990, + 0.9142097831, + 0.9329928160, + 0.9495282173, + 0.9637760520, + 0.9757021666, + 0.9852776527, + 0.9924795628, + 0.9972904325, + 0.9996988177 +}; + +static real_t sine_long_256[] = { + 0.0030679568, + 0.0092037553, + 0.0153392069, + 0.0214740802, + 0.0276081469, + 0.0337411724, + 0.0398729295, + 0.0460031852, + 0.0521317050, + 0.0582582653, + 0.0643826351, + 0.0705045760, + 0.0766238645, + 0.0827402696, + 0.0888535529, + 0.0949634984, + 0.1010698676, + 0.1071724296, + 0.1132709533, + 0.1193652153, + 0.1254549921, + 0.1315400302, + 0.1376201212, + 0.1436950415, + 0.1497645378, + 0.1558284014, + 0.1618863940, + 0.1679383069, + 0.1739838719, + 0.1800229102, + 0.1860551536, + 0.1920804083, + 0.1980984211, + 0.2041089684, + 0.2101118416, + 0.2161068022, + 0.2220936269, + 0.2280720919, + 0.2340419590, + 0.2400030345, + 0.2459550500, + 0.2518978119, + 0.2578310966, + 0.2637546957, + 0.2696683407, + 0.2755718231, + 0.2814649343, + 0.2873474658, + 0.2932191789, + 0.2990798354, + 0.3049292266, + 0.3107671738, + 0.3165933788, + 0.3224076927, + 0.3282098472, + 0.3339996636, + 0.3397769034, + 0.3455413282, + 0.3512927592, + 0.3570309579, + 0.3627557456, + 0.3684668541, + 0.3741640747, + 0.3798472285, + 0.3855160773, + 0.3911703825, + 0.3968099952, + 0.4024346471, + 0.4080441594, + 0.4136383235, + 0.4192169011, + 0.4247796834, + 0.4303264916, + 0.4358570874, + 0.4413712919, + 0.4468688369, + 0.4523496032, + 0.4578133225, + 0.4632597864, + 0.4686888456, + 0.4741002321, + 0.4794937670, + 0.4848692715, + 0.4902265072, + 0.4955652654, + 0.5008853674, + 0.5061866641, + 0.5114688873, + 0.5167317986, + 0.5219752789, + 0.5271991491, + 0.5324031115, + 0.5375871062, + 0.5427507758, + 0.5478940606, + 0.5530167222, + 0.5581185222, + 0.5631993413, + 0.5682589412, + 0.5732972026, + 0.5783138275, + 0.5833086967, + 0.5882815719, + 0.5932323337, + 0.5981607437, + 0.6030666232, + 0.6079497933, + 0.6128100753, + 0.6176473498, + 0.6224613190, + 0.6272518039, + 0.6320187449, + 0.6367619038, + 0.6414810419, + 0.6461760402, + 0.6508467197, + 0.6554928422, + 0.6601143479, + 0.6647109985, + 0.6692826152, + 0.6738290191, + 0.6783500314, + 0.6828455329, + 0.6873153448, + 0.6917592883, + 0.6961771250, + 0.7005687952, + 0.7049341202, + 0.7092728615, + 0.7135848999, + 0.7178700566, + 0.7221282125, + 0.7263591886, + 0.7305628061, + 0.7347388864, + 0.7388873696, + 0.7430079579, + 0.7471006513, + 0.7511651516, + 0.7552013993, + 0.7592092156, + 0.7631884217, + 0.7671388984, + 0.7710605264, + 0.7749531269, + 0.7788165212, + 0.7826505899, + 0.7864552140, + 0.7902302146, + 0.7939754725, + 0.7976908684, + 0.8013761640, + 0.8050313592, + 0.8086562157, + 0.8122506142, + 0.8158144355, + 0.8193475604, + 0.8228498101, + 0.8263210654, + 0.8297612667, + 0.8331701756, + 0.8365477324, + 0.8398938179, + 0.8432082534, + 0.8464909792, + 0.8497417569, + 0.8529606462, + 0.8561473489, + 0.8593018055, + 0.8624239564, + 0.8655136228, + 0.8685707450, + 0.8715950847, + 0.8745866418, + 0.8775452971, + 0.8804709315, + 0.8833633661, + 0.8862225413, + 0.8890483975, + 0.8918406963, + 0.8945994973, + 0.8973246217, + 0.9000158906, + 0.9026733041, + 0.9052967429, + 0.9078861475, + 0.9104412794, + 0.9129621983, + 0.9154487252, + 0.9179008007, + 0.9203183055, + 0.9227011204, + 0.9250492454, + 0.9273625612, + 0.9296408892, + 0.9318842888, + 0.9340925813, + 0.9362657070, + 0.9384035468, + 0.9405061007, + 0.9425731897, + 0.9446048737, + 0.9466009140, + 0.9485613704, + 0.9504860640, + 0.9523749948, + 0.9542281032, + 0.9560452700, + 0.9578264356, + 0.9595715404, + 0.9612805247, + 0.9629532695, + 0.9645897746, + 0.9661900401, + 0.9677538276, + 0.9692812562, + 0.9707721472, + 0.9722265005, + 0.9736442566, + 0.9750253558, + 0.9763697386, + 0.9776773453, + 0.9789481759, + 0.9801821709, + 0.9813792109, + 0.9825392962, + 0.9836624265, + 0.9847484827, + 0.9857975245, + 0.9868094325, + 0.9877841473, + 0.9887216687, + 0.9896219969, + 0.9904850721, + 0.9913108945, + 0.9920993447, + 0.9928504229, + 0.9935641289, + 0.9942404628, + 0.9948793054, + 0.9954807758, + 0.9960446954, + 0.9965711236, + 0.9970600605, + 0.9975114465, + 0.9979252815, + 0.9983015656, + 0.9986402392, + 0.9989413023, + 0.9992047548, + 0.9994305968, + 0.9996188283, + 0.9997693896, + 0.9998823404, + 0.9999576211, + 0.9999952912 +}; + +static real_t kbd_short_32[] = { + 0.0000875914060105, + 0.0009321760265333, + 0.0032114611466596, + 0.0081009893216786, + 0.0171240286619181, + 0.0320720743527833, + 0.0548307856028528, + 0.0871361822564870, + 0.1302923415174603, + 0.1848955425508276, + 0.2506163195331889, + 0.3260874142923209, + 0.4089316830907141, + 0.4959414909423747, + 0.5833939894958904, + 0.6674601983218376, + 0.7446454751465113, + 0.8121892962974020, + 0.8683559394406505, + 0.9125649996381605, + 0.9453396205809574, + 0.9680864942677585, + 0.9827581789763112, + 0.9914756203467121, + 0.9961964092194694, + 0.9984956609571091, + 0.9994855586984285, + 0.9998533730714648, + 0.9999671864476404, + 0.9999948432453556, + 0.9999995655238333, + 0.9999999961638728 +}; + + +static real_t kbd_long_256[] = { + 0.0005851230124487, + 0.0009642149851497, + 0.0013558207534965, + 0.0017771849644394, + 0.0022352533849672, + 0.0027342299070304, + 0.0032773001022195, + 0.0038671998069216, + 0.0045064443384152, + 0.0051974336885144, + 0.0059425050016407, + 0.0067439602523141, + 0.0076040812644888, + 0.0085251378135895, + 0.0095093917383048, + 0.0105590986429280, + 0.0116765080854300, + 0.0128638627792770, + 0.0141233971318631, + 0.0154573353235409, + 0.0168678890600951, + 0.0183572550877256, + 0.0199276125319803, + 0.0215811201042484, + 0.0233199132076965, + 0.0251461009666641, + 0.0270617631981826, + 0.0290689473405856, + 0.0311696653515848, + 0.0333658905863535, + 0.0356595546648444, + 0.0380525443366107, + 0.0405466983507029, + 0.0431438043376910, + 0.0458455957104702, + 0.0486537485902075, + 0.0515698787635492, + 0.0545955386770205, + 0.0577322144743916, + 0.0609813230826460, + 0.0643442093520723, + 0.0678221432558827, + 0.0714163171546603, + 0.0751278431308314, + 0.0789577503982528, + 0.0829069827918993, + 0.0869763963425241, + 0.0911667569410503, + 0.0954787380973307, + 0.0999129187977865, + 0.1044697814663005, + 0.1091497100326053, + 0.1139529881122542, + 0.1188797973021148, + 0.1239302155951605, + 0.1291042159181728, + 0.1344016647957880, + 0.1398223211441467, + 0.1453658351972151, + 0.1510317475686540, + 0.1568194884519144, + 0.1627283769610327, + 0.1687576206143887, + 0.1749063149634756, + 0.1811734433685097, + 0.1875578769224857, + 0.1940583745250518, + 0.2006735831073503, + 0.2074020380087318, + 0.2142421635060113, + 0.2211922734956977, + 0.2282505723293797, + 0.2354151558022098, + 0.2426840122941792, + 0.2500550240636293, + 0.2575259686921987, + 0.2650945206801527, + 0.2727582531907993, + 0.2805146399424422, + 0.2883610572460804, + 0.2962947861868143, + 0.3043130149466800, + 0.3124128412663888, + 0.3205912750432127, + 0.3288452410620226, + 0.3371715818562547, + 0.3455670606953511, + 0.3540283646950029, + 0.3625521080463003, + 0.3711348353596863, + 0.3797730251194006, + 0.3884630932439016, + 0.3972013967475546, + 0.4059842374986933, + 0.4148078660689724, + 0.4236684856687616, + 0.4325622561631607, + 0.4414852981630577, + 0.4504336971855032, + 0.4594035078775303, + 0.4683907582974173, + 0.4773914542472655, + 0.4864015836506502, + 0.4954171209689973, + 0.5044340316502417, + 0.5134482766032377, + 0.5224558166913167, + 0.5314526172383208, + 0.5404346525403849, + 0.5493979103766972, + 0.5583383965124314, + 0.5672521391870222, + 0.5761351935809411, + 0.5849836462541291, + 0.5937936195492526, + 0.6025612759529649, + 0.6112828224083939, + 0.6199545145721097, + 0.6285726610088878, + 0.6371336273176413, + 0.6456338401819751, + 0.6540697913388968, + 0.6624380414593221, + 0.6707352239341151, + 0.6789580485595255, + 0.6871033051160131, + 0.6951678668345944, + 0.7031486937449871, + 0.7110428359000029, + 0.7188474364707993, + 0.7265597347077880, + 0.7341770687621900, + 0.7416968783634273, + 0.7491167073477523, + 0.7564342060337386, + 0.7636471334404891, + 0.7707533593446514, + 0.7777508661725849, + 0.7846377507242818, + 0.7914122257259034, + 0.7980726212080798, + 0.8046173857073919, + 0.8110450872887550, + 0.8173544143867162, + 0.8235441764639875, + 0.8296133044858474, + 0.8355608512093652, + 0.8413859912867303, + 0.8470880211822968, + 0.8526663589032990, + 0.8581205435445334, + 0.8634502346476508, + 0.8686552113760616, + 0.8737353715068081, + 0.8786907302411250, + 0.8835214188357692, + 0.8882276830575707, + 0.8928098814640207, + 0.8972684835130879, + 0.9016040675058185, + 0.9058173183656508, + 0.9099090252587376, + 0.9138800790599416, + 0.9177314696695282, + 0.9214642831859411, + 0.9250796989403991, + 0.9285789863994010, + 0.9319635019415643, + 0.9352346855155568, + 0.9383940571861993, + 0.9414432135761304, + 0.9443838242107182, + 0.9472176277741918, + 0.9499464282852282, + 0.9525720912004834, + 0.9550965394547873, + 0.9575217494469370, + 0.9598497469802043, + 0.9620826031668507, + 0.9642224303060783, + 0.9662713777449607, + 0.9682316277319895, + 0.9701053912729269, + 0.9718949039986892, + 0.9736024220549734, + 0.9752302180233160, + 0.9767805768831932, + 0.9782557920246753, + 0.9796581613210076, + 0.9809899832703159, + 0.9822535532154261, + 0.9834511596505429, + 0.9845850806232530, + 0.9856575802399989, + 0.9866709052828243, + 0.9876272819448033, + 0.9885289126911557, + 0.9893779732525968, + 0.9901766097569984, + 0.9909269360049311, + 0.9916310308941294, + 0.9922909359973702, + 0.9929086532976777, + 0.9934861430841844, + 0.9940253220113651, + 0.9945280613237534, + 0.9949961852476154, + 0.9954314695504363, + 0.9958356402684387, + 0.9962103726017252, + 0.9965572899760172, + 0.9968779632693499, + 0.9971739102014799, + 0.9974465948831872, + 0.9976974275220812, + 0.9979277642809907, + 0.9981389072844972, + 0.9983321047686901, + 0.9985085513687731, + 0.9986693885387259, + 0.9988157050968516, + 0.9989485378906924, + 0.9990688725744943, + 0.9991776444921379, + 0.9992757396582338, + 0.9993639958299003, + 0.9994432036616085, + 0.9995141079353859, + 0.9995774088586188, + 0.9996337634216871, + 0.9996837868076957, + 0.9997280538466377, + 0.9997671005064359, + 0.9998014254134544, + 0.9998314913952471, + 0.9998577270385304, + 0.9998805282555989, + 0.9999002598526793, + 0.9999172570940037, + 0.9999318272557038, + 0.9999442511639580, + 0.9999547847121726, + 0.9999636603523446, + 0.9999710885561258, + 0.9999772592414866, + 0.9999823431612708, + 0.9999864932503106, + 0.9999898459281599, + 0.9999925223548691, + 0.9999946296375997, + 0.9999962619864214, + 0.9999975018180320, + 0.9999984208055542, + 0.9999990808746198, + 0.9999995351446231, + 0.9999998288155155 +}; + +#ifdef __cplusplus +} +#endif +#endif diff --git a/Libraries/FAAD2/Files/libfaad/structs.h b/Libraries/FAAD2/Files/libfaad/structs.h new file mode 100644 index 000000000..0703a77f9 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/structs.h @@ -0,0 +1,473 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#ifndef __STRUCTS_H__ +#define __STRUCTS_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "cfft.h" +#ifdef SBR_DEC +#include "sbr_dec.h" +#endif + +#define MAX_CHANNELS 64 +#define MAX_SYNTAX_ELEMENTS 48 +#define MAX_WINDOW_GROUPS 8 +#define MAX_SFB 51 +#define MAX_LTP_SFB 40 +#define MAX_LTP_SFB_S 8 + +/* used to save the prediction state */ +typedef struct { + int16_t r[2]; + int16_t COR[2]; + int16_t VAR[2]; +} pred_state; + +typedef struct { + uint16_t N; + cfft_info *cfft; + complex_t *sincos; +#ifdef PROFILE + int64_t cycles; + int64_t fft_cycles; +#endif +} mdct_info; + +typedef struct +{ + const real_t *long_window[2]; + const real_t *short_window[2]; +#ifdef LD_DEC + const real_t *ld_window[2]; +#endif + + mdct_info *mdct256; +#ifdef LD_DEC + mdct_info *mdct1024; +#endif + mdct_info *mdct2048; +#ifdef PROFILE + int64_t cycles; +#endif +} fb_info; + +typedef struct +{ + uint8_t present; + + uint8_t num_bands; + uint8_t pce_instance_tag; + uint8_t excluded_chns_present; + uint8_t band_top[17]; + uint8_t prog_ref_level; + uint8_t dyn_rng_sgn[17]; + uint8_t dyn_rng_ctl[17]; + uint8_t exclude_mask[MAX_CHANNELS]; + uint8_t additional_excluded_chns[MAX_CHANNELS]; + + real_t ctrl1; + real_t ctrl2; +} drc_info; + +typedef struct +{ + uint8_t element_instance_tag; + uint8_t object_type; + uint8_t sf_index; + uint8_t num_front_channel_elements; + uint8_t num_side_channel_elements; + uint8_t num_back_channel_elements; + uint8_t num_lfe_channel_elements; + uint8_t num_assoc_data_elements; + uint8_t num_valid_cc_elements; + uint8_t mono_mixdown_present; + uint8_t mono_mixdown_element_number; + uint8_t stereo_mixdown_present; + uint8_t stereo_mixdown_element_number; + uint8_t matrix_mixdown_idx_present; + uint8_t pseudo_surround_enable; + uint8_t matrix_mixdown_idx; + uint8_t front_element_is_cpe[16]; + uint8_t front_element_tag_select[16]; + uint8_t side_element_is_cpe[16]; + uint8_t side_element_tag_select[16]; + uint8_t back_element_is_cpe[16]; + uint8_t back_element_tag_select[16]; + uint8_t lfe_element_tag_select[16]; + uint8_t assoc_data_element_tag_select[16]; + uint8_t cc_element_is_ind_sw[16]; + uint8_t valid_cc_element_tag_select[16]; + + uint8_t channels; + + uint8_t comment_field_bytes; + uint8_t comment_field_data[257]; + + /* extra added values */ + uint8_t num_front_channels; + uint8_t num_side_channels; + uint8_t num_back_channels; + uint8_t num_lfe_channels; + uint8_t sce_channel[16]; + uint8_t cpe_channel[16]; +} program_config; + +typedef struct +{ + uint16_t syncword; + uint8_t id; + uint8_t layer; + uint8_t protection_absent; + uint8_t profile; + uint8_t sf_index; + uint8_t private_bit; + uint8_t channel_configuration; + uint8_t original; + uint8_t home; + uint8_t emphasis; + uint8_t copyright_identification_bit; + uint8_t copyright_identification_start; + uint16_t aac_frame_length; + uint16_t adts_buffer_fullness; + uint8_t no_raw_data_blocks_in_frame; + uint16_t crc_check; + + /* control param */ + uint8_t old_format; +} adts_header; + +typedef struct +{ + uint8_t copyright_id_present; + int8_t copyright_id[10]; + uint8_t original_copy; + uint8_t home; + uint8_t bitstream_type; + uint32_t bitrate; + uint8_t num_program_config_elements; + uint32_t adif_buffer_fullness; + + /* maximum of 16 PCEs */ + program_config pce[16]; +} adif_header; + +#ifdef LTP_DEC +typedef struct +{ + uint8_t last_band; + uint8_t data_present; + uint16_t lag; + uint8_t lag_update; + uint8_t coef; + uint8_t long_used[MAX_SFB]; + uint8_t short_used[8]; + uint8_t short_lag_present[8]; + uint8_t short_lag[8]; +} ltp_info; +#endif + +#ifdef MAIN_DEC +typedef struct +{ + uint8_t limit; + uint8_t predictor_reset; + uint8_t predictor_reset_group_number; + uint8_t prediction_used[MAX_SFB]; +} pred_info; +#endif + +typedef struct +{ + uint8_t number_pulse; + uint8_t pulse_start_sfb; + uint8_t pulse_offset[4]; + uint8_t pulse_amp[4]; +} pulse_info; + +typedef struct +{ + uint8_t n_filt[8]; + uint8_t coef_res[8]; + uint8_t length[8][4]; + uint8_t order[8][4]; + uint8_t direction[8][4]; + uint8_t coef_compress[8][4]; + uint8_t coef[8][4][32]; +} tns_info; + +#ifdef SSR_DEC +typedef struct +{ + uint8_t max_band; + + uint8_t adjust_num[4][8]; + uint8_t alevcode[4][8][8]; + uint8_t aloccode[4][8][8]; +} ssr_info; +#endif + +typedef struct +{ + uint8_t max_sfb; + + uint8_t num_swb; + uint8_t num_window_groups; + uint8_t num_windows; + uint8_t window_sequence; + uint8_t window_group_length[8]; + uint8_t window_shape; + uint8_t scale_factor_grouping; + uint16_t sect_sfb_offset[8][15*8]; + uint16_t swb_offset[52]; + + uint8_t sect_cb[8][15*8]; + uint16_t sect_start[8][15*8]; + uint16_t sect_end[8][15*8]; + uint8_t sfb_cb[8][8*15]; + uint8_t num_sec[8]; /* number of sections in a group */ + + uint8_t global_gain; + int16_t scale_factors[8][51]; /* [0..255] */ + + uint8_t ms_mask_present; + uint8_t ms_used[MAX_WINDOW_GROUPS][MAX_SFB]; + + uint8_t noise_used; + + uint8_t pulse_data_present; + uint8_t tns_data_present; + uint8_t gain_control_data_present; + uint8_t predictor_data_present; + + pulse_info pul; + tns_info tns; +#ifdef MAIN_DEC + pred_info pred; +#endif +#ifdef LTP_DEC + ltp_info ltp; + ltp_info ltp2; +#endif +#ifdef SSR_DEC + ssr_info ssr; +#endif + +#ifdef ERROR_RESILIENCE + /* ER HCR data */ + uint16_t length_of_reordered_spectral_data; + uint8_t length_of_longest_codeword; + /* ER RLVC data */ + uint8_t sf_concealment; + uint8_t rev_global_gain; + uint16_t length_of_rvlc_sf; + uint16_t dpcm_noise_nrg; + uint8_t sf_escapes_present; + uint8_t length_of_rvlc_escapes; + uint16_t dpcm_noise_last_position; +#endif +} ic_stream; /* individual channel stream */ + +typedef struct +{ + uint8_t channel; + int16_t paired_channel; + + uint8_t element_instance_tag; + uint8_t common_window; + + ic_stream ics1; + ic_stream ics2; +} element; /* syntax element (SCE, CPE, LFE) */ + +typedef struct mp4AudioSpecificConfig +{ + /* Audio Specific Info */ + /*uint8_t*/ unsigned char objectTypeIndex; + /*uint8_t*/ unsigned char samplingFrequencyIndex; + /*uint32_t*/ unsigned long samplingFrequency; + /*uint8_t*/ unsigned char channelsConfiguration; + + /* GA Specific Info */ + /*uint8_t*/ unsigned char frameLengthFlag; + /*uint8_t*/ unsigned char dependsOnCoreCoder; + /*uint16_t*/ unsigned short coreCoderDelay; + /*uint8_t*/ unsigned char extensionFlag; + /*uint8_t*/ unsigned char aacSectionDataResilienceFlag; + /*uint8_t*/ unsigned char aacScalefactorDataResilienceFlag; + /*uint8_t*/ unsigned char aacSpectralDataResilienceFlag; + /*uint8_t*/ unsigned char epConfig; + + /*uint8_t*/ char sbr_present_flag; + /*uint8_t*/ char forceUpSampling; + /*uint8_t*/ char downSampledSBR; +} mp4AudioSpecificConfig; + +typedef struct NeAACDecConfiguration +{ + /*uint8_t*/ unsigned char defObjectType; + /*uint32_t*/ unsigned long defSampleRate; + /*uint8_t*/ unsigned char outputFormat; + /*uint8_t*/ unsigned char downMatrix; + /*uint8_t*/ unsigned char useOldADTSFormat; + /*uint8_t*/ unsigned char dontUpSampleImplicitSBR; +} NeAACDecConfiguration, *NeAACDecConfigurationPtr; + +typedef struct NeAACDecFrameInfo +{ + /*uint32_t*/ unsigned long bytesconsumed; + /*uint32_t*/ unsigned long samples; + /*uint8_t*/ unsigned char channels; + /*uint8_t*/ unsigned char error; + /*uint32_t*/ unsigned long samplerate; + + /* SBR: 0: off, 1: on; normal, 2: on; downsampled */ + /*uint8_t*/ unsigned char sbr; + + /* MPEG-4 ObjectType */ + /*uint8_t*/ unsigned char object_type; + + /* AAC header type; MP4 will be signalled as RAW also */ + /*uint8_t*/ unsigned char header_type; + + /* multichannel configuration */ + /*uint8_t*/ unsigned char num_front_channels; + /*uint8_t*/ unsigned char num_side_channels; + /*uint8_t*/ unsigned char num_back_channels; + /*uint8_t*/ unsigned char num_lfe_channels; + /*uint8_t*/ unsigned char channel_position[MAX_CHANNELS]; + + /* PS: 0: off, 1: on */ + /*uint8_t*/ unsigned char ps; +} NeAACDecFrameInfo; + +typedef struct +{ + uint8_t adts_header_present; + uint8_t adif_header_present; + uint8_t sf_index; + uint8_t object_type; + uint8_t channelConfiguration; +#ifdef ERROR_RESILIENCE + uint8_t aacSectionDataResilienceFlag; + uint8_t aacScalefactorDataResilienceFlag; + uint8_t aacSpectralDataResilienceFlag; +#endif + uint16_t frameLength; + uint8_t postSeekResetFlag; + + uint32_t frame; + + uint8_t downMatrix; + uint8_t upMatrix; + uint8_t first_syn_ele; + uint8_t has_lfe; + /* number of channels in current frame */ + uint8_t fr_channels; + /* number of elements in current frame */ + uint8_t fr_ch_ele; + + /* element_output_channels: + determines the number of channels the element will output + */ + uint8_t element_output_channels[MAX_SYNTAX_ELEMENTS]; + /* element_alloced: + determines whether the data needed for the element is allocated or not + */ + uint8_t element_alloced[MAX_SYNTAX_ELEMENTS]; + /* alloced_channels: + determines the number of channels where output data is allocated for + */ + uint8_t alloced_channels; + + /* output data buffer */ + void *sample_buffer; + + uint8_t window_shape_prev[MAX_CHANNELS]; +#ifdef LTP_DEC + uint16_t ltp_lag[MAX_CHANNELS]; +#endif + fb_info *fb; + drc_info *drc; + + real_t *time_out[MAX_CHANNELS]; + real_t *fb_intermed[MAX_CHANNELS]; + +#ifdef SBR_DEC + int8_t sbr_present_flag; + int8_t forceUpSampling; + int8_t downSampledSBR; + /* determines whether SBR data is allocated for the gives element */ + uint8_t sbr_alloced[MAX_SYNTAX_ELEMENTS]; + + sbr_info *sbr[MAX_SYNTAX_ELEMENTS]; +#endif +#if (defined(PS_DEC) || defined(DRM_PS)) + uint8_t ps_used[MAX_SYNTAX_ELEMENTS]; + uint8_t ps_used_global; +#endif + +#ifdef SSR_DEC + real_t *ssr_overlap[MAX_CHANNELS]; + real_t *prev_fmd[MAX_CHANNELS]; + real_t ipqf_buffer[MAX_CHANNELS][4][96/4]; +#endif + +#ifdef MAIN_DEC + pred_state *pred_stat[MAX_CHANNELS]; +#endif +#ifdef LTP_DEC + int16_t *lt_pred_stat[MAX_CHANNELS]; +#endif + + /* Program Config Element */ + uint8_t pce_set; + program_config pce; + uint8_t element_id[MAX_CHANNELS]; + uint8_t internal_channel[MAX_CHANNELS]; + + /* Configuration data */ + NeAACDecConfiguration config; + +#ifdef PROFILE + int64_t cycles; + int64_t spectral_cycles; + int64_t output_cycles; + int64_t scalefac_cycles; + int64_t requant_cycles; +#endif +} NeAACDecStruct, *NeAACDecHandle; + + + +#ifdef __cplusplus +} +#endif +#endif diff --git a/Libraries/FAAD2/Files/libfaad/syntax.c b/Libraries/FAAD2/Files/libfaad/syntax.c new file mode 100644 index 000000000..1ce086eb4 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/syntax.c @@ -0,0 +1,2330 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +/* + Reads the AAC bitstream as defined in 14496-3 (MPEG-4 Audio) +*/ + +#include "common.h" +#include "structs.h" + +#include +#include + +#include "decoder.h" +#include "syntax.h" +#include "specrec.h" +#include "huffman.h" +#include "bits.h" +#include "pulse.h" +#include "analysis.h" +#include "drc.h" +#ifdef ERROR_RESILIENCE +#include "rvlc.h" +#endif +#ifdef SBR_DEC +#include "sbr_syntax.h" +#endif + + +/* static function declarations */ +static void decode_sce_lfe(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo, bitfile *ld, + uint8_t id_syn_ele); +static void decode_cpe(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo, bitfile *ld, + uint8_t id_syn_ele); +static uint8_t single_lfe_channel_element(NeAACDecHandle hDecoder, bitfile *ld, + uint8_t channel, uint8_t *tag); +static uint8_t channel_pair_element(NeAACDecHandle hDecoder, bitfile *ld, + uint8_t channel, uint8_t *tag); +#ifdef COUPLING_DEC +static uint8_t coupling_channel_element(NeAACDecHandle hDecoder, bitfile *ld); +#endif +static uint16_t data_stream_element(NeAACDecHandle hDecoder, bitfile *ld); +static uint8_t program_config_element(program_config *pce, bitfile *ld); +static uint8_t fill_element(NeAACDecHandle hDecoder, bitfile *ld, drc_info *drc +#ifdef SBR_DEC + ,uint8_t sbr_ele +#endif + ); +static uint8_t individual_channel_stream(NeAACDecHandle hDecoder, element *ele, + bitfile *ld, ic_stream *ics, uint8_t scal_flag, + int16_t *spec_data); +static uint8_t ics_info(NeAACDecHandle hDecoder, ic_stream *ics, bitfile *ld, + uint8_t common_window); +static uint8_t section_data(NeAACDecHandle hDecoder, ic_stream *ics, bitfile *ld); +static uint8_t scale_factor_data(NeAACDecHandle hDecoder, ic_stream *ics, bitfile *ld); +#ifdef SSR_DEC +static void gain_control_data(bitfile *ld, ic_stream *ics); +#endif +static uint8_t spectral_data(NeAACDecHandle hDecoder, ic_stream *ics, bitfile *ld, + int16_t *spectral_data); +static uint16_t extension_payload(bitfile *ld, drc_info *drc, uint16_t count); +static uint8_t pulse_data(ic_stream *ics, pulse_info *pul, bitfile *ld); +static void tns_data(ic_stream *ics, tns_info *tns, bitfile *ld); +#ifdef LTP_DEC +static uint8_t ltp_data(NeAACDecHandle hDecoder, ic_stream *ics, ltp_info *ltp, bitfile *ld); +#endif +static uint8_t adts_fixed_header(adts_header *adts, bitfile *ld); +static void adts_variable_header(adts_header *adts, bitfile *ld); +static void adts_error_check(adts_header *adts, bitfile *ld); +static uint8_t dynamic_range_info(bitfile *ld, drc_info *drc); +static uint8_t excluded_channels(bitfile *ld, drc_info *drc); +#ifdef SCALABLE_DEC +static int8_t aac_scalable_main_header(NeAACDecHandle hDecoder, ic_stream *ics1, ic_stream *ics2, + bitfile *ld, uint8_t this_layer_stereo); +#endif + + +/* Table 4.4.1 */ +int8_t GASpecificConfig(bitfile *ld, mp4AudioSpecificConfig *mp4ASC, + program_config *pce_out) +{ + program_config pce; + + /* 1024 or 960 */ + mp4ASC->frameLengthFlag = faad_get1bit(ld + DEBUGVAR(1,138,"GASpecificConfig(): FrameLengthFlag")); +#ifndef ALLOW_SMALL_FRAMELENGTH + if (mp4ASC->frameLengthFlag == 1) + return -3; +#endif + + mp4ASC->dependsOnCoreCoder = faad_get1bit(ld + DEBUGVAR(1,139,"GASpecificConfig(): DependsOnCoreCoder")); + if (mp4ASC->dependsOnCoreCoder == 1) + { + mp4ASC->coreCoderDelay = (uint16_t)faad_getbits(ld, 14 + DEBUGVAR(1,140,"GASpecificConfig(): CoreCoderDelay")); + } + + mp4ASC->extensionFlag = faad_get1bit(ld DEBUGVAR(1,141,"GASpecificConfig(): ExtensionFlag")); + if (mp4ASC->channelsConfiguration == 0) + { + if (program_config_element(&pce, ld)) + return -3; + //mp4ASC->channelsConfiguration = pce.channels; + + if (pce_out != NULL) + memcpy(pce_out, &pce, sizeof(program_config)); + + /* + if (pce.num_valid_cc_elements) + return -3; + */ + } + +#ifdef ERROR_RESILIENCE + if (mp4ASC->extensionFlag == 1) + { + /* Error resilience not supported yet */ + if (mp4ASC->objectTypeIndex >= ER_OBJECT_START) + { + mp4ASC->aacSectionDataResilienceFlag = faad_get1bit(ld + DEBUGVAR(1,144,"GASpecificConfig(): aacSectionDataResilienceFlag")); + mp4ASC->aacScalefactorDataResilienceFlag = faad_get1bit(ld + DEBUGVAR(1,145,"GASpecificConfig(): aacScalefactorDataResilienceFlag")); + mp4ASC->aacSpectralDataResilienceFlag = faad_get1bit(ld + DEBUGVAR(1,146,"GASpecificConfig(): aacSpectralDataResilienceFlag")); + + /* 1 bit: extensionFlag3 */ + } + } +#endif + + return 0; +} + +/* Table 4.4.2 */ +/* An MPEG-4 Audio decoder is only required to follow the Program + Configuration Element in GASpecificConfig(). The decoder shall ignore + any Program Configuration Elements that may occur in raw data blocks. + PCEs transmitted in raw data blocks cannot be used to convey decoder + configuration information. +*/ +static uint8_t program_config_element(program_config *pce, bitfile *ld) +{ + uint8_t i; + + memset(pce, 0, sizeof(program_config)); + + pce->channels = 0; + + pce->element_instance_tag = (uint8_t)faad_getbits(ld, 4 + DEBUGVAR(1,10,"program_config_element(): element_instance_tag")); + + pce->object_type = (uint8_t)faad_getbits(ld, 2 + DEBUGVAR(1,11,"program_config_element(): object_type")); + pce->sf_index = (uint8_t)faad_getbits(ld, 4 + DEBUGVAR(1,12,"program_config_element(): sf_index")); + pce->num_front_channel_elements = (uint8_t)faad_getbits(ld, 4 + DEBUGVAR(1,13,"program_config_element(): num_front_channel_elements")); + pce->num_side_channel_elements = (uint8_t)faad_getbits(ld, 4 + DEBUGVAR(1,14,"program_config_element(): num_side_channel_elements")); + pce->num_back_channel_elements = (uint8_t)faad_getbits(ld, 4 + DEBUGVAR(1,15,"program_config_element(): num_back_channel_elements")); + pce->num_lfe_channel_elements = (uint8_t)faad_getbits(ld, 2 + DEBUGVAR(1,16,"program_config_element(): num_lfe_channel_elements")); + pce->num_assoc_data_elements = (uint8_t)faad_getbits(ld, 3 + DEBUGVAR(1,17,"program_config_element(): num_assoc_data_elements")); + pce->num_valid_cc_elements = (uint8_t)faad_getbits(ld, 4 + DEBUGVAR(1,18,"program_config_element(): num_valid_cc_elements")); + + pce->mono_mixdown_present = faad_get1bit(ld + DEBUGVAR(1,19,"program_config_element(): mono_mixdown_present")); + if (pce->mono_mixdown_present == 1) + { + pce->mono_mixdown_element_number = (uint8_t)faad_getbits(ld, 4 + DEBUGVAR(1,20,"program_config_element(): mono_mixdown_element_number")); + } + + pce->stereo_mixdown_present = faad_get1bit(ld + DEBUGVAR(1,21,"program_config_element(): stereo_mixdown_present")); + if (pce->stereo_mixdown_present == 1) + { + pce->stereo_mixdown_element_number = (uint8_t)faad_getbits(ld, 4 + DEBUGVAR(1,22,"program_config_element(): stereo_mixdown_element_number")); + } + + pce->matrix_mixdown_idx_present = faad_get1bit(ld + DEBUGVAR(1,23,"program_config_element(): matrix_mixdown_idx_present")); + if (pce->matrix_mixdown_idx_present == 1) + { + pce->matrix_mixdown_idx = (uint8_t)faad_getbits(ld, 2 + DEBUGVAR(1,24,"program_config_element(): matrix_mixdown_idx")); + pce->pseudo_surround_enable = faad_get1bit(ld + DEBUGVAR(1,25,"program_config_element(): pseudo_surround_enable")); + } + + for (i = 0; i < pce->num_front_channel_elements; i++) + { + pce->front_element_is_cpe[i] = faad_get1bit(ld + DEBUGVAR(1,26,"program_config_element(): front_element_is_cpe")); + pce->front_element_tag_select[i] = (uint8_t)faad_getbits(ld, 4 + DEBUGVAR(1,27,"program_config_element(): front_element_tag_select")); + + if (pce->front_element_is_cpe[i] & 1) + { + pce->cpe_channel[pce->front_element_tag_select[i]] = pce->channels; + pce->num_front_channels += 2; + pce->channels += 2; + } else { + pce->sce_channel[pce->front_element_tag_select[i]] = pce->channels; + pce->num_front_channels++; + pce->channels++; + } + } + + for (i = 0; i < pce->num_side_channel_elements; i++) + { + pce->side_element_is_cpe[i] = faad_get1bit(ld + DEBUGVAR(1,28,"program_config_element(): side_element_is_cpe")); + pce->side_element_tag_select[i] = (uint8_t)faad_getbits(ld, 4 + DEBUGVAR(1,29,"program_config_element(): side_element_tag_select")); + + if (pce->side_element_is_cpe[i] & 1) + { + pce->cpe_channel[pce->side_element_tag_select[i]] = pce->channels; + pce->num_side_channels += 2; + pce->channels += 2; + } else { + pce->sce_channel[pce->side_element_tag_select[i]] = pce->channels; + pce->num_side_channels++; + pce->channels++; + } + } + + for (i = 0; i < pce->num_back_channel_elements; i++) + { + pce->back_element_is_cpe[i] = faad_get1bit(ld + DEBUGVAR(1,30,"program_config_element(): back_element_is_cpe")); + pce->back_element_tag_select[i] = (uint8_t)faad_getbits(ld, 4 + DEBUGVAR(1,31,"program_config_element(): back_element_tag_select")); + + if (pce->back_element_is_cpe[i] & 1) + { + pce->cpe_channel[pce->back_element_tag_select[i]] = pce->channels; + pce->channels += 2; + pce->num_back_channels += 2; + } else { + pce->sce_channel[pce->back_element_tag_select[i]] = pce->channels; + pce->num_back_channels++; + pce->channels++; + } + } + + for (i = 0; i < pce->num_lfe_channel_elements; i++) + { + pce->lfe_element_tag_select[i] = (uint8_t)faad_getbits(ld, 4 + DEBUGVAR(1,32,"program_config_element(): lfe_element_tag_select")); + + pce->sce_channel[pce->lfe_element_tag_select[i]] = pce->channels; + pce->num_lfe_channels++; + pce->channels++; + } + + for (i = 0; i < pce->num_assoc_data_elements; i++) + pce->assoc_data_element_tag_select[i] = (uint8_t)faad_getbits(ld, 4 + DEBUGVAR(1,33,"program_config_element(): assoc_data_element_tag_select")); + + for (i = 0; i < pce->num_valid_cc_elements; i++) + { + pce->cc_element_is_ind_sw[i] = faad_get1bit(ld + DEBUGVAR(1,34,"program_config_element(): cc_element_is_ind_sw")); + pce->valid_cc_element_tag_select[i] = (uint8_t)faad_getbits(ld, 4 + DEBUGVAR(1,35,"program_config_element(): valid_cc_element_tag_select")); + } + + faad_byte_align(ld); + + pce->comment_field_bytes = (uint8_t)faad_getbits(ld, 8 + DEBUGVAR(1,36,"program_config_element(): comment_field_bytes")); + + for (i = 0; i < pce->comment_field_bytes; i++) + { + pce->comment_field_data[i] = (uint8_t)faad_getbits(ld, 8 + DEBUGVAR(1,37,"program_config_element(): comment_field_data")); + } + pce->comment_field_data[i] = 0; + + if (pce->channels > MAX_CHANNELS) + return 22; + + return 0; +} + +static void decode_sce_lfe(NeAACDecHandle hDecoder, + NeAACDecFrameInfo *hInfo, bitfile *ld, + uint8_t id_syn_ele) +{ + uint8_t channels = hDecoder->fr_channels; + uint8_t tag = 0; + + if (channels+1 > MAX_CHANNELS) + { + hInfo->error = 12; + return; + } + if (hDecoder->fr_ch_ele+1 > MAX_SYNTAX_ELEMENTS) + { + hInfo->error = 13; + return; + } + + /* for SCE hDecoder->element_output_channels[] is not set here because this + can become 2 when some form of Parametric Stereo coding is used + */ + + /* save the syntax element id */ + hDecoder->element_id[hDecoder->fr_ch_ele] = id_syn_ele; + + /* decode the element */ + hInfo->error = single_lfe_channel_element(hDecoder, ld, channels, &tag); + + /* map output channels position to internal data channels */ + if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] == 2) + { + /* this might be faulty when pce_set is true */ + hDecoder->internal_channel[channels] = channels; + hDecoder->internal_channel[channels+1] = channels+1; + } else { + if (hDecoder->pce_set) + hDecoder->internal_channel[hDecoder->pce.sce_channel[tag]] = channels; + else + hDecoder->internal_channel[channels] = channels; + } + + hDecoder->fr_channels += hDecoder->element_output_channels[hDecoder->fr_ch_ele]; + hDecoder->fr_ch_ele++; +} + +static void decode_cpe(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo, bitfile *ld, + uint8_t id_syn_ele) +{ + uint8_t channels = hDecoder->fr_channels; + uint8_t tag = 0; + + if (channels+2 > MAX_CHANNELS) + { + hInfo->error = 12; + return; + } + if (hDecoder->fr_ch_ele+1 > MAX_SYNTAX_ELEMENTS) + { + hInfo->error = 13; + return; + } + + /* for CPE the number of output channels is always 2 */ + if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] == 0) + { + /* element_output_channels not set yet */ + hDecoder->element_output_channels[hDecoder->fr_ch_ele] = 2; + } else if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] != 2) { + /* element inconsistency */ + hInfo->error = 21; + return; + } + + /* save the syntax element id */ + hDecoder->element_id[hDecoder->fr_ch_ele] = id_syn_ele; + + /* decode the element */ + hInfo->error = channel_pair_element(hDecoder, ld, channels, &tag); + + /* map output channel position to internal data channels */ + if (hDecoder->pce_set) + { + hDecoder->internal_channel[hDecoder->pce.cpe_channel[tag]] = channels; + hDecoder->internal_channel[hDecoder->pce.cpe_channel[tag]+1] = channels+1; + } else { + hDecoder->internal_channel[channels] = channels; + hDecoder->internal_channel[channels+1] = channels+1; + } + + hDecoder->fr_channels += 2; + hDecoder->fr_ch_ele++; +} + +void raw_data_block(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo, + bitfile *ld, program_config *pce, drc_info *drc) +{ + uint8_t id_syn_ele; + + hDecoder->fr_channels = 0; + hDecoder->fr_ch_ele = 0; + hDecoder->first_syn_ele = 25; + hDecoder->has_lfe = 0; + +#ifdef ERROR_RESILIENCE + if (hDecoder->object_type < ER_OBJECT_START) + { +#endif + /* Table 4.4.3: raw_data_block() */ + while ((id_syn_ele = (uint8_t)faad_getbits(ld, LEN_SE_ID + DEBUGVAR(1,4,"NeAACDecDecode(): id_syn_ele"))) != ID_END) + { + switch (id_syn_ele) { + case ID_SCE: + if (hDecoder->first_syn_ele == 25) hDecoder->first_syn_ele = id_syn_ele; + decode_sce_lfe(hDecoder, hInfo, ld, id_syn_ele); + if (hInfo->error > 0) + return; + break; + case ID_CPE: + if (hDecoder->first_syn_ele == 25) hDecoder->first_syn_ele = id_syn_ele; + decode_cpe(hDecoder, hInfo, ld, id_syn_ele); + if (hInfo->error > 0) + return; + break; + case ID_LFE: + hDecoder->has_lfe++; + decode_sce_lfe(hDecoder, hInfo, ld, id_syn_ele); + if (hInfo->error > 0) + return; + break; + case ID_CCE: /* not implemented yet, but skip the bits */ +#ifdef COUPLING_DEC + hInfo->error = coupling_channel_element(hDecoder, ld); +#else + hInfo->error = 6; +#endif + if (hInfo->error > 0) + return; + break; + case ID_DSE: + data_stream_element(hDecoder, ld); + break; + case ID_PCE: + /* 14496-4: 5.6.4.1.2.1.3: */ + /* program_configuration_element()'s in access units shall be ignored */ + program_config_element(pce, ld); + //if ((hInfo->error = program_config_element(pce, ld)) > 0) + // return; + //hDecoder->pce_set = 1; + break; + case ID_FIL: + /* one sbr_info describes a channel_element not a channel! */ + /* if we encounter SBR data here: error */ + /* SBR data will be read directly in the SCE/LFE/CPE element */ + if ((hInfo->error = fill_element(hDecoder, ld, drc +#ifdef SBR_DEC + , INVALID_SBR_ELEMENT +#endif + )) > 0) + return; + break; + } + } +#ifdef ERROR_RESILIENCE + } else { + /* Table 262: er_raw_data_block() */ + switch (hDecoder->channelConfiguration) + { + case 1: + decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE); + if (hInfo->error > 0) + return; + break; + case 2: + decode_cpe(hDecoder, hInfo, ld, ID_CPE); + if (hInfo->error > 0) + return; + break; + case 3: + decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE); + decode_cpe(hDecoder, hInfo, ld, ID_CPE); + if (hInfo->error > 0) + return; + break; + case 4: + decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE); + decode_cpe(hDecoder, hInfo, ld, ID_CPE); + decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE); + if (hInfo->error > 0) + return; + break; + case 5: + decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE); + decode_cpe(hDecoder, hInfo, ld, ID_CPE); + decode_cpe(hDecoder, hInfo, ld, ID_CPE); + if (hInfo->error > 0) + return; + break; + case 6: + decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE); + decode_cpe(hDecoder, hInfo, ld, ID_CPE); + decode_cpe(hDecoder, hInfo, ld, ID_CPE); + decode_sce_lfe(hDecoder, hInfo, ld, ID_LFE); + if (hInfo->error > 0) + return; + break; + case 7: /* 8 channels */ + decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE); + decode_cpe(hDecoder, hInfo, ld, ID_CPE); + decode_cpe(hDecoder, hInfo, ld, ID_CPE); + decode_cpe(hDecoder, hInfo, ld, ID_CPE); + decode_sce_lfe(hDecoder, hInfo, ld, ID_LFE); + if (hInfo->error > 0) + return; + break; + default: + hInfo->error = 7; + return; + } +#if 0 + cnt = bits_to_decode() / 8; + while (cnt >= 1) + { + cnt -= extension_payload(cnt); + } +#endif + } +#endif + + /* new in corrigendum 14496-3:2002 */ +#ifdef DRM + if (hDecoder->object_type != DRM_ER_LC) +#endif + { + faad_byte_align(ld); + } + + return; +} + +/* Table 4.4.4 and */ +/* Table 4.4.9 */ +static uint8_t single_lfe_channel_element(NeAACDecHandle hDecoder, bitfile *ld, + uint8_t channel, uint8_t *tag) +{ + uint8_t retval = 0; + element sce = {0}; + ic_stream *ics = &(sce.ics1); + ALIGN int16_t spec_data[1024] = {0}; + + sce.element_instance_tag = (uint8_t)faad_getbits(ld, LEN_TAG + DEBUGVAR(1,38,"single_lfe_channel_element(): element_instance_tag")); + + *tag = sce.element_instance_tag; + sce.channel = channel; + sce.paired_channel = -1; + + retval = individual_channel_stream(hDecoder, &sce, ld, ics, 0, spec_data); + if (retval > 0) + return retval; + +#ifdef SBR_DEC + /* check if next bitstream element is a fill element */ + /* if so, read it now so SBR decoding can be done in case of a file with SBR */ + if (faad_showbits(ld, LEN_SE_ID) == ID_FIL) + { + faad_flushbits(ld, LEN_SE_ID); + + /* one sbr_info describes a channel_element not a channel! */ + if ((retval = fill_element(hDecoder, ld, hDecoder->drc, hDecoder->fr_ch_ele)) > 0) + { + return retval; + } + } +#endif + + /* noiseless coding is done, spectral reconstruction is done now */ + retval = reconstruct_single_channel(hDecoder, ics, &sce, spec_data); + if (retval > 0) + return retval; + + return 0; +} + +/* Table 4.4.5 */ +static uint8_t channel_pair_element(NeAACDecHandle hDecoder, bitfile *ld, + uint8_t channels, uint8_t *tag) +{ + ALIGN int16_t spec_data1[1024] = {0}; + ALIGN int16_t spec_data2[1024] = {0}; + element cpe = {0}; + ic_stream *ics1 = &(cpe.ics1); + ic_stream *ics2 = &(cpe.ics2); + uint8_t result; + + cpe.channel = channels; + cpe.paired_channel = channels+1; + + cpe.element_instance_tag = (uint8_t)faad_getbits(ld, LEN_TAG + DEBUGVAR(1,39,"channel_pair_element(): element_instance_tag")); + *tag = cpe.element_instance_tag; + + if ((cpe.common_window = faad_get1bit(ld + DEBUGVAR(1,40,"channel_pair_element(): common_window"))) & 1) + { + /* both channels have common ics information */ + if ((result = ics_info(hDecoder, ics1, ld, cpe.common_window)) > 0) + return result; + + ics1->ms_mask_present = (uint8_t)faad_getbits(ld, 2 + DEBUGVAR(1,41,"channel_pair_element(): ms_mask_present")); + if (ics1->ms_mask_present == 1) + { + uint8_t g, sfb; + for (g = 0; g < ics1->num_window_groups; g++) + { + for (sfb = 0; sfb < ics1->max_sfb; sfb++) + { + ics1->ms_used[g][sfb] = faad_get1bit(ld + DEBUGVAR(1,42,"channel_pair_element(): faad_get1bit")); + } + } + } + +#ifdef ERROR_RESILIENCE + if ((hDecoder->object_type >= ER_OBJECT_START) && (ics1->predictor_data_present)) + { + if (( +#ifdef LTP_DEC + ics1->ltp.data_present = +#endif + faad_get1bit(ld DEBUGVAR(1,50,"channel_pair_element(): ltp.data_present"))) & 1) + { +#ifdef LTP_DEC + if ((result = ltp_data(hDecoder, ics1, &(ics1->ltp), ld)) > 0) + { + return result; + } +#else + return 26; +#endif + } + } +#endif + + memcpy(ics2, ics1, sizeof(ic_stream)); + } else { + ics1->ms_mask_present = 0; + } + + if ((result = individual_channel_stream(hDecoder, &cpe, ld, ics1, + 0, spec_data1)) > 0) + { + return result; + } + +#ifdef ERROR_RESILIENCE + if (cpe.common_window && (hDecoder->object_type >= ER_OBJECT_START) && + (ics1->predictor_data_present)) + { + if (( +#ifdef LTP_DEC + ics1->ltp2.data_present = +#endif + faad_get1bit(ld DEBUGVAR(1,50,"channel_pair_element(): ltp.data_present"))) & 1) + { +#ifdef LTP_DEC + if ((result = ltp_data(hDecoder, ics1, &(ics1->ltp2), ld)) > 0) + { + return result; + } +#else + return 26; +#endif + } + } +#endif + + if ((result = individual_channel_stream(hDecoder, &cpe, ld, ics2, + 0, spec_data2)) > 0) + { + return result; + } + +#ifdef SBR_DEC + /* check if next bitstream element is a fill element */ + /* if so, read it now so SBR decoding can be done in case of a file with SBR */ + if (faad_showbits(ld, LEN_SE_ID) == ID_FIL) + { + faad_flushbits(ld, LEN_SE_ID); + + /* one sbr_info describes a channel_element not a channel! */ + if ((result = fill_element(hDecoder, ld, hDecoder->drc, hDecoder->fr_ch_ele)) > 0) + { + return result; + } + } +#endif + + /* noiseless coding is done, spectral reconstruction is done now */ + if ((result = reconstruct_channel_pair(hDecoder, ics1, ics2, &cpe, + spec_data1, spec_data2)) > 0) + { + return result; + } + + return 0; +} + +/* Table 4.4.6 */ +static uint8_t ics_info(NeAACDecHandle hDecoder, ic_stream *ics, bitfile *ld, + uint8_t common_window) +{ + uint8_t retval = 0; + + /* ics->ics_reserved_bit = */ faad_get1bit(ld + DEBUGVAR(1,43,"ics_info(): ics_reserved_bit")); + ics->window_sequence = (uint8_t)faad_getbits(ld, 2 + DEBUGVAR(1,44,"ics_info(): window_sequence")); + ics->window_shape = faad_get1bit(ld + DEBUGVAR(1,45,"ics_info(): window_shape")); + + if (ics->window_sequence == EIGHT_SHORT_SEQUENCE) + { + ics->max_sfb = (uint8_t)faad_getbits(ld, 4 + DEBUGVAR(1,46,"ics_info(): max_sfb (short)")); + ics->scale_factor_grouping = (uint8_t)faad_getbits(ld, 7 + DEBUGVAR(1,47,"ics_info(): scale_factor_grouping")); + } else { + ics->max_sfb = (uint8_t)faad_getbits(ld, 6 + DEBUGVAR(1,48,"ics_info(): max_sfb (long)")); + } + + /* get the grouping information */ + if ((retval = window_grouping_info(hDecoder, ics)) > 0) + return retval; + + /* should be an error */ + /* check the range of max_sfb */ + if (ics->max_sfb > ics->num_swb) + return 16; + + if (ics->window_sequence != EIGHT_SHORT_SEQUENCE) + { + if ((ics->predictor_data_present = faad_get1bit(ld + DEBUGVAR(1,49,"ics_info(): predictor_data_present"))) & 1) + { + if (hDecoder->object_type == MAIN) /* MPEG2 style AAC predictor */ + { + uint8_t sfb; + + uint8_t limit = min(ics->max_sfb, max_pred_sfb(hDecoder->sf_index)); +#ifdef MAIN_DEC + ics->pred.limit = limit; +#endif + + if (( +#ifdef MAIN_DEC + ics->pred.predictor_reset = +#endif + faad_get1bit(ld DEBUGVAR(1,53,"ics_info(): pred.predictor_reset"))) & 1) + { +#ifdef MAIN_DEC + ics->pred.predictor_reset_group_number = +#endif + (uint8_t)faad_getbits(ld, 5 DEBUGVAR(1,54,"ics_info(): pred.predictor_reset_group_number")); + } + + for (sfb = 0; sfb < limit; sfb++) + { +#ifdef MAIN_DEC + ics->pred.prediction_used[sfb] = +#endif + faad_get1bit(ld DEBUGVAR(1,55,"ics_info(): pred.prediction_used")); + } + } +#ifdef LTP_DEC + else { /* Long Term Prediction */ + if (hDecoder->object_type < ER_OBJECT_START) + { + if ((ics->ltp.data_present = faad_get1bit(ld + DEBUGVAR(1,50,"ics_info(): ltp.data_present"))) & 1) + { + if ((retval = ltp_data(hDecoder, ics, &(ics->ltp), ld)) > 0) + { + return retval; + } + } + if (common_window) + { + if ((ics->ltp2.data_present = faad_get1bit(ld + DEBUGVAR(1,51,"ics_info(): ltp2.data_present"))) & 1) + { + if ((retval = ltp_data(hDecoder, ics, &(ics->ltp2), ld)) > 0) + { + return retval; + } + } + } + } +#ifdef ERROR_RESILIENCE + if (!common_window && (hDecoder->object_type >= ER_OBJECT_START)) + { + if ((ics->ltp.data_present = faad_get1bit(ld + DEBUGVAR(1,50,"ics_info(): ltp.data_present"))) & 1) + { + ltp_data(hDecoder, ics, &(ics->ltp), ld); + } + } +#endif + } +#endif + } + } + + return retval; +} + +/* Table 4.4.7 */ +static uint8_t pulse_data(ic_stream *ics, pulse_info *pul, bitfile *ld) +{ + uint8_t i; + + pul->number_pulse = (uint8_t)faad_getbits(ld, 2 + DEBUGVAR(1,56,"pulse_data(): number_pulse")); + pul->pulse_start_sfb = (uint8_t)faad_getbits(ld, 6 + DEBUGVAR(1,57,"pulse_data(): pulse_start_sfb")); + + /* check the range of pulse_start_sfb */ + if (pul->pulse_start_sfb > ics->num_swb) + return 16; + + for (i = 0; i < pul->number_pulse+1; i++) + { + pul->pulse_offset[i] = (uint8_t)faad_getbits(ld, 5 + DEBUGVAR(1,58,"pulse_data(): pulse_offset")); +#if 0 + printf("%d\n", pul->pulse_offset[i]); +#endif + pul->pulse_amp[i] = (uint8_t)faad_getbits(ld, 4 + DEBUGVAR(1,59,"pulse_data(): pulse_amp")); +#if 0 + printf("%d\n", pul->pulse_amp[i]); +#endif + } + + return 0; +} + +#ifdef COUPLING_DEC +/* Table 4.4.8: Currently just for skipping the bits... */ +static uint8_t coupling_channel_element(NeAACDecHandle hDecoder, bitfile *ld) +{ + uint8_t c, result = 0; + uint8_t ind_sw_cce_flag = 0; + uint8_t num_gain_element_lists = 0; + uint8_t num_coupled_elements = 0; + + element el_empty = {0}; + ic_stream ics_empty = {0}; + int16_t sh_data[1024]; + + c = faad_getbits(ld, LEN_TAG + DEBUGVAR(1,900,"coupling_channel_element(): element_instance_tag")); + + ind_sw_cce_flag = faad_get1bit(ld + DEBUGVAR(1,901,"coupling_channel_element(): ind_sw_cce_flag")); + num_coupled_elements = faad_getbits(ld, 3 + DEBUGVAR(1,902,"coupling_channel_element(): num_coupled_elements")); + + for (c = 0; c < num_coupled_elements + 1; c++) + { + uint8_t cc_target_is_cpe, cc_target_tag_select; + + num_gain_element_lists++; + + cc_target_is_cpe = faad_get1bit(ld + DEBUGVAR(1,903,"coupling_channel_element(): cc_target_is_cpe")); + cc_target_tag_select = faad_getbits(ld, 4 + DEBUGVAR(1,904,"coupling_channel_element(): cc_target_tag_select")); + + if (cc_target_is_cpe) + { + uint8_t cc_l = faad_get1bit(ld + DEBUGVAR(1,905,"coupling_channel_element(): cc_l")); + uint8_t cc_r = faad_get1bit(ld + DEBUGVAR(1,906,"coupling_channel_element(): cc_r")); + + if (cc_l && cc_r) + num_gain_element_lists++; + } + } + + faad_get1bit(ld + DEBUGVAR(1,907,"coupling_channel_element(): cc_domain")); + faad_get1bit(ld + DEBUGVAR(1,908,"coupling_channel_element(): gain_element_sign")); + faad_getbits(ld, 2 + DEBUGVAR(1,909,"coupling_channel_element(): gain_element_scale")); + + if ((result = individual_channel_stream(hDecoder, &el_empty, ld, &ics_empty, + 0, sh_data)) > 0) + { + return result; + } + + for (c = 1; c < num_gain_element_lists; c++) + { + uint8_t cge; + + if (ind_sw_cce_flag) + { + cge = 1; + } else { + cge = faad_get1bit(ld + DEBUGVAR(1,910,"coupling_channel_element(): common_gain_element_present")); + } + + if (cge) + { + huffman_scale_factor(ld); + } else { + uint8_t g, sfb; + + for (g = 0; g < ics_empty.num_window_groups; g++) + { + for (sfb = 0; sfb < ics_empty.max_sfb; sfb++) + { + if (ics_empty.sfb_cb[g][sfb] != ZERO_HCB) + huffman_scale_factor(ld); + } + } + } + } + + return 0; +} +#endif + +/* Table 4.4.10 */ +static uint16_t data_stream_element(NeAACDecHandle hDecoder, bitfile *ld) +{ + uint8_t byte_aligned; + uint16_t i, count; + + /* element_instance_tag = */ faad_getbits(ld, LEN_TAG + DEBUGVAR(1,60,"data_stream_element(): element_instance_tag")); + byte_aligned = faad_get1bit(ld + DEBUGVAR(1,61,"data_stream_element(): byte_aligned")); + count = (uint16_t)faad_getbits(ld, 8 + DEBUGVAR(1,62,"data_stream_element(): count")); + if (count == 255) + { + count += (uint16_t)faad_getbits(ld, 8 + DEBUGVAR(1,63,"data_stream_element(): extra count")); + } + if (byte_aligned) + faad_byte_align(ld); + + for (i = 0; i < count; i++) + { + faad_getbits(ld, LEN_BYTE + DEBUGVAR(1,64,"data_stream_element(): data_stream_byte")); + } + + return count; +} + +/* Table 4.4.11 */ +static uint8_t fill_element(NeAACDecHandle hDecoder, bitfile *ld, drc_info *drc +#ifdef SBR_DEC + ,uint8_t sbr_ele +#endif + ) +{ + uint16_t count; +#ifdef SBR_DEC + uint8_t bs_extension_type; +#endif + + count = (uint16_t)faad_getbits(ld, 4 + DEBUGVAR(1,65,"fill_element(): count")); + if (count == 15) + { + count += (uint16_t)faad_getbits(ld, 8 + DEBUGVAR(1,66,"fill_element(): extra count")) - 1; + } + + if (count > 0) + { +#ifdef SBR_DEC + bs_extension_type = (uint8_t)faad_showbits(ld, 4); + + if ((bs_extension_type == EXT_SBR_DATA) || + (bs_extension_type == EXT_SBR_DATA_CRC)) + { + if (sbr_ele == INVALID_SBR_ELEMENT) + return 24; + + if (!hDecoder->sbr[sbr_ele]) + { + hDecoder->sbr[sbr_ele] = sbrDecodeInit(hDecoder->frameLength, + hDecoder->element_id[sbr_ele], 2*get_sample_rate(hDecoder->sf_index), + hDecoder->downSampledSBR +#ifdef DRM + , 0 +#endif + ); + } + + hDecoder->sbr_present_flag = 1; + + /* parse the SBR data */ + hDecoder->sbr[sbr_ele]->ret = sbr_extension_data(ld, hDecoder->sbr[sbr_ele], count); + +#if 0 + if (hDecoder->sbr[sbr_ele]->ret > 0) + { + printf("%s\n", NeAACDecGetErrorMessage(hDecoder->sbr[sbr_ele]->ret)); + } +#endif + +#if (defined(PS_DEC) || defined(DRM_PS)) + if (hDecoder->sbr[sbr_ele]->ps_used) + { + hDecoder->ps_used[sbr_ele] = 1; + + /* set element independent flag to 1 as well */ + hDecoder->ps_used_global = 1; + } +#endif + } else { +#endif + while (count > 0) + { + count -= extension_payload(ld, drc, count); + } +#ifdef SBR_DEC + } +#endif + } + + return 0; +} + +/* Table 4.4.12 */ +#ifdef SSR_DEC +static void gain_control_data(bitfile *ld, ic_stream *ics) +{ + uint8_t bd, wd, ad; + ssr_info *ssr = &(ics->ssr); + + ssr->max_band = (uint8_t)faad_getbits(ld, 2 + DEBUGVAR(1,1000,"gain_control_data(): max_band")); + + if (ics->window_sequence == ONLY_LONG_SEQUENCE) + { + for (bd = 1; bd <= ssr->max_band; bd++) + { + for (wd = 0; wd < 1; wd++) + { + ssr->adjust_num[bd][wd] = (uint8_t)faad_getbits(ld, 3 + DEBUGVAR(1,1001,"gain_control_data(): adjust_num")); + + for (ad = 0; ad < ssr->adjust_num[bd][wd]; ad++) + { + ssr->alevcode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 4 + DEBUGVAR(1,1002,"gain_control_data(): alevcode")); + ssr->aloccode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 5 + DEBUGVAR(1,1003,"gain_control_data(): aloccode")); + } + } + } + } else if (ics->window_sequence == LONG_START_SEQUENCE) { + for (bd = 1; bd <= ssr->max_band; bd++) + { + for (wd = 0; wd < 2; wd++) + { + ssr->adjust_num[bd][wd] = (uint8_t)faad_getbits(ld, 3 + DEBUGVAR(1,1001,"gain_control_data(): adjust_num")); + + for (ad = 0; ad < ssr->adjust_num[bd][wd]; ad++) + { + ssr->alevcode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 4 + DEBUGVAR(1,1002,"gain_control_data(): alevcode")); + if (wd == 0) + { + ssr->aloccode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 4 + DEBUGVAR(1,1003,"gain_control_data(): aloccode")); + } else { + ssr->aloccode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 2 + DEBUGVAR(1,1003,"gain_control_data(): aloccode")); + } + } + } + } + } else if (ics->window_sequence == EIGHT_SHORT_SEQUENCE) { + for (bd = 1; bd <= ssr->max_band; bd++) + { + for (wd = 0; wd < 8; wd++) + { + ssr->adjust_num[bd][wd] = (uint8_t)faad_getbits(ld, 3 + DEBUGVAR(1,1001,"gain_control_data(): adjust_num")); + + for (ad = 0; ad < ssr->adjust_num[bd][wd]; ad++) + { + ssr->alevcode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 4 + DEBUGVAR(1,1002,"gain_control_data(): alevcode")); + ssr->aloccode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 2 + DEBUGVAR(1,1003,"gain_control_data(): aloccode")); + } + } + } + } else if (ics->window_sequence == LONG_STOP_SEQUENCE) { + for (bd = 1; bd <= ssr->max_band; bd++) + { + for (wd = 0; wd < 2; wd++) + { + ssr->adjust_num[bd][wd] = (uint8_t)faad_getbits(ld, 3 + DEBUGVAR(1,1001,"gain_control_data(): adjust_num")); + + for (ad = 0; ad < ssr->adjust_num[bd][wd]; ad++) + { + ssr->alevcode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 4 + DEBUGVAR(1,1002,"gain_control_data(): alevcode")); + + if (wd == 0) + { + ssr->aloccode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 4 + DEBUGVAR(1,1003,"gain_control_data(): aloccode")); + } else { + ssr->aloccode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 5 + DEBUGVAR(1,1003,"gain_control_data(): aloccode")); + } + } + } + } + } +} +#endif + +#ifdef SCALABLE_DEC +/* Table 4.4.13 ASME */ +void aac_scalable_main_element(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo, + bitfile *ld, program_config *pce, drc_info *drc) +{ + uint8_t retval = 0; + uint8_t channels = hDecoder->fr_channels = 0; + uint8_t ch; + uint8_t this_layer_stereo = (hDecoder->channelConfiguration > 1) ? 1 : 0; + element cpe = {0}; + ic_stream *ics1 = &(cpe.ics1); + ic_stream *ics2 = &(cpe.ics2); + int16_t *spec_data; + ALIGN int16_t spec_data1[1024] = {0}; + ALIGN int16_t spec_data2[1024] = {0}; + + hDecoder->fr_ch_ele = 0; + + hInfo->error = aac_scalable_main_header(hDecoder, ics1, ics2, ld, this_layer_stereo); + if (hInfo->error > 0) + return; + + cpe.common_window = 1; + if (this_layer_stereo) + { + hDecoder->element_id[0] = ID_CPE; + if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] == 0) + hDecoder->element_output_channels[hDecoder->fr_ch_ele] = 2; + } else { + hDecoder->element_id[0] = ID_SCE; + } + + for (ch = 0; ch < (this_layer_stereo ? 2 : 1); ch++) + { + ic_stream *ics; + if (ch == 0) + { + ics = ics1; + spec_data = spec_data1; + } else { + ics = ics2; + spec_data = spec_data2; + } + + hInfo->error = individual_channel_stream(hDecoder, &cpe, ld, ics, 1, spec_data); + if (hInfo->error > 0) + return; + } + +#ifdef DRM +#ifdef SBR_DEC + /* In case of DRM we need to read the SBR info before channel reconstruction */ + if ((hDecoder->sbr_present_flag == 1) && (hDecoder->object_type == DRM_ER_LC)) + { + bitfile ld_sbr = {0}; + uint32_t i; + uint16_t count = 0; + uint8_t *revbuffer; + uint8_t *prevbufstart; + uint8_t *pbufend; + + /* all forward bitreading should be finished at this point */ + uint32_t bitsconsumed = faad_get_processed_bits(ld); + uint32_t buffer_size = faad_origbitbuffer_size(ld); + uint8_t *buffer = (uint8_t*)faad_origbitbuffer(ld); + + if (bitsconsumed + 8 > buffer_size*8) + { + hInfo->error = 14; + return; + } + + if (!hDecoder->sbr[0]) + { + hDecoder->sbr[0] = sbrDecodeInit(hDecoder->frameLength, hDecoder->element_id[0], + 2*get_sample_rate(hDecoder->sf_index), 0 /* ds SBR */, 1); + } + + /* Reverse bit reading of SBR data in DRM audio frame */ + revbuffer = (uint8_t*)faad_malloc(buffer_size*sizeof(uint8_t)); + prevbufstart = revbuffer; + pbufend = &buffer[buffer_size - 1]; + for (i = 0; i < buffer_size; i++) + *prevbufstart++ = tabFlipbits[*pbufend--]; + + /* Set SBR data */ + /* consider 8 bits from AAC-CRC */ + count = (uint16_t)bit2byte(buffer_size*8 - bitsconsumed); + faad_initbits(&ld_sbr, revbuffer, count); + + hDecoder->sbr[0]->sample_rate = get_sample_rate(hDecoder->sf_index); + hDecoder->sbr[0]->sample_rate *= 2; + + faad_getbits(&ld_sbr, 8); /* Skip 8-bit CRC */ + + hDecoder->sbr[0]->ret = sbr_extension_data(&ld_sbr, hDecoder->sbr[0], count); +#if (defined(PS_DEC) || defined(DRM_PS)) + if (hDecoder->sbr[0]->ps_used) + { + hDecoder->ps_used[0] = 1; + hDecoder->ps_used_global = 1; + } +#endif + + /* check CRC */ + /* no need to check it if there was already an error */ + if (hDecoder->sbr[0]->ret == 0) + hDecoder->sbr[0]->ret = (uint8_t)faad_check_CRC(&ld_sbr, (uint16_t)faad_get_processed_bits(&ld_sbr) - 8); + + /* SBR data was corrupted, disable it until the next header */ + if (hDecoder->sbr[0]->ret != 0) + { + hDecoder->sbr[0]->header_count = 0; + } + + faad_endbits(&ld_sbr); + + if (revbuffer) + faad_free(revbuffer); + } +#endif +#endif + + if (this_layer_stereo) + { + hInfo->error = reconstruct_channel_pair(hDecoder, ics1, ics2, &cpe, spec_data1, spec_data2); + if (hInfo->error > 0) + return; + } else { + hInfo->error = reconstruct_single_channel(hDecoder, ics1, &cpe, spec_data1); + if (hInfo->error > 0) + return; + } + + /* map output channels position to internal data channels */ + if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] == 2) + { + /* this might be faulty when pce_set is true */ + hDecoder->internal_channel[channels] = channels; + hDecoder->internal_channel[channels+1] = channels+1; + } else { + hDecoder->internal_channel[channels] = channels; + } + + hDecoder->fr_channels += hDecoder->element_output_channels[hDecoder->fr_ch_ele]; + hDecoder->fr_ch_ele++; + + return; +} + +/* Table 4.4.15 */ +static int8_t aac_scalable_main_header(NeAACDecHandle hDecoder, ic_stream *ics1, ic_stream *ics2, + bitfile *ld, uint8_t this_layer_stereo) +{ + uint8_t retval = 0; + uint8_t ch; + ic_stream *ics; + + /* ics1->ics_reserved_bit = */ faad_get1bit(ld + DEBUGVAR(1,300,"aac_scalable_main_header(): ics_reserved_bits")); + ics1->window_sequence = (uint8_t)faad_getbits(ld, 2 + DEBUGVAR(1,301,"aac_scalable_main_header(): window_sequence")); + ics1->window_shape = faad_get1bit(ld + DEBUGVAR(1,302,"aac_scalable_main_header(): window_shape")); + + if (ics1->window_sequence == EIGHT_SHORT_SEQUENCE) + { + ics1->max_sfb = (uint8_t)faad_getbits(ld, 4 + DEBUGVAR(1,303,"aac_scalable_main_header(): max_sfb (short)")); + ics1->scale_factor_grouping = (uint8_t)faad_getbits(ld, 7 + DEBUGVAR(1,304,"aac_scalable_main_header(): scale_factor_grouping")); + } else { + ics1->max_sfb = (uint8_t)faad_getbits(ld, 6 + DEBUGVAR(1,305,"aac_scalable_main_header(): max_sfb (long)")); + } + + /* get the grouping information */ + if ((retval = window_grouping_info(hDecoder, ics1)) > 0) + return retval; + + /* should be an error */ + /* check the range of max_sfb */ + if (ics1->max_sfb > ics1->num_swb) + return 16; + + if (this_layer_stereo) + { + ics1->ms_mask_present = (uint8_t)faad_getbits(ld, 2 + DEBUGVAR(1,306,"aac_scalable_main_header(): ms_mask_present")); + if (ics1->ms_mask_present == 1) + { + uint8_t g, sfb; + for (g = 0; g < ics1->num_window_groups; g++) + { + for (sfb = 0; sfb < ics1->max_sfb; sfb++) + { + ics1->ms_used[g][sfb] = faad_get1bit(ld + DEBUGVAR(1,307,"aac_scalable_main_header(): faad_get1bit")); + } + } + } + + memcpy(ics2, ics1, sizeof(ic_stream)); + } else { + ics1->ms_mask_present = 0; + } + + if (0) + { + faad_get1bit(ld + DEBUGVAR(1,308,"aac_scalable_main_header(): tns_channel_mono_layer")); + } + + for (ch = 0; ch < (this_layer_stereo ? 2 : 1); ch++) + { + if (ch == 0) + ics = ics1; + else + ics = ics2; + + if ( 1 /*!tvq_layer_pesent || (tns_aac_tvq_en[ch] == 1)*/) + { + if ((ics->tns_data_present = faad_get1bit(ld + DEBUGVAR(1,309,"aac_scalable_main_header(): tns_data_present"))) & 1) + { +#ifdef DRM + /* different order of data units in DRM */ + if (hDecoder->object_type != DRM_ER_LC) +#endif + { + tns_data(ics, &(ics->tns), ld); + } + } + } +#if 0 + if (0 /*core_flag || tvq_layer_pesent*/) + { + if ((ch==0) || ((ch==1) && (core_stereo || tvq_stereo)) + diff_control_data(); + if (mono_stereo_flag) + diff_control_data_lr(); + } else { +#endif + if (( +#ifdef LTP_DEC + ics->ltp.data_present = +#endif + faad_get1bit(ld DEBUGVAR(1,310,"aac_scalable_main_header(): ltp.data_present"))) & 1) + { +#ifdef LTP_DEC + if ((retval = ltp_data(hDecoder, ics, &(ics->ltp), ld)) > 0) + { + return retval; + } +#else + return 26; +#endif + } +#if 0 + } +#endif + } + + return 0; +} +#endif + +/* Table 4.4.24 */ +static uint8_t individual_channel_stream(NeAACDecHandle hDecoder, element *ele, + bitfile *ld, ic_stream *ics, uint8_t scal_flag, + int16_t *spec_data) +{ + uint8_t result; + + ics->global_gain = (uint8_t)faad_getbits(ld, 8 + DEBUGVAR(1,67,"individual_channel_stream(): global_gain")); + + if (!ele->common_window && !scal_flag) + { + if ((result = ics_info(hDecoder, ics, ld, ele->common_window)) > 0) + return result; + } + + if ((result = section_data(hDecoder, ics, ld)) > 0) + return result; + + if ((result = scale_factor_data(hDecoder, ics, ld)) > 0) + return result; + + if (!scal_flag) + { + /** + ** NOTE: It could be that pulse data is available in scalable AAC too, + ** as said in Amendment 1, this could be only the case for ER AAC, + ** though. (have to check this out later) + **/ + /* get pulse data */ + if ((ics->pulse_data_present = faad_get1bit(ld + DEBUGVAR(1,68,"individual_channel_stream(): pulse_data_present"))) & 1) + { + if ((result = pulse_data(ics, &(ics->pul), ld)) > 0) + return result; + } + + /* get tns data */ + if ((ics->tns_data_present = faad_get1bit(ld + DEBUGVAR(1,69,"individual_channel_stream(): tns_data_present"))) & 1) + { +#ifdef ERROR_RESILIENCE + if (hDecoder->object_type < ER_OBJECT_START) +#endif + tns_data(ics, &(ics->tns), ld); + } + + /* get gain control data */ + if ((ics->gain_control_data_present = faad_get1bit(ld + DEBUGVAR(1,70,"individual_channel_stream(): gain_control_data_present"))) & 1) + { +#ifdef SSR_DEC + if (hDecoder->object_type != SSR) + return 1; + else + gain_control_data(ld, ics); +#else + return 1; +#endif + } + } + +#ifdef ERROR_RESILIENCE + if (hDecoder->aacSpectralDataResilienceFlag) + { + ics->length_of_reordered_spectral_data = (uint16_t)faad_getbits(ld, 14 + DEBUGVAR(1,147,"individual_channel_stream(): length_of_reordered_spectral_data")); + + if (hDecoder->channelConfiguration == 2) + { + if (ics->length_of_reordered_spectral_data > 6144) + ics->length_of_reordered_spectral_data = 6144; + } else { + if (ics->length_of_reordered_spectral_data > 12288) + ics->length_of_reordered_spectral_data = 12288; + } + + ics->length_of_longest_codeword = (uint8_t)faad_getbits(ld, 6 + DEBUGVAR(1,148,"individual_channel_stream(): length_of_longest_codeword")); + if (ics->length_of_longest_codeword >= 49) + ics->length_of_longest_codeword = 49; + } + + /* RVLC spectral data is put here */ + if (hDecoder->aacScalefactorDataResilienceFlag) + { + if ((result = rvlc_decode_scale_factors(ics, ld)) > 0) + return result; + } + + if (hDecoder->object_type >= ER_OBJECT_START) + { + if (ics->tns_data_present) + tns_data(ics, &(ics->tns), ld); + } + +#ifdef DRM + /* CRC check */ + if (hDecoder->object_type == DRM_ER_LC) + if ((result = (uint8_t)faad_check_CRC(ld, (uint16_t)faad_get_processed_bits(ld) - 8)) > 0) + return result; +#endif + + if (hDecoder->aacSpectralDataResilienceFlag) + { + /* error resilient spectral data decoding */ + if ((result = reordered_spectral_data(hDecoder, ics, ld, spec_data)) > 0) + { + return result; + } + } else { +#endif + /* decode the spectral data */ + if ((result = spectral_data(hDecoder, ics, ld, spec_data)) > 0) + { + return result; + } +#ifdef ERROR_RESILIENCE + } +#endif + + /* pulse coding reconstruction */ + if (ics->pulse_data_present) + { + if (ics->window_sequence != EIGHT_SHORT_SEQUENCE) + { + if ((result = pulse_decode(ics, spec_data, hDecoder->frameLength)) > 0) + return result; + } else { + return 2; /* pulse coding not allowed for short blocks */ + } + } + + return 0; +} + +/* Table 4.4.25 */ +static uint8_t section_data(NeAACDecHandle hDecoder, ic_stream *ics, bitfile *ld) +{ + uint8_t g; + uint8_t sect_esc_val, sect_bits; + + if (ics->window_sequence == EIGHT_SHORT_SEQUENCE) + sect_bits = 3; + else + sect_bits = 5; + sect_esc_val = (1<max_sfb); + printf(" sect top cb\n"); +#endif + + for (g = 0; g < ics->num_window_groups; g++) + { + uint8_t k = 0; + uint8_t i = 0; + + while (k < ics->max_sfb) + { +#ifdef ERROR_RESILIENCE + uint8_t vcb11 = 0; +#endif + uint8_t sfb; + uint8_t sect_len_incr; + uint16_t sect_len = 0; + uint8_t sect_cb_bits = 4; + + /* if "faad_getbits" detects error and returns "0", "k" is never + incremented and we cannot leave the while loop */ + if ((ld->error != 0) || (ld->no_more_reading)) + return 14; + +#ifdef ERROR_RESILIENCE + if (hDecoder->aacSectionDataResilienceFlag) + sect_cb_bits = 5; +#endif + + ics->sect_cb[g][i] = (uint8_t)faad_getbits(ld, sect_cb_bits + DEBUGVAR(1,71,"section_data(): sect_cb")); + +#if 0 + printf("%d\n", ics->sect_cb[g][i]); +#endif + + if (ics->sect_cb[g][i] == NOISE_HCB) + ics->noise_used = 1; + +#ifdef ERROR_RESILIENCE + if (hDecoder->aacSectionDataResilienceFlag) + { + if ((ics->sect_cb[g][i] == 11) || + ((ics->sect_cb[g][i] >= 16) && (ics->sect_cb[g][i] <= 32))) + { + vcb11 = 1; + } + } + if (vcb11) + { + sect_len_incr = 1; + } else { +#endif + sect_len_incr = (uint8_t)faad_getbits(ld, sect_bits + DEBUGVAR(1,72,"section_data(): sect_len_incr")); +#ifdef ERROR_RESILIENCE + } +#endif + while ((sect_len_incr == sect_esc_val) /* && + (k+sect_len < ics->max_sfb)*/) + { + sect_len += sect_len_incr; + sect_len_incr = (uint8_t)faad_getbits(ld, sect_bits + DEBUGVAR(1,72,"section_data(): sect_len_incr")); + } + + sect_len += sect_len_incr; + + ics->sect_start[g][i] = k; + ics->sect_end[g][i] = k + sect_len; + +#if 0 + printf("%d\n", ics->sect_start[g][i]); +#endif +#if 0 + printf("%d\n", ics->sect_end[g][i]); +#endif + + if (k + sect_len >= 8*15) + return 15; + if (i >= 8*15) + return 15; + + for (sfb = k; sfb < k + sect_len; sfb++) + { + ics->sfb_cb[g][sfb] = ics->sect_cb[g][i]; +#if 0 + printf("%d\n", ics->sfb_cb[g][sfb]); +#endif + } + +#if 0 + printf(" %6d %6d %6d\n", + i, + ics->sect_end[g][i], + ics->sect_cb[g][i]); +#endif + + k += sect_len; + i++; + } + ics->num_sec[g] = i; +#if 0 + printf("%d\n", ics->num_sec[g]); +#endif + } + +#if 0 + printf("\n"); +#endif + + return 0; +} + +/* + * decode_scale_factors() + * decodes the scalefactors from the bitstream + */ +/* + * All scalefactors (and also the stereo positions and pns energies) are + * transmitted using Huffman coded DPCM relative to the previous active + * scalefactor (respectively previous stereo position or previous pns energy, + * see subclause 4.6.2 and 4.6.3). The first active scalefactor is + * differentially coded relative to the global gain. + */ +static uint8_t decode_scale_factors(ic_stream *ics, bitfile *ld) +{ + uint8_t g, sfb; + int16_t t; + int8_t noise_pcm_flag = 1; + + int16_t scale_factor = ics->global_gain; + int16_t is_position = 0; + int16_t noise_energy = ics->global_gain - 90; + + for (g = 0; g < ics->num_window_groups; g++) + { + for (sfb = 0; sfb < ics->max_sfb; sfb++) + { + switch (ics->sfb_cb[g][sfb]) + { + case ZERO_HCB: /* zero book */ + ics->scale_factors[g][sfb] = 0; +//#define SF_PRINT +#ifdef SF_PRINT + printf("%d\n", ics->scale_factors[g][sfb]); +#endif + break; + case INTENSITY_HCB: /* intensity books */ + case INTENSITY_HCB2: + + /* decode intensity position */ + t = huffman_scale_factor(ld); + is_position += (t - 60); + ics->scale_factors[g][sfb] = is_position; +#ifdef SF_PRINT + printf("%d\n", ics->scale_factors[g][sfb]); +#endif + + break; + case NOISE_HCB: /* noise books */ + + /* decode noise energy */ + if (noise_pcm_flag) + { + noise_pcm_flag = 0; + t = (int16_t)faad_getbits(ld, 9 + DEBUGVAR(1,73,"scale_factor_data(): first noise")) - 256; + } else { + t = huffman_scale_factor(ld); + t -= 60; + } + noise_energy += t; + ics->scale_factors[g][sfb] = noise_energy; +#ifdef SF_PRINT + printf("%d\n", ics->scale_factors[g][sfb]); +#endif + + break; + default: /* spectral books */ + + /* ics->scale_factors[g][sfb] must be between 0 and 255 */ + + ics->scale_factors[g][sfb] = 0; + + /* decode scale factor */ + t = huffman_scale_factor(ld); + scale_factor += (t - 60); + if (scale_factor < 0 || scale_factor > 255) + return 4; + ics->scale_factors[g][sfb] = scale_factor; +#ifdef SF_PRINT + printf("%d\n", ics->scale_factors[g][sfb]); +#endif + + break; + } + } + } + + return 0; +} + +/* Table 4.4.26 */ +static uint8_t scale_factor_data(NeAACDecHandle hDecoder, ic_stream *ics, bitfile *ld) +{ + uint8_t ret = 0; +#ifdef PROFILE + int64_t count = faad_get_ts(); +#endif + +#ifdef ERROR_RESILIENCE + if (!hDecoder->aacScalefactorDataResilienceFlag) + { +#endif + ret = decode_scale_factors(ics, ld); +#ifdef ERROR_RESILIENCE + } else { + /* In ER AAC the parameters for RVLC are seperated from the actual + data that holds the scale_factors. + Strangely enough, 2 parameters for HCR are put inbetween them. + */ + ret = rvlc_scale_factor_data(ics, ld); + } +#endif + +#ifdef PROFILE + count = faad_get_ts() - count; + hDecoder->scalefac_cycles += count; +#endif + + return ret; +} + +/* Table 4.4.27 */ +static void tns_data(ic_stream *ics, tns_info *tns, bitfile *ld) +{ + uint8_t w, filt, i, start_coef_bits, coef_bits; + uint8_t n_filt_bits = 2; + uint8_t length_bits = 6; + uint8_t order_bits = 5; + + if (ics->window_sequence == EIGHT_SHORT_SEQUENCE) + { + n_filt_bits = 1; + length_bits = 4; + order_bits = 3; + } + + for (w = 0; w < ics->num_windows; w++) + { + tns->n_filt[w] = (uint8_t)faad_getbits(ld, n_filt_bits + DEBUGVAR(1,74,"tns_data(): n_filt")); +#if 0 + printf("%d\n", tns->n_filt[w]); +#endif + + if (tns->n_filt[w]) + { + if ((tns->coef_res[w] = faad_get1bit(ld + DEBUGVAR(1,75,"tns_data(): coef_res"))) & 1) + { + start_coef_bits = 4; + } else { + start_coef_bits = 3; + } +#if 0 + printf("%d\n", tns->coef_res[w]); +#endif + } + + for (filt = 0; filt < tns->n_filt[w]; filt++) + { + tns->length[w][filt] = (uint8_t)faad_getbits(ld, length_bits + DEBUGVAR(1,76,"tns_data(): length")); +#if 0 + printf("%d\n", tns->length[w][filt]); +#endif + tns->order[w][filt] = (uint8_t)faad_getbits(ld, order_bits + DEBUGVAR(1,77,"tns_data(): order")); +#if 0 + printf("%d\n", tns->order[w][filt]); +#endif + if (tns->order[w][filt]) + { + tns->direction[w][filt] = faad_get1bit(ld + DEBUGVAR(1,78,"tns_data(): direction")); +#if 0 + printf("%d\n", tns->direction[w][filt]); +#endif + tns->coef_compress[w][filt] = faad_get1bit(ld + DEBUGVAR(1,79,"tns_data(): coef_compress")); +#if 0 + printf("%d\n", tns->coef_compress[w][filt]); +#endif + + coef_bits = start_coef_bits - tns->coef_compress[w][filt]; + for (i = 0; i < tns->order[w][filt]; i++) + { + tns->coef[w][filt][i] = (uint8_t)faad_getbits(ld, coef_bits + DEBUGVAR(1,80,"tns_data(): coef")); +#if 0 + printf("%d\n", tns->coef[w][filt][i]); +#endif + } + } + } + } +} + +#ifdef LTP_DEC +/* Table 4.4.28 */ +static uint8_t ltp_data(NeAACDecHandle hDecoder, ic_stream *ics, ltp_info *ltp, bitfile *ld) +{ + uint8_t sfb, w; + + ltp->lag = 0; + +#ifdef LD_DEC + if (hDecoder->object_type == LD) + { + ltp->lag_update = (uint8_t)faad_getbits(ld, 1 + DEBUGVAR(1,142,"ltp_data(): lag_update")); + + if (ltp->lag_update) + { + ltp->lag = (uint16_t)faad_getbits(ld, 10 + DEBUGVAR(1,81,"ltp_data(): lag")); + } + } else { +#endif + ltp->lag = (uint16_t)faad_getbits(ld, 11 + DEBUGVAR(1,81,"ltp_data(): lag")); +#ifdef LD_DEC + } +#endif + + /* Check length of lag */ + if (ltp->lag > (hDecoder->frameLength << 1)) + return 18; + + ltp->coef = (uint8_t)faad_getbits(ld, 3 + DEBUGVAR(1,82,"ltp_data(): coef")); + + if (ics->window_sequence == EIGHT_SHORT_SEQUENCE) + { + for (w = 0; w < ics->num_windows; w++) + { + if ((ltp->short_used[w] = faad_get1bit(ld + DEBUGVAR(1,83,"ltp_data(): short_used"))) & 1) + { + ltp->short_lag_present[w] = faad_get1bit(ld + DEBUGVAR(1,84,"ltp_data(): short_lag_present")); + if (ltp->short_lag_present[w]) + { + ltp->short_lag[w] = (uint8_t)faad_getbits(ld, 4 + DEBUGVAR(1,85,"ltp_data(): short_lag")); + } + } + } + } else { + ltp->last_band = (ics->max_sfb < MAX_LTP_SFB ? ics->max_sfb : MAX_LTP_SFB); + + for (sfb = 0; sfb < ltp->last_band; sfb++) + { + ltp->long_used[sfb] = faad_get1bit(ld + DEBUGVAR(1,86,"ltp_data(): long_used")); + } + } + + return 0; +} +#endif + +/* Table 4.4.29 */ +static uint8_t spectral_data(NeAACDecHandle hDecoder, ic_stream *ics, bitfile *ld, + int16_t *spectral_data) +{ + int8_t i; + uint8_t g; + uint16_t inc, k, p = 0; + uint8_t groups = 0; + uint8_t sect_cb; + uint8_t result; + uint16_t nshort = hDecoder->frameLength/8; + +#ifdef PROFILE + int64_t count = faad_get_ts(); +#endif + + for(g = 0; g < ics->num_window_groups; g++) + { + p = groups*nshort; + + for (i = 0; i < ics->num_sec[g]; i++) + { + sect_cb = ics->sect_cb[g][i]; + + inc = (sect_cb >= FIRST_PAIR_HCB) ? 2 : 4; + + switch (sect_cb) + { + case ZERO_HCB: + case NOISE_HCB: + case INTENSITY_HCB: + case INTENSITY_HCB2: +//#define SD_PRINT +#ifdef SD_PRINT + { + int j; + for (j = ics->sect_sfb_offset[g][ics->sect_start[g][i]]; j < ics->sect_sfb_offset[g][ics->sect_end[g][i]]; j++) + { + printf("%d\n", 0); + } + } +#endif +//#define SFBO_PRINT +#ifdef SFBO_PRINT + printf("%d\n", ics->sect_sfb_offset[g][ics->sect_start[g][i]]); +#endif + p += (ics->sect_sfb_offset[g][ics->sect_end[g][i]] - + ics->sect_sfb_offset[g][ics->sect_start[g][i]]); + break; + default: +#ifdef SFBO_PRINT + printf("%d\n", ics->sect_sfb_offset[g][ics->sect_start[g][i]]); +#endif + for (k = ics->sect_sfb_offset[g][ics->sect_start[g][i]]; + k < ics->sect_sfb_offset[g][ics->sect_end[g][i]]; k += inc) + { + if ((result = huffman_spectral_data(sect_cb, ld, &spectral_data[p])) > 0) + return result; +#ifdef SD_PRINT + { + int j; + for (j = p; j < p+inc; j++) + { + printf("%d\n", spectral_data[j]); + } + } +#endif + p += inc; + } + break; + } + } + groups += ics->window_group_length[g]; + } + +#ifdef PROFILE + count = faad_get_ts() - count; + hDecoder->spectral_cycles += count; +#endif + + return 0; +} + +/* Table 4.4.30 */ +static uint16_t extension_payload(bitfile *ld, drc_info *drc, uint16_t count) +{ + uint16_t i, n, dataElementLength; + uint8_t dataElementLengthPart; + uint8_t align = 4, data_element_version, loopCounter; + + uint8_t extension_type = (uint8_t)faad_getbits(ld, 4 + DEBUGVAR(1,87,"extension_payload(): extension_type")); + + switch (extension_type) + { + case EXT_DYNAMIC_RANGE: + drc->present = 1; + n = dynamic_range_info(ld, drc); + return n; + case EXT_FILL_DATA: + /* fill_nibble = */ faad_getbits(ld, 4 + DEBUGVAR(1,136,"extension_payload(): fill_nibble")); /* must be ‘0000’ */ + for (i = 0; i < count-1; i++) + { + /* fill_byte[i] = */ faad_getbits(ld, 8 + DEBUGVAR(1,88,"extension_payload(): fill_byte")); /* must be ‘10100101’ */ + } + return count; + case EXT_DATA_ELEMENT: + data_element_version = (uint8_t)faad_getbits(ld, 4 + DEBUGVAR(1,400,"extension_payload(): data_element_version")); + switch (data_element_version) + { + case ANC_DATA: + loopCounter = 0; + dataElementLength = 0; + do { + dataElementLengthPart = (uint8_t)faad_getbits(ld, 8 + DEBUGVAR(1,401,"extension_payload(): dataElementLengthPart")); + dataElementLength += dataElementLengthPart; + loopCounter++; + } while (dataElementLengthPart == 255); + + for (i = 0; i < dataElementLength; i++) + { + /* data_element_byte[i] = */ faad_getbits(ld, 8 + DEBUGVAR(1,402,"extension_payload(): data_element_byte")); + return (dataElementLength+loopCounter+1); + } + default: + align = 0; + } + case EXT_FIL: + default: + faad_getbits(ld, align + DEBUGVAR(1,88,"extension_payload(): fill_nibble")); + for (i = 0; i < count-1; i++) + { + /* other_bits[i] = */ faad_getbits(ld, 8 + DEBUGVAR(1,89,"extension_payload(): fill_bit")); + } + return count; + } +} + +/* Table 4.4.31 */ +static uint8_t dynamic_range_info(bitfile *ld, drc_info *drc) +{ + uint8_t i, n = 1; + uint8_t band_incr; + + drc->num_bands = 1; + + if (faad_get1bit(ld + DEBUGVAR(1,90,"dynamic_range_info(): has instance_tag")) & 1) + { + drc->pce_instance_tag = (uint8_t)faad_getbits(ld, 4 + DEBUGVAR(1,91,"dynamic_range_info(): pce_instance_tag")); + /* drc->drc_tag_reserved_bits = */ faad_getbits(ld, 4 + DEBUGVAR(1,92,"dynamic_range_info(): drc_tag_reserved_bits")); + n++; + } + + drc->excluded_chns_present = faad_get1bit(ld + DEBUGVAR(1,93,"dynamic_range_info(): excluded_chns_present")); + if (drc->excluded_chns_present == 1) + { + n += excluded_channels(ld, drc); + } + + if (faad_get1bit(ld + DEBUGVAR(1,94,"dynamic_range_info(): has bands data")) & 1) + { + band_incr = (uint8_t)faad_getbits(ld, 4 + DEBUGVAR(1,95,"dynamic_range_info(): band_incr")); + /* drc->drc_bands_reserved_bits = */ faad_getbits(ld, 4 + DEBUGVAR(1,96,"dynamic_range_info(): drc_bands_reserved_bits")); + n++; + drc->num_bands += band_incr; + + for (i = 0; i < drc->num_bands; i++); + { + drc->band_top[i] = (uint8_t)faad_getbits(ld, 8 + DEBUGVAR(1,97,"dynamic_range_info(): band_top")); + n++; + } + } + + if (faad_get1bit(ld + DEBUGVAR(1,98,"dynamic_range_info(): has prog_ref_level")) & 1) + { + drc->prog_ref_level = (uint8_t)faad_getbits(ld, 7 + DEBUGVAR(1,99,"dynamic_range_info(): prog_ref_level")); + /* drc->prog_ref_level_reserved_bits = */ faad_get1bit(ld + DEBUGVAR(1,100,"dynamic_range_info(): prog_ref_level_reserved_bits")); + n++; + } + + for (i = 0; i < drc->num_bands; i++) + { + drc->dyn_rng_sgn[i] = faad_get1bit(ld + DEBUGVAR(1,101,"dynamic_range_info(): dyn_rng_sgn")); + drc->dyn_rng_ctl[i] = (uint8_t)faad_getbits(ld, 7 + DEBUGVAR(1,102,"dynamic_range_info(): dyn_rng_ctl")); + n++; + } + + return n; +} + +/* Table 4.4.32 */ +static uint8_t excluded_channels(bitfile *ld, drc_info *drc) +{ + uint8_t i, n = 0; + uint8_t num_excl_chan = 7; + + for (i = 0; i < 7; i++) + { + drc->exclude_mask[i] = faad_get1bit(ld + DEBUGVAR(1,103,"excluded_channels(): exclude_mask")); + } + n++; + + while ((drc->additional_excluded_chns[n-1] = faad_get1bit(ld + DEBUGVAR(1,104,"excluded_channels(): additional_excluded_chns"))) == 1) + { + for (i = num_excl_chan; i < num_excl_chan+7; i++) + { + drc->exclude_mask[i] = faad_get1bit(ld + DEBUGVAR(1,105,"excluded_channels(): exclude_mask")); + } + n++; + num_excl_chan += 7; + } + + return n; +} + +/* Annex A: Audio Interchange Formats */ + +/* Table 1.A.2 */ +void get_adif_header(adif_header *adif, bitfile *ld) +{ + uint8_t i; + + /* adif_id[0] = */ faad_getbits(ld, 8 + DEBUGVAR(1,106,"get_adif_header(): adif_id[0]")); + /* adif_id[1] = */ faad_getbits(ld, 8 + DEBUGVAR(1,107,"get_adif_header(): adif_id[1]")); + /* adif_id[2] = */ faad_getbits(ld, 8 + DEBUGVAR(1,108,"get_adif_header(): adif_id[2]")); + /* adif_id[3] = */ faad_getbits(ld, 8 + DEBUGVAR(1,109,"get_adif_header(): adif_id[3]")); + adif->copyright_id_present = faad_get1bit(ld + DEBUGVAR(1,110,"get_adif_header(): copyright_id_present")); + if(adif->copyright_id_present) + { + for (i = 0; i < 72/8; i++) + { + adif->copyright_id[i] = (int8_t)faad_getbits(ld, 8 + DEBUGVAR(1,111,"get_adif_header(): copyright_id")); + } + adif->copyright_id[i] = 0; + } + adif->original_copy = faad_get1bit(ld + DEBUGVAR(1,112,"get_adif_header(): original_copy")); + adif->home = faad_get1bit(ld + DEBUGVAR(1,113,"get_adif_header(): home")); + adif->bitstream_type = faad_get1bit(ld + DEBUGVAR(1,114,"get_adif_header(): bitstream_type")); + adif->bitrate = faad_getbits(ld, 23 + DEBUGVAR(1,115,"get_adif_header(): bitrate")); + adif->num_program_config_elements = (uint8_t)faad_getbits(ld, 4 + DEBUGVAR(1,116,"get_adif_header(): num_program_config_elements")); + + for (i = 0; i < adif->num_program_config_elements + 1; i++) + { + if(adif->bitstream_type == 0) + { + adif->adif_buffer_fullness = faad_getbits(ld, 20 + DEBUGVAR(1,117,"get_adif_header(): adif_buffer_fullness")); + } else { + adif->adif_buffer_fullness = 0; + } + + program_config_element(&adif->pce[i], ld); + } +} + +/* Table 1.A.5 */ +uint8_t adts_frame(adts_header *adts, bitfile *ld) +{ + /* faad_byte_align(ld); */ + if (adts_fixed_header(adts, ld)) + return 5; + adts_variable_header(adts, ld); + adts_error_check(adts, ld); + + return 0; +} + +/* Table 1.A.6 */ +static uint8_t adts_fixed_header(adts_header *adts, bitfile *ld) +{ + uint16_t i; + uint8_t sync_err = 1; + + /* try to recover from sync errors */ + for (i = 0; i < 768; i++) + { + adts->syncword = (uint16_t)faad_showbits(ld, 12); + if (adts->syncword != 0xFFF) + { + faad_getbits(ld, 8 + DEBUGVAR(0,0,"")); + } else { + sync_err = 0; + faad_getbits(ld, 12 + DEBUGVAR(1,118,"adts_fixed_header(): syncword")); + break; + } + } + if (sync_err) + return 5; + + adts->id = faad_get1bit(ld + DEBUGVAR(1,119,"adts_fixed_header(): id")); + adts->layer = (uint8_t)faad_getbits(ld, 2 + DEBUGVAR(1,120,"adts_fixed_header(): layer")); + adts->protection_absent = faad_get1bit(ld + DEBUGVAR(1,121,"adts_fixed_header(): protection_absent")); + adts->profile = (uint8_t)faad_getbits(ld, 2 + DEBUGVAR(1,122,"adts_fixed_header(): profile")); + adts->sf_index = (uint8_t)faad_getbits(ld, 4 + DEBUGVAR(1,123,"adts_fixed_header(): sf_index")); + adts->private_bit = faad_get1bit(ld + DEBUGVAR(1,124,"adts_fixed_header(): private_bit")); + adts->channel_configuration = (uint8_t)faad_getbits(ld, 3 + DEBUGVAR(1,125,"adts_fixed_header(): channel_configuration")); + adts->original = faad_get1bit(ld + DEBUGVAR(1,126,"adts_fixed_header(): original")); + adts->home = faad_get1bit(ld + DEBUGVAR(1,127,"adts_fixed_header(): home")); + + if (adts->old_format == 1) + { + /* Removed in corrigendum 14496-3:2002 */ + if (adts->id == 0) + { + adts->emphasis = (uint8_t)faad_getbits(ld, 2 + DEBUGVAR(1,128,"adts_fixed_header(): emphasis")); + } + } + + return 0; +} + +/* Table 1.A.7 */ +static void adts_variable_header(adts_header *adts, bitfile *ld) +{ + adts->copyright_identification_bit = faad_get1bit(ld + DEBUGVAR(1,129,"adts_variable_header(): copyright_identification_bit")); + adts->copyright_identification_start = faad_get1bit(ld + DEBUGVAR(1,130,"adts_variable_header(): copyright_identification_start")); + adts->aac_frame_length = (uint16_t)faad_getbits(ld, 13 + DEBUGVAR(1,131,"adts_variable_header(): aac_frame_length")); + adts->adts_buffer_fullness = (uint16_t)faad_getbits(ld, 11 + DEBUGVAR(1,132,"adts_variable_header(): adts_buffer_fullness")); + adts->no_raw_data_blocks_in_frame = (uint8_t)faad_getbits(ld, 2 + DEBUGVAR(1,133,"adts_variable_header(): no_raw_data_blocks_in_frame")); +} + +/* Table 1.A.8 */ +static void adts_error_check(adts_header *adts, bitfile *ld) +{ + if (adts->protection_absent == 0) + { + adts->crc_check = (uint16_t)faad_getbits(ld, 16 + DEBUGVAR(1,134,"adts_error_check(): crc_check")); + } +} diff --git a/Libraries/FAAD2/Files/libfaad/syntax.h b/Libraries/FAAD2/Files/libfaad/syntax.h new file mode 100644 index 000000000..f9efde7d9 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/syntax.h @@ -0,0 +1,124 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#ifndef __SYNTAX_H__ +#define __SYNTAX_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "decoder.h" +#include "bits.h" + +#define MAIN 1 +#define LC 2 +#define SSR 3 +#define LTP 4 +#define HE_AAC 5 +#define LD 23 +#define ER_LC 17 +#define ER_LTP 19 +#define DRM_ER_LC 27 /* special object type for DRM */ + +/* header types */ +#define RAW 0 +#define ADIF 1 +#define ADTS 2 + +/* SBR signalling */ +#define NO_SBR 0 +#define SBR_UPSAMPLED 1 +#define SBR_DOWNSAMPLED 2 +#define NO_SBR_UPSAMPLED 3 + +/* DRM channel definitions */ +#define DRMCH_MONO 1 +#define DRMCH_STEREO 2 +#define DRMCH_SBR_MONO 3 +#define DRMCH_SBR_STEREO 4 +#define DRMCH_SBR_PS_STEREO 5 + + +/* First object type that has ER */ +#define ER_OBJECT_START 17 + + +/* Bitstream */ +#define LEN_SE_ID 3 +#define LEN_TAG 4 +#define LEN_BYTE 8 + +#define EXT_FIL 0 +#define EXT_FILL_DATA 1 +#define EXT_DATA_ELEMENT 2 +#define EXT_DYNAMIC_RANGE 11 +#define ANC_DATA 0 + +/* Syntax elements */ +#define ID_SCE 0x0 +#define ID_CPE 0x1 +#define ID_CCE 0x2 +#define ID_LFE 0x3 +#define ID_DSE 0x4 +#define ID_PCE 0x5 +#define ID_FIL 0x6 +#define ID_END 0x7 + +#define ONLY_LONG_SEQUENCE 0x0 +#define LONG_START_SEQUENCE 0x1 +#define EIGHT_SHORT_SEQUENCE 0x2 +#define LONG_STOP_SEQUENCE 0x3 + +#define ZERO_HCB 0 +#define FIRST_PAIR_HCB 5 +#define ESC_HCB 11 +#define QUAD_LEN 4 +#define PAIR_LEN 2 +#define NOISE_HCB 13 +#define INTENSITY_HCB2 14 +#define INTENSITY_HCB 15 + +#define INVALID_SBR_ELEMENT 255 + +int8_t GASpecificConfig(bitfile *ld, mp4AudioSpecificConfig *mp4ASC, + program_config *pce); + +uint8_t adts_frame(adts_header *adts, bitfile *ld); +void get_adif_header(adif_header *adif, bitfile *ld); +void raw_data_block(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo, + bitfile *ld, program_config *pce, drc_info *drc); +uint8_t reordered_spectral_data(NeAACDecHandle hDecoder, ic_stream *ics, bitfile *ld, + int16_t *spectral_data); +void aac_scalable_main_element(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo, + bitfile *ld, program_config *pce, drc_info *drc); + + +#ifdef __cplusplus +} +#endif +#endif diff --git a/Libraries/FAAD2/Files/libfaad/tns.c b/Libraries/FAAD2/Files/libfaad/tns.c new file mode 100644 index 000000000..fa33e57a1 --- /dev/null +++ b/Libraries/FAAD2/Files/libfaad/tns.c @@ -0,0 +1,306 @@ +/* +** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding +** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +** +** Any non-GPL usage of this software or parts of this software is strictly +** forbidden. +** +** Commercial non-GPL licensing of this software is possible. +** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. +** +** $Id$ +**/ + +#include "common.h" +#include "structs.h" + +#include "syntax.h" +#include "tns.h" + + +/* static function declarations */ +static void tns_decode_coef(uint8_t order, uint8_t coef_res_bits, uint8_t coef_compress, + uint8_t *coef, real_t *a); +static void tns_ar_filter(real_t *spectrum, uint16_t size, int8_t inc, real_t *lpc, + uint8_t order); +static void tns_ma_filter(real_t *spectrum, uint16_t size, int8_t inc, real_t *lpc, + uint8_t order); + + +#ifdef _MSC_VER +#pragma warning(disable:4305) +#pragma warning(disable:4244) +#endif +static real_t tns_coef_0_3[] = +{ + COEF_CONST(0.0), COEF_CONST(0.4338837391), COEF_CONST(0.7818314825), COEF_CONST(0.9749279122), + COEF_CONST(-0.9848077530), COEF_CONST(-0.8660254038), COEF_CONST(-0.6427876097), COEF_CONST(-0.3420201433), + COEF_CONST(-0.4338837391), COEF_CONST(-0.7818314825), COEF_CONST(-0.9749279122), COEF_CONST(-0.9749279122), + COEF_CONST(-0.9848077530), COEF_CONST(-0.8660254038), COEF_CONST(-0.6427876097), COEF_CONST(-0.3420201433) +}; +static real_t tns_coef_0_4[] = +{ + COEF_CONST(0.0), COEF_CONST(0.2079116908), COEF_CONST(0.4067366431), COEF_CONST(0.5877852523), + COEF_CONST(0.7431448255), COEF_CONST(0.8660254038), COEF_CONST(0.9510565163), COEF_CONST(0.9945218954), + COEF_CONST(-0.9957341763), COEF_CONST(-0.9618256432), COEF_CONST(-0.8951632914), COEF_CONST(-0.7980172273), + COEF_CONST(-0.6736956436), COEF_CONST(-0.5264321629), COEF_CONST(-0.3612416662), COEF_CONST(-0.1837495178) +}; +static real_t tns_coef_1_3[] = +{ + COEF_CONST(0.0), COEF_CONST(0.4338837391), COEF_CONST(-0.6427876097), COEF_CONST(-0.3420201433), + COEF_CONST(0.9749279122), COEF_CONST(0.7818314825), COEF_CONST(-0.6427876097), COEF_CONST(-0.3420201433), + COEF_CONST(-0.4338837391), COEF_CONST(-0.7818314825), COEF_CONST(-0.6427876097), COEF_CONST(-0.3420201433), + COEF_CONST(-0.7818314825), COEF_CONST(-0.4338837391), COEF_CONST(-0.6427876097), COEF_CONST(-0.3420201433) +}; +static real_t tns_coef_1_4[] = +{ + COEF_CONST(0.0), COEF_CONST(0.2079116908), COEF_CONST(0.4067366431), COEF_CONST(0.5877852523), + COEF_CONST(-0.6736956436), COEF_CONST(-0.5264321629), COEF_CONST(-0.3612416662), COEF_CONST(-0.1837495178), + COEF_CONST(0.9945218954), COEF_CONST(0.9510565163), COEF_CONST(0.8660254038), COEF_CONST(0.7431448255), + COEF_CONST(-0.6736956436), COEF_CONST(-0.5264321629), COEF_CONST(-0.3612416662), COEF_CONST(-0.1837495178) +}; + + +/* TNS decoding for one channel and frame */ +void tns_decode_frame(ic_stream *ics, tns_info *tns, uint8_t sr_index, + uint8_t object_type, real_t *spec, uint16_t frame_len) +{ + uint8_t w, f, tns_order; + int8_t inc; + int16_t size; + uint16_t bottom, top, start, end; + uint16_t nshort = frame_len/8; + real_t lpc[TNS_MAX_ORDER+1]; + + if (!ics->tns_data_present) + return; + + for (w = 0; w < ics->num_windows; w++) + { + bottom = ics->num_swb; + + for (f = 0; f < tns->n_filt[w]; f++) + { + top = bottom; + bottom = max(top - tns->length[w][f], 0); + tns_order = min(tns->order[w][f], TNS_MAX_ORDER); + if (!tns_order) + continue; + + tns_decode_coef(tns_order, tns->coef_res[w]+3, + tns->coef_compress[w][f], tns->coef[w][f], lpc); + + start = min(bottom, max_tns_sfb(sr_index, object_type, (ics->window_sequence == EIGHT_SHORT_SEQUENCE))); + start = min(start, ics->max_sfb); + start = ics->swb_offset[start]; + + end = min(top, max_tns_sfb(sr_index, object_type, (ics->window_sequence == EIGHT_SHORT_SEQUENCE))); + end = min(end, ics->max_sfb); + end = ics->swb_offset[end]; + + size = end - start; + if (size <= 0) + continue; + + if (tns->direction[w][f]) + { + inc = -1; + start = end - 1; + } else { + inc = 1; + } + + tns_ar_filter(&spec[(w*nshort)+start], size, inc, lpc, tns_order); + } + } +} + +/* TNS encoding for one channel and frame */ +void tns_encode_frame(ic_stream *ics, tns_info *tns, uint8_t sr_index, + uint8_t object_type, real_t *spec, uint16_t frame_len) +{ + uint8_t w, f, tns_order; + int8_t inc; + int16_t size; + uint16_t bottom, top, start, end; + uint16_t nshort = frame_len/8; + real_t lpc[TNS_MAX_ORDER+1]; + + if (!ics->tns_data_present) + return; + + for (w = 0; w < ics->num_windows; w++) + { + bottom = ics->num_swb; + + for (f = 0; f < tns->n_filt[w]; f++) + { + top = bottom; + bottom = max(top - tns->length[w][f], 0); + tns_order = min(tns->order[w][f], TNS_MAX_ORDER); + if (!tns_order) + continue; + + tns_decode_coef(tns_order, tns->coef_res[w]+3, + tns->coef_compress[w][f], tns->coef[w][f], lpc); + + start = min(bottom, max_tns_sfb(sr_index, object_type, (ics->window_sequence == EIGHT_SHORT_SEQUENCE))); + start = min(start, ics->max_sfb); + start = ics->swb_offset[start]; + + end = min(top, max_tns_sfb(sr_index, object_type, (ics->window_sequence == EIGHT_SHORT_SEQUENCE))); + end = min(end, ics->max_sfb); + end = ics->swb_offset[end]; + + size = end - start; + if (size <= 0) + continue; + + if (tns->direction[w][f]) + { + inc = -1; + start = end - 1; + } else { + inc = 1; + } + + tns_ma_filter(&spec[(w*nshort)+start], size, inc, lpc, tns_order); + } + } +} + +/* Decoder transmitted coefficients for one TNS filter */ +static void tns_decode_coef(uint8_t order, uint8_t coef_res_bits, uint8_t coef_compress, + uint8_t *coef, real_t *a) +{ + uint8_t i, m; + real_t tmp2[TNS_MAX_ORDER+1], b[TNS_MAX_ORDER+1]; + + /* Conversion to signed integer */ + for (i = 0; i < order; i++) + { + if (coef_compress == 0) + { + if (coef_res_bits == 3) + { + tmp2[i] = tns_coef_0_3[coef[i]]; + } else { + tmp2[i] = tns_coef_0_4[coef[i]]; + } + } else { + if (coef_res_bits == 3) + { + tmp2[i] = tns_coef_1_3[coef[i]]; + } else { + tmp2[i] = tns_coef_1_4[coef[i]]; + } + } + } + + /* Conversion to LPC coefficients */ + a[0] = COEF_CONST(1.0); + for (m = 1; m <= order; m++) + { + for (i = 1; i < m; i++) /* loop only while i + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + FAAD2 + CFBundleIconFile + + CFBundleIdentifier + com.apple.carbonframeworktemplate + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + FMWK + CFBundleSignature + ???? + CFBundleVersion + 1.0 + CFBundleShortVersionString + 1.0 + CSResourcesFileMapped + + + diff --git a/Libraries/FLAC/English.lproj/InfoPlist.strings b/Libraries/FLAC/English.lproj/InfoPlist.strings new file mode 100644 index 0000000000000000000000000000000000000000..9851c873379e8a690faae2fd56570801f2712634 GIT binary patch literal 138 zcmW-Z%?g5G5Jk`0r}%K`q8>n6WFQ3MJ4h--{zRr=53e0$n7K1|4tLu*lMpBvc~H^u zH*zv&=~}L#G{08^7d!S_aFvQl FiT*KD7mEM@ literal 0 HcmV?d00001 diff --git a/Libraries/FLAC/FLAC.xcode/project.pbxproj b/Libraries/FLAC/FLAC.xcode/project.pbxproj new file mode 100644 index 000000000..e43389a44 --- /dev/null +++ b/Libraries/FLAC/FLAC.xcode/project.pbxproj @@ -0,0 +1,1080 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 39; + objects = { + 034768DDFF38A45A11DB9C8B = { + children = ( + 8D07F2C80486CC7A007CD1D0, + ); + isa = PBXGroup; + name = Products; + refType = 4; + sourceTree = ""; + }; +//030 +//031 +//032 +//033 +//034 +//080 +//081 +//082 +//083 +//084 + 0867D690FE84028FC02AAC07 = { + buildSettings = { + }; + buildStyles = ( + 4F0BB7EC011F40E904CA0E50, + 4F0BB7ED011F40E904CA0E50, + ); + hasScannedForEncodings = 1; + isa = PBXProject; + mainGroup = 0867D691FE84028FC02AAC07; + productRefGroup = 034768DDFF38A45A11DB9C8B; + projectDirPath = ""; + targets = ( + 8D07F2BC0486CC7A007CD1D0, + ); + }; + 0867D691FE84028FC02AAC07 = { + children = ( + 8ED54728082DBF3B00C4727A, + 08FB77ACFE841707C02AAC07, + 089C1665FE841158C02AAC07, + 0867D69AFE84028FC02AAC07, + 034768DDFF38A45A11DB9C8B, + ); + isa = PBXGroup; + name = FLAC; + refType = 4; + sourceTree = ""; + }; + 0867D69AFE84028FC02AAC07 = { + children = ( + ); + isa = PBXGroup; + name = "External Frameworks and Libraries"; + refType = 4; + sourceTree = ""; + }; + 089C1665FE841158C02AAC07 = { + children = ( + 8D07F2C70486CC7A007CD1D0, + 089C1666FE841158C02AAC07, + ); + isa = PBXGroup; + name = Resources; + refType = 4; + sourceTree = ""; + }; + 089C1666FE841158C02AAC07 = { + children = ( + 089C1667FE841158C02AAC07, + ); + isa = PBXVariantGroup; + name = InfoPlist.strings; + refType = 4; + sourceTree = ""; + }; + 089C1667FE841158C02AAC07 = { + fileEncoding = 10; + isa = PBXFileReference; + lastKnownFileType = text.plist.strings; + name = English; + path = English.lproj/InfoPlist.strings; + refType = 4; + sourceTree = ""; + }; + 08FB77ACFE841707C02AAC07 = { + children = ( + 8ED546A7082DBEAB00C4727A, + 8ED546A8082DBEAB00C4727A, + 8ED546A9082DBEAB00C4727A, + 8ED546AA082DBEAB00C4727A, + 8ED546AB082DBEAB00C4727A, + 8ED546AC082DBEAB00C4727A, + 8ED546AD082DBEAB00C4727A, + 8ED546AE082DBEAB00C4727A, + 8ED546AF082DBEAB00C4727A, + 8ED546B0082DBEAB00C4727A, + 8ED546CD082DBEAB00C4727A, + 8ED546CE082DBEAB00C4727A, + 8ED546CF082DBEAB00C4727A, + 8ED546D0082DBEAB00C4727A, + 8ED546D1082DBEAB00C4727A, + 8ED546D2082DBEAB00C4727A, + 8ED546DD082DBEAB00C4727A, + 8ED546DE082DBEAB00C4727A, + 8ED546DF082DBEAB00C4727A, + 8ED546E0082DBEAB00C4727A, + 8ED546E1082DBEAB00C4727A, + ); + isa = PBXGroup; + name = Source; + refType = 4; + sourceTree = ""; + }; +//080 +//081 +//082 +//083 +//084 +//4F0 +//4F1 +//4F2 +//4F3 +//4F4 + 4F0BB7EC011F40E904CA0E50 = { + buildSettings = { + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_GENERATE_DEBUGGING_SYMBOLS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + ZERO_LINK = YES; + }; + isa = PBXBuildStyle; + name = Development; + }; + 4F0BB7ED011F40E904CA0E50 = { + buildSettings = { + COPY_PHASE_STRIP = YES; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + ZERO_LINK = NO; + }; + isa = PBXBuildStyle; + name = Deployment; + }; +//4F0 +//4F1 +//4F2 +//4F3 +//4F4 +//8D0 +//8D1 +//8D2 +//8D3 +//8D4 + 8D07F2BC0486CC7A007CD1D0 = { + buildPhases = ( + 8D07F2BD0486CC7A007CD1D0, + 8D07F2BF0486CC7A007CD1D0, + 8D07F2C10486CC7A007CD1D0, + 8D07F2C30486CC7A007CD1D0, + 8D07F2C50486CC7A007CD1D0, + ); + buildRules = ( + ); + buildSettings = { + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + FRAMEWORK_VERSION = A; + GCC_GENERATE_DEBUGGING_SYMBOLS = NO; + GCC_PRECOMPILE_PREFIX_HEADER = NO; + GCC_PREFIX_HEADER = ""; + HEADER_SEARCH_PATHS = "files/include files/src/libflac/include"; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "@executable_path/../Frameworks"; + LIBRARY_STYLE = DYNAMIC; + OTHER_CFLAGS = "-DVERSION=\\\"1.1.2\\\" -DHAVE_INTTYPES_H -DFLAC__ALIGN_MALLOC_DATA -DFLAC__CPU_PPC -force_cpusubtype_ALL"; + OTHER_LDFLAGS = "-Wl,-read_only_relocs,warning"; + PRODUCT_NAME = FLAC; + WRAPPER_EXTENSION = framework; + }; + dependencies = ( + ); + isa = PBXNativeTarget; + name = FLAC; + productInstallPath = "$(HOME)/Library/Frameworks"; + productName = FLAC; + productReference = 8D07F2C80486CC7A007CD1D0; + productType = "com.apple.product-type.framework"; + }; + 8D07F2BD0486CC7A007CD1D0 = { + buildActionMask = 2147483647; + files = ( + 8EE5088D082DC8CB006BCDDE, + 8EE5088E082DC8CB006BCDDE, + 8EE5088F082DC8CB006BCDDE, + 8EE50890082DC8CB006BCDDE, + 8EE50891082DC8CB006BCDDE, + 8EE50892082DC8CB006BCDDE, + 8EE50893082DC8CB006BCDDE, + 8EE50894082DC8CB006BCDDE, + 8EE50895082DC8CB006BCDDE, + 8EE50896082DC8CB006BCDDE, + 8EE50897082DC8CB006BCDDE, + 8EE50898082DC8CB006BCDDE, + 8EE50899082DC8CB006BCDDE, + ); + isa = PBXHeadersBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 8D07F2BF0486CC7A007CD1D0 = { + buildActionMask = 2147483647; + files = ( + 8D07F2C00486CC7A007CD1D0, + ); + isa = PBXResourcesBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 8D07F2C00486CC7A007CD1D0 = { + fileRef = 089C1666FE841158C02AAC07; + isa = PBXBuildFile; + settings = { + }; + }; + 8D07F2C10486CC7A007CD1D0 = { + buildActionMask = 2147483647; + files = ( + 8ED546E2082DBEAB00C4727A, + 8ED546E3082DBEAB00C4727A, + 8ED546E4082DBEAB00C4727A, + 8ED546E5082DBEAB00C4727A, + 8ED546E6082DBEAB00C4727A, + 8ED546E7082DBEAB00C4727A, + 8ED546E8082DBEAB00C4727A, + 8ED546E9082DBEAB00C4727A, + 8ED546EA082DBEAB00C4727A, + 8ED54705082DBEAB00C4727A, + 8ED54706082DBEAB00C4727A, + 8ED54707082DBEAB00C4727A, + 8ED54708082DBEAB00C4727A, + 8ED54709082DBEAB00C4727A, + 8ED54712082DBEAB00C4727A, + 8ED54713082DBEAB00C4727A, + 8ED54714082DBEAB00C4727A, + 8ED54715082DBEAB00C4727A, + 8ED54716082DBEAB00C4727A, + 8E4DBA16082DC7360040D7AB, + ); + isa = PBXSourcesBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 8D07F2C30486CC7A007CD1D0 = { + buildActionMask = 2147483647; + files = ( + ); + isa = PBXFrameworksBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 8D07F2C50486CC7A007CD1D0 = { + buildActionMask = 2147483647; + files = ( + ); + isa = PBXRezBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 8D07F2C70486CC7A007CD1D0 = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = text.plist; + path = Info.plist; + refType = 4; + sourceTree = ""; + }; + 8D07F2C80486CC7A007CD1D0 = { + explicitFileType = wrapper.framework; + includeInIndex = 0; + isa = PBXFileReference; + path = FLAC.framework; + refType = 3; + sourceTree = BUILT_PRODUCTS_DIR; + }; +//8D0 +//8D1 +//8D2 +//8D3 +//8D4 +//8E0 +//8E1 +//8E2 +//8E3 +//8E4 + 8E4DBA12082DC7360040D7AB = { + children = ( + 8E4DBA13082DC7360040D7AB, + ); + isa = PBXGroup; + path = as; + refType = 4; + sourceTree = ""; + }; + 8E4DBA13082DC7360040D7AB = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.asm; + path = lpc_asm.s; + refType = 4; + sourceTree = ""; + }; + 8E4DBA16082DC7360040D7AB = { + fileRef = 8E4DBA13082DC7360040D7AB; + isa = PBXBuildFile; + settings = { + }; + }; + 8ED546A7082DBEAB00C4727A = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = bitbuffer.c; + path = Files/src/libFLAC/bitbuffer.c; + refType = 4; + sourceTree = ""; + }; + 8ED546A8082DBEAB00C4727A = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = bitmath.c; + path = Files/src/libFLAC/bitmath.c; + refType = 4; + sourceTree = ""; + }; + 8ED546A9082DBEAB00C4727A = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = cpu.c; + path = Files/src/libFLAC/cpu.c; + refType = 4; + sourceTree = ""; + }; + 8ED546AA082DBEAB00C4727A = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = crc.c; + path = Files/src/libFLAC/crc.c; + refType = 4; + sourceTree = ""; + }; + 8ED546AB082DBEAB00C4727A = { + explicitFileType = sourcecode.c.c; + fileEncoding = 30; + isa = PBXFileReference; + name = file_decoder.c; + path = Files/src/libFLAC/file_decoder.c; + refType = 4; + sourceTree = ""; + }; + 8ED546AC082DBEAB00C4727A = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = file_encoder.c; + path = Files/src/libFLAC/file_encoder.c; + refType = 4; + sourceTree = ""; + }; + 8ED546AD082DBEAB00C4727A = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = fixed.c; + path = Files/src/libFLAC/fixed.c; + refType = 4; + sourceTree = ""; + }; + 8ED546AE082DBEAB00C4727A = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = float.c; + path = Files/src/libFLAC/float.c; + refType = 4; + sourceTree = ""; + }; + 8ED546AF082DBEAB00C4727A = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = format.c; + path = Files/src/libFLAC/format.c; + refType = 4; + sourceTree = ""; + }; + 8ED546B0082DBEAB00C4727A = { + children = ( + 8ED546B3082DBEAB00C4727A, + 8ED546C3082DBEAB00C4727A, + ); + isa = PBXGroup; + name = include; + path = Files/src/libFLAC/include; + refType = 4; + sourceTree = ""; + }; + 8ED546B3082DBEAB00C4727A = { + children = ( + 8ED546B4082DBEAB00C4727A, + 8ED546B5082DBEAB00C4727A, + 8ED546B6082DBEAB00C4727A, + 8ED546B7082DBEAB00C4727A, + 8ED546B8082DBEAB00C4727A, + 8ED546B9082DBEAB00C4727A, + 8ED546BA082DBEAB00C4727A, + 8ED546BB082DBEAB00C4727A, + 8ED546BC082DBEAB00C4727A, + 8ED546BF082DBEAB00C4727A, + 8ED546C0082DBEAB00C4727A, + 8ED546C1082DBEAB00C4727A, + 8ED546C2082DBEAB00C4727A, + ); + isa = PBXGroup; + path = private; + refType = 4; + sourceTree = ""; + }; + 8ED546B4082DBEAB00C4727A = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = all.h; + refType = 4; + sourceTree = ""; + }; + 8ED546B5082DBEAB00C4727A = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = bitbuffer.h; + refType = 4; + sourceTree = ""; + }; + 8ED546B6082DBEAB00C4727A = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = bitmath.h; + refType = 4; + sourceTree = ""; + }; + 8ED546B7082DBEAB00C4727A = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = cpu.h; + refType = 4; + sourceTree = ""; + }; + 8ED546B8082DBEAB00C4727A = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = crc.h; + refType = 4; + sourceTree = ""; + }; + 8ED546B9082DBEAB00C4727A = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = fixed.h; + refType = 4; + sourceTree = ""; + }; + 8ED546BA082DBEAB00C4727A = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = float.h; + refType = 4; + sourceTree = ""; + }; + 8ED546BB082DBEAB00C4727A = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = format.h; + refType = 4; + sourceTree = ""; + }; + 8ED546BC082DBEAB00C4727A = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = lpc.h; + refType = 4; + sourceTree = ""; + }; + 8ED546BF082DBEAB00C4727A = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = md5.h; + refType = 4; + sourceTree = ""; + }; + 8ED546C0082DBEAB00C4727A = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = memory.h; + refType = 4; + sourceTree = ""; + }; + 8ED546C1082DBEAB00C4727A = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = metadata.h; + refType = 4; + sourceTree = ""; + }; + 8ED546C2082DBEAB00C4727A = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = stream_encoder_framing.h; + refType = 4; + sourceTree = ""; + }; + 8ED546C3082DBEAB00C4727A = { + children = ( + 8ED546C4082DBEAB00C4727A, + 8ED546C5082DBEAB00C4727A, + 8ED546C6082DBEAB00C4727A, + 8ED546C9082DBEAB00C4727A, + 8ED546CA082DBEAB00C4727A, + 8ED546CB082DBEAB00C4727A, + 8ED546CC082DBEAB00C4727A, + ); + isa = PBXGroup; + path = protected; + refType = 4; + sourceTree = ""; + }; + 8ED546C4082DBEAB00C4727A = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = all.h; + refType = 4; + sourceTree = ""; + }; + 8ED546C5082DBEAB00C4727A = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = file_decoder.h; + refType = 4; + sourceTree = ""; + }; + 8ED546C6082DBEAB00C4727A = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = file_encoder.h; + refType = 4; + sourceTree = ""; + }; + 8ED546C9082DBEAB00C4727A = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = seekable_stream_decoder.h; + refType = 4; + sourceTree = ""; + }; + 8ED546CA082DBEAB00C4727A = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = seekable_stream_encoder.h; + refType = 4; + sourceTree = ""; + }; + 8ED546CB082DBEAB00C4727A = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = stream_decoder.h; + refType = 4; + sourceTree = ""; + }; + 8ED546CC082DBEAB00C4727A = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = stream_encoder.h; + refType = 4; + sourceTree = ""; + }; + 8ED546CD082DBEAB00C4727A = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = lpc.c; + path = Files/src/libFLAC/lpc.c; + refType = 4; + sourceTree = ""; + }; + 8ED546CE082DBEAB00C4727A = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = md5.c; + path = Files/src/libFLAC/md5.c; + refType = 4; + sourceTree = ""; + }; + 8ED546CF082DBEAB00C4727A = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = memory.c; + path = Files/src/libFLAC/memory.c; + refType = 4; + sourceTree = ""; + }; + 8ED546D0082DBEAB00C4727A = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = metadata_iterators.c; + path = Files/src/libFLAC/metadata_iterators.c; + refType = 4; + sourceTree = ""; + }; + 8ED546D1082DBEAB00C4727A = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = metadata_object.c; + path = Files/src/libFLAC/metadata_object.c; + refType = 4; + sourceTree = ""; + }; + 8ED546D2082DBEAB00C4727A = { + children = ( + 8E4DBA12082DC7360040D7AB, + ); + isa = PBXGroup; + name = ppc; + path = Files/src/libFLAC/ppc; + refType = 4; + sourceTree = ""; + }; + 8ED546DD082DBEAB00C4727A = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = seekable_stream_decoder.c; + path = Files/src/libFLAC/seekable_stream_decoder.c; + refType = 4; + sourceTree = ""; + }; + 8ED546DE082DBEAB00C4727A = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = seekable_stream_encoder.c; + path = Files/src/libFLAC/seekable_stream_encoder.c; + refType = 4; + sourceTree = ""; + }; + 8ED546DF082DBEAB00C4727A = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = stream_decoder.c; + path = Files/src/libFLAC/stream_decoder.c; + refType = 4; + sourceTree = ""; + }; + 8ED546E0082DBEAB00C4727A = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = stream_encoder_framing.c; + path = Files/src/libFLAC/stream_encoder_framing.c; + refType = 4; + sourceTree = ""; + }; + 8ED546E1082DBEAB00C4727A = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = stream_encoder.c; + path = Files/src/libFLAC/stream_encoder.c; + refType = 4; + sourceTree = ""; + }; + 8ED546E2082DBEAB00C4727A = { + fileRef = 8ED546A7082DBEAB00C4727A; + isa = PBXBuildFile; + settings = { + }; + }; + 8ED546E3082DBEAB00C4727A = { + fileRef = 8ED546A8082DBEAB00C4727A; + isa = PBXBuildFile; + settings = { + }; + }; + 8ED546E4082DBEAB00C4727A = { + fileRef = 8ED546A9082DBEAB00C4727A; + isa = PBXBuildFile; + settings = { + }; + }; + 8ED546E5082DBEAB00C4727A = { + fileRef = 8ED546AA082DBEAB00C4727A; + isa = PBXBuildFile; + settings = { + }; + }; + 8ED546E6082DBEAB00C4727A = { + fileRef = 8ED546AB082DBEAB00C4727A; + isa = PBXBuildFile; + settings = { + }; + }; + 8ED546E7082DBEAB00C4727A = { + fileRef = 8ED546AC082DBEAB00C4727A; + isa = PBXBuildFile; + settings = { + }; + }; + 8ED546E8082DBEAB00C4727A = { + fileRef = 8ED546AD082DBEAB00C4727A; + isa = PBXBuildFile; + settings = { + }; + }; + 8ED546E9082DBEAB00C4727A = { + fileRef = 8ED546AE082DBEAB00C4727A; + isa = PBXBuildFile; + settings = { + }; + }; + 8ED546EA082DBEAB00C4727A = { + fileRef = 8ED546AF082DBEAB00C4727A; + isa = PBXBuildFile; + settings = { + }; + }; + 8ED54705082DBEAB00C4727A = { + fileRef = 8ED546CD082DBEAB00C4727A; + isa = PBXBuildFile; + settings = { + }; + }; + 8ED54706082DBEAB00C4727A = { + fileRef = 8ED546CE082DBEAB00C4727A; + isa = PBXBuildFile; + settings = { + }; + }; + 8ED54707082DBEAB00C4727A = { + fileRef = 8ED546CF082DBEAB00C4727A; + isa = PBXBuildFile; + settings = { + }; + }; + 8ED54708082DBEAB00C4727A = { + fileRef = 8ED546D0082DBEAB00C4727A; + isa = PBXBuildFile; + settings = { + }; + }; + 8ED54709082DBEAB00C4727A = { + fileRef = 8ED546D1082DBEAB00C4727A; + isa = PBXBuildFile; + settings = { + }; + }; + 8ED54712082DBEAB00C4727A = { + fileRef = 8ED546DD082DBEAB00C4727A; + isa = PBXBuildFile; + settings = { + }; + }; + 8ED54713082DBEAB00C4727A = { + fileRef = 8ED546DE082DBEAB00C4727A; + isa = PBXBuildFile; + settings = { + }; + }; + 8ED54714082DBEAB00C4727A = { + fileRef = 8ED546DF082DBEAB00C4727A; + isa = PBXBuildFile; + settings = { + }; + }; + 8ED54715082DBEAB00C4727A = { + fileRef = 8ED546E0082DBEAB00C4727A; + isa = PBXBuildFile; + settings = { + }; + }; + 8ED54716082DBEAB00C4727A = { + fileRef = 8ED546E1082DBEAB00C4727A; + isa = PBXBuildFile; + settings = { + }; + }; + 8ED54728082DBF3B00C4727A = { + children = ( + 8ED54729082DBF5200C4727A, + 8ED5472A082DBF5200C4727A, + 8ED5472B082DBF5200C4727A, + 8ED5472C082DBF5200C4727A, + 8ED5472D082DBF5200C4727A, + 8ED5472E082DBF5200C4727A, + 8ED5472F082DBF5200C4727A, + 8ED54730082DBF5200C4727A, + 8ED54731082DBF5200C4727A, + 8ED54732082DBF5200C4727A, + 8ED54733082DBF5200C4727A, + 8ED54734082DBF5200C4727A, + 8ED54735082DBF5200C4727A, + ); + isa = PBXGroup; + name = Headers; + refType = 4; + sourceTree = ""; + }; + 8ED54729082DBF5200C4727A = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = all.h; + path = Files/include/FLAC/all.h; + refType = 4; + sourceTree = ""; + }; + 8ED5472A082DBF5200C4727A = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = assert.h; + path = Files/include/FLAC/assert.h; + refType = 4; + sourceTree = ""; + }; + 8ED5472B082DBF5200C4727A = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = callback.h; + path = Files/include/FLAC/callback.h; + refType = 4; + sourceTree = ""; + }; + 8ED5472C082DBF5200C4727A = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = export.h; + path = Files/include/FLAC/export.h; + refType = 4; + sourceTree = ""; + }; + 8ED5472D082DBF5200C4727A = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = file_decoder.h; + path = Files/include/FLAC/file_decoder.h; + refType = 4; + sourceTree = ""; + }; + 8ED5472E082DBF5200C4727A = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = file_encoder.h; + path = Files/include/FLAC/file_encoder.h; + refType = 4; + sourceTree = ""; + }; + 8ED5472F082DBF5200C4727A = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = format.h; + path = Files/include/FLAC/format.h; + refType = 4; + sourceTree = ""; + }; + 8ED54730082DBF5200C4727A = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = metadata.h; + path = Files/include/FLAC/metadata.h; + refType = 4; + sourceTree = ""; + }; + 8ED54731082DBF5200C4727A = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = ordinals.h; + path = Files/include/FLAC/ordinals.h; + refType = 4; + sourceTree = ""; + }; + 8ED54732082DBF5200C4727A = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = seekable_stream_decoder.h; + path = Files/include/FLAC/seekable_stream_decoder.h; + refType = 4; + sourceTree = ""; + }; + 8ED54733082DBF5200C4727A = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = seekable_stream_encoder.h; + path = Files/include/FLAC/seekable_stream_encoder.h; + refType = 4; + sourceTree = ""; + }; + 8ED54734082DBF5200C4727A = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = stream_decoder.h; + path = Files/include/FLAC/stream_decoder.h; + refType = 4; + sourceTree = ""; + }; + 8ED54735082DBF5200C4727A = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = stream_encoder.h; + path = Files/include/FLAC/stream_encoder.h; + refType = 4; + sourceTree = ""; + }; + 8EE5088D082DC8CB006BCDDE = { + fileRef = 8ED54729082DBF5200C4727A; + isa = PBXBuildFile; + settings = { + ATTRIBUTES = ( + Public, + ); + }; + }; + 8EE5088E082DC8CB006BCDDE = { + fileRef = 8ED5472A082DBF5200C4727A; + isa = PBXBuildFile; + settings = { + ATTRIBUTES = ( + Public, + ); + }; + }; + 8EE5088F082DC8CB006BCDDE = { + fileRef = 8ED5472B082DBF5200C4727A; + isa = PBXBuildFile; + settings = { + ATTRIBUTES = ( + Public, + ); + }; + }; + 8EE50890082DC8CB006BCDDE = { + fileRef = 8ED5472C082DBF5200C4727A; + isa = PBXBuildFile; + settings = { + ATTRIBUTES = ( + Public, + ); + }; + }; + 8EE50891082DC8CB006BCDDE = { + fileRef = 8ED5472D082DBF5200C4727A; + isa = PBXBuildFile; + settings = { + ATTRIBUTES = ( + Public, + ); + }; + }; + 8EE50892082DC8CB006BCDDE = { + fileRef = 8ED5472E082DBF5200C4727A; + isa = PBXBuildFile; + settings = { + ATTRIBUTES = ( + Public, + ); + }; + }; + 8EE50893082DC8CB006BCDDE = { + fileRef = 8ED5472F082DBF5200C4727A; + isa = PBXBuildFile; + settings = { + ATTRIBUTES = ( + Public, + ); + }; + }; + 8EE50894082DC8CB006BCDDE = { + fileRef = 8ED54730082DBF5200C4727A; + isa = PBXBuildFile; + settings = { + ATTRIBUTES = ( + Public, + ); + }; + }; + 8EE50895082DC8CB006BCDDE = { + fileRef = 8ED54731082DBF5200C4727A; + isa = PBXBuildFile; + settings = { + ATTRIBUTES = ( + Public, + ); + }; + }; + 8EE50896082DC8CB006BCDDE = { + fileRef = 8ED54732082DBF5200C4727A; + isa = PBXBuildFile; + settings = { + ATTRIBUTES = ( + Public, + ); + }; + }; + 8EE50897082DC8CB006BCDDE = { + fileRef = 8ED54733082DBF5200C4727A; + isa = PBXBuildFile; + settings = { + ATTRIBUTES = ( + Public, + ); + }; + }; + 8EE50898082DC8CB006BCDDE = { + fileRef = 8ED54734082DBF5200C4727A; + isa = PBXBuildFile; + settings = { + ATTRIBUTES = ( + Public, + ); + }; + }; + 8EE50899082DC8CB006BCDDE = { + fileRef = 8ED54735082DBF5200C4727A; + isa = PBXBuildFile; + settings = { + ATTRIBUTES = ( + Public, + ); + }; + }; + }; + rootObject = 0867D690FE84028FC02AAC07; +} diff --git a/Libraries/FLAC/FLAC.xcode/xugg.mode1 b/Libraries/FLAC/FLAC.xcode/xugg.mode1 new file mode 100644 index 000000000..91e20c68f --- /dev/null +++ b/Libraries/FLAC/FLAC.xcode/xugg.mode1 @@ -0,0 +1,1303 @@ + + + + + ActivePerspectiveName + Project + AllowedModules + + + BundleLoadPath + + MaxInstances + n + Module + PBXSmartGroupTreeModule + Name + Groups and Files Outline View + + + BundleLoadPath + + MaxInstances + n + Module + PBXNavigatorGroup + Name + Editor + + + BundleLoadPath + + MaxInstances + n + Module + XCTaskListModule + Name + Task List + + + BundleLoadPath + + MaxInstances + n + Module + XCDetailModule + Name + File and Smart Group Detail Viewer + + + BundleLoadPath + + MaxInstances + 1 + Module + PBXBuildResultsModule + Name + Detailed Build Results Viewer + + + BundleLoadPath + + MaxInstances + 1 + Module + PBXProjectFindModule + Name + Project Batch Find Tool + + + BundleLoadPath + + MaxInstances + n + Module + PBXRunSessionModule + Name + Run Log + + + BundleLoadPath + + MaxInstances + n + Module + PBXBookmarksModule + Name + Bookmarks Tool + + + BundleLoadPath + + MaxInstances + n + Module + PBXClassBrowserModule + Name + Class Browser + + + BundleLoadPath + + MaxInstances + n + Module + PBXCVSModule + Name + Source Code Control Tool + + + BundleLoadPath + + MaxInstances + n + Module + PBXDebugBreakpointsModule + Name + Debug Breakpoints Tool + + + BundleLoadPath + + MaxInstances + n + Module + XCDockableInspector + Name + Inspector + + + BundleLoadPath + + MaxInstances + n + Module + PBXOpenQuicklyModule + Name + Open Quickly Tool + + + BundleLoadPath + + MaxInstances + 1 + Module + PBXDebugSessionModule + Name + Debugger + + + BundleLoadPath + + MaxInstances + 1 + Module + PBXDebugCLIModule + Name + Debug Console + + + Description + DefaultDescriptionKey + DockingSystemVisible + + Extension + mode1 + FavBarConfig + + PBXProjectModuleGUID + 8ED547C6082DC2AB00C4727A + XCBarModuleItemNames + + XCBarModuleItems + + + FirstTimeWindowDisplayed + + Identifier + com.apple.perspectives.project.mode1 + MajorVersion + 31 + MinorVersion + 1 + Name + Default + Notifications + + OpenEditors + + PerspectiveWidths + + -1 + -1 + + Perspectives + + + ChosenToolbarItems + + active-target-popup + action + NSToolbarFlexibleSpaceItem + buildOrClean + build-and-runOrDebug + com.apple.ide.PBXToolbarStopButton + get-info + toggle-editor + NSToolbarFlexibleSpaceItem + com.apple.pbx.toolbar.searchfield + + ControllerClassBaseName + + IconName + WindowOfProjectWithEditor + Identifier + perspective.project + IsVertical + + Layout + + + ContentConfiguration + + PBXBottomSmartGroupGIDs + + 1C37FBAC04509CD000000102 + 1C37FAAC04509CD000000102 + 1C08E77C0454961000C914BD + 1C37FABC05509CD000000102 + 1C37FABC05539CD112110102 + E2644B35053B69B200211256 + 1C37FABC04509CD000100104 + 1CC0EA4004350EF90044410B + 1CC0EA4004350EF90041110B + + PBXProjectModuleGUID + 1CE0B1FE06471DED0097A5F4 + PBXProjectModuleLabel + Files + PBXProjectStructureProvided + yes + PBXSmartGroupTreeModuleColumnData + + PBXSmartGroupTreeModuleColumnWidthsKey + + 186 + + PBXSmartGroupTreeModuleColumnsKey_v4 + + MainColumn + + + PBXSmartGroupTreeModuleOutlineStateKey_v7 + + PBXSmartGroupTreeModuleOutlineStateExpansionKey + + 0867D691FE84028FC02AAC07 + 8ED54728082DBF3B00C4727A + 08FB77ACFE841707C02AAC07 + 1C37FBAC04509CD000000102 + 1C37FABC05509CD000000102 + + PBXSmartGroupTreeModuleOutlineStateSelectionKey + + + 15 + 0 + + + PBXSmartGroupTreeModuleOutlineStateVisibleRectKey + {{0, 128}, {186, 566}} + + PBXTopSmartGroupGIDs + + XCIncludePerspectivesSwitch + + XCSharingToken + com.apple.Xcode.GFSharingToken + + GeometryConfiguration + + Frame + {{0, 0}, {203, 584}} + GroupTreeTableConfiguration + + MainColumn + 186 + + RubberWindowFrame + 0 121 1024 625 0 0 1024 746 + + Module + PBXSmartGroupTreeModule + Proportion + 203pt + + + Dock + + + BecomeActive + + ContentConfiguration + + PBXProjectModuleGUID + 1CE0B20306471E060097A5F4 + PBXProjectModuleLabel + metadata.h + PBXSplitModuleInNavigatorKey + + Split0 + + PBXProjectModuleGUID + 1CE0B20406471E060097A5F4 + PBXProjectModuleLabel + metadata.h + _historyCapacity + 0 + bookmark + 8E0EBEEF084BA727003A6E64 + history + + 8ED5479E082DC2AB00C4727A + 8ED5479F082DC2AB00C4727A + 8ED547A6082DC2AB00C4727A + 8ED547D7082DC32600C4727A + 8ED547D9082DC32600C4727A + 8ED547DA082DC32600C4727A + 8ED547DB082DC32600C4727A + 8ED547DC082DC32600C4727A + 8E4DB98A082DC49D0040D7AB + 8E4DB98B082DC49D0040D7AB + 8E4DB9CF082DC5AE0040D7AB + 8E4DB9D0082DC5AE0040D7AB + 8E4DB9D2082DC5AE0040D7AB + 8E4DB9D3082DC5AE0040D7AB + 8E4DB9D4082DC5AE0040D7AB + 8E4DB9D5082DC5AE0040D7AB + 8E4DBA09082DC6AE0040D7AB + 8E4DBA1E082DC88D0040D7AB + 8EE508A5082DC942006BCDDE + 8EE508A6082DC942006BCDDE + 8EE508A7082DC942006BCDDE + 8EE508A8082DC942006BCDDE + 8EE508A9082DC942006BCDDE + 8EE508AA082DC942006BCDDE + 8EE508AC082DC942006BCDDE + 8EE508AD082DC942006BCDDE + 8EE508AE082DC942006BCDDE + 8EE508AF082DC942006BCDDE + 8EE508B0082DC942006BCDDE + 8EE508B1082DC942006BCDDE + 8EE508B2082DC942006BCDDE + 8EE508D7082DC960006BCDDE + 8E6F2A9608480FE00011F126 + 8E288E35084B920E00EA2202 + + prevStack + + 8ED547AA082DC2AB00C4727A + 8ED547AB082DC2AB00C4727A + 8ED547AC082DC2AB00C4727A + 8ED547AD082DC2AB00C4727A + 8ED547AE082DC2AB00C4727A + 8ED547AF082DC2AB00C4727A + 8ED547B1082DC2AB00C4727A + 8ED547B2082DC2AB00C4727A + 8ED547B5082DC2AB00C4727A + 8ED547B8082DC2AB00C4727A + 8ED547BA082DC2AB00C4727A + 8ED547BE082DC2AB00C4727A + 8ED547E0082DC32600C4727A + 8ED547E1082DC32600C4727A + 8ED547E2082DC32600C4727A + 8ED547E3082DC32600C4727A + 8ED547E4082DC32600C4727A + 8E4DB993082DC49D0040D7AB + 8E4DB9DC082DC5AE0040D7AB + 8E4DB9E3082DC5AE0040D7AB + 8E4DB9E4082DC5AE0040D7AB + 8E4DB9E8082DC5AE0040D7AB + 8E4DB9EA082DC5AE0040D7AB + 8E4DB9EF082DC5AE0040D7AB + 8E4DB9F0082DC5AE0040D7AB + 8EE508B3082DC942006BCDDE + 8EE508B5082DC942006BCDDE + 8EE508BC082DC942006BCDDE + 8EE508BD082DC942006BCDDE + 8EE508BE082DC942006BCDDE + 8EE508BF082DC942006BCDDE + 8EE508D0082DC942006BCDDE + 8EE508DA082DC960006BCDDE + 8E6F2A9708480FE00011F126 + + + SplitCount + 1 + + StatusBarVisibility + + + GeometryConfiguration + + Frame + {{0, 0}, {816, 405}} + RubberWindowFrame + 0 121 1024 625 0 0 1024 746 + + Module + PBXNavigatorGroup + Proportion + 405pt + + + ContentConfiguration + + PBXProjectModuleGUID + 1CE0B20506471E060097A5F4 + PBXProjectModuleLabel + Detail + + GeometryConfiguration + + Frame + {{0, 410}, {816, 174}} + RubberWindowFrame + 0 121 1024 625 0 0 1024 746 + + Module + XCDetailModule + Proportion + 174pt + + + Proportion + 816pt + + + Name + Project + ServiceClasses + + XCModuleDock + PBXSmartGroupTreeModule + XCModuleDock + PBXNavigatorGroup + XCDetailModule + + TableOfContents + + 8E0EBEF0084BA727003A6E64 + 1CE0B1FE06471DED0097A5F4 + 8E0EBEF1084BA727003A6E64 + 1CE0B20306471E060097A5F4 + 1CE0B20506471E060097A5F4 + + ToolbarConfiguration + xcode.toolbar.config.default + + + ControllerClassBaseName + + IconName + WindowOfProject + Identifier + perspective.morph + IsVertical + 0 + Layout + + + BecomeActive + 1 + ContentConfiguration + + PBXBottomSmartGroupGIDs + + 1C37FBAC04509CD000000102 + 1C37FAAC04509CD000000102 + 1C08E77C0454961000C914BD + 1C37FABC05509CD000000102 + 1C37FABC05539CD112110102 + E2644B35053B69B200211256 + 1C37FABC04509CD000100104 + 1CC0EA4004350EF90044410B + 1CC0EA4004350EF90041110B + + PBXProjectModuleGUID + 11E0B1FE06471DED0097A5F4 + PBXProjectModuleLabel + Files + PBXProjectStructureProvided + yes + PBXSmartGroupTreeModuleColumnData + + PBXSmartGroupTreeModuleColumnWidthsKey + + 186 + + PBXSmartGroupTreeModuleColumnsKey_v4 + + MainColumn + + + PBXSmartGroupTreeModuleOutlineStateKey_v7 + + PBXSmartGroupTreeModuleOutlineStateExpansionKey + + 29B97314FDCFA39411CA2CEA + 1C37FABC05509CD000000102 + + PBXSmartGroupTreeModuleOutlineStateSelectionKey + + + 0 + + + PBXSmartGroupTreeModuleOutlineStateVisibleRectKey + {{0, 0}, {186, 337}} + + PBXTopSmartGroupGIDs + + XCIncludePerspectivesSwitch + 1 + XCSharingToken + com.apple.Xcode.GFSharingToken + + GeometryConfiguration + + Frame + {{0, 0}, {203, 355}} + GroupTreeTableConfiguration + + MainColumn + 186 + + RubberWindowFrame + 373 269 690 397 0 0 1440 878 + + Module + PBXSmartGroupTreeModule + Proportion + 100% + + + Name + Morph + PreferredWidth + 300 + ServiceClasses + + XCModuleDock + PBXSmartGroupTreeModule + + TableOfContents + + 11E0B1FE06471DED0097A5F4 + + ToolbarConfiguration + xcode.toolbar.config.default.short + + + PerspectivesBarVisible + + ShelfIsVisible + + SourceDescription + file at '/System/Library/PrivateFrameworks/DevToolsInterface.framework/Versions/A/Resources/XCPerspectivesSpecificationMode1.xcperspec' + StatusbarIsVisible + + TimeStamp + 0.0 + ToolbarDisplayMode + 1 + ToolbarIsVisible + + ToolbarSizeMode + 1 + Type + Perspectives + UpdateMessage + The Default Workspace in this version of Xcode now includes support to hide and show the detail view (what has been referred to as the "Metro-Morph" feature). You must discard your current Default Workspace settings and update to the latest Default Workspace in order to gain this feature. Do you wish to update to the latest Workspace defaults for project '%@'? + WindowJustification + 5 + WindowOrderList + + /Users/xugg/Projects/Cog/Libraries/FLAC/FLAC.xcode + + WindowString + 0 121 1024 625 0 0 1024 746 + WindowTools + + + FirstTimeWindowDisplayed + + Identifier + windowTool.build + IsVertical + + Layout + + + Dock + + + ContentConfiguration + + PBXProjectModuleGUID + 1CD0528F0623707200166675 + PBXProjectModuleLabel + metadata_object.c + StatusBarVisibility + + + GeometryConfiguration + + Frame + {{0, 0}, {500, 218}} + RubberWindowFrame + 401 160 500 500 0 0 1024 746 + + Module + PBXNavigatorGroup + Proportion + 218pt + + + BecomeActive + + ContentConfiguration + + PBXProjectModuleGUID + XCMainBuildResultsModuleGUID + PBXProjectModuleLabel + Build + XCBuildResultsTrigger_Collapse + 1021 + XCBuildResultsTrigger_Open + 1011 + + GeometryConfiguration + + Frame + {{0, 223}, {500, 236}} + RubberWindowFrame + 401 160 500 500 0 0 1024 746 + + Module + PBXBuildResultsModule + Proportion + 236pt + + + Proportion + 459pt + + + Name + Build Results + ServiceClasses + + PBXBuildResultsModule + + StatusbarIsVisible + + TableOfContents + + 8ED5471B082DBED700C4727A + 8EE5089F082DC919006BCDDE + 1CD0528F0623707200166675 + XCMainBuildResultsModuleGUID + + ToolbarConfiguration + xcode.toolbar.config.build + WindowString + 401 160 500 500 0 0 1024 746 + WindowToolGUID + 8ED5471B082DBED700C4727A + WindowToolIsVisible + + + + Identifier + windowTool.debugger + Layout + + + Dock + + + ContentConfiguration + + Debugger + + HorizontalSplitView + + _collapsingFrameDimension + 0.0 + _indexOfCollapsedView + 0 + _percentageOfCollapsedView + 0.0 + isCollapsed + yes + sizes + + {{0, 0}, {317, 164}} + {{317, 0}, {377, 164}} + + + VerticalSplitView + + _collapsingFrameDimension + 0.0 + _indexOfCollapsedView + 0 + _percentageOfCollapsedView + 0.0 + isCollapsed + yes + sizes + + {{0, 0}, {694, 164}} + {{0, 164}, {694, 216}} + + + + LauncherConfigVersion + 8 + PBXProjectModuleGUID + 1C162984064C10D400B95A72 + PBXProjectModuleLabel + Debug - GLUTExamples (Underwater) + + GeometryConfiguration + + DebugConsoleDrawerSize + {100, 120} + DebugConsoleVisible + None + DebugConsoleWindowFrame + {{200, 200}, {500, 300}} + DebugSTDIOWindowFrame + {{200, 200}, {500, 300}} + Frame + {{0, 0}, {694, 380}} + RubberWindowFrame + 321 238 694 422 0 0 1440 878 + + Module + PBXDebugSessionModule + Proportion + 100% + + + Proportion + 100% + + + Name + Debugger + ServiceClasses + + PBXDebugSessionModule + + StatusbarIsVisible + 1 + TableOfContents + + 1CD10A99069EF8BA00B06720 + 1C0AD2AB069F1E9B00FABCE6 + 1C162984064C10D400B95A72 + 1C0AD2AC069F1E9B00FABCE6 + + ToolbarConfiguration + xcode.toolbar.config.debug + WindowString + 321 238 694 422 0 0 1440 878 + WindowToolGUID + 1CD10A99069EF8BA00B06720 + WindowToolIsVisible + 0 + + + FirstTimeWindowDisplayed + + Identifier + windowTool.find + IsVertical + + Layout + + + Dock + + + Dock + + + BecomeActive + + ContentConfiguration + + PBXProjectModuleGUID + 1CDD528C0622207200134675 + PBXProjectModuleLabel + metadata.h + StatusBarVisibility + + + GeometryConfiguration + + Frame + {{0, 0}, {1024, 159}} + RubberWindowFrame + 0 65 1024 681 0 0 1024 746 + + Module + PBXNavigatorGroup + Proportion + 1024pt + + + Proportion + 159pt + + + ContentConfiguration + + PBXProjectModuleGUID + 1CD0528E0623707200166675 + PBXProjectModuleLabel + Project Find + + GeometryConfiguration + + Frame + {{0, 164}, {1024, 476}} + RubberWindowFrame + 0 65 1024 681 0 0 1024 746 + + Module + PBXProjectFindModule + Proportion + 476pt + + + Proportion + 640pt + + + Name + Project Find + ServiceClasses + + PBXProjectFindModule + + StatusbarIsVisible + + TableOfContents + + 1C530D57069F1CE1000CFCEE + 8E6F2A9208480FDE0011F126 + 8E6F2A9308480FDE0011F126 + 1CDD528C0622207200134675 + 1CD0528E0623707200166675 + + WindowString + 0 65 1024 681 0 0 1024 746 + WindowToolGUID + 1C530D57069F1CE1000CFCEE + WindowToolIsVisible + + + + Identifier + MENUSEPARATOR + + + Identifier + windowTool.debuggerConsole + Layout + + + Dock + + + BecomeActive + 1 + ContentConfiguration + + PBXProjectModuleGUID + 1C78EAAC065D492600B07095 + PBXProjectModuleLabel + Debugger Console + + GeometryConfiguration + + Frame + {{0, 0}, {440, 358}} + RubberWindowFrame + 650 41 440 400 0 0 1280 1002 + + Module + PBXDebugCLIModule + Proportion + 358pt + + + Proportion + 358pt + + + Name + Debugger Console + ServiceClasses + + PBXDebugCLIModule + + StatusbarIsVisible + 1 + TableOfContents + + 1C78EAAD065D492600B07095 + 1C78EAAE065D492600B07095 + 1C78EAAC065D492600B07095 + + WindowString + 650 41 440 400 0 0 1280 1002 + + + Identifier + windowTool.run + Layout + + + Dock + + + ContentConfiguration + + LauncherConfigVersion + 3 + PBXProjectModuleGUID + 1CD0528B0623707200166675 + PBXProjectModuleLabel + Run + Runner + + HorizontalSplitView + + _collapsingFrameDimension + 0.0 + _indexOfCollapsedView + 0 + _percentageOfCollapsedView + 0.0 + isCollapsed + yes + sizes + + {{0, 0}, {493, 167}} + {{0, 176}, {493, 267}} + + + VerticalSplitView + + _collapsingFrameDimension + 0.0 + _indexOfCollapsedView + 0 + _percentageOfCollapsedView + 0.0 + isCollapsed + yes + sizes + + {{0, 0}, {405, 443}} + {{414, 0}, {514, 443}} + + + + + GeometryConfiguration + + Frame + {{0, 0}, {460, 159}} + RubberWindowFrame + 316 696 459 200 0 0 1280 1002 + + Module + PBXRunSessionModule + Proportion + 159pt + + + Proportion + 159pt + + + Name + Run Log + ServiceClasses + + PBXRunSessionModule + + StatusbarIsVisible + 1 + TableOfContents + + 1C0AD2B3069F1EA900FABCE6 + 1C0AD2B4069F1EA900FABCE6 + 1CD0528B0623707200166675 + 1C0AD2B5069F1EA900FABCE6 + + ToolbarConfiguration + xcode.toolbar.config.run + WindowString + 316 696 459 200 0 0 1280 1002 + WindowToolGUID + 1C0AD2B3069F1EA900FABCE6 + WindowToolIsVisible + 0 + + + Identifier + windowTool.scm + Layout + + + Dock + + + ContentConfiguration + + PBXProjectModuleGUID + 1C78EAB2065D492600B07095 + PBXProjectModuleLabel + <No Editor> + PBXSplitModuleInNavigatorKey + + Split0 + + PBXProjectModuleGUID + 1C78EAB3065D492600B07095 + + SplitCount + 1 + + StatusBarVisibility + 1 + + GeometryConfiguration + + Frame + {{0, 0}, {452, 0}} + RubberWindowFrame + 743 379 452 308 0 0 1280 1002 + + Module + PBXNavigatorGroup + Proportion + 0pt + + + BecomeActive + 1 + ContentConfiguration + + PBXProjectModuleGUID + 1CD052920623707200166675 + PBXProjectModuleLabel + SCM + + GeometryConfiguration + + ConsoleFrame + {{0, 259}, {452, 0}} + Frame + {{0, 7}, {452, 259}} + RubberWindowFrame + 743 379 452 308 0 0 1280 1002 + TableConfiguration + + Status + 30 + FileName + 199 + Path + 197.09500122070312 + + TableFrame + {{0, 0}, {452, 250}} + + Module + PBXCVSModule + Proportion + 262pt + + + Proportion + 266pt + + + Name + SCM + ServiceClasses + + PBXCVSModule + + StatusbarIsVisible + 1 + TableOfContents + + 1C78EAB4065D492600B07095 + 1C78EAB5065D492600B07095 + 1C78EAB2065D492600B07095 + 1CD052920623707200166675 + + ToolbarConfiguration + xcode.toolbar.config.scm + WindowString + 743 379 452 308 0 0 1280 1002 + + + Identifier + windowTool.breakpoints + Layout + + + Dock + + + BecomeActive + 1 + ContentConfiguration + + PBXProjectModuleGUID + 1CD052930623707200166675 + PBXProjectModuleLabel + Breakpoints + + GeometryConfiguration + + BreakpointsTreeTableConfiguration + + enabledColumn + 16 + breakpointColumn + 201.5830078125 + + Frame + {{0, 0}, {240, 195}} + RubberWindowFrame + 342 421 240 216 0 0 1440 878 + + Module + PBXDebugBreakpointsModule + Proportion + 195pt + + + Proportion + 195pt + + + Name + Breakpoints + ServiceClasses + + PBXDebugBreakpointsModule + + StatusbarIsVisible + 0 + TableOfContents + + 1C0AD2AD069F1E9B00FABCE6 + 1C0AD2AE069F1E9B00FABCE6 + 1CD052930623707200166675 + + WindowString + 342 421 240 216 0 0 1440 878 + WindowToolGUID + 1C0AD2AD069F1E9B00FABCE6 + WindowToolIsVisible + 0 + + + Identifier + windowTool.bookmarks + Layout + + + Dock + + + Module + PBXBookmarksModule + Proportion + 100% + + + Proportion + 100% + + + Name + Bookmarks + ServiceClasses + + PBXBookmarksModule + + StatusbarIsVisible + 0 + WindowString + 538 42 401 187 0 0 1280 1002 + + + Identifier + windowTool.classBrowser + Layout + + + Dock + + + BecomeActive + 1 + ContentConfiguration + + OptionsSetName + Hierarchy, all classes + PBXProjectModuleGUID + 1CA6456E063B45B4001379D8 + PBXProjectModuleLabel + Class Browser - NSObject + + GeometryConfiguration + + ClassesFrame + {{0, 0}, {374, 96}} + ClassesTreeTableConfiguration + + PBXClassNameColumnIdentifier + 208 + PBXClassBookColumnIdentifier + 22 + + Frame + {{0, 0}, {630, 331}} + MembersFrame + {{0, 105}, {374, 395}} + MembersTreeTableConfiguration + + PBXMemberTypeIconColumnIdentifier + 22 + PBXMemberNameColumnIdentifier + 216 + PBXMemberTypeColumnIdentifier + 97 + PBXMemberBookColumnIdentifier + 22 + + PBXModuleWindowStatusBarHidden2 + 1 + RubberWindowFrame + 385 179 630 352 0 0 1440 878 + + Module + PBXClassBrowserModule + Proportion + 332pt + + + Proportion + 332pt + + + Name + Class Browser + ServiceClasses + + PBXClassBrowserModule + + StatusbarIsVisible + 0 + TableOfContents + + 1C0AD2AF069F1E9B00FABCE6 + 1C0AD2B0069F1E9B00FABCE6 + 1CA6456E063B45B4001379D8 + + ToolbarConfiguration + xcode.toolbar.config.classbrowser + WindowString + 385 179 630 352 0 0 1440 878 + WindowToolGUID + 1C0AD2AF069F1E9B00FABCE6 + WindowToolIsVisible + 0 + + + + diff --git a/Libraries/FLAC/FLAC.xcode/xugg.pbxuser b/Libraries/FLAC/FLAC.xcode/xugg.pbxuser new file mode 100644 index 000000000..be051f43a --- /dev/null +++ b/Libraries/FLAC/FLAC.xcode/xugg.pbxuser @@ -0,0 +1,1094 @@ +// !$*UTF8*$! +{ + 0867D690FE84028FC02AAC07 = { + activeBuildStyle = 4F0BB7ED011F40E904CA0E50; + activeTarget = 8D07F2BC0486CC7A007CD1D0; + addToTargets = ( + 8D07F2BC0486CC7A007CD1D0, + ); + codeSenseManager = 8ED54617082DBE4500C4727A; + perUserDictionary = { + PBXConfiguration.PBXFileTableDataSource3.PBXExecutablesDataSource = { + PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; + PBXFileTableDataSourceColumnSortingKey = PBXExecutablesDataSource_NameID; + PBXFileTableDataSourceColumnWidthsKey = ( + 22, + 300, + 464.5835, + ); + PBXFileTableDataSourceColumnsKey = ( + PBXExecutablesDataSource_ActiveFlagID, + PBXExecutablesDataSource_NameID, + PBXExecutablesDataSource_CommentsID, + ); + }; + PBXConfiguration.PBXFileTableDataSource3.PBXFileTableDataSource = { + PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; + PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID; + PBXFileTableDataSourceColumnWidthsKey = ( + 20, + 577, + 20, + 48, + 43, + 43, + 20, + ); + PBXFileTableDataSourceColumnsKey = ( + PBXFileDataSource_FiletypeID, + PBXFileDataSource_Filename_ColumnID, + PBXFileDataSource_Built_ColumnID, + PBXFileDataSource_ObjectSize_ColumnID, + PBXFileDataSource_Errors_ColumnID, + PBXFileDataSource_Warnings_ColumnID, + PBXFileDataSource_Target_ColumnID, + ); + }; + PBXConfiguration.PBXTargetDataSource.PBXTargetDataSource = { + PBXFileTableDataSourceColumnSortingDirectionKey = 1; + PBXFileTableDataSourceColumnSortingKey = PBXTargetDataSource_PrimaryAttribute; + PBXFileTableDataSourceColumnWidthsKey = ( + 20, + 200, + 397, + 20, + 48, + 43, + 43, + ); + PBXFileTableDataSourceColumnsKey = ( + PBXFileDataSource_FiletypeID, + PBXFileDataSource_Filename_ColumnID, + PBXTargetDataSource_PrimaryAttribute, + PBXFileDataSource_Built_ColumnID, + PBXFileDataSource_ObjectSize_ColumnID, + PBXFileDataSource_Errors_ColumnID, + PBXFileDataSource_Warnings_ColumnID, + ); + }; + PBXPerProjectTemplateStateSaveDate = 139175714; + PBXWorkspaceStateSaveDate = 139175714; + }; + perUserProjectItems = { + 8E0EBEEF084BA727003A6E64 = 8E0EBEEF084BA727003A6E64; + 8E288E35084B920E00EA2202 = 8E288E35084B920E00EA2202; + 8E4DB98A082DC49D0040D7AB = 8E4DB98A082DC49D0040D7AB; + 8E4DB98B082DC49D0040D7AB = 8E4DB98B082DC49D0040D7AB; + 8E4DB993082DC49D0040D7AB = 8E4DB993082DC49D0040D7AB; + 8E4DB9CF082DC5AE0040D7AB = 8E4DB9CF082DC5AE0040D7AB; + 8E4DB9D0082DC5AE0040D7AB = 8E4DB9D0082DC5AE0040D7AB; + 8E4DB9D2082DC5AE0040D7AB = 8E4DB9D2082DC5AE0040D7AB; + 8E4DB9D3082DC5AE0040D7AB = 8E4DB9D3082DC5AE0040D7AB; + 8E4DB9D4082DC5AE0040D7AB = 8E4DB9D4082DC5AE0040D7AB; + 8E4DB9D5082DC5AE0040D7AB = 8E4DB9D5082DC5AE0040D7AB; + 8E4DB9DC082DC5AE0040D7AB = 8E4DB9DC082DC5AE0040D7AB; + 8E4DB9E3082DC5AE0040D7AB = 8E4DB9E3082DC5AE0040D7AB; + 8E4DB9E4082DC5AE0040D7AB = 8E4DB9E4082DC5AE0040D7AB; + 8E4DB9E8082DC5AE0040D7AB = 8E4DB9E8082DC5AE0040D7AB; + 8E4DB9EA082DC5AE0040D7AB = 8E4DB9EA082DC5AE0040D7AB; + 8E4DB9EF082DC5AE0040D7AB = 8E4DB9EF082DC5AE0040D7AB; + 8E4DB9F0082DC5AE0040D7AB = 8E4DB9F0082DC5AE0040D7AB; + 8E4DBA09082DC6AE0040D7AB = 8E4DBA09082DC6AE0040D7AB; + 8E4DBA1E082DC88D0040D7AB = 8E4DBA1E082DC88D0040D7AB; + 8E6F2A9608480FE00011F126 = 8E6F2A9608480FE00011F126; + 8E6F2A9708480FE00011F126 = 8E6F2A9708480FE00011F126; + 8ED5479E082DC2AB00C4727A = 8ED5479E082DC2AB00C4727A; + 8ED5479F082DC2AB00C4727A = 8ED5479F082DC2AB00C4727A; + 8ED547A6082DC2AB00C4727A = 8ED547A6082DC2AB00C4727A; + 8ED547AA082DC2AB00C4727A = 8ED547AA082DC2AB00C4727A; + 8ED547AB082DC2AB00C4727A = 8ED547AB082DC2AB00C4727A; + 8ED547AC082DC2AB00C4727A = 8ED547AC082DC2AB00C4727A; + 8ED547AD082DC2AB00C4727A = 8ED547AD082DC2AB00C4727A; + 8ED547AE082DC2AB00C4727A = 8ED547AE082DC2AB00C4727A; + 8ED547AF082DC2AB00C4727A = 8ED547AF082DC2AB00C4727A; + 8ED547B1082DC2AB00C4727A = 8ED547B1082DC2AB00C4727A; + 8ED547B2082DC2AB00C4727A = 8ED547B2082DC2AB00C4727A; + 8ED547B5082DC2AB00C4727A = 8ED547B5082DC2AB00C4727A; + 8ED547B8082DC2AB00C4727A = 8ED547B8082DC2AB00C4727A; + 8ED547BA082DC2AB00C4727A = 8ED547BA082DC2AB00C4727A; + 8ED547BE082DC2AB00C4727A = 8ED547BE082DC2AB00C4727A; + 8ED547D7082DC32600C4727A = 8ED547D7082DC32600C4727A; + 8ED547D9082DC32600C4727A = 8ED547D9082DC32600C4727A; + 8ED547DA082DC32600C4727A = 8ED547DA082DC32600C4727A; + 8ED547DB082DC32600C4727A = 8ED547DB082DC32600C4727A; + 8ED547DC082DC32600C4727A = 8ED547DC082DC32600C4727A; + 8ED547E0082DC32600C4727A = 8ED547E0082DC32600C4727A; + 8ED547E1082DC32600C4727A = 8ED547E1082DC32600C4727A; + 8ED547E2082DC32600C4727A = 8ED547E2082DC32600C4727A; + 8ED547E3082DC32600C4727A = 8ED547E3082DC32600C4727A; + 8ED547E4082DC32600C4727A = 8ED547E4082DC32600C4727A; + 8EE508A5082DC942006BCDDE = 8EE508A5082DC942006BCDDE; + 8EE508A6082DC942006BCDDE = 8EE508A6082DC942006BCDDE; + 8EE508A7082DC942006BCDDE = 8EE508A7082DC942006BCDDE; + 8EE508A8082DC942006BCDDE = 8EE508A8082DC942006BCDDE; + 8EE508A9082DC942006BCDDE = 8EE508A9082DC942006BCDDE; + 8EE508AA082DC942006BCDDE = 8EE508AA082DC942006BCDDE; + 8EE508AC082DC942006BCDDE = 8EE508AC082DC942006BCDDE; + 8EE508AD082DC942006BCDDE = 8EE508AD082DC942006BCDDE; + 8EE508AE082DC942006BCDDE = 8EE508AE082DC942006BCDDE; + 8EE508AF082DC942006BCDDE = 8EE508AF082DC942006BCDDE; + 8EE508B0082DC942006BCDDE = 8EE508B0082DC942006BCDDE; + 8EE508B1082DC942006BCDDE = 8EE508B1082DC942006BCDDE; + 8EE508B2082DC942006BCDDE = 8EE508B2082DC942006BCDDE; + 8EE508B3082DC942006BCDDE = 8EE508B3082DC942006BCDDE; + 8EE508B5082DC942006BCDDE = 8EE508B5082DC942006BCDDE; + 8EE508BC082DC942006BCDDE = 8EE508BC082DC942006BCDDE; + 8EE508BD082DC942006BCDDE = 8EE508BD082DC942006BCDDE; + 8EE508BE082DC942006BCDDE = 8EE508BE082DC942006BCDDE; + 8EE508BF082DC942006BCDDE = 8EE508BF082DC942006BCDDE; + 8EE508D0082DC942006BCDDE = 8EE508D0082DC942006BCDDE; + 8EE508D7082DC960006BCDDE = 8EE508D7082DC960006BCDDE; + 8EE508DA082DC960006BCDDE = 8EE508DA082DC960006BCDDE; + }; + sourceControlManager = 8ED54616082DBE4500C4727A; + userBuildSettings = { + }; + }; + 8D07F2BC0486CC7A007CD1D0 = { + activeExec = 0; + }; + 8E0EBEEF084BA727003A6E64 = { + fRef = 8ED54730082DBF5200C4727A; + isa = PBXTextBookmark; + name = "metadata.h: 81"; + rLen = 0; + rLoc = 3421; + rType = 0; + vrLen = 1302; + vrLoc = 2884; + }; + 8E288E35084B920E00EA2202 = { + fRef = 8ED54730082DBF5200C4727A; + isa = PBXTextBookmark; + name = "metadata.h: 81"; + rLen = 0; + rLoc = 3421; + rType = 0; + vrLen = 1302; + vrLoc = 2884; + }; + 8E4DB968082DC4530040D7AB = { + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = file_decoder.h; + path = /Users/xugg/Projects/Cog/Libraries/FLAC/files/src/libflac/include/protected/file_decoder.h; + refType = 0; + sourceTree = ""; + }; + 8E4DB98A082DC49D0040D7AB = { + fRef = 8ED546DF082DBEAB00C4727A; + isa = PBXTextBookmark; + name = "stream_decoder.c: read_subframe_lpc_"; + rLen = 0; + rLoc = 4247; + rType = 0; + vrLen = 3122; + vrLoc = 2628; + }; + 8E4DB98B082DC49D0040D7AB = { + fRef = 8ED546AE082DBEAB00C4727A; + isa = PBXTextBookmark; + name = "float.c: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1812; + vrLoc = 0; + }; + 8E4DB993082DC49D0040D7AB = { + fRef = 8ED546AE082DBEAB00C4727A; + isa = PBXTextBookmark; + name = "float.c: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1812; + vrLoc = 0; + }; + 8E4DB9CF082DC5AE0040D7AB = { + fRef = 8ED546AC082DBEAB00C4727A; + isa = PBXTextBookmark; + name = "file_encoder.c: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1803; + vrLoc = 0; + }; + 8E4DB9D0082DC5AE0040D7AB = { + fRef = 8ED546AB082DBEAB00C4727A; + isa = PBXTextBookmark; + name = "FLAC__FileDecoder *file_decoder = (FLAC__FileDecoder *)client_data;"; + rLen = 69; + rLoc = 25129; + rType = 0; + vrLen = 1533; + vrLoc = 24103; + }; + 8E4DB9D2082DC5AE0040D7AB = { + fRef = 8ED546B8082DBEAB00C4727A; + isa = PBXTextBookmark; + name = "crc.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1797; + vrLoc = 0; + }; + 8E4DB9D3082DC5AE0040D7AB = { + fRef = 8ED546C6082DBEAB00C4727A; + isa = PBXTextBookmark; + name = "file_encoder.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1829; + vrLoc = 0; + }; + 8E4DB9D4082DC5AE0040D7AB = { + fRef = 8E4DB968082DC4530040D7AB; + isa = PBXTextBookmark; + name = ""; + rLen = 1; + rLoc = 1833; + rType = 0; + vrLen = 1733; + vrLoc = 108; + }; + 8E4DB9D5082DC5AE0040D7AB = { + fRef = 8ED546B4082DBEAB00C4727A; + isa = PBXTextBookmark; + name = "all.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1476; + vrLoc = 0; + }; + 8E4DB9DC082DC5AE0040D7AB = { + fRef = 8E4DB968082DC4530040D7AB; + isa = PBXTextBookmark; + name = "FLAC__FileDecoderState state;"; + rLen = 31; + rLoc = 1772; + rType = 0; + vrLen = 1834; + vrLoc = 0; + }; + 8E4DB9E3082DC5AE0040D7AB = { + fRef = 8ED546AB082DBEAB00C4727A; + isa = PBXTextBookmark; + name = "FLAC__FileDecoder *file_decoder = (FLAC__FileDecoder *)client_data;"; + rLen = 69; + rLoc = 25129; + rType = 0; + vrLen = 1533; + vrLoc = 24103; + }; + 8E4DB9E4082DC5AE0040D7AB = { + fRef = 8ED546AC082DBEAB00C4727A; + isa = PBXTextBookmark; + name = "file_encoder.c: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1803; + vrLoc = 0; + }; + 8E4DB9E8082DC5AE0040D7AB = { + fRef = 8ED5472B082DBF5200C4727A; + isa = PBXTextBookmark; + name = "callback.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1754; + vrLoc = 0; + }; + 8E4DB9EA082DC5AE0040D7AB = { + fRef = 8ED546B8082DBEAB00C4727A; + isa = PBXTextBookmark; + name = "crc.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1797; + vrLoc = 0; + }; + 8E4DB9EF082DC5AE0040D7AB = { + fRef = 8ED546B4082DBEAB00C4727A; + isa = PBXTextBookmark; + name = "all.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1476; + vrLoc = 0; + }; + 8E4DB9F0082DC5AE0040D7AB = { + fRef = 8ED546AF082DBEAB00C4727A; + isa = PBXTextBookmark; + name = "format.c: 47"; + rLen = 0; + rLoc = 1911; + rType = 0; + vrLen = 705; + vrLoc = 1330; + }; + 8E4DBA09082DC6AE0040D7AB = { + fRef = 8ED546C5082DBEAB00C4727A; + isa = PBXTextBookmark; + name = "file_decoder.h: 35"; + rLen = 0; + rLoc = 1696; + rType = 0; + vrLen = 1152; + vrLoc = 689; + }; + 8E4DBA13082DC7360040D7AB = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {775, 6020}}"; + sepNavSelRange = "{1591, 0}"; + sepNavVisRect = "{{0, 350}, {775, 373}}"; + }; + }; + 8E4DBA1E082DC88D0040D7AB = { + fRef = 8ED546AF082DBEAB00C4727A; + isa = PBXTextBookmark; + name = "FLAC_API const char *FLAC__VERSION_STRING = VERSION;"; + rLen = 53; + rLoc = 2077; + rType = 0; + vrLen = 885; + vrLoc = 1800; + }; + 8E6F2A5408480E9D0011F126 = { + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = all.h; + path = /Users/xugg/Projects/Cog/Libraries/FLAC/build/FLAC.framework/Versions/A/Headers/all.h; + refType = 0; + sourceTree = ""; + }; + 8E6F2A9608480FE00011F126 = { + fRef = 8E6F2A5408480E9D0011F126; + isa = PBXTextBookmark; + name = "all.h: 159"; + rLen = 0; + rLoc = 6871; + rType = 0; + vrLen = 687; + vrLoc = 1330; + }; + 8E6F2A9708480FE00011F126 = { + fRef = 8E6F2A5408480E9D0011F126; + isa = PBXTextBookmark; + name = "all.h: 159"; + rLen = 0; + rLoc = 6871; + rType = 0; + vrLen = 687; + vrLoc = 1330; + }; + 8ED54616082DBE4500C4727A = { + fallbackIsa = XCSourceControlManager; + isSCMEnabled = 0; + isa = PBXSourceControlManager; + scmConfiguration = { + }; + scmType = ""; + }; + 8ED54617082DBE4500C4727A = { + indexTemplatePath = ""; + isa = PBXCodeSenseManager; + }; + 8ED546A7082DBEAB00C4727A = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1562, 37674}}"; + sepNavSelRange = "{1703, 31}"; + sepNavVisRect = "{{0, 311}, {441, 319}}"; + }; + }; + 8ED546AA082DBEAB00C4727A = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {536, 2100}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRect = "{{0, 0}, {441, 319}}"; + }; + }; + 8ED546AB082DBEAB00C4727A = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1094, 9436}}"; + sepNavSelRange = "{3109, 180}"; + sepNavVisRect = "{{0, 574}, {459, 186}}"; + }; + }; + 8ED546AC082DBEAB00C4727A = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1652, 10878}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRect = "{{0, 0}, {775, 547}}"; + }; + }; + 8ED546AE082DBEAB00C4727A = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {775, 4270}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRect = "{{0, 0}, {775, 547}}"; + }; + }; + 8ED546AF082DBEAB00C4727A = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1052, 6650}}"; + sepNavSelRange = "{2077, 53}"; + sepNavVisRect = "{{0, 670}, {459, 186}}"; + }; + }; + 8ED546B4082DBEAB00C4727A = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {775, 686}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRect = "{{0, 0}, {775, 373}}"; + }; + }; + 8ED546B8082DBEAB00C4727A = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {775, 812}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRect = "{{0, 0}, {775, 547}}"; + }; + }; + 8ED546C5082DBEAB00C4727A = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {775, 588}}"; + sepNavSelRange = "{1696, 0}"; + sepNavVisRect = "{{0, 215}, {775, 373}}"; + }; + }; + 8ED546C6082DBEAB00C4727A = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {775, 588}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRect = "{{0, 0}, {775, 547}}"; + }; + }; + 8ED546D1082DBEAB00C4727A = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1214, 20622}}"; + sepNavSelRange = "{35721, 0}"; + sepNavVisRect = "{{0, 14871}, {775, 373}}"; + }; + }; + 8ED546DD082DBEAB00C4727A = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1622, 15568}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRect = "{{0, 0}, {441, 319}}"; + }; + }; + 8ED546DE082DBEAB00C4727A = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1184, 5600}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRect = "{{0, 0}, {441, 319}}"; + }; + }; + 8ED546DF082DBEAB00C4727A = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1610, 30212}}"; + sepNavSelRange = "{4247, 0}"; + sepNavVisRect = "{{0, 1008}, {775, 547}}"; + }; + }; + 8ED546E0082DBEAB00C4727A = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1922, 7000}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRect = "{{0, 0}, {441, 319}}"; + }; + }; + 8ED546E1082DBEAB00C4727A = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1508, 47530}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRect = "{{0, 0}, {441, 319}}"; + }; + }; + 8ED54723082DBF3500C4727A = { + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = bitbuffer.h; + path = /Users/xugg/Projects/Cog/Libraries/FLAC/files/src/libFLAC/include/private/bitbuffer.h; + refType = 0; + sourceTree = ""; + }; + 8ED54729082DBF5200C4727A = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {775, 2226}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRect = "{{0, 0}, {775, 373}}"; + }; + }; + 8ED5472A082DBF5200C4727A = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {775, 644}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRect = "{{0, 0}, {775, 373}}"; + }; + }; + 8ED5472B082DBF5200C4727A = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {775, 2548}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRect = "{{0, 0}, {775, 373}}"; + }; + }; + 8ED5472C082DBF5200C4727A = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {775, 672}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRect = "{{0, 112}, {775, 373}}"; + }; + }; + 8ED5472D082DBF5200C4727A = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1148, 9254}}"; + sepNavSelRange = "{348, 0}"; + sepNavVisRect = "{{0, 700}, {775, 373}}"; + }; + }; + 8ED5472E082DBF5200C4727A = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1406, 12208}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRect = "{{0, 0}, {775, 373}}"; + }; + }; + 8ED5472F082DBF5200C4727A = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {944, 12068}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRect = "{{0, 0}, {775, 373}}"; + }; + }; + 8ED54730082DBF5200C4727A = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1472, 26026}}"; + sepNavSelRange = "{3421, 0}"; + sepNavVisRect = "{{0, 966}, {775, 373}}"; + }; + }; + 8ED54731082DBF5200C4727A = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {775, 1036}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRect = "{{0, 0}, {775, 373}}"; + }; + }; + 8ED54732082DBF5200C4727A = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1268, 13048}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRect = "{{0, 0}, {775, 373}}"; + }; + }; + 8ED54733082DBF5200C4727A = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1532, 13902}}"; + sepNavSelRange = "{240, 0}"; + sepNavVisRect = "{{0, 341}, {775, 373}}"; + }; + }; + 8ED54734082DBF5200C4727A = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1172, 12236}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRect = "{{0, 0}, {775, 373}}"; + }; + }; + 8ED54735082DBF5200C4727A = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1430, 14910}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRect = "{{0, 0}, {775, 373}}"; + }; + }; + 8ED5474E082DC01F00C4727A = { + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = file_decoder.h; + path = /Users/xugg/Projects/Cog/Libraries/FLAC/files/src/libFLAC/include/protected/file_decoder.h; + refType = 0; + sourceTree = ""; + }; + 8ED5479E082DC2AB00C4727A = { + fRef = 8ED546A7082DBEAB00C4727A; + isa = PBXTextBookmark; + name = "#include \"private/bitbuffer.h\""; + rLen = 31; + rLoc = 1703; + rType = 0; + vrLen = 985; + vrLoc = 1116; + }; + 8ED5479F082DC2AB00C4727A = { + fRef = 8ED54723082DBF3500C4727A; + isa = PBXTextBookmark; + name = "#include \"FLAC/ordinals.h\""; + rLen = 27; + rLoc = 1720; + rType = 0; + vrLen = 849; + vrLoc = 1260; + }; + 8ED547A6082DC2AB00C4727A = { + fRef = 8ED546AA082DBEAB00C4727A; + isa = PBXTextBookmark; + name = "crc.c: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1189; + vrLoc = 0; + }; + 8ED547AA082DC2AB00C4727A = { + fRef = 8ED546A7082DBEAB00C4727A; + isa = PBXTextBookmark; + name = "#include \"private/bitbuffer.h\""; + rLen = 31; + rLoc = 1703; + rType = 0; + vrLen = 985; + vrLoc = 1116; + }; + 8ED547AB082DC2AB00C4727A = { + fRef = 8ED54723082DBF3500C4727A; + isa = PBXTextBookmark; + name = "#include \"FLAC/ordinals.h\""; + rLen = 27; + rLoc = 1720; + rType = 0; + vrLen = 849; + vrLoc = 1260; + }; + 8ED547AC082DC2AB00C4727A = { + fRef = 8ED54729082DBF5200C4727A; + isa = PBXTextBookmark; + name = "all.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1189; + vrLoc = 0; + }; + 8ED547AD082DC2AB00C4727A = { + fRef = 8ED5472D082DBF5200C4727A; + isa = PBXTextBookmark; + name = "file_decoder.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 618; + vrLoc = 23936; + }; + 8ED547AE082DC2AB00C4727A = { + fRef = 8ED54730082DBF5200C4727A; + isa = PBXTextBookmark; + name = "metadata.h: 1859"; + rLen = 0; + rLoc = 83577; + rType = 0; + vrLen = 930; + vrLoc = 82647; + }; + 8ED547AF082DC2AB00C4727A = { + fRef = 8ED5472F082DBF5200C4727A; + isa = PBXTextBookmark; + name = "format.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1189; + vrLoc = 0; + }; + 8ED547B1082DC2AB00C4727A = { + fRef = 8ED546C5082DBEAB00C4727A; + isa = PBXTextBookmark; + name = "file_decoder.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1189; + vrLoc = 0; + }; + 8ED547B2082DC2AB00C4727A = { + fRef = 8ED546C6082DBEAB00C4727A; + isa = PBXTextBookmark; + name = "file_encoder.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1184; + vrLoc = 0; + }; + 8ED547B5082DC2AB00C4727A = { + fRef = 8ED5474E082DC01F00C4727A; + isa = PBXTextBookmark; + name = "FLAC__FileDecoderState state;"; + rLen = 31; + rLoc = 1740; + rType = 0; + vrLen = 946; + vrLoc = 895; + }; + 8ED547B8082DC2AB00C4727A = { + fRef = 8ED5472C082DBF5200C4727A; + isa = PBXTextBookmark; + name = "export.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 533; + vrLoc = 1330; + }; + 8ED547BA082DC2AB00C4727A = { + fRef = 8ED5472E082DBF5200C4727A; + isa = PBXTextBookmark; + name = "file_encoder.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1179; + vrLoc = 0; + }; + 8ED547BE082DC2AB00C4727A = { + fRef = 8ED546AA082DBEAB00C4727A; + isa = PBXTextBookmark; + name = "crc.c: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1189; + vrLoc = 0; + }; + 8ED547D7082DC32600C4727A = { + fRef = 8ED5474E082DC01F00C4727A; + isa = PBXTextBookmark; + name = "file_decoder.h: 35"; + rLen = 0; + rLoc = 1696; + rType = 0; + vrLen = 988; + vrLoc = 821; + }; + 8ED547D9082DC32600C4727A = { + fRef = 8ED546DD082DBEAB00C4727A; + isa = PBXTextBookmark; + name = "seekable_stream_decoder.c: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1189; + vrLoc = 0; + }; + 8ED547DA082DC32600C4727A = { + fRef = 8ED546DE082DBEAB00C4727A; + isa = PBXTextBookmark; + name = "seekable_stream_encoder.c: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1179; + vrLoc = 0; + }; + 8ED547DB082DC32600C4727A = { + fRef = 8ED546E0082DBEAB00C4727A; + isa = PBXTextBookmark; + name = "stream_encoder_framing.c: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1189; + vrLoc = 0; + }; + 8ED547DC082DC32600C4727A = { + fRef = 8ED546E1082DBEAB00C4727A; + isa = PBXTextBookmark; + name = "stream_encoder.c: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1189; + vrLoc = 0; + }; + 8ED547E0082DC32600C4727A = { + fRef = 8ED546DD082DBEAB00C4727A; + isa = PBXTextBookmark; + name = "seekable_stream_decoder.c: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1189; + vrLoc = 0; + }; + 8ED547E1082DC32600C4727A = { + fRef = 8ED546DE082DBEAB00C4727A; + isa = PBXTextBookmark; + name = "seekable_stream_encoder.c: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1179; + vrLoc = 0; + }; + 8ED547E2082DC32600C4727A = { + fRef = 8ED546DF082DBEAB00C4727A; + isa = PBXTextBookmark; + name = "stream_decoder.c: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1189; + vrLoc = 0; + }; + 8ED547E3082DC32600C4727A = { + fRef = 8ED546E0082DBEAB00C4727A; + isa = PBXTextBookmark; + name = "stream_encoder_framing.c: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1189; + vrLoc = 0; + }; + 8ED547E4082DC32600C4727A = { + fRef = 8ED546E1082DBEAB00C4727A; + isa = PBXTextBookmark; + name = "stream_encoder.c: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1189; + vrLoc = 0; + }; + 8EE508A5082DC942006BCDDE = { + fRef = 8E4DBA13082DC7360040D7AB; + isa = PBXTextBookmark; + name = "lpc_asm.s: 31"; + rLen = 0; + rLoc = 1591; + rType = 0; + vrLen = 1018; + vrLoc = 1305; + }; + 8EE508A6082DC942006BCDDE = { + fRef = 8ED54729082DBF5200C4727A; + isa = PBXTextBookmark; + name = "all.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1476; + vrLoc = 0; + }; + 8EE508A7082DC942006BCDDE = { + fRef = 8ED5472B082DBF5200C4727A; + isa = PBXTextBookmark; + name = "callback.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1456; + vrLoc = 0; + }; + 8EE508A8082DC942006BCDDE = { + fRef = 8ED5472C082DBF5200C4727A; + isa = PBXTextBookmark; + name = "export.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1376; + vrLoc = 334; + }; + 8EE508A9082DC942006BCDDE = { + fRef = 8ED5472D082DBF5200C4727A; + isa = PBXTextBookmark; + name = "file_decoder.h: 9"; + rLen = 0; + rLoc = 348; + rType = 0; + vrLen = 1152; + vrLoc = 2005; + }; + 8EE508AA082DC942006BCDDE = { + fRef = 8ED5472F082DBF5200C4727A; + isa = PBXTextBookmark; + name = "format.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1476; + vrLoc = 0; + }; + 8EE508AC082DC942006BCDDE = { + fRef = 8ED54731082DBF5200C4727A; + isa = PBXTextBookmark; + name = "ordinals.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1476; + vrLoc = 0; + }; + 8EE508AD082DC942006BCDDE = { + fRef = 8ED54732082DBF5200C4727A; + isa = PBXTextBookmark; + name = "seekable_stream_decoder.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1476; + vrLoc = 0; + }; + 8EE508AE082DC942006BCDDE = { + fRef = 8ED54733082DBF5200C4727A; + isa = PBXTextBookmark; + name = "seekable_stream_encoder.h: 5"; + rLen = 0; + rLoc = 240; + rType = 0; + vrLen = 806; + vrLoc = 1250; + }; + 8EE508AF082DC942006BCDDE = { + fRef = 8ED5472A082DBF5200C4727A; + isa = PBXTextBookmark; + name = "assert.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1471; + vrLoc = 0; + }; + 8EE508B0082DC942006BCDDE = { + fRef = 8ED5472E082DBF5200C4727A; + isa = PBXTextBookmark; + name = "file_encoder.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1466; + vrLoc = 0; + }; + 8EE508B1082DC942006BCDDE = { + fRef = 8ED54734082DBF5200C4727A; + isa = PBXTextBookmark; + name = "stream_decoder.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1476; + vrLoc = 0; + }; + 8EE508B2082DC942006BCDDE = { + fRef = 8ED54735082DBF5200C4727A; + isa = PBXTextBookmark; + name = "stream_encoder.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1476; + vrLoc = 0; + }; + 8EE508B3082DC942006BCDDE = { + fRef = 8E4DBA13082DC7360040D7AB; + isa = PBXTextBookmark; + name = "lpc_asm.s: 31"; + rLen = 0; + rLoc = 1591; + rType = 0; + vrLen = 1018; + vrLoc = 1305; + }; + 8EE508B5082DC942006BCDDE = { + fRef = 8ED5472A082DBF5200C4727A; + isa = PBXTextBookmark; + name = "assert.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1471; + vrLoc = 0; + }; + 8EE508BC082DC942006BCDDE = { + fRef = 8ED54731082DBF5200C4727A; + isa = PBXTextBookmark; + name = "ordinals.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1476; + vrLoc = 0; + }; + 8EE508BD082DC942006BCDDE = { + fRef = 8ED54732082DBF5200C4727A; + isa = PBXTextBookmark; + name = "seekable_stream_decoder.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1476; + vrLoc = 0; + }; + 8EE508BE082DC942006BCDDE = { + fRef = 8ED54733082DBF5200C4727A; + isa = PBXTextBookmark; + name = "seekable_stream_encoder.h: 5"; + rLen = 0; + rLoc = 240; + rType = 0; + vrLen = 737; + vrLoc = 1320; + }; + 8EE508BF082DC942006BCDDE = { + fRef = 8ED54735082DBF5200C4727A; + isa = PBXTextBookmark; + name = "stream_encoder.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1476; + vrLoc = 0; + }; + 8EE508D0082DC942006BCDDE = { + fRef = 8ED54734082DBF5200C4727A; + isa = PBXTextBookmark; + name = "stream_decoder.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1476; + vrLoc = 0; + }; + 8EE508D7082DC960006BCDDE = { + fRef = 8ED546D1082DBEAB00C4727A; + isa = PBXTextBookmark; + name = "metadata_object.c: i"; + rLen = 0; + rLoc = 35721; + rType = 0; + vrLen = 941; + vrLoc = 35709; + }; + 8EE508DA082DC960006BCDDE = { + fRef = 8ED546D1082DBEAB00C4727A; + isa = PBXTextBookmark; + name = "metadata_object.c: i"; + rLen = 0; + rLoc = 35721; + rType = 0; + vrLen = 941; + vrLoc = 35709; + }; +} diff --git a/Libraries/FLAC/Files/AUTHORS b/Libraries/FLAC/Files/AUTHORS new file mode 100644 index 000000000..49ddae846 --- /dev/null +++ b/Libraries/FLAC/Files/AUTHORS @@ -0,0 +1,41 @@ +/* FLAC - Free Lossless Audio Codec + * Copyright (C) 2001,2002,2003,2004,2005 Josh Coalson + * + * This file is part the FLAC project. FLAC is comprised of several + * components distributed under difference licenses. The codec libraries + * are distributed under Xiph.Org's BSD-like license (see the file + * COPYING.Xiph in this distribution). All other programs, libraries, and + * plugins are distributed under the GPL (see COPYING.GPL). The documentation + * is distributed under the Gnu FDL (see COPYING.FDL). Each file in the + * FLAC distribution contains at the top the terms under which it may be + * distributed. + * + * Since this particular file is relevant to all components of FLAC, + * it may be distributed under the Xiph.Org license, which is the least + * restrictive of those mentioned above. See the file COPYING.Xiph in this + * distribution. + */ + + +FLAC (http://flac.sourceforge.net/) is an Open Source lossless audio +codec developed by Josh Coalson . + +Other major contributors and their contributions: +"Andrey Astafiev" +* Russian translation of the HTML documentation + +"Miroslav Lichvar" +* IA-32 assembly versions of several libFLAC routines + +"Brady Patterson" +* AIFF file support, PPC assembly versions of libFLAC routines + +"Daisuke Shimamura" +* i18n support in the XMMS plugin + +"X-Fixer" +* Configuration system, tag editing, and file info in the Winamp2 plugin + +"Matt Zimmerman" +* Libtool/autoconf/automake make system, flac man page + diff --git a/Libraries/FLAC/Files/COPYING.FDL b/Libraries/FLAC/Files/COPYING.FDL new file mode 100644 index 000000000..b42936beb --- /dev/null +++ b/Libraries/FLAC/Files/COPYING.FDL @@ -0,0 +1,355 @@ + GNU Free Documentation License + Version 1.1, March 2000 + + Copyright (C) 2000 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + +0. PREAMBLE + +The purpose of this License is to make a manual, textbook, or other +written document "free" in the sense of freedom: to assure everyone +the effective freedom to copy and redistribute it, with or without +modifying it, either commercially or noncommercially. Secondarily, +this License preserves for the author and publisher a way to get +credit for their work, while not being considered responsible for +modifications made by others. + +This License is a kind of "copyleft", which means that derivative +works of the document must themselves be free in the same sense. It +complements the GNU General Public License, which is a copyleft +license designed for free software. + +We have designed this License in order to use it for manuals for free +software, because free software needs free documentation: a free +program should come with manuals providing the same freedoms that the +software does. But this License is not limited to software manuals; +it can be used for any textual work, regardless of subject matter or +whether it is published as a printed book. We recommend this License +principally for works whose purpose is instruction or reference. + + +1. APPLICABILITY AND DEFINITIONS + +This License applies to any manual or other work that contains a +notice placed by the copyright holder saying it can be distributed +under the terms of this License. The "Document", below, refers to any +such manual or work. Any member of the public is a licensee, and is +addressed as "you". + +A "Modified Version" of the Document means any work containing the +Document or a portion of it, either copied verbatim, or with +modifications and/or translated into another language. + +A "Secondary Section" is a named appendix or a front-matter section of +the Document that deals exclusively with the relationship of the +publishers or authors of the Document to the Document's overall subject +(or to related matters) and contains nothing that could fall directly +within that overall subject. (For example, if the Document is in part a +textbook of mathematics, a Secondary Section may not explain any +mathematics.) The relationship could be a matter of historical +connection with the subject or with related matters, or of legal, +commercial, philosophical, ethical or political position regarding +them. + +The "Invariant Sections" are certain Secondary Sections whose titles +are designated, as being those of Invariant Sections, in the notice +that says that the Document is released under this License. + +The "Cover Texts" are certain short passages of text that are listed, +as Front-Cover Texts or Back-Cover Texts, in the notice that says that +the Document is released under this License. + +A "Transparent" copy of the Document means a machine-readable copy, +represented in a format whose specification is available to the +general public, whose contents can be viewed and edited directly and +straightforwardly with generic text editors or (for images composed of +pixels) generic paint programs or (for drawings) some widely available +drawing editor, and that is suitable for input to text formatters or +for automatic translation to a variety of formats suitable for input +to text formatters. A copy made in an otherwise Transparent file +format whose markup has been designed to thwart or discourage +subsequent modification by readers is not Transparent. A copy that is +not "Transparent" is called "Opaque". + +Examples of suitable formats for Transparent copies include plain +ASCII without markup, Texinfo input format, LaTeX input format, SGML +or XML using a publicly available DTD, and standard-conforming simple +HTML designed for human modification. Opaque formats include +PostScript, PDF, proprietary formats that can be read and edited only +by proprietary word processors, SGML or XML for which the DTD and/or +processing tools are not generally available, and the +machine-generated HTML produced by some word processors for output +purposes only. + +The "Title Page" means, for a printed book, the title page itself, +plus such following pages as are needed to hold, legibly, the material +this License requires to appear in the title page. For works in +formats which do not have any title page as such, "Title Page" means +the text near the most prominent appearance of the work's title, +preceding the beginning of the body of the text. + + +2. VERBATIM COPYING + +You may copy and distribute the Document in any medium, either +commercially or noncommercially, provided that this License, the +copyright notices, and the license notice saying this License applies +to the Document are reproduced in all copies, and that you add no other +conditions whatsoever to those of this License. You may not use +technical measures to obstruct or control the reading or further +copying of the copies you make or distribute. However, you may accept +compensation in exchange for copies. If you distribute a large enough +number of copies you must also follow the conditions in section 3. + +You may also lend copies, under the same conditions stated above, and +you may publicly display copies. + + +3. COPYING IN QUANTITY + +If you publish printed copies of the Document numbering more than 100, +and the Document's license notice requires Cover Texts, you must enclose +the copies in covers that carry, clearly and legibly, all these Cover +Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on +the back cover. Both covers must also clearly and legibly identify +you as the publisher of these copies. The front cover must present +the full title with all words of the title equally prominent and +visible. You may add other material on the covers in addition. +Copying with changes limited to the covers, as long as they preserve +the title of the Document and satisfy these conditions, can be treated +as verbatim copying in other respects. + +If the required texts for either cover are too voluminous to fit +legibly, you should put the first ones listed (as many as fit +reasonably) on the actual cover, and continue the rest onto adjacent +pages. + +If you publish or distribute Opaque copies of the Document numbering +more than 100, you must either include a machine-readable Transparent +copy along with each Opaque copy, or state in or with each Opaque copy +a publicly-accessible computer-network location containing a complete +Transparent copy of the Document, free of added material, which the +general network-using public has access to download anonymously at no +charge using public-standard network protocols. If you use the latter +option, you must take reasonably prudent steps, when you begin +distribution of Opaque copies in quantity, to ensure that this +Transparent copy will remain thus accessible at the stated location +until at least one year after the last time you distribute an Opaque +copy (directly or through your agents or retailers) of that edition to +the public. + +It is requested, but not required, that you contact the authors of the +Document well before redistributing any large number of copies, to give +them a chance to provide you with an updated version of the Document. + + +4. MODIFICATIONS + +You may copy and distribute a Modified Version of the Document under +the conditions of sections 2 and 3 above, provided that you release +the Modified Version under precisely this License, with the Modified +Version filling the role of the Document, thus licensing distribution +and modification of the Modified Version to whoever possesses a copy +of it. In addition, you must do these things in the Modified Version: + +A. Use in the Title Page (and on the covers, if any) a title distinct + from that of the Document, and from those of previous versions + (which should, if there were any, be listed in the History section + of the Document). You may use the same title as a previous version + if the original publisher of that version gives permission. +B. List on the Title Page, as authors, one or more persons or entities + responsible for authorship of the modifications in the Modified + Version, together with at least five of the principal authors of the + Document (all of its principal authors, if it has less than five). +C. State on the Title page the name of the publisher of the + Modified Version, as the publisher. +D. Preserve all the copyright notices of the Document. +E. Add an appropriate copyright notice for your modifications + adjacent to the other copyright notices. +F. Include, immediately after the copyright notices, a license notice + giving the public permission to use the Modified Version under the + terms of this License, in the form shown in the Addendum below. +G. Preserve in that license notice the full lists of Invariant Sections + and required Cover Texts given in the Document's license notice. +H. Include an unaltered copy of this License. +I. Preserve the section entitled "History", and its title, and add to + it an item stating at least the title, year, new authors, and + publisher of the Modified Version as given on the Title Page. If + there is no section entitled "History" in the Document, create one + stating the title, year, authors, and publisher of the Document as + given on its Title Page, then add an item describing the Modified + Version as stated in the previous sentence. +J. Preserve the network location, if any, given in the Document for + public access to a Transparent copy of the Document, and likewise + the network locations given in the Document for previous versions + it was based on. These may be placed in the "History" section. + You may omit a network location for a work that was published at + least four years before the Document itself, or if the original + publisher of the version it refers to gives permission. +K. In any section entitled "Acknowledgements" or "Dedications", + preserve the section's title, and preserve in the section all the + substance and tone of each of the contributor acknowledgements + and/or dedications given therein. +L. Preserve all the Invariant Sections of the Document, + unaltered in their text and in their titles. Section numbers + or the equivalent are not considered part of the section titles. +M. Delete any section entitled "Endorsements". Such a section + may not be included in the Modified Version. +N. Do not retitle any existing section as "Endorsements" + or to conflict in title with any Invariant Section. + +If the Modified Version includes new front-matter sections or +appendices that qualify as Secondary Sections and contain no material +copied from the Document, you may at your option designate some or all +of these sections as invariant. To do this, add their titles to the +list of Invariant Sections in the Modified Version's license notice. +These titles must be distinct from any other section titles. + +You may add a section entitled "Endorsements", provided it contains +nothing but endorsements of your Modified Version by various +parties--for example, statements of peer review or that the text has +been approved by an organization as the authoritative definition of a +standard. + +You may add a passage of up to five words as a Front-Cover Text, and a +passage of up to 25 words as a Back-Cover Text, to the end of the list +of Cover Texts in the Modified Version. Only one passage of +Front-Cover Text and one of Back-Cover Text may be added by (or +through arrangements made by) any one entity. If the Document already +includes a cover text for the same cover, previously added by you or +by arrangement made by the same entity you are acting on behalf of, +you may not add another; but you may replace the old one, on explicit +permission from the previous publisher that added the old one. + +The author(s) and publisher(s) of the Document do not by this License +give permission to use their names for publicity for or to assert or +imply endorsement of any Modified Version. + + +5. COMBINING DOCUMENTS + +You may combine the Document with other documents released under this +License, under the terms defined in section 4 above for modified +versions, provided that you include in the combination all of the +Invariant Sections of all of the original documents, unmodified, and +list them all as Invariant Sections of your combined work in its +license notice. + +The combined work need only contain one copy of this License, and +multiple identical Invariant Sections may be replaced with a single +copy. If there are multiple Invariant Sections with the same name but +different contents, make the title of each such section unique by +adding at the end of it, in parentheses, the name of the original +author or publisher of that section if known, or else a unique number. +Make the same adjustment to the section titles in the list of +Invariant Sections in the license notice of the combined work. + +In the combination, you must combine any sections entitled "History" +in the various original documents, forming one section entitled +"History"; likewise combine any sections entitled "Acknowledgements", +and any sections entitled "Dedications". You must delete all sections +entitled "Endorsements." + + +6. COLLECTIONS OF DOCUMENTS + +You may make a collection consisting of the Document and other documents +released under this License, and replace the individual copies of this +License in the various documents with a single copy that is included in +the collection, provided that you follow the rules of this License for +verbatim copying of each of the documents in all other respects. + +You may extract a single document from such a collection, and distribute +it individually under this License, provided you insert a copy of this +License into the extracted document, and follow this License in all +other respects regarding verbatim copying of that document. + + +7. AGGREGATION WITH INDEPENDENT WORKS + +A compilation of the Document or its derivatives with other separate +and independent documents or works, in or on a volume of a storage or +distribution medium, does not as a whole count as a Modified Version +of the Document, provided no compilation copyright is claimed for the +compilation. Such a compilation is called an "aggregate", and this +License does not apply to the other self-contained works thus compiled +with the Document, on account of their being thus compiled, if they +are not themselves derivative works of the Document. + +If the Cover Text requirement of section 3 is applicable to these +copies of the Document, then if the Document is less than one quarter +of the entire aggregate, the Document's Cover Texts may be placed on +covers that surround only the Document within the aggregate. +Otherwise they must appear on covers around the whole aggregate. + + +8. TRANSLATION + +Translation is considered a kind of modification, so you may +distribute translations of the Document under the terms of section 4. +Replacing Invariant Sections with translations requires special +permission from their copyright holders, but you may include +translations of some or all Invariant Sections in addition to the +original versions of these Invariant Sections. You may include a +translation of this License provided that you also include the +original English version of this License. In case of a disagreement +between the translation and the original English version of this +License, the original English version will prevail. + + +9. TERMINATION + +You may not copy, modify, sublicense, or distribute the Document except +as expressly provided for under this License. Any other attempt to +copy, modify, sublicense or distribute the Document is void, and will +automatically terminate your rights under this License. However, +parties who have received copies, or rights, from you under this +License will not have their licenses terminated so long as such +parties remain in full compliance. + + +10. FUTURE REVISIONS OF THIS LICENSE + +The Free Software Foundation may publish new, revised versions +of the GNU Free Documentation License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. See +http://www.gnu.org/copyleft/. + +Each version of the License is given a distinguishing version number. +If the Document specifies that a particular numbered version of this +License "or any later version" applies to it, you have the option of +following the terms and conditions either of that specified version or +of any later version that has been published (not as a draft) by the +Free Software Foundation. If the Document does not specify a version +number of this License, you may choose any version ever published (not +as a draft) by the Free Software Foundation. + + +ADDENDUM: How to use this License for your documents + +To use this License in a document you have written, include a copy of +the License in the document and put the following copyright and +license notices just after the title page: + + Copyright (c) YEAR YOUR NAME. + Permission is granted to copy, distribute and/or modify this document + under the terms of the GNU Free Documentation License, Version 1.1 + or any later version published by the Free Software Foundation; + with the Invariant Sections being LIST THEIR TITLES, with the + Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST. + A copy of the license is included in the section entitled "GNU + Free Documentation License". + +If you have no Invariant Sections, write "with no Invariant Sections" +instead of saying which ones are invariant. If you have no +Front-Cover Texts, write "no Front-Cover Texts" instead of +"Front-Cover Texts being LIST"; likewise for Back-Cover Texts. + +If your document contains nontrivial examples of program code, we +recommend releasing these examples in parallel under your choice of +free software license, such as the GNU General Public License, +to permit their use in free software. diff --git a/Libraries/FLAC/Files/COPYING.GPL b/Libraries/FLAC/Files/COPYING.GPL new file mode 100644 index 000000000..c3c7a9eac --- /dev/null +++ b/Libraries/FLAC/Files/COPYING.GPL @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) 19yy + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/Libraries/FLAC/Files/COPYING.LGPL b/Libraries/FLAC/Files/COPYING.LGPL new file mode 100644 index 000000000..9623417f2 --- /dev/null +++ b/Libraries/FLAC/Files/COPYING.LGPL @@ -0,0 +1,481 @@ + GNU LIBRARY GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the library GPL. It is + numbered 2 because it goes with version 2 of the ordinary GPL.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Library General Public License, applies to some +specially designated Free Software Foundation software, and to any +other libraries whose authors decide to use it. You can use it for +your libraries, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if +you distribute copies of the library, or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link a program with the library, you must provide +complete object files to the recipients so that they can relink them +with the library, after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + Our method of protecting your rights has two steps: (1) copyright +the library, and (2) offer you this license which gives you legal +permission to copy, distribute and/or modify the library. + + Also, for each distributor's protection, we want to make certain +that everyone understands that there is no warranty for this free +library. If the library is modified by someone else and passed on, we +want its recipients to know that what they have is not the original +version, so that any problems introduced by others will not reflect on +the original authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that companies distributing free +software will individually obtain patent licenses, thus in effect +transforming the program into proprietary software. To prevent this, +we have made it clear that any patent must be licensed for everyone's +free use or not licensed at all. + + Most GNU software, including some libraries, is covered by the ordinary +GNU General Public License, which was designed for utility programs. This +license, the GNU Library General Public License, applies to certain +designated libraries. This license is quite different from the ordinary +one; be sure to read it in full, and don't assume that anything in it is +the same as in the ordinary license. + + The reason we have a separate public license for some libraries is that +they blur the distinction we usually make between modifying or adding to a +program and simply using it. Linking a program with a library, without +changing the library, is in some sense simply using the library, and is +analogous to running a utility program or application program. However, in +a textual and legal sense, the linked executable is a combined work, a +derivative of the original library, and the ordinary General Public License +treats it as such. + + Because of this blurred distinction, using the ordinary General +Public License for libraries did not effectively promote software +sharing, because most developers did not use the libraries. We +concluded that weaker conditions might promote sharing better. + + However, unrestricted linking of non-free programs would deprive the +users of those programs of all benefit from the free status of the +libraries themselves. This Library General Public License is intended to +permit developers of non-free programs to use free libraries, while +preserving your freedom as a user of such programs to change the free +libraries that are incorporated in them. (We have not seen how to achieve +this as regards changes in header files, but we have achieved it as regards +changes in the actual functions of the Library.) The hope is that this +will lead to faster development of free libraries. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, while the latter only +works together with the library. + + Note that it is possible for a library to be covered by the ordinary +General Public License rather than by this special one. + + GNU LIBRARY GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library which +contains a notice placed by the copyright holder or other authorized +party saying it may be distributed under the terms of this Library +General Public License (also called "this License"). Each licensee is +addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also compile or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + c) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + d) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the source code distributed need not include anything that is normally +distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Library General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! diff --git a/Libraries/FLAC/Files/COPYING.Xiph b/Libraries/FLAC/Files/COPYING.Xiph new file mode 100644 index 000000000..610a3ba14 --- /dev/null +++ b/Libraries/FLAC/Files/COPYING.Xiph @@ -0,0 +1,28 @@ +Copyright (C) 2000,2001,2002,2003,2004,2005 Josh Coalson + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +- Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + +- Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + +- Neither the name of the Xiph.org Foundation nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/Libraries/FLAC/Files/include/FLAC/Makefile.am b/Libraries/FLAC/Files/include/FLAC/Makefile.am new file mode 100644 index 000000000..adeb46cf5 --- /dev/null +++ b/Libraries/FLAC/Files/include/FLAC/Makefile.am @@ -0,0 +1,46 @@ +# libFLAC - Free Lossless Audio Codec library +# Copyright (C) 2000,2001,2002,2003,2004,2005 Josh Coalson +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# - Neither the name of the Xiph.org Foundation nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +flaccincludedir = $(includedir)/FLAC + +flaccinclude_HEADERS = \ + all.h \ + assert.h \ + callback.h \ + export.h \ + file_decoder.h \ + file_encoder.h \ + format.h \ + metadata.h \ + ordinals.h \ + seekable_stream_decoder.h \ + seekable_stream_encoder.h \ + stream_decoder.h \ + stream_encoder.h diff --git a/Libraries/FLAC/Files/include/FLAC/Makefile.in b/Libraries/FLAC/Files/include/FLAC/Makefile.in new file mode 100644 index 000000000..59723176e --- /dev/null +++ b/Libraries/FLAC/Files/include/FLAC/Makefile.in @@ -0,0 +1,487 @@ +# Makefile.in generated by automake 1.8.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# libFLAC - Free Lossless Audio Codec library +# Copyright (C) 2000,2001,2002,2003,2004,2005 Josh Coalson +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# - Neither the name of the Xiph.org Foundation nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../.. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_triplet = @host@ +subdir = include/FLAC +DIST_COMMON = $(flaccinclude_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(mkdir_p) +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +am__installdirs = "$(DESTDIR)$(flaccincludedir)" +flaccincludeHEADERS_INSTALL = $(INSTALL_HEADER) +HEADERS = $(flaccinclude_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCAS = @CCAS@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEBUG_FALSE = @DEBUG_FALSE@ +DEBUG_TRUE = @DEBUG_TRUE@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DOCBOOK_TO_MAN = @DOCBOOK_TO_MAN@ +DOXYGEN = @DOXYGEN@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FLaC__CPU_IA32_FALSE = @FLaC__CPU_IA32_FALSE@ +FLaC__CPU_IA32_TRUE = @FLaC__CPU_IA32_TRUE@ +FLaC__CPU_PPC_FALSE = @FLaC__CPU_PPC_FALSE@ +FLaC__CPU_PPC_TRUE = @FLaC__CPU_PPC_TRUE@ +FLaC__CPU_SPARC_FALSE = @FLaC__CPU_SPARC_FALSE@ +FLaC__CPU_SPARC_TRUE = @FLaC__CPU_SPARC_TRUE@ +FLaC__EXHAUSTIVE_TESTS_FALSE = @FLaC__EXHAUSTIVE_TESTS_FALSE@ +FLaC__EXHAUSTIVE_TESTS_TRUE = @FLaC__EXHAUSTIVE_TESTS_TRUE@ +FLaC__HAS_AS_FALSE = @FLaC__HAS_AS_FALSE@ +FLaC__HAS_AS_TRUE = @FLaC__HAS_AS_TRUE@ +FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@ +FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@ +FLaC__HAS_DOCBOOK_TO_MAN_FALSE = @FLaC__HAS_DOCBOOK_TO_MAN_FALSE@ +FLaC__HAS_DOCBOOK_TO_MAN_TRUE = @FLaC__HAS_DOCBOOK_TO_MAN_TRUE@ +FLaC__HAS_DOXYGEN_FALSE = @FLaC__HAS_DOXYGEN_FALSE@ +FLaC__HAS_DOXYGEN_TRUE = @FLaC__HAS_DOXYGEN_TRUE@ +FLaC__HAS_GAS_FALSE = @FLaC__HAS_GAS_FALSE@ +FLaC__HAS_GAS_TRUE = @FLaC__HAS_GAS_TRUE@ +FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@ +FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@ +FLaC__HAS_NASM_FALSE = @FLaC__HAS_NASM_FALSE@ +FLaC__HAS_NASM_TRUE = @FLaC__HAS_NASM_TRUE@ +FLaC__HAS_OGG_FALSE = @FLaC__HAS_OGG_FALSE@ +FLaC__HAS_OGG_TRUE = @FLaC__HAS_OGG_TRUE@ +FLaC__HAS_XMMS_FALSE = @FLaC__HAS_XMMS_FALSE@ +FLaC__HAS_XMMS_TRUE = @FLaC__HAS_XMMS_TRUE@ +FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE@ +FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE@ +FLaC__NO_ASM_FALSE = @FLaC__NO_ASM_FALSE@ +FLaC__NO_ASM_TRUE = @FLaC__NO_ASM_TRUE@ +FLaC__SSE_OS_FALSE = @FLaC__SSE_OS_FALSE@ +FLaC__SSE_OS_TRUE = @FLaC__SSE_OS_TRUE@ +FLaC__SYS_DARWIN_FALSE = @FLaC__SYS_DARWIN_FALSE@ +FLaC__SYS_DARWIN_TRUE = @FLaC__SYS_DARWIN_TRUE@ +FLaC__SYS_LINUX_FALSE = @FLaC__SYS_LINUX_FALSE@ +FLaC__SYS_LINUX_TRUE = @FLaC__SYS_LINUX_TRUE@ +FLaC__USE_3DNOW_FALSE = @FLaC__USE_3DNOW_FALSE@ +FLaC__USE_3DNOW_TRUE = @FLaC__USE_3DNOW_TRUE@ +FLaC__USE_ALTIVEC_FALSE = @FLaC__USE_ALTIVEC_FALSE@ +FLaC__USE_ALTIVEC_TRUE = @FLaC__USE_ALTIVEC_TRUE@ +FLaC__VALGRIND_TESTING_FALSE = @FLaC__VALGRIND_TESTING_FALSE@ +FLaC__VALGRIND_TESTING_TRUE = @FLaC__VALGRIND_TESTING_TRUE@ +GAS = @GAS@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +NASM = @NASM@ +OBJEXT = @OBJEXT@ +OBJ_FORMAT = @OBJ_FORMAT@ +OGG_CFLAGS = @OGG_CFLAGS@ +OGG_LIBS = @OGG_LIBS@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +XMMS_CFLAGS = @XMMS_CFLAGS@ +XMMS_CONFIG = @XMMS_CONFIG@ +XMMS_DATA_DIR = @XMMS_DATA_DIR@ +XMMS_EFFECT_PLUGIN_DIR = @XMMS_EFFECT_PLUGIN_DIR@ +XMMS_GENERAL_PLUGIN_DIR = @XMMS_GENERAL_PLUGIN_DIR@ +XMMS_INPUT_PLUGIN_DIR = @XMMS_INPUT_PLUGIN_DIR@ +XMMS_LIBS = @XMMS_LIBS@ +XMMS_OUTPUT_PLUGIN_DIR = @XMMS_OUTPUT_PLUGIN_DIR@ +XMMS_PLUGIN_DIR = @XMMS_PLUGIN_DIR@ +XMMS_VERSION = @XMMS_VERSION@ +XMMS_VISUALIZATION_PLUGIN_DIR = @XMMS_VISUALIZATION_PLUGIN_DIR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +flaccincludedir = $(includedir)/FLAC +flaccinclude_HEADERS = \ + all.h \ + assert.h \ + callback.h \ + export.h \ + file_decoder.h \ + file_encoder.h \ + format.h \ + metadata.h \ + ordinals.h \ + seekable_stream_decoder.h \ + seekable_stream_encoder.h \ + stream_decoder.h \ + stream_encoder.h + +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign include/FLAC/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign include/FLAC/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: +install-flaccincludeHEADERS: $(flaccinclude_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(flaccincludedir)" || $(mkdir_p) "$(DESTDIR)$(flaccincludedir)" + @list='$(flaccinclude_HEADERS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(flaccincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(flaccincludedir)/$$f'"; \ + $(flaccincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(flaccincludedir)/$$f"; \ + done + +uninstall-flaccincludeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(flaccinclude_HEADERS)'; for p in $$list; do \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " rm -f '$(DESTDIR)$(flaccincludedir)/$$f'"; \ + rm -f "$(DESTDIR)$(flaccincludedir)/$$f"; \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(flaccincludedir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-libtool \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: install-flaccincludeHEADERS + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-flaccincludeHEADERS uninstall-info-am + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool ctags distclean distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am \ + install-flaccincludeHEADERS install-info install-info-am \ + install-man install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ + ps ps-am tags uninstall uninstall-am \ + uninstall-flaccincludeHEADERS uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/Libraries/FLAC/Files/include/FLAC/all.h b/Libraries/FLAC/Files/include/FLAC/all.h new file mode 100644 index 000000000..0fd49af6e --- /dev/null +++ b/Libraries/FLAC/Files/include/FLAC/all.h @@ -0,0 +1,158 @@ +/* libFLAC - Free Lossless Audio Codec library + * Copyright (C) 2000,2001,2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef FLAC__ALL_H +#define FLAC__ALL_H + +#include "export.h" + +#include "assert.h" +#include "callback.h" +#include "file_decoder.h" +#include "file_encoder.h" +#include "format.h" +#include "metadata.h" +#include "ordinals.h" +#include "seekable_stream_decoder.h" +#include "seekable_stream_encoder.h" +#include "stream_decoder.h" +#include "stream_encoder.h" + +/** \mainpage + * + * \section intro Introduction + * + * This is the documentation for the FLAC C and C++ APIs. It is + * highly interconnected; this introduction should give you a top + * level idea of the structure and how to find the information you + * need. As a prerequisite you should have at least a basic + * knowledge of the FLAC format, documented + * here. + * + * \section c_api FLAC C API + * + * The FLAC C API is the interface to libFLAC, a set of structures + * describing the components of FLAC streams, and functions for + * encoding and decoding streams, as well as manipulating FLAC + * metadata in files. The public include files will be installed + * in your include area as /FLAC/... + * + * By writing a little code and linking against libFLAC, it is + * relatively easy to add FLAC support to another program. The + * library is licensed under Xiph's BSD license. + * Complete source code of libFLAC as well as the command-line + * encoder and plugins is available and is a useful source of + * examples. + * + * Aside from encoders and decoders, libFLAC provides a powerful + * metadata interface for manipulating metadata in FLAC files. It + * allows the user to add, delete, and modify FLAC metadata blocks + * and it can automatically take advantage of PADDING blocks to avoid + * rewriting the entire FLAC file when changing the size of the + * metadata. + * + * libFLAC usually only requires the standard C library and C math + * library. In particular, threading is not used so there is no + * dependency on a thread library. However, libFLAC does not use + * global variables and should be thread-safe. + * + * There is also a new libOggFLAC library which wraps around libFLAC + * to provide routines for encoding to and decoding from FLAC streams + * inside an Ogg container. The interfaces are very similar or identical + * to their counterparts in libFLAC. libOggFLAC is also licensed under + * Xiph's BSD license. + * + * \section cpp_api FLAC C++ API + * + * The FLAC C++ API is a set of classes that encapsulate the + * structures and functions in libFLAC. They provide slightly more + * functionality with respect to metadata but are otherwise + * equivalent. For the most part, they share the same usage as + * their counterparts in libFLAC, and the FLAC C API documentation + * can be used as a supplement. The public include files + * for the C++ API will be installed in your include area as + * /FLAC++/... + * + * There is also a new libOggFLAC++ library, which provides classes + * for encoding to and decoding from FLAC streams in an Ogg container. + * The classes are very similar to their counterparts in libFLAC++. + * + * Both libFLAC++ libOggFLAC++ are also licensed under + * Xiph's BSD license. + * + * \section getting_started Getting Started + * + * A good starting point for learning the API is to browse through + * the modules. Modules are logical + * groupings of related functions or classes, which correspond roughly + * to header files or sections of header files. Each module includes a + * detailed description of the general usage of its functions or + * classes. + * + * From there you can go on to look at the documentation of + * individual functions. You can see different views of the individual + * functions through the links in top bar across this page. + * + * \section embedded_developers Embedded Developers + * + * libFLAC has grown larger over time as more functionality has been + * included, but much of it may be unnecessary for a particular embedded + * implementation. Unused parts may be pruned by some simple editing of + * src/libFLAC/Makefile.am. In general, the decoders, encoders, and + * metadata interface are all independent from each other. + * + * It is easiest to just describe the dependencies: + * + * - All modules depend on the \link flac_format Format \endlink module. + * - The decoders and encoders are independent of each other. + * - The metadata interface requires the file decoder. + * - The decoder and encoder layers depend on the layers below them, but + * not above them; e.g. the seekable stream decoder depends on the stream + * decoder but not the file decoder + * + * For example, if your application only requires the stream decoder, no + * encoders, and no metadata interface, you can remove the seekable stream + * decoder, file decoder, all encoders, and the metadata interface, which + * will greatly reduce the size of the library. + */ + +/** \defgroup flac FLAC C API + * + * The FLAC C API is the interface to libFLAC, a set of structures + * describing the components of FLAC streams, and functions for + * encoding and decoding streams, as well as manipulating FLAC + * metadata in files. + * + * You should start with the format components as all other modules + * are dependent on it. + */ + +#endif diff --git a/Libraries/FLAC/Files/include/FLAC/assert.h b/Libraries/FLAC/Files/include/FLAC/assert.h new file mode 100644 index 000000000..99e3381fd --- /dev/null +++ b/Libraries/FLAC/Files/include/FLAC/assert.h @@ -0,0 +1,45 @@ +/* libFLAC - Free Lossless Audio Codec library + * Copyright (C) 2001,2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef FLAC__ASSERT_H +#define FLAC__ASSERT_H + +/* we need this since some compilers (like MSVC) leave assert()s on release code (and we don't want to use their ASSERT) */ +#ifdef DEBUG +#include +#define FLAC__ASSERT(x) assert(x) +#define FLAC__ASSERT_DECLARATION(x) x +#else +#define FLAC__ASSERT(x) +#define FLAC__ASSERT_DECLARATION(x) +#endif + +#endif diff --git a/Libraries/FLAC/Files/include/FLAC/callback.h b/Libraries/FLAC/Files/include/FLAC/callback.h new file mode 100644 index 000000000..c6f94c0cf --- /dev/null +++ b/Libraries/FLAC/Files/include/FLAC/callback.h @@ -0,0 +1,181 @@ +/* libFLAC - Free Lossless Audio Codec library + * Copyright (C) 2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef FLAC__CALLBACK_H +#define FLAC__CALLBACK_H + +#include "ordinals.h" +#include /* for size_t */ + +/** \file include/FLAC/callback.h + * + * \brief + * This module defines the structures for describing I/O callbacks + * to the other FLAC interfaces. + * + * See the detailed documentation for callbacks in the + * \link flac_callbacks callbacks \endlink module. + */ + +/** \defgroup flac_callbacks FLAC/callback.h: I/O callback structures + * \ingroup flac + * + * \brief + * This module defines the structures for describing I/O callbacks + * to the other FLAC interfaces. + * + * The purpose of the I/O callback functions is to create a common way + * for the metadata interfaces to handle I/O. + * + * Originally the metadata interfaces required filenames as the way of + * specifying FLAC files to operate on. This is problematic in some + * environments so there is an additional option to specify a set of + * callbacks for doing I/O on the FLAC file, instead of the filename. + * + * In addition to the callbacks, a FLAC__IOHandle type is defined as an + * opaque structure for a data source. + * + * The callback function prototypes are similar (but not identical) to the + * stdio functions fread, fwrite, fseek, ftell, feof, and fclose. If you use + * stdio streams to implement the callbacks, you can pass fread, fwrite, and + * fclose anywhere a FLAC__IOCallback_Read, FLAC__IOCallback_Write, or + * FLAC__IOCallback_Close is required, and a FILE* anywhere a FLAC__IOHandle + * is required. \warning You generally can NOT directly use fseek or ftell + * for FLAC__IOCallback_Seek or FLAC__IOCallback_Tell since on most systems + * these use 32-bit offsets and FLAC requires 64-bit offsets to deal with + * large files. You will have to find an equivalent function (e.g. ftello), + * or write a wrapper. The same is true for feof() since this is usually + * implemented as a macro, not as a function whose address can be taken. + * + * \{ + */ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void* FLAC__IOHandle; + +/** Signature for the read callback. + * The signature and semantics match POSIX fread() implementations + * and can generally be used interchangeably. + * + * \param ptr The address of the read buffer. + * \param size The size of the records to be read. + * \param nmemb The number of records to be read. + * \param handle The handle to the data source. + * \retval size_t + * The number of records read. + */ +typedef size_t (*FLAC__IOCallback_Read) (void *ptr, size_t size, size_t nmemb, FLAC__IOHandle handle); + +/** Signature for the write callback. + * The signature and semantics match POSIX fwrite() implementations + * and can generally be used interchangeably. + * + * \param ptr The address of the write buffer. + * \param size The size of the records to be written. + * \param nmemb The number of records to be written. + * \param handle The handle to the data source. + * \retval size_t + * The number of records written. + */ +typedef size_t (*FLAC__IOCallback_Write) (const void *ptr, size_t size, size_t nmemb, FLAC__IOHandle handle); + +/** Signature for the seek callback. + * The signature and semantics mostly match POSIX fseek() WITH ONE IMPORTANT + * EXCEPTION: the offset is a 64-bit type whereas fseek() is generally 'long' + * and 32-bits wide. + * + * \param handle The handle to the data source. + * \param offset The new position, relative to \a whence + * \param whence \c SEEK_SET, \c SEEK_CUR, or \c SEEK_END + * \retval int + * \c 0 on success, \c -1 on error. + */ +typedef int (*FLAC__IOCallback_Seek) (FLAC__IOHandle handle, FLAC__int64 offset, int whence); + +/** Signature for the tell callback. + * The signature and semantics mostly match POSIX ftell() WITH ONE IMPORTANT + * EXCEPTION: the offset is a 64-bit type whereas ftell() is generally 'long' + * and 32-bits wide. + * + * \param handle The handle to the data source. + * \retval FLAC__int64 + * The current position on success, \c -1 on error. + */ +typedef FLAC__int64 (*FLAC__IOCallback_Tell) (FLAC__IOHandle handle); + +/** Signature for the EOF callback. + * The signature and semantics mostly match POSIX feof() but WATCHOUT: + * on many systems, feof() is a macro, so in this case a wrapper function + * must be provided instead. + * + * \param handle The handle to the data source. + * \retval int + * \c 0 if not at end of file, nonzero if at end of file. + */ +typedef int (*FLAC__IOCallback_Eof) (FLAC__IOHandle handle); + +/** Signature for the close callback. + * The signature and semantics match POSIX fclose() implementations + * and can generally be used interchangeably. + * + * \param handle The handle to the data source. + * \retval int + * \c 0 on success, \c EOF on error. + */ +typedef int (*FLAC__IOCallback_Close) (FLAC__IOHandle handle); + +/** A structure for holding a set of callbacks. + * Each FLAC interface that requires a FLAC__IOCallbacks structure will + * describe which of the callbacks are required. The ones that are not + * required may be set to NULL. + * + * If the seek requirement for an interface is optional, you can signify that + * a data sorce is not seekable by setting the \a seek field to \c NULL. + */ +typedef struct { + FLAC__IOCallback_Read read; + FLAC__IOCallback_Write write; + FLAC__IOCallback_Seek seek; + FLAC__IOCallback_Tell tell; + FLAC__IOCallback_Eof eof; + FLAC__IOCallback_Close close; +} FLAC__IOCallbacks; + +/* \} */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Libraries/FLAC/Files/include/FLAC/export.h b/Libraries/FLAC/Files/include/FLAC/export.h new file mode 100644 index 000000000..db4ec59d2 --- /dev/null +++ b/Libraries/FLAC/Files/include/FLAC/export.h @@ -0,0 +1,47 @@ +/* libFLAC - Free Lossless Audio Codec library + * Copyright (C) 2000,2001,2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef FLAC__EXPORT_H +#define FLAC__EXPORT_H + +#if defined(FLAC__NO_DLL) || !defined(_MSC_VER) +#define FLAC_API + +#else + +#ifdef FLAC_API_EXPORTS +#define FLAC_API _declspec(dllexport) +#else +#define FLAC_API _declspec(dllimport) + +#endif +#endif +#endif diff --git a/Libraries/FLAC/Files/include/FLAC/file_decoder.h b/Libraries/FLAC/Files/include/FLAC/file_decoder.h new file mode 100644 index 000000000..c4b1c6cdb --- /dev/null +++ b/Libraries/FLAC/Files/include/FLAC/file_decoder.h @@ -0,0 +1,660 @@ +/* libFLAC - Free Lossless Audio Codec library + * Copyright (C) 2000,2001,2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef FLAC__FILE_DECODER_H +#define FLAC__FILE_DECODER_H + +#include "export.h" +#include "seekable_stream_decoder.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +/** \file include/FLAC/file_decoder.h + * + * \brief + * This module contains the functions which implement the file + * decoder. + * + * See the detailed documentation in the + * \link flac_file_decoder file decoder \endlink module. + */ + +/** \defgroup flac_file_decoder FLAC/file_decoder.h: file decoder interface + * \ingroup flac_decoder + * + * \brief + * This module contains the functions which implement the file + * decoder. + * + * The basic usage of this decoder is as follows: + * - The program creates an instance of a decoder using + * FLAC__file_decoder_new(). + * - The program overrides the default settings and sets callbacks for + * writing, error reporting, and metadata reporting using + * FLAC__file_decoder_set_*() functions. + * - The program initializes the instance to validate the settings and + * prepare for decoding using FLAC__file_decoder_init(). + * - The program calls the FLAC__file_decoder_process_*() functions + * to decode data, which subsequently calls the callbacks. + * - The program finishes the decoding with FLAC__file_decoder_finish(), + * which flushes the input and output and resets the decoder to the + * uninitialized state. + * - The instance may be used again or deleted with + * FLAC__file_decoder_delete(). + * + * The file decoder is a trivial wrapper around the + * \link flac_seekable_stream_decoder seekable stream decoder \endlink + * meant to simplfy the process of decoding from a standard file. The + * file decoder supplies all but the Write/Metadata/Error callbacks. + * The user needs only to provide the path to the file and the file + * decoder handles the rest. + * + * Like the seekable stream decoder, seeking is exposed through the + * FLAC__file_decoder_seek_absolute() method. At any point after the file + * decoder has been initialized, the user can call this function to seek to + * an exact sample within the file. Subsequently, the first time the write + * callback is called it will be passed a (possibly partial) block starting + * at that sample. + * + * The file decoder also inherits MD5 signature checking from the seekable + * stream decoder. If this is turned on before initialization, + * FLAC__file_decoder_finish() will report when the decoded MD5 signature + * does not match the one stored in the STREAMINFO block. MD5 checking is + * automatically turned off if there is no signature in the STREAMINFO + * block or when a seek is attempted. + * + * Make sure to read the detailed descriptions of the + * \link flac_seekable_stream_decoder seekable stream decoder module \endlink + * and \link flac_stream_decoder stream decoder module \endlink + * since the file decoder inherits much of its behavior from them. + * + * \note + * The "set" functions may only be called when the decoder is in the + * state FLAC__FILE_DECODER_UNINITIALIZED, i.e. after + * FLAC__file_decoder_new() or FLAC__file_decoder_finish(), but + * before FLAC__file_decoder_init(). If this is the case they will + * return \c true, otherwise \c false. + * + * \note + * FLAC__file_decoder_finish() resets all settings to the constructor + * defaults, including the callbacks. + * + * \{ + */ + + +/** State values for a FLAC__FileDecoder + * + * The decoder's state can be obtained by calling FLAC__file_decoder_get_state(). + */ +typedef enum { + + FLAC__FILE_DECODER_OK = 0, + /**< The decoder is in the normal OK state. */ + + FLAC__FILE_DECODER_END_OF_FILE, + /**< The decoder has reached the end of the file. */ + + FLAC__FILE_DECODER_ERROR_OPENING_FILE, + /**< An error occurred opening the input file. */ + + FLAC__FILE_DECODER_MEMORY_ALLOCATION_ERROR, + /**< An error occurred allocating memory. */ + + FLAC__FILE_DECODER_SEEK_ERROR, + /**< An error occurred while seeking. */ + + FLAC__FILE_DECODER_SEEKABLE_STREAM_DECODER_ERROR, + /**< An error occurred in the underlying seekable stream decoder. */ + + FLAC__FILE_DECODER_ALREADY_INITIALIZED, + /**< FLAC__file_decoder_init() was called when the decoder was already + * initialized, usually because FLAC__file_decoder_finish() was not + * called. + */ + + FLAC__FILE_DECODER_INVALID_CALLBACK, + /**< FLAC__file_decoder_init() was called without all callbacks + * being set. + */ + + FLAC__FILE_DECODER_UNINITIALIZED + /**< The decoder is in the uninitialized state. */ + +} FLAC__FileDecoderState; + +/** Maps a FLAC__FileDecoderState to a C string. + * + * Using a FLAC__FileDecoderState as the index to this array + * will give the string equivalent. The contents should not be modified. + */ +extern FLAC_API const char * const FLAC__FileDecoderStateString[]; + + +/*********************************************************************** + * + * class FLAC__FileDecoder : public FLAC__StreamDecoder + * + ***********************************************************************/ + +struct FLAC__FileDecoderProtected; +struct FLAC__FileDecoderPrivate; +/** The opaque structure definition for the file decoder type. See the + * \link flac_file_decoder file decoder module \endlink for a detailed + * description. + */ +typedef struct { + struct FLAC__FileDecoderProtected *protected_; /* avoid the C++ keyword 'protected' */ + struct FLAC__FileDecoderPrivate *private_; /* avoid the C++ keyword 'private' */ +} FLAC__FileDecoder; + +/** Signature for the write callback. + * See FLAC__file_decoder_set_write_callback() + * and FLAC__SeekableStreamDecoderWriteCallback for more info. + * + * \param decoder The decoder instance calling the callback. + * \param frame The description of the decoded frame. + * \param buffer An array of pointers to decoded channels of data. + * \param client_data The callee's client data set through + * FLAC__file_decoder_set_client_data(). + * \retval FLAC__StreamDecoderWriteStatus + * The callee's return status. + */ +typedef FLAC__StreamDecoderWriteStatus (*FLAC__FileDecoderWriteCallback)(const FLAC__FileDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data); + +/** Signature for the metadata callback. + * See FLAC__file_decoder_set_metadata_callback() + * and FLAC__SeekableStreamDecoderMetadataCallback for more info. + * + * \param decoder The decoder instance calling the callback. + * \param metadata The decoded metadata block. + * \param client_data The callee's client data set through + * FLAC__file_decoder_set_client_data(). + */ +typedef void (*FLAC__FileDecoderMetadataCallback)(const FLAC__FileDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data); + +/** Signature for the error callback. + * See FLAC__file_decoder_set_error_callback() + * and FLAC__SeekableStreamDecoderErrorCallback for more info. + * + * \param decoder The decoder instance calling the callback. + * \param status The error encountered by the decoder. + * \param client_data The callee's client data set through + * FLAC__file_decoder_set_client_data(). + */ +typedef void (*FLAC__FileDecoderErrorCallback)(const FLAC__FileDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data); + + +/*********************************************************************** + * + * Class constructor/destructor + * + ***********************************************************************/ + +/** Create a new file decoder instance. The instance is created with + * default settings; see the individual FLAC__file_decoder_set_*() + * functions for each setting's default. + * + * \retval FLAC__FileDecoder* + * \c NULL if there was an error allocating memory, else the new instance. + */ +FLAC_API FLAC__FileDecoder *FLAC__file_decoder_new(); + +/** Free a decoder instance. Deletes the object pointed to by \a decoder. + * + * \param decoder A pointer to an existing decoder. + * \assert + * \code decoder != NULL \endcode + */ +FLAC_API void FLAC__file_decoder_delete(FLAC__FileDecoder *decoder); + + +/*********************************************************************** + * + * Public class method prototypes + * + ***********************************************************************/ + +/** Set the "MD5 signature checking" flag. + * This is inherited from FLAC__SeekableStreamDecoder; see + * FLAC__seekable_stream_decoder_set_md5_checking(). + * + * \default \c false + * \param decoder A decoder instance to set. + * \param value See above. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__file_decoder_set_md5_checking(FLAC__FileDecoder *decoder, FLAC__bool value); + +/** Set the input file name to decode. + * + * \default \c "-" + * \param decoder A decoder instance to set. + * \param value The input file name, or "-" for \c stdin. + * \assert + * \code decoder != NULL \endcode + * \code value != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, or there was a memory + * allocation error, else \c true. + */ +FLAC_API FLAC__bool FLAC__file_decoder_set_filename(FLAC__FileDecoder *decoder, const char *value); + +/** Set the write callback. + * This is inherited from FLAC__SeekableStreamDecoder; see + * FLAC__seekable_stream_decoder_set_write_callback(). + * + * \note + * The callback is mandatory and must be set before initialization. + * + * \default \c NULL + * \param decoder A decoder instance to set. + * \param value See above. + * \assert + * \code decoder != NULL \endcode + * \code value != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__file_decoder_set_write_callback(FLAC__FileDecoder *decoder, FLAC__FileDecoderWriteCallback value); + +/** Set the metadata callback. + * This is inherited from FLAC__SeekableStreamDecoder; see + * FLAC__seekable_stream_decoder_set_metadata_callback(). + * + * \note + * The callback is mandatory and must be set before initialization. + * + * \default \c NULL + * \param decoder A decoder instance to set. + * \param value See above. + * \assert + * \code decoder != NULL \endcode + * \code value != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__file_decoder_set_metadata_callback(FLAC__FileDecoder *decoder, FLAC__FileDecoderMetadataCallback value); + +/** Set the error callback. + * This is inherited from FLAC__SeekableStreamDecoder; see + * FLAC__seekable_stream_decoder_set_error_callback(). + * + * \note + * The callback is mandatory and must be set before initialization. + * + * \default \c NULL + * \param decoder A decoder instance to set. + * \param value See above. + * \assert + * \code decoder != NULL \endcode + * \code value != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__file_decoder_set_error_callback(FLAC__FileDecoder *decoder, FLAC__FileDecoderErrorCallback value); + +/** Set the client data to be passed back to callbacks. + * This value will be supplied to callbacks in their \a client_data + * argument. + * + * \default \c NULL + * \param decoder A decoder instance to set. + * \param value See above. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__file_decoder_set_client_data(FLAC__FileDecoder *decoder, void *value); + +/** This is inherited from FLAC__SeekableStreamDecoder; see + * FLAC__seekable_stream_decoder_set_metadata_respond(). + * + * \default By default, only the \c STREAMINFO block is returned via the + * metadata callback. + * \param decoder A decoder instance to set. + * \param type See above. + * \assert + * \code decoder != NULL \endcode + * \a type is valid + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__file_decoder_set_metadata_respond(FLAC__FileDecoder *decoder, FLAC__MetadataType type); + +/** This is inherited from FLAC__SeekableStreamDecoder; see + * FLAC__seekable_stream_decoder_set_metadata_respond_application(). + * + * \default By default, only the \c STREAMINFO block is returned via the + * metadata callback. + * \param decoder A decoder instance to set. + * \param id See above. + * \assert + * \code decoder != NULL \endcode + * \code id != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__file_decoder_set_metadata_respond_application(FLAC__FileDecoder *decoder, const FLAC__byte id[4]); + +/** This is inherited from FLAC__SeekableStreamDecoder; see + * FLAC__seekable_stream_decoder_set_metadata_respond_all(). + * + * \default By default, only the \c STREAMINFO block is returned via the + * metadata callback. + * \param decoder A decoder instance to set. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__file_decoder_set_metadata_respond_all(FLAC__FileDecoder *decoder); + +/** This is inherited from FLAC__SeekableStreamDecoder; see + * FLAC__seekable_stream_decoder_set_metadata_ignore(). + * + * \default By default, only the \c STREAMINFO block is returned via the + * metadata callback. + * \param decoder A decoder instance to set. + * \param type See above. + * \assert + * \code decoder != NULL \endcode + * \a type is valid + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__file_decoder_set_metadata_ignore(FLAC__FileDecoder *decoder, FLAC__MetadataType type); + +/** This is inherited from FLAC__SeekableStreamDecoder; see + * FLAC__seekable_stream_decoder_set_metadata_ignore_application(). + * + * \default By default, only the \c STREAMINFO block is returned via the + * metadata callback. + * \param decoder A decoder instance to set. + * \param id See above. + * \assert + * \code decoder != NULL \endcode + * \code id != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__file_decoder_set_metadata_ignore_application(FLAC__FileDecoder *decoder, const FLAC__byte id[4]); + +/** This is inherited from FLAC__SeekableStreamDecoder; see + * FLAC__seekable_stream_decoder_set_metadata_ignore_all(). + * + * \default By default, only the \c STREAMINFO block is returned via the + * metadata callback. + * \param decoder A decoder instance to set. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__file_decoder_set_metadata_ignore_all(FLAC__FileDecoder *decoder); + +/** Get the current decoder state. + * + * \param decoder A decoder instance to query. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__FileDecoderState + * The current decoder state. + */ +FLAC_API FLAC__FileDecoderState FLAC__file_decoder_get_state(const FLAC__FileDecoder *decoder); + +/** Get the state of the underlying seekable stream decoder. + * Useful when the file decoder state is + * \c FLAC__FILE_DECODER_SEEKABLE_STREAM_DECODER_ERROR. + * + * \param decoder A decoder instance to query. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__SeekableStreamDecoderState + * The seekable stream decoder state. + */ +FLAC_API FLAC__SeekableStreamDecoderState FLAC__file_decoder_get_seekable_stream_decoder_state(const FLAC__FileDecoder *decoder); + +/** Get the state of the underlying stream decoder. + * Useful when the file decoder state is + * \c FLAC__FILE_DECODER_SEEKABLE_STREAM_DECODER_ERROR and the seekable stream + * decoder state is \c FLAC__SEEKABLE_STREAM_DECODER_STREAM_DECODER_ERROR. + * + * \param decoder A decoder instance to query. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__StreamDecoderState + * The seekable stream decoder state. + */ +FLAC_API FLAC__StreamDecoderState FLAC__file_decoder_get_stream_decoder_state(const FLAC__FileDecoder *decoder); + +/** Get the current decoder state as a C string. + * This version automatically resolves + * \c FLAC__FILE_DECODER_SEEKABLE_STREAM_DECODER_ERROR by getting the + * seekable stream decoder's state. + * + * \param decoder A decoder instance to query. + * \assert + * \code decoder != NULL \endcode + * \retval const char * + * The decoder state as a C string. Do not modify the contents. + */ +FLAC_API const char *FLAC__file_decoder_get_resolved_state_string(const FLAC__FileDecoder *decoder); + +/** Get the "MD5 signature checking" flag. + * This is inherited from FLAC__SeekableStreamDecoder; see + * FLAC__seekable_stream_decoder_get_md5_checking(). + * + * \param decoder A decoder instance to query. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * See above. + */ +FLAC_API FLAC__bool FLAC__file_decoder_get_md5_checking(const FLAC__FileDecoder *decoder); + +/** This is inherited from FLAC__SeekableStreamDecoder; see + * FLAC__seekable_stream_decoder_get_channels(). + * + * \param decoder A decoder instance to query. + * \assert + * \code decoder != NULL \endcode + * \retval unsigned + * See above. + */ +FLAC_API unsigned FLAC__file_decoder_get_channels(const FLAC__FileDecoder *decoder); + +/** This is inherited from FLAC__SeekableStreamDecoder; see + * FLAC__seekable_stream_decoder_get_channel_assignment(). + * + * \param decoder A decoder instance to query. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__ChannelAssignment + * See above. + */ +FLAC_API FLAC__ChannelAssignment FLAC__file_decoder_get_channel_assignment(const FLAC__FileDecoder *decoder); + +/** This is inherited from FLAC__SeekableStreamDecoder; see + * FLAC__seekable_stream_decoder_get_bits_per_sample(). + * + * \param decoder A decoder instance to query. + * \assert + * \code decoder != NULL \endcode + * \retval unsigned + * See above. + */ +FLAC_API unsigned FLAC__file_decoder_get_bits_per_sample(const FLAC__FileDecoder *decoder); + +/** This is inherited from FLAC__SeekableStreamDecoder; see + * FLAC__seekable_stream_decoder_get_sample_rate(). + * + * \param decoder A decoder instance to query. + * \assert + * \code decoder != NULL \endcode + * \retval unsigned + * See above. + */ +FLAC_API unsigned FLAC__file_decoder_get_sample_rate(const FLAC__FileDecoder *decoder); + +/** This is inherited from FLAC__SeekableStreamDecoder; see + * FLAC__seekable_stream_decoder_get_blocksize(). + * + * \param decoder A decoder instance to query. + * \assert + * \code decoder != NULL \endcode + * \retval unsigned + * See above. + */ +FLAC_API unsigned FLAC__file_decoder_get_blocksize(const FLAC__FileDecoder *decoder); + +/** This is inherited from FLAC__SeekableStreamDecoder; see + * FLAC__seekable_stream_decoder_get_decode_position(). + * + * \param decoder A decoder instance to query. + * \param position Address at which to return the desired position. + * \assert + * \code decoder != NULL \endcode + * \code position != NULL \endcode + * \retval FLAC__bool + * \c true if successful, \c false if there was an error from + * the 'tell' callback. + */ +FLAC_API FLAC__bool FLAC__file_decoder_get_decode_position(const FLAC__FileDecoder *decoder, FLAC__uint64 *position); + +/** Initialize the decoder instance. + * Should be called after FLAC__file_decoder_new() and + * FLAC__file_decoder_set_*() but before any of the + * FLAC__file_decoder_process_*() functions. Will set and return + * the decoder state, which will be FLAC__FILE_DECODER_OK if + * initialization succeeded. + * + * \param decoder An uninitialized decoder instance. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__FileDecoderState + * \c FLAC__FILE_DECODER_OK if initialization was successful; see + * FLAC__FileDecoderState for the meanings of other return values. + */ +FLAC_API FLAC__FileDecoderState FLAC__file_decoder_init(FLAC__FileDecoder *decoder); + +/** Finish the decoding process. + * Flushes the decoding buffer, releases resources, resets the decoder + * settings to their defaults, and returns the decoder state to + * FLAC__FILE_DECODER_UNINITIALIZED. + * + * In the event of a prematurely-terminated decode, it is not strictly + * necessary to call this immediately before FLAC__file_decoder_delete() + * but it is good practice to match every FLAC__file_decoder_init() with + * a FLAC__file_decoder_finish(). + * + * \param decoder An uninitialized decoder instance. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * \c false if MD5 checking is on AND a STREAMINFO block was available + * AND the MD5 signature in the STREAMINFO block was non-zero AND the + * signature does not match the one computed by the decoder; else + * \c true. + */ +FLAC_API FLAC__bool FLAC__file_decoder_finish(FLAC__FileDecoder *decoder); + +/** This is inherited from FLAC__SeekableStreamDecoder; see + * FLAC__seekable_stream_decoder_process_single(). + * + * \param decoder A decoder instance. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * See above. + */ +FLAC_API FLAC__bool FLAC__file_decoder_process_single(FLAC__FileDecoder *decoder); + +/** This is inherited from FLAC__SeekableStreamDecoder; see + * FLAC__seekable_stream_decoder_process_until_end_of_metadata(). + * + * \param decoder A decoder instance. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * See above. + */ +FLAC_API FLAC__bool FLAC__file_decoder_process_until_end_of_metadata(FLAC__FileDecoder *decoder); + +/** This is inherited from FLAC__SeekableStreamDecoder; see + * FLAC__seekable_stream_decoder_process_until_end_of_stream(). + * + * \param decoder A decoder instance. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * See above. + */ +FLAC_API FLAC__bool FLAC__file_decoder_process_until_end_of_file(FLAC__FileDecoder *decoder); + +/** This is inherited from FLAC__SeekableStreamDecoder; see + * FLAC__seekable_stream_decoder_skip_single_frame(). + * + * \param decoder A decoder instance. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * See above. + */ +FLAC_API FLAC__bool FLAC__file_decoder_skip_single_frame(FLAC__FileDecoder *decoder); + +/** Flush the input and seek to an absolute sample. + * This is inherited from FLAC__SeekableStreamDecoder; see + * FLAC__seekable_stream_decoder_seek_absolute(). + * + * \param decoder A decoder instance. + * \param sample The target sample number to seek to. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * \c true if successful, else \c false. + */ +FLAC_API FLAC__bool FLAC__file_decoder_seek_absolute(FLAC__FileDecoder *decoder, FLAC__uint64 sample); + +/* \} */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Libraries/FLAC/Files/include/FLAC/file_encoder.h b/Libraries/FLAC/Files/include/FLAC/file_encoder.h new file mode 100644 index 000000000..fbbfadb30 --- /dev/null +++ b/Libraries/FLAC/Files/include/FLAC/file_encoder.h @@ -0,0 +1,871 @@ +/* libFLAC - Free Lossless Audio Codec library + * Copyright (C) 2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef FLAC__FILE_ENCODER_H +#define FLAC__FILE_ENCODER_H + +#include "export.h" +#include "seekable_stream_encoder.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +/** \file include/FLAC/file_encoder.h + * + * \brief + * This module contains the functions which implement the file + * encoder. + * + * See the detailed documentation in the + * \link flac_file_encoder file encoder \endlink module. + */ + +/** \defgroup flac_file_encoder FLAC/file_encoder.h: file encoder interface + * \ingroup flac_encoder + * + * \brief + * This module contains the functions which implement the file + * encoder. + * + * The basic usage of this encoder is as follows: + * - The program creates an instance of an encoder using + * FLAC__file_encoder_new(). + * - The program overrides the default settings using + * FLAC__file_encoder_set_*() functions. + * - The program initializes the instance to validate the settings and + * prepare for encoding using FLAC__file_encoder_init(). + * - The program calls FLAC__file_encoder_process() or + * FLAC__file_encoder_process_interleaved() to encode data, which + * subsequently writes data to the output file. + * - The program finishes the encoding with FLAC__file_encoder_finish(), + * which causes the encoder to encode any data still in its input pipe, + * rewind and write the STREAMINFO metadata to file, and finally reset + * the encoder to the uninitialized state. + * - The instance may be used again or deleted with + * FLAC__file_encoder_delete(). + * + * The file encoder is a wrapper around the + * \link flac_seekable_stream_encoder seekable stream encoder \endlink which supplies all + * callbacks internally; the user need specify only the filename. + * + * Make sure to read the detailed description of the + * \link flac_seekable_stream_encoder seekable stream encoder module \endlink since the + * \link flac_stream_encoder stream encoder module \endlink since the + * file encoder inherits much of its behavior from them. + * + * \note + * The "set" functions may only be called when the encoder is in the + * state FLAC__FILE_ENCODER_UNINITIALIZED, i.e. after + * FLAC__file_encoder_new() or FLAC__file_encoder_finish(), but + * before FLAC__file_encoder_init(). If this is the case they will + * return \c true, otherwise \c false. + * + * \note + * FLAC__file_encoder_finish() resets all settings to the constructor + * defaults. + * + * \{ + */ + + +/** State values for a FLAC__FileEncoder + * + * The encoder's state can be obtained by calling FLAC__file_encoder_get_state(). + */ +typedef enum { + + FLAC__FILE_ENCODER_OK = 0, + /**< The encoder is in the normal OK state. */ + + FLAC__FILE_ENCODER_NO_FILENAME, + /**< FLAC__file_encoder_init() was called without first calling + * FLAC__file_encoder_set_filename(). + */ + + FLAC__FILE_ENCODER_SEEKABLE_STREAM_ENCODER_ERROR, + /**< An error occurred in the underlying seekable stream encoder; + * check FLAC__file_encoder_get_seekable_stream_encoder_state(). + */ + + FLAC__FILE_ENCODER_FATAL_ERROR_WHILE_WRITING, + /**< A fatal error occurred while writing to the encoded file. */ + + FLAC__FILE_ENCODER_ERROR_OPENING_FILE, + /**< An error occurred opening the output file for writing. */ + + FLAC__FILE_ENCODER_MEMORY_ALLOCATION_ERROR, + /**< Memory allocation failed. */ + + FLAC__FILE_ENCODER_ALREADY_INITIALIZED, + /**< FLAC__file_encoder_init() was called when the encoder was + * already initialized, usually because + * FLAC__file_encoder_finish() was not called. + */ + + FLAC__FILE_ENCODER_UNINITIALIZED + /**< The encoder is in the uninitialized state. */ + +} FLAC__FileEncoderState; + +/** Maps a FLAC__FileEncoderState to a C string. + * + * Using a FLAC__FileEncoderState as the index to this array + * will give the string equivalent. The contents should not be modified. + */ +extern FLAC_API const char * const FLAC__FileEncoderStateString[]; + + +/*********************************************************************** + * + * class FLAC__FileEncoder + * + ***********************************************************************/ + +struct FLAC__FileEncoderProtected; +struct FLAC__FileEncoderPrivate; +/** The opaque structure definition for the file encoder type. + * See the \link flac_file_encoder file encoder module \endlink + * for a detailed description. + */ +typedef struct { + struct FLAC__FileEncoderProtected *protected_; /* avoid the C++ keyword 'protected' */ + struct FLAC__FileEncoderPrivate *private_; /* avoid the C++ keyword 'private' */ +} FLAC__FileEncoder; + +/** Signature for the progress callback. + * See FLAC__file_encoder_set_progress_callback() for more info. + * + * \param encoder The encoder instance calling the callback. + * \param bytes_written Bytes written so far. + * \param samples_written Samples written so far. + * \param frames_written Frames written so far. + * \param total_frames_estimate The estimate of the total number of + * frames to be written. + * \param client_data The callee's client data set through + * FLAC__file_encoder_set_client_data(). + */ +typedef void (*FLAC__FileEncoderProgressCallback)(const FLAC__FileEncoder *encoder, FLAC__uint64 bytes_written, FLAC__uint64 samples_written, unsigned frames_written, unsigned total_frames_estimate, void *client_data); + + +/*********************************************************************** + * + * Class constructor/destructor + * + ***********************************************************************/ + +/** Create a new file encoder instance. The instance is created with + * default settings; see the individual FLAC__file_encoder_set_*() + * functions for each setting's default. + * + * \retval FLAC__FileEncoder* + * \c NULL if there was an error allocating memory, else the new instance. + */ +FLAC_API FLAC__FileEncoder *FLAC__file_encoder_new(); + +/** Free an encoder instance. Deletes the object pointed to by \a encoder. + * + * \param encoder A pointer to an existing encoder. + * \assert + * \code encoder != NULL \endcode + */ +FLAC_API void FLAC__file_encoder_delete(FLAC__FileEncoder *encoder); + +/*********************************************************************** + * + * Public class method prototypes + * + ***********************************************************************/ + +/** This is inherited from FLAC__SeekableStreamEncoder; see + * FLAC__seekable_stream_encoder_set_verify(). + * + * \default \c true + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__file_encoder_set_verify(FLAC__FileEncoder *encoder, FLAC__bool value); + +/** This is inherited from FLAC__SeekableStreamEncoder; see + * FLAC__seekable_stream_encoder_set_streamable_subset(). + * + * \default \c true + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__file_encoder_set_streamable_subset(FLAC__FileEncoder *encoder, FLAC__bool value); + +/** This is inherited from FLAC__SeekableStreamEncoder; see + * FLAC__seekable_stream_encoder_set_do_mid_side_stereo(). + * + * \default \c false + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__file_encoder_set_do_mid_side_stereo(FLAC__FileEncoder *encoder, FLAC__bool value); + +/** This is inherited from FLAC__SeekableStreamEncoder; see + * FLAC__seekable_stream_encoder_set_loose_mid_side_stereo(). + * + * \default \c false + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__file_encoder_set_loose_mid_side_stereo(FLAC__FileEncoder *encoder, FLAC__bool value); + +/** This is inherited from FLAC__SeekableStreamEncoder; see + * FLAC__seekable_stream_encoder_set_channels(). + * + * \default \c 2 + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__file_encoder_set_channels(FLAC__FileEncoder *encoder, unsigned value); + +/** This is inherited from FLAC__SeekableStreamEncoder; see + * FLAC__seekable_stream_encoder_set_bits_per_sample(). + * + * \warning + * Do not feed the encoder data that is wider than the value you + * set here or you will generate an invalid stream. + * + * \default \c 16 + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__file_encoder_set_bits_per_sample(FLAC__FileEncoder *encoder, unsigned value); + +/** This is inherited from FLAC__SeekableStreamEncoder; see + * FLAC__seekable_stream_encoder_set_sample_rate(). + * + * \default \c 44100 + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__file_encoder_set_sample_rate(FLAC__FileEncoder *encoder, unsigned value); + +/** This is inherited from FLAC__SeekableStreamEncoder; see + * FLAC__seekable_stream_encoder_set_blocksize(). + * + * \default \c 1152 + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__file_encoder_set_blocksize(FLAC__FileEncoder *encoder, unsigned value); + +/** This is inherited from FLAC__SeekableStreamEncoder; see + * FLAC__seekable_stream_encoder_set_max_lpc_order(). + * + * \default \c 0 + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__file_encoder_set_max_lpc_order(FLAC__FileEncoder *encoder, unsigned value); + +/** This is inherited from FLAC__SeekableStreamEncoder; see + * FLAC__seekable_stream_encoder_set_qlp_coeff_precision(). + * + * \note + * In the current implementation, qlp_coeff_precision + bits_per_sample must + * be less than 32. + * + * \default \c 0 + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__file_encoder_set_qlp_coeff_precision(FLAC__FileEncoder *encoder, unsigned value); + +/** This is inherited from FLAC__SeekableStreamEncoder; see + * FLAC__seekable_stream_encoder_set_do_qlp_coeff_prec_search(). + * + * \default \c false + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__file_encoder_set_do_qlp_coeff_prec_search(FLAC__FileEncoder *encoder, FLAC__bool value); + +/** This is inherited from FLAC__SeekableStreamEncoder; see + * FLAC__seekable_stream_encoder_set_do_escape_coding(). + * + * \default \c false + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__file_encoder_set_do_escape_coding(FLAC__FileEncoder *encoder, FLAC__bool value); + +/** This is inherited from FLAC__SeekableStreamEncoder; see + * FLAC__seekable_stream_encoder_set_do_exhaustive_model_search(). + * + * \default \c false + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__file_encoder_set_do_exhaustive_model_search(FLAC__FileEncoder *encoder, FLAC__bool value); + +/** This is inherited from FLAC__SeekableStreamEncoder; see + * FLAC__seekable_stream_encoder_set_min_residual_partition_order(). + * + * \default \c 0 + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__file_encoder_set_min_residual_partition_order(FLAC__FileEncoder *encoder, unsigned value); + +/** This is inherited from FLAC__SeekableStreamEncoder; see + * FLAC__seekable_stream_encoder_set_max_residual_partition_order(). + * + * \default \c 0 + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__file_encoder_set_max_residual_partition_order(FLAC__FileEncoder *encoder, unsigned value); + +/** This is inherited from FLAC__SeekableStreamEncoder; see + * FLAC__seekable_stream_encoder_set_rice_parameter_search_dist(). + * + * \default \c 0 + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__file_encoder_set_rice_parameter_search_dist(FLAC__FileEncoder *encoder, unsigned value); + +/** This is inherited from FLAC__SeekableStreamEncoder; see + * FLAC__seekable_stream_encoder_set_total_samples_estimate(). + * + * \default \c 0 + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__file_encoder_set_total_samples_estimate(FLAC__FileEncoder *encoder, FLAC__uint64 value); + +/** This is inherited from FLAC__SeekableStreamEncoder; see + * FLAC__seekable_stream_encoder_set_metadata(). + * + * \default \c NULL, 0 + * \param encoder An encoder instance to set. + * \param metadata See above. + * \param num_blocks See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__file_encoder_set_metadata(FLAC__FileEncoder *encoder, FLAC__StreamMetadata **metadata, unsigned num_blocks); + +/** Set the output file name encode to. + * + * \note + * The filename is mandatory and must be set before initialization. + * + * \note + * Unlike the FLAC__FileDecoder, the filename does not interpret "-" for + * \c stdout; writing to \c stdout is not relevant in the file encoder. + * + * \default \c NULL + * \param encoder A encoder instance to set. + * \param value The output file name. + * \assert + * \code encoder != NULL \endcode + * \code value != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, or there was a memory + * allocation error, else \c true. + */ +FLAC_API FLAC__bool FLAC__file_encoder_set_filename(FLAC__FileEncoder *encoder, const char *value); + +/** Set the progress callback. + * The supplied function will be called when the encoder has finished + * writing a frame. The \c total_frames_estimate argument to the callback + * will be based on the value from + * FLAC__file_encoder_set_total_samples_estimate(). + * + * \note + * Unlike most other callbacks, the progress callback is \b not mandatory + * and need not be set before initialization. + * + * \default \c NULL + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \code value != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__file_encoder_set_progress_callback(FLAC__FileEncoder *encoder, FLAC__FileEncoderProgressCallback value); + +/** Set the client data to be passed back to callbacks. + * This value will be supplied to callbacks in their \a client_data + * argument. + * + * \default \c NULL + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__file_encoder_set_client_data(FLAC__FileEncoder *encoder, void *value); + +/** Get the current encoder state. + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__FileEncoderState + * The current encoder state. + */ +FLAC_API FLAC__FileEncoderState FLAC__file_encoder_get_state(const FLAC__FileEncoder *encoder); + +/** Get the state of the underlying seekable stream encoder. + * Useful when the file encoder state is + * \c FLAC__FILE_ENCODER_SEEKABLE_STREAM_ENCODER_ERROR. + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__SeekableStreamEncoderState + * The seekable stream encoder state. + */ +FLAC_API FLAC__SeekableStreamEncoderState FLAC__file_encoder_get_seekable_stream_encoder_state(const FLAC__FileEncoder *encoder); + +/** Get the state of the underlying stream encoder. + * Useful when the file encoder state is + * \c FLAC__FILE_ENCODER_SEEKABLE_STREAM_ENCODER_ERROR and the seekable stream + * encoder state is \c FLAC__SEEKABLE_STREAM_ENCODER_STREAM_ENCODER_ERROR. + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__StreamEncoderState + * The seekable stream encoder state. + */ +FLAC_API FLAC__StreamEncoderState FLAC__file_encoder_get_stream_encoder_state(const FLAC__FileEncoder *encoder); + +/** Get the state of the underlying stream encoder's verify decoder. + * Useful when the file encoder state is + * \c FLAC__FILE_ENCODER_SEEKABLE_STREAM_ENCODER_ERROR and the seekable stream + * encoder state is \c FLAC__SEEKABLE_STREAM_ENCODER_STREAM_ENCODER_ERROR and + * the stream encoder state is \c FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR. + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__StreamDecoderState + * The stream encoder state. + */ +FLAC_API FLAC__StreamDecoderState FLAC__file_encoder_get_verify_decoder_state(const FLAC__FileEncoder *encoder); + +/** Get the current encoder state as a C string. + * This version automatically resolves + * \c FLAC__FILE_ENCODER_SEEKABLE_STREAM_ENCODER_ERROR by getting the + * seekable stream encoder's state. + * + * \param encoder A encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval const char * + * The encoder state as a C string. Do not modify the contents. + */ +FLAC_API const char *FLAC__file_encoder_get_resolved_state_string(const FLAC__FileEncoder *encoder); + +/** Get relevant values about the nature of a verify decoder error. + * Inherited from FLAC__seekable_stream_encoder_get_verify_decoder_error_stats(). + * Useful when the file encoder state is + * \c FLAC__FILE_ENCODER_SEEKABLE_STREAM_ENCODER_ERROR and the seekable stream + * encoder state is + * \c FLAC__SEEKABLE_STREAM_ENCODER_STREAM_ENCODER_ERROR and the + * stream encoder state is + * \c FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR. + * + * \param encoder An encoder instance to query. + * \param absolute_sample The absolute sample number of the mismatch. + * \param frame_number The number of the frame in which the mismatch occurred. + * \param channel The channel in which the mismatch occurred. + * \param sample The number of the sample (relative to the frame) in + * which the mismatch occurred. + * \param expected The expected value for the sample in question. + * \param got The actual value returned by the decoder. + * \assert + * \code encoder != NULL \endcode + */ +FLAC_API void FLAC__file_encoder_get_verify_decoder_error_stats(const FLAC__FileEncoder *encoder, FLAC__uint64 *absolute_sample, unsigned *frame_number, unsigned *channel, unsigned *sample, FLAC__int32 *expected, FLAC__int32 *got); + +/** Get the "verify" flag. + * This is inherited from FLAC__SeekableStreamEncoder; see + * FLAC__seekable_stream_encoder_get_verify(). + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * See FLAC__file_encoder_set_verify(). + */ +FLAC_API FLAC__bool FLAC__file_encoder_get_verify(const FLAC__FileEncoder *encoder); + +/** Get the "streamable subset" flag. + * This is inherited from FLAC__SeekableStreamEncoder; see + * FLAC__seekable_stream_encoder_get_streamable_subset(). + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * See FLAC__file_encoder_set_streamable_subset(). + */ +FLAC_API FLAC__bool FLAC__file_encoder_get_streamable_subset(const FLAC__FileEncoder *encoder); + +/** Get the "mid/side stereo coding" flag. + * This is inherited from FLAC__SeekableStreamEncoder; see + * FLAC__seekable_stream_encoder_get_do_mid_side_stereo(). + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * See FLAC__file_encoder_get_do_mid_side_stereo(). + */ +FLAC_API FLAC__bool FLAC__file_encoder_get_do_mid_side_stereo(const FLAC__FileEncoder *encoder); + +/** Get the "adaptive mid/side switching" flag. + * This is inherited from FLAC__SeekableStreamEncoder; see + * FLAC__seekable_stream_encoder_get_loose_mid_side_stereo(). + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * See FLAC__file_encoder_set_loose_mid_side_stereo(). + */ +FLAC_API FLAC__bool FLAC__file_encoder_get_loose_mid_side_stereo(const FLAC__FileEncoder *encoder); + +/** Get the number of input channels being processed. + * This is inherited from FLAC__SeekableStreamEncoder; see + * FLAC__seekable_stream_encoder_get_channels(). + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval unsigned + * See FLAC__file_encoder_set_channels(). + */ +FLAC_API unsigned FLAC__file_encoder_get_channels(const FLAC__FileEncoder *encoder); + +/** Get the input sample resolution setting. + * This is inherited from FLAC__SeekableStreamEncoder; see + * FLAC__seekable_stream_encoder_get_bits_per_sample(). + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval unsigned + * See FLAC__file_encoder_set_bits_per_sample(). + */ +FLAC_API unsigned FLAC__file_encoder_get_bits_per_sample(const FLAC__FileEncoder *encoder); + +/** Get the input sample rate setting. + * This is inherited from FLAC__SeekableStreamEncoder; see + * FLAC__seekable_stream_encoder_get_sample_rate(). + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval unsigned + * See FLAC__file_encoder_set_sample_rate(). + */ +FLAC_API unsigned FLAC__file_encoder_get_sample_rate(const FLAC__FileEncoder *encoder); + +/** Get the blocksize setting. + * This is inherited from FLAC__SeekableStreamEncoder; see + * FLAC__seekable_stream_encoder_get_blocksize(). + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval unsigned + * See FLAC__file_encoder_set_blocksize(). + */ +FLAC_API unsigned FLAC__file_encoder_get_blocksize(const FLAC__FileEncoder *encoder); + +/** Get the maximum LPC order setting. + * This is inherited from FLAC__SeekableStreamEncoder; see + * FLAC__seekable_stream_encoder_get_max_lpc_order(). + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval unsigned + * See FLAC__file_encoder_set_max_lpc_order(). + */ +FLAC_API unsigned FLAC__file_encoder_get_max_lpc_order(const FLAC__FileEncoder *encoder); + +/** Get the quantized linear predictor coefficient precision setting. + * This is inherited from FLAC__SeekableStreamEncoder; see + * FLAC__seekable_stream_encoder_get_qlp_coeff_precision(). + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval unsigned + * See FLAC__file_encoder_set_qlp_coeff_precision(). + */ +FLAC_API unsigned FLAC__file_encoder_get_qlp_coeff_precision(const FLAC__FileEncoder *encoder); + +/** Get the qlp coefficient precision search flag. + * This is inherited from FLAC__SeekableStreamEncoder; see + * FLAC__seekable_stream_encoder_get_do_qlp_coeff_prec_search(). + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * See FLAC__file_encoder_set_do_qlp_coeff_prec_search(). + */ +FLAC_API FLAC__bool FLAC__file_encoder_get_do_qlp_coeff_prec_search(const FLAC__FileEncoder *encoder); + +/** Get the "escape coding" flag. + * This is inherited from FLAC__SeekableStreamEncoder; see + * FLAC__seekable_stream_encoder_get_do_escape_coding(). + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * See FLAC__file_encoder_set_do_escape_coding(). + */ +FLAC_API FLAC__bool FLAC__file_encoder_get_do_escape_coding(const FLAC__FileEncoder *encoder); + +/** Get the exhaustive model search flag. + * This is inherited from FLAC__SeekableStreamEncoder; see + * FLAC__seekable_stream_encoder_get_do_exhaustive_model_search(). + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * See FLAC__file_encoder_set_do_exhaustive_model_search(). + */ +FLAC_API FLAC__bool FLAC__file_encoder_get_do_exhaustive_model_search(const FLAC__FileEncoder *encoder); + +/** Get the minimum residual partition order setting. + * This is inherited from FLAC__SeekableStreamEncoder; see + * FLAC__seekable_stream_encoder_get_min_residual_partition_order(). + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval unsigned + * See FLAC__file_encoder_set_min_residual_partition_order(). + */ +FLAC_API unsigned FLAC__file_encoder_get_min_residual_partition_order(const FLAC__FileEncoder *encoder); + +/** Get maximum residual partition order setting. + * This is inherited from FLAC__SeekableStreamEncoder; see + * FLAC__seekable_stream_encoder_get_max_residual_partition_order(). + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval unsigned + * See FLAC__file_encoder_set_max_residual_partition_order(). + */ +FLAC_API unsigned FLAC__file_encoder_get_max_residual_partition_order(const FLAC__FileEncoder *encoder); + +/** Get the Rice parameter search distance setting. + * This is inherited from FLAC__SeekableStreamEncoder; see + * FLAC__seekable_stream_encoder_get_rice_parameter_search_dist(). + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval unsigned + * See FLAC__file_encoder_set_rice_parameter_search_dist(). + */ +FLAC_API unsigned FLAC__file_encoder_get_rice_parameter_search_dist(const FLAC__FileEncoder *encoder); + +/** Get the previously set estimate of the total samples to be encoded. + * This is inherited from FLAC__SeekableStreamEncoder; see + * FLAC__seekable_stream_encoder_get_total_samples_estimate(). + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__uint64 + * See FLAC__file_encoder_set_total_samples_estimate(). + */ +FLAC_API FLAC__uint64 FLAC__file_encoder_get_total_samples_estimate(const FLAC__FileEncoder *encoder); + +/** Initialize the encoder instance. + * Should be called after FLAC__file_encoder_new() and + * FLAC__file_encoder_set_*() but before FLAC__file_encoder_process() + * or FLAC__file_encoder_process_interleaved(). Will set and return + * the encoder state, which will be FLAC__FILE_ENCODER_OK if + * initialization succeeded. + * + * \param encoder An uninitialized encoder instance. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__FileEncoderState + * \c FLAC__FILE_ENCODER_OK if initialization was successful; see + * FLAC__FileEncoderState for the meanings of other return values. + */ +FLAC_API FLAC__FileEncoderState FLAC__file_encoder_init(FLAC__FileEncoder *encoder); + +/** Finish the encoding process. + * Flushes the encoding buffer, releases resources, resets the encoder + * settings to their defaults, and returns the encoder state to + * FLAC__FILE_ENCODER_UNINITIALIZED. + * + * In the event of a prematurely-terminated encode, it is not strictly + * necessary to call this immediately before FLAC__file_encoder_delete() + * but it is good practice to match every FLAC__file_encoder_init() + * with a FLAC__file_encoder_finish(). + * + * \param encoder An uninitialized encoder instance. + * \assert + * \code encoder != NULL \endcode + */ +FLAC_API void FLAC__file_encoder_finish(FLAC__FileEncoder *encoder); + +/** Submit data for encoding. + * This is inherited from FLAC__SeekableStreamEncoder; see + * FLAC__seekable_stream_encoder_process(). + * + * \param encoder An initialized encoder instance in the OK state. + * \param buffer An array of pointers to each channel's signal. + * \param samples The number of samples in one channel. + * \assert + * \code encoder != NULL \endcode + * \code FLAC__file_encoder_get_state(encoder) == FLAC__FILE_ENCODER_OK \endcode + * \retval FLAC__bool + * \c true if successful, else \c false; in this case, check the + * encoder state with FLAC__file_encoder_get_state() to see what + * went wrong. + */ +FLAC_API FLAC__bool FLAC__file_encoder_process(FLAC__FileEncoder *encoder, const FLAC__int32 * const buffer[], unsigned samples); + +/** Submit data for encoding. + * This is inherited from FLAC__SeekableStreamEncoder; see + * FLAC__seekable_stream_encoder_process_interleaved(). + * + * \param encoder An initialized encoder instance in the OK state. + * \param buffer An array of channel-interleaved data (see above). + * \param samples The number of samples in one channel, the same as for + * FLAC__file_encoder_process(). For example, if + * encoding two channels, \c 1000 \a samples corresponds + * to a \a buffer of 2000 values. + * \assert + * \code encoder != NULL \endcode + * \code FLAC__file_encoder_get_state(encoder) == FLAC__FILE_ENCODER_OK \endcode + * \retval FLAC__bool + * \c true if successful, else \c false; in this case, check the + * encoder state with FLAC__file_encoder_get_state() to see what + * went wrong. + */ +FLAC_API FLAC__bool FLAC__file_encoder_process_interleaved(FLAC__FileEncoder *encoder, const FLAC__int32 buffer[], unsigned samples); + +/* \} */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Libraries/FLAC/Files/include/FLAC/format.h b/Libraries/FLAC/Files/include/FLAC/format.h new file mode 100644 index 000000000..26080cbf7 --- /dev/null +++ b/Libraries/FLAC/Files/include/FLAC/format.h @@ -0,0 +1,861 @@ +/* libFLAC - Free Lossless Audio Codec library + * Copyright (C) 2000,2001,2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef FLAC__FORMAT_H +#define FLAC__FORMAT_H + +#include "export.h" +#include "ordinals.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** \file include/FLAC/format.h + * + * \brief + * This module contains structure definitions for the representation + * of FLAC format components in memory. These are the basic + * structures used by the rest of the interfaces. + * + * See the detailed documentation in the + * \link flac_format format \endlink module. + */ + +/** \defgroup flac_format FLAC/format.h: format components + * \ingroup flac + * + * \brief + * This module contains structure definitions for the representation + * of FLAC format components in memory. These are the basic + * structures used by the rest of the interfaces. + * + * First, you should be familiar with the + * FLAC format. Many of the values here + * follow directly from the specification. As a user of libFLAC, the + * interesting parts really are the structures that describe the frame + * header and metadata blocks. + * + * The format structures here are very primitive, designed to store + * information in an efficient way. Reading information from the + * structures is easy but creating or modifying them directly is + * more complex. For the most part, as a user of a library, editing + * is not necessary; however, for metadata blocks it is, so there are + * convenience functions provided in the \link flac_metadata metadata + * module \endlink to simplify the manipulation of metadata blocks. + * + * \note + * It's not the best convention, but symbols ending in _LEN are in bits + * and _LENGTH are in bytes. _LENGTH symbols are \#defines instead of + * global variables because they are usually used when declaring byte + * arrays and some compilers require compile-time knowledge of array + * sizes when declared on the stack. + * + * \{ + */ + + +/* + Most of the values described in this file are defined by the FLAC + format specification. There is nothing to tune here. +*/ + +/** The largest legal metadata type code. */ +#define FLAC__MAX_METADATA_TYPE_CODE (126u) + +/** The minimum block size, in samples, permitted by the format. */ +#define FLAC__MIN_BLOCK_SIZE (16u) + +/** The maximum block size, in samples, permitted by the format. */ +#define FLAC__MAX_BLOCK_SIZE (65535u) + +/** The maximum number of channels permitted by the format. */ +#define FLAC__MAX_CHANNELS (8u) + +/** The minimum sample resolution permitted by the format. */ +#define FLAC__MIN_BITS_PER_SAMPLE (4u) + +/** The maximum sample resolution permitted by the format. */ +#define FLAC__MAX_BITS_PER_SAMPLE (32u) + +/** The maximum sample resolution permitted by libFLAC. + * + * \warning + * FLAC__MAX_BITS_PER_SAMPLE is the limit of the FLAC format. However, + * the reference encoder/decoder is currently limited to 24 bits because + * of prevalent 32-bit math, so make sure and use this value when + * appropriate. + */ +#define FLAC__REFERENCE_CODEC_MAX_BITS_PER_SAMPLE (24u) + +/** The maximum sample rate permitted by the format. The value is + * ((2 ^ 16) - 1) * 10; see FLAC format + * as to why. + */ +#define FLAC__MAX_SAMPLE_RATE (655350u) + +/** The maximum LPC order permitted by the format. */ +#define FLAC__MAX_LPC_ORDER (32u) + +/** The minimum quantized linear predictor coefficient precision + * permitted by the format. + */ +#define FLAC__MIN_QLP_COEFF_PRECISION (5u) + +/** The maximum quantized linear predictor coefficient precision + * permitted by the format. + */ +#define FLAC__MAX_QLP_COEFF_PRECISION (15u) + +/** The maximum order of the fixed predictors permitted by the format. */ +#define FLAC__MAX_FIXED_ORDER (4u) + +/** The maximum Rice partition order permitted by the format. */ +#define FLAC__MAX_RICE_PARTITION_ORDER (15u) + +/** The maximum Rice partition order permitted by the FLAC Subset. */ +#define FLAC__SUBSET_MAX_RICE_PARTITION_ORDER (8u) + +/** The version string of the release, stamped onto the libraries and binaries. + * + * \note + * This does not correspond to the shared library version number, which + * is used to determine binary compatibility. + */ +extern FLAC_API const char *FLAC__VERSION_STRING; + +/** The vendor string inserted by the encoder into the VORBIS_COMMENT block. + * This is a nulL-terminated ASCII string; when inserted into the + * VORBIS_COMMENT the trailing null is stripped. + */ +extern FLAC_API const char *FLAC__VENDOR_STRING; + +/** The byte string representation of the beginning of a FLAC stream. */ +extern FLAC_API const FLAC__byte FLAC__STREAM_SYNC_STRING[4]; /* = "fLaC" */ + +/** The 32-bit integer big-endian representation of the beginning of + * a FLAC stream. + */ +extern FLAC_API const unsigned FLAC__STREAM_SYNC; /* = 0x664C6143 */ + +/** The length of the FLAC signature in bits. */ +extern FLAC_API const unsigned FLAC__STREAM_SYNC_LEN; /* = 32 bits */ + +/** The length of the FLAC signature in bytes. */ +#define FLAC__STREAM_SYNC_LENGTH (4u) + + +/***************************************************************************** + * + * Subframe structures + * + *****************************************************************************/ + +/*****************************************************************************/ + +/** An enumeration of the available entropy coding methods. */ +typedef enum { + FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE = 0 + /**< Residual is coded by partitioning into contexts, each with it's own + * Rice parameter. */ +} FLAC__EntropyCodingMethodType; + +/** Maps a FLAC__EntropyCodingMethodType to a C string. + * + * Using a FLAC__EntropyCodingMethodType as the index to this array will + * give the string equivalent. The contents should not be modified. + */ +extern FLAC_API const char * const FLAC__EntropyCodingMethodTypeString[]; + + +/** Contents of a Rice partitioned residual + */ +typedef struct { + + unsigned *parameters; + /**< The Rice parameters for each context. */ + + unsigned *raw_bits; + /**< Widths for escape-coded partitions. */ + + unsigned capacity_by_order; + /**< The capacity of the \a parameters and \a raw_bits arrays + * specified as an order, i.e. the number of array elements + * allocated is 2 ^ \a capacity_by_order. + */ +} FLAC__EntropyCodingMethod_PartitionedRiceContents; + +/** Header for a Rice partitioned residual. (c.f. format specification) + */ +typedef struct { + + unsigned order; + /**< The partition order, i.e. # of contexts = 2 ^ \a order. */ + + const FLAC__EntropyCodingMethod_PartitionedRiceContents *contents; + /**< The context's Rice parameters and/or raw bits. */ + +} FLAC__EntropyCodingMethod_PartitionedRice; + +extern FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ORDER_LEN; /**< == 4 (bits) */ +extern FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN; /**< == 4 (bits) */ +extern FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_RAW_LEN; /**< == 5 (bits) */ + +extern FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER; +/**< == (1<format specification) + */ +typedef struct { + FLAC__EntropyCodingMethodType type; + union { + FLAC__EntropyCodingMethod_PartitionedRice partitioned_rice; + } data; +} FLAC__EntropyCodingMethod; + +extern FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_TYPE_LEN; /**< == 2 (bits) */ + +/*****************************************************************************/ + +/** An enumeration of the available subframe types. */ +typedef enum { + FLAC__SUBFRAME_TYPE_CONSTANT = 0, /**< constant signal */ + FLAC__SUBFRAME_TYPE_VERBATIM = 1, /**< uncompressed signal */ + FLAC__SUBFRAME_TYPE_FIXED = 2, /**< fixed polynomial prediction */ + FLAC__SUBFRAME_TYPE_LPC = 3 /**< linear prediction */ +} FLAC__SubframeType; + +/** Maps a FLAC__SubframeType to a C string. + * + * Using a FLAC__SubframeType as the index to this array will + * give the string equivalent. The contents should not be modified. + */ +extern FLAC_API const char * const FLAC__SubframeTypeString[]; + + +/** CONSTANT subframe. (c.f. format specification) + */ +typedef struct { + FLAC__int32 value; /**< The constant signal value. */ +} FLAC__Subframe_Constant; + + +/** VERBATIM subframe. (c.f. format specification) + */ +typedef struct { + const FLAC__int32 *data; /**< A pointer to verbatim signal. */ +} FLAC__Subframe_Verbatim; + + +/** FIXED subframe. (c.f. format specification) + */ +typedef struct { + FLAC__EntropyCodingMethod entropy_coding_method; + /**< The residual coding method. */ + + unsigned order; + /**< The polynomial order. */ + + FLAC__int32 warmup[FLAC__MAX_FIXED_ORDER]; + /**< Warmup samples to prime the predictor, length == order. */ + + const FLAC__int32 *residual; + /**< The residual signal, length == (blocksize minus order) samples. */ +} FLAC__Subframe_Fixed; + + +/** LPC subframe. (c.f. format specification) + */ +typedef struct { + FLAC__EntropyCodingMethod entropy_coding_method; + /**< The residual coding method. */ + + unsigned order; + /**< The FIR order. */ + + unsigned qlp_coeff_precision; + /**< Quantized FIR filter coefficient precision in bits. */ + + int quantization_level; + /**< The qlp coeff shift needed. */ + + FLAC__int32 qlp_coeff[FLAC__MAX_LPC_ORDER]; + /**< FIR filter coefficients. */ + + FLAC__int32 warmup[FLAC__MAX_LPC_ORDER]; + /**< Warmup samples to prime the predictor, length == order. */ + + const FLAC__int32 *residual; + /**< The residual signal, length == (blocksize minus order) samples. */ +} FLAC__Subframe_LPC; + +extern FLAC_API const unsigned FLAC__SUBFRAME_LPC_QLP_COEFF_PRECISION_LEN; /**< == 4 (bits) */ +extern FLAC_API const unsigned FLAC__SUBFRAME_LPC_QLP_SHIFT_LEN; /**< == 5 (bits) */ + + +/** FLAC subframe structure. (c.f. format specification) + */ +typedef struct { + FLAC__SubframeType type; + union { + FLAC__Subframe_Constant constant; + FLAC__Subframe_Fixed fixed; + FLAC__Subframe_LPC lpc; + FLAC__Subframe_Verbatim verbatim; + } data; + unsigned wasted_bits; +} FLAC__Subframe; + +extern FLAC_API const unsigned FLAC__SUBFRAME_ZERO_PAD_LEN; /**< == 1 (bit) */ +extern FLAC_API const unsigned FLAC__SUBFRAME_TYPE_LEN; /**< == 6 (bits) */ +extern FLAC_API const unsigned FLAC__SUBFRAME_WASTED_BITS_FLAG_LEN; /**< == 1 (bit) */ + +extern FLAC_API const unsigned FLAC__SUBFRAME_TYPE_CONSTANT_BYTE_ALIGNED_MASK; /* = 0x00 */ +extern FLAC_API const unsigned FLAC__SUBFRAME_TYPE_VERBATIM_BYTE_ALIGNED_MASK; /* = 0x02 */ +extern FLAC_API const unsigned FLAC__SUBFRAME_TYPE_FIXED_BYTE_ALIGNED_MASK; /* = 0x10 */ +extern FLAC_API const unsigned FLAC__SUBFRAME_TYPE_LPC_BYTE_ALIGNED_MASK; /* = 0x40 */ + +/*****************************************************************************/ + + +/***************************************************************************** + * + * Frame structures + * + *****************************************************************************/ + +/** An enumeration of the available channel assignments. */ +typedef enum { + FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT = 0, /**< independent channels */ + FLAC__CHANNEL_ASSIGNMENT_LEFT_SIDE = 1, /**< left+side stereo */ + FLAC__CHANNEL_ASSIGNMENT_RIGHT_SIDE = 2, /**< right+side stereo */ + FLAC__CHANNEL_ASSIGNMENT_MID_SIDE = 3 /**< mid+side stereo */ +} FLAC__ChannelAssignment; + +/** Maps a FLAC__ChannelAssignment to a C string. + * + * Using a FLAC__ChannelAssignment as the index to this array will + * give the string equivalent. The contents should not be modified. + */ +extern FLAC_API const char * const FLAC__ChannelAssignmentString[]; + +/** An enumeration of the possible frame numbering methods. */ +typedef enum { + FLAC__FRAME_NUMBER_TYPE_FRAME_NUMBER, /**< number contains the frame number */ + FLAC__FRAME_NUMBER_TYPE_SAMPLE_NUMBER /**< number contains the sample number of first sample in frame */ +} FLAC__FrameNumberType; + +/** Maps a FLAC__FrameNumberType to a C string. + * + * Using a FLAC__FrameNumberType as the index to this array will + * give the string equivalent. The contents should not be modified. + */ +extern FLAC_API const char * const FLAC__FrameNumberTypeString[]; + + +/** FLAC frame header structure. (c.f. format specification) + */ +typedef struct { + unsigned blocksize; + /**< The number of samples per subframe. */ + + unsigned sample_rate; + /**< The sample rate in Hz. */ + + unsigned channels; + /**< The number of channels (== number of subframes). */ + + FLAC__ChannelAssignment channel_assignment; + /**< The channel assignment for the frame. */ + + unsigned bits_per_sample; + /**< The sample resolution. */ + + FLAC__FrameNumberType number_type; + /**< The numbering scheme used for the frame. */ + + union { + FLAC__uint32 frame_number; + FLAC__uint64 sample_number; + } number; + /**< The frame number or sample number of first sample in frame; + * use the \a number_type value to determine which to use. */ + + FLAC__uint8 crc; + /**< CRC-8 (polynomial = x^8 + x^2 + x^1 + x^0, initialized with 0) + * of the raw frame header bytes, meaning everything before the CRC byte + * including the sync code. + */ +} FLAC__FrameHeader; + +extern FLAC_API const unsigned FLAC__FRAME_HEADER_SYNC; /**< == 0x3ffe; the frame header sync code */ +extern FLAC_API const unsigned FLAC__FRAME_HEADER_SYNC_LEN; /**< == 14 (bits) */ +extern FLAC_API const unsigned FLAC__FRAME_HEADER_RESERVED_LEN; /**< == 2 (bits) */ +extern FLAC_API const unsigned FLAC__FRAME_HEADER_BLOCK_SIZE_LEN; /**< == 4 (bits) */ +extern FLAC_API const unsigned FLAC__FRAME_HEADER_SAMPLE_RATE_LEN; /**< == 4 (bits) */ +extern FLAC_API const unsigned FLAC__FRAME_HEADER_CHANNEL_ASSIGNMENT_LEN; /**< == 4 (bits) */ +extern FLAC_API const unsigned FLAC__FRAME_HEADER_BITS_PER_SAMPLE_LEN; /**< == 3 (bits) */ +extern FLAC_API const unsigned FLAC__FRAME_HEADER_ZERO_PAD_LEN; /**< == 1 (bit) */ +extern FLAC_API const unsigned FLAC__FRAME_HEADER_CRC_LEN; /**< == 8 (bits) */ + + +/** FLAC frame footer structure. (c.f. format specification) + */ +typedef struct { + FLAC__uint16 crc; + /**< CRC-16 (polynomial = x^16 + x^15 + x^2 + x^0, initialized with + * 0) of the bytes before the crc, back to and including the frame header + * sync code. + */ +} FLAC__FrameFooter; + +extern FLAC_API const unsigned FLAC__FRAME_FOOTER_CRC_LEN; /**< == 16 (bits) */ + + +/** FLAC frame structure. (c.f. format specification) + */ +typedef struct { + FLAC__FrameHeader header; + FLAC__Subframe subframes[FLAC__MAX_CHANNELS]; + FLAC__FrameFooter footer; +} FLAC__Frame; + +/*****************************************************************************/ + + +/***************************************************************************** + * + * Meta-data structures + * + *****************************************************************************/ + +/** An enumeration of the available metadata block types. */ +typedef enum { + + FLAC__METADATA_TYPE_STREAMINFO = 0, + /**< STREAMINFO block */ + + FLAC__METADATA_TYPE_PADDING = 1, + /**< PADDING block */ + + FLAC__METADATA_TYPE_APPLICATION = 2, + /**< APPLICATION block */ + + FLAC__METADATA_TYPE_SEEKTABLE = 3, + /**< SEEKTABLE block */ + + FLAC__METADATA_TYPE_VORBIS_COMMENT = 4, + /**< VORBISCOMMENT block */ + + FLAC__METADATA_TYPE_CUESHEET = 5, + /**< CUESHEET block */ + + FLAC__METADATA_TYPE_UNDEFINED = 6 + /**< marker to denote beginning of undefined type range; this number will increase as new metadata types are added */ + +} FLAC__MetadataType; + +/** Maps a FLAC__MetadataType to a C string. + * + * Using a FLAC__MetadataType as the index to this array will + * give the string equivalent. The contents should not be modified. + */ +extern FLAC_API const char * const FLAC__MetadataTypeString[]; + + +/** FLAC STREAMINFO structure. (c.f. format specification) + */ +typedef struct { + unsigned min_blocksize, max_blocksize; + unsigned min_framesize, max_framesize; + unsigned sample_rate; + unsigned channels; + unsigned bits_per_sample; + FLAC__uint64 total_samples; + FLAC__byte md5sum[16]; +} FLAC__StreamMetadata_StreamInfo; + +extern FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_MIN_BLOCK_SIZE_LEN; /**< == 16 (bits) */ +extern FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_MAX_BLOCK_SIZE_LEN; /**< == 16 (bits) */ +extern FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_MIN_FRAME_SIZE_LEN; /**< == 24 (bits) */ +extern FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_MAX_FRAME_SIZE_LEN; /**< == 24 (bits) */ +extern FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_SAMPLE_RATE_LEN; /**< == 20 (bits) */ +extern FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_CHANNELS_LEN; /**< == 3 (bits) */ +extern FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_BITS_PER_SAMPLE_LEN; /**< == 5 (bits) */ +extern FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_TOTAL_SAMPLES_LEN; /**< == 36 (bits) */ +extern FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_MD5SUM_LEN; /**< == 128 (bits) */ + +/** The total stream length of the STREAMINFO block in bytes. */ +#define FLAC__STREAM_METADATA_STREAMINFO_LENGTH (34u) + +/** FLAC PADDING structure. (c.f. format specification) + */ +typedef struct { + int dummy; + /**< Conceptually this is an empty struct since we don't store the + * padding bytes. Empty structs are not allowed by some C compilers, + * hence the dummy. + */ +} FLAC__StreamMetadata_Padding; + + +/** FLAC APPLICATION structure. (c.f. format specification) + */ +typedef struct { + FLAC__byte id[4]; + FLAC__byte *data; +} FLAC__StreamMetadata_Application; + +extern FLAC_API const unsigned FLAC__STREAM_METADATA_APPLICATION_ID_LEN; /**< == 32 (bits) */ + +/** SeekPoint structure used in SEEKTABLE blocks. (c.f. format specification) + */ +typedef struct { + FLAC__uint64 sample_number; + /**< The sample number of the target frame. */ + + FLAC__uint64 stream_offset; + /**< The offset, in bytes, of the target frame with respect to + * beginning of the first frame. */ + + unsigned frame_samples; + /**< The number of samples in the target frame. */ +} FLAC__StreamMetadata_SeekPoint; + +extern FLAC_API const unsigned FLAC__STREAM_METADATA_SEEKPOINT_SAMPLE_NUMBER_LEN; /**< == 64 (bits) */ +extern FLAC_API const unsigned FLAC__STREAM_METADATA_SEEKPOINT_STREAM_OFFSET_LEN; /**< == 64 (bits) */ +extern FLAC_API const unsigned FLAC__STREAM_METADATA_SEEKPOINT_FRAME_SAMPLES_LEN; /**< == 16 (bits) */ + +/** The total stream length of a seek point in bytes. */ +#define FLAC__STREAM_METADATA_SEEKPOINT_LENGTH (18u) + +/** The value used in the \a sample_number field of + * FLAC__StreamMetadataSeekPoint used to indicate a placeholder + * point (== 0xffffffffffffffff). + */ +extern FLAC_API const FLAC__uint64 FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER; + + +/** FLAC SEEKTABLE structure. (c.f. format specification) + * + * \note From the format specification: + * - The seek points must be sorted by ascending sample number. + * - Each seek point's sample number must be the first sample of the + * target frame. + * - Each seek point's sample number must be unique within the table. + * - Existence of a SEEKTABLE block implies a correct setting of + * total_samples in the stream_info block. + * - Behavior is undefined when more than one SEEKTABLE block is + * present in a stream. + */ +typedef struct { + unsigned num_points; + FLAC__StreamMetadata_SeekPoint *points; +} FLAC__StreamMetadata_SeekTable; + + +/** Vorbis comment entry structure used in VORBIS_COMMENT blocks. (c.f. format specification) + * + * For convenience, the APIs maintain a trailing NUL character at the end of + * \a entry which is not counted toward \a length, i.e. + * \code strlen(entry) == length \endcode + */ +typedef struct { + FLAC__uint32 length; + FLAC__byte *entry; +} FLAC__StreamMetadata_VorbisComment_Entry; + +extern FLAC_API const unsigned FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN; /**< == 32 (bits) */ + + +/** FLAC VORBIS_COMMENT structure. (c.f. format specification) + */ +typedef struct { + FLAC__StreamMetadata_VorbisComment_Entry vendor_string; + FLAC__uint32 num_comments; + FLAC__StreamMetadata_VorbisComment_Entry *comments; +} FLAC__StreamMetadata_VorbisComment; + +extern FLAC_API const unsigned FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN; /**< == 32 (bits) */ + + +/** FLAC CUESHEET track index structure. (See the + * format specification for + * the full description of each field.) + */ +typedef struct { + FLAC__uint64 offset; + /**< Offset in samples, relative to the track offset, of the index + * point. + */ + + FLAC__byte number; + /**< The index point number. */ +} FLAC__StreamMetadata_CueSheet_Index; + +extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_INDEX_OFFSET_LEN; /**< == 64 (bits) */ +extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_INDEX_NUMBER_LEN; /**< == 8 (bits) */ +extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_INDEX_RESERVED_LEN; /**< == 3*8 (bits) */ + + +/** FLAC CUESHEET track structure. (See the + * format specification for + * the full description of each field.) + */ +typedef struct { + FLAC__uint64 offset; + /**< Track offset in samples, relative to the beginning of the FLAC audio stream. */ + + FLAC__byte number; + /**< The track number. */ + + char isrc[13]; + /**< Track ISRC. This is a 12-digit alphanumeric code plus a trailing '\0' */ + + unsigned type:1; + /**< The track type: 0 for audio, 1 for non-audio. */ + + unsigned pre_emphasis:1; + /**< The pre-emphasis flag: 0 for no pre-emphasis, 1 for pre-emphasis. */ + + FLAC__byte num_indices; + /**< The number of track index points. */ + + FLAC__StreamMetadata_CueSheet_Index *indices; + /**< NULL if num_indices == 0, else pointer to array of index points. */ + +} FLAC__StreamMetadata_CueSheet_Track; + +extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_OFFSET_LEN; /**< == 64 (bits) */ +extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_NUMBER_LEN; /**< == 8 (bits) */ +extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_ISRC_LEN; /**< == 12*8 (bits) */ +extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_TYPE_LEN; /**< == 1 (bit) */ +extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_PRE_EMPHASIS_LEN; /**< == 1 (bit) */ +extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_RESERVED_LEN; /**< == 6+13*8 (bits) */ +extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_NUM_INDICES_LEN; /**< == 8 (bits) */ + + +/** FLAC CUESHEET structure. (See the + * format specification + * for the full description of each field.) + */ +typedef struct { + char media_catalog_number[129]; + /**< Media catalog number, in ASCII printable characters 0x20-0x7e. In + * general, the media catalog number may be 0 to 128 bytes long; any + * unused characters should be right-padded with NUL characters. + */ + + FLAC__uint64 lead_in; + /**< The number of lead-in samples. */ + + FLAC__bool is_cd; + /**< \c true if CUESHEET corresponds to a Compact Disc, else \c false */ + + unsigned num_tracks; + /**< The number of tracks. */ + + FLAC__StreamMetadata_CueSheet_Track *tracks; + /**< NULL if num_tracks == 0, else pointer to array of tracks. */ + +} FLAC__StreamMetadata_CueSheet; + +extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_MEDIA_CATALOG_NUMBER_LEN; /**< == 128*8 (bits) */ +extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_LEAD_IN_LEN; /**< == 64 (bits) */ +extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_IS_CD_LEN; /**< == 1 (bit) */ +extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_RESERVED_LEN; /**< == 7+258*8 (bits) */ +extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_NUM_TRACKS_LEN; /**< == 8 (bits) */ + + +/** Structure that is used when a metadata block of unknown type is loaded. + * The contents are opaque. The structure is used only internally to + * correctly handle unknown metadata. + */ +typedef struct { + FLAC__byte *data; +} FLAC__StreamMetadata_Unknown; + + +/** FLAC metadata block structure. (c.f. format specification) + */ +typedef struct { + FLAC__MetadataType type; + /**< The type of the metadata block; used determine which member of the + * \a data union to dereference. If type >= FLAC__METADATA_TYPE_UNDEFINED + * then \a data.unknown must be used. */ + + FLAC__bool is_last; + /**< \c true if this metadata block is the last, else \a false */ + + unsigned length; + /**< Length, in bytes, of the block data as it appears in the stream. */ + + union { + FLAC__StreamMetadata_StreamInfo stream_info; + FLAC__StreamMetadata_Padding padding; + FLAC__StreamMetadata_Application application; + FLAC__StreamMetadata_SeekTable seek_table; + FLAC__StreamMetadata_VorbisComment vorbis_comment; + FLAC__StreamMetadata_CueSheet cue_sheet; + FLAC__StreamMetadata_Unknown unknown; + } data; + /**< Polymorphic block data; use the \a type value to determine which + * to use. */ +} FLAC__StreamMetadata; + +extern FLAC_API const unsigned FLAC__STREAM_METADATA_IS_LAST_LEN; /**< == 1 (bit) */ +extern FLAC_API const unsigned FLAC__STREAM_METADATA_TYPE_LEN; /**< == 7 (bits) */ +extern FLAC_API const unsigned FLAC__STREAM_METADATA_LENGTH_LEN; /**< == 24 (bits) */ + +/** The total stream length of a metadata block header in bytes. */ +#define FLAC__STREAM_METADATA_HEADER_LENGTH (4u) + +/*****************************************************************************/ + + +/***************************************************************************** + * + * Utility functions + * + *****************************************************************************/ + +/** Tests that a sample rate is valid for FLAC. Since the rules for valid + * sample rates are slightly complex, they are encapsulated in this function. + * + * \param sample_rate The sample rate to test for compliance. + * \retval FLAC__bool + * \c true if the given sample rate conforms to the specification, else + * \c false. + */ +FLAC_API FLAC__bool FLAC__format_sample_rate_is_valid(unsigned sample_rate); + +/** Check a Vorbis comment entry name to see if it conforms to the Vorbis + * comment specification. + * + * Vorbis comment names must be composed only of characters from + * [0x20-0x3C,0x3E-0x7D]. + * + * \param name A NUL-terminated string to be checked. + * \assert + * \code name != NULL \endcode + * \retval FLAC__bool + * \c false if entry name is illegal, else \c true. + */ +FLAC_API FLAC__bool FLAC__format_vorbiscomment_entry_name_is_legal(const char *name); + +/** Check a Vorbis comment entry value to see if it conforms to the Vorbis + * comment specification. + * + * Vorbis comment values must be valid UTF-8 sequences. + * + * \param value A string to be checked. + * \param length A the length of \a value in bytes. May be + * \c (unsigned)(-1) to indicate that \a value is a plain + * UTF-8 NUL-terminated string. + * \assert + * \code value != NULL \endcode + * \retval FLAC__bool + * \c false if entry name is illegal, else \c true. + */ +FLAC_API FLAC__bool FLAC__format_vorbiscomment_entry_value_is_legal(const FLAC__byte *value, unsigned length); + +/** Check a Vorbis comment entry to see if it conforms to the Vorbis + * comment specification. + * + * Vorbis comment entries must be of the form 'name=value', and 'name' and + * 'value' must be legal according to + * FLAC__format_vorbiscomment_entry_name_is_legal() and + * FLAC__format_vorbiscomment_entry_value_is_legal() respectively. + * + * \param value A string to be checked. + * \assert + * \code value != NULL \endcode + * \retval FLAC__bool + * \c false if entry name is illegal, else \c true. + */ +FLAC_API FLAC__bool FLAC__format_vorbiscomment_entry_is_legal(const FLAC__byte *entry, unsigned length); + +/* @@@@ add to unit tests; it is already indirectly tested by the metadata_object tests */ +/** Check a seek table to see if it conforms to the FLAC specification. + * See the format specification for limits on the contents of the + * seek table. + * + * \param seek_table A pointer to a seek table to be checked. + * \assert + * \code seek_table != NULL \endcode + * \retval FLAC__bool + * \c false if seek table is illegal, else \c true. + */ +FLAC_API FLAC__bool FLAC__format_seektable_is_legal(const FLAC__StreamMetadata_SeekTable *seek_table); + +/* @@@@ add to unit tests; it is already indirectly tested by the metadata_object tests */ +/** Sort a seek table's seek points according to the format specification. + * This includes a "unique-ification" step to remove duplicates, i.e. + * seek points with identical \a sample_number values. Duplicate seek + * points are converted into placeholder points and sorted to the end of + * the table. + * + * \param seek_table A pointer to a seek table to be sorted. + * \assert + * \code seek_table != NULL \endcode + * \retval unsigned + * The number of duplicate seek points converted into placeholders. + */ +FLAC_API unsigned FLAC__format_seektable_sort(FLAC__StreamMetadata_SeekTable *seek_table); + +/* @@@@ add to unit tests; it is already indirectly tested by the metadata_object tests */ +/** Check a cue sheet to see if it conforms to the FLAC specification. + * See the format specification for limits on the contents of the + * cue sheet. + * + * \param cue_sheet A pointer to an existing cue sheet to be checked. + * \param check_cd_da_subset If \c true, check CUESHEET against more + * stringent requirements for a CD-DA (audio) disc. + * \param violation Address of a pointer to a string. If there is a + * violation, a pointer to a string explanation of the + * violation will be returned here. \a violation may be + * \c NULL if you don't need the returned string. Do not + * free the returned string; it will always point to static + * data. + * \assert + * \code cue_sheet != NULL \endcode + * \retval FLAC__bool + * \c false if cue sheet is illegal, else \c true. + */ +FLAC_API FLAC__bool FLAC__format_cuesheet_is_legal(const FLAC__StreamMetadata_CueSheet *cue_sheet, FLAC__bool check_cd_da_subset, const char **violation); + +/* \} */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Libraries/FLAC/Files/include/FLAC/metadata.h b/Libraries/FLAC/Files/include/FLAC/metadata.h new file mode 100644 index 000000000..ff40e6d5e --- /dev/null +++ b/Libraries/FLAC/Files/include/FLAC/metadata.h @@ -0,0 +1,1858 @@ +/* libFLAC - Free Lossless Audio Codec library + * Copyright (C) 2001,2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef FLAC__METADATA_H +#define FLAC__METADATA_H + +#include "export.h" +#include "callback.h" +#include "format.h" + +/****************************************************************************** + (For an example of how all these routines are used, see the source + code for the unit tests in src/test_libFLAC/metadata_*.c, or metaflac + in src/metaflac/) +******************************************************************************/ + +/** \file include/FLAC/metadata.h + * + * \brief + * This module provides functions for creating and manipulating FLAC + * metadata blocks in memory, and three progressively more powerful + * interfaces for traversing and editing metadata in FLAC files. + * + * See the detailed documentation for each interface in the + * \link flac_metadata metadata \endlink module. + */ + +/** \defgroup flac_metadata FLAC/metadata.h: metadata interfaces + * \ingroup flac + * + * \brief + * This module provides functions for creating and manipulating FLAC + * metadata blocks in memory, and three progressively more powerful + * interfaces for traversing and editing metadata in FLAC files. + * + * There are three metadata interfaces of increasing complexity: + * + * Level 0: + * Read-only access to the STREAMINFO and VORBIS_COMMENT blocks. + * + * Level 1: + * Read-write access to all metadata blocks. This level is write- + * efficient in most cases (more on this below), and uses less memory + * than level 2. + * + * Level 2: + * Read-write access to all metadata blocks. This level is write- + * efficient in all cases, but uses more memory since all metadata for + * the whole file is read into memory and manipulated before writing + * out again. + * + * What do we mean by efficient? Since FLAC metadata appears at the + * beginning of the file, when writing metadata back to a FLAC file + * it is possible to grow or shrink the metadata such that the entire + * file must be rewritten. However, if the size remains the same during + * changes or PADDING blocks are utilized, only the metadata needs to be + * overwritten, which is much faster. + * + * Efficient means the whole file is rewritten at most one time, and only + * when necessary. Level 1 is not efficient only in the case that you + * cause more than one metadata block to grow or shrink beyond what can + * be accomodated by padding. In this case you should probably use level + * 2, which allows you to edit all the metadata for a file in memory and + * write it out all at once. + * + * All levels know how to skip over and not disturb an ID3v2 tag at the + * front of the file. + * + * All levels access files via their filenames. In addition, level 2 + * has additional alternative read and write functions that take an I/O + * handle and callbacks, for times when access by filename is not possible. + * + * In addition to the three interfaces, this module defines functions for + * creating and manipulating various metadata objects in memory. As we see + * from the Format module, FLAC metadata blocks in memory are very primitive + * structures for storing information in an efficient way. Reading + * information from the structures is easy but creating or modifying them + * directly is more complex. The metadata object routines here facilitate + * this by taking care of the consistency and memory management drudgery. + * + * Unless you will be using the level 1 or 2 interfaces to modify existing + * metadata however, you will not probably not need these. + * + * From a dependency standpoint, none of the encoders or decoders require + * the metadata module. This is so that embedded users can strip out the + * metadata module from libFLAC to reduce the size and complexity. + */ + +#ifdef __cplusplus +extern "C" { +#endif + + +/** \defgroup flac_metadata_level0 FLAC/metadata.h: metadata level 0 interface + * \ingroup flac_metadata + * + * \brief + * The level 0 interface consists of individual routines to read the + * STREAMINFO and VORBIS_COMMENT blocks, requiring only a filename. + * + * It skips any ID3v2 tag at the head of the file. + * + * \{ + */ + +/** Read the STREAMINFO metadata block of the given FLAC file. This function + * will skip any ID3v2 tag at the head of the file. + * + * \param filename The path to the FLAC file to read. + * \param streaminfo A pointer to space for the STREAMINFO block. Since + * FLAC__StreamMetadata is a simple structure with no + * memory allocation involved, you pass the address of + * an existing structure. It need not be initialized. + * \assert + * \code filename != NULL \endcode + * \code streaminfo != NULL \endcode + * \retval FLAC__bool + * \c true if a valid STREAMINFO block was read from \a filename. Returns + * \c false if there was a memory allocation error, a file decoder error, + * or the file contained no STREAMINFO block. (A memory allocation error + * is possible because this function must set up a file decoder.) + */ +FLAC_API FLAC__bool FLAC__metadata_get_streaminfo(const char *filename, FLAC__StreamMetadata *streaminfo); + +/** Read the VORBIS_COMMENT metadata block of the given FLAC file. This + * function will skip any ID3v2 tag at the head of the file. + * + * \param filename The path to the FLAC file to read. + * \param tags The address where the returned pointer will be + * stored. The \a tags object must be deleted by + * the caller using FLAC__metadata_object_delete(). + * \assert + * \code filename != NULL \endcode + * \code streaminfo != NULL \endcode + * \retval FLAC__bool + * \c true if a valid VORBIS_COMMENT block was read from \a filename, + * and \a *tags will be set to the address of the tag structure. + * Returns \c false if there was a memory allocation error, a file + * decoder error, or the file contained no VORBIS_COMMENT block, and + * \a *tags will be set to \c NULL. + */ +FLAC_API FLAC__bool FLAC__metadata_get_tags(const char *filename, FLAC__StreamMetadata **tags); + +/* \} */ + + +/** \defgroup flac_metadata_level1 FLAC/metadata.h: metadata level 1 interface + * \ingroup flac_metadata + * + * \brief + * The level 1 interface provides read-write access to FLAC file metadata and + * operates directly on the FLAC file. + * + * The general usage of this interface is: + * + * - Create an iterator using FLAC__metadata_simple_iterator_new() + * - Attach it to a file using FLAC__metadata_simple_iterator_init() and check + * the exit code. Call FLAC__metadata_simple_iterator_is_writable() to + * see if the file is writable, or read-only access is allowed. + * - Use FLAC__metadata_simple_iterator_next() and + * FLAC__metadata_simple_iterator_prev() to move around the blocks. + * This is does not read the actual blocks themselves. + * FLAC__metadata_simple_iterator_next() is relatively fast. + * FLAC__metadata_simple_iterator_prev() is slower since it needs to search + * forward from the front of the file. + * - Use FLAC__metadata_simple_iterator_get_block_type() or + * FLAC__metadata_simple_iterator_get_block() to access the actual data at + * the current iterator position. The returned object is yours to modify + * and free. + * - Use FLAC__metadata_simple_iterator_set_block() to write a modified block + * back. You must have write permission to the original file. Make sure to + * read the whole comment to FLAC__metadata_simple_iterator_set_block() + * below. + * - Use FLAC__metadata_simple_iterator_insert_block_after() to add new blocks. + * Use the object creation functions from + * \link flac_metadata_object here \endlink to generate new objects. + * - Use FLAC__metadata_simple_iterator_delete_block() to remove the block + * currently referred to by the iterator, or replace it with padding. + * - Destroy the iterator with FLAC__metadata_simple_iterator_delete() when + * finished. + * + * \note + * The FLAC file remains open the whole time between + * FLAC__metadata_simple_iterator_init() and + * FLAC__metadata_simple_iterator_delete(), so make sure you are not altering + * the file during this time. + * + * \note + * Do not modify the \a is_last, \a length, or \a type fields of returned + * FLAC__StreamMetadata objects. These are managed automatically. + * + * \note + * If any of the modification functions + * (FLAC__metadata_simple_iterator_set_block(), + * FLAC__metadata_simple_iterator_delete_block(), + * FLAC__metadata_simple_iterator_insert_block_after(), etc.) return \c false, + * you should delete the iterator as it may no longer be valid. + * + * \{ + */ + +struct FLAC__Metadata_SimpleIterator; +/** The opaque structure definition for the level 1 iterator type. + * See the + * \link flac_metadata_level1 metadata level 1 module \endlink + * for a detailed description. + */ +typedef struct FLAC__Metadata_SimpleIterator FLAC__Metadata_SimpleIterator; + +/** Status type for FLAC__Metadata_SimpleIterator. + * + * The iterator's current status can be obtained by calling FLAC__metadata_simple_iterator_status(). + */ +typedef enum { + + FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK = 0, + /**< The iterator is in the normal OK state */ + + FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ILLEGAL_INPUT, + /**< The data passed into a function violated the function's usage criteria */ + + FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ERROR_OPENING_FILE, + /**< The iterator could not open the target file */ + + FLAC__METADATA_SIMPLE_ITERATOR_STATUS_NOT_A_FLAC_FILE, + /**< The iterator could not find the FLAC signature at the start of the file */ + + FLAC__METADATA_SIMPLE_ITERATOR_STATUS_NOT_WRITABLE, + /**< The iterator tried to write to a file that was not writable */ + + FLAC__METADATA_SIMPLE_ITERATOR_STATUS_BAD_METADATA, + /**< The iterator encountered input that does not conform to the FLAC metadata specification */ + + FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR, + /**< The iterator encountered an error while reading the FLAC file */ + + FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR, + /**< The iterator encountered an error while seeking in the FLAC file */ + + FLAC__METADATA_SIMPLE_ITERATOR_STATUS_WRITE_ERROR, + /**< The iterator encountered an error while writing the FLAC file */ + + FLAC__METADATA_SIMPLE_ITERATOR_STATUS_RENAME_ERROR, + /**< The iterator encountered an error renaming the FLAC file */ + + FLAC__METADATA_SIMPLE_ITERATOR_STATUS_UNLINK_ERROR, + /**< The iterator encountered an error removing the temporary file */ + + FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR, + /**< Memory allocation failed */ + + FLAC__METADATA_SIMPLE_ITERATOR_STATUS_INTERNAL_ERROR + /**< The caller violated an assertion or an unexpected error occurred */ + +} FLAC__Metadata_SimpleIteratorStatus; + +/** Maps a FLAC__Metadata_SimpleIteratorStatus to a C string. + * + * Using a FLAC__Metadata_SimpleIteratorStatus as the index to this array + * will give the string equivalent. The contents should not be modified. + */ +extern FLAC_API const char * const FLAC__Metadata_SimpleIteratorStatusString[]; + + +/** Create a new iterator instance. + * + * \retval FLAC__Metadata_SimpleIterator* + * \c NULL if there was an error allocating memory, else the new instance. + */ +FLAC_API FLAC__Metadata_SimpleIterator *FLAC__metadata_simple_iterator_new(); + +/** Free an iterator instance. Deletes the object pointed to by \a iterator. + * + * \param iterator A pointer to an existing iterator. + * \assert + * \code iterator != NULL \endcode + */ +FLAC_API void FLAC__metadata_simple_iterator_delete(FLAC__Metadata_SimpleIterator *iterator); + +/** Get the current status of the iterator. Call this after a function + * returns \c false to get the reason for the error. Also resets the status + * to FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK. + * + * \param iterator A pointer to an existing iterator. + * \assert + * \code iterator != NULL \endcode + * \retval FLAC__Metadata_SimpleIteratorStatus + * The current status of the iterator. + */ +FLAC_API FLAC__Metadata_SimpleIteratorStatus FLAC__metadata_simple_iterator_status(FLAC__Metadata_SimpleIterator *iterator); + +/** Initialize the iterator to point to the first metadata block in the + * given FLAC file. + * + * \param iterator A pointer to an existing iterator. + * \param filename The path to the FLAC file. + * \param read_only If \c true, the FLAC file will be opened + * in read-only mode; if \c false, the FLAC + * file will be opened for edit even if no + * edits are performed. + * \param preserve_file_stats If \c true, the owner and modification + * time will be preserved even if the FLAC + * file is written to. + * \assert + * \code iterator != NULL \endcode + * \code filename != NULL \endcode + * \retval FLAC__bool + * \c false if a memory allocation error occurs, the file can't be + * opened, or another error occurs, else \c true. + */ +FLAC_API FLAC__bool FLAC__metadata_simple_iterator_init(FLAC__Metadata_SimpleIterator *iterator, const char *filename, FLAC__bool read_only, FLAC__bool preserve_file_stats); + +/** Returns \c true if the FLAC file is writable. If \c false, calls to + * FLAC__metadata_simple_iterator_set_block() and + * FLAC__metadata_simple_iterator_insert_block_after() will fail. + * + * \param iterator A pointer to an existing iterator. + * \assert + * \code iterator != NULL \endcode + * \retval FLAC__bool + * See above. + */ +FLAC_API FLAC__bool FLAC__metadata_simple_iterator_is_writable(const FLAC__Metadata_SimpleIterator *iterator); + +/** Moves the iterator forward one metadata block, returning \c false if + * already at the end. + * + * \param iterator A pointer to an existing initialized iterator. + * \assert + * \code iterator != NULL \endcode + * \a iterator has been successfully initialized with + * FLAC__metadata_simple_iterator_init() + * \retval FLAC__bool + * \c false if already at the last metadata block of the chain, else + * \c true. + */ +FLAC_API FLAC__bool FLAC__metadata_simple_iterator_next(FLAC__Metadata_SimpleIterator *iterator); + +/** Moves the iterator backward one metadata block, returning \c false if + * already at the beginning. + * + * \param iterator A pointer to an existing initialized iterator. + * \assert + * \code iterator != NULL \endcode + * \a iterator has been successfully initialized with + * FLAC__metadata_simple_iterator_init() + * \retval FLAC__bool + * \c false if already at the first metadata block of the chain, else + * \c true. + */ +FLAC_API FLAC__bool FLAC__metadata_simple_iterator_prev(FLAC__Metadata_SimpleIterator *iterator); + +/** Get the type of the metadata block at the current position. This + * avoids reading the actual block data which can save time for large + * blocks. + * + * \param iterator A pointer to an existing initialized iterator. + * \assert + * \code iterator != NULL \endcode + * \a iterator has been successfully initialized with + * FLAC__metadata_simple_iterator_init() + * \retval FLAC__MetadataType + * The type of the metadata block at the current iterator position. + */ + +FLAC_API FLAC__MetadataType FLAC__metadata_simple_iterator_get_block_type(const FLAC__Metadata_SimpleIterator *iterator); + +/** Get the metadata block at the current position. You can modify the + * block but must use FLAC__metadata_simple_iterator_set_block() to + * write it back to the FLAC file. + * + * You must call FLAC__metadata_object_delete() on the returned object + * when you are finished with it. + * + * \param iterator A pointer to an existing initialized iterator. + * \assert + * \code iterator != NULL \endcode + * \a iterator has been successfully initialized with + * FLAC__metadata_simple_iterator_init() + * \retval FLAC__StreamMetadata* + * The current metadata block. + */ +FLAC_API FLAC__StreamMetadata *FLAC__metadata_simple_iterator_get_block(FLAC__Metadata_SimpleIterator *iterator); + +/** Write a block back to the FLAC file. This function tries to be + * as efficient as possible; how the block is actually written is + * shown by the following: + * + * Existing block is a STREAMINFO block and the new block is a + * STREAMINFO block: the new block is written in place. Make sure + * you know what you're doing when changing the values of a + * STREAMINFO block. + * + * Existing block is a STREAMINFO block and the new block is a + * not a STREAMINFO block: this is an error since the first block + * must be a STREAMINFO block. Returns \c false without altering the + * file. + * + * Existing block is not a STREAMINFO block and the new block is a + * STREAMINFO block: this is an error since there may be only one + * STREAMINFO block. Returns \c false without altering the file. + * + * Existing block and new block are the same length: the existing + * block will be replaced by the new block, written in place. + * + * Existing block is longer than new block: if use_padding is \c true, + * the existing block will be overwritten in place with the new + * block followed by a PADDING block, if possible, to make the total + * size the same as the existing block. Remember that a padding + * block requires at least four bytes so if the difference in size + * between the new block and existing block is less than that, the + * entire file will have to be rewritten, using the new block's + * exact size. If use_padding is \c false, the entire file will be + * rewritten, replacing the existing block by the new block. + * + * Existing block is shorter than new block: if use_padding is \c true, + * the function will try and expand the new block into the following + * PADDING block, if it exists and doing so won't shrink the PADDING + * block to less than 4 bytes. If there is no following PADDING + * block, or it will shrink to less than 4 bytes, or use_padding is + * \c false, the entire file is rewritten, replacing the existing block + * with the new block. Note that in this case any following PADDING + * block is preserved as is. + * + * After writing the block, the iterator will remain in the same + * place, i.e. pointing to the new block. + * + * \param iterator A pointer to an existing initialized iterator. + * \param block The block to set. + * \param use_padding See above. + * \assert + * \code iterator != NULL \endcode + * \a iterator has been successfully initialized with + * FLAC__metadata_simple_iterator_init() + * \code block != NULL \endcode + * \retval FLAC__bool + * \c true if successful, else \c false. + */ +FLAC_API FLAC__bool FLAC__metadata_simple_iterator_set_block(FLAC__Metadata_SimpleIterator *iterator, FLAC__StreamMetadata *block, FLAC__bool use_padding); + +/** This is similar to FLAC__metadata_simple_iterator_set_block() + * except that instead of writing over an existing block, it appends + * a block after the existing block. \a use_padding is again used to + * tell the function to try an expand into following padding in an + * attempt to avoid rewriting the entire file. + * + * This function will fail and return \c false if given a STREAMINFO + * block. + * + * After writing the block, the iterator will be pointing to the + * new block. + * + * \param iterator A pointer to an existing initialized iterator. + * \param block The block to set. + * \param use_padding See above. + * \assert + * \code iterator != NULL \endcode + * \a iterator has been successfully initialized with + * FLAC__metadata_simple_iterator_init() + * \code block != NULL \endcode + * \retval FLAC__bool + * \c true if successful, else \c false. + */ +FLAC_API FLAC__bool FLAC__metadata_simple_iterator_insert_block_after(FLAC__Metadata_SimpleIterator *iterator, FLAC__StreamMetadata *block, FLAC__bool use_padding); + +/** Deletes the block at the current position. This will cause the + * entire FLAC file to be rewritten, unless \a use_padding is \c true, + * in which case the block will be replaced by an equal-sized PADDING + * block. The iterator will be left pointing to the block before the + * one just deleted. + * + * You may not delete the STREAMINFO block. + * + * \param iterator A pointer to an existing initialized iterator. + * \param use_padding See above. + * \assert + * \code iterator != NULL \endcode + * \a iterator has been successfully initialized with + * FLAC__metadata_simple_iterator_init() + * \retval FLAC__bool + * \c true if successful, else \c false. + */ +FLAC_API FLAC__bool FLAC__metadata_simple_iterator_delete_block(FLAC__Metadata_SimpleIterator *iterator, FLAC__bool use_padding); + +/* \} */ + + +/** \defgroup flac_metadata_level2 FLAC/metadata.h: metadata level 2 interface + * \ingroup flac_metadata + * + * \brief + * The level 2 interface provides read-write access to FLAC file metadata; + * all metadata is read into memory, operated on in memory, and then written + * to file, which is more efficient than level 1 when editing multiple blocks. + * + * The general usage of this interface is: + * + * - Create a new chain using FLAC__metadata_chain_new(). A chain is a + * linked list of FLAC metadata blocks. + * - Read all metadata into the the chain from a FLAC file using + * FLAC__metadata_chain_read() and check the status. + * - Optionally, consolidate the padding using + * FLAC__metadata_chain_merge_padding() or + * FLAC__metadata_chain_sort_padding(). + * - Create a new iterator using FLAC__metadata_iterator_new() + * - Initialize the iterator to point to the first element in the chain + * using FLAC__metadata_iterator_init() + * - Traverse the chain using FLAC__metadata_iterator_next and + * FLAC__metadata_iterator_prev(). + * - Get a block for reading or modification using + * FLAC__metadata_iterator_get_block(). The pointer to the object + * inside the chain is returned, so the block is yours to modify. + * Changes will be reflected in the FLAC file when you write the + * chain. You can also add and delete blocks (see functions below). + * - When done, write out the chain using FLAC__metadata_chain_write(). + * Make sure to read the whole comment to the function below. + * - Delete the chain using FLAC__metadata_chain_delete(). + * + * \note + * Even though the FLAC file is not open while the chain is being + * manipulated, you must not alter the file externally during + * this time. The chain assumes the FLAC file will not change + * between the time of FLAC__metadata_chain_read() and + * FLAC__metadata_chain_write(). + * + * \note + * Do not modify the is_last, length, or type fields of returned + * FLAC__StreamMetadata objects. These are managed automatically. + * + * \note + * The metadata objects returned by FLAC__metadata_iterator_get_block() + * are owned by the chain; do not FLAC__metadata_object_delete() them. + * In the same way, blocks passed to FLAC__metadata_iterator_set_block() + * become owned by the chain and they will be deleted when the chain is + * deleted. + * + * \{ + */ + +struct FLAC__Metadata_Chain; +/** The opaque structure definition for the level 2 chain type. + */ +typedef struct FLAC__Metadata_Chain FLAC__Metadata_Chain; + +struct FLAC__Metadata_Iterator; +/** The opaque structure definition for the level 2 iterator type. + */ +typedef struct FLAC__Metadata_Iterator FLAC__Metadata_Iterator; + +typedef enum { + FLAC__METADATA_CHAIN_STATUS_OK = 0, + /**< The chain is in the normal OK state */ + + FLAC__METADATA_CHAIN_STATUS_ILLEGAL_INPUT, + /**< The data passed into a function violated the function's usage criteria */ + + FLAC__METADATA_CHAIN_STATUS_ERROR_OPENING_FILE, + /**< The chain could not open the target file */ + + FLAC__METADATA_CHAIN_STATUS_NOT_A_FLAC_FILE, + /**< The chain could not find the FLAC signature at the start of the file */ + + FLAC__METADATA_CHAIN_STATUS_NOT_WRITABLE, + /**< The chain tried to write to a file that was not writable */ + + FLAC__METADATA_CHAIN_STATUS_BAD_METADATA, + /**< The chain encountered input that does not conform to the FLAC metadata specification */ + + FLAC__METADATA_CHAIN_STATUS_READ_ERROR, + /**< The chain encountered an error while reading the FLAC file */ + + FLAC__METADATA_CHAIN_STATUS_SEEK_ERROR, + /**< The chain encountered an error while seeking in the FLAC file */ + + FLAC__METADATA_CHAIN_STATUS_WRITE_ERROR, + /**< The chain encountered an error while writing the FLAC file */ + + FLAC__METADATA_CHAIN_STATUS_RENAME_ERROR, + /**< The chain encountered an error renaming the FLAC file */ + + FLAC__METADATA_CHAIN_STATUS_UNLINK_ERROR, + /**< The chain encountered an error removing the temporary file */ + + FLAC__METADATA_CHAIN_STATUS_MEMORY_ALLOCATION_ERROR, + /**< Memory allocation failed */ + + FLAC__METADATA_CHAIN_STATUS_INTERNAL_ERROR, + /**< The caller violated an assertion or an unexpected error occurred */ + + FLAC__METADATA_CHAIN_STATUS_INVALID_CALLBACKS, + /**< One or more of the required callbacks was NULL */ + + FLAC__METADATA_CHAIN_STATUS_READ_WRITE_MISMATCH, + /**< FLAC__metadata_chain_write() was called on a chain read by + * FLAC__metadata_chain_read_with_callbacks(), or + * FLAC__metadata_chain_write_with_callbacks() or + * FLAC__metadata_chain_write_with_callbacks_and_tempfile() was + * called on a chain read by FLAC__metadata_chain_read(). Matching + * read/write methods must always be used. */ + + FLAC__METADATA_CHAIN_STATUS_WRONG_WRITE_CALL + /**< FLAC__metadata_chain_write_with_callbacks() was called when the + * chain write requires a tempfile; use + * FLAC__metadata_chain_write_with_callbacks_and_tempfile() instead. + * Or, FLAC__metadata_chain_write_with_callbacks_and_tempfile() was + * called when the chain write does not require a tempfile; use + * FLAC__metadata_chain_write_with_callbacks() instead. + * Always check FLAC__metadata_chain_check_if_tempfile_needed() + * before writing via callbacks. */ + +} FLAC__Metadata_ChainStatus; + +/** Maps a FLAC__Metadata_ChainStatus to a C string. + * + * Using a FLAC__Metadata_ChainStatus as the index to this array + * will give the string equivalent. The contents should not be modified. + */ +extern FLAC_API const char * const FLAC__Metadata_ChainStatusString[]; + +/*********** FLAC__Metadata_Chain ***********/ + +/** Create a new chain instance. + * + * \retval FLAC__Metadata_Chain* + * \c NULL if there was an error allocating memory, else the new instance. + */ +FLAC_API FLAC__Metadata_Chain *FLAC__metadata_chain_new(); + +/** Free a chain instance. Deletes the object pointed to by \a chain. + * + * \param chain A pointer to an existing chain. + * \assert + * \code chain != NULL \endcode + */ +FLAC_API void FLAC__metadata_chain_delete(FLAC__Metadata_Chain *chain); + +/** Get the current status of the chain. Call this after a function + * returns \c false to get the reason for the error. Also resets the + * status to FLAC__METADATA_CHAIN_STATUS_OK. + * + * \param chain A pointer to an existing chain. + * \assert + * \code chain != NULL \endcode + * \retval FLAC__Metadata_ChainStatus + * The current status of the chain. + */ +FLAC_API FLAC__Metadata_ChainStatus FLAC__metadata_chain_status(FLAC__Metadata_Chain *chain); + +/** Read all metadata from a FLAC file into the chain. + * + * \param chain A pointer to an existing chain. + * \param filename The path to the FLAC file to read. + * \assert + * \code chain != NULL \endcode + * \code filename != NULL \endcode + * \retval FLAC__bool + * \c true if a valid list of metadata blocks was read from + * \a filename, else \c false. On failure, check the status with + * FLAC__metadata_chain_status(). + */ +FLAC_API FLAC__bool FLAC__metadata_chain_read(FLAC__Metadata_Chain *chain, const char *filename); + +/** Read all metadata from a FLAC stream into the chain via I/O callbacks. + * + * The \a handle need only be open for reading, but must be seekable. + * The equivalent minimum stdio fopen() file mode is \c "r" (or \c "rb" + * for Windows). + * + * \param chain A pointer to an existing chain. + * \param handle The I/O handle of the FLAC stream to read. The + * handle will NOT be closed after the metadata is read; + * that is the duty of the caller. + * \param callbacks + * A set of callbacks to use for I/O. The mandatory + * callbacks are \a read, \a seek, and \a tell. + * \assert + * \code chain != NULL \endcode + * \retval FLAC__bool + * \c true if a valid list of metadata blocks was read from + * \a handle, else \c false. On failure, check the status with + * FLAC__metadata_chain_status(). + */ +FLAC_API FLAC__bool FLAC__metadata_chain_read_with_callbacks(FLAC__Metadata_Chain *chain, FLAC__IOHandle handle, FLAC__IOCallbacks callbacks); + +/** Checks if writing the given chain would require the use of a + * temporary file, or if it could be written in place. + * + * Under certain conditions, padding can be utilized so that writing + * edited metadata back to the FLAC file does not require rewriting the + * entire file. If rewriting is required, then a temporary workfile is + * required. When writing metadata using callbacks, you must check + * this function to know whether to call + * FLAC__metadata_chain_write_with_callbacks() or + * FLAC__metadata_chain_write_with_callbacks_and_tempfile(). When + * writing with FLAC__metadata_chain_write(), the temporary file is + * handled internally. + * + * \param chain A pointer to an existing chain. + * \param use_padding + * Whether or not padding will be allowed to be used + * during the write. The value of \a use_padding given + * here must match the value later passed to + * FLAC__metadata_chain_write_with_callbacks() or + * FLAC__metadata_chain_write_with_callbacks_with_tempfile(). + * \assert + * \code chain != NULL \endcode + * \retval FLAC__bool + * \c true if writing the current chain would require a tempfile, or + * \c false if metadata can be written in place. + */ +FLAC_API FLAC__bool FLAC__metadata_chain_check_if_tempfile_needed(FLAC__Metadata_Chain *chain, FLAC__bool use_padding); + +/** Write all metadata out to the FLAC file. This function tries to be as + * efficient as possible; how the metadata is actually written is shown by + * the following: + * + * If the current chain is the same size as the existing metadata, the new + * data is written in place. + * + * If the current chain is longer than the existing metadata, and + * \a use_padding is \c true, and the last block is a PADDING block of + * sufficient length, the function will truncate the final padding block + * so that the overall size of the metadata is the same as the existing + * metadata, and then just rewrite the metadata. Otherwise, if not all of + * the above conditions are met, the entire FLAC file must be rewritten. + * If you want to use padding this way it is a good idea to call + * FLAC__metadata_chain_sort_padding() first so that you have the maximum + * amount of padding to work with, unless you need to preserve ordering + * of the PADDING blocks for some reason. + * + * If the current chain is shorter than the existing metadata, and + * \a use_padding is \c true, and the final block is a PADDING block, the padding + * is extended to make the overall size the same as the existing data. If + * \a use_padding is \c true and the last block is not a PADDING block, a new + * PADDING block is added to the end of the new data to make it the same + * size as the existing data (if possible, see the note to + * FLAC__metadata_simple_iterator_set_block() about the four byte limit) + * and the new data is written in place. If none of the above apply or + * \a use_padding is \c false, the entire FLAC file is rewritten. + * + * If \a preserve_file_stats is \c true, the owner and modification time will + * be preserved even if the FLAC file is written. + * + * For this write function to be used, the chain must have been read with + * FLAC__metadata_chain_read(), not FLAC__metadata_chain_read_with_callbacks(). + * + * \param chain A pointer to an existing chain. + * \param use_padding See above. + * \param preserve_file_stats See above. + * \assert + * \code chain != NULL \endcode + * \retval FLAC__bool + * \c true if the write succeeded, else \c false. On failure, + * check the status with FLAC__metadata_chain_status(). + */ +FLAC_API FLAC__bool FLAC__metadata_chain_write(FLAC__Metadata_Chain *chain, FLAC__bool use_padding, FLAC__bool preserve_file_stats); + +/** Write all metadata out to a FLAC stream via callbacks. + * + * (See FLAC__metadata_chain_write() for the details on how padding is + * used to write metadata in place if possible.) + * + * The \a handle must be open for updating and be seekable. The + * equivalent minimum stdio fopen() file mode is \c "r+" (or \c "r+b" + * for Windows). + * + * For this write function to be used, the chain must have been read with + * FLAC__metadata_chain_read_with_callbacks(), not FLAC__metadata_chain_read(). + * Also, FLAC__metadata_chain_check_if_tempfile_needed() must have returned + * \c false. + * + * \param chain A pointer to an existing chain. + * \param use_padding See FLAC__metadata_chain_write() + * \param handle The I/O handle of the FLAC stream to write. The + * handle will NOT be closed after the metadata is + * written; that is the duty of the caller. + * \param callbacks A set of callbacks to use for I/O. The mandatory + * callbacks are \a write and \a seek. + * \assert + * \code chain != NULL \endcode + * \retval FLAC__bool + * \c true if the write succeeded, else \c false. On failure, + * check the status with FLAC__metadata_chain_status(). + */ +FLAC_API FLAC__bool FLAC__metadata_chain_write_with_callbacks(FLAC__Metadata_Chain *chain, FLAC__bool use_padding, FLAC__IOHandle handle, FLAC__IOCallbacks callbacks); + +/** Write all metadata out to a FLAC stream via callbacks. + * + * (See FLAC__metadata_chain_write() for the details on how padding is + * used to write metadata in place if possible.) + * + * This version of the write-with-callbacks function must be used when + * FLAC__metadata_chain_check_if_tempfile_needed() returns true. In + * this function, you must supply an I/O handle corresponding to the + * FLAC file to edit, and a temporary handle to which the new FLAC + * file will be written. It is the caller's job to move this temporary + * FLAC file on top of the original FLAC file to complete the metadata + * edit. + * + * The \a handle must be open for reading and be seekable. The + * equivalent minimum stdio fopen() file mode is \c "r" (or \c "rb" + * for Windows). + * + * The \a temp_handle must be open for writing. The + * equivalent minimum stdio fopen() file mode is \c "w" (or \c "wb" + * for Windows). It should be an empty stream, or at least positioned + * at the start-of-file (in which case it is the caller's duty to + * truncate it on return). + * + * For this write function to be used, the chain must have been read with + * FLAC__metadata_chain_read_with_callbacks(), not FLAC__metadata_chain_read(). + * Also, FLAC__metadata_chain_check_if_tempfile_needed() must have returned + * \c true. + * + * \param chain A pointer to an existing chain. + * \param use_padding See FLAC__metadata_chain_write() + * \param handle The I/O handle of the original FLAC stream to read. + * The handle will NOT be closed after the metadata is + * written; that is the duty of the caller. + * \param callbacks A set of callbacks to use for I/O on \a handle. + * The mandatory callbacks are \a read, \a seek, and + * \a eof. + * \param temp_handle The I/O handle of the FLAC stream to write. The + * handle will NOT be closed after the metadata is + * written; that is the duty of the caller. + * \param temp_callbacks + * A set of callbacks to use for I/O on temp_handle. + * The only mandatory callback is \a write. + * \assert + * \code chain != NULL \endcode + * \retval FLAC__bool + * \c true if the write succeeded, else \c false. On failure, + * check the status with FLAC__metadata_chain_status(). + */ +FLAC_API FLAC__bool FLAC__metadata_chain_write_with_callbacks_and_tempfile(FLAC__Metadata_Chain *chain, FLAC__bool use_padding, FLAC__IOHandle handle, FLAC__IOCallbacks callbacks, FLAC__IOHandle temp_handle, FLAC__IOCallbacks temp_callbacks); + +/** Merge adjacent PADDING blocks into a single block. + * + * \note This function does not write to the FLAC file, it only + * modifies the chain. + * + * \warning Any iterator on the current chain will become invalid after this + * call. You should delete the iterator and get a new one. + * + * \param chain A pointer to an existing chain. + * \assert + * \code chain != NULL \endcode + */ +FLAC_API void FLAC__metadata_chain_merge_padding(FLAC__Metadata_Chain *chain); + +/** This function will move all PADDING blocks to the end on the metadata, + * then merge them into a single block. + * + * \note This function does not write to the FLAC file, it only + * modifies the chain. + * + * \warning Any iterator on the current chain will become invalid after this + * call. You should delete the iterator and get a new one. + * + * \param chain A pointer to an existing chain. + * \assert + * \code chain != NULL \endcode + */ +FLAC_API void FLAC__metadata_chain_sort_padding(FLAC__Metadata_Chain *chain); + + +/*********** FLAC__Metadata_Iterator ***********/ + +/** Create a new iterator instance. + * + * \retval FLAC__Metadata_Iterator* + * \c NULL if there was an error allocating memory, else the new instance. + */ +FLAC_API FLAC__Metadata_Iterator *FLAC__metadata_iterator_new(); + +/** Free an iterator instance. Deletes the object pointed to by \a iterator. + * + * \param iterator A pointer to an existing iterator. + * \assert + * \code iterator != NULL \endcode + */ +FLAC_API void FLAC__metadata_iterator_delete(FLAC__Metadata_Iterator *iterator); + +/** Initialize the iterator to point to the first metadata block in the + * given chain. + * + * \param iterator A pointer to an existing iterator. + * \param chain A pointer to an existing and initialized (read) chain. + * \assert + * \code iterator != NULL \endcode + * \code chain != NULL \endcode + */ +FLAC_API void FLAC__metadata_iterator_init(FLAC__Metadata_Iterator *iterator, FLAC__Metadata_Chain *chain); + +/** Moves the iterator forward one metadata block, returning \c false if + * already at the end. + * + * \param iterator A pointer to an existing initialized iterator. + * \assert + * \code iterator != NULL \endcode + * \a iterator has been successfully initialized with + * FLAC__metadata_iterator_init() + * \retval FLAC__bool + * \c false if already at the last metadata block of the chain, else + * \c true. + */ +FLAC_API FLAC__bool FLAC__metadata_iterator_next(FLAC__Metadata_Iterator *iterator); + +/** Moves the iterator backward one metadata block, returning \c false if + * already at the beginning. + * + * \param iterator A pointer to an existing initialized iterator. + * \assert + * \code iterator != NULL \endcode + * \a iterator has been successfully initialized with + * FLAC__metadata_iterator_init() + * \retval FLAC__bool + * \c false if already at the first metadata block of the chain, else + * \c true. + */ +FLAC_API FLAC__bool FLAC__metadata_iterator_prev(FLAC__Metadata_Iterator *iterator); + +/** Get the type of the metadata block at the current position. + * + * \param iterator A pointer to an existing initialized iterator. + * \assert + * \code iterator != NULL \endcode + * \a iterator has been successfully initialized with + * FLAC__metadata_iterator_init() + * \retval FLAC__MetadataType + * The type of the metadata block at the current iterator position. + */ +FLAC_API FLAC__MetadataType FLAC__metadata_iterator_get_block_type(const FLAC__Metadata_Iterator *iterator); + +/** Get the metadata block at the current position. You can modify + * the block in place but must write the chain before the changes + * are reflected to the FLAC file. You do not need to call + * FLAC__metadata_iterator_set_block() to reflect the changes; + * the pointer returned by FLAC__metadata_iterator_get_block() + * points directly into the chain. + * + * \warning + * Do not call FLAC__metadata_object_delete() on the returned object; + * to delete a block use FLAC__metadata_iterator_delete_block(). + * + * \param iterator A pointer to an existing initialized iterator. + * \assert + * \code iterator != NULL \endcode + * \a iterator has been successfully initialized with + * FLAC__metadata_iterator_init() + * \retval FLAC__StreamMetadata* + * The current metadata block. + */ +FLAC_API FLAC__StreamMetadata *FLAC__metadata_iterator_get_block(FLAC__Metadata_Iterator *iterator); + +/** Set the metadata block at the current position, replacing the existing + * block. The new block passed in becomes owned by the chain and it will be + * deleted when the chain is deleted. + * + * \param iterator A pointer to an existing initialized iterator. + * \param block A pointer to a metadata block. + * \assert + * \code iterator != NULL \endcode + * \a iterator has been successfully initialized with + * FLAC__metadata_iterator_init() + * \code block != NULL \endcode + * \retval FLAC__bool + * \c false if the conditions in the above description are not met, or + * a memory allocation error occurs, otherwise \c true. + */ +FLAC_API FLAC__bool FLAC__metadata_iterator_set_block(FLAC__Metadata_Iterator *iterator, FLAC__StreamMetadata *block); + +/** Removes the current block from the chain. If \a replace_with_padding is + * \c true, the block will instead be replaced with a padding block of equal + * size. You can not delete the STREAMINFO block. The iterator will be + * left pointing to the block before the one just "deleted", even if + * \a replace_with_padding is \c true. + * + * \param iterator A pointer to an existing initialized iterator. + * \param replace_with_padding See above. + * \assert + * \code iterator != NULL \endcode + * \a iterator has been successfully initialized with + * FLAC__metadata_iterator_init() + * \retval FLAC__bool + * \c false if the conditions in the above description are not met, + * otherwise \c true. + */ +FLAC_API FLAC__bool FLAC__metadata_iterator_delete_block(FLAC__Metadata_Iterator *iterator, FLAC__bool replace_with_padding); + +/** Insert a new block before the current block. You cannot insert a block + * before the first STREAMINFO block. You cannot insert a STREAMINFO block + * as there can be only one, the one that already exists at the head when you + * read in a chain. The chain takes ownership of the new block and it will be + * deleted when the chain is deleted. The iterator will be left pointing to + * the new block. + * + * \param iterator A pointer to an existing initialized iterator. + * \param block A pointer to a metadata block to insert. + * \assert + * \code iterator != NULL \endcode + * \a iterator has been successfully initialized with + * FLAC__metadata_iterator_init() + * \retval FLAC__bool + * \c false if the conditions in the above description are not met, or + * a memory allocation error occurs, otherwise \c true. + */ +FLAC_API FLAC__bool FLAC__metadata_iterator_insert_block_before(FLAC__Metadata_Iterator *iterator, FLAC__StreamMetadata *block); + +/** Insert a new block after the current block. You cannot insert a STREAMINFO + * block as there can be only one, the one that already exists at the head when + * you read in a chain. The chain takes ownership of the new block and it will + * be deleted when the chain is deleted. The iterator will be left pointing to + * the new block. + * + * \param iterator A pointer to an existing initialized iterator. + * \param block A pointer to a metadata block to insert. + * \assert + * \code iterator != NULL \endcode + * \a iterator has been successfully initialized with + * FLAC__metadata_iterator_init() + * \retval FLAC__bool + * \c false if the conditions in the above description are not met, or + * a memory allocation error occurs, otherwise \c true. + */ +FLAC_API FLAC__bool FLAC__metadata_iterator_insert_block_after(FLAC__Metadata_Iterator *iterator, FLAC__StreamMetadata *block); + +/* \} */ + + +/** \defgroup flac_metadata_object FLAC/metadata.h: metadata object methods + * \ingroup flac_metadata + * + * \brief + * This module contains methods for manipulating FLAC metadata objects. + * + * Since many are variable length we have to be careful about the memory + * management. We decree that all pointers to data in the object are + * owned by the object and memory-managed by the object. + * + * Use the FLAC__metadata_object_new() and FLAC__metadata_object_delete() + * functions to create all instances. When using the + * FLAC__metadata_object_set_*() functions to set pointers to data, set + * \a copy to \c true to have the function make it's own copy of the data, or + * to \c false to give the object ownership of your data. In the latter case + * your pointer must be freeable by free() and will be free()d when the object + * is FLAC__metadata_object_delete()d. It is legal to pass a null pointer as + * the data pointer to a FLAC__metadata_object_set_*() function as long as + * the length argument is 0 and the \a copy argument is \c false. + * + * The FLAC__metadata_object_new() and FLAC__metadata_object_clone() function + * will return \c NULL in the case of a memory allocation error, otherwise a new + * object. The FLAC__metadata_object_set_*() functions return \c false in the + * case of a memory allocation error. + * + * We don't have the convenience of C++ here, so note that the library relies + * on you to keep the types straight. In other words, if you pass, for + * example, a FLAC__StreamMetadata* that represents a STREAMINFO block to + * FLAC__metadata_object_application_set_data(), you will get an assertion + * failure. + * + * For convenience the FLAC__metadata_object_vorbiscomment_*() functions + * maintain a trailing NUL on each Vorbis comment entry. This is not counted + * toward the length or stored in the stream, but it can make working with plain + * comments (those that don't contain embedded-NULs in the value) easier. + * Entries passed into these functions have trailing NULs added if missing, and + * returned entries are guaranteed to have a trailing NUL. + * + * The FLAC__metadata_object_vorbiscomment_*() functions that take a Vorbis + * comment entry/name/value will first validate that it complies with the Vorbis + * comment specification and return false if it does not. + * + * There is no need to recalculate the length field on metadata blocks you + * have modified. They will be calculated automatically before they are + * written back to a file. + * + * \{ + */ + + +/** Create a new metadata object instance of the given type. + * + * The object will be "empty"; i.e. values and data pointers will be \c 0, + * with the exception of FLAC__METADATA_TYPE_VORBIS_COMMENT, which will have + * the vendor string set (but zero comments). + * + * Do not pass in a value greater than or equal to + * \a FLAC__METADATA_TYPE_UNDEFINED unless you really know what you're + * doing. + * + * \param type Type of object to create + * \retval FLAC__StreamMetadata* + * \c NULL if there was an error allocating memory or the type code is + * greater than FLAC__MAX_METADATA_TYPE_CODE, else the new instance. + */ +FLAC_API FLAC__StreamMetadata *FLAC__metadata_object_new(FLAC__MetadataType type); + +/** Create a copy of an existing metadata object. + * + * The copy is a "deep" copy, i.e. dynamically allocated data within the + * object is also copied. The caller takes ownership of the new block and + * is responsible for freeing it with FLAC__metadata_object_delete(). + * + * \param object Pointer to object to copy. + * \assert + * \code object != NULL \endcode + * \retval FLAC__StreamMetadata* + * \c NULL if there was an error allocating memory, else the new instance. + */ +FLAC_API FLAC__StreamMetadata *FLAC__metadata_object_clone(const FLAC__StreamMetadata *object); + +/** Free a metadata object. Deletes the object pointed to by \a object. + * + * The delete is a "deep" delete, i.e. dynamically allocated data within the + * object is also deleted. + * + * \param object A pointer to an existing object. + * \assert + * \code object != NULL \endcode + */ +FLAC_API void FLAC__metadata_object_delete(FLAC__StreamMetadata *object); + +/** Compares two metadata objects. + * + * The compare is "deep", i.e. dynamically allocated data within the + * object is also compared. + * + * \param block1 A pointer to an existing object. + * \param block2 A pointer to an existing object. + * \assert + * \code block1 != NULL \endcode + * \code block2 != NULL \endcode + * \retval FLAC__bool + * \c true if objects are identical, else \c false. + */ +FLAC_API FLAC__bool FLAC__metadata_object_is_equal(const FLAC__StreamMetadata *block1, const FLAC__StreamMetadata *block2); + +/** Sets the application data of an APPLICATION block. + * + * If \a copy is \c true, a copy of the data is stored; otherwise, the object + * takes ownership of the pointer. + * + * \param object A pointer to an existing APPLICATION object. + * \param data A pointer to the data to set. + * \param length The length of \a data in bytes. + * \param copy See above. + * \assert + * \code object != NULL \endcode + * \code object->type == FLAC__METADATA_TYPE_APPLICATION \endcode + * \code (data != NULL && length > 0) || + * (data == NULL && length == 0 && copy == false) \endcode + * \retval FLAC__bool + * \c false if \a copy is \c true and malloc() fails, else \c true. + */ +FLAC_API FLAC__bool FLAC__metadata_object_application_set_data(FLAC__StreamMetadata *object, FLAC__byte *data, unsigned length, FLAC__bool copy); + +/** Resize the seekpoint array. + * + * If the size shrinks, elements will truncated; if it grows, new placeholder + * points will be added to the end. + * + * \param object A pointer to an existing SEEKTABLE object. + * \param new_num_points The desired length of the array; may be \c 0. + * \assert + * \code object != NULL \endcode + * \code object->type == FLAC__METADATA_TYPE_SEEKTABLE \endcode + * \code (object->data.seek_table.points == NULL && object->data.seek_table.num_points == 0) || + * (object->data.seek_table.points != NULL && object->data.seek_table.num_points > 0) \endcode + * \retval FLAC__bool + * \c false if memory allocation error, else \c true. + */ +FLAC_API FLAC__bool FLAC__metadata_object_seektable_resize_points(FLAC__StreamMetadata *object, unsigned new_num_points); + +/** Set a seekpoint in a seektable. + * + * \param object A pointer to an existing SEEKTABLE object. + * \param point_num Index into seekpoint array to set. + * \param point The point to set. + * \assert + * \code object != NULL \endcode + * \code object->type == FLAC__METADATA_TYPE_SEEKTABLE \endcode + * \code object->data.seek_table.num_points > point_num \endcode + */ +FLAC_API void FLAC__metadata_object_seektable_set_point(FLAC__StreamMetadata *object, unsigned point_num, FLAC__StreamMetadata_SeekPoint point); + +/** Insert a seekpoint into a seektable. + * + * \param object A pointer to an existing SEEKTABLE object. + * \param point_num Index into seekpoint array to set. + * \param point The point to set. + * \assert + * \code object != NULL \endcode + * \code object->type == FLAC__METADATA_TYPE_SEEKTABLE \endcode + * \code object->data.seek_table.num_points >= point_num \endcode + * \retval FLAC__bool + * \c false if memory allocation error, else \c true. + */ +FLAC_API FLAC__bool FLAC__metadata_object_seektable_insert_point(FLAC__StreamMetadata *object, unsigned point_num, FLAC__StreamMetadata_SeekPoint point); + +/** Delete a seekpoint from a seektable. + * + * \param object A pointer to an existing SEEKTABLE object. + * \param point_num Index into seekpoint array to set. + * \assert + * \code object != NULL \endcode + * \code object->type == FLAC__METADATA_TYPE_SEEKTABLE \endcode + * \code object->data.seek_table.num_points > point_num \endcode + * \retval FLAC__bool + * \c false if memory allocation error, else \c true. + */ +FLAC_API FLAC__bool FLAC__metadata_object_seektable_delete_point(FLAC__StreamMetadata *object, unsigned point_num); + +/** Check a seektable to see if it conforms to the FLAC specification. + * See the format specification for limits on the contents of the + * seektable. + * + * \param object A pointer to an existing SEEKTABLE object. + * \assert + * \code object != NULL \endcode + * \code object->type == FLAC__METADATA_TYPE_SEEKTABLE \endcode + * \retval FLAC__bool + * \c false if seek table is illegal, else \c true. + */ +FLAC_API FLAC__bool FLAC__metadata_object_seektable_is_legal(const FLAC__StreamMetadata *object); + +/** Append a number of placeholder points to the end of a seek table. + * + * \note + * As with the other ..._seektable_template_... functions, you should + * call FLAC__metadata_object_seektable_template_sort() when finished + * to make the seek table legal. + * + * \param object A pointer to an existing SEEKTABLE object. + * \param num The number of placeholder points to append. + * \assert + * \code object != NULL \endcode + * \code object->type == FLAC__METADATA_TYPE_SEEKTABLE \endcode + * \retval FLAC__bool + * \c false if memory allocation fails, else \c true. + */ +FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_placeholders(FLAC__StreamMetadata *object, unsigned num); + +/** Append a specific seek point template to the end of a seek table. + * + * \note + * As with the other ..._seektable_template_... functions, you should + * call FLAC__metadata_object_seektable_template_sort() when finished + * to make the seek table legal. + * + * \param object A pointer to an existing SEEKTABLE object. + * \param sample_number The sample number of the seek point template. + * \assert + * \code object != NULL \endcode + * \code object->type == FLAC__METADATA_TYPE_SEEKTABLE \endcode + * \retval FLAC__bool + * \c false if memory allocation fails, else \c true. + */ +FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_point(FLAC__StreamMetadata *object, FLAC__uint64 sample_number); + +/** Append specific seek point templates to the end of a seek table. + * + * \note + * As with the other ..._seektable_template_... functions, you should + * call FLAC__metadata_object_seektable_template_sort() when finished + * to make the seek table legal. + * + * \param object A pointer to an existing SEEKTABLE object. + * \param sample_numbers An array of sample numbers for the seek points. + * \param num The number of seek point templates to append. + * \assert + * \code object != NULL \endcode + * \code object->type == FLAC__METADATA_TYPE_SEEKTABLE \endcode + * \retval FLAC__bool + * \c false if memory allocation fails, else \c true. + */ +FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_points(FLAC__StreamMetadata *object, FLAC__uint64 sample_numbers[], unsigned num); + +/** Append a set of evenly-spaced seek point templates to the end of a + * seek table. + * + * \note + * As with the other ..._seektable_template_... functions, you should + * call FLAC__metadata_object_seektable_template_sort() when finished + * to make the seek table legal. + * + * \param object A pointer to an existing SEEKTABLE object. + * \param num The number of placeholder points to append. + * \param total_samples The total number of samples to be encoded; + * the seekpoints will be spaced approximately + * \a total_samples / \a num samples apart. + * \assert + * \code object != NULL \endcode + * \code object->type == FLAC__METADATA_TYPE_SEEKTABLE \endcode + * \retval FLAC__bool + * \c false if memory allocation fails, else \c true. + */ +FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_spaced_points(FLAC__StreamMetadata *object, unsigned num, FLAC__uint64 total_samples); + +/** Sort a seek table's seek points according to the format specification, + * removing duplicates. + * + * \param object A pointer to a seek table to be sorted. + * \param compact If \c false, behaves like FLAC__format_seektable_sort(). + * If \c true, duplicates are deleted and the seek table is + * shrunk appropriately; the number of placeholder points + * present in the seek table will be the same after the call + * as before. + * \assert + * \code object != NULL \endcode + * \code object->type == FLAC__METADATA_TYPE_SEEKTABLE \endcode + * \retval FLAC__bool + * \c false if realloc() fails, else \c true. + */ +FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_sort(FLAC__StreamMetadata *object, FLAC__bool compact); + +/** Sets the vendor string in a VORBIS_COMMENT block. + * + * For convenience, a trailing NUL is added to the entry if it doesn't have + * one already. + * + * If \a copy is \c true, a copy of the entry is stored; otherwise, the object + * takes ownership of the \c entry.entry pointer. + * + * \note If this function returns \c false, the caller still owns the + * pointer. + * + * \param object A pointer to an existing VORBIS_COMMENT object. + * \param entry The entry to set the vendor string to. + * \param copy See above. + * \assert + * \code object != NULL \endcode + * \code object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT \endcode + * \code (entry.entry != NULL && entry.length > 0) || + * (entry.entry == NULL && entry.length == 0) \endcode + * \retval FLAC__bool + * \c false if memory allocation fails or \a entry does not comply with the + * Vorbis comment specification, else \c true. + */ +FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_set_vendor_string(FLAC__StreamMetadata *object, FLAC__StreamMetadata_VorbisComment_Entry entry, FLAC__bool copy); + +/** Resize the comment array. + * + * If the size shrinks, elements will truncated; if it grows, new empty + * fields will be added to the end. + * + * \param object A pointer to an existing VORBIS_COMMENT object. + * \param new_num_comments The desired length of the array; may be \c 0. + * \assert + * \code object != NULL \endcode + * \code object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT \endcode + * \code (object->data.vorbis_comment.comments == NULL && object->data.vorbis_comment.num_comments == 0) || + * (object->data.vorbis_comment.comments != NULL && object->data.vorbis_comment.num_comments > 0) \endcode + * \retval FLAC__bool + * \c false if memory allocation fails, else \c true. + */ +FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_resize_comments(FLAC__StreamMetadata *object, unsigned new_num_comments); + +/** Sets a comment in a VORBIS_COMMENT block. + * + * For convenience, a trailing NUL is added to the entry if it doesn't have + * one already. + * + * If \a copy is \c true, a copy of the entry is stored; otherwise, the object + * takes ownership of the \c entry.entry pointer. + * + * \note If this function returns \c false, the caller still owns the + * pointer. + * + * \param object A pointer to an existing VORBIS_COMMENT object. + * \param comment_num Index into comment array to set. + * \param entry The entry to set the comment to. + * \param copy See above. + * \assert + * \code object != NULL \endcode + * \code object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT \endcode + * \code comment_num < object->data.vorbis_comment.num_comments \endcode + * \code (entry.entry != NULL && entry.length > 0) || + * (entry.entry == NULL && entry.length == 0) \endcode + * \retval FLAC__bool + * \c false if memory allocation fails or \a entry does not comply with the + * Vorbis comment specification, else \c true. + */ +FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_set_comment(FLAC__StreamMetadata *object, unsigned comment_num, FLAC__StreamMetadata_VorbisComment_Entry entry, FLAC__bool copy); + +/** Insert a comment in a VORBIS_COMMENT block at the given index. + * + * For convenience, a trailing NUL is added to the entry if it doesn't have + * one already. + * + * If \a copy is \c true, a copy of the entry is stored; otherwise, the object + * takes ownership of the \c entry.entry pointer. + * + * \note If this function returns \c false, the caller still owns the + * pointer. + * + * \param object A pointer to an existing VORBIS_COMMENT object. + * \param comment_num The index at which to insert the comment. The comments + * at and after \a comment_num move right one position. + * To append a comment to the end, set \a comment_num to + * \c object->data.vorbis_comment.num_comments . + * \param entry The comment to insert. + * \param copy See above. + * \assert + * \code object != NULL \endcode + * \code object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT \endcode + * \code object->data.vorbis_comment.num_comments >= comment_num \endcode + * \code (entry.entry != NULL && entry.length > 0) || + * (entry.entry == NULL && entry.length == 0 && copy == false) \endcode + * \retval FLAC__bool + * \c false if memory allocation fails or \a entry does not comply with the + * Vorbis comment specification, else \c true. + */ +FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_insert_comment(FLAC__StreamMetadata *object, unsigned comment_num, FLAC__StreamMetadata_VorbisComment_Entry entry, FLAC__bool copy); + +/** Appends a comment to a VORBIS_COMMENT block. + * + * For convenience, a trailing NUL is added to the entry if it doesn't have + * one already. + * + * If \a copy is \c true, a copy of the entry is stored; otherwise, the object + * takes ownership of the \c entry.entry pointer. + * + * \note If this function returns \c false, the caller still owns the + * pointer. + * + * \param object A pointer to an existing VORBIS_COMMENT object. + * \param entry The comment to insert. + * \param copy See above. + * \assert + * \code object != NULL \endcode + * \code object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT \endcode + * \code (entry.entry != NULL && entry.length > 0) || + * (entry.entry == NULL && entry.length == 0 && copy == false) \endcode + * \retval FLAC__bool + * \c false if memory allocation fails or \a entry does not comply with the + * Vorbis comment specification, else \c true. + */ +FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_append_comment(FLAC__StreamMetadata *object, FLAC__StreamMetadata_VorbisComment_Entry entry, FLAC__bool copy); + +/** Replaces comments in a VORBIS_COMMENT block with a new one. + * + * For convenience, a trailing NUL is added to the entry if it doesn't have + * one already. + * + * Depending on the the value of \a all, either all or just the first comment + * whose field name(s) match the given entry's name will be replaced by the + * given entry. If no comments match, \a entry will simply be appended. + * + * If \a copy is \c true, a copy of the entry is stored; otherwise, the object + * takes ownership of the \c entry.entry pointer. + * + * \note If this function returns \c false, the caller still owns the + * pointer. + * + * \param object A pointer to an existing VORBIS_COMMENT object. + * \param entry The comment to insert. + * \param all If \c true, all comments whose field name matches + * \a entry's field name will be removed, and \a entry will + * be inserted at the position of the first matching + * comment. If \c false, only the first comment whose + * field name matches \a entry's field name will be + * replaced with \a entry. + * \param copy See above. + * \assert + * \code object != NULL \endcode + * \code object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT \endcode + * \code (entry.entry != NULL && entry.length > 0) || + * (entry.entry == NULL && entry.length == 0 && copy == false) \endcode + * \retval FLAC__bool + * \c false if memory allocation fails or \a entry does not comply with the + * Vorbis comment specification, else \c true. + */ +FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_replace_comment(FLAC__StreamMetadata *object, FLAC__StreamMetadata_VorbisComment_Entry entry, FLAC__bool all, FLAC__bool copy); + +/** Delete a comment in a VORBIS_COMMENT block at the given index. + * + * \param object A pointer to an existing VORBIS_COMMENT object. + * \param comment_num The index of the comment to delete. + * \assert + * \code object != NULL \endcode + * \code object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT \endcode + * \code object->data.vorbis_comment.num_comments > comment_num \endcode + * \retval FLAC__bool + * \c false if realloc() fails, else \c true. + */ +FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_delete_comment(FLAC__StreamMetadata *object, unsigned comment_num); + +/** Creates a Vorbis comment entry from NUL-terminated name and value strings. + * + * On return, the filled-in \a entry->entry pointer will point to malloc()ed + * memory and shall be owned by the caller. For convenience the entry will + * have a terminating NUL. + * + * \param entry A pointer to a Vorbis comment entry. The entry's + * \c entry pointer should not point to allocated + * memory as it will be overwritten. + * \param field_name The field name in ASCII, \c NUL terminated. + * \param field_value The field value in UTF-8, \c NUL terminated. + * \assert + * \code entry != NULL \endcode + * \code field_name != NULL \endcode + * \code field_value != NULL \endcode + * \retval FLAC__bool + * \c false if malloc() fails, or if \a field_name or \a field_value does + * not comply with the Vorbis comment specification, else \c true. + */ +FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_entry_from_name_value_pair(FLAC__StreamMetadata_VorbisComment_Entry *entry, const char *field_name, const char *field_value); + +/** Splits a Vorbis comment entry into NUL-terminated name and value strings. + * + * The returned pointers to name and value will be allocated by malloc() + * and shall be owned by the caller. + * + * \param entry An existing Vorbis comment entry. + * \param field_name The address of where the returned pointer to the + * field name will be stored. + * \param field_value The address of where the returned pointer to the + * field value will be stored. + * \assert + * \code (entry.entry != NULL && entry.length > 0) \endcode + * \code memchr(entry.entry, '=', entry.length) != NULL \endcode + * \code field_name != NULL \endcode + * \code field_value != NULL \endcode + * \retval FLAC__bool + * \c false if memory allocation fails or \a entry does not comply with the + * Vorbis comment specification, else \c true. + */ +FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_entry_to_name_value_pair(const FLAC__StreamMetadata_VorbisComment_Entry entry, char **field_name, char **field_value); + +/** Check if the given Vorbis comment entry's field name matches the given + * field name. + * + * \param entry An existing Vorbis comment entry. + * \param field_name The field name to check. + * \param field_name_length The length of \a field_name, not including the + * terminating \c NUL. + * \assert + * \code (entry.entry != NULL && entry.length > 0) \endcode + * \retval FLAC__bool + * \c true if the field names match, else \c false + */ +FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_entry_matches(const FLAC__StreamMetadata_VorbisComment_Entry entry, const char *field_name, unsigned field_name_length); + +/** Find a Vorbis comment with the given field name. + * + * The search begins at entry number \a offset; use an offset of 0 to + * search from the beginning of the comment array. + * + * \param object A pointer to an existing VORBIS_COMMENT object. + * \param offset The offset into the comment array from where to start + * the search. + * \param field_name The field name of the comment to find. + * \assert + * \code object != NULL \endcode + * \code object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT \endcode + * \code field_name != NULL \endcode + * \retval int + * The offset in the comment array of the first comment whose field + * name matches \a field_name, or \c -1 if no match was found. + */ +FLAC_API int FLAC__metadata_object_vorbiscomment_find_entry_from(const FLAC__StreamMetadata *object, unsigned offset, const char *field_name); + +/** Remove first Vorbis comment matching the given field name. + * + * \param object A pointer to an existing VORBIS_COMMENT object. + * \param field_name The field name of comment to delete. + * \assert + * \code object != NULL \endcode + * \code object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT \endcode + * \retval int + * \c -1 for memory allocation error, \c 0 for no matching entries, + * \c 1 for one matching entry deleted. + */ +FLAC_API int FLAC__metadata_object_vorbiscomment_remove_entry_matching(FLAC__StreamMetadata *object, const char *field_name); + +/** Remove all Vorbis comments matching the given field name. + * + * \param object A pointer to an existing VORBIS_COMMENT object. + * \param field_name The field name of comments to delete. + * \assert + * \code object != NULL \endcode + * \code object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT \endcode + * \retval int + * \c -1 for memory allocation error, \c 0 for no matching entries, + * else the number of matching entries deleted. + */ +FLAC_API int FLAC__metadata_object_vorbiscomment_remove_entries_matching(FLAC__StreamMetadata *object, const char *field_name); + +/** Create a new CUESHEET track instance. + * + * The object will be "empty"; i.e. values and data pointers will be \c 0. + * + * \retval FLAC__StreamMetadata_CueSheet_Track* + * \c NULL if there was an error allocating memory, else the new instance. + */ +FLAC_API FLAC__StreamMetadata_CueSheet_Track *FLAC__metadata_object_cuesheet_track_new(); + +/** Create a copy of an existing CUESHEET track object. + * + * The copy is a "deep" copy, i.e. dynamically allocated data within the + * object is also copied. The caller takes ownership of the new object and + * is responsible for freeing it with + * FLAC__metadata_object_cuesheet_track_delete(). + * + * \param object Pointer to object to copy. + * \assert + * \code object != NULL \endcode + * \retval FLAC__StreamMetadata_CueSheet_Track* + * \c NULL if there was an error allocating memory, else the new instance. + */ +FLAC_API FLAC__StreamMetadata_CueSheet_Track *FLAC__metadata_object_cuesheet_track_clone(const FLAC__StreamMetadata_CueSheet_Track *object); + +/** Delete a CUESHEET track object + * + * \param object A pointer to an existing CUESHEET track object. + * \assert + * \code object != NULL \endcode + */ +FLAC_API void FLAC__metadata_object_cuesheet_track_delete(FLAC__StreamMetadata_CueSheet_Track *object); + +/** Resize a track's index point array. + * + * If the size shrinks, elements will truncated; if it grows, new blank + * indices will be added to the end. + * + * \param object A pointer to an existing CUESHEET object. + * \param track_num The index of the track to modify. NOTE: this is not + * necessarily the same as the track's \a number field. + * \param new_num_indices The desired length of the array; may be \c 0. + * \assert + * \code object != NULL \endcode + * \code object->type == FLAC__METADATA_TYPE_CUESHEET \endcode + * \code object->data.cue_sheet.num_tracks > track_num \endcode + * \code (object->data.cue_sheet.tracks[track_num].indices == NULL && object->data.cue_sheet.tracks[track_num].num_indices == 0) || + * (object->data.cue_sheet.tracks[track_num].indices != NULL && object->data.cue_sheet.tracks[track_num].num_indices > 0) \endcode + * \retval FLAC__bool + * \c false if memory allocation error, else \c true. + */ +FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_resize_indices(FLAC__StreamMetadata *object, unsigned track_num, unsigned new_num_indices); + +/** Insert an index point in a CUESHEET track at the given index. + * + * \param object A pointer to an existing CUESHEET object. + * \param track_num The index of the track to modify. NOTE: this is not + * necessarily the same as the track's \a number field. + * \param index_num The index into the track's index array at which to + * insert the index point. NOTE: this is not necessarily + * the same as the index point's \a number field. The + * indices at and after \a index_num move right one + * position. To append an index point to the end, set + * \a index_num to + * \c object->data.cue_sheet.tracks[track_num].num_indices . + * \param index The index point to insert. + * \assert + * \code object != NULL \endcode + * \code object->type == FLAC__METADATA_TYPE_CUESHEET \endcode + * \code object->data.cue_sheet.num_tracks > track_num \endcode + * \code object->data.cue_sheet.tracks[track_num].num_indices >= index_num \endcode + * \retval FLAC__bool + * \c false if realloc() fails, else \c true. + */ +FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_insert_index(FLAC__StreamMetadata *object, unsigned track_num, unsigned index_num, FLAC__StreamMetadata_CueSheet_Index index); + +/** Insert a blank index point in a CUESHEET track at the given index. + * + * A blank index point is one in which all field values are zero. + * + * \param object A pointer to an existing CUESHEET object. + * \param track_num The index of the track to modify. NOTE: this is not + * necessarily the same as the track's \a number field. + * \param index_num The index into the track's index array at which to + * insert the index point. NOTE: this is not necessarily + * the same as the index point's \a number field. The + * indices at and after \a index_num move right one + * position. To append an index point to the end, set + * \a index_num to + * \c object->data.cue_sheet.tracks[track_num].num_indices . + * \assert + * \code object != NULL \endcode + * \code object->type == FLAC__METADATA_TYPE_CUESHEET \endcode + * \code object->data.cue_sheet.num_tracks > track_num \endcode + * \code object->data.cue_sheet.tracks[track_num].num_indices >= index_num \endcode + * \retval FLAC__bool + * \c false if realloc() fails, else \c true. + */ +FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_insert_blank_index(FLAC__StreamMetadata *object, unsigned track_num, unsigned index_num); + +/** Delete an index point in a CUESHEET track at the given index. + * + * \param object A pointer to an existing CUESHEET object. + * \param track_num The index into the track array of the track to + * modify. NOTE: this is not necessarily the same + * as the track's \a number field. + * \param index_num The index into the track's index array of the index + * to delete. NOTE: this is not necessarily the same + * as the index's \a number field. + * \assert + * \code object != NULL \endcode + * \code object->type == FLAC__METADATA_TYPE_CUESHEET \endcode + * \code object->data.cue_sheet.num_tracks > track_num \endcode + * \code object->data.cue_sheet.tracks[track_num].num_indices > index_num \endcode + * \retval FLAC__bool + * \c false if realloc() fails, else \c true. + */ +FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_delete_index(FLAC__StreamMetadata *object, unsigned track_num, unsigned index_num); + +/** Resize the track array. + * + * If the size shrinks, elements will truncated; if it grows, new blank + * tracks will be added to the end. + * + * \param object A pointer to an existing CUESHEET object. + * \param new_num_tracks The desired length of the array; may be \c 0. + * \assert + * \code object != NULL \endcode + * \code object->type == FLAC__METADATA_TYPE_CUESHEET \endcode + * \code (object->data.cue_sheet.tracks == NULL && object->data.cue_sheet.num_tracks == 0) || + * (object->data.cue_sheet.tracks != NULL && object->data.cue_sheet.num_tracks > 0) \endcode + * \retval FLAC__bool + * \c false if memory allocation error, else \c true. + */ +FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_resize_tracks(FLAC__StreamMetadata *object, unsigned new_num_tracks); + +/** Sets a track in a CUESHEET block. + * + * If \a copy is \c true, a copy of the track is stored; otherwise, the object + * takes ownership of the \a track pointer. + * + * \param object A pointer to an existing CUESHEET object. + * \param track_num Index into track array to set. NOTE: this is not + * necessarily the same as the track's \a number field. + * \param track The track to set the track to. You may safely pass in + * a const pointer if \a copy is \c true. + * \param copy See above. + * \assert + * \code object != NULL \endcode + * \code object->type == FLAC__METADATA_TYPE_CUESHEET \endcode + * \code track_num < object->data.cue_sheet.num_tracks \endcode + * \code (track->indices != NULL && track->num_indices > 0) || + * (track->indices == NULL && track->num_indices == 0) + * \retval FLAC__bool + * \c false if \a copy is \c true and malloc() fails, else \c true. + */ +FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_set_track(FLAC__StreamMetadata *object, unsigned track_num, FLAC__StreamMetadata_CueSheet_Track *track, FLAC__bool copy); + +/** Insert a track in a CUESHEET block at the given index. + * + * If \a copy is \c true, a copy of the track is stored; otherwise, the object + * takes ownership of the \a track pointer. + * + * \param object A pointer to an existing CUESHEET object. + * \param track_num The index at which to insert the track. NOTE: this + * is not necessarily the same as the track's \a number + * field. The tracks at and after \a track_num move right + * one position. To append a track to the end, set + * \a track_num to \c object->data.cue_sheet.num_tracks . + * \param track The track to insert. You may safely pass in a const + * pointer if \a copy is \c true. + * \param copy See above. + * \assert + * \code object != NULL \endcode + * \code object->type == FLAC__METADATA_TYPE_CUESHEET \endcode + * \code object->data.cue_sheet.num_tracks >= track_num \endcode + * \retval FLAC__bool + * \c false if \a copy is \c true and malloc() fails, else \c true. + */ +FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_insert_track(FLAC__StreamMetadata *object, unsigned track_num, FLAC__StreamMetadata_CueSheet_Track *track, FLAC__bool copy); + +/** Insert a blank track in a CUESHEET block at the given index. + * + * A blank track is one in which all field values are zero. + * + * \param object A pointer to an existing CUESHEET object. + * \param track_num The index at which to insert the track. NOTE: this + * is not necessarily the same as the track's \a number + * field. The tracks at and after \a track_num move right + * one position. To append a track to the end, set + * \a track_num to \c object->data.cue_sheet.num_tracks . + * \assert + * \code object != NULL \endcode + * \code object->type == FLAC__METADATA_TYPE_CUESHEET \endcode + * \code object->data.cue_sheet.num_tracks >= track_num \endcode + * \retval FLAC__bool + * \c false if \a copy is \c true and malloc() fails, else \c true. + */ +FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_insert_blank_track(FLAC__StreamMetadata *object, unsigned track_num); + +/** Delete a track in a CUESHEET block at the given index. + * + * \param object A pointer to an existing CUESHEET object. + * \param track_num The index into the track array of the track to + * delete. NOTE: this is not necessarily the same + * as the track's \a number field. + * \assert + * \code object != NULL \endcode + * \code object->type == FLAC__METADATA_TYPE_CUESHEET \endcode + * \code object->data.cue_sheet.num_tracks > track_num \endcode + * \retval FLAC__bool + * \c false if realloc() fails, else \c true. + */ +FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_delete_track(FLAC__StreamMetadata *object, unsigned track_num); + +/** Check a cue sheet to see if it conforms to the FLAC specification. + * See the format specification for limits on the contents of the + * cue sheet. + * + * \param object A pointer to an existing CUESHEET object. + * \param check_cd_da_subset If \c true, check CUESHEET against more + * stringent requirements for a CD-DA (audio) disc. + * \param violation Address of a pointer to a string. If there is a + * violation, a pointer to a string explanation of the + * violation will be returned here. \a violation may be + * \c NULL if you don't need the returned string. Do not + * free the returned string; it will always point to static + * data. + * \assert + * \code object != NULL \endcode + * \code object->type == FLAC__METADATA_TYPE_CUESHEET \endcode + * \retval FLAC__bool + * \c false if cue sheet is illegal, else \c true. + */ +FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_is_legal(const FLAC__StreamMetadata *object, FLAC__bool check_cd_da_subset, const char **violation); + +/* \} */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Libraries/FLAC/Files/include/FLAC/ordinals.h b/Libraries/FLAC/Files/include/FLAC/ordinals.h new file mode 100644 index 000000000..10bc25d5f --- /dev/null +++ b/Libraries/FLAC/Files/include/FLAC/ordinals.h @@ -0,0 +1,73 @@ +/* libFLAC - Free Lossless Audio Codec library + * Copyright (C) 2000,2001,2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef FLAC__ORDINALS_H +#define FLAC__ORDINALS_H + +#ifndef _MSC_VER +#include +#endif + +typedef signed char FLAC__int8; +typedef unsigned char FLAC__uint8; + +#if defined _MSC_VER +typedef __int16 FLAC__int16; +typedef __int32 FLAC__int32; +typedef __int64 FLAC__int64; +typedef unsigned __int16 FLAC__uint16; +typedef unsigned __int32 FLAC__uint32; +typedef unsigned __int64 FLAC__uint64; +#else +typedef int16_t FLAC__int16; +typedef int32_t FLAC__int32; +typedef int64_t FLAC__int64; +typedef uint16_t FLAC__uint16; +typedef uint32_t FLAC__uint32; +typedef uint64_t FLAC__uint64; +#endif + +typedef int FLAC__bool; + +typedef FLAC__uint8 FLAC__byte; + +#ifdef true +#undef true +#endif +#ifdef false +#undef false +#endif +#ifndef __cplusplus +#define true 1 +#define false 0 +#endif + +#endif diff --git a/Libraries/FLAC/Files/include/FLAC/seekable_stream_decoder.h b/Libraries/FLAC/Files/include/FLAC/seekable_stream_decoder.h new file mode 100644 index 000000000..dee5a89ce --- /dev/null +++ b/Libraries/FLAC/Files/include/FLAC/seekable_stream_decoder.h @@ -0,0 +1,931 @@ +/* libFLAC - Free Lossless Audio Codec library + * Copyright (C) 2000,2001,2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef FLAC__SEEKABLE_STREAM_DECODER_H +#define FLAC__SEEKABLE_STREAM_DECODER_H + +#include "export.h" +#include "stream_decoder.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +/** \file include/FLAC/seekable_stream_decoder.h + * + * \brief + * This module contains the functions which implement the seekable stream + * decoder. + * + * See the detailed documentation in the + * \link flac_seekable_stream_decoder seekable stream decoder \endlink module. + */ + +/** \defgroup flac_seekable_stream_decoder FLAC/seekable_stream_decoder.h: seekable stream decoder interface + * \ingroup flac_decoder + * + * \brief + * This module contains the functions which implement the seekable stream + * decoder. + * + * The basic usage of this decoder is as follows: + * - The program creates an instance of a decoder using + * FLAC__seekable_stream_decoder_new(). + * - The program overrides the default settings and sets callbacks for + * reading, writing, seeking, error reporting, and metadata reporting + * using FLAC__seekable_stream_decoder_set_*() functions. + * - The program initializes the instance to validate the settings and + * prepare for decoding using FLAC__seekable_stream_decoder_init(). + * - The program calls the FLAC__seekable_stream_decoder_process_*() + * functions to decode data, which subsequently calls the callbacks. + * - The program finishes the decoding with + * FLAC__seekable_stream_decoder_finish(), which flushes the input and + * output and resets the decoder to the uninitialized state. + * - The instance may be used again or deleted with + * FLAC__seekable_stream_decoder_delete(). + * + * The seekable stream decoder is a wrapper around the + * \link flac_stream_decoder stream decoder \endlink which also provides + * seeking capability. In addition to the Read/Write/Metadata/Error + * callbacks of the stream decoder, the user must also provide the following: + * + * - Seek callback - This function will be called when the decoder wants to + * seek to an absolute position in the stream. + * - Tell callback - This function will be called when the decoder wants to + * know the current absolute position of the stream. + * - Length callback - This function will be called when the decoder wants + * to know length of the stream. The seeking algorithm currently requires + * that the overall stream length be known. + * - EOF callback - This function will be called when the decoder wants to + * know if it is at the end of the stream. This could be synthesized from + * the tell and length callbacks but it may be more expensive that way, so + * there is a separate callback for it. + * + * Seeking is exposed through the + * FLAC__seekable_stream_decoder_seek_absolute() method. At any point after + * the seekable stream decoder has been initialized, the user can call this + * function to seek to an exact sample within the stream. Subsequently, the + * first time the write callback is called it will be passed a (possibly + * partial) block starting at that sample. + * + * The seekable stream decoder also provides MD5 signature checking. If + * this is turned on before initialization, + * FLAC__seekable_stream_decoder_finish() will report when the decoded MD5 + * signature does not match the one stored in the STREAMINFO block. MD5 + * checking is automatically turned off (until the next + * FLAC__seekable_stream_decoder_reset()) if there is no signature in the + * STREAMINFO block or when a seek is attempted. + * + * Make sure to read the detailed description of the + * \link flac_stream_decoder stream decoder module \endlink since the + * seekable stream decoder inherits much of its behavior. + * + * \note + * The "set" functions may only be called when the decoder is in the + * state FLAC__SEEKABLE_STREAM_DECODER_UNINITIALIZED, i.e. after + * FLAC__seekable_stream_decoder_new() or + * FLAC__seekable_stream_decoder_finish(), but before + * FLAC__seekable_stream_decoder_init(). If this is the case they will + * return \c true, otherwise \c false. + * + * \note + * FLAC__stream_decoder_finish() resets all settings to the constructor + * defaults, including the callbacks. + * + * \{ + */ + + +/** State values for a FLAC__SeekableStreamDecoder + * + * The decoder's state can be obtained by calling FLAC__seekable_stream_decoder_get_state(). + */ +typedef enum { + + FLAC__SEEKABLE_STREAM_DECODER_OK = 0, + /**< The decoder is in the normal OK state. */ + + FLAC__SEEKABLE_STREAM_DECODER_SEEKING, + /**< The decoder is in the process of seeking. */ + + FLAC__SEEKABLE_STREAM_DECODER_END_OF_STREAM, + /**< The decoder has reached the end of the stream. */ + + FLAC__SEEKABLE_STREAM_DECODER_MEMORY_ALLOCATION_ERROR, + /**< An error occurred allocating memory. */ + + FLAC__SEEKABLE_STREAM_DECODER_STREAM_DECODER_ERROR, + /**< An error occurred in the underlying stream decoder. */ + + FLAC__SEEKABLE_STREAM_DECODER_READ_ERROR, + /**< The read callback returned an error. */ + + FLAC__SEEKABLE_STREAM_DECODER_SEEK_ERROR, + /**< An error occurred while seeking or the seek or tell + * callback returned an error. + */ + + FLAC__SEEKABLE_STREAM_DECODER_ALREADY_INITIALIZED, + /**< FLAC__seekable_stream_decoder_init() was called when the + * decoder was already initialized, usually because + * FLAC__seekable_stream_decoder_finish() was not called. + */ + + FLAC__SEEKABLE_STREAM_DECODER_INVALID_CALLBACK, + /**< FLAC__seekable_stream_decoder_init() was called without all + * callbacks being set. + */ + + FLAC__SEEKABLE_STREAM_DECODER_UNINITIALIZED + /**< The decoder is in the uninitialized state. */ + +} FLAC__SeekableStreamDecoderState; + +/** Maps a FLAC__SeekableStreamDecoderState to a C string. + * + * Using a FLAC__SeekableStreamDecoderState as the index to this array + * will give the string equivalent. The contents should not be modified. + */ +extern FLAC_API const char * const FLAC__SeekableStreamDecoderStateString[]; + + +/** Return values for the FLAC__SeekableStreamDecoder read callback. + */ +typedef enum { + + FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_OK, + /**< The read was OK and decoding can continue. */ + + FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_ERROR + /**< An unrecoverable error occurred. The decoder will return from the process call. */ + +} FLAC__SeekableStreamDecoderReadStatus; + +/** Maps a FLAC__SeekableStreamDecoderReadStatus to a C string. + * + * Using a FLAC__SeekableStreamDecoderReadStatus as the index to this array + * will give the string equivalent. The contents should not be modified. + */ +extern FLAC_API const char * const FLAC__SeekableStreamDecoderReadStatusString[]; + + +/** Return values for the FLAC__SeekableStreamDecoder seek callback. + */ +typedef enum { + + FLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_OK, + /**< The seek was OK and decoding can continue. */ + + FLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_ERROR + /**< An unrecoverable error occurred. The decoder will return from the process call. */ + +} FLAC__SeekableStreamDecoderSeekStatus; + +/** Maps a FLAC__SeekableStreamDecoderSeekStatus to a C string. + * + * Using a FLAC__SeekableStreamDecoderSeekStatus as the index to this array + * will give the string equivalent. The contents should not be modified. + */ +extern FLAC_API const char * const FLAC__SeekableStreamDecoderSeekStatusString[]; + + +/** Return values for the FLAC__SeekableStreamDecoder tell callback. + */ +typedef enum { + + FLAC__SEEKABLE_STREAM_DECODER_TELL_STATUS_OK, + /**< The tell was OK and decoding can continue. */ + + FLAC__SEEKABLE_STREAM_DECODER_TELL_STATUS_ERROR + /**< An unrecoverable error occurred. The decoder will return from the process call. */ + +} FLAC__SeekableStreamDecoderTellStatus; + +/** Maps a FLAC__SeekableStreamDecoderTellStatus to a C string. + * + * Using a FLAC__SeekableStreamDecoderTellStatus as the index to this array + * will give the string equivalent. The contents should not be modified. + */ +extern FLAC_API const char * const FLAC__SeekableStreamDecoderTellStatusString[]; + + +/** Return values for the FLAC__SeekableStreamDecoder length callback. + */ +typedef enum { + + FLAC__SEEKABLE_STREAM_DECODER_LENGTH_STATUS_OK, + /**< The length call was OK and decoding can continue. */ + + FLAC__SEEKABLE_STREAM_DECODER_LENGTH_STATUS_ERROR + /**< An unrecoverable error occurred. The decoder will return from the process call. */ + +} FLAC__SeekableStreamDecoderLengthStatus; + +/** Maps a FLAC__SeekableStreamDecoderLengthStatus to a C string. + * + * Using a FLAC__SeekableStreamDecoderLengthStatus as the index to this array + * will give the string equivalent. The contents should not be modified. + */ +extern FLAC_API const char * const FLAC__SeekableStreamDecoderLengthStatusString[]; + + +/*********************************************************************** + * + * class FLAC__SeekableStreamDecoder : public FLAC__StreamDecoder + * + ***********************************************************************/ + +struct FLAC__SeekableStreamDecoderProtected; +struct FLAC__SeekableStreamDecoderPrivate; +/** The opaque structure definition for the seekable stream decoder type. + * See the + * \link flac_seekable_stream_decoder seekable stream decoder module \endlink + * for a detailed description. + */ +typedef struct { + struct FLAC__SeekableStreamDecoderProtected *protected_; /* avoid the C++ keyword 'protected' */ + struct FLAC__SeekableStreamDecoderPrivate *private_; /* avoid the C++ keyword 'private' */ +} FLAC__SeekableStreamDecoder; + +/** Signature for the read callback. + * See FLAC__seekable_stream_decoder_set_read_callback() + * and FLAC__StreamDecoderReadCallback for more info. + * + * \param decoder The decoder instance calling the callback. + * \param buffer A pointer to a location for the callee to store + * data to be decoded. + * \param bytes A pointer to the size of the buffer. + * \param client_data The callee's client data set through + * FLAC__seekable_stream_decoder_set_client_data(). + * \retval FLAC__SeekableStreamDecoderReadStatus + * The callee's return status. + */ +typedef FLAC__SeekableStreamDecoderReadStatus (*FLAC__SeekableStreamDecoderReadCallback)(const FLAC__SeekableStreamDecoder *decoder, FLAC__byte buffer[], unsigned *bytes, void *client_data); + +/** Signature for the seek callback. + * See FLAC__seekable_stream_decoder_set_seek_callback() for more info. + * + * \param decoder The decoder instance calling the callback. + * \param absolute_byte_offset The offset from the beginning of the stream + * to seek to. + * \param client_data The callee's client data set through + * FLAC__seekable_stream_decoder_set_client_data(). + * \retval FLAC__SeekableStreamDecoderSeekStatus + * The callee's return status. + */ +typedef FLAC__SeekableStreamDecoderSeekStatus (*FLAC__SeekableStreamDecoderSeekCallback)(const FLAC__SeekableStreamDecoder *decoder, FLAC__uint64 absolute_byte_offset, void *client_data); + +/** Signature for the tell callback. + * See FLAC__seekable_stream_decoder_set_tell_callback() for more info. + * + * \param decoder The decoder instance calling the callback. + * \param absolute_byte_offset A pointer to storage for the current offset + * from the beginning of the stream. + * \param client_data The callee's client data set through + * FLAC__seekable_stream_decoder_set_client_data(). + * \retval FLAC__SeekableStreamDecoderTellStatus + * The callee's return status. + */ +typedef FLAC__SeekableStreamDecoderTellStatus (*FLAC__SeekableStreamDecoderTellCallback)(const FLAC__SeekableStreamDecoder *decoder, FLAC__uint64 *absolute_byte_offset, void *client_data); + +/** Signature for the length callback. + * See FLAC__seekable_stream_decoder_set_length_callback() for more info. + * + * \param decoder The decoder instance calling the callback. + * \param stream_length A pointer to storage for the length of the stream + * in bytes. + * \param client_data The callee's client data set through + * FLAC__seekable_stream_decoder_set_client_data(). + * \retval FLAC__SeekableStreamDecoderLengthStatus + * The callee's return status. + */ +typedef FLAC__SeekableStreamDecoderLengthStatus (*FLAC__SeekableStreamDecoderLengthCallback)(const FLAC__SeekableStreamDecoder *decoder, FLAC__uint64 *stream_length, void *client_data); + +/** Signature for the EOF callback. + * See FLAC__seekable_stream_decoder_set_eof_callback() for more info. + * + * \param decoder The decoder instance calling the callback. + * \param client_data The callee's client data set through + * FLAC__seekable_stream_decoder_set_client_data(). + * \retval FLAC__bool + * \c true if the currently at the end of the stream, else \c false. + */ +typedef FLAC__bool (*FLAC__SeekableStreamDecoderEofCallback)(const FLAC__SeekableStreamDecoder *decoder, void *client_data); + +/** Signature for the write callback. + * See FLAC__seekable_stream_decoder_set_write_callback() + * and FLAC__StreamDecoderWriteCallback for more info. + * + * \param decoder The decoder instance calling the callback. + * \param frame The description of the decoded frame. + * \param buffer An array of pointers to decoded channels of data. + * \param client_data The callee's client data set through + * FLAC__seekable_stream_decoder_set_client_data(). + * \retval FLAC__StreamDecoderWriteStatus + * The callee's return status. + */ +typedef FLAC__StreamDecoderWriteStatus (*FLAC__SeekableStreamDecoderWriteCallback)(const FLAC__SeekableStreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data); + +/** Signature for the metadata callback. + * See FLAC__seekable_stream_decoder_set_metadata_callback() + * and FLAC__StreamDecoderMetadataCallback for more info. + * + * \param decoder The decoder instance calling the callback. + * \param metadata The decoded metadata block. + * \param client_data The callee's client data set through + * FLAC__seekable_stream_decoder_set_client_data(). + */ +typedef void (*FLAC__SeekableStreamDecoderMetadataCallback)(const FLAC__SeekableStreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data); + +/** Signature for the error callback. + * See FLAC__seekable_stream_decoder_set_error_callback() + * and FLAC__StreamDecoderErrorCallback for more info. + * + * \param decoder The decoder instance calling the callback. + * \param status The error encountered by the decoder. + * \param client_data The callee's client data set through + * FLAC__seekable_stream_decoder_set_client_data(). + */ +typedef void (*FLAC__SeekableStreamDecoderErrorCallback)(const FLAC__SeekableStreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data); + + +/*********************************************************************** + * + * Class constructor/destructor + * + ***********************************************************************/ + +/** Create a new seekable stream decoder instance. The instance is created + * with default settings; see the individual + * FLAC__seekable_stream_decoder_set_*() functions for each setting's + * default. + * + * \retval FLAC__SeekableStreamDecoder* + * \c NULL if there was an error allocating memory, else the new instance. + */ +FLAC_API FLAC__SeekableStreamDecoder *FLAC__seekable_stream_decoder_new(); + +/** Free a decoder instance. Deletes the object pointed to by \a decoder. + * + * \param decoder A pointer to an existing decoder. + * \assert + * \code decoder != NULL \endcode + */ +FLAC_API void FLAC__seekable_stream_decoder_delete(FLAC__SeekableStreamDecoder *decoder); + + +/*********************************************************************** + * + * Public class method prototypes + * + ***********************************************************************/ + +/** Set the "MD5 signature checking" flag. If \c true, the decoder will + * compute the MD5 signature of the unencoded audio data while decoding + * and compare it to the signature from the STREAMINFO block, if it + * exists, during FLAC__seekable_stream_decoder_finish(). + * + * MD5 signature checking will be turned off (until the next + * FLAC__seekable_stream_decoder_reset()) if there is no signature in + * the STREAMINFO block or when a seek is attempted. + * + * \default \c false + * \param decoder A decoder instance to set. + * \param value Flag value (see above). + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__seekable_stream_decoder_set_md5_checking(FLAC__SeekableStreamDecoder *decoder, FLAC__bool value); + +/** Set the read callback. + * This is inherited from FLAC__StreamDecoder; see + * FLAC__stream_decoder_set_read_callback(). + * + * \note + * The callback is mandatory and must be set before initialization. + * + * \default \c NULL + * \param decoder A decoder instance to set. + * \param value See above. + * \assert + * \code decoder != NULL \endcode + * \code value != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__seekable_stream_decoder_set_read_callback(FLAC__SeekableStreamDecoder *decoder, FLAC__SeekableStreamDecoderReadCallback value); + +/** Set the seek callback. + * The supplied function will be called when the decoder needs to seek + * the input stream. The decoder will pass the absolute byte offset + * to seek to, 0 meaning the beginning of the stream. + * + * \note + * The callback is mandatory and must be set before initialization. + * + * \default \c NULL + * \param decoder A decoder instance to set. + * \param value See above. + * \assert + * \code decoder != NULL \endcode + * \code value != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__seekable_stream_decoder_set_seek_callback(FLAC__SeekableStreamDecoder *decoder, FLAC__SeekableStreamDecoderSeekCallback value); + +/** Set the tell callback. + * The supplied function will be called when the decoder wants to know + * the current position of the stream. The callback should return the + * byte offset from the beginning of the stream. + * + * \note + * The callback is mandatory and must be set before initialization. + * + * \default \c NULL + * \param decoder A decoder instance to set. + * \param value See above. + * \assert + * \code decoder != NULL \endcode + * \code value != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__seekable_stream_decoder_set_tell_callback(FLAC__SeekableStreamDecoder *decoder, FLAC__SeekableStreamDecoderTellCallback value); + +/** Set the length callback. + * The supplied function will be called when the decoder wants to know + * the total length of the stream in bytes. + * + * \note + * The callback is mandatory and must be set before initialization. + * + * \default \c NULL + * \param decoder A decoder instance to set. + * \param value See above. + * \assert + * \code decoder != NULL \endcode + * \code value != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__seekable_stream_decoder_set_length_callback(FLAC__SeekableStreamDecoder *decoder, FLAC__SeekableStreamDecoderLengthCallback value); + +/** Set the eof callback. + * The supplied function will be called when the decoder needs to know + * if the end of the stream has been reached. + * + * \note + * The callback is mandatory and must be set before initialization. + * + * \default \c NULL + * \param decoder A decoder instance to set. + * \param value See above. + * \assert + * \code decoder != NULL \endcode + * \code value != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__seekable_stream_decoder_set_eof_callback(FLAC__SeekableStreamDecoder *decoder, FLAC__SeekableStreamDecoderEofCallback value); + +/** Set the write callback. + * This is inherited from FLAC__StreamDecoder; see + * FLAC__stream_decoder_set_write_callback(). + * + * \note + * The callback is mandatory and must be set before initialization. + * + * \default \c NULL + * \param decoder A decoder instance to set. + * \param value See above. + * \assert + * \code decoder != NULL \endcode + * \code value != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__seekable_stream_decoder_set_write_callback(FLAC__SeekableStreamDecoder *decoder, FLAC__SeekableStreamDecoderWriteCallback value); + +/** Set the metadata callback. + * This is inherited from FLAC__StreamDecoder; see + * FLAC__stream_decoder_set_metadata_callback(). + * + * \note + * The callback is mandatory and must be set before initialization. + * + * \default \c NULL + * \param decoder A decoder instance to set. + * \param value See above. + * \assert + * \code decoder != NULL \endcode + * \code value != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__seekable_stream_decoder_set_metadata_callback(FLAC__SeekableStreamDecoder *decoder, FLAC__SeekableStreamDecoderMetadataCallback value); + +/** Set the error callback. + * This is inherited from FLAC__StreamDecoder; see + * FLAC__stream_decoder_set_error_callback(). + * + * \note + * The callback is mandatory and must be set before initialization. + * + * \default \c NULL + * \param decoder A decoder instance to set. + * \param value See above. + * \assert + * \code decoder != NULL \endcode + * \code value != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__seekable_stream_decoder_set_error_callback(FLAC__SeekableStreamDecoder *decoder, FLAC__SeekableStreamDecoderErrorCallback value); + +/** Set the client data to be passed back to callbacks. + * This value will be supplied to callbacks in their \a client_data + * argument. + * + * \default \c NULL + * \param decoder A decoder instance to set. + * \param value See above. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__seekable_stream_decoder_set_client_data(FLAC__SeekableStreamDecoder *decoder, void *value); + +/** This is inherited from FLAC__StreamDecoder; see + * FLAC__stream_decoder_set_metadata_respond(). + * + * \default By default, only the \c STREAMINFO block is returned via the + * metadata callback. + * \param decoder A decoder instance to set. + * \param type See above. + * \assert + * \code decoder != NULL \endcode + * \a type is valid + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__seekable_stream_decoder_set_metadata_respond(FLAC__SeekableStreamDecoder *decoder, FLAC__MetadataType type); + +/** This is inherited from FLAC__StreamDecoder; see + * FLAC__stream_decoder_set_metadata_respond_application(). + * + * \default By default, only the \c STREAMINFO block is returned via the + * metadata callback. + * \param decoder A decoder instance to set. + * \param id See above. + * \assert + * \code decoder != NULL \endcode + * \code id != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__seekable_stream_decoder_set_metadata_respond_application(FLAC__SeekableStreamDecoder *decoder, const FLAC__byte id[4]); + +/** This is inherited from FLAC__StreamDecoder; see + * FLAC__stream_decoder_set_metadata_respond_all(). + * + * \default By default, only the \c STREAMINFO block is returned via the + * metadata callback. + * \param decoder A decoder instance to set. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__seekable_stream_decoder_set_metadata_respond_all(FLAC__SeekableStreamDecoder *decoder); + +/** This is inherited from FLAC__StreamDecoder; see + * FLAC__stream_decoder_set_metadata_ignore(). + * + * \default By default, only the \c STREAMINFO block is returned via the + * metadata callback. + * \param decoder A decoder instance to set. + * \param type See above. + * \assert + * \code decoder != NULL \endcode + * \a type is valid + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__seekable_stream_decoder_set_metadata_ignore(FLAC__SeekableStreamDecoder *decoder, FLAC__MetadataType type); + +/** This is inherited from FLAC__StreamDecoder; see + * FLAC__stream_decoder_set_metadata_ignore_application(). + * + * \default By default, only the \c STREAMINFO block is returned via the + * metadata callback. + * \param decoder A decoder instance to set. + * \param id See above. + * \assert + * \code decoder != NULL \endcode + * \code id != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__seekable_stream_decoder_set_metadata_ignore_application(FLAC__SeekableStreamDecoder *decoder, const FLAC__byte id[4]); + +/** This is inherited from FLAC__StreamDecoder; see + * FLAC__stream_decoder_set_metadata_ignore_all(). + * + * \default By default, only the \c STREAMINFO block is returned via the + * metadata callback. + * \param decoder A decoder instance to set. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__seekable_stream_decoder_set_metadata_ignore_all(FLAC__SeekableStreamDecoder *decoder); + +/** Get the current decoder state. + * + * \param decoder A decoder instance to query. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__SeekableStreamDecoderState + * The current decoder state. + */ +FLAC_API FLAC__SeekableStreamDecoderState FLAC__seekable_stream_decoder_get_state(const FLAC__SeekableStreamDecoder *decoder); + +/** Get the state of the underlying stream decoder. + * Useful when the seekable stream decoder state is + * \c FLAC__SEEKABLE_STREAM_DECODER_STREAM_DECODER_ERROR. + * + * \param decoder A decoder instance to query. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__StreamDecoderState + * The stream decoder state. + */ +FLAC_API FLAC__StreamDecoderState FLAC__seekable_stream_decoder_get_stream_decoder_state(const FLAC__SeekableStreamDecoder *decoder); + +/** Get the current decoder state as a C string. + * This version automatically resolves + * \c FLAC__SEEKABLE_STREAM_DECODER_STREAM_DECODER_ERROR by getting the + * stream decoder's state. + * + * \param decoder A decoder instance to query. + * \assert + * \code decoder != NULL \endcode + * \retval const char * + * The decoder state as a C string. Do not modify the contents. + */ +FLAC_API const char *FLAC__seekable_stream_decoder_get_resolved_state_string(const FLAC__SeekableStreamDecoder *decoder); + +/** Get the "MD5 signature checking" flag. + * This is the value of the setting, not whether or not the decoder is + * currently checking the MD5 (remember, it can be turned off automatically + * by a seek). When the decoder is reset the flag will be restored to the + * value returned by this function. + * + * \param decoder A decoder instance to query. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * See above. + */ +FLAC_API FLAC__bool FLAC__seekable_stream_decoder_get_md5_checking(const FLAC__SeekableStreamDecoder *decoder); + +/** This is inherited from FLAC__StreamDecoder; see + * FLAC__stream_decoder_get_channels(). + * + * \param decoder A decoder instance to query. + * \assert + * \code decoder != NULL \endcode + * \retval unsigned + * See above. + */ +FLAC_API unsigned FLAC__seekable_stream_decoder_get_channels(const FLAC__SeekableStreamDecoder *decoder); + +/** This is inherited from FLAC__StreamDecoder; see + * FLAC__stream_decoder_get_channel_assignment(). + * + * \param decoder A decoder instance to query. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__ChannelAssignment + * See above. + */ +FLAC_API FLAC__ChannelAssignment FLAC__seekable_stream_decoder_get_channel_assignment(const FLAC__SeekableStreamDecoder *decoder); + +/** This is inherited from FLAC__StreamDecoder; see + * FLAC__stream_decoder_get_bits_per_sample(). + * + * \param decoder A decoder instance to query. + * \assert + * \code decoder != NULL \endcode + * \retval unsigned + * See above. + */ +FLAC_API unsigned FLAC__seekable_stream_decoder_get_bits_per_sample(const FLAC__SeekableStreamDecoder *decoder); + +/** This is inherited from FLAC__StreamDecoder; see + * FLAC__stream_decoder_get_sample_rate(). + * + * \param decoder A decoder instance to query. + * \assert + * \code decoder != NULL \endcode + * \retval unsigned + * See above. + */ +FLAC_API unsigned FLAC__seekable_stream_decoder_get_sample_rate(const FLAC__SeekableStreamDecoder *decoder); + +/** This is inherited from FLAC__StreamDecoder; see + * FLAC__stream_decoder_get_blocksize(). + * + * \param decoder A decoder instance to query. + * \assert + * \code decoder != NULL \endcode + * \retval unsigned + * See above. + */ +FLAC_API unsigned FLAC__seekable_stream_decoder_get_blocksize(const FLAC__SeekableStreamDecoder *decoder); + +/** Returns the decoder's current read position within the stream. + * The position is the byte offset from the start of the stream. + * Bytes before this position have been fully decoded. Note that + * there may still be undecoded bytes in the decoder's read FIFO. + * The returned position is correct even after a seek. + * + * \param decoder A decoder instance to query. + * \param position Address at which to return the desired position. + * \assert + * \code decoder != NULL \endcode + * \code position != NULL \endcode + * \retval FLAC__bool + * \c true if successful, \c false if there was an error from + * the 'tell' callback. + */ +FLAC_API FLAC__bool FLAC__seekable_stream_decoder_get_decode_position(const FLAC__SeekableStreamDecoder *decoder, FLAC__uint64 *position); + +/** Initialize the decoder instance. + * Should be called after FLAC__seekable_stream_decoder_new() and + * FLAC__seekable_stream_decoder_set_*() but before any of the + * FLAC__seekable_stream_decoder_process_*() functions. Will set and return + * the decoder state, which will be FLAC__SEEKABLE_STREAM_DECODER_OK + * if initialization succeeded. + * + * \param decoder An uninitialized decoder instance. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__SeekableStreamDecoderState + * \c FLAC__SEEKABLE_STREAM_DECODER_OK if initialization was + * successful; see FLAC__SeekableStreamDecoderState for the meanings + * of other return values. + */ +FLAC_API FLAC__SeekableStreamDecoderState FLAC__seekable_stream_decoder_init(FLAC__SeekableStreamDecoder *decoder); + +/** Finish the decoding process. + * Flushes the decoding buffer, releases resources, resets the decoder + * settings to their defaults, and returns the decoder state to + * FLAC__SEEKABLE_STREAM_DECODER_UNINITIALIZED. + * + * In the event of a prematurely-terminated decode, it is not strictly + * necessary to call this immediately before + * FLAC__seekable_stream_decoder_delete() but it is good practice to match + * every FLAC__seekable_stream_decoder_init() with a + * FLAC__seekable_stream_decoder_finish(). + * + * \param decoder An uninitialized decoder instance. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * \c false if MD5 checking is on AND a STREAMINFO block was available + * AND the MD5 signature in the STREAMINFO block was non-zero AND the + * signature does not match the one computed by the decoder; else + * \c true. + */ +FLAC_API FLAC__bool FLAC__seekable_stream_decoder_finish(FLAC__SeekableStreamDecoder *decoder); + +/** Flush the stream input. + * The decoder's input buffer will be cleared and the state set to + * \c FLAC__SEEKABLE_STREAM_DECODER_OK. This will also turn off MD5 + * checking. + * + * \param decoder A decoder instance. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * \c true if successful, else \c false if a memory allocation + * or stream decoder error occurs. + */ +FLAC_API FLAC__bool FLAC__seekable_stream_decoder_flush(FLAC__SeekableStreamDecoder *decoder); + +/** Reset the decoding process. + * The decoder's input buffer will be cleared and the state set to + * \c FLAC__SEEKABLE_STREAM_DECODER_OK. This is similar to + * FLAC__seekable_stream_decoder_finish() except that the settings are + * preserved; there is no need to call FLAC__seekable_stream_decoder_init() + * before decoding again. MD5 checking will be restored to its original + * setting. + * + * \param decoder A decoder instance. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * \c true if successful, else \c false if a memory allocation + * or stream decoder error occurs. + */ +FLAC_API FLAC__bool FLAC__seekable_stream_decoder_reset(FLAC__SeekableStreamDecoder *decoder); + +/** This is inherited from FLAC__StreamDecoder; see + * FLAC__stream_decoder_process_single(). + * + * \param decoder A decoder instance. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * See above. + */ +FLAC_API FLAC__bool FLAC__seekable_stream_decoder_process_single(FLAC__SeekableStreamDecoder *decoder); + +/** This is inherited from FLAC__StreamDecoder; see + * FLAC__stream_decoder_process_until_end_of_metadata(). + * + * \param decoder A decoder instance. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * See above. + */ +FLAC_API FLAC__bool FLAC__seekable_stream_decoder_process_until_end_of_metadata(FLAC__SeekableStreamDecoder *decoder); + +/** This is inherited from FLAC__StreamDecoder; see + * FLAC__stream_decoder_process_until_end_of_stream(). + * + * \param decoder A decoder instance. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * See above. + */ +FLAC_API FLAC__bool FLAC__seekable_stream_decoder_process_until_end_of_stream(FLAC__SeekableStreamDecoder *decoder); + +/** This is inherited from FLAC__StreamDecoder; see + * FLAC__stream_decoder_skip_single_frame(). + * + * \param decoder A decoder instance. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * See above. + */ +FLAC_API FLAC__bool FLAC__seekable_stream_decoder_skip_single_frame(FLAC__SeekableStreamDecoder *decoder); + +/** Flush the input and seek to an absolute sample. + * Decoding will resume at the given sample. Note that because of + * this, the next write callback may contain a partial block. + * + * \param decoder A decoder instance. + * \param sample The target sample number to seek to. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * \c true if successful, else \c false. + */ +FLAC_API FLAC__bool FLAC__seekable_stream_decoder_seek_absolute(FLAC__SeekableStreamDecoder *decoder, FLAC__uint64 sample); + +/* \} */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Libraries/FLAC/Files/include/FLAC/seekable_stream_encoder.h b/Libraries/FLAC/Files/include/FLAC/seekable_stream_encoder.h new file mode 100644 index 000000000..4efeb427b --- /dev/null +++ b/Libraries/FLAC/Files/include/FLAC/seekable_stream_encoder.h @@ -0,0 +1,992 @@ +/* libFLAC - Free Lossless Audio Codec library + * Copyright (C) 2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef FLAC__SEEKABLE_STREAM_ENCODER_H +#define FLAC__SEEKABLE_STREAM_ENCODER_H + +#include "export.h" +#include "stream_encoder.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +/** \file include/FLAC/seekable_stream_encoder.h + * + * \brief + * This module contains the functions which implement the seekable stream + * encoder. + * + * See the detailed documentation in the + * \link flac_seekable_stream_encoder seekable stream encoder \endlink module. + */ + +/** \defgroup flac_seekable_stream_encoder FLAC/seekable_stream_encoder.h: seekable stream encoder interface + * \ingroup flac_encoder + * + * \brief + * This module contains the functions which implement the seekable stream + * encoder. + * + * The basic usage of this encoder is as follows: + * - The program creates an instance of an encoder using + * FLAC__seekable_stream_encoder_new(). + * - The program overrides the default settings and sets callbacks using + * FLAC__seekable_stream_encoder_set_*() functions. + * - The program initializes the instance to validate the settings and + * prepare for encoding using FLAC__seekable_stream_encoder_init(). + * - The program calls FLAC__seekable_stream_encoder_process() or + * FLAC__seekable_stream_encoder_process_interleaved() to encode data, which + * subsequently calls the callbacks when there is encoder data ready + * to be written. + * - The program finishes the encoding with FLAC__seekable_stream_encoder_finish(), + * which causes the encoder to encode any data still in its input pipe, + * rewrite the metadata with the final encoding statistics, and finally + * reset the encoder to the uninitialized state. + * - The instance may be used again or deleted with + * FLAC__seekable_stream_encoder_delete(). + * + * The seekable stream encoder is a wrapper around the + * \link flac_stream_encoder stream encoder \endlink with callbacks for + * seeking the output and reporting the output stream position. This + * allows the encoder to go back and rewrite some of the metadata after + * encoding if necessary, and provides the metadata callback of the stream + * encoder internally. However, you must provide seek and tell callbacks + * (see FLAC__seekable_stream_encoder_set_seek_callback() and + * FLAC__seekable_stream_encoder_set_tell_callback()). + * + * Make sure to read the detailed description of the + * \link flac_stream_encoder stream encoder module \endlink since the + * seekable stream encoder inherits much of its behavior. + * + * \note + * If you are writing the FLAC data to a file, make sure it is open + * for update (e.g. mode "w+" for stdio streams). This is because after + * the first encoding pass, the encoder will try to seek back to the + * beginning of the stream, to the STREAMINFO block, to write some data + * there. + * + * \note + * The "set" functions may only be called when the encoder is in the + * state FLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED, i.e. after + * FLAC__seekable_stream_encoder_new() or FLAC__seekable_stream_encoder_finish(), but + * before FLAC__seekable_stream_encoder_init(). If this is the case they will + * return \c true, otherwise \c false. + * + * \note + * FLAC__seekable_stream_encoder_finish() resets all settings to the constructor + * defaults, including the callbacks. + * + * \{ + */ + + +/** State values for a FLAC__SeekableStreamEncoder + * + * The encoder's state can be obtained by calling FLAC__seekable_stream_encoder_get_state(). + */ +typedef enum { + + FLAC__SEEKABLE_STREAM_ENCODER_OK = 0, + /**< The encoder is in the normal OK state. */ + + FLAC__SEEKABLE_STREAM_ENCODER_STREAM_ENCODER_ERROR, + /**< An error occurred in the underlying stream encoder; + * check FLAC__seekable_stream_encoder_get_stream_encoder_state(). + */ + + FLAC__SEEKABLE_STREAM_ENCODER_MEMORY_ALLOCATION_ERROR, + /**< Memory allocation failed. */ + + FLAC__SEEKABLE_STREAM_ENCODER_WRITE_ERROR, + /**< The write callback returned an error. */ + + FLAC__SEEKABLE_STREAM_ENCODER_READ_ERROR, + /**< The read callback returned an error. */ + + FLAC__SEEKABLE_STREAM_ENCODER_SEEK_ERROR, + /**< The seek callback returned an error. */ + + FLAC__SEEKABLE_STREAM_ENCODER_TELL_ERROR, + /**< The tell callback returned an error. */ + + FLAC__SEEKABLE_STREAM_ENCODER_ALREADY_INITIALIZED, + /**< FLAC__seekable_stream_encoder_init() was called when the encoder was + * already initialized, usually because + * FLAC__seekable_stream_encoder_finish() was not called. + */ + + FLAC__SEEKABLE_STREAM_ENCODER_INVALID_CALLBACK, + /**< FLAC__seekable_stream_encoder_init() was called without all + * callbacks being set. + */ + + FLAC__SEEKABLE_STREAM_ENCODER_INVALID_SEEKTABLE, + /**< An invalid seek table was passed is the metadata to + * FLAC__seekable_stream_encoder_set_metadata(). + */ + + FLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED + /**< The encoder is in the uninitialized state. */ + +} FLAC__SeekableStreamEncoderState; + +/** Maps a FLAC__SeekableStreamEncoderState to a C string. + * + * Using a FLAC__SeekableStreamEncoderState as the index to this array + * will give the string equivalent. The contents should not be modified. + */ +extern FLAC_API const char * const FLAC__SeekableStreamEncoderStateString[]; + + +/** Return values for the FLAC__SeekableStreamEncoder seek callback. + */ +typedef enum { + + FLAC__SEEKABLE_STREAM_ENCODER_SEEK_STATUS_OK, + /**< The seek was OK and encoding can continue. */ + + FLAC__SEEKABLE_STREAM_ENCODER_SEEK_STATUS_ERROR + /**< An unrecoverable error occurred. The encoder will return from the process call. */ + +} FLAC__SeekableStreamEncoderSeekStatus; + +/** Maps a FLAC__SeekableStreamEncoderSeekStatus to a C string. + * + * Using a FLAC__SeekableStreamEncoderSeekStatus as the index to this array + * will give the string equivalent. The contents should not be modified. + */ +extern FLAC_API const char * const FLAC__SeekableStreamEncoderSeekStatusString[]; + + +/** Return values for the FLAC__SeekableStreamEncoder tell callback. + */ +typedef enum { + + FLAC__SEEKABLE_STREAM_ENCODER_TELL_STATUS_OK, + /**< The tell was OK and encoding can continue. */ + + FLAC__SEEKABLE_STREAM_ENCODER_TELL_STATUS_ERROR + /**< An unrecoverable error occurred. The encoder will return from the process call. */ + +} FLAC__SeekableStreamEncoderTellStatus; + +/** Maps a FLAC__SeekableStreamEncoderTellStatus to a C string. + * + * Using a FLAC__SeekableStreamEncoderTellStatus as the index to this array + * will give the string equivalent. The contents should not be modified. + */ +extern FLAC_API const char * const FLAC__SeekableStreamEncoderTellStatusString[]; + + +/*********************************************************************** + * + * class FLAC__SeekableStreamEncoder + * + ***********************************************************************/ + +struct FLAC__SeekableStreamEncoderProtected; +struct FLAC__SeekableStreamEncoderPrivate; +/** The opaque structure definition for the seekable stream encoder type. + * See the \link flac_seekable_stream_encoder seekable stream encoder module \endlink + * for a detailed description. + */ +typedef struct { + struct FLAC__SeekableStreamEncoderProtected *protected_; /* avoid the C++ keyword 'protected' */ + struct FLAC__SeekableStreamEncoderPrivate *private_; /* avoid the C++ keyword 'private' */ +} FLAC__SeekableStreamEncoder; + +/** Signature for the seek callback. + * See FLAC__seekable_stream_encoder_set_seek_callback() for more info. + * + * \param encoder The encoder instance calling the callback. + * \param absolute_byte_offset The offset from the beginning of the stream + * to seek to. + * \param client_data The callee's client data set through + * FLAC__seekable_stream_encoder_set_client_data(). + * \retval FLAC__SeekableStreamEncoderSeekStatus + * The callee's return status. + */ +typedef FLAC__SeekableStreamEncoderSeekStatus (*FLAC__SeekableStreamEncoderSeekCallback)(const FLAC__SeekableStreamEncoder *encoder, FLAC__uint64 absolute_byte_offset, void *client_data); + +/** Signature for the tell callback. + * See FLAC__seekable_stream_encoder_set_tell_callback() for more info. + * + * \warning + * The callback must return the true current byte offset of the output to + * which the encoder is writing. If you are buffering the output, make + * sure and take this into account. If you are writing directly to a + * FILE* from your write callback, ftell() is sufficient. If you are + * writing directly to a file descriptor from your write callback, you + * can use lseek(fd, SEEK_CUR, 0). The encoder may later seek back to + * these points to rewrite metadata after encoding. + * + * \param encoder The encoder instance calling the callback. + * \param absolute_byte_offset The address at which to store the current + * position of the output. + * \param client_data The callee's client data set through + * FLAC__seekable_stream_encoder_set_client_data(). + * \retval FLAC__SeekableStreamEncoderTellStatus + * The callee's return status. + */ +typedef FLAC__SeekableStreamEncoderTellStatus (*FLAC__SeekableStreamEncoderTellCallback)(const FLAC__SeekableStreamEncoder *encoder, FLAC__uint64 *absolute_byte_offset, void *client_data); + +/** Signature for the write callback. + * See FLAC__seekable_stream_encoder_set_write_callback() + * and FLAC__StreamEncoderWriteCallback for more info. + * + * \param encoder The encoder instance calling the callback. + * \param buffer An array of encoded data of length \a bytes. + * \param bytes The byte length of \a buffer. + * \param samples The number of samples encoded by \a buffer. + * \c 0 has a special meaning; see + * FLAC__stream_encoder_set_write_callback(). + * \param current_frame The number of current frame being encoded. + * \param client_data The callee's client data set through + * FLAC__seekable_stream_encoder_set_client_data(). + * \retval FLAC__StreamEncoderWriteStatus + * The callee's return status. + */ +typedef FLAC__StreamEncoderWriteStatus (*FLAC__SeekableStreamEncoderWriteCallback)(const FLAC__SeekableStreamEncoder *encoder, const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame, void *client_data); + + +/*********************************************************************** + * + * Class constructor/destructor + * + ***********************************************************************/ + +/** Create a new seekable stream encoder instance. The instance is created with + * default settings; see the individual FLAC__seekable_stream_encoder_set_*() + * functions for each setting's default. + * + * \retval FLAC__SeekableStreamEncoder* + * \c NULL if there was an error allocating memory, else the new instance. + */ +FLAC_API FLAC__SeekableStreamEncoder *FLAC__seekable_stream_encoder_new(); + +/** Free an encoder instance. Deletes the object pointed to by \a encoder. + * + * \param encoder A pointer to an existing encoder. + * \assert + * \code encoder != NULL \endcode + */ +FLAC_API void FLAC__seekable_stream_encoder_delete(FLAC__SeekableStreamEncoder *encoder); + +/*********************************************************************** + * + * Public class method prototypes + * + ***********************************************************************/ + +/** This is inherited from FLAC__StreamEncoder; see + * FLAC__stream_encoder_set_verify(). + * + * \default \c true + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__seekable_stream_encoder_set_verify(FLAC__SeekableStreamEncoder *encoder, FLAC__bool value); + +/** This is inherited from FLAC__StreamEncoder; see + * FLAC__stream_encoder_set_streamable_subset(). + * + * \default \c true + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__seekable_stream_encoder_set_streamable_subset(FLAC__SeekableStreamEncoder *encoder, FLAC__bool value); + +/** This is inherited from FLAC__StreamEncoder; see + * FLAC__stream_encoder_set_do_mid_side_stereo(). + * + * \default \c false + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__seekable_stream_encoder_set_do_mid_side_stereo(FLAC__SeekableStreamEncoder *encoder, FLAC__bool value); + +/** This is inherited from FLAC__StreamEncoder; see + * FLAC__stream_encoder_set_loose_mid_side_stereo(). + * + * \default \c false + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__seekable_stream_encoder_set_loose_mid_side_stereo(FLAC__SeekableStreamEncoder *encoder, FLAC__bool value); + +/** This is inherited from FLAC__StreamEncoder; see + * FLAC__stream_encoder_set_channels(). + * + * \default \c 2 + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__seekable_stream_encoder_set_channels(FLAC__SeekableStreamEncoder *encoder, unsigned value); + +/** This is inherited from FLAC__StreamEncoder; see + * FLAC__stream_encoder_set_bits_per_sample(). + * + * \warning + * Do not feed the encoder data that is wider than the value you + * set here or you will generate an invalid stream. + * + * \default \c 16 + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__seekable_stream_encoder_set_bits_per_sample(FLAC__SeekableStreamEncoder *encoder, unsigned value); + +/** This is inherited from FLAC__StreamEncoder; see + * FLAC__stream_encoder_set_sample_rate(). + * + * \default \c 44100 + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__seekable_stream_encoder_set_sample_rate(FLAC__SeekableStreamEncoder *encoder, unsigned value); + +/** This is inherited from FLAC__StreamEncoder; see + * FLAC__stream_encoder_set_blocksize(). + * + * \default \c 1152 + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__seekable_stream_encoder_set_blocksize(FLAC__SeekableStreamEncoder *encoder, unsigned value); + +/** This is inherited from FLAC__StreamEncoder; see + * FLAC__stream_encoder_set_max_lpc_order(). + * + * \default \c 0 + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__seekable_stream_encoder_set_max_lpc_order(FLAC__SeekableStreamEncoder *encoder, unsigned value); + +/** This is inherited from FLAC__StreamEncoder; see + * FLAC__stream_encoder_set_qlp_coeff_precision(). + * + * \note + * In the current implementation, qlp_coeff_precision + bits_per_sample must + * be less than 32. + * + * \default \c 0 + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__seekable_stream_encoder_set_qlp_coeff_precision(FLAC__SeekableStreamEncoder *encoder, unsigned value); + +/** This is inherited from FLAC__StreamEncoder; see + * FLAC__stream_encoder_set_do_qlp_coeff_prec_search(). + * + * \default \c false + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__seekable_stream_encoder_set_do_qlp_coeff_prec_search(FLAC__SeekableStreamEncoder *encoder, FLAC__bool value); + +/** This is inherited from FLAC__StreamEncoder; see + * FLAC__stream_encoder_set_do_escape_coding(). + * + * \default \c false + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__seekable_stream_encoder_set_do_escape_coding(FLAC__SeekableStreamEncoder *encoder, FLAC__bool value); + +/** This is inherited from FLAC__StreamEncoder; see + * FLAC__stream_encoder_set_do_exhaustive_model_search(). + * + * \default \c false + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__seekable_stream_encoder_set_do_exhaustive_model_search(FLAC__SeekableStreamEncoder *encoder, FLAC__bool value); + +/** This is inherited from FLAC__StreamEncoder; see + * FLAC__stream_encoder_set_min_residual_partition_order(). + * + * \default \c 0 + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__seekable_stream_encoder_set_min_residual_partition_order(FLAC__SeekableStreamEncoder *encoder, unsigned value); + +/** This is inherited from FLAC__StreamEncoder; see + * FLAC__stream_encoder_set_max_residual_partition_order(). + * + * \default \c 0 + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__seekable_stream_encoder_set_max_residual_partition_order(FLAC__SeekableStreamEncoder *encoder, unsigned value); + +/** This is inherited from FLAC__StreamEncoder; see + * FLAC__stream_encoder_set_rice_parameter_search_dist(). + * + * \default \c 0 + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__seekable_stream_encoder_set_rice_parameter_search_dist(FLAC__SeekableStreamEncoder *encoder, unsigned value); + +/** This is inherited from FLAC__StreamEncoder; see + * FLAC__stream_encoder_set_total_samples_estimate(). + * + * \default \c 0 + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__seekable_stream_encoder_set_total_samples_estimate(FLAC__SeekableStreamEncoder *encoder, FLAC__uint64 value); + +/** This is inherited from FLAC__StreamEncoder; see + * FLAC__stream_encoder_set_metadata(). + * + * \note + * SEEKTABLE blocks are handled specially. Since you will not know + * the values for the seek point stream offsets, you should pass in + * a SEEKTABLE 'template', that is, a SEEKTABLE object with the + * required sample numbers (or placeholder points), with \c 0 for the + * \a frame_samples and \a stream_offset fields for each point. While + * encoding, the encoder will fill them in for you and when encoding + * is finished, it will seek back and write the real values into the + * SEEKTABLE block in the stream. There are helper routines for + * manipulating seektable template blocks; see metadata.h: + * FLAC__metadata_object_seektable_template_*(). + * + * \note + * The encoder instance \b will modify the first \c SEEKTABLE block + * as it transforms the template to a valid seektable while encoding, + * but it is still up to the caller to free all metadata blocks after + * encoding. + * + * \default \c NULL, 0 + * \param encoder An encoder instance to set. + * \param metadata See above. + * \param num_blocks See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__seekable_stream_encoder_set_metadata(FLAC__SeekableStreamEncoder *encoder, FLAC__StreamMetadata **metadata, unsigned num_blocks); + +/** Set the seek callback. + * The supplied function will be called when the encoder needs to seek + * the output stream. The encoder will pass the absolute byte offset + * to seek to, 0 meaning the beginning of the stream. + * + * \note + * The callback is mandatory and must be set before initialization. + * + * \default \c NULL + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \code value != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__seekable_stream_encoder_set_seek_callback(FLAC__SeekableStreamEncoder *encoder, FLAC__SeekableStreamEncoderSeekCallback value); + +/** Set the tell callback. + * The supplied function will be called when the encoder needs to know + * the current position of the output stream. + * + * \note + * The callback is mandatory and must be set before initialization. + * + * \default \c NULL + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \code value != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__seekable_stream_encoder_set_tell_callback(FLAC__SeekableStreamEncoder *encoder, FLAC__SeekableStreamEncoderTellCallback value); + +/** Set the write callback. + * This is inherited from FLAC__StreamEncoder; see + * FLAC__stream_encoder_set_write_callback(). + * + * \note + * The callback is mandatory and must be set before initialization. + * + * \default \c NULL + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \code value != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__seekable_stream_encoder_set_write_callback(FLAC__SeekableStreamEncoder *encoder, FLAC__SeekableStreamEncoderWriteCallback value); + +/** Set the client data to be passed back to callbacks. + * This value will be supplied to callbacks in their \a client_data + * argument. + * + * \default \c NULL + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__seekable_stream_encoder_set_client_data(FLAC__SeekableStreamEncoder *encoder, void *value); + +/** Get the current encoder state. + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__SeekableStreamEncoderState + * The current encoder state. + */ +FLAC_API FLAC__SeekableStreamEncoderState FLAC__seekable_stream_encoder_get_state(const FLAC__SeekableStreamEncoder *encoder); + +/** Get the state of the underlying stream encoder. + * Useful when the seekable stream encoder state is + * \c FLAC__SEEKABLE_STREAM_ENCODER_STREAM_ENCODER_ERROR. + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__StreamEncoderState + * The stream encoder state. + */ +FLAC_API FLAC__StreamEncoderState FLAC__seekable_stream_encoder_get_stream_encoder_state(const FLAC__SeekableStreamEncoder *encoder); + +/** Get the state of the underlying stream encoder's verify decoder. + * Useful when the seekable stream encoder state is + * \c FLAC__SEEKABLE_STREAM_ENCODER_STREAM_ENCODER_ERROR and the + * stream encoder state is \c FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR. + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__StreamDecoderState + * The stream encoder state. + */ +FLAC_API FLAC__StreamDecoderState FLAC__seekable_stream_encoder_get_verify_decoder_state(const FLAC__SeekableStreamEncoder *encoder); + +/** Get the current encoder state as a C string. + * This version automatically resolves + * \c FLAC__SEEKABLE_STREAM_ENCODER_STREAM_ENCODER_ERROR by getting the + * stream encoder's state. + * + * \param encoder A encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval const char * + * The encoder state as a C string. Do not modify the contents. + */ +FLAC_API const char *FLAC__seekable_stream_encoder_get_resolved_state_string(const FLAC__SeekableStreamEncoder *encoder); + +/** Get relevant values about the nature of a verify decoder error. + * Inherited from FLAC__stream_encoder_get_verify_decoder_error_stats(). + * Useful when the seekable stream encoder state is + * \c FLAC__SEEKABLE_STREAM_ENCODER_STREAM_ENCODER_ERROR and the + * stream encoder state is + * \c FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR. + * + * \param encoder An encoder instance to query. + * \param absolute_sample The absolute sample number of the mismatch. + * \param frame_number The number of the frame in which the mismatch occurred. + * \param channel The channel in which the mismatch occurred. + * \param sample The number of the sample (relative to the frame) in + * which the mismatch occurred. + * \param expected The expected value for the sample in question. + * \param got The actual value returned by the decoder. + * \assert + * \code encoder != NULL \endcode + */ +FLAC_API void FLAC__seekable_stream_encoder_get_verify_decoder_error_stats(const FLAC__SeekableStreamEncoder *encoder, FLAC__uint64 *absolute_sample, unsigned *frame_number, unsigned *channel, unsigned *sample, FLAC__int32 *expected, FLAC__int32 *got); + +/** Get the "verify" flag. + * This is inherited from FLAC__StreamEncoder; see + * FLAC__stream_encoder_get_verify(). + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * See FLAC__seekable_stream_encoder_set_verify(). + */ +FLAC_API FLAC__bool FLAC__seekable_stream_encoder_get_verify(const FLAC__SeekableStreamEncoder *encoder); + +/** Get the "streamable subset" flag. + * This is inherited from FLAC__StreamEncoder; see + * FLAC__stream_encoder_get_streamable_subset(). + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * See FLAC__seekable_stream_encoder_set_streamable_subset(). + */ +FLAC_API FLAC__bool FLAC__seekable_stream_encoder_get_streamable_subset(const FLAC__SeekableStreamEncoder *encoder); + +/** Get the "mid/side stereo coding" flag. + * This is inherited from FLAC__StreamEncoder; see + * FLAC__stream_encoder_get_do_mid_side_stereo(). + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * See FLAC__seekable_stream_encoder_get_do_mid_side_stereo(). + */ +FLAC_API FLAC__bool FLAC__seekable_stream_encoder_get_do_mid_side_stereo(const FLAC__SeekableStreamEncoder *encoder); + +/** Get the "adaptive mid/side switching" flag. + * This is inherited from FLAC__StreamEncoder; see + * FLAC__stream_encoder_get_loose_mid_side_stereo(). + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * See FLAC__seekable_stream_encoder_set_loose_mid_side_stereo(). + */ +FLAC_API FLAC__bool FLAC__seekable_stream_encoder_get_loose_mid_side_stereo(const FLAC__SeekableStreamEncoder *encoder); + +/** Get the number of input channels being processed. + * This is inherited from FLAC__StreamEncoder; see + * FLAC__stream_encoder_get_channels(). + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval unsigned + * See FLAC__seekable_stream_encoder_set_channels(). + */ +FLAC_API unsigned FLAC__seekable_stream_encoder_get_channels(const FLAC__SeekableStreamEncoder *encoder); + +/** Get the input sample resolution setting. + * This is inherited from FLAC__StreamEncoder; see + * FLAC__stream_encoder_get_bits_per_sample(). + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval unsigned + * See FLAC__seekable_stream_encoder_set_bits_per_sample(). + */ +FLAC_API unsigned FLAC__seekable_stream_encoder_get_bits_per_sample(const FLAC__SeekableStreamEncoder *encoder); + +/** Get the input sample rate setting. + * This is inherited from FLAC__StreamEncoder; see + * FLAC__stream_encoder_get_sample_rate(). + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval unsigned + * See FLAC__seekable_stream_encoder_set_sample_rate(). + */ +FLAC_API unsigned FLAC__seekable_stream_encoder_get_sample_rate(const FLAC__SeekableStreamEncoder *encoder); + +/** Get the blocksize setting. + * This is inherited from FLAC__StreamEncoder; see + * FLAC__stream_encoder_get_blocksize(). + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval unsigned + * See FLAC__seekable_stream_encoder_set_blocksize(). + */ +FLAC_API unsigned FLAC__seekable_stream_encoder_get_blocksize(const FLAC__SeekableStreamEncoder *encoder); + +/** Get the maximum LPC order setting. + * This is inherited from FLAC__StreamEncoder; see + * FLAC__stream_encoder_get_max_lpc_order(). + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval unsigned + * See FLAC__seekable_stream_encoder_set_max_lpc_order(). + */ +FLAC_API unsigned FLAC__seekable_stream_encoder_get_max_lpc_order(const FLAC__SeekableStreamEncoder *encoder); + +/** Get the quantized linear predictor coefficient precision setting. + * This is inherited from FLAC__StreamEncoder; see + * FLAC__stream_encoder_get_qlp_coeff_precision(). + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval unsigned + * See FLAC__seekable_stream_encoder_set_qlp_coeff_precision(). + */ +FLAC_API unsigned FLAC__seekable_stream_encoder_get_qlp_coeff_precision(const FLAC__SeekableStreamEncoder *encoder); + +/** Get the qlp coefficient precision search flag. + * This is inherited from FLAC__StreamEncoder; see + * FLAC__stream_encoder_get_do_qlp_coeff_prec_search(). + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * See FLAC__seekable_stream_encoder_set_do_qlp_coeff_prec_search(). + */ +FLAC_API FLAC__bool FLAC__seekable_stream_encoder_get_do_qlp_coeff_prec_search(const FLAC__SeekableStreamEncoder *encoder); + +/** Get the "escape coding" flag. + * This is inherited from FLAC__StreamEncoder; see + * FLAC__stream_encoder_get_do_escape_coding(). + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * See FLAC__seekable_stream_encoder_set_do_escape_coding(). + */ +FLAC_API FLAC__bool FLAC__seekable_stream_encoder_get_do_escape_coding(const FLAC__SeekableStreamEncoder *encoder); + +/** Get the exhaustive model search flag. + * This is inherited from FLAC__StreamEncoder; see + * FLAC__stream_encoder_get_do_exhaustive_model_search(). + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * See FLAC__seekable_stream_encoder_set_do_exhaustive_model_search(). + */ +FLAC_API FLAC__bool FLAC__seekable_stream_encoder_get_do_exhaustive_model_search(const FLAC__SeekableStreamEncoder *encoder); + +/** Get the minimum residual partition order setting. + * This is inherited from FLAC__StreamEncoder; see + * FLAC__stream_encoder_get_min_residual_partition_order(). + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval unsigned + * See FLAC__seekable_stream_encoder_set_min_residual_partition_order(). + */ +FLAC_API unsigned FLAC__seekable_stream_encoder_get_min_residual_partition_order(const FLAC__SeekableStreamEncoder *encoder); + +/** Get maximum residual partition order setting. + * This is inherited from FLAC__StreamEncoder; see + * FLAC__stream_encoder_get_max_residual_partition_order(). + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval unsigned + * See FLAC__seekable_stream_encoder_set_max_residual_partition_order(). + */ +FLAC_API unsigned FLAC__seekable_stream_encoder_get_max_residual_partition_order(const FLAC__SeekableStreamEncoder *encoder); + +/** Get the Rice parameter search distance setting. + * This is inherited from FLAC__StreamEncoder; see + * FLAC__stream_encoder_get_rice_parameter_search_dist(). + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval unsigned + * See FLAC__seekable_stream_encoder_set_rice_parameter_search_dist(). + */ +FLAC_API unsigned FLAC__seekable_stream_encoder_get_rice_parameter_search_dist(const FLAC__SeekableStreamEncoder *encoder); + +/** Get the previously set estimate of the total samples to be encoded. + * This is inherited from FLAC__StreamEncoder; see + * FLAC__stream_encoder_get_total_samples_estimate(). + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__uint64 + * See FLAC__seekable_stream_encoder_set_total_samples_estimate(). + */ +FLAC_API FLAC__uint64 FLAC__seekable_stream_encoder_get_total_samples_estimate(const FLAC__SeekableStreamEncoder *encoder); + +/** Initialize the encoder instance. + * Should be called after FLAC__seekable_stream_encoder_new() and + * FLAC__seekable_stream_encoder_set_*() but before FLAC__seekable_stream_encoder_process() + * or FLAC__seekable_stream_encoder_process_interleaved(). Will set and return + * the encoder state, which will be FLAC__SEEKABLE_STREAM_ENCODER_OK if + * initialization succeeded. + * + * The call to FLAC__seekable_stream_encoder_init() currently will also immediately + * call the write callback with the \c fLaC signature and all the encoded + * metadata. + * + * \param encoder An uninitialized encoder instance. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__SeekableStreamEncoderState + * \c FLAC__SEEKABLE_STREAM_ENCODER_OK if initialization was successful; see + * FLAC__SeekableStreamEncoderState for the meanings of other return values. + */ +FLAC_API FLAC__SeekableStreamEncoderState FLAC__seekable_stream_encoder_init(FLAC__SeekableStreamEncoder *encoder); + +/** Finish the encoding process. + * Flushes the encoding buffer, releases resources, resets the encoder + * settings to their defaults, and returns the encoder state to + * FLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED. + * + * In the event of a prematurely-terminated encode, it is not strictly + * necessary to call this immediately before FLAC__seekable_stream_encoder_delete() + * but it is good practice to match every FLAC__seekable_stream_encoder_init() + * with a FLAC__seekable_stream_encoder_finish(). + * + * \param encoder An uninitialized encoder instance. + * \assert + * \code encoder != NULL \endcode + */ +FLAC_API void FLAC__seekable_stream_encoder_finish(FLAC__SeekableStreamEncoder *encoder); + +/** Submit data for encoding. + * This is inherited from FLAC__StreamEncoder; see + * FLAC__stream_encoder_process(). + * + * \param encoder An initialized encoder instance in the OK state. + * \param buffer An array of pointers to each channel's signal. + * \param samples The number of samples in one channel. + * \assert + * \code encoder != NULL \endcode + * \code FLAC__seekable_stream_encoder_get_state(encoder) == FLAC__SEEKABLE_STREAM_ENCODER_OK \endcode + * \retval FLAC__bool + * \c true if successful, else \c false; in this case, check the + * encoder state with FLAC__seekable_stream_encoder_get_state() to see what + * went wrong. + */ +FLAC_API FLAC__bool FLAC__seekable_stream_encoder_process(FLAC__SeekableStreamEncoder *encoder, const FLAC__int32 * const buffer[], unsigned samples); + +/** Submit data for encoding. + * This is inherited from FLAC__StreamEncoder; see + * FLAC__stream_encoder_process_interleaved(). + * + * \param encoder An initialized encoder instance in the OK state. + * \param buffer An array of channel-interleaved data (see above). + * \param samples The number of samples in one channel, the same as for + * FLAC__seekable_stream_encoder_process(). For example, if + * encoding two channels, \c 1000 \a samples corresponds + * to a \a buffer of 2000 values. + * \assert + * \code encoder != NULL \endcode + * \code FLAC__seekable_stream_encoder_get_state(encoder) == FLAC__SEEKABLE_STREAM_ENCODER_OK \endcode + * \retval FLAC__bool + * \c true if successful, else \c false; in this case, check the + * encoder state with FLAC__seekable_stream_encoder_get_state() to see what + * went wrong. + */ +FLAC_API FLAC__bool FLAC__seekable_stream_encoder_process_interleaved(FLAC__SeekableStreamEncoder *encoder, const FLAC__int32 buffer[], unsigned samples); + +/* \} */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Libraries/FLAC/Files/include/FLAC/stream_decoder.h b/Libraries/FLAC/Files/include/FLAC/stream_decoder.h new file mode 100644 index 000000000..6cd59d42a --- /dev/null +++ b/Libraries/FLAC/Files/include/FLAC/stream_decoder.h @@ -0,0 +1,873 @@ +/* libFLAC - Free Lossless Audio Codec library + * Copyright (C) 2000,2001,2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef FLAC__STREAM_DECODER_H +#define FLAC__STREAM_DECODER_H + +#include "export.h" +#include "format.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +/** \file include/FLAC/stream_decoder.h + * + * \brief + * This module contains the functions which implement the stream + * decoder. + * + * See the detailed documentation in the + * \link flac_stream_decoder stream decoder \endlink module. + */ + +/** \defgroup flac_decoder FLAC/ *_decoder.h: decoder interfaces + * \ingroup flac + * + * \brief + * This module describes the three decoder layers provided by libFLAC. + * + * For decoding FLAC streams, libFLAC provides three layers of access. The + * lowest layer is non-seekable stream-level decoding, the next is seekable + * stream-level decoding, and the highest layer is file-level decoding. The + * interfaces are described in the \link flac_stream_decoder stream decoder + * \endlink, \link flac_seekable_stream_decoder seekable stream decoder + * \endlink, and \link flac_file_decoder file decoder \endlink modules + * respectively. Typically you will choose the highest layer that your input + * source will support. + * + * The stream decoder relies on callbacks for all input and output and has no + * provisions for seeking. The seekable stream decoder wraps the stream + * decoder and exposes functions for seeking. However, you must provide + * extra callbacks for seek-related operations on your stream, like seek and + * tell. The file decoder wraps the seekable stream decoder and supplies + * most of the callbacks internally, simplifying the processing of standard + * files. + */ + +/** \defgroup flac_stream_decoder FLAC/stream_decoder.h: stream decoder interface + * \ingroup flac_decoder + * + * \brief + * This module contains the functions which implement the stream + * decoder. + * + * The basic usage of this decoder is as follows: + * - The program creates an instance of a decoder using + * FLAC__stream_decoder_new(). + * - The program overrides the default settings and sets callbacks for + * reading, writing, error reporting, and metadata reporting using + * FLAC__stream_decoder_set_*() functions. + * - The program initializes the instance to validate the settings and + * prepare for decoding using FLAC__stream_decoder_init(). + * - The program calls the FLAC__stream_decoder_process_*() functions + * to decode data, which subsequently calls the callbacks. + * - The program finishes the decoding with FLAC__stream_decoder_finish(), + * which flushes the input and output and resets the decoder to the + * uninitialized state. + * - The instance may be used again or deleted with + * FLAC__stream_decoder_delete(). + * + * In more detail, the program will create a new instance by calling + * FLAC__stream_decoder_new(), then call FLAC__stream_decoder_set_*() + * functions to set the callbacks and client data, and call + * FLAC__stream_decoder_init(). The required callbacks are: + * + * - Read callback - This function will be called when the decoder needs + * more input data. The address of the buffer to be filled is supplied, + * along with the number of bytes the buffer can hold. The callback may + * choose to supply less data and modify the byte count but must be careful + * not to overflow the buffer. The callback then returns a status code + * chosen from FLAC__StreamDecoderReadStatus. + * - Write callback - This function will be called when the decoder has + * decoded a single frame of data. The decoder will pass the frame + * metadata as well as an array of pointers (one for each channel) + * pointing to the decoded audio. + * - Metadata callback - This function will be called when the decoder has + * decoded a metadata block. In a valid FLAC file there will always be + * one STREAMINFO block, followed by zero or more other metadata + * blocks. These will be supplied by the decoder in the same order as + * they appear in the stream and always before the first audio frame + * (i.e. write callback). The metadata block that is passed in must not + * be modified, and it doesn't live beyond the callback, so you should + * make a copy of it with FLAC__metadata_object_clone() if you will need + * it elsewhere. Since metadata blocks can potentially be large, by + * default the decoder only calls the metadata callback for the STREAMINFO + * block; you can instruct the decoder to pass or filter other blocks with + * FLAC__stream_decoder_set_metadata_*() calls. + * - Error callback - This function will be called whenever an error occurs + * during decoding. + * + * Once the decoder is initialized, your program will call one of several + * functions to start the decoding process: + * + * - FLAC__stream_decoder_process_single() - Tells the decoder to process at + * most one metadata block or audio frame and return, calling either the + * metadata callback or write callback, respectively, once. If the decoder + * loses sync it will return with only the error callback being called. + * - FLAC__stream_decoder_process_until_end_of_metadata() - Tells the decoder + * to process the stream from the current location and stop upon reaching + * the first audio frame. The user will get one metadata, write, or error + * callback per metadata block, audio frame, or sync error, respectively. + * - FLAC__stream_decoder_process_until_end_of_stream() - Tells the decoder + * to process the stream from the current location until the read callback + * returns FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM or + * FLAC__STREAM_DECODER_READ_STATUS_ABORT. The user will get one metadata, + * write, or error callback per metadata block, audio frame, or sync error, + * respectively. + * + * When the decoder has finished decoding (normally or through an abort), + * the instance is finished by calling FLAC__stream_decoder_finish(), which + * ensures the decoder is in the correct state and frees memory. Then the + * instance may be deleted with FLAC__stream_decoder_delete() or initialized + * again to decode another stream. + * + * Note that the stream decoder has no real concept of stream position, it + * just converts data. To seek within a stream the callbacks have only to + * flush the decoder using FLAC__stream_decoder_flush() and start feeding + * data from the new position through the read callback. The seekable + * stream decoder does just this. + * + * The FLAC__stream_decoder_set_metadata_*() functions deserve special + * attention. By default, the decoder only calls the metadata_callback for + * the STREAMINFO block. These functions allow you to tell the decoder + * explicitly which blocks to parse and return via the metadata_callback + * and/or which to skip. Use a FLAC__stream_decoder_set_metadata_respond_all(), + * FLAC__stream_decoder_set_metadata_ignore() ... or FLAC__stream_decoder_set_metadata_ignore_all(), + * FLAC__stream_decoder_set_metadata_respond() ... sequence to exactly specify which + * blocks to return. Remember that some metadata blocks can be big so + * filtering out the ones you don't use can reduce the memory requirements + * of the decoder. Also note the special forms + * FLAC__stream_decoder_set_metadata_respond_application(id) and + * FLAC__stream_decoder_set_metadata_ignore_application(id) for filtering APPLICATION + * blocks based on the application ID. + * + * STREAMINFO and SEEKTABLE blocks are always parsed and used internally, but + * they still can legally be filtered from the metadata_callback. + * + * \note + * The "set" functions may only be called when the decoder is in the + * state FLAC__STREAM_DECODER_UNINITIALIZED, i.e. after + * FLAC__stream_decoder_new() or FLAC__stream_decoder_finish(), but + * before FLAC__stream_decoder_init(). If this is the case they will + * return \c true, otherwise \c false. + * + * \note + * FLAC__stream_decoder_finish() resets all settings to the constructor + * defaults, including the callbacks. + * + * \{ + */ + + +/** State values for a FLAC__StreamDecoder + * + * The decoder's state can be obtained by calling FLAC__stream_decoder_get_state(). + */ +typedef enum { + + FLAC__STREAM_DECODER_SEARCH_FOR_METADATA = 0, + /**< The decoder is ready to search for metadata. */ + + FLAC__STREAM_DECODER_READ_METADATA, + /**< The decoder is ready to or is in the process of reading metadata. */ + + FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC, + /**< The decoder is ready to or is in the process of searching for the frame sync code. */ + + FLAC__STREAM_DECODER_READ_FRAME, + /**< The decoder is ready to or is in the process of reading a frame. */ + + FLAC__STREAM_DECODER_END_OF_STREAM, + /**< The decoder has reached the end of the stream. */ + + FLAC__STREAM_DECODER_ABORTED, + /**< The decoder was aborted by the read callback. */ + + FLAC__STREAM_DECODER_UNPARSEABLE_STREAM, + /**< The decoder encountered reserved fields in use in the stream. */ + + FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR, + /**< An error occurred allocating memory. */ + + FLAC__STREAM_DECODER_ALREADY_INITIALIZED, + /**< FLAC__stream_decoder_init() was called when the decoder was + * already initialized, usually because + * FLAC__stream_decoder_finish() was not called. + */ + + FLAC__STREAM_DECODER_INVALID_CALLBACK, + /**< FLAC__stream_decoder_init() was called without all callbacks being set. */ + + FLAC__STREAM_DECODER_UNINITIALIZED + /**< The decoder is in the uninitialized state. */ + +} FLAC__StreamDecoderState; + +/** Maps a FLAC__StreamDecoderState to a C string. + * + * Using a FLAC__StreamDecoderState as the index to this array + * will give the string equivalent. The contents should not be modified. + */ +extern FLAC_API const char * const FLAC__StreamDecoderStateString[]; + + +/** Return values for the FLAC__StreamDecoder read callback. + */ +typedef enum { + + FLAC__STREAM_DECODER_READ_STATUS_CONTINUE, + /**< The read was OK and decoding can continue. */ + + FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM, + /**< The read was attempted at the end of the stream. */ + + FLAC__STREAM_DECODER_READ_STATUS_ABORT + /**< An unrecoverable error occurred. The decoder will return from the process call. */ + +} FLAC__StreamDecoderReadStatus; + +/** Maps a FLAC__StreamDecoderReadStatus to a C string. + * + * Using a FLAC__StreamDecoderReadStatus as the index to this array + * will give the string equivalent. The contents should not be modified. + */ +extern FLAC_API const char * const FLAC__StreamDecoderReadStatusString[]; + + +/** Return values for the FLAC__StreamDecoder write callback. + */ +typedef enum { + + FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE, + /**< The write was OK and decoding can continue. */ + + FLAC__STREAM_DECODER_WRITE_STATUS_ABORT + /**< An unrecoverable error occurred. The decoder will return from the process call. */ + +} FLAC__StreamDecoderWriteStatus; + +/** Maps a FLAC__StreamDecoderWriteStatus to a C string. + * + * Using a FLAC__StreamDecoderWriteStatus as the index to this array + * will give the string equivalent. The contents should not be modified. + */ +extern FLAC_API const char * const FLAC__StreamDecoderWriteStatusString[]; + + +/** Possible values passed in to the FLAC__StreamDecoder error callback. + */ +typedef enum { + + FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC, + /**< An error in the stream caused the decoder to lose synchronization. */ + + FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER, + /**< The decoder encountered a corrupted frame header. */ + + FLAC__STREAM_DECODER_ERROR_STATUS_FRAME_CRC_MISMATCH + /**< The frame's data did not match the CRC in the footer. */ + +} FLAC__StreamDecoderErrorStatus; + +/** Maps a FLAC__StreamDecoderErrorStatus to a C string. + * + * Using a FLAC__StreamDecoderErrorStatus as the index to this array + * will give the string equivalent. The contents should not be modified. + */ +extern FLAC_API const char * const FLAC__StreamDecoderErrorStatusString[]; + + +/*********************************************************************** + * + * class FLAC__StreamDecoder + * + ***********************************************************************/ + +struct FLAC__StreamDecoderProtected; +struct FLAC__StreamDecoderPrivate; +/** The opaque structure definition for the stream decoder type. + * See the \link flac_stream_decoder stream decoder module \endlink + * for a detailed description. + */ +typedef struct { + struct FLAC__StreamDecoderProtected *protected_; /* avoid the C++ keyword 'protected' */ + struct FLAC__StreamDecoderPrivate *private_; /* avoid the C++ keyword 'private' */ +} FLAC__StreamDecoder; + +/** Signature for the read callback. + * See FLAC__stream_decoder_set_read_callback() for more info. + * + * \param decoder The decoder instance calling the callback. + * \param buffer A pointer to a location for the callee to store + * data to be decoded. + * \param bytes A pointer to the size of the buffer. On entry + * to the callback, it contains the maximum number + * of bytes that may be stored in \a buffer. The + * callee must set it to the actual number of bytes + * stored (0 in case of error or end-of-stream) before + * returning. + * \param client_data The callee's client data set through + * FLAC__stream_decoder_set_client_data(). + * \retval FLAC__StreamDecoderReadStatus + * The callee's return status. + */ +typedef FLAC__StreamDecoderReadStatus (*FLAC__StreamDecoderReadCallback)(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], unsigned *bytes, void *client_data); + +/** Signature for the write callback. + * See FLAC__stream_decoder_set_write_callback() for more info. + * + * \param decoder The decoder instance calling the callback. + * \param frame The description of the decoded frame. See + * FLAC__Frame. + * \param buffer An array of pointers to decoded channels of data. + * Each pointer will point to an array of signed + * samples of length \a frame->header.blocksize. + * Currently, the channel order has no meaning + * except for stereo streams; in this case channel + * 0 is left and 1 is right. + * \param client_data The callee's client data set through + * FLAC__stream_decoder_set_client_data(). + * \retval FLAC__StreamDecoderWriteStatus + * The callee's return status. + */ +typedef FLAC__StreamDecoderWriteStatus (*FLAC__StreamDecoderWriteCallback)(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data); + +/** Signature for the metadata callback. + * See FLAC__stream_decoder_set_metadata_callback() for more info. + * + * \param decoder The decoder instance calling the callback. + * \param metadata The decoded metadata block. + * \param client_data The callee's client data set through + * FLAC__stream_decoder_set_client_data(). + */ +typedef void (*FLAC__StreamDecoderMetadataCallback)(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data); + +/** Signature for the error callback. + * See FLAC__stream_decoder_set_error_callback() for more info. + * + * \param decoder The decoder instance calling the callback. + * \param status The error encountered by the decoder. + * \param client_data The callee's client data set through + * FLAC__stream_decoder_set_client_data(). + */ +typedef void (*FLAC__StreamDecoderErrorCallback)(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data); + + +/*********************************************************************** + * + * Class constructor/destructor + * + ***********************************************************************/ + +/** Create a new stream decoder instance. The instance is created with + * default settings; see the individual FLAC__stream_decoder_set_*() + * functions for each setting's default. + * + * \retval FLAC__StreamDecoder* + * \c NULL if there was an error allocating memory, else the new instance. + */ +FLAC_API FLAC__StreamDecoder *FLAC__stream_decoder_new(); + +/** Free a decoder instance. Deletes the object pointed to by \a decoder. + * + * \param decoder A pointer to an existing decoder. + * \assert + * \code decoder != NULL \endcode + */ +FLAC_API void FLAC__stream_decoder_delete(FLAC__StreamDecoder *decoder); + + +/*********************************************************************** + * + * Public class method prototypes + * + ***********************************************************************/ + +/** Set the read callback. + * The supplied function will be called when the decoder needs more input + * data. The address of the buffer to be filled is supplied, along with + * the number of bytes the buffer can hold. The callback may choose to + * supply less data and modify the byte count but must be careful not to + * overflow the buffer. The callback then returns a status code chosen + * from FLAC__StreamDecoderReadStatus. + * + * \note + * The callback is mandatory and must be set before initialization. + * + * \default \c NULL + * \param decoder A decoder instance to set. + * \param value See above. + * \assert + * \code decoder != NULL \endcode + * \code value != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__stream_decoder_set_read_callback(FLAC__StreamDecoder *decoder, FLAC__StreamDecoderReadCallback value); + +/** Set the write callback. + * The supplied function will be called when the decoder has decoded a + * single frame of data. The decoder will pass the frame metadata as + * well as an array of pointers (one for each channel) pointing to the + * decoded audio. + * + * \note + * The callback is mandatory and must be set before initialization. + * + * \default \c NULL + * \param decoder A decoder instance to set. + * \param value See above. + * \assert + * \code decoder != NULL \endcode + * \code value != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__stream_decoder_set_write_callback(FLAC__StreamDecoder *decoder, FLAC__StreamDecoderWriteCallback value); + +/** Set the metadata callback. + * The supplied function will be called when the decoder has decoded a metadata + * block. In a valid FLAC file there will always be one STREAMINFO block, + * followed by zero or more other metadata blocks. These will be supplied + * by the decoder in the same order as they appear in the stream and always + * before the first audio frame (i.e. write callback). The metadata block + * that is passed in must not be modified, and it doesn't live beyond the + * callback, so you should make a copy of it with + * FLAC__metadata_object_clone() if you will need it elsewhere. Since + * metadata blocks can potentially be large, by default the decoder only + * calls the metadata callback for the STREAMINFO block; you can instruct + * the decoder to pass or filter other blocks with + * FLAC__stream_decoder_set_metadata_*() calls. + * + * \note + * The callback is mandatory and must be set before initialization. + * + * \default \c NULL + * \param decoder A decoder instance to set. + * \param value See above. + * \assert + * \code decoder != NULL \endcode + * \code value != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_callback(FLAC__StreamDecoder *decoder, FLAC__StreamDecoderMetadataCallback value); + +/** Set the error callback. + * The supplied function will be called whenever an error occurs during + * decoding. + * + * \note + * The callback is mandatory and must be set before initialization. + * + * \default \c NULL + * \param decoder A decoder instance to set. + * \param value See above. + * \assert + * \code decoder != NULL \endcode + * \code value != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__stream_decoder_set_error_callback(FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorCallback value); + +/** Set the client data to be passed back to callbacks. + * This value will be supplied to callbacks in their \a client_data + * argument. + * + * \default \c NULL + * \param decoder A decoder instance to set. + * \param value See above. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__stream_decoder_set_client_data(FLAC__StreamDecoder *decoder, void *value); + +/** Direct the decoder to pass on all metadata blocks of type \a type. + * + * \default By default, only the \c STREAMINFO block is returned via the + * metadata callback. + * \param decoder A decoder instance to set. + * \param type See above. + * \assert + * \code decoder != NULL \endcode + * \a type is valid + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_respond(FLAC__StreamDecoder *decoder, FLAC__MetadataType type); + +/** Direct the decoder to pass on all APPLICATION metadata blocks of the + * given \a id. + * + * \default By default, only the \c STREAMINFO block is returned via the + * metadata callback. + * \param decoder A decoder instance to set. + * \param id See above. + * \assert + * \code decoder != NULL \endcode + * \code id != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_respond_application(FLAC__StreamDecoder *decoder, const FLAC__byte id[4]); + +/** Direct the decoder to pass on all metadata blocks of any type. + * + * \default By default, only the \c STREAMINFO block is returned via the + * metadata callback. + * \param decoder A decoder instance to set. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_respond_all(FLAC__StreamDecoder *decoder); + +/** Direct the decoder to filter out all metadata blocks of type \a type. + * + * \default By default, only the \c STREAMINFO block is returned via the + * metadata callback. + * \param decoder A decoder instance to set. + * \param type See above. + * \assert + * \code decoder != NULL \endcode + * \a type is valid + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_ignore(FLAC__StreamDecoder *decoder, FLAC__MetadataType type); + +/** Direct the decoder to filter out all APPLICATION metadata blocks of + * the given \a id. + * + * \default By default, only the \c STREAMINFO block is returned via the + * metadata callback. + * \param decoder A decoder instance to set. + * \param id See above. + * \assert + * \code decoder != NULL \endcode + * \code id != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_ignore_application(FLAC__StreamDecoder *decoder, const FLAC__byte id[4]); + +/** Direct the decoder to filter out all metadata blocks of any type. + * + * \default By default, only the \c STREAMINFO block is returned via the + * metadata callback. + * \param decoder A decoder instance to set. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_ignore_all(FLAC__StreamDecoder *decoder); + +/** Get the current decoder state. + * + * \param decoder A decoder instance to query. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__StreamDecoderState + * The current decoder state. + */ +FLAC_API FLAC__StreamDecoderState FLAC__stream_decoder_get_state(const FLAC__StreamDecoder *decoder); + +/** Get the current decoder state as a C string. + * + * \param decoder A decoder instance to query. + * \assert + * \code decoder != NULL \endcode + * \retval const char * + * The decoder state as a C string. Do not modify the contents. + */ +FLAC_API const char *FLAC__stream_decoder_get_resolved_state_string(const FLAC__StreamDecoder *decoder); + +/** Get the current number of channels in the stream being decoded. + * Will only be valid after decoding has started and will contain the + * value from the most recently decoded frame header. + * + * \param decoder A decoder instance to query. + * \assert + * \code decoder != NULL \endcode + * \retval unsigned + * See above. + */ +FLAC_API unsigned FLAC__stream_decoder_get_channels(const FLAC__StreamDecoder *decoder); + +/** Get the current channel assignment in the stream being decoded. + * Will only be valid after decoding has started and will contain the + * value from the most recently decoded frame header. + * + * \param decoder A decoder instance to query. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__ChannelAssignment + * See above. + */ +FLAC_API FLAC__ChannelAssignment FLAC__stream_decoder_get_channel_assignment(const FLAC__StreamDecoder *decoder); + +/** Get the current sample resolution in the stream being decoded. + * Will only be valid after decoding has started and will contain the + * value from the most recently decoded frame header. + * + * \param decoder A decoder instance to query. + * \assert + * \code decoder != NULL \endcode + * \retval unsigned + * See above. + */ +FLAC_API unsigned FLAC__stream_decoder_get_bits_per_sample(const FLAC__StreamDecoder *decoder); + +/** Get the current sample rate in Hz of the stream being decoded. + * Will only be valid after decoding has started and will contain the + * value from the most recently decoded frame header. + * + * \param decoder A decoder instance to query. + * \assert + * \code decoder != NULL \endcode + * \retval unsigned + * See above. + */ +FLAC_API unsigned FLAC__stream_decoder_get_sample_rate(const FLAC__StreamDecoder *decoder); + +/** Get the current blocksize of the stream being decoded. + * Will only be valid after decoding has started and will contain the + * value from the most recently decoded frame header. + * + * \param decoder A decoder instance to query. + * \assert + * \code decoder != NULL \endcode + * \retval unsigned + * See above. + */ +FLAC_API unsigned FLAC__stream_decoder_get_blocksize(const FLAC__StreamDecoder *decoder); + +/** Initialize the decoder instance. + * Should be called after FLAC__stream_decoder_new() and + * FLAC__stream_decoder_set_*() but before any of the + * FLAC__stream_decoder_process_*() functions. Will set and return the + * decoder state, which will be FLAC__STREAM_DECODER_SEARCH_FOR_METADATA + * if initialization succeeded. + * + * \param decoder An uninitialized decoder instance. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__StreamDecoderState + * \c FLAC__STREAM_DECODER_SEARCH_FOR_METADATA if initialization was + * successful; see FLAC__StreamDecoderState for the meanings of other + * return values. + */ +FLAC_API FLAC__StreamDecoderState FLAC__stream_decoder_init(FLAC__StreamDecoder *decoder); + +/** Finish the decoding process. + * Flushes the decoding buffer, releases resources, resets the decoder + * settings to their defaults, and returns the decoder state to + * FLAC__STREAM_DECODER_UNINITIALIZED. + * + * In the event of a prematurely-terminated decode, it is not strictly + * necessary to call this immediately before FLAC__stream_decoder_delete() + * but it is good practice to match every FLAC__stream_decoder_init() + * with a FLAC__stream_decoder_finish(). + * + * \param decoder An uninitialized decoder instance. + * \assert + * \code decoder != NULL \endcode + */ +FLAC_API void FLAC__stream_decoder_finish(FLAC__StreamDecoder *decoder); + +/** Flush the stream input. + * The decoder's input buffer will be cleared and the state set to + * \c FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC. + * + * \param decoder A decoder instance. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * \c true if successful, else \c false if a memory allocation + * error occurs. + */ +FLAC_API FLAC__bool FLAC__stream_decoder_flush(FLAC__StreamDecoder *decoder); + +/** Reset the decoding process. + * The decoder's input buffer will be cleared and the state set to + * \c FLAC__STREAM_DECODER_SEARCH_FOR_METADATA. This is similar to + * FLAC__stream_decoder_finish() except that the settings are + * preserved; there is no need to call FLAC__stream_decoder_init() + * before decoding again. + * + * \param decoder A decoder instance. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * \c true if successful, else \c false if a memory allocation + * error occurs. + */ +FLAC_API FLAC__bool FLAC__stream_decoder_reset(FLAC__StreamDecoder *decoder); + +/** Decode one metadata block or audio frame. + * This version instructs the decoder to decode a either a single metadata + * block or a single frame and stop, unless the callbacks return a fatal + * error or the read callback returns + * \c FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM. + * + * As the decoder needs more input it will call the read callback. + * Depending on what was decoded, the metadata or write callback will be + * called with the decoded metadata block or audio frame, unless an error + * occurred. If the decoder loses sync it will call the error callback + * instead. + * + * Unless there is a fatal read error or end of stream, this function + * will return once one whole frame is decoded. In other words, if the + * stream is not synchronized or points to a corrupt frame header, the + * decoder will continue to try and resync until it gets to a valid + * frame, then decode one frame, then return. If the decoder points to + * frame whose frame CRC in the frame footer does not match the + * computed frame CRC, this function will issue a + * FLAC__STREAM_DECODER_ERROR_STATUS_FRAME_CRC_MISMATCH error to the + * error callback, and return, having decoded one complete, although + * corrupt, frame. (Such corrupted frames are sent as silence of the + * correct length to the write callback.) + * + * \param decoder An initialized decoder instance. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * \c false if any read or write error occurred (except + * \c FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC), else \c true; + * in any case, check the decoder state with + * FLAC__stream_decoder_get_state() to see what went wrong or to + * check for lost synchronization (a sign of stream corruption). + */ +FLAC_API FLAC__bool FLAC__stream_decoder_process_single(FLAC__StreamDecoder *decoder); + +/** Decode until the end of the metadata. + * This version instructs the decoder to decode from the current position + * and continue until all the metadata has been read, or until the + * callbacks return a fatal error or the read callback returns + * \c FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM. + * + * As the decoder needs more input it will call the read callback. + * As each metadata block is decoded, the metadata callback will be called + * with the decoded metadata. If the decoder loses sync it will call the + * error callback. + * + * \param decoder An initialized decoder instance. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * \c false if any read or write error occurred (except + * \c FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC), else \c true; + * in any case, check the decoder state with + * FLAC__stream_decoder_get_state() to see what went wrong or to + * check for lost synchronization (a sign of stream corruption). + */ +FLAC_API FLAC__bool FLAC__stream_decoder_process_until_end_of_metadata(FLAC__StreamDecoder *decoder); + +/** Decode until the end of the stream. + * This version instructs the decoder to decode from the current position + * and continue until the end of stream (the read callback returns + * \c FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM), or until the + * callbacks return a fatal error. + * + * As the decoder needs more input it will call the read callback. + * As each metadata block and frame is decoded, the metadata or write + * callback will be called with the decoded metadata or frame. If the + * decoder loses sync it will call the error callback. + * + * \param decoder An initialized decoder instance. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * \c false if any read or write error occurred (except + * \c FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC), else \c true; + * in any case, check the decoder state with + * FLAC__stream_decoder_get_state() to see what went wrong or to + * check for lost synchronization (a sign of stream corruption). + */ +FLAC_API FLAC__bool FLAC__stream_decoder_process_until_end_of_stream(FLAC__StreamDecoder *decoder); + +/** Skip one audio frame. + * This version instructs the decoder to 'skip' a single frame and stop, + * unless the callbacks return a fatal error or the read callback returns + * \c FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM. + * + * The decoding flow is the same as what occurs when + * FLAC__stream_decoder_process_single() is called to process an audio + * frame, except that this function does not decode the parsed data into + * PCM or call the write callback. The integrity of the frame is still + * checked the same way as in the other process functions. + * + * This function will return once one whole frame is skipped, in the + * same way that FLAC__stream_decoder_process_single() will return once + * one whole frame is decoded. + * + * This function, when used from the higher FLAC__SeekableStreamDecoder + * layer, can be used in more quickly determining FLAC frame boundaries + * when decoding of the actual data is not needed, for example when an + * application is separating a FLAC stream into frames for editing or + * storing in a container. To do this, the application can use + * FLAC__seekable_stream_decoder_skip_single_frame() to quickly advance + * to the next frame, then use + * FLAC__seekable_stream_decoder_get_decode_position() to find the new + * frame boundary. + * + * This function should only be called when the stream has advanced + * past all the metadata, otherwise it will return \c false. + * + * \param decoder An initialized decoder instance not in a metadata + * state. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * \c false if any read or write error occurred (except + * \c FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC), or if the decoder + * is in the FLAC__STREAM_DECODER_SEARCH_FOR_METADATA or + * FLAC__STREAM_DECODER_READ_METADATA state, else \c true; + * in any case, check the decoder state with + * FLAC__stream_decoder_get_state() to see what went wrong or to + * check for lost synchronization (a sign of stream corruption). + */ +FLAC_API FLAC__bool FLAC__stream_decoder_skip_single_frame(FLAC__StreamDecoder *decoder); + +/* \} */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Libraries/FLAC/Files/include/FLAC/stream_encoder.h b/Libraries/FLAC/Files/include/FLAC/stream_encoder.h new file mode 100644 index 000000000..0ac18a365 --- /dev/null +++ b/Libraries/FLAC/Files/include/FLAC/stream_encoder.h @@ -0,0 +1,1064 @@ +/* libFLAC - Free Lossless Audio Codec library + * Copyright (C) 2000,2001,2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef FLAC__STREAM_ENCODER_H +#define FLAC__STREAM_ENCODER_H + +#include "export.h" +#include "format.h" +#include "stream_decoder.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +/** \file include/FLAC/stream_encoder.h + * + * \brief + * This module contains the functions which implement the stream + * encoder. + * + * See the detailed documentation in the + * \link flac_stream_encoder stream encoder \endlink module. + */ + +/** \defgroup flac_encoder FLAC/ *_encoder.h: encoder interfaces + * \ingroup flac + * + * \brief + * This module describes the two encoder layers provided by libFLAC. + * + * For encoding FLAC streams, libFLAC provides three layers of access. The + * lowest layer is non-seekable stream-level encoding, the next is seekable + * stream-level encoding, and the highest layer is file-level encoding. The + * interfaces are described in the \link flac_stream_encoder stream encoder + * \endlink, \link flac_seekable_stream_encoder seekable stream encoder + * \endlink, and \link flac_file_encoder file encoder \endlink modules + * respectively. Typically you will choose the highest layer that your input + * source will support. + * The stream encoder relies on callbacks for writing the data and + * metadata. The file encoder provides these callbacks internally and you + * need only supply the filename. + * + * The stream encoder relies on callbacks for writing the data and has no + * provisions for seeking the output. The seekable stream encoder wraps + * the stream encoder and also automaticallay handles the writing back of + * metadata discovered while encoding. However, you must provide extra + * callbacks for seek-related operations on your output, like seek and + * tell. The file encoder wraps the seekable stream encoder and supplies + * all of the callbacks internally, simplifying the processing of standard + * files. The only callback exposed is for progress reporting, and that + * is optional. + */ + +/** \defgroup flac_stream_encoder FLAC/stream_encoder.h: stream encoder interface + * \ingroup flac_encoder + * + * \brief + * This module contains the functions which implement the stream + * encoder. + * + * The basic usage of this encoder is as follows: + * - The program creates an instance of an encoder using + * FLAC__stream_encoder_new(). + * - The program overrides the default settings and sets callbacks using + * FLAC__stream_encoder_set_*() functions. + * - The program initializes the instance to validate the settings and + * prepare for encoding using FLAC__stream_encoder_init(). + * - The program calls FLAC__stream_encoder_process() or + * FLAC__stream_encoder_process_interleaved() to encode data, which + * subsequently calls the callbacks when there is encoder data ready + * to be written. + * - The program finishes the encoding with FLAC__stream_encoder_finish(), + * which causes the encoder to encode any data still in its input pipe, + * call the metadata callback with the final encoding statistics, and + * finally reset the encoder to the uninitialized state. + * - The instance may be used again or deleted with + * FLAC__stream_encoder_delete(). + * + * In more detail, the stream encoder functions similarly to the + * \link flac_stream_decoder stream decoder \endlink, but has fewer + * callbacks and more options. Typically the user will create a new + * instance by calling FLAC__stream_encoder_new(), then set the necessary + * parameters and callbacks with FLAC__stream_encoder_set_*(), and + * initialize it by calling FLAC__stream_encoder_init(). + * + * Unlike the decoders, the stream encoder has many options that can + * affect the speed and compression ratio. When setting these parameters + * you should have some basic knowledge of the format (see the + * user-level documentation + * or the formal description). The + * FLAC__stream_encoder_set_*() functions themselves do not validate the + * values as many are interdependent. The FLAC__stream_encoder_init() + * function will do this, so make sure to pay attention to the state + * returned by FLAC__stream_encoder_init() to make sure that it is + * FLAC__STREAM_ENCODER_OK. Any parameters that are not set before + * FLAC__stream_encoder_init() will take on the defaults from the + * constructor. + * + * The user must provide function pointers for the following callbacks: + * + * - Write callback - This function is called by the encoder anytime there + * is raw encoded data to write. It may include metadata mixed with + * encoded audio frames and the data is not guaranteed to be aligned on + * frame or metadata block boundaries. + * - Metadata callback - This function is called once at the end of + * encoding with the populated STREAMINFO structure. This is so file + * encoders can seek back to the beginning of the file and write the + * STREAMINFO block with the correct statistics after encoding (like + * minimum/maximum frame size). + * + * The call to FLAC__stream_encoder_init() currently will also immediately + * call the write callback several times, once with the \c fLaC signature, + * and once for each encoded metadata block. + * + * After initializing the instance, the user may feed audio data to the + * encoder in one of two ways: + * + * - Channel separate, through FLAC__stream_encoder_process() - The user + * will pass an array of pointers to buffers, one for each channel, to + * the encoder, each of the same length. The samples need not be + * block-aligned. + * - Channel interleaved, through + * FLAC__stream_encoder_process_interleaved() - The user will pass a single + * pointer to data that is channel-interleaved (i.e. channel0_sample0, + * channel1_sample0, ... , channelN_sample0, channel0_sample1, ...). + * Again, the samples need not be block-aligned but they must be + * sample-aligned, i.e. the first value should be channel0_sample0 and + * the last value channelN_sampleM. + * + * When the user is finished encoding data, it calls + * FLAC__stream_encoder_finish(), which causes the encoder to encode any + * data still in its input pipe, and call the metadata callback with the + * final encoding statistics. Then the instance may be deleted with + * FLAC__stream_encoder_delete() or initialized again to encode another + * stream. + * + * For programs that write their own metadata, but that do not know the + * actual metadata until after encoding, it is advantageous to instruct + * the encoder to write a PADDING block of the correct size, so that + * instead of rewriting the whole stream after encoding, the program can + * just overwrite the PADDING block. If only the maximum size of the + * metadata is known, the program can write a slightly larger padding + * block, then split it after encoding. + * + * Make sure you understand how lengths are calculated. All FLAC metadata + * blocks have a 4 byte header which contains the type and length. This + * length does not include the 4 bytes of the header. See the format page + * for the specification of metadata blocks and their lengths. + * + * \note + * The "set" functions may only be called when the encoder is in the + * state FLAC__STREAM_ENCODER_UNINITIALIZED, i.e. after + * FLAC__stream_encoder_new() or FLAC__stream_encoder_finish(), but + * before FLAC__stream_encoder_init(). If this is the case they will + * return \c true, otherwise \c false. + * + * \note + * FLAC__stream_encoder_finish() resets all settings to the constructor + * defaults, including the callbacks. + * + * \{ + */ + + +/** State values for a FLAC__StreamEncoder + * + * The encoder's state can be obtained by calling FLAC__stream_encoder_get_state(). + */ +typedef enum { + + FLAC__STREAM_ENCODER_OK = 0, + /**< The encoder is in the normal OK state. */ + + FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR, + /**< An error occurred in the underlying verify stream decoder; + * check FLAC__stream_encoder_get_verify_decoder_state(). + */ + + FLAC__STREAM_ENCODER_VERIFY_MISMATCH_IN_AUDIO_DATA, + /**< The verify decoder detected a mismatch between the original + * audio signal and the decoded audio signal. + */ + + FLAC__STREAM_ENCODER_INVALID_CALLBACK, + /**< The encoder was initialized before setting all the required callbacks. */ + + FLAC__STREAM_ENCODER_INVALID_NUMBER_OF_CHANNELS, + /**< The encoder has an invalid setting for number of channels. */ + + FLAC__STREAM_ENCODER_INVALID_BITS_PER_SAMPLE, + /**< The encoder has an invalid setting for bits-per-sample. + * FLAC supports 4-32 bps but the reference encoder currently supports + * only up to 24 bps. + */ + + FLAC__STREAM_ENCODER_INVALID_SAMPLE_RATE, + /**< The encoder has an invalid setting for the input sample rate. */ + + FLAC__STREAM_ENCODER_INVALID_BLOCK_SIZE, + /**< The encoder has an invalid setting for the block size. */ + + FLAC__STREAM_ENCODER_INVALID_MAX_LPC_ORDER, + /**< The encoder has an invalid setting for the maximum LPC order. */ + + FLAC__STREAM_ENCODER_INVALID_QLP_COEFF_PRECISION, + /**< The encoder has an invalid setting for the precision of the quantized linear predictor coefficients. */ + + FLAC__STREAM_ENCODER_MID_SIDE_CHANNELS_MISMATCH, + /**< Mid/side coding was specified but the number of channels is not equal to 2. */ + + FLAC__STREAM_ENCODER_MID_SIDE_SAMPLE_SIZE_MISMATCH, + /**< Deprecated. */ + + FLAC__STREAM_ENCODER_ILLEGAL_MID_SIDE_FORCE, + /**< Loose mid/side coding was specified but mid/side coding was not. */ + + FLAC__STREAM_ENCODER_BLOCK_SIZE_TOO_SMALL_FOR_LPC_ORDER, + /**< The specified block size is less than the maximum LPC order. */ + + FLAC__STREAM_ENCODER_NOT_STREAMABLE, + /**< The encoder is bound to the "streamable subset" but other settings violate it. */ + + FLAC__STREAM_ENCODER_FRAMING_ERROR, + /**< An error occurred while writing the stream; usually, the write_callback returned an error. */ + + FLAC__STREAM_ENCODER_INVALID_METADATA, + /**< The metadata input to the encoder is invalid, in one of the following ways: + * - FLAC__stream_encoder_set_metadata() was called with a null pointer but a block count > 0 + * - One of the metadata blocks contains an undefined type + * - It contains an illegal CUESHEET as checked by FLAC__format_cuesheet_is_legal() + * - It contains an illegal SEEKTABLE as checked by FLAC__format_seektable_is_legal() + * - It contains more than one SEEKTABLE block or more than one VORBIS_COMMENT block + */ + + FLAC__STREAM_ENCODER_FATAL_ERROR_WHILE_ENCODING, + /**< An error occurred while writing the stream; usually, the write_callback returned an error. */ + + FLAC__STREAM_ENCODER_FATAL_ERROR_WHILE_WRITING, + /**< The write_callback returned an error. */ + + FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR, + /**< Memory allocation failed. */ + + FLAC__STREAM_ENCODER_ALREADY_INITIALIZED, + /**< FLAC__stream_encoder_init() was called when the encoder was + * already initialized, usually because + * FLAC__stream_encoder_finish() was not called. + */ + + FLAC__STREAM_ENCODER_UNINITIALIZED + /**< The encoder is in the uninitialized state. */ + +} FLAC__StreamEncoderState; + +/** Maps a FLAC__StreamEncoderState to a C string. + * + * Using a FLAC__StreamEncoderState as the index to this array + * will give the string equivalent. The contents should not be modified. + */ +extern FLAC_API const char * const FLAC__StreamEncoderStateString[]; + +/** Return values for the FLAC__StreamEncoder write callback. + */ +typedef enum { + + FLAC__STREAM_ENCODER_WRITE_STATUS_OK = 0, + /**< The write was OK and encoding can continue. */ + + FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR + /**< An unrecoverable error occurred. The encoder will return from the process call. */ + +} FLAC__StreamEncoderWriteStatus; + +/** Maps a FLAC__StreamEncoderWriteStatus to a C string. + * + * Using a FLAC__StreamEncoderWriteStatus as the index to this array + * will give the string equivalent. The contents should not be modified. + */ +extern FLAC_API const char * const FLAC__StreamEncoderWriteStatusString[]; + + +/*********************************************************************** + * + * class FLAC__StreamEncoder + * + ***********************************************************************/ + +struct FLAC__StreamEncoderProtected; +struct FLAC__StreamEncoderPrivate; +/** The opaque structure definition for the stream encoder type. + * See the \link flac_stream_encoder stream encoder module \endlink + * for a detailed description. + */ +typedef struct { + struct FLAC__StreamEncoderProtected *protected_; /* avoid the C++ keyword 'protected' */ + struct FLAC__StreamEncoderPrivate *private_; /* avoid the C++ keyword 'private' */ +} FLAC__StreamEncoder; + +/** Signature for the write callback. + * See FLAC__stream_encoder_set_write_callback() for more info. + * + * \param encoder The encoder instance calling the callback. + * \param buffer An array of encoded data of length \a bytes. + * \param bytes The byte length of \a buffer. + * \param samples The number of samples encoded by \a buffer. + * \c 0 has a special meaning; see + * FLAC__stream_encoder_set_write_callback(). + * \param current_frame The number of the current frame being encoded. + * \param client_data The callee's client data set through + * FLAC__stream_encoder_set_client_data(). + * \retval FLAC__StreamEncoderWriteStatus + * The callee's return status. + */ +typedef FLAC__StreamEncoderWriteStatus (*FLAC__StreamEncoderWriteCallback)(const FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame, void *client_data); + +/** Signature for the metadata callback. + * See FLAC__stream_encoder_set_metadata_callback() for more info. + * + * \param encoder The encoder instance calling the callback. + * \param metadata The final populated STREAMINFO block. + * \param client_data The callee's client data set through + * FLAC__stream_encoder_set_client_data(). + */ +typedef void (*FLAC__StreamEncoderMetadataCallback)(const FLAC__StreamEncoder *encoder, const FLAC__StreamMetadata *metadata, void *client_data); + + +/*********************************************************************** + * + * Class constructor/destructor + * + ***********************************************************************/ + +/** Create a new stream encoder instance. The instance is created with + * default settings; see the individual FLAC__stream_encoder_set_*() + * functions for each setting's default. + * + * \retval FLAC__StreamEncoder* + * \c NULL if there was an error allocating memory, else the new instance. + */ +FLAC_API FLAC__StreamEncoder *FLAC__stream_encoder_new(); + +/** Free an encoder instance. Deletes the object pointed to by \a encoder. + * + * \param encoder A pointer to an existing encoder. + * \assert + * \code encoder != NULL \endcode + */ +FLAC_API void FLAC__stream_encoder_delete(FLAC__StreamEncoder *encoder); + + +/*********************************************************************** + * + * Public class method prototypes + * + ***********************************************************************/ + +/** Set the "verify" flag. If \c true, the encoder will verify it's own + * encoded output by feeding it through an internal decoder and comparing + * the original signal against the decoded signal. If a mismatch occurs, + * the process call will return \c false. Note that this will slow the + * encoding process by the extra time required for decoding and comparison. + * + * \default \c false + * \param encoder An encoder instance to set. + * \param value Flag value (see above). + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__stream_encoder_set_verify(FLAC__StreamEncoder *encoder, FLAC__bool value); + +/** Set the "streamable subset" flag. If \c true, the encoder will comply + * with the subset (see the format specification) and will check the + * settings during FLAC__stream_encoder_init() to see if all settings + * comply. If \c false, the settings may take advantage of the full + * range that the format allows. + * + * Make sure you know what it entails before setting this to \c false. + * + * \default \c true + * \param encoder An encoder instance to set. + * \param value Flag value (see above). + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__stream_encoder_set_streamable_subset(FLAC__StreamEncoder *encoder, FLAC__bool value); + +/** Set to \c true to enable mid-side encoding on stereo input. The + * number of channels must be 2. Set to \c false to use only + * independent channel coding. + * + * \default \c false + * \param encoder An encoder instance to set. + * \param value Flag value (see above). + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__stream_encoder_set_do_mid_side_stereo(FLAC__StreamEncoder *encoder, FLAC__bool value); + +/** Set to \c true to enable adaptive switching between mid-side and + * left-right encoding on stereo input. The number of channels must + * be 2. Set to \c false to use exhaustive searching. In either + * case, the mid/side stereo setting must be \c true. + * + * \default \c false + * \param encoder An encoder instance to set. + * \param value Flag value (see above). + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__stream_encoder_set_loose_mid_side_stereo(FLAC__StreamEncoder *encoder, FLAC__bool value); + +/** Set the number of channels to be encoded. + * + * \default \c 2 + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__stream_encoder_set_channels(FLAC__StreamEncoder *encoder, unsigned value); + +/** Set the sample resolution of the input to be encoded. + * + * \warning + * Do not feed the encoder data that is wider than the value you + * set here or you will generate an invalid stream. + * + * \default \c 16 + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__stream_encoder_set_bits_per_sample(FLAC__StreamEncoder *encoder, unsigned value); + +/** Set the sample rate (in Hz) of the input to be encoded. + * + * \default \c 44100 + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__stream_encoder_set_sample_rate(FLAC__StreamEncoder *encoder, unsigned value); + +/** Set the blocksize to use while encoding. + * + * \default \c 1152 + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__stream_encoder_set_blocksize(FLAC__StreamEncoder *encoder, unsigned value); + +/** Set the maximum LPC order, or \c 0 to use only the fixed predictors. + * + * \default \c 0 + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__stream_encoder_set_max_lpc_order(FLAC__StreamEncoder *encoder, unsigned value); + +/** Set the precision, in bits, of the quantized linear predictor + * coefficients, or \c 0 to let the encoder select it based on the + * blocksize. + * + * \note + * In the current implementation, qlp_coeff_precision + bits_per_sample must + * be less than 32. + * + * \default \c 0 + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__stream_encoder_set_qlp_coeff_precision(FLAC__StreamEncoder *encoder, unsigned value); + +/** Set to \c false to use only the specified quantized linear predictor + * coefficient precision, or \c true to search neighboring precision + * values and use the best one. + * + * \default \c false + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__stream_encoder_set_do_qlp_coeff_prec_search(FLAC__StreamEncoder *encoder, FLAC__bool value); + +/** Deprecated. Setting this value has no effect. + * + * \default \c false + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__stream_encoder_set_do_escape_coding(FLAC__StreamEncoder *encoder, FLAC__bool value); + +/** Set to \c false to let the encoder estimate the best model order + * based on the residual signal energy, or \c true to force the + * encoder to evaluate all order models and select the best. + * + * \default \c false + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__stream_encoder_set_do_exhaustive_model_search(FLAC__StreamEncoder *encoder, FLAC__bool value); + +/** Set the minimum partition order to search when coding the residual. + * This is used in tandem with + * FLAC__stream_encoder_set_max_residual_partition_order(). + * + * The partition order determines the context size in the residual. + * The context size will be approximately blocksize / (2 ^ order). + * + * Set both min and max values to \c 0 to force a single context, + * whose Rice parameter is based on the residual signal variance. + * Otherwise, set a min and max order, and the encoder will search + * all orders, using the mean of each context for its Rice parameter, + * and use the best. + * + * \default \c 0 + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__stream_encoder_set_min_residual_partition_order(FLAC__StreamEncoder *encoder, unsigned value); + +/** Set the maximum partition order to search when coding the residual. + * This is used in tandem with + * FLAC__stream_encoder_set_min_residual_partition_order(). + * + * The partition order determines the context size in the residual. + * The context size will be approximately blocksize / (2 ^ order). + * + * Set both min and max values to \c 0 to force a single context, + * whose Rice parameter is based on the residual signal variance. + * Otherwise, set a min and max order, and the encoder will search + * all orders, using the mean of each context for its Rice parameter, + * and use the best. + * + * \default \c 0 + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__stream_encoder_set_max_residual_partition_order(FLAC__StreamEncoder *encoder, unsigned value); + +/** Deprecated. Setting this value has no effect. + * + * \default \c 0 + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__stream_encoder_set_rice_parameter_search_dist(FLAC__StreamEncoder *encoder, unsigned value); + +/** Set an estimate of the total samples that will be encoded. + * This is merely an estimate and may be set to \c 0 if unknown. + * This value will be written to the STREAMINFO block before encoding, + * and can remove the need for the caller to rewrite the value later + * if the value is known before encoding. + * + * \default \c 0 + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__stream_encoder_set_total_samples_estimate(FLAC__StreamEncoder *encoder, FLAC__uint64 value); + +/** Set the metadata blocks to be emitted to the stream before encoding. + * A value of \c NULL, \c 0 implies no metadata; otherwise, supply an + * array of pointers to metadata blocks. The array is non-const since + * the encoder may need to change the \a is_last flag inside them. + * Otherwise, the encoder will not modify or free the blocks. It is up + * to the caller to free the metadata blocks after encoding. + * + * \note + * The encoder stores only the \a metadata pointer; the passed-in array + * must survive at least until after FLAC__stream_encoder_init() returns. + * Do not modify the array or free the blocks until then. + * + * \note + * The STREAMINFO block is always written and no STREAMINFO block may + * occur in the supplied array. + * + * \note + * By default the encoder does not create a SEEKTABLE. If one is supplied + * in the \a metadata array it will be written verbatim. However by itself + * this is not very useful as the user will not know the stream offsets for + * the seekpoints ahead of time. You must use the seekable stream encoder + * to generate a legal seektable + * (see FLAC__seekable_stream_encoder_set_metadata()) + * + * \note + * A VORBIS_COMMENT block may be supplied. The vendor string in it + * will be ignored. libFLAC will use it's own vendor string. libFLAC + * will not modify the passed-in VORBIS_COMMENT's vendor string, it + * will simply write it's own into the stream. If no VORBIS_COMMENT + * block is present in the \a metadata array, libFLAC will write an + * empty one, containing only the vendor string. + * + * \default \c NULL, 0 + * \param encoder An encoder instance to set. + * \param metadata See above. + * \param num_blocks See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__stream_encoder_set_metadata(FLAC__StreamEncoder *encoder, FLAC__StreamMetadata **metadata, unsigned num_blocks); + +/** Set the write callback. + * The supplied function will be called by the encoder anytime there is raw + * encoded data ready to write. It may include metadata mixed with encoded + * audio frames and the data is not guaranteed to be aligned on frame or + * metadata block boundaries. + * + * The only duty of the callback is to write out the \a bytes worth of data + * in \a buffer to the current position in the output stream. The arguments + * \a samples and \a current_frame are purely informational. If \a samples + * is greater than \c 0, then \a current_frame will hold the current frame + * number that is being written; otherwise, the write callback is being called + * to write metadata. + * + * \note + * The callback is mandatory and must be set before initialization. + * + * \default \c NULL + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \code value != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__stream_encoder_set_write_callback(FLAC__StreamEncoder *encoder, FLAC__StreamEncoderWriteCallback value); + +/** Set the metadata callback. + * The supplied function will be called once at the end of encoding with + * the populated STREAMINFO structure. This is so file encoders can seek + * back to the beginning of the file and write the STREAMINFO block with + * the correct statistics after encoding (like minimum/maximum frame size + * and total samples). + * + * \note + * The callback is mandatory and must be set before initialization. + * + * \default \c NULL + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \code value != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__stream_encoder_set_metadata_callback(FLAC__StreamEncoder *encoder, FLAC__StreamEncoderMetadataCallback value); + +/** Set the client data to be passed back to callbacks. + * This value will be supplied to callbacks in their \a client_data + * argument. + * + * \default \c NULL + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +FLAC_API FLAC__bool FLAC__stream_encoder_set_client_data(FLAC__StreamEncoder *encoder, void *value); + +/** Get the current encoder state. + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__StreamEncoderState + * The current encoder state. + */ +FLAC_API FLAC__StreamEncoderState FLAC__stream_encoder_get_state(const FLAC__StreamEncoder *encoder); + +/** Get the state of the verify stream decoder. + * Useful when the stream encoder state is + * \c FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR. + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__StreamDecoderState + * The verify stream decoder state. + */ +FLAC_API FLAC__StreamDecoderState FLAC__stream_encoder_get_verify_decoder_state(const FLAC__StreamEncoder *encoder); + +/** Get the current encoder state as a C string. + * This version automatically resolves + * \c FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR by getting the + * verify decoder's state. + * + * \param encoder A encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval const char * + * The encoder state as a C string. Do not modify the contents. + */ +FLAC_API const char *FLAC__stream_encoder_get_resolved_state_string(const FLAC__StreamEncoder *encoder); + +/** Get relevant values about the nature of a verify decoder error. + * Useful when the stream encoder state is + * \c FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR. The arguments should + * be addresses in which the stats will be returned, or NULL if value + * is not desired. + * + * \param encoder An encoder instance to query. + * \param absolute_sample The absolute sample number of the mismatch. + * \param frame_number The number of the frame in which the mismatch occurred. + * \param channel The channel in which the mismatch occurred. + * \param sample The number of the sample (relative to the frame) in + * which the mismatch occurred. + * \param expected The expected value for the sample in question. + * \param got The actual value returned by the decoder. + * \assert + * \code encoder != NULL \endcode + */ +FLAC_API void FLAC__stream_encoder_get_verify_decoder_error_stats(const FLAC__StreamEncoder *encoder, FLAC__uint64 *absolute_sample, unsigned *frame_number, unsigned *channel, unsigned *sample, FLAC__int32 *expected, FLAC__int32 *got); + +/** Get the "verify" flag. + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * See FLAC__stream_encoder_set_verify(). + */ +FLAC_API FLAC__bool FLAC__stream_encoder_get_verify(const FLAC__StreamEncoder *encoder); + +/** Get the "streamable subset" flag. + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * See FLAC__stream_encoder_set_streamable_subset(). + */ +FLAC_API FLAC__bool FLAC__stream_encoder_get_streamable_subset(const FLAC__StreamEncoder *encoder); + +/** Get the "mid/side stereo coding" flag. + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * See FLAC__stream_encoder_get_do_mid_side_stereo(). + */ +FLAC_API FLAC__bool FLAC__stream_encoder_get_do_mid_side_stereo(const FLAC__StreamEncoder *encoder); + +/** Get the "adaptive mid/side switching" flag. + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * See FLAC__stream_encoder_set_loose_mid_side_stereo(). + */ +FLAC_API FLAC__bool FLAC__stream_encoder_get_loose_mid_side_stereo(const FLAC__StreamEncoder *encoder); + +/** Get the number of input channels being processed. + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval unsigned + * See FLAC__stream_encoder_set_channels(). + */ +FLAC_API unsigned FLAC__stream_encoder_get_channels(const FLAC__StreamEncoder *encoder); + +/** Get the input sample resolution setting. + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval unsigned + * See FLAC__stream_encoder_set_bits_per_sample(). + */ +FLAC_API unsigned FLAC__stream_encoder_get_bits_per_sample(const FLAC__StreamEncoder *encoder); + +/** Get the input sample rate setting. + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval unsigned + * See FLAC__stream_encoder_set_sample_rate(). + */ +FLAC_API unsigned FLAC__stream_encoder_get_sample_rate(const FLAC__StreamEncoder *encoder); + +/** Get the blocksize setting. + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval unsigned + * See FLAC__stream_encoder_set_blocksize(). + */ +FLAC_API unsigned FLAC__stream_encoder_get_blocksize(const FLAC__StreamEncoder *encoder); + +/** Get the maximum LPC order setting. + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval unsigned + * See FLAC__stream_encoder_set_max_lpc_order(). + */ +FLAC_API unsigned FLAC__stream_encoder_get_max_lpc_order(const FLAC__StreamEncoder *encoder); + +/** Get the quantized linear predictor coefficient precision setting. + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval unsigned + * See FLAC__stream_encoder_set_qlp_coeff_precision(). + */ +FLAC_API unsigned FLAC__stream_encoder_get_qlp_coeff_precision(const FLAC__StreamEncoder *encoder); + +/** Get the qlp coefficient precision search flag. + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * See FLAC__stream_encoder_set_do_qlp_coeff_prec_search(). + */ +FLAC_API FLAC__bool FLAC__stream_encoder_get_do_qlp_coeff_prec_search(const FLAC__StreamEncoder *encoder); + +/** Get the "escape coding" flag. + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * See FLAC__stream_encoder_set_do_escape_coding(). + */ +FLAC_API FLAC__bool FLAC__stream_encoder_get_do_escape_coding(const FLAC__StreamEncoder *encoder); + +/** Get the exhaustive model search flag. + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * See FLAC__stream_encoder_set_do_exhaustive_model_search(). + */ +FLAC_API FLAC__bool FLAC__stream_encoder_get_do_exhaustive_model_search(const FLAC__StreamEncoder *encoder); + +/** Get the minimum residual partition order setting. + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval unsigned + * See FLAC__stream_encoder_set_min_residual_partition_order(). + */ +FLAC_API unsigned FLAC__stream_encoder_get_min_residual_partition_order(const FLAC__StreamEncoder *encoder); + +/** Get maximum residual partition order setting. + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval unsigned + * See FLAC__stream_encoder_set_max_residual_partition_order(). + */ +FLAC_API unsigned FLAC__stream_encoder_get_max_residual_partition_order(const FLAC__StreamEncoder *encoder); + +/** Get the Rice parameter search distance setting. + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval unsigned + * See FLAC__stream_encoder_set_rice_parameter_search_dist(). + */ +FLAC_API unsigned FLAC__stream_encoder_get_rice_parameter_search_dist(const FLAC__StreamEncoder *encoder); + +/** Get the previously set estimate of the total samples to be encoded. + * The encoder merely mimics back the value given to + * FLAC__stream_encoder_set_total_samples_estimate() since it has no + * other way of knowing how many samples the user will encode. + * + * \param encoder An encoder instance to set. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__uint64 + * See FLAC__stream_encoder_get_total_samples_estimate(). + */ +FLAC_API FLAC__uint64 FLAC__stream_encoder_get_total_samples_estimate(const FLAC__StreamEncoder *encoder); + +/** Initialize the encoder instance. + * Should be called after FLAC__stream_encoder_new() and + * FLAC__stream_encoder_set_*() but before FLAC__stream_encoder_process() + * or FLAC__stream_encoder_process_interleaved(). Will set and return + * the encoder state, which will be FLAC__STREAM_ENCODER_OK if + * initialization succeeded. + * + * The call to FLAC__stream_encoder_init() currently will also immediately + * call the write callback several times, once with the \c fLaC signature, + * and once for each encoded metadata block. + * + * \param encoder An uninitialized encoder instance. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__StreamEncoderState + * \c FLAC__STREAM_ENCODER_OK if initialization was successful; see + * FLAC__StreamEncoderState for the meanings of other return values. + */ +FLAC_API FLAC__StreamEncoderState FLAC__stream_encoder_init(FLAC__StreamEncoder *encoder); + +/** Finish the encoding process. + * Flushes the encoding buffer, releases resources, resets the encoder + * settings to their defaults, and returns the encoder state to + * FLAC__STREAM_ENCODER_UNINITIALIZED. Note that this can generate + * one or more write callbacks before returning, and will generate + * a metadata callback. + * + * In the event of a prematurely-terminated encode, it is not strictly + * necessary to call this immediately before FLAC__stream_encoder_delete() + * but it is good practice to match every FLAC__stream_encoder_init() + * with a FLAC__stream_encoder_finish(). + * + * \param encoder An uninitialized encoder instance. + * \assert + * \code encoder != NULL \endcode + */ +FLAC_API void FLAC__stream_encoder_finish(FLAC__StreamEncoder *encoder); + +/** Submit data for encoding. + * This version allows you to supply the input data via an array of + * pointers, each pointer pointing to an array of \a samples samples + * representing one channel. The samples need not be block-aligned, + * but each channel should have the same number of samples. + * + * \param encoder An initialized encoder instance in the OK state. + * \param buffer An array of pointers to each channel's signal. + * \param samples The number of samples in one channel. + * \assert + * \code encoder != NULL \endcode + * \code FLAC__stream_encoder_get_state(encoder) == FLAC__STREAM_ENCODER_OK \endcode + * \retval FLAC__bool + * \c true if successful, else \c false; in this case, check the + * encoder state with FLAC__stream_encoder_get_state() to see what + * went wrong. + */ +FLAC_API FLAC__bool FLAC__stream_encoder_process(FLAC__StreamEncoder *encoder, const FLAC__int32 * const buffer[], unsigned samples); + +/** Submit data for encoding. + * This version allows you to supply the input data where the channels + * are interleaved into a single array (i.e. channel0_sample0, + * channel1_sample0, ... , channelN_sample0, channel0_sample1, ...). + * The samples need not be block-aligned but they must be + * sample-aligned, i.e. the first value should be channel0_sample0 + * and the last value channelN_sampleM. + * + * \param encoder An initialized encoder instance in the OK state. + * \param buffer An array of channel-interleaved data (see above). + * \param samples The number of samples in one channel, the same as for + * FLAC__stream_encoder_process(). For example, if + * encoding two channels, \c 1000 \a samples corresponds + * to a \a buffer of 2000 values. + * \assert + * \code encoder != NULL \endcode + * \code FLAC__stream_encoder_get_state(encoder) == FLAC__STREAM_ENCODER_OK \endcode + * \retval FLAC__bool + * \c true if successful, else \c false; in this case, check the + * encoder state with FLAC__stream_encoder_get_state() to see what + * went wrong. + */ +FLAC_API FLAC__bool FLAC__stream_encoder_process_interleaved(FLAC__StreamEncoder *encoder, const FLAC__int32 buffer[], unsigned samples); + +/* \} */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Libraries/FLAC/Files/include/OggFLAC/Makefile.am b/Libraries/FLAC/Files/include/OggFLAC/Makefile.am new file mode 100644 index 000000000..668ab4562 --- /dev/null +++ b/Libraries/FLAC/Files/include/OggFLAC/Makefile.am @@ -0,0 +1,44 @@ +# libOggFLAC - Free Lossless Audio Codec + Ogg library +# Copyright (C) 2002,2003,2004,2005 Josh Coalson +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# - Neither the name of the Xiph.org Foundation nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +oggflaccincludedir = $(includedir)/OggFLAC + +# NOTE: file_decoder.h and seekable_stream_decoder.h are NOT ready +# for distribution yet. + +oggflaccinclude_HEADERS = \ + all.h \ + export.h \ + file_decoder.h \ + file_encoder.h \ + seekable_stream_decoder.h \ + seekable_stream_encoder.h \ + stream_decoder.h \ + stream_encoder.h diff --git a/Libraries/FLAC/Files/include/OggFLAC/Makefile.in b/Libraries/FLAC/Files/include/OggFLAC/Makefile.in new file mode 100644 index 000000000..e58dec3df --- /dev/null +++ b/Libraries/FLAC/Files/include/OggFLAC/Makefile.in @@ -0,0 +1,485 @@ +# Makefile.in generated by automake 1.8.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# libOggFLAC - Free Lossless Audio Codec + Ogg library +# Copyright (C) 2002,2003,2004,2005 Josh Coalson +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# - Neither the name of the Xiph.org Foundation nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../.. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_triplet = @host@ +subdir = include/OggFLAC +DIST_COMMON = $(oggflaccinclude_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(mkdir_p) +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +am__installdirs = "$(DESTDIR)$(oggflaccincludedir)" +oggflaccincludeHEADERS_INSTALL = $(INSTALL_HEADER) +HEADERS = $(oggflaccinclude_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCAS = @CCAS@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEBUG_FALSE = @DEBUG_FALSE@ +DEBUG_TRUE = @DEBUG_TRUE@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DOCBOOK_TO_MAN = @DOCBOOK_TO_MAN@ +DOXYGEN = @DOXYGEN@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FLaC__CPU_IA32_FALSE = @FLaC__CPU_IA32_FALSE@ +FLaC__CPU_IA32_TRUE = @FLaC__CPU_IA32_TRUE@ +FLaC__CPU_PPC_FALSE = @FLaC__CPU_PPC_FALSE@ +FLaC__CPU_PPC_TRUE = @FLaC__CPU_PPC_TRUE@ +FLaC__CPU_SPARC_FALSE = @FLaC__CPU_SPARC_FALSE@ +FLaC__CPU_SPARC_TRUE = @FLaC__CPU_SPARC_TRUE@ +FLaC__EXHAUSTIVE_TESTS_FALSE = @FLaC__EXHAUSTIVE_TESTS_FALSE@ +FLaC__EXHAUSTIVE_TESTS_TRUE = @FLaC__EXHAUSTIVE_TESTS_TRUE@ +FLaC__HAS_AS_FALSE = @FLaC__HAS_AS_FALSE@ +FLaC__HAS_AS_TRUE = @FLaC__HAS_AS_TRUE@ +FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@ +FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@ +FLaC__HAS_DOCBOOK_TO_MAN_FALSE = @FLaC__HAS_DOCBOOK_TO_MAN_FALSE@ +FLaC__HAS_DOCBOOK_TO_MAN_TRUE = @FLaC__HAS_DOCBOOK_TO_MAN_TRUE@ +FLaC__HAS_DOXYGEN_FALSE = @FLaC__HAS_DOXYGEN_FALSE@ +FLaC__HAS_DOXYGEN_TRUE = @FLaC__HAS_DOXYGEN_TRUE@ +FLaC__HAS_GAS_FALSE = @FLaC__HAS_GAS_FALSE@ +FLaC__HAS_GAS_TRUE = @FLaC__HAS_GAS_TRUE@ +FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@ +FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@ +FLaC__HAS_NASM_FALSE = @FLaC__HAS_NASM_FALSE@ +FLaC__HAS_NASM_TRUE = @FLaC__HAS_NASM_TRUE@ +FLaC__HAS_OGG_FALSE = @FLaC__HAS_OGG_FALSE@ +FLaC__HAS_OGG_TRUE = @FLaC__HAS_OGG_TRUE@ +FLaC__HAS_XMMS_FALSE = @FLaC__HAS_XMMS_FALSE@ +FLaC__HAS_XMMS_TRUE = @FLaC__HAS_XMMS_TRUE@ +FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE@ +FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE@ +FLaC__NO_ASM_FALSE = @FLaC__NO_ASM_FALSE@ +FLaC__NO_ASM_TRUE = @FLaC__NO_ASM_TRUE@ +FLaC__SSE_OS_FALSE = @FLaC__SSE_OS_FALSE@ +FLaC__SSE_OS_TRUE = @FLaC__SSE_OS_TRUE@ +FLaC__SYS_DARWIN_FALSE = @FLaC__SYS_DARWIN_FALSE@ +FLaC__SYS_DARWIN_TRUE = @FLaC__SYS_DARWIN_TRUE@ +FLaC__SYS_LINUX_FALSE = @FLaC__SYS_LINUX_FALSE@ +FLaC__SYS_LINUX_TRUE = @FLaC__SYS_LINUX_TRUE@ +FLaC__USE_3DNOW_FALSE = @FLaC__USE_3DNOW_FALSE@ +FLaC__USE_3DNOW_TRUE = @FLaC__USE_3DNOW_TRUE@ +FLaC__USE_ALTIVEC_FALSE = @FLaC__USE_ALTIVEC_FALSE@ +FLaC__USE_ALTIVEC_TRUE = @FLaC__USE_ALTIVEC_TRUE@ +FLaC__VALGRIND_TESTING_FALSE = @FLaC__VALGRIND_TESTING_FALSE@ +FLaC__VALGRIND_TESTING_TRUE = @FLaC__VALGRIND_TESTING_TRUE@ +GAS = @GAS@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +NASM = @NASM@ +OBJEXT = @OBJEXT@ +OBJ_FORMAT = @OBJ_FORMAT@ +OGG_CFLAGS = @OGG_CFLAGS@ +OGG_LIBS = @OGG_LIBS@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +XMMS_CFLAGS = @XMMS_CFLAGS@ +XMMS_CONFIG = @XMMS_CONFIG@ +XMMS_DATA_DIR = @XMMS_DATA_DIR@ +XMMS_EFFECT_PLUGIN_DIR = @XMMS_EFFECT_PLUGIN_DIR@ +XMMS_GENERAL_PLUGIN_DIR = @XMMS_GENERAL_PLUGIN_DIR@ +XMMS_INPUT_PLUGIN_DIR = @XMMS_INPUT_PLUGIN_DIR@ +XMMS_LIBS = @XMMS_LIBS@ +XMMS_OUTPUT_PLUGIN_DIR = @XMMS_OUTPUT_PLUGIN_DIR@ +XMMS_PLUGIN_DIR = @XMMS_PLUGIN_DIR@ +XMMS_VERSION = @XMMS_VERSION@ +XMMS_VISUALIZATION_PLUGIN_DIR = @XMMS_VISUALIZATION_PLUGIN_DIR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +oggflaccincludedir = $(includedir)/OggFLAC + +# NOTE: file_decoder.h and seekable_stream_decoder.h are NOT ready +# for distribution yet. +oggflaccinclude_HEADERS = \ + all.h \ + export.h \ + file_decoder.h \ + file_encoder.h \ + seekable_stream_decoder.h \ + seekable_stream_encoder.h \ + stream_decoder.h \ + stream_encoder.h + +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign include/OggFLAC/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign include/OggFLAC/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: +install-oggflaccincludeHEADERS: $(oggflaccinclude_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(oggflaccincludedir)" || $(mkdir_p) "$(DESTDIR)$(oggflaccincludedir)" + @list='$(oggflaccinclude_HEADERS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(oggflaccincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(oggflaccincludedir)/$$f'"; \ + $(oggflaccincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(oggflaccincludedir)/$$f"; \ + done + +uninstall-oggflaccincludeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(oggflaccinclude_HEADERS)'; for p in $$list; do \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " rm -f '$(DESTDIR)$(oggflaccincludedir)/$$f'"; \ + rm -f "$(DESTDIR)$(oggflaccincludedir)/$$f"; \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(oggflaccincludedir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-libtool \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: install-oggflaccincludeHEADERS + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am uninstall-oggflaccincludeHEADERS + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool ctags distclean distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-oggflaccincludeHEADERS \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-info-am \ + uninstall-oggflaccincludeHEADERS + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/Libraries/FLAC/Files/include/OggFLAC/all.h b/Libraries/FLAC/Files/include/OggFLAC/all.h new file mode 100644 index 000000000..cf4b0b521 --- /dev/null +++ b/Libraries/FLAC/Files/include/OggFLAC/all.h @@ -0,0 +1,55 @@ +/* libOggFLAC - Free Lossless Audio Codec + Ogg library + * Copyright (C) 2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef OggFLAC__ALL_H +#define OggFLAC__ALL_H + +/* NOTE: file_decoder.h and seekable_stream_decoder.h are NOT ready + * for distribution yet. + */ + +#include "export.h" + +#include "file_decoder.h" +#include "file_encoder.h" +#include "seekable_stream_decoder.h" +#include "seekable_stream_encoder.h" +#include "stream_decoder.h" +#include "stream_encoder.h" + +/** \defgroup oggflac OggFLAC C API + * + * The OggFLAC C API is the interface to libOggFLAC, a set of encoders + * and decoders that wrap around the libFLAC API to provide encoding + * to and decoding from FLAC streams in an Ogg transport. + */ + +#endif diff --git a/Libraries/FLAC/Files/include/OggFLAC/export.h b/Libraries/FLAC/Files/include/OggFLAC/export.h new file mode 100644 index 000000000..0347680c5 --- /dev/null +++ b/Libraries/FLAC/Files/include/OggFLAC/export.h @@ -0,0 +1,47 @@ +/* libOggFLAC - Free Lossless Audio Codec + Ogg library + * Copyright (C) 2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef OggFLAC__EXPORT_H +#define OggFLAC__EXPORT_H + +#if defined(FLAC__NO_DLL) || !defined(_MSC_VER) +#define OggFLAC_API + +#else + +#ifdef OggFLAC_API_EXPORTS +#define OggFLAC_API _declspec(dllexport) +#else +#define OggFLAC_API _declspec(dllimport) + +#endif +#endif +#endif diff --git a/Libraries/FLAC/Files/include/OggFLAC/file_decoder.h b/Libraries/FLAC/Files/include/OggFLAC/file_decoder.h new file mode 100644 index 000000000..019774ffa --- /dev/null +++ b/Libraries/FLAC/Files/include/OggFLAC/file_decoder.h @@ -0,0 +1,621 @@ +/* libOggFLAC - Free Lossless Audio Codec + Ogg library + * Copyright (C) 2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef OggFLAC__FILE_DECODER_H +#define OggFLAC__FILE_DECODER_H + +#include "export.h" + +#include "seekable_stream_decoder.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +/** \file include/OggFLAC/file_decoder.h + * + * \brief + * This module contains the functions which implement the file + * decoder. + * + * See the detailed documentation in the + * \link oggflac_file_decoder file decoder \endlink module. + */ + +/** \defgroup oggflac_file_decoder OggFLAC/file_decoder.h: file decoder interface + * \ingroup oggflac_decoder + * + * \brief + * This module contains the functions which implement the file + * decoder. + * + * The interface here is nearly identical to FLAC's file decoder, + * including the callbacks, with the addition of + * OggFLAC__file_decoder_set_serial_number(). See the + * \link flac_file_decoder FLAC file decoder module \endlink + * for full documentation. + * + * \{ + */ + + +/** State values for an OggFLAC__FileDecoder + * + * The decoder's state can be obtained by calling OggFLAC__file_decoder_get_state(). + */ +typedef enum { + + OggFLAC__FILE_DECODER_OK = 0, + /**< The decoder is in the normal OK state. */ + + OggFLAC__FILE_DECODER_END_OF_FILE, + /**< The decoder has reached the end of the file. */ + + OggFLAC__FILE_DECODER_ERROR_OPENING_FILE, + /**< An error occurred opening the input file. */ + + OggFLAC__FILE_DECODER_SEEK_ERROR, + /**< An error occurred while seeking. */ + + OggFLAC__FILE_DECODER_SEEKABLE_STREAM_DECODER_ERROR, + /**< An error occurred in the underlying seekable stream decoder; + * check OggFLAC__file_decoder_get_seekable_stream_decoder_state(). + */ + + OggFLAC__FILE_DECODER_MEMORY_ALLOCATION_ERROR, + /**< Memory allocation failed. */ + + OggFLAC__FILE_DECODER_ALREADY_INITIALIZED, + /**< OggFLAC__file_decoder_init() was called when the decoder was + * already initialized, usually because + * OggFLAC__file_decoder_finish() was not called. + */ + + OggFLAC__FILE_DECODER_INVALID_CALLBACK, + /**< The decoder was initialized before setting all the required callbacks. */ + + OggFLAC__FILE_DECODER_UNINITIALIZED + /**< The decoder is in the uninitialized state. */ + +} OggFLAC__FileDecoderState; + +/** Maps an OggFLAC__FileDecoderState to a C string. + * + * Using an OggFLAC__FileDecoderState as the index to this array + * will give the string equivalent. The contents should not be modified. + */ +extern OggFLAC_API const char * const OggFLAC__FileDecoderStateString[]; + + +/*********************************************************************** + * + * class OggFLAC__FileDecoder : public OggFLAC__SeekableStreamDecoder + * + ***********************************************************************/ + +struct OggFLAC__FileDecoderProtected; +struct OggFLAC__FileDecoderPrivate; +/** The opaque structure definition for the file decoder type. See the + * \link oggflac_file_decoder file decoder module \endlink for a detailed + * description. + */ +typedef struct { + struct OggFLAC__FileDecoderProtected *protected_; /* avoid the C++ keyword 'protected' */ + struct OggFLAC__FileDecoderPrivate *private_; /* avoid the C++ keyword 'private' */ +} OggFLAC__FileDecoder; + +/** Signature for the write callback. + * See OggFLAC__file_decoder_set_write_callback() + * and OggFLAC__SeekableStreamDecoderWriteCallback for more info. + * + * \param decoder The decoder instance calling the callback. + * \param frame The description of the decoded frame. + * \param buffer An array of pointers to decoded channels of data. + * \param client_data The callee's client data set through + * OggFLAC__file_decoder_set_client_data(). + * \retval FLAC__StreamDecoderWriteStatus + * The callee's return status. + */ +typedef FLAC__StreamDecoderWriteStatus (*OggFLAC__FileDecoderWriteCallback)(const OggFLAC__FileDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data); + +/** Signature for the metadata callback. + * See OggFLAC__file_decoder_set_metadata_callback() + * and OggFLAC__SeekableStreamDecoderMetadataCallback for more info. + * + * \param decoder The decoder instance calling the callback. + * \param metadata The decoded metadata block. + * \param client_data The callee's client data set through + * OggFLAC__file_decoder_set_client_data(). + */ +typedef void (*OggFLAC__FileDecoderMetadataCallback)(const OggFLAC__FileDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data); + +/** Signature for the error callback. + * See OggFLAC__file_decoder_set_error_callback() + * and OggFLAC__SeekableStreamDecoderErrorCallback for more info. + * + * \param decoder The decoder instance calling the callback. + * \param status The error encountered by the decoder. + * \param client_data The callee's client data set through + * OggFLAC__file_decoder_set_client_data(). + */ +typedef void (*OggFLAC__FileDecoderErrorCallback)(const OggFLAC__FileDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data); + + +/*********************************************************************** + * + * Class constructor/destructor + * + ***********************************************************************/ + +/** Create a new file decoder instance. The instance is created with + * default settings; see the individual OggFLAC__file_decoder_set_*() + * functions for each setting's default. + * + * \retval OggFLAC__FileDecoder* + * \c NULL if there was an error allocating memory, else the new instance. + */ +OggFLAC_API OggFLAC__FileDecoder *OggFLAC__file_decoder_new(); + +/** Free a decoder instance. Deletes the object pointed to by \a decoder. + * + * \param decoder A pointer to an existing decoder. + * \assert + * \code decoder != NULL \endcode + */ +OggFLAC_API void OggFLAC__file_decoder_delete(OggFLAC__FileDecoder *decoder); + + +/*********************************************************************** + * + * Public class method prototypes + * + ***********************************************************************/ + +/** Set the "MD5 signature checking" flag. + * This is inherited from FLAC__FileDecoder; see + * FLAC__file_decoder_set_md5_checking(). + * + * \default \c false + * \param decoder A decoder instance to set. + * \param value See above. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__file_decoder_set_md5_checking(OggFLAC__FileDecoder *decoder, FLAC__bool value); + +/** Set the input file name to decode. + * This is inherited from FLAC__FileDecoder; see + * FLAC__file_decoder_set_filename(). + * + * \default \c "-" + * \param decoder A decoder instance to set. + * \param value The input file name, or "-" for \c stdin. + * \assert + * \code decoder != NULL \endcode + * \code value != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, or there was a memory + * allocation error, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__file_decoder_set_filename(OggFLAC__FileDecoder *decoder, const char *value); + +/** Set the write callback. + * This is inherited from FLAC__FileDecoder; see + * FLAC__file_decoder_set_write_callback(). + * + * \note + * The callback is mandatory and must be set before initialization. + * + * \default \c NULL + * \param decoder A decoder instance to set. + * \param value See above. + * \assert + * \code decoder != NULL \endcode + * \code value != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__file_decoder_set_write_callback(OggFLAC__FileDecoder *decoder, OggFLAC__FileDecoderWriteCallback value); + +/** Set the metadata callback. + * This is inherited from FLAC__FileDecoder; see + * FLAC__file_decoder_set_metadata_callback(). + * + * \note + * The callback is mandatory and must be set before initialization. + * + * \default \c NULL + * \param decoder A decoder instance to set. + * \param value See above. + * \assert + * \code decoder != NULL \endcode + * \code value != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__file_decoder_set_metadata_callback(OggFLAC__FileDecoder *decoder, OggFLAC__FileDecoderMetadataCallback value); + +/** Set the error callback. + * This is inherited from FLAC__FileDecoder; see + * FLAC__file_decoder_set_error_callback(). + * + * \note + * The callback is mandatory and must be set before initialization. + * + * \default \c NULL + * \param decoder A decoder instance to set. + * \param value See above. + * \assert + * \code decoder != NULL \endcode + * \code value != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__file_decoder_set_error_callback(OggFLAC__FileDecoder *decoder, OggFLAC__FileDecoderErrorCallback value); + +/** Set the client data to be passed back to callbacks. + * This value will be supplied to callbacks in their \a client_data + * argument. + * + * \default \c NULL + * \param decoder A decoder instance to set. + * \param value See above. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__file_decoder_set_client_data(OggFLAC__FileDecoder *decoder, void *value); + +/** Set the serial number for the Ogg stream. + * The default behavior is to use the serial number of the first Ogg + * page. Setting a serial number here will explicitly specify which + * stream is to be decoded. + * + * \default \c use serial number of first page + * \param decoder A decoder instance to set. + * \param serial_number See above. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__file_decoder_set_serial_number(OggFLAC__FileDecoder *decoder, long serial_number); + +/** This is inherited from FLAC__FileDecoder; see + * FLAC__file_decoder_set_metadata_respond(). + * + * \default By default, only the \c STREAMINFO block is returned via the + * metadata callback. + * \param decoder A decoder instance to set. + * \param type See above. + * \assert + * \code decoder != NULL \endcode + * \a type is valid + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__file_decoder_set_metadata_respond(OggFLAC__FileDecoder *decoder, FLAC__MetadataType type); + +/** This is inherited from FLAC__FileDecoder; see + * FLAC__file_decoder_set_metadata_respond_application(). + * + * \default By default, only the \c STREAMINFO block is returned via the + * metadata callback. + * \param decoder A decoder instance to set. + * \param id See above. + * \assert + * \code decoder != NULL \endcode + * \code id != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__file_decoder_set_metadata_respond_application(OggFLAC__FileDecoder *decoder, const FLAC__byte id[4]); + +/** This is inherited from FLAC__FileDecoder; see + * FLAC__file_decoder_set_metadata_respond_all(). + * + * \default By default, only the \c STREAMINFO block is returned via the + * metadata callback. + * \param decoder A decoder instance to set. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__file_decoder_set_metadata_respond_all(OggFLAC__FileDecoder *decoder); + +/** This is inherited from FLAC__FileDecoder; see + * FLAC__file_decoder_set_metadata_ignore(). + * + * \default By default, only the \c STREAMINFO block is returned via the + * metadata callback. + * \param decoder A decoder instance to set. + * \param type See above. + * \assert + * \code decoder != NULL \endcode + * \a type is valid + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__file_decoder_set_metadata_ignore(OggFLAC__FileDecoder *decoder, FLAC__MetadataType type); + +/** This is inherited from FLAC__FileDecoder; see + * FLAC__file_decoder_set_metadata_ignore_application(). + * + * \default By default, only the \c STREAMINFO block is returned via the + * metadata callback. + * \param decoder A decoder instance to set. + * \param id See above. + * \assert + * \code decoder != NULL \endcode + * \code id != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__file_decoder_set_metadata_ignore_application(OggFLAC__FileDecoder *decoder, const FLAC__byte id[4]); + +/** This is inherited from FLAC__FileDecoder; see + * FLAC__file_decoder_set_metadata_ignore_all(). + * + * \default By default, only the \c STREAMINFO block is returned via the + * metadata callback. + * \param decoder A decoder instance to set. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__file_decoder_set_metadata_ignore_all(OggFLAC__FileDecoder *decoder); + +/** Get the current decoder state. + * + * \param decoder A decoder instance to query. + * \assert + * \code decoder != NULL \endcode + * \retval OggFLAC__FileDecoderState + * The current decoder state. + */ +OggFLAC_API OggFLAC__FileDecoderState OggFLAC__file_decoder_get_state(const OggFLAC__FileDecoder *decoder); + +/** Get the state of the underlying seekable stream decoder. + * Useful when the file decoder state is + * \c OggFLAC__FILE_DECODER_SEEKABLE_STREAM_DECODER_ERROR. + * + * \param decoder A decoder instance to query. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__FileDecoderState + * The seekable stream decoder state. + */ +OggFLAC_API OggFLAC__SeekableStreamDecoderState OggFLAC__file_decoder_get_seekable_stream_decoder_state(const OggFLAC__FileDecoder *decoder); + +/** Get the state of the underlying stream decoder. + * Useful when the file decoder state is + * \c OggFLAC__FILE_DECODER_SEEKABLE_STREAM_DECODER_ERROR + * and the seekable stream decoder state is + * \c OggFLAC__SEEKABLE_STREAM_DECODER_STREAM_DECODER_ERROR. + * + * \param decoder A decoder instance to query. + * \assert + * \code decoder != NULL \endcode + * \retval OggFLAC__StreamDecoderState + * The stream decoder state. + */ +OggFLAC_API OggFLAC__StreamDecoderState OggFLAC__file_decoder_get_stream_decoder_state(const OggFLAC__FileDecoder *decoder); + +/** Get the state of the underlying FLAC stream decoder. + * Useful when the file decoder state is + * \c OggFLAC__FILE_DECODER_SEEKABLE_STREAM_DECODER_ERROR + * and the seekable stream decoder state is + * \c OggFLAC__SEEKABLE_STREAM_DECODER_STREAM_DECODER_ERROR + * and the stream decoder state is + * \c OggFLAC__STREAM_DECODER_FLAC_STREAM_DECODER_ERROR. + * + * \param decoder A decoder instance to query. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__StreamDecoderState + * The FLAC stream decoder state. + */ +OggFLAC_API FLAC__StreamDecoderState OggFLAC__file_decoder_get_FLAC_stream_decoder_state(const OggFLAC__FileDecoder *decoder); + +/** Get the current decoder state as a C string. + * This version automatically resolves + * \c OggFLAC__FILE_DECODER_SEEKABLE_STREAM_DECODER_ERROR + * by getting the seekable stream decoder's state. + * + * \param decoder A decoder instance to query. + * \assert + * \code decoder != NULL \endcode + * \retval const char * + * The decoder state as a C string. Do not modify the contents. + */ +OggFLAC_API const char *OggFLAC__file_decoder_get_resolved_state_string(const OggFLAC__FileDecoder *decoder); + +/** This is inherited from FLAC__FileDecoder; see + * FLAC__file_decoder_get_md5_checking(). + * + * \param decoder A decoder instance to query. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * See above. + */ +OggFLAC_API FLAC__bool OggFLAC__file_decoder_get_md5_checking(const OggFLAC__FileDecoder *decoder); + +/** This is inherited from FLAC__FileDecoder; see + * FLAC__file_decoder_get_channels(). + * + * \param decoder A decoder instance to query. + * \assert + * \code decoder != NULL \endcode + * \retval unsigned + * See above. + */ +OggFLAC_API unsigned OggFLAC__file_decoder_get_channels(const OggFLAC__FileDecoder *decoder); + +/** This is inherited from FLAC__FileDecoder; see + * FLAC__file_decoder_get_channel_assignment(). + * + * \param decoder A decoder instance to query. + * \assert + * \code decoder != NULL \endcode + * \retval OggFLAC__ChannelAssignment + * See above. + */ +OggFLAC_API FLAC__ChannelAssignment OggFLAC__file_decoder_get_channel_assignment(const OggFLAC__FileDecoder *decoder); + +/** This is inherited from FLAC__FileDecoder; see + * FLAC__file_decoder_get_bits_per_sample(). + * + * \param decoder A decoder instance to query. + * \assert + * \code decoder != NULL \endcode + * \retval unsigned + * See above. + */ +OggFLAC_API unsigned OggFLAC__file_decoder_get_bits_per_sample(const OggFLAC__FileDecoder *decoder); + +/** This is inherited from FLAC__FileDecoder; see + * FLAC__file_decoder_get_sample_rate(). + * + * \param decoder A decoder instance to query. + * \assert + * \code decoder != NULL \endcode + * \retval unsigned + * See above. + */ +OggFLAC_API unsigned OggFLAC__file_decoder_get_sample_rate(const OggFLAC__FileDecoder *decoder); + +/** This is inherited from FLAC__FileDecoder; see + * FLAC__file_decoder_get_blocksize(). + * + * \param decoder A decoder instance to query. + * \assert + * \code decoder != NULL \endcode + * \retval unsigned + * See above. + */ +OggFLAC_API unsigned OggFLAC__file_decoder_get_blocksize(const OggFLAC__FileDecoder *decoder); + +/** Initialize the decoder instance. + * Should be called after OggFLAC__file_decoder_new() and + * OggFLAC__file_decoder_set_*() but before any of the + * OggFLAC__file_decoder_process_*() functions. Will set and return + * the decoder state, which will be OggFLAC__FILE_DECODER_OK if + * initialization succeeded. + * + * \param decoder An uninitialized decoder instance. + * \assert + * \code decoder != NULL \endcode + * \retval OggFLAC__FileDecoderState + * \c OggFLAC__FILE_DECODER_OK if initialization was successful; see + * OggFLAC__FileDecoderState for the meanings of other return values. + */ +OggFLAC_API OggFLAC__FileDecoderState OggFLAC__file_decoder_init(OggFLAC__FileDecoder *decoder); + +/** Finish the decoding process. + * Flushes the decoding buffer, releases resources, resets the decoder + * settings to their defaults, and returns the decoder state to + * OggFLAC__FILE_DECODER_UNINITIALIZED. + * + * In the event of a prematurely-terminated decode, it is not strictly + * necessary to call this immediately before OggFLAC__file_decoder_delete() + * but it is good practice to match every OggFLAC__file_decoder_init() with + * an OggFLAC__file_decoder_finish(). + * + * \param decoder An uninitialized decoder instance. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * \c false if MD5 checking is on AND a STREAMINFO block was available + * AND the MD5 signature in the STREAMINFO block was non-zero AND the + * signature does not match the one computed by the decoder; else + * \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__file_decoder_finish(OggFLAC__FileDecoder *decoder); + +/** This is inherited from FLAC__FileDecoder; see + * FLAC__file_decoder_process_single(). + * + * \param decoder A decoder instance. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * See above. + */ +OggFLAC_API FLAC__bool OggFLAC__file_decoder_process_single(OggFLAC__FileDecoder *decoder); + +/** This is inherited from FLAC__FileDecoder; see + * FLAC__file_decoder_process_until_end_of_metadata(). + * + * \param decoder A decoder instance. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * See above. + */ +OggFLAC_API FLAC__bool OggFLAC__file_decoder_process_until_end_of_metadata(OggFLAC__FileDecoder *decoder); + +/** This is inherited from FLAC__FileDecoder; see + * FLAC__file_decoder_process_until_end_of_stream(). + * + * \param decoder A decoder instance. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * See above. + */ +OggFLAC_API FLAC__bool OggFLAC__file_decoder_process_until_end_of_file(OggFLAC__FileDecoder *decoder); + +/** This is inherited from OggFLAC__SeekableStreamDecoder; see + * OggFLAC__seekable_stream_decoder_seek_absolute(). + * + * \param decoder A decoder instance. + * \param sample The target sample number to seek to. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * \c true if successful, else \c false. + */ +OggFLAC_API FLAC__bool OggFLAC__file_decoder_seek_absolute(OggFLAC__FileDecoder *decoder, FLAC__uint64 sample); + +/* \} */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Libraries/FLAC/Files/include/OggFLAC/file_encoder.h b/Libraries/FLAC/Files/include/OggFLAC/file_encoder.h new file mode 100644 index 000000000..0f0024e0e --- /dev/null +++ b/Libraries/FLAC/Files/include/OggFLAC/file_encoder.h @@ -0,0 +1,874 @@ +/* libOggFLAC - Free Lossless Audio Codec + Ogg library + * Copyright (C) 2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef OggFLAC__FILE_ENCODER_H +#define OggFLAC__FILE_ENCODER_H + +#include "export.h" +#include "seekable_stream_encoder.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +/** \file include/OggFLAC/file_encoder.h + * + * \brief + * This module contains the functions which implement the file + * encoder. + * + * See the detailed documentation in the + * \link oggflac_file_encoder file encoder \endlink module. + */ + +/** \defgroup oggflac_file_encoder OggFLAC/file_encoder.h: file encoder interface + * \ingroup oggflac_encoder + * + * \brief + * This module contains the functions which implement the file + * encoder. Unlink the Ogg stream and seekable stream encoders, which + * derive from their FLAC counterparts, the Ogg file encoder is derived + * from the Ogg seekable stream encoder. + * + * The interface here is nearly identical to FLAC's file + * encoder, including the callbacks, with the addition of + * OggFLAC__file_encoder_set_serial_number(). See the + * \link flac_file_encoder FLAC file encoder module \endlink + * for full documentation. + * + * \{ + */ + + +/** State values for a OggFLAC__FileEncoder + * + * The encoder's state can be obtained by calling OggFLAC__file_encoder_get_state(). + */ +typedef enum { + + OggFLAC__FILE_ENCODER_OK = 0, + /**< The encoder is in the normal OK state. */ + + OggFLAC__FILE_ENCODER_NO_FILENAME, + /**< OggFLAC__file_encoder_init() was called without first calling + * OggFLAC__file_encoder_set_filename(). + */ + + OggFLAC__FILE_ENCODER_SEEKABLE_STREAM_ENCODER_ERROR, + /**< An error occurred in the underlying seekable stream encoder; + * check OggFLAC__file_encoder_get_seekable_stream_encoder_state(). + */ + + OggFLAC__FILE_ENCODER_FATAL_ERROR_WHILE_WRITING, + /**< A fatal error occurred while writing to the encoded file. */ + + OggFLAC__FILE_ENCODER_ERROR_OPENING_FILE, + /**< An error occurred opening the output file for writing. */ + + OggFLAC__FILE_ENCODER_MEMORY_ALLOCATION_ERROR, + /**< Memory allocation failed. */ + + OggFLAC__FILE_ENCODER_ALREADY_INITIALIZED, + /**< OggFLAC__file_encoder_init() was called when the encoder was + * already initialized, usually because + * OggFLAC__file_encoder_finish() was not called. + */ + + OggFLAC__FILE_ENCODER_UNINITIALIZED + /**< The encoder is in the uninitialized state. */ + +} OggFLAC__FileEncoderState; + +/** Maps a FLAC__FileEncoderState to a C string. + * + * Using a FLAC__FileEncoderState as the index to this array + * will give the string equivalent. The contents should not be modified. + */ +extern OggFLAC_API const char * const OggFLAC__FileEncoderStateString[]; + + +/*********************************************************************** + * + * class FLAC__FileEncoder + * + ***********************************************************************/ + +struct OggFLAC__FileEncoderProtected; +struct OggFLAC__FileEncoderPrivate; +/** The opaque structure definition for the file encoder type. + * See the \link oggflac_file_encoder file encoder module \endlink + * for a detailed description. + */ +typedef struct { + struct OggFLAC__FileEncoderProtected *protected_; /* avoid the C++ keyword 'protected' */ + struct OggFLAC__FileEncoderPrivate *private_; /* avoid the C++ keyword 'private' */ +} OggFLAC__FileEncoder; + +/** Signature for the progress callback. + * See OggFLAC__file_encoder_set_progress_callback() + * and FLAC__FileEncoderProgressCallback for more info. + * + * \param encoder The encoder instance calling the callback. + * \param bytes_written Bytes written so far. + * \param samples_written Samples written so far. + * \param frames_written Frames written so far. + * \param total_frames_estimate The estimate of the total number of + * frames to be written. + * \param client_data The callee's client data set through + * OggFLAC__file_encoder_set_client_data(). + */ +typedef void (*OggFLAC__FileEncoderProgressCallback)(const OggFLAC__FileEncoder *encoder, FLAC__uint64 bytes_written, FLAC__uint64 samples_written, unsigned frames_written, unsigned total_frames_estimate, void *client_data); + + +/*********************************************************************** + * + * Class constructor/destructor + * + ***********************************************************************/ + +/** Create a new file encoder instance. The instance is created with + * default settings; see the individual OggFLAC__file_encoder_set_*() + * functions for each setting's default. + * + * \retval OggFLAC__FileEncoder* + * \c NULL if there was an error allocating memory, else the new instance. + */ +OggFLAC_API OggFLAC__FileEncoder *OggFLAC__file_encoder_new(); + +/** Free an encoder instance. Deletes the object pointed to by \a encoder. + * + * \param encoder A pointer to an existing encoder. + * \assert + * \code encoder != NULL \endcode + */ +OggFLAC_API void OggFLAC__file_encoder_delete(OggFLAC__FileEncoder *encoder); + +/*********************************************************************** + * + * Public class method prototypes + * + ***********************************************************************/ + +/** Set the serial number for the FLAC stream. + * + * \default \c 0 + * \param encoder An encoder instance to set. + * \param serial_number See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__file_encoder_set_serial_number(OggFLAC__FileEncoder *encoder, long serial_number); + +/** This is inherited from OggFLAC__SeekableStreamEncoder; see + * OggFLAC__seekable_stream_encoder_set_verify(). + * + * \default \c true + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__file_encoder_set_verify(OggFLAC__FileEncoder *encoder, FLAC__bool value); + +/** This is inherited from OggFLAC__SeekableStreamEncoder; see + * OggFLAC__seekable_stream_encoder_set_streamable_subset(). + * + * \default \c true + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__file_encoder_set_streamable_subset(OggFLAC__FileEncoder *encoder, FLAC__bool value); + +/** This is inherited from OggFLAC__SeekableStreamEncoder; see + * OggFLAC__seekable_stream_encoder_set_do_mid_side_stereo(). + * + * \default \c false + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__file_encoder_set_do_mid_side_stereo(OggFLAC__FileEncoder *encoder, FLAC__bool value); + +/** This is inherited from OggFLAC__SeekableStreamEncoder; see + * OggFLAC__seekable_stream_encoder_set_loose_mid_side_stereo(). + * + * \default \c false + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__file_encoder_set_loose_mid_side_stereo(OggFLAC__FileEncoder *encoder, FLAC__bool value); + +/** This is inherited from OggFLAC__SeekableStreamEncoder; see + * OggFLAC__seekable_stream_encoder_set_channels(). + * + * \default \c 2 + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__file_encoder_set_channels(OggFLAC__FileEncoder *encoder, unsigned value); + +/** This is inherited from OggFLAC__SeekableStreamEncoder; see + * OggFLAC__seekable_stream_encoder_set_bits_per_sample(). + * + * \warning + * Do not feed the encoder data that is wider than the value you + * set here or you will generate an invalid stream. + * + * \default \c 16 + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__file_encoder_set_bits_per_sample(OggFLAC__FileEncoder *encoder, unsigned value); + +/** This is inherited from OggFLAC__SeekableStreamEncoder; see + * OggFLAC__seekable_stream_encoder_set_sample_rate(). + * + * \default \c 44100 + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__file_encoder_set_sample_rate(OggFLAC__FileEncoder *encoder, unsigned value); + +/** This is inherited from OggFLAC__SeekableStreamEncoder; see + * OggFLAC__seekable_stream_encoder_set_blocksize(). + * + * \default \c 1152 + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__file_encoder_set_blocksize(OggFLAC__FileEncoder *encoder, unsigned value); + +/** This is inherited from OggFLAC__SeekableStreamEncoder; see + * OggFLAC__seekable_stream_encoder_set_max_lpc_order(). + * + * \default \c 0 + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__file_encoder_set_max_lpc_order(OggFLAC__FileEncoder *encoder, unsigned value); + +/** This is inherited from OggFLAC__SeekableStreamEncoder; see + * OggFLAC__seekable_stream_encoder_set_qlp_coeff_precision(). + * + * \note + * In the current implementation, qlp_coeff_precision + bits_per_sample must + * be less than 32. + * + * \default \c 0 + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__file_encoder_set_qlp_coeff_precision(OggFLAC__FileEncoder *encoder, unsigned value); + +/** This is inherited from OggFLAC__SeekableStreamEncoder; see + * OggFLAC__seekable_stream_encoder_set_do_qlp_coeff_prec_search(). + * + * \default \c false + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__file_encoder_set_do_qlp_coeff_prec_search(OggFLAC__FileEncoder *encoder, FLAC__bool value); + +/** This is inherited from OggFLAC__SeekableStreamEncoder; see + * OggFLAC__seekable_stream_encoder_set_do_escape_coding(). + * + * \default \c false + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__file_encoder_set_do_escape_coding(OggFLAC__FileEncoder *encoder, FLAC__bool value); + +/** This is inherited from OggFLAC__SeekableStreamEncoder; see + * OggFLAC__seekable_stream_encoder_set_do_exhaustive_model_search(). + * + * \default \c false + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__file_encoder_set_do_exhaustive_model_search(OggFLAC__FileEncoder *encoder, FLAC__bool value); + +/** This is inherited from OggFLAC__SeekableStreamEncoder; see + * OggFLAC__seekable_stream_encoder_set_min_residual_partition_order(). + * + * \default \c 0 + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__file_encoder_set_min_residual_partition_order(OggFLAC__FileEncoder *encoder, unsigned value); + +/** This is inherited from OggFLAC__SeekableStreamEncoder; see + * OggFLAC__seekable_stream_encoder_set_max_residual_partition_order(). + * + * \default \c 0 + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__file_encoder_set_max_residual_partition_order(OggFLAC__FileEncoder *encoder, unsigned value); + +/** This is inherited from OggFLAC__SeekableStreamEncoder; see + * OggFLAC__seekable_stream_encoder_set_rice_parameter_search_dist(). + * + * \default \c 0 + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__file_encoder_set_rice_parameter_search_dist(OggFLAC__FileEncoder *encoder, unsigned value); + +/** This is inherited from OggFLAC__SeekableStreamEncoder; see + * OggFLAC__seekable_stream_encoder_set_total_samples_estimate(). + * + * \default \c 0 + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__file_encoder_set_total_samples_estimate(OggFLAC__FileEncoder *encoder, FLAC__uint64 value); + +/** This is inherited from OggFLAC__SeekableStreamEncoder; see + * OggFLAC__seekable_stream_encoder_set_metadata(). + * + * \note The Ogg FLAC mapping requires that the VORBIS_COMMENT block be + * the second metadata block of the stream. The encoder already supplies + * the STREAMINFO block automatically. If \a metadata does not contain a + * VORBIS_COMMENT block, the encoder will supply that too. Otherwise, if + * \a metadata does contain a VORBIS_COMMENT block and it is not the + * first, this function will reorder \a metadata by moving the + * VORBIS_COMMENT block to the front; the relative ordering of the other + * blocks will remain as they were. + * + * \note The Ogg FLAC mapping limits the number of metadata blocks per + * stream to \c 65535. If \a num_blocks exceeds this the function will + * return \c false. + * + * \default \c NULL, 0 + * \param encoder An encoder instance to set. + * \param metadata See above. + * \param num_blocks See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, or if + * \a num_blocks > 65535, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__file_encoder_set_metadata(OggFLAC__FileEncoder *encoder, FLAC__StreamMetadata **metadata, unsigned num_blocks); + +/** Set the output file name encode to. + * + * \note + * The filename is mandatory and must be set before initialization. + * + * \note + * Unlike the OggFLAC__FileDecoder, the filename does not interpret "-" for + * \c stdout; writing to \c stdout is not relevant in the file encoder. + * + * \default \c NULL + * \param encoder A encoder instance to set. + * \param value The output file name. + * \assert + * \code encoder != NULL \endcode + * \code value != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, or there was a memory + * allocation error, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__file_encoder_set_filename(OggFLAC__FileEncoder *encoder, const char *value); + +/** Set the progress callback. + * The supplied function will be called when the encoder has finished + * writing a frame. The \c total_frames_estimate argument to the callback + * will be based on the value from + * OggFLAC__file_encoder_set_total_samples_estimate(). + * + * \note + * Unlike most other callbacks, the progress callback is \b not mandatory + * and need not be set before initialization. + * + * \default \c NULL + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \code value != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__file_encoder_set_progress_callback(OggFLAC__FileEncoder *encoder, OggFLAC__FileEncoderProgressCallback value); + +/** Set the client data to be passed back to callbacks. + * This value will be supplied to callbacks in their \a client_data + * argument. + * + * \default \c NULL + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__file_encoder_set_client_data(OggFLAC__FileEncoder *encoder, void *value); + +/** Get the current encoder state. + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__FileEncoderState + * The current encoder state. + */ +OggFLAC_API OggFLAC__FileEncoderState OggFLAC__file_encoder_get_state(const OggFLAC__FileEncoder *encoder); + +/** Get the state of the underlying seekable stream encoder. + * Useful when the file encoder state is + * \c OggFLAC__FILE_ENCODER_SEEKABLE_STREAM_ENCODER_ERROR. + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval OggFLAC__SeekableStreamEncoderState + * The seekable stream encoder state. + */ +OggFLAC_API OggFLAC__SeekableStreamEncoderState OggFLAC__file_encoder_get_seekable_stream_encoder_state(const OggFLAC__FileEncoder *encoder); + +/** Get the state of the underlying FLAC stream encoder. + * Useful when the file encoder state is + * \c OggFLAC__FILE_ENCODER_SEEKABLE_STREAM_ENCODER_ERROR + * and the seekable stream encoder state is + * \c OggFLAC__SEEKABLE_STREAM_ENCODER_FLAC_STREAM_ENCODER_ERROR. + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__StreamEncoderState + * The seekable stream encoder state. + */ +OggFLAC_API FLAC__StreamEncoderState OggFLAC__file_encoder_get_FLAC_stream_encoder_state(const OggFLAC__FileEncoder *encoder); + +/** Get the state of the underlying stream encoder's verify decoder. + * Useful when the file encoder state is + * \c OggFLAC__FILE_ENCODER_SEEKABLE_STREAM_ENCODER_ERROR + * and the seekable stream encoder state is + * \c OggFLAC__SEEKABLE_STREAM_ENCODER_FLAC_STREAM_ENCODER_ERROR + * and the FLAC stream encoder state is + * \c FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR. + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__StreamDecoderState + * The stream encoder state. + */ +OggFLAC_API FLAC__StreamDecoderState OggFLAC__file_encoder_get_verify_decoder_state(const OggFLAC__FileEncoder *encoder); + +/** Get the current encoder state as a C string. + * This version automatically resolves + * \c OggFLAC__FILE_ENCODER_SEEKABLE_STREAM_ENCODER_ERROR by getting the + * seekable stream encoder's state. + * + * \param encoder A encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval const char * + * The encoder state as a C string. Do not modify the contents. + */ +OggFLAC_API const char *OggFLAC__file_encoder_get_resolved_state_string(const OggFLAC__FileEncoder *encoder); + +/** Get relevant values about the nature of a verify decoder error. + * Inherited from OggFLAC__seekable_stream_encoder_get_verify_decoder_error_stats(). + * Useful when the file encoder state is + * \c OggFLAC__FILE_ENCODER_SEEKABLE_STREAM_ENCODER_ERROR + * and the seekable stream encoder state is + * \c OggFLAC__SEEKABLE_STREAM_ENCODER_FLAC_SEEKABLE_STREAM_ENCODER_ERROR + * and the FLAC seekable stream encoder state is + * \c FLAC__SEEKABLE_STREAM_ENCODER_STREAM_ENCODER_ERROR + * and the FLAC stream encoder state is + * \c FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR. + * + * \param encoder An encoder instance to query. + * \param absolute_sample The absolute sample number of the mismatch. + * \param frame_number The number of the frame in which the mismatch occurred. + * \param channel The channel in which the mismatch occurred. + * \param sample The number of the sample (relative to the frame) in + * which the mismatch occurred. + * \param expected The expected value for the sample in question. + * \param got The actual value returned by the decoder. + * \assert + * \code encoder != NULL \endcode + */ +OggFLAC_API void OggFLAC__file_encoder_get_verify_decoder_error_stats(const OggFLAC__FileEncoder *encoder, FLAC__uint64 *absolute_sample, unsigned *frame_number, unsigned *channel, unsigned *sample, FLAC__int32 *expected, FLAC__int32 *got); + +/** Get the "verify" flag. + * This is inherited from OggFLAC__SeekableStreamEncoder; see + * OggFLAC__seekable_stream_encoder_get_verify(). + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * See OggFLAC__file_encoder_set_verify(). + */ +OggFLAC_API FLAC__bool OggFLAC__file_encoder_get_verify(const OggFLAC__FileEncoder *encoder); + +/** Get the "streamable subset" flag. + * This is inherited from OggFLAC__SeekableStreamEncoder; see + * OggFLAC__seekable_stream_encoder_get_streamable_subset(). + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * See OggFLAC__file_encoder_set_streamable_subset(). + */ +OggFLAC_API FLAC__bool OggFLAC__file_encoder_get_streamable_subset(const OggFLAC__FileEncoder *encoder); + +/** Get the "mid/side stereo coding" flag. + * This is inherited from OggFLAC__SeekableStreamEncoder; see + * OggFLAC__seekable_stream_encoder_get_do_mid_side_stereo(). + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * See OggFLAC__file_encoder_get_do_mid_side_stereo(). + */ +OggFLAC_API FLAC__bool OggFLAC__file_encoder_get_do_mid_side_stereo(const OggFLAC__FileEncoder *encoder); + +/** Get the "adaptive mid/side switching" flag. + * This is inherited from OggFLAC__SeekableStreamEncoder; see + * OggFLAC__seekable_stream_encoder_get_loose_mid_side_stereo(). + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * See OggFLAC__file_encoder_set_loose_mid_side_stereo(). + */ +OggFLAC_API FLAC__bool OggFLAC__file_encoder_get_loose_mid_side_stereo(const OggFLAC__FileEncoder *encoder); + +/** Get the number of input channels being processed. + * This is inherited from OggFLAC__SeekableStreamEncoder; see + * OggFLAC__seekable_stream_encoder_get_channels(). + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval unsigned + * See FLAC__file_encoder_set_channels(). + */ +OggFLAC_API unsigned OggFLAC__file_encoder_get_channels(const OggFLAC__FileEncoder *encoder); + +/** Get the input sample resolution setting. + * This is inherited from OggFLAC__SeekableStreamEncoder; see + * OggFLAC__seekable_stream_encoder_get_bits_per_sample(). + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval unsigned + * See OggFLAC__file_encoder_set_bits_per_sample(). + */ +OggFLAC_API unsigned OggFLAC__file_encoder_get_bits_per_sample(const OggFLAC__FileEncoder *encoder); + +/** Get the input sample rate setting. + * This is inherited from OggFLAC__SeekableStreamEncoder; see + * OggFLAC__seekable_stream_encoder_get_sample_rate(). + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval unsigned + * See OggFLAC__file_encoder_set_sample_rate(). + */ +OggFLAC_API unsigned OggFLAC__file_encoder_get_sample_rate(const OggFLAC__FileEncoder *encoder); + +/** Get the blocksize setting. + * This is inherited from OggFLAC__SeekableStreamEncoder; see + * OggFLAC__seekable_stream_encoder_get_blocksize(). + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval unsigned + * See OggFLAC__file_encoder_set_blocksize(). + */ +OggFLAC_API unsigned OggFLAC__file_encoder_get_blocksize(const OggFLAC__FileEncoder *encoder); + +/** Get the maximum LPC order setting. + * This is inherited from OggFLAC__SeekableStreamEncoder; see + * OggFLAC__seekable_stream_encoder_get_max_lpc_order(). + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval unsigned + * See OggFLAC__file_encoder_set_max_lpc_order(). + */ +OggFLAC_API unsigned OggFLAC__file_encoder_get_max_lpc_order(const OggFLAC__FileEncoder *encoder); + +/** Get the quantized linear predictor coefficient precision setting. + * This is inherited from OggFLAC__SeekableStreamEncoder; see + * OggFLAC__seekable_stream_encoder_get_qlp_coeff_precision(). + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval unsigned + * See OggFLAC__file_encoder_set_qlp_coeff_precision(). + */ +OggFLAC_API unsigned OggFLAC__file_encoder_get_qlp_coeff_precision(const OggFLAC__FileEncoder *encoder); + +/** Get the qlp coefficient precision search flag. + * This is inherited from OggFLAC__SeekableStreamEncoder; see + * OggFLAC__seekable_stream_encoder_get_do_qlp_coeff_prec_search(). + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * See OggFLAC__file_encoder_set_do_qlp_coeff_prec_search(). + */ +OggFLAC_API FLAC__bool OggFLAC__file_encoder_get_do_qlp_coeff_prec_search(const OggFLAC__FileEncoder *encoder); + +/** Get the "escape coding" flag. + * This is inherited from OggFLAC__SeekableStreamEncoder; see + * OggFLAC__seekable_stream_encoder_get_do_escape_coding(). + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * See OggFLAC__file_encoder_set_do_escape_coding(). + */ +OggFLAC_API FLAC__bool OggFLAC__file_encoder_get_do_escape_coding(const OggFLAC__FileEncoder *encoder); + +/** Get the exhaustive model search flag. + * This is inherited from OggFLAC__SeekableStreamEncoder; see + * OggFLAC__seekable_stream_encoder_get_do_exhaustive_model_search(). + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * See OggFLAC__file_encoder_set_do_exhaustive_model_search(). + */ +OggFLAC_API FLAC__bool OggFLAC__file_encoder_get_do_exhaustive_model_search(const OggFLAC__FileEncoder *encoder); + +/** Get the minimum residual partition order setting. + * This is inherited from OggFLAC__SeekableStreamEncoder; see + * OggFLAC__seekable_stream_encoder_get_min_residual_partition_order(). + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval unsigned + * See OggFLAC__file_encoder_set_min_residual_partition_order(). + */ +OggFLAC_API unsigned OggFLAC__file_encoder_get_min_residual_partition_order(const OggFLAC__FileEncoder *encoder); + +/** Get maximum residual partition order setting. + * This is inherited from OggFLAC__SeekableStreamEncoder; see + * OggFLAC__seekable_stream_encoder_get_max_residual_partition_order(). + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval unsigned + * See OggFLAC__file_encoder_set_max_residual_partition_order(). + */ +OggFLAC_API unsigned OggFLAC__file_encoder_get_max_residual_partition_order(const OggFLAC__FileEncoder *encoder); + +/** Get the Rice parameter search distance setting. + * This is inherited from OggFLAC__SeekableStreamEncoder; see + * OggFLAC__seekable_stream_encoder_get_rice_parameter_search_dist(). + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval unsigned + * See OggFLAC__file_encoder_set_rice_parameter_search_dist(). + */ +OggFLAC_API unsigned OggFLAC__file_encoder_get_rice_parameter_search_dist(const OggFLAC__FileEncoder *encoder); + +/** Get the previously set estimate of the total samples to be encoded. + * This is inherited from OggFLAC__SeekableStreamEncoder; see + * OggFLAC__seekable_stream_encoder_get_total_samples_estimate(). + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__uint64 + * See OggFLAC__file_encoder_set_total_samples_estimate(). + */ +OggFLAC_API FLAC__uint64 OggFLAC__file_encoder_get_total_samples_estimate(const OggFLAC__FileEncoder *encoder); + +/** Initialize the encoder instance. + * Should be called after OggFLAC__file_encoder_new() and + * OggFLAC__file_encoder_set_*() but before OggFLAC__file_encoder_process() + * or OggFLAC__file_encoder_process_interleaved(). Will set and return + * the encoder state, which will be OggFLAC__FILE_ENCODER_OK if + * initialization succeeded. + * + * \param encoder An uninitialized encoder instance. + * \assert + * \code encoder != NULL \endcode + * \retval OggFLAC__FileEncoderState + * \c OggFLAC__FILE_ENCODER_OK if initialization was successful; see + * OggFLAC__FileEncoderState for the meanings of other return values. + */ +OggFLAC_API OggFLAC__FileEncoderState OggFLAC__file_encoder_init(OggFLAC__FileEncoder *encoder); + +/** Finish the encoding process. + * Flushes the encoding buffer, releases resources, resets the encoder + * settings to their defaults, and returns the encoder state to + * OggFLAC__FILE_ENCODER_UNINITIALIZED. + * + * In the event of a prematurely-terminated encode, it is not strictly + * necessary to call this immediately before OggFLAC__file_encoder_delete() + * but it is good practice to match every OggFLAC__file_encoder_init() + * with a OggFLAC__file_encoder_finish(). + * + * \param encoder An uninitialized encoder instance. + * \assert + * \code encoder != NULL \endcode + */ +OggFLAC_API void OggFLAC__file_encoder_finish(OggFLAC__FileEncoder *encoder); + +/** Submit data for encoding. + * This is inherited from OggFLAC__SeekableStreamEncoder; see + * OggFLAC__seekable_stream_encoder_process(). + * + * \param encoder An initialized encoder instance in the OK state. + * \param buffer An array of pointers to each channel's signal. + * \param samples The number of samples in one channel. + * \assert + * \code encoder != NULL \endcode + * \code OggFLAC__file_encoder_get_state(encoder) == OggFLAC__FILE_ENCODER_OK \endcode + * \retval FLAC__bool + * \c true if successful, else \c false; in this case, check the + * encoder state with OggFLAC__file_encoder_get_state() to see what + * went wrong. + */ +OggFLAC_API FLAC__bool OggFLAC__file_encoder_process(OggFLAC__FileEncoder *encoder, const FLAC__int32 * const buffer[], unsigned samples); + +/** Submit data for encoding. + * This is inherited from OggFLAC__SeekableStreamEncoder; see + * OggFLAC__seekable_stream_encoder_process_interleaved(). + * + * \param encoder An initialized encoder instance in the OK state. + * \param buffer An array of channel-interleaved data (see above). + * \param samples The number of samples in one channel, the same as for + * OggFLAC__file_encoder_process(). For example, if + * encoding two channels, \c 1000 \a samples corresponds + * to a \a buffer of 2000 values. + * \assert + * \code encoder != NULL \endcode + * \code OggFLAC__file_encoder_get_state(encoder) == OggFLAC__FILE_ENCODER_OK \endcode + * \retval FLAC__bool + * \c true if successful, else \c false; in this case, check the + * encoder state with OggFLAC__file_encoder_get_state() to see what + * went wrong. + */ +OggFLAC_API FLAC__bool OggFLAC__file_encoder_process_interleaved(OggFLAC__FileEncoder *encoder, const FLAC__int32 buffer[], unsigned samples); + +/* \} */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Libraries/FLAC/Files/include/OggFLAC/seekable_stream_decoder.h b/Libraries/FLAC/Files/include/OggFLAC/seekable_stream_decoder.h new file mode 100644 index 000000000..32d840d8c --- /dev/null +++ b/Libraries/FLAC/Files/include/OggFLAC/seekable_stream_decoder.h @@ -0,0 +1,855 @@ +/* libOggFLAC - Free Lossless Audio Codec + Ogg library + * Copyright (C) 2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef OggFLAC__SEEKABLE_STREAM_DECODER_H +#define OggFLAC__SEEKABLE_STREAM_DECODER_H + +#include "export.h" +#include "stream_decoder.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +/** \file include/OggFLAC/seekable_stream_decoder.h + * + * \brief + * This module contains the functions which implement the seekable stream + * decoder. + * + * See the detailed documentation in the + * \link oggflac_seekable_stream_decoder seekable stream decoder \endlink module. + */ + +/** \defgroup oggflac_seekable_stream_decoder OggFLAC/seekable_stream_decoder.h: seekable stream decoder interface + * \ingroup oggflac_decoder + * + * \brief + * This module contains the functions which implement the seekable stream + * decoder. + * + * The interface here is nearly identical to FLAC's seekable stream decoder, + * including the callbacks, with the addition of + * OggFLAC__seekable_stream_decoder_set_serial_number(). See the + * \link flac_seekable_stream_decoder FLAC seekable stream decoder module \endlink + * for full documentation. + * + * \{ + */ + + +/** State values for an OggFLAC__SeekableStreamDecoder + * + * The decoder's state can be obtained by calling OggFLAC__seekable_stream_decoder_get_state(). + */ +typedef enum { + + OggFLAC__SEEKABLE_STREAM_DECODER_OK = 0, + /**< The decoder is in the normal OK state. */ + + OggFLAC__SEEKABLE_STREAM_DECODER_SEEKING, + /**< The decoder is in the process of seeking. */ + + OggFLAC__SEEKABLE_STREAM_DECODER_END_OF_STREAM, + /**< The decoder has reached the end of the stream. */ + + OggFLAC__SEEKABLE_STREAM_DECODER_MEMORY_ALLOCATION_ERROR, + /**< Memory allocation failed. */ + + OggFLAC__SEEKABLE_STREAM_DECODER_STREAM_DECODER_ERROR, + /**< An error occurred in the underlying stream decoder; + * check OggFLAC__seekable_stream_decoder_get_stream_decoder_state(). + */ + + OggFLAC__SEEKABLE_STREAM_DECODER_READ_ERROR, + /**< The read callback returned an error. */ + + OggFLAC__SEEKABLE_STREAM_DECODER_SEEK_ERROR, + /**< An error occurred while seeking or the seek or tell + * callback returned an error. + */ + + OggFLAC__SEEKABLE_STREAM_DECODER_ALREADY_INITIALIZED, + /**< OggFLAC__seekable_stream_decoder_init() was called when the decoder was + * already initialized, usually because + * OggFLAC__seekable_stream_decoder_finish() was not called. + */ + + OggFLAC__SEEKABLE_STREAM_DECODER_INVALID_CALLBACK, + /**< The decoder was initialized before setting all the required callbacks. */ + + OggFLAC__SEEKABLE_STREAM_DECODER_UNINITIALIZED + /**< The decoder is in the uninitialized state. */ + +} OggFLAC__SeekableStreamDecoderState; + +/** Maps an OggFLAC__SeekableStreamDecoderState to a C string. + * + * Using an OggFLAC__SeekableStreamDecoderState as the index to this array + * will give the string equivalent. The contents should not be modified. + */ +extern OggFLAC_API const char * const OggFLAC__SeekableStreamDecoderStateString[]; + + +/** Return values for the OggFLAC__SeekableStreamDecoder read callback. + */ +typedef enum { + + OggFLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_OK, + /**< The read was OK and decoding can continue. */ + + OggFLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_ERROR + /**< An unrecoverable error occurred. The decoder will return from the process call. */ + +} OggFLAC__SeekableStreamDecoderReadStatus; + +/** Maps a OggFLAC__SeekableStreamDecoderReadStatus to a C string. + * + * Using a OggFLAC__SeekableStreamDecoderReadStatus as the index to this array + * will give the string equivalent. The contents should not be modified. + */ +extern OggFLAC_API const char * const OggFLAC__SeekableStreamDecoderReadStatusString[]; + + +/** Return values for the OggFLAC__SeekableStreamDecoder seek callback. + */ +typedef enum { + + OggFLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_OK, + /**< The seek was OK and decoding can continue. */ + + OggFLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_ERROR + /**< An unrecoverable error occurred. The decoder will return from the process call. */ + +} OggFLAC__SeekableStreamDecoderSeekStatus; + +/** Maps a OggFLAC__SeekableStreamDecoderSeekStatus to a C string. + * + * Using a OggFLAC__SeekableStreamDecoderSeekStatus as the index to this array + * will give the string equivalent. The contents should not be modified. + */ +extern OggFLAC_API const char * const OggFLAC__SeekableStreamDecoderSeekStatusString[]; + + +/** Return values for the OggFLAC__SeekableStreamDecoder tell callback. + */ +typedef enum { + + OggFLAC__SEEKABLE_STREAM_DECODER_TELL_STATUS_OK, + /**< The tell was OK and decoding can continue. */ + + OggFLAC__SEEKABLE_STREAM_DECODER_TELL_STATUS_ERROR + /**< An unrecoverable error occurred. The decoder will return from the process call. */ + +} OggFLAC__SeekableStreamDecoderTellStatus; + +/** Maps a OggFLAC__SeekableStreamDecoderTellStatus to a C string. + * + * Using a OggFLAC__SeekableStreamDecoderTellStatus as the index to this array + * will give the string equivalent. The contents should not be modified. + */ +extern OggFLAC_API const char * const OggFLAC__SeekableStreamDecoderTellStatusString[]; + + +/** Return values for the OggFLAC__SeekableStreamDecoder length callback. + */ +typedef enum { + + OggFLAC__SEEKABLE_STREAM_DECODER_LENGTH_STATUS_OK, + /**< The length call was OK and decoding can continue. */ + + OggFLAC__SEEKABLE_STREAM_DECODER_LENGTH_STATUS_ERROR + /**< An unrecoverable error occurred. The decoder will return from the process call. */ + +} OggFLAC__SeekableStreamDecoderLengthStatus; + +/** Maps a OggFLAC__SeekableStreamDecoderLengthStatus to a C string. + * + * Using a OggFLAC__SeekableStreamDecoderLengthStatus as the index to this array + * will give the string equivalent. The contents should not be modified. + */ +extern OggFLAC_API const char * const OggFLAC__SeekableStreamDecoderLengthStatusString[]; + + +/*********************************************************************** + * + * class OggFLAC__SeekableStreamDecoder : public FLAC__StreamDecoder + * + ***********************************************************************/ + +struct OggFLAC__SeekableStreamDecoderProtected; +struct OggFLAC__SeekableStreamDecoderPrivate; +/** The opaque structure definition for the seekable stream decoder type. + * See the + * \link oggflac_seekable_stream_decoder seekable stream decoder module \endlink + * for a detailed description. + */ +typedef struct { + struct OggFLAC__SeekableStreamDecoderProtected *protected_; /* avoid the C++ keyword 'protected' */ + struct OggFLAC__SeekableStreamDecoderPrivate *private_; /* avoid the C++ keyword 'private' */ +} OggFLAC__SeekableStreamDecoder; + +/** Signature for the read callback. + * See OggFLAC__seekable_stream_decoder_set_read_callback() + * and OggFLAC__StreamDecoderReadCallback for more info. + * + * \param decoder The decoder instance calling the callback. + * \param buffer A pointer to a location for the callee to store + * data to be decoded. + * \param bytes A pointer to the size of the buffer. + * \param client_data The callee's client data set through + * OggFLAC__seekable_stream_decoder_set_client_data(). + * \retval FLAC__SeekableStreamDecoderReadStatus + * The callee's return status. + */ +typedef OggFLAC__SeekableStreamDecoderReadStatus (*OggFLAC__SeekableStreamDecoderReadCallback)(const OggFLAC__SeekableStreamDecoder *decoder, FLAC__byte buffer[], unsigned *bytes, void *client_data); + +/** Signature for the seek callback. + * See OggFLAC__seekable_stream_decoder_set_seek_callback() for more info. + * + * \param decoder The decoder instance calling the callback. + * \param absolute_byte_offset The offset from the beginning of the stream + * to seek to. + * \param client_data The callee's client data set through + * OggFLAC__seekable_stream_decoder_set_client_data(). + * \retval FLAC__SeekableStreamDecoderSeekStatus + * The callee's return status. + */ +typedef OggFLAC__SeekableStreamDecoderSeekStatus (*OggFLAC__SeekableStreamDecoderSeekCallback)(const OggFLAC__SeekableStreamDecoder *decoder, FLAC__uint64 absolute_byte_offset, void *client_data); + +/** Signature for the tell callback. + * See OggFLAC__seekable_stream_decoder_set_tell_callback() for more info. + * + * \param decoder The decoder instance calling the callback. + * \param absolute_byte_offset A pointer to storage for the current offset + * from the beginning of the stream. + * \param client_data The callee's client data set through + * OggFLAC__seekable_stream_decoder_set_client_data(). + * \retval FLAC__SeekableStreamDecoderTellStatus + * The callee's return status. + */ +typedef OggFLAC__SeekableStreamDecoderTellStatus (*OggFLAC__SeekableStreamDecoderTellCallback)(const OggFLAC__SeekableStreamDecoder *decoder, FLAC__uint64 *absolute_byte_offset, void *client_data); + +/** Signature for the length callback. + * See OggFLAC__seekable_stream_decoder_set_length_callback() for more info. + * + * \param decoder The decoder instance calling the callback. + * \param stream_length A pointer to storage for the length of the stream + * in bytes. + * \param client_data The callee's client data set through + * OggFLAC__seekable_stream_decoder_set_client_data(). + * \retval FLAC__SeekableStreamDecoderLengthStatus + * The callee's return status. + */ +typedef OggFLAC__SeekableStreamDecoderLengthStatus (*OggFLAC__SeekableStreamDecoderLengthCallback)(const OggFLAC__SeekableStreamDecoder *decoder, FLAC__uint64 *stream_length, void *client_data); + +/** Signature for the EOF callback. + * See OggFLAC__seekable_stream_decoder_set_eof_callback() for more info. + * + * \param decoder The decoder instance calling the callback. + * \param client_data The callee's client data set through + * OggFLAC__seekable_stream_decoder_set_client_data(). + * \retval FLAC__bool + * \c true if the currently at the end of the stream, else \c false. + */ +typedef FLAC__bool (*OggFLAC__SeekableStreamDecoderEofCallback)(const OggFLAC__SeekableStreamDecoder *decoder, void *client_data); + +/** Signature for the write callback. + * See OggFLAC__seekable_stream_decoder_set_write_callback() + * and OggFLAC__StreamDecoderWriteCallback for more info. + * + * \param decoder The decoder instance calling the callback. + * \param frame The description of the decoded frame. + * \param buffer An array of pointers to decoded channels of data. + * \param client_data The callee's client data set through + * OggFLAC__seekable_stream_decoder_set_client_data(). + * \retval FLAC__StreamDecoderWriteStatus + * The callee's return status. + */ +typedef FLAC__StreamDecoderWriteStatus (*OggFLAC__SeekableStreamDecoderWriteCallback)(const OggFLAC__SeekableStreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data); + +/** Signature for the metadata callback. + * See OggFLAC__seekable_stream_decoder_set_metadata_callback() + * and OggFLAC__StreamDecoderMetadataCallback for more info. + * + * \param decoder The decoder instance calling the callback. + * \param metadata The decoded metadata block. + * \param client_data The callee's client data set through + * OggFLAC__seekable_stream_decoder_set_client_data(). + */ +typedef void (*OggFLAC__SeekableStreamDecoderMetadataCallback)(const OggFLAC__SeekableStreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data); + +/** Signature for the error callback. + * See OggFLAC__seekable_stream_decoder_set_error_callback() + * and OggFLAC__StreamDecoderErrorCallback for more info. + * + * \param decoder The decoder instance calling the callback. + * \param status The error encountered by the decoder. + * \param client_data The callee's client data set through + * OggFLAC__seekable_stream_decoder_set_client_data(). + */ +typedef void (*OggFLAC__SeekableStreamDecoderErrorCallback)(const OggFLAC__SeekableStreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data); + + +/*********************************************************************** + * + * Class constructor/destructor + * + ***********************************************************************/ + +/** Create a new seekable stream decoder instance. The instance is created + * with default settings; see the individual + * OggFLAC__seekable_stream_decoder_set_*() functions for each setting's + * default. + * + * \retval OggFLAC__SeekableStreamDecoder* + * \c NULL if there was an error allocating memory, else the new instance. + */ +OggFLAC_API OggFLAC__SeekableStreamDecoder *OggFLAC__seekable_stream_decoder_new(); + +/** Free a decoder instance. Deletes the object pointed to by \a decoder. + * + * \param decoder A pointer to an existing decoder. + * \assert + * \code decoder != NULL \endcode + */ +OggFLAC_API void OggFLAC__seekable_stream_decoder_delete(OggFLAC__SeekableStreamDecoder *decoder); + + +/*********************************************************************** + * + * Public class method prototypes + * + ***********************************************************************/ + +/** Set the "MD5 signature checking" flag. + * This is inherited from FLAC__SeekableStreamDecoder; see + * FLAC__seekable_stream_decoder_set_md5_checking(). + * + * \default \c false + * \param decoder A decoder instance to set. + * \param value Flag value (see above). + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_decoder_set_md5_checking(OggFLAC__SeekableStreamDecoder *decoder, FLAC__bool value); + +/** Set the read callback. + * This is inherited from FLAC__SeekableStreamDecoder; see + * FLAC__seekable_stream_decoder_set_read_callback(). + * + * \note + * The callback is mandatory and must be set before initialization. + * + * \default \c NULL + * \param decoder A decoder instance to set. + * \param value See above. + * \assert + * \code decoder != NULL \endcode + * \code value != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_decoder_set_read_callback(OggFLAC__SeekableStreamDecoder *decoder, OggFLAC__SeekableStreamDecoderReadCallback value); + +/** Set the seek callback. + * This is inherited from FLAC__SeekableStreamDecoder; see + * FLAC__seekable_stream_decoder_set_seek_callback(). + * + * \note + * The callback is mandatory and must be set before initialization. + * + * \default \c NULL + * \param decoder A decoder instance to set. + * \param value See above. + * \assert + * \code decoder != NULL \endcode + * \code value != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_decoder_set_seek_callback(OggFLAC__SeekableStreamDecoder *decoder, OggFLAC__SeekableStreamDecoderSeekCallback value); + +/** Set the tell callback. + * This is inherited from FLAC__SeekableStreamDecoder; see + * FLAC__seekable_stream_decoder_set_tell_callback(). + * + * \note + * The callback is mandatory and must be set before initialization. + * + * \default \c NULL + * \param decoder A decoder instance to set. + * \param value See above. + * \assert + * \code decoder != NULL \endcode + * \code value != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_decoder_set_tell_callback(OggFLAC__SeekableStreamDecoder *decoder, OggFLAC__SeekableStreamDecoderTellCallback value); + +/** Set the length callback. + * This is inherited from FLAC__SeekableStreamDecoder; see + * FLAC__seekable_stream_decoder_set_length_callback(). + * + * \note + * The callback is mandatory and must be set before initialization. + * + * \default \c NULL + * \param decoder A decoder instance to set. + * \param value See above. + * \assert + * \code decoder != NULL \endcode + * \code value != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_decoder_set_length_callback(OggFLAC__SeekableStreamDecoder *decoder, OggFLAC__SeekableStreamDecoderLengthCallback value); + +/** Set the eof callback. + * This is inherited from FLAC__SeekableStreamDecoder; see + * FLAC__seekable_stream_decoder_set_eof_callback(). + * + * \note + * The callback is mandatory and must be set before initialization. + * + * \default \c NULL + * \param decoder A decoder instance to set. + * \param value See above. + * \assert + * \code decoder != NULL \endcode + * \code value != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_decoder_set_eof_callback(OggFLAC__SeekableStreamDecoder *decoder, OggFLAC__SeekableStreamDecoderEofCallback value); + +/** Set the write callback. + * This is inherited from FLAC__SeekableStreamDecoder; see + * FLAC__seekable_stream_decoder_set_write_callback(). + * + * \note + * The callback is mandatory and must be set before initialization. + * + * \default \c NULL + * \param decoder A decoder instance to set. + * \param value See above. + * \assert + * \code decoder != NULL \endcode + * \code value != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_decoder_set_write_callback(OggFLAC__SeekableStreamDecoder *decoder, OggFLAC__SeekableStreamDecoderWriteCallback value); + +/** Set the metadata callback. + * This is inherited from FLAC__SeekableStreamDecoder; see + * FLAC__seekable_stream_decoder_set_metadata_callback(). + * + * \note + * The callback is mandatory and must be set before initialization. + * + * \default \c NULL + * \param decoder A decoder instance to set. + * \param value See above. + * \assert + * \code decoder != NULL \endcode + * \code value != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_decoder_set_metadata_callback(OggFLAC__SeekableStreamDecoder *decoder, OggFLAC__SeekableStreamDecoderMetadataCallback value); + +/** Set the error callback. + * This is inherited from FLAC__SeekableStreamDecoder; see + * FLAC__seekable_stream_decoder_set_error_callback(). + * + * \note + * The callback is mandatory and must be set before initialization. + * + * \default \c NULL + * \param decoder A decoder instance to set. + * \param value See above. + * \assert + * \code decoder != NULL \endcode + * \code value != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_decoder_set_error_callback(OggFLAC__SeekableStreamDecoder *decoder, OggFLAC__SeekableStreamDecoderErrorCallback value); + +/** Set the client data to be passed back to callbacks. + * This value will be supplied to callbacks in their \a client_data + * argument. + * + * \default \c NULL + * \param decoder A decoder instance to set. + * \param value See above. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_decoder_set_client_data(OggFLAC__SeekableStreamDecoder *decoder, void *value); + +/** Set the serial number for the Ogg stream. + * The default behavior is to use the serial number of the first Ogg + * page. Setting a serial number here will explicitly specify which + * stream is to be decoded. + * + * \default \c use serial number of first page + * \param decoder A decoder instance to set. + * \param serial_number See above. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_decoder_set_serial_number(OggFLAC__SeekableStreamDecoder *decoder, long serial_number); + +/** This is inherited from FLAC__SeekableStreamDecoder; see + * FLAC__seekable_stream_decoder_set_metadata_respond(). + * + * \default By default, only the \c STREAMINFO block is returned via the + * metadata callback. + * \param decoder A decoder instance to set. + * \param type See above. + * \assert + * \code decoder != NULL \endcode + * \a type is valid + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_decoder_set_metadata_respond(OggFLAC__SeekableStreamDecoder *decoder, FLAC__MetadataType type); + +/** This is inherited from FLAC__SeekableStreamDecoder; see + * FLAC__seekable_stream_decoder_set_metadata_respond_application(). + * + * \default By default, only the \c STREAMINFO block is returned via the + * metadata callback. + * \param decoder A decoder instance to set. + * \param id See above. + * \assert + * \code decoder != NULL \endcode + * \code id != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_decoder_set_metadata_respond_application(OggFLAC__SeekableStreamDecoder *decoder, const FLAC__byte id[4]); + +/** This is inherited from FLAC__SeekableStreamDecoder; see + * FLAC__seekable_stream_decoder_set_metadata_respond_all(). + * + * \default By default, only the \c STREAMINFO block is returned via the + * metadata callback. + * \param decoder A decoder instance to set. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_decoder_set_metadata_respond_all(OggFLAC__SeekableStreamDecoder *decoder); + +/** This is inherited from FLAC__SeekableStreamDecoder; see + * FLAC__seekable_stream_decoder_set_metadata_ignore(). + * + * \default By default, only the \c STREAMINFO block is returned via the + * metadata callback. + * \param decoder A decoder instance to set. + * \param type See above. + * \assert + * \code decoder != NULL \endcode + * \a type is valid + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_decoder_set_metadata_ignore(OggFLAC__SeekableStreamDecoder *decoder, FLAC__MetadataType type); + +/** This is inherited from FLAC__SeekableStreamDecoder; see + * FLAC__seekable_stream_decoder_set_metadata_ignore_application(). + * + * \default By default, only the \c STREAMINFO block is returned via the + * metadata callback. + * \param decoder A decoder instance to set. + * \param id See above. + * \assert + * \code decoder != NULL \endcode + * \code id != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_decoder_set_metadata_ignore_application(OggFLAC__SeekableStreamDecoder *decoder, const FLAC__byte id[4]); + +/** This is inherited from FLAC__SeekableStreamDecoder; see + * FLAC__seekable_stream_decoder_set_metadata_ignore_all(). + * + * \default By default, only the \c STREAMINFO block is returned via the + * metadata callback. + * \param decoder A decoder instance to set. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_decoder_set_metadata_ignore_all(OggFLAC__SeekableStreamDecoder *decoder); + +/** Get the current decoder state. + * + * \param decoder A decoder instance to query. + * \assert + * \code decoder != NULL \endcode + * \retval OggFLAC__SeekableStreamDecoderState + * The current decoder state. + */ +OggFLAC_API OggFLAC__SeekableStreamDecoderState OggFLAC__seekable_stream_decoder_get_state(const OggFLAC__SeekableStreamDecoder *decoder); + +/** Get the state of the underlying stream decoder. + * Useful when the seekable stream decoder state is + * \c OggFLAC__SEEKABLE_STREAM_DECODER_STREAM_DECODER_ERROR. + * + * \param decoder A decoder instance to query. + * \assert + * \code decoder != NULL \endcode + * \retval OggFLAC__StreamDecoderState + * The stream decoder state. + */ +OggFLAC_API OggFLAC__StreamDecoderState OggFLAC__seekable_stream_decoder_get_stream_decoder_state(const OggFLAC__SeekableStreamDecoder *decoder); + +/** Get the state of the underlying stream decoder's FLAC stream decoder. + * Useful when the seekable stream decoder state is + * \c OggFLAC__SEEKABLE_STREAM_DECODER_STREAM_DECODER_ERROR and the + * stream decoder state is \c OggFLAC__STREAM_DECODER_FLAC_STREAM_DECODER_ERROR + * + * \param decoder A decoder instance to query. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__StreamDecoderState + * The FLAC stream decoder state. + */ +OggFLAC_API FLAC__StreamDecoderState OggFLAC__seekable_stream_decoder_get_FLAC_stream_decoder_state(const OggFLAC__SeekableStreamDecoder *decoder); + +/** Get the current decoder state as a C string. + * This version automatically resolves + * \c OggFLAC__SEEKABLE_STREAM_DECODER_STREAM_DECODER_ERROR + * by getting the stream decoder's state. + * + * \param decoder A decoder instance to query. + * \assert + * \code decoder != NULL \endcode + * \retval const char * + * The decoder state as a C string. Do not modify the contents. + */ +OggFLAC_API const char *OggFLAC__seekable_stream_decoder_get_resolved_state_string(const OggFLAC__SeekableStreamDecoder *decoder); + +/** This is inherited from FLAC__SeekableStreamDecoder; see + * FLAC__seekable_stream_decoder_get_md5_checking(). + * + * \param decoder A decoder instance to query. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * See above. + */ +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_decoder_get_md5_checking(const OggFLAC__SeekableStreamDecoder *decoder); + +/** This is inherited from FLAC__SeekableStreamDecoder; see + * FLAC__seekable_stream_decoder_get_channels(). + * + * \param decoder A decoder instance to query. + * \assert + * \code decoder != NULL \endcode + * \retval unsigned + * See above. + */ +OggFLAC_API unsigned OggFLAC__seekable_stream_decoder_get_channels(const OggFLAC__SeekableStreamDecoder *decoder); + +/** This is inherited from FLAC__SeekableStreamDecoder; see + * FLAC__seekable_stream_decoder_get_channel_assignment(). + * + * \param decoder A decoder instance to query. + * \assert + * \code decoder != NULL \endcode + * \retval OggFLAC__ChannelAssignment + * See above. + */ +OggFLAC_API FLAC__ChannelAssignment OggFLAC__seekable_stream_decoder_get_channel_assignment(const OggFLAC__SeekableStreamDecoder *decoder); + +/** This is inherited from FLAC__SeekableStreamDecoder; see + * FLAC__seekable_stream_decoder_get_bits_per_sample(). + * + * \param decoder A decoder instance to query. + * \assert + * \code decoder != NULL \endcode + * \retval unsigned + * See above. + */ +OggFLAC_API unsigned OggFLAC__seekable_stream_decoder_get_bits_per_sample(const OggFLAC__SeekableStreamDecoder *decoder); + +/** This is inherited from FLAC__SeekableStreamDecoder; see + * FLAC__seekable_stream_decoder_get_sample_rate(). + * + * \param decoder A decoder instance to query. + * \assert + * \code decoder != NULL \endcode + * \retval unsigned + * See above. + */ +OggFLAC_API unsigned OggFLAC__seekable_stream_decoder_get_sample_rate(const OggFLAC__SeekableStreamDecoder *decoder); + +/** This is inherited from FLAC__SeekableStreamDecoder; see + * FLAC__seekable_stream_decoder_get_blocksize(). + * + * \param decoder A decoder instance to query. + * \assert + * \code decoder != NULL \endcode + * \retval unsigned + * See above. + */ +OggFLAC_API unsigned OggFLAC__seekable_stream_decoder_get_blocksize(const OggFLAC__SeekableStreamDecoder *decoder); + +/** Initialize the decoder instance. + * Should be called after OggFLAC__seekable_stream_decoder_new() and + * OggFLAC__seekable_stream_decoder_set_*() but before any of the + * OggFLAC__seekable_stream_decoder_process_*() functions. Will set and return + * the decoder state, which will be OggFLAC__SEEKABLE_STREAM_DECODER_OK + * if initialization succeeded. + * + * \param decoder An uninitialized decoder instance. + * \assert + * \code decoder != NULL \endcode + * \retval OggFLAC__SeekableStreamDecoderState + * \c OggFLAC__SEEKABLE_STREAM_DECODER_OK if initialization was + * successful; see OggFLAC__SeekableStreamDecoderState for the meanings + * of other return values. + */ +OggFLAC_API OggFLAC__SeekableStreamDecoderState OggFLAC__seekable_stream_decoder_init(OggFLAC__SeekableStreamDecoder *decoder); + +/** Finish the decoding process. + * Flushes the decoding buffer, releases resources, resets the decoder + * settings to their defaults, and returns the decoder state to + * OggFLAC__SEEKABLE_STREAM_DECODER_UNINITIALIZED. + * + * In the event of a prematurely-terminated decode, it is not strictly + * necessary to call this immediately before + * OggFLAC__seekable_stream_decoder_delete() but it is good practice to match + * every OggFLAC__seekable_stream_decoder_init() with a + * OggFLAC__seekable_stream_decoder_finish(). + * + * \param decoder An uninitialized decoder instance. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * \c false if MD5 checking is on AND a STREAMINFO block was available + * AND the MD5 signature in the STREAMINFO block was non-zero AND the + * signature does not match the one computed by the decoder; else + * \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_decoder_finish(OggFLAC__SeekableStreamDecoder *decoder); + +/** This is inherited from FLAC__SeekableStreamDecoder; see + * FLAC__seekable_stream_decoder_flush(). + * + * \param decoder A decoder instance. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * \c true if successful, else \c false if a memory allocation + * or stream decoder error occurs. + */ +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_decoder_flush(OggFLAC__SeekableStreamDecoder *decoder); + +/** This is inherited from FLAC__SeekableStreamDecoder; see + * FLAC__seekable_stream_decoder_reset(). + * + * \param decoder A decoder instance. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * \c true if successful, else \c false if a memory allocation + * or stream decoder error occurs. + */ +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_decoder_reset(OggFLAC__SeekableStreamDecoder *decoder); + +/** This is inherited from FLAC__SeekableStreamDecoder; see + * FLAC__seekable_stream_decoder_process_single(). + * + * \param decoder A decoder instance. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * See above. + */ +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_decoder_process_single(OggFLAC__SeekableStreamDecoder *decoder); + +/** This is inherited from FLAC__SeekableStreamDecoder; see + * FLAC__seekable_stream_decoder_process_until_end_of_metadata(). + * + * \param decoder A decoder instance. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * See above. + */ +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_decoder_process_until_end_of_metadata(OggFLAC__SeekableStreamDecoder *decoder); + +/** This is inherited from FLAC__SeekableStreamDecoder; see + * FLAC__seekable_stream_decoder_process_until_end_of_stream(). + * + * \param decoder A decoder instance. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * See above. + */ +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_decoder_process_until_end_of_stream(OggFLAC__SeekableStreamDecoder *decoder); + +/** This is inherited from FLAC__SeekableStreamDecoder; see + * FLAC__seekable_stream_decoder_seek_absolute(). + * + * \param decoder A decoder instance. + * \param sample The target sample number to seek to. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * \c true if successful, else \c false. + */ +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_decoder_seek_absolute(OggFLAC__SeekableStreamDecoder *decoder, FLAC__uint64 sample); + +/* \} */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Libraries/FLAC/Files/include/OggFLAC/seekable_stream_encoder.h b/Libraries/FLAC/Files/include/OggFLAC/seekable_stream_encoder.h new file mode 100644 index 000000000..5109154b6 --- /dev/null +++ b/Libraries/FLAC/Files/include/OggFLAC/seekable_stream_encoder.h @@ -0,0 +1,936 @@ +/* libOggFLAC - Free Lossless Audio Codec + Ogg library + * Copyright (C) 2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef OggFLAC__SEEKABLE_STREAM_ENCODER_H +#define OggFLAC__SEEKABLE_STREAM_ENCODER_H + +#include "export.h" + +#include "FLAC/stream_encoder.h" +#include "FLAC/seekable_stream_encoder.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +/** \file include/OggFLAC/seekable_stream_encoder.h + * + * \brief + * This module contains the functions which implement the seekable + * stream encoder. + * + * See the detailed documentation in the + * \link oggflac_seekable_stream_encoder seekable stream encoder \endlink module. + */ + +/** \defgroup oggflac_seekable_stream_encoder OggFLAC/seekable_stream_encoder.h: seekable stream encoder interface + * \ingroup oggflac_encoder + * + * \brief + * This module contains the functions which implement the seekable + * stream encoder. The Ogg seekable stream encoder is derived + * from the FLAC seekable stream encoder. + * + * The interface here is nearly identical to FLAC's seekable stream + * encoder, including the callbacks, with the addition of a new required + * read callback (needed when writing back STREAMINFO after encoding) and + * OggFLAC__seekable_stream_encoder_set_serial_number(). See the + * \link flac_seekable_stream_encoder FLAC seekable stream encoder module \endlink + * for full documentation. + * + * \{ + */ + + +/** State values for an OggFLAC__SeekableStreamEncoder + * + * The encoder's state can be obtained by calling OggFLAC__stream_encoder_get_state(). + */ +typedef enum { + + OggFLAC__SEEKABLE_STREAM_ENCODER_OK = 0, + /**< The encoder is in the normal OK state. */ + + OggFLAC__SEEKABLE_STREAM_ENCODER_OGG_ERROR, + /**< An error occurred in the underlying Ogg layer. */ + + OggFLAC__SEEKABLE_STREAM_ENCODER_FLAC_STREAM_ENCODER_ERROR, + /**< An error occurred in the underlying FLAC stream encoder; + * check OggFLAC__seekable_stream_encoder_get_FLAC_stream_encoder_state(). + */ + + OggFLAC__SEEKABLE_STREAM_ENCODER_MEMORY_ALLOCATION_ERROR, + /**< Memory allocation failed. */ + + OggFLAC__SEEKABLE_STREAM_ENCODER_WRITE_ERROR, + /**< The write callback returned an error. */ + + OggFLAC__SEEKABLE_STREAM_ENCODER_READ_ERROR, + /**< The read callback returned an error. */ + + OggFLAC__SEEKABLE_STREAM_ENCODER_SEEK_ERROR, + /**< The seek callback returned an error. */ + + OggFLAC__SEEKABLE_STREAM_ENCODER_TELL_ERROR, + /**< The tell callback returned an error. */ + + OggFLAC__SEEKABLE_STREAM_ENCODER_ALREADY_INITIALIZED, + /**< OggFLAC__seekable_stream_encoder_init() was called when the encoder was + * already initialized, usually because + * OggFLAC__seekable_stream_encoder_finish() was not called. + */ + + OggFLAC__SEEKABLE_STREAM_ENCODER_INVALID_CALLBACK, + /**< OggFLAC__seekable_stream_encoder_init() was called without all + * callbacks being set. + */ + + OggFLAC__SEEKABLE_STREAM_ENCODER_INVALID_SEEKTABLE, + /**< An invalid seek table was passed is the metadata to + * OggFLAC__seekable_stream_encoder_set_metadata(). + */ + + OggFLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED + /**< The encoder is in the uninitialized state. */ + +} OggFLAC__SeekableStreamEncoderState; + +/** Maps an OggFLAC__StreamEncoderState to a C string. + * + * Using an OggFLAC__StreamEncoderState as the index to this array + * will give the string equivalent. The contents should not be modified. + */ +extern OggFLAC_API const char * const OggFLAC__SeekableStreamEncoderStateString[]; + + +/** Return values for the OggFLAC__SeekableStreamEncoder read callback. + */ +typedef enum { + + OggFLAC__SEEKABLE_STREAM_ENCODER_READ_STATUS_CONTINUE, + /**< The read was OK and decoding can continue. */ + + OggFLAC__SEEKABLE_STREAM_ENCODER_READ_STATUS_END_OF_STREAM, + /**< The read was attempted at the end of the stream. */ + + OggFLAC__SEEKABLE_STREAM_ENCODER_READ_STATUS_ABORT + /**< An unrecoverable error occurred. */ + +} OggFLAC__SeekableStreamEncoderReadStatus; + +/** Maps a OggFLAC__SeekableStreamEncoderReadStatus to a C string. + * + * Using a OggFLAC__SeekableStreamEncoderReadStatus as the index to this array + * will give the string equivalent. The contents should not be modified. + */ +extern OggFLAC_API const char * const OggFLAC__SeekableStreamEncoderReadStatusString[]; + + +/*********************************************************************** + * + * class OggFLAC__StreamEncoder + * + ***********************************************************************/ + +struct OggFLAC__SeekableStreamEncoderProtected; +struct OggFLAC__SeekableStreamEncoderPrivate; +/** The opaque structure definition for the seekable stream encoder type. + * See the \link oggflac_seekable_stream_encoder seekable stream encoder module \endlink + * for a detailed description. + */ +typedef struct { + struct OggFLAC__SeekableStreamEncoderProtected *protected_; /* avoid the C++ keyword 'protected' */ + struct OggFLAC__SeekableStreamEncoderPrivate *private_; /* avoid the C++ keyword 'private' */ +} OggFLAC__SeekableStreamEncoder; + +/** Signature for the read callback. + * See OggFLAC__seekable_stream_encoder_set_read_callback() for more info. + * + * \param encoder The encoder instance calling the callback. + * \param buffer A pointer to a location for the callee to store + * data to be encoded. + * \param bytes A pointer to the size of the buffer. On entry + * to the callback, it contains the maximum number + * of bytes that may be stored in \a buffer. The + * callee must set it to the actual number of bytes + * stored (0 in case of error or end-of-stream) before + * returning. + * \param client_data The callee's client data set through + * OggFLAC__seekable_stream_encoder_set_client_data(). + * \retval OggFLAC__SeekableStreamEncoderReadStatus + * The callee's return status. + */ +typedef OggFLAC__SeekableStreamEncoderReadStatus (*OggFLAC__SeekableStreamEncoderReadCallback)(const OggFLAC__SeekableStreamEncoder *encoder, FLAC__byte buffer[], unsigned *bytes, void *client_data); + +/** Signature for the seek callback. + * See OggFLAC__seekable_stream_encoder_set_seek_callback() + * and FLAC__SeekableStreamEncoderSeekCallback for more info. + * + * \param encoder The encoder instance calling the callback. + * \param absolute_byte_offset The offset from the beginning of the stream + * to seek to. + * \param client_data The callee's client data set through + * OggFLAC__seekable_stream_encoder_set_client_data(). + * \retval FLAC__SeekableStreamEncoderSeekStatus + * The callee's return status. + */ +typedef FLAC__SeekableStreamEncoderSeekStatus (*OggFLAC__SeekableStreamEncoderSeekCallback)(const OggFLAC__SeekableStreamEncoder *encoder, FLAC__uint64 absolute_byte_offset, void *client_data); + +/** Signature for the tell callback. + * See OggFLAC__seekable_stream_encoder_set_tell_callback() + * and FLAC__SeekableStreamEncoderTellCallback for more info. + * + * \param encoder The encoder instance calling the callback. + * \param absolute_byte_offset The address at which to store the current + * position of the output. + * \param client_data The callee's client data set through + * OggFLAC__seekable_stream_encoder_set_client_data(). + * \retval FLAC__SeekableStreamEncoderTellStatus + * The callee's return status. + */ +typedef FLAC__SeekableStreamEncoderTellStatus (*OggFLAC__SeekableStreamEncoderTellCallback)(const OggFLAC__SeekableStreamEncoder *encoder, FLAC__uint64 *absolute_byte_offset, void *client_data); + +/** Signature for the write callback. + * See OggFLAC__seekable_stream_encoder_set_write_callback() + * and FLAC__SeekableStreamEncoderWriteCallback for more info. + * + * \param encoder The encoder instance calling the callback. + * \param buffer An array of encoded data of length \a bytes. + * \param bytes The byte length of \a buffer. + * \param samples The number of samples encoded by \a buffer. + * \c 0 has a special meaning; see + * OggFLAC__seekable_stream_encoder_set_write_callback(). + * \param current_frame The number of current frame being encoded. + * \param client_data The callee's client data set through + * OggFLAC__seekable_stream_encoder_set_client_data(). + * \retval FLAC__StreamEncoderWriteStatus + * The callee's return status. + */ +typedef FLAC__StreamEncoderWriteStatus (*OggFLAC__SeekableStreamEncoderWriteCallback)(const OggFLAC__SeekableStreamEncoder *encoder, const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame, void *client_data); + + +/*********************************************************************** + * + * Class constructor/destructor + * + ***********************************************************************/ + +/** Create a new seekable stream encoder instance. The instance is created with + * default settings; see the individual OggFLAC__seekable_stream_encoder_set_*() + * functions for each setting's default. + * + * \retval OggFLAC__SeekableStreamEncoder* + * \c NULL if there was an error allocating memory, else the new instance. + */ +OggFLAC_API OggFLAC__SeekableStreamEncoder *OggFLAC__seekable_stream_encoder_new(); + +/** Free an encoder instance. Deletes the object pointed to by \a encoder. + * + * \param encoder A pointer to an existing encoder. + * \assert + * \code encoder != NULL \endcode + */ +OggFLAC_API void OggFLAC__seekable_stream_encoder_delete(OggFLAC__SeekableStreamEncoder *encoder); + + +/*********************************************************************** + * + * Public class method prototypes + * + ***********************************************************************/ + +/** Set the serial number for the FLAC stream. + * + * \default \c 0 + * \param encoder An encoder instance to set. + * \param serial_number See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_set_serial_number(OggFLAC__SeekableStreamEncoder *encoder, long serial_number); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_verify() + * + * \default \c false + * \param encoder An encoder instance to set. + * \param value Flag value (see above). + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_set_verify(OggFLAC__SeekableStreamEncoder *encoder, FLAC__bool value); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_streamable_subset() + * + * \default \c true + * \param encoder An encoder instance to set. + * \param value Flag value (see above). + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_set_streamable_subset(OggFLAC__SeekableStreamEncoder *encoder, FLAC__bool value); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_do_mid_side_stereo() + * + * \default \c false + * \param encoder An encoder instance to set. + * \param value Flag value (see above). + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_set_do_mid_side_stereo(OggFLAC__SeekableStreamEncoder *encoder, FLAC__bool value); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_loose_mid_side_stereo() + * + * \default \c false + * \param encoder An encoder instance to set. + * \param value Flag value (see above). + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_set_loose_mid_side_stereo(OggFLAC__SeekableStreamEncoder *encoder, FLAC__bool value); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_channels() + * + * \default \c 2 + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_set_channels(OggFLAC__SeekableStreamEncoder *encoder, unsigned value); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_bits_per_sample() + * + * \default \c 16 + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_set_bits_per_sample(OggFLAC__SeekableStreamEncoder *encoder, unsigned value); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_sample_rate() + * + * \default \c 44100 + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_set_sample_rate(OggFLAC__SeekableStreamEncoder *encoder, unsigned value); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_blocksize() + * + * \default \c 1152 + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_set_blocksize(OggFLAC__SeekableStreamEncoder *encoder, unsigned value); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_max_lpc_order() + * + * \default \c 0 + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_set_max_lpc_order(OggFLAC__SeekableStreamEncoder *encoder, unsigned value); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_qlp_coeff_precision() + * + * \default \c 0 + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_set_qlp_coeff_precision(OggFLAC__SeekableStreamEncoder *encoder, unsigned value); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_qlp_coeff_prec_search() + * + * \default \c false + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_set_do_qlp_coeff_prec_search(OggFLAC__SeekableStreamEncoder *encoder, FLAC__bool value); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_do_escape_coding() + * + * \default \c false + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_set_do_escape_coding(OggFLAC__SeekableStreamEncoder *encoder, FLAC__bool value); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_do_exhaustive_model_search() + * + * \default \c false + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_set_do_exhaustive_model_search(OggFLAC__SeekableStreamEncoder *encoder, FLAC__bool value); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_min_residual_partition_order() + * + * \default \c 0 + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_set_min_residual_partition_order(OggFLAC__SeekableStreamEncoder *encoder, unsigned value); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_max_residual_partition_order() + * + * \default \c 0 + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_set_max_residual_partition_order(OggFLAC__SeekableStreamEncoder *encoder, unsigned value); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_rice_parameter_search_dist() + * + * \default \c 0 + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_set_rice_parameter_search_dist(OggFLAC__SeekableStreamEncoder *encoder, unsigned value); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_total_samples_estimate() + * + * \default \c 0 + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_set_total_samples_estimate(OggFLAC__SeekableStreamEncoder *encoder, FLAC__uint64 value); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_metadata() + * + * \note The Ogg FLAC mapping requires that the VORBIS_COMMENT block be + * the second metadata block of the stream. The encoder already supplies + * the STREAMINFO block automatically. If \a metadata does not contain a + * VORBIS_COMMENT block, the encoder will supply that too. Otherwise, if + * \a metadata does contain a VORBIS_COMMENT block and it is not the + * first, this function will reorder \a metadata by moving the + * VORBIS_COMMENT block to the front; the relative ordering of the other + * blocks will remain as they were. + * + * \note The Ogg FLAC mapping limits the number of metadata blocks per + * stream to \c 65535. If \a num_blocks exceeds this the function will + * return \c false. + * + * \default \c NULL, 0 + * \param encoder An encoder instance to set. + * \param metadata See above. + * \param num_blocks See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, or if + * \a num_blocks > 65535, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_set_metadata(OggFLAC__SeekableStreamEncoder *encoder, FLAC__StreamMetadata **metadata, unsigned num_blocks); + +/** Set the read callback. + * The supplied function will be called when the encoder needs to read back + * encoded data. This happens during the metadata callback, when the encoder + * has to read, modify, and rewrite the metadata (e.g. seekpoints) gathered + * while encoding. The address of the buffer to be filled is supplied, along + * with the number of bytes the buffer can hold. The callback may choose to + * supply less data and modify the byte count but must be careful not to + * overflow the buffer. The callback then returns a status code chosen from + * OggFLAC__SeekableStreamEncoderReadStatus. + * + * \note + * The callback is mandatory and must be set before initialization. + * + * \default \c NULL + * \param encoder A encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \code value != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_set_read_callback(OggFLAC__SeekableStreamEncoder *encoder, OggFLAC__SeekableStreamEncoderReadCallback value); + +/** Set the seek callback. + * The supplied function will be called when the encoder needs to seek + * the output stream. The encoder will pass the absolute byte offset + * to seek to, 0 meaning the beginning of the stream. + * + * \note + * The callback is mandatory and must be set before initialization. + * + * \default \c NULL + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \code value != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_set_seek_callback(OggFLAC__SeekableStreamEncoder *encoder, OggFLAC__SeekableStreamEncoderSeekCallback value); + +/** Set the tell callback. + * The supplied function will be called when the encoder needs to know + * the current position of the output stream. + * + * \note + * The callback is mandatory and must be set before initialization. + * + * \default \c NULL + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \code value != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_set_tell_callback(OggFLAC__SeekableStreamEncoder *encoder, OggFLAC__SeekableStreamEncoderTellCallback value); + +/** Set the write callback. + * This is inherited from FLAC__StreamEncoder; see + * FLAC__stream_encoder_set_write_callback(). + * + * \note + * Unlike the FLAC seekable stream encoder write callback, the Ogg + * seekable stream encoder write callback will be called twice when + * writing audio frames; once for the page header, and once for the page + * body. When writing the page header, the \a samples argument to the + * write callback will be \c 0. + * + * \note + * The callback is mandatory and must be set before initialization. + * + * \default \c NULL + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \code value != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_set_write_callback(OggFLAC__SeekableStreamEncoder *encoder, OggFLAC__SeekableStreamEncoderWriteCallback value); + +/** Set the client data to be passed back to callbacks. + * This value will be supplied to callbacks in their \a client_data + * argument. + * + * \default \c NULL + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_set_client_data(OggFLAC__SeekableStreamEncoder *encoder, void *value); + +/** Get the current encoder state. + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval OggFLAC__SeekableStreamEncoderState + * The current encoder state. + */ +OggFLAC_API OggFLAC__SeekableStreamEncoderState OggFLAC__seekable_stream_encoder_get_state(const OggFLAC__SeekableStreamEncoder *encoder); + +/** Get the state of the underlying FLAC stream encoder. + * Useful when the seekable stream encoder state is + * \c OggFLAC__SEEKABLE_STREAM_ENCODER_FLAC_STREAM_ENCODER_ERROR. + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__StreamEncoderState + * The FLAC stream encoder state. + */ +OggFLAC_API FLAC__StreamEncoderState OggFLAC__seekable_stream_encoder_get_FLAC_stream_encoder_state(const OggFLAC__SeekableStreamEncoder *encoder); + +/** Get the state of the underlying FLAC encoder's verify decoder. + * Useful when the seekable stream encoder state is + * \c OggFLAC__SEEKABLE_STREAM_ENCODER_FLAC_STREAM_ENCODER_ERROR + * and the FLAC stream encoder state is + * \c FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR. + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__StreamDecoderState + * The FLAC verify decoder state. + */ +OggFLAC_API FLAC__StreamDecoderState OggFLAC__seekable_stream_encoder_get_verify_decoder_state(const OggFLAC__SeekableStreamEncoder *encoder); + +/** Get the current encoder state as a C string. + * This version automatically resolves + * \c OggFLAC__SEEKABLE_STREAM_ENCODER_FLAC_STREAM_ENCODER_ERROR + * by getting the FLAC stream encoder's resolved state. + * + * \param encoder A encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval const char * + * The encoder state as a C string. Do not modify the contents. + */ +OggFLAC_API const char *OggFLAC__seekable_stream_encoder_get_resolved_state_string(const OggFLAC__SeekableStreamEncoder *encoder); + +/** Get relevant values about the nature of a verify decoder error. + * Inherited from FLAC__stream_encoder_get_verify_decoder_error_stats(). + * Useful when the seekable stream encoder state is + * \c OggFLAC__SEEKABLE_STREAM_ENCODER_FLAC_STREAM_ENCODER_ERROR + * and the FLAC stream encoder state is + * \c FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR. + * + * \param encoder An encoder instance to query. + * \param absolute_sample The absolute sample number of the mismatch. + * \param frame_number The number of the frame in which the mismatch occurred. + * \param channel The channel in which the mismatch occurred. + * \param sample The number of the sample (relative to the frame) in + * which the mismatch occurred. + * \param expected The expected value for the sample in question. + * \param got The actual value returned by the decoder. + * \assert + * \code encoder != NULL \endcode + * \code absolute_sample != NULL \endcode + * \code frame_number != NULL \endcode + * \code channel != NULL \endcode + * \code sample != NULL \endcode + * \code expected != NULL \endcode + */ +OggFLAC_API void OggFLAC__seekable_stream_encoder_get_verify_decoder_error_stats(const OggFLAC__SeekableStreamEncoder *encoder, FLAC__uint64 *absolute_sample, unsigned *frame_number, unsigned *channel, unsigned *sample, FLAC__int32 *expected, FLAC__int32 *got); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_verify() + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * See OggFLAC__seekable_stream_encoder_set_verify(). + */ +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_get_verify(const OggFLAC__SeekableStreamEncoder *encoder); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_streamable_subset() + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * See OggFLAC__seekable_stream_encoder_set_streamable_subset(). + */ +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_get_streamable_subset(const OggFLAC__SeekableStreamEncoder *encoder); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_do_mid_side_stereo() + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * See OggFLAC__seekable_stream_encoder_get_do_mid_side_stereo(). + */ +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_get_do_mid_side_stereo(const OggFLAC__SeekableStreamEncoder *encoder); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_loose_mid_side_stereo() + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * See OggFLAC__seekable_stream_encoder_set_loose_mid_side_stereo(). + */ +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_get_loose_mid_side_stereo(const OggFLAC__SeekableStreamEncoder *encoder); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_channels() + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval unsigned + * See OggFLAC__seekable_stream_encoder_set_channels(). + */ +OggFLAC_API unsigned OggFLAC__seekable_stream_encoder_get_channels(const OggFLAC__SeekableStreamEncoder *encoder); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_bits_per_sample() + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval unsigned + * See OggFLAC__seekable_stream_encoder_set_bits_per_sample(). + */ +OggFLAC_API unsigned OggFLAC__seekable_stream_encoder_get_bits_per_sample(const OggFLAC__SeekableStreamEncoder *encoder); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_sample_rate() + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval unsigned + * See OggFLAC__seekable_stream_encoder_set_sample_rate(). + */ +OggFLAC_API unsigned OggFLAC__seekable_stream_encoder_get_sample_rate(const OggFLAC__SeekableStreamEncoder *encoder); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_blocksize() + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval unsigned + * See OggFLAC__seekable_stream_encoder_set_blocksize(). + */ +OggFLAC_API unsigned OggFLAC__seekable_stream_encoder_get_blocksize(const OggFLAC__SeekableStreamEncoder *encoder); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_max_lpc_order() + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval unsigned + * See OggFLAC__seekable_stream_encoder_set_max_lpc_order(). + */ +OggFLAC_API unsigned OggFLAC__seekable_stream_encoder_get_max_lpc_order(const OggFLAC__SeekableStreamEncoder *encoder); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_qlp_coeff_precision() + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval unsigned + * See OggFLAC__seekable_stream_encoder_set_qlp_coeff_precision(). + */ +OggFLAC_API unsigned OggFLAC__seekable_stream_encoder_get_qlp_coeff_precision(const OggFLAC__SeekableStreamEncoder *encoder); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_do_qlp_coeff_prec_search() + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * See OggFLAC__seekable_stream_encoder_set_do_qlp_coeff_prec_search(). + */ +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_get_do_qlp_coeff_prec_search(const OggFLAC__SeekableStreamEncoder *encoder); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_do_escape_coding() + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * See OggFLAC__seekable_stream_encoder_set_do_escape_coding(). + */ +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_get_do_escape_coding(const OggFLAC__SeekableStreamEncoder *encoder); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_do_exhaustive_model_search() + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * See OggFLAC__seekable_stream_encoder_set_do_exhaustive_model_search(). + */ +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_get_do_exhaustive_model_search(const OggFLAC__SeekableStreamEncoder *encoder); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_min_residual_partition_order() + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval unsigned + * See OggFLAC__seekable_stream_encoder_set_min_residual_partition_order(). + */ +OggFLAC_API unsigned OggFLAC__seekable_stream_encoder_get_min_residual_partition_order(const OggFLAC__SeekableStreamEncoder *encoder); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_man_residual_partition_order() + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval unsigned + * See OggFLAC__seekable_stream_encoder_set_max_residual_partition_order(). + */ +OggFLAC_API unsigned OggFLAC__seekable_stream_encoder_get_max_residual_partition_order(const OggFLAC__SeekableStreamEncoder *encoder); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_rice_parameter_search_dist() + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval unsigned + * See OggFLAC__seekable_stream_encoder_set_rice_parameter_search_dist(). + */ +OggFLAC_API unsigned OggFLAC__seekable_stream_encoder_get_rice_parameter_search_dist(const OggFLAC__SeekableStreamEncoder *encoder); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_total_samples_estimate() + * + * \param encoder An encoder instance to set. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__uint64 + * See OggFLAC__seekable_stream_encoder_get_total_samples_estimate(). + */ +OggFLAC_API FLAC__uint64 OggFLAC__seekable_stream_encoder_get_total_samples_estimate(const OggFLAC__SeekableStreamEncoder *encoder); + +/** Initialize the encoder instance. + * Should be called after OggFLAC__seekable_stream_encoder_new() and + * OggFLAC__seekable_stream_encoder_set_*() but before OggFLAC__seekable_stream_encoder_process() + * or OggFLAC__seekable_stream_encoder_process_interleaved(). Will set and return + * the encoder state, which will be OggFLAC__SEEKABLE_STREAM_ENCODER_OK if + * initialization succeeded. + * + * The call to OggFLAC__seekable_stream_encoder_init() currently will also immediately + * call the write callback several times, once with the \c fLaC signature, + * and once for each encoded metadata block. + * + * \param encoder An uninitialized encoder instance. + * \assert + * \code encoder != NULL \endcode + * \retval OggFLAC__SeekableStreamEncoderState + * \c OggFLAC__SEEKABLE_STREAM_ENCODER_OK if initialization was successful; see + * OggFLAC__SeekableStreamEncoderState for the meanings of other return values. + */ +OggFLAC_API OggFLAC__SeekableStreamEncoderState OggFLAC__seekable_stream_encoder_init(OggFLAC__SeekableStreamEncoder *encoder); + +/** Finish the encoding process. + * Flushes the encoding buffer, releases resources, resets the encoder + * settings to their defaults, and returns the encoder state to + * OggFLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED. Note that this can generate + * one or more write callbacks before returning. + * + * In the event of a prematurely-terminated encode, it is not strictly + * necessary to call this immediately before OggFLAC__seekable_stream_encoder_delete() + * but it is good practice to match every OggFLAC__seekable_stream_encoder_init() + * with an OggFLAC__seekable_stream_encoder_finish(). + * + * \param encoder An uninitialized encoder instance. + * \assert + * \code encoder != NULL \endcode + */ +OggFLAC_API void OggFLAC__seekable_stream_encoder_finish(OggFLAC__SeekableStreamEncoder *encoder); + +/** Submit data for encoding. + * This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_process(). + * + * \param encoder An initialized encoder instance in the OK state. + * \param buffer An array of pointers to each channel's signal. + * \param samples The number of samples in one channel. + * \assert + * \code encoder != NULL \endcode + * \code OggFLAC__seekable_stream_encoder_get_state(encoder) == OggFLAC__SEEKABLE_STREAM_ENCODER_OK \endcode + * \retval FLAC__bool + * \c true if successful, else \c false; in this case, check the + * encoder state with OggFLAC__seekable_stream_encoder_get_state() to see what + * went wrong. + */ +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_process(OggFLAC__SeekableStreamEncoder *encoder, const FLAC__int32 * const buffer[], unsigned samples); + +/** Submit data for encoding. + * This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_process_interleaved(). + * + * \param encoder An initialized encoder instance in the OK state. + * \param buffer An array of channel-interleaved data (see above). + * \param samples The number of samples in one channel, the same as for + * OggFLAC__seekable_stream_encoder_process(). For example, if + * encoding two channels, \c 1000 \a samples corresponds + * to a \a buffer of 2000 values. + * \assert + * \code encoder != NULL \endcode + * \code OggFLAC__seekable_stream_encoder_get_state(encoder) == OggFLAC__SEEKABLE_STREAM_ENCODER_OK \endcode + * \retval FLAC__bool + * \c true if successful, else \c false; in this case, check the + * encoder state with OggFLAC__seekable_stream_encoder_get_state() to see what + * went wrong. + */ +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_process_interleaved(OggFLAC__SeekableStreamEncoder *encoder, const FLAC__int32 buffer[], unsigned samples); + +/* \} */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Libraries/FLAC/Files/include/OggFLAC/stream_decoder.h b/Libraries/FLAC/Files/include/OggFLAC/stream_decoder.h new file mode 100644 index 000000000..6cda675fb --- /dev/null +++ b/Libraries/FLAC/Files/include/OggFLAC/stream_decoder.h @@ -0,0 +1,622 @@ +/* libOggFLAC - Free Lossless Audio Codec + Ogg library + * Copyright (C) 2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef OggFLAC__STREAM_DECODER_H +#define OggFLAC__STREAM_DECODER_H + +#include "export.h" + +#include "FLAC/stream_decoder.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +/** \file include/OggFLAC/stream_decoder.h + * + * \brief + * This module contains the functions which implement the stream + * decoder. + * + * See the detailed documentation in the + * \link oggflac_stream_decoder stream decoder \endlink module. + */ + +/** \defgroup oggflac_decoder OggFLAC/ *_decoder.h: decoder interfaces + * \ingroup oggflac + * + * \brief + * This module describes the three decoder layers provided by libOggFLAC. + * + * libOggFLAC currently provides the same three layers of access as + * libFLAC; the interfaces are nearly identical, with th addition of a + * method for specifying the Ogg serial number. See the + * \link flac_decoder FLAC decoder module \endlink for full documentation. + */ + +/** \defgroup oggflac_stream_decoder OggFLAC/stream_decoder.h: stream decoder interface + * \ingroup oggflac_decoder + * + * \brief + * This module contains the functions which implement the stream + * decoder. + * + * The interface here is nearly identical to FLAC's stream decoder, + * including the callbacks, with the addition of + * OggFLAC__stream_decoder_set_serial_number(). See the + * \link flac_stream_decoder FLAC stream decoder module \endlink + * for full documentation. + * + * \{ + */ + + +/** State values for an OggFLAC__StreamDecoder + * + * The decoder's state can be obtained by calling OggFLAC__stream_decoder_get_state(). + */ +typedef enum { + + OggFLAC__STREAM_DECODER_OK = 0, + /**< The decoder is in the normal OK state. */ + + OggFLAC__STREAM_DECODER_END_OF_STREAM, + /**< The decoder has reached the end of the stream. */ + + OggFLAC__STREAM_DECODER_OGG_ERROR, + /**< An error occurred in the underlying Ogg layer. */ + + OggFLAC__STREAM_DECODER_READ_ERROR, + /**< The read callback returned an error. */ + + OggFLAC__STREAM_DECODER_FLAC_STREAM_DECODER_ERROR, + /**< An error occurred in the underlying FLAC stream decoder; + * check OggFLAC__stream_decoder_get_FLAC_stream_decoder_state(). + */ + + OggFLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR, + /**< Memory allocation failed. */ + + OggFLAC__STREAM_DECODER_ALREADY_INITIALIZED, + /**< OggFLAC__stream_decoder_init() was called when the decoder was + * already initialized, usually because + * OggFLAC__stream_decoder_finish() was not called. + */ + + OggFLAC__STREAM_DECODER_INVALID_CALLBACK, + /**< The decoder was initialized before setting all the required callbacks. */ + + OggFLAC__STREAM_DECODER_UNINITIALIZED + /**< The decoder is in the uninitialized state. */ + +} OggFLAC__StreamDecoderState; + +/** Maps an OggFLAC__StreamDecoderState to a C string. + * + * Using an OggFLAC__StreamDecoderState as the index to this array + * will give the string equivalent. The contents should not be modified. + */ +extern OggFLAC_API const char * const OggFLAC__StreamDecoderStateString[]; + + +/*********************************************************************** + * + * class OggFLAC__StreamDecoder + * + ***********************************************************************/ + +struct OggFLAC__StreamDecoderProtected; +struct OggFLAC__StreamDecoderPrivate; +/** The opaque structure definition for the stream decoder type. + * See the \link oggflac_stream_decoder stream decoder module \endlink + * for a detailed description. + */ +typedef struct { + struct OggFLAC__StreamDecoderProtected *protected_; /* avoid the C++ keyword 'protected' */ + struct OggFLAC__StreamDecoderPrivate *private_; /* avoid the C++ keyword 'private' */ +} OggFLAC__StreamDecoder; + +/** Signature for the read callback. + * See OggFLAC__stream_decoder_set_read_callback() + * and FLAC__StreamDecoderReadCallback for more info. + * + * \param decoder The decoder instance calling the callback. + * \param buffer A pointer to a location for the callee to store + * data to be decoded. + * \param bytes A pointer to the size of the buffer. On entry + * to the callback, it contains the maximum number + * of bytes that may be stored in \a buffer. The + * callee must set it to the actual number of bytes + * stored before returning. + * \param client_data The callee's client data set through + * OggFLAC__stream_decoder_set_client_data(). + * \retval FLAC__StreamDecoderReadStatus + * The callee's return status. + */ +typedef FLAC__StreamDecoderReadStatus (*OggFLAC__StreamDecoderReadCallback)(const OggFLAC__StreamDecoder *decoder, FLAC__byte buffer[], unsigned *bytes, void *client_data); + +/** Signature for the write callback. + * See OggFLAC__stream_decoder_set_write_callback() + * and FLAC__StreamDecoderWriteCallback for more info. + * + * \param decoder The decoder instance calling the callback. + * \param frame The description of the decoded frame. See + * FLAC__Frame. + * \param buffer An array of pointers to decoded channels of data. + * Each pointer will point to an array of signed + * samples of length \a frame->header.blocksize. + * Currently, the channel order has no meaning + * except for stereo streams; in this case channel + * 0 is left and 1 is right. + * \param client_data The callee's client data set through + * OggFLAC__stream_decoder_set_client_data(). + * \retval FLAC__StreamDecoderWriteStatus + * The callee's return status. + */ +typedef FLAC__StreamDecoderWriteStatus (*OggFLAC__StreamDecoderWriteCallback)(const OggFLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data); + +/** Signature for the metadata callback. + * See OggFLAC__stream_decoder_set_metadata_callback() + * and FLAC__StreamDecoderMetadataCallback for more info. + * + * \param decoder The decoder instance calling the callback. + * \param metadata The decoded metadata block. + * \param client_data The callee's client data set through + * OggFLAC__stream_decoder_set_client_data(). + */ +typedef void (*OggFLAC__StreamDecoderMetadataCallback)(const OggFLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data); + +/** Signature for the error callback. + * See OggFLAC__stream_decoder_set_error_callback() + * and FLAC__StreamDecoderErrorCallback for more info. + * + * \param decoder The decoder instance calling the callback. + * \param status The error encountered by the decoder. + * \param client_data The callee's client data set through + * OggFLAC__stream_decoder_set_client_data(). + */ +typedef void (*OggFLAC__StreamDecoderErrorCallback)(const OggFLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data); + + +/*********************************************************************** + * + * Class constructor/destructor + * + ***********************************************************************/ + +/** Create a new stream decoder instance. The instance is created with + * default settings; see the individual OggFLAC__stream_decoder_set_*() + * functions for each setting's default. + * + * \retval OggFLAC__StreamDecoder* + * \c NULL if there was an error allocating memory, else the new instance. + */ +OggFLAC_API OggFLAC__StreamDecoder *OggFLAC__stream_decoder_new(); + +/** Free a decoder instance. Deletes the object pointed to by \a decoder. + * + * \param decoder A pointer to an existing decoder. + * \assert + * \code decoder != NULL \endcode + */ +OggFLAC_API void OggFLAC__stream_decoder_delete(OggFLAC__StreamDecoder *decoder); + + +/*********************************************************************** + * + * Public class method prototypes + * + ***********************************************************************/ + +/** Set the read callback. + * This is inherited from FLAC__StreamDecoder; see FLAC__stream_decoder_set_read_callback() + * + * \note + * The callback is mandatory and must be set before initialization. + * + * \default \c NULL + * \param decoder A decoder instance to set. + * \param value See above. + * \assert + * \code decoder != NULL \endcode + * \code value != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__stream_decoder_set_read_callback(OggFLAC__StreamDecoder *decoder, OggFLAC__StreamDecoderReadCallback value); + +/** Set the write callback. + * This is inherited from FLAC__StreamDecoder; see FLAC__stream_decoder_set_write_callback() + * + * \note + * The callback is mandatory and must be set before initialization. + * + * \default \c NULL + * \param decoder A decoder instance to set. + * \param value See above. + * \assert + * \code decoder != NULL \endcode + * \code value != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__stream_decoder_set_write_callback(OggFLAC__StreamDecoder *decoder, OggFLAC__StreamDecoderWriteCallback value); + +/** Set the metadata callback. + * This is inherited from FLAC__StreamDecoder; see FLAC__stream_decoder_set_metadata_callback() + * + * \note + * The callback is mandatory and must be set before initialization. + * + * \default \c NULL + * \param decoder A decoder instance to set. + * \param value See above. + * \assert + * \code decoder != NULL \endcode + * \code value != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__stream_decoder_set_metadata_callback(OggFLAC__StreamDecoder *decoder, OggFLAC__StreamDecoderMetadataCallback value); + +/** Set the error callback. + * This is inherited from FLAC__StreamDecoder; see FLAC__stream_decoder_set_error_callback() + * + * \note + * The callback is mandatory and must be set before initialization. + * + * \default \c NULL + * \param decoder A decoder instance to set. + * \param value See above. + * \assert + * \code decoder != NULL \endcode + * \code value != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__stream_decoder_set_error_callback(OggFLAC__StreamDecoder *decoder, OggFLAC__StreamDecoderErrorCallback value); + +/** Set the client data to be passed back to callbacks. + * This value will be supplied to callbacks in their \a client_data + * argument. + * + * \default \c NULL + * \param decoder A decoder instance to set. + * \param value See above. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__stream_decoder_set_client_data(OggFLAC__StreamDecoder *decoder, void *value); + +/** Set the serial number for the Ogg stream. + * The default behavior is to use the serial number of the first Ogg + * page. Setting a serial number here will explicitly specify which + * stream is to be decoded. + * + * \default \c use serial number of first page + * \param decoder A decoder instance to set. + * \param serial_number See above. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__stream_decoder_set_serial_number(OggFLAC__StreamDecoder *decoder, long serial_number); + +/** Direct the decoder to pass on all metadata blocks of type \a type. + * This is inherited from FLAC__StreamDecoder; see FLAC__stream_decoder_set_metadata_respond() + * + * \default By default, only the \c STREAMINFO block is returned via the + * metadata callback. + * \param decoder A decoder instance to set. + * \param type See above. + * \assert + * \code decoder != NULL \endcode + * \a type is valid + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__stream_decoder_set_metadata_respond(OggFLAC__StreamDecoder *decoder, FLAC__MetadataType type); + +/** Direct the decoder to pass on all APPLICATION metadata blocks of the + * given \a id. + * This is inherited from FLAC__StreamDecoder; see FLAC__stream_decoder_set_metadata_respond_application() + * + * \default By default, only the \c STREAMINFO block is returned via the + * metadata callback. + * \param decoder A decoder instance to set. + * \param id See above. + * \assert + * \code decoder != NULL \endcode + * \code id != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__stream_decoder_set_metadata_respond_application(OggFLAC__StreamDecoder *decoder, const FLAC__byte id[4]); + +/** Direct the decoder to pass on all metadata blocks of any type. + * This is inherited from FLAC__StreamDecoder; see FLAC__stream_decoder_set_metadata_respond_all() + * + * \default By default, only the \c STREAMINFO block is returned via the + * metadata callback. + * \param decoder A decoder instance to set. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__stream_decoder_set_metadata_respond_all(OggFLAC__StreamDecoder *decoder); + +/** Direct the decoder to filter out all metadata blocks of type \a type. + * This is inherited from FLAC__StreamDecoder; see FLAC__stream_decoder_set_metadata_ignore() + * + * \default By default, only the \c STREAMINFO block is returned via the + * metadata callback. + * \param decoder A decoder instance to set. + * \param type See above. + * \assert + * \code decoder != NULL \endcode + * \a type is valid + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__stream_decoder_set_metadata_ignore(OggFLAC__StreamDecoder *decoder, FLAC__MetadataType type); + +/** Direct the decoder to filter out all APPLICATION metadata blocks of + * the given \a id. + * This is inherited from FLAC__StreamDecoder; see FLAC__stream_decoder_set_metadata_ignore_application() + * + * \default By default, only the \c STREAMINFO block is returned via the + * metadata callback. + * \param decoder A decoder instance to set. + * \param id See above. + * \assert + * \code decoder != NULL \endcode + * \code id != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__stream_decoder_set_metadata_ignore_application(OggFLAC__StreamDecoder *decoder, const FLAC__byte id[4]); + +/** Direct the decoder to filter out all metadata blocks of any type. + * This is inherited from FLAC__StreamDecoder; see FLAC__stream_decoder_set_metadata_ignore_all() + * + * \default By default, only the \c STREAMINFO block is returned via the + * metadata callback. + * \param decoder A decoder instance to set. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * \c false if the decoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__stream_decoder_set_metadata_ignore_all(OggFLAC__StreamDecoder *decoder); + +/** Get the current decoder state. + * + * \param decoder A decoder instance to query. + * \assert + * \code decoder != NULL \endcode + * \retval OggFLAC__StreamDecoderState + * The current decoder state. + */ +OggFLAC_API OggFLAC__StreamDecoderState OggFLAC__stream_decoder_get_state(const OggFLAC__StreamDecoder *decoder); + +/** Get the state of the underlying FLAC stream decoder. + * Useful when the stream decoder state is + * \c OggFLAC__STREAM_DECODER_FLAC_STREAM_DECODER_ERROR. + * + * \param decoder A decoder instance to query. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__StreamDecoderState + * The FLAC stream decoder state. + */ +OggFLAC_API FLAC__StreamDecoderState OggFLAC__stream_decoder_get_FLAC_stream_decoder_state(const OggFLAC__StreamDecoder *decoder); + +/** Get the current decoder state as a C string. + * This version automatically resolves + * \c OggFLAC__STREAM_DECODER_FLAC_STREAM_DECODER_ERROR + * by getting the FLAC stream decoder's state. + * + * \param decoder A decoder instance to query. + * \assert + * \code decoder != NULL \endcode + * \retval const char * + * The decoder state as a C string. Do not modify the contents. + */ +OggFLAC_API const char *OggFLAC__stream_decoder_get_resolved_state_string(const OggFLAC__StreamDecoder *decoder); + +/** This is inherited from FLAC__StreamDecoder; see FLAC__stream_decoder_get_channels() + * + * \param decoder A decoder instance to query. + * \assert + * \code decoder != NULL \endcode + * \retval unsigned + * See above. + */ +OggFLAC_API unsigned OggFLAC__stream_decoder_get_channels(const OggFLAC__StreamDecoder *decoder); + +/** This is inherited from FLAC__StreamDecoder; see FLAC__stream_decoder_get_channel_assignment() + * + * \param decoder A decoder instance to query. + * \assert + * \code decoder != NULL \endcode + * \retval OggFLAC__ChannelAssignment + * See above. + */ +OggFLAC_API FLAC__ChannelAssignment OggFLAC__stream_decoder_get_channel_assignment(const OggFLAC__StreamDecoder *decoder); + +/** This is inherited from FLAC__StreamDecoder; see FLAC__stream_decoder_get_bits_per_sample() + * + * \param decoder A decoder instance to query. + * \assert + * \code decoder != NULL \endcode + * \retval unsigned + * See above. + */ +OggFLAC_API unsigned OggFLAC__stream_decoder_get_bits_per_sample(const OggFLAC__StreamDecoder *decoder); + +/** This is inherited from FLAC__StreamDecoder; see FLAC__stream_decoder_get_sample_rate() + * + * \param decoder A decoder instance to query. + * \assert + * \code decoder != NULL \endcode + * \retval unsigned + * See above. + */ +OggFLAC_API unsigned OggFLAC__stream_decoder_get_sample_rate(const OggFLAC__StreamDecoder *decoder); + +/** This is inherited from FLAC__StreamDecoder; see FLAC__stream_decoder_get_blocksize() + * + * \param decoder A decoder instance to query. + * \assert + * \code decoder != NULL \endcode + * \retval unsigned + * See above. + */ +OggFLAC_API unsigned OggFLAC__stream_decoder_get_blocksize(const OggFLAC__StreamDecoder *decoder); + +/** Initialize the decoder instance. + * Should be called after OggFLAC__stream_decoder_new() and + * OggFLAC__stream_decoder_set_*() but before any of the + * OggFLAC__stream_decoder_process_*() functions. Will set and return the + * decoder state, which will be OggFLAC__STREAM_DECODER_OK + * if initialization succeeded. + * + * \param decoder An uninitialized decoder instance. + * \assert + * \code decoder != NULL \endcode + * \retval OggFLAC__StreamDecoderState + * \c OggFLAC__STREAM_DECODER_OK if initialization was + * successful; see OggFLAC__StreamDecoderState for the meanings of other + * return values. + */ +OggFLAC_API OggFLAC__StreamDecoderState OggFLAC__stream_decoder_init(OggFLAC__StreamDecoder *decoder); + +/** Finish the decoding process. + * Flushes the decoding buffer, releases resources, resets the decoder + * settings to their defaults, and returns the decoder state to + * OggFLAC__STREAM_DECODER_UNINITIALIZED. + * + * In the event of a prematurely-terminated decode, it is not strictly + * necessary to call this immediately before OggFLAC__stream_decoder_delete() + * but it is good practice to match every OggFLAC__stream_decoder_init() + * with an OggFLAC__stream_decoder_finish(). + * + * \param decoder An uninitialized decoder instance. + * \assert + * \code decoder != NULL \endcode + */ +OggFLAC_API void OggFLAC__stream_decoder_finish(OggFLAC__StreamDecoder *decoder); + +/** This is inherited from FLAC__StreamDecoder; see FLAC__stream_decoder_flush() + * + * \param decoder A decoder instance. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * \c true if successful, else \c false if a memory allocation + * error occurs. + */ +OggFLAC_API FLAC__bool OggFLAC__stream_decoder_flush(OggFLAC__StreamDecoder *decoder); + +/** This is inherited from FLAC__StreamDecoder; see FLAC__stream_decoder_reset() + * + * \param decoder A decoder instance. + * \assert + * \code decoder != NULL \endcode + * \retval FLAC__bool + * \c true if successful, else \c false if a memory allocation + * error occurs. + */ +OggFLAC_API FLAC__bool OggFLAC__stream_decoder_reset(OggFLAC__StreamDecoder *decoder); + +/** Decode one metadata block or audio frame. + * This is inherited from FLAC__StreamDecoder; see FLAC__stream_decoder_process_single() + * + * \param decoder An initialized decoder instance in the state + * \c OggFLAC__STREAM_DECODER_OK. + * \assert + * \code decoder != NULL \endcode + * \code OggFLAC__stream_decoder_get_state(decoder) == OggFLAC__STREAM_DECODER_OK \endcode + * \retval FLAC__bool + * \c false if any read or write error occurred (except + * \c FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC), else \c true; + * in any case, check the decoder state with + * OggFLAC__stream_decoder_get_state() to see what went wrong or to + * check for lost synchronization (a sign of stream corruption). + */ +OggFLAC_API FLAC__bool OggFLAC__stream_decoder_process_single(OggFLAC__StreamDecoder *decoder); + +/** Decode until the end of the metadata. + * This is inherited from FLAC__StreamDecoder; see FLAC__stream_decoder_process_until_end_of_metadata() + * + * \param decoder An initialized decoder instance in the state + * \c OggFLAC__STREAM_DECODER_OK. + * \assert + * \code decoder != NULL \endcode + * \code OggFLAC__stream_decoder_get_state(decoder) == OggFLAC__STREAM_DECODER_OK \endcode + * \retval FLAC__bool + * \c false if any read or write error occurred (except + * \c OggFLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC), else \c true; + * in any case, check the decoder state with + * OggFLAC__stream_decoder_get_state() to see what went wrong or to + * check for lost synchronization (a sign of stream corruption). + */ +OggFLAC_API FLAC__bool OggFLAC__stream_decoder_process_until_end_of_metadata(OggFLAC__StreamDecoder *decoder); + +/** Decode until the end of the stream. + * This is inherited from FLAC__StreamDecoder; see FLAC__stream_decoder_process_until_end_of_stream() + * + * \param decoder An initialized decoder instance in the state + * \c OggFLAC__STREAM_DECODER_OK. + * \assert + * \code decoder != NULL \endcode + * \code OggFLAC__stream_decoder_get_state(decoder) == OggFLAC__STREAM_DECODER_OK \endcode + * \retval FLAC__bool + * \c false if any read or write error occurred (except + * \c OggFLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC), else \c true; + * in any case, check the decoder state with + * OggFLAC__stream_decoder_get_state() to see what went wrong or to + * check for lost synchronization (a sign of stream corruption). + */ +OggFLAC_API FLAC__bool OggFLAC__stream_decoder_process_until_end_of_stream(OggFLAC__StreamDecoder *decoder); + +/* \} */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Libraries/FLAC/Files/include/OggFLAC/stream_encoder.h b/Libraries/FLAC/Files/include/OggFLAC/stream_encoder.h new file mode 100644 index 000000000..11025c157 --- /dev/null +++ b/Libraries/FLAC/Files/include/OggFLAC/stream_encoder.h @@ -0,0 +1,828 @@ +/* libOggFLAC - Free Lossless Audio Codec + Ogg library + * Copyright (C) 2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef OggFLAC__STREAM_ENCODER_H +#define OggFLAC__STREAM_ENCODER_H + +#include "export.h" + +#include "FLAC/stream_encoder.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +/** \file include/OggFLAC/stream_encoder.h + * + * \brief + * This module contains the functions which implement the stream + * encoder. + * + * See the detailed documentation in the + * \link oggflac_stream_encoder stream encoder \endlink module. + */ + +/** \defgroup oggflac_encoder OggFLAC/ *_encoder.h: encoder interfaces + * \ingroup oggflac + * + * \brief + * This module describes the three encoder layers provided by libOggFLAC. + * + * libOggFLAC currently provides the same three layers of access as libFLAC; + * the interfaces are nearly identical, with the addition of a method for + * specifying the Ogg serial number. See the \link flac_encoder FLAC + * encoder module \endlink for full documentation. + */ + +/** \defgroup oggflac_stream_encoder OggFLAC/stream_encoder.h: stream encoder interface + * \ingroup oggflac_encoder + * + * \brief + * This module contains the functions which implement the stream + * encoder. The Ogg stream encoder is derived + * from the FLAC stream encoder. + * + * The interface here is nearly identical to FLAC's stream encoder, + * including the callbacks, with the addition of + * OggFLAC__stream_encoder_set_serial_number(). See the + * \link flac_stream_encoder FLAC stream encoder module \endlink + * for full documentation. + * + * \{ + */ + + +/** State values for an OggFLAC__StreamEncoder + * + * The encoder's state can be obtained by calling OggFLAC__stream_encoder_get_state(). + */ +typedef enum { + + OggFLAC__STREAM_ENCODER_OK = 0, + /**< The encoder is in the normal OK state. */ + + OggFLAC__STREAM_ENCODER_OGG_ERROR, + /**< An error occurred in the underlying Ogg layer. */ + + OggFLAC__STREAM_ENCODER_FLAC_STREAM_ENCODER_ERROR, + /**< An error occurred in the underlying FLAC stream encoder; + * check OggFLAC__stream_encoder_get_FLAC_stream_encoder_state(). + */ + + OggFLAC__STREAM_ENCODER_INVALID_CALLBACK, + /**< The encoder was initialized before setting all the required callbacks. */ + + OggFLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR, + /**< Memory allocation failed. */ + + OggFLAC__STREAM_ENCODER_ALREADY_INITIALIZED, + /**< OggFLAC__stream_encoder_init() was called when the encoder was + * already initialized, usually because + * OggFLAC__stream_encoder_finish() was not called. + */ + + OggFLAC__STREAM_ENCODER_UNINITIALIZED + /**< The encoder is in the uninitialized state. */ + +} OggFLAC__StreamEncoderState; + +/** Maps an OggFLAC__StreamEncoderState to a C string. + * + * Using an OggFLAC__StreamEncoderState as the index to this array + * will give the string equivalent. The contents should not be modified. + */ +extern OggFLAC_API const char * const OggFLAC__StreamEncoderStateString[]; + + +/*********************************************************************** + * + * class OggFLAC__StreamEncoder + * + ***********************************************************************/ + +struct OggFLAC__StreamEncoderProtected; +struct OggFLAC__StreamEncoderPrivate; +/** The opaque structure definition for the stream encoder type. + * See the \link oggflac_stream_encoder stream encoder module \endlink + * for a detailed description. + */ +typedef struct { + struct OggFLAC__StreamEncoderProtected *protected_; /* avoid the C++ keyword 'protected' */ + struct OggFLAC__StreamEncoderPrivate *private_; /* avoid the C++ keyword 'private' */ +} OggFLAC__StreamEncoder; + +/** Signature for the write callback. + * See OggFLAC__stream_encoder_set_write_callback() + * and FLAC__StreamEncoderWriteCallback for more info. + * + * \param encoder The encoder instance calling the callback. + * \param buffer An array of encoded data of length \a bytes. + * \param bytes The byte length of \a buffer. + * \param samples The number of samples encoded by \a buffer. + * \c 0 has a special meaning; see + * OggFLAC__stream_encoder_set_write_callback(). + * \param current_frame The number of current frame being encoded. + * \param client_data The callee's client data set through + * OggFLAC__stream_encoder_set_client_data(). + * \retval FLAC__StreamEncoderWriteStatus + * The callee's return status. + */ +typedef FLAC__StreamEncoderWriteStatus (*OggFLAC__StreamEncoderWriteCallback)(const OggFLAC__StreamEncoder *encoder, const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame, void *client_data); + +/** Signature for the metadata callback. + * See OggFLAC__stream_encoder_set_metadata_callback() + * and FLAC__stream_encoder_set_metadata_callback() for more info. + * + * \param encoder The encoder instance calling the callback. + * \param metadata The final populated STREAMINFO block. + * \param client_data The callee's client data set through + * FLAC__stream_encoder_set_client_data(). + */ +typedef void (*OggFLAC__StreamEncoderMetadataCallback)(const OggFLAC__StreamEncoder *encoder, const FLAC__StreamMetadata *metadata, void *client_data); + + +/*********************************************************************** + * + * Class constructor/destructor + * + ***********************************************************************/ + +/** Create a new stream encoder instance. The instance is created with + * default settings; see the individual OggFLAC__stream_encoder_set_*() + * functions for each setting's default. + * + * \retval OggFLAC__StreamEncoder* + * \c NULL if there was an error allocating memory, else the new instance. + */ +OggFLAC_API OggFLAC__StreamEncoder *OggFLAC__stream_encoder_new(); + +/** Free an encoder instance. Deletes the object pointed to by \a encoder. + * + * \param encoder A pointer to an existing encoder. + * \assert + * \code encoder != NULL \endcode + */ +OggFLAC_API void OggFLAC__stream_encoder_delete(OggFLAC__StreamEncoder *encoder); + + +/*********************************************************************** + * + * Public class method prototypes + * + ***********************************************************************/ + +/** Set the serial number for the FLAC stream. + * + * \note + * It is recommended to set a serial number explicitly as the default of '0' + * may collide with other streams. + * + * \default \c 0 + * \param encoder An encoder instance to set. + * \param serial_number See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_serial_number(OggFLAC__StreamEncoder *encoder, long serial_number); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_verify() + * + * \default \c false + * \param encoder An encoder instance to set. + * \param value Flag value (see above). + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_verify(OggFLAC__StreamEncoder *encoder, FLAC__bool value); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_streamable_subset() + * + * \default \c true + * \param encoder An encoder instance to set. + * \param value Flag value (see above). + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_streamable_subset(OggFLAC__StreamEncoder *encoder, FLAC__bool value); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_do_mid_side_stereo() + * + * \default \c false + * \param encoder An encoder instance to set. + * \param value Flag value (see above). + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_do_mid_side_stereo(OggFLAC__StreamEncoder *encoder, FLAC__bool value); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_loose_mid_side_stereo() + * + * \default \c false + * \param encoder An encoder instance to set. + * \param value Flag value (see above). + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_loose_mid_side_stereo(OggFLAC__StreamEncoder *encoder, FLAC__bool value); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_channels() + * + * \default \c 2 + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_channels(OggFLAC__StreamEncoder *encoder, unsigned value); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_bits_per_sample() + * + * \default \c 16 + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_bits_per_sample(OggFLAC__StreamEncoder *encoder, unsigned value); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_sample_rate() + * + * \default \c 44100 + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_sample_rate(OggFLAC__StreamEncoder *encoder, unsigned value); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_blocksize() + * + * \default \c 1152 + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_blocksize(OggFLAC__StreamEncoder *encoder, unsigned value); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_max_lpc_order() + * + * \default \c 0 + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_max_lpc_order(OggFLAC__StreamEncoder *encoder, unsigned value); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_qlp_coeff_precision() + * + * \default \c 0 + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_qlp_coeff_precision(OggFLAC__StreamEncoder *encoder, unsigned value); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_qlp_coeff_prec_search() + * + * \default \c false + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_do_qlp_coeff_prec_search(OggFLAC__StreamEncoder *encoder, FLAC__bool value); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_do_escape_coding() + * + * \default \c false + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_do_escape_coding(OggFLAC__StreamEncoder *encoder, FLAC__bool value); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_do_exhaustive_model_search() + * + * \default \c false + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_do_exhaustive_model_search(OggFLAC__StreamEncoder *encoder, FLAC__bool value); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_min_residual_partition_order() + * + * \default \c 0 + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_min_residual_partition_order(OggFLAC__StreamEncoder *encoder, unsigned value); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_max_residual_partition_order() + * + * \default \c 0 + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_max_residual_partition_order(OggFLAC__StreamEncoder *encoder, unsigned value); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_rice_parameter_search_dist() + * + * \default \c 0 + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_rice_parameter_search_dist(OggFLAC__StreamEncoder *encoder, unsigned value); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_total_samples_estimate() + * + * \default \c 0 + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_total_samples_estimate(OggFLAC__StreamEncoder *encoder, FLAC__uint64 value); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_set_metadata() + * + * \note The Ogg FLAC mapping requires that the VORBIS_COMMENT block be + * the second metadata block of the stream. The encoder already supplies + * the STREAMINFO block automatically. If \a metadata does not contain a + * VORBIS_COMMENT block, the encoder will supply that too. Otherwise, if + * \a metadata does contain a VORBIS_COMMENT block and it is not the + * first, this function will reorder \a metadata by moving the + * VORBIS_COMMENT block to the front; the relative ordering of the other + * blocks will remain as they were. + * + * \note The Ogg FLAC mapping limits the number of metadata blocks per + * stream to \c 65535. If \a num_blocks exceeds this the function will + * return \c false. + * + * \default \c NULL, 0 + * \param encoder An encoder instance to set. + * \param metadata See above. + * \param num_blocks See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, or if + * \a num_blocks > 65535, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_metadata(OggFLAC__StreamEncoder *encoder, FLAC__StreamMetadata **metadata, unsigned num_blocks); + +/** Set the write callback. + * This is inherited from FLAC__StreamEncoder; see + * FLAC__stream_encoder_set_write_callback(). + * + * \note + * Unlike the FLAC stream encoder write callback, the Ogg stream + * encoder write callback will be called twice when writing audio + * frames; once for the page header, and once for the page body. + * When writing the page header, the \a samples argument to the + * write callback will be \c 0. + * + * \note + * The callback is mandatory and must be set before initialization. + * + * \default \c NULL + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \code value != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_write_callback(OggFLAC__StreamEncoder *encoder, OggFLAC__StreamEncoderWriteCallback value); + +/** Set the metadata callback. + * This is inherited from FLAC__StreamEncoder; see + * FLAC__stream_encoder_set_metadata_callback(). + * + * \note + * The callback is mandatory and must be set before initialization. + * + * \default \c NULL + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \code value != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_metadata_callback(OggFLAC__StreamEncoder *encoder, OggFLAC__StreamEncoderMetadataCallback value); + +/** Set the client data to be passed back to callbacks. + * This value will be supplied to callbacks in their \a client_data + * argument. + * + * \default \c NULL + * \param encoder An encoder instance to set. + * \param value See above. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * \c false if the encoder is already initialized, else \c true. + */ +OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_client_data(OggFLAC__StreamEncoder *encoder, void *value); + +/** Get the current encoder state. + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval OggFLAC__StreamEncoderState + * The current encoder state. + */ +OggFLAC_API OggFLAC__StreamEncoderState OggFLAC__stream_encoder_get_state(const OggFLAC__StreamEncoder *encoder); + +/** Get the state of the underlying FLAC stream encoder. + * Useful when the stream encoder state is + * \c OggFLAC__STREAM_ENCODER_FLAC_STREAM_ENCODER_ERROR. + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__StreamEncoderState + * The FLAC stream encoder state. + */ +OggFLAC_API FLAC__StreamEncoderState OggFLAC__stream_encoder_get_FLAC_stream_encoder_state(const OggFLAC__StreamEncoder *encoder); + +/** Get the state of the underlying FLAC stream encoder's verify decoder. + * Useful when the stream encoder state is + * \c OggFLAC__STREAM_ENCODER_FLAC_STREAM_ENCODER_ERROR and the + * FLAC encoder state is \c FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR. + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__StreamDecoderState + * The FLAC verify decoder state. + */ +OggFLAC_API FLAC__StreamDecoderState OggFLAC__stream_encoder_get_verify_decoder_state(const OggFLAC__StreamEncoder *encoder); + +/** Get the current encoder state as a C string. + * This version automatically resolves + * \c OggFLAC__STREAM_ENCODER_FLAC_STREAM_ENCODER_ERROR by getting the + * FLAC stream encoder's state. + * + * \param encoder A encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval const char * + * The encoder state as a C string. Do not modify the contents. + */ +OggFLAC_API const char *OggFLAC__stream_encoder_get_resolved_state_string(const OggFLAC__StreamEncoder *encoder); + +/** Get relevant values about the nature of a verify decoder error. + * Inherited from FLAC__stream_encoder_get_verify_decoder_error_stats(). + * Useful when the stream encoder state is + * \c OggFLAC__STREAM_ENCODER_FLAC_STREAM_ENCODER_ERROR and the + * FLAC stream encoder state is + * \c FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR. + * + * \param encoder An encoder instance to query. + * \param absolute_sample The absolute sample number of the mismatch. + * \param frame_number The number of the frame in which the mismatch occurred. + * \param channel The channel in which the mismatch occurred. + * \param sample The number of the sample (relative to the frame) in + * which the mismatch occurred. + * \param expected The expected value for the sample in question. + * \param got The actual value returned by the decoder. + * \assert + * \code encoder != NULL \endcode + * \code absolute_sample != NULL \endcode + * \code frame_number != NULL \endcode + * \code channel != NULL \endcode + * \code sample != NULL \endcode + * \code expected != NULL \endcode + */ +OggFLAC_API void OggFLAC__stream_encoder_get_verify_decoder_error_stats(const OggFLAC__StreamEncoder *encoder, FLAC__uint64 *absolute_sample, unsigned *frame_number, unsigned *channel, unsigned *sample, FLAC__int32 *expected, FLAC__int32 *got); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_verify() + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * See OggFLAC__stream_encoder_set_verify(). + */ +OggFLAC_API FLAC__bool OggFLAC__stream_encoder_get_verify(const OggFLAC__StreamEncoder *encoder); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_streamable_subset() + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * See OggFLAC__stream_encoder_set_streamable_subset(). + */ +OggFLAC_API FLAC__bool OggFLAC__stream_encoder_get_streamable_subset(const OggFLAC__StreamEncoder *encoder); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_do_mid_side_stereo() + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * See OggFLAC__stream_encoder_get_do_mid_side_stereo(). + */ +OggFLAC_API FLAC__bool OggFLAC__stream_encoder_get_do_mid_side_stereo(const OggFLAC__StreamEncoder *encoder); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_loose_mid_side_stereo() + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * See OggFLAC__stream_encoder_set_loose_mid_side_stereo(). + */ +OggFLAC_API FLAC__bool OggFLAC__stream_encoder_get_loose_mid_side_stereo(const OggFLAC__StreamEncoder *encoder); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_channels() + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval unsigned + * See OggFLAC__stream_encoder_set_channels(). + */ +OggFLAC_API unsigned OggFLAC__stream_encoder_get_channels(const OggFLAC__StreamEncoder *encoder); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_bits_per_sample() + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval unsigned + * See OggFLAC__stream_encoder_set_bits_per_sample(). + */ +OggFLAC_API unsigned OggFLAC__stream_encoder_get_bits_per_sample(const OggFLAC__StreamEncoder *encoder); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_sample_rate() + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval unsigned + * See OggFLAC__stream_encoder_set_sample_rate(). + */ +OggFLAC_API unsigned OggFLAC__stream_encoder_get_sample_rate(const OggFLAC__StreamEncoder *encoder); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_blocksize() + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval unsigned + * See OggFLAC__stream_encoder_set_blocksize(). + */ +OggFLAC_API unsigned OggFLAC__stream_encoder_get_blocksize(const OggFLAC__StreamEncoder *encoder); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_max_lpc_order() + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval unsigned + * See OggFLAC__stream_encoder_set_max_lpc_order(). + */ +OggFLAC_API unsigned OggFLAC__stream_encoder_get_max_lpc_order(const OggFLAC__StreamEncoder *encoder); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_qlp_coeff_precision() + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval unsigned + * See OggFLAC__stream_encoder_set_qlp_coeff_precision(). + */ +OggFLAC_API unsigned OggFLAC__stream_encoder_get_qlp_coeff_precision(const OggFLAC__StreamEncoder *encoder); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_do_qlp_coeff_prec_search() + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * See OggFLAC__stream_encoder_set_do_qlp_coeff_prec_search(). + */ +OggFLAC_API FLAC__bool OggFLAC__stream_encoder_get_do_qlp_coeff_prec_search(const OggFLAC__StreamEncoder *encoder); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_do_escape_coding() + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * See OggFLAC__stream_encoder_set_do_escape_coding(). + */ +OggFLAC_API FLAC__bool OggFLAC__stream_encoder_get_do_escape_coding(const OggFLAC__StreamEncoder *encoder); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_do_exhaustive_model_search() + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__bool + * See OggFLAC__stream_encoder_set_do_exhaustive_model_search(). + */ +OggFLAC_API FLAC__bool OggFLAC__stream_encoder_get_do_exhaustive_model_search(const OggFLAC__StreamEncoder *encoder); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_min_residual_partition_order() + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval unsigned + * See OggFLAC__stream_encoder_set_min_residual_partition_order(). + */ +OggFLAC_API unsigned OggFLAC__stream_encoder_get_min_residual_partition_order(const OggFLAC__StreamEncoder *encoder); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_man_residual_partition_order() + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval unsigned + * See OggFLAC__stream_encoder_set_max_residual_partition_order(). + */ +OggFLAC_API unsigned OggFLAC__stream_encoder_get_max_residual_partition_order(const OggFLAC__StreamEncoder *encoder); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_rice_parameter_search_dist() + * + * \param encoder An encoder instance to query. + * \assert + * \code encoder != NULL \endcode + * \retval unsigned + * See OggFLAC__stream_encoder_set_rice_parameter_search_dist(). + */ +OggFLAC_API unsigned OggFLAC__stream_encoder_get_rice_parameter_search_dist(const OggFLAC__StreamEncoder *encoder); + +/** This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_get_total_samples_estimate() + * + * \param encoder An encoder instance to set. + * \assert + * \code encoder != NULL \endcode + * \retval FLAC__uint64 + * See OggFLAC__stream_encoder_get_total_samples_estimate(). + */ +OggFLAC_API FLAC__uint64 OggFLAC__stream_encoder_get_total_samples_estimate(const OggFLAC__StreamEncoder *encoder); + +/** Initialize the encoder instance. + * Should be called after OggFLAC__stream_encoder_new() and + * OggFLAC__stream_encoder_set_*() but before OggFLAC__stream_encoder_process() + * or OggFLAC__stream_encoder_process_interleaved(). Will set and return + * the encoder state, which will be OggFLAC__STREAM_ENCODER_OK if + * initialization succeeded. + * + * The call to OggFLAC__stream_encoder_init() currently will also immediately + * call the write callback several times, once with the \c fLaC signature, + * and once for each encoded metadata block. + * + * \param encoder An uninitialized encoder instance. + * \assert + * \code encoder != NULL \endcode + * \retval OggFLAC__StreamEncoderState + * \c OggFLAC__STREAM_ENCODER_OK if initialization was successful; see + * OggFLAC__StreamEncoderState for the meanings of other return values. + */ +OggFLAC_API OggFLAC__StreamEncoderState OggFLAC__stream_encoder_init(OggFLAC__StreamEncoder *encoder); + +/** Finish the encoding process. + * Flushes the encoding buffer, releases resources, resets the encoder + * settings to their defaults, and returns the encoder state to + * OggFLAC__STREAM_ENCODER_UNINITIALIZED. Note that this can generate + * one or more write callbacks before returning. + * + * In the event of a prematurely-terminated encode, it is not strictly + * necessary to call this immediately before OggFLAC__stream_encoder_delete() + * but it is good practice to match every OggFLAC__stream_encoder_init() + * with an OggFLAC__stream_encoder_finish(). + * + * \param encoder An uninitialized encoder instance. + * \assert + * \code encoder != NULL \endcode + */ +OggFLAC_API void OggFLAC__stream_encoder_finish(OggFLAC__StreamEncoder *encoder); + +/** Submit data for encoding. + * This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_process(). + * + * \param encoder An initialized encoder instance in the OK state. + * \param buffer An array of pointers to each channel's signal. + * \param samples The number of samples in one channel. + * \assert + * \code encoder != NULL \endcode + * \code OggFLAC__stream_encoder_get_state(encoder) == OggFLAC__STREAM_ENCODER_OK \endcode + * \retval FLAC__bool + * \c true if successful, else \c false; in this case, check the + * encoder state with OggFLAC__stream_encoder_get_state() to see what + * went wrong. + */ +OggFLAC_API FLAC__bool OggFLAC__stream_encoder_process(OggFLAC__StreamEncoder *encoder, const FLAC__int32 * const buffer[], unsigned samples); + +/** Submit data for encoding. + * This is inherited from FLAC__StreamEncoder; see FLAC__stream_encoder_process_interleaved(). + * + * \param encoder An initialized encoder instance in the OK state. + * \param buffer An array of channel-interleaved data (see above). + * \param samples The number of samples in one channel, the same as for + * OggFLAC__stream_encoder_process(). For example, if + * encoding two channels, \c 1000 \a samples corresponds + * to a \a buffer of 2000 values. + * \assert + * \code encoder != NULL \endcode + * \code OggFLAC__stream_encoder_get_state(encoder) == OggFLAC__STREAM_ENCODER_OK \endcode + * \retval FLAC__bool + * \c true if successful, else \c false; in this case, check the + * encoder state with OggFLAC__stream_encoder_get_state() to see what + * went wrong. + */ +OggFLAC_API FLAC__bool OggFLAC__stream_encoder_process_interleaved(OggFLAC__StreamEncoder *encoder, const FLAC__int32 buffer[], unsigned samples); + +/* \} */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Libraries/FLAC/Files/include/share/Makefile.am b/Libraries/FLAC/Files/include/share/Makefile.am new file mode 100644 index 000000000..b50d883d5 --- /dev/null +++ b/Libraries/FLAC/Files/include/share/Makefile.am @@ -0,0 +1,12 @@ +## Process this file with automake to produce Makefile.in + +AUTOMAKE_OPTIONS = foreign + +SUBDIRS = grabbag + +EXTRA_DIST = \ + getopt.h \ + grabbag.h \ + replaygain_analysis.h \ + replaygain_synthesis.h \ + utf8.h diff --git a/Libraries/FLAC/Files/include/share/Makefile.in b/Libraries/FLAC/Files/include/share/Makefile.in new file mode 100644 index 000000000..5ce45bc37 --- /dev/null +++ b/Libraries/FLAC/Files/include/share/Makefile.in @@ -0,0 +1,521 @@ +# Makefile.in generated by automake 1.8.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../.. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_triplet = @host@ +subdir = include/share +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(mkdir_p) +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-exec-recursive install-info-recursive \ + install-recursive installcheck-recursive installdirs-recursive \ + pdf-recursive ps-recursive uninstall-info-recursive \ + uninstall-recursive +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCAS = @CCAS@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEBUG_FALSE = @DEBUG_FALSE@ +DEBUG_TRUE = @DEBUG_TRUE@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DOCBOOK_TO_MAN = @DOCBOOK_TO_MAN@ +DOXYGEN = @DOXYGEN@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FLaC__CPU_IA32_FALSE = @FLaC__CPU_IA32_FALSE@ +FLaC__CPU_IA32_TRUE = @FLaC__CPU_IA32_TRUE@ +FLaC__CPU_PPC_FALSE = @FLaC__CPU_PPC_FALSE@ +FLaC__CPU_PPC_TRUE = @FLaC__CPU_PPC_TRUE@ +FLaC__CPU_SPARC_FALSE = @FLaC__CPU_SPARC_FALSE@ +FLaC__CPU_SPARC_TRUE = @FLaC__CPU_SPARC_TRUE@ +FLaC__EXHAUSTIVE_TESTS_FALSE = @FLaC__EXHAUSTIVE_TESTS_FALSE@ +FLaC__EXHAUSTIVE_TESTS_TRUE = @FLaC__EXHAUSTIVE_TESTS_TRUE@ +FLaC__HAS_AS_FALSE = @FLaC__HAS_AS_FALSE@ +FLaC__HAS_AS_TRUE = @FLaC__HAS_AS_TRUE@ +FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@ +FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@ +FLaC__HAS_DOCBOOK_TO_MAN_FALSE = @FLaC__HAS_DOCBOOK_TO_MAN_FALSE@ +FLaC__HAS_DOCBOOK_TO_MAN_TRUE = @FLaC__HAS_DOCBOOK_TO_MAN_TRUE@ +FLaC__HAS_DOXYGEN_FALSE = @FLaC__HAS_DOXYGEN_FALSE@ +FLaC__HAS_DOXYGEN_TRUE = @FLaC__HAS_DOXYGEN_TRUE@ +FLaC__HAS_GAS_FALSE = @FLaC__HAS_GAS_FALSE@ +FLaC__HAS_GAS_TRUE = @FLaC__HAS_GAS_TRUE@ +FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@ +FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@ +FLaC__HAS_NASM_FALSE = @FLaC__HAS_NASM_FALSE@ +FLaC__HAS_NASM_TRUE = @FLaC__HAS_NASM_TRUE@ +FLaC__HAS_OGG_FALSE = @FLaC__HAS_OGG_FALSE@ +FLaC__HAS_OGG_TRUE = @FLaC__HAS_OGG_TRUE@ +FLaC__HAS_XMMS_FALSE = @FLaC__HAS_XMMS_FALSE@ +FLaC__HAS_XMMS_TRUE = @FLaC__HAS_XMMS_TRUE@ +FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE@ +FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE@ +FLaC__NO_ASM_FALSE = @FLaC__NO_ASM_FALSE@ +FLaC__NO_ASM_TRUE = @FLaC__NO_ASM_TRUE@ +FLaC__SSE_OS_FALSE = @FLaC__SSE_OS_FALSE@ +FLaC__SSE_OS_TRUE = @FLaC__SSE_OS_TRUE@ +FLaC__SYS_DARWIN_FALSE = @FLaC__SYS_DARWIN_FALSE@ +FLaC__SYS_DARWIN_TRUE = @FLaC__SYS_DARWIN_TRUE@ +FLaC__SYS_LINUX_FALSE = @FLaC__SYS_LINUX_FALSE@ +FLaC__SYS_LINUX_TRUE = @FLaC__SYS_LINUX_TRUE@ +FLaC__USE_3DNOW_FALSE = @FLaC__USE_3DNOW_FALSE@ +FLaC__USE_3DNOW_TRUE = @FLaC__USE_3DNOW_TRUE@ +FLaC__USE_ALTIVEC_FALSE = @FLaC__USE_ALTIVEC_FALSE@ +FLaC__USE_ALTIVEC_TRUE = @FLaC__USE_ALTIVEC_TRUE@ +FLaC__VALGRIND_TESTING_FALSE = @FLaC__VALGRIND_TESTING_FALSE@ +FLaC__VALGRIND_TESTING_TRUE = @FLaC__VALGRIND_TESTING_TRUE@ +GAS = @GAS@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +NASM = @NASM@ +OBJEXT = @OBJEXT@ +OBJ_FORMAT = @OBJ_FORMAT@ +OGG_CFLAGS = @OGG_CFLAGS@ +OGG_LIBS = @OGG_LIBS@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +XMMS_CFLAGS = @XMMS_CFLAGS@ +XMMS_CONFIG = @XMMS_CONFIG@ +XMMS_DATA_DIR = @XMMS_DATA_DIR@ +XMMS_EFFECT_PLUGIN_DIR = @XMMS_EFFECT_PLUGIN_DIR@ +XMMS_GENERAL_PLUGIN_DIR = @XMMS_GENERAL_PLUGIN_DIR@ +XMMS_INPUT_PLUGIN_DIR = @XMMS_INPUT_PLUGIN_DIR@ +XMMS_LIBS = @XMMS_LIBS@ +XMMS_OUTPUT_PLUGIN_DIR = @XMMS_OUTPUT_PLUGIN_DIR@ +XMMS_PLUGIN_DIR = @XMMS_PLUGIN_DIR@ +XMMS_VERSION = @XMMS_VERSION@ +XMMS_VISUALIZATION_PLUGIN_DIR = @XMMS_VISUALIZATION_PLUGIN_DIR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +AUTOMAKE_OPTIONS = foreign +SUBDIRS = grabbag +EXTRA_DIST = \ + getopt.h \ + grabbag.h \ + replaygain_analysis.h \ + replaygain_synthesis.h \ + utf8.h + +all: all-recursive + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign include/share/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign include/share/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || mkdir "$(distdir)/$$subdir" \ + || exit 1; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="../$(top_distdir)" \ + distdir="../$(distdir)/$$subdir" \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-libtool \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-recursive + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-info-am + +uninstall-info: uninstall-info-recursive + +.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \ + clean clean-generic clean-libtool clean-recursive ctags \ + ctags-recursive distclean distclean-generic distclean-libtool \ + distclean-recursive distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-strip installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic maintainer-clean-recursive \ + mostlyclean mostlyclean-generic mostlyclean-libtool \ + mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \ + uninstall uninstall-am uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/Libraries/FLAC/Files/include/share/getopt.h b/Libraries/FLAC/Files/include/share/getopt.h new file mode 100644 index 000000000..9d8b36e23 --- /dev/null +++ b/Libraries/FLAC/Files/include/share/getopt.h @@ -0,0 +1,184 @@ +/* + NOTE: + I cannot get the vanilla getopt code to work (i.e. compile only what + is needed and not duplicate symbols found in the standard library) + on all the platforms that FLAC supports. In particular the gating + of code with the ELIDE_CODE #define is not accurate enough on systems + that are POSIX but not glibc. If someone has a patch that works on + GNU/Linux, Darwin, AND Solaris please submit it on the project page: + http://sourceforge.net/projects/flac + + In the meantime I have munged the global symbols and remove gates + around code, while at the same time trying to touch the original as + little as possible. +*/ +/* Declarations for getopt. + Copyright (C) 1989,90,91,92,93,94,96,97,98 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef SHARE__GETOPT_H +#define SHARE__GETOPT_H + +/*[JEC] was:#ifndef __need_getopt*/ +/*[JEC] was:# define _GETOPT_H 1*/ +/*[JEC] was:#endif*/ + +#ifdef __cplusplus +extern "C" { +#endif + +/* For communication from `share__getopt' to the caller. + When `share__getopt' finds an option that takes an argument, + the argument value is returned here. + Also, when `ordering' is RETURN_IN_ORDER, + each non-option ARGV-element is returned here. */ + +extern char *share__optarg; + +/* Index in ARGV of the next element to be scanned. + This is used for communication to and from the caller + and for communication between successive calls to `share__getopt'. + + On entry to `share__getopt', zero means this is the first call; initialize. + + When `share__getopt' returns -1, this is the index of the first of the + non-option elements that the caller should itself scan. + + Otherwise, `share__optind' communicates from one call to the next + how much of ARGV has been scanned so far. */ + +extern int share__optind; + +/* Callers store zero here to inhibit the error message `share__getopt' prints + for unrecognized options. */ + +extern int share__opterr; + +/* Set to an option character which was unrecognized. */ + +extern int share__optopt; + +/*[JEC] was:#ifndef __need_getopt */ +/* Describe the long-named options requested by the application. + The LONG_OPTIONS argument to share__getopt_long or share__getopt_long_only is a vector + of `struct share__option' terminated by an element containing a name which is + zero. + + The field `has_arg' is: + share__no_argument (or 0) if the option does not take an argument, + share__required_argument (or 1) if the option requires an argument, + share__optional_argument (or 2) if the option takes an optional argument. + + If the field `flag' is not NULL, it points to a variable that is set + to the value given in the field `val' when the option is found, but + left unchanged if the option is not found. + + To have a long-named option do something other than set an `int' to + a compiled-in constant, such as set a value from `share__optarg', set the + option's `flag' field to zero and its `val' field to a nonzero + value (the equivalent single-letter option character, if there is + one). For long options that have a zero `flag' field, `share__getopt' + returns the contents of the `val' field. */ + +struct share__option +{ +# if defined __STDC__ && __STDC__ + const char *name; +# else + char *name; +# endif + /* has_arg can't be an enum because some compilers complain about + type mismatches in all the code that assumes it is an int. */ + int has_arg; + int *flag; + int val; +}; + +/* Names for the values of the `has_arg' field of `struct share__option'. */ + +# define share__no_argument 0 +# define share__required_argument 1 +# define share__optional_argument 2 +/*[JEC] was:#endif*/ /* need getopt */ + + +/* Get definitions and prototypes for functions to process the + arguments in ARGV (ARGC of them, minus the program name) for + options given in OPTS. + + Return the option character from OPTS just read. Return -1 when + there are no more options. For unrecognized options, or options + missing arguments, `share__optopt' is set to the option letter, and '?' is + returned. + + The OPTS string is a list of characters which are recognized option + letters, optionally followed by colons, specifying that that letter + takes an argument, to be placed in `share__optarg'. + + If a letter in OPTS is followed by two colons, its argument is + optional. This behavior is specific to the GNU `share__getopt'. + + The argument `--' causes premature termination of argument + scanning, explicitly telling `share__getopt' that there are no more + options. + + If OPTS begins with `--', then non-option arguments are treated as + arguments to the option '\0'. This behavior is specific to the GNU + `share__getopt'. */ + +/*[JEC] was:#if defined __STDC__ && __STDC__*/ +/*[JEC] was:# ifdef __GNU_LIBRARY__*/ +/* Many other libraries have conflicting prototypes for getopt, with + differences in the consts, in stdlib.h. To avoid compilation + errors, only prototype getopt for the GNU C library. */ +extern int share__getopt (int argc, char *const *argv, const char *shortopts); +/*[JEC] was:# else*/ /* not __GNU_LIBRARY__ */ +/*[JEC] was:extern int getopt ();*/ +/*[JEC] was:# endif*/ /* __GNU_LIBRARY__ */ + +/*[JEC] was:# ifndef __need_getopt*/ +extern int share__getopt_long (int argc, char *const *argv, const char *shortopts, + const struct share__option *longopts, int *longind); +extern int share__getopt_long_only (int argc, char *const *argv, + const char *shortopts, + const struct share__option *longopts, int *longind); + +/* Internal only. Users should not call this directly. */ +extern int share___getopt_internal (int argc, char *const *argv, + const char *shortopts, + const struct share__option *longopts, int *longind, + int long_only); +/*[JEC] was:# endif*/ +/*[JEC] was:#else*/ /* not __STDC__ */ +/*[JEC] was:extern int getopt ();*/ +/*[JEC] was:# ifndef __need_getopt*/ +/*[JEC] was:extern int getopt_long ();*/ +/*[JEC] was:extern int getopt_long_only ();*/ + +/*[JEC] was:extern int _getopt_internal ();*/ +/*[JEC] was:# endif*/ +/*[JEC] was:#endif*/ /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +/* Make sure we later can get all the definitions and declarations. */ +/*[JEC] was:#undef __need_getopt*/ + +#endif /* getopt.h */ diff --git a/Libraries/FLAC/Files/include/share/grabbag.h b/Libraries/FLAC/Files/include/share/grabbag.h new file mode 100644 index 000000000..b06bc86a2 --- /dev/null +++ b/Libraries/FLAC/Files/include/share/grabbag.h @@ -0,0 +1,28 @@ +/* grabbag - Convenience lib for various routines common to several tools + * Copyright (C) 2002,2003,2004,2005 Josh Coalson + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef SHARE__GRABBAG_H +#define SHARE__GRABBAG_H + +/* These can't be included by themselves, only from within grabbag.h */ +#include "grabbag/cuesheet.h" +#include "grabbag/file.h" +#include "grabbag/replaygain.h" +#include "grabbag/seektable.h" + +#endif diff --git a/Libraries/FLAC/Files/include/share/grabbag/Makefile.am b/Libraries/FLAC/Files/include/share/grabbag/Makefile.am new file mode 100644 index 000000000..9b2750e5e --- /dev/null +++ b/Libraries/FLAC/Files/include/share/grabbag/Makefile.am @@ -0,0 +1,9 @@ +## Process this file with automake to produce Makefile.in + +AUTOMAKE_OPTIONS = foreign + +EXTRA_DIST = \ + cuesheet.h \ + file.h \ + replaygain.h \ + seektable.h diff --git a/Libraries/FLAC/Files/include/share/grabbag/Makefile.in b/Libraries/FLAC/Files/include/share/grabbag/Makefile.in new file mode 100644 index 000000000..2f9a0191d --- /dev/null +++ b/Libraries/FLAC/Files/include/share/grabbag/Makefile.in @@ -0,0 +1,376 @@ +# Makefile.in generated by automake 1.8.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../../.. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_triplet = @host@ +subdir = include/share/grabbag +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(mkdir_p) +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCAS = @CCAS@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEBUG_FALSE = @DEBUG_FALSE@ +DEBUG_TRUE = @DEBUG_TRUE@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DOCBOOK_TO_MAN = @DOCBOOK_TO_MAN@ +DOXYGEN = @DOXYGEN@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FLaC__CPU_IA32_FALSE = @FLaC__CPU_IA32_FALSE@ +FLaC__CPU_IA32_TRUE = @FLaC__CPU_IA32_TRUE@ +FLaC__CPU_PPC_FALSE = @FLaC__CPU_PPC_FALSE@ +FLaC__CPU_PPC_TRUE = @FLaC__CPU_PPC_TRUE@ +FLaC__CPU_SPARC_FALSE = @FLaC__CPU_SPARC_FALSE@ +FLaC__CPU_SPARC_TRUE = @FLaC__CPU_SPARC_TRUE@ +FLaC__EXHAUSTIVE_TESTS_FALSE = @FLaC__EXHAUSTIVE_TESTS_FALSE@ +FLaC__EXHAUSTIVE_TESTS_TRUE = @FLaC__EXHAUSTIVE_TESTS_TRUE@ +FLaC__HAS_AS_FALSE = @FLaC__HAS_AS_FALSE@ +FLaC__HAS_AS_TRUE = @FLaC__HAS_AS_TRUE@ +FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@ +FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@ +FLaC__HAS_DOCBOOK_TO_MAN_FALSE = @FLaC__HAS_DOCBOOK_TO_MAN_FALSE@ +FLaC__HAS_DOCBOOK_TO_MAN_TRUE = @FLaC__HAS_DOCBOOK_TO_MAN_TRUE@ +FLaC__HAS_DOXYGEN_FALSE = @FLaC__HAS_DOXYGEN_FALSE@ +FLaC__HAS_DOXYGEN_TRUE = @FLaC__HAS_DOXYGEN_TRUE@ +FLaC__HAS_GAS_FALSE = @FLaC__HAS_GAS_FALSE@ +FLaC__HAS_GAS_TRUE = @FLaC__HAS_GAS_TRUE@ +FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@ +FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@ +FLaC__HAS_NASM_FALSE = @FLaC__HAS_NASM_FALSE@ +FLaC__HAS_NASM_TRUE = @FLaC__HAS_NASM_TRUE@ +FLaC__HAS_OGG_FALSE = @FLaC__HAS_OGG_FALSE@ +FLaC__HAS_OGG_TRUE = @FLaC__HAS_OGG_TRUE@ +FLaC__HAS_XMMS_FALSE = @FLaC__HAS_XMMS_FALSE@ +FLaC__HAS_XMMS_TRUE = @FLaC__HAS_XMMS_TRUE@ +FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE@ +FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE@ +FLaC__NO_ASM_FALSE = @FLaC__NO_ASM_FALSE@ +FLaC__NO_ASM_TRUE = @FLaC__NO_ASM_TRUE@ +FLaC__SSE_OS_FALSE = @FLaC__SSE_OS_FALSE@ +FLaC__SSE_OS_TRUE = @FLaC__SSE_OS_TRUE@ +FLaC__SYS_DARWIN_FALSE = @FLaC__SYS_DARWIN_FALSE@ +FLaC__SYS_DARWIN_TRUE = @FLaC__SYS_DARWIN_TRUE@ +FLaC__SYS_LINUX_FALSE = @FLaC__SYS_LINUX_FALSE@ +FLaC__SYS_LINUX_TRUE = @FLaC__SYS_LINUX_TRUE@ +FLaC__USE_3DNOW_FALSE = @FLaC__USE_3DNOW_FALSE@ +FLaC__USE_3DNOW_TRUE = @FLaC__USE_3DNOW_TRUE@ +FLaC__USE_ALTIVEC_FALSE = @FLaC__USE_ALTIVEC_FALSE@ +FLaC__USE_ALTIVEC_TRUE = @FLaC__USE_ALTIVEC_TRUE@ +FLaC__VALGRIND_TESTING_FALSE = @FLaC__VALGRIND_TESTING_FALSE@ +FLaC__VALGRIND_TESTING_TRUE = @FLaC__VALGRIND_TESTING_TRUE@ +GAS = @GAS@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +NASM = @NASM@ +OBJEXT = @OBJEXT@ +OBJ_FORMAT = @OBJ_FORMAT@ +OGG_CFLAGS = @OGG_CFLAGS@ +OGG_LIBS = @OGG_LIBS@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +XMMS_CFLAGS = @XMMS_CFLAGS@ +XMMS_CONFIG = @XMMS_CONFIG@ +XMMS_DATA_DIR = @XMMS_DATA_DIR@ +XMMS_EFFECT_PLUGIN_DIR = @XMMS_EFFECT_PLUGIN_DIR@ +XMMS_GENERAL_PLUGIN_DIR = @XMMS_GENERAL_PLUGIN_DIR@ +XMMS_INPUT_PLUGIN_DIR = @XMMS_INPUT_PLUGIN_DIR@ +XMMS_LIBS = @XMMS_LIBS@ +XMMS_OUTPUT_PLUGIN_DIR = @XMMS_OUTPUT_PLUGIN_DIR@ +XMMS_PLUGIN_DIR = @XMMS_PLUGIN_DIR@ +XMMS_VERSION = @XMMS_VERSION@ +XMMS_VISUALIZATION_PLUGIN_DIR = @XMMS_VISUALIZATION_PLUGIN_DIR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +AUTOMAKE_OPTIONS = foreign +EXTRA_DIST = \ + cuesheet.h \ + file.h \ + replaygain.h \ + seektable.h + +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign include/share/grabbag/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign include/share/grabbag/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-libtool + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + distclean distclean-generic distclean-libtool distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-exec install-exec-am \ + install-info install-info-am install-man install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \ + uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/Libraries/FLAC/Files/include/share/grabbag/cuesheet.h b/Libraries/FLAC/Files/include/share/grabbag/cuesheet.h new file mode 100644 index 000000000..546a5b926 --- /dev/null +++ b/Libraries/FLAC/Files/include/share/grabbag/cuesheet.h @@ -0,0 +1,42 @@ +/* grabbag - Convenience lib for various routines common to several tools + * Copyright (C) 2002,2003,2004,2005 Josh Coalson + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* This .h cannot be included by itself; #include "share/grabbag.h" instead. */ + +#ifndef GRABBAG__CUESHEET_H +#define GRABBAG__CUESHEET_H + +#include +#include "FLAC/metadata.h" + +#ifdef __cplusplus +extern "C" { +#endif + +unsigned grabbag__cuesheet_msf_to_frame(unsigned minutes, unsigned seconds, unsigned frames); +void grabbag__cuesheet_frame_to_msf(unsigned frame, unsigned *minutes, unsigned *seconds, unsigned *frames); + +FLAC__StreamMetadata *grabbag__cuesheet_parse(FILE *file, const char **error_message, unsigned *last_line_read, FLAC__bool is_cdda, FLAC__uint64 lead_out_offset); + +void grabbag__cuesheet_emit(FILE *file, const FLAC__StreamMetadata *cuesheet, const char *file_reference); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Libraries/FLAC/Files/include/share/grabbag/file.h b/Libraries/FLAC/Files/include/share/grabbag/file.h new file mode 100644 index 000000000..7f0a326bb --- /dev/null +++ b/Libraries/FLAC/Files/include/share/grabbag/file.h @@ -0,0 +1,54 @@ +/* grabbag - Convenience lib for various routines common to several tools + * Copyright (C) 2002,2003,2004,2005 Josh Coalson + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* Convenience routines for manipulating files */ + +/* This .h cannot be included by itself; #include "share/grabbag.h" instead. */ + +#ifndef GRABAG__FILE_H +#define GRABAG__FILE_H + +#include /* for off_t */ +#include /* for FILE */ +#include "FLAC/ordinals.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void grabbag__file_copy_metadata(const char *srcpath, const char *destpath); +off_t grabbag__file_get_filesize(const char *srcpath); +const char *grabbag__file_get_basename(const char *srcpath); + +/* read_only == false means "make file writable by user" + * read_only == true means "make file read-only for everyone" + */ +FLAC__bool grabbag__file_change_stats(const char *filename, FLAC__bool read_only); + +/* attempts to make writable before unlinking */ +FLAC__bool grabbag__file_remove_file(const char *filename); + +/* these will forcibly set stdin/stdout to binary mode (for OSes that require it) */ +FILE *grabbag__file_get_binary_stdin(); +FILE *grabbag__file_get_binary_stdout(); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Libraries/FLAC/Files/include/share/grabbag/replaygain.h b/Libraries/FLAC/Files/include/share/grabbag/replaygain.h new file mode 100644 index 000000000..2d1111ce1 --- /dev/null +++ b/Libraries/FLAC/Files/include/share/grabbag/replaygain.h @@ -0,0 +1,64 @@ +/* grabbag - Convenience lib for various routines common to several tools + * Copyright (C) 2002,2003,2004,2005 Josh Coalson + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* + * This wraps the replaygain_analysis lib, which is LGPL. This wrapper + * allows analysis of different input resolutions by automatically + * scaling the input signal + */ + +/* This .h cannot be included by itself; #include "share/grabbag.h" instead. */ + +#ifndef GRABBAG__REPLAYGAIN_H +#define GRABBAG__REPLAYGAIN_H + +#include "FLAC/metadata.h" + +#ifdef __cplusplus +extern "C" { +#endif + +extern const unsigned GRABBAG__REPLAYGAIN_MAX_TAG_SPACE_REQUIRED; + +FLAC__bool grabbag__replaygain_is_valid_sample_frequency(unsigned sample_frequency); + +FLAC__bool grabbag__replaygain_init(unsigned sample_frequency); + +/* 'bps' must be valid for FLAC, i.e. >=4 and <= 32 */ +FLAC__bool grabbag__replaygain_analyze(const FLAC__int32 * const input[], FLAC__bool is_stereo, unsigned bps, unsigned samples); + +void grabbag__replaygain_get_album(float *gain, float *peak); +void grabbag__replaygain_get_title(float *gain, float *peak); + +/* These three functions return an error string on error, or NULL if successful */ +const char *grabbag__replaygain_analyze_file(const char *filename, float *title_gain, float *title_peak); +const char *grabbag__replaygain_store_to_vorbiscomment(FLAC__StreamMetadata *block, float album_gain, float album_peak, float title_gain, float title_peak); +const char *grabbag__replaygain_store_to_vorbiscomment_album(FLAC__StreamMetadata *block, float album_gain, float album_peak); +const char *grabbag__replaygain_store_to_vorbiscomment_title(FLAC__StreamMetadata *block, float title_gain, float title_peak); +const char *grabbag__replaygain_store_to_file(const char *filename, float album_gain, float album_peak, float title_gain, float title_peak, FLAC__bool preserve_modtime); +const char *grabbag__replaygain_store_to_file_album(const char *filename, float album_gain, float album_peak, FLAC__bool preserve_modtime); +const char *grabbag__replaygain_store_to_file_title(const char *filename, float title_gain, float title_peak, FLAC__bool preserve_modtime); + +FLAC__bool grabbag__replaygain_load_from_vorbiscomment(const FLAC__StreamMetadata *block, FLAC__bool album_mode, double *gain, double *peak); +double grabbag__replaygain_compute_scale_factor(double peak, double gain, double preamp, FLAC__bool prevent_clipping); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Libraries/FLAC/Files/include/share/grabbag/seektable.h b/Libraries/FLAC/Files/include/share/grabbag/seektable.h new file mode 100644 index 000000000..00d1f8335 --- /dev/null +++ b/Libraries/FLAC/Files/include/share/grabbag/seektable.h @@ -0,0 +1,38 @@ +/* grabbag - Convenience lib for various routines common to several tools + * Copyright (C) 2002,2003,2004,2005 Josh Coalson + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* Convenience routines for working with seek tables */ + +/* This .h cannot be included by itself; #include "share/grabbag.h" instead. */ + +#ifndef GRABAG__SEEKTABLE_H +#define GRABAG__SEEKTABLE_H + +#include "FLAC/format.h" + +#ifdef __cplusplus +extern "C" { +#endif + +FLAC__bool grabbag__seektable_convert_specification_to_template(const char *spec, FLAC__bool only_explicit_placeholders, FLAC__uint64 total_samples_to_encode, unsigned sample_rate, FLAC__StreamMetadata *seektable_template, FLAC__bool *spec_has_real_points); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Libraries/FLAC/Files/include/share/replaygain_analysis.h b/Libraries/FLAC/Files/include/share/replaygain_analysis.h new file mode 100644 index 000000000..b5bb87bfe --- /dev/null +++ b/Libraries/FLAC/Files/include/share/replaygain_analysis.h @@ -0,0 +1,57 @@ +/* + * ReplayGainAnalysis - analyzes input samples and give the recommended dB change + * Copyright (C) 2001 David Robinson and Glen Sawyer + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * concept and filter values by David Robinson (David@Robinson.org) + * -- blame him if you think the idea is flawed + * coding by Glen Sawyer (glensawyer@hotmail.com) 442 N 700 E, Provo, UT 84606 USA + * -- blame him if you think this runs too slowly, or the coding is otherwise flawed + * minor cosmetic tweaks to integrate with FLAC by Josh Coalson + * + * For an explanation of the concepts and the basic algorithms involved, go to: + * http://www.replaygain.org/ + */ + +#ifndef GAIN_ANALYSIS_H +#define GAIN_ANALYSIS_H + +#include + +#define GAIN_NOT_ENOUGH_SAMPLES -24601 +#define GAIN_ANALYSIS_ERROR 0 +#define GAIN_ANALYSIS_OK 1 + +#define INIT_GAIN_ANALYSIS_ERROR 0 +#define INIT_GAIN_ANALYSIS_OK 1 + +#ifdef __cplusplus +extern "C" { +#endif + +typedef float Float_t; /* Type used for filtering */ + +int InitGainAnalysis ( long samplefreq ); +int AnalyzeSamples ( const Float_t* left_samples, const Float_t* right_samples, size_t num_samples, int num_channels ); +int ResetSampleFrequency ( long samplefreq ); +Float_t GetTitleGain ( void ); +Float_t GetAlbumGain ( void ); + +#ifdef __cplusplus +} +#endif + +#endif /* GAIN_ANALYSIS_H */ diff --git a/Libraries/FLAC/Files/include/share/replaygain_synthesis.h b/Libraries/FLAC/Files/include/share/replaygain_synthesis.h new file mode 100644 index 000000000..9c928cb65 --- /dev/null +++ b/Libraries/FLAC/Files/include/share/replaygain_synthesis.h @@ -0,0 +1,51 @@ +/* replaygain_synthesis - Routines for applying ReplayGain to a signal + * Copyright (C) 2002,2003,2004,2005 Josh Coalson + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef FLAC__SHARE__REPLAYGAIN_SYNTHESIS_H +#define FLAC__SHARE__REPLAYGAIN_SYNTHESIS_H + +#include /* for size_t */ +#include "FLAC/ordinals.h" + +#define FLAC_SHARE__MAX_SUPPORTED_CHANNELS 2 + +typedef enum { + NOISE_SHAPING_NONE = 0, + NOISE_SHAPING_LOW = 1, + NOISE_SHAPING_MEDIUM = 2, + NOISE_SHAPING_HIGH = 3 +} NoiseShaping; + +typedef struct { + const float* FilterCoeff; + FLAC__uint64 Mask; + double Add; + float Dither; + float ErrorHistory [FLAC_SHARE__MAX_SUPPORTED_CHANNELS] [16]; /* 16th order Noise shaping */ + float DitherHistory [FLAC_SHARE__MAX_SUPPORTED_CHANNELS] [16]; + int LastRandomNumber [FLAC_SHARE__MAX_SUPPORTED_CHANNELS]; + unsigned LastHistoryIndex; + NoiseShaping ShapingType; +} DitherContext; + +void FLAC__replaygain_synthesis__init_dither_context(DitherContext *dither, int bits, int shapingtype); + +/* scale = (float) pow(10., (double)replaygain * 0.05); */ +size_t FLAC__replaygain_synthesis__apply_gain(FLAC__byte *data_out, FLAC__bool little_endian_data_out, FLAC__bool unsigned_data_out, const FLAC__int32 * const input[], unsigned wide_samples, unsigned channels, const unsigned source_bps, const unsigned target_bps, const double scale, const FLAC__bool hard_limit, FLAC__bool do_dithering, DitherContext *dither_context); + +#endif diff --git a/Libraries/FLAC/Files/include/share/utf8.h b/Libraries/FLAC/Files/include/share/utf8.h new file mode 100644 index 000000000..6aa0e9864 --- /dev/null +++ b/Libraries/FLAC/Files/include/share/utf8.h @@ -0,0 +1,27 @@ +#ifndef SHARE__UTF8_H +#define SHARE__UTF8_H + +/* + * Convert a string between UTF-8 and the locale's charset. + * Invalid bytes are replaced by '#', and characters that are + * not available in the target encoding are replaced by '?'. + * + * If the locale's charset is not set explicitly then it is + * obtained using nl_langinfo(CODESET), where available, the + * environment variable CHARSET, or assumed to be US-ASCII. + * + * Return value of conversion functions: + * + * -1 : memory allocation failed + * 0 : data was converted exactly + * 1 : valid data was converted approximately (using '?') + * 2 : input was invalid (but still converted, using '#') + * 3 : unknown encoding (but still converted, using '?') + */ + +void convert_set_charset(const char *charset); + +int utf8_encode(const char *from, char **to); +int utf8_decode(const char *from, char **to); + +#endif diff --git a/Libraries/FLAC/Files/src/libFLAC/Makefile.am b/Libraries/FLAC/Files/src/libFLAC/Makefile.am new file mode 100644 index 000000000..e7823aec8 --- /dev/null +++ b/Libraries/FLAC/Files/src/libFLAC/Makefile.am @@ -0,0 +1,103 @@ +# libFLAC - Free Lossless Audio Codec library +# Copyright (C) 2001,2002,2003,2004,2005 Josh Coalson +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# - Neither the name of the Xiph.org Foundation nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +lib_LTLIBRARIES = libFLAC.la +if DEBUG +DEBUGCFLAGS = -DFLAC__OVERFLOW_DETECT +endif +if FLaC__CPU_PPC +# The -force_cpusubtype_ALL is needed to insert a ppc64 instruction +# into cpu.c with an asm(). +if FLaC__SYS_DARWIN +#@@@@@@ PPC optimizations temporarily disabled +CPUCFLAGS = -faltivec -force_cpusubtype_ALL -DFLAC__NO_ASM +else +# Linux-gcc for PPC does not have -force_cpusubtype_ALL, it is Darwin-specific +#@@@@@@ PPC optimizations temporarily disabled +CPUCFLAGS = -maltivec -mabi=altivec -DFLAC__NO_ASM +endif +endif + +AM_CFLAGS = $(DEBUGCFLAGS) $(CPUCFLAGS) + +if FLaC__NO_ASM +else +if FLaC__CPU_IA32 +if FLaC__HAS_NASM +ARCH_SUBDIRS = ia32 +libFLAC_la_LIBADD = ia32/libFLAC-asm.la +endif +endif +if FLaC__CPU_PPC +ARCH_SUBDIRS = ppc +if FLaC__HAS_AS__TEMPORARILY_DISABLED +libFLAC_la_LIBADD = ppc/as/libFLAC-asm.la +else +if FLaC__HAS_GAS__TEMPORARILY_DISABLED +libFLAC_la_LIBADD = ppc/gas/libFLAC-asm.la +endif +endif +LOCAL_EXTRA_LDFLAGS = "-Wl,-read_only_relocs,warning" +endif +endif + +SUBDIRS = $(ARCH_SUBDIRS) include . + +m4datadir = $(datadir)/aclocal +m4data_DATA = libFLAC.m4 + +EXTRA_DIST = \ + Makefile.lite \ + libFLAC_dynamic.dsp \ + libFLAC_static.dsp \ + libFLAC.m4 + +# see 'http://www.gnu.org/software/libtool/manual.html#SEC35' for numbering convention +libFLAC_la_LDFLAGS = -version-info 7:0:0 -lm $(LOCAL_EXTRA_LDFLAGS) +libFLAC_la_SOURCES = \ + bitbuffer.c \ + bitmath.c \ + cpu.c \ + crc.c \ + file_decoder.c \ + file_encoder.c \ + fixed.c \ + float.c \ + format.c \ + lpc.c \ + md5.c \ + memory.c \ + metadata_iterators.c \ + metadata_object.c \ + seekable_stream_decoder.c \ + seekable_stream_encoder.c \ + stream_decoder.c \ + stream_encoder.c \ + stream_encoder_framing.c diff --git a/Libraries/FLAC/Files/src/libFLAC/Makefile.in b/Libraries/FLAC/Files/src/libFLAC/Makefile.in new file mode 100644 index 000000000..f6fc623cb --- /dev/null +++ b/Libraries/FLAC/Files/src/libFLAC/Makefile.in @@ -0,0 +1,745 @@ +# Makefile.in generated by automake 1.8.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# libFLAC - Free Lossless Audio Codec library +# Copyright (C) 2001,2002,2003,2004,2005 Josh Coalson +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# - Neither the name of the Xiph.org Foundation nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +SOURCES = $(libFLAC_la_SOURCES) + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../.. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_triplet = @host@ +subdir = src/libFLAC +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(mkdir_p) +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(m4datadir)" +libLTLIBRARIES_INSTALL = $(INSTALL) +LTLIBRARIES = $(lib_LTLIBRARIES) +@FLaC__CPU_IA32_FALSE@@FLaC__CPU_PPC_TRUE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@@FLaC__NO_ASM_FALSE@libFLAC_la_DEPENDENCIES = ppc/gas/libFLAC-asm.la +@FLaC__CPU_IA32_FALSE@@FLaC__CPU_PPC_TRUE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@@FLaC__NO_ASM_FALSE@libFLAC_la_DEPENDENCIES = ppc/as/libFLAC-asm.la +@FLaC__CPU_IA32_TRUE@@FLaC__HAS_NASM_TRUE@@FLaC__NO_ASM_FALSE@libFLAC_la_DEPENDENCIES = ia32/libFLAC-asm.la +@FLaC__CPU_PPC_TRUE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_NASM_FALSE@@FLaC__NO_ASM_FALSE@libFLAC_la_DEPENDENCIES = ppc/gas/libFLAC-asm.la +@FLaC__CPU_PPC_TRUE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_NASM_FALSE@@FLaC__NO_ASM_FALSE@libFLAC_la_DEPENDENCIES = ppc/as/libFLAC-asm.la +am_libFLAC_la_OBJECTS = bitbuffer.lo bitmath.lo cpu.lo crc.lo \ + file_decoder.lo file_encoder.lo fixed.lo float.lo format.lo \ + lpc.lo md5.lo memory.lo metadata_iterators.lo \ + metadata_object.lo seekable_stream_decoder.lo \ + seekable_stream_encoder.lo stream_decoder.lo stream_encoder.lo \ + stream_encoder_framing.lo +libFLAC_la_OBJECTS = $(am_libFLAC_la_OBJECTS) +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/bitbuffer.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/bitmath.Plo ./$(DEPDIR)/cpu.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/crc.Plo ./$(DEPDIR)/file_decoder.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/file_encoder.Plo ./$(DEPDIR)/fixed.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/float.Plo ./$(DEPDIR)/format.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/lpc.Plo ./$(DEPDIR)/md5.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/memory.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/metadata_iterators.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/metadata_object.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/seekable_stream_decoder.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/seekable_stream_encoder.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/stream_decoder.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/stream_encoder.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/stream_encoder_framing.Plo +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(libFLAC_la_SOURCES) +DIST_SOURCES = $(libFLAC_la_SOURCES) +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-exec-recursive install-info-recursive \ + install-recursive installcheck-recursive installdirs-recursive \ + pdf-recursive ps-recursive uninstall-info-recursive \ + uninstall-recursive +m4dataDATA_INSTALL = $(INSTALL_DATA) +DATA = $(m4data_DATA) +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = ia32 ppc include . +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCAS = @CCAS@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEBUG_FALSE = @DEBUG_FALSE@ +DEBUG_TRUE = @DEBUG_TRUE@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DOCBOOK_TO_MAN = @DOCBOOK_TO_MAN@ +DOXYGEN = @DOXYGEN@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FLaC__CPU_IA32_FALSE = @FLaC__CPU_IA32_FALSE@ +FLaC__CPU_IA32_TRUE = @FLaC__CPU_IA32_TRUE@ +FLaC__CPU_PPC_FALSE = @FLaC__CPU_PPC_FALSE@ +FLaC__CPU_PPC_TRUE = @FLaC__CPU_PPC_TRUE@ +FLaC__CPU_SPARC_FALSE = @FLaC__CPU_SPARC_FALSE@ +FLaC__CPU_SPARC_TRUE = @FLaC__CPU_SPARC_TRUE@ +FLaC__EXHAUSTIVE_TESTS_FALSE = @FLaC__EXHAUSTIVE_TESTS_FALSE@ +FLaC__EXHAUSTIVE_TESTS_TRUE = @FLaC__EXHAUSTIVE_TESTS_TRUE@ +FLaC__HAS_AS_FALSE = @FLaC__HAS_AS_FALSE@ +FLaC__HAS_AS_TRUE = @FLaC__HAS_AS_TRUE@ +FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@ +FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@ +FLaC__HAS_DOCBOOK_TO_MAN_FALSE = @FLaC__HAS_DOCBOOK_TO_MAN_FALSE@ +FLaC__HAS_DOCBOOK_TO_MAN_TRUE = @FLaC__HAS_DOCBOOK_TO_MAN_TRUE@ +FLaC__HAS_DOXYGEN_FALSE = @FLaC__HAS_DOXYGEN_FALSE@ +FLaC__HAS_DOXYGEN_TRUE = @FLaC__HAS_DOXYGEN_TRUE@ +FLaC__HAS_GAS_FALSE = @FLaC__HAS_GAS_FALSE@ +FLaC__HAS_GAS_TRUE = @FLaC__HAS_GAS_TRUE@ +FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@ +FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@ +FLaC__HAS_NASM_FALSE = @FLaC__HAS_NASM_FALSE@ +FLaC__HAS_NASM_TRUE = @FLaC__HAS_NASM_TRUE@ +FLaC__HAS_OGG_FALSE = @FLaC__HAS_OGG_FALSE@ +FLaC__HAS_OGG_TRUE = @FLaC__HAS_OGG_TRUE@ +FLaC__HAS_XMMS_FALSE = @FLaC__HAS_XMMS_FALSE@ +FLaC__HAS_XMMS_TRUE = @FLaC__HAS_XMMS_TRUE@ +FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE@ +FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE@ +FLaC__NO_ASM_FALSE = @FLaC__NO_ASM_FALSE@ +FLaC__NO_ASM_TRUE = @FLaC__NO_ASM_TRUE@ +FLaC__SSE_OS_FALSE = @FLaC__SSE_OS_FALSE@ +FLaC__SSE_OS_TRUE = @FLaC__SSE_OS_TRUE@ +FLaC__SYS_DARWIN_FALSE = @FLaC__SYS_DARWIN_FALSE@ +FLaC__SYS_DARWIN_TRUE = @FLaC__SYS_DARWIN_TRUE@ +FLaC__SYS_LINUX_FALSE = @FLaC__SYS_LINUX_FALSE@ +FLaC__SYS_LINUX_TRUE = @FLaC__SYS_LINUX_TRUE@ +FLaC__USE_3DNOW_FALSE = @FLaC__USE_3DNOW_FALSE@ +FLaC__USE_3DNOW_TRUE = @FLaC__USE_3DNOW_TRUE@ +FLaC__USE_ALTIVEC_FALSE = @FLaC__USE_ALTIVEC_FALSE@ +FLaC__USE_ALTIVEC_TRUE = @FLaC__USE_ALTIVEC_TRUE@ +FLaC__VALGRIND_TESTING_FALSE = @FLaC__VALGRIND_TESTING_FALSE@ +FLaC__VALGRIND_TESTING_TRUE = @FLaC__VALGRIND_TESTING_TRUE@ +GAS = @GAS@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +NASM = @NASM@ +OBJEXT = @OBJEXT@ +OBJ_FORMAT = @OBJ_FORMAT@ +OGG_CFLAGS = @OGG_CFLAGS@ +OGG_LIBS = @OGG_LIBS@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +XMMS_CFLAGS = @XMMS_CFLAGS@ +XMMS_CONFIG = @XMMS_CONFIG@ +XMMS_DATA_DIR = @XMMS_DATA_DIR@ +XMMS_EFFECT_PLUGIN_DIR = @XMMS_EFFECT_PLUGIN_DIR@ +XMMS_GENERAL_PLUGIN_DIR = @XMMS_GENERAL_PLUGIN_DIR@ +XMMS_INPUT_PLUGIN_DIR = @XMMS_INPUT_PLUGIN_DIR@ +XMMS_LIBS = @XMMS_LIBS@ +XMMS_OUTPUT_PLUGIN_DIR = @XMMS_OUTPUT_PLUGIN_DIR@ +XMMS_PLUGIN_DIR = @XMMS_PLUGIN_DIR@ +XMMS_VERSION = @XMMS_VERSION@ +XMMS_VISUALIZATION_PLUGIN_DIR = @XMMS_VISUALIZATION_PLUGIN_DIR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +lib_LTLIBRARIES = libFLAC.la +@DEBUG_TRUE@DEBUGCFLAGS = -DFLAC__OVERFLOW_DETECT +# Linux-gcc for PPC does not have -force_cpusubtype_ALL, it is Darwin-specific +#@@@@@@ PPC optimizations temporarily disabled +@FLaC__CPU_PPC_TRUE@@FLaC__SYS_DARWIN_FALSE@CPUCFLAGS = -maltivec -mabi=altivec -DFLAC__NO_ASM +# The -force_cpusubtype_ALL is needed to insert a ppc64 instruction +# into cpu.c with an asm(). +#@@@@@@ PPC optimizations temporarily disabled +@FLaC__CPU_PPC_TRUE@@FLaC__SYS_DARWIN_TRUE@CPUCFLAGS = -faltivec -force_cpusubtype_ALL -DFLAC__NO_ASM +AM_CFLAGS = $(DEBUGCFLAGS) $(CPUCFLAGS) +@FLaC__CPU_IA32_TRUE@@FLaC__HAS_NASM_TRUE@@FLaC__NO_ASM_FALSE@ARCH_SUBDIRS = ia32 +@FLaC__CPU_PPC_TRUE@@FLaC__NO_ASM_FALSE@ARCH_SUBDIRS = ppc +@FLaC__CPU_IA32_TRUE@@FLaC__HAS_NASM_TRUE@@FLaC__NO_ASM_FALSE@libFLAC_la_LIBADD = ia32/libFLAC-asm.la +@FLaC__CPU_PPC_TRUE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@@FLaC__NO_ASM_FALSE@libFLAC_la_LIBADD = ppc/gas/libFLAC-asm.la +@FLaC__CPU_PPC_TRUE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@@FLaC__NO_ASM_FALSE@libFLAC_la_LIBADD = ppc/as/libFLAC-asm.la +@FLaC__CPU_PPC_TRUE@@FLaC__NO_ASM_FALSE@LOCAL_EXTRA_LDFLAGS = "-Wl,-read_only_relocs,warning" +SUBDIRS = $(ARCH_SUBDIRS) include . +m4datadir = $(datadir)/aclocal +m4data_DATA = libFLAC.m4 +EXTRA_DIST = \ + Makefile.lite \ + libFLAC_dynamic.dsp \ + libFLAC_static.dsp \ + libFLAC.m4 + + +# see 'http://www.gnu.org/software/libtool/manual.html#SEC35' for numbering convention +libFLAC_la_LDFLAGS = -version-info 7:0:0 -lm $(LOCAL_EXTRA_LDFLAGS) +libFLAC_la_SOURCES = \ + bitbuffer.c \ + bitmath.c \ + cpu.c \ + crc.c \ + file_decoder.c \ + file_encoder.c \ + fixed.c \ + float.c \ + format.c \ + lpc.c \ + md5.c \ + memory.c \ + metadata_iterators.c \ + metadata_object.c \ + seekable_stream_decoder.c \ + seekable_stream_encoder.c \ + stream_decoder.c \ + stream_encoder.c \ + stream_encoder_framing.c + +all: all-recursive + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/libFLAC/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/libFLAC/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ + else :; fi; \ + done + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + p="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \ + $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libFLAC.la: $(libFLAC_la_OBJECTS) $(libFLAC_la_DEPENDENCIES) + $(LINK) -rpath $(libdir) $(libFLAC_la_LDFLAGS) $(libFLAC_la_OBJECTS) $(libFLAC_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bitbuffer.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bitmath.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/crc.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/file_decoder.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/file_encoder.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fixed.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/float.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/format.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lpc.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/md5.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memory.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/metadata_iterators.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/metadata_object.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/seekable_stream_decoder.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/seekable_stream_encoder.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stream_decoder.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stream_encoder.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stream_encoder_framing.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: +install-m4dataDATA: $(m4data_DATA) + @$(NORMAL_INSTALL) + test -z "$(m4datadir)" || $(mkdir_p) "$(DESTDIR)$(m4datadir)" + @list='$(m4data_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(m4dataDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(m4datadir)/$$f'"; \ + $(m4dataDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(m4datadir)/$$f"; \ + done + +uninstall-m4dataDATA: + @$(NORMAL_UNINSTALL) + @list='$(m4data_DATA)'; for p in $$list; do \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " rm -f '$(DESTDIR)$(m4datadir)/$$f'"; \ + rm -f "$(DESTDIR)$(m4datadir)/$$f"; \ + done + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || mkdir "$(distdir)/$$subdir" \ + || exit 1; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="../$(top_distdir)" \ + distdir="../$(distdir)/$$subdir" \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile $(LTLIBRARIES) $(DATA) +installdirs: installdirs-recursive +installdirs-am: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(m4datadir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-recursive + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-libtool distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: install-m4dataDATA + +install-exec-am: install-libLTLIBRARIES + +install-info: install-info-recursive + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES \ + uninstall-m4dataDATA + +uninstall-info: uninstall-info-recursive + +.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \ + clean clean-generic clean-libLTLIBRARIES clean-libtool \ + clean-recursive ctags ctags-recursive distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-recursive distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-libLTLIBRARIES install-m4dataDATA \ + install-man install-strip installcheck installcheck-am \ + installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic maintainer-clean-recursive \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool mostlyclean-recursive pdf pdf-am ps ps-am \ + tags tags-recursive uninstall uninstall-am uninstall-info-am \ + uninstall-libLTLIBRARIES uninstall-m4dataDATA + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/Libraries/FLAC/Files/src/libFLAC/Makefile.lite b/Libraries/FLAC/Files/src/libFLAC/Makefile.lite new file mode 100644 index 000000000..38da8f396 --- /dev/null +++ b/Libraries/FLAC/Files/src/libFLAC/Makefile.lite @@ -0,0 +1,86 @@ +# libFLAC - Free Lossless Audio Codec library +# Copyright (C) 2001,2002,2003,2004,2005 Josh Coalson +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# - Neither the name of the Xiph.org Foundation nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +# +# GNU makefile +# + +topdir = ../.. + +LIB_NAME = libFLAC +ifeq ($(DARWIN_BUILD),yes) +DEFINES = -DFLAC__CPU_PPC -DFLAC__USE_ALTIVEC -DFLAC__ALIGN_MALLOC_DATA +else +ifeq ($(SOLARIS_BUILD),yes) +DEFINES = -DFLAC__NO_ASM -DFLAC__ALIGN_MALLOC_DATA +else +DEFINES = -DFLAC__CPU_IA32 -DFLAC__USE_3DNOW -DFLAC__HAS_NASM -DFLAC__ALIGN_MALLOC_DATA +endif +endif +INCLUDES = -I./include -I$(topdir)/include +DEBUG_CFLAGS = -DFLAC__OVERFLOW_DETECT + +ifeq ($(DARWIN_BUILD),yes) +SRCS_S = \ + ppc/as/lpc_asm.s +else +ifeq ($(SOLARIS_BUILD),yes) +else +SRCS_NASM = \ + ia32/cpu_asm.nasm \ + ia32/fixed_asm.nasm \ + ia32/lpc_asm.nasm +endif +endif + +SRCS_C = \ + bitbuffer.c \ + bitmath.c \ + cpu.c \ + crc.c \ + file_decoder.c \ + file_encoder.c \ + fixed.c \ + float.c \ + format.c \ + lpc.c \ + md5.c \ + memory.c \ + metadata_iterators.c \ + metadata_object.c \ + seekable_stream_decoder.c \ + seekable_stream_encoder.c \ + stream_decoder.c \ + stream_encoder.c \ + stream_encoder_framing.c + +include $(topdir)/build/lib.mk + +# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/Libraries/FLAC/Files/src/libFLAC/bitbuffer.c b/Libraries/FLAC/Files/src/libFLAC/bitbuffer.c new file mode 100644 index 000000000..8f5aefa67 --- /dev/null +++ b/Libraries/FLAC/Files/src/libFLAC/bitbuffer.c @@ -0,0 +1,2690 @@ +/* libFLAC - Free Lossless Audio Codec library + * Copyright (C) 2000,2001,2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include /* for malloc() */ +#include /* for memcpy(), memset() */ +#include "private/bitbuffer.h" +#include "private/bitmath.h" +#include "private/crc.h" +#include "FLAC/assert.h" + +/* + * Along the way you will see two versions of some functions, selected + * by a FLAC__NO_MANUAL_INLINING macro. One is the simplified, more + * readable, and slow version, and the other is the same function + * where crucial parts have been manually inlined and are much faster. + * + */ + +/* + * Some optimization strategies are slower with older versions of MSVC + */ +#if defined _MSC_VER && _MSC_VER <= 1200 +#define FLAC__OLD_MSVC_FLAVOR +#endif + +/* + * This should be at least twice as large as the largest number of blurbs + * required to represent any 'number' (in any encoding) you are going to + * read. With FLAC this is on the order of maybe a few hundred bits. + * If the buffer is smaller than that, the decoder won't be able to read + * in a whole number that is in a variable length encoding (e.g. Rice). + * + * The number we are actually using here is based on what would be the + * approximate maximum size of a verbatim frame at the default block size, + * for CD audio (4096 sample * 4 bytes per sample), plus some wiggle room. + * 32kbytes sounds reasonable. For kicks we subtract out 64 bytes for any + * alignment or malloc overhead. + * + * Increase this number to decrease the number of read callbacks, at the + * expense of using more memory. Or decrease for the reverse effect, + * keeping in mind the limit from the first paragraph. + */ +static const unsigned FLAC__BITBUFFER_DEFAULT_CAPACITY = ((65536 - 64) * 8) / FLAC__BITS_PER_BLURB; /* blurbs */ + +#ifndef FLAC__OLD_MSVC_FLAVOR +static const unsigned char byte_to_unary_table[] = { + 8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; +#endif + +#if FLAC__BITS_PER_BLURB == 8 +#define FLAC__BITS_PER_BLURB_LOG2 3 +#define FLAC__BYTES_PER_BLURB 1 +#define FLAC__BLURB_ALL_ONES ((FLAC__byte)0xff) +#define FLAC__BLURB_TOP_BIT_ONE ((FLAC__byte)0x80) +#define BLURB_BIT_TO_MASK(b) (((FLAC__blurb)'\x80') >> (b)) +#define CRC16_UPDATE_BLURB(bb, blurb, crc) FLAC__CRC16_UPDATE((blurb), (crc)); +#ifndef FLAC__OLD_MSVC_FLAVOR +#define FLAC__ALIGNED_BLURB_UNARY(blurb) (byte_to_unary_table[blurb]) +#endif +#elif FLAC__BITS_PER_BLURB == 32 +#define FLAC__BITS_PER_BLURB_LOG2 5 +#define FLAC__BYTES_PER_BLURB 4 +#define FLAC__BLURB_ALL_ONES ((FLAC__uint32)0xffffffff) +#define FLAC__BLURB_TOP_BIT_ONE ((FLAC__uint32)0x80000000) +#define BLURB_BIT_TO_MASK(b) (((FLAC__blurb)0x80000000) >> (b)) +#define CRC16_UPDATE_BLURB(bb, blurb, crc) crc16_update_blurb((bb), (blurb)); +#ifndef FLAC__OLD_MSVC_FLAVOR +#define FLAC__ALIGNED_BLURB_UNARY(blurb) ((blurb) <= 0xff ? byte_to_unary_table[blurb] + 24 : ((blurb) <= 0xffff ? byte_to_unary_table[(blurb) >> 8] + 16 : ((blurb) <= 0xffffff ? byte_to_unary_table[(blurb) >> 16] + 8 : byte_to_unary_table[(blurb) >> 24]))) +#endif +#else +/* ERROR, only sizes of 8 and 32 are supported */ +#endif + +#define FLAC__BLURBS_TO_BITS(blurbs) ((blurbs) << FLAC__BITS_PER_BLURB_LOG2) + +#ifdef min +#undef min +#endif +#define min(x,y) ((x)<(y)?(x):(y)) +#ifdef max +#undef max +#endif +#define max(x,y) ((x)>(y)?(x):(y)) + +/* adjust for compilers that can't understand using LLU suffix for uint64_t literals */ +#ifdef _MSC_VER +#define FLAC__U64L(x) x +#else +#define FLAC__U64L(x) x##LLU +#endif + +#ifndef FLaC__INLINE +#define FLaC__INLINE +#endif + +struct FLAC__BitBuffer { + FLAC__blurb *buffer; + unsigned capacity; /* in blurbs */ + unsigned blurbs, bits; + unsigned total_bits; /* must always == FLAC__BITS_PER_BLURB*blurbs+bits */ + unsigned consumed_blurbs, consumed_bits; + unsigned total_consumed_bits; /* must always == FLAC__BITS_PER_BLURB*consumed_blurbs+consumed_bits */ + FLAC__uint16 read_crc16; +#if FLAC__BITS_PER_BLURB == 32 + unsigned crc16_align; +#endif + FLAC__blurb save_head, save_tail; +}; + +#if FLAC__BITS_PER_BLURB == 32 +static void crc16_update_blurb(FLAC__BitBuffer *bb, FLAC__blurb blurb) +{ + if(bb->crc16_align == 0) { + FLAC__CRC16_UPDATE(blurb >> 24, bb->read_crc16); + FLAC__CRC16_UPDATE((blurb >> 16) & 0xff, bb->read_crc16); + FLAC__CRC16_UPDATE((blurb >> 8) & 0xff, bb->read_crc16); + FLAC__CRC16_UPDATE(blurb & 0xff, bb->read_crc16); + } + else if(bb->crc16_align == 8) { + FLAC__CRC16_UPDATE((blurb >> 16) & 0xff, bb->read_crc16); + FLAC__CRC16_UPDATE((blurb >> 8) & 0xff, bb->read_crc16); + FLAC__CRC16_UPDATE(blurb & 0xff, bb->read_crc16); + } + else if(bb->crc16_align == 16) { + FLAC__CRC16_UPDATE((blurb >> 8) & 0xff, bb->read_crc16); + FLAC__CRC16_UPDATE(blurb & 0xff, bb->read_crc16); + } + else if(bb->crc16_align == 24) { + FLAC__CRC16_UPDATE(blurb & 0xff, bb->read_crc16); + } + bb->crc16_align = 0; +} +#endif + +/* + * WATCHOUT: The current implentation is not friendly to shrinking, i.e. it + * does not shift left what is consumed, it just chops off the end, whether + * there is unconsumed data there or not. This is OK because currently we + * never shrink the buffer, but if this ever changes, we'll have to do some + * fixups here. + */ +static FLAC__bool bitbuffer_resize_(FLAC__BitBuffer *bb, unsigned new_capacity) +{ + FLAC__blurb *new_buffer; + + FLAC__ASSERT(0 != bb); + FLAC__ASSERT(0 != bb->buffer); + + if(bb->capacity == new_capacity) + return true; + + new_buffer = (FLAC__blurb*)calloc(new_capacity, sizeof(FLAC__blurb)); + if(new_buffer == 0) + return false; + memcpy(new_buffer, bb->buffer, sizeof(FLAC__blurb)*min(bb->blurbs+(bb->bits?1:0), new_capacity)); + if(new_capacity < bb->blurbs+(bb->bits?1:0)) { + bb->blurbs = new_capacity; + bb->bits = 0; + bb->total_bits = FLAC__BLURBS_TO_BITS(new_capacity); + } + if(new_capacity < bb->consumed_blurbs+(bb->consumed_bits?1:0)) { + bb->consumed_blurbs = new_capacity; + bb->consumed_bits = 0; + bb->total_consumed_bits = FLAC__BLURBS_TO_BITS(new_capacity); + } + free(bb->buffer); /* we've already asserted above that (0 != bb->buffer) */ + bb->buffer = new_buffer; + bb->capacity = new_capacity; + return true; +} + +static FLAC__bool bitbuffer_grow_(FLAC__BitBuffer *bb, unsigned min_blurbs_to_add) +{ + unsigned new_capacity; + + FLAC__ASSERT(min_blurbs_to_add > 0); + + new_capacity = max(bb->capacity * 2, bb->capacity + min_blurbs_to_add); + return bitbuffer_resize_(bb, new_capacity); +} + +static FLAC__bool bitbuffer_ensure_size_(FLAC__BitBuffer *bb, unsigned bits_to_add) +{ + FLAC__ASSERT(0 != bb); + FLAC__ASSERT(0 != bb->buffer); + + if(FLAC__BLURBS_TO_BITS(bb->capacity) < bb->total_bits + bits_to_add) + return bitbuffer_grow_(bb, (bits_to_add >> FLAC__BITS_PER_BLURB_LOG2) + 2); + else + return true; +} + +static FLAC__bool bitbuffer_read_from_client_(FLAC__BitBuffer *bb, FLAC__bool (*read_callback)(FLAC__byte buffer[], unsigned *bytes, void *client_data), void *client_data) +{ + unsigned bytes; + FLAC__byte *target; + + /* first shift the unconsumed buffer data toward the front as much as possible */ + if(bb->total_consumed_bits >= FLAC__BITS_PER_BLURB) { +#if FLAC__BITS_PER_BLURB == 8 + /* + * memset and memcpy are usually implemented in assembly language + * by the system libc, and they can be much faster + */ + const unsigned r_end = bb->blurbs + (bb->bits? 1:0); + const unsigned r = bb->consumed_blurbs, l = r_end - r; + memmove(&bb->buffer[0], &bb->buffer[r], l); + memset(&bb->buffer[l], 0, r); +#elif FLAC__BITS_PER_BLURB == 32 + /* still needs optimization */ + const unsigned r_end = bb->blurbs + (bb->bits? 1:0); + unsigned l = 0, r = bb->consumed_blurbs; + for( ; r < r_end; l++, r++) + bb->buffer[l] = bb->buffer[r]; + for( ; l < r_end; l++) + bb->buffer[l] = 0; +#else + FLAC__ASSERT(false); /* ERROR, only sizes of 8 and 32 are supported */ +#endif /* FLAC__BITS_PER_BLURB == 32 or 8 */ + + bb->blurbs -= bb->consumed_blurbs; + bb->total_bits -= FLAC__BLURBS_TO_BITS(bb->consumed_blurbs); + bb->consumed_blurbs = 0; + bb->total_consumed_bits = bb->consumed_bits; + } + + /* grow if we need to */ + if(bb->capacity <= 1) { + if(!bitbuffer_resize_(bb, 16)) + return false; + } + + /* set the target for reading, taking into account blurb alignment */ +#if FLAC__BITS_PER_BLURB == 8 + /* blurb == byte, so no gyrations necessary: */ + target = bb->buffer + bb->blurbs; + bytes = bb->capacity - bb->blurbs; +#elif FLAC__BITS_PER_BLURB == 32 + /* @@@ WATCHOUT: code currently only works for big-endian: */ + FLAC__ASSERT((bb->bits & 7) == 0); + target = (FLAC__byte*)(bb->buffer + bb->blurbs) + (bb->bits >> 3); + bytes = ((bb->capacity - bb->blurbs) << 2) - (bb->bits >> 3); /* i.e. (bb->capacity - bb->blurbs) * FLAC__BYTES_PER_BLURB - (bb->bits / 8) */ +#else + FLAC__ASSERT(false); /* ERROR, only sizes of 8 and 32 are supported */ +#endif + + /* finally, read in some data */ + if(!read_callback(target, &bytes, client_data)) + return false; + + /* now we have to handle partial blurb cases: */ +#if FLAC__BITS_PER_BLURB == 8 + /* blurb == byte, so no gyrations necessary: */ + bb->blurbs += bytes; + bb->total_bits += FLAC__BLURBS_TO_BITS(bytes); +#elif FLAC__BITS_PER_BLURB == 32 + /* @@@ WATCHOUT: code currently only works for big-endian: */ + { + const unsigned aligned_bytes = (bb->bits >> 3) + bytes; + bb->blurbs += (aligned_bytes >> 2); /* i.e. aligned_bytes / FLAC__BYTES_PER_BLURB */ + bb->bits = (aligned_bytes & 3u) << 3; /* i.e. (aligned_bytes % FLAC__BYTES_PER_BLURB) * 8 */ + bb->total_bits += (bytes << 3); + } +#else + FLAC__ASSERT(false); /* ERROR, only sizes of 8 and 32 are supported */ +#endif + return true; +} + +/*********************************************************************** + * + * Class constructor/destructor + * + ***********************************************************************/ + +FLAC__BitBuffer *FLAC__bitbuffer_new() +{ + FLAC__BitBuffer *bb = (FLAC__BitBuffer*)calloc(1, sizeof(FLAC__BitBuffer)); + + /* calloc() implies: + memset(bb, 0, sizeof(FLAC__BitBuffer)); + bb->buffer = 0; + bb->capacity = 0; + bb->blurbs = bb->bits = bb->total_bits = 0; + bb->consumed_blurbs = bb->consumed_bits = bb->total_consumed_bits = 0; + */ + return bb; +} + +void FLAC__bitbuffer_delete(FLAC__BitBuffer *bb) +{ + FLAC__ASSERT(0 != bb); + + FLAC__bitbuffer_free(bb); + free(bb); +} + +/*********************************************************************** + * + * Public class methods + * + ***********************************************************************/ + +FLAC__bool FLAC__bitbuffer_init(FLAC__BitBuffer *bb) +{ + FLAC__ASSERT(0 != bb); + + bb->buffer = 0; + bb->capacity = 0; + bb->blurbs = bb->bits = bb->total_bits = 0; + bb->consumed_blurbs = bb->consumed_bits = bb->total_consumed_bits = 0; + + return FLAC__bitbuffer_clear(bb); +} + +FLAC__bool FLAC__bitbuffer_init_from(FLAC__BitBuffer *bb, const FLAC__byte buffer[], unsigned bytes) +{ + FLAC__ASSERT(0 != bb); + FLAC__ASSERT(bytes > 0); + + if(!FLAC__bitbuffer_init(bb)) + return false; + + if(!bitbuffer_ensure_size_(bb, bytes << 3)) + return false; + + FLAC__ASSERT(0 != buffer); + /* @@@ WATCHOUT: code currently only works for 8-bits-per-blurb inclusive-or big-endian: */ + memcpy((FLAC__byte*)bb->buffer, buffer, sizeof(FLAC__byte)*bytes); + bb->blurbs = bytes / FLAC__BYTES_PER_BLURB; + bb->bits = (bytes % FLAC__BYTES_PER_BLURB) << 3; + bb->total_bits = bytes << 3; + return true; +} + +FLAC__bool FLAC__bitbuffer_concatenate_aligned(FLAC__BitBuffer *dest, const FLAC__BitBuffer *src) +{ + unsigned bits_to_add = src->total_bits - src->total_consumed_bits; + + FLAC__ASSERT(0 != dest); + FLAC__ASSERT(0 != src); + + if(bits_to_add == 0) + return true; + if(dest->bits != src->consumed_bits) + return false; + if(!bitbuffer_ensure_size_(dest, bits_to_add)) + return false; + if(dest->bits == 0) { + memcpy(dest->buffer+dest->blurbs, src->buffer+src->consumed_blurbs, sizeof(FLAC__blurb)*(src->blurbs-src->consumed_blurbs + ((src->bits)? 1:0))); + } + else if(dest->bits + bits_to_add > FLAC__BITS_PER_BLURB) { + dest->buffer[dest->blurbs] <<= (FLAC__BITS_PER_BLURB - dest->bits); + dest->buffer[dest->blurbs] |= (src->buffer[src->consumed_blurbs] & ((1u << (FLAC__BITS_PER_BLURB-dest->bits)) - 1)); + memcpy(dest->buffer+dest->blurbs+1, src->buffer+src->consumed_blurbs+1, sizeof(FLAC__blurb)*(src->blurbs-src->consumed_blurbs-1 + ((src->bits)? 1:0))); + } + else { + dest->buffer[dest->blurbs] <<= bits_to_add; + dest->buffer[dest->blurbs] |= (src->buffer[src->consumed_blurbs] & ((1u << bits_to_add) - 1)); + } + dest->bits = src->bits; + dest->total_bits += bits_to_add; + dest->blurbs = dest->total_bits / FLAC__BITS_PER_BLURB; + + return true; +} + +void FLAC__bitbuffer_free(FLAC__BitBuffer *bb) +{ + FLAC__ASSERT(0 != bb); + + if(0 != bb->buffer) + free(bb->buffer); + bb->buffer = 0; + bb->capacity = 0; + bb->blurbs = bb->bits = bb->total_bits = 0; + bb->consumed_blurbs = bb->consumed_bits = bb->total_consumed_bits = 0; +} + +FLAC__bool FLAC__bitbuffer_clear(FLAC__BitBuffer *bb) +{ + if(bb->buffer == 0) { + bb->capacity = FLAC__BITBUFFER_DEFAULT_CAPACITY; + bb->buffer = (FLAC__blurb*)calloc(bb->capacity, sizeof(FLAC__blurb)); + if(bb->buffer == 0) + return false; + } + else { + memset(bb->buffer, 0, bb->blurbs + (bb->bits?1:0)); + } + bb->blurbs = bb->bits = bb->total_bits = 0; + bb->consumed_blurbs = bb->consumed_bits = bb->total_consumed_bits = 0; + return true; +} + +FLAC__bool FLAC__bitbuffer_clone(FLAC__BitBuffer *dest, const FLAC__BitBuffer *src) +{ + FLAC__ASSERT(0 != dest); + FLAC__ASSERT(0 != dest->buffer); + FLAC__ASSERT(0 != src); + FLAC__ASSERT(0 != src->buffer); + + if(dest->capacity < src->capacity) + if(!bitbuffer_resize_(dest, src->capacity)) + return false; + memcpy(dest->buffer, src->buffer, sizeof(FLAC__blurb)*min(src->capacity, src->blurbs+1)); + dest->blurbs = src->blurbs; + dest->bits = src->bits; + dest->total_bits = src->total_bits; + dest->consumed_blurbs = src->consumed_blurbs; + dest->consumed_bits = src->consumed_bits; + dest->total_consumed_bits = src->total_consumed_bits; + dest->read_crc16 = src->read_crc16; + return true; +} + +void FLAC__bitbuffer_reset_read_crc16(FLAC__BitBuffer *bb, FLAC__uint16 seed) +{ + FLAC__ASSERT(0 != bb); + FLAC__ASSERT(0 != bb->buffer); + FLAC__ASSERT((bb->consumed_bits & 7) == 0); + + bb->read_crc16 = seed; +#if FLAC__BITS_PER_BLURB == 8 + /* no need to do anything */ +#elif FLAC__BITS_PER_BLURB == 32 + bb->crc16_align = bb->consumed_bits; +#else + FLAC__ASSERT(false); /* ERROR, only sizes of 8 and 32 are supported */ +#endif +} + +FLAC__uint16 FLAC__bitbuffer_get_read_crc16(FLAC__BitBuffer *bb) +{ + FLAC__ASSERT(0 != bb); + FLAC__ASSERT(0 != bb->buffer); + FLAC__ASSERT((bb->bits & 7) == 0); + FLAC__ASSERT((bb->consumed_bits & 7) == 0); + +#if FLAC__BITS_PER_BLURB == 8 + /* no need to do anything */ +#elif FLAC__BITS_PER_BLURB == 32 + /*@@@ BUG: even though this probably can't happen with FLAC, need to fix the case where we are called here for the very first blurb and crc16_align is > 0 */ + if(bb->bits == 0 || bb->consumed_blurbs < bb->blurbs) { + if(bb->consumed_bits == 8) { + const FLAC__blurb blurb = bb->buffer[bb->consumed_blurbs]; + FLAC__CRC16_UPDATE(blurb >> 24, bb->read_crc16); + } + else if(bb->consumed_bits == 16) { + const FLAC__blurb blurb = bb->buffer[bb->consumed_blurbs]; + FLAC__CRC16_UPDATE(blurb >> 24, bb->read_crc16); + FLAC__CRC16_UPDATE((blurb >> 16) & 0xff, bb->read_crc16); + } + else if(bb->consumed_bits == 24) { + const FLAC__blurb blurb = bb->buffer[bb->consumed_blurbs]; + FLAC__CRC16_UPDATE(blurb >> 24, bb->read_crc16); + FLAC__CRC16_UPDATE((blurb >> 16) & 0xff, bb->read_crc16); + FLAC__CRC16_UPDATE((blurb >> 8) & 0xff, bb->read_crc16); + } + } + else { + if(bb->consumed_bits == 8) { + const FLAC__blurb blurb = bb->buffer[bb->consumed_blurbs]; + FLAC__CRC16_UPDATE(blurb >> (bb->bits-8), bb->read_crc16); + } + else if(bb->consumed_bits == 16) { + const FLAC__blurb blurb = bb->buffer[bb->consumed_blurbs]; + FLAC__CRC16_UPDATE(blurb >> (bb->bits-8), bb->read_crc16); + FLAC__CRC16_UPDATE((blurb >> (bb->bits-16)) & 0xff, bb->read_crc16); + } + else if(bb->consumed_bits == 24) { + const FLAC__blurb blurb = bb->buffer[bb->consumed_blurbs]; + FLAC__CRC16_UPDATE(blurb >> (bb->bits-8), bb->read_crc16); + FLAC__CRC16_UPDATE((blurb >> (bb->bits-16)) & 0xff, bb->read_crc16); + FLAC__CRC16_UPDATE((blurb >> (bb->bits-24)) & 0xff, bb->read_crc16); + } + } + bb->crc16_align = bb->consumed_bits; +#else + FLAC__ASSERT(false); /* ERROR, only sizes of 8 and 32 are supported */ +#endif + return bb->read_crc16; +} + +FLAC__uint16 FLAC__bitbuffer_get_write_crc16(const FLAC__BitBuffer *bb) +{ + FLAC__ASSERT((bb->bits & 7) == 0); /* assert that we're byte-aligned */ + +#if FLAC__BITS_PER_BLURB == 8 + return FLAC__crc16(bb->buffer, bb->blurbs); +#elif FLAC__BITS_PER_BLURB == 32 + /* @@@ WATCHOUT: code currently only works for big-endian: */ + return FLAC__crc16((FLAC__byte*)(bb->buffer), (bb->blurbs * FLAC__BYTES_PER_BLURB) + (bb->bits >> 3)); +#else + FLAC__ASSERT(false); /* ERROR, only sizes of 8 and 32 are supported */ +#endif +} + +FLAC__byte FLAC__bitbuffer_get_write_crc8(const FLAC__BitBuffer *bb) +{ + FLAC__ASSERT(0 != bb); + FLAC__ASSERT((bb->bits & 7) == 0); /* assert that we're byte-aligned */ + FLAC__ASSERT(bb->buffer[0] == 0xff); /* MAGIC NUMBER for the first byte of the sync code */ +#if FLAC__BITS_PER_BLURB == 8 + return FLAC__crc8(bb->buffer, bb->blurbs); +#elif FLAC__BITS_PER_BLURB == 32 + /* @@@ WATCHOUT: code currently only works for big-endian: */ + return FLAC__crc8((FLAC__byte*)(bb->buffer), (bb->blurbs * FLAC__BYTES_PER_BLURB) + (bb->bits >> 3)); +#else + FLAC__ASSERT(false); /* ERROR, only sizes of 8 and 32 are supported */ +#endif +} + +FLAC__bool FLAC__bitbuffer_is_byte_aligned(const FLAC__BitBuffer *bb) +{ + return ((bb->bits & 7) == 0); +} + +FLAC__bool FLAC__bitbuffer_is_consumed_byte_aligned(const FLAC__BitBuffer *bb) +{ + return ((bb->consumed_bits & 7) == 0); +} + +unsigned FLAC__bitbuffer_bits_left_for_byte_alignment(const FLAC__BitBuffer *bb) +{ + return 8 - (bb->consumed_bits & 7); +} + +unsigned FLAC__bitbuffer_get_input_bytes_unconsumed(const FLAC__BitBuffer *bb) +{ + FLAC__ASSERT((bb->consumed_bits & 7) == 0 && (bb->bits & 7) == 0); + return (bb->total_bits - bb->total_consumed_bits) >> 3; +} + +void FLAC__bitbuffer_get_buffer(FLAC__BitBuffer *bb, const FLAC__byte **buffer, unsigned *bytes) +{ + FLAC__ASSERT((bb->consumed_bits & 7) == 0 && (bb->bits & 7) == 0); +#if FLAC__BITS_PER_BLURB == 8 + *buffer = bb->buffer + bb->consumed_blurbs; + *bytes = bb->blurbs - bb->consumed_blurbs; +#elif FLAC__BITS_PER_BLURB == 32 + /* @@@ WATCHOUT: code currently only works for big-endian: */ + *buffer = (FLAC__byte*)(bb->buffer + bb->consumed_blurbs) + (bb->consumed_bits >> 3); + *bytes = (bb->total_bits - bb->total_consumed_bits) >> 3; +#else + FLAC__ASSERT(false); /* ERROR, only sizes of 8 and 32 are supported */ +#endif +} + +void FLAC__bitbuffer_release_buffer(FLAC__BitBuffer *bb) +{ +#if FLAC__BITS_PER_BLURB == 8 + (void)bb; +#elif FLAC__BITS_PER_BLURB == 32 + /* @@@ WATCHOUT: code currently only works for big-endian: */ + (void)bb; +#else + FLAC__ASSERT(false); /* ERROR, only sizes of 8 and 32 are supported */ +#endif +} + +FLAC__bool FLAC__bitbuffer_write_zeroes(FLAC__BitBuffer *bb, unsigned bits) +{ + unsigned n; + + FLAC__ASSERT(0 != bb); + FLAC__ASSERT(0 != bb->buffer); + + if(bits == 0) + return true; + if(!bitbuffer_ensure_size_(bb, bits)) + return false; + bb->total_bits += bits; + while(bits > 0) { + n = min(FLAC__BITS_PER_BLURB - bb->bits, bits); + bb->buffer[bb->blurbs] <<= n; + bits -= n; + bb->bits += n; + if(bb->bits == FLAC__BITS_PER_BLURB) { + bb->blurbs++; + bb->bits = 0; + } + } + return true; +} + +FLaC__INLINE FLAC__bool FLAC__bitbuffer_write_raw_uint32(FLAC__BitBuffer *bb, FLAC__uint32 val, unsigned bits) +{ + unsigned n, k; + + FLAC__ASSERT(0 != bb); + FLAC__ASSERT(0 != bb->buffer); + + FLAC__ASSERT(bits <= 32); + if(bits == 0) + return true; + /* inline the size check so we don't incure a function call unnecessarily */ + if(FLAC__BLURBS_TO_BITS(bb->capacity) < bb->total_bits + bits) { + if(!bitbuffer_ensure_size_(bb, bits)) + return false; + } + + /* zero-out unused bits; WATCHOUT: other code relies on this, so this needs to stay */ + if(bits < 32) /* @@@ gcc seems to require this because the following line causes incorrect results when bits==32; investigate */ + val &= (~(0xffffffff << bits)); /* zero-out unused bits */ + + bb->total_bits += bits; + while(bits > 0) { + n = FLAC__BITS_PER_BLURB - bb->bits; + if(n == FLAC__BITS_PER_BLURB) { /* i.e. bb->bits == 0 */ + if(bits < FLAC__BITS_PER_BLURB) { + bb->buffer[bb->blurbs] = (FLAC__blurb)val; + bb->bits = bits; + break; + } + else if(bits == FLAC__BITS_PER_BLURB) { + bb->buffer[bb->blurbs++] = (FLAC__blurb)val; + break; + } + else { + k = bits - FLAC__BITS_PER_BLURB; + bb->buffer[bb->blurbs++] = (FLAC__blurb)(val >> k); + /* we know k < 32 so no need to protect against the gcc bug mentioned above */ + val &= (~(0xffffffff << k)); + bits -= FLAC__BITS_PER_BLURB; + } + } + else if(bits <= n) { + bb->buffer[bb->blurbs] <<= bits; + bb->buffer[bb->blurbs] |= val; + if(bits == n) { + bb->blurbs++; + bb->bits = 0; + } + else + bb->bits += bits; + break; + } + else { + k = bits - n; + bb->buffer[bb->blurbs] <<= n; + bb->buffer[bb->blurbs] |= (val >> k); + /* we know n > 0 so k < 32 so no need to protect against the gcc bug mentioned above */ + val &= (~(0xffffffff << k)); + bits -= n; + bb->blurbs++; + bb->bits = 0; + } + } + + return true; +} + +FLAC__bool FLAC__bitbuffer_write_raw_int32(FLAC__BitBuffer *bb, FLAC__int32 val, unsigned bits) +{ + return FLAC__bitbuffer_write_raw_uint32(bb, (FLAC__uint32)val, bits); +} + +FLAC__bool FLAC__bitbuffer_write_raw_uint64(FLAC__BitBuffer *bb, FLAC__uint64 val, unsigned bits) +{ + static const FLAC__uint64 mask[] = { + 0, + FLAC__U64L(0x0000000000000001), FLAC__U64L(0x0000000000000003), FLAC__U64L(0x0000000000000007), FLAC__U64L(0x000000000000000F), + FLAC__U64L(0x000000000000001F), FLAC__U64L(0x000000000000003F), FLAC__U64L(0x000000000000007F), FLAC__U64L(0x00000000000000FF), + FLAC__U64L(0x00000000000001FF), FLAC__U64L(0x00000000000003FF), FLAC__U64L(0x00000000000007FF), FLAC__U64L(0x0000000000000FFF), + FLAC__U64L(0x0000000000001FFF), FLAC__U64L(0x0000000000003FFF), FLAC__U64L(0x0000000000007FFF), FLAC__U64L(0x000000000000FFFF), + FLAC__U64L(0x000000000001FFFF), FLAC__U64L(0x000000000003FFFF), FLAC__U64L(0x000000000007FFFF), FLAC__U64L(0x00000000000FFFFF), + FLAC__U64L(0x00000000001FFFFF), FLAC__U64L(0x00000000003FFFFF), FLAC__U64L(0x00000000007FFFFF), FLAC__U64L(0x0000000000FFFFFF), + FLAC__U64L(0x0000000001FFFFFF), FLAC__U64L(0x0000000003FFFFFF), FLAC__U64L(0x0000000007FFFFFF), FLAC__U64L(0x000000000FFFFFFF), + FLAC__U64L(0x000000001FFFFFFF), FLAC__U64L(0x000000003FFFFFFF), FLAC__U64L(0x000000007FFFFFFF), FLAC__U64L(0x00000000FFFFFFFF), + FLAC__U64L(0x00000001FFFFFFFF), FLAC__U64L(0x00000003FFFFFFFF), FLAC__U64L(0x00000007FFFFFFFF), FLAC__U64L(0x0000000FFFFFFFFF), + FLAC__U64L(0x0000001FFFFFFFFF), FLAC__U64L(0x0000003FFFFFFFFF), FLAC__U64L(0x0000007FFFFFFFFF), FLAC__U64L(0x000000FFFFFFFFFF), + FLAC__U64L(0x000001FFFFFFFFFF), FLAC__U64L(0x000003FFFFFFFFFF), FLAC__U64L(0x000007FFFFFFFFFF), FLAC__U64L(0x00000FFFFFFFFFFF), + FLAC__U64L(0x00001FFFFFFFFFFF), FLAC__U64L(0x00003FFFFFFFFFFF), FLAC__U64L(0x00007FFFFFFFFFFF), FLAC__U64L(0x0000FFFFFFFFFFFF), + FLAC__U64L(0x0001FFFFFFFFFFFF), FLAC__U64L(0x0003FFFFFFFFFFFF), FLAC__U64L(0x0007FFFFFFFFFFFF), FLAC__U64L(0x000FFFFFFFFFFFFF), + FLAC__U64L(0x001FFFFFFFFFFFFF), FLAC__U64L(0x003FFFFFFFFFFFFF), FLAC__U64L(0x007FFFFFFFFFFFFF), FLAC__U64L(0x00FFFFFFFFFFFFFF), + FLAC__U64L(0x01FFFFFFFFFFFFFF), FLAC__U64L(0x03FFFFFFFFFFFFFF), FLAC__U64L(0x07FFFFFFFFFFFFFF), FLAC__U64L(0x0FFFFFFFFFFFFFFF), + FLAC__U64L(0x1FFFFFFFFFFFFFFF), FLAC__U64L(0x3FFFFFFFFFFFFFFF), FLAC__U64L(0x7FFFFFFFFFFFFFFF), FLAC__U64L(0xFFFFFFFFFFFFFFFF) + }; + unsigned n, k; + + FLAC__ASSERT(0 != bb); + FLAC__ASSERT(0 != bb->buffer); + + FLAC__ASSERT(bits <= 64); + if(bits == 0) + return true; + if(!bitbuffer_ensure_size_(bb, bits)) + return false; + val &= mask[bits]; + bb->total_bits += bits; + while(bits > 0) { + if(bb->bits == 0) { + if(bits < FLAC__BITS_PER_BLURB) { + bb->buffer[bb->blurbs] = (FLAC__blurb)val; + bb->bits = bits; + break; + } + else if(bits == FLAC__BITS_PER_BLURB) { + bb->buffer[bb->blurbs++] = (FLAC__blurb)val; + break; + } + else { + k = bits - FLAC__BITS_PER_BLURB; + bb->buffer[bb->blurbs++] = (FLAC__blurb)(val >> k); + /* we know k < 64 so no need to protect against the gcc bug mentioned above */ + val &= (~(FLAC__U64L(0xffffffffffffffff) << k)); + bits -= FLAC__BITS_PER_BLURB; + } + } + else { + n = min(FLAC__BITS_PER_BLURB - bb->bits, bits); + k = bits - n; + bb->buffer[bb->blurbs] <<= n; + bb->buffer[bb->blurbs] |= (val >> k); + /* we know n > 0 so k < 64 so no need to protect against the gcc bug mentioned above */ + val &= (~(FLAC__U64L(0xffffffffffffffff) << k)); + bits -= n; + bb->bits += n; + if(bb->bits == FLAC__BITS_PER_BLURB) { + bb->blurbs++; + bb->bits = 0; + } + } + } + + return true; +} + +#if 0 /* UNUSED */ +FLAC__bool FLAC__bitbuffer_write_raw_int64(FLAC__BitBuffer *bb, FLAC__int64 val, unsigned bits) +{ + return FLAC__bitbuffer_write_raw_uint64(bb, (FLAC__uint64)val, bits); +} +#endif + +FLaC__INLINE FLAC__bool FLAC__bitbuffer_write_raw_uint32_little_endian(FLAC__BitBuffer *bb, FLAC__uint32 val) +{ + /* this doesn't need to be that fast as currently it is only used for vorbis comments */ + + /* NOTE: we rely on the fact that FLAC__bitbuffer_write_raw_uint32() masks out the unused bits */ + if(!FLAC__bitbuffer_write_raw_uint32(bb, val, 8)) + return false; + if(!FLAC__bitbuffer_write_raw_uint32(bb, val>>8, 8)) + return false; + if(!FLAC__bitbuffer_write_raw_uint32(bb, val>>16, 8)) + return false; + if(!FLAC__bitbuffer_write_raw_uint32(bb, val>>24, 8)) + return false; + + return true; +} + +FLaC__INLINE FLAC__bool FLAC__bitbuffer_write_byte_block(FLAC__BitBuffer *bb, const FLAC__byte vals[], unsigned nvals) +{ + unsigned i; + + /* this could be faster but currently we don't need it to be */ + for(i = 0; i < nvals; i++) { + if(!FLAC__bitbuffer_write_raw_uint32(bb, (FLAC__uint32)(vals[i]), 8)) + return false; + } + + return true; +} + +FLAC__bool FLAC__bitbuffer_write_unary_unsigned(FLAC__BitBuffer *bb, unsigned val) +{ + if(val < 32) + return FLAC__bitbuffer_write_raw_uint32(bb, 1, ++val); + else if(val < 64) + return FLAC__bitbuffer_write_raw_uint64(bb, 1, ++val); + else { + if(!FLAC__bitbuffer_write_zeroes(bb, val)) + return false; + return FLAC__bitbuffer_write_raw_uint32(bb, 1, 1); + } +} + +unsigned FLAC__bitbuffer_rice_bits(int val, unsigned parameter) +{ + unsigned msbs, uval; + + /* fold signed to unsigned */ + if(val < 0) + /* equivalent to + * (unsigned)(((--val) << 1) - 1); + * but without the overflow problem at MININT + */ + uval = (unsigned)(((-(++val)) << 1) + 1); + else + uval = (unsigned)(val << 1); + + msbs = uval >> parameter; + + return 1 + parameter + msbs; +} + +#if 0 /* UNUSED */ +unsigned FLAC__bitbuffer_golomb_bits_signed(int val, unsigned parameter) +{ + unsigned bits, msbs, uval; + unsigned k; + + FLAC__ASSERT(parameter > 0); + + /* fold signed to unsigned */ + if(val < 0) + /* equivalent to + * (unsigned)(((--val) << 1) - 1); + * but without the overflow problem at MININT + */ + uval = (unsigned)(((-(++val)) << 1) + 1); + else + uval = (unsigned)(val << 1); + + k = FLAC__bitmath_ilog2(parameter); + if(parameter == 1u<> k; + bits = 1 + k + msbs; + } + else { + unsigned q, r, d; + + d = (1 << (k+1)) - parameter; + q = uval / parameter; + r = uval - (q * parameter); + + bits = 1 + q + k; + if(r >= d) + bits++; + } + return bits; +} + +unsigned FLAC__bitbuffer_golomb_bits_unsigned(unsigned uval, unsigned parameter) +{ + unsigned bits, msbs; + unsigned k; + + FLAC__ASSERT(parameter > 0); + + k = FLAC__bitmath_ilog2(parameter); + if(parameter == 1u<> k; + bits = 1 + k + msbs; + } + else { + unsigned q, r, d; + + d = (1 << (k+1)) - parameter; + q = uval / parameter; + r = uval - (q * parameter); + + bits = 1 + q + k; + if(r >= d) + bits++; + } + return bits; +} +#endif /* UNUSED */ + +#ifdef FLAC__SYMMETRIC_RICE +FLAC__bool FLAC__bitbuffer_write_symmetric_rice_signed(FLAC__BitBuffer *bb, int val, unsigned parameter) +{ + unsigned total_bits, interesting_bits, msbs; + FLAC__uint32 pattern; + + FLAC__ASSERT(0 != bb); + FLAC__ASSERT(0 != bb->buffer); + FLAC__ASSERT(parameter <= 31); + + /* init pattern with the unary end bit and the sign bit */ + if(val < 0) { + pattern = 3; + val = -val; + } + else + pattern = 2; + + msbs = val >> parameter; + interesting_bits = 2 + parameter; + total_bits = interesting_bits + msbs; + pattern <<= parameter; + pattern |= (val & ((1<buffer); + FLAC__ASSERT(parameter <= 31); + + *overflow = false; + + /* init pattern with the unary end bit and the sign bit */ + if(val < 0) { + pattern = 3; + val = -val; + } + else + pattern = 2; + + msbs = val >> parameter; + interesting_bits = 2 + parameter; + total_bits = interesting_bits + msbs; + pattern <<= parameter; + pattern |= (val & ((1< max_bits) { + *overflow = true; + return true; + } + else { + /* write the unary MSBs */ + if(!FLAC__bitbuffer_write_zeroes(bb, msbs)) + return false; + /* write the unary end bit, the sign bit, and binary LSBs */ + if(!FLAC__bitbuffer_write_raw_uint32(bb, pattern, interesting_bits)) + return false; + } + return true; +} +#endif /* UNUSED */ + +FLAC__bool FLAC__bitbuffer_write_symmetric_rice_signed_escape(FLAC__BitBuffer *bb, int val, unsigned parameter) +{ + unsigned total_bits, val_bits; + FLAC__uint32 pattern; + + FLAC__ASSERT(0 != bb); + FLAC__ASSERT(0 != bb->buffer); + FLAC__ASSERT(parameter <= 31); + + val_bits = FLAC__bitmath_silog2(val); + total_bits = 2 + parameter + 5 + val_bits; + + if(total_bits <= 32) { + pattern = 3; + pattern <<= (parameter + 5); + pattern |= val_bits; + pattern <<= val_bits; + pattern |= (val & ((1 << val_bits) - 1)); + if(!FLAC__bitbuffer_write_raw_uint32(bb, pattern, total_bits)) + return false; + } + else { + /* write the '-0' escape code first */ + if(!FLAC__bitbuffer_write_raw_uint32(bb, 3u << parameter, 2+parameter)) + return false; + /* write the length */ + if(!FLAC__bitbuffer_write_raw_uint32(bb, val_bits, 5)) + return false; + /* write the value */ + if(!FLAC__bitbuffer_write_raw_int32(bb, val, val_bits)) + return false; + } + return true; +} +#endif /* ifdef FLAC__SYMMETRIC_RICE */ + +FLAC__bool FLAC__bitbuffer_write_rice_signed(FLAC__BitBuffer *bb, int val, unsigned parameter) +{ + unsigned total_bits, interesting_bits, msbs, uval; + FLAC__uint32 pattern; + + FLAC__ASSERT(0 != bb); + FLAC__ASSERT(0 != bb->buffer); + FLAC__ASSERT(parameter <= 30); + + /* fold signed to unsigned */ + if(val < 0) + /* equivalent to + * (unsigned)(((--val) << 1) - 1); + * but without the overflow problem at MININT + */ + uval = (unsigned)(((-(++val)) << 1) + 1); + else + uval = (unsigned)(val << 1); + + msbs = uval >> parameter; + interesting_bits = 1 + parameter; + total_bits = interesting_bits + msbs; + pattern = 1 << parameter; /* the unary end bit */ + pattern |= (uval & ((1<buffer); + FLAC__ASSERT(parameter <= 30); + + *overflow = false; + + /* fold signed to unsigned */ + if(val < 0) + /* equivalent to + * (unsigned)(((--val) << 1) - 1); + * but without the overflow problem at MININT + */ + uval = (unsigned)(((-(++val)) << 1) + 1); + else + uval = (unsigned)(val << 1); + + msbs = uval >> parameter; + interesting_bits = 1 + parameter; + total_bits = interesting_bits + msbs; + pattern = 1 << parameter; /* the unary end bit */ + pattern |= (uval & ((1< max_bits) { + *overflow = true; + return true; + } + else { + /* write the unary MSBs */ + if(!FLAC__bitbuffer_write_zeroes(bb, msbs)) + return false; + /* write the unary end bit and binary LSBs */ + if(!FLAC__bitbuffer_write_raw_uint32(bb, pattern, interesting_bits)) + return false; + } + return true; +} +#endif /* UNUSED */ + +#if 0 /* UNUSED */ +FLAC__bool FLAC__bitbuffer_write_golomb_signed(FLAC__BitBuffer *bb, int val, unsigned parameter) +{ + unsigned total_bits, msbs, uval; + unsigned k; + + FLAC__ASSERT(0 != bb); + FLAC__ASSERT(0 != bb->buffer); + FLAC__ASSERT(parameter > 0); + + /* fold signed to unsigned */ + if(val < 0) + /* equivalent to + * (unsigned)(((--val) << 1) - 1); + * but without the overflow problem at MININT + */ + uval = (unsigned)(((-(++val)) << 1) + 1); + else + uval = (unsigned)(val << 1); + + k = FLAC__bitmath_ilog2(parameter); + if(parameter == 1u<> k; + total_bits = 1 + k + msbs; + pattern = 1 << k; /* the unary end bit */ + pattern |= (uval & ((1u<= d) { + if(!FLAC__bitbuffer_write_raw_uint32(bb, r+d, k+1)) + return false; + } + else { + if(!FLAC__bitbuffer_write_raw_uint32(bb, r, k)) + return false; + } + } + return true; +} + +FLAC__bool FLAC__bitbuffer_write_golomb_unsigned(FLAC__BitBuffer *bb, unsigned uval, unsigned parameter) +{ + unsigned total_bits, msbs; + unsigned k; + + FLAC__ASSERT(0 != bb); + FLAC__ASSERT(0 != bb->buffer); + FLAC__ASSERT(parameter > 0); + + k = FLAC__bitmath_ilog2(parameter); + if(parameter == 1u<> k; + total_bits = 1 + k + msbs; + pattern = 1 << k; /* the unary end bit */ + pattern |= (uval & ((1u<= d) { + if(!FLAC__bitbuffer_write_raw_uint32(bb, r+d, k+1)) + return false; + } + else { + if(!FLAC__bitbuffer_write_raw_uint32(bb, r, k)) + return false; + } + } + return true; +} +#endif /* UNUSED */ + +FLAC__bool FLAC__bitbuffer_write_utf8_uint32(FLAC__BitBuffer *bb, FLAC__uint32 val) +{ + FLAC__bool ok = 1; + + FLAC__ASSERT(0 != bb); + FLAC__ASSERT(0 != bb->buffer); + + FLAC__ASSERT(!(val & 0x80000000)); /* this version only handles 31 bits */ + + if(val < 0x80) { + return FLAC__bitbuffer_write_raw_uint32(bb, val, 8); + } + else if(val < 0x800) { + ok &= FLAC__bitbuffer_write_raw_uint32(bb, 0xC0 | (val>>6), 8); + ok &= FLAC__bitbuffer_write_raw_uint32(bb, 0x80 | (val&0x3F), 8); + } + else if(val < 0x10000) { + ok &= FLAC__bitbuffer_write_raw_uint32(bb, 0xE0 | (val>>12), 8); + ok &= FLAC__bitbuffer_write_raw_uint32(bb, 0x80 | ((val>>6)&0x3F), 8); + ok &= FLAC__bitbuffer_write_raw_uint32(bb, 0x80 | (val&0x3F), 8); + } + else if(val < 0x200000) { + ok &= FLAC__bitbuffer_write_raw_uint32(bb, 0xF0 | (val>>18), 8); + ok &= FLAC__bitbuffer_write_raw_uint32(bb, 0x80 | ((val>>12)&0x3F), 8); + ok &= FLAC__bitbuffer_write_raw_uint32(bb, 0x80 | ((val>>6)&0x3F), 8); + ok &= FLAC__bitbuffer_write_raw_uint32(bb, 0x80 | (val&0x3F), 8); + } + else if(val < 0x4000000) { + ok &= FLAC__bitbuffer_write_raw_uint32(bb, 0xF8 | (val>>24), 8); + ok &= FLAC__bitbuffer_write_raw_uint32(bb, 0x80 | ((val>>18)&0x3F), 8); + ok &= FLAC__bitbuffer_write_raw_uint32(bb, 0x80 | ((val>>12)&0x3F), 8); + ok &= FLAC__bitbuffer_write_raw_uint32(bb, 0x80 | ((val>>6)&0x3F), 8); + ok &= FLAC__bitbuffer_write_raw_uint32(bb, 0x80 | (val&0x3F), 8); + } + else { + ok &= FLAC__bitbuffer_write_raw_uint32(bb, 0xFC | (val>>30), 8); + ok &= FLAC__bitbuffer_write_raw_uint32(bb, 0x80 | ((val>>24)&0x3F), 8); + ok &= FLAC__bitbuffer_write_raw_uint32(bb, 0x80 | ((val>>18)&0x3F), 8); + ok &= FLAC__bitbuffer_write_raw_uint32(bb, 0x80 | ((val>>12)&0x3F), 8); + ok &= FLAC__bitbuffer_write_raw_uint32(bb, 0x80 | ((val>>6)&0x3F), 8); + ok &= FLAC__bitbuffer_write_raw_uint32(bb, 0x80 | (val&0x3F), 8); + } + + return ok; +} + +FLAC__bool FLAC__bitbuffer_write_utf8_uint64(FLAC__BitBuffer *bb, FLAC__uint64 val) +{ + FLAC__bool ok = 1; + + FLAC__ASSERT(0 != bb); + FLAC__ASSERT(0 != bb->buffer); + + FLAC__ASSERT(!(val & FLAC__U64L(0xFFFFFFF000000000))); /* this version only handles 36 bits */ + + if(val < 0x80) { + return FLAC__bitbuffer_write_raw_uint32(bb, (FLAC__uint32)val, 8); + } + else if(val < 0x800) { + ok &= FLAC__bitbuffer_write_raw_uint32(bb, 0xC0 | (FLAC__uint32)(val>>6), 8); + ok &= FLAC__bitbuffer_write_raw_uint32(bb, 0x80 | (FLAC__uint32)(val&0x3F), 8); + } + else if(val < 0x10000) { + ok &= FLAC__bitbuffer_write_raw_uint32(bb, 0xE0 | (FLAC__uint32)(val>>12), 8); + ok &= FLAC__bitbuffer_write_raw_uint32(bb, 0x80 | (FLAC__uint32)((val>>6)&0x3F), 8); + ok &= FLAC__bitbuffer_write_raw_uint32(bb, 0x80 | (FLAC__uint32)(val&0x3F), 8); + } + else if(val < 0x200000) { + ok &= FLAC__bitbuffer_write_raw_uint32(bb, 0xF0 | (FLAC__uint32)(val>>18), 8); + ok &= FLAC__bitbuffer_write_raw_uint32(bb, 0x80 | (FLAC__uint32)((val>>12)&0x3F), 8); + ok &= FLAC__bitbuffer_write_raw_uint32(bb, 0x80 | (FLAC__uint32)((val>>6)&0x3F), 8); + ok &= FLAC__bitbuffer_write_raw_uint32(bb, 0x80 | (FLAC__uint32)(val&0x3F), 8); + } + else if(val < 0x4000000) { + ok &= FLAC__bitbuffer_write_raw_uint32(bb, 0xF8 | (FLAC__uint32)(val>>24), 8); + ok &= FLAC__bitbuffer_write_raw_uint32(bb, 0x80 | (FLAC__uint32)((val>>18)&0x3F), 8); + ok &= FLAC__bitbuffer_write_raw_uint32(bb, 0x80 | (FLAC__uint32)((val>>12)&0x3F), 8); + ok &= FLAC__bitbuffer_write_raw_uint32(bb, 0x80 | (FLAC__uint32)((val>>6)&0x3F), 8); + ok &= FLAC__bitbuffer_write_raw_uint32(bb, 0x80 | (FLAC__uint32)(val&0x3F), 8); + } + else if(val < 0x80000000) { + ok &= FLAC__bitbuffer_write_raw_uint32(bb, 0xFC | (FLAC__uint32)(val>>30), 8); + ok &= FLAC__bitbuffer_write_raw_uint32(bb, 0x80 | (FLAC__uint32)((val>>24)&0x3F), 8); + ok &= FLAC__bitbuffer_write_raw_uint32(bb, 0x80 | (FLAC__uint32)((val>>18)&0x3F), 8); + ok &= FLAC__bitbuffer_write_raw_uint32(bb, 0x80 | (FLAC__uint32)((val>>12)&0x3F), 8); + ok &= FLAC__bitbuffer_write_raw_uint32(bb, 0x80 | (FLAC__uint32)((val>>6)&0x3F), 8); + ok &= FLAC__bitbuffer_write_raw_uint32(bb, 0x80 | (FLAC__uint32)(val&0x3F), 8); + } + else { + ok &= FLAC__bitbuffer_write_raw_uint32(bb, 0xFE, 8); + ok &= FLAC__bitbuffer_write_raw_uint32(bb, 0x80 | (FLAC__uint32)((val>>30)&0x3F), 8); + ok &= FLAC__bitbuffer_write_raw_uint32(bb, 0x80 | (FLAC__uint32)((val>>24)&0x3F), 8); + ok &= FLAC__bitbuffer_write_raw_uint32(bb, 0x80 | (FLAC__uint32)((val>>18)&0x3F), 8); + ok &= FLAC__bitbuffer_write_raw_uint32(bb, 0x80 | (FLAC__uint32)((val>>12)&0x3F), 8); + ok &= FLAC__bitbuffer_write_raw_uint32(bb, 0x80 | (FLAC__uint32)((val>>6)&0x3F), 8); + ok &= FLAC__bitbuffer_write_raw_uint32(bb, 0x80 | (FLAC__uint32)(val&0x3F), 8); + } + + return ok; +} + +FLAC__bool FLAC__bitbuffer_zero_pad_to_byte_boundary(FLAC__BitBuffer *bb) +{ + /* 0-pad to byte boundary */ + if(bb->bits & 7u) + return FLAC__bitbuffer_write_zeroes(bb, 8 - (bb->bits & 7u)); + else + return true; +} + +FLAC__bool FLAC__bitbuffer_peek_bit(FLAC__BitBuffer *bb, unsigned *val, FLAC__bool (*read_callback)(FLAC__byte buffer[], unsigned *bytes, void *client_data), void *client_data) +{ + /* to avoid a drastic speed penalty we don't: + FLAC__ASSERT(0 != bb); + FLAC__ASSERT(0 != bb->buffer); + FLAC__ASSERT(bb->bits == 0); + */ + + while(1) { + if(bb->total_consumed_bits < bb->total_bits) { + *val = (bb->buffer[bb->consumed_blurbs] & BLURB_BIT_TO_MASK(bb->consumed_bits))? 1 : 0; + return true; + } + else { + if(!bitbuffer_read_from_client_(bb, read_callback, client_data)) + return false; + } + } +} + +FLAC__bool FLAC__bitbuffer_read_bit(FLAC__BitBuffer *bb, unsigned *val, FLAC__bool (*read_callback)(FLAC__byte buffer[], unsigned *bytes, void *client_data), void *client_data) +{ + /* to avoid a drastic speed penalty we don't: + FLAC__ASSERT(0 != bb); + FLAC__ASSERT(0 != bb->buffer); + FLAC__ASSERT(bb->bits == 0); + */ + + while(1) { + if(bb->total_consumed_bits < bb->total_bits) { + *val = (bb->buffer[bb->consumed_blurbs] & BLURB_BIT_TO_MASK(bb->consumed_bits))? 1 : 0; + bb->consumed_bits++; + if(bb->consumed_bits == FLAC__BITS_PER_BLURB) { + CRC16_UPDATE_BLURB(bb, bb->buffer[bb->consumed_blurbs], bb->read_crc16); + bb->consumed_blurbs++; + bb->consumed_bits = 0; + } + bb->total_consumed_bits++; + return true; + } + else { + if(!bitbuffer_read_from_client_(bb, read_callback, client_data)) + return false; + } + } +} + +FLAC__bool FLAC__bitbuffer_read_bit_to_uint32(FLAC__BitBuffer *bb, FLAC__uint32 *val, FLAC__bool (*read_callback)(FLAC__byte buffer[], unsigned *bytes, void *client_data), void *client_data) +{ + /* to avoid a drastic speed penalty we don't: + FLAC__ASSERT(0 != bb); + FLAC__ASSERT(0 != bb->buffer); + FLAC__ASSERT(bb->bits == 0); + */ + + while(1) { + if(bb->total_consumed_bits < bb->total_bits) { + *val <<= 1; + *val |= (bb->buffer[bb->consumed_blurbs] & BLURB_BIT_TO_MASK(bb->consumed_bits))? 1 : 0; + bb->consumed_bits++; + if(bb->consumed_bits == FLAC__BITS_PER_BLURB) { + CRC16_UPDATE_BLURB(bb, bb->buffer[bb->consumed_blurbs], bb->read_crc16); + bb->consumed_blurbs++; + bb->consumed_bits = 0; + } + bb->total_consumed_bits++; + return true; + } + else { + if(!bitbuffer_read_from_client_(bb, read_callback, client_data)) + return false; + } + } +} + +FLAC__bool FLAC__bitbuffer_read_bit_to_uint64(FLAC__BitBuffer *bb, FLAC__uint64 *val, FLAC__bool (*read_callback)(FLAC__byte buffer[], unsigned *bytes, void *client_data), void *client_data) +{ + /* to avoid a drastic speed penalty we don't: + FLAC__ASSERT(0 != bb); + FLAC__ASSERT(0 != bb->buffer); + FLAC__ASSERT(bb->bits == 0); + */ + + while(1) { + if(bb->total_consumed_bits < bb->total_bits) { + *val <<= 1; + *val |= (bb->buffer[bb->consumed_blurbs] & BLURB_BIT_TO_MASK(bb->consumed_bits))? 1 : 0; + bb->consumed_bits++; + if(bb->consumed_bits == FLAC__BITS_PER_BLURB) { + CRC16_UPDATE_BLURB(bb, bb->buffer[bb->consumed_blurbs], bb->read_crc16); + bb->consumed_blurbs++; + bb->consumed_bits = 0; + } + bb->total_consumed_bits++; + return true; + } + else { + if(!bitbuffer_read_from_client_(bb, read_callback, client_data)) + return false; + } + } +} + +FLaC__INLINE FLAC__bool FLAC__bitbuffer_read_raw_uint32(FLAC__BitBuffer *bb, FLAC__uint32 *val, const unsigned bits, FLAC__bool (*read_callback)(FLAC__byte buffer[], unsigned *bytes, void *client_data), void *client_data) +#ifdef FLAC__NO_MANUAL_INLINING +{ + unsigned i; + + FLAC__ASSERT(0 != bb); + FLAC__ASSERT(0 != bb->buffer); + + FLAC__ASSERT(bits <= 32); + + *val = 0; + for(i = 0; i < bits; i++) { + if(!FLAC__bitbuffer_read_bit_to_uint32(bb, val, read_callback, client_data)) + return false; + } + return true; +} +#else +{ + unsigned i, bits_ = bits; + FLAC__uint32 v = 0; + + FLAC__ASSERT(0 != bb); + FLAC__ASSERT(0 != bb->buffer); + + FLAC__ASSERT(bits <= 32); + FLAC__ASSERT((bb->capacity*FLAC__BITS_PER_BLURB) * 2 >= bits); + + if(bits == 0) { + *val = 0; + return true; + } + + while(bb->total_consumed_bits + bits > bb->total_bits) { + if(!bitbuffer_read_from_client_(bb, read_callback, client_data)) + return false; + } +#if FLAC__BITS_PER_BLURB > 8 + if(bb->bits == 0 || bb->consumed_blurbs < bb->blurbs) { /*@@@ comment on why this is here*/ +#endif + if(bb->consumed_bits) { + i = FLAC__BITS_PER_BLURB - bb->consumed_bits; + if(i <= bits_) { + v = bb->buffer[bb->consumed_blurbs] & (FLAC__BLURB_ALL_ONES >> bb->consumed_bits); + bits_ -= i; + CRC16_UPDATE_BLURB(bb, bb->buffer[bb->consumed_blurbs], bb->read_crc16); + bb->consumed_blurbs++; + bb->consumed_bits = 0; + /* we hold off updating bb->total_consumed_bits until the end */ + } + else { + *val = (bb->buffer[bb->consumed_blurbs] & (FLAC__BLURB_ALL_ONES >> bb->consumed_bits)) >> (i-bits_); + bb->consumed_bits += bits_; + bb->total_consumed_bits += bits_; + return true; + } + } +#if FLAC__BITS_PER_BLURB == 32 + /* note that we know bits_ cannot be > 32 because of previous assertions */ + if(bits_ == FLAC__BITS_PER_BLURB) { + v = bb->buffer[bb->consumed_blurbs]; + CRC16_UPDATE_BLURB(bb, v, bb->read_crc16); + bb->consumed_blurbs++; + /* bb->consumed_bits is already 0 */ + bb->total_consumed_bits += bits; + *val = v; + return true; + } +#else + while(bits_ >= FLAC__BITS_PER_BLURB) { + v <<= FLAC__BITS_PER_BLURB; + v |= bb->buffer[bb->consumed_blurbs]; + bits_ -= FLAC__BITS_PER_BLURB; + CRC16_UPDATE_BLURB(bb, bb->buffer[bb->consumed_blurbs], bb->read_crc16); + bb->consumed_blurbs++; + /* bb->consumed_bits is already 0 */ + /* we hold off updating bb->total_consumed_bits until the end */ + } +#endif + if(bits_ > 0) { + v <<= bits_; + v |= (bb->buffer[bb->consumed_blurbs] >> (FLAC__BITS_PER_BLURB-bits_)); + bb->consumed_bits = bits_; + /* we hold off updating bb->total_consumed_bits until the end */ + } + bb->total_consumed_bits += bits; + *val = v; +#if FLAC__BITS_PER_BLURB > 8 + } + else { + *val = 0; + for(i = 0; i < bits; i++) { + if(!FLAC__bitbuffer_read_bit_to_uint32(bb, val, read_callback, client_data)) + return false; + } + } +#endif + return true; +} +#endif + +FLAC__bool FLAC__bitbuffer_read_raw_int32(FLAC__BitBuffer *bb, FLAC__int32 *val, const unsigned bits, FLAC__bool (*read_callback)(FLAC__byte buffer[], unsigned *bytes, void *client_data), void *client_data) +#ifdef FLAC__NO_MANUAL_INLINING +{ + unsigned i; + FLAC__uint32 v; + + FLAC__ASSERT(0 != bb); + FLAC__ASSERT(0 != bb->buffer); + + FLAC__ASSERT(bits <= 32); + + if(bits == 0) { + *val = 0; + return true; + } + + v = 0; + for(i = 0; i < bits; i++) { + if(!FLAC__bitbuffer_read_bit_to_uint32(bb, &v, read_callback, client_data)) + return false; + } + + /* fix the sign */ + i = 32 - bits; + if(i) { + v <<= i; + *val = (FLAC__int32)v; + *val >>= i; + } + else + *val = (FLAC__int32)v; + + return true; +} +#else +{ + unsigned i, bits_ = bits; + FLAC__uint32 v = 0; + + FLAC__ASSERT(0 != bb); + FLAC__ASSERT(0 != bb->buffer); + + FLAC__ASSERT(bits <= 32); + FLAC__ASSERT((bb->capacity*FLAC__BITS_PER_BLURB) * 2 >= bits); + + if(bits == 0) { + *val = 0; + return true; + } + + while(bb->total_consumed_bits + bits > bb->total_bits) { + if(!bitbuffer_read_from_client_(bb, read_callback, client_data)) + return false; + } +#if FLAC__BITS_PER_BLURB > 8 + if(bb->bits == 0 || bb->consumed_blurbs < bb->blurbs) { /*@@@ comment on why this is here*/ +#endif + if(bb->consumed_bits) { + i = FLAC__BITS_PER_BLURB - bb->consumed_bits; + if(i <= bits_) { + v = bb->buffer[bb->consumed_blurbs] & (FLAC__BLURB_ALL_ONES >> bb->consumed_bits); + bits_ -= i; + CRC16_UPDATE_BLURB(bb, bb->buffer[bb->consumed_blurbs], bb->read_crc16); + bb->consumed_blurbs++; + bb->consumed_bits = 0; + /* we hold off updating bb->total_consumed_bits until the end */ + } + else { + /* bits_ must be < FLAC__BITS_PER_BLURB-1 if we get to here */ + v = (bb->buffer[bb->consumed_blurbs] & (FLAC__BLURB_ALL_ONES >> bb->consumed_bits)); + v <<= (32-i); + *val = (FLAC__int32)v; + *val >>= (32-bits_); + bb->consumed_bits += bits_; + bb->total_consumed_bits += bits_; + return true; + } + } +#if FLAC__BITS_PER_BLURB == 32 + /* note that we know bits_ cannot be > 32 because of previous assertions */ + if(bits_ == FLAC__BITS_PER_BLURB) { + v = bb->buffer[bb->consumed_blurbs]; + bits_ = 0; + CRC16_UPDATE_BLURB(bb, v, bb->read_crc16); + bb->consumed_blurbs++; + /* bb->consumed_bits is already 0 */ + /* we hold off updating bb->total_consumed_bits until the end */ + } +#else + while(bits_ >= FLAC__BITS_PER_BLURB) { + v <<= FLAC__BITS_PER_BLURB; + v |= bb->buffer[bb->consumed_blurbs]; + bits_ -= FLAC__BITS_PER_BLURB; + CRC16_UPDATE_BLURB(bb, bb->buffer[bb->consumed_blurbs], bb->read_crc16); + bb->consumed_blurbs++; + /* bb->consumed_bits is already 0 */ + /* we hold off updating bb->total_consumed_bits until the end */ + } +#endif + if(bits_ > 0) { + v <<= bits_; + v |= (bb->buffer[bb->consumed_blurbs] >> (FLAC__BITS_PER_BLURB-bits_)); + bb->consumed_bits = bits_; + /* we hold off updating bb->total_consumed_bits until the end */ + } + bb->total_consumed_bits += bits; +#if FLAC__BITS_PER_BLURB > 8 + } + else { + for(i = 0; i < bits; i++) { + if(!FLAC__bitbuffer_read_bit_to_uint32(bb, &v, read_callback, client_data)) + return false; + } + } +#endif + + /* fix the sign */ + i = 32 - bits; + if(i) { + v <<= i; + *val = (FLAC__int32)v; + *val >>= i; + } + else + *val = (FLAC__int32)v; + + return true; +} +#endif + +FLAC__bool FLAC__bitbuffer_read_raw_uint64(FLAC__BitBuffer *bb, FLAC__uint64 *val, const unsigned bits, FLAC__bool (*read_callback)(FLAC__byte buffer[], unsigned *bytes, void *client_data), void *client_data) +#ifdef FLAC__NO_MANUAL_INLINING +{ + unsigned i; + + FLAC__ASSERT(0 != bb); + FLAC__ASSERT(0 != bb->buffer); + + FLAC__ASSERT(bits <= 64); + + *val = 0; + for(i = 0; i < bits; i++) { + if(!FLAC__bitbuffer_read_bit_to_uint64(bb, val, read_callback, client_data)) + return false; + } + return true; +} +#else +{ + unsigned i, bits_ = bits; + FLAC__uint64 v = 0; + + FLAC__ASSERT(0 != bb); + FLAC__ASSERT(0 != bb->buffer); + + FLAC__ASSERT(bits <= 64); + FLAC__ASSERT((bb->capacity*FLAC__BITS_PER_BLURB) * 2 >= bits); + + if(bits == 0) { + *val = 0; + return true; + } + + while(bb->total_consumed_bits + bits > bb->total_bits) { + if(!bitbuffer_read_from_client_(bb, read_callback, client_data)) + return false; + } +#if FLAC__BITS_PER_BLURB > 8 + if(bb->bits == 0 || bb->consumed_blurbs < bb->blurbs) { /*@@@ comment on why this is here*/ +#endif + if(bb->consumed_bits) { + i = FLAC__BITS_PER_BLURB - bb->consumed_bits; + if(i <= bits_) { + v = bb->buffer[bb->consumed_blurbs] & (FLAC__BLURB_ALL_ONES >> bb->consumed_bits); + bits_ -= i; + CRC16_UPDATE_BLURB(bb, bb->buffer[bb->consumed_blurbs], bb->read_crc16); + bb->consumed_blurbs++; + bb->consumed_bits = 0; + /* we hold off updating bb->total_consumed_bits until the end */ + } + else { + *val = (bb->buffer[bb->consumed_blurbs] & (FLAC__BLURB_ALL_ONES >> bb->consumed_bits)) >> (i-bits_); + bb->consumed_bits += bits_; + bb->total_consumed_bits += bits_; + return true; + } + } + while(bits_ >= FLAC__BITS_PER_BLURB) { + v <<= FLAC__BITS_PER_BLURB; + v |= bb->buffer[bb->consumed_blurbs]; + bits_ -= FLAC__BITS_PER_BLURB; + CRC16_UPDATE_BLURB(bb, bb->buffer[bb->consumed_blurbs], bb->read_crc16); + bb->consumed_blurbs++; + /* bb->consumed_bits is already 0 */ + /* we hold off updating bb->total_consumed_bits until the end */ + } + if(bits_ > 0) { + v <<= bits_; + v |= (bb->buffer[bb->consumed_blurbs] >> (FLAC__BITS_PER_BLURB-bits_)); + bb->consumed_bits = bits_; + /* we hold off updating bb->total_consumed_bits until the end */ + } + bb->total_consumed_bits += bits; + *val = v; +#if FLAC__BITS_PER_BLURB > 8 + } + else { + *val = 0; + for(i = 0; i < bits; i++) { + if(!FLAC__bitbuffer_read_bit_to_uint64(bb, val, read_callback, client_data)) + return false; + } + } +#endif + return true; +} +#endif + +#if 0 /* UNUSED */ +FLAC__bool FLAC__bitbuffer_read_raw_int64(FLAC__BitBuffer *bb, FLAC__int64 *val, const unsigned bits, FLAC__bool (*read_callback)(FLAC__byte buffer[], unsigned *bytes, void *client_data), void *client_data) +#ifdef FLAC__NO_MANUAL_INLINING +{ + unsigned i; + FLAC__uint64 v; + + FLAC__ASSERT(0 != bb); + FLAC__ASSERT(0 != bb->buffer); + + FLAC__ASSERT(bits <= 64); + + v = 0; + for(i = 0; i < bits; i++) { + if(!FLAC__bitbuffer_read_bit_to_uint64(bb, &v, read_callback, client_data)) + return false; + } + /* fix the sign */ + i = 64 - bits; + if(i) { + v <<= i; + *val = (FLAC__int64)v; + *val >>= i; + } + else + *val = (FLAC__int64)v; + + return true; +} +#else +{ + unsigned i, bits_ = bits; + FLAC__uint64 v = 0; + + FLAC__ASSERT(0 != bb); + FLAC__ASSERT(0 != bb->buffer); + + FLAC__ASSERT(bits <= 64); + FLAC__ASSERT((bb->capacity*FLAC__BITS_PER_BLURB) * 2 >= bits); + + if(bits == 0) { + *val = 0; + return true; + } + + while(bb->total_consumed_bits + bits > bb->total_bits) { + if(!bitbuffer_read_from_client_(bb, read_callback, client_data)) + return false; + } +#if FLAC__BITS_PER_BLURB > 8 + if(bb->bits == 0 || bb->consumed_blurbs < bb->blurbs) { /*@@@ comment on why this is here*/ +#endif + if(bb->consumed_bits) { + i = FLAC__BITS_PER_BLURB - bb->consumed_bits; + if(i <= bits_) { + v = bb->buffer[bb->consumed_blurbs] & (FLAC__BLURB_ALL_ONES >> bb->consumed_bits); + bits_ -= i; + CRC16_UPDATE_BLURB(bb, bb->buffer[bb->consumed_blurbs], bb->read_crc16); + bb->consumed_blurbs++; + bb->consumed_bits = 0; + /* we hold off updating bb->total_consumed_bits until the end */ + } + else { + /* bits_ must be < FLAC__BITS_PER_BLURB-1 if we get to here */ + v = (bb->buffer[bb->consumed_blurbs] & (FLAC__BLURB_ALL_ONES >> bb->consumed_bits)); + v <<= (64-i); + *val = (FLAC__int64)v; + *val >>= (64-bits_); + bb->consumed_bits += bits_; + bb->total_consumed_bits += bits_; + return true; + } + } + while(bits_ >= FLAC__BITS_PER_BLURB) { + v <<= FLAC__BITS_PER_BLURB; + v |= bb->buffer[bb->consumed_blurbs]; + bits_ -= FLAC__BITS_PER_BLURB; + CRC16_UPDATE_BLURB(bb, bb->buffer[bb->consumed_blurbs], bb->read_crc16); + bb->consumed_blurbs++; + /* bb->consumed_bits is already 0 */ + /* we hold off updating bb->total_consumed_bits until the end */ + } + if(bits_ > 0) { + v <<= bits_; + v |= (bb->buffer[bb->consumed_blurbs] >> (FLAC__BITS_PER_BLURB-bits_)); + bb->consumed_bits = bits_; + /* we hold off updating bb->total_consumed_bits until the end */ + } + bb->total_consumed_bits += bits; +#if FLAC__BITS_PER_BLURB > 8 + } + else { + for(i = 0; i < bits; i++) { + if(!FLAC__bitbuffer_read_bit_to_uint64(bb, &v, read_callback, client_data)) + return false; + } + } +#endif + + /* fix the sign */ + i = 64 - bits; + if(i) { + v <<= i; + *val = (FLAC__int64)v; + *val >>= i; + } + else + *val = (FLAC__int64)v; + + return true; +} +#endif +#endif + +FLaC__INLINE FLAC__bool FLAC__bitbuffer_read_raw_uint32_little_endian(FLAC__BitBuffer *bb, FLAC__uint32 *val, FLAC__bool (*read_callback)(FLAC__byte buffer[], unsigned *bytes, void *client_data), void *client_data) +{ + FLAC__uint32 x8, x32 = 0; + + /* this doesn't need to be that fast as currently it is only used for vorbis comments */ + + if(!FLAC__bitbuffer_read_raw_uint32(bb, &x32, 8, read_callback, client_data)) + return false; + + if(!FLAC__bitbuffer_read_raw_uint32(bb, &x8, 8, read_callback, client_data)) + return false; + x32 |= (x8 << 8); + + if(!FLAC__bitbuffer_read_raw_uint32(bb, &x8, 8, read_callback, client_data)) + return false; + x32 |= (x8 << 16); + + if(!FLAC__bitbuffer_read_raw_uint32(bb, &x8, 8, read_callback, client_data)) + return false; + x32 |= (x8 << 24); + + *val = x32; + return true; +} + +FLAC__bool FLAC__bitbuffer_skip_bits_no_crc(FLAC__BitBuffer *bb, unsigned bits, FLAC__bool (*read_callback)(FLAC__byte buffer[], unsigned *bytes, void *client_data), void *client_data) +{ + /* + * @@@ a slightly faster implementation is possible but + * probably not that useful since this is only called a + * couple of times in the metadata readers. + */ + FLAC__ASSERT(0 != bb); + FLAC__ASSERT(0 != bb->buffer); + + if(bits > 0) { + const unsigned n = bb->consumed_bits & 7; + unsigned m; + FLAC__uint32 x; + + if(n != 0) { + m = min(8-n, bits); + if(!FLAC__bitbuffer_read_raw_uint32(bb, &x, m, read_callback, client_data)) + return false; + bits -= m; + } + m = bits / 8; + if(m > 0) { + if(!FLAC__bitbuffer_read_byte_block_aligned_no_crc(bb, 0, m, read_callback, client_data)) + return false; + bits %= 8; + } + if(bits > 0) { + if(!FLAC__bitbuffer_read_raw_uint32(bb, &x, bits, read_callback, client_data)) + return false; + } + } + + return true; +} + +FLAC__bool FLAC__bitbuffer_read_byte_block_aligned_no_crc(FLAC__BitBuffer *bb, FLAC__byte *val, unsigned nvals, FLAC__bool (*read_callback)(FLAC__byte buffer[], unsigned *bytes, void *client_data), void *client_data) +{ + FLAC__ASSERT(0 != bb); + FLAC__ASSERT(0 != bb->buffer); + FLAC__ASSERT(FLAC__bitbuffer_is_byte_aligned(bb)); + FLAC__ASSERT(FLAC__bitbuffer_is_consumed_byte_aligned(bb)); +#if FLAC__BITS_PER_BLURB == 8 + while(nvals > 0) { + unsigned chunk = min(nvals, bb->blurbs - bb->consumed_blurbs); + if(chunk == 0) { + if(!bitbuffer_read_from_client_(bb, read_callback, client_data)) + return false; + } + else { + if(0 != val) { + memcpy(val, bb->buffer + bb->consumed_blurbs, FLAC__BYTES_PER_BLURB * chunk); + val += FLAC__BYTES_PER_BLURB * chunk; + } + nvals -= chunk; + bb->consumed_blurbs += chunk; + bb->total_consumed_bits = (bb->consumed_blurbs << FLAC__BITS_PER_BLURB_LOG2); + } + } +#else + @@@ need to write this still + FLAC__ASSERT(0); +#endif + + return true; +} + +FLaC__INLINE FLAC__bool FLAC__bitbuffer_read_unary_unsigned(FLAC__BitBuffer *bb, unsigned *val, FLAC__bool (*read_callback)(FLAC__byte buffer[], unsigned *bytes, void *client_data), void *client_data) +#ifdef FLAC__NO_MANUAL_INLINING +{ + unsigned bit, val_ = 0; + + FLAC__ASSERT(0 != bb); + FLAC__ASSERT(0 != bb->buffer); + + while(1) { + if(!FLAC__bitbuffer_read_bit(bb, &bit, read_callback, client_data)) + return false; + if(bit) + break; + else + val_++; + } + *val = val_; + return true; +} +#else +{ + unsigned i, val_ = 0; + unsigned total_blurbs_ = (bb->total_bits + (FLAC__BITS_PER_BLURB-1)) / FLAC__BITS_PER_BLURB; + FLAC__blurb b; + + FLAC__ASSERT(0 != bb); + FLAC__ASSERT(0 != bb->buffer); + +#if FLAC__BITS_PER_BLURB > 8 + if(bb->bits == 0 || bb->consumed_blurbs < bb->blurbs) { /*@@@ comment on why this is here*/ +#endif + if(bb->consumed_bits) { + b = bb->buffer[bb->consumed_blurbs] << bb->consumed_bits; + if(b) { + for(i = 0; !(b & FLAC__BLURB_TOP_BIT_ONE); i++) + b <<= 1; + *val = i; + i++; + bb->consumed_bits += i; + bb->total_consumed_bits += i; + if(bb->consumed_bits == FLAC__BITS_PER_BLURB) { + CRC16_UPDATE_BLURB(bb, bb->buffer[bb->consumed_blurbs], bb->read_crc16); + bb->consumed_blurbs++; + bb->consumed_bits = 0; + } + return true; + } + else { + val_ = FLAC__BITS_PER_BLURB - bb->consumed_bits; + CRC16_UPDATE_BLURB(bb, bb->buffer[bb->consumed_blurbs], bb->read_crc16); + bb->consumed_blurbs++; + bb->consumed_bits = 0; + bb->total_consumed_bits += val_; + } + } + while(1) { + if(bb->consumed_blurbs >= total_blurbs_) { + if(!bitbuffer_read_from_client_(bb, read_callback, client_data)) + return false; + total_blurbs_ = (bb->total_bits + (FLAC__BITS_PER_BLURB-1)) / FLAC__BITS_PER_BLURB; + } + b = bb->buffer[bb->consumed_blurbs]; + if(b) { + for(i = 0; !(b & FLAC__BLURB_TOP_BIT_ONE); i++) + b <<= 1; + val_ += i; + i++; + bb->consumed_bits = i; + *val = val_; + if(i == FLAC__BITS_PER_BLURB) { + CRC16_UPDATE_BLURB(bb, bb->buffer[bb->consumed_blurbs], bb->read_crc16); + bb->consumed_blurbs++; + bb->consumed_bits = 0; + } + bb->total_consumed_bits += i; + return true; + } + else { + val_ += FLAC__BITS_PER_BLURB; + CRC16_UPDATE_BLURB(bb, 0, bb->read_crc16); + bb->consumed_blurbs++; + /* bb->consumed_bits is already 0 */ + bb->total_consumed_bits += FLAC__BITS_PER_BLURB; + } + } +#if FLAC__BITS_PER_BLURB > 8 + } + else { + while(1) { + if(!FLAC__bitbuffer_read_bit(bb, &i, read_callback, client_data)) + return false; + if(i) + break; + else + val_++; + } + *val = val_; + return true; + } +#endif +} +#endif + +#ifdef FLAC__SYMMETRIC_RICE +FLAC__bool FLAC__bitbuffer_read_symmetric_rice_signed(FLAC__BitBuffer *bb, int *val, unsigned parameter, FLAC__bool (*read_callback)(FLAC__byte buffer[], unsigned *bytes, void *client_data), void *client_data) +{ + FLAC__uint32 sign = 0, lsbs = 0, msbs = 0; + + FLAC__ASSERT(0 != bb); + FLAC__ASSERT(0 != bb->buffer); + FLAC__ASSERT(parameter <= 31); + + /* read the unary MSBs and end bit */ + if(!FLAC__bitbuffer_read_unary_unsigned(bb, &msbs, read_callback, client_data)) + return false; + + /* read the sign bit */ + if(!FLAC__bitbuffer_read_bit_to_uint32(bb, &sign, read_callback, client_data)) + return false; + + /* read the binary LSBs */ + if(!FLAC__bitbuffer_read_raw_uint32(bb, &lsbs, parameter, read_callback, client_data)) + return false; + + /* compose the value */ + *val = (msbs << parameter) | lsbs; + if(sign) + *val = -(*val); + + return true; +} +#endif /* ifdef FLAC__SYMMETRIC_RICE */ + +FLAC__bool FLAC__bitbuffer_read_rice_signed(FLAC__BitBuffer *bb, int *val, unsigned parameter, FLAC__bool (*read_callback)(FLAC__byte buffer[], unsigned *bytes, void *client_data), void *client_data) +{ + FLAC__uint32 lsbs = 0, msbs = 0; + unsigned uval; + + FLAC__ASSERT(0 != bb); + FLAC__ASSERT(0 != bb->buffer); + FLAC__ASSERT(parameter <= 31); + + /* read the unary MSBs and end bit */ + if(!FLAC__bitbuffer_read_unary_unsigned(bb, &msbs, read_callback, client_data)) + return false; + + /* read the binary LSBs */ + if(!FLAC__bitbuffer_read_raw_uint32(bb, &lsbs, parameter, read_callback, client_data)) + return false; + + /* compose the value */ + uval = (msbs << parameter) | lsbs; + if(uval & 1) + *val = -((int)(uval >> 1)) - 1; + else + *val = (int)(uval >> 1); + + return true; +} + +FLAC__bool FLAC__bitbuffer_read_rice_signed_block(FLAC__BitBuffer *bb, int vals[], unsigned nvals, unsigned parameter, FLAC__bool (*read_callback)(FLAC__byte buffer[], unsigned *bytes, void *client_data), void *client_data) +#ifdef FLAC__OLD_MSVC_FLAVOR +{ + const FLAC__blurb *buffer = bb->buffer; + + unsigned i, j, val_i = 0; + unsigned cbits = 0, uval = 0, msbs = 0, lsbs_left = 0; + FLAC__blurb blurb, save_blurb; + unsigned state = 0; /* 0 = getting unary MSBs, 1 = getting binary LSBs */ + + FLAC__ASSERT(0 != bb); + FLAC__ASSERT(0 != bb->buffer); + FLAC__ASSERT(parameter <= 31); + + if(nvals == 0) + return true; + + i = bb->consumed_blurbs; + /* + * We unroll the main loop to take care of partially consumed blurbs here. + */ + if(bb->consumed_bits > 0) { + save_blurb = blurb = buffer[i]; + cbits = bb->consumed_bits; + blurb <<= cbits; + + while(1) { + if(state == 0) { + if(blurb) { + for(j = 0; !(blurb & FLAC__BLURB_TOP_BIT_ONE); j++) + blurb <<= 1; + msbs += j; + + /* dispose of the unary end bit */ + blurb <<= 1; + j++; + cbits += j; + + uval = 0; + lsbs_left = parameter; + state++; + if(cbits == FLAC__BITS_PER_BLURB) { + cbits = 0; + CRC16_UPDATE_BLURB(bb, save_blurb, bb->read_crc16); + break; + } + } + else { + msbs += FLAC__BITS_PER_BLURB - cbits; + cbits = 0; + CRC16_UPDATE_BLURB(bb, save_blurb, bb->read_crc16); + break; + } + } + else { + const unsigned available_bits = FLAC__BITS_PER_BLURB - cbits; + if(lsbs_left >= available_bits) { + uval <<= available_bits; + uval |= (blurb >> cbits); + cbits = 0; + CRC16_UPDATE_BLURB(bb, save_blurb, bb->read_crc16); + + if(lsbs_left == available_bits) { + /* compose the value */ + uval |= (msbs << parameter); + if(uval & 1) + vals[val_i++] = -((int)(uval >> 1)) - 1; + else + vals[val_i++] = (int)(uval >> 1); + if(val_i == nvals) + break; + + msbs = 0; + state = 0; + } + + lsbs_left -= available_bits; + break; + } + else { + uval <<= lsbs_left; + uval |= (blurb >> (FLAC__BITS_PER_BLURB - lsbs_left)); + blurb <<= lsbs_left; + cbits += lsbs_left; + + /* compose the value */ + uval |= (msbs << parameter); + if(uval & 1) + vals[val_i++] = -((int)(uval >> 1)) - 1; + else + vals[val_i++] = (int)(uval >> 1); + if(val_i == nvals) { + /* back up one if we exited the for loop because we read all nvals but the end came in the middle of a blurb */ + i--; + break; + } + + msbs = 0; + state = 0; + } + } + } + i++; + + bb->consumed_blurbs = i; + bb->consumed_bits = cbits; + bb->total_consumed_bits = (i << FLAC__BITS_PER_BLURB_LOG2) | cbits; + } + + /* + * Now that we are blurb-aligned the logic is slightly simpler + */ + while(val_i < nvals) { + for( ; i < bb->blurbs && val_i < nvals; i++) { + save_blurb = blurb = buffer[i]; + cbits = 0; + while(1) { + if(state == 0) { + if(blurb) { + for(j = 0; !(blurb & FLAC__BLURB_TOP_BIT_ONE); j++) + blurb <<= 1; + msbs += j; + + /* dispose of the unary end bit */ + blurb <<= 1; + j++; + cbits += j; + + uval = 0; + lsbs_left = parameter; + state++; + if(cbits == FLAC__BITS_PER_BLURB) { + cbits = 0; + CRC16_UPDATE_BLURB(bb, save_blurb, bb->read_crc16); + break; + } + } + else { + msbs += FLAC__BITS_PER_BLURB - cbits; + cbits = 0; + CRC16_UPDATE_BLURB(bb, save_blurb, bb->read_crc16); + break; + } + } + else { + const unsigned available_bits = FLAC__BITS_PER_BLURB - cbits; + if(lsbs_left >= available_bits) { + uval <<= available_bits; + uval |= (blurb >> cbits); + cbits = 0; + CRC16_UPDATE_BLURB(bb, save_blurb, bb->read_crc16); + + if(lsbs_left == available_bits) { + /* compose the value */ + uval |= (msbs << parameter); + if(uval & 1) + vals[val_i++] = -((int)(uval >> 1)) - 1; + else + vals[val_i++] = (int)(uval >> 1); + if(val_i == nvals) + break; + + msbs = 0; + state = 0; + } + + lsbs_left -= available_bits; + break; + } + else { + uval <<= lsbs_left; + uval |= (blurb >> (FLAC__BITS_PER_BLURB - lsbs_left)); + blurb <<= lsbs_left; + cbits += lsbs_left; + + /* compose the value */ + uval |= (msbs << parameter); + if(uval & 1) + vals[val_i++] = -((int)(uval >> 1)) - 1; + else + vals[val_i++] = (int)(uval >> 1); + if(val_i == nvals) { + /* back up one if we exited the for loop because we read all nvals but the end came in the middle of a blurb */ + i--; + break; + } + + msbs = 0; + state = 0; + } + } + } + } + bb->consumed_blurbs = i; + bb->consumed_bits = cbits; + bb->total_consumed_bits = (i << FLAC__BITS_PER_BLURB_LOG2) | cbits; + if(val_i < nvals) { + if(!bitbuffer_read_from_client_(bb, read_callback, client_data)) + return false; + /* these must be zero because we can only get here if we got to the end of the buffer */ + FLAC__ASSERT(bb->consumed_blurbs == 0); + FLAC__ASSERT(bb->consumed_bits == 0); + i = 0; + } + } + + return true; +} +#else +{ + const FLAC__blurb *buffer = bb->buffer; + + unsigned i, j, val_i = nvals; + unsigned cbits = 0, uval = 0, msbs = 0, lsbs_left = 0; + FLAC__blurb blurb, save_blurb; + unsigned state = 0; /* 0 = getting unary MSBs, 1 = getting binary LSBs */ + + FLAC__ASSERT(0 != bb); + FLAC__ASSERT(0 != bb->buffer); + FLAC__ASSERT(parameter <= 31); + + if(nvals == 0) + return true; + + cbits = bb->consumed_bits; + i = bb->consumed_blurbs; + while(val_i != 0) { + for( ; i < bb->blurbs; i++) { + blurb = (save_blurb = buffer[i]) << cbits; + while(1) { + if(state == 0) { + if(blurb) { + j = FLAC__ALIGNED_BLURB_UNARY(blurb); + msbs += j; + j++; + cbits += j; + + uval = 0; + lsbs_left = parameter; + state++; + if(cbits == FLAC__BITS_PER_BLURB) { + cbits = 0; + CRC16_UPDATE_BLURB(bb, save_blurb, bb->read_crc16); + break; + } + blurb <<= j; + } + else { + msbs += FLAC__BITS_PER_BLURB - cbits; + cbits = 0; + CRC16_UPDATE_BLURB(bb, save_blurb, bb->read_crc16); + break; + } + } + else { + const unsigned available_bits = FLAC__BITS_PER_BLURB - cbits; + if(lsbs_left >= available_bits) { + uval <<= available_bits; + uval |= (blurb >> cbits); + cbits = 0; + CRC16_UPDATE_BLURB(bb, save_blurb, bb->read_crc16); + + if(lsbs_left == available_bits) { + /* compose the value */ + uval |= (msbs << parameter); + *vals = (int)(uval >> 1 ^ -(int)(uval & 1)); + --val_i; + if(val_i == 0) { + i++; + goto break2; + } + ++vals; + + msbs = 0; + state = 0; + } + + lsbs_left -= available_bits; + break; + } + else { + cbits += lsbs_left; + uval <<= lsbs_left; + uval |= (blurb >> (FLAC__BITS_PER_BLURB - lsbs_left)); + blurb <<= lsbs_left; + + /* compose the value */ + uval |= (msbs << parameter); + *vals = (int)(uval >> 1 ^ -(int)(uval & 1)); + --val_i; + if(val_i == 0) + goto break2; + ++vals; + + msbs = 0; + state = 0; + } + } + } + } +break2: + bb->consumed_blurbs = i; + bb->consumed_bits = cbits; + bb->total_consumed_bits = (i << FLAC__BITS_PER_BLURB_LOG2) | cbits; + if(val_i != 0) { + if(!bitbuffer_read_from_client_(bb, read_callback, client_data)) + return false; + /* these must be zero because we can only get here if we got to the end of the buffer */ + FLAC__ASSERT(bb->consumed_blurbs == 0); + FLAC__ASSERT(bb->consumed_bits == 0); + i = 0; + } + } + + return true; +} +#endif + +#if 0 /* UNUSED */ +FLAC__bool FLAC__bitbuffer_read_golomb_signed(FLAC__BitBuffer *bb, int *val, unsigned parameter, FLAC__bool (*read_callback)(FLAC__byte buffer[], unsigned *bytes, void *client_data), void *client_data) +{ + FLAC__uint32 lsbs = 0, msbs = 0; + unsigned bit, uval, k; + + FLAC__ASSERT(0 != bb); + FLAC__ASSERT(0 != bb->buffer); + + k = FLAC__bitmath_ilog2(parameter); + + /* read the unary MSBs and end bit */ + if(!FLAC__bitbuffer_read_unary_unsigned(bb, &msbs, read_callback, client_data)) + return false; + + /* read the binary LSBs */ + if(!FLAC__bitbuffer_read_raw_uint32(bb, &lsbs, k, read_callback, client_data)) + return false; + + if(parameter == 1u<= d) { + if(!FLAC__bitbuffer_read_bit(bb, &bit, read_callback, client_data)) + return false; + lsbs <<= 1; + lsbs |= bit; + lsbs -= d; + } + /* compose the value */ + uval = msbs * parameter + lsbs; + } + + /* unfold unsigned to signed */ + if(uval & 1) + *val = -((int)(uval >> 1)) - 1; + else + *val = (int)(uval >> 1); + + return true; +} + +FLAC__bool FLAC__bitbuffer_read_golomb_unsigned(FLAC__BitBuffer *bb, unsigned *val, unsigned parameter, FLAC__bool (*read_callback)(FLAC__byte buffer[], unsigned *bytes, void *client_data), void *client_data) +{ + FLAC__uint32 lsbs, msbs = 0; + unsigned bit, k; + + FLAC__ASSERT(0 != bb); + FLAC__ASSERT(0 != bb->buffer); + + k = FLAC__bitmath_ilog2(parameter); + + /* read the unary MSBs and end bit */ + if(!FLAC__bitbuffer_read_unary_unsigned(bb, &msbs, read_callback, client_data)) + return false; + + /* read the binary LSBs */ + if(!FLAC__bitbuffer_read_raw_uint32(bb, &lsbs, k, read_callback, client_data)) + return false; + + if(parameter == 1u<= d) { + if(!FLAC__bitbuffer_read_bit(bb, &bit, read_callback, client_data)) + return false; + lsbs <<= 1; + lsbs |= bit; + lsbs -= d; + } + /* compose the value */ + *val = msbs * parameter + lsbs; + } + + return true; +} +#endif /* UNUSED */ + +/* on return, if *val == 0xffffffff then the utf-8 sequence was invalid, but the return value will be true */ +FLAC__bool FLAC__bitbuffer_read_utf8_uint32(FLAC__BitBuffer *bb, FLAC__uint32 *val, FLAC__bool (*read_callback)(FLAC__byte buffer[], unsigned *bytes, void *client_data), void *client_data, FLAC__byte *raw, unsigned *rawlen) +{ + FLAC__uint32 v = 0; + FLAC__uint32 x; + unsigned i; + + if(!FLAC__bitbuffer_read_raw_uint32(bb, &x, 8, read_callback, client_data)) + return false; + if(raw) + raw[(*rawlen)++] = (FLAC__byte)x; + if(!(x & 0x80)) { /* 0xxxxxxx */ + v = x; + i = 0; + } + else if(x & 0xC0 && !(x & 0x20)) { /* 110xxxxx */ + v = x & 0x1F; + i = 1; + } + else if(x & 0xE0 && !(x & 0x10)) { /* 1110xxxx */ + v = x & 0x0F; + i = 2; + } + else if(x & 0xF0 && !(x & 0x08)) { /* 11110xxx */ + v = x & 0x07; + i = 3; + } + else if(x & 0xF8 && !(x & 0x04)) { /* 111110xx */ + v = x & 0x03; + i = 4; + } + else if(x & 0xFC && !(x & 0x02)) { /* 1111110x */ + v = x & 0x01; + i = 5; + } + else { + *val = 0xffffffff; + return true; + } + for( ; i; i--) { + if(!FLAC__bitbuffer_read_raw_uint32(bb, &x, 8, read_callback, client_data)) + return false; + if(raw) + raw[(*rawlen)++] = (FLAC__byte)x; + if(!(x & 0x80) || (x & 0x40)) { /* 10xxxxxx */ + *val = 0xffffffff; + return true; + } + v <<= 6; + v |= (x & 0x3F); + } + *val = v; + return true; +} + +/* on return, if *val == 0xffffffffffffffff then the utf-8 sequence was invalid, but the return value will be true */ +FLAC__bool FLAC__bitbuffer_read_utf8_uint64(FLAC__BitBuffer *bb, FLAC__uint64 *val, FLAC__bool (*read_callback)(FLAC__byte buffer[], unsigned *bytes, void *client_data), void *client_data, FLAC__byte *raw, unsigned *rawlen) +{ + FLAC__uint64 v = 0; + FLAC__uint32 x; + unsigned i; + + if(!FLAC__bitbuffer_read_raw_uint32(bb, &x, 8, read_callback, client_data)) + return false; + if(raw) + raw[(*rawlen)++] = (FLAC__byte)x; + if(!(x & 0x80)) { /* 0xxxxxxx */ + v = x; + i = 0; + } + else if(x & 0xC0 && !(x & 0x20)) { /* 110xxxxx */ + v = x & 0x1F; + i = 1; + } + else if(x & 0xE0 && !(x & 0x10)) { /* 1110xxxx */ + v = x & 0x0F; + i = 2; + } + else if(x & 0xF0 && !(x & 0x08)) { /* 11110xxx */ + v = x & 0x07; + i = 3; + } + else if(x & 0xF8 && !(x & 0x04)) { /* 111110xx */ + v = x & 0x03; + i = 4; + } + else if(x & 0xFC && !(x & 0x02)) { /* 1111110x */ + v = x & 0x01; + i = 5; + } + else if(x & 0xFE && !(x & 0x01)) { /* 11111110 */ + v = 0; + i = 6; + } + else { + *val = FLAC__U64L(0xffffffffffffffff); + return true; + } + for( ; i; i--) { + if(!FLAC__bitbuffer_read_raw_uint32(bb, &x, 8, read_callback, client_data)) + return false; + if(raw) + raw[(*rawlen)++] = (FLAC__byte)x; + if(!(x & 0x80) || (x & 0x40)) { /* 10xxxxxx */ + *val = FLAC__U64L(0xffffffffffffffff); + return true; + } + v <<= 6; + v |= (x & 0x3F); + } + *val = v; + return true; +} + +void FLAC__bitbuffer_dump(const FLAC__BitBuffer *bb, FILE *out) +{ + unsigned i, j; + if(bb == 0) { + fprintf(out, "bitbuffer is NULL\n"); + } + else { + fprintf(out, "bitbuffer: capacity=%u blurbs=%u bits=%u total_bits=%u consumed: blurbs=%u, bits=%u, total_bits=%u\n", bb->capacity, bb->blurbs, bb->bits, bb->total_bits, bb->consumed_blurbs, bb->consumed_bits, bb->total_consumed_bits); + + for(i = 0; i < bb->blurbs; i++) { + fprintf(out, "%08X: ", i); + for(j = 0; j < FLAC__BITS_PER_BLURB; j++) + if(i*FLAC__BITS_PER_BLURB+j < bb->total_consumed_bits) + fprintf(out, "."); + else + fprintf(out, "%01u", bb->buffer[i] & (1 << (FLAC__BITS_PER_BLURB-j-1)) ? 1:0); + fprintf(out, "\n"); + } + if(bb->bits > 0) { + fprintf(out, "%08X: ", i); + for(j = 0; j < bb->bits; j++) + if(i*FLAC__BITS_PER_BLURB+j < bb->total_consumed_bits) + fprintf(out, "."); + else + fprintf(out, "%01u", bb->buffer[i] & (1 << (bb->bits-j-1)) ? 1:0); + fprintf(out, "\n"); + } + } +} diff --git a/Libraries/FLAC/Files/src/libFLAC/bitmath.c b/Libraries/FLAC/Files/src/libFLAC/bitmath.c new file mode 100644 index 000000000..2bc509b41 --- /dev/null +++ b/Libraries/FLAC/Files/src/libFLAC/bitmath.c @@ -0,0 +1,145 @@ +/* libFLAC - Free Lossless Audio Codec library + * Copyright (C) 2001,2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "private/bitmath.h" +#include "FLAC/assert.h" + +/* An example of what FLAC__bitmath_ilog2() computes: + * + * ilog2( 0) = assertion failure + * ilog2( 1) = 0 + * ilog2( 2) = 1 + * ilog2( 3) = 1 + * ilog2( 4) = 2 + * ilog2( 5) = 2 + * ilog2( 6) = 2 + * ilog2( 7) = 2 + * ilog2( 8) = 3 + * ilog2( 9) = 3 + * ilog2(10) = 3 + * ilog2(11) = 3 + * ilog2(12) = 3 + * ilog2(13) = 3 + * ilog2(14) = 3 + * ilog2(15) = 3 + * ilog2(16) = 4 + * ilog2(17) = 4 + * ilog2(18) = 4 + */ +unsigned FLAC__bitmath_ilog2(FLAC__uint32 v) +{ + unsigned l = 0; + FLAC__ASSERT(v > 0); + while(v >>= 1) + l++; + return l; +} + +unsigned FLAC__bitmath_ilog2_wide(FLAC__uint64 v) +{ + unsigned l = 0; + FLAC__ASSERT(v > 0); + while(v >>= 1) + l++; + return l; +} + +/* An example of what FLAC__bitmath_silog2() computes: + * + * silog2(-10) = 5 + * silog2(- 9) = 5 + * silog2(- 8) = 4 + * silog2(- 7) = 4 + * silog2(- 6) = 4 + * silog2(- 5) = 4 + * silog2(- 4) = 3 + * silog2(- 3) = 3 + * silog2(- 2) = 2 + * silog2(- 1) = 2 + * silog2( 0) = 0 + * silog2( 1) = 2 + * silog2( 2) = 3 + * silog2( 3) = 3 + * silog2( 4) = 4 + * silog2( 5) = 4 + * silog2( 6) = 4 + * silog2( 7) = 4 + * silog2( 8) = 5 + * silog2( 9) = 5 + * silog2( 10) = 5 + */ +unsigned FLAC__bitmath_silog2(int v) +{ + while(1) { + if(v == 0) { + return 0; + } + else if(v > 0) { + unsigned l = 0; + while(v) { + l++; + v >>= 1; + } + return l+1; + } + else if(v == -1) { + return 2; + } + else { + v++; + v = -v; + } + } +} + +unsigned FLAC__bitmath_silog2_wide(FLAC__int64 v) +{ + while(1) { + if(v == 0) { + return 0; + } + else if(v > 0) { + unsigned l = 0; + while(v) { + l++; + v >>= 1; + } + return l+1; + } + else if(v == -1) { + return 2; + } + else { + v++; + v = -v; + } + } +} diff --git a/Libraries/FLAC/Files/src/libFLAC/cpu.c b/Libraries/FLAC/Files/src/libFLAC/cpu.c new file mode 100644 index 000000000..1e6b27994 --- /dev/null +++ b/Libraries/FLAC/Files/src/libFLAC/cpu.c @@ -0,0 +1,179 @@ +/* libFLAC - Free Lossless Audio Codec library + * Copyright (C) 2001,2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "private/cpu.h" +#include +#include + +#ifdef HAVE_CONFIG_H +#include +#endif + +#if defined FLAC__CPU_PPC +#if !defined FLAC__NO_ASM +#if defined FLAC__SYS_DARWIN +#include +#include +#include +#include +#include +#ifndef CPU_SUBTYPE_POWERPC_970 +#define CPU_SUBTYPE_POWERPC_970 ((cpu_subtype_t) 100) +#endif +#else /* FLAC__SYS_DARWIN */ +#include +#include + +static sigjmp_buf jmpbuf; +static volatile sig_atomic_t canjump = 0; + +static void sigill_handler (int sig) +{ + if (!canjump) { + signal (sig, SIG_DFL); + raise (sig); + } + canjump = 0; + siglongjmp (jmpbuf, 1); +} +#endif /* FLAC__SYS_DARWIN */ +#endif /* FLAC__NO_ASM */ +#endif /* FLAC__CPU_PPC */ + +const unsigned FLAC__CPUINFO_IA32_CPUID_CMOV = 0x00008000; +const unsigned FLAC__CPUINFO_IA32_CPUID_MMX = 0x00800000; +const unsigned FLAC__CPUINFO_IA32_CPUID_FXSR = 0x01000000; +const unsigned FLAC__CPUINFO_IA32_CPUID_SSE = 0x02000000; +const unsigned FLAC__CPUINFO_IA32_CPUID_SSE2 = 0x04000000; + +const unsigned FLAC__CPUINFO_IA32_CPUID_EXTENDED_AMD_3DNOW = 0x80000000; +const unsigned FLAC__CPUINFO_IA32_CPUID_EXTENDED_AMD_EXT3DNOW = 0x40000000; +const unsigned FLAC__CPUINFO_IA32_CPUID_EXTENDED_AMD_EXTMMX = 0x00400000; + + +void FLAC__cpu_info(FLAC__CPUInfo *info) +{ +#ifdef FLAC__CPU_IA32 + info->type = FLAC__CPUINFO_TYPE_IA32; +#if !defined FLAC__NO_ASM && defined FLAC__HAS_NASM + info->use_asm = true; + { + unsigned cpuid = FLAC__cpu_info_asm_ia32(); + info->data.ia32.cmov = (cpuid & FLAC__CPUINFO_IA32_CPUID_CMOV)? true : false; + info->data.ia32.mmx = (cpuid & FLAC__CPUINFO_IA32_CPUID_MMX)? true : false; + info->data.ia32.fxsr = (cpuid & FLAC__CPUINFO_IA32_CPUID_FXSR)? true : false; + info->data.ia32.sse = (cpuid & FLAC__CPUINFO_IA32_CPUID_SSE)? true : false; + info->data.ia32.sse2 = (cpuid & FLAC__CPUINFO_IA32_CPUID_SSE2)? true : false; + +#ifndef FLAC__SSE_OS + info->data.ia32.fxsr = info->data.ia32.sse = info->data.ia32.sse2 = false; +#endif + +#ifdef FLAC__USE_3DNOW + cpuid = FLAC__cpu_info_extended_amd_asm_ia32(); + info->data.ia32._3dnow = (cpuid & FLAC__CPUINFO_IA32_CPUID_EXTENDED_AMD_3DNOW)? true : false; + info->data.ia32.ext3dnow = (cpuid & FLAC__CPUINFO_IA32_CPUID_EXTENDED_AMD_EXT3DNOW)? true : false; + info->data.ia32.extmmx = (cpuid & FLAC__CPUINFO_IA32_CPUID_EXTENDED_AMD_EXTMMX)? true : false; +#else + info->data.ia32._3dnow = info->data.ia32.ext3dnow = info->data.ia32.extmmx = false; +#endif + } +#else + info->use_asm = false; +#endif +#elif defined FLAC__CPU_PPC + info->type = FLAC__CPUINFO_TYPE_PPC; +#if !defined FLAC__NO_ASM + info->use_asm = true; +#ifdef FLAC__USE_ALTIVEC +#if defined FLAC__SYS_DARWIN + { + int selectors[2] = { CTL_HW, HW_VECTORUNIT }; + int result = 0; + size_t length = sizeof(result); + int error = sysctl(selectors, 2, &result, &length, 0, 0); + + info->data.ppc.altivec = error==0 ? result!=0 : 0; + } + { + host_basic_info_data_t hostInfo; + mach_msg_type_number_t infoCount; + + infoCount = HOST_BASIC_INFO_COUNT; + host_info(mach_host_self(), HOST_BASIC_INFO, (host_info_t)&hostInfo, &infoCount); + + info->data.ppc.ppc64 = (hostInfo.cpu_type == CPU_TYPE_POWERPC) && (hostInfo.cpu_subtype == CPU_SUBTYPE_POWERPC_970); + } +#else /* FLAC__SYS_DARWIN */ + { + /* no Darwin, do it the brute-force way */ + /* this is borrowed from MPlayer from the libmpeg2 library */ + info->data.ppc.altivec = 0; + info->data.ppc.ppc64 = 0; + + signal (SIGILL, sigill_handler); + if (!sigsetjmp (jmpbuf, 1)) { + canjump = 1; + + asm volatile ( + "mtspr 256, %0\n\t" + "vand %%v0, %%v0, %%v0" + : + : "r" (-1) + ); + + info->data.ppc.altivec = 1; + } + canjump = 0; + if (!sigsetjmp (jmpbuf, 1)) { + int x = 0; + canjump = 1; + + /* PPC64 hardware implements the cntlzd instruction */ + asm volatile ("cntlzd %0, %1" : "=r" (x) : "r" (x) ); + + info->data.ppc.ppc64 = 1; + } + signal (SIGILL, SIG_DFL); + } +#endif /* FLAC__SYS_DARWIN */ +#else /* FLAC__USE_ALTIVEC */ + info->data.ppc.altivec = 0; + info->data.ppc.ppc64 = 0; +#endif /* FLAC__USE_ALTIVEC */ +#else /* FLAC__NO_ASM */ + info->use_asm = false; +#endif /* FLAC__NO_ASM */ +#else + info->type = FLAC__CPUINFO_TYPE_UNKNOWN; + info->use_asm = false; +#endif +} diff --git a/Libraries/FLAC/Files/src/libFLAC/crc.c b/Libraries/FLAC/Files/src/libFLAC/crc.c new file mode 100644 index 000000000..52e1b600e --- /dev/null +++ b/Libraries/FLAC/Files/src/libFLAC/crc.c @@ -0,0 +1,149 @@ +/* libFLAC - Free Lossless Audio Codec library + * Copyright (C) 2000,2001,2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "private/crc.h" + +/* CRC-8, poly = x^8 + x^2 + x^1 + x^0, init = 0 */ + +FLAC__byte const FLAC__crc8_table[256] = { + 0x00, 0x07, 0x0E, 0x09, 0x1C, 0x1B, 0x12, 0x15, + 0x38, 0x3F, 0x36, 0x31, 0x24, 0x23, 0x2A, 0x2D, + 0x70, 0x77, 0x7E, 0x79, 0x6C, 0x6B, 0x62, 0x65, + 0x48, 0x4F, 0x46, 0x41, 0x54, 0x53, 0x5A, 0x5D, + 0xE0, 0xE7, 0xEE, 0xE9, 0xFC, 0xFB, 0xF2, 0xF5, + 0xD8, 0xDF, 0xD6, 0xD1, 0xC4, 0xC3, 0xCA, 0xCD, + 0x90, 0x97, 0x9E, 0x99, 0x8C, 0x8B, 0x82, 0x85, + 0xA8, 0xAF, 0xA6, 0xA1, 0xB4, 0xB3, 0xBA, 0xBD, + 0xC7, 0xC0, 0xC9, 0xCE, 0xDB, 0xDC, 0xD5, 0xD2, + 0xFF, 0xF8, 0xF1, 0xF6, 0xE3, 0xE4, 0xED, 0xEA, + 0xB7, 0xB0, 0xB9, 0xBE, 0xAB, 0xAC, 0xA5, 0xA2, + 0x8F, 0x88, 0x81, 0x86, 0x93, 0x94, 0x9D, 0x9A, + 0x27, 0x20, 0x29, 0x2E, 0x3B, 0x3C, 0x35, 0x32, + 0x1F, 0x18, 0x11, 0x16, 0x03, 0x04, 0x0D, 0x0A, + 0x57, 0x50, 0x59, 0x5E, 0x4B, 0x4C, 0x45, 0x42, + 0x6F, 0x68, 0x61, 0x66, 0x73, 0x74, 0x7D, 0x7A, + 0x89, 0x8E, 0x87, 0x80, 0x95, 0x92, 0x9B, 0x9C, + 0xB1, 0xB6, 0xBF, 0xB8, 0xAD, 0xAA, 0xA3, 0xA4, + 0xF9, 0xFE, 0xF7, 0xF0, 0xE5, 0xE2, 0xEB, 0xEC, + 0xC1, 0xC6, 0xCF, 0xC8, 0xDD, 0xDA, 0xD3, 0xD4, + 0x69, 0x6E, 0x67, 0x60, 0x75, 0x72, 0x7B, 0x7C, + 0x51, 0x56, 0x5F, 0x58, 0x4D, 0x4A, 0x43, 0x44, + 0x19, 0x1E, 0x17, 0x10, 0x05, 0x02, 0x0B, 0x0C, + 0x21, 0x26, 0x2F, 0x28, 0x3D, 0x3A, 0x33, 0x34, + 0x4E, 0x49, 0x40, 0x47, 0x52, 0x55, 0x5C, 0x5B, + 0x76, 0x71, 0x78, 0x7F, 0x6A, 0x6D, 0x64, 0x63, + 0x3E, 0x39, 0x30, 0x37, 0x22, 0x25, 0x2C, 0x2B, + 0x06, 0x01, 0x08, 0x0F, 0x1A, 0x1D, 0x14, 0x13, + 0xAE, 0xA9, 0xA0, 0xA7, 0xB2, 0xB5, 0xBC, 0xBB, + 0x96, 0x91, 0x98, 0x9F, 0x8A, 0x8D, 0x84, 0x83, + 0xDE, 0xD9, 0xD0, 0xD7, 0xC2, 0xC5, 0xCC, 0xCB, + 0xE6, 0xE1, 0xE8, 0xEF, 0xFA, 0xFD, 0xF4, 0xF3 +}; + +/* CRC-16, poly = x^16 + x^15 + x^2 + x^0, init = 0 */ + +FLAC__uint16 FLAC__crc16_table[256] = { + 0x0000, 0x8005, 0x800f, 0x000a, 0x801b, 0x001e, 0x0014, 0x8011, + 0x8033, 0x0036, 0x003c, 0x8039, 0x0028, 0x802d, 0x8027, 0x0022, + 0x8063, 0x0066, 0x006c, 0x8069, 0x0078, 0x807d, 0x8077, 0x0072, + 0x0050, 0x8055, 0x805f, 0x005a, 0x804b, 0x004e, 0x0044, 0x8041, + 0x80c3, 0x00c6, 0x00cc, 0x80c9, 0x00d8, 0x80dd, 0x80d7, 0x00d2, + 0x00f0, 0x80f5, 0x80ff, 0x00fa, 0x80eb, 0x00ee, 0x00e4, 0x80e1, + 0x00a0, 0x80a5, 0x80af, 0x00aa, 0x80bb, 0x00be, 0x00b4, 0x80b1, + 0x8093, 0x0096, 0x009c, 0x8099, 0x0088, 0x808d, 0x8087, 0x0082, + 0x8183, 0x0186, 0x018c, 0x8189, 0x0198, 0x819d, 0x8197, 0x0192, + 0x01b0, 0x81b5, 0x81bf, 0x01ba, 0x81ab, 0x01ae, 0x01a4, 0x81a1, + 0x01e0, 0x81e5, 0x81ef, 0x01ea, 0x81fb, 0x01fe, 0x01f4, 0x81f1, + 0x81d3, 0x01d6, 0x01dc, 0x81d9, 0x01c8, 0x81cd, 0x81c7, 0x01c2, + 0x0140, 0x8145, 0x814f, 0x014a, 0x815b, 0x015e, 0x0154, 0x8151, + 0x8173, 0x0176, 0x017c, 0x8179, 0x0168, 0x816d, 0x8167, 0x0162, + 0x8123, 0x0126, 0x012c, 0x8129, 0x0138, 0x813d, 0x8137, 0x0132, + 0x0110, 0x8115, 0x811f, 0x011a, 0x810b, 0x010e, 0x0104, 0x8101, + 0x8303, 0x0306, 0x030c, 0x8309, 0x0318, 0x831d, 0x8317, 0x0312, + 0x0330, 0x8335, 0x833f, 0x033a, 0x832b, 0x032e, 0x0324, 0x8321, + 0x0360, 0x8365, 0x836f, 0x036a, 0x837b, 0x037e, 0x0374, 0x8371, + 0x8353, 0x0356, 0x035c, 0x8359, 0x0348, 0x834d, 0x8347, 0x0342, + 0x03c0, 0x83c5, 0x83cf, 0x03ca, 0x83db, 0x03de, 0x03d4, 0x83d1, + 0x83f3, 0x03f6, 0x03fc, 0x83f9, 0x03e8, 0x83ed, 0x83e7, 0x03e2, + 0x83a3, 0x03a6, 0x03ac, 0x83a9, 0x03b8, 0x83bd, 0x83b7, 0x03b2, + 0x0390, 0x8395, 0x839f, 0x039a, 0x838b, 0x038e, 0x0384, 0x8381, + 0x0280, 0x8285, 0x828f, 0x028a, 0x829b, 0x029e, 0x0294, 0x8291, + 0x82b3, 0x02b6, 0x02bc, 0x82b9, 0x02a8, 0x82ad, 0x82a7, 0x02a2, + 0x82e3, 0x02e6, 0x02ec, 0x82e9, 0x02f8, 0x82fd, 0x82f7, 0x02f2, + 0x02d0, 0x82d5, 0x82df, 0x02da, 0x82cb, 0x02ce, 0x02c4, 0x82c1, + 0x8243, 0x0246, 0x024c, 0x8249, 0x0258, 0x825d, 0x8257, 0x0252, + 0x0270, 0x8275, 0x827f, 0x027a, 0x826b, 0x026e, 0x0264, 0x8261, + 0x0220, 0x8225, 0x822f, 0x022a, 0x823b, 0x023e, 0x0234, 0x8231, + 0x8213, 0x0216, 0x021c, 0x8219, 0x0208, 0x820d, 0x8207, 0x0202 +}; + + +void FLAC__crc8_update(const FLAC__byte data, FLAC__uint8 *crc) +{ + *crc = FLAC__crc8_table[*crc ^ data]; +} + +void FLAC__crc8_update_block(const FLAC__byte *data, unsigned len, FLAC__uint8 *crc) +{ + while(len--) + *crc = FLAC__crc8_table[*crc ^ *data++]; +} + +FLAC__uint8 FLAC__crc8(const FLAC__byte *data, unsigned len) +{ + FLAC__uint8 crc = 0; + + while(len--) + crc = FLAC__crc8_table[crc ^ *data++]; + + return crc; +} + +void FLAC__crc16_update(const FLAC__byte data, FLAC__uint16 *crc) +{ + *crc = (*crc<<8) ^ FLAC__crc16_table[(*crc>>8) ^ data]; +} + +void FLAC__crc16_update_block(const FLAC__byte *data, unsigned len, FLAC__uint16 *crc) +{ + while(len--) + *crc = (*crc<<8) ^ FLAC__crc16_table[(*crc>>8) ^ *data++]; +} + +FLAC__uint16 FLAC__crc16(const FLAC__byte *data, unsigned len) +{ + FLAC__uint16 crc = 0; + + while(len--) + crc = (crc<<8) ^ FLAC__crc16_table[(crc>>8) ^ *data++]; + + return crc; +} diff --git a/Libraries/FLAC/Files/src/libFLAC/file_decoder.c b/Libraries/FLAC/Files/src/libFLAC/file_decoder.c new file mode 100644 index 000000000..29d489587 --- /dev/null +++ b/Libraries/FLAC/Files/src/libFLAC/file_decoder.c @@ -0,0 +1,673 @@ +/* libFLAC - Free Lossless Audio Codec library + * Copyright (C) 2000,2001,2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include /* for malloc() */ +#include /* for strcmp() */ +#include /* for stat() */ +#if defined _MSC_VER || defined __MINGW32__ +#include /* for _setmode() */ +#include /* for _O_BINARY */ +#elif defined __CYGWIN__ +#include /* for setmode(), O_BINARY */ +#include /* for _O_BINARY */ +#endif +#include "FLAC/assert.h" +#include "protected/file_decoder.h" +#include "protected/seekable_stream_decoder.h" + +/*********************************************************************** + * + * Private class method prototypes + * + ***********************************************************************/ + +static void set_defaults_(FLAC__FileDecoder *decoder); +static FILE *get_binary_stdin_(); +static FLAC__SeekableStreamDecoderReadStatus read_callback_(const FLAC__SeekableStreamDecoder *decoder, FLAC__byte buffer[], unsigned *bytes, void *client_data); +static FLAC__SeekableStreamDecoderSeekStatus seek_callback_(const FLAC__SeekableStreamDecoder *decoder, FLAC__uint64 absolute_byte_offset, void *client_data); +static FLAC__SeekableStreamDecoderTellStatus tell_callback_(const FLAC__SeekableStreamDecoder *decoder, FLAC__uint64 *absolute_byte_offset, void *client_data); +static FLAC__SeekableStreamDecoderLengthStatus length_callback_(const FLAC__SeekableStreamDecoder *decoder, FLAC__uint64 *stream_length, void *client_data); +static FLAC__bool eof_callback_(const FLAC__SeekableStreamDecoder *decoder, void *client_data); +static FLAC__StreamDecoderWriteStatus write_callback_(const FLAC__SeekableStreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data); +static void metadata_callback_(const FLAC__SeekableStreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data); +static void error_callback_(const FLAC__SeekableStreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data); + +/*********************************************************************** + * + * Private class data + * + ***********************************************************************/ + +typedef struct FLAC__FileDecoderPrivate { + FLAC__FileDecoderWriteCallback write_callback; + FLAC__FileDecoderMetadataCallback metadata_callback; + FLAC__FileDecoderErrorCallback error_callback; + void *client_data; + FILE *file; + char *filename; /* == NULL if stdin */ + FLAC__SeekableStreamDecoder *seekable_stream_decoder; +} FLAC__FileDecoderPrivate; + +/*********************************************************************** + * + * Public static class data + * + ***********************************************************************/ + +FLAC_API const char * const FLAC__FileDecoderStateString[] = { + "FLAC__FILE_DECODER_OK", + "FLAC__FILE_DECODER_END_OF_FILE", + "FLAC__FILE_DECODER_ERROR_OPENING_FILE", + "FLAC__FILE_DECODER_MEMORY_ALLOCATION_ERROR", + "FLAC__FILE_DECODER_SEEK_ERROR", + "FLAC__FILE_DECODER_SEEKABLE_STREAM_DECODER_ERROR", + "FLAC__FILE_DECODER_ALREADY_INITIALIZED", + "FLAC__FILE_DECODER_INVALID_CALLBACK", + "FLAC__FILE_DECODER_UNINITIALIZED" +}; + +/*********************************************************************** + * + * Class constructor/destructor + * + ***********************************************************************/ + +FLAC_API FLAC__FileDecoder *FLAC__file_decoder_new() +{ + FLAC__FileDecoder *decoder; + + FLAC__ASSERT(sizeof(int) >= 4); /* we want to die right away if this is not true */ + + decoder = (FLAC__FileDecoder*)calloc(1, sizeof(FLAC__FileDecoder)); + if(decoder == 0) { + return 0; + } + + decoder->protected_ = (FLAC__FileDecoderProtected*)calloc(1, sizeof(FLAC__FileDecoderProtected)); + if(decoder->protected_ == 0) { + free(decoder); + return 0; + } + + decoder->private_ = (FLAC__FileDecoderPrivate*)calloc(1, sizeof(FLAC__FileDecoderPrivate)); + if(decoder->private_ == 0) { + free(decoder->protected_); + free(decoder); + return 0; + } + + decoder->private_->seekable_stream_decoder = FLAC__seekable_stream_decoder_new(); + if(0 == decoder->private_->seekable_stream_decoder) { + free(decoder->private_); + free(decoder->protected_); + free(decoder); + return 0; + } + + decoder->private_->file = 0; + + set_defaults_(decoder); + + decoder->protected_->state = FLAC__FILE_DECODER_UNINITIALIZED; + + return decoder; +} + +FLAC_API void FLAC__file_decoder_delete(FLAC__FileDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->protected_); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->private_->seekable_stream_decoder); + + (void)FLAC__file_decoder_finish(decoder); + + FLAC__seekable_stream_decoder_delete(decoder->private_->seekable_stream_decoder); + + free(decoder->private_); + free(decoder->protected_); + free(decoder); +} + +/*********************************************************************** + * + * Public class methods + * + ***********************************************************************/ + +FLAC_API FLAC__FileDecoderState FLAC__file_decoder_init(FLAC__FileDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + + if(decoder->protected_->state != FLAC__FILE_DECODER_UNINITIALIZED) + return decoder->protected_->state = FLAC__FILE_DECODER_ALREADY_INITIALIZED; + + if(0 == decoder->private_->write_callback || 0 == decoder->private_->metadata_callback || 0 == decoder->private_->error_callback) + return decoder->protected_->state = FLAC__FILE_DECODER_INVALID_CALLBACK; + + if(0 == decoder->private_->filename) + decoder->private_->file = get_binary_stdin_(); + else + decoder->private_->file = fopen(decoder->private_->filename, "rb"); + + if(decoder->private_->file == 0) + return decoder->protected_->state = FLAC__FILE_DECODER_ERROR_OPENING_FILE; + + FLAC__seekable_stream_decoder_set_read_callback(decoder->private_->seekable_stream_decoder, read_callback_); + FLAC__seekable_stream_decoder_set_seek_callback(decoder->private_->seekable_stream_decoder, seek_callback_); + FLAC__seekable_stream_decoder_set_tell_callback(decoder->private_->seekable_stream_decoder, tell_callback_); + FLAC__seekable_stream_decoder_set_length_callback(decoder->private_->seekable_stream_decoder, length_callback_); + FLAC__seekable_stream_decoder_set_eof_callback(decoder->private_->seekable_stream_decoder, eof_callback_); + FLAC__seekable_stream_decoder_set_write_callback(decoder->private_->seekable_stream_decoder, write_callback_); + FLAC__seekable_stream_decoder_set_metadata_callback(decoder->private_->seekable_stream_decoder, metadata_callback_); + FLAC__seekable_stream_decoder_set_error_callback(decoder->private_->seekable_stream_decoder, error_callback_); + FLAC__seekable_stream_decoder_set_client_data(decoder->private_->seekable_stream_decoder, decoder); + + if(FLAC__seekable_stream_decoder_init(decoder->private_->seekable_stream_decoder) != FLAC__SEEKABLE_STREAM_DECODER_OK) + return decoder->protected_->state = FLAC__FILE_DECODER_SEEKABLE_STREAM_DECODER_ERROR; + + return decoder->protected_->state = FLAC__FILE_DECODER_OK; +} + +FLAC_API FLAC__bool FLAC__file_decoder_finish(FLAC__FileDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + + if(decoder->protected_->state == FLAC__FILE_DECODER_UNINITIALIZED) + return true; + + FLAC__ASSERT(0 != decoder->private_->seekable_stream_decoder); + + if(0 != decoder->private_->file && decoder->private_->file != stdin) { + fclose(decoder->private_->file); + decoder->private_->file = 0; + } + + if(0 != decoder->private_->filename) { + free(decoder->private_->filename); + decoder->private_->filename = 0; + } + + set_defaults_(decoder); + + decoder->protected_->state = FLAC__FILE_DECODER_UNINITIALIZED; + + return FLAC__seekable_stream_decoder_finish(decoder->private_->seekable_stream_decoder); +} + +FLAC_API FLAC__bool FLAC__file_decoder_set_md5_checking(FLAC__FileDecoder *decoder, FLAC__bool value) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + FLAC__ASSERT(0 != decoder->private_->seekable_stream_decoder); + if(decoder->protected_->state != FLAC__FILE_DECODER_UNINITIALIZED) + return false; + return FLAC__seekable_stream_decoder_set_md5_checking(decoder->private_->seekable_stream_decoder, value); +} + +FLAC_API FLAC__bool FLAC__file_decoder_set_filename(FLAC__FileDecoder *decoder, const char *value) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + FLAC__ASSERT(0 != value); + if(decoder->protected_->state != FLAC__FILE_DECODER_UNINITIALIZED) + return false; + if(0 != decoder->private_->filename) { + free(decoder->private_->filename); + decoder->private_->filename = 0; + } + if(0 != strcmp(value, "-")) { + if(0 == (decoder->private_->filename = (char*)malloc(strlen(value)+1))) { + decoder->protected_->state = FLAC__FILE_DECODER_MEMORY_ALLOCATION_ERROR; + return false; + } + strcpy(decoder->private_->filename, value); + } + return true; +} + +FLAC_API FLAC__bool FLAC__file_decoder_set_write_callback(FLAC__FileDecoder *decoder, FLAC__FileDecoderWriteCallback value) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + if(decoder->protected_->state != FLAC__FILE_DECODER_UNINITIALIZED) + return false; + decoder->private_->write_callback = value; + return true; +} + +FLAC_API FLAC__bool FLAC__file_decoder_set_metadata_callback(FLAC__FileDecoder *decoder, FLAC__FileDecoderMetadataCallback value) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + if(decoder->protected_->state != FLAC__FILE_DECODER_UNINITIALIZED) + return false; + decoder->private_->metadata_callback = value; + return true; +} + +FLAC_API FLAC__bool FLAC__file_decoder_set_error_callback(FLAC__FileDecoder *decoder, FLAC__FileDecoderErrorCallback value) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + if(decoder->protected_->state != FLAC__FILE_DECODER_UNINITIALIZED) + return false; + decoder->private_->error_callback = value; + return true; +} + +FLAC_API FLAC__bool FLAC__file_decoder_set_client_data(FLAC__FileDecoder *decoder, void *value) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + if(decoder->protected_->state != FLAC__FILE_DECODER_UNINITIALIZED) + return false; + decoder->private_->client_data = value; + return true; +} + +FLAC_API FLAC__bool FLAC__file_decoder_set_metadata_respond(FLAC__FileDecoder *decoder, FLAC__MetadataType type) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + FLAC__ASSERT(0 != decoder->private_->seekable_stream_decoder); + if(decoder->protected_->state != FLAC__FILE_DECODER_UNINITIALIZED) + return false; + return FLAC__seekable_stream_decoder_set_metadata_respond(decoder->private_->seekable_stream_decoder, type); +} + +FLAC_API FLAC__bool FLAC__file_decoder_set_metadata_respond_application(FLAC__FileDecoder *decoder, const FLAC__byte id[4]) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + FLAC__ASSERT(0 != decoder->private_->seekable_stream_decoder); + if(decoder->protected_->state != FLAC__FILE_DECODER_UNINITIALIZED) + return false; + return FLAC__seekable_stream_decoder_set_metadata_respond_application(decoder->private_->seekable_stream_decoder, id); +} + +FLAC_API FLAC__bool FLAC__file_decoder_set_metadata_respond_all(FLAC__FileDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + FLAC__ASSERT(0 != decoder->private_->seekable_stream_decoder); + if(decoder->protected_->state != FLAC__FILE_DECODER_UNINITIALIZED) + return false; + return FLAC__seekable_stream_decoder_set_metadata_respond_all(decoder->private_->seekable_stream_decoder); +} + +FLAC_API FLAC__bool FLAC__file_decoder_set_metadata_ignore(FLAC__FileDecoder *decoder, FLAC__MetadataType type) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + FLAC__ASSERT(0 != decoder->private_->seekable_stream_decoder); + if(decoder->protected_->state != FLAC__FILE_DECODER_UNINITIALIZED) + return false; + return FLAC__seekable_stream_decoder_set_metadata_ignore(decoder->private_->seekable_stream_decoder, type); +} + +FLAC_API FLAC__bool FLAC__file_decoder_set_metadata_ignore_application(FLAC__FileDecoder *decoder, const FLAC__byte id[4]) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + FLAC__ASSERT(0 != decoder->private_->seekable_stream_decoder); + if(decoder->protected_->state != FLAC__FILE_DECODER_UNINITIALIZED) + return false; + return FLAC__seekable_stream_decoder_set_metadata_ignore_application(decoder->private_->seekable_stream_decoder, id); +} + +FLAC_API FLAC__bool FLAC__file_decoder_set_metadata_ignore_all(FLAC__FileDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + FLAC__ASSERT(0 != decoder->private_->seekable_stream_decoder); + if(decoder->protected_->state != FLAC__FILE_DECODER_UNINITIALIZED) + return false; + return FLAC__seekable_stream_decoder_set_metadata_ignore_all(decoder->private_->seekable_stream_decoder); +} + +FLAC_API FLAC__FileDecoderState FLAC__file_decoder_get_state(const FLAC__FileDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->protected_); + return decoder->protected_->state; +} + +FLAC_API FLAC__SeekableStreamDecoderState FLAC__file_decoder_get_seekable_stream_decoder_state(const FLAC__FileDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + return FLAC__seekable_stream_decoder_get_state(decoder->private_->seekable_stream_decoder); +} + +FLAC_API FLAC__StreamDecoderState FLAC__file_decoder_get_stream_decoder_state(const FLAC__FileDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + return FLAC__seekable_stream_decoder_get_stream_decoder_state(decoder->private_->seekable_stream_decoder); +} + +FLAC_API const char *FLAC__file_decoder_get_resolved_state_string(const FLAC__FileDecoder *decoder) +{ + if(decoder->protected_->state != FLAC__FILE_DECODER_SEEKABLE_STREAM_DECODER_ERROR) + return FLAC__FileDecoderStateString[decoder->protected_->state]; + else + return FLAC__seekable_stream_decoder_get_resolved_state_string(decoder->private_->seekable_stream_decoder); +} + +FLAC_API FLAC__bool FLAC__file_decoder_get_md5_checking(const FLAC__FileDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + return FLAC__seekable_stream_decoder_get_md5_checking(decoder->private_->seekable_stream_decoder); +} + +FLAC_API unsigned FLAC__file_decoder_get_channels(const FLAC__FileDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + return FLAC__seekable_stream_decoder_get_channels(decoder->private_->seekable_stream_decoder); +} + +FLAC_API FLAC__ChannelAssignment FLAC__file_decoder_get_channel_assignment(const FLAC__FileDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + return FLAC__seekable_stream_decoder_get_channel_assignment(decoder->private_->seekable_stream_decoder); +} + +FLAC_API unsigned FLAC__file_decoder_get_bits_per_sample(const FLAC__FileDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + return FLAC__seekable_stream_decoder_get_bits_per_sample(decoder->private_->seekable_stream_decoder); +} + +FLAC_API unsigned FLAC__file_decoder_get_sample_rate(const FLAC__FileDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + return FLAC__seekable_stream_decoder_get_sample_rate(decoder->private_->seekable_stream_decoder); +} + +FLAC_API unsigned FLAC__file_decoder_get_blocksize(const FLAC__FileDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + return FLAC__seekable_stream_decoder_get_blocksize(decoder->private_->seekable_stream_decoder); +} + +FLAC_API FLAC__bool FLAC__file_decoder_get_decode_position(const FLAC__FileDecoder *decoder, FLAC__uint64 *position) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + return FLAC__seekable_stream_decoder_get_decode_position(decoder->private_->seekable_stream_decoder, position); +} + +FLAC_API FLAC__bool FLAC__file_decoder_process_single(FLAC__FileDecoder *decoder) +{ + FLAC__bool ret; + FLAC__ASSERT(0 != decoder); + + if(decoder->private_->seekable_stream_decoder->protected_->state == FLAC__SEEKABLE_STREAM_DECODER_END_OF_STREAM) + decoder->protected_->state = FLAC__FILE_DECODER_END_OF_FILE; + + if(decoder->protected_->state == FLAC__FILE_DECODER_END_OF_FILE) + return true; + + FLAC__ASSERT(decoder->protected_->state == FLAC__FILE_DECODER_OK); + + ret = FLAC__seekable_stream_decoder_process_single(decoder->private_->seekable_stream_decoder); + if(!ret) + decoder->protected_->state = FLAC__FILE_DECODER_SEEKABLE_STREAM_DECODER_ERROR; + + return ret; +} + +FLAC_API FLAC__bool FLAC__file_decoder_process_until_end_of_metadata(FLAC__FileDecoder *decoder) +{ + FLAC__bool ret; + FLAC__ASSERT(0 != decoder); + + if(decoder->private_->seekable_stream_decoder->protected_->state == FLAC__SEEKABLE_STREAM_DECODER_END_OF_STREAM) + decoder->protected_->state = FLAC__FILE_DECODER_END_OF_FILE; + + if(decoder->protected_->state == FLAC__FILE_DECODER_END_OF_FILE) + return true; + + FLAC__ASSERT(decoder->protected_->state == FLAC__FILE_DECODER_OK); + + ret = FLAC__seekable_stream_decoder_process_until_end_of_metadata(decoder->private_->seekable_stream_decoder); + if(!ret) + decoder->protected_->state = FLAC__FILE_DECODER_SEEKABLE_STREAM_DECODER_ERROR; + + return ret; +} + +FLAC_API FLAC__bool FLAC__file_decoder_process_until_end_of_file(FLAC__FileDecoder *decoder) +{ + FLAC__bool ret; + FLAC__ASSERT(0 != decoder); + + if(decoder->private_->seekable_stream_decoder->protected_->state == FLAC__SEEKABLE_STREAM_DECODER_END_OF_STREAM) + decoder->protected_->state = FLAC__FILE_DECODER_END_OF_FILE; + + if(decoder->protected_->state == FLAC__FILE_DECODER_END_OF_FILE) + return true; + + FLAC__ASSERT(decoder->protected_->state == FLAC__FILE_DECODER_OK); + + ret = FLAC__seekable_stream_decoder_process_until_end_of_stream(decoder->private_->seekable_stream_decoder); + if(!ret) + decoder->protected_->state = FLAC__FILE_DECODER_SEEKABLE_STREAM_DECODER_ERROR; + + return ret; +} + +FLAC_API FLAC__bool FLAC__file_decoder_skip_single_frame(FLAC__FileDecoder *decoder) +{ + FLAC__bool ret; + FLAC__ASSERT(0 != decoder); + + if(decoder->private_->seekable_stream_decoder->protected_->state == FLAC__SEEKABLE_STREAM_DECODER_END_OF_STREAM) + decoder->protected_->state = FLAC__FILE_DECODER_END_OF_FILE; + + if(decoder->protected_->state == FLAC__FILE_DECODER_END_OF_FILE) + return true; + + FLAC__ASSERT(decoder->protected_->state == FLAC__FILE_DECODER_OK); + + ret = FLAC__seekable_stream_decoder_skip_single_frame(decoder->private_->seekable_stream_decoder); + if(!ret) + decoder->protected_->state = FLAC__FILE_DECODER_SEEKABLE_STREAM_DECODER_ERROR; + + return ret; +} + +FLAC_API FLAC__bool FLAC__file_decoder_seek_absolute(FLAC__FileDecoder *decoder, FLAC__uint64 sample) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(decoder->protected_->state == FLAC__FILE_DECODER_OK || decoder->protected_->state == FLAC__FILE_DECODER_END_OF_FILE); + + if(decoder->private_->filename == 0) { /* means the file is stdin... */ + decoder->protected_->state = FLAC__FILE_DECODER_SEEK_ERROR; + return false; + } + + if(!FLAC__seekable_stream_decoder_seek_absolute(decoder->private_->seekable_stream_decoder, sample)) { + decoder->protected_->state = FLAC__FILE_DECODER_SEEK_ERROR; + return false; + } + else { + decoder->protected_->state = FLAC__FILE_DECODER_OK; + return true; + } +} + + +/*********************************************************************** + * + * Private class methods + * + ***********************************************************************/ + +void set_defaults_(FLAC__FileDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + + decoder->private_->filename = 0; + decoder->private_->write_callback = 0; + decoder->private_->metadata_callback = 0; + decoder->private_->error_callback = 0; + decoder->private_->client_data = 0; +} + +/* + * This will forcibly set stdin to binary mode (for OSes that require it) + */ +FILE *get_binary_stdin_() +{ + /* if something breaks here it is probably due to the presence or + * absence of an underscore before the identifiers 'setmode', + * 'fileno', and/or 'O_BINARY'; check your system header files. + */ +#if defined _MSC_VER || defined __MINGW32__ + _setmode(_fileno(stdin), _O_BINARY); +#elif defined __CYGWIN__ + /* almost certainly not needed for any modern Cygwin, but let's be safe... */ + setmode(_fileno(stdin), _O_BINARY); +#endif + + return stdin; +} + +FLAC__SeekableStreamDecoderReadStatus read_callback_(const FLAC__SeekableStreamDecoder *decoder, FLAC__byte buffer[], unsigned *bytes, void *client_data) +{ + FLAC__FileDecoder *file_decoder = (FLAC__FileDecoder *)client_data; + (void)decoder; + + if(*bytes > 0) { + *bytes = (unsigned)fread(buffer, sizeof(FLAC__byte), *bytes, file_decoder->private_->file); + if(ferror(file_decoder->private_->file)) { + return FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_ERROR; + } + else { + return FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_OK; + } + } + else + return FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_ERROR; /* abort to avoid a deadlock */ +} + +FLAC__SeekableStreamDecoderSeekStatus seek_callback_(const FLAC__SeekableStreamDecoder *decoder, FLAC__uint64 absolute_byte_offset, void *client_data) +{ + FLAC__FileDecoder *file_decoder = (FLAC__FileDecoder *)client_data; + (void)decoder; + + if(fseek(file_decoder->private_->file, (long)absolute_byte_offset, SEEK_SET) < 0) + return FLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_ERROR; + else + return FLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_OK; +} + +FLAC__SeekableStreamDecoderTellStatus tell_callback_(const FLAC__SeekableStreamDecoder *decoder, FLAC__uint64 *absolute_byte_offset, void *client_data) +{ + FLAC__FileDecoder *file_decoder = (FLAC__FileDecoder *)client_data; + long pos; + (void)decoder; + + if((pos = ftell(file_decoder->private_->file)) < 0) + return FLAC__SEEKABLE_STREAM_DECODER_TELL_STATUS_ERROR; + else { + *absolute_byte_offset = (FLAC__uint64)pos; + return FLAC__SEEKABLE_STREAM_DECODER_TELL_STATUS_OK; + } +} + +FLAC__SeekableStreamDecoderLengthStatus length_callback_(const FLAC__SeekableStreamDecoder *decoder, FLAC__uint64 *stream_length, void *client_data) +{ + FLAC__FileDecoder *file_decoder = (FLAC__FileDecoder *)client_data; + struct stat filestats; + (void)decoder; + + if(0 == file_decoder->private_->filename || stat(file_decoder->private_->filename, &filestats) != 0) + return FLAC__SEEKABLE_STREAM_DECODER_LENGTH_STATUS_ERROR; + else { + *stream_length = (FLAC__uint64)filestats.st_size; + return FLAC__SEEKABLE_STREAM_DECODER_LENGTH_STATUS_OK; + } +} + +FLAC__bool eof_callback_(const FLAC__SeekableStreamDecoder *decoder, void *client_data) +{ + FLAC__FileDecoder *file_decoder = (FLAC__FileDecoder *)client_data; + (void)decoder; + + return feof(file_decoder->private_->file)? true : false; +} + +FLAC__StreamDecoderWriteStatus write_callback_(const FLAC__SeekableStreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data) +{ + FLAC__FileDecoder *file_decoder = (FLAC__FileDecoder *)client_data; + (void)decoder; + + return file_decoder->private_->write_callback(file_decoder, frame, buffer, file_decoder->private_->client_data); +} + +void metadata_callback_(const FLAC__SeekableStreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data) +{ + FLAC__FileDecoder *file_decoder = (FLAC__FileDecoder *)client_data; + (void)decoder; + + file_decoder->private_->metadata_callback(file_decoder, metadata, file_decoder->private_->client_data); +} + +void error_callback_(const FLAC__SeekableStreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data) +{ + FLAC__FileDecoder *file_decoder = (FLAC__FileDecoder *)client_data; + (void)decoder; + + file_decoder->private_->error_callback(file_decoder, status, file_decoder->private_->client_data); +} diff --git a/Libraries/FLAC/Files/src/libFLAC/file_encoder.c b/Libraries/FLAC/Files/src/libFLAC/file_encoder.c new file mode 100644 index 000000000..db4c421f9 --- /dev/null +++ b/Libraries/FLAC/Files/src/libFLAC/file_encoder.c @@ -0,0 +1,776 @@ +/* libFLAC - Free Lossless Audio Codec library + * Copyright (C) 2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include /* for malloc() */ +#include /* for strlen(), strcpy() */ +#include "FLAC/assert.h" +#include "protected/file_encoder.h" + +#ifdef max +#undef max +#endif +#define max(x,y) ((x)>(y)?(x):(y)) + +/*********************************************************************** + * + * Private class method prototypes + * + ***********************************************************************/ + +/* unpublished debug routines */ +extern FLAC__bool FLAC__seekable_stream_encoder_disable_constant_subframes(FLAC__SeekableStreamEncoder *encoder, FLAC__bool value); +extern FLAC__bool FLAC__seekable_stream_encoder_disable_fixed_subframes(FLAC__SeekableStreamEncoder *encoder, FLAC__bool value); +extern FLAC__bool FLAC__seekable_stream_encoder_disable_verbatim_subframes(FLAC__SeekableStreamEncoder *encoder, FLAC__bool value); + +static void set_defaults_(FLAC__FileEncoder *encoder); +static FLAC__SeekableStreamEncoderSeekStatus seek_callback_(const FLAC__SeekableStreamEncoder *encoder, FLAC__uint64 absolute_byte_offset, void *client_data); +static FLAC__SeekableStreamEncoderTellStatus tell_callback_(const FLAC__SeekableStreamEncoder *encoder, FLAC__uint64 *absolute_byte_offset, void *client_data); +static FLAC__StreamEncoderWriteStatus write_callback_(const FLAC__SeekableStreamEncoder *encoder, const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame, void *client_data); + +/*********************************************************************** + * + * Private class data + * + ***********************************************************************/ + +typedef struct FLAC__FileEncoderPrivate { + FLAC__FileEncoderProgressCallback progress_callback; + void *client_data; + char *filename; + FLAC__uint64 bytes_written; + FLAC__uint64 samples_written; + unsigned frames_written; + unsigned total_frames_estimate; + FLAC__SeekableStreamEncoder *seekable_stream_encoder; + FILE *file; +} FLAC__FileEncoderPrivate; + +/*********************************************************************** + * + * Public static class data + * + ***********************************************************************/ + +FLAC_API const char * const FLAC__FileEncoderStateString[] = { + "FLAC__FILE_ENCODER_OK", + "FLAC__FILE_ENCODER_NO_FILENAME", + "FLAC__FILE_ENCODER_SEEKABLE_STREAM_ENCODER_ERROR", + "FLAC__FILE_ENCODER_FATAL_ERROR_WHILE_WRITING", + "FLAC__FILE_ENCODER_ERROR_OPENING_FILE", + "FLAC__FILE_ENCODER_MEMORY_ALLOCATION_ERROR", + "FLAC__FILE_ENCODER_ALREADY_INITIALIZED", + "FLAC__FILE_ENCODER_UNINITIALIZED" +}; + + +/*********************************************************************** + * + * Class constructor/destructor + * + ***********************************************************************/ + +FLAC_API FLAC__FileEncoder *FLAC__file_encoder_new() +{ + FLAC__FileEncoder *encoder; + + FLAC__ASSERT(sizeof(int) >= 4); /* we want to die right away if this is not true */ + + encoder = (FLAC__FileEncoder*)calloc(1, sizeof(FLAC__FileEncoder)); + if(encoder == 0) { + return 0; + } + + encoder->protected_ = (FLAC__FileEncoderProtected*)calloc(1, sizeof(FLAC__FileEncoderProtected)); + if(encoder->protected_ == 0) { + free(encoder); + return 0; + } + + encoder->private_ = (FLAC__FileEncoderPrivate*)calloc(1, sizeof(FLAC__FileEncoderPrivate)); + if(encoder->private_ == 0) { + free(encoder->protected_); + free(encoder); + return 0; + } + + encoder->private_->seekable_stream_encoder = FLAC__seekable_stream_encoder_new(); + if(0 == encoder->private_->seekable_stream_encoder) { + free(encoder->private_); + free(encoder->protected_); + free(encoder); + return 0; + } + + encoder->private_->file = 0; + + set_defaults_(encoder); + + encoder->protected_->state = FLAC__FILE_ENCODER_UNINITIALIZED; + + return encoder; +} + +FLAC_API void FLAC__file_encoder_delete(FLAC__FileEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->private_->seekable_stream_encoder); + + (void)FLAC__file_encoder_finish(encoder); + + FLAC__seekable_stream_encoder_delete(encoder->private_->seekable_stream_encoder); + + free(encoder->private_); + free(encoder->protected_); + free(encoder); +} + +/*********************************************************************** + * + * Public class methods + * + ***********************************************************************/ + +FLAC_API FLAC__FileEncoderState FLAC__file_encoder_init(FLAC__FileEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + + if(encoder->protected_->state != FLAC__FILE_ENCODER_UNINITIALIZED) + return encoder->protected_->state = FLAC__FILE_ENCODER_ALREADY_INITIALIZED; + + if(0 == encoder->private_->filename) + return encoder->protected_->state = FLAC__FILE_ENCODER_NO_FILENAME; + + encoder->private_->file = fopen(encoder->private_->filename, "w+b"); + + if(encoder->private_->file == 0) + return encoder->protected_->state = FLAC__FILE_ENCODER_ERROR_OPENING_FILE; + + encoder->private_->bytes_written = 0; + encoder->private_->samples_written = 0; + encoder->private_->frames_written = 0; + + FLAC__seekable_stream_encoder_set_seek_callback(encoder->private_->seekable_stream_encoder, seek_callback_); + FLAC__seekable_stream_encoder_set_tell_callback(encoder->private_->seekable_stream_encoder, tell_callback_); + FLAC__seekable_stream_encoder_set_write_callback(encoder->private_->seekable_stream_encoder, write_callback_); + FLAC__seekable_stream_encoder_set_client_data(encoder->private_->seekable_stream_encoder, encoder); + + if(FLAC__seekable_stream_encoder_init(encoder->private_->seekable_stream_encoder) != FLAC__SEEKABLE_STREAM_ENCODER_OK) + return encoder->protected_->state = FLAC__FILE_ENCODER_SEEKABLE_STREAM_ENCODER_ERROR; + + { + unsigned blocksize = FLAC__file_encoder_get_blocksize(encoder); + + FLAC__ASSERT(blocksize != 0); + encoder->private_->total_frames_estimate = (unsigned)((FLAC__file_encoder_get_total_samples_estimate(encoder) + blocksize - 1) / blocksize); + } + + return encoder->protected_->state = FLAC__FILE_ENCODER_OK; +} + +FLAC_API void FLAC__file_encoder_finish(FLAC__FileEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + + if(encoder->protected_->state == FLAC__FILE_ENCODER_UNINITIALIZED) + return; + + FLAC__ASSERT(0 != encoder->private_->seekable_stream_encoder); + + /* FLAC__seekable_stream_encoder_finish() might write data so we must close the file after it. */ + + FLAC__seekable_stream_encoder_finish(encoder->private_->seekable_stream_encoder); + + if(0 != encoder->private_->file) { + fclose(encoder->private_->file); + encoder->private_->file = 0; + } + + if(0 != encoder->private_->filename) { + free(encoder->private_->filename); + encoder->private_->filename = 0; + } + + set_defaults_(encoder); + + encoder->protected_->state = FLAC__FILE_ENCODER_UNINITIALIZED; +} + +FLAC_API FLAC__bool FLAC__file_encoder_set_verify(FLAC__FileEncoder *encoder, FLAC__bool value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->seekable_stream_encoder); + if(encoder->protected_->state != FLAC__FILE_ENCODER_UNINITIALIZED) + return false; + return FLAC__seekable_stream_encoder_set_verify(encoder->private_->seekable_stream_encoder, value); +} + +FLAC_API FLAC__bool FLAC__file_encoder_set_streamable_subset(FLAC__FileEncoder *encoder, FLAC__bool value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->seekable_stream_encoder); + if(encoder->protected_->state != FLAC__FILE_ENCODER_UNINITIALIZED) + return false; + return FLAC__seekable_stream_encoder_set_streamable_subset(encoder->private_->seekable_stream_encoder, value); +} + +FLAC_API FLAC__bool FLAC__file_encoder_set_do_mid_side_stereo(FLAC__FileEncoder *encoder, FLAC__bool value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->seekable_stream_encoder); + if(encoder->protected_->state != FLAC__FILE_ENCODER_UNINITIALIZED) + return false; + return FLAC__seekable_stream_encoder_set_do_mid_side_stereo(encoder->private_->seekable_stream_encoder, value); +} + +FLAC_API FLAC__bool FLAC__file_encoder_set_loose_mid_side_stereo(FLAC__FileEncoder *encoder, FLAC__bool value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->seekable_stream_encoder); + if(encoder->protected_->state != FLAC__FILE_ENCODER_UNINITIALIZED) + return false; + return FLAC__seekable_stream_encoder_set_loose_mid_side_stereo(encoder->private_->seekable_stream_encoder, value); +} + +FLAC_API FLAC__bool FLAC__file_encoder_set_channels(FLAC__FileEncoder *encoder, unsigned value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->seekable_stream_encoder); + if(encoder->protected_->state != FLAC__FILE_ENCODER_UNINITIALIZED) + return false; + return FLAC__seekable_stream_encoder_set_channels(encoder->private_->seekable_stream_encoder, value); +} + +FLAC_API FLAC__bool FLAC__file_encoder_set_bits_per_sample(FLAC__FileEncoder *encoder, unsigned value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->seekable_stream_encoder); + if(encoder->protected_->state != FLAC__FILE_ENCODER_UNINITIALIZED) + return false; + return FLAC__seekable_stream_encoder_set_bits_per_sample(encoder->private_->seekable_stream_encoder, value); +} + +FLAC_API FLAC__bool FLAC__file_encoder_set_sample_rate(FLAC__FileEncoder *encoder, unsigned value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->seekable_stream_encoder); + if(encoder->protected_->state != FLAC__FILE_ENCODER_UNINITIALIZED) + return false; + return FLAC__seekable_stream_encoder_set_sample_rate(encoder->private_->seekable_stream_encoder, value); +} + +FLAC_API FLAC__bool FLAC__file_encoder_set_blocksize(FLAC__FileEncoder *encoder, unsigned value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->seekable_stream_encoder); + if(encoder->protected_->state != FLAC__FILE_ENCODER_UNINITIALIZED) + return false; + return FLAC__seekable_stream_encoder_set_blocksize(encoder->private_->seekable_stream_encoder, value); +} + +FLAC_API FLAC__bool FLAC__file_encoder_set_max_lpc_order(FLAC__FileEncoder *encoder, unsigned value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->seekable_stream_encoder); + if(encoder->protected_->state != FLAC__FILE_ENCODER_UNINITIALIZED) + return false; + return FLAC__seekable_stream_encoder_set_max_lpc_order(encoder->private_->seekable_stream_encoder, value); +} + +FLAC_API FLAC__bool FLAC__file_encoder_set_qlp_coeff_precision(FLAC__FileEncoder *encoder, unsigned value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->seekable_stream_encoder); + if(encoder->protected_->state != FLAC__FILE_ENCODER_UNINITIALIZED) + return false; + return FLAC__seekable_stream_encoder_set_qlp_coeff_precision(encoder->private_->seekable_stream_encoder, value); +} + +FLAC_API FLAC__bool FLAC__file_encoder_set_do_qlp_coeff_prec_search(FLAC__FileEncoder *encoder, FLAC__bool value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->seekable_stream_encoder); + if(encoder->protected_->state != FLAC__FILE_ENCODER_UNINITIALIZED) + return false; + return FLAC__seekable_stream_encoder_set_do_qlp_coeff_prec_search(encoder->private_->seekable_stream_encoder, value); +} + +FLAC_API FLAC__bool FLAC__file_encoder_set_do_escape_coding(FLAC__FileEncoder *encoder, FLAC__bool value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->seekable_stream_encoder); + if(encoder->protected_->state != FLAC__FILE_ENCODER_UNINITIALIZED) + return false; + return FLAC__seekable_stream_encoder_set_do_escape_coding(encoder->private_->seekable_stream_encoder, value); +} + +FLAC_API FLAC__bool FLAC__file_encoder_set_do_exhaustive_model_search(FLAC__FileEncoder *encoder, FLAC__bool value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->seekable_stream_encoder); + if(encoder->protected_->state != FLAC__FILE_ENCODER_UNINITIALIZED) + return false; + return FLAC__seekable_stream_encoder_set_do_exhaustive_model_search(encoder->private_->seekable_stream_encoder, value); +} + +FLAC_API FLAC__bool FLAC__file_encoder_set_min_residual_partition_order(FLAC__FileEncoder *encoder, unsigned value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->seekable_stream_encoder); + if(encoder->protected_->state != FLAC__FILE_ENCODER_UNINITIALIZED) + return false; + return FLAC__seekable_stream_encoder_set_min_residual_partition_order(encoder->private_->seekable_stream_encoder, value); +} + +FLAC_API FLAC__bool FLAC__file_encoder_set_max_residual_partition_order(FLAC__FileEncoder *encoder, unsigned value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->seekable_stream_encoder); + if(encoder->protected_->state != FLAC__FILE_ENCODER_UNINITIALIZED) + return false; + return FLAC__seekable_stream_encoder_set_max_residual_partition_order(encoder->private_->seekable_stream_encoder, value); +} + +FLAC_API FLAC__bool FLAC__file_encoder_set_rice_parameter_search_dist(FLAC__FileEncoder *encoder, unsigned value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->seekable_stream_encoder); + if(encoder->protected_->state != FLAC__FILE_ENCODER_UNINITIALIZED) + return false; + return FLAC__seekable_stream_encoder_set_rice_parameter_search_dist(encoder->private_->seekable_stream_encoder, value); +} + +FLAC_API FLAC__bool FLAC__file_encoder_set_total_samples_estimate(FLAC__FileEncoder *encoder, FLAC__uint64 value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->seekable_stream_encoder); + if(encoder->protected_->state != FLAC__FILE_ENCODER_UNINITIALIZED) + return false; + return FLAC__seekable_stream_encoder_set_total_samples_estimate(encoder->private_->seekable_stream_encoder, value); +} + +FLAC_API FLAC__bool FLAC__file_encoder_set_metadata(FLAC__FileEncoder *encoder, FLAC__StreamMetadata **metadata, unsigned num_blocks) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->seekable_stream_encoder); + if(encoder->protected_->state != FLAC__FILE_ENCODER_UNINITIALIZED) + return false; + return FLAC__seekable_stream_encoder_set_metadata(encoder->private_->seekable_stream_encoder, metadata, num_blocks); +} + +FLAC_API FLAC__bool FLAC__file_encoder_set_filename(FLAC__FileEncoder *encoder, const char *value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != value); + if(encoder->protected_->state != FLAC__FILE_ENCODER_UNINITIALIZED) + return false; + if(0 != encoder->private_->filename) { + free(encoder->private_->filename); + encoder->private_->filename = 0; + } + if(0 == (encoder->private_->filename = (char*)malloc(strlen(value)+1))) { + encoder->protected_->state = FLAC__FILE_ENCODER_MEMORY_ALLOCATION_ERROR; + return false; + } + strcpy(encoder->private_->filename, value); + return true; +} + +FLAC_API FLAC__bool FLAC__file_encoder_set_progress_callback(FLAC__FileEncoder *encoder, FLAC__FileEncoderProgressCallback value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + if(encoder->protected_->state != FLAC__FILE_ENCODER_UNINITIALIZED) + return false; + encoder->private_->progress_callback = value; + return true; +} + +FLAC_API FLAC__bool FLAC__file_encoder_set_client_data(FLAC__FileEncoder *encoder, void *value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + if(encoder->protected_->state != FLAC__FILE_ENCODER_UNINITIALIZED) + return false; + encoder->private_->client_data = value; + return true; +} + +/* + * These three functions are not static, but not publically exposed in + * include/FLAC/ either. They are used by the test suite. + */ +FLAC_API FLAC__bool FLAC__file_encoder_disable_constant_subframes(FLAC__FileEncoder *encoder, FLAC__bool value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + if(encoder->protected_->state != FLAC__FILE_ENCODER_UNINITIALIZED) + return false; + return FLAC__seekable_stream_encoder_disable_constant_subframes(encoder->private_->seekable_stream_encoder, value); +} + +FLAC_API FLAC__bool FLAC__file_encoder_disable_fixed_subframes(FLAC__FileEncoder *encoder, FLAC__bool value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + if(encoder->protected_->state != FLAC__FILE_ENCODER_UNINITIALIZED) + return false; + return FLAC__seekable_stream_encoder_disable_fixed_subframes(encoder->private_->seekable_stream_encoder, value); +} + +FLAC_API FLAC__bool FLAC__file_encoder_disable_verbatim_subframes(FLAC__FileEncoder *encoder, FLAC__bool value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + if(encoder->protected_->state != FLAC__FILE_ENCODER_UNINITIALIZED) + return false; + return FLAC__seekable_stream_encoder_disable_verbatim_subframes(encoder->private_->seekable_stream_encoder, value); +} + +FLAC_API FLAC__FileEncoderState FLAC__file_encoder_get_state(const FLAC__FileEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->protected_); + return encoder->protected_->state; +} + +FLAC_API FLAC__SeekableStreamEncoderState FLAC__file_encoder_get_seekable_stream_encoder_state(const FLAC__FileEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + return FLAC__seekable_stream_encoder_get_state(encoder->private_->seekable_stream_encoder); +} + +FLAC_API FLAC__StreamEncoderState FLAC__file_encoder_get_stream_encoder_state(const FLAC__FileEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + return FLAC__seekable_stream_encoder_get_stream_encoder_state(encoder->private_->seekable_stream_encoder); +} + +FLAC_API FLAC__StreamDecoderState FLAC__file_encoder_get_verify_decoder_state(const FLAC__FileEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + return FLAC__seekable_stream_encoder_get_verify_decoder_state(encoder->private_->seekable_stream_encoder); +} + +FLAC_API const char *FLAC__file_encoder_get_resolved_state_string(const FLAC__FileEncoder *encoder) +{ + if(encoder->protected_->state != FLAC__FILE_ENCODER_SEEKABLE_STREAM_ENCODER_ERROR) + return FLAC__FileEncoderStateString[encoder->protected_->state]; + else + return FLAC__seekable_stream_encoder_get_resolved_state_string(encoder->private_->seekable_stream_encoder); +} + +FLAC_API void FLAC__file_encoder_get_verify_decoder_error_stats(const FLAC__FileEncoder *encoder, FLAC__uint64 *absolute_sample, unsigned *frame_number, unsigned *channel, unsigned *sample, FLAC__int32 *expected, FLAC__int32 *got) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__seekable_stream_encoder_get_verify_decoder_error_stats(encoder->private_->seekable_stream_encoder, absolute_sample, frame_number, channel, sample, expected, got); +} + +FLAC_API FLAC__bool FLAC__file_encoder_get_verify(const FLAC__FileEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + return FLAC__seekable_stream_encoder_get_verify(encoder->private_->seekable_stream_encoder); +} + +FLAC_API FLAC__bool FLAC__file_encoder_get_streamable_subset(const FLAC__FileEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + return FLAC__seekable_stream_encoder_get_streamable_subset(encoder->private_->seekable_stream_encoder); +} + +FLAC_API FLAC__bool FLAC__file_encoder_get_do_mid_side_stereo(const FLAC__FileEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + return FLAC__seekable_stream_encoder_get_do_mid_side_stereo(encoder->private_->seekable_stream_encoder); +} + +FLAC_API FLAC__bool FLAC__file_encoder_get_loose_mid_side_stereo(const FLAC__FileEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + return FLAC__seekable_stream_encoder_get_loose_mid_side_stereo(encoder->private_->seekable_stream_encoder); +} + +FLAC_API unsigned FLAC__file_encoder_get_channels(const FLAC__FileEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + return FLAC__seekable_stream_encoder_get_channels(encoder->private_->seekable_stream_encoder); +} + +FLAC_API unsigned FLAC__file_encoder_get_bits_per_sample(const FLAC__FileEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + return FLAC__seekable_stream_encoder_get_bits_per_sample(encoder->private_->seekable_stream_encoder); +} + +FLAC_API unsigned FLAC__file_encoder_get_sample_rate(const FLAC__FileEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + return FLAC__seekable_stream_encoder_get_sample_rate(encoder->private_->seekable_stream_encoder); +} + +FLAC_API unsigned FLAC__file_encoder_get_blocksize(const FLAC__FileEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + return FLAC__seekable_stream_encoder_get_blocksize(encoder->private_->seekable_stream_encoder); +} + +FLAC_API unsigned FLAC__file_encoder_get_max_lpc_order(const FLAC__FileEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + return FLAC__seekable_stream_encoder_get_max_lpc_order(encoder->private_->seekable_stream_encoder); +} + +FLAC_API unsigned FLAC__file_encoder_get_qlp_coeff_precision(const FLAC__FileEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + return FLAC__seekable_stream_encoder_get_qlp_coeff_precision(encoder->private_->seekable_stream_encoder); +} + +FLAC_API FLAC__bool FLAC__file_encoder_get_do_qlp_coeff_prec_search(const FLAC__FileEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + return FLAC__seekable_stream_encoder_get_do_qlp_coeff_prec_search(encoder->private_->seekable_stream_encoder); +} + +FLAC_API FLAC__bool FLAC__file_encoder_get_do_escape_coding(const FLAC__FileEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + return FLAC__seekable_stream_encoder_get_do_escape_coding(encoder->private_->seekable_stream_encoder); +} + +FLAC_API FLAC__bool FLAC__file_encoder_get_do_exhaustive_model_search(const FLAC__FileEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + return FLAC__seekable_stream_encoder_get_do_exhaustive_model_search(encoder->private_->seekable_stream_encoder); +} + +FLAC_API unsigned FLAC__file_encoder_get_min_residual_partition_order(const FLAC__FileEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + return FLAC__seekable_stream_encoder_get_min_residual_partition_order(encoder->private_->seekable_stream_encoder); +} + +FLAC_API unsigned FLAC__file_encoder_get_max_residual_partition_order(const FLAC__FileEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + return FLAC__seekable_stream_encoder_get_max_residual_partition_order(encoder->private_->seekable_stream_encoder); +} + +FLAC_API unsigned FLAC__file_encoder_get_rice_parameter_search_dist(const FLAC__FileEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + return FLAC__seekable_stream_encoder_get_rice_parameter_search_dist(encoder->private_->seekable_stream_encoder); +} + +FLAC_API FLAC__uint64 FLAC__file_encoder_get_total_samples_estimate(const FLAC__FileEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + return FLAC__seekable_stream_encoder_get_total_samples_estimate(encoder->private_->seekable_stream_encoder); +} + +FLAC_API FLAC__bool FLAC__file_encoder_process(FLAC__FileEncoder *encoder, const FLAC__int32 * const buffer[], unsigned samples) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + if(!FLAC__seekable_stream_encoder_process(encoder->private_->seekable_stream_encoder, buffer, samples)) { + encoder->protected_->state = FLAC__FILE_ENCODER_SEEKABLE_STREAM_ENCODER_ERROR; + return false; + } + else + return true; +} + +/* 'samples' is channel-wide samples, e.g. for 1 second at 44100Hz, 'samples' = 44100 regardless of the number of channels */ +FLAC_API FLAC__bool FLAC__file_encoder_process_interleaved(FLAC__FileEncoder *encoder, const FLAC__int32 buffer[], unsigned samples) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + if(!FLAC__seekable_stream_encoder_process_interleaved(encoder->private_->seekable_stream_encoder, buffer, samples)) { + encoder->protected_->state = FLAC__FILE_ENCODER_SEEKABLE_STREAM_ENCODER_ERROR; + return false; + } + else + return true; +} + + +/*********************************************************************** + * + * Private class methods + * + ***********************************************************************/ + +void set_defaults_(FLAC__FileEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + + encoder->private_->progress_callback = 0; + encoder->private_->client_data = 0; + encoder->private_->total_frames_estimate = 0; + encoder->private_->filename = 0; +} + +FLAC__SeekableStreamEncoderSeekStatus seek_callback_(const FLAC__SeekableStreamEncoder *encoder, FLAC__uint64 absolute_byte_offset, void *client_data) +{ + FLAC__FileEncoder *file_encoder = (FLAC__FileEncoder*)client_data; + + (void)encoder; + + FLAC__ASSERT(0 != file_encoder); + + if(fseek(file_encoder->private_->file, (long)absolute_byte_offset, SEEK_SET) < 0) + return FLAC__SEEKABLE_STREAM_ENCODER_SEEK_STATUS_ERROR; + else + return FLAC__SEEKABLE_STREAM_ENCODER_SEEK_STATUS_OK; +} + +FLAC__SeekableStreamEncoderTellStatus tell_callback_(const FLAC__SeekableStreamEncoder *encoder, FLAC__uint64 *absolute_byte_offset, void *client_data) +{ + FLAC__FileEncoder *file_encoder = (FLAC__FileEncoder*)client_data; + long offset; + + (void)encoder; + + FLAC__ASSERT(0 != file_encoder); + + offset = ftell(file_encoder->private_->file); + + if(offset < 0) { + return FLAC__SEEKABLE_STREAM_ENCODER_TELL_STATUS_ERROR; + } + else { + *absolute_byte_offset = (FLAC__uint64)offset; + return FLAC__SEEKABLE_STREAM_ENCODER_TELL_STATUS_OK; + } +} + +#ifdef FLAC__VALGRIND_TESTING +static size_t local__fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream) +{ + size_t ret = fwrite(ptr, size, nmemb, stream); + if(!ferror(stream)) + fflush(stream); + return ret; +} +#else +#define local__fwrite fwrite +#endif + +FLAC__StreamEncoderWriteStatus write_callback_(const FLAC__SeekableStreamEncoder *encoder, const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame, void *client_data) +{ + FLAC__FileEncoder *file_encoder = (FLAC__FileEncoder*)client_data; + + (void)encoder, (void)samples, (void)current_frame; + + FLAC__ASSERT(0 != file_encoder); + + if(local__fwrite(buffer, sizeof(FLAC__byte), bytes, file_encoder->private_->file) == bytes) { + file_encoder->private_->bytes_written += bytes; + file_encoder->private_->samples_written += samples; + /* we keep a high watermark on the number of frames written because + * when the encoder goes back to write metadata, 'current_frame' + * will drop back to 0. + */ + file_encoder->private_->frames_written = max(file_encoder->private_->frames_written, current_frame+1); + if(0 != file_encoder->private_->progress_callback && samples > 0) + file_encoder->private_->progress_callback(file_encoder, file_encoder->private_->bytes_written, file_encoder->private_->samples_written, file_encoder->private_->frames_written, file_encoder->private_->total_frames_estimate, file_encoder->private_->client_data); + return FLAC__STREAM_ENCODER_WRITE_STATUS_OK; + } + else + return FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR; +} diff --git a/Libraries/FLAC/Files/src/libFLAC/fixed.c b/Libraries/FLAC/Files/src/libFLAC/fixed.c new file mode 100644 index 000000000..c1d4a52ba --- /dev/null +++ b/Libraries/FLAC/Files/src/libFLAC/fixed.c @@ -0,0 +1,422 @@ +/* libFLAC - Free Lossless Audio Codec library + * Copyright (C) 2000,2001,2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include "private/bitmath.h" +#include "private/fixed.h" +#include "FLAC/assert.h" + +#ifndef M_LN2 +/* math.h in VC++ doesn't seem to have this (how Microsoft is that?) */ +#define M_LN2 0.69314718055994530942 +#endif + +#ifdef min +#undef min +#endif +#define min(x,y) ((x) < (y)? (x) : (y)) + +#ifdef local_abs +#undef local_abs +#endif +#define local_abs(x) ((unsigned)((x)<0? -(x) : (x))) + +#ifdef FLAC__INTEGER_ONLY_LIBRARY +/* rbps stands for residual bits per sample + * + * (ln(2) * err) + * rbps = log (-----------) + * 2 ( n ) + */ +static FLAC__fixedpoint local__compute_rbps_integerized(FLAC__uint32 err, FLAC__uint32 n) +{ + FLAC__uint32 rbps; + unsigned bits; /* the number of bits required to represent a number */ + int fracbits; /* the number of bits of rbps that comprise the fractional part */ + + FLAC__ASSERT(sizeof(rbps) == sizeof(FLAC__fixedpoint)); + FLAC__ASSERT(err > 0); + FLAC__ASSERT(n > 0); + + FLAC__ASSERT(n <= FLAC__MAX_BLOCK_SIZE); + if(err <= n) + return 0; + /* + * The above two things tell us 1) n fits in 16 bits; 2) err/n > 1. + * These allow us later to know we won't lose too much precision in the + * fixed-point division (err< 0); + bits = FLAC__bitmath_ilog2(err)+1; + if(bits > 16) { + err >>= (bits-16); + fracbits -= (bits-16); + } + rbps = (FLAC__uint32)err; + + /* Multiply by fixed-point version of ln(2), with 16 fractional bits */ + rbps *= FLAC__FP_LN2; + fracbits += 16; + FLAC__ASSERT(fracbits >= 0); + + /* FLAC__fixedpoint_log2 requires fracbits%4 to be 0 */ + { + const int f = fracbits & 3; + if(f) { + rbps >>= f; + fracbits -= f; + } + } + + rbps = FLAC__fixedpoint_log2(rbps, fracbits, (unsigned)(-1)); + + if(rbps == 0) + return 0; + + /* + * The return value must have 16 fractional bits. Since the whole part + * of the base-2 log of a 32 bit number must fit in 5 bits, and fracbits + * must be >= -3, these assertion allows us to be able to shift rbps + * left if necessary to get 16 fracbits without losing any bits of the + * whole part of rbps. + * + * There is a slight chance due to accumulated error that the whole part + * will require 6 bits, so we use 6 in the assertion. Really though as + * long as it fits in 13 bits (32 - (16 - (-3))) we are fine. + */ + FLAC__ASSERT((int)FLAC__bitmath_ilog2(rbps)+1 <= fracbits + 6); + FLAC__ASSERT(fracbits >= -3); + + /* now shift the decimal point into place */ + if(fracbits < 16) + return rbps << (16-fracbits); + else if(fracbits > 16) + return rbps >> (fracbits-16); + else + return rbps; +} + +static FLAC__fixedpoint local__compute_rbps_wide_integerized(FLAC__uint64 err, FLAC__uint32 n) +{ + FLAC__uint32 rbps; + unsigned bits; /* the number of bits required to represent a number */ + int fracbits; /* the number of bits of rbps that comprise the fractional part */ + + FLAC__ASSERT(sizeof(rbps) == sizeof(FLAC__fixedpoint)); + FLAC__ASSERT(err > 0); + FLAC__ASSERT(n > 0); + + FLAC__ASSERT(n <= FLAC__MAX_BLOCK_SIZE); + if(err <= n) + return 0; + /* + * The above two things tell us 1) n fits in 16 bits; 2) err/n > 1. + * These allow us later to know we won't lose too much precision in the + * fixed-point division (err< 0); + bits = FLAC__bitmath_ilog2_wide(err)+1; + if(bits > 16) { + err >>= (bits-16); + fracbits -= (bits-16); + } + rbps = (FLAC__uint32)err; + + /* Multiply by fixed-point version of ln(2), with 16 fractional bits */ + rbps *= FLAC__FP_LN2; + fracbits += 16; + FLAC__ASSERT(fracbits >= 0); + + /* FLAC__fixedpoint_log2 requires fracbits%4 to be 0 */ + { + const int f = fracbits & 3; + if(f) { + rbps >>= f; + fracbits -= f; + } + } + + rbps = FLAC__fixedpoint_log2(rbps, fracbits, (unsigned)(-1)); + + if(rbps == 0) + return 0; + + /* + * The return value must have 16 fractional bits. Since the whole part + * of the base-2 log of a 32 bit number must fit in 5 bits, and fracbits + * must be >= -3, these assertion allows us to be able to shift rbps + * left if necessary to get 16 fracbits without losing any bits of the + * whole part of rbps. + * + * There is a slight chance due to accumulated error that the whole part + * will require 6 bits, so we use 6 in the assertion. Really though as + * long as it fits in 13 bits (32 - (16 - (-3))) we are fine. + */ + FLAC__ASSERT((int)FLAC__bitmath_ilog2(rbps)+1 <= fracbits + 6); + FLAC__ASSERT(fracbits >= -3); + + /* now shift the decimal point into place */ + if(fracbits < 16) + return rbps << (16-fracbits); + else if(fracbits > 16) + return rbps >> (fracbits-16); + else + return rbps; +} +#endif + +#ifndef FLAC__INTEGER_ONLY_LIBRARY +unsigned FLAC__fixed_compute_best_predictor(const FLAC__int32 data[], unsigned data_len, FLAC__float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]) +#else +unsigned FLAC__fixed_compute_best_predictor(const FLAC__int32 data[], unsigned data_len, FLAC__fixedpoint residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]) +#endif +{ + FLAC__int32 last_error_0 = data[-1]; + FLAC__int32 last_error_1 = data[-1] - data[-2]; + FLAC__int32 last_error_2 = last_error_1 - (data[-2] - data[-3]); + FLAC__int32 last_error_3 = last_error_2 - (data[-2] - 2*data[-3] + data[-4]); + FLAC__int32 error, save; + FLAC__uint32 total_error_0 = 0, total_error_1 = 0, total_error_2 = 0, total_error_3 = 0, total_error_4 = 0; + unsigned i, order; + + for(i = 0; i < data_len; i++) { + error = data[i] ; total_error_0 += local_abs(error); save = error; + error -= last_error_0; total_error_1 += local_abs(error); last_error_0 = save; save = error; + error -= last_error_1; total_error_2 += local_abs(error); last_error_1 = save; save = error; + error -= last_error_2; total_error_3 += local_abs(error); last_error_2 = save; save = error; + error -= last_error_3; total_error_4 += local_abs(error); last_error_3 = save; + } + + if(total_error_0 < min(min(min(total_error_1, total_error_2), total_error_3), total_error_4)) + order = 0; + else if(total_error_1 < min(min(total_error_2, total_error_3), total_error_4)) + order = 1; + else if(total_error_2 < min(total_error_3, total_error_4)) + order = 2; + else if(total_error_3 < total_error_4) + order = 3; + else + order = 4; + + /* Estimate the expected number of bits per residual signal sample. */ + /* 'total_error*' is linearly related to the variance of the residual */ + /* signal, so we use it directly to compute E(|x|) */ + FLAC__ASSERT(data_len > 0 || total_error_0 == 0); + FLAC__ASSERT(data_len > 0 || total_error_1 == 0); + FLAC__ASSERT(data_len > 0 || total_error_2 == 0); + FLAC__ASSERT(data_len > 0 || total_error_3 == 0); + FLAC__ASSERT(data_len > 0 || total_error_4 == 0); +#ifndef FLAC__INTEGER_ONLY_LIBRARY + residual_bits_per_sample[0] = (FLAC__float)((total_error_0 > 0) ? log(M_LN2 * (FLAC__double)total_error_0 / (FLAC__double)data_len) / M_LN2 : 0.0); + residual_bits_per_sample[1] = (FLAC__float)((total_error_1 > 0) ? log(M_LN2 * (FLAC__double)total_error_1 / (FLAC__double)data_len) / M_LN2 : 0.0); + residual_bits_per_sample[2] = (FLAC__float)((total_error_2 > 0) ? log(M_LN2 * (FLAC__double)total_error_2 / (FLAC__double)data_len) / M_LN2 : 0.0); + residual_bits_per_sample[3] = (FLAC__float)((total_error_3 > 0) ? log(M_LN2 * (FLAC__double)total_error_3 / (FLAC__double)data_len) / M_LN2 : 0.0); + residual_bits_per_sample[4] = (FLAC__float)((total_error_4 > 0) ? log(M_LN2 * (FLAC__double)total_error_4 / (FLAC__double)data_len) / M_LN2 : 0.0); +#else + residual_bits_per_sample[0] = (total_error_0 > 0) ? local__compute_rbps_integerized(total_error_0, data_len) : 0; + residual_bits_per_sample[1] = (total_error_1 > 0) ? local__compute_rbps_integerized(total_error_1, data_len) : 0; + residual_bits_per_sample[2] = (total_error_2 > 0) ? local__compute_rbps_integerized(total_error_2, data_len) : 0; + residual_bits_per_sample[3] = (total_error_3 > 0) ? local__compute_rbps_integerized(total_error_3, data_len) : 0; + residual_bits_per_sample[4] = (total_error_4 > 0) ? local__compute_rbps_integerized(total_error_4, data_len) : 0; +#endif + + return order; +} + +#ifndef FLAC__INTEGER_ONLY_LIBRARY +unsigned FLAC__fixed_compute_best_predictor_wide(const FLAC__int32 data[], unsigned data_len, FLAC__float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]) +#else +unsigned FLAC__fixed_compute_best_predictor_wide(const FLAC__int32 data[], unsigned data_len, FLAC__fixedpoint residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]) +#endif +{ + FLAC__int32 last_error_0 = data[-1]; + FLAC__int32 last_error_1 = data[-1] - data[-2]; + FLAC__int32 last_error_2 = last_error_1 - (data[-2] - data[-3]); + FLAC__int32 last_error_3 = last_error_2 - (data[-2] - 2*data[-3] + data[-4]); + FLAC__int32 error, save; + /* total_error_* are 64-bits to avoid overflow when encoding + * erratic signals when the bits-per-sample and blocksize are + * large. + */ + FLAC__uint64 total_error_0 = 0, total_error_1 = 0, total_error_2 = 0, total_error_3 = 0, total_error_4 = 0; + unsigned i, order; + + for(i = 0; i < data_len; i++) { + error = data[i] ; total_error_0 += local_abs(error); save = error; + error -= last_error_0; total_error_1 += local_abs(error); last_error_0 = save; save = error; + error -= last_error_1; total_error_2 += local_abs(error); last_error_1 = save; save = error; + error -= last_error_2; total_error_3 += local_abs(error); last_error_2 = save; save = error; + error -= last_error_3; total_error_4 += local_abs(error); last_error_3 = save; + } + + if(total_error_0 < min(min(min(total_error_1, total_error_2), total_error_3), total_error_4)) + order = 0; + else if(total_error_1 < min(min(total_error_2, total_error_3), total_error_4)) + order = 1; + else if(total_error_2 < min(total_error_3, total_error_4)) + order = 2; + else if(total_error_3 < total_error_4) + order = 3; + else + order = 4; + + /* Estimate the expected number of bits per residual signal sample. */ + /* 'total_error*' is linearly related to the variance of the residual */ + /* signal, so we use it directly to compute E(|x|) */ + FLAC__ASSERT(data_len > 0 || total_error_0 == 0); + FLAC__ASSERT(data_len > 0 || total_error_1 == 0); + FLAC__ASSERT(data_len > 0 || total_error_2 == 0); + FLAC__ASSERT(data_len > 0 || total_error_3 == 0); + FLAC__ASSERT(data_len > 0 || total_error_4 == 0); +#ifndef FLAC__INTEGER_ONLY_LIBRARY +#if defined _MSC_VER || defined __MINGW32__ + /* with MSVC you have to spoon feed it the casting */ + residual_bits_per_sample[0] = (FLAC__float)((total_error_0 > 0) ? log(M_LN2 * (FLAC__double)(FLAC__int64)total_error_0 / (FLAC__double)data_len) / M_LN2 : 0.0); + residual_bits_per_sample[1] = (FLAC__float)((total_error_1 > 0) ? log(M_LN2 * (FLAC__double)(FLAC__int64)total_error_1 / (FLAC__double)data_len) / M_LN2 : 0.0); + residual_bits_per_sample[2] = (FLAC__float)((total_error_2 > 0) ? log(M_LN2 * (FLAC__double)(FLAC__int64)total_error_2 / (FLAC__double)data_len) / M_LN2 : 0.0); + residual_bits_per_sample[3] = (FLAC__float)((total_error_3 > 0) ? log(M_LN2 * (FLAC__double)(FLAC__int64)total_error_3 / (FLAC__double)data_len) / M_LN2 : 0.0); + residual_bits_per_sample[4] = (FLAC__float)((total_error_4 > 0) ? log(M_LN2 * (FLAC__double)(FLAC__int64)total_error_4 / (FLAC__double)data_len) / M_LN2 : 0.0); +#else + residual_bits_per_sample[0] = (FLAC__float)((total_error_0 > 0) ? log(M_LN2 * (FLAC__double)total_error_0 / (FLAC__double)data_len) / M_LN2 : 0.0); + residual_bits_per_sample[1] = (FLAC__float)((total_error_1 > 0) ? log(M_LN2 * (FLAC__double)total_error_1 / (FLAC__double)data_len) / M_LN2 : 0.0); + residual_bits_per_sample[2] = (FLAC__float)((total_error_2 > 0) ? log(M_LN2 * (FLAC__double)total_error_2 / (FLAC__double)data_len) / M_LN2 : 0.0); + residual_bits_per_sample[3] = (FLAC__float)((total_error_3 > 0) ? log(M_LN2 * (FLAC__double)total_error_3 / (FLAC__double)data_len) / M_LN2 : 0.0); + residual_bits_per_sample[4] = (FLAC__float)((total_error_4 > 0) ? log(M_LN2 * (FLAC__double)total_error_4 / (FLAC__double)data_len) / M_LN2 : 0.0); +#endif +#else + residual_bits_per_sample[0] = (total_error_0 > 0) ? local__compute_rbps_wide_integerized(total_error_0, data_len) : 0; + residual_bits_per_sample[1] = (total_error_1 > 0) ? local__compute_rbps_wide_integerized(total_error_1, data_len) : 0; + residual_bits_per_sample[2] = (total_error_2 > 0) ? local__compute_rbps_wide_integerized(total_error_2, data_len) : 0; + residual_bits_per_sample[3] = (total_error_3 > 0) ? local__compute_rbps_wide_integerized(total_error_3, data_len) : 0; + residual_bits_per_sample[4] = (total_error_4 > 0) ? local__compute_rbps_wide_integerized(total_error_4, data_len) : 0; +#endif + + return order; +} + +void FLAC__fixed_compute_residual(const FLAC__int32 data[], unsigned data_len, unsigned order, FLAC__int32 residual[]) +{ + const int idata_len = (int)data_len; + int i; + + switch(order) { + case 0: + for(i = 0; i < idata_len; i++) { + residual[i] = data[i]; + } + break; + case 1: + for(i = 0; i < idata_len; i++) { + residual[i] = data[i] - data[i-1]; + } + break; + case 2: + for(i = 0; i < idata_len; i++) { + /* == data[i] - 2*data[i-1] + data[i-2] */ + residual[i] = data[i] - (data[i-1] << 1) + data[i-2]; + } + break; + case 3: + for(i = 0; i < idata_len; i++) { + /* == data[i] - 3*data[i-1] + 3*data[i-2] - data[i-3] */ + residual[i] = data[i] - (((data[i-1]-data[i-2])<<1) + (data[i-1]-data[i-2])) - data[i-3]; + } + break; + case 4: + for(i = 0; i < idata_len; i++) { + /* == data[i] - 4*data[i-1] + 6*data[i-2] - 4*data[i-3] + data[i-4] */ + residual[i] = data[i] - ((data[i-1]+data[i-3])<<2) + ((data[i-2]<<2) + (data[i-2]<<1)) + data[i-4]; + } + break; + default: + FLAC__ASSERT(0); + } +} + +void FLAC__fixed_restore_signal(const FLAC__int32 residual[], unsigned data_len, unsigned order, FLAC__int32 data[]) +{ + int i, idata_len = (int)data_len; + + switch(order) { + case 0: + for(i = 0; i < idata_len; i++) { + data[i] = residual[i]; + } + break; + case 1: + for(i = 0; i < idata_len; i++) { + data[i] = residual[i] + data[i-1]; + } + break; + case 2: + for(i = 0; i < idata_len; i++) { + /* == residual[i] + 2*data[i-1] - data[i-2] */ + data[i] = residual[i] + (data[i-1]<<1) - data[i-2]; + } + break; + case 3: + for(i = 0; i < idata_len; i++) { + /* residual[i] + 3*data[i-1] - 3*data[i-2]) + data[i-3] */ + data[i] = residual[i] + (((data[i-1]-data[i-2])<<1) + (data[i-1]-data[i-2])) + data[i-3]; + } + break; + case 4: + for(i = 0; i < idata_len; i++) { + /* == residual[i] + 4*data[i-1] - 6*data[i-2] + 4*data[i-3] - data[i-4] */ + data[i] = residual[i] + ((data[i-1]+data[i-3])<<2) - ((data[i-2]<<2) + (data[i-2]<<1)) - data[i-4]; + } + break; + default: + FLAC__ASSERT(0); + } +} diff --git a/Libraries/FLAC/Files/src/libFLAC/float.c b/Libraries/FLAC/Files/src/libFLAC/float.c new file mode 100644 index 000000000..cbb381d43 --- /dev/null +++ b/Libraries/FLAC/Files/src/libFLAC/float.c @@ -0,0 +1,304 @@ +/* libFLAC - Free Lossless Audio Codec library + * Copyright (C) 2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "FLAC/assert.h" + +#include "private/float.h" + +#ifdef FLAC__INTEGER_ONLY_LIBRARY + +/* adjust for compilers that can't understand using LLU suffix for uint64_t literals */ +#ifdef _MSC_VER +#define FLAC__U64L(x) x +#else +#define FLAC__U64L(x) x##LLU +#endif + +const FLAC__fixedpoint FLAC__FP_ZERO = 0; +const FLAC__fixedpoint FLAC__FP_ONE_HALF = 0x00008000; +const FLAC__fixedpoint FLAC__FP_ONE = 0x00010000; +const FLAC__fixedpoint FLAC__FP_LN2 = 45426; +const FLAC__fixedpoint FLAC__FP_E = 178145; + +/* Lookup tables for Knuth's logarithm algorithm */ +#define LOG2_LOOKUP_PRECISION 16 +static const FLAC__uint32 log2_lookup[][LOG2_LOOKUP_PRECISION] = { + { + /* + * 0 fraction bits + */ + /* undefined */ 0x00000000, + /* lg(2/1) = */ 0x00000001, + /* lg(4/3) = */ 0x00000000, + /* lg(8/7) = */ 0x00000000, + /* lg(16/15) = */ 0x00000000, + /* lg(32/31) = */ 0x00000000, + /* lg(64/63) = */ 0x00000000, + /* lg(128/127) = */ 0x00000000, + /* lg(256/255) = */ 0x00000000, + /* lg(512/511) = */ 0x00000000, + /* lg(1024/1023) = */ 0x00000000, + /* lg(2048/2047) = */ 0x00000000, + /* lg(4096/4095) = */ 0x00000000, + /* lg(8192/8191) = */ 0x00000000, + /* lg(16384/16383) = */ 0x00000000, + /* lg(32768/32767) = */ 0x00000000 + }, + { + /* + * 4 fraction bits + */ + /* undefined */ 0x00000000, + /* lg(2/1) = */ 0x00000010, + /* lg(4/3) = */ 0x00000007, + /* lg(8/7) = */ 0x00000003, + /* lg(16/15) = */ 0x00000001, + /* lg(32/31) = */ 0x00000001, + /* lg(64/63) = */ 0x00000000, + /* lg(128/127) = */ 0x00000000, + /* lg(256/255) = */ 0x00000000, + /* lg(512/511) = */ 0x00000000, + /* lg(1024/1023) = */ 0x00000000, + /* lg(2048/2047) = */ 0x00000000, + /* lg(4096/4095) = */ 0x00000000, + /* lg(8192/8191) = */ 0x00000000, + /* lg(16384/16383) = */ 0x00000000, + /* lg(32768/32767) = */ 0x00000000 + }, + { + /* + * 8 fraction bits + */ + /* undefined */ 0x00000000, + /* lg(2/1) = */ 0x00000100, + /* lg(4/3) = */ 0x0000006a, + /* lg(8/7) = */ 0x00000031, + /* lg(16/15) = */ 0x00000018, + /* lg(32/31) = */ 0x0000000c, + /* lg(64/63) = */ 0x00000006, + /* lg(128/127) = */ 0x00000003, + /* lg(256/255) = */ 0x00000001, + /* lg(512/511) = */ 0x00000001, + /* lg(1024/1023) = */ 0x00000000, + /* lg(2048/2047) = */ 0x00000000, + /* lg(4096/4095) = */ 0x00000000, + /* lg(8192/8191) = */ 0x00000000, + /* lg(16384/16383) = */ 0x00000000, + /* lg(32768/32767) = */ 0x00000000 + }, + { + /* + * 12 fraction bits + */ + /* undefined */ 0x00000000, + /* lg(2/1) = */ 0x00001000, + /* lg(4/3) = */ 0x000006a4, + /* lg(8/7) = */ 0x00000315, + /* lg(16/15) = */ 0x0000017d, + /* lg(32/31) = */ 0x000000bc, + /* lg(64/63) = */ 0x0000005d, + /* lg(128/127) = */ 0x0000002e, + /* lg(256/255) = */ 0x00000017, + /* lg(512/511) = */ 0x0000000c, + /* lg(1024/1023) = */ 0x00000006, + /* lg(2048/2047) = */ 0x00000003, + /* lg(4096/4095) = */ 0x00000001, + /* lg(8192/8191) = */ 0x00000001, + /* lg(16384/16383) = */ 0x00000000, + /* lg(32768/32767) = */ 0x00000000 + }, + { + /* + * 16 fraction bits + */ + /* undefined */ 0x00000000, + /* lg(2/1) = */ 0x00010000, + /* lg(4/3) = */ 0x00006a40, + /* lg(8/7) = */ 0x00003151, + /* lg(16/15) = */ 0x000017d6, + /* lg(32/31) = */ 0x00000bba, + /* lg(64/63) = */ 0x000005d1, + /* lg(128/127) = */ 0x000002e6, + /* lg(256/255) = */ 0x00000172, + /* lg(512/511) = */ 0x000000b9, + /* lg(1024/1023) = */ 0x0000005c, + /* lg(2048/2047) = */ 0x0000002e, + /* lg(4096/4095) = */ 0x00000017, + /* lg(8192/8191) = */ 0x0000000c, + /* lg(16384/16383) = */ 0x00000006, + /* lg(32768/32767) = */ 0x00000003 + }, + { + /* + * 20 fraction bits + */ + /* undefined */ 0x00000000, + /* lg(2/1) = */ 0x00100000, + /* lg(4/3) = */ 0x0006a3fe, + /* lg(8/7) = */ 0x00031513, + /* lg(16/15) = */ 0x00017d60, + /* lg(32/31) = */ 0x0000bb9d, + /* lg(64/63) = */ 0x00005d10, + /* lg(128/127) = */ 0x00002e59, + /* lg(256/255) = */ 0x00001721, + /* lg(512/511) = */ 0x00000b8e, + /* lg(1024/1023) = */ 0x000005c6, + /* lg(2048/2047) = */ 0x000002e3, + /* lg(4096/4095) = */ 0x00000171, + /* lg(8192/8191) = */ 0x000000b9, + /* lg(16384/16383) = */ 0x0000005c, + /* lg(32768/32767) = */ 0x0000002e + }, + { + /* + * 24 fraction bits + */ + /* undefined */ 0x00000000, + /* lg(2/1) = */ 0x01000000, + /* lg(4/3) = */ 0x006a3fe6, + /* lg(8/7) = */ 0x00315130, + /* lg(16/15) = */ 0x0017d605, + /* lg(32/31) = */ 0x000bb9ca, + /* lg(64/63) = */ 0x0005d0fc, + /* lg(128/127) = */ 0x0002e58f, + /* lg(256/255) = */ 0x0001720e, + /* lg(512/511) = */ 0x0000b8d8, + /* lg(1024/1023) = */ 0x00005c61, + /* lg(2048/2047) = */ 0x00002e2d, + /* lg(4096/4095) = */ 0x00001716, + /* lg(8192/8191) = */ 0x00000b8b, + /* lg(16384/16383) = */ 0x000005c5, + /* lg(32768/32767) = */ 0x000002e3 + }, + { + /* + * 28 fraction bits + */ + /* undefined */ 0x00000000, + /* lg(2/1) = */ 0x10000000, + /* lg(4/3) = */ 0x06a3fe5c, + /* lg(8/7) = */ 0x03151301, + /* lg(16/15) = */ 0x017d6049, + /* lg(32/31) = */ 0x00bb9ca6, + /* lg(64/63) = */ 0x005d0fba, + /* lg(128/127) = */ 0x002e58f7, + /* lg(256/255) = */ 0x001720da, + /* lg(512/511) = */ 0x000b8d87, + /* lg(1024/1023) = */ 0x0005c60b, + /* lg(2048/2047) = */ 0x0002e2d7, + /* lg(4096/4095) = */ 0x00017160, + /* lg(8192/8191) = */ 0x0000b8ad, + /* lg(16384/16383) = */ 0x00005c56, + /* lg(32768/32767) = */ 0x00002e2b + } +}; + +#if 0 +static const FLAC__uint64 log2_lookup_wide[] = { + { + /* + * 32 fraction bits + */ + /* undefined */ 0x00000000, + /* lg(2/1) = */ FLAC__U64L(0x100000000), + /* lg(4/3) = */ FLAC__U64L(0x6a3fe5c6), + /* lg(8/7) = */ FLAC__U64L(0x31513015), + /* lg(16/15) = */ FLAC__U64L(0x17d60497), + /* lg(32/31) = */ FLAC__U64L(0x0bb9ca65), + /* lg(64/63) = */ FLAC__U64L(0x05d0fba2), + /* lg(128/127) = */ FLAC__U64L(0x02e58f74), + /* lg(256/255) = */ FLAC__U64L(0x01720d9c), + /* lg(512/511) = */ FLAC__U64L(0x00b8d875), + /* lg(1024/1023) = */ FLAC__U64L(0x005c60aa), + /* lg(2048/2047) = */ FLAC__U64L(0x002e2d72), + /* lg(4096/4095) = */ FLAC__U64L(0x00171600), + /* lg(8192/8191) = */ FLAC__U64L(0x000b8ad2), + /* lg(16384/16383) = */ FLAC__U64L(0x0005c55d), + /* lg(32768/32767) = */ FLAC__U64L(0x0002e2ac) + }, + { + /* + * 48 fraction bits + */ + /* undefined */ 0x00000000, + /* lg(2/1) = */ FLAC__U64L(0x1000000000000), + /* lg(4/3) = */ FLAC__U64L(0x6a3fe5c60429), + /* lg(8/7) = */ FLAC__U64L(0x315130157f7a), + /* lg(16/15) = */ FLAC__U64L(0x17d60496cfbb), + /* lg(32/31) = */ FLAC__U64L(0xbb9ca64ecac), + /* lg(64/63) = */ FLAC__U64L(0x5d0fba187cd), + /* lg(128/127) = */ FLAC__U64L(0x2e58f7441ee), + /* lg(256/255) = */ FLAC__U64L(0x1720d9c06a8), + /* lg(512/511) = */ FLAC__U64L(0xb8d8752173), + /* lg(1024/1023) = */ FLAC__U64L(0x5c60aa252e), + /* lg(2048/2047) = */ FLAC__U64L(0x2e2d71b0d8), + /* lg(4096/4095) = */ FLAC__U64L(0x1716001719), + /* lg(8192/8191) = */ FLAC__U64L(0xb8ad1de1b), + /* lg(16384/16383) = */ FLAC__U64L(0x5c55d640d), + /* lg(32768/32767) = */ FLAC__U64L(0x2e2abcf52) + } +}; +#endif + +FLAC__uint32 FLAC__fixedpoint_log2(FLAC__uint32 x, unsigned fracbits, unsigned precision) +{ + const FLAC__uint32 ONE = (1u << fracbits); + const FLAC__uint32 *table = log2_lookup[fracbits >> 2]; + + FLAC__ASSERT(fracbits < 32); + FLAC__ASSERT((fracbits & 0x3) == 0); + + if(x < ONE) + return 0; + + if(precision > LOG2_LOOKUP_PRECISION) + precision = LOG2_LOOKUP_PRECISION; + + /* Knuth's algorithm for computing logarithms, optimized for base-2 with lookup tables */ + { + FLAC__uint32 y = 0; + FLAC__uint32 z = x >> 1, k = 1; + while (x > ONE && k < precision) { + if (x - z >= ONE) { + x -= z; + z = x >> k; + y += table[k]; + } + else { + z >>= 1; + k++; + } + } + return y; + } +} + +#endif /* defined FLAC__INTEGER_ONLY_LIBRARY */ diff --git a/Libraries/FLAC/Files/src/libFLAC/format.c b/Libraries/FLAC/Files/src/libFLAC/format.c new file mode 100644 index 000000000..25ec7d98b --- /dev/null +++ b/Libraries/FLAC/Files/src/libFLAC/format.c @@ -0,0 +1,474 @@ +/* libFLAC - Free Lossless Audio Codec library + * Copyright (C) 2000,2001,2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include /* for qsort() */ +#include "FLAC/assert.h" +#include "FLAC/format.h" +#include "private/format.h" + +#ifdef HAVE_CONFIG_H +#include +#endif + +#ifdef min +#undef min +#endif +#define min(a,b) ((a)<(b)?(a):(b)) + +/* adjust for compilers that can't understand using LLU suffix for uint64_t literals */ +#ifdef _MSC_VER +#define FLAC__U64L(x) x +#else +#define FLAC__U64L(x) x##LLU +#endif + +/* VERSION should come from configure */ +FLAC_API const char *FLAC__VERSION_STRING = VERSION; + +#if defined _MSC_VER || defined __MINW32__ +/* yet one more hack because of MSVC6: */ +FLAC_API const char *FLAC__VENDOR_STRING = "reference libFLAC 1.1.2 20050205"; +#else +FLAC_API const char *FLAC__VENDOR_STRING = "reference libFLAC " VERSION " 20050205"; +#endif + +FLAC_API const FLAC__byte FLAC__STREAM_SYNC_STRING[4] = { 'f','L','a','C' }; +FLAC_API const unsigned FLAC__STREAM_SYNC = 0x664C6143; +FLAC_API const unsigned FLAC__STREAM_SYNC_LEN = 32; /* bits */; + +FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_MIN_BLOCK_SIZE_LEN = 16; /* bits */ +FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_MAX_BLOCK_SIZE_LEN = 16; /* bits */ +FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_MIN_FRAME_SIZE_LEN = 24; /* bits */ +FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_MAX_FRAME_SIZE_LEN = 24; /* bits */ +FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_SAMPLE_RATE_LEN = 20; /* bits */ +FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_CHANNELS_LEN = 3; /* bits */ +FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_BITS_PER_SAMPLE_LEN = 5; /* bits */ +FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_TOTAL_SAMPLES_LEN = 36; /* bits */ +FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_MD5SUM_LEN = 128; /* bits */ + +FLAC_API const unsigned FLAC__STREAM_METADATA_APPLICATION_ID_LEN = 32; /* bits */ + +FLAC_API const unsigned FLAC__STREAM_METADATA_SEEKPOINT_SAMPLE_NUMBER_LEN = 64; /* bits */ +FLAC_API const unsigned FLAC__STREAM_METADATA_SEEKPOINT_STREAM_OFFSET_LEN = 64; /* bits */ +FLAC_API const unsigned FLAC__STREAM_METADATA_SEEKPOINT_FRAME_SAMPLES_LEN = 16; /* bits */ + +FLAC_API const FLAC__uint64 FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER = FLAC__U64L(0xffffffffffffffff); + +FLAC_API const unsigned FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN = 32; /* bits */ +FLAC_API const unsigned FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN = 32; /* bits */ + +FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_INDEX_OFFSET_LEN = 64; /* bits */ +FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_INDEX_NUMBER_LEN = 8; /* bits */ +FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_INDEX_RESERVED_LEN = 3*8; /* bits */ + +FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_OFFSET_LEN = 64; /* bits */ +FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_NUMBER_LEN = 8; /* bits */ +FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_ISRC_LEN = 12*8; /* bits */ +FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_TYPE_LEN = 1; /* bit */ +FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_PRE_EMPHASIS_LEN = 1; /* bit */ +FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_RESERVED_LEN = 6+13*8; /* bits */ +FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_NUM_INDICES_LEN = 8; /* bits */ + +FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_MEDIA_CATALOG_NUMBER_LEN = 128*8; /* bits */ +FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_LEAD_IN_LEN = 64; /* bits */ +FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_IS_CD_LEN = 1; /* bit */ +FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_RESERVED_LEN = 7+258*8; /* bits */ +FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_NUM_TRACKS_LEN = 8; /* bits */ + +FLAC_API const unsigned FLAC__STREAM_METADATA_IS_LAST_LEN = 1; /* bits */ +FLAC_API const unsigned FLAC__STREAM_METADATA_TYPE_LEN = 7; /* bits */ +FLAC_API const unsigned FLAC__STREAM_METADATA_LENGTH_LEN = 24; /* bits */ + +FLAC_API const unsigned FLAC__FRAME_HEADER_SYNC = 0x3ffe; +FLAC_API const unsigned FLAC__FRAME_HEADER_SYNC_LEN = 14; /* bits */ +FLAC_API const unsigned FLAC__FRAME_HEADER_RESERVED_LEN = 2; /* bits */ +FLAC_API const unsigned FLAC__FRAME_HEADER_BLOCK_SIZE_LEN = 4; /* bits */ +FLAC_API const unsigned FLAC__FRAME_HEADER_SAMPLE_RATE_LEN = 4; /* bits */ +FLAC_API const unsigned FLAC__FRAME_HEADER_CHANNEL_ASSIGNMENT_LEN = 4; /* bits */ +FLAC_API const unsigned FLAC__FRAME_HEADER_BITS_PER_SAMPLE_LEN = 3; /* bits */ +FLAC_API const unsigned FLAC__FRAME_HEADER_ZERO_PAD_LEN = 1; /* bits */ +FLAC_API const unsigned FLAC__FRAME_HEADER_CRC_LEN = 8; /* bits */ + +FLAC_API const unsigned FLAC__FRAME_FOOTER_CRC_LEN = 16; /* bits */ + +FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_TYPE_LEN = 2; /* bits */ +FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ORDER_LEN = 4; /* bits */ +FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN = 4; /* bits */ +FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_RAW_LEN = 5; /* bits */ + +FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER = 15; /* == (1< FLAC__MAX_SAMPLE_RATE || + ( + sample_rate >= (1u << 16) && + !(sample_rate % 1000 == 0 || sample_rate % 10 == 0) + ) + ) { + return false; + } + else + return true; +} + +FLAC_API FLAC__bool FLAC__format_seektable_is_legal(const FLAC__StreamMetadata_SeekTable *seek_table) +{ + unsigned i; + FLAC__uint64 prev_sample_number = 0; + FLAC__bool got_prev = false; + + FLAC__ASSERT(0 != seek_table); + + for(i = 0; i < seek_table->num_points; i++) { + if(got_prev) { + if( + seek_table->points[i].sample_number != FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER && + seek_table->points[i].sample_number <= prev_sample_number + ) + return false; + } + prev_sample_number = seek_table->points[i].sample_number; + got_prev = true; + } + + return true; +} + +/* used as the sort predicate for qsort() */ +static int seekpoint_compare_(const FLAC__StreamMetadata_SeekPoint *l, const FLAC__StreamMetadata_SeekPoint *r) +{ + /* we don't just 'return l->sample_number - r->sample_number' since the result (FLAC__int64) might overflow an 'int' */ + if(l->sample_number == r->sample_number) + return 0; + else if(l->sample_number < r->sample_number) + return -1; + else + return 1; +} + +FLAC_API unsigned FLAC__format_seektable_sort(FLAC__StreamMetadata_SeekTable *seek_table) +{ + unsigned i, j; + FLAC__bool first; + + FLAC__ASSERT(0 != seek_table); + + /* sort the seekpoints */ + qsort(seek_table->points, seek_table->num_points, sizeof(FLAC__StreamMetadata_SeekPoint), (int (*)(const void *, const void *))seekpoint_compare_); + + /* uniquify the seekpoints */ + first = true; + for(i = j = 0; i < seek_table->num_points; i++) { + if(seek_table->points[i].sample_number != FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER) { + if(!first) { + if(seek_table->points[i].sample_number == seek_table->points[j-1].sample_number) + continue; + } + } + first = false; + seek_table->points[j++] = seek_table->points[i]; + } + + for(i = j; i < seek_table->num_points; i++) { + seek_table->points[i].sample_number = FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER; + seek_table->points[i].stream_offset = 0; + seek_table->points[i].frame_samples = 0; + } + + return j; +} + +static __inline unsigned utf8len_(const FLAC__byte *utf8) +{ + FLAC__ASSERT(0 != utf8); + if ((utf8[0] & 0x80) == 0) + return 1; + else if ((utf8[0] & 0xE0) == 0xC0 && (utf8[1] & 0xC0) == 0x80) + return 2; + else if ((utf8[0] & 0xF0) == 0xE0 && (utf8[1] & 0xC0) == 0x80 && (utf8[2] & 0xC0) == 0x80) + return 3; + else + return 0; +} + +FLAC_API FLAC__bool FLAC__format_vorbiscomment_entry_name_is_legal(const char *name) +{ + char c; + for(c = *name; c; c = *(++name)) + if(c < 0x20 || c == 0x3d || c > 0x7d) + return false; + return true; +} + +FLAC_API FLAC__bool FLAC__format_vorbiscomment_entry_value_is_legal(const FLAC__byte *value, unsigned length) +{ + if(length == (unsigned)(-1)) { + while(*value) { + unsigned n = utf8len_(value); + if(n == 0) + return false; + value += n; + } + } + else { + const FLAC__byte *end = value + length; + while(value < end) { + unsigned n = utf8len_(value); + if(n == 0) + return false; + value += n; + } + if(value != end) + return false; + } + return true; +} + +FLAC_API FLAC__bool FLAC__format_vorbiscomment_entry_is_legal(const FLAC__byte *entry, unsigned length) +{ + const FLAC__byte *s, *end; + + for(s = entry, end = s + length; s < end && *s != '='; s++) { + if(*s < 0x20 || *s > 0x7D) + return false; + } + if(s == end) + return false; + + s++; /* skip '=' */ + + while(s < end) { + unsigned n = utf8len_(s); + if(n == 0) + return false; + s += n; + } + if(s != end) + return false; + + return true; +} + +FLAC_API FLAC__bool FLAC__format_cuesheet_is_legal(const FLAC__StreamMetadata_CueSheet *cue_sheet, FLAC__bool check_cd_da_subset, const char **violation) +{ + unsigned i, j; + + if(check_cd_da_subset) { + if(cue_sheet->lead_in < 2 * 44100) { + if(violation) *violation = "CD-DA cue sheet must have a lead-in length of at least 2 seconds"; + return false; + } + if(cue_sheet->lead_in % 588 != 0) { + if(violation) *violation = "CD-DA cue sheet lead-in length must be evenly divisible by 588 samples"; + return false; + } + } + + if(cue_sheet->num_tracks == 0) { + if(violation) *violation = "cue sheet must have at least one track (the lead-out)"; + return false; + } + + if(check_cd_da_subset && cue_sheet->tracks[cue_sheet->num_tracks-1].number != 170) { + if(violation) *violation = "CD-DA cue sheet must have a lead-out track number 170 (0xAA)"; + return false; + } + + for(i = 0; i < cue_sheet->num_tracks; i++) { + if(cue_sheet->tracks[i].number == 0) { + if(violation) *violation = "cue sheet may not have a track number 0"; + return false; + } + + if(check_cd_da_subset) { + if(!((cue_sheet->tracks[i].number >= 1 && cue_sheet->tracks[i].number <= 99) || cue_sheet->tracks[i].number == 170)) { + if(violation) *violation = "CD-DA cue sheet track number must be 1-99 or 170"; + return false; + } + } + + if(check_cd_da_subset && cue_sheet->tracks[i].offset % 588 != 0) { + if(violation) *violation = "CD-DA cue sheet track offset must be evenly divisible by 588 samples"; + return false; + } + + if(i < cue_sheet->num_tracks - 1) { + if(cue_sheet->tracks[i].num_indices == 0) { + if(violation) *violation = "cue sheet track must have at least one index point"; + return false; + } + + if(cue_sheet->tracks[i].indices[0].number > 1) { + if(violation) *violation = "cue sheet track's first index number must be 0 or 1"; + return false; + } + } + + for(j = 0; j < cue_sheet->tracks[i].num_indices; j++) { + if(check_cd_da_subset && cue_sheet->tracks[i].indices[j].offset % 588 != 0) { + if(violation) *violation = "CD-DA cue sheet track index offset must be evenly divisible by 588 samples"; + return false; + } + + if(j > 0) { + if(cue_sheet->tracks[i].indices[j].number != cue_sheet->tracks[i].indices[j-1].number + 1) { + if(violation) *violation = "cue sheet track index numbers must increase by 1"; + return false; + } + } + } + } + + return true; +} + +/* + * These routines are private to libFLAC + */ +unsigned FLAC__format_get_max_rice_partition_order(unsigned blocksize, unsigned predictor_order) +{ + return + FLAC__format_get_max_rice_partition_order_from_blocksize_limited_max_and_predictor_order( + FLAC__format_get_max_rice_partition_order_from_blocksize(blocksize), + blocksize, + predictor_order + ); +} + +unsigned FLAC__format_get_max_rice_partition_order_from_blocksize(unsigned blocksize) +{ + unsigned max_rice_partition_order = 0; + while(!(blocksize & 1)) { + max_rice_partition_order++; + blocksize >>= 1; + } + return min(FLAC__MAX_RICE_PARTITION_ORDER, max_rice_partition_order); +} + +unsigned FLAC__format_get_max_rice_partition_order_from_blocksize_limited_max_and_predictor_order(unsigned limit, unsigned blocksize, unsigned predictor_order) +{ + unsigned max_rice_partition_order = limit; + + while(max_rice_partition_order > 0 && (blocksize >> max_rice_partition_order) <= predictor_order) + max_rice_partition_order--; + + FLAC__ASSERT( + (max_rice_partition_order == 0 && blocksize >= predictor_order) || + (max_rice_partition_order > 0 && blocksize >> max_rice_partition_order > predictor_order) + ); + + return max_rice_partition_order; +} + +void FLAC__format_entropy_coding_method_partitioned_rice_contents_init(FLAC__EntropyCodingMethod_PartitionedRiceContents *object) +{ + FLAC__ASSERT(0 != object); + + object->parameters = 0; + object->raw_bits = 0; + object->capacity_by_order = 0; +} + +void FLAC__format_entropy_coding_method_partitioned_rice_contents_clear(FLAC__EntropyCodingMethod_PartitionedRiceContents *object) +{ + FLAC__ASSERT(0 != object); + + if(0 != object->parameters) + free(object->parameters); + if(0 != object->raw_bits) + free(object->raw_bits); + FLAC__format_entropy_coding_method_partitioned_rice_contents_init(object); +} + +FLAC__bool FLAC__format_entropy_coding_method_partitioned_rice_contents_ensure_size(FLAC__EntropyCodingMethod_PartitionedRiceContents *object, unsigned max_partition_order) +{ + FLAC__ASSERT(0 != object); + + FLAC__ASSERT(object->capacity_by_order > 0 || (0 == object->parameters && 0 == object->raw_bits)); + + if(object->capacity_by_order < max_partition_order) { + if(0 == (object->parameters = (unsigned*)realloc(object->parameters, sizeof(unsigned)*(1 << max_partition_order)))) + return false; + if(0 == (object->raw_bits = (unsigned*)realloc(object->raw_bits, sizeof(unsigned)*(1 << max_partition_order)))) + return false; + object->capacity_by_order = max_partition_order; + } + + return true; +} diff --git a/Libraries/FLAC/Files/src/libFLAC/ia32/Makefile.am b/Libraries/FLAC/Files/src/libFLAC/ia32/Makefile.am new file mode 100644 index 000000000..d224db407 --- /dev/null +++ b/Libraries/FLAC/Files/src/libFLAC/ia32/Makefile.am @@ -0,0 +1,43 @@ +# libFLAC - Free Lossless Audio Codec library +# Copyright (C) 2001,2002,2003,2004,2005 Josh Coalson +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# - Neither the name of the Xiph.org Foundation nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +SUFFIXES = .nasm .lo + +STRIP_NON_ASM = sh $(top_srcdir)/strip_non_asm_libtool_args.sh + +.nasm.lo: + $(LIBTOOL) --tag=CC --mode=compile $(STRIP_NON_ASM) $(NASM) -f $(OBJ_FORMAT) -d OBJ_FORMAT_$(OBJ_FORMAT) -i$(srcdir)/ $< -o $@ + +noinst_LTLIBRARIES = libFLAC-asm.la +libFLAC_asm_la_SOURCES = \ + cpu_asm.nasm \ + fixed_asm.nasm \ + lpc_asm.nasm \ + nasm.h diff --git a/Libraries/FLAC/Files/src/libFLAC/ia32/Makefile.in b/Libraries/FLAC/Files/src/libFLAC/ia32/Makefile.in new file mode 100644 index 000000000..fdc9a67d7 --- /dev/null +++ b/Libraries/FLAC/Files/src/libFLAC/ia32/Makefile.in @@ -0,0 +1,494 @@ +# Makefile.in generated by automake 1.8.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# libFLAC - Free Lossless Audio Codec library +# Copyright (C) 2001,2002,2003,2004,2005 Josh Coalson +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# - Neither the name of the Xiph.org Foundation nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +SOURCES = $(libFLAC_asm_la_SOURCES) + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../../.. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_triplet = @host@ +subdir = src/libFLAC/ia32 +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(mkdir_p) +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +libFLAC_asm_la_LIBADD = +am_libFLAC_asm_la_OBJECTS = cpu_asm.lo fixed_asm.lo lpc_asm.lo +libFLAC_asm_la_OBJECTS = $(am_libFLAC_asm_la_OBJECTS) +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(libFLAC_asm_la_SOURCES) +DIST_SOURCES = $(libFLAC_asm_la_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCAS = @CCAS@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEBUG_FALSE = @DEBUG_FALSE@ +DEBUG_TRUE = @DEBUG_TRUE@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DOCBOOK_TO_MAN = @DOCBOOK_TO_MAN@ +DOXYGEN = @DOXYGEN@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FLaC__CPU_IA32_FALSE = @FLaC__CPU_IA32_FALSE@ +FLaC__CPU_IA32_TRUE = @FLaC__CPU_IA32_TRUE@ +FLaC__CPU_PPC_FALSE = @FLaC__CPU_PPC_FALSE@ +FLaC__CPU_PPC_TRUE = @FLaC__CPU_PPC_TRUE@ +FLaC__CPU_SPARC_FALSE = @FLaC__CPU_SPARC_FALSE@ +FLaC__CPU_SPARC_TRUE = @FLaC__CPU_SPARC_TRUE@ +FLaC__EXHAUSTIVE_TESTS_FALSE = @FLaC__EXHAUSTIVE_TESTS_FALSE@ +FLaC__EXHAUSTIVE_TESTS_TRUE = @FLaC__EXHAUSTIVE_TESTS_TRUE@ +FLaC__HAS_AS_FALSE = @FLaC__HAS_AS_FALSE@ +FLaC__HAS_AS_TRUE = @FLaC__HAS_AS_TRUE@ +FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@ +FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@ +FLaC__HAS_DOCBOOK_TO_MAN_FALSE = @FLaC__HAS_DOCBOOK_TO_MAN_FALSE@ +FLaC__HAS_DOCBOOK_TO_MAN_TRUE = @FLaC__HAS_DOCBOOK_TO_MAN_TRUE@ +FLaC__HAS_DOXYGEN_FALSE = @FLaC__HAS_DOXYGEN_FALSE@ +FLaC__HAS_DOXYGEN_TRUE = @FLaC__HAS_DOXYGEN_TRUE@ +FLaC__HAS_GAS_FALSE = @FLaC__HAS_GAS_FALSE@ +FLaC__HAS_GAS_TRUE = @FLaC__HAS_GAS_TRUE@ +FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@ +FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@ +FLaC__HAS_NASM_FALSE = @FLaC__HAS_NASM_FALSE@ +FLaC__HAS_NASM_TRUE = @FLaC__HAS_NASM_TRUE@ +FLaC__HAS_OGG_FALSE = @FLaC__HAS_OGG_FALSE@ +FLaC__HAS_OGG_TRUE = @FLaC__HAS_OGG_TRUE@ +FLaC__HAS_XMMS_FALSE = @FLaC__HAS_XMMS_FALSE@ +FLaC__HAS_XMMS_TRUE = @FLaC__HAS_XMMS_TRUE@ +FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE@ +FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE@ +FLaC__NO_ASM_FALSE = @FLaC__NO_ASM_FALSE@ +FLaC__NO_ASM_TRUE = @FLaC__NO_ASM_TRUE@ +FLaC__SSE_OS_FALSE = @FLaC__SSE_OS_FALSE@ +FLaC__SSE_OS_TRUE = @FLaC__SSE_OS_TRUE@ +FLaC__SYS_DARWIN_FALSE = @FLaC__SYS_DARWIN_FALSE@ +FLaC__SYS_DARWIN_TRUE = @FLaC__SYS_DARWIN_TRUE@ +FLaC__SYS_LINUX_FALSE = @FLaC__SYS_LINUX_FALSE@ +FLaC__SYS_LINUX_TRUE = @FLaC__SYS_LINUX_TRUE@ +FLaC__USE_3DNOW_FALSE = @FLaC__USE_3DNOW_FALSE@ +FLaC__USE_3DNOW_TRUE = @FLaC__USE_3DNOW_TRUE@ +FLaC__USE_ALTIVEC_FALSE = @FLaC__USE_ALTIVEC_FALSE@ +FLaC__USE_ALTIVEC_TRUE = @FLaC__USE_ALTIVEC_TRUE@ +FLaC__VALGRIND_TESTING_FALSE = @FLaC__VALGRIND_TESTING_FALSE@ +FLaC__VALGRIND_TESTING_TRUE = @FLaC__VALGRIND_TESTING_TRUE@ +GAS = @GAS@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +NASM = @NASM@ +OBJEXT = @OBJEXT@ +OBJ_FORMAT = @OBJ_FORMAT@ +OGG_CFLAGS = @OGG_CFLAGS@ +OGG_LIBS = @OGG_LIBS@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +XMMS_CFLAGS = @XMMS_CFLAGS@ +XMMS_CONFIG = @XMMS_CONFIG@ +XMMS_DATA_DIR = @XMMS_DATA_DIR@ +XMMS_EFFECT_PLUGIN_DIR = @XMMS_EFFECT_PLUGIN_DIR@ +XMMS_GENERAL_PLUGIN_DIR = @XMMS_GENERAL_PLUGIN_DIR@ +XMMS_INPUT_PLUGIN_DIR = @XMMS_INPUT_PLUGIN_DIR@ +XMMS_LIBS = @XMMS_LIBS@ +XMMS_OUTPUT_PLUGIN_DIR = @XMMS_OUTPUT_PLUGIN_DIR@ +XMMS_PLUGIN_DIR = @XMMS_PLUGIN_DIR@ +XMMS_VERSION = @XMMS_VERSION@ +XMMS_VISUALIZATION_PLUGIN_DIR = @XMMS_VISUALIZATION_PLUGIN_DIR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +SUFFIXES = .nasm .lo +STRIP_NON_ASM = sh $(top_srcdir)/strip_non_asm_libtool_args.sh +noinst_LTLIBRARIES = libFLAC-asm.la +libFLAC_asm_la_SOURCES = \ + cpu_asm.nasm \ + fixed_asm.nasm \ + lpc_asm.nasm \ + nasm.h + +all: all-am + +.SUFFIXES: +.SUFFIXES: .nasm .lo +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/libFLAC/ia32/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/libFLAC/ia32/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libFLAC-asm.la: $(libFLAC_asm_la_OBJECTS) $(libFLAC_asm_la_DEPENDENCIES) + $(LINK) $(libFLAC_asm_la_LDFLAGS) $(libFLAC_asm_la_OBJECTS) $(libFLAC_asm_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstLTLIBRARIES ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-exec \ + install-exec-am install-info install-info-am install-man \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am \ + uninstall-info-am + + +.nasm.lo: + $(LIBTOOL) --tag=CC --mode=compile $(STRIP_NON_ASM) $(NASM) -f $(OBJ_FORMAT) -d OBJ_FORMAT_$(OBJ_FORMAT) -i$(srcdir)/ $< -o $@ +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/Libraries/FLAC/Files/src/libFLAC/ia32/cpu_asm.nasm b/Libraries/FLAC/Files/src/libFLAC/ia32/cpu_asm.nasm new file mode 100644 index 000000000..12e92fd00 --- /dev/null +++ b/Libraries/FLAC/Files/src/libFLAC/ia32/cpu_asm.nasm @@ -0,0 +1,100 @@ +; libFLAC - Free Lossless Audio Codec library +; Copyright (C) 2001,2002,2003,2004,2005 Josh Coalson +; +; Redistribution and use in source and binary forms, with or without +; modification, are permitted provided that the following conditions +; are met: +; +; - Redistributions of source code must retain the above copyright +; notice, this list of conditions and the following disclaimer. +; +; - Redistributions in binary form must reproduce the above copyright +; notice, this list of conditions and the following disclaimer in the +; documentation and/or other materials provided with the distribution. +; +; - Neither the name of the Xiph.org Foundation nor the names of its +; contributors may be used to endorse or promote products derived from +; this software without specific prior written permission. +; +; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +; ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR +; CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +; EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +; PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +; LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +%include "nasm.h" + + data_section + +cglobal FLAC__cpu_info_asm_ia32 +cglobal FLAC__cpu_info_extended_amd_asm_ia32 +cglobal FLAC__cpu_info_sse_test_asm_ia32 + + code_section + +; ********************************************************************** +; + +have_cpuid: + pushfd + pop eax + mov edx, eax + xor eax, 0x00200000 + push eax + popfd + pushfd + pop eax + cmp eax, edx + jz .no_cpuid + mov eax, 1 + jmp .end +.no_cpuid: + xor eax, eax +.end: + ret + +cident FLAC__cpu_info_asm_ia32 + push ebx + call have_cpuid + test eax, eax + jz .no_cpuid + mov eax, 1 + cpuid + mov eax, edx + jmp .end +.no_cpuid: + xor eax, eax +.end + pop ebx + ret + +cident FLAC__cpu_info_extended_amd_asm_ia32 + push ebx + call have_cpuid + test eax, eax + jz .no_cpuid + mov eax, 0x80000000 + cpuid + cmp eax, 0x80000001 + jb .no_cpuid + mov eax, 0x80000001 + cpuid + mov eax, edx + jmp .end +.no_cpuid + xor eax, eax +.end + pop ebx + ret + +cident FLAC__cpu_info_sse_test_asm_ia32 + xorps xmm0, xmm0 + pop ebx + +end diff --git a/Libraries/FLAC/Files/src/libFLAC/ia32/fixed_asm.nasm b/Libraries/FLAC/Files/src/libFLAC/ia32/fixed_asm.nasm new file mode 100644 index 000000000..37c88a2c3 --- /dev/null +++ b/Libraries/FLAC/Files/src/libFLAC/ia32/fixed_asm.nasm @@ -0,0 +1,306 @@ +; libFLAC - Free Lossless Audio Codec library +; Copyright (C) 2001,2002,2003,2004,2005 Josh Coalson +; +; Redistribution and use in source and binary forms, with or without +; modification, are permitted provided that the following conditions +; are met: +; +; - Redistributions of source code must retain the above copyright +; notice, this list of conditions and the following disclaimer. +; +; - Redistributions in binary form must reproduce the above copyright +; notice, this list of conditions and the following disclaimer in the +; documentation and/or other materials provided with the distribution. +; +; - Neither the name of the Xiph.org Foundation nor the names of its +; contributors may be used to endorse or promote products derived from +; this software without specific prior written permission. +; +; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +; ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR +; CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +; EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +; PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +; LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +%include "nasm.h" + + data_section + +cglobal FLAC__fixed_compute_best_predictor_asm_ia32_mmx_cmov + + code_section + +; ********************************************************************** +; +; unsigned FLAC__fixed_compute_best_predictor(const FLAC__int32 *data, unsigned data_len, FLAC__float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]) +; { +; FLAC__int32 last_error_0 = data[-1]; +; FLAC__int32 last_error_1 = data[-1] - data[-2]; +; FLAC__int32 last_error_2 = last_error_1 - (data[-2] - data[-3]); +; FLAC__int32 last_error_3 = last_error_2 - (data[-2] - 2*data[-3] + data[-4]); +; FLAC__int32 error, save; +; FLAC__uint32 total_error_0 = 0, total_error_1 = 0, total_error_2 = 0, total_error_3 = 0, total_error_4 = 0; +; unsigned i, order; +; +; for(i = 0; i < data_len; i++) { +; error = data[i] ; total_error_0 += local_abs(error); save = error; +; error -= last_error_0; total_error_1 += local_abs(error); last_error_0 = save; save = error; +; error -= last_error_1; total_error_2 += local_abs(error); last_error_1 = save; save = error; +; error -= last_error_2; total_error_3 += local_abs(error); last_error_2 = save; save = error; +; error -= last_error_3; total_error_4 += local_abs(error); last_error_3 = save; +; } +; +; if(total_error_0 < min(min(min(total_error_1, total_error_2), total_error_3), total_error_4)) +; order = 0; +; else if(total_error_1 < min(min(total_error_2, total_error_3), total_error_4)) +; order = 1; +; else if(total_error_2 < min(total_error_3, total_error_4)) +; order = 2; +; else if(total_error_3 < total_error_4) +; order = 3; +; else +; order = 4; +; +; residual_bits_per_sample[0] = (FLAC__float)((data_len > 0 && total_error_0 > 0) ? log(M_LN2 * (FLAC__double)total_error_0 / (FLAC__double)data_len) / M_LN2 : 0.0); +; residual_bits_per_sample[1] = (FLAC__float)((data_len > 0 && total_error_1 > 0) ? log(M_LN2 * (FLAC__double)total_error_1 / (FLAC__double)data_len) / M_LN2 : 0.0); +; residual_bits_per_sample[2] = (FLAC__float)((data_len > 0 && total_error_2 > 0) ? log(M_LN2 * (FLAC__double)total_error_2 / (FLAC__double)data_len) / M_LN2 : 0.0); +; residual_bits_per_sample[3] = (FLAC__float)((data_len > 0 && total_error_3 > 0) ? log(M_LN2 * (FLAC__double)total_error_3 / (FLAC__double)data_len) / M_LN2 : 0.0); +; residual_bits_per_sample[4] = (FLAC__float)((data_len > 0 && total_error_4 > 0) ? log(M_LN2 * (FLAC__double)total_error_4 / (FLAC__double)data_len) / M_LN2 : 0.0); +; +; return order; +; } + ALIGN 16 +cident FLAC__fixed_compute_best_predictor_asm_ia32_mmx_cmov + + ; esp + 36 == data[] + ; esp + 40 == data_len + ; esp + 44 == residual_bits_per_sample[] + + push ebp + push ebx + push esi + push edi + sub esp, byte 16 + ; qword [esp] == temp space for loading FLAC__uint64s to FPU regs + + ; ebx == &data[i] + ; ecx == loop counter (i) + ; ebp == order + ; mm0 == total_error_1:total_error_0 + ; mm1 == total_error_2:total_error_3 + ; mm2 == :total_error_4 + ; mm3 == last_error_1:last_error_0 + ; mm4 == last_error_2:last_error_3 + + mov ecx, [esp + 40] ; ecx = data_len + test ecx, ecx + jz near .data_len_is_0 + + mov ebx, [esp + 36] ; ebx = data[] + movd mm3, [ebx - 4] ; mm3 = 0:last_error_0 + movd mm2, [ebx - 8] ; mm2 = 0:data[-2] + movd mm1, [ebx - 12] ; mm1 = 0:data[-3] + movd mm0, [ebx - 16] ; mm0 = 0:data[-4] + movq mm5, mm3 ; mm5 = 0:last_error_0 + psubd mm5, mm2 ; mm5 = 0:last_error_1 + punpckldq mm3, mm5 ; mm3 = last_error_1:last_error_0 + psubd mm2, mm1 ; mm2 = 0:data[-2] - data[-3] + psubd mm5, mm2 ; mm5 = 0:last_error_2 + movq mm4, mm5 ; mm4 = 0:last_error_2 + psubd mm4, mm2 ; mm4 = 0:last_error_2 - (data[-2] - data[-3]) + paddd mm4, mm1 ; mm4 = 0:last_error_2 - (data[-2] - 2 * data[-3]) + psubd mm4, mm0 ; mm4 = 0:last_error_3 + punpckldq mm4, mm5 ; mm4 = last_error_2:last_error_3 + pxor mm0, mm0 ; mm0 = total_error_1:total_error_0 + pxor mm1, mm1 ; mm1 = total_error_2:total_error_3 + pxor mm2, mm2 ; mm2 = 0:total_error_4 + + ALIGN 16 +.loop: + movd mm7, [ebx] ; mm7 = 0:error_0 + add ebx, byte 4 + movq mm6, mm7 ; mm6 = 0:error_0 + psubd mm7, mm3 ; mm7 = :error_1 + punpckldq mm6, mm7 ; mm6 = error_1:error_0 + movq mm5, mm6 ; mm5 = error_1:error_0 + movq mm7, mm6 ; mm7 = error_1:error_0 + psubd mm5, mm3 ; mm5 = error_2: + movq mm3, mm6 ; mm3 = error_1:error_0 + psrad mm6, 31 + pxor mm7, mm6 + psubd mm7, mm6 ; mm7 = abs(error_1):abs(error_0) + paddd mm0, mm7 ; mm0 = total_error_1:total_error_0 + movq mm6, mm5 ; mm6 = error_2: + psubd mm5, mm4 ; mm5 = error_3: + punpckhdq mm5, mm6 ; mm5 = error_2:error_3 + movq mm7, mm5 ; mm7 = error_2:error_3 + movq mm6, mm5 ; mm6 = error_2:error_3 + psubd mm5, mm4 ; mm5 = :error_4 + movq mm4, mm6 ; mm4 = error_2:error_3 + psrad mm6, 31 + pxor mm7, mm6 + psubd mm7, mm6 ; mm7 = abs(error_2):abs(error_3) + paddd mm1, mm7 ; mm1 = total_error_2:total_error_3 + movq mm6, mm5 ; mm6 = :error_4 + psrad mm5, 31 + pxor mm6, mm5 + psubd mm6, mm5 ; mm6 = :abs(error_4) + paddd mm2, mm6 ; mm2 = :total_error_4 + + dec ecx + jnz short .loop + +; if(total_error_0 < min(min(min(total_error_1, total_error_2), total_error_3), total_error_4)) +; order = 0; +; else if(total_error_1 < min(min(total_error_2, total_error_3), total_error_4)) +; order = 1; +; else if(total_error_2 < min(total_error_3, total_error_4)) +; order = 2; +; else if(total_error_3 < total_error_4) +; order = 3; +; else +; order = 4; + movq mm3, mm0 ; mm3 = total_error_1:total_error_0 + movd edi, mm2 ; edi = total_error_4 + movd esi, mm1 ; esi = total_error_3 + movd eax, mm0 ; eax = total_error_0 + punpckhdq mm1, mm1 ; mm1 = total_error_2:total_error_2 + punpckhdq mm3, mm3 ; mm3 = total_error_1:total_error_1 + movd edx, mm1 ; edx = total_error_2 + movd ecx, mm3 ; ecx = total_error_1 + + xor ebx, ebx + xor ebp, ebp + inc ebx + cmp ecx, eax + cmovb eax, ecx ; eax = min(total_error_0, total_error_1) + cmovbe ebp, ebx + inc ebx + cmp edx, eax + cmovb eax, edx ; eax = min(total_error_0, total_error_1, total_error_2) + cmovbe ebp, ebx + inc ebx + cmp esi, eax + cmovb eax, esi ; eax = min(total_error_0, total_error_1, total_error_2, total_error_3) + cmovbe ebp, ebx + inc ebx + cmp edi, eax + cmovb eax, edi ; eax = min(total_error_0, total_error_1, total_error_2, total_error_3, total_error_4) + cmovbe ebp, ebx + movd ebx, mm0 ; ebx = total_error_0 + emms + + ; residual_bits_per_sample[0] = (FLAC__float)((data_len > 0 && total_error_0 > 0) ? log(M_LN2 * (FLAC__double)total_error_0 / (FLAC__double)data_len) / M_LN2 : 0.0); + ; residual_bits_per_sample[1] = (FLAC__float)((data_len > 0 && total_error_1 > 0) ? log(M_LN2 * (FLAC__double)total_error_1 / (FLAC__double)data_len) / M_LN2 : 0.0); + ; residual_bits_per_sample[2] = (FLAC__float)((data_len > 0 && total_error_2 > 0) ? log(M_LN2 * (FLAC__double)total_error_2 / (FLAC__double)data_len) / M_LN2 : 0.0); + ; residual_bits_per_sample[3] = (FLAC__float)((data_len > 0 && total_error_3 > 0) ? log(M_LN2 * (FLAC__double)total_error_3 / (FLAC__double)data_len) / M_LN2 : 0.0); + ; residual_bits_per_sample[4] = (FLAC__float)((data_len > 0 && total_error_4 > 0) ? log(M_LN2 * (FLAC__double)total_error_4 / (FLAC__double)data_len) / M_LN2 : 0.0); + xor eax, eax + fild dword [esp + 40] ; ST = data_len (NOTE: assumes data_len is <2gigs) +.rbps_0: + test ebx, ebx + jz .total_error_0_is_0 + fld1 ; ST = 1.0 data_len + mov [esp], ebx + mov [esp + 4], eax ; [esp] = (FLAC__uint64)total_error_0 + mov ebx, [esp + 44] + fild qword [esp] ; ST = total_error_0 1.0 data_len + fdiv st2 ; ST = total_error_0/data_len 1.0 data_len + fldln2 ; ST = ln2 total_error_0/data_len 1.0 data_len + fmulp st1 ; ST = ln2*total_error_0/data_len 1.0 data_len + fyl2x ; ST = log2(ln2*total_error_0/data_len) data_len + fstp dword [ebx] ; residual_bits_per_sample[0] = log2(ln2*total_error_0/data_len) ST = data_len + jmp short .rbps_1 +.total_error_0_is_0: + mov ebx, [esp + 44] + mov [ebx], eax ; residual_bits_per_sample[0] = 0.0 +.rbps_1: + test ecx, ecx + jz .total_error_1_is_0 + fld1 ; ST = 1.0 data_len + mov [esp], ecx + mov [esp + 4], eax ; [esp] = (FLAC__uint64)total_error_1 + fild qword [esp] ; ST = total_error_1 1.0 data_len + fdiv st2 ; ST = total_error_1/data_len 1.0 data_len + fldln2 ; ST = ln2 total_error_1/data_len 1.0 data_len + fmulp st1 ; ST = ln2*total_error_1/data_len 1.0 data_len + fyl2x ; ST = log2(ln2*total_error_1/data_len) data_len + fstp dword [ebx + 4] ; residual_bits_per_sample[1] = log2(ln2*total_error_1/data_len) ST = data_len + jmp short .rbps_2 +.total_error_1_is_0: + mov [ebx + 4], eax ; residual_bits_per_sample[1] = 0.0 +.rbps_2: + test edx, edx + jz .total_error_2_is_0 + fld1 ; ST = 1.0 data_len + mov [esp], edx + mov [esp + 4], eax ; [esp] = (FLAC__uint64)total_error_2 + fild qword [esp] ; ST = total_error_2 1.0 data_len + fdiv st2 ; ST = total_error_2/data_len 1.0 data_len + fldln2 ; ST = ln2 total_error_2/data_len 1.0 data_len + fmulp st1 ; ST = ln2*total_error_2/data_len 1.0 data_len + fyl2x ; ST = log2(ln2*total_error_2/data_len) data_len + fstp dword [ebx + 8] ; residual_bits_per_sample[2] = log2(ln2*total_error_2/data_len) ST = data_len + jmp short .rbps_3 +.total_error_2_is_0: + mov [ebx + 8], eax ; residual_bits_per_sample[2] = 0.0 +.rbps_3: + test esi, esi + jz .total_error_3_is_0 + fld1 ; ST = 1.0 data_len + mov [esp], esi + mov [esp + 4], eax ; [esp] = (FLAC__uint64)total_error_3 + fild qword [esp] ; ST = total_error_3 1.0 data_len + fdiv st2 ; ST = total_error_3/data_len 1.0 data_len + fldln2 ; ST = ln2 total_error_3/data_len 1.0 data_len + fmulp st1 ; ST = ln2*total_error_3/data_len 1.0 data_len + fyl2x ; ST = log2(ln2*total_error_3/data_len) data_len + fstp dword [ebx + 12] ; residual_bits_per_sample[3] = log2(ln2*total_error_3/data_len) ST = data_len + jmp short .rbps_4 +.total_error_3_is_0: + mov [ebx + 12], eax ; residual_bits_per_sample[3] = 0.0 +.rbps_4: + test edi, edi + jz .total_error_4_is_0 + fld1 ; ST = 1.0 data_len + mov [esp], edi + mov [esp + 4], eax ; [esp] = (FLAC__uint64)total_error_4 + fild qword [esp] ; ST = total_error_4 1.0 data_len + fdiv st2 ; ST = total_error_4/data_len 1.0 data_len + fldln2 ; ST = ln2 total_error_4/data_len 1.0 data_len + fmulp st1 ; ST = ln2*total_error_4/data_len 1.0 data_len + fyl2x ; ST = log2(ln2*total_error_4/data_len) data_len + fstp dword [ebx + 16] ; residual_bits_per_sample[4] = log2(ln2*total_error_4/data_len) ST = data_len + jmp short .rbps_end +.total_error_4_is_0: + mov [ebx + 16], eax ; residual_bits_per_sample[4] = 0.0 +.rbps_end: + fstp st0 ; ST = [empty] + jmp short .end +.data_len_is_0: + ; data_len == 0, so residual_bits_per_sample[*] = 0.0 + xor ebp, ebp + mov edi, [esp + 44] + mov [edi], ebp + mov [edi + 4], ebp + mov [edi + 8], ebp + mov [edi + 12], ebp + mov [edi + 16], ebp + add ebp, byte 4 ; order = 4 + +.end: + mov eax, ebp ; return order + add esp, byte 16 + pop edi + pop esi + pop ebx + pop ebp + ret + +end diff --git a/Libraries/FLAC/Files/src/libFLAC/ia32/lpc_asm.nasm b/Libraries/FLAC/Files/src/libFLAC/ia32/lpc_asm.nasm new file mode 100644 index 000000000..81a37b456 --- /dev/null +++ b/Libraries/FLAC/Files/src/libFLAC/ia32/lpc_asm.nasm @@ -0,0 +1,1503 @@ +; libFLAC - Free Lossless Audio Codec library +; Copyright (C) 2001,2002,2003,2004,2005 Josh Coalson +; +; Redistribution and use in source and binary forms, with or without +; modification, are permitted provided that the following conditions +; are met: +; +; - Redistributions of source code must retain the above copyright +; notice, this list of conditions and the following disclaimer. +; +; - Redistributions in binary form must reproduce the above copyright +; notice, this list of conditions and the following disclaimer in the +; documentation and/or other materials provided with the distribution. +; +; - Neither the name of the Xiph.org Foundation nor the names of its +; contributors may be used to endorse or promote products derived from +; this software without specific prior written permission. +; +; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +; ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR +; CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +; EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +; PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +; LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +%include "nasm.h" + + data_section + +cglobal FLAC__lpc_compute_autocorrelation_asm_ia32 +cglobal FLAC__lpc_compute_autocorrelation_asm_ia32_sse_lag_4 +cglobal FLAC__lpc_compute_autocorrelation_asm_ia32_sse_lag_8 +cglobal FLAC__lpc_compute_autocorrelation_asm_ia32_sse_lag_12 +cglobal FLAC__lpc_compute_autocorrelation_asm_ia32_3dnow +cglobal FLAC__lpc_compute_residual_from_qlp_coefficients_asm_ia32 +cglobal FLAC__lpc_compute_residual_from_qlp_coefficients_asm_ia32_mmx +cglobal FLAC__lpc_restore_signal_asm_ia32 +cglobal FLAC__lpc_restore_signal_asm_ia32_mmx + + code_section + +; ********************************************************************** +; +; void FLAC__lpc_compute_autocorrelation_asm(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[]) +; { +; FLAC__real d; +; unsigned sample, coeff; +; const unsigned limit = data_len - lag; +; +; FLAC__ASSERT(lag > 0); +; FLAC__ASSERT(lag <= data_len); +; +; for(coeff = 0; coeff < lag; coeff++) +; autoc[coeff] = 0.0; +; for(sample = 0; sample <= limit; sample++) { +; d = data[sample]; +; for(coeff = 0; coeff < lag; coeff++) +; autoc[coeff] += d * data[sample+coeff]; +; } +; for(; sample < data_len; sample++) { +; d = data[sample]; +; for(coeff = 0; coeff < data_len - sample; coeff++) +; autoc[coeff] += d * data[sample+coeff]; +; } +; } +; + ALIGN 16 +cident FLAC__lpc_compute_autocorrelation_asm_ia32 + ;[esp + 28] == autoc[] + ;[esp + 24] == lag + ;[esp + 20] == data_len + ;[esp + 16] == data[] + + ;ASSERT(lag > 0) + ;ASSERT(lag <= 33) + ;ASSERT(lag <= data_len) + +.begin: + push esi + push edi + push ebx + + ; for(coeff = 0; coeff < lag; coeff++) + ; autoc[coeff] = 0.0; + mov edi, [esp + 28] ; edi == autoc + mov ecx, [esp + 24] ; ecx = # of dwords (=lag) of 0 to write + xor eax, eax + rep stosd + + ; const unsigned limit = data_len - lag; + mov eax, [esp + 24] ; eax == lag + mov ecx, [esp + 20] + sub ecx, eax ; ecx == limit + + mov edi, [esp + 28] ; edi == autoc + mov esi, [esp + 16] ; esi == data + inc ecx ; we are looping <= limit so we add one to the counter + + ; for(sample = 0; sample <= limit; sample++) { + ; d = data[sample]; + ; for(coeff = 0; coeff < lag; coeff++) + ; autoc[coeff] += d * data[sample+coeff]; + ; } + fld dword [esi] ; ST = d <- data[sample] + ; each iteration is 11 bytes so we need (-eax)*11, so we do (-12*eax + eax) + lea edx, [eax + eax*2] + neg edx + lea edx, [eax + edx*4 + .jumper1_0 - .get_eip1] + call .get_eip1 +.get_eip1: + pop ebx + add edx, ebx + inc edx ; compensate for the shorter opcode on the last iteration + inc edx ; compensate for the shorter opcode on the last iteration + inc edx ; compensate for the shorter opcode on the last iteration + cmp eax, 33 + jne .loop1_start + sub edx, byte 9 ; compensate for the longer opcodes on the first iteration +.loop1_start: + jmp edx + + fld st0 ; ST = d d + fmul dword [esi + (32*4)] ; ST = d*data[sample+32] d WATCHOUT: not a byte displacement here! + fadd dword [edi + (32*4)] ; ST = autoc[32]+d*data[sample+32] d WATCHOUT: not a byte displacement here! + fstp dword [edi + (32*4)] ; autoc[32]+=d*data[sample+32] ST = d WATCHOUT: not a byte displacement here! + fld st0 ; ST = d d + fmul dword [esi + (31*4)] ; ST = d*data[sample+31] d + fadd dword [edi + (31*4)] ; ST = autoc[31]+d*data[sample+31] d + fstp dword [edi + (31*4)] ; autoc[31]+=d*data[sample+31] ST = d + fld st0 ; ST = d d + fmul dword [esi + (30*4)] ; ST = d*data[sample+30] d + fadd dword [edi + (30*4)] ; ST = autoc[30]+d*data[sample+30] d + fstp dword [edi + (30*4)] ; autoc[30]+=d*data[sample+30] ST = d + fld st0 ; ST = d d + fmul dword [esi + (29*4)] ; ST = d*data[sample+29] d + fadd dword [edi + (29*4)] ; ST = autoc[29]+d*data[sample+29] d + fstp dword [edi + (29*4)] ; autoc[29]+=d*data[sample+29] ST = d + fld st0 ; ST = d d + fmul dword [esi + (28*4)] ; ST = d*data[sample+28] d + fadd dword [edi + (28*4)] ; ST = autoc[28]+d*data[sample+28] d + fstp dword [edi + (28*4)] ; autoc[28]+=d*data[sample+28] ST = d + fld st0 ; ST = d d + fmul dword [esi + (27*4)] ; ST = d*data[sample+27] d + fadd dword [edi + (27*4)] ; ST = autoc[27]+d*data[sample+27] d + fstp dword [edi + (27*4)] ; autoc[27]+=d*data[sample+27] ST = d + fld st0 ; ST = d d + fmul dword [esi + (26*4)] ; ST = d*data[sample+26] d + fadd dword [edi + (26*4)] ; ST = autoc[26]+d*data[sample+26] d + fstp dword [edi + (26*4)] ; autoc[26]+=d*data[sample+26] ST = d + fld st0 ; ST = d d + fmul dword [esi + (25*4)] ; ST = d*data[sample+25] d + fadd dword [edi + (25*4)] ; ST = autoc[25]+d*data[sample+25] d + fstp dword [edi + (25*4)] ; autoc[25]+=d*data[sample+25] ST = d + fld st0 ; ST = d d + fmul dword [esi + (24*4)] ; ST = d*data[sample+24] d + fadd dword [edi + (24*4)] ; ST = autoc[24]+d*data[sample+24] d + fstp dword [edi + (24*4)] ; autoc[24]+=d*data[sample+24] ST = d + fld st0 ; ST = d d + fmul dword [esi + (23*4)] ; ST = d*data[sample+23] d + fadd dword [edi + (23*4)] ; ST = autoc[23]+d*data[sample+23] d + fstp dword [edi + (23*4)] ; autoc[23]+=d*data[sample+23] ST = d + fld st0 ; ST = d d + fmul dword [esi + (22*4)] ; ST = d*data[sample+22] d + fadd dword [edi + (22*4)] ; ST = autoc[22]+d*data[sample+22] d + fstp dword [edi + (22*4)] ; autoc[22]+=d*data[sample+22] ST = d + fld st0 ; ST = d d + fmul dword [esi + (21*4)] ; ST = d*data[sample+21] d + fadd dword [edi + (21*4)] ; ST = autoc[21]+d*data[sample+21] d + fstp dword [edi + (21*4)] ; autoc[21]+=d*data[sample+21] ST = d + fld st0 ; ST = d d + fmul dword [esi + (20*4)] ; ST = d*data[sample+20] d + fadd dword [edi + (20*4)] ; ST = autoc[20]+d*data[sample+20] d + fstp dword [edi + (20*4)] ; autoc[20]+=d*data[sample+20] ST = d + fld st0 ; ST = d d + fmul dword [esi + (19*4)] ; ST = d*data[sample+19] d + fadd dword [edi + (19*4)] ; ST = autoc[19]+d*data[sample+19] d + fstp dword [edi + (19*4)] ; autoc[19]+=d*data[sample+19] ST = d + fld st0 ; ST = d d + fmul dword [esi + (18*4)] ; ST = d*data[sample+18] d + fadd dword [edi + (18*4)] ; ST = autoc[18]+d*data[sample+18] d + fstp dword [edi + (18*4)] ; autoc[18]+=d*data[sample+18] ST = d + fld st0 ; ST = d d + fmul dword [esi + (17*4)] ; ST = d*data[sample+17] d + fadd dword [edi + (17*4)] ; ST = autoc[17]+d*data[sample+17] d + fstp dword [edi + (17*4)] ; autoc[17]+=d*data[sample+17] ST = d + fld st0 ; ST = d d + fmul dword [esi + (16*4)] ; ST = d*data[sample+16] d + fadd dword [edi + (16*4)] ; ST = autoc[16]+d*data[sample+16] d + fstp dword [edi + (16*4)] ; autoc[16]+=d*data[sample+16] ST = d + fld st0 ; ST = d d + fmul dword [esi + (15*4)] ; ST = d*data[sample+15] d + fadd dword [edi + (15*4)] ; ST = autoc[15]+d*data[sample+15] d + fstp dword [edi + (15*4)] ; autoc[15]+=d*data[sample+15] ST = d + fld st0 ; ST = d d + fmul dword [esi + (14*4)] ; ST = d*data[sample+14] d + fadd dword [edi + (14*4)] ; ST = autoc[14]+d*data[sample+14] d + fstp dword [edi + (14*4)] ; autoc[14]+=d*data[sample+14] ST = d + fld st0 ; ST = d d + fmul dword [esi + (13*4)] ; ST = d*data[sample+13] d + fadd dword [edi + (13*4)] ; ST = autoc[13]+d*data[sample+13] d + fstp dword [edi + (13*4)] ; autoc[13]+=d*data[sample+13] ST = d + fld st0 ; ST = d d + fmul dword [esi + (12*4)] ; ST = d*data[sample+12] d + fadd dword [edi + (12*4)] ; ST = autoc[12]+d*data[sample+12] d + fstp dword [edi + (12*4)] ; autoc[12]+=d*data[sample+12] ST = d + fld st0 ; ST = d d + fmul dword [esi + (11*4)] ; ST = d*data[sample+11] d + fadd dword [edi + (11*4)] ; ST = autoc[11]+d*data[sample+11] d + fstp dword [edi + (11*4)] ; autoc[11]+=d*data[sample+11] ST = d + fld st0 ; ST = d d + fmul dword [esi + (10*4)] ; ST = d*data[sample+10] d + fadd dword [edi + (10*4)] ; ST = autoc[10]+d*data[sample+10] d + fstp dword [edi + (10*4)] ; autoc[10]+=d*data[sample+10] ST = d + fld st0 ; ST = d d + fmul dword [esi + ( 9*4)] ; ST = d*data[sample+9] d + fadd dword [edi + ( 9*4)] ; ST = autoc[9]+d*data[sample+9] d + fstp dword [edi + ( 9*4)] ; autoc[9]+=d*data[sample+9] ST = d + fld st0 ; ST = d d + fmul dword [esi + ( 8*4)] ; ST = d*data[sample+8] d + fadd dword [edi + ( 8*4)] ; ST = autoc[8]+d*data[sample+8] d + fstp dword [edi + ( 8*4)] ; autoc[8]+=d*data[sample+8] ST = d + fld st0 ; ST = d d + fmul dword [esi + ( 7*4)] ; ST = d*data[sample+7] d + fadd dword [edi + ( 7*4)] ; ST = autoc[7]+d*data[sample+7] d + fstp dword [edi + ( 7*4)] ; autoc[7]+=d*data[sample+7] ST = d + fld st0 ; ST = d d + fmul dword [esi + ( 6*4)] ; ST = d*data[sample+6] d + fadd dword [edi + ( 6*4)] ; ST = autoc[6]+d*data[sample+6] d + fstp dword [edi + ( 6*4)] ; autoc[6]+=d*data[sample+6] ST = d + fld st0 ; ST = d d + fmul dword [esi + ( 5*4)] ; ST = d*data[sample+4] d + fadd dword [edi + ( 5*4)] ; ST = autoc[4]+d*data[sample+4] d + fstp dword [edi + ( 5*4)] ; autoc[4]+=d*data[sample+4] ST = d + fld st0 ; ST = d d + fmul dword [esi + ( 4*4)] ; ST = d*data[sample+4] d + fadd dword [edi + ( 4*4)] ; ST = autoc[4]+d*data[sample+4] d + fstp dword [edi + ( 4*4)] ; autoc[4]+=d*data[sample+4] ST = d + fld st0 ; ST = d d + fmul dword [esi + ( 3*4)] ; ST = d*data[sample+3] d + fadd dword [edi + ( 3*4)] ; ST = autoc[3]+d*data[sample+3] d + fstp dword [edi + ( 3*4)] ; autoc[3]+=d*data[sample+3] ST = d + fld st0 ; ST = d d + fmul dword [esi + ( 2*4)] ; ST = d*data[sample+2] d + fadd dword [edi + ( 2*4)] ; ST = autoc[2]+d*data[sample+2] d + fstp dword [edi + ( 2*4)] ; autoc[2]+=d*data[sample+2] ST = d + fld st0 ; ST = d d + fmul dword [esi + ( 1*4)] ; ST = d*data[sample+1] d + fadd dword [edi + ( 1*4)] ; ST = autoc[1]+d*data[sample+1] d + fstp dword [edi + ( 1*4)] ; autoc[1]+=d*data[sample+1] ST = d + fld st0 ; ST = d d + fmul dword [esi] ; ST = d*data[sample] d WATCHOUT: no displacement byte here! + fadd dword [edi] ; ST = autoc[0]+d*data[sample] d WATCHOUT: no displacement byte here! + fstp dword [edi] ; autoc[0]+=d*data[sample] ST = d WATCHOUT: no displacement byte here! +.jumper1_0: + + fstp st0 ; pop d, ST = empty + add esi, byte 4 ; sample++ + dec ecx + jz .loop1_end + fld dword [esi] ; ST = d <- data[sample] + jmp edx +.loop1_end: + + ; for(; sample < data_len; sample++) { + ; d = data[sample]; + ; for(coeff = 0; coeff < data_len - sample; coeff++) + ; autoc[coeff] += d * data[sample+coeff]; + ; } + mov ecx, [esp + 24] ; ecx <- lag + dec ecx ; ecx <- lag - 1 + jz near .end ; skip loop if 0 (i.e. lag == 1) + + fld dword [esi] ; ST = d <- data[sample] + mov eax, ecx ; eax <- lag - 1 == data_len - sample the first time through + ; each iteration is 11 bytes so we need (-eax)*11, so we do (-12*eax + eax) + lea edx, [eax + eax*2] + neg edx + lea edx, [eax + edx*4 + .jumper2_0 - .get_eip2] + call .get_eip2 +.get_eip2: + pop ebx + add edx, ebx + inc edx ; compensate for the shorter opcode on the last iteration + inc edx ; compensate for the shorter opcode on the last iteration + inc edx ; compensate for the shorter opcode on the last iteration + jmp edx + + fld st0 ; ST = d d + fmul dword [esi + (31*4)] ; ST = d*data[sample+31] d + fadd dword [edi + (31*4)] ; ST = autoc[31]+d*data[sample+31] d + fstp dword [edi + (31*4)] ; autoc[31]+=d*data[sample+31] ST = d + fld st0 ; ST = d d + fmul dword [esi + (30*4)] ; ST = d*data[sample+30] d + fadd dword [edi + (30*4)] ; ST = autoc[30]+d*data[sample+30] d + fstp dword [edi + (30*4)] ; autoc[30]+=d*data[sample+30] ST = d + fld st0 ; ST = d d + fmul dword [esi + (29*4)] ; ST = d*data[sample+29] d + fadd dword [edi + (29*4)] ; ST = autoc[29]+d*data[sample+29] d + fstp dword [edi + (29*4)] ; autoc[29]+=d*data[sample+29] ST = d + fld st0 ; ST = d d + fmul dword [esi + (28*4)] ; ST = d*data[sample+28] d + fadd dword [edi + (28*4)] ; ST = autoc[28]+d*data[sample+28] d + fstp dword [edi + (28*4)] ; autoc[28]+=d*data[sample+28] ST = d + fld st0 ; ST = d d + fmul dword [esi + (27*4)] ; ST = d*data[sample+27] d + fadd dword [edi + (27*4)] ; ST = autoc[27]+d*data[sample+27] d + fstp dword [edi + (27*4)] ; autoc[27]+=d*data[sample+27] ST = d + fld st0 ; ST = d d + fmul dword [esi + (26*4)] ; ST = d*data[sample+26] d + fadd dword [edi + (26*4)] ; ST = autoc[26]+d*data[sample+26] d + fstp dword [edi + (26*4)] ; autoc[26]+=d*data[sample+26] ST = d + fld st0 ; ST = d d + fmul dword [esi + (25*4)] ; ST = d*data[sample+25] d + fadd dword [edi + (25*4)] ; ST = autoc[25]+d*data[sample+25] d + fstp dword [edi + (25*4)] ; autoc[25]+=d*data[sample+25] ST = d + fld st0 ; ST = d d + fmul dword [esi + (24*4)] ; ST = d*data[sample+24] d + fadd dword [edi + (24*4)] ; ST = autoc[24]+d*data[sample+24] d + fstp dword [edi + (24*4)] ; autoc[24]+=d*data[sample+24] ST = d + fld st0 ; ST = d d + fmul dword [esi + (23*4)] ; ST = d*data[sample+23] d + fadd dword [edi + (23*4)] ; ST = autoc[23]+d*data[sample+23] d + fstp dword [edi + (23*4)] ; autoc[23]+=d*data[sample+23] ST = d + fld st0 ; ST = d d + fmul dword [esi + (22*4)] ; ST = d*data[sample+22] d + fadd dword [edi + (22*4)] ; ST = autoc[22]+d*data[sample+22] d + fstp dword [edi + (22*4)] ; autoc[22]+=d*data[sample+22] ST = d + fld st0 ; ST = d d + fmul dword [esi + (21*4)] ; ST = d*data[sample+21] d + fadd dword [edi + (21*4)] ; ST = autoc[21]+d*data[sample+21] d + fstp dword [edi + (21*4)] ; autoc[21]+=d*data[sample+21] ST = d + fld st0 ; ST = d d + fmul dword [esi + (20*4)] ; ST = d*data[sample+20] d + fadd dword [edi + (20*4)] ; ST = autoc[20]+d*data[sample+20] d + fstp dword [edi + (20*4)] ; autoc[20]+=d*data[sample+20] ST = d + fld st0 ; ST = d d + fmul dword [esi + (19*4)] ; ST = d*data[sample+19] d + fadd dword [edi + (19*4)] ; ST = autoc[19]+d*data[sample+19] d + fstp dword [edi + (19*4)] ; autoc[19]+=d*data[sample+19] ST = d + fld st0 ; ST = d d + fmul dword [esi + (18*4)] ; ST = d*data[sample+18] d + fadd dword [edi + (18*4)] ; ST = autoc[18]+d*data[sample+18] d + fstp dword [edi + (18*4)] ; autoc[18]+=d*data[sample+18] ST = d + fld st0 ; ST = d d + fmul dword [esi + (17*4)] ; ST = d*data[sample+17] d + fadd dword [edi + (17*4)] ; ST = autoc[17]+d*data[sample+17] d + fstp dword [edi + (17*4)] ; autoc[17]+=d*data[sample+17] ST = d + fld st0 ; ST = d d + fmul dword [esi + (16*4)] ; ST = d*data[sample+16] d + fadd dword [edi + (16*4)] ; ST = autoc[16]+d*data[sample+16] d + fstp dword [edi + (16*4)] ; autoc[16]+=d*data[sample+16] ST = d + fld st0 ; ST = d d + fmul dword [esi + (15*4)] ; ST = d*data[sample+15] d + fadd dword [edi + (15*4)] ; ST = autoc[15]+d*data[sample+15] d + fstp dword [edi + (15*4)] ; autoc[15]+=d*data[sample+15] ST = d + fld st0 ; ST = d d + fmul dword [esi + (14*4)] ; ST = d*data[sample+14] d + fadd dword [edi + (14*4)] ; ST = autoc[14]+d*data[sample+14] d + fstp dword [edi + (14*4)] ; autoc[14]+=d*data[sample+14] ST = d + fld st0 ; ST = d d + fmul dword [esi + (13*4)] ; ST = d*data[sample+13] d + fadd dword [edi + (13*4)] ; ST = autoc[13]+d*data[sample+13] d + fstp dword [edi + (13*4)] ; autoc[13]+=d*data[sample+13] ST = d + fld st0 ; ST = d d + fmul dword [esi + (12*4)] ; ST = d*data[sample+12] d + fadd dword [edi + (12*4)] ; ST = autoc[12]+d*data[sample+12] d + fstp dword [edi + (12*4)] ; autoc[12]+=d*data[sample+12] ST = d + fld st0 ; ST = d d + fmul dword [esi + (11*4)] ; ST = d*data[sample+11] d + fadd dword [edi + (11*4)] ; ST = autoc[11]+d*data[sample+11] d + fstp dword [edi + (11*4)] ; autoc[11]+=d*data[sample+11] ST = d + fld st0 ; ST = d d + fmul dword [esi + (10*4)] ; ST = d*data[sample+10] d + fadd dword [edi + (10*4)] ; ST = autoc[10]+d*data[sample+10] d + fstp dword [edi + (10*4)] ; autoc[10]+=d*data[sample+10] ST = d + fld st0 ; ST = d d + fmul dword [esi + ( 9*4)] ; ST = d*data[sample+9] d + fadd dword [edi + ( 9*4)] ; ST = autoc[9]+d*data[sample+9] d + fstp dword [edi + ( 9*4)] ; autoc[9]+=d*data[sample+9] ST = d + fld st0 ; ST = d d + fmul dword [esi + ( 8*4)] ; ST = d*data[sample+8] d + fadd dword [edi + ( 8*4)] ; ST = autoc[8]+d*data[sample+8] d + fstp dword [edi + ( 8*4)] ; autoc[8]+=d*data[sample+8] ST = d + fld st0 ; ST = d d + fmul dword [esi + ( 7*4)] ; ST = d*data[sample+7] d + fadd dword [edi + ( 7*4)] ; ST = autoc[7]+d*data[sample+7] d + fstp dword [edi + ( 7*4)] ; autoc[7]+=d*data[sample+7] ST = d + fld st0 ; ST = d d + fmul dword [esi + ( 6*4)] ; ST = d*data[sample+6] d + fadd dword [edi + ( 6*4)] ; ST = autoc[6]+d*data[sample+6] d + fstp dword [edi + ( 6*4)] ; autoc[6]+=d*data[sample+6] ST = d + fld st0 ; ST = d d + fmul dword [esi + ( 5*4)] ; ST = d*data[sample+4] d + fadd dword [edi + ( 5*4)] ; ST = autoc[4]+d*data[sample+4] d + fstp dword [edi + ( 5*4)] ; autoc[4]+=d*data[sample+4] ST = d + fld st0 ; ST = d d + fmul dword [esi + ( 4*4)] ; ST = d*data[sample+4] d + fadd dword [edi + ( 4*4)] ; ST = autoc[4]+d*data[sample+4] d + fstp dword [edi + ( 4*4)] ; autoc[4]+=d*data[sample+4] ST = d + fld st0 ; ST = d d + fmul dword [esi + ( 3*4)] ; ST = d*data[sample+3] d + fadd dword [edi + ( 3*4)] ; ST = autoc[3]+d*data[sample+3] d + fstp dword [edi + ( 3*4)] ; autoc[3]+=d*data[sample+3] ST = d + fld st0 ; ST = d d + fmul dword [esi + ( 2*4)] ; ST = d*data[sample+2] d + fadd dword [edi + ( 2*4)] ; ST = autoc[2]+d*data[sample+2] d + fstp dword [edi + ( 2*4)] ; autoc[2]+=d*data[sample+2] ST = d + fld st0 ; ST = d d + fmul dword [esi + ( 1*4)] ; ST = d*data[sample+1] d + fadd dword [edi + ( 1*4)] ; ST = autoc[1]+d*data[sample+1] d + fstp dword [edi + ( 1*4)] ; autoc[1]+=d*data[sample+1] ST = d + fld st0 ; ST = d d + fmul dword [esi] ; ST = d*data[sample] d WATCHOUT: no displacement byte here! + fadd dword [edi] ; ST = autoc[0]+d*data[sample] d WATCHOUT: no displacement byte here! + fstp dword [edi] ; autoc[0]+=d*data[sample] ST = d WATCHOUT: no displacement byte here! +.jumper2_0: + + fstp st0 ; pop d, ST = empty + add esi, byte 4 ; sample++ + dec ecx + jz .loop2_end + add edx, byte 11 ; adjust our inner loop counter by adjusting the jump target + fld dword [esi] ; ST = d <- data[sample] + jmp edx +.loop2_end: + +.end: + pop ebx + pop edi + pop esi + ret + + ALIGN 16 +cident FLAC__lpc_compute_autocorrelation_asm_ia32_sse_lag_4 + ;[esp + 16] == autoc[] + ;[esp + 12] == lag + ;[esp + 8] == data_len + ;[esp + 4] == data[] + + ;ASSERT(lag > 0) + ;ASSERT(lag <= 4) + ;ASSERT(lag <= data_len) + + ; for(coeff = 0; coeff < lag; coeff++) + ; autoc[coeff] = 0.0; + xorps xmm5, xmm5 + + mov edx, [esp + 8] ; edx == data_len + mov eax, [esp + 4] ; eax == &data[sample] <- &data[0] + + movss xmm0, [eax] ; xmm0 = 0,0,0,data[0] + add eax, 4 + movaps xmm2, xmm0 ; xmm2 = 0,0,0,data[0] + shufps xmm0, xmm0, 0 ; xmm0 == data[sample],data[sample],data[sample],data[sample] = data[0],data[0],data[0],data[0] +.warmup: ; xmm2 == data[sample-3],data[sample-2],data[sample-1],data[sample] + mulps xmm0, xmm2 ; xmm0 = xmm0 * xmm2 + addps xmm5, xmm0 ; xmm5 += xmm0 * xmm2 + dec edx + jz .loop_end + ALIGN 16 +.loop_start: + ; start by reading the next sample + movss xmm0, [eax] ; xmm0 = 0,0,0,data[sample] + add eax, 4 + shufps xmm0, xmm0, 0 ; xmm0 = data[sample],data[sample],data[sample],data[sample] + shufps xmm2, xmm2, 93h ; 93h=2-1-0-3 => xmm2 gets rotated left by one float + movss xmm2, xmm0 + mulps xmm0, xmm2 ; xmm0 = xmm0 * xmm2 + addps xmm5, xmm0 ; xmm5 += xmm0 * xmm2 + dec edx + jnz .loop_start +.loop_end: + ; store autoc + mov edx, [esp + 16] ; edx == autoc + movups [edx], xmm5 + +.end: + ret + + ALIGN 16 +cident FLAC__lpc_compute_autocorrelation_asm_ia32_sse_lag_8 + ;[esp + 16] == autoc[] + ;[esp + 12] == lag + ;[esp + 8] == data_len + ;[esp + 4] == data[] + + ;ASSERT(lag > 0) + ;ASSERT(lag <= 8) + ;ASSERT(lag <= data_len) + + ; for(coeff = 0; coeff < lag; coeff++) + ; autoc[coeff] = 0.0; + xorps xmm5, xmm5 + xorps xmm6, xmm6 + + mov edx, [esp + 8] ; edx == data_len + mov eax, [esp + 4] ; eax == &data[sample] <- &data[0] + + movss xmm0, [eax] ; xmm0 = 0,0,0,data[0] + add eax, 4 + movaps xmm2, xmm0 ; xmm2 = 0,0,0,data[0] + shufps xmm0, xmm0, 0 ; xmm0 == data[sample],data[sample],data[sample],data[sample] = data[0],data[0],data[0],data[0] + movaps xmm1, xmm0 ; xmm1 == data[sample],data[sample],data[sample],data[sample] = data[0],data[0],data[0],data[0] + xorps xmm3, xmm3 ; xmm3 = 0,0,0,0 +.warmup: ; xmm3:xmm2 == data[sample-7],data[sample-6],...,data[sample] + mulps xmm0, xmm2 + mulps xmm1, xmm3 ; xmm1:xmm0 = xmm1:xmm0 * xmm3:xmm2 + addps xmm5, xmm0 + addps xmm6, xmm1 ; xmm6:xmm5 += xmm1:xmm0 * xmm3:xmm2 + dec edx + jz .loop_end + ALIGN 16 +.loop_start: + ; start by reading the next sample + movss xmm0, [eax] ; xmm0 = 0,0,0,data[sample] + ; here we reorder the instructions; see the (#) indexes for a logical order + shufps xmm2, xmm2, 93h ; (3) 93h=2-1-0-3 => xmm2 gets rotated left by one float + add eax, 4 ; (0) + shufps xmm3, xmm3, 93h ; (4) 93h=2-1-0-3 => xmm3 gets rotated left by one float + shufps xmm0, xmm0, 0 ; (1) xmm0 = data[sample],data[sample],data[sample],data[sample] + movss xmm3, xmm2 ; (5) + movaps xmm1, xmm0 ; (2) xmm1 = data[sample],data[sample],data[sample],data[sample] + movss xmm2, xmm0 ; (6) + mulps xmm1, xmm3 ; (8) + mulps xmm0, xmm2 ; (7) xmm1:xmm0 = xmm1:xmm0 * xmm3:xmm2 + addps xmm6, xmm1 ; (10) + addps xmm5, xmm0 ; (9) xmm6:xmm5 += xmm1:xmm0 * xmm3:xmm2 + dec edx + jnz .loop_start +.loop_end: + ; store autoc + mov edx, [esp + 16] ; edx == autoc + movups [edx], xmm5 + movups [edx + 16], xmm6 + +.end: + ret + + ALIGN 16 +cident FLAC__lpc_compute_autocorrelation_asm_ia32_sse_lag_12 + ;[esp + 16] == autoc[] + ;[esp + 12] == lag + ;[esp + 8] == data_len + ;[esp + 4] == data[] + + ;ASSERT(lag > 0) + ;ASSERT(lag <= 12) + ;ASSERT(lag <= data_len) + + ; for(coeff = 0; coeff < lag; coeff++) + ; autoc[coeff] = 0.0; + xorps xmm5, xmm5 + xorps xmm6, xmm6 + xorps xmm7, xmm7 + + mov edx, [esp + 8] ; edx == data_len + mov eax, [esp + 4] ; eax == &data[sample] <- &data[0] + + movss xmm0, [eax] ; xmm0 = 0,0,0,data[0] + add eax, 4 + movaps xmm2, xmm0 ; xmm2 = 0,0,0,data[0] + shufps xmm0, xmm0, 0 ; xmm0 == data[sample],data[sample],data[sample],data[sample] = data[0],data[0],data[0],data[0] + xorps xmm3, xmm3 ; xmm3 = 0,0,0,0 + xorps xmm4, xmm4 ; xmm4 = 0,0,0,0 +.warmup: ; xmm3:xmm2 == data[sample-7],data[sample-6],...,data[sample] + movaps xmm1, xmm0 + mulps xmm1, xmm2 + addps xmm5, xmm1 + movaps xmm1, xmm0 + mulps xmm1, xmm3 + addps xmm6, xmm1 + mulps xmm0, xmm4 + addps xmm7, xmm0 ; xmm7:xmm6:xmm5 += xmm0:xmm0:xmm0 * xmm4:xmm3:xmm2 + dec edx + jz .loop_end + ALIGN 16 +.loop_start: + ; start by reading the next sample + movss xmm0, [eax] ; xmm0 = 0,0,0,data[sample] + add eax, 4 + shufps xmm0, xmm0, 0 ; xmm0 = data[sample],data[sample],data[sample],data[sample] + + ; shift xmm4:xmm3:xmm2 left by one float + shufps xmm2, xmm2, 93h ; 93h=2-1-0-3 => xmm2 gets rotated left by one float + shufps xmm3, xmm3, 93h ; 93h=2-1-0-3 => xmm3 gets rotated left by one float + shufps xmm4, xmm4, 93h ; 93h=2-1-0-3 => xmm4 gets rotated left by one float + movss xmm4, xmm3 + movss xmm3, xmm2 + movss xmm2, xmm0 + + ; xmm7:xmm6:xmm5 += xmm0:xmm0:xmm0 * xmm3:xmm3:xmm2 + movaps xmm1, xmm0 + mulps xmm1, xmm2 + addps xmm5, xmm1 + movaps xmm1, xmm0 + mulps xmm1, xmm3 + addps xmm6, xmm1 + mulps xmm0, xmm4 + addps xmm7, xmm0 + + dec edx + jnz .loop_start +.loop_end: + ; store autoc + mov edx, [esp + 16] ; edx == autoc + movups [edx], xmm5 + movups [edx + 16], xmm6 + movups [edx + 32], xmm7 + +.end: + ret + + align 16 +cident FLAC__lpc_compute_autocorrelation_asm_ia32_3dnow + ;[ebp + 32] autoc + ;[ebp + 28] lag + ;[ebp + 24] data_len + ;[ebp + 20] data + + push ebp + push ebx + push esi + push edi + mov ebp, esp + + mov esi, [ebp + 20] + mov edi, [ebp + 24] + mov edx, [ebp + 28] + inc edx + and edx, byte -2 + mov eax, edx + neg eax + and esp, byte -8 + lea esp, [esp + 4 * eax] + mov ecx, edx + xor eax, eax +.loop0: + dec ecx + mov [esp + 4 * ecx], eax + jnz short .loop0 + + mov eax, edi + sub eax, edx + mov ebx, edx + and ebx, byte 1 + sub eax, ebx + lea ecx, [esi + 4 * eax - 12] + cmp esi, ecx + mov eax, esi + ja short .loop2_pre + align 16 ;4 nops +.loop1_i: + movd mm0, [eax] + movd mm2, [eax + 4] + movd mm4, [eax + 8] + movd mm6, [eax + 12] + mov ebx, edx + punpckldq mm0, mm0 + punpckldq mm2, mm2 + punpckldq mm4, mm4 + punpckldq mm6, mm6 + align 16 ;3 nops +.loop1_j: + sub ebx, byte 2 + movd mm1, [eax + 4 * ebx] + movd mm3, [eax + 4 * ebx + 4] + movd mm5, [eax + 4 * ebx + 8] + movd mm7, [eax + 4 * ebx + 12] + punpckldq mm1, mm3 + punpckldq mm3, mm5 + pfmul mm1, mm0 + punpckldq mm5, mm7 + pfmul mm3, mm2 + punpckldq mm7, [eax + 4 * ebx + 16] + pfmul mm5, mm4 + pfmul mm7, mm6 + pfadd mm1, mm3 + movq mm3, [esp + 4 * ebx] + pfadd mm5, mm7 + pfadd mm1, mm5 + pfadd mm3, mm1 + movq [esp + 4 * ebx], mm3 + jg short .loop1_j + + add eax, byte 16 + cmp eax, ecx + jb short .loop1_i + +.loop2_pre: + mov ebx, eax + sub eax, esi + shr eax, 2 + lea ecx, [esi + 4 * edi] + mov esi, ebx +.loop2_i: + movd mm0, [esi] + mov ebx, edi + sub ebx, eax + cmp ebx, edx + jbe short .loop2_j + mov ebx, edx +.loop2_j: + dec ebx + movd mm1, [esi + 4 * ebx] + pfmul mm1, mm0 + movd mm2, [esp + 4 * ebx] + pfadd mm1, mm2 + movd [esp + 4 * ebx], mm1 + + jnz short .loop2_j + + add esi, byte 4 + inc eax + cmp esi, ecx + jnz short .loop2_i + + mov edi, [ebp + 32] + mov edx, [ebp + 28] +.loop3: + dec edx + mov eax, [esp + 4 * edx] + mov [edi + 4 * edx], eax + jnz short .loop3 + + femms + + mov esp, ebp + pop edi + pop esi + pop ebx + pop ebp + ret + +;void FLAC__lpc_compute_residual_from_qlp_coefficients(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[]) +; +; for(i = 0; i < data_len; i++) { +; sum = 0; +; for(j = 0; j < order; j++) +; sum += qlp_coeff[j] * data[i-j-1]; +; residual[i] = data[i] - (sum >> lp_quantization); +; } +; + ALIGN 16 +cident FLAC__lpc_compute_residual_from_qlp_coefficients_asm_ia32 + ;[esp + 40] residual[] + ;[esp + 36] lp_quantization + ;[esp + 32] order + ;[esp + 28] qlp_coeff[] + ;[esp + 24] data_len + ;[esp + 20] data[] + + ;ASSERT(order > 0) + + push ebp + push ebx + push esi + push edi + + mov esi, [esp + 20] ; esi = data[] + mov edi, [esp + 40] ; edi = residual[] + mov eax, [esp + 32] ; eax = order + mov ebx, [esp + 24] ; ebx = data_len + + test ebx, ebx + jz near .end ; do nothing if data_len == 0 +.begin: + cmp eax, byte 1 + jg short .i_1more + + mov ecx, [esp + 28] + mov edx, [ecx] ; edx = qlp_coeff[0] + mov eax, [esi - 4] ; eax = data[-1] + mov cl, [esp + 36] ; cl = lp_quantization + ALIGN 16 +.i_1_loop_i: + imul eax, edx + sar eax, cl + neg eax + add eax, [esi] + mov [edi], eax + mov eax, [esi] + add edi, byte 4 + add esi, byte 4 + dec ebx + jnz .i_1_loop_i + + jmp .end + +.i_1more: + cmp eax, byte 32 ; for order <= 32 there is a faster routine + jbe short .i_32 + + ; This version is here just for completeness, since FLAC__MAX_LPC_ORDER == 32 + ALIGN 16 +.i_32more_loop_i: + xor ebp, ebp + mov ecx, [esp + 32] + mov edx, ecx + shl edx, 2 + add edx, [esp + 28] + neg ecx + ALIGN 16 +.i_32more_loop_j: + sub edx, byte 4 + mov eax, [edx] + imul eax, [esi + 4 * ecx] + add ebp, eax + inc ecx + jnz short .i_32more_loop_j + + mov cl, [esp + 36] + sar ebp, cl + neg ebp + add ebp, [esi] + mov [edi], ebp + add esi, byte 4 + add edi, byte 4 + + dec ebx + jnz .i_32more_loop_i + + jmp .end + +.i_32: + sub edi, esi + neg eax + lea edx, [eax + eax * 8 + .jumper_0 - .get_eip0] + call .get_eip0 +.get_eip0: + pop eax + add edx, eax + inc edx + mov eax, [esp + 28] ; eax = qlp_coeff[] + xor ebp, ebp + jmp edx + + mov ecx, [eax + 124] + imul ecx, [esi - 128] + add ebp, ecx + mov ecx, [eax + 120] + imul ecx, [esi - 124] + add ebp, ecx + mov ecx, [eax + 116] + imul ecx, [esi - 120] + add ebp, ecx + mov ecx, [eax + 112] + imul ecx, [esi - 116] + add ebp, ecx + mov ecx, [eax + 108] + imul ecx, [esi - 112] + add ebp, ecx + mov ecx, [eax + 104] + imul ecx, [esi - 108] + add ebp, ecx + mov ecx, [eax + 100] + imul ecx, [esi - 104] + add ebp, ecx + mov ecx, [eax + 96] + imul ecx, [esi - 100] + add ebp, ecx + mov ecx, [eax + 92] + imul ecx, [esi - 96] + add ebp, ecx + mov ecx, [eax + 88] + imul ecx, [esi - 92] + add ebp, ecx + mov ecx, [eax + 84] + imul ecx, [esi - 88] + add ebp, ecx + mov ecx, [eax + 80] + imul ecx, [esi - 84] + add ebp, ecx + mov ecx, [eax + 76] + imul ecx, [esi - 80] + add ebp, ecx + mov ecx, [eax + 72] + imul ecx, [esi - 76] + add ebp, ecx + mov ecx, [eax + 68] + imul ecx, [esi - 72] + add ebp, ecx + mov ecx, [eax + 64] + imul ecx, [esi - 68] + add ebp, ecx + mov ecx, [eax + 60] + imul ecx, [esi - 64] + add ebp, ecx + mov ecx, [eax + 56] + imul ecx, [esi - 60] + add ebp, ecx + mov ecx, [eax + 52] + imul ecx, [esi - 56] + add ebp, ecx + mov ecx, [eax + 48] + imul ecx, [esi - 52] + add ebp, ecx + mov ecx, [eax + 44] + imul ecx, [esi - 48] + add ebp, ecx + mov ecx, [eax + 40] + imul ecx, [esi - 44] + add ebp, ecx + mov ecx, [eax + 36] + imul ecx, [esi - 40] + add ebp, ecx + mov ecx, [eax + 32] + imul ecx, [esi - 36] + add ebp, ecx + mov ecx, [eax + 28] + imul ecx, [esi - 32] + add ebp, ecx + mov ecx, [eax + 24] + imul ecx, [esi - 28] + add ebp, ecx + mov ecx, [eax + 20] + imul ecx, [esi - 24] + add ebp, ecx + mov ecx, [eax + 16] + imul ecx, [esi - 20] + add ebp, ecx + mov ecx, [eax + 12] + imul ecx, [esi - 16] + add ebp, ecx + mov ecx, [eax + 8] + imul ecx, [esi - 12] + add ebp, ecx + mov ecx, [eax + 4] + imul ecx, [esi - 8] + add ebp, ecx + mov ecx, [eax] ; there is one byte missing + imul ecx, [esi - 4] + add ebp, ecx +.jumper_0: + + mov cl, [esp + 36] + sar ebp, cl + neg ebp + add ebp, [esi] + mov [edi + esi], ebp + add esi, byte 4 + + dec ebx + jz short .end + xor ebp, ebp + jmp edx + +.end: + pop edi + pop esi + pop ebx + pop ebp + ret + +; WATCHOUT: this routine works on 16 bit data which means bits-per-sample for +; the channel must be <= 16. Especially note that this routine cannot be used +; for side-channel coded 16bps channels since the effective bps is 17. + ALIGN 16 +cident FLAC__lpc_compute_residual_from_qlp_coefficients_asm_ia32_mmx + ;[esp + 40] residual[] + ;[esp + 36] lp_quantization + ;[esp + 32] order + ;[esp + 28] qlp_coeff[] + ;[esp + 24] data_len + ;[esp + 20] data[] + + ;ASSERT(order > 0) + + push ebp + push ebx + push esi + push edi + + mov esi, [esp + 20] ; esi = data[] + mov edi, [esp + 40] ; edi = residual[] + mov eax, [esp + 32] ; eax = order + mov ebx, [esp + 24] ; ebx = data_len + + test ebx, ebx + jz near .end ; do nothing if data_len == 0 + dec ebx + test ebx, ebx + jz near .last_one + + mov edx, [esp + 28] ; edx = qlp_coeff[] + movd mm6, [esp + 36] ; mm6 = 0:lp_quantization + mov ebp, esp + + and esp, 0xfffffff8 + + xor ecx, ecx +.copy_qlp_loop: + push word [edx + 4 * ecx] + inc ecx + cmp ecx, eax + jnz short .copy_qlp_loop + + and ecx, 0x3 + test ecx, ecx + je short .za_end + sub ecx, byte 4 +.za_loop: + push word 0 + inc eax + inc ecx + jnz short .za_loop +.za_end: + + movq mm5, [esp + 2 * eax - 8] + movd mm4, [esi - 16] + punpckldq mm4, [esi - 12] + movd mm0, [esi - 8] + punpckldq mm0, [esi - 4] + packssdw mm4, mm0 + + cmp eax, byte 4 + jnbe short .mmx_4more + + align 16 +.mmx_4_loop_i: + movd mm1, [esi] + movq mm3, mm4 + punpckldq mm1, [esi + 4] + psrlq mm4, 16 + movq mm0, mm1 + psllq mm0, 48 + por mm4, mm0 + movq mm2, mm4 + psrlq mm4, 16 + pxor mm0, mm0 + punpckhdq mm0, mm1 + pmaddwd mm3, mm5 + pmaddwd mm2, mm5 + psllq mm0, 16 + por mm4, mm0 + movq mm0, mm3 + punpckldq mm3, mm2 + punpckhdq mm0, mm2 + paddd mm3, mm0 + psrad mm3, mm6 + psubd mm1, mm3 + movd [edi], mm1 + punpckhdq mm1, mm1 + movd [edi + 4], mm1 + + add edi, byte 8 + add esi, byte 8 + + sub ebx, 2 + jg .mmx_4_loop_i + jmp .mmx_end + +.mmx_4more: + shl eax, 2 + neg eax + add eax, byte 16 + + align 16 +.mmx_4more_loop_i: + movd mm1, [esi] + punpckldq mm1, [esi + 4] + movq mm3, mm4 + psrlq mm4, 16 + movq mm0, mm1 + psllq mm0, 48 + por mm4, mm0 + movq mm2, mm4 + psrlq mm4, 16 + pxor mm0, mm0 + punpckhdq mm0, mm1 + pmaddwd mm3, mm5 + pmaddwd mm2, mm5 + psllq mm0, 16 + por mm4, mm0 + + mov ecx, esi + add ecx, eax + mov edx, esp + + align 16 +.mmx_4more_loop_j: + movd mm0, [ecx - 16] + movd mm7, [ecx - 8] + punpckldq mm0, [ecx - 12] + punpckldq mm7, [ecx - 4] + packssdw mm0, mm7 + pmaddwd mm0, [edx] + punpckhdq mm7, mm7 + paddd mm3, mm0 + movd mm0, [ecx - 12] + punpckldq mm0, [ecx - 8] + punpckldq mm7, [ecx] + packssdw mm0, mm7 + pmaddwd mm0, [edx] + paddd mm2, mm0 + + add edx, byte 8 + add ecx, byte 16 + cmp ecx, esi + jnz .mmx_4more_loop_j + + movq mm0, mm3 + punpckldq mm3, mm2 + punpckhdq mm0, mm2 + paddd mm3, mm0 + psrad mm3, mm6 + psubd mm1, mm3 + movd [edi], mm1 + punpckhdq mm1, mm1 + movd [edi + 4], mm1 + + add edi, byte 8 + add esi, byte 8 + + sub ebx, 2 + jg near .mmx_4more_loop_i + +.mmx_end: + emms + mov esp, ebp +.last_one: + mov eax, [esp + 32] + inc ebx + jnz near FLAC__lpc_compute_residual_from_qlp_coefficients_asm_ia32.begin + +.end: + pop edi + pop esi + pop ebx + pop ebp + ret + +; ********************************************************************** +; +; void FLAC__lpc_restore_signal(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]) +; { +; unsigned i, j; +; FLAC__int32 sum; +; +; FLAC__ASSERT(order > 0); +; +; for(i = 0; i < data_len; i++) { +; sum = 0; +; for(j = 0; j < order; j++) +; sum += qlp_coeff[j] * data[i-j-1]; +; data[i] = residual[i] + (sum >> lp_quantization); +; } +; } + ALIGN 16 +cident FLAC__lpc_restore_signal_asm_ia32 + ;[esp + 40] data[] + ;[esp + 36] lp_quantization + ;[esp + 32] order + ;[esp + 28] qlp_coeff[] + ;[esp + 24] data_len + ;[esp + 20] residual[] + + ;ASSERT(order > 0) + + push ebp + push ebx + push esi + push edi + + mov esi, [esp + 20] ; esi = residual[] + mov edi, [esp + 40] ; edi = data[] + mov eax, [esp + 32] ; eax = order + mov ebx, [esp + 24] ; ebx = data_len + + test ebx, ebx + jz near .end ; do nothing if data_len == 0 + +.begin: + cmp eax, byte 1 + jg short .x87_1more + + mov ecx, [esp + 28] + mov edx, [ecx] + mov eax, [edi - 4] + mov cl, [esp + 36] + ALIGN 16 +.x87_1_loop_i: + imul eax, edx + sar eax, cl + add eax, [esi] + mov [edi], eax + add esi, byte 4 + add edi, byte 4 + dec ebx + jnz .x87_1_loop_i + + jmp .end + +.x87_1more: + cmp eax, byte 32 ; for order <= 32 there is a faster routine + jbe short .x87_32 + + ; This version is here just for completeness, since FLAC__MAX_LPC_ORDER == 32 + ALIGN 16 +.x87_32more_loop_i: + xor ebp, ebp + mov ecx, [esp + 32] + mov edx, ecx + shl edx, 2 + add edx, [esp + 28] + neg ecx + ALIGN 16 +.x87_32more_loop_j: + sub edx, byte 4 + mov eax, [edx] + imul eax, [edi + 4 * ecx] + add ebp, eax + inc ecx + jnz short .x87_32more_loop_j + + mov cl, [esp + 36] + sar ebp, cl + add ebp, [esi] + mov [edi], ebp + add edi, byte 4 + add esi, byte 4 + + dec ebx + jnz .x87_32more_loop_i + + jmp .end + +.x87_32: + sub esi, edi + neg eax + lea edx, [eax + eax * 8 + .jumper_0 - .get_eip0] + call .get_eip0 +.get_eip0: + pop eax + add edx, eax + inc edx ; compensate for the shorter opcode on the last iteration + mov eax, [esp + 28] ; eax = qlp_coeff[] + xor ebp, ebp + jmp edx + + mov ecx, [eax + 124] ; ecx = qlp_coeff[31] + imul ecx, [edi - 128] ; ecx = qlp_coeff[31] * data[i-32] + add ebp, ecx ; sum += qlp_coeff[31] * data[i-32] + mov ecx, [eax + 120] ; ecx = qlp_coeff[30] + imul ecx, [edi - 124] ; ecx = qlp_coeff[30] * data[i-31] + add ebp, ecx ; sum += qlp_coeff[30] * data[i-31] + mov ecx, [eax + 116] ; ecx = qlp_coeff[29] + imul ecx, [edi - 120] ; ecx = qlp_coeff[29] * data[i-30] + add ebp, ecx ; sum += qlp_coeff[29] * data[i-30] + mov ecx, [eax + 112] ; ecx = qlp_coeff[28] + imul ecx, [edi - 116] ; ecx = qlp_coeff[28] * data[i-29] + add ebp, ecx ; sum += qlp_coeff[28] * data[i-29] + mov ecx, [eax + 108] ; ecx = qlp_coeff[27] + imul ecx, [edi - 112] ; ecx = qlp_coeff[27] * data[i-28] + add ebp, ecx ; sum += qlp_coeff[27] * data[i-28] + mov ecx, [eax + 104] ; ecx = qlp_coeff[26] + imul ecx, [edi - 108] ; ecx = qlp_coeff[26] * data[i-27] + add ebp, ecx ; sum += qlp_coeff[26] * data[i-27] + mov ecx, [eax + 100] ; ecx = qlp_coeff[25] + imul ecx, [edi - 104] ; ecx = qlp_coeff[25] * data[i-26] + add ebp, ecx ; sum += qlp_coeff[25] * data[i-26] + mov ecx, [eax + 96] ; ecx = qlp_coeff[24] + imul ecx, [edi - 100] ; ecx = qlp_coeff[24] * data[i-25] + add ebp, ecx ; sum += qlp_coeff[24] * data[i-25] + mov ecx, [eax + 92] ; ecx = qlp_coeff[23] + imul ecx, [edi - 96] ; ecx = qlp_coeff[23] * data[i-24] + add ebp, ecx ; sum += qlp_coeff[23] * data[i-24] + mov ecx, [eax + 88] ; ecx = qlp_coeff[22] + imul ecx, [edi - 92] ; ecx = qlp_coeff[22] * data[i-23] + add ebp, ecx ; sum += qlp_coeff[22] * data[i-23] + mov ecx, [eax + 84] ; ecx = qlp_coeff[21] + imul ecx, [edi - 88] ; ecx = qlp_coeff[21] * data[i-22] + add ebp, ecx ; sum += qlp_coeff[21] * data[i-22] + mov ecx, [eax + 80] ; ecx = qlp_coeff[20] + imul ecx, [edi - 84] ; ecx = qlp_coeff[20] * data[i-21] + add ebp, ecx ; sum += qlp_coeff[20] * data[i-21] + mov ecx, [eax + 76] ; ecx = qlp_coeff[19] + imul ecx, [edi - 80] ; ecx = qlp_coeff[19] * data[i-20] + add ebp, ecx ; sum += qlp_coeff[19] * data[i-20] + mov ecx, [eax + 72] ; ecx = qlp_coeff[18] + imul ecx, [edi - 76] ; ecx = qlp_coeff[18] * data[i-19] + add ebp, ecx ; sum += qlp_coeff[18] * data[i-19] + mov ecx, [eax + 68] ; ecx = qlp_coeff[17] + imul ecx, [edi - 72] ; ecx = qlp_coeff[17] * data[i-18] + add ebp, ecx ; sum += qlp_coeff[17] * data[i-18] + mov ecx, [eax + 64] ; ecx = qlp_coeff[16] + imul ecx, [edi - 68] ; ecx = qlp_coeff[16] * data[i-17] + add ebp, ecx ; sum += qlp_coeff[16] * data[i-17] + mov ecx, [eax + 60] ; ecx = qlp_coeff[15] + imul ecx, [edi - 64] ; ecx = qlp_coeff[15] * data[i-16] + add ebp, ecx ; sum += qlp_coeff[15] * data[i-16] + mov ecx, [eax + 56] ; ecx = qlp_coeff[14] + imul ecx, [edi - 60] ; ecx = qlp_coeff[14] * data[i-15] + add ebp, ecx ; sum += qlp_coeff[14] * data[i-15] + mov ecx, [eax + 52] ; ecx = qlp_coeff[13] + imul ecx, [edi - 56] ; ecx = qlp_coeff[13] * data[i-14] + add ebp, ecx ; sum += qlp_coeff[13] * data[i-14] + mov ecx, [eax + 48] ; ecx = qlp_coeff[12] + imul ecx, [edi - 52] ; ecx = qlp_coeff[12] * data[i-13] + add ebp, ecx ; sum += qlp_coeff[12] * data[i-13] + mov ecx, [eax + 44] ; ecx = qlp_coeff[11] + imul ecx, [edi - 48] ; ecx = qlp_coeff[11] * data[i-12] + add ebp, ecx ; sum += qlp_coeff[11] * data[i-12] + mov ecx, [eax + 40] ; ecx = qlp_coeff[10] + imul ecx, [edi - 44] ; ecx = qlp_coeff[10] * data[i-11] + add ebp, ecx ; sum += qlp_coeff[10] * data[i-11] + mov ecx, [eax + 36] ; ecx = qlp_coeff[ 9] + imul ecx, [edi - 40] ; ecx = qlp_coeff[ 9] * data[i-10] + add ebp, ecx ; sum += qlp_coeff[ 9] * data[i-10] + mov ecx, [eax + 32] ; ecx = qlp_coeff[ 8] + imul ecx, [edi - 36] ; ecx = qlp_coeff[ 8] * data[i- 9] + add ebp, ecx ; sum += qlp_coeff[ 8] * data[i- 9] + mov ecx, [eax + 28] ; ecx = qlp_coeff[ 7] + imul ecx, [edi - 32] ; ecx = qlp_coeff[ 7] * data[i- 8] + add ebp, ecx ; sum += qlp_coeff[ 7] * data[i- 8] + mov ecx, [eax + 24] ; ecx = qlp_coeff[ 6] + imul ecx, [edi - 28] ; ecx = qlp_coeff[ 6] * data[i- 7] + add ebp, ecx ; sum += qlp_coeff[ 6] * data[i- 7] + mov ecx, [eax + 20] ; ecx = qlp_coeff[ 5] + imul ecx, [edi - 24] ; ecx = qlp_coeff[ 5] * data[i- 6] + add ebp, ecx ; sum += qlp_coeff[ 5] * data[i- 6] + mov ecx, [eax + 16] ; ecx = qlp_coeff[ 4] + imul ecx, [edi - 20] ; ecx = qlp_coeff[ 4] * data[i- 5] + add ebp, ecx ; sum += qlp_coeff[ 4] * data[i- 5] + mov ecx, [eax + 12] ; ecx = qlp_coeff[ 3] + imul ecx, [edi - 16] ; ecx = qlp_coeff[ 3] * data[i- 4] + add ebp, ecx ; sum += qlp_coeff[ 3] * data[i- 4] + mov ecx, [eax + 8] ; ecx = qlp_coeff[ 2] + imul ecx, [edi - 12] ; ecx = qlp_coeff[ 2] * data[i- 3] + add ebp, ecx ; sum += qlp_coeff[ 2] * data[i- 3] + mov ecx, [eax + 4] ; ecx = qlp_coeff[ 1] + imul ecx, [edi - 8] ; ecx = qlp_coeff[ 1] * data[i- 2] + add ebp, ecx ; sum += qlp_coeff[ 1] * data[i- 2] + mov ecx, [eax] ; ecx = qlp_coeff[ 0] (NOTE: one byte missing from instruction) + imul ecx, [edi - 4] ; ecx = qlp_coeff[ 0] * data[i- 1] + add ebp, ecx ; sum += qlp_coeff[ 0] * data[i- 1] +.jumper_0: + + mov cl, [esp + 36] + sar ebp, cl ; ebp = (sum >> lp_quantization) + add ebp, [esi + edi] ; ebp = residual[i] + (sum >> lp_quantization) + mov [edi], ebp ; data[i] = residual[i] + (sum >> lp_quantization) + add edi, byte 4 + + dec ebx + jz short .end + xor ebp, ebp + jmp edx + +.end: + pop edi + pop esi + pop ebx + pop ebp + ret + +; WATCHOUT: this routine works on 16 bit data which means bits-per-sample for +; the channel must be <= 16. Especially note that this routine cannot be used +; for side-channel coded 16bps channels since the effective bps is 17. +; WATCHOUT: this routine requires that each data array have a buffer of up to +; 3 zeroes in front (at negative indices) for alignment purposes, i.e. for each +; channel n, data[n][-1] through data[n][-3] should be accessible and zero. + ALIGN 16 +cident FLAC__lpc_restore_signal_asm_ia32_mmx + ;[esp + 40] data[] + ;[esp + 36] lp_quantization + ;[esp + 32] order + ;[esp + 28] qlp_coeff[] + ;[esp + 24] data_len + ;[esp + 20] residual[] + + ;ASSERT(order > 0) + + push ebp + push ebx + push esi + push edi + + mov esi, [esp + 20] + mov edi, [esp + 40] + mov eax, [esp + 32] + mov ebx, [esp + 24] + + test ebx, ebx + jz near .end ; do nothing if data_len == 0 + cmp eax, byte 4 + jb near FLAC__lpc_restore_signal_asm_ia32.begin + + mov edx, [esp + 28] + movd mm6, [esp + 36] + mov ebp, esp + + and esp, 0xfffffff8 + + xor ecx, ecx +.copy_qlp_loop: + push word [edx + 4 * ecx] + inc ecx + cmp ecx, eax + jnz short .copy_qlp_loop + + and ecx, 0x3 + test ecx, ecx + je short .za_end + sub ecx, byte 4 +.za_loop: + push word 0 + inc eax + inc ecx + jnz short .za_loop +.za_end: + + movq mm5, [esp + 2 * eax - 8] + movd mm4, [edi - 16] + punpckldq mm4, [edi - 12] + movd mm0, [edi - 8] + punpckldq mm0, [edi - 4] + packssdw mm4, mm0 + + cmp eax, byte 4 + jnbe short .mmx_4more + + align 16 +.mmx_4_loop_i: + movq mm7, mm4 + pmaddwd mm7, mm5 + movq mm0, mm7 + punpckhdq mm7, mm7 + paddd mm7, mm0 + psrad mm7, mm6 + movd mm1, [esi] + paddd mm7, mm1 + movd [edi], mm7 + psllq mm7, 48 + psrlq mm4, 16 + por mm4, mm7 + + add esi, byte 4 + add edi, byte 4 + + dec ebx + jnz .mmx_4_loop_i + jmp .mmx_end +.mmx_4more: + shl eax, 2 + neg eax + add eax, byte 16 + align 16 +.mmx_4more_loop_i: + mov ecx, edi + add ecx, eax + mov edx, esp + + movq mm7, mm4 + pmaddwd mm7, mm5 + + align 16 +.mmx_4more_loop_j: + movd mm0, [ecx - 16] + punpckldq mm0, [ecx - 12] + movd mm1, [ecx - 8] + punpckldq mm1, [ecx - 4] + packssdw mm0, mm1 + pmaddwd mm0, [edx] + paddd mm7, mm0 + + add edx, byte 8 + add ecx, byte 16 + cmp ecx, edi + jnz .mmx_4more_loop_j + + movq mm0, mm7 + punpckhdq mm7, mm7 + paddd mm7, mm0 + psrad mm7, mm6 + movd mm1, [esi] + paddd mm7, mm1 + movd [edi], mm7 + psllq mm7, 48 + psrlq mm4, 16 + por mm4, mm7 + + add esi, byte 4 + add edi, byte 4 + + dec ebx + jnz short .mmx_4more_loop_i +.mmx_end: + emms + mov esp, ebp + +.end: + pop edi + pop esi + pop ebx + pop ebp + ret + +end diff --git a/Libraries/FLAC/Files/src/libFLAC/ia32/nasm.h b/Libraries/FLAC/Files/src/libFLAC/ia32/nasm.h new file mode 100644 index 000000000..e35fce7a5 --- /dev/null +++ b/Libraries/FLAC/Files/src/libFLAC/ia32/nasm.h @@ -0,0 +1,75 @@ +; libFLAC - Free Lossless Audio Codec library +; Copyright (C) 2001,2002,2003,2004,2005 Josh Coalson +; +; Redistribution and use in source and binary forms, with or without +; modification, are permitted provided that the following conditions +; are met: +; +; - Redistributions of source code must retain the above copyright +; notice, this list of conditions and the following disclaimer. +; +; - Redistributions in binary form must reproduce the above copyright +; notice, this list of conditions and the following disclaimer in the +; documentation and/or other materials provided with the distribution. +; +; - Neither the name of the Xiph.org Foundation nor the names of its +; contributors may be used to endorse or promote products derived from +; this software without specific prior written permission. +; +; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +; ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR +; CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +; EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +; PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +; LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + bits 32 + +%ifdef OBJ_FORMAT_win32 + %define FLAC__PUBLIC_NEEDS_UNDERSCORE + %idefine code_section section .text align=16 class=CODE use32 + %idefine data_section section .data align=32 class=DATA use32 + %idefine bss_section section .bss align=32 class=DATA use32 +%elifdef OBJ_FORMAT_aout + %define FLAC__PUBLIC_NEEDS_UNDERSCORE + %idefine code_section section .text + %idefine data_section section .data + %idefine bss_section section .bss +%elifdef OBJ_FORMAT_aoutb + %define FLAC__PUBLIC_NEEDS_UNDERSCORE + %idefine code_section section .text + %idefine data_section section .data + %idefine bss_section section .bss +%elifdef OBJ_FORMAT_elf + %idefine code_section section .text align=16 + %idefine data_section section .data align=32 + %idefine bss_section section .bss align=32 +%else + %error unsupported object format! +%endif + +%imacro cglobal 1 + %ifdef FLAC__PUBLIC_NEEDS_UNDERSCORE + global _%1 + %else + global %1 + %endif +%endmacro + +%imacro cextern 1 + %ifdef FLAC__PUBLIC_NEEDS_UNDERSCORE + extern _%1 + %else + extern %1 + %endif +%endmacro + +%imacro cident 1 +_%1: +%1: +%endmacro diff --git a/Libraries/FLAC/Files/src/libFLAC/include/Makefile.am b/Libraries/FLAC/Files/src/libFLAC/include/Makefile.am new file mode 100644 index 000000000..1109c1038 --- /dev/null +++ b/Libraries/FLAC/Files/src/libFLAC/include/Makefile.am @@ -0,0 +1,31 @@ +# libFLAC - Free Lossless Audio Codec library +# Copyright (C) 2001,2002,2003,2004,2005 Josh Coalson +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# - Neither the name of the Xiph.org Foundation nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +SUBDIRS = private protected diff --git a/Libraries/FLAC/Files/src/libFLAC/include/Makefile.in b/Libraries/FLAC/Files/src/libFLAC/include/Makefile.in new file mode 100644 index 000000000..6f506021e --- /dev/null +++ b/Libraries/FLAC/Files/src/libFLAC/include/Makefile.in @@ -0,0 +1,543 @@ +# Makefile.in generated by automake 1.8.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# libFLAC - Free Lossless Audio Codec library +# Copyright (C) 2001,2002,2003,2004,2005 Josh Coalson +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# - Neither the name of the Xiph.org Foundation nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../../.. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_triplet = @host@ +subdir = src/libFLAC/include +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(mkdir_p) +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-exec-recursive install-info-recursive \ + install-recursive installcheck-recursive installdirs-recursive \ + pdf-recursive ps-recursive uninstall-info-recursive \ + uninstall-recursive +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCAS = @CCAS@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEBUG_FALSE = @DEBUG_FALSE@ +DEBUG_TRUE = @DEBUG_TRUE@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DOCBOOK_TO_MAN = @DOCBOOK_TO_MAN@ +DOXYGEN = @DOXYGEN@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FLaC__CPU_IA32_FALSE = @FLaC__CPU_IA32_FALSE@ +FLaC__CPU_IA32_TRUE = @FLaC__CPU_IA32_TRUE@ +FLaC__CPU_PPC_FALSE = @FLaC__CPU_PPC_FALSE@ +FLaC__CPU_PPC_TRUE = @FLaC__CPU_PPC_TRUE@ +FLaC__CPU_SPARC_FALSE = @FLaC__CPU_SPARC_FALSE@ +FLaC__CPU_SPARC_TRUE = @FLaC__CPU_SPARC_TRUE@ +FLaC__EXHAUSTIVE_TESTS_FALSE = @FLaC__EXHAUSTIVE_TESTS_FALSE@ +FLaC__EXHAUSTIVE_TESTS_TRUE = @FLaC__EXHAUSTIVE_TESTS_TRUE@ +FLaC__HAS_AS_FALSE = @FLaC__HAS_AS_FALSE@ +FLaC__HAS_AS_TRUE = @FLaC__HAS_AS_TRUE@ +FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@ +FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@ +FLaC__HAS_DOCBOOK_TO_MAN_FALSE = @FLaC__HAS_DOCBOOK_TO_MAN_FALSE@ +FLaC__HAS_DOCBOOK_TO_MAN_TRUE = @FLaC__HAS_DOCBOOK_TO_MAN_TRUE@ +FLaC__HAS_DOXYGEN_FALSE = @FLaC__HAS_DOXYGEN_FALSE@ +FLaC__HAS_DOXYGEN_TRUE = @FLaC__HAS_DOXYGEN_TRUE@ +FLaC__HAS_GAS_FALSE = @FLaC__HAS_GAS_FALSE@ +FLaC__HAS_GAS_TRUE = @FLaC__HAS_GAS_TRUE@ +FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@ +FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@ +FLaC__HAS_NASM_FALSE = @FLaC__HAS_NASM_FALSE@ +FLaC__HAS_NASM_TRUE = @FLaC__HAS_NASM_TRUE@ +FLaC__HAS_OGG_FALSE = @FLaC__HAS_OGG_FALSE@ +FLaC__HAS_OGG_TRUE = @FLaC__HAS_OGG_TRUE@ +FLaC__HAS_XMMS_FALSE = @FLaC__HAS_XMMS_FALSE@ +FLaC__HAS_XMMS_TRUE = @FLaC__HAS_XMMS_TRUE@ +FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE@ +FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE@ +FLaC__NO_ASM_FALSE = @FLaC__NO_ASM_FALSE@ +FLaC__NO_ASM_TRUE = @FLaC__NO_ASM_TRUE@ +FLaC__SSE_OS_FALSE = @FLaC__SSE_OS_FALSE@ +FLaC__SSE_OS_TRUE = @FLaC__SSE_OS_TRUE@ +FLaC__SYS_DARWIN_FALSE = @FLaC__SYS_DARWIN_FALSE@ +FLaC__SYS_DARWIN_TRUE = @FLaC__SYS_DARWIN_TRUE@ +FLaC__SYS_LINUX_FALSE = @FLaC__SYS_LINUX_FALSE@ +FLaC__SYS_LINUX_TRUE = @FLaC__SYS_LINUX_TRUE@ +FLaC__USE_3DNOW_FALSE = @FLaC__USE_3DNOW_FALSE@ +FLaC__USE_3DNOW_TRUE = @FLaC__USE_3DNOW_TRUE@ +FLaC__USE_ALTIVEC_FALSE = @FLaC__USE_ALTIVEC_FALSE@ +FLaC__USE_ALTIVEC_TRUE = @FLaC__USE_ALTIVEC_TRUE@ +FLaC__VALGRIND_TESTING_FALSE = @FLaC__VALGRIND_TESTING_FALSE@ +FLaC__VALGRIND_TESTING_TRUE = @FLaC__VALGRIND_TESTING_TRUE@ +GAS = @GAS@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +NASM = @NASM@ +OBJEXT = @OBJEXT@ +OBJ_FORMAT = @OBJ_FORMAT@ +OGG_CFLAGS = @OGG_CFLAGS@ +OGG_LIBS = @OGG_LIBS@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +XMMS_CFLAGS = @XMMS_CFLAGS@ +XMMS_CONFIG = @XMMS_CONFIG@ +XMMS_DATA_DIR = @XMMS_DATA_DIR@ +XMMS_EFFECT_PLUGIN_DIR = @XMMS_EFFECT_PLUGIN_DIR@ +XMMS_GENERAL_PLUGIN_DIR = @XMMS_GENERAL_PLUGIN_DIR@ +XMMS_INPUT_PLUGIN_DIR = @XMMS_INPUT_PLUGIN_DIR@ +XMMS_LIBS = @XMMS_LIBS@ +XMMS_OUTPUT_PLUGIN_DIR = @XMMS_OUTPUT_PLUGIN_DIR@ +XMMS_PLUGIN_DIR = @XMMS_PLUGIN_DIR@ +XMMS_VERSION = @XMMS_VERSION@ +XMMS_VISUALIZATION_PLUGIN_DIR = @XMMS_VISUALIZATION_PLUGIN_DIR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +SUBDIRS = private protected +all: all-recursive + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/libFLAC/include/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/libFLAC/include/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || mkdir "$(distdir)/$$subdir" \ + || exit 1; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="../$(top_distdir)" \ + distdir="../$(distdir)/$$subdir" \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-libtool \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-recursive + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-info-am + +uninstall-info: uninstall-info-recursive + +.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \ + clean clean-generic clean-libtool clean-recursive ctags \ + ctags-recursive distclean distclean-generic distclean-libtool \ + distclean-recursive distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-strip installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic maintainer-clean-recursive \ + mostlyclean mostlyclean-generic mostlyclean-libtool \ + mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \ + uninstall uninstall-am uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/Libraries/FLAC/Files/src/libFLAC/include/private/Makefile.am b/Libraries/FLAC/Files/src/libFLAC/include/private/Makefile.am new file mode 100644 index 000000000..c61007a65 --- /dev/null +++ b/Libraries/FLAC/Files/src/libFLAC/include/private/Makefile.am @@ -0,0 +1,44 @@ +# libFLAC - Free Lossless Audio Codec library +# Copyright (C) 2001,2002,2003,2004,2005 Josh Coalson +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# - Neither the name of the Xiph.org Foundation nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +noinst_HEADERS = \ + all.h \ + bitbuffer.h \ + bitmath.h \ + cpu.h \ + crc.h \ + fixed.h \ + float.h \ + format.h \ + lpc.h \ + md5.h \ + memory.h \ + metadata.h \ + stream_encoder_framing.h diff --git a/Libraries/FLAC/Files/src/libFLAC/include/private/Makefile.in b/Libraries/FLAC/Files/src/libFLAC/include/private/Makefile.in new file mode 100644 index 000000000..264703110 --- /dev/null +++ b/Libraries/FLAC/Files/src/libFLAC/include/private/Makefile.in @@ -0,0 +1,463 @@ +# Makefile.in generated by automake 1.8.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# libFLAC - Free Lossless Audio Codec library +# Copyright (C) 2001,2002,2003,2004,2005 Josh Coalson +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# - Neither the name of the Xiph.org Foundation nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../../../.. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_triplet = @host@ +subdir = src/libFLAC/include/private +DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(mkdir_p) +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +HEADERS = $(noinst_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCAS = @CCAS@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEBUG_FALSE = @DEBUG_FALSE@ +DEBUG_TRUE = @DEBUG_TRUE@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DOCBOOK_TO_MAN = @DOCBOOK_TO_MAN@ +DOXYGEN = @DOXYGEN@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FLaC__CPU_IA32_FALSE = @FLaC__CPU_IA32_FALSE@ +FLaC__CPU_IA32_TRUE = @FLaC__CPU_IA32_TRUE@ +FLaC__CPU_PPC_FALSE = @FLaC__CPU_PPC_FALSE@ +FLaC__CPU_PPC_TRUE = @FLaC__CPU_PPC_TRUE@ +FLaC__CPU_SPARC_FALSE = @FLaC__CPU_SPARC_FALSE@ +FLaC__CPU_SPARC_TRUE = @FLaC__CPU_SPARC_TRUE@ +FLaC__EXHAUSTIVE_TESTS_FALSE = @FLaC__EXHAUSTIVE_TESTS_FALSE@ +FLaC__EXHAUSTIVE_TESTS_TRUE = @FLaC__EXHAUSTIVE_TESTS_TRUE@ +FLaC__HAS_AS_FALSE = @FLaC__HAS_AS_FALSE@ +FLaC__HAS_AS_TRUE = @FLaC__HAS_AS_TRUE@ +FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@ +FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@ +FLaC__HAS_DOCBOOK_TO_MAN_FALSE = @FLaC__HAS_DOCBOOK_TO_MAN_FALSE@ +FLaC__HAS_DOCBOOK_TO_MAN_TRUE = @FLaC__HAS_DOCBOOK_TO_MAN_TRUE@ +FLaC__HAS_DOXYGEN_FALSE = @FLaC__HAS_DOXYGEN_FALSE@ +FLaC__HAS_DOXYGEN_TRUE = @FLaC__HAS_DOXYGEN_TRUE@ +FLaC__HAS_GAS_FALSE = @FLaC__HAS_GAS_FALSE@ +FLaC__HAS_GAS_TRUE = @FLaC__HAS_GAS_TRUE@ +FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@ +FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@ +FLaC__HAS_NASM_FALSE = @FLaC__HAS_NASM_FALSE@ +FLaC__HAS_NASM_TRUE = @FLaC__HAS_NASM_TRUE@ +FLaC__HAS_OGG_FALSE = @FLaC__HAS_OGG_FALSE@ +FLaC__HAS_OGG_TRUE = @FLaC__HAS_OGG_TRUE@ +FLaC__HAS_XMMS_FALSE = @FLaC__HAS_XMMS_FALSE@ +FLaC__HAS_XMMS_TRUE = @FLaC__HAS_XMMS_TRUE@ +FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE@ +FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE@ +FLaC__NO_ASM_FALSE = @FLaC__NO_ASM_FALSE@ +FLaC__NO_ASM_TRUE = @FLaC__NO_ASM_TRUE@ +FLaC__SSE_OS_FALSE = @FLaC__SSE_OS_FALSE@ +FLaC__SSE_OS_TRUE = @FLaC__SSE_OS_TRUE@ +FLaC__SYS_DARWIN_FALSE = @FLaC__SYS_DARWIN_FALSE@ +FLaC__SYS_DARWIN_TRUE = @FLaC__SYS_DARWIN_TRUE@ +FLaC__SYS_LINUX_FALSE = @FLaC__SYS_LINUX_FALSE@ +FLaC__SYS_LINUX_TRUE = @FLaC__SYS_LINUX_TRUE@ +FLaC__USE_3DNOW_FALSE = @FLaC__USE_3DNOW_FALSE@ +FLaC__USE_3DNOW_TRUE = @FLaC__USE_3DNOW_TRUE@ +FLaC__USE_ALTIVEC_FALSE = @FLaC__USE_ALTIVEC_FALSE@ +FLaC__USE_ALTIVEC_TRUE = @FLaC__USE_ALTIVEC_TRUE@ +FLaC__VALGRIND_TESTING_FALSE = @FLaC__VALGRIND_TESTING_FALSE@ +FLaC__VALGRIND_TESTING_TRUE = @FLaC__VALGRIND_TESTING_TRUE@ +GAS = @GAS@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +NASM = @NASM@ +OBJEXT = @OBJEXT@ +OBJ_FORMAT = @OBJ_FORMAT@ +OGG_CFLAGS = @OGG_CFLAGS@ +OGG_LIBS = @OGG_LIBS@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +XMMS_CFLAGS = @XMMS_CFLAGS@ +XMMS_CONFIG = @XMMS_CONFIG@ +XMMS_DATA_DIR = @XMMS_DATA_DIR@ +XMMS_EFFECT_PLUGIN_DIR = @XMMS_EFFECT_PLUGIN_DIR@ +XMMS_GENERAL_PLUGIN_DIR = @XMMS_GENERAL_PLUGIN_DIR@ +XMMS_INPUT_PLUGIN_DIR = @XMMS_INPUT_PLUGIN_DIR@ +XMMS_LIBS = @XMMS_LIBS@ +XMMS_OUTPUT_PLUGIN_DIR = @XMMS_OUTPUT_PLUGIN_DIR@ +XMMS_PLUGIN_DIR = @XMMS_PLUGIN_DIR@ +XMMS_VERSION = @XMMS_VERSION@ +XMMS_VISUALIZATION_PLUGIN_DIR = @XMMS_VISUALIZATION_PLUGIN_DIR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +noinst_HEADERS = \ + all.h \ + bitbuffer.h \ + bitmath.h \ + cpu.h \ + crc.h \ + fixed.h \ + float.h \ + format.h \ + lpc.h \ + md5.h \ + memory.h \ + metadata.h \ + stream_encoder_framing.h + +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/libFLAC/include/private/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/libFLAC/include/private/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(HEADERS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-libtool \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool ctags distclean distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ + uninstall-am uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/Libraries/FLAC/Files/src/libFLAC/include/private/all.h b/Libraries/FLAC/Files/src/libFLAC/include/private/all.h new file mode 100644 index 000000000..5c9e9842e --- /dev/null +++ b/Libraries/FLAC/Files/src/libFLAC/include/private/all.h @@ -0,0 +1,48 @@ +/* libFLAC - Free Lossless Audio Codec library + * Copyright (C) 2000,2001,2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef FLAC__PRIVATE__ALL_H +#define FLAC__PRIVATE__ALL_H + +#include "bitbuffer.h" +#include "bitmath.h" +#include "cpu.h" +#include "crc.h" +#include "fixed.h" +#include "float.h" +#include "format.h" +#include "lpc.h" +#include "md5.h" +#include "memory.h" +#include "metadata.h" +#include "stream_encoder_framing.h" + +#endif diff --git a/Libraries/FLAC/Files/src/libFLAC/include/private/bitbuffer.h b/Libraries/FLAC/Files/src/libFLAC/include/private/bitbuffer.h new file mode 100644 index 000000000..4ce5957fd --- /dev/null +++ b/Libraries/FLAC/Files/src/libFLAC/include/private/bitbuffer.h @@ -0,0 +1,159 @@ +/* libFLAC - Free Lossless Audio Codec library + * Copyright (C) 2000,2001,2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef FLAC__PRIVATE__BITBUFFER_H +#define FLAC__PRIVATE__BITBUFFER_H + +#include /* for FILE */ +#include "FLAC/ordinals.h" + +/* @@@ This should be configurable. Valid values are currently 8 and 32. */ +/* @@@ WATCHOUT! do not use 32 with a little endian system yet. */ +#define FLAC__BITS_PER_BLURB 8 + +#if FLAC__BITS_PER_BLURB == 8 +typedef FLAC__byte FLAC__blurb; +#elif FLAC__BITS_PER_BLURB == 32 +typedef FLAC__uint32 FLAC__blurb; +#else +/* ERROR, only sizes of 8 and 32 are supported */ +#endif + +/* + * opaque structure definition + */ +struct FLAC__BitBuffer; +typedef struct FLAC__BitBuffer FLAC__BitBuffer; + +/* + * construction, deletion, initialization, cloning functions + */ +FLAC__BitBuffer *FLAC__bitbuffer_new(); +void FLAC__bitbuffer_delete(FLAC__BitBuffer *bb); +FLAC__bool FLAC__bitbuffer_init(FLAC__BitBuffer *bb); +FLAC__bool FLAC__bitbuffer_init_from(FLAC__BitBuffer *bb, const FLAC__byte buffer[], unsigned bytes); +FLAC__bool FLAC__bitbuffer_concatenate_aligned(FLAC__BitBuffer *dest, const FLAC__BitBuffer *src); +void FLAC__bitbuffer_free(FLAC__BitBuffer *bb); /* does not 'free(buffer)' */ +FLAC__bool FLAC__bitbuffer_clear(FLAC__BitBuffer *bb); +FLAC__bool FLAC__bitbuffer_clone(FLAC__BitBuffer *dest, const FLAC__BitBuffer *src); + +/* + * CRC functions + */ +void FLAC__bitbuffer_reset_read_crc16(FLAC__BitBuffer *bb, FLAC__uint16 seed); +FLAC__uint16 FLAC__bitbuffer_get_read_crc16(FLAC__BitBuffer *bb); +FLAC__uint16 FLAC__bitbuffer_get_write_crc16(const FLAC__BitBuffer *bb); +FLAC__byte FLAC__bitbuffer_get_write_crc8(const FLAC__BitBuffer *bb); + +/* + * info functions + */ +FLAC__bool FLAC__bitbuffer_is_byte_aligned(const FLAC__BitBuffer *bb); +FLAC__bool FLAC__bitbuffer_is_consumed_byte_aligned(const FLAC__BitBuffer *bb); +unsigned FLAC__bitbuffer_bits_left_for_byte_alignment(const FLAC__BitBuffer *bb); +unsigned FLAC__bitbuffer_get_input_bytes_unconsumed(const FLAC__BitBuffer *bb); /* do not call unless byte-aligned */ + +/* + * direct buffer access + */ +void FLAC__bitbuffer_get_buffer(FLAC__BitBuffer *bb, const FLAC__byte **buffer, unsigned *bytes); +void FLAC__bitbuffer_release_buffer(FLAC__BitBuffer *bb); + +/* + * write functions + */ +FLAC__bool FLAC__bitbuffer_write_zeroes(FLAC__BitBuffer *bb, unsigned bits); +FLAC__bool FLAC__bitbuffer_write_raw_uint32(FLAC__BitBuffer *bb, FLAC__uint32 val, unsigned bits); +FLAC__bool FLAC__bitbuffer_write_raw_int32(FLAC__BitBuffer *bb, FLAC__int32 val, unsigned bits); +FLAC__bool FLAC__bitbuffer_write_raw_uint64(FLAC__BitBuffer *bb, FLAC__uint64 val, unsigned bits); +#if 0 /* UNUSED */ +FLAC__bool FLAC__bitbuffer_write_raw_int64(FLAC__BitBuffer *bb, FLAC__int64 val, unsigned bits); +#endif +FLAC__bool FLAC__bitbuffer_write_raw_uint32_little_endian(FLAC__BitBuffer *bb, FLAC__uint32 val); /*only for bits=32*/ +FLAC__bool FLAC__bitbuffer_write_byte_block(FLAC__BitBuffer *bb, const FLAC__byte vals[], unsigned nvals); +FLAC__bool FLAC__bitbuffer_write_unary_unsigned(FLAC__BitBuffer *bb, unsigned val); +unsigned FLAC__bitbuffer_rice_bits(int val, unsigned parameter); +#if 0 /* UNUSED */ +unsigned FLAC__bitbuffer_golomb_bits_signed(int val, unsigned parameter); +unsigned FLAC__bitbuffer_golomb_bits_unsigned(unsigned val, unsigned parameter); +#endif +#ifdef FLAC__SYMMETRIC_RICE +FLAC__bool FLAC__bitbuffer_write_symmetric_rice_signed(FLAC__BitBuffer *bb, int val, unsigned parameter); +#if 0 /* UNUSED */ +FLAC__bool FLAC__bitbuffer_write_symmetric_rice_signed_guarded(FLAC__BitBuffer *bb, int val, unsigned parameter, unsigned max_bits, FLAC__bool *overflow); +#endif +FLAC__bool FLAC__bitbuffer_write_symmetric_rice_signed_escape(FLAC__BitBuffer *bb, int val, unsigned parameter); +#endif +FLAC__bool FLAC__bitbuffer_write_rice_signed(FLAC__BitBuffer *bb, int val, unsigned parameter); +#if 0 /* UNUSED */ +FLAC__bool FLAC__bitbuffer_write_rice_signed_guarded(FLAC__BitBuffer *bb, int val, unsigned parameter, unsigned max_bits, FLAC__bool *overflow); +#endif +#if 0 /* UNUSED */ +FLAC__bool FLAC__bitbuffer_write_golomb_signed(FLAC__BitBuffer *bb, int val, unsigned parameter); +FLAC__bool FLAC__bitbuffer_write_golomb_signed_guarded(FLAC__BitBuffer *bb, int val, unsigned parameter, unsigned max_bits, FLAC__bool *overflow); +FLAC__bool FLAC__bitbuffer_write_golomb_unsigned(FLAC__BitBuffer *bb, unsigned val, unsigned parameter); +FLAC__bool FLAC__bitbuffer_write_golomb_unsigned_guarded(FLAC__BitBuffer *bb, unsigned val, unsigned parameter, unsigned max_bits, FLAC__bool *overflow); +#endif +FLAC__bool FLAC__bitbuffer_write_utf8_uint32(FLAC__BitBuffer *bb, FLAC__uint32 val); +FLAC__bool FLAC__bitbuffer_write_utf8_uint64(FLAC__BitBuffer *bb, FLAC__uint64 val); +FLAC__bool FLAC__bitbuffer_zero_pad_to_byte_boundary(FLAC__BitBuffer *bb); + +/* + * read functions + */ +FLAC__bool FLAC__bitbuffer_peek_bit(FLAC__BitBuffer *bb, unsigned *val, FLAC__bool (*read_callback)(FLAC__byte buffer[], unsigned *bytes, void *client_data), void *client_data); +FLAC__bool FLAC__bitbuffer_read_bit(FLAC__BitBuffer *bb, unsigned *val, FLAC__bool (*read_callback)(FLAC__byte buffer[], unsigned *bytes, void *client_data), void *client_data); +FLAC__bool FLAC__bitbuffer_read_bit_to_uint32(FLAC__BitBuffer *bb, FLAC__uint32 *val, FLAC__bool (*read_callback)(FLAC__byte buffer[], unsigned *bytes, void *client_data), void *client_data); +FLAC__bool FLAC__bitbuffer_read_bit_to_uint64(FLAC__BitBuffer *bb, FLAC__uint64 *val, FLAC__bool (*read_callback)(FLAC__byte buffer[], unsigned *bytes, void *client_data), void *client_data); +FLAC__bool FLAC__bitbuffer_read_raw_uint32(FLAC__BitBuffer *bb, FLAC__uint32 *val, const unsigned bits, FLAC__bool (*read_callback)(FLAC__byte buffer[], unsigned *bytes, void *client_data), void *client_data); +FLAC__bool FLAC__bitbuffer_read_raw_int32(FLAC__BitBuffer *bb, FLAC__int32 *val, const unsigned bits, FLAC__bool (*read_callback)(FLAC__byte buffer[], unsigned *bytes, void *client_data), void *client_data); +FLAC__bool FLAC__bitbuffer_read_raw_uint64(FLAC__BitBuffer *bb, FLAC__uint64 *val, const unsigned bits, FLAC__bool (*read_callback)(FLAC__byte buffer[], unsigned *bytes, void *client_data), void *client_data); +#if 0 /* UNUSED */ +FLAC__bool FLAC__bitbuffer_read_raw_int64(FLAC__BitBuffer *bb, FLAC__int64 *val, const unsigned bits, FLAC__bool (*read_callback)(FLAC__byte buffer[], unsigned *bytes, void *client_data), void *client_data); +#endif +FLAC__bool FLAC__bitbuffer_read_raw_uint32_little_endian(FLAC__BitBuffer *bb, FLAC__uint32 *val, FLAC__bool (*read_callback)(FLAC__byte buffer[], unsigned *bytes, void *client_data), void *client_data); /*only for bits=32*/ +FLAC__bool FLAC__bitbuffer_skip_bits_no_crc(FLAC__BitBuffer *bb, unsigned bits, FLAC__bool (*read_callback)(FLAC__byte buffer[], unsigned *bytes, void *client_data), void *client_data); /* WATCHOUT: does not CRC the skipped data! */ /*@@@@ add to unit tests */ +FLAC__bool FLAC__bitbuffer_read_byte_block_aligned_no_crc(FLAC__BitBuffer *bb, FLAC__byte *val, unsigned nvals, FLAC__bool (*read_callback)(FLAC__byte buffer[], unsigned *bytes, void *client_data), void *client_data); /* val may be 0 to skip bytes instead of reading them */ /* WATCHOUT: does not CRC the read data! */ +FLAC__bool FLAC__bitbuffer_read_unary_unsigned(FLAC__BitBuffer *bb, unsigned *val, FLAC__bool (*read_callback)(FLAC__byte buffer[], unsigned *bytes, void *client_data), void *client_data); +#ifdef FLAC__SYMMETRIC_RICE +FLAC__bool FLAC__bitbuffer_read_symmetric_rice_signed(FLAC__BitBuffer *bb, int *val, unsigned parameter, FLAC__bool (*read_callback)(FLAC__byte buffer[], unsigned *bytes, void *client_data), void *client_data); +#endif +FLAC__bool FLAC__bitbuffer_read_rice_signed(FLAC__BitBuffer *bb, int *val, unsigned parameter, FLAC__bool (*read_callback)(FLAC__byte buffer[], unsigned *bytes, void *client_data), void *client_data); +FLAC__bool FLAC__bitbuffer_read_rice_signed_block(FLAC__BitBuffer *bb, int vals[], unsigned nvals, unsigned parameter, FLAC__bool (*read_callback)(FLAC__byte buffer[], unsigned *bytes, void *client_data), void *client_data); +#if 0 /* UNUSED */ +FLAC__bool FLAC__bitbuffer_read_golomb_signed(FLAC__BitBuffer *bb, int *val, unsigned parameter, FLAC__bool (*read_callback)(FLAC__byte buffer[], unsigned *bytes, void *client_data), void *client_data); +FLAC__bool FLAC__bitbuffer_read_golomb_unsigned(FLAC__BitBuffer *bb, unsigned *val, unsigned parameter, FLAC__bool (*read_callback)(FLAC__byte buffer[], unsigned *bytes, void *client_data), void *client_data); +#endif +FLAC__bool FLAC__bitbuffer_read_utf8_uint32(FLAC__BitBuffer *bb, FLAC__uint32 *val, FLAC__bool (*read_callback)(FLAC__byte buffer[], unsigned *bytes, void *client_data), void *client_data, FLAC__byte *raw, unsigned *rawlen); +FLAC__bool FLAC__bitbuffer_read_utf8_uint64(FLAC__BitBuffer *bb, FLAC__uint64 *val, FLAC__bool (*read_callback)(FLAC__byte buffer[], unsigned *bytes, void *client_data), void *client_data, FLAC__byte *raw, unsigned *rawlen); +void FLAC__bitbuffer_dump(const FLAC__BitBuffer *bb, FILE *out); + +#endif diff --git a/Libraries/FLAC/Files/src/libFLAC/include/private/bitmath.h b/Libraries/FLAC/Files/src/libFLAC/include/private/bitmath.h new file mode 100644 index 000000000..1615c338c --- /dev/null +++ b/Libraries/FLAC/Files/src/libFLAC/include/private/bitmath.h @@ -0,0 +1,42 @@ +/* libFLAC - Free Lossless Audio Codec library + * Copyright (C) 2001,2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef FLAC__PRIVATE__BITMATH_H +#define FLAC__PRIVATE__BITMATH_H + +#include "FLAC/ordinals.h" + +unsigned FLAC__bitmath_ilog2(FLAC__uint32 v); +unsigned FLAC__bitmath_ilog2_wide(FLAC__uint64 v); +unsigned FLAC__bitmath_silog2(int v); +unsigned FLAC__bitmath_silog2_wide(FLAC__int64 v); + +#endif diff --git a/Libraries/FLAC/Files/src/libFLAC/include/private/cpu.h b/Libraries/FLAC/Files/src/libFLAC/include/private/cpu.h new file mode 100644 index 000000000..a57936051 --- /dev/null +++ b/Libraries/FLAC/Files/src/libFLAC/include/private/cpu.h @@ -0,0 +1,94 @@ +/* libFLAC - Free Lossless Audio Codec library + * Copyright (C) 2001,2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef FLAC__PRIVATE__CPU_H +#define FLAC__PRIVATE__CPU_H + +#include "FLAC/ordinals.h" + +#ifdef HAVE_CONFIG_H +#include +#endif + +typedef enum { + FLAC__CPUINFO_TYPE_IA32, + FLAC__CPUINFO_TYPE_PPC, + FLAC__CPUINFO_TYPE_UNKNOWN +} FLAC__CPUInfo_Type; + +typedef struct { + FLAC__bool cmov; + FLAC__bool mmx; + FLAC__bool fxsr; + FLAC__bool sse; + FLAC__bool sse2; + FLAC__bool _3dnow; + FLAC__bool ext3dnow; + FLAC__bool extmmx; +} FLAC__CPUInfo_IA32; + +typedef struct { + FLAC__bool altivec; + FLAC__bool ppc64; +} FLAC__CPUInfo_PPC; + +extern const unsigned FLAC__CPUINFO_IA32_CPUID_CMOV; +extern const unsigned FLAC__CPUINFO_IA32_CPUID_MMX; +extern const unsigned FLAC__CPUINFO_IA32_CPUID_FXSR; +extern const unsigned FLAC__CPUINFO_IA32_CPUID_SSE; +extern const unsigned FLAC__CPUINFO_IA32_CPUID_SSE2; + +extern const unsigned FLAC__CPUINFO_IA32_CPUID_EXTENDED_AMD_3DNOW; +extern const unsigned FLAC__CPUINFO_IA32_CPUID_EXTENDED_AMD_EXT3DNOW; +extern const unsigned FLAC__CPUINFO_IA32_CPUID_EXTENDED_AMD_EXTMMX; + +typedef struct { + FLAC__bool use_asm; + FLAC__CPUInfo_Type type; + union { + FLAC__CPUInfo_IA32 ia32; + FLAC__CPUInfo_PPC ppc; + } data; +} FLAC__CPUInfo; + +void FLAC__cpu_info(FLAC__CPUInfo *info); + +#ifndef FLAC__NO_ASM +#ifdef FLAC__CPU_IA32 +#ifdef FLAC__HAS_NASM +unsigned FLAC__cpu_info_asm_ia32(); +unsigned FLAC__cpu_info_extended_amd_asm_ia32(); +unsigned FLAC__cpu_info_sse_test_asm_ia32(); +#endif +#endif +#endif + +#endif diff --git a/Libraries/FLAC/Files/src/libFLAC/include/private/crc.h b/Libraries/FLAC/Files/src/libFLAC/include/private/crc.h new file mode 100644 index 000000000..487ed0401 --- /dev/null +++ b/Libraries/FLAC/Files/src/libFLAC/include/private/crc.h @@ -0,0 +1,57 @@ +/* libFLAC - Free Lossless Audio Codec library + * Copyright (C) 2000,2001,2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef FLAC__PRIVATE__CRC_H +#define FLAC__PRIVATE__CRC_H + +#include "FLAC/ordinals.h" + +/* 8 bit CRC generator, MSB shifted first +** polynomial = x^8 + x^2 + x^1 + x^0 +** init = 0 +*/ +extern FLAC__byte const FLAC__crc8_table[256]; +#define FLAC__CRC8_UPDATE(data, crc) (crc) = FLAC__crc8_table[(crc) ^ (data)]; +void FLAC__crc8_update(const FLAC__byte data, FLAC__uint8 *crc); +void FLAC__crc8_update_block(const FLAC__byte *data, unsigned len, FLAC__uint8 *crc); +FLAC__uint8 FLAC__crc8(const FLAC__byte *data, unsigned len); + +/* 16 bit CRC generator, MSB shifted first +** polynomial = x^16 + x^15 + x^2 + x^0 +** init = 0 +*/ +extern FLAC__uint16 FLAC__crc16_table[256]; +#define FLAC__CRC16_UPDATE(data, crc) (crc) = ((crc)<<8) ^ FLAC__crc16_table[((crc)>>8) ^ (data)]; +void FLAC__crc16_update(const FLAC__byte data, FLAC__uint16 *crc); +void FLAC__crc16_update_block(const FLAC__byte *data, unsigned len, FLAC__uint16 *crc); +FLAC__uint16 FLAC__crc16(const FLAC__byte *data, unsigned len); + +#endif diff --git a/Libraries/FLAC/Files/src/libFLAC/include/private/fixed.h b/Libraries/FLAC/Files/src/libFLAC/include/private/fixed.h new file mode 100644 index 000000000..8401ffa8e --- /dev/null +++ b/Libraries/FLAC/Files/src/libFLAC/include/private/fixed.h @@ -0,0 +1,97 @@ +/* libFLAC - Free Lossless Audio Codec library + * Copyright (C) 2000,2001,2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef FLAC__PRIVATE__FIXED_H +#define FLAC__PRIVATE__FIXED_H + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "private/float.h" +#include "FLAC/format.h" + +/* + * FLAC__fixed_compute_best_predictor() + * -------------------------------------------------------------------- + * Compute the best fixed predictor and the expected bits-per-sample + * of the residual signal for each order. The _wide() version uses + * 64-bit integers which is statistically necessary when bits-per- + * sample + log2(blocksize) > 30 + * + * IN data[0,data_len-1] + * IN data_len + * OUT residual_bits_per_sample[0,FLAC__MAX_FIXED_ORDER] + */ +#ifndef FLAC__INTEGER_ONLY_LIBRARY +unsigned FLAC__fixed_compute_best_predictor(const FLAC__int32 data[], unsigned data_len, FLAC__float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]); +# ifndef FLAC__NO_ASM +# ifdef FLAC__CPU_IA32 +# ifdef FLAC__HAS_NASM +unsigned FLAC__fixed_compute_best_predictor_asm_ia32_mmx_cmov(const FLAC__int32 data[], unsigned data_len, FLAC__float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]); +# endif +# endif +# endif +unsigned FLAC__fixed_compute_best_predictor_wide(const FLAC__int32 data[], unsigned data_len, FLAC__float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]); +#else +unsigned FLAC__fixed_compute_best_predictor(const FLAC__int32 data[], unsigned data_len, FLAC__fixedpoint residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]); +unsigned FLAC__fixed_compute_best_predictor_wide(const FLAC__int32 data[], unsigned data_len, FLAC__fixedpoint residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]); +#endif + +/* + * FLAC__fixed_compute_residual() + * -------------------------------------------------------------------- + * Compute the residual signal obtained from sutracting the predicted + * signal from the original. + * + * IN data[-order,data_len-1] original signal (NOTE THE INDICES!) + * IN data_len length of original signal + * IN order <= FLAC__MAX_FIXED_ORDER fixed-predictor order + * OUT residual[0,data_len-1] residual signal + */ +void FLAC__fixed_compute_residual(const FLAC__int32 data[], unsigned data_len, unsigned order, FLAC__int32 residual[]); + +/* + * FLAC__fixed_restore_signal() + * -------------------------------------------------------------------- + * Restore the original signal by summing the residual and the + * predictor. + * + * IN residual[0,data_len-1] residual signal + * IN data_len length of original signal + * IN order <= FLAC__MAX_FIXED_ORDER fixed-predictor order + * *** IMPORTANT: the caller must pass in the historical samples: + * IN data[-order,-1] previously-reconstructed historical samples + * OUT data[0,data_len-1] original signal + */ +void FLAC__fixed_restore_signal(const FLAC__int32 residual[], unsigned data_len, unsigned order, FLAC__int32 data[]); + +#endif diff --git a/Libraries/FLAC/Files/src/libFLAC/include/private/float.h b/Libraries/FLAC/Files/src/libFLAC/include/private/float.h new file mode 100644 index 000000000..67a5f266e --- /dev/null +++ b/Libraries/FLAC/Files/src/libFLAC/include/private/float.h @@ -0,0 +1,97 @@ +/* libFLAC - Free Lossless Audio Codec library + * Copyright (C) 2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef FLAC__PRIVATE__FLOAT_H +#define FLAC__PRIVATE__FLOAT_H + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "FLAC/ordinals.h" + +/* + * These typedefs make it easier to ensure that integer versions of + * the library really only contain integer operations. All the code + * in libFLAC should use FLAC__float and FLAC__double in place of + * float and double, and be protected by checks of the macro + * FLAC__INTEGER_ONLY_LIBRARY. + * + * FLAC__real is the basic floating point type used in LPC analysis. + */ +#ifndef FLAC__INTEGER_ONLY_LIBRARY +typedef double FLAC__double; +typedef float FLAC__float; +/* + * WATCHOUT: changing FLAC__real will change the signatures of many + * functions that have assembly language equivalents and break them. + */ +typedef float FLAC__real; +#else +/* + * The convention for FLAC__fixedpoint is to use the upper 16 bits + * for the integer part and lower 16 bits for the fractional part. + */ +typedef FLAC__int32 FLAC__fixedpoint; +extern const FLAC__fixedpoint FLAC__FP_ZERO; +extern const FLAC__fixedpoint FLAC__FP_ONE_HALF; +extern const FLAC__fixedpoint FLAC__FP_ONE; +extern const FLAC__fixedpoint FLAC__FP_LN2; +extern const FLAC__fixedpoint FLAC__FP_E; + +#define FLAC__fixedpoint_trunc(x) ((x)>>16) + +#define FLAC__fixedpoint_mul(x, y) ( (FLAC__fixedpoint) ( ((FLAC__int64)(x)*(FLAC__int64)(y)) >> 16 ) ) + +#define FLAC__fixedpoint_div(x, y) ( (FLAC__fixedpoint) ( ( ((FLAC__int64)(x)<<32) / (FLAC__int64)(y) ) >> 16 ) ) + +/* + * FLAC__fixedpoint_log2() + * -------------------------------------------------------------------- + * Returns the base-2 logarithm of the fixed-point number 'x' using an + * algorithm by Knuth for x >= 1.0 + * + * 'fracbits' is the number of fractional bits of 'x'. 'fracbits' must + * be < 32 and evenly divisible by 4 (0 is OK but not very precise). + * + * 'precision' roughly limits the number of iterations that are done; + * use (unsigned)(-1) for maximum precision. + * + * If 'x' is less than one -- that is, x < (1< +#endif + +#include "private/float.h" +#include "FLAC/format.h" + +#ifndef FLAC__INTEGER_ONLY_LIBRARY + +/* + * FLAC__lpc_compute_autocorrelation() + * -------------------------------------------------------------------- + * Compute the autocorrelation for lags between 0 and lag-1. + * Assumes data[] outside of [0,data_len-1] == 0. + * Asserts that lag > 0. + * + * IN data[0,data_len-1] + * IN data_len + * IN 0 < lag <= data_len + * OUT autoc[0,lag-1] + */ +void FLAC__lpc_compute_autocorrelation(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[]); +#ifndef FLAC__NO_ASM +# ifdef FLAC__CPU_IA32 +# ifdef FLAC__HAS_NASM +void FLAC__lpc_compute_autocorrelation_asm_ia32(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[]); +void FLAC__lpc_compute_autocorrelation_asm_ia32_sse_lag_4(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[]); +void FLAC__lpc_compute_autocorrelation_asm_ia32_sse_lag_8(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[]); +void FLAC__lpc_compute_autocorrelation_asm_ia32_sse_lag_12(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[]); +void FLAC__lpc_compute_autocorrelation_asm_ia32_3dnow(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[]); +# endif +# endif +#endif + +/* + * FLAC__lpc_compute_lp_coefficients() + * -------------------------------------------------------------------- + * Computes LP coefficients for orders 1..max_order. + * Do not call if autoc[0] == 0.0. This means the signal is zero + * and there is no point in calculating a predictor. + * + * IN autoc[0,max_order] autocorrelation values + * IN 0 < max_order <= FLAC__MAX_LPC_ORDER max LP order to compute + * OUT lp_coeff[0,max_order-1][0,max_order-1] LP coefficients for each order + * *** IMPORTANT: + * *** lp_coeff[0,max_order-1][max_order,FLAC__MAX_LPC_ORDER-1] are untouched + * OUT error[0,max_order-1] error for each order + * + * Example: if max_order is 9, the LP coefficients for order 9 will be + * in lp_coeff[8][0,8], the LP coefficients for order 8 will be + * in lp_coeff[7][0,7], etc. + */ +void FLAC__lpc_compute_lp_coefficients(const FLAC__real autoc[], unsigned max_order, FLAC__real lp_coeff[][FLAC__MAX_LPC_ORDER], FLAC__double error[]); + +/* + * FLAC__lpc_quantize_coefficients() + * -------------------------------------------------------------------- + * Quantizes the LP coefficients. NOTE: precision + bits_per_sample + * must be less than 32 (sizeof(FLAC__int32)*8). + * + * IN lp_coeff[0,order-1] LP coefficients + * IN order LP order + * IN FLAC__MIN_QLP_COEFF_PRECISION < precision + * desired precision (in bits, including sign + * bit) of largest coefficient + * OUT qlp_coeff[0,order-1] quantized coefficients + * OUT shift # of bits to shift right to get approximated + * LP coefficients. NOTE: could be negative. + * RETURN 0 => quantization OK + * 1 => coefficients require too much shifting for *shift to + * fit in the LPC subframe header. 'shift' is unset. + * 2 => coefficients are all zero, which is bad. 'shift' is + * unset. + */ +int FLAC__lpc_quantize_coefficients(const FLAC__real lp_coeff[], unsigned order, unsigned precision, FLAC__int32 qlp_coeff[], int *shift); + +/* + * FLAC__lpc_compute_residual_from_qlp_coefficients() + * -------------------------------------------------------------------- + * Compute the residual signal obtained from sutracting the predicted + * signal from the original. + * + * IN data[-order,data_len-1] original signal (NOTE THE INDICES!) + * IN data_len length of original signal + * IN qlp_coeff[0,order-1] quantized LP coefficients + * IN order > 0 LP order + * IN lp_quantization quantization of LP coefficients in bits + * OUT residual[0,data_len-1] residual signal + */ +void FLAC__lpc_compute_residual_from_qlp_coefficients(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[]); +void FLAC__lpc_compute_residual_from_qlp_coefficients_wide(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[]); +#ifndef FLAC__NO_ASM +# ifdef FLAC__CPU_IA32 +# ifdef FLAC__HAS_NASM +void FLAC__lpc_compute_residual_from_qlp_coefficients_asm_ia32(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[]); +void FLAC__lpc_compute_residual_from_qlp_coefficients_asm_ia32_mmx(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[]); +# endif +# endif +#endif + +#endif /* !defined FLAC__INTEGER_ONLY_LIBRARY */ + +/* + * FLAC__lpc_restore_signal() + * -------------------------------------------------------------------- + * Restore the original signal by summing the residual and the + * predictor. + * + * IN residual[0,data_len-1] residual signal + * IN data_len length of original signal + * IN qlp_coeff[0,order-1] quantized LP coefficients + * IN order > 0 LP order + * IN lp_quantization quantization of LP coefficients in bits + * *** IMPORTANT: the caller must pass in the historical samples: + * IN data[-order,-1] previously-reconstructed historical samples + * OUT data[0,data_len-1] original signal + */ +void FLAC__lpc_restore_signal(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]); +void FLAC__lpc_restore_signal_wide(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]); +#ifndef FLAC__NO_ASM +# ifdef FLAC__CPU_IA32 +# ifdef FLAC__HAS_NASM +void FLAC__lpc_restore_signal_asm_ia32(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]); +void FLAC__lpc_restore_signal_asm_ia32_mmx(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]); +# endif /* FLAC__HAS_NASM */ +# elif defined FLAC__CPU_PPC +void FLAC__lpc_restore_signal_asm_ppc_altivec_16(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]); +void FLAC__lpc_restore_signal_asm_ppc_altivec_16_order8(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]); +# endif/* FLAC__CPU_IA32 || FLAC__CPU_PPC */ +#endif /* FLAC__NO_ASM */ + +#ifndef FLAC__INTEGER_ONLY_LIBRARY + +/* + * FLAC__lpc_compute_expected_bits_per_residual_sample() + * -------------------------------------------------------------------- + * Compute the expected number of bits per residual signal sample + * based on the LP error (which is related to the residual variance). + * + * IN lpc_error >= 0.0 error returned from calculating LP coefficients + * IN total_samples > 0 # of samples in residual signal + * RETURN expected bits per sample + */ +FLAC__double FLAC__lpc_compute_expected_bits_per_residual_sample(FLAC__double lpc_error, unsigned total_samples); +FLAC__double FLAC__lpc_compute_expected_bits_per_residual_sample_with_error_scale(FLAC__double lpc_error, FLAC__double error_scale); + +/* + * FLAC__lpc_compute_best_order() + * -------------------------------------------------------------------- + * Compute the best order from the array of signal errors returned + * during coefficient computation. + * + * IN lpc_error[0,max_order-1] >= 0.0 error returned from calculating LP coefficients + * IN max_order > 0 max LP order + * IN total_samples > 0 # of samples in residual signal + * IN bits_per_signal_sample # of bits per sample in the original signal + * RETURN [1,max_order] best order + */ +unsigned FLAC__lpc_compute_best_order(const FLAC__double lpc_error[], unsigned max_order, unsigned total_samples, unsigned bits_per_signal_sample); + +#endif /* !defined FLAC__INTEGER_ONLY_LIBRARY */ + +#endif diff --git a/Libraries/FLAC/Files/src/libFLAC/include/private/md5.h b/Libraries/FLAC/Files/src/libFLAC/include/private/md5.h new file mode 100644 index 000000000..e85326015 --- /dev/null +++ b/Libraries/FLAC/Files/src/libFLAC/include/private/md5.h @@ -0,0 +1,54 @@ +/* + * This is the header file for the MD5 message-digest algorithm. + * The algorithm is due to Ron Rivest. This code was + * written by Colin Plumb in 1993, no copyright is claimed. + * This code is in the public domain; do with it what you wish. + * + * Equivalent code is available from RSA Data Security, Inc. + * This code has been tested against that, and is equivalent, + * except that you don't need to include two pages of legalese + * with every copy. + * + * To compute the message digest of a chunk of bytes, declare an + * MD5Context structure, pass it to MD5Init, call MD5Update as + * needed on buffers full of bytes, and then call MD5Final, which + * will fill a supplied 16-byte array with the digest. + * + * Changed so as no longer to depend on Colin Plumb's `usual.h' + * header definitions; now uses stuff from dpkg's config.h + * - Ian Jackson . + * Still in the public domain. + * + * Josh Coalson: made some changes to integrate with libFLAC. + * Still in the public domain. + */ + +#ifndef FLAC__PRIVATE__MD5_H +#define FLAC__PRIVATE__MD5_H + +#define md5byte unsigned char + +/* + * Due to an unholy abomination in libOggFLAC (it requires access to + * these internal MD5 functions) we have to #include "FLAC/export.h" + * and export them when building a DLL + */ +#include "FLAC/export.h" +#include "FLAC/ordinals.h" + +struct FLAC__MD5Context { + FLAC__uint32 buf[4]; + FLAC__uint32 bytes[2]; + FLAC__uint32 in[16]; + FLAC__byte *internal_buf; + unsigned capacity; +}; + +FLAC_API void FLAC__MD5Init(struct FLAC__MD5Context *context); +FLAC_API void FLAC__MD5Update(struct FLAC__MD5Context *context, md5byte const *buf, unsigned len); +FLAC_API void FLAC__MD5Final(md5byte digest[16], struct FLAC__MD5Context *context); +void FLAC__MD5Transform(FLAC__uint32 buf[4], FLAC__uint32 const in[16]); + +FLAC_API FLAC__bool FLAC__MD5Accumulate(struct FLAC__MD5Context *ctx, const FLAC__int32 * const signal[], unsigned channels, unsigned samples, unsigned bytes_per_sample); + +#endif /* !MD5_H */ diff --git a/Libraries/FLAC/Files/src/libFLAC/include/private/memory.h b/Libraries/FLAC/Files/src/libFLAC/include/private/memory.h new file mode 100644 index 000000000..fca808155 --- /dev/null +++ b/Libraries/FLAC/Files/src/libFLAC/include/private/memory.h @@ -0,0 +1,56 @@ +/* libFLAC - Free Lossless Audio Codec library + * Copyright (C) 2001,2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef FLAC__PRIVATE__MEMORY_H +#define FLAC__PRIVATE__MEMORY_H + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include /* for size_t */ + +#include "private/float.h" +#include "FLAC/ordinals.h" /* for FLAC__bool */ + +/* Returns the unaligned address returned by malloc. + * Use free() on this address to deallocate. + */ +void *FLAC__memory_alloc_aligned(size_t bytes, void **aligned_address); +FLAC__bool FLAC__memory_alloc_aligned_int32_array(unsigned elements, FLAC__int32 **unaligned_pointer, FLAC__int32 **aligned_pointer); +FLAC__bool FLAC__memory_alloc_aligned_uint32_array(unsigned elements, FLAC__uint32 **unaligned_pointer, FLAC__uint32 **aligned_pointer); +FLAC__bool FLAC__memory_alloc_aligned_uint64_array(unsigned elements, FLAC__uint64 **unaligned_pointer, FLAC__uint64 **aligned_pointer); +FLAC__bool FLAC__memory_alloc_aligned_unsigned_array(unsigned elements, unsigned **unaligned_pointer, unsigned **aligned_pointer); +#ifndef FLAC__INTEGER_ONLY_LIBRARY +FLAC__bool FLAC__memory_alloc_aligned_real_array(unsigned elements, FLAC__real **unaligned_pointer, FLAC__real **aligned_pointer); +#endif + +#endif diff --git a/Libraries/FLAC/Files/src/libFLAC/include/private/metadata.h b/Libraries/FLAC/Files/src/libFLAC/include/private/metadata.h new file mode 100644 index 000000000..f95e2deab --- /dev/null +++ b/Libraries/FLAC/Files/src/libFLAC/include/private/metadata.h @@ -0,0 +1,40 @@ +/* libFLAC - Free Lossless Audio Codec library + * Copyright (C) 2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef FLAC__PRIVATE__METADATA_H +#define FLAC__PRIVATE__METADATA_H + +#include "FLAC/metadata.h" + +void FLAC__metadata_object_delete_data(FLAC__StreamMetadata *object); +void FLAC__metadata_object_cuesheet_track_delete_data(FLAC__StreamMetadata_CueSheet_Track *object); + +#endif diff --git a/Libraries/FLAC/Files/src/libFLAC/include/private/stream_encoder_framing.h b/Libraries/FLAC/Files/src/libFLAC/include/private/stream_encoder_framing.h new file mode 100644 index 000000000..5b5426a3e --- /dev/null +++ b/Libraries/FLAC/Files/src/libFLAC/include/private/stream_encoder_framing.h @@ -0,0 +1,45 @@ +/* libFLAC - Free Lossless Audio Codec library + * Copyright (C) 2000,2001,2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef FLAC__PRIVATE__STREAM_ENCODER_FRAMING_H +#define FLAC__PRIVATE__STREAM_ENCODER_FRAMING_H + +#include "FLAC/format.h" +#include "bitbuffer.h" + +FLAC__bool FLAC__add_metadata_block(const FLAC__StreamMetadata *metadata, FLAC__BitBuffer *bb); +FLAC__bool FLAC__frame_add_header(const FLAC__FrameHeader *header, FLAC__bool streamable_subset, FLAC__BitBuffer *bb); +FLAC__bool FLAC__subframe_add_constant(const FLAC__Subframe_Constant *subframe, unsigned subframe_bps, unsigned wasted_bits, FLAC__BitBuffer *bb); +FLAC__bool FLAC__subframe_add_fixed(const FLAC__Subframe_Fixed *subframe, unsigned residual_samples, unsigned subframe_bps, unsigned wasted_bits, FLAC__BitBuffer *bb); +FLAC__bool FLAC__subframe_add_lpc(const FLAC__Subframe_LPC *subframe, unsigned residual_samples, unsigned subframe_bps, unsigned wasted_bits, FLAC__BitBuffer *bb); +FLAC__bool FLAC__subframe_add_verbatim(const FLAC__Subframe_Verbatim *subframe, unsigned samples, unsigned subframe_bps, unsigned wasted_bits, FLAC__BitBuffer *bb); + +#endif diff --git a/Libraries/FLAC/Files/src/libFLAC/include/protected/Makefile.am b/Libraries/FLAC/Files/src/libFLAC/include/protected/Makefile.am new file mode 100644 index 000000000..e4e3931fa --- /dev/null +++ b/Libraries/FLAC/Files/src/libFLAC/include/protected/Makefile.am @@ -0,0 +1,38 @@ +# libFLAC - Free Lossless Audio Codec library +# Copyright (C) 2001,2002,2003,2004,2005 Josh Coalson +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# - Neither the name of the Xiph.org Foundation nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +noinst_HEADERS = \ + all.h \ + file_decoder.h \ + file_encoder.h \ + seekable_stream_decoder.h \ + seekable_stream_encoder.h \ + stream_decoder.h \ + stream_encoder.h diff --git a/Libraries/FLAC/Files/src/libFLAC/include/protected/Makefile.in b/Libraries/FLAC/Files/src/libFLAC/include/protected/Makefile.in new file mode 100644 index 000000000..e5fbe07b5 --- /dev/null +++ b/Libraries/FLAC/Files/src/libFLAC/include/protected/Makefile.in @@ -0,0 +1,457 @@ +# Makefile.in generated by automake 1.8.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# libFLAC - Free Lossless Audio Codec library +# Copyright (C) 2001,2002,2003,2004,2005 Josh Coalson +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# - Neither the name of the Xiph.org Foundation nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../../../.. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_triplet = @host@ +subdir = src/libFLAC/include/protected +DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(mkdir_p) +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +HEADERS = $(noinst_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCAS = @CCAS@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEBUG_FALSE = @DEBUG_FALSE@ +DEBUG_TRUE = @DEBUG_TRUE@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DOCBOOK_TO_MAN = @DOCBOOK_TO_MAN@ +DOXYGEN = @DOXYGEN@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FLaC__CPU_IA32_FALSE = @FLaC__CPU_IA32_FALSE@ +FLaC__CPU_IA32_TRUE = @FLaC__CPU_IA32_TRUE@ +FLaC__CPU_PPC_FALSE = @FLaC__CPU_PPC_FALSE@ +FLaC__CPU_PPC_TRUE = @FLaC__CPU_PPC_TRUE@ +FLaC__CPU_SPARC_FALSE = @FLaC__CPU_SPARC_FALSE@ +FLaC__CPU_SPARC_TRUE = @FLaC__CPU_SPARC_TRUE@ +FLaC__EXHAUSTIVE_TESTS_FALSE = @FLaC__EXHAUSTIVE_TESTS_FALSE@ +FLaC__EXHAUSTIVE_TESTS_TRUE = @FLaC__EXHAUSTIVE_TESTS_TRUE@ +FLaC__HAS_AS_FALSE = @FLaC__HAS_AS_FALSE@ +FLaC__HAS_AS_TRUE = @FLaC__HAS_AS_TRUE@ +FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@ +FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@ +FLaC__HAS_DOCBOOK_TO_MAN_FALSE = @FLaC__HAS_DOCBOOK_TO_MAN_FALSE@ +FLaC__HAS_DOCBOOK_TO_MAN_TRUE = @FLaC__HAS_DOCBOOK_TO_MAN_TRUE@ +FLaC__HAS_DOXYGEN_FALSE = @FLaC__HAS_DOXYGEN_FALSE@ +FLaC__HAS_DOXYGEN_TRUE = @FLaC__HAS_DOXYGEN_TRUE@ +FLaC__HAS_GAS_FALSE = @FLaC__HAS_GAS_FALSE@ +FLaC__HAS_GAS_TRUE = @FLaC__HAS_GAS_TRUE@ +FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@ +FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@ +FLaC__HAS_NASM_FALSE = @FLaC__HAS_NASM_FALSE@ +FLaC__HAS_NASM_TRUE = @FLaC__HAS_NASM_TRUE@ +FLaC__HAS_OGG_FALSE = @FLaC__HAS_OGG_FALSE@ +FLaC__HAS_OGG_TRUE = @FLaC__HAS_OGG_TRUE@ +FLaC__HAS_XMMS_FALSE = @FLaC__HAS_XMMS_FALSE@ +FLaC__HAS_XMMS_TRUE = @FLaC__HAS_XMMS_TRUE@ +FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE@ +FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE@ +FLaC__NO_ASM_FALSE = @FLaC__NO_ASM_FALSE@ +FLaC__NO_ASM_TRUE = @FLaC__NO_ASM_TRUE@ +FLaC__SSE_OS_FALSE = @FLaC__SSE_OS_FALSE@ +FLaC__SSE_OS_TRUE = @FLaC__SSE_OS_TRUE@ +FLaC__SYS_DARWIN_FALSE = @FLaC__SYS_DARWIN_FALSE@ +FLaC__SYS_DARWIN_TRUE = @FLaC__SYS_DARWIN_TRUE@ +FLaC__SYS_LINUX_FALSE = @FLaC__SYS_LINUX_FALSE@ +FLaC__SYS_LINUX_TRUE = @FLaC__SYS_LINUX_TRUE@ +FLaC__USE_3DNOW_FALSE = @FLaC__USE_3DNOW_FALSE@ +FLaC__USE_3DNOW_TRUE = @FLaC__USE_3DNOW_TRUE@ +FLaC__USE_ALTIVEC_FALSE = @FLaC__USE_ALTIVEC_FALSE@ +FLaC__USE_ALTIVEC_TRUE = @FLaC__USE_ALTIVEC_TRUE@ +FLaC__VALGRIND_TESTING_FALSE = @FLaC__VALGRIND_TESTING_FALSE@ +FLaC__VALGRIND_TESTING_TRUE = @FLaC__VALGRIND_TESTING_TRUE@ +GAS = @GAS@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +NASM = @NASM@ +OBJEXT = @OBJEXT@ +OBJ_FORMAT = @OBJ_FORMAT@ +OGG_CFLAGS = @OGG_CFLAGS@ +OGG_LIBS = @OGG_LIBS@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +XMMS_CFLAGS = @XMMS_CFLAGS@ +XMMS_CONFIG = @XMMS_CONFIG@ +XMMS_DATA_DIR = @XMMS_DATA_DIR@ +XMMS_EFFECT_PLUGIN_DIR = @XMMS_EFFECT_PLUGIN_DIR@ +XMMS_GENERAL_PLUGIN_DIR = @XMMS_GENERAL_PLUGIN_DIR@ +XMMS_INPUT_PLUGIN_DIR = @XMMS_INPUT_PLUGIN_DIR@ +XMMS_LIBS = @XMMS_LIBS@ +XMMS_OUTPUT_PLUGIN_DIR = @XMMS_OUTPUT_PLUGIN_DIR@ +XMMS_PLUGIN_DIR = @XMMS_PLUGIN_DIR@ +XMMS_VERSION = @XMMS_VERSION@ +XMMS_VISUALIZATION_PLUGIN_DIR = @XMMS_VISUALIZATION_PLUGIN_DIR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +noinst_HEADERS = \ + all.h \ + file_decoder.h \ + file_encoder.h \ + seekable_stream_decoder.h \ + seekable_stream_encoder.h \ + stream_decoder.h \ + stream_encoder.h + +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/libFLAC/include/protected/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/libFLAC/include/protected/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(HEADERS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-libtool \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool ctags distclean distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ + uninstall-am uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/Libraries/FLAC/Files/src/libFLAC/include/protected/all.h b/Libraries/FLAC/Files/src/libFLAC/include/protected/all.h new file mode 100644 index 000000000..12e7ae2a5 --- /dev/null +++ b/Libraries/FLAC/Files/src/libFLAC/include/protected/all.h @@ -0,0 +1,42 @@ +/* libFLAC - Free Lossless Audio Codec library + * Copyright (C) 2001,2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef FLAC__PROTECTED__ALL_H +#define FLAC__PROTECTED__ALL_H + +#include "file_decoder.h" +#include "file_encoder.h" +#include "seekable_stream_decoder.h" +#include "seekable_stream_encoder.h" +#include "stream_decoder.h" +#include "stream_encoder.h" + +#endif diff --git a/Libraries/FLAC/Files/src/libFLAC/include/protected/file_decoder.h b/Libraries/FLAC/Files/src/libFLAC/include/protected/file_decoder.h new file mode 100644 index 000000000..88662bb34 --- /dev/null +++ b/Libraries/FLAC/Files/src/libFLAC/include/protected/file_decoder.h @@ -0,0 +1,41 @@ +/* libFLAC - Free Lossless Audio Codec library + * Copyright (C) 2000,2001,2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef FLAC__PROTECTED__FILE_DECODER_H +#define FLAC__PROTECTED__FILE_DECODER_H + +#include "FLAC/file_decoder.h" + +typedef struct FLAC__FileDecoderProtected { + FLAC__FileDecoderState state; +} FLAC__FileDecoderProtected; + +#endif diff --git a/Libraries/FLAC/Files/src/libFLAC/include/protected/file_encoder.h b/Libraries/FLAC/Files/src/libFLAC/include/protected/file_encoder.h new file mode 100644 index 000000000..1d516d1da --- /dev/null +++ b/Libraries/FLAC/Files/src/libFLAC/include/protected/file_encoder.h @@ -0,0 +1,41 @@ +/* libFLAC - Free Lossless Audio Codec library + * Copyright (C) 2001,2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef FLAC__PROTECTED__FILE_ENCODER_H +#define FLAC__PROTECTED__FILE_ENCODER_H + +#include "FLAC/file_encoder.h" + +typedef struct FLAC__FileEncoderProtected { + FLAC__FileEncoderState state; +} FLAC__FileEncoderProtected; + +#endif diff --git a/Libraries/FLAC/Files/src/libFLAC/include/protected/seekable_stream_decoder.h b/Libraries/FLAC/Files/src/libFLAC/include/protected/seekable_stream_decoder.h new file mode 100644 index 000000000..71123da89 --- /dev/null +++ b/Libraries/FLAC/Files/src/libFLAC/include/protected/seekable_stream_decoder.h @@ -0,0 +1,42 @@ +/* libFLAC - Free Lossless Audio Codec library + * Copyright (C) 2000,2001,2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef FLAC__PROTECTED__SEEKABLE_STREAM_DECODER_H +#define FLAC__PROTECTED__SEEKABLE_STREAM_DECODER_H + +#include "FLAC/seekable_stream_decoder.h" + +typedef struct FLAC__SeekableStreamDecoderProtected { + FLAC__bool md5_checking; /* if true, generate MD5 signature of decoded data and compare against signature in the STREAMINFO metadata block */ + FLAC__SeekableStreamDecoderState state; +} FLAC__SeekableStreamDecoderProtected; + +#endif diff --git a/Libraries/FLAC/Files/src/libFLAC/include/protected/seekable_stream_encoder.h b/Libraries/FLAC/Files/src/libFLAC/include/protected/seekable_stream_encoder.h new file mode 100644 index 000000000..3341d9a5a --- /dev/null +++ b/Libraries/FLAC/Files/src/libFLAC/include/protected/seekable_stream_encoder.h @@ -0,0 +1,42 @@ +/* libFLAC - Free Lossless Audio Codec library + * Copyright (C) 2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef FLAC__PROTECTED__SEEKABLE_STREAM_ENCODER_H +#define FLAC__PROTECTED__SEEKABLE_STREAM_ENCODER_H + +#include "FLAC/seekable_stream_encoder.h" + +typedef struct FLAC__SeekableStreamEncoderProtected { + FLAC__SeekableStreamEncoderState state; + FLAC__uint64 streaminfo_offset, seektable_offset, audio_offset; +} FLAC__SeekableStreamEncoderProtected; + +#endif diff --git a/Libraries/FLAC/Files/src/libFLAC/include/protected/stream_decoder.h b/Libraries/FLAC/Files/src/libFLAC/include/protected/stream_decoder.h new file mode 100644 index 000000000..15eaf28d7 --- /dev/null +++ b/Libraries/FLAC/Files/src/libFLAC/include/protected/stream_decoder.h @@ -0,0 +1,51 @@ +/* libFLAC - Free Lossless Audio Codec library + * Copyright (C) 2000,2001,2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef FLAC__PROTECTED__STREAM_DECODER_H +#define FLAC__PROTECTED__STREAM_DECODER_H + +#include "FLAC/stream_decoder.h" + +typedef struct FLAC__StreamDecoderProtected { + FLAC__StreamDecoderState state; + unsigned channels; + FLAC__ChannelAssignment channel_assignment; + unsigned bits_per_sample; + unsigned sample_rate; /* in Hz */ + unsigned blocksize; /* in samples (per channel) */ +} FLAC__StreamDecoderProtected; + +/* + * return the number of input bytes consumed + */ +unsigned FLAC__stream_decoder_get_input_bytes_unconsumed(const FLAC__StreamDecoder *decoder); + +#endif diff --git a/Libraries/FLAC/Files/src/libFLAC/include/protected/stream_encoder.h b/Libraries/FLAC/Files/src/libFLAC/include/protected/stream_encoder.h new file mode 100644 index 000000000..86495cc9a --- /dev/null +++ b/Libraries/FLAC/Files/src/libFLAC/include/protected/stream_encoder.h @@ -0,0 +1,60 @@ +/* libFLAC - Free Lossless Audio Codec library + * Copyright (C) 2001,2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef FLAC__PROTECTED__STREAM_ENCODER_H +#define FLAC__PROTECTED__STREAM_ENCODER_H + +#include "FLAC/stream_encoder.h" + +typedef struct FLAC__StreamEncoderProtected { + FLAC__StreamEncoderState state; + FLAC__bool verify; + FLAC__bool streamable_subset; + FLAC__bool do_mid_side_stereo; + FLAC__bool loose_mid_side_stereo; + unsigned channels; + unsigned bits_per_sample; + unsigned sample_rate; + unsigned blocksize; + unsigned max_lpc_order; + unsigned qlp_coeff_precision; + FLAC__bool do_qlp_coeff_prec_search; + FLAC__bool do_exhaustive_model_search; + FLAC__bool do_escape_coding; + unsigned min_residual_partition_order; + unsigned max_residual_partition_order; + unsigned rice_parameter_search_dist; + FLAC__uint64 total_samples_estimate; + FLAC__StreamMetadata **metadata; + unsigned num_metadata_blocks; +} FLAC__StreamEncoderProtected; + +#endif diff --git a/Libraries/FLAC/Files/src/libFLAC/libFLAC.m4 b/Libraries/FLAC/Files/src/libFLAC/libFLAC.m4 new file mode 100644 index 000000000..8f9ef741c --- /dev/null +++ b/Libraries/FLAC/Files/src/libFLAC/libFLAC.m4 @@ -0,0 +1,104 @@ +# Configure paths for libFLAC +# "Inspired" by ogg.m4 + +dnl AM_PATH_LIBFLAC([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) +dnl Test for libFLAC, and define LIBFLAC_CFLAGS and LIBFLAC_LIBS +dnl +AC_DEFUN([AM_PATH_LIBFLAC], +[dnl +dnl Get the cflags and libraries +dnl +AC_ARG_WITH(libFLAC,[ --with-libFLAC=PFX Prefix where libFLAC is installed (optional)], libFLAC_prefix="$withval", libFLAC_prefix="") +AC_ARG_WITH(libFLAC-libraries,[ --with-libFLAC-libraries=DIR Directory where libFLAC library is installed (optional)], libFLAC_libraries="$withval", libFLAC_libraries="") +AC_ARG_WITH(libFLAC-includes,[ --with-libFLAC-includes=DIR Directory where libFLAC header files are installed (optional)], libFLAC_includes="$withval", libFLAC_includes="") +AC_ARG_ENABLE(libFLACtest, [ --disable-libFLACtest Do not try to compile and run a test libFLAC program],, enable_libFLACtest=yes) + + if test "x$libFLAC_libraries" != "x" ; then + LIBFLAC_LIBS="-L$libFLAC_libraries" + elif test "x$libFLAC_prefix" != "x" ; then + LIBFLAC_LIBS="-L$libFLAC_prefix/lib" + elif test "x$prefix" != "xNONE" ; then + LIBFLAC_LIBS="-L$libdir" + fi + + LIBFLAC_LIBS="$LIBFLAC_LIBS -lFLAC -lm" + + if test "x$libFLAC_includes" != "x" ; then + LIBFLAC_CFLAGS="-I$libFLAC_includes" + elif test "x$libFLAC_prefix" != "x" ; then + LIBFLAC_CFLAGS="-I$libFLAC_prefix/include" + elif test "$prefix" != "xNONE"; then + LIBFLAC_CFLAGS="-I$prefix/include" + fi + + AC_MSG_CHECKING(for libFLAC) + no_libFLAC="" + + + if test "x$enable_libFLACtest" = "xyes" ; then + ac_save_CFLAGS="$CFLAGS" + ac_save_CXXFLAGS="$CXXFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $LIBFLAC_CFLAGS" + CXXFLAGS="$CXXFLAGS $LIBFLAC_CFLAGS" + LIBS="$LIBS $LIBFLAC_LIBS" +dnl +dnl Now check if the installed libFLAC is sufficiently new. +dnl + rm -f conf.libFLACtest + AC_TRY_RUN([ +#include +#include +#include +#include + +int main () +{ + system("touch conf.libFLACtest"); + return 0; +} + +],, no_libFLAC=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + + if test "x$no_libFLAC" = "x" ; then + AC_MSG_RESULT(yes) + ifelse([$1], , :, [$1]) + else + AC_MSG_RESULT(no) + if test -f conf.libFLACtest ; then + : + else + echo "*** Could not run libFLAC test program, checking why..." + CFLAGS="$CFLAGS $LIBFLAC_CFLAGS" + LIBS="$LIBS $LIBFLAC_LIBS" + AC_TRY_LINK([ +#include +#include +], [ return 0; ], + [ echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding libFLAC or finding the wrong" + echo "*** version of libFLAC. If it is not finding libFLAC, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], + [ echo "*** The test program failed to compile or link. See the file config.log for the" + echo "*** exact error that occured. This usually means libFLAC was incorrectly installed" + echo "*** or that you have moved libFLAC since it was installed. In the latter case, you" + echo "*** may want to edit the libFLAC-config script: $LIBFLAC_CONFIG" ]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + LIBFLAC_CFLAGS="" + LIBFLAC_LIBS="" + ifelse([$2], , :, [$2]) + fi + AC_SUBST(LIBFLAC_CFLAGS) + AC_SUBST(LIBFLAC_LIBS) + rm -f conf.libFLACtest +]) diff --git a/Libraries/FLAC/Files/src/libFLAC/libFLAC_dynamic.dsp b/Libraries/FLAC/Files/src/libFLAC/libFLAC_dynamic.dsp new file mode 100644 index 000000000..97f4ac9d5 --- /dev/null +++ b/Libraries/FLAC/Files/src/libFLAC/libFLAC_dynamic.dsp @@ -0,0 +1,406 @@ +# Microsoft Developer Studio Project File - Name="libFLAC_dynamic" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=libFLAC_dynamic - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "libFLAC_dynamic.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "libFLAC_dynamic.mak" CFG="libFLAC_dynamic - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "libFLAC_dynamic - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "libFLAC_dynamic - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "libFLAC" +# PROP Scc_LocalPath "..\.." +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "libFLAC_dynamic - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "..\..\obj\release\lib" +# PROP Intermediate_Dir "Release_dynamic" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GR /GX /O2 /I ".\include" /I "..\..\include" /D "NDEBUG" /D "FLAC_API_EXPORTS" /D VERSION=\"1.1.2\" /D "FLAC__CPU_IA32" /D "FLAC__HAS_NASM" /D "FLAC__USE_3DNOW" /D "_WINDOWS" /D "_WINDLL" /D "WIN32" /D "_USRDLL" /FR /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" /d "_USRDLL" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +# ADD LINK32 /nologo /subsystem:windows /dll /machine:I386 /out:"..\..\obj\release\bin/libFLAC.dll" + +!ELSEIF "$(CFG)" == "libFLAC_dynamic - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "..\..\obj\debug\lib" +# PROP Intermediate_Dir "Debug_dynamic" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /I ".\include" /I "..\..\include" /D "_DEBUG" /D "FLAC_API_EXPORTS" /D VERSION=\"1.1.2\" /D "FLAC__CPU_IA32" /D "FLAC__HAS_NASM" /D "FLAC__USE_3DNOW" /D "_WINDOWS" /D "_WINDLL" /D "WIN32" /D "_USRDLL" /FR /FD /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" /d "_USRDLL" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 /nologo /subsystem:windows /dll /debug /machine:I386 /out:"..\..\obj\debug\bin/libFLAC.dll" /pdbtype:sept + +!ENDIF + +# Begin Target + +# Name "libFLAC_dynamic - Win32 Release" +# Name "libFLAC_dynamic - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "c" +# Begin Group "Assembly Files (ia32)" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=.\ia32\cpu_asm.nasm + +!IF "$(CFG)" == "libFLAC_dynamic - Win32 Release" + +USERDEP__CPU_A="ia32/cpu_asm.nasm" +# Begin Custom Build +InputPath=.\ia32\cpu_asm.nasm + +"ia32/cpu_asm.obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/cpu_asm.nasm -o ia32/cpu_asm.obj + +# End Custom Build + +!ELSEIF "$(CFG)" == "libFLAC_dynamic - Win32 Debug" + +USERDEP__CPU_A="ia32/cpu_asm.nasm" +# Begin Custom Build +InputPath=.\ia32\cpu_asm.nasm + +"ia32/cpu_asm.obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/cpu_asm.nasm -o ia32/cpu_asm.obj + +# End Custom Build + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\ia32\fixed_asm.nasm + +!IF "$(CFG)" == "libFLAC_dynamic - Win32 Release" + +USERDEP__FIXED="ia32/fixed_asm.nasm" +# Begin Custom Build +InputPath=.\ia32\fixed_asm.nasm + +"ia32/fixed_asm.obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/fixed_asm.nasm -o ia32/fixed_asm.obj + +# End Custom Build + +!ELSEIF "$(CFG)" == "libFLAC_dynamic - Win32 Debug" + +USERDEP__FIXED="ia32/fixed_asm.nasm" +# Begin Custom Build +InputPath=.\ia32\fixed_asm.nasm + +"ia32/fixed_asm.obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/fixed_asm.nasm -o ia32/fixed_asm.obj + +# End Custom Build + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\ia32\lpc_asm.nasm + +!IF "$(CFG)" == "libFLAC_dynamic - Win32 Release" + +USERDEP__LPC_A="ia32/lpc_asm.nasm" +# Begin Custom Build +InputPath=.\ia32\lpc_asm.nasm + +"ia32/lpc_asm.obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/lpc_asm.nasm -o ia32/lpc_asm.obj + +# End Custom Build + +!ELSEIF "$(CFG)" == "libFLAC_dynamic - Win32 Debug" + +USERDEP__LPC_A="ia32/lpc_asm.nasm" +# Begin Custom Build +InputPath=.\ia32\lpc_asm.nasm + +"ia32/lpc_asm.obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/lpc_asm.nasm -o ia32/lpc_asm.obj + +# End Custom Build + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\ia32\nasm.h +# End Source File +# End Group +# Begin Source File + +SOURCE=.\bitbuffer.c +# End Source File +# Begin Source File + +SOURCE=.\bitmath.c +# End Source File +# Begin Source File + +SOURCE=.\cpu.c +# End Source File +# Begin Source File + +SOURCE=.\crc.c +# End Source File +# Begin Source File + +SOURCE=.\file_decoder.c +# End Source File +# Begin Source File + +SOURCE=.\file_encoder.c +# End Source File +# Begin Source File + +SOURCE=.\fixed.c +# End Source File +# Begin Source File + +SOURCE=.\float.c +# End Source File +# Begin Source File + +SOURCE=.\format.c +# End Source File +# Begin Source File + +SOURCE=.\lpc.c +# End Source File +# Begin Source File + +SOURCE=.\md5.c +# End Source File +# Begin Source File + +SOURCE=.\memory.c +# End Source File +# Begin Source File + +SOURCE=.\metadata_iterators.c +# End Source File +# Begin Source File + +SOURCE=.\metadata_object.c +# End Source File +# Begin Source File + +SOURCE=.\seekable_stream_decoder.c +# End Source File +# Begin Source File + +SOURCE=.\seekable_stream_encoder.c +# End Source File +# Begin Source File + +SOURCE=.\stream_decoder.c +# End Source File +# Begin Source File + +SOURCE=.\stream_encoder.c +# End Source File +# Begin Source File + +SOURCE=.\stream_encoder_framing.c +# End Source File +# End Group +# Begin Group "Private Header Files" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=.\include\private\all.h +# End Source File +# Begin Source File + +SOURCE=.\include\private\bitbuffer.h +# End Source File +# Begin Source File + +SOURCE=.\include\private\bitmath.h +# End Source File +# Begin Source File + +SOURCE=.\include\private\cpu.h +# End Source File +# Begin Source File + +SOURCE=.\include\private\crc.h +# End Source File +# Begin Source File + +SOURCE=.\include\private\fixed.h +# End Source File +# Begin Source File + +SOURCE=.\include\private\float.h +# End Source File +# Begin Source File + +SOURCE=.\include\private\format.h +# End Source File +# Begin Source File + +SOURCE=.\include\private\lpc.h +# End Source File +# Begin Source File + +SOURCE=.\include\private\md5.h +# End Source File +# Begin Source File + +SOURCE=.\include\private\memory.h +# End Source File +# Begin Source File + +SOURCE=.\include\private\metadata.h +# End Source File +# Begin Source File + +SOURCE=.\include\private\stream_encoder_framing.h +# End Source File +# End Group +# Begin Group "Protected Header Files" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=.\include\protected\all.h +# End Source File +# Begin Source File + +SOURCE=.\include\protected\file_decoder.h +# End Source File +# Begin Source File + +SOURCE=.\include\protected\file_encoder.h +# End Source File +# Begin Source File + +SOURCE=.\include\protected\seekable_stream_decoder.h +# End Source File +# Begin Source File + +SOURCE=.\include\protected\seekable_stream_encoder.h +# End Source File +# Begin Source File + +SOURCE=.\include\protected\stream_decoder.h +# End Source File +# Begin Source File + +SOURCE=.\include\protected\stream_encoder.h +# End Source File +# End Group +# Begin Group "Public Header Files" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=..\..\include\FLAC\all.h +# End Source File +# Begin Source File + +SOURCE=..\..\include\FLAC\assert.h +# End Source File +# Begin Source File + +SOURCE=..\..\include\FLAC\export.h +# End Source File +# Begin Source File + +SOURCE=..\..\include\FLAC\file_decoder.h +# End Source File +# Begin Source File + +SOURCE=..\..\include\FLAC\file_encoder.h +# End Source File +# Begin Source File + +SOURCE=..\..\include\FLAC\format.h +# End Source File +# Begin Source File + +SOURCE=..\..\include\FLAC\metadata.h +# End Source File +# Begin Source File + +SOURCE=..\..\include\FLAC\ordinals.h +# End Source File +# Begin Source File + +SOURCE=..\..\include\FLAC\seekable_stream_decoder.h +# End Source File +# Begin Source File + +SOURCE=..\..\include\FLAC\seekable_stream_encoder.h +# End Source File +# Begin Source File + +SOURCE=..\..\include\FLAC\stream_decoder.h +# End Source File +# Begin Source File + +SOURCE=..\..\include\FLAC\stream_encoder.h +# End Source File +# End Group +# End Target +# End Project diff --git a/Libraries/FLAC/Files/src/libFLAC/libFLAC_static.dsp b/Libraries/FLAC/Files/src/libFLAC/libFLAC_static.dsp new file mode 100644 index 000000000..b71373d42 --- /dev/null +++ b/Libraries/FLAC/Files/src/libFLAC/libFLAC_static.dsp @@ -0,0 +1,399 @@ +# Microsoft Developer Studio Project File - Name="libFLAC_static" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Static Library" 0x0104 + +CFG=libFLAC_static - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "libFLAC_static.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "libFLAC_static.mak" CFG="libFLAC_static - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "libFLAC_static - Win32 Release" (based on "Win32 (x86) Static Library") +!MESSAGE "libFLAC_static - Win32 Debug" (based on "Win32 (x86) Static Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "libFLAC" +# PROP Scc_LocalPath "..\.." +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "libFLAC_static - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "..\..\obj\release\lib" +# PROP Intermediate_Dir "Release_static" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /Op /I ".\include" /I "..\..\include" /D VERSION=\"1.1.2\" /D "FLAC__NO_DLL" /D "FLAC__CPU_IA32" /D "FLAC__HAS_NASM" /D "FLAC__USE_3DNOW" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo /nodefaultlib + +!ELSEIF "$(CFG)" == "libFLAC_static - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "..\..\obj\debug\lib" +# PROP Intermediate_Dir "Debug_static" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".\include" /I "..\..\include" /D VERSION=\"1.1.2\" /D "FLAC__NO_DLL" /D "FLAC__CPU_IA32" /D "FLAC__HAS_NASM" /D "FLAC__USE_3DNOW" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo /nodefaultlib + +!ENDIF + +# Begin Target + +# Name "libFLAC_static - Win32 Release" +# Name "libFLAC_static - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "c" +# Begin Group "Assembly Files (ia32)" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=.\ia32\cpu_asm.nasm + +!IF "$(CFG)" == "libFLAC_static - Win32 Release" + +USERDEP__CPU_A="ia32/cpu_asm.nasm" +# Begin Custom Build +InputPath=.\ia32\cpu_asm.nasm + +"ia32/cpu_asm.obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/cpu_asm.nasm -o ia32/cpu_asm.obj + +# End Custom Build + +!ELSEIF "$(CFG)" == "libFLAC_static - Win32 Debug" + +USERDEP__CPU_A="ia32/cpu_asm.nasm" +# Begin Custom Build +InputPath=.\ia32\cpu_asm.nasm + +"ia32/cpu_asm.obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/cpu_asm.nasm -o ia32/cpu_asm.obj + +# End Custom Build + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\ia32\fixed_asm.nasm + +!IF "$(CFG)" == "libFLAC_static - Win32 Release" + +USERDEP__FIXED="ia32/fixed_asm.nasm" +# Begin Custom Build +InputPath=.\ia32\fixed_asm.nasm + +"ia32/fixed_asm.obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/fixed_asm.nasm -o ia32/fixed_asm.obj + +# End Custom Build + +!ELSEIF "$(CFG)" == "libFLAC_static - Win32 Debug" + +USERDEP__FIXED="ia32/fixed_asm.nasm" +# Begin Custom Build +InputPath=.\ia32\fixed_asm.nasm + +"ia32/fixed_asm.obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/fixed_asm.nasm -o ia32/fixed_asm.obj + +# End Custom Build + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\ia32\lpc_asm.nasm + +!IF "$(CFG)" == "libFLAC_static - Win32 Release" + +USERDEP__LPC_A="ia32/lpc_asm.nasm" +# Begin Custom Build +InputPath=.\ia32\lpc_asm.nasm + +"ia32/lpc_asm.obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/lpc_asm.nasm -o ia32/lpc_asm.obj + +# End Custom Build + +!ELSEIF "$(CFG)" == "libFLAC_static - Win32 Debug" + +USERDEP__LPC_A="ia32/lpc_asm.nasm" +# Begin Custom Build +InputPath=.\ia32\lpc_asm.nasm + +"ia32/lpc_asm.obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/lpc_asm.nasm -o ia32/lpc_asm.obj + +# End Custom Build + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\ia32\nasm.h +# End Source File +# End Group +# Begin Source File + +SOURCE=.\bitbuffer.c +# End Source File +# Begin Source File + +SOURCE=.\bitmath.c +# End Source File +# Begin Source File + +SOURCE=.\cpu.c +# End Source File +# Begin Source File + +SOURCE=.\crc.c +# End Source File +# Begin Source File + +SOURCE=.\file_decoder.c +# End Source File +# Begin Source File + +SOURCE=.\file_encoder.c +# End Source File +# Begin Source File + +SOURCE=.\fixed.c +# End Source File +# Begin Source File + +SOURCE=.\float.c +# End Source File +# Begin Source File + +SOURCE=.\format.c +# End Source File +# Begin Source File + +SOURCE=.\lpc.c +# End Source File +# Begin Source File + +SOURCE=.\md5.c +# End Source File +# Begin Source File + +SOURCE=.\memory.c +# End Source File +# Begin Source File + +SOURCE=.\metadata_iterators.c +# End Source File +# Begin Source File + +SOURCE=.\metadata_object.c +# End Source File +# Begin Source File + +SOURCE=.\seekable_stream_decoder.c +# End Source File +# Begin Source File + +SOURCE=.\seekable_stream_encoder.c +# End Source File +# Begin Source File + +SOURCE=.\stream_decoder.c +# End Source File +# Begin Source File + +SOURCE=.\stream_encoder.c +# End Source File +# Begin Source File + +SOURCE=.\stream_encoder_framing.c +# End Source File +# End Group +# Begin Group "Private Header Files" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=.\include\private\all.h +# End Source File +# Begin Source File + +SOURCE=.\include\private\bitbuffer.h +# End Source File +# Begin Source File + +SOURCE=.\include\private\bitmath.h +# End Source File +# Begin Source File + +SOURCE=.\include\private\cpu.h +# End Source File +# Begin Source File + +SOURCE=.\include\private\crc.h +# End Source File +# Begin Source File + +SOURCE=.\include\private\fixed.h +# End Source File +# Begin Source File + +SOURCE=.\include\private\float.h +# End Source File +# Begin Source File + +SOURCE=.\include\private\format.h +# End Source File +# Begin Source File + +SOURCE=.\include\private\lpc.h +# End Source File +# Begin Source File + +SOURCE=.\include\private\md5.h +# End Source File +# Begin Source File + +SOURCE=.\include\private\memory.h +# End Source File +# Begin Source File + +SOURCE=.\include\private\metadata.h +# End Source File +# Begin Source File + +SOURCE=.\include\private\stream_encoder_framing.h +# End Source File +# End Group +# Begin Group "Protected Header Files" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=.\include\protected\all.h +# End Source File +# Begin Source File + +SOURCE=.\include\protected\file_decoder.h +# End Source File +# Begin Source File + +SOURCE=.\include\protected\file_encoder.h +# End Source File +# Begin Source File + +SOURCE=.\include\protected\seekable_stream_decoder.h +# End Source File +# Begin Source File + +SOURCE=.\include\protected\seekable_stream_encoder.h +# End Source File +# Begin Source File + +SOURCE=.\include\protected\stream_decoder.h +# End Source File +# Begin Source File + +SOURCE=.\include\protected\stream_encoder.h +# End Source File +# End Group +# Begin Group "Public Header Files" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=..\..\include\FLAC\all.h +# End Source File +# Begin Source File + +SOURCE=..\..\include\FLAC\assert.h +# End Source File +# Begin Source File + +SOURCE=..\..\include\FLAC\export.h +# End Source File +# Begin Source File + +SOURCE=..\..\include\FLAC\file_decoder.h +# End Source File +# Begin Source File + +SOURCE=..\..\include\FLAC\file_encoder.h +# End Source File +# Begin Source File + +SOURCE=..\..\include\FLAC\format.h +# End Source File +# Begin Source File + +SOURCE=..\..\include\FLAC\metadata.h +# End Source File +# Begin Source File + +SOURCE=..\..\include\FLAC\ordinals.h +# End Source File +# Begin Source File + +SOURCE=..\..\include\FLAC\seekable_stream_decoder.h +# End Source File +# Begin Source File + +SOURCE=..\..\include\FLAC\seekable_stream_encoder.h +# End Source File +# Begin Source File + +SOURCE=..\..\include\FLAC\stream_decoder.h +# End Source File +# Begin Source File + +SOURCE=..\..\include\FLAC\stream_encoder.h +# End Source File +# End Group +# End Target +# End Project diff --git a/Libraries/FLAC/Files/src/libFLAC/lpc.c b/Libraries/FLAC/Files/src/libFLAC/lpc.c new file mode 100644 index 000000000..b846db5cb --- /dev/null +++ b/Libraries/FLAC/Files/src/libFLAC/lpc.c @@ -0,0 +1,430 @@ +/* libFLAC - Free Lossless Audio Codec library + * Copyright (C) 2000,2001,2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include "FLAC/assert.h" +#include "FLAC/format.h" +#include "private/bitmath.h" +#include "private/lpc.h" +#if defined DEBUG || defined FLAC__OVERFLOW_DETECT || defined FLAC__OVERFLOW_DETECT_VERBOSE +#include +#endif + +#ifndef FLAC__INTEGER_ONLY_LIBRARY + +#ifndef M_LN2 +/* math.h in VC++ doesn't seem to have this (how Microsoft is that?) */ +#define M_LN2 0.69314718055994530942 +#endif + +void FLAC__lpc_compute_autocorrelation(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[]) +{ + /* a readable, but slower, version */ +#if 0 + FLAC__real d; + unsigned i; + + FLAC__ASSERT(lag > 0); + FLAC__ASSERT(lag <= data_len); + + while(lag--) { + for(i = lag, d = 0.0; i < data_len; i++) + d += data[i] * data[i - lag]; + autoc[lag] = d; + } +#endif + + /* + * this version tends to run faster because of better data locality + * ('data_len' is usually much larger than 'lag') + */ + FLAC__real d; + unsigned sample, coeff; + const unsigned limit = data_len - lag; + + FLAC__ASSERT(lag > 0); + FLAC__ASSERT(lag <= data_len); + + for(coeff = 0; coeff < lag; coeff++) + autoc[coeff] = 0.0; + for(sample = 0; sample <= limit; sample++) { + d = data[sample]; + for(coeff = 0; coeff < lag; coeff++) + autoc[coeff] += d * data[sample+coeff]; + } + for(; sample < data_len; sample++) { + d = data[sample]; + for(coeff = 0; coeff < data_len - sample; coeff++) + autoc[coeff] += d * data[sample+coeff]; + } +} + +void FLAC__lpc_compute_lp_coefficients(const FLAC__real autoc[], unsigned max_order, FLAC__real lp_coeff[][FLAC__MAX_LPC_ORDER], FLAC__double error[]) +{ + unsigned i, j; + FLAC__double r, err, ref[FLAC__MAX_LPC_ORDER], lpc[FLAC__MAX_LPC_ORDER]; + + FLAC__ASSERT(0 < max_order); + FLAC__ASSERT(max_order <= FLAC__MAX_LPC_ORDER); + FLAC__ASSERT(autoc[0] != 0.0); + + err = autoc[0]; + + for(i = 0; i < max_order; i++) { + /* Sum up this iteration's reflection coefficient. */ + r = -autoc[i+1]; + for(j = 0; j < i; j++) + r -= lpc[j] * autoc[i-j]; + ref[i] = (r/=err); + + /* Update LPC coefficients and total error. */ + lpc[i]=r; + for(j = 0; j < (i>>1); j++) { + FLAC__double tmp = lpc[j]; + lpc[j] += r * lpc[i-1-j]; + lpc[i-1-j] += r * tmp; + } + if(i & 1) + lpc[j] += lpc[j] * r; + + err *= (1.0 - r * r); + + /* save this order */ + for(j = 0; j <= i; j++) + lp_coeff[i][j] = (FLAC__real)(-lpc[j]); /* negate FIR filter coeff to get predictor coeff */ + error[i] = err; + } +} + +int FLAC__lpc_quantize_coefficients(const FLAC__real lp_coeff[], unsigned order, unsigned precision, FLAC__int32 qlp_coeff[], int *shift) +{ + unsigned i; + FLAC__double d, cmax = -1e32; + FLAC__int32 qmax, qmin; + const int max_shiftlimit = (1 << (FLAC__SUBFRAME_LPC_QLP_SHIFT_LEN-1)) - 1; + const int min_shiftlimit = -max_shiftlimit - 1; + + FLAC__ASSERT(precision > 0); + FLAC__ASSERT(precision >= FLAC__MIN_QLP_COEFF_PRECISION); + + /* drop one bit for the sign; from here on out we consider only |lp_coeff[i]| */ + precision--; + qmax = 1 << precision; + qmin = -qmax; + qmax--; + + for(i = 0; i < order; i++) { + if(lp_coeff[i] == 0.0) + continue; + d = fabs(lp_coeff[i]); + if(d > cmax) + cmax = d; + } +redo_it: + if(cmax <= 0.0) { + /* => coefficients are all 0, which means our constant-detect didn't work */ + return 2; + } + else { + int log2cmax; + + (void)frexp(cmax, &log2cmax); + log2cmax--; + *shift = (int)precision - log2cmax - 1; + + if(*shift < min_shiftlimit || *shift > max_shiftlimit) { +#if 0 + /*@@@ this does not seem to help at all, but was not extensively tested either: */ + if(*shift > max_shiftlimit) + *shift = max_shiftlimit; + else +#endif + return 1; + } + } + + if(*shift >= 0) { + for(i = 0; i < order; i++) { + qlp_coeff[i] = (FLAC__int32)floor((FLAC__double)lp_coeff[i] * (FLAC__double)(1 << *shift)); + + /* double-check the result */ + if(qlp_coeff[i] > qmax || qlp_coeff[i] < qmin) { +#ifdef FLAC__OVERFLOW_DETECT + fprintf(stderr,"FLAC__lpc_quantize_coefficients: compensating for overflow, qlp_coeff[%u]=%d, lp_coeff[%u]=%f, cmax=%f, precision=%u, shift=%d, q=%f, f(q)=%f\n", i, qlp_coeff[i], i, lp_coeff[i], cmax, precision, *shift, (FLAC__double)lp_coeff[i] * (FLAC__double)(1 << *shift), floor((FLAC__double)lp_coeff[i] * (FLAC__double)(1 << *shift))); +#endif + cmax *= 2.0; + goto redo_it; + } + } + } + else { /* (*shift < 0) */ + const int nshift = -(*shift); +#ifdef DEBUG + fprintf(stderr,"FLAC__lpc_quantize_coefficients: negative shift = %d\n", *shift); +#endif + for(i = 0; i < order; i++) { + qlp_coeff[i] = (FLAC__int32)floor((FLAC__double)lp_coeff[i] / (FLAC__double)(1 << nshift)); + + /* double-check the result */ + if(qlp_coeff[i] > qmax || qlp_coeff[i] < qmin) { +#ifdef FLAC__OVERFLOW_DETECT + fprintf(stderr,"FLAC__lpc_quantize_coefficients: compensating for overflow, qlp_coeff[%u]=%d, lp_coeff[%u]=%f, cmax=%f, precision=%u, shift=%d, q=%f, f(q)=%f\n", i, qlp_coeff[i], i, lp_coeff[i], cmax, precision, *shift, (FLAC__double)lp_coeff[i] / (FLAC__double)(1 << nshift), floor((FLAC__double)lp_coeff[i] / (FLAC__double)(1 << nshift))); +#endif + cmax *= 2.0; + goto redo_it; + } + } + } + + return 0; +} + +void FLAC__lpc_compute_residual_from_qlp_coefficients(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[]) +{ +#ifdef FLAC__OVERFLOW_DETECT + FLAC__int64 sumo; +#endif + unsigned i, j; + FLAC__int32 sum; + const FLAC__int32 *history; + +#ifdef FLAC__OVERFLOW_DETECT_VERBOSE + fprintf(stderr,"FLAC__lpc_compute_residual_from_qlp_coefficients: data_len=%d, order=%u, lpq=%d",data_len,order,lp_quantization); + for(i=0;i 0); + + for(i = 0; i < data_len; i++) { +#ifdef FLAC__OVERFLOW_DETECT + sumo = 0; +#endif + sum = 0; + history = data; + for(j = 0; j < order; j++) { + sum += qlp_coeff[j] * (*(--history)); +#ifdef FLAC__OVERFLOW_DETECT + sumo += (FLAC__int64)qlp_coeff[j] * (FLAC__int64)(*history); +#if defined _MSC_VER + if(sumo > 2147483647I64 || sumo < -2147483648I64) + fprintf(stderr,"FLAC__lpc_compute_residual_from_qlp_coefficients: OVERFLOW, i=%u, j=%u, c=%d, d=%d, sumo=%I64d\n",i,j,qlp_coeff[j],*history,sumo); +#else + if(sumo > 2147483647ll || sumo < -2147483648ll) + fprintf(stderr,"FLAC__lpc_compute_residual_from_qlp_coefficients: OVERFLOW, i=%u, j=%u, c=%d, d=%d, sumo=%lld\n",i,j,qlp_coeff[j],*history,sumo); +#endif +#endif + } + *(residual++) = *(data++) - (sum >> lp_quantization); + } + + /* Here's a slower but clearer version: + for(i = 0; i < data_len; i++) { + sum = 0; + for(j = 0; j < order; j++) + sum += qlp_coeff[j] * data[i-j-1]; + residual[i] = data[i] - (sum >> lp_quantization); + } + */ +} + +void FLAC__lpc_compute_residual_from_qlp_coefficients_wide(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[]) +{ + unsigned i, j; + FLAC__int64 sum; + const FLAC__int32 *history; + +#ifdef FLAC__OVERFLOW_DETECT_VERBOSE + fprintf(stderr,"FLAC__lpc_compute_residual_from_qlp_coefficients_wide: data_len=%d, order=%u, lpq=%d",data_len,order,lp_quantization); + for(i=0;i 0); + + for(i = 0; i < data_len; i++) { + sum = 0; + history = data; + for(j = 0; j < order; j++) + sum += (FLAC__int64)qlp_coeff[j] * (FLAC__int64)(*(--history)); +#ifdef FLAC__OVERFLOW_DETECT + if(FLAC__bitmath_silog2_wide(sum >> lp_quantization) > 32) { + fprintf(stderr,"FLAC__lpc_compute_residual_from_qlp_coefficients_wide: OVERFLOW, i=%u, sum=%lld\n", i, sum >> lp_quantization); + break; + } + if(FLAC__bitmath_silog2_wide((FLAC__int64)(*data) - (sum >> lp_quantization)) > 32) { + fprintf(stderr,"FLAC__lpc_compute_residual_from_qlp_coefficients_wide: OVERFLOW, i=%u, data=%d, sum=%lld, residual=%lld\n", i, *data, sum >> lp_quantization, (FLAC__int64)(*data) - (sum >> lp_quantization)); + break; + } +#endif + *(residual++) = *(data++) - (FLAC__int32)(sum >> lp_quantization); + } +} + +#endif /* !defined FLAC__INTEGER_ONLY_LIBRARY */ + +void FLAC__lpc_restore_signal(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]) +{ +#ifdef FLAC__OVERFLOW_DETECT + FLAC__int64 sumo; +#endif + unsigned i, j; + FLAC__int32 sum; + const FLAC__int32 *history; + +#ifdef FLAC__OVERFLOW_DETECT_VERBOSE + fprintf(stderr,"FLAC__lpc_restore_signal: data_len=%d, order=%u, lpq=%d",data_len,order,lp_quantization); + for(i=0;i 0); + + for(i = 0; i < data_len; i++) { +#ifdef FLAC__OVERFLOW_DETECT + sumo = 0; +#endif + sum = 0; + history = data; + for(j = 0; j < order; j++) { + sum += qlp_coeff[j] * (*(--history)); +#ifdef FLAC__OVERFLOW_DETECT + sumo += (FLAC__int64)qlp_coeff[j] * (FLAC__int64)(*history); +#if defined _MSC_VER + if(sumo > 2147483647I64 || sumo < -2147483648I64) + fprintf(stderr,"FLAC__lpc_restore_signal: OVERFLOW, i=%u, j=%u, c=%d, d=%d, sumo=%I64d\n",i,j,qlp_coeff[j],*history,sumo); +#else + if(sumo > 2147483647ll || sumo < -2147483648ll) + fprintf(stderr,"FLAC__lpc_restore_signal: OVERFLOW, i=%u, j=%u, c=%d, d=%d, sumo=%lld\n",i,j,qlp_coeff[j],*history,sumo); +#endif +#endif + } + *(data++) = *(residual++) + (sum >> lp_quantization); + } + + /* Here's a slower but clearer version: + for(i = 0; i < data_len; i++) { + sum = 0; + for(j = 0; j < order; j++) + sum += qlp_coeff[j] * data[i-j-1]; + data[i] = residual[i] + (sum >> lp_quantization); + } + */ +} + +void FLAC__lpc_restore_signal_wide(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]) +{ + unsigned i, j; + FLAC__int64 sum; + const FLAC__int32 *history; + +#ifdef FLAC__OVERFLOW_DETECT_VERBOSE + fprintf(stderr,"FLAC__lpc_restore_signal_wide: data_len=%d, order=%u, lpq=%d",data_len,order,lp_quantization); + for(i=0;i 0); + + for(i = 0; i < data_len; i++) { + sum = 0; + history = data; + for(j = 0; j < order; j++) + sum += (FLAC__int64)qlp_coeff[j] * (FLAC__int64)(*(--history)); +#ifdef FLAC__OVERFLOW_DETECT + if(FLAC__bitmath_silog2_wide(sum >> lp_quantization) > 32) { + fprintf(stderr,"FLAC__lpc_restore_signal_wide: OVERFLOW, i=%u, sum=%lld\n", i, sum >> lp_quantization); + break; + } + if(FLAC__bitmath_silog2_wide((FLAC__int64)(*residual) + (sum >> lp_quantization)) > 32) { + fprintf(stderr,"FLAC__lpc_restore_signal_wide: OVERFLOW, i=%u, residual=%d, sum=%lld, data=%lld\n", i, *residual, sum >> lp_quantization, (FLAC__int64)(*residual) + (sum >> lp_quantization)); + break; + } +#endif + *(data++) = *(residual++) + (FLAC__int32)(sum >> lp_quantization); + } +} + +#ifndef FLAC__INTEGER_ONLY_LIBRARY + +FLAC__double FLAC__lpc_compute_expected_bits_per_residual_sample(FLAC__double lpc_error, unsigned total_samples) +{ + FLAC__double error_scale; + + FLAC__ASSERT(total_samples > 0); + + error_scale = 0.5 * M_LN2 * M_LN2 / (FLAC__double)total_samples; + + return FLAC__lpc_compute_expected_bits_per_residual_sample_with_error_scale(lpc_error, error_scale); +} + +FLAC__double FLAC__lpc_compute_expected_bits_per_residual_sample_with_error_scale(FLAC__double lpc_error, FLAC__double error_scale) +{ + if(lpc_error > 0.0) { + FLAC__double bps = (FLAC__double)0.5 * log(error_scale * lpc_error) / M_LN2; + if(bps >= 0.0) + return bps; + else + return 0.0; + } + else if(lpc_error < 0.0) { /* error should not be negative but can happen due to inadequate floating-point resolution */ + return 1e32; + } + else { + return 0.0; + } +} + +unsigned FLAC__lpc_compute_best_order(const FLAC__double lpc_error[], unsigned max_order, unsigned total_samples, unsigned bits_per_signal_sample) +{ + unsigned order, best_order; + FLAC__double best_bits, tmp_bits, error_scale; + + FLAC__ASSERT(max_order > 0); + FLAC__ASSERT(total_samples > 0); + + error_scale = 0.5 * M_LN2 * M_LN2 / (FLAC__double)total_samples; + + best_order = 0; + best_bits = FLAC__lpc_compute_expected_bits_per_residual_sample_with_error_scale(lpc_error[0], error_scale) * (FLAC__double)total_samples; + + for(order = 1; order < max_order; order++) { + tmp_bits = FLAC__lpc_compute_expected_bits_per_residual_sample_with_error_scale(lpc_error[order], error_scale) * (FLAC__double)(total_samples - order) + (FLAC__double)(order * bits_per_signal_sample); + if(tmp_bits < best_bits) { + best_order = order; + best_bits = tmp_bits; + } + } + + return best_order+1; /* +1 since index of lpc_error[] is order-1 */ +} + +#endif /* !defined FLAC__INTEGER_ONLY_LIBRARY */ diff --git a/Libraries/FLAC/Files/src/libFLAC/md5.c b/Libraries/FLAC/Files/src/libFLAC/md5.c new file mode 100644 index 000000000..9679387db --- /dev/null +++ b/Libraries/FLAC/Files/src/libFLAC/md5.c @@ -0,0 +1,315 @@ +/* + * This code implements the MD5 message-digest algorithm. + * The algorithm is due to Ron Rivest. This code was + * written by Colin Plumb in 1993, no copyright is claimed. + * This code is in the public domain; do with it what you wish. + * + * Equivalent code is available from RSA Data Security, Inc. + * This code has been tested against that, and is equivalent, + * except that you don't need to include two pages of legalese + * with every copy. + * + * To compute the message digest of a chunk of bytes, declare an + * MD5Context structure, pass it to MD5Init, call MD5Update as + * needed on buffers full of bytes, and then call MD5Final, which + * will fill a supplied 16-byte array with the digest. + * + * Changed so as no longer to depend on Colin Plumb's `usual.h' header + * definitions; now uses stuff from dpkg's config.h. + * - Ian Jackson . + * Still in the public domain. + * + * Josh Coalson: made some changes to integrate with libFLAC. + * Still in the public domain. + */ + +#include /* for malloc() */ +#include /* for memcpy() */ + +#include "private/md5.h" + +#ifdef HAVE_CONFIG_H +#include +#endif + +#ifndef FLaC__INLINE +#define FLaC__INLINE +#endif + +static FLAC__bool is_big_endian_host_; + +#ifndef ASM_MD5 + +/* The four core functions - F1 is optimized somewhat */ + +/* #define F1(x, y, z) (x & y | ~x & z) */ +#define F1(x, y, z) (z ^ (x & (y ^ z))) +#define F2(x, y, z) F1(z, x, y) +#define F3(x, y, z) (x ^ y ^ z) +#define F4(x, y, z) (y ^ (x | ~z)) + +/* This is the central step in the MD5 algorithm. */ +#define MD5STEP(f,w,x,y,z,in,s) \ + (w += f(x,y,z) + in, w = (w<>(32-s)) + x) + +/* + * The core of the MD5 algorithm, this alters an existing MD5 hash to + * reflect the addition of 16 longwords of new data. MD5Update blocks + * the data and converts bytes into longwords for this routine. + */ +FLaC__INLINE +void +FLAC__MD5Transform(FLAC__uint32 buf[4], FLAC__uint32 const in[16]) +{ + register FLAC__uint32 a, b, c, d; + + a = buf[0]; + b = buf[1]; + c = buf[2]; + d = buf[3]; + + MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7); + MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12); + MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17); + MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22); + MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7); + MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12); + MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17); + MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22); + MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7); + MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12); + MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17); + MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22); + MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7); + MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12); + MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17); + MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22); + + MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5); + MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9); + MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14); + MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20); + MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5); + MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9); + MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14); + MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20); + MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5); + MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9); + MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14); + MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20); + MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5); + MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9); + MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14); + MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20); + + MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4); + MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11); + MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16); + MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23); + MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4); + MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11); + MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16); + MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23); + MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4); + MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11); + MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16); + MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23); + MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4); + MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11); + MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16); + MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23); + + MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6); + MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10); + MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15); + MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21); + MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6); + MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10); + MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15); + MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21); + MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6); + MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10); + MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15); + MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21); + MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6); + MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10); + MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15); + MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21); + + buf[0] += a; + buf[1] += b; + buf[2] += c; + buf[3] += d; +} + +#endif + +FLaC__INLINE +void +byteSwap(FLAC__uint32 *buf, unsigned words) +{ + md5byte *p = (md5byte *)buf; + + if(!is_big_endian_host_) + return; + do { + *buf++ = (FLAC__uint32)((unsigned)p[3] << 8 | p[2]) << 16 | ((unsigned)p[1] << 8 | p[0]); + p += 4; + } while (--words); +} + +/* + * Start MD5 accumulation. Set bit count to 0 and buffer to mysterious + * initialization constants. + */ +void +FLAC__MD5Init(struct FLAC__MD5Context *ctx) +{ + FLAC__uint32 test = 1; + + is_big_endian_host_ = (*((FLAC__byte*)(&test)))? false : true; + + ctx->buf[0] = 0x67452301; + ctx->buf[1] = 0xefcdab89; + ctx->buf[2] = 0x98badcfe; + ctx->buf[3] = 0x10325476; + + ctx->bytes[0] = 0; + ctx->bytes[1] = 0; + + ctx->internal_buf = 0; + ctx->capacity = 0; +} + +/* + * Update context to reflect the concatenation of another buffer full + * of bytes. + */ +void +FLAC__MD5Update(struct FLAC__MD5Context *ctx, md5byte const *buf, unsigned len) +{ + FLAC__uint32 t; + + /* Update byte count */ + + t = ctx->bytes[0]; + if ((ctx->bytes[0] = t + len) < t) + ctx->bytes[1]++; /* Carry from low to high */ + + t = 64 - (t & 0x3f); /* Space available in ctx->in (at least 1) */ + if (t > len) { + memcpy((md5byte *)ctx->in + 64 - t, buf, len); + return; + } + /* First chunk is an odd size */ + memcpy((md5byte *)ctx->in + 64 - t, buf, t); + byteSwap(ctx->in, 16); + FLAC__MD5Transform(ctx->buf, ctx->in); + buf += t; + len -= t; + + /* Process data in 64-byte chunks */ + while (len >= 64) { + memcpy(ctx->in, buf, 64); + byteSwap(ctx->in, 16); + FLAC__MD5Transform(ctx->buf, ctx->in); + buf += 64; + len -= 64; + } + + /* Handle any remaining bytes of data. */ + memcpy(ctx->in, buf, len); +} + +/* + * Convert the incoming audio signal to a byte stream and FLAC__MD5Update it. + */ +FLAC__bool +FLAC__MD5Accumulate(struct FLAC__MD5Context *ctx, const FLAC__int32 * const signal[], unsigned channels, unsigned samples, unsigned bytes_per_sample) +{ + unsigned channel, sample, a_byte; + FLAC__int32 a_word; + FLAC__byte *buf_; + const unsigned bytes_needed = channels * samples * bytes_per_sample; + + if(ctx->capacity < bytes_needed) { + FLAC__byte *tmp = (FLAC__byte*)realloc(ctx->internal_buf, bytes_needed); + if(0 == tmp) { + free(ctx->internal_buf); + if(0 == (ctx->internal_buf = (FLAC__byte*)malloc(bytes_needed))) + return false; + } + ctx->internal_buf = tmp; + ctx->capacity = bytes_needed; + } + + buf_ = ctx->internal_buf; + +#ifdef FLAC__CPU_IA32 + if(channels == 2 && bytes_per_sample == 2) { + memcpy(buf_, signal[0], sizeof(FLAC__int32) * samples); + buf_ += sizeof(FLAC__int16); + for(sample = 0; sample < samples; sample++) + ((FLAC__int16 *)buf_)[2 * sample] = (FLAC__int16)signal[1][sample]; + } + else if(channels == 1 && bytes_per_sample == 2) { + for(sample = 0; sample < samples; sample++) + ((FLAC__int16 *)buf_)[sample] = (FLAC__int16)signal[0][sample]; + } + else +#endif + for(sample = 0; sample < samples; sample++) { + for(channel = 0; channel < channels; channel++) { + a_word = signal[channel][sample]; + for(a_byte = 0; a_byte < bytes_per_sample; a_byte++) { + *buf_++ = (FLAC__byte)(a_word & 0xff); + a_word >>= 8; + } + } + } + + FLAC__MD5Update(ctx, ctx->internal_buf, bytes_needed); + + return true; +} + +/* + * Final wrapup - pad to 64-byte boundary with the bit pattern + * 1 0* (64-bit count of bits processed, MSB-first) + */ +void +FLAC__MD5Final(md5byte digest[16], struct FLAC__MD5Context *ctx) +{ + int count = ctx->bytes[0] & 0x3f; /* Number of bytes in ctx->in */ + md5byte *p = (md5byte *)ctx->in + count; + + /* Set the first char of padding to 0x80. There is always room. */ + *p++ = 0x80; + + /* Bytes of padding needed to make 56 bytes (-8..55) */ + count = 56 - 1 - count; + + if (count < 0) { /* Padding forces an extra block */ + memset(p, 0, count + 8); + byteSwap(ctx->in, 16); + FLAC__MD5Transform(ctx->buf, ctx->in); + p = (md5byte *)ctx->in; + count = 56; + } + memset(p, 0, count); + byteSwap(ctx->in, 14); + + /* Append length in bits and transform */ + ctx->in[14] = ctx->bytes[0] << 3; + ctx->in[15] = ctx->bytes[1] << 3 | ctx->bytes[0] >> 29; + FLAC__MD5Transform(ctx->buf, ctx->in); + + byteSwap(ctx->buf, 4); + memcpy(digest, ctx->buf, 16); + memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */ + if(0 != ctx->internal_buf) { + free(ctx->internal_buf); + ctx->internal_buf = 0; + ctx->capacity = 0; + } +} diff --git a/Libraries/FLAC/Files/src/libFLAC/memory.c b/Libraries/FLAC/Files/src/libFLAC/memory.c new file mode 100644 index 000000000..9718b261b --- /dev/null +++ b/Libraries/FLAC/Files/src/libFLAC/memory.c @@ -0,0 +1,188 @@ +/* libFLAC - Free Lossless Audio Codec library + * Copyright (C) 2001,2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "private/memory.h" +#include "FLAC/assert.h" + +#ifdef HAVE_CONFIG_H +#include +#endif + +void *FLAC__memory_alloc_aligned(size_t bytes, void **aligned_address) +{ + void *x; + + FLAC__ASSERT(0 != aligned_address); + +#ifdef FLAC__ALIGN_MALLOC_DATA + /* align on 32-byte (256-bit) boundary */ + x = malloc(bytes+31); + *aligned_address = (void*)(((unsigned)x + 31) & -32); +#else + x = malloc(bytes); + *aligned_address = x; +#endif + return x; +} + +FLAC__bool FLAC__memory_alloc_aligned_int32_array(unsigned elements, FLAC__int32 **unaligned_pointer, FLAC__int32 **aligned_pointer) +{ + FLAC__int32 *pu; /* unaligned pointer */ + union { /* union needed to comply with C99 pointer aliasing rules */ + FLAC__int32 *pa; /* aligned pointer */ + void *pv; /* aligned pointer alias */ + } u; + + FLAC__ASSERT(elements > 0); + FLAC__ASSERT(0 != unaligned_pointer); + FLAC__ASSERT(0 != aligned_pointer); + FLAC__ASSERT(unaligned_pointer != aligned_pointer); + + pu = (FLAC__int32*)FLAC__memory_alloc_aligned(sizeof(FLAC__int32) * elements, &u.pv); + if(0 == pu) { + return false; + } + else { + if(*unaligned_pointer != 0) + free(*unaligned_pointer); + *unaligned_pointer = pu; + *aligned_pointer = u.pa; + return true; + } +} + +FLAC__bool FLAC__memory_alloc_aligned_uint32_array(unsigned elements, FLAC__uint32 **unaligned_pointer, FLAC__uint32 **aligned_pointer) +{ + FLAC__uint32 *pu; /* unaligned pointer */ + union { /* union needed to comply with C99 pointer aliasing rules */ + FLAC__uint32 *pa; /* aligned pointer */ + void *pv; /* aligned pointer alias */ + } u; + + FLAC__ASSERT(elements > 0); + FLAC__ASSERT(0 != unaligned_pointer); + FLAC__ASSERT(0 != aligned_pointer); + FLAC__ASSERT(unaligned_pointer != aligned_pointer); + + pu = (FLAC__uint32*)FLAC__memory_alloc_aligned(sizeof(FLAC__uint32) * elements, &u.pv); + if(0 == pu) { + return false; + } + else { + if(*unaligned_pointer != 0) + free(*unaligned_pointer); + *unaligned_pointer = pu; + *aligned_pointer = u.pa; + return true; + } +} + +FLAC__bool FLAC__memory_alloc_aligned_uint64_array(unsigned elements, FLAC__uint64 **unaligned_pointer, FLAC__uint64 **aligned_pointer) +{ + FLAC__uint64 *pu; /* unaligned pointer */ + union { /* union needed to comply with C99 pointer aliasing rules */ + FLAC__uint64 *pa; /* aligned pointer */ + void *pv; /* aligned pointer alias */ + } u; + + FLAC__ASSERT(elements > 0); + FLAC__ASSERT(0 != unaligned_pointer); + FLAC__ASSERT(0 != aligned_pointer); + FLAC__ASSERT(unaligned_pointer != aligned_pointer); + + pu = (FLAC__uint64*)FLAC__memory_alloc_aligned(sizeof(FLAC__uint64) * elements, &u.pv); + if(0 == pu) { + return false; + } + else { + if(*unaligned_pointer != 0) + free(*unaligned_pointer); + *unaligned_pointer = pu; + *aligned_pointer = u.pa; + return true; + } +} + +FLAC__bool FLAC__memory_alloc_aligned_unsigned_array(unsigned elements, unsigned **unaligned_pointer, unsigned **aligned_pointer) +{ + unsigned *pu; /* unaligned pointer */ + union { /* union needed to comply with C99 pointer aliasing rules */ + unsigned *pa; /* aligned pointer */ + void *pv; /* aligned pointer alias */ + } u; + + FLAC__ASSERT(elements > 0); + FLAC__ASSERT(0 != unaligned_pointer); + FLAC__ASSERT(0 != aligned_pointer); + FLAC__ASSERT(unaligned_pointer != aligned_pointer); + + pu = (unsigned*)FLAC__memory_alloc_aligned(sizeof(unsigned) * elements, &u.pv); + if(0 == pu) { + return false; + } + else { + if(*unaligned_pointer != 0) + free(*unaligned_pointer); + *unaligned_pointer = pu; + *aligned_pointer = u.pa; + return true; + } +} + +#ifndef FLAC__INTEGER_ONLY_LIBRARY + +FLAC__bool FLAC__memory_alloc_aligned_real_array(unsigned elements, FLAC__real **unaligned_pointer, FLAC__real **aligned_pointer) +{ + FLAC__real *pu; /* unaligned pointer */ + union { /* union needed to comply with C99 pointer aliasing rules */ + FLAC__real *pa; /* aligned pointer */ + void *pv; /* aligned pointer alias */ + } u; + + FLAC__ASSERT(elements > 0); + FLAC__ASSERT(0 != unaligned_pointer); + FLAC__ASSERT(0 != aligned_pointer); + FLAC__ASSERT(unaligned_pointer != aligned_pointer); + + pu = (FLAC__real*)FLAC__memory_alloc_aligned(sizeof(FLAC__real) * elements, &u.pv); + if(0 == pu) { + return false; + } + else { + if(*unaligned_pointer != 0) + free(*unaligned_pointer); + *unaligned_pointer = pu; + *aligned_pointer = u.pa; + return true; + } +} + +#endif diff --git a/Libraries/FLAC/Files/src/libFLAC/metadata_iterators.c b/Libraries/FLAC/Files/src/libFLAC/metadata_iterators.c new file mode 100644 index 000000000..2d50dd2bd --- /dev/null +++ b/Libraries/FLAC/Files/src/libFLAC/metadata_iterators.c @@ -0,0 +1,2964 @@ +/* libFLAC - Free Lossless Audio Codec library + * Copyright (C) 2001,2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include +#include + +#if defined _MSC_VER || defined __MINGW32__ +#include /* for utime() */ +#include /* for chmod() */ +#else +#include /* some flavors of BSD (like OS X) require this to get time_t */ +#include /* for utime() */ +#include /* for chown(), unlink() */ +#endif +#include /* for stat(), maybe chmod() */ + +#include "private/metadata.h" + +#include "FLAC/assert.h" +#include "FLAC/file_decoder.h" + +#ifdef max +#undef max +#endif +#define max(a,b) ((a)>(b)?(a):(b)) +#ifdef min +#undef min +#endif +#define min(a,b) ((a)<(b)?(a):(b)) + + +/**************************************************************************** + * + * Local function declarations + * + ***************************************************************************/ + +static void pack_uint32_(FLAC__uint32 val, FLAC__byte *b, unsigned bytes); +static void pack_uint32_little_endian_(FLAC__uint32 val, FLAC__byte *b, unsigned bytes); +static void pack_uint64_(FLAC__uint64 val, FLAC__byte *b, unsigned bytes); +static FLAC__uint32 unpack_uint32_(FLAC__byte *b, unsigned bytes); +static FLAC__uint32 unpack_uint32_little_endian_(FLAC__byte *b, unsigned bytes); +static FLAC__uint64 unpack_uint64_(FLAC__byte *b, unsigned bytes); + +static FLAC__bool read_metadata_block_header_(FLAC__Metadata_SimpleIterator *iterator); +static FLAC__bool read_metadata_block_data_(FLAC__Metadata_SimpleIterator *iterator, FLAC__StreamMetadata *block); +static FLAC__bool read_metadata_block_header_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__bool *is_last, FLAC__MetadataType *type, unsigned *length); +static FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__IOCallback_Seek seek_cb, FLAC__StreamMetadata *block); +static FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_streaminfo_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_StreamInfo *block); +static FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_padding_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Seek seek_cb, FLAC__StreamMetadata_Padding *block, unsigned block_length); +static FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_application_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_Application *block, unsigned block_length); +static FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_seektable_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_SeekTable *block, unsigned block_length); +static FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_vorbis_comment_entry_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_VorbisComment_Entry *entry); +static FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_vorbis_comment_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_VorbisComment *block); +static FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_cuesheet_track_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_CueSheet_Track *track); +static FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_cuesheet_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_CueSheet *block); +static FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_unknown_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_Unknown *block, unsigned block_length); + +static FLAC__bool write_metadata_block_header_(FILE *file, FLAC__Metadata_SimpleIteratorStatus *status, const FLAC__StreamMetadata *block); +static FLAC__bool write_metadata_block_data_(FILE *file, FLAC__Metadata_SimpleIteratorStatus *status, const FLAC__StreamMetadata *block); +static FLAC__bool write_metadata_block_header_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata *block); +static FLAC__bool write_metadata_block_data_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata *block); +static FLAC__bool write_metadata_block_data_streaminfo_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_StreamInfo *block); +static FLAC__bool write_metadata_block_data_padding_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_Padding *block, unsigned block_length); +static FLAC__bool write_metadata_block_data_application_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_Application *block, unsigned block_length); +static FLAC__bool write_metadata_block_data_seektable_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_SeekTable *block); +static FLAC__bool write_metadata_block_data_vorbis_comment_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_VorbisComment *block); +static FLAC__bool write_metadata_block_data_cuesheet_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_CueSheet *block); +static FLAC__bool write_metadata_block_data_unknown_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_Unknown *block, unsigned block_length); + +static FLAC__bool write_metadata_block_stationary_(FLAC__Metadata_SimpleIterator *iterator, const FLAC__StreamMetadata *block); +static FLAC__bool write_metadata_block_stationary_with_padding_(FLAC__Metadata_SimpleIterator *iterator, FLAC__StreamMetadata *block, unsigned padding_length, FLAC__bool padding_is_last); +static FLAC__bool rewrite_whole_file_(FLAC__Metadata_SimpleIterator *iterator, FLAC__StreamMetadata *block, FLAC__bool append); + +static void simple_iterator_push_(FLAC__Metadata_SimpleIterator *iterator); +static FLAC__bool simple_iterator_pop_(FLAC__Metadata_SimpleIterator *iterator); + +static unsigned seek_to_first_metadata_block_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__IOCallback_Seek seek_cb); +static unsigned seek_to_first_metadata_block_(FILE *f); + +static FLAC__bool simple_iterator_copy_file_prefix_(FLAC__Metadata_SimpleIterator *iterator, FILE **tempfile, char **tempfilename, FLAC__bool append); +static FLAC__bool simple_iterator_copy_file_postfix_(FLAC__Metadata_SimpleIterator *iterator, FILE **tempfile, char **tempfilename, int fixup_is_last_code, long fixup_is_last_flag_offset, FLAC__bool backup); + +static FLAC__bool copy_n_bytes_from_file_(FILE *file, FILE *tempfile, unsigned bytes/*@@@ 4G limit*/, FLAC__Metadata_SimpleIteratorStatus *status); +static FLAC__bool copy_n_bytes_from_file_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__IOHandle temp_handle, FLAC__IOCallback_Write temp_write_cb, unsigned bytes/*@@@ 4G limit*/, FLAC__Metadata_SimpleIteratorStatus *status); +static FLAC__bool copy_remaining_bytes_from_file_(FILE *file, FILE *tempfile, FLAC__Metadata_SimpleIteratorStatus *status); +static FLAC__bool copy_remaining_bytes_from_file_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__IOCallback_Eof eof_cb, FLAC__IOHandle temp_handle, FLAC__IOCallback_Write temp_write_cb, FLAC__Metadata_SimpleIteratorStatus *status); + +static FLAC__bool open_tempfile_(const char *filename, const char *tempfile_path_prefix, FILE **tempfile, char **tempfilename, FLAC__Metadata_SimpleIteratorStatus *status); +static FLAC__bool transport_tempfile_(const char *filename, FILE **tempfile, char **tempfilename, FLAC__Metadata_SimpleIteratorStatus *status); +static void cleanup_tempfile_(FILE **tempfile, char **tempfilename); + +static FLAC__bool get_file_stats_(const char *filename, struct stat *stats); +static void set_file_stats_(const char *filename, struct stat *stats); + +static int fseek_wrapper_(FLAC__IOHandle handle, FLAC__int64 offset, int whence); +static FLAC__int64 ftell_wrapper_(FLAC__IOHandle handle); + +static FLAC__Metadata_ChainStatus get_equivalent_status_(FLAC__Metadata_SimpleIteratorStatus status); + + +#ifdef FLAC__VALGRIND_TESTING +static size_t local__fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream) +{ + size_t ret = fwrite(ptr, size, nmemb, stream); + if(!ferror(stream)) + fflush(stream); + return ret; +} +#else +#define local__fwrite fwrite +#endif + +/**************************************************************************** + * + * Level 0 implementation + * + ***************************************************************************/ + +static FLAC__StreamDecoderWriteStatus write_callback_(const FLAC__FileDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data); +static void metadata_callback_(const FLAC__FileDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data); +static void error_callback_(const FLAC__FileDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data); + +typedef struct { + FLAC__bool got_error; + FLAC__bool got_object; + FLAC__StreamMetadata *object; +} level0_client_data; + +FLAC_API FLAC__bool FLAC__metadata_get_streaminfo(const char *filename, FLAC__StreamMetadata *streaminfo) +{ + level0_client_data cd; + FLAC__FileDecoder *decoder; + + FLAC__ASSERT(0 != filename); + FLAC__ASSERT(0 != streaminfo); + + decoder = FLAC__file_decoder_new(); + + if(0 == decoder) + return false; + + cd.got_error = false; + cd.got_object = false; + cd.object = 0; + + FLAC__file_decoder_set_md5_checking(decoder, false); + FLAC__file_decoder_set_filename(decoder, filename); + FLAC__file_decoder_set_metadata_ignore_all(decoder); + FLAC__file_decoder_set_metadata_respond(decoder, FLAC__METADATA_TYPE_STREAMINFO); + FLAC__file_decoder_set_write_callback(decoder, write_callback_); + FLAC__file_decoder_set_metadata_callback(decoder, metadata_callback_); + FLAC__file_decoder_set_error_callback(decoder, error_callback_); + FLAC__file_decoder_set_client_data(decoder, &cd); + + if(FLAC__file_decoder_init(decoder) != FLAC__FILE_DECODER_OK || cd.got_error) { + FLAC__file_decoder_finish(decoder); + FLAC__file_decoder_delete(decoder); + return false; + } + + if(!FLAC__file_decoder_process_until_end_of_metadata(decoder) || cd.got_error) { + FLAC__file_decoder_finish(decoder); + FLAC__file_decoder_delete(decoder); + if(0 != cd.object) + FLAC__metadata_object_delete(cd.object); + return false; + } + + FLAC__file_decoder_finish(decoder); + FLAC__file_decoder_delete(decoder); + + if(cd.got_object) { + /* can just copy the contents since STREAMINFO has no internal structure */ + *streaminfo = *(cd.object); + } + + if(0 != cd.object) + FLAC__metadata_object_delete(cd.object); + + return cd.got_object; +} + +FLAC_API FLAC__bool FLAC__metadata_get_tags(const char *filename, FLAC__StreamMetadata **tags) +{ + level0_client_data cd; + FLAC__FileDecoder *decoder; + + FLAC__ASSERT(0 != filename); + FLAC__ASSERT(0 != tags); + + decoder = FLAC__file_decoder_new(); + + if(0 == decoder) + return false; + + *tags = 0; + + cd.got_error = false; + cd.got_object = false; + cd.object = 0; + + FLAC__file_decoder_set_md5_checking(decoder, false); + FLAC__file_decoder_set_filename(decoder, filename); + FLAC__file_decoder_set_metadata_ignore_all(decoder); + FLAC__file_decoder_set_metadata_respond(decoder, FLAC__METADATA_TYPE_VORBIS_COMMENT); + FLAC__file_decoder_set_write_callback(decoder, write_callback_); + FLAC__file_decoder_set_metadata_callback(decoder, metadata_callback_); + FLAC__file_decoder_set_error_callback(decoder, error_callback_); + FLAC__file_decoder_set_client_data(decoder, &cd); + + if(FLAC__file_decoder_init(decoder) != FLAC__FILE_DECODER_OK || cd.got_error) { + FLAC__file_decoder_finish(decoder); + FLAC__file_decoder_delete(decoder); + return false; + } + + if(!FLAC__file_decoder_process_until_end_of_metadata(decoder) || cd.got_error) { + FLAC__file_decoder_finish(decoder); + FLAC__file_decoder_delete(decoder); + if(0 != cd.object) + FLAC__metadata_object_delete(cd.object); + return false; + } + + FLAC__file_decoder_finish(decoder); + FLAC__file_decoder_delete(decoder); + + if(cd.got_object) + *tags = cd.object; + + return cd.got_object; +} + +FLAC__StreamDecoderWriteStatus write_callback_(const FLAC__FileDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data) +{ + (void)decoder, (void)frame, (void)buffer, (void)client_data; + + return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE; +} + +void metadata_callback_(const FLAC__FileDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data) +{ + level0_client_data *cd = (level0_client_data *)client_data; + (void)decoder; + + /* + * we assume we only get here when the one metadata block we were + * looking for was passed to us + */ + if(!cd->got_object) { + if(0 == (cd->object = FLAC__metadata_object_clone(metadata))) + cd->got_error = true; + else + cd->got_object = true; + } +} + +void error_callback_(const FLAC__FileDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data) +{ + level0_client_data *cd = (level0_client_data *)client_data; + (void)decoder; + + if(status != FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC) + cd->got_error = true; +} + + +/**************************************************************************** + * + * Level 1 implementation + * + ***************************************************************************/ + +#define SIMPLE_ITERATOR_MAX_PUSH_DEPTH (1+4) +/* 1 for initial offset, +4 for our own personal use */ + +struct FLAC__Metadata_SimpleIterator { + FILE *file; + char *filename, *tempfile_path_prefix; + struct stat stats; + FLAC__bool has_stats; + FLAC__bool is_writable; + FLAC__Metadata_SimpleIteratorStatus status; + /*@@@ 2G limits here because of the offset type: */ + long offset[SIMPLE_ITERATOR_MAX_PUSH_DEPTH]; + long first_offset; /* this is the offset to the STREAMINFO block */ + unsigned depth; + /* this is the metadata block header of the current block we are pointing to: */ + FLAC__bool is_last; + FLAC__MetadataType type; + unsigned length; +}; + +FLAC_API const char * const FLAC__Metadata_SimpleIteratorStatusString[] = { + "FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK", + "FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ILLEGAL_INPUT", + "FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ERROR_OPENING_FILE", + "FLAC__METADATA_SIMPLE_ITERATOR_STATUS_NOT_A_FLAC_FILE", + "FLAC__METADATA_SIMPLE_ITERATOR_STATUS_NOT_WRITABLE", + "FLAC__METADATA_SIMPLE_ITERATOR_STATUS_BAD_METADATA", + "FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR", + "FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR", + "FLAC__METADATA_SIMPLE_ITERATOR_STATUS_WRITE_ERROR", + "FLAC__METADATA_SIMPLE_ITERATOR_STATUS_RENAME_ERROR", + "FLAC__METADATA_SIMPLE_ITERATOR_STATUS_UNLINK_ERROR", + "FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR", + "FLAC__METADATA_SIMPLE_ITERATOR_STATUS_INTERNAL_ERROR" +}; + + +FLAC_API FLAC__Metadata_SimpleIterator *FLAC__metadata_simple_iterator_new() +{ + FLAC__Metadata_SimpleIterator *iterator = (FLAC__Metadata_SimpleIterator*)calloc(1, sizeof(FLAC__Metadata_SimpleIterator)); + + if(0 != iterator) { + iterator->file = 0; + iterator->filename = 0; + iterator->tempfile_path_prefix = 0; + iterator->has_stats = false; + iterator->is_writable = false; + iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK; + iterator->first_offset = iterator->offset[0] = -1; + iterator->depth = 0; + } + + return iterator; +} + +static void simple_iterator_free_guts_(FLAC__Metadata_SimpleIterator *iterator) +{ + FLAC__ASSERT(0 != iterator); + + if(0 != iterator->file) { + fclose(iterator->file); + iterator->file = 0; + if(iterator->has_stats) + set_file_stats_(iterator->filename, &iterator->stats); + } + if(0 != iterator->filename) { + free(iterator->filename); + iterator->filename = 0; + } + if(0 != iterator->tempfile_path_prefix) { + free(iterator->tempfile_path_prefix); + iterator->tempfile_path_prefix = 0; + } +} + +FLAC_API void FLAC__metadata_simple_iterator_delete(FLAC__Metadata_SimpleIterator *iterator) +{ + FLAC__ASSERT(0 != iterator); + + simple_iterator_free_guts_(iterator); + free(iterator); +} + +FLAC_API FLAC__Metadata_SimpleIteratorStatus FLAC__metadata_simple_iterator_status(FLAC__Metadata_SimpleIterator *iterator) +{ + FLAC__Metadata_SimpleIteratorStatus status; + + FLAC__ASSERT(0 != iterator); + + status = iterator->status; + iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK; + return status; +} + +static FLAC__bool simple_iterator_prime_input_(FLAC__Metadata_SimpleIterator *iterator, FLAC__bool read_only) +{ + unsigned ret; + + FLAC__ASSERT(0 != iterator); + + if(read_only || 0 == (iterator->file = fopen(iterator->filename, "r+b"))) { + iterator->is_writable = false; + if(read_only || errno == EACCES) { + if(0 == (iterator->file = fopen(iterator->filename, "rb"))) { + iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ERROR_OPENING_FILE; + return false; + } + } + else { + iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ERROR_OPENING_FILE; + return false; + } + } + else { + iterator->is_writable = true; + } + + ret = seek_to_first_metadata_block_(iterator->file); + switch(ret) { + case 0: + iterator->depth = 0; + iterator->first_offset = iterator->offset[iterator->depth] = ftell(iterator->file); + return read_metadata_block_header_(iterator); + case 1: + iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR; + return false; + case 2: + iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR; + return false; + case 3: + iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_NOT_A_FLAC_FILE; + return false; + default: + FLAC__ASSERT(0); + return false; + } +} + +#if 0 +@@@ If we decide to finish implementing this, put this comment back in metadata.h +/* + * The 'tempfile_path_prefix' allows you to specify a directory where + * tempfiles should go. Remember that if your metadata edits cause the + * FLAC file to grow, the entire file will have to be rewritten. If + * 'tempfile_path_prefix' is NULL, the temp file will be written in the + * same directory as the original FLAC file. This makes replacing the + * original with the tempfile fast but requires extra space in the same + * partition for the tempfile. If space is a problem, you can pass a + * directory name belonging to a different partition in + * 'tempfile_path_prefix'. Note that you should use the forward slash + * '/' as the directory separator. A trailing slash is not needed; it + * will be added automatically. + */ +FLAC__bool FLAC__metadata_simple_iterator_init(FLAC__Metadata_SimpleIterator *iterator, const char *filename, FLAC__bool preserve_file_stats, const char *tempfile_path_prefix); +#endif + +FLAC_API FLAC__bool FLAC__metadata_simple_iterator_init(FLAC__Metadata_SimpleIterator *iterator, const char *filename, FLAC__bool read_only, FLAC__bool preserve_file_stats) +{ + const char *tempfile_path_prefix = 0; /*@@@ search for comments near 'rename(...)' for what it will take to finish implementing this */ + + FLAC__ASSERT(0 != iterator); + FLAC__ASSERT(0 != filename); + + simple_iterator_free_guts_(iterator); + + if(!read_only && preserve_file_stats) + iterator->has_stats = get_file_stats_(filename, &iterator->stats); + + if(0 == (iterator->filename = strdup(filename))) { + iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR; + return false; + } + if(0 != tempfile_path_prefix && 0 == (iterator->tempfile_path_prefix = strdup(tempfile_path_prefix))) { + iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR; + return false; + } + + return simple_iterator_prime_input_(iterator, read_only); +} + +FLAC_API FLAC__bool FLAC__metadata_simple_iterator_is_writable(const FLAC__Metadata_SimpleIterator *iterator) +{ + FLAC__ASSERT(0 != iterator); + FLAC__ASSERT(0 != iterator->file); + + return iterator->is_writable; +} + +FLAC_API FLAC__bool FLAC__metadata_simple_iterator_next(FLAC__Metadata_SimpleIterator *iterator) +{ + FLAC__ASSERT(0 != iterator); + FLAC__ASSERT(0 != iterator->file); + + if(iterator->is_last) + return false; + + if(0 != fseek(iterator->file, iterator->length, SEEK_CUR)) { + iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR; + return false; + } + + iterator->offset[iterator->depth] = ftell(iterator->file); + + return read_metadata_block_header_(iterator); +} + +FLAC_API FLAC__bool FLAC__metadata_simple_iterator_prev(FLAC__Metadata_SimpleIterator *iterator) +{ + long this_offset; + + FLAC__ASSERT(0 != iterator); + FLAC__ASSERT(0 != iterator->file); + + if(iterator->offset[iterator->depth] == iterator->first_offset) + return false; + + if(0 != fseek(iterator->file, iterator->first_offset, SEEK_SET)) { + iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR; + return false; + } + this_offset = iterator->first_offset; + if(!read_metadata_block_header_(iterator)) + return false; + + /* we ignore any error from ftell() and catch it in fseek() */ + while(ftell(iterator->file) + (long)iterator->length < iterator->offset[iterator->depth]) { + if(0 != fseek(iterator->file, iterator->length, SEEK_CUR)) { + iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR; + return false; + } + this_offset = ftell(iterator->file); + if(!read_metadata_block_header_(iterator)) + return false; + } + + iterator->offset[iterator->depth] = this_offset; + + return true; +} + +FLAC_API FLAC__MetadataType FLAC__metadata_simple_iterator_get_block_type(const FLAC__Metadata_SimpleIterator *iterator) +{ + FLAC__ASSERT(0 != iterator); + FLAC__ASSERT(0 != iterator->file); + + return iterator->type; +} + +FLAC_API FLAC__StreamMetadata *FLAC__metadata_simple_iterator_get_block(FLAC__Metadata_SimpleIterator *iterator) +{ + FLAC__StreamMetadata *block = FLAC__metadata_object_new(iterator->type); + + FLAC__ASSERT(0 != iterator); + FLAC__ASSERT(0 != iterator->file); + + if(0 != block) { + block->is_last = iterator->is_last; + block->length = iterator->length; + + if(!read_metadata_block_data_(iterator, block)) { + FLAC__metadata_object_delete(block); + return 0; + } + + /* back up to the beginning of the block data to stay consistent */ + if(0 != fseek(iterator->file, iterator->offset[iterator->depth] + FLAC__STREAM_METADATA_HEADER_LENGTH, SEEK_SET)) { + iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR; + FLAC__metadata_object_delete(block); + return 0; + } + } + else + iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR; + + return block; +} + +FLAC_API FLAC__bool FLAC__metadata_simple_iterator_set_block(FLAC__Metadata_SimpleIterator *iterator, FLAC__StreamMetadata *block, FLAC__bool use_padding) +{ + FLAC__ASSERT_DECLARATION(long debug_target_offset = iterator->offset[iterator->depth];) + FLAC__bool ret; + + FLAC__ASSERT(0 != iterator); + FLAC__ASSERT(0 != iterator->file); + FLAC__ASSERT(0 != block); + + if(!iterator->is_writable) { + iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_NOT_WRITABLE; + return false; + } + + if(iterator->type == FLAC__METADATA_TYPE_STREAMINFO || block->type == FLAC__METADATA_TYPE_STREAMINFO) { + if(iterator->type != block->type) { + iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ILLEGAL_INPUT; + return false; + } + } + + block->is_last = iterator->is_last; + + if(iterator->length == block->length) + return write_metadata_block_stationary_(iterator, block); + else if(iterator->length > block->length) { + if(use_padding && iterator->length >= FLAC__STREAM_METADATA_HEADER_LENGTH + block->length) { + ret = write_metadata_block_stationary_with_padding_(iterator, block, iterator->length - FLAC__STREAM_METADATA_HEADER_LENGTH - block->length, block->is_last); + FLAC__ASSERT(!ret || iterator->offset[iterator->depth] == debug_target_offset); + FLAC__ASSERT(!ret || ftell(iterator->file) == debug_target_offset + (long)FLAC__STREAM_METADATA_HEADER_LENGTH); + return ret; + } + else { + ret = rewrite_whole_file_(iterator, block, /*append=*/false); + FLAC__ASSERT(!ret || iterator->offset[iterator->depth] == debug_target_offset); + FLAC__ASSERT(!ret || ftell(iterator->file) == debug_target_offset + (long)FLAC__STREAM_METADATA_HEADER_LENGTH); + return ret; + } + } + else /* iterator->length < block->length */ { + unsigned padding_leftover = 0; + FLAC__bool padding_is_last = false; + if(use_padding) { + /* first see if we can even use padding */ + if(iterator->is_last) { + use_padding = false; + } + else { + const unsigned extra_padding_bytes_required = block->length - iterator->length; + simple_iterator_push_(iterator); + if(!FLAC__metadata_simple_iterator_next(iterator)) { + (void)simple_iterator_pop_(iterator); + return false; + } + if(iterator->type != FLAC__METADATA_TYPE_PADDING) { + use_padding = false; + } + else { + if(FLAC__STREAM_METADATA_HEADER_LENGTH + iterator->length == extra_padding_bytes_required) { + padding_leftover = 0; + block->is_last = iterator->is_last; + } + else if(iterator->length < extra_padding_bytes_required) + use_padding = false; + else { + padding_leftover = FLAC__STREAM_METADATA_HEADER_LENGTH + iterator->length - extra_padding_bytes_required; + padding_is_last = iterator->is_last; + block->is_last = false; + } + } + if(!simple_iterator_pop_(iterator)) + return false; + } + } + if(use_padding) { + if(padding_leftover == 0) { + ret = write_metadata_block_stationary_(iterator, block); + FLAC__ASSERT(!ret || iterator->offset[iterator->depth] == debug_target_offset); + FLAC__ASSERT(!ret || ftell(iterator->file) == debug_target_offset + (long)FLAC__STREAM_METADATA_HEADER_LENGTH); + return ret; + } + else { + FLAC__ASSERT(padding_leftover >= FLAC__STREAM_METADATA_HEADER_LENGTH); + ret = write_metadata_block_stationary_with_padding_(iterator, block, padding_leftover - FLAC__STREAM_METADATA_HEADER_LENGTH, padding_is_last); + FLAC__ASSERT(!ret || iterator->offset[iterator->depth] == debug_target_offset); + FLAC__ASSERT(!ret || ftell(iterator->file) == debug_target_offset + (long)FLAC__STREAM_METADATA_HEADER_LENGTH); + return ret; + } + } + else { + ret = rewrite_whole_file_(iterator, block, /*append=*/false); + FLAC__ASSERT(!ret || iterator->offset[iterator->depth] == debug_target_offset); + FLAC__ASSERT(!ret || ftell(iterator->file) == debug_target_offset + (long)FLAC__STREAM_METADATA_HEADER_LENGTH); + return ret; + } + } +} + +FLAC_API FLAC__bool FLAC__metadata_simple_iterator_insert_block_after(FLAC__Metadata_SimpleIterator *iterator, FLAC__StreamMetadata *block, FLAC__bool use_padding) +{ + unsigned padding_leftover = 0; + FLAC__bool padding_is_last = false; + + FLAC__ASSERT_DECLARATION(long debug_target_offset = iterator->offset[iterator->depth] + FLAC__STREAM_METADATA_HEADER_LENGTH + iterator->length;) + FLAC__bool ret; + + FLAC__ASSERT(0 != iterator); + FLAC__ASSERT(0 != iterator->file); + FLAC__ASSERT(0 != block); + + if(!iterator->is_writable) + return false; + + if(block->type == FLAC__METADATA_TYPE_STREAMINFO) { + iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ILLEGAL_INPUT; + return false; + } + + block->is_last = iterator->is_last; + + if(use_padding) { + /* first see if we can even use padding */ + if(iterator->is_last) { + use_padding = false; + } + else { + simple_iterator_push_(iterator); + if(!FLAC__metadata_simple_iterator_next(iterator)) { + (void)simple_iterator_pop_(iterator); + return false; + } + if(iterator->type != FLAC__METADATA_TYPE_PADDING) { + use_padding = false; + } + else { + if(iterator->length == block->length) { + padding_leftover = 0; + block->is_last = iterator->is_last; + } + else if(iterator->length < FLAC__STREAM_METADATA_HEADER_LENGTH + block->length) + use_padding = false; + else { + padding_leftover = iterator->length - block->length; + padding_is_last = iterator->is_last; + block->is_last = false; + } + } + if(!simple_iterator_pop_(iterator)) + return false; + } + } + if(use_padding) { + /* move to the next block, which is suitable padding */ + if(!FLAC__metadata_simple_iterator_next(iterator)) + return false; + if(padding_leftover == 0) { + ret = write_metadata_block_stationary_(iterator, block); + FLAC__ASSERT(iterator->offset[iterator->depth] == debug_target_offset); + FLAC__ASSERT(ftell(iterator->file) == debug_target_offset + (long)FLAC__STREAM_METADATA_HEADER_LENGTH); + return ret; + } + else { + FLAC__ASSERT(padding_leftover >= FLAC__STREAM_METADATA_HEADER_LENGTH); + ret = write_metadata_block_stationary_with_padding_(iterator, block, padding_leftover - FLAC__STREAM_METADATA_HEADER_LENGTH, padding_is_last); + FLAC__ASSERT(iterator->offset[iterator->depth] == debug_target_offset); + FLAC__ASSERT(ftell(iterator->file) == debug_target_offset + (long)FLAC__STREAM_METADATA_HEADER_LENGTH); + return ret; + } + } + else { + ret = rewrite_whole_file_(iterator, block, /*append=*/true); + FLAC__ASSERT(iterator->offset[iterator->depth] == debug_target_offset); + FLAC__ASSERT(ftell(iterator->file) == debug_target_offset + (long)FLAC__STREAM_METADATA_HEADER_LENGTH); + return ret; + } +} + +FLAC_API FLAC__bool FLAC__metadata_simple_iterator_delete_block(FLAC__Metadata_SimpleIterator *iterator, FLAC__bool use_padding) +{ + FLAC__ASSERT_DECLARATION(long debug_target_offset = iterator->offset[iterator->depth];) + FLAC__bool ret; + + if(iterator->type == FLAC__METADATA_TYPE_STREAMINFO) { + iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ILLEGAL_INPUT; + return false; + } + + if(use_padding) { + FLAC__StreamMetadata *padding = FLAC__metadata_object_new(FLAC__METADATA_TYPE_PADDING); + if(0 == padding) { + iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR; + return false; + } + padding->length = iterator->length; + if(!FLAC__metadata_simple_iterator_set_block(iterator, padding, false)) { + FLAC__metadata_object_delete(padding); + return false; + } + FLAC__metadata_object_delete(padding); + if(!FLAC__metadata_simple_iterator_prev(iterator)) + return false; + FLAC__ASSERT(iterator->offset[iterator->depth] + (long)FLAC__STREAM_METADATA_HEADER_LENGTH + (long)iterator->length == debug_target_offset); + FLAC__ASSERT(ftell(iterator->file) + (long)iterator->length == debug_target_offset); + return true; + } + else { + ret = rewrite_whole_file_(iterator, 0, /*append=*/false); + FLAC__ASSERT(iterator->offset[iterator->depth] + (long)FLAC__STREAM_METADATA_HEADER_LENGTH + (long)iterator->length == debug_target_offset); + FLAC__ASSERT(ftell(iterator->file) + (long)iterator->length == debug_target_offset); + return ret; + } +} + + + +/**************************************************************************** + * + * Level 2 implementation + * + ***************************************************************************/ + + +typedef struct FLAC__Metadata_Node { + FLAC__StreamMetadata *data; + struct FLAC__Metadata_Node *prev, *next; +} FLAC__Metadata_Node; + +struct FLAC__Metadata_Chain { + char *filename; /* will be NULL if using callbacks */ + FLAC__Metadata_Node *head; + FLAC__Metadata_Node *tail; + unsigned nodes; + FLAC__Metadata_ChainStatus status; + long first_offset, last_offset; /*@@@ 2G limit */ + /* + * This is the length of the chain initially read from the FLAC file. + * it is used to compare against the current length to decide whether + * or not the whole file has to be rewritten. + */ + unsigned initial_length; /*@@@ 4G limit */ +}; + +struct FLAC__Metadata_Iterator { + FLAC__Metadata_Chain *chain; + FLAC__Metadata_Node *current; +}; + +FLAC_API const char * const FLAC__Metadata_ChainStatusString[] = { + "FLAC__METADATA_CHAIN_STATUS_OK", + "FLAC__METADATA_CHAIN_STATUS_ILLEGAL_INPUT", + "FLAC__METADATA_CHAIN_STATUS_ERROR_OPENING_FILE", + "FLAC__METADATA_CHAIN_STATUS_NOT_A_FLAC_FILE", + "FLAC__METADATA_CHAIN_STATUS_NOT_WRITABLE", + "FLAC__METADATA_CHAIN_STATUS_BAD_METADATA", + "FLAC__METADATA_CHAIN_STATUS_READ_ERROR", + "FLAC__METADATA_CHAIN_STATUS_SEEK_ERROR", + "FLAC__METADATA_CHAIN_STATUS_WRITE_ERROR", + "FLAC__METADATA_CHAIN_STATUS_RENAME_ERROR", + "FLAC__METADATA_CHAIN_STATUS_UNLINK_ERROR", + "FLAC__METADATA_CHAIN_STATUS_MEMORY_ALLOCATION_ERROR", + "FLAC__METADATA_CHAIN_STATUS_INTERNAL_ERROR", + "FLAC__METADATA_CHAIN_STATUS_INVALID_CALLBACKS", + "FLAC__METADATA_CHAIN_STATUS_READ_WRITE_MISMATCH", + "FLAC__METADATA_CHAIN_STATUS_WRONG_WRITE_CALL" +}; + + +static FLAC__Metadata_Node *node_new_() +{ + return (FLAC__Metadata_Node*)calloc(1, sizeof(FLAC__Metadata_Node)); +} + +static void node_delete_(FLAC__Metadata_Node *node) +{ + FLAC__ASSERT(0 != node); + if(0 != node->data) + FLAC__metadata_object_delete(node->data); + free(node); +} + +static void chain_init_(FLAC__Metadata_Chain *chain) +{ + FLAC__ASSERT(0 != chain); + + chain->filename = 0; + chain->head = chain->tail = 0; + chain->nodes = 0; + chain->status = FLAC__METADATA_CHAIN_STATUS_OK; + chain->initial_length = 0; +} + +static void chain_clear_(FLAC__Metadata_Chain *chain) +{ + FLAC__Metadata_Node *node, *next; + + FLAC__ASSERT(0 != chain); + + for(node = chain->head; node; ) { + next = node->next; + node_delete_(node); + node = next; + } + + if(0 != chain->filename) + free(chain->filename); + + chain_init_(chain); +} + +static void chain_append_node_(FLAC__Metadata_Chain *chain, FLAC__Metadata_Node *node) +{ + FLAC__ASSERT(0 != chain); + FLAC__ASSERT(0 != node); + FLAC__ASSERT(0 != node->data); + + node->next = node->prev = 0; + node->data->is_last = true; + if(0 != chain->tail) + chain->tail->data->is_last = false; + + if(0 == chain->head) + chain->head = node; + else { + FLAC__ASSERT(0 != chain->tail); + chain->tail->next = node; + node->prev = chain->tail; + } + chain->tail = node; + chain->nodes++; +} + +static void chain_remove_node_(FLAC__Metadata_Chain *chain, FLAC__Metadata_Node *node) +{ + FLAC__ASSERT(0 != chain); + FLAC__ASSERT(0 != node); + + if(node == chain->head) + chain->head = node->next; + else + node->prev->next = node->next; + + if(node == chain->tail) + chain->tail = node->prev; + else + node->next->prev = node->prev; + + if(0 != chain->tail) + chain->tail->data->is_last = true; + + chain->nodes--; +} + +static void chain_delete_node_(FLAC__Metadata_Chain *chain, FLAC__Metadata_Node *node) +{ + chain_remove_node_(chain, node); + node_delete_(node); +} + +static unsigned chain_calculate_length_(FLAC__Metadata_Chain *chain) +{ + const FLAC__Metadata_Node *node; + unsigned length = 0; + for(node = chain->head; node; node = node->next) + length += (FLAC__STREAM_METADATA_HEADER_LENGTH + node->data->length); + return length; +} + +static void iterator_insert_node_(FLAC__Metadata_Iterator *iterator, FLAC__Metadata_Node *node) +{ + FLAC__ASSERT(0 != node); + FLAC__ASSERT(0 != node->data); + FLAC__ASSERT(0 != iterator); + FLAC__ASSERT(0 != iterator->current); + FLAC__ASSERT(0 != iterator->chain); + FLAC__ASSERT(0 != iterator->chain->head); + FLAC__ASSERT(0 != iterator->chain->tail); + + node->data->is_last = false; + + node->prev = iterator->current->prev; + node->next = iterator->current; + + if(0 == node->prev) + iterator->chain->head = node; + else + node->prev->next = node; + + iterator->current->prev = node; + + iterator->chain->nodes++; +} + +static void iterator_insert_node_after_(FLAC__Metadata_Iterator *iterator, FLAC__Metadata_Node *node) +{ + FLAC__ASSERT(0 != node); + FLAC__ASSERT(0 != node->data); + FLAC__ASSERT(0 != iterator); + FLAC__ASSERT(0 != iterator->current); + FLAC__ASSERT(0 != iterator->chain); + FLAC__ASSERT(0 != iterator->chain->head); + FLAC__ASSERT(0 != iterator->chain->tail); + + iterator->current->data->is_last = false; + + node->prev = iterator->current; + node->next = iterator->current->next; + + if(0 == node->next) + iterator->chain->tail = node; + else + node->next->prev = node; + + node->prev->next = node; + + iterator->chain->tail->data->is_last = true; + + iterator->chain->nodes++; +} + +/* return true iff node and node->next are both padding */ +static FLAC__bool chain_merge_adjacent_padding_(FLAC__Metadata_Chain *chain, FLAC__Metadata_Node *node) +{ + if(node->data->type == FLAC__METADATA_TYPE_PADDING && 0 != node->next && node->next->data->type == FLAC__METADATA_TYPE_PADDING) { + const unsigned growth = FLAC__STREAM_METADATA_HEADER_LENGTH + node->next->data->length; + node->data->length += growth; + + chain_delete_node_(chain, node->next); + return true; + } + else + return false; +} + +/* Returns the new length of the chain, or 0 if there was an error. */ +/* WATCHOUT: This can get called multiple times before a write, so + * it should still work when this happens. + */ +/* WATCHOUT: Make sure to also update the logic in + * FLAC__metadata_chain_check_if_tempfile_needed() if the logic here changes. + */ +static unsigned chain_prepare_for_write_(FLAC__Metadata_Chain *chain, FLAC__bool use_padding) +{ + unsigned current_length = chain_calculate_length_(chain); + + if(use_padding) { + /* if the metadata shrank and the last block is padding, we just extend the last padding block */ + if(current_length < chain->initial_length && chain->tail->data->type == FLAC__METADATA_TYPE_PADDING) { + const unsigned delta = chain->initial_length - current_length; + chain->tail->data->length += delta; + current_length += delta; + FLAC__ASSERT(current_length == chain->initial_length); + } + /* if the metadata shrank more than 4 bytes then there's room to add another padding block */ + else if(current_length + FLAC__STREAM_METADATA_HEADER_LENGTH <= chain->initial_length) { + FLAC__StreamMetadata *padding; + FLAC__Metadata_Node *node; + if(0 == (padding = FLAC__metadata_object_new(FLAC__METADATA_TYPE_PADDING))) { + chain->status = FLAC__METADATA_CHAIN_STATUS_MEMORY_ALLOCATION_ERROR; + return 0; + } + padding->length = chain->initial_length - (FLAC__STREAM_METADATA_HEADER_LENGTH + current_length); + if(0 == (node = node_new_())) { + FLAC__metadata_object_delete(padding); + chain->status = FLAC__METADATA_CHAIN_STATUS_MEMORY_ALLOCATION_ERROR; + return 0; + } + node->data = padding; + chain_append_node_(chain, node); + current_length = chain_calculate_length_(chain); + FLAC__ASSERT(current_length == chain->initial_length); + } + /* if the metadata grew but the last block is padding, try cutting the padding to restore the original length so we don't have to rewrite the whole file */ + else if(current_length > chain->initial_length) { + const unsigned delta = current_length - chain->initial_length; + if(chain->tail->data->type == FLAC__METADATA_TYPE_PADDING) { + /* if the delta is exactly the size of the last padding block, remove the padding block */ + if(chain->tail->data->length + FLAC__STREAM_METADATA_HEADER_LENGTH == delta) { + chain_delete_node_(chain, chain->tail); + current_length = chain_calculate_length_(chain); + FLAC__ASSERT(current_length == chain->initial_length); + } + /* if there is at least 'delta' bytes of padding, trim the padding down */ + else if(chain->tail->data->length >= delta) { + chain->tail->data->length -= delta; + current_length -= delta; + FLAC__ASSERT(current_length == chain->initial_length); + } + } + } + } + + return current_length; +} + +static FLAC__bool chain_read_cb_(FLAC__Metadata_Chain *chain, FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__IOCallback_Seek seek_cb, FLAC__IOCallback_Tell tell_cb) +{ + FLAC__Metadata_Node *node; + + FLAC__ASSERT(0 != chain); + + /* we assume we're already at the beginning of the file */ + + switch(seek_to_first_metadata_block_cb_(handle, read_cb, seek_cb)) { + case 0: + break; + case 1: + chain->status = FLAC__METADATA_CHAIN_STATUS_READ_ERROR; + return false; + case 2: + chain->status = FLAC__METADATA_CHAIN_STATUS_SEEK_ERROR; + return false; + case 3: + chain->status = FLAC__METADATA_CHAIN_STATUS_NOT_A_FLAC_FILE; + return false; + default: + FLAC__ASSERT(0); + return false; + } + + { + FLAC__int64 pos = tell_cb(handle); + if(pos < 0) { + chain->status = FLAC__METADATA_CHAIN_STATUS_READ_ERROR; + return false; + } + chain->first_offset = (long)pos; + } + + { + FLAC__bool is_last; + FLAC__MetadataType type; + unsigned length; + + do { + node = node_new_(); + if(0 == node) { + chain->status = FLAC__METADATA_CHAIN_STATUS_MEMORY_ALLOCATION_ERROR; + return false; + } + + if(!read_metadata_block_header_cb_(handle, read_cb, &is_last, &type, &length)) { + chain->status = FLAC__METADATA_CHAIN_STATUS_READ_ERROR; + return false; + } + + node->data = FLAC__metadata_object_new(type); + if(0 == node->data) { + node_delete_(node); + chain->status = FLAC__METADATA_CHAIN_STATUS_MEMORY_ALLOCATION_ERROR; + return false; + } + + node->data->is_last = is_last; + node->data->length = length; + + chain->status = get_equivalent_status_(read_metadata_block_data_cb_(handle, read_cb, seek_cb, node->data)); + if(chain->status != FLAC__METADATA_CHAIN_STATUS_OK) { + node_delete_(node); + return false; + } + chain_append_node_(chain, node); + } while(!is_last); + } + + { + FLAC__int64 pos = tell_cb(handle); + if(pos < 0) { + chain->status = FLAC__METADATA_CHAIN_STATUS_READ_ERROR; + return false; + } + chain->last_offset = (long)pos; + } + + chain->initial_length = chain_calculate_length_(chain); + + return true; +} + +static FLAC__bool chain_rewrite_metadata_in_place_cb_(FLAC__Metadata_Chain *chain, FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, FLAC__IOCallback_Seek seek_cb) +{ + FLAC__Metadata_Node *node; + + FLAC__ASSERT(0 != chain); + FLAC__ASSERT(0 != chain->head); + + if(0 != seek_cb(handle, chain->first_offset, SEEK_SET)) { + chain->status = FLAC__METADATA_CHAIN_STATUS_SEEK_ERROR; + return false; + } + + for(node = chain->head; node; node = node->next) { + if(!write_metadata_block_header_cb_(handle, write_cb, node->data)) { + chain->status = FLAC__METADATA_CHAIN_STATUS_WRITE_ERROR; + return false; + } + if(!write_metadata_block_data_cb_(handle, write_cb, node->data)) { + chain->status = FLAC__METADATA_CHAIN_STATUS_WRITE_ERROR; + return false; + } + } + + /*FLAC__ASSERT(fflush(), ftell() == chain->last_offset);*/ + + chain->status = FLAC__METADATA_CHAIN_STATUS_OK; + return true; +} + +static FLAC__bool chain_rewrite_metadata_in_place_(FLAC__Metadata_Chain *chain) +{ + FILE *file; + FLAC__bool ret; + + FLAC__ASSERT(0 != chain->filename); + + if(0 == (file = fopen(chain->filename, "r+b"))) { + chain->status = FLAC__METADATA_CHAIN_STATUS_ERROR_OPENING_FILE; + return false; + } + + /* chain_rewrite_metadata_in_place_cb_() sets chain->status for us */ + ret = chain_rewrite_metadata_in_place_cb_(chain, (FLAC__IOHandle)file, (FLAC__IOCallback_Write)fwrite, fseek_wrapper_); + + fclose(file); + + return ret; +} + +static FLAC__bool chain_rewrite_file_(FLAC__Metadata_Chain *chain, const char *tempfile_path_prefix) +{ + FILE *f, *tempfile; + char *tempfilename; + FLAC__Metadata_SimpleIteratorStatus status; + const FLAC__Metadata_Node *node; + + FLAC__ASSERT(0 != chain); + FLAC__ASSERT(0 != chain->filename); + FLAC__ASSERT(0 != chain->head); + + /* copy the file prefix (data up to first metadata block */ + if(0 == (f = fopen(chain->filename, "rb"))) { + chain->status = FLAC__METADATA_CHAIN_STATUS_ERROR_OPENING_FILE; + return false; + } + if(!open_tempfile_(chain->filename, tempfile_path_prefix, &tempfile, &tempfilename, &status)) { + chain->status = get_equivalent_status_(status); + cleanup_tempfile_(&tempfile, &tempfilename); + return false; + } + if(!copy_n_bytes_from_file_(f, tempfile, chain->first_offset, &status)) { + chain->status = get_equivalent_status_(status); + cleanup_tempfile_(&tempfile, &tempfilename); + return false; + } + + /* write the metadata */ + for(node = chain->head; node; node = node->next) { + if(!write_metadata_block_header_(tempfile, &status, node->data)) { + chain->status = get_equivalent_status_(status); + return false; + } + if(!write_metadata_block_data_(tempfile, &status, node->data)) { + chain->status = get_equivalent_status_(status); + return false; + } + } + /*FLAC__ASSERT(fflush(), ftell() == chain->last_offset);*/ + + /* copy the file postfix (everything after the metadata) */ + if(0 != fseek(f, chain->last_offset, SEEK_SET)) { + cleanup_tempfile_(&tempfile, &tempfilename); + chain->status = FLAC__METADATA_CHAIN_STATUS_SEEK_ERROR; + return false; + } + if(!copy_remaining_bytes_from_file_(f, tempfile, &status)) { + cleanup_tempfile_(&tempfile, &tempfilename); + chain->status = get_equivalent_status_(status); + return false; + } + + /* move the tempfile on top of the original */ + (void)fclose(f); + if(!transport_tempfile_(chain->filename, &tempfile, &tempfilename, &status)) + return false; + + return true; +} + +/* assumes 'handle' is already at beginning of file */ +static FLAC__bool chain_rewrite_file_cb_(FLAC__Metadata_Chain *chain, FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__IOCallback_Seek seek_cb, FLAC__IOCallback_Eof eof_cb, FLAC__IOHandle temp_handle, FLAC__IOCallback_Write temp_write_cb) +{ + FLAC__Metadata_SimpleIteratorStatus status; + const FLAC__Metadata_Node *node; + + FLAC__ASSERT(0 != chain); + FLAC__ASSERT(0 == chain->filename); + FLAC__ASSERT(0 != chain->head); + + /* copy the file prefix (data up to first metadata block */ + if(!copy_n_bytes_from_file_cb_(handle, read_cb, temp_handle, temp_write_cb, chain->first_offset, &status)) { + chain->status = get_equivalent_status_(status); + return false; + } + + /* write the metadata */ + for(node = chain->head; node; node = node->next) { + if(!write_metadata_block_header_cb_(temp_handle, temp_write_cb, node->data)) { + chain->status = FLAC__METADATA_CHAIN_STATUS_WRITE_ERROR; + return false; + } + if(!write_metadata_block_data_cb_(temp_handle, temp_write_cb, node->data)) { + chain->status = FLAC__METADATA_CHAIN_STATUS_WRITE_ERROR; + return false; + } + } + /*FLAC__ASSERT(fflush(), ftell() == chain->last_offset);*/ + + /* copy the file postfix (everything after the metadata) */ + if(0 != seek_cb(handle, chain->last_offset, SEEK_SET)) { + chain->status = FLAC__METADATA_CHAIN_STATUS_SEEK_ERROR; + return false; + } + if(!copy_remaining_bytes_from_file_cb_(handle, read_cb, eof_cb, temp_handle, temp_write_cb, &status)) { + chain->status = get_equivalent_status_(status); + return false; + } + + return true; +} + +FLAC_API FLAC__Metadata_Chain *FLAC__metadata_chain_new() +{ + FLAC__Metadata_Chain *chain = (FLAC__Metadata_Chain*)calloc(1, sizeof(FLAC__Metadata_Chain)); + + if(0 != chain) + chain_init_(chain); + + return chain; +} + +FLAC_API void FLAC__metadata_chain_delete(FLAC__Metadata_Chain *chain) +{ + FLAC__ASSERT(0 != chain); + + chain_clear_(chain); + + free(chain); +} + +FLAC_API FLAC__Metadata_ChainStatus FLAC__metadata_chain_status(FLAC__Metadata_Chain *chain) +{ + FLAC__Metadata_ChainStatus status; + + FLAC__ASSERT(0 != chain); + + status = chain->status; + chain->status = FLAC__METADATA_CHAIN_STATUS_OK; + return status; +} + +FLAC_API FLAC__bool FLAC__metadata_chain_read(FLAC__Metadata_Chain *chain, const char *filename) +{ + FILE *file; + FLAC__bool ret; + + FLAC__ASSERT(0 != chain); + FLAC__ASSERT(0 != filename); + + chain_clear_(chain); + + if(0 == (chain->filename = strdup(filename))) { + chain->status = FLAC__METADATA_CHAIN_STATUS_MEMORY_ALLOCATION_ERROR; + return false; + } + + if(0 == (file = fopen(filename, "rb"))) { + chain->status = FLAC__METADATA_CHAIN_STATUS_ERROR_OPENING_FILE; + return false; + } + + /* chain_read_cb_() sets chain->status for us */ + ret = chain_read_cb_(chain, file, (FLAC__IOCallback_Read)fread, fseek_wrapper_, ftell_wrapper_); + + fclose(file); + + return ret; +} + +FLAC_API FLAC__bool FLAC__metadata_chain_read_with_callbacks(FLAC__Metadata_Chain *chain, FLAC__IOHandle handle, FLAC__IOCallbacks callbacks) +{ + FLAC__ASSERT(0 != chain); + + chain_clear_(chain); + + if (0 == callbacks.read || 0 == callbacks.seek || 0 == callbacks.tell) { + chain->status = FLAC__METADATA_CHAIN_STATUS_INVALID_CALLBACKS; + return false; + } + + /* rewind */ + if(0 != callbacks.seek(handle, 0, SEEK_SET)) { + chain->status = FLAC__METADATA_CHAIN_STATUS_SEEK_ERROR; + return false; + } + + if(!chain_read_cb_(chain, handle, callbacks.read, callbacks.seek, callbacks.tell)) + return false; /* chain->status is already set by chain_read_cb_ */ + + return true; +} + +FLAC_API FLAC__bool FLAC__metadata_chain_check_if_tempfile_needed(FLAC__Metadata_Chain *chain, FLAC__bool use_padding) +{ + /* This does all the same checks that are in chain_prepare_for_write_() + * but doesn't actually alter the chain. Make sure to update the logic + * here if chain_prepare_for_write_() changes. + */ + const unsigned current_length = chain_calculate_length_(chain); + + FLAC__ASSERT(0 != chain); + + if(use_padding) { + /* if the metadata shrank and the last block is padding, we just extend the last padding block */ + if(current_length < chain->initial_length && chain->tail->data->type == FLAC__METADATA_TYPE_PADDING) + return false; + /* if the metadata shrank more than 4 bytes then there's room to add another padding block */ + else if(current_length + FLAC__STREAM_METADATA_HEADER_LENGTH <= chain->initial_length) + return false; + /* if the metadata grew but the last block is padding, try cutting the padding to restore the original length so we don't have to rewrite the whole file */ + else if(current_length > chain->initial_length) { + const unsigned delta = current_length - chain->initial_length; + if(chain->tail->data->type == FLAC__METADATA_TYPE_PADDING) { + /* if the delta is exactly the size of the last padding block, remove the padding block */ + if(chain->tail->data->length + FLAC__STREAM_METADATA_HEADER_LENGTH == delta) + return false; + /* if there is at least 'delta' bytes of padding, trim the padding down */ + else if(chain->tail->data->length >= delta) + return false; + } + } + } + + return (current_length != chain->initial_length); +} + +FLAC_API FLAC__bool FLAC__metadata_chain_write(FLAC__Metadata_Chain *chain, FLAC__bool use_padding, FLAC__bool preserve_file_stats) +{ + struct stat stats; + const char *tempfile_path_prefix = 0; + unsigned current_length; + + FLAC__ASSERT(0 != chain); + + if (0 == chain->filename) { + chain->status = FLAC__METADATA_CHAIN_STATUS_READ_WRITE_MISMATCH; + return false; + } + + current_length = chain_prepare_for_write_(chain, use_padding); + + /* a return value of 0 means there was an error; chain->status is already set */ + if (0 == current_length) + return false; + + if(preserve_file_stats) + get_file_stats_(chain->filename, &stats); + + if(current_length == chain->initial_length) { + if(!chain_rewrite_metadata_in_place_(chain)) + return false; + } + else { + if(!chain_rewrite_file_(chain, tempfile_path_prefix)) + return false; + + /* recompute lengths and offsets */ + { + const FLAC__Metadata_Node *node; + chain->initial_length = current_length; + chain->last_offset = chain->first_offset; + for(node = chain->head; node; node = node->next) + chain->last_offset += (FLAC__STREAM_METADATA_HEADER_LENGTH + node->data->length); + } + } + + if(preserve_file_stats) + set_file_stats_(chain->filename, &stats); + + return true; +} + +FLAC_API FLAC__bool FLAC__metadata_chain_write_with_callbacks(FLAC__Metadata_Chain *chain, FLAC__bool use_padding, FLAC__IOHandle handle, FLAC__IOCallbacks callbacks) +{ + unsigned current_length; + + FLAC__ASSERT(0 != chain); + + if (0 != chain->filename) { + chain->status = FLAC__METADATA_CHAIN_STATUS_READ_WRITE_MISMATCH; + return false; + } + + if (0 == callbacks.write || 0 == callbacks.seek) { + chain->status = FLAC__METADATA_CHAIN_STATUS_INVALID_CALLBACKS; + return false; + } + + if (FLAC__metadata_chain_check_if_tempfile_needed(chain, use_padding)) { + chain->status = FLAC__METADATA_CHAIN_STATUS_WRONG_WRITE_CALL; + return false; + } + + current_length = chain_prepare_for_write_(chain, use_padding); + + /* a return value of 0 means there was an error; chain->status is already set */ + if (0 == current_length) + return false; + + FLAC__ASSERT(current_length == chain->initial_length); + + return chain_rewrite_metadata_in_place_cb_(chain, handle, callbacks.write, callbacks.seek); +} + +FLAC_API FLAC__bool FLAC__metadata_chain_write_with_callbacks_and_tempfile(FLAC__Metadata_Chain *chain, FLAC__bool use_padding, FLAC__IOHandle handle, FLAC__IOCallbacks callbacks, FLAC__IOHandle temp_handle, FLAC__IOCallbacks temp_callbacks) +{ + unsigned current_length; + + FLAC__ASSERT(0 != chain); + + if (0 != chain->filename) { + chain->status = FLAC__METADATA_CHAIN_STATUS_READ_WRITE_MISMATCH; + return false; + } + + if (0 == callbacks.read || 0 == callbacks.seek || 0 == callbacks.eof) { + chain->status = FLAC__METADATA_CHAIN_STATUS_INVALID_CALLBACKS; + return false; + } + if (0 == temp_callbacks.write) { + chain->status = FLAC__METADATA_CHAIN_STATUS_INVALID_CALLBACKS; + return false; + } + + if (!FLAC__metadata_chain_check_if_tempfile_needed(chain, use_padding)) { + chain->status = FLAC__METADATA_CHAIN_STATUS_WRONG_WRITE_CALL; + return false; + } + + current_length = chain_prepare_for_write_(chain, use_padding); + + /* a return value of 0 means there was an error; chain->status is already set */ + if (0 == current_length) + return false; + + FLAC__ASSERT(current_length != chain->initial_length); + + /* rewind */ + if(0 != callbacks.seek(handle, 0, SEEK_SET)) { + chain->status = FLAC__METADATA_CHAIN_STATUS_SEEK_ERROR; + return false; + } + + if(!chain_rewrite_file_cb_(chain, handle, callbacks.read, callbacks.seek, callbacks.eof, temp_handle, temp_callbacks.write)) + return false; + + /* recompute lengths and offsets */ + { + const FLAC__Metadata_Node *node; + chain->initial_length = current_length; + chain->last_offset = chain->first_offset; + for(node = chain->head; node; node = node->next) + chain->last_offset += (FLAC__STREAM_METADATA_HEADER_LENGTH + node->data->length); + } + + return true; +} + +FLAC_API void FLAC__metadata_chain_merge_padding(FLAC__Metadata_Chain *chain) +{ + FLAC__Metadata_Node *node; + + FLAC__ASSERT(0 != chain); + + for(node = chain->head; node; ) { + if(!chain_merge_adjacent_padding_(chain, node)) + node = node->next; + } +} + +FLAC_API void FLAC__metadata_chain_sort_padding(FLAC__Metadata_Chain *chain) +{ + FLAC__Metadata_Node *node, *save; + unsigned i; + + FLAC__ASSERT(0 != chain); + + /* + * Don't try and be too smart... this simple algo is good enough for + * the small number of nodes that we deal with. + */ + for(i = 0, node = chain->head; i < chain->nodes; i++) { + if(node->data->type == FLAC__METADATA_TYPE_PADDING) { + save = node->next; + chain_remove_node_(chain, node); + chain_append_node_(chain, node); + node = save; + } + else { + node = node->next; + } + } + + FLAC__metadata_chain_merge_padding(chain); +} + + +FLAC_API FLAC__Metadata_Iterator *FLAC__metadata_iterator_new() +{ + FLAC__Metadata_Iterator *iterator = (FLAC__Metadata_Iterator*)calloc(1, sizeof(FLAC__Metadata_Iterator)); + + /* calloc() implies: + iterator->current = 0; + iterator->chain = 0; + */ + + return iterator; +} + +FLAC_API void FLAC__metadata_iterator_delete(FLAC__Metadata_Iterator *iterator) +{ + FLAC__ASSERT(0 != iterator); + + free(iterator); +} + +FLAC_API void FLAC__metadata_iterator_init(FLAC__Metadata_Iterator *iterator, FLAC__Metadata_Chain *chain) +{ + FLAC__ASSERT(0 != iterator); + FLAC__ASSERT(0 != chain); + FLAC__ASSERT(0 != chain->head); + + iterator->chain = chain; + iterator->current = chain->head; +} + +FLAC_API FLAC__bool FLAC__metadata_iterator_next(FLAC__Metadata_Iterator *iterator) +{ + FLAC__ASSERT(0 != iterator); + + if(0 == iterator->current || 0 == iterator->current->next) + return false; + + iterator->current = iterator->current->next; + return true; +} + +FLAC_API FLAC__bool FLAC__metadata_iterator_prev(FLAC__Metadata_Iterator *iterator) +{ + FLAC__ASSERT(0 != iterator); + + if(0 == iterator->current || 0 == iterator->current->prev) + return false; + + iterator->current = iterator->current->prev; + return true; +} + +FLAC_API FLAC__MetadataType FLAC__metadata_iterator_get_block_type(const FLAC__Metadata_Iterator *iterator) +{ + FLAC__ASSERT(0 != iterator); + FLAC__ASSERT(0 != iterator->current); + FLAC__ASSERT(0 != iterator->current->data); + + return iterator->current->data->type; +} + +FLAC_API FLAC__StreamMetadata *FLAC__metadata_iterator_get_block(FLAC__Metadata_Iterator *iterator) +{ + FLAC__ASSERT(0 != iterator); + FLAC__ASSERT(0 != iterator->current); + + return iterator->current->data; +} + +FLAC_API FLAC__bool FLAC__metadata_iterator_set_block(FLAC__Metadata_Iterator *iterator, FLAC__StreamMetadata *block) +{ + FLAC__ASSERT(0 != iterator); + FLAC__ASSERT(0 != block); + return FLAC__metadata_iterator_delete_block(iterator, false) && FLAC__metadata_iterator_insert_block_after(iterator, block); +} + +FLAC_API FLAC__bool FLAC__metadata_iterator_delete_block(FLAC__Metadata_Iterator *iterator, FLAC__bool replace_with_padding) +{ + FLAC__Metadata_Node *save; + + FLAC__ASSERT(0 != iterator); + FLAC__ASSERT(0 != iterator->current); + + if(0 == iterator->current->prev) { + FLAC__ASSERT(iterator->current->data->type == FLAC__METADATA_TYPE_STREAMINFO); + return false; + } + + save = iterator->current->prev; + + if(replace_with_padding) { + FLAC__metadata_object_delete_data(iterator->current->data); + iterator->current->data->type = FLAC__METADATA_TYPE_PADDING; + } + else { + chain_delete_node_(iterator->chain, iterator->current); + } + + iterator->current = save; + return true; +} + +FLAC_API FLAC__bool FLAC__metadata_iterator_insert_block_before(FLAC__Metadata_Iterator *iterator, FLAC__StreamMetadata *block) +{ + FLAC__Metadata_Node *node; + + FLAC__ASSERT(0 != iterator); + FLAC__ASSERT(0 != iterator->current); + FLAC__ASSERT(0 != block); + + if(block->type == FLAC__METADATA_TYPE_STREAMINFO) + return false; + + if(0 == iterator->current->prev) { + FLAC__ASSERT(iterator->current->data->type == FLAC__METADATA_TYPE_STREAMINFO); + return false; + } + + if(0 == (node = node_new_())) + return false; + + node->data = block; + iterator_insert_node_(iterator, node); + iterator->current = node; + return true; +} + +FLAC_API FLAC__bool FLAC__metadata_iterator_insert_block_after(FLAC__Metadata_Iterator *iterator, FLAC__StreamMetadata *block) +{ + FLAC__Metadata_Node *node; + + FLAC__ASSERT(0 != iterator); + FLAC__ASSERT(0 != iterator->current); + FLAC__ASSERT(0 != block); + + if(block->type == FLAC__METADATA_TYPE_STREAMINFO) + return false; + + if(0 == (node = node_new_())) + return false; + + node->data = block; + iterator_insert_node_after_(iterator, node); + iterator->current = node; + return true; +} + + +/**************************************************************************** + * + * Local function definitions + * + ***************************************************************************/ + +void pack_uint32_(FLAC__uint32 val, FLAC__byte *b, unsigned bytes) +{ + unsigned i; + + b += bytes; + + for(i = 0; i < bytes; i++) { + *(--b) = (FLAC__byte)(val & 0xff); + val >>= 8; + } +} + +void pack_uint32_little_endian_(FLAC__uint32 val, FLAC__byte *b, unsigned bytes) +{ + unsigned i; + + for(i = 0; i < bytes; i++) { + *(b++) = (FLAC__byte)(val & 0xff); + val >>= 8; + } +} + +void pack_uint64_(FLAC__uint64 val, FLAC__byte *b, unsigned bytes) +{ + unsigned i; + + b += bytes; + + for(i = 0; i < bytes; i++) { + *(--b) = (FLAC__byte)(val & 0xff); + val >>= 8; + } +} + +FLAC__uint32 unpack_uint32_(FLAC__byte *b, unsigned bytes) +{ + FLAC__uint32 ret = 0; + unsigned i; + + for(i = 0; i < bytes; i++) + ret = (ret << 8) | (FLAC__uint32)(*b++); + + return ret; +} + +FLAC__uint32 unpack_uint32_little_endian_(FLAC__byte *b, unsigned bytes) +{ + FLAC__uint32 ret = 0; + unsigned i; + + b += bytes; + + for(i = 0; i < bytes; i++) + ret = (ret << 8) | (FLAC__uint32)(*--b); + + return ret; +} + +FLAC__uint64 unpack_uint64_(FLAC__byte *b, unsigned bytes) +{ + FLAC__uint64 ret = 0; + unsigned i; + + for(i = 0; i < bytes; i++) + ret = (ret << 8) | (FLAC__uint64)(*b++); + + return ret; +} + +FLAC__bool read_metadata_block_header_(FLAC__Metadata_SimpleIterator *iterator) +{ + FLAC__ASSERT(0 != iterator); + FLAC__ASSERT(0 != iterator->file); + + if(!read_metadata_block_header_cb_((FLAC__IOHandle)iterator->file, (FLAC__IOCallback_Read)fread, &iterator->is_last, &iterator->type, &iterator->length)) { + iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR; + return false; + } + + return true; +} + +FLAC__bool read_metadata_block_data_(FLAC__Metadata_SimpleIterator *iterator, FLAC__StreamMetadata *block) +{ + FLAC__ASSERT(0 != iterator); + FLAC__ASSERT(0 != iterator->file); + + iterator->status = read_metadata_block_data_cb_((FLAC__IOHandle)iterator->file, (FLAC__IOCallback_Read)fread, fseek_wrapper_, block); + + return (iterator->status == FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK); +} + +FLAC__bool read_metadata_block_header_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__bool *is_last, FLAC__MetadataType *type, unsigned *length) +{ + FLAC__byte raw_header[FLAC__STREAM_METADATA_HEADER_LENGTH]; + + if(read_cb(raw_header, 1, FLAC__STREAM_METADATA_HEADER_LENGTH, handle) != FLAC__STREAM_METADATA_HEADER_LENGTH) + return false; + + *is_last = raw_header[0] & 0x80? true : false; + *type = (FLAC__MetadataType)(raw_header[0] & 0x7f); + *length = unpack_uint32_(raw_header + 1, 3); + + /* Note that we don't check: + * if(iterator->type >= FLAC__METADATA_TYPE_UNDEFINED) + * we just will read in an opaque block + */ + + return true; +} + +FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__IOCallback_Seek seek_cb, FLAC__StreamMetadata *block) +{ + switch(block->type) { + case FLAC__METADATA_TYPE_STREAMINFO: + return read_metadata_block_data_streaminfo_cb_(handle, read_cb, &block->data.stream_info); + case FLAC__METADATA_TYPE_PADDING: + return read_metadata_block_data_padding_cb_(handle, seek_cb, &block->data.padding, block->length); + case FLAC__METADATA_TYPE_APPLICATION: + return read_metadata_block_data_application_cb_(handle, read_cb, &block->data.application, block->length); + case FLAC__METADATA_TYPE_SEEKTABLE: + return read_metadata_block_data_seektable_cb_(handle, read_cb, &block->data.seek_table, block->length); + case FLAC__METADATA_TYPE_VORBIS_COMMENT: + return read_metadata_block_data_vorbis_comment_cb_(handle, read_cb, &block->data.vorbis_comment); + case FLAC__METADATA_TYPE_CUESHEET: + return read_metadata_block_data_cuesheet_cb_(handle, read_cb, &block->data.cue_sheet); + default: + return read_metadata_block_data_unknown_cb_(handle, read_cb, &block->data.unknown, block->length); + } +} + +FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_streaminfo_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_StreamInfo *block) +{ + FLAC__byte buffer[FLAC__STREAM_METADATA_STREAMINFO_LENGTH], *b; + + if(read_cb(buffer, 1, FLAC__STREAM_METADATA_STREAMINFO_LENGTH, handle) != FLAC__STREAM_METADATA_STREAMINFO_LENGTH) + return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR; + + b = buffer; + + /* we are using hardcoded numbers for simplicity but we should + * probably eventually write a bit-level unpacker and use the + * _STREAMINFO_ constants. + */ + block->min_blocksize = unpack_uint32_(b, 2); b += 2; + block->max_blocksize = unpack_uint32_(b, 2); b += 2; + block->min_framesize = unpack_uint32_(b, 3); b += 3; + block->max_framesize = unpack_uint32_(b, 3); b += 3; + block->sample_rate = (unpack_uint32_(b, 2) << 4) | ((unsigned)(b[2] & 0xf0) >> 4); + block->channels = (unsigned)((b[2] & 0x0e) >> 1) + 1; + block->bits_per_sample = ((((unsigned)(b[2] & 0x01)) << 4) | (((unsigned)(b[3] & 0xf0)) >> 4)) + 1; + block->total_samples = (((FLAC__uint64)(b[3] & 0x0f)) << 32) | unpack_uint64_(b+4, 4); + memcpy(block->md5sum, b+8, 16); + + return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK; +} + + +FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_padding_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Seek seek_cb, FLAC__StreamMetadata_Padding *block, unsigned block_length) +{ + (void)block; /* nothing to do; we don't care about reading the padding bytes */ + + if(0 != seek_cb(handle, block_length, SEEK_CUR)) + return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR; + + return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK; +} + +FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_application_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_Application *block, unsigned block_length) +{ + const unsigned id_bytes = FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8; + + if(read_cb(block->id, 1, id_bytes, handle) != id_bytes) + return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR; + + block_length -= id_bytes; + + if(block_length == 0) { + block->data = 0; + } + else { + if(0 == (block->data = (FLAC__byte*)malloc(block_length))) + return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR; + + if(read_cb(block->data, 1, block_length, handle) != block_length) + return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR; + } + + return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK; +} + +FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_seektable_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_SeekTable *block, unsigned block_length) +{ + unsigned i; + FLAC__byte buffer[FLAC__STREAM_METADATA_SEEKPOINT_LENGTH]; + + FLAC__ASSERT(block_length % FLAC__STREAM_METADATA_SEEKPOINT_LENGTH == 0); + + block->num_points = block_length / FLAC__STREAM_METADATA_SEEKPOINT_LENGTH; + + if(block->num_points == 0) + block->points = 0; + else if(0 == (block->points = (FLAC__StreamMetadata_SeekPoint*)malloc(block->num_points * sizeof(FLAC__StreamMetadata_SeekPoint)))) + return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR; + + for(i = 0; i < block->num_points; i++) { + if(read_cb(buffer, 1, FLAC__STREAM_METADATA_SEEKPOINT_LENGTH, handle) != FLAC__STREAM_METADATA_SEEKPOINT_LENGTH) + return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR; + /* some MAGIC NUMBERs here */ + block->points[i].sample_number = unpack_uint64_(buffer, 8); + block->points[i].stream_offset = unpack_uint64_(buffer+8, 8); + block->points[i].frame_samples = unpack_uint32_(buffer+16, 2); + } + + return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK; +} + +FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_vorbis_comment_entry_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_VorbisComment_Entry *entry) +{ + const unsigned entry_length_len = FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN / 8; + FLAC__byte buffer[4]; /* magic number is asserted below */ + + FLAC__ASSERT(FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN / 8 == 4); + + if(read_cb(buffer, 1, entry_length_len, handle) != entry_length_len) + return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR; + entry->length = unpack_uint32_little_endian_(buffer, entry_length_len); + + if(0 != entry->entry) + free(entry->entry); + + if(entry->length == 0) { + entry->entry = 0; + } + else { + if(0 == (entry->entry = (FLAC__byte*)malloc(entry->length+1))) + return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR; + + if(read_cb(entry->entry, 1, entry->length, handle) != entry->length) + return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR; + + entry->entry[entry->length] = '\0'; + } + + return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK; +} + +FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_vorbis_comment_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_VorbisComment *block) +{ + unsigned i; + FLAC__Metadata_SimpleIteratorStatus status; + const unsigned num_comments_len = FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN / 8; + FLAC__byte buffer[4]; /* magic number is asserted below */ + + FLAC__ASSERT(FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN / 8 == 4); + + if(FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK != (status = read_metadata_block_data_vorbis_comment_entry_cb_(handle, read_cb, &(block->vendor_string)))) + return status; + + if(read_cb(buffer, 1, num_comments_len, handle) != num_comments_len) + return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR; + block->num_comments = unpack_uint32_little_endian_(buffer, num_comments_len); + + if(block->num_comments == 0) { + block->comments = 0; + } + else if(0 == (block->comments = (FLAC__StreamMetadata_VorbisComment_Entry*)calloc(block->num_comments, sizeof(FLAC__StreamMetadata_VorbisComment_Entry)))) + return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR; + + for(i = 0; i < block->num_comments; i++) { + if(FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK != (status = read_metadata_block_data_vorbis_comment_entry_cb_(handle, read_cb, block->comments + i))) + return status; + } + + return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK; +} + +FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_cuesheet_track_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_CueSheet_Track *track) +{ + unsigned i, len; + FLAC__byte buffer[32]; /* asserted below that this is big enough */ + + FLAC__ASSERT(sizeof(buffer) >= sizeof(FLAC__uint64)); + FLAC__ASSERT(sizeof(buffer) >= FLAC__STREAM_METADATA_CUESHEET_INDEX_RESERVED_LEN/8); + FLAC__ASSERT(sizeof(buffer) >= (FLAC__STREAM_METADATA_CUESHEET_TRACK_TYPE_LEN + FLAC__STREAM_METADATA_CUESHEET_TRACK_PRE_EMPHASIS_LEN + FLAC__STREAM_METADATA_CUESHEET_TRACK_RESERVED_LEN) / 8); + + FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_TRACK_OFFSET_LEN % 8 == 0); + len = FLAC__STREAM_METADATA_CUESHEET_TRACK_OFFSET_LEN / 8; + if(read_cb(buffer, 1, len, handle) != len) + return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR; + track->offset = unpack_uint64_(buffer, len); + + FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_TRACK_NUMBER_LEN % 8 == 0); + len = FLAC__STREAM_METADATA_CUESHEET_TRACK_NUMBER_LEN / 8; + if(read_cb(buffer, 1, len, handle) != len) + return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR; + track->number = (FLAC__byte)unpack_uint32_(buffer, len); + + FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_TRACK_ISRC_LEN % 8 == 0); + len = FLAC__STREAM_METADATA_CUESHEET_TRACK_ISRC_LEN / 8; + if(read_cb(track->isrc, 1, len, handle) != len) + return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR; + + FLAC__ASSERT((FLAC__STREAM_METADATA_CUESHEET_TRACK_TYPE_LEN + FLAC__STREAM_METADATA_CUESHEET_TRACK_PRE_EMPHASIS_LEN + FLAC__STREAM_METADATA_CUESHEET_TRACK_RESERVED_LEN) % 8 == 0); + len = (FLAC__STREAM_METADATA_CUESHEET_TRACK_TYPE_LEN + FLAC__STREAM_METADATA_CUESHEET_TRACK_PRE_EMPHASIS_LEN + FLAC__STREAM_METADATA_CUESHEET_TRACK_RESERVED_LEN) / 8; + if(read_cb(buffer, 1, len, handle) != len) + return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR; + FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_TRACK_TYPE_LEN == 1); + FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_TRACK_PRE_EMPHASIS_LEN == 1); + track->type = buffer[0] >> 7; + track->pre_emphasis = (buffer[0] >> 6) & 1; + + FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_TRACK_NUM_INDICES_LEN % 8 == 0); + len = FLAC__STREAM_METADATA_CUESHEET_TRACK_NUM_INDICES_LEN / 8; + if(read_cb(buffer, 1, len, handle) != len) + return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR; + track->num_indices = (FLAC__byte)unpack_uint32_(buffer, len); + + if(track->num_indices == 0) { + track->indices = 0; + } + else if(0 == (track->indices = (FLAC__StreamMetadata_CueSheet_Index*)calloc(track->num_indices, sizeof(FLAC__StreamMetadata_CueSheet_Index)))) + return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR; + + for(i = 0; i < track->num_indices; i++) { + FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_INDEX_OFFSET_LEN % 8 == 0); + len = FLAC__STREAM_METADATA_CUESHEET_INDEX_OFFSET_LEN / 8; + if(read_cb(buffer, 1, len, handle) != len) + return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR; + track->indices[i].offset = unpack_uint64_(buffer, len); + + FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_INDEX_NUMBER_LEN % 8 == 0); + len = FLAC__STREAM_METADATA_CUESHEET_INDEX_NUMBER_LEN / 8; + if(read_cb(buffer, 1, len, handle) != len) + return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR; + track->indices[i].number = (FLAC__byte)unpack_uint32_(buffer, len); + + FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_INDEX_RESERVED_LEN % 8 == 0); + len = FLAC__STREAM_METADATA_CUESHEET_INDEX_RESERVED_LEN / 8; + if(read_cb(buffer, 1, len, handle) != len) + return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR; + } + + return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK; +} + +FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_cuesheet_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_CueSheet *block) +{ + unsigned i, len; + FLAC__Metadata_SimpleIteratorStatus status; + FLAC__byte buffer[1024]; /* MSVC needs a constant expression so we put a magic number and assert */ + + FLAC__ASSERT((FLAC__STREAM_METADATA_CUESHEET_IS_CD_LEN + FLAC__STREAM_METADATA_CUESHEET_RESERVED_LEN)/8 <= sizeof(buffer)); + FLAC__ASSERT(sizeof(FLAC__uint64) <= sizeof(buffer)); + + FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_MEDIA_CATALOG_NUMBER_LEN % 8 == 0); + len = FLAC__STREAM_METADATA_CUESHEET_MEDIA_CATALOG_NUMBER_LEN / 8; + if(read_cb(block->media_catalog_number, 1, len, handle) != len) + return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR; + + FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_LEAD_IN_LEN % 8 == 0); + len = FLAC__STREAM_METADATA_CUESHEET_LEAD_IN_LEN / 8; + if(read_cb(buffer, 1, len, handle) != len) + return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR; + block->lead_in = unpack_uint64_(buffer, len); + + FLAC__ASSERT((FLAC__STREAM_METADATA_CUESHEET_IS_CD_LEN + FLAC__STREAM_METADATA_CUESHEET_RESERVED_LEN) % 8 == 0); + len = (FLAC__STREAM_METADATA_CUESHEET_IS_CD_LEN + FLAC__STREAM_METADATA_CUESHEET_RESERVED_LEN) / 8; + if(read_cb(buffer, 1, len, handle) != len) + return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR; + block->is_cd = buffer[0]&0x80? true : false; + + FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_NUM_TRACKS_LEN % 8 == 0); + len = FLAC__STREAM_METADATA_CUESHEET_NUM_TRACKS_LEN / 8; + if(read_cb(buffer, 1, len, handle) != len) + return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR; + block->num_tracks = unpack_uint32_(buffer, len); + + if(block->num_tracks == 0) { + block->tracks = 0; + } + else if(0 == (block->tracks = (FLAC__StreamMetadata_CueSheet_Track*)calloc(block->num_tracks, sizeof(FLAC__StreamMetadata_CueSheet_Track)))) + return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR; + + for(i = 0; i < block->num_tracks; i++) { + if(FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK != (status = read_metadata_block_data_cuesheet_track_cb_(handle, read_cb, block->tracks + i))) + return status; + } + + return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK; +} + +FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_unknown_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_Unknown *block, unsigned block_length) +{ + if(block_length == 0) { + block->data = 0; + } + else { + if(0 == (block->data = (FLAC__byte*)malloc(block_length))) + return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR; + + if(read_cb(block->data, 1, block_length, handle) != block_length) + return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR; + } + + return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK; +} + +FLAC__bool write_metadata_block_header_(FILE *file, FLAC__Metadata_SimpleIteratorStatus *status, const FLAC__StreamMetadata *block) +{ + FLAC__ASSERT(0 != file); + FLAC__ASSERT(0 != status); + + if(!write_metadata_block_header_cb_((FLAC__IOHandle)file, (FLAC__IOCallback_Write)fwrite, block)) { + *status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_WRITE_ERROR; + return false; + } + + return true; +} + +FLAC__bool write_metadata_block_data_(FILE *file, FLAC__Metadata_SimpleIteratorStatus *status, const FLAC__StreamMetadata *block) +{ + FLAC__ASSERT(0 != file); + FLAC__ASSERT(0 != status); + + if (write_metadata_block_data_cb_((FLAC__IOHandle)file, (FLAC__IOCallback_Write)fwrite, block)) { + *status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK; + return true; + } + else { + *status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_WRITE_ERROR; + return false; + } +} + +FLAC__bool write_metadata_block_header_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata *block) +{ + FLAC__byte buffer[FLAC__STREAM_METADATA_HEADER_LENGTH]; + + FLAC__ASSERT(block->length < (1u << FLAC__STREAM_METADATA_LENGTH_LEN)); + + buffer[0] = (block->is_last? 0x80 : 0) | (FLAC__byte)block->type; + pack_uint32_(block->length, buffer + 1, 3); + + if(write_cb(buffer, 1, FLAC__STREAM_METADATA_HEADER_LENGTH, handle) != FLAC__STREAM_METADATA_HEADER_LENGTH) + return false; + + return true; +} + +FLAC__bool write_metadata_block_data_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata *block) +{ + FLAC__ASSERT(0 != block); + + switch(block->type) { + case FLAC__METADATA_TYPE_STREAMINFO: + return write_metadata_block_data_streaminfo_cb_(handle, write_cb, &block->data.stream_info); + case FLAC__METADATA_TYPE_PADDING: + return write_metadata_block_data_padding_cb_(handle, write_cb, &block->data.padding, block->length); + case FLAC__METADATA_TYPE_APPLICATION: + return write_metadata_block_data_application_cb_(handle, write_cb, &block->data.application, block->length); + case FLAC__METADATA_TYPE_SEEKTABLE: + return write_metadata_block_data_seektable_cb_(handle, write_cb, &block->data.seek_table); + case FLAC__METADATA_TYPE_VORBIS_COMMENT: + return write_metadata_block_data_vorbis_comment_cb_(handle, write_cb, &block->data.vorbis_comment); + case FLAC__METADATA_TYPE_CUESHEET: + return write_metadata_block_data_cuesheet_cb_(handle, write_cb, &block->data.cue_sheet); + default: + return write_metadata_block_data_unknown_cb_(handle, write_cb, &block->data.unknown, block->length); + } +} + +FLAC__bool write_metadata_block_data_streaminfo_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_StreamInfo *block) +{ + FLAC__byte buffer[FLAC__STREAM_METADATA_STREAMINFO_LENGTH]; + const unsigned channels1 = block->channels - 1; + const unsigned bps1 = block->bits_per_sample - 1; + + /* we are using hardcoded numbers for simplicity but we should + * probably eventually write a bit-level packer and use the + * _STREAMINFO_ constants. + */ + pack_uint32_(block->min_blocksize, buffer, 2); + pack_uint32_(block->max_blocksize, buffer+2, 2); + pack_uint32_(block->min_framesize, buffer+4, 3); + pack_uint32_(block->max_framesize, buffer+7, 3); + buffer[10] = (block->sample_rate >> 12) & 0xff; + buffer[11] = (block->sample_rate >> 4) & 0xff; + buffer[12] = ((block->sample_rate & 0x0f) << 4) | (channels1 << 1) | (bps1 >> 4); + buffer[13] = (FLAC__byte)(((bps1 & 0x0f) << 4) | ((block->total_samples >> 32) & 0x0f)); + pack_uint32_((FLAC__uint32)block->total_samples, buffer+14, 4); + memcpy(buffer+18, block->md5sum, 16); + + if(write_cb(buffer, 1, FLAC__STREAM_METADATA_STREAMINFO_LENGTH, handle) != FLAC__STREAM_METADATA_STREAMINFO_LENGTH) + return false; + + return true; +} + +FLAC__bool write_metadata_block_data_padding_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_Padding *block, unsigned block_length) +{ + unsigned i, n = block_length; + FLAC__byte buffer[1024]; + + (void)block; + + memset(buffer, 0, 1024); + + for(i = 0; i < n/1024; i++) + if(write_cb(buffer, 1, 1024, handle) != 1024) + return false; + + n %= 1024; + + if(write_cb(buffer, 1, n, handle) != n) + return false; + + return true; +} + +FLAC__bool write_metadata_block_data_application_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_Application *block, unsigned block_length) +{ + const unsigned id_bytes = FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8; + + if(write_cb(block->id, 1, id_bytes, handle) != id_bytes) + return false; + + block_length -= id_bytes; + + if(write_cb(block->data, 1, block_length, handle) != block_length) + return false; + + return true; +} + +FLAC__bool write_metadata_block_data_seektable_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_SeekTable *block) +{ + unsigned i; + FLAC__byte buffer[FLAC__STREAM_METADATA_SEEKPOINT_LENGTH]; + + for(i = 0; i < block->num_points; i++) { + /* some MAGIC NUMBERs here */ + pack_uint64_(block->points[i].sample_number, buffer, 8); + pack_uint64_(block->points[i].stream_offset, buffer+8, 8); + pack_uint32_(block->points[i].frame_samples, buffer+16, 2); + if(write_cb(buffer, 1, FLAC__STREAM_METADATA_SEEKPOINT_LENGTH, handle) != FLAC__STREAM_METADATA_SEEKPOINT_LENGTH) + return false; + } + + return true; +} + +FLAC__bool write_metadata_block_data_vorbis_comment_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_VorbisComment *block) +{ + unsigned i; + const unsigned entry_length_len = FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN / 8; + const unsigned num_comments_len = FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN / 8; + FLAC__byte buffer[4]; /* magic number is asserted below */ + + FLAC__ASSERT(max(FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN, FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN) / 8 == 4); + + pack_uint32_little_endian_(block->vendor_string.length, buffer, entry_length_len); + if(write_cb(buffer, 1, entry_length_len, handle) != entry_length_len) + return false; + if(write_cb(block->vendor_string.entry, 1, block->vendor_string.length, handle) != block->vendor_string.length) + return false; + + pack_uint32_little_endian_(block->num_comments, buffer, num_comments_len); + if(write_cb(buffer, 1, num_comments_len, handle) != num_comments_len) + return false; + + for(i = 0; i < block->num_comments; i++) { + pack_uint32_little_endian_(block->comments[i].length, buffer, entry_length_len); + if(write_cb(buffer, 1, entry_length_len, handle) != entry_length_len) + return false; + if(write_cb(block->comments[i].entry, 1, block->comments[i].length, handle) != block->comments[i].length) + return false; + } + + return true; +} + +FLAC__bool write_metadata_block_data_cuesheet_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_CueSheet *block) +{ + unsigned i, j, len; + FLAC__byte buffer[1024]; /* asserted below that this is big enough */ + + FLAC__ASSERT(sizeof(buffer) >= sizeof(FLAC__uint64)); + FLAC__ASSERT(sizeof(buffer) >= FLAC__STREAM_METADATA_CUESHEET_RESERVED_LEN/8); + FLAC__ASSERT(sizeof(buffer) >= (FLAC__STREAM_METADATA_CUESHEET_TRACK_TYPE_LEN + FLAC__STREAM_METADATA_CUESHEET_TRACK_PRE_EMPHASIS_LEN + FLAC__STREAM_METADATA_CUESHEET_IS_CD_LEN + FLAC__STREAM_METADATA_CUESHEET_TRACK_RESERVED_LEN)/8); + FLAC__ASSERT(sizeof(buffer) >= FLAC__STREAM_METADATA_CUESHEET_INDEX_RESERVED_LEN/8); + + FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_MEDIA_CATALOG_NUMBER_LEN % 8 == 0); + len = FLAC__STREAM_METADATA_CUESHEET_MEDIA_CATALOG_NUMBER_LEN / 8; + if(write_cb(block->media_catalog_number, 1, len, handle) != len) + return false; + + FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_LEAD_IN_LEN % 8 == 0); + len = FLAC__STREAM_METADATA_CUESHEET_LEAD_IN_LEN / 8; + pack_uint64_(block->lead_in, buffer, len); + if(write_cb(buffer, 1, len, handle) != len) + return false; + + FLAC__ASSERT((FLAC__STREAM_METADATA_CUESHEET_IS_CD_LEN + FLAC__STREAM_METADATA_CUESHEET_RESERVED_LEN) % 8 == 0); + len = (FLAC__STREAM_METADATA_CUESHEET_IS_CD_LEN + FLAC__STREAM_METADATA_CUESHEET_RESERVED_LEN) / 8; + memset(buffer, 0, len); + if(block->is_cd) + buffer[0] |= 0x80; + if(write_cb(buffer, 1, len, handle) != len) + return false; + + FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_NUM_TRACKS_LEN % 8 == 0); + len = FLAC__STREAM_METADATA_CUESHEET_NUM_TRACKS_LEN / 8; + pack_uint32_(block->num_tracks, buffer, len); + if(write_cb(buffer, 1, len, handle) != len) + return false; + + for(i = 0; i < block->num_tracks; i++) { + FLAC__StreamMetadata_CueSheet_Track *track = block->tracks + i; + + FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_TRACK_OFFSET_LEN % 8 == 0); + len = FLAC__STREAM_METADATA_CUESHEET_TRACK_OFFSET_LEN / 8; + pack_uint64_(track->offset, buffer, len); + if(write_cb(buffer, 1, len, handle) != len) + return false; + + FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_TRACK_NUMBER_LEN % 8 == 0); + len = FLAC__STREAM_METADATA_CUESHEET_TRACK_NUMBER_LEN / 8; + pack_uint32_(track->number, buffer, len); + if(write_cb(buffer, 1, len, handle) != len) + return false; + + FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_TRACK_ISRC_LEN % 8 == 0); + len = FLAC__STREAM_METADATA_CUESHEET_TRACK_ISRC_LEN / 8; + if(write_cb(track->isrc, 1, len, handle) != len) + return false; + + FLAC__ASSERT((FLAC__STREAM_METADATA_CUESHEET_TRACK_TYPE_LEN + FLAC__STREAM_METADATA_CUESHEET_TRACK_PRE_EMPHASIS_LEN + FLAC__STREAM_METADATA_CUESHEET_TRACK_RESERVED_LEN) % 8 == 0); + len = (FLAC__STREAM_METADATA_CUESHEET_TRACK_TYPE_LEN + FLAC__STREAM_METADATA_CUESHEET_TRACK_PRE_EMPHASIS_LEN + FLAC__STREAM_METADATA_CUESHEET_TRACK_RESERVED_LEN) / 8; + memset(buffer, 0, len); + buffer[0] = (track->type << 7) | (track->pre_emphasis << 6); + if(write_cb(buffer, 1, len, handle) != len) + return false; + + FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_TRACK_NUM_INDICES_LEN % 8 == 0); + len = FLAC__STREAM_METADATA_CUESHEET_TRACK_NUM_INDICES_LEN / 8; + pack_uint32_(track->num_indices, buffer, len); + if(write_cb(buffer, 1, len, handle) != len) + return false; + + for(j = 0; j < track->num_indices; j++) { + FLAC__StreamMetadata_CueSheet_Index *index = track->indices + j; + + FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_INDEX_OFFSET_LEN % 8 == 0); + len = FLAC__STREAM_METADATA_CUESHEET_INDEX_OFFSET_LEN / 8; + pack_uint64_(index->offset, buffer, len); + if(write_cb(buffer, 1, len, handle) != len) + return false; + + FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_INDEX_NUMBER_LEN % 8 == 0); + len = FLAC__STREAM_METADATA_CUESHEET_INDEX_NUMBER_LEN / 8; + pack_uint32_(index->number, buffer, len); + if(write_cb(buffer, 1, len, handle) != len) + return false; + + FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_INDEX_RESERVED_LEN % 8 == 0); + len = FLAC__STREAM_METADATA_CUESHEET_INDEX_RESERVED_LEN / 8; + memset(buffer, 0, len); + if(write_cb(buffer, 1, len, handle) != len) + return false; + } + } + + return true; +} + +FLAC__bool write_metadata_block_data_unknown_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_Unknown *block, unsigned block_length) +{ + if(write_cb(block->data, 1, block_length, handle) != block_length) + return false; + + return true; +} + +FLAC__bool write_metadata_block_stationary_(FLAC__Metadata_SimpleIterator *iterator, const FLAC__StreamMetadata *block) +{ + if(0 != fseek(iterator->file, iterator->offset[iterator->depth], SEEK_SET)) { + iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR; + return false; + } + + if(!write_metadata_block_header_(iterator->file, &iterator->status, block)) + return false; + + if(!write_metadata_block_data_(iterator->file, &iterator->status, block)) + return false; + + if(0 != fseek(iterator->file, iterator->offset[iterator->depth], SEEK_SET)) { + iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR; + return false; + } + + return read_metadata_block_header_(iterator); +} + +FLAC__bool write_metadata_block_stationary_with_padding_(FLAC__Metadata_SimpleIterator *iterator, FLAC__StreamMetadata *block, unsigned padding_length, FLAC__bool padding_is_last) +{ + FLAC__StreamMetadata *padding; + + if(0 != fseek(iterator->file, iterator->offset[iterator->depth], SEEK_SET)) { + iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR; + return false; + } + + block->is_last = false; + + if(!write_metadata_block_header_(iterator->file, &iterator->status, block)) + return false; + + if(!write_metadata_block_data_(iterator->file, &iterator->status, block)) + return false; + + if(0 == (padding = FLAC__metadata_object_new(FLAC__METADATA_TYPE_PADDING))) + return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR; + + padding->is_last = padding_is_last; + padding->length = padding_length; + + if(!write_metadata_block_header_(iterator->file, &iterator->status, padding)) { + FLAC__metadata_object_delete(padding); + return false; + } + + if(!write_metadata_block_data_(iterator->file, &iterator->status, padding)) { + FLAC__metadata_object_delete(padding); + return false; + } + + FLAC__metadata_object_delete(padding); + + if(0 != fseek(iterator->file, iterator->offset[iterator->depth], SEEK_SET)) { + iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR; + return false; + } + + return read_metadata_block_header_(iterator); +} + +FLAC__bool rewrite_whole_file_(FLAC__Metadata_SimpleIterator *iterator, FLAC__StreamMetadata *block, FLAC__bool append) +{ + FILE *tempfile; + char *tempfilename; + int fixup_is_last_code = 0; /* 0 => no need to change any is_last flags */ + long fixup_is_last_flag_offset = -1; + + FLAC__ASSERT(0 != block || append == false); + + if(iterator->is_last) { + if(append) { + fixup_is_last_code = 1; /* 1 => clear the is_last flag at the following offset */ + fixup_is_last_flag_offset = iterator->offset[iterator->depth]; + } + else if(0 == block) { + simple_iterator_push_(iterator); + if(!FLAC__metadata_simple_iterator_prev(iterator)) { + (void)simple_iterator_pop_(iterator); + return false; + } + fixup_is_last_code = -1; /* -1 => set the is_last the flag at the following offset */ + fixup_is_last_flag_offset = iterator->offset[iterator->depth]; + if(!simple_iterator_pop_(iterator)) + return false; + } + } + + if(!simple_iterator_copy_file_prefix_(iterator, &tempfile, &tempfilename, append)) + return false; + + if(0 != block) { + if(!write_metadata_block_header_(tempfile, &iterator->status, block)) { + cleanup_tempfile_(&tempfile, &tempfilename); + return false; + } + + if(!write_metadata_block_data_(tempfile, &iterator->status, block)) { + cleanup_tempfile_(&tempfile, &tempfilename); + return false; + } + } + + if(!simple_iterator_copy_file_postfix_(iterator, &tempfile, &tempfilename, fixup_is_last_code, fixup_is_last_flag_offset, block==0)) + return false; + + if(append) + return FLAC__metadata_simple_iterator_next(iterator); + + return true; +} + +void simple_iterator_push_(FLAC__Metadata_SimpleIterator *iterator) +{ + FLAC__ASSERT(iterator->depth+1 < SIMPLE_ITERATOR_MAX_PUSH_DEPTH); + iterator->offset[iterator->depth+1] = iterator->offset[iterator->depth]; + iterator->depth++; +} + +FLAC__bool simple_iterator_pop_(FLAC__Metadata_SimpleIterator *iterator) +{ + FLAC__ASSERT(iterator->depth > 0); + iterator->depth--; + if(0 != fseek(iterator->file, iterator->offset[iterator->depth], SEEK_SET)) { + iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR; + return false; + } + + return read_metadata_block_header_(iterator); +} + +/* return meanings: + * 0: ok + * 1: read error + * 2: seek error + * 3: not a FLAC file + */ +unsigned seek_to_first_metadata_block_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__IOCallback_Seek seek_cb) +{ + FLAC__byte buffer[4]; + size_t n; + unsigned i; + + FLAC__ASSERT(FLAC__STREAM_SYNC_LENGTH == 4); + + /* skip any id3v2 tag */ + errno = 0; + n = read_cb(buffer, 1, 4, handle); + if(errno) + return 1; + else if(n != 4) + return 3; + else if(0 == memcmp(buffer, "ID3", 3)) { + unsigned tag_length = 0; + + /* skip to the tag length */ + if(seek_cb(handle, 2, SEEK_CUR) < 0) + return 2; + + /* read the length */ + for(i = 0; i < 4; i++) { + if(read_cb(buffer, 1, 1, handle) < 1 || buffer[0] & 0x80) + return 1; + tag_length <<= 7; + tag_length |= (buffer[0] & 0x7f); + } + + /* skip the rest of the tag */ + if(seek_cb(handle, tag_length, SEEK_CUR) < 0) + return 2; + + /* read the stream sync code */ + errno = 0; + n = read_cb(buffer, 1, 4, handle); + if(errno) + return 1; + else if(n != 4) + return 3; + } + + /* check for the fLaC signature */ + if(0 == memcmp(FLAC__STREAM_SYNC_STRING, buffer, FLAC__STREAM_SYNC_LENGTH)) + return 0; + else + return 3; +} + +unsigned seek_to_first_metadata_block_(FILE *f) +{ + return seek_to_first_metadata_block_cb_((FLAC__IOHandle)f, (FLAC__IOCallback_Read)fread, fseek_wrapper_); +} + +FLAC__bool simple_iterator_copy_file_prefix_(FLAC__Metadata_SimpleIterator *iterator, FILE **tempfile, char **tempfilename, FLAC__bool append) +{ + const long offset_end = append? iterator->offset[iterator->depth] + (long)FLAC__STREAM_METADATA_HEADER_LENGTH + (long)iterator->length : iterator->offset[iterator->depth]; + + if(0 != fseek(iterator->file, 0, SEEK_SET)) { + iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR; + return false; + } + if(!open_tempfile_(iterator->filename, iterator->tempfile_path_prefix, tempfile, tempfilename, &iterator->status)) { + cleanup_tempfile_(tempfile, tempfilename); + return false; + } + if(!copy_n_bytes_from_file_(iterator->file, *tempfile, offset_end, &iterator->status)) { + cleanup_tempfile_(tempfile, tempfilename); + return false; + } + + return true; +} + +FLAC__bool simple_iterator_copy_file_postfix_(FLAC__Metadata_SimpleIterator *iterator, FILE **tempfile, char **tempfilename, int fixup_is_last_code, long fixup_is_last_flag_offset, FLAC__bool backup) +{ + long save_offset = iterator->offset[iterator->depth]; /*@@@ 2G limit */ + FLAC__ASSERT(0 != *tempfile); + + if(0 != fseek(iterator->file, save_offset + FLAC__STREAM_METADATA_HEADER_LENGTH + iterator->length, SEEK_SET)) { + cleanup_tempfile_(tempfile, tempfilename); + iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR; + return false; + } + if(!copy_remaining_bytes_from_file_(iterator->file, *tempfile, &iterator->status)) { + cleanup_tempfile_(tempfile, tempfilename); + return false; + } + + if(fixup_is_last_code != 0) { + /* + * if code == 1, it means a block was appended to the end so + * we have to clear the is_last flag of the previous block + * if code == -1, it means the last block was deleted so + * we have to set the is_last flag of the previous block + */ + /* MAGIC NUMBERs here; we know the is_last flag is the high bit of the byte at this location */ + FLAC__byte x; + if(0 != fseek(*tempfile, fixup_is_last_flag_offset, SEEK_SET)) { + cleanup_tempfile_(tempfile, tempfilename); + iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR; + return false; + } + if(fread(&x, 1, 1, *tempfile) != 1) { + cleanup_tempfile_(tempfile, tempfilename); + iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR; + return false; + } + if(fixup_is_last_code > 0) { + FLAC__ASSERT(x & 0x80); + x &= 0x7f; + } + else { + FLAC__ASSERT(!(x & 0x80)); + x |= 0x80; + } + if(0 != fseek(*tempfile, fixup_is_last_flag_offset, SEEK_SET)) { + cleanup_tempfile_(tempfile, tempfilename); + iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR; + return false; + } + if(local__fwrite(&x, 1, 1, *tempfile) != 1) { + cleanup_tempfile_(tempfile, tempfilename); + iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_WRITE_ERROR; + return false; + } + } + + (void)fclose(iterator->file); + + if(!transport_tempfile_(iterator->filename, tempfile, tempfilename, &iterator->status)) + return false; + + if(iterator->has_stats) + set_file_stats_(iterator->filename, &iterator->stats); + + if(!simple_iterator_prime_input_(iterator, !iterator->is_writable)) + return false; + if(backup) { + while(iterator->offset[iterator->depth] + (long)FLAC__STREAM_METADATA_HEADER_LENGTH + (long)iterator->length < save_offset) + if(!FLAC__metadata_simple_iterator_next(iterator)) + return false; + return true; + } + else { + /* move the iterator to it's original block faster by faking a push, then doing a pop_ */ + FLAC__ASSERT(iterator->depth == 0); + iterator->offset[0] = save_offset; + iterator->depth++; + return simple_iterator_pop_(iterator); + } +} + +FLAC__bool copy_n_bytes_from_file_(FILE *file, FILE *tempfile, unsigned bytes/*@@@ 4G limit*/, FLAC__Metadata_SimpleIteratorStatus *status) +{ + FLAC__byte buffer[8192]; + unsigned n; + + while(bytes > 0) { + n = min(sizeof(buffer), bytes); + if(fread(buffer, 1, n, file) != n) { + *status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR; + return false; + } + if(local__fwrite(buffer, 1, n, tempfile) != n) { + *status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_WRITE_ERROR; + return false; + } + bytes -= n; + } + + return true; +} + +FLAC__bool copy_n_bytes_from_file_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__IOHandle temp_handle, FLAC__IOCallback_Write temp_write_cb, unsigned bytes/*@@@ 4G limit*/, FLAC__Metadata_SimpleIteratorStatus *status) +{ + FLAC__byte buffer[8192]; + unsigned n; + + while(bytes > 0) { + n = min(sizeof(buffer), bytes); + if(read_cb(buffer, 1, n, handle) != n) { + *status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR; + return false; + } + if(temp_write_cb(buffer, 1, n, temp_handle) != n) { + *status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_WRITE_ERROR; + return false; + } + bytes -= n; + } + + return true; +} + +FLAC__bool copy_remaining_bytes_from_file_(FILE *file, FILE *tempfile, FLAC__Metadata_SimpleIteratorStatus *status) +{ + FLAC__byte buffer[8192]; + size_t n; + + while(!feof(file)) { + n = fread(buffer, 1, sizeof(buffer), file); + if(n == 0 && !feof(file)) { + *status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR; + return false; + } + if(n > 0 && local__fwrite(buffer, 1, n, tempfile) != n) { + *status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_WRITE_ERROR; + return false; + } + } + + return true; +} + +FLAC__bool copy_remaining_bytes_from_file_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__IOCallback_Eof eof_cb, FLAC__IOHandle temp_handle, FLAC__IOCallback_Write temp_write_cb, FLAC__Metadata_SimpleIteratorStatus *status) +{ + FLAC__byte buffer[8192]; + size_t n; + + while(!eof_cb(handle)) { + n = read_cb(buffer, 1, sizeof(buffer), handle); + if(n == 0 && !eof_cb(handle)) { + *status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR; + return false; + } + if(n > 0 && temp_write_cb(buffer, 1, n, temp_handle) != n) { + *status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_WRITE_ERROR; + return false; + } + } + + return true; +} + +FLAC__bool open_tempfile_(const char *filename, const char *tempfile_path_prefix, FILE **tempfile, char **tempfilename, FLAC__Metadata_SimpleIteratorStatus *status) +{ + static const char *tempfile_suffix = ".metadata_edit"; + if(0 == tempfile_path_prefix) { + if(0 == (*tempfilename = (char*)malloc(strlen(filename) + strlen(tempfile_suffix) + 1))) { + *status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR; + return false; + } + strcpy(*tempfilename, filename); + strcat(*tempfilename, tempfile_suffix); + } + else { + const char *p = strrchr(filename, '/'); + if(0 == p) + p = filename; + else + p++; + + if(0 == (*tempfilename = (char*)malloc(strlen(tempfile_path_prefix) + 1 + strlen(p) + strlen(tempfile_suffix) + 1))) { + *status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR; + return false; + } + strcpy(*tempfilename, tempfile_path_prefix); + strcat(*tempfilename, "/"); + strcat(*tempfilename, p); + strcat(*tempfilename, tempfile_suffix); + } + + if(0 == (*tempfile = fopen(*tempfilename, "w+b"))) { + *status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ERROR_OPENING_FILE; + return false; + } + + return true; +} + +FLAC__bool transport_tempfile_(const char *filename, FILE **tempfile, char **tempfilename, FLAC__Metadata_SimpleIteratorStatus *status) +{ + FLAC__ASSERT(0 != filename); + FLAC__ASSERT(0 != tempfile); + FLAC__ASSERT(0 != *tempfile); + FLAC__ASSERT(0 != tempfilename); + FLAC__ASSERT(0 != *tempfilename); + FLAC__ASSERT(0 != status); + + (void)fclose(*tempfile); + *tempfile = 0; + +#if defined _MSC_VER || defined __MINGW32__ + if(unlink(filename) < 0) { + cleanup_tempfile_(tempfile, tempfilename); + *status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_UNLINK_ERROR; + return false; + } +#endif + + /*@@@ to fully support the tempfile_path_prefix we need to update this piece to actually copy across filesystems instead of just rename(): */ + if(0 != rename(*tempfilename, filename)) { + cleanup_tempfile_(tempfile, tempfilename); + *status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_RENAME_ERROR; + return false; + } + + cleanup_tempfile_(tempfile, tempfilename); + + return true; +} + +void cleanup_tempfile_(FILE **tempfile, char **tempfilename) +{ + if(0 != *tempfile) { + (void)fclose(*tempfile); + *tempfile = 0; + } + + if(0 != *tempfilename) { + (void)unlink(*tempfilename); + free(*tempfilename); + *tempfilename = 0; + } +} + +FLAC__bool get_file_stats_(const char *filename, struct stat *stats) +{ + FLAC__ASSERT(0 != filename); + FLAC__ASSERT(0 != stats); + return (0 == stat(filename, stats)); +} + +void set_file_stats_(const char *filename, struct stat *stats) +{ + struct utimbuf srctime; + + FLAC__ASSERT(0 != filename); + FLAC__ASSERT(0 != stats); + + srctime.actime = stats->st_atime; + srctime.modtime = stats->st_mtime; + (void)chmod(filename, stats->st_mode); + (void)utime(filename, &srctime); +#if !defined _MSC_VER && !defined __MINGW32__ + (void)chown(filename, stats->st_uid, -1); + (void)chown(filename, -1, stats->st_gid); +#endif +} + +/* @@@ WATCHOUT @@@ + * We cast FLAC__int64 to long and use fseek()/ftell() because + * none of our operations on metadata is ever likely to go past + * 2 gigabytes. + */ +int fseek_wrapper_(FLAC__IOHandle handle, FLAC__int64 offset, int whence) +{ + FLAC__ASSERT(offset <= 0x7fffffff); + return fseek((FILE*)handle, (long)offset, whence); +} + +FLAC__int64 ftell_wrapper_(FLAC__IOHandle handle) +{ + return (long)ftell((FILE*)handle); +} + +FLAC__Metadata_ChainStatus get_equivalent_status_(FLAC__Metadata_SimpleIteratorStatus status) +{ + switch(status) { + case FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK: + return FLAC__METADATA_CHAIN_STATUS_OK; + case FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ILLEGAL_INPUT: + return FLAC__METADATA_CHAIN_STATUS_ILLEGAL_INPUT; + case FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ERROR_OPENING_FILE: + return FLAC__METADATA_CHAIN_STATUS_ERROR_OPENING_FILE; + case FLAC__METADATA_SIMPLE_ITERATOR_STATUS_NOT_A_FLAC_FILE: + return FLAC__METADATA_CHAIN_STATUS_NOT_A_FLAC_FILE; + case FLAC__METADATA_SIMPLE_ITERATOR_STATUS_NOT_WRITABLE: + return FLAC__METADATA_CHAIN_STATUS_NOT_WRITABLE; + case FLAC__METADATA_SIMPLE_ITERATOR_STATUS_BAD_METADATA: + return FLAC__METADATA_CHAIN_STATUS_BAD_METADATA; + case FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR: + return FLAC__METADATA_CHAIN_STATUS_READ_ERROR; + case FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR: + return FLAC__METADATA_CHAIN_STATUS_SEEK_ERROR; + case FLAC__METADATA_SIMPLE_ITERATOR_STATUS_WRITE_ERROR: + return FLAC__METADATA_CHAIN_STATUS_WRITE_ERROR; + case FLAC__METADATA_SIMPLE_ITERATOR_STATUS_RENAME_ERROR: + return FLAC__METADATA_CHAIN_STATUS_RENAME_ERROR; + case FLAC__METADATA_SIMPLE_ITERATOR_STATUS_UNLINK_ERROR: + return FLAC__METADATA_CHAIN_STATUS_UNLINK_ERROR; + case FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR: + return FLAC__METADATA_CHAIN_STATUS_MEMORY_ALLOCATION_ERROR; + case FLAC__METADATA_SIMPLE_ITERATOR_STATUS_INTERNAL_ERROR: + default: + return FLAC__METADATA_CHAIN_STATUS_INTERNAL_ERROR; + } +} diff --git a/Libraries/FLAC/Files/src/libFLAC/metadata_object.c b/Libraries/FLAC/Files/src/libFLAC/metadata_object.c new file mode 100644 index 000000000..290036ce2 --- /dev/null +++ b/Libraries/FLAC/Files/src/libFLAC/metadata_object.c @@ -0,0 +1,1472 @@ +/* libFLAC - Free Lossless Audio Codec library + * Copyright (C) 2001,2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include + +#include "private/metadata.h" + +#include "FLAC/assert.h" + + +/**************************************************************************** + * + * Local routines + * + ***************************************************************************/ + +static FLAC__bool copy_bytes_(FLAC__byte **to, const FLAC__byte *from, unsigned bytes) +{ + if(bytes > 0 && 0 != from) { + FLAC__byte *x; + if(0 == (x = (FLAC__byte*)malloc(bytes))) + return false; + memcpy(x, from, bytes); + *to = x; + } + else { + FLAC__ASSERT(0 == from); + FLAC__ASSERT(bytes == 0); + *to = 0; + } + return true; +} + +static FLAC__bool ensure_null_terminated_(FLAC__byte **entry, unsigned length) +{ + FLAC__byte *x = (FLAC__byte*)realloc(*entry, length+1); + if(0 != x) { + x[length] = '\0'; + *entry = x; + return true; + } + else + return false; +} + +static FLAC__bool copy_vcentry_(FLAC__StreamMetadata_VorbisComment_Entry *to, const FLAC__StreamMetadata_VorbisComment_Entry *from) +{ + to->length = from->length; + if(0 == from->entry) { + FLAC__ASSERT(from->length == 0); + to->entry = 0; + } + else { + FLAC__byte *x; + FLAC__ASSERT(from->length > 0); + if(0 == (x = (FLAC__byte*)malloc(from->length+1))) + return false; + memcpy(x, from->entry, from->length); + x[from->length] = '\0'; + to->entry = x; + } + return true; +} + +static FLAC__bool copy_track_(FLAC__StreamMetadata_CueSheet_Track *to, const FLAC__StreamMetadata_CueSheet_Track *from) +{ + memcpy(to, from, sizeof(FLAC__StreamMetadata_CueSheet_Track)); + if(0 == from->indices) { + FLAC__ASSERT(from->num_indices == 0); + } + else { + FLAC__StreamMetadata_CueSheet_Index *x; + FLAC__ASSERT(from->num_indices > 0); + if(0 == (x = (FLAC__StreamMetadata_CueSheet_Index*)malloc(from->num_indices * sizeof(FLAC__StreamMetadata_CueSheet_Index)))) + return false; + memcpy(x, from->indices, from->num_indices * sizeof(FLAC__StreamMetadata_CueSheet_Index)); + to->indices = x; + } + return true; +} + +static void seektable_calculate_length_(FLAC__StreamMetadata *object) +{ + FLAC__ASSERT(0 != object); + FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_SEEKTABLE); + + object->length = object->data.seek_table.num_points * FLAC__STREAM_METADATA_SEEKPOINT_LENGTH; +} + +static FLAC__StreamMetadata_SeekPoint *seekpoint_array_new_(unsigned num_points) +{ + FLAC__StreamMetadata_SeekPoint *object_array; + + FLAC__ASSERT(num_points > 0); + + object_array = (FLAC__StreamMetadata_SeekPoint*)malloc(num_points * sizeof(FLAC__StreamMetadata_SeekPoint)); + + if(0 != object_array) { + unsigned i; + for(i = 0; i < num_points; i++) { + object_array[i].sample_number = FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER; + object_array[i].stream_offset = 0; + object_array[i].frame_samples = 0; + } + } + + return object_array; +} + +static void vorbiscomment_calculate_length_(FLAC__StreamMetadata *object) +{ + unsigned i; + + FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT); + + object->length = (FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN) / 8; + object->length += object->data.vorbis_comment.vendor_string.length; + object->length += (FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN) / 8; + for(i = 0; i < object->data.vorbis_comment.num_comments; i++) { + object->length += (FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN / 8); + object->length += object->data.vorbis_comment.comments[i].length; + } +} + +static FLAC__StreamMetadata_VorbisComment_Entry *vorbiscomment_entry_array_new_(unsigned num_comments) +{ + FLAC__ASSERT(num_comments > 0); + + return (FLAC__StreamMetadata_VorbisComment_Entry*)calloc(num_comments, sizeof(FLAC__StreamMetadata_VorbisComment_Entry)); +} + +static void vorbiscomment_entry_array_delete_(FLAC__StreamMetadata_VorbisComment_Entry *object_array, unsigned num_comments) +{ + unsigned i; + + FLAC__ASSERT(0 != object_array && num_comments > 0); + + for(i = 0; i < num_comments; i++) + if(0 != object_array[i].entry) + free(object_array[i].entry); + + if(0 != object_array) + free(object_array); +} + +static FLAC__StreamMetadata_VorbisComment_Entry *vorbiscomment_entry_array_copy_(const FLAC__StreamMetadata_VorbisComment_Entry *object_array, unsigned num_comments) +{ + FLAC__StreamMetadata_VorbisComment_Entry *return_array; + + FLAC__ASSERT(0 != object_array); + FLAC__ASSERT(num_comments > 0); + + return_array = vorbiscomment_entry_array_new_(num_comments); + + if(0 != return_array) { + unsigned i; + + for(i = 0; i < num_comments; i++) { + if(!copy_vcentry_(return_array+i, object_array+i)) { + vorbiscomment_entry_array_delete_(return_array, num_comments); + return 0; + } + } + } + + return return_array; +} + +static FLAC__bool vorbiscomment_set_entry_(FLAC__StreamMetadata *object, FLAC__StreamMetadata_VorbisComment_Entry *dest, const FLAC__StreamMetadata_VorbisComment_Entry *src, FLAC__bool copy) +{ + FLAC__byte *save; + + FLAC__ASSERT(0 != object); + FLAC__ASSERT(0 != dest); + FLAC__ASSERT(0 != src); + FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT); + FLAC__ASSERT((0 != src->entry && src->length > 0) || (0 == src->entry && src->length == 0)); + + save = dest->entry; + + if(0 != src->entry && src->length > 0) { + if(copy) { + /* do the copy first so that if we fail we leave the dest object untouched */ + if(!copy_vcentry_(dest, src)) + return false; + } + else { + /* we have to make sure that the string we're taking over is null-terminated */ + + /* + * Stripping the const from src->entry is OK since we're taking + * ownership of the pointer. This is a hack around a deficiency + * in the API where the same function is used for 'copy' and + * 'own', but the source entry is a const pointer. If we were + * precise, the 'own' flavor would be a separate function with a + * non-const source pointer. But it's not, so we hack away. + */ + if(!ensure_null_terminated_((FLAC__byte**)(&src->entry), src->length)) + return false; + *dest = *src; + } + } + else { + /* the src is null */ + *dest = *src; + } + + if(0 != save) + free(save); + + vorbiscomment_calculate_length_(object); + return true; +} + +static int vorbiscomment_find_entry_from_(const FLAC__StreamMetadata *object, unsigned offset, const char *field_name, unsigned field_name_length) +{ + unsigned i; + + FLAC__ASSERT(0 != object); + FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT); + FLAC__ASSERT(0 != field_name); + + for(i = offset; i < object->data.vorbis_comment.num_comments; i++) { + if(FLAC__metadata_object_vorbiscomment_entry_matches(object->data.vorbis_comment.comments[i], field_name, field_name_length)) + return (int)i; + } + + return -1; +} + +static void cuesheet_calculate_length_(FLAC__StreamMetadata *object) +{ + unsigned i; + + FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_CUESHEET); + + object->length = ( + FLAC__STREAM_METADATA_CUESHEET_MEDIA_CATALOG_NUMBER_LEN + + FLAC__STREAM_METADATA_CUESHEET_LEAD_IN_LEN + + FLAC__STREAM_METADATA_CUESHEET_IS_CD_LEN + + FLAC__STREAM_METADATA_CUESHEET_RESERVED_LEN + + FLAC__STREAM_METADATA_CUESHEET_NUM_TRACKS_LEN + ) / 8; + + object->length += object->data.cue_sheet.num_tracks * ( + FLAC__STREAM_METADATA_CUESHEET_TRACK_OFFSET_LEN + + FLAC__STREAM_METADATA_CUESHEET_TRACK_NUMBER_LEN + + FLAC__STREAM_METADATA_CUESHEET_TRACK_ISRC_LEN + + FLAC__STREAM_METADATA_CUESHEET_TRACK_TYPE_LEN + + FLAC__STREAM_METADATA_CUESHEET_TRACK_PRE_EMPHASIS_LEN + + FLAC__STREAM_METADATA_CUESHEET_TRACK_RESERVED_LEN + + FLAC__STREAM_METADATA_CUESHEET_TRACK_NUM_INDICES_LEN + ) / 8; + + for(i = 0; i < object->data.cue_sheet.num_tracks; i++) { + object->length += object->data.cue_sheet.tracks[i].num_indices * ( + FLAC__STREAM_METADATA_CUESHEET_INDEX_OFFSET_LEN + + FLAC__STREAM_METADATA_CUESHEET_INDEX_NUMBER_LEN + + FLAC__STREAM_METADATA_CUESHEET_INDEX_RESERVED_LEN + ) / 8; + } +} + +static FLAC__StreamMetadata_CueSheet_Index *cuesheet_track_index_array_new_(unsigned num_indices) +{ + FLAC__ASSERT(num_indices > 0); + + return (FLAC__StreamMetadata_CueSheet_Index*)calloc(num_indices, sizeof(FLAC__StreamMetadata_CueSheet_Index)); +} + +static FLAC__StreamMetadata_CueSheet_Track *cuesheet_track_array_new_(unsigned num_tracks) +{ + FLAC__ASSERT(num_tracks > 0); + + return (FLAC__StreamMetadata_CueSheet_Track*)calloc(num_tracks, sizeof(FLAC__StreamMetadata_CueSheet_Track)); +} + +static void cuesheet_track_array_delete_(FLAC__StreamMetadata_CueSheet_Track *object_array, unsigned num_tracks) +{ + unsigned i; + + FLAC__ASSERT(0 != object_array && num_tracks > 0); + + for(i = 0; i < num_tracks; i++) { + if(0 != object_array[i].indices) { + FLAC__ASSERT(object_array[i].num_indices > 0); + free(object_array[i].indices); + } + } + + if(0 != object_array) + free(object_array); +} + +static FLAC__StreamMetadata_CueSheet_Track *cuesheet_track_array_copy_(const FLAC__StreamMetadata_CueSheet_Track *object_array, unsigned num_tracks) +{ + FLAC__StreamMetadata_CueSheet_Track *return_array; + + FLAC__ASSERT(0 != object_array); + FLAC__ASSERT(num_tracks > 0); + + return_array = cuesheet_track_array_new_(num_tracks); + + if(0 != return_array) { + unsigned i; + + for(i = 0; i < num_tracks; i++) { + if(!copy_track_(return_array+i, object_array+i)) { + cuesheet_track_array_delete_(return_array, num_tracks); + return 0; + } + } + } + + return return_array; +} + +static FLAC__bool cuesheet_set_track_(FLAC__StreamMetadata *object, FLAC__StreamMetadata_CueSheet_Track *dest, const FLAC__StreamMetadata_CueSheet_Track *src, FLAC__bool copy) +{ + FLAC__StreamMetadata_CueSheet_Index *save; + + FLAC__ASSERT(0 != object); + FLAC__ASSERT(0 != dest); + FLAC__ASSERT(0 != src); + FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_CUESHEET); + FLAC__ASSERT((0 != src->indices && src->num_indices > 0) || (0 == src->indices && src->num_indices == 0)); + + save = dest->indices; + + /* do the copy first so that if we fail we leave the object untouched */ + if(copy) { + if(!copy_track_(dest, src)) + return false; + } + else { + *dest = *src; + } + + if(0 != save) + free(save); + + cuesheet_calculate_length_(object); + return true; +} + + +/**************************************************************************** + * + * Metadata object routines + * + ***************************************************************************/ + +FLAC_API FLAC__StreamMetadata *FLAC__metadata_object_new(FLAC__MetadataType type) +{ + FLAC__StreamMetadata *object; + + if(type > FLAC__MAX_METADATA_TYPE_CODE) + return 0; + + object = (FLAC__StreamMetadata*)calloc(1, sizeof(FLAC__StreamMetadata)); + if(0 != object) { + object->is_last = false; + object->type = type; + switch(type) { + case FLAC__METADATA_TYPE_STREAMINFO: + object->length = FLAC__STREAM_METADATA_STREAMINFO_LENGTH; + break; + case FLAC__METADATA_TYPE_PADDING: + /* calloc() took care of this for us: + object->length = 0; + */ + break; + case FLAC__METADATA_TYPE_APPLICATION: + object->length = FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8; + /* calloc() took care of this for us: + object->data.application.data = 0; + */ + break; + case FLAC__METADATA_TYPE_SEEKTABLE: + /* calloc() took care of this for us: + object->length = 0; + object->data.seek_table.num_points = 0; + object->data.seek_table.points = 0; + */ + break; + case FLAC__METADATA_TYPE_VORBIS_COMMENT: + { + object->data.vorbis_comment.vendor_string.length = (unsigned)strlen(FLAC__VENDOR_STRING); + if(!copy_bytes_(&object->data.vorbis_comment.vendor_string.entry, (const FLAC__byte*)FLAC__VENDOR_STRING, object->data.vorbis_comment.vendor_string.length+1)) { + free(object); + return 0; + } + vorbiscomment_calculate_length_(object); + } + break; + case FLAC__METADATA_TYPE_CUESHEET: + cuesheet_calculate_length_(object); + break; + default: + /* calloc() took care of this for us: + object->length = 0; + object->data.unknown.data = 0; + */ + break; + } + } + + return object; +} + +FLAC_API FLAC__StreamMetadata *FLAC__metadata_object_clone(const FLAC__StreamMetadata *object) +{ + FLAC__StreamMetadata *to; + + FLAC__ASSERT(0 != object); + + if(0 != (to = FLAC__metadata_object_new(object->type))) { + to->is_last = object->is_last; + to->type = object->type; + to->length = object->length; + switch(to->type) { + case FLAC__METADATA_TYPE_STREAMINFO: + memcpy(&to->data.stream_info, &object->data.stream_info, sizeof(FLAC__StreamMetadata_StreamInfo)); + break; + case FLAC__METADATA_TYPE_PADDING: + break; + case FLAC__METADATA_TYPE_APPLICATION: + memcpy(&to->data.application.id, &object->data.application.id, FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8); + if(!copy_bytes_(&to->data.application.data, object->data.application.data, object->length - FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8)) { + FLAC__metadata_object_delete(to); + return 0; + } + break; + case FLAC__METADATA_TYPE_SEEKTABLE: + to->data.seek_table.num_points = object->data.seek_table.num_points; + if(!copy_bytes_((FLAC__byte**)&to->data.seek_table.points, (FLAC__byte*)object->data.seek_table.points, object->data.seek_table.num_points * sizeof(FLAC__StreamMetadata_SeekPoint))) { + FLAC__metadata_object_delete(to); + return 0; + } + break; + case FLAC__METADATA_TYPE_VORBIS_COMMENT: + if(0 != to->data.vorbis_comment.vendor_string.entry) { + free(to->data.vorbis_comment.vendor_string.entry); + to->data.vorbis_comment.vendor_string.entry = 0; + } + if(!copy_vcentry_(&to->data.vorbis_comment.vendor_string, &object->data.vorbis_comment.vendor_string)) { + FLAC__metadata_object_delete(to); + return 0; + } + if(object->data.vorbis_comment.num_comments == 0) { + FLAC__ASSERT(0 == object->data.vorbis_comment.comments); + to->data.vorbis_comment.comments = 0; + } + else { + FLAC__ASSERT(0 != object->data.vorbis_comment.comments); + to->data.vorbis_comment.comments = vorbiscomment_entry_array_copy_(object->data.vorbis_comment.comments, object->data.vorbis_comment.num_comments); + if(0 == to->data.vorbis_comment.comments) { + FLAC__metadata_object_delete(to); + return 0; + } + } + to->data.vorbis_comment.num_comments = object->data.vorbis_comment.num_comments; + break; + case FLAC__METADATA_TYPE_CUESHEET: + memcpy(&to->data.cue_sheet, &object->data.cue_sheet, sizeof(FLAC__StreamMetadata_CueSheet)); + if(object->data.cue_sheet.num_tracks == 0) { + FLAC__ASSERT(0 == object->data.cue_sheet.tracks); + } + else { + FLAC__ASSERT(0 != object->data.cue_sheet.tracks); + to->data.cue_sheet.tracks = cuesheet_track_array_copy_(object->data.cue_sheet.tracks, object->data.cue_sheet.num_tracks); + if(0 == to->data.cue_sheet.tracks) { + FLAC__metadata_object_delete(to); + return 0; + } + } + break; + default: + if(!copy_bytes_(&to->data.unknown.data, object->data.unknown.data, object->length)) { + FLAC__metadata_object_delete(to); + return 0; + } + break; + } + } + + return to; +} + +void FLAC__metadata_object_delete_data(FLAC__StreamMetadata *object) +{ + FLAC__ASSERT(0 != object); + + switch(object->type) { + case FLAC__METADATA_TYPE_STREAMINFO: + case FLAC__METADATA_TYPE_PADDING: + break; + case FLAC__METADATA_TYPE_APPLICATION: + if(0 != object->data.application.data) { + free(object->data.application.data); + object->data.application.data = 0; + } + break; + case FLAC__METADATA_TYPE_SEEKTABLE: + if(0 != object->data.seek_table.points) { + free(object->data.seek_table.points); + object->data.seek_table.points = 0; + } + break; + case FLAC__METADATA_TYPE_VORBIS_COMMENT: + if(0 != object->data.vorbis_comment.vendor_string.entry) { + free(object->data.vorbis_comment.vendor_string.entry); + object->data.vorbis_comment.vendor_string.entry = 0; + } + if(0 != object->data.vorbis_comment.comments) { + FLAC__ASSERT(object->data.vorbis_comment.num_comments > 0); + vorbiscomment_entry_array_delete_(object->data.vorbis_comment.comments, object->data.vorbis_comment.num_comments); + } + break; + case FLAC__METADATA_TYPE_CUESHEET: + if(0 != object->data.cue_sheet.tracks) { + FLAC__ASSERT(object->data.cue_sheet.num_tracks > 0); + cuesheet_track_array_delete_(object->data.cue_sheet.tracks, object->data.cue_sheet.num_tracks); + } + break; + default: + if(0 != object->data.unknown.data) { + free(object->data.unknown.data); + object->data.unknown.data = 0; + } + break; + } +} + +FLAC_API void FLAC__metadata_object_delete(FLAC__StreamMetadata *object) +{ + FLAC__metadata_object_delete_data(object); + free(object); +} + +static FLAC__bool compare_block_data_streaminfo_(const FLAC__StreamMetadata_StreamInfo *block1, const FLAC__StreamMetadata_StreamInfo *block2) +{ + if(block1->min_blocksize != block2->min_blocksize) + return false; + if(block1->max_blocksize != block2->max_blocksize) + return false; + if(block1->min_framesize != block2->min_framesize) + return false; + if(block1->max_framesize != block2->max_framesize) + return false; + if(block1->sample_rate != block2->sample_rate) + return false; + if(block1->channels != block2->channels) + return false; + if(block1->bits_per_sample != block2->bits_per_sample) + return false; + if(block1->total_samples != block2->total_samples) + return false; + if(0 != memcmp(block1->md5sum, block2->md5sum, 16)) + return false; + return true; +} + +static FLAC__bool compare_block_data_application_(const FLAC__StreamMetadata_Application *block1, const FLAC__StreamMetadata_Application *block2, unsigned block_length) +{ + FLAC__ASSERT(0 != block1); + FLAC__ASSERT(0 != block2); + FLAC__ASSERT(block_length >= sizeof(block1->id)); + + if(0 != memcmp(block1->id, block2->id, sizeof(block1->id))) + return false; + if(0 != block1->data && 0 != block2->data) + return 0 == memcmp(block1->data, block2->data, block_length - sizeof(block1->id)); + else + return block1->data == block2->data; +} + +static FLAC__bool compare_block_data_seektable_(const FLAC__StreamMetadata_SeekTable *block1, const FLAC__StreamMetadata_SeekTable *block2) +{ + unsigned i; + + FLAC__ASSERT(0 != block1); + FLAC__ASSERT(0 != block2); + + if(block1->num_points != block2->num_points) + return false; + + if(0 != block1->points && 0 != block2->points) { + for(i = 0; i < block1->num_points; i++) { + if(block1->points[i].sample_number != block2->points[i].sample_number) + return false; + if(block1->points[i].stream_offset != block2->points[i].stream_offset) + return false; + if(block1->points[i].frame_samples != block2->points[i].frame_samples) + return false; + } + return true; + } + else + return block1->points == block2->points; +} + +static FLAC__bool compare_block_data_vorbiscomment_(const FLAC__StreamMetadata_VorbisComment *block1, const FLAC__StreamMetadata_VorbisComment *block2) +{ + unsigned i; + + if(block1->vendor_string.length != block2->vendor_string.length) + return false; + + if(0 != block1->vendor_string.entry && 0 != block2->vendor_string.entry) { + if(0 != memcmp(block1->vendor_string.entry, block2->vendor_string.entry, block1->vendor_string.length)) + return false; + } + else if(block1->vendor_string.entry != block2->vendor_string.entry) + return false; + + if(block1->num_comments != block2->num_comments) + return false; + + for(i = 0; i < block1->num_comments; i++) { + if(0 != block1->comments[i].entry && 0 != block2->comments[i].entry) { + if(0 != memcmp(block1->comments[i].entry, block2->comments[i].entry, block1->comments[i].length)) + return false; + } + else if(block1->comments[i].entry != block2->comments[i].entry) + return false; + } + return true; +} + +static FLAC__bool compare_block_data_cuesheet_(const FLAC__StreamMetadata_CueSheet *block1, const FLAC__StreamMetadata_CueSheet *block2) +{ + unsigned i, j; + + if(0 != strcmp(block1->media_catalog_number, block2->media_catalog_number)) + return false; + + if(block1->lead_in != block2->lead_in) + return false; + + if(block1->is_cd != block2->is_cd) + return false; + + if(block1->num_tracks != block2->num_tracks) + return false; + + if(0 != block1->tracks && 0 != block2->tracks) { + FLAC__ASSERT(block1->num_tracks > 0); + for(i = 0; i < block1->num_tracks; i++) { + if(block1->tracks[i].offset != block2->tracks[i].offset) + return false; + if(block1->tracks[i].number != block2->tracks[i].number) + return false; + if(0 != memcmp(block1->tracks[i].isrc, block2->tracks[i].isrc, sizeof(block1->tracks[i].isrc))) + return false; + if(block1->tracks[i].type != block2->tracks[i].type) + return false; + if(block1->tracks[i].pre_emphasis != block2->tracks[i].pre_emphasis) + return false; + if(block1->tracks[i].num_indices != block2->tracks[i].num_indices) + return false; + if(0 != block1->tracks[i].indices && 0 != block2->tracks[i].indices) { + FLAC__ASSERT(block1->tracks[i].num_indices > 0); + for(j = 0; j < block1->tracks[i].num_indices; j++) { + if(block1->tracks[i].indices[j].offset != block2->tracks[i].indices[j].offset) + return false; + if(block1->tracks[i].indices[j].number != block2->tracks[i].indices[j].number) + return false; + } + } + else if(block1->tracks[i].indices != block2->tracks[i].indices) + return false; + } + } + else if(block1->tracks != block2->tracks) + return false; + return true; +} + +static FLAC__bool compare_block_data_unknown_(const FLAC__StreamMetadata_Unknown *block1, const FLAC__StreamMetadata_Unknown *block2, unsigned block_length) +{ + FLAC__ASSERT(0 != block1); + FLAC__ASSERT(0 != block2); + + if(0 != block1->data && 0 != block2->data) + return 0 == memcmp(block1->data, block2->data, block_length); + else + return block1->data == block2->data; +} + +FLAC_API FLAC__bool FLAC__metadata_object_is_equal(const FLAC__StreamMetadata *block1, const FLAC__StreamMetadata *block2) +{ + FLAC__ASSERT(0 != block1); + FLAC__ASSERT(0 != block2); + + if(block1->type != block2->type) { + return false; + } + if(block1->is_last != block2->is_last) { + return false; + } + if(block1->length != block2->length) { + return false; + } + switch(block1->type) { + case FLAC__METADATA_TYPE_STREAMINFO: + return compare_block_data_streaminfo_(&block1->data.stream_info, &block2->data.stream_info); + case FLAC__METADATA_TYPE_PADDING: + return true; /* we don't compare the padding guts */ + case FLAC__METADATA_TYPE_APPLICATION: + return compare_block_data_application_(&block1->data.application, &block2->data.application, block1->length); + case FLAC__METADATA_TYPE_SEEKTABLE: + return compare_block_data_seektable_(&block1->data.seek_table, &block2->data.seek_table); + case FLAC__METADATA_TYPE_VORBIS_COMMENT: + return compare_block_data_vorbiscomment_(&block1->data.vorbis_comment, &block2->data.vorbis_comment); + case FLAC__METADATA_TYPE_CUESHEET: + return compare_block_data_cuesheet_(&block1->data.cue_sheet, &block2->data.cue_sheet); + default: + return compare_block_data_unknown_(&block1->data.unknown, &block2->data.unknown, block1->length); + } +} + +FLAC_API FLAC__bool FLAC__metadata_object_application_set_data(FLAC__StreamMetadata *object, FLAC__byte *data, unsigned length, FLAC__bool copy) +{ + FLAC__byte *save; + + FLAC__ASSERT(0 != object); + FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_APPLICATION); + FLAC__ASSERT((0 != data && length > 0) || (0 == data && length == 0 && copy == false)); + + save = object->data.application.data; + + /* do the copy first so that if we fail we leave the object untouched */ + if(copy) { + if(!copy_bytes_(&object->data.application.data, data, length)) + return false; + } + else { + object->data.application.data = data; + } + + if(0 != save) + free(save); + + object->length = FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8 + length; + return true; +} + +FLAC_API FLAC__bool FLAC__metadata_object_seektable_resize_points(FLAC__StreamMetadata *object, unsigned new_num_points) +{ + FLAC__ASSERT(0 != object); + FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_SEEKTABLE); + + if(0 == object->data.seek_table.points) { + FLAC__ASSERT(object->data.seek_table.num_points == 0); + if(0 == new_num_points) + return true; + else if(0 == (object->data.seek_table.points = seekpoint_array_new_(new_num_points))) + return false; + } + else { + const unsigned old_size = object->data.seek_table.num_points * sizeof(FLAC__StreamMetadata_SeekPoint); + const unsigned new_size = new_num_points * sizeof(FLAC__StreamMetadata_SeekPoint); + + FLAC__ASSERT(object->data.seek_table.num_points > 0); + + if(new_size == 0) { + free(object->data.seek_table.points); + object->data.seek_table.points = 0; + } + else if(0 == (object->data.seek_table.points = (FLAC__StreamMetadata_SeekPoint*)realloc(object->data.seek_table.points, new_size))) + return false; + + /* if growing, set new elements to placeholders */ + if(new_size > old_size) { + unsigned i; + for(i = object->data.seek_table.num_points; i < new_num_points; i++) { + object->data.seek_table.points[i].sample_number = FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER; + object->data.seek_table.points[i].stream_offset = 0; + object->data.seek_table.points[i].frame_samples = 0; + } + } + } + + object->data.seek_table.num_points = new_num_points; + + seektable_calculate_length_(object); + return true; +} + +FLAC_API void FLAC__metadata_object_seektable_set_point(FLAC__StreamMetadata *object, unsigned point_num, FLAC__StreamMetadata_SeekPoint point) +{ + FLAC__ASSERT(0 != object); + FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_SEEKTABLE); + FLAC__ASSERT(point_num < object->data.seek_table.num_points); + + object->data.seek_table.points[point_num] = point; +} + +FLAC_API FLAC__bool FLAC__metadata_object_seektable_insert_point(FLAC__StreamMetadata *object, unsigned point_num, FLAC__StreamMetadata_SeekPoint point) +{ + int i; + + FLAC__ASSERT(0 != object); + FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_SEEKTABLE); + FLAC__ASSERT(point_num <= object->data.seek_table.num_points); + + if(!FLAC__metadata_object_seektable_resize_points(object, object->data.seek_table.num_points+1)) + return false; + + /* move all points >= point_num forward one space */ + for(i = (int)object->data.seek_table.num_points-1; i > (int)point_num; i--) + object->data.seek_table.points[i] = object->data.seek_table.points[i-1]; + + FLAC__metadata_object_seektable_set_point(object, point_num, point); + seektable_calculate_length_(object); + return true; +} + +FLAC_API FLAC__bool FLAC__metadata_object_seektable_delete_point(FLAC__StreamMetadata *object, unsigned point_num) +{ + unsigned i; + + FLAC__ASSERT(0 != object); + FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_SEEKTABLE); + FLAC__ASSERT(point_num < object->data.seek_table.num_points); + + /* move all points > point_num backward one space */ + for(i = point_num; i < object->data.seek_table.num_points-1; i++) + object->data.seek_table.points[i] = object->data.seek_table.points[i+1]; + + return FLAC__metadata_object_seektable_resize_points(object, object->data.seek_table.num_points-1); +} + +FLAC_API FLAC__bool FLAC__metadata_object_seektable_is_legal(const FLAC__StreamMetadata *object) +{ + FLAC__ASSERT(0 != object); + FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_SEEKTABLE); + + return FLAC__format_seektable_is_legal(&object->data.seek_table); +} + +FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_placeholders(FLAC__StreamMetadata *object, unsigned num) +{ + FLAC__ASSERT(0 != object); + FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_SEEKTABLE); + + if(num > 0) + /* WATCHOUT: we rely on the fact that growing the array adds PLACEHOLDERS at the end */ + return FLAC__metadata_object_seektable_resize_points(object, object->data.seek_table.num_points + num); + else + return true; +} + +FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_point(FLAC__StreamMetadata *object, FLAC__uint64 sample_number) +{ + FLAC__StreamMetadata_SeekTable *seek_table; + + FLAC__ASSERT(0 != object); + FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_SEEKTABLE); + + seek_table = &object->data.seek_table; + + if(!FLAC__metadata_object_seektable_resize_points(object, seek_table->num_points + 1)) + return false; + + seek_table->points[seek_table->num_points - 1].sample_number = sample_number; + seek_table->points[seek_table->num_points - 1].stream_offset = 0; + seek_table->points[seek_table->num_points - 1].frame_samples = 0; + + return true; +} + +FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_points(FLAC__StreamMetadata *object, FLAC__uint64 sample_numbers[], unsigned num) +{ + FLAC__ASSERT(0 != object); + FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_SEEKTABLE); + FLAC__ASSERT(0 != sample_numbers || num == 0); + + if(num > 0) { + FLAC__StreamMetadata_SeekTable *seek_table = &object->data.seek_table; + unsigned i, j; + + i = seek_table->num_points; + + if(!FLAC__metadata_object_seektable_resize_points(object, seek_table->num_points + num)) + return false; + + for(j = 0; j < num; i++, j++) { + seek_table->points[i].sample_number = sample_numbers[j]; + seek_table->points[i].stream_offset = 0; + seek_table->points[i].frame_samples = 0; + } + } + + return true; +} + +FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_spaced_points(FLAC__StreamMetadata *object, unsigned num, FLAC__uint64 total_samples) +{ + FLAC__ASSERT(0 != object); + FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_SEEKTABLE); + FLAC__ASSERT(total_samples > 0); + + if(num > 0) { + FLAC__StreamMetadata_SeekTable *seek_table = &object->data.seek_table; + unsigned i, j; + + i = seek_table->num_points; + + if(!FLAC__metadata_object_seektable_resize_points(object, seek_table->num_points + num)) + return false; + + for(j = 0; j < num; i++, j++) { + seek_table->points[i].sample_number = total_samples * (FLAC__uint64)j / (FLAC__uint64)num; + seek_table->points[i].stream_offset = 0; + seek_table->points[i].frame_samples = 0; + } + } + + return true; +} + +FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_sort(FLAC__StreamMetadata *object, FLAC__bool compact) +{ + unsigned unique; + + FLAC__ASSERT(0 != object); + FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_SEEKTABLE); + + unique = FLAC__format_seektable_sort(&object->data.seek_table); + + return !compact || FLAC__metadata_object_seektable_resize_points(object, unique); +} + +FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_set_vendor_string(FLAC__StreamMetadata *object, FLAC__StreamMetadata_VorbisComment_Entry entry, FLAC__bool copy) +{ + if(!FLAC__format_vorbiscomment_entry_value_is_legal(entry.entry, entry.length)) + return false; + return vorbiscomment_set_entry_(object, &object->data.vorbis_comment.vendor_string, &entry, copy); +} + +FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_resize_comments(FLAC__StreamMetadata *object, unsigned new_num_comments) +{ + FLAC__ASSERT(0 != object); + FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT); + + if(0 == object->data.vorbis_comment.comments) { + FLAC__ASSERT(object->data.vorbis_comment.num_comments == 0); + if(0 == new_num_comments) + return true; + else if(0 == (object->data.vorbis_comment.comments = vorbiscomment_entry_array_new_(new_num_comments))) + return false; + } + else { + const unsigned old_size = object->data.vorbis_comment.num_comments * sizeof(FLAC__StreamMetadata_VorbisComment_Entry); + const unsigned new_size = new_num_comments * sizeof(FLAC__StreamMetadata_VorbisComment_Entry); + + FLAC__ASSERT(object->data.vorbis_comment.num_comments > 0); + + /* if shrinking, free the truncated entries */ + if(new_num_comments < object->data.vorbis_comment.num_comments) { + unsigned i; + for(i = new_num_comments; i < object->data.vorbis_comment.num_comments; i++) + if(0 != object->data.vorbis_comment.comments[i].entry) + free(object->data.vorbis_comment.comments[i].entry); + } + + if(new_size == 0) { + free(object->data.vorbis_comment.comments); + object->data.vorbis_comment.comments = 0; + } + else if(0 == (object->data.vorbis_comment.comments = (FLAC__StreamMetadata_VorbisComment_Entry*)realloc(object->data.vorbis_comment.comments, new_size))) + return false; + + /* if growing, zero all the length/pointers of new elements */ + if(new_size > old_size) + memset(object->data.vorbis_comment.comments + object->data.vorbis_comment.num_comments, 0, new_size - old_size); + } + + object->data.vorbis_comment.num_comments = new_num_comments; + + vorbiscomment_calculate_length_(object); + return true; +} + +FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_set_comment(FLAC__StreamMetadata *object, unsigned comment_num, FLAC__StreamMetadata_VorbisComment_Entry entry, FLAC__bool copy) +{ + FLAC__ASSERT(0 != object); + FLAC__ASSERT(comment_num < object->data.vorbis_comment.num_comments); + + if(!FLAC__format_vorbiscomment_entry_is_legal(entry.entry, entry.length)) + return false; + return vorbiscomment_set_entry_(object, &object->data.vorbis_comment.comments[comment_num], &entry, copy); +} + +FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_insert_comment(FLAC__StreamMetadata *object, unsigned comment_num, FLAC__StreamMetadata_VorbisComment_Entry entry, FLAC__bool copy) +{ + FLAC__StreamMetadata_VorbisComment *vc; + + FLAC__ASSERT(0 != object); + FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT); + FLAC__ASSERT(comment_num <= object->data.vorbis_comment.num_comments); + + if(!FLAC__format_vorbiscomment_entry_is_legal(entry.entry, entry.length)) + return false; + + vc = &object->data.vorbis_comment; + + if(!FLAC__metadata_object_vorbiscomment_resize_comments(object, vc->num_comments+1)) + return false; + + /* move all comments >= comment_num forward one space */ + memmove(&vc->comments[comment_num+1], &vc->comments[comment_num], sizeof(FLAC__StreamMetadata_VorbisComment_Entry)*(vc->num_comments-1-comment_num)); + vc->comments[comment_num].length = 0; + vc->comments[comment_num].entry = 0; + + return FLAC__metadata_object_vorbiscomment_set_comment(object, comment_num, entry, copy); +} + +FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_append_comment(FLAC__StreamMetadata *object, FLAC__StreamMetadata_VorbisComment_Entry entry, FLAC__bool copy) +{ + FLAC__ASSERT(0 != object); + FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT); + return FLAC__metadata_object_vorbiscomment_insert_comment(object, object->data.vorbis_comment.num_comments, entry, copy); +} + +FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_replace_comment(FLAC__StreamMetadata *object, FLAC__StreamMetadata_VorbisComment_Entry entry, FLAC__bool all, FLAC__bool copy) +{ + FLAC__ASSERT(0 != entry.entry && entry.length > 0); + + if(!FLAC__format_vorbiscomment_entry_is_legal(entry.entry, entry.length)) + return false; + + { + int i; + unsigned field_name_length; + const FLAC__byte *eq = (FLAC__byte*)memchr(entry.entry, '=', entry.length); + + FLAC__ASSERT(0 != eq); + + if(0 == eq) + return false; /* double protection */ + + field_name_length = eq-entry.entry; + + if((i = vorbiscomment_find_entry_from_(object, 0, entry.entry, field_name_length)) >= 0) { + unsigned index = (unsigned)i; + if(!FLAC__metadata_object_vorbiscomment_set_comment(object, index, entry, copy)) + return false; + if(all && (index+1 < object->data.vorbis_comment.num_comments)) { + for(i = vorbiscomment_find_entry_from_(object, index+1, entry.entry, field_name_length); i >= 0; ) { + if(!FLAC__metadata_object_vorbiscomment_delete_comment(object, (unsigned)i)) + return false; + if((unsigned)i < object->data.vorbis_comment.num_comments) + i = vorbiscomment_find_entry_from_(object, (unsigned)i, entry.entry, field_name_length); + else + i = -1; + } + } + return true; + } + else + return FLAC__metadata_object_vorbiscomment_append_comment(object, entry, copy); + } +} + +FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_delete_comment(FLAC__StreamMetadata *object, unsigned comment_num) +{ + FLAC__StreamMetadata_VorbisComment *vc; + + FLAC__ASSERT(0 != object); + FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT); + FLAC__ASSERT(comment_num < object->data.vorbis_comment.num_comments); + + vc = &object->data.vorbis_comment; + + /* free the comment at comment_num */ + if(0 != vc->comments[comment_num].entry) + free(vc->comments[comment_num].entry); + + /* move all comments > comment_num backward one space */ + memmove(&vc->comments[comment_num], &vc->comments[comment_num+1], sizeof(FLAC__StreamMetadata_VorbisComment_Entry)*(vc->num_comments-comment_num-1)); + vc->comments[vc->num_comments-1].length = 0; + vc->comments[vc->num_comments-1].entry = 0; + + return FLAC__metadata_object_vorbiscomment_resize_comments(object, vc->num_comments-1); +} + +FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_entry_from_name_value_pair(FLAC__StreamMetadata_VorbisComment_Entry *entry, const char *field_name, const char *field_value) +{ + FLAC__ASSERT(0 != entry); + FLAC__ASSERT(0 != field_name); + FLAC__ASSERT(0 != field_value); + + if(!FLAC__format_vorbiscomment_entry_name_is_legal(field_name)) + return false; + if(!FLAC__format_vorbiscomment_entry_value_is_legal(field_value, (unsigned)(-1))) + return false; + + { + const size_t nn = strlen(field_name); + const size_t nv = strlen(field_value); + entry->length = nn + 1 /*=*/ + nv; + if(0 == (entry->entry = (FLAC__byte*)malloc(entry->length+1))) + return false; + memcpy(entry->entry, field_name, nn); + entry->entry[nn] = '='; + memcpy(entry->entry+nn+1, field_value, nv); + entry->entry[entry->length] = '\0'; + } + + return true; +} + +FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_entry_to_name_value_pair(const FLAC__StreamMetadata_VorbisComment_Entry entry, char **field_name, char **field_value) +{ + FLAC__ASSERT(0 != entry.entry && entry.length > 0); + FLAC__ASSERT(0 != field_name); + FLAC__ASSERT(0 != field_value); + + if(!FLAC__format_vorbiscomment_entry_is_legal(entry.entry, entry.length)) + return false; + + { + const FLAC__byte *eq = (FLAC__byte*)memchr(entry.entry, '=', entry.length); + const size_t nn = eq-entry.entry; + const size_t nv = entry.length-nn-1; /* -1 for the '=' */ + FLAC__ASSERT(0 != eq); + if(0 == eq) + return false; /* double protection */ + if(0 == (*field_name = (char*)malloc(nn+1))) + return false; + if(0 == (*field_value = (char*)malloc(nv+1))) { + free(*field_name); + return false; + } + memcpy(*field_name, entry.entry, nn); + memcpy(*field_value, entry.entry+nn+1, nv); + (*field_name)[nn] = '\0'; + (*field_value)[nv] = '\0'; + } + + return true; +} + +FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_entry_matches(const FLAC__StreamMetadata_VorbisComment_Entry entry, const char *field_name, unsigned field_name_length) +{ + FLAC__ASSERT(0 != entry.entry && entry.length > 0); + { + const FLAC__byte *eq = (FLAC__byte*)memchr(entry.entry, '=', entry.length); +#if defined _MSC_VER || defined __MINGW32__ +#define FLAC__STRNCASECMP strnicmp +#else +#define FLAC__STRNCASECMP strncasecmp +#endif + return (0 != eq && (unsigned)(eq-entry.entry) == field_name_length && 0 == FLAC__STRNCASECMP(field_name, (const char *)entry.entry, field_name_length)); +#undef FLAC__STRNCASECMP + } +} + +FLAC_API int FLAC__metadata_object_vorbiscomment_find_entry_from(const FLAC__StreamMetadata *object, unsigned offset, const char *field_name) +{ + FLAC__ASSERT(0 != field_name); + + return vorbiscomment_find_entry_from_(object, offset, field_name, strlen(field_name)); +} + +FLAC_API int FLAC__metadata_object_vorbiscomment_remove_entry_matching(FLAC__StreamMetadata *object, const char *field_name) +{ + const unsigned field_name_length = strlen(field_name); + unsigned i; + + FLAC__ASSERT(0 != object); + FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT); + + for(i = 0; i < object->data.vorbis_comment.num_comments; i++) { + if(FLAC__metadata_object_vorbiscomment_entry_matches(object->data.vorbis_comment.comments[i], field_name, field_name_length)) { + if(!FLAC__metadata_object_vorbiscomment_delete_comment(object, i)) + return -1; + else + return 1; + } + } + + return 0; +} + +FLAC_API int FLAC__metadata_object_vorbiscomment_remove_entries_matching(FLAC__StreamMetadata *object, const char *field_name) +{ + FLAC__bool ok = true; + unsigned matching = 0; + const unsigned field_name_length = strlen(field_name); + int i; + + FLAC__ASSERT(0 != object); + FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT); + + /* must delete from end to start otherwise it will interfere with our iteration */ + for(i = (int)object->data.vorbis_comment.num_comments - 1; ok && i >= 0; i--) { + if(FLAC__metadata_object_vorbiscomment_entry_matches(object->data.vorbis_comment.comments[i], field_name, field_name_length)) { + matching++; + ok &= FLAC__metadata_object_vorbiscomment_delete_comment(object, (unsigned)i); + } + } + + return ok? (int)matching : -1; +} + +FLAC_API FLAC__StreamMetadata_CueSheet_Track *FLAC__metadata_object_cuesheet_track_new() +{ + return (FLAC__StreamMetadata_CueSheet_Track*)calloc(1, sizeof(FLAC__StreamMetadata_CueSheet_Track)); +} + +FLAC_API FLAC__StreamMetadata_CueSheet_Track *FLAC__metadata_object_cuesheet_track_clone(const FLAC__StreamMetadata_CueSheet_Track *object) +{ + FLAC__StreamMetadata_CueSheet_Track *to; + + FLAC__ASSERT(0 != object); + + if(0 != (to = FLAC__metadata_object_cuesheet_track_new())) { + if(!copy_track_(to, object)) { + FLAC__metadata_object_cuesheet_track_delete(to); + return 0; + } + } + + return to; +} + +void FLAC__metadata_object_cuesheet_track_delete_data(FLAC__StreamMetadata_CueSheet_Track *object) +{ + FLAC__ASSERT(0 != object); + + if(0 != object->indices) { + FLAC__ASSERT(object->num_indices > 0); + free(object->indices); + } +} + +FLAC_API void FLAC__metadata_object_cuesheet_track_delete(FLAC__StreamMetadata_CueSheet_Track *object) +{ + FLAC__metadata_object_cuesheet_track_delete_data(object); + free(object); +} + +FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_resize_indices(FLAC__StreamMetadata *object, unsigned track_num, unsigned new_num_indices) +{ + FLAC__StreamMetadata_CueSheet_Track *track; + FLAC__ASSERT(0 != object); + FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_CUESHEET); + FLAC__ASSERT(track_num < object->data.cue_sheet.num_tracks); + + track = &object->data.cue_sheet.tracks[track_num]; + + if(0 == track->indices) { + FLAC__ASSERT(track->num_indices == 0); + if(0 == new_num_indices) + return true; + else if(0 == (track->indices = cuesheet_track_index_array_new_(new_num_indices))) + return false; + } + else { + const unsigned old_size = track->num_indices * sizeof(FLAC__StreamMetadata_CueSheet_Index); + const unsigned new_size = new_num_indices * sizeof(FLAC__StreamMetadata_CueSheet_Index); + + FLAC__ASSERT(track->num_indices > 0); + + if(new_size == 0) { + free(track->indices); + track->indices = 0; + } + else if(0 == (track->indices = (FLAC__StreamMetadata_CueSheet_Index*)realloc(track->indices, new_size))) + return false; + + /* if growing, zero all the lengths/pointers of new elements */ + if(new_size > old_size) + memset(track->indices + track->num_indices, 0, new_size - old_size); + } + + track->num_indices = new_num_indices; + + cuesheet_calculate_length_(object); + return true; +} + +FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_insert_index(FLAC__StreamMetadata *object, unsigned track_num, unsigned index_num, FLAC__StreamMetadata_CueSheet_Index index) +{ + FLAC__StreamMetadata_CueSheet_Track *track; + + FLAC__ASSERT(0 != object); + FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_CUESHEET); + FLAC__ASSERT(track_num < object->data.cue_sheet.num_tracks); + FLAC__ASSERT(index_num <= object->data.cue_sheet.tracks[track_num].num_indices); + + track = &object->data.cue_sheet.tracks[track_num]; + + if(!FLAC__metadata_object_cuesheet_track_resize_indices(object, track_num, track->num_indices+1)) + return false; + + /* move all indices >= index_num forward one space */ + memmove(&track->indices[index_num+1], &track->indices[index_num], sizeof(FLAC__StreamMetadata_CueSheet_Index)*(track->num_indices-1-index_num)); + + track->indices[index_num] = index; + cuesheet_calculate_length_(object); + return true; +} + +FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_insert_blank_index(FLAC__StreamMetadata *object, unsigned track_num, unsigned index_num) +{ + FLAC__StreamMetadata_CueSheet_Index index; + memset(&index, 0, sizeof(index)); + return FLAC__metadata_object_cuesheet_track_insert_index(object, track_num, index_num, index); +} + +FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_delete_index(FLAC__StreamMetadata *object, unsigned track_num, unsigned index_num) +{ + FLAC__StreamMetadata_CueSheet_Track *track; + + FLAC__ASSERT(0 != object); + FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_CUESHEET); + FLAC__ASSERT(track_num < object->data.cue_sheet.num_tracks); + FLAC__ASSERT(index_num < object->data.cue_sheet.tracks[track_num].num_indices); + + track = &object->data.cue_sheet.tracks[track_num]; + + /* move all indices > index_num backward one space */ + memmove(&track->indices[index_num], &track->indices[index_num+1], sizeof(FLAC__StreamMetadata_CueSheet_Index)*(track->num_indices-index_num-1)); + + FLAC__metadata_object_cuesheet_track_resize_indices(object, track_num, track->num_indices-1); + cuesheet_calculate_length_(object); + return true; +} + +FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_resize_tracks(FLAC__StreamMetadata *object, unsigned new_num_tracks) +{ + FLAC__ASSERT(0 != object); + FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_CUESHEET); + + if(0 == object->data.cue_sheet.tracks) { + FLAC__ASSERT(object->data.cue_sheet.num_tracks == 0); + if(0 == new_num_tracks) + return true; + else if(0 == (object->data.cue_sheet.tracks = cuesheet_track_array_new_(new_num_tracks))) + return false; + } + else { + const unsigned old_size = object->data.cue_sheet.num_tracks * sizeof(FLAC__StreamMetadata_CueSheet_Track); + const unsigned new_size = new_num_tracks * sizeof(FLAC__StreamMetadata_CueSheet_Track); + + FLAC__ASSERT(object->data.cue_sheet.num_tracks > 0); + + /* if shrinking, free the truncated entries */ + if(new_num_tracks < object->data.cue_sheet.num_tracks) { + unsigned i; + for(i = new_num_tracks; i < object->data.cue_sheet.num_tracks; i++) + if(0 != object->data.cue_sheet.tracks[i].indices) + free(object->data.cue_sheet.tracks[i].indices); + } + + if(new_size == 0) { + free(object->data.cue_sheet.tracks); + object->data.cue_sheet.tracks = 0; + } + else if(0 == (object->data.cue_sheet.tracks = (FLAC__StreamMetadata_CueSheet_Track*)realloc(object->data.cue_sheet.tracks, new_size))) + return false; + + /* if growing, zero all the lengths/pointers of new elements */ + if(new_size > old_size) + memset(object->data.cue_sheet.tracks + object->data.cue_sheet.num_tracks, 0, new_size - old_size); + } + + object->data.cue_sheet.num_tracks = new_num_tracks; + + cuesheet_calculate_length_(object); + return true; +} + +FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_set_track(FLAC__StreamMetadata *object, unsigned track_num, FLAC__StreamMetadata_CueSheet_Track *track, FLAC__bool copy) +{ + FLAC__ASSERT(0 != object); + FLAC__ASSERT(track_num < object->data.cue_sheet.num_tracks); + + return cuesheet_set_track_(object, object->data.cue_sheet.tracks + track_num, track, copy); +} + +FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_insert_track(FLAC__StreamMetadata *object, unsigned track_num, FLAC__StreamMetadata_CueSheet_Track *track, FLAC__bool copy) +{ + FLAC__StreamMetadata_CueSheet *cs; + + FLAC__ASSERT(0 != object); + FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_CUESHEET); + FLAC__ASSERT(track_num <= object->data.cue_sheet.num_tracks); + + cs = &object->data.cue_sheet; + + if(!FLAC__metadata_object_cuesheet_resize_tracks(object, cs->num_tracks+1)) + return false; + + /* move all tracks >= track_num forward one space */ + memmove(&cs->tracks[track_num+1], &cs->tracks[track_num], sizeof(FLAC__StreamMetadata_CueSheet_Track)*(cs->num_tracks-1-track_num)); + cs->tracks[track_num].num_indices = 0; + cs->tracks[track_num].indices = 0; + + return FLAC__metadata_object_cuesheet_set_track(object, track_num, track, copy); +} + +FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_insert_blank_track(FLAC__StreamMetadata *object, unsigned track_num) +{ + FLAC__StreamMetadata_CueSheet_Track track; + memset(&track, 0, sizeof(track)); + return FLAC__metadata_object_cuesheet_insert_track(object, track_num, &track, /*copy=*/false); +} + +FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_delete_track(FLAC__StreamMetadata *object, unsigned track_num) +{ + FLAC__StreamMetadata_CueSheet *cs; + + FLAC__ASSERT(0 != object); + FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_CUESHEET); + FLAC__ASSERT(track_num < object->data.cue_sheet.num_tracks); + + cs = &object->data.cue_sheet; + + /* free the track at track_num */ + if(0 != cs->tracks[track_num].indices) + free(cs->tracks[track_num].indices); + + /* move all tracks > track_num backward one space */ + memmove(&cs->tracks[track_num], &cs->tracks[track_num+1], sizeof(FLAC__StreamMetadata_CueSheet_Track)*(cs->num_tracks-track_num-1)); + cs->tracks[cs->num_tracks-1].num_indices = 0; + cs->tracks[cs->num_tracks-1].indices = 0; + + return FLAC__metadata_object_cuesheet_resize_tracks(object, cs->num_tracks-1); +} + +FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_is_legal(const FLAC__StreamMetadata *object, FLAC__bool check_cd_da_subset, const char **violation) +{ + FLAC__ASSERT(0 != object); + FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_CUESHEET); + + return FLAC__format_cuesheet_is_legal(&object->data.cue_sheet, check_cd_da_subset, violation); +} diff --git a/Libraries/FLAC/Files/src/libFLAC/ppc/Makefile.am b/Libraries/FLAC/Files/src/libFLAC/ppc/Makefile.am new file mode 100644 index 000000000..24e6ac5e2 --- /dev/null +++ b/Libraries/FLAC/Files/src/libFLAC/ppc/Makefile.am @@ -0,0 +1,31 @@ +# libFLAC - Free Lossless Audio Codec library +# Copyright (C) 2004,2005 Josh Coalson +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# - Neither the name of the Xiph.org Foundation nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +SUBDIRS = as gas diff --git a/Libraries/FLAC/Files/src/libFLAC/ppc/Makefile.in b/Libraries/FLAC/Files/src/libFLAC/ppc/Makefile.in new file mode 100644 index 000000000..c2611398f --- /dev/null +++ b/Libraries/FLAC/Files/src/libFLAC/ppc/Makefile.in @@ -0,0 +1,543 @@ +# Makefile.in generated by automake 1.8.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# libFLAC - Free Lossless Audio Codec library +# Copyright (C) 2004,2005 Josh Coalson +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# - Neither the name of the Xiph.org Foundation nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../../.. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_triplet = @host@ +subdir = src/libFLAC/ppc +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(mkdir_p) +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-exec-recursive install-info-recursive \ + install-recursive installcheck-recursive installdirs-recursive \ + pdf-recursive ps-recursive uninstall-info-recursive \ + uninstall-recursive +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCAS = @CCAS@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEBUG_FALSE = @DEBUG_FALSE@ +DEBUG_TRUE = @DEBUG_TRUE@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DOCBOOK_TO_MAN = @DOCBOOK_TO_MAN@ +DOXYGEN = @DOXYGEN@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FLaC__CPU_IA32_FALSE = @FLaC__CPU_IA32_FALSE@ +FLaC__CPU_IA32_TRUE = @FLaC__CPU_IA32_TRUE@ +FLaC__CPU_PPC_FALSE = @FLaC__CPU_PPC_FALSE@ +FLaC__CPU_PPC_TRUE = @FLaC__CPU_PPC_TRUE@ +FLaC__CPU_SPARC_FALSE = @FLaC__CPU_SPARC_FALSE@ +FLaC__CPU_SPARC_TRUE = @FLaC__CPU_SPARC_TRUE@ +FLaC__EXHAUSTIVE_TESTS_FALSE = @FLaC__EXHAUSTIVE_TESTS_FALSE@ +FLaC__EXHAUSTIVE_TESTS_TRUE = @FLaC__EXHAUSTIVE_TESTS_TRUE@ +FLaC__HAS_AS_FALSE = @FLaC__HAS_AS_FALSE@ +FLaC__HAS_AS_TRUE = @FLaC__HAS_AS_TRUE@ +FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@ +FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@ +FLaC__HAS_DOCBOOK_TO_MAN_FALSE = @FLaC__HAS_DOCBOOK_TO_MAN_FALSE@ +FLaC__HAS_DOCBOOK_TO_MAN_TRUE = @FLaC__HAS_DOCBOOK_TO_MAN_TRUE@ +FLaC__HAS_DOXYGEN_FALSE = @FLaC__HAS_DOXYGEN_FALSE@ +FLaC__HAS_DOXYGEN_TRUE = @FLaC__HAS_DOXYGEN_TRUE@ +FLaC__HAS_GAS_FALSE = @FLaC__HAS_GAS_FALSE@ +FLaC__HAS_GAS_TRUE = @FLaC__HAS_GAS_TRUE@ +FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@ +FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@ +FLaC__HAS_NASM_FALSE = @FLaC__HAS_NASM_FALSE@ +FLaC__HAS_NASM_TRUE = @FLaC__HAS_NASM_TRUE@ +FLaC__HAS_OGG_FALSE = @FLaC__HAS_OGG_FALSE@ +FLaC__HAS_OGG_TRUE = @FLaC__HAS_OGG_TRUE@ +FLaC__HAS_XMMS_FALSE = @FLaC__HAS_XMMS_FALSE@ +FLaC__HAS_XMMS_TRUE = @FLaC__HAS_XMMS_TRUE@ +FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE@ +FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE@ +FLaC__NO_ASM_FALSE = @FLaC__NO_ASM_FALSE@ +FLaC__NO_ASM_TRUE = @FLaC__NO_ASM_TRUE@ +FLaC__SSE_OS_FALSE = @FLaC__SSE_OS_FALSE@ +FLaC__SSE_OS_TRUE = @FLaC__SSE_OS_TRUE@ +FLaC__SYS_DARWIN_FALSE = @FLaC__SYS_DARWIN_FALSE@ +FLaC__SYS_DARWIN_TRUE = @FLaC__SYS_DARWIN_TRUE@ +FLaC__SYS_LINUX_FALSE = @FLaC__SYS_LINUX_FALSE@ +FLaC__SYS_LINUX_TRUE = @FLaC__SYS_LINUX_TRUE@ +FLaC__USE_3DNOW_FALSE = @FLaC__USE_3DNOW_FALSE@ +FLaC__USE_3DNOW_TRUE = @FLaC__USE_3DNOW_TRUE@ +FLaC__USE_ALTIVEC_FALSE = @FLaC__USE_ALTIVEC_FALSE@ +FLaC__USE_ALTIVEC_TRUE = @FLaC__USE_ALTIVEC_TRUE@ +FLaC__VALGRIND_TESTING_FALSE = @FLaC__VALGRIND_TESTING_FALSE@ +FLaC__VALGRIND_TESTING_TRUE = @FLaC__VALGRIND_TESTING_TRUE@ +GAS = @GAS@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +NASM = @NASM@ +OBJEXT = @OBJEXT@ +OBJ_FORMAT = @OBJ_FORMAT@ +OGG_CFLAGS = @OGG_CFLAGS@ +OGG_LIBS = @OGG_LIBS@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +XMMS_CFLAGS = @XMMS_CFLAGS@ +XMMS_CONFIG = @XMMS_CONFIG@ +XMMS_DATA_DIR = @XMMS_DATA_DIR@ +XMMS_EFFECT_PLUGIN_DIR = @XMMS_EFFECT_PLUGIN_DIR@ +XMMS_GENERAL_PLUGIN_DIR = @XMMS_GENERAL_PLUGIN_DIR@ +XMMS_INPUT_PLUGIN_DIR = @XMMS_INPUT_PLUGIN_DIR@ +XMMS_LIBS = @XMMS_LIBS@ +XMMS_OUTPUT_PLUGIN_DIR = @XMMS_OUTPUT_PLUGIN_DIR@ +XMMS_PLUGIN_DIR = @XMMS_PLUGIN_DIR@ +XMMS_VERSION = @XMMS_VERSION@ +XMMS_VISUALIZATION_PLUGIN_DIR = @XMMS_VISUALIZATION_PLUGIN_DIR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +SUBDIRS = as gas +all: all-recursive + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/libFLAC/ppc/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/libFLAC/ppc/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || mkdir "$(distdir)/$$subdir" \ + || exit 1; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="../$(top_distdir)" \ + distdir="../$(distdir)/$$subdir" \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-libtool \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-recursive + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-info-am + +uninstall-info: uninstall-info-recursive + +.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \ + clean clean-generic clean-libtool clean-recursive ctags \ + ctags-recursive distclean distclean-generic distclean-libtool \ + distclean-recursive distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-strip installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic maintainer-clean-recursive \ + mostlyclean mostlyclean-generic mostlyclean-libtool \ + mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \ + uninstall uninstall-am uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/Libraries/FLAC/Files/src/libFLAC/ppc/as/Makefile.am b/Libraries/FLAC/Files/src/libFLAC/ppc/as/Makefile.am new file mode 100644 index 000000000..4ff20d048 --- /dev/null +++ b/Libraries/FLAC/Files/src/libFLAC/ppc/as/Makefile.am @@ -0,0 +1,52 @@ +# libFLAC - Free Lossless Audio Codec library +# Copyright (C) 2004,2005 Josh Coalson +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# - Neither the name of the Xiph.org Foundation nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#@@@@@@ +if FLaC__HAS_AS__TEMPORARILY_DISABLED + +SUFFIXES = .s .lo + +STRIP_NON_ASM = sh $(top_srcdir)/strip_non_asm_libtool_args.sh + +# For some unknown reason libtool can't figure out the tag for 'as', so +# we fake it with --tag=CC and strip out unwanted options. +.s.lo: + $(LIBTOOL) --tag=CC --mode=compile $(STRIP_NON_ASM) as -force_cpusubtype_ALL -o $@ $< + +noinst_LTLIBRARIES = libFLAC-asm.la +libFLAC_asm_la_SOURCES = \ + lpc_asm.s + +else + +EXTRA_DIST = \ + lpc_asm.s + +endif diff --git a/Libraries/FLAC/Files/src/libFLAC/ppc/as/Makefile.in b/Libraries/FLAC/Files/src/libFLAC/ppc/as/Makefile.in new file mode 100644 index 000000000..ffec52d7c --- /dev/null +++ b/Libraries/FLAC/Files/src/libFLAC/ppc/as/Makefile.in @@ -0,0 +1,512 @@ +# Makefile.in generated by automake 1.8.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# libFLAC - Free Lossless Audio Codec library +# Copyright (C) 2004,2005 Josh Coalson +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# - Neither the name of the Xiph.org Foundation nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +SOURCES = $(libFLAC_asm_la_SOURCES) + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../../../.. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_triplet = @host@ +subdir = src/libFLAC/ppc/as +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(mkdir_p) +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +libFLAC_asm_la_LIBADD = +am__libFLAC_asm_la_SOURCES_DIST = lpc_asm.s +@FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@am_libFLAC_asm_la_OBJECTS = \ +@FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@ lpc_asm.lo +libFLAC_asm_la_OBJECTS = $(am_libFLAC_asm_la_OBJECTS) +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +CCASCOMPILE = $(CCAS) $(AM_CCASFLAGS) $(CCASFLAGS) +LTCCASCOMPILE = $(LIBTOOL) --mode=compile $(CCAS) $(AM_CCASFLAGS) \ + $(CCASFLAGS) +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(libFLAC_asm_la_SOURCES) +DIST_SOURCES = $(am__libFLAC_asm_la_SOURCES_DIST) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCAS = @CCAS@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEBUG_FALSE = @DEBUG_FALSE@ +DEBUG_TRUE = @DEBUG_TRUE@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DOCBOOK_TO_MAN = @DOCBOOK_TO_MAN@ +DOXYGEN = @DOXYGEN@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FLaC__CPU_IA32_FALSE = @FLaC__CPU_IA32_FALSE@ +FLaC__CPU_IA32_TRUE = @FLaC__CPU_IA32_TRUE@ +FLaC__CPU_PPC_FALSE = @FLaC__CPU_PPC_FALSE@ +FLaC__CPU_PPC_TRUE = @FLaC__CPU_PPC_TRUE@ +FLaC__CPU_SPARC_FALSE = @FLaC__CPU_SPARC_FALSE@ +FLaC__CPU_SPARC_TRUE = @FLaC__CPU_SPARC_TRUE@ +FLaC__EXHAUSTIVE_TESTS_FALSE = @FLaC__EXHAUSTIVE_TESTS_FALSE@ +FLaC__EXHAUSTIVE_TESTS_TRUE = @FLaC__EXHAUSTIVE_TESTS_TRUE@ +FLaC__HAS_AS_FALSE = @FLaC__HAS_AS_FALSE@ +FLaC__HAS_AS_TRUE = @FLaC__HAS_AS_TRUE@ +FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@ +FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@ +FLaC__HAS_DOCBOOK_TO_MAN_FALSE = @FLaC__HAS_DOCBOOK_TO_MAN_FALSE@ +FLaC__HAS_DOCBOOK_TO_MAN_TRUE = @FLaC__HAS_DOCBOOK_TO_MAN_TRUE@ +FLaC__HAS_DOXYGEN_FALSE = @FLaC__HAS_DOXYGEN_FALSE@ +FLaC__HAS_DOXYGEN_TRUE = @FLaC__HAS_DOXYGEN_TRUE@ +FLaC__HAS_GAS_FALSE = @FLaC__HAS_GAS_FALSE@ +FLaC__HAS_GAS_TRUE = @FLaC__HAS_GAS_TRUE@ +FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@ +FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@ +FLaC__HAS_NASM_FALSE = @FLaC__HAS_NASM_FALSE@ +FLaC__HAS_NASM_TRUE = @FLaC__HAS_NASM_TRUE@ +FLaC__HAS_OGG_FALSE = @FLaC__HAS_OGG_FALSE@ +FLaC__HAS_OGG_TRUE = @FLaC__HAS_OGG_TRUE@ +FLaC__HAS_XMMS_FALSE = @FLaC__HAS_XMMS_FALSE@ +FLaC__HAS_XMMS_TRUE = @FLaC__HAS_XMMS_TRUE@ +FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE@ +FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE@ +FLaC__NO_ASM_FALSE = @FLaC__NO_ASM_FALSE@ +FLaC__NO_ASM_TRUE = @FLaC__NO_ASM_TRUE@ +FLaC__SSE_OS_FALSE = @FLaC__SSE_OS_FALSE@ +FLaC__SSE_OS_TRUE = @FLaC__SSE_OS_TRUE@ +FLaC__SYS_DARWIN_FALSE = @FLaC__SYS_DARWIN_FALSE@ +FLaC__SYS_DARWIN_TRUE = @FLaC__SYS_DARWIN_TRUE@ +FLaC__SYS_LINUX_FALSE = @FLaC__SYS_LINUX_FALSE@ +FLaC__SYS_LINUX_TRUE = @FLaC__SYS_LINUX_TRUE@ +FLaC__USE_3DNOW_FALSE = @FLaC__USE_3DNOW_FALSE@ +FLaC__USE_3DNOW_TRUE = @FLaC__USE_3DNOW_TRUE@ +FLaC__USE_ALTIVEC_FALSE = @FLaC__USE_ALTIVEC_FALSE@ +FLaC__USE_ALTIVEC_TRUE = @FLaC__USE_ALTIVEC_TRUE@ +FLaC__VALGRIND_TESTING_FALSE = @FLaC__VALGRIND_TESTING_FALSE@ +FLaC__VALGRIND_TESTING_TRUE = @FLaC__VALGRIND_TESTING_TRUE@ +GAS = @GAS@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +NASM = @NASM@ +OBJEXT = @OBJEXT@ +OBJ_FORMAT = @OBJ_FORMAT@ +OGG_CFLAGS = @OGG_CFLAGS@ +OGG_LIBS = @OGG_LIBS@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +XMMS_CFLAGS = @XMMS_CFLAGS@ +XMMS_CONFIG = @XMMS_CONFIG@ +XMMS_DATA_DIR = @XMMS_DATA_DIR@ +XMMS_EFFECT_PLUGIN_DIR = @XMMS_EFFECT_PLUGIN_DIR@ +XMMS_GENERAL_PLUGIN_DIR = @XMMS_GENERAL_PLUGIN_DIR@ +XMMS_INPUT_PLUGIN_DIR = @XMMS_INPUT_PLUGIN_DIR@ +XMMS_LIBS = @XMMS_LIBS@ +XMMS_OUTPUT_PLUGIN_DIR = @XMMS_OUTPUT_PLUGIN_DIR@ +XMMS_PLUGIN_DIR = @XMMS_PLUGIN_DIR@ +XMMS_VERSION = @XMMS_VERSION@ +XMMS_VISUALIZATION_PLUGIN_DIR = @XMMS_VISUALIZATION_PLUGIN_DIR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ + +#@@@@@@ +@FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@SUFFIXES = .s .lo +@FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@STRIP_NON_ASM = sh $(top_srcdir)/strip_non_asm_libtool_args.sh +@FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@noinst_LTLIBRARIES = libFLAC-asm.la +@FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@libFLAC_asm_la_SOURCES = \ +@FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@ lpc_asm.s + +@FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@EXTRA_DIST = \ +@FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@ lpc_asm.s + +all: all-am + +.SUFFIXES: +.SUFFIXES: .s .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/libFLAC/ppc/as/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/libFLAC/ppc/as/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libFLAC-asm.la: $(libFLAC_asm_la_OBJECTS) $(libFLAC_asm_la_DEPENDENCIES) + $(LINK) $(libFLAC_asm_la_LDFLAGS) $(libFLAC_asm_la_OBJECTS) $(libFLAC_asm_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +.s.o: + $(CCASCOMPILE) -c $< + +.s.obj: + $(CCASCOMPILE) -c `$(CYGPATH_W) '$<'` + +@FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@.s.lo: + $(LTCCASCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstLTLIBRARIES ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-exec \ + install-exec-am install-info install-info-am install-man \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am \ + uninstall-info-am + + +# For some unknown reason libtool can't figure out the tag for 'as', so +# we fake it with --tag=CC and strip out unwanted options. +@FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@.s.lo: +@FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@ $(LIBTOOL) --tag=CC --mode=compile $(STRIP_NON_ASM) as -force_cpusubtype_ALL -o $@ $< +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/Libraries/FLAC/Files/src/libFLAC/ppc/as/lpc_asm.s b/Libraries/FLAC/Files/src/libFLAC/ppc/as/lpc_asm.s new file mode 100644 index 000000000..98cb5e8eb --- /dev/null +++ b/Libraries/FLAC/Files/src/libFLAC/ppc/as/lpc_asm.s @@ -0,0 +1,429 @@ +; libFLAC - Free Lossless Audio Codec library +; Copyright (C) 2004,2005 Josh Coalson +; +; Redistribution and use in source and binary forms, with or without +; modification, are permitted provided that the following conditions +; are met: +; +; - Redistributions of source code must retain the above copyright +; notice, this list of conditions and the following disclaimer. +; +; - Redistributions in binary form must reproduce the above copyright +; notice, this list of conditions and the following disclaimer in the +; documentation and/or other materials provided with the distribution. +; +; - Neither the name of the Xiph.org Foundation nor the names of its +; contributors may be used to endorse or promote products derived from +; this software without specific prior written permission. +; +; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +; ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR +; CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +; EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +; PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +; LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +.text + .align 2 +.globl _FLAC__lpc_restore_signal_asm_ppc_altivec_16 + +.globl _FLAC__lpc_restore_signal_asm_ppc_altivec_16_order8 + +_FLAC__lpc_restore_signal_asm_ppc_altivec_16: +; r3: residual[] +; r4: data_len +; r5: qlp_coeff[] +; r6: order +; r7: lp_quantization +; r8: data[] + +; see src/libFLAC/lpc.c:FLAC__lpc_restore_signal() +; these is a PowerPC/Altivec assembly version which requires bps<=16 (or actual +; bps<=15 for mid-side coding, since that uses an extra bit) + +; these should be fast; the inner loop is unrolled (it takes no more than +; 3*(order%4) instructions, all of which are arithmetic), and all of the +; coefficients and all relevant history stay in registers, so the outer loop +; has only one load from memory (the residual) + +; I have not yet run this through simg4, so there may be some avoidable stalls, +; and there may be a somewhat more clever way to do the outer loop + +; the branch mechanism may prevent dynamic loading; I still need to examine +; this issue, and there may be a more elegant method + + stmw r31,-4(r1) + + addi r9,r1,-28 + li r31,0xf + andc r9,r9,r31 ; for quadword-aligned stack data + + slwi r6,r6,2 ; adjust for word size + slwi r4,r4,2 + add r4,r4,r8 ; r4 = data+data_len + + mfspr r0,256 ; cache old vrsave + addis r31,0,hi16(0xfffffc00) + ori r31,r31,lo16(0xfffffc00) + mtspr 256,r31 ; declare VRs in vrsave + + cmplw cr0,r8,r4 ; i> lp_quantization + + lvewx v21,0,r3 ; v21[n]: *residual + vperm v21,v21,v21,v18 ; v21[3]: *residual + vaddsws v20,v21,v20 ; v20[3]: *residual + (sum >> lp_quantization) + vsldoi v18,v18,v18,4 ; increment shift vector + + vperm v21,v20,v20,v17 ; v21[n]: shift for storage + vsldoi v17,v17,v17,12 ; increment shift vector + stvewx v21,0,r8 + + vsldoi v20,v20,v20,12 + vsldoi v8,v8,v20,4 ; insert value onto history + + addi r3,r3,4 + addi r8,r8,4 + cmplw cr0,r8,r4 ; i> lp_quantization + + lvewx v9,0,r3 ; v9[n]: *residual + vperm v9,v9,v9,v6 ; v9[3]: *residual + vaddsws v8,v9,v8 ; v8[3]: *residual + (sum >> lp_quantization) + vsldoi v6,v6,v6,4 ; increment shift vector + + vperm v9,v8,v8,v5 ; v9[n]: shift for storage + vsldoi v5,v5,v5,12 ; increment shift vector + stvewx v9,0,r8 + + vsldoi v8,v8,v8,12 + vsldoi v2,v2,v8,4 ; insert value onto history + + addi r3,r3,4 + addi r8,r8,4 + cmplw cr0,r8,r4 ; i> lp_quantization + + lvewx v21,0,r3 # v21[n]: *residual + vperm v21,v21,v21,v18 # v21[3]: *residual + vaddsws v20,v21,v20 # v20[3]: *residual + (sum >> lp_quantization) + vsldoi v18,v18,v18,4 # increment shift vector + + vperm v21,v20,v20,v17 # v21[n]: shift for storage + vsldoi v17,v17,v17,12 # increment shift vector + stvewx v21,0,r8 + + vsldoi v20,v20,v20,12 + vsldoi v8,v8,v20,4 # insert value onto history + + addi r3,r3,4 + addi r8,r8,4 + cmplw cr0,r8,r4 # i> lp_quantization + + lvewx v9,0,r3 # v9[n]: *residual + vperm v9,v9,v9,v6 # v9[3]: *residual + vaddsws v8,v9,v8 # v8[3]: *residual + (sum >> lp_quantization) + vsldoi v6,v6,v6,4 # increment shift vector + + vperm v9,v8,v8,v5 # v9[n]: shift for storage + vsldoi v5,v5,v5,12 # increment shift vector + stvewx v9,0,r8 + + vsldoi v8,v8,v8,12 + vsldoi v2,v2,v8,4 # insert value onto history + + addi r3,r3,4 + addi r8,r8,4 + cmplw cr0,r8,r4 # i +#include /* for calloc() */ +#include /* for memcpy()/memcmp() */ +#include "FLAC/assert.h" +#include "protected/seekable_stream_decoder.h" +#include "protected/stream_decoder.h" +#include "private/float.h" /* for FLAC__double */ +#include "private/md5.h" + +/* adjust for compilers that can't understand using LLU suffix for uint64_t literals */ +#ifdef _MSC_VER +#define FLAC__U64L(x) x +#else +#define FLAC__U64L(x) x##LLU +#endif + +/*********************************************************************** + * + * Private class method prototypes + * + ***********************************************************************/ + +static void set_defaults_(FLAC__SeekableStreamDecoder *decoder); +static FLAC__StreamDecoderReadStatus read_callback_(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], unsigned *bytes, void *client_data); +static FLAC__StreamDecoderWriteStatus write_callback_(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data); +static void metadata_callback_(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data); +static void error_callback_(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data); +static FLAC__bool seek_to_absolute_sample_(FLAC__SeekableStreamDecoder *decoder, FLAC__uint64 stream_length, FLAC__uint64 target_sample); + +/*********************************************************************** + * + * Private class data + * + ***********************************************************************/ + +typedef struct FLAC__SeekableStreamDecoderPrivate { + FLAC__SeekableStreamDecoderReadCallback read_callback; + FLAC__SeekableStreamDecoderSeekCallback seek_callback; + FLAC__SeekableStreamDecoderTellCallback tell_callback; + FLAC__SeekableStreamDecoderLengthCallback length_callback; + FLAC__SeekableStreamDecoderEofCallback eof_callback; + FLAC__SeekableStreamDecoderWriteCallback write_callback; + FLAC__SeekableStreamDecoderMetadataCallback metadata_callback; + FLAC__SeekableStreamDecoderErrorCallback error_callback; + void *client_data; + FLAC__StreamDecoder *stream_decoder; + FLAC__bool do_md5_checking; /* initially gets protected_->md5_checking but is turned off after a seek */ + struct FLAC__MD5Context md5context; + FLAC__byte stored_md5sum[16]; /* this is what is stored in the metadata */ + FLAC__byte computed_md5sum[16]; /* this is the sum we computed from the decoded data */ + /* the rest of these are only used for seeking: */ + FLAC__StreamMetadata_StreamInfo stream_info; /* we keep this around so we can figure out how to seek quickly */ + const FLAC__StreamMetadata_SeekTable *seek_table; /* we hold a pointer to the stream decoder's seek table for the same reason */ + /* Since we always want to see the STREAMINFO and SEEK_TABLE blocks at this level, we need some extra flags to keep track of whether they should be passed on up through the metadata_callback */ + FLAC__bool ignore_stream_info_block; + FLAC__bool ignore_seek_table_block; + FLAC__Frame last_frame; /* holds the info of the last frame we seeked to */ + FLAC__uint64 target_sample; +} FLAC__SeekableStreamDecoderPrivate; + +/*********************************************************************** + * + * Public static class data + * + ***********************************************************************/ + +FLAC_API const char * const FLAC__SeekableStreamDecoderStateString[] = { + "FLAC__SEEKABLE_STREAM_DECODER_OK", + "FLAC__SEEKABLE_STREAM_DECODER_SEEKING", + "FLAC__SEEKABLE_STREAM_DECODER_END_OF_STREAM", + "FLAC__SEEKABLE_STREAM_DECODER_MEMORY_ALLOCATION_ERROR", + "FLAC__SEEKABLE_STREAM_DECODER_STREAM_DECODER_ERROR", + "FLAC__SEEKABLE_STREAM_DECODER_READ_ERROR", + "FLAC__SEEKABLE_STREAM_DECODER_SEEK_ERROR", + "FLAC__SEEKABLE_STREAM_DECODER_ALREADY_INITIALIZED", + "FLAC__SEEKABLE_STREAM_DECODER_INVALID_CALLBACK", + "FLAC__SEEKABLE_STREAM_DECODER_UNINITIALIZED" +}; + +FLAC_API const char * const FLAC__SeekableStreamDecoderReadStatusString[] = { + "FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_OK", + "FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_ERROR" +}; + +FLAC_API const char * const FLAC__SeekableStreamDecoderSeekStatusString[] = { + "FLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_OK", + "FLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_ERROR" +}; + +FLAC_API const char * const FLAC__SeekableStreamDecoderTellStatusString[] = { + "FLAC__SEEKABLE_STREAM_DECODER_TELL_STATUS_OK", + "FLAC__SEEKABLE_STREAM_DECODER_TELL_STATUS_ERROR" +}; + +FLAC_API const char * const FLAC__SeekableStreamDecoderLengthStatusString[] = { + "FLAC__SEEKABLE_STREAM_DECODER_LENGTH_STATUS_OK", + "FLAC__SEEKABLE_STREAM_DECODER_LENGTH_STATUS_ERROR" +}; + + +/*********************************************************************** + * + * Class constructor/destructor + * + ***********************************************************************/ + +FLAC_API FLAC__SeekableStreamDecoder *FLAC__seekable_stream_decoder_new() +{ + FLAC__SeekableStreamDecoder *decoder; + + FLAC__ASSERT(sizeof(int) >= 4); /* we want to die right away if this is not true */ + + decoder = (FLAC__SeekableStreamDecoder*)calloc(1, sizeof(FLAC__SeekableStreamDecoder)); + if(decoder == 0) { + return 0; + } + + decoder->protected_ = (FLAC__SeekableStreamDecoderProtected*)calloc(1, sizeof(FLAC__SeekableStreamDecoderProtected)); + if(decoder->protected_ == 0) { + free(decoder); + return 0; + } + + decoder->private_ = (FLAC__SeekableStreamDecoderPrivate*)calloc(1, sizeof(FLAC__SeekableStreamDecoderPrivate)); + if(decoder->private_ == 0) { + free(decoder->protected_); + free(decoder); + return 0; + } + + decoder->private_->stream_decoder = FLAC__stream_decoder_new(); + if(0 == decoder->private_->stream_decoder) { + free(decoder->private_); + free(decoder->protected_); + free(decoder); + return 0; + } + + set_defaults_(decoder); + + decoder->protected_->state = FLAC__SEEKABLE_STREAM_DECODER_UNINITIALIZED; + + return decoder; +} + +FLAC_API void FLAC__seekable_stream_decoder_delete(FLAC__SeekableStreamDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->protected_); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->private_->stream_decoder); + + (void)FLAC__seekable_stream_decoder_finish(decoder); + + FLAC__stream_decoder_delete(decoder->private_->stream_decoder); + + free(decoder->private_); + free(decoder->protected_); + free(decoder); +} + +/*********************************************************************** + * + * Public class methods + * + ***********************************************************************/ + +FLAC_API FLAC__SeekableStreamDecoderState FLAC__seekable_stream_decoder_init(FLAC__SeekableStreamDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + + if(decoder->protected_->state != FLAC__SEEKABLE_STREAM_DECODER_UNINITIALIZED) + return decoder->protected_->state = FLAC__SEEKABLE_STREAM_DECODER_ALREADY_INITIALIZED; + + if(0 == decoder->private_->read_callback || 0 == decoder->private_->seek_callback || 0 == decoder->private_->tell_callback || 0 == decoder->private_->length_callback || 0 == decoder->private_->eof_callback) + return decoder->protected_->state = FLAC__SEEKABLE_STREAM_DECODER_INVALID_CALLBACK; + + if(0 == decoder->private_->write_callback || 0 == decoder->private_->metadata_callback || 0 == decoder->private_->error_callback) + return decoder->protected_->state = FLAC__SEEKABLE_STREAM_DECODER_INVALID_CALLBACK; + + decoder->private_->seek_table = 0; + + decoder->private_->do_md5_checking = decoder->protected_->md5_checking; + + /* We initialize the FLAC__MD5Context even though we may never use it. This + * is because md5 checking may be turned on to start and then turned off if + * a seek occurs. So we always init the context here and finalize it in + * FLAC__seekable_stream_decoder_finish() to make sure things are always + * cleaned up properly. + */ + FLAC__MD5Init(&decoder->private_->md5context); + + FLAC__stream_decoder_set_read_callback(decoder->private_->stream_decoder, read_callback_); + FLAC__stream_decoder_set_write_callback(decoder->private_->stream_decoder, write_callback_); + FLAC__stream_decoder_set_metadata_callback(decoder->private_->stream_decoder, metadata_callback_); + FLAC__stream_decoder_set_error_callback(decoder->private_->stream_decoder, error_callback_); + FLAC__stream_decoder_set_client_data(decoder->private_->stream_decoder, decoder); + + /* We always want to see these blocks. Whether or not we pass them up + * through the metadata callback will be determined by flags set in our + * implementation of ..._set_metadata_respond/ignore...() + */ + FLAC__stream_decoder_set_metadata_respond(decoder->private_->stream_decoder, FLAC__METADATA_TYPE_STREAMINFO); + FLAC__stream_decoder_set_metadata_respond(decoder->private_->stream_decoder, FLAC__METADATA_TYPE_SEEKTABLE); + + if(FLAC__stream_decoder_init(decoder->private_->stream_decoder) != FLAC__STREAM_DECODER_SEARCH_FOR_METADATA) + return decoder->protected_->state = FLAC__SEEKABLE_STREAM_DECODER_STREAM_DECODER_ERROR; + + return decoder->protected_->state = FLAC__SEEKABLE_STREAM_DECODER_OK; +} + +FLAC_API FLAC__bool FLAC__seekable_stream_decoder_finish(FLAC__SeekableStreamDecoder *decoder) +{ + FLAC__bool md5_failed = false; + + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + + if(decoder->protected_->state == FLAC__SEEKABLE_STREAM_DECODER_UNINITIALIZED) + return true; + + FLAC__ASSERT(0 != decoder->private_->stream_decoder); + + /* see the comment in FLAC__seekable_stream_decoder_init() as to why we + * always call FLAC__MD5Final() + */ + FLAC__MD5Final(decoder->private_->computed_md5sum, &decoder->private_->md5context); + + FLAC__stream_decoder_finish(decoder->private_->stream_decoder); + + if(decoder->private_->do_md5_checking) { + if(memcmp(decoder->private_->stored_md5sum, decoder->private_->computed_md5sum, 16)) + md5_failed = true; + } + + set_defaults_(decoder); + + decoder->protected_->state = FLAC__SEEKABLE_STREAM_DECODER_UNINITIALIZED; + + return !md5_failed; +} + +FLAC_API FLAC__bool FLAC__seekable_stream_decoder_set_md5_checking(FLAC__SeekableStreamDecoder *decoder, FLAC__bool value) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->protected_); + if(decoder->protected_->state != FLAC__SEEKABLE_STREAM_DECODER_UNINITIALIZED) + return false; + decoder->protected_->md5_checking = value; + return true; +} + +FLAC_API FLAC__bool FLAC__seekable_stream_decoder_set_read_callback(FLAC__SeekableStreamDecoder *decoder, FLAC__SeekableStreamDecoderReadCallback value) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + if(decoder->protected_->state != FLAC__SEEKABLE_STREAM_DECODER_UNINITIALIZED) + return false; + decoder->private_->read_callback = value; + return true; +} + +FLAC_API FLAC__bool FLAC__seekable_stream_decoder_set_seek_callback(FLAC__SeekableStreamDecoder *decoder, FLAC__SeekableStreamDecoderSeekCallback value) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + if(decoder->protected_->state != FLAC__SEEKABLE_STREAM_DECODER_UNINITIALIZED) + return false; + decoder->private_->seek_callback = value; + return true; +} + +FLAC_API FLAC__bool FLAC__seekable_stream_decoder_set_tell_callback(FLAC__SeekableStreamDecoder *decoder, FLAC__SeekableStreamDecoderTellCallback value) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + if(decoder->protected_->state != FLAC__SEEKABLE_STREAM_DECODER_UNINITIALIZED) + return false; + decoder->private_->tell_callback = value; + return true; +} + +FLAC_API FLAC__bool FLAC__seekable_stream_decoder_set_length_callback(FLAC__SeekableStreamDecoder *decoder, FLAC__SeekableStreamDecoderLengthCallback value) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + if(decoder->protected_->state != FLAC__SEEKABLE_STREAM_DECODER_UNINITIALIZED) + return false; + decoder->private_->length_callback = value; + return true; +} + +FLAC_API FLAC__bool FLAC__seekable_stream_decoder_set_eof_callback(FLAC__SeekableStreamDecoder *decoder, FLAC__SeekableStreamDecoderEofCallback value) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + if(decoder->protected_->state != FLAC__SEEKABLE_STREAM_DECODER_UNINITIALIZED) + return false; + decoder->private_->eof_callback = value; + return true; +} + +FLAC_API FLAC__bool FLAC__seekable_stream_decoder_set_write_callback(FLAC__SeekableStreamDecoder *decoder, FLAC__SeekableStreamDecoderWriteCallback value) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + if(decoder->protected_->state != FLAC__SEEKABLE_STREAM_DECODER_UNINITIALIZED) + return false; + decoder->private_->write_callback = value; + return true; +} + +FLAC_API FLAC__bool FLAC__seekable_stream_decoder_set_metadata_callback(FLAC__SeekableStreamDecoder *decoder, FLAC__SeekableStreamDecoderMetadataCallback value) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + if(decoder->protected_->state != FLAC__SEEKABLE_STREAM_DECODER_UNINITIALIZED) + return false; + decoder->private_->metadata_callback = value; + return true; +} + +FLAC_API FLAC__bool FLAC__seekable_stream_decoder_set_error_callback(FLAC__SeekableStreamDecoder *decoder, FLAC__SeekableStreamDecoderErrorCallback value) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + if(decoder->protected_->state != FLAC__SEEKABLE_STREAM_DECODER_UNINITIALIZED) + return false; + decoder->private_->error_callback = value; + return true; +} + +FLAC_API FLAC__bool FLAC__seekable_stream_decoder_set_client_data(FLAC__SeekableStreamDecoder *decoder, void *value) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + if(decoder->protected_->state != FLAC__SEEKABLE_STREAM_DECODER_UNINITIALIZED) + return false; + decoder->private_->client_data = value; + return true; +} + +FLAC_API FLAC__bool FLAC__seekable_stream_decoder_set_metadata_respond(FLAC__SeekableStreamDecoder *decoder, FLAC__MetadataType type) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + FLAC__ASSERT(0 != decoder->private_->stream_decoder); + if(decoder->protected_->state != FLAC__SEEKABLE_STREAM_DECODER_UNINITIALIZED) + return false; + if(type == FLAC__METADATA_TYPE_STREAMINFO) + decoder->private_->ignore_stream_info_block = false; + else if(type == FLAC__METADATA_TYPE_SEEKTABLE) + decoder->private_->ignore_seek_table_block = false; + return FLAC__stream_decoder_set_metadata_respond(decoder->private_->stream_decoder, type); +} + +FLAC_API FLAC__bool FLAC__seekable_stream_decoder_set_metadata_respond_application(FLAC__SeekableStreamDecoder *decoder, const FLAC__byte id[4]) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + FLAC__ASSERT(0 != decoder->private_->stream_decoder); + if(decoder->protected_->state != FLAC__SEEKABLE_STREAM_DECODER_UNINITIALIZED) + return false; + return FLAC__stream_decoder_set_metadata_respond_application(decoder->private_->stream_decoder, id); +} + +FLAC_API FLAC__bool FLAC__seekable_stream_decoder_set_metadata_respond_all(FLAC__SeekableStreamDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + FLAC__ASSERT(0 != decoder->private_->stream_decoder); + if(decoder->protected_->state != FLAC__SEEKABLE_STREAM_DECODER_UNINITIALIZED) + return false; + decoder->private_->ignore_stream_info_block = false; + decoder->private_->ignore_seek_table_block = false; + return FLAC__stream_decoder_set_metadata_respond_all(decoder->private_->stream_decoder); +} + +FLAC_API FLAC__bool FLAC__seekable_stream_decoder_set_metadata_ignore(FLAC__SeekableStreamDecoder *decoder, FLAC__MetadataType type) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + FLAC__ASSERT(0 != decoder->private_->stream_decoder); + if(decoder->protected_->state != FLAC__SEEKABLE_STREAM_DECODER_UNINITIALIZED) + return false; + if(type == FLAC__METADATA_TYPE_STREAMINFO) { + decoder->private_->ignore_stream_info_block = true; + return true; + } + else if(type == FLAC__METADATA_TYPE_SEEKTABLE) { + decoder->private_->ignore_seek_table_block = true; + return true; + } + else + return FLAC__stream_decoder_set_metadata_ignore(decoder->private_->stream_decoder, type); +} + +FLAC_API FLAC__bool FLAC__seekable_stream_decoder_set_metadata_ignore_application(FLAC__SeekableStreamDecoder *decoder, const FLAC__byte id[4]) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + FLAC__ASSERT(0 != decoder->private_->stream_decoder); + if(decoder->protected_->state != FLAC__SEEKABLE_STREAM_DECODER_UNINITIALIZED) + return false; + return FLAC__stream_decoder_set_metadata_ignore_application(decoder->private_->stream_decoder, id); +} + +FLAC_API FLAC__bool FLAC__seekable_stream_decoder_set_metadata_ignore_all(FLAC__SeekableStreamDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + FLAC__ASSERT(0 != decoder->private_->stream_decoder); + if(decoder->protected_->state != FLAC__SEEKABLE_STREAM_DECODER_UNINITIALIZED) + return false; + decoder->private_->ignore_stream_info_block = true; + decoder->private_->ignore_seek_table_block = true; + return + FLAC__stream_decoder_set_metadata_ignore_all(decoder->private_->stream_decoder) && + FLAC__stream_decoder_set_metadata_respond(decoder->private_->stream_decoder, FLAC__METADATA_TYPE_STREAMINFO) && + FLAC__stream_decoder_set_metadata_respond(decoder->private_->stream_decoder, FLAC__METADATA_TYPE_SEEKTABLE); +} + +FLAC_API FLAC__SeekableStreamDecoderState FLAC__seekable_stream_decoder_get_state(const FLAC__SeekableStreamDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->protected_); + return decoder->protected_->state; +} + +FLAC_API FLAC__StreamDecoderState FLAC__seekable_stream_decoder_get_stream_decoder_state(const FLAC__SeekableStreamDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + return FLAC__stream_decoder_get_state(decoder->private_->stream_decoder); +} + +FLAC_API const char *FLAC__seekable_stream_decoder_get_resolved_state_string(const FLAC__SeekableStreamDecoder *decoder) +{ + if(decoder->protected_->state != FLAC__SEEKABLE_STREAM_DECODER_STREAM_DECODER_ERROR) + return FLAC__SeekableStreamDecoderStateString[decoder->protected_->state]; + else + return FLAC__stream_decoder_get_resolved_state_string(decoder->private_->stream_decoder); +} + +FLAC_API FLAC__bool FLAC__seekable_stream_decoder_get_md5_checking(const FLAC__SeekableStreamDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->protected_); + return decoder->protected_->md5_checking; +} + +FLAC_API unsigned FLAC__seekable_stream_decoder_get_channels(const FLAC__SeekableStreamDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + return FLAC__stream_decoder_get_channels(decoder->private_->stream_decoder); +} + +FLAC_API FLAC__ChannelAssignment FLAC__seekable_stream_decoder_get_channel_assignment(const FLAC__SeekableStreamDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + return FLAC__stream_decoder_get_channel_assignment(decoder->private_->stream_decoder); +} + +FLAC_API unsigned FLAC__seekable_stream_decoder_get_bits_per_sample(const FLAC__SeekableStreamDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + return FLAC__stream_decoder_get_bits_per_sample(decoder->private_->stream_decoder); +} + +FLAC_API unsigned FLAC__seekable_stream_decoder_get_sample_rate(const FLAC__SeekableStreamDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + return FLAC__stream_decoder_get_sample_rate(decoder->private_->stream_decoder); +} + +FLAC_API unsigned FLAC__seekable_stream_decoder_get_blocksize(const FLAC__SeekableStreamDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + return FLAC__stream_decoder_get_blocksize(decoder->private_->stream_decoder); +} + +FLAC_API FLAC__bool FLAC__seekable_stream_decoder_get_decode_position(const FLAC__SeekableStreamDecoder *decoder, FLAC__uint64 *position) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != position); + + if(decoder->private_->tell_callback(decoder, position, decoder->private_->client_data) != FLAC__SEEKABLE_STREAM_DECODER_TELL_STATUS_OK) + return false; + FLAC__ASSERT(*position >= FLAC__stream_decoder_get_input_bytes_unconsumed(decoder->private_->stream_decoder)); + *position -= FLAC__stream_decoder_get_input_bytes_unconsumed(decoder->private_->stream_decoder); + return true; +} + +FLAC_API FLAC__bool FLAC__seekable_stream_decoder_flush(FLAC__SeekableStreamDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + + decoder->private_->do_md5_checking = false; + + if(!FLAC__stream_decoder_flush(decoder->private_->stream_decoder)) { + decoder->protected_->state = FLAC__SEEKABLE_STREAM_DECODER_STREAM_DECODER_ERROR; + return false; + } + + decoder->protected_->state = FLAC__SEEKABLE_STREAM_DECODER_OK; + + return true; +} + +FLAC_API FLAC__bool FLAC__seekable_stream_decoder_reset(FLAC__SeekableStreamDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + + if(!FLAC__seekable_stream_decoder_flush(decoder)) { + decoder->protected_->state = FLAC__SEEKABLE_STREAM_DECODER_STREAM_DECODER_ERROR; + return false; + } + + if(!FLAC__stream_decoder_reset(decoder->private_->stream_decoder)) { + decoder->protected_->state = FLAC__SEEKABLE_STREAM_DECODER_STREAM_DECODER_ERROR; + return false; + } + + decoder->private_->seek_table = 0; + + decoder->private_->do_md5_checking = decoder->protected_->md5_checking; + + /* We initialize the FLAC__MD5Context even though we may never use it. This + * is because md5 checking may be turned on to start and then turned off if + * a seek occurs. So we always init the context here and finalize it in + * FLAC__seekable_stream_decoder_finish() to make sure things are always + * cleaned up properly. + */ + FLAC__MD5Init(&decoder->private_->md5context); + + decoder->protected_->state = FLAC__SEEKABLE_STREAM_DECODER_OK; + + return true; +} + +FLAC_API FLAC__bool FLAC__seekable_stream_decoder_process_single(FLAC__SeekableStreamDecoder *decoder) +{ + FLAC__bool ret; + FLAC__ASSERT(0 != decoder); + + if(decoder->private_->stream_decoder->protected_->state == FLAC__STREAM_DECODER_END_OF_STREAM) + decoder->protected_->state = FLAC__SEEKABLE_STREAM_DECODER_END_OF_STREAM; + + if(decoder->protected_->state == FLAC__SEEKABLE_STREAM_DECODER_END_OF_STREAM) + return true; + + FLAC__ASSERT(decoder->protected_->state == FLAC__SEEKABLE_STREAM_DECODER_OK); + + ret = FLAC__stream_decoder_process_single(decoder->private_->stream_decoder); + if(!ret) + decoder->protected_->state = FLAC__SEEKABLE_STREAM_DECODER_STREAM_DECODER_ERROR; + + return ret; +} + +FLAC_API FLAC__bool FLAC__seekable_stream_decoder_process_until_end_of_metadata(FLAC__SeekableStreamDecoder *decoder) +{ + FLAC__bool ret; + FLAC__ASSERT(0 != decoder); + + if(decoder->private_->stream_decoder->protected_->state == FLAC__STREAM_DECODER_END_OF_STREAM) + decoder->protected_->state = FLAC__SEEKABLE_STREAM_DECODER_END_OF_STREAM; + + if(decoder->protected_->state == FLAC__SEEKABLE_STREAM_DECODER_END_OF_STREAM) + return true; + + FLAC__ASSERT(decoder->protected_->state == FLAC__SEEKABLE_STREAM_DECODER_OK); + + ret = FLAC__stream_decoder_process_until_end_of_metadata(decoder->private_->stream_decoder); + if(!ret) + decoder->protected_->state = FLAC__SEEKABLE_STREAM_DECODER_STREAM_DECODER_ERROR; + + return ret; +} + +FLAC_API FLAC__bool FLAC__seekable_stream_decoder_process_until_end_of_stream(FLAC__SeekableStreamDecoder *decoder) +{ + FLAC__bool ret; + FLAC__ASSERT(0 != decoder); + + if(decoder->private_->stream_decoder->protected_->state == FLAC__STREAM_DECODER_END_OF_STREAM) + decoder->protected_->state = FLAC__SEEKABLE_STREAM_DECODER_END_OF_STREAM; + + if(decoder->protected_->state == FLAC__SEEKABLE_STREAM_DECODER_END_OF_STREAM) + return true; + + FLAC__ASSERT(decoder->protected_->state == FLAC__SEEKABLE_STREAM_DECODER_OK); + + ret = FLAC__stream_decoder_process_until_end_of_stream(decoder->private_->stream_decoder); + if(!ret) + decoder->protected_->state = FLAC__SEEKABLE_STREAM_DECODER_STREAM_DECODER_ERROR; + + return ret; +} + +FLAC_API FLAC__bool FLAC__seekable_stream_decoder_skip_single_frame(FLAC__SeekableStreamDecoder *decoder) +{ + FLAC__bool ret; + FLAC__ASSERT(0 != decoder); + + if(decoder->private_->stream_decoder->protected_->state == FLAC__STREAM_DECODER_END_OF_STREAM) + decoder->protected_->state = FLAC__SEEKABLE_STREAM_DECODER_END_OF_STREAM; + + if(decoder->protected_->state == FLAC__SEEKABLE_STREAM_DECODER_END_OF_STREAM) + return true; + + FLAC__ASSERT(decoder->protected_->state == FLAC__SEEKABLE_STREAM_DECODER_OK); + + ret = FLAC__stream_decoder_skip_single_frame(decoder->private_->stream_decoder); + if(!ret) + decoder->protected_->state = FLAC__SEEKABLE_STREAM_DECODER_STREAM_DECODER_ERROR; + + return ret; +} + +FLAC_API FLAC__bool FLAC__seekable_stream_decoder_seek_absolute(FLAC__SeekableStreamDecoder *decoder, FLAC__uint64 sample) +{ + FLAC__uint64 length; + + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(decoder->protected_->state == FLAC__SEEKABLE_STREAM_DECODER_OK || decoder->protected_->state == FLAC__SEEKABLE_STREAM_DECODER_END_OF_STREAM); + + decoder->protected_->state = FLAC__SEEKABLE_STREAM_DECODER_SEEKING; + + /* turn off md5 checking if a seek is attempted */ + decoder->private_->do_md5_checking = false; + + if(!FLAC__stream_decoder_reset(decoder->private_->stream_decoder)) { + decoder->protected_->state = FLAC__SEEKABLE_STREAM_DECODER_STREAM_DECODER_ERROR; + return false; + } + /* get the file length */ + if(decoder->private_->length_callback(decoder, &length, decoder->private_->client_data) != FLAC__SEEKABLE_STREAM_DECODER_LENGTH_STATUS_OK) { + decoder->protected_->state = FLAC__SEEKABLE_STREAM_DECODER_SEEK_ERROR; + return false; + } + /* rewind */ + if(decoder->private_->seek_callback(decoder, 0, decoder->private_->client_data) != FLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_OK) { + decoder->protected_->state = FLAC__SEEKABLE_STREAM_DECODER_SEEK_ERROR; + return false; + } + if(!FLAC__stream_decoder_process_until_end_of_metadata(decoder->private_->stream_decoder)) { + decoder->protected_->state = FLAC__SEEKABLE_STREAM_DECODER_STREAM_DECODER_ERROR; + return false; + } + if(decoder->private_->stream_info.total_samples > 0 && sample >= decoder->private_->stream_info.total_samples) { + decoder->protected_->state = FLAC__SEEKABLE_STREAM_DECODER_SEEK_ERROR; + return false; + } + + return seek_to_absolute_sample_(decoder, length, sample); +} + +/*********************************************************************** + * + * Private class methods + * + ***********************************************************************/ + +void set_defaults_(FLAC__SeekableStreamDecoder *decoder) +{ + decoder->private_->read_callback = 0; + decoder->private_->seek_callback = 0; + decoder->private_->tell_callback = 0; + decoder->private_->length_callback = 0; + decoder->private_->eof_callback = 0; + decoder->private_->write_callback = 0; + decoder->private_->metadata_callback = 0; + decoder->private_->error_callback = 0; + decoder->private_->client_data = 0; + /* WATCHOUT: these should match the default behavior of FLAC__StreamDecoder */ + decoder->private_->ignore_stream_info_block = false; + decoder->private_->ignore_seek_table_block = true; + + decoder->protected_->md5_checking = false; +} + +FLAC__StreamDecoderReadStatus read_callback_(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], unsigned *bytes, void *client_data) +{ + FLAC__SeekableStreamDecoder *seekable_stream_decoder = (FLAC__SeekableStreamDecoder *)client_data; + (void)decoder; + if(seekable_stream_decoder->private_->eof_callback(seekable_stream_decoder, seekable_stream_decoder->private_->client_data)) { + *bytes = 0; +#if 0 + /*@@@@@@ verify that this is not needed */ + seekable_stream_decoder->protected_->state = FLAC__SEEKABLE_STREAM_DECODER_END_OF_STREAM; +#endif + return FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM; + } + else if(*bytes > 0) { + if(seekable_stream_decoder->private_->read_callback(seekable_stream_decoder, buffer, bytes, seekable_stream_decoder->private_->client_data) != FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_OK) { + seekable_stream_decoder->protected_->state = FLAC__SEEKABLE_STREAM_DECODER_READ_ERROR; + return FLAC__STREAM_DECODER_READ_STATUS_ABORT; + } + if(*bytes == 0) { + if(seekable_stream_decoder->private_->eof_callback(seekable_stream_decoder, seekable_stream_decoder->private_->client_data)) { +#if 0 + /*@@@@@@ verify that this is not needed */ + seekable_stream_decoder->protected_->state = FLAC__SEEKABLE_STREAM_DECODER_END_OF_STREAM; +#endif + return FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM; + } + else + return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE; + } + else { + return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE; + } + } + else + return FLAC__STREAM_DECODER_READ_STATUS_ABORT; /* abort to avoid a deadlock */ +} + +FLAC__StreamDecoderWriteStatus write_callback_(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data) +{ + FLAC__SeekableStreamDecoder *seekable_stream_decoder = (FLAC__SeekableStreamDecoder *)client_data; + (void)decoder; + + if(seekable_stream_decoder->protected_->state == FLAC__SEEKABLE_STREAM_DECODER_SEEKING) { + FLAC__uint64 this_frame_sample = frame->header.number.sample_number; + FLAC__uint64 next_frame_sample = this_frame_sample + (FLAC__uint64)frame->header.blocksize; + FLAC__uint64 target_sample = seekable_stream_decoder->private_->target_sample; + + FLAC__ASSERT(frame->header.number_type == FLAC__FRAME_NUMBER_TYPE_SAMPLE_NUMBER); + + seekable_stream_decoder->private_->last_frame = *frame; /* save the frame */ + if(this_frame_sample <= target_sample && target_sample < next_frame_sample) { /* we hit our target frame */ + unsigned delta = (unsigned)(target_sample - this_frame_sample); + /* kick out of seek mode */ + seekable_stream_decoder->protected_->state = FLAC__SEEKABLE_STREAM_DECODER_OK; + /* shift out the samples before target_sample */ + if(delta > 0) { + unsigned channel; + const FLAC__int32 *newbuffer[FLAC__MAX_CHANNELS]; + for(channel = 0; channel < frame->header.channels; channel++) + newbuffer[channel] = buffer[channel] + delta; + seekable_stream_decoder->private_->last_frame.header.blocksize -= delta; + seekable_stream_decoder->private_->last_frame.header.number.sample_number += (FLAC__uint64)delta; + /* write the relevant samples */ + return seekable_stream_decoder->private_->write_callback(seekable_stream_decoder, &seekable_stream_decoder->private_->last_frame, newbuffer, seekable_stream_decoder->private_->client_data); + } + else { + /* write the relevant samples */ + return seekable_stream_decoder->private_->write_callback(seekable_stream_decoder, frame, buffer, seekable_stream_decoder->private_->client_data); + } + } + else { + return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE; + } + } + else { + if(seekable_stream_decoder->private_->do_md5_checking) { + if(!FLAC__MD5Accumulate(&seekable_stream_decoder->private_->md5context, buffer, frame->header.channels, frame->header.blocksize, (frame->header.bits_per_sample+7) / 8)) + return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT; + } + return seekable_stream_decoder->private_->write_callback(seekable_stream_decoder, frame, buffer, seekable_stream_decoder->private_->client_data); + } +} + +void metadata_callback_(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data) +{ + FLAC__SeekableStreamDecoder *seekable_stream_decoder = (FLAC__SeekableStreamDecoder *)client_data; + (void)decoder; + + if(metadata->type == FLAC__METADATA_TYPE_STREAMINFO) { + seekable_stream_decoder->private_->stream_info = metadata->data.stream_info; + /* save the MD5 signature for comparison later */ + memcpy(seekable_stream_decoder->private_->stored_md5sum, metadata->data.stream_info.md5sum, 16); + if(0 == memcmp(seekable_stream_decoder->private_->stored_md5sum, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 16)) + seekable_stream_decoder->private_->do_md5_checking = false; + } + else if(metadata->type == FLAC__METADATA_TYPE_SEEKTABLE) { + seekable_stream_decoder->private_->seek_table = &metadata->data.seek_table; + } + + if(seekable_stream_decoder->protected_->state != FLAC__SEEKABLE_STREAM_DECODER_SEEKING) { + FLAC__bool ignore_block = false; + if(metadata->type == FLAC__METADATA_TYPE_STREAMINFO && seekable_stream_decoder->private_->ignore_stream_info_block) + ignore_block = true; + else if(metadata->type == FLAC__METADATA_TYPE_SEEKTABLE && seekable_stream_decoder->private_->ignore_seek_table_block) + ignore_block = true; + if(!ignore_block) + seekable_stream_decoder->private_->metadata_callback(seekable_stream_decoder, metadata, seekable_stream_decoder->private_->client_data); + } +} + +void error_callback_(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data) +{ + FLAC__SeekableStreamDecoder *seekable_stream_decoder = (FLAC__SeekableStreamDecoder *)client_data; + (void)decoder; + + if(seekable_stream_decoder->protected_->state != FLAC__SEEKABLE_STREAM_DECODER_SEEKING) + seekable_stream_decoder->private_->error_callback(seekable_stream_decoder, status, seekable_stream_decoder->private_->client_data); +} + +FLAC__bool seek_to_absolute_sample_(FLAC__SeekableStreamDecoder *decoder, FLAC__uint64 stream_length, FLAC__uint64 target_sample) +{ + FLAC__uint64 first_frame_offset, lower_bound, upper_bound; + FLAC__int64 pos = -1, last_pos = -1; + int i, lower_seek_point = -1, upper_seek_point = -1; + unsigned approx_bytes_per_frame; + FLAC__uint64 last_frame_sample = FLAC__U64L(0xffffffffffffffff); + FLAC__bool needs_seek; + const FLAC__uint64 total_samples = decoder->private_->stream_info.total_samples; + const unsigned min_blocksize = decoder->private_->stream_info.min_blocksize; + const unsigned max_blocksize = decoder->private_->stream_info.max_blocksize; + const unsigned max_framesize = decoder->private_->stream_info.max_framesize; + const unsigned channels = FLAC__seekable_stream_decoder_get_channels(decoder); + const unsigned bps = FLAC__seekable_stream_decoder_get_bits_per_sample(decoder); + + /* we are just guessing here, but we want to guess high, not low */ + if(max_framesize > 0) { + approx_bytes_per_frame = max_framesize; + } + /* + * Check if it's a known fixed-blocksize stream. Note that though + * the spec doesn't allow zeroes in the STREAMINFO block, we may + * never get a STREAMINFO block when decoding so the value of + * min_blocksize might be zero. + */ + else if(min_blocksize == max_blocksize && min_blocksize > 0) { + /* note there are no () around 'bps/8' to keep precision up since it's an integer calulation */ + approx_bytes_per_frame = min_blocksize * channels * bps/8 + 64; + } + else + approx_bytes_per_frame = 4608 * channels * bps/8 + 64; + + /* + * The decode position is currently at the first frame since we + * rewound and processed metadata. + */ + if(!FLAC__seekable_stream_decoder_get_decode_position(decoder, &first_frame_offset)) { + decoder->protected_->state = FLAC__SEEKABLE_STREAM_DECODER_SEEK_ERROR; + return false; + } + + /* + * First, we set an upper and lower bound on where in the + * stream we will search. For now we assume the worst case + * scenario, which is our best guess at the beginning of + * the first and last frames. + */ + lower_bound = first_frame_offset; + + /* calc the upper_bound, beyond which we never want to seek */ + if(max_framesize > 0) + upper_bound = stream_length - (max_framesize + 128 + 2); /* 128 for a possible ID3V1 tag, 2 for indexing differences */ + else + upper_bound = stream_length - ((channels * bps * FLAC__MAX_BLOCK_SIZE) / 8 + 128 + 2); + + /* + * Now we refine the bounds if we have a seektable with + * suitable points. Note that according to the spec they + * must be ordered by ascending sample number. + */ + if(0 != decoder->private_->seek_table) { + /* find the closest seek point <= target_sample, if it exists */ + for(i = (int)decoder->private_->seek_table->num_points - 1; i >= 0; i--) { + if(decoder->private_->seek_table->points[i].sample_number != FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER && decoder->private_->seek_table->points[i].sample_number <= target_sample) + break; + } + if(i >= 0) { /* i.e. we found a suitable seek point... */ + lower_bound = first_frame_offset + decoder->private_->seek_table->points[i].stream_offset; + lower_seek_point = i; + } + + /* find the closest seek point > target_sample, if it exists */ + for(i = 0; i < (int)decoder->private_->seek_table->num_points; i++) { + if(decoder->private_->seek_table->points[i].sample_number != FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER && decoder->private_->seek_table->points[i].sample_number > target_sample) + break; + } + if(i < (int)decoder->private_->seek_table->num_points) { /* i.e. we found a suitable seek point... */ + upper_bound = first_frame_offset + decoder->private_->seek_table->points[i].stream_offset; + upper_seek_point = i; + } + } + + /* + * Now guess at where within those bounds our target + * sample will be. + */ + if(lower_seek_point >= 0) { + /* first see if our sample is within a few frames of the lower seekpoint */ + if(decoder->private_->seek_table->points[lower_seek_point].sample_number <= target_sample && target_sample < decoder->private_->seek_table->points[lower_seek_point].sample_number + (decoder->private_->seek_table->points[lower_seek_point].frame_samples * 4)) { + pos = (FLAC__int64)lower_bound; + } + else if(upper_seek_point >= 0) { + const FLAC__uint64 target_offset = target_sample - decoder->private_->seek_table->points[lower_seek_point].sample_number; + const FLAC__uint64 range_samples = decoder->private_->seek_table->points[upper_seek_point].sample_number - decoder->private_->seek_table->points[lower_seek_point].sample_number; + const FLAC__uint64 range_bytes = (upper_bound>lower_bound? upper_bound - lower_bound - 1 : 0); +#ifndef FLAC__INTEGER_ONLY_LIBRARY +#if defined _MSC_VER || defined __MINGW32__ + /* with MSVC you have to spoon feed it the casting */ + pos = (FLAC__int64)lower_bound + (FLAC__int64)(((FLAC__double)(FLAC__int64)target_offset / (FLAC__double)(FLAC__int64)range_samples) * (FLAC__double)(FLAC__int64)(range_bytes-1)) - approx_bytes_per_frame; +#else + pos = (FLAC__int64)lower_bound + (FLAC__int64)(((FLAC__double)target_offset / (FLAC__double)range_samples) * (FLAC__double)range_bytes) - approx_bytes_per_frame; +#endif +#else + /* a little less accurate: */ + if (range_bytes <= 0xffffffff) + pos = (FLAC__int64)lower_bound + (FLAC__int64)((target_offset * range_bytes) / range_samples) - approx_bytes_per_frame; + else /* @@@ WATCHOUT, ~2TB limit */ + pos = (FLAC__int64)lower_bound + (FLAC__int64)(((target_offset>>8) * (range_bytes>>8)) / (range_samples>>16)) - approx_bytes_per_frame; +#endif + } + } + + /* + * If there's no seek table, we need to use the metadata (if we + * have it) and the filelength to estimate the position of the + * frame with the correct sample. + */ + if(pos < 0 && total_samples > 0) { + /* + * For max accuracy we should be using + * (stream_length-first_frame_offset-1) in the divisor, but the + * difference is trivial and (stream_length-first_frame_offset) + * has no chance of underflow. + */ +#ifndef FLAC__INTEGER_ONLY_LIBRARY +#if defined _MSC_VER || defined __MINGW32__ + /* with VC++ you have to spoon feed it the casting */ + pos = (FLAC__int64)first_frame_offset + (FLAC__int64)(((FLAC__double)(FLAC__int64)target_sample / (FLAC__double)(FLAC__int64)total_samples) * (FLAC__double)(FLAC__int64)(stream_length-first_frame_offset)) - approx_bytes_per_frame; +#else + pos = (FLAC__int64)first_frame_offset + (FLAC__int64)(((FLAC__double)target_sample / (FLAC__double)total_samples) * (FLAC__double)(stream_length-first_frame_offset)) - approx_bytes_per_frame; +#endif +#else + /* a little less accurate: */ + if (stream_length < 0xffffffff) + pos = (FLAC__int64)first_frame_offset + (FLAC__int64)((target_sample * (stream_length-first_frame_offset)) / total_samples) - approx_bytes_per_frame; + else /* @@@ WATCHOUT, ~2TB limit */ + pos = (FLAC__int64)first_frame_offset + (FLAC__int64)(((target_sample>>8) * ((stream_length-first_frame_offset)>>8)) / (total_samples>>16)) - approx_bytes_per_frame; +#endif + } + + /* + * If there's no seek table and total_samples is unknown, we + * don't even bother trying to figure out a target, we just use + * our current position. + */ + if(pos < 0) { + FLAC__uint64 upos; + if(decoder->private_->tell_callback(decoder, &upos, decoder->private_->client_data) != FLAC__SEEKABLE_STREAM_DECODER_TELL_STATUS_OK) { + decoder->protected_->state = FLAC__SEEKABLE_STREAM_DECODER_SEEK_ERROR; + return false; + } + pos = (FLAC__int64)upos; + needs_seek = false; + } + else + needs_seek = true; + + /* clip the position to the bounds, lower bound takes precedence */ + if(pos >= (FLAC__int64)upper_bound) { + pos = (FLAC__int64)upper_bound-1; + needs_seek = true; + } + if(pos < (FLAC__int64)lower_bound) { + pos = (FLAC__int64)lower_bound; + needs_seek = true; + } + + decoder->private_->target_sample = target_sample; + while(1) { + if(needs_seek) { + if(decoder->private_->seek_callback(decoder, (FLAC__uint64)pos, decoder->private_->client_data) != FLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_OK) { + decoder->protected_->state = FLAC__SEEKABLE_STREAM_DECODER_SEEK_ERROR; + return false; + } + if(!FLAC__stream_decoder_flush(decoder->private_->stream_decoder)) { + decoder->protected_->state = FLAC__SEEKABLE_STREAM_DECODER_STREAM_DECODER_ERROR; + return false; + } + } + /* Now we need to get a frame. It is possible for our seek + * to land in the middle of audio data that looks exactly like + * a frame header from a future version of an encoder. When + * that happens, FLAC__stream_decoder_process_single() will + * return false and the state will be + * FLAC__STREAM_DECODER_UNPARSEABLE_STREAM. But there is a + * remote possibility that it is properly synced at such a + * "future-codec frame", so to make sure, we wait to see + * several "unparseable" errors in a row before bailing out. + */ + { + unsigned unparseable_count; + FLAC__bool got_a_frame = false; + for (unparseable_count = 0; !got_a_frame && unparseable_count < 10; unparseable_count++) { + if(FLAC__stream_decoder_process_single(decoder->private_->stream_decoder)) + got_a_frame = true; + else if(decoder->private_->stream_decoder->protected_->state == FLAC__STREAM_DECODER_UNPARSEABLE_STREAM) + /* try again. we don't want to flush the decoder since that clears the bitbuffer */ + decoder->private_->stream_decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC; + else /* it's a real error */ + break; + } + if (!got_a_frame) { + decoder->protected_->state = FLAC__SEEKABLE_STREAM_DECODER_SEEK_ERROR; + return false; + } + } + /* our write callback will change the state when it gets to the target frame */ + /* actually, we could have got_a_frame if our decoder is at FLAC__SEEKABLE_STREAM_DECODER_END_OF_STREAM so we need to check for that also */ + if(decoder->protected_->state != FLAC__SEEKABLE_STREAM_DECODER_SEEKING && decoder->protected_->state != FLAC__SEEKABLE_STREAM_DECODER_END_OF_STREAM) { + break; + } + else { /* we need to narrow the search */ + const FLAC__uint64 this_frame_sample = decoder->private_->last_frame.header.number.sample_number; + FLAC__ASSERT(decoder->private_->last_frame.header.number_type == FLAC__FRAME_NUMBER_TYPE_SAMPLE_NUMBER); + if(this_frame_sample == last_frame_sample && pos < last_pos) { + /* our last move backwards wasn't big enough, double it */ + pos -= (last_pos - pos); + needs_seek = true; + } + else { + if(target_sample < this_frame_sample) { + last_pos = pos; + approx_bytes_per_frame = decoder->private_->last_frame.header.blocksize * channels * bps/8 + 64; + pos -= approx_bytes_per_frame; + needs_seek = true; + } + else { /* target_sample >= this_frame_sample + this frame's blocksize */ + FLAC__uint64 upos; + if(decoder->private_->tell_callback(decoder, &upos, decoder->private_->client_data) != FLAC__SEEKABLE_STREAM_DECODER_TELL_STATUS_OK) { + decoder->protected_->state = FLAC__SEEKABLE_STREAM_DECODER_SEEK_ERROR; + return false; + } + last_pos = pos; + pos = (FLAC__int64)upos; + pos -= FLAC__stream_decoder_get_input_bytes_unconsumed(decoder->private_->stream_decoder); + needs_seek = false; + /* + * if we haven't hit the target frame yet and our position hasn't changed, + * it means we're at the end of the stream and the seek target does not exist. + */ + if(last_pos == pos) { + decoder->protected_->state = FLAC__SEEKABLE_STREAM_DECODER_SEEK_ERROR; + return false; + } + } + } + if(pos < (FLAC__int64)lower_bound) + pos = (FLAC__int64)lower_bound; + last_frame_sample = this_frame_sample; + } + } + + return true; +} diff --git a/Libraries/FLAC/Files/src/libFLAC/seekable_stream_encoder.c b/Libraries/FLAC/Files/src/libFLAC/seekable_stream_encoder.c new file mode 100644 index 000000000..18291a805 --- /dev/null +++ b/Libraries/FLAC/Files/src/libFLAC/seekable_stream_encoder.c @@ -0,0 +1,943 @@ +/* libFLAC - Free Lossless Audio Codec library + * Copyright (C) 2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include /* for calloc() */ +#include /* for memcpy() */ +#include "FLAC/assert.h" +#include "protected/seekable_stream_encoder.h" + +#ifdef max +#undef max +#endif +#define max(a,b) ((a)>(b)?(a):(b)) + +/*********************************************************************** + * + * Private class method prototypes + * + ***********************************************************************/ + +/* unpublished debug routines */ +extern FLAC__bool FLAC__stream_encoder_disable_constant_subframes(FLAC__StreamEncoder *encoder, FLAC__bool value); +extern FLAC__bool FLAC__stream_encoder_disable_fixed_subframes(FLAC__StreamEncoder *encoder, FLAC__bool value); +extern FLAC__bool FLAC__stream_encoder_disable_verbatim_subframes(FLAC__StreamEncoder *encoder, FLAC__bool value); + +static void set_defaults_(FLAC__SeekableStreamEncoder *encoder); +static FLAC__StreamEncoderWriteStatus write_callback_(const FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame, void *client_data); +static void metadata_callback_(const FLAC__StreamEncoder *encoder, const FLAC__StreamMetadata *metadata, void *client_data); + +/*********************************************************************** + * + * Private class data + * + ***********************************************************************/ + +typedef struct FLAC__SeekableStreamEncoderPrivate { + FLAC__SeekableStreamEncoderSeekCallback seek_callback; + FLAC__SeekableStreamEncoderTellCallback tell_callback; + FLAC__SeekableStreamEncoderWriteCallback write_callback; + void *client_data; + FLAC__StreamEncoder *stream_encoder; + FLAC__StreamMetadata_SeekTable *seek_table; + /* internal vars (all the above are class settings) */ + unsigned first_seekpoint_to_check; + FLAC__uint64 samples_written; +} FLAC__SeekableStreamEncoderPrivate; + +/*********************************************************************** + * + * Public static class data + * + ***********************************************************************/ + +FLAC_API const char * const FLAC__SeekableStreamEncoderStateString[] = { + "FLAC__SEEKABLE_STREAM_ENCODER_OK", + "FLAC__SEEKABLE_STREAM_ENCODER_STREAM_ENCODER_ERROR", + "FLAC__SEEKABLE_STREAM_ENCODER_MEMORY_ALLOCATION_ERROR", + "FLAC__SEEKABLE_STREAM_ENCODER_WRITE_ERROR", + "FLAC__SEEKABLE_STREAM_ENCODER_READ_ERROR", + "FLAC__SEEKABLE_STREAM_ENCODER_SEEK_ERROR", + "FLAC__SEEKABLE_STREAM_ENCODER_TELL_ERROR", + "FLAC__SEEKABLE_STREAM_ENCODER_ALREADY_INITIALIZED", + "FLAC__SEEKABLE_STREAM_ENCODER_INVALID_CALLBACK", + "FLAC__SEEKABLE_STREAM_ENCODER_INVALID_SEEKTABLE", + "FLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED" +}; + +FLAC_API const char * const FLAC__SeekableStreamEncoderSeekStatusString[] = { + "FLAC__SEEKABLE_STREAM_ENCODER_SEEK_STATUS_OK", + "FLAC__SEEKABLE_STREAM_ENCODER_SEEK_STATUS_ERROR" +}; + +FLAC_API const char * const FLAC__SeekableStreamEncoderTellStatusString[] = { + "FLAC__SEEKABLE_STREAM_ENCODER_TELL_STATUS_OK", + "FLAC__SEEKABLE_STREAM_ENCODER_TELL_STATUS_ERROR" +}; + + +/*********************************************************************** + * + * Class constructor/destructor + * + ***********************************************************************/ + +FLAC_API FLAC__SeekableStreamEncoder *FLAC__seekable_stream_encoder_new() +{ + FLAC__SeekableStreamEncoder *encoder; + + FLAC__ASSERT(sizeof(int) >= 4); /* we want to die right away if this is not true */ + + encoder = (FLAC__SeekableStreamEncoder*)calloc(1, sizeof(FLAC__SeekableStreamEncoder)); + if(encoder == 0) { + return 0; + } + + encoder->protected_ = (FLAC__SeekableStreamEncoderProtected*)calloc(1, sizeof(FLAC__SeekableStreamEncoderProtected)); + if(encoder->protected_ == 0) { + free(encoder); + return 0; + } + + encoder->private_ = (FLAC__SeekableStreamEncoderPrivate*)calloc(1, sizeof(FLAC__SeekableStreamEncoderPrivate)); + if(encoder->private_ == 0) { + free(encoder->protected_); + free(encoder); + return 0; + } + + encoder->private_->stream_encoder = FLAC__stream_encoder_new(); + if(0 == encoder->private_->stream_encoder) { + free(encoder->private_); + free(encoder->protected_); + free(encoder); + return 0; + } + + set_defaults_(encoder); + + encoder->protected_->state = FLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED; + + return encoder; +} + +FLAC_API void FLAC__seekable_stream_encoder_delete(FLAC__SeekableStreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->private_->stream_encoder); + + (void)FLAC__seekable_stream_encoder_finish(encoder); + + FLAC__stream_encoder_delete(encoder->private_->stream_encoder); + + free(encoder->private_); + free(encoder->protected_); + free(encoder); +} + + +/*********************************************************************** + * + * Public class methods + * + ***********************************************************************/ + +FLAC_API FLAC__SeekableStreamEncoderState FLAC__seekable_stream_encoder_init(FLAC__SeekableStreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + + if(encoder->protected_->state != FLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED) + return encoder->protected_->state = FLAC__SEEKABLE_STREAM_ENCODER_ALREADY_INITIALIZED; + + if(0 == encoder->private_->seek_callback || 0 == encoder->private_->tell_callback || 0 == encoder->private_->write_callback) + return encoder->protected_->state = FLAC__SEEKABLE_STREAM_ENCODER_INVALID_CALLBACK; + + if(0 != encoder->private_->seek_table && !FLAC__format_seektable_is_legal(encoder->private_->seek_table)) + return encoder->protected_->state = FLAC__SEEKABLE_STREAM_ENCODER_INVALID_SEEKTABLE; + + /* + * These must be done before we init the stream encoder because that + * calls the write_callback, which uses these values. + */ + encoder->private_->first_seekpoint_to_check = 0; + encoder->private_->samples_written = 0; + encoder->protected_->streaminfo_offset = 0; + encoder->protected_->seektable_offset = 0; + encoder->protected_->audio_offset = 0; + + FLAC__stream_encoder_set_write_callback(encoder->private_->stream_encoder, write_callback_); + FLAC__stream_encoder_set_metadata_callback(encoder->private_->stream_encoder, metadata_callback_); + FLAC__stream_encoder_set_client_data(encoder->private_->stream_encoder, encoder); + + if(FLAC__stream_encoder_init(encoder->private_->stream_encoder) != FLAC__STREAM_ENCODER_OK) + return encoder->protected_->state = FLAC__SEEKABLE_STREAM_ENCODER_STREAM_ENCODER_ERROR; + + /* + * Initializing the stream encoder writes all the metadata, so we + * save the stream offset now. + */ + if(encoder->private_->tell_callback(encoder, &encoder->protected_->audio_offset, encoder->private_->client_data) != FLAC__SEEKABLE_STREAM_ENCODER_TELL_STATUS_OK) + return encoder->protected_->state = FLAC__SEEKABLE_STREAM_ENCODER_TELL_ERROR; + + return encoder->protected_->state = FLAC__SEEKABLE_STREAM_ENCODER_OK; +} + +FLAC_API void FLAC__seekable_stream_encoder_finish(FLAC__SeekableStreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + + if(encoder->protected_->state == FLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED) + return; + + FLAC__ASSERT(0 != encoder->private_->stream_encoder); + + FLAC__stream_encoder_finish(encoder->private_->stream_encoder); + + set_defaults_(encoder); + + encoder->protected_->state = FLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED; +} + +FLAC_API FLAC__bool FLAC__seekable_stream_encoder_set_verify(FLAC__SeekableStreamEncoder *encoder, FLAC__bool value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->stream_encoder); + if(encoder->protected_->state != FLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED) + return false; + return FLAC__stream_encoder_set_verify(encoder->private_->stream_encoder, value); +} + +FLAC_API FLAC__bool FLAC__seekable_stream_encoder_set_streamable_subset(FLAC__SeekableStreamEncoder *encoder, FLAC__bool value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->stream_encoder); + if(encoder->protected_->state != FLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED) + return false; + return FLAC__stream_encoder_set_streamable_subset(encoder->private_->stream_encoder, value); +} + +FLAC_API FLAC__bool FLAC__seekable_stream_encoder_set_do_mid_side_stereo(FLAC__SeekableStreamEncoder *encoder, FLAC__bool value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->stream_encoder); + if(encoder->protected_->state != FLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED) + return false; + return FLAC__stream_encoder_set_do_mid_side_stereo(encoder->private_->stream_encoder, value); +} + +FLAC_API FLAC__bool FLAC__seekable_stream_encoder_set_loose_mid_side_stereo(FLAC__SeekableStreamEncoder *encoder, FLAC__bool value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->stream_encoder); + if(encoder->protected_->state != FLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED) + return false; + return FLAC__stream_encoder_set_loose_mid_side_stereo(encoder->private_->stream_encoder, value); +} + +FLAC_API FLAC__bool FLAC__seekable_stream_encoder_set_channels(FLAC__SeekableStreamEncoder *encoder, unsigned value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->stream_encoder); + if(encoder->protected_->state != FLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED) + return false; + return FLAC__stream_encoder_set_channels(encoder->private_->stream_encoder, value); +} + +FLAC_API FLAC__bool FLAC__seekable_stream_encoder_set_bits_per_sample(FLAC__SeekableStreamEncoder *encoder, unsigned value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->stream_encoder); + if(encoder->protected_->state != FLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED) + return false; + return FLAC__stream_encoder_set_bits_per_sample(encoder->private_->stream_encoder, value); +} + +FLAC_API FLAC__bool FLAC__seekable_stream_encoder_set_sample_rate(FLAC__SeekableStreamEncoder *encoder, unsigned value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->stream_encoder); + if(encoder->protected_->state != FLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED) + return false; + return FLAC__stream_encoder_set_sample_rate(encoder->private_->stream_encoder, value); +} + +FLAC_API FLAC__bool FLAC__seekable_stream_encoder_set_blocksize(FLAC__SeekableStreamEncoder *encoder, unsigned value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->stream_encoder); + if(encoder->protected_->state != FLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED) + return false; + return FLAC__stream_encoder_set_blocksize(encoder->private_->stream_encoder, value); +} + +FLAC_API FLAC__bool FLAC__seekable_stream_encoder_set_max_lpc_order(FLAC__SeekableStreamEncoder *encoder, unsigned value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->stream_encoder); + if(encoder->protected_->state != FLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED) + return false; + return FLAC__stream_encoder_set_max_lpc_order(encoder->private_->stream_encoder, value); +} + +FLAC_API FLAC__bool FLAC__seekable_stream_encoder_set_qlp_coeff_precision(FLAC__SeekableStreamEncoder *encoder, unsigned value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->stream_encoder); + if(encoder->protected_->state != FLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED) + return false; + return FLAC__stream_encoder_set_qlp_coeff_precision(encoder->private_->stream_encoder, value); +} + +FLAC_API FLAC__bool FLAC__seekable_stream_encoder_set_do_qlp_coeff_prec_search(FLAC__SeekableStreamEncoder *encoder, FLAC__bool value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->stream_encoder); + if(encoder->protected_->state != FLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED) + return false; + return FLAC__stream_encoder_set_do_qlp_coeff_prec_search(encoder->private_->stream_encoder, value); +} + +FLAC_API FLAC__bool FLAC__seekable_stream_encoder_set_do_escape_coding(FLAC__SeekableStreamEncoder *encoder, FLAC__bool value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->stream_encoder); + if(encoder->protected_->state != FLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED) + return false; + return FLAC__stream_encoder_set_do_escape_coding(encoder->private_->stream_encoder, value); +} + +FLAC_API FLAC__bool FLAC__seekable_stream_encoder_set_do_exhaustive_model_search(FLAC__SeekableStreamEncoder *encoder, FLAC__bool value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->stream_encoder); + if(encoder->protected_->state != FLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED) + return false; + return FLAC__stream_encoder_set_do_exhaustive_model_search(encoder->private_->stream_encoder, value); +} + +FLAC_API FLAC__bool FLAC__seekable_stream_encoder_set_min_residual_partition_order(FLAC__SeekableStreamEncoder *encoder, unsigned value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->stream_encoder); + if(encoder->protected_->state != FLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED) + return false; + return FLAC__stream_encoder_set_min_residual_partition_order(encoder->private_->stream_encoder, value); +} + +FLAC_API FLAC__bool FLAC__seekable_stream_encoder_set_max_residual_partition_order(FLAC__SeekableStreamEncoder *encoder, unsigned value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->stream_encoder); + if(encoder->protected_->state != FLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED) + return false; + return FLAC__stream_encoder_set_max_residual_partition_order(encoder->private_->stream_encoder, value); +} + +FLAC_API FLAC__bool FLAC__seekable_stream_encoder_set_rice_parameter_search_dist(FLAC__SeekableStreamEncoder *encoder, unsigned value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->stream_encoder); + if(encoder->protected_->state != FLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED) + return false; + return FLAC__stream_encoder_set_rice_parameter_search_dist(encoder->private_->stream_encoder, value); +} + +FLAC_API FLAC__bool FLAC__seekable_stream_encoder_set_total_samples_estimate(FLAC__SeekableStreamEncoder *encoder, FLAC__uint64 value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->stream_encoder); + if(encoder->protected_->state != FLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED) + return false; + return FLAC__stream_encoder_set_total_samples_estimate(encoder->private_->stream_encoder, value); +} + +FLAC_API FLAC__bool FLAC__seekable_stream_encoder_set_metadata(FLAC__SeekableStreamEncoder *encoder, FLAC__StreamMetadata **metadata, unsigned num_blocks) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->stream_encoder); + if(encoder->protected_->state != FLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED) + return false; + if(0 != metadata && num_blocks > 0) { + unsigned i; + for(i = 0; i < num_blocks; i++) { + if(0 != metadata[i] && metadata[i]->type == FLAC__METADATA_TYPE_SEEKTABLE) { + encoder->private_->seek_table = &metadata[i]->data.seek_table; + break; /* take only the first one */ + } + } + } + return FLAC__stream_encoder_set_metadata(encoder->private_->stream_encoder, metadata, num_blocks); +} + +FLAC_API FLAC__bool FLAC__seekable_stream_encoder_set_seek_callback(FLAC__SeekableStreamEncoder *encoder, FLAC__SeekableStreamEncoderSeekCallback value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + if(encoder->protected_->state != FLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED) + return false; + encoder->private_->seek_callback = value; + return true; +} + +FLAC_API FLAC__bool FLAC__seekable_stream_encoder_set_tell_callback(FLAC__SeekableStreamEncoder *encoder, FLAC__SeekableStreamEncoderTellCallback value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + if(encoder->protected_->state != FLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED) + return false; + encoder->private_->tell_callback = value; + return true; +} + +FLAC_API FLAC__bool FLAC__seekable_stream_encoder_set_write_callback(FLAC__SeekableStreamEncoder *encoder, FLAC__SeekableStreamEncoderWriteCallback value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + if(encoder->protected_->state != FLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED) + return false; + encoder->private_->write_callback = value; + return true; +} + +FLAC_API FLAC__bool FLAC__seekable_stream_encoder_set_client_data(FLAC__SeekableStreamEncoder *encoder, void *value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + if(encoder->protected_->state != FLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED) + return false; + encoder->private_->client_data = value; + return true; +} + +/* + * These three functions are not static, but not publically exposed in + * include/FLAC/ either. They are used by the test suite. + */ +FLAC_API FLAC__bool FLAC__seekable_stream_encoder_disable_constant_subframes(FLAC__SeekableStreamEncoder *encoder, FLAC__bool value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + if(encoder->protected_->state != FLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED) + return false; + return FLAC__stream_encoder_disable_constant_subframes(encoder->private_->stream_encoder, value); +} + +FLAC_API FLAC__bool FLAC__seekable_stream_encoder_disable_fixed_subframes(FLAC__SeekableStreamEncoder *encoder, FLAC__bool value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + if(encoder->protected_->state != FLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED) + return false; + return FLAC__stream_encoder_disable_fixed_subframes(encoder->private_->stream_encoder, value); +} + +FLAC_API FLAC__bool FLAC__seekable_stream_encoder_disable_verbatim_subframes(FLAC__SeekableStreamEncoder *encoder, FLAC__bool value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + if(encoder->protected_->state != FLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED) + return false; + return FLAC__stream_encoder_disable_verbatim_subframes(encoder->private_->stream_encoder, value); +} + +FLAC_API FLAC__SeekableStreamEncoderState FLAC__seekable_stream_encoder_get_state(const FLAC__SeekableStreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->protected_); + return encoder->protected_->state; +} + +FLAC_API FLAC__StreamEncoderState FLAC__seekable_stream_encoder_get_stream_encoder_state(const FLAC__SeekableStreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + return FLAC__stream_encoder_get_state(encoder->private_->stream_encoder); +} + +FLAC_API FLAC__StreamDecoderState FLAC__seekable_stream_encoder_get_verify_decoder_state(const FLAC__SeekableStreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + return FLAC__stream_encoder_get_verify_decoder_state(encoder->private_->stream_encoder); +} + +FLAC_API const char *FLAC__seekable_stream_encoder_get_resolved_state_string(const FLAC__SeekableStreamEncoder *encoder) +{ + if(encoder->protected_->state != FLAC__SEEKABLE_STREAM_ENCODER_STREAM_ENCODER_ERROR) + return FLAC__SeekableStreamEncoderStateString[encoder->protected_->state]; + else + return FLAC__stream_encoder_get_resolved_state_string(encoder->private_->stream_encoder); +} + +FLAC_API void FLAC__seekable_stream_encoder_get_verify_decoder_error_stats(const FLAC__SeekableStreamEncoder *encoder, FLAC__uint64 *absolute_sample, unsigned *frame_number, unsigned *channel, unsigned *sample, FLAC__int32 *expected, FLAC__int32 *got) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__stream_encoder_get_verify_decoder_error_stats(encoder->private_->stream_encoder, absolute_sample, frame_number, channel, sample, expected, got); +} + +FLAC_API FLAC__bool FLAC__seekable_stream_encoder_get_verify(const FLAC__SeekableStreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + return FLAC__stream_encoder_get_verify(encoder->private_->stream_encoder); +} + +FLAC_API FLAC__bool FLAC__seekable_stream_encoder_get_streamable_subset(const FLAC__SeekableStreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + return FLAC__stream_encoder_get_streamable_subset(encoder->private_->stream_encoder); +} + +FLAC_API FLAC__bool FLAC__seekable_stream_encoder_get_do_mid_side_stereo(const FLAC__SeekableStreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + return FLAC__stream_encoder_get_do_mid_side_stereo(encoder->private_->stream_encoder); +} + +FLAC_API FLAC__bool FLAC__seekable_stream_encoder_get_loose_mid_side_stereo(const FLAC__SeekableStreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + return FLAC__stream_encoder_get_loose_mid_side_stereo(encoder->private_->stream_encoder); +} + +FLAC_API unsigned FLAC__seekable_stream_encoder_get_channels(const FLAC__SeekableStreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + return FLAC__stream_encoder_get_channels(encoder->private_->stream_encoder); +} + +FLAC_API unsigned FLAC__seekable_stream_encoder_get_bits_per_sample(const FLAC__SeekableStreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + return FLAC__stream_encoder_get_bits_per_sample(encoder->private_->stream_encoder); +} + +FLAC_API unsigned FLAC__seekable_stream_encoder_get_sample_rate(const FLAC__SeekableStreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + return FLAC__stream_encoder_get_sample_rate(encoder->private_->stream_encoder); +} + +FLAC_API unsigned FLAC__seekable_stream_encoder_get_blocksize(const FLAC__SeekableStreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + return FLAC__stream_encoder_get_blocksize(encoder->private_->stream_encoder); +} + +FLAC_API unsigned FLAC__seekable_stream_encoder_get_max_lpc_order(const FLAC__SeekableStreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + return FLAC__stream_encoder_get_max_lpc_order(encoder->private_->stream_encoder); +} + +FLAC_API unsigned FLAC__seekable_stream_encoder_get_qlp_coeff_precision(const FLAC__SeekableStreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + return FLAC__stream_encoder_get_qlp_coeff_precision(encoder->private_->stream_encoder); +} + +FLAC_API FLAC__bool FLAC__seekable_stream_encoder_get_do_qlp_coeff_prec_search(const FLAC__SeekableStreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + return FLAC__stream_encoder_get_do_qlp_coeff_prec_search(encoder->private_->stream_encoder); +} + +FLAC_API FLAC__bool FLAC__seekable_stream_encoder_get_do_escape_coding(const FLAC__SeekableStreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + return FLAC__stream_encoder_get_do_escape_coding(encoder->private_->stream_encoder); +} + +FLAC_API FLAC__bool FLAC__seekable_stream_encoder_get_do_exhaustive_model_search(const FLAC__SeekableStreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + return FLAC__stream_encoder_get_do_exhaustive_model_search(encoder->private_->stream_encoder); +} + +FLAC_API unsigned FLAC__seekable_stream_encoder_get_min_residual_partition_order(const FLAC__SeekableStreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + return FLAC__stream_encoder_get_min_residual_partition_order(encoder->private_->stream_encoder); +} + +FLAC_API unsigned FLAC__seekable_stream_encoder_get_max_residual_partition_order(const FLAC__SeekableStreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + return FLAC__stream_encoder_get_max_residual_partition_order(encoder->private_->stream_encoder); +} + +FLAC_API unsigned FLAC__seekable_stream_encoder_get_rice_parameter_search_dist(const FLAC__SeekableStreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + return FLAC__stream_encoder_get_rice_parameter_search_dist(encoder->private_->stream_encoder); +} + +FLAC_API FLAC__uint64 FLAC__seekable_stream_encoder_get_total_samples_estimate(const FLAC__SeekableStreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + return FLAC__stream_encoder_get_total_samples_estimate(encoder->private_->stream_encoder); +} + +FLAC_API FLAC__bool FLAC__seekable_stream_encoder_process(FLAC__SeekableStreamEncoder *encoder, const FLAC__int32 * const buffer[], unsigned samples) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + if(!FLAC__stream_encoder_process(encoder->private_->stream_encoder, buffer, samples)) { + encoder->protected_->state = FLAC__SEEKABLE_STREAM_ENCODER_STREAM_ENCODER_ERROR; + return false; + } + else + return true; +} + +/* 'samples' is channel-wide samples, e.g. for 1 second at 44100Hz, 'samples' = 44100 regardless of the number of channels */ +FLAC_API FLAC__bool FLAC__seekable_stream_encoder_process_interleaved(FLAC__SeekableStreamEncoder *encoder, const FLAC__int32 buffer[], unsigned samples) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + if(!FLAC__stream_encoder_process_interleaved(encoder->private_->stream_encoder, buffer, samples)) { + encoder->protected_->state = FLAC__SEEKABLE_STREAM_ENCODER_STREAM_ENCODER_ERROR; + return false; + } + else + return true; +} + +/*********************************************************************** + * + * Private class methods + * + ***********************************************************************/ + +void set_defaults_(FLAC__SeekableStreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + + encoder->private_->seek_callback = 0; + encoder->private_->tell_callback = 0; + encoder->private_->write_callback = 0; + encoder->private_->client_data = 0; + + encoder->private_->seek_table = 0; +} + +FLAC__StreamEncoderWriteStatus write_callback_(const FLAC__StreamEncoder *unused, const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame, void *client_data) +{ + FLAC__SeekableStreamEncoder *encoder = (FLAC__SeekableStreamEncoder*)client_data; + FLAC__StreamEncoderWriteStatus status; + FLAC__uint64 output_position; + + (void)unused; /* silence compiler warning about unused parameter */ + FLAC__ASSERT(encoder->private_->stream_encoder == unused); + + if(encoder->private_->tell_callback(encoder, &output_position, encoder->private_->client_data) != FLAC__SEEKABLE_STREAM_ENCODER_TELL_STATUS_OK) + return encoder->protected_->state = FLAC__SEEKABLE_STREAM_ENCODER_TELL_ERROR; + + /* + * Watch for the STREAMINFO block and first SEEKTABLE block to go by and store their offsets. + */ + if(samples == 0) { + FLAC__MetadataType type = (buffer[0] & 0x7f); + if(type == FLAC__METADATA_TYPE_STREAMINFO) + encoder->protected_->streaminfo_offset = output_position; + else if(type == FLAC__METADATA_TYPE_SEEKTABLE && encoder->protected_->seektable_offset == 0) + encoder->protected_->seektable_offset = output_position; + } + + /* + * Mark the current seek point if hit (if audio_offset == 0 that + * means we're still writing metadata and haven't hit the first + * frame yet) + */ + if(0 != encoder->private_->seek_table && encoder->protected_->audio_offset > 0 && encoder->private_->seek_table->num_points > 0) { + const unsigned blocksize = FLAC__stream_encoder_get_blocksize(encoder->private_->stream_encoder); + const FLAC__uint64 frame_first_sample = encoder->private_->samples_written; + const FLAC__uint64 frame_last_sample = frame_first_sample + (FLAC__uint64)blocksize - 1; + FLAC__uint64 test_sample; + unsigned i; + for(i = encoder->private_->first_seekpoint_to_check; i < encoder->private_->seek_table->num_points; i++) { + test_sample = encoder->private_->seek_table->points[i].sample_number; + if(test_sample > frame_last_sample) { + break; + } + else if(test_sample >= frame_first_sample) { + encoder->private_->seek_table->points[i].sample_number = frame_first_sample; + encoder->private_->seek_table->points[i].stream_offset = output_position - encoder->protected_->audio_offset; + encoder->private_->seek_table->points[i].frame_samples = blocksize; + encoder->private_->first_seekpoint_to_check++; + /* DO NOT: "break;" and here's why: + * The seektable template may contain more than one target + * sample for any given frame; we will keep looping, generating + * duplicate seekpoints for them, and we'll clean it up later, + * just before writing the seektable back to the metadata. + */ + } + else { + encoder->private_->first_seekpoint_to_check++; + } + } + } + + status = encoder->private_->write_callback(encoder, buffer, bytes, samples, current_frame, encoder->private_->client_data); + + if(status == FLAC__STREAM_ENCODER_WRITE_STATUS_OK) { + encoder->private_->samples_written += samples; + } + else + encoder->protected_->state = FLAC__SEEKABLE_STREAM_ENCODER_WRITE_ERROR; + + return status; +} + +void metadata_callback_(const FLAC__StreamEncoder *unused, const FLAC__StreamMetadata *metadata, void *client_data) +{ + FLAC__SeekableStreamEncoder *encoder = (FLAC__SeekableStreamEncoder*)client_data; + FLAC__byte b[max(6, FLAC__STREAM_METADATA_SEEKPOINT_LENGTH)]; + const FLAC__uint64 samples = metadata->data.stream_info.total_samples; + const unsigned min_framesize = metadata->data.stream_info.min_framesize; + const unsigned max_framesize = metadata->data.stream_info.max_framesize; + const unsigned bps = metadata->data.stream_info.bits_per_sample; + + FLAC__ASSERT(metadata->type == FLAC__METADATA_TYPE_STREAMINFO); + + /* We get called by the stream encoder when the encoding process + * has finished so that we can update the STREAMINFO and SEEKTABLE + * blocks. + */ + + (void)unused; /* silence compiler warning about unused parameter */ + FLAC__ASSERT(encoder->private_->stream_encoder == unused); + + /*@@@ reopen callback here? The docs currently require user to open files in update mode from the start */ + + /* All this is based on intimate knowledge of the stream header + * layout, but a change to the header format that would break this + * would also break all streams encoded in the previous format. + */ + + /* + * Write MD5 signature + */ + { + const unsigned md5_offset = + FLAC__STREAM_METADATA_HEADER_LENGTH + + ( + FLAC__STREAM_METADATA_STREAMINFO_MIN_BLOCK_SIZE_LEN + + FLAC__STREAM_METADATA_STREAMINFO_MAX_BLOCK_SIZE_LEN + + FLAC__STREAM_METADATA_STREAMINFO_MIN_FRAME_SIZE_LEN + + FLAC__STREAM_METADATA_STREAMINFO_MAX_FRAME_SIZE_LEN + + FLAC__STREAM_METADATA_STREAMINFO_SAMPLE_RATE_LEN + + FLAC__STREAM_METADATA_STREAMINFO_CHANNELS_LEN + + FLAC__STREAM_METADATA_STREAMINFO_BITS_PER_SAMPLE_LEN + + FLAC__STREAM_METADATA_STREAMINFO_TOTAL_SAMPLES_LEN + ) / 8; + + if(encoder->private_->seek_callback(encoder, encoder->protected_->streaminfo_offset + md5_offset, encoder->private_->client_data) != FLAC__SEEKABLE_STREAM_ENCODER_SEEK_STATUS_OK) { + encoder->protected_->state = FLAC__SEEKABLE_STREAM_ENCODER_SEEK_ERROR; + return; + } + if(encoder->private_->write_callback(encoder, metadata->data.stream_info.md5sum, 16, 0, 0, encoder->private_->client_data) != FLAC__STREAM_ENCODER_WRITE_STATUS_OK) { + encoder->protected_->state = FLAC__SEEKABLE_STREAM_ENCODER_WRITE_ERROR; + return; + } + } + + /* + * Write total samples + */ + { + const unsigned total_samples_byte_offset = + FLAC__STREAM_METADATA_HEADER_LENGTH + + ( + FLAC__STREAM_METADATA_STREAMINFO_MIN_BLOCK_SIZE_LEN + + FLAC__STREAM_METADATA_STREAMINFO_MAX_BLOCK_SIZE_LEN + + FLAC__STREAM_METADATA_STREAMINFO_MIN_FRAME_SIZE_LEN + + FLAC__STREAM_METADATA_STREAMINFO_MAX_FRAME_SIZE_LEN + + FLAC__STREAM_METADATA_STREAMINFO_SAMPLE_RATE_LEN + + FLAC__STREAM_METADATA_STREAMINFO_CHANNELS_LEN + + FLAC__STREAM_METADATA_STREAMINFO_BITS_PER_SAMPLE_LEN + - 4 + ) / 8; + + b[0] = ((FLAC__byte)(bps-1) << 4) | (FLAC__byte)((samples >> 32) & 0x0F); + b[1] = (FLAC__byte)((samples >> 24) & 0xFF); + b[2] = (FLAC__byte)((samples >> 16) & 0xFF); + b[3] = (FLAC__byte)((samples >> 8) & 0xFF); + b[4] = (FLAC__byte)(samples & 0xFF); + if(encoder->private_->seek_callback(encoder, encoder->protected_->streaminfo_offset + total_samples_byte_offset, encoder->private_->client_data) != FLAC__SEEKABLE_STREAM_ENCODER_SEEK_STATUS_OK) { + encoder->protected_->state = FLAC__SEEKABLE_STREAM_ENCODER_SEEK_ERROR; + return; + } + if(encoder->private_->write_callback(encoder, b, 5, 0, 0, encoder->private_->client_data) != FLAC__STREAM_ENCODER_WRITE_STATUS_OK) { + encoder->protected_->state = FLAC__SEEKABLE_STREAM_ENCODER_WRITE_ERROR; + return; + } + } + + /* + * Write min/max framesize + */ + { + const unsigned min_framesize_offset = + FLAC__STREAM_METADATA_HEADER_LENGTH + + ( + FLAC__STREAM_METADATA_STREAMINFO_MIN_BLOCK_SIZE_LEN + + FLAC__STREAM_METADATA_STREAMINFO_MAX_BLOCK_SIZE_LEN + ) / 8; + + b[0] = (FLAC__byte)((min_framesize >> 16) & 0xFF); + b[1] = (FLAC__byte)((min_framesize >> 8) & 0xFF); + b[2] = (FLAC__byte)(min_framesize & 0xFF); + b[3] = (FLAC__byte)((max_framesize >> 16) & 0xFF); + b[4] = (FLAC__byte)((max_framesize >> 8) & 0xFF); + b[5] = (FLAC__byte)(max_framesize & 0xFF); + if(encoder->private_->seek_callback(encoder, encoder->protected_->streaminfo_offset + min_framesize_offset, encoder->private_->client_data) != FLAC__SEEKABLE_STREAM_ENCODER_SEEK_STATUS_OK) { + encoder->protected_->state = FLAC__SEEKABLE_STREAM_ENCODER_SEEK_ERROR; + return; + } + if(encoder->private_->write_callback(encoder, b, 6, 0, 0, encoder->private_->client_data) != FLAC__STREAM_ENCODER_WRITE_STATUS_OK) { + encoder->protected_->state = FLAC__SEEKABLE_STREAM_ENCODER_WRITE_ERROR; + return; + } + } + + /* + * Write seektable + */ + if(0 != encoder->private_->seek_table && encoder->private_->seek_table->num_points > 0 && encoder->protected_->seektable_offset > 0) { + unsigned i; + + FLAC__format_seektable_sort(encoder->private_->seek_table); + + FLAC__ASSERT(FLAC__format_seektable_is_legal(encoder->private_->seek_table)); + + if(encoder->private_->seek_callback(encoder, encoder->protected_->seektable_offset + FLAC__STREAM_METADATA_HEADER_LENGTH, encoder->private_->client_data) != FLAC__SEEKABLE_STREAM_ENCODER_SEEK_STATUS_OK) { + encoder->protected_->state = FLAC__SEEKABLE_STREAM_ENCODER_SEEK_ERROR; + return; + } + + for(i = 0; i < encoder->private_->seek_table->num_points; i++) { + FLAC__uint64 xx; + unsigned x; + xx = encoder->private_->seek_table->points[i].sample_number; + b[7] = (FLAC__byte)xx; xx >>= 8; + b[6] = (FLAC__byte)xx; xx >>= 8; + b[5] = (FLAC__byte)xx; xx >>= 8; + b[4] = (FLAC__byte)xx; xx >>= 8; + b[3] = (FLAC__byte)xx; xx >>= 8; + b[2] = (FLAC__byte)xx; xx >>= 8; + b[1] = (FLAC__byte)xx; xx >>= 8; + b[0] = (FLAC__byte)xx; xx >>= 8; + xx = encoder->private_->seek_table->points[i].stream_offset; + b[15] = (FLAC__byte)xx; xx >>= 8; + b[14] = (FLAC__byte)xx; xx >>= 8; + b[13] = (FLAC__byte)xx; xx >>= 8; + b[12] = (FLAC__byte)xx; xx >>= 8; + b[11] = (FLAC__byte)xx; xx >>= 8; + b[10] = (FLAC__byte)xx; xx >>= 8; + b[9] = (FLAC__byte)xx; xx >>= 8; + b[8] = (FLAC__byte)xx; xx >>= 8; + x = encoder->private_->seek_table->points[i].frame_samples; + b[17] = (FLAC__byte)x; x >>= 8; + b[16] = (FLAC__byte)x; x >>= 8; + if(encoder->private_->write_callback(encoder, b, 18, 0, 0, encoder->private_->client_data) != FLAC__STREAM_ENCODER_WRITE_STATUS_OK) { + encoder->protected_->state = FLAC__SEEKABLE_STREAM_ENCODER_WRITE_ERROR; + return; + } + } + } +} diff --git a/Libraries/FLAC/Files/src/libFLAC/stream_decoder.c b/Libraries/FLAC/Files/src/libFLAC/stream_decoder.c new file mode 100644 index 000000000..845ff9013 --- /dev/null +++ b/Libraries/FLAC/Files/src/libFLAC/stream_decoder.c @@ -0,0 +1,2157 @@ +/* libFLAC - Free Lossless Audio Codec library + * Copyright (C) 2000,2001,2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include /* for malloc() */ +#include /* for memset/memcpy() */ +#include "FLAC/assert.h" +#include "protected/stream_decoder.h" +#include "private/bitbuffer.h" +#include "private/bitmath.h" +#include "private/cpu.h" +#include "private/crc.h" +#include "private/fixed.h" +#include "private/format.h" +#include "private/lpc.h" +#include "private/memory.h" + +#ifdef HAVE_CONFIG_H +#include +#endif + +#ifdef max +#undef max +#endif +#define max(a,b) ((a)>(b)?(a):(b)) + +/* adjust for compilers that can't understand using LLU suffix for uint64_t literals */ +#ifdef _MSC_VER +#define FLAC__U64L(x) x +#else +#define FLAC__U64L(x) x##LLU +#endif + +/*********************************************************************** + * + * Private static data + * + ***********************************************************************/ + +static FLAC__byte ID3V2_TAG_[3] = { 'I', 'D', '3' }; + +/*********************************************************************** + * + * Private class method prototypes + * + ***********************************************************************/ + +static void set_defaults_(FLAC__StreamDecoder *decoder); +static FLAC__bool allocate_output_(FLAC__StreamDecoder *decoder, unsigned size, unsigned channels); +static FLAC__bool has_id_filtered_(FLAC__StreamDecoder *decoder, FLAC__byte *id); +static FLAC__bool find_metadata_(FLAC__StreamDecoder *decoder); +static FLAC__bool read_metadata_(FLAC__StreamDecoder *decoder); +static FLAC__bool read_metadata_streaminfo_(FLAC__StreamDecoder *decoder, FLAC__bool is_last, unsigned length); +static FLAC__bool read_metadata_seektable_(FLAC__StreamDecoder *decoder, FLAC__bool is_last, unsigned length); +static FLAC__bool read_metadata_vorbiscomment_(FLAC__StreamDecoder *decoder, FLAC__StreamMetadata_VorbisComment *obj); +static FLAC__bool read_metadata_cuesheet_(FLAC__StreamDecoder *decoder, FLAC__StreamMetadata_CueSheet *obj); +static FLAC__bool skip_id3v2_tag_(FLAC__StreamDecoder *decoder); +static FLAC__bool frame_sync_(FLAC__StreamDecoder *decoder); +static FLAC__bool read_frame_(FLAC__StreamDecoder *decoder, FLAC__bool *got_a_frame, FLAC__bool do_full_decode); +static FLAC__bool read_frame_header_(FLAC__StreamDecoder *decoder); +static FLAC__bool read_subframe_(FLAC__StreamDecoder *decoder, unsigned channel, unsigned bps, FLAC__bool do_full_decode); +static FLAC__bool read_subframe_constant_(FLAC__StreamDecoder *decoder, unsigned channel, unsigned bps, FLAC__bool do_full_decode); +static FLAC__bool read_subframe_fixed_(FLAC__StreamDecoder *decoder, unsigned channel, unsigned bps, const unsigned order, FLAC__bool do_full_decode); +static FLAC__bool read_subframe_lpc_(FLAC__StreamDecoder *decoder, unsigned channel, unsigned bps, const unsigned order, FLAC__bool do_full_decode); +static FLAC__bool read_subframe_verbatim_(FLAC__StreamDecoder *decoder, unsigned channel, unsigned bps, FLAC__bool do_full_decode); +static FLAC__bool read_residual_partitioned_rice_(FLAC__StreamDecoder *decoder, unsigned predictor_order, unsigned partition_order, FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents, FLAC__int32 *residual); +static FLAC__bool read_zero_padding_(FLAC__StreamDecoder *decoder); +static FLAC__bool read_callback_(FLAC__byte buffer[], unsigned *bytes, void *client_data); + +/*********************************************************************** + * + * Private class data + * + ***********************************************************************/ + +typedef struct FLAC__StreamDecoderPrivate { + FLAC__StreamDecoderReadCallback read_callback; + FLAC__StreamDecoderWriteCallback write_callback; + FLAC__StreamDecoderMetadataCallback metadata_callback; + FLAC__StreamDecoderErrorCallback error_callback; + /* generic 32-bit datapath: */ + void (*local_lpc_restore_signal)(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]); + /* generic 64-bit datapath: */ + void (*local_lpc_restore_signal_64bit)(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]); + /* for use when the signal is <= 16 bits-per-sample, or <= 15 bits-per-sample on a side channel (which requires 1 extra bit): */ + void (*local_lpc_restore_signal_16bit)(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]); + /* for use when the signal is <= 16 bits-per-sample, or <= 15 bits-per-sample on a side channel (which requires 1 extra bit), AND order <= 8: */ + void (*local_lpc_restore_signal_16bit_order8)(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]); + void *client_data; + FLAC__BitBuffer *input; + FLAC__int32 *output[FLAC__MAX_CHANNELS]; + FLAC__int32 *residual[FLAC__MAX_CHANNELS]; /* WATCHOUT: these are the aligned pointers; the real pointers that should be free()'d are residual_unaligned[] below */ + FLAC__EntropyCodingMethod_PartitionedRiceContents partitioned_rice_contents[FLAC__MAX_CHANNELS]; + unsigned output_capacity, output_channels; + FLAC__uint32 last_frame_number; + FLAC__uint32 last_block_size; + FLAC__uint64 samples_decoded; + FLAC__bool has_stream_info, has_seek_table; + FLAC__StreamMetadata stream_info; + FLAC__StreamMetadata seek_table; + FLAC__bool metadata_filter[128]; /* MAGIC number 128 == total number of metadata block types == 1 << 7 */ + FLAC__byte *metadata_filter_ids; + unsigned metadata_filter_ids_count, metadata_filter_ids_capacity; /* units for both are IDs, not bytes */ + FLAC__Frame frame; + FLAC__bool cached; /* true if there is a byte in lookahead */ + FLAC__CPUInfo cpuinfo; + FLAC__byte header_warmup[2]; /* contains the sync code and reserved bits */ + FLAC__byte lookahead; /* temp storage when we need to look ahead one byte in the stream */ + /* unaligned (original) pointers to allocated data */ + FLAC__int32 *residual_unaligned[FLAC__MAX_CHANNELS]; +} FLAC__StreamDecoderPrivate; + +/*********************************************************************** + * + * Public static class data + * + ***********************************************************************/ + +FLAC_API const char * const FLAC__StreamDecoderStateString[] = { + "FLAC__STREAM_DECODER_SEARCH_FOR_METADATA", + "FLAC__STREAM_DECODER_READ_METADATA", + "FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC", + "FLAC__STREAM_DECODER_READ_FRAME", + "FLAC__STREAM_DECODER_END_OF_STREAM", + "FLAC__STREAM_DECODER_ABORTED", + "FLAC__STREAM_DECODER_UNPARSEABLE_STREAM", + "FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR", + "FLAC__STREAM_DECODER_ALREADY_INITIALIZED", + "FLAC__STREAM_DECODER_INVALID_CALLBACK", + "FLAC__STREAM_DECODER_UNINITIALIZED" +}; + +FLAC_API const char * const FLAC__StreamDecoderReadStatusString[] = { + "FLAC__STREAM_DECODER_READ_STATUS_CONTINUE", + "FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM", + "FLAC__STREAM_DECODER_READ_STATUS_ABORT" +}; + +FLAC_API const char * const FLAC__StreamDecoderWriteStatusString[] = { + "FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE", + "FLAC__STREAM_DECODER_WRITE_STATUS_ABORT" +}; + +FLAC_API const char * const FLAC__StreamDecoderErrorStatusString[] = { + "FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC", + "FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER", + "FLAC__STREAM_DECODER_ERROR_STATUS_FRAME_CRC_MISMATCH" +}; + +/*********************************************************************** + * + * Class constructor/destructor + * + ***********************************************************************/ +FLAC_API FLAC__StreamDecoder *FLAC__stream_decoder_new() +{ + FLAC__StreamDecoder *decoder; + unsigned i; + + FLAC__ASSERT(sizeof(int) >= 4); /* we want to die right away if this is not true */ + + decoder = (FLAC__StreamDecoder*)calloc(1, sizeof(FLAC__StreamDecoder)); + if(decoder == 0) { + return 0; + } + + decoder->protected_ = (FLAC__StreamDecoderProtected*)calloc(1, sizeof(FLAC__StreamDecoderProtected)); + if(decoder->protected_ == 0) { + free(decoder); + return 0; + } + + decoder->private_ = (FLAC__StreamDecoderPrivate*)calloc(1, sizeof(FLAC__StreamDecoderPrivate)); + if(decoder->private_ == 0) { + free(decoder->protected_); + free(decoder); + return 0; + } + + decoder->private_->input = FLAC__bitbuffer_new(); + if(decoder->private_->input == 0) { + free(decoder->private_); + free(decoder->protected_); + free(decoder); + return 0; + } + + decoder->private_->metadata_filter_ids_capacity = 16; + if(0 == (decoder->private_->metadata_filter_ids = (FLAC__byte*)malloc((FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8) * decoder->private_->metadata_filter_ids_capacity))) { + FLAC__bitbuffer_delete(decoder->private_->input); + free(decoder->private_); + free(decoder->protected_); + free(decoder); + return 0; + } + + for(i = 0; i < FLAC__MAX_CHANNELS; i++) { + decoder->private_->output[i] = 0; + decoder->private_->residual_unaligned[i] = decoder->private_->residual[i] = 0; + } + + decoder->private_->output_capacity = 0; + decoder->private_->output_channels = 0; + decoder->private_->has_seek_table = false; + + for(i = 0; i < FLAC__MAX_CHANNELS; i++) + FLAC__format_entropy_coding_method_partitioned_rice_contents_init(&decoder->private_->partitioned_rice_contents[i]); + + set_defaults_(decoder); + + decoder->protected_->state = FLAC__STREAM_DECODER_UNINITIALIZED; + + return decoder; +} + +FLAC_API void FLAC__stream_decoder_delete(FLAC__StreamDecoder *decoder) +{ + unsigned i; + + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->protected_); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->private_->input); + + FLAC__stream_decoder_finish(decoder); + + if(0 != decoder->private_->metadata_filter_ids) + free(decoder->private_->metadata_filter_ids); + + FLAC__bitbuffer_delete(decoder->private_->input); + + for(i = 0; i < FLAC__MAX_CHANNELS; i++) + FLAC__format_entropy_coding_method_partitioned_rice_contents_clear(&decoder->private_->partitioned_rice_contents[i]); + + free(decoder->private_); + free(decoder->protected_); + free(decoder); +} + +/*********************************************************************** + * + * Public class methods + * + ***********************************************************************/ + +FLAC_API FLAC__StreamDecoderState FLAC__stream_decoder_init(FLAC__StreamDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + + if(decoder->protected_->state != FLAC__STREAM_DECODER_UNINITIALIZED) + return decoder->protected_->state = FLAC__STREAM_DECODER_ALREADY_INITIALIZED; + + if(0 == decoder->private_->read_callback || 0 == decoder->private_->write_callback || 0 == decoder->private_->metadata_callback || 0 == decoder->private_->error_callback) + return decoder->protected_->state = FLAC__STREAM_DECODER_INVALID_CALLBACK; + + if(!FLAC__bitbuffer_init(decoder->private_->input)) + return decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; + + decoder->private_->last_frame_number = 0; + decoder->private_->last_block_size = 0; + decoder->private_->samples_decoded = 0; + decoder->private_->has_stream_info = false; + decoder->private_->cached = false; + + /* + * get the CPU info and set the function pointers + */ + FLAC__cpu_info(&decoder->private_->cpuinfo); + /* first default to the non-asm routines */ + decoder->private_->local_lpc_restore_signal = FLAC__lpc_restore_signal; + decoder->private_->local_lpc_restore_signal_64bit = FLAC__lpc_restore_signal_wide; + decoder->private_->local_lpc_restore_signal_16bit = FLAC__lpc_restore_signal; + decoder->private_->local_lpc_restore_signal_16bit_order8 = FLAC__lpc_restore_signal; + /* now override with asm where appropriate */ +#ifndef FLAC__NO_ASM + if(decoder->private_->cpuinfo.use_asm) { +#ifdef FLAC__CPU_IA32 + FLAC__ASSERT(decoder->private_->cpuinfo.type == FLAC__CPUINFO_TYPE_IA32); +#ifdef FLAC__HAS_NASM + if(decoder->private_->cpuinfo.data.ia32.mmx) { + decoder->private_->local_lpc_restore_signal = FLAC__lpc_restore_signal_asm_ia32; + decoder->private_->local_lpc_restore_signal_16bit = FLAC__lpc_restore_signal_asm_ia32_mmx; + decoder->private_->local_lpc_restore_signal_16bit_order8 = FLAC__lpc_restore_signal_asm_ia32_mmx; + } + else { + decoder->private_->local_lpc_restore_signal = FLAC__lpc_restore_signal_asm_ia32; + decoder->private_->local_lpc_restore_signal_16bit = FLAC__lpc_restore_signal_asm_ia32; + decoder->private_->local_lpc_restore_signal_16bit_order8 = FLAC__lpc_restore_signal_asm_ia32; + } +#endif +#elif defined FLAC__CPU_PPC + FLAC__ASSERT(decoder->private_->cpuinfo.type == FLAC__CPUINFO_TYPE_PPC); + if(decoder->private_->cpuinfo.data.ppc.altivec) { + decoder->private_->local_lpc_restore_signal_16bit = FLAC__lpc_restore_signal_asm_ppc_altivec_16; + decoder->private_->local_lpc_restore_signal_16bit_order8 = FLAC__lpc_restore_signal_asm_ppc_altivec_16_order8; + } +#endif + } +#endif + + if(!FLAC__stream_decoder_reset(decoder)) + return decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; + + return decoder->protected_->state; +} + +FLAC_API void FLAC__stream_decoder_finish(FLAC__StreamDecoder *decoder) +{ + unsigned i; + FLAC__ASSERT(0 != decoder); + if(decoder->protected_->state == FLAC__STREAM_DECODER_UNINITIALIZED) + return; + if(0 != decoder->private_->seek_table.data.seek_table.points) { + free(decoder->private_->seek_table.data.seek_table.points); + decoder->private_->seek_table.data.seek_table.points = 0; + decoder->private_->has_seek_table = false; + } + FLAC__bitbuffer_free(decoder->private_->input); + for(i = 0; i < FLAC__MAX_CHANNELS; i++) { + /* WATCHOUT: + * FLAC__lpc_restore_signal_asm_ia32_mmx() requires that the + * output arrays have a buffer of up to 3 zeroes in front + * (at negative indices) for alignment purposes; we use 4 + * to keep the data well-aligned. + */ + if(0 != decoder->private_->output[i]) { + free(decoder->private_->output[i]-4); + decoder->private_->output[i] = 0; + } + if(0 != decoder->private_->residual_unaligned[i]) { + free(decoder->private_->residual_unaligned[i]); + decoder->private_->residual_unaligned[i] = decoder->private_->residual[i] = 0; + } + } + decoder->private_->output_capacity = 0; + decoder->private_->output_channels = 0; + + set_defaults_(decoder); + + decoder->protected_->state = FLAC__STREAM_DECODER_UNINITIALIZED; +} + +FLAC_API FLAC__bool FLAC__stream_decoder_set_read_callback(FLAC__StreamDecoder *decoder, FLAC__StreamDecoderReadCallback value) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + if(decoder->protected_->state != FLAC__STREAM_DECODER_UNINITIALIZED) + return false; + decoder->private_->read_callback = value; + return true; +} + +FLAC_API FLAC__bool FLAC__stream_decoder_set_write_callback(FLAC__StreamDecoder *decoder, FLAC__StreamDecoderWriteCallback value) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + if(decoder->protected_->state != FLAC__STREAM_DECODER_UNINITIALIZED) + return false; + decoder->private_->write_callback = value; + return true; +} + +FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_callback(FLAC__StreamDecoder *decoder, FLAC__StreamDecoderMetadataCallback value) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + if(decoder->protected_->state != FLAC__STREAM_DECODER_UNINITIALIZED) + return false; + decoder->private_->metadata_callback = value; + return true; +} + +FLAC_API FLAC__bool FLAC__stream_decoder_set_error_callback(FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorCallback value) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + if(decoder->protected_->state != FLAC__STREAM_DECODER_UNINITIALIZED) + return false; + decoder->private_->error_callback = value; + return true; +} + +FLAC_API FLAC__bool FLAC__stream_decoder_set_client_data(FLAC__StreamDecoder *decoder, void *value) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + if(decoder->protected_->state != FLAC__STREAM_DECODER_UNINITIALIZED) + return false; + decoder->private_->client_data = value; + return true; +} + +FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_respond(FLAC__StreamDecoder *decoder, FLAC__MetadataType type) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + FLAC__ASSERT((unsigned)type <= FLAC__MAX_METADATA_TYPE_CODE); + /* double protection */ + if((unsigned)type > FLAC__MAX_METADATA_TYPE_CODE) + return false; + if(decoder->protected_->state != FLAC__STREAM_DECODER_UNINITIALIZED) + return false; + decoder->private_->metadata_filter[type] = true; + if(type == FLAC__METADATA_TYPE_APPLICATION) + decoder->private_->metadata_filter_ids_count = 0; + return true; +} + +FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_respond_application(FLAC__StreamDecoder *decoder, const FLAC__byte id[4]) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + FLAC__ASSERT(0 != id); + if(decoder->protected_->state != FLAC__STREAM_DECODER_UNINITIALIZED) + return false; + + if(decoder->private_->metadata_filter[FLAC__METADATA_TYPE_APPLICATION]) + return true; + + FLAC__ASSERT(0 != decoder->private_->metadata_filter_ids); + + if(decoder->private_->metadata_filter_ids_count == decoder->private_->metadata_filter_ids_capacity) { + if(0 == (decoder->private_->metadata_filter_ids = (FLAC__byte*)realloc(decoder->private_->metadata_filter_ids, decoder->private_->metadata_filter_ids_capacity * 2))) + return decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; + decoder->private_->metadata_filter_ids_capacity *= 2; + } + + memcpy(decoder->private_->metadata_filter_ids + decoder->private_->metadata_filter_ids_count * (FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8), id, (FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8)); + decoder->private_->metadata_filter_ids_count++; + + return true; +} + +FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_respond_all(FLAC__StreamDecoder *decoder) +{ + unsigned i; + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + if(decoder->protected_->state != FLAC__STREAM_DECODER_UNINITIALIZED) + return false; + for(i = 0; i < sizeof(decoder->private_->metadata_filter) / sizeof(decoder->private_->metadata_filter[0]); i++) + decoder->private_->metadata_filter[i] = true; + decoder->private_->metadata_filter_ids_count = 0; + return true; +} + +FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_ignore(FLAC__StreamDecoder *decoder, FLAC__MetadataType type) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + FLAC__ASSERT((unsigned)type <= FLAC__MAX_METADATA_TYPE_CODE); + /* double protection */ + if((unsigned)type > FLAC__MAX_METADATA_TYPE_CODE) + return false; + if(decoder->protected_->state != FLAC__STREAM_DECODER_UNINITIALIZED) + return false; + decoder->private_->metadata_filter[type] = false; + if(type == FLAC__METADATA_TYPE_APPLICATION) + decoder->private_->metadata_filter_ids_count = 0; + return true; +} + +FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_ignore_application(FLAC__StreamDecoder *decoder, const FLAC__byte id[4]) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + FLAC__ASSERT(0 != id); + if(decoder->protected_->state != FLAC__STREAM_DECODER_UNINITIALIZED) + return false; + + if(!decoder->private_->metadata_filter[FLAC__METADATA_TYPE_APPLICATION]) + return true; + + FLAC__ASSERT(0 != decoder->private_->metadata_filter_ids); + + if(decoder->private_->metadata_filter_ids_count == decoder->private_->metadata_filter_ids_capacity) { + if(0 == (decoder->private_->metadata_filter_ids = (FLAC__byte*)realloc(decoder->private_->metadata_filter_ids, decoder->private_->metadata_filter_ids_capacity * 2))) + return decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; + decoder->private_->metadata_filter_ids_capacity *= 2; + } + + memcpy(decoder->private_->metadata_filter_ids + decoder->private_->metadata_filter_ids_count * (FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8), id, (FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8)); + decoder->private_->metadata_filter_ids_count++; + + return true; +} + +FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_ignore_all(FLAC__StreamDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + if(decoder->protected_->state != FLAC__STREAM_DECODER_UNINITIALIZED) + return false; + memset(decoder->private_->metadata_filter, 0, sizeof(decoder->private_->metadata_filter)); + decoder->private_->metadata_filter_ids_count = 0; + return true; +} + +FLAC_API FLAC__StreamDecoderState FLAC__stream_decoder_get_state(const FLAC__StreamDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->protected_); + return decoder->protected_->state; +} + +FLAC_API const char *FLAC__stream_decoder_get_resolved_state_string(const FLAC__StreamDecoder *decoder) +{ + return FLAC__StreamDecoderStateString[decoder->protected_->state]; +} + +FLAC_API unsigned FLAC__stream_decoder_get_channels(const FLAC__StreamDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->protected_); + return decoder->protected_->channels; +} + +FLAC_API FLAC__ChannelAssignment FLAC__stream_decoder_get_channel_assignment(const FLAC__StreamDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->protected_); + return decoder->protected_->channel_assignment; +} + +FLAC_API unsigned FLAC__stream_decoder_get_bits_per_sample(const FLAC__StreamDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->protected_); + return decoder->protected_->bits_per_sample; +} + +FLAC_API unsigned FLAC__stream_decoder_get_sample_rate(const FLAC__StreamDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->protected_); + return decoder->protected_->sample_rate; +} + +FLAC_API unsigned FLAC__stream_decoder_get_blocksize(const FLAC__StreamDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->protected_); + return decoder->protected_->blocksize; +} + +FLAC_API FLAC__bool FLAC__stream_decoder_flush(FLAC__StreamDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + + if(!FLAC__bitbuffer_clear(decoder->private_->input)) { + decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; + return false; + } + decoder->private_->last_frame_number = 0; + decoder->private_->last_block_size = 0; + decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC; + + return true; +} + +FLAC_API FLAC__bool FLAC__stream_decoder_reset(FLAC__StreamDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + + if(!FLAC__stream_decoder_flush(decoder)) { + decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; + return false; + } + decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_METADATA; + + decoder->private_->samples_decoded = 0; + + return true; +} + +FLAC_API FLAC__bool FLAC__stream_decoder_process_single(FLAC__StreamDecoder *decoder) +{ + FLAC__bool got_a_frame; + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->protected_); + + while(1) { + switch(decoder->protected_->state) { + case FLAC__STREAM_DECODER_SEARCH_FOR_METADATA: + if(!find_metadata_(decoder)) + return false; /* above function sets the status for us */ + break; + case FLAC__STREAM_DECODER_READ_METADATA: + if(!read_metadata_(decoder)) + return false; /* above function sets the status for us */ + else + return true; + case FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC: + if(!frame_sync_(decoder)) + return true; /* above function sets the status for us */ + break; + case FLAC__STREAM_DECODER_READ_FRAME: + if(!read_frame_(decoder, &got_a_frame, /*do_full_decode=*/true)) + return false; /* above function sets the status for us */ + if(got_a_frame) + return true; /* above function sets the status for us */ + break; + case FLAC__STREAM_DECODER_END_OF_STREAM: + case FLAC__STREAM_DECODER_ABORTED: + return true; + default: + FLAC__ASSERT(0); + return false; + } + } +} + +FLAC_API FLAC__bool FLAC__stream_decoder_process_until_end_of_metadata(FLAC__StreamDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->protected_); + + while(1) { + switch(decoder->protected_->state) { + case FLAC__STREAM_DECODER_SEARCH_FOR_METADATA: + if(!find_metadata_(decoder)) + return false; /* above function sets the status for us */ + break; + case FLAC__STREAM_DECODER_READ_METADATA: + if(!read_metadata_(decoder)) + return false; /* above function sets the status for us */ + break; + case FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC: + case FLAC__STREAM_DECODER_READ_FRAME: + case FLAC__STREAM_DECODER_END_OF_STREAM: + case FLAC__STREAM_DECODER_ABORTED: + return true; + default: + FLAC__ASSERT(0); + return false; + } + } +} + +FLAC_API FLAC__bool FLAC__stream_decoder_process_until_end_of_stream(FLAC__StreamDecoder *decoder) +{ + FLAC__bool dummy; + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->protected_); + + while(1) { + switch(decoder->protected_->state) { + case FLAC__STREAM_DECODER_SEARCH_FOR_METADATA: + if(!find_metadata_(decoder)) + return false; /* above function sets the status for us */ + break; + case FLAC__STREAM_DECODER_READ_METADATA: + if(!read_metadata_(decoder)) + return false; /* above function sets the status for us */ + break; + case FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC: + if(!frame_sync_(decoder)) + return true; /* above function sets the status for us */ + break; + case FLAC__STREAM_DECODER_READ_FRAME: + if(!read_frame_(decoder, &dummy, /*do_full_decode=*/true)) + return false; /* above function sets the status for us */ + break; + case FLAC__STREAM_DECODER_END_OF_STREAM: + case FLAC__STREAM_DECODER_ABORTED: + return true; + default: + FLAC__ASSERT(0); + return false; + } + } +} + +FLAC_API FLAC__bool FLAC__stream_decoder_skip_single_frame(FLAC__StreamDecoder *decoder) +{ + FLAC__bool got_a_frame; + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->protected_); + + while(1) { + switch(decoder->protected_->state) { + case FLAC__STREAM_DECODER_SEARCH_FOR_METADATA: + case FLAC__STREAM_DECODER_READ_METADATA: + return false; /* above function sets the status for us */ + case FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC: + if(!frame_sync_(decoder)) + return true; /* above function sets the status for us */ + break; + case FLAC__STREAM_DECODER_READ_FRAME: + if(!read_frame_(decoder, &got_a_frame, /*do_full_decode=*/false)) + return false; /* above function sets the status for us */ + if(got_a_frame) + return true; /* above function sets the status for us */ + break; + case FLAC__STREAM_DECODER_END_OF_STREAM: + case FLAC__STREAM_DECODER_ABORTED: + return true; + default: + FLAC__ASSERT(0); + return false; + } + } +} + +/*********************************************************************** + * + * Protected class methods + * + ***********************************************************************/ + +unsigned FLAC__stream_decoder_get_input_bytes_unconsumed(const FLAC__StreamDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + return FLAC__bitbuffer_get_input_bytes_unconsumed(decoder->private_->input); +} + +/*********************************************************************** + * + * Private class methods + * + ***********************************************************************/ + +void set_defaults_(FLAC__StreamDecoder *decoder) +{ + decoder->private_->read_callback = 0; + decoder->private_->write_callback = 0; + decoder->private_->metadata_callback = 0; + decoder->private_->error_callback = 0; + decoder->private_->client_data = 0; + + memset(decoder->private_->metadata_filter, 0, sizeof(decoder->private_->metadata_filter)); + decoder->private_->metadata_filter[FLAC__METADATA_TYPE_STREAMINFO] = true; + decoder->private_->metadata_filter_ids_count = 0; +} + +FLAC__bool allocate_output_(FLAC__StreamDecoder *decoder, unsigned size, unsigned channels) +{ + unsigned i; + FLAC__int32 *tmp; + + if(size <= decoder->private_->output_capacity && channels <= decoder->private_->output_channels) + return true; + + /* simply using realloc() is not practical because the number of channels may change mid-stream */ + + for(i = 0; i < FLAC__MAX_CHANNELS; i++) { + if(0 != decoder->private_->output[i]) { + free(decoder->private_->output[i]-4); + decoder->private_->output[i] = 0; + } + if(0 != decoder->private_->residual_unaligned[i]) { + free(decoder->private_->residual_unaligned[i]); + decoder->private_->residual_unaligned[i] = decoder->private_->residual[i] = 0; + } + } + + for(i = 0; i < channels; i++) { + /* WATCHOUT: + * FLAC__lpc_restore_signal_asm_ia32_mmx() requires that the + * output arrays have a buffer of up to 3 zeroes in front + * (at negative indices) for alignment purposes; we use 4 + * to keep the data well-aligned. + */ + tmp = (FLAC__int32*)malloc(sizeof(FLAC__int32)*(size+4)); + if(tmp == 0) { + decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; + return false; + } + memset(tmp, 0, sizeof(FLAC__int32)*4); + decoder->private_->output[i] = tmp + 4; + + /* WATCHOUT: + * minimum of quadword alignment for PPC vector optimizations is REQUIRED: + */ + if(!FLAC__memory_alloc_aligned_int32_array(size, &decoder->private_->residual_unaligned[i], &decoder->private_->residual[i])) { + decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; + return false; + } + } + + decoder->private_->output_capacity = size; + decoder->private_->output_channels = channels; + + return true; +} + +FLAC__bool has_id_filtered_(FLAC__StreamDecoder *decoder, FLAC__byte *id) +{ + unsigned i; + + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + + for(i = 0; i < decoder->private_->metadata_filter_ids_count; i++) + if(0 == memcmp(decoder->private_->metadata_filter_ids + i * (FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8), id, (FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8))) + return true; + + return false; +} + +FLAC__bool find_metadata_(FLAC__StreamDecoder *decoder) +{ + FLAC__uint32 x; + unsigned i, id; + FLAC__bool first = true; + + FLAC__ASSERT(FLAC__bitbuffer_is_consumed_byte_aligned(decoder->private_->input)); + + for(i = id = 0; i < 4; ) { + if(decoder->private_->cached) { + x = (FLAC__uint32)decoder->private_->lookahead; + decoder->private_->cached = false; + } + else { + if(!FLAC__bitbuffer_read_raw_uint32(decoder->private_->input, &x, 8, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + } + if(x == FLAC__STREAM_SYNC_STRING[i]) { + first = true; + i++; + id = 0; + continue; + } + if(x == ID3V2_TAG_[id]) { + id++; + i = 0; + if(id == 3) { + if(!skip_id3v2_tag_(decoder)) + return false; /* the read_callback_ sets the state for us */ + } + continue; + } + if(x == 0xff) { /* MAGIC NUMBER for the first 8 frame sync bits */ + decoder->private_->header_warmup[0] = (FLAC__byte)x; + if(!FLAC__bitbuffer_read_raw_uint32(decoder->private_->input, &x, 8, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + + /* we have to check if we just read two 0xff's in a row; the second may actually be the beginning of the sync code */ + /* else we have to check if the second byte is the end of a sync code */ + if(x == 0xff) { /* MAGIC NUMBER for the first 8 frame sync bits */ + decoder->private_->lookahead = (FLAC__byte)x; + decoder->private_->cached = true; + } + else if(x >> 2 == 0x3e) { /* MAGIC NUMBER for the last 6 sync bits */ + decoder->private_->header_warmup[1] = (FLAC__byte)x; + decoder->protected_->state = FLAC__STREAM_DECODER_READ_FRAME; + return true; + } + } + i = 0; + if(first) { + decoder->private_->error_callback(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC, decoder->private_->client_data); + first = false; + } + } + + decoder->protected_->state = FLAC__STREAM_DECODER_READ_METADATA; + return true; +} + +FLAC__bool read_metadata_(FLAC__StreamDecoder *decoder) +{ + FLAC__bool is_last; + FLAC__uint32 i, x, type, length; + + FLAC__ASSERT(FLAC__bitbuffer_is_consumed_byte_aligned(decoder->private_->input)); + + if(!FLAC__bitbuffer_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_IS_LAST_LEN, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + is_last = x? true : false; + + if(!FLAC__bitbuffer_read_raw_uint32(decoder->private_->input, &type, FLAC__STREAM_METADATA_TYPE_LEN, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + + if(!FLAC__bitbuffer_read_raw_uint32(decoder->private_->input, &length, FLAC__STREAM_METADATA_LENGTH_LEN, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + + if(type == FLAC__METADATA_TYPE_STREAMINFO) { + if(!read_metadata_streaminfo_(decoder, is_last, length)) + return false; + + decoder->private_->has_stream_info = true; + if(decoder->private_->metadata_filter[FLAC__METADATA_TYPE_STREAMINFO]) + decoder->private_->metadata_callback(decoder, &decoder->private_->stream_info, decoder->private_->client_data); + } + else if(type == FLAC__METADATA_TYPE_SEEKTABLE) { + if(!read_metadata_seektable_(decoder, is_last, length)) + return false; + + decoder->private_->has_seek_table = true; + if(decoder->private_->metadata_filter[FLAC__METADATA_TYPE_SEEKTABLE]) + decoder->private_->metadata_callback(decoder, &decoder->private_->seek_table, decoder->private_->client_data); + } + else { + FLAC__bool skip_it = !decoder->private_->metadata_filter[type]; + unsigned real_length = length; + FLAC__StreamMetadata block; + + block.is_last = is_last; + block.type = (FLAC__MetadataType)type; + block.length = length; + + if(type == FLAC__METADATA_TYPE_APPLICATION) { + if(!FLAC__bitbuffer_read_byte_block_aligned_no_crc(decoder->private_->input, block.data.application.id, FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + + real_length -= FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8; + + if(decoder->private_->metadata_filter_ids_count > 0 && has_id_filtered_(decoder, block.data.application.id)) + skip_it = !skip_it; + } + + if(skip_it) { + if(!FLAC__bitbuffer_read_byte_block_aligned_no_crc(decoder->private_->input, 0, real_length, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + } + else { + switch(type) { + case FLAC__METADATA_TYPE_PADDING: + /* skip the padding bytes */ + if(!FLAC__bitbuffer_read_byte_block_aligned_no_crc(decoder->private_->input, 0, real_length, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + break; + case FLAC__METADATA_TYPE_APPLICATION: + /* remember, we read the ID already */ + if(real_length > 0) { + if(0 == (block.data.application.data = (FLAC__byte*)malloc(real_length))) { + decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; + return false; + } + if(!FLAC__bitbuffer_read_byte_block_aligned_no_crc(decoder->private_->input, block.data.application.data, real_length, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + } + else + block.data.application.data = 0; + break; + case FLAC__METADATA_TYPE_VORBIS_COMMENT: + if(!read_metadata_vorbiscomment_(decoder, &block.data.vorbis_comment)) + return false; + break; + case FLAC__METADATA_TYPE_CUESHEET: + if(!read_metadata_cuesheet_(decoder, &block.data.cue_sheet)) + return false; + break; + case FLAC__METADATA_TYPE_STREAMINFO: + case FLAC__METADATA_TYPE_SEEKTABLE: + FLAC__ASSERT(0); + break; + default: + if(real_length > 0) { + if(0 == (block.data.unknown.data = (FLAC__byte*)malloc(real_length))) { + decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; + return false; + } + if(!FLAC__bitbuffer_read_byte_block_aligned_no_crc(decoder->private_->input, block.data.unknown.data, real_length, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + } + else + block.data.unknown.data = 0; + break; + } + decoder->private_->metadata_callback(decoder, &block, decoder->private_->client_data); + + /* now we have to free any malloc'ed data in the block */ + switch(type) { + case FLAC__METADATA_TYPE_PADDING: + break; + case FLAC__METADATA_TYPE_APPLICATION: + if(0 != block.data.application.data) + free(block.data.application.data); + break; + case FLAC__METADATA_TYPE_VORBIS_COMMENT: + if(0 != block.data.vorbis_comment.vendor_string.entry) + free(block.data.vorbis_comment.vendor_string.entry); + if(block.data.vorbis_comment.num_comments > 0) + for(i = 0; i < block.data.vorbis_comment.num_comments; i++) + if(0 != block.data.vorbis_comment.comments[i].entry) + free(block.data.vorbis_comment.comments[i].entry); + if(0 != block.data.vorbis_comment.comments) + free(block.data.vorbis_comment.comments); + break; + case FLAC__METADATA_TYPE_CUESHEET: + if(block.data.cue_sheet.num_tracks > 0) + for(i = 0; i < block.data.cue_sheet.num_tracks; i++) + if(0 != block.data.cue_sheet.tracks[i].indices) + free(block.data.cue_sheet.tracks[i].indices); + if(0 != block.data.cue_sheet.tracks) + free(block.data.cue_sheet.tracks); + break; + case FLAC__METADATA_TYPE_STREAMINFO: + case FLAC__METADATA_TYPE_SEEKTABLE: + FLAC__ASSERT(0); + default: + if(0 != block.data.unknown.data) + free(block.data.unknown.data); + break; + } + } + } + + if(is_last) + decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC; + + return true; +} + +FLAC__bool read_metadata_streaminfo_(FLAC__StreamDecoder *decoder, FLAC__bool is_last, unsigned length) +{ + FLAC__uint32 x; + unsigned bits, used_bits = 0; + + FLAC__ASSERT(FLAC__bitbuffer_is_consumed_byte_aligned(decoder->private_->input)); + + decoder->private_->stream_info.type = FLAC__METADATA_TYPE_STREAMINFO; + decoder->private_->stream_info.is_last = is_last; + decoder->private_->stream_info.length = length; + + bits = FLAC__STREAM_METADATA_STREAMINFO_MIN_BLOCK_SIZE_LEN; + if(!FLAC__bitbuffer_read_raw_uint32(decoder->private_->input, &x, bits, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + decoder->private_->stream_info.data.stream_info.min_blocksize = x; + used_bits += bits; + + bits = FLAC__STREAM_METADATA_STREAMINFO_MAX_BLOCK_SIZE_LEN; + if(!FLAC__bitbuffer_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_STREAMINFO_MAX_BLOCK_SIZE_LEN, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + decoder->private_->stream_info.data.stream_info.max_blocksize = x; + used_bits += bits; + + bits = FLAC__STREAM_METADATA_STREAMINFO_MIN_FRAME_SIZE_LEN; + if(!FLAC__bitbuffer_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_STREAMINFO_MIN_FRAME_SIZE_LEN, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + decoder->private_->stream_info.data.stream_info.min_framesize = x; + used_bits += bits; + + bits = FLAC__STREAM_METADATA_STREAMINFO_MAX_FRAME_SIZE_LEN; + if(!FLAC__bitbuffer_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_STREAMINFO_MAX_FRAME_SIZE_LEN, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + decoder->private_->stream_info.data.stream_info.max_framesize = x; + used_bits += bits; + + bits = FLAC__STREAM_METADATA_STREAMINFO_SAMPLE_RATE_LEN; + if(!FLAC__bitbuffer_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_STREAMINFO_SAMPLE_RATE_LEN, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + decoder->private_->stream_info.data.stream_info.sample_rate = x; + used_bits += bits; + + bits = FLAC__STREAM_METADATA_STREAMINFO_CHANNELS_LEN; + if(!FLAC__bitbuffer_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_STREAMINFO_CHANNELS_LEN, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + decoder->private_->stream_info.data.stream_info.channels = x+1; + used_bits += bits; + + bits = FLAC__STREAM_METADATA_STREAMINFO_BITS_PER_SAMPLE_LEN; + if(!FLAC__bitbuffer_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_STREAMINFO_BITS_PER_SAMPLE_LEN, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + decoder->private_->stream_info.data.stream_info.bits_per_sample = x+1; + used_bits += bits; + + bits = FLAC__STREAM_METADATA_STREAMINFO_TOTAL_SAMPLES_LEN; + if(!FLAC__bitbuffer_read_raw_uint64(decoder->private_->input, &decoder->private_->stream_info.data.stream_info.total_samples, FLAC__STREAM_METADATA_STREAMINFO_TOTAL_SAMPLES_LEN, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + used_bits += bits; + + if(!FLAC__bitbuffer_read_byte_block_aligned_no_crc(decoder->private_->input, decoder->private_->stream_info.data.stream_info.md5sum, 16, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + used_bits += 16*8; + + /* skip the rest of the block */ + FLAC__ASSERT(used_bits % 8 == 0); + length -= (used_bits / 8); + if(!FLAC__bitbuffer_read_byte_block_aligned_no_crc(decoder->private_->input, 0, length, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + + return true; +} + +FLAC__bool read_metadata_seektable_(FLAC__StreamDecoder *decoder, FLAC__bool is_last, unsigned length) +{ + FLAC__uint32 i, x; + FLAC__uint64 xx; + + FLAC__ASSERT(FLAC__bitbuffer_is_consumed_byte_aligned(decoder->private_->input)); + + decoder->private_->seek_table.type = FLAC__METADATA_TYPE_SEEKTABLE; + decoder->private_->seek_table.is_last = is_last; + decoder->private_->seek_table.length = length; + + decoder->private_->seek_table.data.seek_table.num_points = length / FLAC__STREAM_METADATA_SEEKPOINT_LENGTH; + + /* use realloc since we may pass through here several times (e.g. after seeking) */ + if(0 == (decoder->private_->seek_table.data.seek_table.points = (FLAC__StreamMetadata_SeekPoint*)realloc(decoder->private_->seek_table.data.seek_table.points, decoder->private_->seek_table.data.seek_table.num_points * sizeof(FLAC__StreamMetadata_SeekPoint)))) { + decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; + return false; + } + for(i = 0; i < decoder->private_->seek_table.data.seek_table.num_points; i++) { + if(!FLAC__bitbuffer_read_raw_uint64(decoder->private_->input, &xx, FLAC__STREAM_METADATA_SEEKPOINT_SAMPLE_NUMBER_LEN, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + decoder->private_->seek_table.data.seek_table.points[i].sample_number = xx; + + if(!FLAC__bitbuffer_read_raw_uint64(decoder->private_->input, &xx, FLAC__STREAM_METADATA_SEEKPOINT_STREAM_OFFSET_LEN, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + decoder->private_->seek_table.data.seek_table.points[i].stream_offset = xx; + + if(!FLAC__bitbuffer_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_SEEKPOINT_FRAME_SAMPLES_LEN, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + decoder->private_->seek_table.data.seek_table.points[i].frame_samples = x; + } + length -= (decoder->private_->seek_table.data.seek_table.num_points * FLAC__STREAM_METADATA_SEEKPOINT_LENGTH); + /* if there is a partial point left, skip over it */ + if(length > 0) { + /*@@@ do an error_callback() here? there's an argument for either way */ + if(!FLAC__bitbuffer_read_byte_block_aligned_no_crc(decoder->private_->input, 0, length, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + } + + return true; +} + +FLAC__bool read_metadata_vorbiscomment_(FLAC__StreamDecoder *decoder, FLAC__StreamMetadata_VorbisComment *obj) +{ + FLAC__uint32 i; + + FLAC__ASSERT(FLAC__bitbuffer_is_consumed_byte_aligned(decoder->private_->input)); + + /* read vendor string */ + FLAC__ASSERT(FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN == 32); + if(!FLAC__bitbuffer_read_raw_uint32_little_endian(decoder->private_->input, &obj->vendor_string.length, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + if(obj->vendor_string.length > 0) { + if(0 == (obj->vendor_string.entry = (FLAC__byte*)malloc(obj->vendor_string.length+1))) { + decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; + return false; + } + if(!FLAC__bitbuffer_read_byte_block_aligned_no_crc(decoder->private_->input, obj->vendor_string.entry, obj->vendor_string.length, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + obj->vendor_string.entry[obj->vendor_string.length] = '\0'; + } + else + obj->vendor_string.entry = 0; + + /* read num comments */ + FLAC__ASSERT(FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN == 32); + if(!FLAC__bitbuffer_read_raw_uint32_little_endian(decoder->private_->input, &obj->num_comments, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + + /* read comments */ + if(obj->num_comments > 0) { + if(0 == (obj->comments = (FLAC__StreamMetadata_VorbisComment_Entry*)malloc(obj->num_comments * sizeof(FLAC__StreamMetadata_VorbisComment_Entry)))) { + decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; + return false; + } + for(i = 0; i < obj->num_comments; i++) { + FLAC__ASSERT(FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN == 32); + if(!FLAC__bitbuffer_read_raw_uint32_little_endian(decoder->private_->input, &obj->comments[i].length, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + if(obj->comments[i].length > 0) { + if(0 == (obj->comments[i].entry = (FLAC__byte*)malloc(obj->comments[i].length+1))) { + decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; + return false; + } + if(!FLAC__bitbuffer_read_byte_block_aligned_no_crc(decoder->private_->input, obj->comments[i].entry, obj->comments[i].length, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + obj->comments[i].entry[obj->comments[i].length] = '\0'; + } + else + obj->comments[i].entry = 0; + } + } + else { + obj->comments = 0; + } + + return true; +} + +FLAC__bool read_metadata_cuesheet_(FLAC__StreamDecoder *decoder, FLAC__StreamMetadata_CueSheet *obj) +{ + FLAC__uint32 i, j, x; + + FLAC__ASSERT(FLAC__bitbuffer_is_consumed_byte_aligned(decoder->private_->input)); + + memset(obj, 0, sizeof(FLAC__StreamMetadata_CueSheet)); + + FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_MEDIA_CATALOG_NUMBER_LEN % 8 == 0); + if(!FLAC__bitbuffer_read_byte_block_aligned_no_crc(decoder->private_->input, (FLAC__byte*)obj->media_catalog_number, FLAC__STREAM_METADATA_CUESHEET_MEDIA_CATALOG_NUMBER_LEN/8, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + + if(!FLAC__bitbuffer_read_raw_uint64(decoder->private_->input, &obj->lead_in, FLAC__STREAM_METADATA_CUESHEET_LEAD_IN_LEN, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + + if(!FLAC__bitbuffer_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_CUESHEET_IS_CD_LEN, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + obj->is_cd = x? true : false; + + if(!FLAC__bitbuffer_skip_bits_no_crc(decoder->private_->input, FLAC__STREAM_METADATA_CUESHEET_RESERVED_LEN, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + + if(!FLAC__bitbuffer_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_CUESHEET_NUM_TRACKS_LEN, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + obj->num_tracks = x; + + if(obj->num_tracks > 0) { + if(0 == (obj->tracks = (FLAC__StreamMetadata_CueSheet_Track*)calloc(obj->num_tracks, sizeof(FLAC__StreamMetadata_CueSheet_Track)))) { + decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; + return false; + } + for(i = 0; i < obj->num_tracks; i++) { + FLAC__StreamMetadata_CueSheet_Track *track = &obj->tracks[i]; + if(!FLAC__bitbuffer_read_raw_uint64(decoder->private_->input, &track->offset, FLAC__STREAM_METADATA_CUESHEET_TRACK_OFFSET_LEN, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + + if(!FLAC__bitbuffer_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_CUESHEET_TRACK_NUMBER_LEN, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + track->number = (FLAC__byte)x; + + FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_TRACK_ISRC_LEN % 8 == 0); + if(!FLAC__bitbuffer_read_byte_block_aligned_no_crc(decoder->private_->input, (FLAC__byte*)track->isrc, FLAC__STREAM_METADATA_CUESHEET_TRACK_ISRC_LEN/8, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + + if(!FLAC__bitbuffer_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_CUESHEET_TRACK_TYPE_LEN, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + track->type = x; + + if(!FLAC__bitbuffer_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_CUESHEET_TRACK_PRE_EMPHASIS_LEN, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + track->pre_emphasis = x; + + if(!FLAC__bitbuffer_skip_bits_no_crc(decoder->private_->input, FLAC__STREAM_METADATA_CUESHEET_TRACK_RESERVED_LEN, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + + if(!FLAC__bitbuffer_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_CUESHEET_TRACK_NUM_INDICES_LEN, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + track->num_indices = (FLAC__byte)x; + + if(track->num_indices > 0) { + if(0 == (track->indices = (FLAC__StreamMetadata_CueSheet_Index*)calloc(track->num_indices, sizeof(FLAC__StreamMetadata_CueSheet_Index)))) { + decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; + return false; + } + for(j = 0; j < track->num_indices; j++) { + FLAC__StreamMetadata_CueSheet_Index *index = &track->indices[j]; + if(!FLAC__bitbuffer_read_raw_uint64(decoder->private_->input, &index->offset, FLAC__STREAM_METADATA_CUESHEET_INDEX_OFFSET_LEN, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + + if(!FLAC__bitbuffer_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_CUESHEET_INDEX_NUMBER_LEN, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + index->number = (FLAC__byte)x; + + if(!FLAC__bitbuffer_skip_bits_no_crc(decoder->private_->input, FLAC__STREAM_METADATA_CUESHEET_INDEX_RESERVED_LEN, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + } + } + } + } + + return true; +} + +FLAC__bool skip_id3v2_tag_(FLAC__StreamDecoder *decoder) +{ + FLAC__uint32 x; + unsigned i, skip; + + /* skip the version and flags bytes */ + if(!FLAC__bitbuffer_read_raw_uint32(decoder->private_->input, &x, 24, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + /* get the size (in bytes) to skip */ + skip = 0; + for(i = 0; i < 4; i++) { + if(!FLAC__bitbuffer_read_raw_uint32(decoder->private_->input, &x, 8, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + skip <<= 7; + skip |= (x & 0x7f); + } + /* skip the rest of the tag */ + if(!FLAC__bitbuffer_read_byte_block_aligned_no_crc(decoder->private_->input, 0, skip, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + return true; +} + +FLAC__bool frame_sync_(FLAC__StreamDecoder *decoder) +{ + FLAC__uint32 x; + FLAC__bool first = true; + + /* If we know the total number of samples in the stream, stop if we've read that many. */ + /* This will stop us, for example, from wasting time trying to sync on an ID3V1 tag. */ + if(decoder->private_->has_stream_info && decoder->private_->stream_info.data.stream_info.total_samples) { + if(decoder->private_->samples_decoded >= decoder->private_->stream_info.data.stream_info.total_samples) { + decoder->protected_->state = FLAC__STREAM_DECODER_END_OF_STREAM; + return true; + } + } + + /* make sure we're byte aligned */ + if(!FLAC__bitbuffer_is_consumed_byte_aligned(decoder->private_->input)) { + if(!FLAC__bitbuffer_read_raw_uint32(decoder->private_->input, &x, FLAC__bitbuffer_bits_left_for_byte_alignment(decoder->private_->input), read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + } + + while(1) { + if(decoder->private_->cached) { + x = (FLAC__uint32)decoder->private_->lookahead; + decoder->private_->cached = false; + } + else { + if(!FLAC__bitbuffer_read_raw_uint32(decoder->private_->input, &x, 8, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + } + if(x == 0xff) { /* MAGIC NUMBER for the first 8 frame sync bits */ + decoder->private_->header_warmup[0] = (FLAC__byte)x; + if(!FLAC__bitbuffer_read_raw_uint32(decoder->private_->input, &x, 8, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + + /* we have to check if we just read two 0xff's in a row; the second may actually be the beginning of the sync code */ + /* else we have to check if the second byte is the end of a sync code */ + if(x == 0xff) { /* MAGIC NUMBER for the first 8 frame sync bits */ + decoder->private_->lookahead = (FLAC__byte)x; + decoder->private_->cached = true; + } + else if(x >> 2 == 0x3e) { /* MAGIC NUMBER for the last 6 sync bits */ + decoder->private_->header_warmup[1] = (FLAC__byte)x; + decoder->protected_->state = FLAC__STREAM_DECODER_READ_FRAME; + return true; + } + } + if(first) { + decoder->private_->error_callback(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC, decoder->private_->client_data); + first = false; + } + } + + return true; +} + +FLAC__bool read_frame_(FLAC__StreamDecoder *decoder, FLAC__bool *got_a_frame, FLAC__bool do_full_decode) +{ + unsigned channel; + unsigned i; + FLAC__int32 mid, side, left, right; + FLAC__uint16 frame_crc; /* the one we calculate from the input stream */ + FLAC__uint32 x; + + *got_a_frame = false; + + /* init the CRC */ + frame_crc = 0; + FLAC__CRC16_UPDATE(decoder->private_->header_warmup[0], frame_crc); + FLAC__CRC16_UPDATE(decoder->private_->header_warmup[1], frame_crc); + FLAC__bitbuffer_reset_read_crc16(decoder->private_->input, frame_crc); + + if(!read_frame_header_(decoder)) + return false; + if(decoder->protected_->state == FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC) + return true; + if(!allocate_output_(decoder, decoder->private_->frame.header.blocksize, decoder->private_->frame.header.channels)) + return false; + for(channel = 0; channel < decoder->private_->frame.header.channels; channel++) { + /* + * first figure the correct bits-per-sample of the subframe + */ + unsigned bps = decoder->private_->frame.header.bits_per_sample; + switch(decoder->private_->frame.header.channel_assignment) { + case FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT: + /* no adjustment needed */ + break; + case FLAC__CHANNEL_ASSIGNMENT_LEFT_SIDE: + FLAC__ASSERT(decoder->private_->frame.header.channels == 2); + if(channel == 1) + bps++; + break; + case FLAC__CHANNEL_ASSIGNMENT_RIGHT_SIDE: + FLAC__ASSERT(decoder->private_->frame.header.channels == 2); + if(channel == 0) + bps++; + break; + case FLAC__CHANNEL_ASSIGNMENT_MID_SIDE: + FLAC__ASSERT(decoder->private_->frame.header.channels == 2); + if(channel == 1) + bps++; + break; + default: + FLAC__ASSERT(0); + } + /* + * now read it + */ + if(!read_subframe_(decoder, channel, bps, do_full_decode)) + return false; + if(decoder->protected_->state != FLAC__STREAM_DECODER_READ_FRAME) { + decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC; + return true; + } + } + if(!read_zero_padding_(decoder)) + return false; + + /* + * Read the frame CRC-16 from the footer and check + */ + frame_crc = FLAC__bitbuffer_get_read_crc16(decoder->private_->input); + if(!FLAC__bitbuffer_read_raw_uint32(decoder->private_->input, &x, FLAC__FRAME_FOOTER_CRC_LEN, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + if(frame_crc == (FLAC__uint16)x) { + if(do_full_decode) { + /* Undo any special channel coding */ + switch(decoder->private_->frame.header.channel_assignment) { + case FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT: + /* do nothing */ + break; + case FLAC__CHANNEL_ASSIGNMENT_LEFT_SIDE: + FLAC__ASSERT(decoder->private_->frame.header.channels == 2); + for(i = 0; i < decoder->private_->frame.header.blocksize; i++) + decoder->private_->output[1][i] = decoder->private_->output[0][i] - decoder->private_->output[1][i]; + break; + case FLAC__CHANNEL_ASSIGNMENT_RIGHT_SIDE: + FLAC__ASSERT(decoder->private_->frame.header.channels == 2); + for(i = 0; i < decoder->private_->frame.header.blocksize; i++) + decoder->private_->output[0][i] += decoder->private_->output[1][i]; + break; + case FLAC__CHANNEL_ASSIGNMENT_MID_SIDE: + FLAC__ASSERT(decoder->private_->frame.header.channels == 2); + for(i = 0; i < decoder->private_->frame.header.blocksize; i++) { + mid = decoder->private_->output[0][i]; + side = decoder->private_->output[1][i]; + mid <<= 1; + if(side & 1) /* i.e. if 'side' is odd... */ + mid++; + left = mid + side; + right = mid - side; + decoder->private_->output[0][i] = left >> 1; + decoder->private_->output[1][i] = right >> 1; + } + break; + default: + FLAC__ASSERT(0); + break; + } + } + } + else { + /* Bad frame, emit error and zero the output signal */ + decoder->private_->error_callback(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_FRAME_CRC_MISMATCH, decoder->private_->client_data); + if(do_full_decode) { + for(channel = 0; channel < decoder->private_->frame.header.channels; channel++) { + memset(decoder->private_->output[channel], 0, sizeof(FLAC__int32) * decoder->private_->frame.header.blocksize); + } + } + } + + *got_a_frame = true; + + /* put the latest values into the public section of the decoder instance */ + decoder->protected_->channels = decoder->private_->frame.header.channels; + decoder->protected_->channel_assignment = decoder->private_->frame.header.channel_assignment; + decoder->protected_->bits_per_sample = decoder->private_->frame.header.bits_per_sample; + decoder->protected_->sample_rate = decoder->private_->frame.header.sample_rate; + decoder->protected_->blocksize = decoder->private_->frame.header.blocksize; + + FLAC__ASSERT(decoder->private_->frame.header.number_type == FLAC__FRAME_NUMBER_TYPE_SAMPLE_NUMBER); + decoder->private_->samples_decoded = decoder->private_->frame.header.number.sample_number + decoder->private_->frame.header.blocksize; + + /* write it */ + if(do_full_decode) { + if(decoder->private_->write_callback(decoder, &decoder->private_->frame, (const FLAC__int32 * const *)decoder->private_->output, decoder->private_->client_data) != FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE) + return false; + } + + decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC; + return true; +} + +FLAC__bool read_frame_header_(FLAC__StreamDecoder *decoder) +{ + FLAC__uint32 x; + FLAC__uint64 xx; + unsigned i, blocksize_hint = 0, sample_rate_hint = 0; + FLAC__byte crc8, raw_header[16]; /* MAGIC NUMBER based on the maximum frame header size, including CRC */ + unsigned raw_header_len; + FLAC__bool is_unparseable = false; + const FLAC__bool is_known_variable_blocksize_stream = (decoder->private_->has_stream_info && decoder->private_->stream_info.data.stream_info.min_blocksize != decoder->private_->stream_info.data.stream_info.max_blocksize); + const FLAC__bool is_known_fixed_blocksize_stream = (decoder->private_->has_stream_info && decoder->private_->stream_info.data.stream_info.min_blocksize == decoder->private_->stream_info.data.stream_info.max_blocksize); + + FLAC__ASSERT(FLAC__bitbuffer_is_consumed_byte_aligned(decoder->private_->input)); + + /* init the raw header with the saved bits from synchronization */ + raw_header[0] = decoder->private_->header_warmup[0]; + raw_header[1] = decoder->private_->header_warmup[1]; + raw_header_len = 2; + + /* + * check to make sure that the reserved bits are 0 + */ + if(raw_header[1] & 0x03) { /* MAGIC NUMBER */ + is_unparseable = true; + } + + /* + * Note that along the way as we read the header, we look for a sync + * code inside. If we find one it would indicate that our original + * sync was bad since there cannot be a sync code in a valid header. + */ + + /* + * read in the raw header as bytes so we can CRC it, and parse it on the way + */ + for(i = 0; i < 2; i++) { + if(!FLAC__bitbuffer_read_raw_uint32(decoder->private_->input, &x, 8, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + if(x == 0xff) { /* MAGIC NUMBER for the first 8 frame sync bits */ + /* if we get here it means our original sync was erroneous since the sync code cannot appear in the header */ + decoder->private_->lookahead = (FLAC__byte)x; + decoder->private_->cached = true; + decoder->private_->error_callback(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER, decoder->private_->client_data); + decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC; + return true; + } + raw_header[raw_header_len++] = (FLAC__byte)x; + } + + switch(x = raw_header[2] >> 4) { + case 0: + if(is_known_fixed_blocksize_stream) + decoder->private_->frame.header.blocksize = decoder->private_->stream_info.data.stream_info.min_blocksize; + else + is_unparseable = true; + break; + case 1: + decoder->private_->frame.header.blocksize = 192; + break; + case 2: + case 3: + case 4: + case 5: + decoder->private_->frame.header.blocksize = 576 << (x-2); + break; + case 6: + case 7: + blocksize_hint = x; + break; + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + decoder->private_->frame.header.blocksize = 256 << (x-8); + break; + default: + FLAC__ASSERT(0); + break; + } + + switch(x = raw_header[2] & 0x0f) { + case 0: + if(decoder->private_->has_stream_info) + decoder->private_->frame.header.sample_rate = decoder->private_->stream_info.data.stream_info.sample_rate; + else + is_unparseable = true; + break; + case 1: + case 2: + case 3: + is_unparseable = true; + break; + case 4: + decoder->private_->frame.header.sample_rate = 8000; + break; + case 5: + decoder->private_->frame.header.sample_rate = 16000; + break; + case 6: + decoder->private_->frame.header.sample_rate = 22050; + break; + case 7: + decoder->private_->frame.header.sample_rate = 24000; + break; + case 8: + decoder->private_->frame.header.sample_rate = 32000; + break; + case 9: + decoder->private_->frame.header.sample_rate = 44100; + break; + case 10: + decoder->private_->frame.header.sample_rate = 48000; + break; + case 11: + decoder->private_->frame.header.sample_rate = 96000; + break; + case 12: + case 13: + case 14: + sample_rate_hint = x; + break; + case 15: + decoder->private_->error_callback(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER, decoder->private_->client_data); + decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC; + return true; + default: + FLAC__ASSERT(0); + } + + x = (unsigned)(raw_header[3] >> 4); + if(x & 8) { + decoder->private_->frame.header.channels = 2; + switch(x & 7) { + case 0: + decoder->private_->frame.header.channel_assignment = FLAC__CHANNEL_ASSIGNMENT_LEFT_SIDE; + break; + case 1: + decoder->private_->frame.header.channel_assignment = FLAC__CHANNEL_ASSIGNMENT_RIGHT_SIDE; + break; + case 2: + decoder->private_->frame.header.channel_assignment = FLAC__CHANNEL_ASSIGNMENT_MID_SIDE; + break; + default: + is_unparseable = true; + break; + } + } + else { + decoder->private_->frame.header.channels = (unsigned)x + 1; + decoder->private_->frame.header.channel_assignment = FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT; + } + + switch(x = (unsigned)(raw_header[3] & 0x0e) >> 1) { + case 0: + if(decoder->private_->has_stream_info) + decoder->private_->frame.header.bits_per_sample = decoder->private_->stream_info.data.stream_info.bits_per_sample; + else + is_unparseable = true; + break; + case 1: + decoder->private_->frame.header.bits_per_sample = 8; + break; + case 2: + decoder->private_->frame.header.bits_per_sample = 12; + break; + case 4: + decoder->private_->frame.header.bits_per_sample = 16; + break; + case 5: + decoder->private_->frame.header.bits_per_sample = 20; + break; + case 6: + decoder->private_->frame.header.bits_per_sample = 24; + break; + case 3: + case 7: + is_unparseable = true; + break; + default: + FLAC__ASSERT(0); + break; + } + + if(raw_header[3] & 0x01) { /* this should be a zero padding bit */ + decoder->private_->error_callback(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER, decoder->private_->client_data); + decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC; + return true; + } + + /* + * Now we get to the regrettable consequences of not knowing for sure + * whether we got a frame number or a sample number. There are no + * encoders that do variable-blocksize encoding so unless we know from + * the STREAMINFO that it is variable-blocksize we will assume it is + * fixed-blocksize. The trouble comes when we have no STREAMINFO; again + * we will guess that is fixed-blocksize. Where this can go wrong: 1) a + * variable-blocksize stream with no STREAMINFO; 2) a fixed-blocksize + * stream that was edited such that one or more frames before or + * including this one do not have the same number of samples as the + * STREAMINFO's min and max blocksize. + */ + if(is_known_variable_blocksize_stream) { + if(blocksize_hint) { + if(!FLAC__bitbuffer_read_utf8_uint64(decoder->private_->input, &xx, read_callback_, decoder, raw_header, &raw_header_len)) + return false; /* the read_callback_ sets the state for us */ + if(xx == FLAC__U64L(0xffffffffffffffff)) { /* i.e. non-UTF8 code... */ + decoder->private_->lookahead = raw_header[raw_header_len-1]; /* back up as much as we can */ + decoder->private_->cached = true; + decoder->private_->error_callback(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER, decoder->private_->client_data); + decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC; + return true; + } + decoder->private_->frame.header.number_type = FLAC__FRAME_NUMBER_TYPE_SAMPLE_NUMBER; + decoder->private_->frame.header.number.sample_number = xx; + } + else + is_unparseable = true; + } + else { + if(!FLAC__bitbuffer_read_utf8_uint32(decoder->private_->input, &x, read_callback_, decoder, raw_header, &raw_header_len)) + return false; /* the read_callback_ sets the state for us */ + if(x == 0xffffffff) { /* i.e. non-UTF8 code... */ + decoder->private_->lookahead = raw_header[raw_header_len-1]; /* back up as much as we can */ + decoder->private_->cached = true; + decoder->private_->error_callback(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER, decoder->private_->client_data); + decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC; + return true; + } + decoder->private_->last_frame_number = x; + decoder->private_->frame.header.number_type = FLAC__FRAME_NUMBER_TYPE_SAMPLE_NUMBER; + if(decoder->private_->has_stream_info) { + FLAC__ASSERT(decoder->private_->stream_info.data.stream_info.min_blocksize == decoder->private_->stream_info.data.stream_info.max_blocksize); + decoder->private_->frame.header.number.sample_number = (FLAC__uint64)decoder->private_->stream_info.data.stream_info.min_blocksize * (FLAC__uint64)x; + decoder->private_->last_block_size = decoder->private_->frame.header.blocksize; + } + else if(blocksize_hint) { + if(decoder->private_->last_block_size) + decoder->private_->frame.header.number.sample_number = (FLAC__uint64)decoder->private_->last_block_size * (FLAC__uint64)x; + else + is_unparseable = true; + } + else { + decoder->private_->frame.header.number.sample_number = (FLAC__uint64)decoder->private_->frame.header.blocksize * (FLAC__uint64)x; + decoder->private_->last_block_size = decoder->private_->frame.header.blocksize; + } + } + + if(blocksize_hint) { + if(!FLAC__bitbuffer_read_raw_uint32(decoder->private_->input, &x, 8, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + raw_header[raw_header_len++] = (FLAC__byte)x; + if(blocksize_hint == 7) { + FLAC__uint32 _x; + if(!FLAC__bitbuffer_read_raw_uint32(decoder->private_->input, &_x, 8, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + raw_header[raw_header_len++] = (FLAC__byte)_x; + x = (x << 8) | _x; + } + decoder->private_->frame.header.blocksize = x+1; + } + + if(sample_rate_hint) { + if(!FLAC__bitbuffer_read_raw_uint32(decoder->private_->input, &x, 8, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + raw_header[raw_header_len++] = (FLAC__byte)x; + if(sample_rate_hint != 12) { + FLAC__uint32 _x; + if(!FLAC__bitbuffer_read_raw_uint32(decoder->private_->input, &_x, 8, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + raw_header[raw_header_len++] = (FLAC__byte)_x; + x = (x << 8) | _x; + } + if(sample_rate_hint == 12) + decoder->private_->frame.header.sample_rate = x*1000; + else if(sample_rate_hint == 13) + decoder->private_->frame.header.sample_rate = x; + else + decoder->private_->frame.header.sample_rate = x*10; + } + + /* read the CRC-8 byte */ + if(!FLAC__bitbuffer_read_raw_uint32(decoder->private_->input, &x, 8, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + crc8 = (FLAC__byte)x; + + if(FLAC__crc8(raw_header, raw_header_len) != crc8) { + decoder->private_->error_callback(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER, decoder->private_->client_data); + decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC; + return true; + } + + if(is_unparseable) { + decoder->protected_->state = FLAC__STREAM_DECODER_UNPARSEABLE_STREAM; + return false; + } + + return true; +} + +FLAC__bool read_subframe_(FLAC__StreamDecoder *decoder, unsigned channel, unsigned bps, FLAC__bool do_full_decode) +{ + FLAC__uint32 x; + FLAC__bool wasted_bits; + + if(!FLAC__bitbuffer_read_raw_uint32(decoder->private_->input, &x, 8, read_callback_, decoder)) /* MAGIC NUMBER */ + return false; /* the read_callback_ sets the state for us */ + + wasted_bits = (x & 1); + x &= 0xfe; + + if(wasted_bits) { + unsigned u; + if(!FLAC__bitbuffer_read_unary_unsigned(decoder->private_->input, &u, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + decoder->private_->frame.subframes[channel].wasted_bits = u+1; + bps -= decoder->private_->frame.subframes[channel].wasted_bits; + } + else + decoder->private_->frame.subframes[channel].wasted_bits = 0; + + /* + * Lots of magic numbers here + */ + if(x & 0x80) { + decoder->private_->error_callback(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC, decoder->private_->client_data); + decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC; + return true; + } + else if(x == 0) { + if(!read_subframe_constant_(decoder, channel, bps, do_full_decode)) + return false; + } + else if(x == 2) { + if(!read_subframe_verbatim_(decoder, channel, bps, do_full_decode)) + return false; + } + else if(x < 16) { + decoder->protected_->state = FLAC__STREAM_DECODER_UNPARSEABLE_STREAM; + return false; + } + else if(x <= 24) { + if(!read_subframe_fixed_(decoder, channel, bps, (x>>1)&7, do_full_decode)) + return false; + } + else if(x < 64) { + decoder->protected_->state = FLAC__STREAM_DECODER_UNPARSEABLE_STREAM; + return false; + } + else { + if(!read_subframe_lpc_(decoder, channel, bps, ((x>>1)&31)+1, do_full_decode)) + return false; + } + + if(wasted_bits && do_full_decode) { + unsigned i; + x = decoder->private_->frame.subframes[channel].wasted_bits; + for(i = 0; i < decoder->private_->frame.header.blocksize; i++) + decoder->private_->output[channel][i] <<= x; + } + + return true; +} + +FLAC__bool read_subframe_constant_(FLAC__StreamDecoder *decoder, unsigned channel, unsigned bps, FLAC__bool do_full_decode) +{ + FLAC__Subframe_Constant *subframe = &decoder->private_->frame.subframes[channel].data.constant; + FLAC__int32 x; + unsigned i; + FLAC__int32 *output = decoder->private_->output[channel]; + + decoder->private_->frame.subframes[channel].type = FLAC__SUBFRAME_TYPE_CONSTANT; + + if(!FLAC__bitbuffer_read_raw_int32(decoder->private_->input, &x, bps, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + + subframe->value = x; + + /* decode the subframe */ + if(do_full_decode) { + for(i = 0; i < decoder->private_->frame.header.blocksize; i++) + output[i] = x; + } + + return true; +} + +FLAC__bool read_subframe_fixed_(FLAC__StreamDecoder *decoder, unsigned channel, unsigned bps, const unsigned order, FLAC__bool do_full_decode) +{ + FLAC__Subframe_Fixed *subframe = &decoder->private_->frame.subframes[channel].data.fixed; + FLAC__int32 i32; + FLAC__uint32 u32; + unsigned u; + + decoder->private_->frame.subframes[channel].type = FLAC__SUBFRAME_TYPE_FIXED; + + subframe->residual = decoder->private_->residual[channel]; + subframe->order = order; + + /* read warm-up samples */ + for(u = 0; u < order; u++) { + if(!FLAC__bitbuffer_read_raw_int32(decoder->private_->input, &i32, bps, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + subframe->warmup[u] = i32; + } + + /* read entropy coding method info */ + if(!FLAC__bitbuffer_read_raw_uint32(decoder->private_->input, &u32, FLAC__ENTROPY_CODING_METHOD_TYPE_LEN, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + subframe->entropy_coding_method.type = (FLAC__EntropyCodingMethodType)u32; + switch(subframe->entropy_coding_method.type) { + case FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE: + if(!FLAC__bitbuffer_read_raw_uint32(decoder->private_->input, &u32, FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ORDER_LEN, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + subframe->entropy_coding_method.data.partitioned_rice.order = u32; + subframe->entropy_coding_method.data.partitioned_rice.contents = &decoder->private_->partitioned_rice_contents[channel]; + break; + default: + decoder->protected_->state = FLAC__STREAM_DECODER_UNPARSEABLE_STREAM; + return false; + } + + /* read residual */ + switch(subframe->entropy_coding_method.type) { + case FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE: + if(!read_residual_partitioned_rice_(decoder, order, subframe->entropy_coding_method.data.partitioned_rice.order, &decoder->private_->partitioned_rice_contents[channel], decoder->private_->residual[channel])) + return false; + break; + default: + FLAC__ASSERT(0); + } + + /* decode the subframe */ + if(do_full_decode) { + memcpy(decoder->private_->output[channel], subframe->warmup, sizeof(FLAC__int32) * order); + FLAC__fixed_restore_signal(decoder->private_->residual[channel], decoder->private_->frame.header.blocksize-order, order, decoder->private_->output[channel]+order); + } + + return true; +} + +FLAC__bool read_subframe_lpc_(FLAC__StreamDecoder *decoder, unsigned channel, unsigned bps, const unsigned order, FLAC__bool do_full_decode) +{ + FLAC__Subframe_LPC *subframe = &decoder->private_->frame.subframes[channel].data.lpc; + FLAC__int32 i32; + FLAC__uint32 u32; + unsigned u; + + decoder->private_->frame.subframes[channel].type = FLAC__SUBFRAME_TYPE_LPC; + + subframe->residual = decoder->private_->residual[channel]; + subframe->order = order; + + /* read warm-up samples */ + for(u = 0; u < order; u++) { + if(!FLAC__bitbuffer_read_raw_int32(decoder->private_->input, &i32, bps, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + subframe->warmup[u] = i32; + } + + /* read qlp coeff precision */ + if(!FLAC__bitbuffer_read_raw_uint32(decoder->private_->input, &u32, FLAC__SUBFRAME_LPC_QLP_COEFF_PRECISION_LEN, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + if(u32 == (1u << FLAC__SUBFRAME_LPC_QLP_COEFF_PRECISION_LEN) - 1) { + decoder->private_->error_callback(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC, decoder->private_->client_data); + decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC; + return true; + } + subframe->qlp_coeff_precision = u32+1; + + /* read qlp shift */ + if(!FLAC__bitbuffer_read_raw_int32(decoder->private_->input, &i32, FLAC__SUBFRAME_LPC_QLP_SHIFT_LEN, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + subframe->quantization_level = i32; + + /* read quantized lp coefficiencts */ + for(u = 0; u < order; u++) { + if(!FLAC__bitbuffer_read_raw_int32(decoder->private_->input, &i32, subframe->qlp_coeff_precision, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + subframe->qlp_coeff[u] = i32; + } + + /* read entropy coding method info */ + if(!FLAC__bitbuffer_read_raw_uint32(decoder->private_->input, &u32, FLAC__ENTROPY_CODING_METHOD_TYPE_LEN, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + subframe->entropy_coding_method.type = (FLAC__EntropyCodingMethodType)u32; + switch(subframe->entropy_coding_method.type) { + case FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE: + if(!FLAC__bitbuffer_read_raw_uint32(decoder->private_->input, &u32, FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ORDER_LEN, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + subframe->entropy_coding_method.data.partitioned_rice.order = u32; + subframe->entropy_coding_method.data.partitioned_rice.contents = &decoder->private_->partitioned_rice_contents[channel]; + break; + default: + decoder->protected_->state = FLAC__STREAM_DECODER_UNPARSEABLE_STREAM; + return false; + } + + /* read residual */ + switch(subframe->entropy_coding_method.type) { + case FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE: + if(!read_residual_partitioned_rice_(decoder, order, subframe->entropy_coding_method.data.partitioned_rice.order, &decoder->private_->partitioned_rice_contents[channel], decoder->private_->residual[channel])) + return false; + break; + default: + FLAC__ASSERT(0); + } + + /* decode the subframe */ + if(do_full_decode) { + memcpy(decoder->private_->output[channel], subframe->warmup, sizeof(FLAC__int32) * order); + if(bps + subframe->qlp_coeff_precision + FLAC__bitmath_ilog2(order) <= 32) + if(bps <= 16 && subframe->qlp_coeff_precision <= 16) { + if(order <= 8) + decoder->private_->local_lpc_restore_signal_16bit_order8(decoder->private_->residual[channel], decoder->private_->frame.header.blocksize-order, subframe->qlp_coeff, order, subframe->quantization_level, decoder->private_->output[channel]+order); + else + decoder->private_->local_lpc_restore_signal_16bit(decoder->private_->residual[channel], decoder->private_->frame.header.blocksize-order, subframe->qlp_coeff, order, subframe->quantization_level, decoder->private_->output[channel]+order); + } + else + decoder->private_->local_lpc_restore_signal(decoder->private_->residual[channel], decoder->private_->frame.header.blocksize-order, subframe->qlp_coeff, order, subframe->quantization_level, decoder->private_->output[channel]+order); + else + decoder->private_->local_lpc_restore_signal_64bit(decoder->private_->residual[channel], decoder->private_->frame.header.blocksize-order, subframe->qlp_coeff, order, subframe->quantization_level, decoder->private_->output[channel]+order); + } + + return true; +} + +FLAC__bool read_subframe_verbatim_(FLAC__StreamDecoder *decoder, unsigned channel, unsigned bps, FLAC__bool do_full_decode) +{ + FLAC__Subframe_Verbatim *subframe = &decoder->private_->frame.subframes[channel].data.verbatim; + FLAC__int32 x, *residual = decoder->private_->residual[channel]; + unsigned i; + + decoder->private_->frame.subframes[channel].type = FLAC__SUBFRAME_TYPE_VERBATIM; + + subframe->data = residual; + + for(i = 0; i < decoder->private_->frame.header.blocksize; i++) { + if(!FLAC__bitbuffer_read_raw_int32(decoder->private_->input, &x, bps, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + residual[i] = x; + } + + /* decode the subframe */ + if(do_full_decode) + memcpy(decoder->private_->output[channel], subframe->data, sizeof(FLAC__int32) * decoder->private_->frame.header.blocksize); + + return true; +} + +FLAC__bool read_residual_partitioned_rice_(FLAC__StreamDecoder *decoder, unsigned predictor_order, unsigned partition_order, FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents, FLAC__int32 *residual) +{ + FLAC__uint32 rice_parameter; + int i; + unsigned partition, sample, u; + const unsigned partitions = 1u << partition_order; + const unsigned partition_samples = partition_order > 0? decoder->private_->frame.header.blocksize >> partition_order : decoder->private_->frame.header.blocksize - predictor_order; + + /* sanity checks */ + if(partition_order == 0) { + if(decoder->private_->frame.header.blocksize < predictor_order) { + decoder->private_->error_callback(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC, decoder->private_->client_data); + decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC; + return true; + } + } + else { + if(partition_samples < predictor_order) { + decoder->private_->error_callback(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC, decoder->private_->client_data); + decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC; + return true; + } + } + + if(!FLAC__format_entropy_coding_method_partitioned_rice_contents_ensure_size(partitioned_rice_contents, max(6, partition_order))) { + decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; + return false; + } + + sample = 0; + for(partition = 0; partition < partitions; partition++) { + if(!FLAC__bitbuffer_read_raw_uint32(decoder->private_->input, &rice_parameter, FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + partitioned_rice_contents->parameters[partition] = rice_parameter; + if(rice_parameter < FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER) { +#ifdef FLAC__SYMMETRIC_RICE + for(u = (partition_order == 0 || partition > 0)? 0 : predictor_order; u < partition_samples; u++, sample++) { + if(!FLAC__bitbuffer_read_symmetric_rice_signed(decoder->private_->input, &i, rice_parameter, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + residual[sample] = i; + } +#else + u = (partition_order == 0 || partition > 0)? partition_samples : partition_samples - predictor_order; + if(!FLAC__bitbuffer_read_rice_signed_block(decoder->private_->input, residual + sample, u, rice_parameter, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + sample += u; +#endif + } + else { + if(!FLAC__bitbuffer_read_raw_uint32(decoder->private_->input, &rice_parameter, FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_RAW_LEN, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + partitioned_rice_contents->raw_bits[partition] = rice_parameter; + for(u = (partition_order == 0 || partition > 0)? 0 : predictor_order; u < partition_samples; u++, sample++) { + if(!FLAC__bitbuffer_read_raw_int32(decoder->private_->input, &i, rice_parameter, read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + residual[sample] = i; + } + } + } + + return true; +} + +FLAC__bool read_zero_padding_(FLAC__StreamDecoder *decoder) +{ + if(!FLAC__bitbuffer_is_consumed_byte_aligned(decoder->private_->input)) { + FLAC__uint32 zero = 0; + if(!FLAC__bitbuffer_read_raw_uint32(decoder->private_->input, &zero, FLAC__bitbuffer_bits_left_for_byte_alignment(decoder->private_->input), read_callback_, decoder)) + return false; /* the read_callback_ sets the state for us */ + if(zero != 0) { + decoder->private_->error_callback(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC, decoder->private_->client_data); + decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC; + } + } + return true; +} + +FLAC__bool read_callback_(FLAC__byte buffer[], unsigned *bytes, void *client_data) +{ + FLAC__StreamDecoder *decoder = (FLAC__StreamDecoder *)client_data; + FLAC__StreamDecoderReadStatus status; + + status = decoder->private_->read_callback(decoder, buffer, bytes, decoder->private_->client_data); + if(status == FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM) + decoder->protected_->state = FLAC__STREAM_DECODER_END_OF_STREAM; + else if(status == FLAC__STREAM_DECODER_READ_STATUS_ABORT) + decoder->protected_->state = FLAC__STREAM_DECODER_ABORTED; + return status == FLAC__STREAM_DECODER_READ_STATUS_CONTINUE; +} diff --git a/Libraries/FLAC/Files/src/libFLAC/stream_encoder.c b/Libraries/FLAC/Files/src/libFLAC/stream_encoder.c new file mode 100644 index 000000000..33debfc06 --- /dev/null +++ b/Libraries/FLAC/Files/src/libFLAC/stream_encoder.c @@ -0,0 +1,3394 @@ +/* libFLAC - Free Lossless Audio Codec library + * Copyright (C) 2000,2001,2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include /* for malloc() */ +#include /* for memcpy() */ +#include "FLAC/assert.h" +#include "FLAC/stream_decoder.h" +#include "protected/stream_encoder.h" +#include "private/bitbuffer.h" +#include "private/bitmath.h" +#include "private/crc.h" +#include "private/cpu.h" +#include "private/fixed.h" +#include "private/format.h" +#include "private/lpc.h" +#include "private/md5.h" +#include "private/memory.h" +#include "private/stream_encoder_framing.h" + +#ifdef HAVE_CONFIG_H +#include +#endif + +#ifdef min +#undef min +#endif +#define min(x,y) ((x)<(y)?(x):(y)) + +#ifdef max +#undef max +#endif +#define max(x,y) ((x)>(y)?(x):(y)) + +typedef struct { + FLAC__int32 *data[FLAC__MAX_CHANNELS]; + unsigned size; /* of each data[] in samples */ + unsigned tail; +} verify_input_fifo; + +typedef struct { + const FLAC__byte *data; + unsigned capacity; + unsigned bytes; +} verify_output; + +typedef enum { + ENCODER_IN_MAGIC = 0, + ENCODER_IN_METADATA = 1, + ENCODER_IN_AUDIO = 2 +} EncoderStateHint; + +/*********************************************************************** + * + * Private class method prototypes + * + ***********************************************************************/ + +static void set_defaults_(FLAC__StreamEncoder *encoder); +static void free_(FLAC__StreamEncoder *encoder); +static FLAC__bool resize_buffers_(FLAC__StreamEncoder *encoder, unsigned new_size); +static FLAC__bool write_bitbuffer_(FLAC__StreamEncoder *encoder, unsigned samples); +static FLAC__bool process_frame_(FLAC__StreamEncoder *encoder, FLAC__bool is_last_frame); +static FLAC__bool process_subframes_(FLAC__StreamEncoder *encoder, FLAC__bool is_last_frame); + +static FLAC__bool process_subframe_( + FLAC__StreamEncoder *encoder, + unsigned min_partition_order, + unsigned max_partition_order, + FLAC__bool precompute_partition_sums, + const FLAC__FrameHeader *frame_header, + unsigned subframe_bps, + const FLAC__int32 integer_signal[], +#ifndef FLAC__INTEGER_ONLY_LIBRARY + const FLAC__real real_signal[], +#endif + FLAC__Subframe *subframe[2], + FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents[2], + FLAC__int32 *residual[2], + unsigned *best_subframe, + unsigned *best_bits +); + +static FLAC__bool add_subframe_( + FLAC__StreamEncoder *encoder, + const FLAC__FrameHeader *frame_header, + unsigned subframe_bps, + const FLAC__Subframe *subframe, + FLAC__BitBuffer *frame +); + +static unsigned evaluate_constant_subframe_( + const FLAC__int32 signal, + unsigned subframe_bps, + FLAC__Subframe *subframe +); + +static unsigned evaluate_fixed_subframe_( + FLAC__StreamEncoder *encoder, + const FLAC__int32 signal[], + FLAC__int32 residual[], + FLAC__uint32 abs_residual[], + FLAC__uint64 abs_residual_partition_sums[], + unsigned raw_bits_per_partition[], + unsigned blocksize, + unsigned subframe_bps, + unsigned order, + unsigned rice_parameter, + unsigned min_partition_order, + unsigned max_partition_order, + FLAC__bool precompute_partition_sums, + FLAC__bool do_escape_coding, + unsigned rice_parameter_search_dist, + FLAC__Subframe *subframe, + FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents +); + +#ifndef FLAC__INTEGER_ONLY_LIBRARY +static unsigned evaluate_lpc_subframe_( + FLAC__StreamEncoder *encoder, + const FLAC__int32 signal[], + FLAC__int32 residual[], + FLAC__uint32 abs_residual[], + FLAC__uint64 abs_residual_partition_sums[], + unsigned raw_bits_per_partition[], + const FLAC__real lp_coeff[], + unsigned blocksize, + unsigned subframe_bps, + unsigned order, + unsigned qlp_coeff_precision, + unsigned rice_parameter, + unsigned min_partition_order, + unsigned max_partition_order, + FLAC__bool precompute_partition_sums, + FLAC__bool do_escape_coding, + unsigned rice_parameter_search_dist, + FLAC__Subframe *subframe, + FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents +); +#endif + +static unsigned evaluate_verbatim_subframe_( + const FLAC__int32 signal[], + unsigned blocksize, + unsigned subframe_bps, + FLAC__Subframe *subframe +); + +static unsigned find_best_partition_order_( + struct FLAC__StreamEncoderPrivate *private_, + const FLAC__int32 residual[], + FLAC__uint32 abs_residual[], + FLAC__uint64 abs_residual_partition_sums[], + unsigned raw_bits_per_partition[], + unsigned residual_samples, + unsigned predictor_order, + unsigned rice_parameter, + unsigned min_partition_order, + unsigned max_partition_order, + FLAC__bool precompute_partition_sums, + FLAC__bool do_escape_coding, + unsigned rice_parameter_search_dist, + FLAC__EntropyCodingMethod_PartitionedRice *best_partitioned_rice +); + +static void precompute_partition_info_sums_( + const FLAC__uint32 abs_residual[], + FLAC__uint64 abs_residual_partition_sums[], + unsigned residual_samples, + unsigned predictor_order, + unsigned min_partition_order, + unsigned max_partition_order +); + +static void precompute_partition_info_escapes_( + const FLAC__int32 residual[], + unsigned raw_bits_per_partition[], + unsigned residual_samples, + unsigned predictor_order, + unsigned min_partition_order, + unsigned max_partition_order +); + +#ifdef DONT_ESTIMATE_RICE_BITS +static FLAC__bool set_partitioned_rice_( + const FLAC__uint32 abs_residual[], + const FLAC__int32 residual[], + const unsigned residual_samples, + const unsigned predictor_order, + const unsigned suggested_rice_parameter, + const unsigned rice_parameter_search_dist, + const unsigned partition_order, + FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents, + unsigned *bits +); + +static FLAC__bool set_partitioned_rice_with_precompute_( + const FLAC__int32 residual[], + const FLAC__uint64 abs_residual_partition_sums[], + const unsigned raw_bits_per_partition[], + const unsigned residual_samples, + const unsigned predictor_order, + const unsigned suggested_rice_parameter, + const unsigned rice_parameter_search_dist, + const unsigned partition_order, + const FLAC__bool search_for_escapes, + FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents, + unsigned *bits +); +#else +static FLAC__bool set_partitioned_rice_( + const FLAC__uint32 abs_residual[], + const unsigned residual_samples, + const unsigned predictor_order, + const unsigned suggested_rice_parameter, + const unsigned rice_parameter_search_dist, + const unsigned partition_order, + FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents, + unsigned *bits +); + +static FLAC__bool set_partitioned_rice_with_precompute_( + const FLAC__uint32 abs_residual[], + const FLAC__uint64 abs_residual_partition_sums[], + const unsigned raw_bits_per_partition[], + const unsigned residual_samples, + const unsigned predictor_order, + const unsigned suggested_rice_parameter, + const unsigned rice_parameter_search_dist, + const unsigned partition_order, + const FLAC__bool search_for_escapes, + FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents, + unsigned *bits +); +#endif + +static unsigned get_wasted_bits_(FLAC__int32 signal[], unsigned samples); + +/* verify-related routines: */ +static void append_to_verify_fifo_( + verify_input_fifo *fifo, + const FLAC__int32 * const input[], + unsigned input_offset, + unsigned channels, + unsigned wide_samples +); + +static void append_to_verify_fifo_interleaved_( + verify_input_fifo *fifo, + const FLAC__int32 input[], + unsigned input_offset, + unsigned channels, + unsigned wide_samples +); + +static FLAC__StreamDecoderReadStatus verify_read_callback_( + const FLAC__StreamDecoder *decoder, + FLAC__byte buffer[], + unsigned *bytes, + void *client_data +); + +static FLAC__StreamDecoderWriteStatus verify_write_callback_( + const FLAC__StreamDecoder *decoder, + const FLAC__Frame *frame, + const FLAC__int32 * const buffer[], + void *client_data +); + +static void verify_metadata_callback_( + const FLAC__StreamDecoder *decoder, + const FLAC__StreamMetadata *metadata, + void *client_data +); + +static void verify_error_callback_( + const FLAC__StreamDecoder *decoder, + FLAC__StreamDecoderErrorStatus status, + void *client_data +); + + +/*********************************************************************** + * + * Private class data + * + ***********************************************************************/ + +typedef struct FLAC__StreamEncoderPrivate { + unsigned input_capacity; /* current size (in samples) of the signal and residual buffers */ + FLAC__int32 *integer_signal[FLAC__MAX_CHANNELS]; /* the integer version of the input signal */ + FLAC__int32 *integer_signal_mid_side[2]; /* the integer version of the mid-side input signal (stereo only) */ +#ifndef FLAC__INTEGER_ONLY_LIBRARY + FLAC__real *real_signal[FLAC__MAX_CHANNELS]; /* the floating-point version of the input signal */ + FLAC__real *real_signal_mid_side[2]; /* the floating-point version of the mid-side input signal (stereo only) */ +#endif + unsigned subframe_bps[FLAC__MAX_CHANNELS]; /* the effective bits per sample of the input signal (stream bps - wasted bits) */ + unsigned subframe_bps_mid_side[2]; /* the effective bits per sample of the mid-side input signal (stream bps - wasted bits + 0/1) */ + FLAC__int32 *residual_workspace[FLAC__MAX_CHANNELS][2]; /* each channel has a candidate and best workspace where the subframe residual signals will be stored */ + FLAC__int32 *residual_workspace_mid_side[2][2]; + FLAC__Subframe subframe_workspace[FLAC__MAX_CHANNELS][2]; + FLAC__Subframe subframe_workspace_mid_side[2][2]; + FLAC__Subframe *subframe_workspace_ptr[FLAC__MAX_CHANNELS][2]; + FLAC__Subframe *subframe_workspace_ptr_mid_side[2][2]; + FLAC__EntropyCodingMethod_PartitionedRiceContents partitioned_rice_contents_workspace[FLAC__MAX_CHANNELS][2]; + FLAC__EntropyCodingMethod_PartitionedRiceContents partitioned_rice_contents_workspace_mid_side[FLAC__MAX_CHANNELS][2]; + FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents_workspace_ptr[FLAC__MAX_CHANNELS][2]; + FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents_workspace_ptr_mid_side[FLAC__MAX_CHANNELS][2]; + unsigned best_subframe[FLAC__MAX_CHANNELS]; /* index into the above workspaces */ + unsigned best_subframe_mid_side[2]; + unsigned best_subframe_bits[FLAC__MAX_CHANNELS]; /* size in bits of the best subframe for each channel */ + unsigned best_subframe_bits_mid_side[2]; + FLAC__uint32 *abs_residual; /* workspace where abs(candidate residual) is stored */ + FLAC__uint64 *abs_residual_partition_sums; /* workspace where the sum of abs(candidate residual) for each partition is stored */ + unsigned *raw_bits_per_partition; /* workspace where the sum of silog2(candidate residual) for each partition is stored */ + FLAC__BitBuffer *frame; /* the current frame being worked on */ + unsigned loose_mid_side_stereo_frames; /* rounded number of frames the encoder will use before trying both independent and mid/side frames again */ + unsigned loose_mid_side_stereo_frame_count; /* number of frames using the current channel assignment */ + FLAC__ChannelAssignment last_channel_assignment; + FLAC__StreamMetadata metadata; + unsigned current_sample_number; + unsigned current_frame_number; + struct FLAC__MD5Context md5context; + FLAC__CPUInfo cpuinfo; +#ifndef FLAC__INTEGER_ONLY_LIBRARY + unsigned (*local_fixed_compute_best_predictor)(const FLAC__int32 data[], unsigned data_len, FLAC__float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]); +#else + unsigned (*local_fixed_compute_best_predictor)(const FLAC__int32 data[], unsigned data_len, FLAC__fixedpoint residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]); +#endif +#ifndef FLAC__INTEGER_ONLY_LIBRARY + void (*local_lpc_compute_autocorrelation)(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[]); + void (*local_lpc_compute_residual_from_qlp_coefficients)(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[]); + void (*local_lpc_compute_residual_from_qlp_coefficients_64bit)(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[]); + void (*local_lpc_compute_residual_from_qlp_coefficients_16bit)(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[]); +#endif + FLAC__bool use_wide_by_block; /* use slow 64-bit versions of some functions because of the block size */ + FLAC__bool use_wide_by_partition; /* use slow 64-bit versions of some functions because of the min partition order and blocksize */ + FLAC__bool use_wide_by_order; /* use slow 64-bit versions of some functions because of the lpc order */ + FLAC__bool precompute_partition_sums; /* our initial guess as to whether precomputing the partitions sums will be a speed improvement */ + FLAC__bool disable_constant_subframes; + FLAC__bool disable_fixed_subframes; + FLAC__bool disable_verbatim_subframes; + FLAC__StreamEncoderWriteCallback write_callback; + FLAC__StreamEncoderMetadataCallback metadata_callback; + void *client_data; + /* unaligned (original) pointers to allocated data */ + FLAC__int32 *integer_signal_unaligned[FLAC__MAX_CHANNELS]; + FLAC__int32 *integer_signal_mid_side_unaligned[2]; +#ifndef FLAC__INTEGER_ONLY_LIBRARY + FLAC__real *real_signal_unaligned[FLAC__MAX_CHANNELS]; + FLAC__real *real_signal_mid_side_unaligned[2]; +#endif + FLAC__int32 *residual_workspace_unaligned[FLAC__MAX_CHANNELS][2]; + FLAC__int32 *residual_workspace_mid_side_unaligned[2][2]; + FLAC__uint32 *abs_residual_unaligned; + FLAC__uint64 *abs_residual_partition_sums_unaligned; + unsigned *raw_bits_per_partition_unaligned; + /* + * These fields have been moved here from private function local + * declarations merely to save stack space during encoding. + */ +#ifndef FLAC__INTEGER_ONLY_LIBRARY + FLAC__real lp_coeff[FLAC__MAX_LPC_ORDER][FLAC__MAX_LPC_ORDER]; /* from process_subframe_() */ +#endif + FLAC__EntropyCodingMethod_PartitionedRiceContents partitioned_rice_contents_extra[2]; /* from find_best_partition_order_() */ + /* + * The data for the verify section + */ + struct { + FLAC__StreamDecoder *decoder; + EncoderStateHint state_hint; + FLAC__bool needs_magic_hack; + verify_input_fifo input_fifo; + verify_output output; + struct { + FLAC__uint64 absolute_sample; + unsigned frame_number; + unsigned channel; + unsigned sample; + FLAC__int32 expected; + FLAC__int32 got; + } error_stats; + } verify; + FLAC__bool is_being_deleted; /* if true, call to ..._finish() from ..._delete() will not call the callbacks */ +} FLAC__StreamEncoderPrivate; + +/*********************************************************************** + * + * Public static class data + * + ***********************************************************************/ + +FLAC_API const char * const FLAC__StreamEncoderStateString[] = { + "FLAC__STREAM_ENCODER_OK", + "FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR", + "FLAC__STREAM_ENCODER_VERIFY_MISMATCH_IN_AUDIO_DATA", + "FLAC__STREAM_ENCODER_INVALID_CALLBACK", + "FLAC__STREAM_ENCODER_INVALID_NUMBER_OF_CHANNELS", + "FLAC__STREAM_ENCODER_INVALID_BITS_PER_SAMPLE", + "FLAC__STREAM_ENCODER_INVALID_SAMPLE_RATE", + "FLAC__STREAM_ENCODER_INVALID_BLOCK_SIZE", + "FLAC__STREAM_ENCODER_INVALID_MAX_LPC_ORDER", + "FLAC__STREAM_ENCODER_INVALID_QLP_COEFF_PRECISION", + "FLAC__STREAM_ENCODER_MID_SIDE_CHANNELS_MISMATCH", + "FLAC__STREAM_ENCODER_MID_SIDE_SAMPLE_SIZE_MISMATCH", + "FLAC__STREAM_ENCODER_ILLEGAL_MID_SIDE_FORCE", + "FLAC__STREAM_ENCODER_BLOCK_SIZE_TOO_SMALL_FOR_LPC_ORDER", + "FLAC__STREAM_ENCODER_NOT_STREAMABLE", + "FLAC__STREAM_ENCODER_FRAMING_ERROR", + "FLAC__STREAM_ENCODER_INVALID_METADATA", + "FLAC__STREAM_ENCODER_FATAL_ERROR_WHILE_ENCODING", + "FLAC__STREAM_ENCODER_FATAL_ERROR_WHILE_WRITING", + "FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR", + "FLAC__STREAM_ENCODER_ALREADY_INITIALIZED", + "FLAC__STREAM_ENCODER_UNINITIALIZED" +}; + +FLAC_API const char * const FLAC__StreamEncoderWriteStatusString[] = { + "FLAC__STREAM_ENCODER_WRITE_STATUS_OK", + "FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR" +}; + +/*********************************************************************** + * + * Class constructor/destructor + * + */ +FLAC_API FLAC__StreamEncoder *FLAC__stream_encoder_new() +{ + FLAC__StreamEncoder *encoder; + unsigned i; + + FLAC__ASSERT(sizeof(int) >= 4); /* we want to die right away if this is not true */ + + encoder = (FLAC__StreamEncoder*)calloc(1, sizeof(FLAC__StreamEncoder)); + if(encoder == 0) { + return 0; + } + + encoder->protected_ = (FLAC__StreamEncoderProtected*)calloc(1, sizeof(FLAC__StreamEncoderProtected)); + if(encoder->protected_ == 0) { + free(encoder); + return 0; + } + + encoder->private_ = (FLAC__StreamEncoderPrivate*)calloc(1, sizeof(FLAC__StreamEncoderPrivate)); + if(encoder->private_ == 0) { + free(encoder->protected_); + free(encoder); + return 0; + } + + encoder->private_->frame = FLAC__bitbuffer_new(); + if(encoder->private_->frame == 0) { + free(encoder->private_); + free(encoder->protected_); + free(encoder); + return 0; + } + + set_defaults_(encoder); + + encoder->private_->is_being_deleted = false; + + for(i = 0; i < FLAC__MAX_CHANNELS; i++) { + encoder->private_->subframe_workspace_ptr[i][0] = &encoder->private_->subframe_workspace[i][0]; + encoder->private_->subframe_workspace_ptr[i][1] = &encoder->private_->subframe_workspace[i][1]; + } + for(i = 0; i < 2; i++) { + encoder->private_->subframe_workspace_ptr_mid_side[i][0] = &encoder->private_->subframe_workspace_mid_side[i][0]; + encoder->private_->subframe_workspace_ptr_mid_side[i][1] = &encoder->private_->subframe_workspace_mid_side[i][1]; + } + for(i = 0; i < FLAC__MAX_CHANNELS; i++) { + encoder->private_->partitioned_rice_contents_workspace_ptr[i][0] = &encoder->private_->partitioned_rice_contents_workspace[i][0]; + encoder->private_->partitioned_rice_contents_workspace_ptr[i][1] = &encoder->private_->partitioned_rice_contents_workspace[i][1]; + } + for(i = 0; i < 2; i++) { + encoder->private_->partitioned_rice_contents_workspace_ptr_mid_side[i][0] = &encoder->private_->partitioned_rice_contents_workspace_mid_side[i][0]; + encoder->private_->partitioned_rice_contents_workspace_ptr_mid_side[i][1] = &encoder->private_->partitioned_rice_contents_workspace_mid_side[i][1]; + } + + for(i = 0; i < FLAC__MAX_CHANNELS; i++) { + FLAC__format_entropy_coding_method_partitioned_rice_contents_init(&encoder->private_->partitioned_rice_contents_workspace[i][0]); + FLAC__format_entropy_coding_method_partitioned_rice_contents_init(&encoder->private_->partitioned_rice_contents_workspace[i][1]); + } + for(i = 0; i < 2; i++) { + FLAC__format_entropy_coding_method_partitioned_rice_contents_init(&encoder->private_->partitioned_rice_contents_workspace_mid_side[i][0]); + FLAC__format_entropy_coding_method_partitioned_rice_contents_init(&encoder->private_->partitioned_rice_contents_workspace_mid_side[i][1]); + } + for(i = 0; i < 2; i++) + FLAC__format_entropy_coding_method_partitioned_rice_contents_init(&encoder->private_->partitioned_rice_contents_extra[i]); + + encoder->protected_->state = FLAC__STREAM_ENCODER_UNINITIALIZED; + + return encoder; +} + +FLAC_API void FLAC__stream_encoder_delete(FLAC__StreamEncoder *encoder) +{ + unsigned i; + + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->private_->frame); + + encoder->private_->is_being_deleted = true; + + FLAC__stream_encoder_finish(encoder); + + if(0 != encoder->private_->verify.decoder) + FLAC__stream_decoder_delete(encoder->private_->verify.decoder); + + for(i = 0; i < FLAC__MAX_CHANNELS; i++) { + FLAC__format_entropy_coding_method_partitioned_rice_contents_clear(&encoder->private_->partitioned_rice_contents_workspace[i][0]); + FLAC__format_entropy_coding_method_partitioned_rice_contents_clear(&encoder->private_->partitioned_rice_contents_workspace[i][1]); + } + for(i = 0; i < 2; i++) { + FLAC__format_entropy_coding_method_partitioned_rice_contents_clear(&encoder->private_->partitioned_rice_contents_workspace_mid_side[i][0]); + FLAC__format_entropy_coding_method_partitioned_rice_contents_clear(&encoder->private_->partitioned_rice_contents_workspace_mid_side[i][1]); + } + for(i = 0; i < 2; i++) + FLAC__format_entropy_coding_method_partitioned_rice_contents_clear(&encoder->private_->partitioned_rice_contents_extra[i]); + + FLAC__bitbuffer_delete(encoder->private_->frame); + free(encoder->private_); + free(encoder->protected_); + free(encoder); +} + +/*********************************************************************** + * + * Public class methods + * + ***********************************************************************/ + +FLAC_API FLAC__StreamEncoderState FLAC__stream_encoder_init(FLAC__StreamEncoder *encoder) +{ + unsigned i; + FLAC__bool metadata_has_seektable, metadata_has_vorbis_comment; + + FLAC__ASSERT(0 != encoder); + + if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED) + return encoder->protected_->state = FLAC__STREAM_ENCODER_ALREADY_INITIALIZED; + + encoder->protected_->state = FLAC__STREAM_ENCODER_OK; + + if(0 == encoder->private_->write_callback || 0 == encoder->private_->metadata_callback) + return encoder->protected_->state = FLAC__STREAM_ENCODER_INVALID_CALLBACK; + + if(encoder->protected_->channels == 0 || encoder->protected_->channels > FLAC__MAX_CHANNELS) + return encoder->protected_->state = FLAC__STREAM_ENCODER_INVALID_NUMBER_OF_CHANNELS; + + if(encoder->protected_->do_mid_side_stereo && encoder->protected_->channels != 2) + return encoder->protected_->state = FLAC__STREAM_ENCODER_MID_SIDE_CHANNELS_MISMATCH; + + if(encoder->protected_->loose_mid_side_stereo && !encoder->protected_->do_mid_side_stereo) + return encoder->protected_->state = FLAC__STREAM_ENCODER_ILLEGAL_MID_SIDE_FORCE; + + if(encoder->protected_->bits_per_sample >= 32) + encoder->protected_->do_mid_side_stereo = false; /* since we do 32-bit math, the side channel would have 33 bps and overflow */ + + if(encoder->protected_->bits_per_sample < FLAC__MIN_BITS_PER_SAMPLE || encoder->protected_->bits_per_sample > FLAC__REFERENCE_CODEC_MAX_BITS_PER_SAMPLE) + return encoder->protected_->state = FLAC__STREAM_ENCODER_INVALID_BITS_PER_SAMPLE; + + if(!FLAC__format_sample_rate_is_valid(encoder->protected_->sample_rate)) + return encoder->protected_->state = FLAC__STREAM_ENCODER_INVALID_SAMPLE_RATE; + + if(encoder->protected_->blocksize < FLAC__MIN_BLOCK_SIZE || encoder->protected_->blocksize > FLAC__MAX_BLOCK_SIZE) + return encoder->protected_->state = FLAC__STREAM_ENCODER_INVALID_BLOCK_SIZE; + + if(encoder->protected_->max_lpc_order > FLAC__MAX_LPC_ORDER) + return encoder->protected_->state = FLAC__STREAM_ENCODER_INVALID_MAX_LPC_ORDER; + + if(encoder->protected_->blocksize < encoder->protected_->max_lpc_order) + return encoder->protected_->state = FLAC__STREAM_ENCODER_BLOCK_SIZE_TOO_SMALL_FOR_LPC_ORDER; + + if(encoder->protected_->qlp_coeff_precision == 0) { + if(encoder->protected_->bits_per_sample < 16) { + /* @@@ need some data about how to set this here w.r.t. blocksize and sample rate */ + /* @@@ until then we'll make a guess */ + encoder->protected_->qlp_coeff_precision = max(FLAC__MIN_QLP_COEFF_PRECISION, 2 + encoder->protected_->bits_per_sample / 2); + } + else if(encoder->protected_->bits_per_sample == 16) { + if(encoder->protected_->blocksize <= 192) + encoder->protected_->qlp_coeff_precision = 7; + else if(encoder->protected_->blocksize <= 384) + encoder->protected_->qlp_coeff_precision = 8; + else if(encoder->protected_->blocksize <= 576) + encoder->protected_->qlp_coeff_precision = 9; + else if(encoder->protected_->blocksize <= 1152) + encoder->protected_->qlp_coeff_precision = 10; + else if(encoder->protected_->blocksize <= 2304) + encoder->protected_->qlp_coeff_precision = 11; + else if(encoder->protected_->blocksize <= 4608) + encoder->protected_->qlp_coeff_precision = 12; + else + encoder->protected_->qlp_coeff_precision = 13; + } + else { + if(encoder->protected_->blocksize <= 384) + encoder->protected_->qlp_coeff_precision = FLAC__MAX_QLP_COEFF_PRECISION-2; + else if(encoder->protected_->blocksize <= 1152) + encoder->protected_->qlp_coeff_precision = FLAC__MAX_QLP_COEFF_PRECISION-1; + else + encoder->protected_->qlp_coeff_precision = FLAC__MAX_QLP_COEFF_PRECISION; + } + FLAC__ASSERT(encoder->protected_->qlp_coeff_precision <= FLAC__MAX_QLP_COEFF_PRECISION); + } + else if(encoder->protected_->qlp_coeff_precision < FLAC__MIN_QLP_COEFF_PRECISION || encoder->protected_->qlp_coeff_precision > FLAC__MAX_QLP_COEFF_PRECISION) + return encoder->protected_->state = FLAC__STREAM_ENCODER_INVALID_QLP_COEFF_PRECISION; + + if(encoder->protected_->streamable_subset) { + if( + encoder->protected_->blocksize != 192 && + encoder->protected_->blocksize != 576 && + encoder->protected_->blocksize != 1152 && + encoder->protected_->blocksize != 2304 && + encoder->protected_->blocksize != 4608 && + encoder->protected_->blocksize != 256 && + encoder->protected_->blocksize != 512 && + encoder->protected_->blocksize != 1024 && + encoder->protected_->blocksize != 2048 && + encoder->protected_->blocksize != 4096 && + encoder->protected_->blocksize != 8192 && + encoder->protected_->blocksize != 16384 + ) + return encoder->protected_->state = FLAC__STREAM_ENCODER_NOT_STREAMABLE; + if( + encoder->protected_->sample_rate != 8000 && + encoder->protected_->sample_rate != 16000 && + encoder->protected_->sample_rate != 22050 && + encoder->protected_->sample_rate != 24000 && + encoder->protected_->sample_rate != 32000 && + encoder->protected_->sample_rate != 44100 && + encoder->protected_->sample_rate != 48000 && + encoder->protected_->sample_rate != 96000 + ) + return encoder->protected_->state = FLAC__STREAM_ENCODER_NOT_STREAMABLE; + if( + encoder->protected_->bits_per_sample != 8 && + encoder->protected_->bits_per_sample != 12 && + encoder->protected_->bits_per_sample != 16 && + encoder->protected_->bits_per_sample != 20 && + encoder->protected_->bits_per_sample != 24 + ) + return encoder->protected_->state = FLAC__STREAM_ENCODER_NOT_STREAMABLE; + if(encoder->protected_->max_residual_partition_order > FLAC__SUBSET_MAX_RICE_PARTITION_ORDER) + return encoder->protected_->state = FLAC__STREAM_ENCODER_NOT_STREAMABLE; + } + + if(encoder->protected_->max_residual_partition_order >= (1u << FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ORDER_LEN)) + encoder->protected_->max_residual_partition_order = (1u << FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ORDER_LEN) - 1; + if(encoder->protected_->min_residual_partition_order >= encoder->protected_->max_residual_partition_order) + encoder->protected_->min_residual_partition_order = encoder->protected_->max_residual_partition_order; + + /* validate metadata */ + if(0 == encoder->protected_->metadata && encoder->protected_->num_metadata_blocks > 0) + return encoder->protected_->state = FLAC__STREAM_ENCODER_INVALID_METADATA; + metadata_has_seektable = false; + metadata_has_vorbis_comment = false; + for(i = 0; i < encoder->protected_->num_metadata_blocks; i++) { + if(encoder->protected_->metadata[i]->type == FLAC__METADATA_TYPE_STREAMINFO) + return encoder->protected_->state = FLAC__STREAM_ENCODER_INVALID_METADATA; + else if(encoder->protected_->metadata[i]->type == FLAC__METADATA_TYPE_SEEKTABLE) { + if(metadata_has_seektable) /* only one is allowed */ + return encoder->protected_->state = FLAC__STREAM_ENCODER_INVALID_METADATA; + metadata_has_seektable = true; + if(!FLAC__format_seektable_is_legal(&encoder->protected_->metadata[i]->data.seek_table)) + return encoder->protected_->state = FLAC__STREAM_ENCODER_INVALID_METADATA; + } + else if(encoder->protected_->metadata[i]->type == FLAC__METADATA_TYPE_VORBIS_COMMENT) { + if(metadata_has_vorbis_comment) /* only one is allowed */ + return encoder->protected_->state = FLAC__STREAM_ENCODER_INVALID_METADATA; + metadata_has_vorbis_comment = true; + } + else if(encoder->protected_->metadata[i]->type == FLAC__METADATA_TYPE_CUESHEET) { + if(!FLAC__format_cuesheet_is_legal(&encoder->protected_->metadata[i]->data.cue_sheet, encoder->protected_->metadata[i]->data.cue_sheet.is_cd, /*violation=*/0)) + return encoder->protected_->state = FLAC__STREAM_ENCODER_INVALID_METADATA; + } + } + + encoder->private_->input_capacity = 0; + for(i = 0; i < encoder->protected_->channels; i++) { + encoder->private_->integer_signal_unaligned[i] = encoder->private_->integer_signal[i] = 0; +#ifndef FLAC__INTEGER_ONLY_LIBRARY + encoder->private_->real_signal_unaligned[i] = encoder->private_->real_signal[i] = 0; +#endif + } + for(i = 0; i < 2; i++) { + encoder->private_->integer_signal_mid_side_unaligned[i] = encoder->private_->integer_signal_mid_side[i] = 0; +#ifndef FLAC__INTEGER_ONLY_LIBRARY + encoder->private_->real_signal_mid_side_unaligned[i] = encoder->private_->real_signal_mid_side[i] = 0; +#endif + } + for(i = 0; i < encoder->protected_->channels; i++) { + encoder->private_->residual_workspace_unaligned[i][0] = encoder->private_->residual_workspace[i][0] = 0; + encoder->private_->residual_workspace_unaligned[i][1] = encoder->private_->residual_workspace[i][1] = 0; + encoder->private_->best_subframe[i] = 0; + } + for(i = 0; i < 2; i++) { + encoder->private_->residual_workspace_mid_side_unaligned[i][0] = encoder->private_->residual_workspace_mid_side[i][0] = 0; + encoder->private_->residual_workspace_mid_side_unaligned[i][1] = encoder->private_->residual_workspace_mid_side[i][1] = 0; + encoder->private_->best_subframe_mid_side[i] = 0; + } + encoder->private_->abs_residual_unaligned = encoder->private_->abs_residual = 0; + encoder->private_->abs_residual_partition_sums_unaligned = encoder->private_->abs_residual_partition_sums = 0; + encoder->private_->raw_bits_per_partition_unaligned = encoder->private_->raw_bits_per_partition = 0; +#ifndef FLAC__INTEGER_ONLY_LIBRARY + encoder->private_->loose_mid_side_stereo_frames = (unsigned)((FLAC__double)encoder->protected_->sample_rate * 0.4 / (FLAC__double)encoder->protected_->blocksize + 0.5); +#else + /* 26214 is the approximate fixed-point equivalent to 0.4 (0.4 * 2^16) */ + /* sample rate can be up to 655350 Hz, and thus use 20 bits, so we do the multiply÷ by hand */ + FLAC__ASSERT(FLAC__MAX_SAMPLE_RATE <= 655350); + FLAC__ASSERT(FLAC__MAX_BLOCK_SIZE <= 65535); + FLAC__ASSERT(encoder->protected_->sample_rate <= 655350); + FLAC__ASSERT(encoder->protected_->blocksize <= 65535); + encoder->private_->loose_mid_side_stereo_frames = (unsigned)FLAC__fixedpoint_trunc((((FLAC__uint64)(encoder->protected_->sample_rate) * (FLAC__uint64)(26214)) << 16) / (encoder->protected_->blocksize<<16) + FLAC__FP_ONE_HALF); +#endif + if(encoder->private_->loose_mid_side_stereo_frames == 0) + encoder->private_->loose_mid_side_stereo_frames = 1; + encoder->private_->loose_mid_side_stereo_frame_count = 0; + encoder->private_->current_sample_number = 0; + encoder->private_->current_frame_number = 0; + + encoder->private_->use_wide_by_block = (encoder->protected_->bits_per_sample + FLAC__bitmath_ilog2(encoder->protected_->blocksize)+1 > 30); + encoder->private_->use_wide_by_order = (encoder->protected_->bits_per_sample + FLAC__bitmath_ilog2(max(encoder->protected_->max_lpc_order, FLAC__MAX_FIXED_ORDER))+1 > 30); /*@@@ need to use this? */ + encoder->private_->use_wide_by_partition = (false); /*@@@ need to set this */ + + /* + * get the CPU info and set the function pointers + */ + FLAC__cpu_info(&encoder->private_->cpuinfo); + /* first default to the non-asm routines */ +#ifndef FLAC__INTEGER_ONLY_LIBRARY + encoder->private_->local_lpc_compute_autocorrelation = FLAC__lpc_compute_autocorrelation; +#endif + encoder->private_->local_fixed_compute_best_predictor = FLAC__fixed_compute_best_predictor; +#ifndef FLAC__INTEGER_ONLY_LIBRARY + encoder->private_->local_lpc_compute_residual_from_qlp_coefficients = FLAC__lpc_compute_residual_from_qlp_coefficients; + encoder->private_->local_lpc_compute_residual_from_qlp_coefficients_64bit = FLAC__lpc_compute_residual_from_qlp_coefficients_wide; + encoder->private_->local_lpc_compute_residual_from_qlp_coefficients_16bit = FLAC__lpc_compute_residual_from_qlp_coefficients; +#endif + /* now override with asm where appropriate */ +#ifndef FLAC__INTEGER_ONLY_LIBRARY +# ifndef FLAC__NO_ASM + if(encoder->private_->cpuinfo.use_asm) { +# ifdef FLAC__CPU_IA32 + FLAC__ASSERT(encoder->private_->cpuinfo.type == FLAC__CPUINFO_TYPE_IA32); +# ifdef FLAC__HAS_NASM +# ifdef FLAC__SSE_OS + if(encoder->private_->cpuinfo.data.ia32.sse) { + if(encoder->protected_->max_lpc_order < 4) + encoder->private_->local_lpc_compute_autocorrelation = FLAC__lpc_compute_autocorrelation_asm_ia32_sse_lag_4; + else if(encoder->protected_->max_lpc_order < 8) + encoder->private_->local_lpc_compute_autocorrelation = FLAC__lpc_compute_autocorrelation_asm_ia32_sse_lag_8; + else if(encoder->protected_->max_lpc_order < 12) + encoder->private_->local_lpc_compute_autocorrelation = FLAC__lpc_compute_autocorrelation_asm_ia32_sse_lag_12; + else + encoder->private_->local_lpc_compute_autocorrelation = FLAC__lpc_compute_autocorrelation_asm_ia32; + } + else +# endif /* FLAC__SSE_OS */ + if(encoder->private_->cpuinfo.data.ia32._3dnow) + encoder->private_->local_lpc_compute_autocorrelation = FLAC__lpc_compute_autocorrelation_asm_ia32_3dnow; + else + encoder->private_->local_lpc_compute_autocorrelation = FLAC__lpc_compute_autocorrelation_asm_ia32; + if(encoder->private_->cpuinfo.data.ia32.mmx) { + encoder->private_->local_lpc_compute_residual_from_qlp_coefficients = FLAC__lpc_compute_residual_from_qlp_coefficients_asm_ia32; + encoder->private_->local_lpc_compute_residual_from_qlp_coefficients_16bit = FLAC__lpc_compute_residual_from_qlp_coefficients_asm_ia32_mmx; + } + else { + encoder->private_->local_lpc_compute_residual_from_qlp_coefficients = FLAC__lpc_compute_residual_from_qlp_coefficients_asm_ia32; + encoder->private_->local_lpc_compute_residual_from_qlp_coefficients_16bit = FLAC__lpc_compute_residual_from_qlp_coefficients_asm_ia32; + } + if(encoder->private_->cpuinfo.data.ia32.mmx && encoder->private_->cpuinfo.data.ia32.cmov) + encoder->private_->local_fixed_compute_best_predictor = FLAC__fixed_compute_best_predictor_asm_ia32_mmx_cmov; +# endif /* FLAC__HAS_NASM */ +# endif /* FLAC__CPU_IA32 */ + } +# endif /* !FLAC__NO_ASM */ +#endif /* !FLAC__INTEGER_ONLY_LIBRARY */ + /* finally override based on wide-ness if necessary */ + if(encoder->private_->use_wide_by_block) { + encoder->private_->local_fixed_compute_best_predictor = FLAC__fixed_compute_best_predictor_wide; + } + + /* we require precompute_partition_sums if do_escape_coding because of their intertwined nature */ + encoder->private_->precompute_partition_sums = (encoder->protected_->max_residual_partition_order > encoder->protected_->min_residual_partition_order) || encoder->protected_->do_escape_coding; + + if(!resize_buffers_(encoder, encoder->protected_->blocksize)) { + /* the above function sets the state for us in case of an error */ + return encoder->protected_->state; + } + + if(!FLAC__bitbuffer_init(encoder->private_->frame)) + return encoder->protected_->state = FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR; + + /* + * Set up the verify stuff if necessary + */ + if(encoder->protected_->verify) { + /* + * First, set up the fifo which will hold the + * original signal to compare against + */ + encoder->private_->verify.input_fifo.size = encoder->protected_->blocksize; + for(i = 0; i < encoder->protected_->channels; i++) { + if(0 == (encoder->private_->verify.input_fifo.data[i] = (FLAC__int32*)malloc(sizeof(FLAC__int32) * encoder->private_->verify.input_fifo.size))) + return encoder->protected_->state = FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR; + } + encoder->private_->verify.input_fifo.tail = 0; + + /* + * Now set up a stream decoder for verification + */ + encoder->private_->verify.decoder = FLAC__stream_decoder_new(); + if(0 == encoder->private_->verify.decoder) + return encoder->protected_->state = FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR; + + FLAC__stream_decoder_set_read_callback(encoder->private_->verify.decoder, verify_read_callback_); + FLAC__stream_decoder_set_write_callback(encoder->private_->verify.decoder, verify_write_callback_); + FLAC__stream_decoder_set_metadata_callback(encoder->private_->verify.decoder, verify_metadata_callback_); + FLAC__stream_decoder_set_error_callback(encoder->private_->verify.decoder, verify_error_callback_); + FLAC__stream_decoder_set_client_data(encoder->private_->verify.decoder, encoder); + if(FLAC__stream_decoder_init(encoder->private_->verify.decoder) != FLAC__STREAM_DECODER_SEARCH_FOR_METADATA) + return encoder->protected_->state = FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR; + } + encoder->private_->verify.error_stats.absolute_sample = 0; + encoder->private_->verify.error_stats.frame_number = 0; + encoder->private_->verify.error_stats.channel = 0; + encoder->private_->verify.error_stats.sample = 0; + encoder->private_->verify.error_stats.expected = 0; + encoder->private_->verify.error_stats.got = 0; + + /* + * write the stream header + */ + if(encoder->protected_->verify) + encoder->private_->verify.state_hint = ENCODER_IN_MAGIC; + if(!FLAC__bitbuffer_write_raw_uint32(encoder->private_->frame, FLAC__STREAM_SYNC, FLAC__STREAM_SYNC_LEN)) + return encoder->protected_->state = FLAC__STREAM_ENCODER_FRAMING_ERROR; + if(!write_bitbuffer_(encoder, 0)) { + /* the above function sets the state for us in case of an error */ + return encoder->protected_->state; + } + + /* + * write the STREAMINFO metadata block + */ + if(encoder->protected_->verify) + encoder->private_->verify.state_hint = ENCODER_IN_METADATA; + encoder->private_->metadata.type = FLAC__METADATA_TYPE_STREAMINFO; + encoder->private_->metadata.is_last = false; /* we will have at a minimum a VORBIS_COMMENT afterwards */ + encoder->private_->metadata.length = FLAC__STREAM_METADATA_STREAMINFO_LENGTH; + encoder->private_->metadata.data.stream_info.min_blocksize = encoder->protected_->blocksize; /* this encoder uses the same blocksize for the whole stream */ + encoder->private_->metadata.data.stream_info.max_blocksize = encoder->protected_->blocksize; + encoder->private_->metadata.data.stream_info.min_framesize = 0; /* we don't know this yet; have to fill it in later */ + encoder->private_->metadata.data.stream_info.max_framesize = 0; /* we don't know this yet; have to fill it in later */ + encoder->private_->metadata.data.stream_info.sample_rate = encoder->protected_->sample_rate; + encoder->private_->metadata.data.stream_info.channels = encoder->protected_->channels; + encoder->private_->metadata.data.stream_info.bits_per_sample = encoder->protected_->bits_per_sample; + encoder->private_->metadata.data.stream_info.total_samples = encoder->protected_->total_samples_estimate; /* we will replace this later with the real total */ + memset(encoder->private_->metadata.data.stream_info.md5sum, 0, 16); /* we don't know this yet; have to fill it in later */ + FLAC__MD5Init(&encoder->private_->md5context); + if(!FLAC__bitbuffer_clear(encoder->private_->frame)) + return encoder->protected_->state = FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR; + if(!FLAC__add_metadata_block(&encoder->private_->metadata, encoder->private_->frame)) + return encoder->protected_->state = FLAC__STREAM_ENCODER_FRAMING_ERROR; + if(!write_bitbuffer_(encoder, 0)) { + /* the above function sets the state for us in case of an error */ + return encoder->protected_->state; + } + + /* + * Now that the STREAMINFO block is written, we can init this to an + * absurdly-high value... + */ + encoder->private_->metadata.data.stream_info.min_framesize = (1u << FLAC__STREAM_METADATA_STREAMINFO_MIN_FRAME_SIZE_LEN) - 1; + /* ... and clear this to 0 */ + encoder->private_->metadata.data.stream_info.total_samples = 0; + + /* + * Check to see if the supplied metadata contains a VORBIS_COMMENT; + * if not, we will write an empty one (FLAC__add_metadata_block() + * automatically supplies the vendor string). + * + * WATCHOUT: libOggFLAC depends on us to write this block after the + * STREAMINFO since that's what the mapping requires. (In the case + * that metadata_has_vorbis_comment is true it will have already + * insured that the metadata list is properly ordered.) + */ + if(!metadata_has_vorbis_comment) { + FLAC__StreamMetadata vorbis_comment; + vorbis_comment.type = FLAC__METADATA_TYPE_VORBIS_COMMENT; + vorbis_comment.is_last = (encoder->protected_->num_metadata_blocks == 0); + vorbis_comment.length = 4 + 4; /* MAGIC NUMBER */ + vorbis_comment.data.vorbis_comment.vendor_string.length = 0; + vorbis_comment.data.vorbis_comment.vendor_string.entry = 0; + vorbis_comment.data.vorbis_comment.num_comments = 0; + vorbis_comment.data.vorbis_comment.comments = 0; + if(!FLAC__bitbuffer_clear(encoder->private_->frame)) + return encoder->protected_->state = FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR; + if(!FLAC__add_metadata_block(&vorbis_comment, encoder->private_->frame)) + return encoder->protected_->state = FLAC__STREAM_ENCODER_FRAMING_ERROR; + if(!write_bitbuffer_(encoder, 0)) { + /* the above function sets the state for us in case of an error */ + return encoder->protected_->state; + } + } + + /* + * write the user's metadata blocks + */ + for(i = 0; i < encoder->protected_->num_metadata_blocks; i++) { + encoder->protected_->metadata[i]->is_last = (i == encoder->protected_->num_metadata_blocks - 1); + if(!FLAC__bitbuffer_clear(encoder->private_->frame)) + return encoder->protected_->state = FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR; + if(!FLAC__add_metadata_block(encoder->protected_->metadata[i], encoder->private_->frame)) + return encoder->protected_->state = FLAC__STREAM_ENCODER_FRAMING_ERROR; + if(!write_bitbuffer_(encoder, 0)) { + /* the above function sets the state for us in case of an error */ + return encoder->protected_->state; + } + } + + if(encoder->protected_->verify) + encoder->private_->verify.state_hint = ENCODER_IN_AUDIO; + + return encoder->protected_->state; +} + +FLAC_API void FLAC__stream_encoder_finish(FLAC__StreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + + if(encoder->protected_->state == FLAC__STREAM_ENCODER_UNINITIALIZED) + return; + + if(encoder->protected_->state == FLAC__STREAM_ENCODER_OK && !encoder->private_->is_being_deleted) { + if(encoder->private_->current_sample_number != 0) { + encoder->protected_->blocksize = encoder->private_->current_sample_number; + process_frame_(encoder, true); /* true => is last frame */ + } + } + + FLAC__MD5Final(encoder->private_->metadata.data.stream_info.md5sum, &encoder->private_->md5context); + + if(encoder->protected_->state == FLAC__STREAM_ENCODER_OK && !encoder->private_->is_being_deleted) { + encoder->private_->metadata_callback(encoder, &encoder->private_->metadata, encoder->private_->client_data); + } + + if(encoder->protected_->verify && 0 != encoder->private_->verify.decoder) + FLAC__stream_decoder_finish(encoder->private_->verify.decoder); + + free_(encoder); + set_defaults_(encoder); + + encoder->protected_->state = FLAC__STREAM_ENCODER_UNINITIALIZED; +} + +FLAC_API FLAC__bool FLAC__stream_encoder_set_verify(FLAC__StreamEncoder *encoder, FLAC__bool value) +{ + FLAC__ASSERT(0 != encoder); + if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED) + return false; +#ifndef FLAC__MANDATORY_VERIFY_WHILE_ENCODING + encoder->protected_->verify = value; +#endif + return true; +} + +FLAC_API FLAC__bool FLAC__stream_encoder_set_streamable_subset(FLAC__StreamEncoder *encoder, FLAC__bool value) +{ + FLAC__ASSERT(0 != encoder); + if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED) + return false; + encoder->protected_->streamable_subset = value; + return true; +} + +FLAC_API FLAC__bool FLAC__stream_encoder_set_do_mid_side_stereo(FLAC__StreamEncoder *encoder, FLAC__bool value) +{ + FLAC__ASSERT(0 != encoder); + if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED) + return false; + encoder->protected_->do_mid_side_stereo = value; + return true; +} + +FLAC_API FLAC__bool FLAC__stream_encoder_set_loose_mid_side_stereo(FLAC__StreamEncoder *encoder, FLAC__bool value) +{ + FLAC__ASSERT(0 != encoder); + if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED) + return false; + encoder->protected_->loose_mid_side_stereo = value; + return true; +} + +FLAC_API FLAC__bool FLAC__stream_encoder_set_channels(FLAC__StreamEncoder *encoder, unsigned value) +{ + FLAC__ASSERT(0 != encoder); + if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED) + return false; + encoder->protected_->channels = value; + return true; +} + +FLAC_API FLAC__bool FLAC__stream_encoder_set_bits_per_sample(FLAC__StreamEncoder *encoder, unsigned value) +{ + FLAC__ASSERT(0 != encoder); + if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED) + return false; + encoder->protected_->bits_per_sample = value; + return true; +} + +FLAC_API FLAC__bool FLAC__stream_encoder_set_sample_rate(FLAC__StreamEncoder *encoder, unsigned value) +{ + FLAC__ASSERT(0 != encoder); + if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED) + return false; + encoder->protected_->sample_rate = value; + return true; +} + +FLAC_API FLAC__bool FLAC__stream_encoder_set_blocksize(FLAC__StreamEncoder *encoder, unsigned value) +{ + FLAC__ASSERT(0 != encoder); + if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED) + return false; + encoder->protected_->blocksize = value; + return true; +} + +FLAC_API FLAC__bool FLAC__stream_encoder_set_max_lpc_order(FLAC__StreamEncoder *encoder, unsigned value) +{ + FLAC__ASSERT(0 != encoder); + if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED) + return false; + encoder->protected_->max_lpc_order = value; + return true; +} + +FLAC_API FLAC__bool FLAC__stream_encoder_set_qlp_coeff_precision(FLAC__StreamEncoder *encoder, unsigned value) +{ + FLAC__ASSERT(0 != encoder); + if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED) + return false; + encoder->protected_->qlp_coeff_precision = value; + return true; +} + +FLAC_API FLAC__bool FLAC__stream_encoder_set_do_qlp_coeff_prec_search(FLAC__StreamEncoder *encoder, FLAC__bool value) +{ + FLAC__ASSERT(0 != encoder); + if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED) + return false; + encoder->protected_->do_qlp_coeff_prec_search = value; + return true; +} + +FLAC_API FLAC__bool FLAC__stream_encoder_set_do_escape_coding(FLAC__StreamEncoder *encoder, FLAC__bool value) +{ + FLAC__ASSERT(0 != encoder); + if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED) + return false; +#if 0 + /*@@@ deprecated: */ + encoder->protected_->do_escape_coding = value; +#else + (void)value; +#endif + return true; +} + +FLAC_API FLAC__bool FLAC__stream_encoder_set_do_exhaustive_model_search(FLAC__StreamEncoder *encoder, FLAC__bool value) +{ + FLAC__ASSERT(0 != encoder); + if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED) + return false; + encoder->protected_->do_exhaustive_model_search = value; + return true; +} + +FLAC_API FLAC__bool FLAC__stream_encoder_set_min_residual_partition_order(FLAC__StreamEncoder *encoder, unsigned value) +{ + FLAC__ASSERT(0 != encoder); + if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED) + return false; + encoder->protected_->min_residual_partition_order = value; + return true; +} + +FLAC_API FLAC__bool FLAC__stream_encoder_set_max_residual_partition_order(FLAC__StreamEncoder *encoder, unsigned value) +{ + FLAC__ASSERT(0 != encoder); + if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED) + return false; + encoder->protected_->max_residual_partition_order = value; + return true; +} + +FLAC_API FLAC__bool FLAC__stream_encoder_set_rice_parameter_search_dist(FLAC__StreamEncoder *encoder, unsigned value) +{ + FLAC__ASSERT(0 != encoder); + if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED) + return false; +#if 0 + /*@@@ deprecated: */ + encoder->protected_->rice_parameter_search_dist = value; +#else + (void)value; +#endif + return true; +} + +FLAC_API FLAC__bool FLAC__stream_encoder_set_total_samples_estimate(FLAC__StreamEncoder *encoder, FLAC__uint64 value) +{ + FLAC__ASSERT(0 != encoder); + if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED) + return false; + encoder->protected_->total_samples_estimate = value; + return true; +} + +FLAC_API FLAC__bool FLAC__stream_encoder_set_metadata(FLAC__StreamEncoder *encoder, FLAC__StreamMetadata **metadata, unsigned num_blocks) +{ + FLAC__ASSERT(0 != encoder); + if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED) + return false; + encoder->protected_->metadata = metadata; + encoder->protected_->num_metadata_blocks = num_blocks; + return true; +} + +FLAC_API FLAC__bool FLAC__stream_encoder_set_write_callback(FLAC__StreamEncoder *encoder, FLAC__StreamEncoderWriteCallback value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != value); + if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED) + return false; + encoder->private_->write_callback = value; + return true; +} + +FLAC_API FLAC__bool FLAC__stream_encoder_set_metadata_callback(FLAC__StreamEncoder *encoder, FLAC__StreamEncoderMetadataCallback value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != value); + if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED) + return false; + encoder->private_->metadata_callback = value; + return true; +} + +FLAC_API FLAC__bool FLAC__stream_encoder_set_client_data(FLAC__StreamEncoder *encoder, void *value) +{ + FLAC__ASSERT(0 != encoder); + if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED) + return false; + encoder->private_->client_data = value; + return true; +} + +/* + * These three functions are not static, but not publically exposed in + * include/FLAC/ either. They are used by the test suite. + */ +FLAC_API FLAC__bool FLAC__stream_encoder_disable_constant_subframes(FLAC__StreamEncoder *encoder, FLAC__bool value) +{ + FLAC__ASSERT(0 != encoder); + if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED) + return false; + encoder->private_->disable_constant_subframes = value; + return true; +} + +FLAC_API FLAC__bool FLAC__stream_encoder_disable_fixed_subframes(FLAC__StreamEncoder *encoder, FLAC__bool value) +{ + FLAC__ASSERT(0 != encoder); + if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED) + return false; + encoder->private_->disable_fixed_subframes = value; + return true; +} + +FLAC_API FLAC__bool FLAC__stream_encoder_disable_verbatim_subframes(FLAC__StreamEncoder *encoder, FLAC__bool value) +{ + FLAC__ASSERT(0 != encoder); + if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED) + return false; + encoder->private_->disable_verbatim_subframes = value; + return true; +} + +FLAC_API FLAC__StreamEncoderState FLAC__stream_encoder_get_state(const FLAC__StreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + return encoder->protected_->state; +} + +FLAC_API FLAC__StreamDecoderState FLAC__stream_encoder_get_verify_decoder_state(const FLAC__StreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + if(encoder->protected_->verify) + return FLAC__stream_decoder_get_state(encoder->private_->verify.decoder); + else + return FLAC__STREAM_DECODER_UNINITIALIZED; +} + +FLAC_API const char *FLAC__stream_encoder_get_resolved_state_string(const FLAC__StreamEncoder *encoder) +{ + if(encoder->protected_->state != FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR) + return FLAC__StreamEncoderStateString[encoder->protected_->state]; + else + return FLAC__stream_decoder_get_resolved_state_string(encoder->private_->verify.decoder); +} + +FLAC_API void FLAC__stream_encoder_get_verify_decoder_error_stats(const FLAC__StreamEncoder *encoder, FLAC__uint64 *absolute_sample, unsigned *frame_number, unsigned *channel, unsigned *sample, FLAC__int32 *expected, FLAC__int32 *got) +{ + FLAC__ASSERT(0 != encoder); + if(0 != absolute_sample) + *absolute_sample = encoder->private_->verify.error_stats.absolute_sample; + if(0 != frame_number) + *frame_number = encoder->private_->verify.error_stats.frame_number; + if(0 != channel) + *channel = encoder->private_->verify.error_stats.channel; + if(0 != sample) + *sample = encoder->private_->verify.error_stats.sample; + if(0 != expected) + *expected = encoder->private_->verify.error_stats.expected; + if(0 != got) + *got = encoder->private_->verify.error_stats.got; +} + +FLAC_API FLAC__bool FLAC__stream_encoder_get_verify(const FLAC__StreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + return encoder->protected_->verify; +} + +FLAC_API FLAC__bool FLAC__stream_encoder_get_streamable_subset(const FLAC__StreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + return encoder->protected_->streamable_subset; +} + +FLAC_API FLAC__bool FLAC__stream_encoder_get_do_mid_side_stereo(const FLAC__StreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + return encoder->protected_->do_mid_side_stereo; +} + +FLAC_API FLAC__bool FLAC__stream_encoder_get_loose_mid_side_stereo(const FLAC__StreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + return encoder->protected_->loose_mid_side_stereo; +} + +FLAC_API unsigned FLAC__stream_encoder_get_channels(const FLAC__StreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + return encoder->protected_->channels; +} + +FLAC_API unsigned FLAC__stream_encoder_get_bits_per_sample(const FLAC__StreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + return encoder->protected_->bits_per_sample; +} + +FLAC_API unsigned FLAC__stream_encoder_get_sample_rate(const FLAC__StreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + return encoder->protected_->sample_rate; +} + +FLAC_API unsigned FLAC__stream_encoder_get_blocksize(const FLAC__StreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + return encoder->protected_->blocksize; +} + +FLAC_API unsigned FLAC__stream_encoder_get_max_lpc_order(const FLAC__StreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + return encoder->protected_->max_lpc_order; +} + +FLAC_API unsigned FLAC__stream_encoder_get_qlp_coeff_precision(const FLAC__StreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + return encoder->protected_->qlp_coeff_precision; +} + +FLAC_API FLAC__bool FLAC__stream_encoder_get_do_qlp_coeff_prec_search(const FLAC__StreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + return encoder->protected_->do_qlp_coeff_prec_search; +} + +FLAC_API FLAC__bool FLAC__stream_encoder_get_do_escape_coding(const FLAC__StreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + return encoder->protected_->do_escape_coding; +} + +FLAC_API FLAC__bool FLAC__stream_encoder_get_do_exhaustive_model_search(const FLAC__StreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + return encoder->protected_->do_exhaustive_model_search; +} + +FLAC_API unsigned FLAC__stream_encoder_get_min_residual_partition_order(const FLAC__StreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + return encoder->protected_->min_residual_partition_order; +} + +FLAC_API unsigned FLAC__stream_encoder_get_max_residual_partition_order(const FLAC__StreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + return encoder->protected_->max_residual_partition_order; +} + +FLAC_API unsigned FLAC__stream_encoder_get_rice_parameter_search_dist(const FLAC__StreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + return encoder->protected_->rice_parameter_search_dist; +} + +FLAC_API FLAC__uint64 FLAC__stream_encoder_get_total_samples_estimate(const FLAC__StreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + return encoder->protected_->total_samples_estimate; +} + +FLAC_API FLAC__bool FLAC__stream_encoder_process(FLAC__StreamEncoder *encoder, const FLAC__int32 * const buffer[], unsigned samples) +{ + unsigned i, j, channel; + FLAC__int32 x, mid, side; + const unsigned channels = encoder->protected_->channels, blocksize = encoder->protected_->blocksize; + + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(encoder->protected_->state == FLAC__STREAM_ENCODER_OK); + + j = 0; + /* + * we have several flavors of the same basic loop, optimized for + * different conditions: + */ + if(encoder->protected_->max_lpc_order > 0) { + if(encoder->protected_->do_mid_side_stereo && channels == 2) { + /* + * stereo coding: unroll channel loop + * with LPC: calculate floating point version of signal + */ + do { + if(encoder->protected_->verify) + append_to_verify_fifo_(&encoder->private_->verify.input_fifo, buffer, j, channels, min(blocksize-encoder->private_->current_sample_number, samples-j)); + + for(i = encoder->private_->current_sample_number; i < blocksize && j < samples; i++, j++) { + x = mid = side = buffer[0][j]; + encoder->private_->integer_signal[0][i] = x; +#ifndef FLAC__INTEGER_ONLY_LIBRARY + encoder->private_->real_signal[0][i] = (FLAC__real)x; +#endif + x = buffer[1][j]; + encoder->private_->integer_signal[1][i] = x; +#ifndef FLAC__INTEGER_ONLY_LIBRARY + encoder->private_->real_signal[1][i] = (FLAC__real)x; +#endif + mid += x; + side -= x; + mid >>= 1; /* NOTE: not the same as 'mid = (buffer[0][j] + buffer[1][j]) / 2' ! */ + encoder->private_->integer_signal_mid_side[1][i] = side; + encoder->private_->integer_signal_mid_side[0][i] = mid; +#ifndef FLAC__INTEGER_ONLY_LIBRARY + encoder->private_->real_signal_mid_side[1][i] = (FLAC__real)side; + encoder->private_->real_signal_mid_side[0][i] = (FLAC__real)mid; +#endif + encoder->private_->current_sample_number++; + } + if(i == blocksize) { + if(!process_frame_(encoder, false)) /* false => not last frame */ + return false; + } + } while(j < samples); + } + else { + /* + * independent channel coding: buffer each channel in inner loop + * with LPC: calculate floating point version of signal + */ + do { + if(encoder->protected_->verify) + append_to_verify_fifo_(&encoder->private_->verify.input_fifo, buffer, j, channels, min(blocksize-encoder->private_->current_sample_number, samples-j)); + + for(i = encoder->private_->current_sample_number; i < blocksize && j < samples; i++, j++) { + for(channel = 0; channel < channels; channel++) { + x = buffer[channel][j]; + encoder->private_->integer_signal[channel][i] = x; +#ifndef FLAC__INTEGER_ONLY_LIBRARY + encoder->private_->real_signal[channel][i] = (FLAC__real)x; +#endif + } + encoder->private_->current_sample_number++; + } + if(i == blocksize) { + if(!process_frame_(encoder, false)) /* false => not last frame */ + return false; + } + } while(j < samples); + } + } + else { + if(encoder->protected_->do_mid_side_stereo && channels == 2) { + /* + * stereo coding: unroll channel loop + * without LPC: no need to calculate floating point version of signal + */ + do { + if(encoder->protected_->verify) + append_to_verify_fifo_(&encoder->private_->verify.input_fifo, buffer, j, channels, min(blocksize-encoder->private_->current_sample_number, samples-j)); + + for(i = encoder->private_->current_sample_number; i < blocksize && j < samples; i++, j++) { + encoder->private_->integer_signal[0][i] = mid = side = buffer[0][j]; + x = buffer[1][j]; + encoder->private_->integer_signal[1][i] = x; + mid += x; + side -= x; + mid >>= 1; /* NOTE: not the same as 'mid = (buffer[0][j] + buffer[1][j]) / 2' ! */ + encoder->private_->integer_signal_mid_side[1][i] = side; + encoder->private_->integer_signal_mid_side[0][i] = mid; + encoder->private_->current_sample_number++; + } + if(i == blocksize) { + if(!process_frame_(encoder, false)) /* false => not last frame */ + return false; + } + } while(j < samples); + } + else { + /* + * independent channel coding: buffer each channel in inner loop + * without LPC: no need to calculate floating point version of signal + */ + do { + if(encoder->protected_->verify) + append_to_verify_fifo_(&encoder->private_->verify.input_fifo, buffer, j, channels, min(blocksize-encoder->private_->current_sample_number, samples-j)); + + for(i = encoder->private_->current_sample_number; i < blocksize && j < samples; i++, j++) { + for(channel = 0; channel < channels; channel++) + encoder->private_->integer_signal[channel][i] = buffer[channel][j]; + encoder->private_->current_sample_number++; + } + if(i == blocksize) { + if(!process_frame_(encoder, false)) /* false => not last frame */ + return false; + } + } while(j < samples); + } + } + + return true; +} + +FLAC_API FLAC__bool FLAC__stream_encoder_process_interleaved(FLAC__StreamEncoder *encoder, const FLAC__int32 buffer[], unsigned samples) +{ + unsigned i, j, k, channel; + FLAC__int32 x, mid, side; + const unsigned channels = encoder->protected_->channels, blocksize = encoder->protected_->blocksize; + + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(encoder->protected_->state == FLAC__STREAM_ENCODER_OK); + + j = k = 0; + /* + * we have several flavors of the same basic loop, optimized for + * different conditions: + */ + if(encoder->protected_->max_lpc_order > 0) { + if(encoder->protected_->do_mid_side_stereo && channels == 2) { + /* + * stereo coding: unroll channel loop + * with LPC: calculate floating point version of signal + */ + do { + if(encoder->protected_->verify) + append_to_verify_fifo_interleaved_(&encoder->private_->verify.input_fifo, buffer, j, channels, min(blocksize-encoder->private_->current_sample_number, samples-j)); + + for(i = encoder->private_->current_sample_number; i < blocksize && j < samples; i++, j++) { + x = mid = side = buffer[k++]; + encoder->private_->integer_signal[0][i] = x; +#ifndef FLAC__INTEGER_ONLY_LIBRARY + encoder->private_->real_signal[0][i] = (FLAC__real)x; +#endif + x = buffer[k++]; + encoder->private_->integer_signal[1][i] = x; +#ifndef FLAC__INTEGER_ONLY_LIBRARY + encoder->private_->real_signal[1][i] = (FLAC__real)x; +#endif + mid += x; + side -= x; + mid >>= 1; /* NOTE: not the same as 'mid = (left + right) / 2' ! */ + encoder->private_->integer_signal_mid_side[1][i] = side; + encoder->private_->integer_signal_mid_side[0][i] = mid; +#ifndef FLAC__INTEGER_ONLY_LIBRARY + encoder->private_->real_signal_mid_side[1][i] = (FLAC__real)side; + encoder->private_->real_signal_mid_side[0][i] = (FLAC__real)mid; +#endif + encoder->private_->current_sample_number++; + } + if(i == blocksize) { + if(!process_frame_(encoder, false)) /* false => not last frame */ + return false; + } + } while(j < samples); + } + else { + /* + * independent channel coding: buffer each channel in inner loop + * with LPC: calculate floating point version of signal + */ + do { + if(encoder->protected_->verify) + append_to_verify_fifo_interleaved_(&encoder->private_->verify.input_fifo, buffer, j, channels, min(blocksize-encoder->private_->current_sample_number, samples-j)); + + for(i = encoder->private_->current_sample_number; i < blocksize && j < samples; i++, j++) { + for(channel = 0; channel < channels; channel++) { + x = buffer[k++]; + encoder->private_->integer_signal[channel][i] = x; +#ifndef FLAC__INTEGER_ONLY_LIBRARY + encoder->private_->real_signal[channel][i] = (FLAC__real)x; +#endif + } + encoder->private_->current_sample_number++; + } + if(i == blocksize) { + if(!process_frame_(encoder, false)) /* false => not last frame */ + return false; + } + } while(j < samples); + } + } + else { + if(encoder->protected_->do_mid_side_stereo && channels == 2) { + /* + * stereo coding: unroll channel loop + * without LPC: no need to calculate floating point version of signal + */ + do { + if(encoder->protected_->verify) + append_to_verify_fifo_interleaved_(&encoder->private_->verify.input_fifo, buffer, j, channels, min(blocksize-encoder->private_->current_sample_number, samples-j)); + + for(i = encoder->private_->current_sample_number; i < blocksize && j < samples; i++, j++) { + encoder->private_->integer_signal[0][i] = mid = side = buffer[k++]; + x = buffer[k++]; + encoder->private_->integer_signal[1][i] = x; + mid += x; + side -= x; + mid >>= 1; /* NOTE: not the same as 'mid = (left + right) / 2' ! */ + encoder->private_->integer_signal_mid_side[1][i] = side; + encoder->private_->integer_signal_mid_side[0][i] = mid; + encoder->private_->current_sample_number++; + } + if(i == blocksize) { + if(!process_frame_(encoder, false)) /* false => not last frame */ + return false; + } + } while(j < samples); + } + else { + /* + * independent channel coding: buffer each channel in inner loop + * without LPC: no need to calculate floating point version of signal + */ + do { + if(encoder->protected_->verify) + append_to_verify_fifo_interleaved_(&encoder->private_->verify.input_fifo, buffer, j, channels, min(blocksize-encoder->private_->current_sample_number, samples-j)); + + for(i = encoder->private_->current_sample_number; i < blocksize && j < samples; i++, j++) { + for(channel = 0; channel < channels; channel++) + encoder->private_->integer_signal[channel][i] = buffer[k++]; + encoder->private_->current_sample_number++; + } + if(i == blocksize) { + if(!process_frame_(encoder, false)) /* false => not last frame */ + return false; + } + } while(j < samples); + } + } + + return true; +} + +/*********************************************************************** + * + * Private class methods + * + ***********************************************************************/ + +void set_defaults_(FLAC__StreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + +#ifdef FLAC__MANDATORY_VERIFY_WHILE_ENCODING + encoder->protected_->verify = true; +#else + encoder->protected_->verify = false; +#endif + encoder->protected_->streamable_subset = true; + encoder->protected_->do_mid_side_stereo = false; + encoder->protected_->loose_mid_side_stereo = false; + encoder->protected_->channels = 2; + encoder->protected_->bits_per_sample = 16; + encoder->protected_->sample_rate = 44100; + encoder->protected_->blocksize = 1152; + encoder->protected_->max_lpc_order = 0; + encoder->protected_->qlp_coeff_precision = 0; + encoder->protected_->do_qlp_coeff_prec_search = false; + encoder->protected_->do_exhaustive_model_search = false; + encoder->protected_->do_escape_coding = false; + encoder->protected_->min_residual_partition_order = 0; + encoder->protected_->max_residual_partition_order = 0; + encoder->protected_->rice_parameter_search_dist = 0; + encoder->protected_->total_samples_estimate = 0; + encoder->protected_->metadata = 0; + encoder->protected_->num_metadata_blocks = 0; + + encoder->private_->disable_constant_subframes = false; + encoder->private_->disable_fixed_subframes = false; + encoder->private_->disable_verbatim_subframes = false; + encoder->private_->write_callback = 0; + encoder->private_->metadata_callback = 0; + encoder->private_->client_data = 0; +} + +void free_(FLAC__StreamEncoder *encoder) +{ + unsigned i, channel; + + FLAC__ASSERT(0 != encoder); + for(i = 0; i < encoder->protected_->channels; i++) { + if(0 != encoder->private_->integer_signal_unaligned[i]) { + free(encoder->private_->integer_signal_unaligned[i]); + encoder->private_->integer_signal_unaligned[i] = 0; + } +#ifndef FLAC__INTEGER_ONLY_LIBRARY + if(0 != encoder->private_->real_signal_unaligned[i]) { + free(encoder->private_->real_signal_unaligned[i]); + encoder->private_->real_signal_unaligned[i] = 0; + } +#endif + } + for(i = 0; i < 2; i++) { + if(0 != encoder->private_->integer_signal_mid_side_unaligned[i]) { + free(encoder->private_->integer_signal_mid_side_unaligned[i]); + encoder->private_->integer_signal_mid_side_unaligned[i] = 0; + } +#ifndef FLAC__INTEGER_ONLY_LIBRARY + if(0 != encoder->private_->real_signal_mid_side_unaligned[i]) { + free(encoder->private_->real_signal_mid_side_unaligned[i]); + encoder->private_->real_signal_mid_side_unaligned[i] = 0; + } +#endif + } + for(channel = 0; channel < encoder->protected_->channels; channel++) { + for(i = 0; i < 2; i++) { + if(0 != encoder->private_->residual_workspace_unaligned[channel][i]) { + free(encoder->private_->residual_workspace_unaligned[channel][i]); + encoder->private_->residual_workspace_unaligned[channel][i] = 0; + } + } + } + for(channel = 0; channel < 2; channel++) { + for(i = 0; i < 2; i++) { + if(0 != encoder->private_->residual_workspace_mid_side_unaligned[channel][i]) { + free(encoder->private_->residual_workspace_mid_side_unaligned[channel][i]); + encoder->private_->residual_workspace_mid_side_unaligned[channel][i] = 0; + } + } + } + if(0 != encoder->private_->abs_residual_unaligned) { + free(encoder->private_->abs_residual_unaligned); + encoder->private_->abs_residual_unaligned = 0; + } + if(0 != encoder->private_->abs_residual_partition_sums_unaligned) { + free(encoder->private_->abs_residual_partition_sums_unaligned); + encoder->private_->abs_residual_partition_sums_unaligned = 0; + } + if(0 != encoder->private_->raw_bits_per_partition_unaligned) { + free(encoder->private_->raw_bits_per_partition_unaligned); + encoder->private_->raw_bits_per_partition_unaligned = 0; + } + if(encoder->protected_->verify) { + for(i = 0; i < encoder->protected_->channels; i++) { + if(0 != encoder->private_->verify.input_fifo.data[i]) { + free(encoder->private_->verify.input_fifo.data[i]); + encoder->private_->verify.input_fifo.data[i] = 0; + } + } + } + FLAC__bitbuffer_free(encoder->private_->frame); +} + +FLAC__bool resize_buffers_(FLAC__StreamEncoder *encoder, unsigned new_size) +{ + FLAC__bool ok; + unsigned i, channel; + + FLAC__ASSERT(new_size > 0); + FLAC__ASSERT(encoder->protected_->state == FLAC__STREAM_ENCODER_OK); + FLAC__ASSERT(encoder->private_->current_sample_number == 0); + + /* To avoid excessive malloc'ing, we only grow the buffer; no shrinking. */ + if(new_size <= encoder->private_->input_capacity) + return true; + + ok = true; + + /* WATCHOUT: FLAC__lpc_compute_residual_from_qlp_coefficients_asm_ia32_mmx() + * requires that the input arrays (in our case the integer signals) + * have a buffer of up to 3 zeroes in front (at negative indices) for + * alignment purposes; we use 4 to keep the data well-aligned. + */ + + for(i = 0; ok && i < encoder->protected_->channels; i++) { + ok = ok && FLAC__memory_alloc_aligned_int32_array(new_size+4, &encoder->private_->integer_signal_unaligned[i], &encoder->private_->integer_signal[i]); +#ifndef FLAC__INTEGER_ONLY_LIBRARY + if(encoder->protected_->max_lpc_order > 0) + ok = ok && FLAC__memory_alloc_aligned_real_array(new_size, &encoder->private_->real_signal_unaligned[i], &encoder->private_->real_signal[i]); +#endif + memset(encoder->private_->integer_signal[i], 0, sizeof(FLAC__int32)*4); + encoder->private_->integer_signal[i] += 4; + } + for(i = 0; ok && i < 2; i++) { + ok = ok && FLAC__memory_alloc_aligned_int32_array(new_size+4, &encoder->private_->integer_signal_mid_side_unaligned[i], &encoder->private_->integer_signal_mid_side[i]); +#ifndef FLAC__INTEGER_ONLY_LIBRARY + if(encoder->protected_->max_lpc_order > 0) + ok = ok && FLAC__memory_alloc_aligned_real_array(new_size, &encoder->private_->real_signal_mid_side_unaligned[i], &encoder->private_->real_signal_mid_side[i]); +#endif + memset(encoder->private_->integer_signal_mid_side[i], 0, sizeof(FLAC__int32)*4); + encoder->private_->integer_signal_mid_side[i] += 4; + } + for(channel = 0; ok && channel < encoder->protected_->channels; channel++) { + for(i = 0; ok && i < 2; i++) { + ok = ok && FLAC__memory_alloc_aligned_int32_array(new_size, &encoder->private_->residual_workspace_unaligned[channel][i], &encoder->private_->residual_workspace[channel][i]); + } + } + for(channel = 0; ok && channel < 2; channel++) { + for(i = 0; ok && i < 2; i++) { + ok = ok && FLAC__memory_alloc_aligned_int32_array(new_size, &encoder->private_->residual_workspace_mid_side_unaligned[channel][i], &encoder->private_->residual_workspace_mid_side[channel][i]); + } + } + ok = ok && FLAC__memory_alloc_aligned_uint32_array(new_size, &encoder->private_->abs_residual_unaligned, &encoder->private_->abs_residual); + if(encoder->private_->precompute_partition_sums || encoder->protected_->do_escape_coding) /* we require precompute_partition_sums if do_escape_coding because of their intertwined nature */ + ok = ok && FLAC__memory_alloc_aligned_uint64_array(new_size * 2, &encoder->private_->abs_residual_partition_sums_unaligned, &encoder->private_->abs_residual_partition_sums); + if(encoder->protected_->do_escape_coding) + ok = ok && FLAC__memory_alloc_aligned_unsigned_array(new_size * 2, &encoder->private_->raw_bits_per_partition_unaligned, &encoder->private_->raw_bits_per_partition); + + if(ok) + encoder->private_->input_capacity = new_size; + else + encoder->protected_->state = FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR; + + return ok; +} + +FLAC__bool write_bitbuffer_(FLAC__StreamEncoder *encoder, unsigned samples) +{ + const FLAC__byte *buffer; + unsigned bytes; + + FLAC__ASSERT(FLAC__bitbuffer_is_byte_aligned(encoder->private_->frame)); + + FLAC__bitbuffer_get_buffer(encoder->private_->frame, &buffer, &bytes); + + if(encoder->protected_->verify) { + encoder->private_->verify.output.data = buffer; + encoder->private_->verify.output.bytes = bytes; + if(encoder->private_->verify.state_hint == ENCODER_IN_MAGIC) { + encoder->private_->verify.needs_magic_hack = true; + } + else { + if(!FLAC__stream_decoder_process_single(encoder->private_->verify.decoder)) { + FLAC__bitbuffer_release_buffer(encoder->private_->frame); + if(encoder->protected_->state != FLAC__STREAM_ENCODER_VERIFY_MISMATCH_IN_AUDIO_DATA) + encoder->protected_->state = FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR; + return false; + } + } + } + + if(encoder->private_->write_callback(encoder, buffer, bytes, samples, encoder->private_->current_frame_number, encoder->private_->client_data) != FLAC__STREAM_ENCODER_WRITE_STATUS_OK) { + FLAC__bitbuffer_release_buffer(encoder->private_->frame); + encoder->protected_->state = FLAC__STREAM_ENCODER_FATAL_ERROR_WHILE_WRITING; + return false; + } + + FLAC__bitbuffer_release_buffer(encoder->private_->frame); + + if(samples > 0) { + encoder->private_->metadata.data.stream_info.min_framesize = min(bytes, encoder->private_->metadata.data.stream_info.min_framesize); + encoder->private_->metadata.data.stream_info.max_framesize = max(bytes, encoder->private_->metadata.data.stream_info.max_framesize); + } + + return true; +} + +FLAC__bool process_frame_(FLAC__StreamEncoder *encoder, FLAC__bool is_last_frame) +{ + FLAC__ASSERT(encoder->protected_->state == FLAC__STREAM_ENCODER_OK); + + /* + * Accumulate raw signal to the MD5 signature + */ + if(!FLAC__MD5Accumulate(&encoder->private_->md5context, (const FLAC__int32 * const *)encoder->private_->integer_signal, encoder->protected_->channels, encoder->protected_->blocksize, (encoder->protected_->bits_per_sample+7) / 8)) { + encoder->protected_->state = FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR; + return false; + } + + /* + * Process the frame header and subframes into the frame bitbuffer + */ + if(!process_subframes_(encoder, is_last_frame)) { + /* the above function sets the state for us in case of an error */ + return false; + } + + /* + * Zero-pad the frame to a byte_boundary + */ + if(!FLAC__bitbuffer_zero_pad_to_byte_boundary(encoder->private_->frame)) { + encoder->protected_->state = FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR; + return false; + } + + /* + * CRC-16 the whole thing + */ + FLAC__ASSERT(FLAC__bitbuffer_is_byte_aligned(encoder->private_->frame)); + FLAC__bitbuffer_write_raw_uint32(encoder->private_->frame, FLAC__bitbuffer_get_write_crc16(encoder->private_->frame), FLAC__FRAME_FOOTER_CRC_LEN); + + /* + * Write it + */ + if(!write_bitbuffer_(encoder, encoder->protected_->blocksize)) { + /* the above function sets the state for us in case of an error */ + return false; + } + + /* + * Get ready for the next frame + */ + encoder->private_->current_sample_number = 0; + encoder->private_->current_frame_number++; + encoder->private_->metadata.data.stream_info.total_samples += (FLAC__uint64)encoder->protected_->blocksize; + + return true; +} + +FLAC__bool process_subframes_(FLAC__StreamEncoder *encoder, FLAC__bool is_last_frame) +{ + FLAC__FrameHeader frame_header; + unsigned channel, min_partition_order = encoder->protected_->min_residual_partition_order, max_partition_order; + FLAC__bool do_independent, do_mid_side, precompute_partition_sums; + + /* + * Calculate the min,max Rice partition orders + */ + if(is_last_frame) { + max_partition_order = 0; + } + else { + max_partition_order = FLAC__format_get_max_rice_partition_order_from_blocksize(encoder->protected_->blocksize); + max_partition_order = min(max_partition_order, encoder->protected_->max_residual_partition_order); + } + min_partition_order = min(min_partition_order, max_partition_order); + + precompute_partition_sums = encoder->private_->precompute_partition_sums && ((max_partition_order > min_partition_order) || encoder->protected_->do_escape_coding); + + /* + * Setup the frame + */ + if(!FLAC__bitbuffer_clear(encoder->private_->frame)) { + encoder->protected_->state = FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR; + return false; + } + frame_header.blocksize = encoder->protected_->blocksize; + frame_header.sample_rate = encoder->protected_->sample_rate; + frame_header.channels = encoder->protected_->channels; + frame_header.channel_assignment = FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT; /* the default unless the encoder determines otherwise */ + frame_header.bits_per_sample = encoder->protected_->bits_per_sample; + frame_header.number_type = FLAC__FRAME_NUMBER_TYPE_FRAME_NUMBER; + frame_header.number.frame_number = encoder->private_->current_frame_number; + + /* + * Figure out what channel assignments to try + */ + if(encoder->protected_->do_mid_side_stereo) { + if(encoder->protected_->loose_mid_side_stereo) { + if(encoder->private_->loose_mid_side_stereo_frame_count == 0) { + do_independent = true; + do_mid_side = true; + } + else { + do_independent = (encoder->private_->last_channel_assignment == FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT); + do_mid_side = !do_independent; + } + } + else { + do_independent = true; + do_mid_side = true; + } + } + else { + do_independent = true; + do_mid_side = false; + } + + FLAC__ASSERT(do_independent || do_mid_side); + + /* + * Check for wasted bits; set effective bps for each subframe + */ + if(do_independent) { + for(channel = 0; channel < encoder->protected_->channels; channel++) { + const unsigned w = get_wasted_bits_(encoder->private_->integer_signal[channel], encoder->protected_->blocksize); + encoder->private_->subframe_workspace[channel][0].wasted_bits = encoder->private_->subframe_workspace[channel][1].wasted_bits = w; + encoder->private_->subframe_bps[channel] = encoder->protected_->bits_per_sample - w; + } + } + if(do_mid_side) { + FLAC__ASSERT(encoder->protected_->channels == 2); + for(channel = 0; channel < 2; channel++) { + const unsigned w = get_wasted_bits_(encoder->private_->integer_signal_mid_side[channel], encoder->protected_->blocksize); + encoder->private_->subframe_workspace_mid_side[channel][0].wasted_bits = encoder->private_->subframe_workspace_mid_side[channel][1].wasted_bits = w; + encoder->private_->subframe_bps_mid_side[channel] = encoder->protected_->bits_per_sample - w + (channel==0? 0:1); + } + } + + /* + * First do a normal encoding pass of each independent channel + */ + if(do_independent) { + for(channel = 0; channel < encoder->protected_->channels; channel++) { + if(! + process_subframe_( + encoder, + min_partition_order, + max_partition_order, + precompute_partition_sums, + &frame_header, + encoder->private_->subframe_bps[channel], + encoder->private_->integer_signal[channel], +#ifndef FLAC__INTEGER_ONLY_LIBRARY + encoder->private_->real_signal[channel], +#endif + encoder->private_->subframe_workspace_ptr[channel], + encoder->private_->partitioned_rice_contents_workspace_ptr[channel], + encoder->private_->residual_workspace[channel], + encoder->private_->best_subframe+channel, + encoder->private_->best_subframe_bits+channel + ) + ) + return false; + } + } + + /* + * Now do mid and side channels if requested + */ + if(do_mid_side) { + FLAC__ASSERT(encoder->protected_->channels == 2); + + for(channel = 0; channel < 2; channel++) { + if(! + process_subframe_( + encoder, + min_partition_order, + max_partition_order, + precompute_partition_sums, + &frame_header, + encoder->private_->subframe_bps_mid_side[channel], + encoder->private_->integer_signal_mid_side[channel], +#ifndef FLAC__INTEGER_ONLY_LIBRARY + encoder->private_->real_signal_mid_side[channel], +#endif + encoder->private_->subframe_workspace_ptr_mid_side[channel], + encoder->private_->partitioned_rice_contents_workspace_ptr_mid_side[channel], + encoder->private_->residual_workspace_mid_side[channel], + encoder->private_->best_subframe_mid_side+channel, + encoder->private_->best_subframe_bits_mid_side+channel + ) + ) + return false; + } + } + + /* + * Compose the frame bitbuffer + */ + if(do_mid_side) { + unsigned left_bps = 0, right_bps = 0; /* initialized only to prevent superfluous compiler warning */ + FLAC__Subframe *left_subframe = 0, *right_subframe = 0; /* initialized only to prevent superfluous compiler warning */ + FLAC__ChannelAssignment channel_assignment; + + FLAC__ASSERT(encoder->protected_->channels == 2); + + if(encoder->protected_->loose_mid_side_stereo && encoder->private_->loose_mid_side_stereo_frame_count > 0) { + channel_assignment = (encoder->private_->last_channel_assignment == FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT? FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT : FLAC__CHANNEL_ASSIGNMENT_MID_SIDE); + } + else { + unsigned bits[4]; /* WATCHOUT - indexed by FLAC__ChannelAssignment */ + unsigned min_bits; + FLAC__ChannelAssignment ca; + + FLAC__ASSERT(do_independent && do_mid_side); + + /* We have to figure out which channel assignent results in the smallest frame */ + bits[FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT] = encoder->private_->best_subframe_bits [0] + encoder->private_->best_subframe_bits [1]; + bits[FLAC__CHANNEL_ASSIGNMENT_LEFT_SIDE ] = encoder->private_->best_subframe_bits [0] + encoder->private_->best_subframe_bits_mid_side[1]; + bits[FLAC__CHANNEL_ASSIGNMENT_RIGHT_SIDE ] = encoder->private_->best_subframe_bits [1] + encoder->private_->best_subframe_bits_mid_side[1]; + bits[FLAC__CHANNEL_ASSIGNMENT_MID_SIDE ] = encoder->private_->best_subframe_bits_mid_side[0] + encoder->private_->best_subframe_bits_mid_side[1]; + + for(channel_assignment = (FLAC__ChannelAssignment)0, min_bits = bits[0], ca = (FLAC__ChannelAssignment)1; (int)ca <= 3; ca = (FLAC__ChannelAssignment)((int)ca + 1)) { + if(bits[ca] < min_bits) { + min_bits = bits[ca]; + channel_assignment = ca; + } + } + } + + frame_header.channel_assignment = channel_assignment; + + if(!FLAC__frame_add_header(&frame_header, encoder->protected_->streamable_subset, encoder->private_->frame)) { + encoder->protected_->state = FLAC__STREAM_ENCODER_FRAMING_ERROR; + return false; + } + + switch(channel_assignment) { + case FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT: + left_subframe = &encoder->private_->subframe_workspace [0][encoder->private_->best_subframe [0]]; + right_subframe = &encoder->private_->subframe_workspace [1][encoder->private_->best_subframe [1]]; + break; + case FLAC__CHANNEL_ASSIGNMENT_LEFT_SIDE: + left_subframe = &encoder->private_->subframe_workspace [0][encoder->private_->best_subframe [0]]; + right_subframe = &encoder->private_->subframe_workspace_mid_side[1][encoder->private_->best_subframe_mid_side[1]]; + break; + case FLAC__CHANNEL_ASSIGNMENT_RIGHT_SIDE: + left_subframe = &encoder->private_->subframe_workspace_mid_side[1][encoder->private_->best_subframe_mid_side[1]]; + right_subframe = &encoder->private_->subframe_workspace [1][encoder->private_->best_subframe [1]]; + break; + case FLAC__CHANNEL_ASSIGNMENT_MID_SIDE: + left_subframe = &encoder->private_->subframe_workspace_mid_side[0][encoder->private_->best_subframe_mid_side[0]]; + right_subframe = &encoder->private_->subframe_workspace_mid_side[1][encoder->private_->best_subframe_mid_side[1]]; + break; + default: + FLAC__ASSERT(0); + } + + switch(channel_assignment) { + case FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT: + left_bps = encoder->private_->subframe_bps [0]; + right_bps = encoder->private_->subframe_bps [1]; + break; + case FLAC__CHANNEL_ASSIGNMENT_LEFT_SIDE: + left_bps = encoder->private_->subframe_bps [0]; + right_bps = encoder->private_->subframe_bps_mid_side[1]; + break; + case FLAC__CHANNEL_ASSIGNMENT_RIGHT_SIDE: + left_bps = encoder->private_->subframe_bps_mid_side[1]; + right_bps = encoder->private_->subframe_bps [1]; + break; + case FLAC__CHANNEL_ASSIGNMENT_MID_SIDE: + left_bps = encoder->private_->subframe_bps_mid_side[0]; + right_bps = encoder->private_->subframe_bps_mid_side[1]; + break; + default: + FLAC__ASSERT(0); + } + + /* note that encoder_add_subframe_ sets the state for us in case of an error */ + if(!add_subframe_(encoder, &frame_header, left_bps , left_subframe , encoder->private_->frame)) + return false; + if(!add_subframe_(encoder, &frame_header, right_bps, right_subframe, encoder->private_->frame)) + return false; + } + else { + if(!FLAC__frame_add_header(&frame_header, encoder->protected_->streamable_subset, encoder->private_->frame)) { + encoder->protected_->state = FLAC__STREAM_ENCODER_FRAMING_ERROR; + return false; + } + + for(channel = 0; channel < encoder->protected_->channels; channel++) { + if(!add_subframe_(encoder, &frame_header, encoder->private_->subframe_bps[channel], &encoder->private_->subframe_workspace[channel][encoder->private_->best_subframe[channel]], encoder->private_->frame)) { + /* the above function sets the state for us in case of an error */ + return false; + } + } + } + + if(encoder->protected_->loose_mid_side_stereo) { + encoder->private_->loose_mid_side_stereo_frame_count++; + if(encoder->private_->loose_mid_side_stereo_frame_count >= encoder->private_->loose_mid_side_stereo_frames) + encoder->private_->loose_mid_side_stereo_frame_count = 0; + } + + encoder->private_->last_channel_assignment = frame_header.channel_assignment; + + return true; +} + +FLAC__bool process_subframe_( + FLAC__StreamEncoder *encoder, + unsigned min_partition_order, + unsigned max_partition_order, + FLAC__bool precompute_partition_sums, + const FLAC__FrameHeader *frame_header, + unsigned subframe_bps, + const FLAC__int32 integer_signal[], +#ifndef FLAC__INTEGER_ONLY_LIBRARY + const FLAC__real real_signal[], +#endif + FLAC__Subframe *subframe[2], + FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents[2], + FLAC__int32 *residual[2], + unsigned *best_subframe, + unsigned *best_bits +) +{ +#ifndef FLAC__INTEGER_ONLY_LIBRARY + FLAC__float fixed_residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]; +#else + FLAC__fixedpoint fixed_residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]; +#endif +#ifndef FLAC__INTEGER_ONLY_LIBRARY + FLAC__double lpc_residual_bits_per_sample; + FLAC__real autoc[FLAC__MAX_LPC_ORDER+1]; /* WATCHOUT: the size is important even though encoder->protected_->max_lpc_order might be less; some asm routines need all the space */ + FLAC__double lpc_error[FLAC__MAX_LPC_ORDER]; + unsigned min_lpc_order, max_lpc_order, lpc_order; + unsigned min_qlp_coeff_precision, max_qlp_coeff_precision, qlp_coeff_precision; +#endif + unsigned min_fixed_order, max_fixed_order, guess_fixed_order, fixed_order; + unsigned rice_parameter; + unsigned _candidate_bits, _best_bits; + unsigned _best_subframe; + + /* verbatim subframe is the baseline against which we measure other compressed subframes */ + _best_subframe = 0; + if(encoder->private_->disable_verbatim_subframes && frame_header->blocksize >= FLAC__MAX_FIXED_ORDER) + _best_bits = UINT_MAX; + else + _best_bits = evaluate_verbatim_subframe_(integer_signal, frame_header->blocksize, subframe_bps, subframe[_best_subframe]); + + if(frame_header->blocksize >= FLAC__MAX_FIXED_ORDER) { + unsigned signal_is_constant = false; + guess_fixed_order = encoder->private_->local_fixed_compute_best_predictor(integer_signal+FLAC__MAX_FIXED_ORDER, frame_header->blocksize-FLAC__MAX_FIXED_ORDER, fixed_residual_bits_per_sample); + /* check for constant subframe */ + if( + !encoder->private_->disable_constant_subframes && +#ifndef FLAC__INTEGER_ONLY_LIBRARY + fixed_residual_bits_per_sample[1] == 0.0 +#else + fixed_residual_bits_per_sample[1] == FLAC__FP_ZERO +#endif + ) { + /* the above means it's possible all samples are the same value; now double-check it: */ + unsigned i; + signal_is_constant = true; + for(i = 1; i < frame_header->blocksize; i++) { + if(integer_signal[0] != integer_signal[i]) { + signal_is_constant = false; + break; + } + } + } + if(signal_is_constant) { + _candidate_bits = evaluate_constant_subframe_(integer_signal[0], subframe_bps, subframe[!_best_subframe]); + if(_candidate_bits < _best_bits) { + _best_subframe = !_best_subframe; + _best_bits = _candidate_bits; + } + } + else { + if(!encoder->private_->disable_fixed_subframes || (encoder->protected_->max_lpc_order == 0 && _best_bits == UINT_MAX)) { + /* encode fixed */ + if(encoder->protected_->do_exhaustive_model_search) { + min_fixed_order = 0; + max_fixed_order = FLAC__MAX_FIXED_ORDER; + } + else { + min_fixed_order = max_fixed_order = guess_fixed_order; + } + for(fixed_order = min_fixed_order; fixed_order <= max_fixed_order; fixed_order++) { +#ifndef FLAC__INTEGER_ONLY_LIBRARY + if(fixed_residual_bits_per_sample[fixed_order] >= (FLAC__float)subframe_bps) + continue; /* don't even try */ + rice_parameter = (fixed_residual_bits_per_sample[fixed_order] > 0.0)? (unsigned)(fixed_residual_bits_per_sample[fixed_order]+0.5) : 0; /* 0.5 is for rounding */ +#else + if(FLAC__fixedpoint_trunc(fixed_residual_bits_per_sample[fixed_order]) >= (int)subframe_bps) + continue; /* don't even try */ + rice_parameter = (fixed_residual_bits_per_sample[fixed_order] > FLAC__FP_ZERO)? (unsigned)FLAC__fixedpoint_trunc(fixed_residual_bits_per_sample[fixed_order]+FLAC__FP_ONE_HALF) : 0; /* 0.5 is for rounding */ +#endif +#ifndef FLAC__SYMMETRIC_RICE + rice_parameter++; /* to account for the signed->unsigned conversion during rice coding */ +#endif + if(rice_parameter >= FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER) { +#ifdef DEBUG_VERBOSE + fprintf(stderr, "clipping rice_parameter (%u -> %u) @0\n", rice_parameter, FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER - 1); +#endif + rice_parameter = FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER - 1; + } + _candidate_bits = + evaluate_fixed_subframe_( + encoder, + integer_signal, + residual[!_best_subframe], + encoder->private_->abs_residual, + encoder->private_->abs_residual_partition_sums, + encoder->private_->raw_bits_per_partition, + frame_header->blocksize, + subframe_bps, + fixed_order, + rice_parameter, + min_partition_order, + max_partition_order, + precompute_partition_sums, + encoder->protected_->do_escape_coding, + encoder->protected_->rice_parameter_search_dist, + subframe[!_best_subframe], + partitioned_rice_contents[!_best_subframe] + ); + if(_candidate_bits < _best_bits) { + _best_subframe = !_best_subframe; + _best_bits = _candidate_bits; + } + } + } + +#ifndef FLAC__INTEGER_ONLY_LIBRARY + /* encode lpc */ + if(encoder->protected_->max_lpc_order > 0) { + if(encoder->protected_->max_lpc_order >= frame_header->blocksize) + max_lpc_order = frame_header->blocksize-1; + else + max_lpc_order = encoder->protected_->max_lpc_order; + if(max_lpc_order > 0) { + encoder->private_->local_lpc_compute_autocorrelation(real_signal, frame_header->blocksize, max_lpc_order+1, autoc); + /* if autoc[0] == 0.0, the signal is constant and we usually won't get here, but it can happen */ + if(autoc[0] != 0.0) { + FLAC__lpc_compute_lp_coefficients(autoc, max_lpc_order, encoder->private_->lp_coeff, lpc_error); + if(encoder->protected_->do_exhaustive_model_search) { + min_lpc_order = 1; + } + else { + unsigned guess_lpc_order = FLAC__lpc_compute_best_order(lpc_error, max_lpc_order, frame_header->blocksize, subframe_bps); + min_lpc_order = max_lpc_order = guess_lpc_order; + } + for(lpc_order = min_lpc_order; lpc_order <= max_lpc_order; lpc_order++) { + lpc_residual_bits_per_sample = FLAC__lpc_compute_expected_bits_per_residual_sample(lpc_error[lpc_order-1], frame_header->blocksize-lpc_order); + if(lpc_residual_bits_per_sample >= (FLAC__double)subframe_bps) + continue; /* don't even try */ + rice_parameter = (lpc_residual_bits_per_sample > 0.0)? (unsigned)(lpc_residual_bits_per_sample+0.5) : 0; /* 0.5 is for rounding */ +#ifndef FLAC__SYMMETRIC_RICE + rice_parameter++; /* to account for the signed->unsigned conversion during rice coding */ +#endif + if(rice_parameter >= FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER) { +#ifdef DEBUG_VERBOSE + fprintf(stderr, "clipping rice_parameter (%u -> %u) @1\n", rice_parameter, FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER - 1); +#endif + rice_parameter = FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER - 1; + } + if(encoder->protected_->do_qlp_coeff_prec_search) { + min_qlp_coeff_precision = FLAC__MIN_QLP_COEFF_PRECISION; + /* ensure a 32-bit datapath throughout for 16bps or less */ + if(subframe_bps <= 16) + max_qlp_coeff_precision = min(32 - subframe_bps - lpc_order, FLAC__MAX_QLP_COEFF_PRECISION); + else + max_qlp_coeff_precision = FLAC__MAX_QLP_COEFF_PRECISION; + } + else { + min_qlp_coeff_precision = max_qlp_coeff_precision = encoder->protected_->qlp_coeff_precision; + } + for(qlp_coeff_precision = min_qlp_coeff_precision; qlp_coeff_precision <= max_qlp_coeff_precision; qlp_coeff_precision++) { + _candidate_bits = + evaluate_lpc_subframe_( + encoder, + integer_signal, + residual[!_best_subframe], + encoder->private_->abs_residual, + encoder->private_->abs_residual_partition_sums, + encoder->private_->raw_bits_per_partition, + encoder->private_->lp_coeff[lpc_order-1], + frame_header->blocksize, + subframe_bps, + lpc_order, + qlp_coeff_precision, + rice_parameter, + min_partition_order, + max_partition_order, + precompute_partition_sums, + encoder->protected_->do_escape_coding, + encoder->protected_->rice_parameter_search_dist, + subframe[!_best_subframe], + partitioned_rice_contents[!_best_subframe] + ); + if(_candidate_bits > 0) { /* if == 0, there was a problem quantizing the lpcoeffs */ + if(_candidate_bits < _best_bits) { + _best_subframe = !_best_subframe; + _best_bits = _candidate_bits; + } + } + } + } + } + } + } +#endif /* !defined FLAC__INTEGER_ONLY_LIBRARY */ + } + } + + /* under rare circumstances this can happen when all but lpc subframe types are disabled: */ + if(_best_bits == UINT_MAX) { + FLAC__ASSERT(_best_subframe == 0); + _best_bits = evaluate_verbatim_subframe_(integer_signal, frame_header->blocksize, subframe_bps, subframe[_best_subframe]); + } + + *best_subframe = _best_subframe; + *best_bits = _best_bits; + + return true; +} + +FLAC__bool add_subframe_( + FLAC__StreamEncoder *encoder, + const FLAC__FrameHeader *frame_header, + unsigned subframe_bps, + const FLAC__Subframe *subframe, + FLAC__BitBuffer *frame +) +{ + switch(subframe->type) { + case FLAC__SUBFRAME_TYPE_CONSTANT: + if(!FLAC__subframe_add_constant(&(subframe->data.constant), subframe_bps, subframe->wasted_bits, frame)) { + encoder->protected_->state = FLAC__STREAM_ENCODER_FATAL_ERROR_WHILE_ENCODING; + return false; + } + break; + case FLAC__SUBFRAME_TYPE_FIXED: + if(!FLAC__subframe_add_fixed(&(subframe->data.fixed), frame_header->blocksize - subframe->data.fixed.order, subframe_bps, subframe->wasted_bits, frame)) { + encoder->protected_->state = FLAC__STREAM_ENCODER_FATAL_ERROR_WHILE_ENCODING; + return false; + } + break; + case FLAC__SUBFRAME_TYPE_LPC: + if(!FLAC__subframe_add_lpc(&(subframe->data.lpc), frame_header->blocksize - subframe->data.lpc.order, subframe_bps, subframe->wasted_bits, frame)) { + encoder->protected_->state = FLAC__STREAM_ENCODER_FATAL_ERROR_WHILE_ENCODING; + return false; + } + break; + case FLAC__SUBFRAME_TYPE_VERBATIM: + if(!FLAC__subframe_add_verbatim(&(subframe->data.verbatim), frame_header->blocksize, subframe_bps, subframe->wasted_bits, frame)) { + encoder->protected_->state = FLAC__STREAM_ENCODER_FATAL_ERROR_WHILE_ENCODING; + return false; + } + break; + default: + FLAC__ASSERT(0); + } + + return true; +} + +unsigned evaluate_constant_subframe_( + const FLAC__int32 signal, + unsigned subframe_bps, + FLAC__Subframe *subframe +) +{ + subframe->type = FLAC__SUBFRAME_TYPE_CONSTANT; + subframe->data.constant.value = signal; + + return FLAC__SUBFRAME_ZERO_PAD_LEN + FLAC__SUBFRAME_TYPE_LEN + FLAC__SUBFRAME_WASTED_BITS_FLAG_LEN + subframe_bps; +} + +unsigned evaluate_fixed_subframe_( + FLAC__StreamEncoder *encoder, + const FLAC__int32 signal[], + FLAC__int32 residual[], + FLAC__uint32 abs_residual[], + FLAC__uint64 abs_residual_partition_sums[], + unsigned raw_bits_per_partition[], + unsigned blocksize, + unsigned subframe_bps, + unsigned order, + unsigned rice_parameter, + unsigned min_partition_order, + unsigned max_partition_order, + FLAC__bool precompute_partition_sums, + FLAC__bool do_escape_coding, + unsigned rice_parameter_search_dist, + FLAC__Subframe *subframe, + FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents +) +{ + unsigned i, residual_bits; + const unsigned residual_samples = blocksize - order; + + FLAC__fixed_compute_residual(signal+order, residual_samples, order, residual); + + subframe->type = FLAC__SUBFRAME_TYPE_FIXED; + + subframe->data.fixed.entropy_coding_method.type = FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE; + subframe->data.fixed.entropy_coding_method.data.partitioned_rice.contents = partitioned_rice_contents; + subframe->data.fixed.residual = residual; + + residual_bits = + find_best_partition_order_( + encoder->private_, + residual, + abs_residual, + abs_residual_partition_sums, + raw_bits_per_partition, + residual_samples, + order, + rice_parameter, + min_partition_order, + max_partition_order, + precompute_partition_sums, + do_escape_coding, + rice_parameter_search_dist, + &subframe->data.fixed.entropy_coding_method.data.partitioned_rice + ); + + subframe->data.fixed.order = order; + for(i = 0; i < order; i++) + subframe->data.fixed.warmup[i] = signal[i]; + + return FLAC__SUBFRAME_ZERO_PAD_LEN + FLAC__SUBFRAME_TYPE_LEN + FLAC__SUBFRAME_WASTED_BITS_FLAG_LEN + (order * subframe_bps) + residual_bits; +} + +#ifndef FLAC__INTEGER_ONLY_LIBRARY +unsigned evaluate_lpc_subframe_( + FLAC__StreamEncoder *encoder, + const FLAC__int32 signal[], + FLAC__int32 residual[], + FLAC__uint32 abs_residual[], + FLAC__uint64 abs_residual_partition_sums[], + unsigned raw_bits_per_partition[], + const FLAC__real lp_coeff[], + unsigned blocksize, + unsigned subframe_bps, + unsigned order, + unsigned qlp_coeff_precision, + unsigned rice_parameter, + unsigned min_partition_order, + unsigned max_partition_order, + FLAC__bool precompute_partition_sums, + FLAC__bool do_escape_coding, + unsigned rice_parameter_search_dist, + FLAC__Subframe *subframe, + FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents +) +{ + FLAC__int32 qlp_coeff[FLAC__MAX_LPC_ORDER]; + unsigned i, residual_bits; + int quantization, ret; + const unsigned residual_samples = blocksize - order; + + /* try to keep qlp coeff precision such that only 32-bit math is required for decode of <=16bps streams */ + if(subframe_bps <= 16) { + FLAC__ASSERT(order > 0); + FLAC__ASSERT(order <= FLAC__MAX_LPC_ORDER); + qlp_coeff_precision = min(qlp_coeff_precision, 32 - subframe_bps - FLAC__bitmath_ilog2(order)); + } + + ret = FLAC__lpc_quantize_coefficients(lp_coeff, order, qlp_coeff_precision, qlp_coeff, &quantization); + if(ret != 0) + return 0; /* this is a hack to indicate to the caller that we can't do lp at this order on this subframe */ + + if(subframe_bps + qlp_coeff_precision + FLAC__bitmath_ilog2(order) <= 32) + if(subframe_bps <= 16 && qlp_coeff_precision <= 16) + encoder->private_->local_lpc_compute_residual_from_qlp_coefficients_16bit(signal+order, residual_samples, qlp_coeff, order, quantization, residual); + else + encoder->private_->local_lpc_compute_residual_from_qlp_coefficients(signal+order, residual_samples, qlp_coeff, order, quantization, residual); + else + encoder->private_->local_lpc_compute_residual_from_qlp_coefficients_64bit(signal+order, residual_samples, qlp_coeff, order, quantization, residual); + + subframe->type = FLAC__SUBFRAME_TYPE_LPC; + + subframe->data.lpc.entropy_coding_method.type = FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE; + subframe->data.lpc.entropy_coding_method.data.partitioned_rice.contents = partitioned_rice_contents; + subframe->data.lpc.residual = residual; + + residual_bits = + find_best_partition_order_( + encoder->private_, + residual, + abs_residual, + abs_residual_partition_sums, + raw_bits_per_partition, + residual_samples, + order, + rice_parameter, + min_partition_order, + max_partition_order, + precompute_partition_sums, + do_escape_coding, + rice_parameter_search_dist, + &subframe->data.fixed.entropy_coding_method.data.partitioned_rice + ); + + subframe->data.lpc.order = order; + subframe->data.lpc.qlp_coeff_precision = qlp_coeff_precision; + subframe->data.lpc.quantization_level = quantization; + memcpy(subframe->data.lpc.qlp_coeff, qlp_coeff, sizeof(FLAC__int32)*FLAC__MAX_LPC_ORDER); + for(i = 0; i < order; i++) + subframe->data.lpc.warmup[i] = signal[i]; + + return FLAC__SUBFRAME_ZERO_PAD_LEN + FLAC__SUBFRAME_TYPE_LEN + FLAC__SUBFRAME_WASTED_BITS_FLAG_LEN + FLAC__SUBFRAME_LPC_QLP_COEFF_PRECISION_LEN + FLAC__SUBFRAME_LPC_QLP_SHIFT_LEN + (order * (qlp_coeff_precision + subframe_bps)) + residual_bits; +} +#endif + +unsigned evaluate_verbatim_subframe_( + const FLAC__int32 signal[], + unsigned blocksize, + unsigned subframe_bps, + FLAC__Subframe *subframe +) +{ + subframe->type = FLAC__SUBFRAME_TYPE_VERBATIM; + + subframe->data.verbatim.data = signal; + + return FLAC__SUBFRAME_ZERO_PAD_LEN + FLAC__SUBFRAME_TYPE_LEN + FLAC__SUBFRAME_WASTED_BITS_FLAG_LEN + (blocksize * subframe_bps); +} + +unsigned find_best_partition_order_( + FLAC__StreamEncoderPrivate *private_, + const FLAC__int32 residual[], + FLAC__uint32 abs_residual[], + FLAC__uint64 abs_residual_partition_sums[], + unsigned raw_bits_per_partition[], + unsigned residual_samples, + unsigned predictor_order, + unsigned rice_parameter, + unsigned min_partition_order, + unsigned max_partition_order, + FLAC__bool precompute_partition_sums, + FLAC__bool do_escape_coding, + unsigned rice_parameter_search_dist, + FLAC__EntropyCodingMethod_PartitionedRice *best_partitioned_rice +) +{ + FLAC__int32 r; + unsigned residual_bits, best_residual_bits = 0; + unsigned residual_sample; + unsigned best_parameters_index = 0; + const unsigned blocksize = residual_samples + predictor_order; + + /* compute abs(residual) for use later */ + for(residual_sample = 0; residual_sample < residual_samples; residual_sample++) { + r = residual[residual_sample]; + abs_residual[residual_sample] = (FLAC__uint32)(r<0? -r : r); + } + + max_partition_order = FLAC__format_get_max_rice_partition_order_from_blocksize_limited_max_and_predictor_order(max_partition_order, blocksize, predictor_order); + min_partition_order = min(min_partition_order, max_partition_order); + + if(precompute_partition_sums) { + int partition_order; + unsigned sum; + + precompute_partition_info_sums_(abs_residual, abs_residual_partition_sums, residual_samples, predictor_order, min_partition_order, max_partition_order); + + if(do_escape_coding) + precompute_partition_info_escapes_(residual, raw_bits_per_partition, residual_samples, predictor_order, min_partition_order, max_partition_order); + + for(partition_order = (int)max_partition_order, sum = 0; partition_order >= (int)min_partition_order; partition_order--) { +#ifdef DONT_ESTIMATE_RICE_BITS + if(! + set_partitioned_rice_with_precompute_( + residual, + abs_residual_partition_sums+sum, + raw_bits_per_partition+sum, + residual_samples, + predictor_order, + rice_parameter, + rice_parameter_search_dist, + (unsigned)partition_order, + do_escape_coding, + &private_->partitioned_rice_contents_extra[!best_parameters_index], + &residual_bits + ) + ) +#else + if(! + set_partitioned_rice_with_precompute_( + abs_residual, + abs_residual_partition_sums+sum, + raw_bits_per_partition+sum, + residual_samples, + predictor_order, + rice_parameter, + rice_parameter_search_dist, + (unsigned)partition_order, + do_escape_coding, + &private_->partitioned_rice_contents_extra[!best_parameters_index], + &residual_bits + ) + ) +#endif + { + FLAC__ASSERT(best_residual_bits != 0); + break; + } + sum += 1u << partition_order; + if(best_residual_bits == 0 || residual_bits < best_residual_bits) { + best_residual_bits = residual_bits; + best_parameters_index = !best_parameters_index; + best_partitioned_rice->order = partition_order; + } + } + } + else { + unsigned partition_order; + for(partition_order = min_partition_order; partition_order <= max_partition_order; partition_order++) { +#ifdef DONT_ESTIMATE_RICE_BITS + if(! + set_partitioned_rice_( + abs_residual, + residual, + residual_samples, + predictor_order, + rice_parameter, + rice_parameter_search_dist, + partition_order, + &private_->partitioned_rice_contents_extra[!best_parameters_index], + &residual_bits + ) + ) +#else + if(! + set_partitioned_rice_( + abs_residual, + residual_samples, + predictor_order, + rice_parameter, + rice_parameter_search_dist, + partition_order, + &private_->partitioned_rice_contents_extra[!best_parameters_index], + &residual_bits + ) + ) +#endif + { + FLAC__ASSERT(best_residual_bits != 0); + break; + } + if(best_residual_bits == 0 || residual_bits < best_residual_bits) { + best_residual_bits = residual_bits; + best_parameters_index = !best_parameters_index; + best_partitioned_rice->order = partition_order; + } + } + } + + /* + * We are allowed to de-const the pointer based on our special knowledge; + * it is const to the outside world. + */ + { + FLAC__EntropyCodingMethod_PartitionedRiceContents* best_partitioned_rice_contents = (FLAC__EntropyCodingMethod_PartitionedRiceContents*)best_partitioned_rice->contents; + FLAC__format_entropy_coding_method_partitioned_rice_contents_ensure_size(best_partitioned_rice_contents, max(6, best_partitioned_rice->order)); + memcpy(best_partitioned_rice_contents->parameters, private_->partitioned_rice_contents_extra[best_parameters_index].parameters, sizeof(unsigned)*(1<<(best_partitioned_rice->order))); + memcpy(best_partitioned_rice_contents->raw_bits, private_->partitioned_rice_contents_extra[best_parameters_index].raw_bits, sizeof(unsigned)*(1<<(best_partitioned_rice->order))); + } + + return best_residual_bits; +} + +void precompute_partition_info_sums_( + const FLAC__uint32 abs_residual[], + FLAC__uint64 abs_residual_partition_sums[], + unsigned residual_samples, + unsigned predictor_order, + unsigned min_partition_order, + unsigned max_partition_order +) +{ + int partition_order; + unsigned from_partition, to_partition = 0; + const unsigned blocksize = residual_samples + predictor_order; + + /* first do max_partition_order */ + for(partition_order = (int)max_partition_order; partition_order >= 0; partition_order--) { + FLAC__uint64 abs_residual_partition_sum; + FLAC__uint32 abs_r; + unsigned partition, partition_sample, partition_samples, residual_sample; + const unsigned partitions = 1u << partition_order; + const unsigned default_partition_samples = blocksize >> partition_order; + + FLAC__ASSERT(default_partition_samples > predictor_order); + + for(partition = residual_sample = 0; partition < partitions; partition++) { + partition_samples = default_partition_samples; + if(partition == 0) + partition_samples -= predictor_order; + abs_residual_partition_sum = 0; + for(partition_sample = 0; partition_sample < partition_samples; partition_sample++) { + abs_r = abs_residual[residual_sample]; + abs_residual_partition_sum += abs_r; + residual_sample++; + } + abs_residual_partition_sums[partition] = abs_residual_partition_sum; + } + to_partition = partitions; + break; + } + + /* now merge partitions for lower orders */ + for(from_partition = 0, --partition_order; partition_order >= (int)min_partition_order; partition_order--) { + FLAC__uint64 s; + unsigned i; + const unsigned partitions = 1u << partition_order; + for(i = 0; i < partitions; i++) { + s = abs_residual_partition_sums[from_partition]; + from_partition++; + abs_residual_partition_sums[to_partition] = s + abs_residual_partition_sums[from_partition]; + from_partition++; + to_partition++; + } + } +} + +void precompute_partition_info_escapes_( + const FLAC__int32 residual[], + unsigned raw_bits_per_partition[], + unsigned residual_samples, + unsigned predictor_order, + unsigned min_partition_order, + unsigned max_partition_order +) +{ + int partition_order; + unsigned from_partition, to_partition = 0; + const unsigned blocksize = residual_samples + predictor_order; + + /* first do max_partition_order */ + for(partition_order = (int)max_partition_order; partition_order >= 0; partition_order--) { + FLAC__int32 r, residual_partition_min, residual_partition_max; + unsigned silog2_min, silog2_max; + unsigned partition, partition_sample, partition_samples, residual_sample; + const unsigned partitions = 1u << partition_order; + const unsigned default_partition_samples = blocksize >> partition_order; + + FLAC__ASSERT(default_partition_samples > predictor_order); + + for(partition = residual_sample = 0; partition < partitions; partition++) { + partition_samples = default_partition_samples; + if(partition == 0) + partition_samples -= predictor_order; + residual_partition_min = residual_partition_max = 0; + for(partition_sample = 0; partition_sample < partition_samples; partition_sample++) { + r = residual[residual_sample]; + if(r < residual_partition_min) + residual_partition_min = r; + else if(r > residual_partition_max) + residual_partition_max = r; + residual_sample++; + } + silog2_min = FLAC__bitmath_silog2(residual_partition_min); + silog2_max = FLAC__bitmath_silog2(residual_partition_max); + raw_bits_per_partition[partition] = max(silog2_min, silog2_max); + } + to_partition = partitions; + break; + } + + /* now merge partitions for lower orders */ + for(from_partition = 0, --partition_order; partition_order >= (int)min_partition_order; partition_order--) { + unsigned m; + unsigned i; + const unsigned partitions = 1u << partition_order; + for(i = 0; i < partitions; i++) { + m = raw_bits_per_partition[from_partition]; + from_partition++; + raw_bits_per_partition[to_partition] = max(m, raw_bits_per_partition[from_partition]); + from_partition++; + to_partition++; + } + } +} + +#ifdef VARIABLE_RICE_BITS +#undef VARIABLE_RICE_BITS +#endif +#ifndef DONT_ESTIMATE_RICE_BITS +#define VARIABLE_RICE_BITS(value, parameter) ((value) >> (parameter)) +#endif + +#ifdef DONT_ESTIMATE_RICE_BITS +FLAC__bool set_partitioned_rice_( + const FLAC__uint32 abs_residual[], + const FLAC__int32 residual[], + const unsigned residual_samples, + const unsigned predictor_order, + const unsigned suggested_rice_parameter, + const unsigned rice_parameter_search_dist, + const unsigned partition_order, + FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents, + unsigned *bits +) +#else +FLAC__bool set_partitioned_rice_( + const FLAC__uint32 abs_residual[], + const unsigned residual_samples, + const unsigned predictor_order, + const unsigned suggested_rice_parameter, + const unsigned rice_parameter_search_dist, + const unsigned partition_order, + FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents, + unsigned *bits +) +#endif +{ + unsigned rice_parameter, partition_bits; +#ifndef NO_RICE_SEARCH + unsigned best_partition_bits; + unsigned min_rice_parameter, max_rice_parameter, best_rice_parameter = 0; +#endif + unsigned bits_ = FLAC__ENTROPY_CODING_METHOD_TYPE_LEN + FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ORDER_LEN; + unsigned *parameters; + + FLAC__ASSERT(suggested_rice_parameter < FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER); + + FLAC__format_entropy_coding_method_partitioned_rice_contents_ensure_size(partitioned_rice_contents, max(6, partition_order)); + parameters = partitioned_rice_contents->parameters; + + if(partition_order == 0) { + unsigned i; + +#ifndef NO_RICE_SEARCH + if(rice_parameter_search_dist) { + if(suggested_rice_parameter < rice_parameter_search_dist) + min_rice_parameter = 0; + else + min_rice_parameter = suggested_rice_parameter - rice_parameter_search_dist; + max_rice_parameter = suggested_rice_parameter + rice_parameter_search_dist; + if(max_rice_parameter >= FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER) { +#ifdef DEBUG_VERBOSE + fprintf(stderr, "clipping rice_parameter (%u -> %u) @2\n", max_rice_parameter, FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER - 1); +#endif + max_rice_parameter = FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER - 1; + } + } + else + min_rice_parameter = max_rice_parameter = suggested_rice_parameter; + + best_partition_bits = 0xffffffff; + for(rice_parameter = min_rice_parameter; rice_parameter <= max_rice_parameter; rice_parameter++) { +#endif +#ifdef VARIABLE_RICE_BITS +#ifdef FLAC__SYMMETRIC_RICE + partition_bits = (2+rice_parameter) * residual_samples; +#else + const unsigned rice_parameter_estimate = rice_parameter-1; + partition_bits = (1+rice_parameter) * residual_samples; +#endif +#else + partition_bits = 0; +#endif + partition_bits += FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN; + for(i = 0; i < residual_samples; i++) { +#ifdef VARIABLE_RICE_BITS +#ifdef FLAC__SYMMETRIC_RICE + partition_bits += VARIABLE_RICE_BITS(abs_residual[i], rice_parameter); +#else + partition_bits += VARIABLE_RICE_BITS(abs_residual[i], rice_parameter_estimate); +#endif +#else + partition_bits += FLAC__bitbuffer_rice_bits(residual[i], rice_parameter); /* NOTE: we will need to pass in residual[] in addition to abs_residual[] */ +#endif + } +#ifndef NO_RICE_SEARCH + if(partition_bits < best_partition_bits) { + best_rice_parameter = rice_parameter; + best_partition_bits = partition_bits; + } + } +#endif + parameters[0] = best_rice_parameter; + bits_ += best_partition_bits; + } + else { + unsigned partition, residual_sample, save_residual_sample, partition_sample; + unsigned partition_samples; + FLAC__uint64 mean, k; + const unsigned partitions = 1u << partition_order; + for(partition = residual_sample = 0; partition < partitions; partition++) { + partition_samples = (residual_samples+predictor_order) >> partition_order; + if(partition == 0) { + if(partition_samples <= predictor_order) + return false; + else + partition_samples -= predictor_order; + } + mean = 0; + save_residual_sample = residual_sample; + for(partition_sample = 0; partition_sample < partition_samples; residual_sample++, partition_sample++) + mean += abs_residual[residual_sample]; + residual_sample = save_residual_sample; +#ifdef FLAC__SYMMETRIC_RICE + mean += partition_samples >> 1; /* for rounding effect */ + mean /= partition_samples; + + /* calc rice_parameter = floor(log2(mean)) */ + rice_parameter = 0; + mean>>=1; + while(mean) { + rice_parameter++; + mean >>= 1; + } +#else + /* we are basically calculating the size in bits of the + * average residual magnitude in the partition: + * rice_parameter = floor(log2(mean/partition_samples)) + * 'mean' is not a good name for the variable, it is + * actually the sum of magnitudes of all residual values + * in the partition, so the actual mean is + * mean/partition_samples + */ + for(rice_parameter = 0, k = partition_samples; k < mean; rice_parameter++, k <<= 1) + ; +#endif + if(rice_parameter >= FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER) { +#ifdef DEBUG_VERBOSE + fprintf(stderr, "clipping rice_parameter (%u -> %u) @3\n", rice_parameter, FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER - 1); +#endif + rice_parameter = FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER - 1; + } + +#ifndef NO_RICE_SEARCH + if(rice_parameter_search_dist) { + if(rice_parameter < rice_parameter_search_dist) + min_rice_parameter = 0; + else + min_rice_parameter = rice_parameter - rice_parameter_search_dist; + max_rice_parameter = rice_parameter + rice_parameter_search_dist; + if(max_rice_parameter >= FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER) { +#ifdef DEBUG_VERBOSE + fprintf(stderr, "clipping rice_parameter (%u -> %u) @4\n", max_rice_parameter, FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER - 1); +#endif + max_rice_parameter = FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER - 1; + } + } + else + min_rice_parameter = max_rice_parameter = rice_parameter; + + best_partition_bits = 0xffffffff; + for(rice_parameter = min_rice_parameter; rice_parameter <= max_rice_parameter; rice_parameter++) { +#endif +#ifdef VARIABLE_RICE_BITS +#ifdef FLAC__SYMMETRIC_RICE + partition_bits = (2+rice_parameter) * partition_samples; +#else + const unsigned rice_parameter_estimate = rice_parameter-1; + partition_bits = (1+rice_parameter) * partition_samples; +#endif +#else + partition_bits = 0; +#endif + partition_bits += FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN; + save_residual_sample = residual_sample; + for(partition_sample = 0; partition_sample < partition_samples; residual_sample++, partition_sample++) { +#ifdef VARIABLE_RICE_BITS +#ifdef FLAC__SYMMETRIC_RICE + partition_bits += VARIABLE_RICE_BITS(abs_residual[residual_sample], rice_parameter); +#else + partition_bits += VARIABLE_RICE_BITS(abs_residual[residual_sample], rice_parameter_estimate); +#endif +#else + partition_bits += FLAC__bitbuffer_rice_bits(residual[residual_sample], rice_parameter); /* NOTE: we will need to pass in residual[] in addition to abs_residual[] */ +#endif + } +#ifndef NO_RICE_SEARCH + if(rice_parameter != max_rice_parameter) + residual_sample = save_residual_sample; + if(partition_bits < best_partition_bits) { + best_rice_parameter = rice_parameter; + best_partition_bits = partition_bits; + } + } +#endif + parameters[partition] = best_rice_parameter; + bits_ += best_partition_bits; + } + } + + *bits = bits_; + return true; +} + +#ifdef DONT_ESTIMATE_RICE_BITS +FLAC__bool set_partitioned_rice_with_precompute_( + const FLAC__int32 residual[], + const FLAC__uint64 abs_residual_partition_sums[], + const unsigned raw_bits_per_partition[], + const unsigned residual_samples, + const unsigned predictor_order, + const unsigned suggested_rice_parameter, + const unsigned rice_parameter_search_dist, + const unsigned partition_order, + const FLAC__bool search_for_escapes, + FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents, + unsigned *bits +) +#else +FLAC__bool set_partitioned_rice_with_precompute_( + const FLAC__uint32 abs_residual[], + const FLAC__uint64 abs_residual_partition_sums[], + const unsigned raw_bits_per_partition[], + const unsigned residual_samples, + const unsigned predictor_order, + const unsigned suggested_rice_parameter, + const unsigned rice_parameter_search_dist, + const unsigned partition_order, + const FLAC__bool search_for_escapes, + FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents, + unsigned *bits +) +#endif +{ + unsigned rice_parameter, partition_bits; +#ifndef NO_RICE_SEARCH + unsigned best_partition_bits; + unsigned min_rice_parameter, max_rice_parameter, best_rice_parameter = 0; +#endif + unsigned flat_bits; + unsigned bits_ = FLAC__ENTROPY_CODING_METHOD_TYPE_LEN + FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ORDER_LEN; + unsigned *parameters, *raw_bits; + + FLAC__ASSERT(suggested_rice_parameter < FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER); + + FLAC__format_entropy_coding_method_partitioned_rice_contents_ensure_size(partitioned_rice_contents, max(6, partition_order)); + parameters = partitioned_rice_contents->parameters; + raw_bits = partitioned_rice_contents->raw_bits; + + if(partition_order == 0) { + unsigned i; + +#ifndef NO_RICE_SEARCH + if(rice_parameter_search_dist) { + if(suggested_rice_parameter < rice_parameter_search_dist) + min_rice_parameter = 0; + else + min_rice_parameter = suggested_rice_parameter - rice_parameter_search_dist; + max_rice_parameter = suggested_rice_parameter + rice_parameter_search_dist; + if(max_rice_parameter >= FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER) { +#ifdef DEBUG_VERBOSE + fprintf(stderr, "clipping rice_parameter (%u -> %u) @5\n", max_rice_parameter, FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER - 1); +#endif + max_rice_parameter = FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER - 1; + } + } + else + min_rice_parameter = max_rice_parameter = suggested_rice_parameter; + + best_partition_bits = 0xffffffff; + for(rice_parameter = min_rice_parameter; rice_parameter <= max_rice_parameter; rice_parameter++) { +#endif +#ifdef VARIABLE_RICE_BITS +#ifdef FLAC__SYMMETRIC_RICE + partition_bits = (2+rice_parameter) * residual_samples; +#else + const unsigned rice_parameter_estimate = rice_parameter-1; + partition_bits = (1+rice_parameter) * residual_samples; +#endif +#else + partition_bits = 0; +#endif + partition_bits += FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN; + for(i = 0; i < residual_samples; i++) { +#ifdef VARIABLE_RICE_BITS +#ifdef FLAC__SYMMETRIC_RICE + partition_bits += VARIABLE_RICE_BITS(abs_residual[i], rice_parameter); +#else + partition_bits += VARIABLE_RICE_BITS(abs_residual[i], rice_parameter_estimate); +#endif +#else + partition_bits += FLAC__bitbuffer_rice_bits(residual[i], rice_parameter); /* NOTE: we will need to pass in residual[] instead of abs_residual[] */ +#endif + } +#ifndef NO_RICE_SEARCH + if(partition_bits < best_partition_bits) { + best_rice_parameter = rice_parameter; + best_partition_bits = partition_bits; + } + } +#endif + if(search_for_escapes) { + flat_bits = FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN + FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_RAW_LEN + raw_bits_per_partition[0] * residual_samples; + if(flat_bits <= best_partition_bits) { + raw_bits[0] = raw_bits_per_partition[0]; + best_rice_parameter = FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER; + best_partition_bits = flat_bits; + } + } + parameters[0] = best_rice_parameter; + bits_ += best_partition_bits; + } + else { + unsigned partition, residual_sample, save_residual_sample, partition_sample; + unsigned partition_samples; + FLAC__uint64 mean, k; + const unsigned partitions = 1u << partition_order; + for(partition = residual_sample = 0; partition < partitions; partition++) { + partition_samples = (residual_samples+predictor_order) >> partition_order; + if(partition == 0) { + if(partition_samples <= predictor_order) + return false; + else + partition_samples -= predictor_order; + } + mean = abs_residual_partition_sums[partition]; +#ifdef FLAC__SYMMETRIC_RICE + mean += partition_samples >> 1; /* for rounding effect */ + mean /= partition_samples; + + /* calc rice_parameter = floor(log2(mean)) */ + rice_parameter = 0; + mean>>=1; + while(mean) { + rice_parameter++; + mean >>= 1; + } +#else + /* we are basically calculating the size in bits of the + * average residual magnitude in the partition: + * rice_parameter = floor(log2(mean/partition_samples)) + * 'mean' is not a good name for the variable, it is + * actually the sum of magnitudes of all residual values + * in the partition, so the actual mean is + * mean/partition_samples + */ + for(rice_parameter = 0, k = partition_samples; k < mean; rice_parameter++, k <<= 1) + ; +#endif + if(rice_parameter >= FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER) { +#ifdef DEBUG_VERBOSE + fprintf(stderr, "clipping rice_parameter (%u -> %u) @6\n", rice_parameter, FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER - 1); +#endif + rice_parameter = FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER - 1; + } + +#ifndef NO_RICE_SEARCH + if(rice_parameter_search_dist) { + if(rice_parameter < rice_parameter_search_dist) + min_rice_parameter = 0; + else + min_rice_parameter = rice_parameter - rice_parameter_search_dist; + max_rice_parameter = rice_parameter + rice_parameter_search_dist; + if(max_rice_parameter >= FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER) { +#ifdef DEBUG_VERBOSE + fprintf(stderr, "clipping rice_parameter (%u -> %u) @7\n", max_rice_parameter, FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER - 1); +#endif + max_rice_parameter = FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER - 1; + } + } + else + min_rice_parameter = max_rice_parameter = rice_parameter; + + best_partition_bits = 0xffffffff; + for(rice_parameter = min_rice_parameter; rice_parameter <= max_rice_parameter; rice_parameter++) { +#endif +#ifdef VARIABLE_RICE_BITS +#ifdef FLAC__SYMMETRIC_RICE + partition_bits = (2+rice_parameter) * partition_samples; +#else + const unsigned rice_parameter_estimate = rice_parameter-1; + partition_bits = (1+rice_parameter) * partition_samples; +#endif +#else + partition_bits = 0; +#endif + partition_bits += FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN; + save_residual_sample = residual_sample; + for(partition_sample = 0; partition_sample < partition_samples; residual_sample++, partition_sample++) { +#ifdef VARIABLE_RICE_BITS +#ifdef FLAC__SYMMETRIC_RICE + partition_bits += VARIABLE_RICE_BITS(abs_residual[residual_sample], rice_parameter); +#else + partition_bits += VARIABLE_RICE_BITS(abs_residual[residual_sample], rice_parameter_estimate); +#endif +#else + partition_bits += FLAC__bitbuffer_rice_bits(residual[residual_sample], rice_parameter); /* NOTE: we will need to pass in residual[] instead of abs_residual[] */ +#endif + } +#ifndef NO_RICE_SEARCH + if(rice_parameter != max_rice_parameter) + residual_sample = save_residual_sample; + if(partition_bits < best_partition_bits) { + best_rice_parameter = rice_parameter; + best_partition_bits = partition_bits; + } + } +#endif + if(search_for_escapes) { + flat_bits = FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN + FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_RAW_LEN + raw_bits_per_partition[partition] * partition_samples; + if(flat_bits <= best_partition_bits) { + raw_bits[partition] = raw_bits_per_partition[partition]; + best_rice_parameter = FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER; + best_partition_bits = flat_bits; + } + } + parameters[partition] = best_rice_parameter; + bits_ += best_partition_bits; + } + } + + *bits = bits_; + return true; +} + +unsigned get_wasted_bits_(FLAC__int32 signal[], unsigned samples) +{ + unsigned i, shift; + FLAC__int32 x = 0; + + for(i = 0; i < samples && !(x&1); i++) + x |= signal[i]; + + if(x == 0) { + shift = 0; + } + else { + for(shift = 0; !(x&1); shift++) + x >>= 1; + } + + if(shift > 0) { + for(i = 0; i < samples; i++) + signal[i] >>= shift; + } + + return shift; +} + +void append_to_verify_fifo_(verify_input_fifo *fifo, const FLAC__int32 * const input[], unsigned input_offset, unsigned channels, unsigned wide_samples) +{ + unsigned channel; + + for(channel = 0; channel < channels; channel++) + memcpy(&fifo->data[channel][fifo->tail], &input[channel][input_offset], sizeof(FLAC__int32) * wide_samples); + + fifo->tail += wide_samples; + + FLAC__ASSERT(fifo->tail <= fifo->size); +} + +void append_to_verify_fifo_interleaved_(verify_input_fifo *fifo, const FLAC__int32 input[], unsigned input_offset, unsigned channels, unsigned wide_samples) +{ + unsigned channel; + unsigned sample, wide_sample; + unsigned tail = fifo->tail; + + sample = input_offset * channels; + for(wide_sample = 0; wide_sample < wide_samples; wide_sample++) { + for(channel = 0; channel < channels; channel++) + fifo->data[channel][tail] = input[sample++]; + tail++; + } + fifo->tail = tail; + + FLAC__ASSERT(fifo->tail <= fifo->size); +} + +FLAC__StreamDecoderReadStatus verify_read_callback_(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], unsigned *bytes, void *client_data) +{ + FLAC__StreamEncoder *encoder = (FLAC__StreamEncoder*)client_data; + const unsigned encoded_bytes = encoder->private_->verify.output.bytes; + (void)decoder; + + if(encoder->private_->verify.needs_magic_hack) { + FLAC__ASSERT(*bytes >= FLAC__STREAM_SYNC_LENGTH); + *bytes = FLAC__STREAM_SYNC_LENGTH; + memcpy(buffer, FLAC__STREAM_SYNC_STRING, *bytes); + encoder->private_->verify.needs_magic_hack = false; + } + else { + if(encoded_bytes == 0) { + /* + * If we get here, a FIFO underflow has occurred, + * which means there is a bug somewhere. + */ + FLAC__ASSERT(0); + return FLAC__STREAM_DECODER_READ_STATUS_ABORT; + } + else if(encoded_bytes < *bytes) + *bytes = encoded_bytes; + memcpy(buffer, encoder->private_->verify.output.data, *bytes); + encoder->private_->verify.output.data += *bytes; + encoder->private_->verify.output.bytes -= *bytes; + } + + return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE; +} + +FLAC__StreamDecoderWriteStatus verify_write_callback_(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data) +{ + FLAC__StreamEncoder *encoder = (FLAC__StreamEncoder *)client_data; + unsigned channel; + const unsigned channels = FLAC__stream_decoder_get_channels(decoder); + const unsigned blocksize = frame->header.blocksize; + const unsigned bytes_per_block = sizeof(FLAC__int32) * blocksize; + + for(channel = 0; channel < channels; channel++) { + if(0 != memcmp(buffer[channel], encoder->private_->verify.input_fifo.data[channel], bytes_per_block)) { + unsigned i, sample = 0; + FLAC__int32 expect = 0, got = 0; + + for(i = 0; i < blocksize; i++) { + if(buffer[channel][i] != encoder->private_->verify.input_fifo.data[channel][i]) { + sample = i; + expect = (FLAC__int32)encoder->private_->verify.input_fifo.data[channel][i]; + got = (FLAC__int32)buffer[channel][i]; + break; + } + } + FLAC__ASSERT(i < blocksize); + FLAC__ASSERT(frame->header.number_type == FLAC__FRAME_NUMBER_TYPE_SAMPLE_NUMBER); + encoder->private_->verify.error_stats.absolute_sample = frame->header.number.sample_number + sample; + encoder->private_->verify.error_stats.frame_number = (unsigned)(frame->header.number.sample_number / blocksize); + encoder->private_->verify.error_stats.channel = channel; + encoder->private_->verify.error_stats.sample = sample; + encoder->private_->verify.error_stats.expected = expect; + encoder->private_->verify.error_stats.got = got; + encoder->protected_->state = FLAC__STREAM_ENCODER_VERIFY_MISMATCH_IN_AUDIO_DATA; + return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT; + } + } + /* dequeue the frame from the fifo */ + for(channel = 0; channel < channels; channel++) { + memmove(&encoder->private_->verify.input_fifo.data[channel][0], &encoder->private_->verify.input_fifo.data[channel][blocksize], encoder->private_->verify.input_fifo.tail - blocksize); + } + encoder->private_->verify.input_fifo.tail -= blocksize; + return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE; +} + +void verify_metadata_callback_(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data) +{ + (void)decoder, (void)metadata, (void)client_data; +} + +void verify_error_callback_(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data) +{ + FLAC__StreamEncoder *encoder = (FLAC__StreamEncoder*)client_data; + (void)decoder, (void)status; + encoder->protected_->state = FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR; +} diff --git a/Libraries/FLAC/Files/src/libFLAC/stream_encoder_framing.c b/Libraries/FLAC/Files/src/libFLAC/stream_encoder_framing.c new file mode 100644 index 000000000..36bf95245 --- /dev/null +++ b/Libraries/FLAC/Files/src/libFLAC/stream_encoder_framing.c @@ -0,0 +1,499 @@ +/* libFLAC - Free Lossless Audio Codec library + * Copyright (C) 2000,2001,2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include /* for strlen() */ +#include "private/stream_encoder_framing.h" +#include "private/crc.h" +#include "FLAC/assert.h" + +#ifdef max +#undef max +#endif +#define max(x,y) ((x)>(y)?(x):(y)) + +static FLAC__bool add_entropy_coding_method_(FLAC__BitBuffer *bb, const FLAC__EntropyCodingMethod *method); +static FLAC__bool add_residual_partitioned_rice_(FLAC__BitBuffer *bb, const FLAC__int32 residual[], const unsigned residual_samples, const unsigned predictor_order, const unsigned rice_parameters[], const unsigned raw_bits[], const unsigned partition_order); + +FLAC__bool FLAC__add_metadata_block(const FLAC__StreamMetadata *metadata, FLAC__BitBuffer *bb) +{ + unsigned i, j; + const unsigned vendor_string_length = (unsigned)strlen(FLAC__VENDOR_STRING); + + if(!FLAC__bitbuffer_write_raw_uint32(bb, metadata->is_last, FLAC__STREAM_METADATA_IS_LAST_LEN)) + return false; + + if(!FLAC__bitbuffer_write_raw_uint32(bb, metadata->type, FLAC__STREAM_METADATA_TYPE_LEN)) + return false; + + /* + * First, for VORBIS_COMMENTs, adjust the length to reflect our vendor string + */ + i = metadata->length; + if(metadata->type == FLAC__METADATA_TYPE_VORBIS_COMMENT) { + FLAC__ASSERT(metadata->data.vorbis_comment.vendor_string.length == 0 || 0 != metadata->data.vorbis_comment.vendor_string.entry); + i -= metadata->data.vorbis_comment.vendor_string.length; + i += vendor_string_length; + } + FLAC__ASSERT(i < (1u << FLAC__STREAM_METADATA_LENGTH_LEN)); + if(!FLAC__bitbuffer_write_raw_uint32(bb, i, FLAC__STREAM_METADATA_LENGTH_LEN)) + return false; + + switch(metadata->type) { + case FLAC__METADATA_TYPE_STREAMINFO: + FLAC__ASSERT(metadata->data.stream_info.min_blocksize < (1u << FLAC__STREAM_METADATA_STREAMINFO_MIN_BLOCK_SIZE_LEN)); + if(!FLAC__bitbuffer_write_raw_uint32(bb, metadata->data.stream_info.min_blocksize, FLAC__STREAM_METADATA_STREAMINFO_MIN_BLOCK_SIZE_LEN)) + return false; + FLAC__ASSERT(metadata->data.stream_info.max_blocksize < (1u << FLAC__STREAM_METADATA_STREAMINFO_MAX_BLOCK_SIZE_LEN)); + if(!FLAC__bitbuffer_write_raw_uint32(bb, metadata->data.stream_info.max_blocksize, FLAC__STREAM_METADATA_STREAMINFO_MAX_BLOCK_SIZE_LEN)) + return false; + FLAC__ASSERT(metadata->data.stream_info.min_framesize < (1u << FLAC__STREAM_METADATA_STREAMINFO_MIN_FRAME_SIZE_LEN)); + if(!FLAC__bitbuffer_write_raw_uint32(bb, metadata->data.stream_info.min_framesize, FLAC__STREAM_METADATA_STREAMINFO_MIN_FRAME_SIZE_LEN)) + return false; + FLAC__ASSERT(metadata->data.stream_info.max_framesize < (1u << FLAC__STREAM_METADATA_STREAMINFO_MAX_FRAME_SIZE_LEN)); + if(!FLAC__bitbuffer_write_raw_uint32(bb, metadata->data.stream_info.max_framesize, FLAC__STREAM_METADATA_STREAMINFO_MAX_FRAME_SIZE_LEN)) + return false; + FLAC__ASSERT(FLAC__format_sample_rate_is_valid(metadata->data.stream_info.sample_rate)); + if(!FLAC__bitbuffer_write_raw_uint32(bb, metadata->data.stream_info.sample_rate, FLAC__STREAM_METADATA_STREAMINFO_SAMPLE_RATE_LEN)) + return false; + FLAC__ASSERT(metadata->data.stream_info.channels > 0); + FLAC__ASSERT(metadata->data.stream_info.channels <= (1u << FLAC__STREAM_METADATA_STREAMINFO_CHANNELS_LEN)); + if(!FLAC__bitbuffer_write_raw_uint32(bb, metadata->data.stream_info.channels-1, FLAC__STREAM_METADATA_STREAMINFO_CHANNELS_LEN)) + return false; + FLAC__ASSERT(metadata->data.stream_info.bits_per_sample > 0); + FLAC__ASSERT(metadata->data.stream_info.bits_per_sample <= (1u << FLAC__STREAM_METADATA_STREAMINFO_BITS_PER_SAMPLE_LEN)); + if(!FLAC__bitbuffer_write_raw_uint32(bb, metadata->data.stream_info.bits_per_sample-1, FLAC__STREAM_METADATA_STREAMINFO_BITS_PER_SAMPLE_LEN)) + return false; + if(!FLAC__bitbuffer_write_raw_uint64(bb, metadata->data.stream_info.total_samples, FLAC__STREAM_METADATA_STREAMINFO_TOTAL_SAMPLES_LEN)) + return false; + if(!FLAC__bitbuffer_write_byte_block(bb, metadata->data.stream_info.md5sum, 16)) + return false; + break; + case FLAC__METADATA_TYPE_PADDING: + if(!FLAC__bitbuffer_write_zeroes(bb, metadata->length * 8)) + return false; + break; + case FLAC__METADATA_TYPE_APPLICATION: + if(!FLAC__bitbuffer_write_byte_block(bb, metadata->data.application.id, FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8)) + return false; + if(!FLAC__bitbuffer_write_byte_block(bb, metadata->data.application.data, metadata->length - (FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8))) + return false; + break; + case FLAC__METADATA_TYPE_SEEKTABLE: + for(i = 0; i < metadata->data.seek_table.num_points; i++) { + if(!FLAC__bitbuffer_write_raw_uint64(bb, metadata->data.seek_table.points[i].sample_number, FLAC__STREAM_METADATA_SEEKPOINT_SAMPLE_NUMBER_LEN)) + return false; + if(!FLAC__bitbuffer_write_raw_uint64(bb, metadata->data.seek_table.points[i].stream_offset, FLAC__STREAM_METADATA_SEEKPOINT_STREAM_OFFSET_LEN)) + return false; + if(!FLAC__bitbuffer_write_raw_uint32(bb, metadata->data.seek_table.points[i].frame_samples, FLAC__STREAM_METADATA_SEEKPOINT_FRAME_SAMPLES_LEN)) + return false; + } + break; + case FLAC__METADATA_TYPE_VORBIS_COMMENT: + if(!FLAC__bitbuffer_write_raw_uint32_little_endian(bb, vendor_string_length)) + return false; + if(!FLAC__bitbuffer_write_byte_block(bb, (const FLAC__byte*)FLAC__VENDOR_STRING, vendor_string_length)) + return false; + if(!FLAC__bitbuffer_write_raw_uint32_little_endian(bb, metadata->data.vorbis_comment.num_comments)) + return false; + for(i = 0; i < metadata->data.vorbis_comment.num_comments; i++) { + if(!FLAC__bitbuffer_write_raw_uint32_little_endian(bb, metadata->data.vorbis_comment.comments[i].length)) + return false; + if(!FLAC__bitbuffer_write_byte_block(bb, metadata->data.vorbis_comment.comments[i].entry, metadata->data.vorbis_comment.comments[i].length)) + return false; + } + break; + case FLAC__METADATA_TYPE_CUESHEET: + FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_MEDIA_CATALOG_NUMBER_LEN % 8 == 0); + if(!FLAC__bitbuffer_write_byte_block(bb, (const FLAC__byte*)metadata->data.cue_sheet.media_catalog_number, FLAC__STREAM_METADATA_CUESHEET_MEDIA_CATALOG_NUMBER_LEN/8)) + return false; + if(!FLAC__bitbuffer_write_raw_uint64(bb, metadata->data.cue_sheet.lead_in, FLAC__STREAM_METADATA_CUESHEET_LEAD_IN_LEN)) + return false; + if(!FLAC__bitbuffer_write_raw_uint32(bb, metadata->data.cue_sheet.is_cd? 1 : 0, FLAC__STREAM_METADATA_CUESHEET_IS_CD_LEN)) + return false; + if(!FLAC__bitbuffer_write_zeroes(bb, FLAC__STREAM_METADATA_CUESHEET_RESERVED_LEN)) + return false; + if(!FLAC__bitbuffer_write_raw_uint32(bb, metadata->data.cue_sheet.num_tracks, FLAC__STREAM_METADATA_CUESHEET_NUM_TRACKS_LEN)) + return false; + for(i = 0; i < metadata->data.cue_sheet.num_tracks; i++) { + const FLAC__StreamMetadata_CueSheet_Track *track = metadata->data.cue_sheet.tracks + i; + + if(!FLAC__bitbuffer_write_raw_uint64(bb, track->offset, FLAC__STREAM_METADATA_CUESHEET_TRACK_OFFSET_LEN)) + return false; + if(!FLAC__bitbuffer_write_raw_uint32(bb, track->number, FLAC__STREAM_METADATA_CUESHEET_TRACK_NUMBER_LEN)) + return false; + FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_TRACK_ISRC_LEN % 8 == 0); + if(!FLAC__bitbuffer_write_byte_block(bb, (const FLAC__byte*)track->isrc, FLAC__STREAM_METADATA_CUESHEET_TRACK_ISRC_LEN/8)) + return false; + if(!FLAC__bitbuffer_write_raw_uint32(bb, track->type, FLAC__STREAM_METADATA_CUESHEET_TRACK_TYPE_LEN)) + return false; + if(!FLAC__bitbuffer_write_raw_uint32(bb, track->pre_emphasis, FLAC__STREAM_METADATA_CUESHEET_TRACK_PRE_EMPHASIS_LEN)) + return false; + if(!FLAC__bitbuffer_write_zeroes(bb, FLAC__STREAM_METADATA_CUESHEET_TRACK_RESERVED_LEN)) + return false; + if(!FLAC__bitbuffer_write_raw_uint32(bb, track->num_indices, FLAC__STREAM_METADATA_CUESHEET_TRACK_NUM_INDICES_LEN)) + return false; + for(j = 0; j < track->num_indices; j++) { + const FLAC__StreamMetadata_CueSheet_Index *index = track->indices + j; + + if(!FLAC__bitbuffer_write_raw_uint64(bb, index->offset, FLAC__STREAM_METADATA_CUESHEET_INDEX_OFFSET_LEN)) + return false; + if(!FLAC__bitbuffer_write_raw_uint32(bb, index->number, FLAC__STREAM_METADATA_CUESHEET_INDEX_NUMBER_LEN)) + return false; + if(!FLAC__bitbuffer_write_zeroes(bb, FLAC__STREAM_METADATA_CUESHEET_INDEX_RESERVED_LEN)) + return false; + } + } + break; + default: + if(!FLAC__bitbuffer_write_byte_block(bb, metadata->data.unknown.data, metadata->length)) + return false; + break; + } + + FLAC__ASSERT(FLAC__bitbuffer_is_byte_aligned(bb)); + return true; +} + +FLAC__bool FLAC__frame_add_header(const FLAC__FrameHeader *header, FLAC__bool streamable_subset, FLAC__BitBuffer *bb) +{ + unsigned u, blocksize_hint, sample_rate_hint; + + FLAC__ASSERT(FLAC__bitbuffer_is_byte_aligned(bb)); + + if(!FLAC__bitbuffer_write_raw_uint32(bb, FLAC__FRAME_HEADER_SYNC, FLAC__FRAME_HEADER_SYNC_LEN)) + return false; + + if(!FLAC__bitbuffer_write_raw_uint32(bb, 0, FLAC__FRAME_HEADER_RESERVED_LEN)) + return false; + + FLAC__ASSERT(header->blocksize > 0 && header->blocksize <= FLAC__MAX_BLOCK_SIZE); + /* when this assertion holds true, any legal blocksize can be expressed in the frame header */ + FLAC__ASSERT(FLAC__MAX_BLOCK_SIZE <= 65535u); + blocksize_hint = 0; + switch(header->blocksize) { + case 192: u = 1; break; + case 576: u = 2; break; + case 1152: u = 3; break; + case 2304: u = 4; break; + case 4608: u = 5; break; + case 256: u = 8; break; + case 512: u = 9; break; + case 1024: u = 10; break; + case 2048: u = 11; break; + case 4096: u = 12; break; + case 8192: u = 13; break; + case 16384: u = 14; break; + case 32768: u = 15; break; + default: + if(header->blocksize <= 0x100) + blocksize_hint = u = 6; + else if(header->blocksize <= 0x10000) + blocksize_hint = u = 7; + else { + FLAC__ASSERT(0); + return false; + } + break; + } + if(!FLAC__bitbuffer_write_raw_uint32(bb, u, FLAC__FRAME_HEADER_BLOCK_SIZE_LEN)) + return false; + + FLAC__ASSERT(FLAC__format_sample_rate_is_valid(header->sample_rate)); + sample_rate_hint = 0; + switch(header->sample_rate) { + case 8000: u = 4; break; + case 16000: u = 5; break; + case 22050: u = 6; break; + case 24000: u = 7; break; + case 32000: u = 8; break; + case 44100: u = 9; break; + case 48000: u = 10; break; + case 96000: u = 11; break; + default: + if(header->sample_rate <= 255000 && header->sample_rate % 1000 == 0) + sample_rate_hint = u = 12; + else if(header->sample_rate % 10 == 0) + sample_rate_hint = u = 14; + else if(header->sample_rate <= 0xffff) + sample_rate_hint = u = 13; + else if(streamable_subset) { + FLAC__ASSERT(0); + return false; + } + else + u = 0; + break; + } + if(!FLAC__bitbuffer_write_raw_uint32(bb, u, FLAC__FRAME_HEADER_SAMPLE_RATE_LEN)) + return false; + + FLAC__ASSERT(header->channels > 0 && header->channels <= (1u << FLAC__STREAM_METADATA_STREAMINFO_CHANNELS_LEN) && header->channels <= FLAC__MAX_CHANNELS); + switch(header->channel_assignment) { + case FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT: + u = header->channels - 1; + break; + case FLAC__CHANNEL_ASSIGNMENT_LEFT_SIDE: + FLAC__ASSERT(header->channels == 2); + u = 8; + break; + case FLAC__CHANNEL_ASSIGNMENT_RIGHT_SIDE: + FLAC__ASSERT(header->channels == 2); + u = 9; + break; + case FLAC__CHANNEL_ASSIGNMENT_MID_SIDE: + FLAC__ASSERT(header->channels == 2); + u = 10; + break; + default: + FLAC__ASSERT(0); + } + if(!FLAC__bitbuffer_write_raw_uint32(bb, u, FLAC__FRAME_HEADER_CHANNEL_ASSIGNMENT_LEN)) + return false; + + FLAC__ASSERT(header->bits_per_sample > 0 && header->bits_per_sample <= (1u << FLAC__STREAM_METADATA_STREAMINFO_BITS_PER_SAMPLE_LEN)); + switch(header->bits_per_sample) { + case 8 : u = 1; break; + case 12: u = 2; break; + case 16: u = 4; break; + case 20: u = 5; break; + case 24: u = 6; break; + default: u = 0; break; + } + if(!FLAC__bitbuffer_write_raw_uint32(bb, u, FLAC__FRAME_HEADER_BITS_PER_SAMPLE_LEN)) + return false; + + if(!FLAC__bitbuffer_write_raw_uint32(bb, 0, FLAC__FRAME_HEADER_ZERO_PAD_LEN)) + return false; + + FLAC__ASSERT(header->number_type == FLAC__FRAME_NUMBER_TYPE_FRAME_NUMBER); + if(!FLAC__bitbuffer_write_utf8_uint32(bb, header->number.frame_number)) + return false; + + if(blocksize_hint) + if(!FLAC__bitbuffer_write_raw_uint32(bb, header->blocksize-1, (blocksize_hint==6)? 8:16)) + return false; + + switch(sample_rate_hint) { + case 12: + if(!FLAC__bitbuffer_write_raw_uint32(bb, header->sample_rate / 1000, 8)) + return false; + break; + case 13: + if(!FLAC__bitbuffer_write_raw_uint32(bb, header->sample_rate, 16)) + return false; + break; + case 14: + if(!FLAC__bitbuffer_write_raw_uint32(bb, header->sample_rate / 10, 16)) + return false; + break; + } + + /* write the CRC */ + if(!FLAC__bitbuffer_write_raw_uint32(bb, FLAC__bitbuffer_get_write_crc8(bb), FLAC__FRAME_HEADER_CRC_LEN)) + return false; + + return true; +} + +FLAC__bool FLAC__subframe_add_constant(const FLAC__Subframe_Constant *subframe, unsigned subframe_bps, unsigned wasted_bits, FLAC__BitBuffer *bb) +{ + FLAC__bool ok; + + ok = + FLAC__bitbuffer_write_raw_uint32(bb, FLAC__SUBFRAME_TYPE_CONSTANT_BYTE_ALIGNED_MASK | (wasted_bits? 1:0), FLAC__SUBFRAME_ZERO_PAD_LEN + FLAC__SUBFRAME_TYPE_LEN + FLAC__SUBFRAME_WASTED_BITS_FLAG_LEN) && + (wasted_bits? FLAC__bitbuffer_write_unary_unsigned(bb, wasted_bits-1) : true) && + FLAC__bitbuffer_write_raw_int32(bb, subframe->value, subframe_bps) + ; + + return ok; +} + +FLAC__bool FLAC__subframe_add_fixed(const FLAC__Subframe_Fixed *subframe, unsigned residual_samples, unsigned subframe_bps, unsigned wasted_bits, FLAC__BitBuffer *bb) +{ + unsigned i; + + if(!FLAC__bitbuffer_write_raw_uint32(bb, FLAC__SUBFRAME_TYPE_FIXED_BYTE_ALIGNED_MASK | (subframe->order<<1) | (wasted_bits? 1:0), FLAC__SUBFRAME_ZERO_PAD_LEN + FLAC__SUBFRAME_TYPE_LEN + FLAC__SUBFRAME_WASTED_BITS_FLAG_LEN)) + return false; + if(wasted_bits) + if(!FLAC__bitbuffer_write_unary_unsigned(bb, wasted_bits-1)) + return false; + + for(i = 0; i < subframe->order; i++) + if(!FLAC__bitbuffer_write_raw_int32(bb, subframe->warmup[i], subframe_bps)) + return false; + + if(!add_entropy_coding_method_(bb, &subframe->entropy_coding_method)) + return false; + switch(subframe->entropy_coding_method.type) { + case FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE: + if(!add_residual_partitioned_rice_(bb, subframe->residual, residual_samples, subframe->order, subframe->entropy_coding_method.data.partitioned_rice.contents->parameters, subframe->entropy_coding_method.data.partitioned_rice.contents->raw_bits, subframe->entropy_coding_method.data.partitioned_rice.order)) + return false; + break; + default: + FLAC__ASSERT(0); + } + + return true; +} + +FLAC__bool FLAC__subframe_add_lpc(const FLAC__Subframe_LPC *subframe, unsigned residual_samples, unsigned subframe_bps, unsigned wasted_bits, FLAC__BitBuffer *bb) +{ + unsigned i; + + if(!FLAC__bitbuffer_write_raw_uint32(bb, FLAC__SUBFRAME_TYPE_LPC_BYTE_ALIGNED_MASK | ((subframe->order-1)<<1) | (wasted_bits? 1:0), FLAC__SUBFRAME_ZERO_PAD_LEN + FLAC__SUBFRAME_TYPE_LEN + FLAC__SUBFRAME_WASTED_BITS_FLAG_LEN)) + return false; + if(wasted_bits) + if(!FLAC__bitbuffer_write_unary_unsigned(bb, wasted_bits-1)) + return false; + + for(i = 0; i < subframe->order; i++) + if(!FLAC__bitbuffer_write_raw_int32(bb, subframe->warmup[i], subframe_bps)) + return false; + + if(!FLAC__bitbuffer_write_raw_uint32(bb, subframe->qlp_coeff_precision-1, FLAC__SUBFRAME_LPC_QLP_COEFF_PRECISION_LEN)) + return false; + if(!FLAC__bitbuffer_write_raw_int32(bb, subframe->quantization_level, FLAC__SUBFRAME_LPC_QLP_SHIFT_LEN)) + return false; + for(i = 0; i < subframe->order; i++) + if(!FLAC__bitbuffer_write_raw_int32(bb, subframe->qlp_coeff[i], subframe->qlp_coeff_precision)) + return false; + + if(!add_entropy_coding_method_(bb, &subframe->entropy_coding_method)) + return false; + switch(subframe->entropy_coding_method.type) { + case FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE: + if(!add_residual_partitioned_rice_(bb, subframe->residual, residual_samples, subframe->order, subframe->entropy_coding_method.data.partitioned_rice.contents->parameters, subframe->entropy_coding_method.data.partitioned_rice.contents->raw_bits, subframe->entropy_coding_method.data.partitioned_rice.order)) + return false; + break; + default: + FLAC__ASSERT(0); + } + + return true; +} + +FLAC__bool FLAC__subframe_add_verbatim(const FLAC__Subframe_Verbatim *subframe, unsigned samples, unsigned subframe_bps, unsigned wasted_bits, FLAC__BitBuffer *bb) +{ + unsigned i; + const FLAC__int32 *signal = subframe->data; + + if(!FLAC__bitbuffer_write_raw_uint32(bb, FLAC__SUBFRAME_TYPE_VERBATIM_BYTE_ALIGNED_MASK | (wasted_bits? 1:0), FLAC__SUBFRAME_ZERO_PAD_LEN + FLAC__SUBFRAME_TYPE_LEN + FLAC__SUBFRAME_WASTED_BITS_FLAG_LEN)) + return false; + if(wasted_bits) + if(!FLAC__bitbuffer_write_unary_unsigned(bb, wasted_bits-1)) + return false; + + for(i = 0; i < samples; i++) + if(!FLAC__bitbuffer_write_raw_int32(bb, signal[i], subframe_bps)) + return false; + + return true; +} + +FLAC__bool add_entropy_coding_method_(FLAC__BitBuffer *bb, const FLAC__EntropyCodingMethod *method) +{ + if(!FLAC__bitbuffer_write_raw_uint32(bb, method->type, FLAC__ENTROPY_CODING_METHOD_TYPE_LEN)) + return false; + switch(method->type) { + case FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE: + if(!FLAC__bitbuffer_write_raw_uint32(bb, method->data.partitioned_rice.order, FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ORDER_LEN)) + return false; + break; + default: + FLAC__ASSERT(0); + } + return true; +} + +FLAC__bool add_residual_partitioned_rice_(FLAC__BitBuffer *bb, const FLAC__int32 residual[], const unsigned residual_samples, const unsigned predictor_order, const unsigned rice_parameters[], const unsigned raw_bits[], const unsigned partition_order) +{ + if(partition_order == 0) { + unsigned i; + + if(!FLAC__bitbuffer_write_raw_uint32(bb, rice_parameters[0], FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN)) + return false; + if(rice_parameters[0] < FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER) { + for(i = 0; i < residual_samples; i++) { +#ifdef FLAC__SYMMETRIC_RICE + if(!FLAC__bitbuffer_write_symmetric_rice_signed(bb, residual[i], rice_parameters[0])) + return false; +#else + if(!FLAC__bitbuffer_write_rice_signed(bb, residual[i], rice_parameters[0])) + return false; +#endif + } + } + else { + if(!FLAC__bitbuffer_write_raw_uint32(bb, raw_bits[0], FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_RAW_LEN)) + return false; + for(i = 0; i < residual_samples; i++) { + if(!FLAC__bitbuffer_write_raw_int32(bb, residual[i], raw_bits[0])) + return false; + } + } + return true; + } + else { + unsigned i, j, k = 0, k_last = 0; + unsigned partition_samples; + const unsigned default_partition_samples = (residual_samples+predictor_order) >> partition_order; + for(i = 0; i < (1u</dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || mkdir "$(distdir)/$$subdir" \ + || exit 1; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="../$(top_distdir)" \ + distdir="../$(distdir)/$$subdir" \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile $(LTLIBRARIES) $(DATA) +installdirs: installdirs-recursive +installdirs-am: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(m4datadir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-recursive + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-libtool distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: install-m4dataDATA + +install-exec-am: install-libLTLIBRARIES + +install-info: install-info-recursive + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES \ + uninstall-m4dataDATA + +uninstall-info: uninstall-info-recursive + +.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \ + clean clean-generic clean-libLTLIBRARIES clean-libtool \ + clean-recursive ctags ctags-recursive distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-recursive distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-libLTLIBRARIES install-m4dataDATA \ + install-man install-strip installcheck installcheck-am \ + installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic maintainer-clean-recursive \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool mostlyclean-recursive pdf pdf-am ps ps-am \ + tags tags-recursive uninstall uninstall-am uninstall-info-am \ + uninstall-libLTLIBRARIES uninstall-m4dataDATA + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/Libraries/FLAC/Files/src/libOggFLAC/Makefile.lite b/Libraries/FLAC/Files/src/libOggFLAC/Makefile.lite new file mode 100644 index 000000000..c53f2decd --- /dev/null +++ b/Libraries/FLAC/Files/src/libOggFLAC/Makefile.lite @@ -0,0 +1,64 @@ +# libOggFLAC - Free Lossless Audio Codec + Ogg library +# Copyright (C) 2002,2003,2004,2005 Josh Coalson +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# - Neither the name of the Xiph.org Foundation nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +# +# GNU makefile +# + +topdir = ../.. + +LIB_NAME = libOggFLAC +ifeq ($(DARWIN_BUILD),yes) +DEFINES = +else +ifeq ($(SOLARIS_BUILD),yes) +DEFINES = +else +DEFINES = +endif +endif +INCLUDES = -I./include -I$(topdir)/include -I$(OGG_INCLUDE_DIR) +DEBUG_CFLAGS = + +SRCS_C = \ + file_decoder.c \ + file_encoder.c \ + ogg_decoder_aspect.c \ + ogg_encoder_aspect.c \ + ogg_helper.c \ + ogg_mapping.c \ + seekable_stream_decoder.c \ + seekable_stream_encoder.c \ + stream_decoder.c \ + stream_encoder.c + +include $(topdir)/build/lib.mk + +# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/Libraries/FLAC/Files/src/libOggFLAC/file_decoder.c b/Libraries/FLAC/Files/src/libOggFLAC/file_decoder.c new file mode 100644 index 000000000..74da9ed3d --- /dev/null +++ b/Libraries/FLAC/Files/src/libOggFLAC/file_decoder.c @@ -0,0 +1,664 @@ +/* libOggFLAC - Free Lossless Audio Codec + Ogg library + * Copyright (C) 2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include /* for malloc() */ +#include /* for strcmp() */ +#include /* for stat() */ +#if defined _MSC_VER || defined __MINGW32__ +#include /* for _setmode() */ +#include /* for _O_BINARY */ +#elif defined __CYGWIN__ +#include /* for setmode(), O_BINARY */ +#include /* for _O_BINARY */ +#endif +#include "FLAC/assert.h" +#include "protected/file_decoder.h" +#include "protected/seekable_stream_decoder.h" + +/*********************************************************************** + * + * Private class method prototypes + * + ***********************************************************************/ + +static void set_defaults_(OggFLAC__FileDecoder *decoder); +static FILE *get_binary_stdin_(); +static OggFLAC__SeekableStreamDecoderReadStatus read_callback_(const OggFLAC__SeekableStreamDecoder *decoder, FLAC__byte buffer[], unsigned *bytes, void *client_data); +static OggFLAC__SeekableStreamDecoderSeekStatus seek_callback_(const OggFLAC__SeekableStreamDecoder *decoder, FLAC__uint64 absolute_byte_offset, void *client_data); +static OggFLAC__SeekableStreamDecoderTellStatus tell_callback_(const OggFLAC__SeekableStreamDecoder *decoder, FLAC__uint64 *absolute_byte_offset, void *client_data); +static OggFLAC__SeekableStreamDecoderLengthStatus length_callback_(const OggFLAC__SeekableStreamDecoder *decoder, FLAC__uint64 *stream_length, void *client_data); +static FLAC__bool eof_callback_(const OggFLAC__SeekableStreamDecoder *decoder, void *client_data); +static FLAC__StreamDecoderWriteStatus write_callback_(const OggFLAC__SeekableStreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data); +static void metadata_callback_(const OggFLAC__SeekableStreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data); +static void error_callback_(const OggFLAC__SeekableStreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data); + +/*********************************************************************** + * + * Private class data + * + ***********************************************************************/ + +typedef struct OggFLAC__FileDecoderPrivate { + OggFLAC__FileDecoderWriteCallback write_callback; + OggFLAC__FileDecoderMetadataCallback metadata_callback; + OggFLAC__FileDecoderErrorCallback error_callback; + void *client_data; + FILE *file; + char *filename; /* == NULL if stdin */ + OggFLAC__SeekableStreamDecoder *seekable_stream_decoder; +} OggFLAC__FileDecoderPrivate; + +/*********************************************************************** + * + * Public static class data + * + ***********************************************************************/ + +OggFLAC_API const char * const OggFLAC__FileDecoderStateString[] = { + "OggFLAC__FILE_DECODER_OK", + "OggFLAC__FILE_DECODER_END_OF_FILE", + "OggFLAC__FILE_DECODER_ERROR_OPENING_FILE", + "OggFLAC__FILE_DECODER_SEEK_ERROR", + "OggFLAC__FILE_DECODER_SEEKABLE_STREAM_DECODER_ERROR", + "OggFLAC__FILE_DECODER_MEMORY_ALLOCATION_ERROR", + "OggFLAC__FILE_DECODER_ALREADY_INITIALIZED", + "OggFLAC__FILE_DECODER_INVALID_CALLBACK", + "OggFLAC__FILE_DECODER_UNINITIALIZED" +}; + +/*********************************************************************** + * + * Class constructor/destructor + * + ***********************************************************************/ + +OggFLAC_API OggFLAC__FileDecoder *OggFLAC__file_decoder_new() +{ + OggFLAC__FileDecoder *decoder; + + FLAC__ASSERT(sizeof(int) >= 4); /* we want to die right away if this is not true */ + + decoder = (OggFLAC__FileDecoder*)calloc(1, sizeof(OggFLAC__FileDecoder)); + if(decoder == 0) { + return 0; + } + + decoder->protected_ = (OggFLAC__FileDecoderProtected*)calloc(1, sizeof(OggFLAC__FileDecoderProtected)); + if(decoder->protected_ == 0) { + free(decoder); + return 0; + } + + decoder->private_ = (OggFLAC__FileDecoderPrivate*)calloc(1, sizeof(OggFLAC__FileDecoderPrivate)); + if(decoder->private_ == 0) { + free(decoder->protected_); + free(decoder); + return 0; + } + + decoder->private_->seekable_stream_decoder = OggFLAC__seekable_stream_decoder_new(); + if(0 == decoder->private_->seekable_stream_decoder) { + free(decoder->private_); + free(decoder->protected_); + free(decoder); + return 0; + } + + decoder->private_->file = 0; + + set_defaults_(decoder); + + decoder->protected_->state = OggFLAC__FILE_DECODER_UNINITIALIZED; + + return decoder; +} + +OggFLAC_API void OggFLAC__file_decoder_delete(OggFLAC__FileDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->protected_); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->private_->seekable_stream_decoder); + + (void)OggFLAC__file_decoder_finish(decoder); + + OggFLAC__seekable_stream_decoder_delete(decoder->private_->seekable_stream_decoder); + + free(decoder->private_); + free(decoder->protected_); + free(decoder); +} + +/*********************************************************************** + * + * Public class methods + * + ***********************************************************************/ + +OggFLAC_API OggFLAC__FileDecoderState OggFLAC__file_decoder_init(OggFLAC__FileDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + + if(decoder->protected_->state != OggFLAC__FILE_DECODER_UNINITIALIZED) + return decoder->protected_->state = OggFLAC__FILE_DECODER_ALREADY_INITIALIZED; + + if(0 == decoder->private_->write_callback || 0 == decoder->private_->metadata_callback || 0 == decoder->private_->error_callback) + return decoder->protected_->state = OggFLAC__FILE_DECODER_INVALID_CALLBACK; + + if(0 == decoder->private_->filename) + decoder->private_->file = get_binary_stdin_(); + else + decoder->private_->file = fopen(decoder->private_->filename, "rb"); + + if(decoder->private_->file == 0) + return decoder->protected_->state = OggFLAC__FILE_DECODER_ERROR_OPENING_FILE; + + OggFLAC__seekable_stream_decoder_set_read_callback(decoder->private_->seekable_stream_decoder, read_callback_); + OggFLAC__seekable_stream_decoder_set_seek_callback(decoder->private_->seekable_stream_decoder, seek_callback_); + OggFLAC__seekable_stream_decoder_set_tell_callback(decoder->private_->seekable_stream_decoder, tell_callback_); + OggFLAC__seekable_stream_decoder_set_length_callback(decoder->private_->seekable_stream_decoder, length_callback_); + OggFLAC__seekable_stream_decoder_set_eof_callback(decoder->private_->seekable_stream_decoder, eof_callback_); + OggFLAC__seekable_stream_decoder_set_write_callback(decoder->private_->seekable_stream_decoder, write_callback_); + OggFLAC__seekable_stream_decoder_set_metadata_callback(decoder->private_->seekable_stream_decoder, metadata_callback_); + OggFLAC__seekable_stream_decoder_set_error_callback(decoder->private_->seekable_stream_decoder, error_callback_); + OggFLAC__seekable_stream_decoder_set_client_data(decoder->private_->seekable_stream_decoder, decoder); + + if(OggFLAC__seekable_stream_decoder_init(decoder->private_->seekable_stream_decoder) != OggFLAC__SEEKABLE_STREAM_DECODER_OK) + return decoder->protected_->state = OggFLAC__FILE_DECODER_SEEKABLE_STREAM_DECODER_ERROR; + + return decoder->protected_->state = OggFLAC__FILE_DECODER_OK; +} + +OggFLAC_API FLAC__bool OggFLAC__file_decoder_finish(OggFLAC__FileDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + + if(decoder->protected_->state == OggFLAC__FILE_DECODER_UNINITIALIZED) + return true; + + FLAC__ASSERT(0 != decoder->private_->seekable_stream_decoder); + + if(0 != decoder->private_->file && decoder->private_->file != stdin) { + fclose(decoder->private_->file); + decoder->private_->file = 0; + } + + if(0 != decoder->private_->filename) { + free(decoder->private_->filename); + decoder->private_->filename = 0; + } + + set_defaults_(decoder); + + decoder->protected_->state = OggFLAC__FILE_DECODER_UNINITIALIZED; + + return OggFLAC__seekable_stream_decoder_finish(decoder->private_->seekable_stream_decoder); +} + +OggFLAC_API FLAC__bool OggFLAC__file_decoder_set_md5_checking(OggFLAC__FileDecoder *decoder, FLAC__bool value) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + FLAC__ASSERT(0 != decoder->private_->seekable_stream_decoder); + if(decoder->protected_->state != OggFLAC__FILE_DECODER_UNINITIALIZED) + return false; + return OggFLAC__seekable_stream_decoder_set_md5_checking(decoder->private_->seekable_stream_decoder, value); +} + +OggFLAC_API FLAC__bool OggFLAC__file_decoder_set_filename(OggFLAC__FileDecoder *decoder, const char *value) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + FLAC__ASSERT(0 != value); + if(decoder->protected_->state != OggFLAC__FILE_DECODER_UNINITIALIZED) + return false; + if(0 != decoder->private_->filename) { + free(decoder->private_->filename); + decoder->private_->filename = 0; + } + if(0 != strcmp(value, "-")) { + if(0 == (decoder->private_->filename = (char*)malloc(strlen(value)+1))) { + decoder->protected_->state = OggFLAC__FILE_DECODER_MEMORY_ALLOCATION_ERROR; + return false; + } + strcpy(decoder->private_->filename, value); + } + return true; +} + +OggFLAC_API FLAC__bool OggFLAC__file_decoder_set_write_callback(OggFLAC__FileDecoder *decoder, OggFLAC__FileDecoderWriteCallback value) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + if(decoder->protected_->state != OggFLAC__FILE_DECODER_UNINITIALIZED) + return false; + decoder->private_->write_callback = value; + return true; +} + +OggFLAC_API FLAC__bool OggFLAC__file_decoder_set_metadata_callback(OggFLAC__FileDecoder *decoder, OggFLAC__FileDecoderMetadataCallback value) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + if(decoder->protected_->state != OggFLAC__FILE_DECODER_UNINITIALIZED) + return false; + decoder->private_->metadata_callback = value; + return true; +} + +OggFLAC_API FLAC__bool OggFLAC__file_decoder_set_error_callback(OggFLAC__FileDecoder *decoder, OggFLAC__FileDecoderErrorCallback value) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + if(decoder->protected_->state != OggFLAC__FILE_DECODER_UNINITIALIZED) + return false; + decoder->private_->error_callback = value; + return true; +} + +OggFLAC_API FLAC__bool OggFLAC__file_decoder_set_client_data(OggFLAC__FileDecoder *decoder, void *value) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + if(decoder->protected_->state != OggFLAC__FILE_DECODER_UNINITIALIZED) + return false; + decoder->private_->client_data = value; + return true; +} + +OggFLAC_API FLAC__bool OggFLAC__file_decoder_set_serial_number(OggFLAC__FileDecoder *decoder, long value) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + if(decoder->protected_->state != OggFLAC__FILE_DECODER_UNINITIALIZED) + return false; + OggFLAC__seekable_stream_decoder_set_serial_number(decoder->private_->seekable_stream_decoder, value); + return true; +} + +OggFLAC_API FLAC__bool OggFLAC__file_decoder_set_metadata_respond(OggFLAC__FileDecoder *decoder, FLAC__MetadataType type) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + FLAC__ASSERT(0 != decoder->private_->seekable_stream_decoder); + if(decoder->protected_->state != OggFLAC__FILE_DECODER_UNINITIALIZED) + return false; + return OggFLAC__seekable_stream_decoder_set_metadata_respond(decoder->private_->seekable_stream_decoder, type); +} + +OggFLAC_API FLAC__bool OggFLAC__file_decoder_set_metadata_respond_application(OggFLAC__FileDecoder *decoder, const FLAC__byte id[4]) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + FLAC__ASSERT(0 != decoder->private_->seekable_stream_decoder); + if(decoder->protected_->state != OggFLAC__FILE_DECODER_UNINITIALIZED) + return false; + return OggFLAC__seekable_stream_decoder_set_metadata_respond_application(decoder->private_->seekable_stream_decoder, id); +} + +OggFLAC_API FLAC__bool OggFLAC__file_decoder_set_metadata_respond_all(OggFLAC__FileDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + FLAC__ASSERT(0 != decoder->private_->seekable_stream_decoder); + if(decoder->protected_->state != OggFLAC__FILE_DECODER_UNINITIALIZED) + return false; + return OggFLAC__seekable_stream_decoder_set_metadata_respond_all(decoder->private_->seekable_stream_decoder); +} + +OggFLAC_API FLAC__bool OggFLAC__file_decoder_set_metadata_ignore(OggFLAC__FileDecoder *decoder, FLAC__MetadataType type) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + FLAC__ASSERT(0 != decoder->private_->seekable_stream_decoder); + if(decoder->protected_->state != OggFLAC__FILE_DECODER_UNINITIALIZED) + return false; + return OggFLAC__seekable_stream_decoder_set_metadata_ignore(decoder->private_->seekable_stream_decoder, type); +} + +OggFLAC_API FLAC__bool OggFLAC__file_decoder_set_metadata_ignore_application(OggFLAC__FileDecoder *decoder, const FLAC__byte id[4]) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + FLAC__ASSERT(0 != decoder->private_->seekable_stream_decoder); + if(decoder->protected_->state != OggFLAC__FILE_DECODER_UNINITIALIZED) + return false; + return OggFLAC__seekable_stream_decoder_set_metadata_ignore_application(decoder->private_->seekable_stream_decoder, id); +} + +OggFLAC_API FLAC__bool OggFLAC__file_decoder_set_metadata_ignore_all(OggFLAC__FileDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + FLAC__ASSERT(0 != decoder->private_->seekable_stream_decoder); + if(decoder->protected_->state != OggFLAC__FILE_DECODER_UNINITIALIZED) + return false; + return OggFLAC__seekable_stream_decoder_set_metadata_ignore_all(decoder->private_->seekable_stream_decoder); +} + +OggFLAC_API OggFLAC__FileDecoderState OggFLAC__file_decoder_get_state(const OggFLAC__FileDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->protected_); + return decoder->protected_->state; +} + +OggFLAC_API OggFLAC__SeekableStreamDecoderState OggFLAC__file_decoder_get_seekable_stream_decoder_state(const OggFLAC__FileDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + return OggFLAC__seekable_stream_decoder_get_state(decoder->private_->seekable_stream_decoder); +} + +OggFLAC_API OggFLAC__StreamDecoderState OggFLAC__file_decoder_get_stream_decoder_state(const OggFLAC__FileDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + return OggFLAC__seekable_stream_decoder_get_stream_decoder_state(decoder->private_->seekable_stream_decoder); +} + +OggFLAC_API FLAC__StreamDecoderState OggFLAC__file_decoder_get_FLAC_stream_decoder_state(const OggFLAC__FileDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + return OggFLAC__seekable_stream_decoder_get_FLAC_stream_decoder_state(decoder->private_->seekable_stream_decoder); +} + +OggFLAC_API const char *OggFLAC__file_decoder_get_resolved_state_string(const OggFLAC__FileDecoder *decoder) +{ + if(decoder->protected_->state != OggFLAC__FILE_DECODER_SEEKABLE_STREAM_DECODER_ERROR) + return OggFLAC__FileDecoderStateString[decoder->protected_->state]; + else + return OggFLAC__seekable_stream_decoder_get_resolved_state_string(decoder->private_->seekable_stream_decoder); +} + +OggFLAC_API FLAC__bool OggFLAC__file_decoder_get_md5_checking(const OggFLAC__FileDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + return OggFLAC__seekable_stream_decoder_get_md5_checking(decoder->private_->seekable_stream_decoder); +} + +OggFLAC_API unsigned OggFLAC__file_decoder_get_channels(const OggFLAC__FileDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + return OggFLAC__seekable_stream_decoder_get_channels(decoder->private_->seekable_stream_decoder); +} + +OggFLAC_API FLAC__ChannelAssignment OggFLAC__file_decoder_get_channel_assignment(const OggFLAC__FileDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + return OggFLAC__seekable_stream_decoder_get_channel_assignment(decoder->private_->seekable_stream_decoder); +} + +OggFLAC_API unsigned OggFLAC__file_decoder_get_bits_per_sample(const OggFLAC__FileDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + return OggFLAC__seekable_stream_decoder_get_bits_per_sample(decoder->private_->seekable_stream_decoder); +} + +OggFLAC_API unsigned OggFLAC__file_decoder_get_sample_rate(const OggFLAC__FileDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + return OggFLAC__seekable_stream_decoder_get_sample_rate(decoder->private_->seekable_stream_decoder); +} + +OggFLAC_API unsigned OggFLAC__file_decoder_get_blocksize(const OggFLAC__FileDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + return OggFLAC__seekable_stream_decoder_get_blocksize(decoder->private_->seekable_stream_decoder); +} + +OggFLAC_API FLAC__bool OggFLAC__file_decoder_process_single(OggFLAC__FileDecoder *decoder) +{ + FLAC__bool ret; + FLAC__ASSERT(0 != decoder); + + if(decoder->private_->seekable_stream_decoder->protected_->state == OggFLAC__SEEKABLE_STREAM_DECODER_END_OF_STREAM) + decoder->protected_->state = OggFLAC__FILE_DECODER_END_OF_FILE; + + if(decoder->protected_->state == OggFLAC__FILE_DECODER_END_OF_FILE) + return true; + + FLAC__ASSERT(decoder->protected_->state == OggFLAC__FILE_DECODER_OK); + + ret = OggFLAC__seekable_stream_decoder_process_single(decoder->private_->seekable_stream_decoder); + if(!ret) + decoder->protected_->state = OggFLAC__FILE_DECODER_SEEKABLE_STREAM_DECODER_ERROR; + + return ret; +} + +OggFLAC_API FLAC__bool OggFLAC__file_decoder_process_until_end_of_metadata(OggFLAC__FileDecoder *decoder) +{ + FLAC__bool ret; + FLAC__ASSERT(0 != decoder); + + if(decoder->private_->seekable_stream_decoder->protected_->state == OggFLAC__SEEKABLE_STREAM_DECODER_END_OF_STREAM) + decoder->protected_->state = OggFLAC__FILE_DECODER_END_OF_FILE; + + if(decoder->protected_->state == OggFLAC__FILE_DECODER_END_OF_FILE) + return true; + + FLAC__ASSERT(decoder->protected_->state == OggFLAC__FILE_DECODER_OK); + + ret = OggFLAC__seekable_stream_decoder_process_until_end_of_metadata(decoder->private_->seekable_stream_decoder); + if(!ret) + decoder->protected_->state = OggFLAC__FILE_DECODER_SEEKABLE_STREAM_DECODER_ERROR; + + return ret; +} + +OggFLAC_API FLAC__bool OggFLAC__file_decoder_process_until_end_of_file(OggFLAC__FileDecoder *decoder) +{ + FLAC__bool ret; + FLAC__ASSERT(0 != decoder); + + if(decoder->private_->seekable_stream_decoder->protected_->state == OggFLAC__SEEKABLE_STREAM_DECODER_END_OF_STREAM) + decoder->protected_->state = OggFLAC__FILE_DECODER_END_OF_FILE; + + if(decoder->protected_->state == OggFLAC__FILE_DECODER_END_OF_FILE) + return true; + + FLAC__ASSERT(decoder->protected_->state == OggFLAC__FILE_DECODER_OK); + + ret = OggFLAC__seekable_stream_decoder_process_until_end_of_stream(decoder->private_->seekable_stream_decoder); + if(!ret) + decoder->protected_->state = OggFLAC__FILE_DECODER_SEEKABLE_STREAM_DECODER_ERROR; + + return ret; +} + +OggFLAC_API FLAC__bool OggFLAC__file_decoder_seek_absolute(OggFLAC__FileDecoder *decoder, FLAC__uint64 sample) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(decoder->protected_->state == OggFLAC__FILE_DECODER_OK || decoder->protected_->state == OggFLAC__FILE_DECODER_END_OF_FILE); + + if(decoder->private_->filename == 0) { /* means the file is stdin... */ + decoder->protected_->state = OggFLAC__FILE_DECODER_SEEK_ERROR; + return false; + } + + if(!OggFLAC__seekable_stream_decoder_seek_absolute(decoder->private_->seekable_stream_decoder, sample)) { + decoder->protected_->state = OggFLAC__FILE_DECODER_SEEK_ERROR; + return false; + } + else { + decoder->protected_->state = OggFLAC__FILE_DECODER_OK; + return true; + } +} + + +/*********************************************************************** + * + * Private class methods + * + ***********************************************************************/ + +void set_defaults_(OggFLAC__FileDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + + decoder->private_->filename = 0; + decoder->private_->write_callback = 0; + decoder->private_->metadata_callback = 0; + decoder->private_->error_callback = 0; + decoder->private_->client_data = 0; +} + +/* + * This will forcibly set stdin to binary mode (for OSes that require it) + */ +FILE *get_binary_stdin_() +{ + /* if something breaks here it is probably due to the presence or + * absence of an underscore before the identifiers 'setmode', + * 'fileno', and/or 'O_BINARY'; check your system header files. + */ +#if defined _MSC_VER || defined __MINGW32__ + _setmode(_fileno(stdin), _O_BINARY); +#elif defined __CYGWIN__ + /* almost certainly not needed for any modern Cygwin, but let's be safe... */ + setmode(_fileno(stdin), _O_BINARY); +#endif + + return stdin; +} + +OggFLAC__SeekableStreamDecoderReadStatus read_callback_(const OggFLAC__SeekableStreamDecoder *decoder, FLAC__byte buffer[], unsigned *bytes, void *client_data) +{ + OggFLAC__FileDecoder *file_decoder = (OggFLAC__FileDecoder *)client_data; + (void)decoder; + + if(*bytes > 0) { + *bytes = (unsigned)fread(buffer, sizeof(FLAC__byte), *bytes, file_decoder->private_->file); + if(ferror(file_decoder->private_->file)) { + return OggFLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_ERROR; + } + else { + return OggFLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_OK; + } + } + else + return OggFLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_ERROR; /* abort to avoid a deadlock */ +} + +OggFLAC__SeekableStreamDecoderSeekStatus seek_callback_(const OggFLAC__SeekableStreamDecoder *decoder, FLAC__uint64 absolute_byte_offset, void *client_data) +{ + OggFLAC__FileDecoder *file_decoder = (OggFLAC__FileDecoder *)client_data; + (void)decoder; + + if(fseek(file_decoder->private_->file, (long)absolute_byte_offset, SEEK_SET) < 0) + return OggFLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_ERROR; + else + return OggFLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_OK; +} + +OggFLAC__SeekableStreamDecoderTellStatus tell_callback_(const OggFLAC__SeekableStreamDecoder *decoder, FLAC__uint64 *absolute_byte_offset, void *client_data) +{ + OggFLAC__FileDecoder *file_decoder = (OggFLAC__FileDecoder *)client_data; + long pos; + (void)decoder; + + if((pos = ftell(file_decoder->private_->file)) < 0) + return OggFLAC__SEEKABLE_STREAM_DECODER_TELL_STATUS_ERROR; + else { + *absolute_byte_offset = (FLAC__uint64)pos; + return OggFLAC__SEEKABLE_STREAM_DECODER_TELL_STATUS_OK; + } +} + +OggFLAC__SeekableStreamDecoderLengthStatus length_callback_(const OggFLAC__SeekableStreamDecoder *decoder, FLAC__uint64 *stream_length, void *client_data) +{ + OggFLAC__FileDecoder *file_decoder = (OggFLAC__FileDecoder *)client_data; + struct stat filestats; + (void)decoder; + + if(0 == file_decoder->private_->filename || stat(file_decoder->private_->filename, &filestats) != 0) + return OggFLAC__SEEKABLE_STREAM_DECODER_LENGTH_STATUS_ERROR; + else { + *stream_length = (FLAC__uint64)filestats.st_size; + return OggFLAC__SEEKABLE_STREAM_DECODER_LENGTH_STATUS_OK; + } +} + +FLAC__bool eof_callback_(const OggFLAC__SeekableStreamDecoder *decoder, void *client_data) +{ + OggFLAC__FileDecoder *file_decoder = (OggFLAC__FileDecoder *)client_data; + (void)decoder; + + return feof(file_decoder->private_->file)? true : false; +} + +FLAC__StreamDecoderWriteStatus write_callback_(const OggFLAC__SeekableStreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data) +{ + OggFLAC__FileDecoder *file_decoder = (OggFLAC__FileDecoder *)client_data; + (void)decoder; + + return file_decoder->private_->write_callback(file_decoder, frame, buffer, file_decoder->private_->client_data); +} + +void metadata_callback_(const OggFLAC__SeekableStreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data) +{ + OggFLAC__FileDecoder *file_decoder = (OggFLAC__FileDecoder *)client_data; + (void)decoder; + + file_decoder->private_->metadata_callback(file_decoder, metadata, file_decoder->private_->client_data); +} + +void error_callback_(const OggFLAC__SeekableStreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data) +{ + OggFLAC__FileDecoder *file_decoder = (OggFLAC__FileDecoder *)client_data; + (void)decoder; + + file_decoder->private_->error_callback(file_decoder, status, file_decoder->private_->client_data); +} diff --git a/Libraries/FLAC/Files/src/libOggFLAC/file_encoder.c b/Libraries/FLAC/Files/src/libOggFLAC/file_encoder.c new file mode 100644 index 000000000..4567685b7 --- /dev/null +++ b/Libraries/FLAC/Files/src/libOggFLAC/file_encoder.c @@ -0,0 +1,814 @@ +/* libOggFLAC - Free Lossless Audio Codec + Ogg library + * Copyright (C) 2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include /* for malloc() */ +#include /* for strlen(), strcpy() */ +#include "FLAC/assert.h" +#include "OggFLAC/seekable_stream_encoder.h" +#include "protected/file_encoder.h" + +#ifdef max +#undef max +#endif +#define max(x,y) ((x)>(y)?(x):(y)) + +/*********************************************************************** + * + * Private class method prototypes + * + ***********************************************************************/ + +/* unpublished debug routines */ +extern FLAC__bool OggFLAC__seekable_stream_encoder_disable_constant_subframes(OggFLAC__SeekableStreamEncoder *encoder, FLAC__bool value); +extern FLAC__bool OggFLAC__seekable_stream_encoder_disable_fixed_subframes(OggFLAC__SeekableStreamEncoder *encoder, FLAC__bool value); +extern FLAC__bool OggFLAC__seekable_stream_encoder_disable_verbatim_subframes(OggFLAC__SeekableStreamEncoder *encoder, FLAC__bool value); + +static void set_defaults_(OggFLAC__FileEncoder *encoder); +static OggFLAC__SeekableStreamEncoderReadStatus read_callback_(const OggFLAC__SeekableStreamEncoder *encoder, FLAC__byte buffer[], unsigned *bytes, void *client_data); +static FLAC__SeekableStreamEncoderSeekStatus seek_callback_(const OggFLAC__SeekableStreamEncoder *encoder, FLAC__uint64 absolute_byte_offset, void *client_data); +static FLAC__SeekableStreamEncoderTellStatus tell_callback_(const OggFLAC__SeekableStreamEncoder *encoder, FLAC__uint64 *absolute_byte_offset, void *client_data); +static FLAC__StreamEncoderWriteStatus write_callback_(const OggFLAC__SeekableStreamEncoder *encoder, const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame, void *client_data); + +/*********************************************************************** + * + * Private class data + * + ***********************************************************************/ + +typedef struct OggFLAC__FileEncoderPrivate { + OggFLAC__FileEncoderProgressCallback progress_callback; + void *client_data; + char *filename; + FLAC__uint64 bytes_written; + FLAC__uint64 samples_written; + unsigned frames_written; + unsigned total_frames_estimate; + OggFLAC__SeekableStreamEncoder *seekable_stream_encoder; + FILE *file; +} OggFLAC__FileEncoderPrivate; + +/*********************************************************************** + * + * Public static class data + * + ***********************************************************************/ + +OggFLAC_API const char * const OggFLAC__FileEncoderStateString[] = { + "OggFLAC__FILE_ENCODER_OK", + "OggFLAC__FILE_ENCODER_NO_FILENAME", + "OggFLAC__FILE_ENCODER_SEEKABLE_STREAM_ENCODER_ERROR", + "OggFLAC__FILE_ENCODER_FATAL_ERROR_WHILE_WRITING", + "OggFLAC__FILE_ENCODER_ERROR_OPENING_FILE", + "OggFLAC__FILE_ENCODER_MEMORY_ALLOCATION_ERROR", + "OggFLAC__FILE_ENCODER_ALREADY_INITIALIZED", + "OggFLAC__FILE_ENCODER_UNINITIALIZED" +}; + + +/*********************************************************************** + * + * Class constructor/destructor + * + ***********************************************************************/ + +OggFLAC_API OggFLAC__FileEncoder *OggFLAC__file_encoder_new() +{ + OggFLAC__FileEncoder *encoder; + + FLAC__ASSERT(sizeof(int) >= 4); /* we want to die right away if this is not true */ + + encoder = (OggFLAC__FileEncoder*)calloc(1, sizeof(OggFLAC__FileEncoder)); + if(encoder == 0) { + return 0; + } + + encoder->protected_ = (OggFLAC__FileEncoderProtected*)calloc(1, sizeof(OggFLAC__FileEncoderProtected)); + if(encoder->protected_ == 0) { + free(encoder); + return 0; + } + + encoder->private_ = (OggFLAC__FileEncoderPrivate*)calloc(1, sizeof(OggFLAC__FileEncoderPrivate)); + if(encoder->private_ == 0) { + free(encoder->protected_); + free(encoder); + return 0; + } + + encoder->private_->seekable_stream_encoder = OggFLAC__seekable_stream_encoder_new(); + if(0 == encoder->private_->seekable_stream_encoder) { + free(encoder->private_); + free(encoder->protected_); + free(encoder); + return 0; + } + + encoder->private_->file = 0; + + set_defaults_(encoder); + + encoder->protected_->state = OggFLAC__FILE_ENCODER_UNINITIALIZED; + + return encoder; +} + +OggFLAC_API void OggFLAC__file_encoder_delete(OggFLAC__FileEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->private_->seekable_stream_encoder); + + (void)OggFLAC__file_encoder_finish(encoder); + + OggFLAC__seekable_stream_encoder_delete(encoder->private_->seekable_stream_encoder); + + free(encoder->private_); + free(encoder->protected_); + free(encoder); +} + +/*********************************************************************** + * + * Public class methods + * + ***********************************************************************/ + +OggFLAC_API OggFLAC__FileEncoderState OggFLAC__file_encoder_init(OggFLAC__FileEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + + if(encoder->protected_->state != OggFLAC__FILE_ENCODER_UNINITIALIZED) + return encoder->protected_->state = OggFLAC__FILE_ENCODER_ALREADY_INITIALIZED; + + if(0 == encoder->private_->filename) + return encoder->protected_->state = OggFLAC__FILE_ENCODER_NO_FILENAME; + + encoder->private_->file = fopen(encoder->private_->filename, "w+b"); + + if(encoder->private_->file == 0) + return encoder->protected_->state = OggFLAC__FILE_ENCODER_ERROR_OPENING_FILE; + + encoder->private_->bytes_written = 0; + encoder->private_->samples_written = 0; + encoder->private_->frames_written = 0; + + OggFLAC__seekable_stream_encoder_set_read_callback(encoder->private_->seekable_stream_encoder, read_callback_); + OggFLAC__seekable_stream_encoder_set_seek_callback(encoder->private_->seekable_stream_encoder, seek_callback_); + OggFLAC__seekable_stream_encoder_set_tell_callback(encoder->private_->seekable_stream_encoder, tell_callback_); + OggFLAC__seekable_stream_encoder_set_write_callback(encoder->private_->seekable_stream_encoder, write_callback_); + OggFLAC__seekable_stream_encoder_set_client_data(encoder->private_->seekable_stream_encoder, encoder); + + if(OggFLAC__seekable_stream_encoder_init(encoder->private_->seekable_stream_encoder) != OggFLAC__SEEKABLE_STREAM_ENCODER_OK) + return encoder->protected_->state = OggFLAC__FILE_ENCODER_SEEKABLE_STREAM_ENCODER_ERROR; + + { + unsigned blocksize = OggFLAC__file_encoder_get_blocksize(encoder); + + FLAC__ASSERT(blocksize != 0); + encoder->private_->total_frames_estimate = (unsigned)((OggFLAC__file_encoder_get_total_samples_estimate(encoder) + blocksize - 1) / blocksize); + } + + return encoder->protected_->state = OggFLAC__FILE_ENCODER_OK; +} + +OggFLAC_API void OggFLAC__file_encoder_finish(OggFLAC__FileEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + + if(encoder->protected_->state == OggFLAC__FILE_ENCODER_UNINITIALIZED) + return; + + FLAC__ASSERT(0 != encoder->private_->seekable_stream_encoder); + + /* OggFLAC__seekable_stream_encoder_finish() might write data so we must close the file after it. */ + + OggFLAC__seekable_stream_encoder_finish(encoder->private_->seekable_stream_encoder); + + if(0 != encoder->private_->file) { + fclose(encoder->private_->file); + encoder->private_->file = 0; + } + + if(0 != encoder->private_->filename) { + free(encoder->private_->filename); + encoder->private_->filename = 0; + } + + set_defaults_(encoder); + + encoder->protected_->state = OggFLAC__FILE_ENCODER_UNINITIALIZED; +} + +OggFLAC_API FLAC__bool OggFLAC__file_encoder_set_serial_number(OggFLAC__FileEncoder *encoder, long serial_number) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->seekable_stream_encoder); + if(encoder->protected_->state != OggFLAC__FILE_ENCODER_UNINITIALIZED) + return false; + return OggFLAC__seekable_stream_encoder_set_serial_number(encoder->private_->seekable_stream_encoder, serial_number); +} + +OggFLAC_API FLAC__bool OggFLAC__file_encoder_set_verify(OggFLAC__FileEncoder *encoder, FLAC__bool value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->seekable_stream_encoder); + if(encoder->protected_->state != OggFLAC__FILE_ENCODER_UNINITIALIZED) + return false; + return OggFLAC__seekable_stream_encoder_set_verify(encoder->private_->seekable_stream_encoder, value); +} + +OggFLAC_API FLAC__bool OggFLAC__file_encoder_set_streamable_subset(OggFLAC__FileEncoder *encoder, FLAC__bool value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->seekable_stream_encoder); + if(encoder->protected_->state != OggFLAC__FILE_ENCODER_UNINITIALIZED) + return false; + return OggFLAC__seekable_stream_encoder_set_streamable_subset(encoder->private_->seekable_stream_encoder, value); +} + +OggFLAC_API FLAC__bool OggFLAC__file_encoder_set_do_mid_side_stereo(OggFLAC__FileEncoder *encoder, FLAC__bool value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->seekable_stream_encoder); + if(encoder->protected_->state != OggFLAC__FILE_ENCODER_UNINITIALIZED) + return false; + return OggFLAC__seekable_stream_encoder_set_do_mid_side_stereo(encoder->private_->seekable_stream_encoder, value); +} + +OggFLAC_API FLAC__bool OggFLAC__file_encoder_set_loose_mid_side_stereo(OggFLAC__FileEncoder *encoder, FLAC__bool value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->seekable_stream_encoder); + if(encoder->protected_->state != OggFLAC__FILE_ENCODER_UNINITIALIZED) + return false; + return OggFLAC__seekable_stream_encoder_set_loose_mid_side_stereo(encoder->private_->seekable_stream_encoder, value); +} + +OggFLAC_API FLAC__bool OggFLAC__file_encoder_set_channels(OggFLAC__FileEncoder *encoder, unsigned value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->seekable_stream_encoder); + if(encoder->protected_->state != OggFLAC__FILE_ENCODER_UNINITIALIZED) + return false; + return OggFLAC__seekable_stream_encoder_set_channels(encoder->private_->seekable_stream_encoder, value); +} + +OggFLAC_API FLAC__bool OggFLAC__file_encoder_set_bits_per_sample(OggFLAC__FileEncoder *encoder, unsigned value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->seekable_stream_encoder); + if(encoder->protected_->state != OggFLAC__FILE_ENCODER_UNINITIALIZED) + return false; + return OggFLAC__seekable_stream_encoder_set_bits_per_sample(encoder->private_->seekable_stream_encoder, value); +} + +OggFLAC_API FLAC__bool OggFLAC__file_encoder_set_sample_rate(OggFLAC__FileEncoder *encoder, unsigned value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->seekable_stream_encoder); + if(encoder->protected_->state != OggFLAC__FILE_ENCODER_UNINITIALIZED) + return false; + return OggFLAC__seekable_stream_encoder_set_sample_rate(encoder->private_->seekable_stream_encoder, value); +} + +OggFLAC_API FLAC__bool OggFLAC__file_encoder_set_blocksize(OggFLAC__FileEncoder *encoder, unsigned value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->seekable_stream_encoder); + if(encoder->protected_->state != OggFLAC__FILE_ENCODER_UNINITIALIZED) + return false; + return OggFLAC__seekable_stream_encoder_set_blocksize(encoder->private_->seekable_stream_encoder, value); +} + +OggFLAC_API FLAC__bool OggFLAC__file_encoder_set_max_lpc_order(OggFLAC__FileEncoder *encoder, unsigned value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->seekable_stream_encoder); + if(encoder->protected_->state != OggFLAC__FILE_ENCODER_UNINITIALIZED) + return false; + return OggFLAC__seekable_stream_encoder_set_max_lpc_order(encoder->private_->seekable_stream_encoder, value); +} + +OggFLAC_API FLAC__bool OggFLAC__file_encoder_set_qlp_coeff_precision(OggFLAC__FileEncoder *encoder, unsigned value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->seekable_stream_encoder); + if(encoder->protected_->state != OggFLAC__FILE_ENCODER_UNINITIALIZED) + return false; + return OggFLAC__seekable_stream_encoder_set_qlp_coeff_precision(encoder->private_->seekable_stream_encoder, value); +} + +OggFLAC_API FLAC__bool OggFLAC__file_encoder_set_do_qlp_coeff_prec_search(OggFLAC__FileEncoder *encoder, FLAC__bool value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->seekable_stream_encoder); + if(encoder->protected_->state != OggFLAC__FILE_ENCODER_UNINITIALIZED) + return false; + return OggFLAC__seekable_stream_encoder_set_do_qlp_coeff_prec_search(encoder->private_->seekable_stream_encoder, value); +} + +OggFLAC_API FLAC__bool OggFLAC__file_encoder_set_do_escape_coding(OggFLAC__FileEncoder *encoder, FLAC__bool value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->seekable_stream_encoder); + if(encoder->protected_->state != OggFLAC__FILE_ENCODER_UNINITIALIZED) + return false; + return OggFLAC__seekable_stream_encoder_set_do_escape_coding(encoder->private_->seekable_stream_encoder, value); +} + +OggFLAC_API FLAC__bool OggFLAC__file_encoder_set_do_exhaustive_model_search(OggFLAC__FileEncoder *encoder, FLAC__bool value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->seekable_stream_encoder); + if(encoder->protected_->state != OggFLAC__FILE_ENCODER_UNINITIALIZED) + return false; + return OggFLAC__seekable_stream_encoder_set_do_exhaustive_model_search(encoder->private_->seekable_stream_encoder, value); +} + +OggFLAC_API FLAC__bool OggFLAC__file_encoder_set_min_residual_partition_order(OggFLAC__FileEncoder *encoder, unsigned value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->seekable_stream_encoder); + if(encoder->protected_->state != OggFLAC__FILE_ENCODER_UNINITIALIZED) + return false; + return OggFLAC__seekable_stream_encoder_set_min_residual_partition_order(encoder->private_->seekable_stream_encoder, value); +} + +OggFLAC_API FLAC__bool OggFLAC__file_encoder_set_max_residual_partition_order(OggFLAC__FileEncoder *encoder, unsigned value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->seekable_stream_encoder); + if(encoder->protected_->state != OggFLAC__FILE_ENCODER_UNINITIALIZED) + return false; + return OggFLAC__seekable_stream_encoder_set_max_residual_partition_order(encoder->private_->seekable_stream_encoder, value); +} + +OggFLAC_API FLAC__bool OggFLAC__file_encoder_set_rice_parameter_search_dist(OggFLAC__FileEncoder *encoder, unsigned value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->seekable_stream_encoder); + if(encoder->protected_->state != OggFLAC__FILE_ENCODER_UNINITIALIZED) + return false; + return OggFLAC__seekable_stream_encoder_set_rice_parameter_search_dist(encoder->private_->seekable_stream_encoder, value); +} + +OggFLAC_API FLAC__bool OggFLAC__file_encoder_set_total_samples_estimate(OggFLAC__FileEncoder *encoder, FLAC__uint64 value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->seekable_stream_encoder); + if(encoder->protected_->state != OggFLAC__FILE_ENCODER_UNINITIALIZED) + return false; + return OggFLAC__seekable_stream_encoder_set_total_samples_estimate(encoder->private_->seekable_stream_encoder, value); +} + +OggFLAC_API FLAC__bool OggFLAC__file_encoder_set_metadata(OggFLAC__FileEncoder *encoder, FLAC__StreamMetadata **metadata, unsigned num_blocks) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->seekable_stream_encoder); + if(encoder->protected_->state != OggFLAC__FILE_ENCODER_UNINITIALIZED) + return false; + return OggFLAC__seekable_stream_encoder_set_metadata(encoder->private_->seekable_stream_encoder, metadata, num_blocks); +} + +OggFLAC_API FLAC__bool OggFLAC__file_encoder_set_filename(OggFLAC__FileEncoder *encoder, const char *value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != value); + if(encoder->protected_->state != OggFLAC__FILE_ENCODER_UNINITIALIZED) + return false; + if(0 != encoder->private_->filename) { + free(encoder->private_->filename); + encoder->private_->filename = 0; + } + if(0 == (encoder->private_->filename = (char*)malloc(strlen(value)+1))) { + encoder->protected_->state = OggFLAC__FILE_ENCODER_MEMORY_ALLOCATION_ERROR; + return false; + } + strcpy(encoder->private_->filename, value); + return true; +} + +OggFLAC_API FLAC__bool OggFLAC__file_encoder_set_progress_callback(OggFLAC__FileEncoder *encoder, OggFLAC__FileEncoderProgressCallback value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + if(encoder->protected_->state != OggFLAC__FILE_ENCODER_UNINITIALIZED) + return false; + encoder->private_->progress_callback = value; + return true; +} + +OggFLAC_API FLAC__bool OggFLAC__file_encoder_set_client_data(OggFLAC__FileEncoder *encoder, void *value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + if(encoder->protected_->state != OggFLAC__FILE_ENCODER_UNINITIALIZED) + return false; + encoder->private_->client_data = value; + return true; +} + +/* + * These three functions are not static, but not publically exposed in + * include/OggFLAC/ either. They are used by the test suite. + */ +OggFLAC_API FLAC__bool OggFLAC__file_encoder_disable_constant_subframes(OggFLAC__FileEncoder *encoder, FLAC__bool value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + if(encoder->protected_->state != OggFLAC__FILE_ENCODER_UNINITIALIZED) + return false; + return OggFLAC__seekable_stream_encoder_disable_constant_subframes(encoder->private_->seekable_stream_encoder, value); +} + +OggFLAC_API FLAC__bool OggFLAC__file_encoder_disable_fixed_subframes(OggFLAC__FileEncoder *encoder, FLAC__bool value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + if(encoder->protected_->state != OggFLAC__FILE_ENCODER_UNINITIALIZED) + return false; + return OggFLAC__seekable_stream_encoder_disable_fixed_subframes(encoder->private_->seekable_stream_encoder, value); +} + +OggFLAC_API FLAC__bool OggFLAC__file_encoder_disable_verbatim_subframes(OggFLAC__FileEncoder *encoder, FLAC__bool value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + if(encoder->protected_->state != OggFLAC__FILE_ENCODER_UNINITIALIZED) + return false; + return OggFLAC__seekable_stream_encoder_disable_verbatim_subframes(encoder->private_->seekable_stream_encoder, value); +} + +OggFLAC_API OggFLAC__FileEncoderState OggFLAC__file_encoder_get_state(const OggFLAC__FileEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->protected_); + return encoder->protected_->state; +} + +OggFLAC_API OggFLAC__SeekableStreamEncoderState OggFLAC__file_encoder_get_seekable_stream_encoder_state(const OggFLAC__FileEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + return OggFLAC__seekable_stream_encoder_get_state(encoder->private_->seekable_stream_encoder); +} + +OggFLAC_API FLAC__StreamEncoderState OggFLAC__file_encoder_get_FLAC_stream_encoder_state(const OggFLAC__FileEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + return OggFLAC__seekable_stream_encoder_get_FLAC_stream_encoder_state(encoder->private_->seekable_stream_encoder); +} + +OggFLAC_API FLAC__StreamDecoderState OggFLAC__file_encoder_get_verify_decoder_state(const OggFLAC__FileEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + return OggFLAC__seekable_stream_encoder_get_verify_decoder_state(encoder->private_->seekable_stream_encoder); +} + +OggFLAC_API const char *OggFLAC__file_encoder_get_resolved_state_string(const OggFLAC__FileEncoder *encoder) +{ + if(encoder->protected_->state != OggFLAC__FILE_ENCODER_SEEKABLE_STREAM_ENCODER_ERROR) + return OggFLAC__FileEncoderStateString[encoder->protected_->state]; + else + return OggFLAC__seekable_stream_encoder_get_resolved_state_string(encoder->private_->seekable_stream_encoder); +} + +OggFLAC_API void OggFLAC__file_encoder_get_verify_decoder_error_stats(const OggFLAC__FileEncoder *encoder, FLAC__uint64 *absolute_sample, unsigned *frame_number, unsigned *channel, unsigned *sample, FLAC__int32 *expected, FLAC__int32 *got) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + OggFLAC__seekable_stream_encoder_get_verify_decoder_error_stats(encoder->private_->seekable_stream_encoder, absolute_sample, frame_number, channel, sample, expected, got); +} + +OggFLAC_API FLAC__bool OggFLAC__file_encoder_get_verify(const OggFLAC__FileEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + return OggFLAC__seekable_stream_encoder_get_verify(encoder->private_->seekable_stream_encoder); +} + +OggFLAC_API FLAC__bool OggFLAC__file_encoder_get_streamable_subset(const OggFLAC__FileEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + return OggFLAC__seekable_stream_encoder_get_streamable_subset(encoder->private_->seekable_stream_encoder); +} + +OggFLAC_API FLAC__bool OggFLAC__file_encoder_get_do_mid_side_stereo(const OggFLAC__FileEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + return OggFLAC__seekable_stream_encoder_get_do_mid_side_stereo(encoder->private_->seekable_stream_encoder); +} + +OggFLAC_API FLAC__bool OggFLAC__file_encoder_get_loose_mid_side_stereo(const OggFLAC__FileEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + return OggFLAC__seekable_stream_encoder_get_loose_mid_side_stereo(encoder->private_->seekable_stream_encoder); +} + +OggFLAC_API unsigned OggFLAC__file_encoder_get_channels(const OggFLAC__FileEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + return OggFLAC__seekable_stream_encoder_get_channels(encoder->private_->seekable_stream_encoder); +} + +OggFLAC_API unsigned OggFLAC__file_encoder_get_bits_per_sample(const OggFLAC__FileEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + return OggFLAC__seekable_stream_encoder_get_bits_per_sample(encoder->private_->seekable_stream_encoder); +} + +OggFLAC_API unsigned OggFLAC__file_encoder_get_sample_rate(const OggFLAC__FileEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + return OggFLAC__seekable_stream_encoder_get_sample_rate(encoder->private_->seekable_stream_encoder); +} + +OggFLAC_API unsigned OggFLAC__file_encoder_get_blocksize(const OggFLAC__FileEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + return OggFLAC__seekable_stream_encoder_get_blocksize(encoder->private_->seekable_stream_encoder); +} + +OggFLAC_API unsigned OggFLAC__file_encoder_get_max_lpc_order(const OggFLAC__FileEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + return OggFLAC__seekable_stream_encoder_get_max_lpc_order(encoder->private_->seekable_stream_encoder); +} + +OggFLAC_API unsigned OggFLAC__file_encoder_get_qlp_coeff_precision(const OggFLAC__FileEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + return OggFLAC__seekable_stream_encoder_get_qlp_coeff_precision(encoder->private_->seekable_stream_encoder); +} + +OggFLAC_API FLAC__bool OggFLAC__file_encoder_get_do_qlp_coeff_prec_search(const OggFLAC__FileEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + return OggFLAC__seekable_stream_encoder_get_do_qlp_coeff_prec_search(encoder->private_->seekable_stream_encoder); +} + +OggFLAC_API FLAC__bool OggFLAC__file_encoder_get_do_escape_coding(const OggFLAC__FileEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + return OggFLAC__seekable_stream_encoder_get_do_escape_coding(encoder->private_->seekable_stream_encoder); +} + +OggFLAC_API FLAC__bool OggFLAC__file_encoder_get_do_exhaustive_model_search(const OggFLAC__FileEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + return OggFLAC__seekable_stream_encoder_get_do_exhaustive_model_search(encoder->private_->seekable_stream_encoder); +} + +OggFLAC_API unsigned OggFLAC__file_encoder_get_min_residual_partition_order(const OggFLAC__FileEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + return OggFLAC__seekable_stream_encoder_get_min_residual_partition_order(encoder->private_->seekable_stream_encoder); +} + +OggFLAC_API unsigned OggFLAC__file_encoder_get_max_residual_partition_order(const OggFLAC__FileEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + return OggFLAC__seekable_stream_encoder_get_max_residual_partition_order(encoder->private_->seekable_stream_encoder); +} + +OggFLAC_API unsigned OggFLAC__file_encoder_get_rice_parameter_search_dist(const OggFLAC__FileEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + return OggFLAC__seekable_stream_encoder_get_rice_parameter_search_dist(encoder->private_->seekable_stream_encoder); +} + +OggFLAC_API FLAC__uint64 OggFLAC__file_encoder_get_total_samples_estimate(const OggFLAC__FileEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + return OggFLAC__seekable_stream_encoder_get_total_samples_estimate(encoder->private_->seekable_stream_encoder); +} + +OggFLAC_API FLAC__bool OggFLAC__file_encoder_process(OggFLAC__FileEncoder *encoder, const FLAC__int32 * const buffer[], unsigned samples) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + if(!OggFLAC__seekable_stream_encoder_process(encoder->private_->seekable_stream_encoder, buffer, samples)) { + encoder->protected_->state = OggFLAC__FILE_ENCODER_SEEKABLE_STREAM_ENCODER_ERROR; + return false; + } + else + return true; +} + +/* 'samples' is channel-wide samples, e.g. for 1 second at 44100Hz, 'samples' = 44100 regardless of the number of channels */ +OggFLAC_API FLAC__bool OggFLAC__file_encoder_process_interleaved(OggFLAC__FileEncoder *encoder, const FLAC__int32 buffer[], unsigned samples) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + if(!OggFLAC__seekable_stream_encoder_process_interleaved(encoder->private_->seekable_stream_encoder, buffer, samples)) { + encoder->protected_->state = OggFLAC__FILE_ENCODER_SEEKABLE_STREAM_ENCODER_ERROR; + return false; + } + else + return true; +} + + +/*********************************************************************** + * + * Private class methods + * + ***********************************************************************/ + +void set_defaults_(OggFLAC__FileEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + + encoder->private_->progress_callback = 0; + encoder->private_->client_data = 0; + encoder->private_->total_frames_estimate = 0; + encoder->private_->filename = 0; +} + +OggFLAC__SeekableStreamEncoderReadStatus read_callback_(const OggFLAC__SeekableStreamEncoder *encoder, FLAC__byte buffer[], unsigned *bytes, void *client_data) +{ + OggFLAC__FileEncoder *file_encoder = (OggFLAC__FileEncoder*)client_data; + + (void)encoder; + + FLAC__ASSERT(0 != file_encoder); + + *bytes = (unsigned)fread(buffer, 1, *bytes, file_encoder->private_->file); + if (*bytes == 0) { + if (feof(file_encoder->private_->file)) + return OggFLAC__SEEKABLE_STREAM_ENCODER_READ_STATUS_END_OF_STREAM; + else if (ferror(file_encoder->private_->file)) + return OggFLAC__SEEKABLE_STREAM_ENCODER_READ_STATUS_ABORT; + } + return OggFLAC__SEEKABLE_STREAM_ENCODER_READ_STATUS_CONTINUE; +} + +FLAC__SeekableStreamEncoderSeekStatus seek_callback_(const OggFLAC__SeekableStreamEncoder *encoder, FLAC__uint64 absolute_byte_offset, void *client_data) +{ + OggFLAC__FileEncoder *file_encoder = (OggFLAC__FileEncoder*)client_data; + + (void)encoder; + + FLAC__ASSERT(0 != file_encoder); + + if(fseek(file_encoder->private_->file, (long)absolute_byte_offset, SEEK_SET) < 0) + return FLAC__SEEKABLE_STREAM_ENCODER_SEEK_STATUS_ERROR; + else + return FLAC__SEEKABLE_STREAM_ENCODER_SEEK_STATUS_OK; +} + +FLAC__SeekableStreamEncoderTellStatus tell_callback_(const OggFLAC__SeekableStreamEncoder *encoder, FLAC__uint64 *absolute_byte_offset, void *client_data) +{ + OggFLAC__FileEncoder *file_encoder = (OggFLAC__FileEncoder*)client_data; + long offset; + + (void)encoder; + + FLAC__ASSERT(0 != file_encoder); + + offset = ftell(file_encoder->private_->file); + + if(offset < 0) { + return FLAC__SEEKABLE_STREAM_ENCODER_TELL_STATUS_ERROR; + } + else { + *absolute_byte_offset = (FLAC__uint64)offset; + return FLAC__SEEKABLE_STREAM_ENCODER_TELL_STATUS_OK; + } +} + +#ifdef FLAC__VALGRIND_TESTING +static size_t local__fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream) +{ + size_t ret = fwrite(ptr, size, nmemb, stream); + if(!ferror(stream)) + fflush(stream); + return ret; +} +#else +#define local__fwrite fwrite +#endif + +FLAC__StreamEncoderWriteStatus write_callback_(const OggFLAC__SeekableStreamEncoder *encoder, const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame, void *client_data) +{ + OggFLAC__FileEncoder *file_encoder = (OggFLAC__FileEncoder*)client_data; + + (void)encoder; + + FLAC__ASSERT(0 != file_encoder); + + if(local__fwrite(buffer, sizeof(FLAC__byte), bytes, file_encoder->private_->file) == bytes) { + file_encoder->private_->bytes_written += bytes; + file_encoder->private_->samples_written += samples; + /* we keep a high watermark on the number of frames written + * because when the encoder goes back to write metadata, + * 'current_frame' will drop back to 0. + */ + file_encoder->private_->frames_written = max(file_encoder->private_->frames_written, current_frame+1); + /*@@@ We would like to add an '&& samples > 0' to the if + * clause here but currently because of the nature of our Ogg + * writing implementation, 'samples' is always 0 (see + * ogg_encoder_aspect.c). The downside is extra progress + * callbacks. + */ + if(0 != file_encoder->private_->progress_callback) + file_encoder->private_->progress_callback(file_encoder, file_encoder->private_->bytes_written, file_encoder->private_->samples_written, file_encoder->private_->frames_written, file_encoder->private_->total_frames_estimate, file_encoder->private_->client_data); + return FLAC__STREAM_ENCODER_WRITE_STATUS_OK; + } + else + return FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR; +} diff --git a/Libraries/FLAC/Files/src/libOggFLAC/include/Makefile.am b/Libraries/FLAC/Files/src/libOggFLAC/include/Makefile.am new file mode 100644 index 000000000..1cc988bea --- /dev/null +++ b/Libraries/FLAC/Files/src/libOggFLAC/include/Makefile.am @@ -0,0 +1,31 @@ +# libOggFLAC - Free Lossless Audio Codec + Ogg library +# Copyright (C) 2002,2003,2004,2005 Josh Coalson +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# - Neither the name of the Xiph.org Foundation nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +SUBDIRS = private protected diff --git a/Libraries/FLAC/Files/src/libOggFLAC/include/Makefile.in b/Libraries/FLAC/Files/src/libOggFLAC/include/Makefile.in new file mode 100644 index 000000000..1b92c5440 --- /dev/null +++ b/Libraries/FLAC/Files/src/libOggFLAC/include/Makefile.in @@ -0,0 +1,543 @@ +# Makefile.in generated by automake 1.8.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# libOggFLAC - Free Lossless Audio Codec + Ogg library +# Copyright (C) 2002,2003,2004,2005 Josh Coalson +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# - Neither the name of the Xiph.org Foundation nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../../.. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_triplet = @host@ +subdir = src/libOggFLAC/include +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(mkdir_p) +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-exec-recursive install-info-recursive \ + install-recursive installcheck-recursive installdirs-recursive \ + pdf-recursive ps-recursive uninstall-info-recursive \ + uninstall-recursive +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCAS = @CCAS@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEBUG_FALSE = @DEBUG_FALSE@ +DEBUG_TRUE = @DEBUG_TRUE@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DOCBOOK_TO_MAN = @DOCBOOK_TO_MAN@ +DOXYGEN = @DOXYGEN@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FLaC__CPU_IA32_FALSE = @FLaC__CPU_IA32_FALSE@ +FLaC__CPU_IA32_TRUE = @FLaC__CPU_IA32_TRUE@ +FLaC__CPU_PPC_FALSE = @FLaC__CPU_PPC_FALSE@ +FLaC__CPU_PPC_TRUE = @FLaC__CPU_PPC_TRUE@ +FLaC__CPU_SPARC_FALSE = @FLaC__CPU_SPARC_FALSE@ +FLaC__CPU_SPARC_TRUE = @FLaC__CPU_SPARC_TRUE@ +FLaC__EXHAUSTIVE_TESTS_FALSE = @FLaC__EXHAUSTIVE_TESTS_FALSE@ +FLaC__EXHAUSTIVE_TESTS_TRUE = @FLaC__EXHAUSTIVE_TESTS_TRUE@ +FLaC__HAS_AS_FALSE = @FLaC__HAS_AS_FALSE@ +FLaC__HAS_AS_TRUE = @FLaC__HAS_AS_TRUE@ +FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@ +FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@ +FLaC__HAS_DOCBOOK_TO_MAN_FALSE = @FLaC__HAS_DOCBOOK_TO_MAN_FALSE@ +FLaC__HAS_DOCBOOK_TO_MAN_TRUE = @FLaC__HAS_DOCBOOK_TO_MAN_TRUE@ +FLaC__HAS_DOXYGEN_FALSE = @FLaC__HAS_DOXYGEN_FALSE@ +FLaC__HAS_DOXYGEN_TRUE = @FLaC__HAS_DOXYGEN_TRUE@ +FLaC__HAS_GAS_FALSE = @FLaC__HAS_GAS_FALSE@ +FLaC__HAS_GAS_TRUE = @FLaC__HAS_GAS_TRUE@ +FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@ +FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@ +FLaC__HAS_NASM_FALSE = @FLaC__HAS_NASM_FALSE@ +FLaC__HAS_NASM_TRUE = @FLaC__HAS_NASM_TRUE@ +FLaC__HAS_OGG_FALSE = @FLaC__HAS_OGG_FALSE@ +FLaC__HAS_OGG_TRUE = @FLaC__HAS_OGG_TRUE@ +FLaC__HAS_XMMS_FALSE = @FLaC__HAS_XMMS_FALSE@ +FLaC__HAS_XMMS_TRUE = @FLaC__HAS_XMMS_TRUE@ +FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE@ +FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE@ +FLaC__NO_ASM_FALSE = @FLaC__NO_ASM_FALSE@ +FLaC__NO_ASM_TRUE = @FLaC__NO_ASM_TRUE@ +FLaC__SSE_OS_FALSE = @FLaC__SSE_OS_FALSE@ +FLaC__SSE_OS_TRUE = @FLaC__SSE_OS_TRUE@ +FLaC__SYS_DARWIN_FALSE = @FLaC__SYS_DARWIN_FALSE@ +FLaC__SYS_DARWIN_TRUE = @FLaC__SYS_DARWIN_TRUE@ +FLaC__SYS_LINUX_FALSE = @FLaC__SYS_LINUX_FALSE@ +FLaC__SYS_LINUX_TRUE = @FLaC__SYS_LINUX_TRUE@ +FLaC__USE_3DNOW_FALSE = @FLaC__USE_3DNOW_FALSE@ +FLaC__USE_3DNOW_TRUE = @FLaC__USE_3DNOW_TRUE@ +FLaC__USE_ALTIVEC_FALSE = @FLaC__USE_ALTIVEC_FALSE@ +FLaC__USE_ALTIVEC_TRUE = @FLaC__USE_ALTIVEC_TRUE@ +FLaC__VALGRIND_TESTING_FALSE = @FLaC__VALGRIND_TESTING_FALSE@ +FLaC__VALGRIND_TESTING_TRUE = @FLaC__VALGRIND_TESTING_TRUE@ +GAS = @GAS@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +NASM = @NASM@ +OBJEXT = @OBJEXT@ +OBJ_FORMAT = @OBJ_FORMAT@ +OGG_CFLAGS = @OGG_CFLAGS@ +OGG_LIBS = @OGG_LIBS@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +XMMS_CFLAGS = @XMMS_CFLAGS@ +XMMS_CONFIG = @XMMS_CONFIG@ +XMMS_DATA_DIR = @XMMS_DATA_DIR@ +XMMS_EFFECT_PLUGIN_DIR = @XMMS_EFFECT_PLUGIN_DIR@ +XMMS_GENERAL_PLUGIN_DIR = @XMMS_GENERAL_PLUGIN_DIR@ +XMMS_INPUT_PLUGIN_DIR = @XMMS_INPUT_PLUGIN_DIR@ +XMMS_LIBS = @XMMS_LIBS@ +XMMS_OUTPUT_PLUGIN_DIR = @XMMS_OUTPUT_PLUGIN_DIR@ +XMMS_PLUGIN_DIR = @XMMS_PLUGIN_DIR@ +XMMS_VERSION = @XMMS_VERSION@ +XMMS_VISUALIZATION_PLUGIN_DIR = @XMMS_VISUALIZATION_PLUGIN_DIR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +SUBDIRS = private protected +all: all-recursive + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/libOggFLAC/include/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/libOggFLAC/include/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || mkdir "$(distdir)/$$subdir" \ + || exit 1; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="../$(top_distdir)" \ + distdir="../$(distdir)/$$subdir" \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-libtool \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-recursive + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-info-am + +uninstall-info: uninstall-info-recursive + +.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \ + clean clean-generic clean-libtool clean-recursive ctags \ + ctags-recursive distclean distclean-generic distclean-libtool \ + distclean-recursive distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-strip installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic maintainer-clean-recursive \ + mostlyclean mostlyclean-generic mostlyclean-libtool \ + mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \ + uninstall uninstall-am uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/Libraries/FLAC/Files/src/libOggFLAC/include/private/Makefile.am b/Libraries/FLAC/Files/src/libOggFLAC/include/private/Makefile.am new file mode 100644 index 000000000..c05794c4d --- /dev/null +++ b/Libraries/FLAC/Files/src/libOggFLAC/include/private/Makefile.am @@ -0,0 +1,36 @@ +# libOggFLAC - Free Lossless Audio Codec + Ogg library +# Copyright (C) 2002,2003,2004,2005 Josh Coalson +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# - Neither the name of the Xiph.org Foundation nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +noinst_HEADERS = \ + all.h \ + ogg_decoder_aspect.h \ + ogg_encoder_aspect.h \ + ogg_helper.h \ + ogg_mapping.h diff --git a/Libraries/FLAC/Files/src/libOggFLAC/include/private/Makefile.in b/Libraries/FLAC/Files/src/libOggFLAC/include/private/Makefile.in new file mode 100644 index 000000000..43f30f72b --- /dev/null +++ b/Libraries/FLAC/Files/src/libOggFLAC/include/private/Makefile.in @@ -0,0 +1,455 @@ +# Makefile.in generated by automake 1.8.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# libOggFLAC - Free Lossless Audio Codec + Ogg library +# Copyright (C) 2002,2003,2004,2005 Josh Coalson +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# - Neither the name of the Xiph.org Foundation nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../../../.. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_triplet = @host@ +subdir = src/libOggFLAC/include/private +DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(mkdir_p) +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +HEADERS = $(noinst_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCAS = @CCAS@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEBUG_FALSE = @DEBUG_FALSE@ +DEBUG_TRUE = @DEBUG_TRUE@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DOCBOOK_TO_MAN = @DOCBOOK_TO_MAN@ +DOXYGEN = @DOXYGEN@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FLaC__CPU_IA32_FALSE = @FLaC__CPU_IA32_FALSE@ +FLaC__CPU_IA32_TRUE = @FLaC__CPU_IA32_TRUE@ +FLaC__CPU_PPC_FALSE = @FLaC__CPU_PPC_FALSE@ +FLaC__CPU_PPC_TRUE = @FLaC__CPU_PPC_TRUE@ +FLaC__CPU_SPARC_FALSE = @FLaC__CPU_SPARC_FALSE@ +FLaC__CPU_SPARC_TRUE = @FLaC__CPU_SPARC_TRUE@ +FLaC__EXHAUSTIVE_TESTS_FALSE = @FLaC__EXHAUSTIVE_TESTS_FALSE@ +FLaC__EXHAUSTIVE_TESTS_TRUE = @FLaC__EXHAUSTIVE_TESTS_TRUE@ +FLaC__HAS_AS_FALSE = @FLaC__HAS_AS_FALSE@ +FLaC__HAS_AS_TRUE = @FLaC__HAS_AS_TRUE@ +FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@ +FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@ +FLaC__HAS_DOCBOOK_TO_MAN_FALSE = @FLaC__HAS_DOCBOOK_TO_MAN_FALSE@ +FLaC__HAS_DOCBOOK_TO_MAN_TRUE = @FLaC__HAS_DOCBOOK_TO_MAN_TRUE@ +FLaC__HAS_DOXYGEN_FALSE = @FLaC__HAS_DOXYGEN_FALSE@ +FLaC__HAS_DOXYGEN_TRUE = @FLaC__HAS_DOXYGEN_TRUE@ +FLaC__HAS_GAS_FALSE = @FLaC__HAS_GAS_FALSE@ +FLaC__HAS_GAS_TRUE = @FLaC__HAS_GAS_TRUE@ +FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@ +FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@ +FLaC__HAS_NASM_FALSE = @FLaC__HAS_NASM_FALSE@ +FLaC__HAS_NASM_TRUE = @FLaC__HAS_NASM_TRUE@ +FLaC__HAS_OGG_FALSE = @FLaC__HAS_OGG_FALSE@ +FLaC__HAS_OGG_TRUE = @FLaC__HAS_OGG_TRUE@ +FLaC__HAS_XMMS_FALSE = @FLaC__HAS_XMMS_FALSE@ +FLaC__HAS_XMMS_TRUE = @FLaC__HAS_XMMS_TRUE@ +FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE@ +FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE@ +FLaC__NO_ASM_FALSE = @FLaC__NO_ASM_FALSE@ +FLaC__NO_ASM_TRUE = @FLaC__NO_ASM_TRUE@ +FLaC__SSE_OS_FALSE = @FLaC__SSE_OS_FALSE@ +FLaC__SSE_OS_TRUE = @FLaC__SSE_OS_TRUE@ +FLaC__SYS_DARWIN_FALSE = @FLaC__SYS_DARWIN_FALSE@ +FLaC__SYS_DARWIN_TRUE = @FLaC__SYS_DARWIN_TRUE@ +FLaC__SYS_LINUX_FALSE = @FLaC__SYS_LINUX_FALSE@ +FLaC__SYS_LINUX_TRUE = @FLaC__SYS_LINUX_TRUE@ +FLaC__USE_3DNOW_FALSE = @FLaC__USE_3DNOW_FALSE@ +FLaC__USE_3DNOW_TRUE = @FLaC__USE_3DNOW_TRUE@ +FLaC__USE_ALTIVEC_FALSE = @FLaC__USE_ALTIVEC_FALSE@ +FLaC__USE_ALTIVEC_TRUE = @FLaC__USE_ALTIVEC_TRUE@ +FLaC__VALGRIND_TESTING_FALSE = @FLaC__VALGRIND_TESTING_FALSE@ +FLaC__VALGRIND_TESTING_TRUE = @FLaC__VALGRIND_TESTING_TRUE@ +GAS = @GAS@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +NASM = @NASM@ +OBJEXT = @OBJEXT@ +OBJ_FORMAT = @OBJ_FORMAT@ +OGG_CFLAGS = @OGG_CFLAGS@ +OGG_LIBS = @OGG_LIBS@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +XMMS_CFLAGS = @XMMS_CFLAGS@ +XMMS_CONFIG = @XMMS_CONFIG@ +XMMS_DATA_DIR = @XMMS_DATA_DIR@ +XMMS_EFFECT_PLUGIN_DIR = @XMMS_EFFECT_PLUGIN_DIR@ +XMMS_GENERAL_PLUGIN_DIR = @XMMS_GENERAL_PLUGIN_DIR@ +XMMS_INPUT_PLUGIN_DIR = @XMMS_INPUT_PLUGIN_DIR@ +XMMS_LIBS = @XMMS_LIBS@ +XMMS_OUTPUT_PLUGIN_DIR = @XMMS_OUTPUT_PLUGIN_DIR@ +XMMS_PLUGIN_DIR = @XMMS_PLUGIN_DIR@ +XMMS_VERSION = @XMMS_VERSION@ +XMMS_VISUALIZATION_PLUGIN_DIR = @XMMS_VISUALIZATION_PLUGIN_DIR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +noinst_HEADERS = \ + all.h \ + ogg_decoder_aspect.h \ + ogg_encoder_aspect.h \ + ogg_helper.h \ + ogg_mapping.h + +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/libOggFLAC/include/private/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/libOggFLAC/include/private/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(HEADERS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-libtool \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool ctags distclean distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ + uninstall-am uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/Libraries/FLAC/Files/src/libOggFLAC/include/private/all.h b/Libraries/FLAC/Files/src/libOggFLAC/include/private/all.h new file mode 100644 index 000000000..a62fcf5a6 --- /dev/null +++ b/Libraries/FLAC/Files/src/libOggFLAC/include/private/all.h @@ -0,0 +1,40 @@ +/* libOggFLAC - Free Lossless Audio Codec + Ogg library + * Copyright (C) 2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef OggFLAC__PRIVATE__ALL_H +#define OggFLAC__PRIVATE__ALL_H + +#include "ogg_decoder_aspect.h" +#include "ogg_encoder_aspect.h" +#include "ogg_helper.h" +#include "ogg_mapping.h" + +#endif diff --git a/Libraries/FLAC/Files/src/libOggFLAC/include/private/ogg_decoder_aspect.h b/Libraries/FLAC/Files/src/libOggFLAC/include/private/ogg_decoder_aspect.h new file mode 100644 index 000000000..e883b1470 --- /dev/null +++ b/Libraries/FLAC/Files/src/libOggFLAC/include/private/ogg_decoder_aspect.h @@ -0,0 +1,79 @@ +/* libOggFLAC - Free Lossless Audio Codec + Ogg library + * Copyright (C) 2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef OggFLAC__PRIVATE__OGG_DECODER_ASPECT_H +#define OggFLAC__PRIVATE__OGG_DECODER_ASPECT_H + +#include + +#include "FLAC/ordinals.h" +#include "FLAC/stream_decoder.h" /* for FLAC__StreamDecoderReadStatus */ + +typedef struct OggFLAC__OggDecoderAspect { + /* these are storage for values that can be set through the API */ + FLAC__bool use_first_serial_number; + long serial_number; + + /* these are for internal state related to Ogg decoding */ + ogg_stream_state stream_state; + ogg_sync_state sync_state; + unsigned version_major, version_minor; + FLAC__bool need_serial_number; + FLAC__bool end_of_stream; + FLAC__bool have_working_page; /* only if true will the following vars be valid */ + ogg_page working_page; + FLAC__bool have_working_packet; /* only if true will the following vars be valid */ + ogg_packet working_packet; /* as we work through the packet we will move working_packet.packet forward and working_packet.bytes down */ +} OggFLAC__OggDecoderAspect; + +void OggFLAC__ogg_decoder_aspect_set_serial_number(OggFLAC__OggDecoderAspect *aspect, long value); +void OggFLAC__ogg_decoder_aspect_set_defaults(OggFLAC__OggDecoderAspect *aspect); +FLAC__bool OggFLAC__ogg_decoder_aspect_init(OggFLAC__OggDecoderAspect *aspect); +void OggFLAC__ogg_decoder_aspect_finish(OggFLAC__OggDecoderAspect *aspect); +void OggFLAC__ogg_decoder_aspect_flush(OggFLAC__OggDecoderAspect *aspect); +void OggFLAC__ogg_decoder_aspect_reset(OggFLAC__OggDecoderAspect *aspect); + +typedef enum { + OggFLAC__OGG_DECODER_ASPECT_READ_STATUS_OK = 0, + OggFLAC__OGG_DECODER_ASPECT_READ_STATUS_END_OF_STREAM, + OggFLAC__OGG_DECODER_ASPECT_READ_STATUS_LOST_SYNC, + OggFLAC__OGG_DECODER_ASPECT_READ_STATUS_NOT_FLAC, + OggFLAC__OGG_DECODER_ASPECT_READ_STATUS_UNSUPPORTED_MAPPING_VERSION, + OggFLAC__OGG_DECODER_ASPECT_READ_STATUS_ABORT, + OggFLAC__OGG_DECODER_ASPECT_READ_STATUS_ERROR, + OggFLAC__OGG_DECODER_ASPECT_READ_STATUS_MEMORY_ALLOCATION_ERROR +} OggFLAC__OggDecoderAspectReadStatus; + +typedef OggFLAC__OggDecoderAspectReadStatus (*OggFLAC__OggDecoderAspectReadCallbackProxy)(const void *decoder, FLAC__byte buffer[], unsigned *bytes, void *client_data); + +OggFLAC__OggDecoderAspectReadStatus OggFLAC__ogg_decoder_aspect_read_callback_wrapper(OggFLAC__OggDecoderAspect *aspect, FLAC__byte buffer[], unsigned *bytes, OggFLAC__OggDecoderAspectReadCallbackProxy read_callback, void *decoder, void *client_data); + +#endif diff --git a/Libraries/FLAC/Files/src/libOggFLAC/include/private/ogg_encoder_aspect.h b/Libraries/FLAC/Files/src/libOggFLAC/include/private/ogg_encoder_aspect.h new file mode 100644 index 000000000..ba8e5a2ba --- /dev/null +++ b/Libraries/FLAC/Files/src/libOggFLAC/include/private/ogg_encoder_aspect.h @@ -0,0 +1,62 @@ +/* libOggFLAC - Free Lossless Audio Codec + Ogg library + * Copyright (C) 2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef OggFLAC__PRIVATE__OGG_ENCODER_ASPECT_H +#define OggFLAC__PRIVATE__OGG_ENCODER_ASPECT_H + +#include + +#include "FLAC/ordinals.h" +#include "FLAC/stream_encoder.h" /* for FLAC__StreamEncoderWriteStatus */ + +typedef struct OggFLAC__OggEncoderAspect { + /* these are storage for values that can be set through the API */ + long serial_number; + unsigned num_metadata; + + /* these are for internal state related to Ogg encoding */ + ogg_stream_state stream_state; + ogg_page page; + FLAC__bool seen_magic; /* true if we've seen the fLaC magic in the write callback yet */ + FLAC__bool is_first_packet; + FLAC__uint64 samples_written; +} OggFLAC__OggEncoderAspect; + +void OggFLAC__ogg_encoder_aspect_set_serial_number(OggFLAC__OggEncoderAspect *aspect, long value); +FLAC__bool OggFLAC__ogg_encoder_aspect_set_num_metadata(OggFLAC__OggEncoderAspect *aspect, unsigned value); +void OggFLAC__ogg_encoder_aspect_set_defaults(OggFLAC__OggEncoderAspect *aspect); +FLAC__bool OggFLAC__ogg_encoder_aspect_init(OggFLAC__OggEncoderAspect *aspect); +void OggFLAC__ogg_encoder_aspect_finish(OggFLAC__OggEncoderAspect *aspect); + +typedef FLAC__StreamEncoderWriteStatus (*OggFLAC__OggEncoderAspectWriteCallbackProxy)(const void *encoder, const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame, void *client_data); + +FLAC__StreamEncoderWriteStatus OggFLAC__ogg_encoder_aspect_write_callback_wrapper(OggFLAC__OggEncoderAspect *aspect, const FLAC__uint64 total_samples_estimate, const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame, OggFLAC__OggEncoderAspectWriteCallbackProxy write_callback, void *encoder, void *client_data); +#endif diff --git a/Libraries/FLAC/Files/src/libOggFLAC/include/private/ogg_helper.h b/Libraries/FLAC/Files/src/libOggFLAC/include/private/ogg_helper.h new file mode 100644 index 000000000..91a07675b --- /dev/null +++ b/Libraries/FLAC/Files/src/libOggFLAC/include/private/ogg_helper.h @@ -0,0 +1,43 @@ +/* libOggFLAC - Free Lossless Audio Codec + Ogg library + * Copyright (C) 2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef OggFLAC__PRIVATE__OGG_HELPER_H +#define OggFLAC__PRIVATE__OGG_HELPER_H + +#include +#include "OggFLAC/seekable_stream_encoder.h" /* for OggFLAC__SeekableStreamEncoder */ + +void simple_ogg_page__init(ogg_page *page); +void simple_ogg_page__clear(ogg_page *page); +FLAC__bool simple_ogg_page__get_at(OggFLAC__SeekableStreamEncoder *encoder, FLAC__uint64 position, ogg_page *page, OggFLAC__SeekableStreamEncoderSeekCallback seek_callback, OggFLAC__SeekableStreamEncoderReadCallback read_callback, void *client_data); +FLAC__bool simple_ogg_page__set_at(OggFLAC__SeekableStreamEncoder *encoder, FLAC__uint64 position, ogg_page *page, OggFLAC__SeekableStreamEncoderSeekCallback seek_callback, OggFLAC__SeekableStreamEncoderWriteCallback write_callback, void *client_data); + +#endif diff --git a/Libraries/FLAC/Files/src/libOggFLAC/include/private/ogg_mapping.h b/Libraries/FLAC/Files/src/libOggFLAC/include/private/ogg_mapping.h new file mode 100644 index 000000000..c8d2f623c --- /dev/null +++ b/Libraries/FLAC/Files/src/libOggFLAC/include/private/ogg_mapping.h @@ -0,0 +1,63 @@ +/* libOggFLAC - Free Lossless Audio Codec + Ogg library + * Copyright (C) 2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef OggFLAC__PRIVATE__OGG_MAPPING_H +#define OggFLAC__PRIVATE__OGG_MAPPING_H + +#include "FLAC/ordinals.h" + +/** The length of the 'FLAC' magic in bytes. */ +#define OggFLAC__MAPPING_PACKET_TYPE_LENGTH (1u) + +extern const unsigned OggFLAC__MAPPING_PACKET_TYPE_LEN; /* = 8 bits */ + +extern const FLAC__byte OggFLAC__MAPPING_FIRST_HEADER_PACKET_TYPE; /* = 0x7f */ + +/** The length of the 'FLAC' magic in bytes. */ +#define OggFLAC__MAPPING_MAGIC_LENGTH (4u) + +extern const FLAC__byte * const OggFLAC__MAPPING_MAGIC; /* = "FLAC" */ + +extern const unsigned OggFLAC__MAPPING_VERSION_MAJOR_LEN; /* = 8 bits */ +extern const unsigned OggFLAC__MAPPING_VERSION_MINOR_LEN; /* = 8 bits */ + +/** The length of the Ogg FLAC mapping major version number in bytes. */ +#define OggFLAC__MAPPING_VERSION_MAJOR_LENGTH (1u) + +/** The length of the Ogg FLAC mapping minor version number in bytes. */ +#define OggFLAC__MAPPING_VERSION_MINOR_LENGTH (1u) + +extern const unsigned OggFLAC__MAPPING_NUM_HEADERS_LEN; /* = 16 bits */ + +/** The length of the #-of-header-packets number bytes. */ +#define OggFLAC__MAPPING_NUM_HEADERS_LENGTH (2u) + +#endif diff --git a/Libraries/FLAC/Files/src/libOggFLAC/include/protected/Makefile.am b/Libraries/FLAC/Files/src/libOggFLAC/include/protected/Makefile.am new file mode 100644 index 000000000..020967f85 --- /dev/null +++ b/Libraries/FLAC/Files/src/libOggFLAC/include/protected/Makefile.am @@ -0,0 +1,38 @@ +# libOggFLAC - Free Lossless Audio Codec + Ogg library +# Copyright (C) 2002,2003,2004,2005 Josh Coalson +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# - Neither the name of the Xiph.org Foundation nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +noinst_HEADERS = \ + all.h \ + file_decoder.h \ + file_encoder.h \ + seekable_stream_decoder.h \ + seekable_stream_encoder.h \ + stream_decoder.h \ + stream_encoder.h diff --git a/Libraries/FLAC/Files/src/libOggFLAC/include/protected/Makefile.in b/Libraries/FLAC/Files/src/libOggFLAC/include/protected/Makefile.in new file mode 100644 index 000000000..811ef0c35 --- /dev/null +++ b/Libraries/FLAC/Files/src/libOggFLAC/include/protected/Makefile.in @@ -0,0 +1,457 @@ +# Makefile.in generated by automake 1.8.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# libOggFLAC - Free Lossless Audio Codec + Ogg library +# Copyright (C) 2002,2003,2004,2005 Josh Coalson +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# - Neither the name of the Xiph.org Foundation nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../../../.. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_triplet = @host@ +subdir = src/libOggFLAC/include/protected +DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(mkdir_p) +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +HEADERS = $(noinst_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCAS = @CCAS@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEBUG_FALSE = @DEBUG_FALSE@ +DEBUG_TRUE = @DEBUG_TRUE@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DOCBOOK_TO_MAN = @DOCBOOK_TO_MAN@ +DOXYGEN = @DOXYGEN@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FLaC__CPU_IA32_FALSE = @FLaC__CPU_IA32_FALSE@ +FLaC__CPU_IA32_TRUE = @FLaC__CPU_IA32_TRUE@ +FLaC__CPU_PPC_FALSE = @FLaC__CPU_PPC_FALSE@ +FLaC__CPU_PPC_TRUE = @FLaC__CPU_PPC_TRUE@ +FLaC__CPU_SPARC_FALSE = @FLaC__CPU_SPARC_FALSE@ +FLaC__CPU_SPARC_TRUE = @FLaC__CPU_SPARC_TRUE@ +FLaC__EXHAUSTIVE_TESTS_FALSE = @FLaC__EXHAUSTIVE_TESTS_FALSE@ +FLaC__EXHAUSTIVE_TESTS_TRUE = @FLaC__EXHAUSTIVE_TESTS_TRUE@ +FLaC__HAS_AS_FALSE = @FLaC__HAS_AS_FALSE@ +FLaC__HAS_AS_TRUE = @FLaC__HAS_AS_TRUE@ +FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@ +FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@ +FLaC__HAS_DOCBOOK_TO_MAN_FALSE = @FLaC__HAS_DOCBOOK_TO_MAN_FALSE@ +FLaC__HAS_DOCBOOK_TO_MAN_TRUE = @FLaC__HAS_DOCBOOK_TO_MAN_TRUE@ +FLaC__HAS_DOXYGEN_FALSE = @FLaC__HAS_DOXYGEN_FALSE@ +FLaC__HAS_DOXYGEN_TRUE = @FLaC__HAS_DOXYGEN_TRUE@ +FLaC__HAS_GAS_FALSE = @FLaC__HAS_GAS_FALSE@ +FLaC__HAS_GAS_TRUE = @FLaC__HAS_GAS_TRUE@ +FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@ +FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@ +FLaC__HAS_NASM_FALSE = @FLaC__HAS_NASM_FALSE@ +FLaC__HAS_NASM_TRUE = @FLaC__HAS_NASM_TRUE@ +FLaC__HAS_OGG_FALSE = @FLaC__HAS_OGG_FALSE@ +FLaC__HAS_OGG_TRUE = @FLaC__HAS_OGG_TRUE@ +FLaC__HAS_XMMS_FALSE = @FLaC__HAS_XMMS_FALSE@ +FLaC__HAS_XMMS_TRUE = @FLaC__HAS_XMMS_TRUE@ +FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE@ +FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE@ +FLaC__NO_ASM_FALSE = @FLaC__NO_ASM_FALSE@ +FLaC__NO_ASM_TRUE = @FLaC__NO_ASM_TRUE@ +FLaC__SSE_OS_FALSE = @FLaC__SSE_OS_FALSE@ +FLaC__SSE_OS_TRUE = @FLaC__SSE_OS_TRUE@ +FLaC__SYS_DARWIN_FALSE = @FLaC__SYS_DARWIN_FALSE@ +FLaC__SYS_DARWIN_TRUE = @FLaC__SYS_DARWIN_TRUE@ +FLaC__SYS_LINUX_FALSE = @FLaC__SYS_LINUX_FALSE@ +FLaC__SYS_LINUX_TRUE = @FLaC__SYS_LINUX_TRUE@ +FLaC__USE_3DNOW_FALSE = @FLaC__USE_3DNOW_FALSE@ +FLaC__USE_3DNOW_TRUE = @FLaC__USE_3DNOW_TRUE@ +FLaC__USE_ALTIVEC_FALSE = @FLaC__USE_ALTIVEC_FALSE@ +FLaC__USE_ALTIVEC_TRUE = @FLaC__USE_ALTIVEC_TRUE@ +FLaC__VALGRIND_TESTING_FALSE = @FLaC__VALGRIND_TESTING_FALSE@ +FLaC__VALGRIND_TESTING_TRUE = @FLaC__VALGRIND_TESTING_TRUE@ +GAS = @GAS@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +NASM = @NASM@ +OBJEXT = @OBJEXT@ +OBJ_FORMAT = @OBJ_FORMAT@ +OGG_CFLAGS = @OGG_CFLAGS@ +OGG_LIBS = @OGG_LIBS@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +XMMS_CFLAGS = @XMMS_CFLAGS@ +XMMS_CONFIG = @XMMS_CONFIG@ +XMMS_DATA_DIR = @XMMS_DATA_DIR@ +XMMS_EFFECT_PLUGIN_DIR = @XMMS_EFFECT_PLUGIN_DIR@ +XMMS_GENERAL_PLUGIN_DIR = @XMMS_GENERAL_PLUGIN_DIR@ +XMMS_INPUT_PLUGIN_DIR = @XMMS_INPUT_PLUGIN_DIR@ +XMMS_LIBS = @XMMS_LIBS@ +XMMS_OUTPUT_PLUGIN_DIR = @XMMS_OUTPUT_PLUGIN_DIR@ +XMMS_PLUGIN_DIR = @XMMS_PLUGIN_DIR@ +XMMS_VERSION = @XMMS_VERSION@ +XMMS_VISUALIZATION_PLUGIN_DIR = @XMMS_VISUALIZATION_PLUGIN_DIR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +noinst_HEADERS = \ + all.h \ + file_decoder.h \ + file_encoder.h \ + seekable_stream_decoder.h \ + seekable_stream_encoder.h \ + stream_decoder.h \ + stream_encoder.h + +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/libOggFLAC/include/protected/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/libOggFLAC/include/protected/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(HEADERS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-libtool \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool ctags distclean distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ + uninstall-am uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/Libraries/FLAC/Files/src/libOggFLAC/include/protected/all.h b/Libraries/FLAC/Files/src/libOggFLAC/include/protected/all.h new file mode 100644 index 000000000..e204acd33 --- /dev/null +++ b/Libraries/FLAC/Files/src/libOggFLAC/include/protected/all.h @@ -0,0 +1,42 @@ +/* libOggFLAC - Free Lossless Audio Codec + Ogg library + * Copyright (C) 2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef OggFLAC__PROTECTED__ALL_H +#define OggFLAC__PROTECTED__ALL_H + +#include "file_decoder.h" +#include "file_encoder.h" +#include "seekable_stream_decoder.h" +#include "seekable_stream_encoder.h" +#include "stream_decoder.h" +#include "stream_encoder.h" + +#endif diff --git a/Libraries/FLAC/Files/src/libOggFLAC/include/protected/file_decoder.h b/Libraries/FLAC/Files/src/libOggFLAC/include/protected/file_decoder.h new file mode 100644 index 000000000..58ca2780a --- /dev/null +++ b/Libraries/FLAC/Files/src/libOggFLAC/include/protected/file_decoder.h @@ -0,0 +1,41 @@ +/* libOggFLAC - Free Lossless Audio Codec + Ogg library + * Copyright (C) 2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef OggFLAC__PROTECTED__FILE_DECODER_H +#define OggFLAC__PROTECTED__FILE_DECODER_H + +#include "OggFLAC/file_decoder.h" + +typedef struct OggFLAC__FileDecoderProtected { + OggFLAC__FileDecoderState state; +} OggFLAC__FileDecoderProtected; + +#endif diff --git a/Libraries/FLAC/Files/src/libOggFLAC/include/protected/file_encoder.h b/Libraries/FLAC/Files/src/libOggFLAC/include/protected/file_encoder.h new file mode 100644 index 000000000..f594edfdc --- /dev/null +++ b/Libraries/FLAC/Files/src/libOggFLAC/include/protected/file_encoder.h @@ -0,0 +1,41 @@ +/* libOggFLAC - Free Lossless Audio Codec + Ogg library + * Copyright (C) 2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef OggFLAC__PROTECTED__FILE_ENCODER_H +#define OggFLAC__PROTECTED__FILE_ENCODER_H + +#include "OggFLAC/file_encoder.h" + +typedef struct OggFLAC__FileEncoderProtected { + OggFLAC__FileEncoderState state; +} OggFLAC__FileEncoderProtected; + +#endif diff --git a/Libraries/FLAC/Files/src/libOggFLAC/include/protected/seekable_stream_decoder.h b/Libraries/FLAC/Files/src/libOggFLAC/include/protected/seekable_stream_decoder.h new file mode 100644 index 000000000..4809845ef --- /dev/null +++ b/Libraries/FLAC/Files/src/libOggFLAC/include/protected/seekable_stream_decoder.h @@ -0,0 +1,42 @@ +/* libOggFLAC - Free Lossless Audio Codec + Ogg library + * Copyright (C) 2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef OggFLAC__PROTECTED__SEEKABLE_STREAM_DECODER_H +#define OggFLAC__PROTECTED__SEEKABLE_STREAM_DECODER_H + +#include "OggFLAC/seekable_stream_decoder.h" + +typedef struct OggFLAC__SeekableStreamDecoderProtected { + FLAC__bool md5_checking; /* if true, generate MD5 signature of decoded data and compare against signature in the STREAMINFO metadata block */ + OggFLAC__SeekableStreamDecoderState state; +} OggFLAC__SeekableStreamDecoderProtected; + +#endif diff --git a/Libraries/FLAC/Files/src/libOggFLAC/include/protected/seekable_stream_encoder.h b/Libraries/FLAC/Files/src/libOggFLAC/include/protected/seekable_stream_encoder.h new file mode 100644 index 000000000..8623900f8 --- /dev/null +++ b/Libraries/FLAC/Files/src/libOggFLAC/include/protected/seekable_stream_encoder.h @@ -0,0 +1,44 @@ +/* libOggFLAC - Free Lossless Audio Codec + Ogg library + * Copyright (C) 2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef OggFLAC__PROTECTED__SEEKABLE_STREAM_ENCODER_H +#define OggFLAC__PROTECTED__SEEKABLE_STREAM_ENCODER_H + +#include "OggFLAC/seekable_stream_encoder.h" +#include "private/ogg_encoder_aspect.h" + +typedef struct OggFLAC__SeekableStreamEncoderProtected { + OggFLAC__SeekableStreamEncoderState state; + OggFLAC__OggEncoderAspect ogg_encoder_aspect; + FLAC__uint64 streaminfo_offset, seektable_offset, audio_offset; +} OggFLAC__SeekableStreamEncoderProtected; + +#endif diff --git a/Libraries/FLAC/Files/src/libOggFLAC/include/protected/stream_decoder.h b/Libraries/FLAC/Files/src/libOggFLAC/include/protected/stream_decoder.h new file mode 100644 index 000000000..a29d1086f --- /dev/null +++ b/Libraries/FLAC/Files/src/libOggFLAC/include/protected/stream_decoder.h @@ -0,0 +1,43 @@ +/* libOggFLAC - Free Lossless Audio Codec + Ogg library + * Copyright (C) 2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef OggFLAC__PROTECTED__STREAM_DECODER_H +#define OggFLAC__PROTECTED__STREAM_DECODER_H + +#include "OggFLAC/stream_decoder.h" +#include "private/ogg_decoder_aspect.h" + +typedef struct OggFLAC__StreamDecoderProtected { + OggFLAC__StreamDecoderState state; + OggFLAC__OggDecoderAspect ogg_decoder_aspect; +} OggFLAC__StreamDecoderProtected; + +#endif diff --git a/Libraries/FLAC/Files/src/libOggFLAC/include/protected/stream_encoder.h b/Libraries/FLAC/Files/src/libOggFLAC/include/protected/stream_encoder.h new file mode 100644 index 000000000..d860adf4d --- /dev/null +++ b/Libraries/FLAC/Files/src/libOggFLAC/include/protected/stream_encoder.h @@ -0,0 +1,43 @@ +/* libOggFLAC - Free Lossless Audio Codec + Ogg library + * Copyright (C) 2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef OggFLAC__PROTECTED__STREAM_ENCODER_H +#define OggFLAC__PROTECTED__STREAM_ENCODER_H + +#include "OggFLAC/stream_encoder.h" +#include "private/ogg_encoder_aspect.h" + +typedef struct OggFLAC__StreamEncoderProtected { + OggFLAC__StreamEncoderState state; + OggFLAC__OggEncoderAspect ogg_encoder_aspect; +} OggFLAC__StreamEncoderProtected; + +#endif diff --git a/Libraries/FLAC/Files/src/libOggFLAC/libOggFLAC.m4 b/Libraries/FLAC/Files/src/libOggFLAC/libOggFLAC.m4 new file mode 100644 index 000000000..a04623f6c --- /dev/null +++ b/Libraries/FLAC/Files/src/libOggFLAC/libOggFLAC.m4 @@ -0,0 +1,104 @@ +# Configure paths for libOggFLAC +# "Inspired" by ogg.m4 + +dnl AM_PATH_LIBOGGFLAC([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) +dnl Test for libOggFLAC, and define LIBOGGFLAC_CFLAGS and LIBOGGFLAC_LIBS +dnl +AC_DEFUN([AM_PATH_LIBOGGFLAC], +[dnl +dnl Get the cflags and libraries +dnl +AC_ARG_WITH(libOggFLAC,[ --with-libOggFLAC=PFX Prefix where libOggFLAC is installed (optional)], libOggFLAC_prefix="$withval", libOggFLAC_prefix="") +AC_ARG_WITH(libOggFLAC-libraries,[ --with-libOggFLAC-libraries=DIR Directory where libOggFLAC library is installed (optional)], libOggFLAC_libraries="$withval", libOggFLAC_libraries="") +AC_ARG_WITH(libOggFLAC-includes,[ --with-libOggFLAC-includes=DIR Directory where libOggFLAC header files are installed (optional)], libOggFLAC_includes="$withval", libOggFLAC_includes="") +AC_ARG_ENABLE(libOggFLACtest, [ --disable-libOggFLACtest Do not try to compile and run a test libOggFLAC program],, enable_libOggFLACtest=yes) + + if test "x$libOggFLAC_libraries" != "x" ; then + LIBOGGFLAC_LIBS="-L$libOggFLAC_libraries" + elif test "x$libOggFLAC_prefix" != "x" ; then + LIBOGGFLAC_LIBS="-L$libOggFLAC_prefix/lib" + elif test "x$prefix" != "xNONE" ; then + LIBOGGFLAC_LIBS="-L$libdir" + fi + + LIBOGGFLAC_LIBS="$LIBOGGFLAC_LIBS -lOggFLAC -lFLAC -lm" + + if test "x$libOggFLAC_includes" != "x" ; then + LIBOGGFLAC_CFLAGS="-I$libOggFLAC_includes" + elif test "x$libOggFLAC_prefix" != "x" ; then + LIBOGGFLAC_CFLAGS="-I$libOggFLAC_prefix/include" + elif test "$prefix" != "xNONE"; then + LIBOGGFLAC_CFLAGS="-I$prefix/include" + fi + + AC_MSG_CHECKING(for libOggFLAC) + no_libOggFLAC="" + + + if test "x$enable_libOggFLACtest" = "xyes" ; then + ac_save_CFLAGS="$CFLAGS" + ac_save_CXXFLAGS="$CXXFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $LIBOGGFLAC_CFLAGS" + CXXFLAGS="$CXXFLAGS $LIBOGGFLAC_CFLAGS" + LIBS="$LIBS $LIBOGGFLAC_LIBS" +dnl +dnl Now check if the installed libOggFLAC is sufficiently new. +dnl + rm -f conf.libOggFLACtest + AC_TRY_RUN([ +#include +#include +#include +#include + +int main () +{ + system("touch conf.libOggFLACtest"); + return 0; +} + +],, no_libOggFLAC=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + + if test "x$no_libOggFLAC" = "x" ; then + AC_MSG_RESULT(yes) + ifelse([$1], , :, [$1]) + else + AC_MSG_RESULT(no) + if test -f conf.libOggFLACtest ; then + : + else + echo "*** Could not run libOggFLAC test program, checking why..." + CFLAGS="$CFLAGS $LIBOGGFLAC_CFLAGS" + LIBS="$LIBS $LIBOGGFLAC_LIBS" + AC_TRY_LINK([ +#include +#include +], [ return 0; ], + [ echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding libOggFLAC or finding the wrong" + echo "*** version of libOggFLAC. If it is not finding libOggFLAC, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], + [ echo "*** The test program failed to compile or link. See the file config.log for the" + echo "*** exact error that occured. This usually means libOggFLAC was incorrectly installed" + echo "*** or that you have moved libOggFLAC since it was installed. In the latter case, you" + echo "*** may want to edit the libOggFLAC-config script: $LIBOGGFLAC_CONFIG" ]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + LIBOGGFLAC_CFLAGS="" + LIBOGGFLAC_LIBS="" + ifelse([$2], , :, [$2]) + fi + AC_SUBST(LIBOGGFLAC_CFLAGS) + AC_SUBST(LIBOGGFLAC_LIBS) + rm -f conf.libOggFLACtest +]) diff --git a/Libraries/FLAC/Files/src/libOggFLAC/libOggFLAC_dynamic.dsp b/Libraries/FLAC/Files/src/libOggFLAC/libOggFLAC_dynamic.dsp new file mode 100644 index 000000000..0f69b5831 --- /dev/null +++ b/Libraries/FLAC/Files/src/libOggFLAC/libOggFLAC_dynamic.dsp @@ -0,0 +1,227 @@ +# Microsoft Developer Studio Project File - Name="libOggFLAC_dynamic" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=libOggFLAC_dynamic - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "libOggFLAC_dynamic.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "libOggFLAC_dynamic.mak" CFG="libOggFLAC_dynamic - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "libOggFLAC_dynamic - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "libOggFLAC_dynamic - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "libOggFLAC" +# PROP Scc_LocalPath "..\.." +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "libOggFLAC_dynamic - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "..\..\obj\release\lib" +# PROP Intermediate_Dir "Release_dynamic" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GR /GX /O2 /I ".\include" /I "..\..\include" /D "NDEBUG" /D "OggFLAC_API_EXPORTS" /D "_WINDOWS" /D "_WINDLL" /D "WIN32" /D "_USRDLL" /FR /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" /d "_USRDLL" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +# ADD LINK32 ..\..\obj\release\lib\libFLAC.lib ..\..\obj\release\lib\ogg_static.lib /nologo /subsystem:windows /dll /machine:I386 /out:"..\..\obj\release\bin/libOggFLAC.dll" + +!ELSEIF "$(CFG)" == "libOggFLAC_dynamic - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "..\..\obj\debug\lib" +# PROP Intermediate_Dir "Debug_dynamic" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /I ".\include" /I "..\..\include" /D "_DEBUG" /D "OggFLAC_API_EXPORTS" /D "_WINDOWS" /D "_WINDLL" /D "WIN32" /D "_USRDLL" /FR /FD /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" /d "_USRDLL" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 ..\..\obj\debug\lib\libFLAC.lib ..\..\obj\release\lib\ogg_static.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:"..\..\obj\debug\bin/libOggFLAC.dll" /pdbtype:sept + +!ENDIF + +# Begin Target + +# Name "libOggFLAC_dynamic - Win32 Release" +# Name "libOggFLAC_dynamic - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "c" +# Begin Source File + +SOURCE=.\file_decoder.c +# End Source File +# Begin Source File + +SOURCE=.\file_encoder.c +# End Source File +# Begin Source File + +SOURCE=.\ogg_decoder_aspect.c +# End Source File +# Begin Source File + +SOURCE=.\ogg_encoder_aspect.c +# End Source File +# Begin Source File + +SOURCE=.\ogg_helper.c +# End Source File +# Begin Source File + +SOURCE=.\ogg_mapping.c +# End Source File +# Begin Source File + +SOURCE=.\seekable_stream_decoder.c +# End Source File +# Begin Source File + +SOURCE=.\seekable_stream_encoder.c +# End Source File +# Begin Source File + +SOURCE=.\stream_decoder.c +# End Source File +# Begin Source File + +SOURCE=.\stream_encoder.c +# End Source File +# End Group +# Begin Group "Private Header Files" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=.\include\private\all.h +# End Source File +# Begin Source File + +SOURCE=.\include\private\ogg_decoder_aspect.h +# End Source File +# Begin Source File + +SOURCE=.\include\private\ogg_encoder_aspect.h +# End Source File +# Begin Source File + +SOURCE=.\include\private\ogg_helper.h +# End Source File +# Begin Source File + +SOURCE=.\include\private\ogg_mapping.h +# End Source File +# End Group +# Begin Group "Protected Header Files" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=.\include\protected\all.h +# End Source File +# Begin Source File + +SOURCE=.\include\protected\file_decoder.h +# End Source File +# Begin Source File + +SOURCE=.\include\protected\file_encoder.h +# End Source File +# Begin Source File + +SOURCE=.\include\protected\seekable_stream_decoder.h +# End Source File +# Begin Source File + +SOURCE=.\include\protected\seekable_stream_encoder.h +# End Source File +# Begin Source File + +SOURCE=.\include\protected\stream_decoder.h +# End Source File +# Begin Source File + +SOURCE=.\include\protected\stream_encoder.h +# End Source File +# End Group +# Begin Group "Public Header Files" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=..\..\include\OggFLAC\all.h +# End Source File +# Begin Source File + +SOURCE=..\..\include\OggFLAC\export.h +# End Source File +# Begin Source File + +SOURCE=..\..\include\OggFLAC\file_decoder.h +# End Source File +# Begin Source File + +SOURCE=..\..\include\OggFLAC\file_encoder.h +# End Source File +# Begin Source File + +SOURCE=..\..\include\OggFLAC\seekable_stream_decoder.h +# End Source File +# Begin Source File + +SOURCE=..\..\include\OggFLAC\seekable_stream_encoder.h +# End Source File +# Begin Source File + +SOURCE=..\..\include\OggFLAC\stream_decoder.h +# End Source File +# Begin Source File + +SOURCE=..\..\include\OggFLAC\stream_encoder.h +# End Source File +# End Group +# End Target +# End Project diff --git a/Libraries/FLAC/Files/src/libOggFLAC/libOggFLAC_static.dsp b/Libraries/FLAC/Files/src/libOggFLAC/libOggFLAC_static.dsp new file mode 100644 index 000000000..03d50d2c1 --- /dev/null +++ b/Libraries/FLAC/Files/src/libOggFLAC/libOggFLAC_static.dsp @@ -0,0 +1,220 @@ +# Microsoft Developer Studio Project File - Name="libOggFLAC_static" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Static Library" 0x0104 + +CFG=libOggFLAC_static - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "libOggFLAC_static.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "libOggFLAC_static.mak" CFG="libOggFLAC_static - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "libOggFLAC_static - Win32 Release" (based on "Win32 (x86) Static Library") +!MESSAGE "libOggFLAC_static - Win32 Debug" (based on "Win32 (x86) Static Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "libOggFLAC" +# PROP Scc_LocalPath "..\.." +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "libOggFLAC_static - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "..\..\obj\release\lib" +# PROP Intermediate_Dir "Release_static" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I ".\include" /I "..\..\include" /D "FLAC__NO_DLL" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo /nodefaultlib + +!ELSEIF "$(CFG)" == "libOggFLAC_static - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "..\..\obj\debug\lib" +# PROP Intermediate_Dir "Debug_static" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".\include" /I "..\..\include" /D "FLAC__NO_DLL" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo /nodefaultlib + +!ENDIF + +# Begin Target + +# Name "libOggFLAC_static - Win32 Release" +# Name "libOggFLAC_static - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "c" +# Begin Source File + +SOURCE=.\file_decoder.c +# End Source File +# Begin Source File + +SOURCE=.\file_encoder.c +# End Source File +# Begin Source File + +SOURCE=.\ogg_decoder_aspect.c +# End Source File +# Begin Source File + +SOURCE=.\ogg_encoder_aspect.c +# End Source File +# Begin Source File + +SOURCE=.\ogg_helper.c +# End Source File +# Begin Source File + +SOURCE=.\ogg_mapping.c +# End Source File +# Begin Source File + +SOURCE=.\seekable_stream_decoder.c +# End Source File +# Begin Source File + +SOURCE=.\seekable_stream_encoder.c +# End Source File +# Begin Source File + +SOURCE=.\stream_decoder.c +# End Source File +# Begin Source File + +SOURCE=.\stream_encoder.c +# End Source File +# End Group +# Begin Group "Private Header Files" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=.\include\private\all.h +# End Source File +# Begin Source File + +SOURCE=.\include\private\ogg_decoder_aspect.h +# End Source File +# Begin Source File + +SOURCE=.\include\private\ogg_encoder_aspect.h +# End Source File +# Begin Source File + +SOURCE=.\include\private\ogg_helper.h +# End Source File +# Begin Source File + +SOURCE=.\include\private\ogg_mapping.h +# End Source File +# End Group +# Begin Group "Protected Header Files" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=.\include\protected\all.h +# End Source File +# Begin Source File + +SOURCE=.\include\protected\file_decoder.h +# End Source File +# Begin Source File + +SOURCE=.\include\protected\file_encoder.h +# End Source File +# Begin Source File + +SOURCE=.\include\protected\seekable_stream_decoder.h +# End Source File +# Begin Source File + +SOURCE=.\include\protected\seekable_stream_encoder.h +# End Source File +# Begin Source File + +SOURCE=.\include\protected\stream_decoder.h +# End Source File +# Begin Source File + +SOURCE=.\include\protected\stream_encoder.h +# End Source File +# End Group +# Begin Group "Public Header Files" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=..\..\include\OggFLAC\all.h +# End Source File +# Begin Source File + +SOURCE=..\..\include\OggFLAC\export.h +# End Source File +# Begin Source File + +SOURCE=..\..\include\OggFLAC\file_decoder.h +# End Source File +# Begin Source File + +SOURCE=..\..\include\OggFLAC\file_encoder.h +# End Source File +# Begin Source File + +SOURCE=..\..\include\OggFLAC\seekable_stream_decoder.h +# End Source File +# Begin Source File + +SOURCE=..\..\include\OggFLAC\seekable_stream_encoder.h +# End Source File +# Begin Source File + +SOURCE=..\..\include\OggFLAC\stream_decoder.h +# End Source File +# Begin Source File + +SOURCE=..\..\include\OggFLAC\stream_encoder.h +# End Source File +# End Group +# End Target +# End Project diff --git a/Libraries/FLAC/Files/src/libOggFLAC/ogg_decoder_aspect.c b/Libraries/FLAC/Files/src/libOggFLAC/ogg_decoder_aspect.c new file mode 100644 index 000000000..06efd7e2c --- /dev/null +++ b/Libraries/FLAC/Files/src/libOggFLAC/ogg_decoder_aspect.c @@ -0,0 +1,249 @@ +/* libOggFLAC - Free Lossless Audio Codec + Ogg library + * Copyright (C) 2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include /* for memcpy() */ +#include "FLAC/assert.h" +#include "private/ogg_decoder_aspect.h" +#include "private/ogg_mapping.h" + +#ifdef max +#undef max +#endif +#define max(x,y) ((x)>(y)?(x):(y)) + +/*********************************************************************** + * + * Public class methods + * + ***********************************************************************/ + +FLAC__bool OggFLAC__ogg_decoder_aspect_init(OggFLAC__OggDecoderAspect *aspect) +{ + /* we will determine the serial number later if necessary */ + if(ogg_stream_init(&aspect->stream_state, aspect->serial_number) != 0) + return false; + + if(ogg_sync_init(&aspect->sync_state) != 0) + return false; + + aspect->version_major = ~(0u); + aspect->version_minor = ~(0u); + + aspect->need_serial_number = aspect->use_first_serial_number; + + aspect->end_of_stream = false; + aspect->have_working_page = false; + + return true; +} + +void OggFLAC__ogg_decoder_aspect_finish(OggFLAC__OggDecoderAspect *aspect) +{ + (void)ogg_sync_clear(&aspect->sync_state); + (void)ogg_stream_clear(&aspect->stream_state); +} + +void OggFLAC__ogg_decoder_aspect_set_serial_number(OggFLAC__OggDecoderAspect *aspect, long value) +{ + aspect->use_first_serial_number = false; + aspect->serial_number = value; +} + +void OggFLAC__ogg_decoder_aspect_set_defaults(OggFLAC__OggDecoderAspect *aspect) +{ + aspect->use_first_serial_number = true; +} + +void OggFLAC__ogg_decoder_aspect_flush(OggFLAC__OggDecoderAspect *aspect) +{ + (void)ogg_stream_reset(&aspect->stream_state); + (void)ogg_sync_reset(&aspect->sync_state); + aspect->end_of_stream = false; + aspect->have_working_page = false; +} + +void OggFLAC__ogg_decoder_aspect_reset(OggFLAC__OggDecoderAspect *aspect) +{ + OggFLAC__ogg_decoder_aspect_flush(aspect); + + if(aspect->use_first_serial_number) + aspect->need_serial_number = true; +} + +OggFLAC__OggDecoderAspectReadStatus OggFLAC__ogg_decoder_aspect_read_callback_wrapper(OggFLAC__OggDecoderAspect *aspect, FLAC__byte buffer[], unsigned *bytes, OggFLAC__OggDecoderAspectReadCallbackProxy read_callback, void *decoder, void *client_data) +{ + static const unsigned OGG_BYTES_CHUNK = 8192; + const unsigned bytes_requested = *bytes; + + /* + * The FLAC decoding API uses pull-based reads, whereas Ogg decoding + * is push-based. In libFLAC, when you ask to decode a frame, the + * decoder will eventually call the read callback to supply some data, + * but how much it asks for depends on how much free space it has in + * its internal buffer. It does not try to grow its internal buffer + * to accomodate a whole frame because then the internal buffer size + * could not be limited, which is necessary in embedded applications. + * + * Ogg however grows its internal buffer until a whole page is present; + * only then can you get decoded data out. So we can't just ask for + * the same number of bytes from Ogg, then pass what's decoded down to + * libFLAC. If what libFLAC is asking for will not contain a whole + * page, then we will get no data from ogg_sync_pageout(), and at the + * same time cannot just read more data from the client for the purpose + * of getting a whole decoded page because the decoded size might be + * larger than libFLAC's internal buffer. + * + * Instead, whenever this read callback wrapper is called, we will + * continually request data from the client until we have at least one + * page, and manage pages internally so that we can send pieces of + * pages down to libFLAC in such a way that we obey its size + * requirement. To limit the amount of callbacks, we will always try + * to read in enough pages to return the full number of bytes + * requested. + */ + *bytes = 0; + while (*bytes < bytes_requested && !aspect->end_of_stream) { + if (aspect->have_working_page) { + if (aspect->have_working_packet) { + unsigned n = bytes_requested - *bytes; + if ((unsigned)aspect->working_packet.bytes <= n) { + /* the rest of the packet will fit in the buffer */ + n = aspect->working_packet.bytes; + memcpy(buffer, aspect->working_packet.packet, n); + *bytes += n; + buffer += n; + aspect->have_working_packet = false; + } + else { + /* only n bytes of the packet will fit in the buffer */ + memcpy(buffer, aspect->working_packet.packet, n); + *bytes += n; + buffer += n; + aspect->working_packet.packet += n; + aspect->working_packet.bytes -= n; + } + } + else { + /* try and get another packet */ + const int ret = ogg_stream_packetout(&aspect->stream_state, &aspect->working_packet); + if (ret > 0) { + aspect->have_working_packet = true; + /* if it is the first header packet, check for magic and a supported Ogg FLAC mapping version */ + if (aspect->working_packet.bytes > 0 && aspect->working_packet.packet[0] == OggFLAC__MAPPING_FIRST_HEADER_PACKET_TYPE) { + const FLAC__byte *b = aspect->working_packet.packet; + const unsigned header_length = + OggFLAC__MAPPING_PACKET_TYPE_LENGTH + + OggFLAC__MAPPING_MAGIC_LENGTH + + OggFLAC__MAPPING_VERSION_MAJOR_LENGTH + + OggFLAC__MAPPING_VERSION_MINOR_LENGTH + + OggFLAC__MAPPING_NUM_HEADERS_LENGTH; + if (aspect->working_packet.bytes < (long)header_length) + return OggFLAC__OGG_DECODER_ASPECT_READ_STATUS_NOT_FLAC; + b += OggFLAC__MAPPING_PACKET_TYPE_LENGTH; + if (memcmp(b, OggFLAC__MAPPING_MAGIC, OggFLAC__MAPPING_MAGIC_LENGTH)) + return OggFLAC__OGG_DECODER_ASPECT_READ_STATUS_NOT_FLAC; + b += OggFLAC__MAPPING_MAGIC_LENGTH; + aspect->version_major = (unsigned)(*b); + b += OggFLAC__MAPPING_VERSION_MAJOR_LENGTH; + aspect->version_minor = (unsigned)(*b); + if (aspect->version_major != 1) + return OggFLAC__OGG_DECODER_ASPECT_READ_STATUS_UNSUPPORTED_MAPPING_VERSION; + aspect->working_packet.packet += header_length; + aspect->working_packet.bytes -= header_length; + } + } + else if (ret == 0) { + aspect->have_working_page = false; + } + else { /* ret < 0 */ + /* lost sync, we'll leave the working page for the next call */ + return OggFLAC__OGG_DECODER_ASPECT_READ_STATUS_LOST_SYNC; + } + } + } + else { + /* try and get another page */ + const int ret = ogg_sync_pageout(&aspect->sync_state, &aspect->working_page); + if (ret > 0) { + /* got a page, grab the serial number if necessary */ + if(aspect->need_serial_number) { + aspect->stream_state.serialno = aspect->serial_number = ogg_page_serialno(&aspect->working_page); + aspect->need_serial_number = false; + } + if(ogg_stream_pagein(&aspect->stream_state, &aspect->working_page) == 0) { + aspect->have_working_page = true; + aspect->have_working_packet = false; + } + /* else do nothing, could be a page from another stream */ + } + else if (ret == 0) { + /* need more data */ + const unsigned ogg_bytes_to_read = max(bytes_requested - *bytes, OGG_BYTES_CHUNK); + char *oggbuf = ogg_sync_buffer(&aspect->sync_state, ogg_bytes_to_read); + + if(0 == oggbuf) { + return OggFLAC__OGG_DECODER_ASPECT_READ_STATUS_MEMORY_ALLOCATION_ERROR; + } + else { + unsigned ogg_bytes_read = ogg_bytes_to_read; + + switch(read_callback(decoder, (FLAC__byte*)oggbuf, &ogg_bytes_read, client_data)) { + case OggFLAC__OGG_DECODER_ASPECT_READ_STATUS_OK: + break; + case OggFLAC__OGG_DECODER_ASPECT_READ_STATUS_END_OF_STREAM: + aspect->end_of_stream = true; + break; + case OggFLAC__OGG_DECODER_ASPECT_READ_STATUS_ABORT: + return OggFLAC__OGG_DECODER_ASPECT_READ_STATUS_ABORT; + default: + FLAC__ASSERT(0); + } + + if(ogg_sync_wrote(&aspect->sync_state, ogg_bytes_read) < 0) { + /* double protection; this will happen if the read callback returns more bytes than the max requested, which would overflow Ogg's internal buffer */ + FLAC__ASSERT(0); + return OggFLAC__OGG_DECODER_ASPECT_READ_STATUS_ERROR; + } + } + } + else { /* ret < 0 */ + /* lost sync, bail out */ + return OggFLAC__OGG_DECODER_ASPECT_READ_STATUS_LOST_SYNC; + } + } + } + + if (aspect->end_of_stream && *bytes == 0) { + return OggFLAC__OGG_DECODER_ASPECT_READ_STATUS_END_OF_STREAM; + } + + return OggFLAC__OGG_DECODER_ASPECT_READ_STATUS_OK; +} diff --git a/Libraries/FLAC/Files/src/libOggFLAC/ogg_encoder_aspect.c b/Libraries/FLAC/Files/src/libOggFLAC/ogg_encoder_aspect.c new file mode 100644 index 000000000..43e23525a --- /dev/null +++ b/Libraries/FLAC/Files/src/libOggFLAC/ogg_encoder_aspect.c @@ -0,0 +1,218 @@ +/* libOggFLAC - Free Lossless Audio Codec + Ogg library + * Copyright (C) 2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include /* for memset() */ +#include "FLAC/assert.h" +#include "private/ogg_encoder_aspect.h" +#include "private/ogg_mapping.h" + +static const FLAC__byte OggFLAC__MAPPING_VERSION_MAJOR = 1; +static const FLAC__byte OggFLAC__MAPPING_VERSION_MINOR = 0; + +/*********************************************************************** + * + * Public class methods + * + ***********************************************************************/ + +FLAC__bool OggFLAC__ogg_encoder_aspect_init(OggFLAC__OggEncoderAspect *aspect) +{ + /* we will determine the serial number later if necessary */ + if(ogg_stream_init(&aspect->stream_state, aspect->serial_number) != 0) + return false; + + aspect->seen_magic = false; + aspect->is_first_packet = true; + aspect->samples_written = 0; + + return true; +} + +void OggFLAC__ogg_encoder_aspect_finish(OggFLAC__OggEncoderAspect *aspect) +{ + (void)ogg_stream_clear(&aspect->stream_state); + /*@@@ what aobut the page? */ +} + +void OggFLAC__ogg_encoder_aspect_set_serial_number(OggFLAC__OggEncoderAspect *aspect, long value) +{ + aspect->serial_number = value; +} + +FLAC__bool OggFLAC__ogg_encoder_aspect_set_num_metadata(OggFLAC__OggEncoderAspect *aspect, unsigned value) +{ + if(value < (1u << OggFLAC__MAPPING_NUM_HEADERS_LEN)) { + aspect->num_metadata = value; + return true; + } + else + return false; +} + +void OggFLAC__ogg_encoder_aspect_set_defaults(OggFLAC__OggEncoderAspect *aspect) +{ + aspect->serial_number = 0; + aspect->num_metadata = 0; +} + +/* + * The basic FLAC -> Ogg mapping goes like this: + * + * - 'fLaC' magic and STREAMINFO block get combined into the first + * packet. The packet is prefixed with + * + the one-byte packet type 0x7F + * + 'FLAC' magic + * + the 2 byte Ogg FLAC mapping version number + * + tne 2 byte big-endian # of header packets + * - The first packet is flushed to the first page. + * - Each subsequent metadata block goes into its own packet. + * - Each metadata packet is flushed to page (this is not required, + * the mapping only requires that a flush must occur after all + * metadata is written). + * - Each subsequent FLAC audio frame goes into its own packet. + * + * WATCHOUT: + * This depends on the behavior of FLAC__StreamEncoder that we get a + * separate write callback for the fLaC magic, and then separate write + * callbacks for each metadata block and audio frame. + */ +FLAC__StreamEncoderWriteStatus OggFLAC__ogg_encoder_aspect_write_callback_wrapper(OggFLAC__OggEncoderAspect *aspect, const FLAC__uint64 total_samples_estimate, const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame, OggFLAC__OggEncoderAspectWriteCallbackProxy write_callback, void *encoder, void *client_data) +{ + /* WATCHOUT: + * This depends on the behavior of FLAC__StreamEncoder that 'samples' + * will be 0 for metadata writes. + */ + const FLAC__bool is_metadata = (samples == 0); + + /* + * Treat fLaC magic packet specially. We will note when we see it, then + * wait until we get the STREAMINFO and prepend it in that packet + */ + if(aspect->seen_magic) { + ogg_packet packet; + FLAC__byte synthetic_first_packet_body[ + OggFLAC__MAPPING_PACKET_TYPE_LENGTH + + OggFLAC__MAPPING_MAGIC_LENGTH + + OggFLAC__MAPPING_VERSION_MAJOR_LENGTH + + OggFLAC__MAPPING_VERSION_MINOR_LENGTH + + OggFLAC__MAPPING_NUM_HEADERS_LENGTH + + FLAC__STREAM_SYNC_LENGTH + + FLAC__STREAM_METADATA_HEADER_LENGTH + + FLAC__STREAM_METADATA_STREAMINFO_LENGTH + ]; + + memset(&packet, 0, sizeof(packet)); + packet.granulepos = aspect->samples_written + samples; + + if(aspect->is_first_packet) { + FLAC__byte *b = synthetic_first_packet_body; + if(bytes != FLAC__STREAM_METADATA_HEADER_LENGTH + FLAC__STREAM_METADATA_STREAMINFO_LENGTH) { + /* + * If we get here, our assumption about the way write callbacks happen + * explained above is wrong + */ + FLAC__ASSERT(0); + return FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR; + } + /* add first header packet type */ + *b = OggFLAC__MAPPING_FIRST_HEADER_PACKET_TYPE; + b += OggFLAC__MAPPING_PACKET_TYPE_LENGTH; + /* add 'FLAC' mapping magic */ + memcpy(b, OggFLAC__MAPPING_MAGIC, OggFLAC__MAPPING_MAGIC_LENGTH); + b += OggFLAC__MAPPING_MAGIC_LENGTH; + /* add Ogg FLAC mapping major version number */ + memcpy(b, &OggFLAC__MAPPING_VERSION_MAJOR, OggFLAC__MAPPING_VERSION_MAJOR_LENGTH); + b += OggFLAC__MAPPING_VERSION_MAJOR_LENGTH; + /* add Ogg FLAC mapping minor version number */ + memcpy(b, &OggFLAC__MAPPING_VERSION_MINOR, OggFLAC__MAPPING_VERSION_MINOR_LENGTH); + b += OggFLAC__MAPPING_VERSION_MINOR_LENGTH; + /* add number of header packets */ + *b = (FLAC__byte)(aspect->num_metadata >> 8); + b++; + *b = (FLAC__byte)(aspect->num_metadata); + b++; + /* add native FLAC 'fLaC' magic */ + memcpy(b, FLAC__STREAM_SYNC_STRING, FLAC__STREAM_SYNC_LENGTH); + b += FLAC__STREAM_SYNC_LENGTH; + /* add STREAMINFO */ + memcpy(b, buffer, bytes); + FLAC__ASSERT(b + bytes - synthetic_first_packet_body == sizeof(synthetic_first_packet_body)); + packet.packet = (unsigned char *)synthetic_first_packet_body; + packet.bytes = sizeof(synthetic_first_packet_body); + + packet.b_o_s = 1; + aspect->is_first_packet = false; + } + else { + packet.packet = (unsigned char *)buffer; + packet.bytes = bytes; + } + + if(total_samples_estimate > 0 && total_samples_estimate == aspect->samples_written + samples) + packet.e_o_s = 1; + + if(ogg_stream_packetin(&aspect->stream_state, &packet) != 0) + return FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR; + + /*@@@ can't figure out a way to pass a useful number for 'samples' to the write_callback, so we'll just pass 0 */ + if(is_metadata) { + while(ogg_stream_flush(&aspect->stream_state, &aspect->page) != 0) { + if(write_callback(encoder, aspect->page.header, aspect->page.header_len, 0, current_frame, client_data) != FLAC__STREAM_ENCODER_WRITE_STATUS_OK) + return FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR; + if(write_callback(encoder, aspect->page.body, aspect->page.body_len, 0, current_frame, client_data) != FLAC__STREAM_ENCODER_WRITE_STATUS_OK) + return FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR; + } + } + else { + while(ogg_stream_pageout(&aspect->stream_state, &aspect->page) != 0) { + if(write_callback(encoder, aspect->page.header, aspect->page.header_len, 0, current_frame, client_data) != FLAC__STREAM_ENCODER_WRITE_STATUS_OK) + return FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR; + if(write_callback(encoder, aspect->page.body, aspect->page.body_len, 0, current_frame, client_data) != FLAC__STREAM_ENCODER_WRITE_STATUS_OK) + return FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR; + } + } + } + else if(is_metadata && current_frame == 0 && samples == 0 && bytes == 4 && 0 == memcmp(buffer, FLAC__STREAM_SYNC_STRING, sizeof(FLAC__STREAM_SYNC_STRING))) { + aspect->seen_magic = true; + } + else { + /* + * If we get here, our assumption about the way write callbacks happen + * explained above is wrong + */ + FLAC__ASSERT(0); + return FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR; + } + + aspect->samples_written += samples; + + return FLAC__STREAM_ENCODER_WRITE_STATUS_OK; +} diff --git a/Libraries/FLAC/Files/src/libOggFLAC/ogg_helper.c b/Libraries/FLAC/Files/src/libOggFLAC/ogg_helper.c new file mode 100644 index 000000000..dcbcc22a8 --- /dev/null +++ b/Libraries/FLAC/Files/src/libOggFLAC/ogg_helper.c @@ -0,0 +1,189 @@ +/* libOggFLAC - Free Lossless Audio Codec + Ogg library + * Copyright (C) 2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include /* for malloc() */ +#include /* for memcmp(), memcpy() */ +#include "FLAC/assert.h" +#include "private/ogg_helper.h" +#include "protected/seekable_stream_encoder.h" + + +static FLAC__bool full_read_(OggFLAC__SeekableStreamEncoder *encoder, FLAC__byte *buffer, unsigned bytes, OggFLAC__SeekableStreamEncoderReadCallback read_callback, void *client_data) +{ + while(bytes > 0) { + unsigned bytes_read = bytes; + switch(read_callback(encoder, buffer, &bytes_read, client_data)) { + case OggFLAC__SEEKABLE_STREAM_ENCODER_READ_STATUS_CONTINUE: + bytes -= bytes_read; + buffer += bytes_read; + break; + case OggFLAC__SEEKABLE_STREAM_ENCODER_READ_STATUS_END_OF_STREAM: + if(bytes_read == 0) { + encoder->protected_->state = OggFLAC__SEEKABLE_STREAM_ENCODER_OGG_ERROR; + return false; + } + bytes -= bytes_read; + buffer += bytes_read; + break; + case OggFLAC__SEEKABLE_STREAM_ENCODER_READ_STATUS_ABORT: + encoder->protected_->state = OggFLAC__SEEKABLE_STREAM_ENCODER_READ_ERROR; + return false; + default: + /* double protection: */ + FLAC__ASSERT(0); + encoder->protected_->state = OggFLAC__SEEKABLE_STREAM_ENCODER_READ_ERROR; + return false; + } + } + + return true; +} + +void simple_ogg_page__init(ogg_page *page) +{ + page->header = 0; + page->header_len = 0; + page->body = 0; + page->body_len = 0; +} + +void simple_ogg_page__clear(ogg_page *page) +{ + if(page->header) + free(page->header); + if(page->body) + free(page->body); + simple_ogg_page__init(page); +} + +FLAC__bool simple_ogg_page__get_at(OggFLAC__SeekableStreamEncoder *encoder, FLAC__uint64 position, ogg_page *page, OggFLAC__SeekableStreamEncoderSeekCallback seek_callback, OggFLAC__SeekableStreamEncoderReadCallback read_callback, void *client_data) +{ + static const unsigned OGG_HEADER_FIXED_PORTION_LEN = 27; + static const unsigned OGG_MAX_HEADER_LEN = 27/*OGG_HEADER_FIXED_PORTION_LEN*/ + 255; + FLAC__byte crc[4]; + + FLAC__ASSERT(page->header == 0); + FLAC__ASSERT(page->header_len == 0); + FLAC__ASSERT(page->body == 0); + FLAC__ASSERT(page->body_len == 0); + + /* move the stream pointer to the supposed beginning of the page */ + if(seek_callback(encoder, position, client_data) != FLAC__SEEKABLE_STREAM_ENCODER_SEEK_STATUS_OK) { + encoder->protected_->state = OggFLAC__SEEKABLE_STREAM_ENCODER_SEEK_ERROR; + return false; + } + + /* allocate space for the page header */ + if(0 == (page->header = (unsigned char *)malloc(OGG_MAX_HEADER_LEN))) { + encoder->protected_->state = OggFLAC__SEEKABLE_STREAM_ENCODER_MEMORY_ALLOCATION_ERROR; + return false; + } + + /* read in the fixed part of the page header (up to but not including + * the segment table */ + if(!full_read_(encoder, page->header, OGG_HEADER_FIXED_PORTION_LEN, read_callback, client_data)) + return false; + + page->header_len = OGG_HEADER_FIXED_PORTION_LEN + page->header[26]; + + /* check to see if it's a correct, "simple" page (one packet only) */ + if( + memcmp(page->header, "OggS", 4) || /* doesn't start with OggS */ + (page->header[5] & 0x01) || /* continued packet */ + memcmp(page->header+6, "\0\0\0\0\0\0\0\0", 8) || /* granulepos is non-zero */ + page->header[26] == 0 /* packet is 0-size */ + ) { + encoder->protected_->state = OggFLAC__SEEKABLE_STREAM_ENCODER_OGG_ERROR; + return false; + } + + /* read in the segment table */ + if(!full_read_(encoder, page->header + OGG_HEADER_FIXED_PORTION_LEN, page->header[26], read_callback, client_data)) + return false; + + { + unsigned i; + + /* check to see that it specifies a single packet */ + for(i = 0; i < (unsigned)page->header[26] - 1; i++) { + if(page->header[i + OGG_HEADER_FIXED_PORTION_LEN] != 255) { + encoder->protected_->state = OggFLAC__SEEKABLE_STREAM_ENCODER_OGG_ERROR; + return false; + } + } + + page->body_len = 255 * i + page->header[i]; + } + + /* allocate space for the page body */ + if(0 == (page->body = (unsigned char *)malloc(page->body_len))) { + encoder->protected_->state = OggFLAC__SEEKABLE_STREAM_ENCODER_MEMORY_ALLOCATION_ERROR; + return false; + } + + /* read in the page body */ + if(!full_read_(encoder, page->body, page->body_len, read_callback, client_data)) + return false; + + /* check the CRC */ + memcpy(crc, page->header+22, 4); + ogg_page_checksum_set(page); + if(memcmp(crc, page->header+22, 4)) { + encoder->protected_->state = OggFLAC__SEEKABLE_STREAM_ENCODER_OGG_ERROR; + return false; + } + + return true; +} + +FLAC__bool simple_ogg_page__set_at(OggFLAC__SeekableStreamEncoder *encoder, FLAC__uint64 position, ogg_page *page, OggFLAC__SeekableStreamEncoderSeekCallback seek_callback, OggFLAC__SeekableStreamEncoderWriteCallback write_callback, void *client_data) +{ + FLAC__ASSERT(page->header != 0); + FLAC__ASSERT(page->header_len != 0); + FLAC__ASSERT(page->body != 0); + FLAC__ASSERT(page->body_len != 0); + + /* move the stream pointer to the supposed beginning of the page */ + if(seek_callback(encoder, position, client_data) != FLAC__SEEKABLE_STREAM_ENCODER_SEEK_STATUS_OK) { + encoder->protected_->state = OggFLAC__SEEKABLE_STREAM_ENCODER_SEEK_ERROR; + return false; + } + + ogg_page_checksum_set(page); + + /* re-write the page */ + if(write_callback(encoder, page->header, page->header_len, 0, 0, client_data) != FLAC__STREAM_ENCODER_WRITE_STATUS_OK) { + encoder->protected_->state = OggFLAC__SEEKABLE_STREAM_ENCODER_WRITE_ERROR; + return false; + } + + return true; +} diff --git a/Libraries/FLAC/Files/src/libOggFLAC/ogg_mapping.c b/Libraries/FLAC/Files/src/libOggFLAC/ogg_mapping.c new file mode 100644 index 000000000..ae8265183 --- /dev/null +++ b/Libraries/FLAC/Files/src/libOggFLAC/ogg_mapping.c @@ -0,0 +1,43 @@ +/* libOggFLAC - Free Lossless Audio Codec + Ogg library + * Copyright (C) 2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "private/ogg_mapping.h" + +const unsigned OggFLAC__MAPPING_PACKET_TYPE_LEN = 8; /* bits */ + +const FLAC__byte OggFLAC__MAPPING_FIRST_HEADER_PACKET_TYPE = 0x7f; + +const FLAC__byte * const OggFLAC__MAPPING_MAGIC = "FLAC"; + +const unsigned OggFLAC__MAPPING_VERSION_MAJOR_LEN = 8; /* bits */ +const unsigned OggFLAC__MAPPING_VERSION_MINOR_LEN = 8; /* bits */ + +const unsigned OggFLAC__MAPPING_NUM_HEADERS_LEN = 16; /* bits */ diff --git a/Libraries/FLAC/Files/src/libOggFLAC/seekable_stream_decoder.c b/Libraries/FLAC/Files/src/libOggFLAC/seekable_stream_decoder.c new file mode 100644 index 000000000..fdd536bc5 --- /dev/null +++ b/Libraries/FLAC/Files/src/libOggFLAC/seekable_stream_decoder.c @@ -0,0 +1,978 @@ +/* libOggFLAC - Free Lossless Audio Codec + Ogg library + * Copyright (C) 2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include /* for calloc() */ +#include /* for memcpy()/memcmp() */ +#include "FLAC/assert.h" +#include "protected/seekable_stream_decoder.h" +#include "protected/stream_decoder.h" +#include "../libFLAC/include/private/float.h" /* @@@ ugly hack, but how else to do? we need to reuse the float formats but don't want to expose it */ +#include "../libFLAC/include/private/md5.h" /* @@@ ugly hack, but how else to do? we need to reuse the md5 code but don't want to expose it */ + +/*********************************************************************** + * + * Private class method prototypes + * + ***********************************************************************/ + +static void set_defaults_(OggFLAC__SeekableStreamDecoder *decoder); +static FLAC__StreamDecoderReadStatus read_callback_(const OggFLAC__StreamDecoder *decoder, FLAC__byte buffer[], unsigned *bytes, void *client_data); +static FLAC__StreamDecoderWriteStatus write_callback_(const OggFLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data); +static void metadata_callback_(const OggFLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data); +static void error_callback_(const OggFLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data); +static FLAC__bool seek_to_absolute_sample_(OggFLAC__SeekableStreamDecoder *decoder, FLAC__uint64 stream_length, FLAC__uint64 target_sample); + +/*********************************************************************** + * + * Private class data + * + ***********************************************************************/ + +typedef struct OggFLAC__SeekableStreamDecoderPrivate { + OggFLAC__SeekableStreamDecoderReadCallback read_callback; + OggFLAC__SeekableStreamDecoderSeekCallback seek_callback; + OggFLAC__SeekableStreamDecoderTellCallback tell_callback; + OggFLAC__SeekableStreamDecoderLengthCallback length_callback; + OggFLAC__SeekableStreamDecoderEofCallback eof_callback; + OggFLAC__SeekableStreamDecoderWriteCallback write_callback; + OggFLAC__SeekableStreamDecoderMetadataCallback metadata_callback; + OggFLAC__SeekableStreamDecoderErrorCallback error_callback; + void *client_data; + OggFLAC__StreamDecoder *stream_decoder; + FLAC__bool do_md5_checking; /* initially gets protected_->md5_checking but is turned off after a seek */ + struct FLAC__MD5Context md5context; + FLAC__byte stored_md5sum[16]; /* this is what is stored in the metadata */ + FLAC__byte computed_md5sum[16]; /* this is the sum we computed from the decoded data */ + /* the rest of these are only used for seeking: */ + FLAC__StreamMetadata_StreamInfo stream_info; /* we keep this around so we can figure out how to seek quickly */ + const FLAC__StreamMetadata_SeekTable *seek_table; /* we hold a pointer to the stream decoder's seek table for the same reason */ + /* Since we always want to see the STREAMINFO and SEEK_TABLE blocks at this level, we need some extra flags to keep track of whether they should be passed on up through the metadata_callback */ + FLAC__bool ignore_stream_info_block; + FLAC__bool ignore_seek_table_block; + FLAC__Frame last_frame; /* holds the info of the last frame we seeked to */ + FLAC__uint64 target_sample; + FLAC__bool got_a_frame; /* hack needed in seek routine to check when process_single() actually writes a frame */ +} OggFLAC__SeekableStreamDecoderPrivate; + +/*********************************************************************** + * + * Public static class data + * + ***********************************************************************/ + +OggFLAC_API const char * const OggFLAC__SeekableStreamDecoderStateString[] = { + "OggFLAC__SEEKABLE_STREAM_DECODER_OK", + "OggFLAC__SEEKABLE_STREAM_DECODER_SEEKING", + "OggFLAC__SEEKABLE_STREAM_DECODER_END_OF_STREAM", + "OggFLAC__SEEKABLE_STREAM_DECODER_MEMORY_ALLOCATION_ERROR", + "OggFLAC__SEEKABLE_STREAM_DECODER_STREAM_DECODER_ERROR", + "OggFLAC__SEEKABLE_STREAM_DECODER_READ_ERROR", + "OggFLAC__SEEKABLE_STREAM_DECODER_SEEK_ERROR", + "OggFLAC__SEEKABLE_STREAM_DECODER_ALREADY_INITIALIZED", + "OggFLAC__SEEKABLE_STREAM_DECODER_INVALID_CALLBACK", + "OggFLAC__SEEKABLE_STREAM_DECODER_UNINITIALIZED" +}; + +OggFLAC_API const char * const OggFLAC__SeekableStreamDecoderReadStatusString[] = { + "OggFLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_OK", + "OggFLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_ERROR" +}; + +OggFLAC_API const char * const OggFLAC__SeekableStreamDecoderSeekStatusString[] = { + "OggFLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_OK", + "OggFLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_ERROR" +}; + +OggFLAC_API const char * const OggFLAC__SeekableStreamDecoderTellStatusString[] = { + "OggFLAC__SEEKABLE_STREAM_DECODER_TELL_STATUS_OK", + "OggFLAC__SEEKABLE_STREAM_DECODER_TELL_STATUS_ERROR" +}; + +OggFLAC_API const char * const OggFLAC__SeekableStreamDecoderLengthStatusString[] = { + "OggFLAC__SEEKABLE_STREAM_DECODER_LENGTH_STATUS_OK", + "OggFLAC__SEEKABLE_STREAM_DECODER_LENGTH_STATUS_ERROR" +}; + + +/*********************************************************************** + * + * Class constructor/destructor + * + ***********************************************************************/ + +OggFLAC_API OggFLAC__SeekableStreamDecoder *OggFLAC__seekable_stream_decoder_new() +{ + OggFLAC__SeekableStreamDecoder *decoder; + + FLAC__ASSERT(sizeof(int) >= 4); /* we want to die right away if this is not true */ + + decoder = (OggFLAC__SeekableStreamDecoder*)calloc(1, sizeof(OggFLAC__SeekableStreamDecoder)); + if(decoder == 0) { + return 0; + } + + decoder->protected_ = (OggFLAC__SeekableStreamDecoderProtected*)calloc(1, sizeof(OggFLAC__SeekableStreamDecoderProtected)); + if(decoder->protected_ == 0) { + free(decoder); + return 0; + } + + decoder->private_ = (OggFLAC__SeekableStreamDecoderPrivate*)calloc(1, sizeof(OggFLAC__SeekableStreamDecoderPrivate)); + if(decoder->private_ == 0) { + free(decoder->protected_); + free(decoder); + return 0; + } + + decoder->private_->stream_decoder = OggFLAC__stream_decoder_new(); + if(0 == decoder->private_->stream_decoder) { + free(decoder->private_); + free(decoder->protected_); + free(decoder); + return 0; + } + + set_defaults_(decoder); + + decoder->protected_->state = OggFLAC__SEEKABLE_STREAM_DECODER_UNINITIALIZED; + + return decoder; +} + +OggFLAC_API void OggFLAC__seekable_stream_decoder_delete(OggFLAC__SeekableStreamDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->protected_); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->private_->stream_decoder); + + (void)OggFLAC__seekable_stream_decoder_finish(decoder); + + OggFLAC__stream_decoder_delete(decoder->private_->stream_decoder); + + free(decoder->private_); + free(decoder->protected_); + free(decoder); +} + +/*********************************************************************** + * + * Public class methods + * + ***********************************************************************/ + +OggFLAC_API OggFLAC__SeekableStreamDecoderState OggFLAC__seekable_stream_decoder_init(OggFLAC__SeekableStreamDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + + if(decoder->protected_->state != OggFLAC__SEEKABLE_STREAM_DECODER_UNINITIALIZED) + return decoder->protected_->state = OggFLAC__SEEKABLE_STREAM_DECODER_ALREADY_INITIALIZED; + + if(0 == decoder->private_->read_callback || 0 == decoder->private_->seek_callback || 0 == decoder->private_->tell_callback || 0 == decoder->private_->length_callback || 0 == decoder->private_->eof_callback) + return decoder->protected_->state = OggFLAC__SEEKABLE_STREAM_DECODER_INVALID_CALLBACK; + + if(0 == decoder->private_->write_callback || 0 == decoder->private_->metadata_callback || 0 == decoder->private_->error_callback) + return decoder->protected_->state = OggFLAC__SEEKABLE_STREAM_DECODER_INVALID_CALLBACK; + + decoder->private_->seek_table = 0; + + decoder->private_->do_md5_checking = decoder->protected_->md5_checking; + + /* We initialize the FLAC__MD5Context even though we may never use it. This + * is because md5 checking may be turned on to start and then turned off if + * a seek occurs. So we always init the context here and finalize it in + * OggFLAC__seekable_stream_decoder_finish() to make sure things are always + * cleaned up properly. + */ + FLAC__MD5Init(&decoder->private_->md5context); + + OggFLAC__stream_decoder_set_read_callback(decoder->private_->stream_decoder, read_callback_); + OggFLAC__stream_decoder_set_write_callback(decoder->private_->stream_decoder, write_callback_); + OggFLAC__stream_decoder_set_metadata_callback(decoder->private_->stream_decoder, metadata_callback_); + OggFLAC__stream_decoder_set_error_callback(decoder->private_->stream_decoder, error_callback_); + OggFLAC__stream_decoder_set_client_data(decoder->private_->stream_decoder, decoder); + + /* We always want to see these blocks. Whether or not we pass them up + * through the metadata callback will be determined by flags set in our + * implementation of ..._set_metadata_respond/ignore...() + */ + OggFLAC__stream_decoder_set_metadata_respond(decoder->private_->stream_decoder, FLAC__METADATA_TYPE_STREAMINFO); + OggFLAC__stream_decoder_set_metadata_respond(decoder->private_->stream_decoder, FLAC__METADATA_TYPE_SEEKTABLE); + + if(OggFLAC__stream_decoder_init(decoder->private_->stream_decoder) != OggFLAC__STREAM_DECODER_OK) + return decoder->protected_->state = OggFLAC__SEEKABLE_STREAM_DECODER_STREAM_DECODER_ERROR; + + return decoder->protected_->state = OggFLAC__SEEKABLE_STREAM_DECODER_OK; +} + +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_decoder_finish(OggFLAC__SeekableStreamDecoder *decoder) +{ + FLAC__bool md5_failed = false; + + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + + if(decoder->protected_->state == OggFLAC__SEEKABLE_STREAM_DECODER_UNINITIALIZED) + return true; + + FLAC__ASSERT(0 != decoder->private_->stream_decoder); + + /* see the comment in OggFLAC__seekable_stream_decoder_init() as to why we + * always call FLAC__MD5Final() + */ + FLAC__MD5Final(decoder->private_->computed_md5sum, &decoder->private_->md5context); + + OggFLAC__stream_decoder_finish(decoder->private_->stream_decoder); + + if(decoder->private_->do_md5_checking) { + if(memcmp(decoder->private_->stored_md5sum, decoder->private_->computed_md5sum, 16)) + md5_failed = true; + } + + set_defaults_(decoder); + + decoder->protected_->state = OggFLAC__SEEKABLE_STREAM_DECODER_UNINITIALIZED; + + return !md5_failed; +} + +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_decoder_set_md5_checking(OggFLAC__SeekableStreamDecoder *decoder, FLAC__bool value) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->protected_); + if(decoder->protected_->state != OggFLAC__SEEKABLE_STREAM_DECODER_UNINITIALIZED) + return false; + decoder->protected_->md5_checking = value; + return true; +} + +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_decoder_set_read_callback(OggFLAC__SeekableStreamDecoder *decoder, OggFLAC__SeekableStreamDecoderReadCallback value) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + if(decoder->protected_->state != OggFLAC__SEEKABLE_STREAM_DECODER_UNINITIALIZED) + return false; + decoder->private_->read_callback = value; + return true; +} + +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_decoder_set_seek_callback(OggFLAC__SeekableStreamDecoder *decoder, OggFLAC__SeekableStreamDecoderSeekCallback value) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + if(decoder->protected_->state != OggFLAC__SEEKABLE_STREAM_DECODER_UNINITIALIZED) + return false; + decoder->private_->seek_callback = value; + return true; +} + +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_decoder_set_tell_callback(OggFLAC__SeekableStreamDecoder *decoder, OggFLAC__SeekableStreamDecoderTellCallback value) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + if(decoder->protected_->state != OggFLAC__SEEKABLE_STREAM_DECODER_UNINITIALIZED) + return false; + decoder->private_->tell_callback = value; + return true; +} + +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_decoder_set_length_callback(OggFLAC__SeekableStreamDecoder *decoder, OggFLAC__SeekableStreamDecoderLengthCallback value) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + if(decoder->protected_->state != OggFLAC__SEEKABLE_STREAM_DECODER_UNINITIALIZED) + return false; + decoder->private_->length_callback = value; + return true; +} + +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_decoder_set_eof_callback(OggFLAC__SeekableStreamDecoder *decoder, OggFLAC__SeekableStreamDecoderEofCallback value) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + if(decoder->protected_->state != OggFLAC__SEEKABLE_STREAM_DECODER_UNINITIALIZED) + return false; + decoder->private_->eof_callback = value; + return true; +} + +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_decoder_set_write_callback(OggFLAC__SeekableStreamDecoder *decoder, OggFLAC__SeekableStreamDecoderWriteCallback value) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + if(decoder->protected_->state != OggFLAC__SEEKABLE_STREAM_DECODER_UNINITIALIZED) + return false; + decoder->private_->write_callback = value; + return true; +} + +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_decoder_set_metadata_callback(OggFLAC__SeekableStreamDecoder *decoder, OggFLAC__SeekableStreamDecoderMetadataCallback value) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + if(decoder->protected_->state != OggFLAC__SEEKABLE_STREAM_DECODER_UNINITIALIZED) + return false; + decoder->private_->metadata_callback = value; + return true; +} + +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_decoder_set_error_callback(OggFLAC__SeekableStreamDecoder *decoder, OggFLAC__SeekableStreamDecoderErrorCallback value) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + if(decoder->protected_->state != OggFLAC__SEEKABLE_STREAM_DECODER_UNINITIALIZED) + return false; + decoder->private_->error_callback = value; + return true; +} + +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_decoder_set_client_data(OggFLAC__SeekableStreamDecoder *decoder, void *value) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + if(decoder->protected_->state != OggFLAC__SEEKABLE_STREAM_DECODER_UNINITIALIZED) + return false; + decoder->private_->client_data = value; + return true; +} + +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_decoder_set_serial_number(OggFLAC__SeekableStreamDecoder *decoder, long value) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + if(decoder->protected_->state != OggFLAC__SEEKABLE_STREAM_DECODER_UNINITIALIZED) + return false; + OggFLAC__stream_decoder_set_serial_number(decoder->private_->stream_decoder, value); + return true; +} + +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_decoder_set_metadata_respond(OggFLAC__SeekableStreamDecoder *decoder, FLAC__MetadataType type) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + FLAC__ASSERT(0 != decoder->private_->stream_decoder); + if(decoder->protected_->state != OggFLAC__SEEKABLE_STREAM_DECODER_UNINITIALIZED) + return false; + if(type == FLAC__METADATA_TYPE_STREAMINFO) + decoder->private_->ignore_stream_info_block = false; + else if(type == FLAC__METADATA_TYPE_SEEKTABLE) + decoder->private_->ignore_seek_table_block = false; + return OggFLAC__stream_decoder_set_metadata_respond(decoder->private_->stream_decoder, type); +} + +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_decoder_set_metadata_respond_application(OggFLAC__SeekableStreamDecoder *decoder, const FLAC__byte id[4]) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + FLAC__ASSERT(0 != decoder->private_->stream_decoder); + if(decoder->protected_->state != OggFLAC__SEEKABLE_STREAM_DECODER_UNINITIALIZED) + return false; + return OggFLAC__stream_decoder_set_metadata_respond_application(decoder->private_->stream_decoder, id); +} + +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_decoder_set_metadata_respond_all(OggFLAC__SeekableStreamDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + FLAC__ASSERT(0 != decoder->private_->stream_decoder); + if(decoder->protected_->state != OggFLAC__SEEKABLE_STREAM_DECODER_UNINITIALIZED) + return false; + decoder->private_->ignore_stream_info_block = false; + decoder->private_->ignore_seek_table_block = false; + return OggFLAC__stream_decoder_set_metadata_respond_all(decoder->private_->stream_decoder); +} + +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_decoder_set_metadata_ignore(OggFLAC__SeekableStreamDecoder *decoder, FLAC__MetadataType type) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + FLAC__ASSERT(0 != decoder->private_->stream_decoder); + if(decoder->protected_->state != OggFLAC__SEEKABLE_STREAM_DECODER_UNINITIALIZED) + return false; + if(type == FLAC__METADATA_TYPE_STREAMINFO) { + decoder->private_->ignore_stream_info_block = true; + return true; + } + else if(type == FLAC__METADATA_TYPE_SEEKTABLE) { + decoder->private_->ignore_seek_table_block = true; + return true; + } + else + return OggFLAC__stream_decoder_set_metadata_ignore(decoder->private_->stream_decoder, type); +} + +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_decoder_set_metadata_ignore_application(OggFLAC__SeekableStreamDecoder *decoder, const FLAC__byte id[4]) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + FLAC__ASSERT(0 != decoder->private_->stream_decoder); + if(decoder->protected_->state != OggFLAC__SEEKABLE_STREAM_DECODER_UNINITIALIZED) + return false; + return OggFLAC__stream_decoder_set_metadata_ignore_application(decoder->private_->stream_decoder, id); +} + +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_decoder_set_metadata_ignore_all(OggFLAC__SeekableStreamDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + FLAC__ASSERT(0 != decoder->private_->stream_decoder); + if(decoder->protected_->state != OggFLAC__SEEKABLE_STREAM_DECODER_UNINITIALIZED) + return false; + decoder->private_->ignore_stream_info_block = true; + decoder->private_->ignore_seek_table_block = true; + return + OggFLAC__stream_decoder_set_metadata_ignore_all(decoder->private_->stream_decoder) && + OggFLAC__stream_decoder_set_metadata_respond(decoder->private_->stream_decoder, FLAC__METADATA_TYPE_STREAMINFO) && + OggFLAC__stream_decoder_set_metadata_respond(decoder->private_->stream_decoder, FLAC__METADATA_TYPE_SEEKTABLE); +} + +OggFLAC_API OggFLAC__SeekableStreamDecoderState OggFLAC__seekable_stream_decoder_get_state(const OggFLAC__SeekableStreamDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->protected_); + return decoder->protected_->state; +} + +OggFLAC_API OggFLAC__StreamDecoderState OggFLAC__seekable_stream_decoder_get_stream_decoder_state(const OggFLAC__SeekableStreamDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + return OggFLAC__stream_decoder_get_state(decoder->private_->stream_decoder); +} + +OggFLAC_API FLAC__StreamDecoderState OggFLAC__seekable_stream_decoder_get_FLAC_stream_decoder_state(const OggFLAC__SeekableStreamDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + return OggFLAC__stream_decoder_get_FLAC_stream_decoder_state(decoder->private_->stream_decoder); +} + +OggFLAC_API const char *OggFLAC__seekable_stream_decoder_get_resolved_state_string(const OggFLAC__SeekableStreamDecoder *decoder) +{ + if(decoder->protected_->state != OggFLAC__SEEKABLE_STREAM_DECODER_STREAM_DECODER_ERROR) + return OggFLAC__SeekableStreamDecoderStateString[decoder->protected_->state]; + else + return OggFLAC__stream_decoder_get_resolved_state_string(decoder->private_->stream_decoder); +} + +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_decoder_get_md5_checking(const OggFLAC__SeekableStreamDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->protected_); + return decoder->protected_->md5_checking; +} + +OggFLAC_API unsigned OggFLAC__seekable_stream_decoder_get_channels(const OggFLAC__SeekableStreamDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + return OggFLAC__stream_decoder_get_channels(decoder->private_->stream_decoder); +} + +OggFLAC_API FLAC__ChannelAssignment OggFLAC__seekable_stream_decoder_get_channel_assignment(const OggFLAC__SeekableStreamDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + return OggFLAC__stream_decoder_get_channel_assignment(decoder->private_->stream_decoder); +} + +OggFLAC_API unsigned OggFLAC__seekable_stream_decoder_get_bits_per_sample(const OggFLAC__SeekableStreamDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + return OggFLAC__stream_decoder_get_bits_per_sample(decoder->private_->stream_decoder); +} + +OggFLAC_API unsigned OggFLAC__seekable_stream_decoder_get_sample_rate(const OggFLAC__SeekableStreamDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + return OggFLAC__stream_decoder_get_sample_rate(decoder->private_->stream_decoder); +} + +OggFLAC_API unsigned OggFLAC__seekable_stream_decoder_get_blocksize(const OggFLAC__SeekableStreamDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + return OggFLAC__stream_decoder_get_blocksize(decoder->private_->stream_decoder); +} + +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_decoder_flush(OggFLAC__SeekableStreamDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + + decoder->private_->do_md5_checking = false; + + if(!OggFLAC__stream_decoder_flush(decoder->private_->stream_decoder)) { + decoder->protected_->state = OggFLAC__SEEKABLE_STREAM_DECODER_STREAM_DECODER_ERROR; + return false; + } + + decoder->protected_->state = OggFLAC__SEEKABLE_STREAM_DECODER_OK; + + return true; +} + +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_decoder_reset(OggFLAC__SeekableStreamDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + + if(!OggFLAC__seekable_stream_decoder_flush(decoder)) { + decoder->protected_->state = OggFLAC__SEEKABLE_STREAM_DECODER_STREAM_DECODER_ERROR; + return false; + } + + if(!OggFLAC__stream_decoder_reset(decoder->private_->stream_decoder)) { + decoder->protected_->state = OggFLAC__SEEKABLE_STREAM_DECODER_STREAM_DECODER_ERROR; + return false; + } + + decoder->private_->seek_table = 0; + + decoder->private_->do_md5_checking = decoder->protected_->md5_checking; + + /* We initialize the FLAC__MD5Context even though we may never use it. This + * is because md5 checking may be turned on to start and then turned off if + * a seek occurs. So we always init the context here and finalize it in + * OggFLAC__seekable_stream_decoder_finish() to make sure things are always + * cleaned up properly. + */ + FLAC__MD5Init(&decoder->private_->md5context); + + decoder->protected_->state = OggFLAC__SEEKABLE_STREAM_DECODER_OK; + + return true; +} + +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_decoder_process_single(OggFLAC__SeekableStreamDecoder *decoder) +{ + FLAC__bool ret; + FLAC__ASSERT(0 != decoder); + + if(decoder->private_->stream_decoder->protected_->state == OggFLAC__STREAM_DECODER_END_OF_STREAM) + decoder->protected_->state = OggFLAC__SEEKABLE_STREAM_DECODER_END_OF_STREAM; + + if(decoder->protected_->state == OggFLAC__SEEKABLE_STREAM_DECODER_END_OF_STREAM) + return true; + + FLAC__ASSERT(decoder->protected_->state == OggFLAC__SEEKABLE_STREAM_DECODER_OK); + + ret = OggFLAC__stream_decoder_process_single(decoder->private_->stream_decoder); + if(!ret) + decoder->protected_->state = OggFLAC__SEEKABLE_STREAM_DECODER_STREAM_DECODER_ERROR; + + return ret; +} + +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_decoder_process_until_end_of_metadata(OggFLAC__SeekableStreamDecoder *decoder) +{ + FLAC__bool ret; + FLAC__ASSERT(0 != decoder); + + if(decoder->private_->stream_decoder->protected_->state == OggFLAC__STREAM_DECODER_END_OF_STREAM) + decoder->protected_->state = OggFLAC__SEEKABLE_STREAM_DECODER_END_OF_STREAM; + + if(decoder->protected_->state == OggFLAC__SEEKABLE_STREAM_DECODER_END_OF_STREAM) + return true; + + FLAC__ASSERT(decoder->protected_->state == OggFLAC__SEEKABLE_STREAM_DECODER_OK); + + ret = OggFLAC__stream_decoder_process_until_end_of_metadata(decoder->private_->stream_decoder); + if(!ret) + decoder->protected_->state = OggFLAC__SEEKABLE_STREAM_DECODER_STREAM_DECODER_ERROR; + + return ret; +} + +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_decoder_process_until_end_of_stream(OggFLAC__SeekableStreamDecoder *decoder) +{ + FLAC__bool ret; + FLAC__ASSERT(0 != decoder); + + if(decoder->private_->stream_decoder->protected_->state == OggFLAC__STREAM_DECODER_END_OF_STREAM) + decoder->protected_->state = OggFLAC__SEEKABLE_STREAM_DECODER_END_OF_STREAM; + + if(decoder->protected_->state == OggFLAC__SEEKABLE_STREAM_DECODER_END_OF_STREAM) + return true; + + FLAC__ASSERT(decoder->protected_->state == OggFLAC__SEEKABLE_STREAM_DECODER_OK); + + ret = OggFLAC__stream_decoder_process_until_end_of_stream(decoder->private_->stream_decoder); + if(!ret) + decoder->protected_->state = OggFLAC__SEEKABLE_STREAM_DECODER_STREAM_DECODER_ERROR; + + return ret; +} + +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_decoder_seek_absolute(OggFLAC__SeekableStreamDecoder *decoder, FLAC__uint64 sample) +{ + FLAC__uint64 length; + + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(decoder->protected_->state == OggFLAC__SEEKABLE_STREAM_DECODER_OK || decoder->protected_->state == OggFLAC__SEEKABLE_STREAM_DECODER_END_OF_STREAM); + + decoder->protected_->state = OggFLAC__SEEKABLE_STREAM_DECODER_SEEKING; + + /* turn off md5 checking if a seek is attempted */ + decoder->private_->do_md5_checking = false; + + if(!OggFLAC__stream_decoder_reset(decoder->private_->stream_decoder)) { + decoder->protected_->state = OggFLAC__SEEKABLE_STREAM_DECODER_STREAM_DECODER_ERROR; + return false; + } + /* get the file length */ + if(decoder->private_->length_callback(decoder, &length, decoder->private_->client_data) != OggFLAC__SEEKABLE_STREAM_DECODER_LENGTH_STATUS_OK) { + decoder->protected_->state = OggFLAC__SEEKABLE_STREAM_DECODER_SEEK_ERROR; + return false; + } + /* rewind */ + if(decoder->private_->seek_callback(decoder, 0, decoder->private_->client_data) != OggFLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_OK) { + decoder->protected_->state = OggFLAC__SEEKABLE_STREAM_DECODER_SEEK_ERROR; + return false; + } + if(!OggFLAC__stream_decoder_process_until_end_of_metadata(decoder->private_->stream_decoder)) { + decoder->protected_->state = OggFLAC__SEEKABLE_STREAM_DECODER_STREAM_DECODER_ERROR; + return false; + } + if(decoder->private_->stream_info.total_samples > 0 && sample >= decoder->private_->stream_info.total_samples) { + decoder->protected_->state = OggFLAC__SEEKABLE_STREAM_DECODER_SEEK_ERROR; + return false; + } + + return seek_to_absolute_sample_(decoder, length, sample); +} + +/*********************************************************************** + * + * Private class methods + * + ***********************************************************************/ + +void set_defaults_(OggFLAC__SeekableStreamDecoder *decoder) +{ + decoder->private_->read_callback = 0; + decoder->private_->seek_callback = 0; + decoder->private_->tell_callback = 0; + decoder->private_->length_callback = 0; + decoder->private_->eof_callback = 0; + decoder->private_->write_callback = 0; + decoder->private_->metadata_callback = 0; + decoder->private_->error_callback = 0; + decoder->private_->client_data = 0; + /* WATCHOUT: these should match the default behavior of OggFLAC__StreamDecoder */ + decoder->private_->ignore_stream_info_block = false; + decoder->private_->ignore_seek_table_block = true; + + decoder->protected_->md5_checking = false; +} + +FLAC__StreamDecoderReadStatus read_callback_(const OggFLAC__StreamDecoder *decoder, FLAC__byte buffer[], unsigned *bytes, void *client_data) +{ + OggFLAC__SeekableStreamDecoder *seekable_stream_decoder = (OggFLAC__SeekableStreamDecoder *)client_data; + (void)decoder; + if(seekable_stream_decoder->private_->eof_callback(seekable_stream_decoder, seekable_stream_decoder->private_->client_data)) { + *bytes = 0; +#if 0 + /*@@@@@@ we used to do this: */ + seekable_stream_decoder->protected_->state = OggFLAC__SEEKABLE_STREAM_DECODER_END_OF_STREAM; + /* but it causes a problem because the Ogg decoding layer reads as much as it can to get pages, so the state will get to end-of-stream before the bitbuffer does */ +#endif + return FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM; + } + else if(*bytes > 0) { + if(seekable_stream_decoder->private_->read_callback(seekable_stream_decoder, buffer, bytes, seekable_stream_decoder->private_->client_data) != OggFLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_OK) { + seekable_stream_decoder->protected_->state = OggFLAC__SEEKABLE_STREAM_DECODER_READ_ERROR; + return FLAC__STREAM_DECODER_READ_STATUS_ABORT; + } + if(*bytes == 0) { + if(seekable_stream_decoder->private_->eof_callback(seekable_stream_decoder, seekable_stream_decoder->private_->client_data)) { +#if 0 + /*@@@@@@ we used to do this: */ + seekable_stream_decoder->protected_->state = OggFLAC__SEEKABLE_STREAM_DECODER_END_OF_STREAM; + /* but it causes a problem because the Ogg decoding layer reads as much as it can to get pages, so the state will get to end-of-stream before the bitbuffer does */ +#endif + return FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM; + } + else + return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE; + } + else { + return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE; + } + } + else + return FLAC__STREAM_DECODER_READ_STATUS_ABORT; /* abort to avoid a deadlock */ +} + +FLAC__StreamDecoderWriteStatus write_callback_(const OggFLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data) +{ + OggFLAC__SeekableStreamDecoder *seekable_stream_decoder = (OggFLAC__SeekableStreamDecoder *)client_data; + (void)decoder; + + if(seekable_stream_decoder->protected_->state == OggFLAC__SEEKABLE_STREAM_DECODER_SEEKING) { + FLAC__uint64 this_frame_sample = frame->header.number.sample_number; + FLAC__uint64 next_frame_sample = this_frame_sample + (FLAC__uint64)frame->header.blocksize; + FLAC__uint64 target_sample = seekable_stream_decoder->private_->target_sample; + + FLAC__ASSERT(frame->header.number_type == FLAC__FRAME_NUMBER_TYPE_SAMPLE_NUMBER); + + seekable_stream_decoder->private_->got_a_frame = true; + seekable_stream_decoder->private_->last_frame = *frame; /* save the frame */ + if(this_frame_sample <= target_sample && target_sample < next_frame_sample) { /* we hit our target frame */ + unsigned delta = (unsigned)(target_sample - this_frame_sample); + /* kick out of seek mode */ + seekable_stream_decoder->protected_->state = OggFLAC__SEEKABLE_STREAM_DECODER_OK; + /* shift out the samples before target_sample */ + if(delta > 0) { + unsigned channel; + const FLAC__int32 *newbuffer[FLAC__MAX_CHANNELS]; + for(channel = 0; channel < frame->header.channels; channel++) + newbuffer[channel] = buffer[channel] + delta; + seekable_stream_decoder->private_->last_frame.header.blocksize -= delta; + seekable_stream_decoder->private_->last_frame.header.number.sample_number += (FLAC__uint64)delta; + /* write the relevant samples */ + return seekable_stream_decoder->private_->write_callback(seekable_stream_decoder, &seekable_stream_decoder->private_->last_frame, newbuffer, seekable_stream_decoder->private_->client_data); + } + else { + /* write the relevant samples */ + return seekable_stream_decoder->private_->write_callback(seekable_stream_decoder, frame, buffer, seekable_stream_decoder->private_->client_data); + } + } + else { + return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE; + } + } + else { + if(seekable_stream_decoder->private_->do_md5_checking) { + if(!FLAC__MD5Accumulate(&seekable_stream_decoder->private_->md5context, buffer, frame->header.channels, frame->header.blocksize, (frame->header.bits_per_sample+7) / 8)) + return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT; + } + return seekable_stream_decoder->private_->write_callback(seekable_stream_decoder, frame, buffer, seekable_stream_decoder->private_->client_data); + } +} + +void metadata_callback_(const OggFLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data) +{ + OggFLAC__SeekableStreamDecoder *seekable_stream_decoder = (OggFLAC__SeekableStreamDecoder *)client_data; + (void)decoder; + + if(metadata->type == FLAC__METADATA_TYPE_STREAMINFO) { + seekable_stream_decoder->private_->stream_info = metadata->data.stream_info; + /* save the MD5 signature for comparison later */ + memcpy(seekable_stream_decoder->private_->stored_md5sum, metadata->data.stream_info.md5sum, 16); + if(0 == memcmp(seekable_stream_decoder->private_->stored_md5sum, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 16)) + seekable_stream_decoder->private_->do_md5_checking = false; + } + else if(metadata->type == FLAC__METADATA_TYPE_SEEKTABLE) { + seekable_stream_decoder->private_->seek_table = &metadata->data.seek_table; + } + + if(seekable_stream_decoder->protected_->state != OggFLAC__SEEKABLE_STREAM_DECODER_SEEKING) { + FLAC__bool ignore_block = false; + if(metadata->type == FLAC__METADATA_TYPE_STREAMINFO && seekable_stream_decoder->private_->ignore_stream_info_block) + ignore_block = true; + else if(metadata->type == FLAC__METADATA_TYPE_SEEKTABLE && seekable_stream_decoder->private_->ignore_seek_table_block) + ignore_block = true; + if(!ignore_block) + seekable_stream_decoder->private_->metadata_callback(seekable_stream_decoder, metadata, seekable_stream_decoder->private_->client_data); + } +} + +void error_callback_(const OggFLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data) +{ + OggFLAC__SeekableStreamDecoder *seekable_stream_decoder = (OggFLAC__SeekableStreamDecoder *)client_data; + (void)decoder; + + if(seekable_stream_decoder->protected_->state != OggFLAC__SEEKABLE_STREAM_DECODER_SEEKING) + seekable_stream_decoder->private_->error_callback(seekable_stream_decoder, status, seekable_stream_decoder->private_->client_data); +} + +FLAC__bool seek_to_absolute_sample_(OggFLAC__SeekableStreamDecoder *decoder, FLAC__uint64 stream_length, FLAC__uint64 target_sample) +{ + FLAC__uint64 left_pos = 0, right_pos = stream_length; + FLAC__uint64 left_sample = 0, right_sample = decoder->private_->stream_info.total_samples; + FLAC__uint64 this_frame_sample = 0; /* only initialized to avoid compiler warning */ + FLAC__uint64 pos = 0; /* only initialized to avoid compiler warning */ + FLAC__bool did_a_seek; + unsigned iteration = 0; + + /* In the first iterations, we will calculate the target byte position + * by the distance from the target sample to left_sample and + * right_sample (let's call it "proportional search"). After that, we + * will switch to binary search. + */ + unsigned BINARY_SEARCH_AFTER_ITERATION = 2; + + /* We will switch to a linear search once our current sample is less + * that this number of samples ahead of the target sample + */ + static const FLAC__uint64 LINEAR_SEARCH_WITHIN_SAMPLES = FLAC__MAX_BLOCK_SIZE * 2; + + /* If the total number of samples is unknown, use a large value and + * increase 'iteration' to force binary search immediately. + */ + if(right_sample == 0) { + right_sample = (FLAC__uint64)(-1); + BINARY_SEARCH_AFTER_ITERATION = 0; + } + + decoder->private_->target_sample = target_sample; + for( ; ; iteration++) { + if (iteration == 0 || this_frame_sample > target_sample || target_sample - this_frame_sample > LINEAR_SEARCH_WITHIN_SAMPLES) { + if (iteration >= BINARY_SEARCH_AFTER_ITERATION) { + pos = (right_pos + left_pos) / 2; + } + else { +#ifndef FLAC__INTEGER_ONLY_LIBRARY +#if defined _MSC_VER || defined __MINGW32__ + /* with MSVC you have to spoon feed it the casting */ + pos = (FLAC__uint64)((FLAC__double)(FLAC__int64)(target_sample - left_sample) / (FLAC__double)(FLAC__int64)(right_sample - left_sample) * (FLAC__double)(FLAC__int64)(right_pos - left_pos)); +#else + pos = (FLAC__uint64)((FLAC__double)(target_sample - left_sample) / (FLAC__double)(right_sample - left_sample) * (FLAC__double)(right_pos - left_pos)); +#endif +#else + /* a little less accurate: */ + if ((target_sample-left_sample <= 0xffffffff) && (right_pos-left_pos <= 0xffffffff)) + pos = (FLAC__int64)(((target_sample-left_sample) * (right_pos-left_pos)) / (right_sample-left_sample)); + else /* @@@ WATCHOUT, ~2TB limit */ + pos = (FLAC__int64)((((target_sample-left_sample)>>8) * ((right_pos-left_pos)>>8)) / ((right_sample-left_sample)>>16)); +#endif + /* @@@ TODO: might want to limit pos to some distance + * before EOF, to make sure we land before the last frame, + * thereby getting a this_fram_sample and so having a better + * estimate. this would also mostly (or totally if we could + * be sure to land before the last frame) avoid the + * end-of-stream case we have to check later. + */ + } + + /* physical seek */ + if(decoder->private_->seek_callback(decoder, (FLAC__uint64)pos, decoder->private_->client_data) != OggFLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_OK) { + decoder->protected_->state = OggFLAC__SEEKABLE_STREAM_DECODER_SEEK_ERROR; + return false; + } + if(!OggFLAC__stream_decoder_flush(decoder->private_->stream_decoder)) { + decoder->protected_->state = OggFLAC__SEEKABLE_STREAM_DECODER_STREAM_DECODER_ERROR; + return false; + } + did_a_seek = true; + } + else + did_a_seek = false; + + decoder->private_->got_a_frame = false; + if(!OggFLAC__stream_decoder_process_single(decoder->private_->stream_decoder)) { + decoder->protected_->state = OggFLAC__SEEKABLE_STREAM_DECODER_SEEK_ERROR; + return false; + } + if(!decoder->private_->got_a_frame) { + if(did_a_seek) { + /* this can happen if we seek to a point after the last frame; we drop + * to binary search right away in this case to avoid any wasted + * iterations of proportional search. + */ + right_pos = pos; + BINARY_SEARCH_AFTER_ITERATION = 0; + } + else { + /* this can probably only happen if total_samples is unknown and the + * target_sample is past the end of the stream + */ + decoder->protected_->state = OggFLAC__SEEKABLE_STREAM_DECODER_SEEK_ERROR; + return false; + } + } + /* our write callback will change the state when it gets to the target frame */ + else if( + decoder->protected_->state != OggFLAC__SEEKABLE_STREAM_DECODER_SEEKING && + decoder->protected_->state != OggFLAC__SEEKABLE_STREAM_DECODER_END_OF_STREAM + ) { + break; + } + else { + this_frame_sample = decoder->private_->last_frame.header.number.sample_number; + FLAC__ASSERT(decoder->private_->last_frame.header.number_type == FLAC__FRAME_NUMBER_TYPE_SAMPLE_NUMBER); + + if (did_a_seek) { + if (this_frame_sample <= target_sample) { + /* The 'equal' case should not happen, since + * OggFLAC__stream_decoder_process_single() + * should recognize that it has hit the + * target sample and we would exit through + * the 'break' above. + */ + FLAC__ASSERT(this_frame_sample != target_sample); + + left_sample = this_frame_sample; + /* sanity check to avoid infinite loop */ + if (left_pos == pos) { + decoder->protected_->state = OggFLAC__SEEKABLE_STREAM_DECODER_SEEK_ERROR; + return false; + } + left_pos = pos; + } + else if(this_frame_sample > target_sample) { + right_sample = this_frame_sample; + /* sanity check to avoid infinite loop */ + if (right_pos == pos) { + decoder->protected_->state = OggFLAC__SEEKABLE_STREAM_DECODER_SEEK_ERROR; + return false; + } + right_pos = pos; + } + } + } + } + + return true; +} diff --git a/Libraries/FLAC/Files/src/libOggFLAC/seekable_stream_encoder.c b/Libraries/FLAC/Files/src/libOggFLAC/seekable_stream_encoder.c new file mode 100644 index 000000000..0aa6e72f8 --- /dev/null +++ b/Libraries/FLAC/Files/src/libOggFLAC/seekable_stream_encoder.c @@ -0,0 +1,1063 @@ +/* libOggFLAC - Free Lossless Audio Codec + Ogg library + * Copyright (C) 2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include /* for calloc() */ +#include /* for memcpy() */ +#include "FLAC/assert.h" +#include "OggFLAC/seekable_stream_encoder.h" +#include "protected/seekable_stream_encoder.h" +#include "private/ogg_helper.h" + +#ifdef max +#undef max +#endif +#define max(a,b) ((a)>(b)?(a):(b)) + +/*********************************************************************** + * + * Private class method prototypes + * + ***********************************************************************/ + +/* unpublished debug routines */ +extern FLAC__bool FLAC__stream_encoder_disable_constant_subframes(FLAC__StreamEncoder *encoder, FLAC__bool value); +extern FLAC__bool FLAC__stream_encoder_disable_fixed_subframes(FLAC__StreamEncoder *encoder, FLAC__bool value); +extern FLAC__bool FLAC__stream_encoder_disable_verbatim_subframes(FLAC__StreamEncoder *encoder, FLAC__bool value); + +static void set_defaults_(OggFLAC__SeekableStreamEncoder *encoder); +static FLAC__StreamEncoderWriteStatus write_callback_(const FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame, void *client_data); +static void metadata_callback_(const FLAC__StreamEncoder *encoder, const FLAC__StreamMetadata *metadata, void *client_data); + + +/*********************************************************************** + * + * Private class data + * + ***********************************************************************/ + +typedef struct OggFLAC__SeekableStreamEncoderPrivate { + OggFLAC__SeekableStreamEncoderReadCallback read_callback; + OggFLAC__SeekableStreamEncoderSeekCallback seek_callback; + OggFLAC__SeekableStreamEncoderTellCallback tell_callback; + OggFLAC__SeekableStreamEncoderWriteCallback write_callback; + void *client_data; + FLAC__StreamEncoder *FLAC_stream_encoder; + FLAC__StreamMetadata_SeekTable *seek_table; + /* internal vars (all the above are class settings) */ + unsigned first_seekpoint_to_check; + FLAC__uint64 samples_written; +} OggFLAC__SeekableStreamEncoderPrivate; + + +/*********************************************************************** + * + * Public static class data + * + ***********************************************************************/ + +OggFLAC_API const char * const OggFLAC__SeekableStreamEncoderStateString[] = { + "OggFLAC__SEEKABLE_STREAM_ENCODER_OK", + "OggFLAC__SEEKABLE_STREAM_ENCODER_OGG_ERROR", + "OggFLAC__SEEKABLE_STREAM_ENCODER_FLAC_STREAM_ENCODER_ERROR", + "OggFLAC__SEEKABLE_STREAM_ENCODER_MEMORY_ALLOCATION_ERROR", + "OggFLAC__SEEKABLE_STREAM_ENCODER_WRITE_ERROR", + "OggFLAC__SEEKABLE_STREAM_ENCODER_READ_ERROR", + "OggFLAC__SEEKABLE_STREAM_ENCODER_READ_ERROR", + "OggFLAC__SEEKABLE_STREAM_ENCODER_SEEK_ERROR", + "OggFLAC__SEEKABLE_STREAM_ENCODER_TELL_ERROR", + "OggFLAC__SEEKABLE_STREAM_ENCODER_ALREADY_INITIALIZED", + "OggFLAC__SEEKABLE_STREAM_ENCODER_INVALID_CALLBACK", + "OggFLAC__SEEKABLE_STREAM_ENCODER_INVALID_SEEKTABLE", + "OggFLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED" +}; + +OggFLAC_API const char * const OggFLAC__SeekableStreamEncoderReadStatusString[] = { + "OggFLAC__SEEKABLE_STREAM_ENCODER_READ_STATUS_CONTINUE", + "OggFLAC__SEEKABLE_STREAM_ENCODER_READ_STATUS_END_OF_STREAM", + "OggFLAC__SEEKABLE_STREAM_ENCODER_READ_STATUS_ABORT" +}; + + +/*********************************************************************** + * + * Class constructor/destructor + * + */ +OggFLAC_API OggFLAC__SeekableStreamEncoder *OggFLAC__seekable_stream_encoder_new() +{ + OggFLAC__SeekableStreamEncoder *encoder; + + encoder = (OggFLAC__SeekableStreamEncoder*)calloc(1, sizeof(OggFLAC__SeekableStreamEncoder)); + if(encoder == 0) { + return 0; + } + + encoder->protected_ = (OggFLAC__SeekableStreamEncoderProtected*)calloc(1, sizeof(OggFLAC__SeekableStreamEncoderProtected)); + if(encoder->protected_ == 0) { + free(encoder); + return 0; + } + + encoder->private_ = (OggFLAC__SeekableStreamEncoderPrivate*)calloc(1, sizeof(OggFLAC__SeekableStreamEncoderPrivate)); + if(encoder->private_ == 0) { + free(encoder->protected_); + free(encoder); + return 0; + } + + encoder->private_->FLAC_stream_encoder = FLAC__stream_encoder_new(); + if(0 == encoder->private_->FLAC_stream_encoder) { + free(encoder->private_); + free(encoder->protected_); + free(encoder); + return 0; + } + + set_defaults_(encoder); + + encoder->protected_->state = OggFLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED; + + return encoder; +} + +OggFLAC_API void OggFLAC__seekable_stream_encoder_delete(OggFLAC__SeekableStreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->private_->FLAC_stream_encoder); + + (void)OggFLAC__seekable_stream_encoder_finish(encoder); + + FLAC__stream_encoder_delete(encoder->private_->FLAC_stream_encoder); + + free(encoder->private_); + free(encoder->protected_); + free(encoder); +} + + +/*********************************************************************** + * + * Public class methods + * + ***********************************************************************/ + +OggFLAC_API OggFLAC__SeekableStreamEncoderState OggFLAC__seekable_stream_encoder_init(OggFLAC__SeekableStreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + + if(encoder->protected_->state != OggFLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED) + return encoder->protected_->state = OggFLAC__SEEKABLE_STREAM_ENCODER_ALREADY_INITIALIZED; + + if(0 == encoder->private_->seek_callback || 0 == encoder->private_->tell_callback || 0 == encoder->private_->write_callback) + return encoder->protected_->state = OggFLAC__SEEKABLE_STREAM_ENCODER_INVALID_CALLBACK; + + if(!OggFLAC__ogg_encoder_aspect_init(&encoder->protected_->ogg_encoder_aspect)) + return encoder->protected_->state = OggFLAC__SEEKABLE_STREAM_ENCODER_OGG_ERROR; + + if(0 != encoder->private_->seek_table && !FLAC__format_seektable_is_legal(encoder->private_->seek_table)) + return encoder->protected_->state = OggFLAC__SEEKABLE_STREAM_ENCODER_INVALID_SEEKTABLE; + + /* + * These must be done before we init the stream encoder because that + * calls the write_callback, which uses these values. + */ + encoder->private_->first_seekpoint_to_check = 0; + encoder->private_->samples_written = 0; + encoder->protected_->streaminfo_offset = 0; + encoder->protected_->seektable_offset = 0; + encoder->protected_->audio_offset = 0; + + FLAC__stream_encoder_set_write_callback(encoder->private_->FLAC_stream_encoder, write_callback_); + FLAC__stream_encoder_set_metadata_callback(encoder->private_->FLAC_stream_encoder, metadata_callback_); + FLAC__stream_encoder_set_client_data(encoder->private_->FLAC_stream_encoder, encoder); + + if(FLAC__stream_encoder_init(encoder->private_->FLAC_stream_encoder) != FLAC__STREAM_ENCODER_OK) + return encoder->protected_->state = OggFLAC__SEEKABLE_STREAM_ENCODER_FLAC_STREAM_ENCODER_ERROR; + + /* + * Initializing the stream encoder writes all the metadata, so we + * save the stream offset now. + */ + if(encoder->private_->tell_callback(encoder, &encoder->protected_->audio_offset, encoder->private_->client_data) != FLAC__SEEKABLE_STREAM_ENCODER_TELL_STATUS_OK) + return encoder->protected_->state = OggFLAC__SEEKABLE_STREAM_ENCODER_TELL_ERROR; + + return encoder->protected_->state = OggFLAC__SEEKABLE_STREAM_ENCODER_OK; +} + +OggFLAC_API void OggFLAC__seekable_stream_encoder_finish(OggFLAC__SeekableStreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + + if(encoder->protected_->state == OggFLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED) + return; + + FLAC__ASSERT(0 != encoder->private_->FLAC_stream_encoder); + + FLAC__stream_encoder_finish(encoder->private_->FLAC_stream_encoder); + + OggFLAC__ogg_encoder_aspect_finish(&encoder->protected_->ogg_encoder_aspect); + + set_defaults_(encoder); + + encoder->protected_->state = OggFLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED; +} + +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_set_serial_number(OggFLAC__SeekableStreamEncoder *encoder, long value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->FLAC_stream_encoder); + if(encoder->protected_->state != OggFLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED) + return false; + OggFLAC__ogg_encoder_aspect_set_serial_number(&encoder->protected_->ogg_encoder_aspect, value); + return true; +} + +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_set_verify(OggFLAC__SeekableStreamEncoder *encoder, FLAC__bool value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->FLAC_stream_encoder); + if(encoder->protected_->state != OggFLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED) + return false; + return FLAC__stream_encoder_set_verify(encoder->private_->FLAC_stream_encoder, value); +} + +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_set_streamable_subset(OggFLAC__SeekableStreamEncoder *encoder, FLAC__bool value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->FLAC_stream_encoder); + if(encoder->protected_->state != OggFLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED) + return false; + return FLAC__stream_encoder_set_streamable_subset(encoder->private_->FLAC_stream_encoder, value); +} + +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_set_do_mid_side_stereo(OggFLAC__SeekableStreamEncoder *encoder, FLAC__bool value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->FLAC_stream_encoder); + if(encoder->protected_->state != OggFLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED) + return false; + return FLAC__stream_encoder_set_do_mid_side_stereo(encoder->private_->FLAC_stream_encoder, value); +} + +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_set_loose_mid_side_stereo(OggFLAC__SeekableStreamEncoder *encoder, FLAC__bool value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->FLAC_stream_encoder); + if(encoder->protected_->state != OggFLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED) + return false; + return FLAC__stream_encoder_set_loose_mid_side_stereo(encoder->private_->FLAC_stream_encoder, value); +} + +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_set_channels(OggFLAC__SeekableStreamEncoder *encoder, unsigned value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->FLAC_stream_encoder); + if(encoder->protected_->state != OggFLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED) + return false; + return FLAC__stream_encoder_set_channels(encoder->private_->FLAC_stream_encoder, value); +} + +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_set_bits_per_sample(OggFLAC__SeekableStreamEncoder *encoder, unsigned value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->FLAC_stream_encoder); + if(encoder->protected_->state != OggFLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED) + return false; + return FLAC__stream_encoder_set_bits_per_sample(encoder->private_->FLAC_stream_encoder, value); +} + +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_set_sample_rate(OggFLAC__SeekableStreamEncoder *encoder, unsigned value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->FLAC_stream_encoder); + if(encoder->protected_->state != OggFLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED) + return false; + return FLAC__stream_encoder_set_sample_rate(encoder->private_->FLAC_stream_encoder, value); +} + +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_set_blocksize(OggFLAC__SeekableStreamEncoder *encoder, unsigned value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->FLAC_stream_encoder); + if(encoder->protected_->state != OggFLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED) + return false; + return FLAC__stream_encoder_set_blocksize(encoder->private_->FLAC_stream_encoder, value); +} + +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_set_max_lpc_order(OggFLAC__SeekableStreamEncoder *encoder, unsigned value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->FLAC_stream_encoder); + if(encoder->protected_->state != OggFLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED) + return false; + return FLAC__stream_encoder_set_max_lpc_order(encoder->private_->FLAC_stream_encoder, value); +} + +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_set_qlp_coeff_precision(OggFLAC__SeekableStreamEncoder *encoder, unsigned value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->FLAC_stream_encoder); + if(encoder->protected_->state != OggFLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED) + return false; + return FLAC__stream_encoder_set_qlp_coeff_precision(encoder->private_->FLAC_stream_encoder, value); +} + +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_set_do_qlp_coeff_prec_search(OggFLAC__SeekableStreamEncoder *encoder, FLAC__bool value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->FLAC_stream_encoder); + if(encoder->protected_->state != OggFLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED) + return false; + return FLAC__stream_encoder_set_do_qlp_coeff_prec_search(encoder->private_->FLAC_stream_encoder, value); +} + +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_set_do_escape_coding(OggFLAC__SeekableStreamEncoder *encoder, FLAC__bool value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->FLAC_stream_encoder); + if(encoder->protected_->state != OggFLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED) + return false; + return FLAC__stream_encoder_set_do_escape_coding(encoder->private_->FLAC_stream_encoder, value); +} + +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_set_do_exhaustive_model_search(OggFLAC__SeekableStreamEncoder *encoder, FLAC__bool value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->FLAC_stream_encoder); + if(encoder->protected_->state != OggFLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED) + return false; + return FLAC__stream_encoder_set_do_exhaustive_model_search(encoder->private_->FLAC_stream_encoder, value); +} + +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_set_min_residual_partition_order(OggFLAC__SeekableStreamEncoder *encoder, unsigned value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->FLAC_stream_encoder); + if(encoder->protected_->state != OggFLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED) + return false; + return FLAC__stream_encoder_set_min_residual_partition_order(encoder->private_->FLAC_stream_encoder, value); +} + +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_set_max_residual_partition_order(OggFLAC__SeekableStreamEncoder *encoder, unsigned value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->FLAC_stream_encoder); + if(encoder->protected_->state != OggFLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED) + return false; + return FLAC__stream_encoder_set_max_residual_partition_order(encoder->private_->FLAC_stream_encoder, value); +} + +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_set_rice_parameter_search_dist(OggFLAC__SeekableStreamEncoder *encoder, unsigned value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->FLAC_stream_encoder); + if(encoder->protected_->state != OggFLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED) + return false; + return FLAC__stream_encoder_set_rice_parameter_search_dist(encoder->private_->FLAC_stream_encoder, value); +} + +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_set_total_samples_estimate(OggFLAC__SeekableStreamEncoder *encoder, FLAC__uint64 value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->FLAC_stream_encoder); + if(encoder->protected_->state != OggFLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED) + return false; + return FLAC__stream_encoder_set_total_samples_estimate(encoder->private_->FLAC_stream_encoder, value); +} + +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_set_metadata(OggFLAC__SeekableStreamEncoder *encoder, FLAC__StreamMetadata **metadata, unsigned num_blocks) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->FLAC_stream_encoder); + if(encoder->protected_->state != OggFLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED) + return false; + /* reorder metadata if necessary to ensure that any VORBIS_COMMENT is the first, according to the mapping spec */ + if(0 != metadata && num_blocks > 1) { + unsigned i; + for(i = 1; i < num_blocks; i++) { + if(0 != metadata[i] && metadata[i]->type == FLAC__METADATA_TYPE_VORBIS_COMMENT) { + FLAC__StreamMetadata *vc = metadata[i]; + for( ; i > 0; i--) + metadata[i] = metadata[i-1]; + metadata[0] = vc; + break; + } + } + } + if(0 != metadata && num_blocks > 0) { + unsigned i; + for(i = 0; i < num_blocks; i++) { + /* keep track of any SEEKTABLE block */ + if(0 != metadata[i] && metadata[i]->type == FLAC__METADATA_TYPE_SEEKTABLE) { + encoder->private_->seek_table = &metadata[i]->data.seek_table; + break; /* take only the first one */ + } + } + } + if(!OggFLAC__ogg_encoder_aspect_set_num_metadata(&encoder->protected_->ogg_encoder_aspect, num_blocks)) + return false; + return FLAC__stream_encoder_set_metadata(encoder->private_->FLAC_stream_encoder, metadata, num_blocks); +} + +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_set_read_callback(OggFLAC__SeekableStreamEncoder *encoder, OggFLAC__SeekableStreamEncoderReadCallback value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != value); + if(encoder->protected_->state != OggFLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED) + return false; + encoder->private_->read_callback = value; + return true; +} + +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_set_seek_callback(OggFLAC__SeekableStreamEncoder *encoder, OggFLAC__SeekableStreamEncoderSeekCallback value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != value); + if(encoder->protected_->state != OggFLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED) + return false; + encoder->private_->seek_callback = value; + return true; +} + +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_set_tell_callback(OggFLAC__SeekableStreamEncoder *encoder, OggFLAC__SeekableStreamEncoderTellCallback value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != value); + if(encoder->protected_->state != OggFLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED) + return false; + encoder->private_->tell_callback = value; + return true; +} + +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_set_write_callback(OggFLAC__SeekableStreamEncoder *encoder, OggFLAC__SeekableStreamEncoderWriteCallback value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != value); + if(encoder->protected_->state != OggFLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED) + return false; + encoder->private_->write_callback = value; + return true; +} + +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_set_client_data(OggFLAC__SeekableStreamEncoder *encoder, void *value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + if(encoder->protected_->state != OggFLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED) + return false; + encoder->private_->client_data = value; + return true; +} + +/* + * These three functions are not static, but not publically exposed in + * include/FLAC/ either. They are used by the test suite. + */ +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_disable_constant_subframes(OggFLAC__SeekableStreamEncoder *encoder, FLAC__bool value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + if(encoder->protected_->state != OggFLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED) + return false; + return FLAC__stream_encoder_disable_constant_subframes(encoder->private_->FLAC_stream_encoder, value); +} + +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_disable_fixed_subframes(OggFLAC__SeekableStreamEncoder *encoder, FLAC__bool value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + if(encoder->protected_->state != OggFLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED) + return false; + return FLAC__stream_encoder_disable_fixed_subframes(encoder->private_->FLAC_stream_encoder, value); +} + +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_disable_verbatim_subframes(OggFLAC__SeekableStreamEncoder *encoder, FLAC__bool value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + if(encoder->protected_->state != OggFLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED) + return false; + return FLAC__stream_encoder_disable_verbatim_subframes(encoder->private_->FLAC_stream_encoder, value); +} + +OggFLAC_API OggFLAC__SeekableStreamEncoderState OggFLAC__seekable_stream_encoder_get_state(const OggFLAC__SeekableStreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + return encoder->protected_->state; +} + +OggFLAC_API FLAC__StreamEncoderState OggFLAC__seekable_stream_encoder_get_FLAC_stream_encoder_state(const OggFLAC__SeekableStreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->FLAC_stream_encoder); + return FLAC__stream_encoder_get_state(encoder->private_->FLAC_stream_encoder); +} + +OggFLAC_API FLAC__StreamDecoderState OggFLAC__seekable_stream_encoder_get_verify_decoder_state(const OggFLAC__SeekableStreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->FLAC_stream_encoder); + return FLAC__stream_encoder_get_verify_decoder_state(encoder->private_->FLAC_stream_encoder); +} + +OggFLAC_API const char *OggFLAC__seekable_stream_encoder_get_resolved_state_string(const OggFLAC__SeekableStreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->FLAC_stream_encoder); + if(encoder->protected_->state != OggFLAC__SEEKABLE_STREAM_ENCODER_FLAC_STREAM_ENCODER_ERROR) + return OggFLAC__SeekableStreamEncoderStateString[encoder->protected_->state]; + else + return FLAC__stream_encoder_get_resolved_state_string(encoder->private_->FLAC_stream_encoder); +} + +OggFLAC_API void OggFLAC__seekable_stream_encoder_get_verify_decoder_error_stats(const OggFLAC__SeekableStreamEncoder *encoder, FLAC__uint64 *absolute_sample, unsigned *frame_number, unsigned *channel, unsigned *sample, FLAC__int32 *expected, FLAC__int32 *got) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->FLAC_stream_encoder); + FLAC__stream_encoder_get_verify_decoder_error_stats(encoder->private_->FLAC_stream_encoder, absolute_sample, frame_number, channel, sample, expected, got); +} + +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_get_verify(const OggFLAC__SeekableStreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->FLAC_stream_encoder); + return FLAC__stream_encoder_get_verify(encoder->private_->FLAC_stream_encoder); +} + +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_get_streamable_subset(const OggFLAC__SeekableStreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->FLAC_stream_encoder); + return FLAC__stream_encoder_get_streamable_subset(encoder->private_->FLAC_stream_encoder); +} + +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_get_do_mid_side_stereo(const OggFLAC__SeekableStreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->FLAC_stream_encoder); + return FLAC__stream_encoder_get_do_mid_side_stereo(encoder->private_->FLAC_stream_encoder); +} + +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_get_loose_mid_side_stereo(const OggFLAC__SeekableStreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->FLAC_stream_encoder); + return FLAC__stream_encoder_get_loose_mid_side_stereo(encoder->private_->FLAC_stream_encoder); +} + +OggFLAC_API unsigned OggFLAC__seekable_stream_encoder_get_channels(const OggFLAC__SeekableStreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->FLAC_stream_encoder); + return FLAC__stream_encoder_get_channels(encoder->private_->FLAC_stream_encoder); +} + +OggFLAC_API unsigned OggFLAC__seekable_stream_encoder_get_bits_per_sample(const OggFLAC__SeekableStreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->FLAC_stream_encoder); + return FLAC__stream_encoder_get_bits_per_sample(encoder->private_->FLAC_stream_encoder); +} + +OggFLAC_API unsigned OggFLAC__seekable_stream_encoder_get_sample_rate(const OggFLAC__SeekableStreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->FLAC_stream_encoder); + return FLAC__stream_encoder_get_sample_rate(encoder->private_->FLAC_stream_encoder); +} + +OggFLAC_API unsigned OggFLAC__seekable_stream_encoder_get_blocksize(const OggFLAC__SeekableStreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->FLAC_stream_encoder); + return FLAC__stream_encoder_get_blocksize(encoder->private_->FLAC_stream_encoder); +} + +OggFLAC_API unsigned OggFLAC__seekable_stream_encoder_get_max_lpc_order(const OggFLAC__SeekableStreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->FLAC_stream_encoder); + return FLAC__stream_encoder_get_max_lpc_order(encoder->private_->FLAC_stream_encoder); +} + +OggFLAC_API unsigned OggFLAC__seekable_stream_encoder_get_qlp_coeff_precision(const OggFLAC__SeekableStreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->FLAC_stream_encoder); + return FLAC__stream_encoder_get_qlp_coeff_precision(encoder->private_->FLAC_stream_encoder); +} + +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_get_do_qlp_coeff_prec_search(const OggFLAC__SeekableStreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->FLAC_stream_encoder); + return FLAC__stream_encoder_get_do_qlp_coeff_prec_search(encoder->private_->FLAC_stream_encoder); +} + +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_get_do_escape_coding(const OggFLAC__SeekableStreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->FLAC_stream_encoder); + return FLAC__stream_encoder_get_do_escape_coding(encoder->private_->FLAC_stream_encoder); +} + +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_get_do_exhaustive_model_search(const OggFLAC__SeekableStreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->FLAC_stream_encoder); + return FLAC__stream_encoder_get_do_exhaustive_model_search(encoder->private_->FLAC_stream_encoder); +} + +OggFLAC_API unsigned OggFLAC__seekable_stream_encoder_get_min_residual_partition_order(const OggFLAC__SeekableStreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->FLAC_stream_encoder); + return FLAC__stream_encoder_get_min_residual_partition_order(encoder->private_->FLAC_stream_encoder); +} + +OggFLAC_API unsigned OggFLAC__seekable_stream_encoder_get_max_residual_partition_order(const OggFLAC__SeekableStreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->FLAC_stream_encoder); + return FLAC__stream_encoder_get_max_residual_partition_order(encoder->private_->FLAC_stream_encoder); +} + +OggFLAC_API unsigned OggFLAC__seekable_stream_encoder_get_rice_parameter_search_dist(const OggFLAC__SeekableStreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->FLAC_stream_encoder); + return FLAC__stream_encoder_get_rice_parameter_search_dist(encoder->private_->FLAC_stream_encoder); +} + +OggFLAC_API FLAC__uint64 OggFLAC__seekable_stream_encoder_get_total_samples_estimate(const OggFLAC__SeekableStreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->FLAC_stream_encoder); + return FLAC__stream_encoder_get_total_samples_estimate(encoder->private_->FLAC_stream_encoder); +} + +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_process(OggFLAC__SeekableStreamEncoder *encoder, const FLAC__int32 * const buffer[], unsigned samples) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->FLAC_stream_encoder); + if(!FLAC__stream_encoder_process(encoder->private_->FLAC_stream_encoder, buffer, samples)) { + encoder->protected_->state = OggFLAC__SEEKABLE_STREAM_ENCODER_FLAC_STREAM_ENCODER_ERROR; + return false; + } + else + return true; +} + +OggFLAC_API FLAC__bool OggFLAC__seekable_stream_encoder_process_interleaved(OggFLAC__SeekableStreamEncoder *encoder, const FLAC__int32 buffer[], unsigned samples) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->FLAC_stream_encoder); + if(!FLAC__stream_encoder_process_interleaved(encoder->private_->FLAC_stream_encoder, buffer, samples)) { + encoder->protected_->state = OggFLAC__SEEKABLE_STREAM_ENCODER_FLAC_STREAM_ENCODER_ERROR; + return false; + } + else + return true; +} + +/*********************************************************************** + * + * Private class methods + * + ***********************************************************************/ + +void set_defaults_(OggFLAC__SeekableStreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + + encoder->private_->seek_callback = 0; + encoder->private_->tell_callback = 0; + encoder->private_->write_callback = 0; + encoder->private_->client_data = 0; + + encoder->private_->seek_table = 0; + + OggFLAC__ogg_encoder_aspect_set_defaults(&encoder->protected_->ogg_encoder_aspect); +} + +FLAC__StreamEncoderWriteStatus write_callback_(const FLAC__StreamEncoder *unused, const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame, void *client_data) +{ + OggFLAC__SeekableStreamEncoder *encoder = (OggFLAC__SeekableStreamEncoder*)client_data; + FLAC__StreamEncoderWriteStatus status; + FLAC__uint64 output_position; + + (void)unused; /* silence compiler warning about unused parameter */ + FLAC__ASSERT(encoder->private_->FLAC_stream_encoder == unused); + + if(encoder->private_->tell_callback(encoder, &output_position, encoder->private_->client_data) != FLAC__SEEKABLE_STREAM_ENCODER_TELL_STATUS_OK) + return encoder->protected_->state = OggFLAC__SEEKABLE_STREAM_ENCODER_TELL_ERROR; + + /* + * Watch for the STREAMINFO block and first SEEKTABLE block to go by and store their offsets. + */ + if(samples == 0) { + FLAC__MetadataType type = (buffer[0] & 0x7f); + if(type == FLAC__METADATA_TYPE_STREAMINFO) + encoder->protected_->streaminfo_offset = output_position; + else if(type == FLAC__METADATA_TYPE_SEEKTABLE && encoder->protected_->seektable_offset == 0) + encoder->protected_->seektable_offset = output_position; + } + + /* + * Mark the current seek point if hit (if audio_offset == 0 that + * means we're still writing metadata and haven't hit the first + * frame yet) + */ + if(0 != encoder->private_->seek_table && encoder->protected_->audio_offset > 0 && encoder->private_->seek_table->num_points > 0) { + const unsigned blocksize = FLAC__stream_encoder_get_blocksize(encoder->private_->FLAC_stream_encoder); + const FLAC__uint64 frame_first_sample = encoder->private_->samples_written; + const FLAC__uint64 frame_last_sample = frame_first_sample + (FLAC__uint64)blocksize - 1; + FLAC__uint64 test_sample; + unsigned i; + for(i = encoder->private_->first_seekpoint_to_check; i < encoder->private_->seek_table->num_points; i++) { + test_sample = encoder->private_->seek_table->points[i].sample_number; + if(test_sample > frame_last_sample) { + break; + } + else if(test_sample >= frame_first_sample) { + encoder->private_->seek_table->points[i].sample_number = frame_first_sample; + encoder->private_->seek_table->points[i].stream_offset = output_position - encoder->protected_->audio_offset; + encoder->private_->seek_table->points[i].frame_samples = blocksize; + encoder->private_->first_seekpoint_to_check++; + /* DO NOT: "break;" and here's why: + * The seektable template may contain more than one target + * sample for any given frame; we will keep looping, generating + * duplicate seekpoints for them, and we'll clean it up later, + * just before writing the seektable back to the metadata. + */ + } + else { + encoder->private_->first_seekpoint_to_check++; + } + } + } + + status = OggFLAC__ogg_encoder_aspect_write_callback_wrapper(&encoder->protected_->ogg_encoder_aspect, FLAC__stream_encoder_get_total_samples_estimate(encoder->private_->FLAC_stream_encoder), buffer, bytes, samples, current_frame, (OggFLAC__OggEncoderAspectWriteCallbackProxy)encoder->private_->write_callback, encoder, encoder->private_->client_data); + + if(status == FLAC__STREAM_ENCODER_WRITE_STATUS_OK) { + encoder->private_->samples_written += samples; + } + else + encoder->protected_->state = OggFLAC__SEEKABLE_STREAM_ENCODER_WRITE_ERROR; + + return status; +} + +void metadata_callback_(const FLAC__StreamEncoder *unused, const FLAC__StreamMetadata *metadata, void *client_data) +{ + OggFLAC__SeekableStreamEncoder *encoder = (OggFLAC__SeekableStreamEncoder*)client_data; + FLAC__byte b[max(6, FLAC__STREAM_METADATA_SEEKPOINT_LENGTH)]; + const FLAC__uint64 samples = metadata->data.stream_info.total_samples; + const unsigned min_framesize = metadata->data.stream_info.min_framesize; + const unsigned max_framesize = metadata->data.stream_info.max_framesize; + ogg_page page; + + FLAC__ASSERT(metadata->type == FLAC__METADATA_TYPE_STREAMINFO); + + /* We get called by the stream encoder when the encoding process + * has finished so that we can update the STREAMINFO and SEEKTABLE + * blocks. + */ + + (void)unused; /* silence compiler warning about unused parameter */ + FLAC__ASSERT(encoder->private_->FLAC_stream_encoder == unused); + + /*@@@ reopen callback here? The docs currently require user to open files in update mode from the start */ + + /* All this is based on intimate knowledge of the stream header + * layout, but a change to the header format that would break this + * would also break all streams encoded in the previous format. + */ + + /* + * Write STREAMINFO stats + */ + simple_ogg_page__init(&page); + if(!simple_ogg_page__get_at(encoder, encoder->protected_->streaminfo_offset, &page, encoder->private_->seek_callback, encoder->private_->read_callback, encoder->private_->client_data)) { + simple_ogg_page__clear(&page); + return; /* state already set */ + } + /* + * MD5 signature + */ + { + const unsigned md5_offset = + FLAC__STREAM_METADATA_HEADER_LENGTH + + ( + FLAC__STREAM_METADATA_STREAMINFO_MIN_BLOCK_SIZE_LEN + + FLAC__STREAM_METADATA_STREAMINFO_MAX_BLOCK_SIZE_LEN + + FLAC__STREAM_METADATA_STREAMINFO_MIN_FRAME_SIZE_LEN + + FLAC__STREAM_METADATA_STREAMINFO_MAX_FRAME_SIZE_LEN + + FLAC__STREAM_METADATA_STREAMINFO_SAMPLE_RATE_LEN + + FLAC__STREAM_METADATA_STREAMINFO_CHANNELS_LEN + + FLAC__STREAM_METADATA_STREAMINFO_BITS_PER_SAMPLE_LEN + + FLAC__STREAM_METADATA_STREAMINFO_TOTAL_SAMPLES_LEN + ) / 8; + + if(md5_offset + 16 > (unsigned)page.body_len) { + encoder->protected_->state = OggFLAC__SEEKABLE_STREAM_ENCODER_OGG_ERROR; + simple_ogg_page__clear(&page); + return; + } + memcpy(page.body + md5_offset, metadata->data.stream_info.md5sum, 16); + } + /* + * total samples + */ + { + const unsigned total_samples_byte_offset = + FLAC__STREAM_METADATA_HEADER_LENGTH + + ( + FLAC__STREAM_METADATA_STREAMINFO_MIN_BLOCK_SIZE_LEN + + FLAC__STREAM_METADATA_STREAMINFO_MAX_BLOCK_SIZE_LEN + + FLAC__STREAM_METADATA_STREAMINFO_MIN_FRAME_SIZE_LEN + + FLAC__STREAM_METADATA_STREAMINFO_MAX_FRAME_SIZE_LEN + + FLAC__STREAM_METADATA_STREAMINFO_SAMPLE_RATE_LEN + + FLAC__STREAM_METADATA_STREAMINFO_CHANNELS_LEN + + FLAC__STREAM_METADATA_STREAMINFO_BITS_PER_SAMPLE_LEN + - 4 + ) / 8; + + if(total_samples_byte_offset + 5 > (unsigned)page.body_len) { + encoder->protected_->state = OggFLAC__SEEKABLE_STREAM_ENCODER_OGG_ERROR; + simple_ogg_page__clear(&page); + return; + } + b[0] = (FLAC__byte)page.body[total_samples_byte_offset] & 0xF0; + b[0] |= (FLAC__byte)((samples >> 32) & 0x0F); + b[1] = (FLAC__byte)((samples >> 24) & 0xFF); + b[2] = (FLAC__byte)((samples >> 16) & 0xFF); + b[3] = (FLAC__byte)((samples >> 8) & 0xFF); + b[4] = (FLAC__byte)(samples & 0xFF); + memcpy(page.body + total_samples_byte_offset, b, 5); + } + /* + * min/max framesize + */ + { + const unsigned min_framesize_offset = + FLAC__STREAM_METADATA_HEADER_LENGTH + + ( + FLAC__STREAM_METADATA_STREAMINFO_MIN_BLOCK_SIZE_LEN + + FLAC__STREAM_METADATA_STREAMINFO_MAX_BLOCK_SIZE_LEN + ) / 8; + + if(min_framesize_offset + 6 > (unsigned)page.body_len) { + encoder->protected_->state = OggFLAC__SEEKABLE_STREAM_ENCODER_OGG_ERROR; + simple_ogg_page__clear(&page); + return; + } + b[0] = (FLAC__byte)((min_framesize >> 16) & 0xFF); + b[1] = (FLAC__byte)((min_framesize >> 8) & 0xFF); + b[2] = (FLAC__byte)(min_framesize & 0xFF); + b[3] = (FLAC__byte)((max_framesize >> 16) & 0xFF); + b[4] = (FLAC__byte)((max_framesize >> 8) & 0xFF); + b[5] = (FLAC__byte)(max_framesize & 0xFF); + memcpy(page.body + min_framesize_offset, b, 6); + } + if(!simple_ogg_page__set_at(encoder, encoder->protected_->streaminfo_offset, &page, encoder->private_->seek_callback, encoder->private_->write_callback, encoder->private_->client_data)) { + simple_ogg_page__clear(&page); + return; /* state already set */ + } + simple_ogg_page__clear(&page); + + /* + * Write seektable + */ + if(0 != encoder->private_->seek_table && encoder->private_->seek_table->num_points > 0 && encoder->protected_->seektable_offset > 0) { + unsigned i; + FLAC__byte *p; + + FLAC__format_seektable_sort(encoder->private_->seek_table); + + FLAC__ASSERT(FLAC__format_seektable_is_legal(encoder->private_->seek_table)); + + simple_ogg_page__init(&page); + if(!simple_ogg_page__get_at(encoder, encoder->protected_->seektable_offset, &page, encoder->private_->seek_callback, encoder->private_->read_callback, encoder->private_->client_data)) { + simple_ogg_page__clear(&page); + return; /* state already set */ + } + + if(FLAC__STREAM_METADATA_HEADER_LENGTH + (18*encoder->private_->seek_table->num_points) > (unsigned)page.body_len) { + encoder->protected_->state = OggFLAC__SEEKABLE_STREAM_ENCODER_OGG_ERROR; + simple_ogg_page__clear(&page); + return; + } + + for(i = 0, p = page.body + FLAC__STREAM_METADATA_HEADER_LENGTH; i < encoder->private_->seek_table->num_points; i++, p += 18) { + FLAC__uint64 xx; + unsigned x; + xx = encoder->private_->seek_table->points[i].sample_number; + b[7] = (FLAC__byte)xx; xx >>= 8; + b[6] = (FLAC__byte)xx; xx >>= 8; + b[5] = (FLAC__byte)xx; xx >>= 8; + b[4] = (FLAC__byte)xx; xx >>= 8; + b[3] = (FLAC__byte)xx; xx >>= 8; + b[2] = (FLAC__byte)xx; xx >>= 8; + b[1] = (FLAC__byte)xx; xx >>= 8; + b[0] = (FLAC__byte)xx; xx >>= 8; + xx = encoder->private_->seek_table->points[i].stream_offset; + b[15] = (FLAC__byte)xx; xx >>= 8; + b[14] = (FLAC__byte)xx; xx >>= 8; + b[13] = (FLAC__byte)xx; xx >>= 8; + b[12] = (FLAC__byte)xx; xx >>= 8; + b[11] = (FLAC__byte)xx; xx >>= 8; + b[10] = (FLAC__byte)xx; xx >>= 8; + b[9] = (FLAC__byte)xx; xx >>= 8; + b[8] = (FLAC__byte)xx; xx >>= 8; + x = encoder->private_->seek_table->points[i].frame_samples; + b[17] = (FLAC__byte)x; x >>= 8; + b[16] = (FLAC__byte)x; x >>= 8; + if(encoder->private_->write_callback(encoder, b, 18, 0, 0, encoder->private_->client_data) != FLAC__STREAM_ENCODER_WRITE_STATUS_OK) { + encoder->protected_->state = OggFLAC__SEEKABLE_STREAM_ENCODER_WRITE_ERROR; + simple_ogg_page__clear(&page); + return; + } + memcpy(p, b, 18); + } + + if(!simple_ogg_page__set_at(encoder, encoder->protected_->seektable_offset, &page, encoder->private_->seek_callback, encoder->private_->write_callback, encoder->private_->client_data)) { + simple_ogg_page__clear(&page); + return; /* state already set */ + } + simple_ogg_page__clear(&page); + } +} diff --git a/Libraries/FLAC/Files/src/libOggFLAC/stream_decoder.c b/Libraries/FLAC/Files/src/libOggFLAC/stream_decoder.c new file mode 100644 index 000000000..66a3290dc --- /dev/null +++ b/Libraries/FLAC/Files/src/libOggFLAC/stream_decoder.c @@ -0,0 +1,564 @@ +/* libOggFLAC - Free Lossless Audio Codec + Ogg library + * Copyright (C) 2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include /* for calloc() */ +#include "FLAC/assert.h" +#include "protected/stream_decoder.h" + +/*********************************************************************** + * + * Private class method prototypes + * + ***********************************************************************/ + +static void set_defaults_(OggFLAC__StreamDecoder *decoder); +static FLAC__StreamDecoderReadStatus read_callback_(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], unsigned *bytes, void *client_data); +static FLAC__StreamDecoderWriteStatus write_callback_(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data); +static void metadata_callback_(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data); +static void error_callback_(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data); +static OggFLAC__OggDecoderAspectReadStatus read_callback_proxy_(const void *void_decoder, FLAC__byte buffer[], unsigned *bytes, void *client_data); + + +/*********************************************************************** + * + * Private class data + * + ***********************************************************************/ + +typedef struct OggFLAC__StreamDecoderPrivate { + OggFLAC__StreamDecoderReadCallback read_callback; + OggFLAC__StreamDecoderWriteCallback write_callback; + OggFLAC__StreamDecoderMetadataCallback metadata_callback; + OggFLAC__StreamDecoderErrorCallback error_callback; + void *client_data; + FLAC__StreamDecoder *FLAC_stream_decoder; +} OggFLAC__StreamDecoderPrivate; + +/*********************************************************************** + * + * Public static class data + * + ***********************************************************************/ + +OggFLAC_API const char * const OggFLAC__StreamDecoderStateString[] = { + "OggFLAC__STREAM_DECODER_OK", + "OggFLAC__STREAM_DECODER_END_OF_STREAM", + "OggFLAC__STREAM_DECODER_OGG_ERROR", + "OggFLAC__STREAM_DECODER_READ_ERROR", + "OggFLAC__STREAM_DECODER_FLAC_STREAM_DECODER_ERROR", + "OggFLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR", + "OggFLAC__STREAM_DECODER_ALREADY_INITIALIZED", + "OggFLAC__STREAM_DECODER_INVALID_CALLBACK", + "OggFLAC__STREAM_DECODER_UNINITIALIZED" +}; + + +/*********************************************************************** + * + * Class constructor/destructor + * + ***********************************************************************/ +OggFLAC_API OggFLAC__StreamDecoder *OggFLAC__stream_decoder_new() +{ + OggFLAC__StreamDecoder *decoder; + + decoder = (OggFLAC__StreamDecoder*)calloc(1, sizeof(OggFLAC__StreamDecoder)); + if(decoder == 0) { + return 0; + } + + decoder->protected_ = (OggFLAC__StreamDecoderProtected*)calloc(1, sizeof(OggFLAC__StreamDecoderProtected)); + if(decoder->protected_ == 0) { + free(decoder); + return 0; + } + + decoder->private_ = (OggFLAC__StreamDecoderPrivate*)calloc(1, sizeof(OggFLAC__StreamDecoderPrivate)); + if(decoder->private_ == 0) { + free(decoder->protected_); + free(decoder); + return 0; + } + + decoder->private_->FLAC_stream_decoder = FLAC__stream_decoder_new(); + if(0 == decoder->private_->FLAC_stream_decoder) { + free(decoder->private_); + free(decoder->protected_); + free(decoder); + return 0; + } + + set_defaults_(decoder); + + decoder->protected_->state = OggFLAC__STREAM_DECODER_UNINITIALIZED; + + return decoder; +} + +OggFLAC_API void OggFLAC__stream_decoder_delete(OggFLAC__StreamDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->protected_); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->private_->FLAC_stream_decoder); + + OggFLAC__stream_decoder_finish(decoder); + + FLAC__stream_decoder_delete(decoder->private_->FLAC_stream_decoder); + + free(decoder->private_); + free(decoder->protected_); + free(decoder); +} + +/*********************************************************************** + * + * Public class methods + * + ***********************************************************************/ + +OggFLAC_API OggFLAC__StreamDecoderState OggFLAC__stream_decoder_init(OggFLAC__StreamDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + + if(decoder->protected_->state != OggFLAC__STREAM_DECODER_UNINITIALIZED) + return decoder->protected_->state = OggFLAC__STREAM_DECODER_ALREADY_INITIALIZED; + + if(0 == decoder->private_->read_callback || 0 == decoder->private_->write_callback || 0 == decoder->private_->metadata_callback || 0 == decoder->private_->error_callback) + return decoder->protected_->state = OggFLAC__STREAM_DECODER_INVALID_CALLBACK; + + if(!OggFLAC__ogg_decoder_aspect_init(&decoder->protected_->ogg_decoder_aspect)) + return decoder->protected_->state = OggFLAC__STREAM_DECODER_OGG_ERROR; + + FLAC__stream_decoder_set_read_callback(decoder->private_->FLAC_stream_decoder, read_callback_); + FLAC__stream_decoder_set_write_callback(decoder->private_->FLAC_stream_decoder, write_callback_); + FLAC__stream_decoder_set_metadata_callback(decoder->private_->FLAC_stream_decoder, metadata_callback_); + FLAC__stream_decoder_set_error_callback(decoder->private_->FLAC_stream_decoder, error_callback_); + FLAC__stream_decoder_set_client_data(decoder->private_->FLAC_stream_decoder, decoder); + + if(FLAC__stream_decoder_init(decoder->private_->FLAC_stream_decoder) != FLAC__STREAM_DECODER_SEARCH_FOR_METADATA) + return decoder->protected_->state = OggFLAC__STREAM_DECODER_FLAC_STREAM_DECODER_ERROR; + + return decoder->protected_->state = OggFLAC__STREAM_DECODER_OK; +} + +OggFLAC_API void OggFLAC__stream_decoder_finish(OggFLAC__StreamDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + + if(decoder->protected_->state == OggFLAC__STREAM_DECODER_UNINITIALIZED) + return; + + FLAC__ASSERT(0 != decoder->private_->FLAC_stream_decoder); + + FLAC__stream_decoder_finish(decoder->private_->FLAC_stream_decoder); + + OggFLAC__ogg_decoder_aspect_finish(&decoder->protected_->ogg_decoder_aspect); + + set_defaults_(decoder); + + decoder->protected_->state = OggFLAC__STREAM_DECODER_UNINITIALIZED; +} + +OggFLAC_API FLAC__bool OggFLAC__stream_decoder_set_read_callback(OggFLAC__StreamDecoder *decoder, OggFLAC__StreamDecoderReadCallback value) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + if(decoder->protected_->state != OggFLAC__STREAM_DECODER_UNINITIALIZED) + return false; + decoder->private_->read_callback = value; + return true; +} + +OggFLAC_API FLAC__bool OggFLAC__stream_decoder_set_write_callback(OggFLAC__StreamDecoder *decoder, OggFLAC__StreamDecoderWriteCallback value) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + if(decoder->protected_->state != OggFLAC__STREAM_DECODER_UNINITIALIZED) + return false; + decoder->private_->write_callback = value; + return true; +} + +OggFLAC_API FLAC__bool OggFLAC__stream_decoder_set_metadata_callback(OggFLAC__StreamDecoder *decoder, OggFLAC__StreamDecoderMetadataCallback value) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + if(decoder->protected_->state != OggFLAC__STREAM_DECODER_UNINITIALIZED) + return false; + decoder->private_->metadata_callback = value; + return true; +} + +OggFLAC_API FLAC__bool OggFLAC__stream_decoder_set_error_callback(OggFLAC__StreamDecoder *decoder, OggFLAC__StreamDecoderErrorCallback value) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + if(decoder->protected_->state != OggFLAC__STREAM_DECODER_UNINITIALIZED) + return false; + decoder->private_->error_callback = value; + return true; +} + +OggFLAC_API FLAC__bool OggFLAC__stream_decoder_set_client_data(OggFLAC__StreamDecoder *decoder, void *value) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + if(decoder->protected_->state != OggFLAC__STREAM_DECODER_UNINITIALIZED) + return false; + decoder->private_->client_data = value; + return true; +} + +OggFLAC_API FLAC__bool OggFLAC__stream_decoder_set_serial_number(OggFLAC__StreamDecoder *decoder, long value) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + if(decoder->protected_->state != OggFLAC__STREAM_DECODER_UNINITIALIZED) + return false; + OggFLAC__ogg_decoder_aspect_set_serial_number(&decoder->protected_->ogg_decoder_aspect, value); + return true; +} + +OggFLAC_API FLAC__bool OggFLAC__stream_decoder_set_metadata_respond(OggFLAC__StreamDecoder *decoder, FLAC__MetadataType type) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + if(decoder->protected_->state != OggFLAC__STREAM_DECODER_UNINITIALIZED) + return false; + return FLAC__stream_decoder_set_metadata_respond(decoder->private_->FLAC_stream_decoder, type); +} + +OggFLAC_API FLAC__bool OggFLAC__stream_decoder_set_metadata_respond_application(OggFLAC__StreamDecoder *decoder, const FLAC__byte id[4]) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + if(decoder->protected_->state != OggFLAC__STREAM_DECODER_UNINITIALIZED) + return false; + return FLAC__stream_decoder_set_metadata_respond_application(decoder->private_->FLAC_stream_decoder, id); +} + +OggFLAC_API FLAC__bool OggFLAC__stream_decoder_set_metadata_respond_all(OggFLAC__StreamDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + if(decoder->protected_->state != OggFLAC__STREAM_DECODER_UNINITIALIZED) + return false; + return FLAC__stream_decoder_set_metadata_respond_all(decoder->private_->FLAC_stream_decoder); +} + +OggFLAC_API FLAC__bool OggFLAC__stream_decoder_set_metadata_ignore(OggFLAC__StreamDecoder *decoder, FLAC__MetadataType type) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + if(decoder->protected_->state != OggFLAC__STREAM_DECODER_UNINITIALIZED) + return false; + return FLAC__stream_decoder_set_metadata_ignore(decoder->private_->FLAC_stream_decoder, type); +} + +OggFLAC_API FLAC__bool OggFLAC__stream_decoder_set_metadata_ignore_application(OggFLAC__StreamDecoder *decoder, const FLAC__byte id[4]) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + if(decoder->protected_->state != OggFLAC__STREAM_DECODER_UNINITIALIZED) + return false; + return FLAC__stream_decoder_set_metadata_ignore_application(decoder->private_->FLAC_stream_decoder, id); +} + +OggFLAC_API FLAC__bool OggFLAC__stream_decoder_set_metadata_ignore_all(OggFLAC__StreamDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + if(decoder->protected_->state != OggFLAC__STREAM_DECODER_UNINITIALIZED) + return false; + return FLAC__stream_decoder_set_metadata_ignore_all(decoder->private_->FLAC_stream_decoder); +} + +OggFLAC_API OggFLAC__StreamDecoderState OggFLAC__stream_decoder_get_state(const OggFLAC__StreamDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->protected_); + return decoder->protected_->state; +} + +OggFLAC_API FLAC__StreamDecoderState OggFLAC__stream_decoder_get_FLAC_stream_decoder_state(const OggFLAC__StreamDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + return FLAC__stream_decoder_get_state(decoder->private_->FLAC_stream_decoder); +} + +OggFLAC_API const char *OggFLAC__stream_decoder_get_resolved_state_string(const OggFLAC__StreamDecoder *decoder) +{ + if(decoder->protected_->state != OggFLAC__STREAM_DECODER_FLAC_STREAM_DECODER_ERROR) + return OggFLAC__StreamDecoderStateString[decoder->protected_->state]; + else + return FLAC__stream_decoder_get_resolved_state_string(decoder->private_->FLAC_stream_decoder); +} + +OggFLAC_API unsigned OggFLAC__stream_decoder_get_channels(const OggFLAC__StreamDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + return FLAC__stream_decoder_get_channels(decoder->private_->FLAC_stream_decoder); +} + +OggFLAC_API FLAC__ChannelAssignment OggFLAC__stream_decoder_get_channel_assignment(const OggFLAC__StreamDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + return FLAC__stream_decoder_get_channel_assignment(decoder->private_->FLAC_stream_decoder); +} + +OggFLAC_API unsigned OggFLAC__stream_decoder_get_bits_per_sample(const OggFLAC__StreamDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + return FLAC__stream_decoder_get_bits_per_sample(decoder->private_->FLAC_stream_decoder); +} + +OggFLAC_API unsigned OggFLAC__stream_decoder_get_sample_rate(const OggFLAC__StreamDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + return FLAC__stream_decoder_get_sample_rate(decoder->private_->FLAC_stream_decoder); +} + +OggFLAC_API unsigned OggFLAC__stream_decoder_get_blocksize(const OggFLAC__StreamDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + return FLAC__stream_decoder_get_blocksize(decoder->private_->FLAC_stream_decoder); +} + +OggFLAC_API FLAC__bool OggFLAC__stream_decoder_flush(OggFLAC__StreamDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + + OggFLAC__ogg_decoder_aspect_flush(&decoder->protected_->ogg_decoder_aspect); + + if(!FLAC__stream_decoder_flush(decoder->private_->FLAC_stream_decoder)) { + decoder->protected_->state = OggFLAC__STREAM_DECODER_FLAC_STREAM_DECODER_ERROR; + return false; + } + + decoder->protected_->state = OggFLAC__STREAM_DECODER_OK; + + return true; +} + +OggFLAC_API FLAC__bool OggFLAC__stream_decoder_reset(OggFLAC__StreamDecoder *decoder) +{ + FLAC__ASSERT(0 != decoder); + FLAC__ASSERT(0 != decoder->private_); + FLAC__ASSERT(0 != decoder->protected_); + + if(!OggFLAC__stream_decoder_flush(decoder)) { + decoder->protected_->state = OggFLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; + return false; + } + + OggFLAC__ogg_decoder_aspect_reset(&decoder->protected_->ogg_decoder_aspect); + + if(!FLAC__stream_decoder_reset(decoder->private_->FLAC_stream_decoder)) { + decoder->protected_->state = OggFLAC__STREAM_DECODER_FLAC_STREAM_DECODER_ERROR; + return false; + } + + decoder->protected_->state = OggFLAC__STREAM_DECODER_OK; + + return true; +} + +OggFLAC_API FLAC__bool OggFLAC__stream_decoder_process_single(OggFLAC__StreamDecoder *decoder) +{ + FLAC__bool ret; + FLAC__ASSERT(0 != decoder); + + if(FLAC__stream_decoder_get_state(decoder->private_->FLAC_stream_decoder) == FLAC__STREAM_DECODER_END_OF_STREAM) + decoder->protected_->state = OggFLAC__STREAM_DECODER_END_OF_STREAM; + + if(decoder->protected_->state == OggFLAC__STREAM_DECODER_END_OF_STREAM) + return true; + + FLAC__ASSERT(decoder->protected_->state == OggFLAC__STREAM_DECODER_OK); + + ret = FLAC__stream_decoder_process_single(decoder->private_->FLAC_stream_decoder); + if(!ret) + decoder->protected_->state = OggFLAC__STREAM_DECODER_FLAC_STREAM_DECODER_ERROR; + + return ret; +} + +OggFLAC_API FLAC__bool OggFLAC__stream_decoder_process_until_end_of_metadata(OggFLAC__StreamDecoder *decoder) +{ + FLAC__bool ret; + FLAC__ASSERT(0 != decoder); + + if(FLAC__stream_decoder_get_state(decoder->private_->FLAC_stream_decoder) == FLAC__STREAM_DECODER_END_OF_STREAM) + decoder->protected_->state = OggFLAC__STREAM_DECODER_END_OF_STREAM; + + if(decoder->protected_->state == OggFLAC__STREAM_DECODER_END_OF_STREAM) + return true; + + FLAC__ASSERT(decoder->protected_->state == OggFLAC__STREAM_DECODER_OK); + + ret = FLAC__stream_decoder_process_until_end_of_metadata(decoder->private_->FLAC_stream_decoder); + if(!ret) + decoder->protected_->state = OggFLAC__STREAM_DECODER_FLAC_STREAM_DECODER_ERROR; + + return ret; +} + +OggFLAC_API FLAC__bool OggFLAC__stream_decoder_process_until_end_of_stream(OggFLAC__StreamDecoder *decoder) +{ + FLAC__bool ret; + FLAC__ASSERT(0 != decoder); + + if(FLAC__stream_decoder_get_state(decoder->private_->FLAC_stream_decoder) == FLAC__STREAM_DECODER_END_OF_STREAM) + decoder->protected_->state = OggFLAC__STREAM_DECODER_END_OF_STREAM; + + if(decoder->protected_->state == OggFLAC__STREAM_DECODER_END_OF_STREAM) + return true; + + FLAC__ASSERT(decoder->protected_->state == OggFLAC__STREAM_DECODER_OK); + + ret = FLAC__stream_decoder_process_until_end_of_stream(decoder->private_->FLAC_stream_decoder); + if(!ret) + decoder->protected_->state = OggFLAC__STREAM_DECODER_FLAC_STREAM_DECODER_ERROR; + + return ret; +} + + +/*********************************************************************** + * + * Private class methods + * + ***********************************************************************/ + +void set_defaults_(OggFLAC__StreamDecoder *decoder) +{ + decoder->private_->read_callback = 0; + decoder->private_->write_callback = 0; + decoder->private_->metadata_callback = 0; + decoder->private_->error_callback = 0; + decoder->private_->client_data = 0; + OggFLAC__ogg_decoder_aspect_set_defaults(&decoder->protected_->ogg_decoder_aspect); +} + +FLAC__StreamDecoderReadStatus read_callback_(const FLAC__StreamDecoder *unused, FLAC__byte buffer[], unsigned *bytes, void *client_data) +{ + OggFLAC__StreamDecoder *decoder = (OggFLAC__StreamDecoder*)client_data; + + (void)unused; + + switch(OggFLAC__ogg_decoder_aspect_read_callback_wrapper(&decoder->protected_->ogg_decoder_aspect, buffer, bytes, read_callback_proxy_, decoder, decoder->private_->client_data)) { + case OggFLAC__OGG_DECODER_ASPECT_READ_STATUS_OK: + return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE; + /* we don't really have a way to handle lost sync via read + * callback so we'll let it pass and let the underlying + * FLAC decoder catch the error + */ + case OggFLAC__OGG_DECODER_ASPECT_READ_STATUS_LOST_SYNC: + return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE; + case OggFLAC__OGG_DECODER_ASPECT_READ_STATUS_END_OF_STREAM: + return FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM; + case OggFLAC__OGG_DECODER_ASPECT_READ_STATUS_NOT_FLAC: + case OggFLAC__OGG_DECODER_ASPECT_READ_STATUS_UNSUPPORTED_MAPPING_VERSION: + case OggFLAC__OGG_DECODER_ASPECT_READ_STATUS_ABORT: + case OggFLAC__OGG_DECODER_ASPECT_READ_STATUS_ERROR: + decoder->protected_->state = OggFLAC__STREAM_DECODER_READ_ERROR; + return FLAC__STREAM_DECODER_READ_STATUS_ABORT; + case OggFLAC__OGG_DECODER_ASPECT_READ_STATUS_MEMORY_ALLOCATION_ERROR: + decoder->protected_->state = OggFLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; + return FLAC__STREAM_DECODER_READ_STATUS_ABORT; + default: + FLAC__ASSERT(0); + /* double protection */ + return FLAC__STREAM_DECODER_READ_STATUS_ABORT; + } +} + +FLAC__StreamDecoderWriteStatus write_callback_(const FLAC__StreamDecoder *unused, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data) +{ + OggFLAC__StreamDecoder *decoder = (OggFLAC__StreamDecoder*)client_data; + (void)unused; + return decoder->private_->write_callback(decoder, frame, buffer, decoder->private_->client_data); +} + +void metadata_callback_(const FLAC__StreamDecoder *unused, const FLAC__StreamMetadata *metadata, void *client_data) +{ + OggFLAC__StreamDecoder *decoder = (OggFLAC__StreamDecoder*)client_data; + (void)unused; + decoder->private_->metadata_callback(decoder, metadata, decoder->private_->client_data); +} + +void error_callback_(const FLAC__StreamDecoder *unused, FLAC__StreamDecoderErrorStatus status, void *client_data) +{ + OggFLAC__StreamDecoder *decoder = (OggFLAC__StreamDecoder*)client_data; + (void)unused; + decoder->private_->error_callback(decoder, status, decoder->private_->client_data); +} + +OggFLAC__OggDecoderAspectReadStatus read_callback_proxy_(const void *void_decoder, FLAC__byte buffer[], unsigned *bytes, void *client_data) +{ + OggFLAC__StreamDecoder *decoder = (OggFLAC__StreamDecoder*)void_decoder; + + switch(decoder->private_->read_callback(decoder, buffer, bytes, client_data)) { + case FLAC__STREAM_DECODER_READ_STATUS_CONTINUE: + return OggFLAC__OGG_DECODER_ASPECT_READ_STATUS_OK; + case FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM: + return OggFLAC__OGG_DECODER_ASPECT_READ_STATUS_END_OF_STREAM; + case FLAC__STREAM_DECODER_READ_STATUS_ABORT: + return OggFLAC__OGG_DECODER_ASPECT_READ_STATUS_ABORT; + default: + /* double protection: */ + FLAC__ASSERT(0); + return OggFLAC__OGG_DECODER_ASPECT_READ_STATUS_ABORT; + } +} diff --git a/Libraries/FLAC/Files/src/libOggFLAC/stream_encoder.c b/Libraries/FLAC/Files/src/libOggFLAC/stream_encoder.c new file mode 100644 index 000000000..2552101a7 --- /dev/null +++ b/Libraries/FLAC/Files/src/libOggFLAC/stream_encoder.c @@ -0,0 +1,713 @@ +/* libOggFLAC - Free Lossless Audio Codec + Ogg library + * Copyright (C) 2002,2003,2004,2005 Josh Coalson + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include /* for calloc() */ +#include "FLAC/assert.h" +#include "OggFLAC/stream_encoder.h" +#include "protected/stream_encoder.h" + +/*********************************************************************** + * + * Private class method prototypes + * + ***********************************************************************/ + +/* unpublished debug routines */ +extern FLAC__bool FLAC__stream_encoder_disable_constant_subframes(FLAC__StreamEncoder *encoder, FLAC__bool value); +extern FLAC__bool FLAC__stream_encoder_disable_fixed_subframes(FLAC__StreamEncoder *encoder, FLAC__bool value); +extern FLAC__bool FLAC__stream_encoder_disable_verbatim_subframes(FLAC__StreamEncoder *encoder, FLAC__bool value); + +static void set_defaults_(OggFLAC__StreamEncoder *encoder); +static FLAC__StreamEncoderWriteStatus write_callback_(const FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame, void *client_data); +static void metadata_callback_(const FLAC__StreamEncoder *encoder, const FLAC__StreamMetadata *metadata, void *client_data); + + +/*********************************************************************** + * + * Private class data + * + ***********************************************************************/ + +typedef struct OggFLAC__StreamEncoderPrivate { + OggFLAC__StreamEncoderWriteCallback write_callback; + OggFLAC__StreamEncoderMetadataCallback metadata_callback; + void *client_data; + FLAC__StreamEncoder *FLAC_stream_encoder; +} OggFLAC__StreamEncoderPrivate; + + +/*********************************************************************** + * + * Public static class data + * + ***********************************************************************/ + +OggFLAC_API const char * const OggFLAC__StreamEncoderStateString[] = { + "OggFLAC__STREAM_ENCODER_OK", + "OggFLAC__STREAM_ENCODER_OGG_ERROR", + "OggFLAC__STREAM_ENCODER_FLAC_STREAM_ENCODER_ERROR", + "OggFLAC__STREAM_ENCODER_INVALID_CALLBACK", + "OggFLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR", + "OggFLAC__STREAM_ENCODER_ALREADY_INITIALIZED", + "OggFLAC__STREAM_ENCODER_UNINITIALIZED" +}; + + +/*********************************************************************** + * + * Class constructor/destructor + * + */ +OggFLAC_API OggFLAC__StreamEncoder *OggFLAC__stream_encoder_new() +{ + OggFLAC__StreamEncoder *encoder; + + encoder = (OggFLAC__StreamEncoder*)calloc(1, sizeof(OggFLAC__StreamEncoder)); + if(encoder == 0) { + return 0; + } + + encoder->protected_ = (OggFLAC__StreamEncoderProtected*)calloc(1, sizeof(OggFLAC__StreamEncoderProtected)); + if(encoder->protected_ == 0) { + free(encoder); + return 0; + } + + encoder->private_ = (OggFLAC__StreamEncoderPrivate*)calloc(1, sizeof(OggFLAC__StreamEncoderPrivate)); + if(encoder->private_ == 0) { + free(encoder->protected_); + free(encoder); + return 0; + } + + encoder->private_->FLAC_stream_encoder = FLAC__stream_encoder_new(); + if(0 == encoder->private_->FLAC_stream_encoder) { + free(encoder->private_); + free(encoder->protected_); + free(encoder); + return 0; + } + + set_defaults_(encoder); + + encoder->protected_->state = OggFLAC__STREAM_ENCODER_UNINITIALIZED; + + return encoder; +} + +OggFLAC_API void OggFLAC__stream_encoder_delete(OggFLAC__StreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->private_->FLAC_stream_encoder); + + (void)OggFLAC__stream_encoder_finish(encoder); + + FLAC__stream_encoder_delete(encoder->private_->FLAC_stream_encoder); + + free(encoder->private_); + free(encoder->protected_); + free(encoder); +} + + +/*********************************************************************** + * + * Public class methods + * + ***********************************************************************/ + +OggFLAC_API OggFLAC__StreamEncoderState OggFLAC__stream_encoder_init(OggFLAC__StreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + + if(encoder->protected_->state != OggFLAC__STREAM_ENCODER_UNINITIALIZED) + return encoder->protected_->state = OggFLAC__STREAM_ENCODER_ALREADY_INITIALIZED; + + if(0 == encoder->private_->write_callback || 0 == encoder->private_->metadata_callback) + return encoder->protected_->state = OggFLAC__STREAM_ENCODER_INVALID_CALLBACK; + + if(!OggFLAC__ogg_encoder_aspect_init(&encoder->protected_->ogg_encoder_aspect)) + return encoder->protected_->state = OggFLAC__STREAM_ENCODER_OGG_ERROR; + + FLAC__stream_encoder_set_write_callback(encoder->private_->FLAC_stream_encoder, write_callback_); + FLAC__stream_encoder_set_metadata_callback(encoder->private_->FLAC_stream_encoder, metadata_callback_); + FLAC__stream_encoder_set_client_data(encoder->private_->FLAC_stream_encoder, encoder); + + if(FLAC__stream_encoder_init(encoder->private_->FLAC_stream_encoder) != FLAC__STREAM_ENCODER_OK) + return encoder->protected_->state = OggFLAC__STREAM_ENCODER_FLAC_STREAM_ENCODER_ERROR; + + return encoder->protected_->state = OggFLAC__STREAM_ENCODER_OK; +} + +OggFLAC_API void OggFLAC__stream_encoder_finish(OggFLAC__StreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + + if(encoder->protected_->state == OggFLAC__STREAM_ENCODER_UNINITIALIZED) + return; + + FLAC__ASSERT(0 != encoder->private_->FLAC_stream_encoder); + + FLAC__stream_encoder_finish(encoder->private_->FLAC_stream_encoder); + + OggFLAC__ogg_encoder_aspect_finish(&encoder->protected_->ogg_encoder_aspect); + + set_defaults_(encoder); + + encoder->protected_->state = OggFLAC__STREAM_ENCODER_UNINITIALIZED; +} + +OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_serial_number(OggFLAC__StreamEncoder *encoder, long value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->FLAC_stream_encoder); + if(encoder->protected_->state != OggFLAC__STREAM_ENCODER_UNINITIALIZED) + return false; + OggFLAC__ogg_encoder_aspect_set_serial_number(&encoder->protected_->ogg_encoder_aspect, value); + return true; +} + +OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_verify(OggFLAC__StreamEncoder *encoder, FLAC__bool value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->FLAC_stream_encoder); + if(encoder->protected_->state != OggFLAC__STREAM_ENCODER_UNINITIALIZED) + return false; + return FLAC__stream_encoder_set_verify(encoder->private_->FLAC_stream_encoder, value); +} + +OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_streamable_subset(OggFLAC__StreamEncoder *encoder, FLAC__bool value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->FLAC_stream_encoder); + if(encoder->protected_->state != OggFLAC__STREAM_ENCODER_UNINITIALIZED) + return false; + return FLAC__stream_encoder_set_streamable_subset(encoder->private_->FLAC_stream_encoder, value); +} + +OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_do_mid_side_stereo(OggFLAC__StreamEncoder *encoder, FLAC__bool value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->FLAC_stream_encoder); + if(encoder->protected_->state != OggFLAC__STREAM_ENCODER_UNINITIALIZED) + return false; + return FLAC__stream_encoder_set_do_mid_side_stereo(encoder->private_->FLAC_stream_encoder, value); +} + +OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_loose_mid_side_stereo(OggFLAC__StreamEncoder *encoder, FLAC__bool value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->FLAC_stream_encoder); + if(encoder->protected_->state != OggFLAC__STREAM_ENCODER_UNINITIALIZED) + return false; + return FLAC__stream_encoder_set_loose_mid_side_stereo(encoder->private_->FLAC_stream_encoder, value); +} + +OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_channels(OggFLAC__StreamEncoder *encoder, unsigned value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->FLAC_stream_encoder); + if(encoder->protected_->state != OggFLAC__STREAM_ENCODER_UNINITIALIZED) + return false; + return FLAC__stream_encoder_set_channels(encoder->private_->FLAC_stream_encoder, value); +} + +OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_bits_per_sample(OggFLAC__StreamEncoder *encoder, unsigned value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->FLAC_stream_encoder); + if(encoder->protected_->state != OggFLAC__STREAM_ENCODER_UNINITIALIZED) + return false; + return FLAC__stream_encoder_set_bits_per_sample(encoder->private_->FLAC_stream_encoder, value); +} + +OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_sample_rate(OggFLAC__StreamEncoder *encoder, unsigned value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->FLAC_stream_encoder); + if(encoder->protected_->state != OggFLAC__STREAM_ENCODER_UNINITIALIZED) + return false; + return FLAC__stream_encoder_set_sample_rate(encoder->private_->FLAC_stream_encoder, value); +} + +OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_blocksize(OggFLAC__StreamEncoder *encoder, unsigned value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->FLAC_stream_encoder); + if(encoder->protected_->state != OggFLAC__STREAM_ENCODER_UNINITIALIZED) + return false; + return FLAC__stream_encoder_set_blocksize(encoder->private_->FLAC_stream_encoder, value); +} + +OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_max_lpc_order(OggFLAC__StreamEncoder *encoder, unsigned value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->FLAC_stream_encoder); + if(encoder->protected_->state != OggFLAC__STREAM_ENCODER_UNINITIALIZED) + return false; + return FLAC__stream_encoder_set_max_lpc_order(encoder->private_->FLAC_stream_encoder, value); +} + +OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_qlp_coeff_precision(OggFLAC__StreamEncoder *encoder, unsigned value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->FLAC_stream_encoder); + if(encoder->protected_->state != OggFLAC__STREAM_ENCODER_UNINITIALIZED) + return false; + return FLAC__stream_encoder_set_qlp_coeff_precision(encoder->private_->FLAC_stream_encoder, value); +} + +OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_do_qlp_coeff_prec_search(OggFLAC__StreamEncoder *encoder, FLAC__bool value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->FLAC_stream_encoder); + if(encoder->protected_->state != OggFLAC__STREAM_ENCODER_UNINITIALIZED) + return false; + return FLAC__stream_encoder_set_do_qlp_coeff_prec_search(encoder->private_->FLAC_stream_encoder, value); +} + +OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_do_escape_coding(OggFLAC__StreamEncoder *encoder, FLAC__bool value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->FLAC_stream_encoder); + if(encoder->protected_->state != OggFLAC__STREAM_ENCODER_UNINITIALIZED) + return false; + return FLAC__stream_encoder_set_do_escape_coding(encoder->private_->FLAC_stream_encoder, value); +} + +OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_do_exhaustive_model_search(OggFLAC__StreamEncoder *encoder, FLAC__bool value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->FLAC_stream_encoder); + if(encoder->protected_->state != OggFLAC__STREAM_ENCODER_UNINITIALIZED) + return false; + return FLAC__stream_encoder_set_do_exhaustive_model_search(encoder->private_->FLAC_stream_encoder, value); +} + +OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_min_residual_partition_order(OggFLAC__StreamEncoder *encoder, unsigned value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->FLAC_stream_encoder); + if(encoder->protected_->state != OggFLAC__STREAM_ENCODER_UNINITIALIZED) + return false; + return FLAC__stream_encoder_set_min_residual_partition_order(encoder->private_->FLAC_stream_encoder, value); +} + +OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_max_residual_partition_order(OggFLAC__StreamEncoder *encoder, unsigned value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->FLAC_stream_encoder); + if(encoder->protected_->state != OggFLAC__STREAM_ENCODER_UNINITIALIZED) + return false; + return FLAC__stream_encoder_set_max_residual_partition_order(encoder->private_->FLAC_stream_encoder, value); +} + +OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_rice_parameter_search_dist(OggFLAC__StreamEncoder *encoder, unsigned value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->FLAC_stream_encoder); + if(encoder->protected_->state != OggFLAC__STREAM_ENCODER_UNINITIALIZED) + return false; + return FLAC__stream_encoder_set_rice_parameter_search_dist(encoder->private_->FLAC_stream_encoder, value); +} + +OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_total_samples_estimate(OggFLAC__StreamEncoder *encoder, FLAC__uint64 value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->FLAC_stream_encoder); + if(encoder->protected_->state != OggFLAC__STREAM_ENCODER_UNINITIALIZED) + return false; + return FLAC__stream_encoder_set_total_samples_estimate(encoder->private_->FLAC_stream_encoder, value); +} + +OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_metadata(OggFLAC__StreamEncoder *encoder, FLAC__StreamMetadata **metadata, unsigned num_blocks) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != encoder->private_->FLAC_stream_encoder); + if(encoder->protected_->state != OggFLAC__STREAM_ENCODER_UNINITIALIZED) + return false; + /* reorder metadata if necessary to ensure that any VORBIS_COMMENT is the first, according to the mapping spec */ + if(0 != metadata && num_blocks > 1) { + unsigned i; + for(i = 1; i < num_blocks; i++) { + if(0 != metadata[i] && metadata[i]->type == FLAC__METADATA_TYPE_VORBIS_COMMENT) { + FLAC__StreamMetadata *vc = metadata[i]; + for( ; i > 0; i--) + metadata[i] = metadata[i-1]; + metadata[0] = vc; + break; + } + } + } + if(!OggFLAC__ogg_encoder_aspect_set_num_metadata(&encoder->protected_->ogg_encoder_aspect, num_blocks)) + return false; + return FLAC__stream_encoder_set_metadata(encoder->private_->FLAC_stream_encoder, metadata, num_blocks); +} + +OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_write_callback(OggFLAC__StreamEncoder *encoder, OggFLAC__StreamEncoderWriteCallback value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != value); + if(encoder->protected_->state != OggFLAC__STREAM_ENCODER_UNINITIALIZED) + return false; + encoder->private_->write_callback = value; + return true; +} + +OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_metadata_callback(OggFLAC__StreamEncoder *encoder, OggFLAC__StreamEncoderMetadataCallback value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + FLAC__ASSERT(0 != value); + if(encoder->protected_->state != OggFLAC__STREAM_ENCODER_UNINITIALIZED) + return false; + encoder->private_->metadata_callback = value; + return true; +} + +OggFLAC_API FLAC__bool OggFLAC__stream_encoder_set_client_data(OggFLAC__StreamEncoder *encoder, void *value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + if(encoder->protected_->state != OggFLAC__STREAM_ENCODER_UNINITIALIZED) + return false; + encoder->private_->client_data = value; + return true; +} + +/* + * These three functions are not static, but not publically exposed in + * include/FLAC/ either. They are used by the test suite. + */ +OggFLAC_API FLAC__bool OggFLAC__stream_encoder_disable_constant_subframes(OggFLAC__StreamEncoder *encoder, FLAC__bool value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + if(encoder->protected_->state != OggFLAC__STREAM_ENCODER_UNINITIALIZED) + return false; + return FLAC__stream_encoder_disable_constant_subframes(encoder->private_->FLAC_stream_encoder, value); +} + +OggFLAC_API FLAC__bool OggFLAC__stream_encoder_disable_fixed_subframes(OggFLAC__StreamEncoder *encoder, FLAC__bool value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + if(encoder->protected_->state != OggFLAC__STREAM_ENCODER_UNINITIALIZED) + return false; + return FLAC__stream_encoder_disable_fixed_subframes(encoder->private_->FLAC_stream_encoder, value); +} + +OggFLAC_API FLAC__bool OggFLAC__stream_encoder_disable_verbatim_subframes(OggFLAC__StreamEncoder *encoder, FLAC__bool value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + if(encoder->protected_->state != OggFLAC__STREAM_ENCODER_UNINITIALIZED) + return false; + return FLAC__stream_encoder_disable_verbatim_subframes(encoder->private_->FLAC_stream_encoder, value); +} + +OggFLAC_API OggFLAC__StreamEncoderState OggFLAC__stream_encoder_get_state(const OggFLAC__StreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + return encoder->protected_->state; +} + +OggFLAC_API FLAC__StreamEncoderState OggFLAC__stream_encoder_get_FLAC_stream_encoder_state(const OggFLAC__StreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + return FLAC__stream_encoder_get_state(encoder->private_->FLAC_stream_encoder); +} + +OggFLAC_API FLAC__StreamDecoderState OggFLAC__stream_encoder_get_verify_decoder_state(const OggFLAC__StreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + return FLAC__stream_encoder_get_verify_decoder_state(encoder->private_->FLAC_stream_encoder); +} + +OggFLAC_API const char *OggFLAC__stream_encoder_get_resolved_state_string(const OggFLAC__StreamEncoder *encoder) +{ + if(encoder->protected_->state != OggFLAC__STREAM_ENCODER_FLAC_STREAM_ENCODER_ERROR) + return OggFLAC__StreamEncoderStateString[encoder->protected_->state]; + else + return FLAC__stream_encoder_get_resolved_state_string(encoder->private_->FLAC_stream_encoder); +} + +OggFLAC_API void OggFLAC__stream_encoder_get_verify_decoder_error_stats(const OggFLAC__StreamEncoder *encoder, FLAC__uint64 *absolute_sample, unsigned *frame_number, unsigned *channel, unsigned *sample, FLAC__int32 *expected, FLAC__int32 *got) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__stream_encoder_get_verify_decoder_error_stats(encoder->private_->FLAC_stream_encoder, absolute_sample, frame_number, channel, sample, expected, got); +} + +OggFLAC_API FLAC__bool OggFLAC__stream_encoder_get_verify(const OggFLAC__StreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + return FLAC__stream_encoder_get_verify(encoder->private_->FLAC_stream_encoder); +} + +OggFLAC_API FLAC__bool OggFLAC__stream_encoder_get_streamable_subset(const OggFLAC__StreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + return FLAC__stream_encoder_get_streamable_subset(encoder->private_->FLAC_stream_encoder); +} + +OggFLAC_API FLAC__bool OggFLAC__stream_encoder_get_do_mid_side_stereo(const OggFLAC__StreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + return FLAC__stream_encoder_get_do_mid_side_stereo(encoder->private_->FLAC_stream_encoder); +} + +OggFLAC_API FLAC__bool OggFLAC__stream_encoder_get_loose_mid_side_stereo(const OggFLAC__StreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + return FLAC__stream_encoder_get_loose_mid_side_stereo(encoder->private_->FLAC_stream_encoder); +} + +OggFLAC_API unsigned OggFLAC__stream_encoder_get_channels(const OggFLAC__StreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + return FLAC__stream_encoder_get_channels(encoder->private_->FLAC_stream_encoder); +} + +OggFLAC_API unsigned OggFLAC__stream_encoder_get_bits_per_sample(const OggFLAC__StreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + return FLAC__stream_encoder_get_bits_per_sample(encoder->private_->FLAC_stream_encoder); +} + +OggFLAC_API unsigned OggFLAC__stream_encoder_get_sample_rate(const OggFLAC__StreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + return FLAC__stream_encoder_get_sample_rate(encoder->private_->FLAC_stream_encoder); +} + +OggFLAC_API unsigned OggFLAC__stream_encoder_get_blocksize(const OggFLAC__StreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + return FLAC__stream_encoder_get_blocksize(encoder->private_->FLAC_stream_encoder); +} + +OggFLAC_API unsigned OggFLAC__stream_encoder_get_max_lpc_order(const OggFLAC__StreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + return FLAC__stream_encoder_get_max_lpc_order(encoder->private_->FLAC_stream_encoder); +} + +OggFLAC_API unsigned OggFLAC__stream_encoder_get_qlp_coeff_precision(const OggFLAC__StreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + return FLAC__stream_encoder_get_qlp_coeff_precision(encoder->private_->FLAC_stream_encoder); +} + +OggFLAC_API FLAC__bool OggFLAC__stream_encoder_get_do_qlp_coeff_prec_search(const OggFLAC__StreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + return FLAC__stream_encoder_get_do_qlp_coeff_prec_search(encoder->private_->FLAC_stream_encoder); +} + +OggFLAC_API FLAC__bool OggFLAC__stream_encoder_get_do_escape_coding(const OggFLAC__StreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + return FLAC__stream_encoder_get_do_escape_coding(encoder->private_->FLAC_stream_encoder); +} + +OggFLAC_API FLAC__bool OggFLAC__stream_encoder_get_do_exhaustive_model_search(const OggFLAC__StreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + return FLAC__stream_encoder_get_do_exhaustive_model_search(encoder->private_->FLAC_stream_encoder); +} + +OggFLAC_API unsigned OggFLAC__stream_encoder_get_min_residual_partition_order(const OggFLAC__StreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + return FLAC__stream_encoder_get_min_residual_partition_order(encoder->private_->FLAC_stream_encoder); +} + +OggFLAC_API unsigned OggFLAC__stream_encoder_get_max_residual_partition_order(const OggFLAC__StreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + return FLAC__stream_encoder_get_max_residual_partition_order(encoder->private_->FLAC_stream_encoder); +} + +OggFLAC_API unsigned OggFLAC__stream_encoder_get_rice_parameter_search_dist(const OggFLAC__StreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + return FLAC__stream_encoder_get_rice_parameter_search_dist(encoder->private_->FLAC_stream_encoder); +} + +OggFLAC_API FLAC__uint64 OggFLAC__stream_encoder_get_total_samples_estimate(const OggFLAC__StreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + return FLAC__stream_encoder_get_total_samples_estimate(encoder->private_->FLAC_stream_encoder); +} + +OggFLAC_API FLAC__bool OggFLAC__stream_encoder_process(OggFLAC__StreamEncoder *encoder, const FLAC__int32 * const buffer[], unsigned samples) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + return FLAC__stream_encoder_process(encoder->private_->FLAC_stream_encoder, buffer, samples); +} + +OggFLAC_API FLAC__bool OggFLAC__stream_encoder_process_interleaved(OggFLAC__StreamEncoder *encoder, const FLAC__int32 buffer[], unsigned samples) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + return FLAC__stream_encoder_process_interleaved(encoder->private_->FLAC_stream_encoder, buffer, samples); +} + +/*********************************************************************** + * + * Private class methods + * + ***********************************************************************/ + +void set_defaults_(OggFLAC__StreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + + encoder->private_->write_callback = 0; + encoder->private_->metadata_callback = 0; + encoder->private_->client_data = 0; + OggFLAC__ogg_encoder_aspect_set_defaults(&encoder->protected_->ogg_encoder_aspect); +} + +FLAC__StreamEncoderWriteStatus write_callback_(const FLAC__StreamEncoder *unused, const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame, void *client_data) +{ + OggFLAC__StreamEncoder *encoder = (OggFLAC__StreamEncoder*)client_data; + const FLAC__uint64 total_samples_estimate = FLAC__stream_encoder_get_total_samples_estimate(encoder->private_->FLAC_stream_encoder); + + (void)unused; + FLAC__ASSERT(encoder->private_->FLAC_stream_encoder == unused); + + return OggFLAC__ogg_encoder_aspect_write_callback_wrapper(&encoder->protected_->ogg_encoder_aspect, total_samples_estimate, buffer, bytes, samples, current_frame, (OggFLAC__OggEncoderAspectWriteCallbackProxy)encoder->private_->write_callback, encoder, encoder->private_->client_data); +} + +void metadata_callback_(const FLAC__StreamEncoder *unused, const FLAC__StreamMetadata *metadata, void *client_data) +{ + OggFLAC__StreamEncoder *encoder = (OggFLAC__StreamEncoder*)client_data; + + (void)unused; + FLAC__ASSERT(encoder->private_->FLAC_stream_encoder == unused); + + encoder->private_->metadata_callback(encoder, metadata, encoder->private_->client_data); +} diff --git a/Libraries/FLAC/Files/src/share/Makefile.am b/Libraries/FLAC/Files/src/share/Makefile.am new file mode 100644 index 000000000..014072022 --- /dev/null +++ b/Libraries/FLAC/Files/src/share/Makefile.am @@ -0,0 +1,22 @@ +# FLAC - Free Lossless Audio Codec +# Copyright (C) 2002,2003,2004,2005 Josh Coalson +# +# This file is part the FLAC project. FLAC is comprised of several +# components distributed under difference licenses. The codec libraries +# are distributed under Xiph.Org's BSD-like license (see the file +# COPYING.Xiph in this distribution). All other programs, libraries, and +# plugins are distributed under the GPL (see COPYING.GPL). The documentation +# is distributed under the Gnu FDL (see COPYING.FDL). Each file in the +# FLAC distribution contains at the top the terms under which it may be +# distributed. +# +# Since this particular file is relevant to all components of FLAC, +# it may be distributed under the Xiph.Org license, which is the least +# restrictive of those mentioned above. See the file COPYING.Xiph in this +# distribution. + +SUBDIRS = getopt replaygain_analysis replaygain_synthesis grabbag utf8 + +EXTRA_DIST = \ + Makefile.lite \ + README diff --git a/Libraries/FLAC/Files/src/share/Makefile.in b/Libraries/FLAC/Files/src/share/Makefile.in new file mode 100644 index 000000000..d00532d37 --- /dev/null +++ b/Libraries/FLAC/Files/src/share/Makefile.in @@ -0,0 +1,534 @@ +# Makefile.in generated by automake 1.8.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# FLAC - Free Lossless Audio Codec +# Copyright (C) 2002,2003,2004,2005 Josh Coalson +# +# This file is part the FLAC project. FLAC is comprised of several +# components distributed under difference licenses. The codec libraries +# are distributed under Xiph.Org's BSD-like license (see the file +# COPYING.Xiph in this distribution). All other programs, libraries, and +# plugins are distributed under the GPL (see COPYING.GPL). The documentation +# is distributed under the Gnu FDL (see COPYING.FDL). Each file in the +# FLAC distribution contains at the top the terms under which it may be +# distributed. +# +# Since this particular file is relevant to all components of FLAC, +# it may be distributed under the Xiph.Org license, which is the least +# restrictive of those mentioned above. See the file COPYING.Xiph in this +# distribution. +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../.. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_triplet = @host@ +subdir = src/share +DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(mkdir_p) +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-exec-recursive install-info-recursive \ + install-recursive installcheck-recursive installdirs-recursive \ + pdf-recursive ps-recursive uninstall-info-recursive \ + uninstall-recursive +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCAS = @CCAS@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEBUG_FALSE = @DEBUG_FALSE@ +DEBUG_TRUE = @DEBUG_TRUE@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DOCBOOK_TO_MAN = @DOCBOOK_TO_MAN@ +DOXYGEN = @DOXYGEN@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FLaC__CPU_IA32_FALSE = @FLaC__CPU_IA32_FALSE@ +FLaC__CPU_IA32_TRUE = @FLaC__CPU_IA32_TRUE@ +FLaC__CPU_PPC_FALSE = @FLaC__CPU_PPC_FALSE@ +FLaC__CPU_PPC_TRUE = @FLaC__CPU_PPC_TRUE@ +FLaC__CPU_SPARC_FALSE = @FLaC__CPU_SPARC_FALSE@ +FLaC__CPU_SPARC_TRUE = @FLaC__CPU_SPARC_TRUE@ +FLaC__EXHAUSTIVE_TESTS_FALSE = @FLaC__EXHAUSTIVE_TESTS_FALSE@ +FLaC__EXHAUSTIVE_TESTS_TRUE = @FLaC__EXHAUSTIVE_TESTS_TRUE@ +FLaC__HAS_AS_FALSE = @FLaC__HAS_AS_FALSE@ +FLaC__HAS_AS_TRUE = @FLaC__HAS_AS_TRUE@ +FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@ +FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@ +FLaC__HAS_DOCBOOK_TO_MAN_FALSE = @FLaC__HAS_DOCBOOK_TO_MAN_FALSE@ +FLaC__HAS_DOCBOOK_TO_MAN_TRUE = @FLaC__HAS_DOCBOOK_TO_MAN_TRUE@ +FLaC__HAS_DOXYGEN_FALSE = @FLaC__HAS_DOXYGEN_FALSE@ +FLaC__HAS_DOXYGEN_TRUE = @FLaC__HAS_DOXYGEN_TRUE@ +FLaC__HAS_GAS_FALSE = @FLaC__HAS_GAS_FALSE@ +FLaC__HAS_GAS_TRUE = @FLaC__HAS_GAS_TRUE@ +FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@ +FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@ +FLaC__HAS_NASM_FALSE = @FLaC__HAS_NASM_FALSE@ +FLaC__HAS_NASM_TRUE = @FLaC__HAS_NASM_TRUE@ +FLaC__HAS_OGG_FALSE = @FLaC__HAS_OGG_FALSE@ +FLaC__HAS_OGG_TRUE = @FLaC__HAS_OGG_TRUE@ +FLaC__HAS_XMMS_FALSE = @FLaC__HAS_XMMS_FALSE@ +FLaC__HAS_XMMS_TRUE = @FLaC__HAS_XMMS_TRUE@ +FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE@ +FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE@ +FLaC__NO_ASM_FALSE = @FLaC__NO_ASM_FALSE@ +FLaC__NO_ASM_TRUE = @FLaC__NO_ASM_TRUE@ +FLaC__SSE_OS_FALSE = @FLaC__SSE_OS_FALSE@ +FLaC__SSE_OS_TRUE = @FLaC__SSE_OS_TRUE@ +FLaC__SYS_DARWIN_FALSE = @FLaC__SYS_DARWIN_FALSE@ +FLaC__SYS_DARWIN_TRUE = @FLaC__SYS_DARWIN_TRUE@ +FLaC__SYS_LINUX_FALSE = @FLaC__SYS_LINUX_FALSE@ +FLaC__SYS_LINUX_TRUE = @FLaC__SYS_LINUX_TRUE@ +FLaC__USE_3DNOW_FALSE = @FLaC__USE_3DNOW_FALSE@ +FLaC__USE_3DNOW_TRUE = @FLaC__USE_3DNOW_TRUE@ +FLaC__USE_ALTIVEC_FALSE = @FLaC__USE_ALTIVEC_FALSE@ +FLaC__USE_ALTIVEC_TRUE = @FLaC__USE_ALTIVEC_TRUE@ +FLaC__VALGRIND_TESTING_FALSE = @FLaC__VALGRIND_TESTING_FALSE@ +FLaC__VALGRIND_TESTING_TRUE = @FLaC__VALGRIND_TESTING_TRUE@ +GAS = @GAS@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +NASM = @NASM@ +OBJEXT = @OBJEXT@ +OBJ_FORMAT = @OBJ_FORMAT@ +OGG_CFLAGS = @OGG_CFLAGS@ +OGG_LIBS = @OGG_LIBS@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +XMMS_CFLAGS = @XMMS_CFLAGS@ +XMMS_CONFIG = @XMMS_CONFIG@ +XMMS_DATA_DIR = @XMMS_DATA_DIR@ +XMMS_EFFECT_PLUGIN_DIR = @XMMS_EFFECT_PLUGIN_DIR@ +XMMS_GENERAL_PLUGIN_DIR = @XMMS_GENERAL_PLUGIN_DIR@ +XMMS_INPUT_PLUGIN_DIR = @XMMS_INPUT_PLUGIN_DIR@ +XMMS_LIBS = @XMMS_LIBS@ +XMMS_OUTPUT_PLUGIN_DIR = @XMMS_OUTPUT_PLUGIN_DIR@ +XMMS_PLUGIN_DIR = @XMMS_PLUGIN_DIR@ +XMMS_VERSION = @XMMS_VERSION@ +XMMS_VISUALIZATION_PLUGIN_DIR = @XMMS_VISUALIZATION_PLUGIN_DIR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +SUBDIRS = getopt replaygain_analysis replaygain_synthesis grabbag utf8 +EXTRA_DIST = \ + Makefile.lite \ + README + +all: all-recursive + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/share/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/share/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || mkdir "$(distdir)/$$subdir" \ + || exit 1; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="../$(top_distdir)" \ + distdir="../$(distdir)/$$subdir" \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-libtool \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-recursive + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-info-am + +uninstall-info: uninstall-info-recursive + +.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \ + clean clean-generic clean-libtool clean-recursive ctags \ + ctags-recursive distclean distclean-generic distclean-libtool \ + distclean-recursive distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-strip installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic maintainer-clean-recursive \ + mostlyclean mostlyclean-generic mostlyclean-libtool \ + mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \ + uninstall uninstall-am uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/Libraries/FLAC/Files/src/share/Makefile.lite b/Libraries/FLAC/Files/src/share/Makefile.lite new file mode 100644 index 000000000..87096381d --- /dev/null +++ b/Libraries/FLAC/Files/src/share/Makefile.lite @@ -0,0 +1,53 @@ +# FLAC - Free Lossless Audio Codec +# Copyright (C) 2001,2002,2003,2004,2005 Josh Coalson +# +# This file is part the FLAC project. FLAC is comprised of several +# components distributed under difference licenses. The codec libraries +# are distributed under Xiph.Org's BSD-like license (see the file +# COPYING.Xiph in this distribution). All other programs, libraries, and +# plugins are distributed under the GPL (see COPYING.GPL). The documentation +# is distributed under the Gnu FDL (see COPYING.FDL). Each file in the +# FLAC distribution contains at the top the terms under which it may be +# distributed. +# +# Since this particular file is relevant to all components of FLAC, +# it may be distributed under the Xiph.Org license, which is the least +# restrictive of those mentioned above. See the file COPYING.Xiph in this +# distribution. + +.PHONY: all getopt grabbag replaygain_analysis replaygain_synthesis utf8 +all: getopt grabbag replaygain_analysis replaygain_synthesis utf8 + +DEFAULT_CONFIG = release + +CONFIG = $(DEFAULT_CONFIG) + +debug : CONFIG = debug +valgrind: CONFIG = valgrind +release : CONFIG = release + +debug : all +valgrind: all +release : all + +getopt: + (cd $@ ; $(MAKE) -f Makefile.lite $(CONFIG)) + +grabbag: + (cd $@ ; $(MAKE) -f Makefile.lite $(CONFIG)) + +replaygain_analysis: + (cd $@ ; $(MAKE) -f Makefile.lite $(CONFIG)) + +replaygain_synthesis: + (cd $@ ; $(MAKE) -f Makefile.lite $(CONFIG)) + +utf8: + (cd $@ ; $(MAKE) -f Makefile.lite $(CONFIG)) + +clean: + -(cd getopt ; $(MAKE) -f Makefile.lite clean) + -(cd grabbag ; $(MAKE) -f Makefile.lite clean) + -(cd replaygain_analysis ; $(MAKE) -f Makefile.lite clean) + -(cd replaygain_synthesis ; $(MAKE) -f Makefile.lite clean) + -(cd utf8 ; $(MAKE) -f Makefile.lite clean) diff --git a/Libraries/FLAC/Files/src/share/README b/Libraries/FLAC/Files/src/share/README new file mode 100644 index 000000000..1d4fededa --- /dev/null +++ b/Libraries/FLAC/Files/src/share/README @@ -0,0 +1,5 @@ +This directory contains several convenience libraries used by the rest of the +tools and plugins. Two of them (getopt and utf8) are shamelessly copied from +vorbistools, one for manipulating UTF-8 strings (GPL) and one for implementing +getopt (LGPL). libFLAC does not link to either; the only FLAC tools that do +are GPL'ed. diff --git a/Libraries/FLAC/Files/src/share/getopt/Makefile.am b/Libraries/FLAC/Files/src/share/getopt/Makefile.am new file mode 100644 index 000000000..998ef492b --- /dev/null +++ b/Libraries/FLAC/Files/src/share/getopt/Makefile.am @@ -0,0 +1,19 @@ +## Process this file with automake to produce Makefile.in + +AUTOMAKE_OPTIONS = foreign + +INCLUDES = -I$(top_srcdir)/include/share + +noinst_LIBRARIES = libgetopt.a + +libgetopt_a_SOURCES = getopt.c getopt1.c + +EXTRA_DIST = \ + Makefile.lite \ + getopt_static.dsp + +debug: + $(MAKE) all CFLAGS="@DEBUG@" + +profile: + $(MAKE) all CFLAGS="@PROFILE@" diff --git a/Libraries/FLAC/Files/src/share/getopt/Makefile.in b/Libraries/FLAC/Files/src/share/getopt/Makefile.in new file mode 100644 index 000000000..bf348fa63 --- /dev/null +++ b/Libraries/FLAC/Files/src/share/getopt/Makefile.in @@ -0,0 +1,497 @@ +# Makefile.in generated by automake 1.8.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +SOURCES = $(libgetopt_a_SOURCES) + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../../.. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_triplet = @host@ +subdir = src/share/getopt +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(mkdir_p) +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +LIBRARIES = $(noinst_LIBRARIES) +AR = ar +ARFLAGS = cru +libgetopt_a_AR = $(AR) $(ARFLAGS) +libgetopt_a_LIBADD = +am_libgetopt_a_OBJECTS = getopt.$(OBJEXT) getopt1.$(OBJEXT) +libgetopt_a_OBJECTS = $(am_libgetopt_a_OBJECTS) +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/getopt.Po ./$(DEPDIR)/getopt1.Po +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(libgetopt_a_SOURCES) +DIST_SOURCES = $(libgetopt_a_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCAS = @CCAS@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEBUG_FALSE = @DEBUG_FALSE@ +DEBUG_TRUE = @DEBUG_TRUE@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DOCBOOK_TO_MAN = @DOCBOOK_TO_MAN@ +DOXYGEN = @DOXYGEN@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FLaC__CPU_IA32_FALSE = @FLaC__CPU_IA32_FALSE@ +FLaC__CPU_IA32_TRUE = @FLaC__CPU_IA32_TRUE@ +FLaC__CPU_PPC_FALSE = @FLaC__CPU_PPC_FALSE@ +FLaC__CPU_PPC_TRUE = @FLaC__CPU_PPC_TRUE@ +FLaC__CPU_SPARC_FALSE = @FLaC__CPU_SPARC_FALSE@ +FLaC__CPU_SPARC_TRUE = @FLaC__CPU_SPARC_TRUE@ +FLaC__EXHAUSTIVE_TESTS_FALSE = @FLaC__EXHAUSTIVE_TESTS_FALSE@ +FLaC__EXHAUSTIVE_TESTS_TRUE = @FLaC__EXHAUSTIVE_TESTS_TRUE@ +FLaC__HAS_AS_FALSE = @FLaC__HAS_AS_FALSE@ +FLaC__HAS_AS_TRUE = @FLaC__HAS_AS_TRUE@ +FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@ +FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@ +FLaC__HAS_DOCBOOK_TO_MAN_FALSE = @FLaC__HAS_DOCBOOK_TO_MAN_FALSE@ +FLaC__HAS_DOCBOOK_TO_MAN_TRUE = @FLaC__HAS_DOCBOOK_TO_MAN_TRUE@ +FLaC__HAS_DOXYGEN_FALSE = @FLaC__HAS_DOXYGEN_FALSE@ +FLaC__HAS_DOXYGEN_TRUE = @FLaC__HAS_DOXYGEN_TRUE@ +FLaC__HAS_GAS_FALSE = @FLaC__HAS_GAS_FALSE@ +FLaC__HAS_GAS_TRUE = @FLaC__HAS_GAS_TRUE@ +FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@ +FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@ +FLaC__HAS_NASM_FALSE = @FLaC__HAS_NASM_FALSE@ +FLaC__HAS_NASM_TRUE = @FLaC__HAS_NASM_TRUE@ +FLaC__HAS_OGG_FALSE = @FLaC__HAS_OGG_FALSE@ +FLaC__HAS_OGG_TRUE = @FLaC__HAS_OGG_TRUE@ +FLaC__HAS_XMMS_FALSE = @FLaC__HAS_XMMS_FALSE@ +FLaC__HAS_XMMS_TRUE = @FLaC__HAS_XMMS_TRUE@ +FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE@ +FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE@ +FLaC__NO_ASM_FALSE = @FLaC__NO_ASM_FALSE@ +FLaC__NO_ASM_TRUE = @FLaC__NO_ASM_TRUE@ +FLaC__SSE_OS_FALSE = @FLaC__SSE_OS_FALSE@ +FLaC__SSE_OS_TRUE = @FLaC__SSE_OS_TRUE@ +FLaC__SYS_DARWIN_FALSE = @FLaC__SYS_DARWIN_FALSE@ +FLaC__SYS_DARWIN_TRUE = @FLaC__SYS_DARWIN_TRUE@ +FLaC__SYS_LINUX_FALSE = @FLaC__SYS_LINUX_FALSE@ +FLaC__SYS_LINUX_TRUE = @FLaC__SYS_LINUX_TRUE@ +FLaC__USE_3DNOW_FALSE = @FLaC__USE_3DNOW_FALSE@ +FLaC__USE_3DNOW_TRUE = @FLaC__USE_3DNOW_TRUE@ +FLaC__USE_ALTIVEC_FALSE = @FLaC__USE_ALTIVEC_FALSE@ +FLaC__USE_ALTIVEC_TRUE = @FLaC__USE_ALTIVEC_TRUE@ +FLaC__VALGRIND_TESTING_FALSE = @FLaC__VALGRIND_TESTING_FALSE@ +FLaC__VALGRIND_TESTING_TRUE = @FLaC__VALGRIND_TESTING_TRUE@ +GAS = @GAS@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +NASM = @NASM@ +OBJEXT = @OBJEXT@ +OBJ_FORMAT = @OBJ_FORMAT@ +OGG_CFLAGS = @OGG_CFLAGS@ +OGG_LIBS = @OGG_LIBS@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +XMMS_CFLAGS = @XMMS_CFLAGS@ +XMMS_CONFIG = @XMMS_CONFIG@ +XMMS_DATA_DIR = @XMMS_DATA_DIR@ +XMMS_EFFECT_PLUGIN_DIR = @XMMS_EFFECT_PLUGIN_DIR@ +XMMS_GENERAL_PLUGIN_DIR = @XMMS_GENERAL_PLUGIN_DIR@ +XMMS_INPUT_PLUGIN_DIR = @XMMS_INPUT_PLUGIN_DIR@ +XMMS_LIBS = @XMMS_LIBS@ +XMMS_OUTPUT_PLUGIN_DIR = @XMMS_OUTPUT_PLUGIN_DIR@ +XMMS_PLUGIN_DIR = @XMMS_PLUGIN_DIR@ +XMMS_VERSION = @XMMS_VERSION@ +XMMS_VISUALIZATION_PLUGIN_DIR = @XMMS_VISUALIZATION_PLUGIN_DIR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +AUTOMAKE_OPTIONS = foreign +INCLUDES = -I$(top_srcdir)/include/share +noinst_LIBRARIES = libgetopt.a +libgetopt_a_SOURCES = getopt.c getopt1.c +EXTRA_DIST = \ + Makefile.lite \ + getopt_static.dsp + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/share/getopt/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/share/getopt/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) +libgetopt.a: $(libgetopt_a_OBJECTS) $(libgetopt_a_DEPENDENCIES) + -rm -f libgetopt.a + $(libgetopt_a_AR) libgetopt.a $(libgetopt_a_OBJECTS) $(libgetopt_a_LIBADD) + $(RANLIB) libgetopt.a + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt1.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LIBRARIES) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstLIBRARIES ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-exec \ + install-exec-am install-info install-info-am install-man \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am \ + uninstall-info-am + + +debug: + $(MAKE) all CFLAGS="@DEBUG@" + +profile: + $(MAKE) all CFLAGS="@PROFILE@" +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/Libraries/FLAC/Files/src/share/getopt/Makefile.lite b/Libraries/FLAC/Files/src/share/getopt/Makefile.lite new file mode 100644 index 000000000..e36f341d3 --- /dev/null +++ b/Libraries/FLAC/Files/src/share/getopt/Makefile.lite @@ -0,0 +1,16 @@ +# +# GNU makefile +# + +topdir = ../../.. + +LIB_NAME = libgetopt +INCLUDES = -I$(topdir)/include -I$(topdir)/include/share + +SRCS_C = \ + getopt.c \ + getopt1.c + +include $(topdir)/build/lib.mk + +# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/Libraries/FLAC/Files/src/share/getopt/getopt.c b/Libraries/FLAC/Files/src/share/getopt/getopt.c new file mode 100644 index 000000000..3449d31c4 --- /dev/null +++ b/Libraries/FLAC/Files/src/share/getopt/getopt.c @@ -0,0 +1,1065 @@ +/* + NOTE: + I cannot get the vanilla getopt code to work (i.e. compile only what + is needed and not duplicate symbols found in the standard library) + on all the platforms that FLAC supports. In particular the gating + of code with the ELIDE_CODE #define is not accurate enough on systems + that are POSIX but not glibc. If someone has a patch that works on + GNU/Linux, Darwin, AND Solaris please submit it on the project page: + http://sourceforge.net/projects/flac + + In the meantime I have munged the global symbols and remove gates + around code, while at the same time trying to touch the original as + little as possible. +*/ +/* Getopt for GNU. + NOTE: getopt is now part of the C library, so if you don't know what + "Keep this file name-space clean" means, talk to drepper@gnu.org + before changing it! + + Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99 + Free Software Foundation, Inc. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* This tells Alpha OSF/1 not to define a getopt prototype in . + Ditto for AIX 3.2 and . */ +#ifndef _NO_PROTO +# define _NO_PROTO +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#if !defined __STDC__ || !__STDC__ +/* This is a separate conditional since some stdc systems + reject `defined (const)'. */ +# ifndef const +# define const +# endif +#endif + +#include + +/* Comment out all this code if we are using the GNU C Library, and are not + actually compiling the library itself. This code is part of the GNU C + Library, but also included in many other GNU distributions. Compiling + and linking in this code is a waste when using the GNU C library + (especially if it is a shared library). Rather than having every GNU + program understand `configure --with-gnu-libc' and omit the object files, + it is simpler to just do this in the source for each such file. */ + +#define GETOPT_INTERFACE_VERSION 2 +#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2 +# include +# if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION +# define ELIDE_CODE +# endif +#endif + +#if 1 +/*[JEC] was:#ifndef ELIDE_CODE*/ + + +/* This needs to come after some library #include + to get __GNU_LIBRARY__ defined. */ +#ifdef __GNU_LIBRARY__ +/* Don't include stdlib.h for non-GNU C libraries because some of them + contain conflicting prototypes for getopt. */ +# include +# include +#endif /* GNU C library. */ + +#ifdef VMS +# include +# if HAVE_STRING_H - 0 +# include +# endif +#endif + +#ifndef _ +/* This is for other GNU distributions with internationalized messages. + When compiling libc, the _ macro is predefined. */ +# ifdef HAVE_LIBINTL_H +# include +# define _(msgid) gettext (msgid) +# else +# define _(msgid) (msgid) +# endif +#endif + +/* This version of `share__getopt' appears to the caller like standard Unix `getopt' + but it behaves differently for the user, since it allows the user + to intersperse the options with the other arguments. + + As `share__getopt' works, it permutes the elements of ARGV so that, + when it is done, all the options precede everything else. Thus + all application programs are extended to handle flexible argument order. + + Setting the environment variable POSIXLY_CORRECT disables permutation. + Then the behavior is completely standard. + + GNU application programs can use a third alternative mode in which + they can distinguish the relative order of options and other arguments. */ + +#include "share/getopt.h" +/*[JEC] was:#include "getopt.h"*/ + +/* For communication from `share__getopt' to the caller. + When `share__getopt' finds an option that takes an argument, + the argument value is returned here. + Also, when `ordering' is RETURN_IN_ORDER, + each non-option ARGV-element is returned here. */ + +char *share__optarg = 0; /*[JEC] initialize to avoid being a 'Common' symbol */ + +/* Index in ARGV of the next element to be scanned. + This is used for communication to and from the caller + and for communication between successive calls to `share__getopt'. + + On entry to `share__getopt', zero means this is the first call; initialize. + + When `share__getopt' returns -1, this is the index of the first of the + non-option elements that the caller should itself scan. + + Otherwise, `share__optind' communicates from one call to the next + how much of ARGV has been scanned so far. */ + +/* 1003.2 says this must be 1 before any call. */ +int share__optind = 1; + +/* Formerly, initialization of getopt depended on share__optind==0, which + causes problems with re-calling getopt as programs generally don't + know that. */ + +static int share____getopt_initialized = 0; + +/* The next char to be scanned in the option-element + in which the last option character we returned was found. + This allows us to pick up the scan where we left off. + + If this is zero, or a null string, it means resume the scan + by advancing to the next ARGV-element. */ + +static char *nextchar; + +/* Callers store zero here to inhibit the error message + for unrecognized options. */ + +int share__opterr = 1; + +/* Set to an option character which was unrecognized. + This must be initialized on some systems to avoid linking in the + system's own getopt implementation. */ + +int share__optopt = '?'; + +/* Describe how to deal with options that follow non-option ARGV-elements. + + If the caller did not specify anything, + the default is REQUIRE_ORDER if the environment variable + POSIXLY_CORRECT is defined, PERMUTE otherwise. + + REQUIRE_ORDER means don't recognize them as options; + stop option processing when the first non-option is seen. + This is what Unix does. + This mode of operation is selected by either setting the environment + variable POSIXLY_CORRECT, or using `+' as the first character + of the list of option characters. + + PERMUTE is the default. We permute the contents of ARGV as we scan, + so that eventually all the non-options are at the end. This allows options + to be given in any order, even with programs that were not written to + expect this. + + RETURN_IN_ORDER is an option available to programs that were written + to expect options and other ARGV-elements in any order and that care about + the ordering of the two. We describe each non-option ARGV-element + as if it were the argument of an option with character code 1. + Using `-' as the first character of the list of option characters + selects this mode of operation. + + The special argument `--' forces an end of option-scanning regardless + of the value of `ordering'. In the case of RETURN_IN_ORDER, only + `--' can cause `share__getopt' to return -1 with `share__optind' != ARGC. */ + +static enum +{ + REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER +} ordering; + +/* Value of POSIXLY_CORRECT environment variable. */ +static char *posixly_correct; + +#ifdef __GNU_LIBRARY__ +/* We want to avoid inclusion of string.h with non-GNU libraries + because there are many ways it can cause trouble. + On some systems, it contains special magic macros that don't work + in GCC. */ +# include +# define my_index strchr +#else + +#include + +/* Avoid depending on library functions or files + whose names are inconsistent. */ + +#ifndef getenv +extern char *getenv (); +#endif + +static char * +my_index (str, chr) + const char *str; + int chr; +{ + while (*str) + { + if (*str == chr) + return (char *) str; + str++; + } + return 0; +} + +/* If using GCC, we can safely declare strlen this way. + If not using GCC, it is ok not to declare it. */ +#ifdef __GNUC__ +/* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h. + That was relevant to code that was here before. */ +# if (!defined __STDC__ || !__STDC__) && !defined strlen +/* gcc with -traditional declares the built-in strlen to return int, + and has done so at least since version 2.4.5. -- rms. */ +extern int strlen (const char *); +# endif /* not __STDC__ */ +#endif /* __GNUC__ */ + +#endif /* not __GNU_LIBRARY__ */ + +/* Handle permutation of arguments. */ + +/* Describe the part of ARGV that contains non-options that have + been skipped. `first_nonopt' is the index in ARGV of the first of them; + `last_nonopt' is the index after the last of them. */ + +static int first_nonopt; +static int last_nonopt; + +#ifdef _LIBC +/* Bash 2.0 gives us an environment variable containing flags + indicating ARGV elements that should not be considered arguments. */ + +/* Defined in getopt_init.c */ +extern char *__getopt_nonoption_flags; + +static int nonoption_flags_max_len; +static int nonoption_flags_len; + +static int original_argc; +static char *const *original_argv; + +/* Make sure the environment variable bash 2.0 puts in the environment + is valid for the getopt call we must make sure that the ARGV passed + to getopt is that one passed to the process. */ +static void +__attribute__ ((unused)) +store_args_and_env (int argc, char *const *argv) +{ + /* XXX This is no good solution. We should rather copy the args so + that we can compare them later. But we must not use malloc(3). */ + original_argc = argc; + original_argv = argv; +} +# ifdef text_set_element +text_set_element (__libc_subinit, store_args_and_env); +# endif /* text_set_element */ + +# define SWAP_FLAGS(ch1, ch2) \ + if (nonoption_flags_len > 0) \ + { \ + char __tmp = __getopt_nonoption_flags[ch1]; \ + __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2]; \ + __getopt_nonoption_flags[ch2] = __tmp; \ + } +#else /* !_LIBC */ +# define SWAP_FLAGS(ch1, ch2) +#endif /* _LIBC */ + +/* Exchange two adjacent subsequences of ARGV. + One subsequence is elements [first_nonopt,last_nonopt) + which contains all the non-options that have been skipped so far. + The other is elements [last_nonopt,share__optind), which contains all + the options processed since those non-options were skipped. + + `first_nonopt' and `last_nonopt' are relocated so that they describe + the new indices of the non-options in ARGV after they are moved. */ + +#if defined __STDC__ && __STDC__ +static void exchange (char **); +#endif + +static void +exchange (argv) + char **argv; +{ + int bottom = first_nonopt; + int middle = last_nonopt; + int top = share__optind; + char *tem; + + /* Exchange the shorter segment with the far end of the longer segment. + That puts the shorter segment into the right place. + It leaves the longer segment in the right place overall, + but it consists of two parts that need to be swapped next. */ + +#ifdef _LIBC + /* First make sure the handling of the `__getopt_nonoption_flags' + string can work normally. Our top argument must be in the range + of the string. */ + if (nonoption_flags_len > 0 && top >= nonoption_flags_max_len) + { + /* We must extend the array. The user plays games with us and + presents new arguments. */ + char *new_str = malloc (top + 1); + if (new_str == NULL) + nonoption_flags_len = nonoption_flags_max_len = 0; + else + { + memset (__mempcpy (new_str, __getopt_nonoption_flags, + nonoption_flags_max_len), + '\0', top + 1 - nonoption_flags_max_len); + nonoption_flags_max_len = top + 1; + __getopt_nonoption_flags = new_str; + } + } +#endif + + while (top > middle && middle > bottom) + { + if (top - middle > middle - bottom) + { + /* Bottom segment is the short one. */ + int len = middle - bottom; + register int i; + + /* Swap it with the top part of the top segment. */ + for (i = 0; i < len; i++) + { + tem = argv[bottom + i]; + argv[bottom + i] = argv[top - (middle - bottom) + i]; + argv[top - (middle - bottom) + i] = tem; + SWAP_FLAGS (bottom + i, top - (middle - bottom) + i); + } + /* Exclude the moved bottom segment from further swapping. */ + top -= len; + } + else + { + /* Top segment is the short one. */ + int len = top - middle; + register int i; + + /* Swap it with the bottom part of the bottom segment. */ + for (i = 0; i < len; i++) + { + tem = argv[bottom + i]; + argv[bottom + i] = argv[middle + i]; + argv[middle + i] = tem; + SWAP_FLAGS (bottom + i, middle + i); + } + /* Exclude the moved top segment from further swapping. */ + bottom += len; + } + } + + /* Update records for the slots the non-options now occupy. */ + + first_nonopt += (share__optind - last_nonopt); + last_nonopt = share__optind; +} + +/* Initialize the internal data when the first call is made. */ + +#if defined __STDC__ && __STDC__ +static const char *share___getopt_initialize (int, char *const *, const char *); +#endif +static const char * +share___getopt_initialize (argc, argv, optstring) + int argc; + char *const *argv; + const char *optstring; +{ + /* Start processing options with ARGV-element 1 (since ARGV-element 0 + is the program name); the sequence of previously skipped + non-option ARGV-elements is empty. */ + + first_nonopt = last_nonopt = share__optind; + + nextchar = NULL; + + posixly_correct = getenv ("POSIXLY_CORRECT"); + + /* Determine how to handle the ordering of options and nonoptions. */ + + if (optstring[0] == '-') + { + ordering = RETURN_IN_ORDER; + ++optstring; + } + else if (optstring[0] == '+') + { + ordering = REQUIRE_ORDER; + ++optstring; + } + else if (posixly_correct != NULL) + ordering = REQUIRE_ORDER; + else + ordering = PERMUTE; + +#ifdef _LIBC + if (posixly_correct == NULL + && argc == original_argc && argv == original_argv) + { + if (nonoption_flags_max_len == 0) + { + if (__getopt_nonoption_flags == NULL + || __getopt_nonoption_flags[0] == '\0') + nonoption_flags_max_len = -1; + else + { + const char *orig_str = __getopt_nonoption_flags; + int len = nonoption_flags_max_len = strlen (orig_str); + if (nonoption_flags_max_len < argc) + nonoption_flags_max_len = argc; + __getopt_nonoption_flags = + (char *) malloc (nonoption_flags_max_len); + if (__getopt_nonoption_flags == NULL) + nonoption_flags_max_len = -1; + else + memset (__mempcpy (__getopt_nonoption_flags, orig_str, len), + '\0', nonoption_flags_max_len - len); + } + } + nonoption_flags_len = nonoption_flags_max_len; + } + else + nonoption_flags_len = 0; +#else + (void)argc, (void)argv; +#endif + + return optstring; +} + +/* Scan elements of ARGV (whose length is ARGC) for option characters + given in OPTSTRING. + + If an element of ARGV starts with '-', and is not exactly "-" or "--", + then it is an option element. The characters of this element + (aside from the initial '-') are option characters. If `share__getopt' + is called repeatedly, it returns successively each of the option characters + from each of the option elements. + + If `share__getopt' finds another option character, it returns that character, + updating `share__optind' and `nextchar' so that the next call to `share__getopt' can + resume the scan with the following option character or ARGV-element. + + If there are no more option characters, `share__getopt' returns -1. + Then `share__optind' is the index in ARGV of the first ARGV-element + that is not an option. (The ARGV-elements have been permuted + so that those that are not options now come last.) + + OPTSTRING is a string containing the legitimate option characters. + If an option character is seen that is not listed in OPTSTRING, + return '?' after printing an error message. If you set `share__opterr' to + zero, the error message is suppressed but we still return '?'. + + If a char in OPTSTRING is followed by a colon, that means it wants an arg, + so the following text in the same ARGV-element, or the text of the following + ARGV-element, is returned in `share__optarg'. Two colons mean an option that + wants an optional arg; if there is text in the current ARGV-element, + it is returned in `share__optarg', otherwise `share__optarg' is set to zero. + + If OPTSTRING starts with `-' or `+', it requests different methods of + handling the non-option ARGV-elements. + See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above. + + Long-named options begin with `--' instead of `-'. + Their names may be abbreviated as long as the abbreviation is unique + or is an exact match for some defined option. If they have an + argument, it follows the option name in the same ARGV-element, separated + from the option name by a `=', or else the in next ARGV-element. + When `share__getopt' finds a long-named option, it returns 0 if that option's + `flag' field is nonzero, the value of the option's `val' field + if the `flag' field is zero. + + The elements of ARGV aren't really const, because we permute them. + But we pretend they're const in the prototype to be compatible + with other systems. + + LONGOPTS is a vector of `struct share__option' terminated by an + element containing a name which is zero. + + LONGIND returns the index in LONGOPT of the long-named option found. + It is only valid when a long-named option has been found by the most + recent call. + + If LONG_ONLY is nonzero, '-' as well as '--' can introduce + long-named options. */ + +int +share___getopt_internal (argc, argv, optstring, longopts, longind, long_only) + int argc; + char *const *argv; + const char *optstring; + const struct share__option *longopts; + int *longind; + int long_only; +{ + share__optarg = NULL; + + if (share__optind == 0 || !share____getopt_initialized) + { + if (share__optind == 0) + share__optind = 1; /* Don't scan ARGV[0], the program name. */ + optstring = share___getopt_initialize (argc, argv, optstring); + share____getopt_initialized = 1; + } + + /* Test whether ARGV[share__optind] points to a non-option argument. + Either it does not have option syntax, or there is an environment flag + from the shell indicating it is not an option. The later information + is only used when the used in the GNU libc. */ +#ifdef _LIBC +# define NONOPTION_P (argv[share__optind][0] != '-' || argv[share__optind][1] == '\0' \ + || (share__optind < nonoption_flags_len \ + && __getopt_nonoption_flags[share__optind] == '1')) +#else +# define NONOPTION_P (argv[share__optind][0] != '-' || argv[share__optind][1] == '\0') +#endif + + if (nextchar == NULL || *nextchar == '\0') + { + /* Advance to the next ARGV-element. */ + + /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been + moved back by the user (who may also have changed the arguments). */ + if (last_nonopt > share__optind) + last_nonopt = share__optind; + if (first_nonopt > share__optind) + first_nonopt = share__optind; + + if (ordering == PERMUTE) + { + /* If we have just processed some options following some non-options, + exchange them so that the options come first. */ + + if (first_nonopt != last_nonopt && last_nonopt != share__optind) + exchange ((char **) argv); + else if (last_nonopt != share__optind) + first_nonopt = share__optind; + + /* Skip any additional non-options + and extend the range of non-options previously skipped. */ + + while (share__optind < argc && NONOPTION_P) + share__optind++; + last_nonopt = share__optind; + } + + /* The special ARGV-element `--' means premature end of options. + Skip it like a null option, + then exchange with previous non-options as if it were an option, + then skip everything else like a non-option. */ + + if (share__optind != argc && !strcmp (argv[share__optind], "--")) + { + share__optind++; + + if (first_nonopt != last_nonopt && last_nonopt != share__optind) + exchange ((char **) argv); + else if (first_nonopt == last_nonopt) + first_nonopt = share__optind; + last_nonopt = argc; + + share__optind = argc; + } + + /* If we have done all the ARGV-elements, stop the scan + and back over any non-options that we skipped and permuted. */ + + if (share__optind == argc) + { + /* Set the next-arg-index to point at the non-options + that we previously skipped, so the caller will digest them. */ + if (first_nonopt != last_nonopt) + share__optind = first_nonopt; + return -1; + } + + /* If we have come to a non-option and did not permute it, + either stop the scan or describe it to the caller and pass it by. */ + + if (NONOPTION_P) + { + if (ordering == REQUIRE_ORDER) + return -1; + share__optarg = argv[share__optind++]; + return 1; + } + + /* We have found another option-ARGV-element. + Skip the initial punctuation. */ + + nextchar = (argv[share__optind] + 1 + + (longopts != NULL && argv[share__optind][1] == '-')); + } + + /* Decode the current option-ARGV-element. */ + + /* Check whether the ARGV-element is a long option. + + If long_only and the ARGV-element has the form "-f", where f is + a valid short option, don't consider it an abbreviated form of + a long option that starts with f. Otherwise there would be no + way to give the -f short option. + + On the other hand, if there's a long option "fubar" and + the ARGV-element is "-fu", do consider that an abbreviation of + the long option, just like "--fu", and not "-f" with arg "u". + + This distinction seems to be the most useful approach. */ + + if (longopts != NULL + && (argv[share__optind][1] == '-' + || (long_only && (argv[share__optind][2] || !my_index (optstring, argv[share__optind][1]))))) + { + char *nameend; + const struct share__option *p; + const struct share__option *pfound = NULL; + int exact = 0; + int ambig = 0; + int indfound = -1; + int option_index; + + for (nameend = nextchar; *nameend && *nameend != '='; nameend++) + /* Do nothing. */ ; + + /* Test all long options for either exact match + or abbreviated matches. */ + for (p = longopts, option_index = 0; p->name; p++, option_index++) + if (!strncmp (p->name, nextchar, nameend - nextchar)) + { + if ((unsigned int) (nameend - nextchar) + == (unsigned int) strlen (p->name)) + { + /* Exact match found. */ + pfound = p; + indfound = option_index; + exact = 1; + break; + } + else if (pfound == NULL) + { + /* First nonexact match found. */ + pfound = p; + indfound = option_index; + } + else + /* Second or later nonexact match found. */ + ambig = 1; + } + + if (ambig && !exact) + { + if (share__opterr) + fprintf (stderr, _("%s: option `%s' is ambiguous\n"), + argv[0], argv[share__optind]); + nextchar += strlen (nextchar); + share__optind++; + share__optopt = 0; + return '?'; + } + + if (pfound != NULL) + { + option_index = indfound; + share__optind++; + if (*nameend) + { + /* Don't test has_arg with >, because some C compilers don't + allow it to be used on enums. */ + if (pfound->has_arg) + share__optarg = nameend + 1; + else + { + if (share__opterr) + { + if (argv[share__optind - 1][1] == '-') + /* --option */ + fprintf (stderr, + _("%s: option `--%s' doesn't allow an argument\n"), + argv[0], pfound->name); + else + /* +option or -option */ + fprintf (stderr, + _("%s: option `%c%s' doesn't allow an argument\n"), + argv[0], argv[share__optind - 1][0], pfound->name); + } + + nextchar += strlen (nextchar); + + share__optopt = pfound->val; + return '?'; + } + } + else if (pfound->has_arg == 1) + { + if (share__optind < argc) + share__optarg = argv[share__optind++]; + else + { + if (share__opterr) + fprintf (stderr, + _("%s: option `%s' requires an argument\n"), + argv[0], argv[share__optind - 1]); + nextchar += strlen (nextchar); + share__optopt = pfound->val; + return optstring[0] == ':' ? ':' : '?'; + } + } + nextchar += strlen (nextchar); + if (longind != NULL) + *longind = option_index; + if (pfound->flag) + { + *(pfound->flag) = pfound->val; + return 0; + } + return pfound->val; + } + + /* Can't find it as a long option. If this is not share__getopt_long_only, + or the option starts with '--' or is not a valid short + option, then it's an error. + Otherwise interpret it as a short option. */ + if (!long_only || argv[share__optind][1] == '-' + || my_index (optstring, *nextchar) == NULL) + { + if (share__opterr) + { + if (argv[share__optind][1] == '-') + /* --option */ + fprintf (stderr, _("%s: unrecognized option `--%s'\n"), + argv[0], nextchar); + else + /* +option or -option */ + fprintf (stderr, _("%s: unrecognized option `%c%s'\n"), + argv[0], argv[share__optind][0], nextchar); + } + nextchar = (char *) ""; + share__optind++; + share__optopt = 0; + return '?'; + } + } + + /* Look at and handle the next short option-character. */ + + { + char c = *nextchar++; + char *temp = my_index (optstring, c); + + /* Increment `share__optind' when we start to process its last character. */ + if (*nextchar == '\0') + ++share__optind; + + if (temp == NULL || c == ':') + { + if (share__opterr) + { + if (posixly_correct) + /* 1003.2 specifies the format of this message. */ + fprintf (stderr, _("%s: illegal option -- %c\n"), + argv[0], c); + else + fprintf (stderr, _("%s: invalid option -- %c\n"), + argv[0], c); + } + share__optopt = c; + return '?'; + } + /* Convenience. Treat POSIX -W foo same as long option --foo */ + if (temp[0] == 'W' && temp[1] == ';') + { + char *nameend; + const struct share__option *p; + const struct share__option *pfound = NULL; + int exact = 0; + int ambig = 0; + int indfound = 0; + int option_index; + + /* This is an option that requires an argument. */ + if (*nextchar != '\0') + { + share__optarg = nextchar; + /* If we end this ARGV-element by taking the rest as an arg, + we must advance to the next element now. */ + share__optind++; + } + else if (share__optind == argc) + { + if (share__opterr) + { + /* 1003.2 specifies the format of this message. */ + fprintf (stderr, _("%s: option requires an argument -- %c\n"), + argv[0], c); + } + share__optopt = c; + if (optstring[0] == ':') + c = ':'; + else + c = '?'; + return c; + } + else + /* We already incremented `share__optind' once; + increment it again when taking next ARGV-elt as argument. */ + share__optarg = argv[share__optind++]; + + /* share__optarg is now the argument, see if it's in the + table of longopts. */ + + for (nextchar = nameend = share__optarg; *nameend && *nameend != '='; nameend++) + /* Do nothing. */ ; + + /* Test all long options for either exact match + or abbreviated matches. */ + for (p = longopts, option_index = 0; p->name; p++, option_index++) + if (!strncmp (p->name, nextchar, nameend - nextchar)) + { + if ((unsigned int) (nameend - nextchar) == strlen (p->name)) + { + /* Exact match found. */ + pfound = p; + indfound = option_index; + exact = 1; + break; + } + else if (pfound == NULL) + { + /* First nonexact match found. */ + pfound = p; + indfound = option_index; + } + else + /* Second or later nonexact match found. */ + ambig = 1; + } + if (ambig && !exact) + { + if (share__opterr) + fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"), + argv[0], argv[share__optind]); + nextchar += strlen (nextchar); + share__optind++; + return '?'; + } + if (pfound != NULL) + { + option_index = indfound; + if (*nameend) + { + /* Don't test has_arg with >, because some C compilers don't + allow it to be used on enums. */ + if (pfound->has_arg) + share__optarg = nameend + 1; + else + { + if (share__opterr) + fprintf (stderr, _("\ +%s: option `-W %s' doesn't allow an argument\n"), + argv[0], pfound->name); + + nextchar += strlen (nextchar); + return '?'; + } + } + else if (pfound->has_arg == 1) + { + if (share__optind < argc) + share__optarg = argv[share__optind++]; + else + { + if (share__opterr) + fprintf (stderr, + _("%s: option `%s' requires an argument\n"), + argv[0], argv[share__optind - 1]); + nextchar += strlen (nextchar); + return optstring[0] == ':' ? ':' : '?'; + } + } + nextchar += strlen (nextchar); + if (longind != NULL) + *longind = option_index; + if (pfound->flag) + { + *(pfound->flag) = pfound->val; + return 0; + } + return pfound->val; + } + nextchar = NULL; + return 'W'; /* Let the application handle it. */ + } + if (temp[1] == ':') + { + if (temp[2] == ':') + { + /* This is an option that accepts an argument optionally. */ + if (*nextchar != '\0') + { + share__optarg = nextchar; + share__optind++; + } + else + share__optarg = NULL; + nextchar = NULL; + } + else + { + /* This is an option that requires an argument. */ + if (*nextchar != '\0') + { + share__optarg = nextchar; + /* If we end this ARGV-element by taking the rest as an arg, + we must advance to the next element now. */ + share__optind++; + } + else if (share__optind == argc) + { + if (share__opterr) + { + /* 1003.2 specifies the format of this message. */ + fprintf (stderr, + _("%s: option requires an argument -- %c\n"), + argv[0], c); + } + share__optopt = c; + if (optstring[0] == ':') + c = ':'; + else + c = '?'; + } + else + /* We already incremented `share__optind' once; + increment it again when taking next ARGV-elt as argument. */ + share__optarg = argv[share__optind++]; + nextchar = NULL; + } + } + return c; + } +} + +int +share__getopt (argc, argv, optstring) + int argc; + char *const *argv; + const char *optstring; +{ + return share___getopt_internal (argc, argv, optstring, + (const struct share__option *) 0, + (int *) 0, + 0); +} + +#endif /* Not ELIDE_CODE. */ + +#ifdef TEST + +/* Compile with -DTEST to make an executable for use in testing + the above definition of `share__getopt'. */ + +int +main (argc, argv) + int argc; + char **argv; +{ + int c; + int digit_optind = 0; + + while (1) + { + int this_option_optind = share__optind ? share__optind : 1; + + c = share__getopt (argc, argv, "abc:d:0123456789"); + if (c == -1) + break; + + switch (c) + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + if (digit_optind != 0 && digit_optind != this_option_optind) + printf ("digits occur in two different argv-elements.\n"); + digit_optind = this_option_optind; + printf ("option %c\n", c); + break; + + case 'a': + printf ("option a\n"); + break; + + case 'b': + printf ("option b\n"); + break; + + case 'c': + printf ("option c with value `%s'\n", share__optarg); + break; + + case '?': + break; + + default: + printf ("?? getopt returned character code 0%o ??\n", c); + } + } + + if (share__optind < argc) + { + printf ("non-option ARGV-elements: "); + while (share__optind < argc) + printf ("%s ", argv[share__optind++]); + printf ("\n"); + } + + exit (0); +} + +#endif /* TEST */ diff --git a/Libraries/FLAC/Files/src/share/getopt/getopt1.c b/Libraries/FLAC/Files/src/share/getopt/getopt1.c new file mode 100644 index 000000000..633d403cf --- /dev/null +++ b/Libraries/FLAC/Files/src/share/getopt/getopt1.c @@ -0,0 +1,204 @@ +/* + NOTE: + I cannot get the vanilla getopt code to work (i.e. compile only what + is needed and not duplicate symbols found in the standard library) + on all the platforms that FLAC supports. In particular the gating + of code with the ELIDE_CODE #define is not accurate enough on systems + that are POSIX but not glibc. If someone has a patch that works on + GNU/Linux, Darwin, AND Solaris please submit it on the project page: + http://sourceforge.net/projects/flac + + In the meantime I have munged the global symbols and remove gates + around code, while at the same time trying to touch the original as + little as possible. +*/ +/* getopt_long and getopt_long_only entry points for GNU getopt. + Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98 + Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "share/getopt.h" +/*[JEC] was:#include "getopt.h"*/ + +#if !defined __STDC__ || !__STDC__ +/* This is a separate conditional since some stdc systems + reject `defined (const)'. */ +#ifndef const +#define const +#endif +#endif + +#include + +/* Comment out all this code if we are using the GNU C Library, and are not + actually compiling the library itself. This code is part of the GNU C + Library, but also included in many other GNU distributions. Compiling + and linking in this code is a waste when using the GNU C library + (especially if it is a shared library). Rather than having every GNU + program understand `configure --with-gnu-libc' and omit the object files, + it is simpler to just do this in the source for each such file. */ + +#define GETOPT_INTERFACE_VERSION 2 +#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2 +#include +#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION +#define ELIDE_CODE +#endif +#endif + +#if 1 +/*[JEC] was:#ifndef ELIDE_CODE*/ + + +/* This needs to come after some library #include + to get __GNU_LIBRARY__ defined. */ +#ifdef __GNU_LIBRARY__ +#include +#endif + +#ifndef NULL +#define NULL 0 +#endif + +int +share__getopt_long (argc, argv, options, long_options, opt_index) + int argc; + char *const *argv; + const char *options; + const struct share__option *long_options; + int *opt_index; +{ + return share___getopt_internal (argc, argv, options, long_options, opt_index, 0); +} + +/* Like share__getopt_long, but '-' as well as '--' can indicate a long option. + If an option that starts with '-' (not '--') doesn't match a long option, + but does match a short option, it is parsed as a short option + instead. */ + +int +share__getopt_long_only (argc, argv, options, long_options, opt_index) + int argc; + char *const *argv; + const char *options; + const struct share__option *long_options; + int *opt_index; +{ + return share___getopt_internal (argc, argv, options, long_options, opt_index, 1); +} + + +#endif /* Not ELIDE_CODE. */ + +#ifdef TEST + +#include + +int +main (argc, argv) + int argc; + char **argv; +{ + int c; + int digit_optind = 0; + + while (1) + { + int this_option_optind = share__optind ? share__optind : 1; + int option_index = 0; + static struct share__option long_options[] = + { + {"add", 1, 0, 0}, + {"append", 0, 0, 0}, + {"delete", 1, 0, 0}, + {"verbose", 0, 0, 0}, + {"create", 0, 0, 0}, + {"file", 1, 0, 0}, + {0, 0, 0, 0} + }; + + c = share__getopt_long (argc, argv, "abc:d:0123456789", + long_options, &option_index); + if (c == -1) + break; + + switch (c) + { + case 0: + printf ("option %s", long_options[option_index].name); + if (share__optarg) + printf (" with arg %s", share__optarg); + printf ("\n"); + break; + + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + if (digit_optind != 0 && digit_optind != this_option_optind) + printf ("digits occur in two different argv-elements.\n"); + digit_optind = this_option_optind; + printf ("option %c\n", c); + break; + + case 'a': + printf ("option a\n"); + break; + + case 'b': + printf ("option b\n"); + break; + + case 'c': + printf ("option c with value `%s'\n", share__optarg); + break; + + case 'd': + printf ("option d with value `%s'\n", share__optarg); + break; + + case '?': + break; + + default: + printf ("?? getopt returned character code 0%o ??\n", c); + } + } + + if (share__optind < argc) + { + printf ("non-option ARGV-elements: "); + while (share__optind < argc) + printf ("%s ", argv[share__optind++]); + printf ("\n"); + } + + exit (0); +} + +#endif /* TEST */ diff --git a/Libraries/FLAC/Files/src/share/getopt/getopt_static.dsp b/Libraries/FLAC/Files/src/share/getopt/getopt_static.dsp new file mode 100644 index 000000000..8602c1034 --- /dev/null +++ b/Libraries/FLAC/Files/src/share/getopt/getopt_static.dsp @@ -0,0 +1,112 @@ +# Microsoft Developer Studio Project File - Name="getopt_static" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Static Library" 0x0104 + +CFG=getopt_static - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "getopt_static.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "getopt_static.mak" CFG="getopt_static - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "getopt_static - Win32 Release" (based on "Win32 (x86) Static Library") +!MESSAGE "getopt_static - Win32 Debug" (based on "Win32 (x86) Static Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "getopt" +# PROP Scc_LocalPath "..\..\.." +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "getopt_static - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "..\..\..\obj\release\lib" +# PROP Intermediate_Dir "Release_static" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I ".\include" /I "..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo /nodefaultlib + +!ELSEIF "$(CFG)" == "getopt_static - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "..\..\..\obj\debug\lib" +# PROP Intermediate_Dir "Debug_static" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".\include" /I "..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo /nodefaultlib + +!ENDIF + +# Begin Target + +# Name "getopt_static - Win32 Release" +# Name "getopt_static - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "c" +# Begin Source File + +SOURCE=.\getopt.c +# End Source File +# Begin Source File + +SOURCE=.\getopt1.c +# End Source File +# End Group +# Begin Group "Private Header Files" + +# PROP Default_Filter "" +# End Group +# Begin Group "Protected Header Files" + +# PROP Default_Filter "" +# End Group +# Begin Group "Public Header Files" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=..\..\..\include\share\getopt.h +# End Source File +# End Group +# End Target +# End Project diff --git a/Libraries/FLAC/Files/src/share/grabbag/Makefile.am b/Libraries/FLAC/Files/src/share/grabbag/Makefile.am new file mode 100644 index 000000000..edc8e2f7f --- /dev/null +++ b/Libraries/FLAC/Files/src/share/grabbag/Makefile.am @@ -0,0 +1,23 @@ +## Process this file with automake to produce Makefile.in + +AUTOMAKE_OPTIONS = foreign + +INCLUDES = -I$(top_srcdir)/include + +noinst_LTLIBRARIES = libgrabbag.la + +libgrabbag_la_SOURCES = \ + cuesheet.c \ + file.c \ + replaygain.c \ + seektable.c + +EXTRA_DIST = \ + Makefile.lite \ + grabbag_static.dsp + +debug: + $(MAKE) all CFLAGS="@DEBUG@" + +profile: + $(MAKE) all CFLAGS="@PROFILE@" diff --git a/Libraries/FLAC/Files/src/share/grabbag/Makefile.in b/Libraries/FLAC/Files/src/share/grabbag/Makefile.in new file mode 100644 index 000000000..787a6289d --- /dev/null +++ b/Libraries/FLAC/Files/src/share/grabbag/Makefile.in @@ -0,0 +1,508 @@ +# Makefile.in generated by automake 1.8.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +SOURCES = $(libgrabbag_la_SOURCES) + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../../.. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_triplet = @host@ +subdir = src/share/grabbag +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(mkdir_p) +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +libgrabbag_la_LIBADD = +am_libgrabbag_la_OBJECTS = cuesheet.lo file.lo replaygain.lo \ + seektable.lo +libgrabbag_la_OBJECTS = $(am_libgrabbag_la_OBJECTS) +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/cuesheet.Plo ./$(DEPDIR)/file.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/replaygain.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/seektable.Plo +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(libgrabbag_la_SOURCES) +DIST_SOURCES = $(libgrabbag_la_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCAS = @CCAS@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEBUG_FALSE = @DEBUG_FALSE@ +DEBUG_TRUE = @DEBUG_TRUE@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DOCBOOK_TO_MAN = @DOCBOOK_TO_MAN@ +DOXYGEN = @DOXYGEN@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FLaC__CPU_IA32_FALSE = @FLaC__CPU_IA32_FALSE@ +FLaC__CPU_IA32_TRUE = @FLaC__CPU_IA32_TRUE@ +FLaC__CPU_PPC_FALSE = @FLaC__CPU_PPC_FALSE@ +FLaC__CPU_PPC_TRUE = @FLaC__CPU_PPC_TRUE@ +FLaC__CPU_SPARC_FALSE = @FLaC__CPU_SPARC_FALSE@ +FLaC__CPU_SPARC_TRUE = @FLaC__CPU_SPARC_TRUE@ +FLaC__EXHAUSTIVE_TESTS_FALSE = @FLaC__EXHAUSTIVE_TESTS_FALSE@ +FLaC__EXHAUSTIVE_TESTS_TRUE = @FLaC__EXHAUSTIVE_TESTS_TRUE@ +FLaC__HAS_AS_FALSE = @FLaC__HAS_AS_FALSE@ +FLaC__HAS_AS_TRUE = @FLaC__HAS_AS_TRUE@ +FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@ +FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@ +FLaC__HAS_DOCBOOK_TO_MAN_FALSE = @FLaC__HAS_DOCBOOK_TO_MAN_FALSE@ +FLaC__HAS_DOCBOOK_TO_MAN_TRUE = @FLaC__HAS_DOCBOOK_TO_MAN_TRUE@ +FLaC__HAS_DOXYGEN_FALSE = @FLaC__HAS_DOXYGEN_FALSE@ +FLaC__HAS_DOXYGEN_TRUE = @FLaC__HAS_DOXYGEN_TRUE@ +FLaC__HAS_GAS_FALSE = @FLaC__HAS_GAS_FALSE@ +FLaC__HAS_GAS_TRUE = @FLaC__HAS_GAS_TRUE@ +FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@ +FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@ +FLaC__HAS_NASM_FALSE = @FLaC__HAS_NASM_FALSE@ +FLaC__HAS_NASM_TRUE = @FLaC__HAS_NASM_TRUE@ +FLaC__HAS_OGG_FALSE = @FLaC__HAS_OGG_FALSE@ +FLaC__HAS_OGG_TRUE = @FLaC__HAS_OGG_TRUE@ +FLaC__HAS_XMMS_FALSE = @FLaC__HAS_XMMS_FALSE@ +FLaC__HAS_XMMS_TRUE = @FLaC__HAS_XMMS_TRUE@ +FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE@ +FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE@ +FLaC__NO_ASM_FALSE = @FLaC__NO_ASM_FALSE@ +FLaC__NO_ASM_TRUE = @FLaC__NO_ASM_TRUE@ +FLaC__SSE_OS_FALSE = @FLaC__SSE_OS_FALSE@ +FLaC__SSE_OS_TRUE = @FLaC__SSE_OS_TRUE@ +FLaC__SYS_DARWIN_FALSE = @FLaC__SYS_DARWIN_FALSE@ +FLaC__SYS_DARWIN_TRUE = @FLaC__SYS_DARWIN_TRUE@ +FLaC__SYS_LINUX_FALSE = @FLaC__SYS_LINUX_FALSE@ +FLaC__SYS_LINUX_TRUE = @FLaC__SYS_LINUX_TRUE@ +FLaC__USE_3DNOW_FALSE = @FLaC__USE_3DNOW_FALSE@ +FLaC__USE_3DNOW_TRUE = @FLaC__USE_3DNOW_TRUE@ +FLaC__USE_ALTIVEC_FALSE = @FLaC__USE_ALTIVEC_FALSE@ +FLaC__USE_ALTIVEC_TRUE = @FLaC__USE_ALTIVEC_TRUE@ +FLaC__VALGRIND_TESTING_FALSE = @FLaC__VALGRIND_TESTING_FALSE@ +FLaC__VALGRIND_TESTING_TRUE = @FLaC__VALGRIND_TESTING_TRUE@ +GAS = @GAS@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +NASM = @NASM@ +OBJEXT = @OBJEXT@ +OBJ_FORMAT = @OBJ_FORMAT@ +OGG_CFLAGS = @OGG_CFLAGS@ +OGG_LIBS = @OGG_LIBS@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +XMMS_CFLAGS = @XMMS_CFLAGS@ +XMMS_CONFIG = @XMMS_CONFIG@ +XMMS_DATA_DIR = @XMMS_DATA_DIR@ +XMMS_EFFECT_PLUGIN_DIR = @XMMS_EFFECT_PLUGIN_DIR@ +XMMS_GENERAL_PLUGIN_DIR = @XMMS_GENERAL_PLUGIN_DIR@ +XMMS_INPUT_PLUGIN_DIR = @XMMS_INPUT_PLUGIN_DIR@ +XMMS_LIBS = @XMMS_LIBS@ +XMMS_OUTPUT_PLUGIN_DIR = @XMMS_OUTPUT_PLUGIN_DIR@ +XMMS_PLUGIN_DIR = @XMMS_PLUGIN_DIR@ +XMMS_VERSION = @XMMS_VERSION@ +XMMS_VISUALIZATION_PLUGIN_DIR = @XMMS_VISUALIZATION_PLUGIN_DIR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +AUTOMAKE_OPTIONS = foreign +INCLUDES = -I$(top_srcdir)/include +noinst_LTLIBRARIES = libgrabbag.la +libgrabbag_la_SOURCES = \ + cuesheet.c \ + file.c \ + replaygain.c \ + seektable.c + +EXTRA_DIST = \ + Makefile.lite \ + grabbag_static.dsp + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/share/grabbag/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/share/grabbag/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libgrabbag.la: $(libgrabbag_la_OBJECTS) $(libgrabbag_la_DEPENDENCIES) + $(LINK) $(libgrabbag_la_LDFLAGS) $(libgrabbag_la_OBJECTS) $(libgrabbag_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cuesheet.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/file.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/replaygain.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/seektable.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstLTLIBRARIES ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-exec \ + install-exec-am install-info install-info-am install-man \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am \ + uninstall-info-am + + +debug: + $(MAKE) all CFLAGS="@DEBUG@" + +profile: + $(MAKE) all CFLAGS="@PROFILE@" +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/Libraries/FLAC/Files/src/share/grabbag/Makefile.lite b/Libraries/FLAC/Files/src/share/grabbag/Makefile.lite new file mode 100644 index 000000000..d81126f17 --- /dev/null +++ b/Libraries/FLAC/Files/src/share/grabbag/Makefile.lite @@ -0,0 +1,18 @@ +# +# GNU makefile +# + +topdir = ../../.. + +LIB_NAME = libgrabbag +INCLUDES = -I$(topdir)/include + +SRCS_C = \ + cuesheet.c \ + file.c \ + replaygain.c \ + seektable.c + +include $(topdir)/build/lib.mk + +# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/Libraries/FLAC/Files/src/share/grabbag/cuesheet.c b/Libraries/FLAC/Files/src/share/grabbag/cuesheet.c new file mode 100644 index 000000000..58fa444d7 --- /dev/null +++ b/Libraries/FLAC/Files/src/share/grabbag/cuesheet.c @@ -0,0 +1,593 @@ +/* grabbag - Convenience lib for various routines common to several tools + * Copyright (C) 2002,2003,2004,2005 Josh Coalson + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "share/grabbag.h" +#include "FLAC/assert.h" +#include +#include +#include + +unsigned grabbag__cuesheet_msf_to_frame(unsigned minutes, unsigned seconds, unsigned frames) +{ + return ((minutes * 60) + seconds) * 75 + frames; +} + +void grabbag__cuesheet_frame_to_msf(unsigned frame, unsigned *minutes, unsigned *seconds, unsigned *frames) +{ + *frames = frame % 75; + frame /= 75; + *seconds = frame % 60; + frame /= 60; + *minutes = frame; +} + +/* since we only care about values >= 0 or error, returns < 0 for any illegal string, else value */ +static int local__parse_int_(const char *s) +{ + int ret = 0; + char c; + + if(*s == '\0') + return -1; + + while('\0' != (c = *s++)) + if(c >= '0' && c <= '9') + ret = ret * 10 + (c - '0'); + else + return -1; + + return ret; +} + +/* since we only care about values >= 0 or error, returns < 0 for any illegal string, else value */ +static FLAC__int64 local__parse_int64_(const char *s) +{ + FLAC__int64 ret = 0; + char c; + + if(*s == '\0') + return -1; + + while('\0' != (c = *s++)) + if(c >= '0' && c <= '9') + ret = ret * 10 + (c - '0'); + else + return -1; + + return ret; +} + +/* accept '[0-9]+:[0-9][0-9]?:[0-9][0-9]?', but max second of 59 and max frame of 74, e.g. 0:0:0, 123:45:67 + * return sample number or <0 for error + */ +static FLAC__int64 local__parse_msf_(const char *s) +{ + FLAC__int64 ret, field; + char c; + + c = *s++; + if(c >= '0' && c <= '9') + field = (c - '0'); + else + return -1; + while(':' != (c = *s++)) { + if(c >= '0' && c <= '9') + field = field * 10 + (c - '0'); + else + return -1; + } + + ret = field * 60 * 44100; + + c = *s++; + if(c >= '0' && c <= '9') + field = (c - '0'); + else + return -1; + if(':' != (c = *s++)) { + if(c >= '0' && c <= '9') { + field = field * 10 + (c - '0'); + c = *s++; + if(c != ':') + return -1; + } + else + return -1; + } + + if(field >= 60) + return -1; + + ret += field * 44100; + + c = *s++; + if(c >= '0' && c <= '9') + field = (c - '0'); + else + return -1; + if('\0' != (c = *s++)) { + if(c >= '0' && c <= '9') { + field = field * 10 + (c - '0'); + c = *s++; + } + else + return -1; + } + + if(c != '\0') + return -1; + + if(field >= 75) + return -1; + + ret += field * (44100 / 75); + + return ret; +} + +static char *local__get_field_(char **s, FLAC__bool allow_quotes) +{ + FLAC__bool has_quote = false; + char *p; + + FLAC__ASSERT(0 != s); + + if(0 == *s) + return 0; + + /* skip leading whitespace */ + while(**s && 0 != strchr(" \t\r\n", **s)) + (*s)++; + + if(**s == 0) { + *s = 0; + return 0; + } + + if(allow_quotes && (**s == '"')) { + has_quote = true; + (*s)++; + if(**s == 0) { + *s = 0; + return 0; + } + } + + p = *s; + + if(has_quote) { + *s = strchr(*s, '\"'); + /* if there is no matching end quote, it's an error */ + if(0 == *s) + p = *s = 0; + else { + **s = '\0'; + (*s)++; + } + } + else { + while(**s && 0 == strchr(" \t\r\n", **s)) + (*s)++; + if(**s) { + **s = '\0'; + (*s)++; + } + else + *s = 0; + } + + return p; +} + +static FLAC__bool local__cuesheet_parse_(FILE *file, const char **error_message, unsigned *last_line_read, FLAC__StreamMetadata *cuesheet, FLAC__bool is_cdda, FLAC__uint64 lead_out_offset) +{ +#if defined _MSC_VER || defined __MINGW32__ +#define FLAC__STRCASECMP stricmp +#else +#define FLAC__STRCASECMP strcasecmp +#endif + char buffer[4096], *line, *field; + unsigned linelen, forced_leadout_track_num = 0; + FLAC__uint64 forced_leadout_track_offset = 0; + int in_track_num = -1, in_index_num = -1; + FLAC__bool disc_has_catalog = false, track_has_flags = false, track_has_isrc = false, has_forced_leadout = false; + FLAC__StreamMetadata_CueSheet *cs = &cuesheet->data.cue_sheet; + + cs->lead_in = is_cdda? 2 * 44100 /* The default lead-in size for CD-DA */ : 0; + cs->is_cd = is_cdda; + + while(0 != fgets(buffer, sizeof(buffer), file)) { + (*last_line_read)++; + line = buffer; + + linelen = strlen(line); + if(line[linelen-1] != '\n') { + *error_message = "line too long"; + return false; + } + + if(0 != (field = local__get_field_(&line, /*allow_quotes=*/false))) { + if(0 == FLAC__STRCASECMP(field, "CATALOG")) { + if(disc_has_catalog) { + *error_message = "found multiple CATALOG commands"; + return false; + } + if(0 == (field = local__get_field_(&line, /*allow_quotes=*/true))) { + *error_message = "CATALOG is missing catalog number"; + return false; + } + if(strlen(field) >= sizeof(cs->media_catalog_number)) { + *error_message = "CATALOG number is too long"; + return false; + } + if(is_cdda && (strlen(field) != 13 || strspn(field, "0123456789") != 13)) { + *error_message = "CD-DA CATALOG number must be 13 decimal digits"; + return false; + } + strcpy(cs->media_catalog_number, field); + disc_has_catalog = true; + } + else if(0 == FLAC__STRCASECMP(field, "FLAGS")) { + if(track_has_flags) { + *error_message = "found multiple FLAGS commands"; + return false; + } + if(in_track_num < 0 || in_index_num >= 0) { + *error_message = "FLAGS command must come after TRACK but before INDEX"; + return false; + } + while(0 != (field = local__get_field_(&line, /*allow_quotes=*/false))) { + if(0 == FLAC__STRCASECMP(field, "PRE")) + cs->tracks[cs->num_tracks-1].pre_emphasis = 1; + } + track_has_flags = true; + } + else if(0 == FLAC__STRCASECMP(field, "INDEX")) { + FLAC__int64 xx; + FLAC__StreamMetadata_CueSheet_Track *track = &cs->tracks[cs->num_tracks-1]; + if(in_track_num < 0) { + *error_message = "found INDEX before any TRACK"; + return false; + } + if(0 == (field = local__get_field_(&line, /*allow_quotes=*/false))) { + *error_message = "INDEX is missing index number"; + return false; + } + in_index_num = local__parse_int_(field); + if(in_index_num < 0) { + *error_message = "INDEX has invalid index number"; + return false; + } + FLAC__ASSERT(cs->num_tracks > 0); + if(track->num_indices == 0) { + /* it's the first index point of the track */ + if(in_index_num > 1) { + *error_message = "first INDEX number of a TRACK must be 0 or 1"; + return false; + } + } + else { + if(in_index_num != track->indices[track->num_indices-1].number + 1) { + *error_message = "INDEX numbers must be sequential"; + return false; + } + } + if(is_cdda && in_index_num > 99) { + *error_message = "CD-DA INDEX number must be between 0 and 99, inclusive"; + return false; + } + /*@@@ search for duplicate track number? */ + if(0 == (field = local__get_field_(&line, /*allow_quotes=*/false))) { + *error_message = "INDEX is missing an offset after the index number"; + return false; + } + xx = local__parse_msf_(field); + if(xx < 0) { + if(is_cdda) { + *error_message = "illegal INDEX offset (not of the form MM:SS:FF)"; + return false; + } + xx = local__parse_int64_(field); + if(xx < 0) { + *error_message = "illegal INDEX offset"; + return false; + } + } + if(is_cdda && cs->num_tracks == 1 && cs->tracks[0].num_indices == 0 && xx != 0) { + *error_message = "first INDEX of first TRACK must have an offset of 00:00:00"; + return false; + } + if(is_cdda && track->num_indices > 0 && (FLAC__uint64)xx <= track->indices[track->num_indices-1].offset) { + *error_message = "CD-DA INDEX offsets must increase in time"; + return false; + } + /* fill in track offset if it's the first index of the track */ + if(track->num_indices == 0) + track->offset = (FLAC__uint64)xx; + if(is_cdda && cs->num_tracks > 1) { + const FLAC__StreamMetadata_CueSheet_Track *prev = &cs->tracks[cs->num_tracks-2]; + if((FLAC__uint64)xx <= prev->offset + prev->indices[prev->num_indices-1].offset) { + *error_message = "CD-DA INDEX offsets must increase in time"; + return false; + } + } + if(!FLAC__metadata_object_cuesheet_track_insert_blank_index(cuesheet, cs->num_tracks-1, track->num_indices)) { + *error_message = "memory allocation error"; + return false; + } + track->indices[track->num_indices-1].offset = (FLAC__uint64)xx - track->offset; + track->indices[track->num_indices-1].number = in_index_num; + } + else if(0 == FLAC__STRCASECMP(field, "ISRC")) { + char *l, *r; + if(track_has_isrc) { + *error_message = "found multiple ISRC commands"; + return false; + } + if(in_track_num < 0 || in_index_num >= 0) { + *error_message = "ISRC command must come after TRACK but before INDEX"; + return false; + } + if(0 == (field = local__get_field_(&line, /*allow_quotes=*/false))) { + *error_message = "ISRC is missing ISRC number"; + return false; + } + /* strip out dashes */ + for(l = r = field; *r; r++) { + if(*r != '-') + *l++ = *r; + } + *l = '\0'; + if(strlen(field) != 12 || strspn(field, "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789") < 5 || strspn(field+5, "1234567890") != 7) { + *error_message = "invalid ISRC number"; + return false; + } + strcpy(cs->tracks[cs->num_tracks-1].isrc, field); + track_has_isrc = true; + } + else if(0 == FLAC__STRCASECMP(field, "TRACK")) { + if(cs->num_tracks > 0) { + const FLAC__StreamMetadata_CueSheet_Track *prev = &cs->tracks[cs->num_tracks-1]; + if( + prev->num_indices == 0 || + ( + is_cdda && + ( + (prev->num_indices == 1 && prev->indices[0].number != 1) || + (prev->num_indices == 2 && prev->indices[0].number != 1 && prev->indices[1].number != 1) + ) + ) + ) { + *error_message = is_cdda? + "previous TRACK must specify at least one INDEX 01" : + "previous TRACK must specify at least one INDEX"; + return false; + } + } + if(0 == (field = local__get_field_(&line, /*allow_quotes=*/false))) { + *error_message = "TRACK is missing track number"; + return false; + } + in_track_num = local__parse_int_(field); + if(in_track_num < 0) { + *error_message = "TRACK has invalid track number"; + return false; + } + if(in_track_num == 0) { + *error_message = "TRACK number must be greater than 0"; + return false; + } + if(is_cdda && in_track_num > 99) { + *error_message = "CD-DA TRACK number must be between 1 and 99, inclusive"; + return false; + } + if(is_cdda && cs->num_tracks > 0 && in_track_num != cs->tracks[cs->num_tracks-1].number + 1) { + *error_message = "CD-DA TRACK numbers must be sequential"; + return false; + } + /*@@@ search for duplicate track number? */ + if(0 == (field = local__get_field_(&line, /*allow_quotes=*/false))) { + *error_message = "TRACK is missing a track type after the track number"; + return false; + } + if(!FLAC__metadata_object_cuesheet_insert_blank_track(cuesheet, cs->num_tracks)) { + *error_message = "memory allocation error"; + return false; + } + cs->tracks[cs->num_tracks-1].number = in_track_num; + cs->tracks[cs->num_tracks-1].type = (0 == FLAC__STRCASECMP(field, "AUDIO"))? 0 : 1; /*@@@ should we be more strict with the value here? */ + in_index_num = -1; + track_has_flags = false; + track_has_isrc = false; + } + else if(0 == FLAC__STRCASECMP(field, "REM")) { + if(0 != (field = local__get_field_(&line, /*allow_quotes=*/false))) { + if(0 == strcmp(field, "FLAC__lead-in")) { + FLAC__int64 xx; + if(0 == (field = local__get_field_(&line, /*allow_quotes=*/false))) { + *error_message = "FLAC__lead-in is missing offset"; + return false; + } + xx = local__parse_int64_(field); + if(xx < 0) { + *error_message = "illegal FLAC__lead-in offset"; + return false; + } + if(is_cdda && xx % 588 != 0) { + *error_message = "illegal CD-DA FLAC__lead-in offset, must be even multiple of 588 samples"; + return false; + } + cs->lead_in = (FLAC__uint64)xx; + } + else if(0 == strcmp(field, "FLAC__lead-out")) { + int track_num; + FLAC__int64 offset; + if(has_forced_leadout) { + *error_message = "multiple FLAC__lead-out commands"; + return false; + } + if(0 == (field = local__get_field_(&line, /*allow_quotes=*/false))) { + *error_message = "FLAC__lead-out is missing track number"; + return false; + } + track_num = local__parse_int_(field); + if(track_num < 0) { + *error_message = "illegal FLAC__lead-out track number"; + return false; + } + forced_leadout_track_num = (unsigned)track_num; + /*@@@ search for duplicate track number? */ + if(0 == (field = local__get_field_(&line, /*allow_quotes=*/false))) { + *error_message = "FLAC__lead-out is missing offset"; + return false; + } + offset = local__parse_int64_(field); + if(offset < 0) { + *error_message = "illegal FLAC__lead-out offset"; + return false; + } + forced_leadout_track_offset = (FLAC__uint64)offset; + if(forced_leadout_track_offset != lead_out_offset) { + *error_message = "FLAC__lead-out offset does not match end-of-stream offset"; + return false; + } + has_forced_leadout = true; + } + } + } + } + } + + if(cs->num_tracks == 0) { + *error_message = "there must be at least one TRACK command"; + return false; + } + else { + const FLAC__StreamMetadata_CueSheet_Track *prev = &cs->tracks[cs->num_tracks-1]; + if( + prev->num_indices == 0 || + ( + is_cdda && + ( + (prev->num_indices == 1 && prev->indices[0].number != 1) || + (prev->num_indices == 2 && prev->indices[0].number != 1 && prev->indices[1].number != 1) + ) + ) + ) { + *error_message = is_cdda? + "previous TRACK must specify at least one INDEX 01" : + "previous TRACK must specify at least one INDEX"; + return false; + } + } + + if(!has_forced_leadout) { + forced_leadout_track_num = is_cdda? 170 : cs->num_tracks; + forced_leadout_track_offset = lead_out_offset; + } + if(!FLAC__metadata_object_cuesheet_insert_blank_track(cuesheet, cs->num_tracks)) { + *error_message = "memory allocation error"; + return false; + } + cs->tracks[cs->num_tracks-1].number = forced_leadout_track_num; + cs->tracks[cs->num_tracks-1].offset = forced_leadout_track_offset; + + if(!feof(file)) { + *error_message = "read error"; + return false; + } + return true; +#undef FLAC__STRCASECMP +} + +FLAC__StreamMetadata *grabbag__cuesheet_parse(FILE *file, const char **error_message, unsigned *last_line_read, FLAC__bool is_cdda, FLAC__uint64 lead_out_offset) +{ + FLAC__StreamMetadata *cuesheet; + + FLAC__ASSERT(0 != file); + FLAC__ASSERT(0 != error_message); + FLAC__ASSERT(0 != last_line_read); + + *last_line_read = 0; + cuesheet = FLAC__metadata_object_new(FLAC__METADATA_TYPE_CUESHEET); + + if(0 == cuesheet) { + *error_message = "memory allocation error"; + return 0; + } + + if(!local__cuesheet_parse_(file, error_message, last_line_read, cuesheet, is_cdda, lead_out_offset)) { + FLAC__metadata_object_delete(cuesheet); + return 0; + } + + return cuesheet; +} + +void grabbag__cuesheet_emit(FILE *file, const FLAC__StreamMetadata *cuesheet, const char *file_reference) +{ + const FLAC__StreamMetadata_CueSheet *cs; + unsigned track_num, index_num; + + FLAC__ASSERT(0 != file); + FLAC__ASSERT(0 != cuesheet); + FLAC__ASSERT(cuesheet->type == FLAC__METADATA_TYPE_CUESHEET); + + cs = &cuesheet->data.cue_sheet; + + if(*(cs->media_catalog_number)) + fprintf(file, "CATALOG %s\n", cs->media_catalog_number); + fprintf(file, "FILE %s\n", file_reference); + + for(track_num = 0; track_num < cs->num_tracks-1; track_num++) { + const FLAC__StreamMetadata_CueSheet_Track *track = cs->tracks + track_num; + + fprintf(file, " TRACK %02u %s\n", (unsigned)track->number, track->type == 0? "AUDIO" : "DATA"); + + if(track->pre_emphasis) + fprintf(file, " FLAGS PRE\n"); + if(*(track->isrc)) + fprintf(file, " ISRC %s\n", track->isrc); + + for(index_num = 0; index_num < track->num_indices; index_num++) { + const FLAC__StreamMetadata_CueSheet_Index *index = track->indices + index_num; + + fprintf(file, " INDEX %02u ", (unsigned)index->number); + if(cs->is_cd) { + const unsigned logical_frame = (unsigned)((track->offset + index->offset) / (44100 / 75)); + unsigned m, s, f; + grabbag__cuesheet_frame_to_msf(logical_frame, &m, &s, &f); + fprintf(file, "%02u:%02u:%02u\n", m, s, f); + } + else +#ifdef _MSC_VER + fprintf(file, "%I64u\n", track->offset + index->offset); +#else + fprintf(file, "%llu\n", track->offset + index->offset); +#endif + } + } + +#ifdef _MSC_VER + fprintf(file, "REM FLAC__lead-in %I64u\n", cs->lead_in); + fprintf(file, "REM FLAC__lead-out %u %I64u\n", (unsigned)cs->tracks[track_num].number, cs->tracks[track_num].offset); +#else + fprintf(file, "REM FLAC__lead-in %llu\n", cs->lead_in); + fprintf(file, "REM FLAC__lead-out %u %llu\n", (unsigned)cs->tracks[track_num].number, cs->tracks[track_num].offset); +#endif +} diff --git a/Libraries/FLAC/Files/src/share/grabbag/file.c b/Libraries/FLAC/Files/src/share/grabbag/file.c new file mode 100644 index 000000000..5f362da63 --- /dev/null +++ b/Libraries/FLAC/Files/src/share/grabbag/file.c @@ -0,0 +1,142 @@ +/* grabbag - Convenience lib for various routines common to several tools + * Copyright (C) 2002,2003,2004,2005 Josh Coalson + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#if defined _MSC_VER || defined __MINGW32__ +#include /* for utime() */ +#include /* for chmod(), _setmode(), unlink() */ +#include /* for _O_BINARY */ +#else +#include /* some flavors of BSD (like OS X) require this to get time_t */ +#include /* for utime() */ +#endif +#ifdef __CYGWIN__ +#include /* for setmode(), O_BINARY */ +#include /* for _O_BINARY */ +#endif +#include /* for stat(), maybe chmod() */ +#if defined _WIN32 && !defined __CYGWIN__ +#else +#include /* for unlink() */ +#endif +#include +#include +#include /* for strrchr() */ +#include "share/grabbag.h" + + +void grabbag__file_copy_metadata(const char *srcpath, const char *destpath) +{ + struct stat srcstat; + struct utimbuf srctime; + + if(0 == stat(srcpath, &srcstat)) { + srctime.actime = srcstat.st_atime; + srctime.modtime = srcstat.st_mtime; + (void)chmod(destpath, srcstat.st_mode); + (void)utime(destpath, &srctime); + } +} + +off_t grabbag__file_get_filesize(const char *srcpath) +{ + struct stat srcstat; + + if(0 == stat(srcpath, &srcstat)) + return srcstat.st_size; + else + return -1; +} + +const char *grabbag__file_get_basename(const char *srcpath) +{ + const char *p; + + p = strrchr(srcpath, '/'); + if(0 == p) { + p = strrchr(srcpath, '\\'); + if(0 == p) + return srcpath; + } + return ++p; +} + +FLAC__bool grabbag__file_change_stats(const char *filename, FLAC__bool read_only) +{ + struct stat stats; + + if(0 == stat(filename, &stats)) { +#if !defined _MSC_VER && !defined __MINGW32__ + if(read_only) { + stats.st_mode &= ~S_IWUSR; + stats.st_mode &= ~S_IWGRP; + stats.st_mode &= ~S_IWOTH; + } + else { + stats.st_mode |= S_IWUSR; + } +#else + if(read_only) + stats.st_mode &= ~S_IWRITE; + else + stats.st_mode |= S_IWRITE; +#endif + if(0 != chmod(filename, stats.st_mode)) + return false; + } + else + return false; + + return true; +} + +FLAC__bool grabbag__file_remove_file(const char *filename) +{ + return grabbag__file_change_stats(filename, /*read_only=*/false) && 0 == unlink(filename); +} + +FILE *grabbag__file_get_binary_stdin() +{ + /* if something breaks here it is probably due to the presence or + * absence of an underscore before the identifiers 'setmode', + * 'fileno', and/or 'O_BINARY'; check your system header files. + */ +#if defined _MSC_VER || defined __MINGW32__ + _setmode(_fileno(stdin), _O_BINARY); +#elif defined __CYGWIN__ + /* almost certainly not needed for any modern Cygwin, but let's be safe... */ + setmode(_fileno(stdin), _O_BINARY); +#endif + + return stdin; +} + +FILE *grabbag__file_get_binary_stdout() +{ + /* if something breaks here it is probably due to the presence or + * absence of an underscore before the identifiers 'setmode', + * 'fileno', and/or 'O_BINARY'; check your system header files. + */ +#if defined _MSC_VER || defined __MINGW32__ + _setmode(_fileno(stdout), _O_BINARY); +#elif defined __CYGWIN__ + /* almost certainly not needed for any modern Cygwin, but let's be safe... */ + setmode(_fileno(stdout), _O_BINARY); +#endif + + return stdout; +} diff --git a/Libraries/FLAC/Files/src/share/grabbag/grabbag_static.dsp b/Libraries/FLAC/Files/src/share/grabbag/grabbag_static.dsp new file mode 100644 index 000000000..f7db7fbae --- /dev/null +++ b/Libraries/FLAC/Files/src/share/grabbag/grabbag_static.dsp @@ -0,0 +1,136 @@ +# Microsoft Developer Studio Project File - Name="grabbag_static" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Static Library" 0x0104 + +CFG=grabbag_static - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "grabbag_static.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "grabbag_static.mak" CFG="grabbag_static - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "grabbag_static - Win32 Release" (based on "Win32 (x86) Static Library") +!MESSAGE "grabbag_static - Win32 Debug" (based on "Win32 (x86) Static Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "grabbag" +# PROP Scc_LocalPath "..\..\.." +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "grabbag_static - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "..\..\..\obj\release\lib" +# PROP Intermediate_Dir "Release_static" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /Op /I ".\include" /I "..\..\..\include" /D "FLAC__NO_DLL" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo /nodefaultlib + +!ELSEIF "$(CFG)" == "grabbag_static - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "..\..\..\obj\debug\lib" +# PROP Intermediate_Dir "Debug_static" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".\include" /I "..\..\..\include" /D "FLAC__NO_DLL" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo /nodefaultlib + +!ENDIF + +# Begin Target + +# Name "grabbag_static - Win32 Release" +# Name "grabbag_static - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "c" +# Begin Source File + +SOURCE=.\cuesheet.c +# End Source File +# Begin Source File + +SOURCE=.\file.c +# End Source File +# Begin Source File + +SOURCE=.\replaygain.c +# End Source File +# Begin Source File + +SOURCE=.\seektable.c +# End Source File +# End Group +# Begin Group "Private Header Files" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=..\..\..\include\share\grabbag\cuesheet.h +# End Source File +# Begin Source File + +SOURCE=..\..\..\include\share\grabbag\file.h +# End Source File +# Begin Source File + +SOURCE=..\..\..\include\share\grabbag\replaygain.h +# End Source File +# Begin Source File + +SOURCE=..\..\..\include\share\grabbag\seektable.h +# End Source File +# End Group +# Begin Group "Protected Header Files" + +# PROP Default_Filter "" +# End Group +# Begin Group "Public Header Files" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=..\..\..\include\share\grabbag.h +# End Source File +# End Group +# End Target +# End Project diff --git a/Libraries/FLAC/Files/src/share/grabbag/replaygain.c b/Libraries/FLAC/Files/src/share/grabbag/replaygain.c new file mode 100644 index 000000000..bb9e2429d --- /dev/null +++ b/Libraries/FLAC/Files/src/share/grabbag/replaygain.c @@ -0,0 +1,615 @@ +/* grabbag - Convenience lib for various routines common to several tools + * Copyright (C) 2002,2003,2004,2005 Josh Coalson + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "share/grabbag.h" +#include "share/replaygain_analysis.h" +#include "FLAC/assert.h" +#include "FLAC/file_decoder.h" +#include "FLAC/metadata.h" +#include +#include +#include +#include +#include +#if defined _MSC_VER || defined __MINGW32__ +#include /* for chmod() */ +#endif +#include /* for stat(), maybe chmod() */ + +#ifdef local_min +#undef local_min +#endif +#define local_min(a,b) ((a)<(b)?(a):(b)) + +#ifdef local_max +#undef local_max +#endif +#define local_max(a,b) ((a)>(b)?(a):(b)) + +static const FLAC__byte *tag_title_gain_ = "REPLAYGAIN_TRACK_GAIN"; +static const FLAC__byte *tag_title_peak_ = "REPLAYGAIN_TRACK_PEAK"; +static const FLAC__byte *tag_album_gain_ = "REPLAYGAIN_ALBUM_GAIN"; +static const FLAC__byte *tag_album_peak_ = "REPLAYGAIN_ALBUM_PEAK"; +static const char *peak_format_ = "%s=%1.8f"; +static const char *gain_format_ = "%s=%+2.2f dB"; + +static double album_peak_, title_peak_; + +const unsigned GRABBAG__REPLAYGAIN_MAX_TAG_SPACE_REQUIRED = 148; +/* + FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN/8 + 21 + 1 + 10 + + FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN/8 + 21 + 1 + 12 + + FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN/8 + 21 + 1 + 10 + + FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN/8 + 21 + 1 + 12 +*/ + + +static FLAC__bool get_file_stats_(const char *filename, struct stat *stats) +{ + FLAC__ASSERT(0 != filename); + FLAC__ASSERT(0 != stats); + return (0 == stat(filename, stats)); +} + +static void set_file_stats_(const char *filename, struct stat *stats) +{ + FLAC__ASSERT(0 != filename); + FLAC__ASSERT(0 != stats); + + (void)chmod(filename, stats->st_mode); +} + +static FLAC__bool append_tag_(FLAC__StreamMetadata *block, const char *format, const FLAC__byte *name, float value) +{ + char buffer[256]; + char *saved_locale; + FLAC__StreamMetadata_VorbisComment_Entry entry; + + FLAC__ASSERT(0 != block); + FLAC__ASSERT(block->type == FLAC__METADATA_TYPE_VORBIS_COMMENT); + FLAC__ASSERT(0 != name); + FLAC__ASSERT(0 != value); + + buffer[sizeof(buffer)-1] = '\0'; + /* + * We need to save the old locale and switch to "C" because the locale + * influences the formatting of %f and we want it a certain way. + */ + saved_locale = setlocale(LC_ALL, 0); + setlocale(LC_ALL, "C"); +#if defined _MSC_VER || defined __MINGW32__ + _snprintf(buffer, sizeof(buffer)-1, format, name, value); +#else + snprintf(buffer, sizeof(buffer)-1, format, name, value); +#endif + setlocale(LC_ALL, saved_locale); + + entry.entry = (FLAC__byte *)buffer; + entry.length = strlen(buffer); + + return FLAC__metadata_object_vorbiscomment_append_comment(block, entry, /*copy=*/true); +} + +FLAC__bool grabbag__replaygain_is_valid_sample_frequency(unsigned sample_frequency) +{ + static const unsigned valid_sample_rates[] = { + 8000, + 11025, + 12000, + 16000, + 22050, + 24000, + 32000, + 44100, + 48000 + }; + static const unsigned n_valid_sample_rates = sizeof(valid_sample_rates) / sizeof(valid_sample_rates[0]); + + unsigned i; + + for(i = 0; i < n_valid_sample_rates; i++) + if(sample_frequency == valid_sample_rates[i]) + return true; + return false; +} + +FLAC__bool grabbag__replaygain_init(unsigned sample_frequency) +{ + title_peak_ = album_peak_ = 0.0; + return InitGainAnalysis((long)sample_frequency) == INIT_GAIN_ANALYSIS_OK; +} + +FLAC__bool grabbag__replaygain_analyze(const FLAC__int32 * const input[], FLAC__bool is_stereo, unsigned bps, unsigned samples) +{ + /* using a small buffer improves data locality; we'd like it to fit easily in the dcache */ + static Float_t lbuffer[2048], rbuffer[2048]; + static const unsigned nbuffer = sizeof(lbuffer) / sizeof(lbuffer[0]); + FLAC__int32 block_peak = 0, s; + unsigned i, j; + + FLAC__ASSERT(bps >= 4 && bps <= FLAC__REFERENCE_CODEC_MAX_BITS_PER_SAMPLE); + FLAC__ASSERT(FLAC__MIN_BITS_PER_SAMPLE == 4); + /* + * We use abs() on a FLAC__int32 which is undefined for the most negative value. + * If the reference codec ever handles 32bps we will have to write a special + * case here. + */ + FLAC__ASSERT(FLAC__REFERENCE_CODEC_MAX_BITS_PER_SAMPLE < 32); + + if(bps == 16) { + if(is_stereo) { + j = 0; + while(samples > 0) { + const unsigned n = local_min(samples, nbuffer); + for(i = 0; i < n; i++, j++) { + s = input[0][j]; + lbuffer[i] = (Float_t)s; + s = abs(s); + block_peak = local_max(block_peak, s); + + s = input[1][j]; + rbuffer[i] = (Float_t)s; + s = abs(s); + block_peak = local_max(block_peak, s); + } + samples -= n; + if(AnalyzeSamples(lbuffer, rbuffer, n, 2) != GAIN_ANALYSIS_OK) + return false; + } + } + else { + j = 0; + while(samples > 0) { + const unsigned n = local_min(samples, nbuffer); + for(i = 0; i < n; i++, j++) { + s = input[0][j]; + lbuffer[i] = (Float_t)s; + s = abs(s); + block_peak = local_max(block_peak, s); + } + samples -= n; + if(AnalyzeSamples(lbuffer, 0, n, 1) != GAIN_ANALYSIS_OK) + return false; + } + } + } + else { /* bps must be < 32 according to above assertion */ + const double scale = ( + (bps > 16)? + (double)1. / (double)(1u << (bps - 16)) : + (double)(1u << (16 - bps)) + ); + + if(is_stereo) { + j = 0; + while(samples > 0) { + const unsigned n = local_min(samples, nbuffer); + for(i = 0; i < n; i++, j++) { + s = input[0][j]; + lbuffer[i] = (Float_t)(scale * (double)s); + s = abs(s); + block_peak = local_max(block_peak, s); + + s = input[1][j]; + rbuffer[i] = (Float_t)(scale * (double)s); + s = abs(s); + block_peak = local_max(block_peak, s); + } + samples -= n; + if(AnalyzeSamples(lbuffer, rbuffer, n, 2) != GAIN_ANALYSIS_OK) + return false; + } + } + else { + j = 0; + while(samples > 0) { + const unsigned n = local_min(samples, nbuffer); + for(i = 0; i < n; i++, j++) { + s = input[0][j]; + lbuffer[i] = (Float_t)(scale * (double)s); + s = abs(s); + block_peak = local_max(block_peak, s); + } + samples -= n; + if(AnalyzeSamples(lbuffer, 0, n, 1) != GAIN_ANALYSIS_OK) + return false; + } + } + } + + { + const double peak_scale = (double)(1u << (bps - 1)); + double peak = (double)block_peak / peak_scale; + if(peak > title_peak_) + title_peak_ = peak; + if(peak > album_peak_) + album_peak_ = peak; + } + + return true; +} + +void grabbag__replaygain_get_album(float *gain, float *peak) +{ + *gain = (float)GetAlbumGain(); + *peak = (float)album_peak_; + album_peak_ = 0.0; +} + +void grabbag__replaygain_get_title(float *gain, float *peak) +{ + *gain = (float)GetTitleGain(); + *peak = (float)title_peak_; + title_peak_ = 0.0; +} + + +typedef struct { + unsigned channels; + unsigned bits_per_sample; + unsigned sample_rate; + FLAC__bool error; +} DecoderInstance; + +static FLAC__StreamDecoderWriteStatus write_callback_(const FLAC__FileDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data) +{ + DecoderInstance *instance = (DecoderInstance*)client_data; + const unsigned bits_per_sample = frame->header.bits_per_sample; + const unsigned channels = frame->header.channels; + const unsigned sample_rate = frame->header.sample_rate; + const unsigned samples = frame->header.blocksize; + + (void)decoder; + + if( + !instance->error && + (channels == 2 || channels == 1) && + bits_per_sample == instance->bits_per_sample && + channels == instance->channels && + sample_rate == instance->sample_rate + ) { + instance->error = !grabbag__replaygain_analyze(buffer, channels==2, bits_per_sample, samples); + } + else { + instance->error = true; + } + + if(!instance->error) + return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE; + else + return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT; +} + +static void metadata_callback_(const FLAC__FileDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data) +{ + DecoderInstance *instance = (DecoderInstance*)client_data; + + (void)decoder; + + if(metadata->type == FLAC__METADATA_TYPE_STREAMINFO) { + instance->bits_per_sample = metadata->data.stream_info.bits_per_sample; + instance->channels = metadata->data.stream_info.channels; + instance->sample_rate = metadata->data.stream_info.sample_rate; + + if(instance->channels != 1 && instance->channels != 2) { + instance->error = true; + return; + } + + if(!grabbag__replaygain_is_valid_sample_frequency(instance->sample_rate)) { + instance->error = true; + return; + } + } +} + +static void error_callback_(const FLAC__FileDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data) +{ + DecoderInstance *instance = (DecoderInstance*)client_data; + + (void)decoder, (void)status; + + instance->error = true; +} + +const char *grabbag__replaygain_analyze_file(const char *filename, float *title_gain, float *title_peak) +{ + DecoderInstance instance; + FLAC__FileDecoder *decoder = FLAC__file_decoder_new(); + + if(0 == decoder) + return "memory allocation error"; + + instance.error = false; + + /* It does these three by default but lets be explicit: */ + FLAC__file_decoder_set_md5_checking(decoder, false); + FLAC__file_decoder_set_metadata_ignore_all(decoder); + FLAC__file_decoder_set_metadata_respond(decoder, FLAC__METADATA_TYPE_STREAMINFO); + + FLAC__file_decoder_set_filename(decoder, filename); + FLAC__file_decoder_set_write_callback(decoder, write_callback_); + FLAC__file_decoder_set_metadata_callback(decoder, metadata_callback_); + FLAC__file_decoder_set_error_callback(decoder, error_callback_); + FLAC__file_decoder_set_client_data(decoder, &instance); + + if(FLAC__file_decoder_init(decoder) != FLAC__FILE_DECODER_OK) { + FLAC__file_decoder_delete(decoder); + return "initializing decoder"; + } + + if(!FLAC__file_decoder_process_until_end_of_file(decoder) || instance.error) { + FLAC__file_decoder_delete(decoder); + return "decoding file"; + } + + FLAC__file_decoder_delete(decoder); + + grabbag__replaygain_get_title(title_gain, title_peak); + + return 0; +} + +const char *grabbag__replaygain_store_to_vorbiscomment(FLAC__StreamMetadata *block, float album_gain, float album_peak, float title_gain, float title_peak) +{ + const char *error; + + if(0 != (error = grabbag__replaygain_store_to_vorbiscomment_title(block, title_gain, title_peak))) + return error; + + if(0 != (error = grabbag__replaygain_store_to_vorbiscomment_album(block, album_gain, album_peak))) + return error; + + return 0; +} + +const char *grabbag__replaygain_store_to_vorbiscomment_album(FLAC__StreamMetadata *block, float album_gain, float album_peak) +{ + FLAC__ASSERT(0 != block); + FLAC__ASSERT(block->type == FLAC__METADATA_TYPE_VORBIS_COMMENT); + + if( + FLAC__metadata_object_vorbiscomment_remove_entries_matching(block, (const char *)tag_album_gain_) < 0 || + FLAC__metadata_object_vorbiscomment_remove_entries_matching(block, (const char *)tag_album_peak_) < 0 + ) + return "memory allocation error"; + + if( + !append_tag_(block, peak_format_, tag_album_peak_, album_peak) || + !append_tag_(block, gain_format_, tag_album_gain_, album_gain) + ) + return "memory allocation error"; + + return 0; +} + +const char *grabbag__replaygain_store_to_vorbiscomment_title(FLAC__StreamMetadata *block, float title_gain, float title_peak) +{ + FLAC__ASSERT(0 != block); + FLAC__ASSERT(block->type == FLAC__METADATA_TYPE_VORBIS_COMMENT); + + if( + FLAC__metadata_object_vorbiscomment_remove_entries_matching(block, (const char *)tag_title_gain_) < 0 || + FLAC__metadata_object_vorbiscomment_remove_entries_matching(block, (const char *)tag_title_peak_) < 0 + ) + return "memory allocation error"; + + if( + !append_tag_(block, peak_format_, tag_title_peak_, title_peak) || + !append_tag_(block, gain_format_, tag_title_gain_, title_gain) + ) + return "memory allocation error"; + + return 0; +} + +static const char *store_to_file_pre_(const char *filename, FLAC__Metadata_Chain **chain, FLAC__StreamMetadata **block) +{ + FLAC__Metadata_Iterator *iterator; + const char *error; + FLAC__bool found_vc_block = false; + + if(0 == (*chain = FLAC__metadata_chain_new())) + return "memory allocation error"; + + if(!FLAC__metadata_chain_read(*chain, filename)) { + error = FLAC__Metadata_ChainStatusString[FLAC__metadata_chain_status(*chain)]; + FLAC__metadata_chain_delete(*chain); + return error; + } + + if(0 == (iterator = FLAC__metadata_iterator_new())) { + FLAC__metadata_chain_delete(*chain); + return "memory allocation error"; + } + + FLAC__metadata_iterator_init(iterator, *chain); + + do { + *block = FLAC__metadata_iterator_get_block(iterator); + if((*block)->type == FLAC__METADATA_TYPE_VORBIS_COMMENT) + found_vc_block = true; + } while(!found_vc_block && FLAC__metadata_iterator_next(iterator)); + + if(!found_vc_block) { + /* create a new block */ + *block = FLAC__metadata_object_new(FLAC__METADATA_TYPE_VORBIS_COMMENT); + if(0 == *block) { + FLAC__metadata_chain_delete(*chain); + FLAC__metadata_iterator_delete(iterator); + return "memory allocation error"; + } + while(FLAC__metadata_iterator_next(iterator)) + ; + if(!FLAC__metadata_iterator_insert_block_after(iterator, *block)) { + error = FLAC__Metadata_ChainStatusString[FLAC__metadata_chain_status(*chain)]; + FLAC__metadata_chain_delete(*chain); + FLAC__metadata_iterator_delete(iterator); + return error; + } + /* iterator is left pointing to new block */ + FLAC__ASSERT(FLAC__metadata_iterator_get_block(iterator) == *block); + } + + FLAC__metadata_iterator_delete(iterator); + + FLAC__ASSERT(0 != *block); + FLAC__ASSERT((*block)->type == FLAC__METADATA_TYPE_VORBIS_COMMENT); + + return 0; +} + +static const char *store_to_file_post_(const char *filename, FLAC__Metadata_Chain *chain, FLAC__bool preserve_modtime) +{ + struct stat stats; + const FLAC__bool have_stats = get_file_stats_(filename, &stats); + + (void)grabbag__file_change_stats(filename, /*read_only=*/false); + + FLAC__metadata_chain_sort_padding(chain); + if(!FLAC__metadata_chain_write(chain, /*use_padding=*/true, preserve_modtime)) { + FLAC__metadata_chain_delete(chain); + return FLAC__Metadata_ChainStatusString[FLAC__metadata_chain_status(chain)]; + } + + FLAC__metadata_chain_delete(chain); + + if(have_stats) + set_file_stats_(filename, &stats); + + return 0; +} + +const char *grabbag__replaygain_store_to_file(const char *filename, float album_gain, float album_peak, float title_gain, float title_peak, FLAC__bool preserve_modtime) +{ + FLAC__Metadata_Chain *chain; + FLAC__StreamMetadata *block; + const char *error; + + if(0 != (error = store_to_file_pre_(filename, &chain, &block))) + return error; + + if(0 != (error = grabbag__replaygain_store_to_vorbiscomment(block, album_gain, album_peak, title_gain, title_peak))) { + FLAC__metadata_chain_delete(chain); + return error; + } + + if(0 != (error = store_to_file_post_(filename, chain, preserve_modtime))) + return error; + + return 0; +} + +const char *grabbag__replaygain_store_to_file_album(const char *filename, float album_gain, float album_peak, FLAC__bool preserve_modtime) +{ + FLAC__Metadata_Chain *chain; + FLAC__StreamMetadata *block; + const char *error; + + if(0 != (error = store_to_file_pre_(filename, &chain, &block))) + return error; + + if(0 != (error = grabbag__replaygain_store_to_vorbiscomment_album(block, album_gain, album_peak))) { + FLAC__metadata_chain_delete(chain); + return error; + } + + if(0 != (error = store_to_file_post_(filename, chain, preserve_modtime))) + return error; + + return 0; +} + +const char *grabbag__replaygain_store_to_file_title(const char *filename, float title_gain, float title_peak, FLAC__bool preserve_modtime) +{ + FLAC__Metadata_Chain *chain; + FLAC__StreamMetadata *block; + const char *error; + + if(0 != (error = store_to_file_pre_(filename, &chain, &block))) + return error; + + if(0 != (error = grabbag__replaygain_store_to_vorbiscomment_title(block, title_gain, title_peak))) { + FLAC__metadata_chain_delete(chain); + return error; + } + + if(0 != (error = store_to_file_post_(filename, chain, preserve_modtime))) + return error; + + return 0; +} + +static FLAC__bool parse_double_(const FLAC__StreamMetadata_VorbisComment_Entry *entry, double *val) +{ + char s[32], *end; + const char *p, *q; + double v; + + FLAC__ASSERT(0 != entry); + FLAC__ASSERT(0 != val); + + p = (const char *)entry->entry; + q = strchr(p, '='); + if(0 == q) + return false; + q++; + memset(s, 0, sizeof(s)-1); + strncpy(s, q, local_min(sizeof(s)-1, entry->length - (q-p))); + + v = strtod(s, &end); + if(end == s) + return false; + + *val = v; + return true; +} + +FLAC__bool grabbag__replaygain_load_from_vorbiscomment(const FLAC__StreamMetadata *block, FLAC__bool album_mode, double *gain, double *peak) +{ + int gain_offset, peak_offset; + + FLAC__ASSERT(0 != block); + FLAC__ASSERT(block->type == FLAC__METADATA_TYPE_VORBIS_COMMENT); + + if(0 > (gain_offset = FLAC__metadata_object_vorbiscomment_find_entry_from(block, /*offset=*/0, (const char *)(album_mode? tag_album_gain_ : tag_title_gain_)))) + return false; + if(0 > (peak_offset = FLAC__metadata_object_vorbiscomment_find_entry_from(block, /*offset=*/0, (const char *)(album_mode? tag_album_peak_ : tag_title_peak_)))) + return false; + + if(!parse_double_(block->data.vorbis_comment.comments + gain_offset, gain)) + return false; + if(!parse_double_(block->data.vorbis_comment.comments + peak_offset, peak)) + return false; + + return true; +} + +double grabbag__replaygain_compute_scale_factor(double peak, double gain, double preamp, FLAC__bool prevent_clipping) +{ + double scale; + FLAC__ASSERT(peak >= 0.0); + gain += preamp; + scale = (float) pow(10.0, gain * 0.05); + if(prevent_clipping && peak > 0.0) { + const double max_scale = (float)(1.0 / peak); + if(scale > max_scale) + scale = max_scale; + } + return scale; +} diff --git a/Libraries/FLAC/Files/src/share/grabbag/seektable.c b/Libraries/FLAC/Files/src/share/grabbag/seektable.c new file mode 100644 index 000000000..7e0d79c6c --- /dev/null +++ b/Libraries/FLAC/Files/src/share/grabbag/seektable.c @@ -0,0 +1,93 @@ +/* grabbag - Convenience lib for various routines common to several tools + * Copyright (C) 2002,2003,2004,2005 Josh Coalson + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "share/grabbag.h" +#include "FLAC/assert.h" +#include /* for atoi() */ +#include + +FLAC__bool grabbag__seektable_convert_specification_to_template(const char *spec, FLAC__bool only_explicit_placeholders, FLAC__uint64 total_samples_to_encode, unsigned sample_rate, FLAC__StreamMetadata *seektable_template, FLAC__bool *spec_has_real_points) +{ + unsigned i; + const char *pt; + + FLAC__ASSERT(0 != spec); + FLAC__ASSERT(0 != seektable_template); + FLAC__ASSERT(seektable_template->type = FLAC__METADATA_TYPE_SEEKTABLE); + + if(0 != spec_has_real_points) + *spec_has_real_points = false; + + for(pt = spec, i = 0; pt && *pt; i++) { + const char *q = strchr(pt, ';'); + FLAC__ASSERT(0 != q); + + if(q > pt) { + if(0 == strncmp(pt, "X;", 2)) { /* -S X */ + if(!FLAC__metadata_object_seektable_template_append_placeholders(seektable_template, 1)) + return false; + } + else if(q[-1] == 'x') { /* -S #x */ + if(total_samples_to_encode > 0) { /* we can only do these if we know the number of samples to encode up front */ + if(0 != spec_has_real_points) + *spec_has_real_points = true; + if(!only_explicit_placeholders) { + if(!FLAC__metadata_object_seektable_template_append_spaced_points(seektable_template, atoi(pt), total_samples_to_encode)) + return false; + } + } + } + else if(q[-1] == 's') { /* -S #s */ + if(total_samples_to_encode > 0) { /* we can only do these if we know the number of samples to encode up front */ + FLAC__ASSERT(sample_rate > 0); + if(0 != spec_has_real_points) + *spec_has_real_points = true; + if(!only_explicit_placeholders) { + double sec = atof(pt); + if(sec > 0.0) { +#if defined _MSC_VER || defined __MINGW32__ + /* with MSVC you have to spoon feed it the casting */ + unsigned n = (unsigned)((double)(FLAC__int64)total_samples_to_encode / (sec * (double)sample_rate)); +#else + unsigned n = (unsigned)((double)total_samples_to_encode / (sec * (double)sample_rate)); +#endif + if(!FLAC__metadata_object_seektable_template_append_spaced_points(seektable_template, n, total_samples_to_encode)) + return false; + } + } + } + } + else { /* -S # */ + if(0 != spec_has_real_points) + *spec_has_real_points = true; + if(!only_explicit_placeholders) { + FLAC__uint64 n = (unsigned)atoi(pt); + if(!FLAC__metadata_object_seektable_template_append_point(seektable_template, n)) + return false; + } + } + } + + pt = ++q; + } + + if(!FLAC__metadata_object_seektable_template_sort(seektable_template, /*compact=*/true)) + return false; + + return true; +} diff --git a/Libraries/FLAC/Files/src/share/replaygain_analysis/Makefile.am b/Libraries/FLAC/Files/src/share/replaygain_analysis/Makefile.am new file mode 100644 index 000000000..a7ad91576 --- /dev/null +++ b/Libraries/FLAC/Files/src/share/replaygain_analysis/Makefile.am @@ -0,0 +1,19 @@ +## Process this file with automake to produce Makefile.in + +AUTOMAKE_OPTIONS = foreign + +INCLUDES = -I$(top_srcdir)/include/share + +noinst_LTLIBRARIES = libreplaygain_analysis.la + +libreplaygain_analysis_la_SOURCES = replaygain_analysis.c + +EXTRA_DIST = \ + Makefile.lite \ + replaygain_analysis_static.dsp + +debug: + $(MAKE) all CFLAGS="@DEBUG@" + +profile: + $(MAKE) all CFLAGS="@PROFILE@" diff --git a/Libraries/FLAC/Files/src/share/replaygain_analysis/Makefile.in b/Libraries/FLAC/Files/src/share/replaygain_analysis/Makefile.in new file mode 100644 index 000000000..f1ffe6902 --- /dev/null +++ b/Libraries/FLAC/Files/src/share/replaygain_analysis/Makefile.in @@ -0,0 +1,498 @@ +# Makefile.in generated by automake 1.8.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +SOURCES = $(libreplaygain_analysis_la_SOURCES) + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../../.. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_triplet = @host@ +subdir = src/share/replaygain_analysis +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(mkdir_p) +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +libreplaygain_analysis_la_LIBADD = +am_libreplaygain_analysis_la_OBJECTS = replaygain_analysis.lo +libreplaygain_analysis_la_OBJECTS = \ + $(am_libreplaygain_analysis_la_OBJECTS) +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/replaygain_analysis.Plo +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(libreplaygain_analysis_la_SOURCES) +DIST_SOURCES = $(libreplaygain_analysis_la_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCAS = @CCAS@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEBUG_FALSE = @DEBUG_FALSE@ +DEBUG_TRUE = @DEBUG_TRUE@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DOCBOOK_TO_MAN = @DOCBOOK_TO_MAN@ +DOXYGEN = @DOXYGEN@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FLaC__CPU_IA32_FALSE = @FLaC__CPU_IA32_FALSE@ +FLaC__CPU_IA32_TRUE = @FLaC__CPU_IA32_TRUE@ +FLaC__CPU_PPC_FALSE = @FLaC__CPU_PPC_FALSE@ +FLaC__CPU_PPC_TRUE = @FLaC__CPU_PPC_TRUE@ +FLaC__CPU_SPARC_FALSE = @FLaC__CPU_SPARC_FALSE@ +FLaC__CPU_SPARC_TRUE = @FLaC__CPU_SPARC_TRUE@ +FLaC__EXHAUSTIVE_TESTS_FALSE = @FLaC__EXHAUSTIVE_TESTS_FALSE@ +FLaC__EXHAUSTIVE_TESTS_TRUE = @FLaC__EXHAUSTIVE_TESTS_TRUE@ +FLaC__HAS_AS_FALSE = @FLaC__HAS_AS_FALSE@ +FLaC__HAS_AS_TRUE = @FLaC__HAS_AS_TRUE@ +FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@ +FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@ +FLaC__HAS_DOCBOOK_TO_MAN_FALSE = @FLaC__HAS_DOCBOOK_TO_MAN_FALSE@ +FLaC__HAS_DOCBOOK_TO_MAN_TRUE = @FLaC__HAS_DOCBOOK_TO_MAN_TRUE@ +FLaC__HAS_DOXYGEN_FALSE = @FLaC__HAS_DOXYGEN_FALSE@ +FLaC__HAS_DOXYGEN_TRUE = @FLaC__HAS_DOXYGEN_TRUE@ +FLaC__HAS_GAS_FALSE = @FLaC__HAS_GAS_FALSE@ +FLaC__HAS_GAS_TRUE = @FLaC__HAS_GAS_TRUE@ +FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@ +FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@ +FLaC__HAS_NASM_FALSE = @FLaC__HAS_NASM_FALSE@ +FLaC__HAS_NASM_TRUE = @FLaC__HAS_NASM_TRUE@ +FLaC__HAS_OGG_FALSE = @FLaC__HAS_OGG_FALSE@ +FLaC__HAS_OGG_TRUE = @FLaC__HAS_OGG_TRUE@ +FLaC__HAS_XMMS_FALSE = @FLaC__HAS_XMMS_FALSE@ +FLaC__HAS_XMMS_TRUE = @FLaC__HAS_XMMS_TRUE@ +FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE@ +FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE@ +FLaC__NO_ASM_FALSE = @FLaC__NO_ASM_FALSE@ +FLaC__NO_ASM_TRUE = @FLaC__NO_ASM_TRUE@ +FLaC__SSE_OS_FALSE = @FLaC__SSE_OS_FALSE@ +FLaC__SSE_OS_TRUE = @FLaC__SSE_OS_TRUE@ +FLaC__SYS_DARWIN_FALSE = @FLaC__SYS_DARWIN_FALSE@ +FLaC__SYS_DARWIN_TRUE = @FLaC__SYS_DARWIN_TRUE@ +FLaC__SYS_LINUX_FALSE = @FLaC__SYS_LINUX_FALSE@ +FLaC__SYS_LINUX_TRUE = @FLaC__SYS_LINUX_TRUE@ +FLaC__USE_3DNOW_FALSE = @FLaC__USE_3DNOW_FALSE@ +FLaC__USE_3DNOW_TRUE = @FLaC__USE_3DNOW_TRUE@ +FLaC__USE_ALTIVEC_FALSE = @FLaC__USE_ALTIVEC_FALSE@ +FLaC__USE_ALTIVEC_TRUE = @FLaC__USE_ALTIVEC_TRUE@ +FLaC__VALGRIND_TESTING_FALSE = @FLaC__VALGRIND_TESTING_FALSE@ +FLaC__VALGRIND_TESTING_TRUE = @FLaC__VALGRIND_TESTING_TRUE@ +GAS = @GAS@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +NASM = @NASM@ +OBJEXT = @OBJEXT@ +OBJ_FORMAT = @OBJ_FORMAT@ +OGG_CFLAGS = @OGG_CFLAGS@ +OGG_LIBS = @OGG_LIBS@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +XMMS_CFLAGS = @XMMS_CFLAGS@ +XMMS_CONFIG = @XMMS_CONFIG@ +XMMS_DATA_DIR = @XMMS_DATA_DIR@ +XMMS_EFFECT_PLUGIN_DIR = @XMMS_EFFECT_PLUGIN_DIR@ +XMMS_GENERAL_PLUGIN_DIR = @XMMS_GENERAL_PLUGIN_DIR@ +XMMS_INPUT_PLUGIN_DIR = @XMMS_INPUT_PLUGIN_DIR@ +XMMS_LIBS = @XMMS_LIBS@ +XMMS_OUTPUT_PLUGIN_DIR = @XMMS_OUTPUT_PLUGIN_DIR@ +XMMS_PLUGIN_DIR = @XMMS_PLUGIN_DIR@ +XMMS_VERSION = @XMMS_VERSION@ +XMMS_VISUALIZATION_PLUGIN_DIR = @XMMS_VISUALIZATION_PLUGIN_DIR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +AUTOMAKE_OPTIONS = foreign +INCLUDES = -I$(top_srcdir)/include/share +noinst_LTLIBRARIES = libreplaygain_analysis.la +libreplaygain_analysis_la_SOURCES = replaygain_analysis.c +EXTRA_DIST = \ + Makefile.lite \ + replaygain_analysis_static.dsp + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/share/replaygain_analysis/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/share/replaygain_analysis/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libreplaygain_analysis.la: $(libreplaygain_analysis_la_OBJECTS) $(libreplaygain_analysis_la_DEPENDENCIES) + $(LINK) $(libreplaygain_analysis_la_LDFLAGS) $(libreplaygain_analysis_la_OBJECTS) $(libreplaygain_analysis_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/replaygain_analysis.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstLTLIBRARIES ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-exec \ + install-exec-am install-info install-info-am install-man \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am \ + uninstall-info-am + + +debug: + $(MAKE) all CFLAGS="@DEBUG@" + +profile: + $(MAKE) all CFLAGS="@PROFILE@" +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/Libraries/FLAC/Files/src/share/replaygain_analysis/Makefile.lite b/Libraries/FLAC/Files/src/share/replaygain_analysis/Makefile.lite new file mode 100644 index 000000000..8c4c69826 --- /dev/null +++ b/Libraries/FLAC/Files/src/share/replaygain_analysis/Makefile.lite @@ -0,0 +1,15 @@ +# +# GNU makefile +# + +topdir = ../../.. + +LIB_NAME = libreplaygain_analysis +INCLUDES = -I$(topdir)/include/share + +SRCS_C = \ + replaygain_analysis.c + +include $(topdir)/build/lib.mk + +# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/Libraries/FLAC/Files/src/share/replaygain_analysis/replaygain_analysis.c b/Libraries/FLAC/Files/src/share/replaygain_analysis/replaygain_analysis.c new file mode 100644 index 000000000..43e2ba66f --- /dev/null +++ b/Libraries/FLAC/Files/src/share/replaygain_analysis/replaygain_analysis.c @@ -0,0 +1,413 @@ +/* + * ReplayGainAnalysis - analyzes input samples and give the recommended dB change + * Copyright (C) 2001 David Robinson and Glen Sawyer + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * concept and filter values by David Robinson (David@Robinson.org) + * -- blame him if you think the idea is flawed + * original coding by Glen Sawyer (glensawyer@hotmail.com) + * -- blame him if you think this runs too slowly, or the coding is otherwise flawed + * + * lots of code improvements by Frank Klemm ( http://www.uni-jena.de/~pfk/mpp/ ) + * -- credit him for all the _good_ programming ;) + * + * minor cosmetic tweaks to integrate with FLAC by Josh Coalson + * + * + * For an explanation of the concepts and the basic algorithms involved, go to: + * http://www.replaygain.org/ + */ + +/* + * Here's the deal. Call + * + * InitGainAnalysis ( long samplefreq ); + * + * to initialize everything. Call + * + * AnalyzeSamples ( const Float_t* left_samples, + * const Float_t* right_samples, + * size_t num_samples, + * int num_channels ); + * + * as many times as you want, with as many or as few samples as you want. + * If mono, pass the sample buffer in through left_samples, leave + * right_samples NULL, and make sure num_channels = 1. + * + * GetTitleGain() + * + * will return the recommended dB level change for all samples analyzed + * SINCE THE LAST TIME you called GetTitleGain() OR InitGainAnalysis(). + * + * GetAlbumGain() + * + * will return the recommended dB level change for all samples analyzed + * since InitGainAnalysis() was called and finalized with GetTitleGain(). + * + * Pseudo-code to process an album: + * + * Float_t l_samples [4096]; + * Float_t r_samples [4096]; + * size_t num_samples; + * unsigned int num_songs; + * unsigned int i; + * + * InitGainAnalysis ( 44100 ); + * for ( i = 1; i <= num_songs; i++ ) { + * while ( ( num_samples = getSongSamples ( song[i], left_samples, right_samples ) ) > 0 ) + * AnalyzeSamples ( left_samples, right_samples, num_samples, 2 ); + * fprintf ("Recommended dB change for song %2d: %+6.2f dB\n", i, GetTitleGain() ); + * } + * fprintf ("Recommended dB change for whole album: %+6.2f dB\n", GetAlbumGain() ); + */ + +/* + * So here's the main source of potential code confusion: + * + * The filters applied to the incoming samples are IIR filters, + * meaning they rely on up to number of previous samples + * AND up to number of previous filtered samples. + * + * I set up the AnalyzeSamples routine to minimize memory usage and interface + * complexity. The speed isn't compromised too much (I don't think), but the + * internal complexity is higher than it should be for such a relatively + * simple routine. + * + * Optimization/clarity suggestions are welcome. + */ + +#include +#include +#include +#include + +#include "replaygain_analysis.h" + +typedef unsigned short Uint16_t; +typedef signed short Int16_t; +typedef unsigned int Uint32_t; +typedef signed int Int32_t; + +#define YULE_ORDER 10 +#define BUTTER_ORDER 2 +#define RMS_PERCENTILE 0.95 /* percentile which is louder than the proposed level */ +#define MAX_SAMP_FREQ 48000. /* maximum allowed sample frequency [Hz] */ +#define RMS_WINDOW_TIME 0.050 /* Time slice size [s] */ +#define STEPS_per_dB 100. /* Table entries per dB */ +#define MAX_dB 120. /* Table entries for 0...MAX_dB (normal max. values are 70...80 dB) */ + +#define MAX_ORDER (BUTTER_ORDER > YULE_ORDER ? BUTTER_ORDER : YULE_ORDER) +/* [JEC] the following was originally #defined as: + * (size_t) (MAX_SAMP_FREQ * RMS_WINDOW_TIME) + * but that seemed to fail to take into account the ceil() part of the + * sampleWindow calculation in ResetSampleFrequency(), and was causing + * buffer overflows for 48kHz analysis, hence the +1. + */ +#define MAX_SAMPLES_PER_WINDOW (size_t) (MAX_SAMP_FREQ * RMS_WINDOW_TIME + 1.) /* max. Samples per Time slice */ +#define PINK_REF 64.82 /* 298640883795 */ /* calibration value */ + +static Float_t linprebuf [MAX_ORDER * 2]; +static Float_t* linpre; /* left input samples, with pre-buffer */ +static Float_t lstepbuf [MAX_SAMPLES_PER_WINDOW + MAX_ORDER]; +static Float_t* lstep; /* left "first step" (i.e. post first filter) samples */ +static Float_t loutbuf [MAX_SAMPLES_PER_WINDOW + MAX_ORDER]; +static Float_t* lout; /* left "out" (i.e. post second filter) samples */ +static Float_t rinprebuf [MAX_ORDER * 2]; +static Float_t* rinpre; /* right input samples ... */ +static Float_t rstepbuf [MAX_SAMPLES_PER_WINDOW + MAX_ORDER]; +static Float_t* rstep; +static Float_t routbuf [MAX_SAMPLES_PER_WINDOW + MAX_ORDER]; +static Float_t* rout; +static unsigned int sampleWindow; /* number of samples required to reach number of milliseconds required for RMS window */ +static unsigned long totsamp; +static double lsum; +static double rsum; +static int freqindex; +static Uint32_t A [(size_t)(STEPS_per_dB * MAX_dB)]; +static Uint32_t B [(size_t)(STEPS_per_dB * MAX_dB)]; + +/* for each filter: + [0] 48 kHz, [1] 44.1 kHz, [2] 32 kHz, [3] 24 kHz, [4] 22050 Hz, [5] 16 kHz, [6] 12 kHz, [7] is 11025 Hz, [8] 8 kHz */ + +#ifdef WIN32 +#pragma warning ( disable : 4305 ) +#endif + +static const Float_t AYule [9] [11] = { + { 1., -3.84664617118067, 7.81501653005538,-11.34170355132042, 13.05504219327545,-12.28759895145294, 9.48293806319790, -5.87257861775999, 2.75465861874613, -0.86984376593551, 0.13919314567432 }, + { 1., -3.47845948550071, 6.36317777566148, -8.54751527471874, 9.47693607801280, -8.81498681370155, 6.85401540936998, -4.39470996079559, 2.19611684890774, -0.75104302451432, 0.13149317958808 }, + { 1., -2.37898834973084, 2.84868151156327, -2.64577170229825, 2.23697657451713, -1.67148153367602, 1.00595954808547, -0.45953458054983, 0.16378164858596, -0.05032077717131, 0.02347897407020 }, + { 1., -1.61273165137247, 1.07977492259970, -0.25656257754070, -0.16276719120440, -0.22638893773906, 0.39120800788284, -0.22138138954925, 0.04500235387352, 0.02005851806501, 0.00302439095741 }, + { 1., -1.49858979367799, 0.87350271418188, 0.12205022308084, -0.80774944671438, 0.47854794562326, -0.12453458140019, -0.04067510197014, 0.08333755284107, -0.04237348025746, 0.02977207319925 }, + { 1., -0.62820619233671, 0.29661783706366, -0.37256372942400, 0.00213767857124, -0.42029820170918, 0.22199650564824, 0.00613424350682, 0.06747620744683, 0.05784820375801, 0.03222754072173 }, + { 1., -1.04800335126349, 0.29156311971249, -0.26806001042947, 0.00819999645858, 0.45054734505008, -0.33032403314006, 0.06739368333110, -0.04784254229033, 0.01639907836189, 0.01807364323573 }, + { 1., -0.51035327095184, -0.31863563325245, -0.20256413484477, 0.14728154134330, 0.38952639978999, -0.23313271880868, -0.05246019024463, -0.02505961724053, 0.02442357316099, 0.01818801111503 }, + { 1., -0.25049871956020, -0.43193942311114, -0.03424681017675, -0.04678328784242, 0.26408300200955, 0.15113130533216, -0.17556493366449, -0.18823009262115, 0.05477720428674, 0.04704409688120 } +}; + +static const Float_t BYule [9] [11] = { + { 0.03857599435200, -0.02160367184185, -0.00123395316851, -0.00009291677959, -0.01655260341619, 0.02161526843274, -0.02074045215285, 0.00594298065125, 0.00306428023191, 0.00012025322027, 0.00288463683916 }, + { 0.05418656406430, -0.02911007808948, -0.00848709379851, -0.00851165645469, -0.00834990904936, 0.02245293253339, -0.02596338512915, 0.01624864962975, -0.00240879051584, 0.00674613682247, -0.00187763777362 }, + { 0.15457299681924, -0.09331049056315, -0.06247880153653, 0.02163541888798, -0.05588393329856, 0.04781476674921, 0.00222312597743, 0.03174092540049, -0.01390589421898, 0.00651420667831, -0.00881362733839 }, + { 0.30296907319327, -0.22613988682123, -0.08587323730772, 0.03282930172664, -0.00915702933434, -0.02364141202522, -0.00584456039913, 0.06276101321749, -0.00000828086748, 0.00205861885564, -0.02950134983287 }, + { 0.33642304856132, -0.25572241425570, -0.11828570177555, 0.11921148675203, -0.07834489609479, -0.00469977914380, -0.00589500224440, 0.05724228140351, 0.00832043980773, -0.01635381384540, -0.01760176568150 }, + { 0.44915256608450, -0.14351757464547, -0.22784394429749, -0.01419140100551, 0.04078262797139, -0.12398163381748, 0.04097565135648, 0.10478503600251, -0.01863887810927, -0.03193428438915, 0.00541907748707 }, + { 0.56619470757641, -0.75464456939302, 0.16242137742230, 0.16744243493672, -0.18901604199609, 0.30931782841830, -0.27562961986224, 0.00647310677246, 0.08647503780351, -0.03788984554840, -0.00588215443421 }, + { 0.58100494960553, -0.53174909058578, -0.14289799034253, 0.17520704835522, 0.02377945217615, 0.15558449135573, -0.25344790059353, 0.01628462406333, 0.06920467763959, -0.03721611395801, -0.00749618797172 }, + { 0.53648789255105, -0.42163034350696, -0.00275953611929, 0.04267842219415, -0.10214864179676, 0.14590772289388, -0.02459864859345, -0.11202315195388, -0.04060034127000, 0.04788665548180, -0.02217936801134 } +}; + +static const Float_t AButter [9] [3] = { + { 1., -1.97223372919527, 0.97261396931306 }, + { 1., -1.96977855582618, 0.97022847566350 }, + { 1., -1.95835380975398, 0.95920349965459 }, + { 1., -1.95002759149878, 0.95124613669835 }, + { 1., -1.94561023566527, 0.94705070426118 }, + { 1., -1.92783286977036, 0.93034775234268 }, + { 1., -1.91858953033784, 0.92177618768381 }, + { 1., -1.91542108074780, 0.91885558323625 }, + { 1., -1.88903307939452, 0.89487434461664 } +}; + +static const Float_t BButter [9] [3] = { + { 0.98621192462708, -1.97242384925416, 0.98621192462708 }, + { 0.98500175787242, -1.97000351574484, 0.98500175787242 }, + { 0.97938932735214, -1.95877865470428, 0.97938932735214 }, + { 0.97531843204928, -1.95063686409857, 0.97531843204928 }, + { 0.97316523498161, -1.94633046996323, 0.97316523498161 }, + { 0.96454515552826, -1.92909031105652, 0.96454515552826 }, + { 0.96009142950541, -1.92018285901082, 0.96009142950541 }, + { 0.95856916599601, -1.91713833199203, 0.95856916599601 }, + { 0.94597685600279, -1.89195371200558, 0.94597685600279 } +}; + +#ifdef WIN32 +#pragma warning ( default : 4305 ) +#endif + +/* When calling this procedure, make sure that ip[-order] and op[-order] point to real data! */ + +static void +filter ( const Float_t* input, Float_t* output, size_t nSamples, const Float_t* a, const Float_t* b, size_t order ) +{ + double y; + size_t i; + size_t k; + + for ( i = 0; i < nSamples; i++ ) { + y = input[i] * b[0]; + for ( k = 1; k <= order; k++ ) + y += input[i-k] * b[k] - output[i-k] * a[k]; + output[i] = (Float_t)y; + } +} + +/* returns a INIT_GAIN_ANALYSIS_OK if successful, INIT_GAIN_ANALYSIS_ERROR if not */ + +int +ResetSampleFrequency ( long samplefreq ) { + int i; + + /* zero out initial values */ + for ( i = 0; i < MAX_ORDER; i++ ) + linprebuf[i] = lstepbuf[i] = loutbuf[i] = rinprebuf[i] = rstepbuf[i] = routbuf[i] = 0.; + + switch ( (int)(samplefreq) ) { + case 48000: freqindex = 0; break; + case 44100: freqindex = 1; break; + case 32000: freqindex = 2; break; + case 24000: freqindex = 3; break; + case 22050: freqindex = 4; break; + case 16000: freqindex = 5; break; + case 12000: freqindex = 6; break; + case 11025: freqindex = 7; break; + case 8000: freqindex = 8; break; + default: return INIT_GAIN_ANALYSIS_ERROR; + } + + sampleWindow = (int) ceil (samplefreq * RMS_WINDOW_TIME); + + lsum = 0.; + rsum = 0.; + totsamp = 0; + + memset ( A, 0, sizeof(A) ); + + return INIT_GAIN_ANALYSIS_OK; +} + +int +InitGainAnalysis ( long samplefreq ) +{ + if (ResetSampleFrequency(samplefreq) != INIT_GAIN_ANALYSIS_OK) { + return INIT_GAIN_ANALYSIS_ERROR; + } + + linpre = linprebuf + MAX_ORDER; + rinpre = rinprebuf + MAX_ORDER; + lstep = lstepbuf + MAX_ORDER; + rstep = rstepbuf + MAX_ORDER; + lout = loutbuf + MAX_ORDER; + rout = routbuf + MAX_ORDER; + + memset ( B, 0, sizeof(B) ); + + return INIT_GAIN_ANALYSIS_OK; +} + +/* returns GAIN_ANALYSIS_OK if successful, GAIN_ANALYSIS_ERROR if not */ + +int +AnalyzeSamples ( const Float_t* left_samples, const Float_t* right_samples, size_t num_samples, int num_channels ) +{ + const Float_t* curleft; + const Float_t* curright; + long batchsamples; + long cursamples; + long cursamplepos; + int i; + + if ( num_samples == 0 ) + return GAIN_ANALYSIS_OK; + + cursamplepos = 0; + batchsamples = num_samples; + + switch ( num_channels) { + case 1: right_samples = left_samples; + case 2: break; + default: return GAIN_ANALYSIS_ERROR; + } + + if ( num_samples < MAX_ORDER ) { + memcpy ( linprebuf + MAX_ORDER, left_samples , num_samples * sizeof(Float_t) ); + memcpy ( rinprebuf + MAX_ORDER, right_samples, num_samples * sizeof(Float_t) ); + } + else { + memcpy ( linprebuf + MAX_ORDER, left_samples, MAX_ORDER * sizeof(Float_t) ); + memcpy ( rinprebuf + MAX_ORDER, right_samples, MAX_ORDER * sizeof(Float_t) ); + } + + while ( batchsamples > 0 ) { + cursamples = batchsamples > (long)(sampleWindow-totsamp) ? (long)(sampleWindow - totsamp) : batchsamples; + if ( cursamplepos < MAX_ORDER ) { + curleft = linpre+cursamplepos; + curright = rinpre+cursamplepos; + if (cursamples > MAX_ORDER - cursamplepos ) + cursamples = MAX_ORDER - cursamplepos; + } + else { + curleft = left_samples + cursamplepos; + curright = right_samples + cursamplepos; + } + + filter ( curleft , lstep + totsamp, cursamples, AYule[freqindex], BYule[freqindex], YULE_ORDER ); + filter ( curright, rstep + totsamp, cursamples, AYule[freqindex], BYule[freqindex], YULE_ORDER ); + + filter ( lstep + totsamp, lout + totsamp, cursamples, AButter[freqindex], BButter[freqindex], BUTTER_ORDER ); + filter ( rstep + totsamp, rout + totsamp, cursamples, AButter[freqindex], BButter[freqindex], BUTTER_ORDER ); + + for ( i = 0; i < cursamples; i++ ) { /* Get the squared values */ + lsum += lout [totsamp+i] * lout [totsamp+i]; + rsum += rout [totsamp+i] * rout [totsamp+i]; + } + + batchsamples -= cursamples; + cursamplepos += cursamples; + totsamp += cursamples; + if ( totsamp == sampleWindow ) { /* Get the Root Mean Square (RMS) for this set of samples */ + double val = STEPS_per_dB * 10. * log10 ( (lsum+rsum) / totsamp * 0.5 + 1.e-37 ); + int ival = (int) val; + if ( ival < 0 ) ival = 0; + if ( ival >= (int)(sizeof(A)/sizeof(*A)) ) ival = (int)(sizeof(A)/sizeof(*A)) - 1; + A [ival]++; + lsum = rsum = 0.; + memmove ( loutbuf , loutbuf + totsamp, MAX_ORDER * sizeof(Float_t) ); + memmove ( routbuf , routbuf + totsamp, MAX_ORDER * sizeof(Float_t) ); + memmove ( lstepbuf, lstepbuf + totsamp, MAX_ORDER * sizeof(Float_t) ); + memmove ( rstepbuf, rstepbuf + totsamp, MAX_ORDER * sizeof(Float_t) ); + totsamp = 0; + } + if ( totsamp > sampleWindow ) /* somehow I really screwed up: Error in programming! Contact author about totsamp > sampleWindow */ + return GAIN_ANALYSIS_ERROR; + } + if ( num_samples < MAX_ORDER ) { + memmove ( linprebuf, linprebuf + num_samples, (MAX_ORDER-num_samples) * sizeof(Float_t) ); + memmove ( rinprebuf, rinprebuf + num_samples, (MAX_ORDER-num_samples) * sizeof(Float_t) ); + memcpy ( linprebuf + MAX_ORDER - num_samples, left_samples, num_samples * sizeof(Float_t) ); + memcpy ( rinprebuf + MAX_ORDER - num_samples, right_samples, num_samples * sizeof(Float_t) ); + } + else { + memcpy ( linprebuf, left_samples + num_samples - MAX_ORDER, MAX_ORDER * sizeof(Float_t) ); + memcpy ( rinprebuf, right_samples + num_samples - MAX_ORDER, MAX_ORDER * sizeof(Float_t) ); + } + + return GAIN_ANALYSIS_OK; +} + + +static Float_t +analyzeResult ( Uint32_t* Array, size_t len ) +{ + Uint32_t elems; + Int32_t upper; + size_t i; + + elems = 0; + for ( i = 0; i < len; i++ ) + elems += Array[i]; + if ( elems == 0 ) + return GAIN_NOT_ENOUGH_SAMPLES; + + upper = (Int32_t) ceil (elems * (1. - RMS_PERCENTILE)); + for ( i = len; i-- > 0; ) { + if ( (upper -= Array[i]) <= 0 ) + break; + } + + return (Float_t) ((Float_t)PINK_REF - (Float_t)i / (Float_t)STEPS_per_dB); +} + + +Float_t +GetTitleGain ( void ) +{ + Float_t retval; + unsigned int i; + + retval = analyzeResult ( A, sizeof(A)/sizeof(*A) ); + + for ( i = 0; i < sizeof(A)/sizeof(*A); i++ ) { + B[i] += A[i]; + A[i] = 0; + } + + for ( i = 0; i < MAX_ORDER; i++ ) + linprebuf[i] = lstepbuf[i] = loutbuf[i] = rinprebuf[i] = rstepbuf[i] = routbuf[i] = 0.f; + + totsamp = 0; + lsum = rsum = 0.; + return retval; +} + + +Float_t +GetAlbumGain ( void ) +{ + return analyzeResult ( B, sizeof(B)/sizeof(*B) ); +} + +/* end of replaygain_analysis.c */ diff --git a/Libraries/FLAC/Files/src/share/replaygain_analysis/replaygain_analysis_static.dsp b/Libraries/FLAC/Files/src/share/replaygain_analysis/replaygain_analysis_static.dsp new file mode 100644 index 000000000..53cdde5a3 --- /dev/null +++ b/Libraries/FLAC/Files/src/share/replaygain_analysis/replaygain_analysis_static.dsp @@ -0,0 +1,108 @@ +# Microsoft Developer Studio Project File - Name="replaygain_analysis_static" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Static Library" 0x0104 + +CFG=replaygain_analysis_static - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "replaygain_analysis_static.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "replaygain_analysis_static.mak" CFG="replaygain_analysis_static - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "replaygain_analysis_static - Win32 Release" (based on "Win32 (x86) Static Library") +!MESSAGE "replaygain_analysis_static - Win32 Debug" (based on "Win32 (x86) Static Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "replaygain_analysis" +# PROP Scc_LocalPath "..\..\.." +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "replaygain_analysis_static - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "..\..\..\obj\release\lib" +# PROP Intermediate_Dir "Release_static" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /Op /I ".\include" /I "..\..\..\include\share" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo /nodefaultlib + +!ELSEIF "$(CFG)" == "replaygain_analysis_static - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "..\..\..\obj\debug\lib" +# PROP Intermediate_Dir "Debug_static" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".\include" /I "..\..\..\include\share" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo /nodefaultlib + +!ENDIF + +# Begin Target + +# Name "replaygain_analysis_static - Win32 Release" +# Name "replaygain_analysis_static - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "c" +# Begin Source File + +SOURCE=.\replaygain_analysis.c +# End Source File +# End Group +# Begin Group "Private Header Files" + +# PROP Default_Filter "" +# End Group +# Begin Group "Protected Header Files" + +# PROP Default_Filter "" +# End Group +# Begin Group "Public Header Files" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=..\..\..\include\share\replaygain_analysis.h +# End Source File +# End Group +# End Target +# End Project diff --git a/Libraries/FLAC/Files/src/share/replaygain_synthesis/Makefile.am b/Libraries/FLAC/Files/src/share/replaygain_synthesis/Makefile.am new file mode 100644 index 000000000..f94d67224 --- /dev/null +++ b/Libraries/FLAC/Files/src/share/replaygain_synthesis/Makefile.am @@ -0,0 +1,21 @@ +## Process this file with automake to produce Makefile.in + +AUTOMAKE_OPTIONS = foreign + +SUBDIRS = include . + +INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/include/share + +noinst_LTLIBRARIES = libreplaygain_synthesis.la + +libreplaygain_synthesis_la_SOURCES = replaygain_synthesis.c + +EXTRA_DIST = \ + Makefile.lite \ + replaygain_synthesis_static.dsp + +debug: + $(MAKE) all CFLAGS="@DEBUG@" + +profile: + $(MAKE) all CFLAGS="@PROFILE@" diff --git a/Libraries/FLAC/Files/src/share/replaygain_synthesis/Makefile.in b/Libraries/FLAC/Files/src/share/replaygain_synthesis/Makefile.in new file mode 100644 index 000000000..2cfbd1b1c --- /dev/null +++ b/Libraries/FLAC/Files/src/share/replaygain_synthesis/Makefile.in @@ -0,0 +1,596 @@ +# Makefile.in generated by automake 1.8.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +SOURCES = $(libreplaygain_synthesis_la_SOURCES) + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../../.. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_triplet = @host@ +subdir = src/share/replaygain_synthesis +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(mkdir_p) +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +libreplaygain_synthesis_la_LIBADD = +am_libreplaygain_synthesis_la_OBJECTS = replaygain_synthesis.lo +libreplaygain_synthesis_la_OBJECTS = \ + $(am_libreplaygain_synthesis_la_OBJECTS) +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/replaygain_synthesis.Plo +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(libreplaygain_synthesis_la_SOURCES) +DIST_SOURCES = $(libreplaygain_synthesis_la_SOURCES) +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-exec-recursive install-info-recursive \ + install-recursive installcheck-recursive installdirs-recursive \ + pdf-recursive ps-recursive uninstall-info-recursive \ + uninstall-recursive +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCAS = @CCAS@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEBUG_FALSE = @DEBUG_FALSE@ +DEBUG_TRUE = @DEBUG_TRUE@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DOCBOOK_TO_MAN = @DOCBOOK_TO_MAN@ +DOXYGEN = @DOXYGEN@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FLaC__CPU_IA32_FALSE = @FLaC__CPU_IA32_FALSE@ +FLaC__CPU_IA32_TRUE = @FLaC__CPU_IA32_TRUE@ +FLaC__CPU_PPC_FALSE = @FLaC__CPU_PPC_FALSE@ +FLaC__CPU_PPC_TRUE = @FLaC__CPU_PPC_TRUE@ +FLaC__CPU_SPARC_FALSE = @FLaC__CPU_SPARC_FALSE@ +FLaC__CPU_SPARC_TRUE = @FLaC__CPU_SPARC_TRUE@ +FLaC__EXHAUSTIVE_TESTS_FALSE = @FLaC__EXHAUSTIVE_TESTS_FALSE@ +FLaC__EXHAUSTIVE_TESTS_TRUE = @FLaC__EXHAUSTIVE_TESTS_TRUE@ +FLaC__HAS_AS_FALSE = @FLaC__HAS_AS_FALSE@ +FLaC__HAS_AS_TRUE = @FLaC__HAS_AS_TRUE@ +FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@ +FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@ +FLaC__HAS_DOCBOOK_TO_MAN_FALSE = @FLaC__HAS_DOCBOOK_TO_MAN_FALSE@ +FLaC__HAS_DOCBOOK_TO_MAN_TRUE = @FLaC__HAS_DOCBOOK_TO_MAN_TRUE@ +FLaC__HAS_DOXYGEN_FALSE = @FLaC__HAS_DOXYGEN_FALSE@ +FLaC__HAS_DOXYGEN_TRUE = @FLaC__HAS_DOXYGEN_TRUE@ +FLaC__HAS_GAS_FALSE = @FLaC__HAS_GAS_FALSE@ +FLaC__HAS_GAS_TRUE = @FLaC__HAS_GAS_TRUE@ +FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@ +FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@ +FLaC__HAS_NASM_FALSE = @FLaC__HAS_NASM_FALSE@ +FLaC__HAS_NASM_TRUE = @FLaC__HAS_NASM_TRUE@ +FLaC__HAS_OGG_FALSE = @FLaC__HAS_OGG_FALSE@ +FLaC__HAS_OGG_TRUE = @FLaC__HAS_OGG_TRUE@ +FLaC__HAS_XMMS_FALSE = @FLaC__HAS_XMMS_FALSE@ +FLaC__HAS_XMMS_TRUE = @FLaC__HAS_XMMS_TRUE@ +FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE@ +FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE@ +FLaC__NO_ASM_FALSE = @FLaC__NO_ASM_FALSE@ +FLaC__NO_ASM_TRUE = @FLaC__NO_ASM_TRUE@ +FLaC__SSE_OS_FALSE = @FLaC__SSE_OS_FALSE@ +FLaC__SSE_OS_TRUE = @FLaC__SSE_OS_TRUE@ +FLaC__SYS_DARWIN_FALSE = @FLaC__SYS_DARWIN_FALSE@ +FLaC__SYS_DARWIN_TRUE = @FLaC__SYS_DARWIN_TRUE@ +FLaC__SYS_LINUX_FALSE = @FLaC__SYS_LINUX_FALSE@ +FLaC__SYS_LINUX_TRUE = @FLaC__SYS_LINUX_TRUE@ +FLaC__USE_3DNOW_FALSE = @FLaC__USE_3DNOW_FALSE@ +FLaC__USE_3DNOW_TRUE = @FLaC__USE_3DNOW_TRUE@ +FLaC__USE_ALTIVEC_FALSE = @FLaC__USE_ALTIVEC_FALSE@ +FLaC__USE_ALTIVEC_TRUE = @FLaC__USE_ALTIVEC_TRUE@ +FLaC__VALGRIND_TESTING_FALSE = @FLaC__VALGRIND_TESTING_FALSE@ +FLaC__VALGRIND_TESTING_TRUE = @FLaC__VALGRIND_TESTING_TRUE@ +GAS = @GAS@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +NASM = @NASM@ +OBJEXT = @OBJEXT@ +OBJ_FORMAT = @OBJ_FORMAT@ +OGG_CFLAGS = @OGG_CFLAGS@ +OGG_LIBS = @OGG_LIBS@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +XMMS_CFLAGS = @XMMS_CFLAGS@ +XMMS_CONFIG = @XMMS_CONFIG@ +XMMS_DATA_DIR = @XMMS_DATA_DIR@ +XMMS_EFFECT_PLUGIN_DIR = @XMMS_EFFECT_PLUGIN_DIR@ +XMMS_GENERAL_PLUGIN_DIR = @XMMS_GENERAL_PLUGIN_DIR@ +XMMS_INPUT_PLUGIN_DIR = @XMMS_INPUT_PLUGIN_DIR@ +XMMS_LIBS = @XMMS_LIBS@ +XMMS_OUTPUT_PLUGIN_DIR = @XMMS_OUTPUT_PLUGIN_DIR@ +XMMS_PLUGIN_DIR = @XMMS_PLUGIN_DIR@ +XMMS_VERSION = @XMMS_VERSION@ +XMMS_VISUALIZATION_PLUGIN_DIR = @XMMS_VISUALIZATION_PLUGIN_DIR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +AUTOMAKE_OPTIONS = foreign +SUBDIRS = include . +INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/include/share +noinst_LTLIBRARIES = libreplaygain_synthesis.la +libreplaygain_synthesis_la_SOURCES = replaygain_synthesis.c +EXTRA_DIST = \ + Makefile.lite \ + replaygain_synthesis_static.dsp + +all: all-recursive + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/share/replaygain_synthesis/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/share/replaygain_synthesis/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libreplaygain_synthesis.la: $(libreplaygain_synthesis_la_OBJECTS) $(libreplaygain_synthesis_la_DEPENDENCIES) + $(LINK) $(libreplaygain_synthesis_la_LDFLAGS) $(libreplaygain_synthesis_la_OBJECTS) $(libreplaygain_synthesis_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/replaygain_synthesis.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || mkdir "$(distdir)/$$subdir" \ + || exit 1; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="../$(top_distdir)" \ + distdir="../$(distdir)/$$subdir" \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile $(LTLIBRARIES) +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-recursive + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-libtool distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-recursive + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-info-am + +uninstall-info: uninstall-info-recursive + +.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \ + clean clean-generic clean-libtool clean-noinstLTLIBRARIES \ + clean-recursive ctags ctags-recursive distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-recursive distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-strip installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic maintainer-clean-recursive \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool mostlyclean-recursive pdf pdf-am ps ps-am \ + tags tags-recursive uninstall uninstall-am uninstall-info-am + + +debug: + $(MAKE) all CFLAGS="@DEBUG@" + +profile: + $(MAKE) all CFLAGS="@PROFILE@" +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/Libraries/FLAC/Files/src/share/replaygain_synthesis/Makefile.lite b/Libraries/FLAC/Files/src/share/replaygain_synthesis/Makefile.lite new file mode 100644 index 000000000..e58e70882 --- /dev/null +++ b/Libraries/FLAC/Files/src/share/replaygain_synthesis/Makefile.lite @@ -0,0 +1,15 @@ +# +# GNU makefile +# + +topdir = ../../.. + +LIB_NAME = libreplaygain_synthesis +INCLUDES = -I./include -I$(topdir)/include -I$(topdir)/include/share + +SRCS_C = \ + replaygain_synthesis.c + +include $(topdir)/build/lib.mk + +# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/Libraries/FLAC/Files/src/share/replaygain_synthesis/include/Makefile.am b/Libraries/FLAC/Files/src/share/replaygain_synthesis/include/Makefile.am new file mode 100644 index 000000000..a8525c056 --- /dev/null +++ b/Libraries/FLAC/Files/src/share/replaygain_synthesis/include/Makefile.am @@ -0,0 +1,18 @@ +# replaygain_synthesis - Routines for applying ReplayGain to a signal +# Copyright (C) 2002,2003,2004,2005 Josh Coalson +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +SUBDIRS = private diff --git a/Libraries/FLAC/Files/src/share/replaygain_synthesis/include/Makefile.in b/Libraries/FLAC/Files/src/share/replaygain_synthesis/include/Makefile.in new file mode 100644 index 000000000..9296cc156 --- /dev/null +++ b/Libraries/FLAC/Files/src/share/replaygain_synthesis/include/Makefile.in @@ -0,0 +1,530 @@ +# Makefile.in generated by automake 1.8.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# replaygain_synthesis - Routines for applying ReplayGain to a signal +# Copyright (C) 2002,2003,2004,2005 Josh Coalson +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../../../.. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_triplet = @host@ +subdir = src/share/replaygain_synthesis/include +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(mkdir_p) +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-exec-recursive install-info-recursive \ + install-recursive installcheck-recursive installdirs-recursive \ + pdf-recursive ps-recursive uninstall-info-recursive \ + uninstall-recursive +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCAS = @CCAS@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEBUG_FALSE = @DEBUG_FALSE@ +DEBUG_TRUE = @DEBUG_TRUE@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DOCBOOK_TO_MAN = @DOCBOOK_TO_MAN@ +DOXYGEN = @DOXYGEN@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FLaC__CPU_IA32_FALSE = @FLaC__CPU_IA32_FALSE@ +FLaC__CPU_IA32_TRUE = @FLaC__CPU_IA32_TRUE@ +FLaC__CPU_PPC_FALSE = @FLaC__CPU_PPC_FALSE@ +FLaC__CPU_PPC_TRUE = @FLaC__CPU_PPC_TRUE@ +FLaC__CPU_SPARC_FALSE = @FLaC__CPU_SPARC_FALSE@ +FLaC__CPU_SPARC_TRUE = @FLaC__CPU_SPARC_TRUE@ +FLaC__EXHAUSTIVE_TESTS_FALSE = @FLaC__EXHAUSTIVE_TESTS_FALSE@ +FLaC__EXHAUSTIVE_TESTS_TRUE = @FLaC__EXHAUSTIVE_TESTS_TRUE@ +FLaC__HAS_AS_FALSE = @FLaC__HAS_AS_FALSE@ +FLaC__HAS_AS_TRUE = @FLaC__HAS_AS_TRUE@ +FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@ +FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@ +FLaC__HAS_DOCBOOK_TO_MAN_FALSE = @FLaC__HAS_DOCBOOK_TO_MAN_FALSE@ +FLaC__HAS_DOCBOOK_TO_MAN_TRUE = @FLaC__HAS_DOCBOOK_TO_MAN_TRUE@ +FLaC__HAS_DOXYGEN_FALSE = @FLaC__HAS_DOXYGEN_FALSE@ +FLaC__HAS_DOXYGEN_TRUE = @FLaC__HAS_DOXYGEN_TRUE@ +FLaC__HAS_GAS_FALSE = @FLaC__HAS_GAS_FALSE@ +FLaC__HAS_GAS_TRUE = @FLaC__HAS_GAS_TRUE@ +FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@ +FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@ +FLaC__HAS_NASM_FALSE = @FLaC__HAS_NASM_FALSE@ +FLaC__HAS_NASM_TRUE = @FLaC__HAS_NASM_TRUE@ +FLaC__HAS_OGG_FALSE = @FLaC__HAS_OGG_FALSE@ +FLaC__HAS_OGG_TRUE = @FLaC__HAS_OGG_TRUE@ +FLaC__HAS_XMMS_FALSE = @FLaC__HAS_XMMS_FALSE@ +FLaC__HAS_XMMS_TRUE = @FLaC__HAS_XMMS_TRUE@ +FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE@ +FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE@ +FLaC__NO_ASM_FALSE = @FLaC__NO_ASM_FALSE@ +FLaC__NO_ASM_TRUE = @FLaC__NO_ASM_TRUE@ +FLaC__SSE_OS_FALSE = @FLaC__SSE_OS_FALSE@ +FLaC__SSE_OS_TRUE = @FLaC__SSE_OS_TRUE@ +FLaC__SYS_DARWIN_FALSE = @FLaC__SYS_DARWIN_FALSE@ +FLaC__SYS_DARWIN_TRUE = @FLaC__SYS_DARWIN_TRUE@ +FLaC__SYS_LINUX_FALSE = @FLaC__SYS_LINUX_FALSE@ +FLaC__SYS_LINUX_TRUE = @FLaC__SYS_LINUX_TRUE@ +FLaC__USE_3DNOW_FALSE = @FLaC__USE_3DNOW_FALSE@ +FLaC__USE_3DNOW_TRUE = @FLaC__USE_3DNOW_TRUE@ +FLaC__USE_ALTIVEC_FALSE = @FLaC__USE_ALTIVEC_FALSE@ +FLaC__USE_ALTIVEC_TRUE = @FLaC__USE_ALTIVEC_TRUE@ +FLaC__VALGRIND_TESTING_FALSE = @FLaC__VALGRIND_TESTING_FALSE@ +FLaC__VALGRIND_TESTING_TRUE = @FLaC__VALGRIND_TESTING_TRUE@ +GAS = @GAS@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +NASM = @NASM@ +OBJEXT = @OBJEXT@ +OBJ_FORMAT = @OBJ_FORMAT@ +OGG_CFLAGS = @OGG_CFLAGS@ +OGG_LIBS = @OGG_LIBS@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +XMMS_CFLAGS = @XMMS_CFLAGS@ +XMMS_CONFIG = @XMMS_CONFIG@ +XMMS_DATA_DIR = @XMMS_DATA_DIR@ +XMMS_EFFECT_PLUGIN_DIR = @XMMS_EFFECT_PLUGIN_DIR@ +XMMS_GENERAL_PLUGIN_DIR = @XMMS_GENERAL_PLUGIN_DIR@ +XMMS_INPUT_PLUGIN_DIR = @XMMS_INPUT_PLUGIN_DIR@ +XMMS_LIBS = @XMMS_LIBS@ +XMMS_OUTPUT_PLUGIN_DIR = @XMMS_OUTPUT_PLUGIN_DIR@ +XMMS_PLUGIN_DIR = @XMMS_PLUGIN_DIR@ +XMMS_VERSION = @XMMS_VERSION@ +XMMS_VISUALIZATION_PLUGIN_DIR = @XMMS_VISUALIZATION_PLUGIN_DIR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +SUBDIRS = private +all: all-recursive + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/share/replaygain_synthesis/include/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/share/replaygain_synthesis/include/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || mkdir "$(distdir)/$$subdir" \ + || exit 1; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="../$(top_distdir)" \ + distdir="../$(distdir)/$$subdir" \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-libtool \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-recursive + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-info-am + +uninstall-info: uninstall-info-recursive + +.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \ + clean clean-generic clean-libtool clean-recursive ctags \ + ctags-recursive distclean distclean-generic distclean-libtool \ + distclean-recursive distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-strip installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic maintainer-clean-recursive \ + mostlyclean mostlyclean-generic mostlyclean-libtool \ + mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \ + uninstall uninstall-am uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/Libraries/FLAC/Files/src/share/replaygain_synthesis/include/private/Makefile.am b/Libraries/FLAC/Files/src/share/replaygain_synthesis/include/private/Makefile.am new file mode 100644 index 000000000..62f145d0f --- /dev/null +++ b/Libraries/FLAC/Files/src/share/replaygain_synthesis/include/private/Makefile.am @@ -0,0 +1,19 @@ +# replaygain_synthesis - Routines for applying ReplayGain to a signal +# Copyright (C) 2002,2003,2004,2005 Josh Coalson +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +noinst_HEADERS = \ + fast_float_math_hack.h diff --git a/Libraries/FLAC/Files/src/share/replaygain_synthesis/include/private/Makefile.in b/Libraries/FLAC/Files/src/share/replaygain_synthesis/include/private/Makefile.in new file mode 100644 index 000000000..75d35db70 --- /dev/null +++ b/Libraries/FLAC/Files/src/share/replaygain_synthesis/include/private/Makefile.in @@ -0,0 +1,438 @@ +# Makefile.in generated by automake 1.8.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# replaygain_synthesis - Routines for applying ReplayGain to a signal +# Copyright (C) 2002,2003,2004,2005 Josh Coalson +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../../../../.. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_triplet = @host@ +subdir = src/share/replaygain_synthesis/include/private +DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(mkdir_p) +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +HEADERS = $(noinst_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCAS = @CCAS@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEBUG_FALSE = @DEBUG_FALSE@ +DEBUG_TRUE = @DEBUG_TRUE@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DOCBOOK_TO_MAN = @DOCBOOK_TO_MAN@ +DOXYGEN = @DOXYGEN@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FLaC__CPU_IA32_FALSE = @FLaC__CPU_IA32_FALSE@ +FLaC__CPU_IA32_TRUE = @FLaC__CPU_IA32_TRUE@ +FLaC__CPU_PPC_FALSE = @FLaC__CPU_PPC_FALSE@ +FLaC__CPU_PPC_TRUE = @FLaC__CPU_PPC_TRUE@ +FLaC__CPU_SPARC_FALSE = @FLaC__CPU_SPARC_FALSE@ +FLaC__CPU_SPARC_TRUE = @FLaC__CPU_SPARC_TRUE@ +FLaC__EXHAUSTIVE_TESTS_FALSE = @FLaC__EXHAUSTIVE_TESTS_FALSE@ +FLaC__EXHAUSTIVE_TESTS_TRUE = @FLaC__EXHAUSTIVE_TESTS_TRUE@ +FLaC__HAS_AS_FALSE = @FLaC__HAS_AS_FALSE@ +FLaC__HAS_AS_TRUE = @FLaC__HAS_AS_TRUE@ +FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@ +FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@ +FLaC__HAS_DOCBOOK_TO_MAN_FALSE = @FLaC__HAS_DOCBOOK_TO_MAN_FALSE@ +FLaC__HAS_DOCBOOK_TO_MAN_TRUE = @FLaC__HAS_DOCBOOK_TO_MAN_TRUE@ +FLaC__HAS_DOXYGEN_FALSE = @FLaC__HAS_DOXYGEN_FALSE@ +FLaC__HAS_DOXYGEN_TRUE = @FLaC__HAS_DOXYGEN_TRUE@ +FLaC__HAS_GAS_FALSE = @FLaC__HAS_GAS_FALSE@ +FLaC__HAS_GAS_TRUE = @FLaC__HAS_GAS_TRUE@ +FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@ +FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@ +FLaC__HAS_NASM_FALSE = @FLaC__HAS_NASM_FALSE@ +FLaC__HAS_NASM_TRUE = @FLaC__HAS_NASM_TRUE@ +FLaC__HAS_OGG_FALSE = @FLaC__HAS_OGG_FALSE@ +FLaC__HAS_OGG_TRUE = @FLaC__HAS_OGG_TRUE@ +FLaC__HAS_XMMS_FALSE = @FLaC__HAS_XMMS_FALSE@ +FLaC__HAS_XMMS_TRUE = @FLaC__HAS_XMMS_TRUE@ +FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE@ +FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE@ +FLaC__NO_ASM_FALSE = @FLaC__NO_ASM_FALSE@ +FLaC__NO_ASM_TRUE = @FLaC__NO_ASM_TRUE@ +FLaC__SSE_OS_FALSE = @FLaC__SSE_OS_FALSE@ +FLaC__SSE_OS_TRUE = @FLaC__SSE_OS_TRUE@ +FLaC__SYS_DARWIN_FALSE = @FLaC__SYS_DARWIN_FALSE@ +FLaC__SYS_DARWIN_TRUE = @FLaC__SYS_DARWIN_TRUE@ +FLaC__SYS_LINUX_FALSE = @FLaC__SYS_LINUX_FALSE@ +FLaC__SYS_LINUX_TRUE = @FLaC__SYS_LINUX_TRUE@ +FLaC__USE_3DNOW_FALSE = @FLaC__USE_3DNOW_FALSE@ +FLaC__USE_3DNOW_TRUE = @FLaC__USE_3DNOW_TRUE@ +FLaC__USE_ALTIVEC_FALSE = @FLaC__USE_ALTIVEC_FALSE@ +FLaC__USE_ALTIVEC_TRUE = @FLaC__USE_ALTIVEC_TRUE@ +FLaC__VALGRIND_TESTING_FALSE = @FLaC__VALGRIND_TESTING_FALSE@ +FLaC__VALGRIND_TESTING_TRUE = @FLaC__VALGRIND_TESTING_TRUE@ +GAS = @GAS@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +NASM = @NASM@ +OBJEXT = @OBJEXT@ +OBJ_FORMAT = @OBJ_FORMAT@ +OGG_CFLAGS = @OGG_CFLAGS@ +OGG_LIBS = @OGG_LIBS@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +XMMS_CFLAGS = @XMMS_CFLAGS@ +XMMS_CONFIG = @XMMS_CONFIG@ +XMMS_DATA_DIR = @XMMS_DATA_DIR@ +XMMS_EFFECT_PLUGIN_DIR = @XMMS_EFFECT_PLUGIN_DIR@ +XMMS_GENERAL_PLUGIN_DIR = @XMMS_GENERAL_PLUGIN_DIR@ +XMMS_INPUT_PLUGIN_DIR = @XMMS_INPUT_PLUGIN_DIR@ +XMMS_LIBS = @XMMS_LIBS@ +XMMS_OUTPUT_PLUGIN_DIR = @XMMS_OUTPUT_PLUGIN_DIR@ +XMMS_PLUGIN_DIR = @XMMS_PLUGIN_DIR@ +XMMS_VERSION = @XMMS_VERSION@ +XMMS_VISUALIZATION_PLUGIN_DIR = @XMMS_VISUALIZATION_PLUGIN_DIR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +noinst_HEADERS = \ + fast_float_math_hack.h + +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/share/replaygain_synthesis/include/private/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/share/replaygain_synthesis/include/private/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(HEADERS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-libtool \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool ctags distclean distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ + uninstall-am uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/Libraries/FLAC/Files/src/share/replaygain_synthesis/include/private/fast_float_math_hack.h b/Libraries/FLAC/Files/src/share/replaygain_synthesis/include/private/fast_float_math_hack.h new file mode 100644 index 000000000..d8608fc44 --- /dev/null +++ b/Libraries/FLAC/Files/src/share/replaygain_synthesis/include/private/fast_float_math_hack.h @@ -0,0 +1,39 @@ +# ifdef __ICL /* only Intel C compiler has fmath ??? */ + + #include + +/* Nearest integer, absolute value, etc. */ + + #define ceil ceilf + #define fabs fabsf + #define floor floorf + #define fmod fmodf + #define rint rintf + #define hypot hypotf + +/* Power functions */ + + #define pow powf + #define sqrt sqrtf + +/* Exponential and logarithmic functions */ + + #define exp expf + #define log logf + #define log10 log10f + +/* Trigonometric functions */ + + #define acos acosf + #define asin asinf + #define atan atanf + #define cos cosf + #define sin sinf + #define tan tanf + +/* Hyperbolic functions */ + #define cosh coshf + #define sinh sinhf + #define tanh tanhf + +# endif diff --git a/Libraries/FLAC/Files/src/share/replaygain_synthesis/replaygain_synthesis.c b/Libraries/FLAC/Files/src/share/replaygain_synthesis/replaygain_synthesis.c new file mode 100644 index 000000000..2c4a5700c --- /dev/null +++ b/Libraries/FLAC/Files/src/share/replaygain_synthesis/replaygain_synthesis.c @@ -0,0 +1,465 @@ +/* replaygain_synthesis - Routines for applying ReplayGain to a signal + * Copyright (C) 2002,2003,2004,2005 Josh Coalson + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +/* + * This is an aggregation of pieces of code from John Edwards' WaveGain + * program. Mostly cosmetic changes were made; otherwise, the dithering + * code is almost untouched and the gain processing was converted from + * processing a whole file to processing chunks of samples. + * + * The original copyright notices for WaveGain's dither.c and wavegain.c + * appear below: + */ +/* + * (c) 2002 John Edwards + * mostly lifted from work by Frank Klemm + * random functions for dithering. + */ +/* + * Copyright (C) 2002 John Edwards + * Additional code by Magnus Holmgren and Gian-Carlo Pascutto + */ + +#include /* for memset() */ +#include +#include "private/fast_float_math_hack.h" +#include "replaygain_synthesis.h" +#include "FLAC/assert.h" + +#if defined _MSC_VER +#define FLAC__INLINE __inline +#else +#define FLAC__INLINE +#endif + +/* adjust for compilers that can't understand using LL suffix for int64_t literals */ +#ifdef _MSC_VER +#define FLAC__I64L(x) x +#else +#define FLAC__I64L(x) x##LL +#endif + + +/* + * the following is based on parts of dither.c + */ + + +/* + * This is a simple random number generator with good quality for audio purposes. + * It consists of two polycounters with opposite rotation direction and different + * periods. The periods are coprime, so the total period is the product of both. + * + * ------------------------------------------------------------------------------------------------- + * +-> |31:30:29:28:27:26:25:24:23:22:21:20:19:18:17:16:15:14:13:12:11:10: 9: 8: 7: 6: 5: 4: 3: 2: 1: 0| + * | ------------------------------------------------------------------------------------------------- + * | | | | | | | + * | +--+--+--+-XOR-+--------+ + * | | + * +--------------------------------------------------------------------------------------+ + * + * ------------------------------------------------------------------------------------------------- + * |31:30:29:28:27:26:25:24:23:22:21:20:19:18:17:16:15:14:13:12:11:10: 9: 8: 7: 6: 5: 4: 3: 2: 1: 0| <-+ + * ------------------------------------------------------------------------------------------------- | + * | | | | | + * +--+----XOR----+--+ | + * | | + * +----------------------------------------------------------------------------------------+ + * + * + * The first has an period of 3*5*17*257*65537, the second of 7*47*73*178481, + * which gives a period of 18.410.713.077.675.721.215. The result is the + * XORed values of both generators. + */ + +static unsigned int random_int_() +{ + static const unsigned char parity_[256] = { + 0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1, + 1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0, + 1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0, + 0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1, + 1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0, + 0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1, + 0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1, + 1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0 + }; + static unsigned int r1_ = 1; + static unsigned int r2_ = 1; + + unsigned int t1, t2, t3, t4; + + /* Parity calculation is done via table lookup, this is also available + * on CPUs without parity, can be implemented in C and avoid unpredictable + * jumps and slow rotate through the carry flag operations. + */ + t3 = t1 = r1_; t4 = t2 = r2_; + t1 &= 0xF5; t2 >>= 25; + t1 = parity_[t1]; t2 &= 0x63; + t1 <<= 31; t2 = parity_[t2]; + + return (r1_ = (t3 >> 1) | t1 ) ^ (r2_ = (t4 + t4) | t2 ); +} + +/* gives a equal distributed random number */ +/* between -2^31*mult and +2^31*mult */ +static double random_equi_(double mult) +{ + return mult * (int) random_int_(); +} + +/* gives a triangular distributed random number */ +/* between -2^32*mult and +2^32*mult */ +static double random_triangular_(double mult) +{ + return mult * ( (double) (int) random_int_() + (double) (int) random_int_() ); +} + + +static const float F44_0 [16 + 32] = { + (float)0, (float)0, (float)0, (float)0, (float)0, (float)0, (float)0, (float)0, + (float)0, (float)0, (float)0, (float)0, (float)0, (float)0, (float)0, (float)0, + + (float)0, (float)0, (float)0, (float)0, (float)0, (float)0, (float)0, (float)0, + (float)0, (float)0, (float)0, (float)0, (float)0, (float)0, (float)0, (float)0, + + (float)0, (float)0, (float)0, (float)0, (float)0, (float)0, (float)0, (float)0, + (float)0, (float)0, (float)0, (float)0, (float)0, (float)0, (float)0, (float)0 +}; + + +static const float F44_1 [16 + 32] = { /* SNR(w) = 4.843163 dB, SNR = -3.192134 dB */ + (float) 0.85018292704024355931, (float) 0.29089597350995344721, (float)-0.05021866022121039450, (float)-0.23545456294599161833, + (float)-0.58362726442227032096, (float)-0.67038978965193036429, (float)-0.38566861572833459221, (float)-0.15218663390367969967, + (float)-0.02577543084864530676, (float) 0.14119295297688728127, (float) 0.22398848581628781612, (float) 0.15401727203382084116, + (float) 0.05216161232906000929, (float)-0.00282237820999675451, (float)-0.03042794608323867363, (float)-0.03109780942998826024, + + (float) 0.85018292704024355931, (float) 0.29089597350995344721, (float)-0.05021866022121039450, (float)-0.23545456294599161833, + (float)-0.58362726442227032096, (float)-0.67038978965193036429, (float)-0.38566861572833459221, (float)-0.15218663390367969967, + (float)-0.02577543084864530676, (float) 0.14119295297688728127, (float) 0.22398848581628781612, (float) 0.15401727203382084116, + (float) 0.05216161232906000929, (float)-0.00282237820999675451, (float)-0.03042794608323867363, (float)-0.03109780942998826024, + + (float) 0.85018292704024355931, (float) 0.29089597350995344721, (float)-0.05021866022121039450, (float)-0.23545456294599161833, + (float)-0.58362726442227032096, (float)-0.67038978965193036429, (float)-0.38566861572833459221, (float)-0.15218663390367969967, + (float)-0.02577543084864530676, (float) 0.14119295297688728127, (float) 0.22398848581628781612, (float) 0.15401727203382084116, + (float) 0.05216161232906000929, (float)-0.00282237820999675451, (float)-0.03042794608323867363, (float)-0.03109780942998826024, +}; + + +static const float F44_2 [16 + 32] = { /* SNR(w) = 10.060213 dB, SNR = -12.766730 dB */ + (float) 1.78827593892108555290, (float) 0.95508210637394326553, (float)-0.18447626783899924429, (float)-0.44198126506275016437, + (float)-0.88404052492547413497, (float)-1.42218907262407452967, (float)-1.02037566838362314995, (float)-0.34861755756425577264, + (float)-0.11490230170431934434, (float) 0.12498899339968611803, (float) 0.38065885268563131927, (float) 0.31883491321310506562, + (float) 0.10486838686563442765, (float)-0.03105361685110374845, (float)-0.06450524884075370758, (float)-0.02939198261121969816, + + (float) 1.78827593892108555290, (float) 0.95508210637394326553, (float)-0.18447626783899924429, (float)-0.44198126506275016437, + (float)-0.88404052492547413497, (float)-1.42218907262407452967, (float)-1.02037566838362314995, (float)-0.34861755756425577264, + (float)-0.11490230170431934434, (float) 0.12498899339968611803, (float) 0.38065885268563131927, (float) 0.31883491321310506562, + (float) 0.10486838686563442765, (float)-0.03105361685110374845, (float)-0.06450524884075370758, (float)-0.02939198261121969816, + + (float) 1.78827593892108555290, (float) 0.95508210637394326553, (float)-0.18447626783899924429, (float)-0.44198126506275016437, + (float)-0.88404052492547413497, (float)-1.42218907262407452967, (float)-1.02037566838362314995, (float)-0.34861755756425577264, + (float)-0.11490230170431934434, (float) 0.12498899339968611803, (float) 0.38065885268563131927, (float) 0.31883491321310506562, + (float) 0.10486838686563442765, (float)-0.03105361685110374845, (float)-0.06450524884075370758, (float)-0.02939198261121969816, +}; + + +static const float F44_3 [16 + 32] = { /* SNR(w) = 15.382598 dB, SNR = -29.402334 dB */ + (float) 2.89072132015058161445, (float) 2.68932810943698754106, (float) 0.21083359339410251227, (float)-0.98385073324997617515, + (float)-1.11047823227097316719, (float)-2.18954076314139673147, (float)-2.36498032881953056225, (float)-0.95484132880101140785, + (float)-0.23924057925542965158, (float)-0.13865235703915925642, (float) 0.43587843191057992846, (float) 0.65903257226026665927, + (float) 0.24361815372443152787, (float)-0.00235974960154720097, (float) 0.01844166574603346289, (float) 0.01722945988740875099, + + (float) 2.89072132015058161445, (float) 2.68932810943698754106, (float) 0.21083359339410251227, (float)-0.98385073324997617515, + (float)-1.11047823227097316719, (float)-2.18954076314139673147, (float)-2.36498032881953056225, (float)-0.95484132880101140785, + (float)-0.23924057925542965158, (float)-0.13865235703915925642, (float) 0.43587843191057992846, (float) 0.65903257226026665927, + (float) 0.24361815372443152787, (float)-0.00235974960154720097, (float) 0.01844166574603346289, (float) 0.01722945988740875099, + + (float) 2.89072132015058161445, (float) 2.68932810943698754106, (float) 0.21083359339410251227, (float)-0.98385073324997617515, + (float)-1.11047823227097316719, (float)-2.18954076314139673147, (float)-2.36498032881953056225, (float)-0.95484132880101140785, + (float)-0.23924057925542965158, (float)-0.13865235703915925642, (float) 0.43587843191057992846, (float) 0.65903257226026665927, + (float) 0.24361815372443152787, (float)-0.00235974960154720097, (float) 0.01844166574603346289, (float) 0.01722945988740875099 +}; + + +static double scalar16_(const float* x, const float* y) +{ + return + x[ 0]*y[ 0] + x[ 1]*y[ 1] + x[ 2]*y[ 2] + x[ 3]*y[ 3] + + x[ 4]*y[ 4] + x[ 5]*y[ 5] + x[ 6]*y[ 6] + x[ 7]*y[ 7] + + x[ 8]*y[ 8] + x[ 9]*y[ 9] + x[10]*y[10] + x[11]*y[11] + + x[12]*y[12] + x[13]*y[13] + x[14]*y[14] + x[15]*y[15]; +} + + +void FLAC__replaygain_synthesis__init_dither_context(DitherContext *d, int bits, int shapingtype) +{ + static unsigned char default_dither [] = { 92, 92, 88, 84, 81, 78, 74, 67, 0, 0 }; + static const float* F [] = { F44_0, F44_1, F44_2, F44_3 }; + + int index; + + if (shapingtype < 0) shapingtype = 0; + if (shapingtype > 3) shapingtype = 3; + d->ShapingType = (NoiseShaping)shapingtype; + index = bits - 11 - shapingtype; + if (index < 0) index = 0; + if (index > 9) index = 9; + + memset ( d->ErrorHistory , 0, sizeof (d->ErrorHistory ) ); + memset ( d->DitherHistory, 0, sizeof (d->DitherHistory) ); + + d->FilterCoeff = F [shapingtype]; + d->Mask = ((FLAC__uint64)-1) << (32 - bits); + d->Add = 0.5 * ((1L << (32 - bits)) - 1); + d->Dither = 0.01f*default_dither[index] / (((FLAC__int64)1) << bits); + d->LastHistoryIndex = 0; +} + +/* + * the following is based on parts of wavegain.c + */ + +static FLAC__INLINE FLAC__int64 dither_output_(DitherContext *d, FLAC__bool do_dithering, int shapingtype, int i, double Sum, int k) +{ + union { + double d; + FLAC__int64 i; + } doubletmp; + double Sum2; + FLAC__int64 val; + +#define ROUND64(x) ( doubletmp.d = (x) + d->Add + (FLAC__int64)FLAC__I64L(0x001FFFFD80000000), doubletmp.i - (FLAC__int64)FLAC__I64L(0x433FFFFD80000000) ) + + if(do_dithering) { + if(shapingtype == 0) { + double tmp = random_equi_(d->Dither); + Sum2 = tmp - d->LastRandomNumber [k]; + d->LastRandomNumber [k] = (int)tmp; + Sum2 = Sum += Sum2; + val = ROUND64(Sum2) & d->Mask; + } + else { + Sum2 = random_triangular_(d->Dither) - scalar16_(d->DitherHistory[k], d->FilterCoeff + i); + Sum += d->DitherHistory [k] [(-1-i)&15] = (float)Sum2; + Sum2 = Sum + scalar16_(d->ErrorHistory [k], d->FilterCoeff + i); + val = ROUND64(Sum2) & d->Mask; + d->ErrorHistory [k] [(-1-i)&15] = (float)(Sum - val); + } + return val; + } + else + return ROUND64(Sum); + +#undef ROUND64 +} + +#if 0 + float peak = 0.f, + new_peak, + factor_clip + double scale, + dB; + + ... + + peak is in the range -32768.0 .. 32767.0 + + /* calculate factors for ReplayGain and ClippingPrevention */ + *track_gain = GetTitleGain() + settings->man_gain; + scale = (float) pow(10., *track_gain * 0.05); + if(settings->clip_prev) { + factor_clip = (float) (32767./( peak + 1)); + if(scale < factor_clip) + factor_clip = 1.f; + else + factor_clip /= scale; + scale *= factor_clip; + } + new_peak = (float) peak * scale; + + dB = 20. * log10(scale); + *track_gain = (float) dB; + + const double scale = pow(10., (double)gain * 0.05); +#endif + + +size_t FLAC__replaygain_synthesis__apply_gain(FLAC__byte *data_out, FLAC__bool little_endian_data_out, FLAC__bool unsigned_data_out, const FLAC__int32 * const input[], unsigned wide_samples, unsigned channels, const unsigned source_bps, const unsigned target_bps, const double scale, const FLAC__bool hard_limit, FLAC__bool do_dithering, DitherContext *dither_context) +{ + static const FLAC__int32 conv_factors_[33] = { + -1, /* 0 bits-per-sample (not supported) */ + -1, /* 1 bits-per-sample (not supported) */ + -1, /* 2 bits-per-sample (not supported) */ + -1, /* 3 bits-per-sample (not supported) */ + 268435456, /* 4 bits-per-sample */ + 134217728, /* 5 bits-per-sample */ + 67108864, /* 6 bits-per-sample */ + 33554432, /* 7 bits-per-sample */ + 16777216, /* 8 bits-per-sample */ + 8388608, /* 9 bits-per-sample */ + 4194304, /* 10 bits-per-sample */ + 2097152, /* 11 bits-per-sample */ + 1048576, /* 12 bits-per-sample */ + 524288, /* 13 bits-per-sample */ + 262144, /* 14 bits-per-sample */ + 131072, /* 15 bits-per-sample */ + 65536, /* 16 bits-per-sample */ + 32768, /* 17 bits-per-sample */ + 16384, /* 18 bits-per-sample */ + 8192, /* 19 bits-per-sample */ + 4096, /* 20 bits-per-sample */ + 2048, /* 21 bits-per-sample */ + 1024, /* 22 bits-per-sample */ + 512, /* 23 bits-per-sample */ + 256, /* 24 bits-per-sample */ + 128, /* 25 bits-per-sample */ + 64, /* 26 bits-per-sample */ + 32, /* 27 bits-per-sample */ + 16, /* 28 bits-per-sample */ + 8, /* 29 bits-per-sample */ + 4, /* 30 bits-per-sample */ + 2, /* 31 bits-per-sample */ + 1 /* 32 bits-per-sample */ + }; + static const FLAC__int64 hard_clip_factors_[33] = { + 0, /* 0 bits-per-sample (not supported) */ + 0, /* 1 bits-per-sample (not supported) */ + 0, /* 2 bits-per-sample (not supported) */ + 0, /* 3 bits-per-sample (not supported) */ + -8, /* 4 bits-per-sample */ + -16, /* 5 bits-per-sample */ + -32, /* 6 bits-per-sample */ + -64, /* 7 bits-per-sample */ + -128, /* 8 bits-per-sample */ + -256, /* 9 bits-per-sample */ + -512, /* 10 bits-per-sample */ + -1024, /* 11 bits-per-sample */ + -2048, /* 12 bits-per-sample */ + -4096, /* 13 bits-per-sample */ + -8192, /* 14 bits-per-sample */ + -16384, /* 15 bits-per-sample */ + -32768, /* 16 bits-per-sample */ + -65536, /* 17 bits-per-sample */ + -131072, /* 18 bits-per-sample */ + -262144, /* 19 bits-per-sample */ + -524288, /* 20 bits-per-sample */ + -1048576, /* 21 bits-per-sample */ + -2097152, /* 22 bits-per-sample */ + -4194304, /* 23 bits-per-sample */ + -8388608, /* 24 bits-per-sample */ + -16777216, /* 25 bits-per-sample */ + -33554432, /* 26 bits-per-sample */ + -67108864, /* 27 bits-per-sample */ + -134217728, /* 28 bits-per-sample */ + -268435456, /* 29 bits-per-sample */ + -536870912, /* 30 bits-per-sample */ + -1073741824, /* 31 bits-per-sample */ + (FLAC__int64)(-1073741824) * 2 /* 32 bits-per-sample */ + }; + const FLAC__int32 conv_factor = conv_factors_[target_bps]; + const FLAC__int64 hard_clip_factor = hard_clip_factors_[target_bps]; + /* + * The integer input coming in has a varying range based on the + * source_bps. We want to normalize it to [-1.0, 1.0) so instead + * of doing two multiplies on each sample, we just multiple + * 'scale' by 1/(2^(source_bps-1)) + */ + const double multi_scale = scale / (double)(1u << (source_bps-1)); + + FLAC__byte * const start = data_out; + unsigned i, channel; + const FLAC__int32 *input_; + double sample; + const unsigned bytes_per_sample = target_bps / 8; + const unsigned last_history_index = dither_context->LastHistoryIndex; + NoiseShaping noise_shaping = dither_context->ShapingType; + FLAC__int64 val64; + FLAC__int32 val32; + FLAC__int32 uval32; + const FLAC__uint32 twiggle = 1u << (target_bps - 1); + + FLAC__ASSERT(channels > 0 && channels <= FLAC_SHARE__MAX_SUPPORTED_CHANNELS); + FLAC__ASSERT(source_bps >= 4); + FLAC__ASSERT(target_bps >= 4); + FLAC__ASSERT(source_bps <= 32); + FLAC__ASSERT(target_bps < 32); + FLAC__ASSERT((target_bps & 7) == 0); + + for(channel = 0; channel < channels; channel++) { + const unsigned incr = bytes_per_sample * channels; + data_out = start + bytes_per_sample * channel; + input_ = input[channel]; + for(i = 0; i < wide_samples; i++, data_out += incr) { + sample = (double)input_[i] * multi_scale; + + if(hard_limit) { + /* hard 6dB limiting */ + if(sample < -0.5) + sample = tanh((sample + 0.5) / (1-0.5)) * (1-0.5) - 0.5; + else if(sample > 0.5) + sample = tanh((sample - 0.5) / (1-0.5)) * (1-0.5) + 0.5; + } + sample *= 2147483647.f; + + val64 = dither_output_(dither_context, do_dithering, noise_shaping, (i + last_history_index) % 32, sample, channel) / conv_factor; + + val32 = (FLAC__int32)val64; + if(val64 >= -hard_clip_factor) + val32 = (FLAC__int32)(-(hard_clip_factor+1)); + else if(val64 < hard_clip_factor) + val32 = (FLAC__int32)hard_clip_factor; + + uval32 = (FLAC__uint32)val32; + if (unsigned_data_out) + uval32 ^= twiggle; + + if (little_endian_data_out) { + switch(target_bps) { + case 24: + data_out[2] = (FLAC__byte)(uval32 >> 16); + /* fall through */ + case 16: + data_out[1] = (FLAC__byte)(uval32 >> 8); + /* fall through */ + case 8: + data_out[0] = (FLAC__byte)uval32; + break; + } + } + else { + switch(target_bps) { + case 24: + data_out[0] = (FLAC__byte)(uval32 >> 16); + data_out[1] = (FLAC__byte)(uval32 >> 8); + data_out[2] = (FLAC__byte)uval32; + break; + case 16: + data_out[0] = (FLAC__byte)(uval32 >> 8); + data_out[1] = (FLAC__byte)uval32; + break; + case 8: + data_out[0] = (FLAC__byte)uval32; + break; + } + } + } + } + dither_context->LastHistoryIndex = (last_history_index + wide_samples) % 32; + + return wide_samples * channels * (target_bps/8); +} diff --git a/Libraries/FLAC/Files/src/share/replaygain_synthesis/replaygain_synthesis_static.dsp b/Libraries/FLAC/Files/src/share/replaygain_synthesis/replaygain_synthesis_static.dsp new file mode 100644 index 000000000..97e80cfbc --- /dev/null +++ b/Libraries/FLAC/Files/src/share/replaygain_synthesis/replaygain_synthesis_static.dsp @@ -0,0 +1,108 @@ +# Microsoft Developer Studio Project File - Name="replaygain_synthesis_static" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Static Library" 0x0104 + +CFG=replaygain_synthesis_static - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "replaygain_synthesis_static.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "replaygain_synthesis_static.mak" CFG="replaygain_synthesis_static - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "replaygain_synthesis_static - Win32 Release" (based on "Win32 (x86) Static Library") +!MESSAGE "replaygain_synthesis_static - Win32 Debug" (based on "Win32 (x86) Static Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "replaygain_synthesis" +# PROP Scc_LocalPath "..\..\.." +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "replaygain_synthesis_static - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "..\..\..\obj\release\lib" +# PROP Intermediate_Dir "Release_static" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /Op /I ".\include" /I "..\..\..\include" /I "..\..\..\include\share" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo /nodefaultlib + +!ELSEIF "$(CFG)" == "replaygain_synthesis_static - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "..\..\..\obj\debug\lib" +# PROP Intermediate_Dir "Debug_static" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".\include" /I "..\..\..\include" /I "..\..\..\include\share" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo /nodefaultlib + +!ENDIF + +# Begin Target + +# Name "replaygain_synthesis_static - Win32 Release" +# Name "replaygain_synthesis_static - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "c" +# Begin Source File + +SOURCE=.\replaygain_synthesis.c +# End Source File +# End Group +# Begin Group "Private Header Files" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=.\include\private\fast_float_math_hack.h +# End Source File +# End Group +# Begin Group "Public Header Files" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=..\..\..\include\share\replaygain_synthesis.h +# End Source File +# End Group +# End Target +# End Project diff --git a/Libraries/FLAC/Files/src/share/utf8/Makefile.am b/Libraries/FLAC/Files/src/share/utf8/Makefile.am new file mode 100644 index 000000000..6217db384 --- /dev/null +++ b/Libraries/FLAC/Files/src/share/utf8/Makefile.am @@ -0,0 +1,23 @@ +## Process this file with automake to produce Makefile.in + +AUTOMAKE_OPTIONS = foreign + +INCLUDES = -I$(top_srcdir)/include/share + +noinst_LTLIBRARIES = libutf8.la + +libutf8_la_SOURCES = charset.c charset.h iconvert.c utf8.c + +EXTRA_DIST = \ + Makefile.lite \ + charmaps.h \ + makemap.c \ + charset_test.c \ + charsetmap.h \ + utf8_static.dsp + +debug: + $(MAKE) all CFLAGS="@DEBUG@" + +profile: + $(MAKE) all CFLAGS="@PROFILE@" diff --git a/Libraries/FLAC/Files/src/share/utf8/Makefile.in b/Libraries/FLAC/Files/src/share/utf8/Makefile.in new file mode 100644 index 000000000..44e145aa5 --- /dev/null +++ b/Libraries/FLAC/Files/src/share/utf8/Makefile.in @@ -0,0 +1,504 @@ +# Makefile.in generated by automake 1.8.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +SOURCES = $(libutf8_la_SOURCES) + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../../.. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_triplet = @host@ +subdir = src/share/utf8 +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(mkdir_p) +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +libutf8_la_LIBADD = +am_libutf8_la_OBJECTS = charset.lo iconvert.lo utf8.lo +libutf8_la_OBJECTS = $(am_libutf8_la_OBJECTS) +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/charset.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/iconvert.Plo ./$(DEPDIR)/utf8.Plo +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(libutf8_la_SOURCES) +DIST_SOURCES = $(libutf8_la_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCAS = @CCAS@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEBUG_FALSE = @DEBUG_FALSE@ +DEBUG_TRUE = @DEBUG_TRUE@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DOCBOOK_TO_MAN = @DOCBOOK_TO_MAN@ +DOXYGEN = @DOXYGEN@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FLaC__CPU_IA32_FALSE = @FLaC__CPU_IA32_FALSE@ +FLaC__CPU_IA32_TRUE = @FLaC__CPU_IA32_TRUE@ +FLaC__CPU_PPC_FALSE = @FLaC__CPU_PPC_FALSE@ +FLaC__CPU_PPC_TRUE = @FLaC__CPU_PPC_TRUE@ +FLaC__CPU_SPARC_FALSE = @FLaC__CPU_SPARC_FALSE@ +FLaC__CPU_SPARC_TRUE = @FLaC__CPU_SPARC_TRUE@ +FLaC__EXHAUSTIVE_TESTS_FALSE = @FLaC__EXHAUSTIVE_TESTS_FALSE@ +FLaC__EXHAUSTIVE_TESTS_TRUE = @FLaC__EXHAUSTIVE_TESTS_TRUE@ +FLaC__HAS_AS_FALSE = @FLaC__HAS_AS_FALSE@ +FLaC__HAS_AS_TRUE = @FLaC__HAS_AS_TRUE@ +FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@ +FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@ +FLaC__HAS_DOCBOOK_TO_MAN_FALSE = @FLaC__HAS_DOCBOOK_TO_MAN_FALSE@ +FLaC__HAS_DOCBOOK_TO_MAN_TRUE = @FLaC__HAS_DOCBOOK_TO_MAN_TRUE@ +FLaC__HAS_DOXYGEN_FALSE = @FLaC__HAS_DOXYGEN_FALSE@ +FLaC__HAS_DOXYGEN_TRUE = @FLaC__HAS_DOXYGEN_TRUE@ +FLaC__HAS_GAS_FALSE = @FLaC__HAS_GAS_FALSE@ +FLaC__HAS_GAS_TRUE = @FLaC__HAS_GAS_TRUE@ +FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@ +FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@ +FLaC__HAS_NASM_FALSE = @FLaC__HAS_NASM_FALSE@ +FLaC__HAS_NASM_TRUE = @FLaC__HAS_NASM_TRUE@ +FLaC__HAS_OGG_FALSE = @FLaC__HAS_OGG_FALSE@ +FLaC__HAS_OGG_TRUE = @FLaC__HAS_OGG_TRUE@ +FLaC__HAS_XMMS_FALSE = @FLaC__HAS_XMMS_FALSE@ +FLaC__HAS_XMMS_TRUE = @FLaC__HAS_XMMS_TRUE@ +FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE@ +FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE@ +FLaC__NO_ASM_FALSE = @FLaC__NO_ASM_FALSE@ +FLaC__NO_ASM_TRUE = @FLaC__NO_ASM_TRUE@ +FLaC__SSE_OS_FALSE = @FLaC__SSE_OS_FALSE@ +FLaC__SSE_OS_TRUE = @FLaC__SSE_OS_TRUE@ +FLaC__SYS_DARWIN_FALSE = @FLaC__SYS_DARWIN_FALSE@ +FLaC__SYS_DARWIN_TRUE = @FLaC__SYS_DARWIN_TRUE@ +FLaC__SYS_LINUX_FALSE = @FLaC__SYS_LINUX_FALSE@ +FLaC__SYS_LINUX_TRUE = @FLaC__SYS_LINUX_TRUE@ +FLaC__USE_3DNOW_FALSE = @FLaC__USE_3DNOW_FALSE@ +FLaC__USE_3DNOW_TRUE = @FLaC__USE_3DNOW_TRUE@ +FLaC__USE_ALTIVEC_FALSE = @FLaC__USE_ALTIVEC_FALSE@ +FLaC__USE_ALTIVEC_TRUE = @FLaC__USE_ALTIVEC_TRUE@ +FLaC__VALGRIND_TESTING_FALSE = @FLaC__VALGRIND_TESTING_FALSE@ +FLaC__VALGRIND_TESTING_TRUE = @FLaC__VALGRIND_TESTING_TRUE@ +GAS = @GAS@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +NASM = @NASM@ +OBJEXT = @OBJEXT@ +OBJ_FORMAT = @OBJ_FORMAT@ +OGG_CFLAGS = @OGG_CFLAGS@ +OGG_LIBS = @OGG_LIBS@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +XMMS_CFLAGS = @XMMS_CFLAGS@ +XMMS_CONFIG = @XMMS_CONFIG@ +XMMS_DATA_DIR = @XMMS_DATA_DIR@ +XMMS_EFFECT_PLUGIN_DIR = @XMMS_EFFECT_PLUGIN_DIR@ +XMMS_GENERAL_PLUGIN_DIR = @XMMS_GENERAL_PLUGIN_DIR@ +XMMS_INPUT_PLUGIN_DIR = @XMMS_INPUT_PLUGIN_DIR@ +XMMS_LIBS = @XMMS_LIBS@ +XMMS_OUTPUT_PLUGIN_DIR = @XMMS_OUTPUT_PLUGIN_DIR@ +XMMS_PLUGIN_DIR = @XMMS_PLUGIN_DIR@ +XMMS_VERSION = @XMMS_VERSION@ +XMMS_VISUALIZATION_PLUGIN_DIR = @XMMS_VISUALIZATION_PLUGIN_DIR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +AUTOMAKE_OPTIONS = foreign +INCLUDES = -I$(top_srcdir)/include/share +noinst_LTLIBRARIES = libutf8.la +libutf8_la_SOURCES = charset.c charset.h iconvert.c utf8.c +EXTRA_DIST = \ + Makefile.lite \ + charmaps.h \ + makemap.c \ + charset_test.c \ + charsetmap.h \ + utf8_static.dsp + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/share/utf8/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/share/utf8/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libutf8.la: $(libutf8_la_OBJECTS) $(libutf8_la_DEPENDENCIES) + $(LINK) $(libutf8_la_LDFLAGS) $(libutf8_la_OBJECTS) $(libutf8_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/charset.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iconvert.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utf8.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstLTLIBRARIES ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-exec \ + install-exec-am install-info install-info-am install-man \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am \ + uninstall-info-am + + +debug: + $(MAKE) all CFLAGS="@DEBUG@" + +profile: + $(MAKE) all CFLAGS="@PROFILE@" +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/Libraries/FLAC/Files/src/share/utf8/Makefile.lite b/Libraries/FLAC/Files/src/share/utf8/Makefile.lite new file mode 100644 index 000000000..a03580222 --- /dev/null +++ b/Libraries/FLAC/Files/src/share/utf8/Makefile.lite @@ -0,0 +1,17 @@ +# +# GNU makefile +# + +topdir = ../../.. + +LIB_NAME = libutf8 +INCLUDES = -I$(topdir)/include -I$(topdir)/include/share -I$(ICONV_INCLUDE_DIR) + +SRCS_C = \ + charset.c \ + iconvert.c \ + utf8.c + +include $(topdir)/build/lib.mk + +# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/Libraries/FLAC/Files/src/share/utf8/charmaps.h b/Libraries/FLAC/Files/src/share/utf8/charmaps.h new file mode 100644 index 000000000..690d8906f --- /dev/null +++ b/Libraries/FLAC/Files/src/share/utf8/charmaps.h @@ -0,0 +1,57 @@ + +/* + * If you need to generate more maps, use makemap.c on a system + * with a decent iconv. + */ + +static const unsigned short mapping_iso_8859_2[256] = { + 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, + 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f, + 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, + 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x001f, + 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, + 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f, + 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, + 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f, + 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, + 0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, + 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, + 0x0058, 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x005f, + 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, + 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, + 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, + 0x0078, 0x0079, 0x007a, 0x007b, 0x007c, 0x007d, 0x007e, 0x007f, + 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, + 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, + 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, + 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, + 0x00a0, 0x0104, 0x02d8, 0x0141, 0x00a4, 0x013d, 0x015a, 0x00a7, + 0x00a8, 0x0160, 0x015e, 0x0164, 0x0179, 0x00ad, 0x017d, 0x017b, + 0x00b0, 0x0105, 0x02db, 0x0142, 0x00b4, 0x013e, 0x015b, 0x02c7, + 0x00b8, 0x0161, 0x015f, 0x0165, 0x017a, 0x02dd, 0x017e, 0x017c, + 0x0154, 0x00c1, 0x00c2, 0x0102, 0x00c4, 0x0139, 0x0106, 0x00c7, + 0x010c, 0x00c9, 0x0118, 0x00cb, 0x011a, 0x00cd, 0x00ce, 0x010e, + 0x0110, 0x0143, 0x0147, 0x00d3, 0x00d4, 0x0150, 0x00d6, 0x00d7, + 0x0158, 0x016e, 0x00da, 0x0170, 0x00dc, 0x00dd, 0x0162, 0x00df, + 0x0155, 0x00e1, 0x00e2, 0x0103, 0x00e4, 0x013a, 0x0107, 0x00e7, + 0x010d, 0x00e9, 0x0119, 0x00eb, 0x011b, 0x00ed, 0x00ee, 0x010f, + 0x0111, 0x0144, 0x0148, 0x00f3, 0x00f4, 0x0151, 0x00f6, 0x00f7, + 0x0159, 0x016f, 0x00fa, 0x0171, 0x00fc, 0x00fd, 0x0163, 0x02d9 +}; + +static struct { + const char *name; + const unsigned short *map; + struct charset *charset; +} maps[] = { + { "ISO-8859-2", mapping_iso_8859_2, 0 }, + { 0, 0, 0 } +}; + +static const struct { + const char *bad; + const char *good; +} names[] = { + { "ANSI_X3.4-1968", "us-ascii" }, + { 0, 0 } +}; diff --git a/Libraries/FLAC/Files/src/share/utf8/charset.c b/Libraries/FLAC/Files/src/share/utf8/charset.c new file mode 100644 index 000000000..0b7969962 --- /dev/null +++ b/Libraries/FLAC/Files/src/share/utf8/charset.c @@ -0,0 +1,531 @@ +/* + * Copyright (C) 2001 Edmund Grimley Evans + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* + * See the corresponding header file for a description of the functions + * that this file provides. + * + * This was first written for Ogg Vorbis but could be of general use. + * + * The only deliberate assumption about data sizes is that a short has + * at least 16 bits, but this code has only been tested on systems with + * 8-bit char, 16-bit short and 32-bit int. + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#ifndef HAVE_ICONV /* should be ifdef USE_CHARSET_CONVERT */ + +#include + +#include "charset.h" + +#include "charmaps.h" + +/* + * This is like the standard strcasecmp, but it does not depend + * on the locale. Locale-dependent functions can be dangerous: + * we once had a bug involving strcasecmp("iso", "ISO") in a + * Turkish locale! + * + * (I'm not really sure what the official standard says + * about the sign of strcasecmp("Z", "["), but usually + * we're only interested in whether it's zero.) + */ + +static int ascii_strcasecmp(const char *s1, const char *s2) +{ + char c1, c2; + + for (;; s1++, s2++) { + if (!*s1 || !*s1) + break; + if (*s1 == *s2) + continue; + c1 = *s1; + if ('a' <= c1 && c1 <= 'z') + c1 += 'A' - 'a'; + c2 = *s2; + if ('a' <= c2 && c2 <= 'z') + c2 += 'A' - 'a'; + if (c1 != c2) + break; + } + return (unsigned char)*s1 - (unsigned char)*s2; +} + +/* + * UTF-8 equivalents of the C library's wctomb() and mbtowc(). + */ + +int utf8_mbtowc(int *pwc, const char *s, size_t n) +{ + unsigned char c; + int wc, i, k; + + if (!n || !s) + return 0; + + c = *s; + if (c < 0x80) { + if (pwc) + *pwc = c; + return c ? 1 : 0; + } + else if (c < 0xc2) + return -1; + else if (c < 0xe0) { + if (n >= 2 && (s[1] & 0xc0) == 0x80) { + if (pwc) + *pwc = ((c & 0x1f) << 6) | (s[1] & 0x3f); + return 2; + } + else + return -1; + } + else if (c < 0xf0) + k = 3; + else if (c < 0xf8) + k = 4; + else if (c < 0xfc) + k = 5; + else if (c < 0xfe) + k = 6; + else + return -1; + + if (n < (size_t)k) + return -1; + wc = *s++ & ((1 << (7 - k)) - 1); + for (i = 1; i < k; i++) { + if ((*s & 0xc0) != 0x80) + return -1; + wc = (wc << 6) | (*s++ & 0x3f); + } + if (wc < (1 << (5 * k - 4))) + return -1; + if (pwc) + *pwc = wc; + return k; +} + +int utf8_wctomb(char *s, int wc1) +{ + unsigned int wc = wc1; + + if (!s) + return 0; + if (wc < (1u << 7)) { + *s++ = wc; + return 1; + } + else if (wc < (1u << 11)) { + *s++ = 0xc0 | (wc >> 6); + *s++ = 0x80 | (wc & 0x3f); + return 2; + } + else if (wc < (1u << 16)) { + *s++ = 0xe0 | (wc >> 12); + *s++ = 0x80 | ((wc >> 6) & 0x3f); + *s++ = 0x80 | (wc & 0x3f); + return 3; + } + else if (wc < (1u << 21)) { + *s++ = 0xf0 | (wc >> 18); + *s++ = 0x80 | ((wc >> 12) & 0x3f); + *s++ = 0x80 | ((wc >> 6) & 0x3f); + *s++ = 0x80 | (wc & 0x3f); + return 4; + } + else if (wc < (1u << 26)) { + *s++ = 0xf8 | (wc >> 24); + *s++ = 0x80 | ((wc >> 18) & 0x3f); + *s++ = 0x80 | ((wc >> 12) & 0x3f); + *s++ = 0x80 | ((wc >> 6) & 0x3f); + *s++ = 0x80 | (wc & 0x3f); + return 5; + } + else if (wc < (1u << 31)) { + *s++ = 0xfc | (wc >> 30); + *s++ = 0x80 | ((wc >> 24) & 0x3f); + *s++ = 0x80 | ((wc >> 18) & 0x3f); + *s++ = 0x80 | ((wc >> 12) & 0x3f); + *s++ = 0x80 | ((wc >> 6) & 0x3f); + *s++ = 0x80 | (wc & 0x3f); + return 6; + } + else + return -1; +} + +/* + * The charset "object" and methods. + */ + +struct charset { + int max; + int (*mbtowc)(void *table, int *pwc, const char *s, size_t n); + int (*wctomb)(void *table, char *s, int wc); + void *map; +}; + +int charset_mbtowc(struct charset *charset, int *pwc, const char *s, size_t n) +{ + return (*charset->mbtowc)(charset->map, pwc, s, n); +} + +int charset_wctomb(struct charset *charset, char *s, int wc) +{ + return (*charset->wctomb)(charset->map, s, wc); +} + +int charset_max(struct charset *charset) +{ + return charset->max; +} + +/* + * Implementation of UTF-8. + */ + +static int mbtowc_utf8(void *map, int *pwc, const char *s, size_t n) +{ + (void)map; + return utf8_mbtowc(pwc, s, n); +} + +static int wctomb_utf8(void *map, char *s, int wc) +{ + (void)map; + return utf8_wctomb(s, wc); +} + +/* + * Implementation of US-ASCII. + * Probably on most architectures this compiles to less than 256 bytes + * of code, so we can save space by not having a table for this one. + */ + +static int mbtowc_ascii(void *map, int *pwc, const char *s, size_t n) +{ + int wc; + + (void)map; + if (!n || !s) + return 0; + wc = (unsigned char)*s; + if (wc & ~0x7f) + return -1; + if (pwc) + *pwc = wc; + return wc ? 1 : 0; +} + +static int wctomb_ascii(void *map, char *s, int wc) +{ + (void)map; + if (!s) + return 0; + if (wc & ~0x7f) + return -1; + *s = wc; + return 1; +} + +/* + * Implementation of ISO-8859-1. + * Probably on most architectures this compiles to less than 256 bytes + * of code, so we can save space by not having a table for this one. + */ + +static int mbtowc_iso1(void *map, int *pwc, const char *s, size_t n) +{ + int wc; + + (void)map; + if (!n || !s) + return 0; + wc = (unsigned char)*s; + if (wc & ~0xff) + return -1; + if (pwc) + *pwc = wc; + return wc ? 1 : 0; +} + +static int wctomb_iso1(void *map, char *s, int wc) +{ + (void)map; + if (!s) + return 0; + if (wc & ~0xff) + return -1; + *s = wc; + return 1; +} + +/* + * Implementation of any 8-bit charset. + */ + +struct map { + const unsigned short *from; + struct inverse_map *to; +}; + +static int mbtowc_8bit(void *map1, int *pwc, const char *s, size_t n) +{ + struct map *map = map1; + unsigned short wc; + + if (!n || !s) + return 0; + wc = map->from[(unsigned char)*s]; + if (wc == 0xffff) + return -1; + if (pwc) + *pwc = (int)wc; + return wc ? 1 : 0; +} + +/* + * For the inverse map we use a hash table, which has the advantages + * of small constant memory requirement and simple memory allocation, + * but the disadvantage of slow conversion in the worst case. + * If you need real-time performance while letting a potentially + * malicious user define their own map, then the method used in + * linux/drivers/char/consolemap.c would be more appropriate. + */ + +struct inverse_map { + unsigned char first[256]; + unsigned char next[256]; +}; + +/* + * The simple hash is good enough for this application. + * Use the alternative trivial hashes for testing. + */ +#define HASH(i) ((i) & 0xff) +/* #define HASH(i) 0 */ +/* #define HASH(i) 99 */ + +static struct inverse_map *make_inverse_map(const unsigned short *from) +{ + struct inverse_map *to; + char used[256]; + int i, j, k; + + to = (struct inverse_map *)malloc(sizeof(struct inverse_map)); + if (!to) + return 0; + for (i = 0; i < 256; i++) + to->first[i] = to->next[i] = used[i] = 0; + for (i = 255; i >= 0; i--) + if (from[i] != 0xffff) { + k = HASH(from[i]); + to->next[i] = to->first[k]; + to->first[k] = i; + used[k] = 1; + } + + /* Point the empty buckets at an empty list. */ + for (i = 0; i < 256; i++) + if (!to->next[i]) + break; + if (i < 256) + for (j = 0; j < 256; j++) + if (!used[j]) + to->first[j] = i; + + return to; +} + +int wctomb_8bit(void *map1, char *s, int wc1) +{ + struct map *map = map1; + unsigned short wc = wc1; + int i; + + if (!s) + return 0; + + if (wc1 & ~0xffff) + return -1; + + if (1) /* Change 1 to 0 to test the case where malloc fails. */ + if (!map->to) + map->to = make_inverse_map(map->from); + + if (map->to) { + /* Use the inverse map. */ + i = map->to->first[HASH(wc)]; + for (;;) { + if (map->from[i] == wc) { + *s = i; + return 1; + } + if (!(i = map->to->next[i])) + break; + } + } + else { + /* We don't have an inverse map, so do a linear search. */ + for (i = 0; i < 256; i++) + if (map->from[i] == wc) { + *s = i; + return 1; + } + } + + return -1; +} + +/* + * The "constructor" charset_find(). + */ + +struct charset charset_utf8 = { + 6, + &mbtowc_utf8, + &wctomb_utf8, + 0 +}; + +struct charset charset_iso1 = { + 1, + &mbtowc_iso1, + &wctomb_iso1, + 0 +}; + +struct charset charset_ascii = { + 1, + &mbtowc_ascii, + &wctomb_ascii, + 0 +}; + +struct charset *charset_find(const char *code) +{ + int i; + + /* Find good (MIME) name. */ + for (i = 0; names[i].bad; i++) + if (!ascii_strcasecmp(code, names[i].bad)) { + code = names[i].good; + break; + } + + /* Recognise some charsets for which we avoid using a table. */ + if (!ascii_strcasecmp(code, "UTF-8")) + return &charset_utf8; + if (!ascii_strcasecmp(code, "US-ASCII")) + return &charset_ascii; + if (!ascii_strcasecmp(code, "ISO-8859-1")) + return &charset_iso1; + + /* Look for a mapping for a simple 8-bit encoding. */ + for (i = 0; maps[i].name; i++) + if (!ascii_strcasecmp(code, maps[i].name)) { + if (!maps[i].charset) { + maps[i].charset = (struct charset *)malloc(sizeof(struct charset)); + if (maps[i].charset) { + struct map *map = (struct map *)malloc(sizeof(struct map)); + if (!map) { + free(maps[i].charset); + maps[i].charset = 0; + } + else { + maps[i].charset->max = 1; + maps[i].charset->mbtowc = &mbtowc_8bit; + maps[i].charset->wctomb = &wctomb_8bit; + maps[i].charset->map = map; + map->from = maps[i].map; + map->to = 0; /* inverse mapping is created when required */ + } + } + } + return maps[i].charset; + } + + return 0; +} + +/* + * Function to convert a buffer from one encoding to another. + * Invalid bytes are replaced by '#', and characters that are + * not available in the target encoding are replaced by '?'. + * Each of TO and TOLEN may be zero, if the result is not needed. + * The output buffer is null-terminated, so it is all right to + * use charset_convert(fromcode, tocode, s, strlen(s), &t, 0). + */ + +int charset_convert(const char *fromcode, const char *tocode, + const char *from, size_t fromlen, + char **to, size_t *tolen) +{ + int ret = 0; + struct charset *charset1, *charset2; + char *tobuf, *p, *newbuf; + int i, j, wc; + + charset1 = charset_find(fromcode); + charset2 = charset_find(tocode); + if (!charset1 || !charset2 ) + return -1; + + tobuf = (char *)malloc(fromlen * charset2->max + 1); + if (!tobuf) + return -2; + + for (p = tobuf; fromlen; from += i, fromlen -= i, p += j) { + i = charset_mbtowc(charset1, &wc, from, fromlen); + if (!i) + i = 1; + else if (i == -1) { + i = 1; + wc = '#'; + ret = 2; + } + j = charset_wctomb(charset2, p, wc); + if (j == -1) { + if (!ret) + ret = 1; + j = charset_wctomb(charset2, p, '?'); + if (j == -1) + j = 0; + } + } + + if (tolen) + *tolen = p - tobuf; + *p++ = '\0'; + if (to) { + newbuf = realloc(tobuf, p - tobuf); + *to = newbuf ? newbuf : tobuf; + } + else + free(tobuf); + + return ret; +} + +#endif /* USE_CHARSET_ICONV */ diff --git a/Libraries/FLAC/Files/src/share/utf8/charset.h b/Libraries/FLAC/Files/src/share/utf8/charset.h new file mode 100644 index 000000000..b5e2fb738 --- /dev/null +++ b/Libraries/FLAC/Files/src/share/utf8/charset.h @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2001 Edmund Grimley Evans + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +/* + * These functions are like the C library's mbtowc() and wctomb(), + * but instead of depending on the locale they always work in UTF-8, + * and they use int instead of wchar_t. + */ + +int utf8_mbtowc(int *pwc, const char *s, size_t n); +int utf8_wctomb(char *s, int wc); + +/* + * This is an object-oriented version of mbtowc() and wctomb(). + * The caller first uses charset_find() to get a pointer to struct + * charset, then uses the mbtowc() and wctomb() methods on it. + * The function charset_max() gives the maximum length of a + * multibyte character in that encoding. + * This API is only appropriate for stateless encodings like UTF-8 + * or ISO-8859-3, but I have no intention of implementing anything + * other than UTF-8 and 8-bit encodings. + * + * MINOR BUG: If there is no memory charset_find() may return 0 and + * there is no way to distinguish this case from an unknown encoding. + */ + +struct charset; + +struct charset *charset_find(const char *code); + +int charset_mbtowc(struct charset *charset, int *pwc, const char *s, size_t n); +int charset_wctomb(struct charset *charset, char *s, int wc); +int charset_max(struct charset *charset); + +/* + * Function to convert a buffer from one encoding to another. + * Invalid bytes are replaced by '#', and characters that are + * not available in the target encoding are replaced by '?'. + * Each of TO and TOLEN may be zero if the result is not wanted. + * The input or output may contain null bytes, but the output + * buffer is also null-terminated, so it is all right to + * use charset_convert(fromcode, tocode, s, strlen(s), &t, 0). + * + * Return value: + * + * -2 : memory allocation failed + * -1 : unknown encoding + * 0 : data was converted exactly + * 1 : valid data was converted approximately (using '?') + * 2 : input was invalid (but still converted, using '#') + */ + +int charset_convert(const char *fromcode, const char *tocode, + const char *from, size_t fromlen, + char **to, size_t *tolen); diff --git a/Libraries/FLAC/Files/src/share/utf8/charset_test.c b/Libraries/FLAC/Files/src/share/utf8/charset_test.c new file mode 100644 index 000000000..87426d0af --- /dev/null +++ b/Libraries/FLAC/Files/src/share/utf8/charset_test.c @@ -0,0 +1,259 @@ +/* + * Copyright (C) 2001 Edmund Grimley Evans + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include +#include + +#include "charset.h" + +void test_any(struct charset *charset) +{ + int wc; + char s[2]; + + assert(charset); + + /* Decoder */ + + assert(charset_mbtowc(charset, 0, 0, 0) == 0); + assert(charset_mbtowc(charset, 0, 0, 1) == 0); + assert(charset_mbtowc(charset, 0, (char *)(-1), 0) == 0); + + assert(charset_mbtowc(charset, 0, "a", 0) == 0); + assert(charset_mbtowc(charset, 0, "", 1) == 0); + assert(charset_mbtowc(charset, 0, "b", 1) == 1); + assert(charset_mbtowc(charset, 0, "", 2) == 0); + assert(charset_mbtowc(charset, 0, "c", 2) == 1); + + wc = 'x'; + assert(charset_mbtowc(charset, &wc, "a", 0) == 0 && wc == 'x'); + assert(charset_mbtowc(charset, &wc, "", 1) == 0 && wc == 0); + assert(charset_mbtowc(charset, &wc, "b", 1) == 1 && wc == 'b'); + assert(charset_mbtowc(charset, &wc, "", 2) == 0 && wc == 0); + assert(charset_mbtowc(charset, &wc, "c", 2) == 1 && wc == 'c'); + + /* Encoder */ + + assert(charset_wctomb(charset, 0, 0) == 0); + + s[0] = s[1] = '.'; + assert(charset_wctomb(charset, s, 0) == 1 && + s[0] == '\0' && s[1] == '.'); + assert(charset_wctomb(charset, s, 'x') == 1 && + s[0] == 'x' && s[1] == '.'); +} + +void test_utf8() +{ + struct charset *charset; + int wc; + char s[8]; + + charset = charset_find("UTF-8"); + test_any(charset); + + /* Decoder */ + wc = 0; + assert(charset_mbtowc(charset, &wc, "\177", 1) == 1 && wc == 127); + assert(charset_mbtowc(charset, &wc, "\200", 2) == -1); + assert(charset_mbtowc(charset, &wc, "\301\277", 9) == -1); + assert(charset_mbtowc(charset, &wc, "\302\200", 1) == -1); + assert(charset_mbtowc(charset, &wc, "\302\200", 2) == 2 && wc == 128); + assert(charset_mbtowc(charset, &wc, "\302\200", 3) == 2 && wc == 128); + assert(charset_mbtowc(charset, &wc, "\340\237\200", 9) == -1); + assert(charset_mbtowc(charset, &wc, "\340\240\200", 9) == 3 && + wc == 1 << 11); + assert(charset_mbtowc(charset, &wc, "\360\217\277\277", 9) == -1); + assert(charset_mbtowc(charset, &wc, "\360\220\200\200", 9) == 4 && + wc == 1 << 16); + assert(charset_mbtowc(charset, &wc, "\370\207\277\277\277", 9) == -1); + assert(charset_mbtowc(charset, &wc, "\370\210\200\200\200", 9) == 5 && + wc == 1 << 21); + assert(charset_mbtowc(charset, &wc, "\374\203\277\277\277\277", 9) == -1); + assert(charset_mbtowc(charset, &wc, "\374\204\200\200\200\200", 9) == 6 && + wc == 1 << 26); + assert(charset_mbtowc(charset, &wc, "\375\277\277\277\277\277", 9) == 6 && + wc == 0x7fffffff); + + assert(charset_mbtowc(charset, &wc, "\302\000", 2) == -1); + assert(charset_mbtowc(charset, &wc, "\302\300", 2) == -1); + assert(charset_mbtowc(charset, &wc, "\340\040\200", 9) == -1); + assert(charset_mbtowc(charset, &wc, "\340\340\200", 9) == -1); + assert(charset_mbtowc(charset, &wc, "\340\240\000", 9) == -1); + assert(charset_mbtowc(charset, &wc, "\340\240\300", 9) == -1); + assert(charset_mbtowc(charset, &wc, "\360\020\200\200", 9) == -1); + assert(charset_mbtowc(charset, &wc, "\360\320\200\200", 9) == -1); + assert(charset_mbtowc(charset, &wc, "\360\220\000\200", 9) == -1); + assert(charset_mbtowc(charset, &wc, "\360\220\300\200", 9) == -1); + assert(charset_mbtowc(charset, &wc, "\360\220\200\000", 9) == -1); + assert(charset_mbtowc(charset, &wc, "\360\220\200\300", 9) == -1); + assert(charset_mbtowc(charset, &wc, "\375\077\277\277\277\277", 9) == -1); + assert(charset_mbtowc(charset, &wc, "\375\377\277\277\277\277", 9) == -1); + assert(charset_mbtowc(charset, &wc, "\375\277\077\277\277\277", 9) == -1); + assert(charset_mbtowc(charset, &wc, "\375\277\377\277\277\277", 9) == -1); + assert(charset_mbtowc(charset, &wc, "\375\277\277\277\077\277", 9) == -1); + assert(charset_mbtowc(charset, &wc, "\375\277\277\277\377\277", 9) == -1); + assert(charset_mbtowc(charset, &wc, "\375\277\277\277\277\077", 9) == -1); + assert(charset_mbtowc(charset, &wc, "\375\277\277\277\277\377", 9) == -1); + + assert(charset_mbtowc(charset, &wc, "\376\277\277\277\277\277", 9) == -1); + assert(charset_mbtowc(charset, &wc, "\377\277\277\277\277\277", 9) == -1); + + /* Encoder */ + strcpy(s, "......."); + assert(charset_wctomb(charset, s, 1 << 31) == -1 && + !strcmp(s, ".......")); + assert(charset_wctomb(charset, s, 127) == 1 && + !strcmp(s, "\177......")); + assert(charset_wctomb(charset, s, 128) == 2 && + !strcmp(s, "\302\200.....")); + assert(charset_wctomb(charset, s, 0x7ff) == 2 && + !strcmp(s, "\337\277.....")); + assert(charset_wctomb(charset, s, 0x800) == 3 && + !strcmp(s, "\340\240\200....")); + assert(charset_wctomb(charset, s, 0xffff) == 3 && + !strcmp(s, "\357\277\277....")); + assert(charset_wctomb(charset, s, 0x10000) == 4 && + !strcmp(s, "\360\220\200\200...")); + assert(charset_wctomb(charset, s, 0x1fffff) == 4 && + !strcmp(s, "\367\277\277\277...")); + assert(charset_wctomb(charset, s, 0x200000) == 5 && + !strcmp(s, "\370\210\200\200\200..")); + assert(charset_wctomb(charset, s, 0x3ffffff) == 5 && + !strcmp(s, "\373\277\277\277\277..")); + assert(charset_wctomb(charset, s, 0x4000000) == 6 && + !strcmp(s, "\374\204\200\200\200\200.")); + assert(charset_wctomb(charset, s, 0x7fffffff) == 6 && + !strcmp(s, "\375\277\277\277\277\277.")); +} + +void test_ascii() +{ + struct charset *charset; + int wc; + char s[3]; + + charset = charset_find("us-ascii"); + test_any(charset); + + /* Decoder */ + wc = 0; + assert(charset_mbtowc(charset, &wc, "\177", 2) == 1 && wc == 127); + assert(charset_mbtowc(charset, &wc, "\200", 2) == -1); + + /* Encoder */ + strcpy(s, ".."); + assert(charset_wctomb(charset, s, 256) == -1 && !strcmp(s, "..")); + assert(charset_wctomb(charset, s, 255) == -1); + assert(charset_wctomb(charset, s, 128) == -1); + assert(charset_wctomb(charset, s, 127) == 1 && !strcmp(s, "\177.")); +} + +void test_iso1() +{ + struct charset *charset; + int wc; + char s[3]; + + charset = charset_find("iso-8859-1"); + test_any(charset); + + /* Decoder */ + wc = 0; + assert(charset_mbtowc(charset, &wc, "\302\200", 9) == 1 && wc == 0xc2); + + /* Encoder */ + strcpy(s, ".."); + assert(charset_wctomb(charset, s, 256) == -1 && !strcmp(s, "..")); + assert(charset_wctomb(charset, s, 255) == 1 && !strcmp(s, "\377.")); + assert(charset_wctomb(charset, s, 128) == 1 && !strcmp(s, "\200.")); +} + +void test_iso2() +{ + struct charset *charset; + int wc; + char s[3]; + + charset = charset_find("iso-8859-2"); + test_any(charset); + + /* Decoder */ + wc = 0; + assert(charset_mbtowc(charset, &wc, "\302\200", 9) == 1 && wc == 0xc2); + assert(charset_mbtowc(charset, &wc, "\377", 2) == 1 && wc == 0x2d9); + + /* Encoder */ + strcpy(s, ".."); + assert(charset_wctomb(charset, s, 256) == -1 && !strcmp(s, "..")); + assert(charset_wctomb(charset, s, 255) == -1 && !strcmp(s, "..")); + assert(charset_wctomb(charset, s, 258) == 1 && !strcmp(s, "\303.")); + assert(charset_wctomb(charset, s, 128) == 1 && !strcmp(s, "\200.")); +} + +void test_convert() +{ + const char *p; + char *q, *r; + char s[256]; + size_t n, n2; + int i; + + p = "\000x\302\200\375\277\277\277\277\277"; + assert(charset_convert("UTF-8", "UTF-8", p, 10, &q, &n) == 0 && + n == 10 && !strcmp(p, q)); + assert(charset_convert("UTF-8", "UTF-8", "x\301\277y", 4, &q, &n) == 2 && + n == 4 && !strcmp(q, "x##y")); + assert(charset_convert("UTF-8", "UTF-8", "x\301\277y", 4, 0, &n) == 2 && + n == 4); + assert(charset_convert("UTF-8", "UTF-8", "x\301\277y", 4, &q, 0) == 2 && + !strcmp(q, "x##y")); + assert(charset_convert("UTF-8", "iso-8859-1", + "\302\200\304\200x", 5, &q, &n) == 1 && + n == 3 && !strcmp(q, "\200?x")); + assert(charset_convert("iso-8859-1", "UTF-8", + "\000\200\377", 3, &q, &n) == 0 && + n == 5 && !memcmp(q, "\000\302\200\303\277", 5)); + assert(charset_convert("iso-8859-1", "iso-8859-1", + "\000\200\377", 3, &q, &n) == 0 && + n == 3 && !memcmp(q, "\000\200\377", 3)); + + assert(charset_convert("iso-8859-2", "utf-8", "\300", 1, &q, &n) == 0 && + n == 2 && !strcmp(q, "\305\224")); + assert(charset_convert("utf-8", "iso-8859-2", "\305\224", 2, &q, &n) == 0 && + n == 1 && !strcmp(q, "\300")); + + for (i = 0; i < 256; i++) + s[i] = i; + + assert(charset_convert("iso-8859-2", "utf-8", s, 256, &q, &n) == 0); + assert(charset_convert("utf-8", "iso-8859-2", q, n, &r, &n2) == 0); + assert(n2 == 256 && !memcmp(r, s, n2)); +} + +int main() +{ + test_utf8(); + test_ascii(); + test_iso1(); + test_iso2(); + + test_convert(); + + return 0; +} diff --git a/Libraries/FLAC/Files/src/share/utf8/charsetmap.h b/Libraries/FLAC/Files/src/share/utf8/charsetmap.h new file mode 100644 index 000000000..b81259051 --- /dev/null +++ b/Libraries/FLAC/Files/src/share/utf8/charsetmap.h @@ -0,0 +1,79 @@ +/* This file was automatically generated by make_code_map.pl + please don't edit directly + Daniel Resare +*/ +charset_map maps[] = { + {"ISO-8859-1", + { + 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, + 0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, + 0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, + 0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, + 0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, + 0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, + 0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, + 0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, + 0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, + 0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, + 0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, + 0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, + 0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, + 0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, + 0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, + 0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, + 0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087, + 0x0088,0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F, + 0x0090,0x0091,0x0092,0x0093,0x0094,0x0095,0x0096,0x0097, + 0x0098,0x0099,0x009A,0x009B,0x009C,0x009D,0x009E,0x009F, + 0x00A0,0x00A1,0x00A2,0x00A3,0x00A4,0x00A5,0x00A6,0x00A7, + 0x00A8,0x00A9,0x00AA,0x00AB,0x00AC,0x00AD,0x00AE,0x00AF, + 0x00B0,0x00B1,0x00B2,0x00B3,0x00B4,0x00B5,0x00B6,0x00B7, + 0x00B8,0x00B9,0x00BA,0x00BB,0x00BC,0x00BD,0x00BE,0x00BF, + 0x00C0,0x00C1,0x00C2,0x00C3,0x00C4,0x00C5,0x00C6,0x00C7, + 0x00C8,0x00C9,0x00CA,0x00CB,0x00CC,0x00CD,0x00CE,0x00CF, + 0x00D0,0x00D1,0x00D2,0x00D3,0x00D4,0x00D5,0x00D6,0x00D7, + 0x00D8,0x00D9,0x00DA,0x00DB,0x00DC,0x00DD,0x00DE,0x00DF, + 0x00E0,0x00E1,0x00E2,0x00E3,0x00E4,0x00E5,0x00E6,0x00E7, + 0x00E8,0x00E9,0x00EA,0x00EB,0x00EC,0x00ED,0x00EE,0x00EF, + 0x00F0,0x00F1,0x00F2,0x00F3,0x00F4,0x00F5,0x00F6,0x00F7, + 0x00F8,0x00F9,0x00FA,0x00FB,0x00FC,0x00FD,0x00FE,0x00FF + } + }, + {"ISO-8859-2", + { + 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, + 0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, + 0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, + 0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F, + 0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027, + 0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F, + 0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037, + 0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F, + 0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047, + 0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F, + 0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057, + 0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F, + 0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067, + 0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F, + 0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077, + 0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F, + 0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087, + 0x0088,0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F, + 0x0090,0x0091,0x0092,0x0093,0x0094,0x0095,0x0096,0x0097, + 0x0098,0x0099,0x009A,0x009B,0x009C,0x009D,0x009E,0x009F, + 0x00A0,0x0104,0x02D8,0x0141,0x00A4,0x013D,0x015A,0x00A7, + 0x00A8,0x0160,0x015E,0x0164,0x0179,0x00AD,0x017D,0x017B, + 0x00B0,0x0105,0x02DB,0x0142,0x00B4,0x013E,0x015B,0x02C7, + 0x00B8,0x0161,0x015F,0x0165,0x017A,0x02DD,0x017E,0x017C, + 0x0154,0x00C1,0x00C2,0x0102,0x00C4,0x0139,0x0106,0x00C7, + 0x010C,0x00C9,0x0118,0x00CB,0x011A,0x00CD,0x00CE,0x010E, + 0x0110,0x0143,0x0147,0x00D3,0x00D4,0x0150,0x00D6,0x00D7, + 0x0158,0x016E,0x00DA,0x0170,0x00DC,0x00DD,0x0162,0x00DF, + 0x0155,0x00E1,0x00E2,0x0103,0x00E4,0x013A,0x0107,0x00E7, + 0x010D,0x00E9,0x0119,0x00EB,0x011B,0x00ED,0x00EE,0x010F, + 0x0111,0x0144,0x0148,0x00F3,0x00F4,0x0151,0x00F6,0x00F7, + 0x0159,0x016F,0x00FA,0x0171,0x00FC,0x00FD,0x0163,0x02D9 + } + }, + {NULL} +}; diff --git a/Libraries/FLAC/Files/src/share/utf8/iconvert.c b/Libraries/FLAC/Files/src/share/utf8/iconvert.c new file mode 100644 index 000000000..a23168f6c --- /dev/null +++ b/Libraries/FLAC/Files/src/share/utf8/iconvert.c @@ -0,0 +1,248 @@ +/* + * Copyright (C) 2001 Edmund Grimley Evans + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#ifdef HAVE_ICONV + +#include +#include +#include +#include +#include + +/* + * Convert data from one encoding to another. Return: + * + * -2 : memory allocation failed + * -1 : unknown encoding + * 0 : data was converted exactly + * 1 : data was converted inexactly + * 2 : data was invalid (but still converted) + * + * We convert in two steps, via UTF-8, as this is the only + * reliable way of distinguishing between invalid input + * and valid input which iconv refuses to transliterate. + * We convert from UTF-8 twice, because we have no way of + * knowing whether the conversion was exact if iconv returns + * E2BIG (due to a bug in the specification of iconv). + * An alternative approach is to assume that the output of + * iconv is never more than 4 times as long as the input, + * but I prefer to avoid that assumption if possible. + */ + +int iconvert(const char *fromcode, const char *tocode, + const char *from, size_t fromlen, + char **to, size_t *tolen) +{ + int ret = 0; + iconv_t cd1, cd2; + char *ib; + char *ob; + char *utfbuf = 0, *outbuf, *newbuf; + size_t utflen, outlen, ibl, obl, k; + char tbuf[2048]; + + cd1 = iconv_open("UTF-8", fromcode); + if (cd1 == (iconv_t)(-1)) + return -1; + + cd2 = (iconv_t)(-1); + /* Don't use strcasecmp() as it's locale-dependent. */ + if (!strchr("Uu", tocode[0]) || + !strchr("Tt", tocode[1]) || + !strchr("Ff", tocode[2]) || + tocode[3] != '-' || + tocode[4] != '8' || + tocode[5] != '\0') { + char *tocode1; + + /* + * Try using this non-standard feature of glibc and libiconv. + * This is deliberately not a config option as people often + * change their iconv library without rebuilding applications. + */ + tocode1 = (char *)malloc(strlen(tocode) + 11); + if (!tocode1) + goto fail; + + strcpy(tocode1, tocode); + strcat(tocode1, "//TRANSLIT"); + cd2 = iconv_open(tocode1, "UTF-8"); + free(tocode1); + + if (cd2 == (iconv_t)(-1)) + cd2 = iconv_open(tocode, fromcode); + + if (cd2 == (iconv_t)(-1)) { + iconv_close(cd1); + return -1; + } + } + + utflen = 1; /*fromlen * 2 + 1; XXX */ + utfbuf = (char *)malloc(utflen); + if (!utfbuf) + goto fail; + + /* Convert to UTF-8 */ + ib = (char *)from; + ibl = fromlen; + ob = utfbuf; + obl = utflen; + for (;;) { + k = iconv(cd1, &ib, &ibl, &ob, &obl); + assert((!k && !ibl) || + (k == (size_t)(-1) && errno == E2BIG && ibl && obl < 6) || + (k == (size_t)(-1) && + (errno == EILSEQ || errno == EINVAL) && ibl)); + if (!ibl) + break; + if (obl < 6) { + /* Enlarge the buffer */ + utflen *= 2; + newbuf = (char *)realloc(utfbuf, utflen); + if (!newbuf) + goto fail; + ob = (ob - utfbuf) + newbuf; + obl = utflen - (ob - newbuf); + utfbuf = newbuf; + } + else { + /* Invalid input */ + ib++, ibl--; + *ob++ = '#', obl--; + ret = 2; + iconv(cd1, 0, 0, 0, 0); + } + } + + if (cd2 == (iconv_t)(-1)) { + /* The target encoding was UTF-8 */ + if (tolen) + *tolen = ob - utfbuf; + if (!to) { + free(utfbuf); + iconv_close(cd1); + return ret; + } + newbuf = (char *)realloc(utfbuf, (ob - utfbuf) + 1); + if (!newbuf) + goto fail; + ob = (ob - utfbuf) + newbuf; + *ob = '\0'; + *to = newbuf; + iconv_close(cd1); + return ret; + } + + /* Truncate the buffer to be tidy */ + utflen = ob - utfbuf; + newbuf = (char *)realloc(utfbuf, utflen); + if (!newbuf) + goto fail; + utfbuf = newbuf; + + /* Convert from UTF-8 to discover how long the output is */ + outlen = 0; + ib = utfbuf; + ibl = utflen; + while (ibl) { + ob = tbuf; + obl = sizeof(tbuf); + k = iconv(cd2, &ib, &ibl, &ob, &obl); + assert((k != (size_t)(-1) && !ibl) || + (k == (size_t)(-1) && errno == E2BIG && ibl) || + (k == (size_t)(-1) && errno == EILSEQ && ibl)); + if (ibl && !(k == (size_t)(-1) && errno == E2BIG)) { + /* Replace one character */ + char *tb = "?"; + size_t tbl = 1; + + outlen += ob - tbuf; + ob = tbuf; + obl = sizeof(tbuf); + k = iconv(cd2, &tb, &tbl, &ob, &obl); + assert((!k && !tbl) || + (k == (size_t)(-1) && errno == EILSEQ && tbl)); + for (++ib, --ibl; ibl && (*ib & 0x80); ib++, ibl--) + ; + } + outlen += ob - tbuf; + } + ob = tbuf; + obl = sizeof(tbuf); + k = iconv(cd2, 0, 0, &ob, &obl); + assert(!k); + outlen += ob - tbuf; + + /* Convert from UTF-8 for real */ + outbuf = (char *)malloc(outlen + 1); + if (!outbuf) + goto fail; + ib = utfbuf; + ibl = utflen; + ob = outbuf; + obl = outlen; + while (ibl) { + k = iconv(cd2, &ib, &ibl, &ob, &obl); + assert((k != (size_t)(-1) && !ibl) || + (k == (size_t)(-1) && errno == EILSEQ && ibl)); + if (k && !ret) + ret = 1; + if (ibl && !(k == (size_t)(-1) && errno == E2BIG)) { + /* Replace one character */ + char *tb = "?"; + size_t tbl = 1; + + k = iconv(cd2, &tb, &tbl, &ob, &obl); + assert((!k && !tbl) || + (k == (size_t)(-1) && errno == EILSEQ && tbl)); + for (++ib, --ibl; ibl && (*ib & 0x80); ib++, ibl--) + ; + } + } + k = iconv(cd2, 0, 0, &ob, &obl); + assert(!k); + assert(!obl); + *ob = '\0'; + + free(utfbuf); + iconv_close(cd1); + iconv_close(cd2); + if (tolen) + *tolen = outlen; + if (!to) { + free(outbuf); + return ret; + } + *to = outbuf; + return ret; + + fail: + if(0 != utfbuf) + free(utfbuf); + iconv_close(cd1); + if (cd2 != (iconv_t)(-1)) + iconv_close(cd2); + return -2; +} + +#endif /* HAVE_ICONV */ diff --git a/Libraries/FLAC/Files/src/share/utf8/makemap.c b/Libraries/FLAC/Files/src/share/utf8/makemap.c new file mode 100644 index 000000000..e19c1960f --- /dev/null +++ b/Libraries/FLAC/Files/src/share/utf8/makemap.c @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2001 Edmund Grimley Evans + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include +#include +#include + +int main(int argc, char *argv[]) +{ + iconv_t cd; + const char *ib; + char *ob; + size_t ibl, obl, k; + unsigned char c, buf[4]; + int i, wc; + + if (argc != 2) { + printf("Usage: %s ENCODING\n", argv[0]); + printf("Output a charset map for the 8-bit ENCODING.\n"); + return 1; + } + + cd = iconv_open("UCS-4", argv[1]); + if (cd == (iconv_t)(-1)) { + perror("iconv_open"); + return 1; + } + + for (i = 0; i < 256; i++) { + c = i; + ib = &c; + ibl = 1; + ob = buf; + obl = 4; + k = iconv(cd, &ib, &ibl, &ob, &obl); + if (!k && !ibl && !obl) { + wc = (buf[0] << 24) + (buf[1] << 16) + (buf[2] << 8) + buf[3]; + if (wc >= 0xffff) { + printf("Dodgy value.\n"); + return 1; + } + } + else if (k == (size_t)(-1) && errno == EILSEQ) + wc = 0xffff; + else { + printf("Non-standard iconv.\n"); + return 1; + } + + if (i % 8 == 0) + printf(" "); + printf("0x%04x", wc); + if (i == 255) + printf("\n"); + else if (i % 8 == 7) + printf(",\n"); + else + printf(", "); + } + + return 0; +} diff --git a/Libraries/FLAC/Files/src/share/utf8/utf8.c b/Libraries/FLAC/Files/src/share/utf8/utf8.c new file mode 100644 index 000000000..174d51fe7 --- /dev/null +++ b/Libraries/FLAC/Files/src/share/utf8/utf8.c @@ -0,0 +1,319 @@ +/* + * Copyright (C) 2001 Peter Harris + * Copyright (C) 2001 Edmund Grimley Evans + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* + * Convert a string between UTF-8 and the locale's charset. + */ + +#include +#include + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "utf8.h" +#include "charset.h" + + +#ifdef _WIN32 + + /* Thanks to Peter Harris for this win32 + * code. + */ + +#include +#include + +static unsigned char *make_utf8_string(const wchar_t *unicode) +{ + int size = 0, index = 0, out_index = 0; + unsigned char *out; + unsigned short c; + + /* first calculate the size of the target string */ + c = unicode[index++]; + while(c) { + if(c < 0x0080) { + size += 1; + } else if(c < 0x0800) { + size += 2; + } else { + size += 3; + } + c = unicode[index++]; + } + + out = malloc(size + 1); + if (out == NULL) + return NULL; + index = 0; + + c = unicode[index++]; + while(c) + { + if(c < 0x080) { + out[out_index++] = (unsigned char)c; + } else if(c < 0x800) { + out[out_index++] = 0xc0 | (c >> 6); + out[out_index++] = 0x80 | (c & 0x3f); + } else { + out[out_index++] = 0xe0 | (c >> 12); + out[out_index++] = 0x80 | ((c >> 6) & 0x3f); + out[out_index++] = 0x80 | (c & 0x3f); + } + c = unicode[index++]; + } + out[out_index] = 0x00; + + return out; +} + +static wchar_t *make_unicode_string(const unsigned char *utf8) +{ + int size = 0, index = 0, out_index = 0; + wchar_t *out; + unsigned char c; + + /* first calculate the size of the target string */ + c = utf8[index++]; + while(c) { + if((c & 0x80) == 0) { + index += 0; + } else if((c & 0xe0) == 0xe0) { + index += 2; + } else { + index += 1; + } + size += 1; + c = utf8[index++]; + } + + out = malloc((size + 1) * sizeof(wchar_t)); + if (out == NULL) + return NULL; + index = 0; + + c = utf8[index++]; + while(c) + { + if((c & 0x80) == 0) { + out[out_index++] = c; + } else if((c & 0xe0) == 0xe0) { + out[out_index] = (c & 0x1F) << 12; + c = utf8[index++]; + out[out_index] |= (c & 0x3F) << 6; + c = utf8[index++]; + out[out_index++] |= (c & 0x3F); + } else { + out[out_index] = (c & 0x3F) << 6; + c = utf8[index++]; + out[out_index++] |= (c & 0x3F); + } + c = utf8[index++]; + } + out[out_index] = 0; + + return out; +} + +int utf8_encode(const char *from, char **to) +{ + wchar_t *unicode; + int wchars, err; + + wchars = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, from, + strlen(from), NULL, 0); + + if(wchars == 0) + { + fprintf(stderr, "Unicode translation error %d\n", GetLastError()); + return -1; + } + + unicode = calloc(wchars + 1, sizeof(unsigned short)); + if(unicode == NULL) + { + fprintf(stderr, "Out of memory processing string to UTF8\n"); + return -1; + } + + err = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, from, + strlen(from), unicode, wchars); + if(err != wchars) + { + free(unicode); + fprintf(stderr, "Unicode translation error %d\n", GetLastError()); + return -1; + } + + /* On NT-based windows systems, we could use WideCharToMultiByte(), but + * MS doesn't actually have a consistent API across win32. + */ + *to = make_utf8_string(unicode); + + free(unicode); + return 0; +} + +int utf8_decode(const char *from, char **to) +{ + wchar_t *unicode; + int chars, err; + + /* On NT-based windows systems, we could use MultiByteToWideChar(CP_UTF8), but + * MS doesn't actually have a consistent API across win32. + */ + unicode = make_unicode_string(from); + if(unicode == NULL) + { + fprintf(stderr, "Out of memory processing string from UTF8 to UNICODE16\n"); + return -1; + } + + chars = WideCharToMultiByte(GetConsoleCP(), WC_COMPOSITECHECK, unicode, + -1, NULL, 0, NULL, NULL); + + if(chars == 0) + { + fprintf(stderr, "Unicode translation error %d\n", GetLastError()); + free(unicode); + return -1; + } + + *to = calloc(chars + 1, sizeof(unsigned char)); + if(*to == NULL) + { + fprintf(stderr, "Out of memory processing string to local charset\n"); + free(unicode); + return -1; + } + + err = WideCharToMultiByte(GetConsoleCP(), WC_COMPOSITECHECK, unicode, + -1, *to, chars, NULL, NULL); + if(err != chars) + { + fprintf(stderr, "Unicode translation error %d\n", GetLastError()); + free(unicode); + free(*to); + *to = NULL; + return -1; + } + + free(unicode); + return 0; +} + +#else /* End win32. Rest is for real operating systems */ + + +#ifdef HAVE_LANGINFO_CODESET +#include +#endif + +int iconvert(const char *fromcode, const char *tocode, + const char *from, size_t fromlen, + char **to, size_t *tolen); + +static char *current_charset = 0; /* means "US-ASCII" */ + +void convert_set_charset(const char *charset) +{ + +#ifdef HAVE_LANGINFO_CODESET + if (!charset) + charset = nl_langinfo(CODESET); +#endif + + if (!charset) + charset = getenv("CHARSET"); + + free(current_charset); + current_charset = 0; + if (charset && *charset) + current_charset = strdup(charset); +} + +static int convert_buffer(const char *fromcode, const char *tocode, + const char *from, size_t fromlen, + char **to, size_t *tolen) +{ + int ret = -1; + +#ifdef HAVE_ICONV + ret = iconvert(fromcode, tocode, from, fromlen, to, tolen); + if (ret != -1) + return ret; +#endif + +#ifndef HAVE_ICONV /* should be ifdef USE_CHARSET_CONVERT */ + ret = charset_convert(fromcode, tocode, from, fromlen, to, tolen); + if (ret != -1) + return ret; +#endif + + return ret; +} + +static int convert_string(const char *fromcode, const char *tocode, + const char *from, char **to, char replace) +{ + int ret; + size_t fromlen; + char *s; + + fromlen = strlen(from); + ret = convert_buffer(fromcode, tocode, from, fromlen, to, 0); + if (ret == -2) + return -1; + if (ret != -1) + return ret; + + s = malloc(fromlen + 1); + if (!s) + return -1; + strcpy(s, from); + *to = s; + for (; *s; s++) + if (*s & ~0x7f) + *s = replace; + return 3; +} + +int utf8_encode(const char *from, char **to) +{ + char *charset; + + if (!current_charset) + convert_set_charset(0); + charset = current_charset ? current_charset : "US-ASCII"; + return convert_string(charset, "UTF-8", from, to, '#'); +} + +int utf8_decode(const char *from, char **to) +{ + char *charset; + + if (!current_charset) + convert_set_charset(0); + charset = current_charset ? current_charset : "US-ASCII"; + return convert_string("UTF-8", charset, from, to, '?'); +} + +#endif diff --git a/Libraries/FLAC/Files/src/share/utf8/utf8_static.dsp b/Libraries/FLAC/Files/src/share/utf8/utf8_static.dsp new file mode 100644 index 000000000..0e38c0570 --- /dev/null +++ b/Libraries/FLAC/Files/src/share/utf8/utf8_static.dsp @@ -0,0 +1,116 @@ +# Microsoft Developer Studio Project File - Name="utf8_static" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Static Library" 0x0104 + +CFG=utf8_static - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "utf8_static.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "utf8_static.mak" CFG="utf8_static - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "utf8_static - Win32 Release" (based on "Win32 (x86) Static Library") +!MESSAGE "utf8_static - Win32 Debug" (based on "Win32 (x86) Static Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "utf8" +# PROP Scc_LocalPath "..\..\.." +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "utf8_static - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "..\..\..\obj\release\lib" +# PROP Intermediate_Dir "Release_static" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I ".\include" /I "..\..\..\include\share" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo /nodefaultlib + +!ELSEIF "$(CFG)" == "utf8_static - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "..\..\..\obj\debug\lib" +# PROP Intermediate_Dir "Debug_static" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".\include" /I "..\..\..\include\share" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo /nodefaultlib + +!ENDIF + +# Begin Target + +# Name "utf8_static - Win32 Release" +# Name "utf8_static - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "c" +# Begin Source File + +SOURCE=.\charset.c +# End Source File +# Begin Source File + +SOURCE=.\iconvert.c +# End Source File +# Begin Source File + +SOURCE=.\utf8.c +# End Source File +# End Group +# Begin Group "Private Header Files" + +# PROP Default_Filter "" +# End Group +# Begin Group "Protected Header Files" + +# PROP Default_Filter "" +# End Group +# Begin Group "Public Header Files" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=..\..\..\include\share\utf8.h +# End Source File +# End Group +# End Target +# End Project diff --git a/Libraries/FLAC/Info.plist b/Libraries/FLAC/Info.plist new file mode 100644 index 000000000..946e3bbaa --- /dev/null +++ b/Libraries/FLAC/Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + FLAC + CFBundleIconFile + + CFBundleIdentifier + com.apple.carbonframeworktemplate + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + FMWK + CFBundleSignature + ???? + CFBundleVersion + 1.0 + CFBundleShortVersionString + 1.0 + CSResourcesFileMapped + + + diff --git a/Libraries/MAC/.DS_Store b/Libraries/MAC/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..138949646b4a272ce3d95e098407c3743bedef3d GIT binary patch literal 6148 zcmeHK!AiqG5Pe%KwhGdt$M^#U{~*>@=)sdWPtvs3NHAh8coFh#{+Pa*SxaKttEkMt z%-d{cW_RB%nGJw2TF=jb0e~J=u+yj6BJy6eC7sxFKn$8=J}t^@R+O`ruXp@T24wH{ zF~b@;3e@*cj>HZ1^g~6bU-QhfWf^z+>u_}GbBGBZv1G0sE8Jtq))Ssl;-Pjnm^&P| za$o8k7Fd1reBbT4a~4z1;*O&ZIl9f|rI}UN_EuY4A6GcX1tVUOF>;PYGeT!vk5Ee7 zI0MdrGw=r)V9gfk9T~cH2AlzBV8eiX9}=oy8nH6ePX~?u0ubfur^2>e93>`+m`1D& z`GyiKlxU$L{$d0RXMYm?(ukFzg(K+5%o9fr@e&$zboM9ej*uFqyR-Xa*mdJTLf}TvlLrki z7Ai`!S&mF5J)I1)cIIBSd&;o;6CcyJ_HVZme@51oj0<1wQm^9f|5gT0c1*!pC+0}> E2LZGfMgRZ+ literal 0 HcmV?d00001 diff --git a/Libraries/MAC/Files/.DS_Store b/Libraries/MAC/Files/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..236c3f1cefe3237eae725580d5d7890e5f0dcf90 GIT binary patch literal 6148 zcmeHKOHRW;47E#zir93?a<~E9AgbC0>+V=V(*ltqf?5@}xhAK9=T9S&6vPHZku7=N z#IZdyZ$|SWBA#rQmqcSC8bJjICn)xa{1@%Xz%BBVHOGpUS7nti%4*T`4#Qt$K<4h4 z=JY_fw5Im_$)dQ1zP_nw_glV2eqZ@q?-t0go3F?>PaPjgBzY>@qRpIEAJ)vS&GSy1 zjqlw{apC#ISEa}wpJfF?T6w?dUz6`U{VO+n$Dj>H5ex(a!N37BU^^y_P7ko}(dA$u z82DKRWPeCd!OXEX)U5-BJ^_Go?NdQruVug_24Ln`8^Qu%3k6yz`xApL9QNdXnPY8e z;l$c9@_5Va7f|*~At!Yw&J3dr27-Y$14s5bmh*r1`TM^e6kowWFz~M!;Nf&WonT0Q xw)O@mXKjMsKt;r_Hf%yr(W4l?aulCIRbWq20cMW1AuN!%2q+Cv1Ovayz&qTUOHTj* literal 0 HcmV?d00001 diff --git a/Libraries/MAC/Files/Shared/.DS_Store b/Libraries/MAC/Files/Shared/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..3e838cc96d15ebd363ffb36a575933dfc02e6f90 GIT binary patch literal 6148 zcmeHK!AiqG5PeglM7{LrMc6M8{DWBALqSofcWV_?s1&5$^PgV)6MZwYl%`v+B4wt` zykzobGy77qSpYKlcsd9A0BX8o?~q}O>2>wOdO34I6dU7ZJYPJ{=8IXujl};{K%d<{ zE->fs4C~KN{}T7~^lfJC*JR#eggZRox#Y{~2EW1>H(Pk08@w9V9QhK%?S0s|ZKn_C zU*Q$Aa(wIiYmI+|3EtTAJC^K!Ni60n+S7WCO*ld*5DJ6>JE;KIY_F=8kX3WNeH z1@!%p=!#9o*3n)a47LRzR!p1mSU()KCS`0gwvN0)6E7utspKt&cscVa^O}sUqnAVS z=0ozGCGSwg?#}U((IJgv#84m<=qj-1r+r=jN5Aj?yG3yp3WNeXrGQk!$#B3a<+Zh# voUXNrKBcQEuXS9N@W7U0a&;*_p_?(E^nlo8Y#o`Q#fN~&5Fr%!Qw4qi_hDGW literal 0 HcmV?d00001 diff --git a/Libraries/MAC/Files/Shared/APETag.h b/Libraries/MAC/Files/Shared/APETag.h new file mode 100755 index 000000000..e17de5b80 --- /dev/null +++ b/Libraries/MAC/Files/Shared/APETag.h @@ -0,0 +1,293 @@ +#ifndef APE_APETAG_H +#define APE_APETAG_H + +class CIO; + +/***************************************************************************************** +APETag version history / supported formats + +1.0 (1000) - Original APE tag spec. Fully supported by this code. +2.0 (2000) - Refined APE tag spec (better streaming support, UTF encoding). Fully supported by this code. + +Notes: + - also supports reading of ID3v1.1 tags + - all saving done in the APE Tag format using CURRENT_APE_TAG_VERSION +*****************************************************************************************/ + +/***************************************************************************************** +APETag layout + +1) Header - APE_TAG_FOOTER (optional) (32 bytes) +2) Fields (array): + Value Size (4 bytes) + Flags (4 bytes) + Field Name (? ANSI bytes -- requires NULL terminator -- in range of 0x20 (space) to 0x7E (tilde)) + Value ([Value Size] bytes) +3) Footer - APE_TAG_FOOTER (32 bytes) +*****************************************************************************************/ + +/***************************************************************************************** +Notes + +-When saving images, store the filename (no directory -- i.e. Cover.jpg) in UTF-8 followed +by a null terminator, followed by the image data. +*****************************************************************************************/ + +/***************************************************************************************** +The version of the APE tag +*****************************************************************************************/ +#define CURRENT_APE_TAG_VERSION 2000 + +/***************************************************************************************** +"Standard" APE tag fields +*****************************************************************************************/ +#define APE_TAG_FIELD_TITLE L"Title" +#define APE_TAG_FIELD_ARTIST L"Artist" +#define APE_TAG_FIELD_ALBUM L"Album" +#define APE_TAG_FIELD_COMMENT L"Comment" +#define APE_TAG_FIELD_YEAR L"Year" +#define APE_TAG_FIELD_TRACK L"Track" +#define APE_TAG_FIELD_GENRE L"Genre" +#define APE_TAG_FIELD_COVER_ART_FRONT L"Cover Art (front)" +#define APE_TAG_FIELD_NOTES L"Notes" +#define APE_TAG_FIELD_LYRICS L"Lyrics" +#define APE_TAG_FIELD_COPYRIGHT L"Copyright" +#define APE_TAG_FIELD_BUY_URL L"Buy URL" +#define APE_TAG_FIELD_ARTIST_URL L"Artist URL" +#define APE_TAG_FIELD_PUBLISHER_URL L"Publisher URL" +#define APE_TAG_FIELD_FILE_URL L"File URL" +#define APE_TAG_FIELD_COPYRIGHT_URL L"Copyright URL" +#define APE_TAG_FIELD_MJ_METADATA L"Media Jukebox Metadata" +#define APE_TAG_FIELD_TOOL_NAME L"Tool Name" +#define APE_TAG_FIELD_TOOL_VERSION L"Tool Version" +#define APE_TAG_FIELD_PEAK_LEVEL L"Peak Level" +#define APE_TAG_FIELD_REPLAY_GAIN_RADIO L"Replay Gain (radio)" +#define APE_TAG_FIELD_REPLAY_GAIN_ALBUM L"Replay Gain (album)" +#define APE_TAG_FIELD_COMPOSER L"Composer" +#define APE_TAG_FIELD_KEYWORDS L"Keywords" + +/***************************************************************************************** +Standard APE tag field values +*****************************************************************************************/ +#define APE_TAG_GENRE_UNDEFINED L"Undefined" + +/***************************************************************************************** +ID3 v1.1 tag +*****************************************************************************************/ +#define ID3_TAG_BYTES 128 +struct ID3_TAG +{ + char Header[3]; // should equal 'TAG' + char Title[30]; // title + char Artist[30]; // artist + char Album[30]; // album + char Year[4]; // year + char Comment[29]; // comment + unsigned char Track; // track + unsigned char Genre; // genre +}; + +/***************************************************************************************** +Footer (and header) flags +*****************************************************************************************/ +#define APE_TAG_FLAG_CONTAINS_HEADER (1 << 31) +#define APE_TAG_FLAG_CONTAINS_FOOTER (1 << 30) +#define APE_TAG_FLAG_IS_HEADER (1 << 29) + +#define APE_TAG_FLAGS_DEFAULT (APE_TAG_FLAG_CONTAINS_FOOTER) + +/***************************************************************************************** +Tag field flags +*****************************************************************************************/ +#define TAG_FIELD_FLAG_READ_ONLY (1 << 0) + +#define TAG_FIELD_FLAG_DATA_TYPE_MASK (6) +#define TAG_FIELD_FLAG_DATA_TYPE_TEXT_UTF8 (0 << 1) +#define TAG_FIELD_FLAG_DATA_TYPE_BINARY (1 << 1) +#define TAG_FIELD_FLAG_DATA_TYPE_EXTERNAL_INFO (2 << 1) +#define TAG_FIELD_FLAG_DATA_TYPE_RESERVED (3 << 1) + +/***************************************************************************************** +The footer at the end of APE tagged files (can also optionally be at the front of the tag) +*****************************************************************************************/ +#define APE_TAG_FOOTER_BYTES 32 + +class APE_TAG_FOOTER +{ +protected: + + char m_cID[8]; // should equal 'APETAGEX' + int m_nVersion; // equals CURRENT_APE_TAG_VERSION + int m_nSize; // the complete size of the tag, including this footer (excludes header) + int m_nFields; // the number of fields in the tag + int m_nFlags; // the tag flags + char m_cReserved[8]; // reserved for later use (must be zero) + +public: + + APE_TAG_FOOTER(int nFields = 0, int nFieldBytes = 0) + { + memcpy(m_cID, "APETAGEX", 8); + memset(m_cReserved, 0, 8); + m_nFields = nFields; + m_nFlags = APE_TAG_FLAGS_DEFAULT; + m_nSize = nFieldBytes + APE_TAG_FOOTER_BYTES; + m_nVersion = CURRENT_APE_TAG_VERSION; + } + + int GetTotalTagBytes() { return m_nSize + (GetHasHeader() ? APE_TAG_FOOTER_BYTES : 0); } + int GetFieldBytes() { return m_nSize - APE_TAG_FOOTER_BYTES; } + int GetFieldsOffset() { return GetHasHeader() ? APE_TAG_FOOTER_BYTES : 0; } + int GetNumberFields() { return m_nFields; } + BOOL GetHasHeader() { return (m_nFlags & APE_TAG_FLAG_CONTAINS_HEADER) ? TRUE : FALSE; } + BOOL GetIsHeader() { return (m_nFlags & APE_TAG_FLAG_IS_HEADER) ? TRUE : FALSE; } + int GetVersion() { return m_nVersion; } + + BOOL GetIsValid(BOOL bAllowHeader) + { + BOOL bValid = (strncmp(m_cID, "APETAGEX", 8) == 0) && + (m_nVersion <= CURRENT_APE_TAG_VERSION) && + (m_nFields <= 65536) && + (GetFieldBytes() <= (1024 * 1024 * 16)); + + if (bValid && (bAllowHeader == FALSE) && GetIsHeader()) + bValid = FALSE; + + return bValid ? TRUE : FALSE; + } +}; + +/***************************************************************************************** +CAPETagField class (an APE tag is an array of these) +*****************************************************************************************/ +class CAPETagField +{ +public: + + // create a tag field (use nFieldBytes = -1 for null-terminated strings) + CAPETagField(const str_utf16 * pFieldName, const void * pFieldValue, int nFieldBytes = -1, int nFlags = 0); + + // destructor + ~CAPETagField(); + + // gets the size of the entire field in bytes (name, value, and metadata) + int GetFieldSize(); + + // get the name of the field + const str_utf16 * GetFieldName(); + + // get the value of the field + const char * GetFieldValue(); + + // get the size of the value (in bytes) + int GetFieldValueSize(); + + // get any special flags + int GetFieldFlags(); + + // output the entire field to a buffer (GetFieldSize() bytes) + int SaveField(char * pBuffer); + + // checks to see if the field is read-only + BOOL GetIsReadOnly() { return (m_nFieldFlags & TAG_FIELD_FLAG_READ_ONLY) ? TRUE : FALSE; } + BOOL GetIsUTF8Text() { return ((m_nFieldFlags & TAG_FIELD_FLAG_DATA_TYPE_MASK) == TAG_FIELD_FLAG_DATA_TYPE_TEXT_UTF8) ? TRUE : FALSE; } + + // set helpers (use with EXTREME caution) + void SetFieldFlags(int nFlags) { m_nFieldFlags = nFlags; } + +private: + + CSmartPtr m_spFieldNameUTF16; + CSmartPtr m_spFieldValue; + int m_nFieldFlags; + int m_nFieldValueBytes; +}; + +/***************************************************************************************** +CAPETag class +*****************************************************************************************/ +class CAPETag +{ +public: + + // create an APE tag + // bAnalyze determines whether it will analyze immediately or on the first request + // be careful with multiple threads / file pointer movement if you don't analyze immediately + CAPETag(CIO * pIO, BOOL bAnalyze = TRUE); + CAPETag(const str_utf16 * pFilename, BOOL bAnalyze = TRUE); + + // destructor + ~CAPETag(); + + // save the tag to the I/O source (bUseOldID3 forces it to save as an ID3v1.1 tag instead of an APE tag) + int Save(BOOL bUseOldID3 = FALSE); + + // removes any tags from the file (bUpdate determines whether is should re-analyze after removing the tag) + int Remove(BOOL bUpdate = TRUE); + + // sets the value of a field (use nFieldBytes = -1 for null terminated strings) + // note: using NULL or "" for a string type will remove the field + int SetFieldString(const str_utf16 * pFieldName, const str_utf16 * pFieldValue); + int SetFieldString(const str_utf16 * pFieldName, const char * pFieldValue, BOOL bAlreadyUTF8Encoded); + int SetFieldBinary(const str_utf16 * pFieldName, const void * pFieldValue, int nFieldBytes, int nFieldFlags); + + // gets the value of a field (returns -1 and an empty buffer if the field doesn't exist) + int GetFieldBinary(const str_utf16 * pFieldName, void * pBuffer, int * pBufferBytes); + int GetFieldString(const str_utf16 * pFieldName, str_utf16 * pBuffer, int * pBufferCharacters); + int GetFieldString(const str_utf16 * pFieldName, str_ansi * pBuffer, int * pBufferCharacters, BOOL bUTF8Encode = FALSE); + + // remove a specific field + int RemoveField(const str_utf16 * pFieldName); + int RemoveField(int nIndex); + + // clear all the fields + int ClearFields(); + + // get the total tag bytes in the file from the last analyze + // need to call Save() then Analyze() to update any changes + int GetTagBytes(); + + // fills in an ID3_TAG using the current fields (useful for quickly converting the tag) + int CreateID3Tag(ID3_TAG * pID3Tag); + + // see whether the file has an ID3 or APE tag + BOOL GetHasID3Tag() { if (m_bAnalyzed == FALSE) { Analyze(); } return m_bHasID3Tag; } + BOOL GetHasAPETag() { if (m_bAnalyzed == FALSE) { Analyze(); } return m_bHasAPETag; } + int GetAPETagVersion() { return GetHasAPETag() ? m_nAPETagVersion : -1; } + + // gets a desired tag field (returns NULL if not found) + // again, be careful, because this a pointer to the actual field in this class + CAPETagField * GetTagField(const str_utf16 * pFieldName); + CAPETagField * GetTagField(int nIndex); + + // options + void SetIgnoreReadOnly(BOOL bIgnoreReadOnly) { m_bIgnoreReadOnly = bIgnoreReadOnly; } + +private: + + // private functions + int Analyze(); + int GetTagFieldIndex(const str_utf16 * pFieldName); + int WriteBufferToEndOfIO(void * pBuffer, int nBytes); + int LoadField(const char * pBuffer, int nMaximumBytes, int * pBytes); + int SortFields(); + static int CompareFields(const void * pA, const void * pB); + + // helper set / get field functions + int SetFieldID3String(const str_utf16 * pFieldName, const char * pFieldValue, int nBytes); + int GetFieldID3String(const str_utf16 * pFieldName, char * pBuffer, int nBytes); + + // private data + CSmartPtr m_spIO; + BOOL m_bAnalyzed; + int m_nTagBytes; + int m_nFields; + CAPETagField * m_aryFields[256]; + BOOL m_bHasAPETag; + int m_nAPETagVersion; + BOOL m_bHasID3Tag; + BOOL m_bIgnoreReadOnly; +}; + +#endif // #ifndef APE_APETAG_H + diff --git a/Libraries/MAC/Files/Shared/All.h b/Libraries/MAC/Files/Shared/All.h new file mode 100755 index 000000000..2e31ac59a --- /dev/null +++ b/Libraries/MAC/Files/Shared/All.h @@ -0,0 +1,250 @@ +#ifndef APE_ALL_H +#define APE_ALL_H + +/***************************************************************************************** +Cross platform building switch +*****************************************************************************************/ +#define BUILD_CROSS_PLATFORM + +/***************************************************************************************** +Unicode +*****************************************************************************************/ +#ifdef _UNICODE + +#else + +#endif // #ifdef _UNICODE + + +/***************************************************************************************** +Global includes +*****************************************************************************************/ +#ifndef BUILD_CROSS_PLATFORM + #include +#endif + +#ifdef _WIN32 + #include + #include +#else +#warning NO WINDOWS 2 + #include + #include + #include + #include + #include + #include "NoWindows.h" +#endif + +#include +#include +#include +#include +#include +#include "SmartPtr.h" + +/***************************************************************************************** +Global compiler settings (useful for porting) +*****************************************************************************************/ +#ifndef BUILD_CROSS_PLATFORM + #define ENABLE_ASSEMBLY +#endif + +//#define BACKWARDS_COMPATIBILITY + +#define ENABLE_COMPRESSION_MODE_FAST +#define ENABLE_COMPRESSION_MODE_NORMAL +#define ENABLE_COMPRESSION_MODE_HIGH +#define ENABLE_COMPRESSION_MODE_EXTRA_HIGH + +#ifdef _WIN32 + typedef unsigned __int32 uint32; + typedef __int32 int32; + typedef unsigned __int16 uint16; + typedef __int16 int16; + typedef unsigned __int8 uint8; + typedef __int8 int8; + typedef char str_ansi; + typedef unsigned char str_utf8; + typedef wchar_t str_utf16; + + #define IO_USE_WIN_FILE_IO + #define IO_HEADER_FILE "WinFileIO.h" + #define IO_CLASS_NAME CWinFileIO + #define DLLEXPORT __declspec(dllexport) + #define SLEEP(MILLISECONDS) ::Sleep(MILLISECONDS) + #define MESSAGEBOX(PARENT, TEXT, CAPTION, TYPE) ::MessageBox(PARENT, TEXT, CAPTION, TYPE) + #define PUMP_MESSAGE_LOOP { MSG Msg; while (PeekMessage(&Msg, NULL, 0, 0, PM_REMOVE) != 0) { TranslateMessage(&Msg); DispatchMessage(&Msg); } } + #define ODS OutputDebugString + #define TICK_COUNT_TYPE unsigned long + #define TICK_COUNT_READ(VARIABLE) VARIABLE = GetTickCount() + #define TICK_COUNT_FREQ 1000 +#else + #define IO_USE_STD_LIB_FILE_IO + #define IO_HEADER_FILE "StdLibFileIO.h" + #define IO_CLASS_NAME CStdLibFileIO + #define DLLEXPORT + #define SLEEP(MILLISECONDS) { struct timespec t; t.tv_sec = (MILLISECONDS) / 1000; t.tv_nsec = (MILLISECONDS) % 1000 * 1000000; nanosleep(&t, NULL); } + #define MESSAGEBOX(PARENT, TEXT, CAPTION, TYPE) + #define PUMP_MESSAGE_LOOP + #define ODS printf + #define TICK_COUNT_TYPE unsigned long long + #define TICK_COUNT_READ(VARIABLE) { struct timeval t; gettimeofday(&t, NULL); VARIABLE = t.tv_sec * 1000000LLU + t.tv_usec; } + #define TICK_COUNT_FREQ 1000000 +#endif + +/***************************************************************************************** +Global defines +*****************************************************************************************/ +#define MAC_VERSION_NUMBER 3990 +#define MAC_VERSION_STRING _T("3.99") +#define MAC_NAME _T("Monkey's Audio 3.99") +#define PLUGIN_NAME "Monkey's Audio Player v3.99" +#define MJ_PLUGIN_NAME _T("APE Plugin (v3.99)") +#define CONSOLE_NAME "--- Monkey's Audio Console Front End (v 3.99) (c) Matthew T. Ashland ---\n" +#define PLUGIN_ABOUT _T("Monkey's Audio Player v3.99\nCopyrighted (c) 2000-2004 by Matthew T. Ashland") +#define MAC_DLL_INTERFACE_VERSION_NUMBER 1000 + +/***************************************************************************************** +Byte order +*****************************************************************************************/ +#define __LITTLE_ENDIAN 1234 +#define __BIG_ENDIAN 4321 +#define __BYTE_ORDER __BIG_ENDIAN + +/***************************************************************************************** +Macros +*****************************************************************************************/ +#define MB(TEST) MESSAGEBOX(NULL, TEST, _T("Information"), MB_OK); +#define MBN(NUMBER) { TCHAR cNumber[16]; _stprintf(cNumber, _T("%d"), NUMBER); MESSAGEBOX(NULL, cNumber, _T("Information"), MB_OK); } + +#define SAFE_DELETE(POINTER) if (POINTER) { delete POINTER; POINTER = NULL; } +#define SAFE_ARRAY_DELETE(POINTER) if (POINTER) { delete [] POINTER; POINTER = NULL; } +#define SAFE_VOID_CLASS_DELETE(POINTER, Class) { Class *pClass = (Class *) POINTER; if (pClass) { delete pClass; POINTER = NULL; } } +#define SAFE_FILE_CLOSE(HANDLE) if (HANDLE != INVALID_HANDLE_VALUE) { CloseHandle(HANDLE); HANDLE = INVALID_HANDLE_VALUE; } + +#define ODN(NUMBER) { TCHAR cNumber[16]; _stprintf(cNumber, _T("%d\n"), int(NUMBER)); ODS(cNumber); } + +#define CATCH_ERRORS(CODE) try { CODE } catch(...) { } + +#define RETURN_ON_ERROR(FUNCTION) { int nRetVal = FUNCTION; if (nRetVal != 0) { return nRetVal; } } +#define RETURN_VALUE_ON_ERROR(FUNCTION, VALUE) { int nRetVal = FUNCTION; if (nRetVal != 0) { return VALUE; } } +#define RETURN_ON_EXCEPTION(CODE, VALUE) { try { CODE } catch(...) { return VALUE; } } + +#define THROW_ON_ERROR(CODE) { int nRetVal = CODE; if (nRetVal != 0) throw(nRetVal); } + +#define EXPAND_1_TIMES(CODE) CODE +#define EXPAND_2_TIMES(CODE) CODE CODE +#define EXPAND_3_TIMES(CODE) CODE CODE CODE +#define EXPAND_4_TIMES(CODE) CODE CODE CODE CODE +#define EXPAND_5_TIMES(CODE) CODE CODE CODE CODE CODE +#define EXPAND_6_TIMES(CODE) CODE CODE CODE CODE CODE CODE +#define EXPAND_7_TIMES(CODE) CODE CODE CODE CODE CODE CODE CODE +#define EXPAND_8_TIMES(CODE) CODE CODE CODE CODE CODE CODE CODE CODE +#define EXPAND_9_TIMES(CODE) CODE CODE CODE CODE CODE CODE CODE CODE CODE +#define EXPAND_12_TIMES(CODE) CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE +#define EXPAND_14_TIMES(CODE) CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE +#define EXPAND_15_TIMES(CODE) CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE +#define EXPAND_16_TIMES(CODE) CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE +#define EXPAND_30_TIMES(CODE) CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE +#define EXPAND_31_TIMES(CODE) CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE +#define EXPAND_32_TIMES(CODE) CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE +#define EXPAND_64_TIMES(CODE) CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE +#define EXPAND_N_TIMES(NUMBER, CODE) EXPAND_##NUMBER##_TIMES(CODE) + +#define UNROLL_4_TIMES(MACRO) MACRO(0) MACRO(1) MACRO(2) MACRO(3) +#define UNROLL_8_TIMES(MACRO) MACRO(0) MACRO(1) MACRO(2) MACRO(3) MACRO(4) MACRO(5) MACRO(6) MACRO(7) +#define UNROLL_15_TIMES(MACRO) MACRO(0) MACRO(1) MACRO(2) MACRO(3) MACRO(4) MACRO(5) MACRO(6) MACRO(7) MACRO(8) MACRO(9) MACRO(10) MACRO(11) MACRO(12) MACRO(13) MACRO(14) +#define UNROLL_16_TIMES(MACRO) MACRO(0) MACRO(1) MACRO(2) MACRO(3) MACRO(4) MACRO(5) MACRO(6) MACRO(7) MACRO(8) MACRO(9) MACRO(10) MACRO(11) MACRO(12) MACRO(13) MACRO(14) MACRO(15) +#define UNROLL_64_TIMES(MACRO) MACRO(0) MACRO(1) MACRO(2) MACRO(3) MACRO(4) MACRO(5) MACRO(6) MACRO(7) MACRO(8) MACRO(9) MACRO(10) MACRO(11) MACRO(12) MACRO(13) MACRO(14) MACRO(15) MACRO(16) MACRO(17) MACRO(18) MACRO(19) MACRO(20) MACRO(21) MACRO(22) MACRO(23) MACRO(24) MACRO(25) MACRO(26) MACRO(27) MACRO(28) MACRO(29) MACRO(30) MACRO(31) MACRO(32) MACRO(33) MACRO(34) MACRO(35) MACRO(36) MACRO(37) MACRO(38) MACRO(39) MACRO(40) MACRO(41) MACRO(42) MACRO(43) MACRO(44) MACRO(45) MACRO(46) MACRO(47) MACRO(48) MACRO(49) MACRO(50) MACRO(51) MACRO(52) MACRO(53) MACRO(54) MACRO(55) MACRO(56) MACRO(57) MACRO(58) MACRO(59) MACRO(60) MACRO(61) MACRO(62) MACRO(63) +#define UNROLL_128_TIMES(MACRO) MACRO(0) MACRO(1) MACRO(2) MACRO(3) MACRO(4) MACRO(5) MACRO(6) MACRO(7) MACRO(8) MACRO(9) MACRO(10) MACRO(11) MACRO(12) MACRO(13) MACRO(14) MACRO(15) MACRO(16) MACRO(17) MACRO(18) MACRO(19) MACRO(20) MACRO(21) MACRO(22) MACRO(23) MACRO(24) MACRO(25) MACRO(26) MACRO(27) MACRO(28) MACRO(29) MACRO(30) MACRO(31) MACRO(32) MACRO(33) MACRO(34) MACRO(35) MACRO(36) MACRO(37) MACRO(38) MACRO(39) MACRO(40) MACRO(41) MACRO(42) MACRO(43) MACRO(44) MACRO(45) MACRO(46) MACRO(47) MACRO(48) MACRO(49) MACRO(50) MACRO(51) MACRO(52) MACRO(53) MACRO(54) MACRO(55) MACRO(56) MACRO(57) MACRO(58) MACRO(59) MACRO(60) MACRO(61) MACRO(62) MACRO(63) MACRO(64) MACRO(65) MACRO(66) MACRO(67) MACRO(68) MACRO(69) MACRO(70) MACRO(71) MACRO(72) MACRO(73) MACRO(74) MACRO(75) MACRO(76) MACRO(77) MACRO(78) MACRO(79) MACRO(80) MACRO(81) MACRO(82) MACRO(83) MACRO(84) MACRO(85) MACRO(86) MACRO(87) MACRO(88) MACRO(89) MACRO(90) MACRO(91) MACRO(92) MACRO(93) MACRO(94) MACRO(95) MACRO(96) MACRO(97) MACRO(98) MACRO(99) MACRO(100) MACRO(101) MACRO(102) MACRO(103) MACRO(104) MACRO(105) MACRO(106) MACRO(107) MACRO(108) MACRO(109) MACRO(110) MACRO(111) MACRO(112) MACRO(113) MACRO(114) MACRO(115) MACRO(116) MACRO(117) MACRO(118) MACRO(119) MACRO(120) MACRO(121) MACRO(122) MACRO(123) MACRO(124) MACRO(125) MACRO(126) MACRO(127) +#define UNROLL_256_TIMES(MACRO) MACRO(0) MACRO(1) MACRO(2) MACRO(3) MACRO(4) MACRO(5) MACRO(6) MACRO(7) MACRO(8) MACRO(9) MACRO(10) MACRO(11) MACRO(12) MACRO(13) MACRO(14) MACRO(15) MACRO(16) MACRO(17) MACRO(18) MACRO(19) MACRO(20) MACRO(21) MACRO(22) MACRO(23) MACRO(24) MACRO(25) MACRO(26) MACRO(27) MACRO(28) MACRO(29) MACRO(30) MACRO(31) MACRO(32) MACRO(33) MACRO(34) MACRO(35) MACRO(36) MACRO(37) MACRO(38) MACRO(39) MACRO(40) MACRO(41) MACRO(42) MACRO(43) MACRO(44) MACRO(45) MACRO(46) MACRO(47) MACRO(48) MACRO(49) MACRO(50) MACRO(51) MACRO(52) MACRO(53) MACRO(54) MACRO(55) MACRO(56) MACRO(57) MACRO(58) MACRO(59) MACRO(60) MACRO(61) MACRO(62) MACRO(63) MACRO(64) MACRO(65) MACRO(66) MACRO(67) MACRO(68) MACRO(69) MACRO(70) MACRO(71) MACRO(72) MACRO(73) MACRO(74) MACRO(75) MACRO(76) MACRO(77) MACRO(78) MACRO(79) MACRO(80) MACRO(81) MACRO(82) MACRO(83) MACRO(84) MACRO(85) MACRO(86) MACRO(87) MACRO(88) MACRO(89) MACRO(90) MACRO(91) MACRO(92) MACRO(93) MACRO(94) MACRO(95) MACRO(96) MACRO(97) MACRO(98) MACRO(99) MACRO(100) MACRO(101) MACRO(102) MACRO(103) MACRO(104) MACRO(105) MACRO(106) MACRO(107) MACRO(108) MACRO(109) MACRO(110) MACRO(111) MACRO(112) MACRO(113) MACRO(114) MACRO(115) MACRO(116) MACRO(117) MACRO(118) MACRO(119) MACRO(120) MACRO(121) MACRO(122) MACRO(123) MACRO(124) MACRO(125) MACRO(126) MACRO(127) \ + MACRO(128) MACRO(129) MACRO(130) MACRO(131) MACRO(132) MACRO(133) MACRO(134) MACRO(135) MACRO(136) MACRO(137) MACRO(138) MACRO(139) MACRO(140) MACRO(141) MACRO(142) MACRO(143) MACRO(144) MACRO(145) MACRO(146) MACRO(147) MACRO(148) MACRO(149) MACRO(150) MACRO(151) MACRO(152) MACRO(153) MACRO(154) MACRO(155) MACRO(156) MACRO(157) MACRO(158) MACRO(159) MACRO(160) MACRO(161) MACRO(162) MACRO(163) MACRO(164) MACRO(165) MACRO(166) MACRO(167) MACRO(168) MACRO(169) MACRO(170) MACRO(171) MACRO(172) MACRO(173) MACRO(174) MACRO(175) MACRO(176) MACRO(177) MACRO(178) MACRO(179) MACRO(180) MACRO(181) MACRO(182) MACRO(183) MACRO(184) MACRO(185) MACRO(186) MACRO(187) MACRO(188) MACRO(189) MACRO(190) MACRO(191) MACRO(192) MACRO(193) MACRO(194) MACRO(195) MACRO(196) MACRO(197) MACRO(198) MACRO(199) MACRO(200) MACRO(201) MACRO(202) MACRO(203) MACRO(204) MACRO(205) MACRO(206) MACRO(207) MACRO(208) MACRO(209) MACRO(210) MACRO(211) MACRO(212) MACRO(213) MACRO(214) MACRO(215) MACRO(216) MACRO(217) MACRO(218) MACRO(219) MACRO(220) MACRO(221) MACRO(222) MACRO(223) MACRO(224) MACRO(225) MACRO(226) MACRO(227) MACRO(228) MACRO(229) MACRO(230) MACRO(231) MACRO(232) MACRO(233) MACRO(234) MACRO(235) MACRO(236) MACRO(237) MACRO(238) MACRO(239) MACRO(240) MACRO(241) MACRO(242) MACRO(243) MACRO(244) MACRO(245) MACRO(246) MACRO(247) MACRO(248) MACRO(249) MACRO(250) MACRO(251) MACRO(252) MACRO(253) MACRO(254) MACRO(255) + +static inline short swap_endian16(short x) +{ + short y; + asm volatile ("lhbrx %0,0,%1\n" : "=r" (y) : "r" (&x)); + return y; +} + +static inline int swap_endian32(int x) +{ + int y; + asm volatile ("lwbrx %0,0,%1\n" : "=r" (y) : "r" (&x)); + return y; +} + +/***************************************************************************************** +Error Codes +*****************************************************************************************/ + +// success +#ifndef ERROR_SUCCESS +#define ERROR_SUCCESS 0 +#endif + +// file and i/o errors (1000's) +#define ERROR_IO_READ 1000 +#define ERROR_IO_WRITE 1001 +#define ERROR_INVALID_INPUT_FILE 1002 +#define ERROR_INVALID_OUTPUT_FILE 1003 +#define ERROR_INPUT_FILE_TOO_LARGE 1004 +#define ERROR_INPUT_FILE_UNSUPPORTED_BIT_DEPTH 1005 +#define ERROR_INPUT_FILE_UNSUPPORTED_SAMPLE_RATE 1006 +#define ERROR_INPUT_FILE_UNSUPPORTED_CHANNEL_COUNT 1007 +#define ERROR_INPUT_FILE_TOO_SMALL 1008 +#define ERROR_INVALID_CHECKSUM 1009 +#define ERROR_DECOMPRESSING_FRAME 1010 +#define ERROR_INITIALIZING_UNMAC 1011 +#define ERROR_INVALID_FUNCTION_PARAMETER 1012 +#define ERROR_UNSUPPORTED_FILE_TYPE 1013 +#define ERROR_UPSUPPORTED_FILE_VERSION 1014 + +// memory errors (2000's) +#define ERROR_INSUFFICIENT_MEMORY 2000 + +// dll errors (3000's) +#define ERROR_LOADINGAPE_DLL 3000 +#define ERROR_LOADINGAPE_INFO_DLL 3001 +#define ERROR_LOADING_UNMAC_DLL 3002 + +// general and misc errors +#define ERROR_USER_STOPPED_PROCESSING 4000 +#define ERROR_SKIPPED 4001 + +// programmer errors +#define ERROR_BAD_PARAMETER 5000 + +// IAPECompress errors +#define ERROR_APE_COMPRESS_TOO_MUCH_DATA 6000 + +// unknown error +#define ERROR_UNDEFINED -1 + +#define ERROR_EXPLANATION \ + { ERROR_IO_READ , "I/O read error" }, \ + { ERROR_IO_WRITE , "I/O write error" }, \ + { ERROR_INVALID_INPUT_FILE , "invalid input file" }, \ + { ERROR_INVALID_OUTPUT_FILE , "invalid output file" }, \ + { ERROR_INPUT_FILE_TOO_LARGE , "input file file too large" }, \ + { ERROR_INPUT_FILE_UNSUPPORTED_BIT_DEPTH , "input file unsupported bit depth" }, \ + { ERROR_INPUT_FILE_UNSUPPORTED_SAMPLE_RATE , "input file unsupported sample rate" }, \ + { ERROR_INPUT_FILE_UNSUPPORTED_CHANNEL_COUNT , "input file unsupported channel count" }, \ + { ERROR_INPUT_FILE_TOO_SMALL , "input file too small" }, \ + { ERROR_INVALID_CHECKSUM , "invalid checksum" }, \ + { ERROR_DECOMPRESSING_FRAME , "decompressing frame" }, \ + { ERROR_INITIALIZING_UNMAC , "initializing unmac" }, \ + { ERROR_INVALID_FUNCTION_PARAMETER , "invalid function parameter" }, \ + { ERROR_UNSUPPORTED_FILE_TYPE , "unsupported file type" }, \ + { ERROR_INSUFFICIENT_MEMORY , "insufficient memory" }, \ + { ERROR_LOADINGAPE_DLL , "loading MAC.dll" }, \ + { ERROR_LOADINGAPE_INFO_DLL , "loading MACinfo.dll" }, \ + { ERROR_LOADING_UNMAC_DLL , "loading UnMAC.dll" }, \ + { ERROR_USER_STOPPED_PROCESSING , "user stopped processing" }, \ + { ERROR_SKIPPED , "skipped" }, \ + { ERROR_BAD_PARAMETER , "bad parameter" }, \ + { ERROR_APE_COMPRESS_TOO_MUCH_DATA , "APE compress too much data" }, \ + { ERROR_UNDEFINED , "undefined" }, \ + +#endif // #ifndef APE_ALL_H \ No newline at end of file diff --git a/Libraries/MAC/Files/Shared/IO.h b/Libraries/MAC/Files/Shared/IO.h new file mode 100755 index 000000000..c6bee9078 --- /dev/null +++ b/Libraries/MAC/Files/Shared/IO.h @@ -0,0 +1,49 @@ +#ifndef APE_IO_H +#define APE_IO_H + +#ifndef FILE_BEGIN + #define FILE_BEGIN 0 +#endif + +#ifndef FILE_CURRENT + #define FILE_CURRENT 1 +#endif + +#ifndef FILE_END + #define FILE_END 2 +#endif + +class CIO +{ + +public: + + //construction / destruction + CIO() { } + virtual ~CIO() { }; + + // open / close + virtual int Open(const wchar_t * pName) = 0; + virtual int Close() = 0; + + // read / write + virtual int Read(void * pBuffer, unsigned int nBytesToRead, unsigned int * pBytesRead) = 0; + virtual int Write(const void * pBuffer, unsigned int nBytesToWrite, unsigned int * pBytesWritten) = 0; + + // seek + virtual int Seek(int nDistance, unsigned int nMoveMode) = 0; + + // creation / destruction + virtual int Create(const wchar_t * pName) = 0; + virtual int Delete() = 0; + + // other functions + virtual int SetEOF() = 0; + + // attributes + virtual int GetPosition() = 0; + virtual int GetSize() = 0; + virtual int GetName(wchar_t * pBuffer) = 0; +}; + +#endif // #ifndef APE_IO_H diff --git a/Libraries/MAC/Files/Shared/MACDll.h b/Libraries/MAC/Files/Shared/MACDll.h new file mode 100755 index 000000000..50146beea --- /dev/null +++ b/Libraries/MAC/Files/Shared/MACDll.h @@ -0,0 +1,99 @@ +/***************************************************************************************** +Monkey's Audio MACDll.h (include for using MACDll.dll in your projects) +Copyright (C) 2000-2004 by Matthew T. Ashland All Rights Reserved. + +Overview: + +Basically all this dll does is wrap MACLib.lib, so browse through MACLib.h for documentation +on how to use the interfaces. + +Questions / Suggestions: + +Please direct questions or comments to the Monkey's Audio developers board: + http://www.monkeysaudio.com/cgi-bin/YaBB/YaBB.cgi -> Developers +or, if necessary, matt @ monkeysaudio.com +*****************************************************************************************/ + +#ifndef APE_MACDLL_H +#define APE_MACDLL_H + +/***************************************************************************************** +Includes +*****************************************************************************************/ +#include "All.h" +#include "MACLib.h" + +/***************************************************************************************** +Defines (implemented elsewhere) +*****************************************************************************************/ +struct ID3_TAG; + +/***************************************************************************************** +Helper functions +*****************************************************************************************/ +extern "C" +{ + __declspec( dllexport ) int __stdcall GetVersionNumber(); + __declspec( dllexport ) int __stdcall GetInterfaceCompatibility(int nVersion, BOOL bDisplayWarningsOnFailure = TRUE, HWND hwndParent = NULL); + __declspec( dllexport ) int __stdcall ShowFileInfoDialog(const str_ansi * pFilename, HWND hwndWindow); + __declspec( dllexport ) int __stdcall TagFileSimple(const str_ansi * pFilename, const char * pArtist, const char * pAlbum, const char * pTitle, const char * pComment, const char * pGenre, const char * pYear, const char * pTrack, BOOL bClearFirst, BOOL bUseOldID3); + __declspec( dllexport ) int __stdcall GetID3Tag(const str_ansi * pFilename, ID3_TAG * pID3Tag); + __declspec( dllexport ) int __stdcall RemoveTag(const str_ansi * pFilename); +} + +typedef int (__stdcall * proc_GetVersionNumber)(); +typedef int (__stdcall * proc_GetInterfaceCompatibility)(int, BOOL, HWND); + +/***************************************************************************************** +IAPECompress wrapper(s) +*****************************************************************************************/ +typedef void * APE_COMPRESS_HANDLE; + +typedef APE_COMPRESS_HANDLE (__stdcall * proc_APECompress_Create)(int *); +typedef void (__stdcall * proc_APECompress_Destroy)(APE_COMPRESS_HANDLE); +typedef int (__stdcall * proc_APECompress_Start)(APE_COMPRESS_HANDLE, const char *, const WAVEFORMATEX *, int, int, const void *, int); +typedef int (__stdcall * proc_APECompress_StartW)(APE_COMPRESS_HANDLE, const char *, const WAVEFORMATEX *, int, int, const void *, int); +typedef int (__stdcall * proc_APECompress_AddData)(APE_COMPRESS_HANDLE, unsigned char *, int); +typedef int (__stdcall * proc_APECompress_GetBufferBytesAvailable)(APE_COMPRESS_HANDLE); +typedef unsigned char * (__stdcall * proc_APECompress_LockBuffer)(APE_COMPRESS_HANDLE, int *); +typedef int (__stdcall * proc_APECompress_UnlockBuffer)(APE_COMPRESS_HANDLE, int, BOOL); +typedef int (__stdcall * proc_APECompress_Finish)(APE_COMPRESS_HANDLE, unsigned char *, int, int); +typedef int (__stdcall * proc_APECompress_Kill)(APE_COMPRESS_HANDLE); + +extern "C" +{ + __declspec( dllexport ) APE_COMPRESS_HANDLE __stdcall c_APECompress_Create(int * pErrorCode = NULL); + __declspec( dllexport ) void __stdcall c_APECompress_Destroy(APE_COMPRESS_HANDLE hAPECompress); + __declspec( dllexport ) int __stdcall c_APECompress_Start(APE_COMPRESS_HANDLE hAPECompress, const char * pOutputFilename, const WAVEFORMATEX * pwfeInput, int nMaxAudioBytes = MAX_AUDIO_BYTES_UNKNOWN, int nCompressionLevel = COMPRESSION_LEVEL_NORMAL, const unsigned char * pHeaderData = NULL, int nHeaderBytes = CREATE_WAV_HEADER_ON_DECOMPRESSION); + __declspec( dllexport ) int __stdcall c_APECompress_StartW(APE_COMPRESS_HANDLE hAPECompress, const str_utf16 * pOutputFilename, const WAVEFORMATEX * pwfeInput, int nMaxAudioBytes = MAX_AUDIO_BYTES_UNKNOWN, int nCompressionLevel = COMPRESSION_LEVEL_NORMAL, const unsigned char * pHeaderData = NULL, int nHeaderBytes = CREATE_WAV_HEADER_ON_DECOMPRESSION); + __declspec( dllexport ) int __stdcall c_APECompress_AddData(APE_COMPRESS_HANDLE hAPECompress, unsigned char * pData, int nBytes); + __declspec( dllexport ) int __stdcall c_APECompress_GetBufferBytesAvailable(APE_COMPRESS_HANDLE hAPECompress); + __declspec( dllexport ) unsigned char * __stdcall c_APECompress_LockBuffer(APE_COMPRESS_HANDLE hAPECompress, int * pBytesAvailable); + __declspec( dllexport ) int __stdcall c_APECompress_UnlockBuffer(APE_COMPRESS_HANDLE hAPECompress, int nBytesAdded, BOOL bProcess = TRUE); + __declspec( dllexport ) int __stdcall c_APECompress_Finish(APE_COMPRESS_HANDLE hAPECompress, unsigned char * pTerminatingData, int nTerminatingBytes, int nWAVTerminatingBytes); + __declspec( dllexport ) int __stdcall c_APECompress_Kill(APE_COMPRESS_HANDLE hAPECompress); +} + +/***************************************************************************************** +IAPEDecompress wrapper(s) +*****************************************************************************************/ +typedef void * APE_DECOMPRESS_HANDLE; + +typedef APE_DECOMPRESS_HANDLE (__stdcall * proc_APEDecompress_Create)(const char *, int *); +typedef APE_DECOMPRESS_HANDLE (__stdcall * proc_APEDecompress_CreateW)(const char *, int *); +typedef void (__stdcall * proc_APEDecompress_Destroy)(APE_DECOMPRESS_HANDLE); +typedef int (__stdcall * proc_APEDecompress_GetData)(APE_DECOMPRESS_HANDLE, char *, int, int *); +typedef int (__stdcall * proc_APEDecompress_Seek)(APE_DECOMPRESS_HANDLE, int); +typedef int (__stdcall * proc_APEDecompress_GetInfo)(APE_DECOMPRESS_HANDLE, APE_DECOMPRESS_FIELDS, int, int); + +extern "C" +{ + __declspec( dllexport ) APE_DECOMPRESS_HANDLE __stdcall c_APEDecompress_Create(const str_ansi * pFilename, int * pErrorCode = NULL); + __declspec( dllexport ) APE_DECOMPRESS_HANDLE __stdcall c_APEDecompress_CreateW(const str_utf16 * pFilename, int * pErrorCode = NULL); + __declspec( dllexport ) void __stdcall c_APEDecompress_Destroy(APE_DECOMPRESS_HANDLE hAPEDecompress); + __declspec( dllexport ) int __stdcall c_APEDecompress_GetData(APE_DECOMPRESS_HANDLE hAPEDecompress, char * pBuffer, int nBlocks, int * pBlocksRetrieved); + __declspec( dllexport ) int __stdcall c_APEDecompress_Seek(APE_DECOMPRESS_HANDLE hAPEDecompress, int nBlockOffset); + __declspec( dllexport ) int __stdcall c_APEDecompress_GetInfo(APE_DECOMPRESS_HANDLE hAPEDecompress, APE_DECOMPRESS_FIELDS Field, int nParam1 = 0, int nParam2 = 0); +} + +#endif // #ifndef APE_MACDLL_H diff --git a/Libraries/MAC/Files/Shared/MACLib.h b/Libraries/MAC/Files/Shared/MACLib.h new file mode 100755 index 000000000..192d60e65 --- /dev/null +++ b/Libraries/MAC/Files/Shared/MACLib.h @@ -0,0 +1,450 @@ +/***************************************************************************************** +Monkey's Audio MACLib.h (include for using MACLib.lib in your projects) +Copyright (C) 2000-2003 by Matthew T. Ashland All Rights Reserved. + +Overview: + +There are two main interfaces... create one (using CreateIAPExxx) and go to town: + + IAPECompress - for creating APE files + IAPEDecompress - for decompressing and analyzing APE files + +Note(s): + +Unless otherwise specified, functions return ERROR_SUCCESS (0) on success and an +error code on failure. + +The terminology "Sample" refers to a single sample value, and "Block" refers +to a collection of "Channel" samples. For simplicity, MAC typically uses blocks +everywhere so that channel mis-alignment cannot happen. (i.e. on a CD, a sample is +2 bytes and a block is 4 bytes ([2 bytes per sample] * [2 channels] = 4 bytes)) + +Questions / Suggestions: + +Please direct questions or comments to the Monkey's Audio developers board: +http://www.monkeysaudio.com/cgi-bin/YaBB/YaBB.cgi -> Developers +or, if necessary, matt @ monkeysaudio.com +*****************************************************************************************/ + +#ifndef APE_MACLIB_H +#define APE_MACLIB_H + +/************************************************************************************************* +APE File Format Overview: (pieces in order -- only valid for the latest version APE files) + + JUNK - any amount of "junk" before the APE_DESCRIPTOR (so people that put ID3v2 tags on the files aren't hosed) + APE_DESCRIPTOR - defines the sizes (and offsets) of all the pieces, as well as the MD5 checksum + APE_HEADER - describes all of the necessary information about the APE file + SEEK TABLE - the table that represents seek offsets [optional] + HEADER DATA - the pre-audio data from the original file [optional] + APE FRAMES - the actual compressed audio (broken into frames for seekability) + TERMINATING DATA - the post-audio data from the original file [optional] + TAG - describes all the properties of the file [optional] + +Notes: + + Junk: + + This block may not be supported in the future, so don't write any software that adds meta data + before the APE_DESCRIPTOR. Please use the APE Tag for any meta data. + + Seek Table: + + A 32-bit unsigned integer array of offsets from the header to the frame data. May become "delta" + values someday to better suit huge files. + + MD5 Hash: + + Since the header is the last part written to an APE file, you must calculate the MD5 checksum out of order. + So, you first calculate from the tail of the seek table to the end of the terminating data. + Then, go back and do from the end of the descriptor to the tail of the seek table. + You may wish to just cache the header data when starting and run it last, so you don't + need to seek back in the I/O. +*************************************************************************************************/ + +/***************************************************************************************** +Defines +*****************************************************************************************/ +#define COMPRESSION_LEVEL_FAST 1000 +#define COMPRESSION_LEVEL_NORMAL 2000 +#define COMPRESSION_LEVEL_HIGH 3000 +#define COMPRESSION_LEVEL_EXTRA_HIGH 4000 +#define COMPRESSION_LEVEL_INSANE 5000 + +#define MAC_FORMAT_FLAG_8_BIT 1 // is 8-bit [OBSOLETE] +#define MAC_FORMAT_FLAG_CRC 2 // uses the new CRC32 error detection [OBSOLETE] +#define MAC_FORMAT_FLAG_HAS_PEAK_LEVEL 4 // uint32 nPeakLevel after the header [OBSOLETE] +#define MAC_FORMAT_FLAG_24_BIT 8 // is 24-bit [OBSOLETE] +#define MAC_FORMAT_FLAG_HAS_SEEK_ELEMENTS 16 // has the number of seek elements after the peak level +#define MAC_FORMAT_FLAG_CREATE_WAV_HEADER 32 // create the wave header on decompression (not stored) + +#define CREATE_WAV_HEADER_ON_DECOMPRESSION -1 +#define MAX_AUDIO_BYTES_UNKNOWN -1 + +typedef void (__stdcall * APE_PROGRESS_CALLBACK) (int); + +/***************************************************************************************** +WAV header structure +*****************************************************************************************/ +struct WAVE_HEADER +{ + // RIFF header + char cRIFFHeader[4]; + unsigned int nRIFFBytes; + + // data type + char cDataTypeID[4]; + + // wave format + char cFormatHeader[4]; + unsigned int nFormatBytes; + + unsigned short nFormatTag; + unsigned short nChannels; + unsigned int nSamplesPerSec; + unsigned int nAvgBytesPerSec; + unsigned short nBlockAlign; + unsigned short nBitsPerSample; + + // data chunk header + char cDataHeader[4]; + unsigned int nDataBytes; +}; + +/***************************************************************************************** +APE_DESCRIPTOR structure (file header that describes lengths, offsets, etc.) +*****************************************************************************************/ +struct APE_DESCRIPTOR +{ + char cID[4]; // should equal 'MAC ' + uint16 nVersion; // version number * 1000 (3.81 = 3810) + + uint32 nDescriptorBytes; // the number of descriptor bytes (allows later expansion of this header) + uint32 nHeaderBytes; // the number of header APE_HEADER bytes + uint32 nSeekTableBytes; // the number of bytes of the seek table + uint32 nHeaderDataBytes; // the number of header data bytes (from original file) + uint32 nAPEFrameDataBytes; // the number of bytes of APE frame data + uint32 nAPEFrameDataBytesHigh; // the high order number of APE frame data bytes + uint32 nTerminatingDataBytes; // the terminating data of the file (not including tag data) + + uint8 cFileMD5[16]; // the MD5 hash of the file (see notes for usage... it's a littly tricky) +}; + +/***************************************************************************************** +APE_HEADER structure (describes the format, duration, etc. of the APE file) +*****************************************************************************************/ +struct APE_HEADER +{ + uint16 nCompressionLevel; // the compression level (see defines I.E. COMPRESSION_LEVEL_FAST) + uint16 nFormatFlags; // any format flags (for future use) + + uint32 nBlocksPerFrame; // the number of audio blocks in one frame + uint32 nFinalFrameBlocks; // the number of audio blocks in the final frame + uint32 nTotalFrames; // the total number of frames + + uint16 nBitsPerSample; // the bits per sample (typically 16) + uint16 nChannels; // the number of channels (1 or 2) + uint32 nSampleRate; // the sample rate (typically 44100) +}; + +/************************************************************************************************* +Classes (fully defined elsewhere) +*************************************************************************************************/ +class CIO; +class CInputSource; +class CAPEInfo; + +/************************************************************************************************* +IAPEDecompress fields - used when querying for information + +Note(s): +-the distinction between APE_INFO_XXXX and APE_DECOMPRESS_XXXX is that the first is querying the APE +information engine, and the other is querying the decompressor, and since the decompressor can be +a range of an APE file (for APL), differences will arise. Typically, use the APE_DECOMPRESS_XXXX +fields when querying for info about the length, etc. so APL will work properly. +(i.e. (APE_INFO_TOTAL_BLOCKS != APE_DECOMPRESS_TOTAL_BLOCKS) for APL files) +*************************************************************************************************/ +enum APE_DECOMPRESS_FIELDS +{ + APE_INFO_FILE_VERSION = 1000, // version of the APE file * 1000 (3.93 = 3930) [ignored, ignored] + APE_INFO_COMPRESSION_LEVEL = 1001, // compression level of the APE file [ignored, ignored] + APE_INFO_FORMAT_FLAGS = 1002, // format flags of the APE file [ignored, ignored] + APE_INFO_SAMPLE_RATE = 1003, // sample rate (Hz) [ignored, ignored] + APE_INFO_BITS_PER_SAMPLE = 1004, // bits per sample [ignored, ignored] + APE_INFO_BYTES_PER_SAMPLE = 1005, // number of bytes per sample [ignored, ignored] + APE_INFO_CHANNELS = 1006, // channels [ignored, ignored] + APE_INFO_BLOCK_ALIGN = 1007, // block alignment [ignored, ignored] + APE_INFO_BLOCKS_PER_FRAME = 1008, // number of blocks in a frame (frames are used internally) [ignored, ignored] + APE_INFO_FINAL_FRAME_BLOCKS = 1009, // blocks in the final frame (frames are used internally) [ignored, ignored] + APE_INFO_TOTAL_FRAMES = 1010, // total number frames (frames are used internally) [ignored, ignored] + APE_INFO_WAV_HEADER_BYTES = 1011, // header bytes of the decompressed WAV [ignored, ignored] + APE_INFO_WAV_TERMINATING_BYTES = 1012, // terminating bytes of the decompressed WAV [ignored, ignored] + APE_INFO_WAV_DATA_BYTES = 1013, // data bytes of the decompressed WAV [ignored, ignored] + APE_INFO_WAV_TOTAL_BYTES = 1014, // total bytes of the decompressed WAV [ignored, ignored] + APE_INFO_APE_TOTAL_BYTES = 1015, // total bytes of the APE file [ignored, ignored] + APE_INFO_TOTAL_BLOCKS = 1016, // total blocks of audio data [ignored, ignored] + APE_INFO_LENGTH_MS = 1017, // length in ms (1 sec = 1000 ms) [ignored, ignored] + APE_INFO_AVERAGE_BITRATE = 1018, // average bitrate of the APE [ignored, ignored] + APE_INFO_FRAME_BITRATE = 1019, // bitrate of specified APE frame [frame index, ignored] + APE_INFO_DECOMPRESSED_BITRATE = 1020, // bitrate of the decompressed WAV [ignored, ignored] + APE_INFO_PEAK_LEVEL = 1021, // peak audio level (obsolete) (-1 is unknown) [ignored, ignored] + APE_INFO_SEEK_BIT = 1022, // bit offset [frame index, ignored] + APE_INFO_SEEK_BYTE = 1023, // byte offset [frame index, ignored] + APE_INFO_WAV_HEADER_DATA = 1024, // error code [buffer *, max bytes] + APE_INFO_WAV_TERMINATING_DATA = 1025, // error code [buffer *, max bytes] + APE_INFO_WAVEFORMATEX = 1026, // error code [waveformatex *, ignored] + APE_INFO_IO_SOURCE = 1027, // I/O source (CIO *) [ignored, ignored] + APE_INFO_FRAME_BYTES = 1028, // bytes (compressed) of the frame [frame index, ignored] + APE_INFO_FRAME_BLOCKS = 1029, // blocks in a given frame [frame index, ignored] + APE_INFO_TAG = 1030, // point to tag (CAPETag *) [ignored, ignored] + + APE_DECOMPRESS_CURRENT_BLOCK = 2000, // current block location [ignored, ignored] + APE_DECOMPRESS_CURRENT_MS = 2001, // current millisecond location [ignored, ignored] + APE_DECOMPRESS_TOTAL_BLOCKS = 2002, // total blocks in the decompressors range [ignored, ignored] + APE_DECOMPRESS_LENGTH_MS = 2003, // total blocks in the decompressors range [ignored, ignored] + APE_DECOMPRESS_CURRENT_BITRATE = 2004, // current bitrate [ignored, ignored] + APE_DECOMPRESS_AVERAGE_BITRATE = 2005, // average bitrate (works with ranges) [ignored, ignored] + + APE_INTERNAL_INFO = 3000, // for internal use -- don't use (returns APE_FILE_INFO *) [ignored, ignored] +}; + +/************************************************************************************************* +IAPEDecompress - interface for working with existing APE files (decoding, seeking, analyzing, etc.) +*************************************************************************************************/ +class IAPEDecompress +{ +public: + + // destructor (needed so implementation's destructor will be called) + virtual ~IAPEDecompress() {} + + /********************************************************************************************* + * Decompress / Seek + *********************************************************************************************/ + + ////////////////////////////////////////////////////////////////////////////////////////////// + // GetData(...) - gets raw decompressed audio + // + // Parameters: + // char * pBuffer + // a pointer to a buffer to put the data into + // int nBlocks + // the number of audio blocks desired (see note at intro about blocks vs. samples) + // int * pBlocksRetrieved + // the number of blocks actually retrieved (could be less at end of file or on critical failure) + ////////////////////////////////////////////////////////////////////////////////////////////// + virtual int GetData(char * pBuffer, int nBlocks, int * pBlocksRetrieved) = 0; + + ////////////////////////////////////////////////////////////////////////////////////////////// + // Seek(...) - seeks + // + // Parameters: + // int nBlockOffset + // the block to seek to (see note at intro about blocks vs. samples) + ////////////////////////////////////////////////////////////////////////////////////////////// + virtual int Seek(int nBlockOffset) = 0; + + /********************************************************************************************* + * Get Information + *********************************************************************************************/ + + ////////////////////////////////////////////////////////////////////////////////////////////// + // GetInfo(...) - get information about the APE file or the state of the decompressor + // + // Parameters: + // APE_DECOMPRESS_FIELDS Field + // the field we're querying (see APE_DECOMPRESS_FIELDS above for more info) + // int nParam1 + // generic parameter... usage is listed in APE_DECOMPRESS_FIELDS + // int nParam2 + // generic parameter... usage is listed in APE_DECOMPRESS_FIELDS + ////////////////////////////////////////////////////////////////////////////////////////////// + virtual int GetInfo(APE_DECOMPRESS_FIELDS Field, int nParam1 = 0, int nParam2 = 0) = 0; +}; + +/************************************************************************************************* +IAPECompress - interface for creating APE files + +Usage: + + To create an APE file, you Start(...), then add data (in a variety of ways), then Finish(...) +*************************************************************************************************/ +class IAPECompress +{ +public: + + // destructor (needed so implementation's destructor will be called) + virtual ~IAPECompress() {} + + /********************************************************************************************* + * Start + *********************************************************************************************/ + + ////////////////////////////////////////////////////////////////////////////////////////////// + // Start(...) / StartEx(...) - starts encoding + // + // Parameters: + // CIO * pioOutput / const str_utf16 * pFilename + // the output... either a filename or an I/O source + // WAVEFORMATEX * pwfeInput + // format of the audio to encode (use FillWaveFormatEx() if necessary) + // int nMaxAudioBytes + // the absolute maximum audio bytes that will be encoded... encoding fails with a + // ERROR_APE_COMPRESS_TOO_MUCH_DATA if you attempt to encode more than specified here + // (if unknown, use MAX_AUDIO_BYTES_UNKNOWN to allocate as much storage in the seek table as + // possible... limit is then 2 GB of data (~4 hours of CD music)... this wastes around + // 30kb, so only do it if completely necessary) + // int nCompressionLevel + // the compression level for the APE file (fast - extra high) + // (note: extra-high is much slower for little gain) + // const void * pHeaderData + // a pointer to a buffer containing the WAV header (data before the data block in the WAV) + // (note: use NULL for on-the-fly encoding... see next parameter) + // int nHeaderBytes + // number of bytes in the header data buffer (use CREATE_WAV_HEADER_ON_DECOMPRESSION and + // NULL for the pHeaderData and MAC will automatically create the appropriate WAV header + // on decompression) + ////////////////////////////////////////////////////////////////////////////////////////////// + + virtual int Start(const str_utf16 * pOutputFilename, const WAVEFORMATEX * pwfeInput, + int nMaxAudioBytes = MAX_AUDIO_BYTES_UNKNOWN, int nCompressionLevel = COMPRESSION_LEVEL_NORMAL, + const void * pHeaderData = NULL, int nHeaderBytes = CREATE_WAV_HEADER_ON_DECOMPRESSION) = 0; + + virtual int StartEx(CIO * pioOutput, const WAVEFORMATEX * pwfeInput, + int nMaxAudioBytes = MAX_AUDIO_BYTES_UNKNOWN, int nCompressionLevel = COMPRESSION_LEVEL_NORMAL, + const void * pHeaderData = NULL, int nHeaderBytes = CREATE_WAV_HEADER_ON_DECOMPRESSION) = 0; + + /********************************************************************************************* + * Add / Compress Data + * - there are 3 ways to add data: + * 1) simple call AddData(...) + * 2) lock MAC's buffer, copy into it, and unlock (LockBuffer(...) / UnlockBuffer(...)) + * 3) from an I/O source (AddDataFromInputSource(...)) + *********************************************************************************************/ + + ////////////////////////////////////////////////////////////////////////////////////////////// + // AddData(...) - adds data to the encoder + // + // Parameters: + // unsigned char * pData + // a pointer to a buffer containing the raw audio data + // int nBytes + // the number of bytes in the buffer + ////////////////////////////////////////////////////////////////////////////////////////////// + virtual int AddData(unsigned char * pData, int nBytes) = 0; + + ////////////////////////////////////////////////////////////////////////////////////////////// + // GetBufferBytesAvailable(...) - returns the number of bytes available in the buffer + // (helpful when locking) + ////////////////////////////////////////////////////////////////////////////////////////////// + virtual int GetBufferBytesAvailable() = 0; + + ////////////////////////////////////////////////////////////////////////////////////////////// + // LockBuffer(...) - locks MAC's buffer so we can copy into it + // + // Parameters: + // int * pBytesAvailable + // returns the number of bytes available in the buffer (DO NOT COPY MORE THAN THIS IN) + // + // Return: + // pointer to the buffer (add at that location) + ////////////////////////////////////////////////////////////////////////////////////////////// + virtual unsigned char * LockBuffer(int * pBytesAvailable) = 0; + + ////////////////////////////////////////////////////////////////////////////////////////////// + // UnlockBuffer(...) - releases the buffer + // + // Parameters: + // int nBytesAdded + // the number of bytes copied into the buffer + // BOOL bProcess + // whether MAC should process as much as possible of the buffer + ////////////////////////////////////////////////////////////////////////////////////////////// + virtual int UnlockBuffer(int nBytesAdded, BOOL bProcess = TRUE) = 0; + + + ////////////////////////////////////////////////////////////////////////////////////////////// + // AddDataFromInputSource(...) - use a CInputSource (input source) to add data + // + // Parameters: + // CInputSource * pInputSource + // a pointer to the input source + // int nMaxBytes + // the maximum number of bytes to let MAC add (-1 if MAC can add any amount) + // int * pBytesAdded + // returns the number of bytes added from the I/O source + ////////////////////////////////////////////////////////////////////////////////////////////// + virtual int AddDataFromInputSource(CInputSource * pInputSource, int nMaxBytes = -1, int * pBytesAdded = NULL) = 0; + + /********************************************************************************************* + * Finish / Kill + *********************************************************************************************/ + + ////////////////////////////////////////////////////////////////////////////////////////////// + // Finish(...) - ends encoding and finalizes the file + // + // Parameters: + // unsigned char * pTerminatingData + // a pointer to a buffer containing the information to place at the end of the APE file + // (comprised of the WAV terminating data (data after the data block in the WAV) followed + // by any tag information) + // int nTerminatingBytes + // number of bytes in the terminating data buffer + // int nWAVTerminatingBytes + // the number of bytes of the terminating data buffer that should be appended to a decoded + // WAV file (it's basically nTerminatingBytes - the bytes that make up the tag) + ////////////////////////////////////////////////////////////////////////////////////////////// + virtual int Finish(unsigned char * pTerminatingData, int nTerminatingBytes, int nWAVTerminatingBytes) = 0; + + ////////////////////////////////////////////////////////////////////////////////////////////// + // Kill(...) - stops encoding and deletes the output file + // --- NOT CURRENTLY IMPLEMENTED --- + ////////////////////////////////////////////////////////////////////////////////////////////// + virtual int Kill() = 0; +}; + +/************************************************************************************************* +Functions to create the interfaces + +Usage: + Interface creation returns a NULL pointer on failure (and fills error code if it was passed in) + +Usage example: + int nErrorCode; + IAPEDecompress * pAPEDecompress = CreateIAPEDecompress("c:\\1.ape", &nErrorCode); + if (pAPEDecompress == NULL) + { + // failure... nErrorCode will have specific code + } + +*************************************************************************************************/ +extern "C" +{ + IAPEDecompress * __stdcall CreateIAPEDecompress(const str_utf16 * pFilename, int * pErrorCode = NULL); + IAPEDecompress * __stdcall CreateIAPEDecompressEx(CIO * pIO, int * pErrorCode = NULL); + IAPEDecompress * __stdcall CreateIAPEDecompressEx2(CAPEInfo * pAPEInfo, int nStartBlock = -1, int nFinishBlock = -1, int * pErrorCode = NULL); + IAPECompress * __stdcall CreateIAPECompress(int * pErrorCode = NULL); +} + +/************************************************************************************************* +Simple functions - see the SDK sample projects for usage examples +*************************************************************************************************/ +extern "C" +{ + // process whole files + DLLEXPORT int __stdcall CompressFile(const str_ansi * pInputFilename, const str_ansi * pOutputFilename, int nCompressionLevel = COMPRESSION_LEVEL_NORMAL, int * pPercentageDone = NULL, APE_PROGRESS_CALLBACK ProgressCallback = 0, int * pKillFlag = NULL); + DLLEXPORT int __stdcall DecompressFile(const str_ansi * pInputFilename, const str_ansi * pOutputFilename, int * pPercentageDone, APE_PROGRESS_CALLBACK ProgressCallback, int * pKillFlag); + DLLEXPORT int __stdcall ConvertFile(const str_ansi * pInputFilename, const str_ansi * pOutputFilename, int nCompressionLevel, int * pPercentageDone, APE_PROGRESS_CALLBACK ProgressCallback, int * pKillFlag); + DLLEXPORT int __stdcall VerifyFile(const str_ansi * pInputFilename, int * pPercentageDone, APE_PROGRESS_CALLBACK ProgressCallback, int * pKillFlag); + + DLLEXPORT int __stdcall CompressFileW(const str_utf16 * pInputFilename, const str_utf16 * pOutputFilename, int nCompressionLevel = COMPRESSION_LEVEL_NORMAL, int * pPercentageDone = NULL, APE_PROGRESS_CALLBACK ProgressCallback = 0, int * pKillFlag = NULL); + DLLEXPORT int __stdcall DecompressFileW(const str_utf16 * pInputFilename, const str_utf16 * pOutputFilename, int * pPercentageDone, APE_PROGRESS_CALLBACK ProgressCallback, int * pKillFlag); + DLLEXPORT int __stdcall ConvertFileW(const str_utf16 * pInputFilename, const str_utf16 * pOutputFilename, int nCompressionLevel, int * pPercentageDone, APE_PROGRESS_CALLBACK ProgressCallback, int * pKillFlag); + DLLEXPORT int __stdcall VerifyFileW(const str_utf16 * pInputFilename, int * pPercentageDone, APE_PROGRESS_CALLBACK ProgressCallback, int * pKillFlag, BOOL bQuickVerifyIfPossible = FALSE); + + // helper functions + DLLEXPORT int __stdcall FillWaveFormatEx(WAVEFORMATEX * pWaveFormatEx, int nSampleRate = 44100, int nBitsPerSample = 16, int nChannels = 2); + DLLEXPORT int __stdcall FillWaveHeader(WAVE_HEADER * pWAVHeader, int nAudioBytes, WAVEFORMATEX * pWaveFormatEx, int nTerminatingBytes = 0); +} + +#endif // #ifndef APE_MACLIB_H diff --git a/Libraries/MAC/Files/Shared/SmartPtr.h b/Libraries/MAC/Files/Shared/SmartPtr.h new file mode 100755 index 000000000..d92be0856 --- /dev/null +++ b/Libraries/MAC/Files/Shared/SmartPtr.h @@ -0,0 +1,89 @@ +#ifndef APE_SMARTPTR_H +#define APE_SMARTPTR_H + +// disable the operator -> on UDT warning +#ifdef _MSC_VER + #pragma warning(push) + #pragma warning(disable : 4284) +#endif + +/************************************************************************************************* +CSmartPtr - a simple smart pointer class that can automatically initialize and free memory + note: (doesn't do garbage collection / reference counting because of the many pitfalls) +*************************************************************************************************/ +template class CSmartPtr +{ +public: + TYPE * m_pObject; + BOOL m_bArray; + BOOL m_bDelete; + + CSmartPtr() + { + m_bDelete = TRUE; + m_pObject = NULL; + } + CSmartPtr(TYPE * a_pObject, BOOL a_bArray = FALSE, BOOL a_bDelete = TRUE) + { + m_bDelete = TRUE; + m_pObject = NULL; + Assign(a_pObject, a_bArray, a_bDelete); + } + + ~CSmartPtr() + { + Delete(); + } + + void Assign(TYPE * a_pObject, BOOL a_bArray = FALSE, BOOL a_bDelete = TRUE) + { + Delete(); + + m_bDelete = a_bDelete; + m_bArray = a_bArray; + m_pObject = a_pObject; + } + + void Delete() + { + if (m_bDelete && m_pObject) + { + if (m_bArray) + delete [] m_pObject; + else + delete m_pObject; + + m_pObject = NULL; + } + } + + void SetDelete(const BOOL a_bDelete) + { + m_bDelete = a_bDelete; + } + + __inline TYPE * GetPtr() const + { + return m_pObject; + } + + __inline operator TYPE * () const + { + return m_pObject; + } + + __inline TYPE * operator ->() const + { + return m_pObject; + } + + // declare assignment, but don't implement (compiler error if we try to use) + // that way we can't carelessly mix smart pointers and regular pointers + __inline void * operator =(void *) const; +}; + +#ifdef _MSC_VER + #pragma warning(pop) +#endif _MSC_VER + +#endif // #ifndef APE_SMARTPTR_H diff --git a/Libraries/MAC/Files/Source/.DS_Store b/Libraries/MAC/Files/Source/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..d1599e39f5b2e6d55b8a661b6ec62dff070dc1d2 GIT binary patch literal 12292 zcmeHL&5qMB5T5B)sM>Pq3GD?b4}cK+24Ptw5Jey=afLKlwiWqV)ul@hNICIFJPj9~ zfLDNTY!~9R5qp4wmKn+Z5_`rIf8%)K5D}le%Z`agL^MDV>>r}qA<{2pOM1TL7Le^2 zb6S$2yQtr9X={TrpbY$L49L4XqzAO1Gs>v>{w^QqRXWY9DKxM>@NHo9&5E7GkRCzb z;9aj^z4mW?+v@X{)fiSOyp^y$gVhWp6rnGA1*^K@>jpig`*=#RorbzB9y)c$lb6q? zRh46VqF|6Wm-Bl+Cx>3hJS|tUkwIFz<}$C!bF_bK_s!Gu%8#?zBm3Jr<|5QN_}bRV zO?(iYU68+>tm)-Rwl(jD!#*9R9Qx!dYqV4kS=CxL(hBsc3x&=nDbkW>ziGaTDc`ULa5jmPgSQFuORu1Ob~Mu!&n%I|A0J8wRW~$S(sH z=>7=U2TNk3uQOnQPCFR9ZjaL$u*NulG+?2hX29^MR}#0>X)wH!wkjzD%E14`fb0(u zieT)qc4)T_RQ3n}l$>V;*K(E+o5*AAv37_a2s=}tGi86oKu+`hk;m9$?a-MM`@;u& z&+M}=J9Fa5suRZ!wN?g{fsla%cRP~&|FHY~9~$YMGN24xD+aiKIypVTlzeX8nw;d? z2<0`3i0IW0tqCfhj_rk{;v*C*=!@h67<;T8q6MNK0+t4?l!1LS;Pd~H&;Ry2VBgQ6 z{*(b_;O{c<+wwm$x;>5qH$THA??*B{VC=DWh!)7+^Z(|zw)L)+GN2471ImChpbRJj Z%78MU3@8K2fHI&ACdXKD literal 0 HcmV?d00001 diff --git a/Libraries/MAC/Files/Source/.gdb_history b/Libraries/MAC/Files/Source/.gdb_history new file mode 100644 index 000000000..51aa31291 --- /dev/null +++ b/Libraries/MAC/Files/Source/.gdb_history @@ -0,0 +1,5 @@ +r iron.wav iron.ape -c1000 +bt +q +r iron_399f.ape iron_.wav -d +q diff --git a/Libraries/MAC/Files/Source/Credits.txt b/Libraries/MAC/Files/Source/Credits.txt new file mode 100755 index 000000000..acab41fd9 --- /dev/null +++ b/Libraries/MAC/Files/Source/Credits.txt @@ -0,0 +1,25 @@ +Source Code Credits: (listed in alphabetical order by first name) + +Chun-Yu Shei: +- cool suggestion for a slightly more optimized GetSaturatedShortFromInt(...) routine + +David Bryant: +- lots of ideas and support from continued discussions + +Florin Ghido: +- planted the seed for a more efficient stereo decorrelator + +Frank Klemm: +- helped with several Linux building issues, APEv2 tags, and MD5 checksums + +Janne Hyvärinen: (case@mobiili.net) +- donated some nice UTF / ANSI conversion code for APE version 2 tagging + +Torgeir Strand Henriksen: (torgshen@stud.iet.hist.no) +- did all the footwork to enable BACKWARDS_COMPATIBILITY without requiring assembly + +Michael Bevin: (support@lossless-audio.com) +- had a good entropy idea for improving entropy coding ( http://www.lossless-audio.com/theory.htm ) + +Igor Janos: (radscorpion@radlight.com) +- wrote the APE DirectShow filter \ No newline at end of file diff --git a/Libraries/MAC/Files/Source/History.txt b/Libraries/MAC/Files/Source/History.txt new file mode 100755 index 000000000..08b0e128d --- /dev/null +++ b/Libraries/MAC/Files/Source/History.txt @@ -0,0 +1,79 @@ +History: + +Monkey's Audio 3.99 Update 4 + +1. Fixed: Decoder could erroneously report a CRC error on the last frame of some files. + +Monkey's Audio 3.99 Update 3 + +1. Changed: Worked on making data types more standard / cross-platform friendly. +2. Changed: Switched code from tab-based to space based. (may still be some out-of-whack formatting) +3. Fixed: Building ID3 tags could cause a crash. +4. Fixed: APL builder treated the last part of a CUE time as a hundreth of a second instead of as a frame. (1 / 75 of a second) +5. Fixed: File Info dialog used by Winamp plugin wouldn't accept / save Unicode tag values properly. +6. Fixed: APL files could output noise or silence at the end of the file in some cases. + +Monkey's Audio 3.99 Update 2 + +1. Fixed: Possible buffer overflow attack weakness in APE tagging code. +2. Fixed: MACDll.dll was not doing ANSI to Unicode conversions properly. +3. Changed: Added Unicode versions of interface wrappers to MACDll.dll. +4. Changed: Updated Winamp plugin to better handle Unicode. +5. Changed: Removed peak-level normalize from file and Winamp plugin. (newer players can do normalize / replay gain during playback) +6. Changed: Updated Cool Edit filter to 3.99. + +Monkey's Audio 3.99 Update 1 + +1. Fixed: MACDll.dll wasn't working on Win9x / ME systems. +2. Changed: MAC.exe updated to 3.99. + +Monkey's Audio 3.99 + +1. Changed: Decoding engine better at handling corrupt streams / loss of internet connection while playing. +2. Changed: Simplified assembly code building for 3rd party developers. +3. NEW: Improved entropy coder for increased compression. +4. Changed: Removed RKAU support. (since it is no longer commonly used) + +Monkey's Audio 3.98a1 + +1. Changed: Now natively using APE tag version 2 tagging. (updated spec for better streaming and international support) +2. Changed: Using smaller frame sizes with Fast, Normal, and High for faster, smoother seeking. +3. NEW: Added built-in MD5 checking, for super secure, super fast file verification. +4. Changed: Using a new and improved file header format. +5. NEW: Added "Insane" mode for when compression is all that matters. +6. NEW: Introduced new GUI. + - full Unicode support + - few or no dependencies + - multi-thread friendly -- can process multiple files at once + - XML based external plugin architecture + +Monkey's Audio 3.97 (July 7, 2002) + +1. Changed: "Save File List Between Sessions" now on by default in front end. +2. Changed: Replaced usage of "#pragma once" with more non-MS compiler friendly alterternative. +3. NEW: MakeAPL now supports command line APL generation. (pass a .CUE file (no wildcards yet) -- operates in silent mode using existing settings) +4. Changed: Assembly support no longer required for backwards compatibility. (thanks Torgeir Strand Henriksen) +5. Changed: Several non-Windows buildability issues. +6. Changed: Using NASM to compile all assembly code. (aids cross-platform buildability) +7. Changed: Encapsulated the APELink code. +8. Changed: Tags aren't analyzed immediately when opening an http:// or m01p:// stream. +9. Changed: Added more functionality to the APL parser. +10. Changed: Added CreateIAPEDecompressEx2(...) to allow the creation of a ranged decoder. + +Monkey's Audio 3.96 (April 7, 2002) + +1. Fixed: WAV analysis could hang on invalid wav files. +2. Changed: Monkey's Audio would try to analyze files with file extensions not related to Monkey's Audio. +3. NEW: Added APE_DECOMPRESS_AVERAGE_BITRATE field so APL's can report the bitrate for the region they represent. +4. Changed: Improved overall non-Windows build-ability. (MACLib.lib doesn't require to build) +5. Changed: APL parser no longer requires Windows. +6. Fixed: APE tagging code would fail to save tags for files with existing ID3v1 tags. +7. Fixed: MakeAPL would not run on Win95 / 98. +8. Changed: More non-Windows build-ability issues. +9. Changed: Minor assembly optimizations. (like a 2% performance improvement) +10. Changed: MACLib now builds with gcc under Linux. (no backwards compatibility or assembly support yet) +11. Fixed: Bitstream fix / change that may have accounted for decompression failures in extremely rare cases. +12. Changed: Slight NNFilter optimization. (thanks to Chun-Yu Shei) +13. Changed: Turned off "Explorer" by default for the Monkey's Audio GUI. (doesn't work well under XP... will still leave it in for a while) +14. Changed: Included the WavPack 3.93. +15. Changed: Changed the history reporting method. \ No newline at end of file diff --git a/Libraries/MAC/Files/Source/License.htm b/Libraries/MAC/Files/Source/License.htm new file mode 100755 index 000000000..7b429491a --- /dev/null +++ b/Libraries/MAC/Files/Source/License.htm @@ -0,0 +1,48 @@ + + + + + + +Well + + + + +

Monkey's Audio Source Code +License Agreement

+

License Agreement

+

1. The use of any of the Monkey’s Audio source code or any component thereof from another program requires +express written permission from the author of Monkey’s Audio.

+

2. The use of Monkey's Audio or the Monkey's Audio source code for any commercial purposes including, but not +limited to, implementation in shareware packages is strictly prohibited without first obtaining written +permission from the author.

+

3. All code changes and improvements must be +contributed back to the Monkey's Audio project free from restrictions or +royalties for the sake of the common good.

+

4. Although the software has been tested thoroughly, the author is in no way responsible for damages due to +bugs or misuse. 

+

5. If you do not completely agree with all of +the previous stipulations, you must cease using this source code and remove it +from your storage device.

+

 

+

Non-legally Binding License Description

+

The above license is designed to protect both +me, and the Monkey's Audio project.  However, anyone who has ever been kind +enough to request permission to use Monkey's Audio has been granted the right to +do as they please, completely free of charge or royalty.  So, the license +exists not to hinder what considerate people can do with Monkey's Audio, but +instead to protect against the (hopefully few) inconsiderate people.

+

 

+

 

+

All +rights not expressly granted here are reserved by Matthew T. Ashland.

+

 

+

- +All materials and programs copyrighted ©2000-2002 by Matthew T. Ashland -

+

- +All rights reserved. -

+ + + + diff --git a/Libraries/MAC/Files/Source/MACLib/.DS_Store b/Libraries/MAC/Files/Source/MACLib/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..49fc4d2f047a390da84b706ef3716742adbf351c GIT binary patch literal 15364 zcmeHM&2AGh5FRI~NYkj4Rz)0_8(jD~^d8a_QHh^Qu=_pZ@k{xAtKe@@82X!h^UT}?Lrfm$iesd zoH{DD8JCfG8jehytR(|DXWg*?iRJjFqb>APR^Ae-z;P zA;HPEW$naRJ$2xsmjJLeH0uN3u@2Cf#M+j%6Js?LKF#VuS*Ws03}xWBpKy2BmbDXO z4V;vLld_SOU7;u)9k@hyC)F}muA+b_Fs%Tu-Otl4+MqRB_15oWx<);$=7;NpwAUS^ zUG(IK>nYC5zx07`M2$l9j*nFH0dlDT$vk)uAsSzO54>DB)=R)cXYkR(hJ8?~ZI2q*?je7{=a~3W-ujn0}eIM6RNiAIDoK@0C z2Ju*bwc@bNQR}ovFOhG&?qKPmW^Jq^R1k-C^$>ZSyYw27cH?n0yUz~0JkAj+jKj=a zM6TZ^;_!ahpm6*!!x-`*M%}9tem@<4b*n>;iLnd&kFh_u4Q^d zX*$5Dp(eGFWCjW&e75MIm~>^`A>D}JBE$pCJ;YfhE<`sThf7|H=_B!QLVFI(H-}rD z{5SzG9w3!3PX9*G|Gl0zM;OR&0%;ihP`MuMV4UpX!#Uo^=QdjTp2;@w z#cEfdIUE;&*rpG7VX<0$?J=)A+B=7L1O772IV(ph2<#!}=@ACuiKZ`|g&Vb5fDN+ODjzy* z7o)f~`15=m)tnBAW)>YE3&;2fIB4!ZhbNdu9}~Yfhj=VAD44>IP?rJ@>eCd5avvcF zXg_n+$$?)Ta)<(=fG8jeoR$Jr6FA}h|Fz=Z|4)ma#1#cZfq$TYs&zIyZ3MD=>r){s zXi0Fsz{v;qn;5GhxNsM4*W2;PXGV_ literal 0 HcmV?d00001 diff --git a/Libraries/MAC/Files/Source/MACLib/APECompress.cpp b/Libraries/MAC/Files/Source/MACLib/APECompress.cpp new file mode 100755 index 000000000..00b21f36b --- /dev/null +++ b/Libraries/MAC/Files/Source/MACLib/APECompress.cpp @@ -0,0 +1,249 @@ +#include "All.h" +#include "APECompress.h" +#include IO_HEADER_FILE +#include "APECompressCreate.h" +#include "WAVInputSource.h" +#include "CharacterHelper.h" + +CAPECompress::CAPECompress() +{ + m_nBufferHead = 0; + m_nBufferTail = 0; + m_nBufferSize = 0; + m_bBufferLocked = FALSE; + m_bOwnsOutputIO = FALSE; + m_pioOutput = NULL; + + m_spAPECompressCreate.Assign(new CAPECompressCreate()); + + m_pBuffer = NULL; +} + +CAPECompress::~CAPECompress() +{ + SAFE_ARRAY_DELETE(m_pBuffer) + + if (m_bOwnsOutputIO) + { + SAFE_DELETE(m_pioOutput) + } +} + +int CAPECompress::Start(const char * pOutputFilename, const WAVEFORMATEX * pwfeInput, int nMaxAudioBytes, int nCompressionLevel, const void * pHeaderData, int nHeaderBytes) +{ + m_pioOutput = new IO_CLASS_NAME; + m_bOwnsOutputIO = TRUE; + + if (m_pioOutput->Create(pOutputFilename) != 0) + { + return ERROR_INVALID_OUTPUT_FILE; + } + + m_spAPECompressCreate->Start(m_pioOutput, pwfeInput, nMaxAudioBytes, nCompressionLevel, + pHeaderData, nHeaderBytes); + + SAFE_ARRAY_DELETE(m_pBuffer) + m_nBufferSize = m_spAPECompressCreate->GetFullFrameBytes(); + m_pBuffer = new unsigned char [m_nBufferSize]; + memcpy(&m_wfeInput, pwfeInput, sizeof(WAVEFORMATEX)); + + return ERROR_SUCCESS; +} + +int CAPECompress::StartEx(CIO * pioOutput, const WAVEFORMATEX * pwfeInput, int nMaxAudioBytes, int nCompressionLevel, const void * pHeaderData, int nHeaderBytes) +{ + m_pioOutput = pioOutput; + m_bOwnsOutputIO = FALSE; + + m_spAPECompressCreate->Start(m_pioOutput, pwfeInput, nMaxAudioBytes, nCompressionLevel, + pHeaderData, nHeaderBytes); + + SAFE_ARRAY_DELETE(m_pBuffer) + m_nBufferSize = m_spAPECompressCreate->GetFullFrameBytes(); + m_pBuffer = new unsigned char [m_nBufferSize]; + memcpy(&m_wfeInput, pwfeInput, sizeof(WAVEFORMATEX)); + + return ERROR_SUCCESS; +} + +int CAPECompress::GetBufferBytesAvailable() +{ + return m_nBufferSize - m_nBufferTail; +} + +int CAPECompress::UnlockBuffer(int nBytesAdded, BOOL bProcess) +{ + if (m_bBufferLocked == FALSE) + return ERROR_UNDEFINED; + + m_nBufferTail += nBytesAdded; + m_bBufferLocked = FALSE; + + if (bProcess) + { + int nRetVal = ProcessBuffer(); + if (nRetVal != 0) { return nRetVal; } + } + + return ERROR_SUCCESS; +} + +unsigned char * CAPECompress::LockBuffer(int * pBytesAvailable) +{ + if (m_pBuffer == NULL) { return NULL; } + + if (m_bBufferLocked) + return NULL; + + m_bBufferLocked = TRUE; + + if (pBytesAvailable) + *pBytesAvailable = GetBufferBytesAvailable(); + + return &m_pBuffer[m_nBufferTail]; +} + +int CAPECompress::AddData(unsigned char * pData, int nBytes) +{ + if (m_pBuffer == NULL) return ERROR_INSUFFICIENT_MEMORY; + + int nBytesDone = 0; + + while (nBytesDone < nBytes) + { + // lock the buffer + int nBytesAvailable = 0; + unsigned char * pBuffer = LockBuffer(&nBytesAvailable); + if (pBuffer == NULL || nBytesAvailable <= 0) + return ERROR_UNDEFINED; + + // calculate how many bytes to copy and add that much to the buffer + int nBytesToProcess = min(nBytesAvailable, nBytes - nBytesDone); + memcpy(pBuffer, &pData[nBytesDone], nBytesToProcess); + + // unlock the buffer (fail if not successful) + int nRetVal = UnlockBuffer(nBytesToProcess); + if (nRetVal != ERROR_SUCCESS) + return nRetVal; + + // update our progress + nBytesDone += nBytesToProcess; + } + + return ERROR_SUCCESS; +} + +int CAPECompress::Finish(unsigned char * pTerminatingData, int nTerminatingBytes, int nWAVTerminatingBytes) +{ + RETURN_ON_ERROR(ProcessBuffer(TRUE)) + return m_spAPECompressCreate->Finish(pTerminatingData, nTerminatingBytes, nWAVTerminatingBytes); +} + +int CAPECompress::Kill() +{ + return ERROR_SUCCESS; +} + +int CAPECompress::ProcessBuffer(BOOL bFinalize) +{ + if (m_pBuffer == NULL) { return ERROR_UNDEFINED; } + + try + { + // process as much as possible + int nThreshold = (bFinalize) ? 0 : m_spAPECompressCreate->GetFullFrameBytes(); + + while ((m_nBufferTail - m_nBufferHead) >= nThreshold) + { + int nFrameBytes = min(m_spAPECompressCreate->GetFullFrameBytes(), m_nBufferTail - m_nBufferHead); + + if (nFrameBytes == 0) + break; + + int nRetVal = m_spAPECompressCreate->EncodeFrame(&m_pBuffer[m_nBufferHead], nFrameBytes); + if (nRetVal != 0) { return nRetVal; } + + m_nBufferHead += nFrameBytes; + } + + // shift the buffer + if (m_nBufferHead != 0) + { + int nBytesLeft = m_nBufferTail - m_nBufferHead; + + if (nBytesLeft != 0) + memmove(m_pBuffer, &m_pBuffer[m_nBufferHead], nBytesLeft); + + m_nBufferTail -= m_nBufferHead; + m_nBufferHead = 0; + } + } + catch(...) + { + return ERROR_UNDEFINED; + } + + return ERROR_SUCCESS; +} + +int CAPECompress::AddDataFromInputSource(CInputSource * pInputSource, int nMaxBytes, int * pBytesAdded) +{ + // error check the parameters + if (pInputSource == NULL) return ERROR_BAD_PARAMETER; + + // initialize + if (pBytesAdded) *pBytesAdded = 0; + + // lock the buffer + int nBytesAvailable = 0; + unsigned char * pBuffer = LockBuffer(&nBytesAvailable); + if ((pBuffer == NULL) || (nBytesAvailable == 0)) + return ERROR_INSUFFICIENT_MEMORY; + + // calculate the 'ideal' number of bytes + unsigned int nBytesRead = 0; + + int nIdealBytes = m_spAPECompressCreate->GetFullFrameBytes() - (m_nBufferTail - m_nBufferHead); + if (nIdealBytes > 0) + { + + // get the data + int nBytesToAdd = nBytesAvailable; + + if (nMaxBytes > 0) + { + if (nBytesToAdd > nMaxBytes) nBytesToAdd = nMaxBytes; + } + + if (nBytesToAdd > nIdealBytes) nBytesToAdd = nIdealBytes; + + // always make requests along block boundaries + while ((nBytesToAdd % m_wfeInput.nBlockAlign) != 0) + nBytesToAdd--; + + int nBlocksToAdd = nBytesToAdd / m_wfeInput.nBlockAlign; + + // get data + int nBlocksAdded = 0; + int nRetVal = pInputSource->GetData(pBuffer, nBlocksToAdd, &nBlocksAdded); + + if (nRetVal != 0) + return ERROR_IO_READ; + else + nBytesRead = (nBlocksAdded * m_wfeInput.nBlockAlign); + + // store the bytes read + if (pBytesAdded) + *pBytesAdded = nBytesRead; + } + + // unlock the data and process + int nRetVal = UnlockBuffer(nBytesRead, TRUE); + if (nRetVal != 0) + { + return nRetVal; + } + + return ERROR_SUCCESS; +} + diff --git a/Libraries/MAC/Files/Source/MACLib/APECompress.h b/Libraries/MAC/Files/Source/MACLib/APECompress.h new file mode 100755 index 000000000..8dca46ab4 --- /dev/null +++ b/Libraries/MAC/Files/Source/MACLib/APECompress.h @@ -0,0 +1,56 @@ +#ifndef APE_APECOMPRESS_H +#define APE_APECOMPRESS_H + +#include "MACLib.h" +class CAPECompressCreate; + +/************************************************************************************************* +CAPECompress - uses the CAPECompressHub to provide a simpler compression interface (with buffering, etc) +*************************************************************************************************/ +class CAPECompress : public IAPECompress +{ +public: + + CAPECompress(); + ~CAPECompress(); + + // start encoding + int Start(const char * pOutputFilename, const WAVEFORMATEX * pwfeInput, int nMaxAudioBytes, int nCompressionLevel = COMPRESSION_LEVEL_NORMAL, const void * pHeaderData = NULL, int nHeaderBytes = CREATE_WAV_HEADER_ON_DECOMPRESSION); + int StartEx(CIO * pioOutput, const WAVEFORMATEX * pwfeInput, int nMaxAudioBytes, int nCompressionLevel = COMPRESSION_LEVEL_NORMAL, const void * pHeaderData = NULL, int nHeaderBytes = CREATE_WAV_HEADER_ON_DECOMPRESSION); + + // add data / compress data + + // allows linear, immediate access to the buffer (fast) + int GetBufferBytesAvailable(); + int UnlockBuffer(int nBytesAdded, BOOL bProcess = TRUE); + unsigned char * LockBuffer(int * pBytesAvailable); + + // slower, but easier than locking and unlocking (copies data) + int AddData(unsigned char * pData, int nBytes); + + // use a CIO (input source) to add data + int AddDataFromInputSource(CInputSource * pInputSource, int nMaxBytes = -1, int * pBytesAdded = NULL); + + // finish / kill + int Finish(unsigned char * pTerminatingData, int nTerminatingBytes, int nWAVTerminatingBytes); + int Kill(); + +private: + + int ProcessBuffer(BOOL bFinalize = FALSE); + + CSmartPtr m_spAPECompressCreate; + + int m_nBufferHead; + int m_nBufferTail; + int m_nBufferSize; + unsigned char * m_pBuffer; + BOOL m_bBufferLocked; + + CIO * m_pioOutput; + BOOL m_bOwnsOutputIO; + WAVEFORMATEX m_wfeInput; + +}; + +#endif // #ifndef APE_APECOMPRESS_H diff --git a/Libraries/MAC/Files/Source/MACLib/APECompressCore.cpp b/Libraries/MAC/Files/Source/MACLib/APECompressCore.cpp new file mode 100755 index 000000000..8204a9200 --- /dev/null +++ b/Libraries/MAC/Files/Source/MACLib/APECompressCore.cpp @@ -0,0 +1,126 @@ +#include "All.h" +#include "APECompressCore.h" + +#include "BitArray.h" +#include "Prepare.h" +#include "NewPredictor.h" + +CAPECompressCore::CAPECompressCore(CIO * pIO, const WAVEFORMATEX * pwfeInput, int nMaxFrameBlocks, int nCompressionLevel) +{ + m_spBitArray.Assign(new CBitArray(pIO)); + m_spDataX.Assign(new int [nMaxFrameBlocks], TRUE); + m_spDataY.Assign(new int [nMaxFrameBlocks], TRUE); + m_spTempData.Assign(new int [nMaxFrameBlocks], TRUE); + m_spPrepare.Assign(new CPrepare); + m_spPredictorX.Assign(new CPredictorCompressNormal(nCompressionLevel)); + m_spPredictorY.Assign(new CPredictorCompressNormal(nCompressionLevel)); + + memcpy(&m_wfeInput, pwfeInput, sizeof(WAVEFORMATEX)); + m_nPeakLevel = 0; +} + +CAPECompressCore::~CAPECompressCore() +{ +} + +int CAPECompressCore::EncodeFrame(const void * pInputData, int nInputBytes) +{ + // variables + const int nInputBlocks = nInputBytes / m_wfeInput.nBlockAlign; + int nSpecialCodes = 0; + + // always start a new frame on a byte boundary + m_spBitArray->AdvanceToByteBoundary(); + + // do the preparation stage + RETURN_ON_ERROR(Prepare(pInputData, nInputBytes, &nSpecialCodes)) + + m_spPredictorX->Flush(); + m_spPredictorY->Flush(); + + m_spBitArray->FlushState(m_BitArrayStateX); + m_spBitArray->FlushState(m_BitArrayStateY); + + m_spBitArray->FlushBitArray(); + + if (m_wfeInput.nChannels == 2) + { + BOOL bEncodeX = TRUE; + BOOL bEncodeY = TRUE; + + if ((nSpecialCodes & SPECIAL_FRAME_LEFT_SILENCE) && + (nSpecialCodes & SPECIAL_FRAME_RIGHT_SILENCE)) + { + bEncodeX = FALSE; + bEncodeY = FALSE; + } + + if (nSpecialCodes & SPECIAL_FRAME_PSEUDO_STEREO) + { + bEncodeY = FALSE; + } + + if (bEncodeX && bEncodeY) + { + int nLastX = 0; + for (int z = 0; z < nInputBlocks; z++) + { + m_spBitArray->EncodeValue(m_spPredictorY->CompressValue(m_spDataY[z], nLastX), m_BitArrayStateY); + m_spBitArray->EncodeValue(m_spPredictorX->CompressValue(m_spDataX[z], m_spDataY[z]), m_BitArrayStateX); + + nLastX = m_spDataX[z]; + } + } + else if (bEncodeX) + { + for (int z = 0; z < nInputBlocks; z++) + { + RETURN_ON_ERROR(m_spBitArray->EncodeValue(m_spPredictorX->CompressValue(m_spDataX[z]), m_BitArrayStateX)) + } + } + else if (bEncodeY) + { + for (int z = 0; z < nInputBlocks; z++) + { + RETURN_ON_ERROR(m_spBitArray->EncodeValue(m_spPredictorY->CompressValue(m_spDataY[z]), m_BitArrayStateY)) + } + } + } + else if (m_wfeInput.nChannels == 1) + { + if (!(nSpecialCodes & SPECIAL_FRAME_MONO_SILENCE)) + { + for (int z = 0; z < nInputBlocks; z++) + { + RETURN_ON_ERROR(m_spBitArray->EncodeValue(m_spPredictorX->CompressValue(m_spDataX[z]), m_BitArrayStateX)) + } + } + } + + m_spBitArray->Finalize(); + + // return success + return 0; +} + +int CAPECompressCore::Prepare(const void * pInputData, int nInputBytes, int * pSpecialCodes) +{ + // variable declares + *pSpecialCodes = 0; + unsigned int nCRC = 0; + + // do the preparation + RETURN_ON_ERROR(m_spPrepare->Prepare((unsigned char *) pInputData, nInputBytes, &m_wfeInput, m_spDataX, m_spDataY, + &nCRC, pSpecialCodes, &m_nPeakLevel)) + + // store the CRC + RETURN_ON_ERROR(m_spBitArray->EncodeUnsignedLong(nCRC)) + + // store any special codes + if (*pSpecialCodes != 0) + { + RETURN_ON_ERROR(m_spBitArray->EncodeUnsignedLong(*pSpecialCodes)) + } + + return 0; +} \ No newline at end of file diff --git a/Libraries/MAC/Files/Source/MACLib/APECompressCore.h b/Libraries/MAC/Files/Source/MACLib/APECompressCore.h new file mode 100755 index 000000000..622bf95c7 --- /dev/null +++ b/Libraries/MAC/Files/Source/MACLib/APECompressCore.h @@ -0,0 +1,41 @@ +#ifndef APE_APECOMPRESSCORE_H +#define APE_APECOMPRESSCORE_H + +#include "APECompress.h" +#include "BitArray.h" + +class CPrepare; +class IPredictorCompress; + +/************************************************************************************************* +CAPECompressCore - manages the core of compression and bitstream output +*************************************************************************************************/ +class CAPECompressCore +{ +public: + CAPECompressCore(CIO * pIO, const WAVEFORMATEX * pwfeInput, int nMaxFrameBlocks, int nCompressionLevel); + ~CAPECompressCore(); + + int EncodeFrame(const void * pInputData, int nInputBytes); + + CBitArray * GetBitArray() { return m_spBitArray.GetPtr(); } + int GetPeakLevel() { return m_nPeakLevel; } + +private: + + int Prepare(const void * pInputData, int nInputBytes, int * pSpecialCodes); + + CSmartPtr m_spBitArray; + CSmartPtr m_spPredictorX; + CSmartPtr m_spPredictorY; + BIT_ARRAY_STATE m_BitArrayStateX; + BIT_ARRAY_STATE m_BitArrayStateY; + CSmartPtr m_spDataX; + CSmartPtr m_spDataY; + CSmartPtr m_spTempData; + CSmartPtr m_spPrepare; + WAVEFORMATEX m_wfeInput; + int m_nPeakLevel; +}; + +#endif // #ifndef APE_APECOMPRESSCORE_H diff --git a/Libraries/MAC/Files/Source/MACLib/APECompressCreate.cpp b/Libraries/MAC/Files/Source/MACLib/APECompressCreate.cpp new file mode 100755 index 000000000..d2f9231eb --- /dev/null +++ b/Libraries/MAC/Files/Source/MACLib/APECompressCreate.cpp @@ -0,0 +1,287 @@ +#include "All.h" +#include "IO.h" +#include "APECompressCreate.h" + +#include "APECompressCore.h" + +CAPECompressCreate::CAPECompressCreate() +{ + m_nMaxFrames = 0; +} + +CAPECompressCreate::~CAPECompressCreate() +{ +} + +int CAPECompressCreate::Start(CIO * pioOutput, const WAVEFORMATEX * pwfeInput, int nMaxAudioBytes, int nCompressionLevel, const void * pHeaderData, int nHeaderBytes) +{ + // verify the parameters + if (pioOutput == NULL || pwfeInput == NULL) + return ERROR_BAD_PARAMETER; + + // verify the wave format + if ((pwfeInput->nChannels != 1) && (pwfeInput->nChannels != 2)) + { + return ERROR_INPUT_FILE_UNSUPPORTED_CHANNEL_COUNT; + } + if ((pwfeInput->wBitsPerSample != 8) && (pwfeInput->wBitsPerSample != 16) && (pwfeInput->wBitsPerSample != 24)) + { + return ERROR_INPUT_FILE_UNSUPPORTED_BIT_DEPTH; + } + + // initialize (creates the base classes) + m_nSamplesPerFrame = 73728; + if (nCompressionLevel == COMPRESSION_LEVEL_EXTRA_HIGH) + m_nSamplesPerFrame *= 4; + else if (nCompressionLevel == COMPRESSION_LEVEL_INSANE) + m_nSamplesPerFrame *= 16; + + m_spIO.Assign(pioOutput, FALSE, FALSE); + m_spAPECompressCore.Assign(new CAPECompressCore(m_spIO, pwfeInput, m_nSamplesPerFrame, nCompressionLevel)); + + // copy the format + memcpy(&m_wfeInput, pwfeInput, sizeof(WAVEFORMATEX)); + + // the compression level + m_nCompressionLevel = nCompressionLevel; + m_nFrameIndex = 0; + m_nLastFrameBlocks = m_nSamplesPerFrame; + + // initialize the file + if (nMaxAudioBytes < 0) + nMaxAudioBytes = 2147483647; + + uint32 nMaxAudioBlocks = nMaxAudioBytes / pwfeInput->nBlockAlign; + int nMaxFrames = nMaxAudioBlocks / m_nSamplesPerFrame; + if ((nMaxAudioBlocks % m_nSamplesPerFrame) != 0) nMaxFrames++; + + InitializeFile(m_spIO, &m_wfeInput, nMaxFrames, + m_nCompressionLevel, pHeaderData, nHeaderBytes); + + return ERROR_SUCCESS; +} + +int CAPECompressCreate::GetFullFrameBytes() +{ + return m_nSamplesPerFrame * m_wfeInput.nBlockAlign; +} + +int CAPECompressCreate::EncodeFrame(const void * pInputData, int nInputBytes) +{ + int nInputBlocks = nInputBytes / m_wfeInput.nBlockAlign; + + if ((nInputBlocks < m_nSamplesPerFrame) && (m_nLastFrameBlocks < m_nSamplesPerFrame)) + { + return -1; // can only pass a smaller frame for the very last time + } + + // update the seek table + m_spAPECompressCore->GetBitArray()->AdvanceToByteBoundary(); + int nRetVal = SetSeekByte(m_nFrameIndex, m_spIO->GetPosition() + (m_spAPECompressCore->GetBitArray()->GetCurrentBitIndex() / 8)); + if (nRetVal != ERROR_SUCCESS) + return nRetVal; + + // compress + nRetVal = m_spAPECompressCore->EncodeFrame(pInputData, nInputBytes); + + // update stats + m_nLastFrameBlocks = nInputBlocks; + m_nFrameIndex++; + + return nRetVal; +} + +int CAPECompressCreate::Finish(const void * pTerminatingData, int nTerminatingBytes, int nWAVTerminatingBytes) +{ + // clear the bit array + RETURN_ON_ERROR(m_spAPECompressCore->GetBitArray()->OutputBitArray(TRUE)); + // finalize the file + RETURN_ON_ERROR(FinalizeFile(m_spIO, m_nFrameIndex, m_nLastFrameBlocks, + pTerminatingData, nTerminatingBytes, nWAVTerminatingBytes, m_spAPECompressCore->GetPeakLevel())); + return ERROR_SUCCESS; +} + +int CAPECompressCreate::SetSeekByte(int nFrame, int nByteOffset) +{ + if (nFrame >= m_nMaxFrames) return ERROR_APE_COMPRESS_TOO_MUCH_DATA; + m_spSeekTable[nFrame] = nByteOffset; + return ERROR_SUCCESS; +} + +int CAPECompressCreate::InitializeFile(CIO * pIO, const WAVEFORMATEX * pwfeInput, int nMaxFrames, int nCompressionLevel, const void * pHeaderData, int nHeaderBytes) +{ + // error check the parameters + if (pIO == NULL || pwfeInput == NULL || nMaxFrames <= 0) + return ERROR_BAD_PARAMETER; + + APE_DESCRIPTOR APEDescriptor; memset(&APEDescriptor, 0, sizeof(APEDescriptor)); + APE_HEADER APEHeader; memset(&APEHeader, 0, sizeof(APEHeader)); + + APE_DESCRIPTOR APEDescriptor_tmp; memset(&APEDescriptor, 0, sizeof(APEDescriptor)); + APE_HEADER APEHeader_tmp; memset(&APEHeader, 0, sizeof(APEHeader)); + + // create the descriptor (only fill what we know) + APEDescriptor.cID[0] = 'M'; + APEDescriptor.cID[1] = 'A'; + APEDescriptor.cID[2] = 'C'; + APEDescriptor.cID[3] = ' '; + APEDescriptor.nVersion = MAC_VERSION_NUMBER; + + APEDescriptor.nDescriptorBytes = sizeof(APEDescriptor); + APEDescriptor.nHeaderBytes = sizeof(APEHeader); + APEDescriptor.nSeekTableBytes = nMaxFrames * sizeof(unsigned int); + APEDescriptor.nHeaderDataBytes = (nHeaderBytes == CREATE_WAV_HEADER_ON_DECOMPRESSION) ? 0 : nHeaderBytes; + + // create the header (only fill what we know now) + APEHeader.nBitsPerSample = pwfeInput->wBitsPerSample; + APEHeader.nChannels = pwfeInput->nChannels; + APEHeader.nSampleRate = pwfeInput->nSamplesPerSec; + + APEHeader.nCompressionLevel = (uint16) nCompressionLevel; + APEHeader.nFormatFlags = (nHeaderBytes == CREATE_WAV_HEADER_ON_DECOMPRESSION) ? MAC_FORMAT_FLAG_CREATE_WAV_HEADER : 0; + + APEHeader.nBlocksPerFrame = m_nSamplesPerFrame; + + // write the data to the file + + APEDescriptor_tmp.cID[0] = 'M'; + APEDescriptor_tmp.cID[1] = 'A'; + APEDescriptor_tmp.cID[2] = 'C'; + APEDescriptor_tmp.cID[3] = ' '; + APEDescriptor_tmp.nVersion = swap_endian32(APEDescriptor.nVersion); + APEDescriptor_tmp.nDescriptorBytes = swap_endian32(APEDescriptor.nDescriptorBytes); + APEDescriptor_tmp.nHeaderBytes = swap_endian32(APEDescriptor.nHeaderBytes); + APEDescriptor_tmp.nSeekTableBytes = swap_endian32(APEDescriptor.nSeekTableBytes); + APEDescriptor_tmp.nHeaderDataBytes = swap_endian32(APEDescriptor.nHeaderDataBytes); + + APEHeader_tmp.nBitsPerSample = swap_endian16(APEHeader.nBitsPerSample); + APEHeader_tmp.nChannels = swap_endian16(APEHeader.nChannels); + APEHeader_tmp.nSampleRate = swap_endian32(APEHeader.nSampleRate); + APEHeader_tmp.nCompressionLevel = swap_endian16(APEHeader.nCompressionLevel); + APEHeader_tmp.nFormatFlags = swap_endian16(APEHeader.nFormatFlags); + APEHeader_tmp.nBlocksPerFrame = swap_endian32(APEHeader.nBlocksPerFrame); + + unsigned int nBytesWritten = 0; + /* + RETURN_ON_ERROR(pIO->Write(&APEDescriptor, sizeof(APEDescriptor), &nBytesWritten)) + RETURN_ON_ERROR(pIO->Write(&APEHeader, sizeof(APEHeader), &nBytesWritten)) + */ + RETURN_ON_ERROR(pIO->Write(&APEDescriptor_tmp, sizeof(APEDescriptor), &nBytesWritten)) + RETURN_ON_ERROR(pIO->Write(&APEHeader_tmp, sizeof(APEHeader), &nBytesWritten)) + + // write an empty seek table + m_spSeekTable.Assign(new uint32 [nMaxFrames], TRUE); + if (m_spSeekTable == NULL) { return ERROR_INSUFFICIENT_MEMORY; } + ZeroMemory(m_spSeekTable, nMaxFrames * 4); + RETURN_ON_ERROR(pIO->Write(m_spSeekTable, (nMaxFrames * 4), &nBytesWritten)) + m_nMaxFrames = nMaxFrames; + + // write the WAV data + if ((pHeaderData != NULL) && (nHeaderBytes > 0) && (nHeaderBytes != CREATE_WAV_HEADER_ON_DECOMPRESSION)) + { + m_spAPECompressCore->GetBitArray()->GetMD5Helper().AddData(pHeaderData, nHeaderBytes); + RETURN_ON_ERROR(pIO->Write((void *) pHeaderData, nHeaderBytes, &nBytesWritten)) + } + + return ERROR_SUCCESS; +} + + +int CAPECompressCreate::FinalizeFile(CIO * pIO, int nNumberOfFrames, int nFinalFrameBlocks, const void * pTerminatingData, int nTerminatingBytes, int nWAVTerminatingBytes, int nPeakLevel) +{ + int i; + // store the tail position + int nTailPosition = pIO->GetPosition(); + + // append the terminating data + unsigned int nBytesWritten = 0; + unsigned int nBytesRead = 0; + int nRetVal = 0; + if (nTerminatingBytes > 0) + { + m_spAPECompressCore->GetBitArray()->GetMD5Helper().AddData(pTerminatingData, nTerminatingBytes); + if (pIO->Write((void *) pTerminatingData, nTerminatingBytes, &nBytesWritten) != 0) { return ERROR_IO_WRITE; } + } + + // go to the beginning and update the information + nRetVal = pIO->Seek(0, FILE_BEGIN); + + // get the descriptor + APE_DESCRIPTOR APEDescriptor, APEDescriptor_tmp; + + nRetVal = pIO->Read(&APEDescriptor, sizeof(APEDescriptor), &nBytesRead); + if ((nRetVal != 0) || (nBytesRead != sizeof(APEDescriptor))) { return ERROR_IO_READ; } + APEDescriptor.nVersion = swap_endian32(APEDescriptor.nVersion); + APEDescriptor.nDescriptorBytes = swap_endian32(APEDescriptor.nDescriptorBytes); + APEDescriptor.nHeaderBytes = swap_endian32(APEDescriptor.nHeaderBytes); + APEDescriptor.nSeekTableBytes = swap_endian32(APEDescriptor.nSeekTableBytes); + APEDescriptor.nHeaderDataBytes = swap_endian32(APEDescriptor.nHeaderDataBytes); + + // get the header + APE_HEADER APEHeader, APEHeader_tmp; + nRetVal = pIO->Read(&APEHeader, sizeof(APEHeader), &nBytesRead); + if (nRetVal != 0 || nBytesRead != sizeof(APEHeader)) { return ERROR_IO_READ; } + APEHeader.nBitsPerSample = swap_endian16(APEHeader.nBitsPerSample); + APEHeader.nChannels = swap_endian16(APEHeader.nChannels); + APEHeader.nSampleRate = swap_endian32(APEHeader.nSampleRate); + APEHeader.nCompressionLevel = swap_endian16(APEHeader.nCompressionLevel); + APEHeader.nFormatFlags = swap_endian16(APEHeader.nFormatFlags); + APEHeader.nBlocksPerFrame = swap_endian32(APEHeader.nBlocksPerFrame); + + // update the header + APEHeader.nFinalFrameBlocks = nFinalFrameBlocks; + APEHeader.nTotalFrames = nNumberOfFrames; + + // update the descriptor + APEDescriptor.nAPEFrameDataBytes = nTailPosition - (APEDescriptor.nDescriptorBytes + APEDescriptor.nHeaderBytes + APEDescriptor.nSeekTableBytes + APEDescriptor.nHeaderDataBytes); + APEDescriptor.nAPEFrameDataBytesHigh = 0; + APEDescriptor.nTerminatingDataBytes = nTerminatingBytes; + + // update the MD5 + m_spAPECompressCore->GetBitArray()->GetMD5Helper().AddData(&APEHeader, sizeof(APEHeader)); + m_spAPECompressCore->GetBitArray()->GetMD5Helper().AddData(m_spSeekTable, m_nMaxFrames * 4); + m_spAPECompressCore->GetBitArray()->GetMD5Helper().GetResult(APEDescriptor.cFileMD5); + + // set the pointer and re-write the updated header and peak level + nRetVal = pIO->Seek(0, FILE_BEGIN); + + APEDescriptor_tmp.cID[0] = 'M'; + APEDescriptor_tmp.cID[1] = 'A'; + APEDescriptor_tmp.cID[2] = 'C'; + APEDescriptor_tmp.cID[3] = ' '; + APEDescriptor_tmp.nVersion = swap_endian32(APEDescriptor.nVersion); + APEDescriptor_tmp.nDescriptorBytes = swap_endian32(APEDescriptor.nDescriptorBytes); + APEDescriptor_tmp.nHeaderBytes = swap_endian32(APEDescriptor.nHeaderBytes); + APEDescriptor_tmp.nSeekTableBytes = swap_endian32(APEDescriptor.nSeekTableBytes); + APEDescriptor_tmp.nHeaderDataBytes = swap_endian32(APEDescriptor.nHeaderDataBytes); + APEDescriptor_tmp.nAPEFrameDataBytes = swap_endian32(APEDescriptor.nAPEFrameDataBytes); + APEDescriptor_tmp.nAPEFrameDataBytesHigh = swap_endian32(APEDescriptor.nAPEFrameDataBytesHigh); + APEDescriptor_tmp.nTerminatingDataBytes = swap_endian32(APEDescriptor.nTerminatingDataBytes); + + APEHeader_tmp.nBitsPerSample = swap_endian16(APEHeader.nBitsPerSample); + APEHeader_tmp.nChannels = swap_endian16(APEHeader.nChannels); + APEHeader_tmp.nSampleRate = swap_endian32(APEHeader.nSampleRate); + APEHeader_tmp.nCompressionLevel = swap_endian16(APEHeader.nCompressionLevel); + APEHeader_tmp.nFormatFlags = swap_endian16(APEHeader.nFormatFlags); + APEHeader_tmp.nBlocksPerFrame = swap_endian32(APEHeader.nBlocksPerFrame); + APEHeader_tmp.nFinalFrameBlocks = swap_endian32(APEHeader.nFinalFrameBlocks); + APEHeader_tmp.nTotalFrames = swap_endian32(APEHeader.nTotalFrames); + + /* + if (pIO->Write(&APEDescriptor, sizeof(APEDescriptor), &nBytesWritten) != 0) { return ERROR_IO_WRITE; } + if (pIO->Write(&APEHeader, sizeof(APEHeader), &nBytesWritten) != 0) { return ERROR_IO_WRITE; } + */ + if (pIO->Write(&APEDescriptor_tmp, sizeof(APEDescriptor), &nBytesWritten) != 0) { return ERROR_IO_WRITE; } + if (pIO->Write(&APEHeader_tmp, sizeof(APEHeader), &nBytesWritten) != 0) { return ERROR_IO_WRITE; } + + // write the updated seek table + for(i=0;iWrite(m_spSeekTable, m_nMaxFrames * 4, &nBytesWritten) != 0) { return ERROR_IO_WRITE; } + for(i=0;i m_spSeekTable; + int m_nMaxFrames; + + CSmartPtr m_spIO; + CSmartPtr m_spAPECompressCore; + + WAVEFORMATEX m_wfeInput; + int m_nCompressionLevel; + int m_nSamplesPerFrame; + int m_nFrameIndex; + int m_nLastFrameBlocks; + +}; + +#endif // #ifndef APE_APECOMPRESSCREATE_H diff --git a/Libraries/MAC/Files/Source/MACLib/APEDecompress.cpp b/Libraries/MAC/Files/Source/MACLib/APEDecompress.cpp new file mode 100755 index 000000000..54a44e512 --- /dev/null +++ b/Libraries/MAC/Files/Source/MACLib/APEDecompress.cpp @@ -0,0 +1,488 @@ +#include "All.h" +#include "APEDecompress.h" + +#include "APEInfo.h" +#include "Prepare.h" +#include "UnBitArray.h" +#include "NewPredictor.h" + +#define DECODE_BLOCK_SIZE 4096 + +CAPEDecompress::CAPEDecompress(int * pErrorCode, CAPEInfo * pAPEInfo, int nStartBlock, int nFinishBlock) +{ + *pErrorCode = ERROR_SUCCESS; + + // open / analyze the file + m_spAPEInfo.Assign(pAPEInfo); + + // version check (this implementation only works with 3.93 and later files) + if (GetInfo(APE_INFO_FILE_VERSION) < 3930) + { + *pErrorCode = ERROR_UNDEFINED; + return; + } + + // get format information + GetInfo(APE_INFO_WAVEFORMATEX, (int) &m_wfeInput); + m_nBlockAlign = GetInfo(APE_INFO_BLOCK_ALIGN); + + // initialize other stuff + m_bDecompressorInitialized = FALSE; + m_nCurrentFrame = 0; + m_nCurrentBlock = 0; + m_nCurrentFrameBufferBlock = 0; + m_nFrameBufferFinishedBlocks = 0; + m_bErrorDecodingCurrentFrame = FALSE; + + // set the "real" start and finish blocks + m_nStartBlock = (nStartBlock < 0) ? 0 : min(nStartBlock, GetInfo(APE_INFO_TOTAL_BLOCKS)); + m_nFinishBlock = (nFinishBlock < 0) ? GetInfo(APE_INFO_TOTAL_BLOCKS) : min(nFinishBlock, GetInfo(APE_INFO_TOTAL_BLOCKS)); + m_bIsRanged = (m_nStartBlock != 0) || (m_nFinishBlock != GetInfo(APE_INFO_TOTAL_BLOCKS)); +} + +CAPEDecompress::~CAPEDecompress() +{ + +} + +int CAPEDecompress::InitializeDecompressor() +{ + // check if we have anything to do + if (m_bDecompressorInitialized) + return ERROR_SUCCESS; + + // update the initialized flag + m_bDecompressorInitialized = TRUE; + + // create a frame buffer + m_cbFrameBuffer.CreateBuffer((GetInfo(APE_INFO_BLOCKS_PER_FRAME) + DECODE_BLOCK_SIZE) * m_nBlockAlign, m_nBlockAlign * 64); + + // create decoding components + m_spUnBitArray.Assign((CUnBitArrayBase *) CreateUnBitArray(this, GetInfo(APE_INFO_FILE_VERSION))); + + if (GetInfo(APE_INFO_FILE_VERSION) >= 3950) + { + m_spNewPredictorX.Assign(new CPredictorDecompress3950toCurrent(GetInfo(APE_INFO_COMPRESSION_LEVEL), GetInfo(APE_INFO_FILE_VERSION))); + m_spNewPredictorY.Assign(new CPredictorDecompress3950toCurrent(GetInfo(APE_INFO_COMPRESSION_LEVEL), GetInfo(APE_INFO_FILE_VERSION))); + } + else + { + m_spNewPredictorX.Assign(new CPredictorDecompressNormal3930to3950(GetInfo(APE_INFO_COMPRESSION_LEVEL), GetInfo(APE_INFO_FILE_VERSION))); + m_spNewPredictorY.Assign(new CPredictorDecompressNormal3930to3950(GetInfo(APE_INFO_COMPRESSION_LEVEL), GetInfo(APE_INFO_FILE_VERSION))); + } + + // seek to the beginning + return Seek(0); +} + +int CAPEDecompress::GetData(char * pBuffer, int nBlocks, int * pBlocksRetrieved) +{ + int nRetVal = ERROR_SUCCESS; + if (pBlocksRetrieved) *pBlocksRetrieved = 0; + + // make sure we're initialized + RETURN_ON_ERROR(InitializeDecompressor()) + + // cap + int nBlocksUntilFinish = m_nFinishBlock - m_nCurrentBlock; + const int nBlocksToRetrieve = min(nBlocks, nBlocksUntilFinish); + + // get the data + unsigned char * pOutputBuffer = (unsigned char *) pBuffer; + int nBlocksLeft = nBlocksToRetrieve; int nBlocksThisPass = 1; + while ((nBlocksLeft > 0) && (nBlocksThisPass > 0)) + { + // fill up the frame buffer + int nDecodeRetVal = FillFrameBuffer(); + if (nDecodeRetVal != ERROR_SUCCESS) + nRetVal = nDecodeRetVal; + + // analyze how much to remove from the buffer + const int nFrameBufferBlocks = m_nFrameBufferFinishedBlocks; + nBlocksThisPass = min(nBlocksLeft, nFrameBufferBlocks); + + // remove as much as possible + if (nBlocksThisPass > 0) + { + m_cbFrameBuffer.Get(pOutputBuffer, nBlocksThisPass * m_nBlockAlign); + pOutputBuffer += nBlocksThisPass * m_nBlockAlign; + nBlocksLeft -= nBlocksThisPass; + m_nFrameBufferFinishedBlocks -= nBlocksThisPass; + } + } + + // calculate the blocks retrieved + int nBlocksRetrieved = nBlocksToRetrieve - nBlocksLeft; + + // update position + m_nCurrentBlock += nBlocksRetrieved; + if (pBlocksRetrieved) *pBlocksRetrieved = nBlocksRetrieved; + + return nRetVal; +} + +int CAPEDecompress::Seek(int nBlockOffset) +{ + RETURN_ON_ERROR(InitializeDecompressor()) + + // use the offset + nBlockOffset += m_nStartBlock; + + // cap (to prevent seeking too far) + if (nBlockOffset >= m_nFinishBlock) + nBlockOffset = m_nFinishBlock - 1; + if (nBlockOffset < m_nStartBlock) + nBlockOffset = m_nStartBlock; + + // seek to the perfect location + int nBaseFrame = nBlockOffset / GetInfo(APE_INFO_BLOCKS_PER_FRAME); + int nBlocksToSkip = nBlockOffset % GetInfo(APE_INFO_BLOCKS_PER_FRAME); + int nBytesToSkip = nBlocksToSkip * m_nBlockAlign; + + m_nCurrentBlock = nBaseFrame * GetInfo(APE_INFO_BLOCKS_PER_FRAME); + m_nCurrentFrameBufferBlock = nBaseFrame * GetInfo(APE_INFO_BLOCKS_PER_FRAME); + m_nCurrentFrame = nBaseFrame; + m_nFrameBufferFinishedBlocks = 0; + m_cbFrameBuffer.Empty(); + RETURN_ON_ERROR(SeekToFrame(m_nCurrentFrame)); + + // skip necessary blocks + CSmartPtr spTempBuffer(new char [nBytesToSkip], TRUE); + if (spTempBuffer == NULL) return ERROR_INSUFFICIENT_MEMORY; + + int nBlocksRetrieved = 0; + GetData(spTempBuffer, nBlocksToSkip, &nBlocksRetrieved); + if (nBlocksRetrieved != nBlocksToSkip) + return ERROR_UNDEFINED; + + return ERROR_SUCCESS; +} + +/***************************************************************************************** +Decodes blocks of data +*****************************************************************************************/ +int CAPEDecompress::FillFrameBuffer() +{ + int nRetVal = ERROR_SUCCESS; + + // determine the maximum blocks we can decode + // note that we won't do end capping because we can't use data + // until EndFrame(...) successfully handles the frame + // that means we may decode a little extra in end capping cases + // but this allows robust error handling of bad frames + int nMaxBlocks = m_cbFrameBuffer.MaxAdd() / m_nBlockAlign; + + // loop and decode data + int nBlocksLeft = nMaxBlocks; + while (nBlocksLeft > 0) + { + int nFrameBlocks = GetInfo(APE_INFO_FRAME_BLOCKS, m_nCurrentFrame); + if (nFrameBlocks < 0) + break; + + int nFrameOffsetBlocks = m_nCurrentFrameBufferBlock % GetInfo(APE_INFO_BLOCKS_PER_FRAME); + int nFrameBlocksLeft = nFrameBlocks - nFrameOffsetBlocks; + int nBlocksThisPass = min(nFrameBlocksLeft, nBlocksLeft); + + // start the frame if we need to + if (nFrameOffsetBlocks == 0) + StartFrame(); + + // store the frame buffer bytes before we start + int nFrameBufferBytes = m_cbFrameBuffer.MaxGet(); + + // decode data + DecodeBlocksToFrameBuffer(nBlocksThisPass); + + // end the frame if we need to + if ((nFrameOffsetBlocks + nBlocksThisPass) >= nFrameBlocks) + { + EndFrame(); + if (m_bErrorDecodingCurrentFrame) + { + // remove any decoded data from the buffer + m_cbFrameBuffer.RemoveTail(m_cbFrameBuffer.MaxGet() - nFrameBufferBytes); + + // add silence + unsigned char cSilence = (GetInfo(APE_INFO_BITS_PER_SAMPLE) == 8) ? 127 : 0; + for (int z = 0; z < nFrameBlocks * m_nBlockAlign; z++) + { + *m_cbFrameBuffer.GetDirectWritePointer() = cSilence; + m_cbFrameBuffer.UpdateAfterDirectWrite(1); + } + + // seek to try to synchronize after an error + SeekToFrame(m_nCurrentFrame); + + // save the return value + nRetVal = ERROR_INVALID_CHECKSUM; + } + } + + nBlocksLeft -= nBlocksThisPass; + } + + return nRetVal; +} + +void CAPEDecompress::DecodeBlocksToFrameBuffer(int nBlocks) +{ + // decode the samples + int nBlocksProcessed = 0; + + try + { + if (m_wfeInput.nChannels == 2) + { + if ((m_nSpecialCodes & SPECIAL_FRAME_LEFT_SILENCE) && + (m_nSpecialCodes & SPECIAL_FRAME_RIGHT_SILENCE)) + { + for (nBlocksProcessed = 0; nBlocksProcessed < nBlocks; nBlocksProcessed++) + { + m_Prepare.Unprepare(0, 0, &m_wfeInput, m_cbFrameBuffer.GetDirectWritePointer(), &m_nCRC); + m_cbFrameBuffer.UpdateAfterDirectWrite(m_nBlockAlign); + } + } + else if (m_nSpecialCodes & SPECIAL_FRAME_PSEUDO_STEREO) + { + for (nBlocksProcessed = 0; nBlocksProcessed < nBlocks; nBlocksProcessed++) + { + int X = m_spNewPredictorX->DecompressValue(m_spUnBitArray->DecodeValueRange(m_BitArrayStateX)); + m_Prepare.Unprepare(X, 0, &m_wfeInput, m_cbFrameBuffer.GetDirectWritePointer(), &m_nCRC); + m_cbFrameBuffer.UpdateAfterDirectWrite(m_nBlockAlign); + } + } + else + { + if (m_spAPEInfo->GetInfo(APE_INFO_FILE_VERSION) >= 3950) + { + for (nBlocksProcessed = 0; nBlocksProcessed < nBlocks; nBlocksProcessed++) + { + int nY = m_spUnBitArray->DecodeValueRange(m_BitArrayStateY); + int nX = m_spUnBitArray->DecodeValueRange(m_BitArrayStateX); + int Y = m_spNewPredictorY->DecompressValue(nY, m_nLastX); + int X = m_spNewPredictorX->DecompressValue(nX, Y); + m_nLastX = X; + + m_Prepare.Unprepare(X, Y, &m_wfeInput, m_cbFrameBuffer.GetDirectWritePointer(), &m_nCRC); + m_cbFrameBuffer.UpdateAfterDirectWrite(m_nBlockAlign); + } + } + else + { + for (nBlocksProcessed = 0; nBlocksProcessed < nBlocks; nBlocksProcessed++) + { + int X = m_spNewPredictorX->DecompressValue(m_spUnBitArray->DecodeValueRange(m_BitArrayStateX)); + int Y = m_spNewPredictorY->DecompressValue(m_spUnBitArray->DecodeValueRange(m_BitArrayStateY)); + + m_Prepare.Unprepare(X, Y, &m_wfeInput, m_cbFrameBuffer.GetDirectWritePointer(), &m_nCRC); + m_cbFrameBuffer.UpdateAfterDirectWrite(m_nBlockAlign); + } + } + } + } + else + { + if (m_nSpecialCodes & SPECIAL_FRAME_MONO_SILENCE) + { + for (nBlocksProcessed = 0; nBlocksProcessed < nBlocks; nBlocksProcessed++) + { + m_Prepare.Unprepare(0, 0, &m_wfeInput, m_cbFrameBuffer.GetDirectWritePointer(), &m_nCRC); + m_cbFrameBuffer.UpdateAfterDirectWrite(m_nBlockAlign); + } + } + else + { + for (nBlocksProcessed = 0; nBlocksProcessed < nBlocks; nBlocksProcessed++) + { + int X = m_spNewPredictorX->DecompressValue(m_spUnBitArray->DecodeValueRange(m_BitArrayStateX)); + m_Prepare.Unprepare(X, 0, &m_wfeInput, m_cbFrameBuffer.GetDirectWritePointer(), &m_nCRC); + m_cbFrameBuffer.UpdateAfterDirectWrite(m_nBlockAlign); + } + } + } + } + catch(...) + { + m_bErrorDecodingCurrentFrame = TRUE; + } + + m_nCurrentFrameBufferBlock += nBlocks; +} + +void CAPEDecompress::StartFrame() +{ + m_nCRC = 0xFFFFFFFF; + + // get the frame header + m_nStoredCRC = m_spUnBitArray->DecodeValue(DECODE_VALUE_METHOD_UNSIGNED_INT); + m_bErrorDecodingCurrentFrame = FALSE; + + // get any 'special' codes if the file uses them (for silence, FALSE stereo, etc.) + m_nSpecialCodes = 0; + if (GET_USES_SPECIAL_FRAMES(m_spAPEInfo)) + { + if (m_nStoredCRC & 0x80000000) + { + m_nSpecialCodes = m_spUnBitArray->DecodeValue(DECODE_VALUE_METHOD_UNSIGNED_INT); + } + m_nStoredCRC &= 0x7FFFFFFF; + } + + m_spNewPredictorX->Flush(); + m_spNewPredictorY->Flush(); + + m_spUnBitArray->FlushState(m_BitArrayStateX); + m_spUnBitArray->FlushState(m_BitArrayStateY); + + m_spUnBitArray->FlushBitArray(); + + m_nLastX = 0; +} + +void CAPEDecompress::EndFrame() +{ + m_nFrameBufferFinishedBlocks += GetInfo(APE_INFO_FRAME_BLOCKS, m_nCurrentFrame); + m_nCurrentFrame++; + + // finalize + m_spUnBitArray->Finalize(); + + // check the CRC + m_nCRC = m_nCRC ^ 0xFFFFFFFF; + m_nCRC >>= 1; + if (m_nCRC != m_nStoredCRC) + m_bErrorDecodingCurrentFrame = TRUE; +} + +/***************************************************************************************** +Seek to the proper frame (if necessary) and do any alignment of the bit array +*****************************************************************************************/ +int CAPEDecompress::SeekToFrame(int nFrameIndex) +{ + int nSeekRemainder = (GetInfo(APE_INFO_SEEK_BYTE, nFrameIndex) - GetInfo(APE_INFO_SEEK_BYTE, 0)) % 4; + return m_spUnBitArray->FillAndResetBitArray(GetInfo(APE_INFO_SEEK_BYTE, nFrameIndex) - nSeekRemainder, nSeekRemainder * 8); +} + +/***************************************************************************************** +Get information from the decompressor +*****************************************************************************************/ +int CAPEDecompress::GetInfo(APE_DECOMPRESS_FIELDS Field, int nParam1, int nParam2) +{ + int nRetVal = 0; + BOOL bHandled = TRUE; + + switch (Field) + { + case APE_DECOMPRESS_CURRENT_BLOCK: + nRetVal = m_nCurrentBlock - m_nStartBlock; + break; + case APE_DECOMPRESS_CURRENT_MS: + { + int nSampleRate = m_spAPEInfo->GetInfo(APE_INFO_SAMPLE_RATE, 0, 0); + if (nSampleRate > 0) + nRetVal = int((double(m_nCurrentBlock) * double(1000)) / double(nSampleRate)); + break; + } + case APE_DECOMPRESS_TOTAL_BLOCKS: + nRetVal = m_nFinishBlock - m_nStartBlock; + break; + case APE_DECOMPRESS_LENGTH_MS: + { + int nSampleRate = m_spAPEInfo->GetInfo(APE_INFO_SAMPLE_RATE, 0, 0); + if (nSampleRate > 0) + nRetVal = int((double(m_nFinishBlock - m_nStartBlock) * double(1000)) / double(nSampleRate)); + break; + } + case APE_DECOMPRESS_CURRENT_BITRATE: + nRetVal = GetInfo(APE_INFO_FRAME_BITRATE, m_nCurrentFrame); + break; + case APE_DECOMPRESS_AVERAGE_BITRATE: + { + if (m_bIsRanged) + { + // figure the frame range + const int nBlocksPerFrame = GetInfo(APE_INFO_BLOCKS_PER_FRAME); + int nStartFrame = m_nStartBlock / nBlocksPerFrame; + int nFinishFrame = (m_nFinishBlock + nBlocksPerFrame - 1) / nBlocksPerFrame; + + // get the number of bytes in the first and last frame + int nTotalBytes = (GetInfo(APE_INFO_FRAME_BYTES, nStartFrame) * (m_nStartBlock % nBlocksPerFrame)) / nBlocksPerFrame; + if (nFinishFrame != nStartFrame) + nTotalBytes += (GetInfo(APE_INFO_FRAME_BYTES, nFinishFrame) * (m_nFinishBlock % nBlocksPerFrame)) / nBlocksPerFrame; + + // get the number of bytes in between + const int nTotalFrames = GetInfo(APE_INFO_TOTAL_FRAMES); + for (int nFrame = nStartFrame + 1; (nFrame < nFinishFrame) && (nFrame < nTotalFrames); nFrame++) + nTotalBytes += GetInfo(APE_INFO_FRAME_BYTES, nFrame); + + // figure the bitrate + int nTotalMS = int((double(m_nFinishBlock - m_nStartBlock) * double(1000)) / double(GetInfo(APE_INFO_SAMPLE_RATE))); + if (nTotalMS != 0) + nRetVal = (nTotalBytes * 8) / nTotalMS; + } + else + { + nRetVal = GetInfo(APE_INFO_AVERAGE_BITRATE); + } + + break; + } + default: + bHandled = FALSE; + } + + if (!bHandled && m_bIsRanged) + { + bHandled = TRUE; + + switch (Field) + { + case APE_INFO_WAV_HEADER_BYTES: + nRetVal = sizeof(WAVE_HEADER); + break; + case APE_INFO_WAV_HEADER_DATA: + { + char * pBuffer = (char *) nParam1; + int nMaxBytes = nParam2; + + if (sizeof(WAVE_HEADER) > nMaxBytes) + { + nRetVal = -1; + } + else + { + WAVEFORMATEX wfeFormat; GetInfo(APE_INFO_WAVEFORMATEX, (int) &wfeFormat, 0); + WAVE_HEADER WAVHeader; FillWaveHeader(&WAVHeader, + (m_nFinishBlock - m_nStartBlock) * GetInfo(APE_INFO_BLOCK_ALIGN), + &wfeFormat, 0); + WAVHeader.nRIFFBytes = swap_endian32(WAVHeader.nRIFFBytes); + WAVHeader.nFormatBytes = swap_endian32(WAVHeader.nFormatBytes); + WAVHeader.nFormatTag = swap_endian16(WAVHeader.nFormatTag); + WAVHeader.nChannels = swap_endian16(WAVHeader.nChannels); + WAVHeader.nSamplesPerSec = swap_endian32(WAVHeader.nSamplesPerSec); + WAVHeader.nAvgBytesPerSec = swap_endian32(WAVHeader.nAvgBytesPerSec); + WAVHeader.nBlockAlign = swap_endian16(WAVHeader.nBlockAlign); + WAVHeader.nBitsPerSample = swap_endian16(WAVHeader.nBitsPerSample); + WAVHeader.nDataBytes = swap_endian32(WAVHeader.nDataBytes); + memcpy(pBuffer, &WAVHeader, sizeof(WAVE_HEADER)); + nRetVal = 0; + } + break; + } + case APE_INFO_WAV_TERMINATING_BYTES: + nRetVal = 0; + break; + case APE_INFO_WAV_TERMINATING_DATA: + nRetVal = 0; + break; + default: + bHandled = FALSE; + } + } + + if (bHandled == FALSE) + nRetVal = m_spAPEInfo->GetInfo(Field, nParam1, nParam2); + + return nRetVal; +} diff --git a/Libraries/MAC/Files/Source/MACLib/APEDecompress.h b/Libraries/MAC/Files/Source/MACLib/APEDecompress.h new file mode 100755 index 000000000..1a7f7344b --- /dev/null +++ b/Libraries/MAC/Files/Source/MACLib/APEDecompress.h @@ -0,0 +1,72 @@ +#ifndef APE_APEDECOMPRESS_H +#define APE_APEDECOMPRESS_H + +#include "APEDecompress.h" + +class CUnBitArray; +class CPrepare; +class CAPEInfo; +class IPredictorDecompress; +#include "UnBitArrayBase.h" +#include "MACLib.h" +#include "Prepare.h" +#include "CircleBuffer.h" + +class CAPEDecompress : public IAPEDecompress +{ +public: + + CAPEDecompress(int * pErrorCode, CAPEInfo * pAPEInfo, int nStartBlock = -1, int nFinishBlock = -1); + ~CAPEDecompress(); + + int GetData(char * pBuffer, int nBlocks, int * pBlocksRetrieved); + int Seek(int nBlockOffset); + + int GetInfo(APE_DECOMPRESS_FIELDS Field, int nParam1 = 0, int nParam2 = 0); + +protected: + + // file info + int m_nBlockAlign; + int m_nCurrentFrame; + + // start / finish information + int m_nStartBlock; + int m_nFinishBlock; + int m_nCurrentBlock; + BOOL m_bIsRanged; + BOOL m_bDecompressorInitialized; + + // decoding tools + CPrepare m_Prepare; + WAVEFORMATEX m_wfeInput; + unsigned int m_nCRC; + unsigned int m_nStoredCRC; + int m_nSpecialCodes; + + int SeekToFrame(int nFrameIndex); + void DecodeBlocksToFrameBuffer(int nBlocks); + int FillFrameBuffer(); + void StartFrame(); + void EndFrame(); + int InitializeDecompressor(); + + // more decoding components + CSmartPtr m_spAPEInfo; + CSmartPtr m_spUnBitArray; + UNBIT_ARRAY_STATE m_BitArrayStateX; + UNBIT_ARRAY_STATE m_BitArrayStateY; + + CSmartPtr m_spNewPredictorX; + CSmartPtr m_spNewPredictorY; + + int m_nLastX; + + // decoding buffer + BOOL m_bErrorDecodingCurrentFrame; + int m_nCurrentFrameBufferBlock; + int m_nFrameBufferFinishedBlocks; + CCircleBuffer m_cbFrameBuffer; +}; + +#endif // #ifndef APE_APEDECOMPRESS_H diff --git a/Libraries/MAC/Files/Source/MACLib/APEHeader.cpp b/Libraries/MAC/Files/Source/MACLib/APEHeader.cpp new file mode 100755 index 000000000..a62877c5c --- /dev/null +++ b/Libraries/MAC/Files/Source/MACLib/APEHeader.cpp @@ -0,0 +1,324 @@ +#include "All.h" +#include "APEHeader.h" +#include "MACLib.h" +#include "APEInfo.h" + +// TODO: should push and pop the file position + +CAPEHeader::CAPEHeader(CIO * pIO) +{ + m_pIO = pIO; +} + +CAPEHeader::~CAPEHeader() +{ + +} + +int CAPEHeader::FindDescriptor(BOOL bSeek) +{ + // store the original location and seek to the beginning + int nOriginalFileLocation = m_pIO->GetPosition(); + m_pIO->Seek(0, FILE_BEGIN); + + // set the default junk bytes to 0 + int nJunkBytes = 0; + + // skip an ID3v2 tag (which we really don't support anyway...) + unsigned int nBytesRead = 0; + unsigned char cID3v2Header[10]; + m_pIO->Read((unsigned char *) cID3v2Header, 10, &nBytesRead); + if (cID3v2Header[0] == 'I' && cID3v2Header[1] == 'D' && cID3v2Header[2] == '3') + { + // why is it so hard to figure the lenght of an ID3v2 tag ?!? + unsigned int nLength = *((unsigned int *) &cID3v2Header[6]); + + unsigned int nSyncSafeLength = 0; + nSyncSafeLength = (cID3v2Header[6] & 127) << 21; + nSyncSafeLength += (cID3v2Header[7] & 127) << 14; + nSyncSafeLength += (cID3v2Header[8] & 127) << 7; + nSyncSafeLength += (cID3v2Header[9] & 127); + + BOOL bHasTagFooter = FALSE; + + if (cID3v2Header[5] & 16) + { + bHasTagFooter = TRUE; + nJunkBytes = nSyncSafeLength + 20; + } + else + { + nJunkBytes = nSyncSafeLength + 10; + } + + // error check + if (cID3v2Header[5] & 64) + { + // this ID3v2 length calculator algorithm can't cope with extended headers + // we should be ok though, because the scan for the MAC header below should + // really do the trick + } + + m_pIO->Seek(nJunkBytes, FILE_BEGIN); + + // scan for padding (slow and stupid, but who cares here...) + if (!bHasTagFooter) + { + char cTemp = 0; + m_pIO->Read((unsigned char *) &cTemp, 1, &nBytesRead); + while (cTemp == 0 && nBytesRead == 1) + { + nJunkBytes++; + m_pIO->Read((unsigned char *) &cTemp, 1, &nBytesRead); + } + } + } + m_pIO->Seek(nJunkBytes, FILE_BEGIN); + + // scan until we hit the APE_DESCRIPTOR, the end of the file, or 1 MB later + //unsigned int nGoalID = (' ' << 24) | ('C' << 16) | ('A' << 8) | ('M'); + unsigned int nGoalID = ('M' << 24) | ('A' << 16) | ('C' << 8) | (' '); + unsigned int nReadID = 0; + int nRetVal = m_pIO->Read(&nReadID, 4, &nBytesRead); + if (nRetVal != 0 || nBytesRead != 4) return ERROR_UNDEFINED; + + nBytesRead = 1; + int nScanBytes = 0; + while ((nGoalID != nReadID) && (nBytesRead == 1) && (nScanBytes < (1024 * 1024))) + { + unsigned char cTemp; + m_pIO->Read(&cTemp, 1, &nBytesRead); + nReadID = (((unsigned int) cTemp) << 24) | (nReadID >> 8); + nJunkBytes++; + nScanBytes++; + } + + if (nGoalID != nReadID) + nJunkBytes = -1; + + // seek to the proper place (depending on result and settings) + if (bSeek && (nJunkBytes != -1)) + { + // successfully found the start of the file (seek to it and return) + m_pIO->Seek(nJunkBytes, FILE_BEGIN); + } + else + { + // restore the original file pointer + m_pIO->Seek(nOriginalFileLocation, FILE_BEGIN); + } + + return nJunkBytes; +} + +int CAPEHeader::Analyze(APE_FILE_INFO * pInfo) +{ + // error check + if ((m_pIO == NULL) || (pInfo == NULL)) + return ERROR_BAD_PARAMETER; + // variables + unsigned int nBytesRead = 0; + + // find the descriptor + pInfo->nJunkHeaderBytes = FindDescriptor(TRUE); + if (pInfo->nJunkHeaderBytes < 0) + return ERROR_UNDEFINED; + + // read the first 8 bytes of the descriptor (ID and version) + APE_COMMON_HEADER CommonHeader; memset(&CommonHeader, 0, sizeof(APE_COMMON_HEADER)); + m_pIO->Read(&CommonHeader, sizeof(APE_COMMON_HEADER), &nBytesRead); + CommonHeader.nVersion = swap_endian16(CommonHeader.nVersion); + + // make sure we're at the ID + if (CommonHeader.cID[0] != 'M' || CommonHeader.cID[1] != 'A' || CommonHeader.cID[2] != 'C' || CommonHeader.cID[3] != ' ') + return ERROR_UNDEFINED; + + int nRetVal = ERROR_UNDEFINED; + + if (CommonHeader.nVersion >= 3980) + { + // current header format + nRetVal = AnalyzeCurrent(pInfo); + } + else + { + // legacy support + nRetVal = AnalyzeOld(pInfo); + } + + return nRetVal; +} + +int CAPEHeader::AnalyzeCurrent(APE_FILE_INFO * pInfo) +{ + int i; + // variable declares + unsigned int nBytesRead = 0; + pInfo->spAPEDescriptor.Assign(new APE_DESCRIPTOR); memset(pInfo->spAPEDescriptor, 0, sizeof(APE_DESCRIPTOR)); + APE_HEADER APEHeader; memset(&APEHeader, 0, sizeof(APEHeader)); + + // read the descriptor + m_pIO->Seek(pInfo->nJunkHeaderBytes, FILE_BEGIN); + m_pIO->Read(pInfo->spAPEDescriptor, sizeof(APE_DESCRIPTOR), &nBytesRead); + pInfo->spAPEDescriptor->nVersion = swap_endian32(pInfo->spAPEDescriptor->nVersion); + pInfo->spAPEDescriptor->nDescriptorBytes = swap_endian32(pInfo->spAPEDescriptor->nDescriptorBytes); + pInfo->spAPEDescriptor->nHeaderBytes = swap_endian32(pInfo->spAPEDescriptor->nHeaderBytes); + pInfo->spAPEDescriptor->nSeekTableBytes = swap_endian32(pInfo->spAPEDescriptor->nSeekTableBytes); + pInfo->spAPEDescriptor->nHeaderDataBytes = swap_endian32(pInfo->spAPEDescriptor->nHeaderDataBytes); + pInfo->spAPEDescriptor->nAPEFrameDataBytes = swap_endian32(pInfo->spAPEDescriptor->nAPEFrameDataBytes); + pInfo->spAPEDescriptor->nAPEFrameDataBytesHigh = swap_endian32(pInfo->spAPEDescriptor->nAPEFrameDataBytesHigh); + pInfo->spAPEDescriptor->nTerminatingDataBytes = swap_endian32(pInfo->spAPEDescriptor->nTerminatingDataBytes); + + if ((pInfo->spAPEDescriptor->nDescriptorBytes - nBytesRead) > 0) + m_pIO->Seek(pInfo->spAPEDescriptor->nDescriptorBytes - nBytesRead, FILE_CURRENT); + + // read the header + m_pIO->Read(&APEHeader, sizeof(APEHeader), &nBytesRead); + APEHeader.nCompressionLevel = swap_endian16(APEHeader.nCompressionLevel); + APEHeader.nFormatFlags = swap_endian16(APEHeader.nFormatFlags); + APEHeader.nBlocksPerFrame = swap_endian32(APEHeader.nBlocksPerFrame); + APEHeader.nFinalFrameBlocks = swap_endian32(APEHeader.nFinalFrameBlocks); + APEHeader.nTotalFrames = swap_endian32(APEHeader.nTotalFrames); + APEHeader.nBitsPerSample = swap_endian16(APEHeader.nBitsPerSample); + APEHeader.nChannels = swap_endian16(APEHeader.nChannels); + APEHeader.nSampleRate = swap_endian32(APEHeader.nSampleRate); + + //printf("%d,%d,%d,%d,%d,%d,%d,%d\n",APEHeader.nCompressionLevel,APEHeader.nFormatFlags,APEHeader.nBlocksPerFrame,APEHeader.nFinalFrameBlocks,APEHeader.nTotalFrames,APEHeader.nBitsPerSample,APEHeader.nChannels,APEHeader.nSampleRate); + + if ((pInfo->spAPEDescriptor->nHeaderBytes - nBytesRead) > 0) + m_pIO->Seek(pInfo->spAPEDescriptor->nHeaderBytes - nBytesRead, FILE_CURRENT); + + // fill the APE info structure + pInfo->nVersion = int(pInfo->spAPEDescriptor->nVersion); + pInfo->nCompressionLevel = int(APEHeader.nCompressionLevel); + pInfo->nFormatFlags = int(APEHeader.nFormatFlags); + pInfo->nTotalFrames = int(APEHeader.nTotalFrames); + pInfo->nFinalFrameBlocks = int(APEHeader.nFinalFrameBlocks); + pInfo->nBlocksPerFrame = int(APEHeader.nBlocksPerFrame); + pInfo->nChannels = int(APEHeader.nChannels); + pInfo->nSampleRate = int(APEHeader.nSampleRate); + pInfo->nBitsPerSample = int(APEHeader.nBitsPerSample); + pInfo->nBytesPerSample = pInfo->nBitsPerSample / 8; + pInfo->nBlockAlign = pInfo->nBytesPerSample * pInfo->nChannels; + pInfo->nTotalBlocks = (APEHeader.nTotalFrames == 0) ? 0 : ((APEHeader.nTotalFrames - 1) * pInfo->nBlocksPerFrame) + APEHeader.nFinalFrameBlocks; + pInfo->nWAVHeaderBytes = (APEHeader.nFormatFlags & MAC_FORMAT_FLAG_CREATE_WAV_HEADER) ? sizeof(WAVE_HEADER) : pInfo->spAPEDescriptor->nHeaderDataBytes; + pInfo->nWAVTerminatingBytes = pInfo->spAPEDescriptor->nTerminatingDataBytes; + pInfo->nWAVDataBytes = pInfo->nTotalBlocks * pInfo->nBlockAlign; + pInfo->nWAVTotalBytes = pInfo->nWAVDataBytes + pInfo->nWAVHeaderBytes + pInfo->nWAVTerminatingBytes; + pInfo->nAPETotalBytes = m_pIO->GetSize(); + pInfo->nLengthMS = int((double(pInfo->nTotalBlocks) * double(1000)) / double(pInfo->nSampleRate)); + pInfo->nAverageBitrate = (pInfo->nLengthMS <= 0) ? 0 : int((double(pInfo->nAPETotalBytes) * double(8)) / double(pInfo->nLengthMS)); + pInfo->nDecompressedBitrate = (pInfo->nBlockAlign * pInfo->nSampleRate * 8) / 1000; + pInfo->nSeekTableElements = pInfo->spAPEDescriptor->nSeekTableBytes / 4; + + // get the seek tables (really no reason to get the whole thing if there's extra) + pInfo->spSeekByteTable.Assign(new uint32 [pInfo->nSeekTableElements], TRUE); + if (pInfo->spSeekByteTable == NULL) { return ERROR_UNDEFINED; } + + unsigned int *ptr = pInfo->spSeekByteTable.GetPtr(); + //m_pIO->Read((unsigned char *) pInfo->spSeekByteTable.GetPtr(), 4 * pInfo->nSeekTableElements, &nBytesRead); + m_pIO->Read((unsigned char *) ptr, 4 * pInfo->nSeekTableElements, &nBytesRead); + for(i=0;i<(pInfo->nSeekTableElements);i++) { + ptr[i] = swap_endian32(ptr[i]); + } + + // get the wave header + if (!(APEHeader.nFormatFlags & MAC_FORMAT_FLAG_CREATE_WAV_HEADER)) + { + pInfo->spWaveHeaderData.Assign(new unsigned char [pInfo->nWAVHeaderBytes], TRUE); + if (pInfo->spWaveHeaderData == NULL) { return ERROR_UNDEFINED; } + m_pIO->Read((unsigned char *) pInfo->spWaveHeaderData, pInfo->nWAVHeaderBytes, &nBytesRead); + } + + return ERROR_SUCCESS; +} + +int CAPEHeader::AnalyzeOld(APE_FILE_INFO * pInfo) +{ + // variable declares + unsigned int nBytesRead = 0; + int i; + + // read the MAC header from the file + APE_HEADER_OLD APEHeader; + m_pIO->Seek(pInfo->nJunkHeaderBytes, FILE_BEGIN); + m_pIO->Read((unsigned char *) &APEHeader, sizeof(APEHeader), &nBytesRead); + APEHeader.nVersion = swap_endian16(APEHeader.nVersion); + APEHeader.nCompressionLevel = swap_endian16(APEHeader.nCompressionLevel); + APEHeader.nFormatFlags = swap_endian16(APEHeader.nFormatFlags); + APEHeader.nChannels = swap_endian16(APEHeader.nChannels); + APEHeader.nSampleRate = swap_endian32(APEHeader.nSampleRate); + APEHeader.nHeaderBytes = swap_endian32(APEHeader.nHeaderBytes); + APEHeader.nTerminatingBytes = swap_endian32(APEHeader.nTerminatingBytes); + APEHeader.nTotalFrames = swap_endian32(APEHeader.nTotalFrames); + APEHeader.nFinalFrameBlocks = swap_endian32(APEHeader.nFinalFrameBlocks); + + // fail on 0 length APE files (catches non-finalized APE files) + if (APEHeader.nTotalFrames == 0) + return ERROR_UNDEFINED; + + int nPeakLevel = -1; + if (APEHeader.nFormatFlags & MAC_FORMAT_FLAG_HAS_PEAK_LEVEL) { + m_pIO->Read((unsigned char *) &nPeakLevel, 4, &nBytesRead); + nPeakLevel = swap_endian32(nPeakLevel); + } + + if (APEHeader.nFormatFlags & MAC_FORMAT_FLAG_HAS_SEEK_ELEMENTS) { + m_pIO->Read((unsigned char *) &pInfo->nSeekTableElements, 4, &nBytesRead); + pInfo->nSeekTableElements = swap_endian32(pInfo->nSeekTableElements); + } + else + pInfo->nSeekTableElements = APEHeader.nTotalFrames; + + // fill the APE info structure + pInfo->nVersion = int(APEHeader.nVersion); + pInfo->nCompressionLevel = int(APEHeader.nCompressionLevel); + pInfo->nFormatFlags = int(APEHeader.nFormatFlags); + pInfo->nTotalFrames = int(APEHeader.nTotalFrames); + pInfo->nFinalFrameBlocks = int(APEHeader.nFinalFrameBlocks); + pInfo->nBlocksPerFrame = ((APEHeader.nVersion >= 3900) || ((APEHeader.nVersion >= 3800) && (APEHeader.nCompressionLevel == COMPRESSION_LEVEL_EXTRA_HIGH))) ? 73728 : 9216; + if ((APEHeader.nVersion >= 3950)) pInfo->nBlocksPerFrame = 73728 * 4; + pInfo->nChannels = int(APEHeader.nChannels); + pInfo->nSampleRate = int(APEHeader.nSampleRate); + pInfo->nBitsPerSample = (pInfo->nFormatFlags & MAC_FORMAT_FLAG_8_BIT) ? 8 : ((pInfo->nFormatFlags & MAC_FORMAT_FLAG_24_BIT) ? 24 : 16); + pInfo->nBytesPerSample = pInfo->nBitsPerSample / 8; + pInfo->nBlockAlign = pInfo->nBytesPerSample * pInfo->nChannels; + pInfo->nTotalBlocks = (APEHeader.nTotalFrames == 0) ? 0 : ((APEHeader.nTotalFrames - 1) * pInfo->nBlocksPerFrame) + APEHeader.nFinalFrameBlocks; + pInfo->nWAVHeaderBytes = (APEHeader.nFormatFlags & MAC_FORMAT_FLAG_CREATE_WAV_HEADER) ? sizeof(WAVE_HEADER) : APEHeader.nHeaderBytes; + pInfo->nWAVTerminatingBytes = int(APEHeader.nTerminatingBytes); + pInfo->nWAVDataBytes = pInfo->nTotalBlocks * pInfo->nBlockAlign; + pInfo->nWAVTotalBytes = pInfo->nWAVDataBytes + pInfo->nWAVHeaderBytes + pInfo->nWAVTerminatingBytes; + pInfo->nAPETotalBytes = m_pIO->GetSize(); + pInfo->nLengthMS = int((double(pInfo->nTotalBlocks) * double(1000)) / double(pInfo->nSampleRate)); + pInfo->nAverageBitrate = (pInfo->nLengthMS <= 0) ? 0 : int((double(pInfo->nAPETotalBytes) * double(8)) / double(pInfo->nLengthMS)); + pInfo->nDecompressedBitrate = (pInfo->nBlockAlign * pInfo->nSampleRate * 8) / 1000; + + // get the wave header + if (!(APEHeader.nFormatFlags & MAC_FORMAT_FLAG_CREATE_WAV_HEADER)) + { + pInfo->spWaveHeaderData.Assign(new unsigned char [APEHeader.nHeaderBytes], TRUE); + if (pInfo->spWaveHeaderData == NULL) { return ERROR_UNDEFINED; } + m_pIO->Read((unsigned char *) pInfo->spWaveHeaderData, APEHeader.nHeaderBytes, &nBytesRead); + } + + // get the seek tables (really no reason to get the whole thing if there's extra) + pInfo->spSeekByteTable.Assign(new uint32 [pInfo->nSeekTableElements], TRUE); + if (pInfo->spSeekByteTable == NULL) { return ERROR_UNDEFINED; } + + unsigned int *ptr = pInfo->spSeekByteTable.GetPtr(); + //m_pIO->Read((unsigned char *) pInfo->spSeekByteTable.GetPtr(), 4 * pInfo->nSeekTableElements, &nBytesRead); + m_pIO->Read((unsigned char *) ptr, 4 * pInfo->nSeekTableElements, &nBytesRead); + for(i=0;i<(pInfo->nSeekTableElements);i++) { + ptr[i] = swap_endian32(ptr[i]); + } + + if (APEHeader.nVersion <= 3800) + { + pInfo->spSeekBitTable.Assign(new unsigned char [pInfo->nSeekTableElements], TRUE); + if (pInfo->spSeekBitTable == NULL) { return ERROR_UNDEFINED; } + + m_pIO->Read((unsigned char *) pInfo->spSeekBitTable, pInfo->nSeekTableElements, &nBytesRead); + } + + return ERROR_SUCCESS; +} \ No newline at end of file diff --git a/Libraries/MAC/Files/Source/MACLib/APEHeader.h b/Libraries/MAC/Files/Source/MACLib/APEHeader.h new file mode 100755 index 000000000..cc84d3e01 --- /dev/null +++ b/Libraries/MAC/Files/Source/MACLib/APEHeader.h @@ -0,0 +1,57 @@ +#ifndef APE_HEADER_H +#define APE_HEADER_H + +/***************************************************************************************** +APE header that all APE files have in common (old and new) +*****************************************************************************************/ +struct APE_COMMON_HEADER +{ + char cID[4]; // should equal 'MAC ' + uint16 nVersion; // version number * 1000 (3.81 = 3810) +}; + +/***************************************************************************************** +APE header structure for old APE files (3.97 and earlier) +*****************************************************************************************/ +struct APE_HEADER_OLD +{ + char cID[4]; // should equal 'MAC ' + uint16 nVersion; // version number * 1000 (3.81 = 3810) + uint16 nCompressionLevel; // the compression level + uint16 nFormatFlags; // any format flags (for future use) + uint16 nChannels; // the number of channels (1 or 2) + uint32 nSampleRate; // the sample rate (typically 44100) + uint32 nHeaderBytes; // the bytes after the MAC header that compose the WAV header + uint32 nTerminatingBytes; // the bytes after that raw data (for extended info) + uint32 nTotalFrames; // the number of frames in the file + uint32 nFinalFrameBlocks; // the number of samples in the final frame +}; + +struct APE_FILE_INFO; +class CIO; + +/***************************************************************************************** +CAPEHeader - makes managing APE headers a little smoother (and the format change as of 3.98) +*****************************************************************************************/ +class CAPEHeader +{ + +public: + + CAPEHeader(CIO * pIO); + ~CAPEHeader(); + + int Analyze(APE_FILE_INFO * pInfo); + +protected: + + int AnalyzeCurrent(APE_FILE_INFO * pInfo); + int AnalyzeOld(APE_FILE_INFO * pInfo); + + int FindDescriptor(BOOL bSeek); + + CIO * m_pIO; +}; + +#endif // #ifndef APE_HEADER_H + diff --git a/Libraries/MAC/Files/Source/MACLib/APEInfo.cpp b/Libraries/MAC/Files/Source/MACLib/APEInfo.cpp new file mode 100755 index 000000000..b8e90611a --- /dev/null +++ b/Libraries/MAC/Files/Source/MACLib/APEInfo.cpp @@ -0,0 +1,369 @@ +/***************************************************************************************** +CAPEInfo: + -a class to make working with APE files and getting information about them simple +*****************************************************************************************/ +#include "All.h" +#include "APEInfo.h" +#include IO_HEADER_FILE +#include "APECompress.h" +#include "APEHeader.h" +#include "CharacterHelper.h" + +/***************************************************************************************** +Construction +*****************************************************************************************/ +CAPEInfo::CAPEInfo(int * pErrorCode, const char * pFilename, CAPETag * pTag) +{ + *pErrorCode = ERROR_SUCCESS; + CloseFile(); + // open the file + m_spIO.Assign(new IO_CLASS_NAME); + + if (m_spIO->Open(pFilename) != 0) + { + CloseFile(); + *pErrorCode = ERROR_INVALID_INPUT_FILE; + return; + } + // get the file information + if (GetFileInformation(TRUE) != 0) + { + CloseFile(); + *pErrorCode = ERROR_INVALID_INPUT_FILE; + return; + } + + // get the tag (do this second so that we don't do it on failure) + if (pTag == NULL) + { + // we don't want to analyze right away for non-local files + // since a single I/O object is shared, we can't tag and read at the same time (i.e. in multiple threads) + BOOL bAnalyzeNow = TRUE; + if ((strncasecmp(pFilename, "http://", 7) == 0) || (strncasecmp(pFilename, "m01p://", 7) == 0)) + bAnalyzeNow = FALSE; + + m_spAPETag.Assign(new CAPETag(m_spIO, bAnalyzeNow)); + } + else + { + m_spAPETag.Assign(pTag); + } + +} + +CAPEInfo::CAPEInfo(int * pErrorCode, CIO * pIO, CAPETag * pTag) +{ + *pErrorCode = ERROR_SUCCESS; + CloseFile(); + + m_spIO.Assign(pIO, FALSE, FALSE); + + // get the file information + if (GetFileInformation(TRUE) != 0) + { + CloseFile(); + *pErrorCode = ERROR_INVALID_INPUT_FILE; + return; + } + + // get the tag (do this second so that we don't do it on failure) + if (pTag == NULL) + m_spAPETag.Assign(new CAPETag(m_spIO, TRUE)); + else + m_spAPETag.Assign(pTag); +} + + +/***************************************************************************************** +Destruction +*****************************************************************************************/ +CAPEInfo::~CAPEInfo() +{ + CloseFile(); +} + +/***************************************************************************************** +Close the file +*****************************************************************************************/ +int CAPEInfo::CloseFile() +{ + m_spIO.Delete(); + m_APEFileInfo.spWaveHeaderData.Delete(); + m_APEFileInfo.spSeekBitTable.Delete(); + m_APEFileInfo.spSeekByteTable.Delete(); + m_APEFileInfo.spAPEDescriptor.Delete(); + + m_spAPETag.Delete(); + + // re-initialize variables + m_APEFileInfo.nSeekTableElements = 0; + m_bHasFileInformationLoaded = FALSE; + + return ERROR_SUCCESS; +} + +/***************************************************************************************** +Get the file information about the file +*****************************************************************************************/ +int CAPEInfo::GetFileInformation(BOOL bGetTagInformation) +{ + // quit if there is no simple file + if (m_spIO == NULL) { return -1; } + + // quit if the file information has already been loaded + if (m_bHasFileInformationLoaded) { return ERROR_SUCCESS; } + + // use a CAPEHeader class to help us analyze the file + CAPEHeader APEHeader(m_spIO); + int nRetVal = APEHeader.Analyze(&m_APEFileInfo); + + // update our internal state + if (nRetVal == ERROR_SUCCESS){ + m_bHasFileInformationLoaded = TRUE; + } + // return + return nRetVal; +} + +/***************************************************************************************** +Primary query function +*****************************************************************************************/ +int CAPEInfo::GetInfo(APE_DECOMPRESS_FIELDS Field, int nParam1, int nParam2) +{ + int nRetVal = -1; + + switch (Field) + { + case APE_INFO_FILE_VERSION: + nRetVal = m_APEFileInfo.nVersion; + break; + case APE_INFO_COMPRESSION_LEVEL: + nRetVal = m_APEFileInfo.nCompressionLevel; + break; + case APE_INFO_FORMAT_FLAGS: + nRetVal = m_APEFileInfo.nFormatFlags; + break; + case APE_INFO_SAMPLE_RATE: + nRetVal = m_APEFileInfo.nSampleRate; + break; + case APE_INFO_BITS_PER_SAMPLE: + nRetVal = m_APEFileInfo.nBitsPerSample; + break; + case APE_INFO_BYTES_PER_SAMPLE: + nRetVal = m_APEFileInfo.nBytesPerSample; + break; + case APE_INFO_CHANNELS: + nRetVal = m_APEFileInfo.nChannels; + break; + case APE_INFO_BLOCK_ALIGN: + nRetVal = m_APEFileInfo.nBlockAlign; + break; + case APE_INFO_BLOCKS_PER_FRAME: + nRetVal = m_APEFileInfo.nBlocksPerFrame; + break; + case APE_INFO_FINAL_FRAME_BLOCKS: + nRetVal = m_APEFileInfo.nFinalFrameBlocks; + break; + case APE_INFO_TOTAL_FRAMES: + nRetVal = m_APEFileInfo.nTotalFrames; + break; + case APE_INFO_WAV_HEADER_BYTES: + nRetVal = m_APEFileInfo.nWAVHeaderBytes; + break; + case APE_INFO_WAV_TERMINATING_BYTES: + nRetVal = m_APEFileInfo.nWAVTerminatingBytes; + break; + case APE_INFO_WAV_DATA_BYTES: + nRetVal = m_APEFileInfo.nWAVDataBytes; + break; + case APE_INFO_WAV_TOTAL_BYTES: + nRetVal = m_APEFileInfo.nWAVTotalBytes; + break; + case APE_INFO_APE_TOTAL_BYTES: + nRetVal = m_APEFileInfo.nAPETotalBytes; + break; + case APE_INFO_TOTAL_BLOCKS: + nRetVal = m_APEFileInfo.nTotalBlocks; + break; + case APE_INFO_LENGTH_MS: + nRetVal = m_APEFileInfo.nLengthMS; + break; + case APE_INFO_AVERAGE_BITRATE: + nRetVal = m_APEFileInfo.nAverageBitrate; + break; + case APE_INFO_FRAME_BITRATE: + { + int nFrame = nParam1; + + nRetVal = 0; + + int nFrameBytes = GetInfo(APE_INFO_FRAME_BYTES, nFrame); + int nFrameBlocks = GetInfo(APE_INFO_FRAME_BLOCKS, nFrame); + if ((nFrameBytes > 0) && (nFrameBlocks > 0) && m_APEFileInfo.nSampleRate > 0) + { + int nFrameMS = (nFrameBlocks * 1000) / m_APEFileInfo.nSampleRate; + if (nFrameMS != 0) + { + nRetVal = (nFrameBytes * 8) / nFrameMS; + } + } + break; + } + case APE_INFO_DECOMPRESSED_BITRATE: + nRetVal = m_APEFileInfo.nDecompressedBitrate; + break; + case APE_INFO_PEAK_LEVEL: + nRetVal = -1; // no longer supported + break; + case APE_INFO_SEEK_BIT: + { + int nFrame = nParam1; + if (GET_FRAMES_START_ON_BYTES_BOUNDARIES(this)) + { + nRetVal = 0; + } + else + { + if (nFrame < 0 || nFrame >= m_APEFileInfo.nTotalFrames) + nRetVal = 0; + else + nRetVal = m_APEFileInfo.spSeekBitTable[nFrame]; + } + break; + } + case APE_INFO_SEEK_BYTE: + { + int nFrame = nParam1; + if (nFrame < 0 || nFrame >= m_APEFileInfo.nTotalFrames) + nRetVal = 0; + else + nRetVal = m_APEFileInfo.spSeekByteTable[nFrame] + m_APEFileInfo.nJunkHeaderBytes; + break; + } + case APE_INFO_WAV_HEADER_DATA: + { + char * pBuffer = (char *) nParam1; + int nMaxBytes = nParam2; + + if (m_APEFileInfo.nFormatFlags & MAC_FORMAT_FLAG_CREATE_WAV_HEADER) + { + if (sizeof(WAVE_HEADER) > nMaxBytes) + { + nRetVal = -1; + } + else + { + WAVEFORMATEX wfeFormat; GetInfo(APE_INFO_WAVEFORMATEX, (int) &wfeFormat, 0); + WAVE_HEADER WAVHeader; FillWaveHeader(&WAVHeader, m_APEFileInfo.nWAVDataBytes, &wfeFormat, + m_APEFileInfo.nWAVTerminatingBytes); + WAVHeader.nRIFFBytes = swap_endian32(WAVHeader.nRIFFBytes); + WAVHeader.nFormatBytes = swap_endian32(WAVHeader.nFormatBytes); + WAVHeader.nFormatTag = swap_endian16(WAVHeader.nFormatTag); + WAVHeader.nChannels = swap_endian16(WAVHeader.nChannels); + WAVHeader.nSamplesPerSec = swap_endian32(WAVHeader.nSamplesPerSec); + WAVHeader.nAvgBytesPerSec = swap_endian32(WAVHeader.nAvgBytesPerSec); + WAVHeader.nBlockAlign = swap_endian16(WAVHeader.nBlockAlign); + WAVHeader.nBitsPerSample = swap_endian16(WAVHeader.nBitsPerSample); + WAVHeader.nDataBytes = swap_endian32(WAVHeader.nDataBytes); + memcpy(pBuffer, &WAVHeader, sizeof(WAVE_HEADER)); + nRetVal = 0; + } + } + else + { + if (m_APEFileInfo.nWAVHeaderBytes > nMaxBytes) + { + nRetVal = -1; + } + else + { + memcpy(pBuffer, m_APEFileInfo.spWaveHeaderData, m_APEFileInfo.nWAVHeaderBytes); + nRetVal = 0; + } + } + break; + } + case APE_INFO_WAV_TERMINATING_DATA: + { + char * pBuffer = (char *) nParam1; + int nMaxBytes = nParam2; + + if (m_APEFileInfo.nWAVTerminatingBytes > nMaxBytes) + { + nRetVal = -1; + } + else + { + if (m_APEFileInfo.nWAVTerminatingBytes > 0) + { + // variables + int nOriginalFileLocation = m_spIO->GetPosition(); + unsigned int nBytesRead = 0; + + // check for a tag + m_spIO->Seek(-(m_spAPETag->GetTagBytes() + m_APEFileInfo.nWAVTerminatingBytes), FILE_END); + m_spIO->Read(pBuffer, m_APEFileInfo.nWAVTerminatingBytes, &nBytesRead); + + // restore the file pointer + m_spIO->Seek(nOriginalFileLocation, FILE_BEGIN); + } + nRetVal = 0; + } + break; + } + case APE_INFO_WAVEFORMATEX: + { + WAVEFORMATEX * pWaveFormatEx = (WAVEFORMATEX *) nParam1; + FillWaveFormatEx(pWaveFormatEx, m_APEFileInfo.nSampleRate, m_APEFileInfo.nBitsPerSample, m_APEFileInfo.nChannels); + nRetVal = 0; + break; + } + case APE_INFO_IO_SOURCE: + nRetVal = (int) m_spIO.GetPtr(); + break; + case APE_INFO_FRAME_BYTES: + { + int nFrame = nParam1; + + // bound-check the frame index + if ((nFrame < 0) || (nFrame >= m_APEFileInfo.nTotalFrames)) + { + nRetVal = -1; + } + else + { + if (nFrame != (m_APEFileInfo.nTotalFrames - 1)) + nRetVal = GetInfo(APE_INFO_SEEK_BYTE, nFrame + 1) - GetInfo(APE_INFO_SEEK_BYTE, nFrame); + else + nRetVal = m_spIO->GetSize() - m_spAPETag->GetTagBytes() - m_APEFileInfo.nWAVTerminatingBytes - GetInfo(APE_INFO_SEEK_BYTE, nFrame); + } + break; + } + case APE_INFO_FRAME_BLOCKS: + { + int nFrame = nParam1; + + // bound-check the frame index + if ((nFrame < 0) || (nFrame >= m_APEFileInfo.nTotalFrames)) + { + nRetVal = -1; + } + else + { + if (nFrame != (m_APEFileInfo.nTotalFrames - 1)) + nRetVal = m_APEFileInfo.nBlocksPerFrame; + else + nRetVal = m_APEFileInfo.nFinalFrameBlocks; + } + break; + } + case APE_INFO_TAG: + nRetVal = (int) m_spAPETag.GetPtr(); + break; + case APE_INTERNAL_INFO: + nRetVal = (int) &m_APEFileInfo; + break; + } + + return nRetVal; +} \ No newline at end of file diff --git a/Libraries/MAC/Files/Source/MACLib/APEInfo.h b/Libraries/MAC/Files/Source/MACLib/APEInfo.h new file mode 100755 index 000000000..fd36aadb3 --- /dev/null +++ b/Libraries/MAC/Files/Source/MACLib/APEInfo.h @@ -0,0 +1,100 @@ +/***************************************************************************************** +APEInfo.h +Copyright (C) 2000 by Matthew T. Ashland All Rights Reserved. + +Simple method for working with APE files... it encapsulates reading, writing and getting +file information. Just create a CAPEInfo class, call OpenFile(), and use the class methods +to do whatever you need... the destructor will take care of any cleanup + +Notes: + -Most all functions return 0 upon success, and some error code (other than 0) on + failure. However, all of the file functions that are wrapped from the Win32 API + return 0 on failure and some other number on success. This applies to ReadFile, + WriteFile, SetFilePointer, etc... + +WARNING: + -This class driven system for using Monkey's Audio is still in development, so + I can't make any guarantees that the classes and libraries won't change before + everything gets finalized. Use them at your own risk +*****************************************************************************************/ + +#ifndef APE_APEINFO_H +#define APE_APEINFO_H + +#include "IO.h" +#include "APETag.h" +#include "MACLib.h" + +/***************************************************************************************** +APE_FILE_INFO - structure which describes most aspects of an APE file +(used internally for speed and ease) +*****************************************************************************************/ +struct APE_FILE_INFO +{ + int nVersion; // file version number * 1000 (3.93 = 3930) + int nCompressionLevel; // the compression level + int nFormatFlags; // format flags + int nTotalFrames; // the total number frames (frames are used internally) + int nBlocksPerFrame; // the samples in a frame (frames are used internally) + int nFinalFrameBlocks; // the number of samples in the final frame + int nChannels; // audio channels + int nSampleRate; // audio samples per second + int nBitsPerSample; // audio bits per sample + int nBytesPerSample; // audio bytes per sample + int nBlockAlign; // audio block align (channels * bytes per sample) + int nWAVHeaderBytes; // header bytes of the original WAV + int nWAVDataBytes; // data bytes of the original WAV + int nWAVTerminatingBytes; // terminating bytes of the original WAV + int nWAVTotalBytes; // total bytes of the original WAV + int nAPETotalBytes; // total bytes of the APE file + int nTotalBlocks; // the total number audio blocks + int nLengthMS; // the length in milliseconds + int nAverageBitrate; // the kbps (i.e. 637 kpbs) + int nDecompressedBitrate; // the kbps of the decompressed audio (i.e. 1440 kpbs for CD audio) + int nJunkHeaderBytes; // used for ID3v2, etc. + int nSeekTableElements; // the number of elements in the seek table(s) + + CSmartPtr spSeekByteTable; // the seek table (byte) + CSmartPtr spSeekBitTable; // the seek table (bits -- legacy) + CSmartPtr spWaveHeaderData; // the pre-audio header data + CSmartPtr spAPEDescriptor; // the descriptor (only with newer files) +}; + +/***************************************************************************************** +Helper macros (sort of hacky) +*****************************************************************************************/ +#define GET_USES_CRC(APE_INFO) (((APE_INFO)->GetInfo(APE_INFO_FORMAT_FLAGS) & MAC_FORMAT_FLAG_CRC) ? TRUE : FALSE) +#define GET_FRAMES_START_ON_BYTES_BOUNDARIES(APE_INFO) (((APE_INFO)->GetInfo(APE_INFO_FILE_VERSION) > 3800) ? TRUE : FALSE) +#define GET_USES_SPECIAL_FRAMES(APE_INFO) (((APE_INFO)->GetInfo(APE_INFO_FILE_VERSION) > 3820) ? TRUE : FALSE) +#define GET_IO(APE_INFO) ((CIO *) (APE_INFO)->GetInfo(APE_INFO_IO_SOURCE)) +#define GET_TAG(APE_INFO) ((CAPETag *) (APE_INFO)->GetInfo(APE_INFO_TAG)) + +/***************************************************************************************** +CAPEInfo - use this for all work with APE files +*****************************************************************************************/ +class CAPEInfo +{ +public: + + // construction and destruction + CAPEInfo(int * pErrorCode, const char * pFilename, CAPETag * pTag = NULL); + CAPEInfo(int * pErrorCode, CIO * pIO, CAPETag * pTag = NULL); + virtual ~CAPEInfo(); + + // query for information + int GetInfo(APE_DECOMPRESS_FIELDS Field, int nParam1 = 0, int nParam2 = 0); + +private: + + // internal functions + int GetFileInformation(BOOL bGetTagInformation = TRUE); + int CloseFile(); + + // internal variables + BOOL m_bHasFileInformationLoaded; + CSmartPtr m_spIO; + CSmartPtr m_spAPETag; + APE_FILE_INFO m_APEFileInfo; +}; + +#endif // #ifndef APE_APEINFO_H diff --git a/Libraries/MAC/Files/Source/MACLib/APELink.cpp b/Libraries/MAC/Files/Source/MACLib/APELink.cpp new file mode 100755 index 000000000..d35ff7065 --- /dev/null +++ b/Libraries/MAC/Files/Source/MACLib/APELink.cpp @@ -0,0 +1,121 @@ +#include "All.h" +#include "APELink.h" +#include "CharacterHelper.h" +#include IO_HEADER_FILE + +#define APE_LINK_HEADER "[Monkey's Audio Image Link File]" +#define APE_LINK_IMAGE_FILE_TAG "Image File=" +#define APE_LINK_START_BLOCK_TAG "Start Block=" +#define APE_LINK_FINISH_BLOCK_TAG "Finish Block=" + +CAPELink::CAPELink(const char * pFilename) +{ + // empty + m_bIsLinkFile = FALSE; + m_nStartBlock = 0; + m_nFinishBlock = 0; + m_cImageFilename[0] = 0; + + // open the file + IO_CLASS_NAME ioLinkFile; + if (ioLinkFile.Open(pFilename) == ERROR_SUCCESS) + { + // create a buffer + CSmartPtr spBuffer(new char [1024], TRUE); + + // fill the buffer from the file and null terminate it + unsigned int nBytesRead = 0; + ioLinkFile.Read(spBuffer.GetPtr(), 1023, &nBytesRead); + spBuffer[nBytesRead] = 0; + + // call the other constructor (uses a buffer instead of opening the file) + ParseData(spBuffer, pFilename); + } +} + +CAPELink::CAPELink(const char * pData, const char * pFilename) +{ + ParseData(pData, pFilename); +} + +CAPELink::~CAPELink() +{ +} + +void CAPELink::ParseData(const char * pData, const char * pFilename) +{ + // empty + m_bIsLinkFile = FALSE; + m_nStartBlock = 0; + m_nFinishBlock = 0; + m_cImageFilename[0] = 0; + + if (pData != NULL) + { + // parse out the information + char * pHeader = strstr(pData, APE_LINK_HEADER); + char * pImageFile = strstr(pData, APE_LINK_IMAGE_FILE_TAG); + char * pStartBlock = strstr(pData, APE_LINK_START_BLOCK_TAG); + char * pFinishBlock = strstr(pData, APE_LINK_FINISH_BLOCK_TAG); + + if (pHeader && pImageFile && pStartBlock && pFinishBlock) + { + if ((_strnicmp(pHeader, APE_LINK_HEADER, strlen(APE_LINK_HEADER)) == 0) && + (_strnicmp(pImageFile, APE_LINK_IMAGE_FILE_TAG, strlen(APE_LINK_IMAGE_FILE_TAG)) == 0) && + (_strnicmp(pStartBlock, APE_LINK_START_BLOCK_TAG, strlen(APE_LINK_START_BLOCK_TAG)) == 0) && + (_strnicmp(pFinishBlock, APE_LINK_FINISH_BLOCK_TAG, strlen(APE_LINK_FINISH_BLOCK_TAG)) == 0)) + { + // get the start and finish blocks + m_nStartBlock = atoi(&pStartBlock[strlen(APE_LINK_START_BLOCK_TAG)]); + m_nFinishBlock = atoi(&pFinishBlock[strlen(APE_LINK_FINISH_BLOCK_TAG)]); + + // get the path + char cImageFile[MAX_PATH + 1]; int nIndex = 0; + char * pImageCharacter = &pImageFile[strlen(APE_LINK_IMAGE_FILE_TAG)]; + while ((*pImageCharacter != 0) && (*pImageCharacter != '\r') && (*pImageCharacter != '\n')) + cImageFile[nIndex++] = *pImageCharacter++; + cImageFile[nIndex] = 0; + + //CSmartPtr spImageFileUTF16(GetUTF16FromUTF8((UCHAR *) cImageFile), TRUE); + CSmartPtr spImageFileUTF16(GetUTF16FromUTF8((str_utf8*)cImageFile), TRUE); + + // process the path + if (wcsrchr(spImageFileUTF16, '\\') == NULL) + { + str_utf16 cImagePath[MAX_PATH + 1]; + wcscpy(cImagePath, GetUTF16FromANSI(pFilename)); + wcscpy(wcsrchr(cImagePath, '\\') + 1, spImageFileUTF16); + wcscpy(m_cImageFilename, cImagePath); + } + else + { + wcscpy(m_cImageFilename, spImageFileUTF16); + } + + // this is a valid link file + m_bIsLinkFile = TRUE; + } + } + } +} + +int CAPELink::GetStartBlock() +{ + return m_nStartBlock; +} + +int CAPELink::GetFinishBlock() +{ + return m_nFinishBlock; +} + +const str_utf16 * CAPELink::GetImageFilename() +{ + return m_cImageFilename; +} + +BOOL CAPELink::GetIsLinkFile() +{ + return m_bIsLinkFile; +} + diff --git a/Libraries/MAC/Files/Source/MACLib/APELink.h b/Libraries/MAC/Files/Source/MACLib/APELink.h new file mode 100755 index 000000000..b7a25360a --- /dev/null +++ b/Libraries/MAC/Files/Source/MACLib/APELink.h @@ -0,0 +1,30 @@ +#ifndef APE_APELINK_H +#define APE_APELINK_H + +#include "IO.h" +#include "APEInfo.h" + +class CAPELink +{ +public: + + CAPELink(const char * pFilename); + CAPELink(const char * pData, const char * pFilename); + ~CAPELink(); + + BOOL GetIsLinkFile(); + int GetStartBlock(); + int GetFinishBlock(); + const wchar_t * GetImageFilename(); + +protected: + + BOOL m_bIsLinkFile; + int m_nStartBlock; + int m_nFinishBlock; + str_utf16 m_cImageFilename[MAX_PATH]; + + void ParseData(const char * pData, const char * pFilename); +}; + +#endif // #ifndef APE_APELINK_H diff --git a/Libraries/MAC/Files/Source/MACLib/APESimple.cpp b/Libraries/MAC/Files/Source/MACLib/APESimple.cpp new file mode 100755 index 000000000..4b181e094 --- /dev/null +++ b/Libraries/MAC/Files/Source/MACLib/APESimple.cpp @@ -0,0 +1,427 @@ +#include "All.h" +#include "APEInfo.h" +#include "APECompress.h" +#include "APEDecompress.h" +#include "WAVInputSource.h" +#include IO_HEADER_FILE +#include "MACProgressHelper.h" +#include "GlobalFunctions.h" +#include "MD5.h" +#include "CharacterHelper.h" + +#define UNMAC_DECODER_OUTPUT_NONE 0 +#define UNMAC_DECODER_OUTPUT_WAV 1 +#define UNMAC_DECODER_OUTPUT_APE 2 + +#define BLOCKS_PER_DECODE 9216 + +int DecompressCore(const char * pInputFilename, const char * pOutputFilename, int nOutputMode, int nCompressionLevel, int * pPercentageDone, APE_PROGRESS_CALLBACK ProgressCallback, int * pKillFlag); + +/***************************************************************************************** +ANSI wrappers +*****************************************************************************************/ +/* +int __stdcall CompressFile(const str_ansi * pInputFilename, const str_ansi * pOutputFilename, int nCompressionLevel, int * pPercentageDone, APE_PROGRESS_CALLBACK ProgressCallback, int * pKillFlag) +{ + //CSmartPtr spInputFile(GetUTF16FromANSI(pInputFilename), TRUE); + //CSmartPtr spOutputFile(GetUTF16FromANSI(pOutputFilename), TRUE); + return CompressFileW(pInputFilename, pOutputFilename, nCompressionLevel, pPercentageDone, ProgressCallback, pKillFlag); +} + +int __stdcall DecompressFile(const str_ansi * pInputFilename, const str_ansi * pOutputFilename, int * pPercentageDone, APE_PROGRESS_CALLBACK ProgressCallback, int * pKillFlag) +{ + //CSmartPtr spInputFile(GetUTF16FromANSI(pInputFilename), TRUE); + //CSmartPtr spOutputFile(GetUTF16FromANSI(pOutputFilename), TRUE); + return DecompressFileW(pInputFilename, pOutputFilename, pPercentageDone, ProgressCallback, pKillFlag); +} + +int __stdcall ConvertFile(const str_ansi * pInputFilename, const str_ansi * pOutputFilename, int nCompressionLevel, int * pPercentageDone, APE_PROGRESS_CALLBACK ProgressCallback, int * pKillFlag) +{ + //CSmartPtr spInputFile(GetUTF16FromANSI(pInputFilename), TRUE); + //CSmartPtr spOutputFile(GetUTF16FromANSI(pOutputFilename), TRUE); + return ConvertFileW(pInputFilename, pOutputFilename, nCompressionLevel, pPercentageDone, ProgressCallback, pKillFlag); +} + +int __stdcall VerifyFile(const str_ansi * pInputFilename, int * pPercentageDone, APE_PROGRESS_CALLBACK ProgressCallback, int * pKillFlag, BOOL bQuickVerifyIfPossible) +{ + //CSmartPtr spInputFile(GetUTF16FromANSI(pInputFilename), TRUE); + return VerifyFileW(pInputFilename, pPercentageDone, ProgressCallback, pKillFlag, FALSE); +} +*/ + +/***************************************************************************************** +Compress file +*****************************************************************************************/ +int __stdcall CompressFile(const char * pInputFilename, const char * pOutputFilename, int nCompressionLevel, int * pPercentageDone, APE_PROGRESS_CALLBACK ProgressCallback, int * pKillFlag) +{ + // declare the variables + int nFunctionRetVal = ERROR_SUCCESS; + WAVEFORMATEX WaveFormatEx; + CSmartPtr spMACProgressHelper; + CSmartPtr spBuffer; + CSmartPtr spAPECompress; + + try + { + // create the input source + int nRetVal = ERROR_UNDEFINED; + int nAudioBlocks = 0; int nHeaderBytes = 0; int nTerminatingBytes = 0; + CSmartPtr spInputSource(CreateInputSource(pInputFilename, &WaveFormatEx, &nAudioBlocks, + &nHeaderBytes, &nTerminatingBytes, &nRetVal)); + + if ((spInputSource == NULL) || (nRetVal != ERROR_SUCCESS)) + throw nRetVal; + + // create the compressor + spAPECompress.Assign(CreateIAPECompress()); + if (spAPECompress == NULL) throw ERROR_UNDEFINED; + + // figure the audio bytes + int nAudioBytes = nAudioBlocks * WaveFormatEx.nBlockAlign; + + // start the encoder + if (nHeaderBytes > 0) spBuffer.Assign(new unsigned char [nHeaderBytes], TRUE); + THROW_ON_ERROR(spInputSource->GetHeaderData(spBuffer.GetPtr())) + THROW_ON_ERROR(spAPECompress->Start(pOutputFilename, &WaveFormatEx, nAudioBytes, + nCompressionLevel, spBuffer.GetPtr(), nHeaderBytes)); + + spBuffer.Delete(); + + // set-up the progress + spMACProgressHelper.Assign(new CMACProgressHelper(nAudioBytes, pPercentageDone, ProgressCallback, pKillFlag)); + + // master loop + int nBytesLeft = nAudioBytes; + + while (nBytesLeft > 0) + { + int nBytesAdded = 0; + THROW_ON_ERROR(spAPECompress->AddDataFromInputSource(spInputSource.GetPtr(), nBytesLeft, &nBytesAdded)) + + nBytesLeft -= nBytesAdded; + + // update the progress + spMACProgressHelper->UpdateProgress(nAudioBytes - nBytesLeft); + + // process the kill flag + if (spMACProgressHelper->ProcessKillFlag(TRUE) != ERROR_SUCCESS) + throw(ERROR_USER_STOPPED_PROCESSING); + } + // finalize the file + if (nTerminatingBytes > 0) spBuffer.Assign(new unsigned char [nTerminatingBytes], TRUE); + THROW_ON_ERROR(spInputSource->GetTerminatingData(spBuffer.GetPtr())); + THROW_ON_ERROR(spAPECompress->Finish(spBuffer.GetPtr(), nTerminatingBytes, nTerminatingBytes)) + // update the progress to 100% + spMACProgressHelper->UpdateProgressComplete(); + } + catch(int nErrorCode) + { + nFunctionRetVal = (nErrorCode == 0) ? ERROR_UNDEFINED : nErrorCode; + } + catch(...) + { + nFunctionRetVal = ERROR_UNDEFINED; + } + + // kill the compressor if we failed + if ((nFunctionRetVal != 0) && (spAPECompress != NULL)) + spAPECompress->Kill(); + + // return + return nFunctionRetVal; +} + + +/***************************************************************************************** +Verify file +*****************************************************************************************/ +int __stdcall VerifyFile(const char * pInputFilename, int * pPercentageDone, APE_PROGRESS_CALLBACK ProgressCallback, int * pKillFlag, BOOL bQuickVerifyIfPossible) +{ + // error check the function parameters + if (pInputFilename == NULL) + { + return ERROR_INVALID_FUNCTION_PARAMETER; + } + + + // return value + int nRetVal = ERROR_UNDEFINED; + + // see if we can quick verify + if (bQuickVerifyIfPossible) + { + CSmartPtr spAPEDecompress; + try + { + int nFunctionRetVal = ERROR_SUCCESS; + + spAPEDecompress.Assign(CreateIAPEDecompress(pInputFilename, &nFunctionRetVal)); + if (spAPEDecompress == NULL || nFunctionRetVal != ERROR_SUCCESS) throw(nFunctionRetVal); + + APE_FILE_INFO * pInfo = (APE_FILE_INFO *) spAPEDecompress->GetInfo(APE_INTERNAL_INFO); + if ((pInfo->nVersion < 3980) || (pInfo->spAPEDescriptor == NULL)) + throw(ERROR_UPSUPPORTED_FILE_VERSION); + } + catch(...) + { + bQuickVerifyIfPossible = FALSE; + } + } + + // if we can and should quick verify, then do it + if (bQuickVerifyIfPossible) + { + // variable declares + int nFunctionRetVal = ERROR_SUCCESS; + unsigned int nBytesRead = 0; + CSmartPtr spAPEDecompress; + + // run the quick verify + try + { + spAPEDecompress.Assign(CreateIAPEDecompress(pInputFilename, &nFunctionRetVal)); + if (spAPEDecompress == NULL || nFunctionRetVal != ERROR_SUCCESS) throw(nFunctionRetVal); + + CMD5Helper MD5Helper; + + CIO * pIO = GET_IO(spAPEDecompress); + APE_FILE_INFO * pInfo = (APE_FILE_INFO *) spAPEDecompress->GetInfo(APE_INTERNAL_INFO); + + if ((pInfo->nVersion < 3980) || (pInfo->spAPEDescriptor == NULL)) + throw(ERROR_UPSUPPORTED_FILE_VERSION); + + int nHead = pInfo->nJunkHeaderBytes + pInfo->spAPEDescriptor->nDescriptorBytes; + int nStart = nHead + pInfo->spAPEDescriptor->nHeaderBytes + pInfo->spAPEDescriptor->nSeekTableBytes; + + pIO->Seek(nHead, FILE_BEGIN); + int nHeadBytes = nStart - nHead; + CSmartPtr spHeadBuffer(new unsigned char [nHeadBytes], TRUE); + if ((pIO->Read(spHeadBuffer, nHeadBytes, &nBytesRead) != ERROR_SUCCESS) || (nHeadBytes != int(nBytesRead))) + throw(ERROR_IO_READ); + + int nBytesLeft = pInfo->spAPEDescriptor->nHeaderDataBytes + pInfo->spAPEDescriptor->nAPEFrameDataBytes + pInfo->spAPEDescriptor->nTerminatingDataBytes; + CSmartPtr spBuffer(new unsigned char [16384], TRUE); + nBytesRead = 1; + while ((nBytesLeft > 0) && (nBytesRead > 0)) + { + int nBytesToRead = min(16384, nBytesLeft); + if (pIO->Read(spBuffer, nBytesToRead, &nBytesRead) != ERROR_SUCCESS) + throw(ERROR_IO_READ); + + MD5Helper.AddData(spBuffer, nBytesRead); + nBytesLeft -= nBytesRead; + } + + if (nBytesLeft != 0) + throw(ERROR_IO_READ); + + MD5Helper.AddData(spHeadBuffer, nHeadBytes); + + unsigned char cResult[16]; + MD5Helper.GetResult(cResult); + + if (memcmp(cResult, pInfo->spAPEDescriptor->cFileMD5, 16) != 0) + nFunctionRetVal = ERROR_INVALID_CHECKSUM; + + } + catch(int nErrorCode) + { + nFunctionRetVal = (nErrorCode == 0) ? ERROR_UNDEFINED : nErrorCode; + } + catch(...) + { + nFunctionRetVal = ERROR_UNDEFINED; + } + + // return value + nRetVal = nFunctionRetVal; + } + else + { + nRetVal = DecompressCore(pInputFilename, NULL, UNMAC_DECODER_OUTPUT_NONE, -1, pPercentageDone, ProgressCallback, pKillFlag); + } + + + return nRetVal; +} + +/***************************************************************************************** +Decompress file +*****************************************************************************************/ +int __stdcall DecompressFile(const char * pInputFilename, const char * pOutputFilename, int * pPercentageDone, APE_PROGRESS_CALLBACK ProgressCallback, int * pKillFlag) +{ + if (pOutputFilename == NULL) + return VerifyFile(pInputFilename, pPercentageDone, ProgressCallback, pKillFlag, FALSE); + else + return DecompressCore(pInputFilename, pOutputFilename, UNMAC_DECODER_OUTPUT_WAV, -1, pPercentageDone, ProgressCallback, pKillFlag); +} + +/***************************************************************************************** +Convert file +*****************************************************************************************/ +int __stdcall ConvertFile(const char * pInputFilename, const char * pOutputFilename, int nCompressionLevel, int * pPercentageDone, APE_PROGRESS_CALLBACK ProgressCallback, int * pKillFlag) +{ + return DecompressCore(pInputFilename, pOutputFilename, UNMAC_DECODER_OUTPUT_APE, nCompressionLevel, pPercentageDone, ProgressCallback, pKillFlag); +} + +/***************************************************************************************** +Decompress a file using the specified output method +*****************************************************************************************/ +int DecompressCore(const char * pInputFilename, const char * pOutputFilename, int nOutputMode, int nCompressionLevel, int * pPercentageDone, APE_PROGRESS_CALLBACK ProgressCallback, int * pKillFlag) +{ + // error check the function parameters + if (pInputFilename == NULL) + { + return ERROR_INVALID_FUNCTION_PARAMETER; + } + + // variable declares + int nFunctionRetVal = ERROR_SUCCESS; + CSmartPtr spioOutput; + CSmartPtr spAPECompress; + CSmartPtr spAPEDecompress; + CSmartPtr spTempBuffer; + CSmartPtr spMACProgressHelper; + WAVEFORMATEX wfeInput; + + try + { + // create the decoder + spAPEDecompress.Assign(CreateIAPEDecompress(pInputFilename, &nFunctionRetVal)); + + if (spAPEDecompress == NULL || nFunctionRetVal != ERROR_SUCCESS) throw(nFunctionRetVal); + + // get the input format + THROW_ON_ERROR(spAPEDecompress->GetInfo(APE_INFO_WAVEFORMATEX, (int) &wfeInput)) + + // allocate space for the header + spTempBuffer.Assign(new unsigned char [spAPEDecompress->GetInfo(APE_INFO_WAV_HEADER_BYTES)], TRUE); + if (spTempBuffer == NULL) throw(ERROR_INSUFFICIENT_MEMORY); + + // get the header + THROW_ON_ERROR(spAPEDecompress->GetInfo(APE_INFO_WAV_HEADER_DATA, (int) spTempBuffer.GetPtr(), spAPEDecompress->GetInfo(APE_INFO_WAV_HEADER_BYTES))); + + + // initialize the output + if (nOutputMode == UNMAC_DECODER_OUTPUT_WAV) + { + // create the file + spioOutput.Assign(new IO_CLASS_NAME); THROW_ON_ERROR(spioOutput->Create(pOutputFilename)) + + // output the header + THROW_ON_ERROR(WriteSafe(spioOutput, spTempBuffer, spAPEDecompress->GetInfo(APE_INFO_WAV_HEADER_BYTES))); + } + else if (nOutputMode == UNMAC_DECODER_OUTPUT_APE) + { + // quit if there is nothing to do + if (spAPEDecompress->GetInfo(APE_INFO_FILE_VERSION) == MAC_VERSION_NUMBER && spAPEDecompress->GetInfo(APE_INFO_COMPRESSION_LEVEL) == nCompressionLevel) + throw(ERROR_SKIPPED); + + // create and start the compressor + spAPECompress.Assign(CreateIAPECompress()); + THROW_ON_ERROR(spAPECompress->Start(pOutputFilename, &wfeInput, spAPEDecompress->GetInfo(APE_DECOMPRESS_TOTAL_BLOCKS) * spAPEDecompress->GetInfo(APE_INFO_BLOCK_ALIGN), + nCompressionLevel, spTempBuffer, spAPEDecompress->GetInfo(APE_INFO_WAV_HEADER_BYTES))) + } + + // allocate space for decompression + spTempBuffer.Assign(new unsigned char [spAPEDecompress->GetInfo(APE_INFO_BLOCK_ALIGN) * BLOCKS_PER_DECODE], TRUE); + if (spTempBuffer == NULL) throw(ERROR_INSUFFICIENT_MEMORY); + + int nBlocksLeft = spAPEDecompress->GetInfo(APE_DECOMPRESS_TOTAL_BLOCKS); + + // create the progress helper + spMACProgressHelper.Assign(new CMACProgressHelper(nBlocksLeft / BLOCKS_PER_DECODE, pPercentageDone, ProgressCallback, pKillFlag)); + + // main decoding loop + while (nBlocksLeft > 0) + { + // decode data + int nBlocksDecoded = -1; + int nRetVal = spAPEDecompress->GetData((char *) spTempBuffer.GetPtr(), BLOCKS_PER_DECODE, &nBlocksDecoded); + if (nRetVal != ERROR_SUCCESS) + throw(ERROR_INVALID_CHECKSUM); + // handle the output + if (nOutputMode == UNMAC_DECODER_OUTPUT_WAV) + { + unsigned int nBytesToWrite = (nBlocksDecoded * spAPEDecompress->GetInfo(APE_INFO_BLOCK_ALIGN)); + unsigned int nBytesWritten = 0; + int nRetVal = spioOutput->Write(spTempBuffer, nBytesToWrite, &nBytesWritten); + if ((nRetVal != 0) || (nBytesToWrite != nBytesWritten)) + throw(ERROR_IO_WRITE); + } + else if (nOutputMode == UNMAC_DECODER_OUTPUT_APE) + { + THROW_ON_ERROR(spAPECompress->AddData(spTempBuffer, nBlocksDecoded * spAPEDecompress->GetInfo(APE_INFO_BLOCK_ALIGN))) + } + + // update amount remaining + nBlocksLeft -= nBlocksDecoded; + + // update progress and kill flag + spMACProgressHelper->UpdateProgress(); + if (spMACProgressHelper->ProcessKillFlag(TRUE) != 0) + throw(ERROR_USER_STOPPED_PROCESSING); + } + + // terminate the output + if (nOutputMode == UNMAC_DECODER_OUTPUT_WAV) + { + // write any terminating WAV data + if (spAPEDecompress->GetInfo(APE_INFO_WAV_TERMINATING_BYTES) > 0) + { + spTempBuffer.Assign(new unsigned char[spAPEDecompress->GetInfo(APE_INFO_WAV_TERMINATING_BYTES)], TRUE); + if (spTempBuffer == NULL) throw(ERROR_INSUFFICIENT_MEMORY); + THROW_ON_ERROR(spAPEDecompress->GetInfo(APE_INFO_WAV_TERMINATING_DATA, (int) spTempBuffer.GetPtr(), spAPEDecompress->GetInfo(APE_INFO_WAV_TERMINATING_BYTES))) + + unsigned int nBytesToWrite = spAPEDecompress->GetInfo(APE_INFO_WAV_TERMINATING_BYTES); + unsigned int nBytesWritten = 0; + int nRetVal = spioOutput->Write(spTempBuffer, nBytesToWrite, &nBytesWritten); + if ((nRetVal != 0) || (nBytesToWrite != nBytesWritten)) + throw(ERROR_IO_WRITE); + } + } + else if (nOutputMode == UNMAC_DECODER_OUTPUT_APE) + { + // write the WAV data and any tag + int nTagBytes = GET_TAG(spAPEDecompress)->GetTagBytes(); + BOOL bHasTag = (nTagBytes > 0); + int nTerminatingBytes = nTagBytes; + nTerminatingBytes += spAPEDecompress->GetInfo(APE_INFO_WAV_TERMINATING_BYTES); + + if (nTerminatingBytes > 0) + { + spTempBuffer.Assign(new unsigned char[nTerminatingBytes], TRUE); + if (spTempBuffer == NULL) throw(ERROR_INSUFFICIENT_MEMORY); + + THROW_ON_ERROR(spAPEDecompress->GetInfo(APE_INFO_WAV_TERMINATING_DATA, (int) spTempBuffer.GetPtr(), nTerminatingBytes)) + + if (bHasTag) + { + unsigned int nBytesRead = 0; + THROW_ON_ERROR(GET_IO(spAPEDecompress)->Seek(-(nTagBytes), FILE_END)) + THROW_ON_ERROR(GET_IO(spAPEDecompress)->Read(&spTempBuffer[spAPEDecompress->GetInfo(APE_INFO_WAV_TERMINATING_BYTES)], nTagBytes, &nBytesRead)) + } + + THROW_ON_ERROR(spAPECompress->Finish(spTempBuffer, nTerminatingBytes, spAPEDecompress->GetInfo(APE_INFO_WAV_TERMINATING_BYTES))); + } + else + { + THROW_ON_ERROR(spAPECompress->Finish(NULL, 0, 0)); + } + } + + // fire the "complete" progress notification + spMACProgressHelper->UpdateProgressComplete(); + } + catch(int nErrorCode) + { + nFunctionRetVal = (nErrorCode == 0) ? ERROR_UNDEFINED : nErrorCode; + } + catch(...) + { + nFunctionRetVal = ERROR_UNDEFINED; + } + + // return + return nFunctionRetVal; +} diff --git a/Libraries/MAC/Files/Source/MACLib/APETag.cpp b/Libraries/MAC/Files/Source/MACLib/APETag.cpp new file mode 100755 index 000000000..14eeff1e0 --- /dev/null +++ b/Libraries/MAC/Files/Source/MACLib/APETag.cpp @@ -0,0 +1,754 @@ +#include "All.h" +#include "ID3Genres.h" +#include "APETag.h" +#include "CharacterHelper.h" +#include "IO.h" +#include IO_HEADER_FILE + +/***************************************************************************************** +CAPETagField +*****************************************************************************************/ + +CAPETagField::CAPETagField(const str_utf16 * pFieldName, const void * pFieldValue, int nFieldBytes, int nFlags) +{ + // field name + m_spFieldNameUTF16.Assign(new str_utf16 [wcslen(pFieldName) + 1], TRUE); + memcpy(m_spFieldNameUTF16, pFieldName, (wcslen(pFieldName) + 1) * sizeof(str_utf16)); + + // data (we'll always allocate two extra bytes and memset to 0 so we're safely NULL terminated) + m_nFieldValueBytes = max(nFieldBytes, 0); + m_spFieldValue.Assign(new char [m_nFieldValueBytes + 2], TRUE); + memset(m_spFieldValue, 0, m_nFieldValueBytes + 2); + if (m_nFieldValueBytes > 0) + memcpy(m_spFieldValue, pFieldValue, m_nFieldValueBytes); + + // flags + m_nFieldFlags = nFlags; +} + +CAPETagField::~CAPETagField() +{ +} + +int CAPETagField::GetFieldSize() +{ + CSmartPtr spFieldNameANSI(GetANSIFromUTF16(m_spFieldNameUTF16), TRUE); + return (strlen(spFieldNameANSI) + 1) + m_nFieldValueBytes + 4 + 4; +} + +const str_utf16 * CAPETagField::GetFieldName() +{ + return m_spFieldNameUTF16; +} + +const char * CAPETagField::GetFieldValue() +{ + return m_spFieldValue; +} + +int CAPETagField::GetFieldValueSize() +{ + return m_nFieldValueBytes; +} + +int CAPETagField::GetFieldFlags() +{ + return m_nFieldFlags; +} + +int CAPETagField::SaveField(char * pBuffer) +{ + *((int *) pBuffer) = m_nFieldValueBytes; + pBuffer += 4; + *((int *) pBuffer) = m_nFieldFlags; + pBuffer += 4; + + CSmartPtr spFieldNameANSI((char *) GetANSIFromUTF16(m_spFieldNameUTF16), TRUE); + strcpy(pBuffer, spFieldNameANSI); + pBuffer += strlen(spFieldNameANSI) + 1; + + memcpy(pBuffer, m_spFieldValue, m_nFieldValueBytes); + + return GetFieldSize(); +} + + +/***************************************************************************************** +CAPETag +*****************************************************************************************/ + +CAPETag::CAPETag(const char * pFilename, BOOL bAnalyze) +{ + m_spIO.Assign(new IO_CLASS_NAME); + m_spIO->Open(pFilename); + + m_bAnalyzed = FALSE; + m_nFields = 0; + m_nTagBytes = 0; + m_bIgnoreReadOnly = FALSE; + + if (bAnalyze) + { + Analyze(); + } +} + +CAPETag::CAPETag(CIO * pIO, BOOL bAnalyze) +{ + m_spIO.Assign(pIO, FALSE, FALSE); // we don't own the IO source + m_bAnalyzed = FALSE; + m_nFields = 0; + m_nTagBytes = 0; + + if (bAnalyze) + { + Analyze(); + } +} + +CAPETag::~CAPETag() +{ + ClearFields(); +} + +int CAPETag::GetTagBytes() +{ + if (m_bAnalyzed == FALSE) { Analyze(); } + + return m_nTagBytes; +} + +CAPETagField * CAPETag::GetTagField(int nIndex) +{ + if (m_bAnalyzed == FALSE) { Analyze(); } + + if ((nIndex >= 0) && (nIndex < m_nFields)) + { + return m_aryFields[nIndex]; + } + + return NULL; +} + +int CAPETag::Save(BOOL bUseOldID3) +{ + if (Remove(FALSE) != ERROR_SUCCESS) + return -1; + + if (m_nFields == 0) { return ERROR_SUCCESS; } + + int nRetVal = -1; + + if (bUseOldID3 == FALSE) + { + int z = 0; + + // calculate the size of the whole tag + int nFieldBytes = 0; + for (z = 0; z < m_nFields; z++) + nFieldBytes += m_aryFields[z]->GetFieldSize(); + + // sort the fields + SortFields(); + + // build the footer + APE_TAG_FOOTER APETagFooter(m_nFields, nFieldBytes); + + // make a buffer for the tag + int nTotalTagBytes = APETagFooter.GetTotalTagBytes(); + CSmartPtr spRawTag(new char [nTotalTagBytes], TRUE); + + // save the fields + int nLocation = 0; + for (z = 0; z < m_nFields; z++) + nLocation += m_aryFields[z]->SaveField(&spRawTag[nLocation]); + + // add the footer to the buffer + memcpy(&spRawTag[nLocation], &APETagFooter, APE_TAG_FOOTER_BYTES); + nLocation += APE_TAG_FOOTER_BYTES; + + // dump the tag to the I/O source + nRetVal = WriteBufferToEndOfIO(spRawTag, nTotalTagBytes); + } + else + { + // build the ID3 tag + ID3_TAG ID3Tag; + CreateID3Tag(&ID3Tag); + nRetVal = WriteBufferToEndOfIO(&ID3Tag, sizeof(ID3_TAG)); + } + + return nRetVal; +} + +int CAPETag::WriteBufferToEndOfIO(void * pBuffer, int nBytes) +{ + int nOriginalPosition = m_spIO->GetPosition(); + + unsigned int nBytesWritten = 0; + m_spIO->Seek(0, FILE_END); + + int nRetVal = m_spIO->Write(pBuffer, nBytes, &nBytesWritten); + + m_spIO->Seek(nOriginalPosition, FILE_BEGIN); + + return nRetVal; +} + +int CAPETag::Analyze() +{ + // clean-up + ID3_TAG ID3Tag; + ClearFields(); + m_nTagBytes = 0; + + m_bAnalyzed = TRUE; + + // store the original location + int nOriginalPosition = m_spIO->GetPosition(); + + // check for a tag + unsigned int nBytesRead; + int nRetVal; + m_bHasID3Tag = FALSE; + m_bHasAPETag = FALSE; + m_nAPETagVersion = -1; + m_spIO->Seek(-ID3_TAG_BYTES, FILE_END); + nRetVal = m_spIO->Read((unsigned char *) &ID3Tag, sizeof(ID3_TAG), &nBytesRead); + + if ((nBytesRead == sizeof(ID3_TAG)) && (nRetVal == 0)) + { + if (ID3Tag.Header[0] == 'T' && ID3Tag.Header[1] == 'A' && ID3Tag.Header[2] == 'G') + { + m_bHasID3Tag = TRUE; + m_nTagBytes += ID3_TAG_BYTES; + } + } + + // set the fields + if (m_bHasID3Tag) + { + SetFieldID3String(APE_TAG_FIELD_ARTIST, ID3Tag.Artist, 30); + SetFieldID3String(APE_TAG_FIELD_ALBUM, ID3Tag.Album, 30); + SetFieldID3String(APE_TAG_FIELD_TITLE, ID3Tag.Title, 30); + SetFieldID3String(APE_TAG_FIELD_COMMENT, ID3Tag.Comment, 28); + SetFieldID3String(APE_TAG_FIELD_YEAR, ID3Tag.Year, 4); + + char cTemp[16]; sprintf(cTemp, "%d", ID3Tag.Track); + SetFieldString(APE_TAG_FIELD_TRACK, cTemp, FALSE); + + if ((ID3Tag.Genre == GENRE_UNDEFINED) || (ID3Tag.Genre >= GENRE_COUNT)) + SetFieldString(APE_TAG_FIELD_GENRE, APE_TAG_GENRE_UNDEFINED); + else + SetFieldString(APE_TAG_FIELD_GENRE, g_ID3Genre[ID3Tag.Genre]); + } + + // try loading the APE tag + if (m_bHasID3Tag == FALSE) + { + APE_TAG_FOOTER APETagFooter; + m_spIO->Seek(-int(APE_TAG_FOOTER_BYTES), FILE_END); + nRetVal = m_spIO->Read((unsigned char *) &APETagFooter, APE_TAG_FOOTER_BYTES, &nBytesRead); + APETagFooter.m_nVersion = swap_endian32(APETagFooter.m_nVersion); + APETagFooter.m_nSize = swap_endian32(APETagFooter.m_nSize); + APETagFooter.m_nFields = swap_endian32(APETagFooter.m_nFields); + APETagFooter.m_nFlags = swap_endian32(APETagFooter.m_nFlags); + + if ((nBytesRead == APE_TAG_FOOTER_BYTES) && (nRetVal == 0)) + { + if (APETagFooter.GetIsValid(FALSE)) + { + m_bHasAPETag = TRUE; + m_nAPETagVersion = APETagFooter.GetVersion(); + + int nRawFieldBytes = APETagFooter.GetFieldBytes(); + m_nTagBytes += APETagFooter.GetTotalTagBytes(); + + CSmartPtr spRawTag(new char [nRawFieldBytes], TRUE); + m_spIO->Seek(-(APETagFooter.GetTotalTagBytes() - APETagFooter.GetFieldsOffset()), FILE_END); + nRetVal = m_spIO->Read((unsigned char *) spRawTag.GetPtr(), nRawFieldBytes, &nBytesRead); + + if ((nRetVal == 0) && (nRawFieldBytes == int(nBytesRead))) + { + // parse out the raw fields + int nLocation = 0; + for (int z = 0; z < APETagFooter.GetNumberFields(); z++) + { + int nMaximumFieldBytes = nRawFieldBytes - nLocation; + + int nBytes = 0; + if (LoadField(&spRawTag[nLocation], nMaximumFieldBytes, &nBytes) != ERROR_SUCCESS) + { + // if LoadField(...) fails, it means that the tag is corrupt (accidently or intentionally) + // we'll just bail out -- leaving the fields we've already set + break; + } + nLocation += nBytes; + } + } + } + } + } + + // restore the file pointer + m_spIO->Seek(nOriginalPosition, FILE_BEGIN); + + return ERROR_SUCCESS; +} + +int CAPETag::ClearFields() +{ + for (int z = 0; z < m_nFields; z++) + { + SAFE_DELETE(m_aryFields[z]) + } + + m_nFields = 0; + + return ERROR_SUCCESS; +} + +int CAPETag::GetTagFieldIndex(const str_utf16 * pFieldName) +{ + if (m_bAnalyzed == FALSE) { Analyze(); } + if (pFieldName == NULL) return -1; + + for (int z = 0; z < m_nFields; z++) + { + if (wcscmp(m_aryFields[z]->GetFieldName(), pFieldName) == 0) + return z; + } + + return -1; + +} + +CAPETagField * CAPETag::GetTagField(const str_utf16 * pFieldName) +{ + int nIndex = GetTagFieldIndex(pFieldName); + return (nIndex != -1) ? m_aryFields[nIndex] : NULL; +} + +int CAPETag::GetFieldString(const str_utf16 * pFieldName, str_ansi * pBuffer, int * pBufferCharacters, BOOL bUTF8Encode) +{ + int nOriginalCharacters = *pBufferCharacters; + str_utf16 * pUTF16 = new str_utf16 [*pBufferCharacters + 1]; + pUTF16[0] = 0; + + int nRetVal = GetFieldString(pFieldName, pUTF16, pBufferCharacters); + if (nRetVal == ERROR_SUCCESS) + { + CSmartPtr spANSI(bUTF8Encode ? (str_ansi *) GetUTF8FromUTF16(pUTF16) : GetANSIFromUTF16(pUTF16), TRUE); + if (int(strlen(spANSI)) > nOriginalCharacters) + { + memset(pBuffer, 0, nOriginalCharacters * sizeof(str_ansi)); + *pBufferCharacters = 0; + nRetVal = ERROR_UNDEFINED; + } + else + { + strcpy(pBuffer, spANSI); + *pBufferCharacters = strlen(spANSI); + } + } + + delete [] pUTF16; + + return nRetVal; +} + + +int CAPETag::GetFieldString(const str_utf16 * pFieldName, str_utf16 * pBuffer, int * pBufferCharacters) +{ + if (m_bAnalyzed == FALSE) { Analyze(); } + + int nRetVal = ERROR_UNDEFINED; + + if (*pBufferCharacters > 0) + { + CAPETagField * pAPETagField = GetTagField(pFieldName); + if (pAPETagField == NULL) + { + // the field doesn't exist -- return an empty string + memset(pBuffer, 0, *pBufferCharacters * sizeof(str_utf16)); + *pBufferCharacters = 0; + } + else if (pAPETagField->GetIsUTF8Text() || (m_nAPETagVersion < 2000)) + { + // get the value in UTF-16 format + CSmartPtr spUTF16; + if (m_nAPETagVersion >= 2000) + spUTF16.Assign(GetUTF16FromUTF8((str_utf8 *) pAPETagField->GetFieldValue()), TRUE); + else + spUTF16.Assign(GetUTF16FromANSI(pAPETagField->GetFieldValue()), TRUE); + + // get the number of characters + int nCharacters = (wcslen(spUTF16) + 1); + if (nCharacters > *pBufferCharacters) + { + // we'll fail here, because it's not clear what would get returned (null termination, size, etc.) + // and we really don't want to cause buffer overruns on the client side + *pBufferCharacters = nCharacters; + } + else + { + // just copy in + *pBufferCharacters = nCharacters; + memcpy(pBuffer, spUTF16.GetPtr(), *pBufferCharacters * sizeof(str_utf16)); + nRetVal = ERROR_SUCCESS; + } + } + else + { + // memset the whole buffer to NULL (so everything left over is NULL terminated) + memset(pBuffer, 0, *pBufferCharacters * sizeof(str_utf16)); + + // do a binary dump (need to convert from wchar's to bytes) + int nBufferBytes = (*pBufferCharacters - 1) * sizeof(str_utf16); + nRetVal = GetFieldBinary(pFieldName, pBuffer, &nBufferBytes); + *pBufferCharacters = (nBufferBytes / sizeof(str_utf16)) + 1; + } + } + + return nRetVal; +} + +int CAPETag::GetFieldBinary(const str_utf16 * pFieldName, void * pBuffer, int * pBufferBytes) +{ + if (m_bAnalyzed == FALSE) { Analyze(); } + + int nRetVal = ERROR_UNDEFINED; + + if (*pBufferBytes > 0) + { + CAPETagField * pAPETagField = GetTagField(pFieldName); + if (pAPETagField == NULL) + { + memset(pBuffer, 0, *pBufferBytes); + *pBufferBytes = 0; + } + else + { + if (pAPETagField->GetFieldValueSize() > *pBufferBytes) + { + // we'll fail here, because partial data may be worse than no data + memset(pBuffer, 0, *pBufferBytes); + *pBufferBytes = pAPETagField->GetFieldValueSize(); + } + else + { + // memcpy + *pBufferBytes = pAPETagField->GetFieldValueSize(); + memcpy(pBuffer, pAPETagField->GetFieldValue(), *pBufferBytes); + nRetVal = ERROR_SUCCESS; + } + } + } + + return nRetVal; +} + +int CAPETag::CreateID3Tag(ID3_TAG * pID3Tag) +{ + // error check + if (pID3Tag == NULL) { return -1; } + if (m_bAnalyzed == FALSE) { Analyze(); } + if (m_nFields == 0) { return -1; } + + // empty + ZeroMemory(pID3Tag, ID3_TAG_BYTES); + + // header + pID3Tag->Header[0] = 'T'; pID3Tag->Header[1] = 'A'; pID3Tag->Header[2] = 'G'; + + // standard fields + GetFieldID3String(APE_TAG_FIELD_ARTIST, pID3Tag->Artist, 30); + GetFieldID3String(APE_TAG_FIELD_ALBUM, pID3Tag->Album, 30); + GetFieldID3String(APE_TAG_FIELD_TITLE, pID3Tag->Title, 30); + GetFieldID3String(APE_TAG_FIELD_COMMENT, pID3Tag->Comment, 28); + GetFieldID3String(APE_TAG_FIELD_YEAR, pID3Tag->Year, 4); + + // track number + str_utf16 cBuffer[256] = { 0 }; int nBufferCharacters = 255; + GetFieldString(APE_TAG_FIELD_TRACK, cBuffer, &nBufferCharacters); + pID3Tag->Track = (unsigned char) atoi(GetANSIFromUTF16(cBuffer)); + + // genre + cBuffer[0] = 0; nBufferCharacters = 255; + GetFieldString(APE_TAG_FIELD_GENRE, cBuffer, &nBufferCharacters); + + // convert the genre string to an index + pID3Tag->Genre = 255; + int nGenreIndex = 0; + BOOL bFound = FALSE; + while ((nGenreIndex < GENRE_COUNT) && (bFound == FALSE)) + { + if (wcscmp(cBuffer, g_ID3Genre[nGenreIndex]) == 0) + { + pID3Tag->Genre = nGenreIndex; + bFound = TRUE; + } + + nGenreIndex++; + } + + return ERROR_SUCCESS; +} + +int CAPETag::LoadField(const char * pBuffer, int nMaximumBytes, int * pBytes) +{ + // set bytes to 0 + if (pBytes) *pBytes = 0; + + // size and flags + int nLocation = 0; + int nFieldValueSize = *((int *) &pBuffer[nLocation]); + nFieldValueSize = swap_endian32(nFieldValueSize); + nLocation += 4; + int nFieldFlags = *((int *) &pBuffer[nLocation]); + nFieldFlags = swap_endian32(nFieldFlags); + nLocation += 4; + + // safety check (so we can't get buffer overflow attacked) + int nMaximumRead = nMaximumBytes - 8 - nFieldValueSize; + BOOL bSafe = TRUE; + for (int z = 0; (z < nMaximumRead) && (bSafe == TRUE); z++) + { + int nCharacter = pBuffer[nLocation + z]; + if (nCharacter == 0) + break; + if ((nCharacter < 0x20) || (nCharacter > 0x7E)) + bSafe = FALSE; + } + if (bSafe == FALSE) + return -1; + + // name + int nNameCharacters = strlen(&pBuffer[nLocation]); + CSmartPtr spNameUTF8(new str_utf8 [nNameCharacters + 1], TRUE); + memcpy(spNameUTF8, &pBuffer[nLocation], (nNameCharacters + 1) * sizeof(str_utf8)); + nLocation += nNameCharacters + 1; + CSmartPtr spNameUTF16(GetUTF16FromUTF8(spNameUTF8.GetPtr()), TRUE); + + // value + CSmartPtr spFieldBuffer(new char [nFieldValueSize], TRUE); + memcpy(spFieldBuffer, &pBuffer[nLocation], nFieldValueSize); + nLocation += nFieldValueSize; + + // update the bytes + if (pBytes) *pBytes = nLocation; + + // set + return SetFieldBinary(spNameUTF16.GetPtr(), spFieldBuffer, nFieldValueSize, nFieldFlags); +} + +int CAPETag::SetFieldString(const str_utf16 * pFieldName, const str_utf16 * pFieldValue) +{ + // remove if empty + if ((pFieldValue == NULL) || (wcslen(pFieldValue) <= 0)) + return RemoveField(pFieldName); + + // UTF-8 encode the value and call the UTF-8 SetField(...) + CSmartPtr spFieldValueUTF8(GetUTF8FromUTF16((str_utf16 *) pFieldValue), TRUE); + return SetFieldString(pFieldName, (const char *) spFieldValueUTF8.GetPtr(), TRUE); +} + +int CAPETag::SetFieldString(const str_utf16 * pFieldName, const char * pFieldValue, BOOL bAlreadyUTF8Encoded) +{ + // remove if empty + if ((pFieldValue == NULL) || (strlen(pFieldValue) <= 0)) + return RemoveField(pFieldName); + + // get the length and call the binary SetField(...) + if (bAlreadyUTF8Encoded == FALSE) + { + CSmartPtr spUTF8((char *) GetUTF8FromANSI(pFieldValue), TRUE); + int nFieldBytes = strlen(spUTF8.GetPtr()); + return SetFieldBinary(pFieldName, spUTF8.GetPtr(), nFieldBytes, TAG_FIELD_FLAG_DATA_TYPE_TEXT_UTF8); + } + else + { + int nFieldBytes = strlen(pFieldValue); + return SetFieldBinary(pFieldName, pFieldValue, nFieldBytes, TAG_FIELD_FLAG_DATA_TYPE_TEXT_UTF8); + } +} + +int CAPETag::SetFieldBinary(const str_utf16 * pFieldName, const void * pFieldValue, int nFieldBytes, int nFieldFlags) +{ + if (m_bAnalyzed == FALSE) { Analyze(); } + if (pFieldName == NULL) return -1; + + // check to see if we're trying to remove the field (by setting it to NULL or an empty string) + BOOL bRemoving = (pFieldValue == NULL) || (nFieldBytes <= 0); + + // get the index + int nFieldIndex = GetTagFieldIndex(pFieldName); + if (nFieldIndex != -1) + { + // existing field + + // fail if we're read-only (and not ignoring the read-only flag) + if ((m_bIgnoreReadOnly == FALSE) && (m_aryFields[nFieldIndex]->GetIsReadOnly())) + return -1; + + // erase the existing field + SAFE_DELETE(m_aryFields[nFieldIndex]) + + if (bRemoving) + { + return RemoveField(nFieldIndex); + } + } + else + { + if (bRemoving) + return ERROR_SUCCESS; + + nFieldIndex = m_nFields; + m_nFields++; + } + + // create the field and add it to the field array + m_aryFields[nFieldIndex] = new CAPETagField(pFieldName, pFieldValue, nFieldBytes, nFieldFlags); + + return ERROR_SUCCESS; +} + +int CAPETag::RemoveField(int nIndex) +{ + if ((nIndex >= 0) && (nIndex < m_nFields)) + { + SAFE_DELETE(m_aryFields[nIndex]) + memmove(&m_aryFields[nIndex], &m_aryFields[nIndex + 1], (256 - nIndex - 1) * sizeof(CAPETagField *)); + m_nFields--; + return ERROR_SUCCESS; + } + + return -1; +} + +int CAPETag::RemoveField(const str_utf16 * pFieldName) +{ + return RemoveField(GetTagFieldIndex(pFieldName)); +} + +int CAPETag::Remove(BOOL bUpdate) +{ + // variables + unsigned int nBytesRead = 0; + int nRetVal = 0; + int nOriginalPosition = m_spIO->GetPosition(); + + BOOL bID3Removed = TRUE; + BOOL bAPETagRemoved = TRUE; + + BOOL bFailedToRemove = FALSE; + + while (bID3Removed || bAPETagRemoved) + { + bID3Removed = FALSE; + bAPETagRemoved = FALSE; + + // ID3 tag + if (m_spIO->GetSize() > ID3_TAG_BYTES) + { + char cTagHeader[3]; + m_spIO->Seek(-ID3_TAG_BYTES, FILE_END); + nRetVal = m_spIO->Read(cTagHeader, 3, &nBytesRead); + if ((nRetVal == 0) && (nBytesRead == 3)) + { + if (strncmp(cTagHeader, "TAG", 3) == 0) + { + m_spIO->Seek(-ID3_TAG_BYTES, FILE_END); + if (m_spIO->SetEOF() != 0) + bFailedToRemove = TRUE; + else + bID3Removed = TRUE; + } + } + } + + + // APE Tag + if (m_spIO->GetSize() > APE_TAG_FOOTER_BYTES && bFailedToRemove == FALSE) + { + APE_TAG_FOOTER APETagFooter; + m_spIO->Seek(-int(APE_TAG_FOOTER_BYTES), FILE_END); + nRetVal = m_spIO->Read(&APETagFooter, APE_TAG_FOOTER_BYTES, &nBytesRead); + APETagFooter.m_nVersion = swap_endian32(APETagFooter.m_nVersion); + APETagFooter.m_nSize = swap_endian32(APETagFooter.m_nSize); + APETagFooter.m_nFields = swap_endian32(APETagFooter.m_nFields); + APETagFooter.m_nFlags = swap_endian32(APETagFooter.m_nFlags); + if ((nRetVal == 0) && (nBytesRead == APE_TAG_FOOTER_BYTES)) + { + if (APETagFooter.GetIsValid(TRUE)) + { + m_spIO->Seek(-APETagFooter.GetTotalTagBytes(), FILE_END); + + if (m_spIO->SetEOF() != 0) + bFailedToRemove = TRUE; + else + bAPETagRemoved = TRUE; + } + } + } + + } + + m_spIO->Seek(nOriginalPosition, FILE_BEGIN); + + if (bUpdate && bFailedToRemove == FALSE) + { + Analyze(); + } + + return bFailedToRemove ? -1 : 0; +} + +int CAPETag::SetFieldID3String(const str_utf16 * pFieldName, const char * pFieldValue, int nBytes) +{ + // allocate a buffer and terminate it + CSmartPtr spBuffer(new str_ansi [nBytes + 1], TRUE); + spBuffer[nBytes] = 0; + + // make a capped copy of the string + memcpy(spBuffer.GetPtr(), pFieldValue, nBytes); + + // remove trailing white-space + char * pEnd = &spBuffer[nBytes]; + while (((*pEnd == ' ') || (*pEnd == 0)) && pEnd >= &spBuffer[0]) { *pEnd-- = 0; } + + // set the field + SetFieldString(pFieldName, spBuffer, FALSE); + + return ERROR_SUCCESS; +} + +int CAPETag::GetFieldID3String(const str_utf16 * pFieldName, char * pBuffer, int nBytes) +{ + int nBufferCharacters = 255; str_utf16 cBuffer[256] = {0}; + GetFieldString(pFieldName, cBuffer, &nBufferCharacters); + + CSmartPtr spBufferANSI(GetANSIFromUTF16(cBuffer), TRUE); + + memset(pBuffer, 0, nBytes); + strncpy(pBuffer, spBufferANSI.GetPtr(), nBytes); + + return ERROR_SUCCESS; +} + +int CAPETag::SortFields() +{ + // sort the tag fields by size (so that the smallest fields are at the front of the tag) + qsort(m_aryFields, m_nFields, sizeof(CAPETagField *), CompareFields); + + return ERROR_SUCCESS; +} + +int CAPETag::CompareFields(const void * pA, const void * pB) +{ + CAPETagField * pFieldA = *((CAPETagField **) pA); + CAPETagField * pFieldB = *((CAPETagField **) pB); + + return (pFieldA->GetFieldSize() - pFieldB->GetFieldSize()); +} \ No newline at end of file diff --git a/Libraries/MAC/Files/Source/MACLib/APETag.h b/Libraries/MAC/Files/Source/MACLib/APETag.h new file mode 100755 index 000000000..3ce8b57f2 --- /dev/null +++ b/Libraries/MAC/Files/Source/MACLib/APETag.h @@ -0,0 +1,294 @@ +#ifndef APE_APETAG_H +#define APE_APETAG_H + +class CIO; + +/***************************************************************************************** +APETag version history / supported formats + +1.0 (1000) - Original APE tag spec. Fully supported by this code. +2.0 (2000) - Refined APE tag spec (better streaming support, UTF encoding). Fully supported by this code. + +Notes: + - also supports reading of ID3v1.1 tags + - all saving done in the APE Tag format using CURRENT_APE_TAG_VERSION +*****************************************************************************************/ + +/***************************************************************************************** +APETag layout + +1) Header - APE_TAG_FOOTER (optional) (32 bytes) +2) Fields (array): + Value Size (4 bytes) + Flags (4 bytes) + Field Name (? ANSI bytes -- requires NULL terminator -- in range of 0x20 (space) to 0x7E (tilde)) + Value ([Value Size] bytes) +3) Footer - APE_TAG_FOOTER (32 bytes) +*****************************************************************************************/ + +/***************************************************************************************** +Notes + +-When saving images, store the filename (no directory -- i.e. Cover.jpg) in UTF-8 followed +by a null terminator, followed by the image data. +*****************************************************************************************/ + +/***************************************************************************************** +The version of the APE tag +*****************************************************************************************/ +#define CURRENT_APE_TAG_VERSION 2000 + +/***************************************************************************************** +"Standard" APE tag fields +*****************************************************************************************/ +#define APE_TAG_FIELD_TITLE L"Title" +#define APE_TAG_FIELD_ARTIST L"Artist" +#define APE_TAG_FIELD_ALBUM L"Album" +#define APE_TAG_FIELD_COMMENT L"Comment" +#define APE_TAG_FIELD_YEAR L"Year" +#define APE_TAG_FIELD_TRACK L"Track" +#define APE_TAG_FIELD_GENRE L"Genre" +#define APE_TAG_FIELD_COVER_ART_FRONT L"Cover Art (front)" +#define APE_TAG_FIELD_NOTES L"Notes" +#define APE_TAG_FIELD_LYRICS L"Lyrics" +#define APE_TAG_FIELD_COPYRIGHT L"Copyright" +#define APE_TAG_FIELD_BUY_URL L"Buy URL" +#define APE_TAG_FIELD_ARTIST_URL L"Artist URL" +#define APE_TAG_FIELD_PUBLISHER_URL L"Publisher URL" +#define APE_TAG_FIELD_FILE_URL L"File URL" +#define APE_TAG_FIELD_COPYRIGHT_URL L"Copyright URL" +#define APE_TAG_FIELD_MJ_METADATA L"Media Jukebox Metadata" +#define APE_TAG_FIELD_TOOL_NAME L"Tool Name" +#define APE_TAG_FIELD_TOOL_VERSION L"Tool Version" +#define APE_TAG_FIELD_PEAK_LEVEL L"Peak Level" +#define APE_TAG_FIELD_REPLAY_GAIN_RADIO L"Replay Gain (radio)" +#define APE_TAG_FIELD_REPLAY_GAIN_ALBUM L"Replay Gain (album)" +#define APE_TAG_FIELD_COMPOSER L"Composer" +#define APE_TAG_FIELD_KEYWORDS L"Keywords" + +/***************************************************************************************** +Standard APE tag field values +*****************************************************************************************/ +#define APE_TAG_GENRE_UNDEFINED L"Undefined" + +/***************************************************************************************** +ID3 v1.1 tag +*****************************************************************************************/ +#define ID3_TAG_BYTES 128 +struct ID3_TAG +{ + char Header[3]; // should equal 'TAG' + char Title[30]; // title + char Artist[30]; // artist + char Album[30]; // album + char Year[4]; // year + char Comment[29]; // comment + unsigned char Track; // track + unsigned char Genre; // genre +}; + +/***************************************************************************************** +Footer (and header) flags +*****************************************************************************************/ +#define APE_TAG_FLAG_CONTAINS_HEADER (1 << 31) +#define APE_TAG_FLAG_CONTAINS_FOOTER (1 << 30) +#define APE_TAG_FLAG_IS_HEADER (1 << 29) + +#define APE_TAG_FLAGS_DEFAULT (APE_TAG_FLAG_CONTAINS_FOOTER) + +/***************************************************************************************** +Tag field flags +*****************************************************************************************/ +#define TAG_FIELD_FLAG_READ_ONLY (1 << 0) + +#define TAG_FIELD_FLAG_DATA_TYPE_MASK (6) +#define TAG_FIELD_FLAG_DATA_TYPE_TEXT_UTF8 (0 << 1) +#define TAG_FIELD_FLAG_DATA_TYPE_BINARY (1 << 1) +#define TAG_FIELD_FLAG_DATA_TYPE_EXTERNAL_INFO (2 << 1) +#define TAG_FIELD_FLAG_DATA_TYPE_RESERVED (3 << 1) + +/***************************************************************************************** +The footer at the end of APE tagged files (can also optionally be at the front of the tag) +*****************************************************************************************/ +#define APE_TAG_FOOTER_BYTES 32 + +class APE_TAG_FOOTER +{ + //protected: + public: + + char m_cID[8]; // should equal 'APETAGEX' + int m_nVersion; // equals CURRENT_APE_TAG_VERSION + int m_nSize; // the complete size of the tag, including this footer (excludes header) + int m_nFields; // the number of fields in the tag + int m_nFlags; // the tag flags + char m_cReserved[8]; // reserved for later use (must be zero) + +//public: + + APE_TAG_FOOTER(int nFields = 0, int nFieldBytes = 0) + { + memcpy(m_cID, "APETAGEX", 8); + memset(m_cReserved, 0, 8); + m_nFields = nFields; + m_nFlags = APE_TAG_FLAGS_DEFAULT; + m_nSize = nFieldBytes + APE_TAG_FOOTER_BYTES; + m_nVersion = CURRENT_APE_TAG_VERSION; + } + + int GetTotalTagBytes() { return m_nSize + (GetHasHeader() ? APE_TAG_FOOTER_BYTES : 0); } + int GetFieldBytes() { return m_nSize - APE_TAG_FOOTER_BYTES; } + int GetFieldsOffset() { return GetHasHeader() ? APE_TAG_FOOTER_BYTES : 0; } + int GetNumberFields() { return m_nFields; } + BOOL GetHasHeader() { return (m_nFlags & APE_TAG_FLAG_CONTAINS_HEADER) ? TRUE : FALSE; } + BOOL GetIsHeader() { return (m_nFlags & APE_TAG_FLAG_IS_HEADER) ? TRUE : FALSE; } + int GetVersion() { return m_nVersion; } + + BOOL GetIsValid(BOOL bAllowHeader) + { + BOOL bValid = (strncmp(m_cID, "APETAGEX", 8) == 0) && + (m_nVersion <= CURRENT_APE_TAG_VERSION) && + (m_nFields <= 65536) && + (GetFieldBytes() <= (1024 * 1024 * 16)); + + if (bValid && (bAllowHeader == FALSE) && GetIsHeader()) + bValid = FALSE; + + return bValid ? TRUE : FALSE; + } +}; + +/***************************************************************************************** +CAPETagField class (an APE tag is an array of these) +*****************************************************************************************/ +class CAPETagField +{ +public: + + // create a tag field (use nFieldBytes = -1 for null-terminated strings) + CAPETagField(const str_utf16 * pFieldName, const void * pFieldValue, int nFieldBytes = -1, int nFlags = 0); + + // destructor + ~CAPETagField(); + + // gets the size of the entire field in bytes (name, value, and metadata) + int GetFieldSize(); + + // get the name of the field + const str_utf16 * GetFieldName(); + + // get the value of the field + const char * GetFieldValue(); + + // get the size of the value (in bytes) + int GetFieldValueSize(); + + // get any special flags + int GetFieldFlags(); + + // output the entire field to a buffer (GetFieldSize() bytes) + int SaveField(char * pBuffer); + + // checks to see if the field is read-only + BOOL GetIsReadOnly() { return (m_nFieldFlags & TAG_FIELD_FLAG_READ_ONLY) ? TRUE : FALSE; } + BOOL GetIsUTF8Text() { return ((m_nFieldFlags & TAG_FIELD_FLAG_DATA_TYPE_MASK) == TAG_FIELD_FLAG_DATA_TYPE_TEXT_UTF8) ? TRUE : FALSE; } + + // set helpers (use with EXTREME caution) + void SetFieldFlags(int nFlags) { m_nFieldFlags = nFlags; } + +private: + + CSmartPtr m_spFieldNameUTF16; + CSmartPtr m_spFieldValue; + int m_nFieldFlags; + int m_nFieldValueBytes; +}; + +/***************************************************************************************** +CAPETag class +*****************************************************************************************/ +class CAPETag +{ +public: + + // create an APE tag + // bAnalyze determines whether it will analyze immediately or on the first request + // be careful with multiple threads / file pointer movement if you don't analyze immediately + CAPETag(CIO * pIO, BOOL bAnalyze = TRUE); + CAPETag(const char * pFilename, BOOL bAnalyze = TRUE); + + // destructor + ~CAPETag(); + + // save the tag to the I/O source (bUseOldID3 forces it to save as an ID3v1.1 tag instead of an APE tag) + int Save(BOOL bUseOldID3 = FALSE); + + // removes any tags from the file (bUpdate determines whether is should re-analyze after removing the tag) + int Remove(BOOL bUpdate = TRUE); + + // sets the value of a field (use nFieldBytes = -1 for null terminated strings) + // note: using NULL or "" for a string type will remove the field + int SetFieldString(const str_utf16 * pFieldName, const str_utf16 * pFieldValue); + int SetFieldString(const str_utf16 * pFieldName, const char * pFieldValue, BOOL bAlreadyUTF8Encoded); + int SetFieldBinary(const str_utf16 * pFieldName, const void * pFieldValue, int nFieldBytes, int nFieldFlags); + + // gets the value of a field (returns -1 and an empty buffer if the field doesn't exist) + int GetFieldBinary(const str_utf16 * pFieldName, void * pBuffer, int * pBufferBytes); + int GetFieldString(const str_utf16 * pFieldName, str_utf16 * pBuffer, int * pBufferCharacters); + int GetFieldString(const str_utf16 * pFieldName, str_ansi * pBuffer, int * pBufferCharacters, BOOL bUTF8Encode = FALSE); + + // remove a specific field + int RemoveField(const str_utf16 * pFieldName); + int RemoveField(int nIndex); + + // clear all the fields + int ClearFields(); + + // get the total tag bytes in the file from the last analyze + // need to call Save() then Analyze() to update any changes + int GetTagBytes(); + + // fills in an ID3_TAG using the current fields (useful for quickly converting the tag) + int CreateID3Tag(ID3_TAG * pID3Tag); + + // see whether the file has an ID3 or APE tag + BOOL GetHasID3Tag() { if (m_bAnalyzed == FALSE) { Analyze(); } return m_bHasID3Tag; } + BOOL GetHasAPETag() { if (m_bAnalyzed == FALSE) { Analyze(); } return m_bHasAPETag; } + int GetAPETagVersion() { return GetHasAPETag() ? m_nAPETagVersion : -1; } + + // gets a desired tag field (returns NULL if not found) + // again, be careful, because this a pointer to the actual field in this class + CAPETagField * GetTagField(const str_utf16 * pFieldName); + CAPETagField * GetTagField(int nIndex); + + // options + void SetIgnoreReadOnly(BOOL bIgnoreReadOnly) { m_bIgnoreReadOnly = bIgnoreReadOnly; } + +private: + + // private functions + int Analyze(); + int GetTagFieldIndex(const str_utf16 * pFieldName); + int WriteBufferToEndOfIO(void * pBuffer, int nBytes); + int LoadField(const char * pBuffer, int nMaximumBytes, int * pBytes); + int SortFields(); + static int CompareFields(const void * pA, const void * pB); + + // helper set / get field functions + int SetFieldID3String(const str_utf16 * pFieldName, const char * pFieldValue, int nBytes); + int GetFieldID3String(const str_utf16 * pFieldName, char * pBuffer, int nBytes); + + // private data + CSmartPtr m_spIO; + BOOL m_bAnalyzed; + int m_nTagBytes; + int m_nFields; + CAPETagField * m_aryFields[256]; + BOOL m_bHasAPETag; + int m_nAPETagVersion; + BOOL m_bHasID3Tag; + BOOL m_bIgnoreReadOnly; +}; + +#endif // #ifndef APE_APETAG_H + diff --git a/Libraries/MAC/Files/Source/MACLib/Assembly/Assembly.h b/Libraries/MAC/Files/Source/MACLib/Assembly/Assembly.h new file mode 100755 index 000000000..a6ff7906b --- /dev/null +++ b/Libraries/MAC/Files/Source/MACLib/Assembly/Assembly.h @@ -0,0 +1,12 @@ +#ifndef APE_ASSEMBLY_H +#define APE_ASSEMBLY_H + +extern "C" +{ + void Adapt(short * pM, const short * pAdapt, int nDirection, int nOrder); + int CalculateDotProduct(const short * pA, const short * pB, int nOrder); + BOOL GetMMXAvailable(); +}; + +#endif // #ifndef APE_ASSEMBLY_H + diff --git a/Libraries/MAC/Files/Source/MACLib/Assembly/Assembly.nas b/Libraries/MAC/Files/Source/MACLib/Assembly/Assembly.nas new file mode 100755 index 000000000..74e4eaac3 --- /dev/null +++ b/Libraries/MAC/Files/Source/MACLib/Assembly/Assembly.nas @@ -0,0 +1,181 @@ + +%include "Tools.inc" + +segment_code + +; +; void Adapt ( short* pM, const short* pAdapt, int nDirection, int nOrder ) +; +; [esp+16] nOrder +; [esp+12] nDirection +; [esp+ 8] pAdapt +; [esp+ 4] pM +; [esp+ 0] Return Address + + align 16 + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop +proc Adapt + + mov eax, [esp + 4] ; pM + mov ecx, [esp + 8] ; pAdapt + mov edx, [esp + 16] ; nOrder + shr edx, 4 + + cmp dword [esp + 12], byte 0 ; nDirection + jle short AdaptSub + +AdaptAddLoop: + movq mm0, [eax] + paddw mm0, [ecx] + movq [eax], mm0 + movq mm1, [eax + 8] + paddw mm1, [ecx + 8] + movq [eax + 8], mm1 + movq mm2, [eax + 16] + paddw mm2, [ecx + 16] + movq [eax + 16], mm2 + movq mm3, [eax + 24] + paddw mm3, [ecx + 24] + movq [eax + 24], mm3 + add eax, byte 32 + add ecx, byte 32 + dec edx + jnz AdaptAddLoop + + emms + ret + + align 16 + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + +AdaptSub: je short AdaptDone + +AdaptSubLoop: + movq mm0, [eax] + psubw mm0, [ecx] + movq [eax], mm0 + movq mm1, [eax + 8] + psubw mm1, [ecx + 8] + movq [eax + 8], mm1 + movq mm2, [eax + 16] + psubw mm2, [ecx + 16] + movq [eax + 16], mm2 + movq mm3, [eax + 24] + psubw mm3, [ecx + 24] + movq [eax + 24], mm3 + add eax, byte 32 + add ecx, byte 32 + dec edx + jnz AdaptSubLoop + + emms +AdaptDone: + +endproc + +; +; int CalculateDotProduct ( const short* pA, const short* pB, int nOrder ) +; +; [esp+12] nOrder +; [esp+ 8] pB +; [esp+ 4] pA +; [esp+ 0] Return Address + + align 16 + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + +proc CalculateDotProduct + + mov eax, [esp + 4] ; pA + mov ecx, [esp + 8] ; pB + mov edx, [esp + 12] ; nOrder + shr edx, 4 + pxor mm7, mm7 + +loopDot: movq mm0, [eax] + pmaddwd mm0, [ecx] + paddd mm7, mm0 + movq mm1, [eax + 8] + pmaddwd mm1, [ecx + 8] + paddd mm7, mm1 + movq mm2, [eax + 16] + pmaddwd mm2, [ecx + 16] + paddd mm7, mm2 + movq mm3, [eax + 24] + pmaddwd mm3, [ecx + 24] + add eax, byte 32 + add ecx, byte 32 + paddd mm7, mm3 + dec edx + jnz loopDot + + movq mm6, mm7 + psrlq mm7, 32 + paddd mm6, mm7 + movd [esp + 4], mm6 + emms + mov eax, [esp + 4] +endproc + + +; +; BOOL GetMMXAvailable ( void ); +; + +proc GetMMXAvailable + pushad + pushfd + pop eax + mov ecx, eax + xor eax, 0x200000 + push eax + popfd + pushfd + pop eax + cmp eax, ecx + jz short return ; no CPUID command, so no MMX + + mov eax,1 + CPUID + test edx,0x800000 +return: popad + setnz al + and eax, byte 1 +endproc + + end diff --git a/Libraries/MAC/Files/Source/MACLib/Assembly/Tools.inc b/Libraries/MAC/Files/Source/MACLib/Assembly/Tools.inc new file mode 100755 index 000000000..d2fd7fb2f --- /dev/null +++ b/Libraries/MAC/Files/Source/MACLib/Assembly/Tools.inc @@ -0,0 +1,117 @@ +; +; (C) Ururi 1999 +; + +BITS 32 + +%ifdef WIN32 + %define _NAMING + %define segment_code segment .text align=32 class=CODE use32 + %define segment_data segment .data align=32 class=DATA use32 + %ifdef __BORLANDC__ + %define segment_bss segment .data align=32 class=DATA use32 + %else + %define segment_bss segment .bss align=32 class=DATA use32 + %endif + +%elifdef AOUT + %define _NAMING + %define segment_code segment .text + %define segment_data segment .data + %define segment_bss segment .bss + +%else + %define segment_code segment .text align=32 class=CODE use32 + %define segment_data segment .data align=32 class=DATA use32 + %define segment_bss segment .bss align=32 class=DATA use32 +%endif + +%define pmov movq +%define pmovd movd + +%define pupldq punpckldq +%define puphdq punpckhdq +%define puplwd punpcklwd +%define puphwd punpckhwd + +%imacro globaldef 1 + %ifdef _NAMING + %define %1 _%1 + %endif + global %1 +%endmacro + +%imacro externdef 1 + %ifdef _NAMING + %define %1 _%1 + %endif + extern %1 +%endmacro + +%imacro proc 1 + %push proc + global _%1 + global %1 +_%1: +%1: + %assign %$STACK 0 + %assign %$STACKN 0 + %assign %$ARG 4 +%endmacro + +%imacro endproc 0 + %ifnctx proc + %error expected 'proc' before 'endproc'. + %else + %if %$STACK > 0 + add esp, %$STACK + %endif + + %if %$STACK <> (-%$STACKN) + %error STACKLEVEL mismatch check 'local', 'alloc', 'pushd', 'popd' + %endif + + ret + %pop + %endif +%endmacro + +%idefine sp(a) esp+%$STACK+a + +%imacro arg 1 + %00 equ %$ARG + %assign %$ARG %$ARG+%1 +%endmacro + +%imacro local 1 + %assign %$STACKN %$STACKN-%1 + %00 equ %$STACKN +%endmacro + +%imacro alloc 0 + sub esp, (-%$STACKN)-%$STACK + %assign %$STACK (-%$STACKN) +%endmacro + +%imacro pushd 1-* + %rep %0 + push %1 + %assign %$STACK %$STACK+4 + %rotate 1 + %endrep +%endmacro + +%imacro popd 1-* + %rep %0 + %rotate -1 + pop %1 + %assign %$STACK %$STACK-4 + %endrep +%endmacro + +%macro algn 1 + align 16 + %rep (65536-%1) & 15 + nop + %endrep +%endm diff --git a/Libraries/MAC/Files/Source/MACLib/BitArray.cpp b/Libraries/MAC/Files/Source/MACLib/BitArray.cpp new file mode 100755 index 000000000..060e3da2d --- /dev/null +++ b/Libraries/MAC/Files/Source/MACLib/BitArray.cpp @@ -0,0 +1,441 @@ +/************************************************************************************ +Includes +************************************************************************************/ +#include "All.h" +#include "BitArray.h" +#include "MD5.h" + +/************************************************************************************ +Declares +************************************************************************************/ +#define BIT_ARRAY_ELEMENTS (4096) // the number of elements in the bit array (4 MB) +#define BIT_ARRAY_BYTES (BIT_ARRAY_ELEMENTS * 4) // the number of bytes in the bit array +#define BIT_ARRAY_BITS (BIT_ARRAY_BYTES * 8) // the number of bits in the bit array + +#define MAX_ELEMENT_BITS 128 +#define REFILL_BIT_THRESHOLD (BIT_ARRAY_BITS - MAX_ELEMENT_BITS) + +#define CODE_BITS 32 +#define TOP_VALUE ((unsigned int) 1 << (CODE_BITS - 1)) +#define SHIFT_BITS (CODE_BITS - 9) +#define EXTRA_BITS ((CODE_BITS - 2) % 8 + 1) +#define BOTTOM_VALUE (TOP_VALUE >> 8) + +/************************************************************************************ +Lookup tables +************************************************************************************/ +const uint32 K_SUM_MIN_BOUNDARY[32] = {0,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131072,262144,524288,1048576,2097152,4194304,8388608,16777216,33554432,67108864,134217728,268435456,536870912,1073741824,2147483648,0,0,0,0}; + +#define MODEL_ELEMENTS 64 +#define RANGE_OVERFLOW_TOTAL_WIDTH 65536 +#define RANGE_OVERFLOW_SHIFT 16 + +const uint32 RANGE_TOTAL[64] = {0,19578,36160,48417,56323,60899,63265,64435,64971,65232,65351,65416,65447,65466,65476,65482,65485,65488,65490,65491,65492,65493,65494,65495,65496,65497,65498,65499,65500,65501,65502,65503,65504,65505,65506,65507,65508,65509,65510,65511,65512,65513,65514,65515,65516,65517,65518,65519,65520,65521,65522,65523,65524,65525,65526,65527,65528,65529,65530,65531,65532,65533,65534,65535,}; +const uint32 RANGE_WIDTH[64] = {19578,16582,12257,7906,4576,2366,1170,536,261,119,65,31,19,10,6,3,3,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,}; + +#ifdef BUILD_RANGE_TABLE + int g_aryOverflows[256] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; + int g_nTotalOverflow = 0; +#endif + +/************************************************************************************ +Constructor +************************************************************************************/ +CBitArray::CBitArray(CIO *pIO) +{ + // allocate memory for the bit array + m_pBitArray = new uint32 [BIT_ARRAY_ELEMENTS]; + memset(m_pBitArray, 0, BIT_ARRAY_BYTES); + + // initialize other variables + m_nCurrentBitIndex = 0; + m_pIO = pIO; +} + +/************************************************************************************ +Destructor +************************************************************************************/ +CBitArray::~CBitArray() +{ + // free the bit array + SAFE_ARRAY_DELETE(m_pBitArray) +#ifdef BUILD_RANGE_TABLE + OutputRangeTable(); +#endif +} + +/************************************************************************************ +Output the bit array via the CIO (typically saves to disk) +************************************************************************************/ +int CBitArray::OutputBitArray(BOOL bFinalize) +{ + int i; + // write the entire file to disk + unsigned int nBytesWritten = 0; + unsigned int nBytesToWrite = 0; + unsigned int nRetVal = 0; + + if (bFinalize) + { + nBytesToWrite = ((m_nCurrentBitIndex >> 5) * 4) + 4; + + m_MD5.AddData(m_pBitArray, nBytesToWrite); + + for(i=0;i<(nBytesToWrite/4);i++) { + m_pBitArray[i] = swap_endian32(m_pBitArray[i]); + } + RETURN_ON_ERROR(m_pIO->Write(m_pBitArray, nBytesToWrite, &nBytesWritten)) + + // reset the bit pointer + m_nCurrentBitIndex = 0; + } + else + { + nBytesToWrite = (m_nCurrentBitIndex >> 5) * 4; + + m_MD5.AddData(m_pBitArray, nBytesToWrite); + + for(i=0;i<(nBytesToWrite/4);i++) { + m_pBitArray[i] = swap_endian32(m_pBitArray[i]); + } + RETURN_ON_ERROR(m_pIO->Write(m_pBitArray, nBytesToWrite, &nBytesWritten)) + + // move the last value to the front of the bit array + m_pBitArray[0] = m_pBitArray[m_nCurrentBitIndex >> 5]; + m_nCurrentBitIndex = (m_nCurrentBitIndex & 31); + + // zero the rest of the memory (may not need the +1 because of frame byte alignment) + memset(&m_pBitArray[1], 0, min(nBytesToWrite + 1, BIT_ARRAY_BYTES - 1)); + } + + // return a success + return ERROR_SUCCESS; +} + +/************************************************************************************ +Range coding macros -- ugly, but outperform inline's (every cycle counts here) +************************************************************************************/ +#define PUTC(VALUE) m_pBitArray[m_nCurrentBitIndex >> 5] |= ((VALUE) & 0xFF) << (24 - (m_nCurrentBitIndex & 31)); m_nCurrentBitIndex += 8; +#define PUTC_NOCAP(VALUE) m_pBitArray[m_nCurrentBitIndex >> 5] |= (VALUE) << (24 - (m_nCurrentBitIndex & 31)); m_nCurrentBitIndex += 8; + +#define NORMALIZE_RANGE_CODER \ + while (m_RangeCoderInfo.range <= BOTTOM_VALUE) \ + { \ + if (m_RangeCoderInfo.low < (0xFF << SHIFT_BITS)) \ + { \ + PUTC(m_RangeCoderInfo.buffer); \ + for ( ; m_RangeCoderInfo.help; m_RangeCoderInfo.help--) { PUTC_NOCAP(0xFF); } \ + m_RangeCoderInfo.buffer = (m_RangeCoderInfo.low >> SHIFT_BITS); \ + } \ + else if (m_RangeCoderInfo.low & TOP_VALUE) \ + { \ + PUTC(m_RangeCoderInfo.buffer + 1); \ + m_nCurrentBitIndex += (m_RangeCoderInfo.help * 8); \ + m_RangeCoderInfo.help = 0; \ + m_RangeCoderInfo.buffer = (m_RangeCoderInfo.low >> SHIFT_BITS); \ + } \ + else \ + { \ + m_RangeCoderInfo.help++; \ + } \ + \ + m_RangeCoderInfo.low = (m_RangeCoderInfo.low << 8) & (TOP_VALUE - 1); \ + m_RangeCoderInfo.range <<= 8; \ + } + +#define ENCODE_FAST(RANGE_WIDTH, RANGE_TOTAL, SHIFT) \ + NORMALIZE_RANGE_CODER \ + const int nTemp = m_RangeCoderInfo.range >> (SHIFT); \ + m_RangeCoderInfo.range = nTemp * (RANGE_WIDTH); \ + m_RangeCoderInfo.low += nTemp * (RANGE_TOTAL); + +#define ENCODE_DIRECT(VALUE, SHIFT) \ + NORMALIZE_RANGE_CODER \ + m_RangeCoderInfo.range = m_RangeCoderInfo.range >> (SHIFT); \ + m_RangeCoderInfo.low += m_RangeCoderInfo.range * (VALUE); + +/************************************************************************************ +Directly encode bits to the bitstream +************************************************************************************/ +int CBitArray::EncodeBits(unsigned int nValue, int nBits) +{ + // make sure there is room for the data + // this is a little slower than ensuring a huge block to start with, but it's safer + if (m_nCurrentBitIndex > REFILL_BIT_THRESHOLD) + { + RETURN_ON_ERROR(OutputBitArray()) + } + + ENCODE_DIRECT(nValue, nBits); + return 0; +} + +/************************************************************************************ +Encodes an unsigned int to the bit array (no rice coding) +************************************************************************************/ +int CBitArray::EncodeUnsignedLong(unsigned int n) +{ + // make sure there are at least 8 bytes in the buffer + if (m_nCurrentBitIndex > (BIT_ARRAY_BYTES - 8)) + { + RETURN_ON_ERROR(OutputBitArray()) + } + + // encode the value + uint32 nBitArrayIndex = m_nCurrentBitIndex >> 5; + int nBitIndex = m_nCurrentBitIndex & 31; + + if (nBitIndex == 0) + { + m_pBitArray[nBitArrayIndex] = n; + } + else + { + m_pBitArray[nBitArrayIndex] |= n >> nBitIndex; + m_pBitArray[nBitArrayIndex + 1] = n << (32 - nBitIndex); + } + + m_nCurrentBitIndex += 32; + + return 0; +} + +/************************************************************************************ +Advance to a byte boundary (for frame alignment) +************************************************************************************/ +void CBitArray::AdvanceToByteBoundary() +{ + while (m_nCurrentBitIndex % 8) + m_nCurrentBitIndex++; +} + +/************************************************************************************ +Encode a value +************************************************************************************/ +int CBitArray::EncodeValue(int nEncode, BIT_ARRAY_STATE & BitArrayState) +{ + // make sure there is room for the data + // this is a little slower than ensuring a huge block to start with, but it's safer + if (m_nCurrentBitIndex > REFILL_BIT_THRESHOLD) + { + RETURN_ON_ERROR(OutputBitArray()) + } + + // convert to unsigned + nEncode = (nEncode > 0) ? nEncode * 2 - 1 : -nEncode * 2; + + int nOriginalKSum = BitArrayState.nKSum; + + // get the working k + int nTempK = (BitArrayState.k) ? BitArrayState.k - 1 : 0; + + // update nKSum + BitArrayState.nKSum += ((nEncode + 1) / 2) - ((BitArrayState.nKSum + 16) >> 5); + + // update k + if (BitArrayState.nKSum < K_SUM_MIN_BOUNDARY[BitArrayState.k]) + BitArrayState.k--; + else if (BitArrayState.nKSum >= K_SUM_MIN_BOUNDARY[BitArrayState.k + 1]) + BitArrayState.k++; + + // figure the pivot value + int nPivotValue = max(nOriginalKSum / 32, 1); + int nOverflow = nEncode / nPivotValue; + int nBase = nEncode - (nOverflow * nPivotValue); + + // store the overflow + if (nOverflow < (MODEL_ELEMENTS - 1)) + { + ENCODE_FAST(RANGE_WIDTH[nOverflow], RANGE_TOTAL[nOverflow], RANGE_OVERFLOW_SHIFT); + + #ifdef BUILD_RANGE_TABLE + g_aryOverflows[nOverflow]++; + g_nTotalOverflow++; + #endif + } + else + { + // store the "special" overflow (tells that perfect k is encoded next) + ENCODE_FAST(RANGE_WIDTH[MODEL_ELEMENTS - 1], RANGE_TOTAL[MODEL_ELEMENTS - 1], RANGE_OVERFLOW_SHIFT); + + #ifdef BUILD_RANGE_TABLE + g_aryOverflows[MODEL_ELEMENTS - 1]++; + g_nTotalOverflow++; + #endif + + // code the overflow using straight bits + ENCODE_DIRECT((nOverflow >> 16) & 0xFFFF, 16); + ENCODE_DIRECT(nOverflow & 0xFFFF, 16); + } + + // code the base + { + if (nPivotValue >= (1 << 16)) + { + int nPivotValueBits = 0; + while ((nPivotValue >> nPivotValueBits) > 0) { nPivotValueBits++; } + int nSplitFactor = 1 << (nPivotValueBits - 16); + + // we know that base is smaller than pivot coming into this + // however, after we divide both by an integer, they could be the same + // we account by adding one to the pivot, but this hurts compression + // by (1 / nSplitFactor) -- therefore we maximize the split factor + // that gets one added to it + + // encode the pivot as two pieces + int nPivotValueA = (nPivotValue / nSplitFactor) + 1; + int nPivotValueB = nSplitFactor; + + int nBaseA = nBase / nSplitFactor; + int nBaseB = nBase % nSplitFactor; + + { + NORMALIZE_RANGE_CODER + const int nTemp = m_RangeCoderInfo.range / nPivotValueA; + m_RangeCoderInfo.range = nTemp; + m_RangeCoderInfo.low += nTemp * nBaseA; + } + + { + NORMALIZE_RANGE_CODER + const int nTemp = m_RangeCoderInfo.range / nPivotValueB; + m_RangeCoderInfo.range = nTemp; + m_RangeCoderInfo.low += nTemp * nBaseB; + } + } + else + { + + NORMALIZE_RANGE_CODER + const int nTemp = m_RangeCoderInfo.range / nPivotValue; + m_RangeCoderInfo.range = nTemp; + m_RangeCoderInfo.low += nTemp * nBase; + } + } + + return 0; +} + +/************************************************************************************ +Flush +************************************************************************************/ +void CBitArray::FlushBitArray() +{ + // advance to a byte boundary (for alignment) + AdvanceToByteBoundary(); + + // the range coder + m_RangeCoderInfo.low = 0; // full code range + m_RangeCoderInfo.range = TOP_VALUE; + m_RangeCoderInfo.buffer = 0; + m_RangeCoderInfo.help = 0; // no bytes to follow +} + +void CBitArray::FlushState(BIT_ARRAY_STATE & BitArrayState) +{ + // k and ksum + BitArrayState.k = 10; + BitArrayState.nKSum = (1 << BitArrayState.k) * 16; +} + +/************************************************************************************ +Finalize +************************************************************************************/ +void CBitArray::Finalize() +{ + NORMALIZE_RANGE_CODER + + unsigned int nTemp = (m_RangeCoderInfo.low >> SHIFT_BITS) + 1; + + if (nTemp > 0xFF) // we have a carry + { + PUTC(m_RangeCoderInfo.buffer + 1); + for ( ; m_RangeCoderInfo.help; m_RangeCoderInfo.help--) + { + PUTC(0); + } + } + else // no carry + { + PUTC(m_RangeCoderInfo.buffer); + for ( ; m_RangeCoderInfo.help; m_RangeCoderInfo.help--) + { + PUTC(((unsigned char) 0xFF)); + } + } + + // we must output these bytes so the decoder can properly work at the end of the stream + PUTC(nTemp & 0xFF); + PUTC(0); + PUTC(0); + PUTC(0); +} + +/************************************************************************************ +Build a range table (for development / debugging) +************************************************************************************/ +#ifdef BUILD_RANGE_TABLE +void CBitArray::OutputRangeTable() +{ + int z; + + if (g_nTotalOverflow == 0) return; + + int nTotal = 0; + int aryWidth[256]; ZeroMemory(aryWidth, 256 * 4); + for (z = 0; z < MODEL_ELEMENTS; z++) + { + aryWidth[z] = int(((float(g_aryOverflows[z]) * float(65536)) + (g_nTotalOverflow / 2)) / float(g_nTotalOverflow)); + if (aryWidth[z] == 0) aryWidth[z] = 1; + nTotal += aryWidth[z]; + } + + z = 0; + while (nTotal > 65536) + { + if (aryWidth[z] != 1) + { + aryWidth[z]--; + nTotal--; + } + z++; + if (z == MODEL_ELEMENTS) z = 0; + } + + z = 0; + while (nTotal < 65536) + { + aryWidth[z++]++; + nTotal++; + if (z == MODEL_ELEMENTS) z = 0; + } + + int aryTotal[256]; ZeroMemory(aryTotal, 256 * 4); + for (z = 0; z < MODEL_ELEMENTS; z++) + { + for (int q = 0; q < z; q++) + { + aryTotal[z] += aryWidth[q]; + } + } + + TCHAR buf[1024]; + _stprintf(buf, _T("const uint32 RANGE_TOTAL[%d] = {"), MODEL_ELEMENTS); + ODS(buf); + for (z = 0; z < MODEL_ELEMENTS; z++) + { + _stprintf(buf, _T("%d,"), aryTotal[z]); + OutputDebugString(buf); + } + ODS(_T("};\n")); + + _stprintf(buf, _T("const uint32 RANGE_WIDTH[%d] = {"), MODEL_ELEMENTS); + ODS(buf); + for (z = 0; z < MODEL_ELEMENTS; z++) + { + _stprintf(buf, _T("%d,"), aryWidth[z]); + OutputDebugString(buf); + } + ODS(_T("};\n\n")); +} +#endif // #ifdef BUILD_RANGE_TABLE diff --git a/Libraries/MAC/Files/Source/MACLib/BitArray.h b/Libraries/MAC/Files/Source/MACLib/BitArray.h new file mode 100755 index 000000000..854bb31ee --- /dev/null +++ b/Libraries/MAC/Files/Source/MACLib/BitArray.h @@ -0,0 +1,62 @@ +#ifndef APE_BITARRAY_H +#define APE_BITARRAY_H + +#include "IO.h" +#include "MD5.h" + +//#define BUILD_RANGE_TABLE + +struct RANGE_CODER_STRUCT_COMPRESS +{ + unsigned int low; // low end of interval + unsigned int range; // length of interval + unsigned int help; // bytes_to_follow resp. intermediate value + unsigned char buffer; // buffer for input / output +}; + +struct BIT_ARRAY_STATE +{ + uint32 k; + uint32 nKSum; +}; + +class CBitArray +{ +public: + + // construction / destruction + CBitArray(CIO *pIO); + ~CBitArray(); + + // encoding + int EncodeUnsignedLong(unsigned int n); + int EncodeValue(int nEncode, BIT_ARRAY_STATE & BitArrayState); + int EncodeBits(unsigned int nValue, int nBits); + + // output (saving) + int OutputBitArray(BOOL bFinalize = FALSE); + + // other functions + void Finalize(); + void AdvanceToByteBoundary(); + inline uint32 GetCurrentBitIndex() { return m_nCurrentBitIndex; } + void FlushState(BIT_ARRAY_STATE & BitArrayState); + void FlushBitArray(); + inline CMD5Helper & GetMD5Helper() { return m_MD5; } + +private: + + // data members + uint32 * m_pBitArray; + CIO * m_pIO; + uint32 m_nCurrentBitIndex; + RANGE_CODER_STRUCT_COMPRESS m_RangeCoderInfo; + CMD5Helper m_MD5; + +#ifdef BUILD_RANGE_TABLE + void OutputRangeTable(); +#endif + +}; + +#endif // #ifndef APE_BITARRAY_H diff --git a/Libraries/MAC/Files/Source/MACLib/MACLib.cpp b/Libraries/MAC/Files/Source/MACLib/MACLib.cpp new file mode 100755 index 000000000..5bf1fb3ed --- /dev/null +++ b/Libraries/MAC/Files/Source/MACLib/MACLib.cpp @@ -0,0 +1,159 @@ +#include "All.h" +#include "MACLib.h" + +#include "APECompress.h" +#include "APECompressCreate.h" +#include "APECompressCore.h" +#include "APECompress.h" +#include "APEDecompress.h" +#include "APEInfo.h" +#include "APELink.h" +#include "CharacterHelper.h" + +#ifdef BACKWARDS_COMPATIBILITY + #include "Old/APEDecompressOld.h" +#endif + +IAPEDecompress * CreateIAPEDecompressCore(CAPEInfo * pAPEInfo, int nStartBlock, int nFinishBlock, int * pErrorCode) +{ + IAPEDecompress * pAPEDecompress = NULL; + if (pAPEInfo != NULL && *pErrorCode == ERROR_SUCCESS) + { + try + { + if (pAPEInfo->GetInfo(APE_INFO_FILE_VERSION) >= 3930) + pAPEDecompress = new CAPEDecompress(pErrorCode, pAPEInfo, nStartBlock, nFinishBlock); +#ifdef BACKWARDS_COMPATIBILITY + else + pAPEDecompress = new CAPEDecompressOld(pErrorCode, pAPEInfo, nStartBlock, nFinishBlock); +#endif + + if (pAPEDecompress == NULL || *pErrorCode != ERROR_SUCCESS) + { + SAFE_DELETE(pAPEDecompress) + } + } + catch(...) + { + SAFE_DELETE(pAPEDecompress) + *pErrorCode = ERROR_UNDEFINED; + } + } + + return pAPEDecompress; +} + +IAPEDecompress * __stdcall CreateIAPEDecompress(const char * pFilename, int * pErrorCode) +{ + // error check the parameters + if ((pFilename == NULL) || (strlen(pFilename) == 0)) + { + if (pErrorCode) *pErrorCode = ERROR_BAD_PARAMETER; + return NULL; + } + + // variables + int nErrorCode = ERROR_UNDEFINED; + CAPEInfo * pAPEInfo = NULL; + int nStartBlock = -1; int nFinishBlock = -1; + + // get the extension + const char * pExtension = &pFilename[strlen(pFilename)]; + while ((pExtension > pFilename) && (*pExtension != '.')) + pExtension--; + + // take the appropriate action (based on the extension) + if (strcasecmp(pExtension, ".apl") == 0) + { + // "link" file (.apl linked large APE file) + CAPELink APELink(pFilename); + if (APELink.GetIsLinkFile()) + { + pAPEInfo = new CAPEInfo(&nErrorCode, GetANSIFromUTF16(APELink.GetImageFilename()), new CAPETag(pFilename, TRUE)); + nStartBlock = APELink.GetStartBlock(); nFinishBlock = APELink.GetFinishBlock(); + } + } + else if ((strcasecmp(pExtension, ".mac") == 0) || (strcasecmp(pExtension, ".ape") == 0)) + { + // plain .ape file + pAPEInfo = new CAPEInfo(&nErrorCode, pFilename); + } + + // fail if we couldn't get the file information + if (pAPEInfo == NULL) + { + if (pErrorCode) *pErrorCode = ERROR_INVALID_INPUT_FILE; + return NULL; + } + // create and return + IAPEDecompress * pAPEDecompress = CreateIAPEDecompressCore(pAPEInfo, nStartBlock, nFinishBlock, &nErrorCode); + if (pErrorCode) { + *pErrorCode = nErrorCode; + } + return pAPEDecompress; +} + +IAPEDecompress * __stdcall CreateIAPEDecompressEx(CIO * pIO, int * pErrorCode) +{ + int nErrorCode = ERROR_UNDEFINED; + CAPEInfo * pAPEInfo = new CAPEInfo(&nErrorCode, pIO); + IAPEDecompress * pAPEDecompress = CreateIAPEDecompressCore(pAPEInfo, -1, -1, &nErrorCode); + if (pErrorCode) *pErrorCode = nErrorCode; + return pAPEDecompress; +} + + +IAPEDecompress * __stdcall CreateIAPEDecompressEx2(CAPEInfo * pAPEInfo, int nStartBlock, int nFinishBlock, int * pErrorCode) +{ + int nErrorCode = ERROR_SUCCESS; + IAPEDecompress * pAPEDecompress = CreateIAPEDecompressCore(pAPEInfo, nStartBlock, nFinishBlock, &nErrorCode); + if (pErrorCode) *pErrorCode = nErrorCode; + return pAPEDecompress; +} + +IAPECompress * __stdcall CreateIAPECompress(int * pErrorCode) +{ + if (pErrorCode) + *pErrorCode = ERROR_SUCCESS; + + return new CAPECompress(); +} + +int __stdcall FillWaveFormatEx(WAVEFORMATEX * pWaveFormatEx, int nSampleRate, int nBitsPerSample, int nChannels) +{ + pWaveFormatEx->cbSize = 0; + pWaveFormatEx->nSamplesPerSec = nSampleRate; + pWaveFormatEx->wBitsPerSample = nBitsPerSample; + pWaveFormatEx->nChannels = nChannels; + pWaveFormatEx->wFormatTag = 1; + + pWaveFormatEx->nBlockAlign = (pWaveFormatEx->wBitsPerSample / 8) * pWaveFormatEx->nChannels; + pWaveFormatEx->nAvgBytesPerSec = pWaveFormatEx->nBlockAlign * pWaveFormatEx->nSamplesPerSec; + + return ERROR_SUCCESS; +} + +int __stdcall FillWaveHeader(WAVE_HEADER * pWAVHeader, int nAudioBytes, WAVEFORMATEX * pWaveFormatEx, int nTerminatingBytes) +{ + try + { + // RIFF header + memcpy(pWAVHeader->cRIFFHeader, "RIFF", 4); + pWAVHeader->nRIFFBytes = (nAudioBytes + 44) - 8 + nTerminatingBytes; + + // format header + memcpy(pWAVHeader->cDataTypeID, "WAVE", 4); + memcpy(pWAVHeader->cFormatHeader, "fmt ", 4); + + // the format chunk is the first 16 bytes of a waveformatex + pWAVHeader->nFormatBytes = 16; + memcpy(&pWAVHeader->nFormatTag, pWaveFormatEx, 16); + + // the data header + memcpy(pWAVHeader->cDataHeader, "data", 4); + pWAVHeader->nDataBytes = nAudioBytes; + + return ERROR_SUCCESS; + } + catch(...) { return ERROR_UNDEFINED; } +} \ No newline at end of file diff --git a/Libraries/MAC/Files/Source/MACLib/MACLib.h b/Libraries/MAC/Files/Source/MACLib/MACLib.h new file mode 100755 index 000000000..2061f4d83 --- /dev/null +++ b/Libraries/MAC/Files/Source/MACLib/MACLib.h @@ -0,0 +1,451 @@ +/***************************************************************************************** +Monkey's Audio MACLib.h (include for using MACLib.lib in your projects) +Copyright (C) 2000-2003 by Matthew T. Ashland All Rights Reserved. + +Overview: + +There are two main interfaces... create one (using CreateIAPExxx) and go to town: + + IAPECompress - for creating APE files + IAPEDecompress - for decompressing and analyzing APE files + +Note(s): + +Unless otherwise specified, functions return ERROR_SUCCESS (0) on success and an +error code on failure. + +The terminology "Sample" refers to a single sample value, and "Block" refers +to a collection of "Channel" samples. For simplicity, MAC typically uses blocks +everywhere so that channel mis-alignment cannot happen. (i.e. on a CD, a sample is +2 bytes and a block is 4 bytes ([2 bytes per sample] * [2 channels] = 4 bytes)) + +Questions / Suggestions: + +Please direct questions or comments to the Monkey's Audio developers board: +http://www.monkeysaudio.com/cgi-bin/YaBB/YaBB.cgi -> Developers +or, if necessary, matt @ monkeysaudio.com +*****************************************************************************************/ + +#ifndef APE_MACLIB_H +#define APE_MACLIB_H + +/************************************************************************************************* +APE File Format Overview: (pieces in order -- only valid for the latest version APE files) + + JUNK - any amount of "junk" before the APE_DESCRIPTOR (so people that put ID3v2 tags on the files aren't hosed) + APE_DESCRIPTOR - defines the sizes (and offsets) of all the pieces, as well as the MD5 checksum + APE_HEADER - describes all of the necessary information about the APE file + SEEK TABLE - the table that represents seek offsets [optional] + HEADER DATA - the pre-audio data from the original file [optional] + APE FRAMES - the actual compressed audio (broken into frames for seekability) + TERMINATING DATA - the post-audio data from the original file [optional] + TAG - describes all the properties of the file [optional] + +Notes: + + Junk: + + This block may not be supported in the future, so don't write any software that adds meta data + before the APE_DESCRIPTOR. Please use the APE Tag for any meta data. + + Seek Table: + + A 32-bit unsigned integer array of offsets from the header to the frame data. May become "delta" + values someday to better suit huge files. + + MD5 Hash: + + Since the header is the last part written to an APE file, you must calculate the MD5 checksum out of order. + So, you first calculate from the tail of the seek table to the end of the terminating data. + Then, go back and do from the end of the descriptor to the tail of the seek table. + You may wish to just cache the header data when starting and run it last, so you don't + need to seek back in the I/O. +*************************************************************************************************/ + +/***************************************************************************************** +Defines +*****************************************************************************************/ +#define COMPRESSION_LEVEL_FAST 1000 +#define COMPRESSION_LEVEL_NORMAL 2000 +#define COMPRESSION_LEVEL_HIGH 3000 +#define COMPRESSION_LEVEL_EXTRA_HIGH 4000 +#define COMPRESSION_LEVEL_INSANE 5000 + +#define MAC_FORMAT_FLAG_8_BIT 1 // is 8-bit [OBSOLETE] +#define MAC_FORMAT_FLAG_CRC 2 // uses the new CRC32 error detection [OBSOLETE] +#define MAC_FORMAT_FLAG_HAS_PEAK_LEVEL 4 // uint32 nPeakLevel after the header [OBSOLETE] +#define MAC_FORMAT_FLAG_24_BIT 8 // is 24-bit [OBSOLETE] +#define MAC_FORMAT_FLAG_HAS_SEEK_ELEMENTS 16 // has the number of seek elements after the peak level +#define MAC_FORMAT_FLAG_CREATE_WAV_HEADER 32 // create the wave header on decompression (not stored) + +#define CREATE_WAV_HEADER_ON_DECOMPRESSION -1 +#define MAX_AUDIO_BYTES_UNKNOWN -1 + +typedef void (__stdcall * APE_PROGRESS_CALLBACK) (int); + +/***************************************************************************************** +WAV header structure +*****************************************************************************************/ +struct WAVE_HEADER +{ + // RIFF header + char cRIFFHeader[4]; + unsigned int nRIFFBytes; + + // data type + char cDataTypeID[4]; + + // wave format + char cFormatHeader[4]; + unsigned int nFormatBytes; + + unsigned short nFormatTag; + unsigned short nChannels; + unsigned int nSamplesPerSec; + unsigned int nAvgBytesPerSec; + unsigned short nBlockAlign; + unsigned short nBitsPerSample; + + // data chunk header + char cDataHeader[4]; + unsigned int nDataBytes; +}; + +/***************************************************************************************** +APE_DESCRIPTOR structure (file header that describes lengths, offsets, etc.) +*****************************************************************************************/ +struct APE_DESCRIPTOR +{ + char cID[4]; // should equal 'MAC ' + uint32 nVersion; // version number * 1000 (3.81 = 3810) + + uint32 nDescriptorBytes; // the number of descriptor bytes (allows later expansion of this header) + uint32 nHeaderBytes; // the number of header APE_HEADER bytes + uint32 nSeekTableBytes; // the number of bytes of the seek table + uint32 nHeaderDataBytes; // the number of header data bytes (from original file) + uint32 nAPEFrameDataBytes; // the number of bytes of APE frame data + uint32 nAPEFrameDataBytesHigh; // the high order number of APE frame data bytes + uint32 nTerminatingDataBytes; // the terminating data of the file (not including tag data) + + uint8 cFileMD5[16]; // the MD5 hash of the file (see notes for usage... it's a littly tricky) +}; + +/***************************************************************************************** +APE_HEADER structure (describes the format, duration, etc. of the APE file) +*****************************************************************************************/ +struct APE_HEADER +{ + uint16 nCompressionLevel; // the compression level (see defines I.E. COMPRESSION_LEVEL_FAST) + uint16 nFormatFlags; // any format flags (for future use) + + uint32 nBlocksPerFrame; // the number of audio blocks in one frame + uint32 nFinalFrameBlocks; // the number of audio blocks in the final frame + uint32 nTotalFrames; // the total number of frames + + uint16 nBitsPerSample; // the bits per sample (typically 16) + uint16 nChannels; // the number of channels (1 or 2) + uint32 nSampleRate; // the sample rate (typically 44100) +}; + +/************************************************************************************************* +Classes (fully defined elsewhere) +*************************************************************************************************/ +class CIO; +class CInputSource; +class CAPEInfo; + +/************************************************************************************************* +IAPEDecompress fields - used when querying for information + +Note(s): +-the distinction between APE_INFO_XXXX and APE_DECOMPRESS_XXXX is that the first is querying the APE +information engine, and the other is querying the decompressor, and since the decompressor can be +a range of an APE file (for APL), differences will arise. Typically, use the APE_DECOMPRESS_XXXX +fields when querying for info about the length, etc. so APL will work properly. +(i.e. (APE_INFO_TOTAL_BLOCKS != APE_DECOMPRESS_TOTAL_BLOCKS) for APL files) +*************************************************************************************************/ +enum APE_DECOMPRESS_FIELDS +{ + APE_INFO_FILE_VERSION = 1000, // version of the APE file * 1000 (3.93 = 3930) [ignored, ignored] + APE_INFO_COMPRESSION_LEVEL = 1001, // compression level of the APE file [ignored, ignored] + APE_INFO_FORMAT_FLAGS = 1002, // format flags of the APE file [ignored, ignored] + APE_INFO_SAMPLE_RATE = 1003, // sample rate (Hz) [ignored, ignored] + APE_INFO_BITS_PER_SAMPLE = 1004, // bits per sample [ignored, ignored] + APE_INFO_BYTES_PER_SAMPLE = 1005, // number of bytes per sample [ignored, ignored] + APE_INFO_CHANNELS = 1006, // channels [ignored, ignored] + APE_INFO_BLOCK_ALIGN = 1007, // block alignment [ignored, ignored] + APE_INFO_BLOCKS_PER_FRAME = 1008, // number of blocks in a frame (frames are used internally) [ignored, ignored] + APE_INFO_FINAL_FRAME_BLOCKS = 1009, // blocks in the final frame (frames are used internally) [ignored, ignored] + APE_INFO_TOTAL_FRAMES = 1010, // total number frames (frames are used internally) [ignored, ignored] + APE_INFO_WAV_HEADER_BYTES = 1011, // header bytes of the decompressed WAV [ignored, ignored] + APE_INFO_WAV_TERMINATING_BYTES = 1012, // terminating bytes of the decompressed WAV [ignored, ignored] + APE_INFO_WAV_DATA_BYTES = 1013, // data bytes of the decompressed WAV [ignored, ignored] + APE_INFO_WAV_TOTAL_BYTES = 1014, // total bytes of the decompressed WAV [ignored, ignored] + APE_INFO_APE_TOTAL_BYTES = 1015, // total bytes of the APE file [ignored, ignored] + APE_INFO_TOTAL_BLOCKS = 1016, // total blocks of audio data [ignored, ignored] + APE_INFO_LENGTH_MS = 1017, // length in ms (1 sec = 1000 ms) [ignored, ignored] + APE_INFO_AVERAGE_BITRATE = 1018, // average bitrate of the APE [ignored, ignored] + APE_INFO_FRAME_BITRATE = 1019, // bitrate of specified APE frame [frame index, ignored] + APE_INFO_DECOMPRESSED_BITRATE = 1020, // bitrate of the decompressed WAV [ignored, ignored] + APE_INFO_PEAK_LEVEL = 1021, // peak audio level (obsolete) (-1 is unknown) [ignored, ignored] + APE_INFO_SEEK_BIT = 1022, // bit offset [frame index, ignored] + APE_INFO_SEEK_BYTE = 1023, // byte offset [frame index, ignored] + APE_INFO_WAV_HEADER_DATA = 1024, // error code [buffer *, max bytes] + APE_INFO_WAV_TERMINATING_DATA = 1025, // error code [buffer *, max bytes] + APE_INFO_WAVEFORMATEX = 1026, // error code [waveformatex *, ignored] + APE_INFO_IO_SOURCE = 1027, // I/O source (CIO *) [ignored, ignored] + APE_INFO_FRAME_BYTES = 1028, // bytes (compressed) of the frame [frame index, ignored] + APE_INFO_FRAME_BLOCKS = 1029, // blocks in a given frame [frame index, ignored] + APE_INFO_TAG = 1030, // point to tag (CAPETag *) [ignored, ignored] + + APE_DECOMPRESS_CURRENT_BLOCK = 2000, // current block location [ignored, ignored] + APE_DECOMPRESS_CURRENT_MS = 2001, // current millisecond location [ignored, ignored] + APE_DECOMPRESS_TOTAL_BLOCKS = 2002, // total blocks in the decompressors range [ignored, ignored] + APE_DECOMPRESS_LENGTH_MS = 2003, // total blocks in the decompressors range [ignored, ignored] + APE_DECOMPRESS_CURRENT_BITRATE = 2004, // current bitrate [ignored, ignored] + APE_DECOMPRESS_AVERAGE_BITRATE = 2005, // average bitrate (works with ranges) [ignored, ignored] + + APE_INTERNAL_INFO = 3000, // for internal use -- don't use (returns APE_FILE_INFO *) [ignored, ignored] +}; + +/************************************************************************************************* +IAPEDecompress - interface for working with existing APE files (decoding, seeking, analyzing, etc.) +*************************************************************************************************/ +class IAPEDecompress +{ +public: + + // destructor (needed so implementation's destructor will be called) + virtual ~IAPEDecompress() {} + + /********************************************************************************************* + * Decompress / Seek + *********************************************************************************************/ + + ////////////////////////////////////////////////////////////////////////////////////////////// + // GetData(...) - gets raw decompressed audio + // + // Parameters: + // char * pBuffer + // a pointer to a buffer to put the data into + // int nBlocks + // the number of audio blocks desired (see note at intro about blocks vs. samples) + // int * pBlocksRetrieved + // the number of blocks actually retrieved (could be less at end of file or on critical failure) + ////////////////////////////////////////////////////////////////////////////////////////////// + virtual int GetData(char * pBuffer, int nBlocks, int * pBlocksRetrieved) = 0; + + ////////////////////////////////////////////////////////////////////////////////////////////// + // Seek(...) - seeks + // + // Parameters: + // int nBlockOffset + // the block to seek to (see note at intro about blocks vs. samples) + ////////////////////////////////////////////////////////////////////////////////////////////// + virtual int Seek(int nBlockOffset) = 0; + + /********************************************************************************************* + * Get Information + *********************************************************************************************/ + + ////////////////////////////////////////////////////////////////////////////////////////////// + // GetInfo(...) - get information about the APE file or the state of the decompressor + // + // Parameters: + // APE_DECOMPRESS_FIELDS Field + // the field we're querying (see APE_DECOMPRESS_FIELDS above for more info) + // int nParam1 + // generic parameter... usage is listed in APE_DECOMPRESS_FIELDS + // int nParam2 + // generic parameter... usage is listed in APE_DECOMPRESS_FIELDS + ////////////////////////////////////////////////////////////////////////////////////////////// + virtual int GetInfo(APE_DECOMPRESS_FIELDS Field, int nParam1 = 0, int nParam2 = 0) = 0; +}; + +/************************************************************************************************* +IAPECompress - interface for creating APE files + +Usage: + + To create an APE file, you Start(...), then add data (in a variety of ways), then Finish(...) +*************************************************************************************************/ +class IAPECompress +{ +public: + + // destructor (needed so implementation's destructor will be called) + virtual ~IAPECompress() {} + + /********************************************************************************************* + * Start + *********************************************************************************************/ + + ////////////////////////////////////////////////////////////////////////////////////////////// + // Start(...) / StartEx(...) - starts encoding + // + // Parameters: + // CIO * pioOutput / const str_utf16 * pFilename + // the output... either a filename or an I/O source + // WAVEFORMATEX * pwfeInput + // format of the audio to encode (use FillWaveFormatEx() if necessary) + // int nMaxAudioBytes + // the absolute maximum audio bytes that will be encoded... encoding fails with a + // ERROR_APE_COMPRESS_TOO_MUCH_DATA if you attempt to encode more than specified here + // (if unknown, use MAX_AUDIO_BYTES_UNKNOWN to allocate as much storage in the seek table as + // possible... limit is then 2 GB of data (~4 hours of CD music)... this wastes around + // 30kb, so only do it if completely necessary) + // int nCompressionLevel + // the compression level for the APE file (fast - extra high) + // (note: extra-high is much slower for little gain) + // const void * pHeaderData + // a pointer to a buffer containing the WAV header (data before the data block in the WAV) + // (note: use NULL for on-the-fly encoding... see next parameter) + // int nHeaderBytes + // number of bytes in the header data buffer (use CREATE_WAV_HEADER_ON_DECOMPRESSION and + // NULL for the pHeaderData and MAC will automatically create the appropriate WAV header + // on decompression) + ////////////////////////////////////////////////////////////////////////////////////////////// + + virtual int Start(const char * pOutputFilename, const WAVEFORMATEX * pwfeInput, + int nMaxAudioBytes = MAX_AUDIO_BYTES_UNKNOWN, int nCompressionLevel = COMPRESSION_LEVEL_NORMAL, + const void * pHeaderData = NULL, int nHeaderBytes = CREATE_WAV_HEADER_ON_DECOMPRESSION) = 0; + + virtual int StartEx(CIO * pioOutput, const WAVEFORMATEX * pwfeInput, + int nMaxAudioBytes = MAX_AUDIO_BYTES_UNKNOWN, int nCompressionLevel = COMPRESSION_LEVEL_NORMAL, + const void * pHeaderData = NULL, int nHeaderBytes = CREATE_WAV_HEADER_ON_DECOMPRESSION) = 0; + + /********************************************************************************************* + * Add / Compress Data + * - there are 3 ways to add data: + * 1) simple call AddData(...) + * 2) lock MAC's buffer, copy into it, and unlock (LockBuffer(...) / UnlockBuffer(...)) + * 3) from an I/O source (AddDataFromInputSource(...)) + *********************************************************************************************/ + + ////////////////////////////////////////////////////////////////////////////////////////////// + // AddData(...) - adds data to the encoder + // + // Parameters: + // unsigned char * pData + // a pointer to a buffer containing the raw audio data + // int nBytes + // the number of bytes in the buffer + ////////////////////////////////////////////////////////////////////////////////////////////// + virtual int AddData(unsigned char * pData, int nBytes) = 0; + + ////////////////////////////////////////////////////////////////////////////////////////////// + // GetBufferBytesAvailable(...) - returns the number of bytes available in the buffer + // (helpful when locking) + ////////////////////////////////////////////////////////////////////////////////////////////// + virtual int GetBufferBytesAvailable() = 0; + + ////////////////////////////////////////////////////////////////////////////////////////////// + // LockBuffer(...) - locks MAC's buffer so we can copy into it + // + // Parameters: + // int * pBytesAvailable + // returns the number of bytes available in the buffer (DO NOT COPY MORE THAN THIS IN) + // + // Return: + // pointer to the buffer (add at that location) + ////////////////////////////////////////////////////////////////////////////////////////////// + virtual unsigned char * LockBuffer(int * pBytesAvailable) = 0; + + ////////////////////////////////////////////////////////////////////////////////////////////// + // UnlockBuffer(...) - releases the buffer + // + // Parameters: + // int nBytesAdded + // the number of bytes copied into the buffer + // BOOL bProcess + // whether MAC should process as much as possible of the buffer + ////////////////////////////////////////////////////////////////////////////////////////////// + virtual int UnlockBuffer(int nBytesAdded, BOOL bProcess = TRUE) = 0; + + + ////////////////////////////////////////////////////////////////////////////////////////////// + // AddDataFromInputSource(...) - use a CInputSource (input source) to add data + // + // Parameters: + // CInputSource * pInputSource + // a pointer to the input source + // int nMaxBytes + // the maximum number of bytes to let MAC add (-1 if MAC can add any amount) + // int * pBytesAdded + // returns the number of bytes added from the I/O source + ////////////////////////////////////////////////////////////////////////////////////////////// + virtual int AddDataFromInputSource(CInputSource * pInputSource, int nMaxBytes = -1, int * pBytesAdded = NULL) = 0; + + /********************************************************************************************* + * Finish / Kill + *********************************************************************************************/ + + ////////////////////////////////////////////////////////////////////////////////////////////// + // Finish(...) - ends encoding and finalizes the file + // + // Parameters: + // unsigned char * pTerminatingData + // a pointer to a buffer containing the information to place at the end of the APE file + // (comprised of the WAV terminating data (data after the data block in the WAV) followed + // by any tag information) + // int nTerminatingBytes + // number of bytes in the terminating data buffer + // int nWAVTerminatingBytes + // the number of bytes of the terminating data buffer that should be appended to a decoded + // WAV file (it's basically nTerminatingBytes - the bytes that make up the tag) + ////////////////////////////////////////////////////////////////////////////////////////////// + virtual int Finish(unsigned char * pTerminatingData, int nTerminatingBytes, int nWAVTerminatingBytes) = 0; + + ////////////////////////////////////////////////////////////////////////////////////////////// + // Kill(...) - stops encoding and deletes the output file + // --- NOT CURRENTLY IMPLEMENTED --- + ////////////////////////////////////////////////////////////////////////////////////////////// + virtual int Kill() = 0; +}; + +/************************************************************************************************* +Functions to create the interfaces + +Usage: + Interface creation returns a NULL pointer on failure (and fills error code if it was passed in) + +Usage example: + int nErrorCode; + IAPEDecompress * pAPEDecompress = CreateIAPEDecompress("c:\\1.ape", &nErrorCode); + if (pAPEDecompress == NULL) + { + // failure... nErrorCode will have specific code + } + +*************************************************************************************************/ +extern "C" +{ + IAPEDecompress * __stdcall CreateIAPEDecompress(const char * pFilename, int * pErrorCode = NULL); + IAPEDecompress * __stdcall CreateIAPEDecompressEx(CIO * pIO, int * pErrorCode = NULL); + IAPEDecompress * __stdcall CreateIAPEDecompressEx2(CAPEInfo * pAPEInfo, int nStartBlock = -1, int nFinishBlock = -1, int * pErrorCode = NULL); + IAPECompress * __stdcall CreateIAPECompress(int * pErrorCode = NULL); +} + +/************************************************************************************************* +Simple functions - see the SDK sample projects for usage examples +*************************************************************************************************/ +extern "C" +{ + // process whole files + DLLEXPORT int __stdcall CompressFile(const str_ansi * pInputFilename, const str_ansi * pOutputFilename, int nCompressionLevel = COMPRESSION_LEVEL_NORMAL, int * pPercentageDone = NULL, APE_PROGRESS_CALLBACK ProgressCallback = 0, int * pKillFlag = NULL); + DLLEXPORT int __stdcall DecompressFile(const str_ansi * pInputFilename, const str_ansi * pOutputFilename, int * pPercentageDone, APE_PROGRESS_CALLBACK ProgressCallback, int * pKillFlag); + DLLEXPORT int __stdcall ConvertFile(const str_ansi * pInputFilename, const str_ansi * pOutputFilename, int nCompressionLevel, int * pPercentageDone, APE_PROGRESS_CALLBACK ProgressCallback, int * pKillFlag); + DLLEXPORT int __stdcall VerifyFile(const str_ansi * pInputFilename, int * pPercentageDone, APE_PROGRESS_CALLBACK ProgressCallback, int * pKillFlag, BOOL bQuickVerifyIfPossible = FALSE); + +/* + DLLEXPORT int __stdcall CompressFileW(const str_utf16 * pInputFilename, const str_utf16 * pOutputFilename, int nCompressionLevel = COMPRESSION_LEVEL_NORMAL, int * pPercentageDone = NULL, APE_PROGRESS_CALLBACK ProgressCallback = 0, int * pKillFlag = NULL); + DLLEXPORT int __stdcall DecompressFileW(const str_utf16 * pInputFilename, const str_utf16 * pOutputFilename, int * pPercentageDone, APE_PROGRESS_CALLBACK ProgressCallback, int * pKillFlag); + DLLEXPORT int __stdcall ConvertFileW(const str_utf16 * pInputFilename, const str_utf16 * pOutputFilename, int nCompressionLevel, int * pPercentageDone, APE_PROGRESS_CALLBACK ProgressCallback, int * pKillFlag); + DLLEXPORT int __stdcall VerifyFileW(const str_utf16 * pInputFilename, int * pPercentageDone, APE_PROGRESS_CALLBACK ProgressCallback, int * pKillFlag, BOOL bQuickVerifyIfPossible = FALSE); +*/ + // helper functions + DLLEXPORT int __stdcall FillWaveFormatEx(WAVEFORMATEX * pWaveFormatEx, int nSampleRate = 44100, int nBitsPerSample = 16, int nChannels = 2); + DLLEXPORT int __stdcall FillWaveHeader(WAVE_HEADER * pWAVHeader, int nAudioBytes, WAVEFORMATEX * pWaveFormatEx, int nTerminatingBytes = 0); +} + +#endif // #ifndef APE_MACLIB_H diff --git a/Libraries/MAC/Files/Source/MACLib/MACLib.vcproj b/Libraries/MAC/Files/Source/MACLib/MACLib.vcproj new file mode 100755 index 000000000..8b76fe946 --- /dev/null +++ b/Libraries/MAC/Files/Source/MACLib/MACLib.vcproj @@ -0,0 +1,1019 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Libraries/MAC/Files/Source/MACLib/MACProgressHelper.cpp b/Libraries/MAC/Files/Source/MACLib/MACProgressHelper.cpp new file mode 100755 index 000000000..acb6c745c --- /dev/null +++ b/Libraries/MAC/Files/Source/MACLib/MACProgressHelper.cpp @@ -0,0 +1,82 @@ +#include "All.h" +#include "MACProgressHelper.h" + +CMACProgressHelper::CMACProgressHelper(int nTotalSteps, int * pPercentageDone, APE_PROGRESS_CALLBACK ProgressCallback, int * pKillFlag) +{ + m_pKillFlag = pKillFlag; + + m_bUseCallback = FALSE; + if (ProgressCallback != NULL) + { + m_bUseCallback = TRUE; + m_CallbackFunction = ProgressCallback; + } + + m_pPercentageDone = pPercentageDone; + + m_nTotalSteps = nTotalSteps; + m_nCurrentStep = 0; + m_nLastCallbackFiredPercentageDone = 0; + + UpdateProgress(0); +} + +CMACProgressHelper::~CMACProgressHelper() +{ + +} + +void CMACProgressHelper::UpdateProgress(int nCurrentStep, BOOL bForceUpdate) +{ + // update the step + if (nCurrentStep == -1) + m_nCurrentStep++; + else + m_nCurrentStep = nCurrentStep; + + // figure the percentage done + float fPercentageDone = float(m_nCurrentStep) / float(max(m_nTotalSteps, 1)); + int nPercentageDone = (int) (fPercentageDone * 1000 * 100); + if (nPercentageDone > 100000) nPercentageDone = 100000; + + // update the percent done pointer + if (m_pPercentageDone) + { + *m_pPercentageDone = nPercentageDone; + } + + // fire the callback + if (m_bUseCallback) + { + if (bForceUpdate || (nPercentageDone - m_nLastCallbackFiredPercentageDone) >= 1000) + { + m_CallbackFunction(nPercentageDone); + m_nLastCallbackFiredPercentageDone = nPercentageDone; + } + } +} + +int CMACProgressHelper::ProcessKillFlag(BOOL bSleep) +{ + // process any messages (allows repaint, etc.) + if (bSleep) + { + PUMP_MESSAGE_LOOP + } + + if (m_pKillFlag) + { + while (*m_pKillFlag == KILL_FLAG_PAUSE) + { + SLEEP(50); + PUMP_MESSAGE_LOOP + } + + if ((*m_pKillFlag != KILL_FLAG_CONTINUE) && (*m_pKillFlag != KILL_FLAG_PAUSE)) + { + return -1; + } + } + + return ERROR_SUCCESS; +} diff --git a/Libraries/MAC/Files/Source/MACLib/MACProgressHelper.h b/Libraries/MAC/Files/Source/MACLib/MACProgressHelper.h new file mode 100755 index 000000000..43fa7cb93 --- /dev/null +++ b/Libraries/MAC/Files/Source/MACLib/MACProgressHelper.h @@ -0,0 +1,37 @@ +#ifndef APE_MACPROGRESSHELPER_H +#define APE_MACPROGRESSHELPER_H + +#define KILL_FLAG_CONTINUE 0 +#define KILL_FLAG_PAUSE -1 +#define KILL_FLAG_STOP 1 + +typedef void (__stdcall * APE_PROGRESS_CALLBACK) (int); + +class CMACProgressHelper +{ +public: + + CMACProgressHelper(int nTotalSteps, int *pPercentageDone, APE_PROGRESS_CALLBACK ProgressCallback, int *pKillFlag); + virtual ~CMACProgressHelper(); + + void UpdateProgress(int nCurrentStep = -1, BOOL bForceUpdate = FALSE); + void UpdateProgressComplete() { UpdateProgress(m_nTotalSteps, TRUE); } + + int ProcessKillFlag(BOOL bSleep = TRUE); + +private: + + BOOL m_bUseCallback; + APE_PROGRESS_CALLBACK m_CallbackFunction; + + int *m_pPercentageDone; + + int m_nTotalSteps; + int m_nCurrentStep; + int m_nLastCallbackFiredPercentageDone; + + int *m_pKillFlag; +}; + +#endif // #ifndef APE_MACPROGRESSHELPER_H + diff --git a/Libraries/MAC/Files/Source/MACLib/MD5.cpp b/Libraries/MAC/Files/Source/MACLib/MD5.cpp new file mode 100755 index 000000000..f62145ecc --- /dev/null +++ b/Libraries/MAC/Files/Source/MACLib/MD5.cpp @@ -0,0 +1,264 @@ +/***************************************************************************** +* +* "derived from the RSA Data Security, Inc. MD5 Message-Digest Algorithm". +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +* +*****************************************************************************/ + +#include "All.h" +#include +#include "MD5.h" + + +#if __BYTE_ORDER == __BIG_ENDIAN +/* + * Block copy and convert byte order to little-endian. + * dst must be 32bit aligned. + * Length is the number of 32bit words + */ +static void +CopyToLittleEndian ( uint32_t* dst, + const uint8_t* src, + size_t length ) +{ + for ( ; length--; ) { + *dst = (( (uint32_t) src [3] ) << 24) | + (( (uint32_t) src [2] ) << 16) | + (( (uint32_t) src [1] ) << 8) | + (( (uint32_t) src [0] ) << 0); + + src += 4; dst++ ; + } +} +#endif + + +/* + Assembler versions of __MD5Transform, MD5Init and MD5Update + currently exist for x86 and little-endian ARM. + For other targets, we need to use the C versions below. +*/ + +#if !(defined (__i386__) || ((defined (__arm__) && (__BYTE_ORDER == __LITTLE_ENDIAN)))) + +/* + Initialise the MD5 context. +*/ +void +MD5Init ( MD5_CTX* context ) +{ + context -> count [0] = 0; + context -> count [1] = 0; + + context -> state [0] = 0x67452301; /* Load magic constants. */ + context -> state [1] = 0xefcdab89; + context -> state [2] = 0x98badcfe; + context -> state [3] = 0x10325476; +} + +#define ROTATE_LEFT(x, n) ((x << n) | (x >> (32-n))) + +#define F(x, y, z) (z ^ (x & (y ^ z))) +#define G(x, y, z) (y ^ (z & (x ^ y))) +#define H(x, y, z) (x ^ y ^ z) +#define I(x, y, z) (y ^ (x | ~z)) + +#define FF(a, b, c, d, x, s, ac) { (a) += F (b, c, d) + (x) + (uint32_t)(ac); (a) = ROTATE_LEFT (a, s); (a) += (b); } +#define GG(a, b, c, d, x, s, ac) { (a) += G (b, c, d) + (x) + (uint32_t)(ac); (a) = ROTATE_LEFT (a, s); (a) += (b); } +#define HH(a, b, c, d, x, s, ac) { (a) += H (b, c, d) + (x) + (uint32_t)(ac); (a) = ROTATE_LEFT (a, s); (a) += (b); } +#define II(a, b, c, d, x, s, ac) { (a) += I (b, c, d) + (x) + (uint32_t)(ac); (a) = ROTATE_LEFT (a, s); (a) += (b); } + +static void +__MD5Transform ( uint32_t state [4], + const uint8_t* in, + int repeat ) +{ + const uint32_t* x; + uint32_t a = state [0]; + uint32_t b = state [1]; + uint32_t c = state [2]; + uint32_t d = state [3]; + + for ( ; repeat; repeat-- ) { + uint32_t tempBuffer [16]; +#if __BYTE_ORDER == __BIG_ENDIAN + + CopyToLittleEndian (tempBuffer, in, 16); + x = tempBuffer; +#else + if ( (unsigned int)in & 3 ) { + memcpy ( tempBuffer, in, 64 ); + x = tempBuffer; + } + else { + x = (const uint32_t*) in; + } +#endif + + FF (a, b, c, d, x[ 0], 7, 0xd76aa478); /* 1 */ /* Round 1 */ + FF (d, a, b, c, x[ 1], 12, 0xe8c7b756); /* 2 */ + FF (c, d, a, b, x[ 2], 17, 0x242070db); /* 3 */ + FF (b, c, d, a, x[ 3], 22, 0xc1bdceee); /* 4 */ + FF (a, b, c, d, x[ 4], 7, 0xf57c0faf); /* 5 */ + FF (d, a, b, c, x[ 5], 12, 0x4787c62a); /* 6 */ + FF (c, d, a, b, x[ 6], 17, 0xa8304613); /* 7 */ + FF (b, c, d, a, x[ 7], 22, 0xfd469501); /* 8 */ + FF (a, b, c, d, x[ 8], 7, 0x698098d8); /* 9 */ + FF (d, a, b, c, x[ 9], 12, 0x8b44f7af); /* 10 */ + FF (c, d, a, b, x[10], 17, 0xffff5bb1); /* 11 */ + FF (b, c, d, a, x[11], 22, 0x895cd7be); /* 12 */ + FF (a, b, c, d, x[12], 7, 0x6b901122); /* 13 */ + FF (d, a, b, c, x[13], 12, 0xfd987193); /* 14 */ + FF (c, d, a, b, x[14], 17, 0xa679438e); /* 15 */ + FF (b, c, d, a, x[15], 22, 0x49b40821); /* 16 */ + + GG (a, b, c, d, x[ 1], 5, 0xf61e2562); /* 17 */ /* Round 2 */ + GG (d, a, b, c, x[ 6], 9, 0xc040b340); /* 18 */ + GG (c, d, a, b, x[11], 14, 0x265e5a51); /* 19 */ + GG (b, c, d, a, x[ 0], 20, 0xe9b6c7aa); /* 20 */ + GG (a, b, c, d, x[ 5], 5, 0xd62f105d); /* 21 */ + GG (d, a, b, c, x[10], 9, 0x02441453); /* 22 */ + GG (c, d, a, b, x[15], 14, 0xd8a1e681); /* 23 */ + GG (b, c, d, a, x[ 4], 20, 0xe7d3fbc8); /* 24 */ + GG (a, b, c, d, x[ 9], 5, 0x21e1cde6); /* 25 */ + GG (d, a, b, c, x[14], 9, 0xc33707d6); /* 26 */ + GG (c, d, a, b, x[ 3], 14, 0xf4d50d87); /* 27 */ + GG (b, c, d, a, x[ 8], 20, 0x455a14ed); /* 28 */ + GG (a, b, c, d, x[13], 5, 0xa9e3e905); /* 29 */ + GG (d, a, b, c, x[ 2], 9, 0xfcefa3f8); /* 30 */ + GG (c, d, a, b, x[ 7], 14, 0x676f02d9); /* 31 */ + GG (b, c, d, a, x[12], 20, 0x8d2a4c8a); /* 32 */ + + HH (a, b, c, d, x[ 5], 4, 0xfffa3942); /* 33 */ /* Round 3 */ + HH (d, a, b, c, x[ 8], 11, 0x8771f681); /* 34 */ + HH (c, d, a, b, x[11], 16, 0x6d9d6122); /* 35 */ + HH (b, c, d, a, x[14], 23, 0xfde5380c); /* 36 */ + HH (a, b, c, d, x[ 1], 4, 0xa4beea44); /* 37 */ + HH (d, a, b, c, x[ 4], 11, 0x4bdecfa9); /* 38 */ + HH (c, d, a, b, x[ 7], 16, 0xf6bb4b60); /* 39 */ + HH (b, c, d, a, x[10], 23, 0xbebfbc70); /* 40 */ + HH (a, b, c, d, x[13], 4, 0x289b7ec6); /* 41 */ + HH (d, a, b, c, x[ 0], 11, 0xeaa127fa); /* 42 */ + HH (c, d, a, b, x[ 3], 16, 0xd4ef3085); /* 43 */ + HH (b, c, d, a, x[ 6], 23, 0x04881d05); /* 44 */ + HH (a, b, c, d, x[ 9], 4, 0xd9d4d039); /* 45 */ + HH (d, a, b, c, x[12], 11, 0xe6db99e5); /* 46 */ + HH (c, d, a, b, x[15], 16, 0x1fa27cf8); /* 47 */ + HH (b, c, d, a, x[ 2], 23, 0xc4ac5665); /* 48 */ + + II (a, b, c, d, x[ 0], 6, 0xf4292244); /* 49 */ /* Round 4 */ + II (d, a, b, c, x[ 7], 10, 0x432aff97); /* 50 */ + II (c, d, a, b, x[14], 15, 0xab9423a7); /* 51 */ + II (b, c, d, a, x[ 5], 21, 0xfc93a039); /* 52 */ + II (a, b, c, d, x[12], 6, 0x655b59c3); /* 53 */ + II (d, a, b, c, x[ 3], 10, 0x8f0ccc92); /* 54 */ + II (c, d, a, b, x[10], 15, 0xffeff47d); /* 55 */ + II (b, c, d, a, x[ 1], 21, 0x85845dd1); /* 56 */ + II (a, b, c, d, x[ 8], 6, 0x6fa87e4f); /* 57 */ + II (d, a, b, c, x[15], 10, 0xfe2ce6e0); /* 58 */ + II (c, d, a, b, x[ 6], 15, 0xa3014314); /* 59 */ + II (b, c, d, a, x[13], 21, 0x4e0811a1); /* 60 */ + II (a, b, c, d, x[ 4], 6, 0xf7537e82); /* 61 */ + II (d, a, b, c, x[11], 10, 0xbd3af235); /* 62 */ + II (c, d, a, b, x[ 2], 15, 0x2ad7d2bb); /* 63 */ + II (b, c, d, a, x[ 9], 21, 0xeb86d391); /* 64 */ + + state [0] = a = a + state [0]; + state [1] = b = b + state [1]; + state [2] = c = c + state [2]; + state [3] = d = d + state [3]; + + in += 64; + } +} + + +/* + MD5 block update operation: + Process another sub-string of the message and update the context. +*/ + +void +MD5Update ( MD5_CTX* context, + const uint8_t* input, + size_t inputBytes ) +{ + int byteIndex; + unsigned int partLen; + int len; + int i; + + /* Compute number of bytes mod 64 */ + byteIndex = (context -> count[0] >> 3) & 0x3F; + + /* Update number of bits: count += 8 * inputBytes */ + if ( (context -> count [0] += inputBytes << 3) < (inputBytes << 3) ) + context -> count [1]++; + context -> count [1] += inputBytes >> (32 - 3); + + partLen = (64 - byteIndex); + + /* Transform as many times as possible. */ + if ( inputBytes >= partLen ) { + memcpy ( context -> buffer + byteIndex, input, partLen ); + __MD5Transform ( context -> state, (const uint8_t*) context -> buffer, 1 ); + len = ( inputBytes - partLen ) >> 6; + __MD5Transform ( context -> state, input + partLen, len ); + i = partLen + (len << 6); + byteIndex = 0; + } + else { + i = 0; + } + + /* Buffer remaining input */ + memcpy ( (context -> buffer) + byteIndex, input + i, inputBytes - i ); +} + +#endif + + +void +MD5Final ( uint8_t digest [16], + MD5_CTX* context ) +{ + static uint8_t finalBlock [64]; + uint32_t bits [2]; + int byteIndex; + int finalBlockLength; + + byteIndex = (context -> count[0] >> 3) & 0x3F; + finalBlockLength = (byteIndex < 56 ? 56 : 120) - byteIndex; + finalBlock[0] = 0x80; + +#if __BYTE_ORDER == __BIG_ENDIAN + CopyToLittleEndian ( bits, (const uint8_t*) context -> count, 2 ); +#else + memcpy ( bits, context->count, 8 ); +#endif + + MD5Update ( context, finalBlock, finalBlockLength ); + MD5Update ( context, (const uint8_t*) bits, 8 ); + +#if __BYTE_ORDER == __BIG_ENDIAN + CopyToLittleEndian ( (uint32_t*) digest, (const uint8_t*) context -> state, 4 ); +#else + memcpy ( digest, context -> state, 16 ); +#endif + + memset ( context, 0, sizeof (*context) ); +} + diff --git a/Libraries/MAC/Files/Source/MACLib/MultichannelNNFilter.h b/Libraries/MAC/Files/Source/MACLib/MultichannelNNFilter.h new file mode 100755 index 000000000..6bca6f1c6 --- /dev/null +++ b/Libraries/MAC/Files/Source/MACLib/MultichannelNNFilter.h @@ -0,0 +1,95 @@ +#ifndef APE_MULTICHANNEL_NNFILTER_H +#define APE_MULTICHANNEL_NNFILTER_H + +#include "NNFilter.h" + +class CMultichannelNNFilter +{ +public: + + CMultichannelNNFilter(int nOrder1, int nOrder2, int nShift) + { + m_pNNFilterA = new CNNFilter(nOrder1 + nOrder2, 11, 3980); + m_pNNFilterB = new CNNFilter(nOrder1 + nOrder2, 11, 3980); + + m_rbA.Create(NN_WINDOW_ELEMENTS, nOrder1 + nOrder2 + 1); + m_rbB.Create(NN_WINDOW_ELEMENTS, nOrder1 + nOrder2 + 1); + + m_nShift = nShift; + + m_nOrder1 = nOrder1; + } + + + ~CMultichannelNNFilter() + { + SAFE_DELETE(m_pNNFilterA) + SAFE_DELETE(m_pNNFilterB) + } + + void Flush() + { + m_pNNFilterA->Flush(); + m_pNNFilterB->Flush(); + + m_rbA.Flush(); + m_rbB.Flush(); + + } + + inline void Compress(int & nA, int & nB) + { + if (m_nShift <= 0) + return; + + m_rbA[0] = GetSaturatedShortFromInt(nA); m_rbB[0] = GetSaturatedShortFromInt(nB); + m_rbA[-m_nOrder1 - 1] = m_rbB[-1]; m_rbB[-m_nOrder1 - 1] = m_rbA[0]; + + nA -= (m_pNNFilterA->GetPrediction(&m_rbA[-1]) >> m_nShift); + nB -= (m_pNNFilterB->GetPrediction(&m_rbB[-1]) >> m_nShift); + + m_pNNFilterA->AdaptAfterPrediction(&m_rbA[-1], -m_nOrder1, nA); + m_pNNFilterB->AdaptAfterPrediction(&m_rbB[-1], -m_nOrder1, nB); + + m_rbA.IncrementSafe(); m_rbB.IncrementSafe(); + } + + inline void Decompress(int & nA, int & nB) + { + if (m_nShift <= 0) + return; + + m_rbA[-m_nOrder1 - 1] = m_rbB[-1]; + int nOutputA = nA + (m_pNNFilterA->GetPrediction(&m_rbA[-1]) >> m_nShift); + m_rbA[0] = GetSaturatedShortFromInt(nOutputA); + + m_rbB[-m_nOrder1 - 1] = m_rbA[0]; + int nOutputB = nB + (m_pNNFilterB->GetPrediction(&m_rbB[-1]) >> m_nShift); + m_rbB[0] = GetSaturatedShortFromInt(nOutputB); + + m_pNNFilterA->AdaptAfterPrediction(&m_rbA[-1], -m_nOrder1, nA); + m_pNNFilterB->AdaptAfterPrediction(&m_rbB[-1], -m_nOrder1, nB); + + m_rbA.IncrementSafe(); m_rbB.IncrementSafe(); + + nA = nOutputA; nB = nOutputB; + } + +protected: + + CNNFilter * m_pNNFilterA; + CNNFilter * m_pNNFilterB; + + int m_nShift; + int m_nOrder1; + + CRollBuffer m_rbA; + CRollBuffer m_rbB; + + inline short GetSaturatedShortFromInt(int nValue) const + { + return short((nValue == short(nValue)) ? nValue : (nValue >> 31) ^ 0x7FFF); + } +}; + +#endif // #ifndef APE_MULTICHANNEL_NNFILTER_H diff --git a/Libraries/MAC/Files/Source/MACLib/NNFilter.cpp b/Libraries/MAC/Files/Source/MACLib/NNFilter.cpp new file mode 100755 index 000000000..ed909c2b3 --- /dev/null +++ b/Libraries/MAC/Files/Source/MACLib/NNFilter.cpp @@ -0,0 +1,327 @@ +#include "All.h" +#include "GlobalFunctions.h" +#include "NNFilter.h" +//#include + +CNNFilter::CNNFilter(int nOrder, int nShift, int nVersion) +{ + if ((nOrder <= 0) || ((nOrder % 16) != 0)) throw(1); + m_nOrder = nOrder; + m_nShift = nShift; + m_nVersion = nVersion; + + //m_bMMXAvailable = GetMMXAvailable(); + m_AltiVecAvailable = IsAltiVecAvailable(); + + m_rbInput.Create(NN_WINDOW_ELEMENTS, m_nOrder); + m_rbDeltaM.Create(NN_WINDOW_ELEMENTS, m_nOrder); + m_paryM = new short [m_nOrder]; + +#ifdef NN_TEST_MMX + srand(GetTickCount()); +#endif +} + +CNNFilter::~CNNFilter() +{ + SAFE_ARRAY_DELETE(m_paryM) +} + +void CNNFilter::Flush() +{ + memset(&m_paryM[0], 0, m_nOrder * sizeof(short)); + m_rbInput.Flush(); + m_rbDeltaM.Flush(); + m_nRunningAverage = 0; +} + +int CNNFilter::Compress(int nInput) +{ + // convert the input to a short and store it + m_rbInput[0] = GetSaturatedShortFromInt(nInput); + + // figure a dot product + int nDotProduct; + /* + if (m_bMMXAvailable) + nDotProduct = CalculateDotProduct(&m_rbInput[-m_nOrder], &m_paryM[0], m_nOrder); + */ + if(m_AltiVecAvailable) + nDotProduct = CalculateDotProductAltiVec(&m_rbInput[-m_nOrder], &m_paryM[0], m_nOrder); + else + nDotProduct = CalculateDotProductNoMMX(&m_rbInput[-m_nOrder], &m_paryM[0], m_nOrder); + + // calculate the output + int nOutput = nInput - ((nDotProduct + (1 << (m_nShift - 1))) >> m_nShift); + + // adapt + /* + if (m_bMMXAvailable) + Adapt(&m_paryM[0], &m_rbDeltaM[-m_nOrder], -nOutput, m_nOrder); + */ + if(m_AltiVecAvailable) + AdaptAltiVec(&m_paryM[0], &m_rbDeltaM[-m_nOrder], nOutput, m_nOrder); + else + AdaptNoMMX(&m_paryM[0], &m_rbDeltaM[-m_nOrder], nOutput, m_nOrder); + + int nTempABS = abs(nInput); + + if (nTempABS > (m_nRunningAverage * 3)) + m_rbDeltaM[0] = ((nInput >> 25) & 64) - 32; + else if (nTempABS > (m_nRunningAverage * 4) / 3) + m_rbDeltaM[0] = ((nInput >> 26) & 32) - 16; + else if (nTempABS > 0) + m_rbDeltaM[0] = ((nInput >> 27) & 16) - 8; + else + m_rbDeltaM[0] = 0; + + m_nRunningAverage += (nTempABS - m_nRunningAverage) / 16; + + m_rbDeltaM[-1] >>= 1; + m_rbDeltaM[-2] >>= 1; + m_rbDeltaM[-8] >>= 1; + + // increment and roll if necessary + m_rbInput.IncrementSafe(); + m_rbDeltaM.IncrementSafe(); + + return nOutput; +} + +int CNNFilter::Decompress(int nInput) +{ + // figure a dot product + int nDotProduct; + + /* + if (m_bMMXAvailable) + nDotProduct = CalculateDotProduct(&m_rbInput[-m_nOrder], &m_paryM[0], m_nOrder); + */ + if(m_AltiVecAvailable) + nDotProduct = CalculateDotProductAltiVec(&m_rbInput[-m_nOrder], &m_paryM[0], m_nOrder); + else + nDotProduct = CalculateDotProductNoMMX(&m_rbInput[-m_nOrder], &m_paryM[0], m_nOrder); + + // adapt + /* + if (m_bMMXAvailable) + Adapt(&m_paryM[0], &m_rbDeltaM[-m_nOrder], -nInput, m_nOrder); + */ + if(m_AltiVecAvailable) + AdaptAltiVec(&m_paryM[0], &m_rbDeltaM[-m_nOrder], nInput, m_nOrder); + else + AdaptNoMMX(&m_paryM[0], &m_rbDeltaM[-m_nOrder], nInput, m_nOrder); + + // store the output value + int nOutput = nInput + ((nDotProduct + (1 << (m_nShift - 1))) >> m_nShift); + + // update the input buffer + m_rbInput[0] = GetSaturatedShortFromInt(nOutput); + + if (m_nVersion >= 3980) + { + int nTempABS = abs(nOutput); + + if (nTempABS > (m_nRunningAverage * 3)) + m_rbDeltaM[0] = ((nOutput >> 25) & 64) - 32; + else if (nTempABS > (m_nRunningAverage * 4) / 3) + m_rbDeltaM[0] = ((nOutput >> 26) & 32) - 16; + else if (nTempABS > 0) + m_rbDeltaM[0] = ((nOutput >> 27) & 16) - 8; + else + m_rbDeltaM[0] = 0; + + m_nRunningAverage += (nTempABS - m_nRunningAverage) / 16; + + m_rbDeltaM[-1] >>= 1; + m_rbDeltaM[-2] >>= 1; + m_rbDeltaM[-8] >>= 1; + } + else + { + m_rbDeltaM[0] = (nOutput == 0) ? 0 : ((nOutput >> 28) & 8) - 4; + m_rbDeltaM[-4] >>= 1; + m_rbDeltaM[-8] >>= 1; + } + + // increment and roll if necessary + m_rbInput.IncrementSafe(); + m_rbDeltaM.IncrementSafe(); + + return nOutput; +} + +void CNNFilter::AdaptAltiVec(short * pM, short * pAdapt, int nDirection, int nOrder) +{ + vector signed short LSQ2, LSQ4, v1, v2; + vector unsigned char mask2; + + nOrder >>= 4; + + //mask1 = vec_lvsl(0,pM); + mask2 = vec_lvsl(0,pAdapt); + //align = vec_lvsr(0,pM); + //zero = (vector unsigned char)(0); + //(vector signed char) one = (vector signed char)(-1); + //mask3 = vec_perm((vector unsigned char)(0),(vector unsigned char)(-1),align); + + //LSQ3 = vec_ld(0,pM); + LSQ4 = vec_ld(0,pAdapt); + + if (nDirection < 0) + { + while (nOrder--) + { + + v1 = vec_ld(0,pM); + LSQ2 = vec_ld(16,pAdapt); + v2 = vec_perm(LSQ4,LSQ2,mask2); + v1 = vec_add(v1,v2); + vec_st(v1,0,pM); + + /* + v1 = vec_perm(v1,v1,align); + LSQ3 = vec_sel(LSQ3,v1,(vector unsigned short)mask3); + vec_st(LSQ3,0,pM); + LSQ4 = vec_sel(v1,LSQ,(vector unsigned short)mask3); + vec_st(LSQ4,16,pM); + */ + + v1 = vec_ld(16,pM); + LSQ4 = vec_ld(32,pAdapt); + v2 = vec_perm(LSQ2,LSQ4,mask2); + v1 = vec_add(v1,v2); + vec_st(v1,16,pM); + + /* + v1 = vec_perm(v1,v1,align); + LSQ = vec_sel(LSQ,v1,(vector unsigned short)mask3); + vec_st(LSQ,16,pM); + LSQ2 = vec_sel(v1,LSQ3,(vector unsigned short)mask3); + vec_st(LSQ2,32,pM); + */ + + //memcpy(pM,buffer,32); + pM = pM + 16; + pAdapt = pAdapt + 16; + } + } + else if (nDirection > 0) + { + while (nOrder--) + { + + v1 = vec_ld(0,pM); + LSQ2 = vec_ld(16,pAdapt); + v2 = vec_perm(LSQ4,LSQ2,mask2); + v1 = vec_sub(v1,v2); + vec_st(v1,0,pM); + + /* + v1 = vec_perm(v1,v1,align); + LSQ3 = vec_sel(LSQ3,v1,(vector unsigned short)mask3); + vec_st(LSQ3,0,pM); + LSQ4 = vec_sel(v1,LSQ,(vector unsigned short)mask3); + vec_st(LSQ4,16,pM); + */ + + v1 = vec_ld(16,pM); + LSQ4 = vec_ld(32,pAdapt); + v2 = vec_perm(LSQ2,LSQ4,mask2); + v1 = vec_sub(v1,v2); + vec_st(v1,16,pM); + + /* + v1 = vec_perm(v1,v1,align); + LSQ = vec_sel(LSQ,v1,(vector unsigned short)mask3); + vec_st(LSQ,16,pM); + LSQ2 = vec_sel(v1,LSQ3,(vector unsigned short)mask3); + vec_st(LSQ2,32,pM); + */ + + //memcpy(pM,buffer,32); + pM = pM + 16; + pAdapt = pAdapt + 16; + + + } + } +} + +int CNNFilter::CalculateDotProductAltiVec(short * pA, short * pB, int nOrder) +{ + vector signed short LSQ, LSQ3, v1, v2; + vector unsigned char mask1; + + vector signed int vzero = (vector signed int)(0); + vector signed int sum = (vector signed int)(0); + //sum = vec_xor(sum,sum); + + //int nDotProduct; + int p[4]; + nOrder >>= 4; + + mask1 = vec_lvsl(0,pA); + //mask2 = vec_lvsl(0,pB); + + + LSQ3 = vec_ld(0, pA); + //LSQ4 = vec_ld(0, pB); + + while (nOrder--) + { + + LSQ = vec_ld(16,pA); + v1 = vec_perm(LSQ3,LSQ,mask1); + v2 = vec_ld(0,pB); + sum = vec_msum(v1,v2,sum); + + LSQ3 = vec_ld(32,pA); + v1 = vec_perm(LSQ,LSQ3,mask1); + v2 = vec_ld(16,pB); + sum = vec_msum(v1,v2,sum); + + pA = pA + 16; + pB = pB + 16; + + } + + sum = vec_sums(sum,vzero); + vec_st(sum,0,p); + + return p[3]; + +} + +void CNNFilter::AdaptNoMMX(short * pM, short * pAdapt, int nDirection, int nOrder) +{ + nOrder >>= 4; + + if (nDirection < 0) + { + while (nOrder--) + { + EXPAND_16_TIMES(*pM++ += *pAdapt++;) + } + } + else if (nDirection > 0) + { + while (nOrder--) + { + EXPAND_16_TIMES(*pM++ -= *pAdapt++;) + } + } +} + +int CNNFilter::CalculateDotProductNoMMX(short * pA, short * pB, int nOrder) +{ + int nDotProduct = 0; + nOrder >>= 4; + + while (nOrder--) + { + EXPAND_16_TIMES(nDotProduct += *pA++ * *pB++;) + } + + return nDotProduct; +} diff --git a/Libraries/MAC/Files/Source/MACLib/NNFilter.h b/Libraries/MAC/Files/Source/MACLib/NNFilter.h new file mode 100755 index 000000000..abe451213 --- /dev/null +++ b/Libraries/MAC/Files/Source/MACLib/NNFilter.h @@ -0,0 +1,44 @@ +#ifndef APE_NNFILTER_H +#define APE_NNFILTER_H + +#include "RollBuffer.h" +#define NN_WINDOW_ELEMENTS 512 +//#define NN_TEST_MMX + +class CNNFilter +{ +public: + + CNNFilter(int nOrder, int nShift, int nVersion); + ~CNNFilter(); + + int Compress(int nInput); + int Decompress(int nInput); + void Flush(); + +private: + + int m_nOrder; + int m_nShift; + int m_nVersion; + BOOL m_bMMXAvailable; + int m_AltiVecAvailable; + int m_nRunningAverage; + + CRollBuffer m_rbInput; + CRollBuffer m_rbDeltaM; + + short * m_paryM; + + inline short GetSaturatedShortFromInt(int nValue) const + { + return short((nValue == short(nValue)) ? nValue : (nValue >> 31) ^ 0x7FFF); + } + + inline int CalculateDotProductNoMMX(short * pA, short * pB, int nOrder); + inline void AdaptNoMMX(short * pM, short * pAdapt, int nDirection, int nOrder); + int CalculateDotProductAltiVec(short * pA, short * pB, int nOrder); + void AdaptAltiVec(short * pM, short * pAdapt, int nDirection, int nOrder); +}; + +#endif // #ifndef APE_NNFILTER_H diff --git a/Libraries/MAC/Files/Source/MACLib/NewPredictor.cpp b/Libraries/MAC/Files/Source/MACLib/NewPredictor.cpp new file mode 100755 index 000000000..ed9f4d377 --- /dev/null +++ b/Libraries/MAC/Files/Source/MACLib/NewPredictor.cpp @@ -0,0 +1,408 @@ +#include "All.h" +#include "APECompress.h" +#include "NewPredictor.h" + +/***************************************************************************************** +CPredictorCompressNormal +*****************************************************************************************/ +CPredictorCompressNormal::CPredictorCompressNormal(int nCompressionLevel) + : IPredictorCompress(nCompressionLevel) +{ + if (nCompressionLevel == COMPRESSION_LEVEL_FAST) + { + m_pNNFilter = NULL; + m_pNNFilter1 = NULL; + m_pNNFilter2 = NULL; + } + else if (nCompressionLevel == COMPRESSION_LEVEL_NORMAL) + { + m_pNNFilter = new CNNFilter(16, 11, MAC_VERSION_NUMBER); + m_pNNFilter1 = NULL; + m_pNNFilter2 = NULL; + } + else if (nCompressionLevel == COMPRESSION_LEVEL_HIGH) + { + m_pNNFilter = new CNNFilter(64, 11, MAC_VERSION_NUMBER); + m_pNNFilter1 = NULL; + m_pNNFilter2 = NULL; + } + else if (nCompressionLevel == COMPRESSION_LEVEL_EXTRA_HIGH) + { + m_pNNFilter = new CNNFilter(256, 13, MAC_VERSION_NUMBER); + m_pNNFilter1 = new CNNFilter(32, 10, MAC_VERSION_NUMBER); + m_pNNFilter2 = NULL; + } + else if (nCompressionLevel == COMPRESSION_LEVEL_INSANE) + { + m_pNNFilter = new CNNFilter(1024 + 256, 15, MAC_VERSION_NUMBER); + m_pNNFilter1 = new CNNFilter(256, 13, MAC_VERSION_NUMBER); + m_pNNFilter2 = new CNNFilter(16, 11, MAC_VERSION_NUMBER); + + } + else + { + throw(1); + } +} + +CPredictorCompressNormal::~CPredictorCompressNormal() +{ + SAFE_DELETE(m_pNNFilter) + SAFE_DELETE(m_pNNFilter1) + SAFE_DELETE(m_pNNFilter2) +} + +int CPredictorCompressNormal::Flush() +{ + if (m_pNNFilter) m_pNNFilter->Flush(); + if (m_pNNFilter1) m_pNNFilter1->Flush(); + if (m_pNNFilter2) m_pNNFilter2->Flush(); + + m_rbPrediction.Flush(); + m_rbAdapt.Flush(); + m_Stage1FilterA.Flush(); m_Stage1FilterB.Flush(); + + memset(m_aryM, 0, sizeof(m_aryM)); + + int * paryM = &m_aryM[8]; + paryM[0] = 360; + paryM[-1] = 317; + paryM[-2] = -109; + paryM[-3] = 98; + + m_nCurrentIndex = 0; + + return ERROR_SUCCESS; +} + +int CPredictorCompressNormal::CompressValue(int nA, int nB) +{ + // roll the buffers if necessary + if (m_nCurrentIndex == WINDOW_BLOCKS) + { + m_rbPrediction.Roll(); m_rbAdapt.Roll(); + m_nCurrentIndex = 0; + } + + // stage 1: simple, non-adaptive order 1 prediction + nA = m_Stage1FilterA.Compress(nA); + nB = m_Stage1FilterB.Compress(nB); + + // stage 2: adaptive offset filter(s) + m_rbPrediction[0] = nA; + m_rbPrediction[-2] = m_rbPrediction[-1] - m_rbPrediction[-2]; + + m_rbPrediction[-5] = nB; + m_rbPrediction[-6] = m_rbPrediction[-5] - m_rbPrediction[-6]; + + int * paryM = &m_aryM[8]; + + int nPredictionA = (m_rbPrediction[-1] * paryM[0]) + (m_rbPrediction[-2] * paryM[-1]) + (m_rbPrediction[-3] * paryM[-2]) + (m_rbPrediction[-4] * paryM[-3]); + int nPredictionB = (m_rbPrediction[-5] * paryM[-4]) + (m_rbPrediction[-6] * paryM[-5]) + (m_rbPrediction[-7] * paryM[-6]) + (m_rbPrediction[-8] * paryM[-7]) + (m_rbPrediction[-9] * paryM[-8]); + + int nOutput = nA - ((nPredictionA + (nPredictionB >> 1)) >> 10); + + // adapt + m_rbAdapt[0] = (m_rbPrediction[-1]) ? ((m_rbPrediction[-1] >> 30) & 2) - 1 : 0; + m_rbAdapt[-1] = (m_rbPrediction[-2]) ? ((m_rbPrediction[-2] >> 30) & 2) - 1 : 0; + m_rbAdapt[-4] = (m_rbPrediction[-5]) ? ((m_rbPrediction[-5] >> 30) & 2) - 1 : 0; + m_rbAdapt[-5] = (m_rbPrediction[-6]) ? ((m_rbPrediction[-6] >> 30) & 2) - 1 : 0; + + if (nOutput > 0) + { + int * pM = &paryM[-8]; int * pAdapt = &m_rbAdapt[-8]; + EXPAND_9_TIMES(*pM++ -= *pAdapt++;) + } + else if (nOutput < 0) + { + int * pM = &paryM[-8]; int * pAdapt = &m_rbAdapt[-8]; + EXPAND_9_TIMES(*pM++ += *pAdapt++;) + } + + // stage 3: NNFilters + if (m_pNNFilter) + { + nOutput = m_pNNFilter->Compress(nOutput); + + if (m_pNNFilter1) + { + nOutput = m_pNNFilter1->Compress(nOutput); + + if (m_pNNFilter2) + nOutput = m_pNNFilter2->Compress(nOutput); + } + } + + m_rbPrediction.IncrementFast(); m_rbAdapt.IncrementFast(); + m_nCurrentIndex++; + + return nOutput; +} + +/***************************************************************************************** +CPredictorDecompressNormal3930to3950 +*****************************************************************************************/ +CPredictorDecompressNormal3930to3950::CPredictorDecompressNormal3930to3950(int nCompressionLevel, int nVersion) + : IPredictorDecompress(nCompressionLevel, nVersion) +{ + m_pBuffer[0] = new int [HISTORY_ELEMENTS + WINDOW_BLOCKS]; + + if (nCompressionLevel == COMPRESSION_LEVEL_FAST) + { + m_pNNFilter = NULL; + m_pNNFilter1 = NULL; + } + else if (nCompressionLevel == COMPRESSION_LEVEL_NORMAL) + { + m_pNNFilter = new CNNFilter(16, 11, nVersion); + m_pNNFilter1 = NULL; + } + else if (nCompressionLevel == COMPRESSION_LEVEL_HIGH) + { + m_pNNFilter = new CNNFilter(64, 11, nVersion); + m_pNNFilter1 = NULL; + } + else if (nCompressionLevel == COMPRESSION_LEVEL_EXTRA_HIGH) + { + m_pNNFilter = new CNNFilter(256, 13, nVersion); + m_pNNFilter1 = new CNNFilter(32, 10, nVersion); + } + else + { + throw(1); + } +} + +CPredictorDecompressNormal3930to3950::~CPredictorDecompressNormal3930to3950() +{ + SAFE_DELETE(m_pNNFilter) + SAFE_DELETE(m_pNNFilter1) + SAFE_ARRAY_DELETE(m_pBuffer[0]) +} + +int CPredictorDecompressNormal3930to3950::Flush() +{ + if (m_pNNFilter) m_pNNFilter->Flush(); + if (m_pNNFilter1) m_pNNFilter1->Flush(); + + ZeroMemory(m_pBuffer[0], (HISTORY_ELEMENTS + 1) * sizeof(int)); + ZeroMemory(&m_aryM[0], M_COUNT * sizeof(int)); + + m_aryM[0] = 360; + m_aryM[1] = 317; + m_aryM[2] = -109; + m_aryM[3] = 98; + + m_pInputBuffer = &m_pBuffer[0][HISTORY_ELEMENTS]; + + m_nLastValue = 0; + m_nCurrentIndex = 0; + + return ERROR_SUCCESS; +} + +int CPredictorDecompressNormal3930to3950::DecompressValue(int nInput, int) +{ + if (m_nCurrentIndex == WINDOW_BLOCKS) + { + // copy forward and adjust pointers + memcpy(&m_pBuffer[0][0], &m_pBuffer[0][WINDOW_BLOCKS], HISTORY_ELEMENTS * sizeof(int)); + m_pInputBuffer = &m_pBuffer[0][HISTORY_ELEMENTS]; + + m_nCurrentIndex = 0; + } + + // stage 2: NNFilter + if (m_pNNFilter1) + nInput = m_pNNFilter1->Decompress(nInput); + if (m_pNNFilter) + nInput = m_pNNFilter->Decompress(nInput); + + // stage 1: multiple predictors (order 2 and offset 1) + + int p1 = m_pInputBuffer[-1]; + int p2 = m_pInputBuffer[-1] - m_pInputBuffer[-2]; + int p3 = m_pInputBuffer[-2] - m_pInputBuffer[-3]; + int p4 = m_pInputBuffer[-3] - m_pInputBuffer[-4]; + + m_pInputBuffer[0] = nInput + (((p1 * m_aryM[0]) + (p2 * m_aryM[1]) + (p3 * m_aryM[2]) + (p4 * m_aryM[3])) >> 9); + + if (nInput > 0) + { + m_aryM[0] -= ((p1 >> 30) & 2) - 1; + m_aryM[1] -= ((p2 >> 30) & 2) - 1; + m_aryM[2] -= ((p3 >> 30) & 2) - 1; + m_aryM[3] -= ((p4 >> 30) & 2) - 1; + } + else if (nInput < 0) + { + m_aryM[0] += ((p1 >> 30) & 2) - 1; + m_aryM[1] += ((p2 >> 30) & 2) - 1; + m_aryM[2] += ((p3 >> 30) & 2) - 1; + m_aryM[3] += ((p4 >> 30) & 2) - 1; + } + + int nRetVal = m_pInputBuffer[0] + ((m_nLastValue * 31) >> 5); + m_nLastValue = nRetVal; + + m_nCurrentIndex++; + m_pInputBuffer++; + + return nRetVal; +} + +/***************************************************************************************** +CPredictorDecompress3950toCurrent +*****************************************************************************************/ +CPredictorDecompress3950toCurrent::CPredictorDecompress3950toCurrent(int nCompressionLevel, int nVersion) + : IPredictorDecompress(nCompressionLevel, nVersion) +{ + m_nVersion = nVersion; + + if (nCompressionLevel == COMPRESSION_LEVEL_FAST) + { + m_pNNFilter = NULL; + m_pNNFilter1 = NULL; + m_pNNFilter2 = NULL; + } + else if (nCompressionLevel == COMPRESSION_LEVEL_NORMAL) + { + m_pNNFilter = new CNNFilter(16, 11, nVersion); + m_pNNFilter1 = NULL; + m_pNNFilter2 = NULL; + } + else if (nCompressionLevel == COMPRESSION_LEVEL_HIGH) + { + m_pNNFilter = new CNNFilter(64, 11, nVersion); + m_pNNFilter1 = NULL; + m_pNNFilter2 = NULL; + } + else if (nCompressionLevel == COMPRESSION_LEVEL_EXTRA_HIGH) + { + m_pNNFilter = new CNNFilter(256, 13, nVersion); + m_pNNFilter1 = new CNNFilter(32, 10, nVersion); + m_pNNFilter2 = NULL; + } + else if (nCompressionLevel == COMPRESSION_LEVEL_INSANE) + { + m_pNNFilter = new CNNFilter(1024 + 256, 15, MAC_VERSION_NUMBER); + m_pNNFilter1 = new CNNFilter(256, 13, MAC_VERSION_NUMBER); + m_pNNFilter2 = new CNNFilter(16, 11, MAC_VERSION_NUMBER); + + } + else + { + throw(1); + } +} + +CPredictorDecompress3950toCurrent::~CPredictorDecompress3950toCurrent() +{ + SAFE_DELETE(m_pNNFilter) + SAFE_DELETE(m_pNNFilter1) + SAFE_DELETE(m_pNNFilter2) +} + +int CPredictorDecompress3950toCurrent::Flush() +{ + if (m_pNNFilter) m_pNNFilter->Flush(); + if (m_pNNFilter1) m_pNNFilter1->Flush(); + if (m_pNNFilter2) m_pNNFilter2->Flush(); + + ZeroMemory(m_aryMA, sizeof(m_aryMA)); + ZeroMemory(m_aryMB, sizeof(m_aryMB)); + + m_rbPredictionA.Flush(); + m_rbPredictionB.Flush(); + m_rbAdaptA.Flush(); + m_rbAdaptB.Flush(); + + m_aryMA[0] = 360; + m_aryMA[1] = 317; + m_aryMA[2] = -109; + m_aryMA[3] = 98; + + m_Stage1FilterA.Flush(); + m_Stage1FilterB.Flush(); + + m_nLastValueA = 0; + + m_nCurrentIndex = 0; + + return ERROR_SUCCESS; +} + +int CPredictorDecompress3950toCurrent::DecompressValue(int nA, int nB) +{ + if (m_nCurrentIndex == WINDOW_BLOCKS) + { + // copy forward and adjust pointers + m_rbPredictionA.Roll(); m_rbPredictionB.Roll(); + m_rbAdaptA.Roll(); m_rbAdaptB.Roll(); + + m_nCurrentIndex = 0; + } + + // stage 2: NNFilter + if (m_pNNFilter2) + nA = m_pNNFilter2->Decompress(nA); + if (m_pNNFilter1) + nA = m_pNNFilter1->Decompress(nA); + if (m_pNNFilter) + nA = m_pNNFilter->Decompress(nA); + + // stage 1: multiple predictors (order 2 and offset 1) + m_rbPredictionA[0] = m_nLastValueA; + m_rbPredictionA[-1] = m_rbPredictionA[0] - m_rbPredictionA[-1]; + + m_rbPredictionB[0] = m_Stage1FilterB.Compress(nB); + m_rbPredictionB[-1] = m_rbPredictionB[0] - m_rbPredictionB[-1]; + + int nPredictionA = (m_rbPredictionA[0] * m_aryMA[0]) + (m_rbPredictionA[-1] * m_aryMA[1]) + (m_rbPredictionA[-2] * m_aryMA[2]) + (m_rbPredictionA[-3] * m_aryMA[3]); + int nPredictionB = (m_rbPredictionB[0] * m_aryMB[0]) + (m_rbPredictionB[-1] * m_aryMB[1]) + (m_rbPredictionB[-2] * m_aryMB[2]) + (m_rbPredictionB[-3] * m_aryMB[3]) + (m_rbPredictionB[-4] * m_aryMB[4]); + + int nCurrentA = nA + ((nPredictionA + (nPredictionB >> 1)) >> 10); + + m_rbAdaptA[0] = (m_rbPredictionA[0]) ? ((m_rbPredictionA[0] >> 30) & 2) - 1 : 0; + m_rbAdaptA[-1] = (m_rbPredictionA[-1]) ? ((m_rbPredictionA[-1] >> 30) & 2) - 1 : 0; + + m_rbAdaptB[0] = (m_rbPredictionB[0]) ? ((m_rbPredictionB[0] >> 30) & 2) - 1 : 0; + m_rbAdaptB[-1] = (m_rbPredictionB[-1]) ? ((m_rbPredictionB[-1] >> 30) & 2) - 1 : 0; + + if (nA > 0) + { + m_aryMA[0] -= m_rbAdaptA[0]; + m_aryMA[1] -= m_rbAdaptA[-1]; + m_aryMA[2] -= m_rbAdaptA[-2]; + m_aryMA[3] -= m_rbAdaptA[-3]; + + m_aryMB[0] -= m_rbAdaptB[0]; + m_aryMB[1] -= m_rbAdaptB[-1]; + m_aryMB[2] -= m_rbAdaptB[-2]; + m_aryMB[3] -= m_rbAdaptB[-3]; + m_aryMB[4] -= m_rbAdaptB[-4]; + } + else if (nA < 0) + { + m_aryMA[0] += m_rbAdaptA[0]; + m_aryMA[1] += m_rbAdaptA[-1]; + m_aryMA[2] += m_rbAdaptA[-2]; + m_aryMA[3] += m_rbAdaptA[-3]; + + m_aryMB[0] += m_rbAdaptB[0]; + m_aryMB[1] += m_rbAdaptB[-1]; + m_aryMB[2] += m_rbAdaptB[-2]; + m_aryMB[3] += m_rbAdaptB[-3]; + m_aryMB[4] += m_rbAdaptB[-4]; + } + + int nRetVal = m_Stage1FilterA.Decompress(nCurrentA); + m_nLastValueA = nCurrentA; + + m_rbPredictionA.IncrementFast(); m_rbPredictionB.IncrementFast(); + m_rbAdaptA.IncrementFast(); m_rbAdaptB.IncrementFast(); + + m_nCurrentIndex++; + + return nRetVal; +} diff --git a/Libraries/MAC/Files/Source/MACLib/NewPredictor.h b/Libraries/MAC/Files/Source/MACLib/NewPredictor.h new file mode 100755 index 000000000..02ae5eb68 --- /dev/null +++ b/Libraries/MAC/Files/Source/MACLib/NewPredictor.h @@ -0,0 +1,111 @@ +#ifndef APE_NEWPREDICTOR_H +#define APE_NEWPREDICTOR_H + +#include "Predictor.h" + +#include "RollBuffer.h" +#include "NNFilter.h" +#include "ScaledFirstOrderFilter.h" + +/************************************************************************************************* +Functions to create the interfaces +*************************************************************************************************/ +IPredictorCompress * __stdcall CreateIPredictorCompress(); +IPredictorDecompress * __stdcall CreateIPredictorDecompress(); + +#define WINDOW_BLOCKS 512 + +#define BUFFER_COUNT 1 +#define HISTORY_ELEMENTS 8 +#define M_COUNT 8 + +class CPredictorCompressNormal : public IPredictorCompress +{ +public: + CPredictorCompressNormal(int nCompressionLevel); + virtual ~CPredictorCompressNormal(); + + int CompressValue(int nA, int nB = 0); + int Flush(); + +protected: + + // buffer information + CRollBufferFast m_rbPrediction; + CRollBufferFast m_rbAdapt; + + CScaledFirstOrderFilter<31, 5> m_Stage1FilterA; + CScaledFirstOrderFilter<31, 5> m_Stage1FilterB; + + // adaption + int m_aryM[9]; + + // other + int m_nCurrentIndex; + CNNFilter * m_pNNFilter; + CNNFilter * m_pNNFilter1; + CNNFilter * m_pNNFilter2; +}; + +class CPredictorDecompressNormal3930to3950 : public IPredictorDecompress +{ +public: + CPredictorDecompressNormal3930to3950(int nCompressionLevel, int nVersion); + virtual ~CPredictorDecompressNormal3930to3950(); + + int DecompressValue(int nInput, int); + int Flush(); + +protected: + + // buffer information + int * m_pBuffer[BUFFER_COUNT]; + + // adaption + int m_aryM[M_COUNT]; + + // buffer pointers + int * m_pInputBuffer; + + // other + int m_nCurrentIndex; + int m_nLastValue; + CNNFilter * m_pNNFilter; + CNNFilter * m_pNNFilter1; +}; + +class CPredictorDecompress3950toCurrent : public IPredictorDecompress +{ +public: + CPredictorDecompress3950toCurrent(int nCompressionLevel, int nVersion); + virtual ~CPredictorDecompress3950toCurrent(); + + int DecompressValue(int nA, int nB = 0); + int Flush(); + +protected: + + // adaption + int m_aryMA[M_COUNT]; + int m_aryMB[M_COUNT]; + + // buffer pointers + CRollBufferFast m_rbPredictionA; + CRollBufferFast m_rbPredictionB; + + CRollBufferFast m_rbAdaptA; + CRollBufferFast m_rbAdaptB; + + CScaledFirstOrderFilter<31, 5> m_Stage1FilterA; + CScaledFirstOrderFilter<31, 5> m_Stage1FilterB; + + // other + int m_nCurrentIndex; + int m_nLastValueA; + int m_nVersion; + CNNFilter * m_pNNFilter; + CNNFilter * m_pNNFilter1; + CNNFilter * m_pNNFilter2; +}; + +#endif // #ifndef APE_NEWPREDICTOR_H diff --git a/Libraries/MAC/Files/Source/MACLib/Old/APEDecompressCore.cpp b/Libraries/MAC/Files/Source/MACLib/Old/APEDecompressCore.cpp new file mode 100755 index 000000000..9dee2a87a --- /dev/null +++ b/Libraries/MAC/Files/Source/MACLib/Old/APEDecompressCore.cpp @@ -0,0 +1,179 @@ +#include "All.h" +#ifdef BACKWARDS_COMPATIBILITY + +#include "UnMAC.h" +#include "APEDecompressCore.h" +#include "../APEInfo.h" +#include "GlobalFunctions.h" +#include "../UnBitArrayBase.h" +#include "Anti-Predictor.h" +#include "UnMAC.h" +#include "../Prepare.h" +#include "../UnBitArray.h" +#include "../Assembly/Assembly.h" + +CAPEDecompressCore::CAPEDecompressCore(CIO * pIO, IAPEDecompress * pAPEDecompress) +{ + m_pAPEDecompress = pAPEDecompress; + + // initialize the bit array + m_pUnBitArray = CreateUnBitArray(pAPEDecompress, pAPEDecompress->GetInfo(APE_INFO_FILE_VERSION)); + + if (m_pAPEDecompress->GetInfo(APE_INFO_FILE_VERSION) >= 3930) + throw(0); + + m_pAntiPredictorX = CreateAntiPredictor(pAPEDecompress->GetInfo(APE_INFO_COMPRESSION_LEVEL), pAPEDecompress->GetInfo(APE_INFO_FILE_VERSION)); + m_pAntiPredictorY = CreateAntiPredictor(pAPEDecompress->GetInfo(APE_INFO_COMPRESSION_LEVEL), pAPEDecompress->GetInfo(APE_INFO_FILE_VERSION)); + + m_pDataX = new int [pAPEDecompress->GetInfo(APE_INFO_BLOCKS_PER_FRAME) + 16]; + m_pDataY = new int [pAPEDecompress->GetInfo(APE_INFO_BLOCKS_PER_FRAME) + 16]; + m_pTempData = new int [pAPEDecompress->GetInfo(APE_INFO_BLOCKS_PER_FRAME) + 16]; + + m_nBlocksProcessed = 0; + + // check to see if MMX is available + m_bMMXAvailable = GetMMXAvailable(); + +} + +CAPEDecompressCore::~CAPEDecompressCore() +{ + SAFE_DELETE(m_pUnBitArray) + + SAFE_DELETE(m_pAntiPredictorX) + SAFE_DELETE(m_pAntiPredictorY) + + SAFE_ARRAY_DELETE(m_pDataX) + SAFE_ARRAY_DELETE(m_pDataY) + SAFE_ARRAY_DELETE(m_pTempData) +} + +void CAPEDecompressCore::GenerateDecodedArrays(int nBlocks, int nSpecialCodes, int nFrameIndex, int nCPULoadBalancingFactor) +{ + CUnBitArray * pBitArray = (CUnBitArray *) m_pUnBitArray; + + if (m_pAPEDecompress->GetInfo(APE_INFO_CHANNELS) == 2) + { + if ((nSpecialCodes & SPECIAL_FRAME_LEFT_SILENCE) && (nSpecialCodes & SPECIAL_FRAME_RIGHT_SILENCE)) + { + memset(m_pDataX, 0, nBlocks * 4); + memset(m_pDataY, 0, nBlocks * 4); + } + else if (nSpecialCodes & SPECIAL_FRAME_PSEUDO_STEREO) + { + GenerateDecodedArray(m_pDataX, nBlocks, nFrameIndex, m_pAntiPredictorX, nCPULoadBalancingFactor); + memset(m_pDataY, 0, nBlocks * 4); + } + else + { + GenerateDecodedArray(m_pDataX, nBlocks, nFrameIndex, m_pAntiPredictorX, nCPULoadBalancingFactor); + GenerateDecodedArray(m_pDataY, nBlocks, nFrameIndex, m_pAntiPredictorY, nCPULoadBalancingFactor); + } + } + else + { + if (nSpecialCodes & SPECIAL_FRAME_LEFT_SILENCE) + { + memset(m_pDataX, 0, nBlocks * 4); + } + else + { + GenerateDecodedArray(m_pDataX, nBlocks, nFrameIndex, m_pAntiPredictorX, nCPULoadBalancingFactor); + } + } +} + + +void CAPEDecompressCore::GenerateDecodedArray(int * Input_Array, uint32 Number_of_Elements, int Frame_Index, CAntiPredictor *pAntiPredictor, int CPULoadBalancingFactor) +{ + const int nFrameBytes = m_pAPEDecompress->GetInfo(APE_INFO_FRAME_BYTES, Frame_Index); + + // run the prediction sequence + switch (m_pAPEDecompress->GetInfo(APE_INFO_COMPRESSION_LEVEL)) + { + +#ifdef ENABLE_COMPRESSION_MODE_FAST + case COMPRESSION_LEVEL_FAST: + if (m_pAPEDecompress->GetInfo(APE_INFO_FILE_VERSION) < 3320) + { + m_pUnBitArray->GenerateArray(m_pTempData, Number_of_Elements, nFrameBytes); + pAntiPredictor->AntiPredict(m_pTempData, Input_Array, Number_of_Elements); + } + else + { + m_pUnBitArray->GenerateArray(Input_Array, Number_of_Elements, nFrameBytes); + pAntiPredictor->AntiPredict(Input_Array, NULL, Number_of_Elements); + } + + break; +#endif // #ifdef ENABLE_COMPRESSION_MODE_FAST + +#ifdef ENABLE_COMPRESSION_MODE_NORMAL + + case COMPRESSION_LEVEL_NORMAL: + { + // get the array from the bitstream + m_pUnBitArray->GenerateArray(m_pTempData, Number_of_Elements, nFrameBytes); + pAntiPredictor->AntiPredict(m_pTempData, Input_Array, Number_of_Elements); + break; + } + +#endif // #ifdef ENABLE_COMPRESSION_MODE_NORMAL + +#ifdef ENABLE_COMPRESSION_MODE_HIGH + case COMPRESSION_LEVEL_HIGH: + // get the array from the bitstream + m_pUnBitArray->GenerateArray(m_pTempData, Number_of_Elements, nFrameBytes); + pAntiPredictor->AntiPredict(m_pTempData, Input_Array, Number_of_Elements); + break; +#endif // #ifdef ENABLE_COMPRESSION_MODE_HIGH + +#ifdef ENABLE_COMPRESSION_MODE_EXTRA_HIGH + case COMPRESSION_LEVEL_EXTRA_HIGH: + + unsigned int aryCoefficientsA[64], aryCoefficientsB[64], nNumberOfCoefficients; + + #define GET_COEFFICIENTS(NumberOfCoefficientsBits, ValueBits) \ + nNumberOfCoefficients = m_pUnBitArray->DecodeValue(DECODE_VALUE_METHOD_X_BITS, NumberOfCoefficientsBits); \ + for (unsigned int z = 0; z <= nNumberOfCoefficients; z++) \ + { \ + aryCoefficientsA[z] = m_pUnBitArray->DecodeValue(DECODE_VALUE_METHOD_X_BITS, ValueBits); \ + aryCoefficientsB[z] = m_pUnBitArray->DecodeValue(DECODE_VALUE_METHOD_X_BITS, ValueBits); \ + } \ + + if (m_pAPEDecompress->GetInfo(APE_INFO_FILE_VERSION) < 3320) + { + GET_COEFFICIENTS(4, 6) + m_pUnBitArray->GenerateArray(m_pTempData, Number_of_Elements, nFrameBytes); + ((CAntiPredictorExtraHigh0000To3320 *) pAntiPredictor)->AntiPredict(m_pTempData, Input_Array, Number_of_Elements, nNumberOfCoefficients, &aryCoefficientsA[0], &aryCoefficientsB[0]); + } + else if (m_pAPEDecompress->GetInfo(APE_INFO_FILE_VERSION) < 3600) + { + GET_COEFFICIENTS(3, 5) + m_pUnBitArray->GenerateArray(m_pTempData, Number_of_Elements, nFrameBytes); + ((CAntiPredictorExtraHigh3320To3600 *) pAntiPredictor)->AntiPredict(m_pTempData, Input_Array, Number_of_Elements, nNumberOfCoefficients, &aryCoefficientsA[0], &aryCoefficientsB[0]); + } + else if (m_pAPEDecompress->GetInfo(APE_INFO_FILE_VERSION) < 3700) + { + GET_COEFFICIENTS(3, 6) + m_pUnBitArray->GenerateArray(m_pTempData, Number_of_Elements, nFrameBytes); + ((CAntiPredictorExtraHigh3600To3700 *) pAntiPredictor)->AntiPredict(m_pTempData, Input_Array, Number_of_Elements, nNumberOfCoefficients, &aryCoefficientsA[0], &aryCoefficientsB[0]); + } + else if (m_pAPEDecompress->GetInfo(APE_INFO_FILE_VERSION) < 3800) + { + GET_COEFFICIENTS(3, 6) + m_pUnBitArray->GenerateArray(m_pTempData, Number_of_Elements, nFrameBytes); + ((CAntiPredictorExtraHigh3700To3800 *) pAntiPredictor)->AntiPredict(m_pTempData, Input_Array, Number_of_Elements, nNumberOfCoefficients, &aryCoefficientsA[0], &aryCoefficientsB[0]); + } + else + { + m_pUnBitArray->GenerateArray(m_pTempData, Number_of_Elements, nFrameBytes); + ((CAntiPredictorExtraHigh3800ToCurrent *) pAntiPredictor)->AntiPredict(m_pTempData, Input_Array, Number_of_Elements, m_bMMXAvailable, CPULoadBalancingFactor, m_pAPEDecompress->GetInfo(APE_INFO_FILE_VERSION)); + } + + break; +#endif // #ifdef ENABLE_COMPRESSION_MODE_EXTRA_HIGH + } +} + +#endif // #ifdef BACKWARDS_COMPATIBILITY diff --git a/Libraries/MAC/Files/Source/MACLib/Old/APEDecompressCore.h b/Libraries/MAC/Files/Source/MACLib/Old/APEDecompressCore.h new file mode 100755 index 000000000..17982495c --- /dev/null +++ b/Libraries/MAC/Files/Source/MACLib/Old/APEDecompressCore.h @@ -0,0 +1,37 @@ +#ifndef APE_DECOMPRESS_CORE_H +#define APE_DECOMPRESS_CORE_H + +class CAPEDecompressCore +{ +public: + + CAPEDecompressCore(CIO * pIO, IAPEDecompress * pAPEDecompress); + ~CAPEDecompressCore(); + + void GenerateDecodedArrays(int nBlocks, int nSpecialCodes, int nFrameIndex, int nCPULoadBalancingFactor); + void GenerateDecodedArray(int *Input_Array, uint32 Number_of_Elements, int Frame_Index, CAntiPredictor *pAntiPredictor, int CPULoadBalancingFactor = 0); + + int * GetDataX() { return m_pDataX; } + int * GetDataY() { return m_pDataY; } + + CUnBitArrayBase * GetUnBitArrray() { return m_pUnBitArray; } + + int * m_pTempData; + int * m_pDataX; + int * m_pDataY; + + CAntiPredictor * m_pAntiPredictorX; + CAntiPredictor * m_pAntiPredictorY; + + CUnBitArrayBase * m_pUnBitArray; + BIT_ARRAY_STATE m_BitArrayStateX; + BIT_ARRAY_STATE m_BitArrayStateY; + + IAPEDecompress * m_pAPEDecompress; + + BOOL m_bMMXAvailable; + int m_nBlocksProcessed; +}; + + +#endif // #ifndef APE_DECOMPRESS_CORE_H \ No newline at end of file diff --git a/Libraries/MAC/Files/Source/MACLib/Old/APEDecompressOld.cpp b/Libraries/MAC/Files/Source/MACLib/Old/APEDecompressOld.cpp new file mode 100755 index 000000000..604cfd1c8 --- /dev/null +++ b/Libraries/MAC/Files/Source/MACLib/Old/APEDecompressOld.cpp @@ -0,0 +1,279 @@ +#include "All.h" + +#ifdef BACKWARDS_COMPATIBILITY + +#include "UnMAC.h" +#include "APEDecompressOld.h" +#include "../APEInfo.h" + +CAPEDecompressOld::CAPEDecompressOld(int * pErrorCode, CAPEInfo * pAPEInfo, int nStartBlock, int nFinishBlock) +{ + *pErrorCode = ERROR_SUCCESS; + + // open / analyze the file + m_spAPEInfo.Assign(pAPEInfo); + + // version check (this implementation only works with 3.92 and earlier files) + if (GetInfo(APE_INFO_FILE_VERSION) > 3920) + { + *pErrorCode = ERROR_UNDEFINED; + return; + } + + // create the buffer + m_nBlockAlign = GetInfo(APE_INFO_BLOCK_ALIGN); + + // initialize other stuff + m_nBufferTail = 0; + m_bDecompressorInitialized = FALSE; + m_nCurrentFrame = 0; + m_nCurrentBlock = 0; + + // set the "real" start and finish blocks + m_nStartBlock = (nStartBlock < 0) ? 0 : min(nStartBlock, GetInfo(APE_INFO_TOTAL_BLOCKS)); + m_nFinishBlock = (nFinishBlock < 0) ? GetInfo(APE_INFO_TOTAL_BLOCKS) : min(nFinishBlock, GetInfo(APE_INFO_TOTAL_BLOCKS)); + m_bIsRanged = (m_nStartBlock != 0) || (m_nFinishBlock != GetInfo(APE_INFO_TOTAL_BLOCKS)); +} + +CAPEDecompressOld::~CAPEDecompressOld() +{ + +} + +int CAPEDecompressOld::InitializeDecompressor() +{ + // check if we have anything to do + if (m_bDecompressorInitialized) + return ERROR_SUCCESS; + + // initialize the decoder + RETURN_ON_ERROR(m_UnMAC.Initialize(this)) + + int nMaximumDecompressedFrameBytes = m_nBlockAlign * GetInfo(APE_INFO_BLOCKS_PER_FRAME); + int nTotalBufferBytes = max(65536, (nMaximumDecompressedFrameBytes + 16) * 2); + m_spBuffer.Assign(new char [nTotalBufferBytes], TRUE); + if (m_spBuffer == NULL) + return ERROR_INSUFFICIENT_MEMORY; + + // update the initialized flag + m_bDecompressorInitialized = TRUE; + + // seek to the beginning + return Seek(0); +} + +int CAPEDecompressOld::GetData(char * pBuffer, int nBlocks, int * pBlocksRetrieved) +{ + if (pBlocksRetrieved) *pBlocksRetrieved = 0; + + RETURN_ON_ERROR(InitializeDecompressor()) + + // cap + int nBlocksUntilFinish = m_nFinishBlock - m_nCurrentBlock; + nBlocks = min(nBlocks, nBlocksUntilFinish); + + int nBlocksRetrieved = 0; + + // fulfill as much of the request as possible + int nTotalBytesNeeded = nBlocks * m_nBlockAlign; + int nBytesLeft = nTotalBytesNeeded; + int nBlocksDecoded = 1; + + while (nBytesLeft > 0 && nBlocksDecoded > 0) + { + // empty the buffer + int nBytesAvailable = m_nBufferTail; + int nIntialBytes = min(nBytesLeft, nBytesAvailable); + if (nIntialBytes > 0) + { + memcpy(&pBuffer[nTotalBytesNeeded - nBytesLeft], &m_spBuffer[0], nIntialBytes); + + if ((m_nBufferTail - nIntialBytes) > 0) + memmove(&m_spBuffer[0], &m_spBuffer[nIntialBytes], m_nBufferTail - nIntialBytes); + + nBytesLeft -= nIntialBytes; + m_nBufferTail -= nIntialBytes; + + } + + // decode more + if (nBytesLeft > 0) + { + nBlocksDecoded = m_UnMAC.DecompressFrame((unsigned char *) &m_spBuffer[m_nBufferTail], m_nCurrentFrame++, 0); + if (nBlocksDecoded == -1) + { + return -1; + } + m_nBufferTail += (nBlocksDecoded * m_nBlockAlign); + } + } + + nBlocksRetrieved = (nTotalBytesNeeded - nBytesLeft) / m_nBlockAlign; + + // update the position + m_nCurrentBlock += nBlocksRetrieved; + + if (pBlocksRetrieved) *pBlocksRetrieved = nBlocksRetrieved; + + return ERROR_SUCCESS; +} + +int CAPEDecompressOld::Seek(int nBlockOffset) +{ + RETURN_ON_ERROR(InitializeDecompressor()) + + // use the offset + nBlockOffset += m_nStartBlock; + + // cap (to prevent seeking too far) + if (nBlockOffset >= m_nFinishBlock) + nBlockOffset = m_nFinishBlock - 1; + if (nBlockOffset < m_nStartBlock) + nBlockOffset = m_nStartBlock; + + // flush the buffer + m_nBufferTail = 0; + + // seek to the perfect location + int nBaseFrame = nBlockOffset / GetInfo(APE_INFO_BLOCKS_PER_FRAME); + int nBlocksToSkip = nBlockOffset % GetInfo(APE_INFO_BLOCKS_PER_FRAME); + int nBytesToSkip = nBlocksToSkip * m_nBlockAlign; + + // skip necessary blocks + int nMaximumDecompressedFrameBytes = m_nBlockAlign * GetInfo(APE_INFO_BLOCKS_PER_FRAME); + char *pTempBuffer = new char [nMaximumDecompressedFrameBytes + 16]; + ZeroMemory(pTempBuffer, nMaximumDecompressedFrameBytes + 16); + + m_nCurrentFrame = nBaseFrame; + + int nBlocksDecoded = m_UnMAC.DecompressFrame((unsigned char *) pTempBuffer, m_nCurrentFrame++, 0); + + if (nBlocksDecoded == -1) + { + return -1; + } + + int nBytesToKeep = (nBlocksDecoded * m_nBlockAlign) - nBytesToSkip; + memcpy(&m_spBuffer[m_nBufferTail], &pTempBuffer[nBytesToSkip], nBytesToKeep); + m_nBufferTail += nBytesToKeep; + + delete [] pTempBuffer; + + + m_nCurrentBlock = nBlockOffset; + + return ERROR_SUCCESS; +} + +int CAPEDecompressOld::GetInfo(APE_DECOMPRESS_FIELDS Field, int nParam1, int nParam2) +{ + int nRetVal = 0; + BOOL bHandled = TRUE; + + switch (Field) + { + case APE_DECOMPRESS_CURRENT_BLOCK: + nRetVal = m_nCurrentBlock - m_nStartBlock; + break; + case APE_DECOMPRESS_CURRENT_MS: + { + int nSampleRate = m_spAPEInfo->GetInfo(APE_INFO_SAMPLE_RATE, 0, 0); + if (nSampleRate > 0) + nRetVal = int((double(m_nCurrentBlock) * double(1000)) / double(nSampleRate)); + break; + } + case APE_DECOMPRESS_TOTAL_BLOCKS: + nRetVal = m_nFinishBlock - m_nStartBlock; + break; + case APE_DECOMPRESS_LENGTH_MS: + { + int nSampleRate = m_spAPEInfo->GetInfo(APE_INFO_SAMPLE_RATE, 0, 0); + if (nSampleRate > 0) + nRetVal = int((double(m_nFinishBlock - m_nStartBlock) * double(1000)) / double(nSampleRate)); + break; + } + case APE_DECOMPRESS_CURRENT_BITRATE: + nRetVal = GetInfo(APE_INFO_FRAME_BITRATE, m_nCurrentFrame); + break; + case APE_DECOMPRESS_AVERAGE_BITRATE: + { + if (m_bIsRanged) + { + // figure the frame range + const int nBlocksPerFrame = GetInfo(APE_INFO_BLOCKS_PER_FRAME); + int nStartFrame = m_nStartBlock / nBlocksPerFrame; + int nFinishFrame = (m_nFinishBlock + nBlocksPerFrame - 1) / nBlocksPerFrame; + + // get the number of bytes in the first and last frame + int nTotalBytes = (GetInfo(APE_INFO_FRAME_BYTES, nStartFrame) * (m_nStartBlock % nBlocksPerFrame)) / nBlocksPerFrame; + if (nFinishFrame != nStartFrame) + nTotalBytes += (GetInfo(APE_INFO_FRAME_BYTES, nFinishFrame) * (m_nFinishBlock % nBlocksPerFrame)) / nBlocksPerFrame; + + // get the number of bytes in between + const int nTotalFrames = GetInfo(APE_INFO_TOTAL_FRAMES); + for (int nFrame = nStartFrame + 1; (nFrame < nFinishFrame) && (nFrame < nTotalFrames); nFrame++) + nTotalBytes += GetInfo(APE_INFO_FRAME_BYTES, nFrame); + + // figure the bitrate + int nTotalMS = int((double(m_nFinishBlock - m_nStartBlock) * double(1000)) / double(GetInfo(APE_INFO_SAMPLE_RATE))); + if (nTotalMS != 0) + nRetVal = (nTotalBytes * 8) / nTotalMS; + } + else + { + nRetVal = GetInfo(APE_INFO_AVERAGE_BITRATE); + } + + break; + } + default: + bHandled = FALSE; + } + + if (!bHandled && m_bIsRanged) + { + bHandled = TRUE; + + switch (Field) + { + case APE_INFO_WAV_HEADER_BYTES: + nRetVal = sizeof(WAVE_HEADER); + break; + case APE_INFO_WAV_HEADER_DATA: + { + char * pBuffer = (char *) nParam1; + int nMaxBytes = nParam2; + + if (sizeof(WAVE_HEADER) > nMaxBytes) + { + nRetVal = -1; + } + else + { + WAVEFORMATEX wfeFormat; GetInfo(APE_INFO_WAVEFORMATEX, (int) &wfeFormat, 0); + WAVE_HEADER WAVHeader; FillWaveHeader(&WAVHeader, + (m_nFinishBlock - m_nStartBlock) * GetInfo(APE_INFO_BLOCK_ALIGN), + &wfeFormat, 0); + memcpy(pBuffer, &WAVHeader, sizeof(WAVE_HEADER)); + nRetVal = 0; + } + break; + } + case APE_INFO_WAV_TERMINATING_BYTES: + nRetVal = 0; + break; + case APE_INFO_WAV_TERMINATING_DATA: + nRetVal = 0; + break; + default: + bHandled = FALSE; + } + } + + if (bHandled == FALSE) + nRetVal = m_spAPEInfo->GetInfo(Field, nParam1, nParam2); + + return nRetVal; +} + +#endif // #ifdef BACKWARDS_COMPATIBILITY diff --git a/Libraries/MAC/Files/Source/MACLib/Old/APEDecompressOld.h b/Libraries/MAC/Files/Source/MACLib/Old/APEDecompressOld.h new file mode 100755 index 000000000..ae590a5f0 --- /dev/null +++ b/Libraries/MAC/Files/Source/MACLib/Old/APEDecompressOld.h @@ -0,0 +1,43 @@ +#ifndef _apedecompressold_h_ +#define _apedecompressold_h_ + +#include "../APEDecompress.h" +#include "UnMAC.h" + +class CAPEDecompressOld : public IAPEDecompress +{ +public: + CAPEDecompressOld(int * pErrorCode, CAPEInfo * pAPEInfo, int nStartBlock = -1, int nFinishBlock = -1); + ~CAPEDecompressOld(); + + int GetData(char * pBuffer, int nBlocks, int * pBlocksRetrieved); + int Seek(int nBlockOffset); + + int GetInfo(APE_DECOMPRESS_FIELDS Field, int nParam1 = 0, int nParam2 = 0); + +protected: + + // buffer + CSmartPtr m_spBuffer; + int m_nBufferTail; + + // file info + int m_nBlockAlign; + int m_nCurrentFrame; + + // start / finish information + int m_nStartBlock; + int m_nFinishBlock; + int m_nCurrentBlock; + BOOL m_bIsRanged; + + // decoding tools + CUnMAC m_UnMAC; + CSmartPtr m_spAPEInfo; + + BOOL m_bDecompressorInitialized; + int InitializeDecompressor(); +}; + +#endif //_apedecompressold_h_ + diff --git a/Libraries/MAC/Files/Source/MACLib/Old/Anti-Predictor.cpp b/Libraries/MAC/Files/Source/MACLib/Old/Anti-Predictor.cpp new file mode 100755 index 000000000..954d099f0 --- /dev/null +++ b/Libraries/MAC/Files/Source/MACLib/Old/Anti-Predictor.cpp @@ -0,0 +1,394 @@ +#include "All.h" +#ifdef BACKWARDS_COMPATIBILITY + +#include "../MACLib.h" +#include "Anti-Predictor.h" + +CAntiPredictor * CreateAntiPredictor(int nCompressionLevel, int nVersion) +{ + CAntiPredictor *pAntiPredictor = NULL; + + switch (nCompressionLevel) + { +#ifdef ENABLE_COMPRESSION_MODE_FAST + case COMPRESSION_LEVEL_FAST: + if (nVersion < 3320) + { + pAntiPredictor = (CAntiPredictor *) new CAntiPredictorFast0000To3320; + } + else + { + pAntiPredictor = (CAntiPredictor *) new CAntiPredictorFast3320ToCurrent; + } + break; +#endif //ENABLE_COMPRESSION_MODE_FAST + +#ifdef ENABLE_COMPRESSION_MODE_NORMAL + + case COMPRESSION_LEVEL_NORMAL: + if (nVersion < 3320) + { + pAntiPredictor = (CAntiPredictor *) new CAntiPredictorNormal0000To3320; + } + else if (nVersion < 3800) + { + pAntiPredictor = (CAntiPredictor *) new CAntiPredictorNormal3320To3800; + } + else + { + pAntiPredictor = (CAntiPredictor *) new CAntiPredictorNormal3800ToCurrent; + } + break; + +#endif //ENABLE_COMPRESSION_MODE_NORMAL + +#ifdef ENABLE_COMPRESSION_MODE_HIGH + case COMPRESSION_LEVEL_HIGH: + if (nVersion < 3320) + { + pAntiPredictor = (CAntiPredictor *) new CAntiPredictorHigh0000To3320; + } + else if (nVersion < 3600) + { + pAntiPredictor = (CAntiPredictor *) new CAntiPredictorHigh3320To3600; + } + else if (nVersion < 3700) + { + pAntiPredictor = (CAntiPredictor *) new CAntiPredictorHigh3600To3700; + } + else if (nVersion < 3800) + { + pAntiPredictor = (CAntiPredictor *) new CAntiPredictorHigh3700To3800; + } + else + { + pAntiPredictor = (CAntiPredictor *) new CAntiPredictorHigh3800ToCurrent; + } + break; +#endif //ENABLE_COMPRESSION_MODE_HIGH + +#ifdef ENABLE_COMPRESSION_MODE_EXTRA_HIGH + case COMPRESSION_LEVEL_EXTRA_HIGH: + if (nVersion < 3320) + { + pAntiPredictor = (CAntiPredictor *) new CAntiPredictorExtraHigh0000To3320; + } + else if (nVersion < 3600) + { + pAntiPredictor = (CAntiPredictor *) new CAntiPredictorExtraHigh3320To3600; + } + else if (nVersion < 3700) + { + pAntiPredictor = (CAntiPredictor *) new CAntiPredictorExtraHigh3600To3700; + } + else if (nVersion < 3800) + { + pAntiPredictor = (CAntiPredictor *) new CAntiPredictorExtraHigh3700To3800; + } + else + { + pAntiPredictor = (CAntiPredictor *) new CAntiPredictorExtraHigh3800ToCurrent; + } + break; +#endif //ENABLE_COMPRESSION_MODE_EXTRA_HIGH + } + + return pAntiPredictor; +} + + + +CAntiPredictor::CAntiPredictor() +{ +} + +CAntiPredictor::~CAntiPredictor() +{ +} + +void CAntiPredictor::AntiPredict(int *pInputArray, int *pOutputArray, int NumberOfElements) +{ + return; +} + +void CAntiPredictorOffset::AntiPredict(int *pInputArray, int *pOutputArray, int NumberOfElements, int Offset, int DeltaM) +{ + + memcpy(pOutputArray, pInputArray, Offset * 4); + + int *ip = &pInputArray[Offset]; + int *ipo = &pOutputArray[0]; + int *op = &pOutputArray[Offset]; + int m = 0; + + for (; op < &pOutputArray[NumberOfElements]; ip++, ipo++, op++) + { + *op = *ip + ((*ipo * m) >> 12); + + (*ipo ^ *ip) > 0 ? m += DeltaM : m -= DeltaM; + } +} + +#ifdef ENABLE_COMPRESSION_MODE_EXTRA_HIGH + +int CAntiPredictorExtraHighHelper::ConventionalDotProduct(short *bip, short *bbm, short *pIPAdaptFactor, int op, int nNumberOfIterations) +{ + // dot product + int nDotProduct = 0; + short *pMaxBBM = &bbm[nNumberOfIterations]; + + if (op == 0) + { + while(bbm < pMaxBBM) + { + EXPAND_32_TIMES(nDotProduct += *bip++ * *bbm++;) + } + } + else if (op > 0) + { + while(bbm < pMaxBBM) + { + EXPAND_32_TIMES(nDotProduct += *bip++ * *bbm; *bbm++ += *pIPAdaptFactor++;) + } + } + else + { + while(bbm < pMaxBBM) + { + EXPAND_32_TIMES(nDotProduct += *bip++ * *bbm; *bbm++ -= *pIPAdaptFactor++;) + } + } + + // use the dot product + return nDotProduct; +} + +#ifdef ENABLE_ASSEMBLY + +#define MMX_DOT_PRODUCT_3800_TO_CURRENT_PROCESS_CHUNK_HEAD \ + __asm movq mm0, [esi] \ + __asm add esi, 8 \ + __asm movq mm1, [esi] \ + __asm add esi, 8 \ + __asm movq mm2, [esi] \ + __asm add esi, 8 \ + \ + __asm movq mm3, [edi] \ + __asm add edi, 8 \ + __asm movq mm4, [edi] \ + __asm add edi, 8 \ + __asm movq mm5, [edi] \ + __asm sub edi, 16 \ + \ + __asm pmaddwd mm0, mm3 \ + __asm pmaddwd mm1, mm4 \ + __asm pmaddwd mm2, mm5 \ + \ + __asm paddd mm7, mm0 \ + __asm paddd mm7, mm1 \ + __asm paddd mm7, mm2 \ + + +#define MMX_DOT_PRODUCT_3800_TO_CURRENT_PROCESS_CHUNK_ADD \ + MMX_DOT_PRODUCT_3800_TO_CURRENT_PROCESS_CHUNK_HEAD \ + \ + __asm paddw mm3, DWORD PTR [eax] \ + __asm movq [edi], mm3 \ + __asm add eax, 8 \ + __asm add edi, 8 \ + __asm paddw mm4, DWORD PTR [eax] \ + __asm movq [edi], mm4 \ + __asm add eax, 8 \ + __asm add edi, 8 \ + __asm paddw mm5, DWORD PTR [eax] \ + __asm movq [edi], mm5 \ + __asm add eax, 8 \ + __asm add edi, 8 + +#define MMX_DOT_PRODUCT_3800_TO_CURRENT_PROCESS_CHUNK_SUBTRACT \ + MMX_DOT_PRODUCT_3800_TO_CURRENT_PROCESS_CHUNK_HEAD \ + \ + __asm psubw mm3, DWORD PTR [eax] \ + __asm movq [edi], mm3 \ + __asm add eax, 8 \ + __asm add edi, 8 \ + __asm psubw mm4, DWORD PTR [eax] \ + __asm movq [edi], mm4 \ + __asm add eax, 8 \ + __asm add edi, 8 \ + __asm psubw mm5, DWORD PTR [eax] \ + __asm movq [edi], mm5 \ + __asm add eax, 8 \ + __asm add edi, 8 + +int CAntiPredictorExtraHighHelper::MMXDotProduct(short *bip, short *bbm, short *pIPAdaptFactor, int op, int nNumberOfIterations) +{ + int nDotProduct; + nNumberOfIterations = (nNumberOfIterations / 128); + + if (op > 0) + { + __asm + { + push eax + + mov eax, DWORD PTR [pIPAdaptFactor] + + push esi + push edi + + mov esi, DWORD PTR bip[0] + mov edi, DWORD PTR bbm[0] + + pxor mm7, mm7 + +LBL_ADD_AGAIN: + + ///////////////////////////////////////////////////////// + // process 8 mm registers full + ///////////////////////////////////////////////////////// + + MMX_DOT_PRODUCT_3800_TO_CURRENT_PROCESS_CHUNK_ADD + MMX_DOT_PRODUCT_3800_TO_CURRENT_PROCESS_CHUNK_ADD + MMX_DOT_PRODUCT_3800_TO_CURRENT_PROCESS_CHUNK_ADD + MMX_DOT_PRODUCT_3800_TO_CURRENT_PROCESS_CHUNK_ADD + MMX_DOT_PRODUCT_3800_TO_CURRENT_PROCESS_CHUNK_ADD + MMX_DOT_PRODUCT_3800_TO_CURRENT_PROCESS_CHUNK_ADD + MMX_DOT_PRODUCT_3800_TO_CURRENT_PROCESS_CHUNK_ADD + MMX_DOT_PRODUCT_3800_TO_CURRENT_PROCESS_CHUNK_ADD + MMX_DOT_PRODUCT_3800_TO_CURRENT_PROCESS_CHUNK_ADD + MMX_DOT_PRODUCT_3800_TO_CURRENT_PROCESS_CHUNK_ADD + + // fill the registers + movq mm0, [esi] + add esi, 8 + movq mm1, [esi] + add esi, 8 + + movq mm3, [edi] + add edi, 8 + movq mm4, [edi] + sub edi, 8 + + pmaddwd mm0, mm3 + pmaddwd mm1, mm4 + + paddd mm7, mm0 + paddd mm7, mm1 + + paddw mm3, DWORD PTR [eax] + movq [edi], mm3 + add eax, 8 + add edi, 8 + paddw mm4, DWORD PTR [eax] + movq [edi], mm4 + add eax, 8 + add edi, 8 + + sub nNumberOfIterations, 1 + cmp nNumberOfIterations, 0 + jg LBL_ADD_AGAIN + + /////////////////////////////////////////////////////////////// + // clean-up + /////////////////////////////////////////////////////////////// + // mm7 has the final dot-product (split into two dwords) + movq mm6, mm7 + psrlq mm7, 32 + paddd mm6, mm7 + movd nDotProduct, mm6 + + pop edi + pop esi + pop eax + emms + + } + } + else + { + __asm + { + push eax + + mov eax, DWORD PTR [pIPAdaptFactor] + + push esi + push edi + + mov esi, DWORD PTR bip[0] + mov edi, DWORD PTR bbm[0] + + pxor mm7, mm7 + +LBL_SUBTRACT_AGAIN: + + ///////////////////////////////////////////////////////// + // process 8 mm registers full + ///////////////////////////////////////////////////////// + MMX_DOT_PRODUCT_3800_TO_CURRENT_PROCESS_CHUNK_SUBTRACT + MMX_DOT_PRODUCT_3800_TO_CURRENT_PROCESS_CHUNK_SUBTRACT + MMX_DOT_PRODUCT_3800_TO_CURRENT_PROCESS_CHUNK_SUBTRACT + MMX_DOT_PRODUCT_3800_TO_CURRENT_PROCESS_CHUNK_SUBTRACT + MMX_DOT_PRODUCT_3800_TO_CURRENT_PROCESS_CHUNK_SUBTRACT + MMX_DOT_PRODUCT_3800_TO_CURRENT_PROCESS_CHUNK_SUBTRACT + MMX_DOT_PRODUCT_3800_TO_CURRENT_PROCESS_CHUNK_SUBTRACT + MMX_DOT_PRODUCT_3800_TO_CURRENT_PROCESS_CHUNK_SUBTRACT + MMX_DOT_PRODUCT_3800_TO_CURRENT_PROCESS_CHUNK_SUBTRACT + MMX_DOT_PRODUCT_3800_TO_CURRENT_PROCESS_CHUNK_SUBTRACT + + // fill the registers + movq mm0, [esi] + add esi, 8 + movq mm1, [esi] + add esi, 8 + + movq mm3, [edi] + add edi, 8 + movq mm4, [edi] + sub edi, 8 + + pmaddwd mm0, mm3 + pmaddwd mm1, mm4 + + paddd mm7, mm0 + paddd mm7, mm1 + + psubw mm3, DWORD PTR [eax] + movq [edi], mm3 + add eax, 8 + add edi, 8 + psubw mm4, DWORD PTR [eax] + movq [edi], mm4 + add eax, 8 + add edi, 8 + + sub nNumberOfIterations, 1 + cmp nNumberOfIterations, 0 + jg LBL_SUBTRACT_AGAIN + + /////////////////////////////////////////////////////////////// + // clean-up + /////////////////////////////////////////////////////////////// + // mm7 has the final dot-product (split into two dwords) + movq mm6, mm7 + psrlq mm7, 32 + paddd mm6, mm7 + movd nDotProduct, mm6 + + pop edi + pop esi + pop eax + emms + + } + } + + return nDotProduct; +} + +#endif // #ifdef ENABLE_ASSEMBLY + +#endif // #ifdef ENABLE_COMPRESSION_MODE_EXTRA_HIGH + +#endif // #ifdef BACKWARDS_COMPATIBILITY diff --git a/Libraries/MAC/Files/Source/MACLib/Old/Anti-Predictor.h b/Libraries/MAC/Files/Source/MACLib/Old/Anti-Predictor.h new file mode 100755 index 000000000..1aa4c370d --- /dev/null +++ b/Libraries/MAC/Files/Source/MACLib/Old/Anti-Predictor.h @@ -0,0 +1,253 @@ +#ifndef APE_ANTIPREDICTOR_H +#define APE_ANTIPREDICTOR_H + +class CAntiPredictor; + +CAntiPredictor * CreateAntiPredictor(int nCompressionLevel, int nVersion); + +/***************************************************************************************** +Base class for all anti-predictors +*****************************************************************************************/ +class CAntiPredictor +{ +public: + + // construction/destruction + CAntiPredictor(); + ~CAntiPredictor(); + + // functions + virtual void AntiPredict(int *pInputArray, int *pOutputArray, int NumberOfElements); + +}; + +/***************************************************************************************** +Offset anti-predictor +*****************************************************************************************/ +class CAntiPredictorOffset : public CAntiPredictor +{ +public: + + // functions + void AntiPredict(int *pInputArray, int *pOutputArray, int NumberOfElements, int Offset, int DeltaM); +}; + +#ifdef ENABLE_COMPRESSION_MODE_FAST + +/***************************************************************************************** +Fast anti-predictor (from original 'fast' mode...updated for version 3.32) +*****************************************************************************************/ +class CAntiPredictorFast0000To3320 : public CAntiPredictor { + +public: + + // functions + void AntiPredict(int *pInputArray, int *pOutputArray, int NumberOfElements); + +}; + +/***************************************************************************************** +Fast anti-predictor (new 'fast' mode release with version 3.32) +*****************************************************************************************/ +class CAntiPredictorFast3320ToCurrent : public CAntiPredictor { + +public: + + // functions + void AntiPredict(int *pInputArray, int *pOutputArray, int NumberOfElements); + +}; + +#endif // #ifdef ENABLE_COMPRESSION_MODE_FAST + +#ifdef ENABLE_COMPRESSION_MODE_NORMAL +/***************************************************************************************** +Normal anti-predictor +*****************************************************************************************/ +class CAntiPredictorNormal0000To3320 : public CAntiPredictor { + +public: + + // functions + void AntiPredict(int *pInputArray, int *pOutputArray, int NumberOfElements); + +}; + +/***************************************************************************************** +Normal anti-predictor +*****************************************************************************************/ +class CAntiPredictorNormal3320To3800 : public CAntiPredictor { + +public: + + // functions + void AntiPredict(int *pInputArray, int *pOutputArray, int NumberOfElements); + +}; + +/***************************************************************************************** +Normal anti-predictor +*****************************************************************************************/ +class CAntiPredictorNormal3800ToCurrent : public CAntiPredictor { + +public: + + // functions + void AntiPredict(int *pInputArray, int *pOutputArray, int NumberOfElements); + +}; + +#endif // #ifdef ENABLE_COMPRESSION_MODE_NORMAL + +#ifdef ENABLE_COMPRESSION_MODE_HIGH + +/***************************************************************************************** +High anti-predictor +*****************************************************************************************/ +class CAntiPredictorHigh0000To3320 : public CAntiPredictor { + +public: + + // functions + void AntiPredict(int *pInputArray, int *pOutputArray, int NumberOfElements); + +}; + +/***************************************************************************************** +High anti-predictor +*****************************************************************************************/ +class CAntiPredictorHigh3320To3600 : public CAntiPredictor { + +public: + + // functions + void AntiPredict(int *pInputArray, int *pOutputArray, int NumberOfElements); + +}; + +/***************************************************************************************** +High anti-predictor +*****************************************************************************************/ +class CAntiPredictorHigh3600To3700 : public CAntiPredictor { + +public: + + // functions + void AntiPredict(int *pInputArray, int *pOutputArray, int NumberOfElements); + +}; + +/***************************************************************************************** +High anti-predictor +*****************************************************************************************/ +class CAntiPredictorHigh3700To3800 : public CAntiPredictor { + +public: + + // functions + void AntiPredict(int *pInputArray, int *pOutputArray, int NumberOfElements); + +}; + +/***************************************************************************************** +High anti-predictor +*****************************************************************************************/ +class CAntiPredictorHigh3800ToCurrent : public CAntiPredictor { + +public: + + // functions + void AntiPredict(int *pInputArray, int *pOutputArray, int NumberOfElements); + +}; + +#endif // #ifdef ENABLE_COMPRESSION_MODE_HIGH + +#ifdef ENABLE_COMPRESSION_MODE_EXTRA_HIGH + +/***************************************************************************************** +Extra high helper +*****************************************************************************************/ +class CAntiPredictorExtraHighHelper +{ +public: + int ConventionalDotProduct(short *bip, short *bbm, short *pIPAdaptFactor, int op, int nNumberOfIterations); + +#ifdef ENABLE_ASSEMBLY + int MMXDotProduct(short *bip, short *bbm, short *pIPAdaptFactor, int op, int nNumberOfIterations); +#endif // #ifdef ENABLE_ASSEMBLY +}; + + +/***************************************************************************************** +Extra high anti-predictor +*****************************************************************************************/ +class CAntiPredictorExtraHigh0000To3320 : public CAntiPredictor { + +public: + + // functions + void AntiPredict(int *pInputArray, int *pOutputArray, int NumberOfElements, int Iterations, unsigned int *pOffsetValueArrayA, unsigned int *pOffsetValueArrayB); + +private: + void AntiPredictorOffset(int* Input_Array, int* Output_Array, int Number_of_Elements, int g, int dm, int Max_Order); + +}; + +/***************************************************************************************** +Extra high anti-predictor +*****************************************************************************************/ +class CAntiPredictorExtraHigh3320To3600 : public CAntiPredictor { + +public: + + // functions + void AntiPredict(int *pInputArray, int *pOutputArray, int NumberOfElements, int Iterations, unsigned int *pOffsetValueArrayA, unsigned int *pOffsetValueArrayB); + +private: + void AntiPredictorOffset(int* Input_Array, int* Output_Array, int Number_of_Elements, int g, int dm, int Max_Order); +}; + +/***************************************************************************************** +Extra high anti-predictor +*****************************************************************************************/ +class CAntiPredictorExtraHigh3600To3700 : public CAntiPredictor { + +public: + + // functions + void AntiPredict(int *pInputArray, int *pOutputArray, int NumberOfElements, int Iterations, unsigned int *pOffsetValueArrayA, unsigned int *pOffsetValueArrayB); + +private: + void AntiPredictorOffset(int* Input_Array, int* Output_Array, int Number_of_Elements, int g1, int g2, int Max_Order); + +}; + +/***************************************************************************************** +Extra high anti-predictor +*****************************************************************************************/ +class CAntiPredictorExtraHigh3700To3800 : public CAntiPredictor { + +public: + + // functions + void AntiPredict(int *pInputArray, int *pOutputArray, int NumberOfElements, int Iterations, unsigned int *pOffsetValueArrayA, unsigned int *pOffsetValueArrayB); + +private: + void AntiPredictorOffset(int* Input_Array, int* Output_Array, int Number_of_Elements, int g1, int g2, int Max_Order); +}; + +/***************************************************************************************** +Extra high anti-predictor +*****************************************************************************************/ +class CAntiPredictorExtraHigh3800ToCurrent : public CAntiPredictor { + +public: + + // functions + void AntiPredict(int *pInputArray, int *pOutputArray, int NumberOfElements, BOOL bMMXAvailable, int CPULoadBalancingFactor, int nVersion); +}; + +#endif // #ifdef ENABLE_COMPRESSION_MODE_EXTRA_HIGH + +#endif // #ifndef APE_ANTIPREDICTOR_H \ No newline at end of file diff --git a/Libraries/MAC/Files/Source/MACLib/Old/AntiPredictorExtraHigh.cpp b/Libraries/MAC/Files/Source/MACLib/Old/AntiPredictorExtraHigh.cpp new file mode 100755 index 000000000..61974ef0d --- /dev/null +++ b/Libraries/MAC/Files/Source/MACLib/Old/AntiPredictorExtraHigh.cpp @@ -0,0 +1,330 @@ +#include "All.h" +#ifdef BACKWARDS_COMPATIBILITY + +#include "Anti-Predictor.h" + +#ifdef ENABLE_COMPRESSION_MODE_EXTRA_HIGH + +/***************************************************************************************** +Extra high 0000 to 3320 implementation +*****************************************************************************************/ +void CAntiPredictorExtraHigh0000To3320::AntiPredict(int *pInputArray, int *pOutputArray, int NumberOfElements, int Iterations, unsigned int *pOffsetValueArrayA, unsigned int *pOffsetValueArrayB) { + for (int z = Iterations; z >= 0; z--){ + AntiPredictorOffset(pInputArray, pOutputArray, NumberOfElements, pOffsetValueArrayB[z], -1, 64); + AntiPredictorOffset(pOutputArray, pInputArray, NumberOfElements, pOffsetValueArrayA[z], 1, 64); + } + + CAntiPredictorHigh0000To3320 AntiPredictor; + AntiPredictor.AntiPredict(pInputArray, pOutputArray, NumberOfElements); +} + +void CAntiPredictorExtraHigh0000To3320::AntiPredictorOffset(int* Input_Array, int* Output_Array, int Number_of_Elements, int g, int dm, int Max_Order) +{ + int q; + + if ((g==0) || (Number_of_Elements <= Max_Order)) { + memcpy(Output_Array, Input_Array, Number_of_Elements * 4); + return; + } + + memcpy(Output_Array, Input_Array, Max_Order * 4); + + int m = 512; + + if (dm > 0) + for (q = Max_Order; q < Number_of_Elements; q++) { + Output_Array[q] = Input_Array[q] + (Output_Array[q - g] >> 3); + } + + else + for (q = Max_Order; q < Number_of_Elements; q++) { + Output_Array[q] = Input_Array[q] - (Output_Array[q - g] >> 3); + } +} + + +/***************************************************************************************** +Extra high 3320 to 3600 implementation +*****************************************************************************************/ +void CAntiPredictorExtraHigh3320To3600::AntiPredict(int *pInputArray, int *pOutputArray, int NumberOfElements, int Iterations, unsigned int *pOffsetValueArrayA, unsigned int *pOffsetValueArrayB) +{ + for (int z = Iterations; z >= 0; z--) + { + AntiPredictorOffset(pInputArray, pOutputArray, NumberOfElements, pOffsetValueArrayB[z], -1, 32); + AntiPredictorOffset(pOutputArray, pInputArray, NumberOfElements, pOffsetValueArrayA[z], 1, 32); + } + + CAntiPredictorHigh0000To3320 AntiPredictor; + AntiPredictor.AntiPredict(pInputArray, pOutputArray, NumberOfElements); +} + + +void CAntiPredictorExtraHigh3320To3600::AntiPredictorOffset(int* Input_Array, int* Output_Array, int Number_of_Elements, int g, int dm, int Max_Order) +{ + + int q; + + if ((g==0) || (Number_of_Elements <= Max_Order)) { + memcpy(Output_Array, Input_Array, Number_of_Elements * 4); + return; + } + + memcpy(Output_Array, Input_Array, Max_Order * 4); + + int m = 512; + + if (dm > 0) + for (q = Max_Order; q < Number_of_Elements; q++) { + Output_Array[q] = Input_Array[q] + ((Output_Array[q - g] * m) >> 12); + (Input_Array[q] ^ Output_Array[q - g]) > 0 ? m += 8 : m -= 8; + } + + else + for (q = Max_Order; q < Number_of_Elements; q++) { + Output_Array[q] = Input_Array[q] - ((Output_Array[q - g] * m) >> 12); + (Input_Array[q] ^ Output_Array[q - g]) > 0 ? m -= 8 : m += 8; + } +} + + +/***************************************************************************************** +Extra high 3600 to 3700 implementation +*****************************************************************************************/ +void CAntiPredictorExtraHigh3600To3700::AntiPredict(int *pInputArray, int *pOutputArray, int NumberOfElements, int Iterations, unsigned int *pOffsetValueArrayA, unsigned int *pOffsetValueArrayB) { + for (int z = Iterations; z >= 0; ){ + + AntiPredictorOffset(pInputArray, pOutputArray, NumberOfElements, pOffsetValueArrayA[z], pOffsetValueArrayB[z], 64); + z--; + + if (z >= 0) { + AntiPredictorOffset(pOutputArray, pInputArray, NumberOfElements, pOffsetValueArrayA[z], pOffsetValueArrayB[z], 64); + z--; + } + else { + memcpy(pInputArray, pOutputArray, NumberOfElements * 4); + goto Exit_Loop; + z--; + } + } + +Exit_Loop: + CAntiPredictorHigh3600To3700 AntiPredictor; + AntiPredictor.AntiPredict(pInputArray, pOutputArray, NumberOfElements); +} + +void CAntiPredictorExtraHigh3600To3700::AntiPredictorOffset(int* Input_Array, int* Output_Array, int Number_of_Elements, int g1, int g2, int Max_Order) { + int q; + + if ((g1==0) || (g2==0) || (Number_of_Elements <= Max_Order)) { + memcpy(Output_Array, Input_Array, Number_of_Elements * 4); + return; + } + + memcpy(Output_Array, Input_Array, Max_Order * 4); + + int m = 64; + int m2 = 64; + + for (q = Max_Order; q < Number_of_Elements; q++) { + Output_Array[q] = Input_Array[q] + ((Output_Array[q - g1] * m) >> 9) - ((Output_Array[q - g2] * m2) >> 9); + (Input_Array[q] ^ Output_Array[q - g1]) > 0 ? m++ : m--; + (Input_Array[q] ^ Output_Array[q - g2]) > 0 ? m2-- : m2++; + } +} + +/***************************************************************************************** +Extra high 3700 to 3800 implementation +*****************************************************************************************/ +void CAntiPredictorExtraHigh3700To3800::AntiPredict(int *pInputArray, int *pOutputArray, int NumberOfElements, int Iterations, unsigned int *pOffsetValueArrayA, unsigned int *pOffsetValueArrayB) { + for (int z = Iterations; z >= 0; ) { + + AntiPredictorOffset(pInputArray, pOutputArray, NumberOfElements, pOffsetValueArrayA[z], pOffsetValueArrayB[z], 64); + z--; + + if (z >= 0) { + AntiPredictorOffset(pOutputArray, pInputArray, NumberOfElements, pOffsetValueArrayA[z], pOffsetValueArrayB[z], 64); + z--; + } + else { + memcpy(pInputArray, pOutputArray, NumberOfElements * 4); + goto Exit_Loop; + z--; + } + } + +Exit_Loop: + CAntiPredictorHigh3700To3800 AntiPredictor; + AntiPredictor.AntiPredict(pInputArray, pOutputArray, NumberOfElements); + +} + +void CAntiPredictorExtraHigh3700To3800::AntiPredictorOffset(int* Input_Array, int* Output_Array, int Number_of_Elements, int g1, int g2, int Max_Order) { + int q; + + if ((g1==0) || (g2==0) || (Number_of_Elements <= Max_Order)) { + memcpy(Output_Array, Input_Array, Number_of_Elements * 4); + return; + } + + memcpy(Output_Array, Input_Array, Max_Order * 4); + + int m = 64; + int m2 = 64; + + for (q = Max_Order; q < Number_of_Elements; q++) { + Output_Array[q] = Input_Array[q] + ((Output_Array[q - g1] * m) >> 9) - ((Output_Array[q - g2] * m2) >> 9); + (Input_Array[q] ^ Output_Array[q - g1]) > 0 ? m++ : m--; + (Input_Array[q] ^ Output_Array[q - g2]) > 0 ? m2-- : m2++; + } +} + +/***************************************************************************************** +Extra high 3800 to Current +*****************************************************************************************/ +void CAntiPredictorExtraHigh3800ToCurrent::AntiPredict(int *pInputArray, int *pOutputArray, int NumberOfElements, BOOL bMMXAvailable, int CPULoadBalancingFactor, int nVersion) +{ + const int nFilterStageElements = (nVersion < 3830) ? 128 : 256; + const int nFilterStageShift = (nVersion < 3830) ? 11 : 12; + const int nMaxElements = (nVersion < 3830) ? 134 : 262; + const int nFirstElement = (nVersion < 3830) ? 128 : 256; + const int nStageCShift = (nVersion < 3830) ? 10 : 11; + + //short frame handling + if (NumberOfElements < nMaxElements) { + memcpy(pOutputArray, pInputArray, NumberOfElements * 4); + return; + } + + //make the first five samples identical in both arrays + memcpy(pOutputArray, pInputArray, nFirstElement * 4); + + //variable declares and initializations + //short bm[nFirstElement]; memset(bm, 0, nFirstElement * 2); + short bm[256]; memset(bm, 0, 256 * 2); + int m2 = 64, m3 = 115, m4 = 64, m5 = 740, m6 = 0; + int p4 = pInputArray[nFirstElement - 1]; + int p3 = (pInputArray[nFirstElement - 1] - pInputArray[nFirstElement - 2]) << 1; + int p2 = pInputArray[nFirstElement - 1] + ((pInputArray[nFirstElement - 3] - pInputArray[nFirstElement - 2]) << 3);// - pInputArray[3] + pInputArray[2]; + int *op = &pOutputArray[nFirstElement]; + int *ip = &pInputArray[nFirstElement]; + int IPP2 = ip[-2]; + int IPP1 = ip[-1]; + int p7 = 2 * ip[-1] - ip[-2]; + int opp = op[-1]; + int Original; + CAntiPredictorExtraHighHelper Helper; + + //undo the initial prediction stuff + int q; // loop variable + for (q = 1; q < nFirstElement; q++) { + pOutputArray[q] += pOutputArray[q - 1]; + } + + //pump the primary loop + short *IPAdaptFactor = (short *) calloc(NumberOfElements, 2); + short *IPShort = (short *) calloc(NumberOfElements, 2); + for (q = 0; q < nFirstElement; q++) { + IPAdaptFactor[q] = ((pInputArray[q] >> 30) & 2) - 1; + IPShort[q] = short(pInputArray[q]); + } + + int FM[9]; memset(&FM[0], 0, 9 * 4); + int FP[9]; memset(&FP[0], 0, 9 * 4); + + for (q = nFirstElement; op < &pOutputArray[NumberOfElements]; op++, ip++, q++) { + //CPU load-balancing + if (CPULoadBalancingFactor > 0) { + if ((q % CPULoadBalancingFactor) == 0) { SLEEP(1); } + } + + if (nVersion >= 3830) + { + int *pFP = &FP[8]; + int *pFM = &FM[8]; + int nDotProduct = 0; + FP[0] = ip[0]; + + if (FP[0] == 0) + { + EXPAND_8_TIMES(nDotProduct += *pFP * *pFM--; *pFP-- = *(pFP - 1);) + } + else if (FP[0] > 0) + { + EXPAND_8_TIMES(nDotProduct += *pFP * *pFM; *pFM-- += ((*pFP >> 30) & 2) - 1; *pFP-- = *(pFP - 1);) + } + else + { + EXPAND_8_TIMES(nDotProduct += *pFP * *pFM; *pFM-- -= ((*pFP >> 30) & 2) - 1; *pFP-- = *(pFP - 1);) + } + + *ip -= nDotProduct >> 9; + } + + Original = *ip; + + IPShort[q] = short(*ip); + IPAdaptFactor[q] = ((ip[0] >> 30) & 2) - 1; + +#ifdef ENABLE_ASSEMBLY + if (bMMXAvailable && (Original != 0)) + { + *ip -= (Helper.MMXDotProduct(&IPShort[q-nFirstElement], &bm[0], &IPAdaptFactor[q-nFirstElement], Original, nFilterStageElements) >> nFilterStageShift); + } + else + { + *ip -= (Helper.ConventionalDotProduct(&IPShort[q-nFirstElement], &bm[0], &IPAdaptFactor[q-nFirstElement], Original, nFilterStageElements) >> nFilterStageShift); + } +#else + *ip -= (Helper.ConventionalDotProduct(&IPShort[q-nFirstElement], &bm[0], &IPAdaptFactor[q-nFirstElement], Original, nFilterStageElements) >> nFilterStageShift); +#endif + + IPShort[q] = short(*ip); + IPAdaptFactor[q] = ((ip[0] >> 30) & 2) - 1; + + ///////////////////////////////////////////// + *op = *ip + (((p2 * m2) + (p3 * m3) + (p4 * m4)) >> 11); + + if (*ip > 0) { + m2 -= ((p2 >> 30) & 2) - 1; + m3 -= ((p3 >> 28) & 8) - 4; + m4 -= ((p4 >> 28) & 8) - 4; + } + else if (*ip < 0) { + m2 += ((p2 >> 30) & 2) - 1; + m3 += ((p3 >> 28) & 8) - 4; + m4 += ((p4 >> 28) & 8) - 4; + } + + + p2 = *op + ((IPP2 - p4) << 3); + p3 = (*op - p4) << 1; + IPP2 = p4; + p4 = *op; + + ///////////////////////////////////////////// + *op += (((p7 * m5) - (opp * m6)) >> nStageCShift); + + if (p4 > 0) { + m5 -= ((p7 >> 29) & 4) - 2; + m6 += ((opp >> 30) & 2) - 1; + } + else if (p4 < 0) { + m5 += ((p7 >> 29) & 4) - 2; + m6 -= ((opp >> 30) & 2) - 1; + } + + p7 = 2 * *op - opp; + opp = *op; + + ///////////////////////////////////////////// + *op += ((op[-1] * 31) >> 5); + + } + + free(IPAdaptFactor); + free(IPShort); +} + +#endif // #ifdef ENABLE_COMPRESSION_MODE_EXTRA_HIGH + +#endif // #ifdef BACKWARDS_COMPATIBILITY diff --git a/Libraries/MAC/Files/Source/MACLib/Old/AntiPredictorFast.cpp b/Libraries/MAC/Files/Source/MACLib/Old/AntiPredictorFast.cpp new file mode 100755 index 000000000..6a63c4946 --- /dev/null +++ b/Libraries/MAC/Files/Source/MACLib/Old/AntiPredictorFast.cpp @@ -0,0 +1,88 @@ +#include "All.h" +#ifdef BACKWARDS_COMPATIBILITY + +#include "Anti-Predictor.h" + +#ifdef ENABLE_COMPRESSION_MODE_FAST + +void CAntiPredictorFast0000To3320::AntiPredict(int *pInputArray, int *pOutputArray, int NumberOfElements) { + + //short frame handling + if (NumberOfElements < 32) { + memcpy(pOutputArray, pInputArray, NumberOfElements * 4); + return; + } + + //the initial + pOutputArray[0] = pInputArray[0]; + pOutputArray[1] = pInputArray[1] + pOutputArray[0]; + pOutputArray[2] = pInputArray[2] + pOutputArray[1]; + pOutputArray[3] = pInputArray[3] + pOutputArray[2]; + pOutputArray[4] = pInputArray[4] + pOutputArray[3]; + pOutputArray[5] = pInputArray[5] + pOutputArray[4]; + pOutputArray[6] = pInputArray[6] + pOutputArray[5]; + pOutputArray[7] = pInputArray[7] + pOutputArray[6]; + + //the rest + int p, pw; + int m = 4000; + int *ip, *op, *op1; + + op1 = &pOutputArray[7]; + p = (*op1 * 2) - pOutputArray[6]; + pw = (p * m) >> 12; + + for (op = &pOutputArray[8], ip = &pInputArray[8]; ip < &pInputArray[NumberOfElements]; ip++, op++, op1++) { + *op = *ip + pw; + + + //adjust m + if (*ip > 0) + m += (p > 0) ? 4 : -4; + else if (*ip < 0) + m += (p > 0) ? -4 : 4; + + p = (*op * 2) - *op1; + pw = (p * m) >> 12; + + } +} + +///////note: no output - overwrites input///////////////// +void CAntiPredictorFast3320ToCurrent::AntiPredict(int *pInputArray, int *pOutputArray, int NumberOfElements) { + + //short frame handling + if (NumberOfElements < 3) { + return; + } + + //variable declares + int p; + int m = 375; + int *ip; + int IP2 = pInputArray[1]; + int IP3 = pInputArray[0]; + int OP1 = pInputArray[1]; + + //the decompression loop (order 2 followed by order 1) + for (ip = &pInputArray[2]; ip < &pInputArray[NumberOfElements]; ip++) { + + //make a prediction for order 2 + p = IP2 + IP2 - IP3; + + //rollback the values + IP3 = IP2; + IP2 = *ip + ((p * m) >> 9); + + //adjust m for the order 2 + (*ip ^ p) > 0 ? m++ : m--; + + //set the output value + *ip = IP2 + OP1; + OP1 = *ip; + } +} + +#endif // #ifdef ENABLE_COMPRESSION_MODE_FAST + +#endif // #ifdef BACKWARDS_COMPATIBILITY diff --git a/Libraries/MAC/Files/Source/MACLib/Old/AntiPredictorHigh.cpp b/Libraries/MAC/Files/Source/MACLib/Old/AntiPredictorHigh.cpp new file mode 100755 index 000000000..9becf0fdf --- /dev/null +++ b/Libraries/MAC/Files/Source/MACLib/Old/AntiPredictorHigh.cpp @@ -0,0 +1,484 @@ +#include "All.h" +#ifdef BACKWARDS_COMPATIBILITY + +#include "Anti-Predictor.h" + +#ifdef ENABLE_COMPRESSION_MODE_HIGH + +void CAntiPredictorHigh0000To3320::AntiPredict(int *pInputArray, int *pOutputArray, int NumberOfElements) +{ + // variable declares + int p, pw; + int q; + int m; + + // short frame handling + if (NumberOfElements < 32) + { + memcpy(pOutputArray, pInputArray, NumberOfElements * 4); + return; + } + + //////////////////////////////////////// + // order 5 + //////////////////////////////////////// + memcpy(pOutputArray, pInputArray, 32); + + // initialize values + m = 0; + + for (q = 8; q < NumberOfElements; q++) + { + p = (5 * pOutputArray[q - 1]) - (10 * pOutputArray[q - 2]) + (12 * pOutputArray[q - 3]) - (7 * pOutputArray[q - 4]) + pOutputArray[q - 5]; + + pw = (p * m) >> 12; + + pOutputArray[q] = pInputArray[q] + pw; + + // adjust m + if (pInputArray[q] > 0) + (p > 0) ? m += 1 : m -= 1; + else if (pInputArray[q] < 0) + (p > 0) ? m -= 1 : m += 1; + + } + + /////////////////////////////////////// + // order 4 + /////////////////////////////////////// + memcpy(pInputArray, pOutputArray, 32); + m = 0; + + for (q = 8; q < NumberOfElements; q++) + { + p = (4 * pInputArray[q - 1]) - (6 * pInputArray[q - 2]) + (4 * pInputArray[q - 3]) - pInputArray[q - 4]; + pw = (p * m) >> 12; + + pInputArray[q] = pOutputArray[q] + pw; + + // adjust m + if (pOutputArray[q] > 0) + (p > 0) ? m += 2 : m -= 2; + else if (pOutputArray[q] < 0) + (p > 0) ? m -= 2 : m += 2; + } + + CAntiPredictorNormal0000To3320 AntiPredictor; + AntiPredictor.AntiPredict(pInputArray, pOutputArray, NumberOfElements); +} + +void CAntiPredictorHigh3320To3600::AntiPredict(int *pInputArray, int *pOutputArray, int NumberOfElements) +{ + // short frame handling + if (NumberOfElements < 8) + { + memcpy(pOutputArray, pInputArray, NumberOfElements * 4); + return; + } + + // do the offset anti-prediction + CAntiPredictorOffset AntiPredictorOffset; + AntiPredictorOffset.AntiPredict(pInputArray, pOutputArray, NumberOfElements, 2, 12); + AntiPredictorOffset.AntiPredict(pOutputArray, pInputArray, NumberOfElements, 3, 12); + + AntiPredictorOffset.AntiPredict(pInputArray, pOutputArray, NumberOfElements, 4, 12); + AntiPredictorOffset.AntiPredict(pOutputArray, pInputArray, NumberOfElements, 5, 12); + + AntiPredictorOffset.AntiPredict(pInputArray, pOutputArray, NumberOfElements, 6, 12); + AntiPredictorOffset.AntiPredict(pOutputArray, pInputArray, NumberOfElements, 7, 12); + + // use the normal mode + CAntiPredictorNormal3320To3800 AntiPredictor; + AntiPredictor.AntiPredict(pInputArray, pOutputArray, NumberOfElements); +} + +void CAntiPredictorHigh3600To3700::AntiPredict(int *pInputArray, int *pOutputArray, int NumberOfElements) +{ + // variable declares + int q; + + // short frame handling + if (NumberOfElements < 16) + { + memcpy(pOutputArray, pInputArray, NumberOfElements * 4); + return; + } + + // make the first five samples identical in both arrays + memcpy(pOutputArray, pInputArray, 13 * 4); + + // initialize values + int bm1 = 0; + int bm2 = 0; + int bm3 = 0; + int bm4 = 0; + int bm5 = 0; + int bm6 = 0; + int bm7 = 0; + int bm8 = 0; + int bm9 = 0; + int bm10 = 0; + int bm11 = 0; + int bm12 = 0; + int bm13 = 0; + + int m2 = 64; + + int m3 = 28; + int m4 = 16; + int OP0; + int OP1 = pOutputArray[12]; + int p4 = pInputArray[12]; + int p3 = (pInputArray[12] - pInputArray[11]) << 1; + int p2 = pInputArray[12] + ((pInputArray[10] - pInputArray[11]) << 3);// - pInputArray[3] + pInputArray[2]; + int bp1 = pOutputArray[12]; + int bp2 = pOutputArray[11]; + int bp3 = pOutputArray[10]; + int bp4 = pOutputArray[9]; + int bp5 = pOutputArray[8]; + int bp6 = pOutputArray[7]; + int bp7 = pOutputArray[6]; + int bp8 = pOutputArray[5]; + int bp9 = pOutputArray[4]; + int bp10 = pOutputArray[3]; + int bp11 = pOutputArray[2]; + int bp12 = pOutputArray[1]; + int bp13 = pOutputArray[0]; + + for (q = 13; q < NumberOfElements; q++) + { + pInputArray[q] = pInputArray[q] - 1; + OP0 = (pInputArray[q] - ((bp1 * bm1) >> 8) + ((bp2 * bm2) >> 8) - ((bp3 * bm3) >> 8) - ((bp4 * bm4) >> 8) - ((bp5 * bm5) >> 8) - ((bp6 * bm6) >> 8) - ((bp7 * bm7) >> 8) - ((bp8 * bm8) >> 8) - ((bp9 * bm9) >> 8) + ((bp10 * bm10) >> 8) + ((bp11 * bm11) >> 8) + ((bp12 * bm12) >> 8) + ((bp13 * bm13) >> 8)); + + if (pInputArray[q] > 0) + { + bm1 -= bp1 > 0 ? 1 : -1; + bm2 += bp2 >= 0 ? 1 : -1; + bm3 -= bp3 > 0 ? 1 : -1; + bm4 -= bp4 >= 0 ? 1 : -1; + bm5 -= bp5 > 0 ? 1 : -1; + bm6 -= bp6 >= 0 ? 1 : -1; + bm7 -= bp7 > 0 ? 1 : -1; + bm8 -= bp8 >= 0 ? 1 : -1; + bm9 -= bp9 > 0 ? 1 : -1; + bm10 += bp10 >= 0 ? 1 : -1; + bm11 += bp11 > 0 ? 1 : -1; + bm12 += bp12 >= 0 ? 1 : -1; + bm13 += bp13 > 0 ? 1 : -1; + } + else if (pInputArray[q] < 0) + { + bm1 -= bp1 <= 0 ? 1 : -1; + bm2 += bp2 < 0 ? 1 : -1; + bm3 -= bp3 <= 0 ? 1 : -1; + bm4 -= bp4 < 0 ? 1 : -1; + bm5 -= bp5 <= 0 ? 1 : -1; + bm6 -= bp6 < 0 ? 1 : -1; + bm7 -= bp7 <= 0 ? 1 : -1; + bm8 -= bp8 < 0 ? 1 : -1; + bm9 -= bp9 <= 0 ? 1 : -1; + bm10 += bp10 < 0 ? 1 : -1; + bm11 += bp11 <= 0 ? 1 : -1; + bm12 += bp12 < 0 ? 1 : -1; + bm13 += bp13 <= 0 ? 1 : -1; + } + + bp13 = bp12; + bp12 = bp11; + bp11 = bp10; + bp10 = bp9; + bp9 = bp8; + bp8 = bp7; + bp7 = bp6; + bp6 = bp5; + bp5 = bp4; + bp4 = bp3; + bp3 = bp2; + bp2 = bp1; + bp1 = OP0; + + pInputArray[q] = OP0 + ((p2 * m2) >> 11) + ((p3 * m3) >> 9) + ((p4 * m4) >> 9); + + if (OP0 > 0) + { + m2 -= p2 > 0 ? -1 : 1; + m3 -= p3 > 0 ? -1 : 1; + m4 -= p4 > 0 ? -1 : 1; + } + else if (OP0 < 0) + { + m2 -= p2 > 0 ? 1 : -1; + m3 -= p3 > 0 ? 1 : -1; + m4 -= p4 > 0 ? 1 : -1; + } + + p2 = pInputArray[q] + ((pInputArray[q - 2] - pInputArray[q - 1]) << 3); + p3 = (pInputArray[q] - pInputArray[q - 1]) << 1; + p4 = pInputArray[q]; + pOutputArray[q] = pInputArray[q];// + ((p3 * m3) >> 9); + } + + m4 = 370; + int m5 = 3900; + + pOutputArray[1] = pInputArray[1] + pOutputArray[0]; + pOutputArray[2] = pInputArray[2] + pOutputArray[1]; + pOutputArray[3] = pInputArray[3] + pOutputArray[2]; + pOutputArray[4] = pInputArray[4] + pOutputArray[3]; + pOutputArray[5] = pInputArray[5] + pOutputArray[4]; + pOutputArray[6] = pInputArray[6] + pOutputArray[5]; + pOutputArray[7] = pInputArray[7] + pOutputArray[6]; + pOutputArray[8] = pInputArray[8] + pOutputArray[7]; + pOutputArray[9] = pInputArray[9] + pOutputArray[8]; + pOutputArray[10] = pInputArray[10] + pOutputArray[9]; + pOutputArray[11] = pInputArray[11] + pOutputArray[10]; + pOutputArray[12] = pInputArray[12] + pOutputArray[11]; + + p4 = (2 * pInputArray[12]) - pInputArray[11]; + int p6 = 0; + int p5 = pOutputArray[12]; + int IP0, IP1; + int m6 = 0; + + IP1 = pInputArray[12]; + for (q = 13; q < NumberOfElements; q++) + { + IP0 = pOutputArray[q] + ((p4 * m4) >> 9) - ((p6 * m6) >> 10); + (pOutputArray[q] ^ p4) >= 0 ? m4++ : m4--; + (pOutputArray[q] ^ p6) >= 0 ? m6-- : m6++; + p4 = (2 * IP0) - IP1; + p6 = IP0; + + pOutputArray[q] = IP0 + ((p5 * 31) >> 5); + p5 = pOutputArray[q]; + + IP1 = IP0; + } +} + +void CAntiPredictorHigh3700To3800::AntiPredict(int *pInputArray, int *pOutputArray, int NumberOfElements) +{ + // the frame to start prediction on + #define FIRST_ELEMENT 16 + + int x = 100; + int y = -25; + + // short frame handling + if (NumberOfElements < 20) + { + memcpy(pOutputArray, pInputArray, NumberOfElements * 4); + return; + } + + // make the first five samples identical in both arrays + memcpy(pOutputArray, pInputArray, FIRST_ELEMENT * 4); + + // variable declares and initializations + int bm[FIRST_ELEMENT]; memset(bm, 0, FIRST_ELEMENT * 4); + int m2 = 64, m3 = 115, m4 = 64, m5 = 740, m6 = 0; + int p4 = pInputArray[FIRST_ELEMENT - 1]; + int p3 = (pInputArray[FIRST_ELEMENT - 1] - pInputArray[FIRST_ELEMENT - 2]) << 1; + int p2 = pInputArray[FIRST_ELEMENT - 1] + ((pInputArray[FIRST_ELEMENT - 3] - pInputArray[FIRST_ELEMENT - 2]) << 3);// - pInputArray[3] + pInputArray[2]; + int *op = &pOutputArray[FIRST_ELEMENT]; + int *ip = &pInputArray[FIRST_ELEMENT]; + int IPP2 = ip[-2]; + int IPP1 = ip[-1]; + int p7 = 2 * ip[-1] - ip[-2]; + int opp = op[-1]; + int Original; + + // undo the initial prediction stuff + for (int q = 1; q < FIRST_ELEMENT; q++) { + pOutputArray[q] += pOutputArray[q - 1]; + } + + // pump the primary loop + for (;op < &pOutputArray[NumberOfElements]; op++, ip++) { + + Original = *ip - 1; + *ip = Original - (((ip[-1] * bm[0]) + (ip[-2] * bm[1]) + (ip[-3] * bm[2]) + (ip[-4] * bm[3]) + (ip[-5] * bm[4]) + (ip[-6] * bm[5]) + (ip[-7] * bm[6]) + (ip[-8] * bm[7]) + (ip[-9] * bm[8]) + (ip[-10] * bm[9]) + (ip[-11] * bm[10]) + (ip[-12] * bm[11]) + (ip[-13] * bm[12]) + (ip[-14] * bm[13]) + (ip[-15] * bm[14]) + (ip[-16] * bm[15])) >> 8); + + if (Original > 0) + { + bm[0] -= ip[-1] > 0 ? 1 : -1; + bm[1] += ((unsigned int(ip[-2]) >> 30) & 2) - 1; + bm[2] -= ip[-3] > 0 ? 1 : -1; + bm[3] += ((unsigned int(ip[-4]) >> 30) & 2) - 1; + bm[4] -= ip[-5] > 0 ? 1 : -1; + bm[5] += ((unsigned int(ip[-6]) >> 30) & 2) - 1; + bm[6] -= ip[-7] > 0 ? 1 : -1; + bm[7] += ((unsigned int(ip[-8]) >> 30) & 2) - 1; + bm[8] -= ip[-9] > 0 ? 1 : -1; + bm[9] += ((unsigned int(ip[-10]) >> 30) & 2) - 1; + bm[10] -= ip[-11] > 0 ? 1 : -1; + bm[11] += ((unsigned int(ip[-12]) >> 30) & 2) - 1; + bm[12] -= ip[-13] > 0 ? 1 : -1; + bm[13] += ((unsigned int(ip[-14]) >> 30) & 2) - 1; + bm[14] -= ip[-15] > 0 ? 1 : -1; + bm[15] += ((unsigned int(ip[-16]) >> 30) & 2) - 1; + } + else if (Original < 0) + { + bm[0] -= ip[-1] <= 0 ? 1 : -1; + bm[1] -= ((unsigned int(ip[-2]) >> 30) & 2) - 1; + bm[2] -= ip[-3] <= 0 ? 1 : -1; + bm[3] -= ((unsigned int(ip[-4]) >> 30) & 2) - 1; + bm[4] -= ip[-5] <= 0 ? 1 : -1; + bm[5] -= ((unsigned int(ip[-6]) >> 30) & 2) - 1; + bm[6] -= ip[-7] <= 0 ? 1 : -1; + bm[7] -= ((unsigned int(ip[-8]) >> 30) & 2) - 1; + bm[8] -= ip[-9] <= 0 ? 1 : -1; + bm[9] -= ((unsigned int(ip[-10]) >> 30) & 2) - 1; + bm[10] -= ip[-11] <= 0 ? 1 : -1; + bm[11] -= ((unsigned int(ip[-12]) >> 30) & 2) - 1; + bm[12] -= ip[-13] <= 0 ? 1 : -1; + bm[13] -= ((unsigned int(ip[-14]) >> 30) & 2) - 1; + bm[14] -= ip[-15] <= 0 ? 1 : -1; + bm[15] -= ((unsigned int(ip[-16]) >> 30) & 2) - 1; + } + + ///////////////////////////////////////////// + *op = *ip + (((p2 * m2) + (p3 * m3) + (p4 * m4)) >> 11); + + if (*ip > 0) + { + m2 -= p2 > 0 ? -1 : 1; + m3 -= p3 > 0 ? -4 : 4; + m4 -= p4 > 0 ? -4 : 4; + } + else if (*ip < 0) + { + m2 -= p2 > 0 ? 1 : -1; + m3 -= p3 > 0 ? 4 : -4; + m4 -= p4 > 0 ? 4 : -4; + } + + p4 = *op; + p2 = p4 + ((IPP2 - IPP1) << 3); + p3 = (p4 - IPP1) << 1; + + IPP2 = IPP1; + IPP1 = p4; + + ///////////////////////////////////////////// + *op += (((p7 * m5) - (opp * m6)) >> 10); + + (IPP1 ^ p7) >= 0 ? m5+=2 : m5-=2; + (IPP1 ^ opp) >= 0 ? m6-- : m6++; + + p7 = 2 * *op - opp; + opp = *op; + + ///////////////////////////////////////////// + *op += ((op[-1] * 31) >> 5); + } +} + +void CAntiPredictorHigh3800ToCurrent::AntiPredict(int *pInputArray, int *pOutputArray, int NumberOfElements) +{ + // the frame to start prediction on + #define FIRST_ELEMENT 16 + + // short frame handling + if (NumberOfElements < 20) + { + memcpy(pOutputArray, pInputArray, NumberOfElements * 4); + return; + } + + // make the first five samples identical in both arrays + memcpy(pOutputArray, pInputArray, FIRST_ELEMENT * 4); + + // variable declares and initializations + int bm[FIRST_ELEMENT]; memset(bm, 0, FIRST_ELEMENT * 4); + int m2 = 64, m3 = 115, m4 = 64, m5 = 740, m6 = 0; + int p4 = pInputArray[FIRST_ELEMENT - 1]; + int p3 = (pInputArray[FIRST_ELEMENT - 1] - pInputArray[FIRST_ELEMENT - 2]) << 1; + int p2 = pInputArray[FIRST_ELEMENT - 1] + ((pInputArray[FIRST_ELEMENT - 3] - pInputArray[FIRST_ELEMENT - 2]) << 3);// - pInputArray[3] + pInputArray[2]; + int *op = &pOutputArray[FIRST_ELEMENT]; + int *ip = &pInputArray[FIRST_ELEMENT]; + int IPP2 = ip[-2]; + int IPP1 = ip[-1]; + int p7 = 2 * ip[-1] - ip[-2]; + int opp = op[-1]; + + // undo the initial prediction stuff + for (int q = 1; q < FIRST_ELEMENT; q++) + { + pOutputArray[q] += pOutputArray[q - 1]; + } + + // pump the primary loop + for (;op < &pOutputArray[NumberOfElements]; op++, ip++) + { + + unsigned int *pip = (unsigned int *) &ip[-FIRST_ELEMENT]; + int *pbm = &bm[0]; + int nDotProduct = 0; + + if (*ip > 0) + { + EXPAND_16_TIMES(nDotProduct += *pip * *pbm; *pbm++ += ((*pip++ >> 30) & 2) - 1;) + } + else if (*ip < 0) + { + EXPAND_16_TIMES(nDotProduct += *pip * *pbm; *pbm++ -= ((*pip++ >> 30) & 2) - 1;) + } + else + { + EXPAND_16_TIMES(nDotProduct += *pip++ * *pbm++;) + } + + *ip -= (nDotProduct >> 9); + + ///////////////////////////////////////////// + *op = *ip + (((p2 * m2) + (p3 * m3) + (p4 * m4)) >> 11); + + if (*ip > 0) + { + m2 -= ((p2 >> 30) & 2) - 1; + m3 -= ((p3 >> 28) & 8) - 4; + m4 -= ((p4 >> 28) & 8) - 4; + + } + else if (*ip < 0) + { + m2 += ((p2 >> 30) & 2) - 1; + m3 += ((p3 >> 28) & 8) - 4; + m4 += ((p4 >> 28) & 8) - 4; + } + + + p2 = *op + ((IPP2 - p4) << 3); + p3 = (*op - p4) << 1; + IPP2 = p4; + p4 = *op; + + ///////////////////////////////////////////// + *op += (((p7 * m5) - (opp * m6)) >> 10); + + if (p4 > 0) + { + m5 -= ((p7 >> 29) & 4) - 2; + m6 += ((opp >> 30) & 2) - 1; + } + else if (p4 < 0) + { + m5 += ((p7 >> 29) & 4) - 2; + m6 -= ((opp >> 30) & 2) - 1; + } + + p7 = 2 * *op - opp; + opp = *op; + + ///////////////////////////////////////////// + *op += ((op[-1] * 31) >> 5); + } + + #undef FIRST_ELEMENT +} + +#endif // #ifdef ENABLE_COMPRESSION_MODE_HIGH + +#endif // #ifdef BACKWARDS_COMPATIBILITY diff --git a/Libraries/MAC/Files/Source/MACLib/Old/AntiPredictorNormal.cpp b/Libraries/MAC/Files/Source/MACLib/Old/AntiPredictorNormal.cpp new file mode 100755 index 000000000..af3010424 --- /dev/null +++ b/Libraries/MAC/Files/Source/MACLib/Old/AntiPredictorNormal.cpp @@ -0,0 +1,262 @@ +#include "All.h" +#ifdef BACKWARDS_COMPATIBILITY + +#include "Anti-Predictor.h" +#ifdef ENABLE_COMPRESSION_MODE_NORMAL + +void CAntiPredictorNormal0000To3320::AntiPredict(int *pInputArray, int *pOutputArray, int NumberOfElements) +{ + // variable declares + int *ip, *op, *op1, *op2; + int p, pw; + int m; + + // short frame handling + if (NumberOfElements < 32) + { + memcpy(pOutputArray, pInputArray, NumberOfElements * 4); + return; + } + + //////////////////////////////////////// + // order 3 + //////////////////////////////////////// + memcpy(pOutputArray, pInputArray, 32); + + // initialize values + m = 300; + op = &pOutputArray[8]; + op1 = &pOutputArray[7]; + op2 = &pOutputArray[6]; + + // make the first prediction + p = (pOutputArray[7] * 3) - (pOutputArray[6] * 3) + pOutputArray[5]; + pw = (p * m) >> 12; + + // loop through the array + for (ip = &pInputArray[8]; ip < &pInputArray[NumberOfElements]; ip++, op++, op1++, op2++) { + + // figure the output value + *op = *ip + pw; + + // adjust m + if (*ip > 0) + m += (p > 0) ? 4 : -4; + else if (*ip < 0) + m += (p > 0) ? -4 : 4; + + // make the next prediction + p = (*op * 3) - (*op1 * 3) + *op2; + pw = (p * m) >> 12; + } + + + /////////////////////////////////////// + // order 2 + /////////////////////////////////////// + memcpy(pInputArray, pOutputArray, 32); + m = 3000; + + op1 = &pInputArray[7]; + p = (*op1 * 2) - pInputArray[6]; + pw = (p * m) >> 12; + + for (op = &pInputArray[8], ip = &pOutputArray[8]; ip < &pOutputArray[NumberOfElements]; ip++, op++, op1++) + { + *op = *ip + pw; + + // adjust m + if (*ip > 0) + m += (p > 0) ? 12 : -12; + else if (*ip < 0) + m += (p > 0) ? -12 : 12; + + p = (*op * 2) - *op1; + pw = (p * m) >> 12; + + } + + /////////////////////////////////////// + // order 1 + /////////////////////////////////////// + pOutputArray[0] = pInputArray[0]; + pOutputArray[1] = pInputArray[1] + pOutputArray[0]; + pOutputArray[2] = pInputArray[2] + pOutputArray[1]; + pOutputArray[3] = pInputArray[3] + pOutputArray[2]; + pOutputArray[4] = pInputArray[4] + pOutputArray[3]; + pOutputArray[5] = pInputArray[5] + pOutputArray[4]; + pOutputArray[6] = pInputArray[6] + pOutputArray[5]; + pOutputArray[7] = pInputArray[7] + pOutputArray[6]; + + m = 3900; + + p = pOutputArray[7]; + pw = (p * m) >> 12; + + for (op = &pOutputArray[8], ip = &pInputArray[8]; ip < &pInputArray[NumberOfElements]; ip++, op++) { + *op = *ip + pw; + + // adjust m + if (*ip > 0) + m += (p > 0) ? 1 : -1; + else if (*ip < 0) + m += (p > 0) ? -1 : 1; + + p = *op; + pw = (p * m) >> 12; + } + +} + +void CAntiPredictorNormal3320To3800::AntiPredict(int *pInputArray, int *pOutputArray, int NumberOfElements) +{ + // variable declares + int q; + + // short frame handling + if (NumberOfElements < 8) + { + memcpy(pOutputArray, pInputArray, NumberOfElements * 4); + return; + } + + // make the first five samples identical in both arrays + memcpy(pOutputArray, pInputArray, 20); + + // initialize values + int m1 = 0; + int m2 = 64; + int m3 = 28; + int OP0; + int OP1 = pOutputArray[4]; + + int p3 = (3 * (pOutputArray[4] - pOutputArray[3])) + pOutputArray[2]; + int p2 = pInputArray[4] + ((pInputArray[2] - pInputArray[3]) << 3) - pInputArray[1] + pInputArray[0]; + int p1 = pOutputArray[4]; + + for (q = 5; q < NumberOfElements; q++) + { + OP0 = pInputArray[q] + ((p1 * m1) >> 8); + (pInputArray[q] ^ p1) > 0 ? m1++ : m1--; + p1 = OP0; + + pInputArray[q] = OP0 + ((p2 * m2) >> 11); + (OP0 ^ p2) > 0 ? m2++ : m2--; + p2 = pInputArray[q] + ((pInputArray[q - 2] - pInputArray[q - 1]) << 3) - pInputArray[q - 3] + pInputArray[q - 4]; + + pOutputArray[q] = pInputArray[q] + ((p3 * m3) >> 9); + (pInputArray[q] ^ p3) > 0 ? m3++ : m3--; + p3 = (3 * (pOutputArray[q] - pOutputArray[q - 1])) + pOutputArray[q - 2]; + } + + int m4 = 370; + int m5 = 3900; + + pOutputArray[1] = pInputArray[1] + pOutputArray[0]; + pOutputArray[2] = pInputArray[2] + pOutputArray[1]; + pOutputArray[3] = pInputArray[3] + pOutputArray[2]; + pOutputArray[4] = pInputArray[4] + pOutputArray[3]; + + int p4 = (2 * pInputArray[4]) - pInputArray[3]; + int p5 = pOutputArray[4]; + int IP0, IP1; + + IP1 = pInputArray[4]; + for (q = 5; q < NumberOfElements; q++) + { + IP0 = pOutputArray[q] + ((p4 * m4) >> 9); + (pOutputArray[q] ^ p4) > 0 ? m4++ : m4--; + p4 = (2 * IP0) - IP1; + + pOutputArray[q] = IP0 + ((p5 * m5) >> 12); + (IP0 ^ p5) > 0 ? m5++ : m5--; + p5 = pOutputArray[q]; + + IP1 = IP0; + } +} + +void CAntiPredictorNormal3800ToCurrent::AntiPredict(int *pInputArray, int *pOutputArray, int NumberOfElements) +{ + // the frame to start prediction on + #define FIRST_ELEMENT 4 + + // short frame handling + if (NumberOfElements < 8) + { + memcpy(pOutputArray, pInputArray, NumberOfElements * 4); + return; + } + + // make the first five samples identical in both arrays + memcpy(pOutputArray, pInputArray, FIRST_ELEMENT * 4); + + // variable declares and initializations + int m2 = 64, m3 = 115, m4 = 64, m5 = 740, m6 = 0; + int p4 = pInputArray[FIRST_ELEMENT - 1]; + int p3 = (pInputArray[FIRST_ELEMENT - 1] - pInputArray[FIRST_ELEMENT - 2]) << 1; + int p2 = pInputArray[FIRST_ELEMENT - 1] + ((pInputArray[FIRST_ELEMENT - 3] - pInputArray[FIRST_ELEMENT - 2]) << 3);// - pInputArray[3] + pInputArray[2]; + int *op = &pOutputArray[FIRST_ELEMENT]; + int *ip = &pInputArray[FIRST_ELEMENT]; + int IPP2 = ip[-2]; + int p7 = 2 * ip[-1] - ip[-2]; + int opp = op[-1]; + + // undo the initial prediction stuff + for (int q = 1; q < FIRST_ELEMENT; q++) { + pOutputArray[q] += pOutputArray[q - 1]; + } + + // pump the primary loop + for (; op < &pOutputArray[NumberOfElements]; op++, ip++) { + + register int o = *op, i = *ip; + + ///////////////////////////////////////////// + o = i + (((p2 * m2) + (p3 * m3) + (p4 * m4)) >> 11); + + if (i > 0) + { + m2 -= ((p2 >> 30) & 2) - 1; + m3 -= ((p3 >> 28) & 8) - 4; + m4 -= ((p4 >> 28) & 8) - 4; + + } + else if (i < 0) + { + m2 += ((p2 >> 30) & 2) - 1; + m3 += ((p3 >> 28) & 8) - 4; + m4 += ((p4 >> 28) & 8) - 4; + } + + + p2 = o + ((IPP2 - p4) << 3); + p3 = (o - p4) << 1; + IPP2 = p4; + p4 = o; + + ///////////////////////////////////////////// + o += (((p7 * m5) - (opp * m6)) >> 10); + + if (p4 > 0) + { + m5 -= ((p7 >> 29) & 4) - 2; + m6 += ((opp >> 30) & 2) - 1; + } + else if (p4 < 0) + { + m5 += ((p7 >> 29) & 4) - 2; + m6 -= ((opp >> 30) & 2) - 1; + } + + p7 = 2 * o - opp; + opp = o; + + ///////////////////////////////////////////// + *op = o + ((op[-1] * 31) >> 5); + } +} + +#endif // #ifdef ENABLE_COMPRESSION_MODE_NORMAL + +#endif // #ifdef BACKWARDS_COMPATIBILITY diff --git a/Libraries/MAC/Files/Source/MACLib/Old/UnBitArrayOld.cpp b/Libraries/MAC/Files/Source/MACLib/Old/UnBitArrayOld.cpp new file mode 100755 index 000000000..eeb042889 --- /dev/null +++ b/Libraries/MAC/Files/Source/MACLib/Old/UnBitArrayOld.cpp @@ -0,0 +1,353 @@ +#include "All.h" +#ifdef BACKWARDS_COMPATIBILITY + +#include "../APEInfo.h" +#include "UnBitarrayOld.h" +#include "../BitArray.h" + +const uint32 K_SUM_MIN_BOUNDARY_OLD[32] = {0,128,256,512,1024,2048,4096,8192,16384,32768,65536,131072,262144,524288,1048576,2097152,4194304,8388608,16777216,33554432,67108864,134217728,268435456,536870912,1073741824,2147483648,0,0,0,0,0,0}; +const uint32 K_SUM_MAX_BOUNDARY_OLD[32] = {128,256,512,1024,2048,4096,8192,16384,32768,65536,131072,262144,524288,1048576,2097152,4194304,8388608,16777216,33554432,67108864,134217728,268435456,536870912,1073741824,2147483648,0,0,0,0,0,0,0}; +const uint32 Powers_of_Two[32] = {1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131072,262144,524288,1048576,2097152,4194304,8388608,16777216,33554432,67108864,134217728,268435456,536870912,1073741824,2147483648}; +const uint32 Powers_of_Two_Reversed[32] = {2147483648,1073741824,536870912,268435456,134217728,67108864,33554432,16777216,8388608,4194304,2097152,1048576,524288,262144,131072,65536,32768,16384,8192,4096,2048,1024,512,256,128,64,32,16,8,4,2,1}; +const uint32 Powers_of_Two_Minus_One[33] = {0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535,131071,262143,524287,1048575,2097151,4194303,8388607,16777215,33554431,67108863,134217727,268435455,536870911,1073741823,2147483647,4294967295}; +const uint32 Powers_of_Two_Minus_One_Reversed[33] = {4294967295,2147483647,1073741823,536870911,268435455,134217727,67108863,33554431,16777215,8388607,4194303,2097151,1048575,524287,262143,131071,65535,32767,16383,8191,4095,2047,1023,511,255,127,63,31,15,7,3,1,0}; + +const uint32 K_SUM_MIN_BOUNDARY[32] = {0,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131072,262144,524288,1048576,2097152,4194304,8388608,16777216,33554432,67108864,134217728,268435456,536870912,1073741824,2147483648,0,0,0,0}; +const uint32 K_SUM_MAX_BOUNDARY[32] = {32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131072,262144,524288,1048576,2097152,4194304,8388608,16777216,33554432,67108864,134217728,268435456,536870912,1073741824,2147483648,0,0,0,0,0}; + +/*********************************************************************************** +Construction +***********************************************************************************/ +CUnBitArrayOld::CUnBitArrayOld(IAPEDecompress * pAPEDecompress, int nVersion) +{ + int nBitArrayBytes = 262144; + + // calculate the bytes + if (nVersion <= 3880) + { + int nMaxFrameBytes = (pAPEDecompress->GetInfo(APE_INFO_BLOCKS_PER_FRAME) * 50) / 8; + nBitArrayBytes = 65536; + while (nBitArrayBytes < nMaxFrameBytes) + { + nBitArrayBytes <<= 1; + } + + nBitArrayBytes = max(nBitArrayBytes, 262144); + } + else if (nVersion <= 3890) + { + nBitArrayBytes = 65536; + } + else + { + // error + } + + CreateHelper(GET_IO(pAPEDecompress), nBitArrayBytes, nVersion); + + // set the refill threshold + if (m_nVersion <= 3880) + m_nRefillBitThreshold = (m_nBits - (16384 * 8)); + else + m_nRefillBitThreshold = (m_nBits - 512); +} + +CUnBitArrayOld::~CUnBitArrayOld() +{ + SAFE_ARRAY_DELETE(m_pBitArray) +} + +//////////////////////////////////////////////////////////////////////////////////// +// Gets the number of m_nBits of data left in the m_nCurrentBitIndex array +//////////////////////////////////////////////////////////////////////////////////// +uint32 CUnBitArrayOld::GetBitsRemaining() +{ + return (m_nElements * 32 - m_nCurrentBitIndex); +} + +//////////////////////////////////////////////////////////////////////////////////// +// Gets a rice value from the array +//////////////////////////////////////////////////////////////////////////////////// +uint32 CUnBitArrayOld::DecodeValueRiceUnsigned(uint32 k) +{ + // variable declares + uint32 v; + + // plug through the string of 0's (the overflow) + uint32 BitInitial = m_nCurrentBitIndex; + while (!(m_pBitArray[m_nCurrentBitIndex >> 5] & Powers_of_Two_Reversed[m_nCurrentBitIndex++ & 31])) {} + + // if k = 0, your done + if (k == 0) + return (m_nCurrentBitIndex - BitInitial - 1); + + // put the overflow value into v + v = (m_nCurrentBitIndex - BitInitial - 1) << k; + + return v | DecodeValueXBits(k); +} + +//////////////////////////////////////////////////////////////////////////////////// +// Get the optimal k for a given value +//////////////////////////////////////////////////////////////////////////////////// +__inline uint32 CUnBitArrayOld::Get_K(uint32 x) +{ + if (x == 0) return 0; + + uint32 k = 0; + while (x >= Powers_of_Two[++k]) {} + return k; +} + +unsigned int CUnBitArrayOld::DecodeValue(DECODE_VALUE_METHOD DecodeMethod, int nParam1, int nParam2) +{ + switch (DecodeMethod) + { + case DECODE_VALUE_METHOD_UNSIGNED_INT: + return DecodeValueXBits(32); + case DECODE_VALUE_METHOD_UNSIGNED_RICE: + return DecodeValueRiceUnsigned(nParam1); + case DECODE_VALUE_METHOD_X_BITS: + return DecodeValueXBits(nParam1); + } + + return 0; +} + +//////////////////////////////////////////////////////////////////////////////////// +// Generates an array from the m_nCurrentBitIndexarray +//////////////////////////////////////////////////////////////////////////////////// +void CUnBitArrayOld::GenerateArrayOld(int* Output_Array, uint32 Number_of_Elements, int Minimum_nCurrentBitIndex_Array_Bytes) { + + //variable declarations + uint32 K_Sum; + uint32 q; + uint32 kmin, kmax; + uint32 k; + uint32 Max; + int *p1, *p2; + + // fill bit array if necessary + // could use seek information to determine what the max was... + uint32 Max_Bits_Needed = Number_of_Elements * 50; + + if (Minimum_nCurrentBitIndex_Array_Bytes > 0) + { + // this is actually probably double what is really needed + // we can only calculate the space needed for both arrays in multichannel + Max_Bits_Needed = ((Minimum_nCurrentBitIndex_Array_Bytes + 4) * 8); + } + + if (Max_Bits_Needed > GetBitsRemaining()) + FillBitArray(); + + // decode the first 5 elements (all k = 10) + Max = (Number_of_Elements < 5) ? Number_of_Elements : 5; + for (q = 0; q < Max; q++) + { + Output_Array[q] = DecodeValueRiceUnsigned(10); + } + + // quit if that was all + if (Number_of_Elements <= 5) + { + for (p2 = &Output_Array[0]; p2 < &Output_Array[Number_of_Elements]; p2++) + *p2 = (*p2 & 1) ? (*p2 >> 1) + 1 : -(*p2 >> 1); + return; + } + + // update k and K_Sum + K_Sum = Output_Array[0] + Output_Array[1] + Output_Array[2] + Output_Array[3] + Output_Array[4]; + k = Get_K(K_Sum / 10); + + // work through the rest of the elements before the primary loop + Max = (Number_of_Elements < 64) ? Number_of_Elements : 64; + for (q = 5; q < Max; q++) + { + Output_Array[q] = DecodeValueRiceUnsigned(k); + K_Sum += Output_Array[q]; + k = Get_K(K_Sum / (q + 1) / 2); + } + + // quit if that was all + if (Number_of_Elements <= 64) + { + for (p2 = &Output_Array[0]; p2 < &Output_Array[Number_of_Elements]; p2++) + *p2 = (*p2 & 1) ? (*p2 >> 1) + 1 : -(*p2 >> 1); + return; + } + + // set all of the variables up for the primary loop + uint32 v, Bit_Array_Index; + k = Get_K(K_Sum >> 7); + kmin = K_SUM_MIN_BOUNDARY_OLD[k]; + kmax = K_SUM_MAX_BOUNDARY_OLD[k]; + p1 = &Output_Array[64]; p2 = &Output_Array[0]; + + // the primary loop + for (p1 = &Output_Array[64], p2 = &Output_Array[0]; p1 < &Output_Array[Number_of_Elements]; p1++, p2++) + { + // plug through the string of 0's (the overflow) + uint32 Bit_Initial = m_nCurrentBitIndex; + while (!(m_pBitArray[m_nCurrentBitIndex >> 5] & Powers_of_Two_Reversed[m_nCurrentBitIndex++ & 31])) {} + + // if k = 0, your done + if (k == 0) + { + v = (m_nCurrentBitIndex - Bit_Initial - 1); + } + else + { + // put the overflow value into v + v = (m_nCurrentBitIndex - Bit_Initial - 1) << k; + + // store the bit information and incement the bit pointer by 'k' + Bit_Array_Index = m_nCurrentBitIndex >> 5; + unsigned int Bit_Index = m_nCurrentBitIndex & 31; + m_nCurrentBitIndex += k; + + // figure the extra bits on the left and the left value + int Left_Extra_Bits = (32 - k) - Bit_Index; + unsigned int Left_Value = m_pBitArray[Bit_Array_Index] & Powers_of_Two_Minus_One_Reversed[Bit_Index]; + + if (Left_Extra_Bits >= 0) + v |= (Left_Value >> Left_Extra_Bits); + else + v |= (Left_Value << -Left_Extra_Bits) | (m_pBitArray[Bit_Array_Index + 1] >> (32 + Left_Extra_Bits)); + } + + *p1 = v; + K_Sum += *p1 - *p2; + + // convert *p2 to unsigned + *p2 = (*p2 % 2) ? (*p2 >> 1) + 1 : -(*p2 >> 1); + + // adjust k if necessary + if ((K_Sum < kmin) || (K_Sum >= kmax)) + { + if (K_Sum < kmin) + while (K_Sum < K_SUM_MIN_BOUNDARY_OLD[--k]) {} + else + while (K_Sum >= K_SUM_MAX_BOUNDARY_OLD[++k]) {} + + kmax = K_SUM_MAX_BOUNDARY_OLD[k]; + kmin = K_SUM_MIN_BOUNDARY_OLD[k]; + } + } + + for (; p2 < &Output_Array[Number_of_Elements]; p2++) + *p2 = (*p2 & 1) ? (*p2 >> 1) + 1 : -(*p2 >> 1); +} + +void CUnBitArrayOld::GenerateArray(int *pOutputArray, int nElements, int nBytesRequired) +{ + if (m_nVersion < 3860) + { + GenerateArrayOld(pOutputArray, nElements, nBytesRequired); + } + else if (m_nVersion <= 3890) + { + GenerateArrayRice(pOutputArray, nElements, nBytesRequired); + } + else + { + // error + } +} + +void CUnBitArrayOld::GenerateArrayRice(int* Output_Array, uint32 Number_of_Elements, int Minimum_nCurrentBitIndex_Array_Bytes) +{ + ///////////////////////////////////////////////////////////////////////////// + // decode the bit array + ///////////////////////////////////////////////////////////////////////////// + + k = 10; + K_Sum = 1024 * 16; + + if (m_nVersion <= 3880) + { + // the primary loop + for (int *p1 = &Output_Array[0]; p1 < &Output_Array[Number_of_Elements]; p1++) + { + *p1 = DecodeValueNew(FALSE); + } + } + else + { + // the primary loop + for (int *p1 = &Output_Array[0]; p1 < &Output_Array[Number_of_Elements]; p1++) + { + *p1 = DecodeValueNew(TRUE); + } + } +} + +__inline int CUnBitArrayOld::DecodeValueNew(BOOL bCapOverflow) +{ + // make sure there is room for the data + // this is a little slower than ensuring a huge block to start with, but it's safer + if (m_nCurrentBitIndex > m_nRefillBitThreshold) + { + FillBitArray(); + } + + unsigned int v; + + // plug through the string of 0's (the overflow) + uint32 Bit_Initial = m_nCurrentBitIndex; + while (!(m_pBitArray[m_nCurrentBitIndex >> 5] & Powers_of_Two_Reversed[m_nCurrentBitIndex++ & 31])) {} + + int nOverflow = (m_nCurrentBitIndex - Bit_Initial - 1); + + if (bCapOverflow) + { + while (nOverflow >= 16) + { + k += 4; + nOverflow -= 16; + } + } + + // if k = 0, your done + if (k != 0) + { + // put the overflow value into v + v = nOverflow << k; + + // store the bit information and incement the bit pointer by 'k' + unsigned int Bit_Array_Index = m_nCurrentBitIndex >> 5; + unsigned int Bit_Index = m_nCurrentBitIndex & 31; + m_nCurrentBitIndex += k; + + // figure the extra bits on the left and the left value + int Left_Extra_Bits = (32 - k) - Bit_Index; + unsigned int Left_Value = m_pBitArray[Bit_Array_Index] & Powers_of_Two_Minus_One_Reversed[Bit_Index]; + + if (Left_Extra_Bits >= 0) + { + v |= (Left_Value >> Left_Extra_Bits); + } + else + { + v |= (Left_Value << -Left_Extra_Bits) | (m_pBitArray[Bit_Array_Index + 1] >> (32 + Left_Extra_Bits)); + } + } + else + { + v = nOverflow; + } + + // update K_Sum + K_Sum += v - ((K_Sum + 8) >> 4); + + // update k + if (K_Sum < K_SUM_MIN_BOUNDARY[k]) + k--; + else if (K_Sum >= K_SUM_MAX_BOUNDARY[k]) + k++; + + // convert to unsigned and save + return (v & 1) ? (v >> 1) + 1 : -(int(v >> 1)); +} + +#endif // #ifdef BACKWARDS_COMPATIBILITY diff --git a/Libraries/MAC/Files/Source/MACLib/Old/UnBitArrayOld.h b/Libraries/MAC/Files/Source/MACLib/Old/UnBitArrayOld.h new file mode 100755 index 000000000..40c28eacc --- /dev/null +++ b/Libraries/MAC/Files/Source/MACLib/Old/UnBitArrayOld.h @@ -0,0 +1,46 @@ +#ifndef APE_UNBITARRAY_OLD_H +#define APE_UNBITARRAY_OLD_H + +#include "All.h" +#ifdef BACKWARDS_COMPATIBILITY + +#include "../UnBitArrayBase.h" + +class IAPEDecompress; + +// decodes 0000 up to and including 3890 +class CUnBitArrayOld : public CUnBitArrayBase +{ +public: + + // construction/destruction + CUnBitArrayOld(IAPEDecompress *pAPEDecompress, int nVersion); + ~CUnBitArrayOld(); + + // functions + void GenerateArray(int *pOutputArray, int nElements, int nBytesRequired = -1); + unsigned int DecodeValue(DECODE_VALUE_METHOD DecodeMethod, int nParam1 = 0, int nParam2 = 0); + +private: + + void GenerateArrayOld(int* pOutputArray, uint32 NumberOfElements, int MinimumBitArrayBytes); + void GenerateArrayRice(int* pOutputArray, uint32 NumberOfElements, int MinimumBitArrayBytes); + + uint32 DecodeValueRiceUnsigned(uint32 k); + + // data + uint32 k; + uint32 K_Sum; + uint32 m_nRefillBitThreshold; + + // functions + __inline int DecodeValueNew(BOOL bCapOverflow); + uint32 GetBitsRemaining(); + __inline uint32 Get_K(uint32 x); +}; + +#endif + +#endif // #ifndef APE_UNBITARRAY_OLD_H + + diff --git a/Libraries/MAC/Files/Source/MACLib/Old/UnMAC.cpp b/Libraries/MAC/Files/Source/MACLib/Old/UnMAC.cpp new file mode 100755 index 000000000..140993b9a --- /dev/null +++ b/Libraries/MAC/Files/Source/MACLib/Old/UnMAC.cpp @@ -0,0 +1,261 @@ +/***************************************************************************************** +UnMAC.cpp +Copyright (C) 2000-2001 by Matthew T. Ashland All Rights Reserved. + +CUnMAC - the main hub for decompression (manages all of the other components) + +Notes: + -none +*****************************************************************************************/ + +/***************************************************************************************** +Includes +*****************************************************************************************/ +#include "All.h" +#ifdef BACKWARDS_COMPATIBILITY + +#include "../APEInfo.h" +#include "UnMAC.h" +#include "GlobalFunctions.h" +#include "../UnBitArrayBase.h" +#include "Anti-Predictor.h" +#include "../Prepare.h" +#include "../UnBitArray.h" +#include "../NewPredictor.h" +#include "APEDecompressCore.h" + +/***************************************************************************************** +CUnMAC class construction +*****************************************************************************************/ +CUnMAC::CUnMAC() +{ + // initialize member variables + m_bInitialized = FALSE; + m_LastDecodedFrameIndex = -1; + m_pAPEDecompress = NULL; + + m_pAPEDecompressCore = NULL; + m_pPrepare = NULL; + + m_nBlocksProcessed = 0; + m_nCRC = 0; + +} + +/***************************************************************************************** +CUnMAC class destruction +*****************************************************************************************/ +CUnMAC::~CUnMAC() +{ + // uninitialize the decoder in case it isn't already + Uninitialize(); +} + +/***************************************************************************************** +Initialize +*****************************************************************************************/ +int CUnMAC::Initialize(IAPEDecompress *pAPEDecompress) +{ + // uninitialize if it is currently initialized + if (m_bInitialized) + Uninitialize(); + + if (pAPEDecompress == NULL) + { + Uninitialize(); + return ERROR_INITIALIZING_UNMAC; + } + + // set the member pointer to the IAPEDecompress class + m_pAPEDecompress = pAPEDecompress; + + // set the last decode frame to -1 so it forces a seek on start + m_LastDecodedFrameIndex = -1; + + m_pAPEDecompressCore = new CAPEDecompressCore(GET_IO(pAPEDecompress), pAPEDecompress); + m_pPrepare = new CPrepare; + + // set the initialized flag to TRUE + m_bInitialized = TRUE; + + m_pAPEDecompress->GetInfo(APE_INFO_WAVEFORMATEX, (int) &m_wfeInput); + + // return a successful value + return ERROR_SUCCESS; +} + +/***************************************************************************************** +Uninitialize +*****************************************************************************************/ +int CUnMAC::Uninitialize() +{ + if (m_bInitialized) + { + SAFE_DELETE(m_pAPEDecompressCore) + SAFE_DELETE(m_pPrepare) + + // clear the APE info pointer + m_pAPEDecompress = NULL; + + // set the last decoded frame again + m_LastDecodedFrameIndex = -1; + + // set the initialized flag to FALSE + m_bInitialized = FALSE; + } + + return ERROR_SUCCESS; +} + +/***************************************************************************************** +Decompress frame +*****************************************************************************************/ +int CUnMAC::DecompressFrame(unsigned char *pOutputData, int32 FrameIndex, int CPULoadBalancingFactor) +{ + return DecompressFrameOld(pOutputData, FrameIndex, CPULoadBalancingFactor); +} + +/***************************************************************************************** +Seek to the proper frame (if necessary) and do any alignment of the bit array +*****************************************************************************************/ +int CUnMAC::SeekToFrame(int FrameIndex) +{ + if (GET_FRAMES_START_ON_BYTES_BOUNDARIES(m_pAPEDecompress)) + { + if ((m_LastDecodedFrameIndex == -1) || ((FrameIndex - 1) != m_LastDecodedFrameIndex)) + { + int SeekRemainder = (m_pAPEDecompress->GetInfo(APE_INFO_SEEK_BYTE, FrameIndex) - m_pAPEDecompress->GetInfo(APE_INFO_SEEK_BYTE, 0)) % 4; + m_pAPEDecompressCore->GetUnBitArrray()->FillAndResetBitArray(m_pAPEDecompress->GetInfo(APE_INFO_SEEK_BYTE, FrameIndex) - SeekRemainder, SeekRemainder * 8); + } + else + { + m_pAPEDecompressCore->GetUnBitArrray()->AdvanceToByteBoundary(); + } + } + else + { + if ((m_LastDecodedFrameIndex == -1) || ((FrameIndex - 1) != m_LastDecodedFrameIndex)) + { + m_pAPEDecompressCore->GetUnBitArrray()->FillAndResetBitArray(m_pAPEDecompress->GetInfo(APE_INFO_SEEK_BYTE, FrameIndex), m_pAPEDecompress->GetInfo(APE_INFO_SEEK_BIT, FrameIndex)); + } + } + + return ERROR_SUCCESS; +} + +/***************************************************************************************** +Old code for frame decompression +*****************************************************************************************/ +int CUnMAC::DecompressFrameOld(unsigned char *pOutputData, int32 FrameIndex, int CPULoadBalancingFactor) +{ + // error check the parameters (too high of a frame index, etc.) + if (FrameIndex >= m_pAPEDecompress->GetInfo(APE_INFO_TOTAL_FRAMES)) { return ERROR_SUCCESS; } + + // get the number of samples in the frame + int nBlocks = 0; + nBlocks = ((FrameIndex + 1) >= m_pAPEDecompress->GetInfo(APE_INFO_TOTAL_FRAMES)) ? m_pAPEDecompress->GetInfo(APE_INFO_FINAL_FRAME_BLOCKS) : m_pAPEDecompress->GetInfo(APE_INFO_BLOCKS_PER_FRAME); + if (nBlocks == 0) + return -1; // nothing to do (file must be zero length) (have to return error) + + // take care of seeking and frame alignment + if (SeekToFrame(FrameIndex) != 0) { return -1; } + + // get the checksum + unsigned int nSpecialCodes = 0; + uint32 nStoredCRC = 0; + + if (GET_USES_CRC(m_pAPEDecompress) == FALSE) + { + nStoredCRC = m_pAPEDecompressCore->GetUnBitArrray()->DecodeValue(DECODE_VALUE_METHOD_UNSIGNED_RICE, 30); + if (nStoredCRC == 0) + { + nSpecialCodes = SPECIAL_FRAME_LEFT_SILENCE | SPECIAL_FRAME_RIGHT_SILENCE; + } + } + else + { + nStoredCRC = m_pAPEDecompressCore->GetUnBitArrray()->DecodeValue(DECODE_VALUE_METHOD_UNSIGNED_INT); + + // get any 'special' codes if the file uses them (for silence, FALSE stereo, etc.) + nSpecialCodes = 0; + if (GET_USES_SPECIAL_FRAMES(m_pAPEDecompress)) + { + if (nStoredCRC & 0x80000000) + { + nSpecialCodes = m_pAPEDecompressCore->GetUnBitArrray()->DecodeValue(DECODE_VALUE_METHOD_UNSIGNED_INT); + } + nStoredCRC &= 0x7FFFFFFF; + } + } + + // the CRC that will be figured during decompression + uint32 CRC = 0xFFFFFFFF; + + // decompress and convert from (x,y) -> (l,r) + // sort of int and ugly.... sorry + if (m_pAPEDecompress->GetInfo(APE_INFO_CHANNELS) == 2) + { + m_pAPEDecompressCore->GenerateDecodedArrays(nBlocks, nSpecialCodes, FrameIndex, CPULoadBalancingFactor); + + WAVEFORMATEX WaveFormatEx; m_pAPEDecompress->GetInfo(APE_INFO_WAVEFORMATEX, (int) &WaveFormatEx); + m_pPrepare->UnprepareOld(m_pAPEDecompressCore->GetDataX(), m_pAPEDecompressCore->GetDataY(), nBlocks, &WaveFormatEx, + pOutputData, (unsigned int *) &CRC, (int *) &nSpecialCodes, m_pAPEDecompress->GetInfo(APE_INFO_FILE_VERSION)); + } + else if (m_pAPEDecompress->GetInfo(APE_INFO_CHANNELS) == 1) + { + m_pAPEDecompressCore->GenerateDecodedArrays(nBlocks, nSpecialCodes, FrameIndex, CPULoadBalancingFactor); + + WAVEFORMATEX WaveFormatEx; m_pAPEDecompress->GetInfo(APE_INFO_WAVEFORMATEX, (int) &WaveFormatEx); + m_pPrepare->UnprepareOld(m_pAPEDecompressCore->GetDataX(), NULL, nBlocks, &WaveFormatEx, + pOutputData, (unsigned int *) &CRC, (int *) &nSpecialCodes, m_pAPEDecompress->GetInfo(APE_INFO_FILE_VERSION)); + } + + if (GET_USES_SPECIAL_FRAMES(m_pAPEDecompress)) + { + CRC >>= 1; + } + + // check the CRC + if (GET_USES_CRC(m_pAPEDecompress) == FALSE) + { + uint32 nChecksum = CalculateOldChecksum(m_pAPEDecompressCore->GetDataX(), m_pAPEDecompressCore->GetDataY(), m_pAPEDecompress->GetInfo(APE_INFO_CHANNELS), nBlocks); + if (nChecksum != nStoredCRC) + return -1; + } + else + { + if (CRC != nStoredCRC) + return -1; + } + + m_LastDecodedFrameIndex = FrameIndex; + return nBlocks; +} + + +/***************************************************************************************** +Figures the old checksum using the X,Y data +*****************************************************************************************/ +uint32 CUnMAC::CalculateOldChecksum(int *pDataX, int *pDataY, int nChannels, int nBlocks) +{ + uint32 nChecksum = 0; + + if (nChannels == 2) + { + for (int z = 0; z < nBlocks; z++) + { + int R = pDataX[z] - (pDataY[z] / 2); + int L = R + pDataY[z]; + nChecksum += (labs(R) + labs(L)); + } + } + else if (nChannels == 1) + { + for (int z = 0; z < nBlocks; z++) + nChecksum += labs(pDataX[z]); + } + + return nChecksum; +} + +#endif // #ifdef BACKWARDS_COMPATIBILITY diff --git a/Libraries/MAC/Files/Source/MACLib/Old/UnMAC.h b/Libraries/MAC/Files/Source/MACLib/Old/UnMAC.h new file mode 100755 index 000000000..6d60edb02 --- /dev/null +++ b/Libraries/MAC/Files/Source/MACLib/Old/UnMAC.h @@ -0,0 +1,69 @@ +/***************************************************************************************** +UnMAC.h +Copyright (C) 2000-2001 by Matthew T. Ashland All Rights Reserved. + +Methods for decompressing or verifying APE files + +Notes: + -none +*****************************************************************************************/ + +#ifndef APE_UNMAC_H +#define APE_UNMAC_H + +#include "../BitArray.h" +#include "../UnBitArrayBase.h" + +class CAntiPredictor; +class CPrepare; +class CAPEDecompressCore; +class CPredictorBase; +class IPredictorDecompress; +class IAPEDecompress; + +/***************************************************************************************** +CUnMAC class... a class that allows decoding on a frame-by-frame basis +*****************************************************************************************/ +class CUnMAC +{ +public: + + // construction/destruction + CUnMAC(); + ~CUnMAC(); + + // functions + int Initialize(IAPEDecompress *pAPEDecompress); + int Uninitialize(); + int DecompressFrame(unsigned char *pOutputData, int32 FrameIndex, int CPULoadBalancingFactor = 0); + + int SeekToFrame(int FrameIndex); + +private: + + // data members + BOOL m_bInitialized; + int m_LastDecodedFrameIndex; + IAPEDecompress * m_pAPEDecompress; + CPrepare * m_pPrepare; + + CAPEDecompressCore * m_pAPEDecompressCore; + + // functions + void GenerateDecodedArrays(int nBlocks, int nSpecialCodes, int nFrameIndex, int nCPULoadBalancingFactor); + void GenerateDecodedArray(int *Input_Array, uint32 Number_of_Elements, int Frame_Index, CAntiPredictor *pAntiPredictor, int CPULoadBalancingFactor = 0); + + int CreateAntiPredictors(int nCompressionLevel, int nVersion); + + int DecompressFrameOld(unsigned char *pOutputData, int32 FrameIndex, int CPULoadBalancingFactor); + uint32 CalculateOldChecksum(int *pDataX, int *pDataY, int nChannels, int nBlocks); + +public: + + int m_nBlocksProcessed; + unsigned int m_nCRC; + unsigned int m_nStoredCRC; + WAVEFORMATEX m_wfeInput; +}; + +#endif // #ifndef APE_UNMAC_H diff --git a/Libraries/MAC/Files/Source/MACLib/Predictor.h b/Libraries/MAC/Files/Source/MACLib/Predictor.h new file mode 100755 index 000000000..a3ca7475b --- /dev/null +++ b/Libraries/MAC/Files/Source/MACLib/Predictor.h @@ -0,0 +1,30 @@ +#ifndef APE_PREDICTOR_H +#define APE_PREDICTOR_H + +/************************************************************************************************* +IPredictorCompress - the interface for compressing (predicting) data +*************************************************************************************************/ +class IPredictorCompress +{ +public: + IPredictorCompress(int nCompressionLevel) {} + virtual ~IPredictorCompress() {} + + virtual int CompressValue(int nA, int nB = 0) = 0; + virtual int Flush() = 0; +}; + +/************************************************************************************************* +IPredictorDecompress - the interface for decompressing (un-predicting) data +*************************************************************************************************/ +class IPredictorDecompress +{ +public: + IPredictorDecompress(int nCompressionLevel, int nVersion) {} + virtual ~IPredictorDecompress() {} + + virtual int DecompressValue(int nA, int nB = 0) = 0; + virtual int Flush() = 0; +}; + +#endif // #ifndef APE_PREDICTOR_H diff --git a/Libraries/MAC/Files/Source/MACLib/Prepare.cpp b/Libraries/MAC/Files/Source/MACLib/Prepare.cpp new file mode 100755 index 000000000..8a8c67b1f --- /dev/null +++ b/Libraries/MAC/Files/Source/MACLib/Prepare.cpp @@ -0,0 +1,537 @@ +#include "All.h" +#include "Prepare.h" + +const uint32 CRC32_TABLE[256] = {0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368, + 4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850, + 2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918000,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117}; + +#define READ_BUFFER(var,shift) \ + var |= (unsigned char)*pRawData << (shift); \ + CRC = ((unsigned int)CRC >> 8) ^ CRC32_TABLE [(CRC & 0xFF) ^ (unsigned char)*pRawData++] + +#define READ_BUFFER0(var,shift) \ + var = (unsigned char)*pRawData << (shift); \ + CRC = ((unsigned int)CRC >> 8) ^ CRC32_TABLE [(CRC & 0xFF) ^ (unsigned char)*pRawData++] + +#define READ_BUFFERS(var,shift) \ + var |= (char)(*pRawData) << (shift); \ + CRC = ((unsigned int)CRC >> 8) ^ CRC32_TABLE [(CRC & 0xFF) ^ (unsigned char)*pRawData++] + +#define READ_BUFFERS0(var,shift) \ + var = (char)(*pRawData) << (shift); \ + CRC = ((unsigned int)CRC >> 8) ^ CRC32_TABLE [(CRC & 0xFF) ^ (unsigned char)*pRawData++] + +int CPrepare::Prepare(const unsigned char * pRawData, int nBytes, const WAVEFORMATEX * pWaveFormatEx, int * pOutputX, int *pOutputY, unsigned int *pCRC, int *pSpecialCodes, int *pPeakLevel) +{ + // error check the parameters + if (pRawData == NULL || pWaveFormatEx == NULL) + return ERROR_BAD_PARAMETER; + + // initialize the pointers that got passed in + *pCRC = 0xFFFFFFFF; + *pSpecialCodes = 0; + + // variables + uint32 CRC = 0xFFFFFFFF; + const int nTotalBlocks = nBytes / pWaveFormatEx->nBlockAlign; + int R,L; + + // the prepare code + + if (pWaveFormatEx->wBitsPerSample == 8) + { + if (pWaveFormatEx->nChannels == 2) + { + for (int nBlockIndex = 0; nBlockIndex < nTotalBlocks; nBlockIndex++) + { + R = (int) (*((unsigned char *) pRawData) - 128); + L = (int) (*((unsigned char *) (pRawData + 1)) - 128); + + CRC = (CRC >> 8) ^ CRC32_TABLE[(CRC & 0xFF) ^ *pRawData++]; + CRC = (CRC >> 8) ^ CRC32_TABLE[(CRC & 0xFF) ^ *pRawData++]; + + // check the peak + if (labs(L) > *pPeakLevel) + *pPeakLevel = labs(L); + if (labs(R) > *pPeakLevel) + *pPeakLevel = labs(R); + + // convert to x,y + pOutputY[nBlockIndex] = L - R; + pOutputX[nBlockIndex] = R + (pOutputY[nBlockIndex] / 2); + } + } + else if (pWaveFormatEx->nChannels == 1) + { + for (int nBlockIndex = 0; nBlockIndex < nTotalBlocks; nBlockIndex++) + { + R = (int) (*((unsigned char *) pRawData) - 128); + + CRC = (CRC >> 8) ^ CRC32_TABLE[(CRC & 0xFF) ^ *pRawData++]; + + // check the peak + if (labs(R) > *pPeakLevel) + *pPeakLevel = labs(R); + + // convert to x,y + pOutputX[nBlockIndex] = R; + } + } + } + else if (pWaveFormatEx->wBitsPerSample == 24) + { + if (pWaveFormatEx->nChannels == 2) + { + for (int nBlockIndex = 0; nBlockIndex < nTotalBlocks; nBlockIndex++) + { + uint32 nTemp = 0; + + nTemp |= (*pRawData << 0); + CRC = (CRC >> 8) ^ CRC32_TABLE[(CRC & 0xFF) ^ *pRawData++]; + + nTemp |= (*pRawData << 8); + CRC = (CRC >> 8) ^ CRC32_TABLE[(CRC & 0xFF) ^ *pRawData++]; + + nTemp |= (*pRawData << 16); + CRC = (CRC >> 8) ^ CRC32_TABLE[(CRC & 0xFF) ^ *pRawData++]; + + if (nTemp & 0x800000) + R = (int) (nTemp & 0x7FFFFF) - 0x800000; + else + R = (int) (nTemp & 0x7FFFFF); + + nTemp = 0; + + nTemp |= (*pRawData << 0); + CRC = (CRC >> 8) ^ CRC32_TABLE[(CRC & 0xFF) ^ *pRawData++]; + + nTemp |= (*pRawData << 8); + CRC = (CRC >> 8) ^ CRC32_TABLE[(CRC & 0xFF) ^ *pRawData++]; + + nTemp |= (*pRawData << 16); + CRC = (CRC >> 8) ^ CRC32_TABLE[(CRC & 0xFF) ^ *pRawData++]; + + if (nTemp & 0x800000) + L = (int) (nTemp & 0x7FFFFF) - 0x800000; + else + L = (int) (nTemp & 0x7FFFFF); + + // check the peak + if (labs(L) > *pPeakLevel) + *pPeakLevel = labs(L); + if (labs(R) > *pPeakLevel) + *pPeakLevel = labs(R); + + // convert to x,y + pOutputY[nBlockIndex] = L - R; + pOutputX[nBlockIndex] = R + (pOutputY[nBlockIndex] / 2); + + } + } + else if (pWaveFormatEx->nChannels == 1) + { + for (int nBlockIndex = 0; nBlockIndex < nTotalBlocks; nBlockIndex++) + { + uint32 nTemp = 0; + + nTemp |= (*pRawData << 0); + CRC = (CRC >> 8) ^ CRC32_TABLE[(CRC & 0xFF) ^ *pRawData++]; + + nTemp |= (*pRawData << 8); + CRC = (CRC >> 8) ^ CRC32_TABLE[(CRC & 0xFF) ^ *pRawData++]; + + nTemp |= (*pRawData << 16); + CRC = (CRC >> 8) ^ CRC32_TABLE[(CRC & 0xFF) ^ *pRawData++]; + + if (nTemp & 0x800000) + R = (int) (nTemp & 0x7FFFFF) - 0x800000; + else + R = (int) (nTemp & 0x7FFFFF); + + // check the peak + if (labs(R) > *pPeakLevel) + *pPeakLevel = labs(R); + + // convert to x,y + pOutputX[nBlockIndex] = R; + } + } + } + else + { + if (pWaveFormatEx->nChannels == 2) + { + int LPeak = 0; + int RPeak = 0; + int nBlockIndex = 0; + for (nBlockIndex = 0; nBlockIndex < nTotalBlocks; nBlockIndex++) + { + /* + R = (int) *((int16 *) pRawData); + + CRC = (CRC >> 8) ^ CRC32_TABLE[(CRC & 0xFF) ^ *pRawData++]; + CRC = (CRC >> 8) ^ CRC32_TABLE[(CRC & 0xFF) ^ *pRawData++]; + + L = (int) *((int16 *) pRawData); + + CRC = (CRC >> 8) ^ CRC32_TABLE[(CRC & 0xFF) ^ *pRawData++]; + CRC = (CRC >> 8) ^ CRC32_TABLE[(CRC & 0xFF) ^ *pRawData++]; + */ + READ_BUFFER0( R, 0 ); + READ_BUFFERS( R, 8 ); + READ_BUFFER0( L, 0 ); + READ_BUFFERS( L, 8 ); + + // check the peak + if (labs(L) > LPeak) + LPeak = labs(L); + if (labs(R) > RPeak) + RPeak = labs(R); + + // convert to x,y + pOutputY[nBlockIndex] = L - R; + pOutputX[nBlockIndex] = R + (pOutputY[nBlockIndex] / 2); + } + + if (LPeak == 0) { *pSpecialCodes |= SPECIAL_FRAME_LEFT_SILENCE; } + if (RPeak == 0) { *pSpecialCodes |= SPECIAL_FRAME_RIGHT_SILENCE; } + if (max(LPeak, RPeak) > *pPeakLevel) + { + *pPeakLevel = max(LPeak, RPeak); + } + + // check for pseudo-stereo files + nBlockIndex = 0; + while (pOutputY[nBlockIndex++] == 0) + { + if (nBlockIndex == (nBytes / 4)) + { + *pSpecialCodes |= SPECIAL_FRAME_PSEUDO_STEREO; + break; + } + } + + } + else if (pWaveFormatEx->nChannels == 1) + { + int nPeak = 0; + for (int nBlockIndex = 0; nBlockIndex < nTotalBlocks; nBlockIndex++) + { + /* + R = (int) *((int16 *) pRawData); + + CRC = (CRC >> 8) ^ CRC32_TABLE[(CRC & 0xFF) ^ *pRawData++]; + CRC = (CRC >> 8) ^ CRC32_TABLE[(CRC & 0xFF) ^ *pRawData++]; + */ + READ_BUFFER0 ( R, 0 ); + READ_BUFFERS ( R, 8 ); + + // check the peak + if (labs(R) > nPeak) + nPeak = labs(R); + + //convert to x,y + pOutputX[nBlockIndex] = R; + } + + if (nPeak > *pPeakLevel) + *pPeakLevel = nPeak; + if (nPeak == 0) { *pSpecialCodes |= SPECIAL_FRAME_MONO_SILENCE; } + } + } + + CRC = CRC ^ 0xFFFFFFFF; + + // add the special code + CRC >>= 1; + + if (*pSpecialCodes != 0) + { + CRC |= (1 << 31); + } + + *pCRC = CRC; + + return ERROR_SUCCESS; +} + +void CPrepare::Unprepare(int X, int Y, const WAVEFORMATEX * pWaveFormatEx, unsigned char * pOutput, unsigned int * pCRC) +{ + #define CALCULATE_CRC_BYTE *pCRC = (*pCRC >> 8) ^ CRC32_TABLE[(*pCRC & 0xFF) ^ *pOutput++]; + // decompress and convert from (x,y) -> (l,r) + // sort of long and ugly.... sorry + + if (pWaveFormatEx->nChannels == 2) + { + if (pWaveFormatEx->wBitsPerSample == 16) + { + // get the right and left values + int nR = X - (Y / 2); + int nL = nR + Y; + + // error check (for overflows) + if ((nR < -32768) || (nR > 32767) || (nL < -32768) || (nL > 32767)) + { + throw(-1); + } + + *(int16 *) pOutput = swap_endian16(nR); + CALCULATE_CRC_BYTE + CALCULATE_CRC_BYTE + + *(int16 *) pOutput = swap_endian16(nL); + CALCULATE_CRC_BYTE + CALCULATE_CRC_BYTE + } + else if (pWaveFormatEx->wBitsPerSample == 8) + { + unsigned char R = (X - (Y / 2) + 128); + *pOutput = R; + CALCULATE_CRC_BYTE + *pOutput = (unsigned char) (R + Y); + CALCULATE_CRC_BYTE + } + else if (pWaveFormatEx->wBitsPerSample == 24) + { + int32 RV, LV; + + RV = X - (Y / 2); + LV = RV + Y; + + uint32 nTemp = 0; + if (RV < 0) + nTemp = ((uint32) (RV + 0x800000)) | 0x800000; + else + nTemp = (uint32) RV; + + *pOutput = (unsigned char) ((nTemp >> 0) & 0xFF); + CALCULATE_CRC_BYTE + *pOutput = (unsigned char) ((nTemp >> 8) & 0xFF); + CALCULATE_CRC_BYTE + *pOutput = (unsigned char) ((nTemp >> 16) & 0xFF); + CALCULATE_CRC_BYTE + + nTemp = 0; + if (LV < 0) + nTemp = ((uint32) (LV + 0x800000)) | 0x800000; + else + nTemp = (uint32) LV; + + *pOutput = (unsigned char) ((nTemp >> 0) & 0xFF); + CALCULATE_CRC_BYTE + + *pOutput = (unsigned char) ((nTemp >> 8) & 0xFF); + CALCULATE_CRC_BYTE + + *pOutput = (unsigned char) ((nTemp >> 16) & 0xFF); + CALCULATE_CRC_BYTE + } + } + else if (pWaveFormatEx->nChannels == 1) + { + if (pWaveFormatEx->wBitsPerSample == 16) + { + int16 R = X; + + *(int16 *) pOutput = swap_endian16(R);; + CALCULATE_CRC_BYTE + CALCULATE_CRC_BYTE + } + else if (pWaveFormatEx->wBitsPerSample == 8) + { + unsigned char R = X + 128; + *pOutput = R; + CALCULATE_CRC_BYTE + } + else if (pWaveFormatEx->wBitsPerSample == 24) + { + int32 RV = X; + + uint32 nTemp = 0; + if (RV < 0) + nTemp = ((uint32) (RV + 0x800000)) | 0x800000; + else + nTemp = (uint32) RV; + + *pOutput = (unsigned char) ((nTemp >> 0) & 0xFF); + CALCULATE_CRC_BYTE + *pOutput = (unsigned char) ((nTemp >> 8) & 0xFF); + CALCULATE_CRC_BYTE + *pOutput = (unsigned char) ((nTemp >> 16) & 0xFF); + CALCULATE_CRC_BYTE + } + } +} + +#ifdef BACKWARDS_COMPATIBILITY + +int CPrepare::UnprepareOld(int *pInputX, int *pInputY, int nBlocks, const WAVEFORMATEX *pWaveFormatEx, unsigned char *pRawData, unsigned int *pCRC, int *pSpecialCodes, int nFileVersion) +{ + // the CRC that will be figured during decompression + uint32 CRC = 0xFFFFFFFF; + + // decompress and convert from (x,y) -> (l,r) + // sort of int and ugly.... sorry + if (pWaveFormatEx->nChannels == 2) + { + // convert the x,y data to raw data + if (pWaveFormatEx->wBitsPerSample == 16) + { + int16 R; + unsigned char *Buffer = &pRawData[0]; + int *pX = pInputX; + int *pY = pInputY; + + for (; pX < &pInputX[nBlocks]; pX++, pY++) + { + R = *pX - (*pY / 2); + + *(int16 *) Buffer = (int16) R; + CRC = (CRC >> 8) ^ CRC32_TABLE[(CRC & 0xFF) ^ *Buffer++]; + CRC = (CRC >> 8) ^ CRC32_TABLE[(CRC & 0xFF) ^ *Buffer++]; + + *(int16 *) Buffer = (int16) R + *pY; + CRC = (CRC >> 8) ^ CRC32_TABLE[(CRC & 0xFF) ^ *Buffer++]; + CRC = (CRC >> 8) ^ CRC32_TABLE[(CRC & 0xFF) ^ *Buffer++]; + } + } + else if (pWaveFormatEx->wBitsPerSample == 8) + { + unsigned char *R = (unsigned char *) &pRawData[0]; + unsigned char *L = (unsigned char *) &pRawData[1]; + + if (nFileVersion > 3830) + { + for (int SampleIndex = 0; SampleIndex < nBlocks; SampleIndex++, L+=2, R+=2) + { + *R = (unsigned char) (pInputX[SampleIndex] - (pInputY[SampleIndex] / 2) + 128); + CRC = (CRC >> 8) ^ CRC32_TABLE[(CRC & 0xFF) ^ *R]; + *L = (unsigned char) (*R + pInputY[SampleIndex]); + CRC = (CRC >> 8) ^ CRC32_TABLE[(CRC & 0xFF) ^ *L]; + } + } + else + { + for (int SampleIndex = 0; SampleIndex < nBlocks; SampleIndex++, L+=2, R+=2) + { + *R = (unsigned char) (pInputX[SampleIndex] - (pInputY[SampleIndex] / 2)); + CRC = (CRC >> 8) ^ CRC32_TABLE[(CRC & 0xFF) ^ *R]; + *L = (unsigned char) (*R + pInputY[SampleIndex]); + CRC = (CRC >> 8) ^ CRC32_TABLE[(CRC & 0xFF) ^ *L]; + + } + } + } + else if (pWaveFormatEx->wBitsPerSample == 24) + { + unsigned char *Buffer = (unsigned char *) &pRawData[0]; + int32 RV, LV; + + for (int SampleIndex = 0; SampleIndex < nBlocks; SampleIndex++) + { + RV = pInputX[SampleIndex] - (pInputY[SampleIndex] / 2); + LV = RV + pInputY[SampleIndex]; + + uint32 nTemp = 0; + if (RV < 0) + nTemp = ((uint32) (RV + 0x800000)) | 0x800000; + else + nTemp = (uint32) RV; + + *Buffer = (unsigned char) ((nTemp >> 0) & 0xFF); + CRC = (CRC >> 8) ^ CRC32_TABLE[(CRC & 0xFF) ^ *Buffer++]; + + *Buffer = (unsigned char) ((nTemp >> 8) & 0xFF); + CRC = (CRC >> 8) ^ CRC32_TABLE[(CRC & 0xFF) ^ *Buffer++]; + + *Buffer = (unsigned char) ((nTemp >> 16) & 0xFF); + CRC = (CRC >> 8) ^ CRC32_TABLE[(CRC & 0xFF) ^ *Buffer++]; + + nTemp = 0; + if (LV < 0) + nTemp = ((uint32) (LV + 0x800000)) | 0x800000; + else + nTemp = (uint32) LV; + + *Buffer = (unsigned char) ((nTemp >> 0) & 0xFF); + CRC = (CRC >> 8) ^ CRC32_TABLE[(CRC & 0xFF) ^ *Buffer++]; + + *Buffer = (unsigned char) ((nTemp >> 8) & 0xFF); + CRC = (CRC >> 8) ^ CRC32_TABLE[(CRC & 0xFF) ^ *Buffer++]; + + *Buffer = (unsigned char) ((nTemp >> 16) & 0xFF); + CRC = (CRC >> 8) ^ CRC32_TABLE[(CRC & 0xFF) ^ *Buffer++]; + } + } + } + else if (pWaveFormatEx->nChannels == 1) + { + // convert to raw data + if (pWaveFormatEx->wBitsPerSample == 8) + { + unsigned char *R = (unsigned char *) &pRawData[0]; + + if (nFileVersion > 3830) + { + for (int SampleIndex = 0; SampleIndex < nBlocks; SampleIndex++, R++) + { + *R = pInputX[SampleIndex] + 128; + CRC = (CRC >> 8) ^ CRC32_TABLE[(CRC & 0xFF) ^ *R]; + } + } + else + { + for (int SampleIndex = 0; SampleIndex < nBlocks; SampleIndex++, R++) + { + *R = (unsigned char) (pInputX[SampleIndex]); + CRC = (CRC >> 8) ^ CRC32_TABLE[(CRC & 0xFF) ^ *R]; + } + } + + } + else if (pWaveFormatEx->wBitsPerSample == 24) + { + + unsigned char *Buffer = (unsigned char *) &pRawData[0]; + int32 RV; + for (int SampleIndex = 0; SampleIndex> 0) & 0xFF); + CRC = (CRC >> 8) ^ CRC32_TABLE[(CRC & 0xFF) ^ *Buffer++]; + + *Buffer = (unsigned char) ((nTemp >> 8) & 0xFF); + CRC = (CRC >> 8) ^ CRC32_TABLE[(CRC & 0xFF) ^ *Buffer++]; + + *Buffer = (unsigned char) ((nTemp >> 16) & 0xFF); + CRC = (CRC >> 8) ^ CRC32_TABLE[(CRC & 0xFF) ^ *Buffer++]; + } + } + else + { + unsigned char *Buffer = &pRawData[0]; + + for (int SampleIndex = 0; SampleIndex < nBlocks; SampleIndex++) + { + *(int16 *) Buffer = (int16) (pInputX[SampleIndex]); + CRC = (CRC >> 8) ^ CRC32_TABLE[(CRC & 0xFF) ^ *Buffer++]; + CRC = (CRC >> 8) ^ CRC32_TABLE[(CRC & 0xFF) ^ *Buffer++]; + } + } + } + + CRC = CRC ^ 0xFFFFFFFF; + + *pCRC = CRC; + + return 0; +} + +#endif // #ifdef BACKWARDS_COMPATIBILITY diff --git a/Libraries/MAC/Files/Source/MACLib/Prepare.h b/Libraries/MAC/Files/Source/MACLib/Prepare.h new file mode 100755 index 000000000..87860f9a6 --- /dev/null +++ b/Libraries/MAC/Files/Source/MACLib/Prepare.h @@ -0,0 +1,38 @@ +#ifndef APE_PREPARE_H +#define APE_PREPARE_H + +#define SPECIAL_FRAME_MONO_SILENCE 1 +#define SPECIAL_FRAME_LEFT_SILENCE 1 +#define SPECIAL_FRAME_RIGHT_SILENCE 2 +#define SPECIAL_FRAME_PSEUDO_STEREO 4 + +/***************************************************************************** +Manage the preparation stage of compression and decompression + +Tasks: + +1) convert data to 32-bit +2) convert L,R to X,Y +3) calculate the CRC +4) do simple analysis +5) check for the peak value +*****************************************************************************/ + +class IPredictorDecompress; + +class CPrepare +{ +public: + + int Prepare(const unsigned char * pRawData, int nBytes, const WAVEFORMATEX * pWaveFormatEx, int * pOutputX, int * pOutputY, unsigned int * pCRC, int * pSpecialCodes, int * pPeakLevel); + void Unprepare(int X, int Y, const WAVEFORMATEX * pWaveFormatEx, unsigned char * pOutput, unsigned int * pCRC); + + +#ifdef BACKWARDS_COMPATIBILITY + int UnprepareOld(int * pInputX, int *pInputY, int nBlocks, const WAVEFORMATEX * pWaveFormatEx, unsigned char * pRawData, unsigned int * pCRC, int * pSpecialCodes, int nFileVersion); +#endif + +}; + + +#endif // #ifndef APE_PREPARE_H diff --git a/Libraries/MAC/Files/Source/MACLib/ScaledFirstOrderFilter.h b/Libraries/MAC/Files/Source/MACLib/ScaledFirstOrderFilter.h new file mode 100755 index 000000000..4f590c4b8 --- /dev/null +++ b/Libraries/MAC/Files/Source/MACLib/ScaledFirstOrderFilter.h @@ -0,0 +1,31 @@ +#ifndef APE_SCALEDFIRSTORDERFILTER_H +#define APE_SCALEDFIRSTORDERFILTER_H + +template class CScaledFirstOrderFilter +{ +public: + + __inline void Flush() + { + m_nLastValue = 0; + } + + __inline int Compress(const int nInput) + { + int nRetVal = nInput - ((m_nLastValue * MULTIPLY) >> SHIFT); + m_nLastValue = nInput; + return nRetVal; + } + + __inline int Decompress(const int nInput) + { + m_nLastValue = nInput + ((m_nLastValue * MULTIPLY) >> SHIFT); + return m_nLastValue; + } + +protected: + + int m_nLastValue; +}; + +#endif // #ifndef APE_SCALEDFIRSTORDERFILTER_H diff --git a/Libraries/MAC/Files/Source/MACLib/StartFilter.h b/Libraries/MAC/Files/Source/MACLib/StartFilter.h new file mode 100755 index 000000000..863005ff4 --- /dev/null +++ b/Libraries/MAC/Files/Source/MACLib/StartFilter.h @@ -0,0 +1,178 @@ +#ifndef APE_START_FILTER_H +#define APE_START_FILTER_H + +class CStartFilter +{ +public: + + CStartFilter() + { + + } + + ~CStartFilter() + { + + + } + + void Flush() + { + m_rbInputA.Flush(); + m_rbInputB.Flush(); + + memset(m_aryMA, 0, sizeof(m_aryMA)); + memset(m_aryMB, 0, sizeof(m_aryMB)); + + m_Stage1FilterA1.Flush(); + m_Stage1FilterA2.Flush(); + m_Stage1FilterA3.Flush(); + + m_Stage1FilterB1.Flush(); + m_Stage1FilterB2.Flush(); + m_Stage1FilterB3.Flush(); + } + + void Compress(int & nA, int & nB) + { +/* + nA = m_Stage1FilterA1.Compress(nA); + nA = m_Stage1FilterA2.Compress(nA); + nA = m_Stage1FilterA3.Compress(nA); + + nB = m_Stage1FilterB1.Compress(nB); + nB = m_Stage1FilterB2.Compress(nB); + nB = m_Stage1FilterB3.Compress(nB); + return; +//*/ + + nA = m_Stage1FilterA1.Compress(nA); + nA = m_Stage1FilterA2.Compress(nA); +// nA = m_Stage1FilterA3.Compress(nA); + + nB = m_Stage1FilterB1.Compress(nB); + nB = m_Stage1FilterB2.Compress(nB); + + //int nTemp = nA; nA = nB; nB = nTemp; +// nB = m_Stage1FilterB3.Compress(nB); + +// nA = nA - nB; +// nB = nB + (nA / 2); + + +// return; + + m_rbInputA[0] = nA; m_rbInputB[0] = nB; + + { + int nPrediction1 = m_rbInputA[-1]; + int nPrediction2 = m_rbInputA[-2]; + int nPrediction3 = m_rbInputA[-1] - m_rbInputA[-2]; + int nPrediction4 = m_rbInputB[-1]; + + int nTotalPrediction = (nPrediction1 * m_aryMA[0]) + (nPrediction2 * m_aryMA[1]) + + (nPrediction3 * m_aryMA[2]) + (nPrediction4 * m_aryMA[3]); + int nOutput = nA - (nTotalPrediction >> 13); + + if (nOutput > 0) + { + m_aryMA[0] -= 2*((nPrediction1) ? ((nPrediction1 >> 30) & 2) - 1 : 0); + m_aryMA[1] -= (nPrediction2) ? ((nPrediction2 >> 30) & 2) - 1 : 0; + m_aryMA[2] -= (nPrediction3) ? ((nPrediction3 >> 30) & 2) - 1 : 0; + m_aryMA[3] -= 1*((nPrediction4) ? ((nPrediction4 >> 30) & 2) - 1 : 0); + } + else if (nOutput < 0) + { + m_aryMA[0] += 2*((nPrediction1) ? ((nPrediction1 >> 30) & 2) - 1 : 0); + m_aryMA[1] += (nPrediction2) ? ((nPrediction2 >> 30) & 2) - 1 : 0; + m_aryMA[2] += (nPrediction3) ? ((nPrediction3 >> 30) & 2) - 1 : 0; + m_aryMA[3] += 1*((nPrediction4) ? ((nPrediction4 >> 30) & 2) - 1 : 0); + } + + nA = nOutput; + } + { + int nPrediction1 = m_rbInputB[-1]; + int nPrediction2 = m_rbInputB[-2]; + int nPrediction3 = 0;//m_rbInputB[-1] - m_rbInputB[-2]; + int nPrediction4 = m_rbInputA[0]; + + int nTotalPrediction = (nPrediction1 * m_aryMB[0]) + (nPrediction2 * m_aryMB[1]) + + (nPrediction3 * m_aryMB[2]) + (nPrediction4 * m_aryMB[3]); + int nOutput = nB - (nTotalPrediction >> 13); + + if (nOutput > 0) + { + m_aryMB[0] -= 2*((nPrediction1) ? ((nPrediction1 >> 30) & 2) - 1 : 0); + m_aryMB[1] -= (nPrediction2) ? ((nPrediction2 >> 30) & 2) - 1 : 0; + m_aryMB[2] -= (nPrediction3) ? ((nPrediction3 >> 30) & 2) - 1 : 0; + m_aryMB[3] -= 1*((nPrediction4) ? ((nPrediction4 >> 30) & 2) - 1 : 0); + } + else if (nOutput < 0) + { + m_aryMB[0] += 2*((nPrediction1) ? ((nPrediction1 >> 30) & 2) - 1 : 0); + m_aryMB[1] += (nPrediction2) ? ((nPrediction2 >> 30) & 2) - 1 : 0; + m_aryMB[2] += (nPrediction3) ? ((nPrediction3 >> 30) & 2) - 1 : 0; + m_aryMB[3] += 1*((nPrediction4) ? ((nPrediction4 >> 30) & 2) - 1 : 0); + } + + nB = nOutput; + } + + + m_rbInputA.IncrementSafe(); + m_rbInputB.IncrementSafe(); + + +/* +// nInput = m_Filter1.Compress(nInput); + + m_rbInput[0] = nInput; + + int nPrediction1 = m_rbInput[-1]; + int nPrediction2 = (2 * m_rbInput[-1]) - m_rbInput[-2]; + int nPrediction3 = m_rbInput[-1] - m_rbInput[-2]; + int nPrediction4 = m_nLastOutput; + + int nTotalPrediction = ((nPrediction1) * m_aryM[0]) + (nPrediction2 * m_aryM[1]) + + ((nPrediction3 >> 1) * m_aryM[2]) + (nPrediction4 * m_aryM[3]); + int nOutput = nInput - (nTotalPrediction >> 13); + + if (nOutput > 0) + { + m_aryM[0] -= (nPrediction1) ? ((nPrediction1 >> 30) & 2) - 1 : 0; + m_aryM[1] -= (nPrediction2) ? ((nPrediction2 >> 30) & 2) - 1 : 0; + m_aryM[2] -= (nPrediction3) ? ((nPrediction3 >> 30) & 2) - 1 : 0; + m_aryM[3] -= (nPrediction4) ? ((nPrediction4 >> 30) & 2) - 1 : 0; + } + else if (nOutput < 0) + { + m_aryM[0] += (nPrediction1) ? ((nPrediction1 >> 30) & 2) - 1 : 0; + m_aryM[1] += (nPrediction2) ? ((nPrediction2 >> 30) & 2) - 1 : 0; + m_aryM[2] += (nPrediction3) ? ((nPrediction3 >> 30) & 2) - 1 : 0; + m_aryM[3] += (nPrediction4) ? ((nPrediction4 >> 30) & 2) - 1 : 0; + } + + m_nLastOutput = nOutput; + m_rbInput.IncrementSafe(); + + return nOutput; + //*/ + } + +protected: + + CScaledFirstOrderFilter<31, 5> m_Stage1FilterA1; + CScaledFirstOrderFilter<24, 5> m_Stage1FilterA2; + CScaledFirstOrderFilter<7, 5> m_Stage1FilterA3; + + CScaledFirstOrderFilter<31, 5> m_Stage1FilterB1; + CScaledFirstOrderFilter<24, 5> m_Stage1FilterB2; + CScaledFirstOrderFilter<7, 5> m_Stage1FilterB3; + + CRollBufferFast m_rbInputA; + CRollBufferFast m_rbInputB; + int m_aryMA[8]; int m_aryMB[8]; +}; + +#endif // #ifndef APE_START_FILTER_H diff --git a/Libraries/MAC/Files/Source/MACLib/UnBitArray.cpp b/Libraries/MAC/Files/Source/MACLib/UnBitArray.cpp new file mode 100755 index 000000000..735b3a99d --- /dev/null +++ b/Libraries/MAC/Files/Source/MACLib/UnBitArray.cpp @@ -0,0 +1,293 @@ +#include "All.h" +#include "APEInfo.h" +#include "UnBitArray.h" +#include "BitArray.h" + +const uint32 POWERS_OF_TWO_MINUS_ONE_REVERSED[33] = {4294967295,2147483647,1073741823,536870911,268435455,134217727,67108863,33554431,16777215,8388607,4194303,2097151,1048575,524287,262143,131071,65535,32767,16383,8191,4095,2047,1023,511,255,127,63,31,15,7,3,1,0}; + +const uint32 K_SUM_MIN_BOUNDARY[32] = {0,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131072,262144,524288,1048576,2097152,4194304,8388608,16777216,33554432,67108864,134217728,268435456,536870912,1073741824,2147483648,0,0,0,0}; + +const uint32 RANGE_TOTAL_1[65] = {0,14824,28224,39348,47855,53994,58171,60926,62682,63786,64463,64878,65126,65276,65365,65419,65450,65469,65480,65487,65491,65493,65494,65495,65496,65497,65498,65499,65500,65501,65502,65503,65504,65505,65506,65507,65508,65509,65510,65511,65512,65513,65514,65515,65516,65517,65518,65519,65520,65521,65522,65523,65524,65525,65526,65527,65528,65529,65530,65531,65532,65533,65534,65535,65536}; +const uint32 RANGE_WIDTH_1[64] = {14824,13400,11124,8507,6139,4177,2755,1756,1104,677,415,248,150,89,54,31,19,11,7,4,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}; + +const uint32 RANGE_TOTAL_2[65] = {0,19578,36160,48417,56323,60899,63265,64435,64971,65232,65351,65416,65447,65466,65476,65482,65485,65488,65490,65491,65492,65493,65494,65495,65496,65497,65498,65499,65500,65501,65502,65503,65504,65505,65506,65507,65508,65509,65510,65511,65512,65513,65514,65515,65516,65517,65518,65519,65520,65521,65522,65523,65524,65525,65526,65527,65528,65529,65530,65531,65532,65533,65534,65535,65536}; +const uint32 RANGE_WIDTH_2[64] = {19578,16582,12257,7906,4576,2366,1170,536,261,119,65,31,19,10,6,3,3,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,}; + +#define RANGE_OVERFLOW_TOTAL_WIDTH 65536 +#define RANGE_OVERFLOW_SHIFT 16 + +#define CODE_BITS 32 +#define TOP_VALUE ((unsigned int ) 1 << (CODE_BITS - 1)) +#define SHIFT_BITS (CODE_BITS - 9) +#define EXTRA_BITS ((CODE_BITS - 2) % 8 + 1) +#define BOTTOM_VALUE (TOP_VALUE >> 8) + +#define MODEL_ELEMENTS 64 + +/*********************************************************************************** +Construction +***********************************************************************************/ +CUnBitArray::CUnBitArray(CIO * pIO, int nVersion) +{ + CreateHelper(pIO, 16384, nVersion); + m_nFlushCounter = 0; + m_nFinalizeCounter = 0; +} + +CUnBitArray::~CUnBitArray() +{ + SAFE_ARRAY_DELETE(m_pBitArray) +} + +unsigned int CUnBitArray::DecodeValue(DECODE_VALUE_METHOD DecodeMethod, int nParam1, int nParam2) +{ + switch (DecodeMethod) + { + case DECODE_VALUE_METHOD_UNSIGNED_INT: + return DecodeValueXBits(32); + } + + return 0; +} + +void CUnBitArray::GenerateArray(int * pOutputArray, int nElements, int nBytesRequired) +{ + GenerateArrayRange(pOutputArray, nElements); +} + +__inline unsigned char CUnBitArray::GetC() +{ + unsigned char nValue = (unsigned char) (m_pBitArray[m_nCurrentBitIndex >> 5] >> (24 - (m_nCurrentBitIndex & 31))); + m_nCurrentBitIndex += 8; + return nValue; +} + +__inline int CUnBitArray::RangeDecodeFast(int nShift) +{ + while (m_RangeCoderInfo.range <= BOTTOM_VALUE) + { + m_RangeCoderInfo.buffer = (m_RangeCoderInfo.buffer << 8) | ((m_pBitArray[m_nCurrentBitIndex >> 5] >> (24 - (m_nCurrentBitIndex & 31))) & 0xFF); + m_nCurrentBitIndex += 8; + m_RangeCoderInfo.low = (m_RangeCoderInfo.low << 8) | ((m_RangeCoderInfo.buffer >> 1) & 0xFF); + m_RangeCoderInfo.range <<= 8; + } + + // decode + m_RangeCoderInfo.range = m_RangeCoderInfo.range >> nShift; + return m_RangeCoderInfo.low / m_RangeCoderInfo.range; +} + +__inline int CUnBitArray::RangeDecodeFastWithUpdate(int nShift) +{ + while (m_RangeCoderInfo.range <= BOTTOM_VALUE) + { + m_RangeCoderInfo.buffer = (m_RangeCoderInfo.buffer << 8) | ((m_pBitArray[m_nCurrentBitIndex >> 5] >> (24 - (m_nCurrentBitIndex & 31))) & 0xFF); + m_nCurrentBitIndex += 8; + m_RangeCoderInfo.low = (m_RangeCoderInfo.low << 8) | ((m_RangeCoderInfo.buffer >> 1) & 0xFF); + m_RangeCoderInfo.range <<= 8; + } + + // decode + m_RangeCoderInfo.range = m_RangeCoderInfo.range >> nShift; + int nRetVal = m_RangeCoderInfo.low / m_RangeCoderInfo.range; + m_RangeCoderInfo.low -= m_RangeCoderInfo.range * nRetVal; + return nRetVal; +} + +int CUnBitArray::DecodeValueRange(UNBIT_ARRAY_STATE & BitArrayState) +{ + // make sure there is room for the data + // this is a little slower than ensuring a huge block to start with, but it's safer + if (m_nCurrentBitIndex > m_nRefillBitThreshold) + { + FillBitArray(); + } + + int nValue = 0; + + if (m_nVersion >= 3990) + { + // figure the pivot value + int nPivotValue = max(BitArrayState.nKSum / 32, 1); + + // get the overflow + int nOverflow = 0; + { + // decode + int nRangeTotal = RangeDecodeFast(RANGE_OVERFLOW_SHIFT); + + // lookup the symbol (must be a faster way than this) + while (nRangeTotal >= RANGE_TOTAL_2[nOverflow + 1]) { nOverflow++; } + + // update + m_RangeCoderInfo.low -= m_RangeCoderInfo.range * RANGE_TOTAL_2[nOverflow]; + m_RangeCoderInfo.range = m_RangeCoderInfo.range * RANGE_WIDTH_2[nOverflow]; + + // get the working k + if (nOverflow == (MODEL_ELEMENTS - 1)) + { + nOverflow = RangeDecodeFastWithUpdate(16); + nOverflow <<= 16; + nOverflow |= RangeDecodeFastWithUpdate(16); + } + } + + // get the value + int nBase = 0; + { + int nShift = 0; + if (nPivotValue >= (1 << 16)) + { + int nPivotValueBits = 0; + while ((nPivotValue >> nPivotValueBits) > 0) { nPivotValueBits++; } + int nSplitFactor = 1 << (nPivotValueBits - 16); + + int nPivotValueA = (nPivotValue / nSplitFactor) + 1; + int nPivotValueB = nSplitFactor; + + while (m_RangeCoderInfo.range <= BOTTOM_VALUE) + { + m_RangeCoderInfo.buffer = (m_RangeCoderInfo.buffer << 8) | ((m_pBitArray[m_nCurrentBitIndex >> 5] >> (24 - (m_nCurrentBitIndex & 31))) & 0xFF); + m_nCurrentBitIndex += 8; + m_RangeCoderInfo.low = (m_RangeCoderInfo.low << 8) | ((m_RangeCoderInfo.buffer >> 1) & 0xFF); + m_RangeCoderInfo.range <<= 8; + } + m_RangeCoderInfo.range = m_RangeCoderInfo.range / nPivotValueA; + int nBaseA = m_RangeCoderInfo.low / m_RangeCoderInfo.range; + m_RangeCoderInfo.low -= m_RangeCoderInfo.range * nBaseA; + + while (m_RangeCoderInfo.range <= BOTTOM_VALUE) + { + m_RangeCoderInfo.buffer = (m_RangeCoderInfo.buffer << 8) | ((m_pBitArray[m_nCurrentBitIndex >> 5] >> (24 - (m_nCurrentBitIndex & 31))) & 0xFF); + m_nCurrentBitIndex += 8; + m_RangeCoderInfo.low = (m_RangeCoderInfo.low << 8) | ((m_RangeCoderInfo.buffer >> 1) & 0xFF); + m_RangeCoderInfo.range <<= 8; + } + m_RangeCoderInfo.range = m_RangeCoderInfo.range / nPivotValueB; + int nBaseB = m_RangeCoderInfo.low / m_RangeCoderInfo.range; + m_RangeCoderInfo.low -= m_RangeCoderInfo.range * nBaseB; + + nBase = nBaseA * nSplitFactor + nBaseB; + } + else + { + while (m_RangeCoderInfo.range <= BOTTOM_VALUE) + { + m_RangeCoderInfo.buffer = (m_RangeCoderInfo.buffer << 8) | ((m_pBitArray[m_nCurrentBitIndex >> 5] >> (24 - (m_nCurrentBitIndex & 31))) & 0xFF); + m_nCurrentBitIndex += 8; + m_RangeCoderInfo.low = (m_RangeCoderInfo.low << 8) | ((m_RangeCoderInfo.buffer >> 1) & 0xFF); + m_RangeCoderInfo.range <<= 8; + } + + // decode + m_RangeCoderInfo.range = m_RangeCoderInfo.range / nPivotValue; + int nBaseLower = m_RangeCoderInfo.low / m_RangeCoderInfo.range; + m_RangeCoderInfo.low -= m_RangeCoderInfo.range * nBaseLower; + + nBase = nBaseLower; + } + } + + // build the value + nValue = nBase + (nOverflow * nPivotValue); + } + else + { + // decode + int nRangeTotal = RangeDecodeFast(RANGE_OVERFLOW_SHIFT); + + // lookup the symbol (must be a faster way than this) + int nOverflow = 0; + while (nRangeTotal >= RANGE_TOTAL_1[nOverflow + 1]) { nOverflow++; } + + // update + m_RangeCoderInfo.low -= m_RangeCoderInfo.range * RANGE_TOTAL_1[nOverflow]; + m_RangeCoderInfo.range = m_RangeCoderInfo.range * RANGE_WIDTH_1[nOverflow]; + + // get the working k + int nTempK; + if (nOverflow == (MODEL_ELEMENTS - 1)) + { + nTempK = RangeDecodeFastWithUpdate(5); + nOverflow = 0; + } + else + { + nTempK = (BitArrayState.k < 1) ? 0 : BitArrayState.k - 1; + } + + // figure the extra bits on the left and the left value + if (nTempK <= 16 || m_nVersion < 3910) + { + nValue = RangeDecodeFastWithUpdate(nTempK); + } + else + { + int nX1 = RangeDecodeFastWithUpdate(16); + int nX2 = RangeDecodeFastWithUpdate(nTempK - 16); + nValue = nX1 | (nX2 << 16); + } + + // build the value and output it + nValue += (nOverflow << nTempK); + } + + // update nKSum + BitArrayState.nKSum += ((nValue + 1) / 2) - ((BitArrayState.nKSum + 16) >> 5); + + // update k + if (BitArrayState.nKSum < K_SUM_MIN_BOUNDARY[BitArrayState.k]) + BitArrayState.k--; + else if (BitArrayState.nKSum >= K_SUM_MIN_BOUNDARY[BitArrayState.k + 1]) + BitArrayState.k++; + + // output the value (converted to signed) + return (nValue & 1) ? (nValue >> 1) + 1 : -(nValue >> 1); +} + +void CUnBitArray::FlushState(UNBIT_ARRAY_STATE & BitArrayState) +{ + BitArrayState.k = 10; + BitArrayState.nKSum = (1 << BitArrayState.k) * 16; +} + +void CUnBitArray::FlushBitArray() +{ + AdvanceToByteBoundary(); + m_nCurrentBitIndex += 8; // ignore the first byte... (slows compression too much to not output this dummy byte) + m_RangeCoderInfo.buffer = GetC(); + m_RangeCoderInfo.low = m_RangeCoderInfo.buffer >> (8 - EXTRA_BITS); + m_RangeCoderInfo.range = (unsigned int) 1 << EXTRA_BITS; + + m_nRefillBitThreshold = (m_nBits - 512); +} + +void CUnBitArray::Finalize() +{ + // normalize + while (m_RangeCoderInfo.range <= BOTTOM_VALUE) + { + m_nCurrentBitIndex += 8; + m_RangeCoderInfo.range <<= 8; + } + + // used to back-pedal the last two bytes out + // this should never have been a problem because we've outputted and normalized beforehand + // but stopped doing it as of 3.96 in case it accounted for rare decompression failures + if (m_nVersion <= 3950) + m_nCurrentBitIndex -= 16; +} + +void CUnBitArray::GenerateArrayRange(int * pOutputArray, int nElements) +{ + UNBIT_ARRAY_STATE BitArrayState; + FlushState(BitArrayState); + FlushBitArray(); + + for (int z = 0; z < nElements; z++) + { + pOutputArray[z] = DecodeValueRange(BitArrayState); + } + + Finalize(); +} diff --git a/Libraries/MAC/Files/Source/MACLib/UnBitArray.h b/Libraries/MAC/Files/Source/MACLib/UnBitArray.h new file mode 100755 index 000000000..c0ce380ac --- /dev/null +++ b/Libraries/MAC/Files/Source/MACLib/UnBitArray.h @@ -0,0 +1,51 @@ +#ifndef APE_UNBITARRAY_H +#define APE_UNBITARRAY_H + +#include "UnBitArrayBase.h" + +class IAPEDecompress; + +struct RANGE_CODER_STRUCT_DECOMPRESS +{ + unsigned int low; // low end of interval + unsigned int range; // length of interval + unsigned int buffer; // buffer for input/output +}; + +class CUnBitArray : public CUnBitArrayBase +{ +public: + + // construction/destruction + CUnBitArray(CIO * pIO, int nVersion); + ~CUnBitArray(); + + unsigned int DecodeValue(DECODE_VALUE_METHOD DecodeMethod, int nParam1 = 0, int nParam2 = 0); + + void GenerateArray(int * pOutputArray, int nElements, int nBytesRequired = -1); + + int DecodeValueRange(UNBIT_ARRAY_STATE & BitArrayState); + + void FlushState(UNBIT_ARRAY_STATE & BitArrayState); + void FlushBitArray(); + void Finalize(); + +private: + + void GenerateArrayRange(int * pOutputArray, int nElements); + + // data + int m_nFlushCounter; + int m_nFinalizeCounter; + + RANGE_CODER_STRUCT_DECOMPRESS m_RangeCoderInfo; + + uint32 m_nRefillBitThreshold; + + // functions + inline int RangeDecodeFast(int nShift); + inline int RangeDecodeFastWithUpdate(int nShift); + inline unsigned char GetC(); +}; + +#endif // #ifndef APE_UNBITARRAY_H diff --git a/Libraries/MAC/Files/Source/MACLib/UnBitArrayBase.cpp b/Libraries/MAC/Files/Source/MACLib/UnBitArrayBase.cpp new file mode 100755 index 000000000..13f64c41e --- /dev/null +++ b/Libraries/MAC/Files/Source/MACLib/UnBitArrayBase.cpp @@ -0,0 +1,122 @@ +#include "All.h" +#include "UnBitArrayBase.h" +#include "APEInfo.h" +#include "UnBitArray.h" +#ifdef BACKWARDS_COMPATIBILITY + #include "Old/APEDecompressOld.h" + #include "Old/UnBitArrayOld.h" +#endif + +const uint32 POWERS_OF_TWO_MINUS_ONE[33] = {0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535,131071,262143,524287,1048575,2097151,4194303,8388607,16777215,33554431,67108863,134217727,268435455,536870911,1073741823,2147483647,4294967295}; + +CUnBitArrayBase * CreateUnBitArray(IAPEDecompress * pAPEDecompress, int nVersion) +{ +#ifdef BACKWARDS_COMPATIBILITY + if (nVersion >= 3900) + return (CUnBitArrayBase * ) new CUnBitArray(GET_IO(pAPEDecompress), nVersion); + else + return (CUnBitArrayBase * ) new CUnBitArrayOld(pAPEDecompress, nVersion); +#else + return (CUnBitArrayBase * ) new CUnBitArray(GET_IO(pAPEDecompress), nVersion); +#endif +} + +void CUnBitArrayBase::AdvanceToByteBoundary() +{ + int nMod = m_nCurrentBitIndex % 8; + if (nMod != 0) { m_nCurrentBitIndex += 8 - nMod; } +} + +uint32 CUnBitArrayBase::DecodeValueXBits(uint32 nBits) +{ + // get more data if necessary + if ((m_nCurrentBitIndex + nBits) >= m_nBits) + FillBitArray(); + + // variable declares + uint32 nLeftBits = 32 - (m_nCurrentBitIndex & 31); + uint32 nBitArrayIndex = m_nCurrentBitIndex >> 5; + m_nCurrentBitIndex += nBits; + + // if their isn't an overflow to the right value, get the value and exit + if (nLeftBits >= nBits) + return (m_pBitArray[nBitArrayIndex] & (POWERS_OF_TWO_MINUS_ONE[nLeftBits])) >> (nLeftBits - nBits); + + // must get the "split" value from left and right + int nRightBits = nBits - nLeftBits; + + uint32 nLeftValue = ((m_pBitArray[nBitArrayIndex] & POWERS_OF_TWO_MINUS_ONE[nLeftBits]) << nRightBits); + uint32 nRightValue = (m_pBitArray[nBitArrayIndex + 1] >> (32 - nRightBits)); + return (nLeftValue | nRightValue); +} + +int CUnBitArrayBase::FillAndResetBitArray(int nFileLocation, int nNewBitIndex) +{ + int i; + // reset the bit index + m_nCurrentBitIndex = nNewBitIndex; + + // seek if necessary + if (nFileLocation != -1) + { + if (m_pIO->Seek(nFileLocation, FILE_BEGIN) != 0) + return ERROR_IO_READ; + } + + // read the new data into the bit array + unsigned int nBytesRead = 0; + if (m_pIO->Read(((unsigned char *) m_pBitArray), m_nBytes, &nBytesRead) != 0) + return ERROR_IO_READ; + for(i=0;i<(m_nBytes/4);i++) { + m_pBitArray[i] = swap_endian32(m_pBitArray[i]); + } + + return 0; +} + +int CUnBitArrayBase::FillBitArray() +{ + int i; + // get the bit array index + uint32 nBitArrayIndex = m_nCurrentBitIndex >> 5; + + // move the remaining data to the front + memmove((void *) (m_pBitArray), (const void *) (m_pBitArray + nBitArrayIndex), m_nBytes - (nBitArrayIndex * 4)); + + // read the new data + int nBytesToRead = nBitArrayIndex * 4; + unsigned int nBytesRead = 0; + int nRetVal = m_pIO->Read((unsigned char *) (m_pBitArray + m_nElements - nBitArrayIndex), nBytesToRead, &nBytesRead); + + unsigned int *ptr = m_pBitArray + m_nElements - nBitArrayIndex; + for(i=0;i<(nBytesToRead/4);i++) { + ptr[i] = swap_endian32(ptr[i]); + } + + // adjust the m_Bit pointer + m_nCurrentBitIndex = m_nCurrentBitIndex & 31; + + // return + return (nRetVal == 0) ? 0 : ERROR_IO_READ; +} + +int CUnBitArrayBase::CreateHelper(CIO * pIO, int nBytes, int nVersion) +{ + // check the parameters + if ((pIO == NULL) || (nBytes <= 0)) { return ERROR_BAD_PARAMETER; } + + // save the size + m_nElements = nBytes / 4; + m_nBytes = m_nElements * 4; + m_nBits = m_nBytes * 8; + + // set the variables + m_pIO = pIO; + m_nVersion = nVersion; + m_nCurrentBitIndex = 0; + + // create the bitarray + m_pBitArray = new uint32 [m_nElements]; + + return (m_pBitArray != NULL) ? 0 : ERROR_INSUFFICIENT_MEMORY; +} diff --git a/Libraries/MAC/Files/Source/MACLib/UnBitArrayBase.h b/Libraries/MAC/Files/Source/MACLib/UnBitArrayBase.h new file mode 100755 index 000000000..aa18ff0c2 --- /dev/null +++ b/Libraries/MAC/Files/Source/MACLib/UnBitArrayBase.h @@ -0,0 +1,59 @@ +#ifndef APE_UNBITARRAYBASE_H +#define APE_UNBITARRAYBASE_H + +class IAPEDecompress; +class CIO; + +struct UNBIT_ARRAY_STATE +{ + uint32 k; + uint32 nKSum; +}; + +enum DECODE_VALUE_METHOD +{ + DECODE_VALUE_METHOD_UNSIGNED_INT, + DECODE_VALUE_METHOD_UNSIGNED_RICE, + DECODE_VALUE_METHOD_X_BITS +}; + +class CUnBitArrayBase +{ +public: + + // virtual destructor + virtual ~CUnBitArrayBase() {} + + // functions + virtual int FillBitArray(); + virtual int FillAndResetBitArray(int nFileLocation = -1, int nNewBitIndex = 0); + + virtual void GenerateArray(int * pOutputArray, int nElements, int nBytesRequired = -1) {} + virtual unsigned int DecodeValue(DECODE_VALUE_METHOD DecodeMethod, int nParam1 = 0, int nParam2 = 0) { return 0; } + + virtual void AdvanceToByteBoundary(); + + virtual int DecodeValueRange(UNBIT_ARRAY_STATE & BitArrayState) { return 0; } + virtual void FlushState(UNBIT_ARRAY_STATE & BitArrayState) {} + virtual void FlushBitArray() {} + virtual void Finalize() {} + +protected: + + virtual int CreateHelper(CIO * pIO, int nBytes, int nVersion); + virtual uint32 DecodeValueXBits(uint32 nBits); + + uint32 m_nElements; + uint32 m_nBytes; + uint32 m_nBits; + + int m_nVersion; + CIO * m_pIO; + + uint32 m_nCurrentBitIndex; + uint32 * m_pBitArray; +}; + +CUnBitArrayBase * CreateUnBitArray(IAPEDecompress * pAPEDecompress, int nVersion); + +#endif // #ifndef APE_UNBITARRAYBASE_H diff --git a/Libraries/MAC/Files/Source/MACLib/WAVInputSource.cpp b/Libraries/MAC/Files/Source/MACLib/WAVInputSource.cpp new file mode 100755 index 000000000..1b94c1918 --- /dev/null +++ b/Libraries/MAC/Files/Source/MACLib/WAVInputSource.cpp @@ -0,0 +1,292 @@ +#include "All.h" +#include "WAVInputSource.h" +#include IO_HEADER_FILE +#include "MACLib.h" +#include "GlobalFunctions.h" +#include "CharacterHelper.h" + +struct RIFF_HEADER +{ + char cRIFF[4]; // the characters 'RIFF' indicating that it's a RIFF file + unsigned long nBytes; // the number of bytes following this header +}; + +struct DATA_TYPE_ID_HEADER +{ + char cDataTypeID[4]; // should equal 'WAVE' for a WAV file +}; + +struct WAV_FORMAT_HEADER +{ + unsigned short nFormatTag; // the format of the WAV...should equal 1 for a PCM file + unsigned short nChannels; // the number of channels + unsigned long nSamplesPerSecond; // the number of samples per second + unsigned long nBytesPerSecond; // the bytes per second + unsigned short nBlockAlign; // block alignment + unsigned short nBitsPerSample; // the number of bits per sample +}; + +struct RIFF_CHUNK_HEADER +{ + char cChunkLabel[4]; // should equal "data" indicating the data chunk + unsigned long nChunkBytes; // the bytes of the chunk +}; + + +CInputSource * CreateInputSource(const char * pSourceName, WAVEFORMATEX * pwfeSource, int * pTotalBlocks, int * pHeaderBytes, int * pTerminatingBytes, int * pErrorCode) +{ + // error check the parameters + if ((pSourceName == NULL) || (strlen(pSourceName) == 0)) + { + if (pErrorCode) *pErrorCode = ERROR_BAD_PARAMETER; + return NULL; + } + + // get the extension + const char * pExtension = &pSourceName[strlen(pSourceName)]; + while ((pExtension > pSourceName) && (*pExtension != '.')) + pExtension--; + + // create the proper input source + if (strcasecmp(pExtension, ".wav") == 0) + { + if (pErrorCode) *pErrorCode = ERROR_SUCCESS; + return new CWAVInputSource(pSourceName, pwfeSource, pTotalBlocks, pHeaderBytes, pTerminatingBytes, pErrorCode); + } + else + { + if (pErrorCode) *pErrorCode = ERROR_INVALID_INPUT_FILE; + return NULL; + } +} + +CWAVInputSource::CWAVInputSource(CIO * pIO, WAVEFORMATEX * pwfeSource, int * pTotalBlocks, int * pHeaderBytes, int * pTerminatingBytes, int * pErrorCode) + : CInputSource(pIO, pwfeSource, pTotalBlocks, pHeaderBytes, pTerminatingBytes, pErrorCode) +{ + m_bIsValid = FALSE; + + if (pIO == NULL || pwfeSource == NULL) + { + if (pErrorCode) *pErrorCode = ERROR_BAD_PARAMETER; + return; + } + + m_spIO.Assign(pIO, FALSE, FALSE); + + int nRetVal = AnalyzeSource(); + if (nRetVal == ERROR_SUCCESS) + { + // fill in the parameters + if (pwfeSource) memcpy(pwfeSource, &m_wfeSource, sizeof(WAVEFORMATEX)); + if (pTotalBlocks) *pTotalBlocks = m_nDataBytes / m_wfeSource.nBlockAlign; + if (pHeaderBytes) *pHeaderBytes = m_nHeaderBytes; + if (pTerminatingBytes) *pTerminatingBytes = m_nTerminatingBytes; + + m_bIsValid = TRUE; + } + + if (pErrorCode) *pErrorCode = nRetVal; +} + +CWAVInputSource::CWAVInputSource(const char * pSourceName, WAVEFORMATEX * pwfeSource, int * pTotalBlocks, int * pHeaderBytes, int * pTerminatingBytes, int * pErrorCode) + : CInputSource(pSourceName, pwfeSource, pTotalBlocks, pHeaderBytes, pTerminatingBytes, pErrorCode) +{ + m_bIsValid = FALSE; + + if (pSourceName == NULL || pwfeSource == NULL) + { + if (pErrorCode) *pErrorCode = ERROR_BAD_PARAMETER; + return; + } + + m_spIO.Assign(new IO_CLASS_NAME); + if (m_spIO->Open(pSourceName) != ERROR_SUCCESS) + { + m_spIO.Delete(); + if (pErrorCode) *pErrorCode = ERROR_INVALID_INPUT_FILE; + return; + } + + int nRetVal = AnalyzeSource(); + if (nRetVal == ERROR_SUCCESS) + { + // fill in the parameters + if (pwfeSource) memcpy(pwfeSource, &m_wfeSource, sizeof(WAVEFORMATEX)); + if (pTotalBlocks) *pTotalBlocks = m_nDataBytes / m_wfeSource.nBlockAlign; + if (pHeaderBytes) *pHeaderBytes = m_nHeaderBytes; + if (pTerminatingBytes) *pTerminatingBytes = m_nTerminatingBytes; + + m_bIsValid = TRUE; + } + + if (pErrorCode) *pErrorCode = nRetVal; +} + +CWAVInputSource::~CWAVInputSource() +{ + + +} + +int CWAVInputSource::AnalyzeSource() +{ + // seek to the beginning (just in case) + m_spIO->Seek(0, FILE_BEGIN); + + // get the file size + m_nFileBytes = m_spIO->GetSize(); + + // get the RIFF header + RIFF_HEADER RIFFHeader; + RETURN_ON_ERROR(ReadSafe(m_spIO, &RIFFHeader, sizeof(RIFFHeader))) + RIFFHeader.nBytes = swap_endian32(RIFFHeader.nBytes); + + // make sure the RIFF header is valid + if (!(RIFFHeader.cRIFF[0] == 'R' && RIFFHeader.cRIFF[1] == 'I' && RIFFHeader.cRIFF[2] == 'F' && RIFFHeader.cRIFF[3] == 'F')) + return ERROR_INVALID_INPUT_FILE; + + // read the data type header + DATA_TYPE_ID_HEADER DataTypeIDHeader; + RETURN_ON_ERROR(ReadSafe(m_spIO, &DataTypeIDHeader, sizeof(DataTypeIDHeader))) + + // make sure it's the right data type + if (!(DataTypeIDHeader.cDataTypeID[0] == 'W' && DataTypeIDHeader.cDataTypeID[1] == 'A' && DataTypeIDHeader.cDataTypeID[2] == 'V' && DataTypeIDHeader.cDataTypeID[3] == 'E')) + return ERROR_INVALID_INPUT_FILE; + + // find the 'fmt ' chunk + RIFF_CHUNK_HEADER RIFFChunkHeader; + RETURN_ON_ERROR(ReadSafe(m_spIO, &RIFFChunkHeader, sizeof(RIFFChunkHeader))) + RIFFChunkHeader.nChunkBytes = swap_endian32(RIFFChunkHeader.nChunkBytes); + + while (!(RIFFChunkHeader.cChunkLabel[0] == 'f' && RIFFChunkHeader.cChunkLabel[1] == 'm' && RIFFChunkHeader.cChunkLabel[2] == 't' && RIFFChunkHeader.cChunkLabel[3] == ' ')) + { + // move the file pointer to the end of this chunk + m_spIO->Seek(RIFFChunkHeader.nChunkBytes, FILE_CURRENT); + + // check again for the data chunk + RETURN_ON_ERROR(ReadSafe(m_spIO, &RIFFChunkHeader, sizeof(RIFFChunkHeader))) + RIFFChunkHeader.nChunkBytes = swap_endian32(RIFFChunkHeader.nChunkBytes); + } + + // read the format info + WAV_FORMAT_HEADER WAVFormatHeader; + RETURN_ON_ERROR(ReadSafe(m_spIO, &WAVFormatHeader, sizeof(WAVFormatHeader))) + WAVFormatHeader.nFormatTag = swap_endian16(WAVFormatHeader.nFormatTag); + WAVFormatHeader.nChannels = swap_endian16(WAVFormatHeader.nChannels); + WAVFormatHeader.nSamplesPerSecond = swap_endian32(WAVFormatHeader.nSamplesPerSecond); + WAVFormatHeader.nBytesPerSecond = swap_endian32(WAVFormatHeader.nBytesPerSecond); + WAVFormatHeader.nBlockAlign = swap_endian16(WAVFormatHeader.nBlockAlign); + WAVFormatHeader.nBitsPerSample = swap_endian16(WAVFormatHeader.nBitsPerSample); + + // error check the header to see if we support it + if (WAVFormatHeader.nFormatTag != 1) + return ERROR_INVALID_INPUT_FILE; + + // copy the format information to the WAVEFORMATEX passed in + FillWaveFormatEx(&m_wfeSource, WAVFormatHeader.nSamplesPerSecond, WAVFormatHeader.nBitsPerSample, WAVFormatHeader.nChannels); + + // skip over any extra data in the header + int nWAVFormatHeaderExtra = RIFFChunkHeader.nChunkBytes - sizeof(WAVFormatHeader); + if (nWAVFormatHeaderExtra < 0) + return ERROR_INVALID_INPUT_FILE; + else + m_spIO->Seek(nWAVFormatHeaderExtra, FILE_CURRENT); + + // find the data chunk + RETURN_ON_ERROR(ReadSafe(m_spIO, &RIFFChunkHeader, sizeof(RIFFChunkHeader))) + RIFFChunkHeader.nChunkBytes = swap_endian32(RIFFChunkHeader.nChunkBytes); + + while (!(RIFFChunkHeader.cChunkLabel[0] == 'd' && RIFFChunkHeader.cChunkLabel[1] == 'a' && RIFFChunkHeader.cChunkLabel[2] == 't' && RIFFChunkHeader.cChunkLabel[3] == 'a')) + { + // move the file pointer to the end of this chunk + m_spIO->Seek(RIFFChunkHeader.nChunkBytes, FILE_CURRENT); + + // check again for the data chunk + RETURN_ON_ERROR(ReadSafe(m_spIO, &RIFFChunkHeader, sizeof(RIFFChunkHeader))) + RIFFChunkHeader.nChunkBytes = swap_endian32(RIFFChunkHeader.nChunkBytes); + } + + // we're at the data block + m_nHeaderBytes = m_spIO->GetPosition(); + m_nDataBytes = RIFFChunkHeader.nChunkBytes; + if (m_nDataBytes < 0) + m_nDataBytes = m_nFileBytes - m_nHeaderBytes; + + // make sure the data bytes is a whole number of blocks + if ((m_nDataBytes % m_wfeSource.nBlockAlign) != 0) + return ERROR_INVALID_INPUT_FILE; + + // calculate the terminating byts + m_nTerminatingBytes = m_nFileBytes - m_nDataBytes - m_nHeaderBytes; + + // we made it this far, everything must be cool + return ERROR_SUCCESS; +} + +int CWAVInputSource::GetData(unsigned char * pBuffer, int nBlocks, int * pBlocksRetrieved) +{ + if (!m_bIsValid) return ERROR_UNDEFINED; + + int nBytes = (m_wfeSource.nBlockAlign * nBlocks); + unsigned int nBytesRead = 0; + + if (m_spIO->Read(pBuffer, nBytes, &nBytesRead) != ERROR_SUCCESS) + return ERROR_IO_READ; + + if (pBlocksRetrieved) *pBlocksRetrieved = (nBytesRead / m_wfeSource.nBlockAlign); + + return ERROR_SUCCESS; +} + +int CWAVInputSource::GetHeaderData(unsigned char * pBuffer) +{ + if (!m_bIsValid) return ERROR_UNDEFINED; + + int nRetVal = ERROR_SUCCESS; + + if (m_nHeaderBytes > 0) + { + int nOriginalFileLocation = m_spIO->GetPosition(); + + m_spIO->Seek(0, FILE_BEGIN); + + unsigned int nBytesRead = 0; + int nReadRetVal = m_spIO->Read(pBuffer, m_nHeaderBytes, &nBytesRead); + + if ((nReadRetVal != ERROR_SUCCESS) || (m_nHeaderBytes != int(nBytesRead))) + { + nRetVal = ERROR_UNDEFINED; + } + + m_spIO->Seek(nOriginalFileLocation, FILE_BEGIN); + } + + return nRetVal; +} + +int CWAVInputSource::GetTerminatingData(unsigned char * pBuffer) +{ + if (!m_bIsValid) return ERROR_UNDEFINED; + + int nRetVal = ERROR_SUCCESS; + + + if (m_nTerminatingBytes > 0) + { + int nOriginalFileLocation = m_spIO->GetPosition(); + + m_spIO->Seek(-m_nTerminatingBytes, FILE_END); + + unsigned int nBytesRead = 0; + int nReadRetVal = m_spIO->Read(pBuffer, m_nTerminatingBytes, &nBytesRead); + + if ((nReadRetVal != ERROR_SUCCESS) || (m_nTerminatingBytes != int(nBytesRead))) + { + nRetVal = ERROR_UNDEFINED; + } + + m_spIO->Seek(nOriginalFileLocation, FILE_BEGIN); + } + + return nRetVal; +} diff --git a/Libraries/MAC/Files/Source/MACLib/WAVInputSource.h b/Libraries/MAC/Files/Source/MACLib/WAVInputSource.h new file mode 100755 index 000000000..a175a9673 --- /dev/null +++ b/Libraries/MAC/Files/Source/MACLib/WAVInputSource.h @@ -0,0 +1,64 @@ +#ifndef APE_WAVINPUTSOURCE_H +#define APE_WAVINPUTSOURCE_H + +#include "IO.h" + +/************************************************************************************* +CInputSource - base input format class (allows multiple format support) +*************************************************************************************/ +class CInputSource +{ +public: + + // construction / destruction + CInputSource(CIO * pIO, WAVEFORMATEX * pwfeSource, int * pTotalBlocks, int * pHeaderBytes, int * pTerminatingBytes, int * pErrorCode = NULL) { } + CInputSource(const char * pSourceName, WAVEFORMATEX * pwfeSource, int * pTotalBlocks, int * pHeaderBytes, int * pTerminatingBytes, int * pErrorCode = NULL) { } + virtual ~CInputSource() { } + + // get data + virtual int GetData(unsigned char * pBuffer, int nBlocks, int * pBlocksRetrieved) = 0; + + // get header / terminating data + virtual int GetHeaderData(unsigned char * pBuffer) = 0; + virtual int GetTerminatingData(unsigned char * pBuffer) = 0; +}; + +/************************************************************************************* +CWAVInputSource - wraps working with WAV files (could be extended to any format) +*************************************************************************************/ +class CWAVInputSource : public CInputSource +{ +public: + + // construction / destruction + CWAVInputSource(CIO * pIO, WAVEFORMATEX * pwfeSource, int * pTotalBlocks, int * pHeaderBytes, int * pTerminatingBytes, int * pErrorCode = NULL); + CWAVInputSource(const char * pSourceName, WAVEFORMATEX * pwfeSource, int * pTotalBlocks, int * pHeaderBytes, int * pTerminatingBytes, int * pErrorCode = NULL); + ~CWAVInputSource(); + + // get data + int GetData(unsigned char * pBuffer, int nBlocks, int * pBlocksRetrieved); + + // get header / terminating data + int GetHeaderData(unsigned char * pBuffer); + int GetTerminatingData(unsigned char * pBuffer); + +private: + + int AnalyzeSource(); + + CSmartPtr m_spIO; + + WAVEFORMATEX m_wfeSource; + int m_nHeaderBytes; + int m_nDataBytes; + int m_nTerminatingBytes; + int m_nFileBytes; + BOOL m_bIsValid; +}; + +/************************************************************************************* +Input souce creation +*************************************************************************************/ +CInputSource * CreateInputSource(const char * pSourceName, WAVEFORMATEX * pwfeSource, int * pTotalBlocks, int * pHeaderBytes, int * pTerminatingBytes, int * pErrorCode = NULL); + +#endif // #ifndef APE_WAVINPUTSOURCE_H diff --git a/Libraries/MAC/Files/Source/MACLib/md5.h b/Libraries/MAC/Files/Source/MACLib/md5.h new file mode 100755 index 000000000..9fa01f30e --- /dev/null +++ b/Libraries/MAC/Files/Source/MACLib/md5.h @@ -0,0 +1,79 @@ +/* + * Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All rights reserved. + * + * License to copy and use this software is granted provided that it is identified + * as the "RSA Data Security, Inc. MD5 Message-Digest Algorithm" in all material + * mentioning or referencing this software or this function. + * + * License is also granted to make and use derivative works provided that such + * works are identified as "derived from the RSA Data Security, Inc. MD5 Message- + * Digest Algorithm" in all material mentioning or referencing the derived work. + * + * RSA Data Security, Inc. makes no representations concerning either the + * merchantability of this software or the suitability of this software for any + * particular purpose. It is provided "as is" without express or implied warranty + * of any kind. These notices must be retained in any copies of any part of this + * documentation and/or software. + */ + +#ifndef MD5SUM_MD5_H +#define MD5SUM_MD5_H + +typedef unsigned int uint32_t; +typedef unsigned char uint8_t; + +/* + * Define the MD5 context structure + * Please DO NOT change the order or contents of the structure as various assembler files depend on it !! + */ + +typedef struct { + uint32_t state [ 4]; /* state (ABCD) */ + uint32_t count [ 2]; /* number of bits, modulo 2^64 (least sig word first) */ + uint8_t buffer [64]; /* input buffer for incomplete buffer data */ +} MD5_CTX; + +void MD5Init ( MD5_CTX* ctx ); +void MD5Update ( MD5_CTX* ctx, const uint8_t* buf, size_t len ); +void MD5Final ( uint8_t digest [16], MD5_CTX* ctx ); + +class CMD5Helper +{ +public: + + CMD5Helper(BOOL bInitialize = TRUE) + { + if (bInitialize) + Initialize(); + } + + BOOL Initialize() + { + memset(&m_MD5Context, 0, sizeof(m_MD5Context)); + MD5Init(&m_MD5Context); + m_nTotalBytes = 0; + return TRUE; + } + + inline void AddData(const void * pData, int nBytes) + { + MD5Update(&m_MD5Context, (const unsigned char *) pData, nBytes); + m_nTotalBytes += nBytes; + } + + BOOL GetResult(unsigned char cResult[16]) + { + memset(cResult, 0, 16); + MD5Final(cResult, &m_MD5Context); + return TRUE; + } + +protected: + + MD5_CTX m_MD5Context; + BOOL m_bStopped; + int m_nTotalBytes; +}; + + +#endif /* MD5SUM_MD5_H */ diff --git a/Libraries/MAC/Files/Source/Readme.htm b/Libraries/MAC/Files/Source/Readme.htm new file mode 100755 index 000000000..736f08333 --- /dev/null +++ b/Libraries/MAC/Files/Source/Readme.htm @@ -0,0 +1,67 @@ + + + + + + +Monkey + + + + +

Monkey's Audio Source Code +Readme
+
(last updated July 7, 2002)

+

Introduction

+

First off, just to be clear, you have to fully +agree with the included license agreement before using / viewing any of the +included materials.  The big points are that you can't steal code or try to +make money with it (without permission) and that you have to submit changes and +improvements back to the Monkey's Audio project.  With that out of the way, +I'm hoping that by releasing the source code, we'll be able to work together to +make Monkey's Audio better.  Please direct any suggestions or improvements +to the Monkey's Audio developer's forum or to me personally when appropriate. +(email @ monkeysaudio.com)  And thank you for taking the time to help.

+

Important Note

+

The Monkey's Audio format is not +"finalized".  In fact, the compression / decompression engines +are continually being improved.  This is what makes MAC fun to work on, and +it's what makes progress possible.  I realize that this can be a pain for +3rd party developers, but it's the only way to avoid stagnation.  So, you +can not hard code Monkey's Audio support and expect it to work with the newest +versions of MAC forever.  Either use a DLL or else accept that you'll have +to re-link to MACLib once in a while.

+

Things that it'd be great if you worked on

+

1. It would be nice to have makefiles for gcc +or any other compilers that people commonly use.

+

2. Pour through the code and look for bone-head +maneuvers.

+

3. Submit any necessary changes for +cross-platform compilation. 

+

4. XMMS, Lame DLL, PocketPC, etc. plugins / +implementations.

+

5. A console front-end that doesn't suck. (more +options, etc.)  Also, don't worry about maintaining compatibility with the +current parameter passing scheme -- just use whatever makes sense.

+

Tips for building MACLib outside of Windows

+

1. in "Shared/All.h" do this:

+
    +
  • #define BUILD_CROSS_PLATFORM
  • +
  • look through "Shared/All.h" and + "Shared/NoWindows.h" to make sure all the defines are acceptable
  • +
+

2. You need to use NASM to build the assembly +if you want it. (helps speed a lot)  Check out "MacLib/Assembly/..." +for more information.

+

Known non-Windows problems (help fixing them +would be great)

+

2. The macros PUMP_MESSAGE_LOOP, MESSAGEBOX, and a few others don't work.

+

 

+

- +All materials and programs copyrighted ©2000-2002 by Matthew T. Ashland -

+

- +All rights reserved. -

+ + + + diff --git a/Libraries/MAC/Files/Source/Shared/.DS_Store b/Libraries/MAC/Files/Source/Shared/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..9d3c9bf89e041174dfd09db19aaafc6cf9f4ffbe GIT binary patch literal 12292 zcmeI1!D>@M6o&ta5lgSM2?gm!xGvoYBJR_ewgyDSqHZ;5Y6CGTF+~uBJb;@%L?6Ky zaOJ`maN#5P4Emolqs*P$-nbGmXUfbO?wxm?1tJp@yrliPy zsSBkRu3V#a)C0%e(WKuSO?nGs?Sc_70!F|H7y%>jZxG-+Tguu6?|pyQS|eZtR+51H zKIE)oTfxq~)t?SFngY<)d07kl%mY-D2ippE?yX8Wr_UZ-kh+j!I4|e@T!z!Of}MNo z<#1jO7d*R=p*ZzUU9Q97THab~1dPBU0mxp^`_i#*)Q`SCa7_fJr?TDVG zUmn9v&hoCXie8}S$B_Q|^gKWtr=)RI5y7`4f{hA&;#>FNYvg+i`%1j0 zmLH_{jc1uF#<-w2p9n)U<8bS5ikNqzz7%t OBVYuKfD!n=3H$`NJ!b;| literal 0 HcmV?d00001 diff --git a/Libraries/MAC/Files/Source/Shared/APEInfoDialog.cpp b/Libraries/MAC/Files/Source/Shared/APEInfoDialog.cpp new file mode 100755 index 000000000..d3b2b3ae2 --- /dev/null +++ b/Libraries/MAC/Files/Source/Shared/APEInfoDialog.cpp @@ -0,0 +1,308 @@ +#include "All.h" +#include "APEInfo.h" +#include "APEInfoDialog.h" +#include "ID3Genres.h" +#include "APECompress.h" +#include "CharacterHelper.h" + +/*************************************************************************************** +The dialog component ID's +***************************************************************************************/ +#define FILE_NAME_EDIT 1000 + +#define ENCODER_VERSION_STATIC 2000 +#define COMPRESSION_LEVEL_STATIC 2001 +#define FORMAT_FLAGS_STATIC 2002 +#define HAS_TAG_STATIC 2003 + +#define SAMPLE_RATE_STATIC 3000 +#define CHANNELS_STATIC 3001 +#define BITS_PER_SAMPLE_STATIC 3002 +#define PEAK_LEVEL_STATIC 3003 + +#define TRACK_LENGTH_STATIC 4000 +#define WAV_SIZE_STATIC 4001 +#define APE_SIZE_STATIC 4002 +#define COMPRESSION_RATIO_STATIC 4003 + +#define TITLE_EDIT 5000 +#define ARTIST_EDIT 5001 +#define ALBUM_EDIT 5002 +#define COMMENT_EDIT 5003 +#define YEAR_EDIT 5004 +#define GENRE_COMBOBOX 5005 +#define TRACK_EDIT 5006 + +#define SAVE_TAG_BUTTON 6000 +#define REMOVE_TAG_BUTTON 6001 +#define CANCEL_BUTTON 6002 + +/*************************************************************************************** +Global pointer to this instance +***************************************************************************************/ +CAPEInfoDialog * g_pAPEDecompressDialog = NULL; + +/*************************************************************************************** +Construction / destruction +***************************************************************************************/ +CAPEInfoDialog::CAPEInfoDialog() +{ + g_pAPEDecompressDialog = NULL; +} + +CAPEInfoDialog::~CAPEInfoDialog() +{ + +} + +/*************************************************************************************** +Display the file info dialog +***************************************************************************************/ +int CAPEInfoDialog::ShowAPEInfoDialog(const str_utf16 * pFilename, HINSTANCE hInstance, const str_utf16 * lpszTemplateName, HWND hWndParent) +{ + // only allow one instance at a time + if (g_pAPEDecompressDialog != NULL) { return -1; } + + // open the file + int nErrorCode = ERROR_SUCCESS; + m_pAPEDecompress = CreateIAPEDecompress(pFilename, &nErrorCode); + if (m_pAPEDecompress == NULL || nErrorCode != ERROR_SUCCESS) + return nErrorCode; + + g_pAPEDecompressDialog = this; + + DialogBoxParam(hInstance, lpszTemplateName, hWndParent, (DLGPROC) DialogProc, 0); + + // clean up + SAFE_DELETE(m_pAPEDecompress); + g_pAPEDecompressDialog = NULL; + + return 0; +} + +/*************************************************************************************** +Fill the genre combobox +***************************************************************************************/ +int CAPEInfoDialog::FillGenreComboBox(HWND hDlg, int nComboBoxID, char *pSelectedGenre) +{ + // declare the variables + int nRetVal; + HWND hGenreComboBox = GetDlgItem(hDlg, nComboBoxID); + + // reset the contents of the combobox + SendMessage(hGenreComboBox, CB_RESETCONTENT, 0, 0); + + // propagate the combobox (0 to 126 so "Undefined" isn't repeated) + for (int z = 0; z < GENRE_COUNT; z++) + { + //add the genre string + nRetVal = SendMessage(hGenreComboBox, CB_ADDSTRING, 0, (LPARAM) g_ID3Genre[z]); + if (nRetVal == CB_ERR) { return -1; } + } + + // add the 'Undefined' genre + nRetVal = SendMessage(hGenreComboBox, CB_ADDSTRING, 0, (LPARAM) "Undefined"); + if (nRetVal == CB_ERR) { return -1; } + + // set the genre id (if it's specified) + if (pSelectedGenre) + { + if (strlen(pSelectedGenre) > 0) + SendMessage(hGenreComboBox, CB_SELECTSTRING, -1, (LPARAM) pSelectedGenre); + } + + return 0; +} + +/*************************************************************************************** +The dialog procedure +***************************************************************************************/ +LRESULT CALLBACK CAPEInfoDialog::DialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) +{ + // get the class + IAPEDecompress * pAPEDecompress = g_pAPEDecompressDialog->m_pAPEDecompress; + + int wmID, wmEvent; + + switch (message) + { + case WM_INITDIALOG: + { + // variable declares + TCHAR cTemp[1024] = { 0 }; + + // set info + wchar_t cFilename[MAX_PATH + 1] = {0}; + GET_IO(pAPEDecompress)->GetName(&cFilename[0]); + + SetDlgItemText(hDlg, FILE_NAME_EDIT, cFilename); + + switch (pAPEDecompress->GetInfo(APE_INFO_COMPRESSION_LEVEL)) + { + case COMPRESSION_LEVEL_FAST: _stprintf(cTemp, _T("Mode: Fast")); break; + case COMPRESSION_LEVEL_NORMAL: _stprintf(cTemp, _T("Mode: Normal")); break; + case COMPRESSION_LEVEL_HIGH: _stprintf(cTemp, _T("Mode: High")); break; + case COMPRESSION_LEVEL_EXTRA_HIGH: _stprintf(cTemp, _T("Mode: Extra High")); break; + case COMPRESSION_LEVEL_INSANE: _stprintf(cTemp, _T("Mode: Insane")); break; + default: _stprintf(cTemp, _T("Mode: Unknown")); break; + } + SetDlgItemText(hDlg, COMPRESSION_LEVEL_STATIC, cTemp); + + _stprintf(cTemp, _T("Version: %.2f"), float(pAPEDecompress->GetInfo(APE_INFO_FILE_VERSION)) / float(1000)); + SetDlgItemText(hDlg, ENCODER_VERSION_STATIC, cTemp); + + _stprintf(cTemp, _T("Format Flags: %d"), pAPEDecompress->GetInfo(APE_INFO_FORMAT_FLAGS)); + SetDlgItemText(hDlg, FORMAT_FLAGS_STATIC, cTemp); + + _stprintf(cTemp, _T("Sample Rate: %d"), pAPEDecompress->GetInfo(APE_INFO_SAMPLE_RATE)); + SetDlgItemText(hDlg, SAMPLE_RATE_STATIC, cTemp); + + _stprintf(cTemp, _T("Channels: %d"), pAPEDecompress->GetInfo(APE_INFO_CHANNELS)); + SetDlgItemText(hDlg, CHANNELS_STATIC, cTemp); + + _stprintf(cTemp, _T("Bits Per Sample: %d"), pAPEDecompress->GetInfo(APE_INFO_BITS_PER_SAMPLE)); + SetDlgItemText(hDlg, BITS_PER_SAMPLE_STATIC, cTemp); + + int nSeconds = pAPEDecompress->GetInfo(APE_INFO_LENGTH_MS) / 1000; int nMinutes = nSeconds / 60; nSeconds = nSeconds % 60; int nHours = nMinutes / 60; nMinutes = nMinutes % 60; + if (nHours > 0) _stprintf(cTemp, _T("Length: %d:%02d:%02d"), nHours, nMinutes, nSeconds); + else if (nMinutes > 0) _stprintf(cTemp, _T("Length: %d:%02d"), nMinutes, nSeconds); + else _stprintf(cTemp, _T("Length: 0:%02d"), nSeconds); + SetDlgItemText(hDlg, TRACK_LENGTH_STATIC, cTemp); + + int nPeakLevel = pAPEDecompress->GetInfo(APE_INFO_PEAK_LEVEL); + if (nPeakLevel >= 0) _stprintf(cTemp, _T("Peak Level: %d"), nPeakLevel); + else _stprintf(cTemp, _T("Peak Level: ?")); + SetDlgItemText(hDlg, PEAK_LEVEL_STATIC, cTemp); + + // the file size + _stprintf(cTemp, _T("APE: %.2f MB"), float(pAPEDecompress->GetInfo(APE_INFO_APE_TOTAL_BYTES)) / float(1048576)); + SetDlgItemText(hDlg, APE_SIZE_STATIC, cTemp); + + _stprintf(cTemp, _T("WAV: %.2f MB"), float(pAPEDecompress->GetInfo(APE_INFO_WAV_TOTAL_BYTES)) / float(1048576)); + SetDlgItemText(hDlg, WAV_SIZE_STATIC, cTemp); + + // the compression ratio + _stprintf(cTemp, _T("Compression: %.2f%%"), float(pAPEDecompress->GetInfo(APE_INFO_AVERAGE_BITRATE) * 100) / float(pAPEDecompress->GetInfo(APE_INFO_DECOMPRESSED_BITRATE))); + SetDlgItemText(hDlg, COMPRESSION_RATIO_STATIC, cTemp); + + // the has tag + BOOL bHasID3Tag = GET_TAG(pAPEDecompress)->GetHasID3Tag(); + BOOL bHasAPETag = GET_TAG(pAPEDecompress)->GetHasAPETag(); + + if (!bHasID3Tag && !bHasAPETag) + _stprintf(cTemp, _T("Tag: None")); + else if (bHasID3Tag && !bHasAPETag) + _stprintf(cTemp, _T("Tag: ID3v1.1")); + else if (!bHasID3Tag && bHasAPETag) + _stprintf(cTemp, _T("Tag: APE Tag")); + else + _stprintf(cTemp, _T("Tag: Corrupt")); + SetDlgItemText(hDlg, HAS_TAG_STATIC, cTemp); + + wchar_t cBuffer[256]; + int nBufferBytes = 256; + + nBufferBytes = 256; + GET_TAG(pAPEDecompress)->GetFieldString(APE_TAG_FIELD_TITLE, cBuffer, &nBufferBytes); + SetDlgItemText(hDlg, TITLE_EDIT, cBuffer); + + nBufferBytes = 256; + GET_TAG(pAPEDecompress)->GetFieldString(APE_TAG_FIELD_ARTIST, cBuffer, &nBufferBytes); + SetDlgItemText(hDlg, ARTIST_EDIT, cBuffer); + + nBufferBytes = 256; + GET_TAG(pAPEDecompress)->GetFieldString(APE_TAG_FIELD_ALBUM, cBuffer, &nBufferBytes); + SetDlgItemText(hDlg, ALBUM_EDIT, cBuffer); + + nBufferBytes = 256; + GET_TAG(pAPEDecompress)->GetFieldString(APE_TAG_FIELD_COMMENT, cBuffer, &nBufferBytes); + SetDlgItemText(hDlg, COMMENT_EDIT, cBuffer); + + nBufferBytes = 256; + GET_TAG(pAPEDecompress)->GetFieldString(APE_TAG_FIELD_YEAR, cBuffer, &nBufferBytes); + SetDlgItemText(hDlg, YEAR_EDIT, cBuffer); + + nBufferBytes = 256; + GET_TAG(pAPEDecompress)->GetFieldString(APE_TAG_FIELD_TRACK, cBuffer, &nBufferBytes); + SetDlgItemText(hDlg, TRACK_EDIT, cBuffer); + + g_pAPEDecompressDialog->FillGenreComboBox(hDlg, GENRE_COMBOBOX, NULL); + + nBufferBytes = 256; + GET_TAG(pAPEDecompress)->GetFieldString(APE_TAG_FIELD_GENRE, cBuffer, &nBufferBytes); + SetDlgItemText(hDlg, GENRE_COMBOBOX, cBuffer); + + return TRUE; + break; + } + case WM_COMMAND: + wmID = LOWORD(wParam); + wmEvent = HIWORD(wParam); + + switch (wmID) + { + case IDCANCEL: + // traps the [esc] key + EndDialog(hDlg, 0); + return TRUE; + break; + case CANCEL_BUTTON: + EndDialog(hDlg, 0); + return TRUE; + break; + case REMOVE_TAG_BUTTON: + { + // make sure you really wanted to + int nRetVal = ::MessageBox(hDlg, _T("Are you sure you want to permanently remove the tag?"), _T("Are You Sure?"), MB_YESNO | MB_ICONQUESTION); + if (nRetVal == IDYES) + { + // remove the ID3 tag... + if (GET_TAG(pAPEDecompress)->Remove() != 0) + { + MessageBox(hDlg, _T("Error removing tag. (could the file be read-only?)"), _T("Error Removing Tag"), MB_OK | MB_ICONEXCLAMATION); + return TRUE; + } + else + { + EndDialog(hDlg, 0); + return TRUE; + } + } + break; + } + case SAVE_TAG_BUTTON: + + // make the id3 tag + TCHAR cBuffer[256]; int z; + + #define SAVE_FIELD(ID, Field) \ + for (z = 0; z < 256; z++) { cBuffer[z] = 0; } \ + GetDlgItemText(hDlg, ID, cBuffer, 256); \ + GET_TAG(pAPEDecompress)->SetFieldString(Field, cBuffer); + + SAVE_FIELD(TITLE_EDIT, APE_TAG_FIELD_TITLE) + SAVE_FIELD(ARTIST_EDIT, APE_TAG_FIELD_ARTIST) + SAVE_FIELD(ALBUM_EDIT, APE_TAG_FIELD_ALBUM) + SAVE_FIELD(COMMENT_EDIT, APE_TAG_FIELD_COMMENT) + SAVE_FIELD(TRACK_EDIT, APE_TAG_FIELD_TRACK) + SAVE_FIELD(YEAR_EDIT, APE_TAG_FIELD_YEAR) + SAVE_FIELD(GENRE_COMBOBOX, APE_TAG_FIELD_GENRE) + + if (GET_TAG(pAPEDecompress)->Save() != 0) + { + MessageBox(hDlg, _T("Error saving tag. (could the file be read-only?)"), _T("Error Saving Tag"), MB_OK | MB_ICONEXCLAMATION); + return TRUE; + } + + EndDialog(hDlg, 0); + break; + } + break; + case WM_CLOSE: + EndDialog(hDlg, 0); + return TRUE; + break; + } + + return FALSE; +} \ No newline at end of file diff --git a/Libraries/MAC/Files/Source/Shared/APEInfoDialog.h b/Libraries/MAC/Files/Source/Shared/APEInfoDialog.h new file mode 100755 index 000000000..0362aba87 --- /dev/null +++ b/Libraries/MAC/Files/Source/Shared/APEInfoDialog.h @@ -0,0 +1,22 @@ +#ifndef APE_APEINFODIALOG_H +#define APE_APEINFODIALOG_H + +BOOL CALLBACK FileInfoDialogProcedureA(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); + +class CAPEInfoDialog +{ +public: + + CAPEInfoDialog(); + ~CAPEInfoDialog(); + + int ShowAPEInfoDialog(const str_utf16 * pFilename, HINSTANCE hInstance, const str_utf16 * lpszTemplateName, HWND hWndParent); + +private: + + static LRESULT CALLBACK DialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); + int FillGenreComboBox(HWND hDlg, int nComboBoxID, char * pSelectedGenre); + IAPEDecompress * m_pAPEDecompress; +}; + +#endif // #ifndef APE_APEINFODIALOG_H \ No newline at end of file diff --git a/Libraries/MAC/Files/Source/Shared/All.h b/Libraries/MAC/Files/Source/Shared/All.h new file mode 100755 index 000000000..8fdc8009e --- /dev/null +++ b/Libraries/MAC/Files/Source/Shared/All.h @@ -0,0 +1,250 @@ +#ifndef APE_ALL_H +#define APE_ALL_H + +/***************************************************************************************** +Cross platform building switch +*****************************************************************************************/ +#define BUILD_CROSS_PLATFORM + +/***************************************************************************************** +Unicode +*****************************************************************************************/ +#ifdef _UNICODE + +#else + +#endif // #ifdef _UNICODE + + +/***************************************************************************************** +Global includes +*****************************************************************************************/ +#ifndef BUILD_CROSS_PLATFORM + #include +#endif + +#ifdef _WIN32 + #include + #include +#else + #include + #include + #include + #include + #include + #include "NoWindows.h" + #include +#endif + +#include +#include +#include +#include +#include +#include "SmartPtr.h" + +/***************************************************************************************** +Global compiler settings (useful for porting) +*****************************************************************************************/ +#ifndef BUILD_CROSS_PLATFORM + #define ENABLE_ASSEMBLY +#endif + +//#define BACKWARDS_COMPATIBILITY + +#define ENABLE_COMPRESSION_MODE_FAST +#define ENABLE_COMPRESSION_MODE_NORMAL +#define ENABLE_COMPRESSION_MODE_HIGH +#define ENABLE_COMPRESSION_MODE_EXTRA_HIGH + +#ifdef _WIN32 + typedef unsigned __int32 uint32; + typedef __int32 int32; + typedef unsigned __int16 uint16; + typedef __int16 int16; + typedef unsigned __int8 uint8; + typedef __int8 int8; + typedef char str_ansi; + typedef unsigned char str_utf8; + typedef wchar_t str_utf16; + + #define IO_USE_WIN_FILE_IO + #define IO_HEADER_FILE "WinFileIO.h" + #define IO_CLASS_NAME CWinFileIO + #define DLLEXPORT __declspec(dllexport) + #define SLEEP(MILLISECONDS) ::Sleep(MILLISECONDS) + #define MESSAGEBOX(PARENT, TEXT, CAPTION, TYPE) ::MessageBox(PARENT, TEXT, CAPTION, TYPE) + #define PUMP_MESSAGE_LOOP { MSG Msg; while (PeekMessage(&Msg, NULL, 0, 0, PM_REMOVE) != 0) { TranslateMessage(&Msg); DispatchMessage(&Msg); } } + #define ODS OutputDebugString + #define TICK_COUNT_TYPE unsigned long + #define TICK_COUNT_READ(VARIABLE) VARIABLE = GetTickCount() + #define TICK_COUNT_FREQ 1000 +#else + #define IO_USE_STD_LIB_FILE_IO + #define IO_HEADER_FILE "StdLibFileIO.h" + #define IO_CLASS_NAME CStdLibFileIO + #define DLLEXPORT + #define SLEEP(MILLISECONDS) { struct timespec t; t.tv_sec = (MILLISECONDS) / 1000; t.tv_nsec = (MILLISECONDS) % 1000 * 1000000; nanosleep(&t, NULL); } + #define MESSAGEBOX(PARENT, TEXT, CAPTION, TYPE) + #define PUMP_MESSAGE_LOOP + #define ODS printf + #define TICK_COUNT_TYPE unsigned long long + #define TICK_COUNT_READ(VARIABLE) { struct timeval t; gettimeofday(&t, NULL); VARIABLE = t.tv_sec * 1000000LLU + t.tv_usec; } + #define TICK_COUNT_FREQ 1000000 +#endif + +/***************************************************************************************** +Global defines +*****************************************************************************************/ +#define MAC_VERSION_NUMBER 3990 +#define MAC_VERSION_STRING _T("3.99") +#define MAC_NAME _T("Monkey's Audio 3.99") +#define PLUGIN_NAME "Monkey's Audio Player v3.99" +#define MJ_PLUGIN_NAME _T("APE Plugin (v3.99)") +#define CONSOLE_NAME "--- Monkey's Audio Console Front End (v 3.99) (c) Matthew T. Ashland ---\n" +#define PLUGIN_ABOUT _T("Monkey's Audio Player v3.99\nCopyrighted (c) 2000-2004 by Matthew T. Ashland") +#define MAC_DLL_INTERFACE_VERSION_NUMBER 1000 + +/***************************************************************************************** +Byte order +*****************************************************************************************/ +#define __LITTLE_ENDIAN 1234 +#define __BIG_ENDIAN 4321 +#define __BYTE_ORDER __BIG_ENDIAN + +/***************************************************************************************** +Macros +*****************************************************************************************/ +#define MB(TEST) MESSAGEBOX(NULL, TEST, _T("Information"), MB_OK); +#define MBN(NUMBER) { TCHAR cNumber[16]; _stprintf(cNumber, _T("%d"), NUMBER); MESSAGEBOX(NULL, cNumber, _T("Information"), MB_OK); } + +#define SAFE_DELETE(POINTER) if (POINTER) { delete POINTER; POINTER = NULL; } +#define SAFE_ARRAY_DELETE(POINTER) if (POINTER) { delete [] POINTER; POINTER = NULL; } +#define SAFE_VOID_CLASS_DELETE(POINTER, Class) { Class *pClass = (Class *) POINTER; if (pClass) { delete pClass; POINTER = NULL; } } +#define SAFE_FILE_CLOSE(HANDLE) if (HANDLE != INVALID_HANDLE_VALUE) { CloseHandle(HANDLE); HANDLE = INVALID_HANDLE_VALUE; } + +#define ODN(NUMBER) { TCHAR cNumber[16]; _stprintf(cNumber, _T("%d\n"), int(NUMBER)); ODS(cNumber); } + +#define CATCH_ERRORS(CODE) try { CODE } catch(...) { } + +#define RETURN_ON_ERROR(FUNCTION) { int nRetVal = FUNCTION; if (nRetVal != 0) { return nRetVal; } } +#define RETURN_VALUE_ON_ERROR(FUNCTION, VALUE) { int nRetVal = FUNCTION; if (nRetVal != 0) { return VALUE; } } +#define RETURN_ON_EXCEPTION(CODE, VALUE) { try { CODE } catch(...) { return VALUE; } } + +#define THROW_ON_ERROR(CODE) { int nRetVal = CODE; if (nRetVal != 0) throw(nRetVal); } + +#define EXPAND_1_TIMES(CODE) CODE +#define EXPAND_2_TIMES(CODE) CODE CODE +#define EXPAND_3_TIMES(CODE) CODE CODE CODE +#define EXPAND_4_TIMES(CODE) CODE CODE CODE CODE +#define EXPAND_5_TIMES(CODE) CODE CODE CODE CODE CODE +#define EXPAND_6_TIMES(CODE) CODE CODE CODE CODE CODE CODE +#define EXPAND_7_TIMES(CODE) CODE CODE CODE CODE CODE CODE CODE +#define EXPAND_8_TIMES(CODE) CODE CODE CODE CODE CODE CODE CODE CODE +#define EXPAND_9_TIMES(CODE) CODE CODE CODE CODE CODE CODE CODE CODE CODE +#define EXPAND_12_TIMES(CODE) CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE +#define EXPAND_14_TIMES(CODE) CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE +#define EXPAND_15_TIMES(CODE) CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE +#define EXPAND_16_TIMES(CODE) CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE +#define EXPAND_30_TIMES(CODE) CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE +#define EXPAND_31_TIMES(CODE) CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE +#define EXPAND_32_TIMES(CODE) CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE +#define EXPAND_64_TIMES(CODE) CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE CODE +#define EXPAND_N_TIMES(NUMBER, CODE) EXPAND_##NUMBER##_TIMES(CODE) + +#define UNROLL_4_TIMES(MACRO) MACRO(0) MACRO(1) MACRO(2) MACRO(3) +#define UNROLL_8_TIMES(MACRO) MACRO(0) MACRO(1) MACRO(2) MACRO(3) MACRO(4) MACRO(5) MACRO(6) MACRO(7) +#define UNROLL_15_TIMES(MACRO) MACRO(0) MACRO(1) MACRO(2) MACRO(3) MACRO(4) MACRO(5) MACRO(6) MACRO(7) MACRO(8) MACRO(9) MACRO(10) MACRO(11) MACRO(12) MACRO(13) MACRO(14) +#define UNROLL_16_TIMES(MACRO) MACRO(0) MACRO(1) MACRO(2) MACRO(3) MACRO(4) MACRO(5) MACRO(6) MACRO(7) MACRO(8) MACRO(9) MACRO(10) MACRO(11) MACRO(12) MACRO(13) MACRO(14) MACRO(15) +#define UNROLL_64_TIMES(MACRO) MACRO(0) MACRO(1) MACRO(2) MACRO(3) MACRO(4) MACRO(5) MACRO(6) MACRO(7) MACRO(8) MACRO(9) MACRO(10) MACRO(11) MACRO(12) MACRO(13) MACRO(14) MACRO(15) MACRO(16) MACRO(17) MACRO(18) MACRO(19) MACRO(20) MACRO(21) MACRO(22) MACRO(23) MACRO(24) MACRO(25) MACRO(26) MACRO(27) MACRO(28) MACRO(29) MACRO(30) MACRO(31) MACRO(32) MACRO(33) MACRO(34) MACRO(35) MACRO(36) MACRO(37) MACRO(38) MACRO(39) MACRO(40) MACRO(41) MACRO(42) MACRO(43) MACRO(44) MACRO(45) MACRO(46) MACRO(47) MACRO(48) MACRO(49) MACRO(50) MACRO(51) MACRO(52) MACRO(53) MACRO(54) MACRO(55) MACRO(56) MACRO(57) MACRO(58) MACRO(59) MACRO(60) MACRO(61) MACRO(62) MACRO(63) +#define UNROLL_128_TIMES(MACRO) MACRO(0) MACRO(1) MACRO(2) MACRO(3) MACRO(4) MACRO(5) MACRO(6) MACRO(7) MACRO(8) MACRO(9) MACRO(10) MACRO(11) MACRO(12) MACRO(13) MACRO(14) MACRO(15) MACRO(16) MACRO(17) MACRO(18) MACRO(19) MACRO(20) MACRO(21) MACRO(22) MACRO(23) MACRO(24) MACRO(25) MACRO(26) MACRO(27) MACRO(28) MACRO(29) MACRO(30) MACRO(31) MACRO(32) MACRO(33) MACRO(34) MACRO(35) MACRO(36) MACRO(37) MACRO(38) MACRO(39) MACRO(40) MACRO(41) MACRO(42) MACRO(43) MACRO(44) MACRO(45) MACRO(46) MACRO(47) MACRO(48) MACRO(49) MACRO(50) MACRO(51) MACRO(52) MACRO(53) MACRO(54) MACRO(55) MACRO(56) MACRO(57) MACRO(58) MACRO(59) MACRO(60) MACRO(61) MACRO(62) MACRO(63) MACRO(64) MACRO(65) MACRO(66) MACRO(67) MACRO(68) MACRO(69) MACRO(70) MACRO(71) MACRO(72) MACRO(73) MACRO(74) MACRO(75) MACRO(76) MACRO(77) MACRO(78) MACRO(79) MACRO(80) MACRO(81) MACRO(82) MACRO(83) MACRO(84) MACRO(85) MACRO(86) MACRO(87) MACRO(88) MACRO(89) MACRO(90) MACRO(91) MACRO(92) MACRO(93) MACRO(94) MACRO(95) MACRO(96) MACRO(97) MACRO(98) MACRO(99) MACRO(100) MACRO(101) MACRO(102) MACRO(103) MACRO(104) MACRO(105) MACRO(106) MACRO(107) MACRO(108) MACRO(109) MACRO(110) MACRO(111) MACRO(112) MACRO(113) MACRO(114) MACRO(115) MACRO(116) MACRO(117) MACRO(118) MACRO(119) MACRO(120) MACRO(121) MACRO(122) MACRO(123) MACRO(124) MACRO(125) MACRO(126) MACRO(127) +#define UNROLL_256_TIMES(MACRO) MACRO(0) MACRO(1) MACRO(2) MACRO(3) MACRO(4) MACRO(5) MACRO(6) MACRO(7) MACRO(8) MACRO(9) MACRO(10) MACRO(11) MACRO(12) MACRO(13) MACRO(14) MACRO(15) MACRO(16) MACRO(17) MACRO(18) MACRO(19) MACRO(20) MACRO(21) MACRO(22) MACRO(23) MACRO(24) MACRO(25) MACRO(26) MACRO(27) MACRO(28) MACRO(29) MACRO(30) MACRO(31) MACRO(32) MACRO(33) MACRO(34) MACRO(35) MACRO(36) MACRO(37) MACRO(38) MACRO(39) MACRO(40) MACRO(41) MACRO(42) MACRO(43) MACRO(44) MACRO(45) MACRO(46) MACRO(47) MACRO(48) MACRO(49) MACRO(50) MACRO(51) MACRO(52) MACRO(53) MACRO(54) MACRO(55) MACRO(56) MACRO(57) MACRO(58) MACRO(59) MACRO(60) MACRO(61) MACRO(62) MACRO(63) MACRO(64) MACRO(65) MACRO(66) MACRO(67) MACRO(68) MACRO(69) MACRO(70) MACRO(71) MACRO(72) MACRO(73) MACRO(74) MACRO(75) MACRO(76) MACRO(77) MACRO(78) MACRO(79) MACRO(80) MACRO(81) MACRO(82) MACRO(83) MACRO(84) MACRO(85) MACRO(86) MACRO(87) MACRO(88) MACRO(89) MACRO(90) MACRO(91) MACRO(92) MACRO(93) MACRO(94) MACRO(95) MACRO(96) MACRO(97) MACRO(98) MACRO(99) MACRO(100) MACRO(101) MACRO(102) MACRO(103) MACRO(104) MACRO(105) MACRO(106) MACRO(107) MACRO(108) MACRO(109) MACRO(110) MACRO(111) MACRO(112) MACRO(113) MACRO(114) MACRO(115) MACRO(116) MACRO(117) MACRO(118) MACRO(119) MACRO(120) MACRO(121) MACRO(122) MACRO(123) MACRO(124) MACRO(125) MACRO(126) MACRO(127) \ + MACRO(128) MACRO(129) MACRO(130) MACRO(131) MACRO(132) MACRO(133) MACRO(134) MACRO(135) MACRO(136) MACRO(137) MACRO(138) MACRO(139) MACRO(140) MACRO(141) MACRO(142) MACRO(143) MACRO(144) MACRO(145) MACRO(146) MACRO(147) MACRO(148) MACRO(149) MACRO(150) MACRO(151) MACRO(152) MACRO(153) MACRO(154) MACRO(155) MACRO(156) MACRO(157) MACRO(158) MACRO(159) MACRO(160) MACRO(161) MACRO(162) MACRO(163) MACRO(164) MACRO(165) MACRO(166) MACRO(167) MACRO(168) MACRO(169) MACRO(170) MACRO(171) MACRO(172) MACRO(173) MACRO(174) MACRO(175) MACRO(176) MACRO(177) MACRO(178) MACRO(179) MACRO(180) MACRO(181) MACRO(182) MACRO(183) MACRO(184) MACRO(185) MACRO(186) MACRO(187) MACRO(188) MACRO(189) MACRO(190) MACRO(191) MACRO(192) MACRO(193) MACRO(194) MACRO(195) MACRO(196) MACRO(197) MACRO(198) MACRO(199) MACRO(200) MACRO(201) MACRO(202) MACRO(203) MACRO(204) MACRO(205) MACRO(206) MACRO(207) MACRO(208) MACRO(209) MACRO(210) MACRO(211) MACRO(212) MACRO(213) MACRO(214) MACRO(215) MACRO(216) MACRO(217) MACRO(218) MACRO(219) MACRO(220) MACRO(221) MACRO(222) MACRO(223) MACRO(224) MACRO(225) MACRO(226) MACRO(227) MACRO(228) MACRO(229) MACRO(230) MACRO(231) MACRO(232) MACRO(233) MACRO(234) MACRO(235) MACRO(236) MACRO(237) MACRO(238) MACRO(239) MACRO(240) MACRO(241) MACRO(242) MACRO(243) MACRO(244) MACRO(245) MACRO(246) MACRO(247) MACRO(248) MACRO(249) MACRO(250) MACRO(251) MACRO(252) MACRO(253) MACRO(254) MACRO(255) + +static inline short swap_endian16(short x) +{ + short y; + asm volatile ("lhbrx %0,0,%1\n" : "=r" (y) : "r" (&x)); + return y; +} + +static inline int swap_endian32(int x) +{ + int y; + asm volatile ("lwbrx %0,0,%1\n" : "=r" (y) : "r" (&x)); + return y; +} + +/***************************************************************************************** +Error Codes +*****************************************************************************************/ + +// success +#ifndef ERROR_SUCCESS +#define ERROR_SUCCESS 0 +#endif + +// file and i/o errors (1000's) +#define ERROR_IO_READ 1000 +#define ERROR_IO_WRITE 1001 +#define ERROR_INVALID_INPUT_FILE 1002 +#define ERROR_INVALID_OUTPUT_FILE 1003 +#define ERROR_INPUT_FILE_TOO_LARGE 1004 +#define ERROR_INPUT_FILE_UNSUPPORTED_BIT_DEPTH 1005 +#define ERROR_INPUT_FILE_UNSUPPORTED_SAMPLE_RATE 1006 +#define ERROR_INPUT_FILE_UNSUPPORTED_CHANNEL_COUNT 1007 +#define ERROR_INPUT_FILE_TOO_SMALL 1008 +#define ERROR_INVALID_CHECKSUM 1009 +#define ERROR_DECOMPRESSING_FRAME 1010 +#define ERROR_INITIALIZING_UNMAC 1011 +#define ERROR_INVALID_FUNCTION_PARAMETER 1012 +#define ERROR_UNSUPPORTED_FILE_TYPE 1013 +#define ERROR_UPSUPPORTED_FILE_VERSION 1014 + +// memory errors (2000's) +#define ERROR_INSUFFICIENT_MEMORY 2000 + +// dll errors (3000's) +#define ERROR_LOADINGAPE_DLL 3000 +#define ERROR_LOADINGAPE_INFO_DLL 3001 +#define ERROR_LOADING_UNMAC_DLL 3002 + +// general and misc errors +#define ERROR_USER_STOPPED_PROCESSING 4000 +#define ERROR_SKIPPED 4001 + +// programmer errors +#define ERROR_BAD_PARAMETER 5000 + +// IAPECompress errors +#define ERROR_APE_COMPRESS_TOO_MUCH_DATA 6000 + +// unknown error +#define ERROR_UNDEFINED -1 + +#define ERROR_EXPLANATION \ + { ERROR_IO_READ , "I/O read error" }, \ + { ERROR_IO_WRITE , "I/O write error" }, \ + { ERROR_INVALID_INPUT_FILE , "invalid input file" }, \ + { ERROR_INVALID_OUTPUT_FILE , "invalid output file" }, \ + { ERROR_INPUT_FILE_TOO_LARGE , "input file file too large" }, \ + { ERROR_INPUT_FILE_UNSUPPORTED_BIT_DEPTH , "input file unsupported bit depth" }, \ + { ERROR_INPUT_FILE_UNSUPPORTED_SAMPLE_RATE , "input file unsupported sample rate" }, \ + { ERROR_INPUT_FILE_UNSUPPORTED_CHANNEL_COUNT , "input file unsupported channel count" }, \ + { ERROR_INPUT_FILE_TOO_SMALL , "input file too small" }, \ + { ERROR_INVALID_CHECKSUM , "invalid checksum" }, \ + { ERROR_DECOMPRESSING_FRAME , "decompressing frame" }, \ + { ERROR_INITIALIZING_UNMAC , "initializing unmac" }, \ + { ERROR_INVALID_FUNCTION_PARAMETER , "invalid function parameter" }, \ + { ERROR_UNSUPPORTED_FILE_TYPE , "unsupported file type" }, \ + { ERROR_INSUFFICIENT_MEMORY , "insufficient memory" }, \ + { ERROR_LOADINGAPE_DLL , "loading MAC.dll" }, \ + { ERROR_LOADINGAPE_INFO_DLL , "loading MACinfo.dll" }, \ + { ERROR_LOADING_UNMAC_DLL , "loading UnMAC.dll" }, \ + { ERROR_USER_STOPPED_PROCESSING , "user stopped processing" }, \ + { ERROR_SKIPPED , "skipped" }, \ + { ERROR_BAD_PARAMETER , "bad parameter" }, \ + { ERROR_APE_COMPRESS_TOO_MUCH_DATA , "APE compress too much data" }, \ + { ERROR_UNDEFINED , "undefined" }, \ + +#endif // #ifndef APE_ALL_H \ No newline at end of file diff --git a/Libraries/MAC/Files/Source/Shared/CharacterHelper.cpp b/Libraries/MAC/Files/Source/Shared/CharacterHelper.cpp new file mode 100755 index 000000000..e86621260 --- /dev/null +++ b/Libraries/MAC/Files/Source/Shared/CharacterHelper.cpp @@ -0,0 +1,144 @@ +#include "All.h" +#include "CharacterHelper.h" + +str_ansi * GetANSIFromUTF8(const str_utf8 * pUTF8) +{ + str_utf16 * pUTF16 = GetUTF16FromUTF8(pUTF8); + str_ansi * pANSI = GetANSIFromUTF16(pUTF16); + delete [] pUTF16; + return pANSI; +} + +str_ansi * GetANSIFromUTF16(const str_utf16 * pUTF16) +{ + const int nCharacters = pUTF16 ? wcslen(pUTF16) : 0; + #ifdef _WIN32 + int nANSICharacters = (2 * nCharacters); + str_ansi * pANSI = new str_ansi [nANSICharacters + 1]; + memset(pANSI, 0, (nANSICharacters + 1) * sizeof(str_ansi)); + if (pUTF16) + WideCharToMultiByte(CP_ACP, 0, pUTF16, -1, pANSI, nANSICharacters, NULL, NULL); + #else + str_utf8 * pANSI = new str_utf8 [nCharacters + 1]; + for (int z = 0; z < nCharacters; z++) + pANSI[z] = (pUTF16[z] >= 256) ? '?' : (str_utf8) pUTF16[z]; + pANSI[nCharacters] = 0; + #endif + + return (str_ansi *) pANSI; +} + +str_utf16 * GetUTF16FromANSI(const str_ansi * pANSI) +{ + const int nCharacters = pANSI ? strlen(pANSI) : 0; + str_utf16 * pUTF16 = new str_utf16 [nCharacters + 1]; + + #ifdef _WIN32 + memset(pUTF16, 0, sizeof(str_utf16) * (nCharacters + 1)); + if (pANSI) + MultiByteToWideChar(CP_ACP, 0, pANSI, -1, pUTF16, nCharacters); + #else + for (int z = 0; z < nCharacters; z++) + pUTF16[z] = (str_utf16) ((str_utf8) pANSI[z]); + pUTF16[nCharacters] = 0; + #endif + + return pUTF16; +} + +str_utf16 * GetUTF16FromUTF8(const str_utf8 * pUTF8) +{ + // get the length + int nCharacters = 0; int nIndex = 0; + while (pUTF8[nIndex] != 0) + { + if ((pUTF8[nIndex] & 0x80) == 0) + nIndex += 1; + else if ((pUTF8[nIndex] & 0xE0) == 0xE0) + nIndex += 3; + else + nIndex += 2; + + nCharacters += 1; + } + + // make a UTF-16 string + str_utf16 * pUTF16 = new str_utf16 [nCharacters + 1]; + nIndex = 0; nCharacters = 0; + while (pUTF8[nIndex] != 0) + { + if ((pUTF8[nIndex] & 0x80) == 0) + { + pUTF16[nCharacters] = pUTF8[nIndex]; + nIndex += 1; + } + else if ((pUTF8[nIndex] & 0xE0) == 0xE0) + { + pUTF16[nCharacters] = ((pUTF8[nIndex] & 0x1F) << 12) | ((pUTF8[nIndex + 1] & 0x3F) << 6) | (pUTF8[nIndex + 2] & 0x3F); + nIndex += 3; + } + else + { + pUTF16[nCharacters] = ((pUTF8[nIndex] & 0x3F) << 6) | (pUTF8[nIndex + 1] & 0x3F); + nIndex += 2; + } + + nCharacters += 1; + } + pUTF16[nCharacters] = 0; + + return pUTF16; +} + +str_utf8 * GetUTF8FromANSI(const str_ansi * pANSI) +{ + str_utf16 * pUTF16 = GetUTF16FromANSI(pANSI); + str_utf8 * pUTF8 = GetUTF8FromUTF16(pUTF16); + delete [] pUTF16; + return pUTF8; +} + +str_utf8 * GetUTF8FromUTF16(const str_utf16 * pUTF16) +{ + // get the size(s) + int nCharacters = wcslen(pUTF16); + int nUTF8Bytes = 0; + int z; + for (z = 0; z < nCharacters; z++) + { + if (pUTF16[z] < 0x0080) + nUTF8Bytes += 1; + else if (pUTF16[z] < 0x0800) + nUTF8Bytes += 2; + else + nUTF8Bytes += 3; + } + + // allocate a UTF-8 string + str_utf8 * pUTF8 = new str_utf8 [nUTF8Bytes + 1]; + + // create the UTF-8 string + int nUTF8Index = 0; + for (z = 0; z < nCharacters; z++) + { + if (pUTF16[z] < 0x0080) + { + pUTF8[nUTF8Index++] = (str_utf8) pUTF16[z]; + } + else if (pUTF16[z] < 0x0800) + { + pUTF8[nUTF8Index++] = 0xC0 | (pUTF16[z] >> 6); + pUTF8[nUTF8Index++] = 0x80 | (pUTF16[z] & 0x3F); + } + else + { + pUTF8[nUTF8Index++] = 0xE0 | (pUTF16[z] >> 12); + pUTF8[nUTF8Index++] = 0x80 | ((pUTF16[z] >> 6) & 0x3F); + pUTF8[nUTF8Index++] = 0x80 | (pUTF16[z] & 0x3F); + } + } + pUTF8[nUTF8Index++] = 0; + + // return the UTF-8 string + return pUTF8; +} \ No newline at end of file diff --git a/Libraries/MAC/Files/Source/Shared/CharacterHelper.h b/Libraries/MAC/Files/Source/Shared/CharacterHelper.h new file mode 100755 index 000000000..1159b5cad --- /dev/null +++ b/Libraries/MAC/Files/Source/Shared/CharacterHelper.h @@ -0,0 +1,15 @@ +/******************************************************************************************* +Character set conversion helpers +*******************************************************************************************/ + +#ifndef CHARACTER_HELPER_H +#define CHARACTER_HELPER_H + +str_ansi * GetANSIFromUTF8(const str_utf8 * pUTF8); +str_ansi * GetANSIFromUTF16(const str_utf16 * pUTF16); +str_utf16 * GetUTF16FromANSI(const str_ansi * pANSI); +str_utf16 * GetUTF16FromUTF8(const str_utf8 * pUTF8); +str_utf8 * GetUTF8FromANSI(const str_ansi * pANSI); +str_utf8 * GetUTF8FromUTF16(const str_utf16 * pUTF16); + +#endif // #ifndef CHARACTER_HELPER_H \ No newline at end of file diff --git a/Libraries/MAC/Files/Source/Shared/CircleBuffer.cpp b/Libraries/MAC/Files/Source/Shared/CircleBuffer.cpp new file mode 100755 index 000000000..5fde87ac7 --- /dev/null +++ b/Libraries/MAC/Files/Source/Shared/CircleBuffer.cpp @@ -0,0 +1,89 @@ +#include "All.h" +#include "CircleBuffer.h" + +CCircleBuffer::CCircleBuffer() +{ + m_pBuffer = NULL; + m_nTotal = 0; + m_nHead = 0; + m_nTail = 0; + m_nEndCap = 0; + m_nMaxDirectWriteBytes = 0; +} + +CCircleBuffer::~CCircleBuffer() +{ + SAFE_ARRAY_DELETE(m_pBuffer) +} + +void CCircleBuffer::CreateBuffer(int nBytes, int nMaxDirectWriteBytes) +{ + SAFE_ARRAY_DELETE(m_pBuffer) + + m_nMaxDirectWriteBytes = nMaxDirectWriteBytes; + m_nTotal = nBytes + 1 + nMaxDirectWriteBytes; + m_pBuffer = new unsigned char [m_nTotal]; + m_nHead = 0; + m_nTail = 0; + m_nEndCap = m_nTotal; +} + +int CCircleBuffer::MaxAdd() +{ + int nMaxAdd = (m_nTail >= m_nHead) ? (m_nTotal - 1 - m_nMaxDirectWriteBytes) - (m_nTail - m_nHead) : m_nHead - m_nTail - 1; + return nMaxAdd; +} + +int CCircleBuffer::MaxGet() +{ + return (m_nTail >= m_nHead) ? m_nTail - m_nHead : (m_nEndCap - m_nHead) + m_nTail; +} + +int CCircleBuffer::Get(unsigned char * pBuffer, int nBytes) +{ + int nTotalGetBytes = 0; + + if (pBuffer != NULL && nBytes > 0) + { + int nHeadBytes = min(m_nEndCap - m_nHead, nBytes); + int nFrontBytes = nBytes - nHeadBytes; + + memcpy(&pBuffer[0], &m_pBuffer[m_nHead], nHeadBytes); + nTotalGetBytes = nHeadBytes; + + if (nFrontBytes > 0) + { + memcpy(&pBuffer[nHeadBytes], &m_pBuffer[0], nFrontBytes); + nTotalGetBytes += nFrontBytes; + } + + RemoveHead(nBytes); + } + + return nTotalGetBytes; +} + +void CCircleBuffer::Empty() +{ + m_nHead = 0; + m_nTail = 0; + m_nEndCap = m_nTotal; +} + +int CCircleBuffer::RemoveHead(int nBytes) +{ + nBytes = min(MaxGet(), nBytes); + m_nHead += nBytes; + if (m_nHead >= m_nEndCap) + m_nHead -= m_nEndCap; + return nBytes; +} + +int CCircleBuffer::RemoveTail(int nBytes) +{ + nBytes = min(MaxGet(), nBytes); + m_nTail -= nBytes; + if (m_nTail < 0) + m_nTail += m_nEndCap; + return nBytes; +} diff --git a/Libraries/MAC/Files/Source/Shared/CircleBuffer.h b/Libraries/MAC/Files/Source/Shared/CircleBuffer.h new file mode 100755 index 000000000..c7951308e --- /dev/null +++ b/Libraries/MAC/Files/Source/Shared/CircleBuffer.h @@ -0,0 +1,59 @@ +#ifndef APE_CIRCLEBUFFER_H +#define APE_CIRCLEBUFFER_H + +class CCircleBuffer +{ +public: + + // construction / destruction + CCircleBuffer(); + virtual ~CCircleBuffer(); + + // create the buffer + void CreateBuffer(int nBytes, int nMaxDirectWriteBytes); + + // query + int MaxAdd(); + int MaxGet(); + + // direct writing + inline unsigned char * CCircleBuffer::GetDirectWritePointer() + { + // return a pointer to the tail -- note that it will always be safe to write + // at least m_nMaxDirectWriteBytes since we use an end cap region + return &m_pBuffer[m_nTail]; + } + + inline void CCircleBuffer::UpdateAfterDirectWrite(int nBytes) + { + // update the tail + m_nTail += nBytes; + + // if the tail enters the "end cap" area, set the end cap and loop around + if (m_nTail >= (m_nTotal - m_nMaxDirectWriteBytes)) + { + m_nEndCap = m_nTail; + m_nTail = 0; + } + } + + // get data + int Get(unsigned char * pBuffer, int nBytes); + + // remove / empty + void Empty(); + int RemoveHead(int nBytes); + int RemoveTail(int nBytes); + +private: + + int m_nTotal; + int m_nMaxDirectWriteBytes; + int m_nEndCap; + int m_nHead; + int m_nTail; + unsigned char * m_pBuffer; +}; + + +#endif // #ifndef APE_CIRCLEBUFFER_H diff --git a/Libraries/MAC/Files/Source/Shared/GlobalFunctions.cpp b/Libraries/MAC/Files/Source/Shared/GlobalFunctions.cpp new file mode 100755 index 000000000..778d410cb --- /dev/null +++ b/Libraries/MAC/Files/Source/Shared/GlobalFunctions.cpp @@ -0,0 +1,152 @@ +#include "All.h" +#include "GlobalFunctions.h" +#include "IO.h" +#include "CharacterHelper.h" +#include + +/* +#ifndef __GNUC_IA32__ + +extern "C" BOOL GetMMXAvailable(void) +{ +#ifdef ENABLE_ASSEMBLY + + unsigned long nRegisterEDX; + + try + { + __asm mov eax, 1 + __asm CPUID + __asm mov nRegisterEDX, edx + } + catch(...) + { + return FALSE; + } + + if (nRegisterEDX & 0x800000) + RETURN_ON_EXCEPTION(__asm emms, FALSE) + else + return FALSE; + + return TRUE; + +#else + return FALSE; +#endif +} + +#endif // #ifndef __GNUC_IA32__ +*/ + +int IsAltiVecAvailable( void ) +{ + + int selectors[2] = { CTL_HW, HW_VECTORUNIT }; + int hasVectorUnit = 0; + size_t length = sizeof(hasVectorUnit); + int error = sysctl(selectors, 2, &hasVectorUnit, &length, NULL, 0); + + if( 0 == error ) return hasVectorUnit != 0; + + return 0; + +} + +int ReadSafe(CIO * pIO, void * pBuffer, int nBytes) +{ + unsigned int nBytesRead = 0; + int nRetVal = pIO->Read(pBuffer, nBytes, &nBytesRead); + if (nRetVal == ERROR_SUCCESS) + { + if (nBytes != int(nBytesRead)) + nRetVal = ERROR_IO_READ; + } + + return nRetVal; +} + +int WriteSafe(CIO * pIO, void * pBuffer, int nBytes) +{ + unsigned int nBytesWritten = 0; + int nRetVal = pIO->Write(pBuffer, nBytes, &nBytesWritten); + if (nRetVal == ERROR_SUCCESS) + { + if (nBytes != int(nBytesWritten)) + nRetVal = ERROR_IO_WRITE; + } + + return nRetVal; +} + +/* +BOOL FileExists(wchar_t * pFilename) +{ + if (0 == wcscmp(pFilename, L"-") || 0 == wcscmp(pFilename, L"/dev/stdin")) + return TRUE; + +#ifdef _WIN32 + + BOOL bFound = FALSE; + + WIN32_FIND_DATA WFD; + HANDLE hFind = FindFirstFile(pFilename, &WFD); + if (hFind != INVALID_HANDLE_VALUE) + { + bFound = TRUE; + CloseHandle(hFind); + } + + return bFound; + +#else + + CSmartPtr spANSI(GetANSIFromUTF16(pFilename), TRUE); + + struct stat b; + + if (stat(spANSI, &b) != 0) + return FALSE; + + if (!S_ISREG(b.st_mode)) + return FALSE; + + return TRUE; + +#endif +} +*/ + +BOOL FileExists(const char * pFilename) +{ + if (0 == strcmp(pFilename, "-") || 0 == strcmp(pFilename, "/dev/stdin")) + return TRUE; + +#ifdef _WIN32 + + BOOL bFound = FALSE; + + WIN32_FIND_DATA WFD; + HANDLE hFind = FindFirstFile(pFilename, &WFD); + if (hFind != INVALID_HANDLE_VALUE) + { + bFound = TRUE; + CloseHandle(hFind); + } + + return bFound; + +#else + + struct stat b; + + if (stat(pFilename, &b) != 0) + return FALSE; + + if (!S_ISREG(b.st_mode)) + return FALSE; + + return TRUE; + +#endif +} \ No newline at end of file diff --git a/Libraries/MAC/Files/Source/Shared/GlobalFunctions.h b/Libraries/MAC/Files/Source/Shared/GlobalFunctions.h new file mode 100755 index 000000000..8fbcca22e --- /dev/null +++ b/Libraries/MAC/Files/Source/Shared/GlobalFunctions.h @@ -0,0 +1,23 @@ +#ifndef APE_GLOBALFUNCTIONS_H +#define APE_GLOBALFUNCTIONS_H + +/************************************************************************************* +Definitions +*************************************************************************************/ +class CIO; + +/************************************************************************************* +Read / Write from an IO source and return failure if the number of bytes specified +isn't read or written +*************************************************************************************/ +int ReadSafe(CIO * pIO, void * pBuffer, int nBytes); +int WriteSafe(CIO * pIO, void * pBuffer, int nBytes); + +/************************************************************************************* +Checks for the existence of a file +*************************************************************************************/ +BOOL FileExists(const char * pFilename); + +int IsAltiVecAvailable( void ); + +#endif // #ifndef APE_GLOBALFUNCTIONS_H diff --git a/Libraries/MAC/Files/Source/Shared/ID3Genres.h b/Libraries/MAC/Files/Source/Shared/ID3Genres.h new file mode 100755 index 000000000..6aa54c533 --- /dev/null +++ b/Libraries/MAC/Files/Source/Shared/ID3Genres.h @@ -0,0 +1,28 @@ +#ifndef APE_ID3GENRES_H +#define APE_ID3GENRES_H + +#define GENRE_UNDEFINED 255 +#define GENRE_COUNT 148 + +//const LPCWSTR g_ID3Genre[GENRE_COUNT] = +const wchar_t * g_ID3Genre[GENRE_COUNT] = +{ + L"Blues", L"Classic Rock", L"Country", L"Dance", L"Disco", L"Funk", L"Grunge", L"Hip-Hop", + L"Jazz", L"Metal", L"New Age", L"Oldies", L"Other", L"Pop", L"R&B", L"Rap", L"Reggae", L"Rock", L"Techno", + L"Industrial", L"Alternative", L"Ska", L"Death Metal", L"Pranks", L"Soundtrack", L"Euro-Techno", L"Ambient", + L"Trip-Hop", L"Vocal", L"Jazz+Funk", L"Fusion", L"Trance", L"Classical", L"Instrumental", L"Acid", L"House", L"Game", + L"Sound Clip", L"Gospel", L"Noise", L"AlternRock", L"Bass", L"Soul", L"Punk", L"Space", L"Meditative", L"Instrumental Pop", + L"Instrumental Rock", L"Ethnic", L"Gothic", L"Darkwave", L"Techno-Industrial", L"Electronic", L"Pop-Folk", L"Eurodance", + L"Dream", L"Southern Rock", L"Comedy", L"Cult", L"Gangsta", L"Top 40", L"Christian Rap", L"Pop/Funk", L"Jungle", + L"Native American", L"Cabaret", L"New Wave", L"Psychadelic", L"Rave", L"Showtunes", L"Trailer", L"Lo-Fi", L"Tribal", + L"Acid Punk", L"Acid Jazz", L"Polka", L"Retro", L"Musical", L"Rock & Roll", L"Hard Rock", L"Folk", L"Folk-Rock", L"National Folk", + L"Swing", L"Fast Fusion", L"Bebop", L"Latin", L"Revival", L"Celtic", L"Bluegrass", L"Avantgarde", L"Gothic Rock", L"Progressive Rock", + L"Psychedelic Rock", L"Symphonic Rock", L"Slow Rock", L"Big Band", L"Chorus", L"Easy Listening", L"Acoustic", L"Humour", + L"Speech", L"Chanson", L"Opera", L"Chamber Music", L"Sonata", L"Symphony", L"Booty Bass", L"Primus", L"Porn Groove", + L"Satire", L"Slow Jam", L"Club", L"Tango", L"Samba", L"Folklore", L"Ballad", L"Power Ballad", L"Rhythmic Soul", L"Freestyle", + L"Duet", L"Punk Rock", L"Drum Solo", L"Acapella", L"Euro-House", L"Dance Hall", L"Goa", L"Drum & Bass", L"Club House", L"Hardcore", + L"Terror", L"Indie", L"BritPop", L"Black Punk", L"Polsk Punk", L"Beat", L"Christian Gangsta", L"Heavy Metal", L"Black Metal", + L"Crossover", L"Contemporary C", L"Christian Rock", L"Merengue", L"Salsa", L"Thrash Metal", L"Anime", L"JPop", L"SynthPop" +}; + +#endif // #ifndef APE_ID3GENRES_H diff --git a/Libraries/MAC/Files/Source/Shared/IO.h b/Libraries/MAC/Files/Source/Shared/IO.h new file mode 100755 index 000000000..76ddb0ccc --- /dev/null +++ b/Libraries/MAC/Files/Source/Shared/IO.h @@ -0,0 +1,49 @@ +#ifndef APE_IO_H +#define APE_IO_H + +#ifndef FILE_BEGIN + #define FILE_BEGIN 0 +#endif + +#ifndef FILE_CURRENT + #define FILE_CURRENT 1 +#endif + +#ifndef FILE_END + #define FILE_END 2 +#endif + +class CIO +{ + +public: + + //construction / destruction + CIO() { } + virtual ~CIO() { }; + + // open / close + virtual int Open(const char * pName) = 0; + virtual int Close() = 0; + + // read / write + virtual int Read(void * pBuffer, unsigned int nBytesToRead, unsigned int * pBytesRead) = 0; + virtual int Write(const void * pBuffer, unsigned int nBytesToWrite, unsigned int * pBytesWritten) = 0; + + // seek + virtual int Seek(int nDistance, unsigned int nMoveMode) = 0; + + // creation / destruction + virtual int Create(const char * pName) = 0; + virtual int Delete() = 0; + + // other functions + virtual int SetEOF() = 0; + + // attributes + virtual int GetPosition() = 0; + virtual int GetSize() = 0; + virtual int GetName(char * pBuffer) = 0; +}; + +#endif // #ifndef APE_IO_H diff --git a/Libraries/MAC/Files/Source/Shared/NoWindows.h b/Libraries/MAC/Files/Source/Shared/NoWindows.h new file mode 100755 index 000000000..367e38adf --- /dev/null +++ b/Libraries/MAC/Files/Source/Shared/NoWindows.h @@ -0,0 +1,70 @@ +#ifndef _WIN32 + +#ifndef APE_NOWINDOWS_H +#define APE_NOWINDOWS_H + +#define FALSE 0 +#define TRUE 1 + +#define NEAR +#define FAR + +typedef unsigned int uint32; +typedef int int32; +typedef unsigned short uint16; +typedef short int16; +typedef unsigned char uint8; +typedef char int8; +typedef char str_ansi; +typedef unsigned char str_utf8; +typedef wchar_t str_utf16; + +typedef unsigned long DWORD; +#ifndef __OBJC__ +typedef int BOOL; +#endif +typedef unsigned char BYTE; +typedef unsigned short WORD; +typedef float FLOAT; +typedef void * HANDLE; +typedef unsigned int UINT; +typedef unsigned int WPARAM; +typedef long LPARAM; +typedef const char * LPCSTR; +typedef char * LPSTR; +typedef long LRESULT; + +#define ZeroMemory(POINTER, BYTES) memset(POINTER, 0, BYTES); +#define max(a,b) (((a) > (b)) ? (a) : (b)) +#define min(a,b) (((a) < (b)) ? (a) : (b)) + +#define __stdcall +#define CALLBACK + +#define _stricmp strcasecmp +#define _strnicmp strncasecmp + +#define _FPOSOFF(fp) ((long)(fp).__pos) +#define MAX_PATH 260 + +#ifndef _WAVEFORMATEX_ +#define _WAVEFORMATEX_ + +typedef struct tWAVEFORMATEX +{ + WORD wFormatTag; /* format type */ + WORD nChannels; /* number of channels (i.e. mono, stereo...) */ + DWORD nSamplesPerSec; /* sample rate */ + DWORD nAvgBytesPerSec; /* for buffer estimation */ + WORD nBlockAlign; /* block size of data */ + WORD wBitsPerSample; /* number of bits per sample of mono data */ + WORD cbSize; /* the count in bytes of the size of */ + /* extra information (after cbSize) */ +} WAVEFORMATEX, *PWAVEFORMATEX, NEAR *NPWAVEFORMATEX, FAR *LPWAVEFORMATEX; +typedef const WAVEFORMATEX FAR *LPCWAVEFORMATEX; + +#endif // #ifndef _WAVEFORMATEX_ + +#endif // #ifndef APE_NOWINDOWS_H + +#endif // #ifndef _WIN32 diff --git a/Libraries/MAC/Files/Source/Shared/RollBuffer.h b/Libraries/MAC/Files/Source/Shared/RollBuffer.h new file mode 100755 index 000000000..4f1b6a0b4 --- /dev/null +++ b/Libraries/MAC/Files/Source/Shared/RollBuffer.h @@ -0,0 +1,120 @@ +#ifndef APE_ROLLBUFFER_H +#define APE_ROLLBUFFER_H + +template class CRollBuffer +{ +public: + + CRollBuffer() + { + m_pData = NULL; + m_pCurrent = NULL; + } + + ~CRollBuffer() + { + SAFE_ARRAY_DELETE(m_pData); + } + + int Create(int nWindowElements, int nHistoryElements) + { + SAFE_ARRAY_DELETE(m_pData) + m_nWindowElements = nWindowElements; + m_nHistoryElements = nHistoryElements; + + m_pData = new TYPE[m_nWindowElements + m_nHistoryElements]; + if (m_pData == NULL) + return ERROR_INSUFFICIENT_MEMORY; + + Flush(); + return 0; + } + + void Flush() + { + ZeroMemory(m_pData, (m_nHistoryElements + 1) * sizeof(TYPE)); + m_pCurrent = &m_pData[m_nHistoryElements]; + } + + void Roll() + { + memcpy(&m_pData[0], &m_pCurrent[-m_nHistoryElements], m_nHistoryElements * sizeof(TYPE)); + m_pCurrent = &m_pData[m_nHistoryElements]; + } + + __inline void IncrementSafe() + { + m_pCurrent++; + if (m_pCurrent == &m_pData[m_nWindowElements + m_nHistoryElements]) + Roll(); + } + + __inline void IncrementFast() + { + m_pCurrent++; + } + + __inline TYPE & operator[](const int nIndex) const + { + return m_pCurrent[nIndex]; + } + +protected: + + TYPE * m_pData; + TYPE * m_pCurrent; + int m_nHistoryElements; + int m_nWindowElements; +}; + +template class CRollBufferFast +{ +public: + + CRollBufferFast() + { + m_pData = new TYPE[WINDOW_ELEMENTS + HISTORY_ELEMENTS]; + Flush(); + } + + ~CRollBufferFast() + { + SAFE_ARRAY_DELETE(m_pData); + } + + void Flush() + { + ZeroMemory(m_pData, (HISTORY_ELEMENTS + 1) * sizeof(TYPE)); + m_pCurrent = &m_pData[HISTORY_ELEMENTS]; + } + + void Roll() + { + memcpy(&m_pData[0], &m_pCurrent[-HISTORY_ELEMENTS], HISTORY_ELEMENTS * sizeof(TYPE)); + m_pCurrent = &m_pData[HISTORY_ELEMENTS]; + } + + __inline void IncrementSafe() + { + m_pCurrent++; + if (m_pCurrent == &m_pData[WINDOW_ELEMENTS + HISTORY_ELEMENTS]) + Roll(); + } + + __inline void IncrementFast() + { + m_pCurrent++; + } + + __inline TYPE & operator[](const int nIndex) const + { + return m_pCurrent[nIndex]; + } + +protected: + + TYPE * m_pData; + TYPE * m_pCurrent; +}; + +#endif // #ifndef APE_ROLLBUFFER_H diff --git a/Libraries/MAC/Files/Source/Shared/SmartPtr.h b/Libraries/MAC/Files/Source/Shared/SmartPtr.h new file mode 100755 index 000000000..d92be0856 --- /dev/null +++ b/Libraries/MAC/Files/Source/Shared/SmartPtr.h @@ -0,0 +1,89 @@ +#ifndef APE_SMARTPTR_H +#define APE_SMARTPTR_H + +// disable the operator -> on UDT warning +#ifdef _MSC_VER + #pragma warning(push) + #pragma warning(disable : 4284) +#endif + +/************************************************************************************************* +CSmartPtr - a simple smart pointer class that can automatically initialize and free memory + note: (doesn't do garbage collection / reference counting because of the many pitfalls) +*************************************************************************************************/ +template class CSmartPtr +{ +public: + TYPE * m_pObject; + BOOL m_bArray; + BOOL m_bDelete; + + CSmartPtr() + { + m_bDelete = TRUE; + m_pObject = NULL; + } + CSmartPtr(TYPE * a_pObject, BOOL a_bArray = FALSE, BOOL a_bDelete = TRUE) + { + m_bDelete = TRUE; + m_pObject = NULL; + Assign(a_pObject, a_bArray, a_bDelete); + } + + ~CSmartPtr() + { + Delete(); + } + + void Assign(TYPE * a_pObject, BOOL a_bArray = FALSE, BOOL a_bDelete = TRUE) + { + Delete(); + + m_bDelete = a_bDelete; + m_bArray = a_bArray; + m_pObject = a_pObject; + } + + void Delete() + { + if (m_bDelete && m_pObject) + { + if (m_bArray) + delete [] m_pObject; + else + delete m_pObject; + + m_pObject = NULL; + } + } + + void SetDelete(const BOOL a_bDelete) + { + m_bDelete = a_bDelete; + } + + __inline TYPE * GetPtr() const + { + return m_pObject; + } + + __inline operator TYPE * () const + { + return m_pObject; + } + + __inline TYPE * operator ->() const + { + return m_pObject; + } + + // declare assignment, but don't implement (compiler error if we try to use) + // that way we can't carelessly mix smart pointers and regular pointers + __inline void * operator =(void *) const; +}; + +#ifdef _MSC_VER + #pragma warning(pop) +#endif _MSC_VER + +#endif // #ifndef APE_SMARTPTR_H diff --git a/Libraries/MAC/Files/Source/Shared/StdLibFileIO.cpp b/Libraries/MAC/Files/Source/Shared/StdLibFileIO.cpp new file mode 100755 index 000000000..4798385f9 --- /dev/null +++ b/Libraries/MAC/Files/Source/Shared/StdLibFileIO.cpp @@ -0,0 +1,242 @@ +#include "All.h" + +#ifdef IO_USE_STD_LIB_FILE_IO + +#include "StdLibFileIO.h" + +/////////////////////////////////////////////////////// + +// low level I/O, where are prototypes and constants? +#if defined _WIN32 || defined __TURBOC__ || defined __ZTC__ || defined _MSC_VER +# include +# include +# include +# include +# include +#elif defined __unix__ || defined __linux__ +# include +# include +# include +# include +# include +# include +#else +# include +# include +# include +# include +#endif + + +#ifndef O_BINARY +# ifdef _O_BINARY +# define O_BINARY _O_BINARY +# else +# define O_BINARY 0 +# endif +#endif + +//// Binary/Low-Level-IO /////////////////////////////////////////// +// +// All file I/O is basicly handled via an ANSI file pointer (type: FILE*) in +// FILEIO-Mode 1 and via a POSIX file descriptor (type: int) in +// FILEIO-Mode 2 and 3. +// +// Some operation are only available via the POSIX interface (fcntl, setmode, +// ...) so we need a function to get the file descriptor from a file pointer. +// In FILEIO-Mode 2 and 3 this is a dummy function because we always working +// with this file descriptors. +// + +#if defined __BORLANDC__ || defined _WIN32 +# define FILENO(__fp) _fileno ((__fp)) +#elif defined __CYGWIN__ || defined __TURBOC__ || defined __unix__ || defined __EMX__ || defined _MSC_VER +# define FILENO(__fp) fileno ((__fp)) +#else +# define FILENO(__fp) fileno ((__fp)) +#endif + + +// +// If we have access to a file via file name, we can open the file with an +// additional "b" or a O_BINARY within the (f)open function to get a +// transparent untranslated data stream which is necessary for audio bitstream +// data and also for PCM data. If we are working with +// stdin/stdout/FILENO_STDIN/FILENO_STDOUT we can't open the file with this +// attributes, because the files are already open. So we need a non +// standardized sequence to switch to this mode (not necessary for Unix). +// Mostly the sequency is the same for incoming and outgoing streams, but only +// mostly so we need one for IN and one for OUT. +// Macros are called with the file pointer and you get back the untransalted file +// pointer which can be equal or different from the original. +// + +#if defined __EMX__ +# define SETBINARY_IN(__fp) (_fsetmode ( (__fp), "b" ), (__fp)) +# define SETBINARY_OUT(__fp) (_fsetmode ( (__fp), "b" ), (__fp)) +#elif defined __TURBOC__ || defined __BORLANDC__ +# define SETBINARY_IN(__fp) (setmode ( FILENO ((__fp)), O_BINARY ), (__fp)) +# define SETBINARY_OUT(__fp) (setmode ( FILENO ((__fp)), O_BINARY ), (__fp)) +#elif defined __CYGWIN__ +# define SETBINARY_IN(__fp) (setmode ( FILENO ((__fp)), _O_BINARY ), (__fp)) +# define SETBINARY_OUT(__fp) (setmode ( FILENO ((__fp)), _O_BINARY ), (__fp)) +#elif defined _WIN32 +# define SETBINARY_IN(__fp) (_setmode ( FILENO ((__fp)), _O_BINARY ), (__fp)) +# define SETBINARY_OUT(__fp) (_setmode ( FILENO ((__fp)), _O_BINARY ), (__fp)) +#elif defined _MSC_VER +# define SETBINARY_IN(__fp) (setmode ( FILENO ((__fp)), O_BINARY ), (__fp)) +# define SETBINARY_OUT(__fp) (setmode ( FILENO ((__fp)), O_BINARY ), (__fp)) +#elif defined __unix__ +# define SETBINARY_IN(__fp) (__fp) +# define SETBINARY_OUT(__fp) (__fp) +#elif 0 +# define SETBINARY_IN(__fp) (freopen ( NULL, "rb", (__fp) ), (__fp)) +# define SETBINARY_OUT(__fp) (freopen ( NULL, "wb", (__fp) ), (__fp)) +#else +# define SETBINARY_IN(__fp) (__fp) +# define SETBINARY_OUT(__fp) (__fp) +#endif + + +/////////////////////////////////////////////////////// + +CStdLibFileIO::CStdLibFileIO() +{ + memset(m_cFileName, 0, MAX_PATH); + m_bReadOnly = FALSE; + m_pFile = NULL; +} + +CStdLibFileIO::~CStdLibFileIO() +{ + Close(); +} + +int CStdLibFileIO::GetHandle() +{ + return FILENO(m_pFile); +} + +int CStdLibFileIO::Open(const char * pName) +{ + Close(); + + m_bReadOnly = FALSE; + + if (0 == strcmp(pName, "-") || 0 == strcmp(pName, "/dev/stdin")) + { + m_pFile = SETBINARY_IN(stdin); + m_bReadOnly = TRUE; // ReadOnly + } + else if (0 == strcmp (pName, "/dev/stdout")) + { + m_pFile = SETBINARY_OUT(stdout); + m_bReadOnly = FALSE; // WriteOnly + } + else + { + m_pFile = fopen(pName, "r+b"); + m_bReadOnly = FALSE; // Read/Write + } + + if (!m_pFile) + return -1; + + strcpy(m_cFileName, pName); + + return 0; +} + +int CStdLibFileIO::Close() +{ + int nRetVal = -1; + + if (m_pFile != NULL) + { + nRetVal = fclose(m_pFile); + m_pFile = NULL; + } + + return nRetVal; +} + +int CStdLibFileIO::Read(void * pBuffer, unsigned int nBytesToRead, unsigned int * pBytesRead) +{ + *pBytesRead = fread(pBuffer, 1, nBytesToRead, m_pFile); + return ferror(m_pFile) ? ERROR_IO_READ : 0; +} + +int CStdLibFileIO::Write(const void * pBuffer, unsigned int nBytesToWrite, unsigned int * pBytesWritten) +{ + *pBytesWritten = fwrite(pBuffer, 1, nBytesToWrite, m_pFile); + + return (ferror(m_pFile) || (*pBytesWritten != nBytesToWrite)) ? ERROR_IO_WRITE : 0; +} + +int CStdLibFileIO::Seek(int nDistance, unsigned int nMoveMode) +{ + return fseek(m_pFile, nDistance, nMoveMode); +} + +int CStdLibFileIO::SetEOF() +{ + return ftruncate(GetHandle(), GetPosition()); +} + +int CStdLibFileIO::GetPosition() +{ + /* + fpos_t fPosition; + + memset(&fPosition, 0, sizeof(fPosition)); + fgetpos(m_pFile, &fPosition); + return _FPOSOFF(fPosition); + */ + return ftell(m_pFile); +} + +int CStdLibFileIO::GetSize() +{ + int nCurrentPosition = GetPosition(); + Seek(0, FILE_END); + int nLength = GetPosition(); + Seek(nCurrentPosition, FILE_BEGIN); + return nLength; +} + +int CStdLibFileIO::GetName(char * pBuffer) +{ + strcpy(pBuffer, m_cFileName); + return 0; +} + +int CStdLibFileIO::Create(const char * pName) +{ + Close(); + + if (0 == strcmp (pName, "-") || 0 == strcmp (pName, "/dev/stdout")) + { + m_pFile = SETBINARY_OUT(stdout); + m_bReadOnly = FALSE; // WriteOnly + } + else + { + m_pFile = fopen (pName, "w+b"); // Read/Write + m_bReadOnly = FALSE; + } + + if (!m_pFile) + return -1; + + strcpy (m_cFileName, pName); + + return 0; +} + +int CStdLibFileIO::Delete() +{ + Close(); + return unlink (m_cFileName); // 0 success, -1 error +} + +#endif // #ifdef IO_USE_STD_LIB_FILE_IO diff --git a/Libraries/MAC/Files/Source/Shared/StdLibFileIO.h b/Libraries/MAC/Files/Source/Shared/StdLibFileIO.h new file mode 100755 index 000000000..80cb9543c --- /dev/null +++ b/Libraries/MAC/Files/Source/Shared/StdLibFileIO.h @@ -0,0 +1,53 @@ +#ifdef IO_USE_STD_LIB_FILE_IO + +#ifndef APE_STDLIBFILEIO_H +#define APE_STDLIBFILEIO_H + +#include "IO.h" + +class CStdLibFileIO : public CIO +{ +public: + + // construction / destruction + CStdLibFileIO(); + ~CStdLibFileIO(); + + // open / close + //int Open(LPCTSTR pName); + int Open(const char * pName); + int Close(); + + // read / write + int Read(void * pBuffer, unsigned int nBytesToRead, unsigned int * pBytesRead); + int Write(const void * pBuffer, unsigned int nBytesToWrite, unsigned int * pBytesWritten); + + // seek + int Seek(int nDistance, unsigned int nMoveMode); + + // other functions + int SetEOF(); + + // creation / destruction + //int Create(const char * pName); + int Create(const char * pName); + int Delete(); + + // attributes + int GetPosition(); + int GetSize(); + //int GetName(char * pBuffer); + int GetName(char * pBuffer); + int GetHandle(); + +private: + + char m_cFileName[MAX_PATH]; + BOOL m_bReadOnly; + FILE * m_pFile; +}; + +#endif // #ifndef APE_STDLIBFILEIO_H + +#endif // #ifdef IO_USE_STD_LIB_FILE_IO + diff --git a/Libraries/MAC/Files/Source/Shared/StdString.h b/Libraries/MAC/Files/Source/Shared/StdString.h new file mode 100755 index 000000000..777b1d060 --- /dev/null +++ b/Libraries/MAC/Files/Source/Shared/StdString.h @@ -0,0 +1,3015 @@ +// ============================================================================= +// FILE: StdString.h +// AUTHOR: Joe O'Leary (with outside help noted in comments) +// REMARKS: +// This header file declares the CStdStr template. This template derives +// the Standard C++ Library basic_string<> template and add to it the +// the following conveniences: +// - The full MFC CString set of functions (including implicit cast) +// - writing to/reading from COM IStream interfaces +// - Functional objects for use in STL algorithms +// +// From this template, we intstantiate two classes: CStdStringA and +// CStdStringW. The name "CStdString" is just a #define of one of these, +// based upone the _UNICODE macro setting +// +// This header also declares our own version of the MFC/ATL UNICODE-MBCS +// conversion macros. Our version looks exactly like the Microsoft's to +// facilitate portability. +// +// NOTE: +// If you you use this in an MFC or ATL build, you should include either +// afx.h or atlbase.h first, as appropriate. +// +// PEOPLE WHO HAVE CONTRIBUTED TO THIS CLASS: +// +// Several people have helped me iron out problems and othewise improve +// this class. OK, this is a long list but in my own defense, this code +// has undergone two major rewrites. Many of the improvements became +// necessary after I rewrote the code as a template. Others helped me +// improve the CString facade. +// +// Anyway, these people are (in chronological order): +// +// - Pete the Plumber (???) +// - Julian Selman +// - Chris (of Melbsys) +// - Dave Plummer +// - John C Sipos +// - Chris Sells +// - Nigel Nunn +// - Fan Xia +// - Matthew Williams +// - Carl Engman +// - Mark Zeren +// - Craig Watson +// - Rich Zuris +// - Karim Ratib +// - Chris Conti +// - Baptiste Lepilleur +// - Greg Pickles +// - Jim Cline +// - Jeff Kohn +// - Todd Heckel +// - Ullrich Pollähne +// - Joe Vitaterna +// - Joe Woodbury +// - Aaron (no last name) +// - Joldakowski (???) +// - Scott Hathaway +// - Eric Nitzche +// - Pablo Presedo +// +// REVISION HISTORY +// 2001-APR-27 - StreamLoad was calculating the number of BYTES in one +// case, not characters. Thanks to Pablo Presedo for this. +// +// 2001-FEB-23 - Replace() had a bug which caused infinite loops if the +// source string was empty. Fixed thanks to Eric Nitzsche. +// +// 2001-FEB-23 - Scott Hathaway was a huge help in providing me with the +// ability to build CStdString on Sun Unix systems. He +// sent me detailed build reports about what works and what +// does not. If CStdString compiles on your Unix box, you +// can thank Scott for it. +// +// 2000-DEC-29 - Joldakowski noticed one overload of Insert failed to do +// range check as CString's does. Now fixed -- thanks! +// +// 2000-NOV-07 - Aaron pointed out that I was calling static member +// functions of char_traits via a temporary. This was not +// technically wrong, but it was unnecessary and caused +// problems for poor old buggy VC5. Thanks Aaron! +// +// 2000-JUL-11 - Joe Woodbury noted that the CString::Find docs don't match +// what the CString::Find code really ends up doing. I was +// trying to match the docs. Now I match the CString code +// - Joe also caught me truncating strings for GetBuffer() calls +// when the supplied length was less than the current length. +// +// 2000-MAY-25 - Better support for STLPORT's Standard library distribution +// - Got rid of the NSP macro - it interfered with Koenig lookup +// - Thanks to Joe Woodbury for catching a TrimLeft() bug that +// I introduced in January. Empty strings were not getting +// trimmed +// +// 2000-APR-17 - Thanks to Joe Vitaterna for pointing out that ReverseFind +// is supposed to be a const function. +// +// 2000-MAR-07 - Thanks to Ullrich Pollähne for catching a range bug in one +// of the overloads of assign. +// +// 2000-FEB-01 - You can now use CStdString on the Mac with CodeWarrior! +// Thanks to Todd Heckel for helping out with this. +// +// 2000-JAN-23 - Thanks to Jim Cline for pointing out how I could make the +// Trim() function more efficient. +// - Thanks to Jeff Kohn for prompting me to find and fix a typo +// in one of the addition operators that takes _bstr_t. +// - Got rid of the .CPP file - you only need StdString.h now! +// +// 1999-DEC-22 - Thanks to Greg Pickles for helping me identify a problem +// with my implementation of CStdString::FormatV in which +// resulting string might not be properly NULL terminated. +// +// 1999-DEC-06 - Chris Conti pointed yet another basic_string<> assignment +// bug that MS has not fixed. CStdString did nothing to fix +// it either but it does now! The bug was: create a string +// longer than 31 characters, get a pointer to it (via c_str()) +// and then assign that pointer to the original string object. +// The resulting string would be empty. Not with CStdString! +// +// 1999-OCT-06 - BufferSet was erasing the string even when it was merely +// supposed to shrink it. Fixed. Thanks to Chris Conti. +// - Some of the Q172398 fixes were not checking for assignment- +// to-self. Fixed. Thanks to Baptiste Lepilleur. +// +// 1999-AUG-20 - Improved Load() function to be more efficient by using +// SizeOfResource(). Thanks to Rich Zuris for this. +// - Corrected resource ID constructor, again thanks to Rich. +// - Fixed a bug that occurred with UNICODE characters above +// the first 255 ANSI ones. Thanks to Craig Watson. +// - Added missing overloads of TrimLeft() and TrimRight(). +// Thanks to Karim Ratib for pointing them out +// +// 1999-JUL-21 - Made all calls to GetBuf() with no args check length first. +// +// 1999-JUL-10 - Improved MFC/ATL independence of conversion macros +// - Added SS_NO_REFCOUNT macro to allow you to disable any +// reference-counting your basic_string<> impl. may do. +// - Improved ReleaseBuffer() to be as forgiving as CString. +// Thanks for Fan Xia for helping me find this and to +// Matthew Williams for pointing it out directly. +// +// 1999-JUL-06 - Thanks to Nigel Nunn for catching a very sneaky bug in +// ToLower/ToUpper. They should call GetBuf() instead of +// data() in order to ensure the changed string buffer is not +// reference-counted (in those implementations that refcount). +// +// 1999-JUL-01 - Added a true CString facade. Now you can use CStdString as +// a drop-in replacement for CString. If you find this useful, +// you can thank Chris Sells for finally convincing me to give +// in and implement it. +// - Changed operators << and >> (for MFC CArchive) to serialize +// EXACTLY as CString's do. So now you can send a CString out +// to a CArchive and later read it in as a CStdString. I have +// no idea why you would want to do this but you can. +// +// 1999-JUN-21 - Changed the CStdString class into the CStdStr template. +// - Fixed FormatV() to correctly decrement the loop counter. +// This was harmless bug but a bug nevertheless. Thanks to +// Chris (of Melbsys) for pointing it out +// - Changed Format() to try a normal stack-based array before +// using to _alloca(). +// - Updated the text conversion macros to properly use code +// pages and to fit in better in MFC/ATL builds. In other +// words, I copied Microsoft's conversion stuff again. +// - Added equivalents of CString::GetBuffer, GetBufferSetLength +// - new sscpy() replacement of CStdString::CopyString() +// - a Trim() function that combines TrimRight() and TrimLeft(). +// +// 1999-MAR-13 - Corrected the "NotSpace" functional object to use _istpace() +// instead of _isspace() Thanks to Dave Plummer for this. +// +// 1999-FEB-26 - Removed errant line (left over from testing) that #defined +// _MFC_VER. Thanks to John C Sipos for noticing this. +// +// 1999-FEB-03 - Fixed a bug in a rarely-used overload of operator+() that +// caused infinite recursion and stack overflow +// - Added member functions to simplify the process of +// persisting CStdStrings to/from DCOM IStream interfaces +// - Added functional objects (e.g. StdStringLessNoCase) that +// allow CStdStrings to be used as keys STL map objects with +// case-insensitive comparison +// - Added array indexing operators (i.e. operator[]). I +// originally assumed that these were unnecessary and would be +// inherited from basic_string. However, without them, Visual +// C++ complains about ambiguous overloads when you try to use +// them. Thanks to Julian Selman to pointing this out. +// +// 1998-FEB-?? - Added overloads of assign() function to completely account +// for Q172398 bug. Thanks to "Pete the Plumber" for this +// +// 1998-FEB-?? - Initial submission +// +// COPYRIGHT: +// 1999 Joseph M. O'Leary. This code is free. Use it anywhere you want. +// Rewrite it, restructure it, whatever. Please don't blame me if it makes +// your $30 billion dollar satellite explode in orbit. If you redistribute +// it in any form, I'd appreciate it if you would leave this notice here. +// +// If you find any bugs, please let me know: +// +// jmoleary@earthlink.net +// http://home.earthlink.net/~jmoleary +// ============================================================================= + +// Avoid multiple inclusion the VC++ way, +// Turn off browser references +// Turn off unavoidable compiler warnings + +#if defined(_MSC_VER) && (_MSC_VER > 1100) + #pragma once + #pragma component(browser, off, references, "CStdString") + #pragma warning (disable : 4290) // C++ Exception Specification ignored + #pragma warning (disable : 4127) // Conditional expression is constant + #pragma warning (disable : 4097) // typedef name used as synonym for class name +#endif + +#ifndef STDSTRING_H +#define STDSTRING_H + +// MACRO: SS_NO_REFCOUNT: +// turns off reference counting at the assignment level +// I define this by default. comment it out if you don't want it. + +#define SS_NO_REFCOUNT + +// In non-Visual C++ and/or non-Win32 builds, we can't use some cool stuff. + +#if !defined(_MSC_VER) || !defined(_WIN32) + #define SS_ANSI +#endif + +// Avoid legacy code screw up: if _UNICODE is defined, UNICODE must be as well + +#if defined (_UNICODE) && !defined (UNICODE) + #define UNICODE +#endif +#if defined (UNICODE) && !defined (_UNICODE) + #define _UNICODE +#endif + +// ----------------------------------------------------------------------------- +// MIN and MAX. The Standard C++ template versions go by so many names (at +// at least in the MS implementation) that you never know what's available +// ----------------------------------------------------------------------------- +template +inline const Type& SSMIN(const Type& arg1, const Type& arg2) +{ + return arg2 < arg1 ? arg2 : arg1; +} +template +inline const Type& SSMAX(const Type& arg1, const Type& arg2) +{ + return arg2 > arg1 ? arg2 : arg1; +} + +// If they have not #included W32Base.h (part of my W32 utility library) then +// we need to define some stuff. Otherwise, this is all defined there. + +#if !defined(W32BASE_H) + + // If they want us to use only standard C++ stuff (no Win32 stuff) + + #ifdef SS_ANSI + + // On non-Win32 platforms, there is no TCHAR.H so define what we need + + #ifndef _WIN32 + + typedef const char* PCSTR; + typedef char* PSTR; + typedef const wchar_t* PCWSTR; + typedef wchar_t* PWSTR; + #ifdef UNICODE + typedef wchar_t TCHAR; + #else + typedef char TCHAR; + #endif + typedef wchar_t OLECHAR; + + #else + + #include + #include + #ifndef STRICT + #define STRICT + #endif + + #endif // #ifndef _WIN32 + + + // Make sure ASSERT and verify are defined in an ANSI fashion + + #ifndef ASSERT + #include + #define ASSERT(f) assert((f)) + #endif + #ifndef VERIFY + #ifdef _DEBUG + #define VERIFY(x) ASSERT((x)) + #else + #define VERIFY(x) x + #endif + #endif + + #else // #ifdef SS_ANSI + + #include + #include + #ifndef STRICT + #define STRICT + #endif + + // Make sure ASSERT and verify are defined + + #ifndef ASSERT + #include + #define ASSERT(f) _ASSERTE((f)) + #endif + #ifndef VERIFY + #ifdef _DEBUG + #define VERIFY(x) ASSERT((x)) + #else + #define VERIFY(x) x + #endif + #endif + + #endif // #ifdef SS_ANSI + + #ifndef UNUSED + #define UNUSED(x) x + #endif + +#endif // #ifndef W32BASE_H + +// Standard headers needed + +#include // basic_string +#include // for_each, etc. +#include // for StdStringLessNoCase, et al +#include // for various facets + +// If this is a recent enough version of VC include comdef.h, so we can write +// member functions to deal with COM types & compiler support classes e.g. _bstr_t + +#if defined (_MSC_VER) && (_MSC_VER >= 1100) + #include + #define SS_INC_COMDEF // signal that we #included MS comdef.h file + #define STDSTRING_INC_COMDEF + #define SS_NOTHROW __declspec(nothrow) +#else + #define SS_NOTHROW +#endif + +#ifndef TRACE + #define TRACE_DEFINED_HERE + #define TRACE +#endif + +// Microsoft defines PCSTR, PCWSTR, etc, but no PCTSTR. I hate to use the +// versions with the "L" in front of them because that's a leftover from Win 16 +// days, even though it evaluates to the same thing. Therefore, Define a PCSTR +// as an LPCTSTR. + +#if !defined(PCTSTR) && !defined(PCTSTR_DEFINED) + typedef const TCHAR* PCTSTR; + #define PCTSTR_DEFINED +#endif + +#if !defined(PCOLESTR) && !defined(PCOLESTR_DEFINED) + typedef const OLECHAR* PCOLESTR; + #define PCOLESTR_DEFINED +#endif + +#if !defined(POLESTR) && !defined(POLESTR_DEFINED) + typedef OLECHAR* POLESTR; + #define POLESTR_DEFINED +#endif + +#if !defined(PCUSTR) && !defined(PCUSTR_DEFINED) + typedef const unsigned char* PCUSTR; + typedef unsigned char* PUSTR; + #define PCUSTR_DEFINED +#endif + +// SS_USE_FACET macro and why we need it: +// +// Since I'm a good little Standard C++ programmer, I use locales. Thus, I +// need to make use of the use_facet<> template function here. Unfortunately, +// this need is complicated by the fact the MS' implementation of the Standard +// C++ Library has a non-standard version of use_facet that takes more +// arguments than the standard dictates. Since I'm trying to write CStdString +// to work with any version of the Standard library, this presents a problem. +// +// The upshot of this is that I can't do 'use_facet' directly. The MS' docs +// tell me that I have to use a macro, _USE() instead. Since _USE obviously +// won't be available in other implementations, this means that I have to write +// my OWN macro -- SS_USE_FACET -- that evaluates either to _USE or to the +// standard, use_facet. +// +// If you are having trouble with the SS_USE_FACET macro, in your implementation +// of the Standard C++ Library, you can define your own version of SS_USE_FACET. +#ifndef schMSG + #define schSTR(x) #x + #define schSTR2(x) schSTR(x) + #define schMSG(desc) message(__FILE__ "(" schSTR2(__LINE__) "):" #desc) +#endif + +#ifndef SS_USE_FACET + // STLPort #defines a macro (__STL_NO_EXPLICIT_FUNCTION_TMPL_ARGS) for + // all MSVC builds, erroneously in my opinion. It causes problems for + // my SS_ANSI builds. In my code, I always comment out that line. You'll + // find it in \stlport\config\stl_msvc.h + #if defined(__SGI_STL_PORT) && (__SGI_STL_PORT >= 0x400 ) + #if defined(__STL_NO_EXPLICIT_FUNCTION_TMPL_ARGS) && defined(_MSC_VER) + #ifdef SS_ANSI + #pragma schMSG(__STL_NO_EXPLICIT_FUNCTION_TMPL_ARGS defined!!) + #endif + #endif + #define SS_USE_FACET(loc, fac) std::use_facet(loc) + #elif defined(_MSC_VER ) + #define SS_USE_FACET(loc, fac) _USE(loc, fac) + + // ...and + #elif defined(_RWSTD_NO_TEMPLATE_ON_RETURN_TYPE) + #define SS_USE_FACET(loc, fac) std::use_facet(loc, (fac*)0) + #else + #define SS_USE_FACET(loc, fac) std::use_facet(loc) + #endif +#endif + +// ============================================================================= +// UNICODE/MBCS conversion macros. Made to work just like the MFC/ATL ones. +// ============================================================================= + +// First define the conversion helper functions. We define these regardless of +// any preprocessor macro settings since their names won't collide. + +#ifdef SS_ANSI // Are we doing things the standard, non-Win32 way?... + + typedef std::codecvt SSCodeCvt; + + // Not sure if we need all these headers. I believe ANSI says we do. + + #include + #include + #include + #ifndef va_start + #include + #endif + + // StdCodeCvt - made to look like Win32 functions WideCharToMultiByte annd + // MultiByteToWideChar but uses locales in SS_ANSI builds + inline PWSTR StdCodeCvt(PWSTR pW, PCSTR pA, int nChars, + const std::locale& loc=std::locale()) + { + ASSERT(0 != pA); + ASSERT(0 != pW); + pW[0] = '\0'; + PCSTR pBadA = 0; + PWSTR pBadW = 0; + SSCodeCvt::result res = SSCodeCvt::ok; + const SSCodeCvt& conv = SS_USE_FACET(loc, SSCodeCvt); + SSCodeCvt::state_type st= { 0 }; + res = conv.in(st, + pA, pA + nChars, pBadA, + pW, pW + nChars, pBadW); + ASSERT(SSCodeCvt::ok == res); + return pW; + } + inline PWSTR StdCodeCvt(PWSTR pW, PCUSTR pA, int nChars, + const std::locale& loc=std::locale()) + { + return StdCodeCvt(pW, (PCSTR)pA, nChars, loc); + } + + inline PSTR StdCodeCvt(PSTR pA, PCWSTR pW, int nChars, + const std::locale& loc=std::locale()) + { + ASSERT(0 != pA); + ASSERT(0 != pW); + pA[0] = '\0'; + PSTR pBadA = 0; + PCWSTR pBadW = 0; + SSCodeCvt::result res = SSCodeCvt::ok; + const SSCodeCvt& conv = SS_USE_FACET(loc, SSCodeCvt); + SSCodeCvt::state_type st= { 0 }; + res = conv.out(st, + pW, pW + nChars, pBadW, + pA, pA + nChars, pBadA); + ASSERT(SSCodeCvt::ok == res); + return pA; + } + inline PUSTR StdCodeCvt(PUSTR pA, PCWSTR pW, int nChars, + const std::locale& loc=std::locale()) + { + return (PUSTR)StdCodeCvt((PSTR)pA, pW, nChars, loc); + } + +#else // ...or are we doing things assuming win32 and Visual C++? + + #include // needed for _alloca + + inline PWSTR StdCodeCvt(PWSTR pW, PCSTR pA, int nChars, UINT acp=CP_ACP) + { + ASSERT(0 != pA); + ASSERT(0 != pW); + pW[0] = '\0'; + MultiByteToWideChar(acp, 0, pA, -1, pW, nChars); + return pW; + } + inline PWSTR StdCodeCvt(PWSTR pW, PCUSTR pA, int nChars, UINT acp=CP_ACP) + { + return StdCodeCvt(pW, (PCSTR)pA, nChars, acp); + } + + inline PSTR StdCodeCvt(PSTR pA, PCWSTR pW, int nChars, UINT acp=CP_ACP) + { + ASSERT(0 != pA); + ASSERT(0 != pW); + pA[0] = '\0'; + WideCharToMultiByte(acp, 0, pW, -1, pA, nChars, 0, 0); + return pA; + } + inline PUSTR StdCodeCvt(PUSTR pA, PCWSTR pW, int nChars, UINT acp=CP_ACP) + { + return (PUSTR)StdCodeCvt((PSTR)pA, pW, nChars, acp); + } + + // Define our conversion macros to look exactly like Microsoft's to + // facilitate using this stuff both with and without MFC/ATL + + #ifdef _CONVERSION_USES_THREAD_LOCALE + #ifndef _DEBUG + #define SSCVT int _cvt; _cvt; UINT _acp=GetACP(); \ + _acp; PCWSTR _pw; _pw; PCSTR _pa; _pa + #else + #define SSCVT int _cvt = 0; _cvt; UINT _acp=GetACP();\ + _acp; PCWSTR _pw=0; _pw; PCSTR _pa=0; _pa + #endif + #else + #ifndef _DEBUG + #define SSCVT int _cvt; _cvt; UINT _acp=CP_ACP; _acp;\ + PCWSTR _pw; _pw; PCSTR _pa; _pa + #else + #define SSCVT int _cvt = 0; _cvt; UINT _acp=CP_ACP; \ + _acp; PCWSTR _pw=0; _pw; PCSTR _pa=0; _pa + #endif + #endif + + #ifdef _CONVERSION_USES_THREAD_LOCALE + #define SSA2W(pa) (\ + ((_pa = pa) == 0) ? 0 : (\ + _cvt = (strlen(_pa)+1),\ + StdCodeCvt((PWSTR) _alloca(_cvt*2), _pa, _cvt, _acp))) + #define SSW2A(pw) (\ + ((_pw = pw) == 0) ? 0 : (\ + _cvt = (wcslen(_pw)+1)*2,\ + StdW2AHelper((LPSTR) _alloca(_cvt), _pw, _cvt, _acp))) + #else + #define SSA2W(pa) (\ + ((_pa = pa) == 0) ? 0 : (\ + _cvt = (strlen(_pa)+1),\ + StdCodeCvt((PWSTR) _alloca(_cvt*2), _pa, _cvt))) + #define SSW2A(pw) (\ + ((_pw = pw) == 0) ? 0 : (\ + _cvt = (wcslen(_pw)+1)*2,\ + StdCodeCvt((LPSTR) _alloca(_cvt), _pw, _cvt))) + #endif + + #define SSA2CW(pa) ((PCWSTR)SSA2W((pa))) + #define SSW2CA(pw) ((PCSTR)SSW2A((pw))) + + #ifdef UNICODE + #define SST2A SSW2A + #define SSA2T SSA2W + #define SST2CA SSW2CA + #define SSA2CT SSA2CW + inline PWSTR SST2W(PTSTR p) { return p; } + inline PTSTR SSW2T(PWSTR p) { return p; } + inline PCWSTR SST2CW(PCTSTR p) { return p; } + inline PCTSTR SSW2CT(PCWSTR p) { return p; } + #else + #define SST2W SSA2W + #define SSW2T SSW2A + #define SST2CW SSA2CW + #define SSW2CT SSW2CA + inline PSTR SST2A(PTSTR p) { return p; } + inline PTSTR SSA2T(PSTR p) { return p; } + inline PCSTR SST2CA(PCTSTR p) { return p; } + inline PCTSTR SSA2CT(PCSTR p) { return p; } + #endif // #ifdef UNICODE + + #if defined(UNICODE) + // in these cases the default (TCHAR) is the same as OLECHAR + inline PCOLESTR SST2COLE(PCTSTR p) { return p; } + inline PCTSTR SSOLE2CT(PCOLESTR p) { return p; } + inline POLESTR SST2OLE(PTSTR p) { return p; } + inline PTSTR SSOLE2T(POLESTR p) { return p; } + #elif defined(OLE2ANSI) + // in these cases the default (TCHAR) is the same as OLECHAR + inline PCOLESTR SST2COLE(PCTSTR p) { return p; } + inline PCTSTR SSOLE2CT(PCOLESTR p) { return p; } + inline POLESTR SST2OLE(PTSTR p) { return p; } + inline PTSTR SSOLE2T(POLESTR p) { return p; } + #else + //CharNextW doesn't work on Win95 so we use this + #define SST2COLE(pa) SSA2CW((pa)) + #define SST2OLE(pa) SSA2W((pa)) + #define SSOLE2CT(po) SSW2CA((po)) + #define SSOLE2T(po) SSW2A((po)) + #endif + + #ifdef OLE2ANSI + #define SSW2OLE SSW2A + #define SSOLE2W SSA2W + #define SSW2COLE SSW2CA + #define SSOLE2CW SSA2CW + inline POLESTR SSA2OLE(PSTR p) { return p; } + inline PSTR SSOLE2A(POLESTR p) { return p; } + inline PCOLESTR SSA2COLE(PCSTR p) { return p; } + inline PCSTR SSOLE2CA(PCOLESTR p){ return p; } + #else + #define SSA2OLE SSA2W + #define SSOLE2A SSW2A + #define SSA2COLE SSA2CW + #define SSOLE2CA SSW2CA + inline POLESTR SSW2OLE(PWSTR p) { return p; } + inline PWSTR SSOLE2W(POLESTR p) { return p; } + inline PCOLESTR SSW2COLE(PCWSTR p) { return p; } + inline PCWSTR SSOLE2CW(PCOLESTR p){ return p; } + #endif + + // Above we've defined macros that look like MS' but all have + // an 'SS' prefix. Now we need the real macros. We'll either + // get them from the macros above or from MFC/ATL. If + // SS_NO_CONVERSION is #defined, we'll forgo them + + #ifndef SS_NO_CONVERSION + + #if defined (USES_CONVERSION) + + #define _NO_STDCONVERSION // just to be consistent + + #else + + #ifdef _MFC_VER + + #include + #define _NO_STDCONVERSION // just to be consistent + + #else + + #define USES_CONVERSION SSCVT + #define A2CW SSA2CW + #define W2CA SSW2CA + #define T2A SST2A + #define A2T SSA2T + #define T2W SST2W + #define W2T SSW2T + #define T2CA SST2CA + #define A2CT SSA2CT + #define T2CW SST2CW + #define W2CT SSW2CT + #define ocslen sslen + #define ocscpy sscpy + #define T2COLE SST2COLE + #define OLE2CT SSOLE2CT + #define T2OLE SST2COLE + #define OLE2T SSOLE2CT + #define A2OLE SSA2OLE + #define OLE2A SSOLE2A + #define W2OLE SSW2OLE + #define OLE2W SSOLE2W + #define A2COLE SSA2COLE + #define OLE2CA SSOLE2CA + #define W2COLE SSW2COLE + #define OLE2CW SSOLE2CW + + #endif // #ifdef _MFC_VER + #endif // #ifndef USES_CONVERSION + #endif // #ifndef SS_NO_CONVERSION + + // Define ostring - generic name for std::basic_string + + #if !defined(ostring) && !defined(OSTRING_DEFINED) + typedef std::basic_string ostring; + #define OSTRING_DEFINED + #endif + +#endif // #ifndef SS_ANSI + +// StdCodeCvt when there's no conversion to be done +inline PSTR StdCodeCvt(PSTR pDst, PCSTR pSrc, int nChars) +{ + pDst[0] = '\0'; + std::char_traits::copy(pDst, pSrc, nChars); + if ( nChars > 0 ) + pDst[nChars] = '\0'; + + return pDst; +} +inline PSTR StdCodeCvt(PSTR pDst, PCUSTR pSrc, int nChars) +{ + return StdCodeCvt(pDst, (PCSTR)pSrc, nChars); +} +inline PUSTR StdCodeCvt(PUSTR pDst, PCSTR pSrc, int nChars) +{ + return (PUSTR)StdCodeCvt((PSTR)pDst, pSrc, nChars); +} + +inline PWSTR StdCodeCvt(PWSTR pDst, PCWSTR pSrc, int nChars) +{ + pDst[0] = '\0'; + std::char_traits::copy(pDst, pSrc, nChars); + if ( nChars > 0 ) + pDst[nChars] = '\0'; + + return pDst; +} + + +// Define tstring -- generic name for std::basic_string + +#if !defined(tstring) && !defined(TSTRING_DEFINED) + typedef std::basic_string tstring; + #define TSTRING_DEFINED +#endif + +// a very shorthand way of applying the fix for KB problem Q172398 +// (basic_string assignment bug) + +#if defined ( _MSC_VER ) && ( _MSC_VER < 1200 ) + #define Q172398(x) (x).erase() +#else + #define Q172398(x) +#endif + +// ============================================================================= +// INLINE FUNCTIONS ON WHICH CSTDSTRING RELIES +// +// Usually for generic text mapping, we rely on preprocessor macro definitions +// to map to string functions. However the CStdStr<> template cannot use +// macro-based generic text mappings because its character types do not get +// resolved until template processing which comes AFTER macro processing. In +// other words, UNICODE is of little help to us in the CStdStr template +// +// Therefore, to keep the CStdStr declaration simple, we have these inline +// functions. The template calls them often. Since they are inline (and NOT +// exported when this is built as a DLL), they will probably be resolved away +// to nothing. +// +// Without these functions, the CStdStr<> template would probably have to broken +// out into two, almost identical classes. Either that or it would be a huge, +// convoluted mess, with tons of "if" statements all over the place checking the +// size of template parameter CT. +// +// In several cases, you will see two versions of each function. One version is +// the more portable, standard way of doing things, while the other is the +// non-standard, but often significantly faster Visual C++ way. +// ============================================================================= + +// If they defined SS_NO_REFCOUNT, then we must convert all assignments + +#ifdef SS_NO_REFCOUNT + #define SSREF(x) (x).c_str() +#else + #define SSREF(x) (x) +#endif + +// ----------------------------------------------------------------------------- +// sslen: strlen/wcslen wrappers +// ----------------------------------------------------------------------------- +template inline int sslen(const CT* pT) +{ + return 0 == pT ? 0 : std::char_traits::length(pT); +} +inline SS_NOTHROW int sslen(const std::string& s) +{ + return s.length(); +} +inline SS_NOTHROW int sslen(const std::wstring& s) +{ + return s.length(); +} + + +// ----------------------------------------------------------------------------- +// ssasn: assignment functions -- assign "sSrc" to "sDst" +// ----------------------------------------------------------------------------- +typedef std::string::size_type SS_SIZETYPE; // just for shorthand, really +typedef std::string::pointer SS_PTRTYPE; +typedef std::wstring::size_type SW_SIZETYPE; +typedef std::wstring::pointer SW_PTRTYPE; + +inline void ssasn(std::string& sDst, const std::string& sSrc) +{ + if ( sDst.c_str() != sSrc.c_str() ) + { + sDst.erase(); + sDst.assign(SSREF(sSrc)); + } +} +inline void ssasn(std::string& sDst, PCSTR pA) +{ + // Watch out for NULLs, as always. + + if ( 0 == pA ) + { + sDst.erase(); + } + + // If pA actually points to part of sDst, we must NOT erase(), but + // rather take a substring + + else if ( pA >= sDst.c_str() && pA <= sDst.c_str() + sDst.size() ) + { + sDst =sDst.substr(static_cast(pA-sDst.c_str())); + } + + // Otherwise (most cases) apply the assignment bug fix, if applicable + // and do the assignment + + else + { + Q172398(sDst); + sDst.assign(pA); + } +} +inline void ssasn(std::string& sDst, const std::wstring& sSrc) +{ +#ifdef SS_ANSI + int nLen = sSrc.size(); + sDst.resize(0); + sDst.resize(nLen); + StdCodeCvt(const_cast(sDst.data()), sSrc.c_str(), nLen); +#else + SSCVT; + sDst.assign(SSW2CA(sSrc.c_str())); +#endif +} +inline void ssasn(std::string& sDst, PCWSTR pW) +{ +#ifdef SS_ANSI + int nLen = sslen(pW); + sDst.resize(0); + sDst.resize(nLen); + StdCodeCvt(const_cast(sDst.data()), pW, nLen); +#else + SSCVT; + sDst.assign(pW ? SSW2CA(pW) : ""); +#endif +} +inline void ssasn(std::string& sDst, const int nNull) +{ + UNUSED(nNull); + ASSERT(nNull==0); + sDst.assign(""); +} +inline void ssasn(std::wstring& sDst, const std::wstring& sSrc) +{ + if ( sDst.c_str() != sSrc.c_str() ) + { + sDst.erase(); + sDst.assign(SSREF(sSrc)); + } +} +inline void ssasn(std::wstring& sDst, PCWSTR pW) +{ + // Watch out for NULLs, as always. + + if ( 0 == pW ) + { + sDst.erase(); + } + + // If pW actually points to part of sDst, we must NOT erase(), but + // rather take a substring + + else if ( pW >= sDst.c_str() && pW <= sDst.c_str() + sDst.size() ) + { + sDst = sDst.substr(static_cast(pW-sDst.c_str())); + } + + // Otherwise (most cases) apply the assignment bug fix, if applicable + // and do the assignment + + else + { + Q172398(sDst); + sDst.assign(pW); + } +} +#undef StrSizeType +inline void ssasn(std::wstring& sDst, const std::string& sSrc) +{ +#ifdef SS_ANSI + int nLen = sSrc.size(); + sDst.resize(0); + sDst.resize(nLen); + StdCodeCvt(const_cast(sDst.data()), sSrc.c_str(), nLen); +#else + SSCVT; + sDst.assign(SSA2CW(sSrc.c_str())); +#endif +} +inline void ssasn(std::wstring& sDst, PCSTR pA) +{ +#ifdef SS_ANSI + int nLen = sslen(pA); + sDst.resize(0); + sDst.resize(nLen); + StdCodeCvt(const_cast(sDst.data()), pA, nLen); +#else + SSCVT; + sDst.assign(pA ? SSA2CW(pA) : L""); +#endif +} +inline void ssasn(std::wstring& sDst, const int nNull) +{ + UNUSED(nNull); + ASSERT(nNull==0); + sDst.assign(L""); +} + + +// ----------------------------------------------------------------------------- +// ssadd: string object concatenation -- add second argument to first +// ----------------------------------------------------------------------------- +inline void ssadd(std::string& sDst, const std::wstring& sSrc) +{ +#ifdef SS_ANSI + int nLen = sSrc.size(); + sDst.resize(sDst.size() + nLen); + StdCodeCvt(const_cast(sDst.data()+nLen), sSrc.c_str(), nLen); +#else + SSCVT; + sDst.append(SSW2CA(sSrc.c_str())); +#endif +} +inline void ssadd(std::string& sDst, const std::string& sSrc) +{ + sDst.append(sSrc.c_str()); +} +inline void ssadd(std::string& sDst, PCWSTR pW) +{ +#ifdef SS_ANSI + int nLen = sslen(pW); + sDst.resize(sDst.size() + nLen); + StdCodeCvt(const_cast(sDst.data()+nLen), pW, nLen); +#else + SSCVT; + if ( 0 != pW ) + sDst.append(SSW2CA(pW)); +#endif +} +inline void ssadd(std::string& sDst, PCSTR pA) +{ + if ( pA ) + sDst.append(pA); +} +inline void ssadd(std::wstring& sDst, const std::wstring& sSrc) +{ + sDst.append(sSrc.c_str()); +} +inline void ssadd(std::wstring& sDst, const std::string& sSrc) +{ +#ifdef SS_ANSI + int nLen = sSrc.size(); + sDst.resize(sDst.size() + nLen); + StdCodeCvt(const_cast(sDst.data()+nLen), sSrc.c_str(), nLen); +#else + SSCVT; + sDst.append(SSA2CW(sSrc.c_str())); +#endif +} +inline void ssadd(std::wstring& sDst, PCSTR pA) +{ +#ifdef SS_ANSI + int nLen = sslen(pA); + sDst.resize(sDst.size() + nLen); + StdCodeCvt(const_cast(sDst.data()+nLen), pA, nLen); +#else + SSCVT; + if ( 0 != pA ) + sDst.append(SSA2CW(pA)); +#endif +} +inline void ssadd(std::wstring& sDst, PCWSTR pW) +{ + if ( pW ) + sDst.append(pW); +} + + +// ----------------------------------------------------------------------------- +// ssicmp: comparison (case insensitive ) +// ----------------------------------------------------------------------------- +#ifdef SS_ANSI + template + inline int ssicmp(const CT* pA1, const CT* pA2) + { + std::locale loc; + const std::ctype& ct = SS_USE_FACET(loc, std::ctype); + CT f; + CT l; + + do + { + f = ct.tolower(*(pA1++)); + l = ct.tolower(*(pA2++)); + } while ( (f) && (f == l) ); + + return (int)(f - l); + } +#else + #ifdef _MBCS + inline long sscmp(PCSTR pA1, PCSTR pA2) + { + return _mbscmp((PCUSTR)pA1, (PCUSTR)pA2); + } + inline long ssicmp(PCSTR pA1, PCSTR pA2) + { + return _mbsicmp((PCUSTR)pA1, (PCUSTR)pA2); + } + #else + inline long sscmp(PCSTR pA1, PCSTR pA2) + { + return strcmp(pA1, pA2); + } + inline long ssicmp(PCSTR pA1, PCSTR pA2) + { + return _stricmp(pA1, pA2); + } + #endif + inline long sscmp(PCWSTR pW1, PCWSTR pW2) + { + return wcscmp(pW1, pW2); + } + inline long ssicmp(PCWSTR pW1, PCWSTR pW2) + { + return _wcsicmp(pW1, pW2); + } +#endif + +// ----------------------------------------------------------------------------- +// ssupr/sslwr: Uppercase/Lowercase conversion functions +// ----------------------------------------------------------------------------- +#ifdef SS_ANSI + template + inline void sslwr(CT* pT, size_t nLen) + { + SS_USE_FACET(std::locale(), std::ctype).tolower(pT, pT+nLen); + } + template + inline void ssupr(CT* pT, size_t nLen) + { + SS_USE_FACET(std::locale(), std::ctype).toupper(pT, pT+nLen); + } +#else // #else we must be on Win32 + #ifdef _MBCS + inline void ssupr(PSTR pA, size_t /*nLen*/) + { + _mbsupr((PUSTR)pA); + } + inline void sslwr(PSTR pA, size_t /*nLen*/) + { + _mbslwr((PUSTR)pA); + } + #else + inline void ssupr(PSTR pA, size_t /*nLen*/) + { + _strupr(pA); + } + inline void sslwr(PSTR pA, size_t /*nLen*/) + { + _strlwr(pA); + } + #endif + inline void ssupr(PWSTR pW, size_t /*nLen*/) + { + _wcsupr(pW); + } + inline void sslwr(PWSTR pW, size_t /*nLen*/) + { + _wcslwr(pW); + } +#endif // #ifdef SS_ANSI + +// ----------------------------------------------------------------------------- +// vsprintf/vswprintf or _vsnprintf/_vsnwprintf equivalents. In standard +// builds we can't use _vsnprintf/_vsnwsprintf because they're MS extensions. +// ----------------------------------------------------------------------------- +#ifdef SS_ANSI + inline int ssvsprintf(PSTR pA, size_t /*nCount*/, PCSTR pFmtA, va_list vl) + { + return vsprintf(pA, pFmtA, vl); + } + inline int ssvsprintf(PWSTR pW, size_t nCount, PCWSTR pFmtW, va_list vl) + { + // JMO: It is beginning to seem like Microsoft Visual C++ is the only + // CRT distribution whose version of vswprintf takes THREE arguments. + // All others seem to take FOUR arguments. Therefore instead of + // checking for every possible distro here, I'll assume that unless + // I am running with Microsoft's CRT, then vswprintf takes four + // arguments. If you get a compilation error here, then you can just + // change this code to call the three-argument version. +// #if !defined(__MWERKS__) && !defined(__SUNPRO_CC_COMPAT) && !defined(__SUNPRO_CC) + #ifndef _MSC_VER + return vswprintf(pW, nCount, pFmtW, vl); + #else + nCount; + return vswprintf(pW, pFmtW, vl); + #endif + } +#else + inline int ssnprintf(PSTR pA, size_t nCount, PCSTR pFmtA, va_list vl) + { + return _vsnprintf(pA, nCount, pFmtA, vl); + } + inline int ssnprintf(PWSTR pW, size_t nCount, PCWSTR pFmtW, va_list vl) + { + return _vsnwprintf(pW, nCount, pFmtW, vl); + } +#endif + + +// ----------------------------------------------------------------------------- +// ssload: Type safe, overloaded ::LoadString wrappers +// There is no equivalent of these in non-Win32-specific builds. However, I'm +// thinking that with the message facet, there might eventually be one +// ----------------------------------------------------------------------------- +#ifdef SS_ANSI +#else + inline int ssload(HMODULE hInst, UINT uId, PSTR pBuf, int nMax) + { + return ::LoadStringA(hInst, uId, pBuf, nMax); + } + inline int ssload(HMODULE hInst, UINT uId, PWSTR pBuf, int nMax) + { + return ::LoadStringW(hInst, uId, pBuf, nMax); + } +#endif + + +// ----------------------------------------------------------------------------- +// sscoll/ssicoll: Collation wrappers +// ----------------------------------------------------------------------------- +#ifdef SS_ANSI + template + inline int sscoll(const CT* sz1, int nLen1, const CT* sz2, int nLen2) + { + const std::collate& coll = + SS_USE_FACET(std::locale(), std::collate); + return coll.compare(sz1, sz1+nLen1, sz2, sz2+nLen2); + } + template + inline int ssicoll(const CT* sz1, int nLen1, const CT* sz2, int nLen2) + { + const std::locale loc; + const std::collate& coll = SS_USE_FACET(loc, std::collate); + + // Some implementations seem to have trouble using the collate<> + // facet typedefs so we'll just default to basic_string and hope + // that's what the collate facet uses (which it generally should) + +// std::collate::string_type s1(sz1); +// std::collate::string_type s2(sz2); + std::basic_string s1(sz1); + std::basic_string s2(sz2); + + sslwr(const_cast(s1.c_str()), nLen1); + sslwr(const_cast(s2.c_str()), nLen2); + return coll.compare(s1.c_str(), s1.c_str()+nLen1, + s2.c_str(), s2.c_str()+nLen2); + } +#else + #ifdef _MBCS + inline int sscoll(PCSTR sz1, int /*nLen1*/, PCSTR sz2, int /*nLen2*/) + { + return _mbscoll((PCUSTR)sz1, (PCUSTR)sz2); + } + inline int ssicoll(PCSTR sz1, int /*nLen1*/, PCSTR sz2, int /*nLen2*/) + { + return _mbsicoll((PCUSTR)sz1, (PCUSTR)sz2); + } + #else + inline int sscoll(PCSTR sz1, int /*nLen1*/, PCSTR sz2, int /*nLen2*/) + { + return strcoll(sz1, sz2); + } + inline int ssicoll(PCSTR sz1, int /*nLen1*/, PCSTR sz2, int /*nLen2*/) + { + return _stricoll(sz1, sz2); + } + #endif + inline int sscoll(PCWSTR sz1, int /*nLen1*/, PCWSTR sz2, int /*nLen2*/) + { + return wcscoll(sz1, sz2); + } + inline int ssicoll(PCWSTR sz1, int /*nLen1*/, PCWSTR sz2, int /*nLen2*/) + { + return _wcsicoll(sz1, sz2); + } +#endif + + +// ----------------------------------------------------------------------------- +// ssfmtmsg: FormatMessage equivalents. Needed because I added a CString facade +// Again -- no equivalent of these on non-Win32 builds but their might one day +// be one if the message facet gets implemented +// ----------------------------------------------------------------------------- +#ifdef SS_ANSI +#else + inline DWORD ssfmtmsg(DWORD dwFlags, LPCVOID pSrc, DWORD dwMsgId, + DWORD dwLangId, PSTR pBuf, DWORD nSize, + va_list* vlArgs) + { + return FormatMessageA(dwFlags, pSrc, dwMsgId, dwLangId, + pBuf, nSize,vlArgs); + } + inline DWORD ssfmtmsg(DWORD dwFlags, LPCVOID pSrc, DWORD dwMsgId, + DWORD dwLangId, PWSTR pBuf, DWORD nSize, + va_list* vlArgs) + { + return FormatMessageW(dwFlags, pSrc, dwMsgId, dwLangId, + pBuf, nSize,vlArgs); + } +#endif + + + +// FUNCTION: sscpy. Copies up to 'nMax' characters from pSrc to pDst. +// ----------------------------------------------------------------------------- +// FUNCTION: sscpy +// inline int sscpy(PSTR pDst, PCSTR pSrc, int nMax=-1); +// inline int sscpy(PUSTR pDst, PCSTR pSrc, int nMax=-1) +// inline int sscpy(PSTR pDst, PCWSTR pSrc, int nMax=-1); +// inline int sscpy(PWSTR pDst, PCWSTR pSrc, int nMax=-1); +// inline int sscpy(PWSTR pDst, PCSTR pSrc, int nMax=-1); +// +// DESCRIPTION: +// This function is very much (but not exactly) like strcpy. These +// overloads simplify copying one C-style string into another by allowing +// the caller to specify two different types of strings if necessary. +// +// The strings must NOT overlap +// +// "Character" is expressed in terms of the destination string, not +// the source. If no 'nMax' argument is supplied, then the number of +// characters copied will be sslen(pSrc). A NULL terminator will +// also be added so pDst must actually be big enough to hold nMax+1 +// characters. The return value is the number of characters copied, +// not including the NULL terminator. +// +// PARAMETERS: +// pSrc - the string to be copied FROM. May be a char based string, an +// MBCS string (in Win32 builds) or a wide string (wchar_t). +// pSrc - the string to be copied TO. Also may be either MBCS or wide +// nMax - the maximum number of characters to be copied into szDest. Note +// that this is expressed in whatever a "character" means to pDst. +// If pDst is a wchar_t type string than this will be the maximum +// number of wchar_ts that my be copied. The pDst string must be +// large enough to hold least nMaxChars+1 characters. +// If the caller supplies no argument for nMax this is a signal to +// the routine to copy all the characters in pSrc, regardless of +// how long it is. +// +// RETURN VALUE: none +// ----------------------------------------------------------------------------- +template +inline int sscpycvt(CT1* pDst, const CT2* pSrc, int nChars) +{ + StdCodeCvt(pDst, pSrc, nChars); + pDst[SSMAX(nChars, 0)] = '\0'; + return nChars; +} + +template +inline int sscpy(CT1* pDst, const CT2* pSrc, int nMax, int nLen) +{ + return sscpycvt(pDst, pSrc, SSMIN(nMax, nLen)); +} +template +inline int sscpy(CT1* pDst, const CT2* pSrc, int nMax) +{ + return sscpycvt(pDst, pSrc, SSMIN(nMax, sslen(pSrc))); +} +template +inline int sscpy(CT1* pDst, const CT2* pSrc) +{ + return sscpycvt(pDst, pSrc, sslen(pSrc)); +} +template +inline int sscpy(CT1* pDst, const std::basic_string& sSrc, int nMax) +{ + return sscpycvt(pDst, sSrc.c_str(), SSMIN(nMax, (int)sSrc.length())); +} +template +inline int sscpy(CT1* pDst, const std::basic_string& sSrc) +{ + return sscpycvt(pDst, sSrc.c_str(), (int)sSrc.length()); +} + +#ifdef SS_INC_COMDEF + template + inline int sscpy(CT1* pDst, const _bstr_t& bs, int nMax) + { + return sscpycvt(pDst, static_cast(bs), SSMIN(nMax, (int)bs.length())); + } + template + inline int sscpy(CT1* pDst, const _bstr_t& bs) + { + return sscpy(pDst, bs, bs.length()); + } +#endif + + +// ----------------------------------------------------------------------------- +// Functional objects for changing case. They also let you pass locales +// ----------------------------------------------------------------------------- + +#ifdef SS_ANSI + template + struct SSToUpper : public std::binary_function + { + inline CT operator()(const CT& t, const std::locale& loc) const + { + return std::toupper(t, loc); + } + }; + template + struct SSToLower : public std::binary_function + { + inline CT operator()(const CT& t, const std::locale& loc) const + { + return std::tolower(t, loc); + } + }; +#endif + +// This struct is used for TrimRight() and TrimLeft() function implementations. +//template +//struct NotSpace : public std::unary_function +//{ +// const std::locale& loc; +// inline NotSpace(const std::locale& locArg) : loc(locArg) {} +// inline bool operator() (CT t) { return !std::isspace(t, loc); } +//}; +template +struct NotSpace : public std::unary_function +{ + const std::locale& loc; + NotSpace(const std::locale& locArg) : loc(locArg) {} + + // DINKUMWARE BUG: + // Note -- using std::isspace in a COM DLL gives us access violations + // because it causes the dynamic addition of a function to be called + // when the library shuts down. Unfortunately the list is maintained + // in DLL memory but the function is in static memory. So the COM DLL + // goes away along with the function that was supposed to be called, + // and then later when the DLL CRT shuts down it unloads the list and + // tries to call the long-gone function. + // This is DinkumWare's implementation problem. Until then, we will + // use good old isspace and iswspace from the CRT unless they + // specify SS_ANSI +#ifdef SS_ANSI + bool operator() (CT t) const { return !std::isspace(t, loc); } +#else + bool ssisp(char c) const { return FALSE != ::isspace((int) c); } + bool ssisp(wchar_t c) const { return FALSE != ::iswspace((wint_t) c); } + bool operator()(CT t) const { return !ssisp(t); } +#endif +}; + + + + +// Now we can define the template (finally!) +// ============================================================================= +// TEMPLATE: CStdStr +// template class CStdStr : public std::basic_string +// +// REMARKS: +// This template derives from basic_string and adds some MFC CString- +// like functionality +// +// Basically, this is my attempt to make Standard C++ library strings as +// easy to use as the MFC CString class. +// +// Note that although this is a template, it makes the assumption that the +// template argument (CT, the character type) is either char or wchar_t. +// ============================================================================= + +//#define CStdStr _SS // avoid compiler warning 4786 + + +template +class CStdStr : public std::basic_string +{ + // Typedefs for shorter names. Using these names also appears to help + // us avoid some ambiguities that otherwise arise on some platforms + + typedef typename std::basic_string MYBASE; // my base class + typedef CStdStr MYTYPE; // myself + typedef typename MYBASE::const_pointer PCMYSTR; // PCSTR or PCWSTR + typedef typename MYBASE::pointer PMYSTR; // PSTR or PWSTR + typedef typename MYBASE::iterator MYITER; // my iterator type + typedef typename MYBASE::const_iterator MYCITER; // you get the idea... + typedef typename MYBASE::reverse_iterator MYRITER; + typedef typename MYBASE::size_type MYSIZE; + typedef typename MYBASE::value_type MYVAL; + typedef typename MYBASE::allocator_type MYALLOC; + +public: + + // shorthand conversion from PCTSTR to string resource ID + #define _TRES(pctstr) (LOWORD((DWORD)(pctstr))) + + // CStdStr inline constructors + CStdStr() + { + } + + CStdStr(const MYTYPE& str) : MYBASE(SSREF(str)) + { + } + + CStdStr(const std::string& str) + { + ssasn(*this, SSREF(str)); + } + + CStdStr(const std::wstring& str) + { + ssasn(*this, SSREF(str)); + } + + CStdStr(PCMYSTR pT, MYSIZE n) : MYBASE(pT, n) + { + } + + CStdStr(PCSTR pA) + { + #ifdef SS_ANSI + *this = pA; + #else + if ( 0 != HIWORD(pA) ) + *this = pA; + else if ( 0 != pA && !Load(_TRES(pA)) ) + TRACE(_T("Can't load string %u\n"), _TRES(pA)); + #endif + } + + CStdStr(PCWSTR pW) + { + #ifdef SS_ANSI + *this = pW; + #else + if ( 0 != HIWORD(pW) ) + *this = pW; + else if ( 0 != pW && !Load(_TRES(pW)) ) + TRACE(_T("Can't load string %u\n"), _TRES(pW)); + #endif + } + + CStdStr(MYCITER first, MYCITER last) + : MYBASE(first, last) + { + } + + CStdStr(MYSIZE nSize, MYVAL ch, const MYALLOC& al=MYALLOC()) + : MYBASE(nSize, ch, al) + { + } + + #ifdef SS_INC_COMDEF + CStdStr(const _bstr_t& bstr) + { + if ( bstr.length() > 0 ) + append(static_cast(bstr), bstr.length()); + } + #endif + + // CStdStr inline assignment operators -- the ssasn function now takes care + // of fixing the MSVC assignment bug (see knowledge base article Q172398). + MYTYPE& operator=(const MYTYPE& str) + { + ssasn(*this, str); + return *this; + } + + MYTYPE& operator=(const std::string& str) + { + ssasn(*this, str); + return *this; + } + + MYTYPE& operator=(const std::wstring& str) + { + ssasn(*this, str); + return *this; + } + + MYTYPE& operator=(PCSTR pA) + { + ssasn(*this, pA); + return *this; + } + + MYTYPE& operator=(PCWSTR pW) + { + ssasn(*this, pW); + return *this; + } + + MYTYPE& operator=(CT t) + { + Q172398(*this); + MYBASE::assign(1, t); + return *this; + } + + #ifdef SS_INC_COMDEF + MYTYPE& operator=(const _bstr_t& bstr) + { + if ( bstr.length() > 0 ) + return assign(static_cast(bstr), bstr.length()); + else + { + erase(); + return *this; + } + } + #endif + + + // Overloads also needed to fix the MSVC assignment bug (KB: Q172398) + // *** Thanks to Pete The Plumber for catching this one *** + // They also are compiled if you have explicitly turned off refcounting + #if ( defined(_MSC_VER) && ( _MSC_VER < 1200 ) ) || defined(SS_NO_REFCOUNT) + + MYTYPE& assign(const MYTYPE& str) + { + ssasn(*this, str); + return *this; + } + + MYTYPE& assign(const MYTYPE& str, MYSIZE nStart, MYSIZE nChars) + { + // This overload of basic_string::assign is supposed to assign up to + // or the NULL terminator, whichever comes first. Since we + // are about to call a less forgiving overload (in which + // must be a valid length), we must adjust the length here to a safe + // value. Thanks to Ullrich Pollähne for catching this bug + + nChars = SSMIN(nChars, str.length() - nStart); + + // Watch out for assignment to self + + if ( this == &str ) + { + MYTYPE strTemp(str.c_str()+nStart, nChars); + assign(strTemp); + } + else + { + Q172398(*this); + MYBASE::assign(str.c_str()+nStart, nChars); + } + return *this; + } + + MYTYPE& assign(const MYBASE& str) + { + ssasn(*this, str); + return *this; + } + + MYTYPE& assign(const MYBASE& str, MYSIZE nStart, MYSIZE nChars) + { + // This overload of basic_string::assign is supposed to assign up to + // or the NULL terminator, whichever comes first. Since we + // are about to call a less forgiving overload (in which + // must be a valid length), we must adjust the length here to a safe + // value. Thanks to Ullrich Pollähne for catching this bug + + nChars = SSMIN(nChars, str.length() - nStart); + + // Watch out for assignment to self + + if ( this == &str ) // watch out for assignment to self + { + MYTYPE strTemp(str.c_str() + nStart, nChars); + assign(strTemp); + } + else + { + Q172398(*this); + MYBASE::assign(str.c_str()+nStart, nChars); + } + return *this; + } + + MYTYPE& assign(const CT* pC, MYSIZE nChars) + { + // Q172398 only fix -- erase before assigning, but not if we're + // assigning from our own buffer + + #if defined ( _MSC_VER ) && ( _MSC_VER < 1200 ) + if ( !empty() && ( pC < data() || pC > data() + capacity() ) ) + erase(); + #endif + Q172398(*this); + MYBASE::assign(pC, nChars); + return *this; + } + + MYTYPE& assign(MYSIZE nChars, MYVAL val) + { + Q172398(*this); + MYBASE::assign(nChars, val); + return *this; + } + + MYTYPE& assign(const CT* pT) + { + return assign(pT, CStdStr::traits_type::length(pT)); + } + + MYTYPE& assign(MYCITER iterFirst, MYCITER iterLast) + { + #if defined ( _MSC_VER ) && ( _MSC_VER < 1200 ) + // Q172398 fix. don't call erase() if we're assigning from ourself + if ( iterFirst < begin() || iterFirst > begin() + size() ) + erase() + #endif + replace(begin(), end(), iterFirst, iterLast); + return *this; + } + #endif + + + // ------------------------------------------------------------------------- + // CStdStr inline concatenation. + // ------------------------------------------------------------------------- + MYTYPE& operator+=(const MYTYPE& str) + { + ssadd(*this, str); + return *this; + } + + MYTYPE& operator+=(const std::string& str) + { + ssadd(*this, str); + return *this; + } + + MYTYPE& operator+=(const std::wstring& str) + { + ssadd(*this, str); + return *this; + } + + MYTYPE& operator+=(PCSTR pA) + { + ssadd(*this, pA); + return *this; + } + + MYTYPE& operator+=(PCWSTR pW) + { + ssadd(*this, pW); + return *this; + } + + MYTYPE& operator+=(CT t) + { + append(1, t); + return *this; + } + #ifdef SS_INC_COMDEF // if we have _bstr_t, define a += for it too. + MYTYPE& operator+=(const _bstr_t& bstr) + { + return operator+=(static_cast(bstr)); + } + #endif + + + // addition operators -- global friend functions. + + friend MYTYPE operator+(const MYTYPE& str1, const MYTYPE& str2); + friend MYTYPE operator+(const MYTYPE& str, CT t); + friend MYTYPE operator+(const MYTYPE& str, PCSTR sz); + friend MYTYPE operator+(const MYTYPE& str, PCWSTR sz); + friend MYTYPE operator+(PCSTR pA, const MYTYPE& str); + friend MYTYPE operator+(PCWSTR pW, const MYTYPE& str); +#ifdef SS_INC_COMDEF + friend MYTYPE operator+(const _bstr_t& bstr, const MYTYPE& str); + friend MYTYPE operator+(const MYTYPE& str, const _bstr_t& bstr); +#endif + + // ------------------------------------------------------------------------- + // Case changing functions + // ------------------------------------------------------------------------- + // ------------------------------------------------------------------------- + MYTYPE& ToUpper() + { + // Strictly speaking, this would be about the most portable way + + // std::transform(begin(), + // end(), + // begin(), + // std::bind2nd(SSToUpper(), std::locale())); + + // But practically speaking, this works faster + + if ( !empty() ) + ssupr(GetBuf(), size()); + + return *this; + } + + + + MYTYPE& ToLower() + { + // Strictly speaking, this would be about the most portable way + + // std::transform(begin(), + // end(), + // begin(), + // std::bind2nd(SSToLower(), std::locale())); + + // But practically speaking, this works faster + + if ( !empty() ) + sslwr(GetBuf(), size()); + + return *this; + } + + + + MYTYPE& Normalize() + { + return Trim().ToLower(); + } + + + // ------------------------------------------------------------------------- + // CStdStr -- Direct access to character buffer. In the MS' implementation, + // the at() function that we use here also calls _Freeze() providing us some + // protection from multithreading problems associated with ref-counting. + // ------------------------------------------------------------------------- + CT* GetBuf(int nMinLen=-1) + { + if ( static_cast(size()) < nMinLen ) + resize(static_cast(nMinLen)); + + return empty() ? const_cast(data()) : &(at(0)); + } + + CT* SetBuf(int nLen) + { + nLen = ( nLen > 0 ? nLen : 0 ); + if ( capacity() < 1 && nLen == 0 ) + resize(1); + + resize(static_cast(nLen)); + return const_cast(data()); + } + void RelBuf(int nNewLen=-1) + { + resize(static_cast(nNewLen > -1 ? nNewLen : sslen(c_str()))); + } + + void BufferRel() { RelBuf(); } // backwards compatability + CT* Buffer() { return GetBuf(); } // backwards compatability + CT* BufferSet(int nLen) { return SetBuf(nLen);}// backwards compatability + + bool Equals(const CT* pT, bool bUseCase=false) const + { // get copy, THEN compare (thread safe) + return bUseCase ? compare(pT) == 0 : ssicmp(MYTYPE(*this), pT) == 0; + } + + // ------------------------------------------------------------------------- + // FUNCTION: CStdStr::Load + // REMARKS: + // Loads string from resource specified by nID + // + // PARAMETERS: + // nID - resource Identifier. Purely a Win32 thing in this case + // + // RETURN VALUE: + // true if successful, false otherwise + // ------------------------------------------------------------------------- +#ifndef SS_ANSI + bool Load(UINT nId, HMODULE hModule=NULL) + { + bool bLoaded = false; // set to true of we succeed. + + #ifdef _MFC_VER // When in Rome... + + CString strRes; + bLoaded = FALSE != strRes.LoadString(nId); + if ( bLoaded ) + *this = strRes; + + #else + + // Get the resource name and module handle + + if ( NULL == hModule ) + hModule = GetResourceHandle(); + + PCTSTR szName = MAKEINTRESOURCE((nId>>4)+1); // lifted + DWORD dwSize = 0; + + // No sense continuing if we can't find the resource + + HRSRC hrsrc = ::FindResource(hModule, szName, RT_STRING); + + if ( NULL == hrsrc ) + TRACE(_T("Cannot find resource %d: 0x%X"), nId, ::GetLastError()); + else if ( 0 == (dwSize = ::SizeofResource(hModule, hrsrc) / sizeof(CT))) + TRACE(_T("Cant get size of resource %d 0x%X\n"),nId,GetLastError()); + else + { + bLoaded = 0 != ssload(hModule, nId, GetBuf(dwSize), dwSize); + ReleaseBuffer(); + } + + #endif + + if ( !bLoaded ) + TRACE(_T("String not loaded 0x%X\n"), ::GetLastError()); + + return bLoaded; + } +#endif + + // ------------------------------------------------------------------------- + // FUNCTION: CStdStr::Format + // void _cdecl Formst(CStdStringA& PCSTR szFormat, ...) + // void _cdecl Format(PCSTR szFormat); + // + // DESCRIPTION: + // This function does sprintf/wsprintf style formatting on CStdStringA + // objects. It looks a lot like MFC's CString::Format. Some people + // might even call this identical. Fortunately, these people are now + // dead. + // + // PARAMETERS: + // nId - ID of string resource holding the format string + // szFormat - a PCSTR holding the format specifiers + // argList - a va_list holding the arguments for the format specifiers. + // + // RETURN VALUE: None. + // ------------------------------------------------------------------------- + // formatting (using wsprintf style formatting) + #ifndef SS_ANSI + void Format(UINT nId, ...) + { + va_list argList; + va_start(argList, nId); + va_start(argList, nId); + + MYTYPE strFmt; + if ( strFmt.Load(nId) ) + FormatV(strFmt, argList); + + va_end(argList); + } + #endif + void Format(const CT* szFmt, ...) + { + va_list argList; + va_start(argList, szFmt); + FormatV(szFmt, argList); + va_end(argList); + } + void AppendFormat(const CT* szFmt, ...) + { + va_list argList; + va_start(argList, szFmt); + AppendFormatV(szFmt, argList); + va_end(argList); + } + + #define MAX_FMT_TRIES 5 // #of times we try + #define FMT_BLOCK_SIZE 2048 // # of bytes to increment per try + #define BUFSIZE_1ST 256 + #define BUFSIZE_2ND 512 + #define STD_BUF_SIZE 1024 + + // an efficient way to add formatted characters to the string. You may only + // add up to STD_BUF_SIZE characters at a time, though + void AppendFormatV(const CT* szFmt, va_list argList) + { + CT szBuf[STD_BUF_SIZE]; + #ifdef SS_ANSI + int nLen = ssvsprintf(szBuf, STD_BUF_SIZE-1, szFmt, argList); + #else + int nLen = ssnprintf(szBuf, STD_BUF_SIZE-1, szFmt, argList); + #endif + if ( 0 < nLen ) + append(szBuf, nLen); + } + + // ------------------------------------------------------------------------- + // FUNCTION: FormatV + // void FormatV(PCSTR szFormat, va_list, argList); + // + // DESCRIPTION: + // This function formats the string with sprintf style format-specs. + // It makes a general guess at required buffer size and then tries + // successively larger buffers until it finds one big enough or a + // threshold (MAX_FMT_TRIES) is exceeded. + // + // PARAMETERS: + // szFormat - a PCSTR holding the format of the output + // argList - a Microsoft specific va_list for variable argument lists + // + // RETURN VALUE: + // ------------------------------------------------------------------------- + + void FormatV(const CT* szFormat, va_list argList) + { + #ifdef SS_ANSI + + int nLen = sslen(szFormat) + STD_BUF_SIZE; + ssvsprintf(GetBuffer(nLen), nLen-1, szFormat, argList); + ReleaseBuffer(); + + #else + + CT* pBuf = NULL; + int nChars = 1; + int nUsed = 0; + size_type nActual = 0; + int nTry = 0; + + do + { + // Grow more than linearly (e.g. 512, 1536, 3072, etc) + + nChars += ((nTry+1) * FMT_BLOCK_SIZE); + pBuf = reinterpret_cast(_alloca(sizeof(CT)*nChars)); + nUsed = ssnprintf(pBuf, nChars-1, szFormat, argList); + + // Ensure proper NULL termination. + + nActual = nUsed == -1 ? nChars-1 : SSMIN(nUsed, nChars-1); + pBuf[nActual+1]= '\0'; + + + } while ( nUsed < 0 && nTry++ < MAX_FMT_TRIES ); + + // assign whatever we managed to format + + assign(pBuf, nActual); + + #endif + } + + + // ------------------------------------------------------------------------- + // CString Facade Functions: + // + // The following methods are intended to allow you to use this class as a + // drop-in replacement for CString. + // ------------------------------------------------------------------------- + #ifndef SS_ANSI + BSTR AllocSysString() const + { + ostring os; + ssasn(os, *this); + return ::SysAllocString(os.c_str()); + } + #endif + + int Collate(PCMYSTR szThat) const + { + return sscoll(c_str(), length(), szThat, sslen(szThat)); + } + + int CollateNoCase(PCMYSTR szThat) const + { + return ssicoll(c_str(), length(), szThat, sslen(szThat)); + } + + int Compare(PCMYSTR szThat) const + { + return MYBASE::compare(szThat); + } + + int CompareNoCase(PCMYSTR szThat) const + { + return ssicmp(c_str(), szThat); + } + + int Delete(int nIdx, int nCount=1) + { + if ( nIdx < GetLength() ) + erase(static_cast(nIdx), static_cast(nCount)); + + return GetLength(); + } + + void Empty() + { + erase(); + } + + int Find(CT ch) const + { + MYSIZE nIdx = find_first_of(ch); + return static_cast(MYBASE::npos == nIdx ? -1 : nIdx); + } + + int Find(PCMYSTR szSub) const + { + MYSIZE nIdx = find(szSub); + return static_cast(MYBASE::npos == nIdx ? -1 : nIdx); + } + + int Find(CT ch, int nStart) const + { + // CString::Find docs say add 1 to nStart when it's not zero + // CString::Find code doesn't do that however. We'll stick + // with what the code does + + MYSIZE nIdx = find_first_of(ch, static_cast(nStart)); + return static_cast(MYBASE::npos == nIdx ? -1 : nIdx); + } + + int Find(PCMYSTR szSub, int nStart) const + { + // CString::Find docs say add 1 to nStart when it's not zero + // CString::Find code doesn't do that however. We'll stick + // with what the code does + + MYSIZE nIdx = find(szSub, static_cast(nStart)); + return static_cast(MYBASE::npos == nIdx ? -1 : nIdx); + } + + int FindOneOf(PCMYSTR szCharSet) const + { + MYSIZE nIdx = find_first_of(szCharSet); + return static_cast(MYBASE::npos == nIdx ? -1 : nIdx); + } + +#ifndef SS_ANSI + void FormatMessage(PCMYSTR szFormat, ...) throw(std::exception) + { + va_list argList; + va_start(argList, szFormat); + PMYSTR szTemp; + if ( ssfmtmsg(FORMAT_MESSAGE_FROM_STRING|FORMAT_MESSAGE_ALLOCATE_BUFFER, + szFormat, 0, 0, + reinterpret_cast(&szTemp), 0, &argList) == 0 || + szTemp == 0 ) + { + throw std::runtime_error("out of memory"); + } + *this = szTemp; + LocalFree(szTemp); + va_end(argList); + } + + void FormatMessage(UINT nFormatId, ...) throw(std::exception) + { + MYTYPE sFormat; + VERIFY(sFormat.LoadString(nFormatId) != 0); + va_list argList; + va_start(argList, nFormatId); + PMYSTR szTemp; + if ( ssfmtmsg(FORMAT_MESSAGE_FROM_STRING|FORMAT_MESSAGE_ALLOCATE_BUFFER, + sFormat, 0, 0, + reinterpret_cast(&szTemp), 0, &argList) == 0 || + szTemp == 0) + { + throw std::runtime_error("out of memory"); + } + *this = szTemp; + LocalFree(szTemp); + va_end(argList); + } +#endif + + + // ------------------------------------------------------------------------- + // GetXXXX -- Direct access to character buffer + // ------------------------------------------------------------------------- + CT GetAt(int nIdx) const + { + return at(static_cast(nIdx)); + } + + CT* GetBuffer(int nMinLen=-1) + { + return GetBuf(nMinLen); + } + + CT* GetBufferSetLength(int nLen) + { + return BufferSet(nLen); + } + + // GetLength() -- MFC docs say this is the # of BYTES but + // in truth it is the number of CHARACTERs (chars or wchar_ts) + int GetLength() const + { + return static_cast(length()); + } + + + int Insert(int nIdx, CT ch) + { + if ( static_cast(nIdx) > size() -1 ) + append(1, ch); + else + insert(static_cast(nIdx), 1, ch); + + return GetLength(); + } + int Insert(int nIdx, PCMYSTR sz) + { + if ( nIdx >= size() ) + append(sz, sslen(sz)); + else + insert(static_cast(nIdx), sz); + + return GetLength(); + } + + bool IsEmpty() const + { + return empty(); + } + + MYTYPE Left(int nCount) const + { + return substr(0, static_cast(nCount)); + } + + #ifndef SS_ANSI + bool LoadString(UINT nId) + { + return this->Load(nId); + } + #endif + + void MakeLower() + { + ToLower(); + } + + void MakeReverse() + { + std::reverse(begin(), end()); + } + + void MakeUpper() + { + ToUpper(); + } + + MYTYPE Mid(int nFirst ) const + { + return substr(static_cast(nFirst)); + } + + MYTYPE Mid(int nFirst, int nCount) const + { + return substr(static_cast(nFirst), static_cast(nCount)); + } + + void ReleaseBuffer(int nNewLen=-1) + { + RelBuf(nNewLen); + } + + int Remove(CT ch) + { + MYSIZE nIdx = 0; + int nRemoved = 0; + while ( (nIdx=find_first_of(ch)) != MYBASE::npos ) + { + erase(nIdx, 1); + nRemoved++; + } + return nRemoved; + } + + int Replace(CT chOld, CT chNew) + { + int nReplaced = 0; + for ( MYITER iter=begin(); iter != end(); iter++ ) + { + if ( *iter == chOld ) + { + *iter = chNew; + nReplaced++; + } + } + return nReplaced; + } + + int Replace(PCMYSTR szOld, PCMYSTR szNew) + { + int nReplaced = 0; + MYSIZE nIdx = 0; + MYSIZE nOldLen = sslen(szOld); + if ( 0 == nOldLen ) + return 0; + + static const CT ch = CT(0); + MYSIZE nNewLen = sslen(szNew); + PCMYSTR szRealNew = szNew == 0 ? &ch : szNew; + + while ( (nIdx=find(szOld, nIdx)) != MYBASE::npos ) + { + replace(begin()+nIdx, begin()+nIdx+nOldLen, szRealNew); + nReplaced++; + nIdx += nNewLen; + } + return nReplaced; + } + + int ReverseFind(CT ch) const + { + MYSIZE nIdx = find_last_of(ch); + return static_cast(MYBASE::npos == nIdx ? -1 : nIdx); + } + + // ReverseFind overload that's not in CString but might be useful + int ReverseFind(PCMYSTR szFind, MYSIZE pos=MYBASE::npos) const + { + MYSIZE nIdx = rfind(0 == szFind ? MYTYPE() : szFind, pos); + return static_cast(MYBASE::npos == nIdx ? -1 : nIdx); + } + + MYTYPE Right(int nCount) const + { + nCount = SSMIN(nCount, static_cast(size())); + return substr(size()-static_cast(nCount)); + } + + void SetAt(int nIndex, CT ch) + { + ASSERT(size() > static_cast(nIndex)); + at(static_cast(nIndex)) = ch; + } + + #ifndef SS_ANSI + BSTR SetSysString(BSTR* pbstr) const + { + ostring os; + ssasn(os, *this); + if ( !::SysReAllocStringLen(pbstr, os.c_str(), os.length()) ) + throw std::runtime_error("out of memory"); + + ASSERT(*pbstr != 0); + return *pbstr; + } + #endif + + MYTYPE SpanExcluding(PCMYSTR szCharSet) const + { + return Left(find_first_of(szCharSet)); + } + + MYTYPE SpanIncluding(PCMYSTR szCharSet) const + { + return Left(find_first_not_of(szCharSet)); + } + + #if !defined(UNICODE) && !defined(SS_ANSI) + + // CString's OemToAnsi and AnsiToOem functions are available only in + // Unicode builds. However since we're a template we also need a + // runtime check of CT and a reinterpret_cast to account for the fact + // that CStdStringW gets instantiated even in non-Unicode builds. + + void AnsiToOem() + { + if ( sizeof(CT) == sizeof(char) && !empty() ) + { + ::CharToOem(reinterpret_cast(c_str()), + reinterpret_cast(GetBuf())); + } + else + { + ASSERT(false); + } + } + + void OemToAnsi() + { + if ( sizeof(CT) == sizeof(char) && !empty() ) + { + ::OemToChar(reinterpret_cast(c_str()), + reinterpret_cast(GetBuf())); + } + else + { + ASSERT(false); + } + } + + #endif + + + // ------------------------------------------------------------------------- + // Trim and its variants + // ------------------------------------------------------------------------- + MYTYPE& Trim() + { + return TrimLeft().TrimRight(); + } + + MYTYPE& TrimLeft() + { + erase(begin(), std::find_if(begin(),end(),NotSpace(std::locale()))); + return *this; + } + + MYTYPE& TrimLeft(CT tTrim) + { + erase(0, find_first_not_of(tTrim)); + return *this; + } + + MYTYPE& TrimLeft(PCMYSTR szTrimChars) + { + erase(0, find_first_not_of(szTrimChars)); + return *this; + } + + MYTYPE& TrimRight() + { + std::locale loc; + MYRITER it = std::find_if(rbegin(), rend(), NotSpace(loc)); + if ( rend() != it ) + erase(rend() - it); + + erase(it != rend() ? find_last_of(*it) + 1 : 0); + return *this; + } + + MYTYPE& TrimRight(CT tTrim) + { + MYSIZE nIdx = find_last_not_of(tTrim); + erase(MYBASE::npos == nIdx ? 0 : ++nIdx); + return *this; + } + + MYTYPE& TrimRight(PCMYSTR szTrimChars) + { + MYSIZE nIdx = find_last_not_of(szTrimChars); + erase(MYBASE::npos == nIdx ? 0 : ++nIdx); + return *this; + } + + void FreeExtra() + { + MYTYPE mt; + swap(mt); + if ( !mt.empty() ) + assign(mt.c_str(), mt.size()); + } + + // I have intentionally not implemented the following CString + // functions. You cannot make them work without taking advantage + // of implementation specific behavior. However if you absolutely + // MUST have them, uncomment out these lines for "sort-of-like" + // their behavior. You're on your own. + +// CT* LockBuffer() { return GetBuf(); }// won't really lock +// void UnlockBuffer(); { } // why have UnlockBuffer w/o LockBuffer? + + // Array-indexing operators. Required because we defined an implicit cast + // to operator const CT* (Thanks to Julian Selman for pointing this out) + CT& operator[](int nIdx) + { + return MYBASE::operator[](static_cast(nIdx)); + } + + const CT& operator[](int nIdx) const + { + return MYBASE::operator[](static_cast(nIdx)); + } + + CT& operator[](unsigned int nIdx) + { + return MYBASE::operator[](static_cast(nIdx)); + } + + const CT& operator[](unsigned int nIdx) const + { + return MYBASE::operator[](static_cast(nIdx)); + } + + operator const CT*() const + { + return c_str(); + } + + // IStream related functions. Useful in IPersistStream implementations + +#ifdef SS_INC_COMDEF + + // struct SSSHDR - useful for non Std C++ persistence schemes. + typedef struct SSSHDR + { + BYTE byCtrl; + ULONG nChars; + } SSSHDR; // as in "Standard String Stream Header" + + #define SSSO_UNICODE 0x01 // the string is a wide string + #define SSSO_COMPRESS 0x02 // the string is compressed + + // ------------------------------------------------------------------------- + // FUNCTION: StreamSize + // REMARKS: + // Returns how many bytes it will take to StreamSave() this CStdString + // object to an IStream. + // ------------------------------------------------------------------------- + ULONG StreamSize() const + { + // Control header plus string + ASSERT(size()*sizeof(CT) < 0xffffffffUL - sizeof(SSSHDR)); + return (size() * sizeof(CT)) + sizeof(SSSHDR); + } + + // ------------------------------------------------------------------------- + // FUNCTION: StreamSave + // REMARKS: + // Saves this CStdString object to a COM IStream. + // ------------------------------------------------------------------------- + HRESULT StreamSave(IStream* pStream) const + { + ASSERT(size()*sizeof(CT) < 0xffffffffUL - sizeof(SSSHDR)); + HRESULT hr = E_FAIL; + ASSERT(pStream != 0); + SSSHDR hdr; + hdr.byCtrl = sizeof(CT) == 2 ? SSSO_UNICODE : 0; + hdr.nChars = size(); + + + if ( FAILED(hr=pStream->Write(&hdr, sizeof(SSSHDR), 0)) ) + TRACE(_T("StreamSave: Cannot write control header, ERR=0x%X\n"),hr); + else if ( empty() ) + ; // nothing to write + else if ( FAILED(hr=pStream->Write(c_str(), size()*sizeof(CT), 0)) ) + TRACE(_T("StreamSave: Cannot write string to stream 0x%X\n"), hr); + + return hr; + } + + + // ------------------------------------------------------------------------- + // FUNCTION: StreamLoad + // REMARKS: + // This method loads the object from an IStream. + // ------------------------------------------------------------------------- + HRESULT StreamLoad(IStream* pStream) + { + ASSERT(pStream != 0); + SSSHDR hdr; + HRESULT hr = E_FAIL; + + if ( FAILED(hr=pStream->Read(&hdr, sizeof(SSSHDR), 0)) ) + { + TRACE(_T("StreamLoad: Cant read control header, ERR=0x%X\n"), hr); + } + else if ( hdr.nChars > 0 ) + { + ULONG nRead = 0; + PMYSTR pMyBuf = BufferSet(hdr.nChars); + + // If our character size matches the character size of the string + // we're trying to read, then we can read it directly into our + // buffer. Otherwise, we have to read into an intermediate buffer + // and convert. + + if ( (hdr.byCtrl & SSSO_UNICODE) != 0 ) + { + ULONG nBytes = hdr.nChars * sizeof(wchar_t); + if ( sizeof(CT) == sizeof(wchar_t) ) + { + if ( FAILED(hr=pStream->Read(pMyBuf, nBytes, &nRead)) ) + TRACE(_T("StreamLoad: Cannot read string: 0x%X\n"), hr); + } + else + { + PWSTR pBufW = reinterpret_cast(_alloca((nBytes)+1)); + if ( FAILED(hr=pStream->Read(pBufW, nBytes, &nRead)) ) + TRACE(_T("StreamLoad: Cannot read string: 0x%X\n"), hr); + else + sscpy(pMyBuf, pBufW, hdr.nChars); + } + } + else + { + ULONG nBytes = hdr.nChars * sizeof(char); + if ( sizeof(CT) == sizeof(char) ) + { + if ( FAILED(hr=pStream->Read(pMyBuf, nBytes, &nRead)) ) + TRACE(_T("StreamLoad: Cannot read string: 0x%X\n"), hr); + } + else + { + PSTR pBufA = reinterpret_cast(_alloca(nBytes)); + if ( FAILED(hr=pStream->Read(pBufA, hdr.nChars, &nRead)) ) + TRACE(_T("StreamLoad: Cannot read string: 0x%X\n"), hr); + else + sscpy(pMyBuf, pBufA, hdr.nChars); + } + } + } + else + { + this->erase(); + } + return hr; + } +#endif // #ifdef SS_INC_COMDEF + +#ifndef SS_ANSI + + // SetResourceHandle/GetResourceHandle. In MFC builds, these map directly + // to AfxSetResourceHandle and AfxGetResourceHandle. In non-MFC builds they + // point to a single static HINST so that those who call the member + // functions that take resource IDs can provide an alternate HINST of a DLL + // to search. This is not exactly the list of HMODULES that MFC provides + // but it's better than nothing. + + #ifdef _MFC_VER + static void SetResourceHandle(HMODULE hNew) + { + AfxSetResourceHandle(hNew); + } + static HMODULE GetResourceHandle() + { + return AfxGetResourceHandle(); + } + #else + static void SetResourceHandle(HMODULE hNew) + { + SSResourceHandle() = hNew; + } + static HMODULE GetResourceHandle() + { + return SSResourceHandle(); + } + #endif + +#endif +}; + + + +// ----------------------------------------------------------------------------- +// CStdStr friend addition functions defined as inline +// ----------------------------------------------------------------------------- +template +inline +CStdStr operator+(const CStdStr& str1, const CStdStr& str2) +{ + CStdStr strRet(SSREF(str1)); + strRet.append(str2); + return strRet; +} + +template +inline +CStdStr operator+(const CStdStr& str, CT t) +{ + // this particular overload is needed for disabling reference counting + // though it's only an issue from line 1 to line 2 + + CStdStr strRet(SSREF(str)); // 1 + strRet.append(1, t); // 2 + return strRet; +} + +template +inline +CStdStr operator+(const CStdStr& str, PCSTR pA) +{ + return CStdStr(str) + CStdStr(pA); +} + +template +inline +CStdStr operator+(PCSTR pA, const CStdStr& str) +{ + CStdStr strRet(pA); + strRet.append(str); + return strRet; +} + +template +inline +CStdStr operator+(const CStdStr& str, PCWSTR pW) +{ + return CStdStr(SSREF(str)) + CStdStr(pW); +} + +template +inline +CStdStr operator+(PCWSTR pW, const CStdStr& str) +{ + CStdStr strRet(pW); + strRet.append(str); + return strRet; +} + +#ifdef SS_INC_COMDEF + template + inline + CStdStr operator+(const _bstr_t& bstr, const CStdStr& str) + { + return static_cast(bstr) + str; + } + + template + inline + CStdStr operator+(const CStdStr& str, const _bstr_t& bstr) + { + return str + static_cast(bstr); + } +#endif + + + + +// ----------------------------------------------------------------------------- +// These versions of operator+ provided by Scott Hathaway in order to allow +// CStdString to build on Sun Unix systems. +// ----------------------------------------------------------------------------- + +#if defined(__SUNPRO_CC_COMPAT) || defined(__SUNPRO_CC) + +// Made non-template versions due to "undefined" errors on Sun Forte compiler +// when linking with friend template functions +inline +CStdStr operator+(const CStdStr& str1, + const CStdStr& str2) +{ + CStdStr strRet(SSREF(str1)); + strRet.append(str2); + return strRet; +} + +inline +CStdStr operator+(const CStdStr& str, wchar_t t) +{ + // this particular overload is needed for disabling reference counting + // though it's only an issue from line 1 to line 2 + + CStdStr strRet(SSREF(str)); // 1 + strRet.append(1, t); // 2 + return strRet; +} + +inline +CStdStr operator+(const CStdStr& str, PCWSTR pW) +{ + return CStdStr(str) + CStdStr(pW); +} + +inline +CStdStr operator+(PCWSTR pA, const CStdStr& str) +{ + CStdStr strRet(pA); + strRet.append(str); + return strRet; +} + +inline +CStdStr operator+(const CStdStr& str, PCSTR pW) +{ + return CStdStr(SSREF(str)) + CStdStr(pW); +} + +inline +CStdStr operator+(PCSTR pW, const CStdStr& str) +{ + CStdStr strRet(pW); + strRet.append(str); + return strRet; +} + +inline +CStdStr operator+(const CStdStr& str1, const CStdStr& str2) +{ + CStdStr strRet(SSREF(str1)); + strRet.append(str2); + return strRet; +} + +inline +CStdStr operator+(const CStdStr& str, char t) +{ + // this particular overload is needed for disabling reference counting + // though it's only an issue from line 1 to line 2 + + CStdStr strRet(SSREF(str)); // 1 + strRet.append(1, t); // 2 + return strRet; +} + +inline +CStdStr operator+(const CStdStr& str, PCSTR pA) +{ + return CStdStr(str) + CStdStr(pA); +} + +inline +CStdStr operator+(PCSTR pA, const CStdStr& str) +{ + CStdStr strRet(pA); + strRet.append(str); + return strRet; +} + +inline +CStdStr operator+(const CStdStr& str, PCWSTR pW) +{ + return CStdStr(SSREF(str)) + CStdStr(pW); +} + +inline +CStdStr operator+(PCWSTR pW, const CStdStr& str) +{ + CStdStr strRet(pW); + strRet.append(str); + return strRet; +} + + +#endif // defined(__SUNPRO_CC_COMPAT) || defined(__SUNPRO_CC) + + +// ============================================================================= +// END OF CStdStr INLINE FUNCTION DEFINITIONS +// ============================================================================= + +// Now typedef our class names based upon this humongous template + +typedef CStdStr CStdStringA; // a better std::string +typedef CStdStr CStdStringW; // a better std::wstring +typedef CStdStr CStdStringO; // almost always CStdStringW + +#ifndef SS_ANSI + // SSResourceHandle: our MFC-like resource handle + inline HMODULE& SSResourceHandle() + { + static HMODULE hModuleSS = GetModuleHandle(0); + return hModuleSS; + } +#endif + + +// In MFC builds, define some global serialization operators +// Special operators that allow us to serialize CStdStrings to CArchives. +// Note that we use an intermediate CString object in order to ensure that +// we use the exact same format. + +#ifdef _MFC_VER + inline CArchive& AFXAPI operator<<(CArchive& ar, const CStdStringA& strA) + { + CString strTemp = strA; + return ar << strTemp; + } + inline CArchive& AFXAPI operator<<(CArchive& ar, const CStdStringW& strW) + { + CString strTemp = strW; + return ar << strTemp; + } + + inline CArchive& AFXAPI operator>>(CArchive& ar, CStdStringA& strA) + { + CString strTemp; + ar >> strTemp; + strA = strTemp; + return ar; + } + inline CArchive& AFXAPI operator>>(CArchive& ar, CStdStringW& strW) + { + CString strTemp; + ar >> strTemp; + strW = strTemp; + return ar; + } +#endif // #ifdef _MFC_VER -- (i.e. is this MFC?) + + + +// ----------------------------------------------------------------------------- +// HOW TO EXPORT CSTDSTRING FROM A DLL +// +// If you want to export CStdStringA and CStdStringW from a DLL, then all you +// need to +// 1. make sure that all components link to the same DLL version +// of the CRT (not the static one). +// 2. Uncomment the 3 lines of code below +// 3. #define 2 macros per the instructions in MS KnowledgeBase +// article Q168958. The macros are: +// +// MACRO DEFINTION WHEN EXPORTING DEFINITION WHEN IMPORTING +// ----- ------------------------ ------------------------- +// SSDLLEXP (nothing, just #define it) extern +// SSDLLSPEC __declspec(dllexport) __declspec(dllimport) +// +// Note that these macros must be available to ALL clients who want to +// link to the DLL and use the class. If they +// ----------------------------------------------------------------------------- +//#pragma warning(disable:4231) // non-standard extension ("extern template") +// SSDLLEXP template class SSDLLSPEC CStdStr; +// SSDLLEXP template class SSDLLSPEC CStdStr; + + +// ----------------------------------------------------------------------------- +// GLOBAL FUNCTION: WUFormat +// CStdStringA WUFormat(UINT nId, ...); +// CStdStringA WUFormat(PCSTR szFormat, ...); +// +// REMARKS: +// This function allows the caller for format and return a CStdStringA +// object with a single line of code. +// ----------------------------------------------------------------------------- +#ifdef SS_ANSI +#else + inline CStdStringA WUFormatA(UINT nId, ...) + { + va_list argList; + va_start(argList, nId); + + CStdStringA strFmt; + CStdStringA strOut; + if ( strFmt.Load(nId) ) + strOut.FormatV(strFmt, argList); + + va_end(argList); + return strOut; + } + inline CStdStringA WUFormatA(PCSTR szFormat, ...) + { + va_list argList; + va_start(argList, szFormat); + CStdStringA strOut; + strOut.FormatV(szFormat, argList); + va_end(argList); + return strOut; + } + + inline CStdStringW WUFormatW(UINT nId, ...) + { + va_list argList; + va_start(argList, nId); + + CStdStringW strFmt; + CStdStringW strOut; + if ( strFmt.Load(nId) ) + strOut.FormatV(strFmt, argList); + + va_end(argList); + return strOut; + } + inline CStdStringW WUFormatW(PCWSTR szwFormat, ...) + { + va_list argList; + va_start(argList, szwFormat); + CStdStringW strOut; + strOut.FormatV(szwFormat, argList); + va_end(argList); + return strOut; + } +#endif // #ifdef SS_ANSI + +#ifdef SS_ANSI +#else + // ------------------------------------------------------------------------- + // FUNCTION: WUSysMessage + // CStdStringA WUSysMessageA(DWORD dwError, DWORD dwLangId=SS_DEFLANGID); + // CStdStringW WUSysMessageW(DWORD dwError, DWORD dwLangId=SS_DEFLANGID); + // + // DESCRIPTION: + // This function simplifies the process of obtaining a string equivalent + // of a system error code returned from GetLastError(). You simply + // supply the value returned by GetLastError() to this function and the + // corresponding system string is returned in the form of a CStdStringA. + // + // PARAMETERS: + // dwError - a DWORD value representing the error code to be translated + // dwLangId - the language id to use. defaults to english. + // + // RETURN VALUE: + // a CStdStringA equivalent of the error code. Currently, this function + // only returns either English of the system default language strings. + // ------------------------------------------------------------------------- + #define SS_DEFLANGID MAKELANGID(LANG_NEUTRAL,SUBLANG_DEFAULT) + inline CStdStringA WUSysMessageA(DWORD dwError, DWORD dwLangId=SS_DEFLANGID) + { + CHAR szBuf[512]; + + if ( 0 != ::FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, NULL, dwError, + dwLangId, szBuf, 511, NULL) ) + return WUFormatA("%s (0x%X)", szBuf, dwError); + else + return WUFormatA("Unknown error (0x%X)", dwError); + } + inline CStdStringW WUSysMessageW(DWORD dwError, DWORD dwLangId=SS_DEFLANGID) + { + WCHAR szBuf[512]; + + if ( 0 != ::FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM, NULL, dwError, + dwLangId, szBuf, 511, NULL) ) + return WUFormatW(L"%s (0x%X)", szBuf, dwError); + else + return WUFormatW(L"Unknown error (0x%X)", dwError); + } +#endif + +// Define TCHAR based friendly names for some of these functions + +#ifdef UNICODE + #define CStdString CStdStringW + #define WUSysMessage WUSysMessageW + #define WUFormat WUFormatW +#else + #define CStdString CStdStringA + #define WUSysMessage WUSysMessageA + #define WUFormat WUFormatA +#endif + +// ...and some shorter names for the space-efficient + +#define WUSysMsg WUSysMessage +#define WUSysMsgA WUSysMessageA +#define WUSysMsgW WUSysMessageW +#define WUFmtA WUFormatA +#define WUFmtW WUFormatW +#define WUFmt WUFormat +#define WULastErrMsg() WUSysMessage(::GetLastError()) +#define WULastErrMsgA() WUSysMessageA(::GetLastError()) +#define WULastErrMsgW() WUSysMessageW(::GetLastError()) + + +// ----------------------------------------------------------------------------- +// FUNCTIONAL COMPARATORS: +// REMARKS: +// These structs are derived from the std::binary_function template. They +// give us functional classes (which may be used in Standard C++ Library +// collections and algorithms) that perform case-insensitive comparisons of +// CStdString objects. This is useful for maps in which the key may be the +// proper string but in the wrong case. +// ----------------------------------------------------------------------------- +#define StdStringLessNoCaseW SSLNCW // avoid VC compiler warning 4786 +#define StdStringEqualsNoCaseW SSENCW +#define StdStringLessNoCaseA SSLNCA +#define StdStringEqualsNoCaseA SSENCA + +#ifdef UNICODE + #define StdStringLessNoCase SSLNCW + #define StdStringEqualsNoCase SSENCW +#else + #define StdStringLessNoCase SSLNCA + #define StdStringEqualsNoCase SSENCA +#endif + +struct StdStringLessNoCaseW + : std::binary_function +{ + inline + bool operator()(const CStdStringW& sLeft, const CStdStringW& sRight) const + { return ssicmp(sLeft.c_str(), sRight.c_str()) < 0; } +}; +struct StdStringEqualsNoCaseW + : std::binary_function +{ + inline + bool operator()(const CStdStringW& sLeft, const CStdStringW& sRight) const + { return ssicmp(sLeft.c_str(), sRight.c_str()) == 0; } +}; +struct StdStringLessNoCaseA + : std::binary_function +{ + inline + bool operator()(const CStdStringA& sLeft, const CStdStringA& sRight) const + { return ssicmp(sLeft.c_str(), sRight.c_str()) < 0; } +}; +struct StdStringEqualsNoCaseA + : std::binary_function +{ + inline + bool operator()(const CStdStringA& sLeft, const CStdStringA& sRight) const + { return ssicmp(sLeft.c_str(), sRight.c_str()) == 0; } +}; + +// If we had to define our own version of TRACE above, get rid of it now + +#ifdef TRACE_DEFINED_HERE + #undef TRACE + #undef TRACE_DEFINED_HERE +#endif + + +#endif // #ifndef STDSTRING_H \ No newline at end of file diff --git a/Libraries/MAC/Files/Source/Shared/Unicows.cpp b/Libraries/MAC/Files/Source/Shared/Unicows.cpp new file mode 100755 index 000000000..29d0874a8 --- /dev/null +++ b/Libraries/MAC/Files/Source/Shared/Unicows.cpp @@ -0,0 +1,18 @@ +#include + +HMODULE LoadUnicowsProc(void) +{ + HMODULE hModule = LoadLibraryA("unicows.dll"); + if (hModule == NULL) + { + MessageBoxA(NULL, "The Microsoft Layer for Unicode failed to initialize. Please re-install.", "Unicode Failure", MB_OK | MB_ICONERROR); + _exit(-1); + } + + return hModule; +} + +extern "C" +{ + extern FARPROC _PfnLoadUnicows = (FARPROC) &LoadUnicowsProc; +} diff --git a/Libraries/MAC/Files/Source/Shared/WAVInfoDialog.cpp b/Libraries/MAC/Files/Source/Shared/WAVInfoDialog.cpp new file mode 100755 index 000000000..01aea36b5 --- /dev/null +++ b/Libraries/MAC/Files/Source/Shared/WAVInfoDialog.cpp @@ -0,0 +1,156 @@ +#include +#include "All.h" + +#include "WAVInfoDialog.h" +#include "WAVInputSource.h" +#include "CharacterHelper.h" + +/*************************************************************************************** +The dialog component ID's +***************************************************************************************/ +#define FILE_NAME_STATIC 1000 + +#define FILE_SIZE_STATIC 2000 +#define TRACK_LENGTH_STATIC 2001 +#define AUDIO_BYTES_STATIC 2002 +#define HEADER_BYTES_STATIC 2003 +#define TERMINATING_BYTES_STATIC 2004 + +#define SAMPLE_RATE_STATIC 3000 +#define CHANNELS_STATIC 3001 +#define BITS_PER_SAMPLE_STATIC 3002 + +#define OK_BUTTON 4000 + +/*************************************************************************************** +Global pointer to this instance +***************************************************************************************/ +CWAVInfoDialog * g_pWAVInfoDialog; + + +/*************************************************************************************** +Construction / destruction +***************************************************************************************/ +CWAVInfoDialog::CWAVInfoDialog() +{ + g_pWAVInfoDialog = NULL; +} + +CWAVInfoDialog::~CWAVInfoDialog() +{ + +} + +/*************************************************************************************** +Display the file info dialog +***************************************************************************************/ +long CWAVInfoDialog::ShowWAVInfoDialog(const str_utf16 * pFilename, HINSTANCE hInstance, const str_utf16 * lpTemplateName, HWND hWndParent) +{ + //only allow one instance at a time + if (g_pWAVInfoDialog != NULL) + { + return -1; + } + + _tcscpy(m_cFileName, pFilename); + g_pWAVInfoDialog = this; + + DialogBoxParam(hInstance, lpTemplateName, hWndParent, (DLGPROC) DialogProc, 0); + + g_pWAVInfoDialog = NULL; + return 0; +} + +/*************************************************************************************** +Initialize the dialog +***************************************************************************************/ +long CWAVInfoDialog::InitDialog(HWND hDlg) +{ + // analyze the WAV + WAVEFORMATEX wfeWAV; + int nTotalBlocks = 0; + int nHeaderBytes = 0; + int nTerminatingBytes = 0; + int nErrorCode = 0; + + CWAVInputSource WAVInfo(m_cFileName, &wfeWAV, &nTotalBlocks, &nHeaderBytes, &nTerminatingBytes, &nErrorCode); + if (nErrorCode != 0) + return nErrorCode; + + int nAudioBytes = nTotalBlocks * wfeWAV.nBlockAlign; + + // set info + TCHAR cTemp[1024] = { 0 }; + + SetDlgItemText(hDlg, FILE_NAME_STATIC, m_cFileName); + + _stprintf(cTemp, _T("Sample Rate: %d"), wfeWAV.nSamplesPerSec); + SetDlgItemText(hDlg, SAMPLE_RATE_STATIC, cTemp); + + _stprintf(cTemp, _T("Channels: %d"), wfeWAV.nChannels); + SetDlgItemText(hDlg, CHANNELS_STATIC, cTemp); + + _stprintf(cTemp, _T("Bits Per Sample: %d"), int(wfeWAV.wBitsPerSample)); + SetDlgItemText(hDlg, BITS_PER_SAMPLE_STATIC, cTemp); + + int nSeconds = nAudioBytes / wfeWAV.nAvgBytesPerSec; int nMinutes = nSeconds / 60; nSeconds = nSeconds % 60; int nHours = nMinutes / 60; nMinutes = nMinutes % 60; + if (nHours > 0) _stprintf(cTemp, _T("Length: %d:%02d:%02d"), nHours, nMinutes, nSeconds); + else if (nMinutes > 0) _stprintf(cTemp, _T("Length: %d:%02d"), nMinutes, nSeconds); + else _stprintf(cTemp, _T("Length: 0:%02d"), nSeconds); + SetDlgItemText(hDlg, TRACK_LENGTH_STATIC, cTemp); + + _stprintf(cTemp, _T("Audio Bytes: %d"), nAudioBytes); + SetDlgItemText(hDlg, AUDIO_BYTES_STATIC, cTemp); + + _stprintf(cTemp, _T("Header Bytes: %d"), nHeaderBytes); + SetDlgItemText(hDlg, HEADER_BYTES_STATIC, cTemp); + + _stprintf(cTemp, _T("Terminating Bytes: %d"), nTerminatingBytes); + SetDlgItemText(hDlg, TERMINATING_BYTES_STATIC, cTemp); + + _stprintf(cTemp, _T("File Size: %.2f MB"), float(nAudioBytes + nHeaderBytes + nTerminatingBytes) / float(1024 * 1024)); + SetDlgItemText(hDlg, FILE_SIZE_STATIC, cTemp); + + return 0; +} + +/*************************************************************************************** +The dialog procedure +***************************************************************************************/ +LRESULT CALLBACK CWAVInfoDialog::DialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) +{ + int wmID, wmEvent; + long RetVal; + + switch (message) + { + case WM_INITDIALOG: + //fill in the info on initialization + RetVal = g_pWAVInfoDialog->InitDialog(hDlg); + return TRUE; + break; + case WM_COMMAND: + wmID = LOWORD(wParam); + wmEvent = HIWORD(wParam); + switch (wmID) + { + case IDCANCEL: //traps the [esc] key + EndDialog(hDlg, 0); + return TRUE; + break; + case OK_BUTTON: + EndDialog(hDlg, 0); + return TRUE; + break; + } + break; + case WM_CLOSE: + EndDialog(hDlg, 0); + return TRUE; + break; + } + + return FALSE; +} + + diff --git a/Libraries/MAC/Files/Source/Shared/WAVInfoDialog.h b/Libraries/MAC/Files/Source/Shared/WAVInfoDialog.h new file mode 100755 index 000000000..77042e427 --- /dev/null +++ b/Libraries/MAC/Files/Source/Shared/WAVInfoDialog.h @@ -0,0 +1,22 @@ +#ifndef APE_WAVINFODIALOG_H +#define APE_WAVINFODIALOG_H + +BOOL CALLBACK FileInfoDialogProcedureA(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); + +class CWAVInfoDialog +{ +public: + + CWAVInfoDialog(); + ~CWAVInfoDialog(); + + long ShowWAVInfoDialog(const str_utf16 * pFilename, HINSTANCE hInstance, const str_utf16 * lpTemplateName, HWND hWndParent); + +private: + + static LRESULT CALLBACK DialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); + long InitDialog(HWND hDlg); + TCHAR m_cFileName[MAX_PATH]; +}; + +#endif // #ifndef APE_WAVINFODIALOG_H diff --git a/Libraries/MAC/Files/Source/Shared/WinFileIO.cpp b/Libraries/MAC/Files/Source/Shared/WinFileIO.cpp new file mode 100755 index 000000000..d07c2f5f5 --- /dev/null +++ b/Libraries/MAC/Files/Source/Shared/WinFileIO.cpp @@ -0,0 +1,162 @@ +#include "All.h" + +#ifdef IO_USE_WIN_FILE_IO + +#include "WinFileIO.h" +#include +#include "CharacterHelper.h" + +CWinFileIO::CWinFileIO() +{ + m_hFile = INVALID_HANDLE_VALUE; + memset(m_cFileName, 0, MAX_PATH); + m_bReadOnly = FALSE; +} + +CWinFileIO::~CWinFileIO() +{ + Close(); +} + +int CWinFileIO::Open(const wchar_t * pName) +{ + Close(); + + #ifdef _UNICODE + CSmartPtr spName((wchar_t *) pName, TRUE, FALSE); + #else + CSmartPtr spName(GetANSIFromUTF16(pName), TRUE); + #endif + + m_hFile = ::CreateFile(spName, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + if (m_hFile == INVALID_HANDLE_VALUE) + { + m_hFile = ::CreateFile(spName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + if (m_hFile == INVALID_HANDLE_VALUE) + { + return -1; + } + else + { + m_bReadOnly = TRUE; + } + } + else + { + m_bReadOnly = FALSE; + } + + wcscpy(m_cFileName, pName); + + return 0; +} + +int CWinFileIO::Close() +{ + SAFE_FILE_CLOSE(m_hFile); + + return 0; +} + +int CWinFileIO::Read(void * pBuffer, unsigned int nBytesToRead, unsigned int * pBytesRead) +{ + unsigned int nTotalBytesRead = 0; + int nBytesLeft = nBytesToRead; + BOOL bRetVal = TRUE; + unsigned char * pucBuffer = (unsigned char *) pBuffer; + + *pBytesRead = 1; + while ((nBytesLeft > 0) && (*pBytesRead > 0) && bRetVal) + { + bRetVal = ::ReadFile(m_hFile, &pucBuffer[nBytesToRead - nBytesLeft], nBytesLeft, (unsigned long *) pBytesRead, NULL); + if (bRetVal == TRUE) + { + nBytesLeft -= *pBytesRead; + nTotalBytesRead += *pBytesRead; + } + } + + *pBytesRead = nTotalBytesRead; + + return (bRetVal == FALSE) ? ERROR_IO_READ : 0; +} + +int CWinFileIO::Write(const void * pBuffer, unsigned int nBytesToWrite, unsigned int * pBytesWritten) +{ + BOOL bRetVal = WriteFile(m_hFile, pBuffer, nBytesToWrite, (unsigned long *) pBytesWritten, NULL); + + if ((bRetVal == 0) || (*pBytesWritten != nBytesToWrite)) + return ERROR_IO_WRITE; + else + return 0; +} + +int CWinFileIO::Seek(int nDistance, unsigned int nMoveMode) +{ + SetFilePointer(m_hFile, nDistance, NULL, nMoveMode); + return 0; +} + +int CWinFileIO::SetEOF() +{ + BOOL bRetVal = SetEndOfFile(m_hFile); + if (bRetVal == FALSE) + { + return -1; + } + else + { + return 0; + } +} + +int CWinFileIO::GetPosition() +{ + return SetFilePointer(m_hFile, 0, NULL, FILE_CURRENT); +} + +int CWinFileIO::GetSize() +{ + return GetFileSize(m_hFile, NULL); +} + +int CWinFileIO::GetName(wchar_t * pBuffer) +{ + wcscpy(pBuffer, m_cFileName); + return 0; +} + +int CWinFileIO::Create(const wchar_t * pName) +{ + Close(); + + #ifdef _UNICODE + CSmartPtr spName((wchar_t *) pName, TRUE, FALSE); + #else + CSmartPtr spName(GetANSIFromUTF16(pName), TRUE); + #endif + + m_hFile = CreateFile(spName, GENERIC_WRITE | GENERIC_READ, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + if (m_hFile == INVALID_HANDLE_VALUE) { return -1; } + + m_bReadOnly = FALSE; + + wcscpy(m_cFileName, pName); + + return 0; +} + +int CWinFileIO::Delete() +{ + Close(); + + #ifdef _UNICODE + CSmartPtr spName(m_cFileName, TRUE, FALSE); + #else + CSmartPtr spName(GetANSIFromUTF16(m_cFileName), TRUE); + #endif + + return DeleteFile(spName) ? 0 : -1; +} + +#endif // #ifdef IO_USE_WIN_FILE_IO diff --git a/Libraries/MAC/Files/Source/Shared/WinFileIO.h b/Libraries/MAC/Files/Source/Shared/WinFileIO.h new file mode 100755 index 000000000..dc85a3d7f --- /dev/null +++ b/Libraries/MAC/Files/Source/Shared/WinFileIO.h @@ -0,0 +1,49 @@ +#ifdef IO_USE_WIN_FILE_IO + +#ifndef _winfileio_h_ +#define _winfileio_h_ + +#include "IO.h" + +class CWinFileIO : public CIO +{ +public: + + // construction / destruction + CWinFileIO(); + ~CWinFileIO(); + + // open / close + int Open(const wchar_t * pName); + int Close(); + + // read / write + int Read(void * pBuffer, unsigned int nBytesToRead, unsigned int * pBytesRead); + int Write(const void * pBuffer, unsigned int nBytesToWrite, unsigned int * pBytesWritten); + + // seek + int Seek(int nDistance, unsigned int nMoveMode); + + // other functions + int SetEOF(); + + // creation / destruction + int Create(const wchar_t * pName); + int Delete(); + + // attributes + int GetPosition(); + int GetSize(); + int GetName(wchar_t * pBuffer); + +private: + + HANDLE m_hFile; + wchar_t m_cFileName[MAX_PATH]; + BOOL m_bReadOnly; +}; + + +#endif //_winfileio_h_ + +#endif //IO_USE_WIN_FILE_IO \ No newline at end of file diff --git a/Libraries/MAC/Info.plist b/Libraries/MAC/Info.plist new file mode 100644 index 000000000..efe12b202 --- /dev/null +++ b/Libraries/MAC/Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + MAC + CFBundleIconFile + + CFBundleIdentifier + com.apple.carbonframeworktemplate + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + FMWK + CFBundleSignature + ???? + CFBundleVersion + 1.0 + CFBundleShortVersionString + 1.0 + CSResourcesFileMapped + + + diff --git a/Libraries/MAC/MAC.xcode/project.pbxproj b/Libraries/MAC/MAC.xcode/project.pbxproj new file mode 100644 index 000000000..5d39f9e94 --- /dev/null +++ b/Libraries/MAC/MAC.xcode/project.pbxproj @@ -0,0 +1,1312 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 39; + objects = { + 034768DDFF38A45A11DB9C8B = { + children = ( + 8D07F2C80486CC7A007CD1D0, + ); + isa = PBXGroup; + name = Products; + refType = 4; + sourceTree = ""; + }; +//030 +//031 +//032 +//033 +//034 +//080 +//081 +//082 +//083 +//084 + 0867D690FE84028FC02AAC07 = { + buildSettings = { + }; + buildStyles = ( + 4F0BB7EC011F40E904CA0E50, + 4F0BB7ED011F40E904CA0E50, + ); + hasScannedForEncodings = 1; + isa = PBXProject; + mainGroup = 0867D691FE84028FC02AAC07; + productRefGroup = 034768DDFF38A45A11DB9C8B; + projectDirPath = ""; + targets = ( + 8D07F2BC0486CC7A007CD1D0, + ); + }; + 0867D691FE84028FC02AAC07 = { + children = ( + 8E6577FA084F5CB600F28C07, + 08FB77ACFE841707C02AAC07, + 089C1665FE841158C02AAC07, + 0867D69AFE84028FC02AAC07, + 034768DDFF38A45A11DB9C8B, + ); + isa = PBXGroup; + name = MAC; + refType = 4; + sourceTree = ""; + }; + 0867D69AFE84028FC02AAC07 = { + children = ( + ); + isa = PBXGroup; + name = "External Frameworks and Libraries"; + refType = 4; + sourceTree = ""; + }; + 089C1665FE841158C02AAC07 = { + children = ( + 8D07F2C70486CC7A007CD1D0, + 089C1666FE841158C02AAC07, + ); + isa = PBXGroup; + name = Resources; + refType = 4; + sourceTree = ""; + }; + 089C1666FE841158C02AAC07 = { + children = ( + 089C1667FE841158C02AAC07, + ); + isa = PBXVariantGroup; + name = InfoPlist.strings; + refType = 4; + sourceTree = ""; + }; + 089C1667FE841158C02AAC07 = { + fileEncoding = 10; + isa = PBXFileReference; + lastKnownFileType = text.plist.strings; + name = English; + path = English.lproj/InfoPlist.strings; + refType = 4; + sourceTree = ""; + }; + 08FB77ACFE841707C02AAC07 = { + children = ( + 8EEBC77E084F5B1B009FE5BE, + 8EEBC77F084F5B1B009FE5BE, + 8EEBC780084F5B1B009FE5BE, + 8EEBC781084F5B1B009FE5BE, + 8EEBC758084F5AF9009FE5BE, + 8EEBC759084F5AF9009FE5BE, + 8EEBC75A084F5AF9009FE5BE, + 8EEBC75B084F5AF9009FE5BE, + 8EEBC75C084F5AF9009FE5BE, + 8EEBC75D084F5AF9009FE5BE, + 8EEBC75E084F5AF9009FE5BE, + 8EEBC75F084F5AF9009FE5BE, + 8EEBC760084F5AF9009FE5BE, + 8EEBC761084F5AF9009FE5BE, + 8EEBC762084F5AF9009FE5BE, + 8EEBC763084F5AF9009FE5BE, + 8EEBC764084F5AF9009FE5BE, + 8EEBC765084F5AF9009FE5BE, + 8EEBC766084F5AF9009FE5BE, + 8EEBC767084F5AF9009FE5BE, + 8EEBC768084F5AF9009FE5BE, + 8EEBC769084F5AF9009FE5BE, + 8EEBC76A084F5AF9009FE5BE, + ); + isa = PBXGroup; + name = Source; + refType = 4; + sourceTree = ""; + }; +//080 +//081 +//082 +//083 +//084 +//4F0 +//4F1 +//4F2 +//4F3 +//4F4 + 4F0BB7EC011F40E904CA0E50 = { + buildSettings = { + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_GENERATE_DEBUGGING_SYMBOLS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + ZERO_LINK = YES; + }; + isa = PBXBuildStyle; + name = Development; + }; + 4F0BB7ED011F40E904CA0E50 = { + buildSettings = { + COPY_PHASE_STRIP = YES; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + ZERO_LINK = NO; + }; + isa = PBXBuildStyle; + name = Deployment; + }; +//4F0 +//4F1 +//4F2 +//4F3 +//4F4 +//8D0 +//8D1 +//8D2 +//8D3 +//8D4 + 8D07F2BC0486CC7A007CD1D0 = { + buildPhases = ( + 8D07F2BD0486CC7A007CD1D0, + 8D07F2BF0486CC7A007CD1D0, + 8D07F2C10486CC7A007CD1D0, + 8D07F2C30486CC7A007CD1D0, + 8D07F2C50486CC7A007CD1D0, + ); + buildRules = ( + 8E35E2E8084B9B9600C8FE72, + 8E35E2E7084B9B8200C8FE72, + ); + buildSettings = { + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + FRAMEWORK_VERSION = A; + GCC_ENABLE_ASM_KEYWORD = YES; + GCC_ENABLE_PASCAL_STRINGS = YES; + GCC_GENERATE_DEBUGGING_SYMBOLS = NO; + GCC_OPTIMIZATION_LEVEL = 3; + GCC_PRECOMPILE_PREFIX_HEADER = NO; + GCC_PREFIX_HEADER = ""; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "@executable_path/../Frameworks"; + LIBRARY_STYLE = DYNAMIC; + OTHER_CFLAGS = "-maltivec -faltivec"; + OTHER_LDFLAGS = "-Wl,-read_only_relocs,warning"; + PREBINDING = YES; + PRODUCT_NAME = MAC; + WRAPPER_EXTENSION = framework; + }; + dependencies = ( + ); + isa = PBXNativeTarget; + name = MAC; + productInstallPath = "$(HOME)/Library/Frameworks"; + productName = MAC; + productReference = 8D07F2C80486CC7A007CD1D0; + productType = "com.apple.product-type.framework"; + }; + 8D07F2BD0486CC7A007CD1D0 = { + buildActionMask = 2147483647; + files = ( + 8ED1CB70084F616500771E1E, + 8ED1CB71084F616500771E1E, + 8ED1CB72084F616500771E1E, + 8ED1CB73084F616500771E1E, + 8ED1CB74084F616500771E1E, + 8ED1CB75084F616500771E1E, + 8ED1CB76084F616500771E1E, + 8ED1CB77084F616500771E1E, + 8ED1CB78084F616500771E1E, + 8ED1CB79084F616500771E1E, + 8ED1CB7A084F616500771E1E, + 8ED1CB7B084F616500771E1E, + 8ED1CB7C084F616500771E1E, + 8ED1CB7D084F616500771E1E, + 8ED1CB7E084F616500771E1E, + 8ED1CB7F084F616500771E1E, + 8ED1CB80084F616500771E1E, + 8ED1CB81084F616500771E1E, + 8ED1CB82084F616500771E1E, + 8ED1CB83084F616500771E1E, + 8ED1CB84084F616500771E1E, + 8ED1CB85084F616500771E1E, + 8ED1CB86084F616500771E1E, + 8ED1CB87084F616500771E1E, + 8ED1CB88084F616500771E1E, + 8ED1CB89084F616500771E1E, + 8ED1CB8A084F616500771E1E, + 8ED1CB8B084F616500771E1E, + 8ED1CB8C084F616500771E1E, + 8ED1CB8D084F616500771E1E, + 8ED1CB8E084F616500771E1E, + 8ED1CB8F084F616500771E1E, + 8ED1CB90084F616500771E1E, + 8ED1CB91084F616500771E1E, + 8ED1CB92084F616500771E1E, + 8ED1CB93084F616500771E1E, + 8ED1CB94084F616500771E1E, + 8ED1CB95084F616500771E1E, + ); + isa = PBXHeadersBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 8D07F2BF0486CC7A007CD1D0 = { + buildActionMask = 2147483647; + files = ( + 8D07F2C00486CC7A007CD1D0, + ); + isa = PBXResourcesBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 8D07F2C00486CC7A007CD1D0 = { + fileRef = 089C1666FE841158C02AAC07; + isa = PBXBuildFile; + settings = { + }; + }; + 8D07F2C10486CC7A007CD1D0 = { + buildActionMask = 2147483647; + files = ( + 8EEBC76B084F5AF9009FE5BE, + 8EEBC76C084F5AF9009FE5BE, + 8EEBC76D084F5AF9009FE5BE, + 8EEBC76E084F5AF9009FE5BE, + 8EEBC76F084F5AF9009FE5BE, + 8EEBC770084F5AF9009FE5BE, + 8EEBC771084F5AF9009FE5BE, + 8EEBC772084F5AF9009FE5BE, + 8EEBC773084F5AF9009FE5BE, + 8EEBC774084F5AF9009FE5BE, + 8EEBC775084F5AF9009FE5BE, + 8EEBC776084F5AF9009FE5BE, + 8EEBC777084F5AF9009FE5BE, + 8EEBC778084F5AF9009FE5BE, + 8EEBC779084F5AF9009FE5BE, + 8EEBC77A084F5AF9009FE5BE, + 8EEBC77B084F5AF9009FE5BE, + 8EEBC77C084F5AF9009FE5BE, + 8EEBC77D084F5AF9009FE5BE, + 8EEBC782084F5B1B009FE5BE, + 8EEBC783084F5B1B009FE5BE, + 8EEBC784084F5B1B009FE5BE, + 8EEBC785084F5B1B009FE5BE, + ); + isa = PBXSourcesBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 8D07F2C30486CC7A007CD1D0 = { + buildActionMask = 2147483647; + files = ( + ); + isa = PBXFrameworksBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 8D07F2C50486CC7A007CD1D0 = { + buildActionMask = 2147483647; + files = ( + ); + isa = PBXRezBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 8D07F2C70486CC7A007CD1D0 = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = text.plist; + path = Info.plist; + refType = 4; + sourceTree = ""; + }; + 8D07F2C80486CC7A007CD1D0 = { + explicitFileType = wrapper.framework; + includeInIndex = 0; + isa = PBXFileReference; + path = MAC.framework; + refType = 3; + sourceTree = BUILT_PRODUCTS_DIR; + }; +//8D0 +//8D1 +//8D2 +//8D3 +//8D4 +//8E0 +//8E1 +//8E2 +//8E3 +//8E4 + 8E35E2E7084B9B8200C8FE72 = { + compilerSpec = com.apple.compilers.gcc.3_3; + fileType = sourcecode.c; + isEditable = 1; + isa = PBXBuildRule; + outputFiles = ( + ); + }; + 8E35E2E8084B9B9600C8FE72 = { + compilerSpec = com.apple.compilers.gcc.3_3; + fileType = sourcecode.asm; + isEditable = 1; + isa = PBXBuildRule; + outputFiles = ( + ); + }; + 8E6577FA084F5CB600F28C07 = { + children = ( + 8EEBC7C4084F5BB3009FE5BE, + 8EEBC7C5084F5BB3009FE5BE, + 8EEBC7C6084F5BB3009FE5BE, + 8EEBC7C7084F5BB3009FE5BE, + 8EEBC7C8084F5BB3009FE5BE, + 8EEBC7C9084F5BB3009FE5BE, + 8EEBC7CA084F5BB3009FE5BE, + 8EEBC7CB084F5BB3009FE5BE, + 8EEBC7CC084F5BB3009FE5BE, + 8EEBC7CD084F5BB3009FE5BE, + 8EEBC7CE084F5BB3009FE5BE, + 8EEBC792084F5B65009FE5BE, + 8EEBC793084F5B65009FE5BE, + 8EEBC794084F5B65009FE5BE, + 8EEBC795084F5B65009FE5BE, + 8EEBC796084F5B65009FE5BE, + 8EEBC797084F5B65009FE5BE, + 8EEBC798084F5B65009FE5BE, + 8EEBC799084F5B65009FE5BE, + 8EEBC79A084F5B65009FE5BE, + 8EEBC79B084F5B65009FE5BE, + 8EEBC79C084F5B65009FE5BE, + 8EEBC79D084F5B65009FE5BE, + 8EEBC79E084F5B65009FE5BE, + 8EEBC79F084F5B65009FE5BE, + 8EEBC7A0084F5B65009FE5BE, + 8EEBC7A1084F5B65009FE5BE, + 8EEBC7A2084F5B65009FE5BE, + 8EEBC7A3084F5B65009FE5BE, + 8EEBC7A4084F5B65009FE5BE, + 8EEBC7A5084F5B65009FE5BE, + 8EEBC7A6084F5B65009FE5BE, + 8EEBC7A7084F5B65009FE5BE, + 8EEBC787084F5B30009FE5BE, + 8EEBC788084F5B30009FE5BE, + 8EEBC789084F5B30009FE5BE, + 8EEBC78A084F5B30009FE5BE, + 8EEBC78B084F5B30009FE5BE, + ); + isa = PBXGroup; + name = Headers; + refType = 4; + sourceTree = ""; + }; + 8ED1CB70084F616500771E1E = { + fileRef = 8EEBC7C4084F5BB3009FE5BE; + isa = PBXBuildFile; + settings = { + }; + }; + 8ED1CB71084F616500771E1E = { + fileRef = 8EEBC7C5084F5BB3009FE5BE; + isa = PBXBuildFile; + settings = { + }; + }; + 8ED1CB72084F616500771E1E = { + fileRef = 8EEBC7C6084F5BB3009FE5BE; + isa = PBXBuildFile; + settings = { + }; + }; + 8ED1CB73084F616500771E1E = { + fileRef = 8EEBC7C7084F5BB3009FE5BE; + isa = PBXBuildFile; + settings = { + }; + }; + 8ED1CB74084F616500771E1E = { + fileRef = 8EEBC7C8084F5BB3009FE5BE; + isa = PBXBuildFile; + settings = { + }; + }; + 8ED1CB75084F616500771E1E = { + fileRef = 8EEBC7C9084F5BB3009FE5BE; + isa = PBXBuildFile; + settings = { + }; + }; + 8ED1CB76084F616500771E1E = { + fileRef = 8EEBC7CA084F5BB3009FE5BE; + isa = PBXBuildFile; + settings = { + }; + }; + 8ED1CB77084F616500771E1E = { + fileRef = 8EEBC7CB084F5BB3009FE5BE; + isa = PBXBuildFile; + settings = { + }; + }; + 8ED1CB78084F616500771E1E = { + fileRef = 8EEBC7CC084F5BB3009FE5BE; + isa = PBXBuildFile; + settings = { + }; + }; + 8ED1CB79084F616500771E1E = { + fileRef = 8EEBC7CD084F5BB3009FE5BE; + isa = PBXBuildFile; + settings = { + }; + }; + 8ED1CB7A084F616500771E1E = { + fileRef = 8EEBC7CE084F5BB3009FE5BE; + isa = PBXBuildFile; + settings = { + }; + }; + 8ED1CB7B084F616500771E1E = { + fileRef = 8EEBC792084F5B65009FE5BE; + isa = PBXBuildFile; + settings = { + }; + }; + 8ED1CB7C084F616500771E1E = { + fileRef = 8EEBC793084F5B65009FE5BE; + isa = PBXBuildFile; + settings = { + }; + }; + 8ED1CB7D084F616500771E1E = { + fileRef = 8EEBC794084F5B65009FE5BE; + isa = PBXBuildFile; + settings = { + }; + }; + 8ED1CB7E084F616500771E1E = { + fileRef = 8EEBC795084F5B65009FE5BE; + isa = PBXBuildFile; + settings = { + }; + }; + 8ED1CB7F084F616500771E1E = { + fileRef = 8EEBC796084F5B65009FE5BE; + isa = PBXBuildFile; + settings = { + }; + }; + 8ED1CB80084F616500771E1E = { + fileRef = 8EEBC797084F5B65009FE5BE; + isa = PBXBuildFile; + settings = { + }; + }; + 8ED1CB81084F616500771E1E = { + fileRef = 8EEBC798084F5B65009FE5BE; + isa = PBXBuildFile; + settings = { + }; + }; + 8ED1CB82084F616500771E1E = { + fileRef = 8EEBC799084F5B65009FE5BE; + isa = PBXBuildFile; + settings = { + }; + }; + 8ED1CB83084F616500771E1E = { + fileRef = 8EEBC79A084F5B65009FE5BE; + isa = PBXBuildFile; + settings = { + }; + }; + 8ED1CB84084F616500771E1E = { + fileRef = 8EEBC79B084F5B65009FE5BE; + isa = PBXBuildFile; + settings = { + }; + }; + 8ED1CB85084F616500771E1E = { + fileRef = 8EEBC79C084F5B65009FE5BE; + isa = PBXBuildFile; + settings = { + }; + }; + 8ED1CB86084F616500771E1E = { + fileRef = 8EEBC79D084F5B65009FE5BE; + isa = PBXBuildFile; + settings = { + }; + }; + 8ED1CB87084F616500771E1E = { + fileRef = 8EEBC79E084F5B65009FE5BE; + isa = PBXBuildFile; + settings = { + }; + }; + 8ED1CB88084F616500771E1E = { + fileRef = 8EEBC79F084F5B65009FE5BE; + isa = PBXBuildFile; + settings = { + }; + }; + 8ED1CB89084F616500771E1E = { + fileRef = 8EEBC7A0084F5B65009FE5BE; + isa = PBXBuildFile; + settings = { + }; + }; + 8ED1CB8A084F616500771E1E = { + fileRef = 8EEBC7A1084F5B65009FE5BE; + isa = PBXBuildFile; + settings = { + }; + }; + 8ED1CB8B084F616500771E1E = { + fileRef = 8EEBC7A2084F5B65009FE5BE; + isa = PBXBuildFile; + settings = { + }; + }; + 8ED1CB8C084F616500771E1E = { + fileRef = 8EEBC7A3084F5B65009FE5BE; + isa = PBXBuildFile; + settings = { + }; + }; + 8ED1CB8D084F616500771E1E = { + fileRef = 8EEBC7A4084F5B65009FE5BE; + isa = PBXBuildFile; + settings = { + }; + }; + 8ED1CB8E084F616500771E1E = { + fileRef = 8EEBC7A5084F5B65009FE5BE; + isa = PBXBuildFile; + settings = { + }; + }; + 8ED1CB8F084F616500771E1E = { + fileRef = 8EEBC7A6084F5B65009FE5BE; + isa = PBXBuildFile; + settings = { + }; + }; + 8ED1CB90084F616500771E1E = { + fileRef = 8EEBC7A7084F5B65009FE5BE; + isa = PBXBuildFile; + settings = { + }; + }; + 8ED1CB91084F616500771E1E = { + fileRef = 8EEBC787084F5B30009FE5BE; + isa = PBXBuildFile; + settings = { + }; + }; + 8ED1CB92084F616500771E1E = { + fileRef = 8EEBC788084F5B30009FE5BE; + isa = PBXBuildFile; + settings = { + }; + }; + 8ED1CB93084F616500771E1E = { + fileRef = 8EEBC789084F5B30009FE5BE; + isa = PBXBuildFile; + settings = { + }; + }; + 8ED1CB94084F616500771E1E = { + fileRef = 8EEBC78A084F5B30009FE5BE; + isa = PBXBuildFile; + settings = { + }; + }; + 8ED1CB95084F616500771E1E = { + fileRef = 8EEBC78B084F5B30009FE5BE; + isa = PBXBuildFile; + settings = { + }; + }; + 8EEBC758084F5AF9009FE5BE = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + name = APECompress.cpp; + path = Files/Source/MACLib/APECompress.cpp; + refType = 4; + sourceTree = ""; + }; + 8EEBC759084F5AF9009FE5BE = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + name = APECompressCore.cpp; + path = Files/Source/MACLib/APECompressCore.cpp; + refType = 4; + sourceTree = ""; + }; + 8EEBC75A084F5AF9009FE5BE = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + name = APECompressCreate.cpp; + path = Files/Source/MACLib/APECompressCreate.cpp; + refType = 4; + sourceTree = ""; + }; + 8EEBC75B084F5AF9009FE5BE = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + name = APEDecompress.cpp; + path = Files/Source/MACLib/APEDecompress.cpp; + refType = 4; + sourceTree = ""; + }; + 8EEBC75C084F5AF9009FE5BE = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + name = APEHeader.cpp; + path = Files/Source/MACLib/APEHeader.cpp; + refType = 4; + sourceTree = ""; + }; + 8EEBC75D084F5AF9009FE5BE = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + name = APEInfo.cpp; + path = Files/Source/MACLib/APEInfo.cpp; + refType = 4; + sourceTree = ""; + }; + 8EEBC75E084F5AF9009FE5BE = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + name = APELink.cpp; + path = Files/Source/MACLib/APELink.cpp; + refType = 4; + sourceTree = ""; + }; + 8EEBC75F084F5AF9009FE5BE = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + name = APESimple.cpp; + path = Files/Source/MACLib/APESimple.cpp; + refType = 4; + sourceTree = ""; + }; + 8EEBC760084F5AF9009FE5BE = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + name = APETag.cpp; + path = Files/Source/MACLib/APETag.cpp; + refType = 4; + sourceTree = ""; + }; + 8EEBC761084F5AF9009FE5BE = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + name = BitArray.cpp; + path = Files/Source/MACLib/BitArray.cpp; + refType = 4; + sourceTree = ""; + }; + 8EEBC762084F5AF9009FE5BE = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + name = MACLib.cpp; + path = Files/Source/MACLib/MACLib.cpp; + refType = 4; + sourceTree = ""; + }; + 8EEBC763084F5AF9009FE5BE = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + name = MACProgressHelper.cpp; + path = Files/Source/MACLib/MACProgressHelper.cpp; + refType = 4; + sourceTree = ""; + }; + 8EEBC764084F5AF9009FE5BE = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + name = MD5.cpp; + path = Files/Source/MACLib/MD5.cpp; + refType = 4; + sourceTree = ""; + }; + 8EEBC765084F5AF9009FE5BE = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + name = NewPredictor.cpp; + path = Files/Source/MACLib/NewPredictor.cpp; + refType = 4; + sourceTree = ""; + }; + 8EEBC766084F5AF9009FE5BE = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + name = NNFilter.cpp; + path = Files/Source/MACLib/NNFilter.cpp; + refType = 4; + sourceTree = ""; + }; + 8EEBC767084F5AF9009FE5BE = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + name = Prepare.cpp; + path = Files/Source/MACLib/Prepare.cpp; + refType = 4; + sourceTree = ""; + }; + 8EEBC768084F5AF9009FE5BE = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + name = UnBitArray.cpp; + path = Files/Source/MACLib/UnBitArray.cpp; + refType = 4; + sourceTree = ""; + }; + 8EEBC769084F5AF9009FE5BE = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + name = UnBitArrayBase.cpp; + path = Files/Source/MACLib/UnBitArrayBase.cpp; + refType = 4; + sourceTree = ""; + }; + 8EEBC76A084F5AF9009FE5BE = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + name = WAVInputSource.cpp; + path = Files/Source/MACLib/WAVInputSource.cpp; + refType = 4; + sourceTree = ""; + }; + 8EEBC76B084F5AF9009FE5BE = { + fileRef = 8EEBC758084F5AF9009FE5BE; + isa = PBXBuildFile; + settings = { + }; + }; + 8EEBC76C084F5AF9009FE5BE = { + fileRef = 8EEBC759084F5AF9009FE5BE; + isa = PBXBuildFile; + settings = { + }; + }; + 8EEBC76D084F5AF9009FE5BE = { + fileRef = 8EEBC75A084F5AF9009FE5BE; + isa = PBXBuildFile; + settings = { + }; + }; + 8EEBC76E084F5AF9009FE5BE = { + fileRef = 8EEBC75B084F5AF9009FE5BE; + isa = PBXBuildFile; + settings = { + }; + }; + 8EEBC76F084F5AF9009FE5BE = { + fileRef = 8EEBC75C084F5AF9009FE5BE; + isa = PBXBuildFile; + settings = { + }; + }; + 8EEBC770084F5AF9009FE5BE = { + fileRef = 8EEBC75D084F5AF9009FE5BE; + isa = PBXBuildFile; + settings = { + }; + }; + 8EEBC771084F5AF9009FE5BE = { + fileRef = 8EEBC75E084F5AF9009FE5BE; + isa = PBXBuildFile; + settings = { + }; + }; + 8EEBC772084F5AF9009FE5BE = { + fileRef = 8EEBC75F084F5AF9009FE5BE; + isa = PBXBuildFile; + settings = { + }; + }; + 8EEBC773084F5AF9009FE5BE = { + fileRef = 8EEBC760084F5AF9009FE5BE; + isa = PBXBuildFile; + settings = { + }; + }; + 8EEBC774084F5AF9009FE5BE = { + fileRef = 8EEBC761084F5AF9009FE5BE; + isa = PBXBuildFile; + settings = { + }; + }; + 8EEBC775084F5AF9009FE5BE = { + fileRef = 8EEBC762084F5AF9009FE5BE; + isa = PBXBuildFile; + settings = { + }; + }; + 8EEBC776084F5AF9009FE5BE = { + fileRef = 8EEBC763084F5AF9009FE5BE; + isa = PBXBuildFile; + settings = { + }; + }; + 8EEBC777084F5AF9009FE5BE = { + fileRef = 8EEBC764084F5AF9009FE5BE; + isa = PBXBuildFile; + settings = { + }; + }; + 8EEBC778084F5AF9009FE5BE = { + fileRef = 8EEBC765084F5AF9009FE5BE; + isa = PBXBuildFile; + settings = { + }; + }; + 8EEBC779084F5AF9009FE5BE = { + fileRef = 8EEBC766084F5AF9009FE5BE; + isa = PBXBuildFile; + settings = { + }; + }; + 8EEBC77A084F5AF9009FE5BE = { + fileRef = 8EEBC767084F5AF9009FE5BE; + isa = PBXBuildFile; + settings = { + }; + }; + 8EEBC77B084F5AF9009FE5BE = { + fileRef = 8EEBC768084F5AF9009FE5BE; + isa = PBXBuildFile; + settings = { + }; + }; + 8EEBC77C084F5AF9009FE5BE = { + fileRef = 8EEBC769084F5AF9009FE5BE; + isa = PBXBuildFile; + settings = { + }; + }; + 8EEBC77D084F5AF9009FE5BE = { + fileRef = 8EEBC76A084F5AF9009FE5BE; + isa = PBXBuildFile; + settings = { + }; + }; + 8EEBC77E084F5B1B009FE5BE = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + name = CharacterHelper.cpp; + path = Files/Source/Shared/CharacterHelper.cpp; + refType = 4; + sourceTree = ""; + }; + 8EEBC77F084F5B1B009FE5BE = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + name = CircleBuffer.cpp; + path = Files/Source/Shared/CircleBuffer.cpp; + refType = 4; + sourceTree = ""; + }; + 8EEBC780084F5B1B009FE5BE = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + name = GlobalFunctions.cpp; + path = Files/Source/Shared/GlobalFunctions.cpp; + refType = 4; + sourceTree = ""; + }; + 8EEBC781084F5B1B009FE5BE = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + name = StdLibFileIO.cpp; + path = Files/Source/Shared/StdLibFileIO.cpp; + refType = 4; + sourceTree = ""; + }; + 8EEBC782084F5B1B009FE5BE = { + fileRef = 8EEBC77E084F5B1B009FE5BE; + isa = PBXBuildFile; + settings = { + }; + }; + 8EEBC783084F5B1B009FE5BE = { + fileRef = 8EEBC77F084F5B1B009FE5BE; + isa = PBXBuildFile; + settings = { + }; + }; + 8EEBC784084F5B1B009FE5BE = { + fileRef = 8EEBC780084F5B1B009FE5BE; + isa = PBXBuildFile; + settings = { + }; + }; + 8EEBC785084F5B1B009FE5BE = { + fileRef = 8EEBC781084F5B1B009FE5BE; + isa = PBXBuildFile; + settings = { + }; + }; + 8EEBC787084F5B30009FE5BE = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = APETag.h; + path = Files/Shared/APETag.h; + refType = 4; + sourceTree = ""; + }; + 8EEBC788084F5B30009FE5BE = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = IO.h; + path = Files/Shared/IO.h; + refType = 4; + sourceTree = ""; + }; + 8EEBC789084F5B30009FE5BE = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = MACDll.h; + path = Files/Shared/MACDll.h; + refType = 4; + sourceTree = ""; + }; + 8EEBC78A084F5B30009FE5BE = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = MACLib.h; + path = Files/Shared/MACLib.h; + refType = 4; + sourceTree = ""; + }; + 8EEBC78B084F5B30009FE5BE = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = SmartPtr.h; + path = Files/Shared/SmartPtr.h; + refType = 4; + sourceTree = ""; + }; + 8EEBC792084F5B65009FE5BE = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = APECompress.h; + path = Files/Source/MACLib/APECompress.h; + refType = 4; + sourceTree = ""; + }; + 8EEBC793084F5B65009FE5BE = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = APECompressCore.h; + path = Files/Source/MACLib/APECompressCore.h; + refType = 4; + sourceTree = ""; + }; + 8EEBC794084F5B65009FE5BE = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = APECompressCreate.h; + path = Files/Source/MACLib/APECompressCreate.h; + refType = 4; + sourceTree = ""; + }; + 8EEBC795084F5B65009FE5BE = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = APEDecompress.h; + path = Files/Source/MACLib/APEDecompress.h; + refType = 4; + sourceTree = ""; + }; + 8EEBC796084F5B65009FE5BE = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = APEHeader.h; + path = Files/Source/MACLib/APEHeader.h; + refType = 4; + sourceTree = ""; + }; + 8EEBC797084F5B65009FE5BE = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = APEInfo.h; + path = Files/Source/MACLib/APEInfo.h; + refType = 4; + sourceTree = ""; + }; + 8EEBC798084F5B65009FE5BE = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = APELink.h; + path = Files/Source/MACLib/APELink.h; + refType = 4; + sourceTree = ""; + }; + 8EEBC799084F5B65009FE5BE = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = APETag.h; + path = Files/Source/MACLib/APETag.h; + refType = 4; + sourceTree = ""; + }; + 8EEBC79A084F5B65009FE5BE = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = BitArray.h; + path = Files/Source/MACLib/BitArray.h; + refType = 4; + sourceTree = ""; + }; + 8EEBC79B084F5B65009FE5BE = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = MACLib.h; + path = Files/Source/MACLib/MACLib.h; + refType = 4; + sourceTree = ""; + }; + 8EEBC79C084F5B65009FE5BE = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = MACProgressHelper.h; + path = Files/Source/MACLib/MACProgressHelper.h; + refType = 4; + sourceTree = ""; + }; + 8EEBC79D084F5B65009FE5BE = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = md5.h; + path = Files/Source/MACLib/md5.h; + refType = 4; + sourceTree = ""; + }; + 8EEBC79E084F5B65009FE5BE = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = MultichannelNNFilter.h; + path = Files/Source/MACLib/MultichannelNNFilter.h; + refType = 4; + sourceTree = ""; + }; + 8EEBC79F084F5B65009FE5BE = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = NewPredictor.h; + path = Files/Source/MACLib/NewPredictor.h; + refType = 4; + sourceTree = ""; + }; + 8EEBC7A0084F5B65009FE5BE = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = NNFilter.h; + path = Files/Source/MACLib/NNFilter.h; + refType = 4; + sourceTree = ""; + }; + 8EEBC7A1084F5B65009FE5BE = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = Predictor.h; + path = Files/Source/MACLib/Predictor.h; + refType = 4; + sourceTree = ""; + }; + 8EEBC7A2084F5B65009FE5BE = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = Prepare.h; + path = Files/Source/MACLib/Prepare.h; + refType = 4; + sourceTree = ""; + }; + 8EEBC7A3084F5B65009FE5BE = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = ScaledFirstOrderFilter.h; + path = Files/Source/MACLib/ScaledFirstOrderFilter.h; + refType = 4; + sourceTree = ""; + }; + 8EEBC7A4084F5B65009FE5BE = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = StartFilter.h; + path = Files/Source/MACLib/StartFilter.h; + refType = 4; + sourceTree = ""; + }; + 8EEBC7A5084F5B65009FE5BE = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = UnBitArray.h; + path = Files/Source/MACLib/UnBitArray.h; + refType = 4; + sourceTree = ""; + }; + 8EEBC7A6084F5B65009FE5BE = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = UnBitArrayBase.h; + path = Files/Source/MACLib/UnBitArrayBase.h; + refType = 4; + sourceTree = ""; + }; + 8EEBC7A7084F5B65009FE5BE = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = WAVInputSource.h; + path = Files/Source/MACLib/WAVInputSource.h; + refType = 4; + sourceTree = ""; + }; + 8EEBC7C4084F5BB3009FE5BE = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = All.h; + path = Files/Source/Shared/All.h; + refType = 4; + sourceTree = ""; + }; + 8EEBC7C5084F5BB3009FE5BE = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = CharacterHelper.h; + path = Files/Source/Shared/CharacterHelper.h; + refType = 4; + sourceTree = ""; + }; + 8EEBC7C6084F5BB3009FE5BE = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = CircleBuffer.h; + path = Files/Source/Shared/CircleBuffer.h; + refType = 4; + sourceTree = ""; + }; + 8EEBC7C7084F5BB3009FE5BE = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = GlobalFunctions.h; + path = Files/Source/Shared/GlobalFunctions.h; + refType = 4; + sourceTree = ""; + }; + 8EEBC7C8084F5BB3009FE5BE = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = ID3Genres.h; + path = Files/Source/Shared/ID3Genres.h; + refType = 4; + sourceTree = ""; + }; + 8EEBC7C9084F5BB3009FE5BE = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = IO.h; + path = Files/Source/Shared/IO.h; + refType = 4; + sourceTree = ""; + }; + 8EEBC7CA084F5BB3009FE5BE = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = NoWindows.h; + path = Files/Source/Shared/NoWindows.h; + refType = 4; + sourceTree = ""; + }; + 8EEBC7CB084F5BB3009FE5BE = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = RollBuffer.h; + path = Files/Source/Shared/RollBuffer.h; + refType = 4; + sourceTree = ""; + }; + 8EEBC7CC084F5BB3009FE5BE = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = SmartPtr.h; + path = Files/Source/Shared/SmartPtr.h; + refType = 4; + sourceTree = ""; + }; + 8EEBC7CD084F5BB3009FE5BE = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = StdLibFileIO.h; + path = Files/Source/Shared/StdLibFileIO.h; + refType = 4; + sourceTree = ""; + }; + 8EEBC7CE084F5BB3009FE5BE = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = StdString.h; + path = Files/Source/Shared/StdString.h; + refType = 4; + sourceTree = ""; + }; + }; + rootObject = 0867D690FE84028FC02AAC07; +} diff --git a/Libraries/MAC/MAC.xcode/xugg.mode1 b/Libraries/MAC/MAC.xcode/xugg.mode1 new file mode 100644 index 000000000..5e2c4b788 --- /dev/null +++ b/Libraries/MAC/MAC.xcode/xugg.mode1 @@ -0,0 +1,1284 @@ + + + + + ActivePerspectiveName + Project + AllowedModules + + + BundleLoadPath + + MaxInstances + n + Module + PBXSmartGroupTreeModule + Name + Groups and Files Outline View + + + BundleLoadPath + + MaxInstances + n + Module + PBXNavigatorGroup + Name + Editor + + + BundleLoadPath + + MaxInstances + n + Module + XCTaskListModule + Name + Task List + + + BundleLoadPath + + MaxInstances + n + Module + XCDetailModule + Name + File and Smart Group Detail Viewer + + + BundleLoadPath + + MaxInstances + 1 + Module + PBXBuildResultsModule + Name + Detailed Build Results Viewer + + + BundleLoadPath + + MaxInstances + 1 + Module + PBXProjectFindModule + Name + Project Batch Find Tool + + + BundleLoadPath + + MaxInstances + n + Module + PBXRunSessionModule + Name + Run Log + + + BundleLoadPath + + MaxInstances + n + Module + PBXBookmarksModule + Name + Bookmarks Tool + + + BundleLoadPath + + MaxInstances + n + Module + PBXClassBrowserModule + Name + Class Browser + + + BundleLoadPath + + MaxInstances + n + Module + PBXCVSModule + Name + Source Code Control Tool + + + BundleLoadPath + + MaxInstances + n + Module + PBXDebugBreakpointsModule + Name + Debug Breakpoints Tool + + + BundleLoadPath + + MaxInstances + n + Module + XCDockableInspector + Name + Inspector + + + BundleLoadPath + + MaxInstances + n + Module + PBXOpenQuicklyModule + Name + Open Quickly Tool + + + BundleLoadPath + + MaxInstances + 1 + Module + PBXDebugSessionModule + Name + Debugger + + + BundleLoadPath + + MaxInstances + 1 + Module + PBXDebugCLIModule + Name + Debug Console + + + Description + DefaultDescriptionKey + DockingSystemVisible + + Extension + mode1 + FavBarConfig + + PBXProjectModuleGUID + 8E4DD369082DCBC7004B6830 + XCBarModuleItemNames + + XCBarModuleItems + + + FirstTimeWindowDisplayed + + Identifier + com.apple.perspectives.project.mode1 + MajorVersion + 31 + MinorVersion + 1 + Name + Default + Notifications + + OpenEditors + + PerspectiveWidths + + -1 + -1 + + Perspectives + + + ChosenToolbarItems + + active-target-popup + action + NSToolbarFlexibleSpaceItem + buildOrClean + build-and-runOrDebug + com.apple.ide.PBXToolbarStopButton + get-info + toggle-editor + NSToolbarFlexibleSpaceItem + com.apple.pbx.toolbar.searchfield + + ControllerClassBaseName + + IconName + WindowOfProjectWithEditor + Identifier + perspective.project + IsVertical + + Layout + + + BecomeActive + + ContentConfiguration + + PBXBottomSmartGroupGIDs + + 1C37FBAC04509CD000000102 + 1C37FAAC04509CD000000102 + 1C08E77C0454961000C914BD + 1C37FABC05509CD000000102 + 1C37FABC05539CD112110102 + E2644B35053B69B200211256 + 1C37FABC04509CD000100104 + 1CC0EA4004350EF90044410B + 1CC0EA4004350EF90041110B + + PBXProjectModuleGUID + 1CE0B1FE06471DED0097A5F4 + PBXProjectModuleLabel + Files + PBXProjectStructureProvided + yes + PBXSmartGroupTreeModuleColumnData + + PBXSmartGroupTreeModuleColumnWidthsKey + + 231 + + PBXSmartGroupTreeModuleColumnsKey_v4 + + MainColumn + + + PBXSmartGroupTreeModuleOutlineStateKey_v7 + + PBXSmartGroupTreeModuleOutlineStateExpansionKey + + 0867D691FE84028FC02AAC07 + 8E6577FA084F5CB600F28C07 + 08FB77ACFE841707C02AAC07 + 034768DDFF38A45A11DB9C8B + 1C37FBAC04509CD000000102 + 8ED1CBA1084F619E00771E1E + 8ED1CBA2084F619E00771E1E + 1C37FABC05509CD000000102 + + PBXSmartGroupTreeModuleOutlineStateSelectionKey + + + 1 + 0 + + + PBXSmartGroupTreeModuleOutlineStateVisibleRectKey + {{0, 34}, {231, 566}} + + PBXTopSmartGroupGIDs + + XCIncludePerspectivesSwitch + + XCSharingToken + com.apple.Xcode.GFSharingToken + + GeometryConfiguration + + Frame + {{0, 0}, {248, 584}} + GroupTreeTableConfiguration + + MainColumn + 231 + + RubberWindowFrame + 4 120 1024 625 0 0 1024 746 + + Module + PBXSmartGroupTreeModule + Proportion + 248pt + + + Dock + + + ContentConfiguration + + PBXProjectModuleGUID + 1CE0B20306471E060097A5F4 + PBXProjectModuleLabel + SmartPtr.h + PBXSplitModuleInNavigatorKey + + Split0 + + PBXProjectModuleGUID + 1CE0B20406471E060097A5F4 + PBXProjectModuleLabel + SmartPtr.h + _historyCapacity + 0 + bookmark + 8ED1CBAE084F619E00771E1E + history + + 8EEBC7F2084F5C3C009FE5BE + 8EEBC7F4084F5C3C009FE5BE + 8E65785D084F5EDB00F28C07 + 8E65785E084F5EDB00F28C07 + 8E65785F084F5EDB00F28C07 + 8E657860084F5EDB00F28C07 + 8E657861084F5EDB00F28C07 + 8E657862084F5EDB00F28C07 + 8E657863084F5EDB00F28C07 + 8E657864084F5EDB00F28C07 + 8E657865084F5EDB00F28C07 + 8E657867084F5EDB00F28C07 + 8E657868084F5EDB00F28C07 + 8ED1CBA3084F619E00771E1E + 8ED1CBA4084F619E00771E1E + 8ED1CBA5084F619E00771E1E + 8ED1CBA6084F619E00771E1E + 8ED1CBA7084F619E00771E1E + 8ED1CBA8084F619E00771E1E + + prevStack + + 8EEBC7FA084F5C3C009FE5BE + 8EEBC7FC084F5C3C009FE5BE + 8EEBC7FD084F5C3C009FE5BE + 8EEBC7FE084F5C3C009FE5BE + 8EEBC7FF084F5C3C009FE5BE + 8EEBC800084F5C3C009FE5BE + 8E65786B084F5EDB00F28C07 + 8E65786E084F5EDB00F28C07 + 8E657870084F5EDB00F28C07 + 8E657878084F5EDB00F28C07 + 8E65787A084F5EDB00F28C07 + 8E65787B084F5EDB00F28C07 + 8E65787C084F5EDB00F28C07 + 8E65787E084F5EDB00F28C07 + 8E65787F084F5EDB00F28C07 + 8E657888084F5EDB00F28C07 + 8ED1CBA9084F619E00771E1E + 8ED1CBAA084F619E00771E1E + 8ED1CBAB084F619E00771E1E + 8ED1CBAC084F619E00771E1E + 8ED1CBAD084F619E00771E1E + + + SplitCount + 1 + + StatusBarVisibility + + + GeometryConfiguration + + Frame + {{0, 0}, {771, 480}} + RubberWindowFrame + 4 120 1024 625 0 0 1024 746 + + Module + PBXNavigatorGroup + Proportion + 480pt + + + ContentConfiguration + + PBXProjectModuleGUID + 1CE0B20506471E060097A5F4 + PBXProjectModuleLabel + Detail + + GeometryConfiguration + + Frame + {{0, 485}, {771, 99}} + RubberWindowFrame + 4 120 1024 625 0 0 1024 746 + + Module + XCDetailModule + Proportion + 99pt + + + Proportion + 771pt + + + Name + Project + ServiceClasses + + XCModuleDock + PBXSmartGroupTreeModule + XCModuleDock + PBXNavigatorGroup + XCDetailModule + + TableOfContents + + 8ED1CBAF084F619E00771E1E + 1CE0B1FE06471DED0097A5F4 + 8ED1CBB0084F619E00771E1E + 1CE0B20306471E060097A5F4 + 1CE0B20506471E060097A5F4 + + ToolbarConfiguration + xcode.toolbar.config.default + + + ControllerClassBaseName + + IconName + WindowOfProject + Identifier + perspective.morph + IsVertical + 0 + Layout + + + BecomeActive + 1 + ContentConfiguration + + PBXBottomSmartGroupGIDs + + 1C37FBAC04509CD000000102 + 1C37FAAC04509CD000000102 + 1C08E77C0454961000C914BD + 1C37FABC05509CD000000102 + 1C37FABC05539CD112110102 + E2644B35053B69B200211256 + 1C37FABC04509CD000100104 + 1CC0EA4004350EF90044410B + 1CC0EA4004350EF90041110B + + PBXProjectModuleGUID + 11E0B1FE06471DED0097A5F4 + PBXProjectModuleLabel + Files + PBXProjectStructureProvided + yes + PBXSmartGroupTreeModuleColumnData + + PBXSmartGroupTreeModuleColumnWidthsKey + + 186 + + PBXSmartGroupTreeModuleColumnsKey_v4 + + MainColumn + + + PBXSmartGroupTreeModuleOutlineStateKey_v7 + + PBXSmartGroupTreeModuleOutlineStateExpansionKey + + 29B97314FDCFA39411CA2CEA + 1C37FABC05509CD000000102 + + PBXSmartGroupTreeModuleOutlineStateSelectionKey + + + 0 + + + PBXSmartGroupTreeModuleOutlineStateVisibleRectKey + {{0, 0}, {186, 337}} + + PBXTopSmartGroupGIDs + + XCIncludePerspectivesSwitch + 1 + XCSharingToken + com.apple.Xcode.GFSharingToken + + GeometryConfiguration + + Frame + {{0, 0}, {203, 355}} + GroupTreeTableConfiguration + + MainColumn + 186 + + RubberWindowFrame + 373 269 690 397 0 0 1440 878 + + Module + PBXSmartGroupTreeModule + Proportion + 100% + + + Name + Morph + PreferredWidth + 300 + ServiceClasses + + XCModuleDock + PBXSmartGroupTreeModule + + TableOfContents + + 11E0B1FE06471DED0097A5F4 + + ToolbarConfiguration + xcode.toolbar.config.default.short + + + PerspectivesBarVisible + + ShelfIsVisible + + SourceDescription + file at '/System/Library/PrivateFrameworks/DevToolsInterface.framework/Versions/A/Resources/XCPerspectivesSpecificationMode1.xcperspec' + StatusbarIsVisible + + TimeStamp + 0.0 + ToolbarDisplayMode + 1 + ToolbarIsVisible + + ToolbarSizeMode + 1 + Type + Perspectives + UpdateMessage + The Default Workspace in this version of Xcode now includes support to hide and show the detail view (what has been referred to as the "Metro-Morph" feature). You must discard your current Default Workspace settings and update to the latest Default Workspace in order to gain this feature. Do you wish to update to the latest Workspace defaults for project '%@'? + WindowJustification + 5 + WindowOrderList + + 1C530D57069F1CE1000CFCEE + 8E4DD299082DCA59004B6830 + /Users/xugg/Projects/Cog/Libraries/MAC/MAC.xcode + + WindowString + 4 120 1024 625 0 0 1024 746 + WindowTools + + + FirstTimeWindowDisplayed + + Identifier + windowTool.build + IsVertical + + Layout + + + Dock + + + BecomeActive + + ContentConfiguration + + PBXProjectModuleGUID + 1CD0528F0623707200166675 + PBXProjectModuleLabel + NNFilter.cpp + StatusBarVisibility + + + GeometryConfiguration + + Frame + {{0, 0}, {1024, 342}} + RubberWindowFrame + 0 122 1024 624 0 0 1024 746 + + Module + PBXNavigatorGroup + Proportion + 342pt + + + ContentConfiguration + + PBXProjectModuleGUID + XCMainBuildResultsModuleGUID + PBXProjectModuleLabel + Build + XCBuildResultsTrigger_Collapse + 1021 + XCBuildResultsTrigger_Open + 1011 + + GeometryConfiguration + + Frame + {{0, 347}, {1024, 236}} + RubberWindowFrame + 0 122 1024 624 0 0 1024 746 + + Module + PBXBuildResultsModule + Proportion + 236pt + + + Proportion + 583pt + + + Name + Build Results + ServiceClasses + + PBXBuildResultsModule + + StatusbarIsVisible + + TableOfContents + + 8E4DD299082DCA59004B6830 + 8ED1CB66084F612000771E1E + 1CD0528F0623707200166675 + XCMainBuildResultsModuleGUID + + ToolbarConfiguration + xcode.toolbar.config.build + WindowString + 0 122 1024 624 0 0 1024 746 + WindowToolGUID + 8E4DD299082DCA59004B6830 + WindowToolIsVisible + + + + Identifier + windowTool.debugger + Layout + + + Dock + + + ContentConfiguration + + Debugger + + HorizontalSplitView + + _collapsingFrameDimension + 0.0 + _indexOfCollapsedView + 0 + _percentageOfCollapsedView + 0.0 + isCollapsed + yes + sizes + + {{0, 0}, {317, 164}} + {{317, 0}, {377, 164}} + + + VerticalSplitView + + _collapsingFrameDimension + 0.0 + _indexOfCollapsedView + 0 + _percentageOfCollapsedView + 0.0 + isCollapsed + yes + sizes + + {{0, 0}, {694, 164}} + {{0, 164}, {694, 216}} + + + + LauncherConfigVersion + 8 + PBXProjectModuleGUID + 1C162984064C10D400B95A72 + PBXProjectModuleLabel + Debug - GLUTExamples (Underwater) + + GeometryConfiguration + + DebugConsoleDrawerSize + {100, 120} + DebugConsoleVisible + None + DebugConsoleWindowFrame + {{200, 200}, {500, 300}} + DebugSTDIOWindowFrame + {{200, 200}, {500, 300}} + Frame + {{0, 0}, {694, 380}} + RubberWindowFrame + 321 238 694 422 0 0 1440 878 + + Module + PBXDebugSessionModule + Proportion + 100% + + + Proportion + 100% + + + Name + Debugger + ServiceClasses + + PBXDebugSessionModule + + StatusbarIsVisible + 1 + TableOfContents + + 1CD10A99069EF8BA00B06720 + 1C0AD2AB069F1E9B00FABCE6 + 1C162984064C10D400B95A72 + 1C0AD2AC069F1E9B00FABCE6 + + ToolbarConfiguration + xcode.toolbar.config.debug + WindowString + 321 238 694 422 0 0 1440 878 + WindowToolGUID + 1CD10A99069EF8BA00B06720 + WindowToolIsVisible + 0 + + + FirstTimeWindowDisplayed + + Identifier + windowTool.find + IsVertical + + Layout + + + Dock + + + Dock + + + BecomeActive + + ContentConfiguration + + PBXProjectModuleGUID + 1CDD528C0622207200134675 + PBXProjectModuleLabel + StdString.h + StatusBarVisibility + + + GeometryConfiguration + + Frame + {{0, 0}, {781, 212}} + RubberWindowFrame + 188 243 781 470 0 0 1024 746 + + Module + PBXNavigatorGroup + Proportion + 781pt + + + Proportion + 212pt + + + ContentConfiguration + + PBXProjectModuleGUID + 1CD0528E0623707200166675 + PBXProjectModuleLabel + Project Find + + GeometryConfiguration + + Frame + {{0, 217}, {781, 212}} + RubberWindowFrame + 188 243 781 470 0 0 1024 746 + + Module + PBXProjectFindModule + Proportion + 212pt + + + Proportion + 429pt + + + Name + Project Find + ServiceClasses + + PBXProjectFindModule + + StatusbarIsVisible + + TableOfContents + + 1C530D57069F1CE1000CFCEE + 8ED1CB6B084F614400771E1E + 8ED1CB6C084F614400771E1E + 1CDD528C0622207200134675 + 1CD0528E0623707200166675 + + WindowString + 188 243 781 470 0 0 1024 746 + WindowToolGUID + 1C530D57069F1CE1000CFCEE + WindowToolIsVisible + + + + Identifier + MENUSEPARATOR + + + Identifier + windowTool.debuggerConsole + Layout + + + Dock + + + BecomeActive + 1 + ContentConfiguration + + PBXProjectModuleGUID + 1C78EAAC065D492600B07095 + PBXProjectModuleLabel + Debugger Console + + GeometryConfiguration + + Frame + {{0, 0}, {440, 358}} + RubberWindowFrame + 650 41 440 400 0 0 1280 1002 + + Module + PBXDebugCLIModule + Proportion + 358pt + + + Proportion + 358pt + + + Name + Debugger Console + ServiceClasses + + PBXDebugCLIModule + + StatusbarIsVisible + 1 + TableOfContents + + 1C78EAAD065D492600B07095 + 1C78EAAE065D492600B07095 + 1C78EAAC065D492600B07095 + + WindowString + 650 41 440 400 0 0 1280 1002 + + + FirstTimeWindowDisplayed + + Identifier + windowTool.run + IsVertical + + Layout + + + Dock + + + ContentConfiguration + + LauncherConfigVersion + 3 + PBXProjectModuleGUID + 1CD0528B0623707200166675 + PBXProjectModuleLabel + Run + Runner + + HorizontalSplitView + + _collapsingFrameDimension + 0.0 + _indexOfCollapsedView + 0 + _percentageOfCollapsedView + 0.0 + isCollapsed + yes + sizes + + {{0, 0}, {493, 168}} + {{0, 173}, {493, 270}} + + + VerticalSplitView + + _collapsingFrameDimension + 0.0 + _indexOfCollapsedView + 0 + _percentageOfCollapsedView + 0.0 + isCollapsed + yes + sizes + + {{0, 0}, {406, 443}} + {{411, 0}, {517, 443}} + + + + + GeometryConfiguration + + Frame + {{0, 0}, {459, 159}} + RubberWindowFrame + 25 522 459 200 0 0 1024 746 + + Module + PBXRunSessionModule + Proportion + 159pt + + + Proportion + 159pt + + + Name + Run Log + ServiceClasses + + PBXRunSessionModule + + StatusbarIsVisible + + TableOfContents + + 1C0AD2B3069F1EA900FABCE6 + 8E65782B084F5D9A00F28C07 + 1CD0528B0623707200166675 + 8E65782C084F5D9A00F28C07 + + ToolbarConfiguration + xcode.toolbar.config.run + WindowString + 25 522 459 200 0 0 1024 746 + WindowToolGUID + 1C0AD2B3069F1EA900FABCE6 + WindowToolIsVisible + + + + Identifier + windowTool.scm + Layout + + + Dock + + + ContentConfiguration + + PBXProjectModuleGUID + 1C78EAB2065D492600B07095 + PBXProjectModuleLabel + <No Editor> + PBXSplitModuleInNavigatorKey + + Split0 + + PBXProjectModuleGUID + 1C78EAB3065D492600B07095 + + SplitCount + 1 + + StatusBarVisibility + 1 + + GeometryConfiguration + + Frame + {{0, 0}, {452, 0}} + RubberWindowFrame + 743 379 452 308 0 0 1280 1002 + + Module + PBXNavigatorGroup + Proportion + 0pt + + + BecomeActive + 1 + ContentConfiguration + + PBXProjectModuleGUID + 1CD052920623707200166675 + PBXProjectModuleLabel + SCM + + GeometryConfiguration + + ConsoleFrame + {{0, 259}, {452, 0}} + Frame + {{0, 7}, {452, 259}} + RubberWindowFrame + 743 379 452 308 0 0 1280 1002 + TableConfiguration + + Status + 30 + FileName + 199 + Path + 197.09500122070312 + + TableFrame + {{0, 0}, {452, 250}} + + Module + PBXCVSModule + Proportion + 262pt + + + Proportion + 266pt + + + Name + SCM + ServiceClasses + + PBXCVSModule + + StatusbarIsVisible + 1 + TableOfContents + + 1C78EAB4065D492600B07095 + 1C78EAB5065D492600B07095 + 1C78EAB2065D492600B07095 + 1CD052920623707200166675 + + ToolbarConfiguration + xcode.toolbar.config.scm + WindowString + 743 379 452 308 0 0 1280 1002 + + + Identifier + windowTool.breakpoints + Layout + + + Dock + + + BecomeActive + 1 + ContentConfiguration + + PBXProjectModuleGUID + 1CD052930623707200166675 + PBXProjectModuleLabel + Breakpoints + + GeometryConfiguration + + BreakpointsTreeTableConfiguration + + enabledColumn + 16 + breakpointColumn + 201.5830078125 + + Frame + {{0, 0}, {240, 195}} + RubberWindowFrame + 342 421 240 216 0 0 1440 878 + + Module + PBXDebugBreakpointsModule + Proportion + 195pt + + + Proportion + 195pt + + + Name + Breakpoints + ServiceClasses + + PBXDebugBreakpointsModule + + StatusbarIsVisible + 0 + TableOfContents + + 1C0AD2AD069F1E9B00FABCE6 + 1C0AD2AE069F1E9B00FABCE6 + 1CD052930623707200166675 + + WindowString + 342 421 240 216 0 0 1440 878 + WindowToolGUID + 1C0AD2AD069F1E9B00FABCE6 + WindowToolIsVisible + 0 + + + Identifier + windowTool.bookmarks + Layout + + + Dock + + + Module + PBXBookmarksModule + Proportion + 100% + + + Proportion + 100% + + + Name + Bookmarks + ServiceClasses + + PBXBookmarksModule + + StatusbarIsVisible + 0 + WindowString + 538 42 401 187 0 0 1280 1002 + + + Identifier + windowTool.classBrowser + Layout + + + Dock + + + BecomeActive + 1 + ContentConfiguration + + OptionsSetName + Hierarchy, all classes + PBXProjectModuleGUID + 1CA6456E063B45B4001379D8 + PBXProjectModuleLabel + Class Browser - NSObject + + GeometryConfiguration + + ClassesFrame + {{0, 0}, {374, 96}} + ClassesTreeTableConfiguration + + PBXClassNameColumnIdentifier + 208 + PBXClassBookColumnIdentifier + 22 + + Frame + {{0, 0}, {630, 331}} + MembersFrame + {{0, 105}, {374, 395}} + MembersTreeTableConfiguration + + PBXMemberTypeIconColumnIdentifier + 22 + PBXMemberNameColumnIdentifier + 216 + PBXMemberTypeColumnIdentifier + 97 + PBXMemberBookColumnIdentifier + 22 + + PBXModuleWindowStatusBarHidden2 + 1 + RubberWindowFrame + 385 179 630 352 0 0 1440 878 + + Module + PBXClassBrowserModule + Proportion + 332pt + + + Proportion + 332pt + + + Name + Class Browser + ServiceClasses + + PBXClassBrowserModule + + StatusbarIsVisible + 0 + TableOfContents + + 1C0AD2AF069F1E9B00FABCE6 + 1C0AD2B0069F1E9B00FABCE6 + 1CA6456E063B45B4001379D8 + + ToolbarConfiguration + xcode.toolbar.config.classbrowser + WindowString + 385 179 630 352 0 0 1440 878 + WindowToolGUID + 1C0AD2AF069F1E9B00FABCE6 + WindowToolIsVisible + 0 + + + + diff --git a/Libraries/MAC/MAC.xcode/xugg.pbxuser b/Libraries/MAC/MAC.xcode/xugg.pbxuser new file mode 100644 index 000000000..2eca34a9e --- /dev/null +++ b/Libraries/MAC/MAC.xcode/xugg.pbxuser @@ -0,0 +1,692 @@ +// !$*UTF8*$! +{ + 0867D690FE84028FC02AAC07 = { + activeBuildStyle = 4F0BB7ED011F40E904CA0E50; + activeTarget = 8D07F2BC0486CC7A007CD1D0; + addToTargets = ( + 8D07F2BC0486CC7A007CD1D0, + ); + codeSenseManager = 8E4DD23D082DCA1B004B6830; + perUserDictionary = { + PBXConfiguration.PBXFileTableDataSource3.PBXErrorsWarningsDataSource = { + PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; + PBXFileTableDataSourceColumnSortingKey = PBXErrorsWarningsDataSource_LocationID; + PBXFileTableDataSourceColumnWidthsKey = ( + 20, + 300, + 133, + ); + PBXFileTableDataSourceColumnsKey = ( + PBXErrorsWarningsDataSource_TypeID, + PBXErrorsWarningsDataSource_MessageID, + PBXErrorsWarningsDataSource_LocationID, + ); + }; + PBXConfiguration.PBXFileTableDataSource3.PBXExecutablesDataSource = { + PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; + PBXFileTableDataSourceColumnSortingKey = PBXExecutablesDataSource_NameID; + PBXFileTableDataSourceColumnWidthsKey = ( + 22, + 300, + 419.5835, + ); + PBXFileTableDataSourceColumnsKey = ( + PBXExecutablesDataSource_ActiveFlagID, + PBXExecutablesDataSource_NameID, + PBXExecutablesDataSource_CommentsID, + ); + }; + PBXConfiguration.PBXFileTableDataSource3.PBXFileTableDataSource = { + PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; + PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID; + PBXFileTableDataSourceColumnWidthsKey = ( + 20, + 532, + 20, + 48, + 43, + 43, + 20, + ); + PBXFileTableDataSourceColumnsKey = ( + PBXFileDataSource_FiletypeID, + PBXFileDataSource_Filename_ColumnID, + PBXFileDataSource_Built_ColumnID, + PBXFileDataSource_ObjectSize_ColumnID, + PBXFileDataSource_Errors_ColumnID, + PBXFileDataSource_Warnings_ColumnID, + PBXFileDataSource_Target_ColumnID, + ); + }; + PBXConfiguration.PBXTargetDataSource.PBXTargetDataSource = { + PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; + PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID; + PBXFileTableDataSourceColumnWidthsKey = ( + 20, + 200, + 352, + 20, + 48, + 43, + 43, + ); + PBXFileTableDataSourceColumnsKey = ( + PBXFileDataSource_FiletypeID, + PBXFileDataSource_Filename_ColumnID, + PBXTargetDataSource_PrimaryAttribute, + PBXFileDataSource_Built_ColumnID, + PBXFileDataSource_ObjectSize_ColumnID, + PBXFileDataSource_Errors_ColumnID, + PBXFileDataSource_Warnings_ColumnID, + ); + }; + PBXPerProjectTemplateStateSaveDate = 139419923; + PBXWorkspaceStateSaveDate = 139419923; + }; + perUserProjectItems = { + 8E65785D084F5EDB00F28C07 = 8E65785D084F5EDB00F28C07; + 8E65785E084F5EDB00F28C07 = 8E65785E084F5EDB00F28C07; + 8E65785F084F5EDB00F28C07 = 8E65785F084F5EDB00F28C07; + 8E657860084F5EDB00F28C07 = 8E657860084F5EDB00F28C07; + 8E657861084F5EDB00F28C07 = 8E657861084F5EDB00F28C07; + 8E657862084F5EDB00F28C07 = 8E657862084F5EDB00F28C07; + 8E657863084F5EDB00F28C07 = 8E657863084F5EDB00F28C07; + 8E657864084F5EDB00F28C07 = 8E657864084F5EDB00F28C07; + 8E657865084F5EDB00F28C07 = 8E657865084F5EDB00F28C07; + 8E657867084F5EDB00F28C07 = 8E657867084F5EDB00F28C07; + 8E657868084F5EDB00F28C07 = 8E657868084F5EDB00F28C07; + 8E65786B084F5EDB00F28C07 = 8E65786B084F5EDB00F28C07; + 8E65786E084F5EDB00F28C07 = 8E65786E084F5EDB00F28C07; + 8E657870084F5EDB00F28C07 = 8E657870084F5EDB00F28C07; + 8E657878084F5EDB00F28C07 = 8E657878084F5EDB00F28C07; + 8E65787A084F5EDB00F28C07 = 8E65787A084F5EDB00F28C07; + 8E65787B084F5EDB00F28C07 = 8E65787B084F5EDB00F28C07; + 8E65787C084F5EDB00F28C07 = 8E65787C084F5EDB00F28C07; + 8E65787E084F5EDB00F28C07 = 8E65787E084F5EDB00F28C07; + 8E65787F084F5EDB00F28C07 = 8E65787F084F5EDB00F28C07; + 8E657888084F5EDB00F28C07 = 8E657888084F5EDB00F28C07; + 8ED1CBA3084F619E00771E1E = 8ED1CBA3084F619E00771E1E; + 8ED1CBA4084F619E00771E1E = 8ED1CBA4084F619E00771E1E; + 8ED1CBA5084F619E00771E1E = 8ED1CBA5084F619E00771E1E; + 8ED1CBA6084F619E00771E1E = 8ED1CBA6084F619E00771E1E; + 8ED1CBA7084F619E00771E1E = 8ED1CBA7084F619E00771E1E; + 8ED1CBA8084F619E00771E1E = 8ED1CBA8084F619E00771E1E; + 8ED1CBA9084F619E00771E1E = 8ED1CBA9084F619E00771E1E; + 8ED1CBAA084F619E00771E1E = 8ED1CBAA084F619E00771E1E; + 8ED1CBAB084F619E00771E1E = 8ED1CBAB084F619E00771E1E; + 8ED1CBAC084F619E00771E1E = 8ED1CBAC084F619E00771E1E; + 8ED1CBAD084F619E00771E1E = 8ED1CBAD084F619E00771E1E; + 8ED1CBAE084F619E00771E1E = 8ED1CBAE084F619E00771E1E; + 8EEBC7F2084F5C3C009FE5BE = 8EEBC7F2084F5C3C009FE5BE; + 8EEBC7F4084F5C3C009FE5BE = 8EEBC7F4084F5C3C009FE5BE; + 8EEBC7FA084F5C3C009FE5BE = 8EEBC7FA084F5C3C009FE5BE; + 8EEBC7FC084F5C3C009FE5BE = 8EEBC7FC084F5C3C009FE5BE; + 8EEBC7FD084F5C3C009FE5BE = 8EEBC7FD084F5C3C009FE5BE; + 8EEBC7FE084F5C3C009FE5BE = 8EEBC7FE084F5C3C009FE5BE; + 8EEBC7FF084F5C3C009FE5BE = 8EEBC7FF084F5C3C009FE5BE; + 8EEBC800084F5C3C009FE5BE = 8EEBC800084F5C3C009FE5BE; + }; + sourceControlManager = 8E4DD23C082DCA1B004B6830; + userBuildSettings = { + }; + }; + 8D07F2BC0486CC7A007CD1D0 = { + activeExec = 0; + }; + 8E4DD23C082DCA1B004B6830 = { + fallbackIsa = XCSourceControlManager; + isSCMEnabled = 0; + isa = PBXSourceControlManager; + scmConfiguration = { + }; + scmType = ""; + }; + 8E4DD23D082DCA1B004B6830 = { + indexTemplatePath = ""; + isa = PBXCodeSenseManager; + }; + 8E65785D084F5EDB00F28C07 = { + fRef = 8EEBC788084F5B30009FE5BE; + isa = PBXTextBookmark; + name = "virtual int Open(const wchar_t * pName) = 0;"; + rLen = 50; + rLoc = 351; + rType = 0; + vrLen = 669; + vrLoc = 0; + }; + 8E65785E084F5EDB00F28C07 = { + fRef = 8EEBC7C5084F5BB3009FE5BE; + isa = PBXTextBookmark; + name = "CharacterHelper.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 648; + vrLoc = 0; + }; + 8E65785F084F5EDB00F28C07 = { + fRef = 8EEBC792084F5B65009FE5BE; + isa = PBXTextBookmark; + name = "APECompress.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1539; + vrLoc = 0; + }; + 8E657860084F5EDB00F28C07 = { + fRef = 8EEBC7CA084F5BB3009FE5BE; + isa = PBXTextBookmark; + name = wchar_t; + rLen = 7; + rLoc = 451; + rType = 0; + vrLen = 839; + vrLoc = 0; + }; + 8E657861084F5EDB00F28C07 = { + fRef = 8EEBC77F084F5B1B009FE5BE; + isa = PBXTextBookmark; + name = "CircleBuffer.cpp: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 658; + vrLoc = 0; + }; + 8E657862084F5EDB00F28C07 = { + fRef = 8EEBC75B084F5AF9009FE5BE; + isa = PBXTextBookmark; + name = "APEDecompress.cpp: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 868; + vrLoc = 0; + }; + 8E657863084F5EDB00F28C07 = { + fRef = 8EEBC75C084F5AF9009FE5BE; + isa = PBXTextBookmark; + name = "APEHeader.cpp: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 801; + vrLoc = 0; + }; + 8E657864084F5EDB00F28C07 = { + fRef = 8EEBC75F084F5AF9009FE5BE; + isa = PBXTextBookmark; + name = "APESimple.cpp: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1519; + vrLoc = 0; + }; + 8E657865084F5EDB00F28C07 = { + fRef = 8EEBC762084F5AF9009FE5BE; + isa = PBXTextBookmark; + name = "MACLib.cpp: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1010; + vrLoc = 0; + }; + 8E657867084F5EDB00F28C07 = { + fRef = 8EEBC781084F5B1B009FE5BE; + isa = PBXTextBookmark; + name = "StdLibFileIO.cpp: GetName"; + rLen = 0; + rLoc = 6201; + rType = 0; + vrLen = 724; + vrLoc = 5817; + }; + 8E657868084F5EDB00F28C07 = { + fRef = 8EEBC7CD084F5BB3009FE5BE; + isa = PBXTextBookmark; + name = "StdLibFileIO.h: GetName"; + rLen = 0; + rLoc = 916; + rType = 0; + vrLen = 787; + vrLoc = 349; + }; + 8E65786B084F5EDB00F28C07 = { + fRef = 8EEBC7CD084F5BB3009FE5BE; + isa = PBXTextBookmark; + name = "StdLibFileIO.h: Open"; + rLen = 0; + rLoc = 302; + rType = 0; + vrLen = 739; + vrLoc = 0; + }; + 8E65786E084F5EDB00F28C07 = { + fRef = 8EEBC781084F5B1B009FE5BE; + isa = PBXTextBookmark; + name = "StdLibFileIO.cpp: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 802; + vrLoc = 3342; + }; + 8E657870084F5EDB00F28C07 = { + fRef = 8EEBC788084F5B30009FE5BE; + isa = PBXTextBookmark; + name = "virtual int Open(const wchar_t * pName) = 0;"; + rLen = 50; + rLoc = 351; + rType = 0; + vrLen = 669; + vrLoc = 0; + }; + 8E657878084F5EDB00F28C07 = { + fRef = 8EEBC7CA084F5BB3009FE5BE; + isa = PBXTextBookmark; + name = wchar_t; + rLen = 7; + rLoc = 451; + rType = 0; + vrLen = 839; + vrLoc = 0; + }; + 8E65787A084F5EDB00F28C07 = { + fRef = 8EEBC77F084F5B1B009FE5BE; + isa = PBXTextBookmark; + name = "CircleBuffer.cpp: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 658; + vrLoc = 0; + }; + 8E65787B084F5EDB00F28C07 = { + fRef = 8EEBC75B084F5AF9009FE5BE; + isa = PBXTextBookmark; + name = "APEDecompress.cpp: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 868; + vrLoc = 0; + }; + 8E65787C084F5EDB00F28C07 = { + fRef = 8EEBC75C084F5AF9009FE5BE; + isa = PBXTextBookmark; + name = "APEHeader.cpp: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 801; + vrLoc = 0; + }; + 8E65787E084F5EDB00F28C07 = { + fRef = 8EEBC75F084F5AF9009FE5BE; + isa = PBXTextBookmark; + name = "APESimple.cpp: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1519; + vrLoc = 0; + }; + 8E65787F084F5EDB00F28C07 = { + fRef = 8EEBC762084F5AF9009FE5BE; + isa = PBXTextBookmark; + name = "MACLib.cpp: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1010; + vrLoc = 0; + }; + 8E657888084F5EDB00F28C07 = { + fRef = 8EEBC797084F5B65009FE5BE; + isa = PBXTextBookmark; + name = "APEInfo.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1906; + vrLoc = 736; + }; + 8ED1CBA3084F619E00771E1E = { + fRef = 8EEBC75D084F5AF9009FE5BE; + isa = PBXTextBookmark; + name = "m_spIO.Assign(new IO_CLASS_NAME);"; + rLen = 39; + rLoc = 783; + rType = 0; + vrLen = 1114; + vrLoc = 0; + }; + 8ED1CBA4084F619E00771E1E = { + fRef = 8EEBC7CE084F5BB3009FE5BE; + isa = PBXTextBookmark; + name = wchar_t; + rLen = 7; + rLoc = 11811; + rType = 0; + vrLen = 606; + vrLoc = 11444; + }; + 8ED1CBA5084F619E00771E1E = { + fRef = 8EEBC797084F5B65009FE5BE; + isa = PBXTextBookmark; + name = "APEInfo.h: CAPEInfo"; + rLen = 0; + rLoc = 4876; + rType = 0; + vrLen = 1083; + vrLoc = 4375; + }; + 8ED1CBA6084F619E00771E1E = { + fRef = 8EEBC787084F5B30009FE5BE; + isa = PBXTextBookmark; + name = "APETag.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1305; + vrLoc = 0; + }; + 8ED1CBA7084F619E00771E1E = { + fRef = 8EEBC7C4084F5BB3009FE5BE; + isa = PBXTextBookmark; + name = "All.h: 36"; + rLen = 0; + rLoc = 1055; + rType = 0; + vrLen = 840; + vrLoc = 873; + }; + 8ED1CBA8084F619E00771E1E = { + fRef = 8EEBC78B084F5B30009FE5BE; + isa = PBXBookmark; + }; + 8ED1CBA9084F619E00771E1E = { + fRef = 8EEBC75D084F5AF9009FE5BE; + isa = PBXTextBookmark; + name = "m_spIO.Assign(new IO_CLASS_NAME);"; + rLen = 39; + rLoc = 783; + rType = 0; + vrLen = 1114; + vrLoc = 0; + }; + 8ED1CBAA084F619E00771E1E = { + fRef = 8EEBC7CE084F5BB3009FE5BE; + isa = PBXTextBookmark; + name = wchar_t; + rLen = 7; + rLoc = 11811; + rType = 0; + vrLen = 606; + vrLoc = 11444; + }; + 8ED1CBAB084F619E00771E1E = { + fRef = 8EEBC797084F5B65009FE5BE; + isa = PBXTextBookmark; + name = "APEInfo.h: CAPEInfo"; + rLen = 0; + rLoc = 4876; + rType = 0; + vrLen = 1083; + vrLoc = 4375; + }; + 8ED1CBAC084F619E00771E1E = { + fRef = 8EEBC787084F5B30009FE5BE; + isa = PBXTextBookmark; + name = "APETag.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1305; + vrLoc = 0; + }; + 8ED1CBAD084F619E00771E1E = { + fRef = 8EEBC7C4084F5BB3009FE5BE; + isa = PBXTextBookmark; + name = "All.h: 36"; + rLen = 0; + rLoc = 1055; + rType = 0; + vrLen = 840; + vrLoc = 873; + }; + 8ED1CBAE084F619E00771E1E = { + fRef = 8EEBC78B084F5B30009FE5BE; + isa = PBXTextBookmark; + name = "SmartPtr.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 969; + vrLoc = 0; + }; + 8EEBC75B084F5AF9009FE5BE = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {884, 6846}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRect = "{{0, 0}, {730, 448}}"; + }; + }; + 8EEBC75C084F5AF9009FE5BE = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1442, 4536}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRect = "{{0, 0}, {730, 448}}"; + }; + }; + 8EEBC75D084F5AF9009FE5BE = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {983, 5166}}"; + sepNavSelRange = "{783, 39}"; + sepNavVisRect = "{{0, 118}, {983, 310}}"; + }; + }; + 8EEBC75F084F5AF9009FE5BE = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1208, 5992}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRect = "{{0, 0}, {730, 448}}"; + }; + }; + 8EEBC762084F5AF9009FE5BE = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {770, 2226}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRect = "{{0, 0}, {730, 448}}"; + }; + }; + 8EEBC766084F5AF9009FE5BE = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {983, 4592}}"; + sepNavSelRange = "{158, 0}"; + sepNavVisRect = "{{0, 0}, {983, 310}}"; + }; + }; + 8EEBC76A084F5AF9009FE5BE = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1082, 4102}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRect = "{{0, 0}, {730, 448}}"; + }; + }; + 8EEBC77F084F5B1B009FE5BE = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {782, 1260}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRect = "{{0, 0}, {730, 448}}"; + }; + }; + 8EEBC781084F5B1B009FE5BE = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {730, 3402}}"; + sepNavSelRange = "{6201, 0}"; + sepNavVisRect = "{{0, 2646}, {730, 448}}"; + }; + }; + 8EEBC787084F5B30009FE5BE = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {854, 4116}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRect = "{{0, 0}, {730, 448}}"; + }; + }; + 8EEBC788084F5B30009FE5BE = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {983, 700}}"; + sepNavSelRange = "{1014, 49}"; + sepNavVisRect = "{{0, 390}, {983, 310}}"; + }; + }; + 8EEBC78B084F5B30009FE5BE = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {730, 1260}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRect = "{{0, 0}, {730, 448}}"; + }; + }; + 8EEBC792084F5B65009FE5BE = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1424, 798}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRect = "{{0, 0}, {730, 448}}"; + }; + }; + 8EEBC797084F5B65009FE5BE = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {758, 1414}}"; + sepNavSelRange = "{4876, 0}"; + sepNavVisRect = "{{0, 959}, {730, 448}}"; + }; + }; + 8EEBC7A1084F5B65009FE5BE = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {730, 448}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRect = "{{0, 0}, {730, 448}}"; + }; + }; + 8EEBC7C4084F5BB3009FE5BE = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {8486, 3500}}"; + sepNavSelRange = "{1055, 0}"; + sepNavVisRect = "{{0, 392}, {730, 448}}"; + }; + }; + 8EEBC7C5084F5BB3009FE5BE = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {730, 448}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRect = "{{0, 0}, {730, 448}}"; + }; + }; + 8EEBC7CA084F5BB3009FE5BE = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {730, 994}}"; + sepNavSelRange = "{451, 7}"; + sepNavVisRect = "{{0, 0}, {730, 448}}"; + }; + }; + 8EEBC7CD084F5BB3009FE5BE = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {730, 756}}"; + sepNavSelRange = "{916, 0}"; + sepNavVisRect = "{{0, 287}, {730, 448}}"; + }; + }; + 8EEBC7CE084F5BB3009FE5BE = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {730, 42210}}"; + sepNavSelRange = "{11811, 7}"; + sepNavVisRect = "{{0, 3633}, {730, 448}}"; + }; + }; + 8EEBC7F2084F5C3C009FE5BE = { + fRef = 8EEBC76A084F5AF9009FE5BE; + isa = PBXTextBookmark; + name = "WAVInputSource.cpp: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1112; + vrLoc = 0; + }; + 8EEBC7F4084F5C3C009FE5BE = { + fRef = 8EEBC7A1084F5B65009FE5BE; + isa = PBXTextBookmark; + name = "Predictor.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1096; + vrLoc = 0; + }; + 8EEBC7FA084F5C3C009FE5BE = { + fRef = 8EEBC76A084F5AF9009FE5BE; + isa = PBXTextBookmark; + name = "WAVInputSource.cpp: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1112; + vrLoc = 0; + }; + 8EEBC7FC084F5C3C009FE5BE = { + fRef = 8EEBC7A1084F5B65009FE5BE; + isa = PBXTextBookmark; + name = "Predictor.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1096; + vrLoc = 0; + }; + 8EEBC7FD084F5C3C009FE5BE = { + fRef = 8EEBC792084F5B65009FE5BE; + isa = PBXTextBookmark; + name = "APECompress.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1539; + vrLoc = 0; + }; + 8EEBC7FE084F5C3C009FE5BE = { + fRef = 8EEBC75D084F5AF9009FE5BE; + isa = PBXTextBookmark; + name = "m_spIO.Assign(new IO_CLASS_NAME);"; + rLen = 39; + rLoc = 786; + rType = 0; + vrLen = 1114; + vrLoc = 0; + }; + 8EEBC7FF084F5C3C009FE5BE = { + fRef = 8EEBC7C4084F5BB3009FE5BE; + isa = PBXTextBookmark; + name = "All.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 807; + vrLoc = 286; + }; + 8EEBC800084F5C3C009FE5BE = { + fRef = 8EEBC7C5084F5BB3009FE5BE; + isa = PBXTextBookmark; + name = "CharacterHelper.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 648; + vrLoc = 0; + }; +} diff --git a/Libraries/MPCDec/English.lproj/InfoPlist.strings b/Libraries/MPCDec/English.lproj/InfoPlist.strings new file mode 100644 index 0000000000000000000000000000000000000000..91624fb2e103d5d71b50669fd9513a24fcb95019 GIT binary patch literal 142 zcmW-Z-3o$W5Jb^a|n+M5d7y*u$F#S$1bHcC literal 0 HcmV?d00001 diff --git a/Libraries/MPCDec/Files/AUTHORS b/Libraries/MPCDec/Files/AUTHORS new file mode 100644 index 000000000..1bcac6376 --- /dev/null +++ b/Libraries/MPCDec/Files/AUTHORS @@ -0,0 +1,10 @@ +libmpcdec is the result of the work of many people: + +* Andree Buschmann and Frank Klemm + Original implementation and core development. + +* Peter Pawlowski and Benoit Amiaux + Portability and further optimizations. + +* Miles Egan + Port to pure C, documentation, and api refinements. diff --git a/Libraries/MPCDec/Files/COPYING b/Libraries/MPCDec/Files/COPYING new file mode 100644 index 000000000..10190c014 --- /dev/null +++ b/Libraries/MPCDec/Files/COPYING @@ -0,0 +1,31 @@ +Copyright (c) 2005, The Musepack Development Team +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * Neither the name of the The Musepack Development Team nor the + names of its contributors may be used to endorse or promote + products derived from this software without specific prior + written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/Libraries/MPCDec/Files/ChangeLog b/Libraries/MPCDec/Files/ChangeLog new file mode 100644 index 000000000..192cf75ab --- /dev/null +++ b/Libraries/MPCDec/Files/ChangeLog @@ -0,0 +1,23 @@ +1.2 + * 1.1.1 broke the API (BOOL type changed to mpc_bool_t). Version bumped to 1.2 to reflect the major change. Sorry to those who were caught by this error + * Fixed relative/absolute includes (#include "stuff.h" in /include/mpcdec, #include in src/) + * Added msvc project files + * Changed mpc_reader_t structure, any specific data of the reader's + implementations should be hidden behind the (void*) data pointer. (example + in default implementation mpc_reader_file) + * Renamed to libmpcdec (to make room for libmpcenc) + +1.1.1 + * fix for fixed-point mode bug + +1.1 + * add compliance & cleanup patches from Michael Roitzsch of xine project + * switch to BSD license + * port to pure C + * add doxygen documentation + * revise API somewhat + +1.0.3 + * autotools build process + * sample binary added + * floating-point mode by default diff --git a/Libraries/MPCDec/Files/INSTALL b/Libraries/MPCDec/Files/INSTALL new file mode 100644 index 000000000..4bc08a9ef --- /dev/null +++ b/Libraries/MPCDec/Files/INSTALL @@ -0,0 +1,3 @@ +How to install libmpcdec: +"./configure [--prefix=/usr] && make" as a regular user +"make install" as root diff --git a/Libraries/MPCDec/Files/README b/Libraries/MPCDec/Files/README new file mode 100644 index 000000000..159f29a65 --- /dev/null +++ b/Libraries/MPCDec/Files/README @@ -0,0 +1,6 @@ +Musepack Decoder Library 1.2: + +run "./configure; make" + +To create a sample app using the musepack decoder library in src/ +Check src/sample.cpp for more details. diff --git a/Libraries/MPCDec/Files/include/config.h b/Libraries/MPCDec/Files/include/config.h new file mode 100644 index 000000000..f431cde5f --- /dev/null +++ b/Libraries/MPCDec/Files/include/config.h @@ -0,0 +1,105 @@ +/* include/config.h. Generated by configure. */ +/* include/config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the `memmove' function. */ +#define HAVE_MEMMOVE 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the `memset' function. */ +#define HAVE_MEMSET 1 + +/* Define to 1 if the system has the type `ptrdiff_t'. */ +#define HAVE_PTRDIFF_T 1 + +/* Define to 1 if you have the `sqrt' function. */ +#define HAVE_SQRT 1 + +/* Define to 1 if stdbool.h conforms to C99. */ +#define HAVE_STDBOOL_H 1 + +/* 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_STDLIB_H 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. */ +#define HAVE_SYS_STAT_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_UNISTD_H 1 + +/* Define to 1 if the system has the type `_Bool'. */ +#define HAVE__BOOL 1 + +/* Name of package */ +#define PACKAGE "libmpcdec" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "" + +/* The size of a `int', as computed by sizeof. */ +#define SIZEOF_INT 4 + +/* The size of a `long', as computed by sizeof. */ +#define SIZEOF_LONG 4 + +/* The size of a `long long', as computed by sizeof. */ +#define SIZEOF_LONG_LONG 8 + +/* The size of a `short', as computed by sizeof. */ +#define SIZEOF_SHORT 2 + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Version number of package */ +#define VERSION "1.2" + +/* Define to 1 if your processor stores words with the most significant byte + first (like Motorola and SPARC, unlike Intel and VAX). */ +#define WORDS_BIGENDIAN 1 + +/* 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 `long' if does not define. */ +/* #undef off_t */ + +/* Define to `unsigned' if does not define. */ +/* #undef size_t */ diff --git a/Libraries/MPCDec/Files/include/mainpage.h b/Libraries/MPCDec/Files/include/mainpage.h new file mode 100644 index 000000000..41722e8a2 --- /dev/null +++ b/Libraries/MPCDec/Files/include/mainpage.h @@ -0,0 +1,38 @@ +/** + \mainpage libmpcdec documentation + + \section whats what is libmpcdec + libmpcdec is a library that decodes musepack compressed audio data. Musepack + is a free, high performance, high quality lossy audio compression codec. For + more information on musepack visit http://www.musepack.net. + + \section using using libmpcdec + + Using libmpcdec is very straightforward. There are typically four things you must + do to use libmpcdec in your application. + + \subsection step1 step 1: implement an mpc_reader to provide raw data to the decoder library + The role of the mpc_reader is to provide raw mpc stream data to the mpc decoding library. + This data can come from a file, a network socket, or any other source you wish. + + See the documentation of + \link mpc_reader_t mpc_reader \endlink + for more information. + + \subsection step2 step2: read the streaminfo properties structure from the stream + This is a simple matter of calling the streaminfo_init() and streaminfo_read() functions, + supplying your mpc_reader as a source of raw data. This reads the stream properties header from the + mpc stream. This information will be used to prime the decoder for decoding in + the next step. + + \subsection step3 step 3: initialize an mpc_decoder with your mpc_reader source + This is just a matter of calling the mpc_decoder_setup() and mpc_decoder_initialize() + functions with your mpc_decoder, mpc_reader data source and streaminfo information. + + \subsection step4 step 4: iteratively read raw sample data from the mpc decoder + Once you've initialized the decoding library you just iteratively call the + mpc_decoder_decode routine until it indicates that the entire stream has been read. + + For a simple example of all of these steps see the sample application distributed with + libmpcdec in src/sample.cpp. +*/ diff --git a/Libraries/MPCDec/Files/include/mpcdec/config_types.h b/Libraries/MPCDec/Files/include/mpcdec/config_types.h new file mode 100644 index 000000000..acd605a32 --- /dev/null +++ b/Libraries/MPCDec/Files/include/mpcdec/config_types.h @@ -0,0 +1,48 @@ +/* + Copyright (c) 2005, The Musepack Development Team + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * Neither the name of the The Musepack Development Team nor the + names of its contributors may be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef __MUSEPACK_CONFIG_TYPES_H__ +#define __MUSEPACK_CONFIG_TYPES_H__ + +typedef unsigned char mpc_bool_t; +#define TRUE 1 +#define FALSE 0 + +typedef short mpc_int16_t; +typedef unsigned short mpc_uint16_t; +typedef int mpc_int32_t; +typedef unsigned int mpc_uint32_t; +typedef long long mpc_int64_t; + +#endif // __MUSEPACK_CONFIG_TYPES_H__ diff --git a/Libraries/MPCDec/Files/include/mpcdec/config_types.h.in b/Libraries/MPCDec/Files/include/mpcdec/config_types.h.in new file mode 100644 index 000000000..da5662e3a --- /dev/null +++ b/Libraries/MPCDec/Files/include/mpcdec/config_types.h.in @@ -0,0 +1,48 @@ +/* + Copyright (c) 2005, The Musepack Development Team + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * Neither the name of the The Musepack Development Team nor the + names of its contributors may be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef __MUSEPACK_CONFIG_TYPES_H__ +#define __MUSEPACK_CONFIG_TYPES_H__ + +typedef unsigned char mpc_bool_t; +#define TRUE 1 +#define FALSE 0 + +typedef @SIZE16@ mpc_int16_t; +typedef @USIZE16@ mpc_uint16_t; +typedef @SIZE32@ mpc_int32_t; +typedef @USIZE32@ mpc_uint32_t; +typedef @SIZE64@ mpc_int64_t; + +#endif // __MUSEPACK_CONFIG_TYPES_H__ diff --git a/Libraries/MPCDec/Files/include/mpcdec/config_win32.h b/Libraries/MPCDec/Files/include/mpcdec/config_win32.h new file mode 100644 index 000000000..0d388c837 --- /dev/null +++ b/Libraries/MPCDec/Files/include/mpcdec/config_win32.h @@ -0,0 +1,48 @@ +/* + Copyright (c) 2005, The Musepack Development Team + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * Neither the name of the The Musepack Development Team nor the + names of its contributors may be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef __MUSEPACK_CONFIG_WIN32_H__ +#define __MUSEPACK_CONFIG_WIN32_H__ + +typedef unsigned char mpc_bool_t; +#define TRUE 1 +#define FALSE 0 + +typedef __int16 mpc_int16_t; +typedef unsigned __int16 mpc_uint16_t; +typedef __int32 mpc_int32_t; +typedef unsigned __int32 mpc_uint32_t; +typedef __int64 mpc_int64_t; + +#endif // __MUSEPACK_CONFIG_WIN32_H__ diff --git a/Libraries/MPCDec/Files/include/mpcdec/decoder.h b/Libraries/MPCDec/Files/include/mpcdec/decoder.h new file mode 100644 index 000000000..1e9712231 --- /dev/null +++ b/Libraries/MPCDec/Files/include/mpcdec/decoder.h @@ -0,0 +1,148 @@ +/* + Copyright (c) 2005, The Musepack Development Team + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * Neither the name of the The Musepack Development Team nor the + names of its contributors may be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/// \file decoder.h + +#ifndef _mpcdec_decoder_h_ +#define _mpcdec_decoder_h_ + +#include "huffman.h" +#include "math.h" +#include "mpcdec.h" +#include "reader.h" +#include "streaminfo.h" + +enum { + MPC_V_MEM = 2304, + MPC_DECODER_MEMSIZE = 16384, // overall buffer size +}; + +typedef struct { + mpc_int32_t L [36]; + mpc_int32_t R [36]; +} QuantTyp; + +typedef struct mpc_decoder_t { + mpc_reader *r; + + /// @name internal state variables + //@{ + + mpc_uint32_t dword; /// actually decoded 32bit-word + mpc_uint32_t pos; /// bit-position within dword + mpc_uint32_t Speicher[MPC_DECODER_MEMSIZE]; /// read-buffer + mpc_uint32_t Zaehler; /// actual index within read-buffer + + mpc_uint32_t samples_to_skip; + + mpc_uint32_t FwdJumpInfo; + mpc_uint32_t ActDecodePos; + mpc_uint32_t FrameWasValid; + + mpc_uint32_t DecodedFrames; + mpc_uint32_t OverallFrames; + mpc_int32_t SampleRate; // Sample frequency + + mpc_uint32_t StreamVersion; // version of bitstream + mpc_uint32_t MS_used; // MS-coding used ? + mpc_int32_t Max_Band; + mpc_uint32_t MPCHeaderPos; // AB: needed to support ID3v2 + mpc_uint32_t LastValidSamples; + mpc_uint32_t TrueGaplessPresent; + + mpc_uint32_t EQ_activated; + + mpc_uint32_t WordsRead; // counts amount of decoded dwords + + // randomizer state variables + mpc_uint32_t __r1; + mpc_uint32_t __r2; + + mpc_uint32_t Q_bit [32]; + mpc_uint32_t Q_res [32][16]; + + // huffman table stuff + HuffmanTyp HuffHdr [10]; + HuffmanTyp HuffSCFI [ 4]; + HuffmanTyp HuffDSCF [16]; + HuffmanTyp* HuffQ [2] [8]; + + HuffmanTyp HuffQ1 [2] [3*3*3]; + HuffmanTyp HuffQ2 [2] [5*5]; + HuffmanTyp HuffQ3 [2] [ 7]; + HuffmanTyp HuffQ4 [2] [ 9]; + HuffmanTyp HuffQ5 [2] [15]; + HuffmanTyp HuffQ6 [2] [31]; + HuffmanTyp HuffQ7 [2] [63]; + const HuffmanTyp* SampleHuff [18]; + HuffmanTyp SCFI_Bundle [ 8]; + HuffmanTyp DSCF_Entropie [13]; + HuffmanTyp Region_A [16]; + HuffmanTyp Region_B [ 8]; + HuffmanTyp Region_C [ 4]; + + HuffmanTyp Entropie_1 [ 3]; + HuffmanTyp Entropie_2 [ 5]; + HuffmanTyp Entropie_3 [ 7]; + HuffmanTyp Entropie_4 [ 9]; + HuffmanTyp Entropie_5 [15]; + HuffmanTyp Entropie_6 [31]; + HuffmanTyp Entropie_7 [63]; + + mpc_int32_t SCF_Index_L [32] [3]; + mpc_int32_t SCF_Index_R [32] [3]; // holds scalefactor-indices + QuantTyp Q [32]; // holds quantized samples + mpc_int32_t Res_L [32]; + mpc_int32_t Res_R [32]; // holds the chosen quantizer for each subband + mpc_int32_t DSCF_Flag_L [32]; + mpc_int32_t DSCF_Flag_R [32]; // differential SCF used? + mpc_int32_t SCFI_L [32]; + mpc_int32_t SCFI_R [32]; // describes order of transmitted SCF + mpc_int32_t DSCF_Reference_L [32]; + mpc_int32_t DSCF_Reference_R [32]; // holds last frames SCF + mpc_int32_t MS_Flag[32]; // MS used? +#ifdef MPC_FIXED_POINT + unsigned char SCF_shift[256]; +#endif + + MPC_SAMPLE_FORMAT V_L[MPC_V_MEM + 960]; + MPC_SAMPLE_FORMAT V_R[MPC_V_MEM + 960]; + MPC_SAMPLE_FORMAT Y_L[36][32]; + MPC_SAMPLE_FORMAT Y_R[36][32]; + MPC_SAMPLE_FORMAT SCF[256]; ///< holds adapted scalefactors (for clipping prevention) + //@} + +} mpc_decoder; + +#endif // _mpc_decoder_h diff --git a/Libraries/MPCDec/Files/include/mpcdec/huffman.h b/Libraries/MPCDec/Files/include/mpcdec/huffman.h new file mode 100644 index 000000000..09542e314 --- /dev/null +++ b/Libraries/MPCDec/Files/include/mpcdec/huffman.h @@ -0,0 +1,80 @@ +/* + Copyright (c) 2005, The Musepack Development Team + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * Neither the name of the The Musepack Development Team nor the + names of its contributors may be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/// \file huffman.h +/// Data structures and functions for huffman coding. + +#ifndef _mpcdec_huffman_h_ +#define _mpcdec_huffman_h_ + +#ifndef WIN32 +#include "mpcdec/config_types.h" +#else +#include "mpcdec/config_win32.h" +#endif + +#include "decoder.h" + +struct mpc_decoder_t; // forward declare to break circular dependencies + +/// Huffman table entry. +typedef struct huffman_type_t { + mpc_uint32_t Code; + mpc_uint32_t Length; + mpc_int32_t Value; +} HuffmanTyp; + +//! \brief Sorts huffman-tables by codeword. +//! +//! offset resulting value. +//! \param elements +//! \param Table table to sort +//! \param offset offset of resulting sort +void +mpc_decoder_resort_huff_tables( + const mpc_uint32_t elements, HuffmanTyp *Table, const mpc_int32_t offset); + +/// Initializes sv6 huffman decoding structures. +void mpc_decoder_init_huffman_sv6(struct mpc_decoder_t *d); + +/// Initializes sv6 huffman decoding tables. +void mpc_decoder_init_huffman_sv6_tables(struct mpc_decoder_t *d); + +/// Initializes sv7 huffman decoding structures. +void mpc_decoder_init_huffman_sv7(struct mpc_decoder_t *d); + +/// Initializes sv7 huffman decoding tables. +void mpc_decoder_init_huffman_sv7_tables(struct mpc_decoder_t *d); + +#endif // _mpcdec_huffman_h_ diff --git a/Libraries/MPCDec/Files/include/mpcdec/internal.h b/Libraries/MPCDec/Files/include/mpcdec/internal.h new file mode 100644 index 000000000..b0d9c9fbb --- /dev/null +++ b/Libraries/MPCDec/Files/include/mpcdec/internal.h @@ -0,0 +1,67 @@ +/* + Copyright (c) 2005, The Musepack Development Team + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * Neither the name of the The Musepack Development Team nor the + names of its contributors may be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/// \file internal.h +/// Definitions and structures used only internally by the libmpcdec. + +#ifndef _mpcdec_internal_h +#define _mpcdec_internal_h + + +enum { + MPC_DECODER_SYNTH_DELAY = 481 +}; + +/// Big/little endian 32 bit byte swapping routine. +static __inline +mpc_uint32_t swap32(mpc_uint32_t val) { + const unsigned char* src = (const unsigned char*)&val; + return + (mpc_uint32_t)src[0] | + ((mpc_uint32_t)src[1] << 8) | ((mpc_uint32_t)src[2] << 16) | ((mpc_uint32_t)src[3] << 24); +} + +/// Searches for a ID3v2-tag and reads the length (in bytes) of it. +/// \param reader supplying raw stream data +/// \return size of tag, in bytes +/// \return -1 on errors of any kind +mpc_int32_t JumpID3v2(mpc_reader* fp); + +/// helper functions used by multiple files +mpc_uint32_t mpc_random_int(mpc_decoder *d); // in synth_filter.c +void mpc_decoder_initialisiere_quantisierungstabellen(mpc_decoder *d, double scale_factor); +void mpc_decoder_synthese_filter_float(mpc_decoder *d, MPC_SAMPLE_FORMAT* OutData); + +#endif // _mpcdec_internal_h + diff --git a/Libraries/MPCDec/Files/include/mpcdec/math.h b/Libraries/MPCDec/Files/include/mpcdec/math.h new file mode 100644 index 000000000..31d078896 --- /dev/null +++ b/Libraries/MPCDec/Files/include/mpcdec/math.h @@ -0,0 +1,144 @@ +/* + Copyright (c) 2005, The Musepack Development Team + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * Neither the name of the The Musepack Development Team nor the + names of its contributors may be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/// \file math.h +/// Libmpcdec internal math routines. + +#ifndef _mpcdec_math_h_ +#define _mpcdec_math_h_ + +//#define MPC_FIXED_POINT + +#define MPC_FIXED_POINT_SHIFT 16 + +#ifdef MPC_FIXED_POINT + + +#ifdef _WIN32_WCE + +#include + +#define MPC_HAVE_MULHIGH + +#endif + + +#define MPC_FIXED_POINT_SCALE_SHIFT (MPC_FIXED_POINT_SHIFT + MPC_FIXED_POINT_FRACTPART) +#define MPC_FIXED_POINT_SCALE (1 << (MPC_FIXED_POINT_SCALE_SHIFT - 1)) + + +//in fixedpoint mode, results in decode output buffer are in -MPC_FIXED_POINT_SCALE ... MPC_FIXED_POINT_SCALE range + +#define MPC_FIXED_POINT_FRACTPART 14 +typedef mpc_int32_t MPC_SAMPLE_FORMAT; + +typedef mpc_int64_t MPC_SAMPLE_FORMAT_MULTIPLY; + +#define MAKE_MPC_SAMPLE(X) (MPC_SAMPLE_FORMAT)((double)(X) * (double)(((mpc_int64_t)1)<> MPC_FIXED_POINT_FRACTPART) + +#define MPC_MULTIPLY_EX_NOTRUNCATE(X,Y,Z) \ + (((MPC_SAMPLE_FORMAT_MULTIPLY)(X) * (MPC_SAMPLE_FORMAT_MULTIPLY)(Y)) >> (Z)) + +#ifdef _DEBUG +static inline MPC_SAMPLE_FORMAT MPC_MULTIPLY(MPC_SAMPLE_FORMAT item1,MPC_SAMPLE_FORMAT item2) +{ + MPC_SAMPLE_FORMAT_MULTIPLY temp = MPC_MULTIPLY_NOTRUNCATE(item1,item2); + assert(temp == (MPC_SAMPLE_FORMAT_MULTIPLY)(MPC_SAMPLE_FORMAT)temp); + return (MPC_SAMPLE_FORMAT)temp; +} + +static inline MPC_SAMPLE_FORMAT MPC_MULTIPLY_EX(MPC_SAMPLE_FORMAT item1,MPC_SAMPLE_FORMAT item2,unsigned shift) +{ + MPC_SAMPLE_FORMAT_MULTIPLY temp = MPC_MULTIPLY_EX_NOTRUNCATE(item1,item2,shift); + assert(temp == (MPC_SAMPLE_FORMAT_MULTIPLY)(MPC_SAMPLE_FORMAT)temp); + return (MPC_SAMPLE_FORMAT)temp; +} + +#else + +#define MPC_MULTIPLY(X,Y) ((MPC_SAMPLE_FORMAT)MPC_MULTIPLY_NOTRUNCATE(X,Y)) +#define MPC_MULTIPLY_EX(X,Y,Z) ((MPC_SAMPLE_FORMAT)MPC_MULTIPLY_EX_NOTRUNCATE(X,Y,Z)) + +#endif + +#ifdef MPC_HAVE_MULHIGH +#define MPC_MULTIPLY_FRACT(X,Y) _MulHigh(X,Y) +#else +#define MPC_MULTIPLY_FRACT(X,Y) MPC_MULTIPLY_EX(X,Y,32) +#endif + +#define MPC_MAKE_FRACT_CONST(X) (MPC_SAMPLE_FORMAT)((X) * (double)(((mpc_int64_t)1)<<32) ) +#define MPC_MULTIPLY_FRACT_CONST(X,Y) MPC_MULTIPLY_FRACT(X,MPC_MAKE_FRACT_CONST(Y)) +#define MPC_MULTIPLY_FRACT_CONST_FIX(X,Y,Z) ( MPC_MULTIPLY_FRACT(X,MPC_MAKE_FRACT_CONST( Y / (1<<(Z)) )) << (Z) ) +#define MPC_MULTIPLY_FRACT_CONST_SHR(X,Y,Z) MPC_MULTIPLY_FRACT(X,MPC_MAKE_FRACT_CONST( Y / (1<<(Z)) )) + +#define MPC_MULTIPLY_FLOAT_INT(X,Y) ((X)*(Y)) +#define MPC_SCALE_CONST(X,Y,Z) MPC_MULTIPLY_EX(X,MAKE_MPC_SAMPLE_EX(Y,Z),(Z)) +#define MPC_SCALE_CONST_SHL(X,Y,Z,S) MPC_MULTIPLY_EX(X,MAKE_MPC_SAMPLE_EX(Y,Z),(Z)-(S)) +#define MPC_SCALE_CONST_SHR(X,Y,Z,S) MPC_MULTIPLY_EX(X,MAKE_MPC_SAMPLE_EX(Y,Z),(Z)+(S)) +#define MPC_SHR(X,Y) ((X)>>(Y)) +#define MPC_SHL(X,Y) ((X)<<(Y)) + +#else + +//in floating-point mode, decoded samples are in -1...1 range + +typedef float MPC_SAMPLE_FORMAT; + +#define MAKE_MPC_SAMPLE(X) ((MPC_SAMPLE_FORMAT)(X)) +#define MAKE_MPC_SAMPLE_EX(X,Y) ((MPC_SAMPLE_FORMAT)(X)) + +#define MPC_MULTIPLY_FRACT(X,Y) ((X)*(Y)) +#define MPC_MAKE_FRACT_CONST(X) (X) +#define MPC_MULTIPLY_FRACT_CONST(X,Y) MPC_MULTPLY_FRACT(X,MPC_MAKE_FRACT_CONST(Y)) +#define MPC_MULTIPLY_FRACT_CONST_SHR(X,Y,Z) MPC_MULTIPLY_FRACT(X,MPC_MAKE_FRACT_CONST( Y )) +#define MPC_MULTIPLY_FRACT_CONST_FIX(X,Y,Z) MPC_MULTIPLY_FRACT(X,MPC_MAKE_FRACT_CONST( Y )) + +#define MPC_MULTIPLY_FLOAT_INT(X,Y) ((X)*(Y)) +#define MPC_MULTIPLY(X,Y) ((X)*(Y)) +#define MPC_MULTIPLY_EX(X,Y,Z) ((X)*(Y)) +#define MPC_SCALE_CONST(X,Y,Z) ((X)*(Y)) +#define MPC_SCALE_CONST_SHL(X,Y,Z,S) ((X)*(Y)) +#define MPC_SCALE_CONST_SHR(X,Y,Z,S) ((X)*(Y)) +#define MPC_SHR(X,Y) (X) +#define MPC_SHL(X,Y) (X) + +#endif + +#endif // _mpcdec_math_h_ + diff --git a/Libraries/MPCDec/Files/include/mpcdec/mpcdec.h b/Libraries/MPCDec/Files/include/mpcdec/mpcdec.h new file mode 100644 index 000000000..faa6a78cf --- /dev/null +++ b/Libraries/MPCDec/Files/include/mpcdec/mpcdec.h @@ -0,0 +1,132 @@ +/* + Copyright (c) 2005, The Musepack Development Team + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * Neither the name of the The Musepack Development Team nor the + names of its contributors may be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/// \file mpcdec.h +/// Top level include file for libmpcdec. + +#ifndef _mpcdec_h_ +#define _mpcdec_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +#ifndef WIN32 +#include "mpcdec/config_types.h" +#else +#include "mpcdec/config_win32.h" +#endif + +#include "decoder.h" +#include "math.h" +#include "reader.h" +#include "streaminfo.h" + +enum { + MPC_FRAME_LENGTH = (36 * 32), /// samples per mpc frame + MPC_DECODER_BUFFER_LENGTH = 4 * MPC_FRAME_LENGTH /// required buffer size for decoder +}; + +// error codes +#define ERROR_CODE_OK 0 +#define ERROR_CODE_FILE -1 +#define ERROR_CODE_SV7BETA 1 +#define ERROR_CODE_CBR 2 +#define ERROR_CODE_IS 3 +#define ERROR_CODE_BLOCKSIZE 4 +#define ERROR_CODE_INVALIDSV 5 + +/// Initializes a streaminfo structure. +/// \param si streaminfo structure to initialize +void mpc_streaminfo_init(mpc_streaminfo *si); + +/// Reads streaminfo header from the mpc stream supplied by r. +/// \param si streaminfo pointer to which info will be written +/// \param r stream reader to supply raw data +/// \return error code +mpc_int32_t mpc_streaminfo_read(mpc_streaminfo *si, mpc_reader *r); + +/// Gets length of stream si, in seconds. +/// \return length of stream in seconds +double mpc_streaminfo_get_length(mpc_streaminfo *si); + +/// Returns length of stream si, in samples. +/// \return length of stream in samples +mpc_int64_t mpc_streaminfo_get_length_samples(mpc_streaminfo *si); + +/// Sets up decoder library. +/// Call this first when preparing to decode an mpc stream. +/// \param r reader that will supply raw data to the decoder +void mpc_decoder_setup(mpc_decoder *d, mpc_reader *r); + +/// Initializes mpc decoder with the supplied stream info parameters. +/// Call this next after calling mpc_decoder_setup. +/// \param si streaminfo structure indicating format of source stream +/// \return TRUE if decoder was initalized successfully, FALSE otherwise +mpc_bool_t mpc_decoder_initialize(mpc_decoder *d, mpc_streaminfo *si); + +/// Sets decoder sample scaling factor. All decoded samples will be multiplied +/// by this factor. +/// \param scale_factor multiplicative scaling factor +void mpc_decoder_scale_output(mpc_decoder *d, double scale_factor); + +/// Actually reads data from previously initialized stream. Call +/// this iteratively to decode the mpc stream. +/// \param buffer destination buffer for decoded samples +/// \param vbr_update_acc \todo document me +/// \param vbr_update_bits \todo document me +/// \return -1 if an error is encountered +/// \return 0 if the stream has been completely decoded successfully and there are no more samples +/// \return > 0 to indicate the number of bytes that were actually read from the stream. +mpc_uint32_t mpc_decoder_decode( + mpc_decoder *d, + MPC_SAMPLE_FORMAT *buffer, + mpc_uint32_t *vbr_update_acc, + mpc_uint32_t *vbr_update_bits); + +/// Seeks to the specified sample in the source stream. +mpc_bool_t mpc_decoder_seek_sample(mpc_decoder *d, mpc_int64_t destsample); + +/// Seeks to specified position in seconds in the source stream. +mpc_bool_t mpc_decoder_seek_seconds(mpc_decoder *d, double seconds); + +#ifdef __cplusplus +} +#endif // __cplusplus + +#endif // _mpcdec_h_ diff --git a/Libraries/MPCDec/Files/include/mpcdec/reader.h b/Libraries/MPCDec/Files/include/mpcdec/reader.h new file mode 100644 index 000000000..3d4f57edc --- /dev/null +++ b/Libraries/MPCDec/Files/include/mpcdec/reader.h @@ -0,0 +1,82 @@ +/* + Copyright (c) 2005, The Musepack Development Team + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * Neither the name of the The Musepack Development Team nor the + names of its contributors may be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/// \file reader.h + +#ifndef _mpcdec_reader_h_ +#define _mpcdec_reader_h_ + +/// \brief Stream reader interface structure. +/// +/// This is the structure you must supply to the musepack decoding library +/// to feed it with raw data. Implement the five member functions to provide +/// a functional reader. +typedef struct mpc_reader_t { + /// Reads size bytes of data into buffer at ptr. + mpc_int32_t (*read)(void *t, void *ptr, mpc_int32_t size); + + /// Seeks to byte position offset. + mpc_bool_t (*seek)(void *t, mpc_int32_t offset); + + /// Returns the current byte offset in the stream. + mpc_int32_t (*tell)(void *t); + + /// Returns the total length of the source stream, in bytes. + mpc_int32_t (*get_size)(void *t); + + /// True if the stream is a seekable stream. + mpc_bool_t (*canseek)(void *t); + + /// Field that can be used to identify a particular instance of + /// reader or carry along data associated with that reader. + void *data; + +} mpc_reader; + +typedef struct mpc_reader_file_t { + mpc_reader reader; + + FILE *file; + long file_size; + mpc_bool_t is_seekable; +} mpc_reader_file; + +/// Initializes reader with default stdio file reader implementation. Use +/// this if you're just reading from a plain file. +/// +/// \param r reader struct to initalize +/// \param input input stream to attach to the reader +void mpc_reader_setup_file_reader(mpc_reader_file *r, FILE *input); + +#endif // _mpcdec_reader_h_ diff --git a/Libraries/MPCDec/Files/include/mpcdec/requant.h b/Libraries/MPCDec/Files/include/mpcdec/requant.h new file mode 100644 index 000000000..a0aab981b --- /dev/null +++ b/Libraries/MPCDec/Files/include/mpcdec/requant.h @@ -0,0 +1,51 @@ +/* + Copyright (c) 2005, The Musepack Development Team + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * Neither the name of the The Musepack Development Team nor the + names of its contributors may be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/// \file requant.h +/// Requantization function definitions. + +#ifndef _mpcdec_requant_h +#define _mpcdec_requant_h_ + +#include "mpcdec.h" + +/* C O N S T A N T S */ +extern const mpc_uint32_t Res_bit [18]; // bits per sample for chosen quantizer +extern const MPC_SAMPLE_FORMAT __Cc [1 + 18]; // coefficients for requantization +extern const mpc_int32_t __Dc [1 + 18]; // offset for requantization + +#define Cc (__Cc + 1) +#define Dc (__Dc + 1) + +#endif // _mpcdec_requant_h_ diff --git a/Libraries/MPCDec/Files/include/mpcdec/streaminfo.h b/Libraries/MPCDec/Files/include/mpcdec/streaminfo.h new file mode 100644 index 000000000..6c4b4ca10 --- /dev/null +++ b/Libraries/MPCDec/Files/include/mpcdec/streaminfo.h @@ -0,0 +1,86 @@ +/* + Copyright (c) 2005, The Musepack Development Team + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * Neither the name of the The Musepack Development Team nor the + names of its contributors may be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/// \file streaminfo.h + +#ifndef _mpcdec_streaminfo_h_ +#define _mpcdec_streaminfo_h_ + +typedef mpc_int32_t mpc_streaminfo_off_t; + +/// \brief mpc stream properties structure +/// +/// Structure containing all the properties of an mpc stream. Populated +/// by the streaminfo_read function. +typedef struct mpc_streaminfo { + /// @name core mpc stream properties + //@{ + mpc_uint32_t sample_freq; ///< sample frequency of stream + mpc_uint32_t channels; ///< number of channels in stream + mpc_streaminfo_off_t header_position; ///< byte offset of position of header in stream + mpc_uint32_t stream_version; ///< streamversion of stream + mpc_uint32_t bitrate; ///< bitrate of stream file (in bps) + double average_bitrate; ///< average bitrate of stream (in bits/sec) + mpc_uint32_t frames; ///< number of frames in stream + mpc_int64_t pcm_samples; + mpc_uint32_t max_band; ///< maximum band-index used in stream (0...31) + mpc_uint32_t is; ///< intensity stereo (0: off, 1: on) + mpc_uint32_t ms; ///< mid/side stereo (0: off, 1: on) + mpc_uint32_t block_size; ///< only needed for SV4...SV6 -> not supported + mpc_uint32_t profile; ///< quality profile of stream + const char* profile_name; ///< name of profile used by stream + //@} + + /// @name replaygain related fields + //@{ + mpc_int16_t gain_title; ///< replaygain title value + mpc_int16_t gain_album; ///< replaygain album value + mpc_uint16_t peak_album; ///< peak album loudness level + mpc_uint16_t peak_title; ///< peak title loudness level + //@} + + /// @name true gapless support data + //@{ + mpc_uint32_t is_true_gapless; ///< true gapless? (0: no, 1: yes) + mpc_uint32_t last_frame_samples; ///< number of valid samples within last frame + + mpc_uint32_t encoder_version; ///< version of encoder used + char encoder[256]; ///< encoder name + + mpc_streaminfo_off_t tag_offset; ///< offset to file tags + mpc_streaminfo_off_t total_file_length; ///< total length of underlying file + //@} +} mpc_streaminfo; + +#endif // _mpcdec_streaminfo_h_ diff --git a/Libraries/MPCDec/Files/src/huffsv46.c b/Libraries/MPCDec/Files/src/huffsv46.c new file mode 100644 index 000000000..d82fb2fe2 --- /dev/null +++ b/Libraries/MPCDec/Files/src/huffsv46.c @@ -0,0 +1,268 @@ +/* + Copyright (c) 2005, The Musepack Development Team + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * Neither the name of the The Musepack Development Team nor the + names of its contributors may be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/// \file huffsv46.c +/// Implementations of huffman decoding for streamversions < 7. + +#include +#include +#include + +void +mpc_decoder_init_huffman_sv6(mpc_decoder *d) +{ + mpc_decoder_init_huffman_sv6_tables(d); + mpc_decoder_resort_huff_tables(16, d->Region_A , 0); + mpc_decoder_resort_huff_tables( 8, d->Region_B , 0); + mpc_decoder_resort_huff_tables( 4, d->Region_C , 0); + mpc_decoder_resort_huff_tables( 8, d->SCFI_Bundle , 0); + mpc_decoder_resort_huff_tables(13, d->DSCF_Entropie , 6); + mpc_decoder_resort_huff_tables( 3, d->Entropie_1 , Dc[1]); + mpc_decoder_resort_huff_tables( 5, d->Entropie_2 , Dc[2]); + mpc_decoder_resort_huff_tables( 7, d->Entropie_3 , Dc[3]); + mpc_decoder_resort_huff_tables( 9, d->Entropie_4 , Dc[4]); + mpc_decoder_resort_huff_tables(15, d->Entropie_5 , Dc[5]); + mpc_decoder_resort_huff_tables(31, d->Entropie_6 , Dc[6]); + mpc_decoder_resort_huff_tables(63, d->Entropie_7 , Dc[7]); +} + +void +mpc_decoder_init_huffman_sv6_tables(mpc_decoder *d) +{ + // SCFI-bundle + d->SCFI_Bundle[7].Code= 1; d->SCFI_Bundle[7].Length= 1; + d->SCFI_Bundle[3].Code= 1; d->SCFI_Bundle[3].Length= 2; + d->SCFI_Bundle[5].Code= 0; d->SCFI_Bundle[5].Length= 3; + d->SCFI_Bundle[1].Code= 7; d->SCFI_Bundle[1].Length= 5; + d->SCFI_Bundle[2].Code= 6; d->SCFI_Bundle[2].Length= 5; + d->SCFI_Bundle[4].Code= 4; d->SCFI_Bundle[4].Length= 5; + d->SCFI_Bundle[0].Code= 11; d->SCFI_Bundle[0].Length= 6; + d->SCFI_Bundle[6].Code= 10; d->SCFI_Bundle[6].Length= 6; + + // region A (subbands 0..10) + d->Region_A[ 1].Code= 1; d->Region_A[ 1].Length= 1; + d->Region_A[ 2].Code= 0; d->Region_A[ 2].Length= 2; + d->Region_A[ 0].Code= 2; d->Region_A[ 0].Length= 3; + d->Region_A[ 3].Code= 15; d->Region_A[ 3].Length= 5; + d->Region_A[ 5].Code= 13; d->Region_A[ 5].Length= 5; + d->Region_A[ 6].Code= 12; d->Region_A[ 6].Length= 5; + d->Region_A[ 4].Code= 29; d->Region_A[ 4].Length= 6; + d->Region_A[ 7].Code= 57; d->Region_A[ 7].Length= 7; + d->Region_A[ 8].Code= 113; d->Region_A[ 8].Length= 8; + d->Region_A[ 9].Code= 225; d->Region_A[ 9].Length= 9; + d->Region_A[10].Code= 449; d->Region_A[10].Length= 10; + d->Region_A[11].Code= 897; d->Region_A[11].Length= 11; + d->Region_A[12].Code= 1793; d->Region_A[12].Length= 12; + d->Region_A[13].Code= 3585; d->Region_A[13].Length= 13; + d->Region_A[14].Code= 7169; d->Region_A[14].Length= 14; + d->Region_A[15].Code= 7168; d->Region_A[15].Length= 14; + + // region B (subbands 11..22) + d->Region_B[1].Code= 1; d->Region_B[1].Length= 1; + d->Region_B[0].Code= 1; d->Region_B[0].Length= 2; + d->Region_B[2].Code= 1; d->Region_B[2].Length= 3; + d->Region_B[3].Code= 1; d->Region_B[3].Length= 4; + d->Region_B[4].Code= 1; d->Region_B[4].Length= 5; + d->Region_B[5].Code= 1; d->Region_B[5].Length= 6; + d->Region_B[6].Code= 1; d->Region_B[6].Length= 7; + d->Region_B[7].Code= 0; d->Region_B[7].Length= 7; + + // region C (subbands 23..31) + d->Region_C[0].Code= 1; d->Region_C[0].Length= 1; + d->Region_C[1].Code= 1; d->Region_C[1].Length= 2; + d->Region_C[2].Code= 1; d->Region_C[2].Length= 3; + d->Region_C[3].Code= 0; d->Region_C[3].Length= 3; + + // DSCF + d->DSCF_Entropie[ 6].Code= 0; d->DSCF_Entropie[ 6].Length= 2; + d->DSCF_Entropie[ 7].Code= 7; d->DSCF_Entropie[ 7].Length= 3; + d->DSCF_Entropie[ 5].Code= 4; d->DSCF_Entropie[ 5].Length= 3; + d->DSCF_Entropie[ 8].Code= 3; d->DSCF_Entropie[ 8].Length= 3; + d->DSCF_Entropie[ 9].Code= 13; d->DSCF_Entropie[ 9].Length= 4; + d->DSCF_Entropie[ 4].Code= 11; d->DSCF_Entropie[ 4].Length= 4; + d->DSCF_Entropie[10].Code= 10; d->DSCF_Entropie[10].Length= 4; + d->DSCF_Entropie[ 2].Code= 4; d->DSCF_Entropie[ 2].Length= 4; + d->DSCF_Entropie[11].Code= 25; d->DSCF_Entropie[11].Length= 5; + d->DSCF_Entropie[ 3].Code= 24; d->DSCF_Entropie[ 3].Length= 5; + d->DSCF_Entropie[ 1].Code= 11; d->DSCF_Entropie[ 1].Length= 5; + d->DSCF_Entropie[12].Code= 21; d->DSCF_Entropie[12].Length= 6; + d->DSCF_Entropie[ 0].Code= 20; d->DSCF_Entropie[ 0].Length= 6; + + // first quantizer + d->Entropie_1[1].Code= 1; d->Entropie_1[1].Length= 1; + d->Entropie_1[0].Code= 1; d->Entropie_1[0].Length= 2; + d->Entropie_1[2].Code= 0; d->Entropie_1[2].Length= 2; + + // second quantizer + d->Entropie_2[2].Code= 3; d->Entropie_2[2].Length= 2; + d->Entropie_2[3].Code= 1; d->Entropie_2[3].Length= 2; + d->Entropie_2[1].Code= 0; d->Entropie_2[1].Length= 2; + d->Entropie_2[4].Code= 5; d->Entropie_2[4].Length= 3; + d->Entropie_2[0].Code= 4; d->Entropie_2[0].Length= 3; + + // third quantizer + d->Entropie_3[3].Code= 3; d->Entropie_3[3].Length= 2; + d->Entropie_3[2].Code= 1; d->Entropie_3[2].Length= 2; + d->Entropie_3[4].Code= 0; d->Entropie_3[4].Length= 2; + d->Entropie_3[1].Code= 5; d->Entropie_3[1].Length= 3; + d->Entropie_3[5].Code= 9; d->Entropie_3[5].Length= 4; + d->Entropie_3[0].Code= 17; d->Entropie_3[0].Length= 5; + d->Entropie_3[6].Code= 16; d->Entropie_3[6].Length= 5; + + // forth quantizer + d->Entropie_4[4].Code= 0; d->Entropie_4[4].Length= 2; + d->Entropie_4[5].Code= 6; d->Entropie_4[5].Length= 3; + d->Entropie_4[3].Code= 5; d->Entropie_4[3].Length= 3; + d->Entropie_4[6].Code= 4; d->Entropie_4[6].Length= 3; + d->Entropie_4[2].Code= 3; d->Entropie_4[2].Length= 3; + d->Entropie_4[7].Code= 15; d->Entropie_4[7].Length= 4; + d->Entropie_4[1].Code= 14; d->Entropie_4[1].Length= 4; + d->Entropie_4[0].Code= 5; d->Entropie_4[0].Length= 4; + d->Entropie_4[8].Code= 4; d->Entropie_4[8].Length= 4; + + // fifth quantizer + d->Entropie_5[7 ].Code= 4; d->Entropie_5[7 ].Length= 3; + d->Entropie_5[8 ].Code= 3; d->Entropie_5[8 ].Length= 3; + d->Entropie_5[6 ].Code= 2; d->Entropie_5[6 ].Length= 3; + d->Entropie_5[9 ].Code= 0; d->Entropie_5[9 ].Length= 3; + d->Entropie_5[5 ].Code= 15; d->Entropie_5[5 ].Length= 4; + d->Entropie_5[4 ].Code= 13; d->Entropie_5[4 ].Length= 4; + d->Entropie_5[10].Code= 12; d->Entropie_5[10].Length= 4; + d->Entropie_5[11].Code= 10; d->Entropie_5[11].Length= 4; + d->Entropie_5[3 ].Code= 3; d->Entropie_5[3 ].Length= 4; + d->Entropie_5[12].Code= 2; d->Entropie_5[12].Length= 4; + d->Entropie_5[2 ].Code= 29; d->Entropie_5[2 ].Length= 5; + d->Entropie_5[1 ].Code= 23; d->Entropie_5[1 ].Length= 5; + d->Entropie_5[13].Code= 22; d->Entropie_5[13].Length= 5; + d->Entropie_5[0 ].Code= 57; d->Entropie_5[0 ].Length= 6; + d->Entropie_5[14].Code= 56; d->Entropie_5[14].Length= 6; + + // sixth quantizer + d->Entropie_6[15].Code= 9; d->Entropie_6[15].Length= 4; + d->Entropie_6[16].Code= 8; d->Entropie_6[16].Length= 4; + d->Entropie_6[14].Code= 7; d->Entropie_6[14].Length= 4; + d->Entropie_6[18].Code= 6; d->Entropie_6[18].Length= 4; + d->Entropie_6[17].Code= 5; d->Entropie_6[17].Length= 4; + d->Entropie_6[12].Code= 3; d->Entropie_6[12].Length= 4; + d->Entropie_6[13].Code= 2; d->Entropie_6[13].Length= 4; + d->Entropie_6[19].Code= 0; d->Entropie_6[19].Length= 4; + d->Entropie_6[11].Code= 31; d->Entropie_6[11].Length= 5; + d->Entropie_6[20].Code= 30; d->Entropie_6[20].Length= 5; + d->Entropie_6[10].Code= 29; d->Entropie_6[10].Length= 5; + d->Entropie_6[9 ].Code= 27; d->Entropie_6[9 ].Length= 5; + d->Entropie_6[21].Code= 26; d->Entropie_6[21].Length= 5; + d->Entropie_6[22].Code= 25; d->Entropie_6[22].Length= 5; + d->Entropie_6[8 ].Code= 24; d->Entropie_6[8 ].Length= 5; + d->Entropie_6[7 ].Code= 23; d->Entropie_6[7 ].Length= 5; + d->Entropie_6[23].Code= 21; d->Entropie_6[23].Length= 5; + d->Entropie_6[6 ].Code= 9; d->Entropie_6[6 ].Length= 5; + d->Entropie_6[24].Code= 3; d->Entropie_6[24].Length= 5; + d->Entropie_6[25].Code= 57; d->Entropie_6[25].Length= 6; + d->Entropie_6[5 ].Code= 56; d->Entropie_6[5 ].Length= 6; + d->Entropie_6[4 ].Code= 45; d->Entropie_6[4 ].Length= 6; + d->Entropie_6[26].Code= 41; d->Entropie_6[26].Length= 6; + d->Entropie_6[2 ].Code= 40; d->Entropie_6[2 ].Length= 6; + d->Entropie_6[27].Code= 17; d->Entropie_6[27].Length= 6; + d->Entropie_6[28].Code= 16; d->Entropie_6[28].Length= 6; + d->Entropie_6[3 ].Code= 5; d->Entropie_6[3 ].Length= 6; + d->Entropie_6[29].Code= 89; d->Entropie_6[29].Length= 7; + d->Entropie_6[1 ].Code= 88; d->Entropie_6[1 ].Length= 7; + d->Entropie_6[30].Code= 9; d->Entropie_6[30].Length= 7; + d->Entropie_6[0 ].Code= 8; d->Entropie_6[0 ].Length= 7; + + // seventh quantizer + d->Entropie_7[25].Code= 0; d->Entropie_7[25].Length= 5; + d->Entropie_7[37].Code= 1; d->Entropie_7[37].Length= 5; + d->Entropie_7[62].Code= 16; d->Entropie_7[62].Length= 8; + d->Entropie_7[ 0].Code= 17; d->Entropie_7[ 0].Length= 8; + d->Entropie_7[ 3].Code= 9; d->Entropie_7[ 3].Length= 7; + d->Entropie_7[ 5].Code= 10; d->Entropie_7[ 5].Length= 7; + d->Entropie_7[ 6].Code= 11; d->Entropie_7[ 6].Length= 7; + d->Entropie_7[38].Code= 3; d->Entropie_7[38].Length= 5; + d->Entropie_7[35].Code= 4; d->Entropie_7[35].Length= 5; + d->Entropie_7[33].Code= 5; d->Entropie_7[33].Length= 5; + d->Entropie_7[24].Code= 6; d->Entropie_7[24].Length= 5; + d->Entropie_7[27].Code= 7; d->Entropie_7[27].Length= 5; + d->Entropie_7[26].Code= 8; d->Entropie_7[26].Length= 5; + d->Entropie_7[12].Code= 18; d->Entropie_7[12].Length= 6; + d->Entropie_7[50].Code= 19; d->Entropie_7[50].Length= 6; + d->Entropie_7[29].Code= 10; d->Entropie_7[29].Length= 5; + d->Entropie_7[31].Code= 11; d->Entropie_7[31].Length= 5; + d->Entropie_7[36].Code= 12; d->Entropie_7[36].Length= 5; + d->Entropie_7[34].Code= 13; d->Entropie_7[34].Length= 5; + d->Entropie_7[28].Code= 14; d->Entropie_7[28].Length= 5; + d->Entropie_7[49].Code= 30; d->Entropie_7[49].Length= 6; + d->Entropie_7[56].Code= 62; d->Entropie_7[56].Length= 7; + d->Entropie_7[ 7].Code= 63; d->Entropie_7[ 7].Length= 7; + d->Entropie_7[32].Code= 16; d->Entropie_7[32].Length= 5; + d->Entropie_7[30].Code= 17; d->Entropie_7[30].Length= 5; + d->Entropie_7[13].Code= 36; d->Entropie_7[13].Length= 6; + d->Entropie_7[55].Code= 74; d->Entropie_7[55].Length= 7; + d->Entropie_7[61].Code= 150; d->Entropie_7[61].Length= 8; + d->Entropie_7[ 1].Code= 151; d->Entropie_7[ 1].Length= 8; + d->Entropie_7[14].Code= 38; d->Entropie_7[14].Length= 6; + d->Entropie_7[48].Code= 39; d->Entropie_7[48].Length= 6; + d->Entropie_7[ 4].Code= 80; d->Entropie_7[ 4].Length= 7; + d->Entropie_7[58].Code= 81; d->Entropie_7[58].Length= 7; + d->Entropie_7[47].Code= 41; d->Entropie_7[47].Length= 6; + d->Entropie_7[15].Code= 42; d->Entropie_7[15].Length= 6; + d->Entropie_7[16].Code= 43; d->Entropie_7[16].Length= 6; + d->Entropie_7[54].Code= 88; d->Entropie_7[54].Length= 7; + d->Entropie_7[ 8].Code= 89; d->Entropie_7[ 8].Length= 7; + d->Entropie_7[17].Code= 45; d->Entropie_7[17].Length= 6; + d->Entropie_7[46].Code= 46; d->Entropie_7[46].Length= 6; + d->Entropie_7[45].Code= 47; d->Entropie_7[45].Length= 6; + d->Entropie_7[53].Code= 96; d->Entropie_7[53].Length= 7; + d->Entropie_7[ 9].Code= 97; d->Entropie_7[ 9].Length= 7; + d->Entropie_7[43].Code= 49; d->Entropie_7[43].Length= 6; + d->Entropie_7[19].Code= 50; d->Entropie_7[19].Length= 6; + d->Entropie_7[18].Code= 51; d->Entropie_7[18].Length= 6; + d->Entropie_7[44].Code= 52; d->Entropie_7[44].Length= 6; + d->Entropie_7[ 2].Code= 212; d->Entropie_7[ 2].Length= 8; + d->Entropie_7[60].Code= 213; d->Entropie_7[60].Length= 8; + d->Entropie_7[10].Code= 107; d->Entropie_7[10].Length= 7; + d->Entropie_7[42].Code= 54; d->Entropie_7[42].Length= 6; + d->Entropie_7[41].Code= 55; d->Entropie_7[41].Length= 6; + d->Entropie_7[20].Code= 56; d->Entropie_7[20].Length= 6; + d->Entropie_7[21].Code= 57; d->Entropie_7[21].Length= 6; + d->Entropie_7[52].Code= 116; d->Entropie_7[52].Length= 7; + d->Entropie_7[51].Code= 117; d->Entropie_7[51].Length= 7; + d->Entropie_7[40].Code= 59; d->Entropie_7[40].Length= 6; + d->Entropie_7[22].Code= 60; d->Entropie_7[22].Length= 6; + d->Entropie_7[23].Code= 61; d->Entropie_7[23].Length= 6; + d->Entropie_7[39].Code= 62; d->Entropie_7[39].Length= 6; + d->Entropie_7[11].Code= 126; d->Entropie_7[11].Length= 7; + d->Entropie_7[57].Code= 254; d->Entropie_7[57].Length= 8; + d->Entropie_7[59].Code= 255; d->Entropie_7[59].Length= 8; +} diff --git a/Libraries/MPCDec/Files/src/huffsv7.c b/Libraries/MPCDec/Files/src/huffsv7.c new file mode 100644 index 000000000..d4cd3a399 --- /dev/null +++ b/Libraries/MPCDec/Files/src/huffsv7.c @@ -0,0 +1,500 @@ +/* + Copyright (c) 2005, The Musepack Development Team + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * Neither the name of the The Musepack Development Team nor the + names of its contributors may be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/// \file huffsv7.c +/// Implementations of sv7 huffman decoding functions. + +#include +#include +#include + +void +mpc_decoder_init_huffman_sv7(mpc_decoder *d) +{ + mpc_decoder_init_huffman_sv7_tables(d); + mpc_decoder_resort_huff_tables(10, &(d->HuffHdr[0]) , 5); + mpc_decoder_resort_huff_tables( 4, &(d->HuffSCFI[0]) , 0); + mpc_decoder_resort_huff_tables(16, &(d->HuffDSCF[0]) , 7); + mpc_decoder_resort_huff_tables(27, &(d->HuffQ1[0][0]) , 0); + mpc_decoder_resort_huff_tables(27, &(d->HuffQ1[1][0]) , 0); + mpc_decoder_resort_huff_tables(25, &(d->HuffQ2[0][0]) , 0); + mpc_decoder_resort_huff_tables(25, &(d->HuffQ2[1][0]) , 0); + mpc_decoder_resort_huff_tables( 7, &(d->HuffQ3[0][0]) , Dc[3]); + mpc_decoder_resort_huff_tables( 7, &(d->HuffQ3[1][0]) , Dc[3]); + mpc_decoder_resort_huff_tables( 9, &(d->HuffQ4[0][0]) , Dc[4]); + mpc_decoder_resort_huff_tables( 9, &(d->HuffQ4[1][0]) , Dc[4]); + mpc_decoder_resort_huff_tables(15, &(d->HuffQ5[0][0]) , Dc[5]); + mpc_decoder_resort_huff_tables(15, &(d->HuffQ5[1][0]) , Dc[5]); + mpc_decoder_resort_huff_tables(31, &(d->HuffQ6[0][0]) , Dc[6]); + mpc_decoder_resort_huff_tables(31, &(d->HuffQ6[1][0]) , Dc[6]); + mpc_decoder_resort_huff_tables(63, &(d->HuffQ7[0][0]) , Dc[7]); + mpc_decoder_resort_huff_tables(63, &(d->HuffQ7[1][0]) , Dc[7]); +} + +void +mpc_decoder_init_huffman_sv7_tables(mpc_decoder *d) +{ + /***************************** SCFI *******************************/ + d->HuffSCFI[0].Code = 2; d->HuffSCFI[0].Length = 3; + d->HuffSCFI[1].Code = 1; d->HuffSCFI[1].Length = 1; + d->HuffSCFI[2].Code = 3; d->HuffSCFI[2].Length = 3; + d->HuffSCFI[3].Code = 0; d->HuffSCFI[3].Length = 2; + + /***************************** DSCF *******************************/ + d->HuffDSCF[ 0].Code = 32; d->HuffDSCF[ 0].Length = 6; + d->HuffDSCF[ 1].Code = 4; d->HuffDSCF[ 1].Length = 5; + d->HuffDSCF[ 2].Code = 17; d->HuffDSCF[ 2].Length = 5; + d->HuffDSCF[ 3].Code = 30; d->HuffDSCF[ 3].Length = 5; + d->HuffDSCF[ 4].Code = 13; d->HuffDSCF[ 4].Length = 4; + d->HuffDSCF[ 5].Code = 0; d->HuffDSCF[ 5].Length = 3; + d->HuffDSCF[ 6].Code = 3; d->HuffDSCF[ 6].Length = 3; + d->HuffDSCF[ 7].Code = 9; d->HuffDSCF[ 7].Length = 4; + d->HuffDSCF[ 8].Code = 5; d->HuffDSCF[ 8].Length = 3; + d->HuffDSCF[ 9].Code = 2; d->HuffDSCF[ 9].Length = 3; + d->HuffDSCF[10].Code = 14; d->HuffDSCF[10].Length = 4; + d->HuffDSCF[11].Code = 3; d->HuffDSCF[11].Length = 4; + d->HuffDSCF[12].Code = 31; d->HuffDSCF[12].Length = 5; + d->HuffDSCF[13].Code = 5; d->HuffDSCF[13].Length = 5; + d->HuffDSCF[14].Code = 33; d->HuffDSCF[14].Length = 6; + d->HuffDSCF[15].Code = 12; d->HuffDSCF[15].Length = 4; + + /************************* frame-header ***************************/ + /***************** differential quantizer indizes *****************/ + d->HuffHdr[0].Code = 92; d->HuffHdr[0].Length = 8; + d->HuffHdr[1].Code = 47; d->HuffHdr[1].Length = 7; + d->HuffHdr[2].Code = 10; d->HuffHdr[2].Length = 5; + d->HuffHdr[3].Code = 4; d->HuffHdr[3].Length = 4; + d->HuffHdr[4].Code = 0; d->HuffHdr[4].Length = 2; + d->HuffHdr[5].Code = 1; d->HuffHdr[5].Length = 1; + d->HuffHdr[6].Code = 3; d->HuffHdr[6].Length = 3; + d->HuffHdr[7].Code = 22; d->HuffHdr[7].Length = 6; + d->HuffHdr[8].Code = 187; d->HuffHdr[8].Length = 9; + d->HuffHdr[9].Code = 186; d->HuffHdr[9].Length = 9; + + /********************** 3-step quantizer **************************/ + /********************* 3 bundled samples **************************/ + //less shaped, book 0 + d->HuffQ1[0][ 0].Code = 54; d->HuffQ1[0][ 0].Length = 6; + d->HuffQ1[0][ 1].Code = 9; d->HuffQ1[0][ 1].Length = 5; + d->HuffQ1[0][ 2].Code = 32; d->HuffQ1[0][ 2].Length = 6; + d->HuffQ1[0][ 3].Code = 5; d->HuffQ1[0][ 3].Length = 5; + d->HuffQ1[0][ 4].Code = 10; d->HuffQ1[0][ 4].Length = 4; + d->HuffQ1[0][ 5].Code = 7; d->HuffQ1[0][ 5].Length = 5; + d->HuffQ1[0][ 6].Code = 52; d->HuffQ1[0][ 6].Length = 6; + d->HuffQ1[0][ 7].Code = 0; d->HuffQ1[0][ 7].Length = 5; + d->HuffQ1[0][ 8].Code = 35; d->HuffQ1[0][ 8].Length = 6; + d->HuffQ1[0][ 9].Code = 10; d->HuffQ1[0][ 9].Length = 5; + d->HuffQ1[0][10].Code = 6; d->HuffQ1[0][10].Length = 4; + d->HuffQ1[0][11].Code = 4; d->HuffQ1[0][11].Length = 5; + d->HuffQ1[0][12].Code = 11; d->HuffQ1[0][12].Length = 4; + d->HuffQ1[0][13].Code = 7; d->HuffQ1[0][13].Length = 3; + d->HuffQ1[0][14].Code = 12; d->HuffQ1[0][14].Length = 4; + d->HuffQ1[0][15].Code = 3; d->HuffQ1[0][15].Length = 5; + d->HuffQ1[0][16].Code = 7; d->HuffQ1[0][16].Length = 4; + d->HuffQ1[0][17].Code = 11; d->HuffQ1[0][17].Length = 5; + d->HuffQ1[0][18].Code = 34; d->HuffQ1[0][18].Length = 6; + d->HuffQ1[0][19].Code = 1; d->HuffQ1[0][19].Length = 5; + d->HuffQ1[0][20].Code = 53; d->HuffQ1[0][20].Length = 6; + d->HuffQ1[0][21].Code = 6; d->HuffQ1[0][21].Length = 5; + d->HuffQ1[0][22].Code = 9; d->HuffQ1[0][22].Length = 4; + d->HuffQ1[0][23].Code = 2; d->HuffQ1[0][23].Length = 5; + d->HuffQ1[0][24].Code = 33; d->HuffQ1[0][24].Length = 6; + d->HuffQ1[0][25].Code = 8; d->HuffQ1[0][25].Length = 5; + d->HuffQ1[0][26].Code = 55; d->HuffQ1[0][26].Length = 6; + + //more shaped, book 1 + d->HuffQ1[1][ 0].Code = 103; d->HuffQ1[1][ 0].Length = 8; + d->HuffQ1[1][ 1].Code = 62; d->HuffQ1[1][ 1].Length = 7; + d->HuffQ1[1][ 2].Code = 225; d->HuffQ1[1][ 2].Length = 9; + d->HuffQ1[1][ 3].Code = 55; d->HuffQ1[1][ 3].Length = 7; + d->HuffQ1[1][ 4].Code = 3; d->HuffQ1[1][ 4].Length = 4; + d->HuffQ1[1][ 5].Code = 52; d->HuffQ1[1][ 5].Length = 7; + d->HuffQ1[1][ 6].Code = 101; d->HuffQ1[1][ 6].Length = 8; + d->HuffQ1[1][ 7].Code = 60; d->HuffQ1[1][ 7].Length = 7; + d->HuffQ1[1][ 8].Code = 227; d->HuffQ1[1][ 8].Length = 9; + d->HuffQ1[1][ 9].Code = 24; d->HuffQ1[1][ 9].Length = 6; + d->HuffQ1[1][10].Code = 0; d->HuffQ1[1][10].Length = 4; + d->HuffQ1[1][11].Code = 61; d->HuffQ1[1][11].Length = 7; + d->HuffQ1[1][12].Code = 4; d->HuffQ1[1][12].Length = 4; + d->HuffQ1[1][13].Code = 1; d->HuffQ1[1][13].Length = 1; + d->HuffQ1[1][14].Code = 5; d->HuffQ1[1][14].Length = 4; + d->HuffQ1[1][15].Code = 63; d->HuffQ1[1][15].Length = 7; + d->HuffQ1[1][16].Code = 1; d->HuffQ1[1][16].Length = 4; + d->HuffQ1[1][17].Code = 59; d->HuffQ1[1][17].Length = 7; + d->HuffQ1[1][18].Code = 226; d->HuffQ1[1][18].Length = 9; + d->HuffQ1[1][19].Code = 57; d->HuffQ1[1][19].Length = 7; + d->HuffQ1[1][20].Code = 100; d->HuffQ1[1][20].Length = 8; + d->HuffQ1[1][21].Code = 53; d->HuffQ1[1][21].Length = 7; + d->HuffQ1[1][22].Code = 2; d->HuffQ1[1][22].Length = 4; + d->HuffQ1[1][23].Code = 54; d->HuffQ1[1][23].Length = 7; + d->HuffQ1[1][24].Code = 224; d->HuffQ1[1][24].Length = 9; + d->HuffQ1[1][25].Code = 58; d->HuffQ1[1][25].Length = 7; + d->HuffQ1[1][26].Code = 102; d->HuffQ1[1][26].Length = 8; + + /********************** 5-step quantizer **************************/ + /********************* 2 bundled samples **************************/ + //less shaped, book 0 + d->HuffQ2[0][ 0].Code = 89; d->HuffQ2[0][ 0].Length = 7; + d->HuffQ2[0][ 1].Code = 47; d->HuffQ2[0][ 1].Length = 6; + d->HuffQ2[0][ 2].Code = 15; d->HuffQ2[0][ 2].Length = 5; + d->HuffQ2[0][ 3].Code = 0; d->HuffQ2[0][ 3].Length = 5; + d->HuffQ2[0][ 4].Code = 91; d->HuffQ2[0][ 4].Length = 7; + d->HuffQ2[0][ 5].Code = 4; d->HuffQ2[0][ 5].Length = 5; + d->HuffQ2[0][ 6].Code = 6; d->HuffQ2[0][ 6].Length = 4; + d->HuffQ2[0][ 7].Code = 13; d->HuffQ2[0][ 7].Length = 4; + d->HuffQ2[0][ 8].Code = 4; d->HuffQ2[0][ 8].Length = 4; + d->HuffQ2[0][ 9].Code = 5; d->HuffQ2[0][ 9].Length = 5; + d->HuffQ2[0][10].Code = 20; d->HuffQ2[0][10].Length = 5; + d->HuffQ2[0][11].Code = 12; d->HuffQ2[0][11].Length = 4; + d->HuffQ2[0][12].Code = 4; d->HuffQ2[0][12].Length = 3; + d->HuffQ2[0][13].Code = 15; d->HuffQ2[0][13].Length = 4; + d->HuffQ2[0][14].Code = 14; d->HuffQ2[0][14].Length = 5; + d->HuffQ2[0][15].Code = 3; d->HuffQ2[0][15].Length = 5; + d->HuffQ2[0][16].Code = 3; d->HuffQ2[0][16].Length = 4; + d->HuffQ2[0][17].Code = 14; d->HuffQ2[0][17].Length = 4; + d->HuffQ2[0][18].Code = 5; d->HuffQ2[0][18].Length = 4; + d->HuffQ2[0][19].Code = 1; d->HuffQ2[0][19].Length = 5; + d->HuffQ2[0][20].Code = 90; d->HuffQ2[0][20].Length = 7; + d->HuffQ2[0][21].Code = 2; d->HuffQ2[0][21].Length = 5; + d->HuffQ2[0][22].Code = 21; d->HuffQ2[0][22].Length = 5; + d->HuffQ2[0][23].Code = 46; d->HuffQ2[0][23].Length = 6; + d->HuffQ2[0][24].Code = 88; d->HuffQ2[0][24].Length = 7; + + //more shaped, book 1 + d->HuffQ2[1][ 0].Code = 921; d->HuffQ2[1][ 0].Length = 10; + d->HuffQ2[1][ 1].Code = 113; d->HuffQ2[1][ 1].Length = 7; + d->HuffQ2[1][ 2].Code = 51; d->HuffQ2[1][ 2].Length = 6; + d->HuffQ2[1][ 3].Code = 231; d->HuffQ2[1][ 3].Length = 8; + d->HuffQ2[1][ 4].Code = 922; d->HuffQ2[1][ 4].Length = 10; + d->HuffQ2[1][ 5].Code = 104; d->HuffQ2[1][ 5].Length = 7; + d->HuffQ2[1][ 6].Code = 30; d->HuffQ2[1][ 6].Length = 5; + d->HuffQ2[1][ 7].Code = 0; d->HuffQ2[1][ 7].Length = 3; + d->HuffQ2[1][ 8].Code = 29; d->HuffQ2[1][ 8].Length = 5; + d->HuffQ2[1][ 9].Code = 105; d->HuffQ2[1][ 9].Length = 7; + d->HuffQ2[1][10].Code = 50; d->HuffQ2[1][10].Length = 6; + d->HuffQ2[1][11].Code = 1; d->HuffQ2[1][11].Length = 3; + d->HuffQ2[1][12].Code = 2; d->HuffQ2[1][12].Length = 2; + d->HuffQ2[1][13].Code = 3; d->HuffQ2[1][13].Length = 3; + d->HuffQ2[1][14].Code = 49; d->HuffQ2[1][14].Length = 6; + d->HuffQ2[1][15].Code = 107; d->HuffQ2[1][15].Length = 7; + d->HuffQ2[1][16].Code = 27; d->HuffQ2[1][16].Length = 5; + d->HuffQ2[1][17].Code = 2; d->HuffQ2[1][17].Length = 3; + d->HuffQ2[1][18].Code = 31; d->HuffQ2[1][18].Length = 5; + d->HuffQ2[1][19].Code = 112; d->HuffQ2[1][19].Length = 7; + d->HuffQ2[1][20].Code = 920; d->HuffQ2[1][20].Length = 10; + d->HuffQ2[1][21].Code = 106; d->HuffQ2[1][21].Length = 7; + d->HuffQ2[1][22].Code = 48; d->HuffQ2[1][22].Length = 6; + d->HuffQ2[1][23].Code = 114; d->HuffQ2[1][23].Length = 7; + d->HuffQ2[1][24].Code = 923; d->HuffQ2[1][24].Length = 10; + + /********************** 7-step quantizer **************************/ + /*********************** single samples ***************************/ + //less shaped, book 0 + d->HuffQ3[0][0].Code = 12; d->HuffQ3[0][0].Length = 4; + d->HuffQ3[0][1].Code = 4; d->HuffQ3[0][1].Length = 3; + d->HuffQ3[0][2].Code = 0; d->HuffQ3[0][2].Length = 2; + d->HuffQ3[0][3].Code = 1; d->HuffQ3[0][3].Length = 2; + d->HuffQ3[0][4].Code = 7; d->HuffQ3[0][4].Length = 3; + d->HuffQ3[0][5].Code = 5; d->HuffQ3[0][5].Length = 3; + d->HuffQ3[0][6].Code = 13; d->HuffQ3[0][6].Length = 4; + + //more shaped, book 1 + d->HuffQ3[1][0].Code = 4; d->HuffQ3[1][0].Length = 5; + d->HuffQ3[1][1].Code = 3; d->HuffQ3[1][1].Length = 4; + d->HuffQ3[1][2].Code = 2; d->HuffQ3[1][2].Length = 2; + d->HuffQ3[1][3].Code = 3; d->HuffQ3[1][3].Length = 2; + d->HuffQ3[1][4].Code = 1; d->HuffQ3[1][4].Length = 2; + d->HuffQ3[1][5].Code = 0; d->HuffQ3[1][5].Length = 3; + d->HuffQ3[1][6].Code = 5; d->HuffQ3[1][6].Length = 5; + + /********************** 9-step quantizer **************************/ + /*********************** single samples ***************************/ + //less shaped, book 0 + d->HuffQ4[0][0].Code = 5; d->HuffQ4[0][0].Length = 4; + d->HuffQ4[0][1].Code = 0; d->HuffQ4[0][1].Length = 3; + d->HuffQ4[0][2].Code = 4; d->HuffQ4[0][2].Length = 3; + d->HuffQ4[0][3].Code = 6; d->HuffQ4[0][3].Length = 3; + d->HuffQ4[0][4].Code = 7; d->HuffQ4[0][4].Length = 3; + d->HuffQ4[0][5].Code = 5; d->HuffQ4[0][5].Length = 3; + d->HuffQ4[0][6].Code = 3; d->HuffQ4[0][6].Length = 3; + d->HuffQ4[0][7].Code = 1; d->HuffQ4[0][7].Length = 3; + d->HuffQ4[0][8].Code = 4; d->HuffQ4[0][8].Length = 4; + + //more shaped, book 1 + d->HuffQ4[1][0].Code = 9; d->HuffQ4[1][0].Length = 5; + d->HuffQ4[1][1].Code = 12; d->HuffQ4[1][1].Length = 4; + d->HuffQ4[1][2].Code = 3; d->HuffQ4[1][2].Length = 3; + d->HuffQ4[1][3].Code = 0; d->HuffQ4[1][3].Length = 2; + d->HuffQ4[1][4].Code = 2; d->HuffQ4[1][4].Length = 2; + d->HuffQ4[1][5].Code = 7; d->HuffQ4[1][5].Length = 3; + d->HuffQ4[1][6].Code = 13; d->HuffQ4[1][6].Length = 4; + d->HuffQ4[1][7].Code = 5; d->HuffQ4[1][7].Length = 4; + d->HuffQ4[1][8].Code = 8; d->HuffQ4[1][8].Length = 5; + + /********************* 15-step quantizer **************************/ + /*********************** single samples ***************************/ + //less shaped, book 0 + d->HuffQ5[0][ 0].Code = 57; d->HuffQ5[0][ 0].Length = 6; + d->HuffQ5[0][ 1].Code = 23; d->HuffQ5[0][ 1].Length = 5; + d->HuffQ5[0][ 2].Code = 8; d->HuffQ5[0][ 2].Length = 4; + d->HuffQ5[0][ 3].Code = 10; d->HuffQ5[0][ 3].Length = 4; + d->HuffQ5[0][ 4].Code = 13; d->HuffQ5[0][ 4].Length = 4; + d->HuffQ5[0][ 5].Code = 0; d->HuffQ5[0][ 5].Length = 3; + d->HuffQ5[0][ 6].Code = 2; d->HuffQ5[0][ 6].Length = 3; + d->HuffQ5[0][ 7].Code = 3; d->HuffQ5[0][ 7].Length = 3; + d->HuffQ5[0][ 8].Code = 1; d->HuffQ5[0][ 8].Length = 3; + d->HuffQ5[0][ 9].Code = 15; d->HuffQ5[0][ 9].Length = 4; + d->HuffQ5[0][10].Code = 12; d->HuffQ5[0][10].Length = 4; + d->HuffQ5[0][11].Code = 9; d->HuffQ5[0][11].Length = 4; + d->HuffQ5[0][12].Code = 29; d->HuffQ5[0][12].Length = 5; + d->HuffQ5[0][13].Code = 22; d->HuffQ5[0][13].Length = 5; + d->HuffQ5[0][14].Code = 56; d->HuffQ5[0][14].Length = 6; + + //more shaped, book 1 + d->HuffQ5[1][ 0].Code = 229; d->HuffQ5[1][ 0].Length = 8; + d->HuffQ5[1][ 1].Code = 56; d->HuffQ5[1][ 1].Length = 6; + d->HuffQ5[1][ 2].Code = 7; d->HuffQ5[1][ 2].Length = 5; + d->HuffQ5[1][ 3].Code = 2; d->HuffQ5[1][ 3].Length = 4; + d->HuffQ5[1][ 4].Code = 0; d->HuffQ5[1][ 4].Length = 3; + d->HuffQ5[1][ 5].Code = 3; d->HuffQ5[1][ 5].Length = 3; + d->HuffQ5[1][ 6].Code = 5; d->HuffQ5[1][ 6].Length = 3; + d->HuffQ5[1][ 7].Code = 6; d->HuffQ5[1][ 7].Length = 3; + d->HuffQ5[1][ 8].Code = 4; d->HuffQ5[1][ 8].Length = 3; + d->HuffQ5[1][ 9].Code = 2; d->HuffQ5[1][ 9].Length = 3; + d->HuffQ5[1][10].Code = 15; d->HuffQ5[1][10].Length = 4; + d->HuffQ5[1][11].Code = 29; d->HuffQ5[1][11].Length = 5; + d->HuffQ5[1][12].Code = 6; d->HuffQ5[1][12].Length = 5; + d->HuffQ5[1][13].Code = 115; d->HuffQ5[1][13].Length = 7; + d->HuffQ5[1][14].Code = 228; d->HuffQ5[1][14].Length = 8; + + /********************* 31-step quantizer **************************/ + /*********************** single samples ***************************/ + //less shaped, book 0 + d->HuffQ6[0][ 0].Code = 65; d->HuffQ6[0][ 0].Length = 7; + d->HuffQ6[0][ 1].Code = 6; d->HuffQ6[0][ 1].Length = 6; + d->HuffQ6[0][ 2].Code = 44; d->HuffQ6[0][ 2].Length = 6; + d->HuffQ6[0][ 3].Code = 45; d->HuffQ6[0][ 3].Length = 6; + d->HuffQ6[0][ 4].Code = 59; d->HuffQ6[0][ 4].Length = 6; + d->HuffQ6[0][ 5].Code = 13; d->HuffQ6[0][ 5].Length = 5; + d->HuffQ6[0][ 6].Code = 17; d->HuffQ6[0][ 6].Length = 5; + d->HuffQ6[0][ 7].Code = 19; d->HuffQ6[0][ 7].Length = 5; + d->HuffQ6[0][ 8].Code = 23; d->HuffQ6[0][ 8].Length = 5; + d->HuffQ6[0][ 9].Code = 21; d->HuffQ6[0][ 9].Length = 5; + d->HuffQ6[0][10].Code = 26; d->HuffQ6[0][10].Length = 5; + d->HuffQ6[0][11].Code = 30; d->HuffQ6[0][11].Length = 5; + d->HuffQ6[0][12].Code = 0; d->HuffQ6[0][12].Length = 4; + d->HuffQ6[0][13].Code = 2; d->HuffQ6[0][13].Length = 4; + d->HuffQ6[0][14].Code = 5; d->HuffQ6[0][14].Length = 4; + d->HuffQ6[0][15].Code = 7; d->HuffQ6[0][15].Length = 4; + d->HuffQ6[0][16].Code = 3; d->HuffQ6[0][16].Length = 4; + d->HuffQ6[0][17].Code = 4; d->HuffQ6[0][17].Length = 4; + d->HuffQ6[0][18].Code = 31; d->HuffQ6[0][18].Length = 5; + d->HuffQ6[0][19].Code = 28; d->HuffQ6[0][19].Length = 5; + d->HuffQ6[0][20].Code = 25; d->HuffQ6[0][20].Length = 5; + d->HuffQ6[0][21].Code = 27; d->HuffQ6[0][21].Length = 5; + d->HuffQ6[0][22].Code = 24; d->HuffQ6[0][22].Length = 5; + d->HuffQ6[0][23].Code = 20; d->HuffQ6[0][23].Length = 5; + d->HuffQ6[0][24].Code = 18; d->HuffQ6[0][24].Length = 5; + d->HuffQ6[0][25].Code = 12; d->HuffQ6[0][25].Length = 5; + d->HuffQ6[0][26].Code = 2; d->HuffQ6[0][26].Length = 5; + d->HuffQ6[0][27].Code = 58; d->HuffQ6[0][27].Length = 6; + d->HuffQ6[0][28].Code = 33; d->HuffQ6[0][28].Length = 6; + d->HuffQ6[0][29].Code = 7; d->HuffQ6[0][29].Length = 6; + d->HuffQ6[0][30].Code = 64; d->HuffQ6[0][30].Length = 7; + + //more shaped, book 1 + d->HuffQ6[1][ 0].Code = 6472; d->HuffQ6[1][ 0].Length = 13; + d->HuffQ6[1][ 1].Code = 6474; d->HuffQ6[1][ 1].Length = 13; + d->HuffQ6[1][ 2].Code = 808; d->HuffQ6[1][ 2].Length = 10; + d->HuffQ6[1][ 3].Code = 405; d->HuffQ6[1][ 3].Length = 9; + d->HuffQ6[1][ 4].Code = 203; d->HuffQ6[1][ 4].Length = 8; + d->HuffQ6[1][ 5].Code = 102; d->HuffQ6[1][ 5].Length = 7; + d->HuffQ6[1][ 6].Code = 49; d->HuffQ6[1][ 6].Length = 6; + d->HuffQ6[1][ 7].Code = 9; d->HuffQ6[1][ 7].Length = 5; + d->HuffQ6[1][ 8].Code = 15; d->HuffQ6[1][ 8].Length = 5; + d->HuffQ6[1][ 9].Code = 31; d->HuffQ6[1][ 9].Length = 5; + d->HuffQ6[1][10].Code = 2; d->HuffQ6[1][10].Length = 4; + d->HuffQ6[1][11].Code = 6; d->HuffQ6[1][11].Length = 4; + d->HuffQ6[1][12].Code = 8; d->HuffQ6[1][12].Length = 4; + d->HuffQ6[1][13].Code = 11; d->HuffQ6[1][13].Length = 4; + d->HuffQ6[1][14].Code = 13; d->HuffQ6[1][14].Length = 4; + d->HuffQ6[1][15].Code = 0; d->HuffQ6[1][15].Length = 3; + d->HuffQ6[1][16].Code = 14; d->HuffQ6[1][16].Length = 4; + d->HuffQ6[1][17].Code = 10; d->HuffQ6[1][17].Length = 4; + d->HuffQ6[1][18].Code = 9; d->HuffQ6[1][18].Length = 4; + d->HuffQ6[1][19].Code = 5; d->HuffQ6[1][19].Length = 4; + d->HuffQ6[1][20].Code = 3; d->HuffQ6[1][20].Length = 4; + d->HuffQ6[1][21].Code = 30; d->HuffQ6[1][21].Length = 5; + d->HuffQ6[1][22].Code = 14; d->HuffQ6[1][22].Length = 5; + d->HuffQ6[1][23].Code = 8; d->HuffQ6[1][23].Length = 5; + d->HuffQ6[1][24].Code = 48; d->HuffQ6[1][24].Length = 6; + d->HuffQ6[1][25].Code = 103; d->HuffQ6[1][25].Length = 7; + d->HuffQ6[1][26].Code = 201; d->HuffQ6[1][26].Length = 8; + d->HuffQ6[1][27].Code = 200; d->HuffQ6[1][27].Length = 8; + d->HuffQ6[1][28].Code = 1619; d->HuffQ6[1][28].Length = 11; + d->HuffQ6[1][29].Code = 6473; d->HuffQ6[1][29].Length = 13; + d->HuffQ6[1][30].Code = 6475; d->HuffQ6[1][30].Length = 13; + + /********************* 63-step quantizer **************************/ + /*********************** single samples ***************************/ + //less shaped, book 0 + d->HuffQ7[0][ 0].Code = 103; d->HuffQ7[0][ 0].Length = 8; /* 0.003338 - 01100111 */ + d->HuffQ7[0][ 1].Code = 153; d->HuffQ7[0][ 1].Length = 8; /* 0.003766 - 10011001 */ + d->HuffQ7[0][ 2].Code = 181; d->HuffQ7[0][ 2].Length = 8; /* 0.004715 - 10110101 */ + d->HuffQ7[0][ 3].Code = 233; d->HuffQ7[0][ 3].Length = 8; /* 0.005528 - 11101001 */ + d->HuffQ7[0][ 4].Code = 64; d->HuffQ7[0][ 4].Length = 7; /* 0.006677 - 1000000 */ + d->HuffQ7[0][ 5].Code = 65; d->HuffQ7[0][ 5].Length = 7; /* 0.007041 - 1000001 */ + d->HuffQ7[0][ 6].Code = 77; d->HuffQ7[0][ 6].Length = 7; /* 0.007733 - 1001101 */ + d->HuffQ7[0][ 7].Code = 81; d->HuffQ7[0][ 7].Length = 7; /* 0.008296 - 1010001 */ + d->HuffQ7[0][ 8].Code = 91; d->HuffQ7[0][ 8].Length = 7; /* 0.009295 - 1011011 */ + d->HuffQ7[0][ 9].Code = 113; d->HuffQ7[0][ 9].Length = 7; /* 0.010814 - 1110001 */ + d->HuffQ7[0][10].Code = 112; d->HuffQ7[0][10].Length = 7; /* 0.010807 - 1110000 */ + d->HuffQ7[0][11].Code = 24; d->HuffQ7[0][11].Length = 6; /* 0.012748 - 011000 */ + d->HuffQ7[0][12].Code = 29; d->HuffQ7[0][12].Length = 6; /* 0.013390 - 011101 */ + d->HuffQ7[0][13].Code = 35; d->HuffQ7[0][13].Length = 6; /* 0.014224 - 100011 */ + d->HuffQ7[0][14].Code = 37; d->HuffQ7[0][14].Length = 6; /* 0.015201 - 100101 */ + d->HuffQ7[0][15].Code = 41; d->HuffQ7[0][15].Length = 6; /* 0.016642 - 101001 */ + d->HuffQ7[0][16].Code = 44; d->HuffQ7[0][16].Length = 6; /* 0.017292 - 101100 */ + d->HuffQ7[0][17].Code = 46; d->HuffQ7[0][17].Length = 6; /* 0.018647 - 101110 */ + d->HuffQ7[0][18].Code = 51; d->HuffQ7[0][18].Length = 6; /* 0.020473 - 110011 */ + d->HuffQ7[0][19].Code = 49; d->HuffQ7[0][19].Length = 6; /* 0.020152 - 110001 */ + d->HuffQ7[0][20].Code = 54; d->HuffQ7[0][20].Length = 6; /* 0.021315 - 110110 */ + d->HuffQ7[0][21].Code = 55; d->HuffQ7[0][21].Length = 6; /* 0.021358 - 110111 */ + d->HuffQ7[0][22].Code = 57; d->HuffQ7[0][22].Length = 6; /* 0.021700 - 111001 */ + d->HuffQ7[0][23].Code = 60; d->HuffQ7[0][23].Length = 6; /* 0.022449 - 111100 */ + d->HuffQ7[0][24].Code = 0; d->HuffQ7[0][24].Length = 5; /* 0.023063 - 00000 */ + d->HuffQ7[0][25].Code = 2; d->HuffQ7[0][25].Length = 5; /* 0.023854 - 00010 */ + d->HuffQ7[0][26].Code = 10; d->HuffQ7[0][26].Length = 5; /* 0.025481 - 01010 */ + d->HuffQ7[0][27].Code = 5; d->HuffQ7[0][27].Length = 5; /* 0.024867 - 00101 */ + d->HuffQ7[0][28].Code = 9; d->HuffQ7[0][28].Length = 5; /* 0.025352 - 01001 */ + d->HuffQ7[0][29].Code = 6; d->HuffQ7[0][29].Length = 5; /* 0.025074 - 00110 */ + d->HuffQ7[0][30].Code = 13; d->HuffQ7[0][30].Length = 5; /* 0.025745 - 01101 */ + d->HuffQ7[0][31].Code = 7; d->HuffQ7[0][31].Length = 5; /* 0.025195 - 00111 */ + d->HuffQ7[0][32].Code = 11; d->HuffQ7[0][32].Length = 5; /* 0.025502 - 01011 */ + d->HuffQ7[0][33].Code = 15; d->HuffQ7[0][33].Length = 5; /* 0.026251 - 01111 */ + d->HuffQ7[0][34].Code = 8; d->HuffQ7[0][34].Length = 5; /* 0.025260 - 01000 */ + d->HuffQ7[0][35].Code = 4; d->HuffQ7[0][35].Length = 5; /* 0.024418 - 00100 */ + d->HuffQ7[0][36].Code = 3; d->HuffQ7[0][36].Length = 5; /* 0.023983 - 00011 */ + d->HuffQ7[0][37].Code = 1; d->HuffQ7[0][37].Length = 5; /* 0.023697 - 00001 */ + d->HuffQ7[0][38].Code = 63; d->HuffQ7[0][38].Length = 6; /* 0.023041 - 111111 */ + d->HuffQ7[0][39].Code = 62; d->HuffQ7[0][39].Length = 6; /* 0.022656 - 111110 */ + d->HuffQ7[0][40].Code = 61; d->HuffQ7[0][40].Length = 6; /* 0.022549 - 111101 */ + d->HuffQ7[0][41].Code = 53; d->HuffQ7[0][41].Length = 6; /* 0.021151 - 110101 */ + d->HuffQ7[0][42].Code = 59; d->HuffQ7[0][42].Length = 6; /* 0.022042 - 111011 */ + d->HuffQ7[0][43].Code = 52; d->HuffQ7[0][43].Length = 6; /* 0.020837 - 110100 */ + d->HuffQ7[0][44].Code = 48; d->HuffQ7[0][44].Length = 6; /* 0.019446 - 110000 */ + d->HuffQ7[0][45].Code = 47; d->HuffQ7[0][45].Length = 6; /* 0.019189 - 101111 */ + d->HuffQ7[0][46].Code = 43; d->HuffQ7[0][46].Length = 6; /* 0.017177 - 101011 */ + d->HuffQ7[0][47].Code = 42; d->HuffQ7[0][47].Length = 6; /* 0.017035 - 101010 */ + d->HuffQ7[0][48].Code = 39; d->HuffQ7[0][48].Length = 6; /* 0.015287 - 100111 */ + d->HuffQ7[0][49].Code = 36; d->HuffQ7[0][49].Length = 6; /* 0.014559 - 100100 */ + d->HuffQ7[0][50].Code = 33; d->HuffQ7[0][50].Length = 6; /* 0.014117 - 100001 */ + d->HuffQ7[0][51].Code = 28; d->HuffQ7[0][51].Length = 6; /* 0.012776 - 011100 */ + d->HuffQ7[0][52].Code = 117; d->HuffQ7[0][52].Length = 7; /* 0.011107 - 1110101 */ + d->HuffQ7[0][53].Code = 101; d->HuffQ7[0][53].Length = 7; /* 0.010636 - 1100101 */ + d->HuffQ7[0][54].Code = 100; d->HuffQ7[0][54].Length = 7; /* 0.009751 - 1100100 */ + d->HuffQ7[0][55].Code = 80; d->HuffQ7[0][55].Length = 7; /* 0.008132 - 1010000 */ + d->HuffQ7[0][56].Code = 69; d->HuffQ7[0][56].Length = 7; /* 0.007091 - 1000101 */ + d->HuffQ7[0][57].Code = 68; d->HuffQ7[0][57].Length = 7; /* 0.007084 - 1000100 */ + d->HuffQ7[0][58].Code = 50; d->HuffQ7[0][58].Length = 7; /* 0.006277 - 0110010 */ + d->HuffQ7[0][59].Code = 232; d->HuffQ7[0][59].Length = 8; /* 0.005386 - 11101000 */ + d->HuffQ7[0][60].Code = 180; d->HuffQ7[0][60].Length = 8; /* 0.004408 - 10110100 */ + d->HuffQ7[0][61].Code = 152; d->HuffQ7[0][61].Length = 8; /* 0.003759 - 10011000 */ + d->HuffQ7[0][62].Code = 102; d->HuffQ7[0][62].Length = 8; /* 0.003160 - 01100110 */ + + //more shaped, book 1 + d->HuffQ7[1][ 0].Code = 14244; d->HuffQ7[1][ 0].Length = 14; /* 0.000059 - 11011110100100 */ + d->HuffQ7[1][ 1].Code = 14253; d->HuffQ7[1][ 1].Length = 14; /* 0.000098 - 11011110101101 */ + d->HuffQ7[1][ 2].Code = 14246; d->HuffQ7[1][ 2].Length = 14; /* 0.000078 - 11011110100110 */ + d->HuffQ7[1][ 3].Code = 14254; d->HuffQ7[1][ 3].Length = 14; /* 0.000111 - 11011110101110 */ + d->HuffQ7[1][ 4].Code = 3562; d->HuffQ7[1][ 4].Length = 12; /* 0.000320 - 110111101010 */ + d->HuffQ7[1][ 5].Code = 752; d->HuffQ7[1][ 5].Length = 10; /* 0.000920 - 1011110000 */ + d->HuffQ7[1][ 6].Code = 753; d->HuffQ7[1][ 6].Length = 10; /* 0.001057 - 1011110001 */ + d->HuffQ7[1][ 7].Code = 160; d->HuffQ7[1][ 7].Length = 9; /* 0.001403 - 010100000 */ + d->HuffQ7[1][ 8].Code = 162; d->HuffQ7[1][ 8].Length = 9; /* 0.001579 - 010100010 */ + d->HuffQ7[1][ 9].Code = 444; d->HuffQ7[1][ 9].Length = 9; /* 0.002486 - 110111100 */ + d->HuffQ7[1][10].Code = 122; d->HuffQ7[1][10].Length = 8; /* 0.003772 - 01111010 */ + d->HuffQ7[1][11].Code = 223; d->HuffQ7[1][11].Length = 8; /* 0.005710 - 11011111 */ + d->HuffQ7[1][12].Code = 60; d->HuffQ7[1][12].Length = 7; /* 0.006858 - 0111100 */ + d->HuffQ7[1][13].Code = 73; d->HuffQ7[1][13].Length = 7; /* 0.008033 - 1001001 */ + d->HuffQ7[1][14].Code = 110; d->HuffQ7[1][14].Length = 7; /* 0.009827 - 1101110 */ + d->HuffQ7[1][15].Code = 14; d->HuffQ7[1][15].Length = 6; /* 0.012601 - 001110 */ + d->HuffQ7[1][16].Code = 24; d->HuffQ7[1][16].Length = 6; /* 0.013194 - 011000 */ + d->HuffQ7[1][17].Code = 25; d->HuffQ7[1][17].Length = 6; /* 0.013938 - 011001 */ + d->HuffQ7[1][18].Code = 34; d->HuffQ7[1][18].Length = 6; /* 0.015693 - 100010 */ + d->HuffQ7[1][19].Code = 37; d->HuffQ7[1][19].Length = 6; /* 0.017846 - 100101 */ + d->HuffQ7[1][20].Code = 54; d->HuffQ7[1][20].Length = 6; /* 0.020078 - 110110 */ + d->HuffQ7[1][21].Code = 3; d->HuffQ7[1][21].Length = 5; /* 0.022975 - 00011 */ + d->HuffQ7[1][22].Code = 9; d->HuffQ7[1][22].Length = 5; /* 0.025631 - 01001 */ + d->HuffQ7[1][23].Code = 11; d->HuffQ7[1][23].Length = 5; /* 0.027021 - 01011 */ + d->HuffQ7[1][24].Code = 16; d->HuffQ7[1][24].Length = 5; /* 0.031465 - 10000 */ + d->HuffQ7[1][25].Code = 19; d->HuffQ7[1][25].Length = 5; /* 0.034244 - 10011 */ + d->HuffQ7[1][26].Code = 21; d->HuffQ7[1][26].Length = 5; /* 0.035921 - 10101 */ + d->HuffQ7[1][27].Code = 24; d->HuffQ7[1][27].Length = 5; /* 0.037938 - 11000 */ + d->HuffQ7[1][28].Code = 26; d->HuffQ7[1][28].Length = 5; /* 0.039595 - 11010 */ + d->HuffQ7[1][29].Code = 29; d->HuffQ7[1][29].Length = 5; /* 0.041546 - 11101 */ + d->HuffQ7[1][30].Code = 31; d->HuffQ7[1][30].Length = 5; /* 0.042623 - 11111 */ + d->HuffQ7[1][31].Code = 2; d->HuffQ7[1][31].Length = 4; /* 0.045180 - 0010 */ + d->HuffQ7[1][32].Code = 0; d->HuffQ7[1][32].Length = 4; /* 0.043151 - 0000 */ + d->HuffQ7[1][33].Code = 30; d->HuffQ7[1][33].Length = 5; /* 0.042538 - 11110 */ + d->HuffQ7[1][34].Code = 28; d->HuffQ7[1][34].Length = 5; /* 0.041422 - 11100 */ + d->HuffQ7[1][35].Code = 25; d->HuffQ7[1][35].Length = 5; /* 0.039145 - 11001 */ + d->HuffQ7[1][36].Code = 22; d->HuffQ7[1][36].Length = 5; /* 0.036691 - 10110 */ + d->HuffQ7[1][37].Code = 20; d->HuffQ7[1][37].Length = 5; /* 0.034955 - 10100 */ + d->HuffQ7[1][38].Code = 14; d->HuffQ7[1][38].Length = 5; /* 0.029155 - 01110 */ + d->HuffQ7[1][39].Code = 13; d->HuffQ7[1][39].Length = 5; /* 0.027921 - 01101 */ + d->HuffQ7[1][40].Code = 8; d->HuffQ7[1][40].Length = 5; /* 0.025553 - 01000 */ + d->HuffQ7[1][41].Code = 6; d->HuffQ7[1][41].Length = 5; /* 0.023093 - 00110 */ + d->HuffQ7[1][42].Code = 2; d->HuffQ7[1][42].Length = 5; /* 0.021200 - 00010 */ + d->HuffQ7[1][43].Code = 46; d->HuffQ7[1][43].Length = 6; /* 0.018134 - 101110 */ + d->HuffQ7[1][44].Code = 35; d->HuffQ7[1][44].Length = 6; /* 0.015824 - 100011 */ + d->HuffQ7[1][45].Code = 31; d->HuffQ7[1][45].Length = 6; /* 0.014701 - 011111 */ + d->HuffQ7[1][46].Code = 21; d->HuffQ7[1][46].Length = 6; /* 0.013187 - 010101 */ + d->HuffQ7[1][47].Code = 15; d->HuffQ7[1][47].Length = 6; /* 0.012776 - 001111 */ + d->HuffQ7[1][48].Code = 95; d->HuffQ7[1][48].Length = 7; /* 0.009664 - 1011111 */ + d->HuffQ7[1][49].Code = 72; d->HuffQ7[1][49].Length = 7; /* 0.007922 - 1001000 */ + d->HuffQ7[1][50].Code = 41; d->HuffQ7[1][50].Length = 7; /* 0.006838 - 0101001 */ + d->HuffQ7[1][51].Code = 189; d->HuffQ7[1][51].Length = 8; /* 0.005024 - 10111101 */ + d->HuffQ7[1][52].Code = 123; d->HuffQ7[1][52].Length = 8; /* 0.003830 - 01111011 */ + d->HuffQ7[1][53].Code = 377; d->HuffQ7[1][53].Length = 9; /* 0.002232 - 101111001 */ + d->HuffQ7[1][54].Code = 161; d->HuffQ7[1][54].Length = 9; /* 0.001566 - 010100001 */ + d->HuffQ7[1][55].Code = 891; d->HuffQ7[1][55].Length = 10; /* 0.001383 - 1101111011 */ + d->HuffQ7[1][56].Code = 327; d->HuffQ7[1][56].Length = 10; /* 0.000900 - 0101000111 */ + d->HuffQ7[1][57].Code = 326; d->HuffQ7[1][57].Length = 10; /* 0.000790 - 0101000110 */ + d->HuffQ7[1][58].Code = 3560; d->HuffQ7[1][58].Length = 12; /* 0.000254 - 110111101000 */ + d->HuffQ7[1][59].Code = 14255; d->HuffQ7[1][59].Length = 14; /* 0.000117 - 11011110101111 */ + d->HuffQ7[1][60].Code = 14247; d->HuffQ7[1][60].Length = 14; /* 0.000085 - 11011110100111 */ + d->HuffQ7[1][61].Code = 14252; d->HuffQ7[1][61].Length = 14; /* 0.000085 - 11011110101100 */ + d->HuffQ7[1][62].Code = 14245; d->HuffQ7[1][62].Length = 14; /* 0.000065 - 11011110100101 */ +} diff --git a/Libraries/MPCDec/Files/src/idtag.c b/Libraries/MPCDec/Files/src/idtag.c new file mode 100644 index 000000000..7cecdb04e --- /dev/null +++ b/Libraries/MPCDec/Files/src/idtag.c @@ -0,0 +1,83 @@ +/* + Copyright (c) 2005, The Musepack Development Team + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * Neither the name of the The Musepack Development Team nor the + names of its contributors may be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/// \file idtag.c +/// Rudimentary id3tag handling routines, just enough to skip id3v2 tags, +/// if present. + +#include +#include + +mpc_int32_t +JumpID3v2 (mpc_reader* r) { + unsigned char tmp [10]; + mpc_uint32_t Unsynchronisation; // ID3v2.4-flag + mpc_uint32_t ExtHeaderPresent; // ID3v2.4-flag + mpc_uint32_t ExperimentalFlag; // ID3v2.4-flag + mpc_uint32_t FooterPresent; // ID3v2.4-flag + mpc_int32_t ret; + + // seek to first byte of mpc data + if (!r->seek (r->data, 0)) { + return 0; + } + + r->read(r->data, tmp, sizeof(tmp)); + + // check id3-tag + if ( 0 != memcmp ( tmp, "ID3", 3) ) + return 0; + + // read flags + Unsynchronisation = tmp[5] & 0x80; + ExtHeaderPresent = tmp[5] & 0x40; + ExperimentalFlag = tmp[5] & 0x20; + FooterPresent = tmp[5] & 0x10; + + if ( tmp[5] & 0x0F ) + return -1; // not (yet???) allowed + if ( (tmp[6] | tmp[7] | tmp[8] | tmp[9]) & 0x80 ) + return -1; // not allowed + + // read HeaderSize (syncsave: 4 * $0xxxxxxx = 28 significant bits) + ret = tmp[6] << 21; + ret += tmp[7] << 14; + ret += tmp[8] << 7; + ret += tmp[9] ; + ret += 10; + if ( FooterPresent ) + ret += 10; + + return ret; +} diff --git a/Libraries/MPCDec/Files/src/mpc_decoder.c b/Libraries/MPCDec/Files/src/mpc_decoder.c new file mode 100644 index 000000000..52f3951e1 --- /dev/null +++ b/Libraries/MPCDec/Files/src/mpc_decoder.c @@ -0,0 +1,1349 @@ +/* + Copyright (c) 2005, The Musepack Development Team + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * Neither the name of the The Musepack Development Team nor the + names of its contributors may be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/// \file mpc_decoder.c +/// Core decoding routines and logic. + +#include +#include +#include +#include + +//------------------------------------------------------------------------------ +// types +//------------------------------------------------------------------------------ +enum + { + EQ_TAP = 13, // length of FIR filter for EQ + DELAY = ((EQ_TAP + 1) / 2), // delay of FIR + FIR_BANDS = 4, // number of subbands to be FIR filtered + MEMSIZE = MPC_DECODER_MEMSIZE, // overall buffer size + MEMSIZE2 = (MEMSIZE/2), // size of one buffer + MEMMASK = (MEMSIZE-1) + }; + +//------------------------------------------------------------------------------ +// forward declarations +//------------------------------------------------------------------------------ +void mpc_decoder_init_huffman_sv6(mpc_decoder *d); +void mpc_decoder_init_huffman_sv7(mpc_decoder *d); +void mpc_decoder_read_bitstream_sv6(mpc_decoder *d); +void mpc_decoder_read_bitstream_sv7(mpc_decoder *d); +void mpc_decoder_update_buffer(mpc_decoder *d, mpc_uint32_t RING); +mpc_bool_t mpc_decoder_seek_sample(mpc_decoder *d, mpc_int64_t destsample); +void mpc_decoder_requantisierung(mpc_decoder *d, const mpc_int32_t Last_Band); + +//------------------------------------------------------------------------------ +// utility functions +//------------------------------------------------------------------------------ +static mpc_int32_t f_read(mpc_decoder *d, void *ptr, size_t size) +{ + return d->r->read(d->r->data, ptr, size); +}; + +static mpc_bool_t f_seek(mpc_decoder *d, mpc_int32_t offset) +{ + return d->r->seek(d->r->data, offset); +}; + +static mpc_int32_t f_read_dword(mpc_decoder *d, mpc_uint32_t * ptr, mpc_uint32_t count) +{ + count = f_read(d, ptr, count << 2) >> 2; +#ifndef MPC_LITTLE_ENDIAN + mpc_uint32_t n; + for(n = 0; n< count; n++) { + ptr[n] = swap32(ptr[n]); + } +#endif + return count; +} + +//------------------------------------------------------------------------------ +// huffman & bitstream functions +//------------------------------------------------------------------------------ +static const mpc_uint32_t mask [33] = { + 0x00000000, 0x00000001, 0x00000003, 0x00000007, + 0x0000000F, 0x0000001F, 0x0000003F, 0x0000007F, + 0x000000FF, 0x000001FF, 0x000003FF, 0x000007FF, + 0x00000FFF, 0x00001FFF, 0x00003FFF, 0x00007FFF, + 0x0000FFFF, 0x0001FFFF, 0x0003FFFF, 0x0007FFFF, + 0x000FFFFF, 0x001FFFFF, 0x003FFFFF, 0x007FFFFF, + 0x00FFFFFF, 0x01FFFFFF, 0x03FFFFFF, 0x07FFFFFF, + 0x0FFFFFFF, 0x1FFFFFFF, 0x3FFFFFFF, 0x7FFFFFFF, + 0xFFFFFFFF +}; + +/* F U N C T I O N S */ + +// resets bitstream decoding +static void +mpc_decoder_reset_bitstream_decode(mpc_decoder *d) +{ + d->dword = 0; + d->pos = 0; + d->Zaehler = 0; + d->WordsRead = 0; +} + +// reports the number of read bits +static mpc_uint32_t +mpc_decoder_bits_read(mpc_decoder *d) +{ + return 32 * d->WordsRead + d->pos; +} + +// read desired number of bits out of the bitstream +static mpc_uint32_t +mpc_decoder_bitstream_read(mpc_decoder *d, const mpc_uint32_t bits) +{ + mpc_uint32_t out = d->dword; + + d->pos += bits; + + if (d->pos < 32) { + out >>= (32 - d->pos); + } + else { + d->dword = d->Speicher[d->Zaehler = (d->Zaehler + 1) & MEMMASK]; + d->pos -= 32; + if (d->pos) { + out <<= d->pos; + out |= d->dword >> (32 - d->pos); + } + ++(d->WordsRead); + } + + return out & mask[bits]; +} + +// decode SCFI-bundle (sv4,5,6) +static void +mpc_decoder_scfi_bundle_read( + mpc_decoder *d, + HuffmanTyp* Table, mpc_int32_t* SCFI, mpc_int32_t* DSCF) +{ + // load preview and decode + mpc_uint32_t code = d->dword << d->pos; + if (d->pos > 26) { + code |= d->Speicher[(d->Zaehler + 1) & MEMMASK] >> (32 - d->pos); + } + while (code < Table->Code) { + Table++; + } + + // set the new position within bitstream without performing a dummy-read + if ((d->pos += Table->Length) >= 32) { + d->pos -= 32; + d->dword = d->Speicher[d->Zaehler = (d->Zaehler+1) & MEMMASK]; + ++(d->WordsRead); + } + + *SCFI = Table->Value >> 1; + *DSCF = Table->Value & 1; +} + +static int +mpc_decoder_huffman_typ_cmpfn(const void* p1, const void* p2) +{ + if (((HuffmanTyp*) p1)->Code < ((HuffmanTyp*) p2)->Code ) return +1; + if (((HuffmanTyp*) p1)->Code > ((HuffmanTyp*) p2)->Code ) return -1; + return 0; +} + +// sort huffman-tables by codeword +// offset resulting value +void +mpc_decoder_resort_huff_tables( + const mpc_uint32_t elements, HuffmanTyp* Table, const mpc_int32_t offset ) +{ + mpc_uint32_t i; + + for ( i = 0; i < elements; i++ ) { + Table[i].Code <<= 32 - Table[i].Length; + Table[i].Value = i - offset; + } + qsort(Table, elements, sizeof(*Table), mpc_decoder_huffman_typ_cmpfn); +} + +// basic huffman decoding routine +// works with maximum lengths up to 14 +static mpc_int32_t +mpc_decoder_huffman_decode(mpc_decoder *d, const HuffmanTyp *Table) +{ + // load preview and decode + mpc_uint32_t code = d->dword << d->pos; + if (d->pos > 18) { + code |= d->Speicher[(d->Zaehler + 1) & MEMMASK] >> (32 - d->pos); + } + while (code < Table->Code) { + Table++; + } + + // set the new position within bitstream without performing a dummy-read + if ((d->pos += Table->Length) >= 32) { + d->pos -= 32; + d->dword = d->Speicher[d->Zaehler = (d->Zaehler + 1) & MEMMASK]; + ++(d->WordsRead); + } + + return Table->Value; +} + +// faster huffman through previewing less bits +// works with maximum lengths up to 10 +static mpc_int32_t +mpc_decoder_huffman_decode_fast(mpc_decoder *d, const HuffmanTyp* Table) +{ + // load preview and decode + mpc_uint32_t code = d->dword << d->pos; + if (d->pos > 22) { + code |= d->Speicher[(d->Zaehler + 1) & MEMMASK] >> (32 - d->pos); + } + while (code < Table->Code) { + Table++; + } + + // set the new position within bitstream without performing a dummy-read + if ((d->pos += Table->Length) >= 32) { + d->pos -= 32; + d->dword = d->Speicher[d->Zaehler = (d->Zaehler + 1) & MEMMASK]; + ++(d->WordsRead); + } + + return Table->Value; +} + +// even faster huffman through previewing even less bits +// works with maximum lengths up to 5 +static mpc_int32_t +mpc_decoder_huffman_decode_faster(mpc_decoder *d, const HuffmanTyp* Table) +{ + // load preview and decode + mpc_uint32_t code = d->dword << d->pos; + if (d->pos > 27) { + code |= d->Speicher[(d->Zaehler + 1) & MEMMASK] >> (32 - d->pos); + } + while (code < Table->Code) { + Table++; + } + + // set the new position within bitstream without performing a dummy-read + if ((d->pos += Table->Length) >= 32) { + d->pos -= 32; + d->dword = d->Speicher[d->Zaehler = (d->Zaehler + 1) & MEMMASK]; + ++(d->WordsRead); + } + + return Table->Value; +} + +static void +mpc_decoder_reset_v(mpc_decoder *d) +{ + memset(d->V_L, 0, sizeof d->V_L); + memset(d->V_R, 0, sizeof d->V_R); +} + +static void +mpc_decoder_reset_synthesis(mpc_decoder *d) +{ + mpc_decoder_reset_v(d); +} + +static void +mpc_decoder_reset_y(mpc_decoder *d) +{ + memset(d->Y_L, 0, sizeof d->Y_L); + memset(d->Y_R, 0, sizeof d->Y_R); +} + +static void +mpc_decoder_reset_globals(mpc_decoder *d) +{ + mpc_decoder_reset_bitstream_decode(d); + + d->DecodedFrames = 0; + d->StreamVersion = 0; + d->MS_used = 0; + + memset(d->Y_L , 0, sizeof d->Y_L ); + memset(d->Y_R , 0, sizeof d->Y_R ); + memset(d->SCF_Index_L , 0, sizeof d->SCF_Index_L ); + memset(d->SCF_Index_R , 0, sizeof d->SCF_Index_R ); + memset(d->Res_L , 0, sizeof d->Res_L ); + memset(d->Res_R , 0, sizeof d->Res_R ); + memset(d->SCFI_L , 0, sizeof d->SCFI_L ); + memset(d->SCFI_R , 0, sizeof d->SCFI_R ); + memset(d->DSCF_Flag_L , 0, sizeof d->DSCF_Flag_L ); + memset(d->DSCF_Flag_R , 0, sizeof d->DSCF_Flag_R ); + memset(d->DSCF_Reference_L, 0, sizeof d->DSCF_Reference_L ); + memset(d->DSCF_Reference_R, 0, sizeof d->DSCF_Reference_R ); + memset(d->Q , 0, sizeof d->Q ); + memset(d->MS_Flag , 0, sizeof d->MS_Flag ); +} + +static mpc_uint32_t +mpc_decoder_decode_internal(mpc_decoder *d, MPC_SAMPLE_FORMAT *buffer) +{ + mpc_uint32_t output_frame_length = MPC_FRAME_LENGTH; + + mpc_uint32_t FrameBitCnt = 0; + + if (d->DecodedFrames >= d->OverallFrames) { + return (mpc_uint32_t)(-1); // end of file -> abort decoding + } + + // read jump-info for validity check of frame + d->FwdJumpInfo = mpc_decoder_bitstream_read(d, 20); + + d->ActDecodePos = (d->Zaehler << 5) + d->pos; + + // decode data and check for validity of frame + FrameBitCnt = mpc_decoder_bits_read(d); + switch (d->StreamVersion) { + case 0x04: + case 0x05: + case 0x06: + mpc_decoder_read_bitstream_sv6(d); + break; + case 0x07: + case 0x17: + mpc_decoder_read_bitstream_sv7(d); + break; + default: + return (mpc_uint32_t)(-1); + } + d->FrameWasValid = mpc_decoder_bits_read(d) - FrameBitCnt == d->FwdJumpInfo; + + // synthesize signal + mpc_decoder_requantisierung(d, d->Max_Band); + + //if ( d->EQ_activated && PluginSettings.EQbyMPC ) + // perform_EQ (); + + mpc_decoder_synthese_filter_float(d, buffer); + + d->DecodedFrames++; + + // cut off first MPC_DECODER_SYNTH_DELAY zero-samples + if (d->DecodedFrames == d->OverallFrames && d->StreamVersion >= 6) { + // reconstruct exact filelength + mpc_int32_t mod_block = mpc_decoder_bitstream_read(d, 11); + mpc_int32_t FilterDecay; + + if (mod_block == 0) { + // Encoder bugfix + mod_block = 1152; + } + FilterDecay = (mod_block + MPC_DECODER_SYNTH_DELAY) % MPC_FRAME_LENGTH; + + // additional FilterDecay samples are needed for decay of synthesis filter + if (MPC_DECODER_SYNTH_DELAY + mod_block >= MPC_FRAME_LENGTH) { + + // ********************************************************************** + // Rhoades 4/16/2002 + // Commented out are blocks of code which cause gapless playback to fail. + // Temporary fix... + // ********************************************************************** + + if (!d->TrueGaplessPresent) { + mpc_decoder_reset_y(d); + } + else { + //if ( MPC_FRAME_LENGTH != d->LastValidSamples ) { + mpc_decoder_bitstream_read(d, 20); + mpc_decoder_read_bitstream_sv7(d); + mpc_decoder_requantisierung(d, d->Max_Band); + //FilterDecay = d->LastValidSamples; + //} + //else { + //FilterDecay = 0; + //} + } + + mpc_decoder_synthese_filter_float(d, buffer + 2304); + + output_frame_length = MPC_FRAME_LENGTH + FilterDecay; + } + else { // there are only FilterDecay samples needed for this frame + output_frame_length = FilterDecay; + } + } + + if (d->samples_to_skip) { + if (output_frame_length < d->samples_to_skip) { + d->samples_to_skip -= output_frame_length; + output_frame_length = 0; + } + else { + output_frame_length -= d->samples_to_skip; + memmove( + buffer, + buffer + d->samples_to_skip * 2, + output_frame_length * 2 * sizeof (MPC_SAMPLE_FORMAT)); + d->samples_to_skip = 0; + } + } + + return output_frame_length; +} + +mpc_uint32_t mpc_decoder_decode( + mpc_decoder *d, + MPC_SAMPLE_FORMAT *buffer, + mpc_uint32_t *vbr_update_acc, + mpc_uint32_t *vbr_update_bits) +{ + for(;;) + { + //const mpc_int32_t MaxBrokenFrames = 0; // PluginSettings.MaxBrokenFrames + + mpc_uint32_t RING = d->Zaehler; + mpc_int32_t vbr_ring = (RING << 5) + d->pos; + + mpc_uint32_t valid_samples = mpc_decoder_decode_internal(d, buffer); + + if (valid_samples == (mpc_uint32_t)(-1) ) { + return 0; + } + + /**************** ERROR CONCEALMENT *****************/ + if (d->FrameWasValid == 0 ) { + // error occurred in bitstream + return (mpc_uint32_t)(-1); + } + else { + if (vbr_update_acc && vbr_update_bits) { + (*vbr_update_acc) ++; + vbr_ring = (d->Zaehler << 5) + d->pos - vbr_ring; + if (vbr_ring < 0) { + vbr_ring += 524288; + } + (*vbr_update_bits) += vbr_ring; + } + + } + mpc_decoder_update_buffer(d, RING); + + if (valid_samples > 0) { + return valid_samples; + } + } +} + +void +mpc_decoder_requantisierung(mpc_decoder *d, const mpc_int32_t Last_Band) +{ + mpc_int32_t Band; + mpc_int32_t n; + MPC_SAMPLE_FORMAT facL; + MPC_SAMPLE_FORMAT facR; + MPC_SAMPLE_FORMAT templ; + MPC_SAMPLE_FORMAT tempr; + MPC_SAMPLE_FORMAT* YL; + MPC_SAMPLE_FORMAT* YR; + mpc_int32_t* L; + mpc_int32_t* R; + +#ifdef MPC_FIXED_POINT +#if MPC_FIXED_POINT_FRACTPART == 14 +#define MPC_MULTIPLY_SCF(CcVal, SCF_idx) \ + MPC_MULTIPLY_EX(CcVal, d->SCF[SCF_idx], d->SCF_shift[SCF_idx]) +#else + +#error FIXME, Cc table is in 18.14 format + +#endif +#else +#define MPC_MULTIPLY_SCF(CcVal, SCF_idx) \ + MPC_MULTIPLY(CcVal, d->SCF[SCF_idx]) +#endif + // requantization and scaling of subband-samples + for ( Band = 0; Band <= Last_Band; Band++ ) { // setting pointers + YL = d->Y_L[0] + Band; + YR = d->Y_R[0] + Band; + L = d->Q[Band].L; + R = d->Q[Band].R; + /************************** MS-coded **************************/ + if ( d->MS_Flag [Band] ) { + if ( d->Res_L [Band] ) { + if ( d->Res_R [Band] ) { // M!=0, S!=0 + facL = MPC_MULTIPLY_SCF( Cc[d->Res_L[Band]] , (unsigned char)d->SCF_Index_L[Band][0]); + facR = MPC_MULTIPLY_SCF( Cc[d->Res_R[Band]] , (unsigned char)d->SCF_Index_R[Band][0]); + for ( n = 0; n < 12; n++, YL += 32, YR += 32 ) { + *YL = (templ = MPC_MULTIPLY_FLOAT_INT(facL,*L++))+(tempr = MPC_MULTIPLY_FLOAT_INT(facR,*R++)); + *YR = templ - tempr; + } + facL = MPC_MULTIPLY_SCF( Cc[d->Res_L[Band]] , (unsigned char)d->SCF_Index_L[Band][1]); + facR = MPC_MULTIPLY_SCF( Cc[d->Res_R[Band]] , (unsigned char)d->SCF_Index_R[Band][1]); + for ( ; n < 24; n++, YL += 32, YR += 32 ) { + *YL = (templ = MPC_MULTIPLY_FLOAT_INT(facL,*L++))+(tempr = MPC_MULTIPLY_FLOAT_INT(facR,*R++)); + *YR = templ - tempr; + } + facL = MPC_MULTIPLY_SCF( Cc[d->Res_L[Band]] , (unsigned char)d->SCF_Index_L[Band][2]); + facR = MPC_MULTIPLY_SCF( Cc[d->Res_R[Band]] , (unsigned char)d->SCF_Index_R[Band][2]); + for ( ; n < 36; n++, YL += 32, YR += 32 ) { + *YL = (templ = MPC_MULTIPLY_FLOAT_INT(facL,*L++))+(tempr = MPC_MULTIPLY_FLOAT_INT(facR,*R++)); + *YR = templ - tempr; + } + } else { // M!=0, S==0 + facL = MPC_MULTIPLY_SCF( Cc[d->Res_L[Band]] , (unsigned char)d->SCF_Index_L[Band][0]); + for ( n = 0; n < 12; n++, YL += 32, YR += 32 ) { + *YR = *YL = MPC_MULTIPLY_FLOAT_INT(facL,*L++); + } + facL = MPC_MULTIPLY_SCF( Cc[d->Res_L[Band]] , (unsigned char)d->SCF_Index_L[Band][1]); + for ( ; n < 24; n++, YL += 32, YR += 32 ) { + *YR = *YL = MPC_MULTIPLY_FLOAT_INT(facL,*L++); + } + facL = MPC_MULTIPLY_SCF( Cc[d->Res_L[Band]] , (unsigned char)d->SCF_Index_L[Band][2]); + for ( ; n < 36; n++, YL += 32, YR += 32 ) { + *YR = *YL = MPC_MULTIPLY_FLOAT_INT(facL,*L++); + } + } + } else { + if (d->Res_R[Band]) // M==0, S!=0 + { + facR = MPC_MULTIPLY_SCF( Cc[d->Res_R[Band]] , (unsigned char)d->SCF_Index_R[Band][0]); + for ( n = 0; n < 12; n++, YL += 32, YR += 32 ) { + *YR = - (*YL = MPC_MULTIPLY_FLOAT_INT(facR,*(R++))); + } + facR = MPC_MULTIPLY_SCF( Cc[d->Res_R[Band]] , (unsigned char)d->SCF_Index_R[Band][1]); + for ( ; n < 24; n++, YL += 32, YR += 32 ) { + *YR = - (*YL = MPC_MULTIPLY_FLOAT_INT(facR,*(R++))); + } + facR = MPC_MULTIPLY_SCF( Cc[d->Res_R[Band]] , (unsigned char)d->SCF_Index_R[Band][2]); + for ( ; n < 36; n++, YL += 32, YR += 32 ) { + *YR = - (*YL = MPC_MULTIPLY_FLOAT_INT(facR,*(R++))); + } + } else { // M==0, S==0 + for ( n = 0; n < 36; n++, YL += 32, YR += 32 ) { + *YR = *YL = 0; + } + } + } + } + /************************** LR-coded **************************/ + else { + if ( d->Res_L [Band] ) { + if ( d->Res_R [Band] ) { // L!=0, R!=0 + facL = MPC_MULTIPLY_SCF( Cc[d->Res_L[Band]] , (unsigned char)d->SCF_Index_L[Band][0]); + facR = MPC_MULTIPLY_SCF( Cc[d->Res_R[Band]] , (unsigned char)d->SCF_Index_R[Band][0]); + for (n = 0; n < 12; n++, YL += 32, YR += 32 ) { + *YL = MPC_MULTIPLY_FLOAT_INT(facL,*L++); + *YR = MPC_MULTIPLY_FLOAT_INT(facR,*R++); + } + facL = MPC_MULTIPLY_SCF( Cc[d->Res_L[Band]] , (unsigned char)d->SCF_Index_L[Band][1]); + facR = MPC_MULTIPLY_SCF( Cc[d->Res_R[Band]] , (unsigned char)d->SCF_Index_R[Band][1]); + for (; n < 24; n++, YL += 32, YR += 32 ) { + *YL = MPC_MULTIPLY_FLOAT_INT(facL,*L++); + *YR = MPC_MULTIPLY_FLOAT_INT(facR,*R++); + } + facL = MPC_MULTIPLY_SCF( Cc[d->Res_L[Band]] , (unsigned char)d->SCF_Index_L[Band][2]); + facR = MPC_MULTIPLY_SCF( Cc[d->Res_R[Band]] , (unsigned char)d->SCF_Index_R[Band][2]); + for (; n < 36; n++, YL += 32, YR += 32 ) { + *YL = MPC_MULTIPLY_FLOAT_INT(facL,*L++); + *YR = MPC_MULTIPLY_FLOAT_INT(facR,*R++); + } + } else { // L!=0, R==0 + facL = MPC_MULTIPLY_SCF( Cc[d->Res_L[Band]] , (unsigned char)d->SCF_Index_L[Band][0]); + for ( n = 0; n < 12; n++, YL += 32, YR += 32 ) { + *YL = MPC_MULTIPLY_FLOAT_INT(facL,*L++); + *YR = 0; + } + facL = MPC_MULTIPLY_SCF( Cc[d->Res_L[Band]] , (unsigned char)d->SCF_Index_L[Band][1]); + for ( ; n < 24; n++, YL += 32, YR += 32 ) { + *YL = MPC_MULTIPLY_FLOAT_INT(facL,*L++); + *YR = 0; + } + facL = MPC_MULTIPLY_SCF( Cc[d->Res_L[Band]] , (unsigned char)d->SCF_Index_L[Band][2]); + for ( ; n < 36; n++, YL += 32, YR += 32 ) { + *YL = MPC_MULTIPLY_FLOAT_INT(facL,*L++); + *YR = 0; + } + } + } + else { + if ( d->Res_R [Band] ) { // L==0, R!=0 + facR = MPC_MULTIPLY_SCF( Cc[d->Res_R[Band]] , (unsigned char)d->SCF_Index_R[Band][0]); + for ( n = 0; n < 12; n++, YL += 32, YR += 32 ) { + *YL = 0; + *YR = MPC_MULTIPLY_FLOAT_INT(facR,*R++); + } + facR = MPC_MULTIPLY_SCF( Cc[d->Res_R[Band]] , (unsigned char)d->SCF_Index_R[Band][1]); + for ( ; n < 24; n++, YL += 32, YR += 32 ) { + *YL = 0; + *YR = MPC_MULTIPLY_FLOAT_INT(facR,*R++); + } + facR = MPC_MULTIPLY_SCF( Cc[d->Res_R[Band]] , (unsigned char)d->SCF_Index_R[Band][2]); + for ( ; n < 36; n++, YL += 32, YR += 32 ) { + *YL = 0; + *YR = MPC_MULTIPLY_FLOAT_INT(facR,*R++); + } + } else { // L==0, R==0 + for ( n = 0; n < 36; n++, YL += 32, YR += 32 ) { + *YR = *YL = 0; + } + } + } + } + } +} + +/****************************************** SV 6 ******************************************/ +void +mpc_decoder_read_bitstream_sv6(mpc_decoder *d) +{ + mpc_int32_t n,k; + mpc_int32_t Max_used_Band=0; + HuffmanTyp *Table; + const HuffmanTyp *x1; + const HuffmanTyp *x2; + mpc_int32_t *L; + mpc_int32_t *R; + mpc_int32_t *ResL = d->Res_L; + mpc_int32_t *ResR = d->Res_R; + + /************************ HEADER **************************/ + ResL = d->Res_L; + ResR = d->Res_R; + for (n=0; n <= d->Max_Band; ++n, ++ResL, ++ResR) + { + if (n<11) Table = d->Region_A; + else if (n>=11 && n<=22) Table = d->Region_B; + else /*if (n>=23)*/ Table = d->Region_C; + + *ResL = d->Q_res[n][mpc_decoder_huffman_decode(d, Table)]; + if (d->MS_used) { + d->MS_Flag[n] = mpc_decoder_bitstream_read(d, 1); + } + *ResR = d->Q_res[n][mpc_decoder_huffman_decode(d, Table)]; + + // only perform the following procedure up to the maximum non-zero subband + if (*ResL || *ResR) Max_used_Band = n; + } + + /************************* SCFI-Bundle *****************************/ + ResL = d->Res_L; + ResR = d->Res_R; + for (n=0; n<=Max_used_Band; ++n, ++ResL, ++ResR) { + if (*ResL) mpc_decoder_scfi_bundle_read(d, d->SCFI_Bundle, &(d->SCFI_L[n]), &(d->DSCF_Flag_L[n])); + if (*ResR) mpc_decoder_scfi_bundle_read(d, d->SCFI_Bundle, &(d->SCFI_R[n]), &(d->DSCF_Flag_R[n])); + } + + /***************************** SCFI ********************************/ + ResL = d->Res_L; + ResR = d->Res_R; + L = d->SCF_Index_L[0]; + R = d->SCF_Index_R[0]; + for (n=0; n <= Max_used_Band; ++n, ++ResL, ++ResR, L+=3, R+=3) + { + if (*ResL) + { + /*********** DSCF ************/ + if (d->DSCF_Flag_L[n]==1) + { + L[2] = d->DSCF_Reference_L[n]; + switch (d->SCFI_L[n]) + { + case 3: + L[0] = L[2] + mpc_decoder_huffman_decode_fast(d, d->DSCF_Entropie); + L[1] = L[0]; + L[2] = L[1]; + break; + case 1: + L[0] = L[2] + mpc_decoder_huffman_decode_fast(d, d->DSCF_Entropie); + L[1] = L[0] + mpc_decoder_huffman_decode_fast(d, d->DSCF_Entropie); + L[2] = L[1]; + break; + case 2: + L[0] = L[2] + mpc_decoder_huffman_decode_fast(d, d->DSCF_Entropie); + L[1] = L[0]; + L[2] = L[1] + mpc_decoder_huffman_decode_fast(d, d->DSCF_Entropie); + break; + case 0: + L[0] = L[2] + mpc_decoder_huffman_decode_fast(d, d->DSCF_Entropie); + L[1] = L[0] + mpc_decoder_huffman_decode_fast(d, d->DSCF_Entropie); + L[2] = L[1] + mpc_decoder_huffman_decode_fast(d, d->DSCF_Entropie); + break; + default: + return; + break; + } + } + /************ SCF ************/ + else + { + switch (d->SCFI_L[n]) + { + case 3: + L[0] = mpc_decoder_bitstream_read(d, 6); + L[1] = L[0]; + L[2] = L[1]; + break; + case 1: + L[0] = mpc_decoder_bitstream_read(d, 6); + L[1] = mpc_decoder_bitstream_read(d, 6); + L[2] = L[1]; + break; + case 2: + L[0] = mpc_decoder_bitstream_read(d, 6); + L[1] = L[0]; + L[2] = mpc_decoder_bitstream_read(d, 6); + break; + case 0: + L[0] = mpc_decoder_bitstream_read(d, 6); + L[1] = mpc_decoder_bitstream_read(d, 6); + L[2] = mpc_decoder_bitstream_read(d, 6); + break; + default: + return; + break; + } + } + // update Reference for DSCF + d->DSCF_Reference_L[n] = L[2]; + } + if (*ResR) + { + R[2] = d->DSCF_Reference_R[n]; + /*********** DSCF ************/ + if (d->DSCF_Flag_R[n]==1) + { + switch (d->SCFI_R[n]) + { + case 3: + R[0] = R[2] + mpc_decoder_huffman_decode_fast(d, d->DSCF_Entropie); + R[1] = R[0]; + R[2] = R[1]; + break; + case 1: + R[0] = R[2] + mpc_decoder_huffman_decode_fast(d, d->DSCF_Entropie); + R[1] = R[0] + mpc_decoder_huffman_decode_fast(d, d->DSCF_Entropie); + R[2] = R[1]; + break; + case 2: + R[0] = R[2] + mpc_decoder_huffman_decode_fast(d, d->DSCF_Entropie); + R[1] = R[0]; + R[2] = R[1] + mpc_decoder_huffman_decode_fast(d, d->DSCF_Entropie); + break; + case 0: + R[0] = R[2] + mpc_decoder_huffman_decode_fast(d, d->DSCF_Entropie); + R[1] = R[0] + mpc_decoder_huffman_decode_fast(d, d->DSCF_Entropie); + R[2] = R[1] + mpc_decoder_huffman_decode_fast(d, d->DSCF_Entropie); + break; + default: + return; + break; + } + } + /************ SCF ************/ + else + { + switch (d->SCFI_R[n]) + { + case 3: + R[0] = mpc_decoder_bitstream_read(d, 6); + R[1] = R[0]; + R[2] = R[1]; + break; + case 1: + R[0] = mpc_decoder_bitstream_read(d, 6); + R[1] = mpc_decoder_bitstream_read(d, 6); + R[2] = R[1]; + break; + case 2: + R[0] = mpc_decoder_bitstream_read(d, 6); + R[1] = R[0]; + R[2] = mpc_decoder_bitstream_read(d, 6); + break; + case 0: + R[0] = mpc_decoder_bitstream_read(d, 6); + R[1] = mpc_decoder_bitstream_read(d, 6); + R[2] = mpc_decoder_bitstream_read(d, 6); + break; + default: + return; + break; + } + } + // update Reference for DSCF + d->DSCF_Reference_R[n] = R[2]; + } + } + + /**************************** Samples ****************************/ + ResL = d->Res_L; + ResR = d->Res_R; + for (n=0; n <= Max_used_Band; ++n, ++ResL, ++ResR) + { + // setting pointers + x1 = d->SampleHuff[*ResL]; + x2 = d->SampleHuff[*ResR]; + L = d->Q[n].L; + R = d->Q[n].R; + + if (x1!=NULL || x2!=NULL) + for (k=0; k<36; ++k) + { + if (x1 != NULL) *L++ = mpc_decoder_huffman_decode_fast(d, x1); + if (x2 != NULL) *R++ = mpc_decoder_huffman_decode_fast(d, x2); + } + + if (*ResL>7 || *ResR>7) + for (k=0; k<36; ++k) + { + if (*ResL>7) *L++ = (mpc_int32_t)mpc_decoder_bitstream_read(d, Res_bit[*ResL]) - Dc[*ResL]; + if (*ResR>7) *R++ = (mpc_int32_t)mpc_decoder_bitstream_read(d, Res_bit[*ResR]) - Dc[*ResR]; + } + } +} + +/****************************************** SV 7 ******************************************/ +void +mpc_decoder_read_bitstream_sv7(mpc_decoder *d) +{ + // these arrays hold decoding results for bundled quantizers (3- and 5-step) + /*static*/ mpc_int32_t idx30[] = { -1, 0, 1,-1, 0, 1,-1, 0, 1,-1, 0, 1,-1, 0, 1,-1, 0, 1,-1, 0, 1,-1, 0, 1,-1, 0, 1}; + /*static*/ mpc_int32_t idx31[] = { -1,-1,-1, 0, 0, 0, 1, 1, 1,-1,-1,-1, 0, 0, 0, 1, 1, 1,-1,-1,-1, 0, 0, 0, 1, 1, 1}; + /*static*/ mpc_int32_t idx32[] = { -1,-1,-1,-1,-1,-1,-1,-1,-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1}; + /*static*/ mpc_int32_t idx50[] = { -2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2}; + /*static*/ mpc_int32_t idx51[] = { -2,-2,-2,-2,-2,-1,-1,-1,-1,-1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2}; + + mpc_int32_t n,k; + mpc_int32_t Max_used_Band=0; + const HuffmanTyp *Table; + mpc_int32_t idx; + mpc_int32_t *L ,*R; + mpc_int32_t *ResL,*ResR; + mpc_uint32_t tmp; + + /***************************** Header *****************************/ + ResL = d->Res_L; + ResR = d->Res_R; + + // first subband + *ResL = mpc_decoder_bitstream_read(d, 4); + *ResR = mpc_decoder_bitstream_read(d, 4); + if (d->MS_used && !(*ResL==0 && *ResR==0)) { + d->MS_Flag[0] = mpc_decoder_bitstream_read(d, 1); + } + + // consecutive subbands + ++ResL; ++ResR; // increase pointers + for (n=1; n <= d->Max_Band; ++n, ++ResL, ++ResR) + { + idx = mpc_decoder_huffman_decode_fast(d, d->HuffHdr); + *ResL = (idx!=4) ? *(ResL-1) + idx : mpc_decoder_bitstream_read(d, 4); + + idx = mpc_decoder_huffman_decode_fast(d, d->HuffHdr); + *ResR = (idx!=4) ? *(ResR-1) + idx : mpc_decoder_bitstream_read(d, 4); + + if (d->MS_used && !(*ResL==0 && *ResR==0)) { + d->MS_Flag[n] = mpc_decoder_bitstream_read(d, 1); + } + + // only perform following procedures up to the maximum non-zero subband + if (*ResL!=0 || *ResR!=0) { + Max_used_Band = n; + } + } + /****************************** SCFI ******************************/ + L = d->SCFI_L; + R = d->SCFI_R; + ResL = d->Res_L; + ResR = d->Res_R; + for (n=0; n <= Max_used_Band; ++n, ++L, ++R, ++ResL, ++ResR) { + if (*ResL) *L = mpc_decoder_huffman_decode_faster(d, d->HuffSCFI); + if (*ResR) *R = mpc_decoder_huffman_decode_faster(d, d->HuffSCFI); + } + + /**************************** SCF/DSCF ****************************/ + ResL = d->Res_L; + ResR = d->Res_R; + L = d->SCF_Index_L[0]; + R = d->SCF_Index_R[0]; + for (n=0; n<=Max_used_Band; ++n, ++ResL, ++ResR, L+=3, R+=3) { + if (*ResL) + { + L[2] = d->DSCF_Reference_L[n]; + switch (d->SCFI_L[n]) + { + case 1: + idx = mpc_decoder_huffman_decode_fast(d, d->HuffDSCF); + L[0] = (idx!=8) ? L[2] + idx : mpc_decoder_bitstream_read(d, 6); + idx = mpc_decoder_huffman_decode_fast(d, d->HuffDSCF); + L[1] = (idx!=8) ? L[0] + idx : mpc_decoder_bitstream_read(d, 6); + L[2] = L[1]; + break; + case 3: + idx = mpc_decoder_huffman_decode_fast(d, d->HuffDSCF); + L[0] = (idx!=8) ? L[2] + idx : mpc_decoder_bitstream_read(d, 6); + L[1] = L[0]; + L[2] = L[1]; + break; + case 2: + idx = mpc_decoder_huffman_decode_fast(d, d->HuffDSCF); + L[0] = (idx!=8) ? L[2] + idx : mpc_decoder_bitstream_read(d, 6); + L[1] = L[0]; + idx = mpc_decoder_huffman_decode_fast(d, d->HuffDSCF); + L[2] = (idx!=8) ? L[1] + idx : mpc_decoder_bitstream_read(d, 6); + break; + case 0: + idx = mpc_decoder_huffman_decode_fast(d, d->HuffDSCF); + L[0] = (idx!=8) ? L[2] + idx : mpc_decoder_bitstream_read(d, 6); + idx = mpc_decoder_huffman_decode_fast(d, d->HuffDSCF); + L[1] = (idx!=8) ? L[0] + idx : mpc_decoder_bitstream_read(d, 6); + idx = mpc_decoder_huffman_decode_fast(d, d->HuffDSCF); + L[2] = (idx!=8) ? L[1] + idx : mpc_decoder_bitstream_read(d, 6); + break; + default: + return; + break; + } + // update Reference for DSCF + d->DSCF_Reference_L[n] = L[2]; + } + if (*ResR) + { + R[2] = d->DSCF_Reference_R[n]; + switch (d->SCFI_R[n]) + { + case 1: + idx = mpc_decoder_huffman_decode_fast(d, d->HuffDSCF); + R[0] = (idx!=8) ? R[2] + idx : mpc_decoder_bitstream_read(d, 6); + idx = mpc_decoder_huffman_decode_fast(d, d->HuffDSCF); + R[1] = (idx!=8) ? R[0] + idx : mpc_decoder_bitstream_read(d, 6); + R[2] = R[1]; + break; + case 3: + idx = mpc_decoder_huffman_decode_fast(d, d->HuffDSCF); + R[0] = (idx!=8) ? R[2] + idx : mpc_decoder_bitstream_read(d, 6); + R[1] = R[0]; + R[2] = R[1]; + break; + case 2: + idx = mpc_decoder_huffman_decode_fast(d, d->HuffDSCF); + R[0] = (idx!=8) ? R[2] + idx : mpc_decoder_bitstream_read(d, 6); + R[1] = R[0]; + idx = mpc_decoder_huffman_decode_fast(d, d->HuffDSCF); + R[2] = (idx!=8) ? R[1] + idx : mpc_decoder_bitstream_read(d, 6); + break; + case 0: + idx = mpc_decoder_huffman_decode_fast(d, d->HuffDSCF); + R[0] = (idx!=8) ? R[2] + idx : mpc_decoder_bitstream_read(d, 6); + idx = mpc_decoder_huffman_decode_fast(d, d->HuffDSCF); + R[1] = (idx!=8) ? R[0] + idx : mpc_decoder_bitstream_read(d, 6); + idx = mpc_decoder_huffman_decode_fast(d, d->HuffDSCF); + R[2] = (idx!=8) ? R[1] + idx : mpc_decoder_bitstream_read(d, 6); + break; + default: + return; + break; + } + // update Reference for DSCF + d->DSCF_Reference_R[n] = R[2]; + } + } + /***************************** Samples ****************************/ + ResL = d->Res_L; + ResR = d->Res_R; + L = d->Q[0].L; + R = d->Q[0].R; + for (n=0; n <= Max_used_Band; ++n, ++ResL, ++ResR, L+=36, R+=36) + { + /************** links **************/ + switch (*ResL) + { + case -2: case -3: case -4: case -5: case -6: case -7: case -8: case -9: + case -10: case -11: case -12: case -13: case -14: case -15: case -16: case -17: + L += 36; + break; + case -1: + for (k=0; k<36; k++ ) { + tmp = mpc_random_int(d); + *L++ = ((tmp >> 24) & 0xFF) + ((tmp >> 16) & 0xFF) + ((tmp >> 8) & 0xFF) + ((tmp >> 0) & 0xFF) - 510; + } + break; + case 0: + L += 36;// increase pointer + break; + case 1: + Table = d->HuffQ[mpc_decoder_bitstream_read(d, 1)][1]; + for (k=0; k<12; ++k) + { + idx = mpc_decoder_huffman_decode_fast(d, Table); + *L++ = idx30[idx]; + *L++ = idx31[idx]; + *L++ = idx32[idx]; + } + break; + case 2: + Table = d->HuffQ[mpc_decoder_bitstream_read(d, 1)][2]; + for (k=0; k<18; ++k) + { + idx = mpc_decoder_huffman_decode_fast(d, Table); + *L++ = idx50[idx]; + *L++ = idx51[idx]; + } + break; + case 3: + case 4: + Table = d->HuffQ[mpc_decoder_bitstream_read(d, 1)][*ResL]; + for (k=0; k<36; ++k) + *L++ = mpc_decoder_huffman_decode_faster(d, Table); + break; + case 5: + Table = d->HuffQ[mpc_decoder_bitstream_read(d, 1)][*ResL]; + for (k=0; k<36; ++k) + *L++ = mpc_decoder_huffman_decode_fast(d, Table); + break; + case 6: + case 7: + Table = d->HuffQ[mpc_decoder_bitstream_read(d, 1)][*ResL]; + for (k=0; k<36; ++k) + *L++ = mpc_decoder_huffman_decode(d, Table); + break; + case 8: case 9: case 10: case 11: case 12: case 13: case 14: case 15: case 16: case 17: + tmp = Dc[*ResL]; + for (k=0; k<36; ++k) + *L++ = (mpc_int32_t)mpc_decoder_bitstream_read(d, Res_bit[*ResL]) - tmp; + break; + default: + return; + } + /************** rechts **************/ + switch (*ResR) + { + case -2: case -3: case -4: case -5: case -6: case -7: case -8: case -9: + case -10: case -11: case -12: case -13: case -14: case -15: case -16: case -17: + R += 36; + break; + case -1: + for (k=0; k<36; k++ ) { + tmp = mpc_random_int(d); + *R++ = ((tmp >> 24) & 0xFF) + ((tmp >> 16) & 0xFF) + ((tmp >> 8) & 0xFF) + ((tmp >> 0) & 0xFF) - 510; + } + break; + case 0: + R += 36;// increase pointer + break; + case 1: + Table = d->HuffQ[mpc_decoder_bitstream_read(d, 1)][1]; + for (k=0; k<12; ++k) + { + idx = mpc_decoder_huffman_decode_fast(d, Table); + *R++ = idx30[idx]; + *R++ = idx31[idx]; + *R++ = idx32[idx]; + } + break; + case 2: + Table = d->HuffQ[mpc_decoder_bitstream_read(d, 1)][2]; + for (k=0; k<18; ++k) + { + idx = mpc_decoder_huffman_decode_fast(d, Table); + *R++ = idx50[idx]; + *R++ = idx51[idx]; + } + break; + case 3: + case 4: + Table = d->HuffQ[mpc_decoder_bitstream_read(d, 1)][*ResR]; + for (k=0; k<36; ++k) + *R++ = mpc_decoder_huffman_decode_faster(d, Table); + break; + case 5: + Table = d->HuffQ[mpc_decoder_bitstream_read(d, 1)][*ResR]; + for (k=0; k<36; ++k) + *R++ = mpc_decoder_huffman_decode_fast(d, Table); + break; + case 6: + case 7: + Table = d->HuffQ[mpc_decoder_bitstream_read(d, 1)][*ResR]; + for (k=0; k<36; ++k) + *R++ = mpc_decoder_huffman_decode(d, Table); + break; + case 8: case 9: case 10: case 11: case 12: case 13: case 14: case 15: case 16: case 17: + tmp = Dc[*ResR]; + for (k=0; k<36; ++k) + *R++ = (mpc_int32_t)mpc_decoder_bitstream_read(d, Res_bit[*ResR]) - tmp; + break; + default: + return; + } + } +} + +void mpc_decoder_setup(mpc_decoder *d, mpc_reader *r) +{ + d->r = r; + + d->HuffQ[0][0] = 0; + d->HuffQ[1][0] = 0; + d->HuffQ[0][1] = d->HuffQ1[0]; + d->HuffQ[1][1] = d->HuffQ1[1]; + d->HuffQ[0][2] = d->HuffQ2[0]; + d->HuffQ[1][2] = d->HuffQ2[1]; + d->HuffQ[0][3] = d->HuffQ3[0]; + d->HuffQ[1][3] = d->HuffQ3[1]; + d->HuffQ[0][4] = d->HuffQ4[0]; + d->HuffQ[1][4] = d->HuffQ4[1]; + d->HuffQ[0][5] = d->HuffQ5[0]; + d->HuffQ[1][5] = d->HuffQ5[1]; + d->HuffQ[0][6] = d->HuffQ6[0]; + d->HuffQ[1][6] = d->HuffQ6[1]; + d->HuffQ[0][7] = d->HuffQ7[0]; + d->HuffQ[1][7] = d->HuffQ7[1]; + + d->SampleHuff[0] = NULL; + d->SampleHuff[1] = d->Entropie_1; + d->SampleHuff[2] = d->Entropie_2; + d->SampleHuff[3] = d->Entropie_3; + d->SampleHuff[4] = d->Entropie_4; + d->SampleHuff[5] = d->Entropie_5; + d->SampleHuff[6] = d->Entropie_6; + d->SampleHuff[7] = d->Entropie_7; + d->SampleHuff[8] = NULL; + d->SampleHuff[9] = NULL; + d->SampleHuff[10] = NULL; + d->SampleHuff[11] = NULL; + d->SampleHuff[12] = NULL; + d->SampleHuff[13] = NULL; + d->SampleHuff[14] = NULL; + d->SampleHuff[15] = NULL; + d->SampleHuff[16] = NULL; + d->SampleHuff[17] = NULL; + + d->EQ_activated = 0; + d->MPCHeaderPos = 0; + d->StreamVersion = 0; + d->MS_used = 0; + d->FwdJumpInfo = 0; + d->ActDecodePos = 0; + d->FrameWasValid = 0; + d->OverallFrames = 0; + d->DecodedFrames = 0; + d->LastValidSamples = 0; + d->TrueGaplessPresent = 0; + d->WordsRead = 0; + d->Max_Band = 0; + d->SampleRate = 0; +// clips = 0; + d->__r1 = 1; + d->__r2 = 1; + + d->dword = 0; + d->pos = 0; + d->Zaehler = 0; + d->WordsRead = 0; + d->Max_Band = 0; + + mpc_decoder_initialisiere_quantisierungstabellen(d, 1.0f); + mpc_decoder_init_huffman_sv6(d); + mpc_decoder_init_huffman_sv7(d); +} + +static void mpc_decoder_set_streaminfo(mpc_decoder *d, mpc_streaminfo *si) +{ + mpc_decoder_reset_synthesis(d); + mpc_decoder_reset_globals(d); + + d->StreamVersion = si->stream_version; + d->MS_used = si->ms; + d->Max_Band = si->max_band; + d->OverallFrames = si->frames; + d->MPCHeaderPos = si->header_position; + d->LastValidSamples = si->last_frame_samples; + d->TrueGaplessPresent = si->is_true_gapless; + d->SampleRate = (mpc_int32_t)si->sample_freq; + + d->samples_to_skip = MPC_DECODER_SYNTH_DELAY; +} + +mpc_bool_t mpc_decoder_initialize(mpc_decoder *d, mpc_streaminfo *si) +{ + mpc_decoder_set_streaminfo(d, si); + + // AB: setting position to the beginning of the data-bitstream + switch (d->StreamVersion) { + case 0x04: f_seek(d, 4 + d->MPCHeaderPos); d->pos = 16; break; // Geht auch über eine der Helperfunktionen + case 0x05: + case 0x06: f_seek(d, 8 + d->MPCHeaderPos); d->pos = 0; break; + case 0x07: + case 0x17: /*f_seek ( 24 + d->MPCHeaderPos );*/ d->pos = 8; break; + default: return FALSE; + } + + // AB: fill buffer and initialize decoder + f_read_dword(d, d->Speicher, MEMSIZE ); + d->dword = d->Speicher[d->Zaehler = 0]; + + return TRUE; +} + +//--------------------------------------------------------------- +// will seek from the beginning of the file to the desired +// position in ms (given by seek_needed) +//--------------------------------------------------------------- +#if 0 +static void +helper1(mpc_decoder *d, mpc_uint32_t bitpos) +{ + f_seek(d, (bitpos >> 5) * 4 + d->MPCHeaderPos); + f_read_dword(d, d->Speicher, 2); + d->dword = d->Speicher[d->Zaehler = 0]; + d->pos = bitpos & 31; +} +#endif + +static void +helper2(mpc_decoder *d, mpc_uint32_t bitpos) +{ + f_seek(d, (bitpos>>5) * 4 + d->MPCHeaderPos); + f_read_dword(d, d->Speicher, MEMSIZE); + d->dword = d->Speicher[d->Zaehler = 0]; + d->pos = bitpos & 31; +} + +#if 0 +static void +helper3(mpc_decoder *d, mpc_uint32_t bitpos, mpc_uint32_t* buffoffs) +{ + d->pos = bitpos & 31; + bitpos >>= 5; + if ((mpc_uint32_t)(bitpos - *buffoffs) >= MEMSIZE - 2) { + *buffoffs = bitpos; + f_seek(d, bitpos * 4L + d->MPCHeaderPos); + f_read_dword(d, d->Speicher, MEMSIZE ); + } + d->dword = d->Speicher[d->Zaehler = bitpos - *buffoffs ]; +} +#endif + +static mpc_uint32_t get_initial_fpos(mpc_decoder *d, mpc_uint32_t StreamVersion) +{ + mpc_uint32_t fpos = 0; + switch ( d->StreamVersion ) { // setting position to the beginning of the data-bitstream + case 0x04: fpos = 48; break; + case 0x05: + case 0x06: fpos = 64; break; + case 0x07: + case 0x17: fpos = 200; break; + } + return fpos; +} + +mpc_bool_t mpc_decoder_seek_seconds(mpc_decoder *d, double seconds) +{ + return mpc_decoder_seek_sample(d, (mpc_int64_t)(seconds * (double)d->SampleRate + 0.5)); +} + +mpc_bool_t mpc_decoder_seek_sample(mpc_decoder *d, mpc_int64_t destsample) +{ + mpc_uint32_t fpos; + mpc_uint32_t fwd; + + fwd = (mpc_uint32_t) (destsample / MPC_FRAME_LENGTH); + d->samples_to_skip = MPC_DECODER_SYNTH_DELAY + (mpc_uint32_t)(destsample % MPC_FRAME_LENGTH); + + memset(d->Y_L , 0, sizeof d->Y_L ); + memset(d->Y_R , 0, sizeof d->Y_R ); + memset(d->SCF_Index_L , 0, sizeof d->SCF_Index_L ); + memset(d->SCF_Index_R , 0, sizeof d->SCF_Index_R ); + memset(d->Res_L , 0, sizeof d->Res_L ); + memset(d->Res_R , 0, sizeof d->Res_R ); + memset(d->SCFI_L , 0, sizeof d->SCFI_L ); + memset(d->SCFI_R , 0, sizeof d->SCFI_R ); + memset(d->DSCF_Flag_L , 0, sizeof d->DSCF_Flag_L ); + memset(d->DSCF_Flag_R , 0, sizeof d->DSCF_Flag_R ); + memset(d->DSCF_Reference_L, 0, sizeof d->DSCF_Reference_L ); + memset(d->DSCF_Reference_R, 0, sizeof d->DSCF_Reference_R ); + memset(d->Q , 0, sizeof d->Q ); + memset(d->MS_Flag , 0, sizeof d->MS_Flag ); + + // resetting synthesis filter to avoid "clicks" + mpc_decoder_reset_synthesis(d); + + // prevent from desired position out of allowed range + fwd = fwd < d->OverallFrames ? fwd : d->OverallFrames; + + // reset number of decoded frames + d->DecodedFrames = 0; + + fpos = get_initial_fpos(d, d->StreamVersion); + if (fpos == 0) { + return FALSE; + } + + helper2(d, fpos); + + // read the last 32 frames before the desired position to scan the scalefactors (artifactless jumping) + for ( ; d->DecodedFrames < fwd; d->DecodedFrames++ ) { + mpc_uint32_t FrameBitCnt; + mpc_uint32_t RING; + RING = d->Zaehler; + d->FwdJumpInfo = mpc_decoder_bitstream_read(d, 20); // read jump-info + d->ActDecodePos = (d->Zaehler << 5) + d->pos; + FrameBitCnt = mpc_decoder_bits_read(d); // scanning the scalefactors and check for validity of frame + if (d->StreamVersion >= 7) { + mpc_decoder_read_bitstream_sv7(d); + } + else { + mpc_decoder_read_bitstream_sv6(d); + } + if (mpc_decoder_bits_read(d) - FrameBitCnt != d->FwdJumpInfo ) { + // Box ("Bug in perform_jump"); + return FALSE; + } + // update buffer + if ((RING ^ d->Zaehler) & MEMSIZE2) { + f_read_dword(d, d->Speicher + (RING & MEMSIZE2), MEMSIZE2); + } + } + + // LastBitsRead = BitsRead (); + // LastFrame = d->DecodedFrames; + + return TRUE; +} + +void mpc_decoder_update_buffer(mpc_decoder *d, mpc_uint32_t RING) +{ + if ((RING ^ d->Zaehler) & MEMSIZE2 ) { + // update buffer + f_read_dword(d, d->Speicher + (RING & MEMSIZE2), MEMSIZE2); + } +} + + diff --git a/Libraries/MPCDec/Files/src/mpc_reader.c b/Libraries/MPCDec/Files/src/mpc_reader.c new file mode 100644 index 000000000..56e753b1c --- /dev/null +++ b/Libraries/MPCDec/Files/src/mpc_reader.c @@ -0,0 +1,96 @@ +/* + Copyright (c) 2005, The Musepack Development Team + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * Neither the name of the The Musepack Development Team nor the + names of its contributors may be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/// \file mpc_reader.c +/// Contains implementations for simple file-based mpc_reader + +#include + +/// mpc_reader callback implementations +static mpc_int32_t +read_impl(void *data, void *ptr, mpc_int32_t size) +{ + mpc_reader_file *d = (mpc_reader_file *) data; + + return fread(ptr, 1, size, d->file); +} + +static mpc_bool_t +seek_impl(void *data, mpc_int32_t offset) +{ + mpc_reader_file *d = (mpc_reader_file *) data; + + return d->is_seekable ? !fseek(d->file, offset, SEEK_SET) : FALSE; +} + +static mpc_int32_t +tell_impl(void *data) +{ + mpc_reader_file *d = (mpc_reader_file *) data; + + return ftell(d->file); +} + +static mpc_int32_t +get_size_impl(void *data) +{ + mpc_reader_file *d = (mpc_reader_file *) data; + + return d->file_size; +} + +static mpc_bool_t +canseek_impl(void *data) +{ + mpc_reader_file *d = (mpc_reader_file *) data; + + return d->is_seekable; +} + +void +mpc_reader_setup_file_reader(mpc_reader_file *p_reader, FILE *input) +{ + p_reader->reader.seek = seek_impl; + p_reader->reader.read = read_impl; + p_reader->reader.tell = tell_impl; + p_reader->reader.get_size = get_size_impl; + p_reader->reader.canseek = canseek_impl; + p_reader->reader.data = p_reader; // point back to ourselves + + p_reader->file = input; + p_reader->is_seekable = TRUE; + fseek(input, 0, SEEK_END); + p_reader->file_size = ftell(input); + fseek(input, 0, SEEK_SET); +} diff --git a/Libraries/MPCDec/Files/src/requant.c b/Libraries/MPCDec/Files/src/requant.c new file mode 100644 index 000000000..7d6e5b37f --- /dev/null +++ b/Libraries/MPCDec/Files/src/requant.c @@ -0,0 +1,152 @@ +/* + Copyright (c) 2005, The Musepack Development Team + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * Neither the name of the The Musepack Development Team nor the + names of its contributors may be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/// \file requant.c +/// Requantization function implementations. +/// \todo document me + +#include +#include + +/* C O N S T A N T S */ +// bits per sample for chosen quantizer +const mpc_uint32_t Res_bit [18] = { + 0, 0, 0, 0, 0, 0, 0, 0, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 +}; + +// coefficients for requantization +// 65536/step bzw. 65536/(2*D+1) + +#define _(X) MAKE_MPC_SAMPLE_EX(X,14) + +const MPC_SAMPLE_FORMAT __Cc [1 + 18] = { + _(111.285962475327f), // 32768/2/255*sqrt(3) + _(65536.000000000000f), _(21845.333333333332f), _(13107.200000000001f), _(9362.285714285713f), + _(7281.777777777777f), _(4369.066666666666f), _(2114.064516129032f), _(1040.253968253968f), + _(516.031496062992f), _(257.003921568627f), _(128.250489236790f), _(64.062561094819f), + _(32.015632633121f), _(16.003907203907f), _(8.000976681723f), _(4.000244155527f), + _(2.000061037018f), _(1.000015259021f) +}; + +#undef _ + +// offset for requantization +// 2*D+1 = steps of quantizer +const mpc_int32_t __Dc [1 + 18] = { + 2, + 0, 1, 2, 3, 4, 7, 15, 31, 63, + 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767 +}; + +#ifdef MPC_FIXED_POINT +static mpc_uint32_t find_shift(double fval) +{ + mpc_int64_t val = (mpc_int64_t)fval; + if (val<0) val = -val; + mpc_uint32_t ptr = 0; + while(val) {val>>=1;ptr++;} + + return ptr > 31 ? 0 : 31 - ptr; +} +#endif + +/* F U N C T I O N S */ + +#define SET_SCF(N,X) d->SCF[N] = MAKE_MPC_SAMPLE_EX(X,d->SCF_shift[N] = (unsigned char)find_shift(X)); + +void +mpc_decoder_scale_output(mpc_decoder *d, double factor) +{ + mpc_int32_t n; + double f1; + double f2; +#ifndef MPC_FIXED_POINT + factor *= 1.0 / (double)(1<<(MPC_FIXED_POINT_SHIFT-1)); +#else + factor *= 1.0 / (double)(1<<(16 - MPC_FIXED_POINT_SHIFT)); +#endif + f1 = f2 = factor; + + // handles +1.58...-98.41 dB, where's scf[n] / scf[n-1] = 1.20050805774840750476 + + SET_SCF(1,factor); + + f1 *= 0.83298066476582673961; + f2 *= 1/0.83298066476582673961; + + for ( n = 1; n <= 128; n++ ) { + SET_SCF((unsigned char)(1+n),f1); + SET_SCF((unsigned char)(1-n),f2); + f1 *= 0.83298066476582673961; + f2 *= 1/0.83298066476582673961; + } +} + +static void +mpc_decoder_quantisierungsmodes(mpc_decoder *d) // conversion: index -> quantizer (bitstream reading) +{ // conversion: quantizer -> index (bitstream writing) + mpc_int32_t Band = 0; + mpc_int32_t i; + + do { + d->Q_bit [Band] = 4; + for ( i = 0; i < 16-1; i++ ) + d->Q_res [Band] [i] = i; + d->Q_res [Band][i] = 17; + Band++; + } while ( Band < 11 ); + + do { + d->Q_bit [Band] = 3; + for ( i = 0; i < 8-1; i++ ) + d->Q_res [Band] [i] = i; + d->Q_res [Band] [i] = 17; + Band++; + } while ( Band < 23 ); + + do { + d->Q_bit [Band] = 2; + for ( i = 0; i < 4-1; i++ ) + d->Q_res [Band] [i] = i; + d->Q_res [Band] [i] = 17; + Band++; + } while ( Band < 32 ); +} + +void +mpc_decoder_initialisiere_quantisierungstabellen(mpc_decoder *d, double scale_factor) +{ + mpc_decoder_quantisierungsmodes(d); + mpc_decoder_scale_output(d, scale_factor); +} diff --git a/Libraries/MPCDec/Files/src/sample.cpp b/Libraries/MPCDec/Files/src/sample.cpp new file mode 100644 index 000000000..95d821f04 --- /dev/null +++ b/Libraries/MPCDec/Files/src/sample.cpp @@ -0,0 +1,328 @@ +/* + Copyright (c) 2005, The Musepack Development Team + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * Neither the name of the The Musepack Development Team nor the + names of its contributors may be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include +#include +#include + +#include + +/* + The data bundle we pass around with our reader to store file + position and size etc. +*/ +typedef struct reader_data_t { + FILE *file; + long size; + mpc_bool_t seekable; +} reader_data; + +/* + Our implementations of the mpc_reader callback functions. +*/ +mpc_int32_t +read_impl(void *data, void *ptr, mpc_int32_t size) +{ + reader_data *d = (reader_data *) data; + return fread(ptr, 1, size, d->file); +} + +mpc_bool_t +seek_impl(void *data, mpc_int32_t offset) +{ + reader_data *d = (reader_data *) data; + return d->seekable ? !fseek(d->file, offset, SEEK_SET) : false; +} + +mpc_int32_t +tell_impl(void *data) +{ + reader_data *d = (reader_data *) data; + return ftell(d->file); +} + +mpc_int32_t +get_size_impl(void *data) +{ + reader_data *d = (reader_data *) data; + return d->size; +} + +mpc_bool_t +canseek_impl(void *data) +{ + reader_data *d = (reader_data *) data; + return d->seekable; +} + +#define WFX_SIZE (2+2+4+4+2+2) + +#ifdef MPC_FIXED_POINT +static int +shift_signed(MPC_SAMPLE_FORMAT val, int shift) +{ + if (shift > 0) + val <<= shift; + else if (shift < 0) + val >>= -shift; + return (int)val; +} +#endif + +class WavWriter { + public: + WavWriter(FILE * p_output, unsigned p_nch, unsigned p_bps, + unsigned p_srate) + : m_file(p_output), m_nch(p_nch), m_bps(p_bps), m_srate(p_srate) { + assert(m_bps == 16 || m_bps == 24); + + WriteRaw("RIFF", 4); + WriteDword(0); //fix this in destructor + + WriteRaw("WAVE", 4); + WriteRaw("fmt ", 4); + WriteDword(WFX_SIZE); + + WriteWord(1); //WAVE_FORMAT_PCM + WriteWord(m_nch); + WriteDword(m_srate); + WriteDword(m_srate * m_nch * (m_bps >> 3)); + WriteWord(m_nch * (m_bps >> 3)); + WriteWord(m_bps); + /* + WORD wFormatTag; + WORD nChannels; + DWORD nSamplesPerSec; + DWORD nAvgBytesPerSec; + WORD nBlockAlign; + WORD wBitsPerSample; + */ + WriteRaw("data", 4); + WriteDword(0); //fix this in destructor + + m_data_bytes_written = 0; + } mpc_bool_t WriteSamples(const MPC_SAMPLE_FORMAT * p_buffer, unsigned p_size) { + unsigned n; + int clip_min = -1 << (m_bps - 1), + clip_max = (1 << (m_bps - 1)) - 1, float_scale = 1 << (m_bps - 1); + for (n = 0; n < p_size; n++) { + int val; +#ifdef MPC_FIXED_POINT + val = + shift_signed(p_buffer[n], + m_bps - MPC_FIXED_POINT_SCALE_SHIFT); +#else + val = (int)(p_buffer[n] * float_scale); +#endif + if (val < clip_min) + val = clip_min; + else if (val > clip_max) + val = clip_max; + if (!WriteInt(val, m_bps)) + return false; + } + m_data_bytes_written += p_size * (m_bps >> 3); + return true; + } + + ~WavWriter() { + if (m_data_bytes_written & 1) { + char blah = 0; + WriteRaw(&blah, 1); + m_data_bytes_written++; + } + Seek(4); + WriteDword((unsigned long)(m_data_bytes_written + 4 + 8 + WFX_SIZE + + 8)); + Seek(8 + 4 + 8 + WFX_SIZE + 4); + WriteDword(m_data_bytes_written); + } + + private: + + mpc_bool_t Seek(unsigned p_offset) { + return !fseek(m_file, p_offset, SEEK_SET); + } + + mpc_bool_t WriteRaw(const void *p_buffer, unsigned p_bytes) { + return fwrite(p_buffer, 1, p_bytes, m_file) == p_bytes; + } + + mpc_bool_t WriteDword(unsigned long p_val) { + return WriteInt(p_val, 32); + } + mpc_bool_t WriteWord(unsigned short p_val) { + return WriteInt(p_val, 16); + } + + // write a little-endian number properly + mpc_bool_t WriteInt(unsigned int p_val, unsigned p_width_bits) { + unsigned char temp; + unsigned shift = 0; + assert((p_width_bits % 8) == 0); + do { + temp = (unsigned char)((p_val >> shift) & 0xFF); + if (!WriteRaw(&temp, 1)) + return false; + shift += 8; + } while (shift < p_width_bits); + return true; + } + + unsigned m_nch, m_bps, m_srate; + FILE *m_file; + unsigned m_data_bytes_written; +}; + + +static void +usage(const char *exename) +{ + printf + ("Usage: %s []\nIf is not specified, decoder will run in benchmark mode.\n", + exename); +} + +int +main(int argc, char **argv) +{ + if (argc != 2 && argc != 3) { + if (argc > 0) + usage(argv[0]); + return 0; + } + + FILE *input = fopen(argv[1], "rb"); + FILE *output = 0; + if (input == 0) { + usage(argv[0]); + printf("Error opening input file: \"%s\"\n", argv[1]); + return 1; + } + + if (argc == 3) { + output = fopen(argv[2], "wb"); + if (output == 0) { + fclose(input); + usage(argv[0]); + printf("Error opening output file: \"%s\"\n", argv[2]); + return 1; + } + } + + /* initialize our reader_data tag the reader will carry around with it */ + reader_data data; + data.file = input; + data.seekable = true; + fseek(data.file, 0, SEEK_END); + data.size = ftell(data.file); + fseek(data.file, 0, SEEK_SET); + + /* set up an mpc_reader linked to our function implementations */ + mpc_decoder decoder; + mpc_reader reader; + reader.read = read_impl; + reader.seek = seek_impl; + reader.tell = tell_impl; + reader.get_size = get_size_impl; + reader.canseek = canseek_impl; + reader.data = &data; + + /* read file's streaminfo data */ + mpc_streaminfo info; + mpc_streaminfo_init(&info); + if (mpc_streaminfo_read(&info, &reader) != ERROR_CODE_OK) { + printf("Not a valid musepack file: \"%s\"\n", argv[1]); + return 1; + } + + /* instantiate a decoder with our file reader */ + mpc_decoder_setup(&decoder, &reader); + if (!mpc_decoder_initialize(&decoder, &info)) { + printf("Error initializing decoder.\n", argv[1]); + return 1; + } + + /* decode the file */ + printf("Decoding from:\n%s\nTo:\n%s\n", argv[1], + output ? argv[2] : "N/A"); + WavWriter *wavwriter = + output ? new WavWriter(output, 2, 16, info.sample_freq) : 0; + MPC_SAMPLE_FORMAT sample_buffer[MPC_DECODER_BUFFER_LENGTH]; + clock_t begin, end; + begin = clock(); + unsigned total_samples = 0; + mpc_bool_t successful = FALSE; + for (;;) { + unsigned status = mpc_decoder_decode(&decoder, sample_buffer, 0, 0); + if (status == (unsigned)(-1)) { + //decode error + printf("Error decoding file.\n"); + break; + } + else if (status == 0) //EOF + { + successful = true; + break; + } + else //status>0 + { + total_samples += status; + if (wavwriter) { + if (!wavwriter-> + WriteSamples(sample_buffer, status * /* stereo */ 2)) { + printf("Write error.\n"); + break; + } + } + } + } + + end = clock(); + + if (wavwriter) { + delete wavwriter; + } + + if (successful) { + printf("\nFinished.\nTotal samples decoded: %u.\n", total_samples); + unsigned ms = (end - begin) * 1000 / CLOCKS_PER_SEC; + unsigned ratio = + (unsigned)((double)total_samples / (double)info.sample_freq / + ((double)ms / 1000.0) * 100.0); + printf("Time: %u ms (%u.%02ux).\n", ms, ratio / 100, ratio % 100); + } + + return 0; +} diff --git a/Libraries/MPCDec/Files/src/streaminfo.c b/Libraries/MPCDec/Files/src/streaminfo.c new file mode 100644 index 000000000..8092081da --- /dev/null +++ b/Libraries/MPCDec/Files/src/streaminfo.c @@ -0,0 +1,280 @@ +/* + Copyright (c) 2005, The Musepack Development Team + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * Neither the name of the The Musepack Development Team nor the + names of its contributors may be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/// \file streaminfo.c +/// Implementation of streaminfo reading functions. + +#include +#include + +static const char * +Stringify(mpc_uint32_t profile) // profile is 0...15, where 7...13 is used +{ + static const char na[] = "n.a."; + static const char *Names[] = { + na, "'Unstable/Experimental'", na, na, + na, "'quality 0'", "'quality 1'", "'Telephone'", + "'Thumb'", "'Radio'", "'Standard'", "'Xtreme'", + "'Insane'", "'BrainDead'", "'quality 9'", "'quality 10'" + }; + + return profile >= sizeof(Names) / sizeof(*Names) ? na : Names[profile]; +} + +void +mpc_streaminfo_init(mpc_streaminfo * si) +{ + memset(si, 0, sizeof(mpc_streaminfo)); +} + +// read information from SV8 header +// not yet implemented +static mpc_int32_t +streaminfo_read_header_sv8(mpc_streaminfo * si, mpc_reader * fp) +{ + return 0; +} + +/// Reads streaminfo from SV7 header. +static mpc_int32_t +streaminfo_read_header_sv7(mpc_streaminfo * si, mpc_uint32_t HeaderData[8]) +{ + const mpc_int32_t samplefreqs[4] = { 44100, 48000, 37800, 32000 }; + + //mpc_uint32_t HeaderData [8]; + mpc_uint16_t Estimatedpeak_title = 0; + + if (si->stream_version > 0x71) { + // Update (si->stream_version); + return 0; + } + + /* + if ( !fp->seek ( si->header_position ) ) // seek to header start + return ERROR_CODE_FILE; + if ( fp->read ( HeaderData, sizeof HeaderData) != sizeof HeaderData ) + return ERROR_CODE_FILE; + */ + + si->bitrate = 0; + si->frames = HeaderData[1]; + si->is = 0; + si->ms = (HeaderData[2] >> 30) & 0x0001; + si->max_band = (HeaderData[2] >> 24) & 0x003F; + si->block_size = 1; + si->profile = (HeaderData[2] << 8) >> 28; + si->profile_name = Stringify(si->profile); + si->sample_freq = samplefreqs[(HeaderData[2] >> 16) & 0x0003]; + Estimatedpeak_title = (mpc_uint16_t) (HeaderData[2] & 0xFFFF); // read the ReplayGain data + si->gain_title = (mpc_uint16_t) ((HeaderData[3] >> 16) & 0xFFFF); + si->peak_title = (mpc_uint16_t) (HeaderData[3] & 0xFFFF); + si->gain_album = (mpc_uint16_t) ((HeaderData[4] >> 16) & 0xFFFF); + si->peak_album = (mpc_uint16_t) (HeaderData[4] & 0xFFFF); + si->is_true_gapless = (HeaderData[5] >> 31) & 0x0001; // true gapless: used? + si->last_frame_samples = (HeaderData[5] >> 20) & 0x07FF; // true gapless: valid samples for last frame + si->encoder_version = (HeaderData[6] >> 24) & 0x00FF; + + if (si->encoder_version == 0) { + sprintf(si->encoder, "Buschmann 1.7.0...9, Klemm 0.90...1.05"); + } + else { + switch (si->encoder_version % 10) { + case 0: + sprintf(si->encoder, "Release %u.%u", si->encoder_version / 100, + si->encoder_version / 10 % 10); + break; + case 2: + case 4: + case 6: + case 8: + sprintf(si->encoder, "Beta %u.%02u", si->encoder_version / 100, + si->encoder_version % 100); + break; + default: + sprintf(si->encoder, "--Alpha-- %u.%02u", + si->encoder_version / 100, si->encoder_version % 100); + break; + } + } + + // if ( si->peak_title == 0 ) // there is no correct peak_title contained within header + // si->peak_title = (mpc_uint16_t)(Estimatedpeak_title * 1.18); + // if ( si->peak_album == 0 ) + // si->peak_album = si->peak_title; // no correct peak_album, use peak_title + + //si->sample_freq = 44100; // AB: used by all files up to SV7 + si->channels = 2; + + return ERROR_CODE_OK; +} + +// read information from SV4-SV6 header +static mpc_int32_t +streaminfo_read_header_sv6(mpc_streaminfo * si, mpc_uint32_t HeaderData[8]) +{ + //mpc_uint32_t HeaderData [8]; + + /* + if ( !fp->seek ( si->header_position ) ) // seek to header start + return ERROR_CODE_FILE; + if ( fp->read ( HeaderData, sizeof HeaderData ) != sizeof HeaderData ) + return ERROR_CODE_FILE; + */ + + si->bitrate = (HeaderData[0] >> 23) & 0x01FF; // read the file-header (SV6 and below) + si->is = (HeaderData[0] >> 22) & 0x0001; + si->ms = (HeaderData[0] >> 21) & 0x0001; + si->stream_version = (HeaderData[0] >> 11) & 0x03FF; + si->max_band = (HeaderData[0] >> 6) & 0x001F; + si->block_size = (HeaderData[0]) & 0x003F; + si->profile = 0; + si->profile_name = Stringify((mpc_uint32_t) (-1)); + if (si->stream_version >= 5) + si->frames = HeaderData[1]; // 32 bit + else + si->frames = (HeaderData[1] >> 16); // 16 bit + + si->gain_title = 0; // not supported + si->peak_title = 0; + si->gain_album = 0; + si->peak_album = 0; + + si->last_frame_samples = 0; + si->is_true_gapless = 0; + + si->encoder_version = 0; + si->encoder[0] = '\0'; + + if (si->stream_version == 7) + return ERROR_CODE_SV7BETA; // are there any unsupported parameters used? + if (si->bitrate != 0) + return ERROR_CODE_CBR; + if (si->is != 0) + return ERROR_CODE_IS; + if (si->block_size != 1) + return ERROR_CODE_BLOCKSIZE; + + if (si->stream_version < 6) // Bugfix: last frame was invalid for up to SV5 + si->frames -= 1; + + si->sample_freq = 44100; // AB: used by all files up to SV7 + si->channels = 2; + + if (si->stream_version < 4 || si->stream_version > 7) + return ERROR_CODE_INVALIDSV; + + return ERROR_CODE_OK; +} + +// reads file header and tags +mpc_int32_t +mpc_streaminfo_read(mpc_streaminfo * si, mpc_reader * r) +{ + mpc_uint32_t HeaderData[8]; + mpc_int32_t Error = 0; + + // get header position + if ((si->header_position = JumpID3v2(r)) < 0) { + return ERROR_CODE_FILE; + } + // seek to first byte of mpc data + if (!r->seek(r->data, si->header_position)) { + return ERROR_CODE_FILE; + } + if (r->read(r->data, HeaderData, 8 * 4) != 8 * 4) { + return ERROR_CODE_FILE; + } + if (!r->seek(r->data, si->header_position + 6 * 4)) { + return ERROR_CODE_FILE; + } + + si->total_file_length = r->get_size(r->data); + si->tag_offset = si->total_file_length; + if (memcmp(HeaderData, "MP+", 3) == 0) { +#ifndef MPC_LITTLE_ENDIAN + mpc_uint32_t ptr; + for (ptr = 0; ptr < 8; ptr++) { + HeaderData[ptr] = swap32(HeaderData[ptr]); + } +#endif + si->stream_version = HeaderData[0] >> 24; + + // stream version 8 + if ((si->stream_version & 15) >= 8) { + Error = streaminfo_read_header_sv8(si, r); + } + // stream version 7 + else if ((si->stream_version & 15) == 7) { + Error = streaminfo_read_header_sv7(si, HeaderData); + } + } + else { + // stream version 4-6 + Error = streaminfo_read_header_sv6(si, HeaderData); + } + + // estimation, exact value needs too much time + si->pcm_samples = 1152 * si->frames - 576; + + if (si->pcm_samples > 0) { + si->average_bitrate = + (si->tag_offset - + si->header_position) * 8.0 * si->sample_freq / si->pcm_samples; + } + else { + si->average_bitrate = 0; + } + + return Error; +} + +double +mpc_streaminfo_get_length(mpc_streaminfo * si) +{ + return (double)mpc_streaminfo_get_length_samples(si) / + (double)si->sample_freq; +} + +mpc_int64_t +mpc_streaminfo_get_length_samples(mpc_streaminfo * si) +{ + mpc_int64_t samples = (mpc_int64_t) si->frames * MPC_FRAME_LENGTH; + if (si->is_true_gapless) { + samples -= (MPC_FRAME_LENGTH - si->last_frame_samples); + } + else { + samples -= MPC_DECODER_SYNTH_DELAY; + } + return samples; +} diff --git a/Libraries/MPCDec/Files/src/synth_filter.c b/Libraries/MPCDec/Files/src/synth_filter.c new file mode 100644 index 000000000..ef4fd9bca --- /dev/null +++ b/Libraries/MPCDec/Files/src/synth_filter.c @@ -0,0 +1,442 @@ +/* + Copyright (c) 2005, The Musepack Development Team + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * Neither the name of the The Musepack Development Team nor the + names of its contributors may be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/// \file synth_filter.c +/// Synthesis functions. +/// \todo document me + +#include +#include + +typedef mpc_int32_t ptrdiff_t; + +/* C O N S T A N T S */ +#undef _ + +#define MPC_FIXED_POINT_SYNTH_FIX 2 + +#ifdef MPC_FIXED_POINT +#define _(value) MPC_MAKE_FRACT_CONST((double)value/(double)(0x40000)) +#else +#define _(value) MAKE_MPC_SAMPLE((double)value/(double)(0x10000)) +#endif + + +static const MPC_SAMPLE_FORMAT Di_opt [32] [16] = { + { _( 0), _( -29), _( 213), _( -459), _( 2037), _(-5153), _( 6574), _(-37489), _(75038), _(37489), _(6574), _( 5153), _(2037), _( 459), _(213), _(29) }, + { _( -1), _( -31), _( 218), _( -519), _( 2000), _(-5517), _( 5959), _(-39336), _(74992), _(35640), _(7134), _( 4788), _(2063), _( 401), _(208), _(26) }, + { _( -1), _( -35), _( 222), _( -581), _( 1952), _(-5879), _( 5288), _(-41176), _(74856), _(33791), _(7640), _( 4425), _(2080), _( 347), _(202), _(24) }, + { _( -1), _( -38), _( 225), _( -645), _( 1893), _(-6237), _( 4561), _(-43006), _(74630), _(31947), _(8092), _( 4063), _(2087), _( 294), _(196), _(21) }, + { _( -1), _( -41), _( 227), _( -711), _( 1822), _(-6589), _( 3776), _(-44821), _(74313), _(30112), _(8492), _( 3705), _(2085), _( 244), _(190), _(19) }, + { _( -1), _( -45), _( 228), _( -779), _( 1739), _(-6935), _( 2935), _(-46617), _(73908), _(28289), _(8840), _( 3351), _(2075), _( 197), _(183), _(17) }, + { _( -1), _( -49), _( 228), _( -848), _( 1644), _(-7271), _( 2037), _(-48390), _(73415), _(26482), _(9139), _( 3004), _(2057), _( 153), _(176), _(16) }, + { _( -2), _( -53), _( 227), _( -919), _( 1535), _(-7597), _( 1082), _(-50137), _(72835), _(24694), _(9389), _( 2663), _(2032), _( 111), _(169), _(14) }, + { _( -2), _( -58), _( 224), _( -991), _( 1414), _(-7910), _( 70), _(-51853), _(72169), _(22929), _(9592), _( 2330), _(2001), _( 72), _(161), _(13) }, + { _( -2), _( -63), _( 221), _(-1064), _( 1280), _(-8209), _( -998), _(-53534), _(71420), _(21189), _(9750), _( 2006), _(1962), _( 36), _(154), _(11) }, + { _( -2), _( -68), _( 215), _(-1137), _( 1131), _(-8491), _( -2122), _(-55178), _(70590), _(19478), _(9863), _( 1692), _(1919), _( 2), _(147), _(10) }, + { _( -3), _( -73), _( 208), _(-1210), _( 970), _(-8755), _( -3300), _(-56778), _(69679), _(17799), _(9935), _( 1388), _(1870), _( -29), _(139), _( 9) }, + { _( -3), _( -79), _( 200), _(-1283), _( 794), _(-8998), _( -4533), _(-58333), _(68692), _(16155), _(9966), _( 1095), _(1817), _( -57), _(132), _( 8) }, + { _( -4), _( -85), _( 189), _(-1356), _( 605), _(-9219), _( -5818), _(-59838), _(67629), _(14548), _(9959), _( 814), _(1759), _( -83), _(125), _( 7) }, + { _( -4), _( -91), _( 177), _(-1428), _( 402), _(-9416), _( -7154), _(-61289), _(66494), _(12980), _(9916), _( 545), _(1698), _(-106), _(117), _( 7) }, + { _( -5), _( -97), _( 163), _(-1498), _( 185), _(-9585), _( -8540), _(-62684), _(65290), _(11455), _(9838), _( 288), _(1634), _(-127), _(111), _( 6) }, + { _( -5), _(-104), _( 146), _(-1567), _( -45), _(-9727), _( -9975), _(-64019), _(64019), _( 9975), _(9727), _( 45), _(1567), _(-146), _(104), _( 5) }, + { _( -6), _(-111), _( 127), _(-1634), _( -288), _(-9838), _(-11455), _(-65290), _(62684), _( 8540), _(9585), _( -185), _(1498), _(-163), _( 97), _( 5) }, + { _( -7), _(-117), _( 106), _(-1698), _( -545), _(-9916), _(-12980), _(-66494), _(61289), _( 7154), _(9416), _( -402), _(1428), _(-177), _( 91), _( 4) }, + { _( -7), _(-125), _( 83), _(-1759), _( -814), _(-9959), _(-14548), _(-67629), _(59838), _( 5818), _(9219), _( -605), _(1356), _(-189), _( 85), _( 4) }, + { _( -8), _(-132), _( 57), _(-1817), _(-1095), _(-9966), _(-16155), _(-68692), _(58333), _( 4533), _(8998), _( -794), _(1283), _(-200), _( 79), _( 3) }, + { _( -9), _(-139), _( 29), _(-1870), _(-1388), _(-9935), _(-17799), _(-69679), _(56778), _( 3300), _(8755), _( -970), _(1210), _(-208), _( 73), _( 3) }, + { _(-10), _(-147), _( -2), _(-1919), _(-1692), _(-9863), _(-19478), _(-70590), _(55178), _( 2122), _(8491), _(-1131), _(1137), _(-215), _( 68), _( 2) }, + { _(-11), _(-154), _( -36), _(-1962), _(-2006), _(-9750), _(-21189), _(-71420), _(53534), _( 998), _(8209), _(-1280), _(1064), _(-221), _( 63), _( 2) }, + { _(-13), _(-161), _( -72), _(-2001), _(-2330), _(-9592), _(-22929), _(-72169), _(51853), _( -70), _(7910), _(-1414), _( 991), _(-224), _( 58), _( 2) }, + { _(-14), _(-169), _(-111), _(-2032), _(-2663), _(-9389), _(-24694), _(-72835), _(50137), _(-1082), _(7597), _(-1535), _( 919), _(-227), _( 53), _( 2) }, + { _(-16), _(-176), _(-153), _(-2057), _(-3004), _(-9139), _(-26482), _(-73415), _(48390), _(-2037), _(7271), _(-1644), _( 848), _(-228), _( 49), _( 1) }, + { _(-17), _(-183), _(-197), _(-2075), _(-3351), _(-8840), _(-28289), _(-73908), _(46617), _(-2935), _(6935), _(-1739), _( 779), _(-228), _( 45), _( 1) }, + { _(-19), _(-190), _(-244), _(-2085), _(-3705), _(-8492), _(-30112), _(-74313), _(44821), _(-3776), _(6589), _(-1822), _( 711), _(-227), _( 41), _( 1) }, + { _(-21), _(-196), _(-294), _(-2087), _(-4063), _(-8092), _(-31947), _(-74630), _(43006), _(-4561), _(6237), _(-1893), _( 645), _(-225), _( 38), _( 1) }, + { _(-24), _(-202), _(-347), _(-2080), _(-4425), _(-7640), _(-33791), _(-74856), _(41176), _(-5288), _(5879), _(-1952), _( 581), _(-222), _( 35), _( 1) }, + { _(-26), _(-208), _(-401), _(-2063), _(-4788), _(-7134), _(-35640), _(-74992), _(39336), _(-5959), _(5517), _(-2000), _( 519), _(-218), _( 31), _( 1) } +}; + +#undef _ + +static void Calculate_New_V ( const MPC_SAMPLE_FORMAT * Sample, MPC_SAMPLE_FORMAT * V ) +{ + // Calculating new V-buffer values for left channel + // calculate new V-values (ISO-11172-3, p. 39) + // based upon fast-MDCT algorithm by Byeong Gi Lee + /*static*/ MPC_SAMPLE_FORMAT A00, A01, A02, A03, A04, A05, A06, A07, A08, A09, A10, A11, A12, A13, A14, A15; + /*static*/ MPC_SAMPLE_FORMAT B00, B01, B02, B03, B04, B05, B06, B07, B08, B09, B10, B11, B12, B13, B14, B15; + MPC_SAMPLE_FORMAT tmp; + + A00 = Sample[ 0] + Sample[31]; + A01 = Sample[ 1] + Sample[30]; + A02 = Sample[ 2] + Sample[29]; + A03 = Sample[ 3] + Sample[28]; + A04 = Sample[ 4] + Sample[27]; + A05 = Sample[ 5] + Sample[26]; + A06 = Sample[ 6] + Sample[25]; + A07 = Sample[ 7] + Sample[24]; + A08 = Sample[ 8] + Sample[23]; + A09 = Sample[ 9] + Sample[22]; + A10 = Sample[10] + Sample[21]; + A11 = Sample[11] + Sample[20]; + A12 = Sample[12] + Sample[19]; + A13 = Sample[13] + Sample[18]; + A14 = Sample[14] + Sample[17]; + A15 = Sample[15] + Sample[16]; + + B00 = A00 + A15; + B01 = A01 + A14; + B02 = A02 + A13; + B03 = A03 + A12; + B04 = A04 + A11; + B05 = A05 + A10; + B06 = A06 + A09; + B07 = A07 + A08;; + B08 = MPC_SCALE_CONST((A00 - A15) , 0.5024192929f , 31); + B09 = MPC_SCALE_CONST((A01 - A14) , 0.5224986076f , 31); + B10 = MPC_SCALE_CONST((A02 - A13) , 0.5669440627f , 31); + B11 = MPC_SCALE_CONST((A03 - A12) , 0.6468217969f , 31); + B12 = MPC_SCALE_CONST((A04 - A11) , 0.7881546021f , 31); + B13 = MPC_SCALE_CONST((A05 - A10) , 1.0606776476f , 30); + B14 = MPC_SCALE_CONST((A06 - A09) , 1.7224471569f , 30); + B15 = MPC_SCALE_CONST((A07 - A08) , 5.1011486053f , 28); + + A00 = B00 + B07; + A01 = B01 + B06; + A02 = B02 + B05; + A03 = B03 + B04; + A04 = MPC_SCALE_CONST((B00 - B07) , 0.5097956061f , 31); + A05 = MPC_SCALE_CONST((B01 - B06) , 0.6013448834f , 31); + A06 = MPC_SCALE_CONST((B02 - B05) , 0.8999761939f , 31); + A07 = MPC_SCALE_CONST((B03 - B04) , 2.5629155636f , 29); + A08 = B08 + B15; + A09 = B09 + B14; + A10 = B10 + B13; + A11 = B11 + B12; + A12 = MPC_SCALE_CONST((B08 - B15) , 0.5097956061f , 31); + A13 = MPC_SCALE_CONST((B09 - B14) , 0.6013448834f , 31); + A14 = MPC_SCALE_CONST((B10 - B13) , 0.8999761939f , 31); + A15 = MPC_SCALE_CONST((B11 - B12) , 2.5629155636f , 29); + + B00 = A00 + A03; + B01 = A01 + A02; + B02 = MPC_MULTIPLY_FRACT_CONST_FIX((A00 - A03) , 0.5411961079f , 1); + B03 = MPC_MULTIPLY_FRACT_CONST_FIX((A01 - A02) , 1.3065630198f , 2); + B04 = A04 + A07; + B05 = A05 + A06; + B06 = MPC_MULTIPLY_FRACT_CONST_FIX((A04 - A07) , 0.5411961079f , 1); + B07 = MPC_MULTIPLY_FRACT_CONST_FIX((A05 - A06) , 1.3065630198f , 2); + B08 = A08 + A11; + B09 = A09 + A10; + B10 = MPC_MULTIPLY_FRACT_CONST_FIX((A08 - A11) , 0.5411961079f , 1); + B11 = MPC_MULTIPLY_FRACT_CONST_FIX((A09 - A10) , 1.3065630198f , 2); + B12 = A12 + A15; + B13 = A13 + A14; + B14 = MPC_MULTIPLY_FRACT_CONST_FIX((A12 - A15) , 0.5411961079f , 1); + B15 = MPC_MULTIPLY_FRACT_CONST_FIX((A13 - A14) , 1.3065630198f , 2); + + A00 = B00 + B01; + A01 = MPC_MULTIPLY_FRACT_CONST_FIX((B00 - B01) , 0.7071067691f , 1); + A02 = B02 + B03; + A03 = MPC_MULTIPLY_FRACT_CONST_FIX((B02 - B03) , 0.7071067691f , 1); + A04 = B04 + B05; + A05 = MPC_MULTIPLY_FRACT_CONST_FIX((B04 - B05) , 0.7071067691f , 1); + A06 = B06 + B07; + A07 = MPC_MULTIPLY_FRACT_CONST_FIX((B06 - B07) , 0.7071067691f , 1); + A08 = B08 + B09; + A09 = MPC_MULTIPLY_FRACT_CONST_FIX((B08 - B09) , 0.7071067691f , 1); + A10 = B10 + B11; + A11 = MPC_MULTIPLY_FRACT_CONST_FIX((B10 - B11) , 0.7071067691f , 1); + A12 = B12 + B13; + A13 = MPC_MULTIPLY_FRACT_CONST_FIX((B12 - B13) , 0.7071067691f , 1); + A14 = B14 + B15; + A15 = MPC_MULTIPLY_FRACT_CONST_FIX((B14 - B15) , 0.7071067691f , 1); + + V[48] = -A00; + V[ 0] = A01; + V[40] = -A02 - (V[ 8] = A03); + V[36] = -((V[ 4] = A05 + (V[12] = A07)) + A06); + V[44] = - A04 - A06 - A07; + V[ 6] = (V[10] = A11 + (V[14] = A15)) + A13; + V[38] = (V[34] = -(V[ 2] = A09 + A13 + A15) - A14) + A09 - A10 - A11; + V[46] = (tmp = -(A12 + A14 + A15)) - A08; + V[42] = tmp - A10 - A11; + + A00 = MPC_MULTIPLY_FRACT_CONST_SHR((Sample[ 0] - Sample[31]) , 0.5006030202f , MPC_FIXED_POINT_SYNTH_FIX); + A01 = MPC_MULTIPLY_FRACT_CONST_SHR((Sample[ 1] - Sample[30]) , 0.5054709315f , MPC_FIXED_POINT_SYNTH_FIX); + A02 = MPC_MULTIPLY_FRACT_CONST_SHR((Sample[ 2] - Sample[29]) , 0.5154473186f , MPC_FIXED_POINT_SYNTH_FIX); + A03 = MPC_MULTIPLY_FRACT_CONST_SHR((Sample[ 3] - Sample[28]) , 0.5310425758f , MPC_FIXED_POINT_SYNTH_FIX); + A04 = MPC_MULTIPLY_FRACT_CONST_SHR((Sample[ 4] - Sample[27]) , 0.5531039238f , MPC_FIXED_POINT_SYNTH_FIX); + A05 = MPC_MULTIPLY_FRACT_CONST_SHR((Sample[ 5] - Sample[26]) , 0.5829349756f , MPC_FIXED_POINT_SYNTH_FIX); + A06 = MPC_MULTIPLY_FRACT_CONST_SHR((Sample[ 6] - Sample[25]) , 0.6225041151f , MPC_FIXED_POINT_SYNTH_FIX); + A07 = MPC_MULTIPLY_FRACT_CONST_SHR((Sample[ 7] - Sample[24]) , 0.6748083234f , MPC_FIXED_POINT_SYNTH_FIX); + A08 = MPC_MULTIPLY_FRACT_CONST_SHR((Sample[ 8] - Sample[23]) , 0.7445362806f , MPC_FIXED_POINT_SYNTH_FIX); + A09 = MPC_MULTIPLY_FRACT_CONST_SHR((Sample[ 9] - Sample[22]) , 0.8393496275f , MPC_FIXED_POINT_SYNTH_FIX); + A10 = MPC_MULTIPLY_FRACT_CONST_SHR((Sample[10] - Sample[21]) , 0.9725682139f , MPC_FIXED_POINT_SYNTH_FIX); +#if MPC_FIXED_POINT_SYNTH_FIX>=2 + A11 = MPC_MULTIPLY_FRACT_CONST_SHR((Sample[11] - Sample[20]) , 1.1694399118f , MPC_FIXED_POINT_SYNTH_FIX); + A12 = MPC_MULTIPLY_FRACT_CONST_SHR((Sample[12] - Sample[19]) , 1.4841645956f , MPC_FIXED_POINT_SYNTH_FIX); +#else + A11 = MPC_SCALE_CONST_SHR ((Sample[11] - Sample[20]) , 1.1694399118f , 30, MPC_FIXED_POINT_SYNTH_FIX); + A12 = MPC_SCALE_CONST_SHR ((Sample[12] - Sample[19]) , 1.4841645956f , 30, MPC_FIXED_POINT_SYNTH_FIX); +#endif + A13 = MPC_SCALE_CONST_SHR ((Sample[13] - Sample[18]) , 2.0577809811f , 29, MPC_FIXED_POINT_SYNTH_FIX); + A14 = MPC_SCALE_CONST_SHR ((Sample[14] - Sample[17]) , 3.4076085091f , 29, MPC_FIXED_POINT_SYNTH_FIX); + A15 = MPC_SCALE_CONST_SHR ((Sample[15] - Sample[16]) , 10.1900081635f, 27 ,MPC_FIXED_POINT_SYNTH_FIX); + + B00 = A00 + A15; + B01 = A01 + A14; + B02 = A02 + A13; + B03 = A03 + A12; + B04 = A04 + A11; + B05 = A05 + A10; + B06 = A06 + A09; + B07 = A07 + A08; + B08 = MPC_SCALE_CONST((A00 - A15) , 0.5024192929f , 31); + B09 = MPC_SCALE_CONST((A01 - A14) , 0.5224986076f , 31); + B10 = MPC_SCALE_CONST((A02 - A13) , 0.5669440627f , 31); + B11 = MPC_SCALE_CONST((A03 - A12) , 0.6468217969f , 31); + B12 = MPC_SCALE_CONST((A04 - A11) , 0.7881546021f , 31); + B13 = MPC_SCALE_CONST((A05 - A10) , 1.0606776476f , 30); + B14 = MPC_SCALE_CONST((A06 - A09) , 1.7224471569f , 30); + B15 = MPC_SCALE_CONST((A07 - A08) , 5.1011486053f , 28); + + A00 = B00 + B07; + A01 = B01 + B06; + A02 = B02 + B05; + A03 = B03 + B04; + A04 = MPC_SCALE_CONST((B00 - B07) , 0.5097956061f , 31); + A05 = MPC_SCALE_CONST((B01 - B06) , 0.6013448834f , 31); + A06 = MPC_SCALE_CONST((B02 - B05) , 0.8999761939f , 31); + A07 = MPC_SCALE_CONST((B03 - B04) , 2.5629155636f , 29); + A08 = B08 + B15; + A09 = B09 + B14; + A10 = B10 + B13; + A11 = B11 + B12; + A12 = MPC_SCALE_CONST((B08 - B15) , 0.5097956061f , 31); + A13 = MPC_SCALE_CONST((B09 - B14) , 0.6013448834f , 31); + A14 = MPC_SCALE_CONST((B10 - B13) , 0.8999761939f , 31); + A15 = MPC_SCALE_CONST((B11 - B12) , 2.5629155636f , 29); + + B00 = A00 + A03; + B01 = A01 + A02; + B02 = MPC_SCALE_CONST((A00 - A03) , 0.5411961079f , 31); + B03 = MPC_SCALE_CONST((A01 - A02) , 1.3065630198f , 30); + B04 = A04 + A07; + B05 = A05 + A06; + B06 = MPC_SCALE_CONST((A04 - A07) , 0.5411961079f , 31); + B07 = MPC_SCALE_CONST((A05 - A06) , 1.3065630198f , 30); + B08 = A08 + A11; + B09 = A09 + A10; + B10 = MPC_SCALE_CONST((A08 - A11) , 0.5411961079f , 31); + B11 = MPC_SCALE_CONST((A09 - A10) , 1.3065630198f , 30); + B12 = A12 + A15; + B13 = A13 + A14; + B14 = MPC_SCALE_CONST((A12 - A15) , 0.5411961079f , 31); + B15 = MPC_SCALE_CONST((A13 - A14) , 1.3065630198f , 30); + + A00 = MPC_SHL(B00 + B01, MPC_FIXED_POINT_SYNTH_FIX); + A01 = MPC_SCALE_CONST_SHL((B00 - B01) , 0.7071067691f , 31, MPC_FIXED_POINT_SYNTH_FIX); + A02 = MPC_SHL(B02 + B03, MPC_FIXED_POINT_SYNTH_FIX); + A03 = MPC_SCALE_CONST_SHL((B02 - B03) , 0.7071067691f , 31, MPC_FIXED_POINT_SYNTH_FIX); + A04 = MPC_SHL(B04 + B05, MPC_FIXED_POINT_SYNTH_FIX); + A05 = MPC_SCALE_CONST_SHL((B04 - B05) , 0.7071067691f , 31, MPC_FIXED_POINT_SYNTH_FIX); + A06 = MPC_SHL(B06 + B07, MPC_FIXED_POINT_SYNTH_FIX); + A07 = MPC_SCALE_CONST_SHL((B06 - B07) , 0.7071067691f , 31, MPC_FIXED_POINT_SYNTH_FIX); + A08 = MPC_SHL(B08 + B09, MPC_FIXED_POINT_SYNTH_FIX); + A09 = MPC_SCALE_CONST_SHL((B08 - B09) , 0.7071067691f , 31, MPC_FIXED_POINT_SYNTH_FIX); + A10 = MPC_SHL(B10 + B11, MPC_FIXED_POINT_SYNTH_FIX); + A11 = MPC_SCALE_CONST_SHL((B10 - B11) , 0.7071067691f , 31, MPC_FIXED_POINT_SYNTH_FIX); + A12 = MPC_SHL(B12 + B13, MPC_FIXED_POINT_SYNTH_FIX); + A13 = MPC_SCALE_CONST_SHL((B12 - B13) , 0.7071067691f , 31, MPC_FIXED_POINT_SYNTH_FIX); + A14 = MPC_SHL(B14 + B15, MPC_FIXED_POINT_SYNTH_FIX); + A15 = MPC_SCALE_CONST_SHL((B14 - B15) , 0.7071067691f , 31, MPC_FIXED_POINT_SYNTH_FIX); + + // mehrfach verwendete Ausdrücke: A04+A06+A07, A09+A13+A15 + V[ 5] = (V[11] = (V[13] = A07 + (V[15] = A15)) + A11) + A05 + A13; + V[ 7] = (V[ 9] = A03 + A11 + A15) + A13; + V[33] = -(V[ 1] = A01 + A09 + A13 + A15) - A14; + V[35] = -(V[ 3] = A05 + A07 + A09 + A13 + A15) - A06 - A14; + V[37] = (tmp = -(A10 + A11 + A13 + A14 + A15)) - A05 - A06 - A07; + V[39] = tmp - A02 - A03; // abhängig vom Befehl drüber + V[41] = (tmp += A13 - A12) - A02 - A03; // abhängig vom Befehl 2 drüber + V[43] = tmp - A04 - A06 - A07; // abhängig von Befehlen 1 und 3 drüber + V[47] = (tmp = -(A08 + A12 + A14 + A15)) - A00; + V[45] = tmp - A04 - A06 - A07; // abhängig vom Befehl drüber + + V[32] = -V[ 0]; + V[31] = -V[ 1]; + V[30] = -V[ 2]; + V[29] = -V[ 3]; + V[28] = -V[ 4]; + V[27] = -V[ 5]; + V[26] = -V[ 6]; + V[25] = -V[ 7]; + V[24] = -V[ 8]; + V[23] = -V[ 9]; + V[22] = -V[10]; + V[21] = -V[11]; + V[20] = -V[12]; + V[19] = -V[13]; + V[18] = -V[14]; + V[17] = -V[15]; + + V[63] = V[33]; + V[62] = V[34]; + V[61] = V[35]; + V[60] = V[36]; + V[59] = V[37]; + V[58] = V[38]; + V[57] = V[39]; + V[56] = V[40]; + V[55] = V[41]; + V[54] = V[42]; + V[53] = V[43]; + V[52] = V[44]; + V[51] = V[45]; + V[50] = V[46]; + V[49] = V[47]; +} + +static void Synthese_Filter_float_internal(MPC_SAMPLE_FORMAT * OutData,MPC_SAMPLE_FORMAT * V,const MPC_SAMPLE_FORMAT * Y) +{ + mpc_uint32_t n; + for ( n = 0; n < 36; n++, Y += 32 ) { + V -= 64; + Calculate_New_V ( Y, V ); + { + MPC_SAMPLE_FORMAT * Data = OutData; + const MPC_SAMPLE_FORMAT * D = (const MPC_SAMPLE_FORMAT *) &Di_opt; + mpc_int32_t k; + //mpc_int32_t tmp; + + + + for ( k = 0; k < 32; k++, D += 16, V++ ) { + *Data = MPC_SHL( + MPC_MULTIPLY_FRACT(V[ 0],D[ 0]) + MPC_MULTIPLY_FRACT(V[ 96],D[ 1]) + MPC_MULTIPLY_FRACT(V[128],D[ 2]) + MPC_MULTIPLY_FRACT(V[224],D[ 3]) + + MPC_MULTIPLY_FRACT(V[256],D[ 4]) + MPC_MULTIPLY_FRACT(V[352],D[ 5]) + MPC_MULTIPLY_FRACT(V[384],D[ 6]) + MPC_MULTIPLY_FRACT(V[480],D[ 7]) + + MPC_MULTIPLY_FRACT(V[512],D[ 8]) + MPC_MULTIPLY_FRACT(V[608],D[ 9]) + MPC_MULTIPLY_FRACT(V[640],D[10]) + MPC_MULTIPLY_FRACT(V[736],D[11]) + + MPC_MULTIPLY_FRACT(V[768],D[12]) + MPC_MULTIPLY_FRACT(V[864],D[13]) + MPC_MULTIPLY_FRACT(V[896],D[14]) + MPC_MULTIPLY_FRACT(V[992],D[15]) + , 2); + + Data += 2; + } + V -= 32;//bleh + OutData+=64; + } + } +} + +void +mpc_decoder_synthese_filter_float(mpc_decoder *d, MPC_SAMPLE_FORMAT* OutData) +{ + /********* left channel ********/ + memmove(d->V_L + MPC_V_MEM, d->V_L, 960 * sizeof(MPC_SAMPLE_FORMAT) ); + + Synthese_Filter_float_internal( + OutData, + (MPC_SAMPLE_FORMAT *)(d->V_L + MPC_V_MEM), + (MPC_SAMPLE_FORMAT *)(d->Y_L [0])); + + /******** right channel ********/ + memmove(d->V_R + MPC_V_MEM, d->V_R, 960 * sizeof(MPC_SAMPLE_FORMAT) ); + + Synthese_Filter_float_internal( + OutData + 1, + (MPC_SAMPLE_FORMAT *)(d->V_R + MPC_V_MEM), + (MPC_SAMPLE_FORMAT *)(d->Y_R [0])); +} + +/*******************************************/ +/* */ +/* dithered synthesis */ +/* */ +/*******************************************/ + +static const unsigned char Parity [256] = { // parity + 0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1, + 1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0, + 1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0, + 0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1, + 1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0, + 0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1, + 0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1, + 1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0 +}; + +/* + * This is a simple random number generator with good quality for audio purposes. + * It consists of two polycounters with opposite rotation direction and different + * periods. The periods are coprime, so the total period is the product of both. + * + * ------------------------------------------------------------------------------------------------- + * +-> |31:30:29:28:27:26:25:24:23:22:21:20:19:18:17:16:15:14:13:12:11:10: 9: 8: 7: 6: 5: 4: 3: 2: 1: 0| + * | ------------------------------------------------------------------------------------------------- + * | | | | | | | + * | +--+--+--+-XOR-+--------+ + * | | + * +--------------------------------------------------------------------------------------+ + * + * ------------------------------------------------------------------------------------------------- + * |31:30:29:28:27:26:25:24:23:22:21:20:19:18:17:16:15:14:13:12:11:10: 9: 8: 7: 6: 5: 4: 3: 2: 1: 0| <-+ + * ------------------------------------------------------------------------------------------------- | + * | | | | | + * +--+----XOR----+--+ | + * | | + * +----------------------------------------------------------------------------------------+ + * + * + * The first has an period of 3*5*17*257*65537, the second of 7*47*73*178481, + * which gives a period of 18.410.713.077.675.721.215. The result is the + * XORed values of both generators. + */ +mpc_uint32_t +mpc_random_int(mpc_decoder *d) +{ +#if 1 + mpc_uint32_t t1, t2, t3, t4; + + t3 = t1 = d->__r1; t4 = t2 = d->__r2; // Parity calculation is done via table lookup, this is also available + t1 &= 0xF5; t2 >>= 25; // on CPUs without parity, can be implemented in C and avoid unpredictable + t1 = Parity [t1]; t2 &= 0x63; // jumps and slow rotate through the carry flag operations. + t1 <<= 31; t2 = Parity [t2]; + + return (d->__r1 = (t3 >> 1) | t1 ) ^ (d->__r2 = (t4 + t4) | t2 ); +#else + return (d->__r1 = (d->__r1 >> 1) | ((mpc_uint32_t)Parity [d->__r1 & 0xF5] << 31) ) ^ + (d->__r2 = (d->__r2 << 1) | (mpc_uint32_t)Parity [(d->__r2 >> 25) & 0x63] ); +#endif +} diff --git a/Libraries/MPCDec/Info.plist b/Libraries/MPCDec/Info.plist new file mode 100644 index 000000000..bdac75df8 --- /dev/null +++ b/Libraries/MPCDec/Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + MPCDec + CFBundleIconFile + + CFBundleIdentifier + com.apple.carbonframeworktemplate + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + FMWK + CFBundleSignature + ???? + CFBundleVersion + 1.0 + CFBundleShortVersionString + 1.0 + CSResourcesFileMapped + + + diff --git a/Libraries/MPCDec/MPCDec.xcode/project.pbxproj b/Libraries/MPCDec/MPCDec.xcode/project.pbxproj new file mode 100644 index 000000000..4a4916195 --- /dev/null +++ b/Libraries/MPCDec/MPCDec.xcode/project.pbxproj @@ -0,0 +1,599 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 39; + objects = { + 034768DDFF38A45A11DB9C8B = { + children = ( + 8D07F2C80486CC7A007CD1D0, + ); + isa = PBXGroup; + name = Products; + refType = 4; + sourceTree = ""; + }; +//030 +//031 +//032 +//033 +//034 +//080 +//081 +//082 +//083 +//084 + 0867D690FE84028FC02AAC07 = { + buildSettings = { + }; + buildStyles = ( + 4F0BB7EC011F40E904CA0E50, + 4F0BB7ED011F40E904CA0E50, + ); + hasScannedForEncodings = 1; + isa = PBXProject; + mainGroup = 0867D691FE84028FC02AAC07; + productRefGroup = 034768DDFF38A45A11DB9C8B; + projectDirPath = ""; + targets = ( + 8D07F2BC0486CC7A007CD1D0, + ); + }; + 0867D691FE84028FC02AAC07 = { + children = ( + 8E8D0EF0082DD1E600CC65F0, + 08FB77ACFE841707C02AAC07, + 089C1665FE841158C02AAC07, + 0867D69AFE84028FC02AAC07, + 034768DDFF38A45A11DB9C8B, + ); + isa = PBXGroup; + name = MPCDec; + refType = 4; + sourceTree = ""; + }; + 0867D69AFE84028FC02AAC07 = { + children = ( + ); + isa = PBXGroup; + name = "External Frameworks and Libraries"; + refType = 4; + sourceTree = ""; + }; + 089C1665FE841158C02AAC07 = { + children = ( + 8D07F2C70486CC7A007CD1D0, + 089C1666FE841158C02AAC07, + ); + isa = PBXGroup; + name = Resources; + refType = 4; + sourceTree = ""; + }; + 089C1666FE841158C02AAC07 = { + children = ( + 089C1667FE841158C02AAC07, + ); + isa = PBXVariantGroup; + name = InfoPlist.strings; + refType = 4; + sourceTree = ""; + }; + 089C1667FE841158C02AAC07 = { + fileEncoding = 10; + isa = PBXFileReference; + lastKnownFileType = text.plist.strings; + name = English; + path = English.lproj/InfoPlist.strings; + refType = 4; + sourceTree = ""; + }; + 08FB77ACFE841707C02AAC07 = { + children = ( + 8E8D0EDD082DD1E100CC65F0, + 8E8D0EDE082DD1E100CC65F0, + 8E8D0EDF082DD1E100CC65F0, + 8E8D0EE0082DD1E100CC65F0, + 8E8D0EE1082DD1E100CC65F0, + 8E8D0EE2082DD1E100CC65F0, + 8E8D0EE3082DD1E100CC65F0, + 8E8D0EE4082DD1E100CC65F0, + 8E8D0EE5082DD1E100CC65F0, + ); + isa = PBXGroup; + name = Source; + refType = 4; + sourceTree = ""; + }; +//080 +//081 +//082 +//083 +//084 +//4F0 +//4F1 +//4F2 +//4F3 +//4F4 + 4F0BB7EC011F40E904CA0E50 = { + buildSettings = { + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_GENERATE_DEBUGGING_SYMBOLS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + ZERO_LINK = YES; + }; + isa = PBXBuildStyle; + name = Development; + }; + 4F0BB7ED011F40E904CA0E50 = { + buildSettings = { + COPY_PHASE_STRIP = YES; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + ZERO_LINK = NO; + }; + isa = PBXBuildStyle; + name = Deployment; + }; +//4F0 +//4F1 +//4F2 +//4F3 +//4F4 +//8D0 +//8D1 +//8D2 +//8D3 +//8D4 + 8D07F2BC0486CC7A007CD1D0 = { + buildPhases = ( + 8D07F2BD0486CC7A007CD1D0, + 8D07F2BF0486CC7A007CD1D0, + 8D07F2C10486CC7A007CD1D0, + 8D07F2C30486CC7A007CD1D0, + 8D07F2C50486CC7A007CD1D0, + ); + buildRules = ( + ); + buildSettings = { + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + FRAMEWORK_VERSION = A; + GCC_AUTO_VECTORIZATION = NO; + GCC_GENERATE_DEBUGGING_SYMBOLS = NO; + GCC_OPTIMIZATION_LEVEL = 3; + GCC_PRECOMPILE_PREFIX_HEADER = NO; + GCC_PREFIX_HEADER = ""; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "@executable_path/../Frameworks"; + LIBRARY_STYLE = DYNAMIC; + PRODUCT_NAME = MPCDec; + WRAPPER_EXTENSION = framework; + }; + dependencies = ( + ); + isa = PBXNativeTarget; + name = MPCDec; + productInstallPath = "$(HOME)/Library/Frameworks"; + productName = MPCDec; + productReference = 8D07F2C80486CC7A007CD1D0; + productType = "com.apple.product-type.framework"; + }; + 8D07F2BD0486CC7A007CD1D0 = { + buildActionMask = 2147483647; + files = ( + 8E8D0EFA082DD1F800CC65F0, + 8E8D0EFB082DD1F800CC65F0, + 8E8D0EFC082DD1F800CC65F0, + 8E8D0EFD082DD1F800CC65F0, + 8E8D0EFE082DD1F800CC65F0, + 8E8D0EFF082DD1F800CC65F0, + 8E8D0F00082DD1F800CC65F0, + 8E8D0F01082DD1F800CC65F0, + 8E8D0F03082DD28900CC65F0, + 8E8D0F05082DD29500CC65F0, + ); + isa = PBXHeadersBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 8D07F2BF0486CC7A007CD1D0 = { + buildActionMask = 2147483647; + files = ( + 8D07F2C00486CC7A007CD1D0, + ); + isa = PBXResourcesBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 8D07F2C00486CC7A007CD1D0 = { + fileRef = 089C1666FE841158C02AAC07; + isa = PBXBuildFile; + settings = { + }; + }; + 8D07F2C10486CC7A007CD1D0 = { + buildActionMask = 2147483647; + files = ( + 8E8D0EE6082DD1E100CC65F0, + 8E8D0EE7082DD1E100CC65F0, + 8E8D0EE8082DD1E100CC65F0, + 8E8D0EE9082DD1E100CC65F0, + 8E8D0EEA082DD1E100CC65F0, + 8E8D0EEB082DD1E100CC65F0, + 8E8D0EED082DD1E100CC65F0, + 8E8D0EEE082DD1E100CC65F0, + ); + isa = PBXSourcesBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 8D07F2C30486CC7A007CD1D0 = { + buildActionMask = 2147483647; + files = ( + ); + isa = PBXFrameworksBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 8D07F2C50486CC7A007CD1D0 = { + buildActionMask = 2147483647; + files = ( + ); + isa = PBXRezBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 8D07F2C70486CC7A007CD1D0 = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = text.plist; + path = Info.plist; + refType = 4; + sourceTree = ""; + }; + 8D07F2C80486CC7A007CD1D0 = { + explicitFileType = wrapper.framework; + includeInIndex = 0; + isa = PBXFileReference; + path = MPCDec.framework; + refType = 3; + sourceTree = BUILT_PRODUCTS_DIR; + }; +//8D0 +//8D1 +//8D2 +//8D3 +//8D4 +//8E0 +//8E1 +//8E2 +//8E3 +//8E4 + 8E8D0EDD082DD1E100CC65F0 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = huffsv7.c; + path = Files/src/huffsv7.c; + refType = 4; + sourceTree = ""; + }; + 8E8D0EDE082DD1E100CC65F0 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = huffsv46.c; + path = Files/src/huffsv46.c; + refType = 4; + sourceTree = ""; + }; + 8E8D0EDF082DD1E100CC65F0 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = idtag.c; + path = Files/src/idtag.c; + refType = 4; + sourceTree = ""; + }; + 8E8D0EE0082DD1E100CC65F0 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = mpc_decoder.c; + path = Files/src/mpc_decoder.c; + refType = 4; + sourceTree = ""; + }; + 8E8D0EE1082DD1E100CC65F0 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = mpc_reader.c; + path = Files/src/mpc_reader.c; + refType = 4; + sourceTree = ""; + }; + 8E8D0EE2082DD1E100CC65F0 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = requant.c; + path = Files/src/requant.c; + refType = 4; + sourceTree = ""; + }; + 8E8D0EE3082DD1E100CC65F0 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + name = sample.cpp; + path = Files/src/sample.cpp; + refType = 4; + sourceTree = ""; + }; + 8E8D0EE4082DD1E100CC65F0 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = streaminfo.c; + path = Files/src/streaminfo.c; + refType = 4; + sourceTree = ""; + }; + 8E8D0EE5082DD1E100CC65F0 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = synth_filter.c; + path = Files/src/synth_filter.c; + refType = 4; + sourceTree = ""; + }; + 8E8D0EE6082DD1E100CC65F0 = { + fileRef = 8E8D0EDD082DD1E100CC65F0; + isa = PBXBuildFile; + settings = { + }; + }; + 8E8D0EE7082DD1E100CC65F0 = { + fileRef = 8E8D0EDE082DD1E100CC65F0; + isa = PBXBuildFile; + settings = { + }; + }; + 8E8D0EE8082DD1E100CC65F0 = { + fileRef = 8E8D0EDF082DD1E100CC65F0; + isa = PBXBuildFile; + settings = { + }; + }; + 8E8D0EE9082DD1E100CC65F0 = { + fileRef = 8E8D0EE0082DD1E100CC65F0; + isa = PBXBuildFile; + settings = { + }; + }; + 8E8D0EEA082DD1E100CC65F0 = { + fileRef = 8E8D0EE1082DD1E100CC65F0; + isa = PBXBuildFile; + settings = { + }; + }; + 8E8D0EEB082DD1E100CC65F0 = { + fileRef = 8E8D0EE2082DD1E100CC65F0; + isa = PBXBuildFile; + settings = { + }; + }; + 8E8D0EED082DD1E100CC65F0 = { + fileRef = 8E8D0EE4082DD1E100CC65F0; + isa = PBXBuildFile; + settings = { + }; + }; + 8E8D0EEE082DD1E100CC65F0 = { + fileRef = 8E8D0EE5082DD1E100CC65F0; + isa = PBXBuildFile; + settings = { + }; + }; + 8E8D0EF0082DD1E600CC65F0 = { + children = ( + 8E8D0F04082DD29500CC65F0, + 8E8D0F02082DD28900CC65F0, + 8E8D0EF2082DD1F800CC65F0, + 8E8D0EF3082DD1F800CC65F0, + 8E8D0EF4082DD1F800CC65F0, + 8E8D0EF5082DD1F800CC65F0, + 8E8D0EF6082DD1F800CC65F0, + 8E8D0EF7082DD1F800CC65F0, + 8E8D0EF8082DD1F800CC65F0, + 8E8D0EF9082DD1F800CC65F0, + ); + isa = PBXGroup; + name = Headers; + refType = 4; + sourceTree = ""; + }; + 8E8D0EF2082DD1F800CC65F0 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = decoder.h; + path = Files/include/mpcdec/decoder.h; + refType = 4; + sourceTree = ""; + }; + 8E8D0EF3082DD1F800CC65F0 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = huffman.h; + path = Files/include/mpcdec/huffman.h; + refType = 4; + sourceTree = ""; + }; + 8E8D0EF4082DD1F800CC65F0 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = internal.h; + path = Files/include/mpcdec/internal.h; + refType = 4; + sourceTree = ""; + }; + 8E8D0EF5082DD1F800CC65F0 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = math.h; + path = Files/include/mpcdec/math.h; + refType = 4; + sourceTree = ""; + }; + 8E8D0EF6082DD1F800CC65F0 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = mpcdec.h; + path = Files/include/mpcdec/mpcdec.h; + refType = 4; + sourceTree = ""; + }; + 8E8D0EF7082DD1F800CC65F0 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = reader.h; + path = Files/include/mpcdec/reader.h; + refType = 4; + sourceTree = ""; + }; + 8E8D0EF8082DD1F800CC65F0 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = requant.h; + path = Files/include/mpcdec/requant.h; + refType = 4; + sourceTree = ""; + }; + 8E8D0EF9082DD1F800CC65F0 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = streaminfo.h; + path = Files/include/mpcdec/streaminfo.h; + refType = 4; + sourceTree = ""; + }; + 8E8D0EFA082DD1F800CC65F0 = { + fileRef = 8E8D0EF2082DD1F800CC65F0; + isa = PBXBuildFile; + settings = { + ATTRIBUTES = ( + Public, + ); + }; + }; + 8E8D0EFB082DD1F800CC65F0 = { + fileRef = 8E8D0EF3082DD1F800CC65F0; + isa = PBXBuildFile; + settings = { + ATTRIBUTES = ( + Public, + ); + }; + }; + 8E8D0EFC082DD1F800CC65F0 = { + fileRef = 8E8D0EF4082DD1F800CC65F0; + isa = PBXBuildFile; + settings = { + ATTRIBUTES = ( + Public, + ); + }; + }; + 8E8D0EFD082DD1F800CC65F0 = { + fileRef = 8E8D0EF5082DD1F800CC65F0; + isa = PBXBuildFile; + settings = { + ATTRIBUTES = ( + Public, + ); + }; + }; + 8E8D0EFE082DD1F800CC65F0 = { + fileRef = 8E8D0EF6082DD1F800CC65F0; + isa = PBXBuildFile; + settings = { + ATTRIBUTES = ( + Public, + ); + }; + }; + 8E8D0EFF082DD1F800CC65F0 = { + fileRef = 8E8D0EF7082DD1F800CC65F0; + isa = PBXBuildFile; + settings = { + ATTRIBUTES = ( + Public, + ); + }; + }; + 8E8D0F00082DD1F800CC65F0 = { + fileRef = 8E8D0EF8082DD1F800CC65F0; + isa = PBXBuildFile; + settings = { + ATTRIBUTES = ( + Public, + ); + }; + }; + 8E8D0F01082DD1F800CC65F0 = { + fileRef = 8E8D0EF9082DD1F800CC65F0; + isa = PBXBuildFile; + settings = { + ATTRIBUTES = ( + Public, + ); + }; + }; + 8E8D0F02082DD28900CC65F0 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = config.h; + path = Files/include/config.h; + refType = 4; + sourceTree = ""; + }; + 8E8D0F03082DD28900CC65F0 = { + fileRef = 8E8D0F02082DD28900CC65F0; + isa = PBXBuildFile; + settings = { + ATTRIBUTES = ( + Public, + ); + }; + }; + 8E8D0F04082DD29500CC65F0 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = config_types.h; + path = Files/include/mpcdec/config_types.h; + refType = 4; + sourceTree = ""; + }; + 8E8D0F05082DD29500CC65F0 = { + fileRef = 8E8D0F04082DD29500CC65F0; + isa = PBXBuildFile; + settings = { + ATTRIBUTES = ( + Public, + ); + }; + }; + }; + rootObject = 0867D690FE84028FC02AAC07; +} diff --git a/Libraries/MPCDec/MPCDec.xcode/xugg.mode1 b/Libraries/MPCDec/MPCDec.xcode/xugg.mode1 new file mode 100644 index 000000000..47364a626 --- /dev/null +++ b/Libraries/MPCDec/MPCDec.xcode/xugg.mode1 @@ -0,0 +1,1238 @@ + + + + + ActivePerspectiveName + Project + AllowedModules + + + BundleLoadPath + + MaxInstances + n + Module + PBXSmartGroupTreeModule + Name + Groups and Files Outline View + + + BundleLoadPath + + MaxInstances + n + Module + PBXNavigatorGroup + Name + Editor + + + BundleLoadPath + + MaxInstances + n + Module + XCTaskListModule + Name + Task List + + + BundleLoadPath + + MaxInstances + n + Module + XCDetailModule + Name + File and Smart Group Detail Viewer + + + BundleLoadPath + + MaxInstances + 1 + Module + PBXBuildResultsModule + Name + Detailed Build Results Viewer + + + BundleLoadPath + + MaxInstances + 1 + Module + PBXProjectFindModule + Name + Project Batch Find Tool + + + BundleLoadPath + + MaxInstances + n + Module + PBXRunSessionModule + Name + Run Log + + + BundleLoadPath + + MaxInstances + n + Module + PBXBookmarksModule + Name + Bookmarks Tool + + + BundleLoadPath + + MaxInstances + n + Module + PBXClassBrowserModule + Name + Class Browser + + + BundleLoadPath + + MaxInstances + n + Module + PBXCVSModule + Name + Source Code Control Tool + + + BundleLoadPath + + MaxInstances + n + Module + PBXDebugBreakpointsModule + Name + Debug Breakpoints Tool + + + BundleLoadPath + + MaxInstances + n + Module + XCDockableInspector + Name + Inspector + + + BundleLoadPath + + MaxInstances + n + Module + PBXOpenQuicklyModule + Name + Open Quickly Tool + + + BundleLoadPath + + MaxInstances + 1 + Module + PBXDebugSessionModule + Name + Debugger + + + BundleLoadPath + + MaxInstances + 1 + Module + PBXDebugCLIModule + Name + Debug Console + + + Description + DefaultDescriptionKey + DockingSystemVisible + + Extension + mode1 + FavBarConfig + + PBXProjectModuleGUID + 8E8D0F10082DD2A700CC65F0 + XCBarModuleItemNames + + XCBarModuleItems + + + FirstTimeWindowDisplayed + + Identifier + com.apple.perspectives.project.mode1 + MajorVersion + 31 + MinorVersion + 1 + Name + Default + Notifications + + OpenEditors + + PerspectiveWidths + + -1 + -1 + + Perspectives + + + ChosenToolbarItems + + active-target-popup + action + NSToolbarFlexibleSpaceItem + buildOrClean + build-and-runOrDebug + com.apple.ide.PBXToolbarStopButton + get-info + toggle-editor + NSToolbarFlexibleSpaceItem + com.apple.pbx.toolbar.searchfield + + ControllerClassBaseName + + IconName + WindowOfProjectWithEditor + Identifier + perspective.project + IsVertical + + Layout + + + ContentConfiguration + + PBXBottomSmartGroupGIDs + + 1C37FBAC04509CD000000102 + 1C37FAAC04509CD000000102 + 1C08E77C0454961000C914BD + 1C37FABC05509CD000000102 + 1C37FABC05539CD112110102 + E2644B35053B69B200211256 + 1C37FABC04509CD000100104 + 1CC0EA4004350EF90044410B + 1CC0EA4004350EF90041110B + + PBXProjectModuleGUID + 1CE0B1FE06471DED0097A5F4 + PBXProjectModuleLabel + Files + PBXProjectStructureProvided + yes + PBXSmartGroupTreeModuleColumnData + + PBXSmartGroupTreeModuleColumnWidthsKey + + 186 + + PBXSmartGroupTreeModuleColumnsKey_v4 + + MainColumn + + + PBXSmartGroupTreeModuleOutlineStateKey_v7 + + PBXSmartGroupTreeModuleOutlineStateExpansionKey + + 0867D691FE84028FC02AAC07 + 8E8D0EF0082DD1E600CC65F0 + 08FB77ACFE841707C02AAC07 + 1C37FBAC04509CD000000102 + 1C37FABC05509CD000000102 + + PBXSmartGroupTreeModuleOutlineStateSelectionKey + + + 19 + 12 + 0 + + + PBXSmartGroupTreeModuleOutlineStateVisibleRectKey + {{0, 135}, {186, 338}} + + PBXTopSmartGroupGIDs + + XCIncludePerspectivesSwitch + + XCSharingToken + com.apple.Xcode.GFSharingToken + + GeometryConfiguration + + Frame + {{0, 0}, {203, 356}} + GroupTreeTableConfiguration + + MainColumn + 186 + + RubberWindowFrame + 167 339 690 397 0 0 1024 746 + + Module + PBXSmartGroupTreeModule + Proportion + 203pt + + + Dock + + + ContentConfiguration + + PBXProjectModuleGUID + 1CE0B20306471E060097A5F4 + PBXProjectModuleLabel + sample.cpp + PBXSplitModuleInNavigatorKey + + Split0 + + PBXProjectModuleGUID + 1CE0B20406471E060097A5F4 + PBXProjectModuleLabel + sample.cpp + _historyCapacity + 0 + bookmark + 8E94D9A7084BE940007F0AEB + history + + 8E6F2AA8084810380011F126 + 8E6F2AAB084810380011F126 + + prevStack + + 8E6F2AAA084810380011F126 + + + SplitCount + 1 + + StatusBarVisibility + + + GeometryConfiguration + + Frame + {{0, 0}, {482, 0}} + RubberWindowFrame + 167 339 690 397 0 0 1024 746 + + Module + PBXNavigatorGroup + Proportion + 0pt + + + BecomeActive + + ContentConfiguration + + PBXProjectModuleGUID + 1CE0B20506471E060097A5F4 + PBXProjectModuleLabel + Detail + + GeometryConfiguration + + Frame + {{0, 5}, {482, 351}} + RubberWindowFrame + 167 339 690 397 0 0 1024 746 + + Module + XCDetailModule + Proportion + 351pt + + + Proportion + 482pt + + + Name + Project + ServiceClasses + + XCModuleDock + PBXSmartGroupTreeModule + XCModuleDock + PBXNavigatorGroup + XCDetailModule + + TableOfContents + + 8E94D9A8084BE940007F0AEB + 1CE0B1FE06471DED0097A5F4 + 8E94D9A9084BE940007F0AEB + 1CE0B20306471E060097A5F4 + 1CE0B20506471E060097A5F4 + + ToolbarConfiguration + xcode.toolbar.config.default + + + ControllerClassBaseName + + IconName + WindowOfProject + Identifier + perspective.morph + IsVertical + 0 + Layout + + + BecomeActive + 1 + ContentConfiguration + + PBXBottomSmartGroupGIDs + + 1C37FBAC04509CD000000102 + 1C37FAAC04509CD000000102 + 1C08E77C0454961000C914BD + 1C37FABC05509CD000000102 + 1C37FABC05539CD112110102 + E2644B35053B69B200211256 + 1C37FABC04509CD000100104 + 1CC0EA4004350EF90044410B + 1CC0EA4004350EF90041110B + + PBXProjectModuleGUID + 11E0B1FE06471DED0097A5F4 + PBXProjectModuleLabel + Files + PBXProjectStructureProvided + yes + PBXSmartGroupTreeModuleColumnData + + PBXSmartGroupTreeModuleColumnWidthsKey + + 186 + + PBXSmartGroupTreeModuleColumnsKey_v4 + + MainColumn + + + PBXSmartGroupTreeModuleOutlineStateKey_v7 + + PBXSmartGroupTreeModuleOutlineStateExpansionKey + + 29B97314FDCFA39411CA2CEA + 1C37FABC05509CD000000102 + + PBXSmartGroupTreeModuleOutlineStateSelectionKey + + + 0 + + + PBXSmartGroupTreeModuleOutlineStateVisibleRectKey + {{0, 0}, {186, 337}} + + PBXTopSmartGroupGIDs + + XCIncludePerspectivesSwitch + 1 + XCSharingToken + com.apple.Xcode.GFSharingToken + + GeometryConfiguration + + Frame + {{0, 0}, {203, 355}} + GroupTreeTableConfiguration + + MainColumn + 186 + + RubberWindowFrame + 373 269 690 397 0 0 1440 878 + + Module + PBXSmartGroupTreeModule + Proportion + 100% + + + Name + Morph + PreferredWidth + 300 + ServiceClasses + + XCModuleDock + PBXSmartGroupTreeModule + + TableOfContents + + 11E0B1FE06471DED0097A5F4 + + ToolbarConfiguration + xcode.toolbar.config.default.short + + + PerspectivesBarVisible + + ShelfIsVisible + + SourceDescription + file at '/System/Library/PrivateFrameworks/DevToolsInterface.framework/Versions/A/Resources/XCPerspectivesSpecificationMode1.xcperspec' + StatusbarIsVisible + + TimeStamp + 0.0 + ToolbarDisplayMode + 1 + ToolbarIsVisible + + ToolbarSizeMode + 1 + Type + Perspectives + UpdateMessage + The Default Workspace in this version of Xcode now includes support to hide and show the detail view (what has been referred to as the "Metro-Morph" feature). You must discard your current Default Workspace settings and update to the latest Default Workspace in order to gain this feature. Do you wish to update to the latest Workspace defaults for project '%@'? + WindowJustification + 5 + WindowOrderList + + 1C530D57069F1CE1000CFCEE + /Users/xugg/Projects/Cog/Libraries/MPCDec/MPCDec.xcode + + WindowString + 167 339 690 397 0 0 1024 746 + WindowTools + + + FirstTimeWindowDisplayed + + Identifier + windowTool.build + IsVertical + + Layout + + + Dock + + + BecomeActive + + ContentConfiguration + + PBXProjectModuleGUID + 1CD0528F0623707200166675 + PBXProjectModuleLabel + huffsv7.c + StatusBarVisibility + + + GeometryConfiguration + + Frame + {{0, 0}, {500, 218}} + RubberWindowFrame + 188 213 500 500 0 0 1024 746 + + Module + PBXNavigatorGroup + Proportion + 218pt + + + ContentConfiguration + + PBXProjectModuleGUID + XCMainBuildResultsModuleGUID + PBXProjectModuleLabel + Build + XCBuildResultsTrigger_Collapse + 1021 + XCBuildResultsTrigger_Open + 1011 + + GeometryConfiguration + + Frame + {{0, 223}, {500, 236}} + RubberWindowFrame + 188 213 500 500 0 0 1024 746 + + Module + PBXBuildResultsModule + Proportion + 236pt + + + Proportion + 459pt + + + Name + Build Results + ServiceClasses + + PBXBuildResultsModule + + StatusbarIsVisible + + TableOfContents + + 8E8D0F0A082DD2A300CC65F0 + 8E72B7F6082E6C4A00913FD7 + 1CD0528F0623707200166675 + XCMainBuildResultsModuleGUID + + ToolbarConfiguration + xcode.toolbar.config.build + WindowString + 188 213 500 500 0 0 1024 746 + WindowToolGUID + 8E8D0F0A082DD2A300CC65F0 + WindowToolIsVisible + + + + Identifier + windowTool.debugger + Layout + + + Dock + + + ContentConfiguration + + Debugger + + HorizontalSplitView + + _collapsingFrameDimension + 0.0 + _indexOfCollapsedView + 0 + _percentageOfCollapsedView + 0.0 + isCollapsed + yes + sizes + + {{0, 0}, {317, 164}} + {{317, 0}, {377, 164}} + + + VerticalSplitView + + _collapsingFrameDimension + 0.0 + _indexOfCollapsedView + 0 + _percentageOfCollapsedView + 0.0 + isCollapsed + yes + sizes + + {{0, 0}, {694, 164}} + {{0, 164}, {694, 216}} + + + + LauncherConfigVersion + 8 + PBXProjectModuleGUID + 1C162984064C10D400B95A72 + PBXProjectModuleLabel + Debug - GLUTExamples (Underwater) + + GeometryConfiguration + + DebugConsoleDrawerSize + {100, 120} + DebugConsoleVisible + None + DebugConsoleWindowFrame + {{200, 200}, {500, 300}} + DebugSTDIOWindowFrame + {{200, 200}, {500, 300}} + Frame + {{0, 0}, {694, 380}} + RubberWindowFrame + 321 238 694 422 0 0 1440 878 + + Module + PBXDebugSessionModule + Proportion + 100% + + + Proportion + 100% + + + Name + Debugger + ServiceClasses + + PBXDebugSessionModule + + StatusbarIsVisible + 1 + TableOfContents + + 1CD10A99069EF8BA00B06720 + 1C0AD2AB069F1E9B00FABCE6 + 1C162984064C10D400B95A72 + 1C0AD2AC069F1E9B00FABCE6 + + ToolbarConfiguration + xcode.toolbar.config.debug + WindowString + 321 238 694 422 0 0 1440 878 + WindowToolGUID + 1CD10A99069EF8BA00B06720 + WindowToolIsVisible + 0 + + + FirstTimeWindowDisplayed + + Identifier + windowTool.find + IsVertical + + Layout + + + Dock + + + Dock + + + ContentConfiguration + + PBXProjectModuleGUID + 1CDD528C0622207200134675 + PBXProjectModuleLabel + + StatusBarVisibility + + + GeometryConfiguration + + Frame + {{0, 0}, {781, 212}} + RubberWindowFrame + 188 243 781 470 0 0 1024 746 + + Module + PBXNavigatorGroup + Proportion + 781pt + + + Proportion + 212pt + + + ContentConfiguration + + PBXProjectModuleGUID + 1CD0528E0623707200166675 + PBXProjectModuleLabel + Project Find + + GeometryConfiguration + + Frame + {{0, 217}, {781, 212}} + RubberWindowFrame + 188 243 781 470 0 0 1024 746 + + Module + PBXProjectFindModule + Proportion + 212pt + + + Proportion + 429pt + + + Name + Project Find + ServiceClasses + + PBXProjectFindModule + + StatusbarIsVisible + + TableOfContents + + 1C530D57069F1CE1000CFCEE + 8E94D98F084BE762007F0AEB + 8E94D990084BE762007F0AEB + 1CDD528C0622207200134675 + 1CD0528E0623707200166675 + + WindowString + 188 243 781 470 0 0 1024 746 + WindowToolGUID + 1C530D57069F1CE1000CFCEE + WindowToolIsVisible + + + + Identifier + MENUSEPARATOR + + + Identifier + windowTool.debuggerConsole + Layout + + + Dock + + + BecomeActive + 1 + ContentConfiguration + + PBXProjectModuleGUID + 1C78EAAC065D492600B07095 + PBXProjectModuleLabel + Debugger Console + + GeometryConfiguration + + Frame + {{0, 0}, {440, 358}} + RubberWindowFrame + 650 41 440 400 0 0 1280 1002 + + Module + PBXDebugCLIModule + Proportion + 358pt + + + Proportion + 358pt + + + Name + Debugger Console + ServiceClasses + + PBXDebugCLIModule + + StatusbarIsVisible + 1 + TableOfContents + + 1C78EAAD065D492600B07095 + 1C78EAAE065D492600B07095 + 1C78EAAC065D492600B07095 + + WindowString + 650 41 440 400 0 0 1280 1002 + + + Identifier + windowTool.run + Layout + + + Dock + + + ContentConfiguration + + LauncherConfigVersion + 3 + PBXProjectModuleGUID + 1CD0528B0623707200166675 + PBXProjectModuleLabel + Run + Runner + + HorizontalSplitView + + _collapsingFrameDimension + 0.0 + _indexOfCollapsedView + 0 + _percentageOfCollapsedView + 0.0 + isCollapsed + yes + sizes + + {{0, 0}, {493, 167}} + {{0, 176}, {493, 267}} + + + VerticalSplitView + + _collapsingFrameDimension + 0.0 + _indexOfCollapsedView + 0 + _percentageOfCollapsedView + 0.0 + isCollapsed + yes + sizes + + {{0, 0}, {405, 443}} + {{414, 0}, {514, 443}} + + + + + GeometryConfiguration + + Frame + {{0, 0}, {460, 159}} + RubberWindowFrame + 316 696 459 200 0 0 1280 1002 + + Module + PBXRunSessionModule + Proportion + 159pt + + + Proportion + 159pt + + + Name + Run Log + ServiceClasses + + PBXRunSessionModule + + StatusbarIsVisible + 1 + TableOfContents + + 1C0AD2B3069F1EA900FABCE6 + 1C0AD2B4069F1EA900FABCE6 + 1CD0528B0623707200166675 + 1C0AD2B5069F1EA900FABCE6 + + ToolbarConfiguration + xcode.toolbar.config.run + WindowString + 316 696 459 200 0 0 1280 1002 + WindowToolGUID + 1C0AD2B3069F1EA900FABCE6 + WindowToolIsVisible + 0 + + + Identifier + windowTool.scm + Layout + + + Dock + + + ContentConfiguration + + PBXProjectModuleGUID + 1C78EAB2065D492600B07095 + PBXProjectModuleLabel + <No Editor> + PBXSplitModuleInNavigatorKey + + Split0 + + PBXProjectModuleGUID + 1C78EAB3065D492600B07095 + + SplitCount + 1 + + StatusBarVisibility + 1 + + GeometryConfiguration + + Frame + {{0, 0}, {452, 0}} + RubberWindowFrame + 743 379 452 308 0 0 1280 1002 + + Module + PBXNavigatorGroup + Proportion + 0pt + + + BecomeActive + 1 + ContentConfiguration + + PBXProjectModuleGUID + 1CD052920623707200166675 + PBXProjectModuleLabel + SCM + + GeometryConfiguration + + ConsoleFrame + {{0, 259}, {452, 0}} + Frame + {{0, 7}, {452, 259}} + RubberWindowFrame + 743 379 452 308 0 0 1280 1002 + TableConfiguration + + Status + 30 + FileName + 199 + Path + 197.09500122070312 + + TableFrame + {{0, 0}, {452, 250}} + + Module + PBXCVSModule + Proportion + 262pt + + + Proportion + 266pt + + + Name + SCM + ServiceClasses + + PBXCVSModule + + StatusbarIsVisible + 1 + TableOfContents + + 1C78EAB4065D492600B07095 + 1C78EAB5065D492600B07095 + 1C78EAB2065D492600B07095 + 1CD052920623707200166675 + + ToolbarConfiguration + xcode.toolbar.config.scm + WindowString + 743 379 452 308 0 0 1280 1002 + + + Identifier + windowTool.breakpoints + Layout + + + Dock + + + BecomeActive + 1 + ContentConfiguration + + PBXProjectModuleGUID + 1CD052930623707200166675 + PBXProjectModuleLabel + Breakpoints + + GeometryConfiguration + + BreakpointsTreeTableConfiguration + + enabledColumn + 16 + breakpointColumn + 201.5830078125 + + Frame + {{0, 0}, {240, 195}} + RubberWindowFrame + 342 421 240 216 0 0 1440 878 + + Module + PBXDebugBreakpointsModule + Proportion + 195pt + + + Proportion + 195pt + + + Name + Breakpoints + ServiceClasses + + PBXDebugBreakpointsModule + + StatusbarIsVisible + 0 + TableOfContents + + 1C0AD2AD069F1E9B00FABCE6 + 1C0AD2AE069F1E9B00FABCE6 + 1CD052930623707200166675 + + WindowString + 342 421 240 216 0 0 1440 878 + WindowToolGUID + 1C0AD2AD069F1E9B00FABCE6 + WindowToolIsVisible + 0 + + + Identifier + windowTool.bookmarks + Layout + + + Dock + + + Module + PBXBookmarksModule + Proportion + 100% + + + Proportion + 100% + + + Name + Bookmarks + ServiceClasses + + PBXBookmarksModule + + StatusbarIsVisible + 0 + WindowString + 538 42 401 187 0 0 1280 1002 + + + Identifier + windowTool.classBrowser + Layout + + + Dock + + + BecomeActive + 1 + ContentConfiguration + + OptionsSetName + Hierarchy, all classes + PBXProjectModuleGUID + 1CA6456E063B45B4001379D8 + PBXProjectModuleLabel + Class Browser - NSObject + + GeometryConfiguration + + ClassesFrame + {{0, 0}, {374, 96}} + ClassesTreeTableConfiguration + + PBXClassNameColumnIdentifier + 208 + PBXClassBookColumnIdentifier + 22 + + Frame + {{0, 0}, {630, 331}} + MembersFrame + {{0, 105}, {374, 395}} + MembersTreeTableConfiguration + + PBXMemberTypeIconColumnIdentifier + 22 + PBXMemberNameColumnIdentifier + 216 + PBXMemberTypeColumnIdentifier + 97 + PBXMemberBookColumnIdentifier + 22 + + PBXModuleWindowStatusBarHidden2 + 1 + RubberWindowFrame + 385 179 630 352 0 0 1440 878 + + Module + PBXClassBrowserModule + Proportion + 332pt + + + Proportion + 332pt + + + Name + Class Browser + ServiceClasses + + PBXClassBrowserModule + + StatusbarIsVisible + 0 + TableOfContents + + 1C0AD2AF069F1E9B00FABCE6 + 1C0AD2B0069F1E9B00FABCE6 + 1CA6456E063B45B4001379D8 + + ToolbarConfiguration + xcode.toolbar.config.classbrowser + WindowString + 385 179 630 352 0 0 1440 878 + WindowToolGUID + 1C0AD2AF069F1E9B00FABCE6 + WindowToolIsVisible + 0 + + + + diff --git a/Libraries/MPCDec/MPCDec.xcode/xugg.pbxuser b/Libraries/MPCDec/MPCDec.xcode/xugg.pbxuser new file mode 100644 index 000000000..7413c7d89 --- /dev/null +++ b/Libraries/MPCDec/MPCDec.xcode/xugg.pbxuser @@ -0,0 +1,172 @@ +// !$*UTF8*$! +{ + 0867D690FE84028FC02AAC07 = { + activeBuildStyle = 4F0BB7ED011F40E904CA0E50; + activeTarget = 8D07F2BC0486CC7A007CD1D0; + addToTargets = ( + 8D07F2BC0486CC7A007CD1D0, + ); + codeSenseManager = 8E8D0ED8082DD1B300CC65F0; + perUserDictionary = { + PBXConfiguration.PBXFileTableDataSource3.PBXErrorsWarningsDataSource = { + PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; + PBXFileTableDataSourceColumnSortingKey = PBXErrorsWarningsDataSource_LocationID; + PBXFileTableDataSourceColumnWidthsKey = ( + 20, + 300, + 133.2085, + ); + PBXFileTableDataSourceColumnsKey = ( + PBXErrorsWarningsDataSource_TypeID, + PBXErrorsWarningsDataSource_MessageID, + PBXErrorsWarningsDataSource_LocationID, + ); + }; + PBXConfiguration.PBXFileTableDataSource3.PBXExecutablesDataSource = { + PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; + PBXFileTableDataSourceColumnSortingKey = PBXExecutablesDataSource_NameID; + PBXFileTableDataSourceColumnWidthsKey = ( + 22, + 300, + 130.5835, + ); + PBXFileTableDataSourceColumnsKey = ( + PBXExecutablesDataSource_ActiveFlagID, + PBXExecutablesDataSource_NameID, + PBXExecutablesDataSource_CommentsID, + ); + }; + PBXConfiguration.PBXFileTableDataSource3.PBXFileTableDataSource = { + PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; + PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID; + PBXFileTableDataSourceColumnWidthsKey = ( + 20, + 243, + 20, + 48, + 43, + 43, + 20, + ); + PBXFileTableDataSourceColumnsKey = ( + PBXFileDataSource_FiletypeID, + PBXFileDataSource_Filename_ColumnID, + PBXFileDataSource_Built_ColumnID, + PBXFileDataSource_ObjectSize_ColumnID, + PBXFileDataSource_Errors_ColumnID, + PBXFileDataSource_Warnings_ColumnID, + PBXFileDataSource_Target_ColumnID, + ); + }; + PBXConfiguration.PBXTargetDataSource.PBXTargetDataSource = { + PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; + PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID; + PBXFileTableDataSourceColumnWidthsKey = ( + 20, + 200, + 63, + 20, + 48.1626, + 43, + 43, + ); + PBXFileTableDataSourceColumnsKey = ( + PBXFileDataSource_FiletypeID, + PBXFileDataSource_Filename_ColumnID, + PBXTargetDataSource_PrimaryAttribute, + PBXFileDataSource_Built_ColumnID, + PBXFileDataSource_ObjectSize_ColumnID, + PBXFileDataSource_Errors_ColumnID, + PBXFileDataSource_Warnings_ColumnID, + ); + }; + PBXPerProjectTemplateStateSaveDate = 139192148; + PBXWorkspaceStateSaveDate = 139192148; + }; + perUserProjectItems = { + 8E6F2AA8084810380011F126 = 8E6F2AA8084810380011F126; + 8E6F2AAA084810380011F126 = 8E6F2AAA084810380011F126; + 8E6F2AAB084810380011F126 = 8E6F2AAB084810380011F126; + 8E94D9A7084BE940007F0AEB = 8E94D9A7084BE940007F0AEB; + }; + sourceControlManager = 8E8D0ED7082DD1B300CC65F0; + userBuildSettings = { + }; + }; + 8D07F2BC0486CC7A007CD1D0 = { + activeExec = 0; + }; + 8E6F2AA8084810380011F126 = { + fRef = 8E8D0EF6082DD1F800CC65F0; + isa = PBXTextBookmark; + name = "mpcdec.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 948; + vrLoc = 0; + }; + 8E6F2AAA084810380011F126 = { + fRef = 8E8D0EF6082DD1F800CC65F0; + isa = PBXTextBookmark; + name = "mpcdec.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 948; + vrLoc = 0; + }; + 8E6F2AAB084810380011F126 = { + fRef = 8E8D0EE3082DD1E100CC65F0; + isa = PBXTextBookmark; + name = "sample.cpp: 213"; + rLen = 0; + rLoc = 6221; + rType = 0; + vrLen = 0; + vrLoc = 0; + }; + 8E8D0ED7082DD1B300CC65F0 = { + fallbackIsa = XCSourceControlManager; + isSCMEnabled = 0; + isa = PBXSourceControlManager; + scmConfiguration = { + }; + scmType = ""; + }; + 8E8D0ED8082DD1B300CC65F0 = { + indexTemplatePath = ""; + isa = PBXCodeSenseManager; + }; + 8E8D0EDD082DD1E100CC65F0 = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {668, 7014}}"; + sepNavSelRange = "{0, 4}"; + sepNavVisRect = "{{0, 0}, {459, 186}}"; + }; + }; + 8E8D0EE3082DD1E100CC65F0 = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {764, 4606}}"; + sepNavSelRange = "{6221, 0}"; + sepNavVisRect = "{{0, 0}, {0, 0}}"; + }; + }; + 8E8D0EF6082DD1F800CC65F0 = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {608, 1862}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRect = "{{0, 0}, {441, 319}}"; + }; + }; + 8E94D9A7084BE940007F0AEB = { + fRef = 8E8D0EE3082DD1E100CC65F0; + isa = PBXTextBookmark; + name = "sample.cpp: 213"; + rLen = 0; + rLoc = 6221; + rType = 0; + vrLen = 0; + vrLoc = 0; + }; +} diff --git a/Libraries/Ogg/.cvsignore b/Libraries/Ogg/.cvsignore new file mode 100644 index 000000000..8c8719a24 --- /dev/null +++ b/Libraries/Ogg/.cvsignore @@ -0,0 +1,27 @@ +Makefile +Makefile.in +configure +aclocal.m4 +config.cache +config.guess +config.log +config.status +config.sub +install-sh +libtool +ltconfig +ltmain.sh +missing +mkinstalldirs +*.o +*.lo +*.la +*.lai +*.so.* +*.a +*.so +.libs +.deps +*.tar.gz +*.zip +ogg-config diff --git a/Libraries/Ogg/English.lproj/InfoPlist.strings b/Libraries/Ogg/English.lproj/InfoPlist.strings new file mode 100644 index 0000000000000000000000000000000000000000..b230fea4930f0172f7afde95bd251c7efb4da1ba GIT binary patch literal 136 zcmW-Z-3o$W5Jb + +and the rest of the Xiph.Org Foundation. + diff --git a/Libraries/Ogg/Files/CHANGES b/Libraries/Ogg/Files/CHANGES new file mode 100644 index 000000000..9c8a824ae --- /dev/null +++ b/Libraries/Ogg/Files/CHANGES @@ -0,0 +1,27 @@ +Version 1.1.2 (2004 September 23) + + * fix a bug with multipage packet assembly after seek + +Version 1.1.1 (2004 September 12) + + * various bugfixes + * important bugfix for 64-bit platforms + * various portability fixes + * autotools cleanup from Thomas Vander Stichele + * Symbian OS build support from Colin Ward at CSIRO + * new multiplexed Ogg stream documentation + +Version 1.1 (2003 November 17) + + * big-endian bitpacker routines for Theora + * various portability fixes + * improved API documenation + * RFC 3533 documentation of the format by Silvia Pfeiffer at CSIRO + * RFC 3534 documentation of the application/ogg mime-type by Linus Walleij + +Version 1.0 (2002 July 19) + + * First stable release + * little-endian bitpacker routines for Vorbis + * basic Ogg bitstream sync and coding support + diff --git a/Libraries/Ogg/Files/COPYING b/Libraries/Ogg/Files/COPYING new file mode 100644 index 000000000..6111c6c5a --- /dev/null +++ b/Libraries/Ogg/Files/COPYING @@ -0,0 +1,28 @@ +Copyright (c) 2002, Xiph.org Foundation + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +- Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + +- Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + +- Neither the name of the Xiph.org Foundation nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION +OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/Libraries/Ogg/Files/HACKING b/Libraries/Ogg/Files/HACKING new file mode 100644 index 000000000..1c0a284a3 --- /dev/null +++ b/Libraries/Ogg/Files/HACKING @@ -0,0 +1,48 @@ +Note that these instructions are *not* necessary for distribution +tarballs; they have separate configure/build instructions. + +Building this package from CVS is mainly intended for developers. +General users should obtain official distribution packages; both +source and binary distributions are available at +http://www.vorbis.com/. + +----- + +These are *brief* instructions on how to build this package from CVS. +Yes, there are details left out. + +There are generally four steps necessary when building from CVS (i.e., +a developer's copy): + +1. cvs checkout of the sources, or cvs update. RTFM from your + favorite flavor of CVS documentation; information on the xiph.org + CVS repository can be found at http://www.xiph.org/cvs.html. + +2. [re-]generate files such as "configure" and "Makefile.in" with the + GNU autoconf/automake tools. Run the "autogen.sh" script to + perform this step. + + *** IF YOU ARE NOT BUILDING WITH GNU MAKE *AND* GCC: you must set + the AUTOMAKE_FLAGS environment variable to "--include-deps" + before running autogen.sh. For example: + + csh% setenv AUTOMAKE_FLAGS --include-deps + csh% ./autogen.sh + or + sh% AUTOMAKE_FLAGS=--include-deps ./autogen.sh + +3. Run configure. There are several options available; see + "./configure --help" for more information. + +4. Run "make" to build the source. + +In general, steps 2 and 3 need to be re-run every time any of the +following files are modified (either manually or by a cvs update): + + configure.in + acinclude.m4 + +Running "make clean" after running steps 2 and 3 is generally also +advisable before running step 4. It isn't *always* necessary, but +unless you understand the workings of autoconf/automake, it's safest +to just do it. diff --git a/Libraries/Ogg/Files/README b/Libraries/Ogg/Files/README new file mode 100644 index 000000000..c82972d57 --- /dev/null +++ b/Libraries/Ogg/Files/README @@ -0,0 +1,103 @@ +******************************************************************** +* * +* THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * +* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * +* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * +* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * +* * +* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * +* by the Xiph.Org Foundation http://www.xiph.org/ * +* * +******************************************************************** + +WHAT'S HERE: + +This source distribution includes libogg and nothing else. Other modules +(eg, the modules vorbis, vorbis-tools and vorbis-plugins for the Vorbis +codec) contain the codec libraries for use with Ogg bitstreams. + +Directory: + +./src The source for libogg, a BSD-license inplementation of + the public domain Ogg bitstream format + +./include Library API headers and codebooks + +./debian Rules/spec files for building Debian .deb packages + +./doc Ogg specification documents + +./win32 Win32 projects and build automation + +./mac MacOS 9 projects and build automation + +WHAT IS OGG?: + +Ogg project codecs use the Ogg bitstream format to arrange the raw, +compressed bitstream into a more robust, useful form. For example, +the Ogg bitstream makes seeking, time stamping and error recovery +possible, as well as mixing several sepearate, concurrent media +streams into a single physical bitstream. + +CONTACT: + +The Ogg homepage is located at 'http://www.xiph.org/ogg/'. +Up to date technical documents, contact information, source code and +pre-built utilities may be found there. + +BUILDING FROM CVS: + +A standard cvs build should consist of nothing more than: + +./autogen.sh +make + +and as root if desired : + +make install + +This will install the Ogg libraries (static and shared) into +/usr/local/lib, includes into /usr/local/include and API manpages +(once we write some) into /usr/local/man. + +BUILDING FROM TARBALL DISTRIBUTIONS: + +./configure +make + +and optionally (as root): +make install + +BUILDING RPMS: + +RPMs may be built by: + +make dist +rpm -ta libogg-.tar.gz + +BUILDING ON WIN32: + +Use the project file in the win32 directory. It should compile out of the box. +You can also run one of the batch files from the commandline. + +E.g.: build_ogg_dynamic + +BUILDING ON MACOS 9: + +Ogg on MacOS 9 is built using CodeWarrior 5.3. To build it, first +open ogg/mac/libogg.mcp, switch to the "Targets" pane, select +everything, and make the project. In ogg/mac/Output you will now have +both debug and final versions of Ogg shared libraries to link your +projects against. + +To build a project using Ogg, add access paths to your CodeWarrior +project for the ogg/include and ogg/mac/Output folders. Be sure that +"interpret DOS and Unix paths" is turned on in your project; it can be +found in the "access paths" pane in your project settings. Now simply +add the shared libraries you need to your project (OggLib at least) +and #include "ogg/ogg.h" wherever you need to acces Ogg functionality. + +(Build instructions for Ogg codecs such as vorbis are similar and may +be found in those source modules' README files) + +$Id$ diff --git a/Libraries/Ogg/Files/include/.cvsignore b/Libraries/Ogg/Files/include/.cvsignore new file mode 100644 index 000000000..282522db0 --- /dev/null +++ b/Libraries/Ogg/Files/include/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/Libraries/Ogg/Files/include/ogg/.cvsignore b/Libraries/Ogg/Files/include/ogg/.cvsignore new file mode 100644 index 000000000..d7ae24eba --- /dev/null +++ b/Libraries/Ogg/Files/include/ogg/.cvsignore @@ -0,0 +1,3 @@ +Makefile +Makefile.in +config_types.h diff --git a/Libraries/Ogg/Files/include/ogg/config_types.h.in b/Libraries/Ogg/Files/include/ogg/config_types.h.in new file mode 100644 index 000000000..568a001fd --- /dev/null +++ b/Libraries/Ogg/Files/include/ogg/config_types.h.in @@ -0,0 +1,11 @@ +#ifndef __CONFIG_TYPES_H__ +#define __CONFIG_TYPES_H__ + +/* these are filled in by configure */ +typedef @SIZE16@ ogg_int16_t; +typedef @USIZE16@ ogg_uint16_t; +typedef @SIZE32@ ogg_int32_t; +typedef @USIZE32@ ogg_uint32_t; +typedef @SIZE64@ ogg_int64_t; + +#endif diff --git a/Libraries/Ogg/Files/include/ogg/ogg.h b/Libraries/Ogg/Files/include/ogg/ogg.h new file mode 100644 index 000000000..b790f8d62 --- /dev/null +++ b/Libraries/Ogg/Files/include/ogg/ogg.h @@ -0,0 +1,202 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * + * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * + * by the Xiph.Org Foundation http://www.xiph.org/ * + * * + ******************************************************************** + + function: toplevel libogg include + last mod: $Id$ + + ********************************************************************/ +#ifndef _OGG_H +#define _OGG_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +typedef struct { + long endbyte; + int endbit; + + unsigned char *buffer; + unsigned char *ptr; + long storage; +} oggpack_buffer; + +/* ogg_page is used to encapsulate the data in one Ogg bitstream page *****/ + +typedef struct { + unsigned char *header; + long header_len; + unsigned char *body; + long body_len; +} ogg_page; + +/* ogg_stream_state contains the current encode/decode state of a logical + Ogg bitstream **********************************************************/ + +typedef struct { + unsigned char *body_data; /* bytes from packet bodies */ + long body_storage; /* storage elements allocated */ + long body_fill; /* elements stored; fill mark */ + long body_returned; /* elements of fill returned */ + + + int *lacing_vals; /* The values that will go to the segment table */ + ogg_int64_t *granule_vals; /* granulepos values for headers. Not compact + this way, but it is simple coupled to the + lacing fifo */ + long lacing_storage; + long lacing_fill; + long lacing_packet; + long lacing_returned; + + unsigned char header[282]; /* working space for header encode */ + int header_fill; + + int e_o_s; /* set when we have buffered the last packet in the + logical bitstream */ + int b_o_s; /* set after we've written the initial page + of a logical bitstream */ + long serialno; + long pageno; + ogg_int64_t packetno; /* sequence number for decode; the framing + knows where there's a hole in the data, + but we need coupling so that the codec + (which is in a seperate abstraction + layer) also knows about the gap */ + ogg_int64_t granulepos; + +} ogg_stream_state; + +/* ogg_packet is used to encapsulate the data and metadata belonging + to a single raw Ogg/Vorbis packet *************************************/ + +typedef struct { + unsigned char *packet; + long bytes; + long b_o_s; + long e_o_s; + + ogg_int64_t granulepos; + + ogg_int64_t packetno; /* sequence number for decode; the framing + knows where there's a hole in the data, + but we need coupling so that the codec + (which is in a seperate abstraction + layer) also knows about the gap */ +} ogg_packet; + +typedef struct { + unsigned char *data; + int storage; + int fill; + int returned; + + int unsynced; + int headerbytes; + int bodybytes; +} ogg_sync_state; + +/* Ogg BITSTREAM PRIMITIVES: bitstream ************************/ + +extern void oggpack_writeinit(oggpack_buffer *b); +extern void oggpack_writetrunc(oggpack_buffer *b,long bits); +extern void oggpack_writealign(oggpack_buffer *b); +extern void oggpack_writecopy(oggpack_buffer *b,void *source,long bits); +extern void oggpack_reset(oggpack_buffer *b); +extern void oggpack_writeclear(oggpack_buffer *b); +extern void oggpack_readinit(oggpack_buffer *b,unsigned char *buf,int bytes); +extern void oggpack_write(oggpack_buffer *b,unsigned long value,int bits); +extern long oggpack_look(oggpack_buffer *b,int bits); +extern long oggpack_look1(oggpack_buffer *b); +extern void oggpack_adv(oggpack_buffer *b,int bits); +extern void oggpack_adv1(oggpack_buffer *b); +extern long oggpack_read(oggpack_buffer *b,int bits); +extern long oggpack_read1(oggpack_buffer *b); +extern long oggpack_bytes(oggpack_buffer *b); +extern long oggpack_bits(oggpack_buffer *b); +extern unsigned char *oggpack_get_buffer(oggpack_buffer *b); + +extern void oggpackB_writeinit(oggpack_buffer *b); +extern void oggpackB_writetrunc(oggpack_buffer *b,long bits); +extern void oggpackB_writealign(oggpack_buffer *b); +extern void oggpackB_writecopy(oggpack_buffer *b,void *source,long bits); +extern void oggpackB_reset(oggpack_buffer *b); +extern void oggpackB_writeclear(oggpack_buffer *b); +extern void oggpackB_readinit(oggpack_buffer *b,unsigned char *buf,int bytes); +extern void oggpackB_write(oggpack_buffer *b,unsigned long value,int bits); +extern long oggpackB_look(oggpack_buffer *b,int bits); +extern long oggpackB_look1(oggpack_buffer *b); +extern void oggpackB_adv(oggpack_buffer *b,int bits); +extern void oggpackB_adv1(oggpack_buffer *b); +extern long oggpackB_read(oggpack_buffer *b,int bits); +extern long oggpackB_read1(oggpack_buffer *b); +extern long oggpackB_bytes(oggpack_buffer *b); +extern long oggpackB_bits(oggpack_buffer *b); +extern unsigned char *oggpackB_get_buffer(oggpack_buffer *b); + +/* Ogg BITSTREAM PRIMITIVES: encoding **************************/ + +extern int ogg_stream_packetin(ogg_stream_state *os, ogg_packet *op); +extern int ogg_stream_pageout(ogg_stream_state *os, ogg_page *og); +extern int ogg_stream_flush(ogg_stream_state *os, ogg_page *og); + +/* Ogg BITSTREAM PRIMITIVES: decoding **************************/ + +extern int ogg_sync_init(ogg_sync_state *oy); +extern int ogg_sync_clear(ogg_sync_state *oy); +extern int ogg_sync_reset(ogg_sync_state *oy); +extern int ogg_sync_destroy(ogg_sync_state *oy); + +extern char *ogg_sync_buffer(ogg_sync_state *oy, long size); +extern int ogg_sync_wrote(ogg_sync_state *oy, long bytes); +extern long ogg_sync_pageseek(ogg_sync_state *oy,ogg_page *og); +extern int ogg_sync_pageout(ogg_sync_state *oy, ogg_page *og); +extern int ogg_stream_pagein(ogg_stream_state *os, ogg_page *og); +extern int ogg_stream_packetout(ogg_stream_state *os,ogg_packet *op); +extern int ogg_stream_packetpeek(ogg_stream_state *os,ogg_packet *op); + +/* Ogg BITSTREAM PRIMITIVES: general ***************************/ + +extern int ogg_stream_init(ogg_stream_state *os,int serialno); +extern int ogg_stream_clear(ogg_stream_state *os); +extern int ogg_stream_reset(ogg_stream_state *os); +extern int ogg_stream_reset_serialno(ogg_stream_state *os,int serialno); +extern int ogg_stream_destroy(ogg_stream_state *os); +extern int ogg_stream_eos(ogg_stream_state *os); + +extern void ogg_page_checksum_set(ogg_page *og); + +extern int ogg_page_version(ogg_page *og); +extern int ogg_page_continued(ogg_page *og); +extern int ogg_page_bos(ogg_page *og); +extern int ogg_page_eos(ogg_page *og); +extern ogg_int64_t ogg_page_granulepos(ogg_page *og); +extern int ogg_page_serialno(ogg_page *og); +extern long ogg_page_pageno(ogg_page *og); +extern int ogg_page_packets(ogg_page *og); + +extern void ogg_packet_clear(ogg_packet *op); + + +#ifdef __cplusplus +} +#endif + +#endif /* _OGG_H */ + + + + + + diff --git a/Libraries/Ogg/Files/include/ogg/os_types.h b/Libraries/Ogg/Files/include/ogg/os_types.h new file mode 100644 index 000000000..e576080ab --- /dev/null +++ b/Libraries/Ogg/Files/include/ogg/os_types.h @@ -0,0 +1,127 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * + * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * + * by the Xiph.Org Foundation http://www.xiph.org/ * + * * + ******************************************************************** + + function: #ifdef jail to whip a few platforms into the UNIX ideal. + last mod: $Id$ + + ********************************************************************/ +#ifndef _OS_TYPES_H +#define _OS_TYPES_H + +/* make it easy on the folks that want to compile the libs with a + different malloc than stdlib */ +#define _ogg_malloc malloc +#define _ogg_calloc calloc +#define _ogg_realloc realloc +#define _ogg_free free + +#if defined(_WIN32) + +# if defined(__CYGWIN__) +# include <_G_config.h> + typedef _G_int64_t ogg_int64_t; + typedef _G_int32_t ogg_int32_t; + typedef _G_uint32_t ogg_uint32_t; + typedef _G_int16_t ogg_int16_t; + typedef _G_uint16_t ogg_uint16_t; +# elif defined(__MINGW32__) + typedef short ogg_int16_t; + typedef unsigned short ogg_uint16_t; + typedef int ogg_int32_t; + typedef unsigned int ogg_uint32_t; + typedef long long ogg_int64_t; + typedef unsigned long long ogg_uint64_t; +# elif defined(__MWERKS__) + typedef long long ogg_int64_t; + typedef int ogg_int32_t; + typedef unsigned int ogg_uint32_t; + typedef short ogg_int16_t; + typedef unsigned short ogg_uint16_t; +# else + /* MSVC/Borland */ + typedef __int64 ogg_int64_t; + typedef __int32 ogg_int32_t; + typedef unsigned __int32 ogg_uint32_t; + typedef __int16 ogg_int16_t; + typedef unsigned __int16 ogg_uint16_t; +# endif + +#elif defined(__MACOS__) + +# include + typedef SInt16 ogg_int16_t; + typedef UInt16 ogg_uint16_t; + typedef SInt32 ogg_int32_t; + typedef UInt32 ogg_uint32_t; + typedef SInt64 ogg_int64_t; + +#elif defined(__MACOSX__) /* MacOS X Framework build */ + +# include + typedef int16_t ogg_int16_t; + typedef u_int16_t ogg_uint16_t; + typedef int32_t ogg_int32_t; + typedef u_int32_t ogg_uint32_t; + typedef int64_t ogg_int64_t; + +#elif defined(__BEOS__) + + /* Be */ +# include + typedef int16_t ogg_int16_t; + typedef u_int16_t ogg_uint16_t; + typedef int32_t ogg_int32_t; + typedef u_int32_t ogg_uint32_t; + typedef int64_t ogg_int64_t; + +#elif defined (__EMX__) + + /* OS/2 GCC */ + typedef short ogg_int16_t; + typedef unsigned short ogg_uint16_t; + typedef int ogg_int32_t; + typedef unsigned int ogg_uint32_t; + typedef long long ogg_int64_t; + +#elif defined (DJGPP) + + /* DJGPP */ + typedef short ogg_int16_t; + typedef int ogg_int32_t; + typedef unsigned int ogg_uint32_t; + typedef long long ogg_int64_t; + +#elif defined(R5900) + + /* PS2 EE */ + typedef long ogg_int64_t; + typedef int ogg_int32_t; + typedef unsigned ogg_uint32_t; + typedef short ogg_int16_t; + +#elif defined(__SYMBIAN32__) + + /* Symbian GCC */ + typedef signed short ogg_int16_t; + typedef unsigned short ogg_uint16_t; + typedef signed int ogg_int32_t; + typedef unsigned int ogg_uint32_t; + typedef long long int ogg_int64_t; + +#else + +# include +# include + +#endif + +#endif /* _OS_TYPES_H */ diff --git a/Libraries/Ogg/Files/src/.cvsignore b/Libraries/Ogg/Files/src/.cvsignore new file mode 100644 index 000000000..dc4caac80 --- /dev/null +++ b/Libraries/Ogg/Files/src/.cvsignore @@ -0,0 +1,6 @@ +Makefile.in +Makefile +.deps +.libs +*.lo +*.la diff --git a/Libraries/Ogg/Files/src/bitwise.c b/Libraries/Ogg/Files/src/bitwise.c new file mode 100644 index 000000000..83627e9bc --- /dev/null +++ b/Libraries/Ogg/Files/src/bitwise.c @@ -0,0 +1,784 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * + * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * + * by the Xiph.Org Foundation http://www.xiph.org/ * + * * + ******************************************************************** + + function: packing variable sized words into an octet stream + last mod: $Id$ + + ********************************************************************/ + +/* We're 'LSb' endian; if we write a word but read individual bits, + then we'll read the lsb first */ + +#include +#include +#include + +#define BUFFER_INCREMENT 256 + +static const unsigned long mask[]= +{0x00000000,0x00000001,0x00000003,0x00000007,0x0000000f, + 0x0000001f,0x0000003f,0x0000007f,0x000000ff,0x000001ff, + 0x000003ff,0x000007ff,0x00000fff,0x00001fff,0x00003fff, + 0x00007fff,0x0000ffff,0x0001ffff,0x0003ffff,0x0007ffff, + 0x000fffff,0x001fffff,0x003fffff,0x007fffff,0x00ffffff, + 0x01ffffff,0x03ffffff,0x07ffffff,0x0fffffff,0x1fffffff, + 0x3fffffff,0x7fffffff,0xffffffff }; + +static const unsigned int mask8B[]= +{0x00,0x80,0xc0,0xe0,0xf0,0xf8,0xfc,0xfe,0xff}; + +void oggpack_writeinit(oggpack_buffer *b){ + memset(b,0,sizeof(*b)); + b->ptr=b->buffer=_ogg_malloc(BUFFER_INCREMENT); + b->buffer[0]='\0'; + b->storage=BUFFER_INCREMENT; +} + +void oggpackB_writeinit(oggpack_buffer *b){ + oggpack_writeinit(b); +} + +void oggpack_writetrunc(oggpack_buffer *b,long bits){ + long bytes=bits>>3; + bits-=bytes*8; + b->ptr=b->buffer+bytes; + b->endbit=bits; + b->endbyte=bytes; + *b->ptr&=mask[bits]; +} + +void oggpackB_writetrunc(oggpack_buffer *b,long bits){ + long bytes=bits>>3; + bits-=bytes*8; + b->ptr=b->buffer+bytes; + b->endbit=bits; + b->endbyte=bytes; + *b->ptr&=mask8B[bits]; +} + +/* Takes only up to 32 bits. */ +void oggpack_write(oggpack_buffer *b,unsigned long value,int bits){ + if(b->endbyte+4>=b->storage){ + b->buffer=_ogg_realloc(b->buffer,b->storage+BUFFER_INCREMENT); + b->storage+=BUFFER_INCREMENT; + b->ptr=b->buffer+b->endbyte; + } + + value&=mask[bits]; + bits+=b->endbit; + + b->ptr[0]|=value<endbit; + + if(bits>=8){ + b->ptr[1]=(unsigned char)(value>>(8-b->endbit)); + if(bits>=16){ + b->ptr[2]=(unsigned char)(value>>(16-b->endbit)); + if(bits>=24){ + b->ptr[3]=(unsigned char)(value>>(24-b->endbit)); + if(bits>=32){ + if(b->endbit) + b->ptr[4]=(unsigned char)(value>>(32-b->endbit)); + else + b->ptr[4]=0; + } + } + } + } + + b->endbyte+=bits/8; + b->ptr+=bits/8; + b->endbit=bits&7; +} + +/* Takes only up to 32 bits. */ +void oggpackB_write(oggpack_buffer *b,unsigned long value,int bits){ + if(b->endbyte+4>=b->storage){ + b->buffer=_ogg_realloc(b->buffer,b->storage+BUFFER_INCREMENT); + b->storage+=BUFFER_INCREMENT; + b->ptr=b->buffer+b->endbyte; + } + + value=(value&mask[bits])<<(32-bits); + bits+=b->endbit; + + b->ptr[0]|=value>>(24+b->endbit); + + if(bits>=8){ + b->ptr[1]=(unsigned char)(value>>(16+b->endbit)); + if(bits>=16){ + b->ptr[2]=(unsigned char)(value>>(8+b->endbit)); + if(bits>=24){ + b->ptr[3]=(unsigned char)(value>>(b->endbit)); + if(bits>=32){ + if(b->endbit) + b->ptr[4]=(unsigned char)(value<<(8-b->endbit)); + else + b->ptr[4]=0; + } + } + } + } + + b->endbyte+=bits/8; + b->ptr+=bits/8; + b->endbit=bits&7; +} + +void oggpack_writealign(oggpack_buffer *b){ + int bits=8-b->endbit; + if(bits<8) + oggpack_write(b,0,bits); +} + +void oggpackB_writealign(oggpack_buffer *b){ + int bits=8-b->endbit; + if(bits<8) + oggpackB_write(b,0,bits); +} + +static void oggpack_writecopy_helper(oggpack_buffer *b, + void *source, + long bits, + void (*w)(oggpack_buffer *, + unsigned long, + int), + int msb){ + unsigned char *ptr=(unsigned char *)source; + + long bytes=bits/8; + bits-=bytes*8; + + if(b->endbit){ + int i; + /* unaligned copy. Do it the hard way. */ + for(i=0;iendbyte+bytes+1>=b->storage){ + b->storage=b->endbyte+bytes+BUFFER_INCREMENT; + b->buffer=_ogg_realloc(b->buffer,b->storage); + b->ptr=b->buffer+b->endbyte; + } + + memmove(b->ptr,source,bytes); + b->ptr+=bytes; + b->endbyte+=bytes; + *b->ptr=0; + + } + if(bits){ + if(msb) + w(b,(unsigned long)(ptr[bytes]>>(8-bits)),bits); + else + w(b,(unsigned long)(ptr[bytes]),bits); + } +} + +void oggpack_writecopy(oggpack_buffer *b,void *source,long bits){ + oggpack_writecopy_helper(b,source,bits,oggpack_write,0); +} + +void oggpackB_writecopy(oggpack_buffer *b,void *source,long bits){ + oggpack_writecopy_helper(b,source,bits,oggpackB_write,1); +} + +void oggpack_reset(oggpack_buffer *b){ + b->ptr=b->buffer; + b->buffer[0]=0; + b->endbit=b->endbyte=0; +} + +void oggpackB_reset(oggpack_buffer *b){ + oggpack_reset(b); +} + +void oggpack_writeclear(oggpack_buffer *b){ + _ogg_free(b->buffer); + memset(b,0,sizeof(*b)); +} + +void oggpackB_writeclear(oggpack_buffer *b){ + oggpack_writeclear(b); +} + +void oggpack_readinit(oggpack_buffer *b,unsigned char *buf,int bytes){ + memset(b,0,sizeof(*b)); + b->buffer=b->ptr=buf; + b->storage=bytes; +} + +void oggpackB_readinit(oggpack_buffer *b,unsigned char *buf,int bytes){ + oggpack_readinit(b,buf,bytes); +} + +/* Read in bits without advancing the bitptr; bits <= 32 */ +long oggpack_look(oggpack_buffer *b,int bits){ + unsigned long ret; + unsigned long m=mask[bits]; + + bits+=b->endbit; + + if(b->endbyte+4>=b->storage){ + /* not the main path */ + if(b->endbyte*8+bits>b->storage*8)return(-1); + } + + ret=b->ptr[0]>>b->endbit; + if(bits>8){ + ret|=b->ptr[1]<<(8-b->endbit); + if(bits>16){ + ret|=b->ptr[2]<<(16-b->endbit); + if(bits>24){ + ret|=b->ptr[3]<<(24-b->endbit); + if(bits>32 && b->endbit) + ret|=b->ptr[4]<<(32-b->endbit); + } + } + } + return(m&ret); +} + +/* Read in bits without advancing the bitptr; bits <= 32 */ +long oggpackB_look(oggpack_buffer *b,int bits){ + unsigned long ret; + int m=32-bits; + + bits+=b->endbit; + + if(b->endbyte+4>=b->storage){ + /* not the main path */ + if(b->endbyte*8+bits>b->storage*8)return(-1); + } + + ret=b->ptr[0]<<(24+b->endbit); + if(bits>8){ + ret|=b->ptr[1]<<(16+b->endbit); + if(bits>16){ + ret|=b->ptr[2]<<(8+b->endbit); + if(bits>24){ + ret|=b->ptr[3]<<(b->endbit); + if(bits>32 && b->endbit) + ret|=b->ptr[4]>>(8-b->endbit); + } + } + } + return ((ret&0xffffffff)>>(m>>1))>>((m+1)>>1); +} + +long oggpack_look1(oggpack_buffer *b){ + if(b->endbyte>=b->storage)return(-1); + return((b->ptr[0]>>b->endbit)&1); +} + +long oggpackB_look1(oggpack_buffer *b){ + if(b->endbyte>=b->storage)return(-1); + return((b->ptr[0]>>(7-b->endbit))&1); +} + +void oggpack_adv(oggpack_buffer *b,int bits){ + bits+=b->endbit; + b->ptr+=bits/8; + b->endbyte+=bits/8; + b->endbit=bits&7; +} + +void oggpackB_adv(oggpack_buffer *b,int bits){ + oggpack_adv(b,bits); +} + +void oggpack_adv1(oggpack_buffer *b){ + if(++(b->endbit)>7){ + b->endbit=0; + b->ptr++; + b->endbyte++; + } +} + +void oggpackB_adv1(oggpack_buffer *b){ + oggpack_adv1(b); +} + +/* bits <= 32 */ +long oggpack_read(oggpack_buffer *b,int bits){ + long ret; + unsigned long m=mask[bits]; + + bits+=b->endbit; + + if(b->endbyte+4>=b->storage){ + /* not the main path */ + ret=-1L; + if(b->endbyte*8+bits>b->storage*8)goto overflow; + } + + ret=b->ptr[0]>>b->endbit; + if(bits>8){ + ret|=b->ptr[1]<<(8-b->endbit); + if(bits>16){ + ret|=b->ptr[2]<<(16-b->endbit); + if(bits>24){ + ret|=b->ptr[3]<<(24-b->endbit); + if(bits>32 && b->endbit){ + ret|=b->ptr[4]<<(32-b->endbit); + } + } + } + } + ret&=m; + + overflow: + + b->ptr+=bits/8; + b->endbyte+=bits/8; + b->endbit=bits&7; + return(ret); +} + +/* bits <= 32 */ +long oggpackB_read(oggpack_buffer *b,int bits){ + long ret; + long m=32-bits; + + bits+=b->endbit; + + if(b->endbyte+4>=b->storage){ + /* not the main path */ + ret=-1L; + if(b->endbyte*8+bits>b->storage*8)goto overflow; + } + + ret=b->ptr[0]<<(24+b->endbit); + if(bits>8){ + ret|=b->ptr[1]<<(16+b->endbit); + if(bits>16){ + ret|=b->ptr[2]<<(8+b->endbit); + if(bits>24){ + ret|=b->ptr[3]<<(b->endbit); + if(bits>32 && b->endbit) + ret|=b->ptr[4]>>(8-b->endbit); + } + } + } + ret=((ret&0xffffffffUL)>>(m>>1))>>((m+1)>>1); + + overflow: + + b->ptr+=bits/8; + b->endbyte+=bits/8; + b->endbit=bits&7; + return(ret); +} + +long oggpack_read1(oggpack_buffer *b){ + long ret; + + if(b->endbyte>=b->storage){ + /* not the main path */ + ret=-1L; + goto overflow; + } + + ret=(b->ptr[0]>>b->endbit)&1; + + overflow: + + b->endbit++; + if(b->endbit>7){ + b->endbit=0; + b->ptr++; + b->endbyte++; + } + return(ret); +} + +long oggpackB_read1(oggpack_buffer *b){ + long ret; + + if(b->endbyte>=b->storage){ + /* not the main path */ + ret=-1L; + goto overflow; + } + + ret=(b->ptr[0]>>(7-b->endbit))&1; + + overflow: + + b->endbit++; + if(b->endbit>7){ + b->endbit=0; + b->ptr++; + b->endbyte++; + } + return(ret); +} + +long oggpack_bytes(oggpack_buffer *b){ + return(b->endbyte+(b->endbit+7)/8); +} + +long oggpack_bits(oggpack_buffer *b){ + return(b->endbyte*8+b->endbit); +} + +long oggpackB_bytes(oggpack_buffer *b){ + return oggpack_bytes(b); +} + +long oggpackB_bits(oggpack_buffer *b){ + return oggpack_bits(b); +} + +unsigned char *oggpack_get_buffer(oggpack_buffer *b){ + return(b->buffer); +} + +unsigned char *oggpackB_get_buffer(oggpack_buffer *b){ + return oggpack_get_buffer(b); +} + +/* Self test of the bitwise routines; everything else is based on + them, so they damned well better be solid. */ + +#ifdef _V_SELFTEST +#include + +static int ilog(unsigned int v){ + int ret=0; + while(v){ + ret++; + v>>=1; + } + return(ret); +} + +oggpack_buffer o; +oggpack_buffer r; + +void report(char *in){ + fprintf(stderr,"%s",in); + exit(1); +} + +void cliptest(unsigned long *b,int vals,int bits,int *comp,int compsize){ + long bytes,i; + unsigned char *buffer; + + oggpack_reset(&o); + for(i=0;i +#include +#include + +/* A complete description of Ogg framing exists in docs/framing.html */ + +int ogg_page_version(ogg_page *og){ + return((int)(og->header[4])); +} + +int ogg_page_continued(ogg_page *og){ + return((int)(og->header[5]&0x01)); +} + +int ogg_page_bos(ogg_page *og){ + return((int)(og->header[5]&0x02)); +} + +int ogg_page_eos(ogg_page *og){ + return((int)(og->header[5]&0x04)); +} + +ogg_int64_t ogg_page_granulepos(ogg_page *og){ + unsigned char *page=og->header; + ogg_int64_t granulepos=page[13]&(0xff); + granulepos= (granulepos<<8)|(page[12]&0xff); + granulepos= (granulepos<<8)|(page[11]&0xff); + granulepos= (granulepos<<8)|(page[10]&0xff); + granulepos= (granulepos<<8)|(page[9]&0xff); + granulepos= (granulepos<<8)|(page[8]&0xff); + granulepos= (granulepos<<8)|(page[7]&0xff); + granulepos= (granulepos<<8)|(page[6]&0xff); + return(granulepos); +} + +int ogg_page_serialno(ogg_page *og){ + return(og->header[14] | + (og->header[15]<<8) | + (og->header[16]<<16) | + (og->header[17]<<24)); +} + +long ogg_page_pageno(ogg_page *og){ + return(og->header[18] | + (og->header[19]<<8) | + (og->header[20]<<16) | + (og->header[21]<<24)); +} + + + +/* returns the number of packets that are completed on this page (if + the leading packet is begun on a previous page, but ends on this + page, it's counted */ + +/* NOTE: +If a page consists of a packet begun on a previous page, and a new +packet begun (but not completed) on this page, the return will be: + ogg_page_packets(page) ==1, + ogg_page_continued(page) !=0 + +If a page happens to be a single packet that was begun on a +previous page, and spans to the next page (in the case of a three or +more page packet), the return will be: + ogg_page_packets(page) ==0, + ogg_page_continued(page) !=0 +*/ + +int ogg_page_packets(ogg_page *og){ + int i,n=og->header[26],count=0; + for(i=0;iheader[27+i]<255)count++; + return(count); +} + + +#if 0 +/* helper to initialize lookup for direct-table CRC (illustrative; we + use the static init below) */ + +static ogg_uint32_t _ogg_crc_entry(unsigned long index){ + int i; + unsigned long r; + + r = index << 24; + for (i=0; i<8; i++) + if (r & 0x80000000UL) + r = (r << 1) ^ 0x04c11db7; /* The same as the ethernet generator + polynomial, although we use an + unreflected alg and an init/final + of 0, not 0xffffffff */ + else + r<<=1; + return (r & 0xffffffffUL); +} +#endif + +static const ogg_uint32_t crc_lookup[256]={ + 0x00000000,0x04c11db7,0x09823b6e,0x0d4326d9, + 0x130476dc,0x17c56b6b,0x1a864db2,0x1e475005, + 0x2608edb8,0x22c9f00f,0x2f8ad6d6,0x2b4bcb61, + 0x350c9b64,0x31cd86d3,0x3c8ea00a,0x384fbdbd, + 0x4c11db70,0x48d0c6c7,0x4593e01e,0x4152fda9, + 0x5f15adac,0x5bd4b01b,0x569796c2,0x52568b75, + 0x6a1936c8,0x6ed82b7f,0x639b0da6,0x675a1011, + 0x791d4014,0x7ddc5da3,0x709f7b7a,0x745e66cd, + 0x9823b6e0,0x9ce2ab57,0x91a18d8e,0x95609039, + 0x8b27c03c,0x8fe6dd8b,0x82a5fb52,0x8664e6e5, + 0xbe2b5b58,0xbaea46ef,0xb7a96036,0xb3687d81, + 0xad2f2d84,0xa9ee3033,0xa4ad16ea,0xa06c0b5d, + 0xd4326d90,0xd0f37027,0xddb056fe,0xd9714b49, + 0xc7361b4c,0xc3f706fb,0xceb42022,0xca753d95, + 0xf23a8028,0xf6fb9d9f,0xfbb8bb46,0xff79a6f1, + 0xe13ef6f4,0xe5ffeb43,0xe8bccd9a,0xec7dd02d, + 0x34867077,0x30476dc0,0x3d044b19,0x39c556ae, + 0x278206ab,0x23431b1c,0x2e003dc5,0x2ac12072, + 0x128e9dcf,0x164f8078,0x1b0ca6a1,0x1fcdbb16, + 0x018aeb13,0x054bf6a4,0x0808d07d,0x0cc9cdca, + 0x7897ab07,0x7c56b6b0,0x71159069,0x75d48dde, + 0x6b93dddb,0x6f52c06c,0x6211e6b5,0x66d0fb02, + 0x5e9f46bf,0x5a5e5b08,0x571d7dd1,0x53dc6066, + 0x4d9b3063,0x495a2dd4,0x44190b0d,0x40d816ba, + 0xaca5c697,0xa864db20,0xa527fdf9,0xa1e6e04e, + 0xbfa1b04b,0xbb60adfc,0xb6238b25,0xb2e29692, + 0x8aad2b2f,0x8e6c3698,0x832f1041,0x87ee0df6, + 0x99a95df3,0x9d684044,0x902b669d,0x94ea7b2a, + 0xe0b41de7,0xe4750050,0xe9362689,0xedf73b3e, + 0xf3b06b3b,0xf771768c,0xfa325055,0xfef34de2, + 0xc6bcf05f,0xc27dede8,0xcf3ecb31,0xcbffd686, + 0xd5b88683,0xd1799b34,0xdc3abded,0xd8fba05a, + 0x690ce0ee,0x6dcdfd59,0x608edb80,0x644fc637, + 0x7a089632,0x7ec98b85,0x738aad5c,0x774bb0eb, + 0x4f040d56,0x4bc510e1,0x46863638,0x42472b8f, + 0x5c007b8a,0x58c1663d,0x558240e4,0x51435d53, + 0x251d3b9e,0x21dc2629,0x2c9f00f0,0x285e1d47, + 0x36194d42,0x32d850f5,0x3f9b762c,0x3b5a6b9b, + 0x0315d626,0x07d4cb91,0x0a97ed48,0x0e56f0ff, + 0x1011a0fa,0x14d0bd4d,0x19939b94,0x1d528623, + 0xf12f560e,0xf5ee4bb9,0xf8ad6d60,0xfc6c70d7, + 0xe22b20d2,0xe6ea3d65,0xeba91bbc,0xef68060b, + 0xd727bbb6,0xd3e6a601,0xdea580d8,0xda649d6f, + 0xc423cd6a,0xc0e2d0dd,0xcda1f604,0xc960ebb3, + 0xbd3e8d7e,0xb9ff90c9,0xb4bcb610,0xb07daba7, + 0xae3afba2,0xaafbe615,0xa7b8c0cc,0xa379dd7b, + 0x9b3660c6,0x9ff77d71,0x92b45ba8,0x9675461f, + 0x8832161a,0x8cf30bad,0x81b02d74,0x857130c3, + 0x5d8a9099,0x594b8d2e,0x5408abf7,0x50c9b640, + 0x4e8ee645,0x4a4ffbf2,0x470cdd2b,0x43cdc09c, + 0x7b827d21,0x7f436096,0x7200464f,0x76c15bf8, + 0x68860bfd,0x6c47164a,0x61043093,0x65c52d24, + 0x119b4be9,0x155a565e,0x18197087,0x1cd86d30, + 0x029f3d35,0x065e2082,0x0b1d065b,0x0fdc1bec, + 0x3793a651,0x3352bbe6,0x3e119d3f,0x3ad08088, + 0x2497d08d,0x2056cd3a,0x2d15ebe3,0x29d4f654, + 0xc5a92679,0xc1683bce,0xcc2b1d17,0xc8ea00a0, + 0xd6ad50a5,0xd26c4d12,0xdf2f6bcb,0xdbee767c, + 0xe3a1cbc1,0xe760d676,0xea23f0af,0xeee2ed18, + 0xf0a5bd1d,0xf464a0aa,0xf9278673,0xfde69bc4, + 0x89b8fd09,0x8d79e0be,0x803ac667,0x84fbdbd0, + 0x9abc8bd5,0x9e7d9662,0x933eb0bb,0x97ffad0c, + 0xafb010b1,0xab710d06,0xa6322bdf,0xa2f33668, + 0xbcb4666d,0xb8757bda,0xb5365d03,0xb1f740b4}; + +/* init the encode/decode logical stream state */ + +int ogg_stream_init(ogg_stream_state *os,int serialno){ + if(os){ + memset(os,0,sizeof(*os)); + os->body_storage=16*1024; + os->body_data=_ogg_malloc(os->body_storage*sizeof(*os->body_data)); + + os->lacing_storage=1024; + os->lacing_vals=_ogg_malloc(os->lacing_storage*sizeof(*os->lacing_vals)); + os->granule_vals=_ogg_malloc(os->lacing_storage*sizeof(*os->granule_vals)); + + os->serialno=serialno; + + return(0); + } + return(-1); +} + +/* _clear does not free os, only the non-flat storage within */ +int ogg_stream_clear(ogg_stream_state *os){ + if(os){ + if(os->body_data)_ogg_free(os->body_data); + if(os->lacing_vals)_ogg_free(os->lacing_vals); + if(os->granule_vals)_ogg_free(os->granule_vals); + + memset(os,0,sizeof(*os)); + } + return(0); +} + +int ogg_stream_destroy(ogg_stream_state *os){ + if(os){ + ogg_stream_clear(os); + _ogg_free(os); + } + return(0); +} + +/* Helpers for ogg_stream_encode; this keeps the structure and + what's happening fairly clear */ + +static void _os_body_expand(ogg_stream_state *os,int needed){ + if(os->body_storage<=os->body_fill+needed){ + os->body_storage+=(needed+1024); + os->body_data=_ogg_realloc(os->body_data,os->body_storage*sizeof(*os->body_data)); + } +} + +static void _os_lacing_expand(ogg_stream_state *os,int needed){ + if(os->lacing_storage<=os->lacing_fill+needed){ + os->lacing_storage+=(needed+32); + os->lacing_vals=_ogg_realloc(os->lacing_vals,os->lacing_storage*sizeof(*os->lacing_vals)); + os->granule_vals=_ogg_realloc(os->granule_vals,os->lacing_storage*sizeof(*os->granule_vals)); + } +} + +/* checksum the page */ +/* Direct table CRC; note that this will be faster in the future if we + perform the checksum silmultaneously with other copies */ + +void ogg_page_checksum_set(ogg_page *og){ + if(og){ + ogg_uint32_t crc_reg=0; + int i; + + /* safety; needed for API behavior, but not framing code */ + og->header[22]=0; + og->header[23]=0; + og->header[24]=0; + og->header[25]=0; + + for(i=0;iheader_len;i++) + crc_reg=(crc_reg<<8)^crc_lookup[((crc_reg >> 24)&0xff)^og->header[i]]; + for(i=0;ibody_len;i++) + crc_reg=(crc_reg<<8)^crc_lookup[((crc_reg >> 24)&0xff)^og->body[i]]; + + og->header[22]=(unsigned char)(crc_reg&0xff); + og->header[23]=(unsigned char)((crc_reg>>8)&0xff); + og->header[24]=(unsigned char)((crc_reg>>16)&0xff); + og->header[25]=(unsigned char)((crc_reg>>24)&0xff); + } +} + +/* submit data to the internal buffer of the framing engine */ +int ogg_stream_packetin(ogg_stream_state *os,ogg_packet *op){ + int lacing_vals=op->bytes/255+1,i; + + if(os->body_returned){ + /* advance packet data according to the body_returned pointer. We + had to keep it around to return a pointer into the buffer last + call */ + + os->body_fill-=os->body_returned; + if(os->body_fill) + memmove(os->body_data,os->body_data+os->body_returned, + os->body_fill); + os->body_returned=0; + } + + /* make sure we have the buffer storage */ + _os_body_expand(os,op->bytes); + _os_lacing_expand(os,lacing_vals); + + /* Copy in the submitted packet. Yes, the copy is a waste; this is + the liability of overly clean abstraction for the time being. It + will actually be fairly easy to eliminate the extra copy in the + future */ + + memcpy(os->body_data+os->body_fill,op->packet,op->bytes); + os->body_fill+=op->bytes; + + /* Store lacing vals for this packet */ + for(i=0;ilacing_vals[os->lacing_fill+i]=255; + os->granule_vals[os->lacing_fill+i]=os->granulepos; + } + os->lacing_vals[os->lacing_fill+i]=(op->bytes)%255; + os->granulepos=os->granule_vals[os->lacing_fill+i]=op->granulepos; + + /* flag the first segment as the beginning of the packet */ + os->lacing_vals[os->lacing_fill]|= 0x100; + + os->lacing_fill+=lacing_vals; + + /* for the sake of completeness */ + os->packetno++; + + if(op->e_o_s)os->e_o_s=1; + + return(0); +} + +/* This will flush remaining packets into a page (returning nonzero), + even if there is not enough data to trigger a flush normally + (undersized page). If there are no packets or partial packets to + flush, ogg_stream_flush returns 0. Note that ogg_stream_flush will + try to flush a normal sized page like ogg_stream_pageout; a call to + ogg_stream_flush does not guarantee that all packets have flushed. + Only a return value of 0 from ogg_stream_flush indicates all packet + data is flushed into pages. + + since ogg_stream_flush will flush the last page in a stream even if + it's undersized, you almost certainly want to use ogg_stream_pageout + (and *not* ogg_stream_flush) unless you specifically need to flush + an page regardless of size in the middle of a stream. */ + +int ogg_stream_flush(ogg_stream_state *os,ogg_page *og){ + int i; + int vals=0; + int maxvals=(os->lacing_fill>255?255:os->lacing_fill); + int bytes=0; + long acc=0; + ogg_int64_t granule_pos=os->granule_vals[0]; + + if(maxvals==0)return(0); + + /* construct a page */ + /* decide how many segments to include */ + + /* If this is the initial header case, the first page must only include + the initial header packet */ + if(os->b_o_s==0){ /* 'initial header page' case */ + granule_pos=0; + for(vals=0;valslacing_vals[vals]&0x0ff)<255){ + vals++; + break; + } + } + }else{ + for(vals=0;vals4096)break; + acc+=os->lacing_vals[vals]&0x0ff; + granule_pos=os->granule_vals[vals]; + } + } + + /* construct the header in temp storage */ + memcpy(os->header,"OggS",4); + + /* stream structure version */ + os->header[4]=0x00; + + /* continued packet flag? */ + os->header[5]=0x00; + if((os->lacing_vals[0]&0x100)==0)os->header[5]|=0x01; + /* first page flag? */ + if(os->b_o_s==0)os->header[5]|=0x02; + /* last page flag? */ + if(os->e_o_s && os->lacing_fill==vals)os->header[5]|=0x04; + os->b_o_s=1; + + /* 64 bits of PCM position */ + for(i=6;i<14;i++){ + os->header[i]=(unsigned char)(granule_pos&0xff); + granule_pos>>=8; + } + + /* 32 bits of stream serial number */ + { + long serialno=os->serialno; + for(i=14;i<18;i++){ + os->header[i]=(unsigned char)(serialno&0xff); + serialno>>=8; + } + } + + /* 32 bits of page counter (we have both counter and page header + because this val can roll over) */ + if(os->pageno==-1)os->pageno=0; /* because someone called + stream_reset; this would be a + strange thing to do in an + encode stream, but it has + plausible uses */ + { + long pageno=os->pageno++; + for(i=18;i<22;i++){ + os->header[i]=(unsigned char)(pageno&0xff); + pageno>>=8; + } + } + + /* zero for computation; filled in later */ + os->header[22]=0; + os->header[23]=0; + os->header[24]=0; + os->header[25]=0; + + /* segment table */ + os->header[26]=(unsigned char)(vals&0xff); + for(i=0;iheader[i+27]=(unsigned char)(os->lacing_vals[i]&0xff); + + /* set pointers in the ogg_page struct */ + og->header=os->header; + og->header_len=os->header_fill=vals+27; + og->body=os->body_data+os->body_returned; + og->body_len=bytes; + + /* advance the lacing data and set the body_returned pointer */ + + os->lacing_fill-=vals; + memmove(os->lacing_vals,os->lacing_vals+vals,os->lacing_fill*sizeof(*os->lacing_vals)); + memmove(os->granule_vals,os->granule_vals+vals,os->lacing_fill*sizeof(*os->granule_vals)); + os->body_returned+=bytes; + + /* calculate the checksum */ + + ogg_page_checksum_set(og); + + /* done */ + return(1); +} + + +/* This constructs pages from buffered packet segments. The pointers +returned are to static buffers; do not free. The returned buffers are +good only until the next call (using the same ogg_stream_state) */ + +int ogg_stream_pageout(ogg_stream_state *os, ogg_page *og){ + + if((os->e_o_s&&os->lacing_fill) || /* 'were done, now flush' case */ + os->body_fill-os->body_returned > 4096 ||/* 'page nominal size' case */ + os->lacing_fill>=255 || /* 'segment table full' case */ + (os->lacing_fill&&!os->b_o_s)){ /* 'initial header page' case */ + + return(ogg_stream_flush(os,og)); + } + + /* not enough data to construct a page and not end of stream */ + return(0); +} + +int ogg_stream_eos(ogg_stream_state *os){ + return os->e_o_s; +} + +/* DECODING PRIMITIVES: packet streaming layer **********************/ + +/* This has two layers to place more of the multi-serialno and paging + control in the application's hands. First, we expose a data buffer + using ogg_sync_buffer(). The app either copies into the + buffer, or passes it directly to read(), etc. We then call + ogg_sync_wrote() to tell how many bytes we just added. + + Pages are returned (pointers into the buffer in ogg_sync_state) + by ogg_sync_pageout(). The page is then submitted to + ogg_stream_pagein() along with the appropriate + ogg_stream_state* (ie, matching serialno). We then get raw + packets out calling ogg_stream_packetout() with a + ogg_stream_state. See the 'frame-prog.txt' docs for details and + example code. */ + +/* initialize the struct to a known state */ +int ogg_sync_init(ogg_sync_state *oy){ + if(oy){ + memset(oy,0,sizeof(*oy)); + } + return(0); +} + +/* clear non-flat storage within */ +int ogg_sync_clear(ogg_sync_state *oy){ + if(oy){ + if(oy->data)_ogg_free(oy->data); + ogg_sync_init(oy); + } + return(0); +} + +int ogg_sync_destroy(ogg_sync_state *oy){ + if(oy){ + ogg_sync_clear(oy); + _ogg_free(oy); + } + return(0); +} + +char *ogg_sync_buffer(ogg_sync_state *oy, long size){ + + /* first, clear out any space that has been previously returned */ + if(oy->returned){ + oy->fill-=oy->returned; + if(oy->fill>0) + memmove(oy->data,oy->data+oy->returned,oy->fill); + oy->returned=0; + } + + if(size>oy->storage-oy->fill){ + /* We need to extend the internal buffer */ + long newsize=size+oy->fill+4096; /* an extra page to be nice */ + + if(oy->data) + oy->data=_ogg_realloc(oy->data,newsize); + else + oy->data=_ogg_malloc(newsize); + oy->storage=newsize; + } + + /* expose a segment at least as large as requested at the fill mark */ + return((char *)oy->data+oy->fill); +} + +int ogg_sync_wrote(ogg_sync_state *oy, long bytes){ + if(oy->fill+bytes>oy->storage)return(-1); + oy->fill+=bytes; + return(0); +} + +/* sync the stream. This is meant to be useful for finding page + boundaries. + + return values for this: + -n) skipped n bytes + 0) page not ready; more data (no bytes skipped) + n) page synced at current location; page length n bytes + +*/ + +long ogg_sync_pageseek(ogg_sync_state *oy,ogg_page *og){ + unsigned char *page=oy->data+oy->returned; + unsigned char *next; + long bytes=oy->fill-oy->returned; + + if(oy->headerbytes==0){ + int headerbytes,i; + if(bytes<27)return(0); /* not enough for a header */ + + /* verify capture pattern */ + if(memcmp(page,"OggS",4))goto sync_fail; + + headerbytes=page[26]+27; + if(bytesbodybytes+=page[27+i]; + oy->headerbytes=headerbytes; + } + + if(oy->bodybytes+oy->headerbytes>bytes)return(0); + + /* The whole test page is buffered. Verify the checksum */ + { + /* Grab the checksum bytes, set the header field to zero */ + char chksum[4]; + ogg_page log; + + memcpy(chksum,page+22,4); + memset(page+22,0,4); + + /* set up a temp page struct and recompute the checksum */ + log.header=page; + log.header_len=oy->headerbytes; + log.body=page+oy->headerbytes; + log.body_len=oy->bodybytes; + ogg_page_checksum_set(&log); + + /* Compare */ + if(memcmp(chksum,page+22,4)){ + /* D'oh. Mismatch! Corrupt page (or miscapture and not a page + at all) */ + /* replace the computed checksum with the one actually read in */ + memcpy(page+22,chksum,4); + + /* Bad checksum. Lose sync */ + goto sync_fail; + } + } + + /* yes, have a whole page all ready to go */ + { + unsigned char *page=oy->data+oy->returned; + long bytes; + + if(og){ + og->header=page; + og->header_len=oy->headerbytes; + og->body=page+oy->headerbytes; + og->body_len=oy->bodybytes; + } + + oy->unsynced=0; + oy->returned+=(bytes=oy->headerbytes+oy->bodybytes); + oy->headerbytes=0; + oy->bodybytes=0; + return(bytes); + } + + sync_fail: + + oy->headerbytes=0; + oy->bodybytes=0; + + /* search for possible capture */ + next=memchr(page+1,'O',bytes-1); + if(!next) + next=oy->data+oy->fill; + + oy->returned=next-oy->data; + return(-(next-page)); +} + +/* sync the stream and get a page. Keep trying until we find a page. + Supress 'sync errors' after reporting the first. + + return values: + -1) recapture (hole in data) + 0) need more data + 1) page returned + + Returns pointers into buffered data; invalidated by next call to + _stream, _clear, _init, or _buffer */ + +int ogg_sync_pageout(ogg_sync_state *oy, ogg_page *og){ + + /* all we need to do is verify a page at the head of the stream + buffer. If it doesn't verify, we look for the next potential + frame */ + + for(;;){ + long ret=ogg_sync_pageseek(oy,og); + if(ret>0){ + /* have a page */ + return(1); + } + if(ret==0){ + /* need more data */ + return(0); + } + + /* head did not start a synced page... skipped some bytes */ + if(!oy->unsynced){ + oy->unsynced=1; + return(-1); + } + + /* loop. keep looking */ + + } +} + +/* add the incoming page to the stream state; we decompose the page + into packet segments here as well. */ + +int ogg_stream_pagein(ogg_stream_state *os, ogg_page *og){ + unsigned char *header=og->header; + unsigned char *body=og->body; + long bodysize=og->body_len; + int segptr=0; + + int version=ogg_page_version(og); + int continued=ogg_page_continued(og); + int bos=ogg_page_bos(og); + int eos=ogg_page_eos(og); + ogg_int64_t granulepos=ogg_page_granulepos(og); + int serialno=ogg_page_serialno(og); + long pageno=ogg_page_pageno(og); + int segments=header[26]; + + /* clean up 'returned data' */ + { + long lr=os->lacing_returned; + long br=os->body_returned; + + /* body data */ + if(br){ + os->body_fill-=br; + if(os->body_fill) + memmove(os->body_data,os->body_data+br,os->body_fill); + os->body_returned=0; + } + + if(lr){ + /* segment table */ + if(os->lacing_fill-lr){ + memmove(os->lacing_vals,os->lacing_vals+lr, + (os->lacing_fill-lr)*sizeof(*os->lacing_vals)); + memmove(os->granule_vals,os->granule_vals+lr, + (os->lacing_fill-lr)*sizeof(*os->granule_vals)); + } + os->lacing_fill-=lr; + os->lacing_packet-=lr; + os->lacing_returned=0; + } + } + + /* check the serial number */ + if(serialno!=os->serialno)return(-1); + if(version>0)return(-1); + + _os_lacing_expand(os,segments+1); + + /* are we in sequence? */ + if(pageno!=os->pageno){ + int i; + + /* unroll previous partial packet (if any) */ + for(i=os->lacing_packet;ilacing_fill;i++) + os->body_fill-=os->lacing_vals[i]&0xff; + os->lacing_fill=os->lacing_packet; + + /* make a note of dropped data in segment table */ + if(os->pageno!=-1){ + os->lacing_vals[os->lacing_fill++]=0x400; + os->lacing_packet++; + } + } + + /* are we a 'continued packet' page? If so, we may need to skip + some segments */ + if(continued){ + if(os->lacing_fill<1 || + os->lacing_vals[os->lacing_fill-1]==0x400){ + bos=0; + for(;segptrbody_data+os->body_fill,body,bodysize); + os->body_fill+=bodysize; + } + + { + int saved=-1; + while(segptrlacing_vals[os->lacing_fill]=val; + os->granule_vals[os->lacing_fill]=-1; + + if(bos){ + os->lacing_vals[os->lacing_fill]|=0x100; + bos=0; + } + + if(val<255)saved=os->lacing_fill; + + os->lacing_fill++; + segptr++; + + if(val<255)os->lacing_packet=os->lacing_fill; + } + + /* set the granulepos on the last granuleval of the last full packet */ + if(saved!=-1){ + os->granule_vals[saved]=granulepos; + } + + } + + if(eos){ + os->e_o_s=1; + if(os->lacing_fill>0) + os->lacing_vals[os->lacing_fill-1]|=0x200; + } + + os->pageno=pageno+1; + + return(0); +} + +/* clear things to an initial state. Good to call, eg, before seeking */ +int ogg_sync_reset(ogg_sync_state *oy){ + oy->fill=0; + oy->returned=0; + oy->unsynced=0; + oy->headerbytes=0; + oy->bodybytes=0; + return(0); +} + +int ogg_stream_reset(ogg_stream_state *os){ + os->body_fill=0; + os->body_returned=0; + + os->lacing_fill=0; + os->lacing_packet=0; + os->lacing_returned=0; + + os->header_fill=0; + + os->e_o_s=0; + os->b_o_s=0; + os->pageno=-1; + os->packetno=0; + os->granulepos=0; + + return(0); +} + +int ogg_stream_reset_serialno(ogg_stream_state *os,int serialno){ + ogg_stream_reset(os); + os->serialno=serialno; + return(0); +} + +static int _packetout(ogg_stream_state *os,ogg_packet *op,int adv){ + + /* The last part of decode. We have the stream broken into packet + segments. Now we need to group them into packets (or return the + out of sync markers) */ + + int ptr=os->lacing_returned; + + if(os->lacing_packet<=ptr)return(0); + + if(os->lacing_vals[ptr]&0x400){ + /* we need to tell the codec there's a gap; it might need to + handle previous packet dependencies. */ + os->lacing_returned++; + os->packetno++; + return(-1); + } + + if(!op && !adv)return(1); /* just using peek as an inexpensive way + to ask if there's a whole packet + waiting */ + + /* Gather the whole packet. We'll have no holes or a partial packet */ + { + int size=os->lacing_vals[ptr]&0xff; + int bytes=size; + int eos=os->lacing_vals[ptr]&0x200; /* last packet of the stream? */ + int bos=os->lacing_vals[ptr]&0x100; /* first packet of the stream? */ + + while(size==255){ + int val=os->lacing_vals[++ptr]; + size=val&0xff; + if(val&0x200)eos=0x200; + bytes+=size; + } + + if(op){ + op->e_o_s=eos; + op->b_o_s=bos; + op->packet=os->body_data+os->body_returned; + op->packetno=os->packetno; + op->granulepos=os->granule_vals[ptr]; + op->bytes=bytes; + } + + if(adv){ + os->body_returned+=bytes; + os->lacing_returned=ptr+1; + os->packetno++; + } + } + return(1); +} + +int ogg_stream_packetout(ogg_stream_state *os,ogg_packet *op){ + return _packetout(os,op,1); +} + +int ogg_stream_packetpeek(ogg_stream_state *os,ogg_packet *op){ + return _packetout(os,op,0); +} + +void ogg_packet_clear(ogg_packet *op) { + _ogg_free(op->packet); + memset(op, 0, sizeof(*op)); +} + +#ifdef _V_SELFTEST +#include + +ogg_stream_state os_en, os_de; +ogg_sync_state oy; + +void checkpacket(ogg_packet *op,int len, int no, int pos){ + long j; + static int sequence=0; + static int lastno=0; + + if(op->bytes!=len){ + fprintf(stderr,"incorrect packet length!\n"); + exit(1); + } + if(op->granulepos!=pos){ + fprintf(stderr,"incorrect packet position!\n"); + exit(1); + } + + /* packet number just follows sequence/gap; adjust the input number + for that */ + if(no==0){ + sequence=0; + }else{ + sequence++; + if(no>lastno+1) + sequence++; + } + lastno=no; + if(op->packetno!=sequence){ + fprintf(stderr,"incorrect packet sequence %ld != %d\n", + (long)(op->packetno),sequence); + exit(1); + } + + /* Test data */ + for(j=0;jbytes;j++) + if(op->packet[j]!=((j+no)&0xff)){ + fprintf(stderr,"body data mismatch (1) at pos %ld: %x!=%lx!\n\n", + j,op->packet[j],(j+no)&0xff); + exit(1); + } +} + +void check_page(unsigned char *data,const int *header,ogg_page *og){ + long j; + /* Test data */ + for(j=0;jbody_len;j++) + if(og->body[j]!=data[j]){ + fprintf(stderr,"body data mismatch (2) at pos %ld: %x!=%x!\n\n", + j,data[j],og->body[j]); + exit(1); + } + + /* Test header */ + for(j=0;jheader_len;j++){ + if(og->header[j]!=header[j]){ + fprintf(stderr,"header content mismatch at pos %ld:\n",j); + for(j=0;jheader[j]); + fprintf(stderr,"\n"); + exit(1); + } + } + if(og->header_len!=header[26]+27){ + fprintf(stderr,"header length incorrect! (%ld!=%d)\n", + og->header_len,header[26]+27); + exit(1); + } +} + +void print_header(ogg_page *og){ + int j; + fprintf(stderr,"\nHEADER:\n"); + fprintf(stderr," capture: %c %c %c %c version: %d flags: %x\n", + og->header[0],og->header[1],og->header[2],og->header[3], + (int)og->header[4],(int)og->header[5]); + + fprintf(stderr," granulepos: %d serialno: %d pageno: %ld\n", + (og->header[9]<<24)|(og->header[8]<<16)| + (og->header[7]<<8)|og->header[6], + (og->header[17]<<24)|(og->header[16]<<16)| + (og->header[15]<<8)|og->header[14], + ((long)(og->header[21])<<24)|(og->header[20]<<16)| + (og->header[19]<<8)|og->header[18]); + + fprintf(stderr," checksum: %02x:%02x:%02x:%02x\n segments: %d (", + (int)og->header[22],(int)og->header[23], + (int)og->header[24],(int)og->header[25], + (int)og->header[26]); + + for(j=27;jheader_len;j++) + fprintf(stderr,"%d ",(int)og->header[j]); + fprintf(stderr,")\n\n"); +} + +void copy_page(ogg_page *og){ + unsigned char *temp=_ogg_malloc(og->header_len); + memcpy(temp,og->header,og->header_len); + og->header=temp; + + temp=_ogg_malloc(og->body_len); + memcpy(temp,og->body,og->body_len); + og->body=temp; +} + +void free_page(ogg_page *og){ + _ogg_free (og->header); + _ogg_free (og->body); +} + +void error(void){ + fprintf(stderr,"error!\n"); + exit(1); +} + +/* 17 only */ +const int head1_0[] = {0x4f,0x67,0x67,0x53,0,0x06, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x01,0x02,0x03,0x04,0,0,0,0, + 0x15,0xed,0xec,0x91, + 1, + 17}; + +/* 17, 254, 255, 256, 500, 510, 600 byte, pad */ +const int head1_1[] = {0x4f,0x67,0x67,0x53,0,0x02, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x01,0x02,0x03,0x04,0,0,0,0, + 0x59,0x10,0x6c,0x2c, + 1, + 17}; +const int head2_1[] = {0x4f,0x67,0x67,0x53,0,0x04, + 0x07,0x18,0x00,0x00,0x00,0x00,0x00,0x00, + 0x01,0x02,0x03,0x04,1,0,0,0, + 0x89,0x33,0x85,0xce, + 13, + 254,255,0,255,1,255,245,255,255,0, + 255,255,90}; + +/* nil packets; beginning,middle,end */ +const int head1_2[] = {0x4f,0x67,0x67,0x53,0,0x02, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x01,0x02,0x03,0x04,0,0,0,0, + 0xff,0x7b,0x23,0x17, + 1, + 0}; +const int head2_2[] = {0x4f,0x67,0x67,0x53,0,0x04, + 0x07,0x28,0x00,0x00,0x00,0x00,0x00,0x00, + 0x01,0x02,0x03,0x04,1,0,0,0, + 0x5c,0x3f,0x66,0xcb, + 17, + 17,254,255,0,0,255,1,0,255,245,255,255,0, + 255,255,90,0}; + +/* large initial packet */ +const int head1_3[] = {0x4f,0x67,0x67,0x53,0,0x02, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x01,0x02,0x03,0x04,0,0,0,0, + 0x01,0x27,0x31,0xaa, + 18, + 255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,10}; + +const int head2_3[] = {0x4f,0x67,0x67,0x53,0,0x04, + 0x07,0x08,0x00,0x00,0x00,0x00,0x00,0x00, + 0x01,0x02,0x03,0x04,1,0,0,0, + 0x7f,0x4e,0x8a,0xd2, + 4, + 255,4,255,0}; + + +/* continuing packet test */ +const int head1_4[] = {0x4f,0x67,0x67,0x53,0,0x02, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x01,0x02,0x03,0x04,0,0,0,0, + 0xff,0x7b,0x23,0x17, + 1, + 0}; + +const int head2_4[] = {0x4f,0x67,0x67,0x53,0,0x00, + 0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x01,0x02,0x03,0x04,1,0,0,0, + 0x34,0x24,0xd5,0x29, + 17, + 255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255}; + +const int head3_4[] = {0x4f,0x67,0x67,0x53,0,0x05, + 0x07,0x0c,0x00,0x00,0x00,0x00,0x00,0x00, + 0x01,0x02,0x03,0x04,2,0,0,0, + 0xc8,0xc3,0xcb,0xed, + 5, + 10,255,4,255,0}; + + +/* page with the 255 segment limit */ +const int head1_5[] = {0x4f,0x67,0x67,0x53,0,0x02, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x01,0x02,0x03,0x04,0,0,0,0, + 0xff,0x7b,0x23,0x17, + 1, + 0}; + +const int head2_5[] = {0x4f,0x67,0x67,0x53,0,0x00, + 0x07,0xfc,0x03,0x00,0x00,0x00,0x00,0x00, + 0x01,0x02,0x03,0x04,1,0,0,0, + 0xed,0x2a,0x2e,0xa7, + 255, + 10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10}; + +const int head3_5[] = {0x4f,0x67,0x67,0x53,0,0x04, + 0x07,0x00,0x04,0x00,0x00,0x00,0x00,0x00, + 0x01,0x02,0x03,0x04,2,0,0,0, + 0x6c,0x3b,0x82,0x3d, + 1, + 50}; + + +/* packet that overspans over an entire page */ +const int head1_6[] = {0x4f,0x67,0x67,0x53,0,0x02, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x01,0x02,0x03,0x04,0,0,0,0, + 0xff,0x7b,0x23,0x17, + 1, + 0}; + +const int head2_6[] = {0x4f,0x67,0x67,0x53,0,0x00, + 0x07,0x04,0x00,0x00,0x00,0x00,0x00,0x00, + 0x01,0x02,0x03,0x04,1,0,0,0, + 0x3c,0xd9,0x4d,0x3f, + 17, + 100,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255}; + +const int head3_6[] = {0x4f,0x67,0x67,0x53,0,0x01, + 0x07,0x04,0x00,0x00,0x00,0x00,0x00,0x00, + 0x01,0x02,0x03,0x04,2,0,0,0, + 0xbd,0xd5,0xb5,0x8b, + 17, + 255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255}; + +const int head4_6[] = {0x4f,0x67,0x67,0x53,0,0x05, + 0x07,0x10,0x00,0x00,0x00,0x00,0x00,0x00, + 0x01,0x02,0x03,0x04,3,0,0,0, + 0xef,0xdd,0x88,0xde, + 7, + 255,255,75,255,4,255,0}; + +/* packet that overspans over an entire page */ +const int head1_7[] = {0x4f,0x67,0x67,0x53,0,0x02, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x01,0x02,0x03,0x04,0,0,0,0, + 0xff,0x7b,0x23,0x17, + 1, + 0}; + +const int head2_7[] = {0x4f,0x67,0x67,0x53,0,0x00, + 0x07,0x04,0x00,0x00,0x00,0x00,0x00,0x00, + 0x01,0x02,0x03,0x04,1,0,0,0, + 0x3c,0xd9,0x4d,0x3f, + 17, + 100,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255}; + +const int head3_7[] = {0x4f,0x67,0x67,0x53,0,0x05, + 0x07,0x08,0x00,0x00,0x00,0x00,0x00,0x00, + 0x01,0x02,0x03,0x04,2,0,0,0, + 0xd4,0xe0,0x60,0xe5, + 1,0}; + +void test_pack(const int *pl, const int **headers, int byteskip, + int pageskip, int packetskip){ + unsigned char *data=_ogg_malloc(1024*1024); /* for scripted test cases only */ + long inptr=0; + long outptr=0; + long deptr=0; + long depacket=0; + long granule_pos=7,pageno=0; + int i,j,packets,pageout=pageskip; + int eosflag=0; + int bosflag=0; + + int byteskipcount=0; + + ogg_stream_reset(&os_en); + ogg_stream_reset(&os_de); + ogg_sync_reset(&oy); + + for(packets=0;packetsbyteskip){ + memcpy(next,og.header,byteskipcount-byteskip); + next+=byteskipcount-byteskip; + byteskipcount=byteskip; + } + + byteskipcount+=og.body_len; + if(byteskipcount>byteskip){ + memcpy(next,og.body,byteskipcount-byteskip); + next+=byteskipcount-byteskip; + byteskipcount=byteskip; + } + + ogg_sync_wrote(&oy,next-buf); + + while(1){ + int ret=ogg_sync_pageout(&oy,&og_de); + if(ret==0)break; + if(ret<0)continue; + /* got a page. Happy happy. Verify that it's good. */ + + fprintf(stderr,"(%ld), ",pageout); + + check_page(data+deptr,headers[pageout],&og_de); + deptr+=og_de.body_len; + pageout++; + + /* submit it to deconstitution */ + ogg_stream_pagein(&os_de,&og_de); + + /* packets out? */ + while(ogg_stream_packetpeek(&os_de,&op_de2)>0){ + ogg_stream_packetpeek(&os_de,NULL); + ogg_stream_packetout(&os_de,&op_de); /* just catching them all */ + + /* verify peek and out match */ + if(memcmp(&op_de,&op_de2,sizeof(op_de))){ + fprintf(stderr,"packetout != packetpeek! pos=%ld\n", + depacket); + exit(1); + } + + /* verify the packet! */ + /* check data */ + if(memcmp(data+depacket,op_de.packet,op_de.bytes)){ + fprintf(stderr,"packet data mismatch in decode! pos=%ld\n", + depacket); + exit(1); + } + /* check bos flag */ + if(bosflag==0 && op_de.b_o_s==0){ + fprintf(stderr,"b_o_s flag not set on packet!\n"); + exit(1); + } + if(bosflag && op_de.b_o_s){ + fprintf(stderr,"b_o_s flag incorrectly set on packet!\n"); + exit(1); + } + bosflag=1; + depacket+=op_de.bytes; + + /* check eos flag */ + if(eosflag){ + fprintf(stderr,"Multiple decoded packets with eos flag!\n"); + exit(1); + } + + if(op_de.e_o_s)eosflag=1; + + /* check granulepos flag */ + if(op_de.granulepos!=-1){ + fprintf(stderr," granule:%ld ",(long)op_de.granulepos); + } + } + } + } + } + } + } + _ogg_free(data); + if(headers[pageno]!=NULL){ + fprintf(stderr,"did not write last page!\n"); + exit(1); + } + if(headers[pageout]!=NULL){ + fprintf(stderr,"did not decode last page!\n"); + exit(1); + } + if(inptr!=outptr){ + fprintf(stderr,"encoded page data incomplete!\n"); + exit(1); + } + if(inptr!=deptr){ + fprintf(stderr,"decoded page data incomplete!\n"); + exit(1); + } + if(inptr!=depacket){ + fprintf(stderr,"decoded packet data incomplete!\n"); + exit(1); + } + if(!eosflag){ + fprintf(stderr,"Never got a packet with EOS set!\n"); + exit(1); + } + fprintf(stderr,"ok.\n"); +} + +int main(void){ + + ogg_stream_init(&os_en,0x04030201); + ogg_stream_init(&os_de,0x04030201); + ogg_sync_init(&oy); + + /* Exercise each code path in the framing code. Also verify that + the checksums are working. */ + + { + /* 17 only */ + const int packets[]={17, -1}; + const int *headret[]={head1_0,NULL}; + + fprintf(stderr,"testing single page encoding... "); + test_pack(packets,headret,0,0,0); + } + + { + /* 17, 254, 255, 256, 500, 510, 600 byte, pad */ + const int packets[]={17, 254, 255, 256, 500, 510, 600, -1}; + const int *headret[]={head1_1,head2_1,NULL}; + + fprintf(stderr,"testing basic page encoding... "); + test_pack(packets,headret,0,0,0); + } + + { + /* nil packets; beginning,middle,end */ + const int packets[]={0,17, 254, 255, 0, 256, 0, 500, 510, 600, 0, -1}; + const int *headret[]={head1_2,head2_2,NULL}; + + fprintf(stderr,"testing basic nil packets... "); + test_pack(packets,headret,0,0,0); + } + + { + /* large initial packet */ + const int packets[]={4345,259,255,-1}; + const int *headret[]={head1_3,head2_3,NULL}; + + fprintf(stderr,"testing initial-packet lacing > 4k... "); + test_pack(packets,headret,0,0,0); + } + + { + /* continuing packet test */ + const int packets[]={0,4345,259,255,-1}; + const int *headret[]={head1_4,head2_4,head3_4,NULL}; + + fprintf(stderr,"testing single packet page span... "); + test_pack(packets,headret,0,0,0); + } + + /* page with the 255 segment limit */ + { + + const int packets[]={0,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,50,-1}; + const int *headret[]={head1_5,head2_5,head3_5,NULL}; + + fprintf(stderr,"testing max packet segments... "); + test_pack(packets,headret,0,0,0); + } + + { + /* packet that overspans over an entire page */ + const int packets[]={0,100,9000,259,255,-1}; + const int *headret[]={head1_6,head2_6,head3_6,head4_6,NULL}; + + fprintf(stderr,"testing very large packets... "); + test_pack(packets,headret,0,0,0); + } + + { + /* test for the libogg 1.1.1 resync in large continuation bug + found by Josh Coalson) */ + const int packets[]={0,100,9000,259,255,-1}; + const int *headret[]={head1_6,head2_6,head3_6,head4_6,NULL}; + + fprintf(stderr,"testing continuation resync in very large packets... "); + test_pack(packets,headret,100,2,3); + } + + { + /* term only page. why not? */ + const int packets[]={0,100,4080,-1}; + const int *headret[]={head1_7,head2_7,head3_7,NULL}; + + fprintf(stderr,"testing zero data page (1 nil packet)... "); + test_pack(packets,headret,0,0,0); + } + + + + { + /* build a bunch of pages for testing */ + unsigned char *data=_ogg_malloc(1024*1024); + int pl[]={0,100,4079,2956,2057,76,34,912,0,234,1000,1000,1000,300,-1}; + int inptr=0,i,j; + ogg_page og[5]; + + ogg_stream_reset(&os_en); + + for(i=0;pl[i]!=-1;i++){ + ogg_packet op; + int len=pl[i]; + + op.packet=data+inptr; + op.bytes=len; + op.e_o_s=(pl[i+1]<0?1:0); + op.granulepos=(i+1)*1000; + + for(j=0;j0)error(); + + /* Test fractional page inputs: incomplete fixed header */ + memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header+3, + 20); + ogg_sync_wrote(&oy,20); + if(ogg_sync_pageout(&oy,&og_de)>0)error(); + + /* Test fractional page inputs: incomplete header */ + memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header+23, + 5); + ogg_sync_wrote(&oy,5); + if(ogg_sync_pageout(&oy,&og_de)>0)error(); + + /* Test fractional page inputs: incomplete body */ + + memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header+28, + og[1].header_len-28); + ogg_sync_wrote(&oy,og[1].header_len-28); + if(ogg_sync_pageout(&oy,&og_de)>0)error(); + + memcpy(ogg_sync_buffer(&oy,og[1].body_len),og[1].body,1000); + ogg_sync_wrote(&oy,1000); + if(ogg_sync_pageout(&oy,&og_de)>0)error(); + + memcpy(ogg_sync_buffer(&oy,og[1].body_len),og[1].body+1000, + og[1].body_len-1000); + ogg_sync_wrote(&oy,og[1].body_len-1000); + if(ogg_sync_pageout(&oy,&og_de)<=0)error(); + + fprintf(stderr,"ok.\n"); + } + + /* Test fractional page inputs: page + incomplete capture */ + { + ogg_page og_de; + fprintf(stderr,"Testing sync on 1+partial inputs... "); + ogg_sync_reset(&oy); + + memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header, + og[1].header_len); + ogg_sync_wrote(&oy,og[1].header_len); + + memcpy(ogg_sync_buffer(&oy,og[1].body_len),og[1].body, + og[1].body_len); + ogg_sync_wrote(&oy,og[1].body_len); + + memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header, + 20); + ogg_sync_wrote(&oy,20); + if(ogg_sync_pageout(&oy,&og_de)<=0)error(); + if(ogg_sync_pageout(&oy,&og_de)>0)error(); + + memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header+20, + og[1].header_len-20); + ogg_sync_wrote(&oy,og[1].header_len-20); + memcpy(ogg_sync_buffer(&oy,og[1].body_len),og[1].body, + og[1].body_len); + ogg_sync_wrote(&oy,og[1].body_len); + if(ogg_sync_pageout(&oy,&og_de)<=0)error(); + + fprintf(stderr,"ok.\n"); + } + + /* Test recapture: garbage + page */ + { + ogg_page og_de; + fprintf(stderr,"Testing search for capture... "); + ogg_sync_reset(&oy); + + /* 'garbage' */ + memcpy(ogg_sync_buffer(&oy,og[1].body_len),og[1].body, + og[1].body_len); + ogg_sync_wrote(&oy,og[1].body_len); + + memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header, + og[1].header_len); + ogg_sync_wrote(&oy,og[1].header_len); + + memcpy(ogg_sync_buffer(&oy,og[1].body_len),og[1].body, + og[1].body_len); + ogg_sync_wrote(&oy,og[1].body_len); + + memcpy(ogg_sync_buffer(&oy,og[2].header_len),og[2].header, + 20); + ogg_sync_wrote(&oy,20); + if(ogg_sync_pageout(&oy,&og_de)>0)error(); + if(ogg_sync_pageout(&oy,&og_de)<=0)error(); + if(ogg_sync_pageout(&oy,&og_de)>0)error(); + + memcpy(ogg_sync_buffer(&oy,og[2].header_len),og[2].header+20, + og[2].header_len-20); + ogg_sync_wrote(&oy,og[2].header_len-20); + memcpy(ogg_sync_buffer(&oy,og[2].body_len),og[2].body, + og[2].body_len); + ogg_sync_wrote(&oy,og[2].body_len); + if(ogg_sync_pageout(&oy,&og_de)<=0)error(); + + fprintf(stderr,"ok.\n"); + } + + /* Test recapture: page + garbage + page */ + { + ogg_page og_de; + fprintf(stderr,"Testing recapture... "); + ogg_sync_reset(&oy); + + memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header, + og[1].header_len); + ogg_sync_wrote(&oy,og[1].header_len); + + memcpy(ogg_sync_buffer(&oy,og[1].body_len),og[1].body, + og[1].body_len); + ogg_sync_wrote(&oy,og[1].body_len); + + memcpy(ogg_sync_buffer(&oy,og[2].header_len),og[2].header, + og[2].header_len); + ogg_sync_wrote(&oy,og[2].header_len); + + memcpy(ogg_sync_buffer(&oy,og[2].header_len),og[2].header, + og[2].header_len); + ogg_sync_wrote(&oy,og[2].header_len); + + if(ogg_sync_pageout(&oy,&og_de)<=0)error(); + + memcpy(ogg_sync_buffer(&oy,og[2].body_len),og[2].body, + og[2].body_len-5); + ogg_sync_wrote(&oy,og[2].body_len-5); + + memcpy(ogg_sync_buffer(&oy,og[3].header_len),og[3].header, + og[3].header_len); + ogg_sync_wrote(&oy,og[3].header_len); + + memcpy(ogg_sync_buffer(&oy,og[3].body_len),og[3].body, + og[3].body_len); + ogg_sync_wrote(&oy,og[3].body_len); + + if(ogg_sync_pageout(&oy,&og_de)>0)error(); + if(ogg_sync_pageout(&oy,&og_de)<=0)error(); + + fprintf(stderr,"ok.\n"); + } + + /* Free page data that was previously copied */ + { + for(i=0;i<5;i++){ + free_page(&og[i]); + } + } + } + + return(0); +} + +#endif + + + + diff --git a/Libraries/Ogg/Info.plist b/Libraries/Ogg/Info.plist new file mode 100644 index 000000000..b77e4e535 --- /dev/null +++ b/Libraries/Ogg/Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + Ogg + CFBundleIconFile + + CFBundleIdentifier + com.apple.carbonframeworktemplate + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + FMWK + CFBundleSignature + ???? + CFBundleVersion + 1.0 + CFBundleShortVersionString + 1.0 + CSResourcesFileMapped + + + diff --git a/Libraries/Ogg/Ogg.xcode/project.pbxproj b/Libraries/Ogg/Ogg.xcode/project.pbxproj new file mode 100644 index 000000000..a188d3dbe --- /dev/null +++ b/Libraries/Ogg/Ogg.xcode/project.pbxproj @@ -0,0 +1,342 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 39; + objects = { + 034768DDFF38A45A11DB9C8B = { + children = ( + 8D07F2C80486CC7A007CD1D0, + ); + isa = PBXGroup; + name = Products; + refType = 4; + sourceTree = ""; + }; +//030 +//031 +//032 +//033 +//034 +//080 +//081 +//082 +//083 +//084 + 0867D690FE84028FC02AAC07 = { + buildSettings = { + }; + buildStyles = ( + 4F0BB7EC011F40E904CA0E50, + 4F0BB7ED011F40E904CA0E50, + ); + hasScannedForEncodings = 1; + isa = PBXProject; + mainGroup = 0867D691FE84028FC02AAC07; + productRefGroup = 034768DDFF38A45A11DB9C8B; + projectDirPath = ""; + targets = ( + 8D07F2BC0486CC7A007CD1D0, + ); + }; + 0867D691FE84028FC02AAC07 = { + children = ( + 8E975884082DF89C00D18832, + 08FB77ACFE841707C02AAC07, + 089C1665FE841158C02AAC07, + 0867D69AFE84028FC02AAC07, + 034768DDFF38A45A11DB9C8B, + ); + isa = PBXGroup; + name = Ogg; + refType = 4; + sourceTree = ""; + }; + 0867D69AFE84028FC02AAC07 = { + children = ( + 08FB77AAFE841565C02AAC07, + ); + isa = PBXGroup; + name = "External Frameworks and Libraries"; + refType = 4; + sourceTree = ""; + }; + 089C1665FE841158C02AAC07 = { + children = ( + 8D07F2C70486CC7A007CD1D0, + 089C1666FE841158C02AAC07, + ); + isa = PBXGroup; + name = Resources; + refType = 4; + sourceTree = ""; + }; + 089C1666FE841158C02AAC07 = { + children = ( + 089C1667FE841158C02AAC07, + ); + isa = PBXVariantGroup; + name = InfoPlist.strings; + refType = 4; + sourceTree = ""; + }; + 089C1667FE841158C02AAC07 = { + fileEncoding = 10; + isa = PBXFileReference; + lastKnownFileType = text.plist.strings; + name = English; + path = English.lproj/InfoPlist.strings; + refType = 4; + sourceTree = ""; + }; + 08FB77AAFE841565C02AAC07 = { + isa = PBXFileReference; + lastKnownFileType = wrapper.framework; + name = Carbon.framework; + path = /System/Library/Frameworks/Carbon.framework; + refType = 0; + sourceTree = ""; + }; + 08FB77ACFE841707C02AAC07 = { + children = ( + 8E97588C082DF8BF00D18832, + 8E97588D082DF8BF00D18832, + ); + isa = PBXGroup; + name = Source; + refType = 4; + sourceTree = ""; + }; +//080 +//081 +//082 +//083 +//084 +//4F0 +//4F1 +//4F2 +//4F3 +//4F4 + 4F0BB7EC011F40E904CA0E50 = { + buildSettings = { + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_GENERATE_DEBUGGING_SYMBOLS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + ZERO_LINK = YES; + }; + isa = PBXBuildStyle; + name = Development; + }; + 4F0BB7ED011F40E904CA0E50 = { + buildSettings = { + COPY_PHASE_STRIP = YES; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + ZERO_LINK = NO; + }; + isa = PBXBuildStyle; + name = Deployment; + }; +//4F0 +//4F1 +//4F2 +//4F3 +//4F4 +//8D0 +//8D1 +//8D2 +//8D3 +//8D4 + 8D07F2BC0486CC7A007CD1D0 = { + buildPhases = ( + 8D07F2BD0486CC7A007CD1D0, + 8D07F2BF0486CC7A007CD1D0, + 8D07F2C10486CC7A007CD1D0, + 8D07F2C30486CC7A007CD1D0, + 8D07F2C50486CC7A007CD1D0, + ); + buildRules = ( + ); + buildSettings = { + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + FRAMEWORK_VERSION = A; + GCC_GENERATE_DEBUGGING_SYMBOLS = NO; + GCC_PRECOMPILE_PREFIX_HEADER = NO; + GCC_PREFIX_HEADER = ""; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "@executable_path/../Frameworks"; + LIBRARY_STYLE = DYNAMIC; + OTHER_CFLAGS = "-D__MACOSX__"; + PRODUCT_NAME = Ogg; + WRAPPER_EXTENSION = framework; + }; + dependencies = ( + ); + isa = PBXNativeTarget; + name = Ogg; + productInstallPath = "$(HOME)/Library/Frameworks"; + productName = Ogg; + productReference = 8D07F2C80486CC7A007CD1D0; + productType = "com.apple.product-type.framework"; + }; + 8D07F2BD0486CC7A007CD1D0 = { + buildActionMask = 2147483647; + files = ( + 8E97588A082DF8AF00D18832, + 8E97588B082DF8AF00D18832, + ); + isa = PBXHeadersBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 8D07F2BF0486CC7A007CD1D0 = { + buildActionMask = 2147483647; + files = ( + 8D07F2C00486CC7A007CD1D0, + ); + isa = PBXResourcesBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 8D07F2C00486CC7A007CD1D0 = { + fileRef = 089C1666FE841158C02AAC07; + isa = PBXBuildFile; + settings = { + }; + }; + 8D07F2C10486CC7A007CD1D0 = { + buildActionMask = 2147483647; + files = ( + 8E97588E082DF8BF00D18832, + 8E97588F082DF8BF00D18832, + ); + isa = PBXSourcesBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 8D07F2C30486CC7A007CD1D0 = { + buildActionMask = 2147483647; + files = ( + 8D07F2C40486CC7A007CD1D0, + ); + isa = PBXFrameworksBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 8D07F2C40486CC7A007CD1D0 = { + fileRef = 08FB77AAFE841565C02AAC07; + isa = PBXBuildFile; + settings = { + }; + }; + 8D07F2C50486CC7A007CD1D0 = { + buildActionMask = 2147483647; + files = ( + ); + isa = PBXRezBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 8D07F2C70486CC7A007CD1D0 = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = text.plist; + path = Info.plist; + refType = 4; + sourceTree = ""; + }; + 8D07F2C80486CC7A007CD1D0 = { + explicitFileType = wrapper.framework; + includeInIndex = 0; + isa = PBXFileReference; + path = Ogg.framework; + refType = 3; + sourceTree = BUILT_PRODUCTS_DIR; + }; +//8D0 +//8D1 +//8D2 +//8D3 +//8D4 +//8E0 +//8E1 +//8E2 +//8E3 +//8E4 + 8E975884082DF89C00D18832 = { + children = ( + 8E975888082DF8AF00D18832, + 8E975889082DF8AF00D18832, + ); + isa = PBXGroup; + name = Headers; + refType = 4; + sourceTree = ""; + }; + 8E975888082DF8AF00D18832 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = ogg.h; + path = Files/include/ogg/ogg.h; + refType = 4; + sourceTree = ""; + }; + 8E975889082DF8AF00D18832 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = os_types.h; + path = Files/include/ogg/os_types.h; + refType = 4; + sourceTree = ""; + }; + 8E97588A082DF8AF00D18832 = { + fileRef = 8E975888082DF8AF00D18832; + isa = PBXBuildFile; + settings = { + ATTRIBUTES = ( + Public, + ); + }; + }; + 8E97588B082DF8AF00D18832 = { + fileRef = 8E975889082DF8AF00D18832; + isa = PBXBuildFile; + settings = { + ATTRIBUTES = ( + Public, + ); + }; + }; + 8E97588C082DF8BF00D18832 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = bitwise.c; + path = Files/src/bitwise.c; + refType = 4; + sourceTree = ""; + }; + 8E97588D082DF8BF00D18832 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = framing.c; + path = Files/src/framing.c; + refType = 4; + sourceTree = ""; + }; + 8E97588E082DF8BF00D18832 = { + fileRef = 8E97588C082DF8BF00D18832; + isa = PBXBuildFile; + settings = { + }; + }; + 8E97588F082DF8BF00D18832 = { + fileRef = 8E97588D082DF8BF00D18832; + isa = PBXBuildFile; + settings = { + }; + }; + }; + rootObject = 0867D690FE84028FC02AAC07; +} diff --git a/Libraries/Ogg/Ogg.xcode/xugg.mode1 b/Libraries/Ogg/Ogg.xcode/xugg.mode1 new file mode 100644 index 000000000..677793dd6 --- /dev/null +++ b/Libraries/Ogg/Ogg.xcode/xugg.mode1 @@ -0,0 +1,1241 @@ + + + + + ActivePerspectiveName + Project + AllowedModules + + + BundleLoadPath + + MaxInstances + n + Module + PBXSmartGroupTreeModule + Name + Groups and Files Outline View + + + BundleLoadPath + + MaxInstances + n + Module + PBXNavigatorGroup + Name + Editor + + + BundleLoadPath + + MaxInstances + n + Module + XCTaskListModule + Name + Task List + + + BundleLoadPath + + MaxInstances + n + Module + XCDetailModule + Name + File and Smart Group Detail Viewer + + + BundleLoadPath + + MaxInstances + 1 + Module + PBXBuildResultsModule + Name + Detailed Build Results Viewer + + + BundleLoadPath + + MaxInstances + 1 + Module + PBXProjectFindModule + Name + Project Batch Find Tool + + + BundleLoadPath + + MaxInstances + n + Module + PBXRunSessionModule + Name + Run Log + + + BundleLoadPath + + MaxInstances + n + Module + PBXBookmarksModule + Name + Bookmarks Tool + + + BundleLoadPath + + MaxInstances + n + Module + PBXClassBrowserModule + Name + Class Browser + + + BundleLoadPath + + MaxInstances + n + Module + PBXCVSModule + Name + Source Code Control Tool + + + BundleLoadPath + + MaxInstances + n + Module + PBXDebugBreakpointsModule + Name + Debug Breakpoints Tool + + + BundleLoadPath + + MaxInstances + n + Module + XCDockableInspector + Name + Inspector + + + BundleLoadPath + + MaxInstances + n + Module + PBXOpenQuicklyModule + Name + Open Quickly Tool + + + BundleLoadPath + + MaxInstances + 1 + Module + PBXDebugSessionModule + Name + Debugger + + + BundleLoadPath + + MaxInstances + 1 + Module + PBXDebugCLIModule + Name + Debug Console + + + Description + DefaultDescriptionKey + DockingSystemVisible + + Extension + mode1 + FavBarConfig + + PBXProjectModuleGUID + 8E97589C082DF8E900D18832 + XCBarModuleItemNames + + XCBarModuleItems + + + FirstTimeWindowDisplayed + + Identifier + com.apple.perspectives.project.mode1 + MajorVersion + 31 + MinorVersion + 1 + Name + Default + Notifications + + OpenEditors + + PerspectiveWidths + + -1 + -1 + + Perspectives + + + ChosenToolbarItems + + active-target-popup + action + NSToolbarFlexibleSpaceItem + buildOrClean + build-and-runOrDebug + com.apple.ide.PBXToolbarStopButton + get-info + toggle-editor + NSToolbarFlexibleSpaceItem + com.apple.pbx.toolbar.searchfield + + ControllerClassBaseName + + IconName + WindowOfProjectWithEditor + Identifier + perspective.project + IsVertical + + Layout + + + BecomeActive + + ContentConfiguration + + PBXBottomSmartGroupGIDs + + 1C37FBAC04509CD000000102 + 1C37FAAC04509CD000000102 + 1C08E77C0454961000C914BD + 1C37FABC05509CD000000102 + 1C37FABC05539CD112110102 + E2644B35053B69B200211256 + 1C37FABC04509CD000100104 + 1CC0EA4004350EF90044410B + 1CC0EA4004350EF90041110B + + PBXProjectModuleGUID + 1CE0B1FE06471DED0097A5F4 + PBXProjectModuleLabel + Files + PBXProjectStructureProvided + yes + PBXSmartGroupTreeModuleColumnData + + PBXSmartGroupTreeModuleColumnWidthsKey + + 186 + + PBXSmartGroupTreeModuleColumnsKey_v4 + + MainColumn + + + PBXSmartGroupTreeModuleOutlineStateKey_v7 + + PBXSmartGroupTreeModuleOutlineStateExpansionKey + + 0867D691FE84028FC02AAC07 + 8E975884082DF89C00D18832 + 034768DDFF38A45A11DB9C8B + 8D07F2C80486CC7A007CD1D0 + 1C37FBAC04509CD000000102 + 1C37FABC05509CD000000102 + + PBXSmartGroupTreeModuleOutlineStateSelectionKey + + + 2 + 1 + 0 + + + PBXSmartGroupTreeModuleOutlineStateVisibleRectKey + {{0, 0}, {186, 338}} + + PBXTopSmartGroupGIDs + + XCIncludePerspectivesSwitch + + XCSharingToken + com.apple.Xcode.GFSharingToken + + GeometryConfiguration + + Frame + {{0, 0}, {203, 356}} + GroupTreeTableConfiguration + + MainColumn + 186 + + RubberWindowFrame + 167 339 690 397 0 0 1024 746 + + Module + PBXSmartGroupTreeModule + Proportion + 203pt + + + Dock + + + ContentConfiguration + + PBXProjectModuleGUID + 1CE0B20306471E060097A5F4 + PBXProjectModuleLabel + os_types.h + PBXSplitModuleInNavigatorKey + + Split0 + + PBXProjectModuleGUID + 1CE0B20406471E060097A5F4 + PBXProjectModuleLabel + os_types.h + _historyCapacity + 0 + bookmark + 8E5A9074084CB90D00AE6D62 + history + + 8E94DA19084BECEE007F0AEB + 8E94DA1C084BECEE007F0AEB + + prevStack + + 8E94DA1A084BECEE007F0AEB + 8E94DA1B084BECEE007F0AEB + + + SplitCount + 1 + + StatusBarVisibility + + + GeometryConfiguration + + Frame + {{0, 0}, {482, 246}} + RubberWindowFrame + 167 339 690 397 0 0 1024 746 + + Module + PBXNavigatorGroup + Proportion + 246pt + + + ContentConfiguration + + PBXProjectModuleGUID + 1CE0B20506471E060097A5F4 + PBXProjectModuleLabel + Detail + + GeometryConfiguration + + Frame + {{0, 251}, {482, 105}} + RubberWindowFrame + 167 339 690 397 0 0 1024 746 + + Module + XCDetailModule + Proportion + 105pt + + + Proportion + 482pt + + + Name + Project + ServiceClasses + + XCModuleDock + PBXSmartGroupTreeModule + XCModuleDock + PBXNavigatorGroup + XCDetailModule + + TableOfContents + + 8E5A9075084CB90D00AE6D62 + 1CE0B1FE06471DED0097A5F4 + 8E5A9076084CB90D00AE6D62 + 1CE0B20306471E060097A5F4 + 1CE0B20506471E060097A5F4 + + ToolbarConfiguration + xcode.toolbar.config.default + + + ControllerClassBaseName + + IconName + WindowOfProject + Identifier + perspective.morph + IsVertical + 0 + Layout + + + BecomeActive + 1 + ContentConfiguration + + PBXBottomSmartGroupGIDs + + 1C37FBAC04509CD000000102 + 1C37FAAC04509CD000000102 + 1C08E77C0454961000C914BD + 1C37FABC05509CD000000102 + 1C37FABC05539CD112110102 + E2644B35053B69B200211256 + 1C37FABC04509CD000100104 + 1CC0EA4004350EF90044410B + 1CC0EA4004350EF90041110B + + PBXProjectModuleGUID + 11E0B1FE06471DED0097A5F4 + PBXProjectModuleLabel + Files + PBXProjectStructureProvided + yes + PBXSmartGroupTreeModuleColumnData + + PBXSmartGroupTreeModuleColumnWidthsKey + + 186 + + PBXSmartGroupTreeModuleColumnsKey_v4 + + MainColumn + + + PBXSmartGroupTreeModuleOutlineStateKey_v7 + + PBXSmartGroupTreeModuleOutlineStateExpansionKey + + 29B97314FDCFA39411CA2CEA + 1C37FABC05509CD000000102 + + PBXSmartGroupTreeModuleOutlineStateSelectionKey + + + 0 + + + PBXSmartGroupTreeModuleOutlineStateVisibleRectKey + {{0, 0}, {186, 337}} + + PBXTopSmartGroupGIDs + + XCIncludePerspectivesSwitch + 1 + XCSharingToken + com.apple.Xcode.GFSharingToken + + GeometryConfiguration + + Frame + {{0, 0}, {203, 355}} + GroupTreeTableConfiguration + + MainColumn + 186 + + RubberWindowFrame + 373 269 690 397 0 0 1440 878 + + Module + PBXSmartGroupTreeModule + Proportion + 100% + + + Name + Morph + PreferredWidth + 300 + ServiceClasses + + XCModuleDock + PBXSmartGroupTreeModule + + TableOfContents + + 11E0B1FE06471DED0097A5F4 + + ToolbarConfiguration + xcode.toolbar.config.default.short + + + PerspectivesBarVisible + + ShelfIsVisible + + SourceDescription + file at '/System/Library/PrivateFrameworks/DevToolsInterface.framework/Versions/A/Resources/XCPerspectivesSpecificationMode1.xcperspec' + StatusbarIsVisible + + TimeStamp + 0.0 + ToolbarDisplayMode + 1 + ToolbarIsVisible + + ToolbarSizeMode + 1 + Type + Perspectives + UpdateMessage + The Default Workspace in this version of Xcode now includes support to hide and show the detail view (what has been referred to as the "Metro-Morph" feature). You must discard your current Default Workspace settings and update to the latest Default Workspace in order to gain this feature. Do you wish to update to the latest Workspace defaults for project '%@'? + WindowJustification + 5 + WindowOrderList + + /Users/xugg/Projects/Cog/Libraries/Ogg/Ogg.xcode + + WindowString + 167 339 690 397 0 0 1024 746 + WindowTools + + + FirstTimeWindowDisplayed + + Identifier + windowTool.build + IsVertical + + Layout + + + Dock + + + BecomeActive + + ContentConfiguration + + PBXProjectModuleGUID + 1CD0528F0623707200166675 + PBXProjectModuleLabel + bitwise.c + StatusBarVisibility + + + GeometryConfiguration + + Frame + {{0, 0}, {500, 218}} + RubberWindowFrame + 188 213 500 500 0 0 1024 746 + + Module + PBXNavigatorGroup + Proportion + 218pt + + + ContentConfiguration + + PBXProjectModuleGUID + XCMainBuildResultsModuleGUID + PBXProjectModuleLabel + Build + XCBuildResultsTrigger_Collapse + 1021 + XCBuildResultsTrigger_Open + 1011 + + GeometryConfiguration + + Frame + {{0, 223}, {500, 236}} + RubberWindowFrame + 188 213 500 500 0 0 1024 746 + + Module + PBXBuildResultsModule + Proportion + 236pt + + + Proportion + 459pt + + + Name + Build Results + ServiceClasses + + PBXBuildResultsModule + + StatusbarIsVisible + + TableOfContents + + 8E975896082DF8E600D18832 + 8EE4A640082E6CD900415456 + 1CD0528F0623707200166675 + XCMainBuildResultsModuleGUID + + ToolbarConfiguration + xcode.toolbar.config.build + WindowString + 188 213 500 500 0 0 1024 746 + WindowToolGUID + 8E975896082DF8E600D18832 + WindowToolIsVisible + + + + Identifier + windowTool.debugger + Layout + + + Dock + + + ContentConfiguration + + Debugger + + HorizontalSplitView + + _collapsingFrameDimension + 0.0 + _indexOfCollapsedView + 0 + _percentageOfCollapsedView + 0.0 + isCollapsed + yes + sizes + + {{0, 0}, {317, 164}} + {{317, 0}, {377, 164}} + + + VerticalSplitView + + _collapsingFrameDimension + 0.0 + _indexOfCollapsedView + 0 + _percentageOfCollapsedView + 0.0 + isCollapsed + yes + sizes + + {{0, 0}, {694, 164}} + {{0, 164}, {694, 216}} + + + + LauncherConfigVersion + 8 + PBXProjectModuleGUID + 1C162984064C10D400B95A72 + PBXProjectModuleLabel + Debug - GLUTExamples (Underwater) + + GeometryConfiguration + + DebugConsoleDrawerSize + {100, 120} + DebugConsoleVisible + None + DebugConsoleWindowFrame + {{200, 200}, {500, 300}} + DebugSTDIOWindowFrame + {{200, 200}, {500, 300}} + Frame + {{0, 0}, {694, 380}} + RubberWindowFrame + 321 238 694 422 0 0 1440 878 + + Module + PBXDebugSessionModule + Proportion + 100% + + + Proportion + 100% + + + Name + Debugger + ServiceClasses + + PBXDebugSessionModule + + StatusbarIsVisible + 1 + TableOfContents + + 1CD10A99069EF8BA00B06720 + 1C0AD2AB069F1E9B00FABCE6 + 1C162984064C10D400B95A72 + 1C0AD2AC069F1E9B00FABCE6 + + ToolbarConfiguration + xcode.toolbar.config.debug + WindowString + 321 238 694 422 0 0 1440 878 + WindowToolGUID + 1CD10A99069EF8BA00B06720 + WindowToolIsVisible + 0 + + + FirstTimeWindowDisplayed + + Identifier + windowTool.find + IsVertical + + Layout + + + Dock + + + Dock + + + BecomeActive + + ContentConfiguration + + PBXProjectModuleGUID + 1CDD528C0622207200134675 + PBXProjectModuleLabel + os_types.h + StatusBarVisibility + + + GeometryConfiguration + + Frame + {{0, 0}, {781, 212}} + RubberWindowFrame + 188 243 781 470 0 0 1024 746 + + Module + PBXNavigatorGroup + Proportion + 781pt + + + Proportion + 212pt + + + ContentConfiguration + + PBXProjectModuleGUID + 1CD0528E0623707200166675 + PBXProjectModuleLabel + Project Find + + GeometryConfiguration + + Frame + {{0, 217}, {781, 212}} + RubberWindowFrame + 188 243 781 470 0 0 1024 746 + + Module + PBXProjectFindModule + Proportion + 212pt + + + Proportion + 429pt + + + Name + Project Find + ServiceClasses + + PBXProjectFindModule + + StatusbarIsVisible + + TableOfContents + + 1C530D57069F1CE1000CFCEE + 8E94DA15084BECED007F0AEB + 8E94DA16084BECED007F0AEB + 1CDD528C0622207200134675 + 1CD0528E0623707200166675 + + WindowString + 188 243 781 470 0 0 1024 746 + WindowToolGUID + 1C530D57069F1CE1000CFCEE + WindowToolIsVisible + + + + Identifier + MENUSEPARATOR + + + Identifier + windowTool.debuggerConsole + Layout + + + Dock + + + BecomeActive + 1 + ContentConfiguration + + PBXProjectModuleGUID + 1C78EAAC065D492600B07095 + PBXProjectModuleLabel + Debugger Console + + GeometryConfiguration + + Frame + {{0, 0}, {440, 358}} + RubberWindowFrame + 650 41 440 400 0 0 1280 1002 + + Module + PBXDebugCLIModule + Proportion + 358pt + + + Proportion + 358pt + + + Name + Debugger Console + ServiceClasses + + PBXDebugCLIModule + + StatusbarIsVisible + 1 + TableOfContents + + 1C78EAAD065D492600B07095 + 1C78EAAE065D492600B07095 + 1C78EAAC065D492600B07095 + + WindowString + 650 41 440 400 0 0 1280 1002 + + + Identifier + windowTool.run + Layout + + + Dock + + + ContentConfiguration + + LauncherConfigVersion + 3 + PBXProjectModuleGUID + 1CD0528B0623707200166675 + PBXProjectModuleLabel + Run + Runner + + HorizontalSplitView + + _collapsingFrameDimension + 0.0 + _indexOfCollapsedView + 0 + _percentageOfCollapsedView + 0.0 + isCollapsed + yes + sizes + + {{0, 0}, {493, 167}} + {{0, 176}, {493, 267}} + + + VerticalSplitView + + _collapsingFrameDimension + 0.0 + _indexOfCollapsedView + 0 + _percentageOfCollapsedView + 0.0 + isCollapsed + yes + sizes + + {{0, 0}, {405, 443}} + {{414, 0}, {514, 443}} + + + + + GeometryConfiguration + + Frame + {{0, 0}, {460, 159}} + RubberWindowFrame + 316 696 459 200 0 0 1280 1002 + + Module + PBXRunSessionModule + Proportion + 159pt + + + Proportion + 159pt + + + Name + Run Log + ServiceClasses + + PBXRunSessionModule + + StatusbarIsVisible + 1 + TableOfContents + + 1C0AD2B3069F1EA900FABCE6 + 1C0AD2B4069F1EA900FABCE6 + 1CD0528B0623707200166675 + 1C0AD2B5069F1EA900FABCE6 + + ToolbarConfiguration + xcode.toolbar.config.run + WindowString + 316 696 459 200 0 0 1280 1002 + WindowToolGUID + 1C0AD2B3069F1EA900FABCE6 + WindowToolIsVisible + 0 + + + Identifier + windowTool.scm + Layout + + + Dock + + + ContentConfiguration + + PBXProjectModuleGUID + 1C78EAB2065D492600B07095 + PBXProjectModuleLabel + <No Editor> + PBXSplitModuleInNavigatorKey + + Split0 + + PBXProjectModuleGUID + 1C78EAB3065D492600B07095 + + SplitCount + 1 + + StatusBarVisibility + 1 + + GeometryConfiguration + + Frame + {{0, 0}, {452, 0}} + RubberWindowFrame + 743 379 452 308 0 0 1280 1002 + + Module + PBXNavigatorGroup + Proportion + 0pt + + + BecomeActive + 1 + ContentConfiguration + + PBXProjectModuleGUID + 1CD052920623707200166675 + PBXProjectModuleLabel + SCM + + GeometryConfiguration + + ConsoleFrame + {{0, 259}, {452, 0}} + Frame + {{0, 7}, {452, 259}} + RubberWindowFrame + 743 379 452 308 0 0 1280 1002 + TableConfiguration + + Status + 30 + FileName + 199 + Path + 197.09500122070312 + + TableFrame + {{0, 0}, {452, 250}} + + Module + PBXCVSModule + Proportion + 262pt + + + Proportion + 266pt + + + Name + SCM + ServiceClasses + + PBXCVSModule + + StatusbarIsVisible + 1 + TableOfContents + + 1C78EAB4065D492600B07095 + 1C78EAB5065D492600B07095 + 1C78EAB2065D492600B07095 + 1CD052920623707200166675 + + ToolbarConfiguration + xcode.toolbar.config.scm + WindowString + 743 379 452 308 0 0 1280 1002 + + + Identifier + windowTool.breakpoints + Layout + + + Dock + + + BecomeActive + 1 + ContentConfiguration + + PBXProjectModuleGUID + 1CD052930623707200166675 + PBXProjectModuleLabel + Breakpoints + + GeometryConfiguration + + BreakpointsTreeTableConfiguration + + enabledColumn + 16 + breakpointColumn + 201.5830078125 + + Frame + {{0, 0}, {240, 195}} + RubberWindowFrame + 342 421 240 216 0 0 1440 878 + + Module + PBXDebugBreakpointsModule + Proportion + 195pt + + + Proportion + 195pt + + + Name + Breakpoints + ServiceClasses + + PBXDebugBreakpointsModule + + StatusbarIsVisible + 0 + TableOfContents + + 1C0AD2AD069F1E9B00FABCE6 + 1C0AD2AE069F1E9B00FABCE6 + 1CD052930623707200166675 + + WindowString + 342 421 240 216 0 0 1440 878 + WindowToolGUID + 1C0AD2AD069F1E9B00FABCE6 + WindowToolIsVisible + 0 + + + Identifier + windowTool.bookmarks + Layout + + + Dock + + + Module + PBXBookmarksModule + Proportion + 100% + + + Proportion + 100% + + + Name + Bookmarks + ServiceClasses + + PBXBookmarksModule + + StatusbarIsVisible + 0 + WindowString + 538 42 401 187 0 0 1280 1002 + + + Identifier + windowTool.classBrowser + Layout + + + Dock + + + BecomeActive + 1 + ContentConfiguration + + OptionsSetName + Hierarchy, all classes + PBXProjectModuleGUID + 1CA6456E063B45B4001379D8 + PBXProjectModuleLabel + Class Browser - NSObject + + GeometryConfiguration + + ClassesFrame + {{0, 0}, {374, 96}} + ClassesTreeTableConfiguration + + PBXClassNameColumnIdentifier + 208 + PBXClassBookColumnIdentifier + 22 + + Frame + {{0, 0}, {630, 331}} + MembersFrame + {{0, 105}, {374, 395}} + MembersTreeTableConfiguration + + PBXMemberTypeIconColumnIdentifier + 22 + PBXMemberNameColumnIdentifier + 216 + PBXMemberTypeColumnIdentifier + 97 + PBXMemberBookColumnIdentifier + 22 + + PBXModuleWindowStatusBarHidden2 + 1 + RubberWindowFrame + 385 179 630 352 0 0 1440 878 + + Module + PBXClassBrowserModule + Proportion + 332pt + + + Proportion + 332pt + + + Name + Class Browser + ServiceClasses + + PBXClassBrowserModule + + StatusbarIsVisible + 0 + TableOfContents + + 1C0AD2AF069F1E9B00FABCE6 + 1C0AD2B0069F1E9B00FABCE6 + 1CA6456E063B45B4001379D8 + + ToolbarConfiguration + xcode.toolbar.config.classbrowser + WindowString + 385 179 630 352 0 0 1440 878 + WindowToolGUID + 1C0AD2AF069F1E9B00FABCE6 + WindowToolIsVisible + 0 + + + + diff --git a/Libraries/Ogg/Ogg.xcode/xugg.pbxuser b/Libraries/Ogg/Ogg.xcode/xugg.pbxuser new file mode 100644 index 000000000..24541266c --- /dev/null +++ b/Libraries/Ogg/Ogg.xcode/xugg.pbxuser @@ -0,0 +1,169 @@ +// !$*UTF8*$! +{ + 0867D690FE84028FC02AAC07 = { + activeBuildStyle = 4F0BB7ED011F40E904CA0E50; + activeTarget = 8D07F2BC0486CC7A007CD1D0; + addToTargets = ( + 8D07F2BC0486CC7A007CD1D0, + ); + codeSenseManager = 8E975887082DF89C00D18832; + perUserDictionary = { + PBXConfiguration.PBXFileTableDataSource3.PBXExecutablesDataSource = { + PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; + PBXFileTableDataSourceColumnSortingKey = PBXExecutablesDataSource_NameID; + PBXFileTableDataSourceColumnWidthsKey = ( + 22, + 300, + 130.5835, + ); + PBXFileTableDataSourceColumnsKey = ( + PBXExecutablesDataSource_ActiveFlagID, + PBXExecutablesDataSource_NameID, + PBXExecutablesDataSource_CommentsID, + ); + }; + PBXConfiguration.PBXFileTableDataSource3.PBXFileTableDataSource = { + PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; + PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID; + PBXFileTableDataSourceColumnWidthsKey = ( + 20, + 243, + 20, + 48, + 43, + 43, + 20, + ); + PBXFileTableDataSourceColumnsKey = ( + PBXFileDataSource_FiletypeID, + PBXFileDataSource_Filename_ColumnID, + PBXFileDataSource_Built_ColumnID, + PBXFileDataSource_ObjectSize_ColumnID, + PBXFileDataSource_Errors_ColumnID, + PBXFileDataSource_Warnings_ColumnID, + PBXFileDataSource_Target_ColumnID, + ); + }; + PBXConfiguration.PBXTargetDataSource.PBXTargetDataSource = { + PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; + PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID; + PBXFileTableDataSourceColumnWidthsKey = ( + 20, + 200, + 63, + 20, + 48, + 43, + 43, + ); + PBXFileTableDataSourceColumnsKey = ( + PBXFileDataSource_FiletypeID, + PBXFileDataSource_Filename_ColumnID, + PBXTargetDataSource_PrimaryAttribute, + PBXFileDataSource_Built_ColumnID, + PBXFileDataSource_ObjectSize_ColumnID, + PBXFileDataSource_Errors_ColumnID, + PBXFileDataSource_Warnings_ColumnID, + ); + }; + PBXPerProjectTemplateStateSaveDate = 139245817; + PBXWorkspaceStateSaveDate = 139245817; + }; + perUserProjectItems = { + 8E5A9074084CB90D00AE6D62 = 8E5A9074084CB90D00AE6D62; + 8E94DA19084BECEE007F0AEB = 8E94DA19084BECEE007F0AEB; + 8E94DA1A084BECEE007F0AEB = 8E94DA1A084BECEE007F0AEB; + 8E94DA1B084BECEE007F0AEB = 8E94DA1B084BECEE007F0AEB; + 8E94DA1C084BECEE007F0AEB = 8E94DA1C084BECEE007F0AEB; + }; + sourceControlManager = 8E975886082DF89C00D18832; + userBuildSettings = { + }; + }; + 8D07F2BC0486CC7A007CD1D0 = { + activeExec = 0; + }; + 8E5A9074084CB90D00AE6D62 = { + fRef = 8E975889082DF8AF00D18832; + isa = PBXTextBookmark; + name = config_types; + rLen = 12; + rLoc = 4070; + rType = 0; + vrLen = 310; + vrLoc = 3811; + }; + 8E94DA19084BECEE007F0AEB = { + fRef = 8E975888082DF8AF00D18832; + isa = PBXTextBookmark; + name = "ogg.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 937; + vrLoc = 0; + }; + 8E94DA1A084BECEE007F0AEB = { + fRef = 8E975889082DF8AF00D18832; + isa = PBXTextBookmark; + name = __MACOSX__; + rLen = 10; + rLoc = 2776; + rType = 0; + vrLen = 381; + vrLoc = 2667; + }; + 8E94DA1B084BECEE007F0AEB = { + fRef = 8E975888082DF8AF00D18832; + isa = PBXTextBookmark; + name = "ogg.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 937; + vrLoc = 0; + }; + 8E94DA1C084BECEE007F0AEB = { + fRef = 8E975889082DF8AF00D18832; + isa = PBXTextBookmark; + name = config_types; + rLen = 12; + rLoc = 4070; + rType = 0; + vrLen = 309; + vrLoc = 3812; + }; + 8E975886082DF89C00D18832 = { + fallbackIsa = XCSourceControlManager; + isSCMEnabled = 0; + isa = PBXSourceControlManager; + scmConfiguration = { + }; + scmType = ""; + }; + 8E975887082DF89C00D18832 = { + indexTemplatePath = ""; + isa = PBXCodeSenseManager; + }; + 8E975888082DF8AF00D18832 = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {494, 2842}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRect = "{{0, 0}, {441, 214}}"; + }; + }; + 8E975889082DF8AF00D18832 = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {668, 1792}}"; + sepNavSelRange = "{4070, 12}"; + sepNavVisRect = "{{0, 1566}, {441, 214}}"; + }; + }; + 8E97588C082DF8BF00D18832 = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {494, 10990}}"; + sepNavSelRange = "{1115, 21}"; + sepNavVisRect = "{{0, 223}, {459, 186}}"; + }; + }; +} diff --git a/Libraries/SndFile/English.lproj/InfoPlist.strings b/Libraries/SndFile/English.lproj/InfoPlist.strings new file mode 100644 index 0000000000000000000000000000000000000000..32d6c25d66abfe1f317cc623e6b4a1db4533f4c6 GIT binary patch literal 144 zcmW-Z!3u&<5Jk`0uXwn0p&t-#5(FXK^aYU$QE6la_VMZIG0fbVJBRyQDaZ&Mm^gFd z#)U6Eo!&=%GV4r?YETDf<2AVFJR(2y(!EMAk;=?WtcsdFZ|P31r#1hs21+~S7(cc7 J|8L5UWCP5q85#fp literal 0 HcmV?d00001 diff --git a/Libraries/SndFile/Files/AUTHORS b/Libraries/SndFile/Files/AUTHORS new file mode 100644 index 000000000..95770ab52 --- /dev/null +++ b/Libraries/SndFile/Files/AUTHORS @@ -0,0 +1,14 @@ +The main author of libsndfile is Erik de Castro Lopo . + +The code in the src/GSM610 directory was written by Jutta Degener + and Carsten Bormann . +They should not be contacted in relation to libsndfile or the GSM 6.10 code +that is part of libsndfile. Their original code can be found at: + + http://kbs.cs.tu-berlin.de/~jutta/toast.html + +Code in the src/G72x directory was released by Sun Microsystems, Inc. to the +public domain. Minor modifications were required to integrate these files +into libsndfile. The changes are listed in src/G72x/ChangeLog. + + diff --git a/Libraries/SndFile/Files/COPYING b/Libraries/SndFile/Files/COPYING new file mode 100644 index 000000000..c396169ee --- /dev/null +++ b/Libraries/SndFile/Files/COPYING @@ -0,0 +1,503 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + diff --git a/Libraries/SndFile/Files/ChangeLog b/Libraries/SndFile/Files/ChangeLog new file mode 100644 index 000000000..553149207 --- /dev/null +++ b/Libraries/SndFile/Files/ChangeLog @@ -0,0 +1,5161 @@ +2004-11-15 Erik de Castro Lopo + + * Win32/sndfile.h Win32/config.h MacOS9/sndfile.h MacOS9/config.h + Updates from autoconfig versions. + +2004-11-13 Erik de Castro Lopo + + * src/aiff.c + Fix parsing of COMT chunks. Store SF_STR_COMMENT data in ANNO chunks + instead of COMT chunk. + +2004-11-07 Erik de Castro Lopo + + * src/file_io.c src/common.h + Change the ptr argument to psf_write() from "void*" to a "const void*". + Thanks to Tobias Gehrig for suggesting this. + +2004-10-31 Erik de Castro Lopo + + * src/file_io.c src/common.h + Add functions psf_close_rsrc() and read length of resourse fork into + rsrclength field of SF_PRIVATE. + + * src/sd2.c + Make sure resource fork gets closed. + + * tests/util.tpl + Add functions to check for file descriptor leakage. + + * src/write_read_test.tpl + Use the file descriptor leak checks. + + * src/sndfile.h.in + Add SFC_GET_LOOP_INFO and SF_LOOP_INFO struct. + + * src/common.h + Add SF_LOOP_INFO pointer to SF_PRIVATE. + + * src/wav.c src/aiff.c + Improve and add parsing of 'ACID' and 'basc' chunks, filling in + SF_LOOP_INFO data in SF_PRIVATE. + +2004-10-30 Erik de Castro Lopo + + * src/sd2.c + Further cleanup: remove printfs, change snprintf to LSF_SNPRINTF. + + * Win32/config.h Win32/sndfile.h + Updates. + + * tests/util.tpl + Add win32 macro for snprintf. + +2004-10-29 Erik de Castro Lopo + + * src/sfendian.h + Add macros : H2BE_SHORT, H2BE_INT, H2LE_SHORT and H2LE_INT. + + * src/sd2.c + Use macros to make sure writing SD2 files on little endian machines works + correctly. + + * tests/util.tpl + Add a delete_file() function which also deletes the resource fork of SD2 + files. + + * tests/write_read_test.tpl + Use delete_file() so that "make distcheck" works. + +2004-10-28 Erik de Castro Lopo + + * src/sndfile.c src/file_io.c + Move resource filename construction and testing to psf_open_rsrc(). + + * src/common.h src/sndfile.c + Add error SFE_SD2_FD_DISALLOWED. + + * tests/util.tpl tests/*.(c|tpl) + Add and allow_fd parameter to test_open_file_or_die() so that use of + sf_open_fd() can be avoided when opening SD2 files. + +2004-10-27 Erik de Castro Lopo + + * src/wav.c + Update ACID chunk parsing. + + * src/sd2.c + More fixes for files with large resource forks. + +2004-10-23 Erik de Castro Lopo + + * src/common.h src/sndfile.c + Add error numbers and messages for sd2 files. + + * src/sd2.c + Reading of sd2 (resource fork version) now seems to be working. + +2004-10-17 Erik de Castro Lopo + + * src/file_io.h + Update file_io.c to include win32 psf_rsrc_open(). + + * tests/floating_point_test.tpl + Remove use of __func__ in test programs (MSVC++ doesn't grok this). + + * Win32/(config|sndfile).h MacOS9/(config|sndfile).h + Updates. + +2004-10-13 Erik de Castro Lopo + + * src/sfendian.h + Fix endswap_int64_t_(array|copy). + + * src/test_endswap.(tpl|def) + Add tests for above and inprove all tests. + +2004-10-12 Erik de Castro Lopo + + * src/sfendian.h + Improve type safety, add endswap_double_array(). + + * src/double64.c + Use endswap_double_array() instead of endswap_long_array(). + + * src/test_endswap.(tpl|def) src/Makefile.am + Add preliminary endswap tests and hook into build system. + +2004-10-06 Erik de Castro Lopo + + * src/configure.ac src/makefile.am + Finally fix the bulding of DLLs on Win32/MinGW. + + * tests/makefile.am + Fix running of tests on Win32/MinGW. + +2004-10-01 Erik de Castro Lopo + + * src/sndfile.h.in src/sndfile.c tests/floating_point_test.tpl + Rename SFC_SET_FLOAT_INT_MULTIPLIER to SFC_SET_SCALE_FLOAT_INT_READ. + + * doc/command.html + Document SFC_SET_SCALE_FLOAT_INT_READ. + +2004-09-30 Erik de Castro Lopo + + * tests/floating_point_test.(tpl|def) + Derived from floating_point_test.c. + Add (float|double)_(short|int)_test functions. + + * tests/util.(tpl|def) + Make separate float and double versions of gen_windowed_sine(). + + * tests/write_read_test.tpl + Fix after changes to gen_windowed_sine(). + + * src/(float32|double64).c + Implement SFC_SET_FLOAT_INT_MULTIPPLIER. + +2004-09-29 Erik de Castro Lopo + + * acinclude.m4 + Fix warnings from automake 1.8 and later. + + * examples/sndfile-info.c + Add a "fflush (stdout)" after printing Win32 message. + +2004-09-28 Erik de Castro Lopo + + * Win32/Makefile.mingw.in + Add a "make install" target. + +2004-09-24 Erik de Castro Lopo + + * src/sndfile.h.in src/common.h src/sndfile.c src/command.c + Start work on adding command SFC_SET_FLOAT_INT_MULTIPLIER. + +2004-09-22 Erik de Castro Lopo + + * examples/sndfile-convert.c + Fix a bug converting stereo integer PCM files to float. + +2004-09-22 Erik de Castro Lopo + + * examples/sndfile-play.c + Appy patch from Conrad Parker to make Mac OSX error messages more + consistent and informative. + + * doc/api.html + Fix a HTML HREF which was wrong. + + * doc/win32.html + Add information about when nmake fails. + +2004-09-05 Erik de Castro Lopo + + * examples/sndfile-play.c + Another patch from Denis Cote to prevent race conditions. + +2004-09-02 Erik de Castro Lopo + + * src/common.h src/ms_adpcm.c src/ima_adpcm.c + Fix alternative to ISO standard flexible struct array feature for broken + compilers. + +2004-08-31 Erik de Castro Lopo + + * src/common.h src/string.c src/sndfile.c + Make sf_set_string() return an error if trying to set a string when in + read mode. + +2004-08-29 Erik de Castro Lopo + + * src/common.h + Change the unnamed union into a named union so gcc-2.95 will compile it. + + * src/*.c + Fixes to allow for the above change. + +2004-08-20 Erik de Castro Lopo + + * examples/sndfile-play.c + Fixes for Win32. Thanks to Denis Cote. + + * Win32/Win32/Makefile.(msvc|mingw.in) + Fix build system after removal of sfendian.h. + Build sndfile-convert. + + * src/Makefile.am + Remove sfendian.c from dependancies. + +2004-08-10 Erik de Castro Lopo + + * src/sndfile.h.in + Fix typo in comments (thanks Tommi Sakari Uimonen). + +2004-07-31 Erik de Castro Lopo + + * tests/(a|u)law_test.c + Minor cleanup. + +2004-07-29 Erik de Castro Lopo + + * src/(pcm|float|double64|ulaw|alaw|xi).c + Optimise read/write loops by removing a redundant variable. + +2004-07-24 Erik de Castro Lopo + + * src/file_io.c + Remove call to fsync() in psf_close(). + +2004-07-19 Erik de Castro Lopo + + * src/pcm.c + Inline x2y_array() functions where possible. + + * configure.ac + Detect presence of type int64_t. + + * src/sfendian.c src/sfendian.h + Move functions in the first file to the sfendian.h as static inline + functions. + Improve endswap_long_*() where possible. + +2004-07-17 Erik de Castro Lopo + + * src/pcm.c + When converting from unsigned char to float or double, subtract 128 before + converting to float/double rather than after to save a floating point + operation as suggested by Stefan Briesenick. + + * src/(pcm|sfendian|alaw|ulaw|double64|float32).c + Optimize inner loops by changing the loop counting slightly as suggested + by Stefan Briesenick. + + * configure.ac + Detect presence of . + + * src/sfendian.h + Use if present as suggested by Stefan Briesenick. + + * src/pcm.c + Update bytewapping. + +2004-07-02 Erik de Castro Lopo + + * src/common.h src/*.c + Change the psf->buffer field of SF_PRIVATE into a more type safe union with + double, float, int etc elements. + +2004-06-28 Erik de Castro Lopo + + * examples/sndfile-play.c + Merge slightly modifed patch from Stanko Juzbasic which allows playback of + mono files on MacOSX. + +2004-06-25 Erik de Castro Lopo + + * examples/sndfile-convert.c + Move copy_metadata() after the second sf_open(). + +2004-06-21 Erik de Castro Lopo + + * examples/sndfile-convert.c + Fix a bug which caused the program to go into an infinite loop if the source + file has no meta-data. Thanks to Ron Parker for reporting this. + + * src/sndfile.h.in + Add SF_STR_FIRST and SF_STR_LAST to allow enumeration of string types. + + * Win32/sndfile.h MacOS9/sndfile.h + Update these as per the above file. + +2004-06-17 Erik de Castro Lopo + + * configure.ac src/common.h src/ogg.c src/sndfile.c src/sndfile.h.in + src/Makefile.am + Apply large patch from Conrad Parker implementing Ogg Vorbis, Ogg Speex and + Annodex support via liboggz and libfishsound. Thanks Conrad. + +2004-06-15 Erik de Castro Lopo + + * src/avr.c src/ircam.c src/nist.c src/paf.c src/xi.c + Add cast to size_t for some parameters passed to psf_binheader_writef. This + is Debian bug number 253490. Thanks to Anand Kumria and Andreas Jochens. + + * src/w64.c + Found and fixed a bug resulting from use of size_t when writing W64 'fmt ' + chunk. + +2004-06-14 Erik de Castro Lopo + + * configure.ac + Bump version to 1.0.10 ready for release. + + * Makefile.am + Remove redundant files (check_libsndfile.py libsndfile_version_convert.py) + from distribution tarball. + + * tests/header_test.tpl + Fix uninitialised variable. + + * src/GSM610/short_term.c + Fix compiler warning on MSVC++. + +2004-05-23 Erik de Castro Lopo + + * src/wav.c + Improve record keeping of chunks seen and return an error if a file with + unusual chunks is opened in mode SFM_RDWR. + + * src/mmreg.h + This file not needed so remove it. + +2004-05-22 Erik de Castro Lopo + + * tests/header_test.tpl + Add extra_header_test(). + + * src/common.h src/sndfile.c + Add SFE_RDWR_BAD_HEADER error number and string. + +2004-05-21 Erik de Castro Lopo + + * tests/utils.tpl tests/*.c tests/*.tpl + Add a line number argument to check_log_buffer_or_die() and update all + files that use that function. + + * tests/header_test.tpl + Modify/update tests for files opened SFM_RDWR and SFC_UPDATE_HEADER_AUTO. + + * src/aiff.c src/wav.c + Fix another bug in AIFF and WAV files opened in SFM_RDWR and using + SFC_UPDATE_HEADER_AUTO. + + * src/test_file_io.c + Add a test for psf_ftruncate() function. + +2004-05-19 Erik de Castro Lopo + + * src/sndfile.c + Fix another weird corner case bug found by Martin Rumori. Thanks. + + * tests/header_test.(tpl|def) + Two new files to test for the absence of the above bug and include tests + moved from tests/misc_test.c. + + * tests/Makefile.am + Hook new tests into build/test system. + + * tests/misc_test.c + Remove update_header_test() which has been moved to the new files above. + +2004-05-16 Erik de Castro Lopo + + * src/aiff.c + Fixed a bug reported by Martin Rumori on the LAD list. If a file created + with a format of SF_FORMAT_FLOAT and then closed before any data is written + to it, the header can get screwed up (PEAK chunk gets overwritten). + + * tests/write_read_test.tpl + Add a test (empty_file_test) for the above bug. + +2004-05-13 Erik de Castro Lopo + + * Win32/Makefile.mingw.in + Added a Makefile for MinGW (needs to be processed by configure). + + * src/mmsystem.h src/mmreg.h + Add files from the Wine project (under the LGPL) to allow build of + sndfile-play.exe under MinGW. + +2004-05-12 Erik de Castro Lopo + + * src/GSM610/gsm610_priv.h + Replace ugly macros with inline functions. + + * src/GSM610/*.c + Remove temporary variables used by macros and other minor fixes required by + above change. + +2004-05-10 Erik de Castro Lopo + + * tests/pipe_test.tpl tests/stdio_test.c Win32/Makefile.msvc + Make sure these programs compile (even though they do nothing) on Win32 + and add them to the "make check" target. + + * src/sfendian.h + Fix warning on Sparc CPU and code cleanup. + +2004-05-09 Erik de Castro Lopo + + * src/file_io.c + Fix warning messages when compiling under MinGW. + +2004-05-01 Erik de Castro Lopo + + * configure.ac + Set HAVE_FLEXIBLE_ARRAY in src/config.h depending on whether the compiler + accepts the flexible array struct member as per 1999 ISO C standard. + + * src/common.h src/ima_adpcm.c src/paf.c src/ms_adpcm.c + Added ugly #if HAVE_FLEXIBLE_ARRAY and provided a non-standards compliant + hack for non 1999 ISO C compliant compilers. + +2004-04-26 Erik de Castro Lopo + + * src/strings.c + If adding an SF_STR_SOFTWARE string, only append libsndfile-X.Y.Z if the + string does not already have libsndfile in the string. Thanks to Conrad + Parker. + + * tests/string_test.c + Add test to verify the above. + + * examples/sndfile-convert.c + Add ability to transcode meta data as well (Conrad Parker). + +2004-04-25 Erik de Castro Lopo + + * doc/command.html + Fix minor error. Thanks to Simon Burton. + + * doc/win32.html + Started adding instructions for compiling libsndfile under MinGW. + + * configure.ac + Add --enable-bow-docs to enable black text on a white background HTML docs. + + * doc/libsndfile.css.in + This is now a template file for configure which sets the foreground and + background colours. + +2004-04-20 Erik de Castro Lopo + + * configure.ac + Do some MinGW fixes. + + * configure.ac doc/Makefile.am + Install HTML docs when doing make install. + +2004-04-19 Erik de Castro Lopo + + * examples/sndfile-info.c + Print out the dB level with the signal max. + +2004-04-15 Erik de Castro Lopo + + * src/file_io.c + Define S_ISSOCK in src/file_io.c if required. + +2004-04-03 Erik de Castro Lopo + + * configure.ac + Improve printout configuration summary (as suggested by Axel Röbel). + + * doc/index.html + Add link to pre-release location. + + * src/sndfile.h.in + Remove comma after last element of enum. + + * src/float32.c src/double64.c + Fix read/write of float/double encoded raw files to/from pipes. + + * tests/pipe_test.c tests/pipe_test.tpl tests/pipe_test.def + Turn pipe_test.c into an autogenerated file and add tests for reading/ + writing floats and doubles. + + * tests/Makefile.am + Hook tests/pipe_test.* into build system. + +2004-04-02 Erik de Castro Lopo + + * configure.ac acinclude.m4 + Rename AC_C_STRUCT_HACK macro to AC_C99_FLEXIBLE_ARRAY. + +2004-03-31 Erik de Castro Lopo + + * tests/misc_test.c + Perform update_header_test in RDWR mode as well. + + * src/aiff.c + Fix problems when updating header in RDWR mode. + +2004-03-30 Erik de Castro Lopo + + * src/wav.c src/w64.c src/wav_w64.c + Integrate code supplied by David Viens for supporting microsoft's + WAVEFORMATEXTENSIBLE stuff. Thanks David for supplying this. + + * configure.ac doc/*.html + Bump version to 1.0.9. + +2004-03-28 Erik de Castro Lopo + + * src/command.c src/sndfile.c src/sndfile.h.in src/wav.c + Started work on supporting microsoft's WAVEFORMATEXTENSIBLE gunk. + +2004-03-26 Erik de Castro Lopo + + * src/avr.c + New file to handle Audio Visual Resaerch files. + + * src/sndfile.h.in src/common.h src/sndfile.c src/command.c + Hook AVR into everything else. + + * tests/Makefile.am tests/write_read_test.tpl tests/misc_test.c + Add testing for AVR files. + +2004-03-22 Erik de Castro Lopo + + * src/file_io.c + Fix psf_set_file() for win32. Thanks to Vincent Trussart (Plogue Art et + Technologie) for coming up with the solution. + +2004-03-21 Erik de Castro Lopo + + * tests/write_read_test.tpl + Fixed a bug that was causing valgrind to report a memory leak. The bug was + in the test code itself, not the library. + +2004-03-20 Erik de Castro Lopo + + * examples/generate.cs + An example showing how to use libsndfile from C#. Thanks to James Robson + for providing this. + +2004-03-19 Erik de Castro Lopo + + * src/common.c + Fix problems with WAV files containing large chunks after the 'data' + chunk. Thanks to Koen Tanghe for providing a sample file. + +2004-03-17 Erik de Castro Lopo + + * configure.ac + Detect presense of ALSA (Advanced Linux Sound Architecture). + + * examples/sndfile-play.c + Add ALSA output support. + + * examples/Makefile.am + Add ALSA_LIBS to link line of sndfile-play.c. + +2004-03-15 Erik de Castro Lopo + + * acinclude.m4 + Add new macro (AC_C_STRUCT_HACK) to detect whether the C compiler allows + the use of the what is known as the struct hack introduced by the 1999 ISO + C Standard. + + * configure.ac + The last release would not compile with gcc-2.95 due to the use of features + (ie struct hack) introduced by the 1999 ISO C Standard. + Add check to make sure compiler handles this and bomb out if it doesn't. + +2004-03-14 Erik de Castro Lopo + + * tests/write_read_test.tpl + Fix compiler warning on Win32. + + * src/file_io.c + Fix use of an un-initialised variable in Win32 stuff. + + * Win32/config.h examples/sndfile-play.c + Win32 fixes. + +2004-03-10 Erik de Castro Lopo + + * configure.ac + Fix bug which occurres when configuring for MinGW. + If compiler is gcc and cross compiling use -nostdinc. + +2004-03-09 Erik de Castro Lopo + + * src/common.h src/aiff.c src/wav.c src/float32.c src/double64.c + src/sndfile.c + Fix a bug with PEAK chunk handling for files with more than 16 channels. + Thanks to Remy Bruno for finding this. + +2004-03-08 Erik de Castro Lopo + + * src/common.c + Fix a bug which was preventing WAV files being openned correctly if the + file had a very large header. Thanks to Eldad Zack for finding this. + +2004-03-04 Erik de Castro Lopo + + * configure.ac src/file_io.c + Fix cross-compiling from Linux to Win32 using the MinGW tools. + +2004-03-01 Erik de Castro Lopo + + * src/create_symbols_file.sh + Christian Weisgerber pointed out that the shell script did not run on a + real Bourne shell although it did run under Bash in Bourne shell mode. + + * src/create_symbols_file.py + Rewrite of above in Python. Also add support for writing Win32 .def files. + The Python script generates Symbols.linux, Symbols.darwin and + libsndfile.def (Win32 version). These files get shipped with the tarball + so there should not be necessary to run the Python script when building + the code from the tarball. + + * configure.ac src/Makefile.am Win32/Makefile.am + Hook new Python script into the build system. + +2004-02-25 Erik de Castro Lopo + + * src/configure.ac + Add --enable-gcc-werror option and move GCC specific stuff down. + +2004-02-24 Erik de Castro Lopo + + * acinclude.m4 configure.ac + Fix clip mode detection (tested in one of HP's testdrive Itanium II boxes). + + * src/file_io.c + Added check for sizeof (off_t) != sizeof (sf_count_t) to prevent recurrence + of missing large file support on Linux and Solaris. + +2004-02-19 Erik de Castro Lopo + + * examples/sndfile-play.c + Fix a MacOSX specific bug which was caused by a space being inserted in + the middle of a file name. + + * configure.ac src/Makefile.am examples/Makefile.am + Fix a couple of MacOSX build issues. + +2004-02-17 Erik de Castro Lopo + + * doc/command.html + Document SFC_SET_CLIPPING and SFC_GET_CLIPPING. + +2004-02-14 Erik de Castro Lopo + + * doc/*.html + Applied patch from Frank Neumann (author of lakai) which fixes many minor + typos in documentation. Thanks Frank. + +2004-02-13 Erik de Castro Lopo + + * ChangeLog + Changed my email address throughout source and docs. + +2004-02-08 Erik de Castro Lopo + + * src/file_io.c + Make sure config.h is included before stdio.h to make sure large file + support is enabled on Linux (and Solaris). + + * tests/misc_test.c + Disable update_header test on Win32. This should work but doesn't and + I'm not sure why. + + * Make.bat Win32/Makefile.msvc + Updates. + +2004-01-07 Erik de Castro Lopo + + * src/common.h + Changed logindex, headindex and headend files of SF_PRIVATE from unsigned + int to int to prevent weird arithmetic bugs. + + * src/common.c src/aiff.c src/wav.c src/w64.c + Fixed compiler warnings resulting from above change. + +2004-01-06 Erik de Castro Lopo + + * src/common.c + Fixed a bug in header reader for some files with data after the sample data. + +2003-12-29 Erik de Castro Lopo + + * tests/lossy_comp_test.c tests/Makefile.am + Add tests for AIFF/IMA files. + +2003-12-26 Erik de Castro Lopo + + * src/macbinary3.c src/macos.c + Two new files required for handling SD2 files. + + * src/common.h + Add prototypes for functions in above two files. + + * src/Makefile.am + Hook new files into build system. + +2003-12-21 Erik de Castro Lopo + + * configure.ac + Add checks for mmap() and getpagesize() which might be used at some time + for faster file reads. + Add detection of MacOSX. + +2003-12-13 Erik de Castro Lopo + + * doc/FAQ.html + Minor mods to pkg-config section. + +2003-12-12 Erik de Castro Lopo + + * src/create_symbols_file.sh + Andre Pang (also known as Ozone) pointed out that on MacOSX, all non + static symbols are exported causing troubles when trying to link + libsndfile with another library which has any of the same symbols. + He fixed this by supplying the MacOSX linker with a file containing + all the public symbols so that only they would be exported and then + supplied a patch for libsndfile. + This wasn't quite ideal, because I would have to maintain two (3 if + you include Win32) separate files containing the exported symbols. + A better solution was to create this script which can generate a + Symbols file for Linux, MacoSX and any other OS that supports + minimising the number of exported symbols. + + * configure.ac src/Makefile.am + Hook the new script into the build process. + +2003-12-10 Erik de Castro Lopo + + * doc/index.html + Added comments about Steve Dekorte's SoundConverter scam. + +2003-12-07 Erik de Castro Lopo + + * src/file_io.c + Axel Roebel pointed out that on Mac OSX a pipe is not considered a fifo + (S_ISFIFO (st.st_mode) is false) but a socket (S_ISSOCK (st.st_mode) is + true). The test has therefore been changed to is S_ISREG and anything + which which does not return true for S_ISREG is considered a pipe. + +2003-11-25 Erik de Castro Lopo + + * tests/misc_test.c + Fix update_header_test to pass SDS. + + * src/sds.c + More minor fixes. + + * tests/floating_point_test.c + Add test for SDS files. + + * src/command.c + Add SDS to major_formats array. + +2003-11-24 Erik de Castro Lopo + + * tests/write_read_test.tpl tests/misc_test.c + Add tests for SDS files. + + * src/sds.c + Fix a bug in header update code. + +2003-11-23 Erik de Castro Lopo + + * src/sds.c + Get file write working. + + * src/paf.c + Fix a potential bug in paf24_seek(). + +2003-11-04 Erik de Castro Lopo + + * doc/FAQ.html + Add Q/A about u-law encoded WAV files. + + * Win32/*.h + Updated so it compiles on Win32. + +2003-11-03 Erik de Castro Lopo + + * examples/sndfile-convert.c + Add -alaw and -ulaw command line arguments. + + * configure.ac + Add library versioning comments. + Add arguments to AC_INIT. + +2003-10-28 Erik de Castro Lopo + + * src/file_io.c + Ross Bencina has contributed code to replace all of the (mostly broken) + Win32 POSIX emulation calls with calls the native Win32 file I/O API. + This code still needs testing but is likely to be a huge improvemnt + of support for Win32. Thanks Ross. + +2003-10-27 Erik de Castro Lopo + + * src/dwvw.c + Removed filedes field from the DWVW_PRIVATE struct. + + * src/file_io.c + Change psf_fopen() so it returns psf->error instead of the file descriptor. + Add new functions psf_set_stdio() and psf_set_file(). + + * src/sndfile.c + Change these to work with changed psf_fopen() return value. + Remove all uses of psf->filedes from sndfile, making it easier to slot native + Win32 API file handling functions. + + * src/test_file_io.c + Minor changes to make it compile with new file_io.c stuff. + +2003-10-26 Erik de Castro Lopo + + * src/gsm610.h + Rename a variable from true to true_flag. As Ross Bencina points out, + true is defined in the C99 header . + + * src/file_io.c + If fstat() fails, return SF_TRUE instead of -1 (Ross Bencina). + +2003-10-09 Erik de Castro Lopo + + * src/common.h + Increase the size of SF_BUFFER_LEN and SF_HEADER_LEN. + + * src/sndfile.c + Fix sf_read/write_raw which were dividing by psf->bytwidth and + psf->blockwidth which can both be zero. + + * examples/sndfile-info.c + Increase size of BUFFER_LEN. + +2003-09-21 Erik de Castro Lopo + + * configure.ac + Add checks for and ssize_t. + Other Win32/MinGW checks. + + * src/aiff.c src/au_g72x.c src/file_io.c src/gsm610.c src/interleave.c + src/paf.c src/sds.c src/svx.c src/voc.c src/w64.c src/wav.c src/xi.c + Fix compiler warnings. + +2003-09-20 Erik de Castro Lopo + + * tests/scale_clip_test.tpl + Add definition of M_PI if needed. + +2003-09-19 Erik de Castro Lopo + + * configure.ac + Detect if S_IRGRP is declared in . + + * src/file_io.c tests/*.tpl tests/*.c + More fixes for Win32/MSVC++ and MinGW. MinGW does have but that + file doesn't declare S_IRGRP. + +2003-10-18 Erik de Castro Lopo + + * src/config.h.in + Add comment stating that the sf_count_t typedef is determined when + libsndfile is being compiled. + + * tests/utils.tpl + Modified so that utils.c gets one copy of the GPL and not two. + + +2003-09-17 Erik de Castro Lopo + + * Win32/unistd.h src/sf_unistd.h + Move first file to the second. This will help for Win32/MSVC++ and MinGW. + + * Win32/Makefile.am src/Makefile.am + Changed in line with above. + + * Win32/Makefile.msvc + Removed "/I Win32" which is no longer required. + + * src/file_io.c src/test_file_io.c tests/*.tpl tests/*.c + If HAVE_UNISTD_H include else include . This should + work for Win32, MinGW and other fakes Unix-like OSes. + + * src/*.c + Removed #include from files which didn't need it. + +2003-09-16 Erik de Castro Lopo + + * libsndfile.spec.in + Apply fix from Andrew Schultz. + +2003-09-07 Erik de Castro Lopo + + * src/vox_adpcm.c + Only set psf->sf.samplerate if the existing value is invalid. + +2003-09-06 Erik de Castro Lopo + + * examples/sndfile-play.c + Started adding support for ALSA output. + +2003-09-04 Erik de Castro Lopo + + * src/sndfile.h.in + Removed from sndfile.h. + + * src/*.c examples/*.c tests/*.c tests/*.tpl + Added where needed. + +2003-09-02 Erik de Castro Lopo + + * src/common.h + Added ARRAY_LEN, SF_MAX and SF_MIN macros. + +2003-08-19 Erik de Castro Lopo + + * doc/index.html + Remove statements about alternative licensing arrangements. + +2003-08-17 Erik de Castro Lopo + + * MacOS MacOS9 Makefile.am configure.ac + Change directory name from MacOS to MacOS9 + + * MacOS9/MacOS9-readme.txt + Change name to make it really obvious, add text to top of file to make it + still more obvious again. + +2003-08-16 Erik de Castro Lopo + + * src/test_log_printf.c + Add tests for %u conversions. + + * src/common.c + Fix psf_log_printf() %u conversions. + +2003-08-15 Erik de Castro Lopo + + * src/aiff.c + Fixed a bug where opening a file with a non-trival header in SFM_RDWR mode + would over-write part of the header. Thanks to Axel Roebel for pointing + this out. Axel also provided a patch to fix this but I came up with a + neater and more general solution. + Return error when openning an AIFF file with data after the SSND chunk + (Thanks Axel Roebel). + + * tests/aiff_rw_test.c + Improvements to test program which will later allow it to be generalised to + test WAV, SVX and others as required. + +2003-08-14 Erik de Castro Lopo + + * tests/pipe_test.c + Add useek_pipe_rw_test() submitted by Russell Francis. + + * src/sndfile.c + In sf_open_fd(), check if input file descriptor is a pipe. + + * src/sndfile.[ch] + Fix typo in variable name do_not_close_descriptor. + +2003-08-13 Erik de Castro Lopo + + * src/test_log_printf.c + Improve the tests for %d and %s conversions. + + * src/common.c + Fixed a few problems in psf_log_printf() found using new tests. + +2003-08-06 Erik de Castro Lopo + + * configure.ac + Add -Wwrite-strings warning to CFLAGS if the compiler is GCC. Thanks to + Peter Miller (Aegis author) for suggesting this and supplying a patch. + + * src/*.c examples/*.c tests/*.c + Fix all compiler warnings arising from the above. + +2003-08-02 + + * tests/aiff_rw_test.c tests/Makefile.am + New test program to check for errors re-writing the headers of AIFC files + opened in mode SFM_RDWR. + +2003-07-21 Erik de Castro Lopo + + * examples/sndfile-play.c + Applied a patch from Tero Pelander to allow this program to run on systems + using devfs which used /dev/sound/dsp instead of /dev/dsp. + +2003-07-11 Erik de Castro Lopo + + * doc/new_file_type.HOWTO + Updated document. Still incomplete. + +2003-06-29 Erik de Castro Lopo + + * src/sndfile.c + Fix VALIDATE_SNDFILE_AND_ASSIGN_PSF which was returning an error rather + than saving it and returning zero. + +2003-06-25 Erik de Castro Lopo + + * src/file_io.c + Two fixes for Mac OS9. + Fix all casts from sf_count_t to ssize_t (not size_t). + +2003-06-22 Erik de Castro Lopo + + * src/wav.c + Fix for reading files with RIFF length of 8 and data length of 0. + +2003-06-14 Erik de Castro Lopo + + * src/*.c tests/*.c tests/*.tpl + Added comments to mark code for removal when make Lite version of + libsndfile. + +2003-06-09 Erik de Castro Lopo + + * examples/sndfile-convert.c + Add extra error checking for unrecognised arguments. + +2003-06-08 Erik de Castro Lopo + + * src/ima_adpcm.c + Started adding code to write IMA ADPCM encoded AIFF files. + + * src/test_log_printf.c src/Makefile.am + New file to test psf_log_printf() function and add hooks into build system. + + * src/common.c + Move psf_log_printf() function to top of the file and only compile the rest + of the file if if PSF_LOG_PRINTF_ONLY is not defined. + +2003-06-03 Erik de Castro Lopo + + * Win32/config.h Win32/sndfile.h + Updated with new config variables. + + * Win32/unistd.h src/file_io.c + Added implementation of S_ISFIFO macro which Win32 seems to lack and is + used in src/file_io.c. + + * tests/utils.tpl + Added #include to pull in Win32/unistd.h so it compiles for + Win32. + + * src/Makefile.msvc + Added src\test_file_io.exe build target and run this as the very first + test. + + * tests/win32_test.c + Add support for testing Cygwin32. + + * configure.ac + Detect POSIX fsync() and fdatasync() functions. + + * src/file_io.c + If compiling for Cygwin, call fsync() before calling fstat() to retrieve + file length. + + * tests/pcm_test.tpl + Add a test for lrintf() function. This was required to detect a really + broken lrint() and lrintf() on Cygwin. + + * tests/misc_test.c + Don't run permission test when compiling under Cygwin. + + * src/float_cast.h + Fix fallback macro for lrint() and lrintf() to cast to long instead of int + to match official function prototypes. + +2003-06-02 Erik de Castro Lopo + + * examples/sndfile-convert.c + Modifications to improve accuracy of conversions; use double data for + floating point and int for everything else. + + * src/ima_apdcm.c + Completed work on decoding IMA ADPCM encoded AIFF files. Still need to + get encoding working. + +2003-05-28 Erik de Castro Lopo + + * src/aiff.c src/ima_adpcm.c + Start working on getting IMA ADPCM encoded AIFF files working. + +2003-05-27 Erik de Castro Lopo + + * configure.ac + Fixed the touch command for when the autogen program is not found (Matt + Flax). + + * src/ulaw.c src/alaw.c + Made these pipe-able. + +2003-05-24 Erik de Castro Lopo + + * src/paf.c src/ircam.c + Fixed writing to pipe. + + * src/wav.c src/aiff.c src/nist.c src/mat*.c src/svx.c src/w64.c + Return SFE_NO_PIPE_WRITE if an attempt is made to write to a pipe. + +2003-05-23 Erik de Castro Lopo + + * examples/sndfile-info.c + Modified to detect unknown file lengths. + + * src/mat4.c + Fix reading from a pipe. + +2003-05-22 Erik de Castro Lopo + + * tests/pipe_test.c + Add more file types to tests. + + * src/mat4.c + Removed explicit setting of psf->sf.seekable to SF_TRUE. + + * tests/utils.tpl + Add macro for generating and check data in the stdio and pipe tests. + + * tests/stdout_test.c tests/stdin_test.c + Use the above macro to generate known data on output and check data on + input. + + * src/voc.c src/htk.c common.h sndfile.c + Disallow reading/writing VOC and HTK files from/to pipes be returning new + error values. + + * src/w64.c + Fixes to allow reading from a pipe. + +2003-05-21 Erik de Castro Lopo + + * configure.ac src/sndfile.h.in + When the configure script determines the sizeof (sf_count_t), also set the + value of SF_COUNT_MAX in sndfile.h. + + * configure.ac + Remove -pedantic flag from default GCC compiler flags. + + * tests/pipe_test.c + Add a pipe_read_test() before doing pipe_write_test(). + + * tests/scale_clip_test.c + Add test to make sure non-normalized values also clip in the right way. + +2003-05-18 Erik de Castro Lopo + + * configure.ac + Add test to detect processor clipping capabilities. + + * tests/stdin_test.c tests/stdout_test.c + Fix a pair of compiler warnings. + + * src/common.h + Add new pipeoffset field to SF_PRIVATE. This will contain the current file + offset when operating on a pipe. + + * src/common.c + Removed direct calls to psf_fread()/psf_fseek()/psf_fgets() etc from + psf_binheader_readf and redirect them to new buffered versions + header_read(), header_seek() and header_gets(). + Add "G" format specifier to emulate fgets() functionality with buffering. + This will allow reading some file types from pipes. + + * src/file_io.c + When the file descriptor is a pipe, manintain psf->pipeoffset. + + * src/pvf.c + Change use of psf_fgets() to psf_binheader_readf() as required but changes to header re + + * src/au.c + Fix reading from a pipe. + +2003-05-17 Erik de Castro Lopo + + * src/pcm.c + Add clipping versions of the f2XXX_array() functions to allow option of + clipping data that would otherwise overflow. + + * tests/scale_clip_test.tpl tests/scale_clip_test.def + New files test that clipping option does actually work. + +2003-05-14 Erik de Castro Lopo + + * doc/index.html + Fixed a typo ("OS(" instead of "OS9"). + +2003-05-13 Erik de Castro Lopo + + * tests/open_fail_test.c + Include to prevent warning message of missing declaration of + memset(). + +2003-05-12 Erik de Castro Lopo + + * src/common.h + Add new "add_clipping" field to SF_PRIVATE. + + * src/sndfile.h.in src/sndfile.c + Add command SFC_SET_CLIPPING which sets/resets add_clipping field. + +2003-05-11 Erik de Castro Lopo + + * doc/api.html + Add docs for sf_set_string() and sf_get_string(). + + * src/common.h src/sndfile.c + Add new SFE_STR_BAD_STRING error. + + * tests/stdin_test.c tests/stdout_test.c + Removed all non-error print statements. + + * tests/stdio_test.c tests/pipe_test.c tests/Makefile.am + Add print statements removed from two files above. + +2003-05-10 Erik de Castro Lopo + + * libsndfile.spec.in + Fixed a coulpe of minor errors discovered by someone calling themselves + Agent Smith. + + * src/common.c src/common.h src/file_io.h + Added is_pipe field to SF_PRIVATE and declaration of psf_is_pipe() + function. (Axel Roebel) + + * src/sndfile.c + Fixed determination of whether the file is a pipe. (Axel Roebel) + + * src/paf.c + Force paf24 to start with undefined mode. (Axel Roebel) + + * tests/pipe_test.c + Mods to make this test work and actually do the test on RAW files. (Axel + Roebel). + +2003-05-05 Erik de Castro Lopo + + * src/sndfile.c + Fixed a potential bug where psf->sf.seekable was being set to FALSE when + operating on stdin or stdout but then the default initialiser was reseting + it to TRUE. Thanks to Axel Roebel. + + * src/aiff.c + Fixed a bug in the header parser where it was not handling an odd length + COMM chunk correctly. Thanks to Axel Roebel. + + * src/test_file_io.c + Add more tests. + + * tests/win32_test.c + New file for showing the bugs in the Win32 implementation of the POSIX API. + It also runs on Linux for sanity checking. + + * tests/Makefile.am Win32/Makefile.msvc + Hook the new test program into the build system. + +2003-05-04 Erik de Castro Lopo + + * src/test_file_io.c + New test program to test operation of functions defined in file_io.c. This + should make supporting win32 significantly easier. + + * src/Makefile.am + Hook new test program into the build system. + + * src/file_io.c + Add compile/run time check that sizeof statbuf.st_size and sf_count_t are + the same. + + * src/common.h src/sndfile.c + Added new error code and error message for new check. + + * tests/benchmark.tpl + Fix to use frames instead of samples in SF_INFO. + +2003-05-03 Erik de Castro Lopo + + * src/file_io.c + More stuffing about working around PLAIN OLD-FASHIONED **BUGS** in Win32. + + * examples/sndfile-info.c + Applied patch from Conrad Parker to add "--help" and "-h" options as + well as an improved usage message. + +2003-05-02 Erik de Castro Lopo + + * src/au.c + Added embedded file support. + + * tests/multi_file_test.c + Added tests for embedded AU files. + Added verbose testing mode. + + * src/common.h src/sndfile.c + Added an embedded AU specific error code and message. + + * src/wav.c + Added patch from Conrad Parker which filled in a little more information + about ACIDized WAV files. + +2003-04-30 Erik de Castro Lopo + + * src/file_io.c + Fixed Win32 version of psf_fseek() which was calling psf_get_filelen() + which was in turn calling psf_fseek() which in the end blew the stack. + Now of course this would have been easy to find on Linux, but this blow + up was happening in kernel32.dll and the fscking MSVC++ debugger couldn't + figure out what call caused this (it couldn't even tell me the stack had + overflowed) and was absolutley useless for this debugging exercise. + On top of that, the reason I got into this mess was that windoze doesn't + have a working fstat() function which can return file lengths > 2 Gig. It + HAS a fscking _fstati64() but the file length value is only updated AFTER + the bloody file is closed. That makes it completely useless. + How the hell do people stand working on this crap excuse of an OS? + +2003-04-29 Erik de Castro Lopo + + * Win32/unistd.h src/file_io.c + Moved definitions of S_IGRP etc from file_io.c to unistd.h so that these + can be used in the test programs. + + * Win32/libsndfile.def + Added sf_open_fd. + + * Win32/sndfile.h + Updated to match src/sndfile.h.in. + + * Win32/Makefile.msvc + Added dither.c and htk.c to libsndfile.dll target. + +2003-04-28 Erik de Castro Lopo + + * src/file_io.c + First attempt at getting the Win32 versions of the these functions working. + They still need to be tested. + +2003-04-27 Erik de Castro Lopo + + * src/strings.c + Found and fixed a bug which was causing psf_store_string() to fail on + Motorola 68k processors. Many thanks fo Joshua Haberman (Debian maintainer + of libsndfile) for compiling and running debug code to help me debug the + problem. + +2003-04-26 Erik de Castro Lopo + + * src/sndfile.c src/file_io.c src/wav.c src/aiff.c + Much hacking to get reading and writing of embedded files working (ie sound + files at a non-zero files offset). + + * doc/embedded_files.html + First pass atempt at documenting reading/writing embedded files. + +2003-04-21 Erik de Castro Lopo + + * doc/FAQ.html + Updated answer to "Why doesn't libsndfile do interleaving/de-interleaving?" + +2003-04-19 Erik de Castro Lopo + + * src/wav.c src/aiff.c + Fix retrieving and storing of string data from files. Need to be careful + about using psf->buffer for strings. + +2003-04-18 Erik de Castro Lopo + + * src/file_io.c + Fix psf_fseek() for seeks withing embedded files. + +2003-04-15 Erik de Castro Lopo + + * src/sndfile.h.in + Changed the definition of SNDFILE slightly to produce warnings when it isn't + used correctly. This should have zero affect in code which uses the SNDFILE + type correctly. + + * src/sndfile.c + Fixed a few compiler warnings cause by the changes to the SNDFILE type. + +2003-04-12 Erik de Castro Lopo + + * doc/FAQ.html + Added question and answer to the question "How about adding the ability + to write/read sound files to/from memory buffers?". + +2003-04-08 Erik de Castro Lopo + + * tests/write_read_test.tpl + Removed un-needed enums declaring TRUE and FALSE and replaced usage of + these with SF_TRUE and SF_FALSE. + + * tests/multi_file_test.c + New test program to test sf_open_fd() on files containing data other than + a single sound file. + +2003-04-06 Erik de Castro Lopo + + * src/file_io.c + When creating files, set the readable by others flag. This still allows + further restrictions to be enforced by use of the user's umask. Fix + suggested by Eric Lyon. + +2003-04-05 Erik de Castro Lopo + + * src/sndfile.h.in src/sndfile.c + Changed sf_open_fd(). Dropped offset parameter and added a close_desc + parameter. If close desc is TRUE, the file descritpor passed into the + library will be closed when sf_close() is called. + + * tests/utils.tpl + Modified call to sf_open_fd() to set close_desc parameter to SF_TRUE. + +2003-04-04 Erik de Castro Lopo + + * tests/write_read_test.tpl + Add a string (using sf_set_string() function) before and after data section + of all files. This will make sure that if string data can be added, it + doesn't overwrite real audio data. + +2003-04-02 Erik de Castro Lopo + + * src/sndfile.c + Started work on supporting a non-zero offset parameter for sf_open_fd (). + + * src/.c + Removed many uses of psf_fseek (SEEK_END) which to allow for future use of + sf_open_fd() with non-zero offset. + Associated refactoring. + + * src/aiff.c + Implemented functionality required to get sf_get_string() and + sf_set_string() working for AIFF files. + +2003-04-01 Erik de Castro Lopo + + * tests/utils.tpl + Modified test_open_file_or_die() to alternately use sf_open() and + sf_open_fd(). + + * src/svx.c + Fixed a bug which occurred when openning an existing file for read/write + using sf_open_fd(). In this case, the existing NAME chunk needs to be + read into psf->filename. + Fixed printing of sf_count_t types to logbuffer. + +2003-03-31 Erik de Castro Lopo + + * src/sndfile.h.in + Added prototype for new function sf_open_fd(). + + * src/sndfile.c + Moved most of the code in sf_open() to a new function psf_open_file(). + Created new function sf_open_fd() which also uses psf_open_file() but + does not currently support the offset parameter. + + * doc/api.html + Document sf_open_fd(). + +2003-03-09 Erik de Castro Lopo + + * src/sndfile.c + Fixed a memory leak reported by Evgeny Karpov. Memory leak only occurred + when an attempt was made to read and the open() call fails. + +2003-03-08 Erik de Castro Lopo + + * tests/open_fail_test.c + New test program to check for memory leaks when sf_open fails on a valid + file. Currently this must be run manually under valgrid. + + * tests/Makefile.am + Hook new test program into build. + +2003-03-03 Erik de Castro Lopo + + * Octave/sndfile_save.m Octave/sndfile_play.m + Added a -mat-binary option to the octave save command to force the output + to binary mode even if the user has set ascii data as the default. Found + by Christopher Moore. + +2003-02-27 Erik de Castro Lopo + + * doc/dither.html + New file which will document the interface which allows the addition of + audio dither when sample word sizes are being reduced. + + * src/dither.c + More work. + +2003-02-26 Erik de Castro Lopo + + * tests/misc_test.c + In update_header_test(), make HTK files a special case. + + * doc/index.html + Added HTK to the feature matrix. + +2003-02-25 Erik de Castro Lopo + + * src/htk.c + New file for reading/writing HMM Tool Kit files. + + * src/sndfile.h.in src/sndfile.c src/command.c src/Makefile.am + Hook in htk.c + + * tests/write_read_test.tpl tests/misc_test.c tests/Makefile.am + Add tests for HTK files. + +2003-02-22 Erik de Castro Lopo + + * src/wav.c + Fixed a bug where the LIST chunk length was being written incorrectly. + + * tests/string_test.c + Added call to check_log_buffer(). + Minor cleanups. + +2003-02-10 Erik de Castro Lopo + + * src/wav_w64.h + Applied patch from Antoine Mathys to add extra WAV format definitions and + a G72x_ADPCM_WAV_FMT struct definition. + + * src/wav_w64.c + Applied patch from Antoine Mathys which converts wav_w64_format_str() from + one huge inefficient switch statement to a binary search. + + * tests/string_test.c + Dump log buffer if tests fail. + +2003-02-07 Erik de Castro Lopo + + * tests/string_test.c + David Viens supplied some modifications to this file which showed up a bug + when using sf_set_string() and the sf_writef_float() functions. + + * src/sndfile.c + Fixed the above bug. + +2003-02-06 Erik de Castro Lopo + + * doc/FAQ.html + Added Q and A on how to detect libsndfile in configure.in (at the suggestion + of Davy Durham). + +2003-02-05 Erik de Castro Lopo + + * src/sndfile.h.in + Add enums and typedefs for dither. + Deprecate SFC_SET_ADD_DITHER_ON_WRITE and SFC_SET_ADD_DITHER_ON_READ, to be + replaced with SFC_SET_DITHER_ON_WRITE and SFC_SET_DITHER_ON_READ which will + allow different dither algorithms to be enabled. + Added SFC_GET_DITHER_INFO_COUNT and SFC_GET_DITHER_INFO. + + * src/sndfile.h.in src/Version_script.in Win32/libsndfile.def. + Added public sf_dither_*() functions. + + * src/sndfile.c + Implement commands above. + + * src/dither.c + More work. Framework and external hooks into dither algorithms complete. + +2003-02-03 Erik de Castro Lopo + + * doc/version-1.html libsndfile_version_convert.py + Remove redundant files. + + * doc/index.html doc/api.html + Remove links to version-1.html. + + * src/dither.c + New file to allow the addition of audio dither on input and output. + + * src/common.h + Add prototype for dither_init() function. + + * Makefile.am doc/Makefile.am + Changes for added and removed files. + +2003-02-02 Erik de Castro Lopo + + * Win32/Makefile.msvc + Changes to force example binaries to be placed in the top level directory + instead of the examples/ directory. + Add src/strings.c and src/xi.c to the build. + Add string_test to build and to tests on WAV files. + + * doc/index.html + Added XI to support matrix. + +2003-01-27 Erik de Castro Lopo + + * src/sndfile.h.in + Added prototypes for sf_get_string() and sf_set_string() and SF_STR_* + enum values. + + * src/sndfile.c + Added public interface to sf_get_string() and sf_set_string(). + + * src/wav.c + Added code for setting and getting strings in WAV files. + + * tests/string_test.c + New test program for sf_get_string() and sf_set_string() functionality. + + * tests/Makefile.am + Hook new test program into build and test framework. + +2003-01-26 Erik de Castro Lopo + + * src/common.h + Added fields to SF_PRIVATE for string data needed to implement + sf_get_string() and sf_set_string(). + + * src/strings.c + New file for storing and retrieving strings to/from files. + + * src/Makefile.am + Added strings.c to build. + +2003-01-25 Erik de Castro Lopo + + * src/xi.c + Read seems to be working so looking at write. + + * src/sndfile.h.in + Added SF_FORMAT_XI, SF_FORMAT_DPCM_8 and SF_FORMAT_DPCM_16 enum values. + + * tests/floating_point_test.c tests/lossy_comp_test.c tests/Makefile.am + Added test for 8 and 16 bit XI format files. + +2003-01-24 Erik de Castro Lopo + + * doc/index.html + Added a non-lawyer readable summary of the licensing provisions as + suggested by Steve Dekorte. + +2003-01-23 Erik de Castro Lopo + + * src/wav.c + Fixed a compiler warning found by Alexander Lerch. + +2003-01-18 Erik de Castro Lopo + + * configure.ac + Fixed the multiple linking of libm. + +2003-01-17 Erik de Castro Lopo + + * Win32/Makefile.mcvs + Added comments on the correct way to set up the MSVCDir environment + variable. + + * doc/win32.html + Add on how to set up the MSVCDir environment variable. + +2003-01-15 Erik de Castro Lopo + + * examples/sndfile-play.c examples/sndfile-info.c + When run on Win32 without any command line parameters print a message and + then sleep for 5 seconds. This means the when somebody double clicks on + these programs in explorer the user will actually see the message. + +2003-01-14 Erik de Castro Lopo + + * tests/misc_test.c + Bypass permission test if running as root because root is allowed to open + a readonly file for write. + +2003-01-08 Erik de Castro Lopo + + * Win32/Makefile.msvc + Added pvf.c and xi.c source files to project. + + * src/sndfile.h + Updated for PVF files. + +2003-01-07 Erik de Castro Lopo + + * src/sndfile.c + Modified validate_sfinfo() to force samplerate, channels and sections + to be >= 1. + In format_from_extension() replaced calls to does_extension_match() + with strcmp(). + + * src/xi.c + More work. + +2003-01-06 Erik de Castro Lopo + + * doc/Makefile.am + Added octave.html which had been left out. Found by Jan Weil. + +2003-01-05 Erik de Castro Lopo + + * src/pvf.c src/common.h src/sndfile.c + Fixed error handling for PVF files. + + * src/xi.c + New file for handling Fasttracker 2 Extended Instrument files. Not working + yet and included when configured with --enable-experimental. + + * src/sndfile.c src/common.h + Hooked in new file xi.c. + +2002-12-30 Erik de Castro Lopo + + * src/rx2.c + Added a patch from Marek Peteraj which sheds a little more light on the + slices within an RX2 file. Still need to find out data encoding. + +2002-12-20 Erik de Castro Lopo + + * src/wav.c + Started work on decoding 'acid' and 'strc' chunks. + +2002-12-14 Erik de Castro Lopo + + * tests/peak_check_test.c + Minor cleanup. + +2002-12-12 Erik de Castro Lopo + + * tests/write_read_test.tpl + Added check to make sure no error was generated when an attempt was made to + read past the end of the file. + +2002-12-11 Erik de Castro Lopo + + * doc/lists.html + Added "mailto" links for all three lists. + + * src/pvf.c + New file for Portable Voice Format files. + + * src/sndfile.h.in src/sndfile.c src/common.h src/command.c src/Makefile.am + Added hooks for SF_FORMAT_PVF format files. + + * tests/write_read_test.tpl tests/std*.c + Add tests for SF_FORMAT_PVF. + + * doc/index.html + Add PVF to the compatibility matrix. + + * src/pcm.c src/alaw.c src/ulaw.c src/float32.c src/double64.c + Previously, attempts to read beyond the end of a file would set psf->error + to SFE_SHORT_ERROR. This behaviour diverged from the behaviour of the POSIX + read() call but has now been fixed. + Attempts to read beyond the end of the file will return a short read count + but will not longer set any error. + +2002-12-09 Erik de Castro Lopo + + * src/sndfile.c + Add more sanity checking when opening a RAW file for read. When format is + not RAW, zero out all members of the SF_INFO struct. + + * tests/raw_test.c + Add bad_raw_test() to check for above problem. + + * tests/stdin_test.c examples/sndfile-info.c + Set the format field of the SF_INFO struct to zero before calling + sf_open(). + + * doc/api.html + Add information about the need to set the format field of the SF_INFO struct + to zero when opening non-RAW files for read. + + * configure.ac + Removed use of conversion script on Solaris. Not all Solaris versions + support it. + + * doc/lists.html + New file containg details of the mailing lists. + + * doc/index.html + Add a link to the above new file. + +2002-12-04 Erik de Castro Lopo + + * tests/dft_cmp.c + Fixed a SIGFPE on Alpha caused by a log10 (0.0). Thanks to Joshua Haberman + for providing the gdb traceback. + +2002-11-28 Erik de Castro Lopo + + * src/wav.c + Added more capabilities to 'smpl' chunk parser. + + * src/sndfile.c + Fixed some (not all) possible problems found with Flawfinder. + +2002-11-24 Erik de Castro Lopo + + * src/sndfile.c + Fixed a bug in sf_seek(). This bug could only occur when an attempt was + made to read beyond the end and then sf_seek() was called with a whence + parameter of SEEK_CUR. + + * src/file_io.c + Win32's _fstati64() does not work, it returns BS. Re-implemented + psf_get_filelen() in terms of psf_fseek(). + + * tests/write_read_test.tpl + Add a test to detect above bug. + + * src/float_cast.h + Modification to prevent compiler warnings on Mac OS X. + + * src/file_io.c + Fixes for windows (what a f**ked OS). + +2002-11-08 Erik de Castro Lopo + + * configure.ac + Disable use of native lrint()/lrintf() on Mac OSX. These functions exist on + Mac OSX 10.2 but not on 10.1. Forcing the use of the versions in + src/float_cast.h means that a library compiled on 10.2 will still work on + 10.1. + +2002-11-06 Erik de Castro Lopo + + * configure.in configure.ac + Renamed configure.in to configure.ac as expected by later versions of + autoconf. + Slight hacking of configure.ac to work with version 2.54 of autoconf. + Changed to using -dumpversion instead of --version for determining GCC + version numer as suggested by Anand Kumria. + + * src/G72x/Makefile.am + Slight hacking required for operation with automake 1.6.3. + +2002-11-05 Erik de Castro Lopo + + * src/common.c + In psf_binheader_readf() changed type parameter type "b" type from size_t + to int to prevent errors on IA64 CPU where sizeof (size_t) != sizeof (int). + Thanks to Enrique Robledo Arnuncio for debugging this. + +2002-11-04 Erik de Castro Lopo + + * test/command_test.tpl + Changed test value so test would pass on Solaris. + + * src/Version_script.in + Modified version numbering so that later versions of 1.0.X can replace + earlier versions without recompilation. + + * src/vox_adpcm.c + Fixed bug causing short reads. + +2002-11-03 Erik de Castro Lopo + + * test/floating_point_test.c + Code cleanup using functions from util.c. + Add test for IEEE replacement floats and doubles. + +2002-11-01 Erik de Castro Lopo + + * src/wav.c + Fixed a possible divide by zero error when read the 'smpl' chunk. Thanks to + Serg Repalov for the example file. + + * tests/pcm_test.tpl + Used sf_command (SFC_TEST_IEEE_FLOAT_REPLACE) to test IEEE replacement code. + Clean up pcm_double_test(). + + * src/float32.c src/double64.c + Force use of IEEE replacement code using psf->ieee_replace is TRUE, + Print message to log_buffer as well. + Rename all broken_read_* and broken_write* functions to replace_read_* and + replace_write_*. + + * tests/util.tpl + Added string_in_log_buffer(). + + * tests/pcm_test.tpl + Use string_in_log_buffer() to ensure that IEEE replacement code has been + used. + + * configure.in + Removed --enable-force-broken-float option. IEEE replacement code is now + always tested. + +2002-10-31 Erik de Castro Lopo + + * src/double64.c + Implement code for read/writing IEEE doubles on platforms where the native + double format is not IEEE. + + * src/float32.c src/common.h + Remove float32_read() and float32_write(). Replace with float32_le_read(), + float32_be_read(), float32_le_write() and float32_be_write() to match stuff + in src/double64.c. + + * src/common.c + Fix all usage of float32_write(). + + * src/sndfile.h.in + Added SFC_TEST_IEEE_FLOAT_REPLACE command (testing only). + + * src/common.h + Added SF_PRIVATE field ieee_replace. + + * src/sndfile.c + In sf_command() set/reset psf->ieee_replace. + +2002-10-26 Erik de Castro Lopo + + * tests/pcm_test.tpl + Fixed a problem when testing with --enable-force-broken-float. The test was + generating a value of negative zero and the broken float code is not able + to write negative zero. Removing the negative zero fixed the test. + +2002-10-25 Erik de Castro Lopo + + * src/file_io.c + Added fix for Cygwin (suggested by Maros Michalik). + +2002-10-23 Erik de Castro Lopo + + * src/file_io.c + Improved error detection and handling. + + * src/file_io.c src/common.h + Removed functions psf_ferror() and psf_clearerr() which were redundant + after above improvements. + + * src/aiff.c src/svx.c src/w64.c src/wav.c + Removed all use of psf_ferror() and psf_clearerr(). + + * src/sndfile.c + Removed #include of , , and which + are no longer needed. + + * tests/misc_test.c + Added test to make sure the correct error message is returned with an + existing read-only file is openned for write. + +2002-10-21 Erik de Castro Lopo + + * doc/index.html doc/api.html + Updated for OKI Dialogic ADPCM files. + + * src/command.c + Added VOX ADPCM to sub_fomats. + +2002-10-20 Erik de Castro Lopo + + * src/vox_adpcm.c src/Makefile.am + New file for handling OKI Dialogic ADPCM files. + + * src/sndfile.h + Add new subtype SF_FORMAT_VOX_ADPCM. + + * src/sndfile.c + Renamed function is_au_snd_file () to format_from_extenstion () and expanded + its functionality to detect headerless VOX files. + + * src/raw.c + Added hooks for SF_FORMAT_VOX_ADPCM. + + * examples/sndfile-info.c + Print out file duration (suggested by Conrad Parker). + + * libsndfile.spec.in + Force installation of sndfile.pc file (found by John Thompson). + + * tests/Makefile.am tests/lossy_comp_test.c tests/floating_point_test.c + Add tests for SF_FORMAT_VOX_ADPCM. + +2002-10-18 Erik de Castro Lopo + + * tests/misc_test.c + Add test which attempts to write to /dev/full (on Linux anyway) to check + for correct handling of writing to a full filesystem. + + * src/sndfile.c + Return correct error message if the header cannot be written because the + filesystem is full. + + * tests/util.tpl + Corrected printing of file mode in error reporting. + + * src/mat5.c + Fixed a bug where a MAT5 file written by libsndfile could not be opened by + Octave 2.1.36. + +2002-10-13 Erik de Castro Lopo + + * src/common.h src/file_io.c + All low level file I/O have been modified to be better able to report + system errors resulting from calling system level open/read/write etc. + + * src/*.c + Updated for compatibility with above changes. + + * examples/cooledit-fixer.c + New example program which fixes badly broken file created by Syntrillium's + Cooledit which are marked as containing PCM samples but actually contain + floating point data. + + * examples/Makefile.am + Hooked cooledit-fixer into the build system. + +2002-10-10 Erik de Castro Lopo + + * doc/command.html + Document SFC_GET_FORMAT_INFO. + +2002-10-09 Erik de Castro Lopo + + * examples/wav32_aiff24.c examples/sndfile2oct.c examples/sfhexdump.c + examples/sfdump.c + Removed these files because they weren't interesting. + + * examples/sfconvert.c examples/sndfile-convert.c + Renamed the first to the latter. + + * examples/Makefile.am + Added sndfile-convert to the bin_PROGRAMS, so it is installed when the lib + is installed. + Removed old programs wav32_aiff24 and sndfile2oct. + + * man/sndfile-convert.1 + New man page. + + * examples/sndfile-convert.c + Added some gloss now that sndfile-convert.c is an installed program. + + * src/sndfile.h.in src/sndfile.c src/common.h src/command.h + Added command SFC_GET_FORMAT_INFO. + + * tests/command_test.c + Added tests form SFC_GET_FORMAT_INFO. + +2002-10-08 Erik de Castro Lopo + + * src/sndfile.c + In sf_format_check() return error if samplerate < 0. + +2002-10-07 Erik de Castro Lopo + + * src/aiff.c + Fixed bug in handling of COMM chunks with a 4 byte encoding byte but no + encoding string. + +2002-10-06 Erik de Castro Lopo + + * src/sndfile.c + Fixed repeated word in an error message. + +2002-10-05 Erik de Castro Lopo + + * doc/index.html + Improved advertising in Features section. + +2002-10-04 Erik de Castro Lopo + + * src/wav.c + Added decoding of 'labl' chunks within 'LIST' chunks. + + * src/common.h + Added (experimental only) SF_FORMAT_OGG and SF_FORMAT_VORBIS and definition + of ogg_open(). This is nowhere near working yet. + + * src/sndfile.c + Added detection of 'OggS' file marker and added call to ogg_open() to + switch statement. + + * src/ogg.c + New file. Very early start of Ogg Vorbis support. + + * src/wav.c + Added handling of brain-damaged and broken Cooledit "32 bit 24.0 float + type 1" files. These files are marked as being 24 bit WAVE_FORMAT_PCM with + a block alignment of 4 times the numbers of channels but are in fact 32 bit + floating point. + +2002-10-02 Erik de Castro Lopo + + * configure.in + Modified option --enable-experimental to set ENABLE_EXPERIMENTAL_CODE in + config.h to either 0 or 1. + + * src/sndfile.c + Modify sf_command (SFC_GET_LIB_VERSION) to append "-exp" to the version + string if experimental code has been enabled. + +2002-10-01 Erik de Castro Lopo + + * src/Makefile.am + Added -lm to libsndfile_la_LIBADD. This means that -lm is not longer needed + in the link line when linking something to libsndfile. + + * tests/Makefile.am examples/Makefile.am + Removed -lm from all link lines. + + * sndfile.pc.in + Removed -lm from Libs line. + +2002-09-24 Erik de Castro Lopo + + * src/file_io.c + Removed all perror() calls. + + * src/nist.c + Removed calls to exit() function. + Added check to detect NIST files dammaged from Unix CR -> Win32 CRLF + conversion process. + +2002-09-24 Erik de Castro Lopo + + * src/sndfile.h.in src/sndfile.c + New function sf_strerror() which will eventually replace functions + sf_perror() and sf_error_str(). + Function sf_error_number() has also been changed, but this was documented + as being for testing only. + + * doc/api.html + Documented above changes. + + * tests/*.c examples/*.c + Changed to new error functions. + +2002-09-22 Erik de Castro Lopo + + * configure.in + Detect GCC version, and print a warning message about writeable strings + it GCC major version number is less than 3. + +2002-09-21 Erik de Castro Lopo + + * src/sndfile.h.in doc/api.html + Documentation fixes. + +2002-09-19 Erik de Castro Lopo + + * src/Version_script.in src/Makefile.am configure.in + Use the version script to prevent the exporting of all non public symbols. + This currently only works with Linux. Will test on Solaris as well. + + * src/float_cast.h + Added #ifndef to prevent the #warning directives killing the SGI MIPSpro + compiler. + + * src/au_g72x.c src/double64.c src/float32.c src/gsm610.c src/ima_adpcm.c + src/ms_adpcm.c + Fix benign compiler warnings arising from previously added compiler + flags. + +2002-09-18 Erik de Castro Lopo + + * src/sndfile.c + Fixed a bug in sf_error_str() where errnum was used as the index instead + of k. Found by Tim Hockin. + + * examples/sndfile-play.c + Fixed a compiler warning resulting from a variable shadowing a previously + defined local. + +2002-09-17 Erik de Castro Lopo + + * src/sndfile.h.in src/sndfile.c + Added command SFC_SET_RAW_START_OFFSET. + + * doc/command.html + Document SFC_SET_RAW_START_OFFSET. + + * tests/raw_test.c tests/Makefile.am + Add new file for for testing SF_FORMAT_RAW specific functionality. + + * tests/dwvw_test.c + Updates. + +2002-09-16 Erik de Castro Lopo + + * src/wav.c + Modified reading of 'smpl' chunk to take account of the sampler data field. + + * tests/utils.tpl tests/utils.h + Added function print_test_name(). + + * tests/misc_test.c tests/write_read_test.tpl tests/lossy_comp_test.c + tests/pcm_test.tpl tests/command_test.tpl tests/floating_point_test.c + Convert to use function print_test_name(). + +2002-09-15 Erik de Castro Lopo + + * doc/octave.html + Added a link to some other Octave scripts for reading and writing sound + files. + + * src/paf.c + Change type of dummy data field to int. This should fix a benign compiler + warning on some CPUs. + Removed superfluous casts resulting from the above change. + + * src/rx2.c + More hacking. + +2002-09-14 Erik de Castro Lopo + + * src/mat5.c src/common.c + Changed usage of snprintf() to LSF_SNPRINTF(). + + * Win32/Makefile.msvc + Updated to include new files and add new tests. + + * Win32/config.h Win32/sndfile.h + Updated. + + * doc/api.html + Added note about the possibility of "missing" features actually being + implemented as an sf_command(). + +2002-09-13 Erik de Castro Lopo + + * tests/misc_test.c + Added previously missing update_header_test and zero_data_tests for PAF, + MAT4 and MAT5 formats. + + * src/paf.c src/mat4.c src/mat5.c + Fixed bugs uncovered by new tests above. + + * src/mat5.c + Generalised parsing of name fields of MAT5 files. + + * src/mat5.c src/sndfile.c + Added support for unsigned 8 bit PCM MAT5 files. + + * tests/write_read_test.tpl + Added test for unsigned 8 bit PCM MAT5 files. + + * doc/index.html + Added unsigned 8 bit PCM MAT5 to capabilities matrix. + +2002-09-12 Erik de Castro Lopo + + * test/update_header_test.c tests/misc_test.c + Renamed update_header_test.c to misc_test.c. + Added zero_data_test() to check for case where file is opened for write and + closed immediately. The resulting file can be left in a state where + libsndfile cannot open it. Problem reported by Werner Schweer, the author + of Muse. + + * src/aiff.c + Removed superfluous cast. + + * src/wav.c src/svx.c + Fixed case of file generated with no data. + Removed superfluous cast. + + * src/sndfile.c + Fixed error on IA64 platform caused by incorrect termination of + SndfileErrors struct array. This problem was found in the Debian buildd + logs (http://buildd.debian.org/). + + * configure.in + Added Octave directory. + + * Octave/Makefile.ma + New Makfile.am for Octave directory. + + * Octave/sndfile_load.m Octave/sndfile_save.m Octave/sndfile_play.m + New files for working with Octave. + + * doc/octave.html + Document explaining the use of the above three Octave scripts. + +2002-09-10 Erik de Castro Lopo + + * src/sndfile.c + Fixed bug in RDWR mode. + +2002-09-09 Erik de Castro Lopo + + * src/common.c + Fixed psf_get_date_str() for systems which don't have gmtime_r() or + gmtime(). + + * src/file_io.c + Added #include for Win32. Reported by Koen Tanghe. + +2002-09-08 Erik de Castro Lopo + + * src/common.c + Added 'S' format specifier for psf_binheader_writef() which writes a C + string, including single null terminator to the header. + Added 'j' format specifier to allow jumping forwards or backwards in the + header. + Added function psf_get_date_str(). + + * src/mat5.c + Complete read and write support. + + * doc/index.html + Added entries for MAT4 and MAT5 in capabilities matrix. + +2002-09-06 Erik de Castro Lopo + + * src/mat4.c + Completed read and write support. + + * src/common.h src/sndfile.c + Added MAT4 and MAT5 specific error messages. + + * tests/write_read_test.tpl tests/Makefile.am + Added tests for MAT4 and MAT5 files. + + * tests/stdio_test.c tests/stdout_test.c tests/stdin_test.c + Added tests for MAT4 and MAT5 files. + +2002-09-05 Erik de Castro Lopo + + * src/command.c + Added elements for SF_FORMAT_MAT4 and SF_FORMAT_MAT5 to major_formats + array. + + * examples/sfconvert.c + Added mat4 and mat5 output targets. + +2002-09-04 Erik de Castro Lopo + + * src/sndfile.c + Added check to prevent errors openning read only formats for read/write. + + * src/interleave.c + New file for interleaving non-interleaved data. Non-interleaved data is + only supported on read. + + * src/Makefile.am + Added src/interleave.c to build. + +2002-09-03 Erik de Castro Lopo + + * src/double64.c src/common.h + Added double64_be_read(), double64_le_read(), double64_be_write() and + double64_le_write() which replace double64_read() and double64_write(). + + * src/common.c + Cleanup of psf_binheader_readf() and add ability to read big and little + endian doubles (required by mat4.c and mat5.c). + Add ability for psf_binheader_writef() to write doubles to sound file + headers. + +2002-09-01 Erik de Castro Lopo + + * src/mat5.c + New file for reading Matlab (tm) version 5 data files. This is also the + native binary file format for version 2.1.X of GNU Octave which will be + used for testing. + Not complete yet. + + * src/mat4.c + New file for reading Matlab (tm) version 4.2 data files. This is also the + native binary file format for version 2.0.X of GNU Octave which will be + used for testing. + Not complete yet. + + * src/sndfile.h.in src/sndfile.c src/common.h src/command.c src/Makefile.am + Mods to add Matlab files. + + * src/common.[ch] + Added readf_endian field to SF_PRIVATE struct allowing endianness to + remembered across calls to sf_binheader_readf(). + Fixed bug in width_specifier behaviour for printing hex values. + +2002-08-31 Erik de Castro Lopo + + * src/file_io.c + Check return value of close() call in psf_fclose(). + +2002-08-24 Erik de Castro Lopo + + * src/ms_adpcm.c + Commented out some code where 0x10000 was being subtracted from a short + and the result assigned to a short again. Andrew Zaja found this. + +2002-08-23 Erik de Castro Lopo + + * doc/command.html + Fixed typo found by Tommi Ilmonen. + + * src/ima_adpcm.c + Changed type of diff from short to int to prevent errors which can occur + during very rare circumstances. Thanks to FUWAFUWA. + +2002-08-16 Erik de Castro Lopo + + * tests/floating_point_test.c + Disable testing on machines without lrintf(). + + * Win32/Makefile.msvc + Added dwd.c and wve.c to build. + + * configure.in + Bumped version to 1.0.0. + +2002-08-15 Erik de Castro Lopo + + * src/file_io.c + Add a #include for Mac OS 9. Thanks to Stephane Letz. + + * src/wav.c + Changed an snprintf to LSF_SNPRINTF. + + * doc/Makefile.am + Added version-1.html. + +2002-08-14 Erik de Castro Lopo + + * configure.in + Bumped version to 1.0.rc6. + + * src/*.c + Modified scaling of normalised floats and doubles to integers. Until now + this has been done by multiplying by 0x8000 for short output, 0x80000000 + for 32 bit ints and so on. Unfortunately this can cause an overflow and + wrap around in the target value. All thes values have therefore been + reduced to 0x7FFF, 0x7FFFFFFF and so on. The conversion from ints to + normalised floats and doubles remains unchanged. This does mean that for + repeated conversions normalised float -> pcm16 -> normalised float would + result in a decrease in amplitude of 0x7FFF/0x8000 on every round trip. + This is undesirable but less undesireable than the wrap around I am trying + to avoid. + + * tests/floating_point_test.c + Removed file hash checking because new float scaling procedure introduced + above prevented the ability to crate a has on both x86 and PowerPC systems. + +2002-08-13 Erik de Castro Lopo + + * src/txw.c + Completed reading of TXW files. Seek doesn't work yet. + + * src/file_io.c + Added a MacOS 9 replacement for ftruncate(). + + * MacOS/sndfile.h + Added MacOS 9 header file. This should be copied into src/ to compile + libsndfile for MacOS9. + +2002-08-12 Erik de Castro Lopo + + * src/sndfile.c + Fixed commands SF_SET_NORM_DOUBLE and SFC_SET_NORM_FLOAT to return their + values after being set. Reported by Jussi Laako. + + * configure.in + If autogen is not found, touch all .c and .h files in tests/. + + * src/common.c + Added format width specifier to psf_log_printf() for %u, %d, %D and %X. + + * src/dwd.c + Completed implementation of read only access to these files. + + * src/common.h src/*.c src/pcm.c + Removed redundant field chars from SF_PRIVATE struct and modified + pcm_init() to do without it. + +2002-08-11 Erik de Castro Lopo + + * src/wve.c + New file implementing read of Psion Alaw files. This will be a read only + format. Implementation complete. + + * src/dwd/c + Started implementation of DiamondWare Digitized files. Also read only, not + complete. + + * src/wav.c + Add parsing of 'smpl' chunk. + + * src/paf.c + Fixed reading on un-normalized doubles and floats from 24 bit PAF files. + This brings it into line with the reading of 8 bit files into + un-normalized doubles which returns values in the range [-128, 127]. + + * src/common.c + Modified psf_log_printf() to accept the %% conversion specifier to allow + printing of a single '%'. + + * src/sds.c + Read only of 16 bit samples is working. Need to build a test harness for + this and other read only formats. + +2002-08-10 Erik de Castro Lopo + + * configure.in + Added --enable-experimental configure option. + Removed pkg-config message at the end of the configure process. + + * src/sds.c src/txw.c src/rx2.c src/sd2.c + Moved all the code in these files inside #if ENABLE_EXPERIMENTAL_CODE + blocks and added new *_open() function for the case where experimental is + not enabled. These new functions just return SFE_UNIMPLMENTED. + + * Win32/sndfile.h src/sndfile.h.in src/common.h + Removed un-necessary #pragma pack commands. + + * src/file_io.c + Implemented psf_ftruncate() and much other hacking for Win32. + + * Win32/Makefile.msvc + Updated. + + * doc/win32.html + Updated to include the copying of the sndfile.h file from the Win32/ + directory to the src/ directory. + + * Make.bat + Batch file to make compiling on Wi32 a little easier. Implements "make" and + "make check". + +2002-08-09 Erik de Castro Lopo + + * src/file_io.c + Add place holder for ftruncate() on Win32 which doesn't have ftruncate(). + This will need to be fixed later. + + * src/sndfile.h.in + New file (copy of sndfile.h) with sets up @TYPEOF_SF_COUNT_T@ which will be + replaced by the correct type during configure. + + * configure.in + Modified to find a good type for TYPEOF_SF_COUNT_T. + + * src/aiff.c + Fixed a bug when reading malformed headers. + + * src/common.c + Set read values to zero before performing read. + +2002-08-08 Erik de Castro Lopo + + * doc/command.html + Fixed some HTML tags which were not allowing jumps to links within the + page. + + * src/sds.c + Massive hacking on this. + + * src/wav.c + Added recognition of 'clm ' tag. + +2002-08-07 Erik de Castro Lopo + + * doc/index.html + Added beginning of a capabilities list beyond simple file formats which + can be read/written. + + * src/aiff.c + Added parsing of INST and MARK chunks of AIFF files. At the moment this + data is simply recorded in the log buffer. Later it will be possible to + read this data from an application using sf_command(). + + * src/wav.c + Added parsing of 'cue ' chunk which contains loop information in WAV files. + + * exampes/sndfile-info.c + Changed reporting of Samples to Frames. + + * src/wav.c src/w64.c src/aiff.c src/wav_w64.h + Moved from a samples to a frames nomenclature to avoid confusion. + + * doc/FAQ.html + What's the best format for storing temporary files? + + * src/sds.c + New file for reading/writing Midi Sample Dump Standard files. + + * src/Makefile.am src/sndfile.c src/common.[ch] + Added hooks for sds.c. + + * examples/sndfile-info.c + Changed from using sf_perror() to using sf_error_str(). + +2002-08-06 Erik de Castro Lopo + + * doc/api.html + Added explanation of mode parameter for sf_open(). + Added explanation of usage of SFM_* values in sf_seek(). + + * src/sndfile.[ch] src/command.c src/file_io.c src/common.h + Implemented SFC_FILE_TRUNCATE to allow a file to be truncated. File + truncation was suggested by James McCartney. + + * src/command.html + Documented SFC_FILE_TRUNCATE. + + * tests/command_test.c + Add tests for SFC_FILE_TRUNCATE. + + * src/sndfile.c + Added a thrid parameter to the VALIDATE_SNDFILE_AND_ASSIGN_PSF macro to + make resetting the error number optional. All uses of the macro other than + in error reporting functions were changed to reset the error number. + + * src/pcm.c + Fixed a bug were sf_read_* was logging an SFE_SHORT_READ even when no error + occurred. + + * tests/write_read_test.tpl + Added tests of internal error state. + +2002-08-05 Erik de Castro Lopo + + * src/GSM610/private.h src/GSM610/*.c src/GSM610/Makefile.am + Renamed private.h to gsm610_priv.h to prevent clash with other headers + named private.h in other directories. (Probably only a problem on MacOS 9). + + * src/G72x/private.h src/G72x/*.c src/G72x/Makefile.am + Renamed private.h to g72x_priv.h to prevent clash with other headers + named private.h in other directories. (Probably only a problem on MacOS 9). + + * MacOS/config.h + Changed values of HAVE_LRINT and HAVE_LRINTF to force use of code in + float_cash.h. + + * src/sndfile.h + Changes the name of samples field of the SF_INFO to frames. The old name + had caused too much confusion and it simply had to be changed. There will + be at least one more pre-release. + +2002-08-04 Erik de Castro Lopo + + * doc/index.html + Updated formats matrix to include RAW (header-less) GSM 6.10. + Fix specificaltion of table and spelling mistakes. + + * src/sndfile.c src/command.c + Fixed bug in SFC_CALC_MAX_SIGNAL family and psf_calc_signal_max (). + + * tests/command.c + Removed cruft. + Added test for SFC_CALC_MAX_SIGNAL and SFC_CALC_NORM_MAX_SIGNAL. + + * configure.in + Update version to 1.0.0rc5. + + * sfendian.h + Removed inclusion of un-necessary header. + +2002-08-03 Erik de Castro Lopo + + * src/aiff.c + Minor fixes of info written to log buffer. + + * src/float_cast.h + Add definition of HAVE_LRINT_REPLACEMENT. + + * tests/floating_point_test.c + Fix file hash check on systems without lrint/lrintf. + + * tests/dft_cmp.c + Limit SNR to less than -500.0dB. + + * examples/sndfile2oct.c + Fixed compiler warnings. + + * doc/api.html + Fixed error where last parameter of sf_error_str() was sf_count_t instead + of size_t. + +2002-08-02 Erik de Castro Lopo + + * doc/FAQ.html + Why doesn't libsndfile do interleaving/de-interleaving. + + * tests/pcm_test.tpl + On Win32 do not perform hash check on files containing doubles. + +2002-08-01 Erik de Castro Lopo + + * src/common.h + Defined SF_COUNT_MAX_POSITIVE() macro, a portable way of setting variables + of type sf_count_t to their maximum positive value. + + * src/dwvw.c src/w64.c + Used SF_COUNT_MAX_POSITIVE(). + +2002-07-31 Erik de Castro Lopo + + * src/paf.c + Fixed bug in reading/writing of 24 bit PCM PAF files on big endian systems. + + * tests/floating_point_tests.c + Fixed hash values for 24 bit PCM PAF files. + Disabled file has check if lrintf() function is not available and added + warning. + Decreased level of signal from a peak of 1.0 to a value of 0.95 to prevent + problems on platforms without lrintf() ie Solaris. + +2002-07-30 Erik de Castro Lopo + + * src/wav.c + Fixed a problem with two different kinds of mal-formed WAV file header. The + first had the 'fact' chunk before the 'fmt ' chunk, the other had an + incomplete 'INFO' chunk at the end of the file. + + * src/w64.c + Added fix to allow differentiation between W64 files and ACID files. + + * src/au_g72x.c src/common.h src/sndfile.c + Added error for G72x encoded files with more than one channel. + + * tests/pcm_test.tpl tests/utils.tpl + Moved function check_file_hash_or_die() to utils.tpl. Function was then + modified to calculate the has of the whole file. + + * src/wav.c + Fixed problem writing the 'fact' chunk on big endian systems. + + * tests/sfconvert.c + Fixed bug where .paf files were being written as Sphere NIST. + +2002-07-29 Erik de Castro Lopo + + * src/voc.c + Fix for reading headers generated using SFC_UPDATE_HEADER_NOW. + + * doc/command.html + Add docs for SFC_UPDATE_HEADER_NOW and SFC_SET_UPDATE_HEADER_AUTO. + +2002-07-28 Erik de Castro Lopo + + * man/sndfile-info.1 man/sndfile-play.1 + Added manpages supplied by Joshua Haberman the Debian maintainer for + libsndfile. Additional tweaks by me. + + * configure.in man/Makefile.am + Hooked manpages into autoconf/automake system. + + * src/sndfile.c + Added hooks for SFC_SET_UPDATE_HEADER_AUTO. + + * tests/update_header_test.c + Improved rigor of testing. + + * src/*.c + Fixed problem with *_write_header() functions. + +2002-07-27 Erik de Castro Lopo + + * doc/*.html + Updates to documentation to fix problems found by wdg-html-validator. + + * src/common.h src/command.c + Added normalize parameter to calls to psf_calc_signal_max() and + psf_calc_max_all_channels(). + + * src/sndfile.c + Added handling for commands SFC_CALC_NORM_SIGNAL_MAX and + SFC_CALC_NORM_MAX_ALL_CHANNELS. + + * doc/command.html + Added entry for SFC_CALC_NORM_SIGNAL_MAX and SFC_CALC_NORM_MAX_ALL_CHANNELS. + +2002-07-26 Erik de Castro Lopo + + * examples/sndfile-play.c Win32/Makefile.msvc + Get sndfile-play program working on Win32. The Win32 PCM sample I/O API + sucks. The sndfile-play program now works on Linux, MacOSX, Solaris and + Win32. + +2002-07-25 Erik de Castro Lopo + + * doc/FAQ.html + New file for frequently asked questsions. + +2002-07-22 Erik de Castro Lopo + + * doc/api.html + Documentation fixes. + + * src/au.[ch] src/au_g72x.c src/G72x/g72x.h + Add support of 40kbps G723 ADPCM encoding. + + * tests/lossy_comp_test.c tests/floating_point_test.c + Add tests for 40kbps G723 ADPCM encoding. + + * doc/index.html + Update support matrix. + +2002-07-21 Erik de Castro Lopo + + * doc/command.html + Documented SFC_GET_SIMPLE_FORMAT_COUNT, SFC_GET_SIMPLE_FORMAT, + SFC_GET_FORMAT_* and SFC_SET_ADD_PEAK_CHUNK. + + * src/sndfile.c src/pcm.c + Add ability to turn on and off the addition of a PEAK chunk for floating + point WAV and AIFF files. + + * src/sndfile.[ch] src/common.h src/command.c + Added sf_command SFC_CALC_MAX_ALL_CHANNELS. Implemented by Maurizio Umberto + Puxeddu. + + * doc/command.html + Docs for SFC_CALC_MAX_ALL_CHANNELS (assisted by Maurizio Umberto Puxeddu). + +2002-07-18 Erik de Castro Lopo + + * src/sndfile.c src/gsm610.c + Finalised support for GSM 6.10 AIFF files and added support for GSM 6.10 + encoded RAW (header-less) files. + + * src/wav.c + Add support for IBM_FORMAT_MULAW and IBM_FORMAT_ALAW encodings. + + * src/api.html + Fixed more documentation bugs. + +2002-07-17 Erik de Castro Lopo + + * src/sndfile.h src/common.h + Moved some yet-to-be-implelmented values for SF_FORMAT_* from the public + header file sndfile.h to the private header file common.h to avoid + confusion about the actual capabilities of libsndfile. + +2002-07-16 Erik de Castro Lopo + + * src/aiff.c src/wav.c + Fixed file parsing for WAV and AIFF files containing non-audio data after + the data chunk. + + * src/aiff.c src/sndfile.c + Add support for GSM 6.10 encoded AIFF files. + + * tests/lossy_comp_test.c tests/Makefile.am + Add tests for GSM 6.10 encoded AIFF files. + + * src/*.c + Fix compiler warnings. + +2002-07-15 Erik de Castro Lopo + + * tests/command_test.c + For SFC_SET_NORM_* tests, change the file format from SF_FORMAT_WAV to + SF_FORMAT_RAW. + + * src/sndfile.c + Added sf_command(SFC_TEST_ADD_TRAILING_DATA) to allow testing of reading + from AIFF and WAV files with non-audio data after the audio chunk. + + * src/common.h + Add test commands SFC_TEST_WAV_ADD_INFO_CHUNK and + SFC_TEST_AIFF_ADD_INST_CHUNK. When these commands are working, they will be + moved to src/sndfile.h + + * src/aiff.c src/wav.c + Begin implementation of XXXX_command() hook for sf_command(). + + * tests/write_read_test.tpl + Added sf_command (SFC_TEST_ADD_TRAILING_DATA) to ensure above new code was + working. + +2002-07-13 Erik de Castro Lopo + + * tests/update_header_test.c + Allow read sample count == write sample count - 1 to fix problems with VOC + files. + + * tests/write_read_test.tpl tests/pcm_test.tpl + Fixed some problems in the test suite discovered by using Valgrind. + +2002-07-12 Erik de Castro Lopo + + * tests/utils.[ch] tests/*.c + Renamed check_log_buffer() to check_log_buffer_or_die(). + + * src/sndfile.c + SFC_UPDATE_HEADER_NOW and SFC_SETUPDATE_HEADER_AUTO almost finished. Works + for all file formats other than VOC. + +2002-07-11 Erik de Castro Lopo + + * src/sndfile.[ch] src/common.h + Started adding functionality to allow the file header to be updated before + the file is closed on files open for SFM_WRITE. This was requested by + Maurizio Umberto Puxeddu who is using libsndfile for file I/O in iCSound. + + * tests/update_header_test.c + New test program to test that the above functionality is working correctly. + + * tests/peak_chunk_test.c tests/floating_point_test.c + Cleanups. + +2002-07-10 Erik de Castro Lopo + + * src/sfendian.[ch] + Changed length count parameters for all endswap_XXX() functions from + sf_count_t (which can be 64 bit even on 32 bit architectures) to int. These + functions are only called frin inside the library, are always called with + integer parameters and doing the actual calculation on 64 bit values is + slow in comparision to doing it on ints. + + * examples/sndfile-play.c + More playback hacking for Win32. + +2002-07-09 Erik de Castro Lopo + + * src/common.c + In psf_log_printf(), changed %D format conversion specifier to %M (marker) and + added %D specifier for printing the sf_count_t type. + + * src/*.c + Changed all usage of psf_log_printf() with %D format conversion specifiers + to use %M conversion instead. + + * tests/pcm_test.tpl tests/pcm_test.def + New files to autogen pcm_test.c. + + * src/pcm.c + Fixed bug in scaling floats and doubles to 24 bit PCM and vice versa. + +2002-07-08 Erik de Castro Lopo + + * configure.in + Fix setup of $ac_cv_sys_largefile_CFLAGS so that sndfile.pc gets valid + values for CFLAGS. + + * examples/sndfile-play.c + Start adding playback support for Win32. + +2002-07-07 Erik de Castro Lopo + + * src/*.c + Worked to removed compiler warnings. + Extensive refactoring. + + * src/common.[ch] + Added function psf_memset() which works like the standard C function memset + but takes and sf_count_t as the length parameter. + + * src/sndfile.c + Replaced calls to memset(0 with calls to psf_memset() as required. + +2002-07-06 Erik de Castro Lopo + + * src/sndfile.c + Added "libsndfile : " to the start of all error messages. This was suggested + by Conrad Parker author of Sweep ( http://sweep.sourceforge.net/ ). + + * src/sfendian.[ch] + Added endswap_XXXX_copy() functions. + + * src/pcm.c src/float32.c src/double64.c + Use endswap_XXXX_copy() functions and removed dead code. + Cleanups and optimisations. + +2002-07-05 Erik de Castro Lopo + + * src/sndfile.c src/sndfile.h + Gave values to all the SFC_* enum values to allow better control of the + interface as commands are added and removed. + Added new command SFC_SET_ADD_PEAK_CHUNK. + + * src/wav.c src/aiff.c + Modified wav_write_header and aiff_write_header to make addition of a PEAK + chunk optional, even on floating point files. + + * tests/benchmark.tpl + Added call to sf_command(SFC_SET_ADD_PEAK_CHUNK) to turn off addition of a + PEAK chunk for the benchmark where we are trying to miximize speed. + + * src.pcm.c + Changed tribyte typedef to something more sensible. + Further conversion speed ups. + +2002-07-03 Erik de Castro Lopo + + * src/command.c + In major_formats rename "Sphere NIST" to "NIST Sphere". + + * src/common.c src/sfendian.c + Moved all endswap_XXX_array() functions to sfendian.c. These functions will + be tweaked to provide maximum performance. Since maximum performance on one + platform does not guarantee maximum performance on another, a small set of + functions will be written and the optimal one chosen at compile time. + + * src/common.h src/sfendian.h + Declarations of all endswap_XXX_array() functions moved to sfendian.h. + + * src/Makefile.am + Add sfendian.c to build targets. + +2002-07-01 Erik de Castro Lopo + + * src/pcm.c src/sfendian.h + Re-coded PCM encoders and decoders to match or better the speed of + libsndfile version 0.0.28. + +2002-06-30 Erik de Castro Lopo + + * src/wav.c + Add checking for WAVPACK data in standard PCM WAV file. Return error if + found. This WAVPACK is *WAY* broken. It uses the same PCM WAV file header + and then stores non-PCM data. + + * tests/benchmark.tpl + Added more tests. + +2002-06-29 Erik de Castro Lopo + + * tests/benchmark.tpl + Added conditional definition of M_PI. + For Win32, set WRITE_PERMS to 0777. + + * Win32/Makefile.msvc + Added target to make generate program on Win32. + + * src/samplitude.c + Removed handler for Samplitude RAP file format. This file type seems rarer + than hens teeth and is completely undocumented. + + * src/common.h src/sndfile.c src/Makefile.am Win32/Makefile.msvc + Removed references to sampltiude RAP format. + + * tests/benchmark.tpl + Benchmark program now prints the libsndfile version number when run. This + program was also backported to version 0 to compare results. Version + 1.0.0rc2 is faster than version 0.0.28 on most conversions but slower on + some. The slow ones need to be fixed before final release. + +2002-06-28 Erik de Castro Lopo + + * tests/benchmark.def tests/benchmark.tpl + New files which generate tests/benchmark.c using Autogen. Added int -> + SF_FORMAT_PCM_24 test. + + * tests/benchmark.c + Now and Autogen output file. + + * tests/Makefile.am + Updated for above changes. + +2002-06-27 Erik de Castro Lopo + + * tests/benchmark.c + Basic benchmark program complete. Need to convert it to Autogen. + + * Win32/Makefile.msvc + Added benchmark.exe target. + +2002-06-26 Erik de Castro Lopo + + * examples/generate.c + New program to generate a number of different output file formats from a + single input file. This allows testing of the created files. + + * tests/benchmark.c + New test program to benchmark libsndfile. Nowhere near complete yet. + + * examples/Makefile.am tests/Makefile.am + New make rules for the two new programs. + +2002-06-25 Erik de Castro Lopo + + * Win32/libsndfile.def + Removed definition for sf_signal_max(). + + * src/sndfile.c + Removed cruft. + + * doc/index.html + A number of documentation bugs were fixed. Thanks to Anand Kumria. + + * doc/version-1.html + Minor doc updates. + + * configure.in + Bumped version to 1.0.0rc2. + + * src/sf_command.h src/Makefile.am + Removed the header file as it was no longer being used. Thanks to Anand + Kunria for spotting this. + + * doc/index.html + A number of documentation bugs were fixed. Thanks to Anand Kumria. + +2002-06-24 Erik de Castro Lopo + + * src/common.h + Test for Win32 before testing SIZEOF_OFF_T so that it works correctly + on Win32.. + + * src/file_io.c + Win32 fixes to ensure O_BINARY is used for file open. + + * doc/win32.html + New file documenting the building libsndfile on Win32. + + * doc/*.html + Updating of documentation. + +2002-06-23 Erik de Castro Lopo + + * tests/pcm_test.c + Minor changes to allow easier determination of test file name. + + * src/sndfile.[ch] + Removed function sf_signal_max(). + + * examples/sndfile-play.c + Changed call to sf_signal_max() to a call to sf_command(). + +2002-06-22 Erik de Castro Lopo + + * src/format.c src/command.c + Renamed format.c to command.c which will now include code for sf_command() + calls to perform operations other than format commands. + + * src/sndfile.c src/sndfile.h + Removed function sf_get_signal_max() which is replaced by commands passed + to sf_command(). + + * src/command.c + Implement commands SFC_CALC_SIGNAL_MAX. + + * doc/command.html + Documented SFC_CALC_SIGNAL_MAX. + +2002-06-21 Erik de Castro Lopo + + * examples/sndfile-play.c + Mods to make sndfile-play work on Solaris. The program sndfile-play now + runs on Linux, MaxOSX and Solaris. Win32 to come. + + * src/format.c + Added SF_FORMAT_DWVW_* to subtype_formats array. + + * src/nist.c + Added support for 8 bit NIST Sphere files. Example file supplied by Anand + Kumria. + +2002-06-20 Erik de Castro Lopo + + * examples/sndfile-info.c + Tidy up of output format. + + * examnples/sndfile-play.c + Mods to make sndfile-play work on MacOSX using Apple's CoreAudio API. + + * configure.in + Add new variables OS_SPECIFIC_INCLUDES and OS_SPECIFIC_LINKS which were + required to supply extra include paths and link parameters to get + sndfile-play working on MacOSX. + + * examples/Makefile.am + Use OS_SPOECIFIC_INCLUDES and OS_SPECIFIC_LINKS to build commands for + sndfile-play. + +2002-06-19 Erik de Castro Lopo + + * src/nist.c + Added ability to read/write new NIST Sphere file types (A-law, u-law). + Header parser was re-written from scratch. Example files supplied by Anand + Kumria. + + * src/sndfile.c + Support for A-law and u-law NIST files. + + * tests/Makefile.am tests/lossy_comp_test.c + Tests for A-law and u-law NIST files. + +2002-06-18 Erik de Castro Lopo + + * tests/utils.c + Fixed an error in error string. + +2002-06-17 Erik de Castro Lopo + + * acinclude.m4 + Removed exit command to allow cross-compiling. + + * Win32/unistd.h src/file_io.c + Moved contents of first file into the second file (enclosed in #ifdef). + Win32/unistd.h is now an empty file but still must be there for libsndfile + to compile on Win32. + + * src/sd2.c, src/sndfile.c: + Fixes for Sound Designer II files on big endian systems. + +2002-06-16 Erik de Castro Lopo + + * configure.in + Modified to work around problems with crappy MacOSX version of sed. + Added sanity check for proper values for CFLAGS. + +2002-06-14 Erik de Castro Lopo + + * src/sndfile.c + Code clean up in sf_open (). + + * Win32/Makefile.msvc + Michael Fink's contributed MSVC++ makefile was hacked to bits and put back + together in a new improved form. + + * src/file_io.c + Fixes for Win32; _lseeki64() returns an invalid argument for calls like + _lseeki64(fd, 0, SEEK_CUR) so need to use _telli64 (fd) instead. + + * src/common.h src/sndfile.c src/wav.c src/aiff.c + Added SFE_LOG_OVERRUN error. + Added termination for potential infinite loop when parsing file headers. + + * src/wav.c src/w64.c + Fixed bug casuing incorrect header generation when opening file read/write. + +2002-06-12 Erik de Castro Lopo + + * doc/api.html + Improved the documentation to make it clearer that the file read method + and the underlying file format are completely disconnected. Suggested + by Josh Green. + + * doc/command.html + Started correcting docs to take into account changes made to the + operations of the sf_command () function. Not complete yet. + + * src/sndfile.c + Reverted some changes which had broken the partially working SDII header + parsing. Now have access to an iBook with OS X so reading and writing SDII + files on all platforms should be a reality in the near future. On Mac this + will involve reading the resource fork via the standard MacOS API. To move + a file from Mac to another OS, the resource and data forks will need to be + combined before transfer. The combined file will be read on both Mac and + other OSes like any other file. + +2002-06-08 Erik de Castro Lopo + + * ltmain.sh + Applied a patch from http://fink.sourceforge.net/doc/porting/libtool.php + which allows libsndfile to compile on MacOSX 10.1. This patch should not + interfere with compiling on other OSes. + + * src/GSM610/private.h + Changes to fix compile problems on MacOSX (see src/GSM610/ChangeLog). + + * src/float_cast.h + Added MacOSX replacements for lrint() and lrintf(). + +2002-06-05 Erik de Castro Lopo + + * src/sndfile.c + Replaced the code to print the filename to the log buffer when a file is + opened. This code seems to have been left out during the merge of + sf_open_read() and sf_open_write() to make a single functions sf_open(). + +2002-06-01 Erik de Castro Lopo + + * src/wav.c + Fixed a bug where the WAV header parser was going into an infinite loop + on a badly formed LIST chunk. File supplied by David Viens. + +2002-05-25 Erik de Castro Lopo + + * configure.in + Added a message at the end of the configuration process to warn about the + need for the use of pkg-config when linking programs against version 1 of + libsndfile. + + * doc/pkg-config.html + New documentation file containing details of how to use pkg-config to + retrieve settings for CFLAGS and library locations for linking files + against version 1 of libsndfile. + +2002-05-17 Erik de Castro Lopo + + * src/wav.c + Fixed minor bug in handling of so-called ACIDized WAV files. + +2002-05-16 Erik de Castro Lopo + + * Win32/libsndfile.def Win32/Makefile.msvc + Two new files contributed by Michael Fink (from the winLAME project) + which allows libsndfile to be built on windows in a MSDOS box by doing + "nmake -f Makefile.msvc". Way cool! + +2002-05-15 Erik de Castro Lopo + + * configure.in + MacOSX is SSSOOOOOOO screwed up!!! I can't believe how hard it is to + generate a tarball which will configure and compile on that platform. + Joined the libtool mailing list to try and get some answers. + +2002-05-13 Erik de Castro Lopo + + * configure.in + Changed to autoconf version 2.50. MacOSX uses autoconf version 2.53 which + is incompatible with with version 2.13 which had been using until now. + The AC_SYS_LARGE_FILE macro distributed withe autoconf 2.50 is missing a + few features so AC_SYS_EXTRA_LARGE file was defined to replace it. + + * configure.in + Changed to automake version 1.5 to try and make a tarball which will + work on MacOSX. + +2002-05-12 Erik de Castro Lopo + + * src/wav_gsm610.c + Changed name to gsm610.c. Added reading/writing of headerless files. + + * src/sndfile.c src/raw.c + Added ability to read/write headerless (SF_FORMAT_RAW) GSM 6.10 files. + +2002-05-11 Erik de Castro Lopo + + * tests/lossy_comp_test.c + Clean up in preparation for Autogen-ing this file. + + * src/GSM610/*.[ch] + Code cleanup and prepartion forgetting file seek working. Details in + src/GSM610/ChangeLog. + + * sndfile.pc.in + Testing complete. Is sndfile.m4 still needed? + +2002-05-09 Erik de Castro Lopo + + * tests/write_read_test.tpl tests/rdwr_test.tpl + Merged tests from these two programs into write_read_test.tpl and deleted + rdwr_test.tpl. + +2002-05-08 Erik de Castro Lopo + + * src/w64.c src/svx.c src/paf.c + Fixed bugs in read/write mode. + +2002-05-07 Erik de Castro Lopo + + * examples/Makefile.am + Renamed sfplay.c to sndfile-play.c and sndfile_info.c to sndfile-info.c for + consistency when these programs become part of the Debian package + sndfile-programs. + + * sndfile.pc.in + New file to replace sndfile-config.in. Libsndfile now uses the pkg-config + model for providing installation parameters to dependant programs. + + * src/sndfile.c + Cleanup of code in sf_open(). + +2002-05-06 Erik de Castro Lopo + + * tests/utils.tpl tests/write_read_test.tpl + More conversion to Autogen fixes and enchancements. + + * src/*.c + Read/write mode is now working for 16, 24 and 32 bit PCM as well as 32 + bit float and 64 bit double data. More tests still required. + + * src/Makefile.am + Added DISTCLEANFILES target to remove config.status and config.last. + + * Win32/Makefile.am MacOS/Makefile.am + Added DISTCLEANFILES target to remove Makefile. + +2002-05-05 Erik de Castro Lopo + + * src/*.[ch] tests/rdwr_test.c + More verifying workings of read/write mode. Fixing bugs found. + + * tests/utils.[ch] + Made these files Autogen generated files. + + * tests/util.tpl tests/util.def + New Autogen files to generate utils.[ch]. Moved some generic test functions + into this file. Autogen is such a great tool! + +2002-05-03 Erik de Castro Lopo + + * src/pcm.c src/float_cast.h Win32/config.h + Fixed a couple of Win32 specific bugs pointed out by Michael Fink + (maintainer of WinLAME) and David Viens. + + * tests/check_log_buffer.[ch] tests/utils.[ch] + Moved check_log_buffer() to utils.[ch] and deleted old file. + +2002-05-02 Erik de Castro Lopo + + * src/common.[ch] src/sndfile.c + New function psf_default_seek() which will be the default seek function + for things like PCM and floating point data. This default is set for + both read and write in sf_open() but can be over-ridden by any codec + during it's initialisation. + +2002-05-01 Erik de Castro Lopo + + * src/au.c + AU files use a data size value of -1 to mean unknown. Fixed au_open_read() + to allow opening files like this. + + * tests/rdwr_test .c + Added more tests. + + * src/sndfile.c + Fixed bugs in read/write mode found due to improvements in the test + program. + +2002-04-30 Erik de Castro Lopo + + * tests/rdwr_test .c + New file for testing read/write mode. + +2002-04-29 Erik de Castro Lopo + + * m4/* + Removed all m4 macros from this directory as they get concatenated to form + the file aclocal.m4 anyway. + + * sndfile.m4 + Moved this from the m4 directory to the root directory asn this is part of + the distribution and is installed during "make install". + +2002-04-29 Erik de Castro Lopo + + * src/float32.c + Removed logging of peaks for all file formats other than AIFF and WAV. + + * tests/write_read_test.tpl tests/write_read_test.def + New files which autogen uses to generate write_read_test.c. Doing it this + way makes write_read_test.c far easier to maintain. Other test programs + will be converted to autogen in the near future. + + * src/*.c + Fixed a few bugs found when testing on Sparc (bug endian) Solaris. + +2002-04-28 Erik de Castro Lopo + + * doc/*.html + Fixed documention versioning. + + * configure.in + Fixed a bug in the routines which search for Large File Support on systems + which have large file support by defualt. + +2002-04-27 Erik de Castro Lopo + + * src/*.[ch] + Found and fixed an issue which can cause a bug in other software (I was + porting Conrad Parker's Sweep program from version 0 of the library to + version 1). When opening a file for write, the libsndfile code would + set the sfinfo.samples field to a maximum value. + + * tests/write_read_test.c + Added tests to detect the above problem. + +2002-04-25 Erik de Castro Lopo + + * src/*.[ch] + Finished base implementation of read/write mode. Much more testing still + needed. + + * m4/largefile.m4 + Macro for detecting Large File Standard capabilities. This macro was ripped + out of the aclocal.m4 file of GNU tar-1.13. + + * configure.in + Added detection of large file support. Files larger than 2 Gigabytes should + now be supported on 64 bit platforms and many 32 bit platforms including + Linux (2.4 kernel, glibc-2.2), *BSD, MacOS, Win32. + + * libsndfile_convert_version.py + A Python script which attempts to autoconvert code written to use version 0 + to version 1. + +2002-04-24 Erik de Castro Lopo + + * src/*.[ch] + Finished base implementation of read/write mode. Much more testing still + needed. + + * tests/write_read_test.c + Preliminary tests for read/write mode added. More needed. + +2002-04-20 Erik de Castro Lopo + + * src/sndfile.[ch] + Removed sf_open_read() and sf_open_write() functions,replacting them with + sf_open() which takes an extra mode parameter (SF_OPEN_READ, SF_OPEN_WRITE, + or SF_OPEN_RDWR). This new function sf_open can now be modified to allow + opening a file formodification (RDWR). + +2002-04-19 Erik de Castro Lopo + + * src/*.c + Completed merging of separate xxx_open_read() and xxx_open_write() + functions. All tests pass. + +2002-04-18 Erik de Castro Lopo + + * src/au.c + Massive refactoring required to merge au_open_read() with au_open_write() + to create au_open(). + +2002-04-17 Erik de Castro Lopo + + * src/*.c + Started changes required to allow a sound file to be opened in read/write + mode, with separate file pointers for read and write. This involves merging + of encoder/decoder functions like pcm_read_init() and pcm_write_init() + int a new function pcm_init() as well as doing something similar for all + the file type specific functions ie aiff_open_read() and aiff_open_write() + were merged to make the function aiff_open(). + +2002-04-15 Erik de Castro Lopo + + * src/file_io.c + New file containing psf_fopen(), psf_fread(), psf_fwrite(), psf_fseek() and + psf_ftell() functions. These function will replace use of fopen/fread/fwrite + etc and allow access to files larger than 2 gigabytes on a number of 32 bit + OSes (Linux on x86, 32 bit Solaris user space apps, Win32 and MacOS). + + * src/*.c + Replaced all instances of fopen with psf_open, fread with psd_read, fwrite + with psf_write and so on. + +2002-03-11 Erik de Castro Lopo + + * src/dwvw.c + Finally fixed all known problems with 12, 16 and 24 bit DWVW encoding. + + * tests/floating_point_test.c + Added tests for 12, 16 and 24 bit DWVW encoding. + +2002-03-03 Erik de Castro Lopo + + * m4/endian.m4 + Defines a new m4 macro AC_C_FIND_ENDIAN, for determining the endian-ness of + the target CPU. It first checks for the definition of BYTE_ORDER in + , then in and . If none of these work + and the C compiler is not a cross compiler it compiles and runs a program + to test for endian-ness. If the compiler is a cross compiler it makes a + guess based on $target_cpu. + + * configure.in + Modified to use AC_C_FIND_ENDIAN. + + * src/sfendian.h + Simplified. + +2002-02-23 Erik de Castro Lopo + + * tests/floating_point_test.c + Tests completely rewritten using the dft_cmp function. Now able to + calculate a quick guesstimate of the Signal to Noise Ratio of the encoder. + +2002-02-15 Erik de Castro Lopo + + * tests/dft_cmp.[ch] + New files containing functions for comparing pre and post lossily + compressed data using a quickly hacked DFT. + + * tests/utils.[ch] + New files containing functions for saving pre and post encoded data in a + file readable by the GNU Octave package. + +2002-02-13 Erik de Castro Lopo + + * m4/lrint.m4 m4/lrintf.m4 + Fixed m4 macros to define HAVE_LRINT and HAVE_LRINTF even when the test + is cached. + +2002-02-12 Erik de Castro Lopo + + * tests/floating_point_test.c + Fixed improper use of strncat (). + +2002-02-11 Erik de Castro Lopo + + * tests/headerless_test.c + New test program to test the ability to open and read a known file type as a + RAW header-less file. + +2002-02-07 Erik de Castro Lopo + + * tests/losy_comp_test.c + Added a test to ensure that the data read from a file is not all zeros. + + * examples/sfconvert.c + Added "-gsm610" encoding types. + +2002-01-29 Erik de Castro Lopo + + * examples/sfconvert.c + Added "-dwvw12", "-dwvw16" and "-dwvw24" encoding types. + + * tests/dwvw_test.c + New file for testing DWVW encoder/decoder. + +2002-01-28 Erik de Castro Lopo + + * src/dwvw.c + Implemented writing of DWVW. 12 bit seems to work, 16 and 24 bit still broken. + + * src/aiff.c + Improved reporting of encoding types. + + * src/voc.c + Clean up. + +2002-01-27 Erik de Castro Lopo + + * src/dwvw.c + New file implementing lossless Delta Word Variable Width (DWVW) encoding. + Reading 12 bit DWVW is now working. + + * src/aiff.c common.h sndfile.c + Added hooks for DWVW encoded AIFF and RAW files. + +2002-01-15 Erik de Castro Lopo + + * src/w64.c + Robustify header parsing. + + * src/wav_w64.h + Header file wav.h was renamed to wav_w64.h to signify sharing of + definitions across the two file types. + + * src/wav.c src/w64.c src/wav_w64.c + Refactoring. + Modified and moved functions with a high degree of similarity between + wav.c and w64.c to wav_w64.c. + +2002-01-14 Erik de Castro Lopo + + * src/w64.c + Completed work on getting read and write working. + + * examples/sfplay.c + Added code to scale floating point data so it plays at a reasonable volume. + + * tests/Makefile.am tests/write_read_test.c + Added tests for W64 files. + +2002-01-13 Erik de Castro Lopo + + * src/*.c + Modded all code in file header writing routines to use + psf_new_binheader_writef(). + Removed psf_binheader_writef() from src/common.c. + Globally replaced psf_new_binheader_writef with psf_binheader_writef. + +2002-01-12 Erik de Castro Lopo + + * src/*.c + Modded all code in file parsing routines to use psf_new_binheader_readf(). + Removed psf_binheader_readf() from src/common.c. + Globally replaced psf_new_binheader_readf with psf_binheader_readf. + + * src/common.[ch] + Added new function psf_new_binheader_writef () which will soon replace + psf_binheader_writef (). The new function has basically the same function + as the original but has a more flexible and capable interface. It also + allows the writing of 64 bit integer values for files contains 64 bit file + offsets. + +2002-01-11 Erik de Castro Lopo + + * src/formats.c src/sndfile.c src/sndfile.h + Added code allowing full enumeration of supported file formats via the + sf_command () interface. + This feature will allow applications to avoid needing recompilation when + support for new file formats are added to libsndfile. + + * tests/command_test.c + Added test code for the above feature. + + * examples/list_formats.c + New file. An example of the use of the supported file enumeration + interface. This program lists all the major formats and for each major + format the supported subformats. + +2002-01-10 Erik de Castro Lopo + + * src/*.[ch] tests/*.c + Changed command parameter of sf_command () function from a test string to + an int. The valid values for the command parameter begin with SFC_ and are + listed in src/sndfile.h. + +2001-12-20 Erik de Castro Lopo + + * src/formats.c src/sndfile.c + Added an way of enumerating a set of common file formats using the + sf_command () interface. This interface was suggested by Dominic Mazzoni, + one of the main authors of Audacity (http://audacity.sourceforge.net/). + +2001-12-26 Erik de Castro Lopo + + * src/sndfile.c + Added checking of filename parameter in sf_open_read (). Previousy, if a + NULL pointer was passed the library would segfault. + +2001-12-18 Erik de Castro Lopo + + * src/common.c src/common.h + Changed the len parameter of the endswap_*_array () functions from type + int to type long. + + * src/pcm.c + Fixed a problem which + +2001-12-15 Erik de Castro Lopo + + * src/sndfile.c + Added conditional #include for EMX/gcc on OS/2. Thanks to + Paul Hartman for pointing this out. + + * tests/lossy_comp_test.c tests/floating_point_test.c + Added definitions for M_PI for when it isn't defined in . + +2001-11-30 Erik de Castro Lopo + + * src/ircam.c + Re-implemented the header reader. Old version was making incorrect + assumptions about the endian-ness of the file from the magic number at the + start of the file. The new code looks at the integer which holds the + number of channels and determines the endian-ness from that. + +2001-11-30 Erik de Castro Lopo + + * src/aiff.c + Added support for other AIFC types ('raw ', 'in32', '23ni'). + Further work on IMA ADPCM encoding. + +2001-11-29 Erik de Castro Lopo + + * src/ima_adpcm.c + Renamed from wav_ima_adpcm.c. This file will soon handle IMA ADPCM + encodings for both WAV and AIFF files. + + * src/aiff.c + Started adding IMA ADPCM support. + +2001-11-28 Erik de Castro Lopo + + * src/double.c + New file for handling double precision floating point (SF_FORMAT_DOUBLE) + data. + + * src/wav.c src/aiff.c src/au.c src/raw.c + Added support for SF_FORMAT_DOUBLE data. + + * src/common.[ch] + Addition of endswap_long_array () for endian swapping 64 bit integers. This + function will work correctly on processors with 32 bit and 64 bit longs. + Optimised endswap_short_array () and endswap_int_array (). + + * tests/pcm_test.c + Added and extra check. After the first file of each type is written to disk + a checksum is performed of the first 64 bytes and checked against a pre- + calculated value. This will work whatever the endian-ness of the host + machine. + +2001-11-27 Erik de Castro Lopo + + * src/aiff.c + Added handling of u-law, A-law encoded AIFF files. Thanks to Tom Erbe for + supplying example files. + + * tests/lossy_comp_test.c + Added tests for above. + + * src/common.h src/*.c + Removed function typedefs from common.h and function pointer casting in all + the other files. This allows the compiler to perform proper type checking. + Hopefully this will prevernt problems like the sf_seek bug for OpenBSD, + BeOS etc. + + * src/common.[ch] + Added new function psf_new_binheader_readf () which will eventually replace + psf_binheader_readf (). The new function has basically the same function as + the original but has a more flexible and capable interface. It also allows + the reading of 64 bit integer values for files contains 64 bit file + offsets. + +2001-11-26 Erik de Castro Lopo + + * src/voc.c + Completed implementation of VOC file handling. Can now handle 8 and 16 bit + PCM, u-law and A-law files with one or two channels. + + * src/write_read_test.c tests/lossy_comp_test.c + Added tests for VOC files. + +2001-11-22 Erik de Castro Lopo + + * src/float_cast.h + Added inline asm version of lrint/lrintf for MacOS. Solution provided by + Stephane Letz. + + * src/voc.c + More work on this braindamaged format. The VOC files produced by SoX also + have a number of inconsistencies. + +2001-11-19 Erik de Castro Lopo + + * src/paf.c + Added support for 8 bit PCM PAF files. + + * tests/write_read_test.c + Added tests for 8 bit PAF files. + +2001-11-18 Erik de Castro Lopo + + * tests/pcm_test.c + New test program to test for correct scaling of integer values between + different sized integer containers (ie short -> int). + The new specs for libsndfile state that when the source and destination + containers are of a different size, the most significant bit of the source + value becomes the most significant bit of the destination container. + + * src/pcm.c src/paf.c + Modified to pass the above test program. + + * tests/write_read_test.c tests/lossy_comp_test.c + Modified to work with the new scaling rules. + +2001-11-17 Erik de Castro Lopo + + * src/raw.c tests/write_read_test.c tests/write_read_test.c + Added ability to do raw reads/writes of float, u-law and A-law files. + + * src/*.[ch] examples/*.[ch] tests/*.[ch] + Removed dependance on pcmbitwidth field of SF_INFO struct and moved to new + SF_FORMAT_* types and use of SF_ENDIAN_BIG/LITTLE/CPU. + +2001-11-12 Erik de Castro Lopo + + * src/*.[ch] + Started implmentation of major changes documented in doc/version1.html. + + Removed all usage of off_t which is not part of the ISO C standard. All + places which were using it are now using type long which is the type of + the offset parameter for the fseek function. + This should fix problems on BeOS, MacOS and *BSD like systems which were + failing "make check" because sizeof (long) != sizeof (off_t). + +-------------------------------------------------------------------------------- +This is the boundary between version 1 of the library above and version 0 below. +-------------------------------------------------------------------------------- + +2001-11-11 Erik de Castro Lopo + + * examples/sfplay_beos.cpp + Added BeOS version of sfplay.c. This needs to be compiled using a C++ + compiler so is therefore not built by default. Thanks to Marcus Overhagen + for providing this. + +2001-11-10 Erik de Castro Lopo + + * examples/sfplay.c + New example file showing how libsndfile can be used to read and play a + sound file. + At the moment on Linux is supported. Others will follow in the near future. + +2001-11-09 Erik de Castro Lopo + + * src/pcm.c + Fixed problem with normalisation code where a value of 1.0 could map to + a value greater than MAX_SHORT or MAX_INT. Thanks to Roger Dannenberg for + pointing this out. + +2001-11-08 Erik de Castro Lopo + + * src/pcm.c + Fixed scaling issue when reading/writing 8 bit files using + sf_read/sf_write_short (). + On read, values are scaled so that the most significant bit in the char + ends up in the most significant bit of the short. On write, values are + scaled so that most significant bit in the short ends up as the most + significant bit in the char. + +2001-11-07 Erik de Castro Lopo + + * src/au.c src/sndfile.c + Added support for 32 bit float data in big and little endian AU files. + + * tests/write_read_test.c + Added tests for 32 bit float data in AU files. + +2001-11-06 Erik de Castro Lopo + + * tests/lossy_comp_test.c + Finalised testing of stereo files where possible. + +2001-11-05 Erik de Castro Lopo + + * src/wav_ms_adpcm.c + Fixed bug in writing stereo MS ADPCM WAV files. Thanks to Xu Xin for + pointing out this problem. + +2001-10-24 Erik de Castro Lopo + + * src/wav_ms_adpcm.c + Modified function srate2blocksize () to handle 44k1Hz stereo files. + +2001-10-21 Erik de Castro Lopo + + * src/w64.c + Added support for Sonic Foundry 64 bit WAV format. As Linux (my main + development platform) does not yet support 64 bit file offsets by default, + current handling of this file format treats everything as 32 bit and fails + openning the file, if it finds anything that goes beyond 32 bit values. + + * src/sndfile.[hc] src/common.h src/Makefile.am + Added hooks for W64 support. + +2001-10-21 Erik de Castro Lopo + + * configure.in + Added more warnings options to CFLAGS when the gcc compiler is detected. + + * src/*.[ch] tests/*.c examples/*.c + Started fixing the warning messages due to the new CFLASG. + + * src/voc.c + More work on VOC file read/writing. + + * src/paf.c + Found that PAF files were not checking the normalisation flag when reading + or writing floats and doubles. Fixed it. + + * tests/floating_point_test.c + Added specific test for the above problem. + + * src/float_cast.h src/pcm.c + Added a section for Win32 to define lrint () and lrintf () in the header + and implement it in the pcm.c + +2001-10-20 Erik de Castro Lopo + + * sndfile-config.in m4/sndfile.m4 + These files were donated by Conrad Parker who also provided instructions + on how to install them using autoconf/automake. + + * src/float_cast.h + Fiddled around with this file some more. On Linux and other gcc supported + OSes use the C99 functions lrintf() and lrint() for casting from floating + point to int without incurring the huge perfromance penalty (particularly + on the i386 family) caused by the regular C cast from float to int. + These new C99 functions replace the FLOAT_TO_* and DOUBLE_TO_* macros which + I had been playing with. + + * configure.in m4/lrint.m4 m4/lrintf.m4 + Add detection of these functions. + +2001-10-17 Erik de Castro Lopo + + * src/voc.c + Completed code for reading VOC files containing a single audio data + segment. + Started implementing code to handle files with multiple VOC_SOUND_DATA + segments but couldn't be bothered finishing it. Multiple segment files can + have different sample rates for different sections and other nasties like + silence and repeat segments. + +2001-10-16 Erik de Castro Lopo + + * src/common.h src/*.c + Removed SF_PRIVATE struct field fdata and replaced it with extra_data. + + * src/voc.c + Further development of the read part of this woefult file format. + +2001-10-04 Erik de Castro Lopo + + * src/float_cast.h + Implemented gcc and i386 floating point to int cast macros. Standard cast + will be used when not on gcc for i385. + + * src/pcm.c + Modified all uses of FLOAT/DOUBLE_TO_INT and FLOAT/DOUBLE_TO_SHORT casts to + comply with macros in float_cast.h. + +2001-10-04 Erik de Castro Lopo + + * src/voc.c + Changed the TYPE_xxx enum names to VOC_TYPE_xxx to prevent name clashes + on MacOS with CodeWarrior 6.0. + + * MacOS/MacOS-readme.txt + Updated the compile instructions. Probably still need work as I don't have + access to a Mac. + +2001-10-01 Erik de Castro Lopo + + * src/wav.c src/aiff.c common.c + Changed all references to snprintf to LSF_SNPRINTF and all vsnprintf to + LSF_VSNPRINTF. LSF_VSNPRINTF and LSF_VSNPRINTF are defined in common.h. + + * src/common.h + Added checking of HAVE_SNPRINTF and HAVE_VSNPRINTF and defining + LSF_VSNPRINTF and LSF_VSNPRINTF to appropriate values. + + * src/missing.c + New file containing a minimal implementation of snprintf and vsnprintf + functions named missing_snprintf and missing_vsnprintf respectively. These + are only compliled into the binary if snprintf and/or vsnprintf are not + available. + +2001-09-29 Erik de Castro Lopo + + * src/ircam.c + New file to handle Berkeley/IRCAM/CARL files. + + * src/sndfile.c src/common.h + Modified for IRCAM handling. + + * tests/*.c + Added tests for IRCAM files. + +2001-09-27 Erik de Castro Lopo + + * src/wav.c + Apparently microsoft windows (tm) doesn't like ulaw and Alaw WAV files with + 20 byte format chunks (contrary to ms's own documentation). Fixed the WAV + header writing code to generate smaller ms compliant ulaw and Alaw WAV + files. + +2001-09-17 Erik de Castro Lopo + + * tests/stdio_test.sh tests/stdio_test.c + Shell script was rewritten as a C program due to incompatibilities of the + sh shell on Linux and Solaris. + +2001-09-16 Erik de Castro Lopo + + * tests/stdio_test.sh tests/stdout_test.c tests/stdin_test.c + New test programs to verify the correct operation of reading from stdin and + writing to stdout. + + * src/sndfile.c wav.c au.c nist.c paf.c + Fixed a bugs uncovered by the new test programs above. + +2001-09-15 Erik de Castro Lopo + + * src/sndfile.c wav.c + Fixed a bug preventing reading a file from stdin. Found by T. Narita. + +2001-09-12 Erik de Castro Lopo + + * src/common.h + Fixed a problem on OpenBSD 2.9 which was causing sf_seek() to fail on IMA + WAV files. Root cause was the declaration of the func_seek typedef not + matching the functions it was actually being used to point to. In OpenBSD + sizeof (off_t) != sizeof (int). Thanks to Heikki Korpela for allowing me + to log into his OpenBSD machine to debug this problem. + +2001-09-03 Erik de Castro Lopo + + * src/sndfile.c + Implemented sf_command ("norm float"). + + * src/*.c + Implemented handling of sf_command ("set-norm-float"). Float normalization + can now be turned on and off. + + * tests/double_test.c + Renamed to floating_point_test.c. Modified to include tests for all scaled + reads and writes of floats and doubles. + + * src/au_g72x.c + Fixed bug in normalization code found with improved floating_point_test + program. + + * src/wav.c + Added code for parsing 'INFO' and 'LIST' chunks. Will be used for extract + text annotations from WAV files. + + * src/aiff.c + Added code for parsing '(c) ' and 'ANNO' chunks. Will be used for extract + text annotations from WAV files. + +2001-09-02 Erik de Castro Lopo + + * examples/sf_info.c example/Makefile.am + Renamed to sndfile_info.c. The program sndfile_info will now be installed + when the library is installed. + + * src/float_cast.h + New file defining floating point to short and int casts. These casts will + eventually replace all flot and double casts to short and int. See comments + at the top of the file for the reasoning. + + * src/*.c + Changed all default float and double casts to short or int with macros + defined in floatcast.h. At the moment these casts do nothing. They will be + replaced with faster float to int cast operations in the near future. + +2001-08-31 Erik de Castro Lopo + + * tests/command_test.c + New file for testing sf_command () functionality. + + * src/sndfile.c + Revisiting of error return values of some functions. + Started implementing sf_command () a new function will allow on-the-fly + modification of library behaviour, or instance, sample value scaling. + + * src/common.h + Added hook for format specific sf_command () calls to SNDFILE struct. + + * doc/api.html + Updated and errors corrected. + + * doc/command.html + New documentation file explaining new sf_command () function. + +2001-08-11 Erik de Castro Lopo + + * src/sndfile.c + Fixed error return values from sf_read*() and sf_write*(). There were + numerous instances of -1 being returned through size_t. These now all set + error int the SF_PRIVATE struct and return 0. Thanks to David Viens for + spotting this. + +2001-08-01 Erik de Castro Lopo + + * src/common.c + Fixed use of va_arg() calls that were causing warning messages with the + latest version of gcc (thanks Maurizio Umberto Puxeddu). + +2001-07-25 Erik de Castro Lopo + + * src/*.c src/sfendian.h + Moved definition of MAKE_MARKER macro to sfendian.h + +2001-07-23 Erik de Castro Lopo + + * src/sndfile.c + Modified sf_get_lib_version () so that version string will be visible using + the Unix strings command. + + * examples/Makefile.am examples/sfinfo.c + Renamed sfinfo program and source code to sf_info. This prevents a name + clash with the program included with libaudiofile. + +2001-07-22 Erik de Castro Lopo + + * tests/read_seek_test.c tests/lossy_comp_test.c + Added tests for sf_read_float () and sf_readf_float (). + + * src/voc.c + New files for handling Creative Voice files (not complete). + + * src/samplitude.c + New files for handling Samplitude files (not complete). + +2001-07-21 Erik de Castro Lopo + + * src/aiff.c src/au.c src/paf.c src/svx.c src/wav.c + Converted these files to using psf_binheader_readf() function. Will soon be + ready to attempt to make reading writing from pipes work reliably. + + * src/*.[ch] + Added code for sf_read_float () and sf_readf_float () methods of accessing + file data. + +2001-07-20 Erik de Castro Lopo + + * src/paf.c src/wav_gsm610.c + Removed two printf()s which had escaped notice for some time (thanks + Sigbjørn Skjæret). + +2001-07-19 Erik de Castro Lopo + + * src/wav_gsm610.c + Fixed a bug which prevented GSM 6.10 encoded WAV files generated by + libsndfile from being played in Windoze (thanks klay). + +2001-07-18 Erik de Castro Lopo + + * src/common.[ch] + Implemented psf_binheader_readf() which will do for file header reading what + psf_binheader_writef() did for writing headers. Will eventually allow + libsndfile to read and write from pipes, including named pipes. + +2001-07-16 Erik de Castro Lopo + + * MacOS/config.h Win32/config.h + Attempted to bring these two files uptodate with src/config.h. As I don't + have access to either of these systems support for them may be completely + broken. + +2001-06-18 Erik de Castro Lopo + + * src/float32.c + Fixed bug for big endian processors that can't read 32 bit IEEE floats. Now + tested on Intel x86 and UltraSparc processors. + +2001-06-13 Erik de Castro Lopo + + * src/aiff.c + Modified to allow REX files (from Propellorhead's Recycle and Reason + programs) to be read. + REX files are basically an AIFF file with slightly unusual sequence of + chunks (AIFF files are supposed to allow any sequence) and some extra + application specific information. + Not yet able to write a REX file as the details of the application specific + data is unknown. + +2001-06-12 Erik de Castro Lopo + + * src/wav.c + Fixed endian bug when reading PEAK chunk on big endian machines. + + * src/common.c + Fixed endian bug when reading PEAK chunk on big endian machines with + --enable-force-broken-float configure option. + Fix psf_binheader_writef for (FORCE_BROKEN_FLOAT ||______) + +2001-06-07 Erik de Castro Lopo + + * configure.in src/config.h.in + Removed old CAN_READ_WRITE_x86_IEEE configure variable now that float + capabilities are detected at run time. + Added FORCE_BROKEN_FLOAT to allow testing of broken float code on machines + where the processor can in fact handle floats correctly. + + * src/float32.c + Rejigged code reading and writing of floats on broken processors. + + * m4/ + Removed this directory and all its files as they are no longer needed. + +2001-06-05 Erik de Castro Lopo + + * tests/peak_chunk_test.c + New test to validate reading and writing of peak chunk. + + * examples/sfconvert + Added -float32 option. + + * src/*.c + Changed all error return values to negative values (ie the negative of what + they were). + + * src/sndfile.c tests/error_test.c + Modified to take account of the previous change. + +2001-06-04 Erik de Castro Lopo + + * src/float32.c + File renamed from wav_float.c and renamed function to something more + general. + Added runtime detection of floating point capabilities. + Added recording of peaks during write for generation of PEAK chunk. + + * src/wav.c src/aiff.c + Added handing for PEAK chunk for floating point files. PEAK is read when the + file headers are read and generated when the file is closed. Logic is in + place for adding PEAK chunk to end of file when writing to a pipe (reading + and writing from/to pipe to be implemented soon). + + * src/sndfile.c + Modified sf_signal_max () to use PEAK values if present. + +2001-06-03 Erik de Castro Lopo + + * src/*.c + Added pcm_read_init () and pcm_write_init () to src/pcm.c and removed all + other calls to functions in this file from the filetype specific files. + + * src/*.c + Added alaw_read_init (), alaw_write_int (), ulaw_read_init () and + ulaw_write_init () and removed all other calls to functions in alaw.c and + ulaw.c from the filetype specific files. + + * tests/write_read_test.c + Added tests to validate sf_seek () on all file types. + + * src/raw.c + Implemented raw_seek () function to fix a bug where + sf_seek (file, 0, SEEK_SET) on a RAW file failed. + + * src/paf.c + Fixed a bug in paf24_seek () found due to added seeks tests in + tests/write_read_test.c + +2001-06-01 Erik de Castro Lopo + + * tests/read_seek_test.c + Fixed a couple of broken binary files. + + * src/aiff.c src/wav.c + Added handling of PEAK chunks on file read. + +2001-05-31 Erik de Castro Lopo + + * check_libsndfile.py + New file for the regression testing of libsndfile. + check_libsndfile.py is a Python script which reads in a file containing + filenames of audio files. Each file is checked by running the examples/sfinfo + program on them and checking for error or warning messages in the libsndfile + log buffer. + + * check_libsndfile.list + This is an example list of audio files for use with check_libsndfile.py + + * tests/lossy_comp_test.c + Changed the defined value of M_PI for math header files which don't have it. + This fixed validation test failures on MetroWerks compilers. Thanks to Lord + Praetor Satanus of Acheron for bringing this to my attention. + +2001-05-30 Erik de Castro Lopo + + * src/common.[ch] + Removed psf_header_setf () which was no longer required after refactoring + and simplification of header writing. + Added 'z' format specifier to psf_binheader_writef () for zero filling header + with N bytes. Used by paf.c and nist.c + + * tests/check_log_buffer.c + New file implementing check_log_buffer () which reads the log buffer of a + SNDFILE* object and searches for error and warning messages. Calls exit () + if any are found. + + * tests/*.c + Added calls to check_log_buffer () after each call to sf_open_XXX (). + +2001-05-29 Erik de Castro Lopo + + * src/wav.c src/wav_ms_adpcm.c src/wav_gsm610.c + Major rehack of header writing using psf_binheader_writef (). + +2001-05-28 Erik de Castro Lopo + + * src/wav.c src/wav_ima_adpcm.c + Major rehack of header writing using psf_binheader_writef (). + +2001-05-27 Erik de Castro Lopo + + * src/wav.c + Changed return type of get_encoding_str () to prevent compiler warnings on + Mac OSX. + + * src/aiff.c src/au.c + Major rehack of header writing using psf_binheader_writef (). + +2001-05-25 Erik de Castro Lopo + + * src/common.h src/common.c + Added comments. + Name of log buffer changed from strbuffer to logbuffer. + Name of log buffer index variable changed from strindex to logindex. + + * src/*.[ch] + Changed name of internal logging function from psf_sprintf () to + psf_log_printf (). + Changed name of internal header generation functions from + psf_[ab]h_printf () to psf_asciiheader_printf () and + psf_binheader_writef (). + Changed name of internal header manipulation function psf_hsetf () to + psf_header_setf (). + +2001-05-24 Erik de Castro Lopo + + * src/nist.c + Fixed reading and writing of sample_byte_format header. "01" means little + endian and "10" means big endian regardless of bit width. + + * configure.in + Detect Mac OSX and disable -Wall and -pedantic gcc options. Mac OSX is + way screwed up and spews out buckets of warning messages from the system + headers. + Added --disable-gcc-opt configure option (sets gcc optimisation to -O0 ) for + easier debugging. + Made decision to harmonise source code version number and .so library + version number. Future releases will stick to this rule. + + * doc/new_file_type.HOWTO + New file to document the addition of new file types to libsndfile. + +2001-05-23 Erik de Castro Lopo + + * src/nist.c + New file for reading/writing Sphere NIST audio file format. + Originally requested by Elis Pomales in 1999. + Retrieved from unstable (and untouched for 18 months) branch of libsndfile. + Some vital information gleaned from the source code to Bill Schottstaedt's + sndlib library : ftp://ccrma-ftp.stanford.edu/pub/Lisp/sndlib.tar.gz + Currently reading and writing 16, 24 and 32 bit, big-endian and little + endian, stereo and mono files. + + * src/common.h src/common.c + Added psf_ah_printf () function to help construction of ASCII headers (ie NIST). + + * configure.in + Added test for vsnprintf () required by psf_ah_printf (). + + * tests/write_read_test.c + Added tests for supported NIST files. + +2001-05-22 Erik de Castro Lopo + + * tests/write_read_test.c + Added tests for little endian AIFC files. + + * src/aiff.c + Minor re-working of aiff_open_write (). + Added write support for little endian PCM encoded AIFC files. + +2001-05-13 Erik de Castro Lopo + + * src/aiff.c + Minor re-working of aiff_open_read (). + Added read support for little endian PCM encoded AIFC files from the Mac + OSX CD ripper program. Guillaume Lessard provided a couple of sample files + and a working patch. + The patch was not used as is but gave a good guide as to what to do. + +2001-05-11 Erik de Castro Lopo + + * src/sndfile.h + Fixed comments about endian-ness of WAV and AIFF files. Guillaume Lessard + pointed out the error. + +2001-04-23 Erik de Castro Lopo + + * examples/make_sine.c + Re-write of this example using sample rate and required frequency in Hz. + +2001-02-11 Erik de Castro Lopo + + * src/sndfile.c + Fixed bug that prevented known file types from being read as RAW PCM data. + +2000-12-16 Erik de Castro Lopo + + * src/aiff.c + Added handing of COMT chunk. + +2000-11-16 Erik de Castro Lopo + + * examples/sfconvert.c + Fixed bug in normalisatio code. Pointed out by Johnny Wu. + +2000-11-08 Erik de Castro Lopo + + * Win32/config.h + Fixed the incorrect setting of HAVE_ENDIAN_H parameter. Win32 only issue. + +2000-10-27 Erik de Castro Lopo + + * tests/Makefile.am + Added -lm for write_read_test_LDADD. + +2000-10-16 Erik de Castro Lopo + + * src/sndfile.c src/au.c + Fixed bug which prevented writing of G723 24kbps AU files. + + * tests/lossy_comp_test.c + Corrrection to options for G723 tests. + + * configure.in + Added --disable-gcc-pipe option for DJGPP compiler (gcc on MS-DOS) which + doesn't allow gcc -pipe option. + +2000-09-03 Erik de Castro Lopo + + * src/ulaw.c src/alaw.c src/wav_imaadpcm.c src/msadpcm.c src/wav_gsm610.c + Fixed normailsation bugs shown up by new double_test program. + +2000-08-31 Erik de Castro Lopo + + * src/pcm.c + Fixed bug in normalisation code (spotted by Steve Lhomme). + + * tests/double_test.c + New file to test scaled and unscaled sf_read_double() and sf_write_double() + functions. + +2000-08-28 Erik de Castro Lopo + + * COPYING + Changed to the LGPL COPYING file (spotted by H. S. Teoh). + +2000-08-21 Erik de Castro Lopo + + * src/sndfile.h + Removed prototype of unimplemented function sf_get_info(). Added prototype + for sf_error_number() Thanks to Sigbjørn Skjæret for spotting these. + +2000-08-18 Erik de Castro Lopo + + * src/newpcm.h + New file to contain a complete rewrite of the PCM data handling. + +2000-08-15 Erik de Castro Lopo + + * src/sndfile.c + Fixed a leak of FILE* pointers in sf_open_write(). Thanks to Sigbjørn + Skjæret for spotting this one. + +2000-08-13 Erik de Castro Lopo + + * src/au_g72x.c src/G72x/g72x.c + Added G723 encoded AU file support. + + * tests/lossy_comp_test.c + Added tests for G721 and G723 encoded AU files. + +2000-08-06 Erik de Castro Lopo + + * all files + Changed the license to LGPL. Albert Faber who had copyright on + Win32/unistd.h gave his permission to change the license on that file. All + other files were either copyright erikd AT mega-nerd DOT com or copyright + under a GPL/LGPL compatible license. + +2000-08-06 Erik de Castro Lopo + + * tests/lossy_comp_test.c + Fixed incorrect error message. + + * src/au_g72x.c src/G72x/* + G721 encoded AU files now working. + + * Win32/README-Win32.txt + Replaced this file with a new one which gives a full explanation + of how to build libsndfile under Win32. Thanks to Mike Ricos. + +2000-08-05 Erik de Castro Lopo + + * src/*.[ch] + Removed double leading underscores from the start of all variable and + function names. Identifiers with a leading underscores are reserved + for use by the compiler. + + * src/au_g72x.c src/G72x/* + Continued work on G721 encoded AU files. + +2000-07-12 Erik de Castro Lopo + + * src/G72x/* + New files for reading/writing G721 and G723 ADPCM audio. These files + are from a Sun Microsystems reference implementation released under a + free software licence. + Extensive changes to this code to make it fit in with libsndfile. + See the ChangeLog in this directory for details. + + * src/au_g72x.c + New file for G721 encoded AU files. + +2000-07-08 Erik de Castro Lopo + + * libsndfile.spec.in + Added a spec file for making RPMs. Thanks to Josh Green for supplying this. + +2000-06-28 Erik de Castro Lopo + + * src/sndfile.c src/sndfile.h + Add checking for and handling of header-less u-law encoded AU/SND files. + Any file with a ".au" or ".snd" file extension and without the normal + AU file header is treated as an 8kHz, u-law encoded file. + + * src/au.h + New function for opening a headerless u-law encoded file for read. + +2000-06-04 Erik de Castro Lopo + + * src/paf.c + Add checking for files shorter than minimal PAF file header length. + +2000-06-02 Erik de Castro Lopo + + * tests/write_read_test.c + Added extra sf_perror() calls when sf_write_XXXX fails. + +2000-05-29 Erik de Castro Lopo + + * src/common.c + Modified usage of va_arg() macro to work correctly on PowerPC + Linux. Thanks to Kyle Wheeler for giving me ssh access to his + machine while I was trying to track this down. + + * configure.in src/*.[ch] + Sorted out some endian-ness issues brought up by PowerPC Linux. + + * tests/read_seek_test.c + Added extra debugging for when tests fail. + +2000-05-18 Erik de Castro Lopo + + * src/wav.c + Fixed bug in GSM 6.10 handling for big-endian machines. Thanks + to Sigbjørn Skjæret for reporting this. + +2000-04-25 Erik de Castro Lopo + + * src/sndfile.c src/wav.c src/wav_gsm610.c + Finallised writing of GSM 6.10 WAV files. + + * tests/lossy_comp_test.c + Wrote new test code for GSM 6.10 files. + + * examples/sfinfo.c + Fixed incorrect format in printf() statement. + +2000-04-06 Erik de Castro Lopo + + * src/sndfile.h.in + Fixed comments about sf_perror () and sf_error_str (). + +2000-03-14 Erik de Castro Lopo + + * configure.in + Fixed --enable-justsrc option. + +2000-03-07 Erik de Castro Lopo + + * wav.c + Fixed checking of bytespersec field of header. Still some weirdness + with some files. + +2000-03-05 Erik de Castro Lopo + + * tests/lossy_comp_test.c + Added option to test PCM WAV files (sanity check). + Fixed bug in sf_seek() tests. + +2000-02-29 Erik de Castro Lopo + + * src/sndfile.c src/wav.c + Minor changes to allow writing of GSM 6.10 WAV files. + +2000-02-28 Erik de Castro Lopo + + * configure.in Makefile.am src/Makefile.am + Finally got around to figuring out how to build a single library from + multiple source directories. + Reading GSM 6.10 files now seems to work. + +2000-01-03 Erik de Castro Lopo + + * src/wav.c + Added more error reporting in read_fmt_chunk(). + +1999-12-21 Erik de Castro Lopo + + * examples/sfinfo.c + Modified program to accept multiple filenames from the command line. + +1999-11-27 Erik de Castro Lopo + + * src/wav_ima_adpcm.c + Moved code around in preparation to adding ability to read/write IMA ADPCM + encoded AIFF files. + +1999-11-16 Erik de Castro Lopo + + * src/common.c + Fixed put_int() and put_short() macros used by _psf_hprintf() which were + causing seg. faults on Sparc Solaris. + +1999-11-15 Erik de Castro Lopo + + * src/common.c + Added string.h to includes. Thanks to Sigbjxrn Skjfret. + + * src/svx.c + Fixed __svx_close() function to ensure FORM and BODY chunks are correctly + set. + +1999-10-01 Erik de Castro Lopo + + * src/au.c + Fixed handling of incorrect size field in AU header on read. Thanks to + Christoph Lauer for finding this problem. + +1999-09-28 Erik de Castro Lopo + + * src/aiff.c + Fixed a bug with incorrect SSND chunk length being written. This also lead + to finding an minor error in AIFF header parsing. Thanks to Dan Timis for + pointing this out. + +1999-09-24 Erik de Castro Lopo + + * src/paf.c + Fixed a bug with reading and writing 24 bit stereo PAF files. This problem + came to light when implementing tests for the new functions which operate + in terms of frames rather than items. + +1999-09-23 Erik de Castro Lopo + + * src/sndfile.c + Modified file type detection to use first 12 bytes of file rather than + file name extension. Required this because NIST files use the same + filename extension as Microsoft WAV files. + + * src/sndfile.c src/sndfile.h + Added short, int and double read/write functions which work in frames + rather than items. This was originally suggested by Maurizio Umberto + Puxeddu. + +1999-09-22 Erik de Castro Lopo + + * src/svx.c + Finished off implementation of write using __psf_hprintf(). + +1999-09-21 Erik de Castro Lopo + + * src/common.h + Added a buffer to SF_PRIVATE for writing the header. This is required + to make generating headers for IFF/SVX files easier as well as making + it easier to do re-write the headers which will be required when + sf_rewrite_header() is implemented. + + * src/common.c + Implemented __psf_hprintf() function. This is an internal function + which is documented briefly just above the code. + +1999-09-05 Erik de Castro Lopo + + * src/sndfile.c + Fixed a bug in sf_write_raw() where it was returning incorrect values + (thanks to Richard Dobson for finding this one). Must put in a test + routine for sf_read_raw and sf_write_raw. + + * src/aiff.c + Fixed default FORMsize in __aiff_open_write (). + + * src/sndfile.c + Added copy of filename to internal data structure. IFF/SVX files + contain a NAME header chunk. Both sf_open_read() and sf_open_write() + copy the file name (less the leading path information) to the + filename field. + + * src/svx.c + Started implementing writing of files. + +1999-08-04 Erik de Castro Lopo + + * src/svx.c + New file for reading/writing 8SVX and 16SVX files. + + * src/sndfile.[ch] src/common.h + Changes for SVX files. + + * src/aiff.c + Fixed header parsing when unknown chunk is found. + +1999-08-01 Erik de Castro Lopo + + * src/paf.c + New file for reading/writing Ensoniq PARIS audio file format. + + * src/sndfile.[ch] src/common.h + Changes for PAF files. + + * src/sndfile.[ch] + Added stuff for sf_get_lib_version() function. + + +1999-07-31 Erik de Castro Lopo + + * src/sndfile.h MacOS/config.h + Fixed minor MacOS configuration issues. + +1999-07-30 Erik de Castro Lopo + + * MacOS/ + Added a new directory for the MacOS config.h file and the + readme file. + + * src/aiff.c + Fixed calculation of datalength when reading SSND chunk. Thanks to + Sigbjørn Skjæret for pointing out this error. + +1999-07-29 Erik de Castro Lopo + + * src/sndfile.c src/sndfile.h src/raw.c + Further fixing of #includes for MacOS. + +1999-07-25 Erik de Castro Lopo + + * src/wav.c src/aiff.c + Added call to ferror () in main header parsing loop of __XXX_open_read + functions. This should fix problems on platforms (MacOS, AmigaOS) where + fseek()ing or fread()ing beyond the end of the file puts the FILE* + stream in an error state until clearerr() is called. + + * tests/write_read_test.c + Added tests for RAW header-less PCM files. + + * src/common.h + Moved definition of struct tribyte to pcm.c which is the only place + which needs it. + + * src/pcm.c + Modified all code which assumed sizeof (struct tribyte) == 3. This code + did not work on MacOS. Thanks to Ben "Jacobs" for pointing this out. + + * src/au.c + Removed from list of #includes (not being used). + + * src/sndfile.c + Added MacOS specific #ifdef to replace . + + * src/sndfile.h + Added MacOS specific #ifdef to replace . + + * src/sndfile.h + Added MacOS specific typedef for off_t. + + * MacOS-readme.txt + New file with instructions for building libsndfile under MacOS. Thanks + to Ben "Jacobs" for supplying these instructions. + +1999-07-24 Erik de Castro Lopo + + * configure.in + Removed sndfile.h from generated file list as there were no longer + any autoconf substitutions being made. + + * src/raw.c + New file for handling raw header-less PCM files. In order to open these + for read, the user must specify format, pcmbitwidth and channels in the + SF_INFO struct when calling sf_open_read (). + + * src/sndfile.c + Added support for raw header-less PCM files. + +1999-07-22 Erik de Castro Lopo + + * examples/sfinfo.c + Removed options so the sfinfo program always prints out all the information. + +1999-07-19 Erik de Castro Lopo + + * src/alaw.c + New file for A-law encoding (similar to u-law). + + * tests/alaw_test.c + New test program to test the A-law encode/decode lookup tables. + + * tests/lossy_comp_test.c + Added tests for a-law encoded WAV, AU and AULE files. + +1999-07-18 Erik de Castro Lopo + + * src/sndfile.c src/au.c + Removed second "#include ". Thanks to Ben "Jacobs" for pointing + this out. + +1999-07-18 Erik de Castro Lopo + + * tests/ulaw_test.c + New test program to test the u-law encode/decode lookup tables. + +1999-07-16 Erik de Castro Lopo + + * src/sndfile.h + Made corrections to comments on the return values from sf_seek (). + + * src/sndfile.c + Fixed boundary condition checking bug and accounting bug in sf_read_raw (). + +1999-07-15 Erik de Castro Lopo + + * src/au.c src/ulaw.c + Finished implementation of u-law encoded AU files. + + * src/wav.c + Implemented reading and writing of u-law encoded WAV files. + + * tests/ + Changed name of adpcm_test.c to lossy_comp_test.c. This test program + will now be used to test Ulaw and Alaw encoding as well as APDCM. + Added tests for Ulaw encoded WAV files. + +1999-07-14 Erik de Castro Lopo + + * tests/adpcm_test.c + Initialised amp variable in gen_signal() to remove compiler warning. + +1999-07-12 Erik de Castro Lopo + + * src/aiff.c + In __aiff_open_read () prevented fseek()ing beyond end of file which + was causing trouble on MacOS with the MetroWerks compiler. Thanks to + Ben "Jacobs" for pointing this out. + + *src/wav.c + Fixed as above in __wav_open_read (). + +1999-07-01 Erik de Castro Lopo + + * src/wav_ms_adpcm.c + Implemented MS ADPCM encoding. Code cleanup of decoder. + + * tests/adpcm_test.c + Added tests for MS ADPCM WAV files. + + * src/wav_ima_adpcm.c + Fixed incorrect parameter in call to srate2blocksize () from + __ima_writer_init (). + +1999-06-23 Erik de Castro Lopo + + * tests/read_seek_test.c + Added test for 8 bit AIFF files. + +1999-06-18 Erik de Castro Lopo + + * tests/write_read_test.c + Removed test for IMA ADPCM WAV files which is now done in adpcm_test.c + + * configure.in + Added -Wconversion to CFLAGS. + + * src/*.c tests/*.c examples/*.c + Fixed all warnings resulting from use of -Wconversion. + +1999-06-17 Erik de Castro Lopo + + * src/wav.c + Added fact chunk handling on read and write for all non WAVE_FORMAT_PCM + WAV files. + + * src/wav_ima.c + Changed block alignment to be dependant on sample rate. This should make + WAV files created with libsndfile compatible with the MS Windows media + players. + + * tests/adpcm_test.c + Reimplemented adpcm_test_short and implemented adpcm_test_int and + adpcm_test_double. + Now have full testing of IMA ADPCM WAV file read, write and seek. + +1999-06-15 Erik de Castro Lopo + + * src/wav_float.c + Fixed function prototype for x86f2d_array () which was causing ocassional + seg. faults on Sparc Solaris machines. + +1999-06-14 Erik de Castro Lopo + + * src/aiff.c + Fixed bug in __aiff_close where the length fields in the header were + not being correctly calculated before writing. + + * tests/write_read_test.c + Modified to detect the above bug in WAV, AIFF and AU files. + +1999-06-12 Erik de Castro Lopo + + * Win32/* + Added a contribution from Albert Faber to allow libsndfile to compile + under Win32 systems. libsndfile will now be used as part of LAME the + the MPEG 1 Layer 3 encoder (http://internet.roadrunner.com/~mt/mp3/). + +1999-06-11 Erik de Castro Lopo + + * configure.in + Changed to reflect previous changes. + + * src/wav_ima_adpcm.c + Fixed incorrect calculation of bytespersec header field (IMA ADPCM only). + + Fixed bug when writing from int or double data to IMA ADPCM file. Will need + to write test code for this. + + Fixed bug in __ima_write () whereby the length of the current block was + calculated incorrectly. Thanks to Jongcheon Park for pointing this out. + +1999-03-27 Erik de Castro Lopo + + * src/*.c + Changed all read/write/lseek function calls to fread/fwrite/ + fseek/ftell and added error checking of return values from + fread and fwrite in critical areas of the code. + + * src/au.c + Fixed incorrect datasize element in AU header on write. + + * tests/error_test.c + Add new test to check all error values have an associated error + string. This will avoid embarrassing real world core dumps. + +1999-03-23 Erik de Castro Lopo + + * src/wav.c src/aiff.c + Added handling for unknown chunk markers in the file. + +1999-03-22 Erik de Castro Lopo + + * src/sndfile.c + Filled in missing error strings in SndfileErrors array. Missing entries + can cause core dumps when calling sf_error-str (). Thanks to Sam + for finding this problem. + +1999-03-21 Erik de Castro Lopo + + * src/wav_ima_adpcm.c + Work on wav_ms_adpcm.c uncovered a bug in __ima_read () when reading + stereo files. Caused by not adjusting offset into buffer of decoded + samples for 2 channels. A similar bug existed in __ima_write (). + Need a test for stereo ADPCM files. + + * src/wav_ms_adpcm.c + Decoder working correctly. + +1999-03-18 Erik de Castro Lopo + + * configure.in Makefile.am + Added --enable-justsrc configuration variable sent by Sam + . + + * src/wav_ima_adpcm.c + Fixed bug when reading beyond end of data section due to not + checking pima->blockcount. + This uncovered __ima_seek () bug due to pima->blockcount being set + before calling __ima_init_block (). + +1999-03-17 Erik de Castro Lopo + + * src/wav.c + Started implementing MS ADPCM decoder. + If file is WAVE_FORMAT_ADPCM and length of data chunk is odd, this + encoder seems to add an extra byte. Why not just give an even data + length? + +1999-03-16 Erik de Castro Lopo + + * src/wav.c + Split code out of wav.c to create wav_float.c and wav_ima_adpcm.c. + This will make it easier to add and debug other kinds of WAV files + in future. + +1999-03-14 Erik de Castro Lopo + + * tests/ + Added adpcm_test.c which implements test functions for + IMA ADPCM reading/writing/seeking etc. + + * src/wav.c + Fixed many bugs in IMA ADPCM encoder and decoder. + +1999-03-11 Erik de Castro Lopo + + * src/wav.c + Finished implementing IMA ADPCM encoder and decoder (what a bitch!). + +1999-03-03 Erik de Castro Lopo + + * src/wav.c + Started implementing IMA ADPCM decoder. + +1999-03-02 Erik de Castro Lopo + + * src/sndfile.c + Fixed bug where the sf_read_XXX functions were returning a + incorrect read count when reading past end of file. + Fixed bug in sf_seek () when seeking backwards from end of file. + + * tests/read_seek_test.c + Added multiple read test to short_test(), int_test () and + double_test (). + Added extra chunk to all test WAV files to test that reading + stops at end of 'data' chunk. + +1999-02-21 Erik de Castro Lopo + + * tests/write_read_test.c + Added tests for little DEC endian AU files. + + * src/au.c + Add handling for DEC format little endian AU files. + +1999-02-20 Erik de Castro Lopo + + * src/aiff.c src/au.c src/wav.c + Add __psf_sprintf calls during header parsing. + + * src/sndfile.c src/common.c + Implement sf_header_info (sndfile.c) function and __psf_sprintf (common.c). + + * tests/write_read_test.c + Added tests for 8 bit PCM files (WAV, AIFF and AU). + + * src/au.c src/aiff.c + Add handling of 8 bit PCM data format. + + * src/aiff.c + On write, set blocksize in SSND chunk to zero like everybody else. + +1999-02-16 Erik de Castro Lopo + + * src/pcm.c: + Fixed bug in let2s_array (cptr was not being initialised). + + * src/sndfile.c: + Fixed bug in sf_read_raw and sf_write_raw. sf_seek should + now work when using these functions. + +1999-02-15 Erik de Castro Lopo + + * tests/write_read_test.c: + Force test_buffer array to be double aligned. Sparc Solaris + requires this. + +1999-02-14 Erik de Castro Lopo + + * src/pcm.c: + Fixed a bug which was causing errors in the reading + and writing of 24 bit PCM files. + + * doc/api.html + Finished of preliminary documentaion. + +1999-02-13 Erik de Castro Lopo + + * src/aiff.c: + Changed reading of 'COMM' chunk to avoid reading an int + which overlaps an int (4 byte) boundary. + diff --git a/Libraries/SndFile/Files/INSTALL b/Libraries/SndFile/Files/INSTALL new file mode 100644 index 000000000..b42a17ac4 --- /dev/null +++ b/Libraries/SndFile/Files/INSTALL @@ -0,0 +1,182 @@ +Basic Installation +================== + + These are generic installation instructions. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, a file +`config.cache' that saves the results of its tests to speed up +reconfiguring, and a file `config.log' containing compiler output +(useful mainly for debugging `configure'). + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If at some point `config.cache' +contains results you don't want to keep, you may remove or edit it. + + The file `configure.in' is used to create `configure' by a program +called `autoconf'. You only need `configure.in' if you want to change +it or regenerate `configure' using a newer version of `autoconf'. + +The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. If you're + using `csh' on an old version of System V, you might need to type + `sh ./configure' instead to prevent `csh' from trying to execute + `configure' itself. + + Running `configure' takes awhile. While running, it prints some + messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package. + + 4. Type `make install' to install the programs and any data files and + documentation. + + 5. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + +Compilers and Options +===================== + + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. You can give `configure' +initial values for variables by setting them in the environment. Using +a Bourne-compatible shell, you can do that on the command line like +this: + CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure + +Or on systems that have the `env' program, you can do it like this: + env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure + +Compiling For Multiple Architectures +==================================== + + You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you must use a version of `make' that +supports the `VPATH' variable, such as GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. + + If you have to use a `make' that does not supports the `VPATH' +variable, you have to compile the package for one architecture at a time +in the source code directory. After you have installed the package for +one architecture, use `make distclean' before reconfiguring for another +architecture. + +Installation Names +================== + + By default, `make install' will install the package's files in +`/usr/local/bin', `/usr/local/man', etc. You can specify an +installation prefix other than `/usr/local' by giving `configure' the +option `--prefix=PATH'. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +give `configure' the option `--exec-prefix=PATH', the package will use +PATH as the prefix for installing programs and libraries. +Documentation and other data files will still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=PATH' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + +Optional Features +================= + + Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + +Specifying the System Type +========================== + + There may be some features `configure' can not figure out +automatically, but needs to determine by the type of host the package +will run on. Usually `configure' can figure that out, but if it prints +a message saying it can not guess the host type, give it the +`--host=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name with three fields: + CPU-COMPANY-SYSTEM + +See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the host type. + + If you are building compiler tools for cross-compiling, you can also +use the `--target=TYPE' option to select the type of system they will +produce code for and the `--build=TYPE' option to select the type of +system on which you are compiling the package. + +Sharing Defaults +================ + + If you want to set default values for `configure' scripts to share, +you can create a site shell script called `config.site' that gives +default values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Operation Controls +================== + + `configure' recognizes the following options to control how it +operates. + +`--cache-file=FILE' + Use and save the results of the tests in FILE instead of + `./config.cache'. Set FILE to `/dev/null' to disable caching, for + debugging `configure'. + +`--help' + Print a summary of the options to `configure', and exit. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null' (any error + messages will still be shown). + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`--version' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`configure' also accepts some other, not widely useful, options. diff --git a/Libraries/SndFile/Files/NEWS b/Libraries/SndFile/Files/NEWS new file mode 100644 index 000000000..a62f5de79 --- /dev/null +++ b/Libraries/SndFile/Files/NEWS @@ -0,0 +1,98 @@ +Version 1.0.11 (2004-11-15) + * Add support for SD2 files. + * Add read support for loop info in WAV and AIFF files. + * Add more tests. + * Improve type safety. + * Minor optimisations and bug fixes. + +Version 1.0.10 (2004-06-15) + * Fix AIFF read/write mode bugs. + * Add support for compiling Win32 DLLS using MinGW. + * Fix problems resulting in failed compiles with gcc-2.95. + * Improve test suite. + * Minor bug fixes. + +Version 1.0.9 (2004-03-30) + * Add handling of AVR (Audio Visual Research) files. + * Improve handling of WAVEFORMATEXTENSIBLE WAV files. + * Fix for using pipes on Win32. + +Version 1.0.8 (2004-03-14) + * Correct peak chunk handing for files with > 16 tracks. + * Fix for WAV files with huge number of CUE chunks. + +Version 1.0.7 (2004-02-25) + * Fix clip mode detection on ia64, MIPS and other CPUs. + * Fix two MacOSX build problems. + +Version 1.0.6 (2004-02-08) + * Added support for native Win32 file access API (Ross Bencina). + * New mode to add clippling then a converting from float/double to integer + would otherwise wrap around. + * Fixed a bug in reading/writing files > 2Gig on Linux, Solaris and others. + * Many minor bug fixes. + * Other random fixes for Win32. + +Version 1.0.5 (2003-05-03) + * Added support for HTK files. + * Added new function sf_open_fd() to allow for secure opening of temporary + files as well as reading/writing sound files embedded within larger + container files. + * Added string support for AIFF files. + * Minor bug fixes and code cleanups. + +Version 1.0.4 (2003-02-02) + * Added suport of PVF and XI files. + * Added functionality for setting and retreiving strings from sound files. + * Minor code cleanups and bug fixes. + +Version 1.0.3 (2002-12-09) + * Minor bug fixes. + +Version 1.0.2 (2002-11-24) + * Added support for VOX ADPCM. + * Improved error reporting. + * Added version scripting on Linux and Solaris. + * Minor bug fixes. + +Version 1.0.1 (2002-09-14) + * Added MAT and MAT5 file formats. + * Minor bug fixes. + +Version 1.0.0 (2002-08-16) + * Final release for 1.0.0. + +Version 1.0.0rc6 (2002-08-14) + * Release candidate 6 for the 1.0.0 series. + * MacOS9 fixes. + +Version 1.0.0rc5 (2002-08-10) + * Release candidate 5 for the 1.0.0 series. + * Changed the definition of sf_count_t which was causing problems when + libsndfile was compiled with other libraries (ie WxWindows). + * Minor bug fixes. + * Documentation cleanup. + +Version 1.0.0rc4 (2002-08-03) + * Release candidate 4 for the 1.0.0 series. + * Minor bug fixes. + * Fix broken Win32 "make check". + +Version 1.0.0rc3 (2002-08-02) + * Release candidate 3 for the 1.0.0 series. + * Fix bug where libsndfile was reading beyond the end of the data chunk. + * Added on-the-fly header updates on write. + * Fix a couple of documentation issues. + +Version 1.0.0rc2 (2002-06-24) + * Release candidate 2 for the 1.0.0 series. + * Fix compile problem for Win32. + +Version 1.0.0rc1 (2002-06-24) + * Release candidate 1 for the 1.0.0 series. + +Version 0.0.28 (2002-04-27) + * Last offical release of 0.0.X series of the library. + +Version 0.0.8 (1999-02-16) + * First offical release. diff --git a/Libraries/SndFile/Files/README b/Libraries/SndFile/Files/README new file mode 100644 index 000000000..830f17ee5 --- /dev/null +++ b/Libraries/SndFile/Files/README @@ -0,0 +1,74 @@ +This is libsndfile, 1.0.11 + +libsndfile is a library of C routines for reading and writing +files containing sampled audio data. + +The src/ directory contains the source code for library itself. + +The doc/ directory contains the libsndfile documentation. + +The examples/ directory contains examples of how to write code using +libsndfile. 'wav32_aiff24' converts a WAV file containing 32 bit floating +point data into a 24 bit PCM AIFF file. 'sndfile2oct' dumps the audio +data of a file in a human readable format. 'sfconvert' is the beginnings +of a audio file format conversion utility. 'make_sine' generates a WAV +file containing one cycle of a sine wave with 4096 sample points in +32 bit floating point format. 'sfinfo' opens a sound file and prints +out information about that file. + +The tests/ directory contains programs which link against libsndfile +and test its functionality. + +The Win32/ directory contains files and documentation to allow libsndfile +to compile under Win32 with the Microsoft Visual C++ compiler. + +The MacOS/ directory contains files and documentation to allow libsndfile +to compile under MacOS with the Metrowerks compiler. + +The src/GSM610 directory contains code written by Jutta Degener and Carsten +Bormann. Their original code can be found at : + http://kbs.cs.tu-berlin.de/~jutta/toast.html + +The src/G72x directory contains code written and released by Sun Microsystems +under a suitably free license. + + +Win32 +----- +There are detailed instructions for building libsndfile on Win32 in the file + + doc/win32.html + + +MacOSX +------ +Building on MacOSX should be the same as building it on any other Unix. + + +OTHER PLATFORMS +--------------- +To compile libsndfile on platforms which have a Bourne Shell compatible +shell, an ANSI C compiler and a make utility should require no more that +the following three commands : + ./configure + make + make install + +For platforms without the required shell, it is usually sufficient to +create an approriate config.h file in the src/ directory with correct +values for the following #defines (this would work for AmigaOS) : + +#define HAVE_ENDIAN_H 0 +#define GUESS_BIG_ENDIAN 1 +#define GUESS_LITTLE_ENDIAN 0 +#define FORCE_BROKEN_FLOAT 0 + + +CONTACTS +-------- + +libsndfile was written by Erik de Castro Lopo (erikd AT mega-nerd DOT com). +The libsndfile home page is at : + + http://www.mega-nerd.com/libsndfile/ + diff --git a/Libraries/SndFile/Files/TODO b/Libraries/SndFile/Files/TODO new file mode 100644 index 000000000..f6da6dff6 --- /dev/null +++ b/Libraries/SndFile/Files/TODO @@ -0,0 +1,42 @@ +Here's a list of what I (erikd AT mega-nerd DOT com) think needs to be +done. The list is by no means exhaustive and people are encouraged to +email me with suggestions. + + o Add pipe in/out capabilities. libsndfile should be able to read + its input from a pipe and write its output to a pipe. + + o Add checks of the error state after fseek???? Use ferror (). + + o Modify tests/lossy_comp_test.c to add tests for stereo files. + + o Testing compilation and correctness on more platforms. + + o Improve testing routines. Must test all combinations of inputs + and outputs. + + o Test sf_seek function on write??? + + o Add more sound file formats. People should contact me with their + requirements. + + o Add support for accessing sound formats with multiple audio + data sections (ie samples within tracker files, Soundfont II and + multi-sample sampler formats). + + o Add an interface to allow reading and writing of sample loop points + and other info within AIFF and other file formats. This must be a + general solution. + + o Improve documentation. Is HTML documentation good enough? + + o Look into the possibility of optional sample rate convert on file + read. + +As I am the person who knows libsndfile best, I can probably implement +any new features faster than anybody else (and you can spend your time +writing applications with libsndfile). All I need is some +documentation and some sample files. Please contact me before emailing +me documentation and sample files. I would much rather pull them off +the web than have them clogging up my email inbox. + + diff --git a/Libraries/SndFile/Files/src/G72x/ChangeLog b/Libraries/SndFile/Files/src/G72x/ChangeLog new file mode 100644 index 000000000..aa108dff7 --- /dev/null +++ b/Libraries/SndFile/Files/src/G72x/ChangeLog @@ -0,0 +1,50 @@ +2001-06-05 Erik de Castro Lopo + + * g72x.c + Added {} in function update () to prevent 'ambiguous else' warning messages. + +2000-07-14 Erik de Castro Lopo + + * g72x.c + Modified g72x_init_state () to fit in with the new structure of the code. + Implemented g72x_encode_block () and g72x_decode_block (). + +2000-07-12 Erik de Castro Lopo + + * g72x.h + Moved nearly all definitions and function prototypes from this file have been + moved to private.h. + Added an enum defining the 4 different G72x ADPCM codecs. + Added new function prototypes to define a cleaner interface to the encoder + and decoder. This new interface also allows samples to be processed in blocks + rather than on a sample by sample basis like the original code. + + * private.h + Added prototypes moved from g72x.h. + Changed struct g72x_state to a typedef struct { .. } G72x_PRIVATE. + Added fields to G72x_PRIVATE required for working on blocks of samples. + +2000-06-07 Erik de Castro Lopo + + * g72x.c + Fixed all compiler warnings. + Removed functions tandem_adjust() which is not required by libsndfile. + + * g721.c + Fixed all compiler warnings. + Removed functions tandem_adjust_alaw() and tandem_adjust_ulaw () which are not + required by libsndfile. + Removed second parameter to g721_encoder () which is not required. + + * g72x.h + Removed in_coding and out_coding parameters from all functions. These allowed + g72x encoding/decoding to/from A-law or u-law and are not required by libsndfile. + Removed unneeded defines for A-law, u-law and linear encoding. + + * g723_16.c + Removed second parameter (in_coding) for g723_16_encoder(). + Removed second parameter (out_coding) for g723_16_decoder(). + + * private.h + New file containing prototypes and tyepdefs private to G72x code. + diff --git a/Libraries/SndFile/Files/src/G72x/Makefile.am b/Libraries/SndFile/Files/src/G72x/Makefile.am new file mode 100644 index 000000000..f05ce05a6 --- /dev/null +++ b/Libraries/SndFile/Files/src/G72x/Makefile.am @@ -0,0 +1,28 @@ +## Process this file with automake to produce Makefile.in + +EXTRA_DIST = README README.original ChangeLog + +noinst_HEADERS = g72x.h g72x_priv.h +noinst_LTLIBRARIES = libg72x.la + +noinst_PROGRAMS = g72x_test + +CFILES = g72x.c g721.c g723_16.c g723_24.c g723_40.c + +libg72x_la_SOURCES = $(CFILES) $(noinst_HEADERS) + +g72x_test_SOURCES = g72x_test.c +g72x_test_LDADD = ./libg72x.la -lm + +check: g72x_test + ./g72x_test all + +# Disable autoheader. +AUTOHEADER=echo + +## Do not edit or modify anything in this comment block. +## The arch-tag line is a file identity tag for the GNU Arch +## revision control system. +## +## arch-tag: d417a8e8-da7f-423d-884d-f03c93379348 + diff --git a/Libraries/SndFile/Files/src/G72x/Makefile.in b/Libraries/SndFile/Files/src/G72x/Makefile.in new file mode 100644 index 000000000..192b76ec5 --- /dev/null +++ b/Libraries/SndFile/Files/src/G72x/Makefile.in @@ -0,0 +1,478 @@ +# Makefile.in generated by automake 1.7.9 from Makefile.am. +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../.. + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_triplet = @host@ +ACLOCAL = @ACLOCAL@ +ALSA_LIBS = @ALSA_LIBS@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ + +# Disable autoheader. +AUTOHEADER = echo +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COMPILER_IS_GCC = @COMPILER_IS_GCC@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ENABLE_EXPERIMENTAL_CODE = @ENABLE_EXPERIMENTAL_CODE@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +GCC_MAJOR_VERSION = @GCC_MAJOR_VERSION@ +GETCONF = @GETCONF@ +HTML_BGCOLOUR = @HTML_BGCOLOUR@ +HTML_FGCOLOUR = @HTML_FGCOLOUR@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIBTOOL_DEPS = @LIBTOOL_DEPS@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +OBJEXT = @OBJEXT@ +OS_SPECIFIC_CFLAGS = @OS_SPECIFIC_CFLAGS@ +OS_SPECIFIC_LINKS = @OS_SPECIFIC_LINKS@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SF_COUNT_MAX = @SF_COUNT_MAX@ +SHARED_VERSION_INFO = @SHARED_VERSION_INFO@ +SHELL = @SHELL@ +SHLIB_VERSION_ARG = @SHLIB_VERSION_ARG@ +SIZEOF_SF_COUNT_T = @SIZEOF_SF_COUNT_T@ +STRIP = @STRIP@ +TYPEOF_SF_COUNT_T = @TYPEOF_SF_COUNT_T@ +VERSION = @VERSION@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +ac_ct_GETCONF = @ac_ct_GETCONF@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +autogen = @autogen@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldocdir = @htmldocdir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ + +EXTRA_DIST = README README.original ChangeLog + +noinst_HEADERS = g72x.h g72x_priv.h +noinst_LTLIBRARIES = libg72x.la + +noinst_PROGRAMS = g72x_test + +CFILES = g72x.c g721.c g723_16.c g723_24.c g723_40.c + +libg72x_la_SOURCES = $(CFILES) $(noinst_HEADERS) + +g72x_test_SOURCES = g72x_test.c +g72x_test_LDADD = ./libg72x.la -lm +subdir = src/G72x +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/src/config.h +CONFIG_CLEAN_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) + +libg72x_la_LDFLAGS = +libg72x_la_LIBADD = +am__objects_1 = g72x.lo g721.lo g723_16.lo g723_24.lo g723_40.lo +am__objects_2 = +am_libg72x_la_OBJECTS = $(am__objects_1) $(am__objects_2) +libg72x_la_OBJECTS = $(am_libg72x_la_OBJECTS) +noinst_PROGRAMS = g72x_test$(EXEEXT) +PROGRAMS = $(noinst_PROGRAMS) + +am_g72x_test_OBJECTS = g72x_test.$(OBJEXT) +g72x_test_OBJECTS = $(am_g72x_test_OBJECTS) +g72x_test_DEPENDENCIES = ./libg72x.la +g72x_test_LDFLAGS = + +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/src +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/g721.Plo ./$(DEPDIR)/g723_16.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/g723_24.Plo ./$(DEPDIR)/g723_40.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/g72x.Plo ./$(DEPDIR)/g72x_test.Po +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \ + $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +DIST_SOURCES = $(libg72x_la_SOURCES) $(g72x_test_SOURCES) +HEADERS = $(noinst_HEADERS) + +DIST_COMMON = README $(noinst_HEADERS) $(srcdir)/Makefile.in ChangeLog \ + Makefile.am +SOURCES = $(libg72x_la_SOURCES) $(g72x_test_SOURCES) + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/G72x/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" = "$$p" && dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libg72x.la: $(libg72x_la_OBJECTS) $(libg72x_la_DEPENDENCIES) + $(LINK) $(libg72x_la_LDFLAGS) $(libg72x_la_OBJECTS) $(libg72x_la_LIBADD) $(LIBS) + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done +g72x_test$(EXEEXT): $(g72x_test_OBJECTS) $(g72x_test_DEPENDENCIES) + @rm -f g72x_test$(EXEEXT) + $(LINK) $(g72x_test_LDFLAGS) $(g72x_test_OBJECTS) $(g72x_test_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) core *.core + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/g721.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/g723_16.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/g723_24.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/g723_40.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/g72x.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/g72x_test.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< + +.c.obj: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` + +.c.lo: +@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +ETAGS = etags +ETAGSFLAGS = + +CTAGS = ctags +CTAGSFLAGS = + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique + +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = ../.. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(HEADERS) + +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + clean-noinstPROGRAMS mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstLTLIBRARIES clean-noinstPROGRAMS \ + ctags distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am info \ + info-am install install-am install-data install-data-am \ + install-exec install-exec-am install-info install-info-am \ + install-man install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ + uninstall-am uninstall-info-am + + +check: g72x_test + ./g72x_test all +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/Libraries/SndFile/Files/src/G72x/README b/Libraries/SndFile/Files/src/G72x/README new file mode 100644 index 000000000..e69de29bb diff --git a/Libraries/SndFile/Files/src/G72x/README.original b/Libraries/SndFile/Files/src/G72x/README.original new file mode 100644 index 000000000..23b0e7dd5 --- /dev/null +++ b/Libraries/SndFile/Files/src/G72x/README.original @@ -0,0 +1,94 @@ +The files in this directory comprise ANSI-C language reference implementations +of the CCITT (International Telegraph and Telephone Consultative Committee) +G.711, G.721 and G.723 voice compressions. They have been tested on Sun +SPARCstations and passed 82 out of 84 test vectors published by CCITT +(Dec. 20, 1988) for G.721 and G.723. [The two remaining test vectors, +which the G.721 decoder implementation for u-law samples did not pass, +may be in error because they are identical to two other vectors for G.723_40.] + +This source code is released by Sun Microsystems, Inc. to the public domain. +Please give your acknowledgement in product literature if this code is used +in your product implementation. + +Sun Microsystems supports some CCITT audio formats in Solaris 2.0 system +software. However, Sun's implementations have been optimized for higher +performance on SPARCstations. + + +The source files for CCITT conversion routines in this directory are: + + g72x.h header file for g721.c, g723_24.c and g723_40.c + g711.c CCITT G.711 u-law and A-law compression + g72x.c common denominator of G.721 and G.723 ADPCM codes + g721.c CCITT G.721 32Kbps ADPCM coder (with g72x.c) + g723_24.c CCITT G.723 24Kbps ADPCM coder (with g72x.c) + g723_40.c CCITT G.723 40Kbps ADPCM coder (with g72x.c) + + +Simple conversions between u-law, A-law, and 16-bit linear PCM are invoked +as follows: + + unsigned char ucode, acode; + short pcm_val; + + ucode = linear2ulaw(pcm_val); + ucode = alaw2ulaw(acode); + + acode = linear2alaw(pcm_val); + acode = ulaw2alaw(ucode); + + pcm_val = ulaw2linear(ucode); + pcm_val = alaw2linear(acode); + + +The other CCITT compression routines are invoked as follows: + + #include "g72x.h" + + struct g72x_state state; + int sample, code; + + g72x_init_state(&state); + code = {g721,g723_24,g723_40}_encoder(sample, coding, &state); + sample = {g721,g723_24,g723_40}_decoder(code, coding, &state); + +where + coding = AUDIO_ENCODING_ULAW for 8-bit u-law samples + AUDIO_ENCODING_ALAW for 8-bit A-law samples + AUDIO_ENCODING_LINEAR for 16-bit linear PCM samples + + + +This directory also includes the following sample programs: + + encode.c CCITT ADPCM encoder + decode.c CCITT ADPCM decoder + Makefile makefile for the sample programs + + +The sample programs contain examples of how to call the various compression +routines and pack/unpack the bits. The sample programs read byte streams from +stdin and write to stdout. The input/output data is raw data (no file header +or other identifying information is embedded). The sample programs are +invoked as follows: + + encode [-3|4|5] [-a|u|l] outfile + decode [-3|4|5] [-a|u|l] outfile +where: + -3 encode to (decode from) G.723 24kbps (3-bit) data + -4 encode to (decode from) G.721 32kbps (4-bit) data [the default] + -5 encode to (decode from) G.723 40kbps (5-bit) data + -a encode from (decode to) A-law data + -u encode from (decode to) u-law data [the default] + -l encode from (decode to) 16-bit linear data + +Examples: + # Read 16-bit linear and output G.721 + encode -4 -l g721file + + # Read 40Kbps G.723 and output A-law + decode -5 -a alawfile + + # Compress and then decompress u-law data using 24Kbps G.723 + encode -3 ulawout + diff --git a/Libraries/SndFile/Files/src/G72x/g721.c b/Libraries/SndFile/Files/src/G72x/g721.c new file mode 100644 index 000000000..4f51bb197 --- /dev/null +++ b/Libraries/SndFile/Files/src/G72x/g721.c @@ -0,0 +1,162 @@ +/* + * This source code is a product of Sun Microsystems, Inc. and is provided + * for unrestricted use. Users may copy or modify this source code without + * charge. + * + * SUN SOURCE CODE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING + * THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun source code is provided with no support and without any obligation on + * the part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS SOFTWARE + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + */ + +/* + * g721.c + * + * Description: + * + * g721_encoder(), g721_decoder() + * + * These routines comprise an implementation of the CCITT G.721 ADPCM + * coding algorithm. Essentially, this implementation is identical to + * the bit level description except for a few deviations which + * take advantage of work station attributes, such as hardware 2's + * complement arithmetic and large memory. Specifically, certain time + * consuming operations such as multiplications are replaced + * with lookup tables and software 2's complement operations are + * replaced with hardware 2's complement. + * + * The deviation from the bit level specification (lookup tables) + * preserves the bit level performance specifications. + * + * As outlined in the G.721 Recommendation, the algorithm is broken + * down into modules. Each section of code below is preceded by + * the name of the module which it is implementing. + * + */ + +#include "g72x.h" +#include "g72x_priv.h" + +static short qtab_721[7] = {-124, 80, 178, 246, 300, 349, 400}; +/* + * Maps G.721 code word to reconstructed scale factor normalized log + * magnitude values. + */ +static short _dqlntab[16] = {-2048, 4, 135, 213, 273, 323, 373, 425, + 425, 373, 323, 273, 213, 135, 4, -2048}; + +/* Maps G.721 code word to log of scale factor multiplier. */ +static short _witab[16] = {-12, 18, 41, 64, 112, 198, 355, 1122, + 1122, 355, 198, 112, 64, 41, 18, -12}; +/* + * Maps G.721 code words to a set of values whose long and short + * term averages are computed and then compared to give an indication + * how stationary (steady state) the signal is. + */ +static short _fitab[16] = {0, 0, 0, 0x200, 0x200, 0x200, 0x600, 0xE00, + 0xE00, 0x600, 0x200, 0x200, 0x200, 0, 0, 0}; + +/* + * g721_encoder() + * + * Encodes the input vale of linear PCM, A-law or u-law data sl and returns + * the resulting code. -1 is returned for unknown input coding value. + */ +int +g721_encoder( + int sl, + G72x_STATE *state_ptr) +{ + short sezi, se, sez; /* ACCUM */ + short d; /* SUBTA */ + short sr; /* ADDB */ + short y; /* MIX */ + short dqsez; /* ADDC */ + short dq, i; + + /* linearize input sample to 14-bit PCM */ + sl >>= 2; /* 14-bit dynamic range */ + + sezi = predictor_zero(state_ptr); + sez = sezi >> 1; + se = (sezi + predictor_pole(state_ptr)) >> 1; /* estimated signal */ + + d = sl - se; /* estimation difference */ + + /* quantize the prediction difference */ + y = step_size(state_ptr); /* quantizer step size */ + i = quantize(d, y, qtab_721, 7); /* i = ADPCM code */ + + dq = reconstruct(i & 8, _dqlntab[i], y); /* quantized est diff */ + + sr = (dq < 0) ? se - (dq & 0x3FFF) : se + dq; /* reconst. signal */ + + dqsez = sr + sez - se; /* pole prediction diff. */ + + update(4, y, _witab[i] << 5, _fitab[i], dq, sr, dqsez, state_ptr); + + return (i); +} + +/* + * g721_decoder() + * + * Description: + * + * Decodes a 4-bit code of G.721 encoded data of i and + * returns the resulting linear PCM, A-law or u-law value. + * return -1 for unknown out_coding value. + */ +int +g721_decoder( + int i, + G72x_STATE *state_ptr) +{ + short sezi, sei, sez, se; /* ACCUM */ + short y; /* MIX */ + short sr; /* ADDB */ + short dq; + short dqsez; + + i &= 0x0f; /* mask to get proper bits */ + sezi = predictor_zero(state_ptr); + sez = sezi >> 1; + sei = sezi + predictor_pole(state_ptr); + se = sei >> 1; /* se = estimated signal */ + + y = step_size(state_ptr); /* dynamic quantizer step size */ + + dq = reconstruct(i & 0x08, _dqlntab[i], y); /* quantized diff. */ + + sr = (dq < 0) ? (se - (dq & 0x3FFF)) : se + dq; /* reconst. signal */ + + dqsez = sr - se + sez; /* pole prediction diff. */ + + update(4, y, _witab[i] << 5, _fitab[i], dq, sr, dqsez, state_ptr); + + /* sr was 14-bit dynamic range */ + return (sr << 2); +} +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: 101b6e25-457d-490a-99ae-e2e74a26ea24 +*/ + diff --git a/Libraries/SndFile/Files/src/G72x/g723_16.c b/Libraries/SndFile/Files/src/G72x/g723_16.c new file mode 100644 index 000000000..0c3174501 --- /dev/null +++ b/Libraries/SndFile/Files/src/G72x/g723_16.c @@ -0,0 +1,169 @@ +/* + * This source code is a product of Sun Microsystems, Inc. and is provided + * for unrestricted use. Users may copy or modify this source code without + * charge. + * + * SUN SOURCE CODE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING + * THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun source code is provided with no support and without any obligation on + * the part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS SOFTWARE + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + */ +/* 16kbps version created, used 24kbps code and changing as little as possible. + * G.726 specs are available from ITU's gopher or WWW site (http://www.itu.ch) + * If any errors are found, please contact me at mrand@tamu.edu + * -Marc Randolph + */ + +/* + * g723_16.c + * + * Description: + * + * g723_16_encoder(), g723_16_decoder() + * + * These routines comprise an implementation of the CCITT G.726 16 Kbps + * ADPCM coding algorithm. Essentially, this implementation is identical to + * the bit level description except for a few deviations which take advantage + * of workstation attributes, such as hardware 2's complement arithmetic. + * + */ + +#include "g72x.h" +#include "g72x_priv.h" + +/* + * Maps G.723_16 code word to reconstructed scale factor normalized log + * magnitude values. Comes from Table 11/G.726 + */ +static short _dqlntab[4] = { 116, 365, 365, 116}; + +/* Maps G.723_16 code word to log of scale factor multiplier. + * + * _witab[4] is actually {-22 , 439, 439, -22}, but FILTD wants it + * as WI << 5 (multiplied by 32), so we'll do that here + */ +static short _witab[4] = {-704, 14048, 14048, -704}; + +/* + * Maps G.723_16 code words to a set of values whose long and short + * term averages are computed and then compared to give an indication + * how stationary (steady state) the signal is. + */ + +/* Comes from FUNCTF */ +static short _fitab[4] = {0, 0xE00, 0xE00, 0}; + +/* Comes from quantizer decision level tables (Table 7/G.726) + */ +static short qtab_723_16[1] = {261}; + + +/* + * g723_16_encoder() + * + * Encodes a linear PCM, A-law or u-law input sample and returns its 2-bit code. + * Returns -1 if invalid input coding value. + */ +int +g723_16_encoder( + int sl, + G72x_STATE *state_ptr) +{ + short sei, sezi, se, sez; /* ACCUM */ + short d; /* SUBTA */ + short y; /* MIX */ + short sr; /* ADDB */ + short dqsez; /* ADDC */ + short dq, i; + + /* linearize input sample to 14-bit PCM */ + sl >>= 2; /* sl of 14-bit dynamic range */ + + sezi = predictor_zero(state_ptr); + sez = sezi >> 1; + sei = sezi + predictor_pole(state_ptr); + se = sei >> 1; /* se = estimated signal */ + + d = sl - se; /* d = estimation diff. */ + + /* quantize prediction difference d */ + y = step_size(state_ptr); /* quantizer step size */ + i = quantize(d, y, qtab_723_16, 1); /* i = ADPCM code */ + + /* Since quantize() only produces a three level output + * (1, 2, or 3), we must create the fourth one on our own + */ + if (i == 3) /* i code for the zero region */ + if ((d & 0x8000) == 0) /* If d > 0, i=3 isn't right... */ + i = 0; + + dq = reconstruct(i & 2, _dqlntab[i], y); /* quantized diff. */ + + sr = (dq < 0) ? se - (dq & 0x3FFF) : se + dq; /* reconstructed signal */ + + dqsez = sr + sez - se; /* pole prediction diff. */ + + update(2, y, _witab[i], _fitab[i], dq, sr, dqsez, state_ptr); + + return (i); +} + +/* + * g723_16_decoder() + * + * Decodes a 2-bit CCITT G.723_16 ADPCM code and returns + * the resulting 16-bit linear PCM, A-law or u-law sample value. + * -1 is returned if the output coding is unknown. + */ +int +g723_16_decoder( + int i, + G72x_STATE *state_ptr) +{ + short sezi, sei, sez, se; /* ACCUM */ + short y; /* MIX */ + short sr; /* ADDB */ + short dq; + short dqsez; + + i &= 0x03; /* mask to get proper bits */ + sezi = predictor_zero(state_ptr); + sez = sezi >> 1; + sei = sezi + predictor_pole(state_ptr); + se = sei >> 1; /* se = estimated signal */ + + y = step_size(state_ptr); /* adaptive quantizer step size */ + dq = reconstruct(i & 0x02, _dqlntab[i], y); /* unquantize pred diff */ + + sr = (dq < 0) ? (se - (dq & 0x3FFF)) : (se + dq); /* reconst. signal */ + + dqsez = sr - se + sez; /* pole prediction diff. */ + + update(2, y, _witab[i], _fitab[i], dq, sr, dqsez, state_ptr); + + /* sr was of 14-bit dynamic range */ + return (sr << 2); +} +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: ae265466-c3fc-4f83-bb32-edae488a5ca5 +*/ + diff --git a/Libraries/SndFile/Files/src/G72x/g723_24.c b/Libraries/SndFile/Files/src/G72x/g723_24.c new file mode 100644 index 000000000..8748459ac --- /dev/null +++ b/Libraries/SndFile/Files/src/G72x/g723_24.c @@ -0,0 +1,146 @@ +/* + * This source code is a product of Sun Microsystems, Inc. and is provided + * for unrestricted use. Users may copy or modify this source code without + * charge. + * + * SUN SOURCE CODE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING + * THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun source code is provided with no support and without any obligation on + * the part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS SOFTWARE + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + */ + +/* + * g723_24.c + * + * Description: + * + * g723_24_encoder(), g723_24_decoder() + * + * These routines comprise an implementation of the CCITT G.723 24 Kbps + * ADPCM coding algorithm. Essentially, this implementation is identical to + * the bit level description except for a few deviations which take advantage + * of workstation attributes, such as hardware 2's complement arithmetic. + * + */ + +#include "g72x.h" +#include "g72x_priv.h" + +/* + * Maps G.723_24 code word to reconstructed scale factor normalized log + * magnitude values. + */ +static short _dqlntab[8] = {-2048, 135, 273, 373, 373, 273, 135, -2048}; + +/* Maps G.723_24 code word to log of scale factor multiplier. */ +static short _witab[8] = {-128, 960, 4384, 18624, 18624, 4384, 960, -128}; + +/* + * Maps G.723_24 code words to a set of values whose long and short + * term averages are computed and then compared to give an indication + * how stationary (steady state) the signal is. + */ +static short _fitab[8] = {0, 0x200, 0x400, 0xE00, 0xE00, 0x400, 0x200, 0}; + +static short qtab_723_24[3] = {8, 218, 331}; + +/* + * g723_24_encoder() + * + * Encodes a linear PCM, A-law or u-law input sample and returns its 3-bit code. + * Returns -1 if invalid input coding value. + */ +int +g723_24_encoder( + int sl, + G72x_STATE *state_ptr) +{ + short sei, sezi, se, sez; /* ACCUM */ + short d; /* SUBTA */ + short y; /* MIX */ + short sr; /* ADDB */ + short dqsez; /* ADDC */ + short dq, i; + + /* linearize input sample to 14-bit PCM */ + sl >>= 2; /* sl of 14-bit dynamic range */ + + sezi = predictor_zero(state_ptr); + sez = sezi >> 1; + sei = sezi + predictor_pole(state_ptr); + se = sei >> 1; /* se = estimated signal */ + + d = sl - se; /* d = estimation diff. */ + + /* quantize prediction difference d */ + y = step_size(state_ptr); /* quantizer step size */ + i = quantize(d, y, qtab_723_24, 3); /* i = ADPCM code */ + dq = reconstruct(i & 4, _dqlntab[i], y); /* quantized diff. */ + + sr = (dq < 0) ? se - (dq & 0x3FFF) : se + dq; /* reconstructed signal */ + + dqsez = sr + sez - se; /* pole prediction diff. */ + + update(3, y, _witab[i], _fitab[i], dq, sr, dqsez, state_ptr); + + return (i); +} + +/* + * g723_24_decoder() + * + * Decodes a 3-bit CCITT G.723_24 ADPCM code and returns + * the resulting 16-bit linear PCM, A-law or u-law sample value. + * -1 is returned if the output coding is unknown. + */ +int +g723_24_decoder( + int i, + G72x_STATE *state_ptr) +{ + short sezi, sei, sez, se; /* ACCUM */ + short y; /* MIX */ + short sr; /* ADDB */ + short dq; + short dqsez; + + i &= 0x07; /* mask to get proper bits */ + sezi = predictor_zero(state_ptr); + sez = sezi >> 1; + sei = sezi + predictor_pole(state_ptr); + se = sei >> 1; /* se = estimated signal */ + + y = step_size(state_ptr); /* adaptive quantizer step size */ + dq = reconstruct(i & 0x04, _dqlntab[i], y); /* unquantize pred diff */ + + sr = (dq < 0) ? (se - (dq & 0x3FFF)) : (se + dq); /* reconst. signal */ + + dqsez = sr - se + sez; /* pole prediction diff. */ + + update(3, y, _witab[i], _fitab[i], dq, sr, dqsez, state_ptr); + + return (sr << 2); /* sr was of 14-bit dynamic range */ +} +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: 75389236-650b-4427-98f3-0df6e8fb24bc +*/ + diff --git a/Libraries/SndFile/Files/src/G72x/g723_40.c b/Libraries/SndFile/Files/src/G72x/g723_40.c new file mode 100644 index 000000000..6ddb577df --- /dev/null +++ b/Libraries/SndFile/Files/src/G72x/g723_40.c @@ -0,0 +1,160 @@ +/* + * This source code is a product of Sun Microsystems, Inc. and is provided + * for unrestricted use. Users may copy or modify this source code without + * charge. + * + * SUN SOURCE CODE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING + * THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun source code is provided with no support and without any obligation on + * the part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS SOFTWARE + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + */ + +/* + * g723_40.c + * + * Description: + * + * g723_40_encoder(), g723_40_decoder() + * + * These routines comprise an implementation of the CCITT G.723 40Kbps + * ADPCM coding algorithm. Essentially, this implementation is identical to + * the bit level description except for a few deviations which + * take advantage of workstation attributes, such as hardware 2's + * complement arithmetic. + * + * The deviation from the bit level specification (lookup tables), + * preserves the bit level performance specifications. + * + * As outlined in the G.723 Recommendation, the algorithm is broken + * down into modules. Each section of code below is preceded by + * the name of the module which it is implementing. + * + */ + +#include "g72x.h" +#include "g72x_priv.h" + +/* + * Maps G.723_40 code word to ructeconstructed scale factor normalized log + * magnitude values. + */ +static short _dqlntab[32] = {-2048, -66, 28, 104, 169, 224, 274, 318, + 358, 395, 429, 459, 488, 514, 539, 566, + 566, 539, 514, 488, 459, 429, 395, 358, + 318, 274, 224, 169, 104, 28, -66, -2048}; + +/* Maps G.723_40 code word to log of scale factor multiplier. */ +static short _witab[32] = {448, 448, 768, 1248, 1280, 1312, 1856, 3200, + 4512, 5728, 7008, 8960, 11456, 14080, 16928, 22272, + 22272, 16928, 14080, 11456, 8960, 7008, 5728, 4512, + 3200, 1856, 1312, 1280, 1248, 768, 448, 448}; + +/* + * Maps G.723_40 code words to a set of values whose long and short + * term averages are computed and then compared to give an indication + * how stationary (steady state) the signal is. + */ +static short _fitab[32] = {0, 0, 0, 0, 0, 0x200, 0x200, 0x200, + 0x200, 0x200, 0x400, 0x600, 0x800, 0xA00, 0xC00, 0xC00, + 0xC00, 0xC00, 0xA00, 0x800, 0x600, 0x400, 0x200, 0x200, + 0x200, 0x200, 0x200, 0, 0, 0, 0, 0}; + +static short qtab_723_40[15] = {-122, -16, 68, 139, 198, 250, 298, 339, + 378, 413, 445, 475, 502, 528, 553}; + +/* + * g723_40_encoder() + * + * Encodes a 16-bit linear PCM, A-law or u-law input sample and retuens + * the resulting 5-bit CCITT G.723 40Kbps code. + * Returns -1 if the input coding value is invalid. + */ +int g723_40_encoder (int sl, G72x_STATE *state_ptr) +{ + short sei, sezi, se, sez; /* ACCUM */ + short d; /* SUBTA */ + short y; /* MIX */ + short sr; /* ADDB */ + short dqsez; /* ADDC */ + short dq, i; + + /* linearize input sample to 14-bit PCM */ + sl >>= 2; /* sl of 14-bit dynamic range */ + + sezi = predictor_zero(state_ptr); + sez = sezi >> 1; + sei = sezi + predictor_pole(state_ptr); + se = sei >> 1; /* se = estimated signal */ + + d = sl - se; /* d = estimation difference */ + + /* quantize prediction difference */ + y = step_size(state_ptr); /* adaptive quantizer step size */ + i = quantize(d, y, qtab_723_40, 15); /* i = ADPCM code */ + + dq = reconstruct(i & 0x10, _dqlntab[i], y); /* quantized diff */ + + sr = (dq < 0) ? se - (dq & 0x7FFF) : se + dq; /* reconstructed signal */ + + dqsez = sr + sez - se; /* dqsez = pole prediction diff. */ + + update(5, y, _witab[i], _fitab[i], dq, sr, dqsez, state_ptr); + + return (i); +} + +/* + * g723_40_decoder() + * + * Decodes a 5-bit CCITT G.723 40Kbps code and returns + * the resulting 16-bit linear PCM, A-law or u-law sample value. + * -1 is returned if the output coding is unknown. + */ +int g723_40_decoder (int i, G72x_STATE *state_ptr) +{ + short sezi, sei, sez, se; /* ACCUM */ + short y ; /* MIX */ + short sr; /* ADDB */ + short dq; + short dqsez; + + i &= 0x1f; /* mask to get proper bits */ + sezi = predictor_zero(state_ptr); + sez = sezi >> 1; + sei = sezi + predictor_pole(state_ptr); + se = sei >> 1; /* se = estimated signal */ + + y = step_size(state_ptr); /* adaptive quantizer step size */ + dq = reconstruct(i & 0x10, _dqlntab[i], y); /* estimation diff. */ + + sr = (dq < 0) ? (se - (dq & 0x7FFF)) : (se + dq); /* reconst. signal */ + + dqsez = sr - se + sez; /* pole prediction diff. */ + + update(5, y, _witab[i], _fitab[i], dq, sr, dqsez, state_ptr); + + return (sr << 2); /* sr was of 14-bit dynamic range */ +} +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: eb8d9a00-32bf-4dd2-b287-01b0336d72bf +*/ + diff --git a/Libraries/SndFile/Files/src/G72x/g72x.c b/Libraries/SndFile/Files/src/G72x/g72x.c new file mode 100644 index 000000000..8bbbfa781 --- /dev/null +++ b/Libraries/SndFile/Files/src/G72x/g72x.c @@ -0,0 +1,636 @@ +/* + * This source code is a product of Sun Microsystems, Inc. and is provided + * for unrestricted use. Users may copy or modify this source code without + * charge. + * + * SUN SOURCE CODE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING + * THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun source code is provided with no support and without any obligation on + * the part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS SOFTWARE + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + */ + +/* + * g72x.c + * + * Common routines for G.721 and G.723 conversions. + */ + +#include +#include +#include + +#include "g72x.h" +#include "g72x_priv.h" + +static +short power2 [15] = +{ 1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80, + 0x100, 0x200, 0x400, 0x800, 0x1000, 0x2000, 0x4000 +} ; + +/* + * quan() + * + * quantizes the input val against the table of size short integers. + * It returns i if table[i - 1] <= val < table[i]. + * + * Using linear search for simple coding. + */ +static +int quan (int val, short *table, int size) +{ + int i; + + for (i = 0; i < size; i++) + if (val < *table++) + break; + return (i); +} + +/* + * fmult() + * + * returns the integer product of the 14-bit integer "an" and + * "floating point" representation (4-bit exponent, 6-bit mantessa) "srn". + */ +static +int fmult (int an, int srn) +{ + short anmag, anexp, anmant; + short wanexp, wanmant; + short retval; + + anmag = (an > 0) ? an : ((-an) & 0x1FFF); + anexp = quan(anmag, power2, 15) - 6; + anmant = (anmag == 0) ? 32 : + (anexp >= 0) ? anmag >> anexp : anmag << -anexp; + wanexp = anexp + ((srn >> 6) & 0xF) - 13; + + /* + ** The original was : + ** wanmant = (anmant * (srn & 0x37) + 0x30) >> 4 ; + ** but could see no valid reason for the + 0x30. + ** Removed it and it improved the SNR of the codec. + */ + + wanmant = (anmant * (srn & 0x37)) >> 4 ; + + retval = (wanexp >= 0) ? ((wanmant << wanexp) & 0x7FFF) : + (wanmant >> -wanexp); + + return (((an ^ srn) < 0) ? -retval : retval); +} + +/* + * private_init_state() + * + * This routine initializes and/or resets the G72x_PRIVATE structure + * pointed to by 'state_ptr'. + * All the initial state values are specified in the CCITT G.721 document. + */ +void private_init_state (G72x_STATE *state_ptr) +{ + int cnta; + + state_ptr->yl = 34816; + state_ptr->yu = 544; + state_ptr->dms = 0; + state_ptr->dml = 0; + state_ptr->ap = 0; + for (cnta = 0; cnta < 2; cnta++) { + state_ptr->a[cnta] = 0; + state_ptr->pk[cnta] = 0; + state_ptr->sr[cnta] = 32; + } + for (cnta = 0; cnta < 6; cnta++) { + state_ptr->b[cnta] = 0; + state_ptr->dq[cnta] = 32; + } + state_ptr->td = 0; +} /* private_init_state */ + +int g72x_reader_init (G72x_DATA *data, int codec) +{ G72x_STATE *pstate ; + + if (sizeof (data->private) < sizeof (G72x_STATE)) + { /* This is for safety only. */ + return 1 ; + } ; + + memset (data, 0, sizeof (G72x_DATA)) ; + + pstate = (G72x_STATE*) data->private ; + private_init_state (pstate) ; + + pstate->encoder = NULL ; + + switch (codec) + { case G723_16_BITS_PER_SAMPLE : /* 2 bits per sample. */ + pstate->decoder = g723_16_decoder ; + data->blocksize = G723_16_BYTES_PER_BLOCK ; + data->samplesperblock = G723_16_SAMPLES_PER_BLOCK ; + pstate->codec_bits = 2 ; + break ; + + case G723_24_BITS_PER_SAMPLE : /* 3 bits per sample. */ + pstate->decoder = g723_24_decoder ; + data->blocksize = G723_24_BYTES_PER_BLOCK ; + data->samplesperblock = G723_24_SAMPLES_PER_BLOCK ; + pstate->codec_bits = 3 ; + break ; + + case G721_32_BITS_PER_SAMPLE : /* 4 bits per sample. */ + pstate->decoder = g721_decoder ; + data->blocksize = G721_32_BYTES_PER_BLOCK ; + data->samplesperblock = G721_32_SAMPLES_PER_BLOCK ; + pstate->codec_bits = 4 ; + break ; + + case G721_40_BITS_PER_SAMPLE : /* 5 bits per sample. */ + pstate->decoder = g723_40_decoder ; + data->blocksize = G721_40_BYTES_PER_BLOCK ; + data->samplesperblock = G721_40_SAMPLES_PER_BLOCK ; + pstate->codec_bits = 5 ; + break ; + + default : return 1 ; + } ; + + return 0 ; +} /* g72x_reader_init */ + +int g72x_writer_init (G72x_DATA *data, int codec) +{ G72x_STATE *pstate ; + + if (sizeof (data->private) < sizeof (G72x_STATE)) + { /* This is for safety only. Gets optimised out. */ + return 1 ; + } ; + + memset (data, 0, sizeof (G72x_DATA)) ; + + pstate = (G72x_STATE*) data->private ; + private_init_state (pstate) ; + + pstate->decoder = NULL ; + + switch (codec) + { case G723_16_BITS_PER_SAMPLE : /* 2 bits per sample. */ + pstate->encoder = g723_16_encoder ; + data->blocksize = G723_16_BYTES_PER_BLOCK ; + data->samplesperblock = G723_16_SAMPLES_PER_BLOCK ; + pstate->codec_bits = 2 ; + break ; + + case G723_24_BITS_PER_SAMPLE : /* 3 bits per sample. */ + pstate->encoder = g723_24_encoder ; + data->blocksize = G723_24_BYTES_PER_BLOCK ; + data->samplesperblock = G723_24_SAMPLES_PER_BLOCK ; + pstate->codec_bits = 3 ; + break ; + + case G721_32_BITS_PER_SAMPLE : /* 4 bits per sample. */ + pstate->encoder = g721_encoder ; + data->blocksize = G721_32_BYTES_PER_BLOCK ; + data->samplesperblock = G721_32_SAMPLES_PER_BLOCK ; + pstate->codec_bits = 4 ; + break ; + + case G721_40_BITS_PER_SAMPLE : /* 5 bits per sample. */ + pstate->encoder = g723_40_encoder ; + data->blocksize = G721_40_BYTES_PER_BLOCK ; + data->samplesperblock = G721_40_SAMPLES_PER_BLOCK ; + pstate->codec_bits = 5 ; + break ; + + default : return 1 ; + } ; + + return 0 ; +} /* g72x_writer_init */ + +int unpack_bytes (G72x_DATA *data, int bits) +{ unsigned int in_buffer = 0 ; + unsigned char in_byte ; + int k, in_bits = 0, bindex = 0 ; + + for (k = 0 ; bindex <= data->blocksize && k < G72x_BLOCK_SIZE ; k++) + { if (in_bits < bits) + { in_byte = data->block [bindex++] ; + + in_buffer |= (in_byte << in_bits); + in_bits += 8; + } + data->samples [k] = in_buffer & ((1 << bits) - 1); + in_buffer >>= bits; + in_bits -= bits; + } ; + + return k ; +} /* unpack_bytes */ + +int g72x_decode_block (G72x_DATA *data) +{ G72x_STATE *pstate ; + int k, count ; + + pstate = (G72x_STATE*) data->private ; + + count = unpack_bytes (data, pstate->codec_bits) ; + + for (k = 0 ; k < count ; k++) + data->samples [k] = pstate->decoder (data->samples [k], pstate) ; + + return 0 ; +} /* g72x_decode_block */ + +int pack_bytes (G72x_DATA *data, int bits) +{ + unsigned int out_buffer = 0 ; + int k, bindex = 0, out_bits = 0 ; + unsigned char out_byte ; + + for (k = 0 ; k < G72x_BLOCK_SIZE ; k++) + { out_buffer |= (data->samples [k] << out_bits) ; + out_bits += bits ; + if (out_bits >= 8) + { out_byte = out_buffer & 0xFF ; + out_bits -= 8 ; + out_buffer >>= 8 ; + data->block [bindex++] = out_byte ; + } + } ; + + return bindex ; +} /* pack_bytes */ + +int g72x_encode_block (G72x_DATA *data) +{ G72x_STATE *pstate ; + int k, count ; + + pstate = (G72x_STATE*) data->private ; + + for (k = 0 ; k < data->samplesperblock ; k++) + data->samples [k] = pstate->encoder (data->samples [k], pstate) ; + + count = pack_bytes (data, pstate->codec_bits) ; + + return count ; +} /* g72x_encode_block */ + +/* + * predictor_zero() + * + * computes the estimated signal from 6-zero predictor. + * + */ +int predictor_zero (G72x_STATE *state_ptr) +{ + int i; + int sezi; + + sezi = fmult(state_ptr->b[0] >> 2, state_ptr->dq[0]); + for (i = 1; i < 6; i++) /* ACCUM */ + sezi += fmult(state_ptr->b[i] >> 2, state_ptr->dq[i]); + return (sezi); +} +/* + * predictor_pole() + * + * computes the estimated signal from 2-pole predictor. + * + */ +int predictor_pole(G72x_STATE *state_ptr) +{ + return (fmult(state_ptr->a[1] >> 2, state_ptr->sr[1]) + + fmult(state_ptr->a[0] >> 2, state_ptr->sr[0])); +} +/* + * step_size() + * + * computes the quantization step size of the adaptive quantizer. + * + */ +int step_size (G72x_STATE *state_ptr) +{ + int y; + int dif; + int al; + + if (state_ptr->ap >= 256) + return (state_ptr->yu); + else { + y = state_ptr->yl >> 6; + dif = state_ptr->yu - y; + al = state_ptr->ap >> 2; + if (dif > 0) + y += (dif * al) >> 6; + else if (dif < 0) + y += (dif * al + 0x3F) >> 6; + return (y); + } +} + +/* + * quantize() + * + * Given a raw sample, 'd', of the difference signal and a + * quantization step size scale factor, 'y', this routine returns the + * ADPCM codeword to which that sample gets quantized. The step + * size scale factor division operation is done in the log base 2 domain + * as a subtraction. + */ +int quantize( + int d, /* Raw difference signal sample */ + int y, /* Step size multiplier */ + short *table, /* quantization table */ + int size) /* table size of short integers */ +{ + short dqm; /* Magnitude of 'd' */ + short expon; /* Integer part of base 2 log of 'd' */ + short mant; /* Fractional part of base 2 log */ + short dl; /* Log of magnitude of 'd' */ + short dln; /* Step size scale factor normalized log */ + int i; + + /* + * LOG + * + * Compute base 2 log of 'd', and store in 'dl'. + */ + dqm = abs(d); + expon = quan(dqm >> 1, power2, 15); + mant = ((dqm << 7) >> expon) & 0x7F; /* Fractional portion. */ + dl = (expon << 7) + mant; + + /* + * SUBTB + * + * "Divide" by step size multiplier. + */ + dln = dl - (y >> 2); + + /* + * QUAN + * + * Obtain codword i for 'd'. + */ + i = quan(dln, table, size); + if (d < 0) /* take 1's complement of i */ + return ((size << 1) + 1 - i); + else if (i == 0) /* take 1's complement of 0 */ + return ((size << 1) + 1); /* new in 1988 */ + else + return (i); +} +/* + * reconstruct() + * + * Returns reconstructed difference signal 'dq' obtained from + * codeword 'i' and quantization step size scale factor 'y'. + * Multiplication is performed in log base 2 domain as addition. + */ +int +reconstruct( + int sign, /* 0 for non-negative value */ + int dqln, /* G.72x codeword */ + int y) /* Step size multiplier */ +{ + short dql; /* Log of 'dq' magnitude */ + short dex; /* Integer part of log */ + short dqt; + short dq; /* Reconstructed difference signal sample */ + + dql = dqln + (y >> 2); /* ADDA */ + + if (dql < 0) { + return ((sign) ? -0x8000 : 0); + } else { /* ANTILOG */ + dex = (dql >> 7) & 15; + dqt = 128 + (dql & 127); + dq = (dqt << 7) >> (14 - dex); + return ((sign) ? (dq - 0x8000) : dq); + } +} + + +/* + * update() + * + * updates the state variables for each output code + */ +void +update( + int code_size, /* distinguish 723_40 with others */ + int y, /* quantizer step size */ + int wi, /* scale factor multiplier */ + int fi, /* for long/short term energies */ + int dq, /* quantized prediction difference */ + int sr, /* reconstructed signal */ + int dqsez, /* difference from 2-pole predictor */ + G72x_STATE *state_ptr) /* coder state pointer */ +{ + int cnt; + short mag, expon; /* Adaptive predictor, FLOAT A */ + short a2p = 0; /* LIMC */ + short a1ul; /* UPA1 */ + short pks1; /* UPA2 */ + short fa1; + char tr; /* tone/transition detector */ + short ylint, thr2, dqthr; + short ylfrac, thr1; + short pk0; + + pk0 = (dqsez < 0) ? 1 : 0; /* needed in updating predictor poles */ + + mag = dq & 0x7FFF; /* prediction difference magnitude */ + /* TRANS */ + ylint = state_ptr->yl >> 15; /* exponent part of yl */ + ylfrac = (state_ptr->yl >> 10) & 0x1F; /* fractional part of yl */ + thr1 = (32 + ylfrac) << ylint; /* threshold */ + thr2 = (ylint > 9) ? 31 << 10 : thr1; /* limit thr2 to 31 << 10 */ + dqthr = (thr2 + (thr2 >> 1)) >> 1; /* dqthr = 0.75 * thr2 */ + if (state_ptr->td == 0) /* signal supposed voice */ + tr = 0; + else if (mag <= dqthr) /* supposed data, but small mag */ + tr = 0; /* treated as voice */ + else /* signal is data (modem) */ + tr = 1; + + /* + * Quantizer scale factor adaptation. + */ + + /* FUNCTW & FILTD & DELAY */ + /* update non-steady state step size multiplier */ + state_ptr->yu = y + ((wi - y) >> 5); + + /* LIMB */ + if (state_ptr->yu < 544) /* 544 <= yu <= 5120 */ + state_ptr->yu = 544; + else if (state_ptr->yu > 5120) + state_ptr->yu = 5120; + + /* FILTE & DELAY */ + /* update steady state step size multiplier */ + state_ptr->yl += state_ptr->yu + ((-state_ptr->yl) >> 6); + + /* + * Adaptive predictor coefficients. + */ + if (tr == 1) { /* reset a's and b's for modem signal */ + state_ptr->a[0] = 0; + state_ptr->a[1] = 0; + state_ptr->b[0] = 0; + state_ptr->b[1] = 0; + state_ptr->b[2] = 0; + state_ptr->b[3] = 0; + state_ptr->b[4] = 0; + state_ptr->b[5] = 0; + } else { /* update a's and b's */ + pks1 = pk0 ^ state_ptr->pk[0]; /* UPA2 */ + + /* update predictor pole a[1] */ + a2p = state_ptr->a[1] - (state_ptr->a[1] >> 7); + if (dqsez != 0) { + fa1 = (pks1) ? state_ptr->a[0] : -state_ptr->a[0]; + if (fa1 < -8191) /* a2p = function of fa1 */ + a2p -= 0x100; + else if (fa1 > 8191) + a2p += 0xFF; + else + a2p += fa1 >> 5; + + if (pk0 ^ state_ptr->pk[1]) + { /* LIMC */ + if (a2p <= -12160) + a2p = -12288; + else if (a2p >= 12416) + a2p = 12288; + else + a2p -= 0x80; + } + else if (a2p <= -12416) + a2p = -12288; + else if (a2p >= 12160) + a2p = 12288; + else + a2p += 0x80; + } + + /* TRIGB & DELAY */ + state_ptr->a[1] = a2p; + + /* UPA1 */ + /* update predictor pole a[0] */ + state_ptr->a[0] -= state_ptr->a[0] >> 8; + if (dqsez != 0) + { if (pks1 == 0) + state_ptr->a[0] += 192; + else + state_ptr->a[0] -= 192; + } ; + + /* LIMD */ + a1ul = 15360 - a2p; + if (state_ptr->a[0] < -a1ul) + state_ptr->a[0] = -a1ul; + else if (state_ptr->a[0] > a1ul) + state_ptr->a[0] = a1ul; + + /* UPB : update predictor zeros b[6] */ + for (cnt = 0; cnt < 6; cnt++) { + if (code_size == 5) /* for 40Kbps G.723 */ + state_ptr->b[cnt] -= state_ptr->b[cnt] >> 9; + else /* for G.721 and 24Kbps G.723 */ + state_ptr->b[cnt] -= state_ptr->b[cnt] >> 8; + if (dq & 0x7FFF) { /* XOR */ + if ((dq ^ state_ptr->dq[cnt]) >= 0) + state_ptr->b[cnt] += 128; + else + state_ptr->b[cnt] -= 128; + } + } + } + + for (cnt = 5; cnt > 0; cnt--) + state_ptr->dq[cnt] = state_ptr->dq[cnt-1]; + /* FLOAT A : convert dq[0] to 4-bit exp, 6-bit mantissa f.p. */ + if (mag == 0) { + state_ptr->dq[0] = (dq >= 0) ? 0x20 : 0xFC20; + } else { + expon = quan(mag, power2, 15); + state_ptr->dq[0] = (dq >= 0) ? + (expon << 6) + ((mag << 6) >> expon) : + (expon << 6) + ((mag << 6) >> expon) - 0x400; + } + + state_ptr->sr[1] = state_ptr->sr[0]; + /* FLOAT B : convert sr to 4-bit exp., 6-bit mantissa f.p. */ + if (sr == 0) { + state_ptr->sr[0] = 0x20; + } else if (sr > 0) { + expon = quan(sr, power2, 15); + state_ptr->sr[0] = (expon << 6) + ((sr << 6) >> expon); + } else if (sr > -32768) { + mag = -sr; + expon = quan(mag, power2, 15); + state_ptr->sr[0] = (expon << 6) + ((mag << 6) >> expon) - 0x400; + } else + state_ptr->sr[0] = (short) 0xFC20; + + /* DELAY A */ + state_ptr->pk[1] = state_ptr->pk[0]; + state_ptr->pk[0] = pk0; + + /* TONE */ + if (tr == 1) /* this sample has been treated as data */ + state_ptr->td = 0; /* next one will be treated as voice */ + else if (a2p < -11776) /* small sample-to-sample correlation */ + state_ptr->td = 1; /* signal may be data */ + else /* signal is voice */ + state_ptr->td = 0; + + /* + * Adaptation speed control. + */ + state_ptr->dms += (fi - state_ptr->dms) >> 5; /* FILTA */ + state_ptr->dml += (((fi << 2) - state_ptr->dml) >> 7); /* FILTB */ + + if (tr == 1) + state_ptr->ap = 256; + else if (y < 1536) /* SUBTC */ + state_ptr->ap += (0x200 - state_ptr->ap) >> 4; + else if (state_ptr->td == 1) + state_ptr->ap += (0x200 - state_ptr->ap) >> 4; + else if (abs((state_ptr->dms << 2) - state_ptr->dml) >= + (state_ptr->dml >> 3)) + state_ptr->ap += (0x200 - state_ptr->ap) >> 4; + else + state_ptr->ap += (-state_ptr->ap) >> 4; + + return ; +} /* update */ + +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: 6298dc75-fd0f-4062-9b90-f73ed69f22d4 +*/ + diff --git a/Libraries/SndFile/Files/src/G72x/g72x.h b/Libraries/SndFile/Files/src/G72x/g72x.h new file mode 100644 index 000000000..63c1a351f --- /dev/null +++ b/Libraries/SndFile/Files/src/G72x/g72x.h @@ -0,0 +1,117 @@ +/* +** Copyright (C) 1999-2001 Erik de Castro Lopo +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU Lesser General Public License as published by +** the Free Software Foundation; either version 2.1 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU Lesser General Public License for more details. +** +** You should have received a copy of the GNU Lesser General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +/* +** This file is not the same as the original file from Sun Microsystems. Nearly +** all the original definitions and function prototypes that were in the file +** of this name have been moved to private.h. +*/ + +#ifndef G72X_HEADER_FILE +#define G72X_HEADER_FILE + +/* +** Number of samples per block to process. +** Must be a common multiple of possible bits per sample : 2, 3, 4, 5 and 8. +*/ +#define G72x_BLOCK_SIZE (3*5*8) + +/* +** Identifiers for the differing kinds of G72x ADPCM codecs. +** The identifiers also define the number of encoded bits per sample. +*/ + +enum +{ G723_16_BITS_PER_SAMPLE = 2, + G723_24_BITS_PER_SAMPLE = 3, + G723_40_BITS_PER_SAMPLE = 5, + + G721_32_BITS_PER_SAMPLE = 4, + G721_40_BITS_PER_SAMPLE = 5, + + G723_16_SAMPLES_PER_BLOCK = G72x_BLOCK_SIZE, + G723_24_SAMPLES_PER_BLOCK = G723_24_BITS_PER_SAMPLE * (G72x_BLOCK_SIZE / G723_24_BITS_PER_SAMPLE), + G723_40_SAMPLES_PER_BLOCK = G723_40_BITS_PER_SAMPLE * (G72x_BLOCK_SIZE / G723_40_BITS_PER_SAMPLE), + + G721_32_SAMPLES_PER_BLOCK = G72x_BLOCK_SIZE, + G721_40_SAMPLES_PER_BLOCK = G721_40_BITS_PER_SAMPLE * (G72x_BLOCK_SIZE / G721_40_BITS_PER_SAMPLE), + + G723_16_BYTES_PER_BLOCK = (G723_16_BITS_PER_SAMPLE * G72x_BLOCK_SIZE) / 8, + G723_24_BYTES_PER_BLOCK = (G723_24_BITS_PER_SAMPLE * G72x_BLOCK_SIZE) / 8, + G723_40_BYTES_PER_BLOCK = (G723_40_BITS_PER_SAMPLE * G72x_BLOCK_SIZE) / 8, + + G721_32_BYTES_PER_BLOCK = (G721_32_BITS_PER_SAMPLE * G72x_BLOCK_SIZE) / 8, + G721_40_BYTES_PER_BLOCK = (G721_40_BITS_PER_SAMPLE * G72x_BLOCK_SIZE) / 8 +} ; + +/* +** This is the public structure for passing data between the caller and +** the G72x encoder and decoder. +** The private array is used by the encoder and decoder for internal +** state information and should not be changed in any way by the caller. +** When decoding or encoding a stream, the same instance of this struct +** should be used for every call so that the decoder/encoder keeps the +** correct state data between calls. +*/ + +typedef struct +{ /* Private data. Don't mess with it. */ + unsigned long private [256 / sizeof (long)] ; + + /* Public data. Read only. */ + int blocksize, max_bytes, samplesperblock, bytesperblock ; + + /* Public data. Read and write. */ + int blocks, blockcount, samplecount ; + unsigned char block [G72x_BLOCK_SIZE] ; + short samples [G72x_BLOCK_SIZE] ; +} G72x_DATA ; + +/* External function definitions. */ + +int g72x_reader_init (G72x_DATA *data, int codec) ; +int g72x_writer_init (G72x_DATA *data, int codec) ; +/* +** Initialize the ADPCM state table for the given codec. +** Return 0 on success, 1 on fail. +*/ + +int g72x_decode_block (G72x_DATA *data) ; +/* +** The caller fills data->block with data->bytes bytes before calling the +** function. The value data->bytes must be an integer multiple of +** data->blocksize and be <= data->max_bytes. +** When it returns, the caller can read out data->samples samples. +*/ + +int g72x_encode_block (G72x_DATA *data) ; +/* +** The caller fills state->samples some integer multiple data->samples_per_block +** (up to G72x_BLOCK_SIZE) samples before calling the function. +** When it returns, the caller can read out bytes encoded bytes. +*/ + +#endif /* !G72X_HEADER_FILE */ +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: 6ca84e5f-f932-4ba1-87ee-37056d921621 +*/ + diff --git a/Libraries/SndFile/Files/src/G72x/g72x_priv.h b/Libraries/SndFile/Files/src/G72x/g72x_priv.h new file mode 100644 index 000000000..0bf730671 --- /dev/null +++ b/Libraries/SndFile/Files/src/G72x/g72x_priv.h @@ -0,0 +1,119 @@ +/* + * This source code is a product of Sun Microsystems, Inc. and is provided + * for unrestricted use. Users may copy or modify this source code without + * charge. + * + * SUN SOURCE CODE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING + * THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + * + * Sun source code is provided with no support and without any obligation on + * the part of Sun Microsystems, Inc. to assist in its use, correction, + * modification or enhancement. + * + * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS SOFTWARE + * OR ANY PART THEREOF. + * + * In no event will Sun Microsystems, Inc. be liable for any lost revenue + * or profits or other special, indirect and consequential damages, even if + * Sun has been advised of the possibility of such damages. + * + * Sun Microsystems, Inc. + * 2550 Garcia Avenue + * Mountain View, California 94043 + */ + +#ifndef G72X_PRIVATE_H +#define G72X_PRIVATE_H + + +/* +** The following is the definition of the state structure used by the +** G.721/G.723 encoder and decoder to preserve their internal state +** between successive calls. The meanings of the majority of the state +** structure fields are explained in detail in the CCITT Recommendation +** G.721. The field names are essentially identical to variable names +** in the bit level description of the coding algorithm included in this +** Recommendation. +*/ + +typedef struct private_g72x +{ long yl; /* Locked or steady state step size multiplier. */ + short yu; /* Unlocked or non-steady state step size multiplier. */ + short dms; /* Short term energy estimate. */ + short dml; /* Long term energy estimate. */ + short ap; /* Linear weighting coefficient of 'yl' and 'yu'. */ + + short a[2]; /* Coefficients of pole portion of prediction filter. */ + short b[6]; /* Coefficients of zero portion of prediction filter. */ + short pk[2]; /* + ** Signs of previous two samples of a partially + ** reconstructed signal. + **/ + short dq[6]; /* + ** Previous 6 samples of the quantized difference + ** signal represented in an internal floating point + ** format. + **/ + short sr[2]; /* + ** Previous 2 samples of the quantized difference + ** signal represented in an internal floating point + ** format. + */ + char td; /* delayed tone detect, new in 1988 version */ + + /* The following struct members were added for libsndfile. The original + ** code worked by calling a set of functions on a sample by sample basis + ** which is slow on architectures like Intel x86. For libsndfile, this + ** was changed so that the encoding and decoding routines could work on + ** a block of samples at a time to reduce the function call overhead. + */ + int (*encoder) (int, struct private_g72x* state) ; + int (*decoder) (int, struct private_g72x* state) ; + + int codec_bits ; + int byte_index, sample_index ; + +} G72x_STATE ; + + + +int predictor_zero (G72x_STATE *state_ptr); + +int predictor_pole (G72x_STATE *state_ptr); + +int step_size (G72x_STATE *state_ptr); + +int quantize (int d, int y, short *table, int size); + +int reconstruct (int sign, int dqln, int y); + +void update (int code_size, int y, int wi, int fi, int dq, int sr, int dqsez, G72x_STATE *state_ptr); + +int g721_encoder (int sample, G72x_STATE *state_ptr); +int g721_decoder (int code, G72x_STATE *state_ptr); + +int g723_16_encoder (int sample, G72x_STATE *state_ptr); +int g723_16_decoder (int code, G72x_STATE *state_ptr); + +int g723_24_encoder (int sample, G72x_STATE *state_ptr); +int g723_24_decoder (int code, G72x_STATE *state_ptr); + +int g723_40_encoder (int sample, G72x_STATE *state_ptr); +int g723_40_decoder (int code, G72x_STATE *state_ptr); + +int unpack_bytes (G72x_DATA *data, int bits) ; +int pack_bytes (G72x_DATA *data, int bits) ; + +void private_init_state (G72x_STATE *state_ptr) ; + +#endif /* G72X_PRIVATE_H */ +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: d9ad4da7-0fa3-471d-8020-720b5cfb5e5b +*/ + diff --git a/Libraries/SndFile/Files/src/G72x/g72x_test.c b/Libraries/SndFile/Files/src/G72x/g72x_test.c new file mode 100644 index 000000000..caf58467b --- /dev/null +++ b/Libraries/SndFile/Files/src/G72x/g72x_test.c @@ -0,0 +1,222 @@ +/* +** Copyright (C) 1999-2004 Erik de Castro Lopo +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include +#include +#include +#include +#include + +#include "g72x.h" +#include "g72x_priv.h" + +#ifndef M_PI +#define M_PI 3.14159265358979323846264338 +#endif + +#define BUFFER_SIZE (1<<14) /* Should be (1<<14) */ +#define SAMPLE_RATE 11025 + + +static void g721_test (void) ; +static void g723_test (double margin) ; + +static void gen_signal_double (double *data, double scale, int datalen) ; +static int error_function (double data, double orig, double margin) ; + +static int oct_save_short (short *a, short *b, int len) ; + +int +main (int argc, char *argv []) +{ int bDoAll = 0 ; + int nTests = 0 ; + + if (argc != 2) + { printf ("Usage : %s \n", argv [0]) ; + printf (" Where is one of the following:\n") ; + printf (" g721 - test G721 encoder and decoder\n") ; + printf (" g723 - test G721 encoder and decoder\n") ; + printf (" all - perform all tests\n") ; + exit (1) ; + } ; + + bDoAll=!strcmp (argv [1], "all"); + + if (bDoAll || ! strcmp (argv [1], "g721")) + { g721_test () ; + nTests++ ; + } ; + + if (bDoAll || ! strcmp (argv [1], "g723")) + { g723_test (0.53) ; + nTests++ ; + } ; + + if (nTests == 0) + { printf ("Mono : ************************************\n") ; + printf ("Mono : * No '%s' test defined.\n", argv [1]) ; + printf ("Mono : ************************************\n") ; + return 1 ; + } ; + + return 0 ; +} /* main */ + +static void +g721_test (void) +{ + return ; +} /* g721_test */ + +static void +g723_test (double margin) +{ static double orig_buffer [BUFFER_SIZE] ; + static short orig [BUFFER_SIZE] ; + static short data [BUFFER_SIZE] ; + + G72x_STATE encoder_state, decoder_state ; + + long k ; + int code, position, max_err ; + + private_init_state (&encoder_state) ; + encoder_state.encoder = g723_24_encoder ; + encoder_state.codec_bits = 3 ; + + private_init_state (&decoder_state) ; + decoder_state.decoder = g723_24_decoder ; + decoder_state.codec_bits = 3 ; + + memset (data, 0, BUFFER_SIZE * sizeof (short)) ; + memset (orig, 0, BUFFER_SIZE * sizeof (short)) ; + + printf (" g723_test : ") ; + fflush (stdout) ; + + gen_signal_double (orig_buffer, 32000.0, BUFFER_SIZE) ; + for (k = 0 ; k < BUFFER_SIZE ; k++) + orig [k] = (short) orig_buffer [k] ; + + /* Write and read data here. */ + position = 0 ; + max_err = 0 ; + for (k = 0 ; k < BUFFER_SIZE ; k++) + { code = encoder_state.encoder (orig [k], &encoder_state) ; + data [k] = decoder_state.decoder (code, &decoder_state) ; + if (abs (orig [k] - data [k]) > max_err) + { position = k ; + max_err = abs (orig [k] - data [k]) ; + } ; + } ; + + printf ("\n\nMax error of %d at postion %d.\n", max_err, position) ; + + for (k = 0 ; k < BUFFER_SIZE ; k++) + { if (error_function (data [k], orig [k], margin)) + { printf ("Line %d: Incorrect sample A (#%ld : %d should be %d).\n", __LINE__, k, data [k], orig [k]) ; + oct_save_short (orig, data, BUFFER_SIZE) ; + exit (1) ; + } ; + } ; + + + printf ("ok\n") ; + + return ; +} /* g723_test */ + + +#define SIGNAL_MAXVAL 30000.0 +#define DECAY_COUNT 1000 + +static void +gen_signal_double (double *gendata, double scale, int gendatalen) +{ int k, ramplen ; + double amp = 0.0 ; + + ramplen = DECAY_COUNT ; + + for (k = 0 ; k < gendatalen ; k++) + { if (k <= ramplen) + amp = scale * k / ((double) ramplen) ; + else if (k > gendatalen - ramplen) + amp = scale * (gendatalen - k) / ((double) ramplen) ; + + gendata [k] = amp * (0.4 * sin (33.3 * 2.0 * M_PI * ((double) (k+1)) / ((double) SAMPLE_RATE)) + + 0.3 * cos (201.1 * 2.0 * M_PI * ((double) (k+1)) / ((double) SAMPLE_RATE))) ; + } ; + + return ; +} /* gen_signal_double */ + +static int +error_function (double data, double orig, double margin) +{ double error ; + + if (fabs (orig) <= 500.0) + error = fabs (fabs (data) - fabs(orig)) / 2000.0 ; + else if (fabs (orig) <= 1000.0) + error = fabs (data - orig) / 3000.0 ; + else + error = fabs (data - orig) / fabs (orig) ; + + if (error > margin) + { printf ("\n\n*******************\nError : %f\n", error) ; + return 1 ; + } ; + return 0 ; +} /* error_function */ + +static int +oct_save_short (short *a, short *b, int len) +{ FILE *file ; + int k ; + + if (! (file = fopen ("error.dat", "w"))) + return 1 ; + + fprintf (file, "# Not created by Octave\n") ; + + fprintf (file, "# name: a\n") ; + fprintf (file, "# type: matrix\n") ; + fprintf (file, "# rows: %d\n", len) ; + fprintf (file, "# columns: 1\n") ; + + for (k = 0 ; k < len ; k++) + fprintf (file, "% d\n", a [k]) ; + + fprintf (file, "# name: b\n") ; + fprintf (file, "# type: matrix\n") ; + fprintf (file, "# rows: %d\n", len) ; + fprintf (file, "# columns: 1\n") ; + + for (k = 0 ; k < len ; k++) + fprintf (file, "% d\n", b [k]) ; + + fclose (file) ; + return 0 ; +} /* oct_save_short */ + +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: 0597b442-a5b0-4abf-92a4-92f6c24e85a6 +*/ + diff --git a/Libraries/SndFile/Files/src/GSM610/COPYRIGHT b/Libraries/SndFile/Files/src/GSM610/COPYRIGHT new file mode 100644 index 000000000..eba0e523b --- /dev/null +++ b/Libraries/SndFile/Files/src/GSM610/COPYRIGHT @@ -0,0 +1,16 @@ +Copyright 1992, 1993, 1994 by Jutta Degener and Carsten Bormann, +Technische Universitaet Berlin + +Any use of this software is permitted provided that this notice is not +removed and that neither the authors nor the Technische Universitaet Berlin +are deemed to have made any representations as to the suitability of this +software for any purpose nor are held responsible for any defects of +this software. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. + +As a matter of courtesy, the authors request to be informed about uses +this software has found, about bugs in this software, and about any +improvements that may be of general interest. + +Berlin, 28.11.1994 +Jutta Degener +Carsten Bormann diff --git a/Libraries/SndFile/Files/src/GSM610/ChangeLog b/Libraries/SndFile/Files/src/GSM610/ChangeLog new file mode 100644 index 000000000..24f524882 --- /dev/null +++ b/Libraries/SndFile/Files/src/GSM610/ChangeLog @@ -0,0 +1,56 @@ +2004-05-12 Erik de Castro Lopo + + * gsm610_priv.h + Replace ugly macros with inline functions. + + * *.c + Remove temporary variables used by macros and other minor fixes required by + above change. + +2003-06-02 Erik de Castro Lopo + + * rpe.c + Renamed variables "exp" to "expon" to avoid shadowed parameter warnigns. + +2002-06-08 Erik de Castro Lopo + + * long_term.c + Changes tp removed compiler warnings about shadowed parameters. + +2002-06-08 Erik de Castro Lopo + + * private.h + Made declarations of gsm_A, gsm_B, gsm_MIC etc extern. This fixed a compile + problem on MacOSX. + +2002-05-10 Erik de Castro Lopo + + * *.[ch] + Removed all pre-ANSI prototype kludges. Removed proto.h and unproto.h. + Started work on making GSM 6.10 files seekable. Currently they are not. + + * code.c private.h + Function Gsm_Coder () used a statically defined array. This was obviously + not re-entrant so moved it to struct gsm_state. + +2001-09-16 Erik de Castro Lopo + + * code.c + Added #includes for string.h and stdlib.h. + +2000-10-27 Erik de Castro Lopo + + * config.h + Removed some commented out #defines (ie //*efine) which were causing problems on + the Sun cc compiler. + +2000-02-29 Erik de Castro Lopo + + * private.h + Added #defines to emulate normal compile time options. + +2000-02-28 Erik de Castro Lopo + + * everthing + Created this directory and copied files from libgsm. + http://kbs.cs.tu-berlin.de/~jutta/toast.html diff --git a/Libraries/SndFile/Files/src/GSM610/Makefile.am b/Libraries/SndFile/Files/src/GSM610/Makefile.am new file mode 100644 index 000000000..e754ba98e --- /dev/null +++ b/Libraries/SndFile/Files/src/GSM610/Makefile.am @@ -0,0 +1,21 @@ +## Process this file with automake to produce Makefile.in + +EXTRA_DIST = README COPYRIGHT ChangeLog + +noinst_HEADERS = gsm.h config.h gsm610_priv.h +noinst_LTLIBRARIES = libgsm.la + +CFILES = add.c decode.c gsm_decode.c gsm_encode.c long_term.c preprocess.c \ + short_term.c code.c gsm_create.c gsm_destroy.c gsm_option.c lpc.c rpe.c table.c + +libgsm_la_SOURCES = $(CFILES) $(noinst_HEADERS) + +# Disable autoheader. +AUTOHEADER=echo + +## Do not edit or modify anything in this comment block. +## The arch-tag line is a file identity tag for the GNU Arch +## revision control system. +## +## arch-tag: ba91ffbe-9d1d-4044-a1de-e8ee2f890560 + diff --git a/Libraries/SndFile/Files/src/GSM610/Makefile.in b/Libraries/SndFile/Files/src/GSM610/Makefile.in new file mode 100644 index 000000000..124b2866a --- /dev/null +++ b/Libraries/SndFile/Files/src/GSM610/Makefile.in @@ -0,0 +1,470 @@ +# Makefile.in generated by automake 1.7.9 from Makefile.am. +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../.. + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_triplet = @host@ +ACLOCAL = @ACLOCAL@ +ALSA_LIBS = @ALSA_LIBS@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ + +# Disable autoheader. +AUTOHEADER = echo +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COMPILER_IS_GCC = @COMPILER_IS_GCC@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ENABLE_EXPERIMENTAL_CODE = @ENABLE_EXPERIMENTAL_CODE@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +GCC_MAJOR_VERSION = @GCC_MAJOR_VERSION@ +GETCONF = @GETCONF@ +HTML_BGCOLOUR = @HTML_BGCOLOUR@ +HTML_FGCOLOUR = @HTML_FGCOLOUR@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIBTOOL_DEPS = @LIBTOOL_DEPS@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +OBJEXT = @OBJEXT@ +OS_SPECIFIC_CFLAGS = @OS_SPECIFIC_CFLAGS@ +OS_SPECIFIC_LINKS = @OS_SPECIFIC_LINKS@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SF_COUNT_MAX = @SF_COUNT_MAX@ +SHARED_VERSION_INFO = @SHARED_VERSION_INFO@ +SHELL = @SHELL@ +SHLIB_VERSION_ARG = @SHLIB_VERSION_ARG@ +SIZEOF_SF_COUNT_T = @SIZEOF_SF_COUNT_T@ +STRIP = @STRIP@ +TYPEOF_SF_COUNT_T = @TYPEOF_SF_COUNT_T@ +VERSION = @VERSION@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +ac_ct_GETCONF = @ac_ct_GETCONF@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +autogen = @autogen@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldocdir = @htmldocdir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ + +EXTRA_DIST = README COPYRIGHT ChangeLog + +noinst_HEADERS = gsm.h config.h gsm610_priv.h +noinst_LTLIBRARIES = libgsm.la + +CFILES = add.c decode.c gsm_decode.c gsm_encode.c long_term.c preprocess.c \ + short_term.c code.c gsm_create.c gsm_destroy.c gsm_option.c lpc.c rpe.c table.c + + +libgsm_la_SOURCES = $(CFILES) $(noinst_HEADERS) +subdir = src/GSM610 +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/src/config.h +CONFIG_CLEAN_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) + +libgsm_la_LDFLAGS = +libgsm_la_LIBADD = +am__objects_1 = add.lo decode.lo gsm_decode.lo gsm_encode.lo \ + long_term.lo preprocess.lo short_term.lo code.lo gsm_create.lo \ + gsm_destroy.lo gsm_option.lo lpc.lo rpe.lo table.lo +am__objects_2 = +am_libgsm_la_OBJECTS = $(am__objects_1) $(am__objects_2) +libgsm_la_OBJECTS = $(am_libgsm_la_OBJECTS) + +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/src +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/add.Plo ./$(DEPDIR)/code.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/decode.Plo ./$(DEPDIR)/gsm_create.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/gsm_decode.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/gsm_destroy.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/gsm_encode.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/gsm_option.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/long_term.Plo ./$(DEPDIR)/lpc.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/preprocess.Plo ./$(DEPDIR)/rpe.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/short_term.Plo ./$(DEPDIR)/table.Plo +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \ + $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +DIST_SOURCES = $(libgsm_la_SOURCES) +HEADERS = $(noinst_HEADERS) + +DIST_COMMON = README $(noinst_HEADERS) $(srcdir)/Makefile.in ChangeLog \ + Makefile.am +SOURCES = $(libgsm_la_SOURCES) + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/GSM610/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" = "$$p" && dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libgsm.la: $(libgsm_la_OBJECTS) $(libgsm_la_DEPENDENCIES) + $(LINK) $(libgsm_la_LDFLAGS) $(libgsm_la_OBJECTS) $(libgsm_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) core *.core + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/add.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/code.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/decode.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsm_create.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsm_decode.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsm_destroy.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsm_encode.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsm_option.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/long_term.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lpc.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/preprocess.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rpe.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/short_term.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/table.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< + +.c.obj: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` + +.c.lo: +@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +ETAGS = etags +ETAGSFLAGS = + +CTAGS = ctags +CTAGSFLAGS = + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique + +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = ../.. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) + +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstLTLIBRARIES ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am info info-am install \ + install-am install-data install-data-am install-exec \ + install-exec-am install-info install-info-am install-man \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool pdf \ + pdf-am ps ps-am tags uninstall uninstall-am uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/Libraries/SndFile/Files/src/GSM610/README b/Libraries/SndFile/Files/src/GSM610/README new file mode 100644 index 000000000..b57132b05 --- /dev/null +++ b/Libraries/SndFile/Files/src/GSM610/README @@ -0,0 +1,36 @@ +GSM 06.10 13 kbit/s RPE/LTP speech codec +---------------------------------------- + +All the file in this directory were written by Jutta Degener +and Carsten Borman for The Communications and Operating Systems +Research Group (KBS) at the Technische Universitaet Berlin. + +Their work was released under the following license which is +assumed to be compatible with The GNU Lesser General Public License. + +---------------------------------------------------------------------------- + +Copyright 1992, 1993, 1994 by Jutta Degener and Carsten Bormann, +Technische Universitaet Berlin + +Any use of this software is permitted provided that this notice is not +removed and that neither the authors nor the Technische Universitaet Berlin +are deemed to have made any representations as to the suitability of this +software for any purpose nor are held responsible for any defects of +this software. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. + +As a matter of courtesy, the authors request to be informed about uses +this software has found, about bugs in this software, and about any +improvements that may be of general interest. + +Berlin, 28.11.1994 +Jutta Degener (jutta@cs.tu-berlin.de) +Carsten Bormann (cabo@cs.tu-berlin.de) + +---------------------------------------------------------------------------- + +Jutta Degener and Carsten Bormann's work can be found on their homepage +at: + + http://kbs.cs.tu-berlin.de/~jutta/toast.html + diff --git a/Libraries/SndFile/Files/src/GSM610/add.c b/Libraries/SndFile/Files/src/GSM610/add.c new file mode 100644 index 000000000..fbf7cf147 --- /dev/null +++ b/Libraries/SndFile/Files/src/GSM610/add.c @@ -0,0 +1,248 @@ +/* + * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische + * Universitaet Berlin. See the accompanying file "COPYRIGHT" for + * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. + */ + +/* + * See private.h for the more commonly used macro versions. + */ + +#include +#include + +#include "gsm610_priv.h" +#include "gsm.h" + +#define saturate(x) \ + ((x) < MIN_WORD ? MIN_WORD : (x) > MAX_WORD ? MAX_WORD: (x)) + +word gsm_add ( word a, word b) +{ + longword sum = (longword)a + (longword)b; + return saturate(sum); +} + +word gsm_sub ( word a, word b) +{ + longword diff = (longword)a - (longword)b; + return saturate(diff); +} + +word gsm_mult ( word a, word b) +{ + if (a == MIN_WORD && b == MIN_WORD) + return MAX_WORD; + + return SASR_L( (longword)a * (longword)b, 15 ); +} + +word gsm_mult_r ( word a, word b) +{ + if (b == MIN_WORD && a == MIN_WORD) return MAX_WORD; + else { + longword prod = (longword)a * (longword)b + 16384; + prod >>= 15; + return prod & 0xFFFF; + } +} + +word gsm_abs (word a) +{ + return a < 0 ? (a == MIN_WORD ? MAX_WORD : -a) : a; +} + +longword gsm_L_mult (word a, word b) +{ + assert( a != MIN_WORD || b != MIN_WORD ); + return ((longword)a * (longword)b) << 1; +} + +longword gsm_L_add ( longword a, longword b) +{ + if (a < 0) { + if (b >= 0) return a + b; + else { + ulongword A = (ulongword)-(a + 1) + (ulongword)-(b + 1); + return A >= MAX_LONGWORD ? MIN_LONGWORD :-(longword)A-2; + } + } + else if (b <= 0) return a + b; + else { + ulongword A = (ulongword)a + (ulongword)b; + return A > MAX_LONGWORD ? MAX_LONGWORD : A; + } +} + +longword gsm_L_sub ( longword a, longword b) +{ + if (a >= 0) { + if (b >= 0) return a - b; + else { + /* a>=0, b<0 */ + + ulongword A = (ulongword)a + -(b + 1); + return A >= MAX_LONGWORD ? MAX_LONGWORD : (A + 1); + } + } + else if (b <= 0) return a - b; + else { + /* a<0, b>0 */ + + ulongword A = (ulongword)-(a + 1) + b; + return A >= MAX_LONGWORD ? MIN_LONGWORD : -(longword)A - 1; + } +} + +static unsigned char const bitoff[ 256 ] = { + 8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +word gsm_norm (longword a ) +/* + * the number of left shifts needed to normalize the 32 bit + * variable L_var1 for positive values on the interval + * + * with minimum of + * minimum of 1073741824 (01000000000000000000000000000000) and + * maximum of 2147483647 (01111111111111111111111111111111) + * + * + * and for negative values on the interval with + * minimum of -2147483648 (-10000000000000000000000000000000) and + * maximum of -1073741824 ( -1000000000000000000000000000000). + * + * in order to normalize the result, the following + * operation must be done: L_norm_var1 = L_var1 << norm( L_var1 ); + * + * (That's 'ffs', only from the left, not the right..) + */ +{ + assert(a != 0); + + if (a < 0) { + if (a <= -1073741824) return 0; + a = ~a; + } + + return a & 0xffff0000 + ? ( a & 0xff000000 + ? -1 + bitoff[ 0xFF & (a >> 24) ] + : 7 + bitoff[ 0xFF & (a >> 16) ] ) + : ( a & 0xff00 + ? 15 + bitoff[ 0xFF & (a >> 8) ] + : 23 + bitoff[ 0xFF & a ] ); +} + +longword gsm_L_asl (longword a, int n) +{ + if (n >= 32) return 0; + if (n <= -32) return -(a < 0); + if (n < 0) return gsm_L_asr(a, -n); + return a << n; +} + +word gsm_asr (word a, int n) +{ + if (n >= 16) return -(a < 0); + if (n <= -16) return 0; + if (n < 0) return a << -n; + + return SASR_W (a, (word) n); +} + +word gsm_asl (word a, int n) +{ + if (n >= 16) return 0; + if (n <= -16) return -(a < 0); + if (n < 0) return gsm_asr(a, -n); + return a << n; +} + +longword gsm_L_asr (longword a, int n) +{ + if (n >= 32) return -(a < 0); + if (n <= -32) return 0; + if (n < 0) return a << -n; + + return SASR_L (a, (word) n); +} + +/* +** word gsm_asr (word a, int n) +** { +** if (n >= 16) return -(a < 0); +** if (n <= -16) return 0; +** if (n < 0) return a << -n; +** +** # ifdef SASR_W +** return a >> n; +** # else +** if (a >= 0) return a >> n; +** else return -(word)( -(uword)a >> n ); +** # endif +** } +** +*/ +/* + * (From p. 46, end of section 4.2.5) + * + * NOTE: The following lines gives [sic] one correct implementation + * of the div(num, denum) arithmetic operation. Compute div + * which is the integer division of num by denum: with denum + * >= num > 0 + */ + +word gsm_div (word num, word denum) +{ + longword L_num = num; + longword L_denum = denum; + word div = 0; + int k = 15; + + /* The parameter num sometimes becomes zero. + * Although this is explicitly guarded against in 4.2.5, + * we assume that the result should then be zero as well. + */ + + /* assert(num != 0); */ + + assert(num >= 0 && denum >= num); + if (num == 0) + return 0; + + while (k--) { + div <<= 1; + L_num <<= 1; + + if (L_num >= L_denum) { + L_num -= L_denum; + div++; + } + } + + return div; +} +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: a7398579-e2e1-4733-aa2d-4c6efc0c58ff +*/ + diff --git a/Libraries/SndFile/Files/src/GSM610/code.c b/Libraries/SndFile/Files/src/GSM610/code.c new file mode 100644 index 000000000..02ec75bf1 --- /dev/null +++ b/Libraries/SndFile/Files/src/GSM610/code.c @@ -0,0 +1,97 @@ +/* + * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische + * Universitaet Berlin. See the accompanying file "COPYRIGHT" for + * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. + */ + + +#include +#include + +#include "config.h" + +#include "gsm610_priv.h" +#include "gsm.h" + +/* + * 4.2 FIXED POINT IMPLEMENTATION OF THE RPE-LTP CODER + */ + +void Gsm_Coder ( + + struct gsm_state * State, + + word * s, /* [0..159] samples IN */ + +/* + * The RPE-LTD coder works on a frame by frame basis. The length of + * the frame is equal to 160 samples. Some computations are done + * once per frame to produce at the output of the coder the + * LARc[1..8] parameters which are the coded LAR coefficients and + * also to realize the inverse filtering operation for the entire + * frame (160 samples of signal d[0..159]). These parts produce at + * the output of the coder: + */ + + word * LARc, /* [0..7] LAR coefficients OUT */ + +/* + * Procedure 4.2.11 to 4.2.18 are to be executed four times per + * frame. That means once for each sub-segment RPE-LTP analysis of + * 40 samples. These parts produce at the output of the coder: + */ + + word * Nc, /* [0..3] LTP lag OUT */ + word * bc, /* [0..3] coded LTP gain OUT */ + word * Mc, /* [0..3] RPE grid selection OUT */ + word * xmaxc,/* [0..3] Coded maximum amplitude OUT */ + word * xMc /* [13*4] normalized RPE samples OUT */ +) +{ + int k; + word * dp = State->dp0 + 120; /* [ -120...-1 ] */ + word * dpp = dp; /* [ 0...39 ] */ + + word so[160]; + + Gsm_Preprocess (State, s, so); + Gsm_LPC_Analysis (State, so, LARc); + Gsm_Short_Term_Analysis_Filter (State, LARc, so); + + for (k = 0; k <= 3; k++, xMc += 13) { + + Gsm_Long_Term_Predictor ( State, + so+k*40, /* d [0..39] IN */ + dp, /* dp [-120..-1] IN */ + State->e + 5, /* e [0..39] OUT */ + dpp, /* dpp [0..39] OUT */ + Nc++, + bc++); + + Gsm_RPE_Encoding ( /*-S,-*/ + State->e + 5, /* e ][0..39][ IN/OUT */ + xmaxc++, Mc++, xMc ); + /* + * Gsm_Update_of_reconstructed_short_time_residual_signal + * ( dpp, e + 5, dp ); + */ + + { register int i; + for (i = 0; i <= 39; i++) + dp[ i ] = GSM_ADD( State->e[5 + i], dpp[i] ); + } + dp += 40; + dpp += 40; + + } + (void)memcpy( (char *)State->dp0, (char *)(State->dp0 + 160), + 120 * sizeof(*State->dp0) ); +} +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: ae8ef1b2-5a1e-4263-94cd-42b15dca81a3 +*/ + diff --git a/Libraries/SndFile/Files/src/GSM610/config.h b/Libraries/SndFile/Files/src/GSM610/config.h new file mode 100644 index 000000000..23ac5ad08 --- /dev/null +++ b/Libraries/SndFile/Files/src/GSM610/config.h @@ -0,0 +1,33 @@ +/* + * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische + * Universitaet Berlin. See the accompanying file "COPYRIGHT" for + * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. + */ + +#ifndef CONFIG_H +#define CONFIG_H + +#define HAS_STDLIB_H 1 /* /usr/include/stdlib.h */ +#define HAS_FCNTL_H 1 /* /usr/include/fcntl.h */ + +#define HAS_FSTAT 1 /* fstat syscall */ +#define HAS_FCHMOD 1 /* fchmod syscall */ +#define HAS_CHMOD 1 /* chmod syscall */ +#define HAS_FCHOWN 1 /* fchown syscall */ +#define HAS_CHOWN 1 /* chown syscall */ + +#define HAS_STRING_H 1 /* /usr/include/string.h */ + +#define HAS_UNISTD_H 1 /* /usr/include/unistd.h */ +#define HAS_UTIME 1 /* POSIX utime(path, times) */ +#define HAS_UTIME_H 1 /* UTIME header file */ + +#endif /* CONFIG_H */ +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: 5338dfef-8e59-4f51-af47-627c9ea85353 +*/ + diff --git a/Libraries/SndFile/Files/src/GSM610/decode.c b/Libraries/SndFile/Files/src/GSM610/decode.c new file mode 100644 index 000000000..46db31825 --- /dev/null +++ b/Libraries/SndFile/Files/src/GSM610/decode.c @@ -0,0 +1,67 @@ +/* + * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische + * Universitaet Berlin. See the accompanying file "COPYRIGHT" for + * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. + */ + +#include + +#include "gsm610_priv.h" +#include "gsm.h" + +/* + * 4.3 FIXED POINT IMPLEMENTATION OF THE RPE-LTP DECODER + */ + +static void Postprocessing ( + struct gsm_state * S, + register word * s) +{ + register int k; + register word msr = S->msr; + register word tmp; + + for (k = 160; k--; s++) { + tmp = GSM_MULT_R( msr, 28180 ); + msr = GSM_ADD(*s, tmp); /* Deemphasis */ + *s = GSM_ADD(msr, msr) & 0xFFF8; /* Truncation & Upscaling */ + } + S->msr = msr; +} + +void Gsm_Decoder ( + struct gsm_state * S, + + word * LARcr, /* [0..7] IN */ + + word * Ncr, /* [0..3] IN */ + word * bcr, /* [0..3] IN */ + word * Mcr, /* [0..3] IN */ + word * xmaxcr, /* [0..3] IN */ + word * xMcr, /* [0..13*4] IN */ + + word * s) /* [0..159] OUT */ +{ + int j, k; + word erp[40], wt[160]; + word * drp = S->dp0 + 120; + + for (j=0; j <= 3; j++, xmaxcr++, bcr++, Ncr++, Mcr++, xMcr += 13) { + + Gsm_RPE_Decoding( /*-S,-*/ *xmaxcr, *Mcr, xMcr, erp ); + Gsm_Long_Term_Synthesis_Filtering( S, *Ncr, *bcr, erp, drp ); + + for (k = 0; k <= 39; k++) wt[ j * 40 + k ] = drp[ k ]; + } + + Gsm_Short_Term_Synthesis_Filter( S, LARcr, wt, s ); + Postprocessing(S, s); +} +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: 11ae5b90-2e8b-400b-ac64-a69a1fc6cc41 +*/ + diff --git a/Libraries/SndFile/Files/src/GSM610/gsm.h b/Libraries/SndFile/Files/src/GSM610/gsm.h new file mode 100644 index 000000000..a13a60614 --- /dev/null +++ b/Libraries/SndFile/Files/src/GSM610/gsm.h @@ -0,0 +1,58 @@ +/* + * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische + * Universitaet Berlin. See the accompanying file "COPYRIGHT" for + * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. + */ + +#ifndef GSM_H +#define GSM_H + +#include /* for FILE * */ + +/* + * Interface + */ + +typedef struct gsm_state * gsm; +typedef short gsm_signal; /* signed 16 bit */ +typedef unsigned char gsm_byte; +typedef gsm_byte gsm_frame[33]; /* 33 * 8 bits */ + +#define GSM_MAGIC 0xD /* 13 kbit/s RPE-LTP */ + +#define GSM_PATCHLEVEL 10 +#define GSM_MINOR 0 +#define GSM_MAJOR 1 + +#define GSM_OPT_VERBOSE 1 +#define GSM_OPT_FAST 2 +#define GSM_OPT_LTP_CUT 3 +#define GSM_OPT_WAV49 4 +#define GSM_OPT_FRAME_INDEX 5 +#define GSM_OPT_FRAME_CHAIN 6 + +gsm gsm_create (void); + +/* Added for libsndfile : May 6, 2002 */ +void gsm_init (gsm); + +void gsm_destroy (gsm); + +int gsm_print (FILE *, gsm, gsm_byte *); +int gsm_option (gsm, int, int *); + +void gsm_encode (gsm, gsm_signal *, gsm_byte *); +int gsm_decode (gsm, gsm_byte *, gsm_signal *); + +int gsm_explode (gsm, gsm_byte *, gsm_signal *); +void gsm_implode (gsm, gsm_signal *, gsm_byte *); + +#endif /* GSM_H */ +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: 8cfc7698-5433-4b6f-aeca-967c6fda4dec +*/ + diff --git a/Libraries/SndFile/Files/src/GSM610/gsm610_priv.h b/Libraries/SndFile/Files/src/GSM610/gsm610_priv.h new file mode 100644 index 000000000..e42f32f3e --- /dev/null +++ b/Libraries/SndFile/Files/src/GSM610/gsm610_priv.h @@ -0,0 +1,304 @@ +/* + * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische + * Universitaet Berlin. See the accompanying file "COPYRIGHT" for + * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. + */ + +#ifndef PRIVATE_H +#define PRIVATE_H + +/* Added by Erik de Castro Lopo */ +#define USE_FLOAT_MUL +#define FAST +#define WAV49 +/* Added by Erik de Castro Lopo */ + + + +typedef short word; /* 16 bit signed int */ +typedef int longword; /* 32 bit signed int */ + +typedef unsigned short uword; /* unsigned word */ +typedef unsigned int ulongword; /* unsigned longword */ + +struct gsm_state +{ word dp0[ 280 ] ; + + word z1; /* preprocessing.c, Offset_com. */ + longword L_z2; /* Offset_com. */ + int mp; /* Preemphasis */ + + word u[8] ; /* short_term_aly_filter.c */ + word LARpp[2][8] ; /* */ + word j; /* */ + + word ltp_cut; /* long_term.c, LTP crosscorr. */ + word nrp; /* 40 */ /* long_term.c, synthesis */ + word v[9] ; /* short_term.c, synthesis */ + word msr; /* decoder.c, Postprocessing */ + + char verbose; /* only used if !NDEBUG */ + char fast; /* only used if FAST */ + + char wav_fmt; /* only used if WAV49 defined */ + unsigned char frame_index; /* odd/even chaining */ + unsigned char frame_chain; /* half-byte to carry forward */ + + /* Moved here from code.c where it was defined as static */ + word e[50] ; +} ; + +typedef struct gsm_state GSM_STATE ; + +#define MIN_WORD (-32767 - 1) +#define MAX_WORD 32767 + +#define MIN_LONGWORD (-2147483647 - 1) +#define MAX_LONGWORD 2147483647 + +/* Signed arithmetic shift right. */ +static inline word +SASR_W (word x, word by) +{ return (x >> by) ; +} /* SASR */ + +static inline longword +SASR_L (longword x, word by) +{ return (x >> by) ; +} /* SASR */ + +/* + * Prototypes from add.c + */ +word gsm_mult (word a, word b) ; +longword gsm_L_mult (word a, word b) ; +word gsm_mult_r (word a, word b) ; + +word gsm_div (word num, word denum) ; + +word gsm_add (word a, word b ) ; +longword gsm_L_add (longword a, longword b ) ; + +word gsm_sub (word a, word b) ; +longword gsm_L_sub (longword a, longword b) ; + +word gsm_abs (word a) ; + +word gsm_norm (longword a ) ; + +longword gsm_L_asl (longword a, int n) ; +word gsm_asl (word a, int n) ; + +longword gsm_L_asr (longword a, int n) ; +word gsm_asr (word a, int n) ; + +/* + * Inlined functions from add.h + */ + +static inline longword +GSM_MULT_R (word a, word b) +{ return (((longword) (a)) * ((longword) (b)) + 16384) >> 15 ; +} /* GSM_MULT_R */ + +static inline longword +GSM_MULT (word a, word b) +{ return (((longword) (a)) * ((longword) (b))) >> 15 ; +} /* GSM_MULT */ + +static inline longword +GSM_L_MULT (word a, word b) +{ return ((longword) (a)) * ((longword) (b)) << 1 ; +} /* GSM_L_MULT */ + +static inline longword +GSM_L_ADD (longword a, longword b) +{ ulongword utmp ; + + if (a < 0 && b < 0) + { utmp = (ulongword)-((a) + 1) + (ulongword)-((b) + 1) ; + return (utmp >= (ulongword) MAX_LONGWORD) ? MIN_LONGWORD : -(longword)utmp-2 ; + } ; + + if (a > 0 && b > 0) + { utmp = (ulongword) a + (ulongword) b ; + return (utmp >= (ulongword) MAX_LONGWORD) ? MAX_LONGWORD : utmp ; + } ; + + return a + b ; +} /* GSM_L_ADD */ + +static inline longword +GSM_ADD (word a, word b) +{ longword ltmp ; + + ltmp = ((longword) a) + ((longword) b) ; + + if (ltmp >= MAX_WORD) + return MAX_WORD ; + if (ltmp <= MIN_WORD) + return MIN_WORD ; + + return ltmp ; +} /* GSM_ADD */ + +static inline longword +GSM_SUB (word a, word b) +{ longword ltmp ; + + ltmp = ((longword) a) - ((longword) b) ; + + if (ltmp >= MAX_WORD) + ltmp = MAX_WORD ; + else if (ltmp <= MIN_WORD) + ltmp = MIN_WORD ; + + return ltmp ; +} /* GSM_SUB */ + +static inline word +GSM_ABS (word a) +{ + if (a > 0) + return a ; + if (a == MIN_WORD) + return MAX_WORD ; + return -a ; +} /* GSM_ADD */ + + +/* + * More prototypes from implementations.. + */ +void Gsm_Coder ( + struct gsm_state * S, + word * s, /* [0..159] samples IN */ + word * LARc, /* [0..7] LAR coefficients OUT */ + word * Nc, /* [0..3] LTP lag OUT */ + word * bc, /* [0..3] coded LTP gain OUT */ + word * Mc, /* [0..3] RPE grid selection OUT */ + word * xmaxc,/* [0..3] Coded maximum amplitude OUT */ + word * xMc) ;/* [13*4] normalized RPE samples OUT */ + +void Gsm_Long_Term_Predictor ( /* 4x for 160 samples */ + struct gsm_state * S, + word * d, /* [0..39] residual signal IN */ + word * dp, /* [-120..-1] d' IN */ + word * e, /* [0..40] OUT */ + word * dpp, /* [0..40] OUT */ + word * Nc, /* correlation lag OUT */ + word * bc) ; /* gain factor OUT */ + +void Gsm_LPC_Analysis ( + struct gsm_state * S, + word * s, /* 0..159 signals IN/OUT */ + word * LARc) ; /* 0..7 LARc's OUT */ + +void Gsm_Preprocess ( + struct gsm_state * S, + word * s, word * so) ; + +void Gsm_Encoding ( + struct gsm_state * S, + word * e, + word * ep, + word * xmaxc, + word * Mc, + word * xMc) ; + +void Gsm_Short_Term_Analysis_Filter ( + struct gsm_state * S, + word * LARc, /* coded log area ratio [0..7] IN */ + word * d) ; /* st res. signal [0..159] IN/OUT */ + +void Gsm_Decoder ( + struct gsm_state * S, + word * LARcr, /* [0..7] IN */ + word * Ncr, /* [0..3] IN */ + word * bcr, /* [0..3] IN */ + word * Mcr, /* [0..3] IN */ + word * xmaxcr, /* [0..3] IN */ + word * xMcr, /* [0..13*4] IN */ + word * s) ; /* [0..159] OUT */ + +void Gsm_Decoding ( + struct gsm_state * S, + word xmaxcr, + word Mcr, + word * xMcr, /* [0..12] IN */ + word * erp) ; /* [0..39] OUT */ + +void Gsm_Long_Term_Synthesis_Filtering ( + struct gsm_state* S, + word Ncr, + word bcr, + word * erp, /* [0..39] IN */ + word * drp) ; /* [-120..-1] IN, [0..40] OUT */ + +void Gsm_RPE_Decoding ( + /*-struct gsm_state *S,-*/ + word xmaxcr, + word Mcr, + word * xMcr, /* [0..12], 3 bits IN */ + word * erp) ; /* [0..39] OUT */ + +void Gsm_RPE_Encoding ( + /*-struct gsm_state * S,-*/ + word * e, /* -5..-1][0..39][40..44 IN/OUT */ + word * xmaxc, /* OUT */ + word * Mc, /* OUT */ + word * xMc) ; /* [0..12] OUT */ + +void Gsm_Short_Term_Synthesis_Filter ( + struct gsm_state * S, + word * LARcr, /* log area ratios [0..7] IN */ + word * drp, /* received d [0...39] IN */ + word * s) ; /* signal s [0..159] OUT */ + +void Gsm_Update_of_reconstructed_short_time_residual_signal ( + word * dpp, /* [0...39] IN */ + word * ep, /* [0...39] IN */ + word * dp) ; /* [-120...-1] IN/OUT */ + +/* + * Tables from table.c + */ +#ifndef GSM_TABLE_C + +extern word gsm_A [8], gsm_B [8], gsm_MIC [8], gsm_MAC [8] ; +extern word gsm_INVA [8] ; +extern word gsm_DLB [4], gsm_QLB [4] ; +extern word gsm_H [11] ; +extern word gsm_NRFAC [8] ; +extern word gsm_FAC [8] ; + +#endif /* GSM_TABLE_C */ + +/* + * Debugging + */ +#ifdef NDEBUG + +# define gsm_debug_words(a, b, c, d) /* nil */ +# define gsm_debug_longwords(a, b, c, d) /* nil */ +# define gsm_debug_word(a, b) /* nil */ +# define gsm_debug_longword(a, b) /* nil */ + +#else /* !NDEBUG => DEBUG */ + + void gsm_debug_words (char * name, int, int, word *) ; + void gsm_debug_longwords (char * name, int, int, longword *) ; + void gsm_debug_longword (char * name, longword) ; + void gsm_debug_word (char * name, word) ; + +#endif /* !NDEBUG */ + +#endif /* PRIVATE_H */ +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: 8bc5fdf2-e8c8-4686-9bd7-a30b512bef0c +*/ + diff --git a/Libraries/SndFile/Files/src/GSM610/gsm_create.c b/Libraries/SndFile/Files/src/GSM610/gsm_create.c new file mode 100644 index 000000000..94e8d7d70 --- /dev/null +++ b/Libraries/SndFile/Files/src/GSM610/gsm_create.c @@ -0,0 +1,44 @@ +/* + * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische + * Universitaet Berlin. See the accompanying file "COPYRIGHT" for + * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. + */ + +#include "config.h" + +#include +#include +#include + + + +#include "gsm.h" +#include "gsm610_priv.h" + +gsm gsm_create (void) +{ + gsm r; + + r = malloc (sizeof(struct gsm_state)); + if (!r) return r; + + memset((char *)r, 0, sizeof (struct gsm_state)); + r->nrp = 40; + + return r; +} + +/* Added for libsndfile : May 6, 2002. Not sure if it works. */ +void gsm_init (gsm state) +{ + memset (state, 0, sizeof (struct gsm_state)) ; + state->nrp = 40 ; +} +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: 9fedb6b3-ed99-40c2-aac1-484c536261fe +*/ + diff --git a/Libraries/SndFile/Files/src/GSM610/gsm_decode.c b/Libraries/SndFile/Files/src/GSM610/gsm_decode.c new file mode 100644 index 000000000..e6425587c --- /dev/null +++ b/Libraries/SndFile/Files/src/GSM610/gsm_decode.c @@ -0,0 +1,366 @@ +/* + * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische + * Universitaet Berlin. See the accompanying file "COPYRIGHT" for + * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. + */ + +#include "gsm610_priv.h" + +#include "gsm.h" + +int gsm_decode (gsm s, gsm_byte * c, gsm_signal * target) +{ + word LARc[8], Nc[4], Mc[4], bc[4], xmaxc[4], xmc[13*4]; + +#ifdef WAV49 + if (s->wav_fmt) { + + uword sr = 0; + + s->frame_index = !s->frame_index; + if (s->frame_index) { + + sr = *c++; + LARc[0] = sr & 0x3f; sr >>= 6; + sr |= (uword)*c++ << 2; + LARc[1] = sr & 0x3f; sr >>= 6; + sr |= (uword)*c++ << 4; + LARc[2] = sr & 0x1f; sr >>= 5; + LARc[3] = sr & 0x1f; sr >>= 5; + sr |= (uword)*c++ << 2; + LARc[4] = sr & 0xf; sr >>= 4; + LARc[5] = sr & 0xf; sr >>= 4; + sr |= (uword)*c++ << 2; /* 5 */ + LARc[6] = sr & 0x7; sr >>= 3; + LARc[7] = sr & 0x7; sr >>= 3; + sr |= (uword)*c++ << 4; + Nc[0] = sr & 0x7f; sr >>= 7; + bc[0] = sr & 0x3; sr >>= 2; + Mc[0] = sr & 0x3; sr >>= 2; + sr |= (uword)*c++ << 1; + xmaxc[0] = sr & 0x3f; sr >>= 6; + xmc[0] = sr & 0x7; sr >>= 3; + sr = *c++; + xmc[1] = sr & 0x7; sr >>= 3; + xmc[2] = sr & 0x7; sr >>= 3; + sr |= (uword)*c++ << 2; + xmc[3] = sr & 0x7; sr >>= 3; + xmc[4] = sr & 0x7; sr >>= 3; + xmc[5] = sr & 0x7; sr >>= 3; + sr |= (uword)*c++ << 1; /* 10 */ + xmc[6] = sr & 0x7; sr >>= 3; + xmc[7] = sr & 0x7; sr >>= 3; + xmc[8] = sr & 0x7; sr >>= 3; + sr = *c++; + xmc[9] = sr & 0x7; sr >>= 3; + xmc[10] = sr & 0x7; sr >>= 3; + sr |= (uword)*c++ << 2; + xmc[11] = sr & 0x7; sr >>= 3; + xmc[12] = sr & 0x7; sr >>= 3; + sr |= (uword)*c++ << 4; + Nc[1] = sr & 0x7f; sr >>= 7; + bc[1] = sr & 0x3; sr >>= 2; + Mc[1] = sr & 0x3; sr >>= 2; + sr |= (uword)*c++ << 1; + xmaxc[1] = sr & 0x3f; sr >>= 6; + xmc[13] = sr & 0x7; sr >>= 3; + sr = *c++; /* 15 */ + xmc[14] = sr & 0x7; sr >>= 3; + xmc[15] = sr & 0x7; sr >>= 3; + sr |= (uword)*c++ << 2; + xmc[16] = sr & 0x7; sr >>= 3; + xmc[17] = sr & 0x7; sr >>= 3; + xmc[18] = sr & 0x7; sr >>= 3; + sr |= (uword)*c++ << 1; + xmc[19] = sr & 0x7; sr >>= 3; + xmc[20] = sr & 0x7; sr >>= 3; + xmc[21] = sr & 0x7; sr >>= 3; + sr = *c++; + xmc[22] = sr & 0x7; sr >>= 3; + xmc[23] = sr & 0x7; sr >>= 3; + sr |= (uword)*c++ << 2; + xmc[24] = sr & 0x7; sr >>= 3; + xmc[25] = sr & 0x7; sr >>= 3; + sr |= (uword)*c++ << 4; /* 20 */ + Nc[2] = sr & 0x7f; sr >>= 7; + bc[2] = sr & 0x3; sr >>= 2; + Mc[2] = sr & 0x3; sr >>= 2; + sr |= (uword)*c++ << 1; + xmaxc[2] = sr & 0x3f; sr >>= 6; + xmc[26] = sr & 0x7; sr >>= 3; + sr = *c++; + xmc[27] = sr & 0x7; sr >>= 3; + xmc[28] = sr & 0x7; sr >>= 3; + sr |= (uword)*c++ << 2; + xmc[29] = sr & 0x7; sr >>= 3; + xmc[30] = sr & 0x7; sr >>= 3; + xmc[31] = sr & 0x7; sr >>= 3; + sr |= (uword)*c++ << 1; + xmc[32] = sr & 0x7; sr >>= 3; + xmc[33] = sr & 0x7; sr >>= 3; + xmc[34] = sr & 0x7; sr >>= 3; + sr = *c++; /* 25 */ + xmc[35] = sr & 0x7; sr >>= 3; + xmc[36] = sr & 0x7; sr >>= 3; + sr |= (uword)*c++ << 2; + xmc[37] = sr & 0x7; sr >>= 3; + xmc[38] = sr & 0x7; sr >>= 3; + sr |= (uword)*c++ << 4; + Nc[3] = sr & 0x7f; sr >>= 7; + bc[3] = sr & 0x3; sr >>= 2; + Mc[3] = sr & 0x3; sr >>= 2; + sr |= (uword)*c++ << 1; + xmaxc[3] = sr & 0x3f; sr >>= 6; + xmc[39] = sr & 0x7; sr >>= 3; + sr = *c++; + xmc[40] = sr & 0x7; sr >>= 3; + xmc[41] = sr & 0x7; sr >>= 3; + sr |= (uword)*c++ << 2; /* 30 */ + xmc[42] = sr & 0x7; sr >>= 3; + xmc[43] = sr & 0x7; sr >>= 3; + xmc[44] = sr & 0x7; sr >>= 3; + sr |= (uword)*c++ << 1; + xmc[45] = sr & 0x7; sr >>= 3; + xmc[46] = sr & 0x7; sr >>= 3; + xmc[47] = sr & 0x7; sr >>= 3; + sr = *c++; + xmc[48] = sr & 0x7; sr >>= 3; + xmc[49] = sr & 0x7; sr >>= 3; + sr |= (uword)*c++ << 2; + xmc[50] = sr & 0x7; sr >>= 3; + xmc[51] = sr & 0x7; sr >>= 3; + + s->frame_chain = sr & 0xf; + } + else { + sr = s->frame_chain; + sr |= (uword)*c++ << 4; /* 1 */ + LARc[0] = sr & 0x3f; sr >>= 6; + LARc[1] = sr & 0x3f; sr >>= 6; + sr = *c++; + LARc[2] = sr & 0x1f; sr >>= 5; + sr |= (uword)*c++ << 3; + LARc[3] = sr & 0x1f; sr >>= 5; + LARc[4] = sr & 0xf; sr >>= 4; + sr |= (uword)*c++ << 2; + LARc[5] = sr & 0xf; sr >>= 4; + LARc[6] = sr & 0x7; sr >>= 3; + LARc[7] = sr & 0x7; sr >>= 3; + sr = *c++; /* 5 */ + Nc[0] = sr & 0x7f; sr >>= 7; + sr |= (uword)*c++ << 1; + bc[0] = sr & 0x3; sr >>= 2; + Mc[0] = sr & 0x3; sr >>= 2; + sr |= (uword)*c++ << 5; + xmaxc[0] = sr & 0x3f; sr >>= 6; + xmc[0] = sr & 0x7; sr >>= 3; + xmc[1] = sr & 0x7; sr >>= 3; + sr |= (uword)*c++ << 1; + xmc[2] = sr & 0x7; sr >>= 3; + xmc[3] = sr & 0x7; sr >>= 3; + xmc[4] = sr & 0x7; sr >>= 3; + sr = *c++; + xmc[5] = sr & 0x7; sr >>= 3; + xmc[6] = sr & 0x7; sr >>= 3; + sr |= (uword)*c++ << 2; /* 10 */ + xmc[7] = sr & 0x7; sr >>= 3; + xmc[8] = sr & 0x7; sr >>= 3; + xmc[9] = sr & 0x7; sr >>= 3; + sr |= (uword)*c++ << 1; + xmc[10] = sr & 0x7; sr >>= 3; + xmc[11] = sr & 0x7; sr >>= 3; + xmc[12] = sr & 0x7; sr >>= 3; + sr = *c++; + Nc[1] = sr & 0x7f; sr >>= 7; + sr |= (uword)*c++ << 1; + bc[1] = sr & 0x3; sr >>= 2; + Mc[1] = sr & 0x3; sr >>= 2; + sr |= (uword)*c++ << 5; + xmaxc[1] = sr & 0x3f; sr >>= 6; + xmc[13] = sr & 0x7; sr >>= 3; + xmc[14] = sr & 0x7; sr >>= 3; + sr |= (uword)*c++ << 1; /* 15 */ + xmc[15] = sr & 0x7; sr >>= 3; + xmc[16] = sr & 0x7; sr >>= 3; + xmc[17] = sr & 0x7; sr >>= 3; + sr = *c++; + xmc[18] = sr & 0x7; sr >>= 3; + xmc[19] = sr & 0x7; sr >>= 3; + sr |= (uword)*c++ << 2; + xmc[20] = sr & 0x7; sr >>= 3; + xmc[21] = sr & 0x7; sr >>= 3; + xmc[22] = sr & 0x7; sr >>= 3; + sr |= (uword)*c++ << 1; + xmc[23] = sr & 0x7; sr >>= 3; + xmc[24] = sr & 0x7; sr >>= 3; + xmc[25] = sr & 0x7; sr >>= 3; + sr = *c++; + Nc[2] = sr & 0x7f; sr >>= 7; + sr |= (uword)*c++ << 1; /* 20 */ + bc[2] = sr & 0x3; sr >>= 2; + Mc[2] = sr & 0x3; sr >>= 2; + sr |= (uword)*c++ << 5; + xmaxc[2] = sr & 0x3f; sr >>= 6; + xmc[26] = sr & 0x7; sr >>= 3; + xmc[27] = sr & 0x7; sr >>= 3; + sr |= (uword)*c++ << 1; + xmc[28] = sr & 0x7; sr >>= 3; + xmc[29] = sr & 0x7; sr >>= 3; + xmc[30] = sr & 0x7; sr >>= 3; + sr = *c++; + xmc[31] = sr & 0x7; sr >>= 3; + xmc[32] = sr & 0x7; sr >>= 3; + sr |= (uword)*c++ << 2; + xmc[33] = sr & 0x7; sr >>= 3; + xmc[34] = sr & 0x7; sr >>= 3; + xmc[35] = sr & 0x7; sr >>= 3; + sr |= (uword)*c++ << 1; /* 25 */ + xmc[36] = sr & 0x7; sr >>= 3; + xmc[37] = sr & 0x7; sr >>= 3; + xmc[38] = sr & 0x7; sr >>= 3; + sr = *c++; + Nc[3] = sr & 0x7f; sr >>= 7; + sr |= (uword)*c++ << 1; + bc[3] = sr & 0x3; sr >>= 2; + Mc[3] = sr & 0x3; sr >>= 2; + sr |= (uword)*c++ << 5; + xmaxc[3] = sr & 0x3f; sr >>= 6; + xmc[39] = sr & 0x7; sr >>= 3; + xmc[40] = sr & 0x7; sr >>= 3; + sr |= (uword)*c++ << 1; + xmc[41] = sr & 0x7; sr >>= 3; + xmc[42] = sr & 0x7; sr >>= 3; + xmc[43] = sr & 0x7; sr >>= 3; + sr = *c++; /* 30 */ + xmc[44] = sr & 0x7; sr >>= 3; + xmc[45] = sr & 0x7; sr >>= 3; + sr |= (uword)*c++ << 2; + xmc[46] = sr & 0x7; sr >>= 3; + xmc[47] = sr & 0x7; sr >>= 3; + xmc[48] = sr & 0x7; sr >>= 3; + sr |= (uword)*c++ << 1; + xmc[49] = sr & 0x7; sr >>= 3; + xmc[50] = sr & 0x7; sr >>= 3; + xmc[51] = sr & 0x7; sr >>= 3; + } + } + else +#endif + { + /* GSM_MAGIC = (*c >> 4) & 0xF; */ + + if (((*c >> 4) & 0x0F) != GSM_MAGIC) return -1; + + LARc[0] = (*c++ & 0xF) << 2; /* 1 */ + LARc[0] |= (*c >> 6) & 0x3; + LARc[1] = *c++ & 0x3F; + LARc[2] = (*c >> 3) & 0x1F; + LARc[3] = (*c++ & 0x7) << 2; + LARc[3] |= (*c >> 6) & 0x3; + LARc[4] = (*c >> 2) & 0xF; + LARc[5] = (*c++ & 0x3) << 2; + LARc[5] |= (*c >> 6) & 0x3; + LARc[6] = (*c >> 3) & 0x7; + LARc[7] = *c++ & 0x7; + Nc[0] = (*c >> 1) & 0x7F; + bc[0] = (*c++ & 0x1) << 1; + bc[0] |= (*c >> 7) & 0x1; + Mc[0] = (*c >> 5) & 0x3; + xmaxc[0] = (*c++ & 0x1F) << 1; + xmaxc[0] |= (*c >> 7) & 0x1; + xmc[0] = (*c >> 4) & 0x7; + xmc[1] = (*c >> 1) & 0x7; + xmc[2] = (*c++ & 0x1) << 2; + xmc[2] |= (*c >> 6) & 0x3; + xmc[3] = (*c >> 3) & 0x7; + xmc[4] = *c++ & 0x7; + xmc[5] = (*c >> 5) & 0x7; + xmc[6] = (*c >> 2) & 0x7; + xmc[7] = (*c++ & 0x3) << 1; /* 10 */ + xmc[7] |= (*c >> 7) & 0x1; + xmc[8] = (*c >> 4) & 0x7; + xmc[9] = (*c >> 1) & 0x7; + xmc[10] = (*c++ & 0x1) << 2; + xmc[10] |= (*c >> 6) & 0x3; + xmc[11] = (*c >> 3) & 0x7; + xmc[12] = *c++ & 0x7; + Nc[1] = (*c >> 1) & 0x7F; + bc[1] = (*c++ & 0x1) << 1; + bc[1] |= (*c >> 7) & 0x1; + Mc[1] = (*c >> 5) & 0x3; + xmaxc[1] = (*c++ & 0x1F) << 1; + xmaxc[1] |= (*c >> 7) & 0x1; + xmc[13] = (*c >> 4) & 0x7; + xmc[14] = (*c >> 1) & 0x7; + xmc[15] = (*c++ & 0x1) << 2; + xmc[15] |= (*c >> 6) & 0x3; + xmc[16] = (*c >> 3) & 0x7; + xmc[17] = *c++ & 0x7; + xmc[18] = (*c >> 5) & 0x7; + xmc[19] = (*c >> 2) & 0x7; + xmc[20] = (*c++ & 0x3) << 1; + xmc[20] |= (*c >> 7) & 0x1; + xmc[21] = (*c >> 4) & 0x7; + xmc[22] = (*c >> 1) & 0x7; + xmc[23] = (*c++ & 0x1) << 2; + xmc[23] |= (*c >> 6) & 0x3; + xmc[24] = (*c >> 3) & 0x7; + xmc[25] = *c++ & 0x7; + Nc[2] = (*c >> 1) & 0x7F; + bc[2] = (*c++ & 0x1) << 1; /* 20 */ + bc[2] |= (*c >> 7) & 0x1; + Mc[2] = (*c >> 5) & 0x3; + xmaxc[2] = (*c++ & 0x1F) << 1; + xmaxc[2] |= (*c >> 7) & 0x1; + xmc[26] = (*c >> 4) & 0x7; + xmc[27] = (*c >> 1) & 0x7; + xmc[28] = (*c++ & 0x1) << 2; + xmc[28] |= (*c >> 6) & 0x3; + xmc[29] = (*c >> 3) & 0x7; + xmc[30] = *c++ & 0x7; + xmc[31] = (*c >> 5) & 0x7; + xmc[32] = (*c >> 2) & 0x7; + xmc[33] = (*c++ & 0x3) << 1; + xmc[33] |= (*c >> 7) & 0x1; + xmc[34] = (*c >> 4) & 0x7; + xmc[35] = (*c >> 1) & 0x7; + xmc[36] = (*c++ & 0x1) << 2; + xmc[36] |= (*c >> 6) & 0x3; + xmc[37] = (*c >> 3) & 0x7; + xmc[38] = *c++ & 0x7; + Nc[3] = (*c >> 1) & 0x7F; + bc[3] = (*c++ & 0x1) << 1; + bc[3] |= (*c >> 7) & 0x1; + Mc[3] = (*c >> 5) & 0x3; + xmaxc[3] = (*c++ & 0x1F) << 1; + xmaxc[3] |= (*c >> 7) & 0x1; + xmc[39] = (*c >> 4) & 0x7; + xmc[40] = (*c >> 1) & 0x7; + xmc[41] = (*c++ & 0x1) << 2; + xmc[41] |= (*c >> 6) & 0x3; + xmc[42] = (*c >> 3) & 0x7; + xmc[43] = *c++ & 0x7; /* 30 */ + xmc[44] = (*c >> 5) & 0x7; + xmc[45] = (*c >> 2) & 0x7; + xmc[46] = (*c++ & 0x3) << 1; + xmc[46] |= (*c >> 7) & 0x1; + xmc[47] = (*c >> 4) & 0x7; + xmc[48] = (*c >> 1) & 0x7; + xmc[49] = (*c++ & 0x1) << 2; + xmc[49] |= (*c >> 6) & 0x3; + xmc[50] = (*c >> 3) & 0x7; + xmc[51] = *c & 0x7; /* 33 */ + } + + Gsm_Decoder(s, LARc, Nc, bc, Mc, xmaxc, xmc, target); + + return 0; +} +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: 6a9b6628-821c-4a96-84c1-485ebd35f170 +*/ + diff --git a/Libraries/SndFile/Files/src/GSM610/gsm_destroy.c b/Libraries/SndFile/Files/src/GSM610/gsm_destroy.c new file mode 100644 index 000000000..9e2d6a49b --- /dev/null +++ b/Libraries/SndFile/Files/src/GSM610/gsm_destroy.c @@ -0,0 +1,31 @@ +/* + * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische + * Universitaet Berlin. See the accompanying file "COPYRIGHT" for + * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. + */ + +#include "gsm.h" +#include "config.h" + +#ifdef HAS_STDLIB_H +# include +#else +# ifdef HAS_MALLOC_H +# include +# else + extern void free(); +# endif +#endif + +void gsm_destroy (gsm S) +{ + if (S) free((char *)S); +} +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: f423d09b-6ccc-47e0-9b18-ee1cf7a8e473 +*/ + diff --git a/Libraries/SndFile/Files/src/GSM610/gsm_encode.c b/Libraries/SndFile/Files/src/GSM610/gsm_encode.c new file mode 100644 index 000000000..02af4ba28 --- /dev/null +++ b/Libraries/SndFile/Files/src/GSM610/gsm_encode.c @@ -0,0 +1,456 @@ +/* + * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische + * Universitaet Berlin. See the accompanying file "COPYRIGHT" for + * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. + */ + +#include "gsm610_priv.h" +#include "gsm.h" + +void gsm_encode (gsm s, gsm_signal * source, gsm_byte * c) +{ + word LARc[8], Nc[4], Mc[4], bc[4], xmaxc[4], xmc[13*4]; + + Gsm_Coder(s, source, LARc, Nc, bc, Mc, xmaxc, xmc); + + + /* variable size + + GSM_MAGIC 4 + + LARc[0] 6 + LARc[1] 6 + LARc[2] 5 + LARc[3] 5 + LARc[4] 4 + LARc[5] 4 + LARc[6] 3 + LARc[7] 3 + + Nc[0] 7 + bc[0] 2 + Mc[0] 2 + xmaxc[0] 6 + xmc[0] 3 + xmc[1] 3 + xmc[2] 3 + xmc[3] 3 + xmc[4] 3 + xmc[5] 3 + xmc[6] 3 + xmc[7] 3 + xmc[8] 3 + xmc[9] 3 + xmc[10] 3 + xmc[11] 3 + xmc[12] 3 + + Nc[1] 7 + bc[1] 2 + Mc[1] 2 + xmaxc[1] 6 + xmc[13] 3 + xmc[14] 3 + xmc[15] 3 + xmc[16] 3 + xmc[17] 3 + xmc[18] 3 + xmc[19] 3 + xmc[20] 3 + xmc[21] 3 + xmc[22] 3 + xmc[23] 3 + xmc[24] 3 + xmc[25] 3 + + Nc[2] 7 + bc[2] 2 + Mc[2] 2 + xmaxc[2] 6 + xmc[26] 3 + xmc[27] 3 + xmc[28] 3 + xmc[29] 3 + xmc[30] 3 + xmc[31] 3 + xmc[32] 3 + xmc[33] 3 + xmc[34] 3 + xmc[35] 3 + xmc[36] 3 + xmc[37] 3 + xmc[38] 3 + + Nc[3] 7 + bc[3] 2 + Mc[3] 2 + xmaxc[3] 6 + xmc[39] 3 + xmc[40] 3 + xmc[41] 3 + xmc[42] 3 + xmc[43] 3 + xmc[44] 3 + xmc[45] 3 + xmc[46] 3 + xmc[47] 3 + xmc[48] 3 + xmc[49] 3 + xmc[50] 3 + xmc[51] 3 + */ + +#ifdef WAV49 + + if (s->wav_fmt) { + s->frame_index = !s->frame_index; + if (s->frame_index) { + + uword sr; + + sr = 0; + sr = sr >> 6 | LARc[0] << 10; + sr = sr >> 6 | LARc[1] << 10; + *c++ = sr >> 4; + sr = sr >> 5 | LARc[2] << 11; + *c++ = sr >> 7; + sr = sr >> 5 | LARc[3] << 11; + sr = sr >> 4 | LARc[4] << 12; + *c++ = sr >> 6; + sr = sr >> 4 | LARc[5] << 12; + sr = sr >> 3 | LARc[6] << 13; + *c++ = sr >> 7; + sr = sr >> 3 | LARc[7] << 13; + sr = sr >> 7 | Nc[0] << 9; + *c++ = sr >> 5; + sr = sr >> 2 | bc[0] << 14; + sr = sr >> 2 | Mc[0] << 14; + sr = sr >> 6 | xmaxc[0] << 10; + *c++ = sr >> 3; + sr = sr >> 3 | xmc[0] << 13; + *c++ = sr >> 8; + sr = sr >> 3 | xmc[1] << 13; + sr = sr >> 3 | xmc[2] << 13; + sr = sr >> 3 | xmc[3] << 13; + *c++ = sr >> 7; + sr = sr >> 3 | xmc[4] << 13; + sr = sr >> 3 | xmc[5] << 13; + sr = sr >> 3 | xmc[6] << 13; + *c++ = sr >> 6; + sr = sr >> 3 | xmc[7] << 13; + sr = sr >> 3 | xmc[8] << 13; + *c++ = sr >> 8; + sr = sr >> 3 | xmc[9] << 13; + sr = sr >> 3 | xmc[10] << 13; + sr = sr >> 3 | xmc[11] << 13; + *c++ = sr >> 7; + sr = sr >> 3 | xmc[12] << 13; + sr = sr >> 7 | Nc[1] << 9; + *c++ = sr >> 5; + sr = sr >> 2 | bc[1] << 14; + sr = sr >> 2 | Mc[1] << 14; + sr = sr >> 6 | xmaxc[1] << 10; + *c++ = sr >> 3; + sr = sr >> 3 | xmc[13] << 13; + *c++ = sr >> 8; + sr = sr >> 3 | xmc[14] << 13; + sr = sr >> 3 | xmc[15] << 13; + sr = sr >> 3 | xmc[16] << 13; + *c++ = sr >> 7; + sr = sr >> 3 | xmc[17] << 13; + sr = sr >> 3 | xmc[18] << 13; + sr = sr >> 3 | xmc[19] << 13; + *c++ = sr >> 6; + sr = sr >> 3 | xmc[20] << 13; + sr = sr >> 3 | xmc[21] << 13; + *c++ = sr >> 8; + sr = sr >> 3 | xmc[22] << 13; + sr = sr >> 3 | xmc[23] << 13; + sr = sr >> 3 | xmc[24] << 13; + *c++ = sr >> 7; + sr = sr >> 3 | xmc[25] << 13; + sr = sr >> 7 | Nc[2] << 9; + *c++ = sr >> 5; + sr = sr >> 2 | bc[2] << 14; + sr = sr >> 2 | Mc[2] << 14; + sr = sr >> 6 | xmaxc[2] << 10; + *c++ = sr >> 3; + sr = sr >> 3 | xmc[26] << 13; + *c++ = sr >> 8; + sr = sr >> 3 | xmc[27] << 13; + sr = sr >> 3 | xmc[28] << 13; + sr = sr >> 3 | xmc[29] << 13; + *c++ = sr >> 7; + sr = sr >> 3 | xmc[30] << 13; + sr = sr >> 3 | xmc[31] << 13; + sr = sr >> 3 | xmc[32] << 13; + *c++ = sr >> 6; + sr = sr >> 3 | xmc[33] << 13; + sr = sr >> 3 | xmc[34] << 13; + *c++ = sr >> 8; + sr = sr >> 3 | xmc[35] << 13; + sr = sr >> 3 | xmc[36] << 13; + sr = sr >> 3 | xmc[37] << 13; + *c++ = sr >> 7; + sr = sr >> 3 | xmc[38] << 13; + sr = sr >> 7 | Nc[3] << 9; + *c++ = sr >> 5; + sr = sr >> 2 | bc[3] << 14; + sr = sr >> 2 | Mc[3] << 14; + sr = sr >> 6 | xmaxc[3] << 10; + *c++ = sr >> 3; + sr = sr >> 3 | xmc[39] << 13; + *c++ = sr >> 8; + sr = sr >> 3 | xmc[40] << 13; + sr = sr >> 3 | xmc[41] << 13; + sr = sr >> 3 | xmc[42] << 13; + *c++ = sr >> 7; + sr = sr >> 3 | xmc[43] << 13; + sr = sr >> 3 | xmc[44] << 13; + sr = sr >> 3 | xmc[45] << 13; + *c++ = sr >> 6; + sr = sr >> 3 | xmc[46] << 13; + sr = sr >> 3 | xmc[47] << 13; + *c++ = sr >> 8; + sr = sr >> 3 | xmc[48] << 13; + sr = sr >> 3 | xmc[49] << 13; + sr = sr >> 3 | xmc[50] << 13; + *c++ = sr >> 7; + sr = sr >> 3 | xmc[51] << 13; + sr = sr >> 4; + *c = sr >> 8; + s->frame_chain = *c; + } + else { + uword sr; + + sr = 0; + sr = sr >> 4 | s->frame_chain << 12; + sr = sr >> 6 | LARc[0] << 10; + *c++ = sr >> 6; + sr = sr >> 6 | LARc[1] << 10; + *c++ = sr >> 8; + sr = sr >> 5 | LARc[2] << 11; + sr = sr >> 5 | LARc[3] << 11; + *c++ = sr >> 6; + sr = sr >> 4 | LARc[4] << 12; + sr = sr >> 4 | LARc[5] << 12; + *c++ = sr >> 6; + sr = sr >> 3 | LARc[6] << 13; + sr = sr >> 3 | LARc[7] << 13; + *c++ = sr >> 8; + sr = sr >> 7 | Nc[0] << 9; + sr = sr >> 2 | bc[0] << 14; + *c++ = sr >> 7; + sr = sr >> 2 | Mc[0] << 14; + sr = sr >> 6 | xmaxc[0] << 10; + *c++ = sr >> 7; + sr = sr >> 3 | xmc[0] << 13; + sr = sr >> 3 | xmc[1] << 13; + sr = sr >> 3 | xmc[2] << 13; + *c++ = sr >> 6; + sr = sr >> 3 | xmc[3] << 13; + sr = sr >> 3 | xmc[4] << 13; + *c++ = sr >> 8; + sr = sr >> 3 | xmc[5] << 13; + sr = sr >> 3 | xmc[6] << 13; + sr = sr >> 3 | xmc[7] << 13; + *c++ = sr >> 7; + sr = sr >> 3 | xmc[8] << 13; + sr = sr >> 3 | xmc[9] << 13; + sr = sr >> 3 | xmc[10] << 13; + *c++ = sr >> 6; + sr = sr >> 3 | xmc[11] << 13; + sr = sr >> 3 | xmc[12] << 13; + *c++ = sr >> 8; + sr = sr >> 7 | Nc[1] << 9; + sr = sr >> 2 | bc[1] << 14; + *c++ = sr >> 7; + sr = sr >> 2 | Mc[1] << 14; + sr = sr >> 6 | xmaxc[1] << 10; + *c++ = sr >> 7; + sr = sr >> 3 | xmc[13] << 13; + sr = sr >> 3 | xmc[14] << 13; + sr = sr >> 3 | xmc[15] << 13; + *c++ = sr >> 6; + sr = sr >> 3 | xmc[16] << 13; + sr = sr >> 3 | xmc[17] << 13; + *c++ = sr >> 8; + sr = sr >> 3 | xmc[18] << 13; + sr = sr >> 3 | xmc[19] << 13; + sr = sr >> 3 | xmc[20] << 13; + *c++ = sr >> 7; + sr = sr >> 3 | xmc[21] << 13; + sr = sr >> 3 | xmc[22] << 13; + sr = sr >> 3 | xmc[23] << 13; + *c++ = sr >> 6; + sr = sr >> 3 | xmc[24] << 13; + sr = sr >> 3 | xmc[25] << 13; + *c++ = sr >> 8; + sr = sr >> 7 | Nc[2] << 9; + sr = sr >> 2 | bc[2] << 14; + *c++ = sr >> 7; + sr = sr >> 2 | Mc[2] << 14; + sr = sr >> 6 | xmaxc[2] << 10; + *c++ = sr >> 7; + sr = sr >> 3 | xmc[26] << 13; + sr = sr >> 3 | xmc[27] << 13; + sr = sr >> 3 | xmc[28] << 13; + *c++ = sr >> 6; + sr = sr >> 3 | xmc[29] << 13; + sr = sr >> 3 | xmc[30] << 13; + *c++ = sr >> 8; + sr = sr >> 3 | xmc[31] << 13; + sr = sr >> 3 | xmc[32] << 13; + sr = sr >> 3 | xmc[33] << 13; + *c++ = sr >> 7; + sr = sr >> 3 | xmc[34] << 13; + sr = sr >> 3 | xmc[35] << 13; + sr = sr >> 3 | xmc[36] << 13; + *c++ = sr >> 6; + sr = sr >> 3 | xmc[37] << 13; + sr = sr >> 3 | xmc[38] << 13; + *c++ = sr >> 8; + sr = sr >> 7 | Nc[3] << 9; + sr = sr >> 2 | bc[3] << 14; + *c++ = sr >> 7; + sr = sr >> 2 | Mc[3] << 14; + sr = sr >> 6 | xmaxc[3] << 10; + *c++ = sr >> 7; + sr = sr >> 3 | xmc[39] << 13; + sr = sr >> 3 | xmc[40] << 13; + sr = sr >> 3 | xmc[41] << 13; + *c++ = sr >> 6; + sr = sr >> 3 | xmc[42] << 13; + sr = sr >> 3 | xmc[43] << 13; + *c++ = sr >> 8; + sr = sr >> 3 | xmc[44] << 13; + sr = sr >> 3 | xmc[45] << 13; + sr = sr >> 3 | xmc[46] << 13; + *c++ = sr >> 7; + sr = sr >> 3 | xmc[47] << 13; + sr = sr >> 3 | xmc[48] << 13; + sr = sr >> 3 | xmc[49] << 13; + *c++ = sr >> 6; + sr = sr >> 3 | xmc[50] << 13; + sr = sr >> 3 | xmc[51] << 13; + *c++ = sr >> 8; + } + } + + else + +#endif /* WAV49 */ + { + + *c++ = ((GSM_MAGIC & 0xF) << 4) /* 1 */ + | ((LARc[0] >> 2) & 0xF); + *c++ = ((LARc[0] & 0x3) << 6) + | (LARc[1] & 0x3F); + *c++ = ((LARc[2] & 0x1F) << 3) + | ((LARc[3] >> 2) & 0x7); + *c++ = ((LARc[3] & 0x3) << 6) + | ((LARc[4] & 0xF) << 2) + | ((LARc[5] >> 2) & 0x3); + *c++ = ((LARc[5] & 0x3) << 6) + | ((LARc[6] & 0x7) << 3) + | (LARc[7] & 0x7); + *c++ = ((Nc[0] & 0x7F) << 1) + | ((bc[0] >> 1) & 0x1); + *c++ = ((bc[0] & 0x1) << 7) + | ((Mc[0] & 0x3) << 5) + | ((xmaxc[0] >> 1) & 0x1F); + *c++ = ((xmaxc[0] & 0x1) << 7) + | ((xmc[0] & 0x7) << 4) + | ((xmc[1] & 0x7) << 1) + | ((xmc[2] >> 2) & 0x1); + *c++ = ((xmc[2] & 0x3) << 6) + | ((xmc[3] & 0x7) << 3) + | (xmc[4] & 0x7); + *c++ = ((xmc[5] & 0x7) << 5) /* 10 */ + | ((xmc[6] & 0x7) << 2) + | ((xmc[7] >> 1) & 0x3); + *c++ = ((xmc[7] & 0x1) << 7) + | ((xmc[8] & 0x7) << 4) + | ((xmc[9] & 0x7) << 1) + | ((xmc[10] >> 2) & 0x1); + *c++ = ((xmc[10] & 0x3) << 6) + | ((xmc[11] & 0x7) << 3) + | (xmc[12] & 0x7); + *c++ = ((Nc[1] & 0x7F) << 1) + | ((bc[1] >> 1) & 0x1); + *c++ = ((bc[1] & 0x1) << 7) + | ((Mc[1] & 0x3) << 5) + | ((xmaxc[1] >> 1) & 0x1F); + *c++ = ((xmaxc[1] & 0x1) << 7) + | ((xmc[13] & 0x7) << 4) + | ((xmc[14] & 0x7) << 1) + | ((xmc[15] >> 2) & 0x1); + *c++ = ((xmc[15] & 0x3) << 6) + | ((xmc[16] & 0x7) << 3) + | (xmc[17] & 0x7); + *c++ = ((xmc[18] & 0x7) << 5) + | ((xmc[19] & 0x7) << 2) + | ((xmc[20] >> 1) & 0x3); + *c++ = ((xmc[20] & 0x1) << 7) + | ((xmc[21] & 0x7) << 4) + | ((xmc[22] & 0x7) << 1) + | ((xmc[23] >> 2) & 0x1); + *c++ = ((xmc[23] & 0x3) << 6) + | ((xmc[24] & 0x7) << 3) + | (xmc[25] & 0x7); + *c++ = ((Nc[2] & 0x7F) << 1) /* 20 */ + | ((bc[2] >> 1) & 0x1); + *c++ = ((bc[2] & 0x1) << 7) + | ((Mc[2] & 0x3) << 5) + | ((xmaxc[2] >> 1) & 0x1F); + *c++ = ((xmaxc[2] & 0x1) << 7) + | ((xmc[26] & 0x7) << 4) + | ((xmc[27] & 0x7) << 1) + | ((xmc[28] >> 2) & 0x1); + *c++ = ((xmc[28] & 0x3) << 6) + | ((xmc[29] & 0x7) << 3) + | (xmc[30] & 0x7); + *c++ = ((xmc[31] & 0x7) << 5) + | ((xmc[32] & 0x7) << 2) + | ((xmc[33] >> 1) & 0x3); + *c++ = ((xmc[33] & 0x1) << 7) + | ((xmc[34] & 0x7) << 4) + | ((xmc[35] & 0x7) << 1) + | ((xmc[36] >> 2) & 0x1); + *c++ = ((xmc[36] & 0x3) << 6) + | ((xmc[37] & 0x7) << 3) + | (xmc[38] & 0x7); + *c++ = ((Nc[3] & 0x7F) << 1) + | ((bc[3] >> 1) & 0x1); + *c++ = ((bc[3] & 0x1) << 7) + | ((Mc[3] & 0x3) << 5) + | ((xmaxc[3] >> 1) & 0x1F); + *c++ = ((xmaxc[3] & 0x1) << 7) + | ((xmc[39] & 0x7) << 4) + | ((xmc[40] & 0x7) << 1) + | ((xmc[41] >> 2) & 0x1); + *c++ = ((xmc[41] & 0x3) << 6) /* 30 */ + | ((xmc[42] & 0x7) << 3) + | (xmc[43] & 0x7); + *c++ = ((xmc[44] & 0x7) << 5) + | ((xmc[45] & 0x7) << 2) + | ((xmc[46] >> 1) & 0x3); + *c++ = ((xmc[46] & 0x1) << 7) + | ((xmc[47] & 0x7) << 4) + | ((xmc[48] & 0x7) << 1) + | ((xmc[49] >> 2) & 0x1); + *c++ = ((xmc[49] & 0x3) << 6) + | ((xmc[50] & 0x7) << 3) + | (xmc[51] & 0x7); + + } +} +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: cfe9c43d-d97c-4216-b5e5-ccd6a25b582b +*/ + diff --git a/Libraries/SndFile/Files/src/GSM610/gsm_option.c b/Libraries/SndFile/Files/src/GSM610/gsm_option.c new file mode 100644 index 000000000..5c56d78df --- /dev/null +++ b/Libraries/SndFile/Files/src/GSM610/gsm_option.c @@ -0,0 +1,74 @@ +/* + * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische + * Universitaet Berlin. See the accompanying file "COPYRIGHT" for + * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. + */ + +#include "gsm610_priv.h" + +#include "gsm.h" + +int gsm_option (gsm r, int opt, int * val) +{ + int result = -1; + + switch (opt) { + case GSM_OPT_LTP_CUT: +#ifdef LTP_CUT + result = r->ltp_cut; + if (val) r->ltp_cut = *val; +#endif + break; + + case GSM_OPT_VERBOSE: +#ifndef NDEBUG + result = r->verbose; + if (val) r->verbose = *val; +#endif + break; + + case GSM_OPT_FAST: + +#if defined(FAST) && defined(USE_FLOAT_MUL) + result = r->fast; + if (val) r->fast = !!*val; +#endif + break; + + case GSM_OPT_FRAME_CHAIN: + +#ifdef WAV49 + result = r->frame_chain; + if (val) r->frame_chain = *val; +#endif + break; + + case GSM_OPT_FRAME_INDEX: + +#ifdef WAV49 + result = r->frame_index; + if (val) r->frame_index = *val; +#endif + break; + + case GSM_OPT_WAV49: + +#ifdef WAV49 + result = r->wav_fmt; + if (val) r->wav_fmt = !!*val; +#endif + break; + + default: + break; + } + return result; +} +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: 963ff156-506f-4359-9145-371e9060b030 +*/ + diff --git a/Libraries/SndFile/Files/src/GSM610/long_term.c b/Libraries/SndFile/Files/src/GSM610/long_term.c new file mode 100644 index 000000000..5179d1d09 --- /dev/null +++ b/Libraries/SndFile/Files/src/GSM610/long_term.c @@ -0,0 +1,951 @@ +/* + * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische + * Universitaet Berlin. See the accompanying file "COPYRIGHT" for + * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. + */ + +#include +#include + +#include "gsm610_priv.h" + +#include "gsm.h" + +/* + * 4.2.11 .. 4.2.12 LONG TERM PREDICTOR (LTP) SECTION + */ + + +/* + * This module computes the LTP gain (bc) and the LTP lag (Nc) + * for the long term analysis filter. This is done by calculating a + * maximum of the cross-correlation function between the current + * sub-segment short term residual signal d[0..39] (output of + * the short term analysis filter; for simplification the index + * of this array begins at 0 and ends at 39 for each sub-segment of the + * RPE-LTP analysis) and the previous reconstructed short term + * residual signal dp[ -120 .. -1 ]. A dynamic scaling must be + * performed to avoid overflow. + */ + + /* The next procedure exists in six versions. First two integer + * version (if USE_FLOAT_MUL is not defined); then four floating + * point versions, twice with proper scaling (USE_FLOAT_MUL defined), + * once without (USE_FLOAT_MUL and FAST defined, and fast run-time + * option used). Every pair has first a Cut version (see the -C + * option to toast or the LTP_CUT option to gsm_option()), then the + * uncut one. (For a detailed explanation of why this is altogether + * a bad idea, see Henry Spencer and Geoff Collyer, ``#ifdef Considered + * Harmful''.) + */ + +#ifndef USE_FLOAT_MUL + +#ifdef LTP_CUT + +static void Cut_Calculation_of_the_LTP_parameters ( + + struct gsm_state * st, + + register word * d, /* [0..39] IN */ + register word * dp, /* [-120..-1] IN */ + word * bc_out, /* OUT */ + word * Nc_out /* OUT */ +) +{ + register int k, lambda; + word Nc, bc; + word wt[40]; + + longword L_result; + longword L_max, L_power; + word R, S, dmax, scal, best_k; + word ltp_cut; + + register word temp, wt_k; + + /* Search of the optimum scaling of d[0..39]. + */ + dmax = 0; + for (k = 0; k <= 39; k++) { + temp = d[k]; + temp = GSM_ABS( temp ); + if (temp > dmax) { + dmax = temp; + best_k = k; + } + } + temp = 0; + if (dmax == 0) scal = 0; + else { + assert(dmax > 0); + temp = gsm_norm( (longword)dmax << 16 ); + } + if (temp > 6) scal = 0; + else scal = 6 - temp; + assert(scal >= 0); + + /* Search for the maximum cross-correlation and coding of the LTP lag + */ + L_max = 0; + Nc = 40; /* index for the maximum cross-correlation */ + wt_k = SASR_W(d[best_k], scal); + + for (lambda = 40; lambda <= 120; lambda++) { + L_result = (longword)wt_k * dp[best_k - lambda]; + if (L_result > L_max) { + Nc = lambda; + L_max = L_result; + } + } + *Nc_out = Nc; + L_max <<= 1; + + /* Rescaling of L_max + */ + assert(scal <= 100 && scal >= -100); + L_max = L_max >> (6 - scal); /* sub(6, scal) */ + + assert( Nc <= 120 && Nc >= 40); + + /* Compute the power of the reconstructed short term residual + * signal dp[..] + */ + L_power = 0; + for (k = 0; k <= 39; k++) { + + register longword L_temp; + + L_temp = SASR_W( dp[k - Nc], 3 ); + L_power += L_temp * L_temp; + } + L_power <<= 1; /* from L_MULT */ + + /* Normalization of L_max and L_power + */ + + if (L_max <= 0) { + *bc_out = 0; + return; + } + if (L_max >= L_power) { + *bc_out = 3; + return; + } + + temp = gsm_norm( L_power ); + + R = SASR( L_max << temp, 16 ); + S = SASR( L_power << temp, 16 ); + + /* Coding of the LTP gain + */ + + /* Table 4.3a must be used to obtain the level DLB[i] for the + * quantization of the LTP gain b to get the coded version bc. + */ + for (bc = 0; bc <= 2; bc++) if (R <= gsm_mult(S, gsm_DLB[bc])) break; + *bc_out = bc; +} + +#endif /* LTP_CUT */ + +static void Calculation_of_the_LTP_parameters ( + register word * d, /* [0..39] IN */ + register word * dp, /* [-120..-1] IN */ + word * bc_out, /* OUT */ + word * Nc_out /* OUT */ +) +{ + register int k, lambda; + word Nc, bc; + word wt[40]; + + longword L_max, L_power; + word R, S, dmax, scal; + register word temp; + + /* Search of the optimum scaling of d[0..39]. + */ + dmax = 0; + + for (k = 0; k <= 39; k++) { + temp = d[k]; + temp = GSM_ABS( temp ); + if (temp > dmax) dmax = temp; + } + + temp = 0; + if (dmax == 0) scal = 0; + else { + assert(dmax > 0); + temp = gsm_norm( (longword)dmax << 16 ); + } + + if (temp > 6) scal = 0; + else scal = 6 - temp; + + assert(scal >= 0); + + /* Initialization of a working array wt + */ + + for (k = 0; k <= 39; k++) wt[k] = SASR_W( d[k], scal ); + + /* Search for the maximum cross-correlation and coding of the LTP lag + */ + L_max = 0; + Nc = 40; /* index for the maximum cross-correlation */ + + for (lambda = 40; lambda <= 120; lambda++) { + +# undef STEP +# define STEP(k) (longword)wt[k] * dp[k - lambda] + + register longword L_result; + + L_result = STEP(0) ; L_result += STEP(1) ; + L_result += STEP(2) ; L_result += STEP(3) ; + L_result += STEP(4) ; L_result += STEP(5) ; + L_result += STEP(6) ; L_result += STEP(7) ; + L_result += STEP(8) ; L_result += STEP(9) ; + L_result += STEP(10) ; L_result += STEP(11) ; + L_result += STEP(12) ; L_result += STEP(13) ; + L_result += STEP(14) ; L_result += STEP(15) ; + L_result += STEP(16) ; L_result += STEP(17) ; + L_result += STEP(18) ; L_result += STEP(19) ; + L_result += STEP(20) ; L_result += STEP(21) ; + L_result += STEP(22) ; L_result += STEP(23) ; + L_result += STEP(24) ; L_result += STEP(25) ; + L_result += STEP(26) ; L_result += STEP(27) ; + L_result += STEP(28) ; L_result += STEP(29) ; + L_result += STEP(30) ; L_result += STEP(31) ; + L_result += STEP(32) ; L_result += STEP(33) ; + L_result += STEP(34) ; L_result += STEP(35) ; + L_result += STEP(36) ; L_result += STEP(37) ; + L_result += STEP(38) ; L_result += STEP(39) ; + + if (L_result > L_max) { + + Nc = lambda; + L_max = L_result; + } + } + + *Nc_out = Nc; + + L_max <<= 1; + + /* Rescaling of L_max + */ + assert(scal <= 100 && scal >= -100); + L_max = L_max >> (6 - scal); /* sub(6, scal) */ + + assert( Nc <= 120 && Nc >= 40); + + /* Compute the power of the reconstructed short term residual + * signal dp[..] + */ + L_power = 0; + for (k = 0; k <= 39; k++) { + + register longword L_temp; + + L_temp = SASR_W( dp[k - Nc], 3 ); + L_power += L_temp * L_temp; + } + L_power <<= 1; /* from L_MULT */ + + /* Normalization of L_max and L_power + */ + + if (L_max <= 0) { + *bc_out = 0; + return; + } + if (L_max >= L_power) { + *bc_out = 3; + return; + } + + temp = gsm_norm( L_power ); + + R = SASR_L( L_max << temp, 16 ); + S = SASR_L( L_power << temp, 16 ); + + /* Coding of the LTP gain + */ + + /* Table 4.3a must be used to obtain the level DLB[i] for the + * quantization of the LTP gain b to get the coded version bc. + */ + for (bc = 0; bc <= 2; bc++) if (R <= gsm_mult(S, gsm_DLB[bc])) break; + *bc_out = bc; +} + +#else /* USE_FLOAT_MUL */ + +#ifdef LTP_CUT + +static void Cut_Calculation_of_the_LTP_parameters ( + struct gsm_state * st, /* IN */ + register word * d, /* [0..39] IN */ + register word * dp, /* [-120..-1] IN */ + word * bc_out, /* OUT */ + word * Nc_out /* OUT */ +) +{ + register int k, lambda; + word Nc, bc; + word ltp_cut; + + float wt_float[40]; + float dp_float_base[120], * dp_float = dp_float_base + 120; + + longword L_max, L_power; + word R, S, dmax, scal; + register word temp; + + /* Search of the optimum scaling of d[0..39]. + */ + dmax = 0; + + for (k = 0; k <= 39; k++) { + temp = d[k]; + temp = GSM_ABS( temp ); + if (temp > dmax) dmax = temp; + } + + temp = 0; + if (dmax == 0) scal = 0; + else { + assert(dmax > 0); + temp = gsm_norm( (longword)dmax << 16 ); + } + + if (temp > 6) scal = 0; + else scal = 6 - temp; + + assert(scal >= 0); + ltp_cut = (longword)SASR_W(dmax, scal) * st->ltp_cut / 100; + + + /* Initialization of a working array wt + */ + + for (k = 0; k < 40; k++) { + register word w = SASR_W( d[k], scal ); + if (w < 0 ? w > -ltp_cut : w < ltp_cut) { + wt_float[k] = 0.0; + } + else { + wt_float[k] = w; + } + } + for (k = -120; k < 0; k++) dp_float[k] = dp[k]; + + /* Search for the maximum cross-correlation and coding of the LTP lag + */ + L_max = 0; + Nc = 40; /* index for the maximum cross-correlation */ + + for (lambda = 40; lambda <= 120; lambda += 9) { + + /* Calculate L_result for l = lambda .. lambda + 9. + */ + register float *lp = dp_float - lambda; + + register float W; + register float a = lp[-8], b = lp[-7], c = lp[-6], + d = lp[-5], e = lp[-4], f = lp[-3], + g = lp[-2], h = lp[-1]; + register float E; + register float S0 = 0, S1 = 0, S2 = 0, S3 = 0, S4 = 0, + S5 = 0, S6 = 0, S7 = 0, S8 = 0; + +# undef STEP +# define STEP(K, a, b, c, d, e, f, g, h) \ + if ((W = wt_float[K]) != 0.0) { \ + E = W * a; S8 += E; \ + E = W * b; S7 += E; \ + E = W * c; S6 += E; \ + E = W * d; S5 += E; \ + E = W * e; S4 += E; \ + E = W * f; S3 += E; \ + E = W * g; S2 += E; \ + E = W * h; S1 += E; \ + a = lp[K]; \ + E = W * a; S0 += E; } else (a = lp[K]) + +# define STEP_A(K) STEP(K, a, b, c, d, e, f, g, h) +# define STEP_B(K) STEP(K, b, c, d, e, f, g, h, a) +# define STEP_C(K) STEP(K, c, d, e, f, g, h, a, b) +# define STEP_D(K) STEP(K, d, e, f, g, h, a, b, c) +# define STEP_E(K) STEP(K, e, f, g, h, a, b, c, d) +# define STEP_F(K) STEP(K, f, g, h, a, b, c, d, e) +# define STEP_G(K) STEP(K, g, h, a, b, c, d, e, f) +# define STEP_H(K) STEP(K, h, a, b, c, d, e, f, g) + + STEP_A( 0); STEP_B( 1); STEP_C( 2); STEP_D( 3); + STEP_E( 4); STEP_F( 5); STEP_G( 6); STEP_H( 7); + + STEP_A( 8); STEP_B( 9); STEP_C(10); STEP_D(11); + STEP_E(12); STEP_F(13); STEP_G(14); STEP_H(15); + + STEP_A(16); STEP_B(17); STEP_C(18); STEP_D(19); + STEP_E(20); STEP_F(21); STEP_G(22); STEP_H(23); + + STEP_A(24); STEP_B(25); STEP_C(26); STEP_D(27); + STEP_E(28); STEP_F(29); STEP_G(30); STEP_H(31); + + STEP_A(32); STEP_B(33); STEP_C(34); STEP_D(35); + STEP_E(36); STEP_F(37); STEP_G(38); STEP_H(39); + + if (S0 > L_max) { L_max = S0; Nc = lambda; } + if (S1 > L_max) { L_max = S1; Nc = lambda + 1; } + if (S2 > L_max) { L_max = S2; Nc = lambda + 2; } + if (S3 > L_max) { L_max = S3; Nc = lambda + 3; } + if (S4 > L_max) { L_max = S4; Nc = lambda + 4; } + if (S5 > L_max) { L_max = S5; Nc = lambda + 5; } + if (S6 > L_max) { L_max = S6; Nc = lambda + 6; } + if (S7 > L_max) { L_max = S7; Nc = lambda + 7; } + if (S8 > L_max) { L_max = S8; Nc = lambda + 8; } + + } + *Nc_out = Nc; + + L_max <<= 1; + + /* Rescaling of L_max + */ + assert(scal <= 100 && scal >= -100); + L_max = L_max >> (6 - scal); /* sub(6, scal) */ + + assert( Nc <= 120 && Nc >= 40); + + /* Compute the power of the reconstructed short term residual + * signal dp[..] + */ + L_power = 0; + for (k = 0; k <= 39; k++) { + + register longword L_temp; + + L_temp = SASR_W( dp[k - Nc], 3 ); + L_power += L_temp * L_temp; + } + L_power <<= 1; /* from L_MULT */ + + /* Normalization of L_max and L_power + */ + + if (L_max <= 0) { + *bc_out = 0; + return; + } + if (L_max >= L_power) { + *bc_out = 3; + return; + } + + temp = gsm_norm( L_power ); + + R = SASR( L_max << temp, 16 ); + S = SASR( L_power << temp, 16 ); + + /* Coding of the LTP gain + */ + + /* Table 4.3a must be used to obtain the level DLB[i] for the + * quantization of the LTP gain b to get the coded version bc. + */ + for (bc = 0; bc <= 2; bc++) if (R <= gsm_mult(S, gsm_DLB[bc])) break; + *bc_out = bc; +} + +#endif /* LTP_CUT */ + +static void Calculation_of_the_LTP_parameters ( + register word * din, /* [0..39] IN */ + register word * dp, /* [-120..-1] IN */ + word * bc_out, /* OUT */ + word * Nc_out /* OUT */ +) +{ + register int k, lambda; + word Nc, bc; + + float wt_float[40]; + float dp_float_base[120], * dp_float = dp_float_base + 120; + + longword L_max, L_power; + word R, S, dmax, scal; + register word temp; + + /* Search of the optimum scaling of d[0..39]. + */ + dmax = 0; + + for (k = 0; k <= 39; k++) { + temp = din [k] ; + temp = GSM_ABS (temp) ; + if (temp > dmax) dmax = temp; + } + + temp = 0; + if (dmax == 0) scal = 0; + else { + assert(dmax > 0); + temp = gsm_norm( (longword)dmax << 16 ); + } + + if (temp > 6) scal = 0; + else scal = 6 - temp; + + assert(scal >= 0); + + /* Initialization of a working array wt + */ + + for (k = 0; k < 40; k++) wt_float[k] = SASR_W (din [k], scal) ; + for (k = -120; k < 0; k++) dp_float[k] = dp[k]; + + /* Search for the maximum cross-correlation and coding of the LTP lag + */ + L_max = 0; + Nc = 40; /* index for the maximum cross-correlation */ + + for (lambda = 40; lambda <= 120; lambda += 9) { + + /* Calculate L_result for l = lambda .. lambda + 9. + */ + register float *lp = dp_float - lambda; + + register float W; + register float a = lp[-8], b = lp[-7], c = lp[-6], + d = lp[-5], e = lp[-4], f = lp[-3], + g = lp[-2], h = lp[-1]; + register float E; + register float S0 = 0, S1 = 0, S2 = 0, S3 = 0, S4 = 0, + S5 = 0, S6 = 0, S7 = 0, S8 = 0; + +# undef STEP +# define STEP(K, a, b, c, d, e, f, g, h) \ + W = wt_float[K]; \ + E = W * a; S8 += E; \ + E = W * b; S7 += E; \ + E = W * c; S6 += E; \ + E = W * d; S5 += E; \ + E = W * e; S4 += E; \ + E = W * f; S3 += E; \ + E = W * g; S2 += E; \ + E = W * h; S1 += E; \ + a = lp[K]; \ + E = W * a; S0 += E + +# define STEP_A(K) STEP(K, a, b, c, d, e, f, g, h) +# define STEP_B(K) STEP(K, b, c, d, e, f, g, h, a) +# define STEP_C(K) STEP(K, c, d, e, f, g, h, a, b) +# define STEP_D(K) STEP(K, d, e, f, g, h, a, b, c) +# define STEP_E(K) STEP(K, e, f, g, h, a, b, c, d) +# define STEP_F(K) STEP(K, f, g, h, a, b, c, d, e) +# define STEP_G(K) STEP(K, g, h, a, b, c, d, e, f) +# define STEP_H(K) STEP(K, h, a, b, c, d, e, f, g) + + STEP_A( 0); STEP_B( 1); STEP_C( 2); STEP_D( 3); + STEP_E( 4); STEP_F( 5); STEP_G( 6); STEP_H( 7); + + STEP_A( 8); STEP_B( 9); STEP_C(10); STEP_D(11); + STEP_E(12); STEP_F(13); STEP_G(14); STEP_H(15); + + STEP_A(16); STEP_B(17); STEP_C(18); STEP_D(19); + STEP_E(20); STEP_F(21); STEP_G(22); STEP_H(23); + + STEP_A(24); STEP_B(25); STEP_C(26); STEP_D(27); + STEP_E(28); STEP_F(29); STEP_G(30); STEP_H(31); + + STEP_A(32); STEP_B(33); STEP_C(34); STEP_D(35); + STEP_E(36); STEP_F(37); STEP_G(38); STEP_H(39); + + if (S0 > L_max) { L_max = S0; Nc = lambda; } + if (S1 > L_max) { L_max = S1; Nc = lambda + 1; } + if (S2 > L_max) { L_max = S2; Nc = lambda + 2; } + if (S3 > L_max) { L_max = S3; Nc = lambda + 3; } + if (S4 > L_max) { L_max = S4; Nc = lambda + 4; } + if (S5 > L_max) { L_max = S5; Nc = lambda + 5; } + if (S6 > L_max) { L_max = S6; Nc = lambda + 6; } + if (S7 > L_max) { L_max = S7; Nc = lambda + 7; } + if (S8 > L_max) { L_max = S8; Nc = lambda + 8; } + } + *Nc_out = Nc; + + L_max <<= 1; + + /* Rescaling of L_max + */ + assert(scal <= 100 && scal >= -100); + L_max = L_max >> (6 - scal); /* sub(6, scal) */ + + assert( Nc <= 120 && Nc >= 40); + + /* Compute the power of the reconstructed short term residual + * signal dp[..] + */ + L_power = 0; + for (k = 0; k <= 39; k++) { + + register longword L_temp; + + L_temp = SASR_W( dp[k - Nc], 3 ); + L_power += L_temp * L_temp; + } + L_power <<= 1; /* from L_MULT */ + + /* Normalization of L_max and L_power + */ + + if (L_max <= 0) { + *bc_out = 0; + return; + } + if (L_max >= L_power) { + *bc_out = 3; + return; + } + + temp = gsm_norm( L_power ); + + R = SASR_L ( L_max << temp, 16 ); + S = SASR_L ( L_power << temp, 16 ); + + /* Coding of the LTP gain + */ + + /* Table 4.3a must be used to obtain the level DLB[i] for the + * quantization of the LTP gain b to get the coded version bc. + */ + for (bc = 0; bc <= 2; bc++) if (R <= gsm_mult(S, gsm_DLB[bc])) break; + *bc_out = bc; +} + +#ifdef FAST +#ifdef LTP_CUT + +static void Cut_Fast_Calculation_of_the_LTP_parameters ( + struct gsm_state * st, /* IN */ + register word * d, /* [0..39] IN */ + register word * dp, /* [-120..-1] IN */ + word * bc_out, /* OUT */ + word * Nc_out /* OUT */ +) +{ + register int k, lambda; + register float wt_float; + word Nc, bc; + word wt_max, best_k, ltp_cut; + + float dp_float_base[120], * dp_float = dp_float_base + 120; + + register float L_result, L_max, L_power; + + wt_max = 0; + + for (k = 0; k < 40; ++k) { + if ( d[k] > wt_max) wt_max = d[best_k = k]; + else if (-d[k] > wt_max) wt_max = -d[best_k = k]; + } + + assert(wt_max >= 0); + wt_float = (float)wt_max; + + for (k = -120; k < 0; ++k) dp_float[k] = (float)dp[k]; + + /* Search for the maximum cross-correlation and coding of the LTP lag + */ + L_max = 0; + Nc = 40; /* index for the maximum cross-correlation */ + + for (lambda = 40; lambda <= 120; lambda++) { + L_result = wt_float * dp_float[best_k - lambda]; + if (L_result > L_max) { + Nc = lambda; + L_max = L_result; + } + } + + *Nc_out = Nc; + if (L_max <= 0.) { + *bc_out = 0; + return; + } + + /* Compute the power of the reconstructed short term residual + * signal dp[..] + */ + dp_float -= Nc; + L_power = 0; + for (k = 0; k < 40; ++k) { + register float f = dp_float[k]; + L_power += f * f; + } + + if (L_max >= L_power) { + *bc_out = 3; + return; + } + + /* Coding of the LTP gain + * Table 4.3a must be used to obtain the level DLB[i] for the + * quantization of the LTP gain b to get the coded version bc. + */ + lambda = L_max / L_power * 32768.; + for (bc = 0; bc <= 2; ++bc) if (lambda <= gsm_DLB[bc]) break; + *bc_out = bc; +} + +#endif /* LTP_CUT */ + +static void Fast_Calculation_of_the_LTP_parameters ( + register word * din, /* [0..39] IN */ + register word * dp, /* [-120..-1] IN */ + word * bc_out, /* OUT */ + word * Nc_out /* OUT */ +) +{ + register int k, lambda; + word Nc, bc; + + float wt_float[40]; + float dp_float_base[120], * dp_float = dp_float_base + 120; + + register float L_max, L_power; + + for (k = 0; k < 40; ++k) wt_float[k] = (float) din [k] ; + for (k = -120; k < 0; ++k) dp_float[k] = (float) dp [k] ; + + /* Search for the maximum cross-correlation and coding of the LTP lag + */ + L_max = 0; + Nc = 40; /* index for the maximum cross-correlation */ + + for (lambda = 40; lambda <= 120; lambda += 9) { + + /* Calculate L_result for l = lambda .. lambda + 9. + */ + register float *lp = dp_float - lambda; + + register float W; + register float a = lp[-8], b = lp[-7], c = lp[-6], + d = lp[-5], e = lp[-4], f = lp[-3], + g = lp[-2], h = lp[-1]; + register float E; + register float S0 = 0, S1 = 0, S2 = 0, S3 = 0, S4 = 0, + S5 = 0, S6 = 0, S7 = 0, S8 = 0; + +# undef STEP +# define STEP(K, a, b, c, d, e, f, g, h) \ + W = wt_float[K]; \ + E = W * a; S8 += E; \ + E = W * b; S7 += E; \ + E = W * c; S6 += E; \ + E = W * d; S5 += E; \ + E = W * e; S4 += E; \ + E = W * f; S3 += E; \ + E = W * g; S2 += E; \ + E = W * h; S1 += E; \ + a = lp[K]; \ + E = W * a; S0 += E + +# define STEP_A(K) STEP(K, a, b, c, d, e, f, g, h) +# define STEP_B(K) STEP(K, b, c, d, e, f, g, h, a) +# define STEP_C(K) STEP(K, c, d, e, f, g, h, a, b) +# define STEP_D(K) STEP(K, d, e, f, g, h, a, b, c) +# define STEP_E(K) STEP(K, e, f, g, h, a, b, c, d) +# define STEP_F(K) STEP(K, f, g, h, a, b, c, d, e) +# define STEP_G(K) STEP(K, g, h, a, b, c, d, e, f) +# define STEP_H(K) STEP(K, h, a, b, c, d, e, f, g) + + STEP_A( 0); STEP_B( 1); STEP_C( 2); STEP_D( 3); + STEP_E( 4); STEP_F( 5); STEP_G( 6); STEP_H( 7); + + STEP_A( 8); STEP_B( 9); STEP_C(10); STEP_D(11); + STEP_E(12); STEP_F(13); STEP_G(14); STEP_H(15); + + STEP_A(16); STEP_B(17); STEP_C(18); STEP_D(19); + STEP_E(20); STEP_F(21); STEP_G(22); STEP_H(23); + + STEP_A(24); STEP_B(25); STEP_C(26); STEP_D(27); + STEP_E(28); STEP_F(29); STEP_G(30); STEP_H(31); + + STEP_A(32); STEP_B(33); STEP_C(34); STEP_D(35); + STEP_E(36); STEP_F(37); STEP_G(38); STEP_H(39); + + if (S0 > L_max) { L_max = S0; Nc = lambda; } + if (S1 > L_max) { L_max = S1; Nc = lambda + 1; } + if (S2 > L_max) { L_max = S2; Nc = lambda + 2; } + if (S3 > L_max) { L_max = S3; Nc = lambda + 3; } + if (S4 > L_max) { L_max = S4; Nc = lambda + 4; } + if (S5 > L_max) { L_max = S5; Nc = lambda + 5; } + if (S6 > L_max) { L_max = S6; Nc = lambda + 6; } + if (S7 > L_max) { L_max = S7; Nc = lambda + 7; } + if (S8 > L_max) { L_max = S8; Nc = lambda + 8; } + } + *Nc_out = Nc; + + if (L_max <= 0.) { + *bc_out = 0; + return; + } + + /* Compute the power of the reconstructed short term residual + * signal dp[..] + */ + dp_float -= Nc; + L_power = 0; + for (k = 0; k < 40; ++k) { + register float f = dp_float[k]; + L_power += f * f; + } + + if (L_max >= L_power) { + *bc_out = 3; + return; + } + + /* Coding of the LTP gain + * Table 4.3a must be used to obtain the level DLB[i] for the + * quantization of the LTP gain b to get the coded version bc. + */ + lambda = L_max / L_power * 32768.; + for (bc = 0; bc <= 2; ++bc) if (lambda <= gsm_DLB[bc]) break; + *bc_out = bc; +} + +#endif /* FAST */ +#endif /* USE_FLOAT_MUL */ + + +/* 4.2.12 */ + +static void Long_term_analysis_filtering ( + word bc, /* IN */ + word Nc, /* IN */ + register word * dp, /* previous d [-120..-1] IN */ + register word * d, /* d [0..39] IN */ + register word * dpp, /* estimate [0..39] OUT */ + register word * e /* long term res. signal [0..39] OUT */ +) +/* + * In this part, we have to decode the bc parameter to compute + * the samples of the estimate dpp[0..39]. The decoding of bc needs the + * use of table 4.3b. The long term residual signal e[0..39] + * is then calculated to be fed to the RPE encoding section. + */ +{ + register int k; + +# undef STEP +# define STEP(BP) \ + for (k = 0; k <= 39; k++) { \ + dpp[k] = GSM_MULT_R( BP, dp[k - Nc]); \ + e[k] = GSM_SUB( d[k], dpp[k] ); \ + } + + switch (bc) { + case 0: STEP( 3277 ); break; + case 1: STEP( 11469 ); break; + case 2: STEP( 21299 ); break; + case 3: STEP( 32767 ); break; + } +} + +void Gsm_Long_Term_Predictor ( /* 4x for 160 samples */ + + struct gsm_state * S, + + word * d, /* [0..39] residual signal IN */ + word * dp, /* [-120..-1] d' IN */ + + word * e, /* [0..39] OUT */ + word * dpp, /* [0..39] OUT */ + word * Nc, /* correlation lag OUT */ + word * bc /* gain factor OUT */ +) +{ + assert( d ); assert( dp ); assert( e ); + assert( dpp); assert( Nc ); assert( bc ); + +#if defined(FAST) && defined(USE_FLOAT_MUL) + if (S->fast) +#if defined (LTP_CUT) + if (S->ltp_cut) + Cut_Fast_Calculation_of_the_LTP_parameters(S, + d, dp, bc, Nc); + else +#endif /* LTP_CUT */ + Fast_Calculation_of_the_LTP_parameters(d, dp, bc, Nc ); + else +#endif /* FAST & USE_FLOAT_MUL */ +#ifdef LTP_CUT + if (S->ltp_cut) + Cut_Calculation_of_the_LTP_parameters(S, d, dp, bc, Nc); + else +#endif + Calculation_of_the_LTP_parameters(d, dp, bc, Nc); + + Long_term_analysis_filtering( *bc, *Nc, dp, d, dpp, e ); +} + +/* 4.3.2 */ +void Gsm_Long_Term_Synthesis_Filtering ( + struct gsm_state * S, + + word Ncr, + word bcr, + register word * erp, /* [0..39] IN */ + register word * drp /* [-120..-1] IN, [-120..40] OUT */ +) +/* + * This procedure uses the bcr and Ncr parameter to realize the + * long term synthesis filtering. The decoding of bcr needs + * table 4.3b. + */ +{ + register int k; + word brp, drpp, Nr; + + /* Check the limits of Nr. + */ + Nr = Ncr < 40 || Ncr > 120 ? S->nrp : Ncr; + S->nrp = Nr; + assert(Nr >= 40 && Nr <= 120); + + /* Decoding of the LTP gain bcr + */ + brp = gsm_QLB[ bcr ]; + + /* Computation of the reconstructed short term residual + * signal drp[0..39] + */ + assert(brp != MIN_WORD); + + for (k = 0; k <= 39; k++) { + drpp = GSM_MULT_R( brp, drp[ k - Nr ] ); + drp[k] = GSM_ADD( erp[k], drpp ); + } + + /* + * Update of the reconstructed short term residual signal + * drp[ -1..-120 ] + */ + + for (k = 0; k <= 119; k++) drp[ -120 + k ] = drp[ -80 + k ]; +} +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: b369b90d-0284-42a0-87b0-99a25bbd93ac +*/ + diff --git a/Libraries/SndFile/Files/src/GSM610/lpc.c b/Libraries/SndFile/Files/src/GSM610/lpc.c new file mode 100644 index 000000000..0a879f354 --- /dev/null +++ b/Libraries/SndFile/Files/src/GSM610/lpc.c @@ -0,0 +1,341 @@ +/* + * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische + * Universitaet Berlin. See the accompanying file "COPYRIGHT" for + * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. + */ + +#include +#include + +#include "gsm610_priv.h" + +#include "gsm.h" + +/* + * 4.2.4 .. 4.2.7 LPC ANALYSIS SECTION + */ + +/* 4.2.4 */ + + +static void Autocorrelation ( + word * s, /* [0..159] IN/OUT */ + longword * L_ACF) /* [0..8] OUT */ +/* + * The goal is to compute the array L_ACF[k]. The signal s[i] must + * be scaled in order to avoid an overflow situation. + */ +{ + register int k, i; + + word temp, smax, scalauto; + +#ifdef USE_FLOAT_MUL + float float_s[160]; +#endif + + /* Dynamic scaling of the array s[0..159] + */ + + /* Search for the maximum. + */ + smax = 0; + for (k = 0; k <= 159; k++) { + temp = GSM_ABS( s[k] ); + if (temp > smax) smax = temp; + } + + /* Computation of the scaling factor. + */ + if (smax == 0) scalauto = 0; + else { + assert(smax > 0); + scalauto = 4 - gsm_norm( (longword)smax << 16 );/* sub(4,..) */ + } + + /* Scaling of the array s[0...159] + */ + + if (scalauto > 0) { + +# ifdef USE_FLOAT_MUL +# define SCALE(n) \ + case n: for (k = 0; k <= 159; k++) \ + float_s[k] = (float) \ + (s[k] = GSM_MULT_R(s[k], 16384 >> (n-1)));\ + break; +# else +# define SCALE(n) \ + case n: for (k = 0; k <= 159; k++) \ + s[k] = GSM_MULT_R( s[k], 16384 >> (n-1) );\ + break; +# endif /* USE_FLOAT_MUL */ + + switch (scalauto) { + SCALE(1) + SCALE(2) + SCALE(3) + SCALE(4) + } +# undef SCALE + } +# ifdef USE_FLOAT_MUL + else for (k = 0; k <= 159; k++) float_s[k] = (float) s[k]; +# endif + + /* Compute the L_ACF[..]. + */ + { +# ifdef USE_FLOAT_MUL + register float * sp = float_s; + register float sl = *sp; + +# define STEP(k) L_ACF[k] += (longword)(sl * sp[ -(k) ]); +# else + word * sp = s; + word sl = *sp; + +# define STEP(k) L_ACF[k] += ((longword)sl * sp[ -(k) ]); +# endif + +# define NEXTI sl = *++sp + + + for (k = 9; k--; L_ACF[k] = 0) ; + + STEP (0); + NEXTI; + STEP(0); STEP(1); + NEXTI; + STEP(0); STEP(1); STEP(2); + NEXTI; + STEP(0); STEP(1); STEP(2); STEP(3); + NEXTI; + STEP(0); STEP(1); STEP(2); STEP(3); STEP(4); + NEXTI; + STEP(0); STEP(1); STEP(2); STEP(3); STEP(4); STEP(5); + NEXTI; + STEP(0); STEP(1); STEP(2); STEP(3); STEP(4); STEP(5); STEP(6); + NEXTI; + STEP(0); STEP(1); STEP(2); STEP(3); STEP(4); STEP(5); STEP(6); STEP(7); + + for (i = 8; i <= 159; i++) { + + NEXTI; + + STEP(0); + STEP(1); STEP(2); STEP(3); STEP(4); + STEP(5); STEP(6); STEP(7); STEP(8); + } + + for (k = 9; k--; L_ACF[k] <<= 1) ; + + } + /* Rescaling of the array s[0..159] + */ + if (scalauto > 0) { + assert(scalauto <= 4); + for (k = 160; k--; *s++ <<= scalauto) ; + } +} + +#if defined(USE_FLOAT_MUL) && defined(FAST) + +static void Fast_Autocorrelation ( + word * s, /* [0..159] IN/OUT */ + longword * L_ACF) /* [0..8] OUT */ +{ + register int k, i; + float f_L_ACF[9]; + float scale; + + float s_f[160]; + register float *sf = s_f; + + for (i = 0; i < 160; ++i) sf[i] = s[i]; + for (k = 0; k <= 8; k++) { + register float L_temp2 = 0; + register float *sfl = sf - k; + for (i = k; i < 160; ++i) L_temp2 += sf[i] * sfl[i]; + f_L_ACF[k] = L_temp2; + } + scale = MAX_LONGWORD / f_L_ACF[0]; + + for (k = 0; k <= 8; k++) { + L_ACF[k] = f_L_ACF[k] * scale; + } +} +#endif /* defined (USE_FLOAT_MUL) && defined (FAST) */ + +/* 4.2.5 */ + +static void Reflection_coefficients ( + longword * L_ACF, /* 0...8 IN */ + register word * r /* 0...7 OUT */ +) +{ + register int i, m, n; + register word temp; + word ACF[9]; /* 0..8 */ + word P[ 9]; /* 0..8 */ + word K[ 9]; /* 2..8 */ + + /* Schur recursion with 16 bits arithmetic. + */ + + if (L_ACF[0] == 0) { + for (i = 8; i--; *r++ = 0) ; + return; + } + + assert( L_ACF[0] != 0 ); + temp = gsm_norm( L_ACF[0] ); + + assert(temp >= 0 && temp < 32); + + /* ? overflow ? */ + for (i = 0; i <= 8; i++) ACF[i] = SASR_L( L_ACF[i] << temp, 16 ); + + /* Initialize array P[..] and K[..] for the recursion. + */ + + for (i = 1; i <= 7; i++) K[ i ] = ACF[ i ]; + for (i = 0; i <= 8; i++) P[ i ] = ACF[ i ]; + + /* Compute reflection coefficients + */ + for (n = 1; n <= 8; n++, r++) { + + temp = P[1]; + temp = GSM_ABS(temp); + if (P[0] < temp) { + for (i = n; i <= 8; i++) *r++ = 0; + return; + } + + *r = gsm_div( temp, P[0] ); + + assert(*r >= 0); + if (P[1] > 0) *r = -*r; /* r[n] = sub(0, r[n]) */ + assert (*r != MIN_WORD); + if (n == 8) return; + + /* Schur recursion + */ + temp = GSM_MULT_R( P[1], *r ); + P[0] = GSM_ADD( P[0], temp ); + + for (m = 1; m <= 8 - n; m++) { + temp = GSM_MULT_R( K[ m ], *r ); + P[m] = GSM_ADD( P[ m+1 ], temp ); + + temp = GSM_MULT_R( P[ m+1 ], *r ); + K[m] = GSM_ADD( K[ m ], temp ); + } + } +} + +/* 4.2.6 */ + +static void Transformation_to_Log_Area_Ratios ( + register word * r /* 0..7 IN/OUT */ +) +/* + * The following scaling for r[..] and LAR[..] has been used: + * + * r[..] = integer( real_r[..]*32768. ); -1 <= real_r < 1. + * LAR[..] = integer( real_LAR[..] * 16384 ); + * with -1.625 <= real_LAR <= 1.625 + */ +{ + register word temp; + register int i; + + + /* Computation of the LAR[0..7] from the r[0..7] + */ + for (i = 1; i <= 8; i++, r++) { + + temp = *r; + temp = GSM_ABS(temp); + assert(temp >= 0); + + if (temp < 22118) { + temp >>= 1; + } else if (temp < 31130) { + assert( temp >= 11059 ); + temp -= 11059; + } else { + assert( temp >= 26112 ); + temp -= 26112; + temp <<= 2; + } + + *r = *r < 0 ? -temp : temp; + assert( *r != MIN_WORD ); + } +} + +/* 4.2.7 */ + +static void Quantization_and_coding ( + register word * LAR /* [0..7] IN/OUT */ +) +{ + register word temp; + + /* This procedure needs four tables; the following equations + * give the optimum scaling for the constants: + * + * A[0..7] = integer( real_A[0..7] * 1024 ) + * B[0..7] = integer( real_B[0..7] * 512 ) + * MAC[0..7] = maximum of the LARc[0..7] + * MIC[0..7] = minimum of the LARc[0..7] + */ + +# undef STEP +# define STEP( A, B, MAC, MIC ) \ + temp = GSM_MULT( A, *LAR ); \ + temp = GSM_ADD( temp, B ); \ + temp = GSM_ADD( temp, 256 ); \ + temp = SASR_W( temp, 9 ); \ + *LAR = temp>MAC ? MAC - MIC : (tempfast) Fast_Autocorrelation (s, L_ACF ); + else +#endif + Autocorrelation (s, L_ACF ); + Reflection_coefficients (L_ACF, LARc ); + Transformation_to_Log_Area_Ratios (LARc); + Quantization_and_coding (LARc); +} +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: 63146664-a002-4e1e-8b7b-f0cc8a6a53da +*/ + diff --git a/Libraries/SndFile/Files/src/GSM610/preprocess.c b/Libraries/SndFile/Files/src/GSM610/preprocess.c new file mode 100644 index 000000000..d1b473d69 --- /dev/null +++ b/Libraries/SndFile/Files/src/GSM610/preprocess.c @@ -0,0 +1,115 @@ +/* + * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische + * Universitaet Berlin. See the accompanying file "COPYRIGHT" for + * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. + */ + +#include +#include + +#include "gsm610_priv.h" + +#include "gsm.h" + +/* 4.2.0 .. 4.2.3 PREPROCESSING SECTION + * + * After A-law to linear conversion (or directly from the + * Ato D converter) the following scaling is assumed for + * input to the RPE-LTP algorithm: + * + * in: 0.1.....................12 + * S.v.v.v.v.v.v.v.v.v.v.v.v.*.*.* + * + * Where S is the sign bit, v a valid bit, and * a "don't care" bit. + * The original signal is called sop[..] + * + * out: 0.1................... 12 + * S.S.v.v.v.v.v.v.v.v.v.v.v.v.0.0 + */ + + +void Gsm_Preprocess ( + struct gsm_state * S, + word * s, + word * so ) /* [0..159] IN/OUT */ +{ + + word z1 = S->z1; + longword L_z2 = S->L_z2; + word mp = S->mp; + + word s1; + longword L_s2; + + longword L_temp; + + word msp, lsp; + word SO; + + register int k = 160; + + while (k--) { + + /* 4.2.1 Downscaling of the input signal + */ + SO = SASR_W( *s, 3 ) << 2; + s++; + + assert (SO >= -0x4000); /* downscaled by */ + assert (SO <= 0x3FFC); /* previous routine. */ + + + /* 4.2.2 Offset compensation + * + * This part implements a high-pass filter and requires extended + * arithmetic precision for the recursive part of this filter. + * The input of this procedure is the array so[0...159] and the + * output the array sof[ 0...159 ]. + */ + /* Compute the non-recursive part + */ + + s1 = SO - z1; /* s1 = gsm_sub( *so, z1 ); */ + z1 = SO; + + assert(s1 != MIN_WORD); + + /* Compute the recursive part + */ + L_s2 = s1; + L_s2 <<= 15; + + /* Execution of a 31 bv 16 bits multiplication + */ + + msp = SASR_L( L_z2, 15 ); + lsp = L_z2-((longword)msp<<15); /* gsm_L_sub(L_z2,(msp<<15)); */ + + L_s2 += GSM_MULT_R( lsp, 32735 ); + L_temp = (longword)msp * 32735; /* GSM_L_MULT(msp,32735) >> 1;*/ + L_z2 = GSM_L_ADD( L_temp, L_s2 ); + + /* Compute sof[k] with rounding + */ + L_temp = GSM_L_ADD( L_z2, 16384 ); + + /* 4.2.3 Preemphasis + */ + + msp = GSM_MULT_R( mp, -28180 ); + mp = SASR_L( L_temp, 15 ); + *so++ = GSM_ADD( mp, msp ); + } + + S->z1 = z1; + S->L_z2 = L_z2; + S->mp = mp; +} +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: b760b0d9-3a05-4da3-9dc9-441ffb905d87 +*/ + diff --git a/Libraries/SndFile/Files/src/GSM610/rpe.c b/Libraries/SndFile/Files/src/GSM610/rpe.c new file mode 100644 index 000000000..1d91f38be --- /dev/null +++ b/Libraries/SndFile/Files/src/GSM610/rpe.c @@ -0,0 +1,490 @@ +/* + * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische + * Universitaet Berlin. See the accompanying file "COPYRIGHT" for + * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. + */ + +#include +#include + +#include "gsm610_priv.h" + +#include "gsm.h" + +/* 4.2.13 .. 4.2.17 RPE ENCODING SECTION + */ + +/* 4.2.13 */ + +static void Weighting_filter ( + register word * e, /* signal [-5..0.39.44] IN */ + word * x /* signal [0..39] OUT */ +) +/* + * The coefficients of the weighting filter are stored in a table + * (see table 4.4). The following scaling is used: + * + * H[0..10] = integer( real_H[ 0..10] * 8192 ); + */ +{ + /* word wt[ 50 ]; */ + + register longword L_result; + register int k /* , i */ ; + + /* Initialization of a temporary working array wt[0...49] + */ + + /* for (k = 0; k <= 4; k++) wt[k] = 0; + * for (k = 5; k <= 44; k++) wt[k] = *e++; + * for (k = 45; k <= 49; k++) wt[k] = 0; + * + * (e[-5..-1] and e[40..44] are allocated by the caller, + * are initially zero and are not written anywhere.) + */ + e -= 5; + + /* Compute the signal x[0..39] + */ + for (k = 0; k <= 39; k++) { + + L_result = 8192 >> 1; + + /* for (i = 0; i <= 10; i++) { + * L_temp = GSM_L_MULT( wt[k+i], gsm_H[i] ); + * L_result = GSM_L_ADD( L_result, L_temp ); + * } + */ + +#undef STEP +#define STEP( i, H ) (e[ k + i ] * (longword)H) + + /* Every one of these multiplications is done twice -- + * but I don't see an elegant way to optimize this. + * Do you? + */ + +#ifdef STUPID_COMPILER + L_result += STEP( 0, -134 ) ; + L_result += STEP( 1, -374 ) ; + /* + STEP( 2, 0 ) */ + L_result += STEP( 3, 2054 ) ; + L_result += STEP( 4, 5741 ) ; + L_result += STEP( 5, 8192 ) ; + L_result += STEP( 6, 5741 ) ; + L_result += STEP( 7, 2054 ) ; + /* + STEP( 8, 0 ) */ + L_result += STEP( 9, -374 ) ; + L_result += STEP( 10, -134 ) ; +#else + L_result += + STEP( 0, -134 ) + + STEP( 1, -374 ) + /* + STEP( 2, 0 ) */ + + STEP( 3, 2054 ) + + STEP( 4, 5741 ) + + STEP( 5, 8192 ) + + STEP( 6, 5741 ) + + STEP( 7, 2054 ) + /* + STEP( 8, 0 ) */ + + STEP( 9, -374 ) + + STEP(10, -134 ) + ; +#endif + + /* L_result = GSM_L_ADD( L_result, L_result ); (* scaling(x2) *) + * L_result = GSM_L_ADD( L_result, L_result ); (* scaling(x4) *) + * + * x[k] = SASR( L_result, 16 ); + */ + + /* 2 adds vs. >>16 => 14, minus one shift to compensate for + * those we lost when replacing L_MULT by '*'. + */ + + L_result = SASR_L( L_result, 13 ); + x[k] = ( L_result < MIN_WORD ? MIN_WORD + : (L_result > MAX_WORD ? MAX_WORD : L_result )); + } +} + +/* 4.2.14 */ + +static void RPE_grid_selection ( + word * x, /* [0..39] IN */ + word * xM, /* [0..12] OUT */ + word * Mc_out /* OUT */ +) +/* + * The signal x[0..39] is used to select the RPE grid which is + * represented by Mc. + */ +{ + /* register word temp1; */ + register int /* m, */ i; + register longword L_result, L_temp; + longword EM; /* xxx should be L_EM? */ + word Mc; + + longword L_common_0_3; + + EM = 0; + Mc = 0; + + /* for (m = 0; m <= 3; m++) { + * L_result = 0; + * + * + * for (i = 0; i <= 12; i++) { + * + * temp1 = SASR_W( x[m + 3*i], 2 ); + * + * assert(temp1 != MIN_WORD); + * + * L_temp = GSM_L_MULT( temp1, temp1 ); + * L_result = GSM_L_ADD( L_temp, L_result ); + * } + * + * if (L_result > EM) { + * Mc = m; + * EM = L_result; + * } + * } + */ + +#undef STEP +#define STEP( m, i ) L_temp = SASR_W( x[m + 3 * i], 2 ); \ + L_result += L_temp * L_temp; + + /* common part of 0 and 3 */ + + L_result = 0; + STEP( 0, 1 ); STEP( 0, 2 ); STEP( 0, 3 ); STEP( 0, 4 ); + STEP( 0, 5 ); STEP( 0, 6 ); STEP( 0, 7 ); STEP( 0, 8 ); + STEP( 0, 9 ); STEP( 0, 10); STEP( 0, 11); STEP( 0, 12); + L_common_0_3 = L_result; + + /* i = 0 */ + + STEP( 0, 0 ); + L_result <<= 1; /* implicit in L_MULT */ + EM = L_result; + + /* i = 1 */ + + L_result = 0; + STEP( 1, 0 ); + STEP( 1, 1 ); STEP( 1, 2 ); STEP( 1, 3 ); STEP( 1, 4 ); + STEP( 1, 5 ); STEP( 1, 6 ); STEP( 1, 7 ); STEP( 1, 8 ); + STEP( 1, 9 ); STEP( 1, 10); STEP( 1, 11); STEP( 1, 12); + L_result <<= 1; + if (L_result > EM) { + Mc = 1; + EM = L_result; + } + + /* i = 2 */ + + L_result = 0; + STEP( 2, 0 ); + STEP( 2, 1 ); STEP( 2, 2 ); STEP( 2, 3 ); STEP( 2, 4 ); + STEP( 2, 5 ); STEP( 2, 6 ); STEP( 2, 7 ); STEP( 2, 8 ); + STEP( 2, 9 ); STEP( 2, 10); STEP( 2, 11); STEP( 2, 12); + L_result <<= 1; + if (L_result > EM) { + Mc = 2; + EM = L_result; + } + + /* i = 3 */ + + L_result = L_common_0_3; + STEP( 3, 12 ); + L_result <<= 1; + if (L_result > EM) { + Mc = 3; + EM = L_result; + } + + /**/ + + /* Down-sampling by a factor 3 to get the selected xM[0..12] + * RPE sequence. + */ + for (i = 0; i <= 12; i ++) xM[i] = x[Mc + 3*i]; + *Mc_out = Mc; +} + +/* 4.12.15 */ + +static void APCM_quantization_xmaxc_to_exp_mant ( + word xmaxc, /* IN */ + word * expon_out, /* OUT */ + word * mant_out ) /* OUT */ +{ + word expon, mant; + + /* Compute expononent and mantissa of the decoded version of xmaxc + */ + + expon = 0; + if (xmaxc > 15) expon = SASR_W(xmaxc, 3) - 1; + mant = xmaxc - (expon << 3); + + if (mant == 0) { + expon = -4; + mant = 7; + } + else { + while (mant <= 7) { + mant = mant << 1 | 1; + expon--; + } + mant -= 8; + } + + assert( expon >= -4 && expon <= 6 ); + assert( mant >= 0 && mant <= 7 ); + + *expon_out = expon; + *mant_out = mant; +} + +static void APCM_quantization ( + word * xM, /* [0..12] IN */ + word * xMc, /* [0..12] OUT */ + word * mant_out, /* OUT */ + word * expon_out, /* OUT */ + word * xmaxc_out /* OUT */ +) +{ + int i, itest; + + word xmax, xmaxc, temp, temp1, temp2; + word expon, mant; + + + /* Find the maximum absolute value xmax of xM[0..12]. + */ + + xmax = 0; + for (i = 0; i <= 12; i++) { + temp = xM[i]; + temp = GSM_ABS(temp); + if (temp > xmax) xmax = temp; + } + + /* Qantizing and coding of xmax to get xmaxc. + */ + + expon = 0; + temp = SASR_W( xmax, 9 ); + itest = 0; + + for (i = 0; i <= 5; i++) { + + itest |= (temp <= 0); + temp = SASR_W( temp, 1 ); + + assert(expon <= 5); + if (itest == 0) expon++; /* expon = add (expon, 1) */ + } + + assert(expon <= 6 && expon >= 0); + temp = expon + 5; + + assert(temp <= 11 && temp >= 0); + xmaxc = gsm_add( SASR_W(xmax, temp), (word) (expon << 3) ); + + /* Quantizing and coding of the xM[0..12] RPE sequence + * to get the xMc[0..12] + */ + + APCM_quantization_xmaxc_to_exp_mant( xmaxc, &expon, &mant ); + + /* This computation uses the fact that the decoded version of xmaxc + * can be calculated by using the expononent and the mantissa part of + * xmaxc (logarithmic table). + * So, this method avoids any division and uses only a scaling + * of the RPE samples by a function of the expononent. A direct + * multiplication by the inverse of the mantissa (NRFAC[0..7] + * found in table 4.5) gives the 3 bit coded version xMc[0..12] + * of the RPE samples. + */ + + + /* Direct computation of xMc[0..12] using table 4.5 + */ + + assert( expon <= 4096 && expon >= -4096); + assert( mant >= 0 && mant <= 7 ); + + temp1 = 6 - expon; /* normalization by the expononent */ + temp2 = gsm_NRFAC[ mant ]; /* inverse mantissa */ + + for (i = 0; i <= 12; i++) { + + assert(temp1 >= 0 && temp1 < 16); + + temp = xM[i] << temp1; + temp = GSM_MULT( temp, temp2 ); + temp = SASR_W(temp, 12); + xMc[i] = temp + 4; /* see note below */ + } + + /* NOTE: This equation is used to make all the xMc[i] positive. + */ + + *mant_out = mant; + *expon_out = expon; + *xmaxc_out = xmaxc; +} + +/* 4.2.16 */ + +static void APCM_inverse_quantization ( + register word * xMc, /* [0..12] IN */ + word mant, + word expon, + register word * xMp) /* [0..12] OUT */ +/* + * This part is for decoding the RPE sequence of coded xMc[0..12] + * samples to obtain the xMp[0..12] array. Table 4.6 is used to get + * the mantissa of xmaxc (FAC[0..7]). + */ +{ + int i; + word temp, temp1, temp2, temp3; + + assert( mant >= 0 && mant <= 7 ); + + temp1 = gsm_FAC[ mant ]; /* see 4.2-15 for mant */ + temp2 = gsm_sub( 6, expon ); /* see 4.2-15 for exp */ + temp3 = gsm_asl( 1, gsm_sub( temp2, 1 )); + + for (i = 13; i--;) { + + assert( *xMc <= 7 && *xMc >= 0 ); /* 3 bit unsigned */ + + /* temp = gsm_sub( *xMc++ << 1, 7 ); */ + temp = (*xMc++ << 1) - 7; /* restore sign */ + assert( temp <= 7 && temp >= -7 ); /* 4 bit signed */ + + temp <<= 12; /* 16 bit signed */ + temp = GSM_MULT_R( temp1, temp ); + temp = GSM_ADD( temp, temp3 ); + *xMp++ = gsm_asr( temp, temp2 ); + } +} + +/* 4.2.17 */ + +static void RPE_grid_positioning ( + word Mc, /* grid position IN */ + register word * xMp, /* [0..12] IN */ + register word * ep /* [0..39] OUT */ +) +/* + * This procedure computes the reconstructed long term residual signal + * ep[0..39] for the LTP analysis filter. The inputs are the Mc + * which is the grid position selection and the xMp[0..12] decoded + * RPE samples which are upsampled by a factor of 3 by inserting zero + * values. + */ +{ + int i = 13; + + assert(0 <= Mc && Mc <= 3); + + switch (Mc) { + case 3: *ep++ = 0; + case 2: do { + *ep++ = 0; + case 1: *ep++ = 0; + case 0: *ep++ = *xMp++; + } while (--i); + } + while (++Mc < 4) *ep++ = 0; + + /* + + int i, k; + for (k = 0; k <= 39; k++) ep[k] = 0; + for (i = 0; i <= 12; i++) { + ep[ Mc + (3*i) ] = xMp[i]; + } + */ +} + +/* 4.2.18 */ + +/* This procedure adds the reconstructed long term residual signal + * ep[0..39] to the estimated signal dpp[0..39] from the long term + * analysis filter to compute the reconstructed short term residual + * signal dp[-40..-1]; also the reconstructed short term residual + * array dp[-120..-41] is updated. + */ + +#if 0 /* Has been inlined in code.c */ +void Gsm_Update_of_reconstructed_short_time_residual_signal ( + word * dpp, /* [0...39] IN */ + word * ep, /* [0...39] IN */ + word * dp) /* [-120...-1] IN/OUT */ +{ + int k; + + for (k = 0; k <= 79; k++) + dp[ -120 + k ] = dp[ -80 + k ]; + + for (k = 0; k <= 39; k++) + dp[ -40 + k ] = gsm_add( ep[k], dpp[k] ); +} +#endif /* Has been inlined in code.c */ + +void Gsm_RPE_Encoding ( + /*-struct gsm_state * S,-*/ + + word * e, /* -5..-1][0..39][40..44 IN/OUT */ + word * xmaxc, /* OUT */ + word * Mc, /* OUT */ + word * xMc) /* [0..12] OUT */ +{ + word x[40]; + word xM[13], xMp[13]; + word mant, expon; + + Weighting_filter(e, x); + RPE_grid_selection(x, xM, Mc); + + APCM_quantization( xM, xMc, &mant, &expon, xmaxc); + APCM_inverse_quantization( xMc, mant, expon, xMp); + + RPE_grid_positioning( *Mc, xMp, e ); + +} + +void Gsm_RPE_Decoding ( + /*-struct gsm_state * S,-*/ + + word xmaxcr, + word Mcr, + word * xMcr, /* [0..12], 3 bits IN */ + word * erp /* [0..39] OUT */ +) +{ + word expon, mant; + word xMp[ 13 ]; + + APCM_quantization_xmaxc_to_exp_mant( xmaxcr, &expon, &mant ); + APCM_inverse_quantization( xMcr, mant, expon, xMp ); + RPE_grid_positioning( Mcr, xMp, erp ); + +} +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: 82005b9e-1560-4e94-9ddb-00cb14867295 +*/ + diff --git a/Libraries/SndFile/Files/src/GSM610/short_term.c b/Libraries/SndFile/Files/src/GSM610/short_term.c new file mode 100644 index 000000000..0174b0523 --- /dev/null +++ b/Libraries/SndFile/Files/src/GSM610/short_term.c @@ -0,0 +1,427 @@ +/* + * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische + * Universitaet Berlin. See the accompanying file "COPYRIGHT" for + * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. + */ + +#include +#include + +#include "gsm610_priv.h" + +#include "gsm.h" + +/* + * SHORT TERM ANALYSIS FILTERING SECTION + */ + +/* 4.2.8 */ + +static void Decoding_of_the_coded_Log_Area_Ratios ( + word * LARc, /* coded log area ratio [0..7] IN */ + word * LARpp) /* out: decoded .. */ +{ + register word temp1 /* , temp2 */; + + /* This procedure requires for efficient implementation + * two tables. + * + * INVA[1..8] = integer( (32768 * 8) / real_A[1..8]) + * MIC[1..8] = minimum value of the LARc[1..8] + */ + + /* Compute the LARpp[1..8] + */ + + /* for (i = 1; i <= 8; i++, B++, MIC++, INVA++, LARc++, LARpp++) { + * + * temp1 = GSM_ADD( *LARc, *MIC ) << 10; + * temp2 = *B << 1; + * temp1 = GSM_SUB( temp1, temp2 ); + * + * assert(*INVA != MIN_WORD); + * + * temp1 = GSM_MULT_R( *INVA, temp1 ); + * *LARpp = GSM_ADD( temp1, temp1 ); + * } + */ + +#undef STEP +#define STEP( B, MIC, INVA ) \ + temp1 = GSM_ADD( *LARc++, MIC ) << 10; \ + temp1 = GSM_SUB( temp1, B << 1 ); \ + temp1 = GSM_MULT_R( INVA, temp1 ); \ + *LARpp++ = GSM_ADD( temp1, temp1 ); + + STEP( 0, -32, 13107 ); + STEP( 0, -32, 13107 ); + STEP( 2048, -16, 13107 ); + STEP( -2560, -16, 13107 ); + + STEP( 94, -8, 19223 ); + STEP( -1792, -8, 17476 ); + STEP( -341, -4, 31454 ); + STEP( -1144, -4, 29708 ); + + /* NOTE: the addition of *MIC is used to restore + * the sign of *LARc. + */ +} + +/* 4.2.9 */ +/* Computation of the quantized reflection coefficients + */ + +/* 4.2.9.1 Interpolation of the LARpp[1..8] to get the LARp[1..8] + */ + +/* + * Within each frame of 160 analyzed speech samples the short term + * analysis and synthesis filters operate with four different sets of + * coefficients, derived from the previous set of decoded LARs(LARpp(j-1)) + * and the actual set of decoded LARs (LARpp(j)) + * + * (Initial value: LARpp(j-1)[1..8] = 0.) + */ + +static void Coefficients_0_12 ( + register word * LARpp_j_1, + register word * LARpp_j, + register word * LARp) +{ + register int i; + + for (i = 1; i <= 8; i++, LARp++, LARpp_j_1++, LARpp_j++) { + *LARp = GSM_ADD( SASR_W( *LARpp_j_1, 2 ), SASR_W( *LARpp_j, 2 )); + *LARp = GSM_ADD( *LARp, SASR_W( *LARpp_j_1, 1)); + } +} + +static void Coefficients_13_26 ( + register word * LARpp_j_1, + register word * LARpp_j, + register word * LARp) +{ + register int i; + for (i = 1; i <= 8; i++, LARpp_j_1++, LARpp_j++, LARp++) { + *LARp = GSM_ADD( SASR_W( *LARpp_j_1, 1), SASR_W( *LARpp_j, 1 )); + } +} + +static void Coefficients_27_39 ( + register word * LARpp_j_1, + register word * LARpp_j, + register word * LARp) +{ + register int i; + + for (i = 1; i <= 8; i++, LARpp_j_1++, LARpp_j++, LARp++) { + *LARp = GSM_ADD( SASR_W( *LARpp_j_1, 2 ), SASR_W( *LARpp_j, 2 )); + *LARp = GSM_ADD( *LARp, SASR_W( *LARpp_j, 1 )); + } +} + + +static void Coefficients_40_159 ( + register word * LARpp_j, + register word * LARp) +{ + register int i; + + for (i = 1; i <= 8; i++, LARp++, LARpp_j++) + *LARp = *LARpp_j; +} + +/* 4.2.9.2 */ + +static void LARp_to_rp ( + register word * LARp) /* [0..7] IN/OUT */ +/* + * The input of this procedure is the interpolated LARp[0..7] array. + * The reflection coefficients, rp[i], are used in the analysis + * filter and in the synthesis filter. + */ +{ + register int i; + register word temp; + + for (i = 1; i <= 8; i++, LARp++) { + + /* temp = GSM_ABS( *LARp ); + * + * if (temp < 11059) temp <<= 1; + * else if (temp < 20070) temp += 11059; + * else temp = GSM_ADD( temp >> 2, 26112 ); + * + * *LARp = *LARp < 0 ? -temp : temp; + */ + + if (*LARp < 0) { + temp = *LARp == MIN_WORD ? MAX_WORD : -(*LARp); + *LARp = - ((temp < 11059) ? temp << 1 + : ((temp < 20070) ? temp + 11059 + : GSM_ADD( (word) (temp >> 2), (word) 26112 ))); + } else { + temp = *LARp; + *LARp = (temp < 11059) ? temp << 1 + : ((temp < 20070) ? temp + 11059 + : GSM_ADD( (word) (temp >> 2), (word) 26112 )); + } + } +} + + +/* 4.2.10 */ +static void Short_term_analysis_filtering ( + struct gsm_state * S, + register word * rp, /* [0..7] IN */ + register int k_n, /* k_end - k_start */ + register word * s /* [0..n-1] IN/OUT */ +) +/* + * This procedure computes the short term residual signal d[..] to be fed + * to the RPE-LTP loop from the s[..] signal and from the local rp[..] + * array (quantized reflection coefficients). As the call of this + * procedure can be done in many ways (see the interpolation of the LAR + * coefficient), it is assumed that the computation begins with index + * k_start (for arrays d[..] and s[..]) and stops with index k_end + * (k_start and k_end are defined in 4.2.9.1). This procedure also + * needs to keep the array u[0..7] in memory for each call. + */ +{ + register word * u = S->u; + register int i; + register word di, zzz, ui, sav, rpi; + + for (; k_n--; s++) { + + di = sav = *s; + + for (i = 0; i < 8; i++) { /* YYY */ + + ui = u[i]; + rpi = rp[i]; + u[i] = sav; + + zzz = GSM_MULT_R(rpi, di); + sav = GSM_ADD( ui, zzz); + + zzz = GSM_MULT_R(rpi, ui); + di = GSM_ADD( di, zzz ); + } + + *s = di; + } +} + +#if defined(USE_FLOAT_MUL) && defined(FAST) + +static void Fast_Short_term_analysis_filtering ( + struct gsm_state * S, + register word * rp, /* [0..7] IN */ + register int k_n, /* k_end - k_start */ + register word * s /* [0..n-1] IN/OUT */ +) +{ + register word * u = S->u; + register int i; + + float uf[8], + rpf[8]; + + register float scalef = 3.0517578125e-5; + register float sav, di, temp; + + for (i = 0; i < 8; ++i) { + uf[i] = u[i]; + rpf[i] = rp[i] * scalef; + } + for (; k_n--; s++) { + sav = di = *s; + for (i = 0; i < 8; ++i) { + register float rpfi = rpf[i]; + register float ufi = uf[i]; + + uf[i] = sav; + temp = rpfi * di + ufi; + di += rpfi * ufi; + sav = temp; + } + *s = di; + } + for (i = 0; i < 8; ++i) u[i] = uf[i]; +} +#endif /* ! (defined (USE_FLOAT_MUL) && defined (FAST)) */ + +static void Short_term_synthesis_filtering ( + struct gsm_state * S, + register word * rrp, /* [0..7] IN */ + register int k, /* k_end - k_start */ + register word * wt, /* [0..k-1] IN */ + register word * sr /* [0..k-1] OUT */ +) +{ + register word * v = S->v; + register int i; + register word sri, tmp1, tmp2; + + while (k--) { + sri = *wt++; + for (i = 8; i--;) { + + /* sri = GSM_SUB( sri, gsm_mult_r( rrp[i], v[i] ) ); + */ + tmp1 = rrp[i]; + tmp2 = v[i]; + tmp2 = ( tmp1 == MIN_WORD && tmp2 == MIN_WORD + ? MAX_WORD + : 0x0FFFF & (( (longword)tmp1 * (longword)tmp2 + + 16384) >> 15)) ; + + sri = GSM_SUB( sri, tmp2 ); + + /* v[i+1] = GSM_ADD( v[i], gsm_mult_r( rrp[i], sri ) ); + */ + tmp1 = ( tmp1 == MIN_WORD && sri == MIN_WORD + ? MAX_WORD + : 0x0FFFF & (( (longword)tmp1 * (longword)sri + + 16384) >> 15)) ; + + v[i+1] = GSM_ADD( v[i], tmp1); + } + *sr++ = v[0] = sri; + } +} + + +#if defined(FAST) && defined(USE_FLOAT_MUL) + +static void Fast_Short_term_synthesis_filtering ( + struct gsm_state * S, + register word * rrp, /* [0..7] IN */ + register int k, /* k_end - k_start */ + register word * wt, /* [0..k-1] IN */ + register word * sr /* [0..k-1] OUT */ +) +{ + register word * v = S->v; + register int i; + + float va[9], rrpa[8]; + register float scalef = 3.0517578125e-5, temp; + + for (i = 0; i < 8; ++i) { + va[i] = v[i]; + rrpa[i] = (float)rrp[i] * scalef; + } + while (k--) { + register float sri = *wt++; + for (i = 8; i--;) { + sri -= rrpa[i] * va[i]; + if (sri < -32768.) sri = -32768.; + else if (sri > 32767.) sri = 32767.; + + temp = va[i] + rrpa[i] * sri; + if (temp < -32768.) temp = -32768.; + else if (temp > 32767.) temp = 32767.; + va[i+1] = temp; + } + *sr++ = va[0] = sri; + } + for (i = 0; i < 9; ++i) v[i] = va[i]; +} + +#endif /* defined(FAST) && defined(USE_FLOAT_MUL) */ + +void Gsm_Short_Term_Analysis_Filter ( + + struct gsm_state * S, + + word * LARc, /* coded log area ratio [0..7] IN */ + word * s /* signal [0..159] IN/OUT */ +) +{ + word * LARpp_j = S->LARpp[ S->j ]; + word * LARpp_j_1 = S->LARpp[ S->j ^= 1 ]; + + word LARp[8]; + +#undef FILTER +#if defined(FAST) && defined(USE_FLOAT_MUL) +# define FILTER (* (S->fast \ + ? Fast_Short_term_analysis_filtering \ + : Short_term_analysis_filtering )) + +#else +# define FILTER Short_term_analysis_filtering +#endif + + Decoding_of_the_coded_Log_Area_Ratios( LARc, LARpp_j ); + + Coefficients_0_12( LARpp_j_1, LARpp_j, LARp ); + LARp_to_rp( LARp ); + FILTER( S, LARp, 13, s); + + Coefficients_13_26( LARpp_j_1, LARpp_j, LARp); + LARp_to_rp( LARp ); + FILTER( S, LARp, 14, s + 13); + + Coefficients_27_39( LARpp_j_1, LARpp_j, LARp); + LARp_to_rp( LARp ); + FILTER( S, LARp, 13, s + 27); + + Coefficients_40_159( LARpp_j, LARp); + LARp_to_rp( LARp ); + FILTER( S, LARp, 120, s + 40); +} + +void Gsm_Short_Term_Synthesis_Filter ( + struct gsm_state * S, + + word * LARcr, /* received log area ratios [0..7] IN */ + word * wt, /* received d [0..159] IN */ + + word * s /* signal s [0..159] OUT */ +) +{ + word * LARpp_j = S->LARpp[ S->j ]; + word * LARpp_j_1 = S->LARpp[ S->j ^=1 ]; + + word LARp[8]; + +#undef FILTER +#if defined(FAST) && defined(USE_FLOAT_MUL) + +# define FILTER (* (S->fast \ + ? Fast_Short_term_synthesis_filtering \ + : Short_term_synthesis_filtering )) +#else +# define FILTER Short_term_synthesis_filtering +#endif + + Decoding_of_the_coded_Log_Area_Ratios( LARcr, LARpp_j ); + + Coefficients_0_12( LARpp_j_1, LARpp_j, LARp ); + LARp_to_rp( LARp ); + FILTER( S, LARp, 13, wt, s ); + + Coefficients_13_26( LARpp_j_1, LARpp_j, LARp); + LARp_to_rp( LARp ); + FILTER( S, LARp, 14, wt + 13, s + 13 ); + + Coefficients_27_39( LARpp_j_1, LARpp_j, LARp); + LARp_to_rp( LARp ); + FILTER( S, LARp, 13, wt + 27, s + 27 ); + + Coefficients_40_159( LARpp_j, LARp ); + LARp_to_rp( LARp ); + FILTER(S, LARp, 120, wt + 40, s + 40); +} +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: 019ac7ba-c6dd-4540-abf0-8644b6c4a633 +*/ + diff --git a/Libraries/SndFile/Files/src/GSM610/table.c b/Libraries/SndFile/Files/src/GSM610/table.c new file mode 100644 index 000000000..b5aa881ea --- /dev/null +++ b/Libraries/SndFile/Files/src/GSM610/table.c @@ -0,0 +1,69 @@ +/* + * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische + * Universitaet Berlin. See the accompanying file "COPYRIGHT" for + * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. + */ + +/* Most of these tables are inlined at their point of use. + */ + +/* 4.4 TABLES USED IN THE FIXED POINT IMPLEMENTATION OF THE RPE-LTP + * CODER AND DECODER + * + * (Most of them inlined, so watch out.) + */ + +#define GSM_TABLE_C +#include "gsm610_priv.h" +#include "gsm.h" + +/* Table 4.1 Quantization of the Log.-Area Ratios + */ +/* i 1 2 3 4 5 6 7 8 */ +word gsm_A[8] = {20480, 20480, 20480, 20480, 13964, 15360, 8534, 9036}; +word gsm_B[8] = { 0, 0, 2048, -2560, 94, -1792, -341, -1144}; +word gsm_MIC[8] = { -32, -32, -16, -16, -8, -8, -4, -4 }; +word gsm_MAC[8] = { 31, 31, 15, 15, 7, 7, 3, 3 }; + + +/* Table 4.2 Tabulation of 1/A[1..8] + */ +word gsm_INVA[8]={ 13107, 13107, 13107, 13107, 19223, 17476, 31454, 29708 }; + + +/* Table 4.3a Decision level of the LTP gain quantizer + */ +/* bc 0 1 2 3 */ +word gsm_DLB[4] = { 6554, 16384, 26214, 32767 }; + + +/* Table 4.3b Quantization levels of the LTP gain quantizer + */ +/* bc 0 1 2 3 */ +word gsm_QLB[4] = { 3277, 11469, 21299, 32767 }; + + +/* Table 4.4 Coefficients of the weighting filter + */ +/* i 0 1 2 3 4 5 6 7 8 9 10 */ +word gsm_H[11] = {-134, -374, 0, 2054, 5741, 8192, 5741, 2054, 0, -374, -134 }; + + +/* Table 4.5 Normalized inverse mantissa used to compute xM/xmax + */ +/* i 0 1 2 3 4 5 6 7 */ +word gsm_NRFAC[8] = { 29128, 26215, 23832, 21846, 20165, 18725, 17476, 16384 }; + + +/* Table 4.6 Normalized direct mantissa used to compute xM/xmax + */ +/* i 0 1 2 3 4 5 6 7 */ +word gsm_FAC[8] = { 18431, 20479, 22527, 24575, 26623, 28671, 30719, 32767 }; +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: 8957c531-e6b0-4097-9202-da7ca42729ca +*/ + diff --git a/Libraries/SndFile/Files/src/Symbols.darwin b/Libraries/SndFile/Files/src/Symbols.darwin new file mode 100644 index 000000000..9adfd5027 --- /dev/null +++ b/Libraries/SndFile/Files/src/Symbols.darwin @@ -0,0 +1,34 @@ +# Auto-generated by create_symbols_file.py + +_sf_command +_sf_open +_sf_close +_sf_seek +_sf_error +_sf_perror +_sf_error_str +_sf_error_number +_sf_format_check +_sf_read_raw +_sf_readf_short +_sf_readf_int +_sf_readf_float +_sf_readf_double +_sf_read_short +_sf_read_int +_sf_read_float +_sf_read_double +_sf_write_raw +_sf_writef_short +_sf_writef_int +_sf_writef_float +_sf_writef_double +_sf_write_short +_sf_write_int +_sf_write_float +_sf_write_double +_sf_strerror +_sf_get_string +_sf_set_string +_sf_open_fd + diff --git a/Libraries/SndFile/Files/src/Symbols.linux b/Libraries/SndFile/Files/src/Symbols.linux new file mode 100644 index 000000000..81f6ce577 --- /dev/null +++ b/Libraries/SndFile/Files/src/Symbols.linux @@ -0,0 +1,40 @@ +# Auto-generated by create_symbols_file.py + +libsndfile.so.1.0 +{ + global: + sf_command ; + sf_open ; + sf_close ; + sf_seek ; + sf_error ; + sf_perror ; + sf_error_str ; + sf_error_number ; + sf_format_check ; + sf_read_raw ; + sf_readf_short ; + sf_readf_int ; + sf_readf_float ; + sf_readf_double ; + sf_read_short ; + sf_read_int ; + sf_read_float ; + sf_read_double ; + sf_write_raw ; + sf_writef_short ; + sf_writef_int ; + sf_writef_float ; + sf_writef_double ; + sf_write_short ; + sf_write_int ; + sf_write_float ; + sf_write_double ; + sf_strerror ; + sf_get_string ; + sf_set_string ; + sf_open_fd ; + local: + * ; +} ; + diff --git a/Libraries/SndFile/Files/src/aiff.c b/Libraries/SndFile/Files/src/aiff.c new file mode 100644 index 000000000..acfda73c1 --- /dev/null +++ b/Libraries/SndFile/Files/src/aiff.c @@ -0,0 +1,1345 @@ +/* +** Copyright (C) 1999-2004 Erik de Castro Lopo +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU Lesser General Public License as published by +** the Free Software Foundation; either version 2.1 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU Lesser General Public License for more details. +** +** You should have received a copy of the GNU Lesser General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include "config.h" + +#include +#include +#include +#include +#include + +#include "sndfile.h" +#include "sfendian.h" +#include "common.h" + +/*------------------------------------------------------------------------------ + * Macros to handle big/little endian issues. + */ + +#define FORM_MARKER (MAKE_MARKER ('F', 'O', 'R', 'M')) +#define AIFF_MARKER (MAKE_MARKER ('A', 'I', 'F', 'F')) +#define AIFC_MARKER (MAKE_MARKER ('A', 'I', 'F', 'C')) +#define COMM_MARKER (MAKE_MARKER ('C', 'O', 'M', 'M')) +#define SSND_MARKER (MAKE_MARKER ('S', 'S', 'N', 'D')) +#define MARK_MARKER (MAKE_MARKER ('M', 'A', 'R', 'K')) +#define INST_MARKER (MAKE_MARKER ('I', 'N', 'S', 'T')) +#define APPL_MARKER (MAKE_MARKER ('A', 'P', 'P', 'L')) + +#define c_MARKER (MAKE_MARKER ('(', 'c', ')', ' ')) +#define NAME_MARKER (MAKE_MARKER ('N', 'A', 'M', 'E')) +#define AUTH_MARKER (MAKE_MARKER ('A', 'U', 'T', 'H')) +#define ANNO_MARKER (MAKE_MARKER ('A', 'N', 'N', 'O')) +#define COMT_MARKER (MAKE_MARKER ('C', 'O', 'M', 'T')) +#define FVER_MARKER (MAKE_MARKER ('F', 'V', 'E', 'R')) +#define SFX_MARKER (MAKE_MARKER ('S', 'F', 'X', '!')) + +#define PEAK_MARKER (MAKE_MARKER ('P', 'E', 'A', 'K')) +#define basc_MARKER (MAKE_MARKER ('b', 'a', 's', 'c')) + +/* Supported AIFC encodings.*/ +#define NONE_MARKER (MAKE_MARKER ('N', 'O', 'N', 'E')) +#define sowt_MARKER (MAKE_MARKER ('s', 'o', 'w', 't')) +#define twos_MARKER (MAKE_MARKER ('t', 'w', 'o', 's')) +#define raw_MARKER (MAKE_MARKER ('r', 'a', 'w', ' ')) +#define in32_MARKER (MAKE_MARKER ('i', 'n', '3', '2')) +#define ni32_MARKER (MAKE_MARKER ('2', '3', 'n', 'i')) + +#define fl32_MARKER (MAKE_MARKER ('f', 'l', '3', '2')) +#define FL32_MARKER (MAKE_MARKER ('F', 'L', '3', '2')) +#define fl64_MARKER (MAKE_MARKER ('f', 'l', '6', '4')) +#define FL64_MARKER (MAKE_MARKER ('F', 'L', '6', '4')) + +#define ulaw_MARKER (MAKE_MARKER ('u', 'l', 'a', 'w')) +#define ULAW_MARKER (MAKE_MARKER ('U', 'L', 'A', 'W')) +#define alaw_MARKER (MAKE_MARKER ('a', 'l', 'a', 'w')) +#define ALAW_MARKER (MAKE_MARKER ('A', 'L', 'A', 'W')) + +#define DWVW_MARKER (MAKE_MARKER ('D', 'W', 'V', 'W')) +#define GSM_MARKER (MAKE_MARKER ('G', 'S', 'M', ' ')) +#define ima4_MARKER (MAKE_MARKER ('i', 'm', 'a', '4')) + +/* Unsupported AIFC encodings.*/ + +#define MAC3_MARKER (MAKE_MARKER ('M', 'A', 'C', '3')) +#define MAC6_MARKER (MAKE_MARKER ('M', 'A', 'C', '6')) +#define ADP4_MARKER (MAKE_MARKER ('A', 'D', 'P', '4')) + +/* Predfined chunk sizes. */ +#define SIZEOF_AIFF_COMM 18 +#define SIZEOF_AIFC_COMM_MIN 22 +#define SIZEOF_AIFC_COMM 24 +#define SIZEOF_SSND_CHUNK 8 +#define SIZEOF_INST_CHUNK 20 + +/* Is it constant? */ +#define SIZEOF_basc_CHUNK 0x54 +#define SIZEOF_basc_CHUNK_PADDING 66 + +/* AIFC/IMA4 defines. */ +#define AIFC_IMA4_BLOCK_LEN 34 +#define AIFC_IMA4_SAMPLES_PER_BLOCK 64 + +/*------------------------------------------------------------------------------ + * Typedefs for file chunks. + */ + +enum +{ HAVE_FORM = 0x01, + HAVE_AIFF = 0x02, + HAVE_COMM = 0x04, + HAVE_SSND = 0x08 +} ; + +typedef struct +{ unsigned int size ; + short numChannels ; + unsigned int numSampleFrames ; + short sampleSize ; + unsigned char sampleRate [10] ; + unsigned int encoding ; + char zero_bytes [2] ; +} COMM_CHUNK ; + +typedef struct +{ unsigned int offset ; + unsigned int blocksize ; +} SSND_CHUNK ; + +typedef struct +{ short playMode ; + unsigned short beginLoop ; + unsigned short endLoop ; +} INST_LOOP ; + +typedef struct +{ char baseNote ; /* all notes are MIDI note numbers */ + char detune ; /* cents off, only -50 to +50 are significant */ + char lowNote ; + char highNote ; + char lowVelocity ; /* 1 to 127 */ + char highVelocity ; /* 1 to 127 */ + short gain ; /* in dB, 0 is normal */ + INST_LOOP sustain_loop ; + INST_LOOP release_loop ; +} INST_CHUNK ; + + +enum +{ basc_SCALE_MINOR = 1, + basc_SCALE_MAJOR, + basc_SCALE_NEITHER, + basc_SCALE_BOTH, +} ; + +enum +{ basc_TYPE_LOOP = 0, + basc_TYPE_ONE_SHOT, +} ; + + +typedef struct +{ unsigned int version ; + unsigned int numBeats ; + unsigned short rootNote ; + unsigned short scaleType ; + unsigned short sigNumerator ; + unsigned short sigDenominator ; + unsigned short loopType ; + char zero_bytes [SIZEOF_basc_CHUNK_PADDING] ; +} basc_CHUNK ; + +/*------------------------------------------------------------------------------ + * Private static functions. + */ + +static int aiff_close (SF_PRIVATE *psf) ; + +static int tenbytefloat2int (unsigned char *bytes) ; +static void uint2tenbytefloat (unsigned int num, unsigned char *bytes) ; + +static int aiff_read_comm_chunk (SF_PRIVATE *psf, COMM_CHUNK *comm_fmt) ; + +static int aiff_read_header (SF_PRIVATE *psf, COMM_CHUNK *comm_fmt) ; + +static int aiff_write_header (SF_PRIVATE *psf, int calc_length) ; +static int aiff_write_tailer (SF_PRIVATE *psf) ; +static void aiff_write_strings (SF_PRIVATE *psf, int location) ; + +static int aiff_command (SF_PRIVATE *psf, int command, void *data, int datasize) ; + +static const char *get_loop_mode_str (short mode) ; + +static int aiff_read_basc_chunk (SF_PRIVATE * psf) ; + +/*------------------------------------------------------------------------------ +** Public function. +*/ + +int +aiff_open (SF_PRIVATE *psf) +{ COMM_CHUNK comm_fmt ; + int error, subformat ; + + subformat = psf->sf.format & SF_FORMAT_SUBMASK ; + + if (psf->mode == SFM_READ || (psf->mode == SFM_RDWR && psf->filelength > 0)) + { if ((error = aiff_read_header (psf, &comm_fmt))) + return error ; + + psf_fseek (psf, psf->dataoffset, SEEK_SET) ; + } ; + + if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR) + { if (psf->is_pipe) + return SFE_NO_PIPE_WRITE ; + + if ((psf->sf.format & SF_FORMAT_TYPEMASK) != SF_FORMAT_AIFF) + return SFE_BAD_OPEN_FORMAT ; + + if (psf->mode == SFM_WRITE && (subformat == SF_FORMAT_FLOAT || subformat == SF_FORMAT_DOUBLE)) + { psf->pchunk = calloc (1, sizeof (PEAK_CHUNK) * psf->sf.channels * sizeof (PEAK_POS)) ; + if (psf->pchunk == NULL) + return SFE_MALLOC_FAILED ; + psf->has_peak = SF_TRUE ; + psf->peak_loc = SF_PEAK_START ; + } ; + + if (psf->mode != SFM_RDWR || psf->filelength < 40) + { psf->filelength = 0 ; + psf->datalength = 0 ; + psf->dataoffset = 0 ; + psf->sf.frames = 0 ; + } ; + + psf->str_flags = SF_STR_ALLOW_START | SF_STR_ALLOW_END ; + + if ((error = aiff_write_header (psf, SF_FALSE))) + return error ; + + psf->write_header = aiff_write_header ; + } ; + + psf->close = aiff_close ; + psf->command = aiff_command ; + + psf->blockwidth = psf->sf.channels * psf->bytewidth ; + + switch (psf->sf.format & SF_FORMAT_SUBMASK) + { case SF_FORMAT_PCM_U8 : + error = pcm_init (psf) ; + break ; + + case SF_FORMAT_PCM_S8 : + error = pcm_init (psf) ; + break ; + + case SF_FORMAT_PCM_16 : + case SF_FORMAT_PCM_24 : + case SF_FORMAT_PCM_32 : + error = pcm_init (psf) ; + break ; + + case SF_FORMAT_ULAW : + error = ulaw_init (psf) ; + break ; + + case SF_FORMAT_ALAW : + error = alaw_init (psf) ; + break ; + + /* Lite remove start */ + case SF_FORMAT_FLOAT : + error = float32_init (psf) ; + break ; + + case SF_FORMAT_DOUBLE : + error = double64_init (psf) ; + break ; + + case SF_FORMAT_DWVW_12 : + error = dwvw_init (psf, 12) ; + break ; + + case SF_FORMAT_DWVW_16 : + error = dwvw_init (psf, 16) ; + break ; + + case SF_FORMAT_DWVW_24 : + error = dwvw_init (psf, 24) ; + break ; + + case SF_FORMAT_DWVW_N : + if (psf->mode != SFM_READ) + { error = SFE_DWVW_BAD_BITWIDTH ; + break ; + } ; + if (comm_fmt.sampleSize >= 8 && comm_fmt.sampleSize < 24) + { error = dwvw_init (psf, comm_fmt.sampleSize) ; + psf->sf.frames = comm_fmt.numSampleFrames ; + break ; + } ; + psf_log_printf (psf, "AIFC/DWVW : Bad bitwidth %d\n", comm_fmt.sampleSize) ; + error = SFE_DWVW_BAD_BITWIDTH ; + break ; + + case SF_FORMAT_IMA_ADPCM : + /* + ** IMA ADPCM encoded AIFF files always have a block length + ** of 34 which decodes to 64 samples. + */ + error = aiff_ima_init (psf, AIFC_IMA4_BLOCK_LEN, AIFC_IMA4_SAMPLES_PER_BLOCK) ; + break ; + /* Lite remove end */ + + case SF_FORMAT_GSM610 : + error = gsm610_init (psf) ; + break ; + + default : return SFE_UNIMPLEMENTED ; + } ; + + if (psf->mode == SFM_READ) + psf->blockwidth = psf->sf.channels * psf->bytewidth ; + + return error ; +} /* aiff_open */ + +/*========================================================================================== +** Private functions. +*/ + +static int +aiff_read_header (SF_PRIVATE *psf, COMM_CHUNK *comm_fmt) +{ SSND_CHUNK ssnd_fmt ; + int marker, dword, bytesread, k ; + int FORMsize, SSNDsize ; + int filetype, found_chunk = 0, done = 0, error = 0 ; + char *cptr, byte ; + + /* Set position to start of file to begin reading header. */ + psf_binheader_readf (psf, "p", 0) ; + + memset (comm_fmt, 0, sizeof (COMM_CHUNK)) ; + + /* Until recently AIF* file were all BIG endian. */ + psf->endian = SF_ENDIAN_BIG ; + + /* AIFF files can apparently have their chunks in any order. However, they + ** must have a FORM chunk. Approach here is to read all the chunks one by + ** one and then check for the mandatory chunks at the end. + */ + while (! done) + { psf_binheader_readf (psf, "m", &marker) ; + + if (psf->mode == SFM_RDWR && (found_chunk & HAVE_SSND)) + return SFE_AIFF_RW_SSND_NOT_LAST ; + + switch (marker) + { case FORM_MARKER : + if (found_chunk) + return SFE_AIFF_NO_FORM ; + + psf_binheader_readf (psf, "E4", &FORMsize) ; + + if (psf->fileoffset > 0 && psf->filelength > FORMsize + 8) + { /* Set file length. */ + psf->filelength = FORMsize + 8 ; + psf_log_printf (psf, "FORM : %u\n", FORMsize) ; + } + else if (FORMsize != psf->filelength - 2 * SIGNED_SIZEOF (dword)) + { dword = psf->filelength - 2 * sizeof (dword) ; + psf_log_printf (psf, "FORM : %u (should be %u)\n", FORMsize, dword) ; + FORMsize = dword ; + } + else + psf_log_printf (psf, "FORM : %u\n", FORMsize) ; + found_chunk |= HAVE_FORM ; + break ; + + case AIFC_MARKER : + case AIFF_MARKER : + if (! (found_chunk & HAVE_FORM)) + return SFE_AIFF_AIFF_NO_FORM ; + filetype = marker ; + psf_log_printf (psf, " %M\n", marker) ; + found_chunk |= HAVE_AIFF ; + break ; + + case COMM_MARKER : + error = aiff_read_comm_chunk (psf, comm_fmt) ; + + psf->sf.samplerate = tenbytefloat2int (comm_fmt->sampleRate) ; + psf->sf.frames = comm_fmt->numSampleFrames ; + psf->sf.channels = comm_fmt->numChannels ; + psf->bytewidth = BITWIDTH2BYTES (comm_fmt->sampleSize) ; + + if (error) + return error ; + + found_chunk |= HAVE_COMM ; + break ; + + case PEAK_MARKER : + /* Must have COMM chunk before PEAK chunk. */ + if ((found_chunk & (HAVE_FORM | HAVE_AIFF | HAVE_COMM)) != (HAVE_FORM | HAVE_AIFF | HAVE_COMM)) + return SFE_AIFF_PEAK_B4_COMM ; + + psf_binheader_readf (psf, "E4", &dword) ; + + psf_log_printf (psf, "%M : %d\n", marker, dword) ; + if (dword != SIGNED_SIZEOF (PEAK_CHUNK) + psf->sf.channels * SIGNED_SIZEOF (PEAK_POS)) + { psf_binheader_readf (psf, "j", dword) ; + psf_log_printf (psf, "*** File PEAK chunk bigger than sizeof (PEAK_CHUNK).\n") ; + return SFE_WAV_BAD_PEAK ; + } ; + + psf->pchunk = calloc (1, sizeof (PEAK_CHUNK) * psf->sf.channels * sizeof (PEAK_POS)) ; + if (psf->pchunk == NULL) + return SFE_MALLOC_FAILED ; + + /* read in rest of PEAK chunk. */ + psf_binheader_readf (psf, "E44", &(psf->pchunk->version), &(psf->pchunk->timestamp)) ; + + if (psf->pchunk->version != 1) + psf_log_printf (psf, " version : %d *** (should be version 1)\n", psf->pchunk->version) ; + else + psf_log_printf (psf, " version : %d\n", psf->pchunk->version) ; + + psf_log_printf (psf, " time stamp : %d\n", psf->pchunk->timestamp) ; + psf_log_printf (psf, " Ch Position Value\n") ; + + cptr = psf->u.scbuf ; + for (dword = 0 ; dword < psf->sf.channels ; dword++) + { psf_binheader_readf (psf, "Ef4", &(psf->pchunk->peaks [dword].value), + &(psf->pchunk->peaks [dword].position)) ; + + LSF_SNPRINTF (cptr, sizeof (psf->u.scbuf), " %2d %-12d %g\n", + dword, psf->pchunk->peaks [dword].position, psf->pchunk->peaks [dword].value) ; + cptr [sizeof (psf->u.scbuf) - 1] = 0 ; + psf_log_printf (psf, cptr) ; + } ; + + psf->has_peak = SF_TRUE ; /* Found PEAK chunk. */ + break ; + + case SSND_MARKER : + psf_binheader_readf (psf, "E444", &SSNDsize, &(ssnd_fmt.offset), &(ssnd_fmt.blocksize)) ; + + psf->datalength = SSNDsize - sizeof (ssnd_fmt) ; + psf->dataoffset = psf_ftell (psf) ; + + if (psf->datalength > psf->filelength - psf->dataoffset || psf->datalength < 0) + { psf_log_printf (psf, " SSND : %u (should be %D)\n", SSNDsize, psf->filelength - psf->dataoffset + sizeof (SSND_CHUNK)) ; + psf->datalength = psf->filelength - psf->dataoffset ; + } + else + psf_log_printf (psf, " SSND : %u\n", SSNDsize) ; + + /* Only set dataend if there really is data at the end. */ + if (psf->datalength + psf->dataoffset < psf->filelength) + psf->dataend = psf->datalength + psf->dataoffset ; + + psf_log_printf (psf, " Offset : %u\n", ssnd_fmt.offset) ; + psf_log_printf (psf, " Block Size : %u\n", ssnd_fmt.blocksize) ; + + found_chunk |= HAVE_SSND ; + + if (! psf->sf.seekable) + break ; + + /* Seek to end of SSND chunk. */ + psf_fseek (psf, psf->dataoffset + psf->datalength + (SSNDsize & 1), SEEK_SET) ; + break ; + + case c_MARKER : + psf_binheader_readf (psf, "E4", &dword) ; + if (dword == 0) + break ; + if (dword > SIGNED_SIZEOF (psf->u.scbuf) - 1) + { psf_log_printf (psf, " %M : %d (too big)\n", marker, dword) ; + return SFE_INTERNAL ; + } ; + + cptr = psf->u.scbuf ; + psf_binheader_readf (psf, "b", cptr, dword) ; + cptr [dword] = 0 ; + psf_log_printf (psf, " %M : %s\n", marker, cptr) ; + psf_store_string (psf, SF_STR_COPYRIGHT, cptr) ; + break ; + + case AUTH_MARKER : + psf_binheader_readf (psf, "E4", &dword) ; + dword += (dword & 1) ; + if (dword == 0) + break ; + if (dword > SIGNED_SIZEOF (psf->u.scbuf)) + { psf_log_printf (psf, " %M : %d (too big)\n", marker, dword) ; + return SFE_INTERNAL ; + } ; + + cptr = psf->u.scbuf ; + psf_binheader_readf (psf, "b", cptr, dword) ; + cptr [dword - 1] = 0 ; + psf_log_printf (psf, " %M : %s\n", marker, cptr) ; + psf_store_string (psf, SF_STR_ARTIST, cptr) ; + break ; + + case COMT_MARKER : + { unsigned short count, id, len ; + unsigned int timestamp ; + + psf_binheader_readf (psf, "E42", &dword, &count) ; + psf_log_printf (psf, " %M : %d\n count : %d\n", marker, dword, count) ; + dword += (dword & 1) ; + if (dword == 0) + break ; + + for (k = 0 ; k < count ; k++) + { psf_binheader_readf (psf, "E422", ×tamp, &id, &len) ; + + psf_log_printf (psf, " time : 0x%x\n marker : %x\n length : %d\n", timestamp, id, len) ; + + if (len + 1 > SIGNED_SIZEOF (psf->u.scbuf)) + { psf_log_printf (psf, "\nError : string length (%d) too big.\n", len) ; + return SFE_INTERNAL ; + } ; + + cptr = psf->u.scbuf ; + psf_binheader_readf (psf, "b", cptr, len) ; + cptr [len] = 0 ; + psf_log_printf (psf, " string : %s\n", cptr) ; + } ; + } ; + break ; + + case APPL_MARKER : + psf_binheader_readf (psf, "E4", &dword) ; + dword += (dword & 1) ; + if (dword == 0) + break ; + if (dword >= SIGNED_SIZEOF (psf->u.scbuf)) + { psf_log_printf (psf, " %M : %d (too big, skipping)\n", marker, dword) ; + psf_binheader_readf (psf, "j", dword) ; + break ; + } ; + + cptr = psf->u.scbuf ; + psf_binheader_readf (psf, "b", cptr, dword) ; + cptr [dword - 1] = 0 ; + + for (k = 0 ; k < dword ; k++) + if (! isprint (cptr [k])) + { cptr [k] = 0 ; + break ; + } ; + + psf_log_printf (psf, " %M : %s\n", marker, cptr) ; + psf_store_string (psf, SF_STR_SOFTWARE, cptr) ; + break ; + + case NAME_MARKER : + psf_binheader_readf (psf, "E4", &dword) ; + dword += (dword & 1) ; + if (dword == 0) + break ; + if (dword > SIGNED_SIZEOF (psf->u.scbuf)) + { psf_log_printf (psf, " %M : %d (too big)\n", marker, dword) ; + return SFE_INTERNAL ; + } ; + + cptr = psf->u.scbuf ; + psf_binheader_readf (psf, "b", cptr, dword) ; + cptr [dword - 1] = 0 ; + psf_log_printf (psf, " %M : %s\n", marker, cptr) ; + psf_store_string (psf, SF_STR_TITLE, cptr) ; + break ; + + case ANNO_MARKER : + psf_binheader_readf (psf, "E4", &dword) ; + if (dword == 0) + break ; + if (dword > SIGNED_SIZEOF (psf->u.scbuf) - 1) + { psf_log_printf (psf, " %M : %d (too big)\n", marker, dword) ; + return SFE_INTERNAL ; + } ; + + cptr = psf->u.scbuf ; + psf_binheader_readf (psf, "b", cptr, dword) ; + cptr [dword] = 0 ; + psf_log_printf (psf, " %M : %s\n", marker, cptr) ; + psf_store_string (psf, SF_STR_COMMENT, cptr) ; + break ; + + case INST_MARKER : + psf_binheader_readf (psf, "E4", &dword) ; + if (dword != SIZEOF_INST_CHUNK) + { psf_log_printf (psf, " %M : %d (should be %d)\n", marker, dword, SIZEOF_INST_CHUNK) ; + psf_binheader_readf (psf, "j", dword) ; + break ; + } ; + psf_log_printf (psf, " %M : %d\n", marker, dword) ; + { unsigned char bytes [6] ; + short gain ; + + psf_binheader_readf (psf, "b", bytes, 6) ; + psf_log_printf (psf, " Base Note : %u\n Detune : %u\n" + " Low Note : %u\n High Note : %u\n" + " Low Vel. : %u\n High Vel. : %u\n", + bytes [0], bytes [1], bytes [2], bytes [3], bytes [4], bytes [5]) ; + + psf_binheader_readf (psf, "E2", &gain) ; + psf_log_printf (psf, " Gain (dB) : %d\n", gain) ; + + } ; + { short mode ; /* 0 - no loop, 1 - forward looping, 2 - backward looping */ + const char *loop_mode ; + unsigned short begin, end ; + + psf_binheader_readf (psf, "E222", &mode, &begin, &end) ; + loop_mode = get_loop_mode_str (mode) ; + psf_log_printf (psf, " Sustain\n mode : %d => %s\n begin : %u\n end : %u\n", + mode, loop_mode, begin, end) ; + psf_binheader_readf (psf, "E222", &mode, &begin, &end) ; + loop_mode = get_loop_mode_str (mode) ; + psf_log_printf (psf, " Release\n mode : %d => %s\n begin : %u\n end : %u\n", + mode, loop_mode, begin, end) ; + } ; + break ; + + case basc_MARKER : + psf_binheader_readf (psf, "E4", &dword) ; + + if (dword != SIZEOF_basc_CHUNK) + { psf_log_printf (psf, " %M : %d (should be %d)\n", marker, dword, SIZEOF_basc_CHUNK) ; + psf_binheader_readf (psf, "j", dword) ; + break ; + } ; + + psf_log_printf (psf, " basc : %u\n", dword) ; + + if ((error = aiff_read_basc_chunk (psf))) + return error ; + break ; + + case MARK_MARKER : + psf_binheader_readf (psf, "E4", &dword) ; + psf_log_printf (psf, " %M : %d\n", marker, dword) ; + { unsigned short mark_count, mark_id ; + unsigned char pstr_len ; + unsigned int position ; + + bytesread = psf_binheader_readf (psf, "E2", &mark_count) ; + psf_log_printf (psf, " Count : %d\n", mark_count) ; + + while (mark_count && bytesread < dword) + { bytesread += psf_binheader_readf (psf, "E241", &mark_id, &position, &pstr_len) ; + psf_log_printf (psf, " Mark ID : %u\n Position : %u\n", mark_id, position) ; + + pstr_len += (pstr_len & 1) + 1 ; /* fudgy, fudgy, hack, hack */ + + bytesread += psf_binheader_readf (psf, "b", psf->u.scbuf, pstr_len) ; + psf_log_printf (psf, " Name : %s\n", psf->u.scbuf) ; + + mark_count -- ; + } ; + } ; + psf_binheader_readf (psf, "j", dword - bytesread) ; + break ; + + case FVER_MARKER : + case SFX_MARKER : + psf_binheader_readf (psf, "E4", &dword) ; + psf_log_printf (psf, " %M : %d\n", marker, dword) ; + + psf_binheader_readf (psf, "j", dword) ; + break ; + + case NONE_MARKER : + /* Fix for broken AIFC files with incorrect COMM chunk length. */ + psf_binheader_readf (psf, "1", &byte) ; + dword = byte ; + psf_binheader_readf (psf, "j", dword) ; + break ; + + default : + if (isprint ((marker >> 24) & 0xFF) && isprint ((marker >> 16) & 0xFF) + && isprint ((marker >> 8) & 0xFF) && isprint (marker & 0xFF)) + { psf_binheader_readf (psf, "E4", &dword) ; + psf_log_printf (psf, " %M : %d (unknown marker)\n", marker, dword) ; + + psf_binheader_readf (psf, "j", dword) ; + break ; + } ; + if ((dword = psf_ftell (psf)) & 0x03) + { psf_log_printf (psf, " Unknown chunk marker %X at position %d. Resyncing.\n", marker, dword - 4) ; + + psf_binheader_readf (psf, "j", -3) ; + break ; + } ; + psf_log_printf (psf, "*** Unknown chunk marker %X at position %D. Exiting parser.\n", marker, psf_ftell (psf)) ; + done = 1 ; + break ; + } ; /* switch (marker) */ + + if ((! psf->sf.seekable) && (found_chunk & HAVE_SSND)) + break ; + + if (psf_ftell (psf) >= psf->filelength - (2 * SIGNED_SIZEOF (dword))) + break ; + + if (psf->logindex >= SIGNED_SIZEOF (psf->logbuffer) - 2) + return SFE_LOG_OVERRUN ; + } ; /* while (1) */ + + if (! (found_chunk & HAVE_FORM)) + return SFE_AIFF_NO_FORM ; + + if (! (found_chunk & HAVE_AIFF)) + return SFE_AIFF_COMM_NO_FORM ; + + if (! (found_chunk & HAVE_COMM)) + return SFE_AIFF_SSND_NO_COMM ; + + if (! psf->dataoffset) + return SFE_AIFF_NO_DATA ; + + return 0 ; +} /* aiff_read_header */ + +static int +aiff_close (SF_PRIVATE *psf) +{ + if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR) + { aiff_write_tailer (psf) ; + + aiff_write_header (psf, SF_TRUE) ; + } ; + + return 0 ; +} /* aiff_close */ + +static int +aiff_read_comm_chunk (SF_PRIVATE *psf, COMM_CHUNK *comm_fmt) +{ int error = 0, bytesread, subformat ; + + psf->u.scbuf [0] = 0 ; + + bytesread = psf_binheader_readf (psf, "E4", &(comm_fmt->size)) ; + + /* The COMM chunk has an int aligned to an odd word boundary. Some + ** procesors are not able to deal with this (ie bus fault) so we have + ** to take special care. + */ + comm_fmt->size += comm_fmt->size & 1 ; + + bytesread += + psf_binheader_readf (psf, "E242b", &(comm_fmt->numChannels), &(comm_fmt->numSampleFrames), + &(comm_fmt->sampleSize), &(comm_fmt->sampleRate), SIGNED_SIZEOF (comm_fmt->sampleRate)) ; + + if (comm_fmt->size == SIZEOF_AIFF_COMM) + comm_fmt->encoding = NONE_MARKER ; + else if (comm_fmt->size == SIZEOF_AIFC_COMM_MIN) + bytesread += psf_binheader_readf (psf, "Em", &(comm_fmt->encoding)) ; + else if (comm_fmt->size >= SIZEOF_AIFC_COMM) + { unsigned char encoding_len ; + + bytesread += psf_binheader_readf (psf, "Em1", &(comm_fmt->encoding), &encoding_len) ; + + memset (psf->u.scbuf, 0, comm_fmt->size) ; + + bytesread += psf_binheader_readf (psf, "b", psf->u.scbuf, + comm_fmt->size - SIZEOF_AIFC_COMM + 1) ; + psf->u.scbuf [encoding_len] = 0 ; + } ; + + psf_log_printf (psf, " COMM : %d\n", comm_fmt->size) ; + psf_log_printf (psf, " Sample Rate : %d\n", tenbytefloat2int (comm_fmt->sampleRate)) ; + psf_log_printf (psf, " Frames : %u%s\n", comm_fmt->numSampleFrames, (comm_fmt->numSampleFrames == 0 && psf->filelength > 100) ? " (Should not be 0)" : "") ; + psf_log_printf (psf, " Channels : %d\n", comm_fmt->numChannels) ; + + /* Found some broken 'fl32' files with comm.samplesize == 16. Fix it here. */ + + if ((comm_fmt->encoding == fl32_MARKER || comm_fmt->encoding == FL32_MARKER) && comm_fmt->sampleSize != 32) + { psf_log_printf (psf, " Sample Size : %d (should be 32)\n", comm_fmt->sampleSize) ; + comm_fmt->sampleSize = 32 ; + } + else if ((comm_fmt->encoding == fl64_MARKER || comm_fmt->encoding == FL64_MARKER) && comm_fmt->sampleSize != 64) + { psf_log_printf (psf, " Sample Size : %d (should be 64)\n", comm_fmt->sampleSize) ; + comm_fmt->sampleSize = 64 ; + } + else + psf_log_printf (psf, " Sample Size : %d\n", comm_fmt->sampleSize) ; + + subformat = s_bitwidth_to_subformat (comm_fmt->sampleSize) ; + + psf->endian = SF_ENDIAN_BIG ; + + switch (comm_fmt->encoding) + { case NONE_MARKER : + psf->sf.format = (SF_FORMAT_AIFF | subformat) ; + break ; + + case twos_MARKER : + case in32_MARKER : + psf->sf.format = (SF_ENDIAN_BIG | SF_FORMAT_AIFF | subformat) ; + break ; + + case sowt_MARKER : + case ni32_MARKER : + psf->endian = SF_ENDIAN_LITTLE ; + psf->sf.format = (SF_ENDIAN_LITTLE | SF_FORMAT_AIFF | subformat) ; + break ; + + case fl32_MARKER : + case FL32_MARKER : + psf->sf.format = (SF_FORMAT_AIFF | SF_FORMAT_FLOAT) ; + break ; + + case ulaw_MARKER : + case ULAW_MARKER : + psf->sf.format = (SF_FORMAT_AIFF | SF_FORMAT_ULAW) ; + break ; + + case alaw_MARKER : + case ALAW_MARKER : + psf->sf.format = (SF_FORMAT_AIFF | SF_FORMAT_ALAW) ; + break ; + + case fl64_MARKER : + case FL64_MARKER : + psf->sf.format = (SF_FORMAT_AIFF | SF_FORMAT_DOUBLE) ; + break ; + + case raw_MARKER : + psf->sf.format = (SF_FORMAT_AIFF | SF_FORMAT_PCM_U8) ; + break ; + + case DWVW_MARKER : + psf->sf.format = SF_FORMAT_AIFF ; + switch (comm_fmt->sampleSize) + { case 12 : + psf->sf.format |= SF_FORMAT_DWVW_12 ; + break ; + case 16 : + psf->sf.format |= SF_FORMAT_DWVW_16 ; + break ; + case 24 : + psf->sf.format |= SF_FORMAT_DWVW_24 ; + break ; + + default : + psf->sf.format |= SF_FORMAT_DWVW_N ; + break ; + } ; + break ; + + case GSM_MARKER : + psf->sf.format = SF_FORMAT_AIFF ; + psf->sf.format = (SF_FORMAT_AIFF | SF_FORMAT_GSM610) ; + break ; + + + case ima4_MARKER : + psf->endian = SF_ENDIAN_BIG ; + psf->sf.format = (SF_FORMAT_AIFF | SF_FORMAT_IMA_ADPCM) ; + break ; + + default : + psf_log_printf (psf, "AIFC : Unimplemented format : %M\n", comm_fmt->encoding) ; + error = SFE_UNIMPLEMENTED ; + } ; + + if (! psf->u.scbuf [0]) + psf_log_printf (psf, " Encoding : %M\n", comm_fmt->encoding) ; + else + psf_log_printf (psf, " Encoding : %M => %s\n", comm_fmt->encoding, psf->u.scbuf) ; + + return error ; +} /* aiff_read_comm_chunk */ + +static int +aiff_write_header (SF_PRIVATE *psf, int calc_length) +{ sf_count_t current ; + unsigned char comm_sample_rate [10], comm_zero_bytes [2] = { 0, 0 } ; + unsigned int comm_type, comm_size, comm_encoding, comm_frames ; + int k, endian ; + short bit_width ; + + current = psf_ftell (psf) ; + + if (calc_length) + { psf->filelength = psf_get_filelen (psf) ; + + psf->datalength = psf->filelength - psf->dataoffset ; + if (psf->dataend) + psf->datalength -= psf->filelength - psf->dataend ; + + if (psf->bytewidth > 0) + psf->sf.frames = psf->datalength / (psf->bytewidth * psf->sf.channels) ; + } ; + + if (psf->mode == SFM_RDWR && psf->dataoffset > 0) + { /* Assuming here that the header has already been written and just + ** needs to be corrected for new data length. That means that we + ** only change the length fields of the FORM and SSND chunks; + ** everything else can be skipped over. + */ + + /* First write new FORM chunk. */ + psf->headindex = 0 ; + psf_fseek (psf, 0, SEEK_SET) ; + + psf_binheader_writef (psf, "Etm8", FORM_MARKER, psf->filelength - 8) ; + psf_fwrite (psf->header, psf->headindex, 1, psf) ; + + /* Now write frame count field of COMM chunk header. */ + psf->headindex = 0 ; + psf_fseek (psf, 22, SEEK_SET) ; + + psf_binheader_writef (psf, "Et8", psf->sf.frames) ; + psf_fwrite (psf->header, psf->headindex, 1, psf) ; + + /* Now write new SSND chunk header. */ + psf->headindex = 0 ; + psf_fseek (psf, psf->dataoffset - 16, SEEK_SET) ; + + psf_binheader_writef (psf, "Etm8", SSND_MARKER, psf->datalength + SIZEOF_SSND_CHUNK) ; + psf_fwrite (psf->header, psf->headindex, 1, psf) ; + + if (current < psf->dataoffset) + psf_fseek (psf, psf->dataoffset, SEEK_SET) ; + else if (current > 0) + psf_fseek (psf, current, SEEK_SET) ; + + return 0 ; + } ; + + endian = psf->sf.format & SF_FORMAT_ENDMASK ; + if (CPU_IS_LITTLE_ENDIAN && endian == SF_ENDIAN_CPU) + endian = SF_ENDIAN_LITTLE ; + + /* Standard value here. */ + bit_width = psf->bytewidth * 8 ; + comm_frames = (psf->sf.frames > 0xFFFFFFFF) ? 0xFFFFFFFF : psf->sf.frames ; + + switch (psf->sf.format & SF_FORMAT_SUBMASK) + { case SF_FORMAT_PCM_S8 : + case SF_FORMAT_PCM_16 : + case SF_FORMAT_PCM_24 : + case SF_FORMAT_PCM_32 : + switch (endian) + { case SF_ENDIAN_BIG : + psf->endian = SF_ENDIAN_BIG ; + comm_type = AIFC_MARKER ; + comm_size = SIZEOF_AIFC_COMM ; + comm_encoding = twos_MARKER ; + break ; + + case SF_ENDIAN_LITTLE : + psf->endian = SF_ENDIAN_LITTLE ; + comm_type = AIFC_MARKER ; + comm_size = SIZEOF_AIFC_COMM ; + comm_encoding = sowt_MARKER ; + break ; + + default : /* SF_ENDIAN_FILE */ + psf->endian = SF_ENDIAN_BIG ; + comm_type = AIFF_MARKER ; + comm_size = SIZEOF_AIFF_COMM ; + comm_encoding = 0 ; + break ; + } ; + break ; + + case SF_FORMAT_FLOAT : /* Big endian floating point. */ + psf->endian = SF_ENDIAN_BIG ; + comm_type = AIFC_MARKER ; + comm_size = SIZEOF_AIFC_COMM ; + comm_encoding = FL32_MARKER ; /* Use 'FL32' because its easier to read. */ + break ; + + case SF_FORMAT_DOUBLE : /* Big endian double precision floating point. */ + psf->endian = SF_ENDIAN_BIG ; + comm_type = AIFC_MARKER ; + comm_size = SIZEOF_AIFC_COMM ; + comm_encoding = FL64_MARKER ; /* Use 'FL64' because its easier to read. */ + break ; + + case SF_FORMAT_ULAW : + psf->endian = SF_ENDIAN_BIG ; + comm_type = AIFC_MARKER ; + comm_size = SIZEOF_AIFC_COMM ; + comm_encoding = ulaw_MARKER ; + break ; + + case SF_FORMAT_ALAW : + psf->endian = SF_ENDIAN_BIG ; + comm_type = AIFC_MARKER ; + comm_size = SIZEOF_AIFC_COMM ; + comm_encoding = alaw_MARKER ; + break ; + + case SF_FORMAT_PCM_U8 : + psf->endian = SF_ENDIAN_BIG ; + comm_type = AIFC_MARKER ; + comm_size = SIZEOF_AIFC_COMM ; + comm_encoding = raw_MARKER ; + break ; + + case SF_FORMAT_DWVW_12 : + psf->endian = SF_ENDIAN_BIG ; + comm_type = AIFC_MARKER ; + comm_size = SIZEOF_AIFC_COMM ; + comm_encoding = DWVW_MARKER ; + + /* Override standard value here.*/ + bit_width = 12 ; + break ; + + case SF_FORMAT_DWVW_16 : + psf->endian = SF_ENDIAN_BIG ; + comm_type = AIFC_MARKER ; + comm_size = SIZEOF_AIFC_COMM ; + comm_encoding = DWVW_MARKER ; + + /* Override standard value here.*/ + bit_width = 16 ; + break ; + + case SF_FORMAT_DWVW_24 : + psf->endian = SF_ENDIAN_BIG ; + comm_type = AIFC_MARKER ; + comm_size = SIZEOF_AIFC_COMM ; + comm_encoding = DWVW_MARKER ; + + /* Override standard value here.*/ + bit_width = 24 ; + break ; + + case SF_FORMAT_GSM610 : + psf->endian = SF_ENDIAN_BIG ; + comm_type = AIFC_MARKER ; + comm_size = SIZEOF_AIFC_COMM ; + comm_encoding = GSM_MARKER ; + + /* Override standard value here.*/ + bit_width = 16 ; + break ; + + case SF_FORMAT_IMA_ADPCM : + psf->endian = SF_ENDIAN_BIG ; + comm_type = AIFC_MARKER ; + comm_size = SIZEOF_AIFC_COMM ; + comm_encoding = ima4_MARKER ; + + /* Override standard value here.*/ + bit_width = 16 ; + comm_frames = psf->sf.frames / AIFC_IMA4_SAMPLES_PER_BLOCK ; + break ; + + default : return SFE_BAD_OPEN_FORMAT ; + } ; + + /* Reset the current header length to zero. */ + psf->header [0] = 0 ; + psf->headindex = 0 ; + psf_fseek (psf, 0, SEEK_SET) ; + + psf_binheader_writef (psf, "Etm8", FORM_MARKER, psf->filelength - 8) ; + + /* Write COMM chunk. */ + psf_binheader_writef (psf, "Emm4", comm_type, COMM_MARKER, comm_size) ; + + uint2tenbytefloat (psf->sf.samplerate, comm_sample_rate) ; + + psf_binheader_writef (psf, "Et242", psf->sf.channels, comm_frames, bit_width) ; + psf_binheader_writef (psf, "b", comm_sample_rate, sizeof (comm_sample_rate)) ; + + /* AIFC chunks have some extra data. */ + if (comm_type == AIFC_MARKER) + psf_binheader_writef (psf, "mb", comm_encoding, comm_zero_bytes, sizeof (comm_zero_bytes)) ; + + if (psf->str_flags & SF_STR_LOCATE_START) + aiff_write_strings (psf, SF_STR_LOCATE_START) ; + + if (psf->has_peak && psf->peak_loc == SF_PEAK_START) + { psf_binheader_writef (psf, "Em4", PEAK_MARKER, + sizeof (PEAK_CHUNK) + psf->sf.channels * sizeof (PEAK_POS)) ; + psf_binheader_writef (psf, "E44", 1, time (NULL)) ; + for (k = 0 ; k < psf->sf.channels ; k++) + psf_binheader_writef (psf, "Ef4", psf->pchunk->peaks [k].value, psf->pchunk->peaks [k].position) ; /* XXXXX */ + } ; + + /* Write SSND chunk. */ + psf_binheader_writef (psf, "Etm844", SSND_MARKER, psf->datalength + SIZEOF_SSND_CHUNK, 0, 0) ; + + /* Header construction complete so write it out. */ + psf_fwrite (psf->header, psf->headindex, 1, psf) ; + + if (psf->error) + return psf->error ; + + psf->dataoffset = psf->headindex ; + + if (current < psf->dataoffset) + psf_fseek (psf, psf->dataoffset, SEEK_SET) ; + else if (current > 0) + psf_fseek (psf, current, SEEK_SET) ; + + return psf->error ; +} /* aiff_write_header */ + +static int +aiff_write_tailer (SF_PRIVATE *psf) +{ int k ; + + /* Reset the current header length to zero. */ + psf->header [0] = 0 ; + psf->headindex = 0 ; + + psf->dataend = psf_fseek (psf, 0, SEEK_END) ; + + if (psf->has_peak && psf->peak_loc == SF_PEAK_END) + { psf_binheader_writef (psf, "Em4", PEAK_MARKER, + sizeof (PEAK_CHUNK) + psf->sf.channels * sizeof (PEAK_POS)) ; + psf_binheader_writef (psf, "E44", 1, time (NULL)) ; + for (k = 0 ; k < psf->sf.channels ; k++) + psf_binheader_writef (psf, "Ef4", psf->pchunk->peaks [k].value, psf->pchunk->peaks [k].position) ; /* XXXXX */ + } ; + + if (psf->str_flags & SF_STR_LOCATE_END) + aiff_write_strings (psf, SF_STR_LOCATE_END) ; + + /* Write the tailer. */ + if (psf->headindex) + psf_fwrite (psf->header, psf->headindex, 1, psf) ; + + return 0 ; +} /* aiff_write_tailer */ + +static void +aiff_write_strings (SF_PRIVATE *psf, int location) +{ int k ; + + for (k = 0 ; k < SF_MAX_STRINGS ; k++) + { if (psf->strings [k].type == 0) + break ; + + if (psf->strings [k].flags != location) + continue ; + + switch (psf->strings [k].type) + { case SF_STR_SOFTWARE : + psf_binheader_writef (psf, "Ems", APPL_MARKER, psf->strings [k].str) ; + break ; + + case SF_STR_TITLE : + psf_binheader_writef (psf, "Ems", NAME_MARKER, psf->strings [k].str) ; + break ; + + case SF_STR_COPYRIGHT : + psf_binheader_writef (psf, "Ems", c_MARKER, psf->strings [k].str) ; + break ; + + case SF_STR_ARTIST : + psf_binheader_writef (psf, "Ems", AUTH_MARKER, psf->strings [k].str) ; + break ; + + case SF_STR_COMMENT : + psf_binheader_writef (psf, "Ems", ANNO_MARKER, psf->strings [k].str) ; + break ; + + /* + case SF_STR_DATE : + psf_binheader_writef (psf, "Ems", ICRD_MARKER, psf->strings [k].str) ; + break ; + */ + } ; + } ; + + return ; +} /* aiff_write_strings */ + +static int +aiff_command (SF_PRIVATE *psf, int command, void *data, int datasize) +{ + /* Avoid compiler warnings. */ + psf = psf ; + data = data ; + datasize = datasize ; + + switch (command) + { default : break ; + } ; + + return 0 ; +} /* aiff_command */ + +static const char* +get_loop_mode_str (short mode) +{ switch (mode) + { case 0 : return "none" ; + case 1 : return "forward" ; + case 2 : return "backward" ; + } ; + + return "*** unknown" ; +} /* get_loop_mode_str */ + +/*========================================================================================== +** Rough hack at converting from 80 bit IEEE float in AIFF header to an int and +** back again. It assumes that all sample rates are between 1 and 800MHz, which +** should be OK as other sound file formats use a 32 bit integer to store sample +** rate. +** There is another (probably better) version in the source code to the SoX but it +** has a copyright which probably prevents it from being allowable as GPL/LGPL. +*/ + +static int +tenbytefloat2int (unsigned char *bytes) +{ int val = 3 ; + + if (bytes [0] & 0x80) /* Negative number. */ + return 0 ; + + if (bytes [0] <= 0x3F) /* Less than 1. */ + return 1 ; + + if (bytes [0] > 0x40) /* Way too big. */ + return 0x4000000 ; + + if (bytes [0] == 0x40 && bytes [1] > 0x1C) /* Too big. */ + return 800000000 ; + + /* Ok, can handle it. */ + + val = (bytes [2] << 23) | (bytes [3] << 15) | (bytes [4] << 7) | (bytes [5] >> 1) ; + + val >>= (29 - bytes [1]) ; + + return val ; +} /* tenbytefloat2int */ + +static void +uint2tenbytefloat (unsigned int num, unsigned char *bytes) +{ unsigned int mask = 0x40000000 ; + int count ; + + + memset (bytes, 0, 10) ; + + if (num <= 1) + { bytes [0] = 0x3F ; + bytes [1] = 0xFF ; + bytes [2] = 0x80 ; + return ; + } ; + + bytes [0] = 0x40 ; + + if (num >= mask) + { bytes [1] = 0x1D ; + return ; + } ; + + for (count = 0 ; count <= 32 ; count ++) + { if (num & mask) + break ; + mask >>= 1 ; + } ; + + num <<= count + 1 ; + bytes [1] = 29 - count ; + bytes [2] = (num >> 24) & 0xFF ; + bytes [3] = (num >> 16) & 0xFF ; + bytes [4] = (num >> 8) & 0xFF ; + bytes [5] = num & 0xFF ; + +} /* uint2tenbytefloat */ + +static int +aiff_read_basc_chunk (SF_PRIVATE * psf) +{ const char * type_str ; + basc_CHUNK bc ; + + psf_binheader_readf (psf, "E442", &bc.version, &bc.numBeats, &bc.rootNote) ; + psf_binheader_readf (psf, "E222", &bc.scaleType, &bc.sigNumerator, &bc.sigDenominator) ; + psf_binheader_readf (psf, "E2b", &bc.loopType, &bc.zero_bytes, SIZEOF_basc_CHUNK_PADDING) ; + + psf_log_printf (psf, " Version ? : %u\n Num Beats : %u\n Root Note : 0x%x\n", + bc.version, bc.numBeats, bc.rootNote) ; + + switch (bc.scaleType) + { case basc_SCALE_MINOR : + type_str = "MINOR" ; + break ; + case basc_SCALE_MAJOR : + type_str = "MAJOR" ; + break ; + case basc_SCALE_NEITHER : + type_str = "NEITHER" ; + break ; + case basc_SCALE_BOTH : + type_str = "BOTH" ; + break ; + default : + type_str = "!!WRONG!!" ; + break ; + } ; + + psf_log_printf (psf, " ScaleType : 0x%x (%s)\n", bc.scaleType, type_str) ; + psf_log_printf (psf, " Time Sig : %d/%d\n", bc.sigNumerator, bc.sigDenominator) ; + + switch (bc.loopType) + { case basc_TYPE_ONE_SHOT : + type_str = "One Shot" ; + break ; + case basc_TYPE_LOOP : + type_str = "Loop" ; + break ; + default: + type_str = "!!WRONG!!" ; + break ; + } ; + + psf_log_printf (psf, " Loop Type : 0x%x (%s)\n", bc.loopType, type_str) ; + + if ((psf->loop_info = calloc (1, sizeof (SF_LOOP_INFO))) == NULL) + return SFE_MALLOC_FAILED ; + + psf->loop_info->time_sig_num = bc.sigNumerator ; + psf->loop_info->time_sig_den = bc.sigDenominator ; + psf->loop_info->loop_mode = (bc.loopType == basc_TYPE_ONE_SHOT) ? SF_LOOP_NONE : SF_LOOP_FORWARD ; + psf->loop_info->num_beats = bc.numBeats ; + + /* Can always be recalculated from other known fields. */ + psf->loop_info->bpm = (1.0 / psf->sf.frames) * psf->sf.samplerate + * ((bc.numBeats * 4.0) / bc.sigDenominator) * 60.0 ; + psf->loop_info->root_key = bc.rootNote ; + + return 0 ; +} /* aiff_read_basc_chunk */ + +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: 7dec56ca-d6f2-48cf-863b-a72e7e17a5d9 +*/ diff --git a/Libraries/SndFile/Files/src/alaw.c b/Libraries/SndFile/Files/src/alaw.c new file mode 100644 index 000000000..e8735d5a7 --- /dev/null +++ b/Libraries/SndFile/Files/src/alaw.c @@ -0,0 +1,544 @@ +/* +** Copyright (C) 1999-2004 Erik de Castro Lopo +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU Lesser General Public License as published by +** the Free Software Foundation; either version 2.1 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU Lesser General Public License for more details. +** +** You should have received a copy of the GNU Lesser General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include "sndfile.h" +#include "float_cast.h" +#include "common.h" + +static sf_count_t alaw_read_alaw2s (SF_PRIVATE *psf, short *ptr, sf_count_t len) ; +static sf_count_t alaw_read_alaw2i (SF_PRIVATE *psf, int *ptr, sf_count_t len) ; +static sf_count_t alaw_read_alaw2f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ; +static sf_count_t alaw_read_alaw2d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ; + +static sf_count_t alaw_write_s2alaw (SF_PRIVATE *psf, short *ptr, sf_count_t len) ; +static sf_count_t alaw_write_i2alaw (SF_PRIVATE *psf, int *ptr, sf_count_t len) ; +static sf_count_t alaw_write_f2alaw (SF_PRIVATE *psf, float *ptr, sf_count_t len) ; +static sf_count_t alaw_write_d2alaw (SF_PRIVATE *psf, double *ptr, sf_count_t len) ; + +static void alaw2s_array (unsigned char *buffer, int count, short *ptr) ; +static void alaw2i_array (unsigned char *buffer, int count, int *ptr) ; +static void alaw2f_array (unsigned char *buffer, int count, float *ptr, float normfact) ; +static void alaw2d_array (unsigned char *buffer, int count, double *ptr, double normfact) ; + +static void s2alaw_array (short *buffer, int count, unsigned char *ptr) ; +static void i2alaw_array (int *buffer, int count, unsigned char *ptr) ; +static void f2alaw_array (float *buffer, int count, unsigned char *ptr, float normfact) ; +static void d2alaw_array (double *buffer, int count, unsigned char *ptr, double normfact) ; + + +int +alaw_init (SF_PRIVATE *psf) +{ + if (psf->mode == SFM_READ || psf->mode == SFM_RDWR) + { psf->read_short = alaw_read_alaw2s ; + psf->read_int = alaw_read_alaw2i ; + psf->read_float = alaw_read_alaw2f ; + psf->read_double = alaw_read_alaw2d ; + } ; + + if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR) + { psf->write_short = alaw_write_s2alaw ; + psf->write_int = alaw_write_i2alaw ; + psf->write_float = alaw_write_f2alaw ; + psf->write_double = alaw_write_d2alaw ; + } ; + + psf->bytewidth = 1 ; + psf->blockwidth = psf->sf.channels ; + + if (psf->filelength > psf->dataoffset) + psf->datalength = (psf->dataend) ? psf->dataend - psf->dataoffset : psf->filelength - psf->dataoffset ; + else + psf->datalength = 0 ; + + psf->sf.frames = psf->datalength / psf->blockwidth ; + + return 0 ; +} /* alaw_init */ + +/*============================================================================== + * Private static functions and data. + */ + +static +short alaw_decode [256] = +{ -5504, -5248, -6016, -5760, -4480, -4224, -4992, -4736, + -7552, -7296, -8064, -7808, -6528, -6272, -7040, -6784, + -2752, -2624, -3008, -2880, -2240, -2112, -2496, -2368, + -3776, -3648, -4032, -3904, -3264, -3136, -3520, -3392, + -22016, -20992, -24064, -23040, -17920, -16896, -19968, -18944, + -30208, -29184, -32256, -31232, -26112, -25088, -28160, -27136, + -11008, -10496, -12032, -11520, -8960, -8448, -9984, -9472, + -15104, -14592, -16128, -15616, -13056, -12544, -14080, -13568, + -344, -328, -376, -360, -280, -264, -312, -296, + -472, -456, -504, -488, -408, -392, -440, -424, + -88, -72, -120, -104, -24, -8, -56, -40, + -216, -200, -248, -232, -152, -136, -184, -168, + -1376, -1312, -1504, -1440, -1120, -1056, -1248, -1184, + -1888, -1824, -2016, -1952, -1632, -1568, -1760, -1696, + -688, -656, -752, -720, -560, -528, -624, -592, + -944, -912, -1008, -976, -816, -784, -880, -848, + 5504, 5248, 6016, 5760, 4480, 4224, 4992, 4736, + 7552, 7296, 8064, 7808, 6528, 6272, 7040, 6784, + 2752, 2624, 3008, 2880, 2240, 2112, 2496, 2368, + 3776, 3648, 4032, 3904, 3264, 3136, 3520, 3392, + 22016, 20992, 24064, 23040, 17920, 16896, 19968, 18944, + 30208, 29184, 32256, 31232, 26112, 25088, 28160, 27136, + 11008, 10496, 12032, 11520, 8960, 8448, 9984, 9472, + 15104, 14592, 16128, 15616, 13056, 12544, 14080, 13568, + 344, 328, 376, 360, 280, 264, 312, 296, + 472, 456, 504, 488, 408, 392, 440, 424, + 88, 72, 120, 104, 24, 8, 56, 40, + 216, 200, 248, 232, 152, 136, 184, 168, + 1376, 1312, 1504, 1440, 1120, 1056, 1248, 1184, + 1888, 1824, 2016, 1952, 1632, 1568, 1760, 1696, + 688, 656, 752, 720, 560, 528, 624, 592, + 944, 912, 1008, 976, 816, 784, 880, 848 +} ; /* alaw_decode */ + +static +unsigned char alaw_encode [2048 + 1] = +{ 0xd5, 0xd4, 0xd7, 0xd6, 0xd1, 0xd0, 0xd3, 0xd2, 0xdd, 0xdc, 0xdf, 0xde, + 0xd9, 0xd8, 0xdb, 0xda, 0xc5, 0xc4, 0xc7, 0xc6, 0xc1, 0xc0, 0xc3, 0xc2, + 0xcd, 0xcc, 0xcf, 0xce, 0xc9, 0xc8, 0xcb, 0xca, 0xf5, 0xf5, 0xf4, 0xf4, + 0xf7, 0xf7, 0xf6, 0xf6, 0xf1, 0xf1, 0xf0, 0xf0, 0xf3, 0xf3, 0xf2, 0xf2, + 0xfd, 0xfd, 0xfc, 0xfc, 0xff, 0xff, 0xfe, 0xfe, 0xf9, 0xf9, 0xf8, 0xf8, + 0xfb, 0xfb, 0xfa, 0xfa, 0xe5, 0xe5, 0xe5, 0xe5, 0xe4, 0xe4, 0xe4, 0xe4, + 0xe7, 0xe7, 0xe7, 0xe7, 0xe6, 0xe6, 0xe6, 0xe6, 0xe1, 0xe1, 0xe1, 0xe1, + 0xe0, 0xe0, 0xe0, 0xe0, 0xe3, 0xe3, 0xe3, 0xe3, 0xe2, 0xe2, 0xe2, 0xe2, + 0xed, 0xed, 0xed, 0xed, 0xec, 0xec, 0xec, 0xec, 0xef, 0xef, 0xef, 0xef, + 0xee, 0xee, 0xee, 0xee, 0xe9, 0xe9, 0xe9, 0xe9, 0xe8, 0xe8, 0xe8, 0xe8, + 0xeb, 0xeb, 0xeb, 0xeb, 0xea, 0xea, 0xea, 0xea, 0x95, 0x95, 0x95, 0x95, + 0x95, 0x95, 0x95, 0x95, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, + 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x96, 0x96, 0x96, 0x96, + 0x96, 0x96, 0x96, 0x96, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, + 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x93, 0x93, 0x93, 0x93, + 0x93, 0x93, 0x93, 0x93, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, + 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9c, 0x9c, 0x9c, 0x9c, + 0x9c, 0x9c, 0x9c, 0x9c, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, + 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x99, 0x99, 0x99, 0x99, + 0x99, 0x99, 0x99, 0x99, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, + 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9a, 0x9a, 0x9a, 0x9a, + 0x9a, 0x9a, 0x9a, 0x9a, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, + 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x84, 0x84, 0x84, 0x84, + 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, + 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, + 0x87, 0x87, 0x87, 0x87, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, + 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x81, 0x81, 0x81, 0x81, + 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, + 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, + 0x80, 0x80, 0x80, 0x80, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, + 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x82, 0x82, 0x82, 0x82, + 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, + 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, + 0x8d, 0x8d, 0x8d, 0x8d, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, + 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8f, 0x8f, 0x8f, 0x8f, + 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, + 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, + 0x8e, 0x8e, 0x8e, 0x8e, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, + 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x88, 0x88, 0x88, 0x88, + 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, + 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, + 0x8b, 0x8b, 0x8b, 0x8b, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, + 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0xb5, 0xb5, 0xb5, 0xb5, + 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, + 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, + 0xb5, 0xb5, 0xb5, 0xb5, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, + 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, + 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, + 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, + 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, + 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb6, 0xb6, 0xb6, 0xb6, + 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, + 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, + 0xb6, 0xb6, 0xb6, 0xb6, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, + 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, + 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, + 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, + 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, + 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb3, 0xb3, 0xb3, 0xb3, + 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, + 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, + 0xb3, 0xb3, 0xb3, 0xb3, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, + 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, + 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, + 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, + 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, + 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbc, 0xbc, 0xbc, 0xbc, + 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, + 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, + 0xbc, 0xbc, 0xbc, 0xbc, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, + 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, + 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, + 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, + 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, + 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xb9, 0xb9, 0xb9, 0xb9, + 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, + 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, + 0xb9, 0xb9, 0xb9, 0xb9, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, + 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, + 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, + 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, + 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, + 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xba, 0xba, 0xba, 0xba, + 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, + 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, + 0xba, 0xba, 0xba, 0xba, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, + 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, + 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, + 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, + 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, + 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa4, 0xa4, 0xa4, 0xa4, + 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, + 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, + 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, + 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, + 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, + 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, + 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, + 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, + 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, + 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, + 0xa7, 0xa7, 0xa7, 0xa7, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, + 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, + 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, + 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, + 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, + 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa1, 0xa1, 0xa1, 0xa1, + 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, + 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, + 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, + 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, + 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, + 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, + 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, + 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, + 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, + 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, + 0xa0, 0xa0, 0xa0, 0xa0, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, + 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, + 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, + 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, + 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, + 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa2, 0xa2, 0xa2, 0xa2, + 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, + 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, + 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, + 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, + 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, + 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, + 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, + 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, + 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, + 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, + 0xad, 0xad, 0xad, 0xad, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, + 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, + 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, + 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, + 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, + 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xaf, 0xaf, 0xaf, 0xaf, + 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, + 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, + 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, + 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, + 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, + 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, + 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, + 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, + 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, + 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, + 0xae, 0xae, 0xae, 0xae, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, + 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, + 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, + 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, + 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, + 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa8, 0xa8, 0xa8, 0xa8, + 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, + 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, + 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, + 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, + 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, + 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, + 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, + 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, + 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, + 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, + 0xab, 0xab, 0xab, 0xab, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0x2a +} ; /* alaw_encode */ + +static inline void +alaw2s_array (unsigned char *buffer, int count, short *ptr) +{ while (--count >= 0) + ptr [count] = alaw_decode [(int) buffer [count]] ; +} /* alaw2s_array */ + +static inline void +alaw2i_array (unsigned char *buffer, int count, int *ptr) +{ while (--count >= 0) + ptr [count] = alaw_decode [(int) buffer [count]] << 16 ; +} /* alaw2i_array */ + +static inline void +alaw2f_array (unsigned char *buffer, int count, float *ptr, float normfact) +{ while (--count >= 0) + ptr [count] = normfact * alaw_decode [(int) buffer [count]] ; +} /* alaw2f_array */ + +static inline void +alaw2d_array (unsigned char *buffer, int count, double *ptr, double normfact) +{ while (--count >= 0) + ptr [count] = normfact * alaw_decode [(int) buffer [count]] ; +} /* alaw2d_array */ + +static inline void +s2alaw_array (short *ptr, int count, unsigned char *buffer) +{ while (--count >= 0) + { if (ptr [count] >= 0) + buffer [count] = alaw_encode [ptr [count] / 16] ; + else + buffer [count] = 0x7F & alaw_encode [ptr [count] / -16] ; + } ; +} /* s2alaw_array */ + +static inline void +i2alaw_array (int *ptr, int count, unsigned char *buffer) +{ while (--count >= 0) + { if (ptr [count] >= 0) + buffer [count] = alaw_encode [ptr [count] >> (16 + 4)] ; + else + buffer [count] = 0x7F & alaw_encode [- ptr [count] >> (16 + 4)] ; + } ; +} /* i2alaw_array */ + +static inline void +f2alaw_array (float *ptr, int count, unsigned char *buffer, float normfact) +{ while (--count >= 0) + { if (ptr [count] >= 0) + buffer [count] = alaw_encode [lrintf (normfact * ptr [count])] ; + else + buffer [count] = 0x7F & alaw_encode [- lrintf (normfact * ptr [count])] ; + } ; +} /* f2alaw_array */ + +static inline void +d2alaw_array (double *ptr, int count, unsigned char *buffer, double normfact) +{ while (--count >= 0) + { if (ptr [count] >= 0) + buffer [count] = alaw_encode [lrint (normfact * ptr [count])] ; + else + buffer [count] = 0x7F & alaw_encode [- lrint (normfact * ptr [count])] ; + } ; +} /* d2alaw_array */ + +/*============================================================================== +*/ + +static sf_count_t +alaw_read_alaw2s (SF_PRIVATE *psf, short *ptr, sf_count_t len) +{ int bufferlen, readcount ; + sf_count_t total = 0 ; + + bufferlen = ARRAY_LEN (psf->u.ucbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + readcount = psf_fread (psf->u.ucbuf, 1, bufferlen, psf) ; + alaw2s_array (psf->u.ucbuf, readcount, ptr + total) ; + total += readcount ; + if (readcount < bufferlen) + break ; + len -= readcount ; + } ; + + return total ; +} /* alaw_read_alaw2s */ + +static sf_count_t +alaw_read_alaw2i (SF_PRIVATE *psf, int *ptr, sf_count_t len) +{ int bufferlen, readcount ; + sf_count_t total = 0 ; + + bufferlen = ARRAY_LEN (psf->u.ucbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + readcount = psf_fread (psf->u.ucbuf, 1, bufferlen, psf) ; + alaw2i_array (psf->u.ucbuf, readcount, ptr + total) ; + total += readcount ; + if (readcount < bufferlen) + break ; + len -= readcount ; + } ; + + return total ; +} /* alaw_read_alaw2i */ + +static sf_count_t +alaw_read_alaw2f (SF_PRIVATE *psf, float *ptr, sf_count_t len) +{ int bufferlen, readcount ; + sf_count_t total = 0 ; + float normfact ; + + normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x8000) : 1.0 ; + + bufferlen = ARRAY_LEN (psf->u.ucbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + readcount = psf_fread (psf->u.ucbuf, 1, bufferlen, psf) ; + alaw2f_array (psf->u.ucbuf, readcount, ptr + total, normfact) ; + total += readcount ; + if (readcount < bufferlen) + break ; + len -= readcount ; + } ; + + return total ; +} /* alaw_read_alaw2f */ + +static sf_count_t +alaw_read_alaw2d (SF_PRIVATE *psf, double *ptr, sf_count_t len) +{ int bufferlen, readcount ; + sf_count_t total = 0 ; + double normfact ; + + normfact = (psf->norm_double) ? 1.0 / ((double) 0x8000) : 1.0 ; + bufferlen = ARRAY_LEN (psf->u.ucbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + readcount = psf_fread (psf->u.ucbuf, 1, bufferlen, psf) ; + alaw2d_array (psf->u.ucbuf, readcount, ptr + total, normfact) ; + total += readcount ; + if (readcount < bufferlen) + break ; + len -= readcount ; + } ; + + return total ; +} /* alaw_read_alaw2d */ + +/*============================================================================================= +*/ + +static sf_count_t +alaw_write_s2alaw (SF_PRIVATE *psf, short *ptr, sf_count_t len) +{ int bufferlen, writecount ; + sf_count_t total = 0 ; + + bufferlen = ARRAY_LEN (psf->u.ucbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + s2alaw_array (ptr + total, bufferlen, psf->u.ucbuf) ; + writecount = psf_fwrite (psf->u.ucbuf, 1, bufferlen, psf) ; + total += writecount ; + if (writecount < bufferlen) + break ; + len -= writecount ; + } ; + + return total ; +} /* alaw_write_s2alaw */ + +static sf_count_t +alaw_write_i2alaw (SF_PRIVATE *psf, int *ptr, sf_count_t len) +{ int bufferlen, writecount ; + sf_count_t total = 0 ; + + bufferlen = ARRAY_LEN (psf->u.ucbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + i2alaw_array (ptr + total, bufferlen, psf->u.ucbuf) ; + writecount = psf_fwrite (psf->u.ucbuf, 1, bufferlen, psf) ; + total += writecount ; + if (writecount < bufferlen) + break ; + len -= writecount ; + } ; + + return total ; +} /* alaw_write_i2alaw */ + +static sf_count_t +alaw_write_f2alaw (SF_PRIVATE *psf, float *ptr, sf_count_t len) +{ int bufferlen, writecount ; + sf_count_t total = 0 ; + float normfact ; + + normfact = (psf->norm_float == SF_TRUE) ? (1.0 * 0x7FFF) / 16.0 : 1.0 / 16 ; + + bufferlen = ARRAY_LEN (psf->u.ucbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + f2alaw_array (ptr + total, bufferlen, psf->u.ucbuf, normfact) ; + writecount = psf_fwrite (psf->u.ucbuf, 1, bufferlen, psf) ; + total += writecount ; + if (writecount < bufferlen) + break ; + len -= writecount ; + } ; + + return total ; +} /* alaw_write_f2alaw */ + +static sf_count_t +alaw_write_d2alaw (SF_PRIVATE *psf, double *ptr, sf_count_t len) +{ int bufferlen, writecount ; + sf_count_t total = 0 ; + double normfact ; + + normfact = (psf->norm_double) ? (1.0 * 0x7FFF) / 16.0 : 1.0 / 16.0 ; + + bufferlen = ARRAY_LEN (psf->u.ucbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + d2alaw_array (ptr + total, bufferlen, psf->u.ucbuf, normfact) ; + writecount = psf_fwrite (psf->u.ucbuf, 1, bufferlen, psf) ; + total += writecount ; + if (writecount < bufferlen) + break ; + len -= writecount ; + } ; + + return total ; +} /* alaw_write_d2alaw */ + +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: 289ccfc2-42a6-4f1f-a29f-4dcc9bfa8752 +*/ diff --git a/Libraries/SndFile/Files/src/au.c b/Libraries/SndFile/Files/src/au.c new file mode 100644 index 000000000..85ebf7b97 --- /dev/null +++ b/Libraries/SndFile/Files/src/au.c @@ -0,0 +1,495 @@ +/* +** Copyright (C) 1999-2004 Erik de Castro Lopo +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU Lesser General Public License as published by +** the Free Software Foundation; either version 2.1 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU Lesser General Public License for more details. +** +** You should have received a copy of the GNU Lesser General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include "config.h" + +#include +#include +#include +#include + +#include "sndfile.h" +#include "sfendian.h" +#include "common.h" +#include "au.h" + +/*------------------------------------------------------------------------------ +** Macros to handle big/little endian issues. +*/ + +#define DOTSND_MARKER (MAKE_MARKER ('.', 's', 'n', 'd')) +#define DNSDOT_MARKER (MAKE_MARKER ('d', 'n', 's', '.')) + +#define AU_DATA_OFFSET 24 + +/*------------------------------------------------------------------------------ +** Known AU file encoding types. +*/ + +enum +{ AU_ENCODING_ULAW_8 = 1, /* 8-bit u-law samples */ + AU_ENCODING_PCM_8 = 2, /* 8-bit linear samples */ + AU_ENCODING_PCM_16 = 3, /* 16-bit linear samples */ + AU_ENCODING_PCM_24 = 4, /* 24-bit linear samples */ + AU_ENCODING_PCM_32 = 5, /* 32-bit linear samples */ + + AU_ENCODING_FLOAT = 6, /* floating-point samples */ + AU_ENCODING_DOUBLE = 7, /* double-precision float samples */ + AU_ENCODING_INDIRECT = 8, /* fragmented sampled data */ + AU_ENCODING_NESTED = 9, /* ? */ + AU_ENCODING_DSP_CORE = 10, /* DSP program */ + AU_ENCODING_DSP_DATA_8 = 11, /* 8-bit fixed-point samples */ + AU_ENCODING_DSP_DATA_16 = 12, /* 16-bit fixed-point samples */ + AU_ENCODING_DSP_DATA_24 = 13, /* 24-bit fixed-point samples */ + AU_ENCODING_DSP_DATA_32 = 14, /* 32-bit fixed-point samples */ + + AU_ENCODING_DISPLAY = 16, /* non-audio display data */ + AU_ENCODING_MULAW_SQUELCH = 17, /* ? */ + AU_ENCODING_EMPHASIZED = 18, /* 16-bit linear with emphasis */ + AU_ENCODING_NEXT = 19, /* 16-bit linear with compression (NEXT) */ + AU_ENCODING_COMPRESSED_EMPHASIZED = 20, /* A combination of the two above */ + AU_ENCODING_DSP_COMMANDS = 21, /* Music Kit DSP commands */ + AU_ENCODING_DSP_COMMANDS_SAMPLES = 22, /* ? */ + + AU_ENCODING_ADPCM_G721_32 = 23, /* G721 32 kbs ADPCM - 4 bits per sample. */ + AU_ENCODING_ADPCM_G722 = 24, /* G722 64 kbs ADPCM */ + AU_ENCODING_ADPCM_G723_24 = 25, /* G723 24 kbs ADPCM - 3 bits per sample. */ + AU_ENCODING_ADPCM_G723_40 = 26, /* G723 40 kbs ADPCM - 5 bits per sample. */ + + AU_ENCODING_ALAW_8 = 27 +} ; + +/*------------------------------------------------------------------------------ +** Typedefs. +*/ + +typedef struct +{ int dataoffset ; + int datasize ; + int encoding ; + int samplerate ; + int channels ; +} AU_FMT ; + + +/*------------------------------------------------------------------------------ +** Private static functions. +*/ + +static int au_close (SF_PRIVATE *psf) ; + +static int au_format_to_encoding (int format) ; + +static int au_write_header (SF_PRIVATE *psf, int calc_length) ; +static int au_read_header (SF_PRIVATE *psf) ; + +/*------------------------------------------------------------------------------ +** Public function. +*/ + +int +au_open (SF_PRIVATE *psf) +{ int subformat ; + int error = 0 ; + + if (psf->mode == SFM_READ || (psf->mode == SFM_RDWR && psf->filelength > 0)) + { if ((error = au_read_header (psf))) + return error ; + } ; + + if ((psf->sf.format & SF_FORMAT_TYPEMASK) != SF_FORMAT_AU) + return SFE_BAD_OPEN_FORMAT ; + + subformat = psf->sf.format & SF_FORMAT_SUBMASK ; + + if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR) + { psf->endian = psf->sf.format & SF_FORMAT_ENDMASK ; + if (CPU_IS_LITTLE_ENDIAN && psf->endian == SF_ENDIAN_CPU) + psf->endian = SF_ENDIAN_LITTLE ; + else if (psf->endian != SF_ENDIAN_LITTLE) + psf->endian = SF_ENDIAN_BIG ; + + if (au_write_header (psf, SF_FALSE)) + return psf->error ; + + psf->write_header = au_write_header ; + } ; + + psf->close = au_close ; + + psf->blockwidth = psf->bytewidth * psf->sf.channels ; + + switch (subformat) + { case SF_FORMAT_ULAW : /* 8-bit Ulaw encoding. */ + ulaw_init (psf) ; + break ; + + case SF_FORMAT_PCM_S8 : /* 8-bit linear PCM. */ + error = pcm_init (psf) ; + break ; + + case SF_FORMAT_PCM_16 : /* 16-bit linear PCM. */ + case SF_FORMAT_PCM_24 : /* 24-bit linear PCM */ + case SF_FORMAT_PCM_32 : /* 32-bit linear PCM. */ + error = pcm_init (psf) ; + break ; + + case SF_FORMAT_ALAW : /* 8-bit Alaw encoding. */ + alaw_init (psf) ; + break ; + + /* Lite remove start */ + case SF_FORMAT_FLOAT : /* 32-bit floats. */ + error = float32_init (psf) ; + break ; + + case SF_FORMAT_DOUBLE : /* 64-bit double precision floats. */ + error = double64_init (psf) ; + break ; + + case SF_FORMAT_G721_32 : + if (psf->mode == SFM_READ) + error = au_g72x_reader_init (psf, AU_H_G721_32) ; + else if (psf->mode == SFM_WRITE) + error = au_g72x_writer_init (psf, AU_H_G721_32) ; + psf->sf.seekable = SF_FALSE ; + break ; + + case SF_FORMAT_G723_24 : + if (psf->mode == SFM_READ) + error = au_g72x_reader_init (psf, AU_H_G723_24) ; + else if (psf->mode == SFM_WRITE) + error = au_g72x_writer_init (psf, AU_H_G723_24) ; + psf->sf.seekable = SF_FALSE ; + break ; + + case SF_FORMAT_G723_40 : + if (psf->mode == SFM_READ) + error = au_g72x_reader_init (psf, AU_H_G723_40) ; + else if (psf->mode == SFM_WRITE) + error = au_g72x_writer_init (psf, AU_H_G723_40) ; + psf->sf.seekable = SF_FALSE ; + break ; + /* Lite remove end */ + + default : break ; + } ; + + return error ; +} /* au_open */ + +int +au_nh_open (SF_PRIVATE *psf) +{ + if (psf->mode == SFM_RDWR) + return SFE_BAD_OPEN_FORMAT ; + + if (psf_fseek (psf, psf->dataoffset, SEEK_SET)) + return SFE_BAD_SEEK ; + + psf_log_printf (psf, "Header-less u-law encoded file.\n") ; + psf_log_printf (psf, "Setting up for 8kHz, mono, u-law.\n") ; + + psf->sf.format = SF_FORMAT_AU | SF_FORMAT_ULAW ; + + psf->dataoffset = 0 ; + psf->endian = 0 ; /* Irrelevant but it must be something. */ + psf->sf.samplerate = 8000 ; + psf->sf.channels = 1 ; + psf->bytewidth = 1 ; /* Before decoding */ + + ulaw_init (psf) ; + + psf->close = au_close ; + + psf->blockwidth = 1 ; + psf->sf.frames = psf->filelength ; + psf->datalength = psf->filelength - AU_DATA_OFFSET ; + + return 0 ; +} /* au_nh_open */ + +/*------------------------------------------------------------------------------ +*/ + +static int +au_close (SF_PRIVATE *psf) +{ + if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR) + au_write_header (psf, SF_TRUE) ; + + return 0 ; +} /* au_close */ + +static int +au_write_header (SF_PRIVATE *psf, int calc_length) +{ sf_count_t current ; + int encoding, datalength ; + + if (psf->pipeoffset > 0) + return 0 ; + + current = psf_ftell (psf) ; + + if (calc_length) + { psf->filelength = psf_get_filelen (psf) ; + + psf->datalength = psf->filelength - psf->dataoffset ; + if (psf->dataend) + psf->datalength -= psf->filelength - psf->dataend ; + + psf->sf.frames = psf->datalength / (psf->bytewidth * psf->sf.channels) ; + } ; + + encoding = au_format_to_encoding (psf->sf.format & SF_FORMAT_SUBMASK) ; + if (! encoding) + return (psf->error = SFE_BAD_OPEN_FORMAT) ; + + /* Reset the current header length to zero. */ + psf->header [0] = 0 ; + psf->headindex = 0 ; + + /* + ** Only attempt to seek if we are not writng to a pipe. If we are + ** writing to a pipe we shouldn't be here anyway. + */ + if (psf->is_pipe == SF_FALSE) + psf_fseek (psf, 0, SEEK_SET) ; + + /* + ** AU format files allow a datalength value of -1 if the datalength + ** is not know at the time the header is written. + ** Also use this value of -1 if the datalength > 2 gigabytes. + */ + if (psf->datalength < 0 || psf->datalength > 0x7FFFFFFF) + datalength = -1 ; + else + datalength = (int) (psf->datalength & 0x7FFFFFFF) ; + + if (psf->endian == SF_ENDIAN_BIG) + { psf_binheader_writef (psf, "Em4", DOTSND_MARKER, AU_DATA_OFFSET) ; + psf_binheader_writef (psf, "E4444", datalength, encoding, psf->sf.samplerate, psf->sf.channels) ; + } + else if (psf->endian == SF_ENDIAN_LITTLE) + { psf_binheader_writef (psf, "em4", DNSDOT_MARKER, AU_DATA_OFFSET) ; + psf_binheader_writef (psf, "e4444", datalength, encoding, psf->sf.samplerate, psf->sf.channels) ; + } + else + return (psf->error = SFE_BAD_OPEN_FORMAT) ; + + /* Header construction complete so write it out. */ + psf_fwrite (psf->header, psf->headindex, 1, psf) ; + + if (psf->error) + return psf->error ; + + psf->dataoffset = psf->headindex ; + + if (current > 0) + psf_fseek (psf, current, SEEK_SET) ; + + return psf->error ; +} /* au_write_header */ + +static int +au_format_to_encoding (int format) +{ + switch (format) + { case SF_FORMAT_PCM_S8 : return AU_ENCODING_PCM_8 ; + case SF_FORMAT_PCM_16 : return AU_ENCODING_PCM_16 ; + case SF_FORMAT_PCM_24 : return AU_ENCODING_PCM_24 ; + case SF_FORMAT_PCM_32 : return AU_ENCODING_PCM_32 ; + + case SF_FORMAT_FLOAT : return AU_ENCODING_FLOAT ; + case SF_FORMAT_DOUBLE : return AU_ENCODING_DOUBLE ; + + case SF_FORMAT_ULAW : return AU_ENCODING_ULAW_8 ; + case SF_FORMAT_ALAW : return AU_ENCODING_ALAW_8 ; + + case SF_FORMAT_G721_32 : return AU_ENCODING_ADPCM_G721_32 ; + case SF_FORMAT_G723_24 : return AU_ENCODING_ADPCM_G723_24 ; + case SF_FORMAT_G723_40 : return AU_ENCODING_ADPCM_G723_40 ; + + default : break ; + } ; + return 0 ; +} /* au_format_to_encoding */ + +static int +au_read_header (SF_PRIVATE *psf) +{ AU_FMT au_fmt ; + int marker, dword ; + + psf_binheader_readf (psf, "pm", 0, &marker) ; + psf_log_printf (psf, "%M\n", marker) ; + + if (marker == DOTSND_MARKER) + { psf->endian = SF_ENDIAN_BIG ; + + psf_binheader_readf (psf, "E44444", &(au_fmt.dataoffset), &(au_fmt.datasize), + &(au_fmt.encoding), &(au_fmt.samplerate), &(au_fmt.channels)) ; + } + else if (marker == DNSDOT_MARKER) + { psf->endian = SF_ENDIAN_LITTLE ; + psf_binheader_readf (psf, "e44444", &(au_fmt.dataoffset), &(au_fmt.datasize), + &(au_fmt.encoding), &(au_fmt.samplerate), &(au_fmt.channels)) ; + } + else + return SFE_AU_NO_DOTSND ; + + psf_log_printf (psf, " Data Offset : %d\n", au_fmt.dataoffset) ; + + if (psf->fileoffset > 0 && au_fmt.datasize == -1) + { psf_log_printf (psf, " Data Size : -1\n") ; + return SFE_AU_EMBED_BAD_LEN ; + } ; + + if (psf->fileoffset > 0) + { psf->filelength = au_fmt.dataoffset + au_fmt.datasize ; + psf_log_printf (psf, " Data Size : %d\n", au_fmt.datasize) ; + } + else if (au_fmt.datasize == -1 || au_fmt.dataoffset + au_fmt.datasize == psf->filelength) + psf_log_printf (psf, " Data Size : %d\n", au_fmt.datasize) ; + else if (au_fmt.dataoffset + au_fmt.datasize < psf->filelength) + { psf->filelength = au_fmt.dataoffset + au_fmt.datasize ; + psf_log_printf (psf, " Data Size : %d\n", au_fmt.datasize) ; + } + else + { dword = psf->filelength - au_fmt.dataoffset ; + psf_log_printf (psf, " Data Size : %d (should be %d)\n", au_fmt.datasize, dword) ; + au_fmt.datasize = dword ; + } ; + + psf->dataoffset = au_fmt.dataoffset ; + psf->datalength = psf->filelength - psf->dataoffset ; + + if (psf_ftell (psf) < psf->dataoffset) + psf_binheader_readf (psf, "j", psf->dataoffset - psf_ftell (psf)) ; + + psf->close = au_close ; + + psf->sf.samplerate = au_fmt.samplerate ; + psf->sf.channels = au_fmt.channels ; + + /* Only fill in type major. */ + if (psf->endian == SF_ENDIAN_BIG) + psf->sf.format = SF_FORMAT_AU ; + else if (psf->endian == SF_ENDIAN_LITTLE) + psf->sf.format = SF_ENDIAN_LITTLE | SF_FORMAT_AU ; + + psf_log_printf (psf, " Encoding : %d => ", au_fmt.encoding) ; + + psf->sf.format = psf->sf.format & SF_FORMAT_ENDMASK ; + + switch (au_fmt.encoding) + { case AU_ENCODING_ULAW_8 : + psf->sf.format |= SF_FORMAT_AU | SF_FORMAT_ULAW ; + psf->bytewidth = 1 ; /* Before decoding */ + psf_log_printf (psf, "8-bit ISDN u-law\n") ; + break ; + + case AU_ENCODING_PCM_8 : + psf->sf.format |= SF_FORMAT_AU | SF_FORMAT_PCM_S8 ; + psf->bytewidth = 1 ; + psf_log_printf (psf, "8-bit linear PCM\n") ; + break ; + + case AU_ENCODING_PCM_16 : + psf->sf.format |= SF_FORMAT_AU | SF_FORMAT_PCM_16 ; + psf->bytewidth = 2 ; + psf_log_printf (psf, "16-bit linear PCM\n") ; + break ; + + case AU_ENCODING_PCM_24 : + psf->sf.format |= SF_FORMAT_AU | SF_FORMAT_PCM_24 ; + psf->bytewidth = 3 ; + psf_log_printf (psf, "24-bit linear PCM\n") ; + break ; + + case AU_ENCODING_PCM_32 : + psf->sf.format |= SF_FORMAT_AU | SF_FORMAT_PCM_32 ; + psf->bytewidth = 4 ; + psf_log_printf (psf, "32-bit linear PCM\n") ; + break ; + + case AU_ENCODING_FLOAT : + psf->sf.format |= SF_FORMAT_AU | SF_FORMAT_FLOAT ; + psf->bytewidth = 4 ; + psf_log_printf (psf, "32-bit float\n") ; + break ; + + case AU_ENCODING_DOUBLE : + psf->sf.format |= SF_FORMAT_AU | SF_FORMAT_DOUBLE ; + psf->bytewidth = 8 ; + psf_log_printf (psf, "64-bit double precision float\n") ; + break ; + + case AU_ENCODING_ALAW_8 : + psf->sf.format |= SF_FORMAT_AU | SF_FORMAT_ALAW ; + psf->bytewidth = 1 ; /* Before decoding */ + psf_log_printf (psf, "8-bit ISDN A-law\n") ; + break ; + + case AU_ENCODING_ADPCM_G721_32 : + psf->sf.format |= SF_FORMAT_AU | SF_FORMAT_G721_32 ; + psf->bytewidth = 0 ; + psf_log_printf (psf, "G721 32kbs ADPCM\n") ; + break ; + + case AU_ENCODING_ADPCM_G723_24 : + psf->sf.format |= SF_FORMAT_AU | SF_FORMAT_G723_24 ; + psf->bytewidth = 0 ; + psf_log_printf (psf, "G723 24kbs ADPCM\n") ; + break ; + + case AU_ENCODING_ADPCM_G723_40 : + psf->sf.format |= SF_FORMAT_AU | SF_FORMAT_G723_40 ; + psf->bytewidth = 0 ; + psf_log_printf (psf, "G723 40kbs ADPCM\n") ; + break ; + + case AU_ENCODING_ADPCM_G722 : + psf_log_printf (psf, "G722 64 kbs ADPCM (unsupported)\n") ; + break ; + + case AU_ENCODING_NEXT : + psf_log_printf (psf, "Weird NeXT encoding format (unsupported)\n") ; + break ; + + default : + psf_log_printf (psf, "Unknown!!\n") ; + break ; + } ; + + psf_log_printf (psf, " Sample Rate : %d\n", au_fmt.samplerate) ; + psf_log_printf (psf, " Channels : %d\n", au_fmt.channels) ; + + psf->blockwidth = psf->sf.channels * psf->bytewidth ; + + if (! psf->sf.frames && psf->blockwidth) + psf->sf.frames = (psf->filelength - psf->dataoffset) / psf->blockwidth ; + + return 0 ; +} /* au_read_header */ +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: 31f691b1-cde9-4ed2-9469-6bca60fb9cd0 +*/ diff --git a/Libraries/SndFile/Files/src/au.h b/Libraries/SndFile/Files/src/au.h new file mode 100644 index 000000000..36a850468 --- /dev/null +++ b/Libraries/SndFile/Files/src/au.h @@ -0,0 +1,39 @@ +/* +** Copyright (C) 1999-2004 Erik de Castro Lopo +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU Lesser General Public License as published by +** the Free Software Foundation; either version 2.1 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU Lesser General Public License for more details. +** +** You should have received a copy of the GNU Lesser General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#ifndef AU_HEADER_FILE +#define AU_HEADER_FILE + + +enum +{ AU_H_G721_32 = 200, + AU_H_G723_24 = 201, + AU_H_G723_40 = 202 +} ; + +int au_g72x_reader_init (SF_PRIVATE *psf, int codec) ; +int au_g72x_writer_init (SF_PRIVATE *psf, int codec) ; + +#endif /* AU_HEADER_FILE */ +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: 63affc81-e204-4468-9705-60abe4d10689 +*/ diff --git a/Libraries/SndFile/Files/src/au_g72x.c b/Libraries/SndFile/Files/src/au_g72x.c new file mode 100644 index 000000000..cec76dc68 --- /dev/null +++ b/Libraries/SndFile/Files/src/au_g72x.c @@ -0,0 +1,634 @@ +/* +** Copyright (C) 1999-2004 Erik de Castro Lopo +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU Lesser General Public License as published by +** the Free Software Foundation; either version 2.1 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU Lesser General Public License for more details. +** +** You should have received a copy of the GNU Lesser General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include "config.h" + +#include +#include +#include + +#include "sndfile.h" +#include "sfendian.h" +#include "float_cast.h" +#include "common.h" +#include "au.h" +#include "G72x/g72x.h" + +static int au_g72x_read_block (SF_PRIVATE *psf, G72x_DATA *pg72x, short *ptr, int len) ; +static int au_g72x_write_block (SF_PRIVATE *psf, G72x_DATA *pg72x, short *ptr, int len) ; + +static int au_g72x_decode_block (SF_PRIVATE *psf, G72x_DATA *pg72x) ; +static int au_g72x_encode_block (SF_PRIVATE *psf, G72x_DATA *pg72x) ; + +static sf_count_t au_g72x_read_s (SF_PRIVATE *psf, short *ptr, sf_count_t len) ; +static sf_count_t au_g72x_read_i (SF_PRIVATE *psf, int *ptr, sf_count_t len) ; +static sf_count_t au_g72x_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ; +static sf_count_t au_g72x_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ; + +static sf_count_t au_g72x_write_s (SF_PRIVATE *psf, short *ptr, sf_count_t len) ; +static sf_count_t au_g72x_write_i (SF_PRIVATE *psf, int *ptr, sf_count_t len) ; +static sf_count_t au_g72x_write_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ; +static sf_count_t au_g72x_write_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ; + +static sf_count_t au_g72x_seek (SF_PRIVATE *psf, int mode, sf_count_t offset) ; + +static int au_g72x_close (SF_PRIVATE *psf) ; + + +/*============================================================================================ +** WAV G721 Reader initialisation function. +*/ + +int +au_g72x_reader_init (SF_PRIVATE *psf, int codec) +{ G72x_DATA *pg72x ; + int bitspersample ; + + psf->sf.seekable = SF_FALSE ; + + if (psf->sf.channels != 1) + return SFE_G72X_NOT_MONO ; + + if (! (pg72x = malloc (sizeof (G72x_DATA)))) + return SFE_MALLOC_FAILED ; + + psf->fdata = (void*) pg72x ; + + pg72x->blockcount = 0 ; + pg72x->samplecount = 0 ; + + switch (codec) + { case AU_H_G721_32 : + g72x_reader_init (pg72x, G721_32_BITS_PER_SAMPLE) ; + pg72x->bytesperblock = G721_32_BYTES_PER_BLOCK ; + bitspersample = G721_32_BITS_PER_SAMPLE ; + break ; + + case AU_H_G723_24: + g72x_reader_init (pg72x, G723_24_BITS_PER_SAMPLE) ; + pg72x->bytesperblock = G723_24_BYTES_PER_BLOCK ; + bitspersample = G723_24_BITS_PER_SAMPLE ; + break ; + + case AU_H_G723_40: + g72x_reader_init (pg72x, G723_40_BITS_PER_SAMPLE) ; + pg72x->bytesperblock = G723_40_BYTES_PER_BLOCK ; + bitspersample = G723_40_BITS_PER_SAMPLE ; + break ; + + default : return SFE_UNIMPLEMENTED ; + } ; + + psf->read_short = au_g72x_read_s ; + psf->read_int = au_g72x_read_i ; + psf->read_float = au_g72x_read_f ; + psf->read_double = au_g72x_read_d ; + + psf->seek = au_g72x_seek ; + psf->close = au_g72x_close ; + + psf->blockwidth = psf->bytewidth = 1 ; + + psf->filelength = psf_get_filelen (psf) ; + psf->datalength = psf->filelength - psf->dataoffset ; + + if (psf->datalength % pg72x->blocksize) + pg72x->blocks = (psf->datalength / pg72x->blocksize) + 1 ; + else + pg72x->blocks = psf->datalength / pg72x->blocksize ; + + psf->sf.frames = (8 * psf->datalength) / bitspersample ; + + if ((psf->sf.frames * bitspersample) / 8 != psf->datalength) + psf_log_printf (psf, "*** Warning : weird psf->datalength.\n") ; + + au_g72x_decode_block (psf, pg72x) ; + + return 0 ; +} /* au_g72x_reader_init */ + +/*============================================================================================ +** WAV G721 writer initialisation function. +*/ + +int +au_g72x_writer_init (SF_PRIVATE *psf, int codec) +{ G72x_DATA *pg72x ; + int bitspersample ; + + psf->sf.seekable = SF_FALSE ; + + if (psf->sf.channels != 1) + return SFE_G72X_NOT_MONO ; + + if (! (pg72x = malloc (sizeof (G72x_DATA)))) + return SFE_MALLOC_FAILED ; + + psf->fdata = (void*) pg72x ; + + pg72x->blockcount = 0 ; + pg72x->samplecount = 0 ; + + switch (codec) + { case AU_H_G721_32 : + g72x_writer_init (pg72x, G721_32_BITS_PER_SAMPLE) ; + pg72x->bytesperblock = G721_32_BYTES_PER_BLOCK ; + bitspersample = G721_32_BITS_PER_SAMPLE ; + break ; + + case AU_H_G723_24: + g72x_writer_init (pg72x, G723_24_BITS_PER_SAMPLE) ; + pg72x->bytesperblock = G723_24_BYTES_PER_BLOCK ; + bitspersample = G723_24_BITS_PER_SAMPLE ; + break ; + + case AU_H_G723_40: + g72x_writer_init (pg72x, G723_40_BITS_PER_SAMPLE) ; + pg72x->bytesperblock = G723_40_BYTES_PER_BLOCK ; + bitspersample = G723_40_BITS_PER_SAMPLE ; + break ; + + default : return SFE_UNIMPLEMENTED ; + } ; + + psf->write_short = au_g72x_write_s ; + psf->write_int = au_g72x_write_i ; + psf->write_float = au_g72x_write_f ; + psf->write_double = au_g72x_write_d ; + + psf->close = au_g72x_close ; + + psf->blockwidth = psf->bytewidth = 1 ; + + psf->filelength = psf_get_filelen (psf) ; + if (psf->filelength < psf->dataoffset) + psf->filelength = psf->dataoffset ; + + psf->datalength = psf->filelength - psf->dataoffset ; + + if (psf->datalength % pg72x->blocksize) + pg72x->blocks = (psf->datalength / pg72x->blocksize) + 1 ; + else + pg72x->blocks = psf->datalength / pg72x->blocksize ; + + if (psf->datalength > 0) + psf->sf.frames = (8 * psf->datalength) / bitspersample ; + + if ((psf->sf.frames * bitspersample) / 8 != psf->datalength) + psf_log_printf (psf, "*** Warning : weird psf->datalength.\n") ; + + return 0 ; +} /* au_g72x_writer_init */ + +/*============================================================================================ +** G721 Read Functions. +*/ + +static int +au_g72x_decode_block (SF_PRIVATE *psf, G72x_DATA *pg72x) +{ int k ; + + pg72x->blockcount ++ ; + pg72x->samplecount = 0 ; + + if (pg72x->samplecount > pg72x->blocksize) + { memset (pg72x->samples, 0, G72x_BLOCK_SIZE * sizeof (short)) ; + return 1 ; + } ; + + if ((k = psf_fread (pg72x->block, 1, pg72x->bytesperblock, psf)) != pg72x->bytesperblock) + psf_log_printf (psf, "*** Warning : short read (%d != %d).\n", k, pg72x->bytesperblock) ; + + pg72x->blocksize = k ; + g72x_decode_block (pg72x) ; + + return 1 ; +} /* au_g72x_decode_block */ + +static int +au_g72x_read_block (SF_PRIVATE *psf, G72x_DATA *pg72x, short *ptr, int len) +{ int count, total = 0, indx = 0 ; + + while (indx < len) + { if (pg72x->blockcount >= pg72x->blocks && pg72x->samplecount >= pg72x->samplesperblock) + { memset (&(ptr [indx]), 0, (len - indx) * sizeof (short)) ; + return total ; + } ; + + if (pg72x->samplecount >= pg72x->samplesperblock) + au_g72x_decode_block (psf, pg72x) ; + + count = pg72x->samplesperblock - pg72x->samplecount ; + count = (len - indx > count) ? count : len - indx ; + + memcpy (&(ptr [indx]), &(pg72x->samples [pg72x->samplecount]), count * sizeof (short)) ; + indx += count ; + pg72x->samplecount += count ; + total = indx ; + } ; + + return total ; +} /* au_g72x_read_block */ + +static sf_count_t +au_g72x_read_s (SF_PRIVATE *psf, short *ptr, sf_count_t len) +{ G72x_DATA *pg72x ; + int readcount, count ; + sf_count_t total = 0 ; + + if (! psf->fdata) + return 0 ; + pg72x = (G72x_DATA*) psf->fdata ; + + while (len > 0) + { readcount = (len > 0x10000000) ? 0x10000000 : (int) len ; + + count = au_g72x_read_block (psf, pg72x, ptr, readcount) ; + + total += count ; + len -= count ; + + if (count != readcount) + break ; + } ; + + return total ; +} /* au_g72x_read_s */ + +static sf_count_t +au_g72x_read_i (SF_PRIVATE *psf, int *ptr, sf_count_t len) +{ G72x_DATA *pg72x ; + short *sptr ; + int k, bufferlen, readcount = 0, count ; + sf_count_t total = 0 ; + + if (! psf->fdata) + return 0 ; + pg72x = (G72x_DATA*) psf->fdata ; + + sptr = psf->u.sbuf ; + bufferlen = SF_BUFFER_LEN / sizeof (short) ; + while (len > 0) + { readcount = (len >= bufferlen) ? bufferlen : len ; + count = au_g72x_read_block (psf, pg72x, sptr, readcount) ; + + for (k = 0 ; k < readcount ; k++) + ptr [total + k] = sptr [k] << 16 ; + + total += count ; + len -= readcount ; + if (count != readcount) + break ; + } ; + + return total ; +} /* au_g72x_read_i */ + +static sf_count_t +au_g72x_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) +{ G72x_DATA *pg72x ; + short *sptr ; + int k, bufferlen, readcount = 0, count ; + sf_count_t total = 0 ; + float normfact ; + + if (! psf->fdata) + return 0 ; + pg72x = (G72x_DATA*) psf->fdata ; + + normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x8000) : 1.0 ; + + sptr = psf->u.sbuf ; + bufferlen = SF_BUFFER_LEN / sizeof (short) ; + while (len > 0) + { readcount = (len >= bufferlen) ? bufferlen : len ; + count = au_g72x_read_block (psf, pg72x, sptr, readcount) ; + for (k = 0 ; k < readcount ; k++) + ptr [total + k] = normfact * sptr [k] ; + + total += count ; + len -= readcount ; + if (count != readcount) + break ; + } ; + + return total ; +} /* au_g72x_read_f */ + +static sf_count_t +au_g72x_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) +{ G72x_DATA *pg72x ; + short *sptr ; + int k, bufferlen, readcount = 0, count ; + sf_count_t total = 0 ; + double normfact ; + + if (! psf->fdata) + return 0 ; + pg72x = (G72x_DATA*) psf->fdata ; + + normfact = (psf->norm_double == SF_TRUE) ? 1.0 / ((double) 0x8000) : 1.0 ; + + sptr = psf->u.sbuf ; + bufferlen = SF_BUFFER_LEN / sizeof (short) ; + while (len > 0) + { readcount = (len >= bufferlen) ? bufferlen : len ; + count = au_g72x_read_block (psf, pg72x, sptr, readcount) ; + for (k = 0 ; k < readcount ; k++) + ptr [total + k] = normfact * (double) (sptr [k]) ; + + total += count ; + len -= readcount ; + if (count != readcount) + break ; + } ; + + return total ; +} /* au_g72x_read_d */ + +static sf_count_t +au_g72x_seek (SF_PRIVATE *psf, int mode, sf_count_t offset) +{ + /* Prevent compiler warnings. */ + mode ++ ; + offset ++ ; + + psf_log_printf (psf, "seek unsupported\n") ; + + /* No simple solution. To do properly, would need to seek + ** to start of file and decode everything up to seek position. + ** Maybe implement SEEK_SET to 0 only? + */ + return 0 ; + +/* +** G72x_DATA *pg72x ; +** int newblock, newsample, samplecount ; +** +** if (! psf->fdata) +** return 0 ; +** pg72x = (G72x_DATA*) psf->fdata ; +** +** if (! (psf->datalength && psf->dataoffset)) +** { psf->error = SFE_BAD_SEEK ; +** return ((sf_count_t) -1) ; +** } ; +** +** samplecount = (8 * psf->datalength) / G721_32_BITS_PER_SAMPLE ; +** +** switch (whence) +** { case SEEK_SET : +** if (offset < 0 || offset > samplecount) +** { psf->error = SFE_BAD_SEEK ; +** return ((sf_count_t) -1) ; +** } ; +** newblock = offset / pg72x->samplesperblock ; +** newsample = offset % pg72x->samplesperblock ; +** break ; +** +** case SEEK_CUR : +** if (psf->current + offset < 0 || psf->current + offset > samplecount) +** { psf->error = SFE_BAD_SEEK ; +** return ((sf_count_t) -1) ; +** } ; +** newblock = (8 * (psf->current + offset)) / pg72x->samplesperblock ; +** newsample = (8 * (psf->current + offset)) % pg72x->samplesperblock ; +** break ; +** +** case SEEK_END : +** if (offset > 0 || samplecount + offset < 0) +** { psf->error = SFE_BAD_SEEK ; +** return ((sf_count_t) -1) ; +** } ; +** newblock = (samplecount + offset) / pg72x->samplesperblock ; +** newsample = (samplecount + offset) % pg72x->samplesperblock ; +** break ; +** +** default : +** psf->error = SFE_BAD_SEEK ; +** return ((sf_count_t) -1) ; +** } ; +** +** if (psf->mode == SFM_READ) +** { psf_fseek (psf, psf->dataoffset + newblock * pg72x->blocksize, SEEK_SET) ; +** pg72x->blockcount = newblock ; +** au_g72x_decode_block (psf, pg72x) ; +** pg72x->samplecount = newsample ; +** } +** else +** { /+* What to do about write??? *+/ +** psf->error = SFE_BAD_SEEK ; +** return ((sf_count_t) -1) ; +** } ; +** +** psf->current = newblock * pg72x->samplesperblock + newsample ; +** return psf->current ; +** +*/ +} /* au_g72x_seek */ + +/*========================================================================================== +** G72x Write Functions. +*/ + +static int +au_g72x_encode_block (SF_PRIVATE *psf, G72x_DATA *pg72x) +{ int k ; + + /* Encode the samples. */ + g72x_encode_block (pg72x) ; + + /* Write the block to disk. */ + if ((k = psf_fwrite (pg72x->block, 1, pg72x->blocksize, psf)) != pg72x->blocksize) + psf_log_printf (psf, "*** Warning : short write (%d != %d).\n", k, pg72x->blocksize) ; + + pg72x->samplecount = 0 ; + pg72x->blockcount ++ ; + + /* Set samples to zero for next block. */ + memset (pg72x->samples, 0, G72x_BLOCK_SIZE * sizeof (short)) ; + + return 1 ; +} /* au_g72x_encode_block */ + +static int +au_g72x_write_block (SF_PRIVATE *psf, G72x_DATA *pg72x, short *ptr, int len) +{ int count, total = 0, indx = 0 ; + + while (indx < len) + { count = pg72x->samplesperblock - pg72x->samplecount ; + + if (count > len - indx) + count = len - indx ; + + memcpy (&(pg72x->samples [pg72x->samplecount]), &(ptr [indx]), count * sizeof (short)) ; + indx += count ; + pg72x->samplecount += count ; + total = indx ; + + if (pg72x->samplecount >= pg72x->samplesperblock) + au_g72x_encode_block (psf, pg72x) ; + } ; + + return total ; +} /* au_g72x_write_block */ + +static sf_count_t +au_g72x_write_s (SF_PRIVATE *psf, short *ptr, sf_count_t len) +{ G72x_DATA *pg72x ; + int writecount, count ; + sf_count_t total = 0 ; + + if (! psf->fdata) + return 0 ; + pg72x = (G72x_DATA*) psf->fdata ; + + while (len > 0) + { writecount = (len > 0x10000000) ? 0x10000000 : (int) len ; + + count = au_g72x_write_block (psf, pg72x, ptr, writecount) ; + + total += count ; + len -= count ; + if (count != writecount) + break ; + } ; + + return total ; +} /* au_g72x_write_s */ + +static sf_count_t +au_g72x_write_i (SF_PRIVATE *psf, int *ptr, sf_count_t len) +{ G72x_DATA *pg72x ; + short *sptr ; + int k, bufferlen, writecount = 0, count ; + sf_count_t total = 0 ; + + if (! psf->fdata) + return 0 ; + pg72x = (G72x_DATA*) psf->fdata ; + + sptr = psf->u.sbuf ; + bufferlen = ((SF_BUFFER_LEN / psf->blockwidth) * psf->blockwidth) / sizeof (short) ; + while (len > 0) + { writecount = (len >= bufferlen) ? bufferlen : len ; + for (k = 0 ; k < writecount ; k++) + sptr [k] = ptr [total + k] >> 16 ; + count = au_g72x_write_block (psf, pg72x, sptr, writecount) ; + + total += count ; + len -= writecount ; + if (count != writecount) + break ; + } ; + return total ; +} /* au_g72x_write_i */ + +static sf_count_t +au_g72x_write_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) +{ G72x_DATA *pg72x ; + short *sptr ; + int k, bufferlen, writecount = 0, count ; + sf_count_t total = 0 ; + float normfact ; + + if (! psf->fdata) + return 0 ; + pg72x = (G72x_DATA*) psf->fdata ; + + normfact = (psf->norm_float == SF_TRUE) ? (1.0 * 0x8000) : 1.0 ; + + sptr = psf->u.sbuf ; + bufferlen = ((SF_BUFFER_LEN / psf->blockwidth) * psf->blockwidth) / sizeof (short) ; + while (len > 0) + { writecount = (len >= bufferlen) ? bufferlen : len ; + for (k = 0 ; k < writecount ; k++) + sptr [k] = lrintf (normfact * ptr [total + k]) ; + count = au_g72x_write_block (psf, pg72x, sptr, writecount) ; + + total += count ; + len -= writecount ; + if (count != writecount) + break ; + } ; + + return total ; +} /* au_g72x_write_f */ + +static sf_count_t +au_g72x_write_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) +{ G72x_DATA *pg72x ; + short *sptr ; + int k, bufferlen, writecount = 0, count ; + sf_count_t total = 0 ; + double normfact ; + + if (! psf->fdata) + return 0 ; + pg72x = (G72x_DATA*) psf->fdata ; + + normfact = (psf->norm_double == SF_TRUE) ? (1.0 * 0x8000) : 1.0 ; + + sptr = psf->u.sbuf ; + bufferlen = ((SF_BUFFER_LEN / psf->blockwidth) * psf->blockwidth) / sizeof (short) ; + while (len > 0) + { writecount = (len >= bufferlen) ? bufferlen : len ; + for (k = 0 ; k < writecount ; k++) + sptr [k] = lrint (normfact * ptr [total + k]) ; + count = au_g72x_write_block (psf, pg72x, sptr, writecount) ; + + total += count ; + len -= writecount ; + if (count != writecount) + break ; + } ; + + return total ; +} /* au_g72x_write_d */ + +static int +au_g72x_close (SF_PRIVATE *psf) +{ G72x_DATA *pg72x ; + + if (! psf->fdata) + return 0 ; + + pg72x = (G72x_DATA*) psf->fdata ; + + if (psf->mode == SFM_WRITE) + { /* If a block has been partially assembled, write it out + ** as the final block. + */ + + if (pg72x->samplecount && pg72x->samplecount < G72x_BLOCK_SIZE) + au_g72x_encode_block (psf, pg72x) ; + + if (psf->write_header) + psf->write_header (psf, SF_FALSE) ; + } ; + + return 0 ; +} /* au_g72x_close */ + +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: 3cc5439e-7247-486b-b2e6-11a4affa5744 +*/ diff --git a/Libraries/SndFile/Files/src/avr.c b/Libraries/SndFile/Files/src/avr.c new file mode 100644 index 000000000..39a15878c --- /dev/null +++ b/Libraries/SndFile/Files/src/avr.c @@ -0,0 +1,262 @@ +/* +** Copyright (C) 2004 Erik de Castro Lopo +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU Lesser General Public License as published by +** the Free Software Foundation; either version 2.1 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU Lesser General Public License for more details. +** +** You should have received a copy of the GNU Lesser General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include "config.h" + +#include +#include + +#include "sndfile.h" +#include "sfendian.h" +#include "common.h" + +#define TWOBIT_MARKER (MAKE_MARKER ('2', 'B', 'I', 'T')) +#define AVR_HDR_SIZE 128 + +#define SFE_AVR_X 666 + +/* +** From: hyc@hanauma.Jpl.Nasa.Gov (Howard Chu) +** +** A lot of PD software exists to play Mac .snd files on the ST. One other +** format that seems pretty popular (used by a number of commercial packages) +** is the AVR format (from Audio Visual Research). This format has a 128 byte +** header that looks like this (its actually packed, but thats not portable): +*/ + +typedef struct +{ int marker ; /* 2BIT */ + char name [8] ; /* null-padded sample name */ + short mono ; /* 0 = mono, 0xffff = stereo */ + short rez ; /* 8 = 8 bit, 16 = 16 bit */ + short sign ; /* 0 = unsigned, 0xffff = signed */ + + short loop ; /* 0 = no loop, 0xffff = looping sample */ + short midi ; /* 0xffff = no MIDI note assigned, */ + /* 0xffXX = single key note assignment */ + /* 0xLLHH = key split, low/hi note */ + int srate ; /* sample frequency in hertz */ + int frames ; /* sample length in bytes or words (see rez) */ + int lbeg ; /* offset to start of loop in bytes or words. */ + /* set to zero if unused */ + int lend ; /* offset to end of loop in bytes or words. */ + /* set to sample length if unused */ + short res1 ; /* Reserved, MIDI keyboard split */ + short res2 ; /* Reserved, sample compression */ + short res3 ; /* Reserved */ + char ext [20] ; /* Additional filename space, used if (name[7] != 0) */ + char user [64] ; /* User defined. Typically ASCII message */ +} AVR_HEADER ; + +/*------------------------------------------------------------------------------ +** Private static functions. +*/ + +static int avr_close (SF_PRIVATE *psf) ; + +static int avr_read_header (SF_PRIVATE *psf) ; +static int avr_write_header (SF_PRIVATE *psf, int calc_length) ; + +/*------------------------------------------------------------------------------ +** Public function. +*/ + +int +avr_open (SF_PRIVATE *psf) +{ int subformat ; + int error = 0 ; + + if (psf->mode == SFM_READ || (psf->mode == SFM_RDWR && psf->filelength > 0)) + { if ((error = avr_read_header (psf))) + return error ; + } ; + + if ((psf->sf.format & SF_FORMAT_TYPEMASK) != SF_FORMAT_AVR) + return SFE_BAD_OPEN_FORMAT ; + + subformat = psf->sf.format & SF_FORMAT_SUBMASK ; + + if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR) + { psf->endian = psf->sf.format & SF_FORMAT_ENDMASK ; + psf->endian = SF_ENDIAN_BIG ; + + if (avr_write_header (psf, SF_FALSE)) + return psf->error ; + + psf->write_header = avr_write_header ; + } ; + + psf->close = avr_close ; + + psf->blockwidth = psf->bytewidth * psf->sf.channels ; + + error = pcm_init (psf) ; + + return error ; +} /* avr_open */ + +static int +avr_read_header (SF_PRIVATE *psf) +{ AVR_HEADER hdr ; + + memset (&hdr, 0, sizeof (hdr)) ; + + psf_binheader_readf (psf, "pmb", 0, &hdr.marker, &hdr.name, sizeof (hdr.name)) ; + psf_log_printf (psf, "%M\n", hdr.marker) ; + + if (hdr.marker != TWOBIT_MARKER) + return SFE_AVR_X ; + + psf_log_printf (psf, " Name : %s\n", hdr.name) ; + + psf_binheader_readf (psf, "E22222", &hdr.mono, &hdr.rez, &hdr.sign, &hdr.loop, &hdr.midi) ; + + psf->sf.channels = (hdr.mono & 1) + 1 ; + + psf_log_printf (psf, " Channels : %d\n Bit width : %d\n Signed : %s\n", + (hdr.mono & 1) + 1, hdr.rez, hdr.sign ? "yes" : "no") ; + + switch ((hdr.rez << 16) + (hdr.sign & 1)) + { case ((8 << 16) + 0) : + psf->sf.format = SF_FORMAT_AVR | SF_FORMAT_PCM_U8 ; + psf->bytewidth = 1 ; + break ; + + case ((8 << 16) + 1) : + psf->sf.format = SF_FORMAT_AVR | SF_FORMAT_PCM_S8 ; + psf->bytewidth = 1 ; + break ; + + case ((16 << 16) + 1) : + psf->sf.format = SF_FORMAT_AVR | SF_FORMAT_PCM_16 ; + psf->bytewidth = 2 ; + break ; + + default : + psf_log_printf (psf, "Error : bad rez/sign combination.\n") ; + return SFE_AVR_X ; + break ; + } ; + + psf_binheader_readf (psf, "E4444", &hdr.srate, &hdr.frames, &hdr.lbeg, &hdr.lend) ; + + psf->sf.frames = hdr.frames ; + psf->sf.samplerate = hdr.srate ; + + psf_log_printf (psf, " Frames : %D\n", psf->sf.frames) ; + psf_log_printf (psf, " Sample rate : %d\n", psf->sf.samplerate) ; + + psf_binheader_readf (psf, "E222", &hdr.res1, &hdr.res2, &hdr.res3) ; + psf_binheader_readf (psf, "bb", hdr.ext, sizeof (hdr.ext), hdr.user, sizeof (hdr.user)) ; + + psf_log_printf (psf, " Ext : %s\n User : %s\n", hdr.ext, hdr.user) ; + + psf->endian = SF_ENDIAN_BIG ; + + psf->dataoffset = AVR_HDR_SIZE ; + psf->datalength = hdr.frames * (hdr.rez / 8) ; + + if (psf->fileoffset > 0) + psf->filelength = AVR_HDR_SIZE + psf->datalength ; + + if (psf_ftell (psf) != psf->dataoffset) + psf_binheader_readf (psf, "j", psf->dataoffset - psf_ftell (psf)) ; + + psf->close = avr_close ; + + psf->blockwidth = psf->sf.channels * psf->bytewidth ; + + if (psf->sf.frames == 0 && psf->blockwidth) + psf->sf.frames = (psf->filelength - psf->dataoffset) / psf->blockwidth ; + + return 0 ; +} /* avr_read_header */ + +static int +avr_write_header (SF_PRIVATE *psf, int calc_length) +{ sf_count_t current ; + int sign, datalength ; + + if (psf->pipeoffset > 0) + return 0 ; + + current = psf_ftell (psf) ; + + if (calc_length) + { psf->filelength = psf_get_filelen (psf) ; + + psf->datalength = psf->filelength - psf->dataoffset ; + if (psf->dataend) + psf->datalength -= psf->filelength - psf->dataend ; + + psf->sf.frames = psf->datalength / (psf->bytewidth * psf->sf.channels) ; + } ; + + /* Reset the current header length to zero. */ + psf->header [0] = 0 ; + psf->headindex = 0 ; + + /* + ** Only attempt to seek if we are not writng to a pipe. If we are + ** writing to a pipe we shouldn't be here anyway. + */ + if (psf->is_pipe == SF_FALSE) + psf_fseek (psf, 0, SEEK_SET) ; + + datalength = (int) (psf->datalength & 0x7FFFFFFF) ; + + psf_binheader_writef (psf, "Emz22", TWOBIT_MARKER, (size_t) 8, + psf->sf.channels == 2 ? 0xFFFF : 0, psf->bytewidth * 8) ; + + sign = ((psf->sf.format & SF_FORMAT_SUBMASK) == SF_FORMAT_PCM_U8) ? 0 : 0xFFFF ; + + psf_binheader_writef (psf, "E222", sign, 0, 0xFFFF) ; + psf_binheader_writef (psf, "E4444", psf->sf.samplerate, psf->sf.frames, 0, 0) ; + + psf_binheader_writef (psf, "E222zz", 0, 0, 0, (size_t) 20, (size_t) 64) ; + + /* Header construction complete so write it out. */ + psf_fwrite (psf->header, psf->headindex, 1, psf) ; + + if (psf->error) + return psf->error ; + + psf->dataoffset = psf->headindex ; + + if (current > 0) + psf_fseek (psf, current, SEEK_SET) ; + + return psf->error ; +} /* avr_write_header */ + +static int +avr_close (SF_PRIVATE *psf) +{ + if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR) + avr_write_header (psf, SF_TRUE) ; + + return 0 ; +} /* avr_close */ + +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: 0823d454-f39a-4a28-a776-607f1ef33b52 +*/ diff --git a/Libraries/SndFile/Files/src/command.c b/Libraries/SndFile/Files/src/command.c new file mode 100644 index 000000000..939e0fa2a --- /dev/null +++ b/Libraries/SndFile/Files/src/command.c @@ -0,0 +1,325 @@ +/* +** Copyright (C) 2001-2004 Erik de Castro Lopo +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU Lesser General Public License as published by +** the Free Software Foundation; either version 2.1 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU Lesser General Public License for more details. +** +** You should have received a copy of the GNU Lesser General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include +#include +#include + +#include "sndfile.h" +#include "config.h" +#include "common.h" + +static SF_FORMAT_INFO const simple_formats [] = +{ + { SF_FORMAT_AIFF | SF_FORMAT_PCM_16, + "AIFF (Apple/SGI 16 bit PCM)", "aiff" + }, + + { SF_FORMAT_AIFF | SF_FORMAT_FLOAT, + "AIFF (Apple/SGI 32 bit float)", "aifc" + }, + + { SF_FORMAT_AIFF | SF_FORMAT_PCM_S8, + "AIFF (Apple/SGI 8 bit PCM)", "aiff" + }, + + { SF_FORMAT_AU | SF_FORMAT_PCM_16, + "AU (Sun/Next 16 bit PCM)", "au" + }, + + { SF_FORMAT_AU | SF_FORMAT_ULAW, + "AU (Sun/Next 8-bit u-law)", "au" + }, + + { SF_FORMAT_RAW | SF_FORMAT_VOX_ADPCM, + "OKI Dialogic VOX ADPCM", "vox" + }, + + { SF_FORMAT_WAV | SF_FORMAT_PCM_16, + "WAV (Microsoft 16 bit PCM)", "wav" + }, + + { SF_FORMAT_WAV | SF_FORMAT_FLOAT, + "WAV (Microsoft 32 bit float)", "wav" + }, + + { SF_FORMAT_WAV | SF_FORMAT_IMA_ADPCM, + "WAV (Microsoft 4 bit IMA ADPCM)", "wav" + }, + + { SF_FORMAT_WAV | SF_FORMAT_MS_ADPCM, + "WAV (Microsoft 4 bit MS ADPCM)", "wav" + }, + + { SF_FORMAT_WAV | SF_FORMAT_PCM_U8, + "WAV (Microsoft 8 bit PCM)", "wav" + }, + +} ; /* simple_formats */ + +int +psf_get_format_simple_count (void) +{ return (sizeof (simple_formats) / sizeof (SF_FORMAT_INFO)) ; +} /* psf_get_format_simple_count */ + +int +psf_get_format_simple (SF_FORMAT_INFO *data) +{ int indx ; + + if (data->format < 0 || data->format >= (SIGNED_SIZEOF (simple_formats) / SIGNED_SIZEOF (SF_FORMAT_INFO))) + return SFE_BAD_CONTROL_CMD ; + + indx = data->format ; + memcpy (data, &(simple_formats [indx]), SIGNED_SIZEOF (SF_FORMAT_INFO)) ; + + return 0 ; +} /* psf_get_format_simple */ + +/*============================================================================ +** Major format info. +*/ + +static SF_FORMAT_INFO const major_formats [] = +{ + { SF_FORMAT_AIFF, "AIFF (Apple/SGI)", "aiff" }, + { SF_FORMAT_AU, "AU (Sun/NeXT)", "au" }, + { SF_FORMAT_AVR, "AVR (Audio Visual Research)", "avr" }, + { SF_FORMAT_HTK, "HTK (HMM Tool Kit)", "htk" }, + { SF_FORMAT_SVX, "IFF (Amiga IFF/SVX8/SV16)", "iff" }, + { SF_FORMAT_MAT4, "MAT4 (GNU Octave 2.0 / Matlab 4.2)", "mat" }, + { SF_FORMAT_MAT5, "MAT5 (GNU Octave 2.1 / Matlab 5.0)", "mat" }, + { SF_FORMAT_PAF, "PAF (Ensoniq PARIS)", "paf" }, + { SF_FORMAT_PVF, "PVF (Portable Voice Format)", "pvf" }, + { SF_FORMAT_RAW, "RAW (header-less)", "raw" }, + { SF_FORMAT_SDS, "SDS (Midi Sample Dump Standard)", "sds" }, + /* Not ready for mainstream use yet. + { SF_FORMAT_SD2, "SD2 (Sound Designer II)", "sd2" }, + */ + { SF_FORMAT_IRCAM, "SF (Berkeley/IRCAM/CARL)", "sf" }, + { SF_FORMAT_VOC, "VOC (Creative Labs)", "voc" }, + { SF_FORMAT_W64, "W64 (SoundFoundry WAVE 64)", "w64" }, + { SF_FORMAT_WAV, "WAV (Microsoft)", "wav" }, + { SF_FORMAT_NIST, "WAV (NIST Sphere)", "wav" }, + { SF_FORMAT_WAVEX, "WAVEX (Microsoft)", "wav" }, + { SF_FORMAT_XI, "XI (FastTracker 2)", "xi" }, + +} ; /* major_formats */ + +int +psf_get_format_major_count (void) +{ return (sizeof (major_formats) / sizeof (SF_FORMAT_INFO)) ; +} /* psf_get_format_major_count */ + +int +psf_get_format_major (SF_FORMAT_INFO *data) +{ int indx ; + + if (data->format < 0 || data->format >= (SIGNED_SIZEOF (major_formats) / SIGNED_SIZEOF (SF_FORMAT_INFO))) + return SFE_BAD_CONTROL_CMD ; + + indx = data->format ; + memcpy (data, &(major_formats [indx]), SIGNED_SIZEOF (SF_FORMAT_INFO)) ; + + return 0 ; +} /* psf_get_format_major */ + +/*============================================================================ +** Subtype format info. +*/ + +static SF_FORMAT_INFO subtype_formats [] = +{ + { SF_FORMAT_PCM_S8, "Signed 8 bit PCM", NULL }, + { SF_FORMAT_PCM_16, "Signed 16 bit PCM", NULL }, + { SF_FORMAT_PCM_24, "Signed 24 bit PCM", NULL }, + { SF_FORMAT_PCM_32, "Signed 32 bit PCM", NULL }, + + { SF_FORMAT_PCM_U8, "Unsigned 8 bit PCM", NULL }, + + { SF_FORMAT_FLOAT, "32 bit float", NULL }, + { SF_FORMAT_DOUBLE, "64 bit float", NULL }, + + { SF_FORMAT_ULAW, "U-Law", NULL }, + { SF_FORMAT_ALAW, "A-Law", NULL }, + { SF_FORMAT_IMA_ADPCM, "IMA ADPCM", NULL }, + { SF_FORMAT_MS_ADPCM, "Microsoft ADPCM", NULL }, + + { SF_FORMAT_GSM610, "GSM 6.10", NULL }, + + { SF_FORMAT_G721_32, "32kbs G721 ADPCM", NULL }, + { SF_FORMAT_G723_24, "24kbs G723 ADPCM", NULL }, + + { SF_FORMAT_DWVW_12, "12 bit DWVW", NULL }, + { SF_FORMAT_DWVW_16, "16 bit DWVW", NULL }, + { SF_FORMAT_DWVW_24, "24 bit DWVW", NULL }, + { SF_FORMAT_VOX_ADPCM, "VOX ADPCM", "vox" }, + + { SF_FORMAT_DPCM_16, "16 bit DPCM", NULL }, + { SF_FORMAT_DPCM_8, "8 bit DPCM", NULL }, +} ; /* subtype_formats */ + +int +psf_get_format_subtype_count (void) +{ return (sizeof (subtype_formats) / sizeof (SF_FORMAT_INFO)) ; +} /* psf_get_format_subtype_count */ + +int +psf_get_format_subtype (SF_FORMAT_INFO *data) +{ int indx ; + + if (data->format < 0 || data->format >= (SIGNED_SIZEOF (subtype_formats) / SIGNED_SIZEOF (SF_FORMAT_INFO))) + return SFE_BAD_CONTROL_CMD ; + + indx = data->format ; + memcpy (data, &(subtype_formats [indx]), sizeof (SF_FORMAT_INFO)) ; + + return 0 ; +} /* psf_get_format_subtype */ + +/*============================================================================== +*/ + +int +psf_get_format_info (SF_FORMAT_INFO *data) +{ int k, format ; + + if (data->format & SF_FORMAT_TYPEMASK) + { format = data->format & SF_FORMAT_TYPEMASK ; + + for (k = 0 ; k < (SIGNED_SIZEOF (major_formats) / SIGNED_SIZEOF (SF_FORMAT_INFO)) ; k++) + { if (format == major_formats [k].format) + { memcpy (data, &(major_formats [k]), sizeof (SF_FORMAT_INFO)) ; + return 0 ; + } ; + } ; + } + else if (data->format & SF_FORMAT_SUBMASK) + { format = data->format & SF_FORMAT_SUBMASK ; + + for (k = 0 ; k < (SIGNED_SIZEOF (subtype_formats) / SIGNED_SIZEOF (SF_FORMAT_INFO)) ; k++) + { if (format == subtype_formats [k].format) + { memcpy (data, &(subtype_formats [k]), sizeof (SF_FORMAT_INFO)) ; + return 0 ; + } ; + } ; + } ; + + memset (data, 0, sizeof (SF_FORMAT_INFO)) ; + + return SFE_BAD_CONTROL_CMD ; +} /* psf_get_format_info */ + +/*============================================================================== +*/ + +double +psf_calc_signal_max (SF_PRIVATE *psf, int normalize) +{ sf_count_t position ; + double max_val, temp, *data ; + int k, len, readcount, save_state ; + + /* If the file is not seekable, there is nothing we can do. */ + if (! psf->sf.seekable) + { psf->error = SFE_NOT_SEEKABLE ; + return 0.0 ; + } ; + + if (! psf->read_double) + { psf->error = SFE_UNIMPLEMENTED ; + return 0.0 ; + } ; + + save_state = sf_command ((SNDFILE*) psf, SFC_GET_NORM_DOUBLE, NULL, 0) ; + sf_command ((SNDFILE*) psf, SFC_SET_NORM_DOUBLE, NULL, normalize) ; + + /* Brute force. Read the whole file and find the biggest sample. */ + /* Get current position in file */ + position = sf_seek ((SNDFILE*) psf, 0, SEEK_CUR) ; + /* Go to start of file. */ + sf_seek ((SNDFILE*) psf, 0, SEEK_SET) ; + + data = psf->u.dbuf ; + len = ARRAY_LEN (psf->u.dbuf) ; + + for (readcount = 1, max_val = 0.0 ; readcount > 0 ; /* nothing */) + { readcount = sf_read_double ((SNDFILE*) psf, data, len) ; + for (k = 0 ; k < readcount ; k++) + { temp = fabs (data [k]) ; + max_val = temp > max_val ? temp : max_val ; + } ; + } ; + + /* Return to SNDFILE to original state. */ + sf_seek ((SNDFILE*) psf, position, SEEK_SET) ; + sf_command ((SNDFILE*) psf, SFC_SET_NORM_DOUBLE, NULL, save_state) ; + + return max_val ; +} /* psf_calc_signal_max */ + +int +psf_calc_max_all_channels (SF_PRIVATE *psf, double *peaks, int normalize) +{ sf_count_t position ; + double temp, *data ; + int k, len, readcount, save_state ; + int chan ; + + /* If the file is not seekable, there is nothing we can do. */ + if (! psf->sf.seekable) + return (psf->error = SFE_NOT_SEEKABLE) ; + + if (! psf->read_double) + return (psf->error = SFE_UNIMPLEMENTED) ; + + save_state = sf_command ((SNDFILE*) psf, SFC_GET_NORM_DOUBLE, NULL, 0) ; + sf_command ((SNDFILE*) psf, SFC_SET_NORM_DOUBLE, NULL, normalize) ; + + memset (peaks, 0, sizeof (double) * psf->sf.channels) ; + + /* Brute force. Read the whole file and find the biggest sample for each channel. */ + position = sf_seek ((SNDFILE*) psf, 0, SEEK_CUR) ; /* Get current position in file */ + sf_seek ((SNDFILE*) psf, 0, SEEK_SET) ; /* Go to start of file. */ + + len = ARRAY_LEN (psf->u.dbuf) ; + + data = psf->u.dbuf ; + + chan = 0 ; + readcount = len ; + while (readcount > 0) + { readcount = sf_read_double ((SNDFILE*) psf, data, len) ; + for (k = 0 ; k < readcount ; k++) + { temp = fabs (data [k]) ; + peaks [chan] = temp > peaks [chan] ? temp : peaks [chan] ; + chan = (chan + 1) % psf->sf.channels ; + } ; + } ; + + sf_seek ((SNDFILE*) psf, position, SEEK_SET) ; /* Return to original position. */ + + sf_command ((SNDFILE*) psf, SFC_SET_NORM_DOUBLE, NULL, save_state) ; + + return 0 ; +} /* psf_calc_max_all_channels */ + +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: 0aae0d9d-ab2b-4d70-ade3-47a534666f8e +*/ diff --git a/Libraries/SndFile/Files/src/common.c b/Libraries/SndFile/Files/src/common.c new file mode 100644 index 000000000..f03647879 --- /dev/null +++ b/Libraries/SndFile/Files/src/common.c @@ -0,0 +1,1188 @@ +/* +** Copyright (C) 1999-2004 Erik de Castro Lopo +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU Lesser General Public License as published by +** the Free Software Foundation; either version 2.1 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU Lesser General Public License for more details. +** +** You should have received a copy of the GNU Lesser General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include +#include +#include +#include +#include + +#include "sndfile.h" +#include "sfendian.h" +#include "common.h" + +/*----------------------------------------------------------------------------------------------- +** psf_log_printf allows libsndfile internal functions to print to an internal logbuffer which +** can later be displayed. +** The format specifiers are as for printf but without the field width and other modifiers. +** Printing is performed to the logbuffer char array of the SF_PRIVATE struct. +** Printing is done in such a way as to guarantee that the log never overflows the end of the +** logbuffer array. +*/ + +#define LOG_PUTCHAR(a,b) \ + { if ((a)->logindex < SIGNED_SIZEOF ((a)->logbuffer) - 1) \ + { (a)->logbuffer [(a)->logindex++] = (b) ; \ + (a)->logbuffer [(a)->logindex] = 0 ; \ + } \ + } + +void +psf_log_printf (SF_PRIVATE *psf, const char *format, ...) +{ va_list ap ; + unsigned int u ; + int d, tens, shift, width, width_specifier, left_align ; + char c, *strptr, istr [5], lead_char, sign_char ; + + va_start (ap, format) ; + + while ((c = *format++)) + { if (c != '%') + { LOG_PUTCHAR (psf, c) ; + continue ; + } ; + + if (format [0] == '%') /* Handle %% */ + { LOG_PUTCHAR (psf, '%') ; + format ++ ; + continue ; + } ; + + sign_char = 0 ; + left_align = SF_FALSE ; + while (1) + { switch (format [0]) + { case ' ' : + case '+' : + sign_char = format [0] ; + format ++ ; + continue ; + + case '-' : + left_align = SF_TRUE ; + format ++ ; + continue ; + + default : break ; + } ; + + break ; + } ; + + if (format [0] == 0) + break ; + + lead_char = ' ' ; + if (format [0] == '0') + lead_char = '0' ; + + width_specifier = 0 ; + while ((c = *format++) && isdigit (c)) + width_specifier = width_specifier * 10 + (c - '0') ; + + switch (c) + { case 0 : /* NULL character. */ + va_end (ap) ; + return ; + + case 's': /* string */ + strptr = va_arg (ap, char *) ; + if (strptr == NULL) + break ; + width_specifier -= strlen (strptr) ; + if (left_align == SF_FALSE) + while (width_specifier -- > 0) + LOG_PUTCHAR (psf, ' ') ; + while (*strptr) + LOG_PUTCHAR (psf, *strptr++) ; + while (width_specifier -- > 0) + LOG_PUTCHAR (psf, ' ') ; + break ; + + case 'd': /* int */ + d = va_arg (ap, int) ; + + if (d < 0) + { d = -d ; + sign_char = '-' ; + if (lead_char != '0' && left_align == SF_FALSE) + width_specifier -- ; + } ; + + tens = 1 ; + width = 1 ; + while (d / tens >= 10) + { tens *= 10 ; + width ++ ; + } ; + + width_specifier -= width ; + + if (sign_char == ' ') + { LOG_PUTCHAR (psf, ' ') ; + width_specifier -- ; + } ; + + if (left_align == SF_FALSE && lead_char != '0') + { if (sign_char == '+') + width_specifier -- ; + + while (width_specifier -- > 0) + LOG_PUTCHAR (psf, lead_char) ; + } ; + + if (sign_char == '+' || sign_char == '-') + { LOG_PUTCHAR (psf, sign_char) ; + width_specifier -- ; + } ; + + if (left_align == SF_FALSE) + while (width_specifier -- > 0) + LOG_PUTCHAR (psf, lead_char) ; + + while (tens > 0) + { LOG_PUTCHAR (psf, '0' + d / tens) ; + d %= tens ; + tens /= 10 ; + } ; + + while (width_specifier -- > 0) + LOG_PUTCHAR (psf, lead_char) ; + break ; + + case 'D': /* sf_count_t */ + { sf_count_t D, Tens ; + + D = va_arg (ap, sf_count_t) ; + + if (D == 0) + { while (-- width_specifier > 0) + LOG_PUTCHAR (psf, lead_char) ; + LOG_PUTCHAR (psf, '0') ; + break ; + } + if (D < 0) + { LOG_PUTCHAR (psf, '-') ; + D = -D ; + } ; + Tens = 1 ; + width = 1 ; + while (D / Tens >= 10) + { Tens *= 10 ; + width ++ ; + } ; + + while (width_specifier > width) + { LOG_PUTCHAR (psf, lead_char) ; + width_specifier-- ; + } ; + + while (Tens > 0) + { LOG_PUTCHAR (psf, '0' + D / Tens) ; + D %= Tens ; + Tens /= 10 ; + } ; + } ; + break ; + + case 'u': /* unsigned int */ + u = va_arg (ap, unsigned int) ; + + tens = 1 ; + width = 1 ; + while (u / tens >= 10) + { tens *= 10 ; + width ++ ; + } ; + + width_specifier -= width ; + + if (sign_char == ' ') + { LOG_PUTCHAR (psf, ' ') ; + width_specifier -- ; + } ; + + if (left_align == SF_FALSE && lead_char != '0') + { if (sign_char == '+') + width_specifier -- ; + + while (width_specifier -- > 0) + LOG_PUTCHAR (psf, lead_char) ; + } ; + + if (sign_char == '+' || sign_char == '-') + { LOG_PUTCHAR (psf, sign_char) ; + width_specifier -- ; + } ; + + if (left_align == SF_FALSE) + while (width_specifier -- > 0) + LOG_PUTCHAR (psf, lead_char) ; + + while (tens > 0) + { LOG_PUTCHAR (psf, '0' + u / tens) ; + u %= tens ; + tens /= 10 ; + } ; + + while (width_specifier -- > 0) + LOG_PUTCHAR (psf, lead_char) ; + break ; + + case 'c': /* char */ + c = va_arg (ap, int) & 0xFF ; + LOG_PUTCHAR (psf, c) ; + break ; + + case 'x': /* hex */ + case 'X': /* hex */ + d = va_arg (ap, int) ; + + if (d == 0) + { while (--width_specifier > 0) + LOG_PUTCHAR (psf, lead_char) ; + LOG_PUTCHAR (psf, '0') ; + break ; + } ; + shift = 28 ; + width = (width_specifier < 8) ? 8 : width_specifier ; + while (! ((0xF << shift) & d)) + { shift -= 4 ; + width -- ; + } ; + + while (width > 0 && width_specifier > width) + { LOG_PUTCHAR (psf, lead_char) ; + width_specifier-- ; + } ; + + while (shift >= 0) + { c = (d >> shift) & 0xF ; + LOG_PUTCHAR (psf, (c > 9) ? c + 'A' - 10 : c + '0') ; + shift -= 4 ; + } ; + break ; + + case 'M': /* int2str */ + d = va_arg (ap, int) ; + if (CPU_IS_LITTLE_ENDIAN) + { istr [0] = d & 0xFF ; + istr [1] = (d >> 8) & 0xFF ; + istr [2] = (d >> 16) & 0xFF ; + istr [3] = (d >> 24) & 0xFF ; + } + else + { istr [3] = d & 0xFF ; + istr [2] = (d >> 8) & 0xFF ; + istr [1] = (d >> 16) & 0xFF ; + istr [0] = (d >> 24) & 0xFF ; + } ; + istr [4] = 0 ; + strptr = istr ; + while (*strptr) + { c = *strptr++ ; + LOG_PUTCHAR (psf, c) ; + } ; + break ; + + default : + LOG_PUTCHAR (psf, '*') ; + LOG_PUTCHAR (psf, c) ; + LOG_PUTCHAR (psf, '*') ; + break ; + } /* switch */ + } /* while */ + + va_end (ap) ; + return ; +} /* psf_log_printf */ + +#ifndef PSF_LOG_PRINTF_ONLY +/*----------------------------------------------------------------------------------------------- +** ASCII header printf functions. +** Some formats (ie NIST) use ascii text in their headers. +** Format specifiers are the same as the standard printf specifiers (uses vsnprintf). +** If this generates a compile error on any system, the author should be notified +** so an alternative vsnprintf can be provided. +*/ + +void +psf_asciiheader_printf (SF_PRIVATE *psf, const char *format, ...) +{ va_list argptr ; + int maxlen ; + char *start ; + + maxlen = strlen ((char*) psf->header) ; + start = ((char*) psf->header) + maxlen ; + maxlen = sizeof (psf->header) - maxlen ; + + va_start (argptr, format) ; + LSF_VSNPRINTF (start, maxlen, format, argptr) ; + va_end (argptr) ; + + /* Make sure the string is properly terminated. */ + start [maxlen - 1] = 0 ; + + psf->headindex = strlen ((char*) psf->header) ; + + return ; +} /* psf_asciiheader_printf */ + +/*----------------------------------------------------------------------------------------------- +** Binary header writing functions. Returns number of bytes written. +** +** Format specifiers for psf_binheader_writef are as follows +** m - marker - four bytes - no endian manipulation +** +** e - all following numerical values will be little endian +** E - all following numerical values will be big endian +** +** t - all following O types will be truncated to 4 bytes +** T - switch off truncation of all following O types +** +** 1 - single byte value +** 2 - two byte value +** 3 - three byte value +** 4 - four byte value +** 8 - eight byte value (sometimes written as 4 bytes) +** +** s - string preceded by a four byte length +** S - string including null terminator +** f - floating point data +** d - double precision floating point data +** h - 16 binary bytes value +** +** b - binary data (see below) +** z - zero bytes (ses below) +** j - jump forwards or backwards +** +** To write a word followed by an int (both little endian) use: +** psf_binheader_writef ("e24", wordval, longval) ; +** +** To write binary data use: +** psf_binheader_writef ("b", &bindata, sizeof (bindata)) ; +** +** To write N zero bytes use: +** NOTE: due to platform issues (ie x86-64) you should cast the +** argument to size_t or ensure the variable type is size_t. +** psf_binheader_writef ("z", N) ; +*/ + +/* These macros may seem a bit messy but do prevent problems with processors which +** seg. fault when asked to write an int or short to a non-int/short aligned address. +*/ + +#define PUT_BYTE(psf,x) if ((psf)->headindex < SIGNED_SIZEOF ((psf)->header) - 1) \ + { (psf)->header [(psf)->headindex++] = (x) ; } + +#if (CPU_IS_BIG_ENDIAN == 1) +#define PUT_MARKER(psf,x) if ((psf)->headindex < SIGNED_SIZEOF ((psf)->header) - 4) \ + { (psf)->header [(psf)->headindex++] = ((x) >> 24) ; \ + (psf)->header [(psf)->headindex++] = ((x) >> 16) ; \ + (psf)->header [(psf)->headindex++] = ((x) >> 8) ; \ + (psf)->header [(psf)->headindex++] = (x) ; } + +#elif (CPU_IS_LITTLE_ENDIAN == 1) +#define PUT_MARKER(psf,x) if ((psf)->headindex < SIGNED_SIZEOF ((psf)->header) - 4) \ + { (psf)->header [(psf)->headindex++] = (x) ; \ + (psf)->header [(psf)->headindex++] = ((x) >> 8) ; \ + (psf)->header [(psf)->headindex++] = ((x) >> 16) ; \ + (psf)->header [(psf)->headindex++] = ((x) >> 24) ; } + +#else +# error "Cannot determine endian-ness of processor." +#endif + + +#define PUT_BE_SHORT(psf,x) if ((psf)->headindex < SIGNED_SIZEOF ((psf)->header) - 2) \ + { (psf)->header [(psf)->headindex++] = ((x) >> 8) ; \ + (psf)->header [(psf)->headindex++] = (x) ; } + +#define PUT_LE_SHORT(psf,x) if ((psf)->headindex < SIGNED_SIZEOF ((psf)->header) - 2) \ + { (psf)->header [(psf)->headindex++] = (x) ; \ + (psf)->header [(psf)->headindex++] = ((x) >> 8) ; } + +#define PUT_BE_3BYTE(psf,x) if ((psf)->headindex < SIGNED_SIZEOF ((psf)->header) - 3) \ + { (psf)->header [(psf)->headindex++] = ((x) >> 16) ; \ + (psf)->header [(psf)->headindex++] = ((x) >> 8) ; \ + (psf)->header [(psf)->headindex++] = (x) ; } + +#define PUT_LE_3BYTE(psf,x) if ((psf)->headindex < SIGNED_SIZEOF ((psf)->header) - 3) \ + { (psf)->header [(psf)->headindex++] = (x) ; \ + (psf)->header [(psf)->headindex++] = ((x) >> 8) ; \ + (psf)->header [(psf)->headindex++] = ((x) >> 16) ; } + +#define PUT_BE_INT(psf,x) if ((psf)->headindex < SIGNED_SIZEOF ((psf)->header) - 4) \ + { (psf)->header [(psf)->headindex++] = ((x) >> 24) ; \ + (psf)->header [(psf)->headindex++] = ((x) >> 16) ; \ + (psf)->header [(psf)->headindex++] = ((x) >> 8) ; \ + (psf)->header [(psf)->headindex++] = (x) ; } + +#define PUT_LE_INT(psf,x) if ((psf)->headindex < SIGNED_SIZEOF ((psf)->header) - 4) \ + { (psf)->header [(psf)->headindex++] = (x) ; \ + (psf)->header [(psf)->headindex++] = ((x) >> 8) ; \ + (psf)->header [(psf)->headindex++] = ((x) >> 16) ; \ + (psf)->header [(psf)->headindex++] = ((x) >> 24) ; } + +#if (SIZEOF_SF_COUNT_T == 4) +#define PUT_BE_8BYTE(psf,x) if ((psf)->headindex < SIGNED_SIZEOF ((psf)->header) - 8) \ + { (psf)->header [(psf)->headindex++] = 0 ; \ + (psf)->header [(psf)->headindex++] = 0 ; \ + (psf)->header [(psf)->headindex++] = 0 ; \ + (psf)->header [(psf)->headindex++] = 0 ; \ + (psf)->header [(psf)->headindex++] = ((x) >> 24) ; \ + (psf)->header [(psf)->headindex++] = ((x) >> 16) ; \ + (psf)->header [(psf)->headindex++] = ((x) >> 8) ; \ + (psf)->header [(psf)->headindex++] = (x) ; } + +#define PUT_LE_8BYTE(psf,x) if ((psf)->headindex < SIGNED_SIZEOF ((psf)->header) - 8) \ + { (psf)->header [(psf)->headindex++] = (x) ; \ + (psf)->header [(psf)->headindex++] = ((x) >> 8) ; \ + (psf)->header [(psf)->headindex++] = ((x) >> 16) ; \ + (psf)->header [(psf)->headindex++] = ((x) >> 24) ; \ + (psf)->header [(psf)->headindex++] = 0 ; \ + (psf)->header [(psf)->headindex++] = 0 ; \ + (psf)->header [(psf)->headindex++] = 0 ; \ + (psf)->header [(psf)->headindex++] = 0 ; } + +#elif (SIZEOF_SF_COUNT_T == 8) +#define PUT_BE_8BYTE(psf,x) if ((psf)->headindex < SIGNED_SIZEOF ((psf)->header) - 8) \ + { (psf)->header [(psf)->headindex++] = ((x) >> 56) ; \ + (psf)->header [(psf)->headindex++] = ((x) >> 48) ; \ + (psf)->header [(psf)->headindex++] = ((x) >> 40) ; \ + (psf)->header [(psf)->headindex++] = ((x) >> 32) ; \ + (psf)->header [(psf)->headindex++] = ((x) >> 24) ; \ + (psf)->header [(psf)->headindex++] = ((x) >> 16) ; \ + (psf)->header [(psf)->headindex++] = ((x) >> 8) ; \ + (psf)->header [(psf)->headindex++] = (x) ; } + +#define PUT_LE_8BYTE(psf,x) if ((psf)->headindex < SIGNED_SIZEOF ((psf)->header) - 8) \ + { (psf)->header [(psf)->headindex++] = (x) ; \ + (psf)->header [(psf)->headindex++] = ((x) >> 8) ; \ + (psf)->header [(psf)->headindex++] = ((x) >> 16) ; \ + (psf)->header [(psf)->headindex++] = ((x) >> 24) ; \ + (psf)->header [(psf)->headindex++] = ((x) >> 32) ; \ + (psf)->header [(psf)->headindex++] = ((x) >> 40) ; \ + (psf)->header [(psf)->headindex++] = ((x) >> 48) ; \ + (psf)->header [(psf)->headindex++] = ((x) >> 56) ; } +#else +#error "SIZEOF_SF_COUNT_T is not defined." +#endif + +int +psf_binheader_writef (SF_PRIVATE *psf, const char *format, ...) +{ va_list argptr ; + sf_count_t countdata ; + unsigned long longdata ; + unsigned int data ; + float floatdata ; + double doubledata ; + void *bindata ; + size_t size ; + char c, *strptr ; + int count = 0, trunc_8to4 ; + + trunc_8to4 = SF_FALSE ; + + va_start (argptr, format) ; + + while ((c = *format++)) + { switch (c) + { case 'e' : /* All conversions are now from LE to host. */ + psf->rwf_endian = SF_ENDIAN_LITTLE ; + break ; + + case 'E' : /* All conversions are now from BE to host. */ + psf->rwf_endian = SF_ENDIAN_BIG ; + break ; + + case 't' : /* All 8 byte values now get written as 4 bytes. */ + trunc_8to4 = SF_TRUE ; + break ; + + case 'T' : /* All 8 byte values now get written as 8 bytes. */ + trunc_8to4 = SF_FALSE ; + break ; + + case 'm' : + data = va_arg (argptr, unsigned int) ; + PUT_MARKER (psf, data) ; + count += 4 ; + break ; + + case '1' : + data = va_arg (argptr, unsigned int) ; + PUT_BYTE (psf, data) ; + count += 1 ; + break ; + + case '2' : + data = va_arg (argptr, unsigned int) ; + if (psf->rwf_endian == SF_ENDIAN_BIG) + { PUT_BE_SHORT (psf, data) ; + } + else + { PUT_LE_SHORT (psf, data) ; + } ; + count += 2 ; + break ; + + case '3' : /* tribyte */ + data = va_arg (argptr, unsigned int) ; + if (psf->rwf_endian == SF_ENDIAN_BIG) + { PUT_BE_3BYTE (psf, data) ; + } + else + { PUT_LE_3BYTE (psf, data) ; + } ; + count += 3 ; + break ; + + case '4' : + data = va_arg (argptr, unsigned int) ; + if (psf->rwf_endian == SF_ENDIAN_BIG) + { PUT_BE_INT (psf, data) ; + } + else + { PUT_LE_INT (psf, data) ; + } ; + count += 4 ; + break ; + + case '8' : + countdata = va_arg (argptr, sf_count_t) ; + if (psf->rwf_endian == SF_ENDIAN_BIG && trunc_8to4 == SF_FALSE) + { PUT_BE_8BYTE (psf, countdata) ; + count += 8 ; + } + else if (psf->rwf_endian == SF_ENDIAN_LITTLE && trunc_8to4 == SF_FALSE) + { PUT_LE_8BYTE (psf, countdata) ; + count += 8 ; + } + else if (psf->rwf_endian == SF_ENDIAN_BIG && trunc_8to4 == SF_TRUE) + { longdata = countdata & 0xFFFFFFFF ; + PUT_BE_INT (psf, longdata) ; + count += 4 ; + } + else if (psf->rwf_endian == SF_ENDIAN_LITTLE && trunc_8to4 == SF_TRUE) + { longdata = countdata & 0xFFFFFFFF ; + PUT_LE_INT (psf, longdata) ; + count += 4 ; + } + break ; + + case 'f' : + /* Floats are passed as doubles. Is this always true? */ + floatdata = (float) va_arg (argptr, double) ; + if (psf->rwf_endian == SF_ENDIAN_BIG) + float32_be_write (floatdata, psf->header + psf->headindex) ; + else + float32_le_write (floatdata, psf->header + psf->headindex) ; + psf->headindex += 4 ; + count += 4 ; + break ; + + case 'd' : + doubledata = va_arg (argptr, double) ; + if (psf->rwf_endian == SF_ENDIAN_BIG) + double64_be_write (doubledata, psf->header + psf->headindex) ; + else + double64_le_write (doubledata, psf->header + psf->headindex) ; + psf->headindex += 8 ; + count += 8 ; + break ; + + case 's' : + strptr = va_arg (argptr, char *) ; + size = strlen (strptr) + 1 ; + size += (size & 1) ; + if (psf->rwf_endian == SF_ENDIAN_BIG) + { PUT_BE_INT (psf, size) ; + } + else + { PUT_LE_INT (psf, size) ; + } ; + memcpy (&(psf->header [psf->headindex]), strptr, size) ; + psf->headindex += size ; + psf->header [psf->headindex - 1] = 0 ; + count += 4 + size ; + break ; + + case 'S' : + strptr = va_arg (argptr, char *) ; + size = strlen (strptr) + 1 ; + memcpy (&(psf->header [psf->headindex]), strptr, size) ; + psf->headindex += size ; + count += size ; + break ; + + case 'b' : + bindata = va_arg (argptr, void *) ; + size = va_arg (argptr, size_t) ; + memcpy (&(psf->header [psf->headindex]), bindata, size) ; + psf->headindex += size ; + count += size ; + break ; + + case 'z' : + size = va_arg (argptr, size_t) ; + count += size ; + while (size) + { psf->header [psf->headindex] = 0 ; + psf->headindex ++ ; + size -- ; + } ; + break ; + + case 'h' : + bindata = va_arg (argptr, void *) ; + memcpy (&(psf->header [psf->headindex]), bindata, 16) ; + psf->headindex += 16 ; + count += 16 ; + break ; + + case 'j' : + size = va_arg (argptr, int) ; + psf->headindex += size ; + count = size ; + break ; + + default : + psf_log_printf (psf, "*** Invalid format specifier `%c'\n", c) ; + psf->error = SFE_INTERNAL ; + break ; + } ; + } ; + + va_end (argptr) ; + return count ; +} /* psf_binheader_writef */ + +/*----------------------------------------------------------------------------------------------- +** Binary header reading functions. Returns number of bytes read. +** +** Format specifiers are the same as for header write function above with the following +** additions: +** +** p - jump a given number of position from start of file. +** +** If format is NULL, psf_binheader_readf returns the current offset. +*/ + +#if (CPU_IS_BIG_ENDIAN == 1) +#define GET_MARKER(ptr) ( ((ptr) [0] << 24) | ((ptr) [1] << 16) | \ + ((ptr) [2] << 8) | ((ptr) [3]) ) + +#elif (CPU_IS_LITTLE_ENDIAN == 1) +#define GET_MARKER(ptr) ( ((ptr) [0]) | ((ptr) [1] << 8) | \ + ((ptr) [2] << 16) | ((ptr) [3] << 24) ) + +#else +# error "Cannot determine endian-ness of processor." +#endif + +#define GET_LE_SHORT(ptr) ( ((ptr) [1] << 8) | ((ptr) [0]) ) +#define GET_BE_SHORT(ptr) ( ((ptr) [0] << 8) | ((ptr) [1]) ) + +#define GET_LE_3BYTE(ptr) ( ((ptr) [2] << 16) | ((ptr) [1] << 8) | ((ptr) [0]) ) +#define GET_BE_3BYTE(ptr) ( ((ptr) [0] << 16) | ((ptr) [1] << 8) | ((ptr) [2]) ) + +#define GET_LE_INT(ptr) ( ((ptr) [3] << 24) | ((ptr) [2] << 16) | \ + ((ptr) [1] << 8) | ((ptr) [0]) ) + +#define GET_BE_INT(ptr) ( ((ptr) [0] << 24) | ((ptr) [1] << 16) | \ + ((ptr) [2] << 8) | ((ptr) [3]) ) + +#if (SIZEOF_LONG == 4) +#define GET_LE_8BYTE(ptr) ( ((ptr) [3] << 24) | ((ptr) [2] << 16) | \ + ((ptr) [1] << 8) | ((ptr) [0]) ) + +#define GET_BE_8BYTE(ptr) ( ((ptr) [4] << 24) | ((ptr) [5] << 16) | \ + ((ptr) [6] << 8) | ((ptr) [7]) ) +#else +#define GET_LE_8BYTE(ptr) ( (((ptr) [7] * 1L) << 56) | (((ptr) [6] * 1L) << 48) | \ + (((ptr) [5] * 1L) << 40) | (((ptr) [4] * 1L) << 32) | \ + (((ptr) [3] * 1L) << 24) | (((ptr) [2] * 1L) << 16) | \ + (((ptr) [1] * 1L) << 8 ) | ((ptr) [0])) + +#define GET_BE_8BYTE(ptr) ( (((ptr) [0] * 1L) << 56) | (((ptr) [1] * 1L) << 48) | \ + (((ptr) [2] * 1L) << 40) | (((ptr) [3] * 1L) << 32) | \ + (((ptr) [4] * 1L) << 24) | (((ptr) [5] * 1L) << 16) | \ + (((ptr) [6] * 1L) << 8 ) | ((ptr) [7])) + +#endif + +static int +header_read (SF_PRIVATE *psf, void *ptr, int bytes) +{ int count = 0 ; + + if (psf->headindex + bytes > SIGNED_SIZEOF (psf->header)) + { if (psf->headend < SIGNED_SIZEOF (psf->header)) + psf_log_printf (psf, "Warning : Further header read would overflow buffer.\n") ; + psf->headend = SIGNED_SIZEOF (psf->header) ; + + /* This is the best that we can do. */ + return psf_fread (ptr, 1, bytes, psf) ; + } ; + + if (psf->headindex + bytes > psf->headend) + { count = psf_fread (psf->header + psf->headend, 1, bytes - (psf->headend - psf->headindex), psf) ; + if (count != bytes - (int) (psf->headend - psf->headindex)) + { psf_log_printf (psf, "Error : psf_fread returned short count.\n") ; + return 0 ; + } ; + psf->headend += count ; + } ; + + memcpy (ptr, psf->header + psf->headindex, bytes) ; + psf->headindex += bytes ; + + return bytes ; +} /* header_read */ + +static void +header_seek (SF_PRIVATE *psf, sf_count_t position, int whence) +{ + + switch (whence) + { case SEEK_SET : + if (position > SIGNED_SIZEOF (psf->header)) + { /* Too much header to cache so just seek instead. */ + psf_fseek (psf, position, whence) ; + return ; + } ; + if (position > psf->headend) + psf->headend += psf_fread (psf->header + psf->headend, 1, position - psf->headend, psf) ; + psf->headindex = position ; + break ; + + case SEEK_CUR : + if (psf->headindex + position < 0) + break ; + + if (psf->headindex >= SIGNED_SIZEOF (psf->header)) + { psf_fseek (psf, position, whence) ; + return ; + } ; + + if (psf->headindex + position <= psf->headend) + { psf->headindex += position ; + break ; + } ; + + if (psf->headindex + position > SIGNED_SIZEOF (psf->header)) + { /* Need to jump this without caching it. */ + psf->headindex = psf->headend ; + psf_fseek (psf, position, SEEK_CUR) ; + break ; + } ; + + psf->headend += psf_fread (psf->header + psf->headend, 1, position - (psf->headend - psf->headindex), psf) ; + psf->headindex = psf->headend ; + break ; + + case SEEK_END : + default : + psf_log_printf (psf, "Bad whence param in header_seek().\n") ; + break ; + } ; + + return ; +} /* header_seek */ + +static int +header_gets (SF_PRIVATE *psf, char *ptr, int bufsize) +{ + int k ; + + for (k = 0 ; k < bufsize - 1 ; k++) + { if (psf->headindex < psf->headend) + { ptr [k] = psf->header [psf->headindex] ; + psf->headindex ++ ; + } + else + { psf->headend += psf_fread (psf->header + psf->headend, 1, 1, psf) ; + ptr [k] = psf->header [psf->headindex] ; + psf->headindex = psf->headend ; + } ; + + if (ptr [k] == '\n') + break ; + } ; + + ptr [k] = 0 ; + + return k ; +} /* header_gets */ + +int +psf_binheader_readf (SF_PRIVATE *psf, char const *format, ...) +{ va_list argptr ; + sf_count_t *countptr, countdata ; + unsigned char *ucptr, sixteen_bytes [16] ; + unsigned int *intptr, intdata ; + unsigned short *shortptr ; + char *charptr ; + float *floatptr ; + double *doubleptr ; + char c ; + int byte_count = 0, count ; + + if (! format) + return psf_ftell (psf) ; + + va_start (argptr, format) ; + + while ((c = *format++)) + { switch (c) + { case 'e' : /* All conversions are now from LE to host. */ + psf->rwf_endian = SF_ENDIAN_LITTLE ; + break ; + + case 'E' : /* All conversions are now from BE to host. */ + psf->rwf_endian = SF_ENDIAN_BIG ; + break ; + + case 'm' : + intptr = va_arg (argptr, unsigned int*) ; + ucptr = (unsigned char*) intptr ; + byte_count += header_read (psf, ucptr, sizeof (int)) ; + *intptr = GET_MARKER (ucptr) ; + break ; + + case 'h' : + intptr = va_arg (argptr, unsigned int*) ; + ucptr = (unsigned char*) intptr ; + byte_count += header_read (psf, sixteen_bytes, sizeof (sixteen_bytes)) ; + { int k ; + intdata = 0 ; + for (k = 0 ; k < 16 ; k++) + intdata ^= sixteen_bytes [k] << k ; + } + *intptr = intdata ; + break ; + + case '1' : + charptr = va_arg (argptr, char*) ; + byte_count += header_read (psf, charptr, sizeof (char)) ; + break ; + + case '2' : + shortptr = va_arg (argptr, unsigned short*) ; + ucptr = (unsigned char*) shortptr ; + byte_count += header_read (psf, ucptr, sizeof (short)) ; + if (psf->rwf_endian == SF_ENDIAN_BIG) + *shortptr = GET_BE_SHORT (ucptr) ; + else + *shortptr = GET_LE_SHORT (ucptr) ; + break ; + + case '3' : + intptr = va_arg (argptr, unsigned int*) ; + byte_count += header_read (psf, sixteen_bytes, 3) ; + if (psf->rwf_endian == SF_ENDIAN_BIG) + *intptr = GET_BE_3BYTE (sixteen_bytes) ; + else + *intptr = GET_LE_3BYTE (sixteen_bytes) ; + break ; + + case '4' : + intptr = va_arg (argptr, unsigned int*) ; + ucptr = (unsigned char*) intptr ; + byte_count += header_read (psf, ucptr, sizeof (int)) ; + if (psf->rwf_endian == SF_ENDIAN_BIG) + *intptr = GET_BE_INT (ucptr) ; + else + *intptr = GET_LE_INT (ucptr) ; + break ; + + case '8' : + countptr = va_arg (argptr, sf_count_t*) ; + byte_count += header_read (psf, sixteen_bytes, 8) ; + if (psf->rwf_endian == SF_ENDIAN_BIG) + countdata = GET_BE_8BYTE (sixteen_bytes) ; + else + countdata = GET_LE_8BYTE (sixteen_bytes) ; + *countptr = countdata ; + break ; + + case 'f' : /* Float conversion */ + floatptr = va_arg (argptr, float *) ; + *floatptr = 0.0 ; + byte_count += header_read (psf, floatptr, sizeof (float)) ; + if (psf->rwf_endian == SF_ENDIAN_BIG) + *floatptr = float32_be_read ((unsigned char*) floatptr) ; + else + *floatptr = float32_le_read ((unsigned char*) floatptr) ; + break ; + + case 'd' : /* double conversion */ + doubleptr = va_arg (argptr, double *) ; + *doubleptr = 0.0 ; + byte_count += header_read (psf, doubleptr, sizeof (double)) ; + if (psf->rwf_endian == SF_ENDIAN_BIG) + *doubleptr = double64_be_read ((unsigned char*) doubleptr) ; + else + *doubleptr = double64_le_read ((unsigned char*) doubleptr) ; + break ; + + case 's' : + psf_log_printf (psf, "Format conversion 's' not implemented yet.\n") ; + /* + strptr = va_arg (argptr, char *) ; + size = strlen (strptr) + 1 ; + size += (size & 1) ; + longdata = H2LE_INT (size) ; + get_int (psf, longdata) ; + memcpy (&(psf->header [psf->headindex]), strptr, size) ; + psf->headindex += size ; + */ + break ; + + case 'b' : + charptr = va_arg (argptr, char*) ; + count = va_arg (argptr, int) ; + if (count > 0) + byte_count += header_read (psf, charptr, count) ; + break ; + + case 'G' : + charptr = va_arg (argptr, char*) ; + count = va_arg (argptr, int) ; + if (count > 0) + byte_count += header_gets (psf, charptr, count) ; + break ; + + case 'z' : + psf_log_printf (psf, "Format conversion 'z' not implemented yet.\n") ; + /* + size = va_arg (argptr, size_t) ; + while (size) + { psf->header [psf->headindex] = 0 ; + psf->headindex ++ ; + size -- ; + } ; + */ + break ; + + case 'p' : + /* Get the seek position first. */ + count = va_arg (argptr, int) ; + header_seek (psf, count, SEEK_SET) ; + byte_count = count ; + break ; + + case 'j' : + /* Get the seek position first. */ + count = va_arg (argptr, int) ; + header_seek (psf, count, SEEK_CUR) ; + byte_count += count ; + break ; + + default : + psf_log_printf (psf, "*** Invalid format specifier `%c'\n", c) ; + psf->error = SFE_INTERNAL ; + break ; + } ; + } ; + + va_end (argptr) ; + + return byte_count ; +} /* psf_binheader_readf */ + +/*----------------------------------------------------------------------------------------------- +*/ + +sf_count_t +psf_default_seek (SF_PRIVATE *psf, int mode, sf_count_t samples_from_start) +{ sf_count_t position, retval ; + + if (! (psf->blockwidth && psf->dataoffset >= 0)) + { psf->error = SFE_BAD_SEEK ; + return ((sf_count_t) -1) ; + } ; + + if (! psf->sf.seekable) + { psf->error = SFE_NOT_SEEKABLE ; + return ((sf_count_t) -1) ; + } ; + + position = psf->dataoffset + psf->blockwidth * samples_from_start ; + + if ((retval = psf_fseek (psf, position, SEEK_SET)) != position) + { psf->error = SFE_SEEK_FAILED ; + return ((sf_count_t) -1) ; + } ; + + mode = mode ; + + return samples_from_start ; +} /* psf_default_seek */ + +/*----------------------------------------------------------------------------------------------- +*/ + +void +psf_hexdump (void *ptr, int len) +{ char ascii [17], *data ; + int k, m ; + + if ((data = ptr) == NULL) + return ; + if (len <= 0) + return ; + + puts ("") ; + for (k = 0 ; k < len ; k += 16) + { memset (ascii, ' ', sizeof (ascii)) ; + + printf ("%08X: ", k) ; + for (m = 0 ; m < 16 && k + m < len ; m++) + { printf (m == 8 ? " %02X " : "%02X ", data [k + m] & 0xFF) ; + ascii [m] = isprint (data [k + m]) ? data [k + m] : '.' ; + } ; + + if (m <= 8) printf (" ") ; + for ( ; m < 16 ; m++) printf (" ") ; + + ascii [16] = 0 ; + printf (" %s\n", ascii) ; + } ; + + puts ("") ; +} /* psf_hexdump */ + +void +psf_log_SF_INFO (SF_PRIVATE *psf) +{ psf_log_printf (psf, "---------------------------------\n") ; + + psf_log_printf (psf, " Sample rate : %d\n", psf->sf.samplerate) ; + psf_log_printf (psf, " Frames : %C\n", psf->sf.frames) ; + psf_log_printf (psf, " Channels : %d\n", psf->sf.channels) ; + + psf_log_printf (psf, " Format : 0x%X\n", psf->sf.format) ; + psf_log_printf (psf, " Sections : %d\n", psf->sf.sections) ; + psf_log_printf (psf, " Seekable : %s\n", psf->sf.seekable ? "TRUE" : "FALSE") ; + + psf_log_printf (psf, "---------------------------------\n") ; +} /* psf_dump_SFINFO */ + +/*======================================================================================== +*/ + +void* +psf_memset (void *s, int c, sf_count_t len) +{ char *ptr ; + int setcount ; + + ptr = (char *) s ; + + while (len > 0) + { setcount = (len > 0x10000000) ? 0x10000000 : (int) len ; + + memset (ptr, c, setcount) ; + + ptr += setcount ; + len -= setcount ; + } ; + + return s ; +} /* psf_memset */ + +void psf_get_date_str (char *str, int maxlen) +{ time_t current ; + struct tm timedata, *tmptr ; + + time (¤t) ; + +#if defined (HAVE_GMTIME_R) + /* If the re-entrant version is available, use it. */ + tmptr = gmtime_r (¤t, &timedata) ; +#elif defined (HAVE_GMTIME) + /* Otherwise use the standard one and copy the data to local storage. */ + tmptr = gmtime (¤t) ; + memcpy (&timedata, tmptr, sizeof (timedata)) ; +#else + tmptr = NULL ; +#endif + + if (tmptr) + LSF_SNPRINTF (str, maxlen, "%4d-%02d-%02d %02d:%02d:%02d UTC", + 1900 + timedata.tm_year, timedata.tm_mon, timedata.tm_mday, + timedata.tm_hour, timedata.tm_min, timedata.tm_sec) ; + else + LSF_SNPRINTF (str, maxlen, "Unknown date") ; + + return ; +} /* psf_get_date_str */ + +int +subformat_to_bytewidth (int format) +{ + switch (format) + { case SF_FORMAT_PCM_U8 : + case SF_FORMAT_PCM_S8 : + return 1 ; + case SF_FORMAT_PCM_16 : + return 2 ; + case SF_FORMAT_PCM_24 : + return 3 ; + case SF_FORMAT_PCM_32 : + case SF_FORMAT_FLOAT : + return 4 ; + case SF_FORMAT_DOUBLE : + return 8 ; + } ; + + return 0 ; +} /* subformat_to_bytewidth */ + +int +s_bitwidth_to_subformat (int bits) +{ static int array [] = + { SF_FORMAT_PCM_S8, SF_FORMAT_PCM_16, SF_FORMAT_PCM_24, SF_FORMAT_PCM_32 + } ; + + if (bits < 8 || bits > 32) + return 0 ; + + return array [((bits + 7) / 8) - 1] ; +} /* bitwidth_to_subformat */ + +int +u_bitwidth_to_subformat (int bits) +{ static int array [] = + { SF_FORMAT_PCM_U8, SF_FORMAT_PCM_16, SF_FORMAT_PCM_24, SF_FORMAT_PCM_32 + } ; + + if (bits < 8 || bits > 32) + return 0 ; + + return array [((bits + 7) / 8) - 1] ; +} /* bitwidth_to_subformat */ + +#endif /* PSF_LOG_PRINTF_ONLY */ + +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: 33e9795e-f717-461a-9feb-65d083a56395 +*/ diff --git a/Libraries/SndFile/Files/src/common.h b/Libraries/SndFile/Files/src/common.h new file mode 100644 index 000000000..19f08e085 --- /dev/null +++ b/Libraries/SndFile/Files/src/common.h @@ -0,0 +1,691 @@ +/* +** Copyright (C) 1999-2004 Erik de Castro Lopo +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU Lesser General Public License as published by +** the Free Software Foundation; either version 2.1 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU Lesser General Public License for more details. +** +** You should have received a copy of the GNU Lesser General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#ifndef COMMON_H_INCLUDED +#define COMMON_H_INCLUDED + +#include "config.h" + +#ifndef SNDFILE_H +#include +#endif + +#if HAVE_STDINT_H +#include +#endif + +#ifdef UNUSED +#elif defined (__GNUC__) +# define UNUSED(x) UNUSED_ ## x __attribute__ ((unused)) +#elif defined (__LCLINT__) +# define UNUSED(x) /*@unused@*/ x +#else +# define UNUSED(x) x +#endif + +#ifdef __GNUC__ +# define WARN_UNUSED __attribute__((warn_unused_result)) +#else +# define WARN_UNUSED +#endif + +#define SF_BUFFER_LEN (8192*2) +#define SF_FILENAME_LEN (512) +#define SF_HEADER_LEN (4096) +#define SF_TEXT_LEN (1024) +#define SF_SYSERR_LEN (256) +#define SF_MAX_STRINGS (16) + +#define SF_SEEK_ERROR ((sf_count_t) -1) + + +#define BITWIDTH2BYTES(x) (((x) + 7) / 8) + +/* For some reason sizeof returns an unsigned value which causes +** a warning when that value is added or subtracted from a signed +** value. Use SIGNED_SIZEOF instead. +*/ +#define SIGNED_SIZEOF(x) ((int) sizeof (x)) + +#define ARRAY_LEN(x) ((int) (sizeof (x) / sizeof ((x) [0]))) + +#define SF_MAX(a,b) ((a) > (b) ? (a) : (b)) +#define SF_MIN(a,b) ((a) < (b) ? (a) : (b)) + +enum +{ /* PEAK chunk location. */ + SF_PEAK_START = 42, + SF_PEAK_END = 43, + + /* PEAK chunk location. */ + SF_SCALE_MAX = 52, + SF_SCALE_MIN = 53, + + /* str_flags values. */ + SF_STR_ALLOW_START = 0x0100, + SF_STR_ALLOW_END = 0x0200, + + /* Location of strings. */ + SF_STR_LOCATE_START = 0x0400, + SF_STR_LOCATE_END = 0x0800, + + SFD_TYPEMASK = 0x0FFFFFFF +} ; + +#define SFM_MASK (SFM_READ | SFM_WRITE | SFM_RDWR) +#define SFM_UNMASK (~SFM_MASK) + +/*--------------------------------------------------------------------------------------- +** Formats that may be supported at some time in the future. +** When support is finalised, these values move to src/sndfile.h. +*/ + +enum +{ /* Work in progress. */ + + /* Formats supported read only. */ + SF_FORMAT_WVE = 0x4020000, /* Psion ALaw Sound File */ + SF_FORMAT_TXW = 0x4030000, /* Yamaha TX16 sampler file */ + SF_FORMAT_DWD = 0x4040000, /* DiamondWare Digirized */ + + /* Following are detected but not supported. */ + SF_FORMAT_OGG = 0x4090000, + + SF_FORMAT_REX = 0x40A0000, /* Propellorheads Rex/Rcy */ + SF_FORMAT_REX2 = 0x40D0000, /* Propellorheads Rex2 */ + SF_FORMAT_KRZ = 0x40E0000, /* Kurzweil sampler file */ + SF_FORMAT_WMA = 0x4100000, /* Windows Media Audio. */ + SF_FORMAT_SHN = 0x4110000, /* Shorten. */ + SF_FORMAT_FLAC = 0x4120000, + + /* Unsupported encodings. */ + SF_FORMAT_VORBIS = 0x1001, + + SF_FORMAT_SVX_FIB = 0x1020, /* SVX Fibonacci Delta encoding. */ + SF_FORMAT_SVX_EXP = 0x1021, /* SVX Exponential Delta encoding. */ + + SF_FORMAT_PCM_N = 0x1030 +} ; + +/*--------------------------------------------------------------------------------------- +** PEAK_CHUNK - This chunk type is common to both AIFF and WAVE files although their +** endian encodings are different. +*/ + +typedef struct +{ float value ; /* signed value of peak */ + unsigned int position ; /* the sample frame for the peak */ +} PEAK_POS ; + +typedef struct +{ unsigned int version ; /* version of the PEAK chunk */ + unsigned int timestamp ; /* secs since 1/1/1970 */ +#if HAVE_FLEXIBLE_ARRAY + /* the per channel peak info */ + PEAK_POS peaks [] ; +#else + /* + ** This is not ISO compliant C. It works on some compilers which + ** don't support the ISO standard flexible struct array which is + ** used above. If your compiler doesn't ike this I suggest you find + ** youself a 1999 ISO C standards compilant compiler. GCC-3.X is + ** highly recommended. + */ + PEAK_POS peaks [0] ; +#endif +} PEAK_CHUNK ; + +typedef struct +{ int type ; + int flags ; + char *str ; +} STR_DATA ; + +/*======================================================================================= +** SF_PRIVATE stuct - a pointer to this struct is passed back to the caller of the +** sf_open_XXXX functions. The caller however has no knowledge of the struct's +** contents. +*/ + +typedef struct sf_private_tag +{ /* Force the compiler to double align the start of buffer. */ + union + { double dbuf [SF_BUFFER_LEN / sizeof (double)] ; +#if (defined (SIZEOF_INT64_T) && (SIZEOF_INT64_T == 8)) + int64_t lbuf [SF_BUFFER_LEN / sizeof (int64_t)] ; +#else + long lbuf [SF_BUFFER_LEN / sizeof (double)] ; +#endif + float fbuf [SF_BUFFER_LEN / sizeof (float)] ; + int ibuf [SF_BUFFER_LEN / sizeof (int)] ; + short sbuf [SF_BUFFER_LEN / sizeof (short)] ; + char cbuf [SF_BUFFER_LEN / sizeof (char)] ; + signed char scbuf [SF_BUFFER_LEN / sizeof (signed char)] ; + unsigned char ucbuf [SF_BUFFER_LEN / sizeof (signed char)] ; + } u ; + + char filepath [SF_FILENAME_LEN] ; + char rsrcpath [SF_FILENAME_LEN] ; + char filename [SF_FILENAME_LEN / 4] ; + + char syserr [SF_SYSERR_LEN] ; + + /* logbuffer and logindex should only be changed within the logging functions + ** of common.c + */ + char logbuffer [SF_BUFFER_LEN] ; + unsigned char header [SF_HEADER_LEN] ; /* Must be unsigned */ + int rwf_endian ; /* Header endian-ness flag. */ + + /* Storage and housekeeping data for adding/reading strings from + ** sound files. + */ + STR_DATA strings [SF_MAX_STRINGS] ; + char str_storage [SF_BUFFER_LEN] ; + char *str_end ; + int str_flags ; + + /* Guard value. If this changes the buffers above have overflowed. */ + int Magick ; + + /* Index variables for maintaining logbuffer and header above. */ + int logindex ; + int headindex, headend ; + int has_text ; + int do_not_close_descriptor ; + + /* File descriptors for the file and (possibly) the resource fork. */ + int filedes, rsrcdes ; + + int end_of_file ; + int error ; + + int mode ; /* Open mode : SFM_READ, SFM_WRITE or SFM_RDWR. */ + int endian ; /* File endianness : SF_ENDIAN_LITTLE or SF_ENDIAN_BIG. */ + int float_endswap ; /* Need to endswap float32s? */ + + /* + ** Maximum float value for calculating the multiplier for + ** float/double to short/int conversions. + */ + int float_int_mult ; + float float_max ; + + /* Vairables for handling pipes. */ + int is_pipe ; /* True if file is a pipe. */ + sf_count_t pipeoffset ; /* Number of bytes read from a pipe. */ + + /* True if clipping must be performed on float->int conversions. */ + int add_clipping ; + + SF_INFO sf ; + + int have_written ; /* Has a single write been done to the file? */ + int has_peak ; /* Has a PEAK chunk (AIFF and WAVE) been read? */ + int peak_loc ; /* Write a PEAK chunk at the start or end of the file? */ + PEAK_CHUNK *pchunk ; + + /* Loop Info */ + SF_LOOP_INFO *loop_info ; + + sf_count_t filelength ; /* Overall length of (embedded) file. */ + sf_count_t fileoffset ; /* Offset in number of bytes from beginning of file. */ + + sf_count_t rsrclength ; /* Length of the resource fork (if it exists). */ + + sf_count_t dataoffset ; /* Offset in number of bytes from beginning of file. */ + sf_count_t datalength ; /* Length in bytes of the audio data. */ + sf_count_t dataend ; /* Offset to file tailer. */ + + int blockwidth ; /* Size in bytes of one set of interleaved samples. */ + int bytewidth ; /* Size in bytes of one sample (one channel). */ + + void *dither ; + void *interleave ; + + int last_op ; /* Last operation; either SFM_READ or SFM_WRITE */ + sf_count_t read_current ; + sf_count_t write_current ; + + void *fdata ; /* This is a pointer to dynamically allocated file format + ** specific data. + */ + + SF_DITHER_INFO write_dither ; + SF_DITHER_INFO read_dither ; + + int norm_double ; + int norm_float ; + + int auto_header ; + + int ieee_replace ; + /* A set of file specific function pointers */ + + sf_count_t (*read_short) (struct sf_private_tag*, short *ptr, sf_count_t len) ; + sf_count_t (*read_int) (struct sf_private_tag*, int *ptr, sf_count_t len) ; + sf_count_t (*read_float) (struct sf_private_tag*, float *ptr, sf_count_t len) ; + sf_count_t (*read_double) (struct sf_private_tag*, double *ptr, sf_count_t len) ; + + sf_count_t (*write_short) (struct sf_private_tag*, short *ptr, sf_count_t len) ; + sf_count_t (*write_int) (struct sf_private_tag*, int *ptr, sf_count_t len) ; + sf_count_t (*write_float) (struct sf_private_tag*, float *ptr, sf_count_t len) ; + sf_count_t (*write_double) (struct sf_private_tag*, double *ptr, sf_count_t len) ; + + sf_count_t (*seek) (struct sf_private_tag*, int mode, sf_count_t samples_from_start) ; + int (*write_header) (struct sf_private_tag*, int calc_length) ; + int (*command) (struct sf_private_tag*, int command, void *data, int datasize) ; + int (*close) (struct sf_private_tag*) ; + + char *format_desc ; +} SF_PRIVATE ; + + + +enum +{ SFE_NO_ERROR = SF_ERR_NO_ERROR, + SFE_BAD_OPEN_FORMAT = SF_ERR_UNRECOGNISED_FORMAT, + SFE_SYSTEM = SF_ERR_SYSTEM, + + SFE_BAD_FILE, + SFE_BAD_FILE_READ, + SFE_OPEN_FAILED, + SFE_BAD_SNDFILE_PTR, + SFE_BAD_SF_INFO_PTR, + SFE_BAD_SF_INCOMPLETE, + SFE_BAD_FILE_PTR, + SFE_BAD_INT_PTR, + SFE_BAD_STAT_SIZE, + SFE_MALLOC_FAILED, + SFE_UNIMPLEMENTED, + SFE_BAD_READ_ALIGN, + SFE_BAD_WRITE_ALIGN, + SFE_UNKNOWN_FORMAT, + SFE_NOT_READMODE, + SFE_NOT_WRITEMODE, + SFE_BAD_MODE_RW, + SFE_BAD_SF_INFO, + SFE_BAD_OFFSET, + SFE_NO_EMBED_SUPPORT, + SFE_NO_EMBEDDED_RDWR, + SFE_NO_PIPE_WRITE, + + SFE_INTERNAL, + SFE_LOG_OVERRUN, + SFE_BAD_CONTROL_CMD, + SFE_BAD_ENDIAN, + SFE_CHANNEL_COUNT, + SFE_BAD_RDWR_FORMAT, + + SFE_INTERLEAVE_MODE, + SFE_INTERLEAVE_SEEK, + SFE_INTERLEAVE_READ, + + SFE_BAD_SEEK, + SFE_NOT_SEEKABLE, + SFE_AMBIGUOUS_SEEK, + SFE_WRONG_SEEK, + SFE_SEEK_FAILED, + + SFE_BAD_OPEN_MODE, + SFE_OPEN_PIPE_RDWR, + SFE_RDWR_POSITION, + SFE_RDWR_BAD_HEADER, + + SFE_STR_NO_SUPPORT, + SFE_STR_NOT_WRITE, + SFE_STR_MAX_DATA, + SFE_STR_MAX_COUNT, + SFE_STR_BAD_TYPE, + SFE_STR_NO_ADD_END, + SFE_STR_BAD_STRING, + SFE_STR_WEIRD, + + SFE_WAV_NO_RIFF, + SFE_WAV_NO_WAVE, + SFE_WAV_NO_FMT, + SFE_WAV_FMT_SHORT, + SFE_WAV_FMT_TOO_BIG, + SFE_WAV_BAD_FACT, + SFE_WAV_BAD_PEAK, + SFE_WAV_PEAK_B4_FMT, + SFE_WAV_BAD_FORMAT, + SFE_WAV_BAD_BLOCKALIGN, + SFE_WAV_NO_DATA, + SFE_WAV_ADPCM_NOT4BIT, + SFE_WAV_ADPCM_CHANNELS, + SFE_WAV_GSM610_FORMAT, + SFE_WAV_UNKNOWN_CHUNK, + SFE_WAV_WVPK_DATA, + + SFE_AIFF_NO_FORM, + SFE_AIFF_AIFF_NO_FORM, + SFE_AIFF_COMM_NO_FORM, + SFE_AIFF_SSND_NO_COMM, + SFE_AIFF_UNKNOWN_CHUNK, + SFE_AIFF_COMM_CHUNK_SIZE, + SFE_AIFF_BAD_COMM_CHUNK, + SFE_AIFF_PEAK_B4_COMM, + SFE_AIFF_BAD_PEAK, + SFE_AIFF_NO_SSND, + SFE_AIFF_NO_DATA, + SFE_AIFF_RW_SSND_NOT_LAST, + + SFE_AU_UNKNOWN_FORMAT, + SFE_AU_NO_DOTSND, + SFE_AU_EMBED_BAD_LEN, + + SFE_RAW_READ_BAD_SPEC, + SFE_RAW_BAD_BITWIDTH, + SFE_RAW_BAD_FORMAT, + + SFE_PAF_NO_MARKER, + SFE_PAF_VERSION, + SFE_PAF_UNKNOWN_FORMAT, + SFE_PAF_SHORT_HEADER, + + SFE_SVX_NO_FORM, + SFE_SVX_NO_BODY, + SFE_SVX_NO_DATA, + SFE_SVX_BAD_COMP, + SFE_SVX_BAD_NAME_LENGTH, + + SFE_NIST_BAD_HEADER, + SFE_NIST_CRLF_CONVERISON, + SFE_NIST_BAD_ENCODING, + + SFE_VOC_NO_CREATIVE, + SFE_VOC_BAD_FORMAT, + SFE_VOC_BAD_VERSION, + SFE_VOC_BAD_MARKER, + SFE_VOC_BAD_SECTIONS, + SFE_VOC_MULTI_SAMPLERATE, + SFE_VOC_MULTI_SECTION, + SFE_VOC_MULTI_PARAM, + SFE_VOC_SECTION_COUNT, + SFE_VOC_NO_PIPE, + + SFE_IRCAM_NO_MARKER, + SFE_IRCAM_BAD_CHANNELS, + SFE_IRCAM_UNKNOWN_FORMAT, + + SFE_W64_64_BIT, + SFE_W64_NO_RIFF, + SFE_W64_NO_WAVE, + SFE_W64_NO_FMT, + SFE_W64_NO_DATA, + SFE_W64_FMT_SHORT, + SFE_W64_FMT_TOO_BIG, + SFE_W64_ADPCM_NOT4BIT, + SFE_W64_ADPCM_CHANNELS, + SFE_W64_GSM610_FORMAT, + + SFE_MAT4_BAD_NAME, + SFE_MAT4_NO_SAMPLERATE, + SFE_MAT4_ZERO_CHANNELS, + + SFE_MAT5_BAD_ENDIAN, + SFE_MAT5_NO_BLOCK, + SFE_MAT5_SAMPLE_RATE, + SFE_MAT5_ZERO_CHANNELS, + + SFE_PVF_NO_PVF1, + SFE_PVF_BAD_HEADER, + SFE_PVF_BAD_BITWIDTH, + + SFE_DWVW_BAD_BITWIDTH, + SFE_G72X_NOT_MONO, + + SFE_XI_BAD_HEADER, + SFE_XI_EXCESS_SAMPLES, + SFE_XI_NO_PIPE, + + SFE_HTK_NO_PIPE, + + SFE_SDS_NOT_SDS, + SFE_SDS_BAD_BIT_WIDTH, + + SFE_SD2_FD_DISALLOWED, + SFE_SD2_BAD_DATA_OFFSET, + SFE_SD2_BAD_MAP_OFFSET, + SFE_SD2_BAD_DATA_LENGTH, + SFE_SD2_BAD_MAP_LENGTH, + SFE_SD2_BAD_RSRC, + SFE_SD2_BAD_SAMPLE_SIZE, + + SFE_MAX_ERROR /* This must be last in list. */ +} ; + +int subformat_to_bytewidth (int format) ; +int s_bitwidth_to_subformat (int bits) ; +int u_bitwidth_to_subformat (int bits) ; + +/* Functions for reading and writing floats and doubles on processors +** with non-IEEE floats/doubles. +*/ +float float32_be_read (unsigned char *cptr) ; +float float32_le_read (unsigned char *cptr) ; +void float32_be_write (float in, unsigned char *out) ; +void float32_le_write (float in, unsigned char *out) ; + +double double64_be_read (unsigned char *cptr) ; +double double64_le_read (unsigned char *cptr) ; +void double64_be_write (double in, unsigned char *out) ; +void double64_le_write (double in, unsigned char *out) ; + +/* Functions for writing to the internal logging buffer. */ + +void psf_log_printf (SF_PRIVATE *psf, const char *format, ...) ; +void psf_log_SF_INFO (SF_PRIVATE *psf) ; + +void psf_hexdump (void *ptr, int len) ; + +/* Functions used when writing file headers. */ + +int psf_binheader_writef (SF_PRIVATE *psf, const char *format, ...) ; +void psf_asciiheader_printf (SF_PRIVATE *psf, const char *format, ...) ; + +/* Functions used when reading file headers. */ + +int psf_binheader_readf (SF_PRIVATE *psf, char const *format, ...) ; + +/* Functions used in the write function for updating the peak chunk. */ + +void peak_update_short (SF_PRIVATE *psf, short *ptr, size_t items) ; +void peak_update_int (SF_PRIVATE *psf, int *ptr, size_t items) ; +void peak_update_double (SF_PRIVATE *psf, double *ptr, size_t items) ; + +/* Functions defined in command.c. */ + +int psf_get_format_simple_count (void) ; +int psf_get_format_simple (SF_FORMAT_INFO *data) ; + +int psf_get_format_info (SF_FORMAT_INFO *data) ; + +int psf_get_format_major_count (void) ; +int psf_get_format_major (SF_FORMAT_INFO *data) ; + +int psf_get_format_subtype_count (void) ; +int psf_get_format_subtype (SF_FORMAT_INFO *data) ; + +void psf_generate_format_desc (SF_PRIVATE *psf) ; + +double psf_calc_signal_max (SF_PRIVATE *psf, int normalize) ; +int psf_calc_max_all_channels (SF_PRIVATE *psf, double *peaks, int normalize) ; + +/* Functions in strings.c. */ + +const char* psf_get_string (SF_PRIVATE *psf, int str_type) ; +int psf_set_string (SF_PRIVATE *psf, int str_type, const char *str) ; +int psf_store_string (SF_PRIVATE *psf, int str_type, const char *str) ; + +/* Default seek function. Use for PCM and float encoded data. */ +sf_count_t psf_default_seek (SF_PRIVATE *psf, int mode, sf_count_t samples_from_start) ; + +/* Generate the currebt date as a string. */ +void psf_get_date_str (char *str, int maxlen) ; + +int macos_guess_file_type (SF_PRIVATE *psf, const char *filename) ; + +/*------------------------------------------------------------------------------------ +** File I/O functions which will allow access to large files (> 2 Gig) on +** some 32 bit OSes. Implementation in file_io.c. +*/ + +int psf_fopen (SF_PRIVATE *psf, const char *pathname, int flags) ; +int psf_set_stdio (SF_PRIVATE *psf, int mode) ; +int psf_filedes_valid (SF_PRIVATE *psf) ; +void psf_set_file (SF_PRIVATE *psf, int fd) ; + +sf_count_t psf_fseek (SF_PRIVATE *psf, sf_count_t offset, int whence) ; +sf_count_t psf_fread (void *ptr, sf_count_t bytes, sf_count_t count, SF_PRIVATE *psf) ; +sf_count_t psf_fwrite (const void *ptr, sf_count_t bytes, sf_count_t count, SF_PRIVATE *psf) ; +sf_count_t psf_fgets (char *buffer, sf_count_t bufsize, SF_PRIVATE *psf) ; +sf_count_t psf_ftell (SF_PRIVATE *psf) ; +sf_count_t psf_get_filelen (SF_PRIVATE *psf) ; + +int psf_is_pipe (SF_PRIVATE *psf) ; + +int psf_ftruncate (SF_PRIVATE *psf, sf_count_t len) ; +int psf_fclose (SF_PRIVATE *psf) ; + +/* Open and close the resource fork of a file. */ +int psf_open_rsrc (SF_PRIVATE *psf, int mode) ; +int psf_close_rsrc (SF_PRIVATE *psf) ; + +/* +void psf_fclearerr (SF_PRIVATE *psf) ; +int psf_ferror (SF_PRIVATE *psf) ; +*/ + +/*------------------------------------------------------------------------------------ +** Functions for reading and writing different file formats. +*/ + +int aiff_open (SF_PRIVATE *psf) ; +int au_open (SF_PRIVATE *psf) ; +int au_nh_open (SF_PRIVATE *psf) ; /* Headerless version of AU. */ +int avr_open (SF_PRIVATE *psf) ; +int htk_open (SF_PRIVATE *psf) ; +int ircam_open (SF_PRIVATE *psf) ; +int mat4_open (SF_PRIVATE *psf) ; +int mat5_open (SF_PRIVATE *psf) ; +int nist_open (SF_PRIVATE *psf) ; +int paf_open (SF_PRIVATE *psf) ; +int pvf_open (SF_PRIVATE *psf) ; +int raw_open (SF_PRIVATE *psf) ; +int sd2_open (SF_PRIVATE *psf) ; +int sds_open (SF_PRIVATE *psf) ; +int svx_open (SF_PRIVATE *psf) ; +int voc_open (SF_PRIVATE *psf) ; +int w64_open (SF_PRIVATE *psf) ; +int wav_open (SF_PRIVATE *psf) ; +int xi_open (SF_PRIVATE *psf) ; + +/* In progress. Do not currently work. */ + +int ogg_open (SF_PRIVATE *psf) ; +int rx2_open (SF_PRIVATE *psf) ; +int txw_open (SF_PRIVATE *psf) ; +int wve_open (SF_PRIVATE *psf) ; +int dwd_open (SF_PRIVATE *psf) ; + +int macbinary3_open (SF_PRIVATE *psf) ; + +/*------------------------------------------------------------------------------------ +** Init functions for a number of common data encodings. +*/ + +int pcm_init (SF_PRIVATE *psf) ; +int ulaw_init (SF_PRIVATE *psf) ; +int alaw_init (SF_PRIVATE *psf) ; +int float32_init (SF_PRIVATE *psf) ; +int double64_init (SF_PRIVATE *psf) ; +int dwvw_init (SF_PRIVATE *psf, int bitwidth) ; +int gsm610_init (SF_PRIVATE *psf) ; +int vox_adpcm_init (SF_PRIVATE *psf) ; + +int dither_init (SF_PRIVATE *psf, int mode) ; + +int wav_w64_ima_init (SF_PRIVATE *psf, int blockalign, int samplesperblock) ; +int wav_w64_msadpcm_init (SF_PRIVATE *psf, int blockalign, int samplesperblock) ; + +int aiff_ima_init (SF_PRIVATE *psf, int blockalign, int samplesperblock) ; + +int interleave_init (SF_PRIVATE *psf) ; + +/*------------------------------------------------------------------------------------ +** Other helper functions. +*/ + +void *psf_memset (void *s, int c, sf_count_t n) ; + +/*------------------------------------------------------------------------------------ +** Here's how we fix systems which don't snprintf / vsnprintf. +** Systems without these functions should use the +*/ + +#if (defined (WIN32) || defined (_WIN32)) +#define LSF_SNPRINTF _snprintf +#elif (HAVE_SNPRINTF && ! FORCE_MISSING_SNPRINTF) +#define LSF_SNPRINTF snprintf +#else +int missing_snprintf (char *str, size_t n, char const *fmt, ...) ; +#define LSF_SNPRINTF missing_snprintf +#endif + +#if (defined (WIN32) || defined (_WIN32)) +#define LSF_VSNPRINTF _vsnprintf +#elif (HAVE_VSNPRINTF && ! FORCE_MISSING_SNPRINTF) +#define LSF_VSNPRINTF vsnprintf +#else +int missing_vsnprintf (char *str, size_t n, const char *fmt, ...) ; +#define LSF_VSNPRINTF missing_vsnprintf +#endif + +#endif /* COMMON_H_INCLUDED */ + +/*------------------------------------------------------------------------------------ +** Extra commands for sf_command(). Not for public use yet. +*/ + +enum +{ SFC_TEST_AIFF_ADD_INST_CHUNK = 0x2000, + SFC_TEST_WAV_ADD_INFO_CHUNK = 0x2010 +} ; + +/* +** Maybe, one day, make these functions or something like them, public. +** +** Buffer to buffer dithering. Pointer in and out are allowed to point +** to the same buffer for in-place dithering. +*/ + +#if 0 +int sf_dither_short (const SF_DITHER_INFO *dither, const short *in, short *out, int count) ; +int sf_dither_int (const SF_DITHER_INFO *dither, const int *in, int *out, int count) ; +int sf_dither_float (const SF_DITHER_INFO *dither, const float *in, float *out, int count) ; +int sf_dither_double (const SF_DITHER_INFO *dither, const double *in, double *out, int count) ; +#endif +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: 7b45c0ee-5835-4a18-a4ef-994e4cd95b67 +*/ diff --git a/Libraries/SndFile/Files/src/config.h b/Libraries/SndFile/Files/src/config.h new file mode 100644 index 000000000..b1bf7d0e9 --- /dev/null +++ b/Libraries/SndFile/Files/src/config.h @@ -0,0 +1,239 @@ +/* src/config.h. Generated by configure. */ +/* src/config.h.in. Generated from configure.ac by autoheader. */ +//#error WTF +/* Set to 1 if the compile is GNU GCC. */ +#define COMPILER_IS_GCC 1 + +/* Target processor clips on negative float to int conversion. */ +#define CPU_CLIPS_NEGATIVE 1 + +/* Target processor clips on positive float to int conversion. */ +#define CPU_CLIPS_POSITIVE 1 + +/* Target processor is big endian. */ +#define CPU_IS_BIG_ENDIAN 1 + +/* Target processor is little endian. */ +#define CPU_IS_LITTLE_ENDIAN 0 + +/* Set to 1 to enable experimental code. */ +#define ENABLE_EXPERIMENTAL_CODE 0 + +/* Major version of GCC or 3 otherwise. */ +#define GCC_MAJOR_VERSION 3 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_ALSA_ASOUNDLIB_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_BYTESWAP_H */ + +/* Define to 1 if you have the `calloc' function. */ +#define HAVE_CALLOC 1 + +/* Define to 1 if you have the `ceil' function. */ +#define HAVE_CEIL 1 + +/* Set to 1 if S_IRGRP is defined. */ +#define HAVE_DECL_S_IRGRP 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_ENDIAN_H */ + +/* Define to 1 if you have the `fdatasync' function. */ +/* #undef HAVE_FDATASYNC */ + +/* Set to 1 if the compile supports the struct hack. */ +#define HAVE_FLEXIBLE_ARRAY 1 + +/* Define to 1 if you have the `floor' function. */ +#define HAVE_FLOOR 1 + +/* Define to 1 if you have the `fmod' function. */ +#define HAVE_FMOD 1 + +/* Define to 1 if you have the `free' function. */ +#define HAVE_FREE 1 + +/* Define to 1 if you have the `fstat' function. */ +#define HAVE_FSTAT 1 + +/* Define to 1 if you have the `fsync' function. */ +#define HAVE_FSYNC 1 + +/* Define to 1 if you have the `ftruncate' function. */ +#define HAVE_FTRUNCATE 1 + +/* Define to 1 if you have the `getpagesize' function. */ +#define HAVE_GETPAGESIZE 1 + +/* Define to 1 if you have the `gmtime' function. */ +#define HAVE_GMTIME 1 + +/* Define to 1 if you have the `gmtime_r' function. */ +#define HAVE_GMTIME_R 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the `m' library (-lm). */ +#define HAVE_LIBM 1 + +/* Define if you have C99's lrint function. */ +/* #undef HAVE_LRINT */ + +/* Define if you have C99's lrintf function. */ +/* #undef HAVE_LRINTF */ + +/* Define to 1 if you have the `lseek' function. */ +#define HAVE_LSEEK 1 + +/* Define to 1 if you have the `malloc' function. */ +#define HAVE_MALLOC 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the `mmap' function. */ +#define HAVE_MMAP 1 + +/* Define to 1 if you have the `open' function. */ +#define HAVE_OPEN 1 + +/* Define to 1 if you have the `pread' function. */ +#define HAVE_PREAD 1 + +/* Define to 1 if you have the `pwrite' function. */ +#define HAVE_PWRITE 1 + +/* Define to 1 if you have the `read' function. */ +#define HAVE_READ 1 + +/* Define to 1 if you have the `realloc' function. */ +#define HAVE_REALLOC 1 + +/* Define to 1 if you have the `snprintf' function. */ +#define HAVE_SNPRINTF 1 + +/* Define to 1 if the system has the type `ssize_t'. */ +#define HAVE_SSIZE_T 1 + +/* 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_STDLIB_H 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. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have that is POSIX.1 compatible. */ +#define HAVE_SYS_WAIT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if you have the `vsnprintf' function. */ +#define HAVE_VSNPRINTF 1 + +/* Define to 1 if you have the `write' function. */ +#define HAVE_WRITE 1 + +/* Set to 1 if compiling for MacOSX */ +#define OS_IS_MACOSX 1 + +/* Set to 1 if compiling for Win32 */ +#define OS_IS_WIN32 0 + +/* Name of package */ +#define PACKAGE "libsndfile" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "erikd@mega-nerd.com" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "libsndfile" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "libsndfile 1.0.11" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "libsndfile" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "1.0.11" + +/* Set to maximum allowed value of sf_count_t type. */ +#define SF_COUNT_MAX 0x7FFFFFFFFFFFFFFFLL + +/* The size of a `double', as computed by sizeof. */ +#define SIZEOF_DOUBLE 8 + +/* The size of a `float', as computed by sizeof. */ +#define SIZEOF_FLOAT 4 + +/* The size of a `int', as computed by sizeof. */ +#define SIZEOF_INT 4 + +/* The size of a `int64_t', as computed by sizeof. */ +#define SIZEOF_INT64_T 8 + +/* The size of a `loff_t', as computed by sizeof. */ +/* #undef SIZEOF_LOFF_T */ + +/* The size of a `long', as computed by sizeof. */ +#define SIZEOF_LONG 4 + +/* The size of a `long long', as computed by sizeof. */ +#define SIZEOF_LONG_LONG 8 + +/* The size of a `off64_t', as computed by sizeof. */ +/* #undef SIZEOF_OFF64_T */ + +/* The size of a `off_t', as computed by sizeof. */ +#define SIZEOF_OFF_T 8 + +/* Set to sizeof (long) if unknown. */ +#define SIZEOF_SF_COUNT_T 8 + +/* The size of a `short', as computed by sizeof. */ +#define SIZEOF_SHORT 2 + +/* The size of a `size_t', as computed by sizeof. */ +#define SIZEOF_SIZE_T 4 + +/* The size of a `ssize_t', as computed by sizeof. */ +#define SIZEOF_SSIZE_T 4 + +/* The size of a `void*', as computed by sizeof. */ +#define SIZEOF_VOIDP 4 + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Set to long if unknown. */ +#define TYPEOF_SF_COUNT_T off_t + +/* Version number of package */ +#define VERSION "1.0.11" + +/* Number of bits in a file offset, on hosts where this is settable. */ +/* #undef _FILE_OFFSET_BITS */ + +/* Define to make fseeko etc. visible, on some hosts. */ +/* #undef _LARGEFILE_SOURCE */ + +/* Define for large files, on AIX-style hosts. */ +/* #undef _LARGE_FILES */ diff --git a/Libraries/SndFile/Files/src/create_symbols_file.py b/Libraries/SndFile/Files/src/create_symbols_file.py new file mode 100755 index 000000000..de7a198b5 --- /dev/null +++ b/Libraries/SndFile/Files/src/create_symbols_file.py @@ -0,0 +1,147 @@ +#!/usr/bin/python + +# Copyright (C) 2003,2004 Erik de Castro Lopo +# +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the author nor the names of any contributors may be used +# to endorse or promote products derived from this software without +# specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import re, sys + +#---------------------------------------------------------------- +# These are all of the public functions exported from libsndfile. +# +# Its important not to change the order they are listed in or +# the ordinal values in the second column. + +ALL_SYMBOLS = ( + ( "sf_command", 1 ), + ( "sf_open", 2 ), + ( "sf_close", 3 ), + ( "sf_seek", 4 ), + ( "sf_error", 7 ), + ( "sf_perror", 8 ), + ( "sf_error_str", 9 ), + ( "sf_error_number", 10 ), + ( "sf_format_check", 11 ), + ( "sf_read_raw", 16 ), + ( "sf_readf_short", 17 ), + ( "sf_readf_int", 18 ), + ( "sf_readf_float", 19 ), + ( "sf_readf_double", 20 ), + ( "sf_read_short", 21 ), + ( "sf_read_int", 22 ), + ( "sf_read_float", 23 ), + ( "sf_read_double", 24 ), + ( "sf_write_raw", 32 ), + ( "sf_writef_short", 33 ), + ( "sf_writef_int", 34 ), + ( "sf_writef_float", 35 ), + ( "sf_writef_double", 36 ), + ( "sf_write_short", 37 ), + ( "sf_write_int", 38 ), + ( "sf_write_float", 39 ), + ( "sf_write_double", 40 ), + ( "sf_strerror", 50 ), + ( "sf_get_string", 60 ), + ( "sf_set_string", 61 ), + ( "sf_open_fd", 70 ) + ) + +#------------------------------------------------------------------------------- + +def linux_symbols (progname, version): + print "# Auto-generated by %s\n" %progname + print "libsndfile.so.%s" % version + print "{" + print " global:" + for name, ordinal in ALL_SYMBOLS: + print " %s ;" % name + print " local:" + print " * ;" + print "} ;" + print + return + +def darwin_symbols (progname, version): + print "# Auto-generated by %s\n" %progname + for name, ordinal in ALL_SYMBOLS: + print "_%s" % name + print + return + +def win32_symbols (progname, version): + print "; Auto-generated by %s\n" %progname + print "LIBRARY libsndfile.dll" + print "EXPORTS\n" + for name, ordinal in ALL_SYMBOLS: + print "%-20s @%s" % (name, ordinal) + print + return + +def no_symbols (os_name): + print + print "No known way of restricting exported symbols on '%s'." % os_name + print "If you know a way, please contact the author." + print + return + +#------------------------------------------------------------------------------- + +progname = re.sub (".*[\\/]", "", sys.argv [0]) + +if len (sys.argv) != 3: + print + print "Usage : %s ." % progname + print + print " Currently supported values for target OS are:" + print " linux" + print " darwin (ie MacOSX)" + print " win32 (ie wintendo)" + print + sys.exit (1) + +os_name = sys.argv [1] +version = re.sub ("\.[a-z0-9]+$", "", sys.argv [2]) + +if os_name == "linux": + linux_symbols (progname, version) +elif os_name == "darwin": + darwin_symbols (progname, version) +elif os_name == "win32": + win32_symbols (progname, version) +else: + no_symbols (os_name) + +sys.exit (0) + +# Do not edit or modify anything in this comment block. +# The arch-tag line is a file identity tag for the GNU Arch +# revision control system. +# +# arch-tag: 5814f35c-318f-4023-a0c3-d9cf7c9e5f6c + diff --git a/Libraries/SndFile/Files/src/dither.c b/Libraries/SndFile/Files/src/dither.c new file mode 100644 index 000000000..fb25c5c05 --- /dev/null +++ b/Libraries/SndFile/Files/src/dither.c @@ -0,0 +1,534 @@ +/* +** Copyright (C) 2003,2004 Erik de Castro Lopo +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU Lesser General Public License as published by +** the Free Software Foundation; either version 2.1 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU Lesser General Public License for more details. +** +** You should have received a copy of the GNU Lesser General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include + +#include "sndfile.h" +#include "config.h" +#include "sfendian.h" +#include "common.h" + +/*============================================================================ +** Rule number 1 is to only apply dither when going from a larger bitwidth +** to a smaller bitwidth. This can happen on both read and write. +** +** Need to apply dither on all conversions marked X below. +** +** Dither on write: +** +** Input +** | short int float double +** --------+----------------------------------------------- +** O 8 bit | X X X X +** u 16 bit | none X X X +** t 24 bit | none X X X +** p 32 bit | none none X X +** u float | none none none none +** t double | none none none none +** +** Dither on read: +** +** Input +** O | 8 bit 16 bit 24 bit 32 bit float double +** u --------+------------------------------------------------- +** t short | none none X X X X +** p int | none none none X X X +** u float | none none none none none none +** t double | none none none none none none +*/ + +#define SFE_DITHER_BAD_PTR 666 +#define SFE_DITHER_BAD_TYPE 667 + +typedef struct +{ int read_short_dither_bits, read_int_dither_bits ; + int write_short_dither_bits, write_int_dither_bits ; + double read_float_dither_scale, read_double_dither_bits ; + double write_float_dither_scale, write_double_dither_bits ; + + sf_count_t (*read_short) (SF_PRIVATE *psf, short *ptr, sf_count_t len) ; + sf_count_t (*read_int) (SF_PRIVATE *psf, int *ptr, sf_count_t len) ; + sf_count_t (*read_float) (SF_PRIVATE *psf, float *ptr, sf_count_t len) ; + sf_count_t (*read_double) (SF_PRIVATE *psf, double *ptr, sf_count_t len) ; + + sf_count_t (*write_short) (SF_PRIVATE *psf, short *ptr, sf_count_t len) ; + sf_count_t (*write_int) (SF_PRIVATE *psf, int *ptr, sf_count_t len) ; + sf_count_t (*write_float) (SF_PRIVATE *psf, float *ptr, sf_count_t len) ; + sf_count_t (*write_double) (SF_PRIVATE *psf, double *ptr, sf_count_t len) ; + + double buffer [SF_BUFFER_LEN / sizeof (double)] ; +} DITHER_DATA ; + +static sf_count_t dither_read_short (SF_PRIVATE *psf, short *ptr, sf_count_t len) ; +static sf_count_t dither_read_int (SF_PRIVATE *psf, int *ptr, sf_count_t len) ; + +static sf_count_t dither_write_short (SF_PRIVATE *psf, short *ptr, sf_count_t len) ; +static sf_count_t dither_write_int (SF_PRIVATE *psf, int *ptr, sf_count_t len) ; +static sf_count_t dither_write_float (SF_PRIVATE *psf, float *ptr, sf_count_t len) ; +static sf_count_t dither_write_double (SF_PRIVATE *psf, double *ptr, sf_count_t len) ; + +int +dither_init (SF_PRIVATE *psf, int mode) +{ DITHER_DATA *pdither ; + + pdither = psf->dither ; /* This may be NULL. */ + + /* Turn off dither on read. */ + if (mode == SFM_READ && psf->read_dither.type == SFD_NO_DITHER) + { if (pdither == NULL) + return 0 ; /* Dither is already off, so just return. */ + + if (pdither->read_short) + psf->read_short = pdither->read_short ; + if (pdither->read_int) + psf->read_int = pdither->read_int ; + if (pdither->read_float) + psf->read_float = pdither->read_float ; + if (pdither->read_double) + psf->read_double = pdither->read_double ; + return 0 ; + } ; + + /* Turn off dither on write. */ + if (mode == SFM_WRITE && psf->write_dither.type == SFD_NO_DITHER) + { if (pdither == NULL) + return 0 ; /* Dither is already off, so just return. */ + + if (pdither->write_short) + psf->write_short = pdither->write_short ; + if (pdither->write_int) + psf->write_int = pdither->write_int ; + if (pdither->write_float) + psf->write_float = pdither->write_float ; + if (pdither->write_double) + psf->write_double = pdither->write_double ; + return 0 ; + } ; + + /* Turn on dither on read if asked. */ + if (mode == SFM_READ && psf->read_dither.type != 0) + { if (pdither == NULL) + pdither = psf->dither = calloc (1, sizeof (DITHER_DATA)) ; + if (pdither == NULL) + return SFE_MALLOC_FAILED ; + + switch (psf->sf.format & SF_FORMAT_SUBMASK) + { case SF_FORMAT_DOUBLE : + case SF_FORMAT_FLOAT : + pdither->read_int = psf->read_int ; + psf->read_int = dither_read_int ; + + case SF_FORMAT_PCM_32 : + case SF_FORMAT_PCM_24 : + case SF_FORMAT_PCM_16 : + case SF_FORMAT_PCM_S8 : + case SF_FORMAT_PCM_U8 : + pdither->read_short = psf->read_short ; + psf->read_short = dither_read_short ; + + default : break ; + } ; + } ; + + /* Turn on dither on write if asked. */ + if (mode == SFM_WRITE && psf->write_dither.type != 0) + { if (pdither == NULL) + pdither = psf->dither = calloc (1, sizeof (DITHER_DATA)) ; + if (pdither == NULL) + return SFE_MALLOC_FAILED ; + + switch (psf->sf.format & SF_FORMAT_SUBMASK) + { case SF_FORMAT_DOUBLE : + case SF_FORMAT_FLOAT : + pdither->write_int = psf->write_int ; + psf->write_int = dither_write_int ; + + case SF_FORMAT_PCM_32 : + case SF_FORMAT_PCM_24 : + case SF_FORMAT_PCM_16 : + case SF_FORMAT_PCM_S8 : + case SF_FORMAT_PCM_U8 : + + default : break ; + } ; + + pdither->write_short = psf->write_short ; + psf->write_short = dither_write_short ; + + pdither->write_int = psf->write_int ; + psf->write_int = dither_write_int ; + + pdither->write_float = psf->write_float ; + psf->write_float = dither_write_float ; + + pdither->write_double = psf->write_double ; + psf->write_double = dither_write_double ; + } ; + + return 0 ; +} /* dither_init */ + +/*============================================================================== +*/ + +static void dither_short (const short *in, short *out, int frames, int channels) ; +static void dither_int (const int *in, int *out, int frames, int channels) ; + +static void dither_float (const float *in, float *out, int frames, int channels) ; +static void dither_double (const double *in, double *out, int frames, int channels) ; + +static sf_count_t +dither_read_short (SF_PRIVATE *psf, short *ptr, sf_count_t len) +{ psf = psf ; + ptr = ptr ; + return len ; +} /* dither_read_short */ + +static sf_count_t +dither_read_int (SF_PRIVATE *psf, int *ptr, sf_count_t len) +{ psf = psf ; + ptr = ptr ; + return len ; +} /* dither_read_int */ + +/*------------------------------------------------------------------------------ +*/ + +static sf_count_t +dither_write_short (SF_PRIVATE *psf, short *ptr, sf_count_t len) +{ DITHER_DATA *pdither ; + int bufferlen, writecount, thiswrite ; + sf_count_t total = 0 ; + + if ((pdither = psf->dither) == NULL) + { psf->error = SFE_DITHER_BAD_PTR ; + return 0 ; + } ; + + switch (psf->sf.format & SF_FORMAT_SUBMASK) + { case SF_FORMAT_PCM_S8 : + case SF_FORMAT_PCM_U8 : + case SF_FORMAT_DPCM_8 : + break ; + + default : + return pdither->write_short (psf, ptr, len) ; + } ; + + bufferlen = sizeof (pdither->buffer) / sizeof (short) ; + + while (len > 0) + { writecount = (len >= bufferlen) ? bufferlen : (int) len ; + writecount /= psf->sf.channels ; + writecount *= psf->sf.channels ; + + dither_short (ptr, (short*) pdither->buffer, writecount / psf->sf.channels, psf->sf.channels) ; + + thiswrite = pdither->write_short (psf, (short*) pdither->buffer, writecount) ; + total += thiswrite ; + len -= thiswrite ; + if (thiswrite < writecount) + break ; + } ; + + return total ; +} /* dither_write_short */ + +static sf_count_t +dither_write_int (SF_PRIVATE *psf, int *ptr, sf_count_t len) +{ DITHER_DATA *pdither ; + int bufferlen, writecount, thiswrite ; + sf_count_t total = 0 ; + + if ((pdither = psf->dither) == NULL) + { psf->error = SFE_DITHER_BAD_PTR ; + return 0 ; + } ; + + switch (psf->sf.format & SF_FORMAT_SUBMASK) + { case SF_FORMAT_PCM_S8 : + case SF_FORMAT_PCM_U8 : + case SF_FORMAT_PCM_16 : + case SF_FORMAT_PCM_24 : + + case SF_FORMAT_DPCM_8 : + case SF_FORMAT_DPCM_16 : + break ; + + default : + return pdither->write_int (psf, ptr, len) ; + } ; + + + bufferlen = sizeof (pdither->buffer) / sizeof (int) ; + + while (len > 0) + { writecount = (len >= bufferlen) ? bufferlen : (int) len ; + writecount /= psf->sf.channels ; + writecount *= psf->sf.channels ; + + dither_int (ptr, (int*) pdither->buffer, writecount / psf->sf.channels, psf->sf.channels) ; + + thiswrite = pdither->write_int (psf, (int*) pdither->buffer, writecount) ; + total += thiswrite ; + len -= thiswrite ; + if (thiswrite < writecount) + break ; + } ; + + return total ; +} /* dither_write_int */ + +static sf_count_t +dither_write_float (SF_PRIVATE *psf, float *ptr, sf_count_t len) +{ DITHER_DATA *pdither ; + int bufferlen, writecount, thiswrite ; + sf_count_t total = 0 ; + + if ((pdither = psf->dither) == NULL) + { psf->error = SFE_DITHER_BAD_PTR ; + return 0 ; + } ; + + switch (psf->sf.format & SF_FORMAT_SUBMASK) + { case SF_FORMAT_PCM_S8 : + case SF_FORMAT_PCM_U8 : + case SF_FORMAT_PCM_16 : + case SF_FORMAT_PCM_24 : + + case SF_FORMAT_DPCM_8 : + case SF_FORMAT_DPCM_16 : + break ; + + default : + return pdither->write_float (psf, ptr, len) ; + } ; + + bufferlen = sizeof (pdither->buffer) / sizeof (float) ; + + while (len > 0) + { writecount = (len >= bufferlen) ? bufferlen : (float) len ; + writecount /= psf->sf.channels ; + writecount *= psf->sf.channels ; + + dither_float (ptr, (float*) pdither->buffer, writecount / psf->sf.channels, psf->sf.channels) ; + + thiswrite = pdither->write_float (psf, (float*) pdither->buffer, writecount) ; + total += thiswrite ; + len -= thiswrite ; + if (thiswrite < writecount) + break ; + } ; + + return total ; +} /* dither_write_float */ + +static sf_count_t +dither_write_double (SF_PRIVATE *psf, double *ptr, sf_count_t len) +{ DITHER_DATA *pdither ; + int bufferlen, writecount, thiswrite ; + sf_count_t total = 0 ; + + if ((pdither = psf->dither) == NULL) + { psf->error = SFE_DITHER_BAD_PTR ; + return 0 ; + } ; + + switch (psf->sf.format & SF_FORMAT_SUBMASK) + { case SF_FORMAT_PCM_S8 : + case SF_FORMAT_PCM_U8 : + case SF_FORMAT_PCM_16 : + case SF_FORMAT_PCM_24 : + + case SF_FORMAT_DPCM_8 : + case SF_FORMAT_DPCM_16 : + break ; + + default : + return pdither->write_double (psf, ptr, len) ; + } ; + + + bufferlen = sizeof (pdither->buffer) / sizeof (double) ; + + while (len > 0) + { writecount = (len >= bufferlen) ? bufferlen : (double) len ; + writecount /= psf->sf.channels ; + writecount *= psf->sf.channels ; + + dither_double (ptr, (double*) pdither->buffer, writecount / psf->sf.channels, psf->sf.channels) ; + + thiswrite = pdither->write_double (psf, (double*) pdither->buffer, writecount) ; + total += thiswrite ; + len -= thiswrite ; + if (thiswrite < writecount) + break ; + } ; + + return total ; +} /* dither_write_double */ + +/*============================================================================== +*/ + +static void +dither_short (const short *in, short *out, int frames, int channels) +{ int ch, k ; + + for (ch = 0 ; ch < channels ; ch++) + for (k = ch ; k < channels * frames ; k += channels) + out [k] = in [k] ; + +} /* dither_short */ + +static void +dither_int (const int *in, int *out, int frames, int channels) +{ int ch, k ; + + for (ch = 0 ; ch < channels ; ch++) + for (k = ch ; k < channels * frames ; k += channels) + out [k] = in [k] ; + +} /* dither_int */ + +static void +dither_float (const float *in, float *out, int frames, int channels) +{ int ch, k ; + + for (ch = 0 ; ch < channels ; ch++) + for (k = ch ; k < channels * frames ; k += channels) + out [k] = in [k] ; + +} /* dither_float */ + +static void +dither_double (const double *in, double *out, int frames, int channels) +{ int ch, k ; + + for (ch = 0 ; ch < channels ; ch++) + for (k = ch ; k < channels * frames ; k += channels) + out [k] = in [k] ; + +} /* dither_double */ + +/*============================================================================== +*/ +#if 0 + +/* +** Not made public because this (maybe) requires storage of state information. +** +** Also maybe need separate state info for each channel!!!! +*/ + +int +DO_NOT_USE_sf_dither_short (const SF_DITHER_INFO *dither, const short *in, short *out, int frames, int channels) +{ int ch, k ; + + if (! dither) + return SFE_DITHER_BAD_PTR ; + + switch (dither->type & SFD_TYPEMASK) + { case SFD_WHITE : + case SFD_TRIANGULAR_PDF : + for (ch = 0 ; ch < channels ; ch++) + for (k = ch ; k < channels * frames ; k += channels) + out [k] = in [k] ; + break ; + + default : + return SFE_DITHER_BAD_TYPE ; + } ; + + return 0 ; +} /* DO_NOT_USE_sf_dither_short */ + +int +DO_NOT_USE_sf_dither_int (const SF_DITHER_INFO *dither, const int *in, int *out, int frames, int channels) +{ int ch, k ; + + if (! dither) + return SFE_DITHER_BAD_PTR ; + + switch (dither->type & SFD_TYPEMASK) + { case SFD_WHITE : + case SFD_TRIANGULAR_PDF : + for (ch = 0 ; ch < channels ; ch++) + for (k = ch ; k < channels * frames ; k += channels) + out [k] = in [k] ; + break ; + + default : + return SFE_DITHER_BAD_TYPE ; + } ; + + return 0 ; +} /* DO_NOT_USE_sf_dither_int */ + +int +DO_NOT_USE_sf_dither_float (const SF_DITHER_INFO *dither, const float *in, float *out, int frames, int channels) +{ int ch, k ; + + if (! dither) + return SFE_DITHER_BAD_PTR ; + + switch (dither->type & SFD_TYPEMASK) + { case SFD_WHITE : + case SFD_TRIANGULAR_PDF : + for (ch = 0 ; ch < channels ; ch++) + for (k = ch ; k < channels * frames ; k += channels) + out [k] = in [k] ; + break ; + + default : + return SFE_DITHER_BAD_TYPE ; + } ; + + return 0 ; +} /* DO_NOT_USE_sf_dither_float */ + +int +DO_NOT_USE_sf_dither_double (const SF_DITHER_INFO *dither, const double *in, double *out, int frames, int channels) +{ int ch, k ; + + if (! dither) + return SFE_DITHER_BAD_PTR ; + + switch (dither->type & SFD_TYPEMASK) + { case SFD_WHITE : + case SFD_TRIANGULAR_PDF : + for (ch = 0 ; ch < channels ; ch++) + for (k = ch ; k < channels * frames ; k += channels) + out [k] = in [k] ; + break ; + + default : + return SFE_DITHER_BAD_TYPE ; + } ; + + return 0 ; +} /* DO_NOT_USE_sf_dither_double */ + +#endif +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: 673fad58-5314-421c-9144-9d54bfdf104c +*/ diff --git a/Libraries/SndFile/Files/src/double64.c b/Libraries/SndFile/Files/src/double64.c new file mode 100644 index 000000000..091babc44 --- /dev/null +++ b/Libraries/SndFile/Files/src/double64.c @@ -0,0 +1,1007 @@ +/* +** Copyright (C) 1999-2004 Erik de Castro Lopo +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU Lesser General Public License as published by +** the Free Software Foundation; either version 2.1 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU Lesser General Public License for more details. +** +** You should have received a copy of the GNU Lesser General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + + +#include +#include +#include + +#include "sndfile.h" +#include "config.h" +#include "sfendian.h" +#include "common.h" +#include "float_cast.h" + +#if CPU_IS_LITTLE_ENDIAN + #define DOUBLE64_READ double64_le_read + #define DOUBLE64_WRITE double64_le_write +#elif CPU_IS_BIG_ENDIAN + #define DOUBLE64_READ double64_be_read + #define DOUBLE64_WRITE double64_be_write +#endif + +/* A 32 number which will not overflow when multiplied by sizeof (double). */ +#define SENSIBLE_LEN (0x8000000) + +/*-------------------------------------------------------------------------------------------- +** Processor floating point capabilities. double64_get_capability () returns one of the +** latter three values. +*/ + +enum +{ DOUBLE_UNKNOWN = 0x00, + DOUBLE_CAN_RW_LE = 0x23, + DOUBLE_CAN_RW_BE = 0x34, + DOUBLE_BROKEN_LE = 0x45, + DOUBLE_BROKEN_BE = 0x56 +} ; + +/*-------------------------------------------------------------------------------------------- +** Prototypes for private functions. +*/ + +static sf_count_t host_read_d2s (SF_PRIVATE *psf, short *ptr, sf_count_t len) ; +static sf_count_t host_read_d2i (SF_PRIVATE *psf, int *ptr, sf_count_t len) ; +static sf_count_t host_read_d2f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ; +static sf_count_t host_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ; + +static sf_count_t host_write_s2d (SF_PRIVATE *psf, short *ptr, sf_count_t len) ; +static sf_count_t host_write_i2d (SF_PRIVATE *psf, int *ptr, sf_count_t len) ; +static sf_count_t host_write_f2d (SF_PRIVATE *psf, float *ptr, sf_count_t len) ; +static sf_count_t host_write_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ; + +static void double64_peak_update (SF_PRIVATE *psf, double *buffer, int count, int indx) ; + +static int double64_get_capability (SF_PRIVATE *psf) ; + +static sf_count_t replace_read_d2s (SF_PRIVATE *psf, short *ptr, sf_count_t len) ; +static sf_count_t replace_read_d2i (SF_PRIVATE *psf, int *ptr, sf_count_t len) ; +static sf_count_t replace_read_d2f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ; +static sf_count_t replace_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ; + +static sf_count_t replace_write_s2d (SF_PRIVATE *psf, short *ptr, sf_count_t len) ; +static sf_count_t replace_write_i2d (SF_PRIVATE *psf, int *ptr, sf_count_t len) ; +static sf_count_t replace_write_f2d (SF_PRIVATE *psf, float *ptr, sf_count_t len) ; +static sf_count_t replace_write_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ; + +static void d2bd_read (double *buffer, int count) ; +static void bd2d_write (double *buffer, int count) ; + +/*-------------------------------------------------------------------------------------------- +** Exported functions. +*/ + +int +double64_init (SF_PRIVATE *psf) +{ static int double64_caps ; + + double64_caps = double64_get_capability (psf) ; + + psf->blockwidth = sizeof (double) * psf->sf.channels ; + + if (psf->mode == SFM_READ || psf->mode == SFM_RDWR) + { switch (psf->endian + double64_caps) + { case (SF_ENDIAN_BIG + DOUBLE_CAN_RW_BE) : + psf->float_endswap = SF_FALSE ; + psf->read_short = host_read_d2s ; + psf->read_int = host_read_d2i ; + psf->read_float = host_read_d2f ; + psf->read_double = host_read_d ; + break ; + + case (SF_ENDIAN_LITTLE + DOUBLE_CAN_RW_LE) : + psf->float_endswap = SF_FALSE ; + psf->read_short = host_read_d2s ; + psf->read_int = host_read_d2i ; + psf->read_float = host_read_d2f ; + psf->read_double = host_read_d ; + break ; + + case (SF_ENDIAN_BIG + DOUBLE_CAN_RW_LE) : + psf->float_endswap = SF_TRUE ; + psf->read_short = host_read_d2s ; + psf->read_int = host_read_d2i ; + psf->read_float = host_read_d2f ; + psf->read_double = host_read_d ; + break ; + + case (SF_ENDIAN_LITTLE + DOUBLE_CAN_RW_BE) : + psf->float_endswap = SF_TRUE ; + psf->read_short = host_read_d2s ; + psf->read_int = host_read_d2i ; + psf->read_float = host_read_d2f ; + psf->read_double = host_read_d ; + break ; + + /* When the CPU is not IEEE compatible. */ + case (SF_ENDIAN_BIG + DOUBLE_BROKEN_BE) : + psf->float_endswap = SF_FALSE ; + psf->read_short = replace_read_d2s ; + psf->read_int = replace_read_d2i ; + psf->read_float = replace_read_d2f ; + psf->read_double = replace_read_d ; + break ; + + case (SF_ENDIAN_LITTLE + DOUBLE_BROKEN_LE) : + psf->float_endswap = SF_FALSE ; + psf->read_short = replace_read_d2s ; + psf->read_int = replace_read_d2i ; + psf->read_float = replace_read_d2f ; + psf->read_double = replace_read_d ; + break ; + + case (SF_ENDIAN_BIG + DOUBLE_BROKEN_LE) : + psf->float_endswap = SF_TRUE ; + psf->read_short = replace_read_d2s ; + psf->read_int = replace_read_d2i ; + psf->read_float = replace_read_d2f ; + psf->read_double = replace_read_d ; + break ; + + case (SF_ENDIAN_LITTLE + DOUBLE_BROKEN_BE) : + psf->float_endswap = SF_TRUE ; + psf->read_short = replace_read_d2s ; + psf->read_int = replace_read_d2i ; + psf->read_float = replace_read_d2f ; + psf->read_double = replace_read_d ; + break ; + + default : break ; + } ; + } ; + + if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR) + { switch (psf->endian + double64_caps) + { case (SF_ENDIAN_LITTLE + DOUBLE_CAN_RW_LE) : + psf->float_endswap = SF_FALSE ; + psf->write_short = host_write_s2d ; + psf->write_int = host_write_i2d ; + psf->write_float = host_write_f2d ; + psf->write_double = host_write_d ; + break ; + + case (SF_ENDIAN_BIG + DOUBLE_CAN_RW_BE) : + psf->float_endswap = SF_FALSE ; + psf->write_short = host_write_s2d ; + psf->write_int = host_write_i2d ; + psf->write_float = host_write_f2d ; + psf->write_double = host_write_d ; + break ; + + case (SF_ENDIAN_BIG + DOUBLE_CAN_RW_LE) : + psf->float_endswap = SF_TRUE ; + psf->write_short = host_write_s2d ; + psf->write_int = host_write_i2d ; + psf->write_float = host_write_f2d ; + psf->write_double = host_write_d ; + break ; + + case (SF_ENDIAN_LITTLE + DOUBLE_CAN_RW_BE) : + psf->float_endswap = SF_TRUE ; + psf->write_short = host_write_s2d ; + psf->write_int = host_write_i2d ; + psf->write_float = host_write_f2d ; + psf->write_double = host_write_d ; + break ; + + /* When the CPU is not IEEE compatible. */ + case (SF_ENDIAN_LITTLE + DOUBLE_BROKEN_LE) : + psf->float_endswap = SF_FALSE ; + psf->write_short = replace_write_s2d ; + psf->write_int = replace_write_i2d ; + psf->write_float = replace_write_f2d ; + psf->write_double = replace_write_d ; + break ; + + case (SF_ENDIAN_BIG + DOUBLE_BROKEN_BE) : + psf->float_endswap = SF_FALSE ; + psf->write_short = replace_write_s2d ; + psf->write_int = replace_write_i2d ; + psf->write_float = replace_write_f2d ; + psf->write_double = replace_write_d ; + break ; + + case (SF_ENDIAN_BIG + DOUBLE_BROKEN_LE) : + psf->float_endswap = SF_TRUE ; + psf->write_short = replace_write_s2d ; + psf->write_int = replace_write_i2d ; + psf->write_float = replace_write_f2d ; + psf->write_double = replace_write_d ; + break ; + + case (SF_ENDIAN_LITTLE + DOUBLE_BROKEN_BE) : + psf->float_endswap = SF_TRUE ; + psf->write_short = replace_write_s2d ; + psf->write_int = replace_write_i2d ; + psf->write_float = replace_write_f2d ; + psf->write_double = replace_write_d ; + break ; + + default : break ; + } ; + } ; + + if (psf->filelength > psf->dataoffset) + { psf->datalength = (psf->dataend > 0) ? psf->dataend - psf->dataoffset : + psf->filelength - psf->dataoffset ; + } + else + psf->datalength = 0 ; + + psf->sf.frames = psf->datalength / psf->blockwidth ; + + return 0 ; +} /* double64_init */ + +/*---------------------------------------------------------------------------- +** From : http://www.hpcf.cam.ac.uk/fp_formats.html +** +** 64 bit double precision layout (big endian) +** Sign bit 0 +** Exponent bits 1-11 +** Mantissa bits 12-63 +** Exponent Offset 1023 +** +** double single +** +** +INF 7FF0000000000000 7F800000 +** -INF FFF0000000000000 FF800000 +** NaN 7FF0000000000001 7F800001 +** to to +** 7FFFFFFFFFFFFFFF 7FFFFFFF +** and and +** FFF0000000000001 FF800001 +** to to +** FFFFFFFFFFFFFFFF FFFFFFFF +** +OVER 7FEFFFFFFFFFFFFF 7F7FFFFF +** -OVER FFEFFFFFFFFFFFFF FF7FFFFF +** +UNDER 0010000000000000 00800000 +** -UNDER 8010000000000000 80800000 +*/ + +double +double64_be_read (unsigned char *cptr) +{ int exponent, negative ; + double dvalue ; + + negative = (cptr [0] & 0x80) ? 1 : 0 ; + exponent = ((cptr [0] & 0x7F) << 4) | ((cptr [1] >> 4) & 0xF) ; + + /* Might not have a 64 bit long, so load the mantissa into a double. */ + dvalue = (((cptr [1] & 0xF) << 24) | (cptr [2] << 16) | (cptr [3] << 8) | cptr [4]) ; + dvalue += ((cptr [5] << 16) | (cptr [6] << 8) | cptr [7]) / ((double) 0x1000000) ; + + if (exponent == 0 && dvalue == 0.0) + return 0.0 ; + + dvalue += 0x10000000 ; + + exponent = exponent - 0x3FF ; + + dvalue = dvalue / ((double) 0x10000000) ; + + if (negative) + dvalue *= -1 ; + + if (exponent > 0) + dvalue *= (1 << exponent) ; + else if (exponent < 0) + dvalue /= (1 << abs (exponent)) ; + + return dvalue ; +} /* double64_be_read */ + +double +double64_le_read (unsigned char *cptr) +{ int exponent, negative ; + double dvalue ; + + negative = (cptr [7] & 0x80) ? 1 : 0 ; + exponent = ((cptr [7] & 0x7F) << 4) | ((cptr [6] >> 4) & 0xF) ; + + /* Might not have a 64 bit long, so load the mantissa into a double. */ + dvalue = (((cptr [6] & 0xF) << 24) | (cptr [5] << 16) | (cptr [4] << 8) | cptr [3]) ; + dvalue += ((cptr [2] << 16) | (cptr [1] << 8) | cptr [0]) / ((double) 0x1000000) ; + + if (exponent == 0 && dvalue == 0.0) + return 0.0 ; + + dvalue += 0x10000000 ; + + exponent = exponent - 0x3FF ; + + dvalue = dvalue / ((double) 0x10000000) ; + + if (negative) + dvalue *= -1 ; + + if (exponent > 0) + dvalue *= (1 << exponent) ; + else if (exponent < 0) + dvalue /= (1 << abs (exponent)) ; + + return dvalue ; +} /* double64_le_read */ + +void +double64_be_write (double in, unsigned char *out) +{ int exponent, mantissa ; + + memset (out, 0, sizeof (double)) ; + + if (in == 0.0) + return ; + + if (in < 0.0) + { in *= -1.0 ; + out [0] |= 0x80 ; + } ; + + in = frexp (in, &exponent) ; + + exponent += 1022 ; + + out [0] |= (exponent >> 4) & 0x7F ; + out [1] |= (exponent << 4) & 0xF0 ; + + in *= 0x20000000 ; + mantissa = lrint (floor (in)) ; + + out [1] |= (mantissa >> 24) & 0xF ; + out [2] = (mantissa >> 16) & 0xFF ; + out [3] = (mantissa >> 8) & 0xFF ; + out [4] = mantissa & 0xFF ; + + in = fmod (in, 1.0) ; + in *= 0x1000000 ; + mantissa = lrint (floor (in)) ; + + out [5] = (mantissa >> 16) & 0xFF ; + out [6] = (mantissa >> 8) & 0xFF ; + out [7] = mantissa & 0xFF ; + + return ; +} /* double64_be_write */ + +void +double64_le_write (double in, unsigned char *out) +{ int exponent, mantissa ; + + memset (out, 0, sizeof (double)) ; + + if (in == 0.0) + return ; + + if (in < 0.0) + { in *= -1.0 ; + out [7] |= 0x80 ; + } ; + + in = frexp (in, &exponent) ; + + exponent += 1022 ; + + out [7] |= (exponent >> 4) & 0x7F ; + out [6] |= (exponent << 4) & 0xF0 ; + + in *= 0x20000000 ; + mantissa = lrint (floor (in)) ; + + out [6] |= (mantissa >> 24) & 0xF ; + out [5] = (mantissa >> 16) & 0xFF ; + out [4] = (mantissa >> 8) & 0xFF ; + out [3] = mantissa & 0xFF ; + + in = fmod (in, 1.0) ; + in *= 0x1000000 ; + mantissa = lrint (floor (in)) ; + + out [2] = (mantissa >> 16) & 0xFF ; + out [1] = (mantissa >> 8) & 0xFF ; + out [0] = mantissa & 0xFF ; + + return ; +} /* double64_le_write */ + +/*============================================================================================== +** Private functions. +*/ + +static void +double64_peak_update (SF_PRIVATE *psf, double *buffer, int count, int indx) +{ int chan ; + int k, position ; + float fmaxval ; + + for (chan = 0 ; chan < psf->sf.channels ; chan++) + { fmaxval = fabs (buffer [chan]) ; + position = 0 ; + for (k = chan ; k < count ; k += psf->sf.channels) + if (fmaxval < fabs (buffer [k])) + { fmaxval = fabs (buffer [k]) ; + position = k ; + } ; + + if (fmaxval > psf->pchunk->peaks [chan].value) + { psf->pchunk->peaks [chan].value = fmaxval ; + psf->pchunk->peaks [chan].position = psf->write_current + indx + (position / psf->sf.channels) ; + } ; + } ; + + return ; +} /* double64_peak_update */ + +static int +double64_get_capability (SF_PRIVATE *psf) +{ union + { double d ; + int i [2] ; + unsigned char c [8] ; + } data ; + + data.d = 1.234567890123456789 ; /* Some abitrary value. */ + + if (! psf->ieee_replace) + { /* If this test is true ints and floats are compatible and little endian. */ + if (data.i [0] == 0x428c59fb && data.i [1] == 0x3ff3c0ca && + data.c [0] == 0xfb && data.c [2] == 0x8c && data.c [4] == 0xca && data.c [6] == 0xf3) + return DOUBLE_CAN_RW_LE ; + + /* If this test is true ints and floats are compatible and big endian. */ + if ((data.i [0] == 0x3ff3c0ca && data.i [1] == 0x428c59fb) && + (data.c [0] == 0x3f && data.c [2] == 0xc0 && data.c [4] == 0x42 && data.c [6] == 0x59)) + return DOUBLE_CAN_RW_BE ; + } ; + + /* Doubles are broken. Don't expect reading or writing to be fast. */ + psf_log_printf (psf, "Using IEEE replacement code for double.\n") ; + + return (CPU_IS_LITTLE_ENDIAN) ? DOUBLE_BROKEN_LE : DOUBLE_BROKEN_BE ; +} /* double64_get_capability */ + +/*======================================================================================= +*/ + +static inline void +d2s_array (double *src, int count, short *dest, double scale) +{ while (--count >= 0) + { dest [count] = lrint (scale * src [count]) ; + } ; +} /* d2s_array */ + +static inline void +d2i_array (double *src, int count, int *dest, double scale) +{ while (--count >= 0) + { dest [count] = lrint (scale * src [count]) ; + } ; +} /* d2i_array */ + +static inline void +d2f_array (double *src, int count, float *dest) +{ while (--count >= 0) + { dest [count] = src [count] ; + } ; +} /* d2f_array */ + +static inline void +s2d_array (short *src, double *dest, int count) +{ while (--count >= 0) + { dest [count] = src [count] ; + } ; +} /* s2d_array */ + +static inline void +i2d_array (int *src, double *dest, int count) +{ while (--count >= 0) + { dest [count] = src [count] ; + } ; +} /* i2d_array */ + +static inline void +f2d_array (float *src, double *dest, int count) +{ while (--count >= 0) + { dest [count] = src [count] ; + } ; +} /* f2d_array */ + +/*---------------------------------------------------------------------------------------------- +*/ + +static sf_count_t +host_read_d2s (SF_PRIVATE *psf, short *ptr, sf_count_t len) +{ int bufferlen, readcount ; + sf_count_t total = 0 ; + double scale ; + + bufferlen = ARRAY_LEN (psf->u.dbuf) ; + scale = (psf->float_int_mult == 0) ? 1.0 : 0x7FFF / psf->float_max ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + readcount = psf_fread (psf->u.dbuf, sizeof (double), bufferlen, psf) ; + + if (psf->float_endswap == SF_TRUE) + endswap_double_array (psf->u.dbuf, readcount) ; + + d2s_array (psf->u.dbuf, readcount, ptr + total, scale) ; + total += readcount ; + len -= readcount ; + if (readcount < bufferlen) + break ; + } ; + + return total ; +} /* host_read_d2s */ + +static sf_count_t +host_read_d2i (SF_PRIVATE *psf, int *ptr, sf_count_t len) +{ int bufferlen, readcount ; + sf_count_t total = 0 ; + double scale ; + bufferlen = ARRAY_LEN (psf->u.dbuf) ; + scale = (psf->float_int_mult == 0) ? 1.0 : 0x7FFFFFFF / psf->float_max ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + readcount = psf_fread (psf->u.dbuf, sizeof (double), bufferlen, psf) ; + + if (psf->float_endswap == SF_TRUE) + endswap_double_array (psf->u.dbuf, bufferlen) ; + + d2i_array (psf->u.dbuf, readcount, ptr + total, scale) ; + total += readcount ; + len -= readcount ; + if (readcount < bufferlen) + break ; + } ; + + return total ; +} /* host_read_d2i */ + +static sf_count_t +host_read_d2f (SF_PRIVATE *psf, float *ptr, sf_count_t len) +{ int bufferlen, readcount ; + sf_count_t total = 0 ; + + bufferlen = ARRAY_LEN (psf->u.dbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + readcount = psf_fread (psf->u.dbuf, sizeof (double), bufferlen, psf) ; + + if (psf->float_endswap == SF_TRUE) + endswap_double_array (psf->u.dbuf, bufferlen) ; + + d2f_array (psf->u.dbuf, readcount, ptr + total) ; + total += readcount ; + len -= readcount ; + if (readcount < bufferlen) + break ; + } ; + + return total ; +} /* host_read_d2f */ + +static sf_count_t +host_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) +{ int bufferlen ; + sf_count_t readcount, total = 0 ; + + readcount = psf_fread (ptr, sizeof (double), len, psf) ; + + if (psf->float_endswap != SF_TRUE) + return readcount ; + + /* If the read length was sensible, endswap output in one go. */ + if (readcount < SENSIBLE_LEN) + { endswap_double_array (ptr, readcount) ; + return readcount ; + } ; + + bufferlen = SENSIBLE_LEN ; + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + + endswap_double_array (ptr + total, bufferlen) ; + + total += bufferlen ; + len -= bufferlen ; + } ; + + return total ; +} /* host_read_d */ + +static sf_count_t +host_write_s2d (SF_PRIVATE *psf, short *ptr, sf_count_t len) +{ int bufferlen, writecount ; + sf_count_t total = 0 ; + + bufferlen = ARRAY_LEN (psf->u.dbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + + s2d_array (ptr + total, psf->u.dbuf, bufferlen) ; + + if (psf->has_peak) + double64_peak_update (psf, psf->u.dbuf, bufferlen, (int) (total / psf->sf.channels)) ; + + if (psf->float_endswap == SF_TRUE) + endswap_double_array (psf->u.dbuf, bufferlen) ; + + writecount = psf_fwrite (psf->u.dbuf, sizeof (double), bufferlen, psf) ; + total += writecount ; + if (writecount < bufferlen) + break ; + len -= writecount ; + } ; + + return total ; +} /* host_write_s2d */ + +static sf_count_t +host_write_i2d (SF_PRIVATE *psf, int *ptr, sf_count_t len) +{ int bufferlen, writecount ; + sf_count_t total = 0 ; + + bufferlen = ARRAY_LEN (psf->u.dbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + i2d_array (ptr + total, psf->u.dbuf, bufferlen) ; + + if (psf->has_peak) + double64_peak_update (psf, psf->u.dbuf, bufferlen, (int) (total / psf->sf.channels)) ; + + if (psf->float_endswap == SF_TRUE) + endswap_double_array (psf->u.dbuf, bufferlen) ; + + writecount = psf_fwrite (psf->u.dbuf, sizeof (double), bufferlen, psf) ; + total += writecount ; + if (writecount < bufferlen) + break ; + len -= writecount ; + } ; + + return total ; +} /* host_write_i2d */ + +static sf_count_t +host_write_f2d (SF_PRIVATE *psf, float *ptr, sf_count_t len) +{ int bufferlen, writecount ; + sf_count_t total = 0 ; + + bufferlen = ARRAY_LEN (psf->u.dbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + f2d_array (ptr + total, psf->u.dbuf, bufferlen) ; + + if (psf->has_peak) + double64_peak_update (psf, psf->u.dbuf, bufferlen, (int) (total / psf->sf.channels)) ; + + if (psf->float_endswap == SF_TRUE) + endswap_double_array (psf->u.dbuf, bufferlen) ; + + writecount = psf_fwrite (psf->u.dbuf, sizeof (double), bufferlen, psf) ; + total += writecount ; + if (writecount < bufferlen) + break ; + len -= writecount ; + } ; + + return total ; +} /* host_write_f2d */ + +static sf_count_t +host_write_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) +{ int bufferlen, writecount ; + sf_count_t total = 0 ; + + if (psf->has_peak) + double64_peak_update (psf, ptr, len, 0) ; + + if (psf->float_endswap != SF_TRUE) + return psf_fwrite (ptr, sizeof (double), len, psf) ; + + bufferlen = ARRAY_LEN (psf->u.dbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + + endswap_double_copy (psf->u.dbuf, ptr + total, bufferlen) ; + + writecount = psf_fwrite (psf->u.dbuf, sizeof (double), bufferlen, psf) ; + total += writecount ; + if (writecount < bufferlen) + break ; + len -= writecount ; + } ; + + return total ; +} /* host_write_d */ + +/*======================================================================================= +*/ + +static sf_count_t +replace_read_d2s (SF_PRIVATE *psf, short *ptr, sf_count_t len) +{ int bufferlen, readcount ; + sf_count_t total = 0 ; + double scale ; + + bufferlen = ARRAY_LEN (psf->u.dbuf) ; + scale = (psf->float_int_mult == 0) ? 1.0 : 0x7FFF / psf->float_max ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + readcount = psf_fread (psf->u.dbuf, sizeof (double), bufferlen, psf) ; + + if (psf->float_endswap == SF_TRUE) + endswap_double_array (psf->u.dbuf, bufferlen) ; + + d2bd_read (psf->u.dbuf, bufferlen) ; + + d2s_array (psf->u.dbuf, readcount, ptr + total, scale) ; + total += readcount ; + if (readcount < bufferlen) + break ; + len -= readcount ; + } ; + + return total ; +} /* replace_read_d2s */ + +static sf_count_t +replace_read_d2i (SF_PRIVATE *psf, int *ptr, sf_count_t len) +{ int bufferlen, readcount ; + sf_count_t total = 0 ; + double scale ; + + bufferlen = ARRAY_LEN (psf->u.dbuf) ; + scale = (psf->float_int_mult == 0) ? 1.0 : 0x7FFFFFFF / psf->float_max ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + readcount = psf_fread (psf->u.dbuf, sizeof (double), bufferlen, psf) ; + + if (psf->float_endswap == SF_TRUE) + endswap_double_array (psf->u.dbuf, bufferlen) ; + + d2bd_read (psf->u.dbuf, bufferlen) ; + + d2i_array (psf->u.dbuf, readcount, ptr + total, scale) ; + total += readcount ; + if (readcount < bufferlen) + break ; + len -= readcount ; + } ; + + return total ; +} /* replace_read_d2i */ + +static sf_count_t +replace_read_d2f (SF_PRIVATE *psf, float *ptr, sf_count_t len) +{ int bufferlen, readcount ; + sf_count_t total = 0 ; + + bufferlen = ARRAY_LEN (psf->u.dbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + readcount = psf_fread (psf->u.dbuf, sizeof (double), bufferlen, psf) ; + + if (psf->float_endswap == SF_TRUE) + endswap_double_array (psf->u.dbuf, bufferlen) ; + + d2bd_read (psf->u.dbuf, bufferlen) ; + + memcpy (ptr + total, psf->u.dbuf, bufferlen * sizeof (double)) ; + + total += readcount ; + if (readcount < bufferlen) + break ; + len -= readcount ; + } ; + + return total ; +} /* replace_read_d2f */ + +static sf_count_t +replace_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) +{ int bufferlen, readcount ; + sf_count_t total = 0 ; + + /* FIXME : This is probably nowhere near optimal. */ + bufferlen = ARRAY_LEN (psf->u.dbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + readcount = psf_fread (psf->u.dbuf, sizeof (double), bufferlen, psf) ; + + if (psf->float_endswap == SF_TRUE) + endswap_double_array (psf->u.dbuf, readcount) ; + + d2bd_read (psf->u.dbuf, readcount) ; + + memcpy (ptr + total, psf->u.dbuf, readcount * sizeof (double)) ; + + total += readcount ; + if (readcount < bufferlen) + break ; + len -= readcount ; + } ; + + return total ; +} /* replace_read_d */ + +static sf_count_t +replace_write_s2d (SF_PRIVATE *psf, short *ptr, sf_count_t len) +{ int bufferlen, writecount ; + sf_count_t total = 0 ; + + bufferlen = ARRAY_LEN (psf->u.dbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + s2d_array (ptr + total, psf->u.dbuf, bufferlen) ; + + if (psf->has_peak) + double64_peak_update (psf, psf->u.dbuf, bufferlen, (int) (total / psf->sf.channels)) ; + + bd2d_write (psf->u.dbuf, bufferlen) ; + + if (psf->float_endswap == SF_TRUE) + endswap_double_array (psf->u.dbuf, bufferlen) ; + + writecount = psf_fwrite (psf->u.dbuf, sizeof (double), bufferlen, psf) ; + total += writecount ; + if (writecount < bufferlen) + break ; + len -= writecount ; + } ; + + return total ; +} /* replace_write_s2d */ + +static sf_count_t +replace_write_i2d (SF_PRIVATE *psf, int *ptr, sf_count_t len) +{ int bufferlen, writecount ; + sf_count_t total = 0 ; + + bufferlen = ARRAY_LEN (psf->u.dbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + i2d_array (ptr + total, psf->u.dbuf, bufferlen) ; + + if (psf->has_peak) + double64_peak_update (psf, psf->u.dbuf, bufferlen, (int) (total / psf->sf.channels)) ; + + bd2d_write (psf->u.dbuf, bufferlen) ; + + if (psf->float_endswap == SF_TRUE) + endswap_double_array (psf->u.dbuf, bufferlen) ; + + writecount = psf_fwrite (psf->u.dbuf, sizeof (double), bufferlen, psf) ; + total += writecount ; + if (writecount < bufferlen) + break ; + len -= writecount ; + } ; + + return total ; +} /* replace_write_i2d */ + +static sf_count_t +replace_write_f2d (SF_PRIVATE *psf, float *ptr, sf_count_t len) +{ int bufferlen, writecount ; + sf_count_t total = 0 ; + + bufferlen = ARRAY_LEN (psf->u.dbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + f2d_array (ptr + total, psf->u.dbuf, bufferlen) ; + + bd2d_write (psf->u.dbuf, bufferlen) ; + + if (psf->float_endswap == SF_TRUE) + endswap_double_array (psf->u.dbuf, bufferlen) ; + + writecount = psf_fwrite (psf->u.dbuf, sizeof (double), bufferlen, psf) ; + total += writecount ; + if (writecount < bufferlen) + break ; + len -= writecount ; + } ; + + return total ; +} /* replace_write_f2d */ + +static sf_count_t +replace_write_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) +{ int bufferlen, writecount ; + sf_count_t total = 0 ; + + /* FIXME : This is probably nowhere near optimal. */ + if (psf->has_peak) + double64_peak_update (psf, ptr, len, 0) ; + + bufferlen = ARRAY_LEN (psf->u.dbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + + memcpy (psf->u.dbuf, ptr + total, bufferlen * sizeof (double)) ; + + bd2d_write (psf->u.dbuf, bufferlen) ; + + if (psf->float_endswap == SF_TRUE) + endswap_double_array (psf->u.dbuf, bufferlen) ; + + writecount = psf_fwrite (psf->u.dbuf, sizeof (double), bufferlen, psf) ; + total += writecount ; + if (writecount < bufferlen) + break ; + len -= writecount ; + } ; + + return total ; +} /* replace_write_d */ + +/*---------------------------------------------------------------------------------------------- +*/ + +static void +d2bd_read (double *buffer, int count) +{ while (--count >= 0) + { buffer [count] = DOUBLE64_READ ((unsigned char *) (buffer + count)) ; + } ; +} /* d2bd_read */ + +static void +bd2d_write (double *buffer, int count) +{ while (--count >= 0) + { DOUBLE64_WRITE (buffer [count], (unsigned char*) (buffer + count)) ; + } ; +} /* bd2d_write */ + +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: 4ee243b7-8c7a-469b-869c-e9aa0ee3b77f +*/ diff --git a/Libraries/SndFile/Files/src/dwd.c b/Libraries/SndFile/Files/src/dwd.c new file mode 100644 index 000000000..a11628c70 --- /dev/null +++ b/Libraries/SndFile/Files/src/dwd.c @@ -0,0 +1,209 @@ +/* +** Copyright (C) 2002-2004 Erik de Castro Lopo +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU Lesser General Public License as published by +** the Free Software Foundation; either version 2.1 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU Lesser General Public License for more details. +** +** You should have received a copy of the GNU Lesser General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include +#include +#include +#include + +#include "sndfile.h" +#include "config.h" +#include "sfendian.h" +#include "common.h" + +#if (ENABLE_EXPERIMENTAL_CODE == 0) + +int +dwd_open (SF_PRIVATE *psf) +{ if (psf) + return SFE_UNIMPLEMENTED ; + return (psf && 0) ; +} /* dwd_open */ + +#else + +/*------------------------------------------------------------------------------ +** Macros to handle big/little endian issues. +*/ + +#define SFE_DWD_NO_DWD 1666 +#define SFE_DWD_BAND_BIT_WIDTH 1667 +#define SFE_DWD_COMPRESSION 1668 + +#define DWD_IDENTIFIER "DiamondWare Digitized\n\0\x1a" +#define DWD_IDENTIFIER_LEN 24 + +#define DWD_HEADER_LEN 57 + +/*------------------------------------------------------------------------------ +** Typedefs. +*/ + +/*------------------------------------------------------------------------------ +** Private static functions. +*/ + +static int dwd_read_header (SF_PRIVATE *psf) ; + +static int dwd_close (SF_PRIVATE *psf) ; + +/*------------------------------------------------------------------------------ +** Public function. +*/ + +int +dwd_open (SF_PRIVATE *psf) +{ int subformat, error = 0 ; + + if (psf->mode == SFM_READ || (psf->mode == SFM_RDWR && psf->filelength > 0)) + { if ((error = dwd_read_header (psf))) + return error ; + } ; + + if ((psf->sf.format & SF_FORMAT_TYPEMASK) != SF_FORMAT_DWD) + return SFE_BAD_OPEN_FORMAT ; + + subformat = psf->sf.format & SF_FORMAT_SUBMASK ; + + if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR) + { + /*-psf->endian = psf->sf.format & SF_FORMAT_ENDMASK ; + if (CPU_IS_LITTLE_ENDIAN && psf->endian == SF_ENDIAN_CPU) + psf->endian = SF_ENDIAN_LITTLE ; + else if (psf->endian != SF_ENDIAN_LITTLE) + psf->endian = SF_ENDIAN_BIG ; + + if (! (encoding = dwd_write_header (psf, SF_FALSE))) + return psf->error ; + + psf->write_header = dwd_write_header ; + -*/ + } ; + + psf->close = dwd_close ; + + /*-psf->blockwidth = psf->bytewidth * psf->sf.channels ;-*/ + + return error ; +} /* dwd_open */ + +/*------------------------------------------------------------------------------ +*/ + +static int +dwd_close (SF_PRIVATE *psf) +{ + psf = psf ; + + return 0 ; +} /* dwd_close */ + +/* This struct contains all the fields of interest om the DWD header, but does not +** do so in the same order and layout as the actual file, header. +** No assumptions are made about the packing of this struct. +*/ +typedef struct +{ unsigned char major, minor, compression, channels, bitwidth ; + unsigned short srate, maxval ; + unsigned int id, datalen, frames, offset ; +} DWD_HEADER ; + +static int +dwd_read_header (SF_PRIVATE *psf) +{ DWD_HEADER dwdh ; + + memset (psf->u.cbuf, 0, sizeof (psf->u.cbuf)) ; + /* Set position to start of file to begin reading header. */ + psf_binheader_readf (psf, "pb", 0, psf->u.cbuf, DWD_IDENTIFIER_LEN) ; + + if (memcmp (psf->u.cbuf, DWD_IDENTIFIER, DWD_IDENTIFIER_LEN) != 0) + return SFE_DWD_NO_DWD ; + + psf_log_printf (psf, "Read only : DiamondWare Digitized (.dwd)\n", psf->u.cbuf) ; + + psf_binheader_readf (psf, "11", &dwdh.major, &dwdh.minor) ; + psf_binheader_readf (psf, "e4j1", &dwdh.id, 1, &dwdh.compression) ; + psf_binheader_readf (psf, "e211", &dwdh.srate, &dwdh.channels, &dwdh.bitwidth) ; + psf_binheader_readf (psf, "e24", &dwdh.maxval, &dwdh.datalen) ; + psf_binheader_readf (psf, "e44", &dwdh.frames, &dwdh.offset) ; + + psf_log_printf (psf, " Version Major : %d\n Version Minor : %d\n Unique ID : %08X\n", + dwdh.major, dwdh.minor, dwdh.id) ; + psf_log_printf (psf, " Compression : %d => ", dwdh.compression) ; + + if (dwdh.compression != 0) + { psf_log_printf (psf, "Unsupported compression\n") ; + return SFE_DWD_COMPRESSION ; + } + else + psf_log_printf (psf, "None\n") ; + + psf_log_printf (psf, " Sample Rate : %d\n Channels : %d\n" + " Bit Width : %d\n", + dwdh.srate, dwdh.channels, dwdh.bitwidth) ; + + switch (dwdh.bitwidth) + { case 8 : + psf->sf.format = SF_FORMAT_DWD | SF_FORMAT_PCM_S8 ; + psf->bytewidth = 1 ; + break ; + + case 16 : + psf->sf.format = SF_FORMAT_DWD | SF_FORMAT_PCM_16 ; + psf->bytewidth = 2 ; + break ; + + default : + psf_log_printf (psf, "*** Bad bit width %d\n", dwdh.bitwidth) ; + return SFE_DWD_BAND_BIT_WIDTH ; + } ; + + if (psf->filelength != dwdh.offset + dwdh.datalen) + { psf_log_printf (psf, " Data Length : %d (should be %D)\n", dwdh.datalen, psf->filelength - dwdh.offset) ; + dwdh.datalen = (unsigned int) (psf->filelength - dwdh.offset) ; + } + else + psf_log_printf (psf, " Data Length : %d\n", dwdh.datalen) ; + + psf_log_printf (psf, " Max Value : %d\n", dwdh.maxval) ; + psf_log_printf (psf, " Frames : %d\n", dwdh.frames) ; + psf_log_printf (psf, " Data Offset : %d\n", dwdh.offset) ; + + psf->datalength = dwdh.datalen ; + psf->dataoffset = dwdh.offset ; + + psf->endian = SF_ENDIAN_LITTLE ; + + psf->sf.samplerate = dwdh.srate ; + psf->sf.channels = dwdh.channels ; + psf->sf.sections = 1 ; + + return pcm_init (psf) ; +} /* dwd_read_header */ + +/*------------------------------------------------------------------------------ +*/ + +#endif +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: a5e1d2a6-a840-4039-a0e7-e1a43eb05a4f +*/ diff --git a/Libraries/SndFile/Files/src/dwvw.c b/Libraries/SndFile/Files/src/dwvw.c new file mode 100644 index 000000000..dfd6e01c3 --- /dev/null +++ b/Libraries/SndFile/Files/src/dwvw.c @@ -0,0 +1,665 @@ +/* +** Copyright (C) 2002-2004 Erik de Castro Lopo +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU Lesser General Public License as published by +** the Free Software Foundation; either version 2.1 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU Lesser General Public License for more details. +** +** You should have received a copy of the GNU Lesser General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +/*=========================================================================== +** Delta Word Variable Width +** +** This decoder and encoder were implemented using information found in this +** document : http://home.swbell.net/rubywand/R011SNDFMTS.TXT +** +** According to the document, the algorithm "was invented 1991 by Magnus +** Lidstrom and is copyright 1993 by NuEdge Development". +*/ + +#include +#include +#include + +#include "sndfile.h" +#include "config.h" +#include "sfendian.h" +#include "float_cast.h" +#include "common.h" + +typedef struct +{ int dwm_maxsize, bit_width, max_delta, span ; + int samplecount ; + int bit_count, bits, last_delta_width, last_sample ; + struct + { int index, end ; + unsigned char buffer [256] ; + } b ; +} DWVW_PRIVATE ; + +/*============================================================================================ +*/ + +static sf_count_t dwvw_read_s (SF_PRIVATE *psf, short *ptr, sf_count_t len) ; +static sf_count_t dwvw_read_i (SF_PRIVATE *psf, int *ptr, sf_count_t len) ; +static sf_count_t dwvw_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ; +static sf_count_t dwvw_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ; + +static sf_count_t dwvw_write_s (SF_PRIVATE *psf, short *ptr, sf_count_t len) ; +static sf_count_t dwvw_write_i (SF_PRIVATE *psf, int *ptr, sf_count_t len) ; +static sf_count_t dwvw_write_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ; +static sf_count_t dwvw_write_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ; + +static sf_count_t dwvw_seek (SF_PRIVATE *psf, int mode, sf_count_t offset) ; +static int dwvw_close (SF_PRIVATE *psf) ; + +static int dwvw_decode_data (SF_PRIVATE *psf, DWVW_PRIVATE *pdwvw, int *ptr, int len) ; +static int dwvw_decode_load_bits (SF_PRIVATE *psf, DWVW_PRIVATE *pdwvw, int bit_count) ; + +static int dwvw_encode_data (SF_PRIVATE *psf, DWVW_PRIVATE *pdwvw, int *ptr, int len) ; +static void dwvw_encode_store_bits (SF_PRIVATE *psf, DWVW_PRIVATE *pdwvw, int data, int new_bits) ; +static void dwvw_read_reset (DWVW_PRIVATE *pdwvw) ; + +/*============================================================================================ +** DWVW initialisation function. +*/ + +int +dwvw_init (SF_PRIVATE *psf, int bitwidth) +{ DWVW_PRIVATE *pdwvw ; + + if (bitwidth > 24) + return SFE_DWVW_BAD_BITWIDTH ; + + if (psf->mode == SFM_RDWR) + return SFE_BAD_MODE_RW ; + + if ((pdwvw = calloc (1, sizeof (DWVW_PRIVATE))) == NULL) + return SFE_MALLOC_FAILED ; + + psf->fdata = (void*) pdwvw ; + + pdwvw->bit_width = bitwidth ; + pdwvw->dwm_maxsize = bitwidth / 2 ; + pdwvw->max_delta = 1 << (bitwidth - 1) ; + pdwvw->span = 1 << bitwidth ; + + dwvw_read_reset (pdwvw) ; + + if (psf->mode == SFM_READ) + { psf->read_short = dwvw_read_s ; + psf->read_int = dwvw_read_i ; + psf->read_float = dwvw_read_f ; + psf->read_double = dwvw_read_d ; + } ; + + if (psf->mode == SFM_WRITE) + { psf->write_short = dwvw_write_s ; + psf->write_int = dwvw_write_i ; + psf->write_float = dwvw_write_f ; + psf->write_double = dwvw_write_d ; + } ; + + psf->seek = dwvw_seek ; + psf->close = dwvw_close ; + + /* FIXME : This s bogus. */ + psf->sf.frames = SF_COUNT_MAX ; + psf->datalength = psf->sf.frames ; + /* EMXIF : This s bogus. */ + + return 0 ; +} /* dwvw_init */ + +/*-------------------------------------------------------------------------------------------- +*/ + +static int +dwvw_close (SF_PRIVATE *psf) +{ DWVW_PRIVATE *pdwvw ; + + if (psf->fdata == NULL) + return 0 ; + pdwvw = (DWVW_PRIVATE*) psf->fdata ; + + if (psf->mode == SFM_WRITE) + { static int last_values [12] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } ; + + /* Write 8 zero samples to fully flush output. */ + dwvw_encode_data (psf, pdwvw, last_values, 12) ; + + /* Write the last buffer worth of data to disk. */ + psf_fwrite (pdwvw->b.buffer, 1, pdwvw->b.index, psf) ; + + if (psf->write_header) + psf->write_header (psf, SF_TRUE) ; + } ; + + return 0 ; +} /* dwvw_close */ + +static sf_count_t +dwvw_seek (SF_PRIVATE *psf, int mode, sf_count_t offset) +{ DWVW_PRIVATE *pdwvw ; + + mode = mode ; + + if (! psf->fdata) + { psf->error = SFE_INTERNAL ; + return ((sf_count_t) -1) ; + } ; + + pdwvw = (DWVW_PRIVATE*) psf->fdata ; + + if (offset == 0) + { psf_fseek (psf, psf->dataoffset, SEEK_SET) ; + dwvw_read_reset (pdwvw) ; + return 0 ; + } ; + + psf->error = SFE_BAD_SEEK ; + return ((sf_count_t) -1) ; +} /* dwvw_seek */ + + +/*============================================================================== +*/ + +static sf_count_t +dwvw_read_s (SF_PRIVATE *psf, short *ptr, sf_count_t len) +{ DWVW_PRIVATE *pdwvw ; + int *iptr ; + int k, bufferlen, readcount = 0, count ; + sf_count_t total = 0 ; + + if (! psf->fdata) + return 0 ; + pdwvw = (DWVW_PRIVATE*) psf->fdata ; + + iptr = psf->u.ibuf ; + bufferlen = ARRAY_LEN (psf->u.ibuf) ; + while (len > 0) + { readcount = (len >= bufferlen) ? bufferlen : len ; + count = dwvw_decode_data (psf, pdwvw, iptr, readcount) ; + for (k = 0 ; k < readcount ; k++) + ptr [total + k] = iptr [k] >> 16 ; + + total += count ; + len -= readcount ; + if (count != readcount) + break ; + } ; + + return total ; +} /* dwvw_read_s */ + +static sf_count_t +dwvw_read_i (SF_PRIVATE *psf, int *ptr, sf_count_t len) +{ DWVW_PRIVATE *pdwvw ; + int readcount, count ; + sf_count_t total = 0 ; + + if (! psf->fdata) + return 0 ; + pdwvw = (DWVW_PRIVATE*) psf->fdata ; + + while (len > 0) + { readcount = (len > 0x10000000) ? 0x10000000 : (int) len ; + + count = dwvw_decode_data (psf, pdwvw, ptr, readcount) ; + + total += count ; + len -= count ; + + if (count != readcount) + break ; + } ; + + return total ; +} /* dwvw_read_i */ + +static sf_count_t +dwvw_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) +{ DWVW_PRIVATE *pdwvw ; + int *iptr ; + int k, bufferlen, readcount = 0, count ; + sf_count_t total = 0 ; + float normfact ; + + if (! psf->fdata) + return 0 ; + pdwvw = (DWVW_PRIVATE*) psf->fdata ; + + normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x80000000) : 1.0 ; + + iptr = psf->u.ibuf ; + bufferlen = ARRAY_LEN (psf->u.ibuf) ; + while (len > 0) + { readcount = (len >= bufferlen) ? bufferlen : len ; + count = dwvw_decode_data (psf, pdwvw, iptr, readcount) ; + for (k = 0 ; k < readcount ; k++) + ptr [total + k] = normfact * (float) (iptr [k]) ; + + total += count ; + len -= readcount ; + if (count != readcount) + break ; + } ; + + return total ; +} /* dwvw_read_f */ + +static sf_count_t +dwvw_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) +{ DWVW_PRIVATE *pdwvw ; + int *iptr ; + int k, bufferlen, readcount = 0, count ; + sf_count_t total = 0 ; + double normfact ; + + if (! psf->fdata) + return 0 ; + pdwvw = (DWVW_PRIVATE*) psf->fdata ; + + normfact = (psf->norm_double == SF_TRUE) ? 1.0 / ((double) 0x80000000) : 1.0 ; + + iptr = psf->u.ibuf ; + bufferlen = ARRAY_LEN (psf->u.ibuf) ; + while (len > 0) + { readcount = (len >= bufferlen) ? bufferlen : len ; + count = dwvw_decode_data (psf, pdwvw, iptr, readcount) ; + for (k = 0 ; k < readcount ; k++) + ptr [total + k] = normfact * (double) (iptr [k]) ; + + total += count ; + len -= readcount ; + if (count != readcount) + break ; + } ; + + return total ; +} /* dwvw_read_d */ + +static int +dwvw_decode_data (SF_PRIVATE *psf, DWVW_PRIVATE *pdwvw, int *ptr, int len) +{ int count ; + int delta_width_modifier, delta_width, delta_negative, delta, sample ; + + /* Restore state from last decode call. */ + delta_width = pdwvw->last_delta_width ; + sample = pdwvw->last_sample ; + + for (count = 0 ; count < len ; count++) + { /* If bit_count parameter is zero get the delta_width_modifier. */ + delta_width_modifier = dwvw_decode_load_bits (psf, pdwvw, -1) ; + + /* Check for end of input bit stream. Break loop if end. */ + if (delta_width_modifier < 0) + break ; + + if (delta_width_modifier && dwvw_decode_load_bits (psf, pdwvw, 1)) + delta_width_modifier = - delta_width_modifier ; + + /* Calculate the current word width. */ + delta_width = (delta_width + delta_width_modifier + pdwvw->bit_width) % pdwvw->bit_width ; + + /* Load the delta. */ + delta = 0 ; + if (delta_width) + { delta = dwvw_decode_load_bits (psf, pdwvw, delta_width - 1) | (1 << (delta_width - 1)) ; + delta_negative = dwvw_decode_load_bits (psf, pdwvw, 1) ; + if (delta == pdwvw->max_delta - 1) + delta += dwvw_decode_load_bits (psf, pdwvw, 1) ; + if (delta_negative) + delta = -delta ; + } ; + + /* Calculate the sample */ + sample += delta ; + + if (sample >= pdwvw->max_delta) + sample -= pdwvw->span ; + else if (sample < - pdwvw->max_delta) + sample += pdwvw->span ; + + /* Store the sample justifying to the most significant bit. */ + ptr [count] = sample << (32 - pdwvw->bit_width) ; + + if (pdwvw->b.end == 0 && pdwvw->bit_count == 0) + break ; + } ; + + pdwvw->last_delta_width = delta_width ; + pdwvw->last_sample = sample ; + + pdwvw->samplecount += count ; + + return count ; +} /* dwvw_decode_data */ + +static int +dwvw_decode_load_bits (SF_PRIVATE *psf, DWVW_PRIVATE *pdwvw, int bit_count) +{ int output = 0, get_dwm = SF_FALSE ; + + /* + ** Depending on the value of parameter bit_count, either get the + ** required number of bits (ie bit_count > 0) or the + ** delta_width_modifier (otherwise). + */ + + if (bit_count < 0) + { get_dwm = SF_TRUE ; + /* modify bit_count to ensure we have enought bits for finding dwm. */ + bit_count = pdwvw->dwm_maxsize ; + } ; + + /* Load bits in bit reseviour. */ + while (pdwvw->bit_count < bit_count) + { if (pdwvw->b.index >= pdwvw->b.end) + { pdwvw->b.end = psf_fread (pdwvw->b.buffer, 1, sizeof (pdwvw->b.buffer), psf) ; + pdwvw->b.index = 0 ; + } ; + + /* Check for end of input stream. */ + if (bit_count < 8 && pdwvw->b.end == 0) + return -1 ; + + pdwvw->bits = (pdwvw->bits << 8) ; + + if (pdwvw->b.index < pdwvw->b.end) + { pdwvw->bits |= pdwvw->b.buffer [pdwvw->b.index] ; + pdwvw->b.index ++ ; + } ; + pdwvw->bit_count += 8 ; + } ; + + /* If asked to get bits do so. */ + if (! get_dwm) + { output = (pdwvw->bits >> (pdwvw->bit_count - bit_count)) & ((1 << bit_count) - 1) ; + pdwvw->bit_count -= bit_count ; + return output ; + } ; + + /* Otherwise must have been asked to get delta_width_modifier. */ + while (output < (pdwvw->dwm_maxsize)) + { pdwvw->bit_count -= 1 ; + if (pdwvw->bits & (1 << pdwvw->bit_count)) + break ; + output += 1 ; + } ; + + return output ; +} /* dwvw_decode_load_bits */ + +static void +dwvw_read_reset (DWVW_PRIVATE *pdwvw) +{ pdwvw->samplecount = 0 ; + pdwvw->b.index = 0 ; + pdwvw->b.end = 0 ; + pdwvw->bit_count = 0 ; + pdwvw->bits = 0 ; + pdwvw->last_delta_width = 0 ; + pdwvw->last_sample = 0 ; +} /* dwvw_read_reset */ + +static void +dwvw_encode_store_bits (SF_PRIVATE *psf, DWVW_PRIVATE *pdwvw, int data, int new_bits) +{ int byte ; + + /* Shift the bits into the resevoir. */ + pdwvw->bits = (pdwvw->bits << new_bits) | (data & ((1 << new_bits) - 1)) ; + pdwvw->bit_count += new_bits ; + + /* Transfer bit to buffer. */ + while (pdwvw->bit_count >= 8) + { byte = pdwvw->bits >> (pdwvw->bit_count - 8) ; + pdwvw->bit_count -= 8 ; + pdwvw->b.buffer [pdwvw->b.index] = byte & 0xFF ; + pdwvw->b.index ++ ; + } ; + + if (pdwvw->b.index > SIGNED_SIZEOF (pdwvw->b.buffer) - 4) + { psf_fwrite (pdwvw->b.buffer, 1, pdwvw->b.index, psf) ; + pdwvw->b.index = 0 ; + } ; + + return ; +} /* dwvw_encode_store_bits */ + +#if 0 +/* Debigging routine. */ +static void +dump_bits (DWVW_PRIVATE *pdwvw) +{ int k, mask ; + + for (k = 0 ; k < 10 && k < pdwvw->b.index ; k++) + { mask = 0x80 ; + while (mask) + { putchar (mask & pdwvw->b.buffer [k] ? '1' : '0') ; + mask >>= 1 ; + } ; + putchar (' ') ; + } + + for (k = pdwvw->bit_count - 1 ; k >= 0 ; k --) + putchar (pdwvw->bits & (1 << k) ? '1' : '0') ; + + putchar ('\n') ; +} /* dump_bits */ +#endif + +#define HIGHEST_BIT(x,count) \ + { int y = x ; \ + (count) = 0 ; \ + while (y) \ + { (count) ++ ; \ + y >>= 1 ; \ + } ; \ + } ; + +static int +dwvw_encode_data (SF_PRIVATE *psf, DWVW_PRIVATE *pdwvw, int *ptr, int len) +{ int count ; + int delta_width_modifier, delta, delta_negative, delta_width, extra_bit ; + + for (count = 0 ; count < len ; count++) + { delta = (ptr [count] >> (32 - pdwvw->bit_width)) - pdwvw->last_sample ; + + /* Calculate extra_bit if needed. */ + extra_bit = -1 ; + delta_negative = 0 ; + if (delta < -pdwvw->max_delta) + delta = pdwvw->max_delta + (delta % pdwvw->max_delta) ; + else if (delta == -pdwvw->max_delta) + { extra_bit = 1 ; + delta_negative = 1 ; + delta = pdwvw->max_delta - 1 ; + } + else if (delta > pdwvw->max_delta) + { delta_negative = 1 ; + delta = pdwvw->span - delta ; + delta = abs (delta) ; + } + else if (delta == pdwvw->max_delta) + { extra_bit = 1 ; + delta = pdwvw->max_delta - 1 ; + } + else if (delta < 0) + { delta_negative = 1 ; + delta = abs (delta) ; + } ; + + if (delta == pdwvw->max_delta - 1 && extra_bit == -1) + extra_bit = 0 ; + + /* Find width in bits of delta */ + HIGHEST_BIT (delta, delta_width) ; + + /* Calculate the delta_width_modifier */ + delta_width_modifier = (delta_width - pdwvw->last_delta_width) % pdwvw->bit_width ; + if (delta_width_modifier > pdwvw->dwm_maxsize) + delta_width_modifier -= pdwvw->bit_width ; + if (delta_width_modifier < -pdwvw->dwm_maxsize) + delta_width_modifier += pdwvw->bit_width ; + + /* Write delta_width_modifier zeros, followed by terminating '1'. */ + dwvw_encode_store_bits (psf, pdwvw, 0, abs (delta_width_modifier)) ; + if (abs (delta_width_modifier) != pdwvw->dwm_maxsize) + dwvw_encode_store_bits (psf, pdwvw, 1, 1) ; + + /* Write delta_width_modifier sign. */ + if (delta_width_modifier < 0) + dwvw_encode_store_bits (psf, pdwvw, 1, 1) ; + if (delta_width_modifier > 0) + dwvw_encode_store_bits (psf, pdwvw, 0, 1) ; + + /* Write delta and delta sign bit. */ + if (delta_width) + { dwvw_encode_store_bits (psf, pdwvw, delta, abs (delta_width) - 1) ; + dwvw_encode_store_bits (psf, pdwvw, (delta_negative ? 1 : 0), 1) ; + } ; + + /* Write extra bit!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ + if (extra_bit >= 0) + dwvw_encode_store_bits (psf, pdwvw, extra_bit, 1) ; + + pdwvw->last_sample = ptr [count] >> (32 - pdwvw->bit_width) ; + pdwvw->last_delta_width = delta_width ; + } ; + + pdwvw->samplecount += count ; + + return count ; +} /* dwvw_encode_data */ + +static sf_count_t +dwvw_write_s (SF_PRIVATE *psf, short *ptr, sf_count_t len) +{ DWVW_PRIVATE *pdwvw ; + int *iptr ; + int k, bufferlen, writecount = 0, count ; + sf_count_t total = 0 ; + + if (! psf->fdata) + return 0 ; + pdwvw = (DWVW_PRIVATE*) psf->fdata ; + + iptr = psf->u.ibuf ; + bufferlen = ARRAY_LEN (psf->u.ibuf) ; + while (len > 0) + { writecount = (len >= bufferlen) ? bufferlen : len ; + for (k = 0 ; k < writecount ; k++) + iptr [k] = ptr [total + k] << 16 ; + count = dwvw_encode_data (psf, pdwvw, iptr, writecount) ; + + total += count ; + len -= writecount ; + if (count != writecount) + break ; + } ; + + return total ; +} /* dwvw_write_s */ + +static sf_count_t +dwvw_write_i (SF_PRIVATE *psf, int *ptr, sf_count_t len) +{ DWVW_PRIVATE *pdwvw ; + int writecount, count ; + sf_count_t total = 0 ; + + if (! psf->fdata) + return 0 ; + pdwvw = (DWVW_PRIVATE*) psf->fdata ; + + while (len > 0) + { writecount = (len > 0x10000000) ? 0x10000000 : (int) len ; + + count = dwvw_encode_data (psf, pdwvw, ptr, writecount) ; + + total += count ; + len -= count ; + + if (count != writecount) + break ; + } ; + + return total ; +} /* dwvw_write_i */ + +static sf_count_t +dwvw_write_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) +{ DWVW_PRIVATE *pdwvw ; + int *iptr ; + int k, bufferlen, writecount = 0, count ; + sf_count_t total = 0 ; + float normfact ; + + if (! psf->fdata) + return 0 ; + pdwvw = (DWVW_PRIVATE*) psf->fdata ; + + normfact = (psf->norm_float == SF_TRUE) ? (1.0 * 0x7FFFFFFF) : 1.0 ; + + iptr = psf->u.ibuf ; + bufferlen = ARRAY_LEN (psf->u.ibuf) ; + while (len > 0) + { writecount = (len >= bufferlen) ? bufferlen : len ; + for (k = 0 ; k < writecount ; k++) + iptr [k] = lrintf (normfact * ptr [total + k]) ; + count = dwvw_encode_data (psf, pdwvw, iptr, writecount) ; + + total += count ; + len -= writecount ; + if (count != writecount) + break ; + } ; + + return total ; +} /* dwvw_write_f */ + +static sf_count_t +dwvw_write_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) +{ DWVW_PRIVATE *pdwvw ; + int *iptr ; + int k, bufferlen, writecount = 0, count ; + sf_count_t total = 0 ; + double normfact ; + + if (! psf->fdata) + return 0 ; + pdwvw = (DWVW_PRIVATE*) psf->fdata ; + + normfact = (psf->norm_double == SF_TRUE) ? (1.0 * 0x7FFFFFFF) : 1.0 ; + + iptr = psf->u.ibuf ; + bufferlen = ARRAY_LEN (psf->u.ibuf) ; + while (len > 0) + { writecount = (len >= bufferlen) ? bufferlen : len ; + for (k = 0 ; k < writecount ; k++) + iptr [k] = lrint (normfact * ptr [total + k]) ; + count = dwvw_encode_data (psf, pdwvw, iptr, writecount) ; + + total += count ; + len -= writecount ; + if (count != writecount) + break ; + } ; + + return total ; +} /* dwvw_write_d */ + +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: 1ca09552-b01f-4d7f-9bcf-612f834fe41d +*/ diff --git a/Libraries/SndFile/Files/src/file_io.c b/Libraries/SndFile/Files/src/file_io.c new file mode 100644 index 000000000..b3b0d59a7 --- /dev/null +++ b/Libraries/SndFile/Files/src/file_io.c @@ -0,0 +1,1287 @@ +/* +** Copyright (C) 2002-2004 Erik de Castro Lopo +** Copyright (C) 2003 Ross Bencina +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU Lesser General Public License as published by +** the Free Software Foundation; either version 2.1 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU Lesser General Public License for more details. +** +** You should have received a copy of the GNU Lesser General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +/* +** This header file MUST be included before the others to ensure that +** large file support is enabled. +*/ + +#include "config.h" + +#include +#include + +#ifdef HAVE_UNISTD_H +#include +#endif + +#if (HAVE_DECL_S_IRGRP == 0) +#include +#endif + +#include +#include +#include +#include + +#if (defined (__MWERKS__) && defined (macintosh)) +typedef int ssize_t ; +#include +#endif + +#include "sndfile.h" +#include "common.h" + +#define SENSIBLE_SIZE (0x40000000) + +static int psf_open_fd (const char * path, int mode) ; +static int psf_close_fd (int fd) ; +static void psf_log_syserr (SF_PRIVATE *psf, int error) ; +static sf_count_t psf_get_filelen_fd (int fd) ; + +int +psf_fopen (SF_PRIVATE *psf, const char *pathname, int open_mode) +{ + psf->error = 0 ; + psf->filedes = psf_open_fd (pathname, open_mode) ; + + if (psf->filedes == - SFE_BAD_OPEN_MODE) + { psf->error = SFE_BAD_OPEN_MODE ; + psf->filedes = -1 ; + return psf->error ; + } ; + + if (psf->filedes == -1) + psf_log_syserr (psf, errno) ; + + psf->mode = open_mode ; + + return psf->error ; +} /* psf_fopen */ + +int +psf_fclose (SF_PRIVATE *psf) +{ int retval ; + + if (psf->do_not_close_descriptor) + { psf->filedes = -1 ; + return 0 ; + } ; + + if ((retval = psf_close_fd (psf->filedes)) == -1) + psf_log_syserr (psf, errno) ; + + psf->filedes = -1 ; + + return retval ; +} /* psf_fclose */ + +int +psf_open_rsrc (SF_PRIVATE *psf, int open_mode) +{ char *fname ; + + if (psf->rsrcdes > 0) + return 0 ; + + /* Test for MacOSX style resource fork on HPFS or HPFS+ filesystems. */ + LSF_SNPRINTF (psf->rsrcpath, sizeof (psf->rsrcpath), "%s/rsrc", psf->filepath) ; + + psf->error = SFE_NO_ERROR ; + if ((psf->rsrcdes = psf_open_fd (psf->rsrcpath, open_mode)) >= 0) + { psf->rsrclength = psf_get_filelen_fd (psf->rsrcdes) ; + if (psf->rsrclength < 100) + { psf->error = SFE_SD2_BAD_RSRC ; + return psf->error ; + } ; + return SFE_NO_ERROR ; + } ; + + if (psf->rsrcdes == - SFE_BAD_OPEN_MODE) + { psf->error = SFE_BAD_OPEN_MODE ; + return psf->error ; + } ; + + /* + ** Now try for a resource fork stored as a separate file. + ** Grab the un-adulterated filename again. + */ + LSF_SNPRINTF (psf->rsrcpath, sizeof (psf->rsrcpath), "%s", psf->filepath) ; + + if ((fname = strrchr (psf->rsrcpath, '/')) != NULL) + fname ++ ; + else if ((fname = strrchr (psf->rsrcpath, '\\')) != NULL) + fname ++ ; + else + fname = psf->rsrcpath ; + + memmove (fname + 2, fname, strlen (fname) + 1) ; + fname [0] = '.' ; + fname [1] = '_' ; + + psf->error = SFE_NO_ERROR ; + if ((psf->rsrcdes = psf_open_fd (psf->rsrcpath, open_mode)) >= 0) + { psf->rsrclength = psf_get_filelen_fd (psf->rsrcdes) ; + return SFE_NO_ERROR ; + } ; + + if (psf->rsrcdes == -1) + psf_log_syserr (psf, errno) ; + + psf->rsrcdes = -1 ; + + return psf->error ; +} /* psf_open_rsrc */ + +int +psf_close_rsrc (SF_PRIVATE *psf) +{ + psf_close_fd (psf->rsrcdes) ; + psf->rsrcdes = -1 ; + return 0 ; +} /* psf_close_rsrc */ + +sf_count_t +psf_get_filelen (SF_PRIVATE *psf) +{ sf_count_t filelen ; + + filelen = psf_get_filelen_fd (psf->filedes) ; + + if (filelen == -1) + { psf_log_syserr (psf, errno) ; + return (sf_count_t) -1 ; + } ; + + if (filelen == -SFE_BAD_STAT_SIZE) + { psf->error = SFE_BAD_STAT_SIZE ; + return (sf_count_t) -1 ; + } ; + + switch (psf->mode) + { case SFM_WRITE : + filelen = filelen - psf->fileoffset ; + break ; + + case SFM_READ : + if (psf->fileoffset > 0 && psf->filelength > 0) + filelen = psf->filelength ; + break ; + + case SFM_RDWR : + /* + ** Cannot open embedded files SFM_RDWR so we don't need to + ** subtract psf->fileoffset. We already have the answer we + ** need. + */ + break ; + + default : + /* Shouldn't be here, so return error. */ + filelen = -1 ; + } ; + + return filelen ; +} /* psf_get_filelen */ + +#if ((defined (WIN32) || defined (_WIN32)) == 0) + +/*------------------------------------------------------------------------------ +** Win32 stuff at the bottom of the file. Unix and other sensible OSes here. +*/ + +int +psf_set_stdio (SF_PRIVATE *psf, int mode) +{ int error = 0 ; + + switch (mode) + { case SFM_RDWR : + error = SFE_OPEN_PIPE_RDWR ; + break ; + + case SFM_READ : + psf->filedes = 0 ; + break ; + + case SFM_WRITE : + psf->filedes = 1 ; + break ; + + default : + error = SFE_BAD_OPEN_MODE ; + break ; + } ; + psf->filelength = 0 ; + + return error ; +} /* psf_set_stdio */ + +void +psf_set_file (SF_PRIVATE *psf, int fd) +{ psf->filedes = fd ; +} /* psf_set_file */ + +int +psf_filedes_valid (SF_PRIVATE *psf) +{ return (psf->filedes >= 0) ? SF_TRUE : SF_FALSE ; +} /* psf_set_file */ + +sf_count_t +psf_fseek (SF_PRIVATE *psf, sf_count_t offset, int whence) +{ sf_count_t new_position ; + + switch (whence) + { case SEEK_SET : + offset += psf->fileoffset ; + break ; + + case SEEK_END : + if (psf->mode == SFM_WRITE) + { new_position = lseek (psf->filedes, offset, whence) ; + + if (new_position < 0) + psf_log_syserr (psf, errno) ; + + return new_position - psf->fileoffset ; + } ; + + /* Transform SEEK_END into a SEEK_SET, ie find the file + ** length add the requested offset (should be <= 0) to + ** get the offset wrt the start of file. + */ + whence = SEEK_SET ; + offset = lseek (psf->filedes, 0, SEEK_END) + offset ; + break ; + + default : + /* No need to do anything about SEEK_CUR. */ + break ; + } ; + + new_position = lseek (psf->filedes, offset, whence) ; + + if (new_position < 0) + psf_log_syserr (psf, errno) ; + + new_position -= psf->fileoffset ; + + return new_position ; +} /* psf_fseek */ + +sf_count_t +psf_fread (void *ptr, sf_count_t bytes, sf_count_t items, SF_PRIVATE *psf) +{ sf_count_t total = 0 ; + ssize_t count ; + + items *= bytes ; + + /* Do this check after the multiplication above. */ + if (items <= 0) + return 0 ; + + while (items > 0) + { /* Break the writes down to a sensible size. */ + count = (items > SENSIBLE_SIZE) ? SENSIBLE_SIZE : (ssize_t) items ; + + count = read (psf->filedes, ((char*) ptr) + total, (size_t) count) ; + + if (count == -1) + { if (errno == EINTR) + continue ; + + psf_log_syserr (psf, errno) ; + break ; + } ; + + if (count == 0) + break ; + + total += count ; + items -= count ; + } ; + + if (psf->is_pipe) + psf->pipeoffset += total ; + + return total / bytes ; +} /* psf_fread */ + +sf_count_t +psf_fwrite (const void *ptr, sf_count_t bytes, sf_count_t items, SF_PRIVATE *psf) +{ sf_count_t total = 0 ; + ssize_t count ; + + items *= bytes ; + + /* Do this check after the multiplication above. */ + if (items <= 0) + return 0 ; + + while (items > 0) + { /* Break the writes down to a sensible size. */ + count = (items > SENSIBLE_SIZE) ? SENSIBLE_SIZE : items ; + + count = write (psf->filedes, ((const char*) ptr) + total, count) ; + + if (count == -1) + { if (errno == EINTR) + continue ; + + psf_log_syserr (psf, errno) ; + break ; + } ; + + if (count == 0) + break ; + + total += count ; + items -= count ; + } ; + + if (psf->is_pipe) + psf->pipeoffset += total ; + + return total / bytes ; +} /* psf_fwrite */ + +sf_count_t +psf_ftell (SF_PRIVATE *psf) +{ sf_count_t pos ; + + if (psf->is_pipe) + return psf->pipeoffset ; + + pos = lseek (psf->filedes, 0, SEEK_CUR) ; + + if (pos == ((sf_count_t) -1)) + { psf_log_syserr (psf, errno) ; + return -1 ; + } ; + + return pos - psf->fileoffset ; +} /* psf_ftell */ + +int +psf_close_fd (int fd) +{ int retval ; + + while ((retval = close (fd)) == -1 && errno == EINTR) + /* Do nothing. */ ; + + return retval ; +} /* psf_close_fd */ + +sf_count_t +psf_fgets (char *buffer, sf_count_t bufsize, SF_PRIVATE *psf) +{ sf_count_t k = 0 ; + sf_count_t count ; + + while (k < bufsize - 1) + { count = read (psf->filedes, &(buffer [k]), 1) ; + + if (count == -1) + { if (errno == EINTR) + continue ; + + psf_log_syserr (psf, errno) ; + break ; + } ; + + if (count == 0 || buffer [k++] == '\n') + break ; + } ; + + buffer [k] = 0 ; + + return k ; +} /* psf_fgets */ + +int +psf_is_pipe (SF_PRIVATE *psf) +{ struct stat statbuf ; + + if (fstat (psf->filedes, &statbuf) == -1) + { psf_log_syserr (psf, errno) ; + /* Default to maximum safety. */ + return SF_TRUE ; + } ; + + if (S_ISFIFO (statbuf.st_mode) || S_ISSOCK (statbuf.st_mode)) + return SF_TRUE ; + + return SF_FALSE ; +} /* psf_is_pipe */ + +static sf_count_t +psf_get_filelen_fd (int fd) +{ struct stat statbuf ; + + /* + ** Sanity check. + ** If everything is OK, this will be optimised out. + */ + if (sizeof (statbuf.st_size) == 4 && sizeof (sf_count_t) == 8) + return (sf_count_t) -SFE_BAD_STAT_SIZE ; + +/* Cygwin seems to need this. */ +#if (defined (__CYGWIN__) && HAVE_FSYNC) + fsync (psf->filedes) ; +#endif + + if (fstat (fd, &statbuf) == -1) + return (sf_count_t) -1 ; + + return statbuf.st_size ; +} /* psf_get_filelen_fd */ + +int +psf_ftruncate (SF_PRIVATE *psf, sf_count_t len) +{ int retval ; + + /* Returns 0 on success, non-zero on failure. */ + if (len < 0) + return -1 ; + + if ((sizeof (off_t) < sizeof (sf_count_t)) && len > 0x7FFFFFFF) + return -1 ; + +#if (defined (__MWERKS__) && defined (macintosh)) + retval = FSSetForkSize (psf->filedes, fsFromStart, len) ; +#else + retval = ftruncate (psf->filedes, len) ; +#endif + + if (retval == -1) + psf_log_syserr (psf, errno) ; + + return retval ; +} /* psf_ftruncate */ + +static int +psf_open_fd (const char * pathname, int open_mode) +{ int fd, oflag, mode ; + + /* + ** Sanity check. If everything is OK, this test and the printfs will + ** be optimised out. This is meant to catch the problems caused by + ** "config.h" being included after . + */ + if (sizeof (off_t) != sizeof (sf_count_t)) + { puts ("\n\n*** Fatal error : sizeof (off_t) != sizeof (sf_count_t)") ; + puts ("*** This means that libsndfile was not configured correctly.\n") ; + exit (1) ; + } ; + + switch (open_mode) + { case SFM_READ : + oflag = O_RDONLY ; + mode = 0 ; + break ; + + case SFM_WRITE : + oflag = O_WRONLY | O_CREAT | O_TRUNC ; + mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH ; + break ; + + case SFM_RDWR : + oflag = O_RDWR | O_CREAT ; + mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH ; + break ; + + default : + return - SFE_BAD_OPEN_MODE ; + break ; + } ; + +#if defined (__CYGWIN__) + oflag |= O_BINARY ; +#endif + + if (mode == 0) + fd = open (pathname, oflag) ; + else + fd = open (pathname, oflag, mode) ; + + return fd ; +} /* psf_open_fd */ + +static void +psf_log_syserr (SF_PRIVATE *psf, int error) +{ + /* Only log an error if no error has been set yet. */ + if (psf->error == 0) + { psf->error = SFE_SYSTEM ; + LSF_SNPRINTF (psf->syserr, sizeof (psf->syserr), "System error : %s.", strerror (error)) ; + } ; + + return ; +} /* psf_log_syserr */ + +#elif OS_IS_WIN32 + +/* Win32 file i/o functions implemented using native Win32 API */ + +#include +#include + +#ifndef HAVE_SSIZE_T +typedef long ssize_t ; +#endif + +/* Win32 */ static int +psf_open_fd (const char * pathname, int open_mode) +{ DWORD dwDesiredAccess ; + DWORD dwShareMode ; + DWORD dwCreationDistribution ; + HANDLE handle ; + + switch (open_mode) + { case SFM_READ : + dwDesiredAccess = GENERIC_READ ; + dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE ; + dwCreationDistribution = OPEN_EXISTING ; + break ; + + case SFM_WRITE : + dwDesiredAccess = GENERIC_WRITE ; + dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE ; + dwCreationDistribution = CREATE_ALWAYS ; + break ; + + case SFM_RDWR : + dwDesiredAccess = GENERIC_READ | GENERIC_WRITE ; + dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE ; + dwCreationDistribution = OPEN_ALWAYS ; + break ; + + default : + return - SFE_BAD_OPEN_MODE ; + } ; + + handle = CreateFile ( + pathname, /* pointer to name of the file */ + dwDesiredAccess, /* access (read-write) mode */ + dwShareMode, /* share mode */ + 0, /* pointer to security attributes */ + dwCreationDistribution, /* how to create */ + FILE_ATTRIBUTE_NORMAL, /* file attributes (could use FILE_FLAG_SEQUENTIAL_SCAN) */ + NULL /* handle to file with attributes to copy */ + ) ; + + if (handle == INVALID_HANDLE_VALUE) + return -1 ; + + return (int) handle ; +} /* psf_open_fd */ + +/* Win32 */ static void +psf_log_syserr (SF_PRIVATE *psf, int error) +{ LPVOID lpMsgBuf ; + + /* Only log an error if no error has been set yet. */ + if (psf->error == 0) + { psf->error = SFE_SYSTEM ; + + FormatMessage ( + FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, + NULL, + error, + MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT), + (LPTSTR) &lpMsgBuf, + 0, + NULL + ) ; + + LSF_SNPRINTF (psf->syserr, sizeof (psf->syserr), "System error : %s", lpMsgBuf) ; + LocalFree (lpMsgBuf) ; + } ; + + return ; +} /* psf_log_syserr */ + + +/* Win32 */ int +psf_set_stdio (SF_PRIVATE *psf, int mode) +{ HANDLE handle = NULL ; + int error = 0 ; + + switch (mode) + { case SFM_RDWR : + error = SFE_OPEN_PIPE_RDWR ; + break ; + + case SFM_READ : + handle = GetStdHandle (STD_INPUT_HANDLE) ; + psf->do_not_close_descriptor = 1 ; + break ; + + case SFM_WRITE : + handle = GetStdHandle (STD_OUTPUT_HANDLE) ; + psf->do_not_close_descriptor = 1 ; + break ; + + default : + error = SFE_BAD_OPEN_MODE ; + break ; + } ; + + psf->filedes = (int) handle ; + psf->filelength = 0 ; + + return error ; +} /* psf_set_stdio */ + +/* Win32 */ void +psf_set_file (SF_PRIVATE *psf, int fd) +{ HANDLE handle ; + long osfhandle ; + + osfhandle = _get_osfhandle (fd) ; + handle = (HANDLE) osfhandle ; + + if (GetFileType (handle) == FILE_TYPE_DISK) + psf->filedes = (int) handle ; + else + psf->filedes = fd ; +} /* psf_set_file */ + +/* Win32 */ int +psf_filedes_valid (SF_PRIVATE *psf) +{ return (((HANDLE) psf->filedes) != INVALID_HANDLE_VALUE) ? SF_TRUE : SF_FALSE ; +} /* psf_set_file */ + +/* Win32 */ sf_count_t +psf_fseek (SF_PRIVATE *psf, sf_count_t offset, int whence) +{ sf_count_t new_position ; + LONG lDistanceToMove, lDistanceToMoveHigh ; + DWORD dwMoveMethod ; + DWORD dwResult, dwError ; + + switch (whence) + { case SEEK_SET : + offset += psf->fileoffset ; + dwMoveMethod = FILE_BEGIN ; + break ; + + case SEEK_END : + dwMoveMethod = FILE_END ; + break ; + + default : + dwMoveMethod = FILE_CURRENT ; + break ; + } ; + + lDistanceToMove = (DWORD) (offset & 0xFFFFFFFF) ; + lDistanceToMoveHigh = (DWORD) ((offset >> 32) & 0xFFFFFFFF) ; + + dwResult = SetFilePointer ((HANDLE) psf->filedes, lDistanceToMove, &lDistanceToMoveHigh, dwMoveMethod) ; + + if (dwResult == 0xFFFFFFFF) + dwError = GetLastError () ; + else + dwError = NO_ERROR ; + + if (dwError != NO_ERROR) + { psf_log_syserr (psf, dwError) ; + return -1 ; + } ; + + new_position = (dwResult + ((__int64) lDistanceToMoveHigh << 32)) - psf->fileoffset ; + + return new_position ; +} /* psf_fseek */ + +/* Win32 */ sf_count_t +psf_fread (void *ptr, sf_count_t bytes, sf_count_t items, SF_PRIVATE *psf) +{ sf_count_t total = 0 ; + ssize_t count ; + DWORD dwNumberOfBytesRead ; + + items *= bytes ; + + /* Do this check after the multiplication above. */ + if (items <= 0) + return 0 ; + + while (items > 0) + { /* Break the writes down to a sensible size. */ + count = (items > SENSIBLE_SIZE) ? SENSIBLE_SIZE : (ssize_t) items ; + + if (ReadFile ((HANDLE) psf->filedes, ((char*) ptr) + total, count, &dwNumberOfBytesRead, 0) == 0) + { psf_log_syserr (psf, GetLastError ()) ; + break ; + } + else + count = dwNumberOfBytesRead ; + + if (count == 0) + break ; + + total += count ; + items -= count ; + } ; + + if (psf->is_pipe) + psf->pipeoffset += total ; + + return total / bytes ; +} /* psf_fread */ + +/* Win32 */ sf_count_t +psf_fwrite (const void *ptr, sf_count_t bytes, sf_count_t items, SF_PRIVATE *psf) +{ sf_count_t total = 0 ; + ssize_t count ; + DWORD dwNumberOfBytesWritten ; + + items *= bytes ; + + /* Do this check after the multiplication above. */ + if (items <= 0) + return 0 ; + + while (items > 0) + { /* Break the writes down to a sensible size. */ + count = (items > SENSIBLE_SIZE) ? SENSIBLE_SIZE : (ssize_t) items ; + + if (WriteFile ((HANDLE) psf->filedes, ((const char*) ptr) + total, count, &dwNumberOfBytesWritten, 0) == 0) + { psf_log_syserr (psf, GetLastError ()) ; + break ; + } + else + count = dwNumberOfBytesWritten ; + + if (count == 0) + break ; + + total += count ; + items -= count ; + } ; + + if (psf->is_pipe) + psf->pipeoffset += total ; + + return total / bytes ; +} /* psf_fwrite */ + +/* Win32 */ sf_count_t +psf_ftell (SF_PRIVATE *psf) +{ sf_count_t pos ; + LONG lDistanceToMoveLow, lDistanceToMoveHigh ; + DWORD dwResult, dwError ; + + if (psf->is_pipe) + return psf->pipeoffset ; + + lDistanceToMoveLow = 0 ; + lDistanceToMoveHigh = 0 ; + + dwResult = SetFilePointer ((HANDLE) psf->filedes, lDistanceToMoveLow, &lDistanceToMoveHigh, FILE_CURRENT) ; + + if (dwResult == 0xFFFFFFFF) + dwError = GetLastError () ; + else + dwError = NO_ERROR ; + + if (dwError != NO_ERROR) + { psf_log_syserr (psf, dwError) ; + return -1 ; + } ; + + pos = (dwResult + ((__int64) lDistanceToMoveHigh << 32)) ; + + return pos - psf->fileoffset ; +} /* psf_ftell */ + +/* Win32 */ int +psf_close_fd (int fd) +{ if (CloseHandle ((HANDLE) fd) == 0) + return -1 ; + + return 0 ; +} /* psf_close_fd */ + +/* Win32 */ sf_count_t +psf_fgets (char *buffer, sf_count_t bufsize, SF_PRIVATE *psf) +{ sf_count_t k = 0 ; + sf_count_t count ; + DWORD dwNumberOfBytesRead ; + + while (k < bufsize - 1) + { if (ReadFile ((HANDLE) psf->filedes, &(buffer [k]), 1, &dwNumberOfBytesRead, 0) == 0) + { psf_log_syserr (psf, GetLastError ()) ; + break ; + } + else + { count = dwNumberOfBytesRead ; + /* note that we only check for '\n' not other line endings such as CRLF */ + if (count == 0 || buffer [k++] == '\n') + break ; + } ; + } ; + + buffer [k] = 0 ; + + return k ; +} /* psf_fgets */ + +/* Win32 */ int +psf_is_pipe (SF_PRIVATE *psf) +{ if (GetFileType ((HANDLE) psf->filedes) == FILE_TYPE_DISK) + return SF_FALSE ; + + /* Default to maximum safety. */ + return SF_TRUE ; +} /* psf_is_pipe */ + +/* Win32 */ sf_count_t +psf_get_filelen_fd (int fd) +{ sf_count_t filelen ; + DWORD dwFileSizeLow, dwFileSizeHigh, dwError = NO_ERROR ; + + dwFileSizeLow = GetFileSize ((HANDLE) fd, &dwFileSizeHigh) ; + + if (dwFileSizeLow == 0xFFFFFFFF) + dwError = GetLastError () ; + + if (dwError != NO_ERROR) + return (sf_count_t) -1 ; + + filelen = dwFileSizeLow + ((__int64) dwFileSizeHigh << 32) ; + + return filelen ; +} /* psf_get_filelen_fd */ + +/* Win32 */ int +psf_ftruncate (SF_PRIVATE *psf, sf_count_t len) +{ int retval = 0 ; + LONG lDistanceToMoveLow, lDistanceToMoveHigh ; + DWORD dwResult, dwError = NO_ERROR ; + + /* This implementation trashes the current file position. + ** should it save and restore it? what if the current position is past + ** the new end of file? + */ + + /* Returns 0 on success, non-zero on failure. */ + if (len < 0) + return 1 ; + + lDistanceToMoveLow = (DWORD) (len & 0xFFFFFFFF) ; + lDistanceToMoveHigh = (DWORD) ((len >> 32) & 0xFFFFFFFF) ; + + dwResult = SetFilePointer ((HANDLE) psf->filedes, lDistanceToMoveLow, &lDistanceToMoveHigh, FILE_BEGIN) ; + + if (dwResult == 0xFFFFFFFF) + dwError = GetLastError () ; + + if (dwError != NO_ERROR) + { retval = -1 ; + psf_log_syserr (psf, dwError) ; + } + else + { /* Note: when SetEndOfFile is used to extend a file, the contents of the + ** new portion of the file is undefined. This is unlike chsize(), + ** which guarantees that the new portion of the file will be zeroed. + ** Not sure if this is important or not. + */ + if (SetEndOfFile ((HANDLE) psf->filedes) == 0) + { retval = -1 ; + psf_log_syserr (psf, GetLastError ()) ; + } ; + } ; + + return retval ; +} /* psf_ftruncate */ + + +#else +/* Win32 file i/o functions implemented using Unix-style file i/o API */ + +/* Win32 has a 64 file offset seek function: +** +** __int64 _lseeki64 (int handle, __int64 offset, int origin) ; +** +** It also has a 64 bit fstat function: +** +** int fstati64 (int, struct _stati64) ; +** +** but the fscking thing doesn't work!!!!! The file size parameter returned +** by this function is only valid up until more data is written at the end of +** the file. That makes this function completely 100% useless. +*/ + +#include +#include + +#ifndef HAVE_SSIZE_T +typedef long ssize_t ; +#endif + +/* Win32 */ int +psf_fopen (SF_PRIVATE *psf, const char *pathname, int open_mode) +{ int oflag, mode ; + + switch (open_mode) + { case SFM_READ : + oflag = O_RDONLY | O_BINARY ; + mode = 0 ; + break ; + + case SFM_WRITE : + oflag = O_WRONLY | O_CREAT | O_TRUNC | O_BINARY ; + mode = S_IRUSR | S_IWUSR | S_IRGRP ; + break ; + + case SFM_RDWR : + oflag = O_RDWR | O_CREAT | O_BINARY ; + mode = S_IRUSR | S_IWUSR | S_IRGRP ; + break ; + + default : + psf->error = SFE_BAD_OPEN_MODE ; + return -1 ; + break ; + } ; + + if (mode == 0) + psf->filedes = open (pathname, oflag) ; + else + psf->filedes = open (pathname, oflag, mode) ; + + if (psf->filedes == -1) + psf_log_syserr (psf, errno) ; + + return psf->filedes ; +} /* psf_fopen */ + +/* Win32 */ sf_count_t +psf_fseek (SF_PRIVATE *psf, sf_count_t offset, int whence) +{ sf_count_t new_position ; + + switch (whence) + { case SEEK_SET : + offset += psf->fileoffset ; + break ; + + case SEEK_END : + if (psf->mode == SFM_WRITE) + { new_position = _lseeki64 (psf->filedes, offset, whence) ; + + if (new_position < 0) + psf_log_syserr (psf, errno) ; + + return new_position - psf->fileoffset ; + } ; + + /* Transform SEEK_END into a SEEK_SET, ie find the file + ** length add the requested offset (should be <= 0) to + ** get the offset wrt the start of file. + */ + whence = SEEK_SET ; + offset = _lseeki64 (psf->filedes, 0, SEEK_END) + offset ; + break ; + + default : + /* No need to do anything about SEEK_CUR. */ + break ; + } ; + + /* + ** Bypass weird Win32-ism if necessary. + ** _lseeki64() returns an "invalid parameter" error if called with the + ** offset == 0 and whence == SEEK_CUR. + *** Use the _telli64() function instead. + */ + if (offset == 0 && whence == SEEK_CUR) + new_position = _telli64 (psf->filedes) ; + else + new_position = _lseeki64 (psf->filedes, offset, whence) ; + + if (new_position < 0) + psf_log_syserr (psf, errno) ; + + new_position -= psf->fileoffset ; + + return new_position ; +} /* psf_fseek */ + +/* Win32 */ sf_count_t +psf_fread (void *ptr, sf_count_t bytes, sf_count_t items, SF_PRIVATE *psf) +{ sf_count_t total = 0 ; + ssize_t count ; + + items *= bytes ; + + /* Do this check after the multiplication above. */ + if (items <= 0) + return 0 ; + + while (items > 0) + { /* Break the writes down to a sensible size. */ + count = (items > SENSIBLE_SIZE) ? SENSIBLE_SIZE : (ssize_t) items ; + + count = read (psf->filedes, ((char*) ptr) + total, (size_t) count) ; + + if (count == -1) + { if (errno == EINTR) + continue ; + + psf_log_syserr (psf, errno) ; + break ; + } ; + + if (count == 0) + break ; + + total += count ; + items -= count ; + } ; + + return total / bytes ; +} /* psf_fread */ + +/* Win32 */ sf_count_t +psf_fwrite (const void *ptr, sf_count_t bytes, sf_count_t items, SF_PRIVATE *psf) +{ sf_count_t total = 0 ; + ssize_t count ; + + items *= bytes ; + + /* Do this check after the multiplication above. */ + if (items <= 0) + return 0 ; + + while (items > 0) + { /* Break the writes down to a sensible size. */ + count = (items > SENSIBLE_SIZE) ? SENSIBLE_SIZE : items ; + + count = write (psf->filedes, ((const char*) ptr) + total, count) ; + + if (count == -1) + { if (errno == EINTR) + continue ; + + psf_log_syserr (psf, errno) ; + break ; + } ; + + if (count == 0) + break ; + + total += count ; + items -= count ; + } ; + + return total / bytes ; +} /* psf_fwrite */ + +/* Win32 */ sf_count_t +psf_ftell (SF_PRIVATE *psf) +{ sf_count_t pos ; + + pos = _telli64 (psf->filedes) ; + + if (pos == ((sf_count_t) -1)) + { psf_log_syserr (psf, errno) ; + return -1 ; + } ; + + return pos - psf->fileoffset ; +} /* psf_ftell */ + +/* Win32 */ int +psf_fclose (SF_PRIVATE *psf) +{ int retval ; + + while ((retval = close (psf->filedes)) == -1 && errno == EINTR) + /* Do nothing. */ ; + + if (retval == -1) + psf_log_syserr (psf, errno) ; + + psf->filedes = -1 ; + + return retval ; +} /* psf_fclose */ + +/* Win32 */ sf_count_t +psf_fgets (char *buffer, sf_count_t bufsize, SF_PRIVATE *psf) +{ sf_count_t k = 0 ; + sf_count_t count ; + + while (k < bufsize - 1) + { count = read (psf->filedes, &(buffer [k]), 1) ; + + if (count == -1) + { if (errno == EINTR) + continue ; + + psf_log_syserr (psf, errno) ; + break ; + } ; + + if (count == 0 || buffer [k++] == '\n') + break ; + } ; + + buffer [k] = 0 ; + + return k ; +} /* psf_fgets */ + +/* Win32 */ int +psf_is_pipe (SF_PRIVATE *psf) +{ struct stat statbuf ; + + /* Not sure if this works. */ + + if (fstat (psf->filedes, &statbuf) == -1) + { psf_log_syserr (psf, errno) ; + /* Default to maximum safety. */ + return SF_TRUE ; + } ; + + /* These macros are defined in Win32/unistd.h. */ + if (S_ISFIFO (statbuf.st_mode) || S_ISSOCK (statbuf.st_mode)) + return SF_TRUE ; + + return SF_FALSE ; +} /* psf_checkpipe */ + +/* Win32 */ sf_count_t +psf_get_filelen (SF_PRIVATE *psf) +{ +#if 0 + /* + ** Windoze is SOOOOO FUCKED!!!!!!! + ** This code should work but doesn't. Why? + ** Code below does work. + */ + struct _stati64 statbuf ; + + if (_fstati64 (psf->filedes, &statbuf)) + { psf_log_syserr (psf, errno) ; + return (sf_count_t) -1 ; + } ; + + return statbuf.st_size ; +#else + sf_count_t current, filelen ; + + if ((current = _telli64 (psf->filedes)) < 0) + { psf_log_syserr (psf, errno) ; + return (sf_count_t) -1 ; + } ; + + /* + ** Lets face it, windoze if FUBAR!!! + ** + ** For some reason, I have to call _lseeki64() TWICE to get to the + ** end of the file. + ** + ** This might have been avoided if windows had implemented the POSIX + ** standard function fsync() but NO, that would have been too easy. + ** + ** I am VERY close to saying that windoze will no longer be supported + ** by libsndfile and changing the license to GPL at the same time. + */ + + _lseeki64 (psf->filedes, 0, SEEK_END) ; + + if ((filelen = _lseeki64 (psf->filedes, 0, SEEK_END)) < 0) + { psf_log_syserr (psf, errno) ; + return (sf_count_t) -1 ; + } ; + + if (filelen > current) + _lseeki64 (psf->filedes, current, SEEK_SET) ; + + switch (psf->mode) + { case SFM_WRITE : + filelen = filelen - psf->fileoffset ; + break ; + + case SFM_READ : + if (psf->fileoffset > 0 && psf->filelength > 0) + filelen = psf->filelength ; + break ; + + case SFM_RDWR : + /* + ** Cannot open embedded files SFM_RDWR so we don't need to + ** subtract psf->fileoffset. We already have the answer we + ** need. + */ + break ; + + default : + filelen = 0 ; + } ; + + return filelen ; +#endif +} /* psf_get_filelen */ + +/* Win32 */ int +psf_ftruncate (SF_PRIVATE *psf, sf_count_t len) +{ int retval ; + + /* Returns 0 on success, non-zero on failure. */ + if (len < 0) + return 1 ; + + /* The global village idiots at micorsoft decided to implement + ** nearly all the required 64 bit file offset functions except + ** for one, truncate. The fscking morons! + ** + ** This is not 64 bit file offset clean. Somone needs to clean + ** this up. + */ + if (len > 0x7FFFFFFF) + return -1 ; + + retval = chsize (psf->filedes, len) ; + + if (retval == -1) + psf_log_syserr (psf, errno) ; + + return retval ; +} /* psf_ftruncate */ + + +static void +psf_log_syserr (SF_PRIVATE *psf, int error) +{ + /* Only log an error if no error has been set yet. */ + if (psf->error == 0) + { psf->error = SFE_SYSTEM ; + LSF_SNPRINTF (psf->syserr, sizeof (psf->syserr), "System error : %s", strerror (error)) ; + } ; + + return ; +} /* psf_log_syserr */ + +#endif + +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: 749740d7-ecc7-47bd-8cf7-600f31d32e6d +*/ diff --git a/Libraries/SndFile/Files/src/float32.c b/Libraries/SndFile/Files/src/float32.c new file mode 100644 index 000000000..0011d444b --- /dev/null +++ b/Libraries/SndFile/Files/src/float32.c @@ -0,0 +1,960 @@ +/* +** Copyright (C) 1999-2004 Erik de Castro Lopo +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU Lesser General Public License as published by +** the Free Software Foundation; either version 2.1 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU Lesser General Public License for more details. +** +** You should have received a copy of the GNU Lesser General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include +#include +#include + +#include "sndfile.h" +#include "config.h" +#include "sfendian.h" +#include "common.h" +#include "float_cast.h" + +#if CPU_IS_LITTLE_ENDIAN + #define FLOAT32_READ float32_le_read + #define FLOAT32_WRITE float32_le_write +#elif CPU_IS_BIG_ENDIAN + #define FLOAT32_READ float32_be_read + #define FLOAT32_WRITE float32_be_write +#endif + +/*-------------------------------------------------------------------------------------------- +** Processor floating point capabilities. float32_get_capability () returns one of the +** latter four values. +*/ + +enum +{ FLOAT_UNKNOWN = 0x00, + FLOAT_CAN_RW_LE = 0x12, + FLOAT_CAN_RW_BE = 0x23, + FLOAT_BROKEN_LE = 0x34, + FLOAT_BROKEN_BE = 0x45 +} ; + +/*-------------------------------------------------------------------------------------------- +** Prototypes for private functions. +*/ + +static sf_count_t host_read_f2s (SF_PRIVATE *psf, short *ptr, sf_count_t len) ; +static sf_count_t host_read_f2i (SF_PRIVATE *psf, int *ptr, sf_count_t len) ; +static sf_count_t host_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ; +static sf_count_t host_read_f2d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ; + +static sf_count_t host_write_s2f (SF_PRIVATE *psf, short *ptr, sf_count_t len) ; +static sf_count_t host_write_i2f (SF_PRIVATE *psf, int *ptr, sf_count_t len) ; +static sf_count_t host_write_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ; +static sf_count_t host_write_d2f (SF_PRIVATE *psf, double *ptr, sf_count_t len) ; + +static void float32_peak_update (SF_PRIVATE *psf, float *buffer, int count, int indx) ; + +static sf_count_t replace_read_f2s (SF_PRIVATE *psf, short *ptr, sf_count_t len) ; +static sf_count_t replace_read_f2i (SF_PRIVATE *psf, int *ptr, sf_count_t len) ; +static sf_count_t replace_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ; +static sf_count_t replace_read_f2d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ; + +static sf_count_t replace_write_s2f (SF_PRIVATE *psf, short *ptr, sf_count_t len) ; +static sf_count_t replace_write_i2f (SF_PRIVATE *psf, int *ptr, sf_count_t len) ; +static sf_count_t replace_write_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ; +static sf_count_t replace_write_d2f (SF_PRIVATE *psf, double *ptr, sf_count_t len) ; + +static void bf2f_array (float *buffer, int count) ; +static void f2bf_array (float *buffer, int count) ; + +static int float32_get_capability (SF_PRIVATE *psf) ; + +/*-------------------------------------------------------------------------------------------- +** Exported functions. +*/ + +int +float32_init (SF_PRIVATE *psf) +{ static int float_caps ; + + float_caps = float32_get_capability (psf) ; + + psf->blockwidth = sizeof (float) * psf->sf.channels ; + + if (psf->mode == SFM_READ || psf->mode == SFM_RDWR) + { switch (psf->endian + float_caps) + { case (SF_ENDIAN_BIG + FLOAT_CAN_RW_BE) : + psf->float_endswap = SF_FALSE ; + psf->read_short = host_read_f2s ; + psf->read_int = host_read_f2i ; + psf->read_float = host_read_f ; + psf->read_double = host_read_f2d ; + break ; + + case (SF_ENDIAN_LITTLE + FLOAT_CAN_RW_LE) : + psf->float_endswap = SF_FALSE ; + psf->read_short = host_read_f2s ; + psf->read_int = host_read_f2i ; + psf->read_float = host_read_f ; + psf->read_double = host_read_f2d ; + break ; + + case (SF_ENDIAN_BIG + FLOAT_CAN_RW_LE) : + psf->float_endswap = SF_TRUE ; + psf->read_short = host_read_f2s ; + psf->read_int = host_read_f2i ; + psf->read_float = host_read_f ; + psf->read_double = host_read_f2d ; + break ; + + case (SF_ENDIAN_LITTLE + FLOAT_CAN_RW_BE) : + psf->float_endswap = SF_TRUE ; + psf->read_short = host_read_f2s ; + psf->read_int = host_read_f2i ; + psf->read_float = host_read_f ; + psf->read_double = host_read_f2d ; + break ; + + /* When the CPU is not IEEE compatible. */ + case (SF_ENDIAN_BIG + FLOAT_BROKEN_LE) : + psf->float_endswap = SF_TRUE ; + psf->read_short = replace_read_f2s ; + psf->read_int = replace_read_f2i ; + psf->read_float = replace_read_f ; + psf->read_double = replace_read_f2d ; + break ; + + case (SF_ENDIAN_LITTLE + FLOAT_BROKEN_LE) : + psf->float_endswap = SF_FALSE ; + psf->read_short = replace_read_f2s ; + psf->read_int = replace_read_f2i ; + psf->read_float = replace_read_f ; + psf->read_double = replace_read_f2d ; + break ; + + case (SF_ENDIAN_BIG + FLOAT_BROKEN_BE) : + psf->float_endswap = SF_FALSE ; + psf->read_short = replace_read_f2s ; + psf->read_int = replace_read_f2i ; + psf->read_float = replace_read_f ; + psf->read_double = replace_read_f2d ; + break ; + + case (SF_ENDIAN_LITTLE + FLOAT_BROKEN_BE) : + psf->float_endswap = SF_TRUE ; + psf->read_short = replace_read_f2s ; + psf->read_int = replace_read_f2i ; + psf->read_float = replace_read_f ; + psf->read_double = replace_read_f2d ; + break ; + + default : break ; + } ; + } ; + + if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR) + { switch (psf->endian + float_caps) + { case (SF_ENDIAN_LITTLE + FLOAT_CAN_RW_LE) : + psf->float_endswap = SF_FALSE ; + psf->write_short = host_write_s2f ; + psf->write_int = host_write_i2f ; + psf->write_float = host_write_f ; + psf->write_double = host_write_d2f ; + break ; + + case (SF_ENDIAN_BIG + FLOAT_CAN_RW_BE) : + psf->float_endswap = SF_FALSE ; + psf->write_short = host_write_s2f ; + psf->write_int = host_write_i2f ; + psf->write_float = host_write_f ; + psf->write_double = host_write_d2f ; + break ; + + case (SF_ENDIAN_BIG + FLOAT_CAN_RW_LE) : + psf->float_endswap = SF_TRUE ; + psf->write_short = host_write_s2f ; + psf->write_int = host_write_i2f ; + psf->write_float = host_write_f ; + psf->write_double = host_write_d2f ; + break ; + + case (SF_ENDIAN_LITTLE + FLOAT_CAN_RW_BE) : + psf->float_endswap = SF_TRUE ; + psf->write_short = host_write_s2f ; + psf->write_int = host_write_i2f ; + psf->write_float = host_write_f ; + psf->write_double = host_write_d2f ; + break ; + + /* When the CPU is not IEEE compatible. */ + case (SF_ENDIAN_BIG + FLOAT_BROKEN_LE) : + psf->float_endswap = SF_TRUE ; + psf->write_short = replace_write_s2f ; + psf->write_int = replace_write_i2f ; + psf->write_float = replace_write_f ; + psf->write_double = replace_write_d2f ; + break ; + + case (SF_ENDIAN_LITTLE + FLOAT_BROKEN_LE) : + psf->float_endswap = SF_FALSE ; + psf->write_short = replace_write_s2f ; + psf->write_int = replace_write_i2f ; + psf->write_float = replace_write_f ; + psf->write_double = replace_write_d2f ; + break ; + + case (SF_ENDIAN_BIG + FLOAT_BROKEN_BE) : + psf->float_endswap = SF_FALSE ; + psf->write_short = replace_write_s2f ; + psf->write_int = replace_write_i2f ; + psf->write_float = replace_write_f ; + psf->write_double = replace_write_d2f ; + break ; + + case (SF_ENDIAN_LITTLE + FLOAT_BROKEN_BE) : + psf->float_endswap = SF_TRUE ; + psf->write_short = replace_write_s2f ; + psf->write_int = replace_write_i2f ; + psf->write_float = replace_write_f ; + psf->write_double = replace_write_d2f ; + break ; + + default : break ; + } ; + } ; + + if (psf->filelength > psf->dataoffset) + { psf->datalength = (psf->dataend > 0) ? psf->dataend - psf->dataoffset : + psf->filelength - psf->dataoffset ; + } + else + psf->datalength = 0 ; + + psf->sf.frames = psf->datalength / psf->blockwidth ; + + return 0 ; +} /* float32_init */ + +float +float32_be_read (unsigned char *cptr) +{ int exponent, mantissa, negative ; + float fvalue ; + + negative = cptr [0] & 0x80 ; + exponent = ((cptr [0] & 0x7F) << 1) | ((cptr [1] & 0x80) ? 1 : 0) ; + mantissa = ((cptr [1] & 0x7F) << 16) | (cptr [2] << 8) | (cptr [3]) ; + + if (! (exponent || mantissa)) + return 0.0 ; + + mantissa |= 0x800000 ; + exponent = exponent ? exponent - 127 : 0 ; + + fvalue = mantissa ? ((float) mantissa) / ((float) 0x800000) : 0.0 ; + + if (negative) + fvalue *= -1 ; + + if (exponent > 0) + fvalue *= (1 << exponent) ; + else if (exponent < 0) + fvalue /= (1 << abs (exponent)) ; + + return fvalue ; +} /* float32_be_read */ + +float +float32_le_read (unsigned char *cptr) +{ int exponent, mantissa, negative ; + float fvalue ; + + negative = cptr [3] & 0x80 ; + exponent = ((cptr [3] & 0x7F) << 1) | ((cptr [2] & 0x80) ? 1 : 0) ; + mantissa = ((cptr [2] & 0x7F) << 16) | (cptr [1] << 8) | (cptr [0]) ; + + if (! (exponent || mantissa)) + return 0.0 ; + + mantissa |= 0x800000 ; + exponent = exponent ? exponent - 127 : 0 ; + + fvalue = mantissa ? ((float) mantissa) / ((float) 0x800000) : 0.0 ; + + if (negative) + fvalue *= -1 ; + + if (exponent > 0) + fvalue *= (1 << exponent) ; + else if (exponent < 0) + fvalue /= (1 << abs (exponent)) ; + + return fvalue ; +} /* float32_le_read */ + +void +float32_le_write (float in, unsigned char *out) +{ int exponent, mantissa, negative = 0 ; + + memset (out, 0, sizeof (int)) ; + + if (in == 0.0) + return ; + + if (in < 0.0) + { in *= -1.0 ; + negative = 1 ; + } ; + + in = frexp (in, &exponent) ; + + exponent += 126 ; + + in *= (float) 0x1000000 ; + mantissa = (((int) in) & 0x7FFFFF) ; + + if (negative) + out [3] |= 0x80 ; + + if (exponent & 0x01) + out [2] |= 0x80 ; + + out [0] = mantissa & 0xFF ; + out [1] = (mantissa >> 8) & 0xFF ; + out [2] |= (mantissa >> 16) & 0x7F ; + out [3] |= (exponent >> 1) & 0x7F ; + + return ; +} /* float32_le_write */ + +void +float32_be_write (float in, unsigned char *out) +{ int exponent, mantissa, negative = 0 ; + + memset (out, 0, sizeof (int)) ; + + if (in == 0.0) + return ; + + if (in < 0.0) + { in *= -1.0 ; + negative = 1 ; + } ; + + in = frexp (in, &exponent) ; + + exponent += 126 ; + + in *= (float) 0x1000000 ; + mantissa = (((int) in) & 0x7FFFFF) ; + + if (negative) + out [0] |= 0x80 ; + + if (exponent & 0x01) + out [1] |= 0x80 ; + + out [3] = mantissa & 0xFF ; + out [2] = (mantissa >> 8) & 0xFF ; + out [1] |= (mantissa >> 16) & 0x7F ; + out [0] |= (exponent >> 1) & 0x7F ; + + return ; +} /* float32_be_write */ + +/*============================================================================================== +** Private functions. +*/ + +static void +float32_peak_update (SF_PRIVATE *psf, float *buffer, int count, int indx) +{ int chan ; + int k, position ; + float fmaxval ; + + for (chan = 0 ; chan < psf->sf.channels ; chan++) + { fmaxval = fabs (buffer [chan]) ; + position = 0 ; + for (k = chan ; k < count ; k += psf->sf.channels) + if (fmaxval < fabs (buffer [k])) + { fmaxval = fabs (buffer [k]) ; + position = k ; + } ; + + if (fmaxval > psf->pchunk->peaks [chan].value) + { psf->pchunk->peaks [chan].value = fmaxval ; + psf->pchunk->peaks [chan].position = psf->write_current + indx + (position / psf->sf.channels) ; + } ; + } ; + + return ; +} /* float32_peak_update */ + +static int +float32_get_capability (SF_PRIVATE *psf) +{ union + { float f ; + int i ; + unsigned char c [4] ; + } data ; + + data.f = (float) 1.23456789 ; /* Some abitrary value. */ + + if (! psf->ieee_replace) + { /* If this test is true ints and floats are compatible and little endian. */ + if (data.c [0] == 0x52 && data.c [1] == 0x06 && data.c [2] == 0x9e && data.c [3] == 0x3f) + return FLOAT_CAN_RW_LE ; + + /* If this test is true ints and floats are compatible and big endian. */ + if (data.c [3] == 0x52 && data.c [2] == 0x06 && data.c [1] == 0x9e && data.c [0] == 0x3f) + return FLOAT_CAN_RW_BE ; + } ; + + /* Floats are broken. Don't expect reading or writing to be fast. */ + psf_log_printf (psf, "Using IEEE replacement code for float.\n") ; + + return (CPU_IS_LITTLE_ENDIAN) ? FLOAT_BROKEN_LE : FLOAT_BROKEN_BE ; +} /* float32_get_capability */ + +/*======================================================================================= +*/ + +static inline void +f2s_array (float *src, int count, short *dest, float scale) +{ while (--count >= 0) + { dest [count] = lrintf (scale * src [count]) ; + } ; +} /* f2s_array */ + +static inline void +f2i_array (float *src, int count, int *dest, float scale) +{ while (--count >= 0) + { dest [count] = lrintf (scale * src [count]) ; + } ; +} /* f2i_array */ + +static inline void +f2d_array (float *src, int count, double *dest) +{ while (--count >= 0) + { dest [count] = src [count] ; + } ; +} /* f2d_array */ + +static inline void +s2f_array (short *src, float *dest, int count) +{ while (--count >= 0) + { dest [count] = src [count] ; + } ; + +} /* s2f_array */ + +static inline void +i2f_array (int *src, float *dest, int count) +{ while (--count >= 0) + { dest [count] = src [count] ; + } ; +} /* i2f_array */ + +static inline void +d2f_array (double *src, float *dest, int count) +{ while (--count >= 0) + { dest [count] = src [count] ; + } ; +} /* d2f_array */ + +/*---------------------------------------------------------------------------------------------- +*/ + +static sf_count_t +host_read_f2s (SF_PRIVATE *psf, short *ptr, sf_count_t len) +{ int bufferlen, readcount ; + sf_count_t total = 0 ; + float scale ; + + bufferlen = ARRAY_LEN (psf->u.fbuf) ; + scale = (psf->float_int_mult == 0) ? 1.0 : 0x7FFF / psf->float_max ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + readcount = psf_fread (psf->u.fbuf, sizeof (float), bufferlen, psf) ; + +/* Fix me : Need lef2s_array */ + if (psf->float_endswap == SF_TRUE) + endswap_int_array (psf->u.ibuf, bufferlen) ; + + f2s_array (psf->u.fbuf, readcount, ptr + total, scale) ; + total += readcount ; + if (readcount < bufferlen) + break ; + len -= readcount ; + } ; + + return total ; +} /* host_read_f2s */ + +static sf_count_t +host_read_f2i (SF_PRIVATE *psf, int *ptr, sf_count_t len) +{ int bufferlen, readcount ; + sf_count_t total = 0 ; + float scale ; + + bufferlen = ARRAY_LEN (psf->u.fbuf) ; + scale = (psf->float_int_mult == 0) ? 1.0 : 0x7FFFFFFF / psf->float_max ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + readcount = psf_fread (psf->u.fbuf, sizeof (float), bufferlen, psf) ; + + if (psf->float_endswap == SF_TRUE) + endswap_int_array (psf->u.ibuf, bufferlen) ; + + f2i_array (psf->u.fbuf, readcount, ptr + total, scale) ; + total += readcount ; + if (readcount < bufferlen) + break ; + len -= readcount ; + } ; + + return total ; +} /* host_read_f2i */ + +static sf_count_t +host_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) +{ int bufferlen, readcount ; + sf_count_t total = 0 ; + + if (psf->float_endswap != SF_TRUE) + return psf_fread (ptr, sizeof (float), len, psf) ; + + bufferlen = ARRAY_LEN (psf->u.fbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + readcount = psf_fread (psf->u.fbuf, sizeof (float), bufferlen, psf) ; + + endswap_int_copy ((int*) (ptr + total), psf->u.ibuf, readcount) ; + + total += readcount ; + if (readcount < bufferlen) + break ; + len -= readcount ; + } ; + + return total ; +} /* host_read_f */ + +static sf_count_t +host_read_f2d (SF_PRIVATE *psf, double *ptr, sf_count_t len) +{ int bufferlen, readcount ; + sf_count_t total = 0 ; + + bufferlen = ARRAY_LEN (psf->u.fbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + readcount = psf_fread (psf->u.fbuf, sizeof (float), bufferlen, psf) ; + + if (psf->float_endswap == SF_TRUE) + endswap_int_array (psf->u.ibuf, bufferlen) ; + +/* Fix me : Need lef2d_array */ + f2d_array (psf->u.fbuf, readcount, ptr + total) ; + total += readcount ; + if (readcount < bufferlen) + break ; + len -= readcount ; + } ; + + return total ; +} /* host_read_f2d */ + +static sf_count_t +host_write_s2f (SF_PRIVATE *psf, short *ptr, sf_count_t len) +{ int bufferlen, writecount ; + sf_count_t total = 0 ; + + bufferlen = ARRAY_LEN (psf->u.fbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + s2f_array (ptr + total, psf->u.fbuf, bufferlen) ; + + if (psf->has_peak) + float32_peak_update (psf, psf->u.fbuf, bufferlen, (int) (total / psf->sf.channels)) ; + + if (psf->float_endswap == SF_TRUE) + endswap_int_array (psf->u.ibuf, bufferlen) ; + + writecount = psf_fwrite (psf->u.fbuf, sizeof (float), bufferlen, psf) ; + total += writecount ; + if (writecount < bufferlen) + break ; + len -= writecount ; + } ; + + return total ; +} /* host_write_s2f */ + +static sf_count_t +host_write_i2f (SF_PRIVATE *psf, int *ptr, sf_count_t len) +{ int bufferlen, writecount ; + sf_count_t total = 0 ; + + bufferlen = ARRAY_LEN (psf->u.fbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + i2f_array (ptr + total, psf->u.fbuf, bufferlen) ; + + if (psf->has_peak) + float32_peak_update (psf, psf->u.fbuf, bufferlen, (int) (total / psf->sf.channels)) ; + + if (psf->float_endswap == SF_TRUE) + endswap_int_array (psf->u.ibuf, bufferlen) ; + + writecount = psf_fwrite (psf->u.fbuf, sizeof (float) , bufferlen, psf) ; + total += writecount ; + if (writecount < bufferlen) + break ; + len -= writecount ; + } ; + + return total ; +} /* host_write_i2f */ + +static sf_count_t +host_write_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) +{ int bufferlen, writecount ; + sf_count_t total = 0 ; + + if (psf->has_peak) + float32_peak_update (psf, ptr, len, 0) ; + + if (psf->float_endswap != SF_TRUE) + return psf_fwrite (ptr, sizeof (float), len, psf) ; + + bufferlen = ARRAY_LEN (psf->u.fbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + + endswap_int_copy (psf->u.ibuf, (int*) (ptr + total), bufferlen) ; + + writecount = psf_fwrite (psf->u.fbuf, sizeof (float), bufferlen, psf) ; + total += writecount ; + if (writecount < bufferlen) + break ; + len -= writecount ; + } ; + + return total ; +} /* host_write_f */ + +static sf_count_t +host_write_d2f (SF_PRIVATE *psf, double *ptr, sf_count_t len) +{ int bufferlen, writecount ; + sf_count_t total = 0 ; + + bufferlen = ARRAY_LEN (psf->u.fbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + + d2f_array (ptr + total, psf->u.fbuf, bufferlen) ; + + if (psf->has_peak) + float32_peak_update (psf, psf->u.fbuf, bufferlen, (int) (total / psf->sf.channels)) ; + + if (psf->float_endswap == SF_TRUE) + endswap_int_array (psf->u.ibuf, bufferlen) ; + + writecount = psf_fwrite (psf->u.fbuf, sizeof (float), bufferlen, psf) ; + total += writecount ; + if (writecount < bufferlen) + break ; + len -= writecount ; + } ; + + return total ; +} /* host_write_d2f */ + +/*======================================================================================= +*/ + +static sf_count_t +replace_read_f2s (SF_PRIVATE *psf, short *ptr, sf_count_t len) +{ int bufferlen, readcount ; + sf_count_t total = 0 ; + float scale ; + + bufferlen = ARRAY_LEN (psf->u.fbuf) ; + scale = (psf->float_int_mult == 0) ? 1.0 : 0x7FFF / psf->float_max ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + readcount = psf_fread (psf->u.fbuf, sizeof (float), bufferlen, psf) ; + + if (psf->float_endswap == SF_TRUE) + endswap_int_array (psf->u.ibuf, bufferlen) ; + + bf2f_array (psf->u.fbuf, bufferlen) ; + + f2s_array (psf->u.fbuf, readcount, ptr + total, scale) ; + total += readcount ; + if (readcount < bufferlen) + break ; + len -= readcount ; + } ; + + return total ; +} /* replace_read_f2s */ + +static sf_count_t +replace_read_f2i (SF_PRIVATE *psf, int *ptr, sf_count_t len) +{ int bufferlen, readcount ; + sf_count_t total = 0 ; + float scale ; + + bufferlen = ARRAY_LEN (psf->u.fbuf) ; + scale = (psf->float_int_mult == 0) ? 1.0 : 0x7FFF / psf->float_max ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + readcount = psf_fread (psf->u.fbuf, sizeof (float), bufferlen, psf) ; + + if (psf->float_endswap == SF_TRUE) + endswap_int_array (psf->u.ibuf, bufferlen) ; + + bf2f_array (psf->u.fbuf, bufferlen) ; + + f2i_array (psf->u.fbuf, readcount, ptr + total, scale) ; + total += readcount ; + if (readcount < bufferlen) + break ; + len -= readcount ; + } ; + + return total ; +} /* replace_read_f2i */ + +static sf_count_t +replace_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) +{ int bufferlen, readcount ; + sf_count_t total = 0 ; + + /* FIX THIS */ + + bufferlen = ARRAY_LEN (psf->u.fbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + readcount = psf_fread (psf->u.fbuf, sizeof (float), bufferlen, psf) ; + + if (psf->float_endswap == SF_TRUE) + endswap_int_array (psf->u.ibuf, bufferlen) ; + + bf2f_array (psf->u.fbuf, bufferlen) ; + + memcpy (ptr + total, psf->u.fbuf, bufferlen * sizeof (float)) ; + + total += readcount ; + if (readcount < bufferlen) + break ; + len -= readcount ; + } ; + + return total ; +} /* replace_read_f */ + +static sf_count_t +replace_read_f2d (SF_PRIVATE *psf, double *ptr, sf_count_t len) +{ int bufferlen, readcount ; + sf_count_t total = 0 ; + + bufferlen = ARRAY_LEN (psf->u.fbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + readcount = psf_fread (psf->u.fbuf, sizeof (float), bufferlen, psf) ; + + if (psf->float_endswap == SF_TRUE) + endswap_int_array (psf->u.ibuf, bufferlen) ; + + bf2f_array (psf->u.fbuf, bufferlen) ; + + f2d_array (psf->u.fbuf, readcount, ptr + total) ; + total += readcount ; + if (readcount < bufferlen) + break ; + len -= readcount ; + } ; + + return total ; +} /* replace_read_f2d */ + +static sf_count_t +replace_write_s2f (SF_PRIVATE *psf, short *ptr, sf_count_t len) +{ int bufferlen, writecount ; + sf_count_t total = 0 ; + + bufferlen = ARRAY_LEN (psf->u.fbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + s2f_array (ptr + total, psf->u.fbuf, bufferlen) ; + + if (psf->has_peak) + float32_peak_update (psf, psf->u.fbuf, bufferlen, (int) (total / psf->sf.channels)) ; + + f2bf_array (psf->u.fbuf, bufferlen) ; + + if (psf->float_endswap == SF_TRUE) + endswap_int_array (psf->u.ibuf, bufferlen) ; + + writecount = psf_fwrite (psf->u.fbuf, sizeof (float), bufferlen, psf) ; + total += writecount ; + if (writecount < bufferlen) + break ; + len -= writecount ; + } ; + + return total ; +} /* replace_write_s2f */ + +static sf_count_t +replace_write_i2f (SF_PRIVATE *psf, int *ptr, sf_count_t len) +{ int bufferlen, writecount ; + sf_count_t total = 0 ; + + bufferlen = ARRAY_LEN (psf->u.fbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + i2f_array (ptr + total, psf->u.fbuf, bufferlen) ; + + if (psf->has_peak) + float32_peak_update (psf, psf->u.fbuf, bufferlen, (int) (total / psf->sf.channels)) ; + + f2bf_array (psf->u.fbuf, bufferlen) ; + + if (psf->float_endswap == SF_TRUE) + endswap_int_array (psf->u.ibuf, bufferlen) ; + + writecount = psf_fwrite (psf->u.fbuf, sizeof (float), bufferlen, psf) ; + total += writecount ; + if (writecount < bufferlen) + break ; + len -= writecount ; + } ; + + return total ; +} /* replace_write_i2f */ + +static sf_count_t +replace_write_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) +{ int bufferlen, writecount ; + sf_count_t total = 0 ; + + /* FIX THIS */ + if (psf->has_peak) + float32_peak_update (psf, ptr, len, 0) ; + + bufferlen = ARRAY_LEN (psf->u.fbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + + memcpy (psf->u.fbuf, ptr + total, bufferlen * sizeof (float)) ; + + f2bf_array (psf->u.fbuf, bufferlen) ; + + if (psf->float_endswap == SF_TRUE) + endswap_int_array (psf->u.ibuf, bufferlen) ; + + writecount = psf_fwrite (psf->u.fbuf, sizeof (float) , bufferlen, psf) ; + total += writecount ; + if (writecount < bufferlen) + break ; + len -= writecount ; + } ; + + return total ; +} /* replace_write_f */ + +static sf_count_t +replace_write_d2f (SF_PRIVATE *psf, double *ptr, sf_count_t len) +{ int bufferlen, writecount ; + sf_count_t total = 0 ; + + bufferlen = ARRAY_LEN (psf->u.fbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + d2f_array (ptr + total, psf->u.fbuf, bufferlen) ; + + if (psf->has_peak) + float32_peak_update (psf, psf->u.fbuf, bufferlen, (int) (total / psf->sf.channels)) ; + + f2bf_array (psf->u.fbuf, bufferlen) ; + + if (psf->float_endswap == SF_TRUE) + endswap_int_array (psf->u.ibuf, bufferlen) ; + + writecount = psf_fwrite (psf->u.fbuf, sizeof (float), bufferlen, psf) ; + total += writecount ; + if (writecount < bufferlen) + break ; + len -= writecount ; + } ; + + return total ; +} /* replace_write_d2f */ + +/*---------------------------------------------------------------------------------------------- +*/ + +static void +bf2f_array (float *buffer, int count) +{ while (--count >= 0) + { buffer [count] = FLOAT32_READ ((unsigned char *) (buffer + count)) ; + } ; +} /* bf2f_array */ + +static void +f2bf_array (float *buffer, int count) +{ while (--count >= 0) + { FLOAT32_WRITE (buffer [count], (unsigned char*) (buffer + count)) ; + } ; +} /* f2bf_array */ + +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: b6c34917-488c-4145-9648-f4371fc4c889 +*/ diff --git a/Libraries/SndFile/Files/src/float_cast.h b/Libraries/SndFile/Files/src/float_cast.h new file mode 100644 index 000000000..107469604 --- /dev/null +++ b/Libraries/SndFile/Files/src/float_cast.h @@ -0,0 +1,210 @@ +/* +** Copyright (C) 2001-2004 Erik de Castro Lopo +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU Lesser General Public License as published by +** the Free Software Foundation; either version 2.1 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU Lesser General Public License for more details. +** +** You should have received a copy of the GNU Lesser General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +/* Version 1.3 */ + + +/*============================================================================ +** On Intel Pentium processors (especially PIII and probably P4), converting +** from float to int is very slow. To meet the C specs, the code produced by +** most C compilers targeting Pentium needs to change the FPU rounding mode +** before the float to int conversion is performed. +** +** Changing the FPU rounding mode causes the FPU pipeline to be flushed. It +** is this flushing of the pipeline which is so slow. +** +** Fortunately the ISO C99 specifications define the functions lrint, lrintf, +** llrint and llrintf which fix this problem as a side effect. +** +** On Unix-like systems, the configure process should have detected the +** presence of these functions. If they weren't found we have to replace them +** here with a standard C cast. +*/ + +/* +** The C99 prototypes for lrint and lrintf are as follows: +** +** long int lrintf (float x) ; +** long int lrint (double x) ; +*/ + +#include "config.h" + +/* +** The presence of the required functions are detected during the configure +** process and the values HAVE_LRINT and HAVE_LRINTF are set accordingly in +** the config.h file. +*/ + +#define HAVE_LRINT_REPLACEMENT 0 + +#if (HAVE_LRINT && HAVE_LRINTF) + + /* + ** These defines enable functionality introduced with the 1999 ISO C + ** standard. They must be defined before the inclusion of math.h to + ** engage them. If optimisation is enabled, these functions will be + ** inlined. With optimisation switched off, you have to link in the + ** maths library using -lm. + */ + + #define _ISOC9X_SOURCE 1 + #define _ISOC99_SOURCE 1 + + #define __USE_ISOC9X 1 + #define __USE_ISOC99 1 + + #include + +#elif (defined (WIN32) || defined (_WIN32)) + + #undef HAVE_LRINT_REPLACEMENT + #define HAVE_LRINT_REPLACEMENT 1 + #include + + /* + ** Win32 doesn't seem to have these functions. + ** Therefore implement inline versions of these functions here. + */ + + __inline long int + lrint (double flt) + { int intgr ; + + _asm + { fld flt + fistp intgr + } ; + + return intgr ; + } + + __inline long int + lrintf (float flt) + { int intgr ; + + _asm + { fld flt + fistp intgr + } ; + + return intgr ; + } + +#elif (defined (__MWERKS__) && defined (macintosh)) + + /* This MacOS 9 solution was provided by Stephane Letz */ + + #undef HAVE_LRINT_REPLACEMENT + #define HAVE_LRINT_REPLACEMENT 1 + #include + + #undef lrint + #undef lrintf + + #define lrint double2int + #define lrintf float2int + + inline int + float2int (register float in) + { long res [2] ; + + asm + { fctiw in, in + stfd in, res + } + return res [1] ; + } /* float2int */ + + inline int + double2int (register double in) + { long res [2] ; + + asm + { fctiw in, in + stfd in, res + } + return res [1] ; + } /* double2int */ + +#elif (defined (__MACH__) && defined (__APPLE__)) + + /* For Apple MacOSX. */ + + #undef HAVE_LRINT_REPLACEMENT + #define HAVE_LRINT_REPLACEMENT 1 + #include + + #undef lrint + #undef lrintf + + #define lrint double2int + #define lrintf float2int + + inline static long int + float2int (register float in) + { int res [2] ; + + __asm__ __volatile__ + ( "fctiw %1, %1\n\t" + "stfd %1, %0" + : "=m" (res) /* Output */ + : "f" (in) /* Input */ + : "memory" + ) ; + + return res [1] ; + } /* lrintf */ + + inline static long int + double2int (register double in) + { int res [2] ; + + __asm__ __volatile__ + ( "fctiw %1, %1\n\t" + "stfd %1, %0" + : "=m" (res) /* Output */ + : "f" (in) /* Input */ + : "memory" + ) ; + + return res [1] ; + } /* lrint */ + +#else + #ifndef __sgi + #warning "Don't have the functions lrint() and lrintf()." + #warning "Replacing these functions with a standard C cast." + #endif + + #include + + #define lrint(dbl) ((long) (dbl)) + #define lrintf(flt) ((long) (flt)) + +#endif + + + +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: 42db1693-ff61-4051-bac1-e4d24c4e30b7 +*/ diff --git a/Libraries/SndFile/Files/src/gsm610.c b/Libraries/SndFile/Files/src/gsm610.c new file mode 100644 index 000000000..8c1fbe350 --- /dev/null +++ b/Libraries/SndFile/Files/src/gsm610.c @@ -0,0 +1,605 @@ +/* +** Copyright (C) 1999-2004 Erik de Castro Lopo +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU Lesser General Public License as published by +** the Free Software Foundation; either version 2.1 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU Lesser General Public License for more details. +** +** You should have received a copy of the GNU Lesser General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include "config.h" + +#include +#include +#include + +#include "sndfile.h" +#include "sfendian.h" +#include "float_cast.h" +#include "common.h" +#include "wav_w64.h" +#include "GSM610/gsm.h" + +#define GSM610_BLOCKSIZE 33 +#define GSM610_SAMPLES 160 + +typedef struct gsm610_tag +{ int blocks ; + int blockcount, samplecount ; + int samplesperblock, blocksize ; + + int (*decode_block) (SF_PRIVATE *psf, struct gsm610_tag *pgsm610) ; + int (*encode_block) (SF_PRIVATE *psf, struct gsm610_tag *pgsm610) ; + + short samples [WAV_W64_GSM610_SAMPLES] ; + unsigned char block [WAV_W64_GSM610_BLOCKSIZE] ; + + gsm gsm_data ; +} GSM610_PRIVATE ; + +static sf_count_t gsm610_read_s (SF_PRIVATE *psf, short *ptr, sf_count_t len) ; +static sf_count_t gsm610_read_i (SF_PRIVATE *psf, int *ptr, sf_count_t len) ; +static sf_count_t gsm610_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ; +static sf_count_t gsm610_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ; + +static sf_count_t gsm610_write_s (SF_PRIVATE *psf, short *ptr, sf_count_t len) ; +static sf_count_t gsm610_write_i (SF_PRIVATE *psf, int *ptr, sf_count_t len) ; +static sf_count_t gsm610_write_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ; +static sf_count_t gsm610_write_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ; + +static int gsm610_read_block (SF_PRIVATE *psf, GSM610_PRIVATE *pgsm610, short *ptr, int len) ; +static int gsm610_write_block (SF_PRIVATE *psf, GSM610_PRIVATE *pgsm610, short *ptr, int len) ; + +static int gsm610_decode_block (SF_PRIVATE *psf, GSM610_PRIVATE *pgsm610) ; +static int gsm610_encode_block (SF_PRIVATE *psf, GSM610_PRIVATE *pgsm610) ; + +static int gsm610_wav_decode_block (SF_PRIVATE *psf, GSM610_PRIVATE *pgsm610) ; +static int gsm610_wav_encode_block (SF_PRIVATE *psf, GSM610_PRIVATE *pgsm610) ; + +static sf_count_t gsm610_seek (SF_PRIVATE *psf, int mode, sf_count_t offset) ; + +static int gsm610_close (SF_PRIVATE *psf) ; + +/*============================================================================================ +** WAV GSM610 initialisation function. +*/ + +int +gsm610_init (SF_PRIVATE *psf) +{ GSM610_PRIVATE *pgsm610 ; + int true_flag = 1 ; + + if (psf->mode == SFM_RDWR) + return SFE_BAD_MODE_RW ; + + psf->sf.seekable = SF_FALSE ; + + if (! (pgsm610 = malloc (sizeof (GSM610_PRIVATE)))) + return SFE_MALLOC_FAILED ; + + psf->fdata = (void*) pgsm610 ; + + memset (pgsm610, 0, sizeof (GSM610_PRIVATE)) ; + +/*============================================================ + +Need separate gsm_data structs for encode and decode. + +============================================================*/ + + if (! (pgsm610->gsm_data = gsm_create ())) + return SFE_MALLOC_FAILED ; + + if ((psf->sf.format & SF_FORMAT_TYPEMASK) == SF_FORMAT_WAV || + (psf->sf.format & SF_FORMAT_TYPEMASK) == SF_FORMAT_W64) + { gsm_option (pgsm610->gsm_data, GSM_OPT_WAV49, &true_flag) ; + + pgsm610->encode_block = gsm610_wav_encode_block ; + pgsm610->decode_block = gsm610_wav_decode_block ; + + pgsm610->samplesperblock = WAV_W64_GSM610_SAMPLES ; + pgsm610->blocksize = WAV_W64_GSM610_BLOCKSIZE ; + } + else + { pgsm610->encode_block = gsm610_encode_block ; + pgsm610->decode_block = gsm610_decode_block ; + + pgsm610->samplesperblock = GSM610_SAMPLES ; + pgsm610->blocksize = GSM610_BLOCKSIZE ; + } ; + + if (psf->mode == SFM_READ) + { if (psf->datalength % pgsm610->blocksize) + { psf_log_printf (psf, "*** Warning : data chunk seems to be truncated.\n") ; + pgsm610->blocks = psf->datalength / pgsm610->blocksize + 1 ; + } + else + pgsm610->blocks = psf->datalength / pgsm610->blocksize ; + + psf->sf.frames = pgsm610->samplesperblock * pgsm610->blocks ; + + pgsm610->decode_block (psf, pgsm610) ; /* Read first block. */ + + psf->read_short = gsm610_read_s ; + psf->read_int = gsm610_read_i ; + psf->read_float = gsm610_read_f ; + psf->read_double = gsm610_read_d ; + } ; + + if (psf->mode == SFM_WRITE) + { pgsm610->blockcount = 0 ; + pgsm610->samplecount = 0 ; + + psf->write_short = gsm610_write_s ; + psf->write_int = gsm610_write_i ; + psf->write_float = gsm610_write_f ; + psf->write_double = gsm610_write_d ; + } ; + + psf->close = gsm610_close ; + psf->seek = gsm610_seek ; + + psf->filelength = psf_get_filelen (psf) ; + psf->datalength = psf->filelength - psf->dataoffset ; + + return 0 ; +} /* gsm610_init */ + +/*============================================================================================ +** GSM 6.10 Read Functions. +*/ + +static int +gsm610_wav_decode_block (SF_PRIVATE *psf, GSM610_PRIVATE *pgsm610) +{ int k ; + + pgsm610->blockcount ++ ; + pgsm610->samplecount = 0 ; + + if (pgsm610->blockcount > pgsm610->blocks) + { memset (pgsm610->samples, 0, WAV_W64_GSM610_SAMPLES * sizeof (short)) ; + return 1 ; + } ; + + if ((k = psf_fread (pgsm610->block, 1, WAV_W64_GSM610_BLOCKSIZE, psf)) != WAV_W64_GSM610_BLOCKSIZE) + psf_log_printf (psf, "*** Warning : short read (%d != %d).\n", k, WAV_W64_GSM610_BLOCKSIZE) ; + + if (gsm_decode (pgsm610->gsm_data, pgsm610->block, pgsm610->samples) < 0) + { psf_log_printf (psf, "Error from gsm_decode() on frame : %d\n", pgsm610->blockcount) ; + return 0 ; + } ; + + if (gsm_decode (pgsm610->gsm_data, pgsm610->block + (WAV_W64_GSM610_BLOCKSIZE + 1) / 2, pgsm610->samples + WAV_W64_GSM610_SAMPLES / 2) < 0) + { psf_log_printf (psf, "Error from gsm_decode() on frame : %d.5\n", pgsm610->blockcount) ; + return 0 ; + } ; + + return 1 ; +} /* gsm610_wav_decode_block */ + +static int +gsm610_decode_block (SF_PRIVATE *psf, GSM610_PRIVATE *pgsm610) +{ int k ; + + pgsm610->blockcount ++ ; + pgsm610->samplecount = 0 ; + + if (pgsm610->blockcount > pgsm610->blocks) + { memset (pgsm610->samples, 0, GSM610_SAMPLES * sizeof (short)) ; + return 1 ; + } ; + + if ((k = psf_fread (pgsm610->block, 1, GSM610_BLOCKSIZE, psf)) != GSM610_BLOCKSIZE) + psf_log_printf (psf, "*** Warning : short read (%d != %d).\n", k, GSM610_BLOCKSIZE) ; + + if (gsm_decode (pgsm610->gsm_data, pgsm610->block, pgsm610->samples) < 0) + { psf_log_printf (psf, "Error from gsm_decode() on frame : %d\n", pgsm610->blockcount) ; + return 0 ; + } ; + + return 1 ; +} /* gsm610_decode_block */ + +static int +gsm610_read_block (SF_PRIVATE *psf, GSM610_PRIVATE *pgsm610, short *ptr, int len) +{ int count, total = 0, indx = 0 ; + + while (indx < len) + { if (pgsm610->blockcount >= pgsm610->blocks && pgsm610->samplecount >= pgsm610->samplesperblock) + { memset (&(ptr [indx]), 0, (size_t) ((len - indx) * sizeof (short))) ; + return total ; + } ; + + if (pgsm610->samplecount >= pgsm610->samplesperblock) + pgsm610->decode_block (psf, pgsm610) ; + + count = pgsm610->samplesperblock - pgsm610->samplecount ; + count = (len - indx > count) ? count : len - indx ; + + memcpy (&(ptr [indx]), &(pgsm610->samples [pgsm610->samplecount]), count * sizeof (short)) ; + indx += count ; + pgsm610->samplecount += count ; + total = indx ; + } ; + + return total ; +} /* gsm610_read_block */ + +static sf_count_t +gsm610_read_s (SF_PRIVATE *psf, short *ptr, sf_count_t len) +{ GSM610_PRIVATE *pgsm610 ; + int readcount, count ; + sf_count_t total = 0 ; + + if (! psf->fdata) + return 0 ; + pgsm610 = (GSM610_PRIVATE*) psf->fdata ; + + while (len > 0) + { readcount = (len > 0x10000000) ? 0x1000000 : (int) len ; + + count = gsm610_read_block (psf, pgsm610, ptr, readcount) ; + + total += count ; + len -= count ; + + if (count != readcount) + break ; + } ; + + return total ; +} /* gsm610_read_s */ + +static sf_count_t +gsm610_read_i (SF_PRIVATE *psf, int *ptr, sf_count_t len) +{ GSM610_PRIVATE *pgsm610 ; + short *sptr ; + int k, bufferlen, readcount = 0, count ; + sf_count_t total = 0 ; + + if (! psf->fdata) + return 0 ; + pgsm610 = (GSM610_PRIVATE*) psf->fdata ; + + sptr = psf->u.sbuf ; + bufferlen = ARRAY_LEN (psf->u.sbuf) ; + while (len > 0) + { readcount = (len >= bufferlen) ? bufferlen : len ; + count = gsm610_read_block (psf, pgsm610, sptr, readcount) ; + for (k = 0 ; k < readcount ; k++) + ptr [total + k] = sptr [k] << 16 ; + + total += count ; + len -= readcount ; + } ; + return total ; +} /* gsm610_read_i */ + +static sf_count_t +gsm610_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) +{ GSM610_PRIVATE *pgsm610 ; + short *sptr ; + int k, bufferlen, readcount = 0, count ; + sf_count_t total = 0 ; + float normfact ; + + if (! psf->fdata) + return 0 ; + pgsm610 = (GSM610_PRIVATE*) psf->fdata ; + + normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x8000) : 1.0 ; + + sptr = psf->u.sbuf ; + bufferlen = ARRAY_LEN (psf->u.sbuf) ; + while (len > 0) + { readcount = (len >= bufferlen) ? bufferlen : len ; + count = gsm610_read_block (psf, pgsm610, sptr, readcount) ; + for (k = 0 ; k < readcount ; k++) + ptr [total + k] = normfact * sptr [k] ; + + total += count ; + len -= readcount ; + } ; + return total ; +} /* gsm610_read_f */ + +static sf_count_t +gsm610_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) +{ GSM610_PRIVATE *pgsm610 ; + short *sptr ; + int k, bufferlen, readcount = 0, count ; + sf_count_t total = 0 ; + double normfact ; + + normfact = (psf->norm_double == SF_TRUE) ? 1.0 / ((double) 0x8000) : 1.0 ; + + if (! psf->fdata) + return 0 ; + pgsm610 = (GSM610_PRIVATE*) psf->fdata ; + + sptr = psf->u.sbuf ; + bufferlen = ARRAY_LEN (psf->u.sbuf) ; + while (len > 0) + { readcount = (len >= bufferlen) ? bufferlen : len ; + count = gsm610_read_block (psf, pgsm610, sptr, readcount) ; + for (k = 0 ; k < readcount ; k++) + ptr [total + k] = normfact * sptr [k] ; + + total += count ; + len -= readcount ; + } ; + return total ; +} /* gsm610_read_d */ + +static sf_count_t +gsm610_seek (SF_PRIVATE *psf, int mode, sf_count_t offset) +{ GSM610_PRIVATE *pgsm610 ; + int newblock, newsample ; + + mode = mode ; + + if (! psf->fdata) + return 0 ; + pgsm610 = (GSM610_PRIVATE*) psf->fdata ; + + if (psf->dataoffset < 0) + { psf->error = SFE_BAD_SEEK ; + return ((sf_count_t) -1) ; + } ; + + if (offset == 0) + { int true_flag = 1 ; + + psf_fseek (psf, psf->dataoffset, SEEK_SET) ; + pgsm610->blockcount = 0 ; + + gsm_init (pgsm610->gsm_data) ; + if ((psf->sf.format & SF_FORMAT_TYPEMASK) == SF_FORMAT_WAV || + (psf->sf.format & SF_FORMAT_TYPEMASK) == SF_FORMAT_W64) + gsm_option (pgsm610->gsm_data, GSM_OPT_WAV49, &true_flag) ; + + pgsm610->decode_block (psf, pgsm610) ; + pgsm610->samplecount = 0 ; + return 0 ; + } ; + + if (offset < 0 || offset > pgsm610->blocks * pgsm610->samplesperblock) + { psf->error = SFE_BAD_SEEK ; + return ((sf_count_t) -1) ; + } ; + + newblock = offset / pgsm610->samplesperblock ; + newsample = offset % pgsm610->samplesperblock ; + + if (psf->mode == SFM_READ) + { if (psf->read_current != newblock * pgsm610->samplesperblock + newsample) + { psf_fseek (psf, psf->dataoffset + newblock * pgsm610->samplesperblock, SEEK_SET) ; + pgsm610->blockcount = newblock ; + pgsm610->decode_block (psf, pgsm610) ; + pgsm610->samplecount = newsample ; + } ; + + return newblock * pgsm610->samplesperblock + newsample ; + } ; + + /* What to do about write??? */ + psf->error = SFE_BAD_SEEK ; + return ((sf_count_t) -1) ; +} /* gsm610_seek */ + +/*========================================================================================== +** GSM 6.10 Write Functions. +*/ + +static int +gsm610_encode_block (SF_PRIVATE *psf, GSM610_PRIVATE *pgsm610) +{ int k ; + + /* Encode the samples. */ + gsm_encode (pgsm610->gsm_data, pgsm610->samples, pgsm610->block) ; + + /* Write the block to disk. */ + if ((k = psf_fwrite (pgsm610->block, 1, GSM610_BLOCKSIZE, psf)) != GSM610_BLOCKSIZE) + psf_log_printf (psf, "*** Warning : short write (%d != %d).\n", k, GSM610_BLOCKSIZE) ; + + pgsm610->samplecount = 0 ; + pgsm610->blockcount ++ ; + + /* Set samples to zero for next block. */ + memset (pgsm610->samples, 0, WAV_W64_GSM610_SAMPLES * sizeof (short)) ; + + return 1 ; +} /* gsm610_encode_block */ + +static int +gsm610_wav_encode_block (SF_PRIVATE *psf, GSM610_PRIVATE *pgsm610) +{ int k ; + + /* Encode the samples. */ + gsm_encode (pgsm610->gsm_data, pgsm610->samples, pgsm610->block) ; + gsm_encode (pgsm610->gsm_data, pgsm610->samples+WAV_W64_GSM610_SAMPLES/2, pgsm610->block+WAV_W64_GSM610_BLOCKSIZE/2) ; + + /* Write the block to disk. */ + if ((k = psf_fwrite (pgsm610->block, 1, WAV_W64_GSM610_BLOCKSIZE, psf)) != WAV_W64_GSM610_BLOCKSIZE) + psf_log_printf (psf, "*** Warning : short write (%d != %d).\n", k, WAV_W64_GSM610_BLOCKSIZE) ; + + pgsm610->samplecount = 0 ; + pgsm610->blockcount ++ ; + + /* Set samples to zero for next block. */ + memset (pgsm610->samples, 0, WAV_W64_GSM610_SAMPLES * sizeof (short)) ; + + return 1 ; +} /* gsm610_wav_encode_block */ + +static int +gsm610_write_block (SF_PRIVATE *psf, GSM610_PRIVATE *pgsm610, short *ptr, int len) +{ int count, total = 0, indx = 0 ; + + while (indx < len) + { count = pgsm610->samplesperblock - pgsm610->samplecount ; + + if (count > len - indx) + count = len - indx ; + + memcpy (&(pgsm610->samples [pgsm610->samplecount]), &(ptr [indx]), count * sizeof (short)) ; + indx += count ; + pgsm610->samplecount += count ; + total = indx ; + + if (pgsm610->samplecount >= pgsm610->samplesperblock) + pgsm610->encode_block (psf, pgsm610) ; + } ; + + return total ; +} /* gsm610_write_block */ + +static sf_count_t +gsm610_write_s (SF_PRIVATE *psf, short *ptr, sf_count_t len) +{ GSM610_PRIVATE *pgsm610 ; + int writecount, count ; + sf_count_t total = 0 ; + + if (! psf->fdata) + return 0 ; + pgsm610 = (GSM610_PRIVATE*) psf->fdata ; + + while (len > 0) + { writecount = (len > 0x10000000) ? 0x10000000 : (int) len ; + + count = gsm610_write_block (psf, pgsm610, ptr, writecount) ; + + total += count ; + len -= count ; + + if (count != writecount) + break ; + } ; + + return total ; +} /* gsm610_write_s */ + +static sf_count_t +gsm610_write_i (SF_PRIVATE *psf, int *ptr, sf_count_t len) +{ GSM610_PRIVATE *pgsm610 ; + short *sptr ; + int k, bufferlen, writecount = 0, count ; + sf_count_t total = 0 ; + + if (! psf->fdata) + return 0 ; + pgsm610 = (GSM610_PRIVATE*) psf->fdata ; + + sptr = psf->u.sbuf ; + bufferlen = ARRAY_LEN (psf->u.sbuf) ; + while (len > 0) + { writecount = (len >= bufferlen) ? bufferlen : len ; + for (k = 0 ; k < writecount ; k++) + sptr [k] = ptr [total + k] >> 16 ; + count = gsm610_write_block (psf, pgsm610, sptr, writecount) ; + + total += count ; + len -= writecount ; + } ; + return total ; +} /* gsm610_write_i */ + +static sf_count_t +gsm610_write_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) +{ GSM610_PRIVATE *pgsm610 ; + short *sptr ; + int k, bufferlen, writecount = 0, count ; + sf_count_t total = 0 ; + float normfact ; + + if (! psf->fdata) + return 0 ; + pgsm610 = (GSM610_PRIVATE*) psf->fdata ; + + normfact = (psf->norm_float == SF_TRUE) ? (1.0 * 0x7FFF) : 1.0 ; + + sptr = psf->u.sbuf ; + bufferlen = ARRAY_LEN (psf->u.sbuf) ; + while (len > 0) + { writecount = (len >= bufferlen) ? bufferlen : len ; + for (k = 0 ; k < writecount ; k++) + sptr [k] = lrintf (normfact * ptr [total + k]) ; + count = gsm610_write_block (psf, pgsm610, sptr, writecount) ; + + total += count ; + len -= writecount ; + } ; + return total ; +} /* gsm610_write_f */ + +static sf_count_t +gsm610_write_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) +{ GSM610_PRIVATE *pgsm610 ; + short *sptr ; + int k, bufferlen, writecount = 0, count ; + sf_count_t total = 0 ; + double normfact ; + + if (! psf->fdata) + return 0 ; + pgsm610 = (GSM610_PRIVATE*) psf->fdata ; + + normfact = (psf->norm_double == SF_TRUE) ? (1.0 * 0x7FFF) : 1.0 ; + + sptr = psf->u.sbuf ; + bufferlen = ARRAY_LEN (psf->u.sbuf) ; + while (len > 0) + { writecount = (len >= bufferlen) ? bufferlen : len ; + for (k = 0 ; k < writecount ; k++) + sptr [k] = lrint (normfact * ptr [total + k]) ; + count = gsm610_write_block (psf, pgsm610, sptr, writecount) ; + + total += count ; + len -= writecount ; + } ; + return total ; +} /* gsm610_write_d */ + +static int +gsm610_close (SF_PRIVATE *psf) +{ GSM610_PRIVATE *pgsm610 ; + + if (! psf->fdata) + return 0 ; + + pgsm610 = (GSM610_PRIVATE*) psf->fdata ; + + if (psf->mode == SFM_WRITE) + { /* If a block has been partially assembled, write it out + ** as the final block. + */ + + if (pgsm610->samplecount && pgsm610->samplecount < pgsm610->samplesperblock) + pgsm610->encode_block (psf, pgsm610) ; + + if (psf->write_header) + psf->write_header (psf, SF_TRUE) ; + } ; + + if (pgsm610->gsm_data) + gsm_destroy (pgsm610->gsm_data) ; + + return 0 ; +} /* gsm610_close */ + +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: 8575187d-af4f-4acf-b9dd-6ff705628345 +*/ diff --git a/Libraries/SndFile/Files/src/htk.c b/Libraries/SndFile/Files/src/htk.c new file mode 100644 index 000000000..20ddcda72 --- /dev/null +++ b/Libraries/SndFile/Files/src/htk.c @@ -0,0 +1,226 @@ +/* +** Copyright (C) 2002-2004 Erik de Castro Lopo +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU Lesser General Public License as published by +** the Free Software Foundation; either version 2.1 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU Lesser General Public License for more details. +** +** You should have received a copy of the GNU Lesser General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include +#include +#include +#include + +#include "sndfile.h" +#include "config.h" +#include "sfendian.h" +#include "common.h" + +/*------------------------------------------------------------------------------ +** Macros to handle big/little endian issues. +*/ + +#define SFE_HTK_BAD_FILE_LEN 1666 +#define SFE_HTK_NOT_WAVEFORM 1667 + +/*------------------------------------------------------------------------------ +** Private static functions. +*/ + +static int htk_close (SF_PRIVATE *psf) ; + +static int htk_write_header (SF_PRIVATE *psf, int calc_length) ; +static int htk_read_header (SF_PRIVATE *psf) ; + +/*------------------------------------------------------------------------------ +** Public function. +*/ + +int +htk_open (SF_PRIVATE *psf) +{ int subformat ; + int error = 0 ; + + if (psf->is_pipe) + return SFE_HTK_NO_PIPE ; + + if (psf->mode == SFM_READ || (psf->mode == SFM_RDWR && psf->filelength > 0)) + { if ((error = htk_read_header (psf))) + return error ; + } ; + + subformat = psf->sf.format & SF_FORMAT_SUBMASK ; + + if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR) + { if ((psf->sf.format & SF_FORMAT_TYPEMASK) != SF_FORMAT_HTK) + return SFE_BAD_OPEN_FORMAT ; + + psf->endian = SF_ENDIAN_BIG ; + + if (htk_write_header (psf, SF_FALSE)) + return psf->error ; + + psf->write_header = htk_write_header ; + } ; + + psf->close = htk_close ; + + psf->blockwidth = psf->bytewidth * psf->sf.channels ; + + switch (subformat) + { case SF_FORMAT_PCM_16 : /* 16-bit linear PCM. */ + error = pcm_init (psf) ; + break ; + + default : break ; + } ; + + return error ; +} /* htk_open */ + +/*------------------------------------------------------------------------------ +*/ + +static int +htk_close (SF_PRIVATE *psf) +{ + if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR) + htk_write_header (psf, SF_TRUE) ; + + return 0 ; +} /* htk_close */ + +static int +htk_write_header (SF_PRIVATE *psf, int calc_length) +{ sf_count_t current ; + int sample_count, sample_period ; + + current = psf_ftell (psf) ; + + if (calc_length) + psf->filelength = psf_get_filelen (psf) ; + + /* Reset the current header length to zero. */ + psf->header [0] = 0 ; + psf->headindex = 0 ; + psf_fseek (psf, 0, SEEK_SET) ; + + if (psf->filelength > 12) + sample_count = (psf->filelength - 12) / 2 ; + else + sample_count = 0 ; + + sample_period = 10000000 / psf->sf.samplerate ; + + psf_binheader_writef (psf, "E444", sample_count, sample_period, 0x20000) ; + + /* Header construction complete so write it out. */ + psf_fwrite (psf->header, psf->headindex, 1, psf) ; + + if (psf->error) + return psf->error ; + + psf->dataoffset = psf->headindex ; + + if (current > 0) + psf_fseek (psf, current, SEEK_SET) ; + + return psf->error ; +} /* htk_write_header */ + +/* +** Found the following info in a comment block within Bill Schottstaedt's +** sndlib library. +** +** HTK format files consist of a contiguous sequence of samples preceded by a +** header. Each sample is a vector of either 2-byte integers or 4-byte floats. +** 2-byte integers are used for compressed forms as described below and for +** vector quantised data as described later in section 5.11. HTK format data +** files can also be used to store speech waveforms as described in section 5.8. +** +** The HTK file format header is 12 bytes long and contains the following data +** nSamples -- number of samples in file (4-byte integer) +** sampPeriod -- sample period in 100ns units (4-byte integer) +** sampSize -- number of bytes per sample (2-byte integer) +** parmKind -- a code indicating the sample kind (2-byte integer) +** +** The parameter kind consists of a 6 bit code representing the basic +** parameter kind plus additional bits for each of the possible qualifiers. +** The basic parameter kind codes are +** +** 0 WAVEFORM sampled waveform +** 1 LPC linear prediction filter coefficients +** 2 LPREFC linear prediction reflection coefficients +** 3 LPCEPSTRA LPC cepstral coefficients +** 4 LPDELCEP LPC cepstra plus delta coefficients +** 5 IREFC LPC reflection coef in 16 bit integer format +** 6 MFCC mel-frequency cepstral coefficients +** 7 FBANK log mel-filter bank channel outputs +** 8 MELSPEC linear mel-filter bank channel outputs +** 9 USER user defined sample kind +** 10 DISCRETE vector quantised data +** +** and the bit-encoding for the qualifiers (in octal) is +** _E 000100 has energy +** _N 000200 absolute energy suppressed +** _D 000400 has delta coefficients +** _A 001000 has acceleration coefficients +** _C 002000 is compressed +** _Z 004000 has zero mean static coef. +** _K 010000 has CRC checksum +** _O 020000 has 0'th cepstral coef. +*/ + +static int +htk_read_header (SF_PRIVATE *psf) +{ int sample_count, sample_period, marker ; + + psf_binheader_readf (psf, "pE444", 0, &sample_count, &sample_period, &marker) ; + + if (2 * sample_count + 12 != psf->filelength) + return SFE_HTK_BAD_FILE_LEN ; + + if (marker != 0x20000) + return SFE_HTK_NOT_WAVEFORM ; + + psf->sf.channels = 1 ; + psf->sf.samplerate = 10000000 / sample_period ; + + psf_log_printf (psf, "HTK Waveform file\n Sample Count : %d\n Sample Period : %d => %d Hz\n", + sample_count, sample_period, psf->sf.samplerate) ; + + psf->sf.format = SF_FORMAT_HTK | SF_FORMAT_PCM_16 ; + psf->bytewidth = 2 ; + + /* HTK always has a 12 byte header. */ + psf->dataoffset = 12 ; + psf->endian = SF_ENDIAN_BIG ; + + psf->datalength = psf->filelength - psf->dataoffset ; + + psf->close = htk_close ; + + psf->blockwidth = psf->sf.channels * psf->bytewidth ; + + if (! psf->sf.frames && psf->blockwidth) + psf->sf.frames = (psf->filelength - psf->dataoffset) / psf->blockwidth ; + + return 0 ; +} /* htk_read_header */ +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: c350e972-082e-4c20-8934-03391a723560 +*/ diff --git a/Libraries/SndFile/Files/src/ima_adpcm.c b/Libraries/SndFile/Files/src/ima_adpcm.c new file mode 100644 index 000000000..ecb2fd140 --- /dev/null +++ b/Libraries/SndFile/Files/src/ima_adpcm.c @@ -0,0 +1,1008 @@ +/* +** Copyright (C) 1999-2004 Erik de Castro Lopo +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU Lesser General Public License as published by +** the Free Software Foundation; either version 2.1 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU Lesser General Public License for more details. +** +** You should have received a copy of the GNU Lesser General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include +#include +#include + +#include "sndfile.h" +#include "config.h" +#include "sfendian.h" +#include "float_cast.h" +#include "common.h" + +typedef struct IMA_ADPCM_PRIVATE_tag +{ int (*decode_block) (SF_PRIVATE *psf, struct IMA_ADPCM_PRIVATE_tag *pima) ; + int (*encode_block) (SF_PRIVATE *psf, struct IMA_ADPCM_PRIVATE_tag *pima) ; + + int channels, blocksize, samplesperblock, blocks ; + int blockcount, samplecount ; + int previous [2] ; + int stepindx [2] ; + unsigned char *block ; + short *samples ; +#if HAVE_FLEXIBLE_ARRAY + unsigned short data [] ; /* ISO C99 struct flexible array. */ +#else + unsigned short data [0] ; /* This is a hack and might not work. */ +#endif +} IMA_ADPCM_PRIVATE ; + +/*============================================================================================ +** Predefined IMA ADPCM data. +*/ + +static int ima_indx_adjust [16] = +{ -1, -1, -1, -1, /* +0 - +3, decrease the step size */ + 2, 4, 6, 8, /* +4 - +7, increase the step size */ + -1, -1, -1, -1, /* -0 - -3, decrease the step size */ + 2, 4, 6, 8, /* -4 - -7, increase the step size */ +} ; + +static int ima_step_size [89] = +{ 7, 8, 9, 10, 11, 12, 13, 14, 16, 17, 19, 21, 23, 25, 28, 31, 34, 37, 41, 45, + 50, 55, 60, 66, 73, 80, 88, 97, 107, 118, 130, 143, 157, 173, 190, 209, 230, + 253, 279, 307, 337, 371, 408, 449, 494, 544, 598, 658, 724, 796, 876, 963, + 1060, 1166, 1282, 1411, 1552, 1707, 1878, 2066, 2272, 2499, 2749, 3024, 3327, + 3660, 4026, 4428, 4871, 5358, 5894, 6484, 7132, 7845, 8630, 9493, 10442, + 11487, 12635, 13899, 15289, 16818, 18500, 20350, 22385, 24623, 27086, 29794, + 32767 +} ; + +static int ima_reader_init (SF_PRIVATE *psf, int blockalign, int samplesperblock) ; +static int ima_writer_init (SF_PRIVATE *psf, int blockalign) ; + +static int ima_read_block (SF_PRIVATE *psf, IMA_ADPCM_PRIVATE *pima, short *ptr, int len) ; +static int ima_write_block (SF_PRIVATE *psf, IMA_ADPCM_PRIVATE *pima, short *ptr, int len) ; + +static sf_count_t ima_read_s (SF_PRIVATE *psf, short *ptr, sf_count_t len) ; +static sf_count_t ima_read_i (SF_PRIVATE *psf, int *ptr, sf_count_t len) ; +static sf_count_t ima_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ; +static sf_count_t ima_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ; + +static sf_count_t ima_write_s (SF_PRIVATE *psf, short *ptr, sf_count_t len) ; +static sf_count_t ima_write_i (SF_PRIVATE *psf, int *ptr, sf_count_t len) ; +static sf_count_t ima_write_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ; +static sf_count_t ima_write_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ; + +static sf_count_t ima_seek (SF_PRIVATE *psf, int mode, sf_count_t offset) ; + +static int wav_w64_ima_close (SF_PRIVATE *psf) ; +static int aiff_ima_close (SF_PRIVATE *psf) ; + +static int wav_w64_ima_decode_block (SF_PRIVATE *psf, IMA_ADPCM_PRIVATE *pima) ; +static int wav_w64_ima_encode_block (SF_PRIVATE *psf, IMA_ADPCM_PRIVATE *pima) ; + +/*-static int aiff_ima_reader_init (SF_PRIVATE *psf, int blockalign, int samplesperblock) ;-*/ +static int aiff_ima_decode_block (SF_PRIVATE *psf, IMA_ADPCM_PRIVATE *pima) ; +static int aiff_ima_encode_block (SF_PRIVATE *psf, IMA_ADPCM_PRIVATE *pima) ; + + +/*============================================================================================ +** IMA ADPCM Reader initialisation function. +*/ + +int +wav_w64_ima_init (SF_PRIVATE *psf, int blockalign, int samplesperblock) +{ int error ; + + if (psf->mode == SFM_RDWR) + return SFE_BAD_MODE_RW ; + + if (psf->mode == SFM_READ) + if ((error = ima_reader_init (psf, blockalign, samplesperblock))) + return error ; + + if (psf->mode == SFM_WRITE) + if ((error = ima_writer_init (psf, blockalign))) + return error ; + + psf->seek = ima_seek ; + psf->close = wav_w64_ima_close ; + + return 0 ; +} /* wav_w64_ima_init */ + +static int +wav_w64_ima_close (SF_PRIVATE *psf) +{ IMA_ADPCM_PRIVATE *pima ; + + if (! psf->fdata) + return 0 ; + + pima = (IMA_ADPCM_PRIVATE*) psf->fdata ; + + if (psf->mode == SFM_WRITE) + { /* If a block has been partially assembled, write it out + ** as the final block. + */ + if (pima->samplecount && pima->samplecount < pima->samplesperblock) + pima->encode_block (psf, pima) ; + + psf->sf.frames = pima->samplesperblock * pima->blockcount / psf->sf.channels ; + + if (psf->write_header) + psf->write_header (psf, SF_TRUE) ; + } ; + + free (psf->fdata) ; + psf->fdata = NULL ; + + return 0 ; +} /* wav_w64_ima_close */ + +int +aiff_ima_init (SF_PRIVATE *psf, int blockalign, int samplesperblock) +{ int error ; + + if (psf->mode == SFM_RDWR) + return SFE_BAD_MODE_RW ; + + if (psf->mode == SFM_READ) + if ((error = ima_reader_init (psf, blockalign, samplesperblock))) + return error ; + + if (psf->mode == SFM_WRITE) + if ((error = ima_writer_init (psf, blockalign))) + return error ; + + psf->seek = ima_seek ; + psf->close = aiff_ima_close ; + + return 0 ; +} /* aiff_ima_init */ + +static int +aiff_ima_close (SF_PRIVATE *psf) +{ IMA_ADPCM_PRIVATE *pima ; + + if (! psf->fdata) + return 0 ; + + pima = (IMA_ADPCM_PRIVATE*) psf->fdata ; + + if (psf->mode == SFM_WRITE) + { /* If a block has been partially assembled, write it out + ** as the final block. + */ + + if (pima->samplecount && pima->samplecount < pima->samplesperblock) + pima->encode_block (psf, pima) ; + + if (psf->write_header) + psf->write_header (psf, SF_TRUE) ; + } ; + + free (psf->fdata) ; + psf->fdata = NULL ; + + return 0 ; +} /* aiff_ima_close */ + +/*============================================================================================ +** IMA ADPCM Read Functions. +*/ + +static int +ima_reader_init (SF_PRIVATE *psf, int blockalign, int samplesperblock) +{ IMA_ADPCM_PRIVATE *pima ; + int pimasize, count ; + + if (psf->mode != SFM_READ) + return SFE_BAD_MODE_RW ; + + pimasize = sizeof (IMA_ADPCM_PRIVATE) + blockalign * psf->sf.channels + 3 * psf->sf.channels * samplesperblock ; + + if (! (pima = malloc (pimasize))) + return SFE_MALLOC_FAILED ; + + psf->fdata = (void*) pima ; + + memset (pima, 0, pimasize) ; + + pima->samples = pima->data ; + pima->block = (unsigned char*) (pima->data + samplesperblock * psf->sf.channels) ; + + pima->channels = psf->sf.channels ; + pima->blocksize = blockalign ; + pima->samplesperblock = samplesperblock ; + + psf->filelength = psf_get_filelen (psf) ; + psf->datalength = (psf->dataend) ? psf->dataend - psf->dataoffset : + psf->filelength - psf->dataoffset ; + + if (psf->datalength % pima->blocksize) + pima->blocks = psf->datalength / pima->blocksize + 1 ; + else + pima->blocks = psf->datalength / pima->blocksize ; + + switch (psf->sf.format & SF_FORMAT_TYPEMASK) + { case SF_FORMAT_WAV : + case SF_FORMAT_W64 : + count = 2 * (pima->blocksize - 4 * pima->channels) / pima->channels + 1 ; + + if (pima->samplesperblock != count) + psf_log_printf (psf, "*** Warning : samplesperblock should be %d.\n", count) ; + + pima->decode_block = wav_w64_ima_decode_block ; + + psf->sf.frames = pima->samplesperblock * pima->blocks ; + break ; + + case SF_FORMAT_AIFF : + psf_log_printf (psf, "still need to check block count\n") ; + pima->decode_block = aiff_ima_decode_block ; + psf->sf.frames = pima->samplesperblock * pima->blocks / pima->channels ; + break ; + + default : + psf_log_printf (psf, "ima_reader_init: bad psf->sf.format\n") ; + return SFE_INTERNAL ; + break ; + } ; + + pima->decode_block (psf, pima) ; /* Read first block. */ + + psf->read_short = ima_read_s ; + psf->read_int = ima_read_i ; + psf->read_float = ima_read_f ; + psf->read_double = ima_read_d ; + + return 0 ; +} /* ima_reader_init */ + +static int +aiff_ima_decode_block (SF_PRIVATE *psf, IMA_ADPCM_PRIVATE *pima) +{ unsigned char *blockdata ; + int chan, k, diff, bytecode ; + short step, stepindx, predictor, *sampledata ; + +static int count = 0 ; +count ++ ; + + pima->blockcount += pima->channels ; + pima->samplecount = 0 ; + + if (pima->blockcount > pima->blocks) + { memset (pima->samples, 0, pima->samplesperblock * pima->channels * sizeof (short)) ; + return 1 ; + } ; + + if ((k = psf_fread (pima->block, 1, pima->blocksize * pima->channels, psf)) != pima->blocksize * pima->channels) + psf_log_printf (psf, "*** Warning : short read (%d != %d).\n", k, pima->blocksize) ; + + /* Read and check the block header. */ + for (chan = 0 ; chan < pima->channels ; chan++) + { blockdata = pima->block + chan * 34 ; + sampledata = pima->samples + chan ; + + predictor = (blockdata [0] << 8) | (blockdata [1] & 0x80) ; + stepindx = blockdata [1] & 0x7F ; + +{ +if (count < 5) +printf ("\nchan: %d predictor: %d stepindx: %d (%d)\n", + chan, predictor, stepindx, ima_step_size [stepindx]) ; +} + /* FIXME : Do this a better way. */ + if (stepindx < 0) stepindx = 0 ; + else if (stepindx > 88) stepindx = 88 ; + + /* + ** Pull apart the packed 4 bit samples and store them in their + ** correct sample positions. + */ + for (k = 0 ; k < pima->blocksize - 2 ; k++) + { bytecode = blockdata [k + 2] ; + sampledata [pima->channels * (2 * k + 0)] = bytecode & 0xF ; + sampledata [pima->channels * (2 * k + 1)] = (bytecode >> 4) & 0xF ; + } ; + + /* Decode the encoded 4 bit samples. */ + for (k = 0 ; k < pima->samplesperblock ; k ++) + { step = ima_step_size [stepindx] ; + + bytecode = pima->samples [pima->channels * k + chan] ; + + stepindx += ima_indx_adjust [bytecode] ; + + if (stepindx < 0) stepindx = 0 ; + else if (stepindx > 88) stepindx = 88 ; + + diff = step >> 3 ; + if (bytecode & 1) diff += step >> 2 ; + if (bytecode & 2) diff += step >> 1 ; + if (bytecode & 4) diff += step ; + if (bytecode & 8) diff = -diff ; + + predictor += diff ; + + pima->samples [pima->channels * k + chan] = predictor ; + } ; + } ; + +if (count < 5) +{ + for (k = 0 ; k < 10 ; k++) + printf ("% 7d,", pima->samples [k]) ; + puts ("") ; +} + + return 1 ; +} /* aiff_ima_decode_block */ + +static int +aiff_ima_encode_block (SF_PRIVATE *psf, IMA_ADPCM_PRIVATE *pima) +{ int chan, k, step, diff, vpdiff, blockindx, indx ; + short bytecode, mask ; + +static int count = 0 ; +if (0 && count == 0) +{ pima->samples [0] = 0 ; + printf ("blocksize : %d\n", pima->blocksize) ; + printf ("pima->stepindx [0] : %d\n", pima->stepindx [0]) ; + } +count ++ ; + + /* Encode the block header. */ + for (chan = 0 ; chan < pima->channels ; chan ++) + { blockindx = chan * pima->blocksize ; + + pima->block [blockindx] = (pima->samples [chan] >> 8) & 0xFF ; + pima->block [blockindx + 1] = (pima->samples [chan] & 0x80) + (pima->stepindx [chan] & 0x7F) ; + + pima->previous [chan] = pima->samples [chan] ; + } ; + + /* Encode second and later samples for every block as a 4 bit value. */ + for (k = pima->channels ; k < (pima->samplesperblock * pima->channels) ; k ++) + { chan = (pima->channels > 1) ? (k % 2) : 0 ; + + diff = pima->samples [k] - pima->previous [chan] ; + + bytecode = 0 ; + step = ima_step_size [pima->stepindx [chan]] ; + vpdiff = step >> 3 ; + if (diff < 0) + { bytecode = 8 ; + diff = -diff ; + } ; + mask = 4 ; + while (mask) + { if (diff >= step) + { bytecode |= mask ; + diff -= step ; + vpdiff += step ; + } ; + step >>= 1 ; + mask >>= 1 ; + } ; + + if (bytecode & 8) + pima->previous [chan] -= vpdiff ; + else + pima->previous [chan] += vpdiff ; + + if (pima->previous [chan] > 32767) + pima->previous [chan] = 32767 ; + else if (pima->previous [chan] < -32768) + pima->previous [chan] = -32768 ; + + pima->stepindx [chan] += ima_indx_adjust [bytecode] ; + if (pima->stepindx [chan] < 0) + pima->stepindx [chan] = 0 ; + else if (pima->stepindx [chan] > 88) + pima->stepindx [chan] = 88 ; + + pima->samples [k] = bytecode ; + } ; + + /* Pack the 4 bit encoded samples. */ + + for (chan = 0 ; chan < pima->channels ; chan ++) + { for (indx = pima->channels ; indx < pima->channels * pima->samplesperblock ; indx += 2 * pima->channels) + { blockindx = chan * pima->blocksize + 2 + indx / 2 ; + +if (0 && count ++ < 5) + printf ("chan: %d blockindx: %3d indx: %3d\n", chan, blockindx, indx) ; + + pima->block [blockindx] = pima->samples [indx] & 0x0F ; + pima->block [blockindx] |= (pima->samples [indx + pima->channels] << 4) & 0xF0 ; + } ; + } ; + + /* Write the block to disk. */ + + if ((k = psf_fwrite (pima->block, 1, pima->channels * pima->blocksize, psf)) != pima->channels * pima->blocksize) + psf_log_printf (psf, "*** Warning : short write (%d != %d).\n", k, pima->channels * pima->blocksize) ; + + memset (pima->samples, 0, pima->channels * pima->samplesperblock * sizeof (short)) ; + pima->samplecount = 0 ; + pima->blockcount ++ ; + + return 1 ; +} /* aiff_ima_encode_block */ + +static int +wav_w64_ima_decode_block (SF_PRIVATE *psf, IMA_ADPCM_PRIVATE *pima) +{ int chan, k, current, blockindx, indx, indxstart, diff ; + short step, bytecode, stepindx [2] ; + + pima->blockcount ++ ; + pima->samplecount = 0 ; + + if (pima->blockcount > pima->blocks) + { memset (pima->samples, 0, pima->samplesperblock * pima->channels * sizeof (short)) ; + return 1 ; + } ; + + if ((k = psf_fread (pima->block, 1, pima->blocksize, psf)) != pima->blocksize) + psf_log_printf (psf, "*** Warning : short read (%d != %d).\n", k, pima->blocksize) ; + + /* Read and check the block header. */ + + for (chan = 0 ; chan < pima->channels ; chan++) + { current = pima->block [chan*4] | (pima->block [chan*4+1] << 8) ; + if (current & 0x8000) + current -= 0x10000 ; + + stepindx [chan] = pima->block [chan*4+2] ; + if (stepindx [chan] < 0) + stepindx [chan] = 0 ; + else if (stepindx [chan] > 88) + stepindx [chan] = 88 ; + + if (pima->block [chan*4+3] != 0) + psf_log_printf (psf, "IMA ADPCM synchronisation error.\n") ; + + pima->samples [chan] = current ; + } ; + + /* + ** Pull apart the packed 4 bit samples and store them in their + ** correct sample positions. + */ + + blockindx = 4 * pima->channels ; + + indxstart = pima->channels ; + while (blockindx < pima->blocksize) + { for (chan = 0 ; chan < pima->channels ; chan++) + { indx = indxstart + chan ; + for (k = 0 ; k < 4 ; k++) + { bytecode = pima->block [blockindx++] ; + pima->samples [indx] = bytecode & 0x0F ; + indx += pima->channels ; + pima->samples [indx] = (bytecode >> 4) & 0x0F ; + indx += pima->channels ; + } ; + } ; + indxstart += 8 * pima->channels ; + } ; + + /* Decode the encoded 4 bit samples. */ + + for (k = pima->channels ; k < (pima->samplesperblock * pima->channels) ; k ++) + { chan = (pima->channels > 1) ? (k % 2) : 0 ; + + bytecode = pima->samples [k] & 0xF ; + + step = ima_step_size [stepindx [chan]] ; + current = pima->samples [k - pima->channels] ; + + diff = step >> 3 ; + if (bytecode & 1) + diff += step >> 2 ; + if (bytecode & 2) + diff += step >> 1 ; + if (bytecode & 4) + diff += step ; + if (bytecode & 8) + diff = -diff ; + + current += diff ; + + if (current > 32767) + current = 32767 ; + else if (current < -32768) + current = -32768 ; + + stepindx [chan] += ima_indx_adjust [bytecode] ; + + if (stepindx [chan] < 0) + stepindx [chan] = 0 ; + else if (stepindx [chan] > 88) + stepindx [chan] = 88 ; + + pima->samples [k] = current ; + } ; + + return 1 ; +} /* wav_w64_ima_decode_block */ + +static int +wav_w64_ima_encode_block (SF_PRIVATE *psf, IMA_ADPCM_PRIVATE *pima) +{ int chan, k, step, diff, vpdiff, blockindx, indx, indxstart ; + short bytecode, mask ; + + /* Encode the block header. */ + for (chan = 0 ; chan < pima->channels ; chan++) + { pima->block [chan*4] = pima->samples [chan] & 0xFF ; + pima->block [chan*4+1] = (pima->samples [chan] >> 8) & 0xFF ; + + pima->block [chan*4+2] = pima->stepindx [chan] ; + pima->block [chan*4+3] = 0 ; + + pima->previous [chan] = pima->samples [chan] ; + } ; + + /* Encode the samples as 4 bit. */ + + for (k = pima->channels ; k < (pima->samplesperblock * pima->channels) ; k ++) + { chan = (pima->channels > 1) ? (k % 2) : 0 ; + + diff = pima->samples [k] - pima->previous [chan] ; + + bytecode = 0 ; + step = ima_step_size [pima->stepindx [chan]] ; + vpdiff = step >> 3 ; + if (diff < 0) + { bytecode = 8 ; + diff = -diff ; + } ; + mask = 4 ; + while (mask) + { if (diff >= step) + { bytecode |= mask ; + diff -= step ; + vpdiff += step ; + } ; + step >>= 1 ; + mask >>= 1 ; + } ; + + if (bytecode & 8) + pima->previous [chan] -= vpdiff ; + else + pima->previous [chan] += vpdiff ; + + if (pima->previous [chan] > 32767) + pima->previous [chan] = 32767 ; + else if (pima->previous [chan] < -32768) + pima->previous [chan] = -32768 ; + + pima->stepindx [chan] += ima_indx_adjust [bytecode] ; + if (pima->stepindx [chan] < 0) + pima->stepindx [chan] = 0 ; + else if (pima->stepindx [chan] > 88) + pima->stepindx [chan] = 88 ; + + pima->samples [k] = bytecode ; + } ; + + /* Pack the 4 bit encoded samples. */ + + blockindx = 4 * pima->channels ; + + indxstart = pima->channels ; + while (blockindx < pima->blocksize) + { for (chan = 0 ; chan < pima->channels ; chan++) + { indx = indxstart + chan ; + for (k = 0 ; k < 4 ; k++) + { pima->block [blockindx] = pima->samples [indx] & 0x0F ; + indx += pima->channels ; + pima->block [blockindx] |= (pima->samples [indx] << 4) & 0xF0 ; + indx += pima->channels ; + blockindx ++ ; + } ; + } ; + indxstart += 8 * pima->channels ; + } ; + + /* Write the block to disk. */ + + if ((k = psf_fwrite (pima->block, 1, pima->blocksize, psf)) != pima->blocksize) + psf_log_printf (psf, "*** Warning : short write (%d != %d).\n", k, pima->blocksize) ; + + memset (pima->samples, 0, pima->samplesperblock * sizeof (short)) ; + pima->samplecount = 0 ; + pima->blockcount ++ ; + + return 1 ; +} /* wav_w64_ima_encode_block */ + +static int +ima_read_block (SF_PRIVATE *psf, IMA_ADPCM_PRIVATE *pima, short *ptr, int len) +{ int count, total = 0, indx = 0 ; + + while (indx < len) + { if (pima->blockcount >= pima->blocks && pima->samplecount >= pima->samplesperblock) + { memset (&(ptr [indx]), 0, (size_t) ((len - indx) * sizeof (short))) ; + return total ; + } ; + + if (pima->samplecount >= pima->samplesperblock) + pima->decode_block (psf, pima) ; + + count = (pima->samplesperblock - pima->samplecount) * pima->channels ; + count = (len - indx > count) ? count : len - indx ; + + memcpy (&(ptr [indx]), &(pima->samples [pima->samplecount * pima->channels]), count * sizeof (short)) ; + indx += count ; + pima->samplecount += count / pima->channels ; + total = indx ; + } ; + + return total ; +} /* ima_read_block */ + +static sf_count_t +ima_read_s (SF_PRIVATE *psf, short *ptr, sf_count_t len) +{ IMA_ADPCM_PRIVATE *pima ; + int readcount, count ; + sf_count_t total = 0 ; + + if (! psf->fdata) + return 0 ; + pima = (IMA_ADPCM_PRIVATE*) psf->fdata ; + + while (len > 0) + { readcount = (len > 0x10000000) ? 0x10000000 : (int) len ; + + count = ima_read_block (psf, pima, ptr, readcount) ; + + total += count ; + len -= count ; + if (count != readcount) + break ; + } ; + + return total ; +} /* ima_read_s */ + +static sf_count_t +ima_read_i (SF_PRIVATE *psf, int *ptr, sf_count_t len) +{ IMA_ADPCM_PRIVATE *pima ; + short *sptr ; + int k, bufferlen, readcount, count ; + sf_count_t total = 0 ; + + if (! psf->fdata) + return 0 ; + pima = (IMA_ADPCM_PRIVATE*) psf->fdata ; + + sptr = psf->u.sbuf ; + bufferlen = ARRAY_LEN (psf->u.sbuf) ; + while (len > 0) + { readcount = (len >= bufferlen) ? bufferlen : (int) len ; + count = ima_read_block (psf, pima, sptr, readcount) ; + for (k = 0 ; k < readcount ; k++) + ptr [total + k] = ((int) sptr [k]) << 16 ; + total += count ; + len -= readcount ; + if (count != readcount) + break ; + } ; + + return total ; +} /* ima_read_i */ + +static sf_count_t +ima_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) +{ IMA_ADPCM_PRIVATE *pima ; + short *sptr ; + int k, bufferlen, readcount, count ; + sf_count_t total = 0 ; + float normfact ; + + if (! psf->fdata) + return 0 ; + pima = (IMA_ADPCM_PRIVATE*) psf->fdata ; + + normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x8000) : 1.0 ; + + sptr = psf->u.sbuf ; + bufferlen = ARRAY_LEN (psf->u.sbuf) ; + while (len > 0) + { readcount = (len >= bufferlen) ? bufferlen : (int) len ; + count = ima_read_block (psf, pima, sptr, readcount) ; + for (k = 0 ; k < readcount ; k++) + ptr [total + k] = normfact * (float) (sptr [k]) ; + total += count ; + len -= readcount ; + if (count != readcount) + break ; + } ; + + return total ; +} /* ima_read_f */ + +static sf_count_t +ima_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) +{ IMA_ADPCM_PRIVATE *pima ; + short *sptr ; + int k, bufferlen, readcount, count ; + sf_count_t total = 0 ; + double normfact ; + + if (! psf->fdata) + return 0 ; + pima = (IMA_ADPCM_PRIVATE*) psf->fdata ; + + normfact = (psf->norm_double == SF_TRUE) ? 1.0 / ((double) 0x8000) : 1.0 ; + + sptr = psf->u.sbuf ; + bufferlen = ARRAY_LEN (psf->u.sbuf) ; + while (len > 0) + { readcount = (len >= bufferlen) ? bufferlen : (int) len ; + count = ima_read_block (psf, pima, sptr, readcount) ; + for (k = 0 ; k < readcount ; k++) + ptr [total + k] = normfact * (double) (sptr [k]) ; + total += count ; + len -= readcount ; + if (count != readcount) + break ; + } ; + + return total ; +} /* ima_read_d */ + +static sf_count_t +ima_seek (SF_PRIVATE *psf, int mode, sf_count_t offset) +{ IMA_ADPCM_PRIVATE *pima ; + int newblock, newsample ; + + if (! psf->fdata) + return 0 ; + pima = (IMA_ADPCM_PRIVATE*) psf->fdata ; + + if (psf->datalength < 0 || psf->dataoffset < 0) + { psf->error = SFE_BAD_SEEK ; + return ((sf_count_t) -1) ; + } ; + + if (offset == 0) + { psf_fseek (psf, psf->dataoffset, SEEK_SET) ; + pima->blockcount = 0 ; + pima->decode_block (psf, pima) ; + pima->samplecount = 0 ; + return 0 ; + } ; + + if (offset < 0 || offset > pima->blocks * pima->samplesperblock) + { psf->error = SFE_BAD_SEEK ; + return ((sf_count_t) -1) ; + } ; + + newblock = offset / pima->samplesperblock ; + newsample = offset % pima->samplesperblock ; + + if (mode == SFM_READ) + { psf_fseek (psf, psf->dataoffset + newblock * pima->blocksize, SEEK_SET) ; + pima->blockcount = newblock ; + pima->decode_block (psf, pima) ; + pima->samplecount = newsample ; + } + else + { /* What to do about write??? */ + psf->error = SFE_BAD_SEEK ; + return ((sf_count_t) -1) ; + } ; + + return newblock * pima->samplesperblock + newsample ; +} /* ima_seek */ + +/*========================================================================================== +** IMA ADPCM Write Functions. +*/ + +static int +ima_writer_init (SF_PRIVATE *psf, int blockalign) +{ IMA_ADPCM_PRIVATE *pima ; + int samplesperblock ; + unsigned int pimasize ; + + if (psf->mode != SFM_WRITE) + return SFE_BAD_MODE_RW ; + + samplesperblock = 2 * (blockalign - 4 * psf->sf.channels) / psf->sf.channels + 1 ; + + pimasize = sizeof (IMA_ADPCM_PRIVATE) + blockalign + 3 * psf->sf.channels * samplesperblock ; + + if ((pima = calloc (1, pimasize)) == NULL) + return SFE_MALLOC_FAILED ; + + psf->fdata = (void*) pima ; + + pima->channels = psf->sf.channels ; + pima->blocksize = blockalign ; + pima->samplesperblock = samplesperblock ; + + pima->block = (unsigned char*) pima->data ; + pima->samples = (short*) (pima->data + blockalign) ; + + pima->samplecount = 0 ; + + switch (psf->sf.format & SF_FORMAT_TYPEMASK) + { case SF_FORMAT_WAV : + case SF_FORMAT_W64 : + pima->encode_block = wav_w64_ima_encode_block ; + break ; + + case SF_FORMAT_AIFF : + pima->encode_block = aiff_ima_encode_block ; + break ; + + default : + psf_log_printf (psf, "ima_reader_init: bad psf->sf.format\n") ; + return SFE_INTERNAL ; + break ; + } ; + + psf->write_short = ima_write_s ; + psf->write_int = ima_write_i ; + psf->write_float = ima_write_f ; + psf->write_double = ima_write_d ; + + return 0 ; +} /* ima_writer_init */ + +/*========================================================================================== +*/ + +static int +ima_write_block (SF_PRIVATE *psf, IMA_ADPCM_PRIVATE *pima, short *ptr, int len) +{ int count, total = 0, indx = 0 ; + + while (indx < len) + { count = (pima->samplesperblock - pima->samplecount) * pima->channels ; + + if (count > len - indx) + count = len - indx ; + + memcpy (&(pima->samples [pima->samplecount * pima->channels]), &(ptr [total]), count * sizeof (short)) ; + indx += count ; + pima->samplecount += count / pima->channels ; + total = indx ; + + if (pima->samplecount >= pima->samplesperblock) + pima->encode_block (psf, pima) ; + } ; + + return total ; +} /* ima_write_block */ + +static sf_count_t +ima_write_s (SF_PRIVATE *psf, short *ptr, sf_count_t len) +{ IMA_ADPCM_PRIVATE *pima ; + int writecount, count ; + sf_count_t total = 0 ; + + if (! psf->fdata) + return 0 ; + pima = (IMA_ADPCM_PRIVATE*) psf->fdata ; + + while (len) + { writecount = (len > 0x10000000) ? 0x10000000 : (int) len ; + + count = ima_write_block (psf, pima, ptr, writecount) ; + + total += count ; + len -= count ; + if (count != writecount) + break ; + } ; + + return total ; +} /* ima_write_s */ + +static sf_count_t +ima_write_i (SF_PRIVATE *psf, int *ptr, sf_count_t len) +{ IMA_ADPCM_PRIVATE *pima ; + short *sptr ; + int k, bufferlen, writecount, count ; + sf_count_t total = 0 ; + + if (! psf->fdata) + return 0 ; + pima = (IMA_ADPCM_PRIVATE*) psf->fdata ; + + sptr = psf->u.sbuf ; + bufferlen = ARRAY_LEN (psf->u.sbuf) ; + while (len > 0) + { writecount = (len >= bufferlen) ? bufferlen : (int) len ; + for (k = 0 ; k < writecount ; k++) + sptr [k] = ptr [total + k] >> 16 ; + count = ima_write_block (psf, pima, sptr, writecount) ; + total += count ; + len -= writecount ; + if (count != writecount) + break ; + } ; + + return total ; +} /* ima_write_i */ + +static sf_count_t +ima_write_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) +{ IMA_ADPCM_PRIVATE *pima ; + short *sptr ; + int k, bufferlen, writecount, count ; + sf_count_t total = 0 ; + float normfact ; + + if (! psf->fdata) + return 0 ; + pima = (IMA_ADPCM_PRIVATE*) psf->fdata ; + + normfact = (psf->norm_float == SF_TRUE) ? (1.0 * 0x7FFF) : 1.0 ; + + sptr = psf->u.sbuf ; + bufferlen = ARRAY_LEN (psf->u.sbuf) ; + while (len > 0) + { writecount = (len >= bufferlen) ? bufferlen : (int) len ; + for (k = 0 ; k < writecount ; k++) + sptr [k] = lrintf (normfact * ptr [total + k]) ; + count = ima_write_block (psf, pima, sptr, writecount) ; + total += count ; + len -= writecount ; + if (count != writecount) + break ; + } ; + + return total ; +} /* ima_write_f */ + +static sf_count_t +ima_write_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) +{ IMA_ADPCM_PRIVATE *pima ; + short *sptr ; + int k, bufferlen, writecount, count ; + sf_count_t total = 0 ; + double normfact ; + + if (! psf->fdata) + return 0 ; + pima = (IMA_ADPCM_PRIVATE*) psf->fdata ; + + normfact = (psf->norm_double == SF_TRUE) ? (1.0 * 0x7FFF) : 1.0 ; + + sptr = psf->u.sbuf ; + bufferlen = ARRAY_LEN (psf->u.sbuf) ; + while (len > 0) + { writecount = (len >= bufferlen) ? bufferlen : (int) len ; + for (k = 0 ; k < writecount ; k++) + sptr [k] = lrint (normfact * ptr [total + k]) ; + count = ima_write_block (psf, pima, sptr, writecount) ; + total += count ; + len -= writecount ; + if (count != writecount) + break ; + } ; + + return total ; +} /* ima_write_d */ + + +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: 75a54b82-ad18-4758-9933-64e00a7f24e0 +*/ diff --git a/Libraries/SndFile/Files/src/interleave.c b/Libraries/SndFile/Files/src/interleave.c new file mode 100644 index 000000000..53f6def17 --- /dev/null +++ b/Libraries/SndFile/Files/src/interleave.c @@ -0,0 +1,306 @@ +/* +** Copyright (C) 2002-2004 Erik de Castro Lopo +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU Lesser General Public License as published by +** the Free Software Foundation; either version 2.1 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU Lesser General Public License for more details. +** +** You should have received a copy of the GNU Lesser General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include + +#include "sndfile.h" +#include "config.h" +#include "sfendian.h" +#include "common.h" + +#define INTERLEAVE_CHANNELS 6 + +typedef struct +{ double buffer [SF_BUFFER_LEN / sizeof (double)] ; + + sf_count_t channel_len ; + + sf_count_t (*read_short) (SF_PRIVATE*, short *ptr, sf_count_t len) ; + sf_count_t (*read_int) (SF_PRIVATE*, int *ptr, sf_count_t len) ; + sf_count_t (*read_float) (SF_PRIVATE*, float *ptr, sf_count_t len) ; + sf_count_t (*read_double) (SF_PRIVATE*, double *ptr, sf_count_t len) ; + +} INTERLEAVE_DATA ; + + + +static sf_count_t interleave_read_short (SF_PRIVATE *psf, short *ptr, sf_count_t len) ; +static sf_count_t interleave_read_int (SF_PRIVATE *psf, int *ptr, sf_count_t len) ; +static sf_count_t interleave_read_float (SF_PRIVATE *psf, float *ptr, sf_count_t len) ; +static sf_count_t interleave_read_double (SF_PRIVATE *psf, double *ptr, sf_count_t len) ; + +static sf_count_t interleave_seek (SF_PRIVATE*, int mode, sf_count_t samples_from_start) ; + + + + +int +interleave_init (SF_PRIVATE *psf) +{ INTERLEAVE_DATA *pdata ; + + if (psf->mode != SFM_READ) + return SFE_INTERLEAVE_MODE ; + + if (psf->interleave) + { psf_log_printf (psf, "*** Weird, already have interleave.\n") ; + return 666 ; + } ; + + /* Free this in sf_close() function. */ + if (! (pdata = malloc (sizeof (INTERLEAVE_DATA)))) + return SFE_MALLOC_FAILED ; + +puts ("interleave_init") ; + + psf->interleave = pdata ; + + /* Save the existing methods. */ + pdata->read_short = psf->read_short ; + pdata->read_int = psf->read_int ; + pdata->read_float = psf->read_float ; + pdata->read_double = psf->read_double ; + + pdata->channel_len = psf->sf.frames * psf->bytewidth ; + + /* Insert our new methods. */ + psf->read_short = interleave_read_short ; + psf->read_int = interleave_read_int ; + psf->read_float = interleave_read_float ; + psf->read_double = interleave_read_double ; + + psf->seek = interleave_seek ; + + return 0 ; +} /* pcm_interleave_init */ + +/*------------------------------------------------------------------------------ +*/ + +static sf_count_t +interleave_read_short (SF_PRIVATE *psf, short *ptr, sf_count_t len) +{ INTERLEAVE_DATA *pdata ; + sf_count_t offset, templen ; + int chan, count, k ; + short *inptr, *outptr ; + + if (! (pdata = psf->interleave)) + return 0 ; + + inptr = (short*) pdata->buffer ; + + for (chan = 0 ; chan < psf->sf.channels ; chan++) + { outptr = ptr + chan ; + + offset = psf->dataoffset + chan * psf->bytewidth * psf->read_current ; + + if (psf_fseek (psf, offset, SEEK_SET) != offset) + { psf->error = SFE_INTERLEAVE_SEEK ; + return 0 ; + } ; + + templen = len / psf->sf.channels ; + + while (templen > 0) + { if (templen > SIGNED_SIZEOF (pdata->buffer) / SIGNED_SIZEOF (short)) + count = SIGNED_SIZEOF (pdata->buffer) / SIGNED_SIZEOF (short) ; + else + count = (int) templen ; + + if (pdata->read_short (psf, inptr, count) != count) + { psf->error = SFE_INTERLEAVE_READ ; + return 0 ; + } ; + + for (k = 0 ; k < count ; k++) + { *outptr = inptr [k] ; + outptr += psf->sf.channels ; + } ; + + templen -= count ; + } ; + } ; + + return len ; +} /* interleave_read_short */ + +static sf_count_t +interleave_read_int (SF_PRIVATE *psf, int *ptr, sf_count_t len) +{ INTERLEAVE_DATA *pdata ; + sf_count_t offset, templen ; + int chan, count, k ; + int *inptr, *outptr ; + + if (! (pdata = psf->interleave)) + return 0 ; + + inptr = (int*) pdata->buffer ; + + for (chan = 0 ; chan < psf->sf.channels ; chan++) + { outptr = ptr + chan ; + + offset = psf->dataoffset + chan * psf->bytewidth * psf->read_current ; + + if (psf_fseek (psf, offset, SEEK_SET) != offset) + { psf->error = SFE_INTERLEAVE_SEEK ; + return 0 ; + } ; + + templen = len / psf->sf.channels ; + + while (templen > 0) + { if (templen > SIGNED_SIZEOF (pdata->buffer) / SIGNED_SIZEOF (int)) + count = SIGNED_SIZEOF (pdata->buffer) / SIGNED_SIZEOF (int) ; + else + count = (int) templen ; + + if (pdata->read_int (psf, inptr, count) != count) + { psf->error = SFE_INTERLEAVE_READ ; + return 0 ; + } ; + + for (k = 0 ; k < count ; k++) + { *outptr = inptr [k] ; + outptr += psf->sf.channels ; + } ; + + templen -= count ; + } ; + } ; + + return len ; +} /* interleave_read_int */ + +static sf_count_t +interleave_read_float (SF_PRIVATE *psf, float *ptr, sf_count_t len) +{ INTERLEAVE_DATA *pdata ; + sf_count_t offset, templen ; + int chan, count, k ; + float *inptr, *outptr ; + + if (! (pdata = psf->interleave)) + return 0 ; + + inptr = (float*) pdata->buffer ; + + for (chan = 0 ; chan < psf->sf.channels ; chan++) + { outptr = ptr + chan ; + + offset = psf->dataoffset + pdata->channel_len * chan + psf->read_current * psf->bytewidth ; + +/*-printf ("chan : %d read_current : %6lld offset : %6lld\n", chan, psf->read_current, offset) ;-*/ + + if (psf_fseek (psf, offset, SEEK_SET) != offset) + { psf->error = SFE_INTERLEAVE_SEEK ; +/*-puts ("interleave_seek error") ; exit (1) ;-*/ + return 0 ; + } ; + + templen = len / psf->sf.channels ; + + while (templen > 0) + { if (templen > SIGNED_SIZEOF (pdata->buffer) / SIGNED_SIZEOF (float)) + count = SIGNED_SIZEOF (pdata->buffer) / SIGNED_SIZEOF (float) ; + else + count = (int) templen ; + + if (pdata->read_float (psf, inptr, count) != count) + { psf->error = SFE_INTERLEAVE_READ ; +/*-puts ("interleave_read error") ; exit (1) ;-*/ + return 0 ; + } ; + + for (k = 0 ; k < count ; k++) + { *outptr = inptr [k] ; + outptr += psf->sf.channels ; + } ; + + templen -= count ; + } ; + } ; + + return len ; +} /* interleave_read_float */ + +static sf_count_t +interleave_read_double (SF_PRIVATE *psf, double *ptr, sf_count_t len) +{ INTERLEAVE_DATA *pdata ; + sf_count_t offset, templen ; + int chan, count, k ; + double *inptr, *outptr ; + + if (! (pdata = psf->interleave)) + return 0 ; + + inptr = (double*) pdata->buffer ; + + for (chan = 0 ; chan < psf->sf.channels ; chan++) + { outptr = ptr + chan ; + + offset = psf->dataoffset + chan * psf->bytewidth * psf->read_current ; + + if (psf_fseek (psf, offset, SEEK_SET) != offset) + { psf->error = SFE_INTERLEAVE_SEEK ; + return 0 ; + } ; + + templen = len / psf->sf.channels ; + + while (templen > 0) + { if (templen > SIGNED_SIZEOF (pdata->buffer) / SIGNED_SIZEOF (double)) + count = SIGNED_SIZEOF (pdata->buffer) / SIGNED_SIZEOF (double) ; + else + count = (int) templen ; + + if (pdata->read_double (psf, inptr, count) != count) + { psf->error = SFE_INTERLEAVE_READ ; + return 0 ; + } ; + + for (k = 0 ; k < count ; k++) + { *outptr = inptr [k] ; + outptr += psf->sf.channels ; + } ; + + templen -= count ; + } ; + } ; + + return len ; +} /* interleave_read_double */ + +/*------------------------------------------------------------------------------ +*/ + +static sf_count_t +interleave_seek (SF_PRIVATE *psf, int mode, sf_count_t samples_from_start) +{ psf = psf ; mode = mode ; + + /* + ** Do nothing here. This is a place holder to prevent the default + ** seek function from being called. + */ + + return samples_from_start ; +} /* interleave_seek */ +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: 82314e13-0225-4408-a2f2-e6dab3f38904 +*/ diff --git a/Libraries/SndFile/Files/src/ircam.c b/Libraries/SndFile/Files/src/ircam.c new file mode 100644 index 000000000..d3f0e37ad --- /dev/null +++ b/Libraries/SndFile/Files/src/ircam.c @@ -0,0 +1,331 @@ +/* +** Copyright (C) 2001-2004 Erik de Castro Lopo +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU Lesser General Public License as published by +** the Free Software Foundation; either version 2.1 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU Lesser General Public License for more details. +** +** You should have received a copy of the GNU Lesser General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include +#include +#include +#include + +#include "sndfile.h" +#include "config.h" +#include "sfendian.h" +#include "common.h" + +/*------------------------------------------------------------------------------ +** Macros to handle big/little endian issues. +*/ + +/* The IRCAM magic number is weird in that one byte in the number can have +** values of 0x1, 0x2, 0x03 or 0x04. Hence the need for a marker and a mask. +*/ + +#define IRCAM_BE_MASK (MAKE_MARKER (0xFF, 0xFF, 0x00, 0xFF)) +#define IRCAM_BE_MARKER (MAKE_MARKER (0x64, 0xA3, 0x00, 0x00)) + +#define IRCAM_LE_MASK (MAKE_MARKER (0xFF, 0x00, 0xFF, 0xFF)) +#define IRCAM_LE_MARKER (MAKE_MARKER (0x00, 0x00, 0xA3, 0x64)) + +#define IRCAM_02B_MARKER (MAKE_MARKER (0x00, 0x02, 0xA3, 0x64)) +#define IRCAM_03L_MARKER (MAKE_MARKER (0x64, 0xA3, 0x03, 0x00)) + +#define IRCAM_DATA_OFFSET (1024) + +/*------------------------------------------------------------------------------ +** Typedefs. +*/ + +enum +{ IRCAM_PCM_16 = 0x00002, + IRCAM_FLOAT = 0x00004, + IRCAM_ALAW = 0x10001, + IRCAM_ULAW = 0x20001, + IRCAM_PCM_32 = 0x40004 +} ; + + +/*------------------------------------------------------------------------------ +** Private static functions. +*/ + +static int ircam_close (SF_PRIVATE *psf) ; +static int ircam_write_header (SF_PRIVATE *psf, int calc_length) ; +static int ircam_read_header (SF_PRIVATE *psf) ; + +static int get_encoding (int subformat) ; + +static const char* get_encoding_str (int encoding) ; + +/*------------------------------------------------------------------------------ +** Public function. +*/ + +int +ircam_open (SF_PRIVATE *psf) +{ int subformat ; + int error = SFE_NO_ERROR ; + + if (psf->mode == SFM_READ || (psf->mode == SFM_RDWR && psf->filelength > 0)) + { if ((error = ircam_read_header (psf))) + return error ; + } ; + + subformat = psf->sf.format & SF_FORMAT_SUBMASK ; + + if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR) + { if ((psf->sf.format & SF_FORMAT_TYPEMASK) != SF_FORMAT_IRCAM) + return SFE_BAD_OPEN_FORMAT ; + + psf->endian = psf->sf.format & SF_FORMAT_ENDMASK ; + if (psf->endian == 0 || psf->endian == SF_ENDIAN_CPU) + psf->endian = (CPU_IS_BIG_ENDIAN) ? SF_ENDIAN_BIG : SF_ENDIAN_LITTLE ; + + psf->dataoffset = IRCAM_DATA_OFFSET ; + + if ((error = ircam_write_header (psf, SF_FALSE))) + return error ; + + psf->write_header = ircam_write_header ; + } ; + + psf->close = ircam_close ; + + switch (subformat) + { case SF_FORMAT_ULAW : /* 8-bit Ulaw encoding. */ + error = ulaw_init (psf) ; + break ; + + case SF_FORMAT_ALAW : /* 8-bit Alaw encoding. */ + error = alaw_init (psf) ; + break ; + + case SF_FORMAT_PCM_16 : /* 16-bit linear PCM. */ + case SF_FORMAT_PCM_32 : /* 32-bit linear PCM. */ + error = pcm_init (psf) ; + break ; + + case SF_FORMAT_FLOAT : /* 32-bit linear PCM. */ + error = float32_init (psf) ; + break ; + + default : break ; + } ; + + return error ; +} /* ircam_open */ + +/*------------------------------------------------------------------------------ +*/ + +static int +ircam_read_header (SF_PRIVATE *psf) +{ unsigned int marker, encoding ; + float samplerate ; + int error = SFE_NO_ERROR ; + + psf_binheader_readf (psf, "epmf44", 0, &marker, &samplerate, &(psf->sf.channels), &encoding) ; + + if (((marker & IRCAM_LE_MASK) != IRCAM_LE_MARKER) && + ((marker & IRCAM_BE_MASK) != IRCAM_BE_MARKER)) + { psf_log_printf (psf, "marker: 0x%X\n", marker) ; + return SFE_IRCAM_NO_MARKER ; + } ; + + psf->endian = SF_ENDIAN_LITTLE ; + + if (psf->sf.channels > 256) + { psf_binheader_readf (psf, "Epmf44", 0, &marker, &samplerate, &(psf->sf.channels), &encoding) ; + + /* Sanity checking for endian-ness detection. */ + if (psf->sf.channels > 256) + { psf_log_printf (psf, "marker: 0x%X\n", marker) ; + return SFE_IRCAM_BAD_CHANNELS ; + } ; + + psf->endian = SF_ENDIAN_BIG ; + } ; + + psf_log_printf (psf, "marker: 0x%X\n", marker) ; + + psf->sf.samplerate = (int) samplerate ; + + psf_log_printf (psf, " Sample Rate : %d\n" + " Channels : %d\n" + " Encoding : %X => %s\n", psf->sf.samplerate, psf->sf.channels, encoding, get_encoding_str (encoding)) ; + + switch (encoding) + { case IRCAM_PCM_16 : + psf->bytewidth = 2 ; + psf->blockwidth = psf->sf.channels * psf->bytewidth ; + + psf->sf.format = SF_FORMAT_IRCAM | SF_FORMAT_PCM_16 ; + break ; + + case IRCAM_PCM_32 : + psf->bytewidth = 4 ; + psf->blockwidth = psf->sf.channels * psf->bytewidth ; + + psf->sf.format = SF_FORMAT_IRCAM | SF_FORMAT_PCM_32 ; + break ; + + case IRCAM_FLOAT : + psf->bytewidth = 4 ; + psf->blockwidth = psf->sf.channels * psf->bytewidth ; + + psf->sf.format = SF_FORMAT_IRCAM | SF_FORMAT_FLOAT ; + break ; + + case IRCAM_ALAW : + psf->bytewidth = 1 ; + psf->blockwidth = psf->sf.channels * psf->bytewidth ; + + psf->sf.format = SF_FORMAT_IRCAM | SF_FORMAT_ALAW ; + break ; + + case IRCAM_ULAW : + psf->bytewidth = 1 ; + psf->blockwidth = psf->sf.channels * psf->bytewidth ; + + psf->sf.format = SF_FORMAT_IRCAM | SF_FORMAT_ULAW ; + break ; + + default : + error = SFE_IRCAM_UNKNOWN_FORMAT ; + break ; + } ; + + if (psf->endian == SF_ENDIAN_BIG) + psf->sf.format |= SF_ENDIAN_BIG ; + else + psf->sf.format |= SF_ENDIAN_LITTLE ; + + if (error) + return error ; + + psf->dataoffset = IRCAM_DATA_OFFSET ; + psf->datalength = psf->filelength - psf->dataoffset ; + + if (psf->sf.frames == 0 && psf->blockwidth) + psf->sf.frames = psf->datalength / psf->blockwidth ; + + psf_log_printf (psf, " Samples : %d\n", psf->sf.frames) ; + + psf_binheader_readf (psf, "p", IRCAM_DATA_OFFSET) ; + + return 0 ; +} /* ircam_read_header */ + +static int +ircam_close (SF_PRIVATE *psf) +{ + psf_log_printf (psf, "close\n") ; + + return 0 ; +} /* ircam_close */ + +static int +ircam_write_header (SF_PRIVATE *psf, int calc_length) +{ int encoding ; + float samplerate ; + sf_count_t current ; + + if (psf->pipeoffset > 0) + return 0 ; + + current = psf_ftell (psf) ; + + calc_length = calc_length ; + + /* This also sets psf->endian. */ + encoding = get_encoding (psf->sf.format & SF_FORMAT_SUBMASK) ; + + if (encoding == 0) + return SFE_BAD_OPEN_FORMAT ; + + /* Reset the current header length to zero. */ + psf->header [0] = 0 ; + psf->headindex = 0 ; + + if (psf->is_pipe == SF_FALSE) + psf_fseek (psf, 0, SEEK_SET) ; + + samplerate = psf->sf.samplerate ; + + switch (psf->endian) + { case SF_ENDIAN_BIG : + psf_binheader_writef (psf, "Emf", IRCAM_02B_MARKER, samplerate) ; + psf_binheader_writef (psf, "E44", psf->sf.channels, encoding) ; + break ; + + case SF_ENDIAN_LITTLE : + psf_binheader_writef (psf, "emf", IRCAM_03L_MARKER, samplerate) ; + psf_binheader_writef (psf, "e44", psf->sf.channels, encoding) ; + break ; + + default : return SFE_BAD_OPEN_FORMAT ; + } ; + + psf_binheader_writef (psf, "z", (size_t) (IRCAM_DATA_OFFSET - psf->headindex)) ; + + /* Header construction complete so write it out. */ + psf_fwrite (psf->header, psf->headindex, 1, psf) ; + + if (psf->error) + return psf->error ; + + if (current > 0) + psf_fseek (psf, current, SEEK_SET) ; + + return psf->error ; +} /* ircam_write_header */ + +static int +get_encoding (int subformat) +{ switch (subformat) + { case SF_FORMAT_PCM_16 : return IRCAM_PCM_16 ; + case SF_FORMAT_PCM_32 : return IRCAM_PCM_32 ; + + case SF_FORMAT_FLOAT : return IRCAM_FLOAT ; + + case SF_FORMAT_ULAW : return IRCAM_ULAW ; + case SF_FORMAT_ALAW : return IRCAM_ALAW ; + + default : break ; + } ; + + return 0 ; +} /* get_encoding */ + +static const char* +get_encoding_str (int encoding) +{ switch (encoding) + { case IRCAM_PCM_16 : return "16 bit PCM" ; + case IRCAM_FLOAT : return "32 bit float" ; + case IRCAM_ALAW : return "A law" ; + case IRCAM_ULAW : return "u law" ; + case IRCAM_PCM_32 : return "32 bit PCM" ; + } ; + return "Unknown encoding" ; +} /* get_encoding_str */ + +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: f2714ab8-f286-4c94-9740-edaf673a1c71 +*/ diff --git a/Libraries/SndFile/Files/src/libsndfile.def b/Libraries/SndFile/Files/src/libsndfile.def new file mode 100644 index 000000000..710855268 --- /dev/null +++ b/Libraries/SndFile/Files/src/libsndfile.def @@ -0,0 +1,37 @@ +; Auto-generated by create_symbols_file.py + +LIBRARY libsndfile.dll +EXPORTS + +sf_command @1 +sf_open @2 +sf_close @3 +sf_seek @4 +sf_error @7 +sf_perror @8 +sf_error_str @9 +sf_error_number @10 +sf_format_check @11 +sf_read_raw @16 +sf_readf_short @17 +sf_readf_int @18 +sf_readf_float @19 +sf_readf_double @20 +sf_read_short @21 +sf_read_int @22 +sf_read_float @23 +sf_read_double @24 +sf_write_raw @32 +sf_writef_short @33 +sf_writef_int @34 +sf_writef_float @35 +sf_writef_double @36 +sf_write_short @37 +sf_write_int @38 +sf_write_float @39 +sf_write_double @40 +sf_strerror @50 +sf_get_string @60 +sf_set_string @61 +sf_open_fd @70 + diff --git a/Libraries/SndFile/Files/src/macbinary3.c b/Libraries/SndFile/Files/src/macbinary3.c new file mode 100644 index 000000000..1b1a91d6c --- /dev/null +++ b/Libraries/SndFile/Files/src/macbinary3.c @@ -0,0 +1,58 @@ +/* +** Copyright (C) 2003,2004 Erik de Castro Lopo +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU Lesser General Public License as published by +** the Free Software Foundation; either version 2.1 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU Lesser General Public License for more details. +** +** You should have received a copy of the GNU Lesser General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include "config.h" + +#include +#include + +#include "sndfile.h" +#include "sfendian.h" +#include "common.h" + +#if (OS_IS_MACOSX == 1) + +//#include + +int +macbinary3_open (SF_PRIVATE *psf) +{ + if (psf) + return 0 ; + + return 0 ; +} /* macbinary3_open */ + +#else + +int +macbinary3_open (SF_PRIVATE *psf) +{ + psf = psf ; + return 0 ; +} /* macbinary3_open */ + +#endif /* OS_IS_MACOSX */ + +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: c397a7d7-1a31-4349-9684-bd29ef06211e +*/ diff --git a/Libraries/SndFile/Files/src/macos.c b/Libraries/SndFile/Files/src/macos.c new file mode 100644 index 000000000..3c664f390 --- /dev/null +++ b/Libraries/SndFile/Files/src/macos.c @@ -0,0 +1,63 @@ +/* +** Copyright (C) 2003,2004 Erik de Castro Lopo +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU Lesser General Public License as published by +** the Free Software Foundation; either version 2.1 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU Lesser General Public License for more details. +** +** You should have received a copy of the GNU Lesser General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include "config.h" + +#include +#include +#include + +#include "sndfile.h" +#include "sfendian.h" +#include "common.h" + +#define STR_MARKER MAKE_MARKER ('S', 'T', 'R', ' ') + +int +macos_guess_file_type (SF_PRIVATE *psf, const char *filename) +{ static char rsrc_name [1024] ; + struct stat statbuf ; + int format ; + + psf = psf ; + + snprintf (rsrc_name, sizeof (rsrc_name), "%s/rsrc", filename) ; + + /* If there is no resource fork, just return. */ + if (stat (rsrc_name, &statbuf) != 0) + { psf_log_printf (psf, "No resource fork.\n") ; + return 0 ; + } ; + + if (statbuf.st_size == 0) + { psf_log_printf (psf, "Have zero size resource fork.\n") ; + return 0 ; + } ; + + format = 0 ; + + return format ; +} /* macos_guess_file_type */ + +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: 5fbf66d7-9547-442a-9c73-92fd164f3a95 +*/ diff --git a/Libraries/SndFile/Files/src/mat4.c b/Libraries/SndFile/Files/src/mat4.c new file mode 100644 index 000000000..64a0b6398 --- /dev/null +++ b/Libraries/SndFile/Files/src/mat4.c @@ -0,0 +1,393 @@ +/* +** Copyright (C) 2002-2004 Erik de Castro Lopo +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU Lesser General Public License as published by +** the Free Software Foundation; either version 2.1 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU Lesser General Public License for more details. +** +** You should have received a copy of the GNU Lesser General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include +#include +#include +#include + +#include "sndfile.h" +#include "config.h" +#include "sfendian.h" +#include "common.h" +#include "float_cast.h" + +/*------------------------------------------------------------------------------ +** Information on how to decode and encode this file was obtained in a PDF +** file which I found on http://www.wotsit.org/. +** Also did a lot of testing with GNU Octave but do not have access to +** Matlab (tm) and so could not test it there. +*/ + +/*------------------------------------------------------------------------------ +** Macros to handle big/little endian issues. +*/ + +#define MAT4_BE_DOUBLE (MAKE_MARKER (0, 0, 0x03, 0xE8)) +#define MAT4_LE_DOUBLE (MAKE_MARKER (0, 0, 0, 0)) + +#define MAT4_BE_FLOAT (MAKE_MARKER (0, 0, 0x03, 0xF2)) +#define MAT4_LE_FLOAT (MAKE_MARKER (0x0A, 0, 0, 0)) + +#define MAT4_BE_PCM_32 (MAKE_MARKER (0, 0, 0x03, 0xFC)) +#define MAT4_LE_PCM_32 (MAKE_MARKER (0x14, 0, 0, 0)) + +#define MAT4_BE_PCM_16 (MAKE_MARKER (0, 0, 0x04, 0x06)) +#define MAT4_LE_PCM_16 (MAKE_MARKER (0x1E, 0, 0, 0)) + +/* Can't see any reason to ever implement this. */ +#define MAT4_BE_PCM_U8 (MAKE_MARKER (0, 0, 0x04, 0x1A)) +#define MAT4_LE_PCM_U8 (MAKE_MARKER (0x32, 0, 0, 0)) + +/*------------------------------------------------------------------------------ +** Private static functions. +*/ + +static int mat4_close (SF_PRIVATE *psf) ; + +static int mat4_format_to_encoding (int format, int endian) ; + +static int mat4_write_header (SF_PRIVATE *psf, int calc_length) ; +static int mat4_read_header (SF_PRIVATE *psf) ; + +static const char * mat4_marker_to_str (int marker) ; + +/*------------------------------------------------------------------------------ +** Public function. +*/ + +int +mat4_open (SF_PRIVATE *psf) +{ int subformat, error = 0 ; + + if (psf->mode == SFM_READ || (psf->mode == SFM_RDWR && psf->filelength > 0)) + { if ((error = mat4_read_header (psf))) + return error ; + } ; + + if ((psf->sf.format & SF_FORMAT_TYPEMASK) != SF_FORMAT_MAT4) + return SFE_BAD_OPEN_FORMAT ; + + subformat = psf->sf.format & SF_FORMAT_SUBMASK ; + + if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR) + { if (psf->is_pipe) + return SFE_NO_PIPE_WRITE ; + + psf->endian = psf->sf.format & SF_FORMAT_ENDMASK ; + if (CPU_IS_LITTLE_ENDIAN && (psf->endian == SF_ENDIAN_CPU || psf->endian == 0)) + psf->endian = SF_ENDIAN_LITTLE ; + else if (CPU_IS_BIG_ENDIAN && (psf->endian == SF_ENDIAN_CPU || psf->endian == 0)) + psf->endian = SF_ENDIAN_BIG ; + + if ((error = mat4_write_header (psf, SF_FALSE))) + return error ; + + psf->write_header = mat4_write_header ; + } ; + + psf->close = mat4_close ; + + psf->blockwidth = psf->bytewidth * psf->sf.channels ; + + switch (subformat) + { case SF_FORMAT_PCM_16 : + case SF_FORMAT_PCM_32 : + error = pcm_init (psf) ; + break ; + + case SF_FORMAT_FLOAT : + error = float32_init (psf) ; + break ; + + case SF_FORMAT_DOUBLE : + error = double64_init (psf) ; + break ; + + default : break ; + } ; + + if (error) + return error ; + + return error ; +} /* mat4_open */ + +/*------------------------------------------------------------------------------ +*/ + +static int +mat4_close (SF_PRIVATE *psf) +{ + if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR) + mat4_write_header (psf, SF_TRUE) ; + + return 0 ; +} /* mat4_close */ + +/*------------------------------------------------------------------------------ +*/ + +static int +mat4_write_header (SF_PRIVATE *psf, int calc_length) +{ sf_count_t current ; + int encoding ; + double samplerate ; + + current = psf_ftell (psf) ; + + if (calc_length) + { psf->filelength = psf_get_filelen (psf) ; + + psf->datalength = psf->filelength - psf->dataoffset ; + if (psf->dataend) + psf->datalength -= psf->filelength - psf->dataend ; + + psf->sf.frames = psf->datalength / (psf->bytewidth * psf->sf.channels) ; + } ; + + encoding = mat4_format_to_encoding (psf->sf.format & SF_FORMAT_SUBMASK, psf->endian) ; + + if (encoding == -1) + return SFE_BAD_OPEN_FORMAT ; + + /* Reset the current header length to zero. */ + psf->header [0] = 0 ; + psf->headindex = 0 ; + psf_fseek (psf, 0, SEEK_SET) ; + + /* Need sample rate as a double for writing to the header. */ + samplerate = psf->sf.samplerate ; + + if (psf->endian == SF_ENDIAN_BIG) + { psf_binheader_writef (psf, "Em444", MAT4_BE_DOUBLE, 1, 1, 0) ; + psf_binheader_writef (psf, "E4bd", 11, "samplerate", 11, samplerate) ; + psf_binheader_writef (psf, "tEm484", encoding, psf->sf.channels, psf->sf.frames, 0) ; + psf_binheader_writef (psf, "E4b", 9, "wavedata", 9) ; + } + else if (psf->endian == SF_ENDIAN_LITTLE) + { psf_binheader_writef (psf, "em444", MAT4_LE_DOUBLE, 1, 1, 0) ; + psf_binheader_writef (psf, "e4bd", 11, "samplerate", 11, samplerate) ; + psf_binheader_writef (psf, "tem484", encoding, psf->sf.channels, psf->sf.frames, 0) ; + psf_binheader_writef (psf, "e4b", 9, "wavedata", 9) ; + } + else + return SFE_BAD_OPEN_FORMAT ; + + /* Header construction complete so write it out. */ + psf_fwrite (psf->header, psf->headindex, 1, psf) ; + + if (psf->error) + return psf->error ; + + psf->dataoffset = psf->headindex ; + + if (current > 0) + psf_fseek (psf, current, SEEK_SET) ; + + return psf->error ; +} /* mat4_write_header */ + +static int +mat4_read_header (SF_PRIVATE *psf) +{ int marker, namesize, rows, cols, imag ; + double value ; + const char *marker_str ; + char name [64] ; + + psf_binheader_readf (psf, "pm", 0, &marker) ; + + /* MAT4 file must start with a double for the samplerate. */ + if (marker == MAT4_BE_DOUBLE) + { psf->endian = psf->rwf_endian = SF_ENDIAN_BIG ; + marker_str = "big endian double" ; + } + else if (marker == MAT4_LE_DOUBLE) + { psf->endian = psf->rwf_endian = SF_ENDIAN_LITTLE ; + marker_str = "little endian double" ; + } + else + return SFE_UNIMPLEMENTED ; + + psf_log_printf (psf, "GNU Octave 2.0 / MATLAB v4.2 format\nMarker : %s\n", marker_str) ; + + psf_binheader_readf (psf, "444", &rows, &cols, &imag) ; + + psf_log_printf (psf, " Rows : %d\n Cols : %d\n Imag : %s\n", rows, cols, imag ? "True" : "False") ; + + psf_binheader_readf (psf, "4", &namesize) ; + + if (namesize >= SIGNED_SIZEOF (name)) + return SFE_MAT4_BAD_NAME ; + + psf_binheader_readf (psf, "b", name, namesize) ; + name [namesize] = 0 ; + + psf_log_printf (psf, " Name : %s\n", name) ; + + psf_binheader_readf (psf, "d", &value) ; + + LSF_SNPRINTF (psf->u.scbuf, sizeof (psf->u.scbuf), " Value : %f\n", value) ; + psf_log_printf (psf, psf->u.scbuf) ; + + if ((rows != 1) || (cols != 1)) + return SFE_MAT4_NO_SAMPLERATE ; + + psf->sf.samplerate = lrint (value) ; + + /* Now write out the audio data. */ + + psf_binheader_readf (psf, "m", &marker) ; + + psf_log_printf (psf, "Marker : %s\n", mat4_marker_to_str (marker)) ; + + psf_binheader_readf (psf, "444", &rows, &cols, &imag) ; + + psf_log_printf (psf, " Rows : %d\n Cols : %d\n Imag : %s\n", rows, cols, imag ? "True" : "False") ; + + psf_binheader_readf (psf, "4", &namesize) ; + + if (namesize >= SIGNED_SIZEOF (name)) + return SFE_MAT4_BAD_NAME ; + + psf_binheader_readf (psf, "b", name, namesize) ; + name [namesize] = 0 ; + + psf_log_printf (psf, " Name : %s\n", name) ; + + psf->dataoffset = psf_ftell (psf) ; + + if (rows == 0 && cols == 0) + { psf_log_printf (psf, "*** Error : zero channel count.\n") ; + return SFE_MAT4_ZERO_CHANNELS ; + } ; + + psf->sf.channels = rows ; + psf->sf.frames = cols ; + + psf->sf.format = psf->endian | SF_FORMAT_MAT4 ; + switch (marker) + { case MAT4_BE_DOUBLE : + case MAT4_LE_DOUBLE : + psf->sf.format |= SF_FORMAT_DOUBLE ; + psf->bytewidth = 8 ; + break ; + + case MAT4_BE_FLOAT : + case MAT4_LE_FLOAT : + psf->sf.format |= SF_FORMAT_FLOAT ; + psf->bytewidth = 4 ; + break ; + + case MAT4_BE_PCM_32 : + case MAT4_LE_PCM_32 : + psf->sf.format |= SF_FORMAT_PCM_32 ; + psf->bytewidth = 4 ; + break ; + + case MAT4_BE_PCM_16 : + case MAT4_LE_PCM_16 : + psf->sf.format |= SF_FORMAT_PCM_16 ; + psf->bytewidth = 2 ; + break ; + + default : + psf_log_printf (psf, "*** Error : Bad marker %08X\n", marker) ; + return SFE_UNIMPLEMENTED ; + } ; + + if ((psf->filelength - psf->dataoffset) < psf->sf.channels * psf->sf.frames * psf->bytewidth) + { psf_log_printf (psf, "*** File seems to be truncated. %D <--> %D\n", + psf->filelength - psf->dataoffset, psf->sf.channels * psf->sf.frames * psf->bytewidth) ; + } + else if ((psf->filelength - psf->dataoffset) > psf->sf.channels * psf->sf.frames * psf->bytewidth) + psf->dataend = psf->dataoffset + rows * cols * psf->bytewidth ; + + psf->datalength = psf->filelength - psf->dataoffset - psf->dataend ; + + psf->sf.sections = 1 ; + + return 0 ; +} /* mat4_read_header */ + +static int +mat4_format_to_encoding (int format, int endian) +{ + switch (format | endian) + { case (SF_FORMAT_PCM_16 | SF_ENDIAN_BIG) : + return MAT4_BE_PCM_16 ; + + case (SF_FORMAT_PCM_16 | SF_ENDIAN_LITTLE) : + return MAT4_LE_PCM_16 ; + + case (SF_FORMAT_PCM_32 | SF_ENDIAN_BIG) : + return MAT4_BE_PCM_32 ; + + case (SF_FORMAT_PCM_32 | SF_ENDIAN_LITTLE) : + return MAT4_LE_PCM_32 ; + + case (SF_FORMAT_FLOAT | SF_ENDIAN_BIG) : + return MAT4_BE_FLOAT ; + + case (SF_FORMAT_FLOAT | SF_ENDIAN_LITTLE) : + return MAT4_LE_FLOAT ; + + case (SF_FORMAT_DOUBLE | SF_ENDIAN_BIG) : + return MAT4_BE_DOUBLE ; + + case (SF_FORMAT_DOUBLE | SF_ENDIAN_LITTLE) : + return MAT4_LE_DOUBLE ; + + default : break ; + } ; + + return -1 ; +} /* mat4_format_to_encoding */ + +static const char * +mat4_marker_to_str (int marker) +{ static char str [32] ; + + switch (marker) + { + case MAT4_BE_PCM_16 : return "big endian 16 bit PCM" ; + case MAT4_LE_PCM_16 : return "little endian 16 bit PCM" ; + + case MAT4_BE_PCM_32 : return "big endian 32 bit PCM" ; + case MAT4_LE_PCM_32 : return "little endian 32 bit PCM" ; + + + case MAT4_BE_FLOAT : return "big endian float" ; + case MAT4_LE_FLOAT : return "big endian float" ; + + case MAT4_BE_DOUBLE : return "big endian double" ; + case MAT4_LE_DOUBLE : return "little endian double" ; + } ; + + /* This is a little unsafe but is really only for debugging. */ + str [sizeof (str) - 1] = 0 ; + LSF_SNPRINTF (str, sizeof (str) - 1, "%08X", marker) ; + return str ; +} /* mat4_marker_to_str */ +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: f7e5f5d6-fc39-452e-bc4a-59627116ff59 +*/ diff --git a/Libraries/SndFile/Files/src/mat5.c b/Libraries/SndFile/Files/src/mat5.c new file mode 100644 index 000000000..1bed0b883 --- /dev/null +++ b/Libraries/SndFile/Files/src/mat5.c @@ -0,0 +1,506 @@ +/* +** Copyright (C) 2002-2004 Erik de Castro Lopo +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU Lesser General Public License as published by +** the Free Software Foundation; either version 2.1 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU Lesser General Public License for more details. +** +** You should have received a copy of the GNU Lesser General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include +#include +#include +#include + +#include "sndfile.h" +#include "config.h" +#include "sfendian.h" +#include "common.h" +#include "float_cast.h" + +/*------------------------------------------------------------------------------ +** Information on how to decode and encode this file was obtained in a PDF +** file which I found on http://www.wotsit.org/. +** Also did a lot of testing with GNU Octave but do not have access to +** Matlab (tm) and so could not test it there. +*/ + +/*------------------------------------------------------------------------------ +** Macros to handle big/little endian issues. +*/ + +#define MATL_MARKER (MAKE_MARKER ('M', 'A', 'T', 'L')) + +#define IM_MARKER (('I' << 8) + 'M') +#define MI_MARKER (('M' << 8) + 'I') + +/*------------------------------------------------------------------------------ +** Enums and typedefs. +*/ + +enum +{ MAT5_TYPE_SCHAR = 0x1, + MAT5_TYPE_UCHAR = 0x2, + MAT5_TYPE_INT16 = 0x3, + MAT5_TYPE_UINT16 = 0x4, + MAT5_TYPE_INT32 = 0x5, + MAT5_TYPE_UINT32 = 0x6, + MAT5_TYPE_FLOAT = 0x7, + MAT5_TYPE_DOUBLE = 0x9, + MAT5_TYPE_ARRAY = 0xE, + + MAT5_TYPE_COMP_USHORT = 0x00020004, + MAT5_TYPE_COMP_UINT = 0x00040006 +} ; + +typedef struct +{ sf_count_t size ; + int rows, cols ; + char name [32] ; +} MAT5_MATRIX ; + +/*------------------------------------------------------------------------------ +** Private static functions. +*/ + +static int mat5_close (SF_PRIVATE *psf) ; + +static int mat5_write_header (SF_PRIVATE *psf, int calc_length) ; +static int mat5_read_header (SF_PRIVATE *psf) ; + +/*------------------------------------------------------------------------------ +** Public function. +*/ + +int +mat5_open (SF_PRIVATE *psf) +{ int subformat, error = 0 ; + + if (psf->mode == SFM_READ || (psf->mode == SFM_RDWR && psf->filelength > 0)) + { if ((error = mat5_read_header (psf))) + return error ; + } ; + + if ((psf->sf.format & SF_FORMAT_TYPEMASK) != SF_FORMAT_MAT5) + return SFE_BAD_OPEN_FORMAT ; + + subformat = psf->sf.format & SF_FORMAT_SUBMASK ; + + if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR) + { if (psf->is_pipe) + return SFE_NO_PIPE_WRITE ; + + psf->endian = psf->sf.format & SF_FORMAT_ENDMASK ; + if (CPU_IS_LITTLE_ENDIAN && (psf->endian == SF_ENDIAN_CPU || psf->endian == 0)) + psf->endian = SF_ENDIAN_LITTLE ; + else if (CPU_IS_BIG_ENDIAN && (psf->endian == SF_ENDIAN_CPU || psf->endian == 0)) + psf->endian = SF_ENDIAN_BIG ; + + if ((error = mat5_write_header (psf, SF_FALSE))) + return error ; + + psf->write_header = mat5_write_header ; + } ; + + psf->close = mat5_close ; + + psf->blockwidth = psf->bytewidth * psf->sf.channels ; + + switch (subformat) + { case SF_FORMAT_PCM_U8 : + case SF_FORMAT_PCM_16 : + case SF_FORMAT_PCM_32 : + error = pcm_init (psf) ; + break ; + + case SF_FORMAT_FLOAT : + error = float32_init (psf) ; + break ; + + case SF_FORMAT_DOUBLE : + error = double64_init (psf) ; + break ; + + default : break ; + } ; + + return error ; +} /* mat5_open */ + +/*------------------------------------------------------------------------------ +*/ + +static int +mat5_close (SF_PRIVATE *psf) +{ + if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR) + mat5_write_header (psf, SF_TRUE) ; + + return 0 ; +} /* mat5_close */ + +/*------------------------------------------------------------------------------ +*/ + +static int +mat5_write_header (SF_PRIVATE *psf, int calc_length) +{ static const char *sr_name = "samplerate\0\0\0\0\0\0\0\0\0\0\0" ; + static const char *wd_name = "wavedata\0" ; + sf_count_t current, datasize ; + int encoding ; + + current = psf_ftell (psf) ; + + if (calc_length) + { psf_fseek (psf, 0, SEEK_END) ; + psf->filelength = psf_ftell (psf) ; + psf_fseek (psf, 0, SEEK_SET) ; + + psf->datalength = psf->filelength - psf->dataoffset ; + if (psf->dataend) + psf->datalength -= psf->filelength - psf->dataend ; + + psf->sf.frames = psf->datalength / (psf->bytewidth * psf->sf.channels) ; + } ; + + switch (psf->sf.format & SF_FORMAT_SUBMASK) + { case SF_FORMAT_PCM_U8 : + encoding = MAT5_TYPE_UCHAR ; + break ; + + case SF_FORMAT_PCM_16 : + encoding = MAT5_TYPE_INT16 ; + break ; + + case SF_FORMAT_PCM_32 : + encoding = MAT5_TYPE_INT32 ; + break ; + + case SF_FORMAT_FLOAT : + encoding = MAT5_TYPE_FLOAT ; + break ; + + case SF_FORMAT_DOUBLE : + encoding = MAT5_TYPE_DOUBLE ; + break ; + + default : + return SFE_BAD_OPEN_FORMAT ; + } ; + + /* Reset the current header length to zero. */ + psf->header [0] = 0 ; + psf->headindex = 0 ; + psf_fseek (psf, 0, SEEK_SET) ; + + psf_binheader_writef (psf, "S", "MATLAB 5.0 MAT-file, written by " PACKAGE "-" VERSION ", ") ; + psf_get_date_str (psf->u.scbuf, sizeof (psf->u.scbuf)) ; + psf_binheader_writef (psf, "jS", -1, psf->u.scbuf) ; + + memset (psf->u.scbuf, ' ', 124 - psf->headindex) ; + psf_binheader_writef (psf, "b", psf->u.scbuf, 124 - psf->headindex) ; + + psf->rwf_endian = psf->endian ; + + if (psf->rwf_endian == SF_ENDIAN_BIG) + psf_binheader_writef (psf, "2b", 0x0100, "MI", 2) ; + else + psf_binheader_writef (psf, "2b", 0x0100, "IM", 2) ; + + psf_binheader_writef (psf, "444444", MAT5_TYPE_ARRAY, 64, MAT5_TYPE_UINT32, 8, 6, 0) ; + psf_binheader_writef (psf, "4444", MAT5_TYPE_INT32, 8, 1, 1) ; + psf_binheader_writef (psf, "44b", MAT5_TYPE_SCHAR, strlen (sr_name), sr_name, 16) ; + + if (psf->sf.samplerate > 0xFFFF) + psf_binheader_writef (psf, "44", MAT5_TYPE_COMP_UINT, psf->sf.samplerate) ; + else + { unsigned short samplerate = psf->sf.samplerate ; + + psf_binheader_writef (psf, "422", MAT5_TYPE_COMP_USHORT, samplerate, 0) ; + } ; + + datasize = psf->sf.frames * psf->sf.channels * psf->bytewidth ; + + psf_binheader_writef (psf, "t484444", MAT5_TYPE_ARRAY, datasize + 64, MAT5_TYPE_UINT32, 8, 6, 0) ; + psf_binheader_writef (psf, "t4448", MAT5_TYPE_INT32, 8, psf->sf.channels, psf->sf.frames) ; + psf_binheader_writef (psf, "44b", MAT5_TYPE_SCHAR, strlen (wd_name), wd_name, strlen (wd_name)) ; + + datasize = psf->sf.frames * psf->sf.channels * psf->bytewidth ; + if (datasize > 0x7FFFFFFF) + datasize = 0x7FFFFFFF ; + + psf_binheader_writef (psf, "t48", encoding, datasize) ; + + /* Header construction complete so write it out. */ + psf_fwrite (psf->header, psf->headindex, 1, psf) ; + + if (psf->error) + return psf->error ; + + psf->dataoffset = psf->headindex ; + + if (current > 0) + psf_fseek (psf, current, SEEK_SET) ; + + return psf->error ; +} /* mat5_write_header */ + +static int +mat5_read_header (SF_PRIVATE *psf) +{ char name [32] ; + short version, endian ; + int type, size, flags1, flags2, rows, cols ; + + psf_binheader_readf (psf, "pb", 0, psf->u.scbuf, 124) ; + + psf->u.scbuf [125] = 0 ; + + if (strlen (psf->u.scbuf) >= 124) + return SFE_UNIMPLEMENTED ; + + if (strstr (psf->u.cbuf, "MATLAB 5.0 MAT-file") == psf->u.cbuf) + psf_log_printf (psf, "%s\n", psf->u.scbuf) ; + + + psf_binheader_readf (psf, "E22", &version, &endian) ; + + if (endian == MI_MARKER) + { psf->endian = psf->rwf_endian = SF_ENDIAN_BIG ; + if (CPU_IS_LITTLE_ENDIAN) version = ENDSWAP_SHORT (version) ; + } + else if (endian == IM_MARKER) + { psf->endian = psf->rwf_endian = SF_ENDIAN_LITTLE ; + if (CPU_IS_BIG_ENDIAN) version = ENDSWAP_SHORT (version) ; + } + else + return SFE_MAT5_BAD_ENDIAN ; + + if ((CPU_IS_LITTLE_ENDIAN && endian == IM_MARKER) || + (CPU_IS_BIG_ENDIAN && endian == MI_MARKER)) + version = ENDSWAP_SHORT (version) ; + + psf_log_printf (psf, "Version : 0x%04X\n", version) ; + psf_log_printf (psf, "Endian : 0x%04X => %s\n", endian, + (psf->endian == SF_ENDIAN_LITTLE) ? "Little" : "Big") ; + + /*========================================================*/ + psf_binheader_readf (psf, "44", &type, &size) ; + psf_log_printf (psf, "Block\n Type : %X Size : %d\n", type, size) ; + + if (type != MAT5_TYPE_ARRAY) + return SFE_MAT5_NO_BLOCK ; + + psf_binheader_readf (psf, "44", &type, &size) ; + psf_log_printf (psf, " Type : %X Size : %d\n", type, size) ; + + if (type != MAT5_TYPE_UINT32) + return SFE_MAT5_NO_BLOCK ; + + psf_binheader_readf (psf, "44", &flags1, &flags2) ; + psf_log_printf (psf, " Flg1 : %X Flg2 : %d\n", flags1, flags2) ; + + psf_binheader_readf (psf, "44", &type, &size) ; + psf_log_printf (psf, " Type : %X Size : %d\n", type, size) ; + + if (type != MAT5_TYPE_INT32) + return SFE_MAT5_NO_BLOCK ; + + psf_binheader_readf (psf, "44", &rows, &cols) ; + psf_log_printf (psf, " Rows : %X Cols : %d\n", rows, cols) ; + + if (rows != 1 || cols != 1) + return SFE_MAT5_SAMPLE_RATE ; + + psf_binheader_readf (psf, "4", &type) ; + + if (type == MAT5_TYPE_SCHAR) + { psf_binheader_readf (psf, "4", &size) ; + psf_log_printf (psf, " Type : %X Size : %d\n", type, size) ; + if (size > SIGNED_SIZEOF (name) - 1) + { psf_log_printf (psf, "Error : Bad name length.\n") ; + return SFE_MAT5_NO_BLOCK ; + } ; + + psf_binheader_readf (psf, "bj", name, size, (8 - (size % 8)) % 8) ; + name [size] = 0 ; + } + else if ((type & 0xFFFF) == MAT5_TYPE_SCHAR) + { size = type >> 16 ; + if (size > 4) + { psf_log_printf (psf, "Error : Bad name length.\n") ; + return SFE_MAT5_NO_BLOCK ; + } ; + + psf_log_printf (psf, " Type : %X\n", type) ; + psf_binheader_readf (psf, "4", &name) ; + name [size] = 0 ; + } + else + return SFE_MAT5_NO_BLOCK ; + + psf_log_printf (psf, " Name : %s\n", name) ; + + /*-----------------------------------------*/ + + psf_binheader_readf (psf, "44", &type, &size) ; + + switch (type) + { case MAT5_TYPE_DOUBLE : + { double samplerate ; + + psf_binheader_readf (psf, "d", &samplerate) ; + LSF_SNPRINTF (name, sizeof (name), "%f\n", samplerate) ; + psf_log_printf (psf, " Val : %s\n", name) ; + + psf->sf.samplerate = lrint (samplerate) ; + } ; + break ; + + case MAT5_TYPE_COMP_USHORT : + { unsigned short samplerate ; + + psf_binheader_readf (psf, "j2j", -4, &samplerate, 2) ; + psf_log_printf (psf, " Val : %u\n", samplerate) ; + psf->sf.samplerate = samplerate ; + } + break ; + + case MAT5_TYPE_COMP_UINT : + psf_log_printf (psf, " Val : %u\n", size) ; + psf->sf.samplerate = size ; + break ; + + default : + psf_log_printf (psf, " Type : %X Size : %d ***\n", type, size) ; + return SFE_MAT5_SAMPLE_RATE ; + } ; + + /*-----------------------------------------*/ + + + psf_binheader_readf (psf, "44", &type, &size) ; + psf_log_printf (psf, " Type : %X Size : %d\n", type, size) ; + + if (type != MAT5_TYPE_ARRAY) + return SFE_MAT5_NO_BLOCK ; + + psf_binheader_readf (psf, "44", &type, &size) ; + psf_log_printf (psf, " Type : %X Size : %d\n", type, size) ; + + if (type != MAT5_TYPE_UINT32) + return SFE_MAT5_NO_BLOCK ; + + psf_binheader_readf (psf, "44", &flags1, &flags2) ; + psf_log_printf (psf, " Flg1 : %X Flg2 : %d\n", flags1, flags2) ; + + psf_binheader_readf (psf, "44", &type, &size) ; + psf_log_printf (psf, " Type : %X Size : %d\n", type, size) ; + + if (type != MAT5_TYPE_INT32) + return SFE_MAT5_NO_BLOCK ; + + psf_binheader_readf (psf, "44", &rows, &cols) ; + psf_log_printf (psf, " Rows : %X Cols : %d\n", rows, cols) ; + + psf_binheader_readf (psf, "4", &type) ; + + if (type == MAT5_TYPE_SCHAR) + { psf_binheader_readf (psf, "4", &size) ; + psf_log_printf (psf, " Type : %X Size : %d\n", type, size) ; + if (size > SIGNED_SIZEOF (name) - 1) + { psf_log_printf (psf, "Error : Bad name length.\n") ; + return SFE_MAT5_NO_BLOCK ; + } ; + + psf_binheader_readf (psf, "bj", name, size, (8 - (size % 8)) % 8) ; + name [size] = 0 ; + } + else if ((type & 0xFFFF) == MAT5_TYPE_SCHAR) + { size = type >> 16 ; + if (size > 4) + { psf_log_printf (psf, "Error : Bad name length.\n") ; + return SFE_MAT5_NO_BLOCK ; + } ; + + psf_log_printf (psf, " Type : %X\n", type) ; + psf_binheader_readf (psf, "4", &name) ; + name [size] = 0 ; + } + else + return SFE_MAT5_NO_BLOCK ; + + psf_log_printf (psf, " Name : %s\n", name) ; + + psf_binheader_readf (psf, "44", &type, &size) ; + psf_log_printf (psf, " Type : %X Size : %d\n", type, size) ; + + /*++++++++++++++++++++++++++++++++++++++++++++++++++*/ + + if (rows == 0 && cols == 0) + { psf_log_printf (psf, "*** Error : zero channel count.\n") ; + return SFE_MAT5_ZERO_CHANNELS ; + } ; + + psf->sf.channels = rows ; + psf->sf.frames = cols ; + + psf->sf.format = psf->endian | SF_FORMAT_MAT5 ; + + switch (type) + { case MAT5_TYPE_DOUBLE : + psf_log_printf (psf, "Data type : double\n") ; + psf->sf.format |= SF_FORMAT_DOUBLE ; + psf->bytewidth = 8 ; + break ; + + case MAT5_TYPE_FLOAT : + psf_log_printf (psf, "Data type : float\n") ; + psf->sf.format |= SF_FORMAT_FLOAT ; + psf->bytewidth = 4 ; + break ; + + case MAT5_TYPE_INT32 : + psf_log_printf (psf, "Data type : 32 bit PCM\n") ; + psf->sf.format |= SF_FORMAT_PCM_32 ; + psf->bytewidth = 4 ; + break ; + + case MAT5_TYPE_INT16 : + psf_log_printf (psf, "Data type : 16 bit PCM\n") ; + psf->sf.format |= SF_FORMAT_PCM_16 ; + psf->bytewidth = 2 ; + break ; + + case MAT5_TYPE_UCHAR : + psf_log_printf (psf, "Data type : unsigned 8 bit PCM\n") ; + psf->sf.format |= SF_FORMAT_PCM_U8 ; + psf->bytewidth = 1 ; + break ; + + default : + psf_log_printf (psf, "*** Error : Bad marker %08X\n", type) ; + return SFE_UNIMPLEMENTED ; + } ; + + psf->dataoffset = psf_ftell (psf) ; + psf->datalength = psf->filelength - psf->dataoffset ; + + return 0 ; +} /* mat5_read_header */ + +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: dfdb6742-b2be-4be8-b390-d0c674e8bc8e +*/ diff --git a/Libraries/SndFile/Files/src/ms_adpcm.c b/Libraries/SndFile/Files/src/ms_adpcm.c new file mode 100644 index 000000000..54e2bdddd --- /dev/null +++ b/Libraries/SndFile/Files/src/ms_adpcm.c @@ -0,0 +1,834 @@ +/* +** Copyright (C) 1999-2004 Erik de Castro Lopo +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU Lesser General Public License as published by +** the Free Software Foundation; either version 2.1 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU Lesser General Public License for more details. +** +** You should have received a copy of the GNU Lesser General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include +#include +#include + +#include "sndfile.h" +#include "config.h" +#include "sfendian.h" +#include "float_cast.h" +#include "common.h" +#include "wav_w64.h" + +/* These required here because we write the header in this file. */ + +#define RIFF_MARKER (MAKE_MARKER ('R', 'I', 'F', 'F')) +#define WAVE_MARKER (MAKE_MARKER ('W', 'A', 'V', 'E')) +#define fmt_MARKER (MAKE_MARKER ('f', 'm', 't', ' ')) +#define fact_MARKER (MAKE_MARKER ('f', 'a', 'c', 't')) +#define data_MARKER (MAKE_MARKER ('d', 'a', 't', 'a')) + +#define WAVE_FORMAT_MS_ADPCM 0x0002 + +typedef struct +{ int channels, blocksize, samplesperblock, blocks, dataremaining ; + int blockcount ; + sf_count_t samplecount ; + short *samples ; + unsigned char *block ; +#if HAVE_FLEXIBLE_ARRAY + unsigned short dummydata [] ; /* ISO C99 struct flexible array. */ +#else + unsigned short dummydata [0] ; /* This is a hack an might not work. */ +#endif +} MSADPCM_PRIVATE ; + +/*============================================================================================ +** MS ADPCM static data and functions. +*/ + +static int AdaptationTable [] = +{ 230, 230, 230, 230, 307, 409, 512, 614, + 768, 614, 512, 409, 307, 230, 230, 230 +} ; + +/* TODO : The first 7 coef's are are always hardcode and must + appear in the actual WAVE file. They should be read in + in case a sound program added extras to the list. */ + +static int AdaptCoeff1 [MSADPCM_ADAPT_COEFF_COUNT] = +{ 256, 512, 0, 192, 240, 460, 392 +} ; + +static int AdaptCoeff2 [MSADPCM_ADAPT_COEFF_COUNT] = +{ 0, -256, 0, 64, 0, -208, -232 +} ; + +/*============================================================================================ +** MS ADPCM Block Layout. +** ====================== +** Block is usually 256, 512 or 1024 bytes depending on sample rate. +** For a mono file, the block is laid out as follows: +** byte purpose +** 0 block predictor [0..6] +** 1,2 initial idelta (positive) +** 3,4 sample 1 +** 5,6 sample 0 +** 7..n packed bytecodes +** +** For a stereo file, the block is laid out as follows: +** byte purpose +** 0 block predictor [0..6] for left channel +** 1 block predictor [0..6] for right channel +** 2,3 initial idelta (positive) for left channel +** 4,5 initial idelta (positive) for right channel +** 6,7 sample 1 for left channel +** 8,9 sample 1 for right channel +** 10,11 sample 0 for left channel +** 12,13 sample 0 for right channel +** 14..n packed bytecodes +*/ + +/*============================================================================================ +** Static functions. +*/ + +static int msadpcm_decode_block (SF_PRIVATE *psf, MSADPCM_PRIVATE *pms) ; +static sf_count_t msadpcm_read_block (SF_PRIVATE *psf, MSADPCM_PRIVATE *pms, short *ptr, int len) ; + +static int msadpcm_encode_block (SF_PRIVATE *psf, MSADPCM_PRIVATE *pms) ; +static sf_count_t msadpcm_write_block (SF_PRIVATE *psf, MSADPCM_PRIVATE *pms, short *ptr, int len) ; + +static sf_count_t msadpcm_read_s (SF_PRIVATE *psf, short *ptr, sf_count_t len) ; +static sf_count_t msadpcm_read_i (SF_PRIVATE *psf, int *ptr, sf_count_t len) ; +static sf_count_t msadpcm_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ; +static sf_count_t msadpcm_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ; + +static sf_count_t msadpcm_write_s (SF_PRIVATE *psf, short *ptr, sf_count_t len) ; +static sf_count_t msadpcm_write_i (SF_PRIVATE *psf, int *ptr, sf_count_t len) ; +static sf_count_t msadpcm_write_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ; +static sf_count_t msadpcm_write_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ; + +static sf_count_t msadpcm_seek (SF_PRIVATE *psf, int mode, sf_count_t offset) ; +static int msadpcm_close (SF_PRIVATE *psf) ; + +static void choose_predictor (unsigned int channels, short *data, int *bpred, int *idelta) ; + +/*============================================================================================ +** MS ADPCM Read Functions. +*/ + +int +wav_w64_msadpcm_init (SF_PRIVATE *psf, int blockalign, int samplesperblock) +{ MSADPCM_PRIVATE *pms ; + unsigned int pmssize ; + int count ; + + if (psf->mode == SFM_WRITE) + samplesperblock = 2 + 2 * (blockalign - 7 * psf->sf.channels) / psf->sf.channels ; + + pmssize = sizeof (MSADPCM_PRIVATE) + blockalign + 3 * psf->sf.channels * samplesperblock ; + + if (! (psf->fdata = malloc (pmssize))) + return SFE_MALLOC_FAILED ; + pms = (MSADPCM_PRIVATE*) psf->fdata ; + memset (pms, 0, pmssize) ; + + pms->samples = pms->dummydata ; + pms->block = (unsigned char*) (pms->dummydata + psf->sf.channels * samplesperblock) ; + + pms->channels = psf->sf.channels ; + pms->blocksize = blockalign ; + pms->samplesperblock = samplesperblock ; + + if (psf->mode == SFM_READ) + { pms->dataremaining = psf->datalength ; + + if (psf->datalength % pms->blocksize) + pms->blocks = psf->datalength / pms->blocksize + 1 ; + else + pms->blocks = psf->datalength / pms->blocksize ; + + count = 2 * (pms->blocksize - 6 * pms->channels) / pms->channels ; + if (pms->samplesperblock != count) + psf_log_printf (psf, "*** Warning : samplesperblock shoud be %d.\n", count) ; + + psf->sf.frames = (psf->datalength / pms->blocksize) * pms->samplesperblock ; + + psf_log_printf (psf, " bpred idelta\n") ; + + msadpcm_decode_block (psf, pms) ; + + psf->read_short = msadpcm_read_s ; + psf->read_int = msadpcm_read_i ; + psf->read_float = msadpcm_read_f ; + psf->read_double = msadpcm_read_d ; + } ; + + if (psf->mode == SFM_WRITE) + { pms->samples = pms->dummydata ; + + pms->samplecount = 0 ; + + psf->write_short = msadpcm_write_s ; + psf->write_int = msadpcm_write_i ; + psf->write_float = msadpcm_write_f ; + psf->write_double = msadpcm_write_d ; + } ; + + psf->seek = msadpcm_seek ; + psf->close = msadpcm_close ; + + return 0 ; +} /* wav_w64_msadpcm_init */ + +static int +msadpcm_decode_block (SF_PRIVATE *psf, MSADPCM_PRIVATE *pms) +{ int chan, k, blockindx, sampleindx ; + short bytecode, bpred [2], chan_idelta [2] ; + + int predict ; + int current ; + int idelta ; + + pms->blockcount ++ ; + pms->samplecount = 0 ; + + if (pms->blockcount > pms->blocks) + { memset (pms->samples, 0, pms->samplesperblock * pms->channels) ; + return 1 ; + } ; + + if ((k = psf_fread (pms->block, 1, pms->blocksize, psf)) != pms->blocksize) + psf_log_printf (psf, "*** Warning : short read (%d != %d).\n", k, pms->blocksize) ; + + /* Read and check the block header. */ + + if (pms->channels == 1) + { bpred [0] = pms->block [0] ; + + if (bpred [0] >= 7) + psf_log_printf (psf, "MS ADPCM synchronisation error (%d).\n", bpred [0]) ; + + chan_idelta [0] = pms->block [1] | (pms->block [2] << 8) ; + chan_idelta [1] = 0 ; + + psf_log_printf (psf, "(%d) (%d)\n", bpred [0], chan_idelta [0]) ; + + pms->samples [1] = pms->block [3] | (pms->block [4] << 8) ; + pms->samples [0] = pms->block [5] | (pms->block [6] << 8) ; + blockindx = 7 ; + } + else + { bpred [0] = pms->block [0] ; + bpred [1] = pms->block [1] ; + + if (bpred [0] >= 7 || bpred [1] >= 7) + psf_log_printf (psf, "MS ADPCM synchronisation error (%d %d).\n", bpred [0], bpred [1]) ; + + chan_idelta [0] = pms->block [2] | (pms->block [3] << 8) ; + chan_idelta [1] = pms->block [4] | (pms->block [5] << 8) ; + + psf_log_printf (psf, "(%d, %d) (%d, %d)\n", bpred [0], bpred [1], chan_idelta [0], chan_idelta [1]) ; + + pms->samples [2] = pms->block [6] | (pms->block [7] << 8) ; + pms->samples [3] = pms->block [8] | (pms->block [9] << 8) ; + + pms->samples [0] = pms->block [10] | (pms->block [11] << 8) ; + pms->samples [1] = pms->block [12] | (pms->block [13] << 8) ; + + blockindx = 14 ; + } ; + + /*-------------------------------------------------------- + This was left over from a time when calculations were done + as ints rather than shorts. Keep this around as a reminder + in case I ever find a file which decodes incorrectly. + + if (chan_idelta [0] & 0x8000) + chan_idelta [0] -= 0x10000 ; + if (chan_idelta [1] & 0x8000) + chan_idelta [1] -= 0x10000 ; + --------------------------------------------------------*/ + + /* Pull apart the packed 4 bit samples and store them in their + ** correct sample positions. + */ + + sampleindx = 2 * pms->channels ; + while (blockindx < pms->blocksize) + { bytecode = pms->block [blockindx++] ; + pms->samples [sampleindx++] = (bytecode >> 4) & 0x0F ; + pms->samples [sampleindx++] = bytecode & 0x0F ; + } ; + + /* Decode the encoded 4 bit samples. */ + + for (k = 2 * pms->channels ; k < (pms->samplesperblock * pms->channels) ; k ++) + { chan = (pms->channels > 1) ? (k % 2) : 0 ; + + bytecode = pms->samples [k] & 0xF ; + + /* Compute next Adaptive Scale Factor (ASF) */ + idelta = chan_idelta [chan] ; + chan_idelta [chan] = (AdaptationTable [bytecode] * idelta) >> 8 ; /* => / 256 => FIXED_POINT_ADAPTATION_BASE == 256 */ + if (chan_idelta [chan] < 16) + chan_idelta [chan] = 16 ; + if (bytecode & 0x8) + bytecode -= 0x10 ; + + predict = ((pms->samples [k - pms->channels] * AdaptCoeff1 [bpred [chan]]) + + (pms->samples [k - 2 * pms->channels] * AdaptCoeff2 [bpred [chan]])) >> 8 ; /* => / 256 => FIXED_POINT_COEFF_BASE == 256 */ + current = (bytecode * idelta) + predict ; + + if (current > 32767) + current = 32767 ; + else if (current < -32768) + current = -32768 ; + + pms->samples [k] = current ; + } ; + + return 1 ; +} /* msadpcm_decode_block */ + +static sf_count_t +msadpcm_read_block (SF_PRIVATE *psf, MSADPCM_PRIVATE *pms, short *ptr, int len) +{ int count, total = 0, indx = 0 ; + + while (indx < len) + { if (pms->blockcount >= pms->blocks && pms->samplecount >= pms->samplesperblock) + { memset (&(ptr [indx]), 0, (size_t) ((len - indx) * sizeof (short))) ; + return total ; + } ; + + if (pms->samplecount >= pms->samplesperblock) + msadpcm_decode_block (psf, pms) ; + + count = (pms->samplesperblock - pms->samplecount) * pms->channels ; + count = (len - indx > count) ? count : len - indx ; + + memcpy (&(ptr [indx]), &(pms->samples [pms->samplecount * pms->channels]), count * sizeof (short)) ; + indx += count ; + pms->samplecount += count / pms->channels ; + total = indx ; + } ; + + return total ; +} /* msadpcm_read_block */ + +static sf_count_t +msadpcm_read_s (SF_PRIVATE *psf, short *ptr, sf_count_t len) +{ MSADPCM_PRIVATE *pms ; + int readcount, count ; + sf_count_t total = 0 ; + + if (! psf->fdata) + return 0 ; + pms = (MSADPCM_PRIVATE*) psf->fdata ; + + while (len > 0) + { readcount = (len > 0x10000000) ? 0x10000000 : (int) len ; + + count = msadpcm_read_block (psf, pms, ptr, readcount) ; + + total += count ; + len -= count ; + if (count != readcount) + break ; + } ; + + return total ; +} /* msadpcm_read_s */ + +static sf_count_t +msadpcm_read_i (SF_PRIVATE *psf, int *ptr, sf_count_t len) +{ MSADPCM_PRIVATE *pms ; + short *sptr ; + int k, bufferlen, readcount = 0, count ; + sf_count_t total = 0 ; + + if (! psf->fdata) + return 0 ; + pms = (MSADPCM_PRIVATE*) psf->fdata ; + + sptr = psf->u.sbuf ; + bufferlen = ARRAY_LEN (psf->u.sbuf) ; + while (len > 0) + { readcount = (len >= bufferlen) ? bufferlen : len ; + count = msadpcm_read_block (psf, pms, sptr, readcount) ; + for (k = 0 ; k < readcount ; k++) + ptr [total + k] = sptr [k] << 16 ; + total += count ; + len -= readcount ; + if (count != readcount) + break ; + } ; + return total ; +} /* msadpcm_read_i */ + +static sf_count_t +msadpcm_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) +{ MSADPCM_PRIVATE *pms ; + short *sptr ; + int k, bufferlen, readcount = 0, count ; + sf_count_t total = 0 ; + float normfact ; + + if (! psf->fdata) + return 0 ; + pms = (MSADPCM_PRIVATE*) psf->fdata ; + + normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x8000) : 1.0 ; + sptr = psf->u.sbuf ; + bufferlen = ARRAY_LEN (psf->u.sbuf) ; + while (len > 0) + { readcount = (len >= bufferlen) ? bufferlen : len ; + count = msadpcm_read_block (psf, pms, sptr, readcount) ; + for (k = 0 ; k < readcount ; k++) + ptr [total + k] = normfact * (float) (sptr [k]) ; + total += count ; + len -= readcount ; + if (count != readcount) + break ; + } ; + return total ; +} /* msadpcm_read_f */ + +static sf_count_t +msadpcm_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) +{ MSADPCM_PRIVATE *pms ; + short *sptr ; + int k, bufferlen, readcount = 0, count ; + sf_count_t total = 0 ; + double normfact ; + + normfact = (psf->norm_double == SF_TRUE) ? 1.0 / ((double) 0x8000) : 1.0 ; + + if (! psf->fdata) + return 0 ; + pms = (MSADPCM_PRIVATE*) psf->fdata ; + + sptr = psf->u.sbuf ; + bufferlen = ARRAY_LEN (psf->u.sbuf) ; + while (len > 0) + { readcount = (len >= bufferlen) ? bufferlen : len ; + count = msadpcm_read_block (psf, pms, sptr, readcount) ; + for (k = 0 ; k < readcount ; k++) + ptr [total + k] = normfact * (double) (sptr [k]) ; + total += count ; + len -= readcount ; + if (count != readcount) + break ; + } ; + return total ; +} /* msadpcm_read_d */ + +static sf_count_t +msadpcm_seek (SF_PRIVATE *psf, int mode, sf_count_t offset) +{ MSADPCM_PRIVATE *pms ; + int newblock, newsample ; + + if (! psf->fdata) + return 0 ; + pms = (MSADPCM_PRIVATE*) psf->fdata ; + + if (psf->datalength < 0 || psf->dataoffset < 0) + { psf->error = SFE_BAD_SEEK ; + return ((sf_count_t) -1) ; + } ; + + if (offset == 0) + { psf_fseek (psf, psf->dataoffset, SEEK_SET) ; + pms->blockcount = 0 ; + msadpcm_decode_block (psf, pms) ; + pms->samplecount = 0 ; + return 0 ; + } ; + + if (offset < 0 || offset > pms->blocks * pms->samplesperblock) + { psf->error = SFE_BAD_SEEK ; + return ((sf_count_t) -1) ; + } ; + + newblock = offset / pms->samplesperblock ; + newsample = offset % pms->samplesperblock ; + + if (mode == SFM_READ) + { psf_fseek (psf, psf->dataoffset + newblock * pms->blocksize, SEEK_SET) ; + pms->blockcount = newblock ; + msadpcm_decode_block (psf, pms) ; + pms->samplecount = newsample ; + } + else + { /* What to do about write??? */ + psf->error = SFE_BAD_SEEK ; + return ((sf_count_t) -1) ; + } ; + + return newblock * pms->samplesperblock + newsample ; +} /* msadpcm_seek */ + +/*========================================================================================== +** MS ADPCM Write Functions. +*/ + +void +msadpcm_write_adapt_coeffs (SF_PRIVATE *psf) +{ int k ; + + for (k = 0 ; k < MSADPCM_ADAPT_COEFF_COUNT ; k++) + psf_binheader_writef (psf, "e22", AdaptCoeff1 [k], AdaptCoeff2 [k]) ; +} /* msadpcm_write_adapt_coeffs */ + +/*========================================================================================== +*/ + +static int +msadpcm_encode_block (SF_PRIVATE *psf, MSADPCM_PRIVATE *pms) +{ unsigned int blockindx ; + unsigned char byte ; + int chan, k, predict, bpred [2], idelta [2], errordelta, newsamp ; + + choose_predictor (pms->channels, pms->samples, bpred, idelta) ; + + /* Write the block header. */ + + if (pms->channels == 1) + { pms->block [0] = bpred [0] ; + pms->block [1] = idelta [0] & 0xFF ; + pms->block [2] = idelta [0] >> 8 ; + pms->block [3] = pms->samples [1] & 0xFF ; + pms->block [4] = pms->samples [1] >> 8 ; + pms->block [5] = pms->samples [0] & 0xFF ; + pms->block [6] = pms->samples [0] >> 8 ; + + blockindx = 7 ; + byte = 0 ; + + /* Encode the samples as 4 bit. */ + + for (k = 2 ; k < pms->samplesperblock ; k++) + { predict = (pms->samples [k-1] * AdaptCoeff1 [bpred [0]] + pms->samples [k-2] * AdaptCoeff2 [bpred [0]]) >> 8 ; + errordelta = (pms->samples [k] - predict) / idelta [0] ; + if (errordelta < -8) + errordelta = -8 ; + else if (errordelta > 7) + errordelta = 7 ; + newsamp = predict + (idelta [0] * errordelta) ; + if (newsamp > 32767) + newsamp = 32767 ; + else if (newsamp < -32768) + newsamp = -32768 ; + if (errordelta < 0) + errordelta += 0x10 ; + + byte = (byte << 4) | (errordelta & 0xF) ; + if (k % 2) + { pms->block [blockindx++] = byte ; + byte = 0 ; + } ; + + idelta [0] = (idelta [0] * AdaptationTable [errordelta]) >> 8 ; + if (idelta [0] < 16) + idelta [0] = 16 ; + pms->samples [k] = newsamp ; + } ; + } + else + { /* Stereo file. */ + pms->block [0] = bpred [0] ; + pms->block [1] = bpred [1] ; + + pms->block [2] = idelta [0] & 0xFF ; + pms->block [3] = idelta [0] >> 8 ; + pms->block [4] = idelta [1] & 0xFF ; + pms->block [5] = idelta [1] >> 8 ; + + pms->block [6] = pms->samples [2] & 0xFF ; + pms->block [7] = pms->samples [2] >> 8 ; + pms->block [8] = pms->samples [3] & 0xFF ; + pms->block [9] = pms->samples [3] >> 8 ; + + pms->block [10] = pms->samples [0] & 0xFF ; + pms->block [11] = pms->samples [0] >> 8 ; + pms->block [12] = pms->samples [1] & 0xFF ; + pms->block [13] = pms->samples [1] >> 8 ; + + blockindx = 14 ; + byte = 0 ; + chan = 1 ; + + for (k = 4 ; k < 2 * pms->samplesperblock ; k++) + { chan = k & 1 ; + + predict = (pms->samples [k-2] * AdaptCoeff1 [bpred [chan]] + pms->samples [k-4] * AdaptCoeff2 [bpred [chan]]) >> 8 ; + errordelta = (pms->samples [k] - predict) / idelta [chan] ; + + + if (errordelta < -8) + errordelta = -8 ; + else if (errordelta > 7) + errordelta = 7 ; + newsamp = predict + (idelta [chan] * errordelta) ; + if (newsamp > 32767) + newsamp = 32767 ; + else if (newsamp < -32768) + newsamp = -32768 ; + if (errordelta < 0) + errordelta += 0x10 ; + + byte = (byte << 4) | (errordelta & 0xF) ; + + if (chan) + { pms->block [blockindx++] = byte ; + byte = 0 ; + } ; + + idelta [chan] = (idelta [chan] * AdaptationTable [errordelta]) >> 8 ; + if (idelta [chan] < 16) + idelta [chan] = 16 ; + pms->samples [k] = newsamp ; + } ; + } ; + + /* Write the block to disk. */ + + if ((k = psf_fwrite (pms->block, 1, pms->blocksize, psf)) != pms->blocksize) + psf_log_printf (psf, "*** Warning : short write (%d != %d).\n", k, pms->blocksize) ; + + memset (pms->samples, 0, pms->samplesperblock * sizeof (short)) ; + + pms->blockcount ++ ; + pms->samplecount = 0 ; + + return 1 ; +} /* msadpcm_encode_block */ + +static sf_count_t +msadpcm_write_block (SF_PRIVATE *psf, MSADPCM_PRIVATE *pms, short *ptr, int len) +{ int count, total = 0, indx = 0 ; + + while (indx < len) + { count = (pms->samplesperblock - pms->samplecount) * pms->channels ; + + if (count > len - indx) + count = len - indx ; + + memcpy (&(pms->samples [pms->samplecount * pms->channels]), &(ptr [total]), count * sizeof (short)) ; + indx += count ; + pms->samplecount += count / pms->channels ; + total = indx ; + + if (pms->samplecount >= pms->samplesperblock) + msadpcm_encode_block (psf, pms) ; + } ; + + return total ; +} /* msadpcm_write_block */ + +static sf_count_t +msadpcm_write_s (SF_PRIVATE *psf, short *ptr, sf_count_t len) +{ MSADPCM_PRIVATE *pms ; + int writecount, count ; + sf_count_t total = 0 ; + + if (! psf->fdata) + return 0 ; + pms = (MSADPCM_PRIVATE*) psf->fdata ; + + while (len > 0) + { writecount = (len > 0x10000000) ? 0x10000000 : (int) len ; + + count = msadpcm_write_block (psf, pms, ptr, writecount) ; + + total += count ; + len -= count ; + if (count != writecount) + break ; + } ; + + return total ; +} /* msadpcm_write_s */ + +static sf_count_t +msadpcm_write_i (SF_PRIVATE *psf, int *ptr, sf_count_t len) +{ MSADPCM_PRIVATE *pms ; + short *sptr ; + int k, bufferlen, writecount, count ; + sf_count_t total = 0 ; + + if (! psf->fdata) + return 0 ; + pms = (MSADPCM_PRIVATE*) psf->fdata ; + + sptr = psf->u.sbuf ; + bufferlen = ARRAY_LEN (psf->u.sbuf) ; + while (len > 0) + { writecount = (len >= bufferlen) ? bufferlen : len ; + for (k = 0 ; k < writecount ; k++) + sptr [k] = ptr [total + k] >> 16 ; + count = msadpcm_write_block (psf, pms, sptr, writecount) ; + total += count ; + len -= writecount ; + if (count != writecount) + break ; + } ; + return total ; +} /* msadpcm_write_i */ + +static sf_count_t +msadpcm_write_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) +{ MSADPCM_PRIVATE *pms ; + short *sptr ; + int k, bufferlen, writecount, count ; + sf_count_t total = 0 ; + float normfact ; + + if (! psf->fdata) + return 0 ; + pms = (MSADPCM_PRIVATE*) psf->fdata ; + + normfact = (psf->norm_float == SF_TRUE) ? (1.0 * 0x7FFF) : 1.0 ; + + sptr = psf->u.sbuf ; + bufferlen = ARRAY_LEN (psf->u.sbuf) ; + while (len > 0) + { writecount = (len >= bufferlen) ? bufferlen : len ; + for (k = 0 ; k < writecount ; k++) + sptr [k] = lrintf (normfact * ptr [total + k]) ; + count = msadpcm_write_block (psf, pms, sptr, writecount) ; + total += count ; + len -= writecount ; + if (count != writecount) + break ; + } ; + return total ; +} /* msadpcm_write_f */ + +static sf_count_t +msadpcm_write_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) +{ MSADPCM_PRIVATE *pms ; + short *sptr ; + int k, bufferlen, writecount, count ; + sf_count_t total = 0 ; + double normfact ; + + normfact = (psf->norm_double == SF_TRUE) ? (1.0 * 0x7FFF) : 1.0 ; + + if (! psf->fdata) + return 0 ; + pms = (MSADPCM_PRIVATE*) psf->fdata ; + + sptr = psf->u.sbuf ; + bufferlen = ARRAY_LEN (psf->u.sbuf) ; + while (len > 0) + { writecount = (len >= bufferlen) ? bufferlen : len ; + for (k = 0 ; k < writecount ; k++) + sptr [k] = lrint (normfact * ptr [total + k]) ; + count = msadpcm_write_block (psf, pms, sptr, writecount) ; + total += count ; + len -= writecount ; + if (count != writecount) + break ; + } ; + return total ; +} /* msadpcm_write_d */ + +/*======================================================================================== +*/ + +static int +msadpcm_close (SF_PRIVATE *psf) +{ MSADPCM_PRIVATE *pms ; + + if (! psf->fdata) + return 0 ; + + pms = (MSADPCM_PRIVATE*) psf->fdata ; + + if (psf->mode == SFM_WRITE) + { /* Now we know static int for certain the length of the file we can + ** re-write the header. + */ + + if (pms->samplecount && pms->samplecount < pms->samplesperblock) + msadpcm_encode_block (psf, pms) ; + + if (psf->write_header) + psf->write_header (psf, SF_TRUE) ; + } ; + + return 0 ; +} /* msadpcm_close */ + +/*======================================================================================== +** Static functions. +*/ + +/*---------------------------------------------------------------------------------------- +** Choosing the block predictor. +** Each block requires a predictor and an idelta for each channel. +** The predictor is in the range [0..6] which is an indx into the two AdaptCoeff tables. +** The predictor is chosen by trying all of the possible predictors on a small set of +** samples at the beginning of the block. The predictor with the smallest average +** abs (idelta) is chosen as the best predictor for this block. +** The value of idelta is chosen to to give a 4 bit code value of +/- 4 (approx. half the +** max. code value). If the average abs (idelta) is zero, the sixth predictor is chosen. +** If the value of idelta is less then 16 it is set to 16. +** +** Microsoft uses an IDELTA_COUNT (number of sample pairs used to choose best predictor) +** value of 3. The best possible results would be obtained by using all the samples to +** choose the predictor. +*/ + +#define IDELTA_COUNT 3 + +static void +choose_predictor (unsigned int channels, short *data, int *block_pred, int *idelta) +{ unsigned int chan, k, bpred, idelta_sum, best_bpred, best_idelta ; + + for (chan = 0 ; chan < channels ; chan++) + { best_bpred = best_idelta = 0 ; + + for (bpred = 0 ; bpred < 7 ; bpred++) + { idelta_sum = 0 ; + for (k = 2 ; k < 2 + IDELTA_COUNT ; k++) + idelta_sum += abs (data [k * channels] - ((data [(k - 1) * channels] * AdaptCoeff1 [bpred] + data [(k - 2) * channels] * AdaptCoeff2 [bpred]) >> 8)) ; + idelta_sum /= (4 * IDELTA_COUNT) ; + + if (bpred == 0 || idelta_sum < best_idelta) + { best_bpred = bpred ; + best_idelta = idelta_sum ; + } ; + + if (! idelta_sum) + { best_bpred = bpred ; + best_idelta = 16 ; + break ; + } ; + + } ; /* for bpred ... */ + if (best_idelta < 16) + best_idelta = 16 ; + + block_pred [chan] = best_bpred ; + idelta [chan] = best_idelta ; + } ; + + return ; +} /* choose_predictor */ +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: a98908a3-5305-4935-872b-77d6a86c330f +*/ diff --git a/Libraries/SndFile/Files/src/nist.c b/Libraries/SndFile/Files/src/nist.c new file mode 100644 index 000000000..ca5b56daf --- /dev/null +++ b/Libraries/SndFile/Files/src/nist.c @@ -0,0 +1,354 @@ +/* +** Copyright (C) 1999-2004 Erik de Castro Lopo +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU Lesser General Public License as published by +** the Free Software Foundation; either version 2.1 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU Lesser General Public License for more details. +** +** You should have received a copy of the GNU Lesser General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +/* +** Some of the information used to read NIST files was gleaned from +** reading the code of Bill Schottstaedt's sndlib library +** ftp://ccrma-ftp.stanford.edu/pub/Lisp/sndlib.tar.gz +** However, no code from that package was used. +*/ + +#include +#include +#include +#include + +#include "sndfile.h" +#include "config.h" +#include "sfendian.h" +#include "common.h" + +/*------------------------------------------------------------------------------ +*/ + +#define NIST_HEADER_LENGTH 1024 + +/*------------------------------------------------------------------------------ +** Private static functions. +*/ + +static int nist_close (SF_PRIVATE *psf) ; +static int nist_write_header (SF_PRIVATE *psf, int calc_length) ; +static int nist_read_header (SF_PRIVATE *psf) ; + +/*------------------------------------------------------------------------------ +*/ + +int +nist_open (SF_PRIVATE *psf) +{ int subformat, error ; + + if (psf->mode == SFM_READ || (psf->mode == SFM_RDWR && psf->filelength > 0)) + { if ((error = nist_read_header (psf))) + return error ; + } ; + + subformat = psf->sf.format & SF_FORMAT_SUBMASK ; + + if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR) + { if (psf->is_pipe) + return SFE_NO_PIPE_WRITE ; + + if ((psf->sf.format & SF_FORMAT_TYPEMASK) != SF_FORMAT_NIST) + return SFE_BAD_OPEN_FORMAT ; + + psf->endian = psf->sf.format & SF_FORMAT_ENDMASK ; + if (psf->endian == 0 || psf->endian == SF_ENDIAN_CPU) + psf->endian = (CPU_IS_BIG_ENDIAN) ? SF_ENDIAN_BIG : SF_ENDIAN_LITTLE ; + + psf->blockwidth = psf->bytewidth * psf->sf.channels ; + + if ((error = nist_write_header (psf, SF_FALSE))) + return error ; + + psf->write_header = nist_write_header ; + } ; + + psf->close = nist_close ; + + switch (psf->sf.format & SF_FORMAT_SUBMASK) + { case SF_FORMAT_PCM_S8 : + error = pcm_init (psf) ; + break ; + + case SF_FORMAT_PCM_16 : + case SF_FORMAT_PCM_24 : + case SF_FORMAT_PCM_32 : + error = pcm_init (psf) ; + break ; + + case SF_FORMAT_ULAW : + error = ulaw_init (psf) ; + break ; + + case SF_FORMAT_ALAW : + error = alaw_init (psf) ; + break ; + + default : error = SFE_UNIMPLEMENTED ; + break ; + } ; + + return error ; +} /* nist_open */ + +/*------------------------------------------------------------------------------ +*/ + +static char bad_header [] = +{ 'N', 'I', 'S', 'T', '_', '1', 'A', 0x0d, 0x0a, + ' ', ' ', ' ', '1', '0', '2', '4', 0x0d, 0x0a, + 0 +} ; + + static int +nist_read_header (SF_PRIVATE *psf) +{ char *psf_header ; + int bitwidth = 0, bytes = 0, count, encoding ; + char str [64], *cptr ; + long samples ; + + psf->sf.format = SF_FORMAT_NIST ; + + psf_header = psf->u.cbuf ; + + if (sizeof (psf->header) <= NIST_HEADER_LENGTH) + return SFE_INTERNAL ; + + /* Go to start of file and read in the whole header. */ + psf_binheader_readf (psf, "pb", 0, psf_header, NIST_HEADER_LENGTH) ; + + /* Header is a string, so make sure it is null terminated. */ + psf_header [NIST_HEADER_LENGTH] = 0 ; + + /* Now trim the header after the end marker. */ + if ((cptr = strstr (psf_header, "end_head"))) + { cptr += strlen ("end_head") + 1 ; + cptr [0] = 0 ; + } ; + + if (strstr (psf_header, bad_header) == psf_header) + return SFE_NIST_CRLF_CONVERISON ; + + /* Make sure its a NIST file. */ + if (strstr (psf_header, "NIST_1A\n 1024\n") != psf_header) + { psf_log_printf (psf, "Not a NIST file.\n") ; + return SFE_NIST_BAD_HEADER ; + } ; + + /* Determine sample encoding, start by assuming PCM. */ + encoding = SF_FORMAT_PCM_U8 ; + if ((cptr = strstr (psf_header, "sample_coding -s"))) + { sscanf (cptr, "sample_coding -s%d %63s", &count, str) ; + + if (strcmp (str, "pcm") == 0) + encoding = SF_FORMAT_PCM_U8 ; + else if (strcmp (str, "alaw") == 0) + encoding = SF_FORMAT_ALAW ; + else if ((strcmp (str, "ulaw") == 0) || (strcmp (str, "mu-law") == 0)) + encoding = SF_FORMAT_ULAW ; + else + { psf_log_printf (psf, "*** Unknown encoding : %s\n", str) ; + encoding = 0 ; + } ; + } ; + + if ((cptr = strstr (psf_header, "channel_count -i "))) + sscanf (cptr, "channel_count -i %d", &(psf->sf.channels)) ; + + if ((cptr = strstr (psf_header, "sample_rate -i "))) + sscanf (cptr, "sample_rate -i %d", &(psf->sf.samplerate)) ; + + if ((cptr = strstr (psf_header, "sample_count -i "))) + { sscanf (psf_header, "sample_count -i %ld", &samples) ; + psf->sf.frames = samples ; + } ; + + if ((cptr = strstr (psf_header, "sample_n_bytes -i "))) + sscanf (cptr, "sample_n_bytes -i %d", &(psf->bytewidth)) ; + + /* Default endian-ness (for 8 bit, u-law, A-law. */ + psf->endian = (CPU_IS_BIG_ENDIAN) ? SF_ENDIAN_BIG : SF_ENDIAN_LITTLE ; + + /* This is where we figure out endian-ness. */ + if ((cptr = strstr (psf_header, "sample_byte_format -s"))) + { sscanf (cptr, "sample_byte_format -s%d %8s", &bytes, str) ; + if (bytes > 1) + { if (psf->bytewidth == 0) + psf->bytewidth = bytes ; + else if (psf->bytewidth != bytes) + { psf_log_printf (psf, "psf->bytewidth (%d) != bytes (%d)\n", psf->bytewidth, bytes) ; + return SFE_NIST_BAD_ENCODING ; + } ; + + if (strstr (str, "01") == str) + psf->endian = SF_ENDIAN_LITTLE ; + else if (strstr (str, "10")) + psf->endian = SF_ENDIAN_BIG ; + else + { psf_log_printf (psf, "Weird endian-ness : %s\n", str) ; + return SFE_NIST_BAD_ENCODING ; + } ; + } ; + + psf->sf.format |= psf->endian ; + } ; + + if ((cptr = strstr (psf_header, "sample_sig_bits -i "))) + sscanf (cptr, "sample_sig_bits -i %d", &bitwidth) ; + + if (strstr (psf_header, "channels_interleaved -s5 FALSE")) + { psf_log_printf (psf, "Non-interleaved data unsupported.\n", str) ; + return SFE_NIST_BAD_ENCODING ; + } ; + + psf->dataoffset = NIST_HEADER_LENGTH ; + psf->blockwidth = psf->sf.channels * psf->bytewidth ; + psf->datalength = psf->filelength - psf->dataoffset ; + + psf->close = nist_close ; + + psf_fseek (psf, psf->dataoffset, SEEK_SET) ; + + if (encoding == SF_FORMAT_PCM_U8) + { switch (psf->bytewidth) + { case 1 : + psf->sf.format |= SF_FORMAT_PCM_S8 ; + break ; + + case 2 : + psf->sf.format |= SF_FORMAT_PCM_16 ; + break ; + + case 3 : + psf->sf.format |= SF_FORMAT_PCM_24 ; + break ; + + case 4 : + psf->sf.format |= SF_FORMAT_PCM_32 ; + break ; + + default : break ; + } ; + } + else if (encoding != 0) + psf->sf.format |= encoding ; + else + return SFE_UNIMPLEMENTED ; + + return 0 ; +} /* nist_read_header */ + +static int +nist_close (SF_PRIVATE *psf) +{ + if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR) + nist_write_header (psf, SF_TRUE) ; + + return 0 ; +} /* nist_close */ + +/*========================================================================= +*/ + +static int +nist_write_header (SF_PRIVATE *psf, int calc_length) +{ const char *end_str ; + long samples ; + sf_count_t current ; + + current = psf_ftell (psf) ; + + /* Prevent compiler warning. */ + calc_length = calc_length ; + + if (psf->endian == SF_ENDIAN_BIG) + end_str = "10" ; + else if (psf->endian == SF_ENDIAN_LITTLE) + end_str = "01" ; + else + end_str = "error" ; + + /* Clear the whole header. */ + memset (psf->header, 0, sizeof (psf->header)) ; + psf->headindex = 0 ; + + psf_fseek (psf, 0, SEEK_SET) ; + + psf_asciiheader_printf (psf, "NIST_1A\n 1024\n") ; + psf_asciiheader_printf (psf, "channel_count -i %d\n", psf->sf.channels) ; + psf_asciiheader_printf (psf, "sample_rate -i %d\n", psf->sf.samplerate) ; + + switch (psf->sf.format & SF_FORMAT_SUBMASK) + { case SF_FORMAT_PCM_S8 : + psf_asciiheader_printf (psf, "sample_coding -s3 pcm\n") ; + psf_asciiheader_printf (psf, "sample_n_bytes -i 1\n" + "sample_sig_bits -i 8\n") ; + break ; + + case SF_FORMAT_PCM_16 : + case SF_FORMAT_PCM_24 : + case SF_FORMAT_PCM_32 : + psf_asciiheader_printf (psf, "sample_n_bytes -i %d\n", psf->bytewidth) ; + psf_asciiheader_printf (psf, "sample_sig_bits -i %d\n", psf->bytewidth * 8) ; + psf_asciiheader_printf (psf, "sample_coding -s3 pcm\n" + "sample_byte_format -s%d %s\n", psf->bytewidth, end_str) ; + break ; + + case SF_FORMAT_ALAW : + psf_asciiheader_printf (psf, "sample_coding -s4 alaw\n") ; + psf_asciiheader_printf (psf, "sample_n_bytes -s1 1\n") ; + break ; + + case SF_FORMAT_ULAW : + psf_asciiheader_printf (psf, "sample_coding -s4 ulaw\n") ; + psf_asciiheader_printf (psf, "sample_n_bytes -s1 1\n") ; + break ; + + default : return SFE_UNIMPLEMENTED ; + } ; + + psf->dataoffset = NIST_HEADER_LENGTH ; + + /* Fix this */ + samples = psf->sf.frames ; + psf_asciiheader_printf (psf, "sample_count -i %ld\n", samples) ; + psf_asciiheader_printf (psf, "end_head\n") ; + + /* Zero fill to dataoffset. */ + psf_binheader_writef (psf, "z", (size_t) (NIST_HEADER_LENGTH - psf->headindex)) ; + + psf_fwrite (psf->header, psf->headindex, 1, psf) ; + + if (psf->error) + return psf->error ; + + if (current > 0) + psf_fseek (psf, current, SEEK_SET) ; + + return psf->error ; +} /* nist_write_header */ + + +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: b45ed85d-9e22-4ad9-b78c-4b58b67152a8 +*/ diff --git a/Libraries/SndFile/Files/src/ogg.c b/Libraries/SndFile/Files/src/ogg.c new file mode 100644 index 000000000..279f4cd94 --- /dev/null +++ b/Libraries/SndFile/Files/src/ogg.c @@ -0,0 +1,898 @@ +/* +** Copyright (C) 2002-2004 Erik de Castro Lopo +** +** This program is free software ; you can redistribute it and/or modify +** it under the terms of the GNU Lesser General Public License as published by +** the Free Software Foundation ; either version 2.1 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY ; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU Lesser General Public License for more details. +** +** You should have received a copy of the GNU Lesser General Public License +** along with this program ; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include +#include +#include +#include + +#include "sndfile.h" +#include "config.h" +#include "sfendian.h" +#include "common.h" + +#if (ENABLE_EXPERIMENTAL_CODE == 0) + +int +ogg_open (SF_PRIVATE *psf) +{ if (psf) + return SFE_UNIMPLEMENTED ; + return (psf && 0) ; +} /* ogg_open */ + +#else + +#define SFE_OGG_NOT_OGG 666 + +/*------------------------------------------------------------------------------ +** Macros to handle big/little endian issues. +*/ + +#define ALAW_MARKER MAKE_MARKER ('A', 'L', 'a', 'w') +#define SOUN_MARKER MAKE_MARKER ('S', 'o', 'u', 'n') +#define DFIL_MARKER MAKE_MARKER ('d', 'F', 'i', 'l') + +/*------------------------------------------------------------------------------ +** Private static functions. +*/ + +static int ogg_read_header (SF_PRIVATE *psf) ; + +/*------------------------------------------------------------------------------ +** Public function. +*/ + +int +ogg_open (SF_PRIVATE *psf) +{ OGG_PRIVATE *pogg ; + int subformat, error = 0 ; + + if (psf->mode == SFM_RDWR) + return SFE_UNIMPLEMENTED ; + + psf->sf.sections = 1 ; + + psf->datalength = psf->filelength ; + psf->dataoffset = 0 ; + psf->blockwidth = 0 ; + psf->bytewidth = 1 ; + + if (! (pogg = calloc (1, sizeof (OGG_PRIVATE)))) + return SFE_MALLOC_FAILED ; + psf->fdata = pogg ; + + if (psf->mode == SFM_READ) + { if ((error = pogg_read_header (psf))) + return error ; + } ; + + if (psf->mode == SFM_WRITE) + { psf->str_flags = SF_STR_ALLOW_START ; + + if ((error = pogg_write_header (psf))) + return error ; + } ; + + if ((psf->sf.format & SF_FORMAT_TYPEMASK) == 0) + return SFE_BAD_OPEN_FORMAT ; + + subformat = psf->sf.format & SF_FORMAT_SUBMASK ; + if (subformat == 0) + return SFE_BAD_OPEN_FORMAT ; + + return pogg_init (psf) ; +} /* ogg_open */ + +/*------------------------------------------------------------------------------ +** Private functions +*/ + +static int +pogg_init (SF_PRIVATE * psf) +{ + psf->close = pogg_close ; + + if (psf->mode == SFM_READ) + { /* set the virtual functions for reading */ + psf->read_short = pogg_read_s ; + psf->read_int = pogg_read_i ; + psf->read_float = pogg_read_f ; + psf->read_double = pogg_read_d ; + + /* set the virtual function for seeking */ + psf->seek = pogg_seek ; + } ; + + if (psf->mode == SFM_WRITE) + { /* set the virtual functions for writing */ + psf->write_short = pogg_write_s ; + psf->write_int = pogg_write_i ; + psf->write_float = pogg_write_f ; + psf->write_double = pogg_write_d ; + } ; + + return 0 ; +} /* pogg_init */ + +static int +pogg_close (SF_PRIVATE * psf) +{ OGG_PRIVATE * pogg = (OGG_PRIVATE *) psf->fdata ; + long n ; + + if (psf->mode == SFM_READ) + { if (pogg->cache_pcm != NULL) + free (pogg->cache_pcm) ; + /* MUST NOT free pogg->ptr, it is a pointer into the user's buffers */ + } ; + + if (psf->mode == SFM_WRITE) + { fish_sound_flush (pogg->fsound) ; + while ((n = oggz_write (pogg->oggz, 1024)) > 0) ; + } ; + + if (pogg->oggz) + oggz_close (pogg->oggz) ; + if (pogg->fsound) + fish_sound_delete (pogg->fsound) ; + + return 0 ; +} /* pogg_close */ + + +/*------------------------------------------------------------------------------ +** OggzIO methods +*/ + +static size_t +pogg_io_read (void * user_handle, void * buf, size_t n) +{ SF_PRIVATE * psf = (SF_PRIVATE *) user_handle ; + + return (size_t) psf_fread (buf, 1, n, psf) ; +} /* pogg_io_read */ + +static int +pogg_io_seek (void * user_handle, long offset, int whence) +{ SF_PRIVATE * psf = (SF_PRIVATE *) user_handle ; + + return (size_t) psf_fseek (psf, offset, whence) ; +} /* pogg_io_seek */ + +static long +pogg_io_tell (void * user_handle) +{ SF_PRIVATE * psf = (SF_PRIVATE *) user_handle ; + + return (size_t) psf_ftell (psf) ; +} /* pogg_io_tell */ + +static size_t +pogg_io_write (void * user_handle, void * buf, size_t n) +{ SF_PRIVATE * psf = (SF_PRIVATE *) user_handle ; + + return (size_t) psf_fwrite (buf, 1, n, psf) ; +} /* pogg_io_write */ + +/*------------------------------------------------------------------------------ +** Read last packet -- set the number of frames to be the last recorded +** granulepos. +*/ + +static int +pogg_read_last_packet (OGGZ * oggz, ogg_packet * op, long serialno, void * data) +{ SF_PRIVATE * psf = (SF_PRIVATE *) data ; + + /* Avoid compiler warning. */ + oggz = NULL ; + serialno = 0 ; + + if (op->granulepos == -1) + return OGGZ_CONTINUE ; + + psf->sf.frames = op->granulepos ; + + return OGGZ_STOP_OK ; +} /* pogg_read_least_packet */ + +/*------------------------------------------------------------------------------ +** Decode header -- by the time FishSound calls this, all header codebooks etc. +** have been parsed and the Oggz is ready for seeking. +*/ + +static int +pogg_decode_header (FishSound * fsound, float ** pcm, long frames, void * user_data) +{ SF_PRIVATE * psf = (SF_PRIVATE *) user_data ; + FishSoundInfo fsinfo ; + const FishSoundComment * comment ; + + /* Avoid compiler warnings. */ + pcm = NULL ; + frames = 0 ; + + fish_sound_command (fsound, FISH_SOUND_GET_INFO, &fsinfo, sizeof (FishSoundInfo)) ; + + switch (fsinfo.format) + { case FISH_SOUND_VORBIS : + psf_log_printf (psf, "Vorbis\n") ; + psf->sf.format |= SF_FORMAT_VORBIS ; + break ; + case FISH_SOUND_SPEEX : + psf_log_printf (psf, "Speex\n") ; + psf->sf.format |= SF_FORMAT_SPEEX ; + break ; + default : + psf_log_printf (psf, "Unknown Ogg codec\n") ; + break ; + } ; + + psf->sf.samplerate = fsinfo.samplerate ; + psf->sf.channels = fsinfo.channels ; + + /* Get comments */ + for (comment = fish_sound_comment_first (fsound) ; comment ; + comment = fish_sound_comment_next (fsound, comment)) + { psf_log_printf (psf, "%s : %s\n", comment->name, comment->value) ; + + if (strcasecmp (comment->name, "TITLE") == 0) + psf_store_string (psf, SF_STR_TITLE, comment->value) ; + else if (strcasecmp (comment->name, "COPYRIGHT") == 0) + psf_store_string (psf, SF_STR_COPYRIGHT, comment->value) ; + else if (strcasecmp (comment->name, "ENCODER") == 0) + psf_store_string (psf, SF_STR_SOFTWARE, comment->value) ; + else if (strcasecmp (comment->name, "ARTIST") == 0) + psf_store_string (psf, SF_STR_ARTIST, comment->value) ; + else if (strcasecmp (comment->name, "DATE") == 0) + psf_store_string (psf, SF_STR_DATE, comment->value) ; + else if (strcasecmp (comment->name, "author") == 0) + { /* speexenc provides this */ + psf_store_string (psf, SF_STR_ARTIST, comment->value) ; + } ; + } ; + + puts (psf->logbuffer) ; + + return 1 ; +} /* pogg_decode_header */ + +static int +pogg_read_header_packet (OGGZ * oggz, ogg_packet * op, long serialno, void * data) +{ SF_PRIVATE * psf = (SF_PRIVATE *) data ; + OGG_PRIVATE * pogg = (OGG_PRIVATE *) psf->fdata ; + int format ; + + /* Avoid compiler warning. */ + oggz = NULL ; + + if (pogg->serialno == -1) + psf_log_printf (psf, "Read Ogg packet header : [%s]\n", op->packet) ; + + if (pogg->serialno == -1 && op->bytes >= 8) + { format = fish_sound_identify (op->packet, 8) ; + if (format == FISH_SOUND_VORBIS || format == FISH_SOUND_SPEEX) + { /* + ** Detect this is (probably) the audio stream. Don't set the subformat + ** yet, do that in the decoded callback, once FishSound has had a proper + ** look at all the headers and codebooks etc. and the file is ready for + ** decoding and seeking. We use the value of (psf->sf.format & _SUBMASK) + ** below to determine whether the headers have all been read or not. + */ + pogg->serialno = serialno ; + } + else if (strncmp (op->packet, "Annodex", 8) == 0) + { /* The overall stream encpasulation is Annodex */ + psf->sf.format = SF_FORMAT_ANX ; + } ; + } ; + + if (serialno == pogg->serialno) + fish_sound_decode (pogg->fsound, op->packet, op->bytes) ; + + if ((psf->sf.format & SF_FORMAT_SUBMASK) == 0) + return OGGZ_CONTINUE ; + + return OGGZ_STOP_OK ; +} /* pogg_read_header_packet */ + +static int +pogg_read_header (SF_PRIVATE *psf) +{ OGG_PRIVATE * pogg = (OGG_PRIVATE *) psf->fdata ; + unsigned char buf [1024] ; + + OGGZ * oggz ; + FishSound * fsound ; + FishSoundInfo fsinfo ; + int nread = 1024 ; + + psf->sf.format = SF_FORMAT_OGG ; + psf->sf.frames = 0 ; + + oggz = oggz_new (OGGZ_READ|OGGZ_AUTO) ; + + oggz_io_set_read (oggz, pogg_io_read, psf) ; + oggz_io_set_seek (oggz, pogg_io_seek, psf) ; + oggz_io_set_tell (oggz, pogg_io_tell, psf) ; + + fsound = fish_sound_new (FISH_SOUND_DECODE, &fsinfo) ; + fish_sound_set_interleave (fsound, 1) ; + fish_sound_set_decoded_callback (fsound, pogg_decode_header, psf) ; + + pogg->oggz = oggz ; + pogg->fsound = fsound ; + pogg->serialno = -1 ; + pogg->cache_pcm = NULL ; + pogg->cache_size = 0 ; + pogg->cache_granulepos = 0 ; /* We set this to a known value of zero to begin */ + pogg->cache_frames = 0 ; + pogg->cache_remaining = 0 ; + pogg->ptr = NULL ; + pogg->pcmtype = POGG_PCM_SHORT ; + pogg->remaining = 0 ; + pogg->seek_from_start = 0 ; + + /* Set position to start of file to begin reading header. */ + psf_binheader_readf (psf, "p", 0) ; + + /* Get the header info */ + oggz_set_read_callback (oggz, -1, pogg_read_header_packet, psf) ; + while (nread > 0 && ((psf->sf.format & SF_FORMAT_SUBMASK) == 0)) + { nread = psf_binheader_readf (psf, "b", buf, sizeof (buf)) ; + oggz_read_input (oggz, buf, nread) ; + } ; + + /* Get the duration */ + oggz_set_read_callback (oggz, -1, NULL, NULL) ; + oggz_set_read_callback (oggz, pogg->serialno, pogg_read_last_packet, psf) ; + oggz_seek_units (oggz, 0, SEEK_END) ; + nread = 1024 ; + while (nread > 0) + nread = oggz_read (oggz, 1024) ; + + /* reset to the beginning of the audio data */ + oggz_seek_units (oggz, 0, SEEK_SET) ; + + psf->dataoffset = oggz_tell (oggz) ; + psf->datalength = psf->filelength - psf->dataoffset ; + + /* set the Oggz and FishSound up for decoding */ + oggz_set_read_callback (oggz, -1, NULL, NULL) ; + oggz_set_read_callback (oggz, pogg->serialno, pogg_read_packet, psf) ; + fish_sound_set_decoded_callback (fsound, pogg_decode, psf) ; + + return 0 ; +} /* pogg_read_header */ + +/*------------------------------------------------------------------------------ +** Decode functions +*/ + +static int +pogg_copyout (SF_PRIVATE * psf) +{ OGG_PRIVATE * pogg = (OGG_PRIVATE *) psf->fdata ; + size_t frame_size, bytes, cache_offset ; + long cache_usable, i ; + unsigned char * src ; + + if (pogg->seek_from_start > 0) + { /* If we've seeked and don't know where we are, don't do anything yet */ + if (pogg->cache_granulepos == -1) + return -1 ; + + /* If we've seeked and are before the seek point, don't do anything yet */ + else if (pogg->cache_granulepos < pogg->seek_from_start) + return -1 ; + + /* If this block contains the seek point, adjust the cache offset accordingly */ + else if (pogg->cache_granulepos - pogg->cache_frames <= pogg->seek_from_start) + { pogg->cache_remaining = pogg->cache_granulepos - pogg->seek_from_start ; + pogg->seek_from_start = 0 ; /* bingo */ + } ; + } ; + + frame_size = psf->sf.channels * sizeof (float) ; + cache_usable = SF_MIN (pogg->remaining, pogg->cache_remaining) ; + + if (cache_usable <= 0) + return 0 ; + + bytes = cache_usable * frame_size ; + cache_offset = (pogg->cache_frames - pogg->cache_remaining) * frame_size ; + src = (unsigned char *) pogg->cache_pcm + cache_offset ; + + switch (pogg->pcmtype) + { case POGG_PCM_SHORT : + for (i = 0 ; i < cache_usable ; i++) + ((short *) pogg->ptr) [i] = (short) (((float *) src) [i] * SHRT_MAX) ; + break ; + + case POGG_PCM_INT : + for (i = 0 ; i < cache_usable ; i++) + ((double *) pogg->ptr) [i] = (double) (((float *) src) [i] * INT_MAX) ; + break ; + + case POGG_PCM_FLOAT : + memcpy (pogg->ptr, src, bytes) ; + break ; + + case POGG_PCM_DOUBLE : + for (i = 0 ; i < cache_usable ; i++) + ((double *) pogg->ptr) [i] = (double) ((float *) src) [i] ; + break ; + } ; + + pogg->ptr += bytes ; + pogg->cache_remaining -= cache_usable ; + pogg->remaining -= cache_usable ; + + return 0 ; +} /* pogg_copyout*/ + +static int +pogg_decode (FishSound * fsound, float ** pcm, long frames, void * user_data) +{ SF_PRIVATE * psf = (SF_PRIVATE *) user_data ; + OGG_PRIVATE * pogg = (OGG_PRIVATE *) psf->fdata ; + size_t bytes ; + float ** new_block ; + + /* Avoid compiler warning. */ + fsound = NULL ; + + bytes = sizeof (float) * psf->sf.channels * frames ; + + if (bytes > pogg->cache_size) + { new_block = realloc (pogg->cache_pcm, bytes) ; + if (new_block == NULL) + /* XXX : SFE_MALLOC_FAILED */ + return -1 ; + + pogg->cache_pcm = new_block ; + pogg->cache_size = bytes ; + } ; + + memcpy (pogg->cache_pcm, pcm, bytes) ; + pogg->cache_frames = frames ; + pogg->cache_remaining = frames ; + + if (pogg->cache_granulepos != -1) + pogg->cache_granulepos += frames ; + + pogg_copyout (psf) ; + + return 0 ; +} /* pogg_decode */ + +static int +pogg_read_packet (OGGZ * oggz, ogg_packet * op, long serialno, void * data) +{ SF_PRIVATE * psf = (SF_PRIVATE *) data ; + OGG_PRIVATE * pogg = (OGG_PRIVATE *) psf->fdata ; + FishSound * fsound = pogg->fsound ; + + /* Avoid warning message. */ + oggz = NULL ; + serialno = 0 ; + + fish_sound_decode (fsound, op->packet, op->bytes) ; + + if (op->granulepos != -1) + pogg->cache_granulepos = op->granulepos ; + + if (pogg->remaining == 0) + return OGGZ_STOP_OK ; + + return OGGZ_CONTINUE ; +} /* pogg_read_packet */ + +static sf_count_t +pogg_read_loop (SF_PRIVATE *psf, sf_count_t len) +{ OGG_PRIVATE * pogg = (OGG_PRIVATE *) psf->fdata ; + long nread = 1024 ; + sf_count_t ret = len ; + + /** Calculate nr. frames remaining */ + pogg->remaining = len / psf->sf.channels ; + + /** Serve out any remaining cached data first */ + pogg_copyout (psf) ; + + while (nread > 0 && pogg->remaining > 0) + nread = oggz_read (pogg->oggz, 1024) ; + + if (nread == 0) + ret -= pogg->remaining * psf->sf.channels ; + + return ret ; +} /* pogg_read_loop */ + +static sf_count_t +pogg_read_s (SF_PRIVATE *psf, short *ptr, sf_count_t len) +{ OGG_PRIVATE * pogg = (OGG_PRIVATE *) psf->fdata ; + + pogg->ptr = ptr ; + pogg->pcmtype = POGG_PCM_SHORT ; + + return pogg_read_loop (psf, len) ; +} /* pogg_read_s */ + +static sf_count_t +pogg_read_i (SF_PRIVATE *psf, int *ptr, sf_count_t len) +{ OGG_PRIVATE * pogg = (OGG_PRIVATE *) psf->fdata ; + + pogg->ptr = ptr ; + pogg->pcmtype = POGG_PCM_INT ; + + return pogg_read_loop (psf, len) ; +} /* pogg_read_i */ + +static sf_count_t +pogg_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) +{ OGG_PRIVATE * pogg = (OGG_PRIVATE *) psf->fdata ; + + pogg->ptr = ptr ; + pogg->pcmtype = POGG_PCM_FLOAT ; + + return pogg_read_loop (psf, len) ; +} /* pogg_read_f */ + +static sf_count_t +pogg_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) +{ OGG_PRIVATE * pogg = (OGG_PRIVATE *) psf->fdata ; + + pogg->ptr = ptr ; + pogg->pcmtype = POGG_PCM_DOUBLE ; + + return pogg_read_loop (psf, len) ; +} /* pogg_read_d */ + +/*------------------------------------------------------------------------------ +** Seek functions +*/ + +static sf_count_t +pogg_seek (SF_PRIVATE *psf, int mode, sf_count_t seek_from_start) +{ OGG_PRIVATE * pogg = (OGG_PRIVATE *) psf->fdata ; + ogg_int64_t units = seek_from_start * 1000 / psf->sf.samplerate ; + + if (mode != SFM_READ) + { psf->error = SFE_BAD_SEEK ; + return SF_SEEK_ERROR ; + } ; + + oggz_seek_units (pogg->oggz, units, SEEK_SET) ; + + /* Invalidate cache and set the desired seek position */ + pogg->cache_remaining = 0 ; + pogg->cache_granulepos = -1 ; + pogg->seek_from_start = seek_from_start ; + + return seek_from_start ; +} /* pogg_seek */ + +/*------------------------------------------------------------------------------ +** Write functions +*/ + +static int +pogg_encoded (FishSound * fsound, unsigned char * buf, long bytes, void * user_data) +{ SF_PRIVATE * psf = (SF_PRIVATE *) user_data ; + OGG_PRIVATE * pogg = (OGG_PRIVATE *) psf->fdata ; + ogg_packet op ; + int err ; + + op.packet = buf ; + op.bytes = bytes ; + op.b_o_s = pogg->b_o_s ; + op.e_o_s = 0 ; + op.granulepos = fish_sound_get_frameno (fsound) ; + op.packetno = -1 ; + + err = oggz_write_feed (pogg->oggz, &op, pogg->serialno, 0, NULL) ; + + pogg->b_o_s = 0 ; + + return OGGZ_CONTINUE ; +} /* pogg_encoded */ + +static int +pogg_write_anx_headers (SF_PRIVATE *psf, int format) +{ OGG_PRIVATE * pogg = (OGG_PRIVATE *) psf->fdata ; + unsigned char buf [128] ; + long anx_serialno ; + int headers_len = 0 ; + const char * content_type ; + ogg_packet op ; + int err ; + + anx_serialno = oggz_serialno_new (pogg->oggz) ; + + /* Write Annodex header */ + memset (buf, 0, 48) ; + snprintf (buf, 8, "Annodex") ; + + /* Version */ + *(ogg_int16_t *) &buf [8] = (ogg_int16_t) POGG_ANX_VERSION_MAJOR ; + *(ogg_int16_t *) &buf [10] = (ogg_int16_t) POGG_ANX_VERSION_MINOR ; + if (CPU_IS_BIG_ENDIAN) + endswap_short_array ((short *) &buf [8], 2) ; + + /* Timebase numerator */ + *(ogg_int64_t *) &buf [12] = (ogg_int64_t) 0 ; + + /* Timebase denominator */ + *(ogg_int64_t *) &buf [20] = (ogg_int64_t) 1 ; + + if (CPU_IS_BIG_ENDIAN) + endswap_long_array ((long *) &buf [12], 2) ; + + op.packet = buf ; + op.bytes = 48 ; + op.b_o_s = 1 ; + op.e_o_s = 0 ; + op.granulepos = 0 ; + op.packetno = -1 ; + + err = oggz_write_feed (pogg->oggz, &op, anx_serialno, 0, NULL) ; + + pogg->b_o_s = 0 ; + + /* Write AnxData header */ + memset (buf, 0, 48) ; + snprintf (buf, 8, "AnxData") ; + + /* Granule rate numerator */ + *(ogg_int64_t *) &buf [8] = (ogg_int64_t) psf->sf.samplerate ; + + /* Granule rate denominator */ + *(ogg_int64_t *) &buf [16] = (ogg_int64_t) 1 ; + + if (CPU_IS_BIG_ENDIAN) + endswap_long_array ((long *) &buf [8], 2) ; + + /* Number of secondary header pages */ + *(ogg_int32_t *) &buf [24] = (ogg_int32_t) 3 ; + if (CPU_IS_BIG_ENDIAN) + endswap_int_array ((int *) &buf [24], 1) ; + + /* Headers */ + if (format == FISH_SOUND_VORBIS) + content_type = POGG_VORBIS_CONTENT_TYPE ; + else + content_type = POGG_SPEEX_CONTENT_TYPE ; + + headers_len = snprintf ((char *) &buf [28], 100, "Content-Type : %s\r\n", content_type) ; + + op.packet = buf ; + op.bytes = 28 + headers_len + 1 ; + op.b_o_s = 1 ; + op.e_o_s = 0 ; + op.granulepos = 0 ; + op.packetno = -1 ; + + err = oggz_write_feed (pogg->oggz, &op, pogg->serialno, 0, NULL) ; + + /* Write Annodex eos packet */ + op.packet = NULL ; + op.bytes = 0 ; + op.b_o_s = 0 ; + op.e_o_s = 1 ; + op.granulepos = 0 ; + op.packetno = -1 ; + + err = oggz_write_feed (pogg->oggz, &op, anx_serialno, 0, NULL) ; + + return 0 ; +} /* pogg_write_anx_headers */ + +static int +pogg_write_header (SF_PRIVATE *psf) +{ OGG_PRIVATE * pogg = (OGG_PRIVATE *) psf->fdata ; + + OGGZ * oggz ; + FishSound * fsound ; + FishSoundInfo fsinfo ; + + oggz = oggz_new (OGGZ_WRITE) ; + + oggz_io_set_write (oggz, pogg_io_write, psf) ; + + fsinfo.samplerate = psf->sf.samplerate ; + fsinfo.channels = psf->sf.channels ; + + switch (psf->sf.format & SF_FORMAT_SUBMASK) + { case SF_FORMAT_VORBIS : + fsinfo.format = FISH_SOUND_VORBIS ; + break ; + + case SF_FORMAT_SPEEX : + fsinfo.format = FISH_SOUND_SPEEX ; + break ; + } ; + + fsound = fish_sound_new (FISH_SOUND_ENCODE, &fsinfo) ; + fish_sound_set_interleave (fsound, 1) ; + fish_sound_set_encoded_callback (fsound, pogg_encoded, psf) ; + + pogg->oggz = oggz ; + pogg->fsound = fsound ; + pogg->serialno = oggz_serialno_new (oggz) ; + pogg->b_o_s = 1 ; + pogg->comments_written = 0 ; + pogg->granulepos = 0 ; + pogg->fptr = (float *) malloc (sizeof (float) * 1024) ; + + if ((psf->sf.format & SF_FORMAT_TYPEMASK) == SF_FORMAT_ANX) + pogg_write_anx_headers (psf, fsinfo.format) ; + + return 0 ; +} /* pogg_write_header */ + +static void +pogg_write_comments (SF_PRIVATE *psf) +{ OGG_PRIVATE * pogg = (OGG_PRIVATE *) psf->fdata ; + int k ; + int err ; + + for (k = 0 ; k < SF_MAX_STRINGS ; k++) + { printf ("hrumf comment : %d => %s\n", psf->strings [k].type, psf->strings [k].str) ; + /* + if (psf->strings [k].type == 0) + break ; + */ + + if (psf->strings [k].type != 0) + { printf ("adding comment : %d => %s\n", psf->strings [k].type, psf->strings [k].str) ; + + switch (psf->strings [k].type) + { case SF_STR_SOFTWARE : + err = fish_sound_comment_add_byname (pogg->fsound, "ENCODER", psf->strings [k].str) ; + break ; + + case SF_STR_TITLE : + err = fish_sound_comment_add_byname (pogg->fsound, "TITLE", psf->strings [k].str) ; + break ; + + case SF_STR_COPYRIGHT : + err = fish_sound_comment_add_byname (pogg->fsound, "COPYRIGHT", psf->strings [k].str) ; + break ; + + case SF_STR_ARTIST : + err = fish_sound_comment_add_byname (pogg->fsound, "ARTIST", psf->strings [k].str) ; + break ; + + /* + case SF_STR_COMMENT : + fish_sound_comment_add_byname (pogg->fsound, "COMMENT", psf->strings [k].str) ; + break ; + */ + + case SF_STR_DATE : + err = fish_sound_comment_add_byname (pogg->fsound, "DATE", psf->strings [k].str) ; + break ; + } ; + + } ; /* if type !0 */ + } ; + + pogg->comments_written = 1 ; + + return ; +} /* pogg_write_comments*/ + +static sf_count_t +pogg_write_s (SF_PRIVATE *psf, short *ptr, sf_count_t len) +{ OGG_PRIVATE * pogg = (OGG_PRIVATE *) psf->fdata ; + long n, i, remaining = len / psf->sf.channels ; + + if (pogg->comments_written == 0) + pogg_write_comments (psf) ; + + while (remaining > 0) + { n = SF_MIN (remaining, 1024) ; + + for (i = 0 ; i < n * psf->sf.channels ; i++) + pogg->fptr [i] = (float) ptr [i] ; + + fish_sound_encode (pogg->fsound, (float **) ptr, n) ; + + while (oggz_write (pogg->oggz, 1024) > 0) ; + + ptr += n * psf->sf.channels ; + remaining -= n ; + } ; + + return len ; +} /* pogg_write_s */ + +static sf_count_t +pogg_write_i (SF_PRIVATE *psf, int *ptr, sf_count_t len) +{ + OGG_PRIVATE * pogg = (OGG_PRIVATE *) psf->fdata ; + long n, i, remaining = len / psf->sf.channels ; + + if (pogg->comments_written == 0) + pogg_write_comments (psf) ; + + while (remaining > 0) + { n = SF_MIN (remaining, 1024) ; + + for (i = 0 ; i < n * psf->sf.channels ; i++) + pogg->fptr [i] = (float) ptr [i] ; + + fish_sound_encode (pogg->fsound, (float **) ptr, n) ; + + while (oggz_write (pogg->oggz, 1024) > 0) ; + + ptr += n * psf->sf.channels ; + remaining -= n ; + } ; + + return len ; +} /* pogg_write_i */ + +static sf_count_t +pogg_write_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) +{ OGG_PRIVATE * pogg = (OGG_PRIVATE *) psf->fdata ; + long n, remaining = len / psf->sf.channels ; + + if (pogg->comments_written == 0) + pogg_write_comments (psf) ; + + while (remaining > 0) + { n = SF_MIN (remaining, 1024) ; + + fish_sound_encode (pogg->fsound, (float **) ptr, n) ; + + while (oggz_write (pogg->oggz, 1024) > 0) ; + + ptr += n * psf->sf.channels ; + remaining -= n ; + } ; + + return len ; +} /* pog_write_f */ + +static sf_count_t +pogg_write_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) +{ OGG_PRIVATE * pogg = (OGG_PRIVATE *) psf->fdata ; + long n, i, remaining = len / psf->sf.channels ; + + if (pogg->comments_written == 0) + pogg_write_comments (psf) ; + + while (remaining > 0) + { n = SF_MIN (remaining, 1024) ; + + for (i = 0 ; i < n * psf->sf.channels ; i++) + pogg->fptr [i] = (float) ptr [i] ; + + fish_sound_encode (pogg->fsound, (float **) ptr, n) ; + + while (oggz_write (pogg->oggz, 1024) > 0) ; + + ptr += n * psf->sf.channels ; + remaining -= n ; + } ; + + return len ; +} /* pogg_write_d */ + +#endif + +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: 9ff1fe9c-629e-4e9c-9ef5-3d0eb1e427a0 +*/ diff --git a/Libraries/SndFile/Files/src/paf.c b/Libraries/SndFile/Files/src/paf.c new file mode 100644 index 000000000..72b1b459b --- /dev/null +++ b/Libraries/SndFile/Files/src/paf.c @@ -0,0 +1,847 @@ +/* +** Copyright (C) 1999-2004 Erik de Castro Lopo +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU Lesser General Public License as published by +** the Free Software Foundation; either version 2.1 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU Lesser General Public License for more details. +** +** You should have received a copy of the GNU Lesser General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include "config.h" + +#include +#include +#include +#include +#include + +#include "sndfile.h" +#include "sfendian.h" +#include "float_cast.h" +#include "common.h" + +/*------------------------------------------------------------------------------ +** Macros to handle big/little endian issues. +*/ + +#define FAP_MARKER (MAKE_MARKER ('f', 'a', 'p', ' ')) +#define PAF_MARKER (MAKE_MARKER (' ', 'p', 'a', 'f')) + +/*------------------------------------------------------------------------------ +** Other defines. +*/ + +#define PAF_HEADER_LENGTH 2048 + +#define PAF24_SAMPLES_PER_BLOCK 10 +#define PAF24_BLOCK_SIZE 32 + +/*------------------------------------------------------------------------------ +** Typedefs. +*/ + +typedef struct +{ int version ; + int endianness ; + int samplerate ; + int format ; + int channels ; + int source ; +} PAF_FMT ; + +typedef struct +{ int max_blocks, channels, samplesperblock, blocksize ; + int read_block, write_block, read_count, write_count ; + sf_count_t sample_count ; + int *samples ; + unsigned char *block ; +#if HAVE_FLEXIBLE_ARRAY + int data [] ; /* ISO C99 struct flexible array. */ +#else + int data [1] ; /* This is a hack and may not work. */ +#endif +} PAF24_PRIVATE ; + +/*------------------------------------------------------------------------------ +** Private static functions. +*/ + +static int paf24_init (SF_PRIVATE *psf) ; + +static int paf_read_header (SF_PRIVATE *psf) ; +static int paf_write_header (SF_PRIVATE *psf, int calc_length) ; + +static sf_count_t paf24_read_s (SF_PRIVATE *psf, short *ptr, sf_count_t len) ; +static sf_count_t paf24_read_i (SF_PRIVATE *psf, int *ptr, sf_count_t len) ; +static sf_count_t paf24_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ; +static sf_count_t paf24_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ; + +static sf_count_t paf24_write_s (SF_PRIVATE *psf, short *ptr, sf_count_t len) ; +static sf_count_t paf24_write_i (SF_PRIVATE *psf, int *ptr, sf_count_t len) ; +static sf_count_t paf24_write_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ; +static sf_count_t paf24_write_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ; + +static sf_count_t paf24_seek (SF_PRIVATE *psf, int mode, sf_count_t offset) ; + +enum +{ PAF_PCM_16 = 0, + PAF_PCM_24 = 1, + PAF_PCM_S8 = 2 +} ; + +/*------------------------------------------------------------------------------ +** Public function. +*/ + +int +paf_open (SF_PRIVATE *psf) +{ int subformat, error, endian ; + + psf->dataoffset = PAF_HEADER_LENGTH ; + + if (psf->mode == SFM_READ || (psf->mode == SFM_RDWR && psf->filelength > 0)) + { if ((error = paf_read_header (psf))) + return error ; + } ; + + subformat = psf->sf.format & SF_FORMAT_SUBMASK ; + + if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR) + { if ((psf->sf.format & SF_FORMAT_TYPEMASK) != SF_FORMAT_PAF) + return SFE_BAD_OPEN_FORMAT ; + + endian = psf->sf.format & SF_FORMAT_ENDMASK ; + + /* PAF is by default big endian. */ + psf->endian = SF_ENDIAN_BIG ; + + if (endian == SF_ENDIAN_LITTLE || (CPU_IS_LITTLE_ENDIAN && (endian == SF_ENDIAN_CPU))) + psf->endian = SF_ENDIAN_LITTLE ; + + if ((error = paf_write_header (psf, SF_FALSE))) + return error ; + + psf->write_header = paf_write_header ; + } ; + + switch (subformat) + { case SF_FORMAT_PCM_S8 : + psf->bytewidth = 1 ; + error = pcm_init (psf) ; + break ; + + case SF_FORMAT_PCM_16 : + psf->bytewidth = 2 ; + error = pcm_init (psf) ; + break ; + + case SF_FORMAT_PCM_24 : + /* No bytewidth because of whacky 24 bit encoding. */ + error = paf24_init (psf) ; + break ; + + default : return SFE_PAF_UNKNOWN_FORMAT ; + } ; + + return error ; +} /* paf_open */ + +/*------------------------------------------------------------------------------ +*/ + +static int +paf_read_header (SF_PRIVATE *psf) +{ PAF_FMT paf_fmt ; + int marker ; + + psf_binheader_readf (psf, "pm", 0, &marker) ; + + psf_log_printf (psf, "Signature : '%M'\n", marker) ; + + if (marker == PAF_MARKER) + { psf_binheader_readf (psf, "E444444", &(paf_fmt.version), &(paf_fmt.endianness), + &(paf_fmt.samplerate), &(paf_fmt.format), &(paf_fmt.channels), &(paf_fmt.source)) ; + } + else if (marker == FAP_MARKER) + { psf_binheader_readf (psf, "e444444", &(paf_fmt.version), &(paf_fmt.endianness), + &(paf_fmt.samplerate), &(paf_fmt.format), &(paf_fmt.channels), &(paf_fmt.source)) ; + } + else + return SFE_PAF_NO_MARKER ; + + psf_log_printf (psf, "Version : %d\n", paf_fmt.version) ; + + if (paf_fmt.version != 0) + { psf_log_printf (psf, "*** Bad version number. should be zero.\n") ; + return SFE_PAF_VERSION ; + } ; + + psf_log_printf (psf, "Sample Rate : %d\n", paf_fmt.samplerate) ; + psf_log_printf (psf, "Channels : %d\n", paf_fmt.channels) ; + + psf_log_printf (psf, "Endianness : %d => ", paf_fmt.endianness) ; + if (paf_fmt.endianness) + { psf_log_printf (psf, "Little\n", paf_fmt.endianness) ; + psf->endian = SF_ENDIAN_LITTLE ; + } + else + { psf_log_printf (psf, "Big\n", paf_fmt.endianness) ; + psf->endian = SF_ENDIAN_BIG ; + } ; + + if (psf->filelength < PAF_HEADER_LENGTH) + return SFE_PAF_SHORT_HEADER ; + + psf->datalength = psf->filelength - psf->dataoffset ; + + psf_binheader_readf (psf, "p", (int) psf->dataoffset) ; + + psf->sf.samplerate = paf_fmt.samplerate ; + psf->sf.channels = paf_fmt.channels ; + + /* Only fill in type major. */ + psf->sf.format = SF_FORMAT_PAF ; + + psf_log_printf (psf, "Format : %d => ", paf_fmt.format) ; + + /* PAF is by default big endian. */ + psf->sf.format |= paf_fmt.endianness ? SF_ENDIAN_LITTLE : SF_ENDIAN_BIG ; + + switch (paf_fmt.format) + { case PAF_PCM_S8 : + psf_log_printf (psf, "8 bit linear PCM\n") ; + psf->bytewidth = 1 ; + + psf->sf.format |= SF_FORMAT_PCM_S8 ; + + psf->blockwidth = psf->bytewidth * psf->sf.channels ; + psf->sf.frames = psf->datalength / psf->blockwidth ; + break ; + + case PAF_PCM_16 : + psf_log_printf (psf, "16 bit linear PCM\n") ; + psf->bytewidth = 2 ; + + psf->sf.format |= SF_FORMAT_PCM_16 ; + + psf->blockwidth = psf->bytewidth * psf->sf.channels ; + psf->sf.frames = psf->datalength / psf->blockwidth ; + break ; + + case PAF_PCM_24 : + psf_log_printf (psf, "24 bit linear PCM\n") ; + psf->bytewidth = 3 ; + + psf->sf.format |= SF_FORMAT_PCM_24 ; + + psf->blockwidth = 0 ; + psf->sf.frames = PAF24_SAMPLES_PER_BLOCK * psf->datalength / + (PAF24_BLOCK_SIZE * psf->sf.channels) ; + break ; + + default : psf_log_printf (psf, "Unknown\n") ; + return SFE_PAF_UNKNOWN_FORMAT ; + break ; + } ; + + psf_log_printf (psf, "Source : %d => ", paf_fmt.source) ; + + switch (paf_fmt.source) + { case 1 : psf_log_printf (psf, "Analog Recording\n") ; + break ; + case 2 : psf_log_printf (psf, "Digital Transfer\n") ; + break ; + case 3 : psf_log_printf (psf, "Multi-track Mixdown\n") ; + break ; + case 5 : psf_log_printf (psf, "Audio Resulting From DSP Processing\n") ; + break ; + default : psf_log_printf (psf, "Unknown\n") ; + break ; + } ; + + return 0 ; +} /* paf_read_header */ + +static int +paf_write_header (SF_PRIVATE *psf, int calc_length) +{ int paf_format ; + + /* PAF header already written so no need to re-write. */ + if (psf_ftell (psf) >= PAF_HEADER_LENGTH) + return 0 ; + + psf->dataoffset = PAF_HEADER_LENGTH ; + + psf->dataoffset = PAF_HEADER_LENGTH ; + + /* Prevent compiler warning. */ + calc_length = calc_length ; + + switch (psf->sf.format & SF_FORMAT_SUBMASK) + { case SF_FORMAT_PCM_S8 : + paf_format = PAF_PCM_S8 ; + break ; + + case SF_FORMAT_PCM_16 : + paf_format = PAF_PCM_16 ; + break ; + + case SF_FORMAT_PCM_24 : + paf_format = PAF_PCM_24 ; + break ; + + default : return SFE_PAF_UNKNOWN_FORMAT ; + } ; + + /* Reset the current header length to zero. */ + psf->header [0] = 0 ; + psf->headindex = 0 ; + + if (psf->endian == SF_ENDIAN_BIG) + { /* Marker, version, endianness, samplerate */ + psf_binheader_writef (psf, "Em444", PAF_MARKER, 0, 0, psf->sf.samplerate) ; + /* format, channels, source */ + psf_binheader_writef (psf, "E444", paf_format, psf->sf.channels, 0) ; + } + else if (psf->endian == SF_ENDIAN_LITTLE) + { /* Marker, version, endianness, samplerate */ + psf_binheader_writef (psf, "em444", FAP_MARKER, 0, 1, psf->sf.samplerate) ; + /* format, channels, source */ + psf_binheader_writef (psf, "e444", paf_format, psf->sf.channels, 0) ; + } ; + + /* Zero fill to dataoffset. */ + psf_binheader_writef (psf, "z", (size_t) (psf->dataoffset - psf->headindex)) ; + + psf_fwrite (psf->header, psf->headindex, 1, psf) ; + + return psf->error ; +} /* paf_write_header */ + +/*=============================================================================== +** 24 bit PAF files have a really weird encoding. +** For a mono file, 10 samples (each being 3 bytes) are packed into a 32 byte +** block. The 8 ints in this 32 byte block are then endian swapped (as ints) +** if necessary before being written to disk. +** For a stereo file, blocks of 10 samples from the same channel are encoded +** into 32 bytes as for the mono case. The 32 byte blocks are then interleaved +** on disk. +** Reading has to reverse the above process :-). +** Weird!!! +** +** The code below attempts to gain efficiency while maintaining readability. +*/ + +static int paf24_read_block (SF_PRIVATE *psf, PAF24_PRIVATE *ppaf24) ; +static int paf24_write_block (SF_PRIVATE *psf, PAF24_PRIVATE *ppaf24) ; +static int paf24_close (SF_PRIVATE *psf) ; + + +static int +paf24_init (SF_PRIVATE *psf) +{ PAF24_PRIVATE *ppaf24 ; + int paf24size, max_blocks ; + + paf24size = sizeof (PAF24_PRIVATE) + psf->sf.channels * + (PAF24_BLOCK_SIZE + PAF24_SAMPLES_PER_BLOCK * sizeof (int)) ; + + /* + ** Not exatly sure why this needs to be here but the tests + ** fail without it. + */ + psf->last_op = 0 ; + + if (! (psf->fdata = malloc (paf24size))) + return SFE_MALLOC_FAILED ; + + ppaf24 = (PAF24_PRIVATE*) psf->fdata ; + memset (ppaf24, 0, paf24size) ; + + ppaf24->channels = psf->sf.channels ; + ppaf24->samples = ppaf24->data ; + ppaf24->block = (unsigned char*) (ppaf24->data + PAF24_SAMPLES_PER_BLOCK * ppaf24->channels) ; + + ppaf24->blocksize = PAF24_BLOCK_SIZE * ppaf24->channels ; + ppaf24->samplesperblock = PAF24_SAMPLES_PER_BLOCK ; + + if (psf->mode == SFM_READ || psf->mode == SFM_RDWR) + { paf24_read_block (psf, ppaf24) ; /* Read first block. */ + + psf->read_short = paf24_read_s ; + psf->read_int = paf24_read_i ; + psf->read_float = paf24_read_f ; + psf->read_double = paf24_read_d ; + } ; + + if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR) + { psf->write_short = paf24_write_s ; + psf->write_int = paf24_write_i ; + psf->write_float = paf24_write_f ; + psf->write_double = paf24_write_d ; + } ; + + psf->seek = paf24_seek ; + psf->close = paf24_close ; + + psf->filelength = psf_get_filelen (psf) ; + psf->datalength = psf->filelength - psf->dataoffset ; + + if (psf->datalength % PAF24_BLOCK_SIZE) + { if (psf->mode == SFM_READ) + psf_log_printf (psf, "*** Warning : file seems to be truncated.\n") ; + max_blocks = psf->datalength / ppaf24->blocksize + 1 ; + } + else + max_blocks = psf->datalength / ppaf24->blocksize ; + + ppaf24->read_block = 0 ; + if (psf->mode == SFM_RDWR) + ppaf24->write_block = max_blocks ; + else + ppaf24->write_block = 0 ; + + psf->sf.frames = ppaf24->samplesperblock * max_blocks ; + ppaf24->sample_count = psf->sf.frames ; + + return 0 ; +} /* paf24_init */ + +static sf_count_t +paf24_seek (SF_PRIVATE *psf, int mode, sf_count_t offset) +{ PAF24_PRIVATE *ppaf24 ; + int newblock, newsample ; + + if (psf->fdata == NULL) + { psf->error = SFE_INTERNAL ; + return SF_SEEK_ERROR ; + } ; + + ppaf24 = (PAF24_PRIVATE*) psf->fdata ; + + if (mode == SFM_READ && ppaf24->write_count > 0) + paf24_write_block (psf, ppaf24) ; + + newblock = offset / ppaf24->samplesperblock ; + newsample = offset % ppaf24->samplesperblock ; + + switch (mode) + { case SFM_READ : + if (offset > ppaf24->read_block * ppaf24->samplesperblock + ppaf24->read_count) + { psf->error = SFE_BAD_SEEK ; + return SF_SEEK_ERROR ; + } ; + + if (psf->last_op == SFM_WRITE && ppaf24->write_count) + paf24_write_block (psf, ppaf24) ; + + psf_fseek (psf, psf->dataoffset + newblock * ppaf24->blocksize, SEEK_SET) ; + ppaf24->read_block = newblock ; + paf24_read_block (psf, ppaf24) ; + ppaf24->read_count = newsample ; + break ; + + case SFM_WRITE : + if (offset > ppaf24->sample_count) + { psf->error = SFE_BAD_SEEK ; + return SF_SEEK_ERROR ; + } ; + + if (psf->last_op == SFM_WRITE && ppaf24->write_count) + paf24_write_block (psf, ppaf24) ; + + psf_fseek (psf, psf->dataoffset + newblock * ppaf24->blocksize, SEEK_SET) ; + ppaf24->write_block = newblock ; + paf24_read_block (psf, ppaf24) ; + ppaf24->write_count = newsample ; + break ; + + default : + psf->error = SFE_BAD_SEEK ; + return SF_SEEK_ERROR ; + } ; + + return newblock * ppaf24->samplesperblock + newsample ; +} /* paf24_seek */ + +static int +paf24_close (SF_PRIVATE *psf) +{ PAF24_PRIVATE *ppaf24 ; + + if (psf->fdata == NULL) + return 0 ; + + ppaf24 = (PAF24_PRIVATE*) psf->fdata ; + + if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR) + { if (ppaf24->write_count > 0) + paf24_write_block (psf, ppaf24) ; + } ; + + return 0 ; +} /* paf24_close */ + +/*--------------------------------------------------------------------------- +*/ +static int +paf24_read_block (SF_PRIVATE *psf, PAF24_PRIVATE *ppaf24) +{ int k, channel ; + unsigned char *cptr ; + + ppaf24->read_block ++ ; + ppaf24->read_count = 0 ; + + if (ppaf24->read_block * ppaf24->samplesperblock > ppaf24->sample_count) + { memset (ppaf24->samples, 0, ppaf24->samplesperblock * ppaf24->channels) ; + return 1 ; + } ; + + /* Read the block. */ + if ((k = psf_fread (ppaf24->block, 1, ppaf24->blocksize, psf)) != ppaf24->blocksize) + psf_log_printf (psf, "*** Warning : short read (%d != %d).\n", k, ppaf24->blocksize) ; + + + if (CPU_IS_LITTLE_ENDIAN) + { /* Do endian swapping if necessary. */ + if (psf->endian == SF_ENDIAN_BIG) + endswap_int_array (ppaf24->data, 8 * ppaf24->channels) ; + + /* Unpack block. */ + for (k = 0 ; k < PAF24_SAMPLES_PER_BLOCK * ppaf24->channels ; k++) + { channel = k % ppaf24->channels ; + cptr = ppaf24->block + PAF24_BLOCK_SIZE * channel + 3 * (k / ppaf24->channels) ; + ppaf24->samples [k] = (cptr [0] << 8) | (cptr [1] << 16) | (cptr [2] << 24) ; + } ; + } + else + { /* Do endian swapping if necessary. */ + if (psf->endian == SF_ENDIAN_BIG) + endswap_int_array (ppaf24->data, 8 * ppaf24->channels) ; + + /* Unpack block. */ + for (k = 0 ; k < PAF24_SAMPLES_PER_BLOCK * ppaf24->channels ; k++) + { channel = k % ppaf24->channels ; + cptr = ppaf24->block + PAF24_BLOCK_SIZE * channel + 3 * (k / ppaf24->channels) ; + ppaf24->samples [k] = (cptr [0] << 8) | (cptr [1] << 16) | (cptr [2] << 24) ; + } ; + } ; + + return 1 ; +} /* paf24_read_block */ + +static int +paf24_read (SF_PRIVATE *psf, PAF24_PRIVATE *ppaf24, int *ptr, int len) +{ int count, total = 0 ; + + while (total < len) + { if (ppaf24->read_block * ppaf24->samplesperblock >= ppaf24->sample_count) + { memset (&(ptr [total]), 0, (len - total) * sizeof (int)) ; + return total ; + } ; + + if (ppaf24->read_count >= ppaf24->samplesperblock) + paf24_read_block (psf, ppaf24) ; + + count = (ppaf24->samplesperblock - ppaf24->read_count) * ppaf24->channels ; + count = (len - total > count) ? count : len - total ; + + memcpy (&(ptr [total]), &(ppaf24->samples [ppaf24->read_count * ppaf24->channels]), count * sizeof (int)) ; + total += count ; + ppaf24->read_count += count / ppaf24->channels ; + } ; + + return total ; +} /* paf24_read */ + +static sf_count_t +paf24_read_s (SF_PRIVATE *psf, short *ptr, sf_count_t len) +{ PAF24_PRIVATE *ppaf24 ; + int *iptr ; + int k, bufferlen, readcount, count ; + sf_count_t total = 0 ; + + if (psf->fdata == NULL) + return 0 ; + ppaf24 = (PAF24_PRIVATE*) psf->fdata ; + + iptr = psf->u.ibuf ; + bufferlen = ARRAY_LEN (psf->u.ibuf) ; + while (len > 0) + { readcount = (len >= bufferlen) ? bufferlen : len ; + count = paf24_read (psf, ppaf24, iptr, readcount) ; + for (k = 0 ; k < readcount ; k++) + ptr [total + k] = iptr [k] >> 16 ; + total += count ; + len -= readcount ; + } ; + return total ; +} /* paf24_read_s */ + +static sf_count_t +paf24_read_i (SF_PRIVATE *psf, int *ptr, sf_count_t len) +{ PAF24_PRIVATE *ppaf24 ; + int total ; + + if (psf->fdata == NULL) + return 0 ; + ppaf24 = (PAF24_PRIVATE*) psf->fdata ; + + total = paf24_read (psf, ppaf24, ptr, len) ; + + return total ; +} /* paf24_read_i */ + +static sf_count_t +paf24_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) +{ PAF24_PRIVATE *ppaf24 ; + int *iptr ; + int k, bufferlen, readcount, count ; + sf_count_t total = 0 ; + float normfact ; + + if (psf->fdata == NULL) + return 0 ; + ppaf24 = (PAF24_PRIVATE*) psf->fdata ; + + normfact = (psf->norm_float == SF_TRUE) ? (1.0 / 0x80000000) : (1.0 / 0x100) ; + + iptr = psf->u.ibuf ; + bufferlen = ARRAY_LEN (psf->u.ibuf) ; + while (len > 0) + { readcount = (len >= bufferlen) ? bufferlen : len ; + count = paf24_read (psf, ppaf24, iptr, readcount) ; + for (k = 0 ; k < readcount ; k++) + ptr [total + k] = normfact * iptr [k] ; + total += count ; + len -= readcount ; + } ; + return total ; +} /* paf24_read_f */ + +static sf_count_t +paf24_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) +{ PAF24_PRIVATE *ppaf24 ; + int *iptr ; + int k, bufferlen, readcount, count ; + sf_count_t total = 0 ; + double normfact ; + + if (psf->fdata == NULL) + return 0 ; + ppaf24 = (PAF24_PRIVATE*) psf->fdata ; + + normfact = (psf->norm_double == SF_TRUE) ? (1.0 / 0x80000000) : (1.0 / 0x100) ; + + iptr = psf->u.ibuf ; + bufferlen = ARRAY_LEN (psf->u.ibuf) ; + while (len > 0) + { readcount = (len >= bufferlen) ? bufferlen : len ; + count = paf24_read (psf, ppaf24, iptr, readcount) ; + for (k = 0 ; k < readcount ; k++) + ptr [total + k] = normfact * iptr [k] ; + total += count ; + len -= readcount ; + } ; + return total ; +} /* paf24_read_d */ + +/*--------------------------------------------------------------------------- +*/ + +static int +paf24_write_block (SF_PRIVATE *psf, PAF24_PRIVATE *ppaf24) +{ int k, nextsample, channel ; + unsigned char *cptr ; + + /* First pack block. */ + + if (CPU_IS_LITTLE_ENDIAN) + { for (k = 0 ; k < PAF24_SAMPLES_PER_BLOCK * ppaf24->channels ; k++) + { channel = k % ppaf24->channels ; + cptr = ppaf24->block + PAF24_BLOCK_SIZE * channel + 3 * (k / ppaf24->channels) ; + nextsample = ppaf24->samples [k] >> 8 ; + cptr [0] = nextsample ; + cptr [1] = nextsample >> 8 ; + cptr [2] = nextsample >> 16 ; + } ; + + /* Do endian swapping if necessary. */ + if (psf->endian == SF_ENDIAN_BIG) + endswap_int_array (ppaf24->data, 8 * ppaf24->channels) ; + } + else if (CPU_IS_BIG_ENDIAN) + { /* This is correct. */ + for (k = 0 ; k < PAF24_SAMPLES_PER_BLOCK * ppaf24->channels ; k++) + { channel = k % ppaf24->channels ; + cptr = ppaf24->block + PAF24_BLOCK_SIZE * channel + 3 * (k / ppaf24->channels) ; + nextsample = ppaf24->samples [k] >> 8 ; + cptr [0] = nextsample ; + cptr [1] = nextsample >> 8 ; + cptr [2] = nextsample >> 16 ; + } ; + if (psf->endian == SF_ENDIAN_BIG) + endswap_int_array (ppaf24->data, 8 * ppaf24->channels) ; + } ; + + /* Write block to disk. */ + if ((k = psf_fwrite (ppaf24->block, 1, ppaf24->blocksize, psf)) != ppaf24->blocksize) + psf_log_printf (psf, "*** Warning : short write (%d != %d).\n", k, ppaf24->blocksize) ; + + if (ppaf24->sample_count < ppaf24->write_block * ppaf24->samplesperblock + ppaf24->write_count) + ppaf24->sample_count = ppaf24->write_block * ppaf24->samplesperblock + ppaf24->write_count ; + + if (ppaf24->write_count == ppaf24->samplesperblock) + { ppaf24->write_block ++ ; + ppaf24->write_count = 0 ; + } ; + + return 1 ; +} /* paf24_write_block */ + +static int +paf24_write (SF_PRIVATE *psf, PAF24_PRIVATE *ppaf24, int *ptr, int len) +{ int count, total = 0 ; + + while (total < len) + { count = (ppaf24->samplesperblock - ppaf24->write_count) * ppaf24->channels ; + + if (count > len - total) + count = len - total ; + + memcpy (&(ppaf24->samples [ppaf24->write_count * ppaf24->channels]), &(ptr [total]), count * sizeof (int)) ; + total += count ; + ppaf24->write_count += count / ppaf24->channels ; + + if (ppaf24->write_count >= ppaf24->samplesperblock) + paf24_write_block (psf, ppaf24) ; + } ; + + return total ; +} /* paf24_write */ + +static sf_count_t +paf24_write_s (SF_PRIVATE *psf, short *ptr, sf_count_t len) +{ PAF24_PRIVATE *ppaf24 ; + int *iptr ; + int k, bufferlen, writecount = 0, count ; + sf_count_t total = 0 ; + + if (psf->fdata == NULL) + return 0 ; + ppaf24 = (PAF24_PRIVATE*) psf->fdata ; + + iptr = psf->u.ibuf ; + bufferlen = ARRAY_LEN (psf->u.ibuf) ; + while (len > 0) + { writecount = (len >= bufferlen) ? bufferlen : len ; + for (k = 0 ; k < writecount ; k++) + iptr [k] = ptr [total + k] << 16 ; + count = paf24_write (psf, ppaf24, iptr, writecount) ; + total += count ; + len -= writecount ; + if (count != writecount) + break ; + } ; + return total ; +} /* paf24_write_s */ + +static sf_count_t +paf24_write_i (SF_PRIVATE *psf, int *ptr, sf_count_t len) +{ PAF24_PRIVATE *ppaf24 ; + int writecount, count ; + sf_count_t total = 0 ; + + if (psf->fdata == NULL) + return 0 ; + ppaf24 = (PAF24_PRIVATE*) psf->fdata ; + + while (len > 0) + { writecount = (len > 0x10000000) ? 0x10000000 : (int) len ; + + count = paf24_write (psf, ppaf24, ptr, writecount) ; + + total += count ; + len -= count ; + if (count != writecount) + break ; + } ; + + return total ; +} /* paf24_write_i */ + +static sf_count_t +paf24_write_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) +{ PAF24_PRIVATE *ppaf24 ; + int *iptr ; + int k, bufferlen, writecount = 0, count ; + sf_count_t total = 0 ; + float normfact ; + + if (psf->fdata == NULL) + return 0 ; + ppaf24 = (PAF24_PRIVATE*) psf->fdata ; + + normfact = (psf->norm_float == SF_TRUE) ? (1.0 * 0x7FFFFFFF) : (1.0 / 0x100) ; + + iptr = psf->u.ibuf ; + bufferlen = ARRAY_LEN (psf->u.ibuf) ; + while (len > 0) + { writecount = (len >= bufferlen) ? bufferlen : len ; + for (k = 0 ; k < writecount ; k++) + iptr [k] = lrintf (normfact * ptr [total + k]) ; + count = paf24_write (psf, ppaf24, iptr, writecount) ; + total += count ; + len -= writecount ; + if (count != writecount) + break ; + } ; + + return total ; +} /* paf24_write_f */ + +static sf_count_t +paf24_write_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) +{ PAF24_PRIVATE *ppaf24 ; + int *iptr ; + int k, bufferlen, writecount = 0, count ; + sf_count_t total = 0 ; + double normfact ; + + if (psf->fdata == NULL) + return 0 ; + ppaf24 = (PAF24_PRIVATE*) psf->fdata ; + + normfact = (psf->norm_double == SF_TRUE) ? (1.0 * 0x7FFFFFFF) : (1.0 / 0x100) ; + + iptr = psf->u.ibuf ; + bufferlen = ARRAY_LEN (psf->u.ibuf) ; + while (len > 0) + { writecount = (len >= bufferlen) ? bufferlen : len ; + for (k = 0 ; k < writecount ; k++) + iptr [k] = lrint (normfact * ptr [total+k]) ; + count = paf24_write (psf, ppaf24, iptr, writecount) ; + total += count ; + len -= writecount ; + if (count != writecount) + break ; + } ; + + return total ; +} /* paf24_write_d */ + + +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: 477a5308-451e-4bbd-bab4-fab6caa4e884 +*/ diff --git a/Libraries/SndFile/Files/src/pcm.c b/Libraries/SndFile/Files/src/pcm.c new file mode 100644 index 000000000..38a993529 --- /dev/null +++ b/Libraries/SndFile/Files/src/pcm.c @@ -0,0 +1,2898 @@ +/* +** Copyright (C) 1999-2004 Erik de Castro Lopo +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU Lesser General Public License as published by +** the Free Software Foundation; either version 2.1 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU Lesser General Public License for more details. +** +** You should have received a copy of the GNU Lesser General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include "sndfile.h" +#include "config.h" +#include "sfendian.h" +#include "float_cast.h" +#include "common.h" + +/* Need to be able to handle 3 byte (24 bit) integers. So defined a +** type and use SIZEOF_TRIBYTE instead of (tribyte). +*/ + +typedef void tribyte ; + +#define SIZEOF_TRIBYTE 3 + +static sf_count_t pcm_read_sc2s (SF_PRIVATE *psf, short *ptr, sf_count_t len) ; +static sf_count_t pcm_read_uc2s (SF_PRIVATE *psf, short *ptr, sf_count_t len) ; +static sf_count_t pcm_read_bes2s (SF_PRIVATE *psf, short *ptr, sf_count_t len) ; +static sf_count_t pcm_read_les2s (SF_PRIVATE *psf, short *ptr, sf_count_t len) ; +static sf_count_t pcm_read_bet2s (SF_PRIVATE *psf, short *ptr, sf_count_t len) ; +static sf_count_t pcm_read_let2s (SF_PRIVATE *psf, short *ptr, sf_count_t len) ; +static sf_count_t pcm_read_bei2s (SF_PRIVATE *psf, short *ptr, sf_count_t len) ; +static sf_count_t pcm_read_lei2s (SF_PRIVATE *psf, short *ptr, sf_count_t len) ; + +static sf_count_t pcm_read_sc2i (SF_PRIVATE *psf, int *ptr, sf_count_t len) ; +static sf_count_t pcm_read_uc2i (SF_PRIVATE *psf, int *ptr, sf_count_t len) ; +static sf_count_t pcm_read_bes2i (SF_PRIVATE *psf, int *ptr, sf_count_t len) ; +static sf_count_t pcm_read_les2i (SF_PRIVATE *psf, int *ptr, sf_count_t len) ; +static sf_count_t pcm_read_bet2i (SF_PRIVATE *psf, int *ptr, sf_count_t len) ; +static sf_count_t pcm_read_let2i (SF_PRIVATE *psf, int *ptr, sf_count_t len) ; +static sf_count_t pcm_read_bei2i (SF_PRIVATE *psf, int *ptr, sf_count_t len) ; +static sf_count_t pcm_read_lei2i (SF_PRIVATE *psf, int *ptr, sf_count_t len) ; + +static sf_count_t pcm_read_sc2f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ; +static sf_count_t pcm_read_uc2f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ; +static sf_count_t pcm_read_bes2f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ; +static sf_count_t pcm_read_les2f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ; +static sf_count_t pcm_read_bet2f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ; +static sf_count_t pcm_read_let2f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ; +static sf_count_t pcm_read_bei2f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ; +static sf_count_t pcm_read_lei2f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ; + +static sf_count_t pcm_read_sc2d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ; +static sf_count_t pcm_read_uc2d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ; +static sf_count_t pcm_read_bes2d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ; +static sf_count_t pcm_read_les2d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ; +static sf_count_t pcm_read_bet2d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ; +static sf_count_t pcm_read_let2d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ; +static sf_count_t pcm_read_bei2d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ; +static sf_count_t pcm_read_lei2d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ; + +static sf_count_t pcm_write_s2sc (SF_PRIVATE *psf, short *ptr, sf_count_t len) ; +static sf_count_t pcm_write_s2uc (SF_PRIVATE *psf, short *ptr, sf_count_t len) ; +static sf_count_t pcm_write_s2bes (SF_PRIVATE *psf, short *ptr, sf_count_t len) ; +static sf_count_t pcm_write_s2les (SF_PRIVATE *psf, short *ptr, sf_count_t len) ; +static sf_count_t pcm_write_s2bet (SF_PRIVATE *psf, short *ptr, sf_count_t len) ; +static sf_count_t pcm_write_s2let (SF_PRIVATE *psf, short *ptr, sf_count_t len) ; +static sf_count_t pcm_write_s2bei (SF_PRIVATE *psf, short *ptr, sf_count_t len) ; +static sf_count_t pcm_write_s2lei (SF_PRIVATE *psf, short *ptr, sf_count_t len) ; + +static sf_count_t pcm_write_i2sc (SF_PRIVATE *psf, int *ptr, sf_count_t len) ; +static sf_count_t pcm_write_i2uc (SF_PRIVATE *psf, int *ptr, sf_count_t len) ; +static sf_count_t pcm_write_i2bes (SF_PRIVATE *psf, int *ptr, sf_count_t len) ; +static sf_count_t pcm_write_i2les (SF_PRIVATE *psf, int *ptr, sf_count_t len) ; +static sf_count_t pcm_write_i2bet (SF_PRIVATE *psf, int *ptr, sf_count_t len) ; +static sf_count_t pcm_write_i2let (SF_PRIVATE *psf, int *ptr, sf_count_t len) ; +static sf_count_t pcm_write_i2bei (SF_PRIVATE *psf, int *ptr, sf_count_t len) ; +static sf_count_t pcm_write_i2lei (SF_PRIVATE *psf, int *ptr, sf_count_t len) ; + +static sf_count_t pcm_write_f2sc (SF_PRIVATE *psf, float *ptr, sf_count_t len) ; +static sf_count_t pcm_write_f2uc (SF_PRIVATE *psf, float *ptr, sf_count_t len) ; +static sf_count_t pcm_write_f2bes (SF_PRIVATE *psf, float *ptr, sf_count_t len) ; +static sf_count_t pcm_write_f2les (SF_PRIVATE *psf, float *ptr, sf_count_t len) ; +static sf_count_t pcm_write_f2bet (SF_PRIVATE *psf, float *ptr, sf_count_t len) ; +static sf_count_t pcm_write_f2let (SF_PRIVATE *psf, float *ptr, sf_count_t len) ; +static sf_count_t pcm_write_f2bei (SF_PRIVATE *psf, float *ptr, sf_count_t len) ; +static sf_count_t pcm_write_f2lei (SF_PRIVATE *psf, float *ptr, sf_count_t len) ; + +static sf_count_t pcm_write_d2sc (SF_PRIVATE *psf, double *ptr, sf_count_t len) ; +static sf_count_t pcm_write_d2uc (SF_PRIVATE *psf, double *ptr, sf_count_t len) ; +static sf_count_t pcm_write_d2bes (SF_PRIVATE *psf, double *ptr, sf_count_t len) ; +static sf_count_t pcm_write_d2les (SF_PRIVATE *psf, double *ptr, sf_count_t len) ; +static sf_count_t pcm_write_d2bet (SF_PRIVATE *psf, double *ptr, sf_count_t len) ; +static sf_count_t pcm_write_d2let (SF_PRIVATE *psf, double *ptr, sf_count_t len) ; +static sf_count_t pcm_write_d2bei (SF_PRIVATE *psf, double *ptr, sf_count_t len) ; +static sf_count_t pcm_write_d2lei (SF_PRIVATE *psf, double *ptr, sf_count_t len) ; + +/*----------------------------------------------------------------------------------------------- +*/ + +enum +{ /* Char type for 8 bit files. */ + SF_CHARS_SIGNED = 200, + SF_CHARS_UNSIGNED = 201 +} ; + +/*----------------------------------------------------------------------------------------------- +*/ + +int +pcm_init (SF_PRIVATE *psf) +{ int chars = 0 ; + + if (psf->bytewidth == 0 || psf->sf.channels == 0) + return SFE_INTERNAL ; + + psf->blockwidth = psf->bytewidth * psf->sf.channels ; + + if ((psf->sf.format & SF_FORMAT_SUBMASK) == SF_FORMAT_PCM_S8) + chars = SF_CHARS_SIGNED ; + else if ((psf->sf.format & SF_FORMAT_SUBMASK) == SF_FORMAT_PCM_U8) + chars = SF_CHARS_UNSIGNED ; + + if (psf->mode == SFM_READ || psf->mode == SFM_RDWR) + { switch (psf->bytewidth * 0x10000 + psf->endian + chars) + { case (0x10000 + SF_ENDIAN_BIG + SF_CHARS_SIGNED) : + case (0x10000 + SF_ENDIAN_LITTLE + SF_CHARS_SIGNED) : + psf->read_short = pcm_read_sc2s ; + psf->read_int = pcm_read_sc2i ; + psf->read_float = pcm_read_sc2f ; + psf->read_double = pcm_read_sc2d ; + break ; + case (0x10000 + SF_ENDIAN_BIG + SF_CHARS_UNSIGNED) : + case (0x10000 + SF_ENDIAN_LITTLE + SF_CHARS_UNSIGNED) : + psf->read_short = pcm_read_uc2s ; + psf->read_int = pcm_read_uc2i ; + psf->read_float = pcm_read_uc2f ; + psf->read_double = pcm_read_uc2d ; + break ; + + case (2 * 0x10000 + SF_ENDIAN_BIG) : + psf->read_short = pcm_read_bes2s ; + psf->read_int = pcm_read_bes2i ; + psf->read_float = pcm_read_bes2f ; + psf->read_double = pcm_read_bes2d ; + break ; + case (3 * 0x10000 + SF_ENDIAN_BIG) : + psf->read_short = pcm_read_bet2s ; + psf->read_int = pcm_read_bet2i ; + psf->read_float = pcm_read_bet2f ; + psf->read_double = pcm_read_bet2d ; + break ; + case (4 * 0x10000 + SF_ENDIAN_BIG) : + psf->read_short = pcm_read_bei2s ; + psf->read_int = pcm_read_bei2i ; + psf->read_float = pcm_read_bei2f ; + psf->read_double = pcm_read_bei2d ; + break ; + + case (2 * 0x10000 + SF_ENDIAN_LITTLE) : + psf->read_short = pcm_read_les2s ; + psf->read_int = pcm_read_les2i ; + psf->read_float = pcm_read_les2f ; + psf->read_double = pcm_read_les2d ; + break ; + case (3 * 0x10000 + SF_ENDIAN_LITTLE) : + psf->read_short = pcm_read_let2s ; + psf->read_int = pcm_read_let2i ; + psf->read_float = pcm_read_let2f ; + psf->read_double = pcm_read_let2d ; + break ; + case (4 * 0x10000 + SF_ENDIAN_LITTLE) : + psf->read_short = pcm_read_lei2s ; + psf->read_int = pcm_read_lei2i ; + psf->read_float = pcm_read_lei2f ; + psf->read_double = pcm_read_lei2d ; + break ; + default : + psf_log_printf (psf, "pcm.c returning SFE_UNIMPLEMENTED\n") ; + return SFE_UNIMPLEMENTED ; + } ; + } ; + + if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR) + { switch (psf->bytewidth * 0x10000 + psf->endian + chars) + { case (0x10000 + SF_ENDIAN_BIG + SF_CHARS_SIGNED) : + case (0x10000 + SF_ENDIAN_LITTLE + SF_CHARS_SIGNED) : + psf->write_short = pcm_write_s2sc ; + psf->write_int = pcm_write_i2sc ; + psf->write_float = pcm_write_f2sc ; + psf->write_double = pcm_write_d2sc ; + break ; + case (0x10000 + SF_ENDIAN_BIG + SF_CHARS_UNSIGNED) : + case (0x10000 + SF_ENDIAN_LITTLE + SF_CHARS_UNSIGNED) : + psf->write_short = pcm_write_s2uc ; + psf->write_int = pcm_write_i2uc ; + psf->write_float = pcm_write_f2uc ; + psf->write_double = pcm_write_d2uc ; + break ; + + case (2 * 0x10000 + SF_ENDIAN_BIG) : + psf->write_short = pcm_write_s2bes ; + psf->write_int = pcm_write_i2bes ; + psf->write_float = pcm_write_f2bes ; + psf->write_double = pcm_write_d2bes ; + break ; + + case (3 * 0x10000 + SF_ENDIAN_BIG) : + psf->write_short = pcm_write_s2bet ; + psf->write_int = pcm_write_i2bet ; + psf->write_float = pcm_write_f2bet ; + psf->write_double = pcm_write_d2bet ; + break ; + + case (4 * 0x10000 + SF_ENDIAN_BIG) : + psf->write_short = pcm_write_s2bei ; + psf->write_int = pcm_write_i2bei ; + psf->write_float = pcm_write_f2bei ; + psf->write_double = pcm_write_d2bei ; + break ; + + case (2 * 0x10000 + SF_ENDIAN_LITTLE) : + psf->write_short = pcm_write_s2les ; + psf->write_int = pcm_write_i2les ; + psf->write_float = pcm_write_f2les ; + psf->write_double = pcm_write_d2les ; + break ; + + case (3 * 0x10000 + SF_ENDIAN_LITTLE) : + psf->write_short = pcm_write_s2let ; + psf->write_int = pcm_write_i2let ; + psf->write_float = pcm_write_f2let ; + psf->write_double = pcm_write_d2let ; + break ; + + case (4 * 0x10000 + SF_ENDIAN_LITTLE) : + psf->write_short = pcm_write_s2lei ; + psf->write_int = pcm_write_i2lei ; + psf->write_float = pcm_write_f2lei ; + psf->write_double = pcm_write_d2lei ; + break ; + + default : + psf_log_printf (psf, "pcm.c returning SFE_UNIMPLEMENTED\n") ; + return SFE_UNIMPLEMENTED ; + } ; + + } ; + + if (psf->filelength > psf->dataoffset) + { psf->datalength = (psf->dataend > 0) ? psf->dataend - psf->dataoffset : + psf->filelength - psf->dataoffset ; + } + else + psf->datalength = 0 ; + + psf->sf.frames = psf->datalength / psf->blockwidth ; + + return 0 ; +} /* pcm_init */ + +/*============================================================================== +*/ + +static inline void +sc2s_array (signed char *src, int count, short *dest) +{ while (--count >= 0) + { dest [count] = src [count] << 8 ; + } ; +} /* sc2s_array */ + +static inline void +uc2s_array (unsigned char *src, int count, short *dest) +{ while (--count >= 0) + { dest [count] = (((short) src [count]) - 0x80) << 8 ; + } ; +} /* uc2s_array */ + +static inline void +let2s_array (tribyte *src, int count, short *dest) +{ unsigned char *ucptr ; + + ucptr = ((unsigned char*) src) + 3 * count ; + while (--count >= 0) + { ucptr -= 3 ; + dest [count] = LET2H_SHORT_PTR (ucptr) ; + } ; +} /* let2s_array */ + +static inline void +bet2s_array (tribyte *src, int count, short *dest) +{ unsigned char *ucptr ; + + ucptr = ((unsigned char*) src) + 3 * count ; + while (--count >= 0) + { ucptr -= 3 ; + dest [count] = BET2H_SHORT_PTR (ucptr) ; + } ; +} /* bet2s_array */ + +static inline void +lei2s_array (int *src, int count, short *dest) +{ int value ; + + while (--count >= 0) + { value = LEI2H_INT (src [count]) ; + dest [count] = value >> 16 ; + } ; +} /* lei2s_array */ + +static inline void +bei2s_array (int *src, int count, short *dest) +{ int value ; + + while (--count >= 0) + { value = BEI2H_INT (src [count]) ; + dest [count] = value >> 16 ; + } ; +} /* bei2s_array */ + +/*-------------------------------------------------------------------------- +*/ + +static inline void +sc2i_array (signed char *src, int count, int *dest) +{ while (--count >= 0) + { dest [count] = ((int) src [count]) << 24 ; + } ; +} /* sc2i_array */ + +static inline void +uc2i_array (unsigned char *src, int count, int *dest) +{ while (--count >= 0) + { dest [count] = (((int) src [count]) - 128) << 24 ; + } ; +} /* uc2i_array */ + +static inline void +bes2i_array (short *src, int count, int *dest) +{ short value ; + + while (--count >= 0) + { value = BES2H_SHORT (src [count]) ; + dest [count] = value << 16 ; + } ; +} /* bes2i_array */ + +static inline void +les2i_array (short *src, int count, int *dest) +{ short value ; + + while (--count >= 0) + { value = LES2H_SHORT (src [count]) ; + dest [count] = value << 16 ; + } ; +} /* les2i_array */ + +static inline void +bet2i_array (tribyte *src, int count, int *dest) +{ unsigned char *ucptr ; + + ucptr = ((unsigned char*) src) + 3 * count ; + while (--count >= 0) + { ucptr -= 3 ; + dest [count] = BET2H_INT_PTR (ucptr) ; + } ; +} /* bet2i_array */ + +static inline void +let2i_array (tribyte *src, int count, int *dest) +{ unsigned char *ucptr ; + + ucptr = ((unsigned char*) src) + 3 * count ; + while (--count >= 0) + { ucptr -= 3 ; + dest [count] = LET2H_INT_PTR (ucptr) ; + } ; +} /* let2i_array */ + +/*-------------------------------------------------------------------------- +*/ + +static inline void +sc2f_array (signed char *src, int count, float *dest, float normfact) +{ while (--count >= 0) + dest [count] = ((float) src [count]) * normfact ; +} /* sc2f_array */ + +static inline void +uc2f_array (unsigned char *src, int count, float *dest, float normfact) +{ while (--count >= 0) + dest [count] = (((int) src [count]) - 128) * normfact ; +} /* uc2f_array */ + +static inline void +les2f_array (short *src, int count, float *dest, float normfact) +{ short value ; + + while (--count >= 0) + { value = src [count] ; + value = LES2H_SHORT (value) ; + dest [count] = ((float) value) * normfact ; + } ; +} /* les2f_array */ + +static inline void +bes2f_array (short *src, int count, float *dest, float normfact) +{ short value ; + + while (--count >= 0) + { value = src [count] ; + value = BES2H_SHORT (value) ; + dest [count] = ((float) value) * normfact ; + } ; +} /* bes2f_array */ + +static inline void +let2f_array (tribyte *src, int count, float *dest, float normfact) +{ unsigned char *ucptr ; + int value ; + + ucptr = ((unsigned char*) src) + 3 * count ; + while (--count >= 0) + { ucptr -= 3 ; + value = LET2H_INT_PTR (ucptr) ; + dest [count] = ((float) value) * normfact ; + } ; +} /* let2f_array */ + +static inline void +bet2f_array (tribyte *src, int count, float *dest, float normfact) +{ unsigned char *ucptr ; + int value ; + + ucptr = ((unsigned char*) src) + 3 * count ; + while (--count >= 0) + { ucptr -= 3 ; + value = BET2H_INT_PTR (ucptr) ; + dest [count] = ((float) value) * normfact ; + } ; +} /* bet2f_array */ + +static inline void +lei2f_array (int *src, int count, float *dest, float normfact) +{ int value ; + + while (--count >= 0) + { value = src [count] ; + value = LEI2H_INT (value) ; + dest [count] = ((float) value) * normfact ; + } ; +} /* lei2f_array */ + +static inline void +bei2f_array (int *src, int count, float *dest, float normfact) +{ int value ; + + while (--count >= 0) + { value = src [count] ; + value = BEI2H_INT (value) ; + dest [count] = ((float) value) * normfact ; + } ; +} /* bei2f_array */ + +/*-------------------------------------------------------------------------- +*/ + +static inline void +sc2d_array (signed char *src, int count, double *dest, double normfact) +{ while (--count >= 0) + dest [count] = ((double) src [count]) * normfact ; +} /* sc2d_array */ + +static inline void +uc2d_array (unsigned char *src, int count, double *dest, double normfact) +{ while (--count >= 0) + dest [count] = (((int) src [count]) - 128) * normfact ; +} /* uc2d_array */ + +static inline void +les2d_array (short *src, int count, double *dest, double normfact) +{ short value ; + + while (--count >= 0) + { value = src [count] ; + value = LES2H_SHORT (value) ; + dest [count] = ((double) value) * normfact ; + } ; +} /* les2d_array */ + +static inline void +bes2d_array (short *src, int count, double *dest, double normfact) +{ short value ; + + while (--count >= 0) + { value = src [count] ; + value = BES2H_SHORT (value) ; + dest [count] = ((double) value) * normfact ; + } ; +} /* bes2d_array */ + +static inline void +let2d_array (tribyte *src, int count, double *dest, double normfact) +{ unsigned char *ucptr ; + int value ; + + ucptr = ((unsigned char*) src) + 3 * count ; + while (--count >= 0) + { ucptr -= 3 ; + value = LET2H_INT_PTR (ucptr) ; + dest [count] = ((double) value) * normfact ; + } ; +} /* let2d_array */ + +static inline void +bet2d_array (tribyte *src, int count, double *dest, double normfact) +{ unsigned char *ucptr ; + int value ; + + ucptr = ((unsigned char*) src) + 3 * count ; + while (--count >= 0) + { ucptr -= 3 ; + value = (ucptr [0] << 24) | (ucptr [1] << 16) | (ucptr [2] << 8) ; + dest [count] = ((double) value) * normfact ; + } ; +} /* bet2d_array */ + +static inline void +lei2d_array (int *src, int count, double *dest, double normfact) +{ int value ; + + while (--count >= 0) + { value = src [count] ; + value = LEI2H_INT (value) ; + dest [count] = ((double) value) * normfact ; + } ; +} /* lei2d_array */ + +static inline void +bei2d_array (int *src, int count, double *dest, double normfact) +{ int value ; + + while (--count >= 0) + { value = src [count] ; + value = BEI2H_INT (value) ; + dest [count] = ((double) value) * normfact ; + } ; +} /* bei2d_array */ + +/*-------------------------------------------------------------------------- +*/ + +static inline void +s2sc_array (short *src, signed char *dest, int count) +{ while (--count >= 0) + dest [count] = src [count] >> 8 ; +} /* s2sc_array */ + +static inline void +s2uc_array (short *src, unsigned char *dest, int count) +{ while (--count >= 0) + dest [count] = (src [count] >> 8) + 0x80 ; +} /* s2uc_array */ + +static inline void +s2let_array (short *src, tribyte *dest, int count) +{ unsigned char *ucptr ; + + ucptr = ((unsigned char*) dest) + 3 * count ; + while (--count >= 0) + { ucptr -= 3 ; + ucptr [0] = 0 ; + ucptr [1] = src [count] ; + ucptr [2] = src [count] >> 8 ; + } ; +} /* s2let_array */ + +static inline void +s2bet_array (short *src, tribyte *dest, int count) +{ unsigned char *ucptr ; + + ucptr = ((unsigned char*) dest) + 3 * count ; + while (--count >= 0) + { ucptr -= 3 ; + ucptr [2] = 0 ; + ucptr [1] = src [count] ; + ucptr [0] = src [count] >> 8 ; + } ; +} /* s2bet_array */ + +static inline void +s2lei_array (short *src, int *dest, int count) +{ unsigned char *ucptr ; + + ucptr = ((unsigned char*) dest) + 4 * count ; + while (--count >= 0) + { ucptr -= 4 ; + ucptr [0] = 0 ; + ucptr [1] = 0 ; + ucptr [2] = src [count] ; + ucptr [3] = src [count] >> 8 ; + } ; +} /* s2lei_array */ + +static inline void +s2bei_array (short *src, int *dest, int count) +{ unsigned char *ucptr ; + + ucptr = ((unsigned char*) dest) + 4 * count ; + while (--count >= 0) + { ucptr -= 4 ; + ucptr [0] = src [count] >> 8 ; + ucptr [1] = src [count] ; + ucptr [2] = 0 ; + ucptr [3] = 0 ; + } ; +} /* s2bei_array */ + +/*-------------------------------------------------------------------------- +*/ + +static inline void +i2sc_array (int *src, signed char *dest, int count) +{ while (--count >= 0) + dest [count] = (src [count] >> 24) ; +} /* i2sc_array */ + +static inline void +i2uc_array (int *src, unsigned char *dest, int count) +{ while (--count >= 0) + dest [count] = ((src [count] >> 24) + 128) ; +} /* i2uc_array */ + +static inline void +i2bes_array (int *src, short *dest, int count) +{ unsigned char *ucptr ; + + ucptr = ((unsigned char*) dest) + 2 * count ; + while (--count >= 0) + { ucptr -= 2 ; + ucptr [0] = src [count] >> 24 ; + ucptr [1] = src [count] >> 16 ; + } ; +} /* i2bes_array */ + +static inline void +i2les_array (int *src, short *dest, int count) +{ unsigned char *ucptr ; + + ucptr = ((unsigned char*) dest) + 2 * count ; + while (--count >= 0) + { ucptr -= 2 ; + ucptr [0] = src [count] >> 16 ; + ucptr [1] = src [count] >> 24 ; + } ; +} /* i2les_array */ + +static inline void +i2let_array (int *src, tribyte *dest, int count) +{ unsigned char *ucptr ; + int value ; + + ucptr = ((unsigned char*) dest) + 3 * count ; + while (--count >= 0) + { ucptr -= 3 ; + value = src [count] >> 8 ; + ucptr [0] = value ; + ucptr [1] = value >> 8 ; + ucptr [2] = value >> 16 ; + } ; +} /* i2let_array */ + +static inline void +i2bet_array (int *src, tribyte *dest, int count) +{ unsigned char *ucptr ; + int value ; + + ucptr = ((unsigned char*) dest) + 3 * count ; + while (--count >= 0) + { ucptr -= 3 ; + value = src [count] >> 8 ; + ucptr [2] = value ; + ucptr [1] = value >> 8 ; + ucptr [0] = value >> 16 ; + } ; +} /* i2bet_array */ + +/*=============================================================================================== +*/ + +static sf_count_t +pcm_read_sc2s (SF_PRIVATE *psf, short *ptr, sf_count_t len) +{ int bufferlen, readcount ; + sf_count_t total = 0 ; + + bufferlen = ARRAY_LEN (psf->u.scbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + readcount = psf_fread (psf->u.scbuf, sizeof (signed char), bufferlen, psf) ; + sc2s_array (psf->u.scbuf, readcount, ptr + total) ; + total += readcount ; + if (readcount < bufferlen) + break ; + len -= readcount ; + } ; + + return total ; +} /* pcm_read_sc2s */ + +static sf_count_t +pcm_read_uc2s (SF_PRIVATE *psf, short *ptr, sf_count_t len) +{ int bufferlen, readcount ; + sf_count_t total = 0 ; + + bufferlen = ARRAY_LEN (psf->u.ucbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + readcount = psf_fread (psf->u.ucbuf, sizeof (unsigned char), bufferlen, psf) ; + uc2s_array (psf->u.ucbuf, readcount, ptr + total) ; + total += readcount ; + if (readcount < bufferlen) + break ; + len -= readcount ; + } ; + + return total ; +} /* pcm_read_uc2s */ + +static sf_count_t +pcm_read_bes2s (SF_PRIVATE *psf, short *ptr, sf_count_t len) +{ int total ; + + total = psf_fread (ptr, sizeof (short), len, psf) ; + if (CPU_IS_LITTLE_ENDIAN) + endswap_short_array (ptr, len) ; + + return total ; +} /* pcm_read_bes2s */ + +static sf_count_t +pcm_read_les2s (SF_PRIVATE *psf, short *ptr, sf_count_t len) +{ int total ; + + total = psf_fread (ptr, sizeof (short), len, psf) ; + if (CPU_IS_BIG_ENDIAN) + endswap_short_array (ptr, len) ; + + return total ; +} /* pcm_read_les2s */ + +static sf_count_t +pcm_read_bet2s (SF_PRIVATE *psf, short *ptr, sf_count_t len) +{ int bufferlen, readcount ; + sf_count_t total = 0 ; + + bufferlen = sizeof (psf->u.ucbuf) / SIZEOF_TRIBYTE ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + readcount = psf_fread (psf->u.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ; + bet2s_array ((tribyte*) (psf->u.ucbuf), readcount, ptr + total) ; + total += readcount ; + if (readcount < bufferlen) + break ; + len -= readcount ; + } ; + + return total ; +} /* pcm_read_bet2s */ + +static sf_count_t +pcm_read_let2s (SF_PRIVATE *psf, short *ptr, sf_count_t len) +{ int bufferlen, readcount ; + sf_count_t total = 0 ; + + bufferlen = sizeof (psf->u.ucbuf) / SIZEOF_TRIBYTE ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + readcount = psf_fread (psf->u.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ; + let2s_array ((tribyte*) (psf->u.ucbuf), readcount, ptr + total) ; + total += readcount ; + if (readcount < bufferlen) + break ; + len -= readcount ; + } ; + + return total ; +} /* pcm_read_let2s */ + +static sf_count_t +pcm_read_bei2s (SF_PRIVATE *psf, short *ptr, sf_count_t len) +{ int bufferlen, readcount ; + sf_count_t total = 0 ; + + bufferlen = ARRAY_LEN (psf->u.ibuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + readcount = psf_fread (psf->u.ibuf, sizeof (int), bufferlen, psf) ; + bei2s_array (psf->u.ibuf, readcount, ptr + total) ; + total += readcount ; + if (readcount < bufferlen) + break ; + len -= readcount ; + } ; + + return total ; +} /* pcm_read_bei2s */ + +static sf_count_t +pcm_read_lei2s (SF_PRIVATE *psf, short *ptr, sf_count_t len) +{ int bufferlen, readcount ; + sf_count_t total = 0 ; + + bufferlen = ARRAY_LEN (psf->u.ibuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + readcount = psf_fread (psf->u.ibuf, sizeof (int), bufferlen, psf) ; + lei2s_array (psf->u.ibuf, readcount, ptr + total) ; + total += readcount ; + if (readcount < bufferlen) + break ; + len -= readcount ; + } ; + + return total ; +} /* pcm_read_lei2s */ + +/*----------------------------------------------------------------------------------------------- +*/ + +static sf_count_t +pcm_read_sc2i (SF_PRIVATE *psf, int *ptr, sf_count_t len) +{ int bufferlen, readcount ; + sf_count_t total = 0 ; + + bufferlen = ARRAY_LEN (psf->u.scbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + readcount = psf_fread (psf->u.scbuf, sizeof (signed char), bufferlen, psf) ; + sc2i_array (psf->u.scbuf, readcount, ptr + total) ; + total += readcount ; + if (readcount < bufferlen) + break ; + len -= readcount ; + } ; + + return total ; +} /* pcm_read_sc2i */ + +static sf_count_t +pcm_read_uc2i (SF_PRIVATE *psf, int *ptr, sf_count_t len) +{ int bufferlen, readcount ; + sf_count_t total = 0 ; + + bufferlen = ARRAY_LEN (psf->u.ucbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + readcount = psf_fread (psf->u.ucbuf, sizeof (unsigned char), bufferlen, psf) ; + uc2i_array (psf->u.ucbuf, readcount, ptr + total) ; + total += readcount ; + if (readcount < bufferlen) + break ; + len -= readcount ; + } ; + + return total ; +} /* pcm_read_uc2i */ + +static sf_count_t +pcm_read_bes2i (SF_PRIVATE *psf, int *ptr, sf_count_t len) +{ int bufferlen, readcount ; + sf_count_t total = 0 ; + + bufferlen = ARRAY_LEN (psf->u.sbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + readcount = psf_fread (psf->u.sbuf, sizeof (short), bufferlen, psf) ; + bes2i_array (psf->u.sbuf, readcount, ptr + total) ; + total += readcount ; + if (readcount < bufferlen) + break ; + len -= readcount ; + } ; + + return total ; +} /* pcm_read_bes2i */ + +static sf_count_t +pcm_read_les2i (SF_PRIVATE *psf, int *ptr, sf_count_t len) +{ int bufferlen, readcount ; + sf_count_t total = 0 ; + + bufferlen = ARRAY_LEN (psf->u.sbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + readcount = psf_fread (psf->u.sbuf, sizeof (short), bufferlen, psf) ; + les2i_array (psf->u.sbuf, readcount, ptr + total) ; + total += readcount ; + if (readcount < bufferlen) + break ; + len -= readcount ; + } ; + + return total ; +} /* pcm_read_les2i */ + +static sf_count_t +pcm_read_bet2i (SF_PRIVATE *psf, int *ptr, sf_count_t len) +{ int bufferlen, readcount ; + sf_count_t total = 0 ; + + bufferlen = sizeof (psf->u.ucbuf) / SIZEOF_TRIBYTE ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + readcount = psf_fread (psf->u.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ; + bet2i_array ((tribyte*) (psf->u.ucbuf), readcount, ptr + total) ; + total += readcount ; + if (readcount < bufferlen) + break ; + len -= readcount ; + } ; + + return total ; +} /* pcm_read_bet2i */ + +static sf_count_t +pcm_read_let2i (SF_PRIVATE *psf, int *ptr, sf_count_t len) +{ int bufferlen, readcount ; + sf_count_t total = 0 ; + + bufferlen = sizeof (psf->u.ucbuf) / SIZEOF_TRIBYTE ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + readcount = psf_fread (psf->u.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ; + let2i_array ((tribyte*) (psf->u.ucbuf), readcount, ptr + total) ; + total += readcount ; + if (readcount < bufferlen) + break ; + len -= readcount ; + } ; + + return total ; +} /* pcm_read_let2i */ + +static sf_count_t +pcm_read_bei2i (SF_PRIVATE *psf, int *ptr, sf_count_t len) +{ int total ; + + total = psf_fread (ptr, sizeof (int), len, psf) ; + if (CPU_IS_LITTLE_ENDIAN) + endswap_int_array (ptr, len) ; + + return total ; +} /* pcm_read_bei2i */ + +static sf_count_t +pcm_read_lei2i (SF_PRIVATE *psf, int *ptr, sf_count_t len) +{ int total ; + + total = psf_fread (ptr, sizeof (int), len, psf) ; + if (CPU_IS_BIG_ENDIAN) + endswap_int_array (ptr, len) ; + + return total ; +} /* pcm_read_lei2i */ + +/*----------------------------------------------------------------------------------------------- +*/ + +static sf_count_t +pcm_read_sc2f (SF_PRIVATE *psf, float *ptr, sf_count_t len) +{ int bufferlen, readcount ; + sf_count_t total = 0 ; + float normfact ; + + normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x80) : 1.0 ; + + bufferlen = ARRAY_LEN (psf->u.scbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + readcount = psf_fread (psf->u.scbuf, sizeof (signed char), bufferlen, psf) ; + sc2f_array (psf->u.scbuf, readcount, ptr + total, normfact) ; + total += readcount ; + if (readcount < bufferlen) + break ; + len -= readcount ; + } ; + + return total ; +} /* pcm_read_sc2f */ + +static sf_count_t +pcm_read_uc2f (SF_PRIVATE *psf, float *ptr, sf_count_t len) +{ int bufferlen, readcount ; + sf_count_t total = 0 ; + float normfact ; + + normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x80) : 1.0 ; + + bufferlen = ARRAY_LEN (psf->u.ucbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + readcount = psf_fread (psf->u.ucbuf, sizeof (unsigned char), bufferlen, psf) ; + uc2f_array (psf->u.ucbuf, readcount, ptr + total, normfact) ; + total += readcount ; + if (readcount < bufferlen) + break ; + len -= readcount ; + } ; + + return total ; +} /* pcm_read_uc2f */ + +static sf_count_t +pcm_read_bes2f (SF_PRIVATE *psf, float *ptr, sf_count_t len) +{ int bufferlen, readcount ; + sf_count_t total = 0 ; + float normfact ; + + normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x8000) : 1.0 ; + + bufferlen = ARRAY_LEN (psf->u.sbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + readcount = psf_fread (psf->u.sbuf, sizeof (short), bufferlen, psf) ; + bes2f_array (psf->u.sbuf, readcount, ptr + total, normfact) ; + total += readcount ; + if (readcount < bufferlen) + break ; + len -= readcount ; + } ; + + return total ; +} /* pcm_read_bes2f */ + +static sf_count_t +pcm_read_les2f (SF_PRIVATE *psf, float *ptr, sf_count_t len) +{ int bufferlen, readcount ; + sf_count_t total = 0 ; + float normfact ; + + normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x8000) : 1.0 ; + + bufferlen = ARRAY_LEN (psf->u.sbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + readcount = psf_fread (psf->u.sbuf, sizeof (short), bufferlen, psf) ; + les2f_array (psf->u.sbuf, readcount, ptr + total, normfact) ; + total += readcount ; + if (readcount < bufferlen) + break ; + len -= readcount ; + } ; + + return total ; +} /* pcm_read_les2f */ + +static sf_count_t +pcm_read_bet2f (SF_PRIVATE *psf, float *ptr, sf_count_t len) +{ int bufferlen, readcount ; + sf_count_t total = 0 ; + float normfact ; + + /* Special normfactor because tribyte value is read into an int. */ + normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x80000000) : 1.0 / 256.0 ; + + bufferlen = sizeof (psf->u.ucbuf) / SIZEOF_TRIBYTE ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + readcount = psf_fread (psf->u.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ; + bet2f_array ((tribyte*) (psf->u.ucbuf), readcount, ptr + total, normfact) ; + total += readcount ; + if (readcount < bufferlen) + break ; + len -= readcount ; + } ; + + return total ; +} /* pcm_read_bet2f */ + +static sf_count_t +pcm_read_let2f (SF_PRIVATE *psf, float *ptr, sf_count_t len) +{ int bufferlen, readcount ; + sf_count_t total = 0 ; + float normfact ; + + /* Special normfactor because tribyte value is read into an int. */ + normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x80000000) : 1.0 / 256.0 ; + + bufferlen = sizeof (psf->u.ucbuf) / SIZEOF_TRIBYTE ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + readcount = psf_fread (psf->u.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ; + let2f_array ((tribyte*) (psf->u.ucbuf), readcount, ptr + total, normfact) ; + total += readcount ; + if (readcount < bufferlen) + break ; + len -= readcount ; + } ; + + return total ; +} /* pcm_read_let2f */ + +static sf_count_t +pcm_read_bei2f (SF_PRIVATE *psf, float *ptr, sf_count_t len) +{ int bufferlen, readcount ; + sf_count_t total = 0 ; + float normfact ; + + normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x80000000) : 1.0 ; + + bufferlen = ARRAY_LEN (psf->u.ibuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + readcount = psf_fread (psf->u.ibuf, sizeof (int), bufferlen, psf) ; + bei2f_array (psf->u.ibuf, readcount, ptr + total, normfact) ; + total += readcount ; + if (readcount < bufferlen) + break ; + len -= readcount ; + } ; + + return total ; +} /* pcm_read_bei2f */ + +static sf_count_t +pcm_read_lei2f (SF_PRIVATE *psf, float *ptr, sf_count_t len) +{ int bufferlen, readcount ; + sf_count_t total = 0 ; + float normfact ; + + normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x80000000) : 1.0 ; + + bufferlen = ARRAY_LEN (psf->u.ibuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + readcount = psf_fread (psf->u.ibuf, sizeof (int), bufferlen, psf) ; + lei2f_array (psf->u.ibuf, readcount, ptr + total, normfact) ; + total += readcount ; + if (readcount < bufferlen) + break ; + len -= readcount ; + } ; + + return total ; +} /* pcm_read_lei2f */ + +/*----------------------------------------------------------------------------------------------- +*/ + +static sf_count_t +pcm_read_sc2d (SF_PRIVATE *psf, double *ptr, sf_count_t len) +{ int bufferlen, readcount ; + sf_count_t total = 0 ; + double normfact ; + + normfact = (psf->norm_double == SF_TRUE) ? 1.0 / ((double) 0x80) : 1.0 ; + + bufferlen = ARRAY_LEN (psf->u.scbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + readcount = psf_fread (psf->u.scbuf, sizeof (signed char), bufferlen, psf) ; + sc2d_array (psf->u.scbuf, readcount, ptr + total, normfact) ; + total += readcount ; + if (readcount < bufferlen) + break ; + len -= readcount ; + } ; + + return total ; +} /* pcm_read_sc2d */ + +static sf_count_t +pcm_read_uc2d (SF_PRIVATE *psf, double *ptr, sf_count_t len) +{ int bufferlen, readcount ; + sf_count_t total = 0 ; + double normfact ; + + normfact = (psf->norm_double == SF_TRUE) ? 1.0 / ((double) 0x80) : 1.0 ; + + bufferlen = ARRAY_LEN (psf->u.ucbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + readcount = psf_fread (psf->u.ucbuf, sizeof (unsigned char), bufferlen, psf) ; + uc2d_array (psf->u.ucbuf, readcount, ptr + total, normfact) ; + total += readcount ; + if (readcount < bufferlen) + break ; + len -= readcount ; + } ; + + return total ; +} /* pcm_read_uc2d */ + +static sf_count_t +pcm_read_bes2d (SF_PRIVATE *psf, double *ptr, sf_count_t len) +{ int bufferlen, readcount ; + sf_count_t total = 0 ; + double normfact ; + + normfact = (psf->norm_double == SF_TRUE) ? 1.0 / ((double) 0x8000) : 1.0 ; + + bufferlen = ARRAY_LEN (psf->u.sbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + readcount = psf_fread (psf->u.sbuf, sizeof (short), bufferlen, psf) ; + bes2d_array (psf->u.sbuf, readcount, ptr + total, normfact) ; + total += readcount ; + if (readcount < bufferlen) + break ; + len -= readcount ; + } ; + + return total ; +} /* pcm_read_bes2d */ + +static sf_count_t +pcm_read_les2d (SF_PRIVATE *psf, double *ptr, sf_count_t len) +{ int bufferlen, readcount ; + sf_count_t total = 0 ; + double normfact ; + + normfact = (psf->norm_double == SF_TRUE) ? 1.0 / ((double) 0x8000) : 1.0 ; + + bufferlen = ARRAY_LEN (psf->u.sbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + readcount = psf_fread (psf->u.sbuf, sizeof (short), bufferlen, psf) ; + les2d_array (psf->u.sbuf, readcount, ptr + total, normfact) ; + total += readcount ; + if (readcount < bufferlen) + break ; + len -= readcount ; + } ; + + return total ; +} /* pcm_read_les2d */ + +static sf_count_t +pcm_read_bet2d (SF_PRIVATE *psf, double *ptr, sf_count_t len) +{ int bufferlen, readcount ; + sf_count_t total = 0 ; + double normfact ; + + normfact = (psf->norm_double == SF_TRUE) ? 1.0 / ((double) 0x80000000) : 1.0 / 256.0 ; + + bufferlen = sizeof (psf->u.ucbuf) / SIZEOF_TRIBYTE ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + readcount = psf_fread (psf->u.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ; + bet2d_array ((tribyte*) (psf->u.ucbuf), readcount, ptr + total, normfact) ; + total += readcount ; + if (readcount < bufferlen) + break ; + len -= readcount ; + } ; + + return total ; +} /* pcm_read_bet2d */ + +static sf_count_t +pcm_read_let2d (SF_PRIVATE *psf, double *ptr, sf_count_t len) +{ int bufferlen, readcount ; + sf_count_t total = 0 ; + double normfact ; + + /* Special normfactor because tribyte value is read into an int. */ + normfact = (psf->norm_double == SF_TRUE) ? 1.0 / ((double) 0x80000000) : 1.0 / 256.0 ; + + bufferlen = sizeof (psf->u.ucbuf) / SIZEOF_TRIBYTE ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + readcount = psf_fread (psf->u.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ; + let2d_array ((tribyte*) (psf->u.ucbuf), readcount, ptr + total, normfact) ; + total += readcount ; + if (readcount < bufferlen) + break ; + len -= readcount ; + } ; + + return total ; +} /* pcm_read_let2d */ + +static sf_count_t +pcm_read_bei2d (SF_PRIVATE *psf, double *ptr, sf_count_t len) +{ int bufferlen, readcount ; + sf_count_t total = 0 ; + double normfact ; + + normfact = (psf->norm_double == SF_TRUE) ? 1.0 / ((double) 0x80000000) : 1.0 ; + + bufferlen = ARRAY_LEN (psf->u.ibuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + readcount = psf_fread (psf->u.ibuf, sizeof (int), bufferlen, psf) ; + bei2d_array (psf->u.ibuf, readcount, ptr + total, normfact) ; + total += readcount ; + if (readcount < bufferlen) + break ; + len -= readcount ; + } ; + + return total ; +} /* pcm_read_bei2d */ + +static sf_count_t +pcm_read_lei2d (SF_PRIVATE *psf, double *ptr, sf_count_t len) +{ int bufferlen, readcount ; + sf_count_t total = 0 ; + double normfact ; + + normfact = (psf->norm_double == SF_TRUE) ? 1.0 / ((double) 0x80000000) : 1.0 ; + + bufferlen = ARRAY_LEN (psf->u.ibuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + readcount = psf_fread (psf->u.ibuf, sizeof (int), bufferlen, psf) ; + lei2d_array (psf->u.ibuf, readcount, ptr + total, normfact) ; + total += readcount ; + if (readcount < bufferlen) + break ; + len -= readcount ; + } ; + + return total ; +} /* pcm_read_lei2d */ + +/*=============================================================================================== +**----------------------------------------------------------------------------------------------- +**=============================================================================================== +*/ + +static sf_count_t +pcm_write_s2sc (SF_PRIVATE *psf, short *ptr, sf_count_t len) +{ int bufferlen, writecount ; + sf_count_t total = 0 ; + + bufferlen = ARRAY_LEN (psf->u.scbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + s2sc_array (ptr + total, psf->u.scbuf, bufferlen) ; + writecount = psf_fwrite (psf->u.scbuf, sizeof (signed char), bufferlen, psf) ; + total += writecount ; + if (writecount < bufferlen) + break ; + len -= writecount ; + } ; + + return total ; +} /* pcm_write_s2sc */ + +static sf_count_t +pcm_write_s2uc (SF_PRIVATE *psf, short *ptr, sf_count_t len) +{ int bufferlen, writecount ; + sf_count_t total = 0 ; + + bufferlen = ARRAY_LEN (psf->u.ucbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + s2uc_array (ptr + total, psf->u.ucbuf, bufferlen) ; + writecount = psf_fwrite (psf->u.ucbuf, sizeof (unsigned char), bufferlen, psf) ; + total += writecount ; + if (writecount < bufferlen) + break ; + len -= writecount ; + } ; + + return total ; +} /* pcm_write_s2uc */ + +static sf_count_t +pcm_write_s2bes (SF_PRIVATE *psf, short *ptr, sf_count_t len) +{ int bufferlen, writecount ; + sf_count_t total = 0 ; + + if (CPU_IS_BIG_ENDIAN) + return psf_fwrite (ptr, sizeof (short), len, psf) ; + else + + bufferlen = ARRAY_LEN (psf->u.sbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + endswap_short_copy (psf->u.sbuf, ptr + total, bufferlen) ; + writecount = psf_fwrite (psf->u.sbuf, sizeof (short), bufferlen, psf) ; + total += writecount ; + if (writecount < bufferlen) + break ; + len -= writecount ; + } ; + + return total ; +} /* pcm_write_s2bes */ + +static sf_count_t +pcm_write_s2les (SF_PRIVATE *psf, short *ptr, sf_count_t len) +{ int bufferlen, writecount ; + sf_count_t total = 0 ; + + if (CPU_IS_LITTLE_ENDIAN) + return psf_fwrite (ptr, sizeof (short), len, psf) ; + + bufferlen = ARRAY_LEN (psf->u.sbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + endswap_short_copy (psf->u.sbuf, ptr + total, bufferlen) ; + writecount = psf_fwrite (psf->u.sbuf, sizeof (short), bufferlen, psf) ; + total += writecount ; + if (writecount < bufferlen) + break ; + len -= writecount ; + } ; + + return total ; +} /* pcm_write_s2les */ + +static sf_count_t +pcm_write_s2bet (SF_PRIVATE *psf, short *ptr, sf_count_t len) +{ int bufferlen, writecount ; + sf_count_t total = 0 ; + + bufferlen = sizeof (psf->u.ucbuf) / SIZEOF_TRIBYTE ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + s2bet_array (ptr + total, (tribyte*) (psf->u.ucbuf), bufferlen) ; + writecount = psf_fwrite (psf->u.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ; + total += writecount ; + if (writecount < bufferlen) + break ; + len -= writecount ; + } ; + + return total ; +} /* pcm_write_s2bet */ + +static sf_count_t +pcm_write_s2let (SF_PRIVATE *psf, short *ptr, sf_count_t len) +{ int bufferlen, writecount ; + sf_count_t total = 0 ; + + bufferlen = sizeof (psf->u.ucbuf) / SIZEOF_TRIBYTE ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + s2let_array (ptr + total, (tribyte*) (psf->u.ucbuf), bufferlen) ; + writecount = psf_fwrite (psf->u.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ; + total += writecount ; + if (writecount < bufferlen) + break ; + len -= writecount ; + } ; + + return total ; +} /* pcm_write_s2let */ + +static sf_count_t +pcm_write_s2bei (SF_PRIVATE *psf, short *ptr, sf_count_t len) +{ int bufferlen, writecount ; + sf_count_t total = 0 ; + + bufferlen = ARRAY_LEN (psf->u.ibuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + s2bei_array (ptr + total, psf->u.ibuf, bufferlen) ; + writecount = psf_fwrite (psf->u.ibuf, sizeof (int), bufferlen, psf) ; + total += writecount ; + if (writecount < bufferlen) + break ; + len -= writecount ; + } ; + + return total ; +} /* pcm_write_s2bei */ + +static sf_count_t +pcm_write_s2lei (SF_PRIVATE *psf, short *ptr, sf_count_t len) +{ int bufferlen, writecount ; + sf_count_t total = 0 ; + + bufferlen = ARRAY_LEN (psf->u.ibuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + s2lei_array (ptr + total, psf->u.ibuf, bufferlen) ; + writecount = psf_fwrite (psf->u.ibuf, sizeof (int), bufferlen, psf) ; + total += writecount ; + if (writecount < bufferlen) + break ; + len -= writecount ; + } ; + + return total ; +} /* pcm_write_s2lei */ + +/*----------------------------------------------------------------------------------------------- +*/ + +static sf_count_t +pcm_write_i2sc (SF_PRIVATE *psf, int *ptr, sf_count_t len) +{ int bufferlen, writecount ; + sf_count_t total = 0 ; + + bufferlen = ARRAY_LEN (psf->u.scbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + i2sc_array (ptr + total, psf->u.scbuf, bufferlen) ; + writecount = psf_fwrite (psf->u.scbuf, sizeof (signed char), bufferlen, psf) ; + total += writecount ; + if (writecount < bufferlen) + break ; + len -= writecount ; + } ; + + return total ; +} /* pcm_write_i2sc */ + +static sf_count_t +pcm_write_i2uc (SF_PRIVATE *psf, int *ptr, sf_count_t len) +{ int bufferlen, writecount ; + sf_count_t total = 0 ; + + bufferlen = ARRAY_LEN (psf->u.ucbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + i2uc_array (ptr + total, psf->u.ucbuf, bufferlen) ; + writecount = psf_fwrite (psf->u.ucbuf, sizeof (signed char), bufferlen, psf) ; + total += writecount ; + if (writecount < bufferlen) + break ; + len -= writecount ; + } ; + + return total ; +} /* pcm_write_i2uc */ + +static sf_count_t +pcm_write_i2bes (SF_PRIVATE *psf, int *ptr, sf_count_t len) +{ int bufferlen, writecount ; + sf_count_t total = 0 ; + + bufferlen = ARRAY_LEN (psf->u.sbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + i2bes_array (ptr + total, psf->u.sbuf, bufferlen) ; + writecount = psf_fwrite (psf->u.sbuf, sizeof (short), bufferlen, psf) ; + total += writecount ; + if (writecount < bufferlen) + break ; + len -= writecount ; + } ; + + return total ; +} /* pcm_write_i2bes */ + +static sf_count_t +pcm_write_i2les (SF_PRIVATE *psf, int *ptr, sf_count_t len) +{ int bufferlen, writecount ; + sf_count_t total = 0 ; + + bufferlen = ARRAY_LEN (psf->u.sbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + i2les_array (ptr + total, psf->u.sbuf, bufferlen) ; + writecount = psf_fwrite (psf->u.sbuf, sizeof (short), bufferlen, psf) ; + total += writecount ; + if (writecount < bufferlen) + break ; + len -= writecount ; + } ; + + return total ; +} /* pcm_write_i2les */ + +static sf_count_t +pcm_write_i2bet (SF_PRIVATE *psf, int *ptr, sf_count_t len) +{ int bufferlen, writecount ; + sf_count_t total = 0 ; + + bufferlen = sizeof (psf->u.ucbuf) / SIZEOF_TRIBYTE ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + i2bet_array (ptr + total, (tribyte*) (psf->u.ucbuf), bufferlen) ; + writecount = psf_fwrite (psf->u.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ; + total += writecount ; + if (writecount < bufferlen) + break ; + len -= writecount ; + } ; + + return total ; +} /* pcm_write_i2bet */ + +static sf_count_t +pcm_write_i2let (SF_PRIVATE *psf, int *ptr, sf_count_t len) +{ int bufferlen, writecount ; + sf_count_t total = 0 ; + + bufferlen = sizeof (psf->u.ucbuf) / SIZEOF_TRIBYTE ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + i2let_array (ptr + total, (tribyte*) (psf->u.ucbuf), bufferlen) ; + writecount = psf_fwrite (psf->u.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ; + total += writecount ; + if (writecount < bufferlen) + break ; + len -= writecount ; + } ; + + return total ; +} /* pcm_write_i2les */ + +static sf_count_t +pcm_write_i2bei (SF_PRIVATE *psf, int *ptr, sf_count_t len) +{ int bufferlen, writecount ; + sf_count_t total = 0 ; + + if (CPU_IS_BIG_ENDIAN) + return psf_fwrite (ptr, sizeof (int), len, psf) ; + + bufferlen = ARRAY_LEN (psf->u.ibuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + endswap_int_copy (psf->u.ibuf, ptr + total, bufferlen) ; + writecount = psf_fwrite (psf->u.ibuf, sizeof (int), bufferlen, psf) ; + total += writecount ; + if (writecount < bufferlen) + break ; + len -= writecount ; + } ; + + return total ; +} /* pcm_write_i2bei */ + +static sf_count_t +pcm_write_i2lei (SF_PRIVATE *psf, int *ptr, sf_count_t len) +{ int bufferlen, writecount ; + sf_count_t total = 0 ; + + if (CPU_IS_LITTLE_ENDIAN) + return psf_fwrite (ptr, sizeof (int), len, psf) ; + + bufferlen = ARRAY_LEN (psf->u.ibuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + endswap_int_copy (psf->u.ibuf, ptr + total, bufferlen) ; + writecount = psf_fwrite (psf->u.ibuf, sizeof (int), bufferlen, psf) ; + total += writecount ; + if (writecount < bufferlen) + break ; + len -= writecount ; + } ; + + return total ; +} /* pcm_write_i2lei */ + +/*------------------------------------------------------------------------------ +**============================================================================== +**------------------------------------------------------------------------------ +*/ + +static void +f2sc_array (float *src, signed char *dest, int count, int normalize) +{ float normfact ; + + normfact = normalize ? (1.0 * 0x7F) : 1.0 ; + + while (--count >= 0) + { dest [count] = lrintf (src [count] * normfact) ; + } ; +} /* f2sc_array */ + +static void +f2sc_clip_array (float *src, signed char *dest, int count, int normalize) +{ float normfact, scaled_value ; + + normfact = normalize ? (8.0 * 0x10000000) : (1.0 * 0x1000000) ; + + while (--count >= 0) + { scaled_value = src [count] * normfact ; + if (CPU_CLIPS_POSITIVE == 0 && scaled_value >= (1.0 * 0x7FFFFFFF)) + { dest [count] = 127 ; + continue ; + } ; + if (CPU_CLIPS_NEGATIVE == 0 && scaled_value <= (-8.0 * 0x10000000)) + { dest [count] = -128 ; + continue ; + } ; + + dest [count] = lrintf (scaled_value) >> 24 ; + } ; +} /* f2sc_clip_array */ + +static sf_count_t +pcm_write_f2sc (SF_PRIVATE *psf, float *ptr, sf_count_t len) +{ void (*convert) (float *, signed char *, int, int) ; + int bufferlen, writecount ; + sf_count_t total = 0 ; + + convert = (psf->add_clipping) ? f2sc_clip_array : f2sc_array ; + bufferlen = ARRAY_LEN (psf->u.scbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + convert (ptr + total, psf->u.scbuf, bufferlen, psf->norm_float) ; + writecount = psf_fwrite (psf->u.scbuf, sizeof (signed char), bufferlen, psf) ; + total += writecount ; + if (writecount < bufferlen) + break ; + len -= writecount ; + } ; + + return total ; +} /* pcm_write_f2sc */ + +/*============================================================================== +*/ + +static void +f2uc_array (float *src, unsigned char *dest, int count, int normalize) +{ float normfact ; + + normfact = normalize ? (1.0 * 0x7F) : 1.0 ; + + while (--count >= 0) + { dest [count] = lrintf (src [count] * normfact) + 128 ; + } ; +} /* f2uc_array */ + +static void +f2uc_clip_array (float *src, unsigned char *dest, int count, int normalize) +{ float normfact, scaled_value ; + + normfact = normalize ? (8.0 * 0x10000000) : (1.0 * 0x1000000) ; + + while (--count >= 0) + { scaled_value = src [count] * normfact ; + if (CPU_CLIPS_POSITIVE == 0 && scaled_value >= (1.0 * 0x7FFFFFFF)) + { dest [count] = 0xFF ; + continue ; + } ; + if (CPU_CLIPS_NEGATIVE == 0 && scaled_value <= (-8.0 * 0x10000000)) + { dest [count] = 0 ; + continue ; + } ; + + dest [count] = (lrintf (scaled_value) >> 24) + 128 ; + } ; +} /* f2uc_clip_array */ + +static sf_count_t +pcm_write_f2uc (SF_PRIVATE *psf, float *ptr, sf_count_t len) +{ void (*convert) (float *, unsigned char *, int, int) ; + int bufferlen, writecount ; + sf_count_t total = 0 ; + + convert = (psf->add_clipping) ? f2uc_clip_array : f2uc_array ; + bufferlen = ARRAY_LEN (psf->u.ucbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + convert (ptr + total, psf->u.ucbuf, bufferlen, psf->norm_float) ; + writecount = psf_fwrite (psf->u.ucbuf, sizeof (unsigned char), bufferlen, psf) ; + total += writecount ; + if (writecount < bufferlen) + break ; + len -= writecount ; + } ; + + return total ; +} /* pcm_write_f2uc */ + +/*============================================================================== +*/ + +static void +f2bes_array (float *src, short *dest, int count, int normalize) +{ unsigned char *ucptr ; + float normfact ; + short value ; + + normfact = normalize ? (1.0 * 0x7FFF) : 1.0 ; + ucptr = ((unsigned char*) dest) + 2 * count ; + + while (--count >= 0) + { ucptr -= 2 ; + value = lrintf (src [count] * normfact) ; + ucptr [1] = value ; + ucptr [0] = value >> 8 ; + } ; +} /* f2bes_array */ + +static void +f2bes_clip_array (float *src, short *dest, int count, int normalize) +{ unsigned char *ucptr ; + float normfact, scaled_value ; + int value ; + + normfact = normalize ? (8.0 * 0x10000000) : (1.0 * 0x10000) ; + ucptr = ((unsigned char*) dest) + 2 * count ; + + while (--count >= 0) + { ucptr -= 2 ; + scaled_value = src [count] * normfact ; + if (CPU_CLIPS_POSITIVE == 0 && scaled_value >= (1.0 * 0x7FFFFFFF)) + { ucptr [1] = 0xFF ; + ucptr [0] = 0x7F ; + continue ; + } ; + if (CPU_CLIPS_NEGATIVE == 0 && scaled_value <= (-8.0 * 0x10000000)) + { ucptr [1] = 0x00 ; + ucptr [0] = 0x80 ; + continue ; + } ; + + value = lrintf (scaled_value) ; + ucptr [1] = value >> 16 ; + ucptr [0] = value >> 24 ; + } ; +} /* f2bes_clip_array */ + +static sf_count_t +pcm_write_f2bes (SF_PRIVATE *psf, float *ptr, sf_count_t len) +{ void (*convert) (float *, short *t, int, int) ; + int bufferlen, writecount ; + sf_count_t total = 0 ; + + convert = (psf->add_clipping) ? f2bes_clip_array : f2bes_array ; + bufferlen = ARRAY_LEN (psf->u.sbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + convert (ptr + total, psf->u.sbuf, bufferlen, psf->norm_float) ; + writecount = psf_fwrite (psf->u.sbuf, sizeof (short), bufferlen, psf) ; + total += writecount ; + if (writecount < bufferlen) + break ; + len -= writecount ; + } ; + + return total ; +} /* pcm_write_f2bes */ + +/*============================================================================== +*/ + +static void +f2les_array (float *src, short *dest, int count, int normalize) +{ unsigned char *ucptr ; + float normfact ; + int value ; + + normfact = normalize ? (1.0 * 0x7FFF) : 1.0 ; + ucptr = ((unsigned char*) dest) + 2 * count ; + + while (--count >= 0) + { ucptr -= 2 ; + value = lrintf (src [count] * normfact) ; + ucptr [0] = value ; + ucptr [1] = value >> 8 ; + } ; +} /* f2les_array */ + +static void +f2les_clip_array (float *src, short *dest, int count, int normalize) +{ unsigned char *ucptr ; + float normfact, scaled_value ; + int value ; + + normfact = normalize ? (8.0 * 0x10000000) : (1.0 * 0x10000) ; + ucptr = ((unsigned char*) dest) + 2 * count ; + + while (--count >= 0) + { ucptr -= 2 ; + scaled_value = src [count] * normfact ; + if (CPU_CLIPS_POSITIVE == 0 && scaled_value >= (1.0 * 0x7FFFFFFF)) + { ucptr [0] = 0xFF ; + ucptr [1] = 0x7F ; + continue ; + } ; + if (CPU_CLIPS_NEGATIVE == 0 && scaled_value <= (-8.0 * 0x10000000)) + { ucptr [0] = 0x00 ; + ucptr [1] = 0x80 ; + continue ; + } ; + + value = lrintf (scaled_value) ; + ucptr [0] = value >> 16 ; + ucptr [1] = value >> 24 ; + } ; +} /* f2les_clip_array */ + +static sf_count_t +pcm_write_f2les (SF_PRIVATE *psf, float *ptr, sf_count_t len) +{ void (*convert) (float *, short *t, int, int) ; + int bufferlen, writecount ; + sf_count_t total = 0 ; + + convert = (psf->add_clipping) ? f2les_clip_array : f2les_array ; + bufferlen = ARRAY_LEN (psf->u.sbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + convert (ptr + total, psf->u.sbuf, bufferlen, psf->norm_float) ; + writecount = psf_fwrite (psf->u.sbuf, sizeof (short), bufferlen, psf) ; + total += writecount ; + if (writecount < bufferlen) + break ; + len -= writecount ; + } ; + + return total ; +} /* pcm_write_f2les */ + +/*============================================================================== +*/ + +static void +f2let_array (float *src, tribyte *dest, int count, int normalize) +{ unsigned char *ucptr ; + float normfact ; + int value ; + + normfact = normalize ? (1.0 * 0x7FFFFF) : 1.0 ; + ucptr = ((unsigned char*) dest) + 3 * count ; + + while (--count >= 0) + { ucptr -= 3 ; + value = lrintf (src [count] * normfact) ; + ucptr [0] = value ; + ucptr [1] = value >> 8 ; + ucptr [2] = value >> 16 ; + } ; +} /* f2let_array */ + +static void +f2let_clip_array (float *src, tribyte *dest, int count, int normalize) +{ unsigned char *ucptr ; + float normfact, scaled_value ; + int value ; + + normfact = normalize ? (8.0 * 0x10000000) : (1.0 * 0x100) ; + ucptr = ((unsigned char*) dest) + 3 * count ; + + while (--count >= 0) + { ucptr -= 3 ; + scaled_value = src [count] * normfact ; + if (CPU_CLIPS_POSITIVE == 0 && scaled_value >= (1.0 * 0x7FFFFFFF)) + { ucptr [0] = 0xFF ; + ucptr [1] = 0xFF ; + ucptr [2] = 0x7F ; + continue ; + } ; + if (CPU_CLIPS_NEGATIVE == 0 && scaled_value <= (-8.0 * 0x10000000)) + { ucptr [0] = 0x00 ; + ucptr [1] = 0x00 ; + ucptr [2] = 0x80 ; + continue ; + } ; + + value = lrintf (scaled_value) ; + ucptr [0] = value >> 8 ; + ucptr [1] = value >> 16 ; + ucptr [2] = value >> 24 ; + } ; +} /* f2let_clip_array */ + +static sf_count_t +pcm_write_f2let (SF_PRIVATE *psf, float *ptr, sf_count_t len) +{ void (*convert) (float *, tribyte *, int, int) ; + int bufferlen, writecount ; + sf_count_t total = 0 ; + + convert = (psf->add_clipping) ? f2let_clip_array : f2let_array ; + bufferlen = sizeof (psf->u.ucbuf) / SIZEOF_TRIBYTE ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + convert (ptr + total, (tribyte*) (psf->u.ucbuf), bufferlen, psf->norm_float) ; + writecount = psf_fwrite (psf->u.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ; + total += writecount ; + if (writecount < bufferlen) + break ; + len -= writecount ; + } ; + + return total ; +} /* pcm_write_f2let */ + +/*============================================================================== +*/ + +static void +f2bet_array (float *src, tribyte *dest, int count, int normalize) +{ unsigned char *ucptr ; + float normfact ; + int value ; + + normfact = normalize ? (1.0 * 0x7FFFFF) : 1.0 ; + ucptr = ((unsigned char*) dest) + 3 * count ; + + while (--count >= 0) + { ucptr -= 3 ; + value = lrintf (src [count] * normfact) ; + ucptr [0] = value >> 16 ; + ucptr [1] = value >> 8 ; + ucptr [2] = value ; + } ; +} /* f2bet_array */ + +static void +f2bet_clip_array (float *src, tribyte *dest, int count, int normalize) +{ unsigned char *ucptr ; + float normfact, scaled_value ; + int value ; + + normfact = normalize ? (8.0 * 0x10000000) : (1.0 * 0x100) ; + ucptr = ((unsigned char*) dest) + 3 * count ; + + while (--count >= 0) + { ucptr -= 3 ; + scaled_value = src [count] * normfact ; + if (CPU_CLIPS_POSITIVE == 0 && scaled_value >= (1.0 * 0x7FFFFFFF)) + { ucptr [0] = 0x7F ; + ucptr [1] = 0xFF ; + ucptr [2] = 0xFF ; + continue ; + } ; + if (CPU_CLIPS_NEGATIVE == 0 && scaled_value <= (-8.0 * 0x10000000)) + { ucptr [0] = 0x80 ; + ucptr [1] = 0x00 ; + ucptr [2] = 0x00 ; + continue ; + } ; + + value = lrint (scaled_value) ; + ucptr [0] = value >> 24 ; + ucptr [1] = value >> 16 ; + ucptr [2] = value >> 8 ; + } ; +} /* f2bet_clip_array */ + +static sf_count_t +pcm_write_f2bet (SF_PRIVATE *psf, float *ptr, sf_count_t len) +{ void (*convert) (float *, tribyte *, int, int) ; + int bufferlen, writecount ; + sf_count_t total = 0 ; + + convert = (psf->add_clipping) ? f2bet_clip_array : f2bet_array ; + bufferlen = sizeof (psf->u.ucbuf) / SIZEOF_TRIBYTE ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + convert (ptr + total, (tribyte*) (psf->u.ucbuf), bufferlen, psf->norm_float) ; + writecount = psf_fwrite (psf->u.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ; + total += writecount ; + if (writecount < bufferlen) + break ; + len -= writecount ; + } ; + + return total ; +} /* pcm_write_f2bet */ + +/*============================================================================== +*/ + +static void +f2bei_array (float *src, int *dest, int count, int normalize) +{ unsigned char *ucptr ; + float normfact ; + int value ; + + normfact = normalize ? (1.0 * 0x7FFFFFFF) : 1.0 ; + ucptr = ((unsigned char*) dest) + 4 * count ; + while (--count >= 0) + { ucptr -= 4 ; + value = lrintf (src [count] * normfact) ; + ucptr [0] = value >> 24 ; + ucptr [1] = value >> 16 ; + ucptr [2] = value >> 8 ; + ucptr [3] = value ; + } ; +} /* f2bei_array */ + +static void +f2bei_clip_array (float *src, int *dest, int count, int normalize) +{ unsigned char *ucptr ; + float normfact, scaled_value ; + int value ; + + normfact = normalize ? (8.0 * 0x10000000) : 1.0 ; + ucptr = ((unsigned char*) dest) + 4 * count ; + + while (--count >= 0) + { ucptr -= 4 ; + scaled_value = src [count] * normfact ; + if (CPU_CLIPS_POSITIVE == 0 && scaled_value >= 1.0 * 0x7FFFFFFF) + { ucptr [0] = 0x7F ; + ucptr [1] = 0xFF ; + ucptr [2] = 0xFF ; + ucptr [3] = 0xFF ; + continue ; + } ; + if (CPU_CLIPS_NEGATIVE == 0 && scaled_value <= (-8.0 * 0x10000000)) + { ucptr [0] = 0x80 ; + ucptr [1] = 0x00 ; + ucptr [2] = 0x00 ; + ucptr [3] = 0x00 ; + continue ; + } ; + + value = lrintf (scaled_value) ; + ucptr [0] = value >> 24 ; + ucptr [1] = value >> 16 ; + ucptr [2] = value >> 8 ; + ucptr [3] = value ; + } ; +} /* f2bei_clip_array */ + +static sf_count_t +pcm_write_f2bei (SF_PRIVATE *psf, float *ptr, sf_count_t len) +{ void (*convert) (float *, int *, int, int) ; + int bufferlen, writecount ; + sf_count_t total = 0 ; + + convert = (psf->add_clipping) ? f2bei_clip_array : f2bei_array ; + bufferlen = ARRAY_LEN (psf->u.ibuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + convert (ptr + total, psf->u.ibuf, bufferlen, psf->norm_float) ; + writecount = psf_fwrite (psf->u.ibuf, sizeof (int), bufferlen, psf) ; + total += writecount ; + if (writecount < bufferlen) + break ; + len -= writecount ; + } ; + + return total ; +} /* pcm_write_f2bei */ + +/*============================================================================== +*/ + +static void +f2lei_array (float *src, int *dest, int count, int normalize) +{ unsigned char *ucptr ; + float normfact ; + int value ; + + normfact = normalize ? (1.0 * 0x7FFFFFFF) : 1.0 ; + ucptr = ((unsigned char*) dest) + 4 * count ; + + while (--count >= 0) + { ucptr -= 4 ; + value = lrintf (src [count] * normfact) ; + ucptr [0] = value ; + ucptr [1] = value >> 8 ; + ucptr [2] = value >> 16 ; + ucptr [3] = value >> 24 ; + } ; +} /* f2lei_array */ + +static void +f2lei_clip_array (float *src, int *dest, int count, int normalize) +{ unsigned char *ucptr ; + float normfact, scaled_value ; + int value ; + + normfact = normalize ? (8.0 * 0x10000000) : 1.0 ; + ucptr = ((unsigned char*) dest) + 4 * count ; + + while (--count >= 0) + { ucptr -= 4 ; + scaled_value = src [count] * normfact ; + if (CPU_CLIPS_POSITIVE == 0 && scaled_value >= (1.0 * 0x7FFFFFFF)) + { ucptr [0] = 0xFF ; + ucptr [1] = 0xFF ; + ucptr [2] = 0xFF ; + ucptr [3] = 0x7F ; + continue ; + } ; + if (CPU_CLIPS_NEGATIVE == 0 && scaled_value <= (-8.0 * 0x10000000)) + { ucptr [0] = 0x00 ; + ucptr [1] = 0x00 ; + ucptr [2] = 0x00 ; + ucptr [3] = 0x80 ; + continue ; + } ; + + value = lrintf (scaled_value) ; + ucptr [0] = value ; + ucptr [1] = value >> 8 ; + ucptr [2] = value >> 16 ; + ucptr [3] = value >> 24 ; + } ; +} /* f2lei_clip_array */ + +static sf_count_t +pcm_write_f2lei (SF_PRIVATE *psf, float *ptr, sf_count_t len) +{ void (*convert) (float *, int *, int, int) ; + int bufferlen, writecount ; + sf_count_t total = 0 ; + + convert = (psf->add_clipping) ? f2lei_clip_array : f2lei_array ; + bufferlen = ARRAY_LEN (psf->u.ibuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + convert (ptr + total, psf->u.ibuf, bufferlen, psf->norm_float) ; + writecount = psf_fwrite (psf->u.ibuf, sizeof (int), bufferlen, psf) ; + total += writecount ; + if (writecount < bufferlen) + break ; + len -= writecount ; + } ; + + return total ; +} /* pcm_write_f2lei */ + +/*============================================================================== +*/ + +static void +d2sc_array (double *src, signed char *dest, int count, int normalize) +{ double normfact ; + + normfact = normalize ? (1.0 * 0x7F) : 1.0 ; + + while (--count >= 0) + { dest [count] = lrint (src [count] * normfact) ; + } ; +} /* d2sc_array */ + +static void +d2sc_clip_array (double *src, signed char *dest, int count, int normalize) +{ double normfact, scaled_value ; + + normfact = normalize ? (8.0 * 0x10000000) : (1.0 * 0x1000000) ; + + while (--count >= 0) + { scaled_value = src [count] * normfact ; + if (CPU_CLIPS_POSITIVE == 0 && scaled_value >= (1.0 * 0x7FFFFFFF)) + { dest [count] = 127 ; + continue ; + } ; + if (CPU_CLIPS_NEGATIVE == 0 && scaled_value <= (-8.0 * 0x10000000)) + { dest [count] = -128 ; + continue ; + } ; + + dest [count] = lrintf (scaled_value) >> 24 ; + } ; +} /* d2sc_clip_array */ + +static sf_count_t +pcm_write_d2sc (SF_PRIVATE *psf, double *ptr, sf_count_t len) +{ void (*convert) (double *, signed char *, int, int) ; + int bufferlen, writecount ; + sf_count_t total = 0 ; + + convert = (psf->add_clipping) ? d2sc_clip_array : d2sc_array ; + bufferlen = ARRAY_LEN (psf->u.scbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + convert (ptr + total, psf->u.scbuf, bufferlen, psf->norm_double) ; + writecount = psf_fwrite (psf->u.scbuf, sizeof (signed char), bufferlen, psf) ; + total += writecount ; + if (writecount < bufferlen) + break ; + len -= writecount ; + } ; + + return total ; +} /* pcm_write_d2sc */ + +/*============================================================================== +*/ + +static void +d2uc_array (double *src, unsigned char *dest, int count, int normalize) +{ double normfact ; + + normfact = normalize ? (1.0 * 0x7F) : 1.0 ; + + while (--count >= 0) + { dest [count] = lrint (src [count] * normfact) + 128 ; + } ; +} /* d2uc_array */ + +static void +d2uc_clip_array (double *src, unsigned char *dest, int count, int normalize) +{ double normfact, scaled_value ; + + normfact = normalize ? (8.0 * 0x10000000) : (1.0 * 0x1000000) ; + + while (--count >= 0) + { scaled_value = src [count] * normfact ; + if (CPU_CLIPS_POSITIVE == 0 && scaled_value >= (1.0 * 0x7FFFFFFF)) + { dest [count] = 255 ; + continue ; + } ; + if (CPU_CLIPS_NEGATIVE == 0 && scaled_value <= (-8.0 * 0x10000000)) + { dest [count] = 0 ; + continue ; + } ; + + dest [count] = (lrint (src [count] * normfact) >> 24) + 128 ; + } ; +} /* d2uc_clip_array */ + +static sf_count_t +pcm_write_d2uc (SF_PRIVATE *psf, double *ptr, sf_count_t len) +{ void (*convert) (double *, unsigned char *, int, int) ; + int bufferlen, writecount ; + sf_count_t total = 0 ; + + convert = (psf->add_clipping) ? d2uc_clip_array : d2uc_array ; + bufferlen = ARRAY_LEN (psf->u.ucbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + convert (ptr + total, psf->u.ucbuf, bufferlen, psf->norm_double) ; + writecount = psf_fwrite (psf->u.ucbuf, sizeof (unsigned char), bufferlen, psf) ; + total += writecount ; + if (writecount < bufferlen) + break ; + len -= writecount ; + } ; + + return total ; +} /* pcm_write_d2uc */ + +/*============================================================================== +*/ + +static void +d2bes_array (double *src, short *dest, int count, int normalize) +{ unsigned char *ucptr ; + short value ; + double normfact ; + + normfact = normalize ? (1.0 * 0x7FFF) : 1.0 ; + ucptr = ((unsigned char*) dest) + 2 * count ; + + while (--count >= 0) + { ucptr -= 2 ; + value = lrint (src [count] * normfact) ; + ucptr [1] = value ; + ucptr [0] = value >> 8 ; + } ; +} /* d2bes_array */ + +static void +d2bes_clip_array (double *src, short *dest, int count, int normalize) +{ unsigned char *ucptr ; + double normfact, scaled_value ; + int value ; + + normfact = normalize ? (8.0 * 0x10000000) : (1.0 * 0x10000) ; + ucptr = ((unsigned char*) dest) + 2 * count ; + + while (--count >= 0) + { ucptr -= 2 ; + scaled_value = src [count] * normfact ; + if (CPU_CLIPS_POSITIVE == 0 && scaled_value >= (1.0 * 0x7FFFFFFF)) + { ucptr [1] = 0xFF ; + ucptr [0] = 0x7F ; + continue ; + } ; + if (CPU_CLIPS_NEGATIVE == 0 && scaled_value <= (-8.0 * 0x10000000)) + { ucptr [1] = 0x00 ; + ucptr [0] = 0x80 ; + continue ; + } ; + + value = lrint (scaled_value) ; + ucptr [1] = value >> 16 ; + ucptr [0] = value >> 24 ; + } ; +} /* d2bes_clip_array */ + +static sf_count_t +pcm_write_d2bes (SF_PRIVATE *psf, double *ptr, sf_count_t len) +{ void (*convert) (double *, short *, int, int) ; + int bufferlen, writecount ; + sf_count_t total = 0 ; + + convert = (psf->add_clipping) ? d2bes_clip_array : d2bes_array ; + bufferlen = ARRAY_LEN (psf->u.sbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + convert (ptr + total, psf->u.sbuf, bufferlen, psf->norm_double) ; + writecount = psf_fwrite (psf->u.sbuf, sizeof (short), bufferlen, psf) ; + total += writecount ; + if (writecount < bufferlen) + break ; + len -= writecount ; + } ; + + return total ; +} /* pcm_write_d2bes */ + +/*============================================================================== +*/ + +static void +d2les_array (double *src, short *dest, int count, int normalize) +{ unsigned char *ucptr ; + short value ; + double normfact ; + + normfact = normalize ? (1.0 * 0x7FFF) : 1.0 ; + ucptr = ((unsigned char*) dest) + 2 * count ; + + while (--count >= 0) + { ucptr -= 2 ; + value = lrint (src [count] * normfact) ; + ucptr [0] = value ; + ucptr [1] = value >> 8 ; + } ; +} /* d2les_array */ + +static void +d2les_clip_array (double *src, short *dest, int count, int normalize) +{ unsigned char *ucptr ; + int value ; + double normfact, scaled_value ; + + normfact = normalize ? (8.0 * 0x10000000) : (1.0 * 0x10000) ; + ucptr = ((unsigned char*) dest) + 2 * count ; + + while (--count >= 0) + { ucptr -= 2 ; + scaled_value = src [count] * normfact ; + if (CPU_CLIPS_POSITIVE == 0 && scaled_value >= (1.0 * 0x7FFFFFFF)) + { ucptr [0] = 0xFF ; + ucptr [1] = 0x7F ; + continue ; + } ; + if (CPU_CLIPS_NEGATIVE == 0 && scaled_value <= (-8.0 * 0x10000000)) + { ucptr [0] = 0x00 ; + ucptr [1] = 0x80 ; + continue ; + } ; + + value = lrint (scaled_value) ; + ucptr [0] = value >> 16 ; + ucptr [1] = value >> 24 ; + } ; +} /* d2les_clip_array */ + +static sf_count_t +pcm_write_d2les (SF_PRIVATE *psf, double *ptr, sf_count_t len) +{ void (*convert) (double *, short *, int, int) ; + int bufferlen, writecount ; + sf_count_t total = 0 ; + + convert = (psf->add_clipping) ? d2les_clip_array : d2les_array ; + bufferlen = ARRAY_LEN (psf->u.sbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + convert (ptr + total, psf->u.sbuf, bufferlen, psf->norm_double) ; + writecount = psf_fwrite (psf->u.sbuf, sizeof (short), bufferlen, psf) ; + total += writecount ; + if (writecount < bufferlen) + break ; + len -= writecount ; + } ; + + return total ; +} /* pcm_write_d2les */ + +/*============================================================================== +*/ + +static void +d2let_array (double *src, tribyte *dest, int count, int normalize) +{ unsigned char *ucptr ; + int value ; + double normfact ; + + normfact = normalize ? (1.0 * 0x7FFFFF) : 1.0 ; + ucptr = ((unsigned char*) dest) + 3 * count ; + + while (--count >= 0) + { ucptr -= 3 ; + value = lrint (src [count] * normfact) ; + ucptr [0] = value ; + ucptr [1] = value >> 8 ; + ucptr [2] = value >> 16 ; + } ; +} /* d2let_array */ + +static void +d2let_clip_array (double *src, tribyte *dest, int count, int normalize) +{ unsigned char *ucptr ; + int value ; + double normfact, scaled_value ; + + normfact = normalize ? (8.0 * 0x10000000) : (1.0 * 0x100) ; + ucptr = ((unsigned char*) dest) + 3 * count ; + + while (--count >= 0) + { ucptr -= 3 ; + scaled_value = src [count] * normfact ; + if (CPU_CLIPS_POSITIVE == 0 && scaled_value >= (1.0 * 0x7FFFFFFF)) + { ucptr [0] = 0xFF ; + ucptr [1] = 0xFF ; + ucptr [2] = 0x7F ; + continue ; + } ; + if (CPU_CLIPS_NEGATIVE == 0 && scaled_value <= (-8.0 * 0x10000000)) + { ucptr [0] = 0x00 ; + ucptr [1] = 0x00 ; + ucptr [2] = 0x80 ; + continue ; + } ; + + value = lrint (scaled_value) ; + ucptr [0] = value >> 8 ; + ucptr [1] = value >> 16 ; + ucptr [2] = value >> 24 ; + } ; +} /* d2let_clip_array */ + +static sf_count_t +pcm_write_d2let (SF_PRIVATE *psf, double *ptr, sf_count_t len) +{ void (*convert) (double *, tribyte *, int, int) ; + int bufferlen, writecount ; + sf_count_t total = 0 ; + + convert = (psf->add_clipping) ? d2let_clip_array : d2let_array ; + bufferlen = sizeof (psf->u.ucbuf) / SIZEOF_TRIBYTE ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + convert (ptr + total, (tribyte*) (psf->u.ucbuf), bufferlen, psf->norm_double) ; + writecount = psf_fwrite (psf->u.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ; + total += writecount ; + if (writecount < bufferlen) + break ; + len -= writecount ; + } ; + + return total ; +} /* pcm_write_d2let */ + +/*============================================================================== +*/ + +static void +d2bet_array (double *src, tribyte *dest, int count, int normalize) +{ unsigned char *ucptr ; + int value ; + double normfact ; + + normfact = normalize ? (1.0 * 0x7FFFFF) : 1.0 ; + ucptr = ((unsigned char*) dest) + 3 * count ; + + while (--count >= 0) + { ucptr -= 3 ; + value = lrint (src [count] * normfact) ; + ucptr [2] = value ; + ucptr [1] = value >> 8 ; + ucptr [0] = value >> 16 ; + } ; +} /* d2bet_array */ + +static void +d2bet_clip_array (double *src, tribyte *dest, int count, int normalize) +{ unsigned char *ucptr ; + int value ; + double normfact, scaled_value ; + + normfact = normalize ? (8.0 * 0x10000000) : (1.0 * 0x100) ; + ucptr = ((unsigned char*) dest) + 3 * count ; + + while (--count >= 0) + { ucptr -= 3 ; + scaled_value = src [count] * normfact ; + if (CPU_CLIPS_POSITIVE == 0 && scaled_value >= (1.0 * 0x7FFFFFFF)) + { ucptr [2] = 0xFF ; + ucptr [1] = 0xFF ; + ucptr [0] = 0x7F ; + continue ; + } ; + if (CPU_CLIPS_NEGATIVE == 0 && scaled_value <= (-8.0 * 0x10000000)) + { ucptr [2] = 0x00 ; + ucptr [1] = 0x00 ; + ucptr [0] = 0x80 ; + continue ; + } ; + + value = lrint (scaled_value) ; + ucptr [2] = value >> 8 ; + ucptr [1] = value >> 16 ; + ucptr [0] = value >> 24 ; + } ; +} /* d2bet_clip_array */ + +static sf_count_t +pcm_write_d2bet (SF_PRIVATE *psf, double *ptr, sf_count_t len) +{ void (*convert) (double *, tribyte *, int, int) ; + int bufferlen, writecount ; + sf_count_t total = 0 ; + + convert = (psf->add_clipping) ? d2bet_clip_array : d2bet_array ; + bufferlen = sizeof (psf->u.ucbuf) / SIZEOF_TRIBYTE ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + convert (ptr + total, (tribyte*) (psf->u.ucbuf), bufferlen, psf->norm_double) ; + writecount = psf_fwrite (psf->u.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ; + total += writecount ; + if (writecount < bufferlen) + break ; + len -= writecount ; + } ; + + return total ; +} /* pcm_write_d2bet */ + +/*============================================================================== +*/ + +static void +d2bei_array (double *src, int *dest, int count, int normalize) +{ unsigned char *ucptr ; + int value ; + double normfact ; + + normfact = normalize ? (1.0 * 0x7FFFFFFF) : 1.0 ; + ucptr = ((unsigned char*) dest) + 4 * count ; + + while (--count >= 0) + { ucptr -= 4 ; + value = lrint (src [count] * normfact) ; + ucptr [0] = value >> 24 ; + ucptr [1] = value >> 16 ; + ucptr [2] = value >> 8 ; + ucptr [3] = value ; + } ; +} /* d2bei_array */ + +static void +d2bei_clip_array (double *src, int *dest, int count, int normalize) +{ unsigned char *ucptr ; + int value ; + double normfact, scaled_value ; + + normfact = normalize ? (8.0 * 0x10000000) : 1.0 ; + ucptr = ((unsigned char*) dest) + 4 * count ; + + while (--count >= 0) + { ucptr -= 4 ; + scaled_value = src [count] * normfact ; + if (CPU_CLIPS_POSITIVE == 0 && scaled_value >= (1.0 * 0x7FFFFFFF)) + { ucptr [3] = 0xFF ; + ucptr [2] = 0xFF ; + ucptr [1] = 0xFF ; + ucptr [0] = 0x7F ; + continue ; + } ; + if (CPU_CLIPS_NEGATIVE == 0 && scaled_value <= (-8.0 * 0x10000000)) + { ucptr [3] = 0x00 ; + ucptr [2] = 0x00 ; + ucptr [1] = 0x00 ; + ucptr [0] = 0x80 ; + continue ; + } ; + + value = lrint (scaled_value) ; + ucptr [0] = value >> 24 ; + ucptr [1] = value >> 16 ; + ucptr [2] = value >> 8 ; + ucptr [3] = value ; + } ; +} /* d2bei_clip_array */ + +static sf_count_t +pcm_write_d2bei (SF_PRIVATE *psf, double *ptr, sf_count_t len) +{ void (*convert) (double *, int *, int, int) ; + int bufferlen, writecount ; + sf_count_t total = 0 ; + + convert = (psf->add_clipping) ? d2bei_clip_array : d2bei_array ; + bufferlen = ARRAY_LEN (psf->u.ibuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + convert (ptr + total, psf->u.ibuf, bufferlen, psf->norm_double) ; + writecount = psf_fwrite (psf->u.ibuf, sizeof (int), bufferlen, psf) ; + total += writecount ; + if (writecount < bufferlen) + break ; + len -= writecount ; + } ; + + return total ; +} /* pcm_write_d2bei */ + +/*============================================================================== +*/ + +static void +d2lei_array (double *src, int *dest, int count, int normalize) +{ unsigned char *ucptr ; + int value ; + double normfact ; + + normfact = normalize ? (1.0 * 0x7FFFFFFF) : 1.0 ; + ucptr = ((unsigned char*) dest) + 4 * count ; + + while (--count >= 0) + { ucptr -= 4 ; + value = lrint (src [count] * normfact) ; + ucptr [0] = value ; + ucptr [1] = value >> 8 ; + ucptr [2] = value >> 16 ; + ucptr [3] = value >> 24 ; + } ; +} /* d2lei_array */ + +static void +d2lei_clip_array (double *src, int *dest, int count, int normalize) +{ unsigned char *ucptr ; + int value ; + double normfact, scaled_value ; + + normfact = normalize ? (8.0 * 0x10000000) : 1.0 ; + ucptr = ((unsigned char*) dest) + 4 * count ; + + while (--count >= 0) + { ucptr -= 4 ; + scaled_value = src [count] * normfact ; + if (CPU_CLIPS_POSITIVE == 0 && scaled_value >= (1.0 * 0x7FFFFFFF)) + { ucptr [0] = 0xFF ; + ucptr [1] = 0xFF ; + ucptr [2] = 0xFF ; + ucptr [3] = 0x7F ; + continue ; + } ; + if (CPU_CLIPS_NEGATIVE == 0 && scaled_value <= (-8.0 * 0x10000000)) + { ucptr [0] = 0x00 ; + ucptr [1] = 0x00 ; + ucptr [2] = 0x00 ; + ucptr [3] = 0x80 ; + continue ; + } ; + + value = lrint (scaled_value) ; + ucptr [0] = value ; + ucptr [1] = value >> 8 ; + ucptr [2] = value >> 16 ; + ucptr [3] = value >> 24 ; + } ; +} /* d2lei_clip_array */ + +static sf_count_t +pcm_write_d2lei (SF_PRIVATE *psf, double *ptr, sf_count_t len) +{ void (*convert) (double *, int *, int, int) ; + int bufferlen, writecount ; + sf_count_t total = 0 ; + + convert = (psf->add_clipping) ? d2lei_clip_array : d2lei_array ; + bufferlen = ARRAY_LEN (psf->u.ibuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + convert (ptr + total, psf->u.ibuf, bufferlen, psf->norm_double) ; + writecount = psf_fwrite (psf->u.ibuf, sizeof (int), bufferlen, psf) ; + total += writecount ; + if (writecount < bufferlen) + break ; + len -= writecount ; + } ; + + return total ; +} /* pcm_write_d2lei */ + +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: d8bc7c0e-1e2f-4ff3-a28f-10ce1fbade3b +*/ diff --git a/Libraries/SndFile/Files/src/pvf.c b/Libraries/SndFile/Files/src/pvf.c new file mode 100644 index 000000000..d92b1c61c --- /dev/null +++ b/Libraries/SndFile/Files/src/pvf.c @@ -0,0 +1,200 @@ +/* +** Copyright (C) 2002-2004 Erik de Castro Lopo +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU Lesser General Public License as published by +** the Free Software Foundation; either version 2.1 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU Lesser General Public License for more details. +** +** You should have received a copy of the GNU Lesser General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include +#include +#include +#include + +#include "sndfile.h" +#include "config.h" +#include "sfendian.h" +#include "common.h" + +/*------------------------------------------------------------------------------ +** Macros to handle big/little endian issues. +*/ + +#define PVF1_MARKER (MAKE_MARKER ('P', 'V', 'F', '1')) + +/*------------------------------------------------------------------------------ +** Private static functions. +*/ + +static int pvf_close (SF_PRIVATE *psf) ; + +static int pvf_write_header (SF_PRIVATE *psf, int calc_length) ; +static int pvf_read_header (SF_PRIVATE *psf) ; + +/*------------------------------------------------------------------------------ +** Public function. +*/ + +int +pvf_open (SF_PRIVATE *psf) +{ int subformat ; + int error = 0 ; + + if (psf->mode == SFM_READ || (psf->mode == SFM_RDWR && psf->filelength > 0)) + { if ((error = pvf_read_header (psf))) + return error ; + } ; + + subformat = psf->sf.format & SF_FORMAT_SUBMASK ; + + if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR) + { if ((psf->sf.format & SF_FORMAT_TYPEMASK) != SF_FORMAT_PVF) + return SFE_BAD_OPEN_FORMAT ; + + psf->endian = SF_ENDIAN_BIG ; + + if (pvf_write_header (psf, SF_FALSE)) + return psf->error ; + + psf->write_header = pvf_write_header ; + } ; + + psf->close = pvf_close ; + + psf->blockwidth = psf->bytewidth * psf->sf.channels ; + + switch (subformat) + { case SF_FORMAT_PCM_S8 : /* 8-bit linear PCM. */ + case SF_FORMAT_PCM_16 : /* 16-bit linear PCM. */ + case SF_FORMAT_PCM_32 : /* 32-bit linear PCM. */ + error = pcm_init (psf) ; + break ; + + default : break ; + } ; + + return error ; +} /* pvf_open */ + +/*------------------------------------------------------------------------------ +*/ + +static int +pvf_close (SF_PRIVATE *psf) +{ + psf = psf ; + + return 0 ; +} /* pvf_close */ + +static int +pvf_write_header (SF_PRIVATE *psf, int calc_length) +{ sf_count_t current ; + + if (psf->pipeoffset > 0) + return 0 ; + + calc_length = calc_length ; /* Avoid a compiler warning. */ + + current = psf_ftell (psf) ; + + /* Reset the current header length to zero. */ + psf->header [0] = 0 ; + psf->headindex = 0 ; + + if (psf->is_pipe == SF_FALSE) + psf_fseek (psf, 0, SEEK_SET) ; + + LSF_SNPRINTF ((char*) psf->header, sizeof (psf->header), "PVF1\n%d %d %d\n", + psf->sf.channels, psf->sf.samplerate, psf->bytewidth * 8) ; + + psf->headindex = strlen ((char*) psf->header) ; + + /* Header construction complete so write it out. */ + psf_fwrite (psf->header, psf->headindex, 1, psf) ; + + if (psf->error) + return psf->error ; + + psf->dataoffset = psf->headindex ; + + if (current > 0) + psf_fseek (psf, current, SEEK_SET) ; + + return psf->error ; +} /* pvf_write_header */ + +static int +pvf_read_header (SF_PRIVATE *psf) +{ char buffer [32] ; + int marker, channels, samplerate, bitwidth ; + + psf_binheader_readf (psf, "pmj", 0, &marker, 1) ; + psf_log_printf (psf, "%M\n", marker) ; + + if (marker != PVF1_MARKER) + return SFE_PVF_NO_PVF1 ; + + /* Grab characters up until a newline which is replaced by an EOS. */ + psf_binheader_readf (psf, "G", buffer, sizeof (buffer)) ; + + if (sscanf (buffer, "%d %d %d", &channels, &samplerate, &bitwidth) != 3) + return SFE_PVF_BAD_HEADER ; + + psf_log_printf (psf, " Channels : %d\n Sample rate : %d\n Bit width : %d\n", + channels, samplerate, bitwidth) ; + + psf->sf.channels = channels ; + psf->sf.samplerate = samplerate ; + + switch (bitwidth) + { case 8 : + psf->sf.format = SF_FORMAT_PVF | SF_FORMAT_PCM_S8 ; + psf->bytewidth = 1 ; + break ; + + case 16 : + psf->sf.format = SF_FORMAT_PVF | SF_FORMAT_PCM_16 ; + psf->bytewidth = 2 ; + break ; + case 32 : + psf->sf.format = SF_FORMAT_PVF | SF_FORMAT_PCM_32 ; + psf->bytewidth = 4 ; + break ; + + default : + return SFE_PVF_BAD_BITWIDTH ; + } ; + + psf->dataoffset = psf_ftell (psf) ; + psf_log_printf (psf, " Data Offset : %D\n", psf->dataoffset) ; + + psf->endian = SF_ENDIAN_BIG ; + + psf->datalength = psf->filelength - psf->dataoffset ; + psf->blockwidth = psf->sf.channels * psf->bytewidth ; + + psf->close = pvf_close ; + + if (! psf->sf.frames && psf->blockwidth) + psf->sf.frames = (psf->filelength - psf->dataoffset) / psf->blockwidth ; + + return 0 ; +} /* pvf_read_header */ +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: 20a26761-8bc1-41d7-b1f3-9793bf3d9864 +*/ diff --git a/Libraries/SndFile/Files/src/raw.c b/Libraries/SndFile/Files/src/raw.c new file mode 100644 index 000000000..2efa9672d --- /dev/null +++ b/Libraries/SndFile/Files/src/raw.c @@ -0,0 +1,110 @@ +/* +** Copyright (C) 1999-2004 Erik de Castro Lopo +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU Lesser General Public License as published by +** the Free Software Foundation; either version 2.1 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU Lesser General Public License for more details. +** +** You should have received a copy of the GNU Lesser General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include + +#include "sndfile.h" +#include "config.h" +#include "common.h" + +/*------------------------------------------------------------------------------ +** Public function. +*/ + +int +raw_open (SF_PRIVATE *psf) +{ int subformat, error = SFE_NO_ERROR ; + + subformat = psf->sf.format & SF_FORMAT_SUBMASK ; + + psf->endian = psf->sf.format & SF_FORMAT_ENDMASK ; + + if (CPU_IS_BIG_ENDIAN && (psf->endian == 0 || psf->endian == SF_ENDIAN_CPU)) + psf->endian = SF_ENDIAN_BIG ; + else if (CPU_IS_LITTLE_ENDIAN && (psf->endian == 0 || psf->endian == SF_ENDIAN_CPU)) + psf->endian = SF_ENDIAN_LITTLE ; + + psf->blockwidth = psf->bytewidth * psf->sf.channels ; + psf->dataoffset = 0 ; + psf->datalength = psf->filelength ; + + switch (subformat) + { case SF_FORMAT_PCM_S8 : + error = pcm_init (psf) ; + break ; + + case SF_FORMAT_PCM_U8 : + error = pcm_init (psf) ; + break ; + + case SF_FORMAT_PCM_16 : + case SF_FORMAT_PCM_24 : + case SF_FORMAT_PCM_32 : + error = pcm_init (psf) ; + break ; + + case SF_FORMAT_ULAW : + error = ulaw_init (psf) ; + break ; + + case SF_FORMAT_ALAW : + error = alaw_init (psf) ; + break ; + + case SF_FORMAT_GSM610 : + error = gsm610_init (psf) ; + break ; + + /* Lite remove start */ + case SF_FORMAT_FLOAT : + error = float32_init (psf) ; + break ; + + case SF_FORMAT_DOUBLE : + error = double64_init (psf) ; + break ; + + case SF_FORMAT_DWVW_12 : + error = dwvw_init (psf, 12) ; + break ; + + case SF_FORMAT_DWVW_16 : + error = dwvw_init (psf, 16) ; + break ; + + case SF_FORMAT_DWVW_24 : + error = dwvw_init (psf, 24) ; + break ; + + case SF_FORMAT_VOX_ADPCM : + error = vox_adpcm_init (psf) ; + break ; + /* Lite remove end */ + + default : return SFE_BAD_OPEN_FORMAT ; + } ; + + return error ; +} /* raw_open */ +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: f0066de7-d6ce-4f36-a1e0-e475c07d4e1a +*/ diff --git a/Libraries/SndFile/Files/src/rx2.c b/Libraries/SndFile/Files/src/rx2.c new file mode 100644 index 000000000..e6c117989 --- /dev/null +++ b/Libraries/SndFile/Files/src/rx2.c @@ -0,0 +1,325 @@ +/* +** Copyright (C) 2001-2004 Erik de Castro Lopo +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU Lesser General Public License as published by +** the Free Software Foundation; either version 2.1 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU Lesser General Public License for more details. +** +** You should have received a copy of the GNU Lesser General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include +#include +#include +#include + +#include "sndfile.h" +#include "config.h" +#include "sfendian.h" +#include "common.h" + +#if (ENABLE_EXPERIMENTAL_CODE == 0) + +int +rx2_open (SF_PRIVATE *psf) +{ if (psf) + return SFE_UNIMPLEMENTED ; + return (psf && 0) ; +} /* rx2_open */ + +#else + +/*------------------------------------------------------------------------------ + * Macros to handle big/little endian issues. +*/ + +#define CAT_MARKER (MAKE_MARKER ('C', 'A', 'T', ' ')) +#define GLOB_MARKER (MAKE_MARKER ('G', 'L', 'O', 'B')) + +#define RECY_MARKER (MAKE_MARKER ('R', 'E', 'C', 'Y')) + +#define SLCL_MARKER (MAKE_MARKER ('S', 'L', 'C', 'L')) +#define SLCE_MARKER (MAKE_MARKER ('S', 'L', 'C', 'E')) + +#define DEVL_MARKER (MAKE_MARKER ('D', 'E', 'V', 'L')) +#define TRSH_MARKER (MAKE_MARKER ('T', 'R', 'S', 'H')) + +#define EQ_MARKER (MAKE_MARKER ('E', 'Q', ' ', ' ')) +#define COMP_MARKER (MAKE_MARKER ('C', 'O', 'M', 'P')) + +#define SINF_MARKER (MAKE_MARKER ('S', 'I', 'N', 'F')) +#define SDAT_MARKER (MAKE_MARKER ('S', 'D', 'A', 'T')) + +/*------------------------------------------------------------------------------ + * Typedefs for file chunks. +*/ + + +/*------------------------------------------------------------------------------ + * Private static functions. +*/ +static int rx2_close (SF_PRIVATE *psf) ; + +/*------------------------------------------------------------------------------ +** Public functions. +*/ + +int +rx2_open (SF_PRIVATE *psf) +{ static const char *marker_type [4] = + { "Original Enabled", "Enabled Hidden", + "Additional/PencilTool", "Disabled" + } ; + + int error, marker, length, glob_offset, slce_count, frames ; + + int sdat_length = 0, slce_total = 0 ; + + int n_channels ; + + + /* So far only doing read. */ + + psf_binheader_readf (psf, "Epm4", 0, &marker, &length) ; + + if (marker != CAT_MARKER) + { psf_log_printf (psf, "length : %d\n", length) ; + return -1000 ; + } ; + + if (length != psf->filelength - 8) + psf_log_printf (psf, "%M : %d (should be %d)\n", marker, length, psf->filelength - 8) ; + else + psf_log_printf (psf, "%M : %d\n", marker, length) ; + + /* 'REX2' marker */ + psf_binheader_readf (psf, "m", &marker) ; + psf_log_printf (psf, "%M", marker) ; + + /* 'HEAD' marker */ + psf_binheader_readf (psf, "m", &marker) ; + psf_log_printf (psf, "%M\n", marker) ; + + /* Grab 'GLOB' offset. */ + psf_binheader_readf (psf, "E4", &glob_offset) ; + glob_offset += 0x14 ; /* Add the current file offset. */ + + /* Jump to offset 0x30 */ + psf_binheader_readf (psf, "p", 0x30) ; + + /* Get name length */ + length = 0 ; + psf_binheader_readf (psf, "1", &length) ; + if (length >= SIGNED_SIZEOF (psf->u.cbuf)) + { psf_log_printf (psf, " Text : %d *** Error : Too sf_count_t!\n") ; + return -1001 ; + } + + memset (psf->u.cbuf, 0, sizeof (psf->u.cbuf)) ; + psf_binheader_readf (psf, "b", psf->u.cbuf, length) ; + psf_log_printf (psf, " Text : \"%s\"\n", psf->u.cbuf) ; + + /* Jump to GLOB offset position. */ + if (glob_offset & 1) + glob_offset ++ ; + + psf_binheader_readf (psf, "p", glob_offset) ; + + slce_count = 0 ; + /* GLOB */ + while (1) + { psf_binheader_readf (psf, "m", &marker) ; + + if (marker != SLCE_MARKER && slce_count > 0) + { psf_log_printf (psf, " SLCE count : %d\n", slce_count) ; + slce_count = 0 ; + } + switch (marker) + { case GLOB_MARKER: + psf_binheader_readf (psf, "E4", &length) ; + psf_log_printf (psf, " %M : %d\n", marker, length) ; + psf_binheader_readf (psf, "j", length) ; + break ; + + case RECY_MARKER: + psf_binheader_readf (psf, "E4", &length) ; + psf_log_printf (psf, " %M : %d\n", marker, length) ; + psf_binheader_readf (psf, "j", (length+1) & 0xFFFFFFFE) ; /* ?????? */ + break ; + + case CAT_MARKER: + psf_binheader_readf (psf, "E4", &length) ; + psf_log_printf (psf, " %M : %d\n", marker, length) ; + /*-psf_binheader_readf (psf, "j", length) ;-*/ + break ; + + case DEVL_MARKER: + psf_binheader_readf (psf, "mE4", &marker, &length) ; + psf_log_printf (psf, " DEVL%M : %d\n", marker, length) ; + if (length & 1) + length ++ ; + psf_binheader_readf (psf, "j", length) ; + break ; + + case EQ_MARKER: + case COMP_MARKER: + psf_binheader_readf (psf, "E4", &length) ; + psf_log_printf (psf, " %M : %d\n", marker, length) ; + /* This is weird!!!! why make this (length - 1) */ + if (length & 1) + length ++ ; + psf_binheader_readf (psf, "j", length) ; + break ; + + case SLCL_MARKER: + psf_log_printf (psf, " %M\n (Offset, Next Offset, Type)\n", marker) ; + slce_count = 0 ; + break ; + + case SLCE_MARKER: + { int len [4], indx ; + + psf_binheader_readf (psf, "E4444", &len [0], &len [1], &len [2], &len [3]) ; + + indx = ((len [3] & 0x0000FFFF) >> 8) & 3 ; + + if (len [2] == 1) + { if (indx != 1) + indx = 3 ; /* 2 cases, where next slice offset = 1 -> disabled & enabled/hidden */ + + psf_log_printf (psf, " %M : (%6d, ?: 0x%X, %s)\n", marker, len [1], (len [3] & 0xFFFF0000) >> 16, marker_type [indx]) ; + } + else + { slce_total += len [2] ; + + psf_log_printf (psf, " %M : (%6d, SLCE_next_ofs:%d, ?: 0x%X, %s)\n", marker, len [1], len [2], (len [3] & 0xFFFF0000) >> 16, marker_type [indx]) ; + } ; + + slce_count ++ ; + } ; + break ; + + case SINF_MARKER: + psf_binheader_readf (psf, "E4", &length) ; + psf_log_printf (psf, " %M : %d\n", marker, length) ; + + psf_binheader_readf (psf, "E2", &n_channels) ; + n_channels = (n_channels & 0x0000FF00) >> 8 ; + psf_log_printf (psf, " Channels : %d\n", n_channels) ; + + psf_binheader_readf (psf, "E44", &psf->sf.samplerate, &frames) ; + psf->sf.frames = frames ; + psf_log_printf (psf, " Sample Rate : %d\n", psf->sf.samplerate) ; + psf_log_printf (psf, " Frames : %D\n", psf->sf.frames) ; + + psf_binheader_readf (psf, "E4", &length) ; + psf_log_printf (psf, " ??????????? : %d\n", length) ; + + psf_binheader_readf (psf, "E4", &length) ; + psf_log_printf (psf, " ??????????? : %d\n", length) ; + break ; + + case SDAT_MARKER: + psf_binheader_readf (psf, "E4", &length) ; + + sdat_length = length ; + + /* Get the current offset. */ + psf->dataoffset = psf_binheader_readf (psf, NULL) ; + + if (psf->dataoffset + length != psf->filelength) + psf_log_printf (psf, " %M : %d (should be %d)\n", marker, length, psf->dataoffset + psf->filelength) ; + else + psf_log_printf (psf, " %M : %d\n", marker, length) ; + break ; + + default : + psf_log_printf (psf, "Unknown marker : 0x%X %M", marker, marker) ; + return -1003 ; + break ; + } ; + + /* SDAT always last marker in file. */ + if (marker == SDAT_MARKER) + break ; + } ; + + puts (psf->logbuffer) ; + puts ("-----------------------------------") ; + + printf ("SDAT length : %d\n", sdat_length) ; + printf ("SLCE count : %d\n", slce_count) ; + + /* Hack for zero slice count. */ + if (slce_count == 0 && slce_total == 1) + slce_total = frames ; + + printf ("SLCE samples : %d\n", slce_total) ; + + /* Two bytes per sample. */ + printf ("Comp Ratio : %f:1\n", (2.0 * slce_total * n_channels) / sdat_length) ; + + puts (" ") ; + + psf->logbuffer [0] = 0 ; + + /* OK, have the header although not too sure what it all means. */ + + psf->endian = SF_ENDIAN_BIG ; + + psf->datalength = psf->filelength - psf->dataoffset ; + + if (psf_fseek (psf, psf->dataoffset, SEEK_SET)) + return SFE_BAD_SEEK ; + + psf->sf.format = (SF_FORMAT_REX2 | SF_FORMAT_DWVW_12) ; + + psf->sf.channels = 1 ; + psf->bytewidth = 2 ; + psf->blockwidth = psf->sf.channels * psf->bytewidth ; + + if ((error = dwvw_init (psf, 16))) + return error ; + + psf->close = rx2_close ; + + if (! psf->sf.frames && psf->blockwidth) + psf->sf.frames = psf->datalength / psf->blockwidth ; + + /* All done. */ + + return 0 ; +} /* rx2_open */ + +/*------------------------------------------------------------------------------ +*/ + +static int +rx2_close (SF_PRIVATE *psf) +{ + if (psf->mode == SFM_WRITE) + { /* Now we know for certain the length of the file we can re-write + ** correct values for the FORM, 8SVX and BODY chunks. + */ + + } ; + + return 0 ; +} /* rx2_close */ + +#endif +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: 7366e813-9fee-4d1f-881e-e4a691469370 +*/ diff --git a/Libraries/SndFile/Files/src/sd2.c b/Libraries/SndFile/Files/src/sd2.c new file mode 100644 index 000000000..b53c23a4e --- /dev/null +++ b/Libraries/SndFile/Files/src/sd2.c @@ -0,0 +1,572 @@ +/* +** Copyright (C) 2001-2004 Erik de Castro Lopo +** Copyright (C) 2004 Paavo Jumppanen +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU Lesser General Public License as published by +** the Free Software Foundation; either version 2.1 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU Lesser General Public License for more details. +** +** You should have received a copy of the GNU Lesser General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +/* +** The sd2 support implemented in this file was partially sponsored +** (financially) by Paavo Jumppanen. +*/ + +/* +** Documentation on the Mac resource fork was obtained here : +** http://developer.apple.com/documentation/mac/MoreToolbox/MoreToolbox-99.html +*/ + +#include +#include +#include +#include + +#include "sndfile.h" +#include "config.h" +#include "sfendian.h" +#include "common.h" + +/*------------------------------------------------------------------------------ + * Markers. +*/ + +#define Sd2f_MARKER MAKE_MARKER ('S', 'd', '2', 'f') +#define Sd2a_MARKER MAKE_MARKER ('S', 'd', '2', 'a') +#define ALCH_MARKER MAKE_MARKER ('A', 'L', 'C', 'H') +#define lsf1_MARKER MAKE_MARKER ('l', 's', 'f', '1') + +#define STR_MARKER MAKE_MARKER ('S', 'T', 'R', ' ') +#define sdML_MARKER MAKE_MARKER ('s', 'd', 'M', 'L') + +enum +{ RSRC_STR = 111, + RSRC_BIN +} ; + +typedef struct +{ unsigned char * rsrc_data ; + int rsrc_len ; + + int data_offset, data_length ; + int map_offset, map_length ; + + int type_count, type_offset ; + int item_offset ; + + int str_index, str_count ; + + int string_offset ; + + /* All the above just to get these three. */ + int sample_size, sample_rate, channels ; +} SD2_RSRC ; + +typedef struct +{ int type ; + int id ; + char name [32] ; + char value [32] ; + int value_len ; +} STR_RSRC ; + +/*------------------------------------------------------------------------------ + * Private static functions. +*/ + +static int sd2_close (SF_PRIVATE *psf) ; + +static int sd2_parse_rsrc_fork (SF_PRIVATE *psf) ; +static int parse_str_rsrc (SF_PRIVATE *psf, SD2_RSRC * rsrc) ; + +static int sd2_write_rsrc_fork (SF_PRIVATE *psf, int calc_length) ; + +/*------------------------------------------------------------------------------ +** Public functions. +*/ + +int +sd2_open (SF_PRIVATE *psf) +{ int saved_filedes, subformat, error = 0 ; + + /* SD2 is always big endian. */ + psf->endian = SF_ENDIAN_BIG ; + + if (psf->mode == SFM_READ || (psf->mode == SFM_RDWR && psf->rsrclength > 0)) + { if (psf->rsrcdes < 0) + { psf_log_printf (psf, "sd2_open : psf->rsrcdes < 0\n") ; + return SFE_SD2_BAD_RSRC ; + } ; + + saved_filedes = psf->filedes ; + psf->filedes = psf->rsrcdes ; + + error = sd2_parse_rsrc_fork (psf) ; + + psf->filedes = saved_filedes ; + if (error) + goto error_cleanup ; + } ; + + if ((psf->sf.format & SF_FORMAT_TYPEMASK) != SF_FORMAT_SD2) + { error = SFE_BAD_OPEN_FORMAT ; + goto error_cleanup ; + } ; + + subformat = psf->sf.format & SF_FORMAT_SUBMASK ; + psf->dataoffset = 0 ; + + /* Only open and write the resource in RDWR mode is its current length is zero. */ + if (psf->mode == SFM_WRITE || (psf->mode == SFM_RDWR && psf->rsrclength == 0)) + { psf_open_rsrc (psf, psf->mode) ; + + saved_filedes = psf->filedes ; + psf->filedes = psf->rsrcdes ; + + error = sd2_write_rsrc_fork (psf, SF_FALSE) ; + + psf->filedes = saved_filedes ; + if (error) + goto error_cleanup ; + + /* Not needed. */ + psf->write_header = NULL ; + } ; + + psf->close = sd2_close ; + + psf->blockwidth = psf->bytewidth * psf->sf.channels ; + + switch (subformat) + { case SF_FORMAT_PCM_S8 : /* 8-bit linear PCM. */ + case SF_FORMAT_PCM_16 : /* 16-bit linear PCM. */ + case SF_FORMAT_PCM_24 : /* 24-bit linear PCM */ + error = pcm_init (psf) ; + break ; + + default : + error = SFE_UNIMPLEMENTED ; + break ; + } ; + + psf_fseek (psf, psf->dataoffset, SEEK_SET) ; + +error_cleanup: + + /* Close the resource fork regardless. We won't need it again. */ + psf_close_rsrc (psf) ; + + return error ; +} /* sd2_open */ + +/*------------------------------------------------------------------------------ +*/ + +static int +sd2_close (SF_PRIVATE *psf) +{ + if (psf->mode == SFM_WRITE) + { /* Now we know for certain the audio_length of the file we can re-write + ** correct values for the FORM, 8SVX and BODY chunks. + */ + + } ; + + return 0 ; +} /* sd2_close */ + +/*------------------------------------------------------------------------------ +*/ + +static inline void +write_char (unsigned char * data, int offset, char value) +{ data [offset] = value ; +} /* write_char */ + +static inline void +write_short (unsigned char * data, int offset, short value) +{ data [offset] = value >> 8 ; + data [offset + 1] = value ; +} /* write_char */ + +static inline void +write_int (unsigned char * data, int offset, int value) +{ data [offset] = value >> 24 ; + data [offset + 1] = value >> 16 ; + data [offset + 2] = value >> 8 ; + data [offset + 3] = value ; +} /* write_int */ + +static void +write_str (unsigned char * data, int offset, char * buffer, int buffer_len) +{ memcpy (data + offset, buffer, buffer_len) ; +} /* write_str */ + +static int +sd2_write_rsrc_fork (SF_PRIVATE *psf, int UNUSED (calc_length)) +{ SD2_RSRC rsrc ; + STR_RSRC str_rsrc [] = + { { RSRC_STR, 1000, "_sample-size", "", 0 }, + { RSRC_STR, 1001, "_sample-rate", "", 0 }, + { RSRC_STR, 1002, "_channels", "", 0 }, + { RSRC_BIN, 1000, "_Markers", "", 8 } + } ; + + int k, str_offset, data_offset, next_str ; + + memset (&rsrc, 0, sizeof (rsrc)) ; + + rsrc.sample_rate = psf->sf.samplerate ; + rsrc.sample_size = psf->bytewidth ; + rsrc.channels = psf->sf.channels ; + + rsrc.rsrc_data = psf->header ; + rsrc.rsrc_len = sizeof (psf->header) ; + memset (rsrc.rsrc_data, 0xea, rsrc.rsrc_len) ; + + LSF_SNPRINTF (str_rsrc [0].value, sizeof (str_rsrc [0].value), "_%d", rsrc.sample_size) ; + LSF_SNPRINTF (str_rsrc [1].value, sizeof (str_rsrc [1].value), "_%d.000000", rsrc.sample_rate) ; + LSF_SNPRINTF (str_rsrc [2].value, sizeof (str_rsrc [2].value), "_%d", rsrc.channels) ; + + for (k = 0 ; k < ARRAY_LEN (str_rsrc) ; k++) + { if (str_rsrc [k].value_len == 0) + { str_rsrc [k].value_len = strlen (str_rsrc [k].value) ; + str_rsrc [k].value [0] = str_rsrc [k].value_len - 1 ; + } ; + + /* Turn name string into a pascal string. */ + str_rsrc [k].name [0] = strlen (str_rsrc [k].name) - 1 ; + } ; + + rsrc.data_offset = 0x100 ; + + /* + ** Calculate data length : + ** length of strings, plus the length of the sdML chunk. + */ + rsrc.data_length = 0 ; + for (k = 0 ; k < ARRAY_LEN (str_rsrc) ; k++) + rsrc.data_length += str_rsrc [k].value_len + 4 ; + + rsrc.map_offset = rsrc.data_offset + rsrc.data_length ; + + /* Very start of resource fork. */ + write_int (rsrc.rsrc_data, 0, rsrc.data_offset) ; + write_int (rsrc.rsrc_data, 4, rsrc.map_offset) ; + write_int (rsrc.rsrc_data, 8, rsrc.data_length) ; + + write_char (rsrc.rsrc_data, 0x30, strlen (psf->filename)) ; + write_str (rsrc.rsrc_data, 0x31, psf->filename, strlen (psf->filename)) ; + + write_short (rsrc.rsrc_data, 0x50, 0) ; + write_int (rsrc.rsrc_data, 0x52, Sd2f_MARKER) ; + write_int (rsrc.rsrc_data, 0x56, lsf1_MARKER) ; + + /* Very start of resource map. */ + write_int (rsrc.rsrc_data, rsrc.map_offset + 0, rsrc.data_offset) ; + write_int (rsrc.rsrc_data, rsrc.map_offset + 4, rsrc.map_offset) ; + write_int (rsrc.rsrc_data, rsrc.map_offset + 8, rsrc.data_length) ; + + /* These I don't currently understand. */ + if (1) + { write_char (rsrc.rsrc_data, rsrc.map_offset+ 16, 1) ; + /* Next resource map. */ + write_int (rsrc.rsrc_data, rsrc.map_offset + 17, 0x12345678) ; + /* File ref number. */ + write_short (rsrc.rsrc_data, rsrc.map_offset + 21, 0xabcd) ; + /* Fork attributes. */ + write_short (rsrc.rsrc_data, rsrc.map_offset + 23, 0) ; + } ; + + /* Resource type offset. */ + rsrc.type_offset = rsrc.map_offset + 30 ; + write_short (rsrc.rsrc_data, rsrc.map_offset + 24, rsrc.type_offset - rsrc.map_offset - 2) ; + + /* Type index max. */ + rsrc.type_count = 2 ; + write_short (rsrc.rsrc_data, rsrc.map_offset + 28, rsrc.type_count - 1) ; + + rsrc.item_offset = rsrc.type_offset + rsrc.type_count * 8 ; + + rsrc.str_count = ARRAY_LEN (str_rsrc) ; + rsrc.string_offset = rsrc.item_offset + (rsrc.str_count + 1) * 12 - rsrc.map_offset ; + write_short (rsrc.rsrc_data, rsrc.map_offset + 26, rsrc.string_offset) ; + + /* Write 'STR ' resource type. */ + rsrc.str_count = 3 ; + write_int (rsrc.rsrc_data, rsrc.type_offset, STR_MARKER) ; + write_short (rsrc.rsrc_data, rsrc.type_offset + 4, rsrc.str_count - 1) ; + write_short (rsrc.rsrc_data, rsrc.type_offset + 6, 0x12) ; + + /* Write 'sdML' resource type. */ + write_int (rsrc.rsrc_data, rsrc.type_offset + 8, sdML_MARKER) ; + write_short (rsrc.rsrc_data, rsrc.type_offset + 12, 0) ; + write_short (rsrc.rsrc_data, rsrc.type_offset + 14, 0x36) ; + + str_offset = rsrc.map_offset + rsrc.string_offset ; + next_str = 0 ; + data_offset = rsrc.data_offset ; + for (k = 0 ; k < ARRAY_LEN (str_rsrc) ; k++) + { write_str (rsrc.rsrc_data, str_offset, str_rsrc [k].name, strlen (str_rsrc [k].name)) ; + + write_short (rsrc.rsrc_data, rsrc.item_offset + k * 12, str_rsrc [k].id) ; + write_short (rsrc.rsrc_data, rsrc.item_offset + k * 12 + 2, next_str) ; + + str_offset += strlen (str_rsrc [k].name) ; + next_str += strlen (str_rsrc [k].name) ; + + write_int (rsrc.rsrc_data, rsrc.item_offset + k * 12 + 4, data_offset - rsrc.data_offset) ; + + write_int (rsrc.rsrc_data, data_offset, str_rsrc [k].value_len) ; + write_str (rsrc.rsrc_data, data_offset + 4, str_rsrc [k].value, str_rsrc [k].value_len) ; + data_offset += 4 + str_rsrc [k].value_len ; + } ; + + /* Finally, calculate and set map length. */ + rsrc.map_length = str_offset - rsrc.map_offset ; + write_int (rsrc.rsrc_data, 12, rsrc.map_length) ; + write_int (rsrc.rsrc_data, rsrc.map_offset + 12, rsrc.map_length) ; + + rsrc.rsrc_len = rsrc.map_offset + rsrc.map_length ; + + psf_fwrite (rsrc.rsrc_data, rsrc.rsrc_len, 1, psf) ; + if (psf->error) + return psf->error ; + + return 0 ; +} /* sd2_write_rsrc_fork */ + +/*------------------------------------------------------------------------------ +*/ + +static inline int +read_char (const unsigned char * data, int offset) +{ return data [offset] ; +} /* read_char */ + +static inline int +read_short (const unsigned char * data, int offset) +{ return (data [offset] << 8) + data [offset + 1] ; +} /* read_char */ + +static inline int +read_int (const unsigned char * data, int offset) +{ return (data [offset] << 24) + (data [offset + 1] << 16) + (data [offset + 2] << 8) + data [offset + 3] ; +} /* read_char */ + +static void +read_str (const unsigned char * data, int offset, char * buffer, int buffer_len) +{ int k ; + + memset (buffer, 0, buffer_len) ; + + for (k = 0 ; k < buffer_len - 1 ; k++) + { if (isprint (data [offset + k]) == 0) + return ; + buffer [k] = data [offset + k] ; + } ; + return ; +} /* read_str */ + +static int +sd2_parse_rsrc_fork (SF_PRIVATE *psf) +{ SD2_RSRC rsrc ; + int k, marker, error = 0 ; + + memset (&rsrc, 0, sizeof (rsrc)) ; + + rsrc.rsrc_len = psf_get_filelen (psf) ; + psf_log_printf (psf, "Resource length : %d (0x%04X)\n", rsrc.rsrc_len, rsrc.rsrc_len) ; + + if (rsrc.rsrc_len > SIGNED_SIZEOF (psf->header)) + rsrc.rsrc_data = calloc (1, rsrc.rsrc_len) ; + else + rsrc.rsrc_data = psf->header ; + + /* Read in the whole lot. */ + psf_fread (rsrc.rsrc_data, rsrc.rsrc_len, 1, psf) ; + + /* Reset the header storage because we have changed to the rsrcdes. */ + psf->headindex = psf->headend = rsrc.rsrc_len ; + + rsrc.data_offset = read_int (rsrc.rsrc_data, 0) ; + rsrc.map_offset = read_int (rsrc.rsrc_data, 4) ; + rsrc.data_length = read_int (rsrc.rsrc_data, 8) ; + rsrc.map_length = read_int (rsrc.rsrc_data, 12) ; + + psf_log_printf (psf, " data offset : 0x%04X\n map offset : 0x%04X\n" + " data length : 0x%04X\n map length : 0x%04X\n", + rsrc.data_offset, rsrc.map_offset, rsrc.data_length, rsrc.map_length) ; + + if (rsrc.data_offset > rsrc.rsrc_len) + { psf_log_printf (psf, "Error : rsrc.data_offset > len\n") ; + error = SFE_SD2_BAD_DATA_OFFSET ; + goto parse_rsrc_fork_cleanup ; + } ; + + if (rsrc.map_offset > rsrc.rsrc_len) + { psf_log_printf (psf, "Error : rsrc.map_offset > len\n") ; + error = SFE_SD2_BAD_MAP_OFFSET ; + goto parse_rsrc_fork_cleanup ; + } ; + + if (rsrc.data_length > rsrc.rsrc_len) + { psf_log_printf (psf, "Error : rsrc.data_length > len\n") ; + error = SFE_SD2_BAD_DATA_LENGTH ; + goto parse_rsrc_fork_cleanup ; + } ; + + if (rsrc.map_length > rsrc.rsrc_len) + { psf_log_printf (psf, "Error : rsrc.map_length > len\n") ; + error = SFE_SD2_BAD_MAP_LENGTH ; + goto parse_rsrc_fork_cleanup ; + } ; + + if (rsrc.data_offset + rsrc.data_length != rsrc.map_offset || rsrc.map_offset + rsrc.map_length != rsrc.rsrc_len) + { psf_log_printf (psf, "Error : This does not look like a MacOSX resource fork.\n") ; + error = SFE_SD2_BAD_RSRC ; + goto parse_rsrc_fork_cleanup ; + } ; + + rsrc.string_offset = rsrc.map_offset + read_short (rsrc.rsrc_data, rsrc.map_offset + 26) ; + if (rsrc.string_offset > rsrc.rsrc_len) + { psf_log_printf (psf, "Bad string offset (%d).\n", rsrc.string_offset) ; + error = SFE_SD2_BAD_RSRC ; + goto parse_rsrc_fork_cleanup ; + } ; + + rsrc.type_offset = rsrc.map_offset + 30 ; + + rsrc.type_count = read_short (rsrc.rsrc_data, rsrc.map_offset + 28) + 1 ; + if (rsrc.type_count < 1) + { psf_log_printf (psf, "Bad type count.\n") ; + error = SFE_SD2_BAD_RSRC ; + goto parse_rsrc_fork_cleanup ; + } ; + + rsrc.item_offset = rsrc.type_offset + rsrc.type_count * 8 ; + if (rsrc.item_offset < 0 || rsrc.item_offset > rsrc.rsrc_len) + { psf_log_printf (psf, "Bad item offset (%d).\n", rsrc.item_offset) ; + error = SFE_SD2_BAD_RSRC ; + goto parse_rsrc_fork_cleanup ; + } ; + + rsrc.str_index = -1 ; + for (k = 0 ; k < rsrc.type_count ; k ++) + { marker = read_int (rsrc.rsrc_data, rsrc.type_offset + k * 8) ; + + if (marker == STR_MARKER) + { rsrc.str_index = k ; + rsrc.str_count = read_short (rsrc.rsrc_data, rsrc.type_offset + k * 8 + 4) + 1 ; + error = parse_str_rsrc (psf, &rsrc) ; + goto parse_rsrc_fork_cleanup ; + } ; + } ; + + psf_log_printf (psf, "No 'STR ' resource.\n") ; + error = SFE_SD2_BAD_RSRC ; + +parse_rsrc_fork_cleanup : + + if ((void *) rsrc.rsrc_data < (void *) psf || (void *) rsrc.rsrc_data > (void *) (psf + 1)) + free (rsrc.rsrc_data) ; + + return error ; +} /* sd2_parse_rsrc_fork */ + +static int +parse_str_rsrc (SF_PRIVATE *psf, SD2_RSRC * rsrc) +{ char name [32], value [32] ; + int k, str_offset, data_offset, data_len, rsrc_id ; + + psf_log_printf (psf, "Finding parameters :\n") ; + + str_offset = rsrc->string_offset ; + for (k = 0 ; k < rsrc->str_count ; k++) + { int slen ; + + slen = read_char (rsrc->rsrc_data, str_offset) ; + read_str (rsrc->rsrc_data, str_offset + 1, name, SF_MIN (SIGNED_SIZEOF (name), slen + 1)) ; + str_offset += slen + 1 ; + + rsrc_id = read_short (rsrc->rsrc_data, rsrc->item_offset + k * 12) ; + + data_offset = rsrc->data_offset + read_int (rsrc->rsrc_data, rsrc->item_offset + k * 12 + 4) ; + if (data_offset < 0 || data_offset > rsrc->rsrc_len) + { psf_log_printf (psf, "Bad data offset (%d)\n", data_offset) ; + return SFE_SD2_BAD_DATA_OFFSET ; + } ; + + data_len = read_int (rsrc->rsrc_data, data_offset) ; + if (data_len < 0 || data_len > rsrc->rsrc_len) + { psf_log_printf (psf, "Bad data length (%d).\n", data_len) ; + return SFE_SD2_BAD_RSRC ; + } ; + + slen = read_char (rsrc->rsrc_data, data_offset + 4) ; + read_str (rsrc->rsrc_data, data_offset + 5, value, SF_MIN (SIGNED_SIZEOF (value), slen + 1)) ; + + psf_log_printf (psf, " %-12s 0x%04x %4d %2d %2d '%s'\n", name, data_offset, rsrc_id, data_len, slen, value) ; + + if (strcmp (name, "sample-size") == 0 && rsrc->sample_size == 0) + rsrc->sample_size = strtol (value, NULL, 10) ; + else if (strcmp (name, "sample-rate") == 0 && rsrc->sample_rate == 0) + rsrc->sample_rate = strtol (value, NULL, 10) ; + else if (strcmp (name, "channels") == 0 && rsrc->channels == 0) + rsrc->channels = strtol (value, NULL, 10) ; + } ; + + if (rsrc->sample_rate < 0) + { psf_log_printf (psf, "Bad sample rate (%d)\n", rsrc->sample_rate) ; + return SFE_SD2_BAD_RSRC ; + } ; + + if (rsrc->channels < 0) + { psf_log_printf (psf, "Bad channel count (%d)\n", rsrc->channels) ; + return SFE_SD2_BAD_RSRC ; + } ; + + psf->sf.samplerate = rsrc->sample_rate ; + psf->sf.channels = rsrc->channels ; + psf->bytewidth = rsrc->sample_size ; + + switch (rsrc->sample_size) + { case 1 : + psf->sf.format = SF_FORMAT_SD2 | SF_FORMAT_PCM_S8 ; + break ; + + case 2 : + psf->sf.format = SF_FORMAT_SD2 | SF_FORMAT_PCM_16 ; + break ; + + case 3 : + psf->sf.format = SF_FORMAT_SD2 | SF_FORMAT_PCM_24 ; + break ; + + default : + psf_log_printf (psf, "Bad sample size (%d)\n", rsrc->sample_size) ; + return SFE_SD2_BAD_SAMPLE_SIZE ; + } ; + + psf_log_printf (psf, "ok\n") ; + + return 0 ; +} /* parse_str_rsrc */ + +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: 1ee183e5-6b9f-4c2c-bd0a-24f35595cefc +*/ diff --git a/Libraries/SndFile/Files/src/sds.c b/Libraries/SndFile/Files/src/sds.c new file mode 100644 index 000000000..75da49d18 --- /dev/null +++ b/Libraries/SndFile/Files/src/sds.c @@ -0,0 +1,995 @@ +/* +** Copyright (C) 2002-2004 Erik de Castro Lopo +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU Lesser General Public License as published by +** the Free Software Foundation; either version 2.1 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU Lesser General Public License for more details. +** +** You should have received a copy of the GNU Lesser General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include "config.h" + +#include +#include +#include +#include +#include + +#include "sndfile.h" +#include "sfendian.h" +#include "common.h" +#include "float_cast.h" + +/*------------------------------------------------------------------------------ +*/ + +#define SDS_DATA_OFFSET 0x15 +#define SDS_BLOCK_SIZE 127 + +#define SDS_AUDIO_BYTES_PER_BLOCK 120 + +#define SDS_3BYTE_TO_INT_DECODE(x) (((x) & 0x7F) | (((x) & 0x7F00) >> 1) | (((x) & 0x7F0000) >> 2)) +#define SDS_INT_TO_3BYTE_ENCODE(x) (((x) & 0x7F) | (((x) << 1) & 0x7F00) | (((x) << 2) & 0x7F0000)) + +/*------------------------------------------------------------------------------ +** Typedefs. +*/ + +typedef struct tag_SDS_PRIVATE +{ int bitwidth, frames ; + int samplesperblock, total_blocks ; + + int (*reader) (SF_PRIVATE *psf, struct tag_SDS_PRIVATE *psds) ; + int (*writer) (SF_PRIVATE *psf, struct tag_SDS_PRIVATE *psds) ; + + int read_block, read_count ; + unsigned char read_data [SDS_BLOCK_SIZE] ; + int read_samples [SDS_BLOCK_SIZE / 2] ; /* Maximum samples per block */ + + int write_block, write_count ; + unsigned char write_data [SDS_BLOCK_SIZE] ; + int write_samples [SDS_BLOCK_SIZE / 2] ; /* Maximum samples per block */ +} SDS_PRIVATE ; + +/*------------------------------------------------------------------------------ +** Private static functions. +*/ + +static int sds_close (SF_PRIVATE *psf) ; + +static int sds_write_header (SF_PRIVATE *psf, int calc_length) ; +static int sds_read_header (SF_PRIVATE *psf, SDS_PRIVATE *psds) ; + +static int sds_init (SF_PRIVATE *psf, SDS_PRIVATE *psds) ; + +static sf_count_t sds_read_s (SF_PRIVATE *psf, short *ptr, sf_count_t len) ; +static sf_count_t sds_read_i (SF_PRIVATE *psf, int *ptr, sf_count_t len) ; +static sf_count_t sds_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ; +static sf_count_t sds_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ; + +static sf_count_t sds_write_s (SF_PRIVATE *psf, short *ptr, sf_count_t len) ; +static sf_count_t sds_write_i (SF_PRIVATE *psf, int *ptr, sf_count_t len) ; +static sf_count_t sds_write_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ; +static sf_count_t sds_write_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ; + +static sf_count_t sds_seek (SF_PRIVATE *psf, int mode, sf_count_t offset) ; + +static int sds_2byte_read (SF_PRIVATE *psf, SDS_PRIVATE *psds) ; +static int sds_3byte_read (SF_PRIVATE *psf, SDS_PRIVATE *psds) ; +static int sds_4byte_read (SF_PRIVATE *psf, SDS_PRIVATE *psds) ; + +static int sds_read (SF_PRIVATE *psf, SDS_PRIVATE *psds, int *iptr, int readcount) ; + +static int sds_2byte_write (SF_PRIVATE *psf, SDS_PRIVATE *psds) ; +static int sds_3byte_write (SF_PRIVATE *psf, SDS_PRIVATE *psds) ; +static int sds_4byte_write (SF_PRIVATE *psf, SDS_PRIVATE *psds) ; + +static int sds_write (SF_PRIVATE *psf, SDS_PRIVATE *psds, int *iptr, int writecount) ; + +/*------------------------------------------------------------------------------ +** Public function. +*/ + +int +sds_open (SF_PRIVATE *psf) +{ SDS_PRIVATE *psds ; + int subformat, error = 0 ; + + /* Hmmmm, need this here to pass update_header_test. */ + psf->sf.frames = 0 ; + + if (! (psds = calloc (1, sizeof (SDS_PRIVATE)))) + return SFE_MALLOC_FAILED ; + psf->fdata = psds ; + + if (psf->mode == SFM_READ || (psf->mode == SFM_RDWR && psf->filelength > 0)) + { if ((error = sds_read_header (psf, psds))) + return error ; + } ; + + if ((psf->sf.format & SF_FORMAT_TYPEMASK) != SF_FORMAT_SDS) + return SFE_BAD_OPEN_FORMAT ; + + subformat = psf->sf.format & SF_FORMAT_SUBMASK ; + + if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR) + { if (sds_write_header (psf, SF_FALSE)) + return psf->error ; + + psf->write_header = sds_write_header ; + + psf_fseek (psf, SDS_DATA_OFFSET, SEEK_SET) ; + } ; + + if ((error = sds_init (psf, psds)) != 0) + return error ; + + psf->seek = sds_seek ; + psf->close = sds_close ; + + psf->blockwidth = 0 ; + + return error ; +} /* sds_open */ + +/*------------------------------------------------------------------------------ +*/ + +static int +sds_close (SF_PRIVATE *psf) +{ + if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR) + { SDS_PRIVATE *psds ; + + if ((psds = (SDS_PRIVATE *) psf->fdata) == NULL) + { psf_log_printf (psf, "*** Bad psf->fdata ptr.\n") ; + return SFE_INTERNAL ; + } ; + + if (psds->write_count > 0) + { memset (&(psds->write_data [psds->write_count]), 0, (psds->samplesperblock - psds->write_count) * sizeof (int)) ; + psds->writer (psf, psds) ; + } ; + + sds_write_header (psf, SF_TRUE) ; + } ; + + return 0 ; +} /* sds_close */ + +static int +sds_init (SF_PRIVATE *psf, SDS_PRIVATE *psds) +{ + if (psds->bitwidth < 8 || psds->bitwidth > 28) + return (psf->error = SFE_SDS_BAD_BIT_WIDTH) ; + + if (psds->bitwidth < 14) + { psds->reader = sds_2byte_read ; + psds->writer = sds_2byte_write ; + psds->samplesperblock = SDS_AUDIO_BYTES_PER_BLOCK / 2 ; + } + else if (psds->bitwidth < 21) + { psds->reader = sds_3byte_read ; + psds->writer = sds_3byte_write ; + psds->samplesperblock = SDS_AUDIO_BYTES_PER_BLOCK / 3 ; + } + else + { psds->reader = sds_4byte_read ; + psds->writer = sds_4byte_write ; + psds->samplesperblock = SDS_AUDIO_BYTES_PER_BLOCK / 4 ; + } ; + + if (psf->mode == SFM_READ || psf->mode == SFM_RDWR) + { psf->read_short = sds_read_s ; + psf->read_int = sds_read_i ; + psf->read_float = sds_read_f ; + psf->read_double = sds_read_d ; + + /* Read first block. */ + psds->reader (psf, psds) ; + } ; + + if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR) + { psf->write_short = sds_write_s ; + psf->write_int = sds_write_i ; + psf->write_float = sds_write_f ; + psf->write_double = sds_write_d ; + } ; + + return 0 ; +} /* sds_init */ + +static int +sds_read_header (SF_PRIVATE *psf, SDS_PRIVATE *psds) +{ unsigned char channel, bitwidth, loop_type, byte ; + unsigned short sample_no, marker ; + unsigned int samp_period, data_length, sustain_loop_start, sustain_loop_end ; + int bytesread, blockcount ; + + /* Set position to start of file to begin reading header. */ + bytesread = psf_binheader_readf (psf, "pE211", 0, &marker, &channel, &byte) ; + + if (marker != 0xF07E || byte != 0x01) + return SFE_SDS_NOT_SDS ; + + psf_log_printf (psf, "Midi Sample Dump Standard (.sds)\nF07E\n Midi Channel : %d\n", channel) ; + + bytesread += psf_binheader_readf (psf, "e213", &sample_no, &bitwidth, &samp_period) ; + + sample_no = SDS_3BYTE_TO_INT_DECODE (sample_no) ; + samp_period = SDS_3BYTE_TO_INT_DECODE (samp_period) ; + + psds->bitwidth = bitwidth ; + + psf->sf.samplerate = 1000000000 / samp_period ; + + psf_log_printf (psf, " Sample Number : %d\n" + " Bit Width : %d\n" + " Sample Rate : %d\n", + sample_no, psds->bitwidth, psf->sf.samplerate) ; + + bytesread += psf_binheader_readf (psf, "e3331", &data_length, &sustain_loop_start, &sustain_loop_end, &loop_type) ; + + data_length = SDS_3BYTE_TO_INT_DECODE (data_length) ; + + sustain_loop_start = SDS_3BYTE_TO_INT_DECODE (sustain_loop_start) ; + sustain_loop_end = SDS_3BYTE_TO_INT_DECODE (sustain_loop_end) ; + + psf_log_printf (psf, " Sustain Loop\n" + " Start : %d\n" + " End : %d\n" + " Loop Type : %d\n", + sustain_loop_start, sustain_loop_end, loop_type) ; + + psf->dataoffset = SDS_DATA_OFFSET ; + psf->datalength = psf->filelength - psf->dataoffset ; + + if (data_length != psf->filelength - psf->dataoffset) + { psf_log_printf (psf, " Datalength : %d (truncated data??? %d)\n", data_length, psf->filelength - psf->dataoffset) ; + data_length = psf->filelength - psf->dataoffset ; + } + else + psf_log_printf (psf, " Datalength : %d\n", data_length) ; + + bytesread += psf_binheader_readf (psf, "1", &byte) ; + if (byte != 0xF7) + psf_log_printf (psf, "bad end : %X\n", byte & 0xFF) ; + + for (blockcount = 0 ; bytesread < psf->filelength ; blockcount++) + { + bytesread += psf_fread (&marker, 1, 2, psf) ; + + if (marker == 0) + break ; + + psf_fseek (psf, SDS_BLOCK_SIZE - 2, SEEK_CUR) ; + bytesread += SDS_BLOCK_SIZE - 2 ; + } ; + + psf_log_printf (psf, "\nBlocks : %d\n", blockcount) ; + psds->total_blocks = blockcount ; + + psds->samplesperblock = SDS_AUDIO_BYTES_PER_BLOCK / ((psds->bitwidth + 6) / 7) ; + psf_log_printf (psf, "Samples/Block : %d\n", psds->samplesperblock) ; + + psf_log_printf (psf, "Frames : %d\n", blockcount * psds->samplesperblock) ; + + psf->sf.frames = blockcount * psds->samplesperblock ; + psds->frames = blockcount * psds->samplesperblock ; + + /* Always Mono */ + psf->sf.channels = 1 ; + psf->sf.sections = 1 ; + + /* + ** Lie to the user about PCM bit width. Always round up to + ** the next multiple of 8. + */ + switch ((psds->bitwidth + 7) / 8) + { case 1 : + psf->sf.format = SF_FORMAT_SDS | SF_FORMAT_PCM_S8 ; + break ; + + case 2 : + psf->sf.format = SF_FORMAT_SDS | SF_FORMAT_PCM_16 ; + break ; + + case 3 : + psf->sf.format = SF_FORMAT_SDS | SF_FORMAT_PCM_24 ; + break ; + + case 4 : + psf->sf.format = SF_FORMAT_SDS | SF_FORMAT_PCM_32 ; + break ; + + default : + psf_log_printf (psf, "*** Weird byte width (%d)\n", (psds->bitwidth + 7) / 8) ; + return SFE_SDS_BAD_BIT_WIDTH ; + } ; + + psf_fseek (psf, SDS_DATA_OFFSET, SEEK_SET) ; + + return 0 ; +} /* sds_read_header */ + +static int +sds_write_header (SF_PRIVATE *psf, int calc_length) +{ SDS_PRIVATE *psds ; + sf_count_t current ; + int samp_period, data_length, sustain_loop_start, sustain_loop_end ; + unsigned char loop_type = 0 ; + + if ((psds = (SDS_PRIVATE *) psf->fdata) == NULL) + { psf_log_printf (psf, "*** Bad psf->fdata ptr.\n") ; + return SFE_INTERNAL ; + } ; + + if (psf->pipeoffset > 0) + return 0 ; + + current = psf_ftell (psf) ; + + if (calc_length) + psf->sf.frames = psds->total_blocks * psds->samplesperblock + psds->write_count ; + + if (psds->write_count > 0) + { int current_count = psds->write_count ; + int current_block = psds->write_block ; + + psds->writer (psf, psds) ; + + psf_fseek (psf, -1 * SDS_BLOCK_SIZE, SEEK_CUR) ; + + psds->write_count = current_count ; + psds->write_block = current_block ; + } ; + + /* Reset the current header length to zero. */ + psf->header [0] = 0 ; + psf->headindex = 0 ; + + if (psf->is_pipe == SF_FALSE) + psf_fseek (psf, 0, SEEK_SET) ; + + psf_binheader_writef (psf, "E211", 0xF07E, 0, 1) ; + + switch (psf->sf.format & SF_FORMAT_SUBMASK) + { case SF_FORMAT_PCM_S8 : + psds->bitwidth = 8 ; + break ; + case SF_FORMAT_PCM_16 : + psds->bitwidth = 16 ; + break ; + case SF_FORMAT_PCM_24 : + psds->bitwidth = 24 ; + break ; + default: + return SFE_SDS_BAD_BIT_WIDTH ; + } ; + + samp_period = SDS_INT_TO_3BYTE_ENCODE (1000000000 / psf->sf.samplerate) ; + + psf_binheader_writef (psf, "e213", 0, psds->bitwidth, samp_period) ; + + data_length = SDS_INT_TO_3BYTE_ENCODE (psds->total_blocks * SDS_BLOCK_SIZE) ; + sustain_loop_start = SDS_INT_TO_3BYTE_ENCODE (0) ; + sustain_loop_end = SDS_INT_TO_3BYTE_ENCODE (psf->sf.frames) ; + + psf_binheader_writef (psf, "e33311", data_length, sustain_loop_start, sustain_loop_end, loop_type, 0xF7) ; + + /* Header construction complete so write it out. */ + psf_fwrite (psf->header, psf->headindex, 1, psf) ; + + if (psf->error) + return psf->error ; + + psf->dataoffset = psf->headindex ; + psf->datalength = psds->write_block * SDS_BLOCK_SIZE ; + + if (current > 0) + psf_fseek (psf, current, SEEK_SET) ; + + return psf->error ; +} /* sds_write_header */ + + +/*------------------------------------------------------------------------------ +*/ + +static int +sds_2byte_read (SF_PRIVATE *psf, SDS_PRIVATE *psds) +{ unsigned char *ucptr, checksum ; + unsigned int sample ; + int k ; + + psds->read_block ++ ; + psds->read_count = 0 ; + + if (psds->read_block * psds->samplesperblock > psds->frames) + { memset (psds->read_samples, 0, psds->samplesperblock * sizeof (int)) ; + return 1 ; + } ; + + if ((k = psf_fread (psds->read_data, 1, SDS_BLOCK_SIZE, psf)) != SDS_BLOCK_SIZE) + psf_log_printf (psf, "*** Warning : short read (%d != %d).\n", k, SDS_BLOCK_SIZE) ; + + if (psds->read_data [0] != 0xF0) + { printf ("Error A : %02X\n", psds->read_data [0] & 0xFF) ; + } ; + + checksum = psds->read_data [1] ; + if (checksum != 0x7E) + { printf ("Error 1 : %02X\n", checksum & 0xFF) ; + } + + for (k = 2 ; k < SDS_BLOCK_SIZE - 3 ; k ++) + checksum ^= psds->read_data [k] ; + + checksum &= 0x7F ; + + if (checksum != psds->read_data [SDS_BLOCK_SIZE - 2]) + { psf_log_printf (psf, "Block %d : checksum is %02X should be %02X\n", psds->read_data [4], checksum, psds->read_data [SDS_BLOCK_SIZE - 2]) ; + } ; + + ucptr = psds->read_data + 5 ; + for (k = 0 ; k < 120 ; k += 2) + { sample = (ucptr [k] << 25) + (ucptr [k + 1] << 18) ; + psds->read_samples [k / 2] = (int) (sample - 0x80000000) ; + } ; + + return 1 ; +} /* sds_2byte_read */ + +static int +sds_3byte_read (SF_PRIVATE *psf, SDS_PRIVATE *psds) +{ unsigned char *ucptr, checksum ; + unsigned int sample ; + int k ; + + psds->read_block ++ ; + psds->read_count = 0 ; + + if (psds->read_block * psds->samplesperblock > psds->frames) + { memset (psds->read_samples, 0, psds->samplesperblock * sizeof (int)) ; + return 1 ; + } ; + + if ((k = psf_fread (psds->read_data, 1, SDS_BLOCK_SIZE, psf)) != SDS_BLOCK_SIZE) + psf_log_printf (psf, "*** Warning : short read (%d != %d).\n", k, SDS_BLOCK_SIZE) ; + + if (psds->read_data [0] != 0xF0) + { printf ("Error A : %02X\n", psds->read_data [0] & 0xFF) ; + } ; + + checksum = psds->read_data [1] ; + if (checksum != 0x7E) + { printf ("Error 1 : %02X\n", checksum & 0xFF) ; + } + + for (k = 2 ; k < SDS_BLOCK_SIZE - 3 ; k ++) + checksum ^= psds->read_data [k] ; + + checksum &= 0x7F ; + + if (checksum != psds->read_data [SDS_BLOCK_SIZE - 2]) + { psf_log_printf (psf, "Block %d : checksum is %02X should be %02X\n", psds->read_data [4], checksum, psds->read_data [SDS_BLOCK_SIZE - 2]) ; + } ; + + ucptr = psds->read_data + 5 ; + for (k = 0 ; k < 120 ; k += 3) + { sample = (ucptr [k] << 25) + (ucptr [k + 1] << 18) + (ucptr [k + 2] << 11) ; + psds->read_samples [k / 3] = (int) (sample - 0x80000000) ; + } ; + + return 1 ; +} /* sds_3byte_read */ + +static int +sds_4byte_read (SF_PRIVATE *psf, SDS_PRIVATE *psds) +{ unsigned char *ucptr, checksum ; + unsigned int sample ; + int k ; + + psds->read_block ++ ; + psds->read_count = 0 ; + + if (psds->read_block * psds->samplesperblock > psds->frames) + { memset (psds->read_samples, 0, psds->samplesperblock * sizeof (int)) ; + return 1 ; + } ; + + if ((k = psf_fread (psds->read_data, 1, SDS_BLOCK_SIZE, psf)) != SDS_BLOCK_SIZE) + psf_log_printf (psf, "*** Warning : short read (%d != %d).\n", k, SDS_BLOCK_SIZE) ; + + if (psds->read_data [0] != 0xF0) + { printf ("Error A : %02X\n", psds->read_data [0] & 0xFF) ; + } ; + + checksum = psds->read_data [1] ; + if (checksum != 0x7E) + { printf ("Error 1 : %02X\n", checksum & 0xFF) ; + } + + for (k = 2 ; k < SDS_BLOCK_SIZE - 3 ; k ++) + checksum ^= psds->read_data [k] ; + + checksum &= 0x7F ; + + if (checksum != psds->read_data [SDS_BLOCK_SIZE - 2]) + { psf_log_printf (psf, "Block %d : checksum is %02X should be %02X\n", psds->read_data [4], checksum, psds->read_data [SDS_BLOCK_SIZE - 2]) ; + } ; + + ucptr = psds->read_data + 5 ; + for (k = 0 ; k < 120 ; k += 4) + { sample = (ucptr [k] << 25) + (ucptr [k + 1] << 18) + (ucptr [k + 2] << 11) + (ucptr [k + 3] << 4) ; + psds->read_samples [k / 4] = (int) (sample - 0x80000000) ; + } ; + + return 1 ; +} /* sds_4byte_read */ + + +static sf_count_t +sds_read_s (SF_PRIVATE *psf, short *ptr, sf_count_t len) +{ SDS_PRIVATE *psds ; + int *iptr ; + int k, bufferlen, readcount, count ; + sf_count_t total = 0 ; + + if (psf->fdata == NULL) + return 0 ; + psds = (SDS_PRIVATE*) psf->fdata ; + + iptr = psf->u.ibuf ; + bufferlen = ARRAY_LEN (psf->u.ibuf) ; + while (len > 0) + { readcount = (len >= bufferlen) ? bufferlen : len ; + count = sds_read (psf, psds, iptr, readcount) ; + for (k = 0 ; k < readcount ; k++) + ptr [total + k] = iptr [k] >> 16 ; + total += count ; + len -= readcount ; + } ; + + return total ; +} /* sds_read_s */ + +static sf_count_t +sds_read_i (SF_PRIVATE *psf, int *ptr, sf_count_t len) +{ SDS_PRIVATE *psds ; + int total ; + + if (psf->fdata == NULL) + return 0 ; + psds = (SDS_PRIVATE*) psf->fdata ; + + total = sds_read (psf, psds, ptr, len) ; + + return total ; +} /* sds_read_i */ + +static sf_count_t +sds_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) +{ SDS_PRIVATE *psds ; + int *iptr ; + int k, bufferlen, readcount, count ; + sf_count_t total = 0 ; + float normfact ; + + if (psf->fdata == NULL) + return 0 ; + psds = (SDS_PRIVATE*) psf->fdata ; + + if (psf->norm_float == SF_TRUE) + normfact = 1.0 / 0x80000000 ; + else + normfact = 1.0 / (1 << psds->bitwidth) ; + + iptr = psf->u.ibuf ; + bufferlen = ARRAY_LEN (psf->u.ibuf) ; + while (len > 0) + { readcount = (len >= bufferlen) ? bufferlen : len ; + count = sds_read (psf, psds, iptr, readcount) ; + for (k = 0 ; k < readcount ; k++) + ptr [total + k] = normfact * iptr [k] ; + total += count ; + len -= readcount ; + } ; + + return total ; +} /* sds_read_f */ + +static sf_count_t +sds_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) +{ SDS_PRIVATE *psds ; + int *iptr ; + int k, bufferlen, readcount, count ; + sf_count_t total = 0 ; + double normfact ; + + if (psf->fdata == NULL) + return 0 ; + psds = (SDS_PRIVATE*) psf->fdata ; + + if (psf->norm_double == SF_TRUE) + normfact = 1.0 / 0x80000000 ; + else + normfact = 1.0 / (1 << psds->bitwidth) ; + + iptr = psf->u.ibuf ; + bufferlen = ARRAY_LEN (psf->u.ibuf) ; + while (len > 0) + { readcount = (len >= bufferlen) ? bufferlen : len ; + count = sds_read (psf, psds, iptr, readcount) ; + for (k = 0 ; k < readcount ; k++) + ptr [total + k] = normfact * iptr [k] ; + total += count ; + len -= readcount ; + } ; + + return total ; +} /* sds_read_d */ + +static int +sds_read (SF_PRIVATE *psf, SDS_PRIVATE *psds, int *ptr, int len) +{ int count, total = 0 ; + + while (total < len) + { if (psds->read_block * psds->samplesperblock >= psds->frames) + { memset (&(ptr [total]), 0, (len - total) * sizeof (int)) ; + return total ; + } ; + + if (psds->read_count >= psds->samplesperblock) + psds->reader (psf, psds) ; + + count = (psds->samplesperblock - psds->read_count) ; + count = (len - total > count) ? count : len - total ; + + memcpy (&(ptr [total]), &(psds->read_samples [psds->read_count]), count * sizeof (int)) ; + total += count ; + psds->read_count += count ; + } ; + + return total ; +} /* sds_read */ + +/*============================================================================== +*/ + +static sf_count_t +sds_seek (SF_PRIVATE *psf, int mode, sf_count_t seek_from_start) +{ SDS_PRIVATE *psds ; + sf_count_t file_offset ; + int newblock, newsample ; + + if ((psds = psf->fdata) == NULL) + { psf->error = SFE_INTERNAL ; + return SF_SEEK_ERROR ; + } ; + + if (psf->datalength < 0 || psf->dataoffset < 0) + { psf->error = SFE_BAD_SEEK ; + return SF_SEEK_ERROR ; + } ; + + if (seek_from_start < 0 || seek_from_start > psf->sf.frames) + { psf->error = SFE_BAD_SEEK ; + return SF_SEEK_ERROR ; + } ; + + if (mode == SFM_READ && psds->write_count > 0) + psds->writer (psf, psds) ; + + newblock = seek_from_start / psds->samplesperblock ; + newsample = seek_from_start % psds->samplesperblock ; + + switch (mode) + { case SFM_READ : + if (newblock > psds->total_blocks) + { psf->error = SFE_BAD_SEEK ; + return SF_SEEK_ERROR ; + } ; + + file_offset = psf->dataoffset + newblock * SDS_BLOCK_SIZE ; + + if (psf_fseek (psf, file_offset, SEEK_SET) != file_offset) + { psf->error = SFE_SEEK_FAILED ; + return SF_SEEK_ERROR ; + } ; + + psds->read_block = newblock ; + psds->reader (psf, psds) ; + psds->read_count = newsample ; + break ; + + case SFM_WRITE : + if (newblock > psds->total_blocks) + { psf->error = SFE_BAD_SEEK ; + return SF_SEEK_ERROR ; + } ; + + file_offset = psf->dataoffset + newblock * SDS_BLOCK_SIZE ; + + if (psf_fseek (psf, file_offset, SEEK_SET) != file_offset) + { psf->error = SFE_SEEK_FAILED ; + return SF_SEEK_ERROR ; + } ; + + psds->write_block = newblock ; + psds->reader (psf, psds) ; + psds->write_count = newsample ; + break ; + + default : + psf->error = SFE_BAD_SEEK ; + return SF_SEEK_ERROR ; + break ; + } ; + + return seek_from_start ; +} /* sds_seek */ + +/*============================================================================== +*/ + +static int +sds_2byte_write (SF_PRIVATE *psf, SDS_PRIVATE *psds) +{ unsigned char *ucptr, checksum ; + unsigned int sample ; + int k ; + + psds->write_data [0] = 0xF0 ; + psds->write_data [1] = 0x7E ; + psds->write_data [2] = 0 ; /* Channel number */ + psds->write_data [3] = psds->write_block & 0x7F ; /* Packet number */ + + ucptr = psds->write_data + 5 ; + for (k = 0 ; k < 120 ; k += 2) + { sample = psds->write_samples [k / 2] ; + sample += 0x80000000 ; + ucptr [k] = (sample >> 25) & 0x7F ; + ucptr [k + 1] = (sample >> 18) & 0x7F ; + } ; + + checksum = psds->write_data [1] ; + for (k = 2 ; k < SDS_BLOCK_SIZE - 3 ; k ++) + checksum ^= psds->write_data [k] ; + checksum &= 0x7F ; + + psds->write_data [SDS_BLOCK_SIZE - 2] = checksum ; + psds->write_data [SDS_BLOCK_SIZE - 1] = 0xF7 ; + + if ((k = psf_fwrite (psds->write_data, 1, SDS_BLOCK_SIZE, psf)) != SDS_BLOCK_SIZE) + psf_log_printf (psf, "*** Warning : psf_fwrite (%d != %d).\n", k, SDS_BLOCK_SIZE) ; + + psds->write_block ++ ; + psds->write_count = 0 ; + + if (psds->write_block > psds->total_blocks) + psds->total_blocks = psds->write_block ; + psds->frames = psds->total_blocks * psds->samplesperblock ; + + return 1 ; +} /* sds_2byte_write */ + +static int +sds_3byte_write (SF_PRIVATE *psf, SDS_PRIVATE *psds) +{ unsigned char *ucptr, checksum ; + unsigned int sample ; + int k ; + + psds->write_data [0] = 0xF0 ; + psds->write_data [1] = 0x7E ; + psds->write_data [2] = 0 ; /* Channel number */ + psds->write_data [3] = psds->write_block & 0x7F ; /* Packet number */ + + ucptr = psds->write_data + 5 ; + for (k = 0 ; k < 120 ; k += 3) + { sample = psds->write_samples [k / 3] ; + sample += 0x80000000 ; + ucptr [k] = (sample >> 25) & 0x7F ; + ucptr [k + 1] = (sample >> 18) & 0x7F ; + ucptr [k + 2] = (sample >> 11) & 0x7F ; + } ; + + checksum = psds->write_data [1] ; + for (k = 2 ; k < SDS_BLOCK_SIZE - 3 ; k ++) + checksum ^= psds->write_data [k] ; + checksum &= 0x7F ; + + psds->write_data [SDS_BLOCK_SIZE - 2] = checksum ; + psds->write_data [SDS_BLOCK_SIZE - 1] = 0xF7 ; + + if ((k = psf_fwrite (psds->write_data, 1, SDS_BLOCK_SIZE, psf)) != SDS_BLOCK_SIZE) + psf_log_printf (psf, "*** Warning : psf_fwrite (%d != %d).\n", k, SDS_BLOCK_SIZE) ; + + psds->write_block ++ ; + psds->write_count = 0 ; + + if (psds->write_block > psds->total_blocks) + psds->total_blocks = psds->write_block ; + psds->frames = psds->total_blocks * psds->samplesperblock ; + + return 1 ; +} /* sds_3byte_write */ + +static int +sds_4byte_write (SF_PRIVATE *psf, SDS_PRIVATE *psds) +{ unsigned char *ucptr, checksum ; + unsigned int sample ; + int k ; + + psds->write_data [0] = 0xF0 ; + psds->write_data [1] = 0x7E ; + psds->write_data [2] = 0 ; /* Channel number */ + psds->write_data [3] = psds->write_block & 0x7F ; /* Packet number */ + + ucptr = psds->write_data + 5 ; + for (k = 0 ; k < 120 ; k += 4) + { sample = psds->write_samples [k / 4] ; + sample += 0x80000000 ; + ucptr [k] = (sample >> 25) & 0x7F ; + ucptr [k + 1] = (sample >> 18) & 0x7F ; + ucptr [k + 2] = (sample >> 11) & 0x7F ; + ucptr [k + 3] = (sample >> 4) & 0x7F ; + } ; + + checksum = psds->write_data [1] ; + for (k = 2 ; k < SDS_BLOCK_SIZE - 3 ; k ++) + checksum ^= psds->write_data [k] ; + checksum &= 0x7F ; + + psds->write_data [SDS_BLOCK_SIZE - 2] = checksum ; + psds->write_data [SDS_BLOCK_SIZE - 1] = 0xF7 ; + + if ((k = psf_fwrite (psds->write_data, 1, SDS_BLOCK_SIZE, psf)) != SDS_BLOCK_SIZE) + psf_log_printf (psf, "*** Warning : psf_fwrite (%d != %d).\n", k, SDS_BLOCK_SIZE) ; + + psds->write_block ++ ; + psds->write_count = 0 ; + + if (psds->write_block > psds->total_blocks) + psds->total_blocks = psds->write_block ; + psds->frames = psds->total_blocks * psds->samplesperblock ; + + return 1 ; +} /* sds_4byte_write */ + +static sf_count_t +sds_write_s (SF_PRIVATE *psf, short *ptr, sf_count_t len) +{ SDS_PRIVATE *psds ; + int *iptr ; + int k, bufferlen, writecount, count ; + sf_count_t total = 0 ; + + if (psf->fdata == NULL) + return 0 ; + psds = (SDS_PRIVATE*) psf->fdata ; + + iptr = psf->u.ibuf ; + bufferlen = ARRAY_LEN (psf->u.ibuf) ; + while (len > 0) + { writecount = (len >= bufferlen) ? bufferlen : len ; + for (k = 0 ; k < writecount ; k++) + iptr [k] = ptr [total + k] << 16 ; + count = sds_write (psf, psds, iptr, writecount) ; + total += count ; + len -= writecount ; + } ; + + return total ; +} /* sds_write_s */ + +static sf_count_t +sds_write_i (SF_PRIVATE *psf, int *ptr, sf_count_t len) +{ SDS_PRIVATE *psds ; + int total ; + + if (psf->fdata == NULL) + return 0 ; + psds = (SDS_PRIVATE*) psf->fdata ; + + total = sds_write (psf, psds, ptr, len) ; + + return total ; +} /* sds_write_i */ + +static sf_count_t +sds_write_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) +{ SDS_PRIVATE *psds ; + int *iptr ; + int k, bufferlen, writecount, count ; + sf_count_t total = 0 ; + float normfact ; + + if (psf->fdata == NULL) + return 0 ; + psds = (SDS_PRIVATE*) psf->fdata ; + + if (psf->norm_float == SF_TRUE) + normfact = 1.0 * 0x80000000 ; + else + normfact = 1.0 * (1 << psds->bitwidth) ; + + iptr = psf->u.ibuf ; + bufferlen = ARRAY_LEN (psf->u.ibuf) ; + while (len > 0) + { writecount = (len >= bufferlen) ? bufferlen : len ; + for (k = 0 ; k < writecount ; k++) + iptr [k] = normfact * ptr [total + k] ; + count = sds_write (psf, psds, iptr, writecount) ; + total += count ; + len -= writecount ; + } ; + + return total ; +} /* sds_write_f */ + +static sf_count_t +sds_write_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) +{ SDS_PRIVATE *psds ; + int *iptr ; + int k, bufferlen, writecount, count ; + sf_count_t total = 0 ; + double normfact ; + + if (psf->fdata == NULL) + return 0 ; + psds = (SDS_PRIVATE*) psf->fdata ; + + if (psf->norm_double == SF_TRUE) + normfact = 1.0 * 0x80000000 ; + else + normfact = 1.0 * (1 << psds->bitwidth) ; + + iptr = psf->u.ibuf ; + bufferlen = ARRAY_LEN (psf->u.ibuf) ; + while (len > 0) + { writecount = (len >= bufferlen) ? bufferlen : len ; + for (k = 0 ; k < writecount ; k++) + iptr [k] = normfact * ptr [total + k] ; + count = sds_write (psf, psds, iptr, writecount) ; + total += count ; + len -= writecount ; + } ; + + return total ; +} /* sds_write_d */ + +static int +sds_write (SF_PRIVATE *psf, SDS_PRIVATE *psds, int *ptr, int len) +{ int count, total = 0 ; + + while (total < len) + { count = psds->samplesperblock - psds->write_count ; + if (count > len - total) + count = len - total ; + + memcpy (&(psds->write_samples [psds->write_count]), &(ptr [total]), count * sizeof (int)) ; + total += count ; + psds->write_count += count ; + + if (psds->write_count >= psds->samplesperblock) + psds->writer (psf, psds) ; + } ; + + return total ; +} /* sds_write */ + +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: d5d26aa3-368c-4ca6-bb85-377e5a2578cc +*/ diff --git a/Libraries/SndFile/Files/src/sf_unistd.h b/Libraries/SndFile/Files/src/sf_unistd.h new file mode 100644 index 000000000..f24ae67e9 --- /dev/null +++ b/Libraries/SndFile/Files/src/sf_unistd.h @@ -0,0 +1,67 @@ +/* +** Copyright (C) 2002-2004 Erik de Castro Lopo +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU Lesser General Public License as published by +** the Free Software Foundation; either version 2.1 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU Lesser General Public License for more details. +** +** You should have received a copy of the GNU Lesser General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +/* Some defines that microsoft 'forgot' to implement. */ + +#ifndef S_IRWXU +#define S_IRWXU 0000700 /* rwx, owner */ +#endif + +#ifndef S_IRUSR +#define S_IRUSR 0000400 /* read permission, owner */ +#endif + +#ifndef S_IWUSR +#define S_IWUSR 0000200 /* write permission, owner */ +#endif + +#ifndef S_IXUSR +#define S_IXUSR 0000100 /* execute/search permission, owner */ +#endif + +#define S_IRWXG 0000070 /* rwx, group */ +#define S_IRGRP 0000040 /* read permission, group */ +#define S_IWGRP 0000020 /* write permission, grougroup */ +#define S_IXGRP 0000010 /* execute/search permission, group */ + +#define S_IRWXO 0000007 /* rwx, other */ +#define S_IROTH 0000004 /* read permission, other */ +#define S_IWOTH 0000002 /* write permission, other */ +#define S_IXOTH 0000001 /* execute/search permission, other */ + +#ifndef S_ISFIFO +#define S_ISFIFO(mode) (((mode) & _S_IFMT) == _S_IFIFO) +#endif + +#ifndef S_ISREG +#define S_ISREG(mode) (((mode) & _S_IFREG) == _S_IFREG) +#endif + +/* +** Don't know if these are still needed. +** +** #define _IFMT _S_IFMT +** #define _IFREG _S_IFREG +*/ +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: 253aea6d-6299-46fd-8d06-bc5f6224c8fe +*/ diff --git a/Libraries/SndFile/Files/src/sfendian.h b/Libraries/SndFile/Files/src/sfendian.h new file mode 100644 index 000000000..1d5ebbc1d --- /dev/null +++ b/Libraries/SndFile/Files/src/sfendian.h @@ -0,0 +1,258 @@ +/* +** Copyright (C) 1999-2004 Erik de Castro Lopo +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU Lesser General Public License as published by +** the Free Software Foundation; either version 2.1 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU Lesser General Public License for more details. +** +** You should have received a copy of the GNU Lesser General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include "config.h" + +#if HAVE_STDINT_H +#include +#endif + +#if (defined (SIZEOF_INT64_T) && (SIZEOF_INT64_T == 8)) +/* Good, we have int64_t. */ +#elif (defined (SIZEOF_LONG_LONG) && (SIZEOF_LONG_LONG == 8)) +typedef long long int64_t ; +#elif (defined (SIZEOF_LONG) && (SIZEOF_LONG == 8)) +typedef long int64_t ; +#elif (defined (WIN32) || defined (_WIN32)) +typedef __int64 int64_t ; +#else +#error "No 64 bit integer type." +#endif + +#undef HAVE_BYTESWAP_H + +#if HAVE_BYTESWAP_H + +#include + +#define ENDSWAP_SHORT(x) ((short) bswap_16 (x)) +#define ENDSWAP_INT(x) ((int) bswap_32 (x)) + +#else + +#define ENDSWAP_SHORT(x) ((((x)>>8)&0xFF)+(((x)&0xFF)<<8)) +#define ENDSWAP_INT(x) ((((x)>>24)&0xFF)+(((x)>>8)&0xFF00)+(((x)&0xFF00)<<8)+(((x)&0xFF)<<24)) + +#endif + +/* +** Many file types (ie WAV, AIFF) use sets of four consecutive bytes as a +** marker indicating different sections of the file. +** The following MAKE_MARKER macro allows th creation of integer constants +** for these markers. +*/ + +#if (CPU_IS_LITTLE_ENDIAN == 1) + #define MAKE_MARKER(a,b,c,d) ((a)|((b)<<8)|((c)<<16)|((d)<<24)) +#elif (CPU_IS_BIG_ENDIAN == 1) + #define MAKE_MARKER(a,b,c,d) (((a)<<24)|((b)<<16)|((c)<<8)|(d)) +#else + #error "Target CPU endian-ness unknown. May need to hand edit src/config.h" +#endif + +/* +** Macros to handle reading of data of a specific endian-ness into host endian +** shorts and ints. The single input is an unsigned char* pointer to the start +** of the object. There are two versions of each macro as we need to deal with +** both big and little endian CPUs. +*/ + +#if (CPU_IS_LITTLE_ENDIAN == 1) + #define LES2H_SHORT(x) (x) + #define LEI2H_INT(x) (x) + #define BES2H_SHORT(x) ENDSWAP_SHORT(x) + #define BEI2H_INT(x) ENDSWAP_INT(x) + + #define H2BE_SHORT(x) ENDSWAP_SHORT(x) + #define H2BE_INT(x) ENDSWAP_INT(x) + #define H2LE_SHORT(x) (x) + #define H2LE_INT(x) (x) + +#elif (CPU_IS_BIG_ENDIAN == 1) + #define LES2H_SHORT(x) ENDSWAP_SHORT(x) + #define LEI2H_INT(x) ENDSWAP_INT(x) + #define BES2H_SHORT(x) (x) + #define BEI2H_INT(x) (x) + + #define H2BE_SHORT(x) (x) + #define H2BE_INT(x) (x) + #define H2LE_SHORT(x) ENDSWAP_SHORT(x) + #define H2LE_INT(x) ENDSWAP_INT(x) + +#else + #error "Target CPU endian-ness unknown. May need to hand edit src/config.h" +#endif + +#define LET2H_SHORT_PTR(x) ((x) [1] + ((x) [2] << 8)) +#define LET2H_INT_PTR(x) (((x) [0] << 8) + ((x) [1] << 16) + ((x) [2] << 24)) + +#define BET2H_SHORT_PTR(x) (((x) [0] << 8) + (x) [1]) +#define BET2H_INT_PTR(x) (((x) [0] << 24) + ((x) [1] << 16) + ((x) [2] << 8)) + +/*----------------------------------------------------------------------------------------------- +** Generic functions for performing endian swapping on integer arrays. +*/ + +static inline void +endswap_short_array (short *ptr, int len) +{ short temp ; + + while (--len >= 0) + { temp = ptr [len] ; + ptr [len] = ENDSWAP_SHORT (temp) ; + } ; +} /* endswap_short_array */ + +static inline void +endswap_short_copy (short *dest, const short *src, int len) +{ + while (--len >= 0) + { dest [len] = ENDSWAP_SHORT (src [len]) ; + } ; +} /* endswap_short_copy */ + +static inline void +endswap_int_array (int *ptr, int len) +{ int temp ; + + while (--len >= 0) + { temp = ptr [len] ; + ptr [len] = ENDSWAP_INT (temp) ; + } ; +} /* endswap_int_array */ + +static inline void +endswap_int_copy (int *dest, const int *src, int len) +{ + while (--len >= 0) + { dest [len] = ENDSWAP_INT (src [len]) ; + } ; +} /* endswap_int_copy */ + +/*======================================================================================== +*/ + +#if (HAVE_BYTESWAP_H && defined (SIZEOF_INT64_T) && (SIZEOF_INT64_T == 8)) + +static inline void +endswap_int64_t_array (int64_t *ptr, int len) +{ int64_t value ; + + while (--len >= 0) + { value = ptr [len] ; + ptr [len] = bswap_64 (value) ; + } ; +} /* endswap_int64_t_array */ + +static inline void +endswap_int64_t_copy (int64_t *dest, const int64_t *src, int len) +{ int64_t value ; + + while (--len >= 0) + { value = src [len] ; + dest [len] = bswap_64 (value) ; + } ; +} /* endswap_int64_t_copy */ + +#else + +static inline void +endswap_int64_t_array (int64_t *ptr, int len) +{ unsigned char *ucptr, temp ; + + ucptr = (unsigned char *) ptr ; + ucptr += 8 * len ; + while (--len >= 0) + { ucptr -= 8 ; + + temp = ucptr [0] ; + ucptr [0] = ucptr [7] ; + ucptr [7] = temp ; + + temp = ucptr [1] ; + ucptr [1] = ucptr [6] ; + ucptr [6] = temp ; + + temp = ucptr [2] ; + ucptr [2] = ucptr [5] ; + ucptr [5] = temp ; + + temp = ucptr [3] ; + ucptr [3] = ucptr [4] ; + ucptr [4] = temp ; + } ; +} /* endswap_int64_t_array */ + +static inline void +endswap_int64_t_copy (int64_t *dest, const int64_t *src, int len) +{ const unsigned char *psrc ; + unsigned char *pdest ; + + if (dest == src) + { endswap_int64_t_array (dest, len) ; + return ; + } ; + + psrc = ((const unsigned char *) src) + 8 * len ; + pdest = ((unsigned char *) dest) + 8 * len ; + while (--len >= 0) + { psrc -= 8 ; + pdest -= 8 ; + + pdest [0] = psrc [7] ; + pdest [2] = psrc [5] ; + pdest [4] = psrc [3] ; + pdest [6] = psrc [1] ; + pdest [7] = psrc [0] ; + pdest [1] = psrc [6] ; + pdest [3] = psrc [4] ; + pdest [5] = psrc [2] ; + } ; +} /* endswap_int64_t_copy */ + +#endif + +/* A couple of wrapper functions. */ + +static inline void +endswap_float_array (float *ptr, int len) +{ endswap_int_array ((void *) ptr, len) ; +} /* endswap_float_array */ + +static inline void +endswap_double_array (double *ptr, int len) +{ endswap_int64_t_array ((void *) ptr, len) ; +} /* endswap_double_array */ + +static inline void +endswap_float_copy (float *dest, const float *src, int len) +{ endswap_int_copy ((int *) dest, (const int *) src, len) ; +} /* endswap_float_copy */ + +static inline void +endswap_double_copy (double *dest, const double *src, int len) +{ endswap_int64_t_copy ((int64_t *) dest, (const int64_t *) src, len) ; +} /* endswap_double_copy */ + +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: f0c5cd54-42d3-4237-90ec-11fe24995de7 +*/ diff --git a/Libraries/SndFile/Files/src/sndfile.c b/Libraries/SndFile/Files/src/sndfile.c new file mode 100644 index 000000000..e5ca2be1e --- /dev/null +++ b/Libraries/SndFile/Files/src/sndfile.c @@ -0,0 +1,2487 @@ +/* +** Copyright (C) 1999-2004 Erik de Castro Lopo +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU Lesser General Public License as published by +** the Free Software Foundation; either version 2.1 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU Lesser General Public License for more details. +** +** You should have received a copy of the GNU Lesser General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include "config.h" + +#include +#include +#include + +#include "sndfile.h" +#include "sfendian.h" +#include "common.h" + +#define SNDFILE_MAGICK 0x1234C0DE + +typedef struct +{ int error ; + const char *str ; +} ErrorStruct ; + +static +ErrorStruct SndfileErrors [] = +{ + /* Public error values and their associated strings. */ + { SF_ERR_NO_ERROR , "No Error." }, + { SF_ERR_UNRECOGNISED_FORMAT , "File opened for read. Format not recognised." }, + { SF_ERR_SYSTEM , "System error." /* Often replaced. */ }, + + /* Private error values and their associated strings. */ + { SFE_BAD_FILE , "File does not exist or is not a regular file (possibly a pipe?)." }, + { SFE_BAD_FILE_READ , "File exists but no data could be read." }, + { SFE_OPEN_FAILED , "Could not open file." }, + { SFE_BAD_SNDFILE_PTR , "Not a valid SNDFILE* pointer." }, + { SFE_BAD_SF_INFO_PTR , "NULL SF_INFO pointer passed to libsndfile." }, + { SFE_BAD_SF_INCOMPLETE , "SF_PRIVATE struct incomplete and end of header parsing." }, + { SFE_BAD_FILE_PTR , "Bad FILE pointer." }, + { SFE_BAD_INT_PTR , "Internal error, Bad pointer." }, + { SFE_BAD_STAT_SIZE , "Error : software was misconfigured at compile time (sizeof statbuf.st_size)." }, + + { SFE_MALLOC_FAILED , "Internal malloc () failed." }, + { SFE_UNIMPLEMENTED , "File contains data in an unimplemented format." }, + { SFE_BAD_READ_ALIGN , "Attempt to read a non-integer number of channels." }, + { SFE_BAD_WRITE_ALIGN , "Attempt to write a non-integer number of channels." }, + { SFE_UNKNOWN_FORMAT , "File contains data in an unknown format." }, + { SFE_NOT_READMODE , "Read attempted on file currently open for write." }, + { SFE_NOT_WRITEMODE , "Write attempted on file currently open for read." }, + { SFE_BAD_MODE_RW , "This file format does not support read/write mode." }, + { SFE_BAD_SF_INFO , "Internal error : SF_INFO struct incomplete." }, + { SFE_BAD_OFFSET , "Error : supplied offset beyond end of file." }, + { SFE_NO_EMBED_SUPPORT , "Error : embedding not supported for this file format." }, + { SFE_NO_EMBEDDED_RDWR , "Error : cannot open embedded file read/write." }, + { SFE_NO_PIPE_WRITE , "Error : this file format does not support pipe write." }, + { SFE_BAD_RDWR_FORMAT , "Attempted to open read only format for RDWR." }, + + { SFE_INTERLEAVE_MODE , "Attempt to write to file with non-interleaved data." }, + { SFE_INTERLEAVE_SEEK , "Bad karma in seek during interleave read operation." }, + { SFE_INTERLEAVE_READ , "Bad karma in read during interleave read operation." }, + + { SFE_INTERNAL , "Unspecified internal error." }, + { SFE_LOG_OVERRUN , "Log buffer has overrun. File probably broken." }, + { SFE_BAD_CONTROL_CMD , "Bad command passed to function sf_command()." }, + { SFE_BAD_ENDIAN , "Bad endian-ness. Try default endian-ness" }, + { SFE_CHANNEL_COUNT , "Too many channels specified." }, + + { SFE_BAD_SEEK , "Internal psf_fseek() failed." }, + { SFE_NOT_SEEKABLE , "Seek attempted on unseekable file type." }, + { SFE_AMBIGUOUS_SEEK , "Error: combination of file open mode and seek command is ambiguous." }, + { SFE_WRONG_SEEK , "Error: invalid seek parameters." }, + { SFE_SEEK_FAILED , "Error: parameters OK, but psf_seek() failed." }, + + { SFE_BAD_OPEN_MODE , "Error: bad mode parameter for file open." }, + { SFE_OPEN_PIPE_RDWR , "Error: attempt toopen a pipe in read/write mode." }, + { SFE_RDWR_POSITION , "Error on RDWR position (cryptic)." }, + { SFE_RDWR_BAD_HEADER , "Error : Cannot open file in read/write mode due to string data in header." }, + + { SFE_STR_NO_SUPPORT , "Error : File type does not support string data." }, + { SFE_STR_NOT_WRITE , "Error : Trying to set a string when file is not in write mode." }, + { SFE_STR_MAX_DATA , "Error : Maximum string data storage reached." }, + { SFE_STR_MAX_COUNT , "Error : Maximum string data count reached." }, + { SFE_STR_BAD_TYPE , "Error : Bad string data type." }, + { SFE_STR_NO_ADD_END , "Error : file type does not support strings added at end of file." }, + { SFE_STR_BAD_STRING , "Error : bad string." }, + { SFE_STR_WEIRD , "Error : Weird string error." }, + + { SFE_WAV_NO_RIFF , "Error in WAV file. No 'RIFF' chunk marker." }, + { SFE_WAV_NO_WAVE , "Error in WAV file. No 'WAVE' chunk marker." }, + { SFE_WAV_NO_FMT , "Error in WAV file. No 'fmt ' chunk marker." }, + { SFE_WAV_FMT_SHORT , "Error in WAV file. Short 'fmt ' chunk." }, + + { SFE_WAV_FMT_TOO_BIG , "Error in WAV file. 'fmt ' chunk too large." }, + { SFE_WAV_BAD_FACT , "Error in WAV file. 'fact' chunk out of place." }, + { SFE_WAV_BAD_PEAK , "Error in WAV file. Bad 'PEAK' chunk." }, + { SFE_WAV_PEAK_B4_FMT , "Error in WAV file. 'PEAK' chunk found before 'fmt ' chunk." }, + + { SFE_WAV_BAD_FORMAT , "Error in WAV file. Errors in 'fmt ' chunk." }, + { SFE_WAV_BAD_BLOCKALIGN , "Error in WAV file. Block alignment in 'fmt ' chunk is incorrect." }, + { SFE_WAV_NO_DATA , "Error in WAV file. No 'data' chunk marker." }, + { SFE_WAV_UNKNOWN_CHUNK , "Error in WAV file. File contains an unknown chunk marker." }, + { SFE_WAV_WVPK_DATA , "Error in WAV file. Data is in WAVPACK format." }, + + { SFE_WAV_ADPCM_NOT4BIT , "Error in ADPCM WAV file. Invalid bit width." }, + { SFE_WAV_ADPCM_CHANNELS , "Error in ADPCM WAV file. Invalid number of channels." }, + { SFE_WAV_GSM610_FORMAT , "Error in GSM610 WAV file. Invalid format chunk." }, + + { SFE_AIFF_NO_FORM , "Error in AIFF file, bad 'FORM' marker." }, + { SFE_AIFF_AIFF_NO_FORM , "Error in AIFF file, 'AIFF' marker without 'FORM'." }, + { SFE_AIFF_COMM_NO_FORM , "Error in AIFF file, 'COMM' marker without 'FORM'." }, + { SFE_AIFF_SSND_NO_COMM , "Error in AIFF file, 'SSND' marker without 'COMM'." }, + { SFE_AIFF_UNKNOWN_CHUNK , "Error in AIFF file, unknown chunk." }, + { SFE_AIFF_COMM_CHUNK_SIZE, "Error in AIFF file, bad 'COMM' chunk size." }, + { SFE_AIFF_BAD_COMM_CHUNK , "Error in AIFF file, bad 'COMM' chunk." }, + { SFE_AIFF_PEAK_B4_COMM , "Error in AIFF file. 'PEAK' chunk found before 'COMM' chunk." }, + { SFE_AIFF_BAD_PEAK , "Error in AIFF file. Bad 'PEAK' chunk." }, + { SFE_AIFF_NO_SSND , "Error in AIFF file, bad 'SSND' chunk." }, + { SFE_AIFF_NO_DATA , "Error in AIFF file, no sound data." }, + { SFE_AIFF_RW_SSND_NOT_LAST, "Error in AIFF file, RDWR only possible if SSND chunk at end of file." }, + + { SFE_AU_UNKNOWN_FORMAT , "Error in AU file, unknown format." }, + { SFE_AU_NO_DOTSND , "Error in AU file, missing '.snd' or 'dns.' marker." }, + { SFE_AU_EMBED_BAD_LEN , "Embedded AU file with unknown length." }, + + { SFE_RAW_READ_BAD_SPEC , "Error while opening RAW file for read. Must specify format and channels.\n" + "Possibly trying to open unsupported format." + }, + { SFE_RAW_BAD_BITWIDTH , "Error. RAW file bitwidth must be a multiple of 8." }, + { SFE_RAW_BAD_FORMAT , "Error. Bad format field in SF_INFO struct when openning a RAW file for read." }, + + { SFE_PAF_NO_MARKER , "Error in PAF file, no marker." }, + { SFE_PAF_VERSION , "Error in PAF file, bad version." }, + { SFE_PAF_UNKNOWN_FORMAT , "Error in PAF file, unknown format." }, + { SFE_PAF_SHORT_HEADER , "Error in PAF file. File shorter than minimal header." }, + + { SFE_SVX_NO_FORM , "Error in 8SVX / 16SV file, no 'FORM' marker." }, + { SFE_SVX_NO_BODY , "Error in 8SVX / 16SV file, no 'BODY' marker." }, + { SFE_SVX_NO_DATA , "Error in 8SVX / 16SV file, no sound data." }, + { SFE_SVX_BAD_COMP , "Error in 8SVX / 16SV file, unsupported compression format." }, + { SFE_SVX_BAD_NAME_LENGTH , "Error in 8SVX / 16SV file, NAME chunk too long." }, + + { SFE_NIST_BAD_HEADER , "Error in NIST file, bad header." }, + { SFE_NIST_CRLF_CONVERISON, "Error : NIST file damaged by Windows CR -> CRLF conversion process." }, + { SFE_NIST_BAD_ENCODING , "Error in NIST file, unsupported compression format." }, + + { SFE_VOC_NO_CREATIVE , "Error in VOC file, no 'Creative Voice File' marker." }, + { SFE_VOC_BAD_FORMAT , "Error in VOC file, bad format." }, + { SFE_VOC_BAD_VERSION , "Error in VOC file, bad version number." }, + { SFE_VOC_BAD_MARKER , "Error in VOC file, bad marker in file." }, + { SFE_VOC_BAD_SECTIONS , "Error in VOC file, incompatible VOC sections." }, + { SFE_VOC_MULTI_SAMPLERATE, "Error in VOC file, more than one sample rate defined." }, + { SFE_VOC_MULTI_SECTION , "Unimplemented VOC file feature, file contains multiple sound sections." }, + { SFE_VOC_MULTI_PARAM , "Error in VOC file, file contains multiple bit or channel widths." }, + { SFE_VOC_SECTION_COUNT , "Error in VOC file, too many sections." }, + { SFE_VOC_NO_PIPE , "Error : not able to operate on VOC files over a pipe." }, + + { SFE_IRCAM_NO_MARKER , "Error in IRCAM file, bad IRCAM marker." }, + { SFE_IRCAM_BAD_CHANNELS , "Error in IRCAM file, bad channel count." }, + { SFE_IRCAM_UNKNOWN_FORMAT, "Error in IRCAM file, unknow encoding format." }, + + { SFE_W64_64_BIT , "Error in W64 file, file contains 64 bit offset." }, + + { SFE_W64_NO_RIFF , "Error in W64 file. No 'riff' chunk marker." }, + { SFE_W64_NO_WAVE , "Error in W64 file. No 'wave' chunk marker." }, + { SFE_W64_NO_FMT , "Error in W64 file. No 'fmt ' chunk marker." }, + { SFE_W64_NO_DATA , "Error in W64 file. No 'data' chunk marker." }, + + { SFE_W64_FMT_SHORT , "Error in W64 file. Short 'fmt ' chunk." }, + { SFE_W64_FMT_TOO_BIG , "Error in W64 file. 'fmt ' chunk too large." }, + + { SFE_W64_ADPCM_NOT4BIT , "Error in ADPCM W64 file. Invalid bit width." }, + { SFE_W64_ADPCM_CHANNELS , "Error in ADPCM W64 file. Invalid number of channels." }, + { SFE_W64_GSM610_FORMAT , "Error in GSM610 W64 file. Invalid format chunk." }, + + { SFE_MAT4_BAD_NAME , "Error in MAT4 file. No variable name." }, + { SFE_MAT4_NO_SAMPLERATE , "Error in MAT4 file. No sample rate." }, + { SFE_MAT4_ZERO_CHANNELS , "Error in MAT4 file. Channel count is zero." }, + + { SFE_MAT5_BAD_ENDIAN , "Error in MAT5 file. Not able to determine endian-ness." }, + { SFE_MAT5_NO_BLOCK , "Error in MAT5 file. Bad block structure." }, + { SFE_MAT5_SAMPLE_RATE , "Error in MAT5 file. Not able to determine sample rate." }, + { SFE_MAT5_ZERO_CHANNELS , "Error in MAT5 file. Channel count is zero." }, + + { SFE_PVF_NO_PVF1 , "Error in PVF file. No PVF1 marker." }, + { SFE_PVF_BAD_HEADER , "Error in PVF file. Bad header." }, + { SFE_PVF_BAD_BITWIDTH , "Error in PVF file. Bad bit width." }, + + { SFE_XI_BAD_HEADER , "Error in XI file. Bad header." }, + { SFE_XI_EXCESS_SAMPLES , "Error in XI file. Excess samples in file." }, + { SFE_XI_NO_PIPE , "Error : not able to operate on XI files over a pipe." }, + + { SFE_HTK_NO_PIPE , "Error : not able to operate on HTK files over a pipe." }, + + { SFE_SDS_NOT_SDS , "Error : not an SDS file." }, + { SFE_SDS_BAD_BIT_WIDTH , "Error : bad bit width for SDS file." }, + + { SFE_SD2_FD_DISALLOWED , "Error : cannot open SD2 file without a file name." }, + { SFE_SD2_BAD_DATA_OFFSET , "Error : bad data offset." }, + { SFE_SD2_BAD_MAP_OFFSET , "Error : bad map offset." }, + { SFE_SD2_BAD_DATA_LENGTH , "Error : bad data length." }, + { SFE_SD2_BAD_MAP_LENGTH , "Error : bad map length." }, + { SFE_SD2_BAD_RSRC , "Error : bad resource fork." }, + { SFE_SD2_BAD_SAMPLE_SIZE , "Error : bad sample size." }, + + { SFE_DWVW_BAD_BITWIDTH , "Error : Bad bit width for DWVW encoding. Must be 12, 16 or 24." }, + { SFE_G72X_NOT_MONO , "Error : G72x encoding does not support more than 1 channel." }, + + { SFE_MAX_ERROR , "Maximum error number." }, + { SFE_MAX_ERROR + 1 , NULL } +} ; + +/*------------------------------------------------------------------------------ +*/ + +static int format_from_extension (const char *filename) ; +static int guess_file_type (SF_PRIVATE *psf, const char *filename) ; +static int validate_sfinfo (SF_INFO *sfinfo) ; +static int validate_psf (SF_PRIVATE *psf) ; +static void save_header_info (SF_PRIVATE *psf) ; +static void copy_filename (SF_PRIVATE *psf, const char *path) ; +static int psf_close (SF_PRIVATE *psf) ; +static int psf_open_file (SF_PRIVATE *psf, int mode, SF_INFO *sfinfo) ; + +static int try_resource_fork (SF_PRIVATE * psf, int mode) ; + +/*------------------------------------------------------------------------------ +** Private (static) variables. +*/ + +static int sf_errno = 0 ; +static char sf_logbuffer [SF_BUFFER_LEN] = { 0 } ; +static char sf_syserr [SF_SYSERR_LEN] = { 0 } ; + +/*------------------------------------------------------------------------------ +*/ + +#define VALIDATE_SNDFILE_AND_ASSIGN_PSF(a,b,c) \ + { if (! (a)) \ + { sf_errno = SFE_BAD_SNDFILE_PTR ; \ + return 0 ; \ + } ; \ + (b) = (SF_PRIVATE*) (a) ; \ + if (psf_filedes_valid (b) == 0) \ + { (b)->error = SFE_BAD_FILE_PTR ; \ + return 0 ; \ + } ; \ + if ((b)->Magick != SNDFILE_MAGICK) \ + { (b)->error = SFE_BAD_SNDFILE_PTR ; \ + return 0 ; \ + } ; \ + if (c) (b)->error = 0 ; \ + } + +/*------------------------------------------------------------------------------ +** Public functions. +*/ + +SNDFILE* +sf_open (const char *path, int mode, SF_INFO *sfinfo) +{ SF_PRIVATE *psf ; + int error = 0 ; + + if ((psf = calloc (1, sizeof (SF_PRIVATE))) == NULL) + { sf_errno = SFE_MALLOC_FAILED ; + return NULL ; + } ; + + memset (psf, 0, sizeof (SF_PRIVATE)) ; + psf->rsrcdes = -1 ; + + psf_log_printf (psf, "File : %s\n", path) ; + + copy_filename (psf, path) ; + + if (strcmp (path, "-") == 0) + error = psf_set_stdio (psf, mode) ; + else + error = psf_fopen (psf, path, mode) ; + + if (error == 0) + error = psf_open_file (psf, mode, sfinfo) ; + + if (error) + { sf_errno = error ; + if (error == SFE_SYSTEM) + LSF_SNPRINTF (sf_syserr, sizeof (sf_syserr), "%s", psf->syserr) ; + LSF_SNPRINTF (sf_logbuffer, sizeof (sf_logbuffer), "%s", psf->logbuffer) ; + psf_close (psf) ; + return NULL ; + } ; + + memcpy (sfinfo, &(psf->sf), sizeof (SF_INFO)) ; + + return (SNDFILE*) psf ; +} /* sf_open */ + +SNDFILE* +sf_open_fd (int fd, int mode, SF_INFO *sfinfo, int close_desc) +{ SF_PRIVATE *psf ; + int error ; + + if ((sfinfo->format & SF_FORMAT_TYPEMASK) == SF_FORMAT_SD2) + { sf_errno = SFE_SD2_FD_DISALLOWED ; + return NULL ; + } ; + + if ((psf = calloc (1, sizeof (SF_PRIVATE))) == NULL) + { sf_errno = SFE_MALLOC_FAILED ; + return NULL ; + } ; + + psf_set_file (psf, fd) ; + psf->rsrcdes = -1 ; + psf->is_pipe = psf_is_pipe (psf) ; + psf->fileoffset = psf_ftell (psf) ; + + if (! close_desc) + psf->do_not_close_descriptor = SF_TRUE ; + + error = psf_open_file (psf, mode, sfinfo) ; + + if (error) + { sf_errno = error ; + if (error == SFE_SYSTEM) + LSF_SNPRINTF (sf_syserr, sizeof (sf_syserr), "%s", psf->syserr) ; + LSF_SNPRINTF (sf_logbuffer, sizeof (sf_logbuffer), "%s", psf->logbuffer) ; + psf_close (psf) ; + return NULL ; + } ; + + memcpy (sfinfo, &(psf->sf), sizeof (SF_INFO)) ; + + return (SNDFILE*) psf ; +} /* sf_open_fd */ + +/*------------------------------------------------------------------------------ +*/ + +int +sf_close (SNDFILE *sndfile) +{ SF_PRIVATE *psf ; + + VALIDATE_SNDFILE_AND_ASSIGN_PSF (sndfile, psf, 1) ; + + return psf_close (psf) ; +} /* sf_close */ + +/*============================================================================== +*/ + +const char* +sf_error_number (int errnum) +{ static const char *bad_errnum = + "No error defined for this error number. This is a bug in libsndfile." ; + int k ; + + if (errnum == SFE_MAX_ERROR) + return SndfileErrors [0].str ; + + if (errnum < 0 || errnum > SFE_MAX_ERROR) + { /* This really shouldn't happen in release versions. */ + printf ("Not a valid error number (%d).\n", errnum) ; + return bad_errnum ; + } ; + + for (k = 0 ; SndfileErrors [k].str ; k++) + if (errnum == SndfileErrors [k].error) + return SndfileErrors [k].str ; + + return bad_errnum ; +} /* sf_error_number */ + +const char* +sf_strerror (SNDFILE *sndfile) +{ SF_PRIVATE *psf = NULL ; + int errnum ; + + if (! sndfile) + { errnum = sf_errno ; + if (errnum == SFE_SYSTEM && sf_syserr [0]) + return sf_syserr ; + } + else + { psf = (SF_PRIVATE *) sndfile ; + + if (psf->Magick != SNDFILE_MAGICK) + return "sf_strerror : Bad magic number." ; + + errnum = psf->error ; + + if (errnum == SFE_SYSTEM && psf->syserr [0]) + return psf->syserr ; + } ; + + return sf_error_number (errnum) ; +} /* sf_strerror */ + +/*------------------------------------------------------------------------------ +*/ + +int +sf_error (SNDFILE *sndfile) +{ SF_PRIVATE *psf ; + + if (! sndfile) + { if (sf_error != 0) + return 1 ; + return 0 ; + } ; + + VALIDATE_SNDFILE_AND_ASSIGN_PSF (sndfile, psf, 0) ; + + if (psf->error) + return 1 ; + + return 0 ; +} /* sf_error */ + +/*------------------------------------------------------------------------------ +*/ + +int +sf_perror (SNDFILE *sndfile) +{ SF_PRIVATE *psf ; + int errnum ; + + if (! sndfile) + { errnum = sf_errno ; + } + else + { VALIDATE_SNDFILE_AND_ASSIGN_PSF (sndfile, psf, 0) ; + errnum = psf->error ; + } ; + + fprintf (stderr, "%s\n", sf_error_number (errnum)) ; + return SFE_NO_ERROR ; +} /* sf_perror */ + + +/*------------------------------------------------------------------------------ +*/ + +int +sf_error_str (SNDFILE *sndfile, char *str, size_t maxlen) +{ SF_PRIVATE *psf ; + int errnum ; + + if (! str) + return SFE_INTERNAL ; + + if (! sndfile) + errnum = sf_errno ; + else + { VALIDATE_SNDFILE_AND_ASSIGN_PSF (sndfile, psf, 0) ; + errnum = psf->error ; + } ; + + LSF_SNPRINTF (str, maxlen, "%s", sf_error_number (errnum)) ; + + return SFE_NO_ERROR ; +} /* sf_error_str */ + +/*============================================================================== +*/ + +int +sf_format_check (const SF_INFO *info) +{ int subformat, endian ; + + subformat = info->format & SF_FORMAT_SUBMASK ; + endian = info->format & SF_FORMAT_ENDMASK ; + + /* This is the place where each file format can check if the suppiled + ** SF_INFO struct is valid. + ** Return 0 on failure, 1 ons success. + */ + + if (info->channels < 1 || info->channels > 256) + return 0 ; + + if (info->samplerate < 0) + return 0 ; + + switch (info->format & SF_FORMAT_TYPEMASK) + { case SF_FORMAT_WAV : + case SF_FORMAT_WAVEX : + /* WAV is strictly little endian. */ + if (endian == SF_ENDIAN_BIG || endian == SF_ENDIAN_CPU) + return 0 ; + if (subformat == SF_FORMAT_PCM_U8 || subformat == SF_FORMAT_PCM_16) + return 1 ; + if (subformat == SF_FORMAT_PCM_24 || subformat == SF_FORMAT_PCM_32) + return 1 ; + if ((subformat == SF_FORMAT_IMA_ADPCM || subformat == SF_FORMAT_MS_ADPCM) && info->channels <= 2) + return 1 ; + if (subformat == SF_FORMAT_GSM610 && info->channels == 1) + return 1 ; + if (subformat == SF_FORMAT_ULAW || subformat == SF_FORMAT_ALAW) + return 1 ; + if (subformat == SF_FORMAT_FLOAT || subformat == SF_FORMAT_DOUBLE) + return 1 ; + break ; + + case SF_FORMAT_AIFF : + /* AIFF does allow both endian-nesses for PCM data.*/ + if (subformat == SF_FORMAT_PCM_16 || subformat == SF_FORMAT_PCM_24 || subformat == SF_FORMAT_PCM_32) + return 1 ; + /* Other encodings. Check for endian-ness. */ + if (endian == SF_ENDIAN_LITTLE || endian == SF_ENDIAN_CPU) + return 0 ; + if (subformat == SF_FORMAT_PCM_U8 || subformat == SF_FORMAT_PCM_S8) + return 1 ; + if (subformat == SF_FORMAT_FLOAT || subformat == SF_FORMAT_DOUBLE) + return 1 ; + if (subformat == SF_FORMAT_ULAW || subformat == SF_FORMAT_ALAW) + return 1 ; + if ((subformat == SF_FORMAT_DWVW_12 || subformat == SF_FORMAT_DWVW_16 || + subformat == SF_FORMAT_DWVW_24) && info-> channels == 1) + return 1 ; + if (subformat == SF_FORMAT_GSM610 && info->channels == 1) + return 1 ; + if (subformat == SF_FORMAT_IMA_ADPCM && (info->channels == 1 || info->channels == 2)) + return 1 ; + break ; + + case SF_FORMAT_AU : + if (subformat == SF_FORMAT_PCM_S8 || subformat == SF_FORMAT_PCM_16) + return 1 ; + if (subformat == SF_FORMAT_PCM_24 || subformat == SF_FORMAT_PCM_32) + return 1 ; + if (subformat == SF_FORMAT_ULAW || subformat == SF_FORMAT_ALAW) + return 1 ; + if (subformat == SF_FORMAT_FLOAT || subformat == SF_FORMAT_DOUBLE) + return 1 ; + if (subformat == SF_FORMAT_G721_32 && info->channels == 1) + return 1 ; + if (subformat == SF_FORMAT_G723_24 && info->channels == 1) + return 1 ; + if (subformat == SF_FORMAT_G723_40 && info->channels == 1) + return 1 ; + break ; + + case SF_FORMAT_RAW : + if (subformat == SF_FORMAT_PCM_U8 || subformat == SF_FORMAT_PCM_S8 || subformat == SF_FORMAT_PCM_16) + return 1 ; + if (subformat == SF_FORMAT_PCM_24 || subformat == SF_FORMAT_PCM_32) + return 1 ; + if (subformat == SF_FORMAT_FLOAT || subformat == SF_FORMAT_DOUBLE) + return 1 ; + if (subformat == SF_FORMAT_ALAW || subformat == SF_FORMAT_ULAW) + return 1 ; + if ((subformat == SF_FORMAT_DWVW_12 || subformat == SF_FORMAT_DWVW_16 || + subformat == SF_FORMAT_DWVW_24) && info-> channels == 1) + return 1 ; + if (subformat == SF_FORMAT_GSM610 && info->channels == 1) + return 1 ; + if (subformat == SF_FORMAT_VOX_ADPCM && info->channels == 1) + return 1 ; + break ; + + case SF_FORMAT_PAF : + if (subformat == SF_FORMAT_PCM_S8 || subformat == SF_FORMAT_PCM_16) + return 1 ; + if (subformat == SF_FORMAT_PCM_24 || subformat == SF_FORMAT_PCM_32) + return 1 ; + break ; + + case SF_FORMAT_SVX : + /* SVX currently does not support more than one channel for write. + ** Read will allow more than one channel but only allow one here. + */ + if (info->channels != 1) + return 0 ; + /* Always big endian. */ + if (endian == SF_ENDIAN_LITTLE || endian == SF_ENDIAN_CPU) + return 0 ; + + if ((subformat == SF_FORMAT_PCM_S8 || subformat == SF_FORMAT_PCM_16) && info->channels == 1) + return 1 ; + break ; + + case SF_FORMAT_NIST : + if (subformat == SF_FORMAT_PCM_S8 || subformat == SF_FORMAT_PCM_16) + return 1 ; + if (subformat == SF_FORMAT_PCM_24 || subformat == SF_FORMAT_PCM_32) + return 1 ; + if (subformat == SF_FORMAT_ULAW || subformat == SF_FORMAT_ALAW) + return 1 ; + break ; + + case SF_FORMAT_IRCAM : + if (subformat == SF_FORMAT_PCM_16 || subformat == SF_FORMAT_PCM_24 || subformat == SF_FORMAT_PCM_32) + return 1 ; + if (subformat == SF_FORMAT_ULAW || subformat == SF_FORMAT_ALAW || subformat == SF_FORMAT_FLOAT) + return 1 ; + break ; + + case SF_FORMAT_VOC : + /* VOC is strictly little endian. */ + if (endian == SF_ENDIAN_BIG || endian == SF_ENDIAN_CPU) + return 0 ; + if (subformat == SF_FORMAT_PCM_U8 || subformat == SF_FORMAT_PCM_16) + return 1 ; + if (subformat == SF_FORMAT_ULAW || subformat == SF_FORMAT_ALAW) + return 1 ; + break ; + + case SF_FORMAT_W64 : + /* W64 is strictly little endian. */ + if (endian == SF_ENDIAN_BIG || endian == SF_ENDIAN_CPU) + return 0 ; + if (subformat == SF_FORMAT_PCM_U8 || subformat == SF_FORMAT_PCM_16) + return 1 ; + if (subformat == SF_FORMAT_PCM_24 || subformat == SF_FORMAT_PCM_32) + return 1 ; + if ((subformat == SF_FORMAT_IMA_ADPCM || subformat == SF_FORMAT_MS_ADPCM) && info->channels <= 2) + return 1 ; + if (subformat == SF_FORMAT_GSM610 && info->channels == 1) + return 1 ; + if (subformat == SF_FORMAT_ULAW || subformat == SF_FORMAT_ALAW) + return 1 ; + if (subformat == SF_FORMAT_FLOAT || subformat == SF_FORMAT_DOUBLE) + return 1 ; + break ; + + case SF_FORMAT_MAT4 : + if (subformat == SF_FORMAT_PCM_16 || subformat == SF_FORMAT_PCM_32) + return 1 ; + if (subformat == SF_FORMAT_FLOAT || subformat == SF_FORMAT_DOUBLE) + return 1 ; + break ; + + case SF_FORMAT_MAT5 : + if (subformat == SF_FORMAT_PCM_U8 || subformat == SF_FORMAT_PCM_16 || subformat == SF_FORMAT_PCM_32) + return 1 ; + if (subformat == SF_FORMAT_FLOAT || subformat == SF_FORMAT_DOUBLE) + return 1 ; + break ; + + case SF_FORMAT_PVF : + if (subformat == SF_FORMAT_PCM_S8 || subformat == SF_FORMAT_PCM_16 || subformat == SF_FORMAT_PCM_32) + return 1 ; + break ; + + case SF_FORMAT_XI : + if (info->channels != 1) + return 0 ; + if (subformat == SF_FORMAT_DPCM_8 || subformat == SF_FORMAT_DPCM_16) + return 1 ; + break ; + + case SF_FORMAT_HTK : + /* HTK is strictly big endian. */ + if (endian == SF_ENDIAN_LITTLE || endian == SF_ENDIAN_CPU) + return 0 ; + if (info->channels != 1) + return 0 ; + if (subformat == SF_FORMAT_PCM_16) + return 1 ; + break ; + + case SF_FORMAT_SDS : + /* SDS is strictly big endian. */ + if (endian == SF_ENDIAN_LITTLE || endian == SF_ENDIAN_CPU) + return 0 ; + if (info->channels != 1) + return 0 ; + if (subformat == SF_FORMAT_PCM_S8 || subformat == SF_FORMAT_PCM_16 || subformat == SF_FORMAT_PCM_24) + return 1 ; + break ; + + case SF_FORMAT_AVR : + /* SDS is strictly big endian. */ + if (endian == SF_ENDIAN_LITTLE || endian == SF_ENDIAN_CPU) + return 0 ; + if (info->channels < 1 || info->channels > 2) + return 0 ; + if (subformat == SF_FORMAT_PCM_U8 || subformat == SF_FORMAT_PCM_S8 || subformat == SF_FORMAT_PCM_16) + return 1 ; + break ; + + case SF_FORMAT_SD2 : + /* SD2 is strictly big endian. */ + if (endian == SF_ENDIAN_LITTLE || endian == SF_ENDIAN_CPU) + return 0 ; + if (subformat == SF_FORMAT_PCM_S8 || subformat == SF_FORMAT_PCM_16 || subformat == SF_FORMAT_PCM_24) + return 1 ; + break ; + + default : break ; + } ; + + return 0 ; +} /* sf_format_check */ + +/*------------------------------------------------------------------------------ +*/ + +int +sf_command (SNDFILE *sndfile, int command, void *data, int datasize) +{ SF_PRIVATE *psf = NULL ; + + /* This set of commands do not need the sndfile parameter. */ + switch (command) + { case SFC_GET_LIB_VERSION : + if (data == NULL) + return (psf->error = SFE_BAD_CONTROL_CMD) ; + if (ENABLE_EXPERIMENTAL_CODE) + LSF_SNPRINTF (data, datasize, "%s-%s-exp", PACKAGE_NAME, PACKAGE_VERSION) ; + else + LSF_SNPRINTF (data, datasize, "%s-%s", PACKAGE_NAME, PACKAGE_VERSION) ; + return 0 ; + + case SFC_GET_SIMPLE_FORMAT_COUNT : + if (data == NULL || datasize != SIGNED_SIZEOF (int)) + return (sf_errno = SFE_BAD_CONTROL_CMD) ; + *((int*) data) = psf_get_format_simple_count () ; + return 0 ; + + case SFC_GET_SIMPLE_FORMAT : + if (data == NULL || datasize != SIGNED_SIZEOF (SF_FORMAT_INFO)) + return (sf_errno = SFE_BAD_CONTROL_CMD) ; + return psf_get_format_simple (data) ; + + case SFC_GET_FORMAT_MAJOR_COUNT : + if (data == NULL || datasize != SIGNED_SIZEOF (int)) + return (sf_errno = SFE_BAD_CONTROL_CMD) ; + *((int*) data) = psf_get_format_major_count () ; + return 0 ; + + case SFC_GET_FORMAT_MAJOR : + if (data == NULL || datasize != SIGNED_SIZEOF (SF_FORMAT_INFO)) + return (sf_errno = SFE_BAD_CONTROL_CMD) ; + return psf_get_format_major (data) ; + + case SFC_GET_FORMAT_SUBTYPE_COUNT : + if (data == NULL || datasize != SIGNED_SIZEOF (int)) + return (sf_errno = SFE_BAD_CONTROL_CMD) ; + *((int*) data) = psf_get_format_subtype_count () ; + return 0 ; + + case SFC_GET_FORMAT_SUBTYPE : + if (data == NULL || datasize != SIGNED_SIZEOF (SF_FORMAT_INFO)) + return (sf_errno = SFE_BAD_CONTROL_CMD) ; + return psf_get_format_subtype (data) ; + + case SFC_GET_FORMAT_INFO : + if (data == NULL || datasize != SIGNED_SIZEOF (SF_FORMAT_INFO)) + return (sf_errno = SFE_BAD_CONTROL_CMD) ; + return psf_get_format_info (data) ; + } ; + + if (sndfile == NULL && command == SFC_GET_LOG_INFO) + { if (data == NULL) + return (psf->error = SFE_BAD_CONTROL_CMD) ; + LSF_SNPRINTF (data, datasize, "%s", sf_logbuffer) ; + return 0 ; + } ; + + VALIDATE_SNDFILE_AND_ASSIGN_PSF (sndfile, psf, 1) ; + + switch (command) + { case SFC_SET_NORM_FLOAT : + psf->norm_float = (datasize) ? SF_TRUE : SF_FALSE ; + return psf->norm_float ; + + case SFC_SET_NORM_DOUBLE : + psf->norm_double = (datasize) ? SF_TRUE : SF_FALSE ; + return psf->norm_double ; + + case SFC_GET_NORM_FLOAT : + return psf->norm_float ; + + case SFC_GET_NORM_DOUBLE : + return psf->norm_double ; + + case SFC_SET_SCALE_FLOAT_INT_READ : + { int old_value = psf->float_int_mult ; + + psf->float_int_mult = (datasize != 0) ? SF_TRUE : SF_FALSE ; + if (psf->float_int_mult && psf->float_max < 0.0) + psf->float_max = psf_calc_signal_max (psf, SF_FALSE) ; + return old_value ; + } + break ; + + case SFC_SET_ADD_PEAK_CHUNK : + { int format = psf->sf.format & SF_FORMAT_TYPEMASK ; + + /* Only WAV and AIFF support the PEAK chunk. */ + if (format != SF_FORMAT_WAV && format != SF_FORMAT_WAVEX && format != SF_FORMAT_AIFF) + return SF_FALSE ; + + format = psf->sf.format & SF_FORMAT_SUBMASK ; + + /* Only files containg the following data types support the PEAK chunk. */ + if (format != SF_FORMAT_FLOAT && format != SF_FORMAT_DOUBLE) + return SF_FALSE ; + + } ; + /* Can only do this is in SFM_WRITE mode. */ + if (psf->mode != SFM_WRITE) + return SF_FALSE ; + /* If data has already been written this must fail. */ + if (psf->have_written) + return psf->has_peak ; + /* Everything seems OK, so set psf->has_peak and re-write header. */ + psf->has_peak = (datasize) ? SF_TRUE : SF_FALSE ; + if (psf->write_header) + psf->write_header (psf, SF_TRUE) ; + return psf->has_peak ; + + case SFC_GET_LOG_INFO : + if (data == NULL) + return (psf->error = SFE_BAD_CONTROL_CMD) ; + LSF_SNPRINTF (data, datasize, "%s", psf->logbuffer) ; + break ; + + case SFC_CALC_SIGNAL_MAX : + if (data == NULL || datasize != sizeof (double)) + return (psf->error = SFE_BAD_CONTROL_CMD) ; + *((double*) data) = psf_calc_signal_max (psf, SF_FALSE) ; + break ; + + case SFC_CALC_NORM_SIGNAL_MAX : + if (data == NULL || datasize != sizeof (double)) + return (psf->error = SFE_BAD_CONTROL_CMD) ; + *((double*) data) = psf_calc_signal_max (psf, SF_TRUE) ; + break ; + + case SFC_CALC_MAX_ALL_CHANNELS : + if (data == NULL || datasize != SIGNED_SIZEOF (double) * psf->sf.channels) + return (psf->error = SFE_BAD_CONTROL_CMD) ; + return psf_calc_max_all_channels (psf, (double*) data, SF_FALSE) ; + + case SFC_CALC_NORM_MAX_ALL_CHANNELS : + if (data == NULL || datasize != SIGNED_SIZEOF (double) * psf->sf.channels) + return (psf->error = SFE_BAD_CONTROL_CMD) ; + return psf_calc_max_all_channels (psf, (double*) data, SF_TRUE) ; + + case SFC_UPDATE_HEADER_NOW : + if (psf->write_header) + psf->write_header (psf, SF_TRUE) ; + break ; + + case SFC_SET_UPDATE_HEADER_AUTO : + psf->auto_header = datasize ? SF_TRUE : SF_FALSE ; + return psf->auto_header ; + break ; + + case SFC_SET_ADD_DITHER_ON_WRITE : + case SFC_SET_ADD_DITHER_ON_READ : + /* + ** FIXME ! + ** These are obsolete. Just return. + ** Remove some time after version 1.0.8. + */ + break ; + + case SFC_SET_DITHER_ON_WRITE : + if (data == NULL || datasize != SIGNED_SIZEOF (SF_DITHER_INFO)) + return (psf->error = SFE_BAD_CONTROL_CMD) ; + memcpy (&psf->write_dither, data, sizeof (psf->write_dither)) ; + if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR) + dither_init (psf, SFM_WRITE) ; + break ; + + case SFC_SET_DITHER_ON_READ : + if (data == NULL || datasize != SIGNED_SIZEOF (SF_DITHER_INFO)) + return (psf->error = SFE_BAD_CONTROL_CMD) ; + memcpy (&psf->read_dither, data, sizeof (psf->read_dither)) ; + if (psf->mode == SFM_READ || psf->mode == SFM_RDWR) + dither_init (psf, SFM_READ) ; + break ; + + case SFC_FILE_TRUNCATE : + if (psf->mode != SFM_WRITE && psf->mode != SFM_RDWR) + return SF_TRUE ; + if (datasize != sizeof (sf_count_t)) + return SF_TRUE ; + { sf_count_t position ; + + position = *((sf_count_t*) data) ; + + if (sf_seek (sndfile, position, SEEK_SET) != position) + return SF_TRUE ; + + psf->sf.frames = position ; + + position = psf_fseek (psf, 0, SEEK_CUR) ; + + return psf_ftruncate (psf, position) ; + } ; + break ; + + case SFC_SET_RAW_START_OFFSET : + if (data == NULL || datasize != sizeof (sf_count_t)) + return (psf->error = SFE_BAD_CONTROL_CMD) ; + if ((psf->sf.format & SF_FORMAT_TYPEMASK) != SF_FORMAT_RAW) + return (psf->error = SFE_BAD_CONTROL_CMD) ; + + psf->dataoffset = *((sf_count_t*) data) ; + sf_seek (sndfile, 0, SEEK_CUR) ; + break ; + + case SFC_GET_EMBED_FILE_INFO : + if (data == NULL || datasize != sizeof (SF_EMBED_FILE_INFO)) + return (psf->error = SFE_BAD_CONTROL_CMD) ; + + ((SF_EMBED_FILE_INFO*) data)->offset = psf->fileoffset ; + ((SF_EMBED_FILE_INFO*) data)->length = psf->filelength ; + break ; + + /* Lite remove start */ + case SFC_TEST_IEEE_FLOAT_REPLACE : + psf->ieee_replace = (datasize) ? SF_TRUE : SF_FALSE ; + if ((psf->sf.format & SF_FORMAT_SUBMASK) == SF_FORMAT_FLOAT) + float32_init (psf) ; + else if ((psf->sf.format & SF_FORMAT_SUBMASK) == SF_FORMAT_DOUBLE) + double64_init (psf) ; + else + return (psf->error = SFE_BAD_CONTROL_CMD) ; + break ; + /* Lite remove end */ + + case SFC_SET_CLIPPING : + psf->add_clipping = (datasize) ? SF_TRUE : SF_FALSE ; + return psf->add_clipping ; + + case SFC_GET_CLIPPING : + return psf->add_clipping ; + + case SFC_GET_LOOP_INFO : + if (datasize != sizeof (SF_LOOP_INFO)) + return SF_FALSE ; + if (psf->loop_info != NULL) + { SF_LOOP_INFO *temp = (SF_LOOP_INFO *) data ; + memcpy (temp, psf->loop_info, sizeof (SF_LOOP_INFO)) ; + + return SF_TRUE ; + } ; + + return SF_FALSE ; + + default : + /* Must be a file specific command. Pass it on. */ + if (psf->command) + return psf->command (psf, command, data, datasize) ; + + psf_log_printf (psf, "*** sf_command : cmd = 0x%X\n", command) ; + return (psf->error = SFE_BAD_CONTROL_CMD) ; + } ; + + return 0 ; +} /* sf_command */ + +/*------------------------------------------------------------------------------ +*/ + +sf_count_t +sf_seek (SNDFILE *sndfile, sf_count_t offset, int whence) +{ SF_PRIVATE *psf ; + sf_count_t seek_from_start = 0, retval ; + + VALIDATE_SNDFILE_AND_ASSIGN_PSF (sndfile, psf, 1) ; + + if (! psf->sf.seekable) + { psf->error = SFE_NOT_SEEKABLE ; + return ((sf_count_t) -1) ; + } ; + + /* If the whence parameter has a mode ORed in, check to see that + ** it makes sense. + */ + if (((whence & SFM_MASK) == SFM_WRITE && psf->mode == SFM_READ) || + ((whence & SFM_MASK) == SFM_WRITE && psf->mode == SFM_WRITE)) + { psf->error = SFE_WRONG_SEEK ; + return ((sf_count_t) -1) ; + } ; + + /* Convert all SEEK_CUR and SEEK_END into seek_from_start to be + ** used with SEEK_SET. + */ + switch (whence) + { /* The SEEK_SET behaviour is independant of mode. */ + case SEEK_SET : + case SEEK_SET | SFM_READ : + case SEEK_SET | SFM_WRITE : + case SEEK_SET | SFM_RDWR : + seek_from_start = offset ; + break ; + + /* The SEEK_CUR is a little more tricky. */ + case SEEK_CUR : + if (offset == 0) + { if (psf->mode == SFM_READ) + return psf->read_current ; + if (psf->mode == SFM_WRITE) + return psf->write_current ; + } ; + if (psf->mode == SFM_READ) + seek_from_start = psf->read_current + offset ; + else if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR) + seek_from_start = psf->write_current + offset ; + else + psf->error = SFE_AMBIGUOUS_SEEK ; + break ; + + case SEEK_CUR | SFM_READ : + if (offset == 0) + return psf->read_current ; + seek_from_start = psf->read_current + offset ; + break ; + + case SEEK_CUR | SFM_WRITE : + if (offset == 0) + return psf->write_current ; + seek_from_start = psf->write_current + offset ; + break ; + + /* The SEEK_END */ + case SEEK_END : + case SEEK_END | SFM_READ : + case SEEK_END | SFM_WRITE : + seek_from_start = psf->sf.frames + offset ; + break ; + + default : + psf->error = SFE_BAD_SEEK ; + break ; + } ; + + if (psf->error) + return ((sf_count_t) -1) ; + + if (seek_from_start < 0 || seek_from_start > psf->sf.frames) + { psf->error = SFE_BAD_SEEK ; + return ((sf_count_t) -1) ; + } ; + + if (psf->seek) + { int new_mode = (whence & SFM_MASK) ? (whence & SFM_MASK) : psf->mode ; + + retval = psf->seek (psf, new_mode, seek_from_start) ; + + switch (new_mode) + { case SFM_READ : + psf->read_current = retval ; + break ; + case SFM_WRITE : + psf->write_current = retval ; + break ; + case SFM_RDWR : + psf->read_current = retval ; + psf->write_current = retval ; + new_mode = SFM_READ ; + break ; + } ; + + psf->last_op = new_mode ; + + return retval ; + } ; + + psf->error = SFE_AMBIGUOUS_SEEK ; + return ((sf_count_t) -1) ; +} /* sf_seek */ + +/*------------------------------------------------------------------------------ +*/ + +const char* +sf_get_string (SNDFILE *sndfile, int str_type) +{ SF_PRIVATE *psf ; + + if ((psf = (SF_PRIVATE*) sndfile) == NULL) + return NULL ; + if (psf->Magick != SNDFILE_MAGICK) + return NULL ; + + return psf_get_string (psf, str_type) ; +} /* sf_get_string */ + +int +sf_set_string (SNDFILE *sndfile, int str_type, const char* str) +{ SF_PRIVATE *psf ; + + VALIDATE_SNDFILE_AND_ASSIGN_PSF (sndfile, psf, 1) ; + + return psf_set_string (psf, str_type, str) ; +} /* sf_get_string */ + +/*============================================================================== +*/ + +sf_count_t +sf_read_raw (SNDFILE *sndfile, void *ptr, sf_count_t bytes) +{ SF_PRIVATE *psf ; + sf_count_t count ; + int bytewidth, blockwidth ; + + VALIDATE_SNDFILE_AND_ASSIGN_PSF (sndfile, psf, 1) ; + + bytewidth = (psf->bytewidth > 0) ? psf->bytewidth : 1 ; + blockwidth = (psf->blockwidth > 0) ? psf->blockwidth : 1 ; + + if (psf->mode == SFM_WRITE) + { psf->error = SFE_NOT_READMODE ; + return 0 ; + } ; + + if (bytes < 0 || psf->read_current >= psf->datalength) + { psf_memset (ptr, 0, bytes) ; + return 0 ; + } ; + + if (bytes % (psf->sf.channels * bytewidth)) + { psf->error = SFE_BAD_READ_ALIGN ; + return 0 ; + } ; + + count = psf_fread (ptr, 1, bytes, psf) ; + + if (count < bytes) + psf_memset (((char*) ptr) + count, 0, bytes - count) ; + + psf->read_current += count / blockwidth ; + + psf->last_op = SFM_READ ; + + return count ; +} /* sf_read_raw */ + +/*------------------------------------------------------------------------------ +*/ + +sf_count_t +sf_read_short (SNDFILE *sndfile, short *ptr, sf_count_t len) +{ SF_PRIVATE *psf ; + sf_count_t count, extra ; + + VALIDATE_SNDFILE_AND_ASSIGN_PSF (sndfile, psf, 1) ; + + if (psf->mode == SFM_WRITE) + { psf->error = SFE_NOT_READMODE ; + return 0 ; + } ; + + if (len % psf->sf.channels) + { psf->error = SFE_BAD_READ_ALIGN ; + return 0 ; + } ; + + if (len <= 0 || psf->read_current >= psf->sf.frames) + { psf_memset (ptr, 0, len * sizeof (short)) ; + return 0 ; /* End of file. */ + } ; + + if (! psf->read_short || psf->seek == NULL) + { psf->error = SFE_UNIMPLEMENTED ; + return 0 ; + } ; + + if (psf->last_op != SFM_READ) + if (psf->seek (psf, SFM_READ, psf->read_current) < 0) + return 0 ; + + count = psf->read_short (psf, ptr, len) ; + + if (psf->read_current + count / psf->sf.channels > psf->sf.frames) + { count = (psf->sf.frames - psf->read_current) * psf->sf.channels ; + extra = len - count ; + psf_memset (ptr + count, 0, extra * sizeof (short)) ; + psf->read_current = psf->sf.frames ; + } ; + + psf->read_current += count / psf->sf.channels ; + + psf->last_op = SFM_READ ; + + if (psf->read_current > psf->sf.frames) + { count = psf->sf.channels * (psf->read_current - psf->sf.frames) ; + psf->read_current = psf->sf.frames ; + } ; + + return count ; +} /* sf_read_short */ + +sf_count_t +sf_readf_short (SNDFILE *sndfile, short *ptr, sf_count_t frames) +{ SF_PRIVATE *psf ; + sf_count_t count, extra ; + + VALIDATE_SNDFILE_AND_ASSIGN_PSF (sndfile, psf, 1) ; + + if (psf->mode == SFM_WRITE) + { psf->error = SFE_NOT_READMODE ; + return 0 ; + } ; + + if (frames <= 0 || psf->read_current >= psf->sf.frames) + { psf_memset (ptr, 0, frames * psf->sf.channels * sizeof (short)) ; + return 0 ; /* End of file. */ + } ; + + if (! psf->read_short || psf->seek == NULL) + { psf->error = SFE_UNIMPLEMENTED ; + return 0 ; + } ; + + if (psf->last_op != SFM_READ) + if (psf->seek (psf, SFM_READ, psf->read_current) < 0) + return 0 ; + + count = psf->read_short (psf, ptr, frames * psf->sf.channels) ; + + if (psf->read_current + count / psf->sf.channels > psf->sf.frames) + { count = (psf->sf.frames - psf->read_current) * psf->sf.channels ; + extra = frames * psf->sf.channels - count ; + psf_memset (ptr + count, 0, extra * sizeof (short)) ; + psf->read_current = psf->sf.frames ; + } ; + + psf->read_current += count / psf->sf.channels ; + + psf->last_op = SFM_READ ; + + if (psf->read_current > psf->sf.frames) + { count = psf->sf.channels * (psf->read_current - psf->sf.frames) ; + psf->read_current = psf->sf.frames ; + } ; + + return count / psf->sf.channels ; +} /* sf_readf_short */ + +/*------------------------------------------------------------------------------ +*/ + +sf_count_t +sf_read_int (SNDFILE *sndfile, int *ptr, sf_count_t len) +{ SF_PRIVATE *psf ; + sf_count_t count, extra ; + + VALIDATE_SNDFILE_AND_ASSIGN_PSF (sndfile, psf, 1) ; + + if (psf->mode == SFM_WRITE) + { psf->error = SFE_NOT_READMODE ; + return 0 ; + } ; + + if (len % psf->sf.channels) + { psf->error = SFE_BAD_READ_ALIGN ; + return 0 ; + } ; + + if (len <= 0 || psf->read_current >= psf->sf.frames) + { psf_memset (ptr, 0, len * sizeof (int)) ; + return 0 ; + } ; + + if (! psf->read_int || psf->seek == NULL) + { psf->error = SFE_UNIMPLEMENTED ; + return 0 ; + } ; + + if (psf->last_op != SFM_READ) + if (psf->seek (psf, SFM_READ, psf->read_current) < 0) + return 0 ; + + count = psf->read_int (psf, ptr, len) ; + + if (psf->read_current + count / psf->sf.channels > psf->sf.frames) + { count = (psf->sf.frames - psf->read_current) * psf->sf.channels ; + extra = len - count ; + psf_memset (ptr + count, 0, extra * sizeof (int)) ; + psf->read_current = psf->sf.frames ; + } ; + + psf->read_current += count / psf->sf.channels ; + + psf->last_op = SFM_READ ; + + if (psf->read_current > psf->sf.frames) + { count = psf->sf.channels * (psf->read_current - psf->sf.frames) ; + psf->read_current = psf->sf.frames ; + } ; + + return count ; +} /* sf_read_int */ + +sf_count_t +sf_readf_int (SNDFILE *sndfile, int *ptr, sf_count_t frames) +{ SF_PRIVATE *psf ; + sf_count_t count, extra ; + + VALIDATE_SNDFILE_AND_ASSIGN_PSF (sndfile, psf, 1) ; + + if (psf->mode == SFM_WRITE) + { psf->error = SFE_NOT_READMODE ; + return 0 ; + } ; + + if (frames <= 0 || psf->read_current >= psf->sf.frames) + { psf_memset (ptr, 0, frames * psf->sf.channels * sizeof (int)) ; + return 0 ; + } ; + + if (! psf->read_int || psf->seek == NULL) + { psf->error = SFE_UNIMPLEMENTED ; + return 0 ; + } ; + + if (psf->last_op != SFM_READ) + if (psf->seek (psf, SFM_READ, psf->read_current) < 0) + return 0 ; + + count = psf->read_int (psf, ptr, frames * psf->sf.channels) ; + + if (psf->read_current + count / psf->sf.channels > psf->sf.frames) + { count = (psf->sf.frames - psf->read_current) * psf->sf.channels ; + extra = frames * psf->sf.channels - count ; + psf_memset (ptr + count, 0, extra * sizeof (int)) ; + psf->read_current = psf->sf.frames ; + } ; + + psf->read_current += count / psf->sf.channels ; + + psf->last_op = SFM_READ ; + + if (psf->read_current > psf->sf.frames) + { count = psf->sf.channels * (psf->read_current - psf->sf.frames) ; + psf->read_current = psf->sf.frames ; + } ; + + return count / psf->sf.channels ; +} /* sf_readf_int */ + +/*------------------------------------------------------------------------------ +*/ + +sf_count_t +sf_read_float (SNDFILE *sndfile, float *ptr, sf_count_t len) +{ SF_PRIVATE *psf ; + sf_count_t count, extra ; + + VALIDATE_SNDFILE_AND_ASSIGN_PSF (sndfile, psf, 1) ; + + if (psf->mode == SFM_WRITE) + { psf->error = SFE_NOT_READMODE ; + return 0 ; + } ; + + if (len % psf->sf.channels) + { psf->error = SFE_BAD_READ_ALIGN ; + return 0 ; + } ; + + if (len <= 0 || psf->read_current >= psf->sf.frames) + { psf_memset (ptr, 0, len * sizeof (float)) ; + return 0 ; + } ; + + if (! psf->read_float || psf->seek == NULL) + { psf->error = SFE_UNIMPLEMENTED ; + return 0 ; + } ; + + if (psf->last_op != SFM_READ) + if (psf->seek (psf, SFM_READ, psf->read_current) < 0) + return 0 ; + + count = psf->read_float (psf, ptr, len) ; + + if (psf->read_current + count / psf->sf.channels > psf->sf.frames) + { count = (psf->sf.frames - psf->read_current) * psf->sf.channels ; + extra = len - count ; + psf_memset (ptr + count, 0, extra * sizeof (float)) ; + psf->read_current = psf->sf.frames ; + } ; + + psf->read_current += count / psf->sf.channels ; + + psf->last_op = SFM_READ ; + + if (psf->read_current > psf->sf.frames) + { count = psf->sf.channels * (psf->read_current - psf->sf.frames) ; + psf->read_current = psf->sf.frames ; + } ; + + return count ; +} /* sf_read_float */ + +sf_count_t +sf_readf_float (SNDFILE *sndfile, float *ptr, sf_count_t frames) +{ SF_PRIVATE *psf ; + sf_count_t count, extra ; + + VALIDATE_SNDFILE_AND_ASSIGN_PSF (sndfile, psf, 1) ; + + if (psf->mode == SFM_WRITE) + { psf->error = SFE_NOT_READMODE ; + return 0 ; + } ; + + if (frames <= 0 || psf->read_current >= psf->sf.frames) + { psf_memset (ptr, 0, frames * psf->sf.channels * sizeof (float)) ; + return 0 ; + } ; + + if (! psf->read_float || psf->seek == NULL) + { psf->error = SFE_UNIMPLEMENTED ; + return 0 ; + } ; + + if (psf->last_op != SFM_READ) + if (psf->seek (psf, SFM_READ, psf->read_current) < 0) + return 0 ; + + count = psf->read_float (psf, ptr, frames * psf->sf.channels) ; + + if (psf->read_current + count / psf->sf.channels > psf->sf.frames) + { count = (psf->sf.frames - psf->read_current) * psf->sf.channels ; + extra = frames * psf->sf.channels - count ; + psf_memset (ptr + count, 0, extra * sizeof (float)) ; + psf->read_current = psf->sf.frames ; + } ; + + psf->read_current += count / psf->sf.channels ; + + psf->last_op = SFM_READ ; + + if (psf->read_current > psf->sf.frames) + { count = psf->sf.channels * (psf->read_current - psf->sf.frames) ; + psf->read_current = psf->sf.frames ; + } ; + + return count / psf->sf.channels ; +} /* sf_readf_float */ + +/*------------------------------------------------------------------------------ +*/ + +sf_count_t +sf_read_double (SNDFILE *sndfile, double *ptr, sf_count_t len) +{ SF_PRIVATE *psf ; + sf_count_t count, extra ; + + VALIDATE_SNDFILE_AND_ASSIGN_PSF (sndfile, psf, 1) ; + + if (psf->mode == SFM_WRITE) + { psf->error = SFE_NOT_READMODE ; + return 0 ; + } ; + + if (len % psf->sf.channels) + { psf->error = SFE_BAD_READ_ALIGN ; + return 0 ; + } ; + + if (len <= 0 || psf->read_current >= psf->sf.frames) + { psf_memset (ptr, 0, len * sizeof (double)) ; + return 0 ; + } ; + + if (! psf->read_double || psf->seek == NULL) + { psf->error = SFE_UNIMPLEMENTED ; + return 0 ; + } ; + + if (psf->last_op != SFM_READ) + if (psf->seek (psf, SFM_READ, psf->read_current) < 0) + return 0 ; + + count = psf->read_double (psf, ptr, len) ; + + if (psf->read_current + count / psf->sf.channels > psf->sf.frames) + { count = (psf->sf.frames - psf->read_current) * psf->sf.channels ; + extra = len - count ; + psf_memset (ptr + count, 0, extra * sizeof (double)) ; + psf->read_current = psf->sf.frames ; + } ; + + psf->read_current += count / psf->sf.channels ; + + psf->last_op = SFM_READ ; + + if (psf->read_current > psf->sf.frames) + { count = psf->sf.channels * (psf->read_current - psf->sf.frames) ; + psf->read_current = psf->sf.frames ; + } ; + + return count ; +} /* sf_read_double */ + +sf_count_t +sf_readf_double (SNDFILE *sndfile, double *ptr, sf_count_t frames) +{ SF_PRIVATE *psf ; + sf_count_t count, extra ; + + VALIDATE_SNDFILE_AND_ASSIGN_PSF (sndfile, psf, 1) ; + + if (psf->mode == SFM_WRITE) + { psf->error = SFE_NOT_READMODE ; + return 0 ; + } ; + + if (frames <= 0 || psf->read_current >= psf->sf.frames) + { psf_memset (ptr, 0, frames * psf->sf.channels * sizeof (double)) ; + return 0 ; + } ; + + if (! psf->read_double || psf->seek == NULL) + { psf->error = SFE_UNIMPLEMENTED ; + return 0 ; + } ; + + if (psf->last_op != SFM_READ) + if (psf->seek (psf, SFM_READ, psf->read_current) < 0) + return 0 ; + + count = psf->read_double (psf, ptr, frames * psf->sf.channels) ; + + if (psf->read_current + count / psf->sf.channels > psf->sf.frames) + { count = (psf->sf.frames - psf->read_current) * psf->sf.channels ; + extra = frames * psf->sf.channels - count ; + psf_memset (ptr + count, 0, extra * sizeof (double)) ; + psf->read_current = psf->sf.frames ; + } ; + + psf->read_current += count / psf->sf.channels ; + + psf->last_op = SFM_READ ; + + if (psf->read_current > psf->sf.frames) + { count = psf->sf.channels * (psf->read_current - psf->sf.frames) ; + psf->read_current = psf->sf.frames ; + } ; + + return count / psf->sf.channels ; +} /* sf_readf_double */ + +/*------------------------------------------------------------------------------ +*/ + +sf_count_t +sf_write_raw (SNDFILE *sndfile, void *ptr, sf_count_t len) +{ SF_PRIVATE *psf ; + sf_count_t count ; + int bytewidth, blockwidth ; + + VALIDATE_SNDFILE_AND_ASSIGN_PSF (sndfile, psf, 1) ; + + bytewidth = (psf->bytewidth > 0) ? psf->bytewidth : 1 ; + blockwidth = (psf->blockwidth > 0) ? psf->blockwidth : 1 ; + + if (psf->mode == SFM_READ) + { psf->error = SFE_NOT_WRITEMODE ; + return 0 ; + } ; + + if (len % (psf->sf.channels * bytewidth)) + { psf->error = SFE_BAD_WRITE_ALIGN ; + return 0 ; + } ; + + if (psf->have_written == SF_FALSE && psf->write_header != NULL) + psf->write_header (psf, SF_FALSE) ; + psf->have_written = SF_TRUE ; + + count = psf_fwrite (ptr, 1, len, psf) ; + + psf->write_current += count / blockwidth ; + + if (psf->write_current > psf->sf.frames) + psf->sf.frames = psf->write_current ; + + psf->last_op = SFM_WRITE ; + + return count ; +} /* sf_write_raw */ + +/*------------------------------------------------------------------------------ +*/ + +sf_count_t +sf_write_short (SNDFILE *sndfile, short *ptr, sf_count_t len) +{ SF_PRIVATE *psf ; + sf_count_t count ; + + VALIDATE_SNDFILE_AND_ASSIGN_PSF (sndfile, psf, 1) ; + + if (psf->mode == SFM_READ) + { psf->error = SFE_NOT_WRITEMODE ; + return 0 ; + } ; + + if (len % psf->sf.channels) + { psf->error = SFE_BAD_WRITE_ALIGN ; + return 0 ; + } ; + + if (! psf->write_short || psf->seek == NULL) + { psf->error = SFE_UNIMPLEMENTED ; + return 0 ; + } ; + + if (psf->last_op != SFM_WRITE) + if (psf->seek (psf, SFM_WRITE, psf->write_current) < 0) + return 0 ; + + if (psf->have_written == SF_FALSE && psf->write_header != NULL) + psf->write_header (psf, SF_FALSE) ; + psf->have_written = SF_TRUE ; + + count = psf->write_short (psf, ptr, len) ; + + psf->write_current += count / psf->sf.channels ; + + psf->last_op = SFM_WRITE ; + + if (psf->auto_header) + psf->write_header (psf, SF_TRUE) ; + + if (psf->write_current > psf->sf.frames) + psf->sf.frames = psf->write_current ; + + return count ; +} /* sf_write_short */ + +sf_count_t +sf_writef_short (SNDFILE *sndfile, short *ptr, sf_count_t frames) +{ SF_PRIVATE *psf ; + sf_count_t count ; + + VALIDATE_SNDFILE_AND_ASSIGN_PSF (sndfile, psf, 1) ; + + if (psf->mode == SFM_READ) + { psf->error = SFE_NOT_WRITEMODE ; + return 0 ; + } ; + + if (! psf->write_short || psf->seek == NULL) + { psf->error = SFE_UNIMPLEMENTED ; + return 0 ; + } ; + + if (psf->last_op != SFM_WRITE) + if (psf->seek (psf, SFM_WRITE, psf->write_current) < 0) + return 0 ; + + if (psf->have_written == SF_FALSE && psf->write_header != NULL) + psf->write_header (psf, SF_FALSE) ; + psf->have_written = SF_TRUE ; + + count = psf->write_short (psf, ptr, frames * psf->sf.channels) ; + + psf->write_current += count / psf->sf.channels ; + + psf->last_op = SFM_WRITE ; + + if (psf->auto_header) + psf->write_header (psf, SF_TRUE) ; + + if (psf->write_current > psf->sf.frames) + psf->sf.frames = psf->write_current ; + + return count / psf->sf.channels ; +} /* sf_writef_short */ + +/*------------------------------------------------------------------------------ +*/ + +sf_count_t +sf_write_int (SNDFILE *sndfile, int *ptr, sf_count_t len) +{ SF_PRIVATE *psf ; + sf_count_t count ; + + VALIDATE_SNDFILE_AND_ASSIGN_PSF (sndfile, psf, 1) ; + + if (psf->mode == SFM_READ) + { psf->error = SFE_NOT_WRITEMODE ; + return 0 ; + } ; + + if (len % psf->sf.channels) + { psf->error = SFE_BAD_WRITE_ALIGN ; + return 0 ; + } ; + + if (! psf->write_int || psf->seek == NULL) + { psf->error = SFE_UNIMPLEMENTED ; + return 0 ; + } ; + + if (psf->last_op != SFM_WRITE) + if (psf->seek (psf, SFM_WRITE, psf->write_current) < 0) + return 0 ; + + if (psf->have_written == SF_FALSE && psf->write_header != NULL) + psf->write_header (psf, SF_FALSE) ; + psf->have_written = SF_TRUE ; + + count = psf->write_int (psf, ptr, len) ; + + psf->write_current += count / psf->sf.channels ; + + psf->last_op = SFM_WRITE ; + + if (psf->auto_header) + psf->write_header (psf, SF_TRUE) ; + + if (psf->write_current > psf->sf.frames) + psf->sf.frames = psf->write_current ; + + return count ; +} /* sf_write_int */ + +sf_count_t +sf_writef_int (SNDFILE *sndfile, int *ptr, sf_count_t frames) +{ SF_PRIVATE *psf ; + sf_count_t count ; + + VALIDATE_SNDFILE_AND_ASSIGN_PSF (sndfile, psf, 1) ; + + if (psf->mode == SFM_READ) + { psf->error = SFE_NOT_WRITEMODE ; + return 0 ; + } ; + + if (! psf->write_int || psf->seek == NULL) + { psf->error = SFE_UNIMPLEMENTED ; + return 0 ; + } ; + + if (psf->last_op != SFM_WRITE) + if (psf->seek (psf, SFM_WRITE, psf->write_current) < 0) + return 0 ; + + if (psf->have_written == SF_FALSE && psf->write_header != NULL) + psf->write_header (psf, SF_FALSE) ; + psf->have_written = SF_TRUE ; + + count = psf->write_int (psf, ptr, frames * psf->sf.channels) ; + + psf->write_current += count / psf->sf.channels ; + + psf->last_op = SFM_WRITE ; + + if (psf->auto_header) + psf->write_header (psf, SF_TRUE) ; + + if (psf->write_current > psf->sf.frames) + psf->sf.frames = psf->write_current ; + + return count / psf->sf.channels ; +} /* sf_writef_int */ + +/*------------------------------------------------------------------------------ +*/ + +sf_count_t +sf_write_float (SNDFILE *sndfile, float *ptr, sf_count_t len) +{ SF_PRIVATE *psf ; + sf_count_t count ; + + VALIDATE_SNDFILE_AND_ASSIGN_PSF (sndfile, psf, 1) ; + + if (psf->mode == SFM_READ) + { psf->error = SFE_NOT_WRITEMODE ; + return 0 ; + } ; + + if (len % psf->sf.channels) + { psf->error = SFE_BAD_WRITE_ALIGN ; + return 0 ; + } ; + + if (! psf->write_float || psf->seek == NULL) + { psf->error = SFE_UNIMPLEMENTED ; + return 0 ; + } ; + + if (psf->last_op != SFM_WRITE) + if (psf->seek (psf, SFM_WRITE, psf->write_current) < 0) + return 0 ; + + if (psf->have_written == SF_FALSE && psf->write_header != NULL) + psf->write_header (psf, SF_FALSE) ; + psf->have_written = SF_TRUE ; + + count = psf->write_float (psf, ptr, len) ; + + psf->write_current += count / psf->sf.channels ; + + psf->last_op = SFM_WRITE ; + + if (psf->auto_header) + psf->write_header (psf, SF_TRUE) ; + + if (psf->write_current > psf->sf.frames) + psf->sf.frames = psf->write_current ; + + return count ; +} /* sf_write_float */ + +sf_count_t +sf_writef_float (SNDFILE *sndfile, float *ptr, sf_count_t frames) +{ SF_PRIVATE *psf ; + sf_count_t count ; + + VALIDATE_SNDFILE_AND_ASSIGN_PSF (sndfile, psf, 1) ; + + if (psf->mode == SFM_READ) + { psf->error = SFE_NOT_WRITEMODE ; + return 0 ; + } ; + + if (! psf->write_float || psf->seek == NULL) + { psf->error = SFE_UNIMPLEMENTED ; + return 0 ; + } ; + + if (psf->last_op != SFM_WRITE) + if (psf->seek (psf, SFM_WRITE, psf->write_current) < 0) + return 0 ; + + if (psf->have_written == SF_FALSE && psf->write_header != NULL) + psf->write_header (psf, SF_FALSE) ; + psf->have_written = SF_TRUE ; + + count = psf->write_float (psf, ptr, frames * psf->sf.channels) ; + + psf->write_current += count / psf->sf.channels ; + + psf->last_op = SFM_WRITE ; + + if (psf->auto_header) + psf->write_header (psf, SF_TRUE) ; + + if (psf->write_current > psf->sf.frames) + psf->sf.frames = psf->write_current ; + + return count / psf->sf.channels ; +} /* sf_writef_float */ + +/*------------------------------------------------------------------------------ +*/ + +sf_count_t +sf_write_double (SNDFILE *sndfile, double *ptr, sf_count_t len) +{ SF_PRIVATE *psf ; + sf_count_t count ; + + VALIDATE_SNDFILE_AND_ASSIGN_PSF (sndfile, psf, 1) ; + + if (psf->mode == SFM_READ) + { psf->error = SFE_NOT_WRITEMODE ; + return 0 ; + } ; + + if (len % psf->sf.channels) + { psf->error = SFE_BAD_WRITE_ALIGN ; + return 0 ; + } ; + + if (! psf->write_double || psf->seek == NULL) + { psf->error = SFE_UNIMPLEMENTED ; + return 0 ; + } ; + + if (psf->last_op != SFM_WRITE) + if (psf->seek (psf, SFM_WRITE, psf->write_current) < 0) + return 0 ; + + if (psf->have_written == SF_FALSE && psf->write_header != NULL) + psf->write_header (psf, SF_FALSE) ; + psf->have_written = SF_TRUE ; + + count = psf->write_double (psf, ptr, len) ; + + psf->write_current += count / psf->sf.channels ; + + psf->last_op = SFM_WRITE ; + + if (psf->auto_header) + psf->write_header (psf, SF_TRUE) ; + + if (psf->write_current > psf->sf.frames) + psf->sf.frames = psf->write_current ; + + return count ; +} /* sf_write_double */ + +sf_count_t +sf_writef_double (SNDFILE *sndfile, double *ptr, sf_count_t frames) +{ SF_PRIVATE *psf ; + sf_count_t count ; + + VALIDATE_SNDFILE_AND_ASSIGN_PSF (sndfile, psf, 1) ; + + if (psf->mode == SFM_READ) + { psf->error = SFE_NOT_WRITEMODE ; + return 0 ; + } ; + + if (! psf->write_double || psf->seek == NULL) + { psf->error = SFE_UNIMPLEMENTED ; + return 0 ; + } ; + + if (psf->last_op != SFM_WRITE) + if (psf->seek (psf, SFM_WRITE, psf->write_current) < 0) + return 0 ; + + if (psf->have_written == SF_FALSE && psf->write_header != NULL) + psf->write_header (psf, SF_FALSE) ; + psf->have_written = SF_TRUE ; + + count = psf->write_double (psf, ptr, frames * psf->sf.channels) ; + + psf->write_current += count / psf->sf.channels ; + + psf->last_op = SFM_WRITE ; + + if (psf->auto_header) + psf->write_header (psf, SF_TRUE) ; + + if (psf->write_current > psf->sf.frames) + psf->sf.frames = psf->write_current ; + + return count / psf->sf.channels ; +} /* sf_writef_double */ + +/*========================================================================= +** Private functions. +*/ + +static int +try_resource_fork (SF_PRIVATE * psf, int mode) +{ + if (psf_open_rsrc (psf, mode) != 0) + return 0 ; + + /* More checking here. */ + psf_log_printf (psf, "Resource fork : %s\n", psf->rsrcpath) ; + + return SF_FORMAT_SD2 ; +} /* try_resource_fork */ + +static int +format_from_extension (const char *filename) +{ char *cptr ; + char buffer [16] ; + + if (filename == NULL) + return 0 ; + + if ((cptr = strrchr (filename, '.')) == NULL) + return 0 ; + + cptr ++ ; + if (strlen (cptr) > sizeof (buffer) - 1) + return 0 ; + + strncpy (buffer, cptr, sizeof (buffer)) ; + buffer [sizeof (buffer) - 1] = 0 ; + + /* Convert everything in the buffer to lower case. */ + cptr = buffer ; + while (*cptr) + { *cptr = tolower (*cptr) ; + cptr ++ ; + } ; + + cptr = buffer ; + + if (strcmp (cptr, "au") == 0) + return SF_FORMAT_AU | SF_FORMAT_ULAW ; + + if (strcmp (cptr, "snd") == 0) + return SF_FORMAT_AU | SF_FORMAT_ULAW ; + + if (strcmp (cptr, "vox") == 0) + return SF_FORMAT_RAW | SF_FORMAT_VOX_ADPCM ; + + return 0 ; +} /* format_from_extension */ + +static int +guess_file_type (SF_PRIVATE *psf, const char *filename) +{ int buffer [3], format ; + + if (psf_binheader_readf (psf, "b", &buffer, SIGNED_SIZEOF (buffer)) != SIGNED_SIZEOF (buffer)) + { psf->error = SFE_BAD_FILE_READ ; + return 0 ; + } ; + + if (buffer [0] == MAKE_MARKER ('R', 'I', 'F', 'F') && buffer [2] == MAKE_MARKER ('W', 'A', 'V', 'E')) + return SF_FORMAT_WAV ; + + if (buffer [0] == MAKE_MARKER ('F', 'O', 'R', 'M')) + { if (buffer [2] == MAKE_MARKER ('A', 'I', 'F', 'F') || buffer [2] == MAKE_MARKER ('A', 'I', 'F', 'C')) + return SF_FORMAT_AIFF ; + if (buffer [2] == MAKE_MARKER ('8', 'S', 'V', 'X') || buffer [2] == MAKE_MARKER ('1', '6', 'S', 'V')) + return SF_FORMAT_SVX ; + return 0 ; + } ; + + if (buffer [0] == MAKE_MARKER ('.', 's', 'n', 'd') || buffer [0] == MAKE_MARKER ('d', 'n', 's', '.')) + return SF_FORMAT_AU ; + + if ((buffer [0] == MAKE_MARKER ('f', 'a', 'p', ' ') || buffer [0] == MAKE_MARKER (' ', 'p', 'a', 'f'))) + return SF_FORMAT_PAF ; + + if (buffer [0] == MAKE_MARKER ('N', 'I', 'S', 'T')) + return SF_FORMAT_NIST ; + + if (buffer [0] == MAKE_MARKER ('C', 'r', 'e', 'a') && buffer [1] == MAKE_MARKER ('t', 'i', 'v', 'e')) + return SF_FORMAT_VOC ; + + if ((buffer [0] & MAKE_MARKER (0xFF, 0xFF, 0xF8, 0xFF)) == MAKE_MARKER (0x64, 0xA3, 0x00, 0x00) || + (buffer [0] & MAKE_MARKER (0xFF, 0xF8, 0xFF, 0xFF)) == MAKE_MARKER (0x00, 0x00, 0xA3, 0x64)) + return SF_FORMAT_IRCAM ; + + if (buffer [0] == MAKE_MARKER ('r', 'i', 'f', 'f')) + return SF_FORMAT_W64 ; + + if (buffer [0] == MAKE_MARKER (0, 0, 0x03, 0xE8) && buffer [1] == MAKE_MARKER (0, 0, 0, 1) && + buffer [2] == MAKE_MARKER (0, 0, 0, 1)) + return SF_FORMAT_MAT4 ; + + if (buffer [0] == MAKE_MARKER (0, 0, 0, 0) && buffer [1] == MAKE_MARKER (1, 0, 0, 0) && + buffer [2] == MAKE_MARKER (1, 0, 0, 0)) + return SF_FORMAT_MAT4 ; + + if (buffer [0] == MAKE_MARKER ('M', 'A', 'T', 'L') && buffer [1] == MAKE_MARKER ('A', 'B', ' ', '5')) + return SF_FORMAT_MAT5 ; + + if (buffer [0] == MAKE_MARKER ('P', 'V', 'F', '1')) + return SF_FORMAT_PVF ; + + if (buffer [0] == MAKE_MARKER ('E', 'x', 't', 'e') && buffer [1] == MAKE_MARKER ('n', 'd', 'e', 'd') && + buffer [2] == MAKE_MARKER (' ', 'I', 'n', 's')) + return SF_FORMAT_XI ; + + if (ENABLE_EXPERIMENTAL_CODE && buffer [0] == MAKE_MARKER ('O', 'g', 'g', 'S')) + return SF_FORMAT_OGG ; + + if (buffer [0] == MAKE_MARKER ('A', 'L', 'a', 'w') && buffer [1] == MAKE_MARKER ('S', 'o', 'u', 'n') + && buffer [2] == MAKE_MARKER ('d', 'F', 'i', 'l')) + return SF_FORMAT_WVE ; + + if (buffer [0] == MAKE_MARKER ('D', 'i', 'a', 'm') && buffer [1] == MAKE_MARKER ('o', 'n', 'd', 'W') + && buffer [2] == MAKE_MARKER ('a', 'r', 'e', ' ')) + return SF_FORMAT_DWD ; + + if (buffer [0] == MAKE_MARKER ('L', 'M', '8', '9') || buffer [0] == MAKE_MARKER ('5', '3', 0, 0)) + return SF_FORMAT_TXW ; + + if ((buffer [0] & MAKE_MARKER (0xFF, 0xFF, 0x80, 0xFF)) == MAKE_MARKER (0xF0, 0x7E, 0, 0x01)) + return SF_FORMAT_SDS ; + + if (buffer [0] == MAKE_MARKER ('C', 'A', 'T', ' ') && buffer [2] == MAKE_MARKER ('R', 'E', 'X', '2')) + return SF_FORMAT_REX2 ; + + if (buffer [0] == MAKE_MARKER (0x30, 0x26, 0xB2, 0x75) && buffer [1] == MAKE_MARKER (0x8E, 0x66, 0xCF, 0x11)) + return 0 /*-SF_FORMAT_WMA-*/ ; + + /* HMM (Hidden Markov Model) Tool Kit. */ + if (2 * BEI2H_INT (buffer [0]) + 12 == psf->filelength && buffer [2] == MAKE_MARKER (0, 2, 0, 0)) + return SF_FORMAT_HTK ; + + if (buffer [0] == MAKE_MARKER ('f', 'L', 'a', 'C')) + return 0 /*-SF_FORMAT_FLAC-*/ ; + + /* Turtle Beach SMP 16-bit */ + if (buffer [0] == MAKE_MARKER ('S', 'O', 'U', 'N') && buffer [1] == MAKE_MARKER ('D', ' ', 'S', 'A')) + return 0 ; + + if (buffer [0] == MAKE_MARKER ('S', 'Y', '8', '0') || buffer [0] == MAKE_MARKER ('S', 'Y', '8', '5')) + return 0 ; + + if (buffer [0] == MAKE_MARKER ('a', 'j', 'k', 'g')) + return 0 /*-SF_FORMAT_SHN-*/ ; + + if (buffer [0] == MAKE_MARKER ('2', 'B', 'I', 'T')) + return SF_FORMAT_AVR ; + + /* This must be the second last one. */ + if (psf->filelength > 0 && (format = try_resource_fork (psf, SFM_READ)) != 0) + return format ; + + /* This must be the last one. */ + if ((format = format_from_extension (filename)) != 0) + return format ; + + /* Default to header-less RAW PCM file type. */ + return SF_FORMAT_RAW ; +} /* guess_file_type */ + + +static int +validate_sfinfo (SF_INFO *sfinfo) +{ if (sfinfo->samplerate < 1) + return 0 ; + if (sfinfo->frames < 0) + return 0 ; + if (sfinfo->channels < 1) + return 0 ; + if ((sfinfo->format & SF_FORMAT_TYPEMASK) == 0) + return 0 ; + if ((sfinfo->format & SF_FORMAT_SUBMASK) == 0) + return 0 ; + if (sfinfo->sections < 1) + return 0 ; + return 1 ; +} /* validate_sfinfo */ + +static int +validate_psf (SF_PRIVATE *psf) +{ + if (psf->datalength < 0) + { psf_log_printf (psf, "Invalid SF_PRIVATE field : datalength == %D.\n", psf->datalength) ; + return 0 ; + } ; + if (psf->dataoffset < 0) + { psf_log_printf (psf, "Invalid SF_PRIVATE field : dataoffset == %D.\n", psf->dataoffset) ; + return 0 ; + } ; + if (psf->blockwidth && psf->blockwidth != psf->sf.channels * psf->bytewidth) + { psf_log_printf (psf, "Invalid SF_PRIVATE field : channels * bytewidth == %d.\n", + psf->sf.channels * psf->bytewidth) ; + return 0 ; + } ; + return 1 ; +} /* validate_psf */ + +static void +save_header_info (SF_PRIVATE *psf) +{ LSF_SNPRINTF (sf_logbuffer, sizeof (sf_logbuffer), "%s", psf->logbuffer) ; +} /* save_header_info */ + +static void +copy_filename (SF_PRIVATE *psf, const char *path) +{ const char *cptr ; + + LSF_SNPRINTF (psf->filepath, sizeof (psf->filepath), "%s", path) ; + + if ((cptr = strrchr (path, '/')) || (cptr = strrchr (path, '\\'))) + cptr ++ ; + else + cptr = path ; + + memset (psf->filename, 0, sizeof (psf->filename)) ; + + LSF_SNPRINTF (psf->filename, sizeof (psf->filename), "%s", cptr) ; + +} /* copy_filename */ + +/*============================================================================== +*/ + +static int +psf_close (SF_PRIVATE *psf) +{ int error ; + + if (psf->close) + error = psf->close (psf) ; + + psf_fclose (psf) ; + + if (psf->rsrcdes >= 0) + psf_close_rsrc (psf) ; + + if (psf->fdata) + free (psf->fdata) ; + + if (psf->interleave) + free (psf->interleave) ; + + if (psf->dither) + free (psf->dither) ; + + if (psf->pchunk) + free (psf->pchunk) ; + + if (psf->format_desc) + { memset (psf->format_desc, 0, strlen (psf->format_desc)) ; + free (psf->format_desc) ; + } ; + + memset (psf, 0, sizeof (SF_PRIVATE)) ; + free (psf) ; + + return 0 ; +} /* psf_close */ + +static int +psf_open_file (SF_PRIVATE *psf, int mode, SF_INFO *sfinfo) +{ int error, format ; + + if (mode != SFM_READ && mode != SFM_WRITE && mode != SFM_RDWR) + return SFE_BAD_OPEN_MODE ; + + if (sfinfo == NULL) + return SFE_BAD_SF_INFO_PTR ; + + /* Zero out these fields. */ + sfinfo->frames = 0 ; + sfinfo->sections = 0 ; + sfinfo->seekable = 0 ; + + if (mode == SFM_READ) + { if ((sfinfo->format & SF_FORMAT_TYPEMASK) == SF_FORMAT_RAW) + { if (sf_format_check (sfinfo) == 0) + return SFE_RAW_BAD_FORMAT ; + } + else + memset (sfinfo, 0, sizeof (SF_INFO)) ; + } ; + + sf_errno = error = 0 ; + sf_logbuffer [0] = 0 ; + + memcpy (&(psf->sf), sfinfo, sizeof (SF_INFO)) ; + + psf->Magick = SNDFILE_MAGICK ; + psf->norm_float = SF_TRUE ; + psf->norm_double = SF_TRUE ; + psf->mode = mode ; + psf->dataoffset = -1 ; + psf->datalength = -1 ; + psf->read_current = -1 ; + psf->write_current = -1 ; + psf->auto_header = SF_FALSE ; + psf->rwf_endian = SF_ENDIAN_LITTLE ; + psf->seek = psf_default_seek ; + psf->float_int_mult = 0 ; + psf->float_max = -1.0 ; + + psf->sf.sections = 1 ; + + psf->is_pipe = psf_is_pipe (psf) ; + + if (psf->is_pipe) + { psf->sf.seekable = SF_FALSE ; + psf->filelength = SF_COUNT_MAX ; + } + else + { psf->sf.seekable = SF_TRUE ; + + /* File is open, so get the length. */ + psf->filelength = psf_get_filelen (psf) ; + } ; + + if (psf->fileoffset > 0) + { switch (psf->mode) + { case SFM_READ : + if (psf->filelength < 44) + { psf_log_printf (psf, "Short filelength: %D (fileoffset: %D)\n", psf->filelength, psf->fileoffset) ; + return SFE_BAD_OFFSET ; + } ; + break ; + + case SFM_WRITE : + psf->fileoffset = 0 ; + psf_fseek (psf, 0, SEEK_END) ; + psf->fileoffset = psf_ftell (psf) ; + break ; + + case SFM_RDWR : + return SFE_NO_EMBEDDED_RDWR ; + } ; + + psf_log_printf (psf, "Embedded file offset : %D\n", psf->fileoffset) ; + } ; + + if (psf->filelength == SF_COUNT_MAX) + psf_log_printf (psf, "Length : unknown\n") ; + else + psf_log_printf (psf, "Length : %D\n", psf->filelength) ; + + if (mode == SFM_WRITE || (mode == SFM_RDWR && psf->filelength == 0)) + { /* If the file is being opened for write or RDWR and the file is currently + ** empty, then the SF_INFO struct must contain valid data. + */ + if (sf_format_check (&(psf->sf)) == 0) + return SFE_BAD_OPEN_FORMAT ; + } + else if ((psf->sf.format & SF_FORMAT_TYPEMASK) != SF_FORMAT_RAW) + { /* If type RAW has not been specified then need to figure out file type. */ + psf->sf.format = guess_file_type (psf, psf->filename) ; + } ; + + /* Prevent unnecessary seeks */ + psf->last_op = psf->mode ; + + /* Set bytewidth if known. */ + switch (psf->sf.format & SF_FORMAT_SUBMASK) + { case SF_FORMAT_PCM_S8 : + case SF_FORMAT_PCM_U8 : + case SF_FORMAT_ULAW : + case SF_FORMAT_ALAW : + case SF_FORMAT_DPCM_8 : + psf->bytewidth = 1 ; + break ; + + case SF_FORMAT_PCM_16 : + case SF_FORMAT_DPCM_16 : + psf->bytewidth = 2 ; + break ; + + case SF_FORMAT_PCM_24 : + psf->bytewidth = 3 ; + break ; + + case SF_FORMAT_PCM_32 : + case SF_FORMAT_FLOAT : + psf->bytewidth = 4 ; + break ; + + case SF_FORMAT_DOUBLE : + psf->bytewidth = 8 ; + break ; + } ; + + /* Call the initialisation function for the relevant file type. */ + switch (psf->sf.format & SF_FORMAT_TYPEMASK) + { case SF_FORMAT_WAV : + case SF_FORMAT_WAVEX : + error = wav_open (psf) ; + break ; + + case SF_FORMAT_AIFF : + error = aiff_open (psf) ; + break ; + + case SF_FORMAT_AU : + error = au_open (psf) ; + break ; + + case SF_FORMAT_AU | SF_FORMAT_ULAW : + error = au_nh_open (psf) ; + break ; + + case SF_FORMAT_RAW : + error = raw_open (psf) ; + break ; + + case SF_FORMAT_W64 : + error = w64_open (psf) ; + break ; + + /* Lite remove start */ + case SF_FORMAT_PAF : + error = paf_open (psf) ; + break ; + + case SF_FORMAT_SVX : + error = svx_open (psf) ; + break ; + + case SF_FORMAT_NIST : + error = nist_open (psf) ; + break ; + + case SF_FORMAT_IRCAM : + error = ircam_open (psf) ; + break ; + + case SF_FORMAT_VOC : + error = voc_open (psf) ; + break ; + + case SF_FORMAT_SDS : + error = sds_open (psf) ; + break ; + + case SF_FORMAT_OGG : + error = ogg_open (psf) ; + break ; + + case SF_FORMAT_TXW : + error = txw_open (psf) ; + break ; + + case SF_FORMAT_WVE : + error = wve_open (psf) ; + break ; + + case SF_FORMAT_DWD : + error = dwd_open (psf) ; + break ; + + case SF_FORMAT_MAT4 : + error = mat4_open (psf) ; + break ; + + case SF_FORMAT_MAT5 : + error = mat5_open (psf) ; + break ; + + case SF_FORMAT_PVF : + error = pvf_open (psf) ; + break ; + + case SF_FORMAT_XI : + error = xi_open (psf) ; + break ; + + case SF_FORMAT_HTK : + error = htk_open (psf) ; + break ; + + case SF_FORMAT_SD2 : + error = sd2_open (psf) ; + break ; + + case SF_FORMAT_REX2 : + error = rx2_open (psf) ; + break ; + + case SF_FORMAT_AVR : + error = avr_open (psf) ; + break ; + + /* Lite remove end */ + + default : + error = SFE_UNKNOWN_FORMAT ; + } ; + + if (error) + return error ; + + /* For now, check whether embedding is supported. */ + format = psf->sf.format & SF_FORMAT_TYPEMASK ; + if (psf->fileoffset > 0 && + (format != SF_FORMAT_WAV) && (format != SF_FORMAT_WAVEX) && + (format != SF_FORMAT_AIFF) && (format != SF_FORMAT_AU) + ) + return SFE_NO_EMBED_SUPPORT ; + + if (psf->fileoffset > 0) + psf_log_printf (psf, "Embedded file length : %D\n", psf->filelength) ; + + if (mode == SFM_RDWR && sf_format_check (&(psf->sf)) == 0) + return SFE_BAD_RDWR_FORMAT ; + + if (validate_sfinfo (&(psf->sf)) == 0) + { psf_log_SF_INFO (psf) ; + save_header_info (psf) ; + return SFE_BAD_SF_INFO ; + } ; + + if (validate_psf (psf) == 0) + { save_header_info (psf) ; + return SFE_INTERNAL ; + } ; + + psf->read_current = 0 ; + psf->write_current = (psf->mode == SFM_RDWR) ? psf->sf.frames : 0 ; + + memcpy (sfinfo, &(psf->sf), sizeof (SF_INFO)) ; + + return 0 ; +} /* psf_open_file */ + +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: cd4f9e91-a8ec-4154-9bf6-fe4b8c69a615 +*/ diff --git a/Libraries/SndFile/Files/src/sndfile.h b/Libraries/SndFile/Files/src/sndfile.h new file mode 100644 index 000000000..273066a7c --- /dev/null +++ b/Libraries/SndFile/Files/src/sndfile.h @@ -0,0 +1,491 @@ +/* +** Copyright (C) 1999-2004 Erik de Castro Lopo +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU Lesser General Public License as published by +** the Free Software Foundation; either version 2.1 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU Lesser General Public License for more details. +** +** You should have received a copy of the GNU Lesser General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +/* +** sndfile.h -- system-wide definitions +** +** API documentation is in the doc/ directory of the source code tarball +** and at http://www.mega-nerd.com/libsndfile/api.html. +*/ + +#ifndef SNDFILE_H +#define SNDFILE_H + +/* This is the version 1.0.X header file. */ +#define SNDFILE_1 + +#include + +/* For the Metrowerks CodeWarrior Pro Compiler (mainly MacOS) */ + +#if (defined (__MWERKS__)) +#include +#else +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* The following file types can be read and written. +** A file type would consist of a major type (ie SF_FORMAT_WAV) bitwise +** ORed with a minor type (ie SF_FORMAT_PCM). SF_FORMAT_TYPEMASK and +** SF_FORMAT_SUBMASK can be used to separate the major and minor file +** types. +*/ + +enum +{ /* Major formats. */ + SF_FORMAT_WAV = 0x010000, /* Microsoft WAV format (little endian). */ + SF_FORMAT_AIFF = 0x020000, /* Apple/SGI AIFF format (big endian). */ + SF_FORMAT_AU = 0x030000, /* Sun/NeXT AU format (big endian). */ + SF_FORMAT_RAW = 0x040000, /* RAW PCM data. */ + SF_FORMAT_PAF = 0x050000, /* Ensoniq PARIS file format. */ + SF_FORMAT_SVX = 0x060000, /* Amiga IFF / SVX8 / SV16 format. */ + SF_FORMAT_NIST = 0x070000, /* Sphere NIST format. */ + SF_FORMAT_VOC = 0x080000, /* VOC files. */ + SF_FORMAT_IRCAM = 0x0A0000, /* Berkeley/IRCAM/CARL */ + SF_FORMAT_W64 = 0x0B0000, /* Sonic Foundry's 64 bit RIFF/WAV */ + SF_FORMAT_MAT4 = 0x0C0000, /* Matlab (tm) V4.2 / GNU Octave 2.0 */ + SF_FORMAT_MAT5 = 0x0D0000, /* Matlab (tm) V5.0 / GNU Octave 2.1 */ + SF_FORMAT_PVF = 0x0E0000, /* Portable Voice Format */ + SF_FORMAT_XI = 0x0F0000, /* Fasttracker 2 Extended Instrument */ + SF_FORMAT_HTK = 0x100000, /* HMM Tool Kit format */ + SF_FORMAT_SDS = 0x110000, /* Midi Sample Dump Standard */ + SF_FORMAT_AVR = 0x120000, /* Audio Visual Research */ + SF_FORMAT_WAVEX = 0x130000, /* MS WAVE with WAVEFORMATEX */ + SF_FORMAT_SD2 = 0x160000, /* Sound Designer 2 */ + + /* Subtypes from here on. */ + + SF_FORMAT_PCM_S8 = 0x0001, /* Signed 8 bit data */ + SF_FORMAT_PCM_16 = 0x0002, /* Signed 16 bit data */ + SF_FORMAT_PCM_24 = 0x0003, /* Signed 24 bit data */ + SF_FORMAT_PCM_32 = 0x0004, /* Signed 32 bit data */ + + SF_FORMAT_PCM_U8 = 0x0005, /* Unsigned 8 bit data (WAV and RAW only) */ + + SF_FORMAT_FLOAT = 0x0006, /* 32 bit float data */ + SF_FORMAT_DOUBLE = 0x0007, /* 64 bit float data */ + + SF_FORMAT_ULAW = 0x0010, /* U-Law encoded. */ + SF_FORMAT_ALAW = 0x0011, /* A-Law encoded. */ + SF_FORMAT_IMA_ADPCM = 0x0012, /* IMA ADPCM. */ + SF_FORMAT_MS_ADPCM = 0x0013, /* Microsoft ADPCM. */ + + SF_FORMAT_GSM610 = 0x0020, /* GSM 6.10 encoding. */ + SF_FORMAT_VOX_ADPCM = 0x0021, /* OKI / Dialogix ADPCM */ + + SF_FORMAT_G721_32 = 0x0030, /* 32kbs G721 ADPCM encoding. */ + SF_FORMAT_G723_24 = 0x0031, /* 24kbs G723 ADPCM encoding. */ + SF_FORMAT_G723_40 = 0x0032, /* 40kbs G723 ADPCM encoding. */ + + SF_FORMAT_DWVW_12 = 0x0040, /* 12 bit Delta Width Variable Word encoding. */ + SF_FORMAT_DWVW_16 = 0x0041, /* 16 bit Delta Width Variable Word encoding. */ + SF_FORMAT_DWVW_24 = 0x0042, /* 24 bit Delta Width Variable Word encoding. */ + SF_FORMAT_DWVW_N = 0x0043, /* N bit Delta Width Variable Word encoding. */ + + SF_FORMAT_DPCM_8 = 0x0050, /* 8 bit differential PCM (XI only) */ + SF_FORMAT_DPCM_16 = 0x0051, /* 16 bit differential PCM (XI only) */ + + + /* Endian-ness options. */ + + SF_ENDIAN_FILE = 0x00000000, /* Default file endian-ness. */ + SF_ENDIAN_LITTLE = 0x10000000, /* Force little endian-ness. */ + SF_ENDIAN_BIG = 0x20000000, /* Force big endian-ness. */ + SF_ENDIAN_CPU = 0x30000000, /* Force CPU endian-ness. */ + + SF_FORMAT_SUBMASK = 0x0000FFFF, + SF_FORMAT_TYPEMASK = 0x0FFF0000, + SF_FORMAT_ENDMASK = 0x30000000 +} ; + +/* +** The following are the valid command numbers for the sf_command() +** interface. The use of these commands is documented in the file +** command.html in the doc directory of the source code distribution. +*/ + +enum +{ SFC_GET_LIB_VERSION = 0x1000, + SFC_GET_LOG_INFO = 0x1001, + + SFC_GET_NORM_DOUBLE = 0x1010, + SFC_GET_NORM_FLOAT = 0x1011, + SFC_SET_NORM_DOUBLE = 0x1012, + SFC_SET_NORM_FLOAT = 0x1013, + SFC_SET_SCALE_FLOAT_INT_READ = 0x1014, + + SFC_GET_SIMPLE_FORMAT_COUNT = 0x1020, + SFC_GET_SIMPLE_FORMAT = 0x1021, + + SFC_GET_FORMAT_INFO = 0x1028, + + SFC_GET_FORMAT_MAJOR_COUNT = 0x1030, + SFC_GET_FORMAT_MAJOR = 0x1031, + SFC_GET_FORMAT_SUBTYPE_COUNT = 0x1032, + SFC_GET_FORMAT_SUBTYPE = 0x1033, + + SFC_CALC_SIGNAL_MAX = 0x1040, + SFC_CALC_NORM_SIGNAL_MAX = 0x1041, + SFC_CALC_MAX_ALL_CHANNELS = 0x1042, + SFC_CALC_NORM_MAX_ALL_CHANNELS = 0x1043, + + SFC_SET_ADD_PEAK_CHUNK = 0x1050, + + SFC_UPDATE_HEADER_NOW = 0x1060, + SFC_SET_UPDATE_HEADER_AUTO = 0x1061, + + SFC_FILE_TRUNCATE = 0x1080, + + SFC_SET_RAW_START_OFFSET = 0x1090, + + SFC_SET_DITHER_ON_WRITE = 0x10A0, + SFC_SET_DITHER_ON_READ = 0x10A1, + + SFC_GET_DITHER_INFO_COUNT = 0x10A2, + SFC_GET_DITHER_INFO = 0x10A3, + + SFC_GET_EMBED_FILE_INFO = 0x10B0, + + SFC_SET_CLIPPING = 0x10C0, + SFC_GET_CLIPPING = 0x10C1, + + SFC_GET_INSTRUMENT = 0x10D0, + SFC_SET_INSTRUMENT = 0x10D1, + + SFC_GET_LOOP_INFO = 0x10E0, + + /* Following commands for testing only. */ + SFC_TEST_IEEE_FLOAT_REPLACE = 0x6001, + + /* + ** SFC_SET_ADD_* values are deprecated and will disappear at some + ** time in the future. They are guaranteed to be here up to and + ** including version 1.0.8 to avoid breakage of existng software. + ** They currently do nothing and will continue to do nothing. + */ + SFC_SET_ADD_DITHER_ON_WRITE = 0x1070, + SFC_SET_ADD_DITHER_ON_READ = 0x1071 +} ; + + +/* +** String types that can be set and read from files. Not all file types +** support this and even the file types which support one, may not support +** all string types. +*/ + +enum +{ SF_STR_TITLE = 0x01, + SF_STR_COPYRIGHT = 0x02, + SF_STR_SOFTWARE = 0x03, + SF_STR_ARTIST = 0x04, + SF_STR_COMMENT = 0x05, + SF_STR_DATE = 0x06 +} ; + +/* +** Use the following as the start and end index when doing metadata +** transcoding. +*/ + +#define SF_STR_FIRST SF_STR_TITLE +#define SF_STR_LAST SF_STR_DATE + +enum +{ /* True and false */ + SF_FALSE = 0, + SF_TRUE = 1, + + /* Modes for opening files. */ + SFM_READ = 0x10, + SFM_WRITE = 0x20, + SFM_RDWR = 0x30 +} ; + +/* Public error values. These are guaranteed to remain unchanged for the duration +** of the library major version number. +** There are also a large number of private error numbers which are internal to +** the library which can change at any time. +*/ + +enum +{ SF_ERR_NO_ERROR = 0, + SF_ERR_UNRECOGNISED_FORMAT = 1, + SF_ERR_SYSTEM = 2 +} ; + +/* A SNDFILE* pointer can be passed around much like stdio.h's FILE* pointer. */ + +typedef struct SNDFILE_tag SNDFILE ; + +/* The following typedef is system specific and is defined when libsndfile is. +** compiled. sf_count_t can be one of loff_t (Linux), off_t (*BSD), +** off64_t (Solaris), __int64_t (Win32) etc. +*/ + +typedef off_t sf_count_t ; + +#define SF_COUNT_MAX 0x7FFFFFFFFFFFFFFFLL + +/* A pointer to a SF_INFO structure is passed to sf_open_read () and filled in. +** On write, the SF_INFO structure is filled in by the user and passed into +** sf_open_write (). +*/ + +struct SF_INFO +{ sf_count_t frames ; /* Used to be called samples. Changed to avoid confusion. */ + int samplerate ; + int channels ; + int format ; + int sections ; + int seekable ; +} ; + +typedef struct SF_INFO SF_INFO ; + +/* The SF_FORMAT_INFO struct is used to retrieve information about the sound +** file formats libsndfile supports using the sf_command () interface. +** +** Using this interface will allow applications to support new file formats +** and encoding types when libsndfile is upgraded, without requiring +** re-compilation of the application. +** +** Please consult the libsndfile documentation (particularly the information +** on the sf_command () interface) for examples of its use. +*/ + +typedef struct +{ int format ; + const char *name ; + const char *extension ; +} SF_FORMAT_INFO ; + +/* +** Enums and typedefs for adding dither on read and write. +** See the html documentation for sf_command(), SFC_SET_DITHER_ON_WRITE +** and SFC_SET_DITHER_ON_READ. +*/ + +enum +{ SFD_DEFAULT_LEVEL = 0, + SFD_CUSTOM_LEVEL = 0x40000000, + + SFD_NO_DITHER = 500, + SFD_WHITE = 501, + SFD_TRIANGULAR_PDF = 502 +} ; + +typedef struct +{ int type ; + double level ; + const char *name ; +} SF_DITHER_INFO ; + +/* Struct used to retrieve information about a file embedded within a +** larger file. See SFC_GET_EMBED_FILE_INFO. +*/ + +typedef struct +{ sf_count_t offset ; + sf_count_t length ; +} SF_EMBED_FILE_INFO ; + +/* Struct used to retrieve music sample information from a file. +*/ + +typedef struct +{ int basenote ; + int gain ; + int sustain_mode ; + int sustain_start, sustain_end ; + int release_mode ; + int release_start, reslease_end ; +} SF_INSTRUMENT ; + +/* sustain_mode and release_mode will be one of the following. */ + +enum +{ SF_LOOP_NONE = 800, + SF_LOOP_FORWARD, + SF_LOOP_BACKWARD +} ; + +/* Struct used to retrieve loop information from a file.*/ +typedef struct +{ + short time_sig_num ; /* any positive integer >0 */ + short time_sig_den ; /* any positive power of 2 >0 */ + int loop_mode ; /* see SF_LOOP enum */ + + int num_beats ; /* this is NOT the amount of quarter notes !!!*/ + /* a full bar of 4/4 is 4 beats */ + /* a full bar of 7/8 is 7 beats */ + + float bpm ; /* suggestion, as it can be calculated using other fields:*/ + /* file's lenght, file's sampleRate and our time_sig_den*/ + /* -> bpms are always the amount of _quarter notes_ per minute */ + + int root_key ; /* MIDI note, or -1 for None */ + int future [6] ; +} SF_LOOP_INFO ; + +/* Open the specified file for read, write or both. On error, this will +** return a NULL pointer. To find the error number, pass a NULL SNDFILE +** to sf_perror () or sf_error_str (). +** All calls to sf_open() should be matched with a call to sf_close(). +*/ + +SNDFILE* sf_open (const char *path, int mode, SF_INFO *sfinfo) ; + +/* Use the existing file descriptor to create a SNDFILE object. If close_desc +** is TRUE, the file descriptor will be closed when sf_close() is called. If +** it is FALSE, the descritor will not be closed. +** When passed a descriptor like this, the library will assume that the start +** of file header is at the current file offset. This allows sound files within +** larger container files to be read and/or written. +** On error, this will return a NULL pointer. To find the error number, pass a +** NULL SNDFILE to sf_perror () or sf_error_str (). +** All calls to sf_open_fd() should be matched with a call to sf_close(). + +*/ + +SNDFILE* sf_open_fd (int fd, int mode, SF_INFO *sfinfo, int close_desc) ; + +/* sf_error () returns a error number which can be translated to a text +** string using sf_error_number(). +*/ + +int sf_error (SNDFILE *sndfile) ; + +/* sf_strerror () returns to the caller a pointer to the current error message for +** the given SNDFILE. +*/ + +const char* sf_strerror (SNDFILE *sndfile) ; + +/* sf_error_number () allows the retrieval of the error string for each internal +** error number. +** +*/ + +const char* sf_error_number (int errnum) ; + +/* The following three error functions are deprecated but they will remain in the +** library for the forseeable future. The function sf_strerror() should be used +** in their place. +*/ + +int sf_perror (SNDFILE *sndfile) ; +int sf_error_str (SNDFILE *sndfile, char* str, size_t len) ; + + +/* Return TRUE if fields of the SF_INFO struct are a valid combination of values. */ + +int sf_command (SNDFILE *sndfile, int command, void *data, int datasize) ; + +/* Return TRUE if fields of the SF_INFO struct are a valid combination of values. */ + +int sf_format_check (const SF_INFO *info) ; + +/* Seek within the waveform data chunk of the SNDFILE. sf_seek () uses +** the same values for whence (SEEK_SET, SEEK_CUR and SEEK_END) as +** stdio.h function fseek (). +** An offset of zero with whence set to SEEK_SET will position the +** read / write pointer to the first data sample. +** On success sf_seek returns the current position in (multi-channel) +** samples from the start of the file. +** Please see the libsndfile documentation for moving the read pointer +** separately from the write pointer on files open in mode SFM_RDWR. +** On error all of these functions return -1. +*/ + +sf_count_t sf_seek (SNDFILE *sndfile, sf_count_t frames, int whence) ; + +/* Functions for retrieving and setting string data within sound files. +** Not all file types support this features; AIFF and WAV do. For both +** functions, the str_type parameter must be one of the SF_STR_* values +** defined above. +** On error, sf_set_string() returns non-zero while sf_get_string() +** returns NULL. +*/ + +int sf_set_string (SNDFILE *sndfile, int str_type, const char* str) ; + +const char* sf_get_string (SNDFILE *sndfile, int str_type) ; + +/* Functions for reading/writing the waveform data of a sound file. +*/ + +sf_count_t sf_read_raw (SNDFILE *sndfile, void *ptr, sf_count_t bytes) ; +sf_count_t sf_write_raw (SNDFILE *sndfile, void *ptr, sf_count_t bytes) ; + +/* Functions for reading and writing the data chunk in terms of frames. +** The number of items actually read/written = frames * number of channels. +** sf_xxxx_raw read/writes the raw data bytes from/to the file +** sf_xxxx_short passes data in the native short format +** sf_xxxx_int passes data in the native int format +** sf_xxxx_float passes data in the native float format +** sf_xxxx_double passes data in the native double format +** All of these read/write function return number of frames read/written. +*/ + +sf_count_t sf_readf_short (SNDFILE *sndfile, short *ptr, sf_count_t frames) ; +sf_count_t sf_writef_short (SNDFILE *sndfile, short *ptr, sf_count_t frames) ; + +sf_count_t sf_readf_int (SNDFILE *sndfile, int *ptr, sf_count_t frames) ; +sf_count_t sf_writef_int (SNDFILE *sndfile, int *ptr, sf_count_t frames) ; + +sf_count_t sf_readf_float (SNDFILE *sndfile, float *ptr, sf_count_t frames) ; +sf_count_t sf_writef_float (SNDFILE *sndfile, float *ptr, sf_count_t frames) ; + +sf_count_t sf_readf_double (SNDFILE *sndfile, double *ptr, sf_count_t frames) ; +sf_count_t sf_writef_double (SNDFILE *sndfile, double *ptr, sf_count_t frames) ; + +/* Functions for reading and writing the data chunk in terms of items. +** Otherwise similar to above. +** All of these read/write function return number of items read/written. +*/ + +sf_count_t sf_read_short (SNDFILE *sndfile, short *ptr, sf_count_t items) ; +sf_count_t sf_write_short (SNDFILE *sndfile, short *ptr, sf_count_t items) ; + +sf_count_t sf_read_int (SNDFILE *sndfile, int *ptr, sf_count_t items) ; +sf_count_t sf_write_int (SNDFILE *sndfile, int *ptr, sf_count_t items) ; + +sf_count_t sf_read_float (SNDFILE *sndfile, float *ptr, sf_count_t items) ; +sf_count_t sf_write_float (SNDFILE *sndfile, float *ptr, sf_count_t items) ; + +sf_count_t sf_read_double (SNDFILE *sndfile, double *ptr, sf_count_t items) ; +sf_count_t sf_write_double (SNDFILE *sndfile, double *ptr, sf_count_t items) ; + +/* Close the SNDFILE and clean up all memory allocations associated with this +** file. +** Returns 0 on success, or an error number. +*/ + +int sf_close (SNDFILE *sndfile) ; + +#ifdef __cplusplus +} /* extern "C" */ +#endif /* __cplusplus */ + +#endif /* SNDFILE_H */ diff --git a/Libraries/SndFile/Files/src/strings.c b/Libraries/SndFile/Files/src/strings.c new file mode 100644 index 000000000..2400a8954 --- /dev/null +++ b/Libraries/SndFile/Files/src/strings.c @@ -0,0 +1,203 @@ +/* +** Copyright (C) 2001-2004 Erik de Castro Lopo +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU Lesser General Public License as published by +** the Free Software Foundation; either version 2.1 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU Lesser General Public License for more details. +** +** You should have received a copy of the GNU Lesser General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include +#include +#include + +#include "sndfile.h" +#include "config.h" +#include "common.h" + +#define STRINGS_DEBUG 0 +#if STRINGS_DEBUG +static void hexdump (void *data, int len) ; +#endif + +int +psf_store_string (SF_PRIVATE *psf, int str_type, const char *str) +{ static char lsf_name [] = PACKAGE "-" VERSION ; + static char bracket_name [] = " (" PACKAGE "-" VERSION ")" ; + int k, str_len, len_remaining, str_flags ; + + if (str == NULL) + return SFE_STR_BAD_STRING ; + + str_len = strlen (str) ; + + /* A few extra checks for write mode. */ + if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR) + { if ((psf->str_flags & SF_STR_ALLOW_START) == 0) + return SFE_STR_NO_SUPPORT ; + if ((psf->str_flags & SF_STR_ALLOW_END) == 0) + return SFE_STR_NO_SUPPORT ; + /* Only allow zero length strings for software. */ + if (str_type != SF_STR_SOFTWARE && str_len == 0) + return SFE_STR_BAD_STRING ; + } ; + + /* Determine flags */ + str_flags = SF_STR_LOCATE_START ; + if (psf->have_written) + { if ((psf->str_flags & SF_STR_ALLOW_END) == 0) + return SFE_STR_NO_ADD_END ; + str_flags = SF_STR_LOCATE_END ; + } ; + + /* Find next free slot in table. */ + for (k = 0 ; k < SF_MAX_STRINGS ; k++) + if (psf->strings [k].type == 0) + break ; + + /* More sanity checking. */ + if (k >= SF_MAX_STRINGS) + return SFE_STR_MAX_COUNT ; + + if (k == 0 && psf->str_end != NULL) + { psf_log_printf (psf, "SFE_STR_WEIRD : k == 0 && psf->str_end != NULL\n") ; + return SFE_STR_WEIRD ; + } ; + + if (k != 0 && psf->str_end == NULL) + { psf_log_printf (psf, "SFE_STR_WEIRD : k != 0 && psf->str_end == NULL\n") ; + return SFE_STR_WEIRD ; + } ; + + /* Special case for the first string. */ + if (k == 0) + psf->str_end = psf->str_storage ; + + +#if STRINGS_DEBUG + psf_log_printf (psf, "str_storage : %X\n", (int) psf->str_storage) ; + psf_log_printf (psf, "str_end : %X\n", (int) psf->str_end) ; + psf_log_printf (psf, "sizeof (storage) : %d\n", SIGNED_SIZEOF (psf->str_storage)) ; +#endif + + len_remaining = SIGNED_SIZEOF (psf->str_storage) - (psf->str_end - psf->str_storage) ; + + if (len_remaining < str_len + 2) + return SFE_STR_MAX_DATA ; + + switch (str_type) + { case SF_STR_SOFTWARE : + /* In write mode, want to append libsndfile-version to string. */ + if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR) + { psf->strings [k].type = str_type ; + psf->strings [k].str = psf->str_end ; + psf->strings [k].flags = str_flags ; + + memcpy (psf->str_end, str, str_len + 1) ; + psf->str_end += str_len ; + + /* + ** If the supplied string does not already contain a + ** libsndfile-X.Y.Z component, then add it. + */ + if (strstr (str, PACKAGE) == NULL && len_remaining > (int) (strlen (bracket_name) + str_len + 2)) + { if (strlen (str) == 0) + strncat (psf->str_end, lsf_name, len_remaining) ; + else + strncat (psf->str_end, bracket_name, len_remaining) ; + psf->str_end += strlen (psf->str_end) ; + } ; + + /* Plus one to catch string terminator. */ + psf->str_end += 1 ; + break ; + } ; + + /* Fall though if not write mode. */ + + case SF_STR_TITLE : + case SF_STR_COPYRIGHT : + case SF_STR_ARTIST : + case SF_STR_COMMENT : + case SF_STR_DATE : + psf->strings [k].type = str_type ; + psf->strings [k].str = psf->str_end ; + psf->strings [k].flags = str_flags ; + + /* Plus one to catch string terminator. */ + memcpy (psf->str_end, str, str_len + 1) ; + psf->str_end += str_len + 1 ; + break ; + + default : + return SFE_STR_BAD_TYPE ; + } ; + + psf->str_flags |= (psf->have_written) ? SF_STR_LOCATE_END : SF_STR_LOCATE_START ; + +#if STRINGS_DEBUG + hexdump (psf->str_storage, 300) ; +#endif + + return 0 ; +} /* psf_store_string */ + +int +psf_set_string (SF_PRIVATE *psf, int str_type, const char *str) +{ if (psf->mode == SFM_READ) + return SFE_STR_NOT_WRITE ; + + return psf_store_string (psf, str_type, str) ; +} /* psf_set_string */ + +const char* +psf_get_string (SF_PRIVATE *psf, int str_type) +{ int k ; + + for (k = 0 ; k < SF_MAX_STRINGS ; k++) + if (str_type == psf->strings [k].type) + return psf->strings [k].str ; + + return NULL ; +} /* psf_get_string */ + +#if STRINGS_DEBUG + +#include +static void +hexdump (void *data, int len) +{ unsigned char *ptr ; + int k ; + + ptr = data ; + + puts ("---------------------------------------------------------") ; + while (len >= 16) + { for (k = 0 ; k < 16 ; k++) + printf ("%02X ", ptr [k] & 0xFF) ; + printf (" ") ; + for (k = 0 ; k < 16 ; k++) + printf ("%c", isprint (ptr [k]) ? ptr [k] : '.') ; + puts ("") ; + ptr += 16 ; + len -= 16 ; + } ; +} /* hexdump */ + +#endif +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: 04393aa1-9389-46fe-baf2-58a7bd544fd6 +*/ diff --git a/Libraries/SndFile/Files/src/svx.c b/Libraries/SndFile/Files/src/svx.c new file mode 100644 index 000000000..4063fd31e --- /dev/null +++ b/Libraries/SndFile/Files/src/svx.c @@ -0,0 +1,410 @@ +/* +** Copyright (C) 1999-2004 Erik de Castro Lopo +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU Lesser General Public License as published by +** the Free Software Foundation; either version 2.1 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU Lesser General Public License for more details. +** +** You should have received a copy of the GNU Lesser General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include "config.h" + +#include +#include +#include +#include + +#include "sndfile.h" +#include "sfendian.h" +#include "common.h" + + +/*------------------------------------------------------------------------------ + * Macros to handle big/little endian issues. +*/ + +#define FORM_MARKER (MAKE_MARKER ('F', 'O', 'R', 'M')) +#define SVX8_MARKER (MAKE_MARKER ('8', 'S', 'V', 'X')) +#define SV16_MARKER (MAKE_MARKER ('1', '6', 'S', 'V')) +#define VHDR_MARKER (MAKE_MARKER ('V', 'H', 'D', 'R')) +#define BODY_MARKER (MAKE_MARKER ('B', 'O', 'D', 'Y')) + +#define ATAK_MARKER (MAKE_MARKER ('A', 'T', 'A', 'K')) +#define RLSE_MARKER (MAKE_MARKER ('R', 'L', 'S', 'E')) + +#define c_MARKER (MAKE_MARKER ('(', 'c', ')', ' ')) +#define NAME_MARKER (MAKE_MARKER ('N', 'A', 'M', 'E')) +#define AUTH_MARKER (MAKE_MARKER ('A', 'U', 'T', 'H')) +#define ANNO_MARKER (MAKE_MARKER ('A', 'N', 'N', 'O')) +#define CHAN_MARKER (MAKE_MARKER ('C', 'H', 'A', 'N')) + +/*------------------------------------------------------------------------------ + * Typedefs for file chunks. +*/ + +typedef struct +{ unsigned int oneShotHiSamples, repeatHiSamples, samplesPerHiCycle ; + unsigned short samplesPerSec ; + unsigned char octave, compression ; + unsigned int volume ; +} VHDR_CHUNK ; + +enum { + HAVE_FORM = 0x01, + + HAVE_SVX = 0x02, + HAVE_VHDR = 0x04, + HAVE_BODY = 0x08 +} ; + +/*------------------------------------------------------------------------------ + * Private static functions. +*/ + +static int svx_close (SF_PRIVATE *psf) ; +static int svx_write_header (SF_PRIVATE *psf, int calc_length) ; +static int svx_read_header (SF_PRIVATE *psf) ; + +/*------------------------------------------------------------------------------ +** Public function. +*/ + +int +svx_open (SF_PRIVATE *psf) +{ int error, subformat ; + + if (psf->mode == SFM_READ || (psf->mode == SFM_RDWR && psf->filelength > 0)) + { if ((error = svx_read_header (psf))) + return error ; + + psf->endian = SF_ENDIAN_BIG ; /* All SVX files are big endian. */ + + psf->blockwidth = psf->sf.channels * psf->bytewidth ; + if (psf->blockwidth) + psf->sf.frames = psf->datalength / psf->blockwidth ; + + psf_fseek (psf, psf->dataoffset, SEEK_SET) ; + } ; + + subformat = psf->sf.format & SF_FORMAT_SUBMASK ; + + if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR) + { if (psf->is_pipe) + return SFE_NO_PIPE_WRITE ; + + if ((psf->sf.format & SF_FORMAT_TYPEMASK) != SF_FORMAT_SVX) + return SFE_BAD_OPEN_FORMAT ; + + psf->endian = psf->sf.format & SF_FORMAT_ENDMASK ; + + if (psf->endian == SF_ENDIAN_LITTLE || (CPU_IS_LITTLE_ENDIAN && psf->endian == SF_ENDIAN_CPU)) + return SFE_BAD_ENDIAN ; + + psf->endian = SF_ENDIAN_BIG ; /* All SVX files are big endian. */ + + error = svx_write_header (psf, SF_FALSE) ; + if (error) + return error ; + + psf->write_header = svx_write_header ; + } ; + + psf->close = svx_close ; + + if ((error = pcm_init (psf))) + return error ; + + return 0 ; +} /* svx_open */ + +/*------------------------------------------------------------------------------ +*/ + +static int +svx_read_header (SF_PRIVATE *psf) +{ VHDR_CHUNK vhdr ; + unsigned int FORMsize, vhdrsize, dword, marker ; + int filetype = 0, parsestage = 0, done = 0 ; + int bytecount = 0, channels ; + + psf_binheader_readf (psf, "p", 0) ; + + /* Set default number of channels. */ + psf->sf.channels = 1 ; + + psf->sf.format = SF_FORMAT_SVX ; + + while (! done) + { psf_binheader_readf (psf, "m", &marker) ; + switch (marker) + { case FORM_MARKER : + if (parsestage) + return SFE_SVX_NO_FORM ; + + psf_binheader_readf (psf, "E4", &FORMsize) ; + + if (FORMsize != psf->filelength - 2 * sizeof (dword)) + { dword = psf->filelength - 2 * sizeof (dword) ; + psf_log_printf (psf, "FORM : %d (should be %d)\n", FORMsize, dword) ; + FORMsize = dword ; + } + else + psf_log_printf (psf, "FORM : %d\n", FORMsize) ; + parsestage |= HAVE_FORM ; + break ; + + case SVX8_MARKER : + case SV16_MARKER : + if (! (parsestage & HAVE_FORM)) + return SFE_SVX_NO_FORM ; + filetype = marker ; + psf_log_printf (psf, " %M\n", marker) ; + parsestage |= HAVE_SVX ; + break ; + + case VHDR_MARKER : + if (! (parsestage & (HAVE_FORM | HAVE_SVX))) + return SFE_SVX_NO_FORM ; + + psf_binheader_readf (psf, "E4", &vhdrsize) ; + + psf_log_printf (psf, " VHDR : %d\n", vhdrsize) ; + + psf_binheader_readf (psf, "E4442114", &(vhdr.oneShotHiSamples), &(vhdr.repeatHiSamples), + &(vhdr.samplesPerHiCycle), &(vhdr.samplesPerSec), &(vhdr.octave), &(vhdr.compression), + &(vhdr.volume)) ; + + psf_log_printf (psf, " OneShotHiSamples : %d\n", vhdr.oneShotHiSamples) ; + psf_log_printf (psf, " RepeatHiSamples : %d\n", vhdr.repeatHiSamples) ; + psf_log_printf (psf, " samplesPerHiCycle : %d\n", vhdr.samplesPerHiCycle) ; + psf_log_printf (psf, " Sample Rate : %d\n", vhdr.samplesPerSec) ; + psf_log_printf (psf, " Octave : %d\n", vhdr.octave) ; + + psf_log_printf (psf, " Compression : %d => ", vhdr.compression) ; + + switch (vhdr.compression) + { case 0 : psf_log_printf (psf, "None.\n") ; + break ; + case 1 : psf_log_printf (psf, "Fibonacci delta\n") ; + break ; + case 2 : psf_log_printf (psf, "Exponential delta\n") ; + break ; + } ; + + psf_log_printf (psf, " Volume : %d\n", vhdr.volume) ; + + psf->sf.samplerate = vhdr.samplesPerSec ; + + if (filetype == SVX8_MARKER) + { psf->sf.format |= SF_FORMAT_PCM_S8 ; + psf->bytewidth = 1 ; + } + else if (filetype == SV16_MARKER) + { psf->sf.format |= SF_FORMAT_PCM_16 ; + psf->bytewidth = 2 ; + } ; + + parsestage |= HAVE_VHDR ; + break ; + + case BODY_MARKER : + if (! (parsestage & HAVE_VHDR)) + return SFE_SVX_NO_BODY ; + + psf_binheader_readf (psf, "E4", &dword) ; + psf->datalength = dword ; + + psf->dataoffset = psf_ftell (psf) ; + + if (psf->datalength > psf->filelength - psf->dataoffset) + { psf_log_printf (psf, " BODY : %D (should be %D)\n", psf->datalength, psf->filelength - psf->dataoffset) ; + psf->datalength = psf->filelength - psf->dataoffset ; + } + else + psf_log_printf (psf, " BODY : %D\n", psf->datalength) ; + + parsestage |= HAVE_BODY ; + + if (! psf->sf.seekable) + break ; + + psf_fseek (psf, psf->datalength, SEEK_CUR) ; + break ; + + case NAME_MARKER : + if (! (parsestage & HAVE_SVX)) + return SFE_SVX_NO_FORM ; + + psf_binheader_readf (psf, "E4", &dword) ; + + psf_log_printf (psf, " %M : %d\n", marker, dword) ; + + if (strlen (psf->filename) != dword) + { if (dword > sizeof (psf->filename) - 1) + return SFE_SVX_BAD_NAME_LENGTH ; + + psf_binheader_readf (psf, "b", psf->filename, dword) ; + psf->filename [dword] = 0 ; + } + else + psf_binheader_readf (psf, "j", dword) ; + break ; + + case ANNO_MARKER : + if (! (parsestage & HAVE_SVX)) + return SFE_SVX_NO_FORM ; + + psf_binheader_readf (psf, "E4", &dword) ; + + psf_log_printf (psf, " %M : %d\n", marker, dword) ; + + psf_binheader_readf (psf, "j", dword) ; + break ; + + case CHAN_MARKER : + if (! (parsestage & HAVE_SVX)) + return SFE_SVX_NO_FORM ; + + psf_binheader_readf (psf, "E4", &dword) ; + + psf_log_printf (psf, " %M : %d\n", marker, dword) ; + + bytecount += psf_binheader_readf (psf, "E4", &channels) ; + + psf_log_printf (psf, " Channels : %d => %d\n", channels) ; + + psf_binheader_readf (psf, "j", dword - bytecount) ; + break ; + + + case AUTH_MARKER : + case c_MARKER : + if (! (parsestage & HAVE_SVX)) + return SFE_SVX_NO_FORM ; + + psf_binheader_readf (psf, "E4", &dword) ; + + psf_log_printf (psf, " %M : %d\n", marker, dword) ; + + psf_binheader_readf (psf, "j", dword) ; + break ; + + default : + if (isprint ((marker >> 24) & 0xFF) && isprint ((marker >> 16) & 0xFF) + && isprint ((marker >> 8) & 0xFF) && isprint (marker & 0xFF)) + { psf_binheader_readf (psf, "E4", &dword) ; + + psf_log_printf (psf, "%M : %d (unknown marker)\n", marker, dword) ; + + psf_binheader_readf (psf, "j", dword) ; + break ; + } ; + if ((dword = psf_ftell (psf)) & 0x03) + { psf_log_printf (psf, " Unknown chunk marker at position %d. Resynching.\n", dword - 4) ; + + psf_binheader_readf (psf, "j", -3) ; + break ; + } ; + psf_log_printf (psf, "*** Unknown chunk marker : %X. Exiting parser.\n", marker) ; + done = 1 ; + } ; /* switch (marker) */ + + if (! psf->sf.seekable && (parsestage & HAVE_BODY)) + break ; + + if (psf_ftell (psf) >= psf->filelength - SIGNED_SIZEOF (dword)) + break ; + } ; /* while (1) */ + + if (vhdr.compression) + return SFE_SVX_BAD_COMP ; + + if (psf->dataoffset <= 0) + return SFE_SVX_NO_DATA ; + + return 0 ; +} /* svx_read_header */ + +static int +svx_close (SF_PRIVATE *psf) +{ + if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR) + svx_write_header (psf, SF_TRUE) ; + + return 0 ; +} /* svx_close */ + +static int +svx_write_header (SF_PRIVATE *psf, int calc_length) +{ static char annotation [] = "libsndfile by Erik de Castro Lopo\0\0\0" ; + sf_count_t current ; + + current = psf_ftell (psf) ; + + if (calc_length) + { psf->filelength = psf_get_filelen (psf) ; + + psf->datalength = psf->filelength - psf->dataoffset ; + + if (psf->dataend) + psf->datalength -= psf->filelength - psf->dataend ; + + psf->sf.frames = psf->datalength / (psf->bytewidth * psf->sf.channels) ; + } ; + + psf->header [0] = 0 ; + psf->headindex = 0 ; + psf_fseek (psf, 0, SEEK_SET) ; + + /* FORM marker and FORM size. */ + psf_binheader_writef (psf, "Etm8", FORM_MARKER, (psf->filelength < 8) ? + psf->filelength * 0 : psf->filelength - 8) ; + + psf_binheader_writef (psf, "m", (psf->bytewidth == 1) ? SVX8_MARKER : SV16_MARKER) ; + + /* VHDR chunk. */ + psf_binheader_writef (psf, "Em4", VHDR_MARKER, sizeof (VHDR_CHUNK)) ; + /* VHDR : oneShotHiSamples, repeatHiSamples, samplesPerHiCycle */ + psf_binheader_writef (psf, "E444", psf->sf.frames, 0, 0) ; + /* VHDR : samplesPerSec, octave, compression */ + psf_binheader_writef (psf, "E211", psf->sf.samplerate, 1, 0) ; + /* VHDR : volume */ + psf_binheader_writef (psf, "E4", (psf->bytewidth == 1) ? 0xFF : 0xFFFF) ; + + /* Filename and annotation strings. */ + psf_binheader_writef (psf, "Emsms", NAME_MARKER, psf->filename, ANNO_MARKER, annotation) ; + + /* BODY marker and size. */ + psf_binheader_writef (psf, "Etm8", BODY_MARKER, (psf->datalength < 0) ? + psf->datalength * 0 : psf->datalength) ; + + psf_fwrite (psf->header, psf->headindex, 1, psf) ; + + if (psf->error) + return psf->error ; + + psf->dataoffset = psf->headindex ; + + if (current > 0) + psf_fseek (psf, current, SEEK_SET) ; + + return psf->error ; +} /* svx_write_header */ + + +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: a80ab6fb-7d75-4d32-a6b0-0061a3f05d95 +*/ diff --git a/Libraries/SndFile/Files/src/test_endswap.c b/Libraries/SndFile/Files/src/test_endswap.c new file mode 100644 index 000000000..c7d918fe4 --- /dev/null +++ b/Libraries/SndFile/Files/src/test_endswap.c @@ -0,0 +1,233 @@ +/* +** Copyright (C) 2002-2004 Erik de Castro Lopo +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU Lesser General Public License as published by +** the Free Software Foundation; either version 2.1 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU Lesser General Public License for more details. +** +** You should have received a copy of the GNU Lesser General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include "config.h" + +#include +#include + +#ifdef HAVE_UNISTD_H +#include +#endif + +#include +#include + +#include "common.h" +#include "sfendian.h" + +static void test_endswap_short (void) ; +static void test_endswap_int (void) ; +static void test_endswap_int64_t (void) ; + + +int +main (void) +{ + test_endswap_short () ; + test_endswap_int () ; + test_endswap_int64_t () ; + + return 0 ; +} /* main */ + +/*============================================================================== +** Actual test functions. +*/ + +static void +dump_short_array (const char * name, short * data, int datalen) +{ int k ; + + printf ("%-6s : ", name) ; + for (k = 0 ; k < datalen ; k++) + printf ("0x%04x ", data [k]) ; + putchar ('\n') ; +} /* dump_short_array */ + +static void +test_endswap_short (void) +{ short orig [4], first [4], second [4] ; + int k ; + + printf (" %-24s : ", "test_endswap_short") ; + fflush (stdout) ; + + for (k = 0 ; k < ARRAY_LEN (orig) ; k++) + orig [k] = 0x3210 + k ; + + endswap_short_copy (first, orig, ARRAY_LEN (first)) ; + endswap_short_copy (second, first, ARRAY_LEN (second)) ; + + if (memcmp (orig, first, sizeof (orig)) == 0) + { printf ("\n\nLine %d : test 1 : these two array should not be the same:\n\n", __LINE__) ; + dump_short_array ("orig", orig, ARRAY_LEN (orig)); + dump_short_array ("first", first, ARRAY_LEN (first)); + exit (1) ; + } ; + + if (memcmp (orig, second, sizeof (orig)) != 0) + { printf ("\n\nLine %d : test 2 : these two array should be the same:\n\n", __LINE__) ; + dump_short_array ("orig", orig, ARRAY_LEN (orig)); + dump_short_array ("second", second, ARRAY_LEN (second)); + exit (1) ; + } ; + + endswap_short_array (first, ARRAY_LEN (first)) ; + + if (memcmp (orig, first, sizeof (orig)) != 0) + { printf ("\n\nLine %d : test 3 : these two array should be the same:\n\n", __LINE__) ; + dump_short_array ("orig", orig, ARRAY_LEN (orig)); + dump_short_array ("first", first, ARRAY_LEN (first)); + exit (1) ; + } ; + + endswap_short_copy (first, orig, ARRAY_LEN (first)) ; + endswap_short_copy (first, first, ARRAY_LEN (first)) ; + + if (memcmp (orig, first, sizeof (orig)) != 0) + { printf ("\n\nLine %d : test 4 : these two array should be the same:\n\n", __LINE__) ; + dump_short_array ("orig", orig, ARRAY_LEN (orig)); + dump_short_array ("first", first, ARRAY_LEN (first)); + exit (1) ; + } ; + + puts ("ok") ; +} /* test_endswap_short */ +static void +dump_int_array (const char * name, int * data, int datalen) +{ int k ; + + printf ("%-6s : ", name) ; + for (k = 0 ; k < datalen ; k++) + printf ("0x%08x ", data [k]) ; + putchar ('\n') ; +} /* dump_int_array */ + +static void +test_endswap_int (void) +{ int orig [4], first [4], second [4] ; + int k ; + + printf (" %-24s : ", "test_endswap_int") ; + fflush (stdout) ; + + for (k = 0 ; k < ARRAY_LEN (orig) ; k++) + orig [k] = 0x76543210 + k ; + + endswap_int_copy (first, orig, ARRAY_LEN (first)) ; + endswap_int_copy (second, first, ARRAY_LEN (second)) ; + + if (memcmp (orig, first, sizeof (orig)) == 0) + { printf ("\n\nLine %d : test 1 : these two array should not be the same:\n\n", __LINE__) ; + dump_int_array ("orig", orig, ARRAY_LEN (orig)); + dump_int_array ("first", first, ARRAY_LEN (first)); + exit (1) ; + } ; + + if (memcmp (orig, second, sizeof (orig)) != 0) + { printf ("\n\nLine %d : test 2 : these two array should be the same:\n\n", __LINE__) ; + dump_int_array ("orig", orig, ARRAY_LEN (orig)); + dump_int_array ("second", second, ARRAY_LEN (second)); + exit (1) ; + } ; + + endswap_int_array (first, ARRAY_LEN (first)) ; + + if (memcmp (orig, first, sizeof (orig)) != 0) + { printf ("\n\nLine %d : test 3 : these two array should be the same:\n\n", __LINE__) ; + dump_int_array ("orig", orig, ARRAY_LEN (orig)); + dump_int_array ("first", first, ARRAY_LEN (first)); + exit (1) ; + } ; + + endswap_int_copy (first, orig, ARRAY_LEN (first)) ; + endswap_int_copy (first, first, ARRAY_LEN (first)) ; + + if (memcmp (orig, first, sizeof (orig)) != 0) + { printf ("\n\nLine %d : test 4 : these two array should be the same:\n\n", __LINE__) ; + dump_int_array ("orig", orig, ARRAY_LEN (orig)); + dump_int_array ("first", first, ARRAY_LEN (first)); + exit (1) ; + } ; + + puts ("ok") ; +} /* test_endswap_int */ +static void +dump_int64_t_array (const char * name, int64_t * data, int datalen) +{ int k ; + + printf ("%-6s : ", name) ; + for (k = 0 ; k < datalen ; k++) + printf ("0x%016llx ", data [k]) ; + putchar ('\n') ; +} /* dump_int64_t_array */ + +static void +test_endswap_int64_t (void) +{ int64_t orig [4], first [4], second [4] ; + int k ; + + printf (" %-24s : ", "test_endswap_int64_t") ; + fflush (stdout) ; + + for (k = 0 ; k < ARRAY_LEN (orig) ; k++) + orig [k] = 0x0807050540302010LL + k ; + + endswap_int64_t_copy (first, orig, ARRAY_LEN (first)) ; + endswap_int64_t_copy (second, first, ARRAY_LEN (second)) ; + + if (memcmp (orig, first, sizeof (orig)) == 0) + { printf ("\n\nLine %d : test 1 : these two array should not be the same:\n\n", __LINE__) ; + dump_int64_t_array ("orig", orig, ARRAY_LEN (orig)); + dump_int64_t_array ("first", first, ARRAY_LEN (first)); + exit (1) ; + } ; + + if (memcmp (orig, second, sizeof (orig)) != 0) + { printf ("\n\nLine %d : test 2 : these two array should be the same:\n\n", __LINE__) ; + dump_int64_t_array ("orig", orig, ARRAY_LEN (orig)); + dump_int64_t_array ("second", second, ARRAY_LEN (second)); + exit (1) ; + } ; + + endswap_int64_t_array (first, ARRAY_LEN (first)) ; + + if (memcmp (orig, first, sizeof (orig)) != 0) + { printf ("\n\nLine %d : test 3 : these two array should be the same:\n\n", __LINE__) ; + dump_int64_t_array ("orig", orig, ARRAY_LEN (orig)); + dump_int64_t_array ("first", first, ARRAY_LEN (first)); + exit (1) ; + } ; + + endswap_int64_t_copy (first, orig, ARRAY_LEN (first)) ; + endswap_int64_t_copy (first, first, ARRAY_LEN (first)) ; + + if (memcmp (orig, first, sizeof (orig)) != 0) + { printf ("\n\nLine %d : test 4 : these two array should be the same:\n\n", __LINE__) ; + dump_int64_t_array ("orig", orig, ARRAY_LEN (orig)); + dump_int64_t_array ("first", first, ARRAY_LEN (first)); + exit (1) ; + } ; + + puts ("ok") ; +} /* test_endswap_int64_t */ + + + + diff --git a/Libraries/SndFile/Files/src/test_endswap.def b/Libraries/SndFile/Files/src/test_endswap.def new file mode 100644 index 000000000..68efe6d75 --- /dev/null +++ b/Libraries/SndFile/Files/src/test_endswap.def @@ -0,0 +1,28 @@ +autogen definitions test_endswap.tpl; + +int_type = { + name = short ; + value = 0x3210 ; + format = "0x%04x" ; + } ; + +int_type = { + name = int ; + value = 0x76543210 ; + format = "0x%08x" ; + } ; + +int_type = { + name = int64_t ; + value = "0x0807050540302010LL" ; + format = "0x%016llx" ; + } ; + +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: 098c07e0-2d3f-4f62-ad93-f3f4b91c5211 +*/ + diff --git a/Libraries/SndFile/Files/src/test_endswap.tpl b/Libraries/SndFile/Files/src/test_endswap.tpl new file mode 100644 index 000000000..dfa7417ac --- /dev/null +++ b/Libraries/SndFile/Files/src/test_endswap.tpl @@ -0,0 +1,126 @@ +[+ AutoGen5 template c +] +/* +** Copyright (C) 2002-2004 Erik de Castro Lopo +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU Lesser General Public License as published by +** the Free Software Foundation; either version 2.1 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU Lesser General Public License for more details. +** +** You should have received a copy of the GNU Lesser General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include "config.h" + +#include +#include + +#ifdef HAVE_UNISTD_H +#include +#endif + +#include +#include + +#include "common.h" +#include "sfendian.h" + +[+ FOR int_type ++]static void test_endswap_[+ (get "name") +] (void) ; +[+ ENDFOR int_type ++] + +int +main (void) +{ +[+ FOR int_type ++] test_endswap_[+ (get "name") +] () ; +[+ ENDFOR int_type ++] + return 0 ; +} /* main */ + +/*============================================================================== +** Actual test functions. +*/ + +[+ FOR int_type ++]static void +dump_[+ (get "name") +]_array (const char * name, [+ (get "name") +] * data, int datalen) +{ int k ; + + printf ("%-6s : ", name) ; + for (k = 0 ; k < datalen ; k++) + printf ("[+ (get "format") +] ", data [k]) ; + putchar ('\n') ; +} /* dump_[+ (get "name") +]_array */ + +static void +test_endswap_[+ (get "name") +] (void) +{ [+ (get "name") +] orig [4], first [4], second [4] ; + int k ; + + printf (" %-24s : ", "test_endswap_[+ (get "name") +]") ; + fflush (stdout) ; + + for (k = 0 ; k < ARRAY_LEN (orig) ; k++) + orig [k] = [+ (get "value") +] + k ; + + endswap_[+ (get "name") +]_copy (first, orig, ARRAY_LEN (first)) ; + endswap_[+ (get "name") +]_copy (second, first, ARRAY_LEN (second)) ; + + if (memcmp (orig, first, sizeof (orig)) == 0) + { printf ("\n\nLine %d : test 1 : these two array should not be the same:\n\n", __LINE__) ; + dump_[+ (get "name") +]_array ("orig", orig, ARRAY_LEN (orig)); + dump_[+ (get "name") +]_array ("first", first, ARRAY_LEN (first)); + exit (1) ; + } ; + + if (memcmp (orig, second, sizeof (orig)) != 0) + { printf ("\n\nLine %d : test 2 : these two array should be the same:\n\n", __LINE__) ; + dump_[+ (get "name") +]_array ("orig", orig, ARRAY_LEN (orig)); + dump_[+ (get "name") +]_array ("second", second, ARRAY_LEN (second)); + exit (1) ; + } ; + + endswap_[+ (get "name") +]_array (first, ARRAY_LEN (first)) ; + + if (memcmp (orig, first, sizeof (orig)) != 0) + { printf ("\n\nLine %d : test 3 : these two array should be the same:\n\n", __LINE__) ; + dump_[+ (get "name") +]_array ("orig", orig, ARRAY_LEN (orig)); + dump_[+ (get "name") +]_array ("first", first, ARRAY_LEN (first)); + exit (1) ; + } ; + + endswap_[+ (get "name") +]_copy (first, orig, ARRAY_LEN (first)) ; + endswap_[+ (get "name") +]_copy (first, first, ARRAY_LEN (first)) ; + + if (memcmp (orig, first, sizeof (orig)) != 0) + { printf ("\n\nLine %d : test 4 : these two array should be the same:\n\n", __LINE__) ; + dump_[+ (get "name") +]_array ("orig", orig, ARRAY_LEN (orig)); + dump_[+ (get "name") +]_array ("first", first, ARRAY_LEN (first)); + exit (1) ; + } ; + + puts ("ok") ; +} /* test_endswap_[+ (get "name") +] */ +[+ ENDFOR int_type ++] + + +[+ COMMENT +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: fd8887e8-8202-4f30-a419-0cf01a0e799b +*/ ++] diff --git a/Libraries/SndFile/Files/src/test_file_io.c b/Libraries/SndFile/Files/src/test_file_io.c new file mode 100644 index 000000000..1b5456de1 --- /dev/null +++ b/Libraries/SndFile/Files/src/test_file_io.c @@ -0,0 +1,448 @@ +/* +** Copyright (C) 2002-2004 Erik de Castro Lopo +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU Lesser General Public License as published by +** the Free Software Foundation; either version 2.1 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU Lesser General Public License for more details. +** +** You should have received a copy of the GNU Lesser General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include "config.h" + +#include +#include + +#ifdef HAVE_UNISTD_H +#include +#endif + +#include +#include + +#include "common.h" + +static void make_data (int *data, int len, int seed) ; + +static void file_open_test (const char *filename) ; +static void file_read_write_test (const char *filename) ; +static void file_truncate_test (const char *filename) ; + +static void test_open_or_die (SF_PRIVATE *psf, int linenum) ; +static void test_close_or_die (SF_PRIVATE *psf, int linenum) ; + +static void test_write_or_die (SF_PRIVATE *psf, void *data, sf_count_t bytes, sf_count_t items, sf_count_t new_position, int linenum) ; +static void test_read_or_die (SF_PRIVATE *psf, void *data, sf_count_t bytes, sf_count_t items, sf_count_t new_position, int linenum) ; +static void test_equal_or_die (int *array1, int *array2, int len, int linenum) ; +static void test_seek_or_die (SF_PRIVATE *psf, sf_count_t offset, int whence, sf_count_t new_position, int linenum) ; + + + +int +main (void) +{ const char *filename = "file_io.dat" ; + + file_open_test (filename) ; + file_read_write_test (filename) ; + file_truncate_test (filename) ; + + unlink (filename) ; + + return 0 ; +} /* main */ + +/*============================================================================== +** Actual test functions. +*/ + +static void +file_open_test (const char *filename) +{ SF_PRIVATE sf_data, *psf ; + int error ; + + printf (" %-24s : ", "file_open_test") ; + fflush (stdout) ; + + memset (&sf_data, 0, sizeof (sf_data)) ; + psf = &sf_data ; + + /* Ensure that the file doesn't already exist. */ + if (unlink (filename) != 0 && errno != ENOENT) + { printf ("\n\nLine %d: unlink failed (%d) : %s\n\n", __LINE__, errno, strerror (errno)) ; + exit (1) ; + } ; + + strncpy (psf->filename, filename, sizeof (psf->filename)) ; + + /* Test that open for read fails if the file doesn't exist. */ + error = psf_fopen (psf, psf->filename, SFM_READ) ; + if (error == 0) + { printf ("\n\nLine %d: psf_fopen() should have failed.\n\n", __LINE__) ; + exit (1) ; + } ; + + /* Reset error to zero. */ + psf->error = SFE_NO_ERROR ; + + /* Test file open in write mode. */ + psf->mode = SFM_WRITE ; + test_open_or_die (psf, __LINE__) ; + + test_close_or_die (psf, __LINE__) ; + + unlink (psf->filename) ; + + /* Test file open in read/write mode for a non-existant file. */ + psf->mode = SFM_RDWR ; + test_open_or_die (psf, __LINE__) ; + + test_close_or_die (psf, __LINE__) ; + + /* Test file open in read/write mode for an existing file. */ + psf->mode = SFM_RDWR ; + test_open_or_die (psf, __LINE__) ; + + test_close_or_die (psf, __LINE__) ; + + unlink (psf->filename) ; + puts ("ok") ; +} /* file_open_test */ + +static void +file_read_write_test (const char *filename) +{ static int data_out [512] ; + static int data_in [512] ; + + SF_PRIVATE sf_data, *psf ; + sf_count_t retval ; + + /* + ** Open a new file and write two blocks of data to the file. After each + ** write, test that psf_get_filelen() returns the new length. + */ + + printf (" %-24s : ", "file_write_test") ; + fflush (stdout) ; + + memset (&sf_data, 0, sizeof (sf_data)) ; + psf = &sf_data ; + strncpy (psf->filename, filename, sizeof (psf->filename)) ; + + /* Test file open in write mode. */ + psf->mode = SFM_WRITE ; + test_open_or_die (psf, __LINE__) ; + + make_data (data_out, ARRAY_LEN (data_out), 1) ; + test_write_or_die (psf, data_out, sizeof (data_out [0]), ARRAY_LEN (data_out), sizeof (data_out), __LINE__) ; + + if ((retval = psf_get_filelen (psf)) != sizeof (data_out)) + { printf ("\n\nLine %d: file length after write is not correct (%ld should be %d).\n\n", __LINE__, (long) retval, (int) sizeof (data_out)) ; + if (retval == 0) + printf ("An fsync() may be necessary before fstat() in psf_get_filelen().\n\n") ; + exit (1) ; + } ; + + make_data (data_out, ARRAY_LEN (data_out), 2) ; + test_write_or_die (psf, data_out, ARRAY_LEN (data_out), sizeof (data_out [0]), 2 * sizeof (data_out), __LINE__) ; + + if ((retval = psf_get_filelen (psf)) != 2 * sizeof (data_out)) + { printf ("\n\nLine %d: file length after write is not correct. (%ld should be %d)\n\n", __LINE__, (long) retval, 2 * ((int) sizeof (data_out))) ; + exit (1) ; + } ; + + test_close_or_die (psf, __LINE__) ; + puts ("ok") ; + + /* + ** Now open the file in read mode, check the file length and check + ** that the data is correct. + */ + + printf (" %-24s : ", "file_read_test") ; + fflush (stdout) ; + + /* Test file open in write mode. */ + psf->mode = SFM_READ ; + test_open_or_die (psf, __LINE__) ; + + make_data (data_out, ARRAY_LEN (data_out), 1) ; + test_read_or_die (psf, data_in, 1, sizeof (data_in), sizeof (data_in), __LINE__) ; + test_equal_or_die (data_out, data_in, ARRAY_LEN (data_out), __LINE__) ; + + make_data (data_out, ARRAY_LEN (data_out), 2) ; + test_read_or_die (psf, data_in, sizeof (data_in [0]), ARRAY_LEN (data_in), 2 * sizeof (data_in), __LINE__) ; + test_equal_or_die (data_out, data_in, ARRAY_LEN (data_out), __LINE__) ; + + test_close_or_die (psf, __LINE__) ; + + puts ("ok") ; + + /* + ** Open the file in read/write mode, seek around a bit and then seek to + ** the end of the file and write another block of data (3rd block). Then + ** go back and check that all three blocks are correct. + */ + + printf (" %-24s : ", "file_seek_test") ; + fflush (stdout) ; + + /* Test file open in read/write mode. */ + psf->mode = SFM_RDWR ; + test_open_or_die (psf, __LINE__) ; + + test_seek_or_die (psf, 0, SEEK_SET, 0, __LINE__) ; + test_seek_or_die (psf, 0, SEEK_END, 2 * SIGNED_SIZEOF (data_out), __LINE__) ; + test_seek_or_die (psf, -1 * SIGNED_SIZEOF (data_out), SEEK_CUR, (sf_count_t) sizeof (data_out), __LINE__) ; + + test_seek_or_die (psf, SIGNED_SIZEOF (data_out), SEEK_CUR, 2 * SIGNED_SIZEOF (data_out), __LINE__) ; + make_data (data_out, ARRAY_LEN (data_out), 3) ; + test_write_or_die (psf, data_out, sizeof (data_out [0]), ARRAY_LEN (data_out), 3 * sizeof (data_out), __LINE__) ; + + test_seek_or_die (psf, 0, SEEK_SET, 0, __LINE__) ; + make_data (data_out, ARRAY_LEN (data_out), 1) ; + test_read_or_die (psf, data_in, 1, sizeof (data_in), sizeof (data_in), __LINE__) ; + test_equal_or_die (data_out, data_in, ARRAY_LEN (data_out), __LINE__) ; + + test_seek_or_die (psf, 2 * SIGNED_SIZEOF (data_out), SEEK_SET, 2 * SIGNED_SIZEOF (data_out), __LINE__) ; + make_data (data_out, ARRAY_LEN (data_out), 3) ; + test_read_or_die (psf, data_in, 1, sizeof (data_in), 3 * sizeof (data_in), __LINE__) ; + test_equal_or_die (data_out, data_in, ARRAY_LEN (data_out), __LINE__) ; + + test_seek_or_die (psf, SIGNED_SIZEOF (data_out), SEEK_SET, SIGNED_SIZEOF (data_out), __LINE__) ; + make_data (data_out, ARRAY_LEN (data_out), 2) ; + test_read_or_die (psf, data_in, 1, sizeof (data_in), 2 * sizeof (data_in), __LINE__) ; + test_equal_or_die (data_out, data_in, ARRAY_LEN (data_out), __LINE__) ; + + test_close_or_die (psf, __LINE__) ; + puts ("ok") ; + + /* + ** Now test operations with a non-zero psf->fileoffset field. This field + ** sets an artificial file start positions so that a seek to the start of + ** the file will actually be a seek to the value given by psf->fileoffset. + */ + + printf (" %-24s : ", "file_offset_test") ; + fflush (stdout) ; + + /* Test file open in read/write mode. */ + psf->mode = SFM_RDWR ; + psf->fileoffset = sizeof (data_out [0]) * ARRAY_LEN (data_out) ; + test_open_or_die (psf, __LINE__) ; + + if ((retval = psf_get_filelen (psf)) != 3 * sizeof (data_out)) + { printf ("\n\nLine %d: file length after write is not correct. (%ld should be %d)\n\n", __LINE__, (long) retval, 3 * ((int) sizeof (data_out))) ; + exit (1) ; + } ; + + test_seek_or_die (psf, SIGNED_SIZEOF (data_out), SEEK_SET, SIGNED_SIZEOF (data_out), __LINE__) ; + make_data (data_out, ARRAY_LEN (data_out), 5) ; + test_write_or_die (psf, data_out, sizeof (data_out [0]), ARRAY_LEN (data_out), 2 * sizeof (data_out), __LINE__) ; + test_close_or_die (psf, __LINE__) ; + + /* final test with psf->fileoffset == 0. */ + + psf->mode = SFM_RDWR ; + psf->fileoffset = 0 ; + test_open_or_die (psf, __LINE__) ; + + if ((retval = psf_get_filelen (psf)) != 3 * sizeof (data_out)) + { printf ("\n\nLine %d: file length after write is not correct. (%ld should be %d)\n\n", __LINE__, (long) retval, 3 * ((int) sizeof (data_out))) ; + exit (1) ; + } ; + + make_data (data_out, ARRAY_LEN (data_out), 1) ; + test_read_or_die (psf, data_in, 1, sizeof (data_in), sizeof (data_in), __LINE__) ; + test_equal_or_die (data_out, data_in, ARRAY_LEN (data_out), __LINE__) ; + + make_data (data_out, ARRAY_LEN (data_out), 2) ; + test_read_or_die (psf, data_in, 1, sizeof (data_in), 2 * sizeof (data_in), __LINE__) ; + test_equal_or_die (data_out, data_in, ARRAY_LEN (data_out), __LINE__) ; + + make_data (data_out, ARRAY_LEN (data_out), 5) ; + test_read_or_die (psf, data_in, 1, sizeof (data_in), 3 * sizeof (data_in), __LINE__) ; + test_equal_or_die (data_out, data_in, ARRAY_LEN (data_out), __LINE__) ; + + test_close_or_die (psf, __LINE__) ; + + puts ("ok") ; +} /* file_read_write_test */ + +static void +file_truncate_test (const char *filename) +{ SF_PRIVATE sf_data, *psf ; + unsigned char buffer [256] ; + int k ; + + /* + ** Open a new file and write two blocks of data to the file. After each + ** write, test that psf_get_filelen() returns the new length. + */ + + printf (" %-24s : ", "file_truncate_test") ; + fflush (stdout) ; + + memset (&sf_data, 0, sizeof (sf_data)) ; + memset (buffer, 0xEE, sizeof (buffer)) ; + + psf = &sf_data ; + strncpy (psf->filename, filename, sizeof (psf->filename)) ; + + /* + ** Open the file write mode, write 0xEE data and then extend the file + ** using truncate (the extended data should be 0x00). + */ + psf->mode = SFM_WRITE ; + test_open_or_die (psf, __LINE__) ; + test_write_or_die (psf, buffer, sizeof (buffer) / 2, 1, sizeof (buffer) / 2, __LINE__) ; + psf_ftruncate (psf, sizeof (buffer)) ; + test_close_or_die (psf, __LINE__) ; + + /* Open the file in read mode and check the data. */ + psf->mode = SFM_READ ; + test_open_or_die (psf, __LINE__) ; + test_read_or_die (psf, buffer, sizeof (buffer), 1, sizeof (buffer), __LINE__) ; + test_close_or_die (psf, __LINE__) ; + + for (k = 0 ; k < SIGNED_SIZEOF (buffer) / 2 ; k++) + if (buffer [k] != 0xEE) + { printf ("\n\nLine %d : buffer [%d] = %d (should be 0xEE)\n\n", __LINE__, k, buffer [k]) ; + exit (1) ; + } ; + + for (k = SIGNED_SIZEOF (buffer) / 2 ; k < SIGNED_SIZEOF (buffer) ; k++) + if (buffer [k] != 0) + { printf ("\n\nLine %d : buffer [%d] = %d (should be 0)\n\n", __LINE__, k, buffer [k]) ; + exit (1) ; + } ; + + /* Open the file in read/write and shorten the file using truncate. */ + psf->mode = SFM_RDWR ; + test_open_or_die (psf, __LINE__) ; + psf_ftruncate (psf, sizeof (buffer) / 4) ; + test_close_or_die (psf, __LINE__) ; + + /* Check the file length. */ + psf->mode = SFM_READ ; + test_open_or_die (psf, __LINE__) ; + test_seek_or_die (psf, 0, SEEK_END, SIGNED_SIZEOF (buffer) / 4, __LINE__) ; + test_close_or_die (psf, __LINE__) ; + + puts ("ok") ; +} /* file_truncate_test */ + +/*============================================================================== +** Testing helper functions. +*/ + +static void +test_open_or_die (SF_PRIVATE *psf, int linenum) +{ int error ; + + /* Test that open for read fails if the file doesn't exist. */ + error = psf_fopen (psf, psf->filename, psf->mode) ; + if (error) + { printf ("\n\nLine %d: psf_fopen() failed : %s\n\n", linenum, strerror (errno)) ; + exit (1) ; + } ; + +} /* test_open_or_die */ + +static void +test_close_or_die (SF_PRIVATE *psf, int linenum) +{ + psf_fclose (psf) ; + if (psf->filedes >= 0) + { printf ("\n\nLine %d: psf->filedes should be < 0.\n\n", linenum) ; + exit (1) ; + } ; + +} /* test_close_or_die */ + +static void +test_write_or_die (SF_PRIVATE *psf, void *data, sf_count_t bytes, sf_count_t items, sf_count_t new_position, int linenum) +{ sf_count_t retval ; + + retval = psf_fwrite (data, bytes, items, psf) ; + if (retval != items) + { printf ("\n\nLine %d: psf_write() returned %ld (should be %ld)\n\n", linenum, (long) retval, (long) items) ; + exit (1) ; + } ; + + if ((retval = psf_ftell (psf)) != new_position) + { printf ("\n\nLine %d: file length after write is not correct. (%ld should be %ld)\n\n", linenum, (long) retval, (long) new_position) ; + exit (1) ; + } ; + + return ; +} /* test_write_or_die */ + +static void +test_read_or_die (SF_PRIVATE *psf, void *data, sf_count_t bytes, sf_count_t items, sf_count_t new_position, int linenum) +{ sf_count_t retval ; + + retval = psf_fread (data, bytes, items, psf) ; + if (retval != items) + { printf ("\n\nLine %d: psf_write() returned %ld (should be %ld)\n\n", linenum, (long) retval, (long) items) ; + exit (1) ; + } ; + + if ((retval = psf_ftell (psf)) != new_position) + { printf ("\n\nLine %d: file length after write is not correct. (%ld should be %ld)\n\n", linenum, (long) retval, (long) new_position) ; + exit (1) ; + } ; + + return ; +} /* test_write_or_die */ + +static void +test_seek_or_die (SF_PRIVATE *psf, sf_count_t offset, int whence, sf_count_t new_position, int linenum) +{ sf_count_t retval ; + + retval = psf_fseek (psf, offset, whence) ; + + if (retval != new_position) + { printf ("\n\nLine %d: psf_fseek() failed. New position is %ld (should be %ld).\n\n", + linenum, (long) retval, (long) new_position) ; + exit (1) ; + } ; + +} /* test_seek_or_die */ + +static void +test_equal_or_die (int *array1, int *array2, int len, int linenum) +{ int k ; + + for (k = 0 ; k < len ; k++) + if (array1 [k] != array2 [k]) + printf ("\n\nLine %d: error at index %d (%d != %d).\n\n", + linenum, k, array1 [k], array2 [k]) ; + + return ; +} /* test_equal_or_die */ + +static void +make_data (int *data, int len, int seed) +{ int k ; + + srand (seed * 3333333 + 14756123) ; + + for (k = 0 ; k < len ; k++) + data [k] = rand () ; + +} /* make_data */ +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: 0a21fb93-78dd-4f72-8338-4bca9e77b8c8 +*/ diff --git a/Libraries/SndFile/Files/src/test_log_printf.c b/Libraries/SndFile/Files/src/test_log_printf.c new file mode 100644 index 000000000..fde54b79d --- /dev/null +++ b/Libraries/SndFile/Files/src/test_log_printf.c @@ -0,0 +1,138 @@ +/* +** Copyright (C) 2003,2004 Erik de Castro Lopo +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU Lesser General Public License as published by +** the Free Software Foundation; either version 2.1 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU Lesser General Public License for more details. +** +** You should have received a copy of the GNU Lesser General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include +#include +#include +#include +#include + +#include "config.h" + +/* +** This is a bit rough, but it is the nicest way to do it. +*/ +#define PSF_LOG_PRINTF_ONLY +#include "common.c" + + +#define CMP_0_ARGS(line,err,fmt) \ + { psf->logindex = 0 ; \ + LSF_SNPRINTF (buffer, sizeof (buffer), (fmt)) ; \ + psf_log_printf (psf, (fmt)) ; \ + err += compare_strings_or_die (line, fmt, buffer, psf->logbuffer) ; \ + } + +#define CMP_2_ARGS(line,err,fmt,a) \ + { psf->logindex = 0 ; \ + LSF_SNPRINTF (buffer, sizeof (buffer), (fmt), (a), (a)) ; \ + psf_log_printf (psf, (fmt), (a), (a)) ; \ + err += compare_strings_or_die (line, fmt, buffer, psf->logbuffer) ; \ + } + +#define CMP_4_ARGS(line,err,fmt,a) \ + { psf->logindex = 0 ; \ + LSF_SNPRINTF (buffer, sizeof (buffer), (fmt), (a), (a), (a), (a)) ; \ + psf_log_printf (psf, (fmt), (a), (a), (a), (a)) ; \ + err += compare_strings_or_die (line, fmt, buffer, psf->logbuffer) ; \ + } + +#define CMP_5_ARGS(line,err,fmt,a) \ + { psf->logindex = 0 ; \ + LSF_SNPRINTF (buffer, sizeof (buffer), (fmt), (a), (a), (a), (a), (a)) ; \ + psf_log_printf (psf, (fmt), (a), (a), (a), (a), (a)) ; \ + err += compare_strings_or_die (line, fmt, buffer, psf->logbuffer) ; \ + } + +#define CMP_6_ARGS(line,err,fmt,a) \ + { psf->logindex = 0 ; \ + LSF_SNPRINTF (buffer, sizeof (buffer), (fmt), (a), (a), (a), (a), (a), (a)) ; \ + psf_log_printf (psf, (fmt), (a), (a), (a), (a), (a), (a)) ; \ + err += compare_strings_or_die (line, fmt, buffer, psf->logbuffer) ; \ + } + +static int compare_strings_or_die (int linenum, const char *fmt, const char* s1, const char* s3) ; + +int +main (void) +{ static char buffer [2048] ; + SF_PRIVATE sf_private, *psf ; + int k, errors = 0 ; + int int_values [] = { 0, 1, 12, 123, 1234, 123456, -1, -12, -123, -1234, -123456 } ; + + printf (" %-24s : ", "psf_log_printf_test") ; + fflush (stdout) ; + + psf = &sf_private ; + memset (psf, 0, sizeof (sf_private)) ; + + CMP_0_ARGS (__LINE__, errors, " ->%%<- ") ; + + /* Test printing of ints. */ + for (k = 0 ; k < ARRAY_LEN (int_values) ; k++) + CMP_6_ARGS (__LINE__, errors, "int A : %d, % d, %4d, % 4d, %04d, % 04d", int_values [k]) ; + + for (k = 0 ; k < ARRAY_LEN (int_values) ; k++) + CMP_5_ARGS (__LINE__, errors, "int B : %+d, %+4d, %+04d, %-d, %-4d", int_values [k]) ; + + for (k = 0 ; k < ARRAY_LEN (int_values) ; k++) + CMP_2_ARGS (__LINE__, errors, "int C : %- d, %- 4d", int_values [k]) ; + + /* Test printing of unsigned ints. */ + for (k = 0 ; k < ARRAY_LEN (int_values) ; k++) + CMP_4_ARGS (__LINE__, errors, "D : %u, %4u, %04u, %0u", int_values [k]) ; + + /* Test printing of hex ints. */ + for (k = 0 ; k < ARRAY_LEN (int_values) ; k++) + CMP_4_ARGS (__LINE__, errors, "E : %X, %4X, %04X, %0X", int_values [k]) ; + + /* Test printing of strings. */ + CMP_4_ARGS (__LINE__, errors, "B %s, %3s, %8s, %-8s", "str") ; + + if (errors) + { puts ("\nExiting due to errors.\n") ; + exit (1) ; + } ; + + puts ("ok") ; + + return 0 ; +} /* main */ + +static int +compare_strings_or_die (int linenum, const char *fmt, const char* s1, const char* s2) +{ int errors = 0 ; +/*-puts (s1) ;puts (s2) ;-*/ + + if (strcmp (s1, s2) != 0) + { printf ("\n\nLine %d: string compare mismatch:\n\t", linenum) ; + printf ("\"%s\"\n", fmt) ; + printf ("\t\"%s\"\n\t\"%s\"\n", s1, s2) ; + errors ++ ; + } ; + + return errors ; +} /* compare_strings_or_die */ + +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: 45147310-868b-400a-97e8-cc0a572a6270 +*/ diff --git a/Libraries/SndFile/Files/src/txw.c b/Libraries/SndFile/Files/src/txw.c new file mode 100644 index 000000000..1be23aef3 --- /dev/null +++ b/Libraries/SndFile/Files/src/txw.c @@ -0,0 +1,378 @@ +/* +** Copyright (C) 2002-2004 Erik de Castro Lopo +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU Lesser General Public License as published by +** the Free Software Foundation; either version 2.1 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU Lesser General Public License for more details. +** +** You should have received a copy of the GNU Lesser General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +/*=========================================================================== +** Yamaha TX16 Sampler Files. +** +** This header parser was written using information from the SoX source code +** and trial and error experimentation. The code here however is all original. +*/ + +#include +#include +#include +#include + +#include "sndfile.h" +#include "config.h" +#include "sfendian.h" +#include "common.h" + +#if (ENABLE_EXPERIMENTAL_CODE == 0) + +int +txw_open (SF_PRIVATE *psf) +{ if (psf) + return SFE_UNIMPLEMENTED ; + return (psf && 0) ; +} /* txw_open */ + +#else + +/*------------------------------------------------------------------------------ +** Markers. +*/ + +#define TXW_DATA_OFFSET 32 + +#define TXW_LOOPED 0x49 +#define TXW_NO_LOOP 0xC9 + +/*------------------------------------------------------------------------------ +** Private static functions. +*/ + +static int txw_read_header (SF_PRIVATE *psf) ; + +static sf_count_t txw_read_s (SF_PRIVATE *psf, short *ptr, sf_count_t len) ; +static sf_count_t txw_read_i (SF_PRIVATE *psf, int *ptr, sf_count_t len) ; +static sf_count_t txw_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ; +static sf_count_t txw_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ; + +static sf_count_t txw_seek (SF_PRIVATE *psf, int mode, sf_count_t offset) ; + +/*------------------------------------------------------------------------------ +** Public functions. +*/ + +/* + * ftp://ftp.t0.or.at/pub/sound/tx16w/samples.yamaha + * ftp://ftp.t0.or.at/pub/sound/tx16w/faq/tx16w.tec + * http://www.t0.or.at/~mpakesch/tx16w/ + * + * from tx16w.c sox 12.15: (7-Oct-98) (Mark Lakata and Leigh Smith) + * char filetype[6] "LM8953" + * nulls[10], + * dummy_aeg[6] + * format 0x49 = looped, 0xC9 = non-looped + * sample_rate 1 = 33 kHz, 2 = 50 kHz, 3 = 16 kHz + * atc_length[3] if sample rate 0, [2]&0xfe = 6: 33kHz, 0x10:50, 0xf6: 16, + * depending on [5] but to heck with it + * rpt_length[3] (these are for looped samples, attack and loop lengths) + * unused[2] + */ + +typedef struct +{ unsigned char format, srate, sr2, sr3 ; + unsigned short srhash ; + unsigned int attacklen, repeatlen ; +} TXW_HEADER ; + +#define ERROR_666 666 + +int +txw_open (SF_PRIVATE *psf) +{ int error ; + + if (psf->mode != SFM_READ) + return SFE_UNIMPLEMENTED ; + + if ((error = txw_read_header (psf))) + return error ; + + if (psf_fseek (psf, psf->dataoffset, SEEK_SET) != psf->dataoffset) + return SFE_BAD_SEEK ; + + psf->read_short = txw_read_s ; + psf->read_int = txw_read_i ; + psf->read_float = txw_read_f ; + psf->read_double = txw_read_d ; + + psf->seek = txw_seek ; + + return 0 ; +} /* txw_open */ + +/*------------------------------------------------------------------------------ +*/ + +static int +txw_read_header (SF_PRIVATE *psf) +{ TXW_HEADER txwh ; + char *strptr ; + + memset (&txwh, 0, sizeof (txwh)) ; + memset (psf->u.cbuf, 0, sizeof (psf->u.cbuf)) ; + psf_binheader_readf (psf, "pb", 0, psf->u.cbuf, 16) ; + + if (memcmp (psf->u.cbuf, "LM8953\0\0\0\0\0\0\0\0\0\0", 16) != 0) + return ERROR_666 ; + + psf_log_printf (psf, "Read only : Yamaha TX-16 Sampler (.txw)\nLM8953\n") ; + + /* Jump 6 bytes (dummp_aeg), read format, read sample rate. */ + psf_binheader_readf (psf, "j11", 6, &txwh.format, &txwh.srate) ; + + /* 8 bytes (atc_length[3], rpt_length[3], unused[2]). */ + psf_binheader_readf (psf, "e33j", &txwh.attacklen, &txwh.repeatlen, 2) ; + txwh.sr2 = (txwh.attacklen >> 16) & 0xFE ; + txwh.sr3 = (txwh.repeatlen >> 16) & 0xFE ; + txwh.attacklen &= 0x1FFFF ; + txwh.repeatlen &= 0x1FFFF ; + + switch (txwh.format) + { case TXW_LOOPED : + strptr = "looped" ; + break ; + + case TXW_NO_LOOP : + strptr = "non-looped" ; + break ; + + default : + psf_log_printf (psf, " Format : 0x%02x => ?????\n", txwh.format) ; + return ERROR_666 ; + } ; + + psf_log_printf (psf, " Format : 0x%02X => %s\n", txwh.format, strptr) ; + + strptr = NULL ; + + switch (txwh.srate) + { case 1 : + psf->sf.samplerate = 33333 ; + break ; + + case 2 : + psf->sf.samplerate = 50000 ; + break ; + + case 3 : + psf->sf.samplerate = 16667 ; + break ; + + default : + /* This is ugly and braindead. */ + txwh.srhash = ((txwh.sr2 & 0xFE) << 8) | (txwh.sr3 & 0xFE) ; + switch (txwh.srhash) + { case ((0x6 << 8) | 0x52) : + psf->sf.samplerate = 33333 ; + break ; + + case ((0x10 << 8) | 0x52) : + psf->sf.samplerate = 50000 ; + break ; + + case ((0xF6 << 8) | 0x52) : + psf->sf.samplerate = 166667 ; + break ; + + default : + strptr = " Sample Rate : Unknown : forcing to 33333\n" ; + psf->sf.samplerate = 33333 ; + break ; + } ; + } ; + + + if (strptr) + psf_log_printf (psf, strptr) ; + else if (txwh.srhash) + psf_log_printf (psf, " Sample Rate : %d (0x%X) => %d\n", txwh.srate, txwh.srhash, psf->sf.samplerate) ; + else + psf_log_printf (psf, " Sample Rate : %d => %d\n", txwh.srate, psf->sf.samplerate) ; + + if (txwh.format == TXW_LOOPED) + { psf_log_printf (psf, " Attack Len : %d\n", txwh.attacklen) ; + psf_log_printf (psf, " Repeat Len : %d\n", txwh.repeatlen) ; + } ; + + psf->dataoffset = TXW_DATA_OFFSET ; + psf->datalength = psf->filelength - TXW_DATA_OFFSET ; + psf->sf.frames = 2 * psf->datalength / 3 ; + + + if (psf->datalength % 3 == 1) + psf_log_printf (psf, "*** File seems to be truncated, %d extra bytes.\n", + (int) (psf->datalength % 3)) ; + + if (txwh.attacklen + txwh.repeatlen > psf->sf.frames) + psf_log_printf (psf, "*** File has been truncated.\n") ; + + psf->sf.format = SF_FORMAT_TXW | SF_FORMAT_PCM_16 ; + psf->sf.channels = 1 ; + psf->sf.sections = 1 ; + psf->sf.seekable = SF_TRUE ; + + return 0 ; +} /* txw_read_header */ + +static sf_count_t +txw_read_s (SF_PRIVATE *psf, short *ptr, sf_count_t len) +{ unsigned char *ucptr ; + short sample ; + int k, bufferlen, readcount, count ; + sf_count_t total = 0 ; + + bufferlen = sizeof (psf->u.cbuf) / 3 ; + bufferlen -= (bufferlen & 1) ; + while (len > 0) + { readcount = (len >= bufferlen) ? bufferlen : len ; + count = psf_fread (psf->u.cbuf, 3, readcount, psf) ; + + ucptr = psf->u.ucbuf ; + for (k = 0 ; k < readcount ; k += 2) + { sample = (ucptr [0] << 8) | (ucptr [1] & 0xF0) ; + ptr [total + k] = sample ; + sample = (ucptr [2] << 8) | ((ucptr [1] & 0xF) << 4) ; + ptr [total + k + 1] = sample ; + ucptr += 3 ; + } ; + + total += count ; + len -= readcount ; + } ; + + return total ; +} /* txw_read_s */ + +static sf_count_t +txw_read_i (SF_PRIVATE *psf, int *ptr, sf_count_t len) +{ unsigned char *ucptr ; + short sample ; + int k, bufferlen, readcount, count ; + sf_count_t total = 0 ; + + bufferlen = sizeof (psf->u.cbuf) / 3 ; + bufferlen -= (bufferlen & 1) ; + while (len > 0) + { readcount = (len >= bufferlen) ? bufferlen : len ; + count = psf_fread (psf->u.cbuf, 3, readcount, psf) ; + + ucptr = psf->u.ucbuf ; + for (k = 0 ; k < readcount ; k += 2) + { sample = (ucptr [0] << 8) | (ucptr [1] & 0xF0) ; + ptr [total + k] = sample << 16 ; + sample = (ucptr [2] << 8) | ((ucptr [1] & 0xF) << 4) ; + ptr [total + k + 1] = sample << 16 ; + ucptr += 3 ; + } ; + + total += count ; + len -= readcount ; + } ; + + return total ; +} /* txw_read_i */ + +static sf_count_t +txw_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) +{ unsigned char *ucptr ; + short sample ; + int k, bufferlen, readcount, count ; + sf_count_t total = 0 ; + float normfact ; + + if (psf->norm_float == SF_TRUE) + normfact = 1.0 / 0x8000 ; + else + normfact = 1.0 / 0x10 ; + + bufferlen = sizeof (psf->u.cbuf) / 3 ; + bufferlen -= (bufferlen & 1) ; + while (len > 0) + { readcount = (len >= bufferlen) ? bufferlen : len ; + count = psf_fread (psf->u.cbuf, 3, readcount, psf) ; + + ucptr = psf->u.ucbuf ; + for (k = 0 ; k < readcount ; k += 2) + { sample = (ucptr [0] << 8) | (ucptr [1] & 0xF0) ; + ptr [total + k] = normfact * sample ; + sample = (ucptr [2] << 8) | ((ucptr [1] & 0xF) << 4) ; + ptr [total + k + 1] = normfact * sample ; + ucptr += 3 ; + } ; + + total += count ; + len -= readcount ; + } ; + + return total ; +} /* txw_read_f */ + +static sf_count_t +txw_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) +{ unsigned char *ucptr ; + short sample ; + int k, bufferlen, readcount, count ; + sf_count_t total = 0 ; + double normfact ; + + if (psf->norm_double == SF_TRUE) + normfact = 1.0 / 0x8000 ; + else + normfact = 1.0 / 0x10 ; + + bufferlen = sizeof (psf->u.cbuf) / 3 ; + bufferlen -= (bufferlen & 1) ; + while (len > 0) + { readcount = (len >= bufferlen) ? bufferlen : len ; + count = psf_fread (psf->u.cbuf, 3, readcount, psf) ; + + ucptr = psf->u.ucbuf ; + for (k = 0 ; k < readcount ; k += 2) + { sample = (ucptr [0] << 8) | (ucptr [1] & 0xF0) ; + ptr [total + k] = normfact * sample ; + sample = (ucptr [2] << 8) | ((ucptr [1] & 0xF) << 4) ; + ptr [total + k + 1] = normfact * sample ; + ucptr += 3 ; + } ; + + total += count ; + len -= readcount ; + } ; + + return total ; +} /* txw_read_d */ + +static sf_count_t +txw_seek (SF_PRIVATE *psf, int mode, sf_count_t offset) +{ if (psf && mode) + return offset ; + + return 0 ; +} /* txw_seek */ + +#endif +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: 4d0ba7af-b1c5-46b4-a900-7c6f59fd9a89 +*/ diff --git a/Libraries/SndFile/Files/src/ulaw.c b/Libraries/SndFile/Files/src/ulaw.c new file mode 100644 index 000000000..8de7c66e1 --- /dev/null +++ b/Libraries/SndFile/Files/src/ulaw.c @@ -0,0 +1,1047 @@ +/* +** Copyright (C) 1999-2004 Erik de Castro Lopo +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU Lesser General Public License as published by +** the Free Software Foundation; either version 2.1 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU Lesser General Public License for more details. +** +** You should have received a copy of the GNU Lesser General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include "sndfile.h" +#include "float_cast.h" +#include "common.h" + +static sf_count_t ulaw_read_ulaw2s (SF_PRIVATE *psf, short *ptr, sf_count_t len) ; +static sf_count_t ulaw_read_ulaw2i (SF_PRIVATE *psf, int *ptr, sf_count_t len) ; +static sf_count_t ulaw_read_ulaw2f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ; +static sf_count_t ulaw_read_ulaw2d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ; + +static sf_count_t ulaw_write_s2ulaw (SF_PRIVATE *psf, short *ptr, sf_count_t len) ; +static sf_count_t ulaw_write_i2ulaw (SF_PRIVATE *psf, int *ptr, sf_count_t len) ; +static sf_count_t ulaw_write_f2ulaw (SF_PRIVATE *psf, float *ptr, sf_count_t len) ; +static sf_count_t ulaw_write_d2ulaw (SF_PRIVATE *psf, double *ptr, sf_count_t len) ; + +int +ulaw_init (SF_PRIVATE *psf) +{ + if (psf->mode == SFM_READ || psf->mode == SFM_RDWR) + { psf->read_short = ulaw_read_ulaw2s ; + psf->read_int = ulaw_read_ulaw2i ; + psf->read_float = ulaw_read_ulaw2f ; + psf->read_double = ulaw_read_ulaw2d ; + } ; + + if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR) + { psf->write_short = ulaw_write_s2ulaw ; + psf->write_int = ulaw_write_i2ulaw ; + psf->write_float = ulaw_write_f2ulaw ; + psf->write_double = ulaw_write_d2ulaw ; + } ; + + psf->bytewidth = 1 ; + psf->blockwidth = psf->sf.channels ; + + if (psf->filelength > psf->dataoffset) + psf->datalength = (psf->dataend) ? psf->dataend - psf->dataoffset : + psf->filelength - psf->dataoffset ; + else + psf->datalength = 0 ; + + psf->sf.frames = psf->datalength / psf->blockwidth ; + + return 0 ; +} /* ulaw_init */ + +/*============================================================================== +*/ + +static short ulaw_decode [256] = +{ -32124, -31100, -30076, -29052, -28028, -27004, -25980, -24956, + -23932, -22908, -21884, -20860, -19836, -18812, -17788, -16764, + -15996, -15484, -14972, -14460, -13948, -13436, -12924, -12412, + -11900, -11388, -10876, -10364, -9852, -9340, -8828, -8316, + -7932, -7676, -7420, -7164, -6908, -6652, -6396, -6140, + -5884, -5628, -5372, -5116, -4860, -4604, -4348, -4092, + -3900, -3772, -3644, -3516, -3388, -3260, -3132, -3004, + -2876, -2748, -2620, -2492, -2364, -2236, -2108, -1980, + -1884, -1820, -1756, -1692, -1628, -1564, -1500, -1436, + -1372, -1308, -1244, -1180, -1116, -1052, -988, -924, + -876, -844, -812, -780, -748, -716, -684, -652, + -620, -588, -556, -524, -492, -460, -428, -396, + -372, -356, -340, -324, -308, -292, -276, -260, + -244, -228, -212, -196, -180, -164, -148, -132, + -120, -112, -104, -96, -88, -80, -72, -64, + -56, -48, -40, -32, -24, -16, -8, 0, + + 32124, 31100, 30076, 29052, 28028, 27004, 25980, 24956, + 23932, 22908, 21884, 20860, 19836, 18812, 17788, 16764, + 15996, 15484, 14972, 14460, 13948, 13436, 12924, 12412, + 11900, 11388, 10876, 10364, 9852, 9340, 8828, 8316, + 7932, 7676, 7420, 7164, 6908, 6652, 6396, 6140, + 5884, 5628, 5372, 5116, 4860, 4604, 4348, 4092, + 3900, 3772, 3644, 3516, 3388, 3260, 3132, 3004, + 2876, 2748, 2620, 2492, 2364, 2236, 2108, 1980, + 1884, 1820, 1756, 1692, 1628, 1564, 1500, 1436, + 1372, 1308, 1244, 1180, 1116, 1052, 988, 924, + 876, 844, 812, 780, 748, 716, 684, 652, + 620, 588, 556, 524, 492, 460, 428, 396, + 372, 356, 340, 324, 308, 292, 276, 260, + 244, 228, 212, 196, 180, 164, 148, 132, + 120, 112, 104, 96, 88, 80, 72, 64, + 56, 48, 40, 32, 24, 16, 8, 0 +} ; + +static +unsigned char ulaw_encode [8193] = +{ 0xff, 0xfe, 0xfe, 0xfd, 0xfd, 0xfc, 0xfc, 0xfb, 0xfb, 0xfa, 0xfa, 0xf9, + 0xf9, 0xf8, 0xf8, 0xf7, 0xf7, 0xf6, 0xf6, 0xf5, 0xf5, 0xf4, 0xf4, 0xf3, + 0xf3, 0xf2, 0xf2, 0xf1, 0xf1, 0xf0, 0xf0, 0xef, 0xef, 0xef, 0xef, 0xee, + 0xee, 0xee, 0xee, 0xed, 0xed, 0xed, 0xed, 0xec, 0xec, 0xec, 0xec, 0xeb, + 0xeb, 0xeb, 0xeb, 0xea, 0xea, 0xea, 0xea, 0xe9, 0xe9, 0xe9, 0xe9, 0xe8, + 0xe8, 0xe8, 0xe8, 0xe7, 0xe7, 0xe7, 0xe7, 0xe6, 0xe6, 0xe6, 0xe6, 0xe5, + 0xe5, 0xe5, 0xe5, 0xe4, 0xe4, 0xe4, 0xe4, 0xe3, 0xe3, 0xe3, 0xe3, 0xe2, + 0xe2, 0xe2, 0xe2, 0xe1, 0xe1, 0xe1, 0xe1, 0xe0, 0xe0, 0xe0, 0xe0, 0xdf, + 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0xdf, 0xde, 0xde, 0xde, 0xde, 0xde, + 0xde, 0xde, 0xde, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdc, + 0xdc, 0xdc, 0xdc, 0xdc, 0xdc, 0xdc, 0xdc, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, + 0xdb, 0xdb, 0xdb, 0xda, 0xda, 0xda, 0xda, 0xda, 0xda, 0xda, 0xda, 0xd9, + 0xd9, 0xd9, 0xd9, 0xd9, 0xd9, 0xd9, 0xd9, 0xd8, 0xd8, 0xd8, 0xd8, 0xd8, + 0xd8, 0xd8, 0xd8, 0xd7, 0xd7, 0xd7, 0xd7, 0xd7, 0xd7, 0xd7, 0xd7, 0xd6, + 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0xd5, 0xd5, 0xd5, 0xd5, 0xd5, + 0xd5, 0xd5, 0xd5, 0xd4, 0xd4, 0xd4, 0xd4, 0xd4, 0xd4, 0xd4, 0xd4, 0xd3, + 0xd3, 0xd3, 0xd3, 0xd3, 0xd3, 0xd3, 0xd3, 0xd2, 0xd2, 0xd2, 0xd2, 0xd2, + 0xd2, 0xd2, 0xd2, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd0, + 0xd0, 0xd0, 0xd0, 0xd0, 0xd0, 0xd0, 0xd0, 0xcf, 0xcf, 0xcf, 0xcf, 0xcf, + 0xcf, 0xcf, 0xcf, 0xcf, 0xcf, 0xcf, 0xcf, 0xcf, 0xcf, 0xcf, 0xcf, 0xce, + 0xce, 0xce, 0xce, 0xce, 0xce, 0xce, 0xce, 0xce, 0xce, 0xce, 0xce, 0xce, + 0xce, 0xce, 0xce, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, + 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, + 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcb, + 0xcb, 0xcb, 0xcb, 0xcb, 0xcb, 0xcb, 0xcb, 0xcb, 0xcb, 0xcb, 0xcb, 0xcb, + 0xcb, 0xcb, 0xcb, 0xca, 0xca, 0xca, 0xca, 0xca, 0xca, 0xca, 0xca, 0xca, + 0xca, 0xca, 0xca, 0xca, 0xca, 0xca, 0xca, 0xc9, 0xc9, 0xc9, 0xc9, 0xc9, + 0xc9, 0xc9, 0xc9, 0xc9, 0xc9, 0xc9, 0xc9, 0xc9, 0xc9, 0xc9, 0xc9, 0xc8, + 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, 0xc8, + 0xc8, 0xc8, 0xc8, 0xc7, 0xc7, 0xc7, 0xc7, 0xc7, 0xc7, 0xc7, 0xc7, 0xc7, + 0xc7, 0xc7, 0xc7, 0xc7, 0xc7, 0xc7, 0xc7, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, + 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc5, + 0xc5, 0xc5, 0xc5, 0xc5, 0xc5, 0xc5, 0xc5, 0xc5, 0xc5, 0xc5, 0xc5, 0xc5, + 0xc5, 0xc5, 0xc5, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, + 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc4, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, + 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc2, + 0xc2, 0xc2, 0xc2, 0xc2, 0xc2, 0xc2, 0xc2, 0xc2, 0xc2, 0xc2, 0xc2, 0xc2, + 0xc2, 0xc2, 0xc2, 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, + 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, + 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xbf, + 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, + 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, + 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, + 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, + 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, 0xbe, + 0xbe, 0xbe, 0xbe, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, + 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, + 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbd, 0xbc, + 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, + 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, + 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbc, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, + 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, + 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, 0xbb, + 0xbb, 0xbb, 0xbb, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, + 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, + 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xb9, + 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, + 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, + 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb9, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, + 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, + 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, 0xb8, + 0xb8, 0xb8, 0xb8, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, + 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, + 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb7, 0xb6, + 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, + 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, + 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb6, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, + 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, + 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, + 0xb5, 0xb5, 0xb5, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, + 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, + 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb3, + 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, + 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, + 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb3, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, + 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, + 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, 0xb2, + 0xb2, 0xb2, 0xb2, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, + 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, + 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb1, 0xb0, + 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, + 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, + 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, + 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, + 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, + 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, + 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, + 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xae, + 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, + 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, + 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, + 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, + 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, 0xae, + 0xae, 0xae, 0xae, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, + 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, + 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, + 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, + 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, + 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xad, 0xac, 0xac, 0xac, 0xac, 0xac, + 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, + 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, + 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, + 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, + 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xab, + 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, + 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, + 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, + 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, + 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, + 0xab, 0xab, 0xab, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, + 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, + 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, + 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, + 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, + 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa9, 0xa8, + 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, + 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, + 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, + 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, + 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, 0xa8, + 0xa8, 0xa8, 0xa8, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, + 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, + 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, + 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, + 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, + 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa7, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, + 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, + 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, + 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, + 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, + 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa6, 0xa5, + 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, + 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, + 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, + 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, + 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, + 0xa5, 0xa5, 0xa5, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, + 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, + 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, + 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, + 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, + 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, + 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, + 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, + 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, + 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, + 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa3, 0xa2, + 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, + 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, + 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, + 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, + 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, + 0xa2, 0xa2, 0xa2, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, + 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, + 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, + 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, + 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, + 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa1, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, + 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, + 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, + 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, + 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, + 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0x9f, + 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, + 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, + 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, + 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, + 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, + 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, + 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, + 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, + 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, + 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, + 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, + 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, + 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, + 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, + 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, + 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, + 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, + 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, + 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, + 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, + 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, + 0x9e, 0x9e, 0x9e, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, + 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, + 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, + 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, + 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, + 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, + 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, + 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, + 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, + 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, + 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9d, 0x9c, + 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, + 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, + 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, + 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, + 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, + 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, + 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, + 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, + 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, + 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, + 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9c, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, + 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, + 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, + 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, + 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, + 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, + 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, + 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, + 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, + 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, + 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, 0x9b, + 0x9b, 0x9b, 0x9b, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, + 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, + 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, + 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, + 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, + 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, + 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, + 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, + 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, + 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, + 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x9a, 0x99, + 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, + 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, + 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, + 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, + 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, + 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, + 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, + 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, + 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, + 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, + 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x98, 0x98, 0x98, 0x98, 0x98, + 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, + 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, + 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, + 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, + 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, + 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, + 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, + 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, + 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, + 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, + 0x98, 0x98, 0x98, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, + 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, + 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, + 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, + 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, + 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, + 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, + 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, + 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, + 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, + 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x96, + 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, + 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, + 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, + 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, + 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, + 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, + 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, + 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, + 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, + 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, + 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x95, 0x95, 0x95, 0x95, 0x95, + 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, + 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, + 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, + 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, + 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, + 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, + 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, + 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, + 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, + 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, + 0x95, 0x95, 0x95, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, + 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, + 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, + 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, + 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, + 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, + 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, + 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, + 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, + 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, + 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x93, + 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, + 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, + 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, + 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, + 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, + 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, + 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, + 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, + 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, + 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, + 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x92, 0x92, 0x92, 0x92, 0x92, + 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, + 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, + 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, + 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, + 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, + 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, + 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, + 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, + 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, + 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, + 0x92, 0x92, 0x92, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, + 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, + 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, + 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, + 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, + 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, + 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, + 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, + 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, + 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, + 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x90, + 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, + 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, + 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, + 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, + 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, + 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, + 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, + 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, + 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, + 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, + 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, + 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, + 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, + 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, + 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, + 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, + 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, + 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, + 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, + 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, + 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, + 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, + 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, + 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, + 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, + 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, + 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, + 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, + 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, + 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, + 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, + 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8e, + 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, + 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, + 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, + 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, + 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, + 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, + 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, + 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, + 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, + 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, + 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, + 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, + 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, + 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, + 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, + 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, + 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, + 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, + 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, + 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, + 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, 0x8e, + 0x8e, 0x8e, 0x8e, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, + 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, + 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, + 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, + 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, + 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, + 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, + 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, + 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, + 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, + 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, + 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, + 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, + 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, + 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, + 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, + 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, + 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, + 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, + 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, + 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, + 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, + 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, + 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, + 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, + 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, + 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, + 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, + 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, + 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, + 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, + 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, + 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, + 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, + 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, + 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, + 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, + 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, + 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, + 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, + 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, + 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, + 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8b, + 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, + 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, + 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, + 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, + 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, + 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, + 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, + 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, + 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, + 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, + 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, + 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, + 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, + 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, + 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, + 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, + 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, + 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, + 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, + 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, + 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, 0x8b, + 0x8b, 0x8b, 0x8b, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, + 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, + 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, + 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, + 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, + 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, + 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, + 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, + 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, + 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, + 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, + 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, + 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, + 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, + 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, + 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, + 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, + 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, + 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, + 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, + 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, + 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x89, 0x89, 0x89, 0x89, 0x89, + 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, + 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, + 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, + 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, + 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, + 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, + 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, + 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, + 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, + 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, + 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, + 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, + 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, + 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, + 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, + 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, + 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, + 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, + 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, + 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, + 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x88, + 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, + 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, + 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, + 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, + 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, + 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, + 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, + 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, + 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, + 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, + 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, + 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, + 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, + 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, + 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, + 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, + 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, + 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, + 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, + 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, + 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, + 0x88, 0x88, 0x88, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, + 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, + 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, + 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, + 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, + 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, + 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, + 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, + 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, + 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, + 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, + 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, + 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, + 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, + 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, + 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, + 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, + 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, + 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, + 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, + 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, + 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x86, 0x86, 0x86, 0x86, 0x86, + 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, + 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, + 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, + 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, + 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, + 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, + 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, + 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, + 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, + 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, + 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, + 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, + 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, + 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, + 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, + 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, + 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, + 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, + 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, + 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, + 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x85, + 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, + 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, + 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, + 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, + 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, + 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, + 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, + 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, + 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, + 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, + 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, + 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, + 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, + 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, + 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, + 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, + 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, + 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, + 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, + 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, + 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, + 0x85, 0x85, 0x85, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, + 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, + 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, + 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, + 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, + 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, + 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, + 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, + 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, + 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, + 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, + 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, + 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, + 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, + 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, + 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, + 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, + 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, + 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, + 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, + 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, + 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x83, 0x83, 0x83, 0x83, 0x83, + 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, + 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, + 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, + 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, + 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, + 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, + 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, + 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, + 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, + 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, + 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, + 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, + 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, + 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, + 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, + 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, + 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, + 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, + 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, + 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, + 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x82, + 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, + 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, + 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, + 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, + 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, + 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, + 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, + 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, + 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, + 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, + 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, + 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, + 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, + 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, + 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, + 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, + 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, + 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, + 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, + 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, + 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, + 0x82, 0x82, 0x82, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, + 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, + 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, + 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, + 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, + 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, + 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, + 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, + 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, + 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, + 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, + 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, + 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, + 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, + 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, + 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, + 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, + 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, + 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, + 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, + 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, + 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x80, 0x80, 0x80, 0x80, 0x80, + 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, + 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, + 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, + 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, + 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, + 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, + 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, + 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, + 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, + 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, + 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, + 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, + 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, + 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, + 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, + 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, + 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, + 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, + 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, + 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, + 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, + 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, + 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, + 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00 +} ; + +static inline void +ulaw2s_array (unsigned char *buffer, int count, short *ptr) +{ while (--count >= 0) + ptr [count] = ulaw_decode [(int) buffer [count]] ; +} /* ulaw2s_array */ + +static inline void +ulaw2i_array (unsigned char *buffer, int count, int *ptr) +{ while (--count >= 0) + ptr [count] = ulaw_decode [buffer [count]] << 16 ; +} /* ulaw2i_array */ + +static inline void +ulaw2f_array (unsigned char *buffer, int count, float *ptr, float normfact) +{ while (--count >= 0) + ptr [count] = normfact * ulaw_decode [(int) buffer [count]] ; +} /* ulaw2f_array */ + +static inline void +ulaw2d_array (unsigned char *buffer, int count, double *ptr, double normfact) +{ while (--count >= 0) + ptr [count] = normfact * ulaw_decode [(int) buffer [count]] ; +} /* ulaw2d_array */ + +static inline void +s2ulaw_array (short *ptr, int count, unsigned char *buffer) +{ while (--count >= 0) + { if (ptr [count] >= 0) + buffer [count] = ulaw_encode [ptr [count] / 4] ; + else + buffer [count] = 0x7F & ulaw_encode [ptr [count] / -4] ; + } ; +} /* s2ulaw_array */ + +static inline void +i2ulaw_array (int *ptr, int count, unsigned char *buffer) +{ while (--count >= 0) + { if (ptr [count] >= 0) + buffer [count] = ulaw_encode [ptr [count] >> (16 + 2)] ; + else + buffer [count] = 0x7F & ulaw_encode [-ptr [count] >> (16 + 2)] ; + } ; +} /* i2ulaw_array */ + +static inline void +f2ulaw_array (float *ptr, int count, unsigned char *buffer, float normfact) +{ while (--count >= 0) + { if (ptr [count] >= 0) + buffer [count] = ulaw_encode [lrintf (normfact * ptr [count])] ; + else + buffer [count] = 0x7F & ulaw_encode [- lrintf (normfact * ptr [count])] ; + } ; +} /* f2ulaw_array */ + +static inline void +d2ulaw_array (double *ptr, int count, unsigned char *buffer, double normfact) +{ while (--count >= 0) + { if (ptr [count] >= 0) + buffer [count] = ulaw_encode [lrint (normfact * ptr [count])] ; + else + buffer [count] = 0x7F & ulaw_encode [- lrint (normfact * ptr [count])] ; + } ; +} /* d2ulaw_array */ + +/*============================================================================== +*/ + +static sf_count_t +ulaw_read_ulaw2s (SF_PRIVATE *psf, short *ptr, sf_count_t len) +{ int bufferlen, readcount ; + sf_count_t total = 0 ; + + bufferlen = ARRAY_LEN (psf->u.ucbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + readcount = psf_fread (psf->u.ucbuf, 1, bufferlen, psf) ; + ulaw2s_array (psf->u.ucbuf, readcount, ptr + total) ; + total += readcount ; + if (readcount < bufferlen) + break ; + len -= readcount ; + } ; + + return total ; +} /* ulaw_read_ulaw2s */ + +static sf_count_t +ulaw_read_ulaw2i (SF_PRIVATE *psf, int *ptr, sf_count_t len) +{ int bufferlen, readcount ; + sf_count_t total = 0 ; + + bufferlen = ARRAY_LEN (psf->u.ucbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + readcount = psf_fread (psf->u.ucbuf, 1, bufferlen, psf) ; + ulaw2i_array (psf->u.ucbuf, readcount, ptr + total) ; + total += readcount ; + if (readcount < bufferlen) + break ; + len -= readcount ; + } ; + + return total ; +} /* ulaw_read_ulaw2i */ + +static sf_count_t +ulaw_read_ulaw2f (SF_PRIVATE *psf, float *ptr, sf_count_t len) +{ int bufferlen, readcount ; + sf_count_t total = 0 ; + float normfact ; + + normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x8000) : 1.0 ; + + bufferlen = ARRAY_LEN (psf->u.ucbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + readcount = psf_fread (psf->u.ucbuf, 1, bufferlen, psf) ; + ulaw2f_array (psf->u.ucbuf, readcount, ptr + total, normfact) ; + total += readcount ; + if (readcount < bufferlen) + break ; + len -= readcount ; + } ; + + return total ; +} /* ulaw_read_ulaw2f */ + +static sf_count_t +ulaw_read_ulaw2d (SF_PRIVATE *psf, double *ptr, sf_count_t len) +{ int bufferlen, readcount ; + sf_count_t total = 0 ; + double normfact ; + + normfact = (psf->norm_double) ? 1.0 / ((double) 0x8000) : 1.0 ; + bufferlen = ARRAY_LEN (psf->u.ucbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + readcount = psf_fread (psf->u.ucbuf, 1, bufferlen, psf) ; + ulaw2d_array (psf->u.ucbuf, readcount, ptr + total, normfact) ; + total += readcount ; + if (readcount < bufferlen) + break ; + len -= readcount ; + } ; + + return total ; +} /* ulaw_read_ulaw2d */ + +/*============================================================================================= +*/ + +static sf_count_t +ulaw_write_s2ulaw (SF_PRIVATE *psf, short *ptr, sf_count_t len) +{ int bufferlen, writecount ; + sf_count_t total = 0 ; + + bufferlen = ARRAY_LEN (psf->u.ucbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + s2ulaw_array (ptr + total, bufferlen, psf->u.ucbuf) ; + writecount = psf_fwrite (psf->u.ucbuf, 1, bufferlen, psf) ; + total += writecount ; + if (writecount < bufferlen) + break ; + len -= writecount ; + } ; + + return total ; +} /* ulaw_write_s2ulaw */ + +static sf_count_t +ulaw_write_i2ulaw (SF_PRIVATE *psf, int *ptr, sf_count_t len) +{ int bufferlen, writecount ; + sf_count_t total = 0 ; + + bufferlen = ARRAY_LEN (psf->u.ucbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + i2ulaw_array (ptr + total, bufferlen, psf->u.ucbuf) ; + writecount = psf_fwrite (psf->u.ucbuf, 1, bufferlen, psf) ; + total += writecount ; + if (writecount < bufferlen) + break ; + len -= writecount ; + } ; + + return total ; +} /* ulaw_write_i2ulaw */ + +static sf_count_t +ulaw_write_f2ulaw (SF_PRIVATE *psf, float *ptr, sf_count_t len) +{ int bufferlen, writecount ; + sf_count_t total = 0 ; + float normfact ; + + /* Factor in a divide by 4. */ + normfact = (psf->norm_float == SF_TRUE) ? (0.25 * 0x7FFF) : 0.25 ; + + bufferlen = ARRAY_LEN (psf->u.ucbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + f2ulaw_array (ptr + total, bufferlen, psf->u.ucbuf, normfact) ; + writecount = psf_fwrite (psf->u.ucbuf, 1, bufferlen, psf) ; + total += writecount ; + if (writecount < bufferlen) + break ; + len -= writecount ; + } ; + + return total ; +} /* ulaw_write_f2ulaw */ + +static sf_count_t +ulaw_write_d2ulaw (SF_PRIVATE *psf, double *ptr, sf_count_t len) +{ int bufferlen, writecount ; + sf_count_t total = 0 ; + double normfact ; + + /* Factor in a divide by 4. */ + normfact = (psf->norm_double) ? (0.25 * 0x7FFF) : 0.25 ; + + bufferlen = ARRAY_LEN (psf->u.ucbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + d2ulaw_array (ptr + total, bufferlen, psf->u.ucbuf, normfact) ; + writecount = psf_fwrite (psf->u.ucbuf, 1, bufferlen, psf) ; + total += writecount ; + if (writecount < bufferlen) + break ; + len -= writecount ; + } ; + + return total ; +} /* ulaw_write_d2ulaw */ + +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: 655cc790-f058-45e8-89c9-86967cccc37e +*/ diff --git a/Libraries/SndFile/Files/src/voc.c b/Libraries/SndFile/Files/src/voc.c new file mode 100644 index 000000000..9697e2e8d --- /dev/null +++ b/Libraries/SndFile/Files/src/voc.c @@ -0,0 +1,878 @@ +/* +** Copyright (C) 2001-2004 Erik de Castro Lopo +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU Lesser General Public License as published by +** the Free Software Foundation; either version 2.1 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU Lesser General Public License for more details. +** +** You should have received a copy of the GNU Lesser General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +/* RANT: +** The VOC file format is the most brain damaged format I have yet had to deal +** with. No one programmer could have bee stupid enough to put this together. +** Instead it looks like a series of manic, dyslexic assembly language programmers +** hacked it to fit their needs. +** Utterly woeful. +*/ + +#include "config.h" + +#include +#include +#include + +#include "sndfile.h" +#include "sfendian.h" +#include "common.h" + + +/*------------------------------------------------------------------------------ + * Typedefs for file chunks. +*/ + +#define VOC_MAX_SECTIONS 200 + +enum +{ VOC_TERMINATOR = 0, + VOC_SOUND_DATA = 1, + VOC_SOUND_CONTINUE = 2, + VOC_SILENCE = 3, + VOC_MARKER = 4, + VOC_ASCII = 5, + VOC_REPEAT = 6, + VOC_END_REPEAT = 7, + VOC_EXTENDED = 8, + VOC_EXTENDED_II = 9 +} ; + +typedef struct +{ int samples ; + int offset ; /* Offset of zero => silence. */ +} SND_DATA_BLOCKS ; + +typedef struct +{ unsigned int sections, section_types ; + int samplerate, channels, bitwidth ; + SND_DATA_BLOCKS blocks [VOC_MAX_SECTIONS] ; +} VOC_DATA ; + +/*------------------------------------------------------------------------------ + * Private static functions. +*/ + +static int voc_close (SF_PRIVATE *psf) ; +static int voc_write_header (SF_PRIVATE *psf, int calc_length) ; +static int voc_read_header (SF_PRIVATE *psf) ; + +static const char* voc_encoding2str (int encoding) ; + +#if 0 + +/* These functions would be required for files with more than one VOC_SOUND_DATA +** segment. Not sure whether to bother implementing this. +*/ + +static int voc_multi_init (SF_PRIVATE *psf, VOC_DATA *pvoc) ; + +static int voc_multi_read_uc2s (SF_PRIVATE *psf, short *ptr, int len) ; +static int voc_multi_read_les2s (SF_PRIVATE *psf, short *ptr, int len) ; + +static int voc_multi_read_uc2i (SF_PRIVATE *psf, int *ptr, int len) ; +static int voc_multi_read_les2i (SF_PRIVATE *psf, int *ptr, int len) ; + +static int voc_multi_read_uc2f (SF_PRIVATE *psf, float *ptr, int len) ; +static int voc_multi_read_les2f (SF_PRIVATE *psf, float *ptr, int len) ; + +static int voc_multi_read_uc2d (SF_PRIVATE *psf, double *ptr, int len) ; +static int voc_multi_read_les2d (SF_PRIVATE *psf, double *ptr, int len) ; +#endif + +/*------------------------------------------------------------------------------ +** Public function. +*/ + +int +voc_open (SF_PRIVATE *psf) +{ int subformat, error = 0 ; + + if (psf->is_pipe) + return SFE_VOC_NO_PIPE ; + + if (psf->mode == SFM_READ || (psf->mode == SFM_RDWR && psf->filelength > 0)) + { if ((error = voc_read_header (psf))) + return error ; + } ; + + subformat = psf->sf.format & SF_FORMAT_SUBMASK ; + + if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR) + { if ((psf->sf.format & SF_FORMAT_TYPEMASK) != SF_FORMAT_VOC) + return SFE_BAD_OPEN_FORMAT ; + + psf->endian = SF_ENDIAN_LITTLE ; + + if ((error = voc_write_header (psf, SF_FALSE))) + return error ; + + psf->write_header = voc_write_header ; + } ; + + psf->blockwidth = psf->bytewidth * psf->sf.channels ; + + psf->close = voc_close ; + + switch (subformat) + { case SF_FORMAT_PCM_U8 : + case SF_FORMAT_PCM_16 : + error = pcm_init (psf) ; + break ; + + case SF_FORMAT_ALAW : + error = alaw_init (psf) ; + break ; + + case SF_FORMAT_ULAW : + error = ulaw_init (psf) ; + break ; + + default : return SFE_UNIMPLEMENTED ; + } ; + + return error ; +} /* voc_open */ + +/*------------------------------------------------------------------------------ +*/ + +static int +voc_read_header (SF_PRIVATE *psf) +{ VOC_DATA *pvoc ; + char creative [20] ; + unsigned char block_type, rate_byte ; + short version, checksum, encoding, dataoffset ; + int offset ; + + /* Set position to start of file to begin reading header. */ + offset = psf_binheader_readf (psf, "pb", 0, creative, SIGNED_SIZEOF (creative)) ; + + if (creative [sizeof (creative) - 1] != 0x1A) + return SFE_VOC_NO_CREATIVE ; + + /* Terminate the string. */ + creative [sizeof (creative) - 1] = 0 ; + + if (strcmp ("Creative Voice File", creative)) + return SFE_VOC_NO_CREATIVE ; + + psf_log_printf (psf, "%s\n", creative) ; + + offset += psf_binheader_readf (psf, "e222", &dataoffset, &version, &checksum) ; + + psf->dataoffset = dataoffset ; + + psf_log_printf (psf, "dataoffset : %d\n" + "version : 0x%X\n" + "checksum : 0x%X\n", psf->dataoffset, version, checksum) ; + + if (version != 0x010A && version != 0x0114) + return SFE_VOC_BAD_VERSION ; + + if (! (psf->fdata = malloc (sizeof (VOC_DATA)))) + return SFE_MALLOC_FAILED ; + + pvoc = (VOC_DATA*) psf->fdata ; + + memset (pvoc, 0, sizeof (VOC_DATA)) ; + + /* Set the default encoding now. */ + psf->sf.format = SF_FORMAT_VOC ; /* Major format */ + encoding = SF_FORMAT_PCM_U8 ; /* Minor format */ + psf->endian = SF_ENDIAN_LITTLE ; + + while (1) + { offset += psf_binheader_readf (psf, "1", &block_type) ; + + switch (block_type) + { case VOC_ASCII : + { int size ; + + offset += psf_binheader_readf (psf, "e3", &size) ; + + psf_log_printf (psf, " ASCII : %d\n", size) ; + + offset += psf_binheader_readf (psf, "b", psf->header, size) ; + psf->header [size] = 0 ; + psf_log_printf (psf, " text : %s\n", psf->header) ; + } ; + continue ; + + case VOC_SOUND_DATA : + case VOC_EXTENDED : + case VOC_EXTENDED_II : + break ; + + default : psf_log_printf (psf, "*** Weird block marker (%d)\n", block_type) ; + } ; + + break ; + } ; + + if (block_type == VOC_SOUND_DATA) + { unsigned char compression ; + int size ; + + offset += psf_binheader_readf (psf, "e311", &size, &rate_byte, &compression) ; + + psf->sf.samplerate = 1000000 / (256 - (rate_byte & 0xFF)) ; + + psf_log_printf (psf, " Sound Data : %d\n sr : %d => %dHz\n comp : %d\n", + size, rate_byte, psf->sf.samplerate, compression) ; + + if (offset + size - 1 > psf->filelength) + { psf_log_printf (psf, "Seems to be a truncated file.\n") ; + psf_log_printf (psf, "offset: %d size: %d sum: %d filelength: %D\n", offset, size, offset + size, psf->filelength) ; + return SFE_VOC_BAD_SECTIONS ; + } + else if (offset + size - 1 < psf->filelength) + { psf_log_printf (psf, "Seems to be a multi-segment file (#1).\n") ; + psf_log_printf (psf, "offset: %d size: %d sum: %d filelength: %D\n", offset, size, offset + size, psf->filelength) ; + return SFE_VOC_BAD_SECTIONS ; + } ; + + psf->dataoffset = offset ; + psf->dataend = psf->filelength - 1 ; + + psf->sf.channels = 1 ; + psf->bytewidth = 1 ; + + psf->sf.format = SF_FORMAT_VOC | SF_FORMAT_PCM_U8 ; + + return 0 ; + } ; + + if (block_type == VOC_EXTENDED) + { unsigned char pack, stereo, compression ; + unsigned short rate_short ; + int size ; + + offset += psf_binheader_readf (psf, "e3211", &size, &rate_short, &pack, &stereo) ; + + psf_log_printf (psf, " Extended : %d\n", size) ; + if (size == 4) + psf_log_printf (psf, " size : 4\n") ; + else + psf_log_printf (psf, " size : %d (should be 4)\n", size) ; + + psf_log_printf (psf, " pack : %d\n" + " stereo : %s\n", pack, (stereo ? "yes" : "no")) ; + + if (stereo) + { psf->sf.channels = 2 ; + psf->sf.samplerate = 128000000 / (65536 - rate_short) ; + } + else + { psf->sf.channels = 1 ; + psf->sf.samplerate = 256000000 / (65536 - rate_short) ; + } ; + + psf_log_printf (psf, " sr : %d => %dHz\n", (rate_short & 0xFFFF), psf->sf.samplerate) ; + + offset += psf_binheader_readf (psf, "1", &block_type) ; + + if (block_type != VOC_SOUND_DATA) + { psf_log_printf (psf, "*** Expecting VOC_SOUND_DATA section.\n") ; + return SFE_VOC_BAD_FORMAT ; + } ; + + offset += psf_binheader_readf (psf, "e311", &size, &rate_byte, &compression) ; + + psf_log_printf (psf, " Sound Data : %d\n" + " sr : %d\n" + " comp : %d\n", size, rate_byte, compression) ; + + + if (offset + size - 1 > psf->filelength) + { psf_log_printf (psf, "Seems to be a truncated file.\n") ; + psf_log_printf (psf, "offset: %d size: %d sum: %d filelength: %D\n", offset, size, offset + size, psf->filelength) ; + return SFE_VOC_BAD_SECTIONS ; + } + else if (offset + size - 1 < psf->filelength) + { psf_log_printf (psf, "Seems to be a multi-segment file (#2).\n") ; + psf_log_printf (psf, "offset: %d size: %d sum: %d filelength: %D\n", offset, size, offset + size, psf->filelength) ; + return SFE_VOC_BAD_SECTIONS ; + } ; + + psf->dataoffset = offset ; + psf->dataend = psf->filelength - 1 ; + + psf->bytewidth = 1 ; + + psf->sf.format = SF_FORMAT_VOC | SF_FORMAT_PCM_U8 ; + + return 0 ; + } + + if (block_type == VOC_EXTENDED_II) + { unsigned char bitwidth, channels ; + int size, fourbytes ; + + offset += psf_binheader_readf (psf, "e341124", &size, &psf->sf.samplerate, + &bitwidth, &channels, &encoding, &fourbytes) ; + + if (size * 2 == psf->filelength - 39) + { int temp_size = psf->filelength - 31 ; + + psf_log_printf (psf, " Extended II : %d (SoX bug: should be %d)\n", size, temp_size) ; + size = temp_size ; + } + else + psf_log_printf (psf, " Extended II : %d\n", size) ; + + psf_log_printf (psf, " sample rate : %d\n" + " bit width : %d\n" + " channels : %d\n", psf->sf.samplerate, bitwidth, channels) ; + + if (bitwidth == 16 && encoding == 0) + { encoding = 4 ; + psf_log_printf (psf, " encoding : 0 (SoX bug: should be 4 for 16 bit signed PCM)\n") ; + } + else + psf_log_printf (psf, " encoding : %d => %s\n", encoding, voc_encoding2str (encoding)) ; + + + psf_log_printf (psf, " fourbytes : %X\n", fourbytes) ; + + psf->sf.channels = channels ; + + psf->dataoffset = offset ; + psf->dataend = psf->filelength - 1 ; + + if (size + 31 == psf->filelength + 1) + { /* Hack for reading files produced using + ** sf_command (SFC_UPDATE_HEADER_NOW). + */ + psf_log_printf (psf, "Missing zero byte at end of file.\n") ; + size = psf->filelength - 30 ; + psf->dataend = 0 ; + } + else if (size + 31 > psf->filelength) + { psf_log_printf (psf, "Seems to be a truncated file.\n") ; + size = psf->filelength - 31 ; + } + else if (size + 31 < psf->filelength) + psf_log_printf (psf, "Seems to be a multi-segment file (#3).\n") ; + + switch (encoding) + { case 0 : + psf->sf.format = SF_FORMAT_VOC | SF_FORMAT_PCM_U8 ; + psf->bytewidth = 1 ; + break ; + + case 4 : + psf->sf.format = SF_FORMAT_VOC | SF_FORMAT_PCM_16 ; + psf->bytewidth = 2 ; + break ; + + case 6 : + psf->sf.format = SF_FORMAT_VOC | SF_FORMAT_ALAW ; + psf->bytewidth = 1 ; + break ; + + case 7 : + psf->sf.format = SF_FORMAT_VOC | SF_FORMAT_ULAW ; + psf->bytewidth = 1 ; + break ; + + default : /* Unknown */ + return SFE_UNKNOWN_FORMAT ; + break ; + } ; + + } ; + + return 0 ; +} /* voc_read_header */ + +/*==================================================================================== +*/ + +static int +voc_write_header (SF_PRIVATE *psf, int calc_length) +{ sf_count_t current ; + int rate_const, subformat ; + + current = psf_ftell (psf) ; + + if (calc_length) + { psf->filelength = psf_get_filelen (psf) ; + + psf->datalength = psf->filelength - psf->dataoffset ; + if (psf->dataend) + psf->datalength -= psf->filelength - psf->dataend ; + + psf->sf.frames = psf->datalength / (psf->bytewidth * psf->sf.channels) ; + } ; + + subformat = psf->sf.format & SF_FORMAT_SUBMASK ; + /* Reset the current header length to zero. */ + psf->header [0] = 0 ; + psf->headindex = 0 ; + psf_fseek (psf, 0, SEEK_SET) ; + + /* VOC marker and 0x1A byte. */ + psf_binheader_writef (psf, "eb1", "Creative Voice File", 19, 0x1A) ; + + /* Data offset, version and other. */ + psf_binheader_writef (psf, "e222", 26, 0x0114, 0x111F) ; + + /* Use same logic as SOX. + ** If the file is mono 8 bit data, use VOC_SOUND_DATA. + ** If the file is mono 16 bit data, use VOC_EXTENED. + ** Otherwise use VOC_EXTENED_2. + */ + + if (subformat == SF_FORMAT_PCM_U8 && psf->sf.channels == 1) + { /* samplerate = 1000000 / (256 - rate_const) ; */ + rate_const = 256 - 1000000 / psf->sf.samplerate ; + + /* First type marker, length, rate_const and compression */ + psf_binheader_writef (psf, "e1311", VOC_SOUND_DATA, (int) (psf->datalength + 1), rate_const, 0) ; + } + else if (subformat == SF_FORMAT_PCM_U8 && psf->sf.channels == 2) + { /* sample_rate = 128000000 / (65536 - rate_short) ; */ + rate_const = 65536 - 128000000 / psf->sf.samplerate ; + + /* First write the VOC_EXTENDED section + ** marker, length, rate_const and compression + */ + psf_binheader_writef (psf, "e13211", VOC_EXTENDED, 4, rate_const, 0, 1) ; + + /* samplerate = 1000000 / (256 - rate_const) ; */ + rate_const = 256 - 1000000 / psf->sf.samplerate ; + + /* Now write the VOC_SOUND_DATA section + ** marker, length, rate_const and compression + */ + psf_binheader_writef (psf, "e1311", VOC_SOUND_DATA, (int) (psf->datalength + 1), rate_const, 0) ; + } + else + { int length ; + + if (psf->sf.channels < 1 || psf->sf.channels > 2) + return SFE_CHANNEL_COUNT ; + + switch (subformat) + { case SF_FORMAT_PCM_U8 : + psf->bytewidth = 1 ; + length = psf->sf.frames * psf->sf.channels * psf->bytewidth + 12 ; + /* Marker, length, sample rate, bitwidth, stereo flag, encoding and fourt zero bytes. */ + psf_binheader_writef (psf, "e1341124", VOC_EXTENDED_II, length, psf->sf.samplerate, 16, psf->sf.channels, 4, 0) ; + break ; + + case SF_FORMAT_PCM_16 : + psf->bytewidth = 2 ; + length = psf->sf.frames * psf->sf.channels * psf->bytewidth + 12 ; + /* Marker, length, sample rate, bitwidth, stereo flag, encoding and fourt zero bytes. */ + psf_binheader_writef (psf, "e1341124", VOC_EXTENDED_II, length, psf->sf.samplerate, 16, psf->sf.channels, 4, 0) ; + break ; + + case SF_FORMAT_ALAW : + psf->bytewidth = 1 ; + length = psf->sf.frames * psf->sf.channels * psf->bytewidth + 12 ; + psf_binheader_writef (psf, "e1341124", VOC_EXTENDED_II, length, psf->sf.samplerate, 8, psf->sf.channels, 6, 0) ; + break ; + + case SF_FORMAT_ULAW : + psf->bytewidth = 1 ; + length = psf->sf.frames * psf->sf.channels * psf->bytewidth + 12 ; + psf_binheader_writef (psf, "e1341124", VOC_EXTENDED_II, length, psf->sf.samplerate, 8, psf->sf.channels, 7, 0) ; + break ; + + default : return SFE_UNIMPLEMENTED ; + } ; + } ; + + psf_fwrite (psf->header, psf->headindex, 1, psf) ; + + if (psf->error) + return psf->error ; + + psf->dataoffset = psf->headindex ; + + if (current > 0) + psf_fseek (psf, current, SEEK_SET) ; + + return psf->error ; +} /* voc_write_header */ + +static int +voc_close (SF_PRIVATE *psf) +{ + if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR) + { /* Now we know for certain the length of the file we can re-write + ** correct values for the FORM, 8SVX and BODY chunks. + */ + unsigned byte = VOC_TERMINATOR ; + + + psf_fseek (psf, 0, SEEK_END) ; + + /* Write terminator */ + psf_fwrite (&byte, 1, 1, psf) ; + + voc_write_header (psf, SF_TRUE) ; + } ; + + return 0 ; +} /* voc_close */ + +static const char* +voc_encoding2str (int encoding) +{ + switch (encoding) + { case 0 : return "8 bit unsigned PCM" ; + case 4 : return "16 bit signed PCM" ; + case 6 : return "A-law" ; + case 7 : return "u-law" ; + default : break ; + } + return "*** Unknown ***" ; +} /* voc_encoding2str */ + +/*==================================================================================== +*/ + +#if 0 +static int +voc_multi_init (SF_PRIVATE *psf, VOC_DATA *pvoc) +{ + psf->sf.frames = 0 ; + + if (pvoc->bitwidth == 8) + { psf->read_short = voc_multi_read_uc2s ; + psf->read_int = voc_multi_read_uc2i ; + psf->read_float = voc_multi_read_uc2f ; + psf->read_double = voc_multi_read_uc2d ; + return 0 ; + } ; + + if (pvoc->bitwidth == 16) + { psf->read_short = voc_multi_read_les2s ; + psf->read_int = voc_multi_read_les2i ; + psf->read_float = voc_multi_read_les2f ; + psf->read_double = voc_multi_read_les2d ; + return 0 ; + } ; + + psf_log_printf (psf, "Error : bitwith != 8 && bitwidth != 16.\n") ; + + return SFE_UNIMPLEMENTED ; +} /* voc_multi_read_int */ + +/*------------------------------------------------------------------------------------ +*/ + +static int +voc_multi_read_uc2s (SF_PRIVATE *psf, short *ptr, int len) +{ + + return 0 ; +} /* voc_multi_read_uc2s */ + +static int +voc_multi_read_les2s (SF_PRIVATE *psf, short *ptr, int len) +{ + + return 0 ; +} /* voc_multi_read_les2s */ + + +static int +voc_multi_read_uc2i (SF_PRIVATE *psf, int *ptr, int len) +{ + + return 0 ; +} /* voc_multi_read_uc2i */ + +static int +voc_multi_read_les2i (SF_PRIVATE *psf, int *ptr, int len) +{ + + return 0 ; +} /* voc_multi_read_les2i */ + + +static int +voc_multi_read_uc2f (SF_PRIVATE *psf, float *ptr, int len) +{ + + return 0 ; +} /* voc_multi_read_uc2f */ + +static int +voc_multi_read_les2f (SF_PRIVATE *psf, float *ptr, int len) +{ + + return 0 ; +} /* voc_multi_read_les2f */ + + +static int +voc_multi_read_uc2d (SF_PRIVATE *psf, double *ptr, int len) +{ + + return 0 ; +} /* voc_multi_read_uc2d */ + +static int +voc_multi_read_les2d (SF_PRIVATE *psf, double *ptr, int len) +{ + + return 0 ; +} /* voc_multi_read_les2d */ + +#endif + +/*------------------------------------------------------------------------------------ + +Creative Voice (VOC) file format +-------------------------------- + +~From: galt@dsd.es.com + +(byte numbers are hex!) + + HEADER (bytes 00-19) + Series of DATA BLOCKS (bytes 1A+) [Must end w/ Terminator Block] + +- --------------------------------------------------------------- + +HEADER: +======= + byte # Description + ------ ------------------------------------------ + 00-12 "Creative Voice File" + 13 1A (eof to abort printing of file) + 14-15 Offset of first datablock in .voc file (std 1A 00 + in Intel Notation) + 16-17 Version number (minor,major) (VOC-HDR puts 0A 01) + 18-19 1's Comp of Ver. # + 1234h (VOC-HDR puts 29 11) + +- --------------------------------------------------------------- + +DATA BLOCK: +=========== + + Data Block: TYPE(1-byte), SIZE(3-bytes), INFO(0+ bytes) + NOTE: Terminator Block is an exception -- it has only the TYPE byte. + + TYPE Description Size (3-byte int) Info + ---- ----------- ----------------- ----------------------- + 00 Terminator (NONE) (NONE) + 01 Sound data 2+length of data * + 02 Sound continue length of data Voice Data + 03 Silence 3 ** + 04 Marker 2 Marker# (2 bytes) + 05 ASCII length of string null terminated string + 06 Repeat 2 Count# (2 bytes) + 07 End repeat 0 (NONE) + 08 Extended 4 *** + + *Sound Info Format: + --------------------- + 00 Sample Rate + 01 Compression Type + 02+ Voice Data + + **Silence Info Format: + ---------------------------- + 00-01 Length of silence - 1 + 02 Sample Rate + + + ***Extended Info Format: + --------------------- + 00-01 Time Constant: Mono: 65536 - (256000000/sample_rate) + Stereo: 65536 - (25600000/(2*sample_rate)) + 02 Pack + 03 Mode: 0 = mono + 1 = stereo + + + Marker# -- Driver keeps the most recent marker in a status byte + Count# -- Number of repetitions + 1 + Count# may be 1 to FFFE for 0 - FFFD repetitions + or FFFF for endless repetitions + Sample Rate -- SR byte = 256-(1000000/sample_rate) + Length of silence -- in units of sampling cycle + Compression Type -- of voice data + 8-bits = 0 + 4-bits = 1 + 2.6-bits = 2 + 2-bits = 3 + Multi DAC = 3+(# of channels) [interesting-- + this isn't in the developer's manual] + + +--------------------------------------------------------------------------------- +Addendum submitted by Votis Kokavessis: + +After some experimenting with .VOC files I found out that there is a Data Block +Type 9, which is not covered in the VOC.TXT file. Here is what I was able to discover +about this block type: + + +TYPE: 09 +SIZE: 12 + length of data +INFO: 12 (twelve) bytes + +INFO STRUCTURE: + +Bytes 0-1: (Word) Sample Rate (e.g. 44100) +Bytes 2-3: zero (could be that bytes 0-3 are a DWord for Sample Rate) +Byte 4: Sample Size in bits (e.g. 16) +Byte 5: Number of channels (e.g. 1 for mono, 2 for stereo) +Byte 6: Unknown (equal to 4 in all files I examined) +Bytes 7-11: zero + + +-------------------------------------------------------------------------------------*/ + +/*===================================================================================== +**===================================================================================== +**===================================================================================== +**===================================================================================== +*/ + +/*------------------------------------------------------------------------ +The following is taken from the Audio File Formats FAQ dated 2-Jan-1995 +and submitted by Guido van Rossum . +-------------------------------------------------------------------------- +Creative Voice (VOC) file format +-------------------------------- + +From: galt@dsd.es.com + +(byte numbers are hex!) + + HEADER (bytes 00-19) + Series of DATA BLOCKS (bytes 1A+) [Must end w/ Terminator Block] + +- --------------------------------------------------------------- + +HEADER: +------- + byte # Description + ------ ------------------------------------------ + 00-12 "Creative Voice File" + 13 1A (eof to abort printing of file) + 14-15 Offset of first datablock in .voc file (std 1A 00 + in Intel Notation) + 16-17 Version number (minor,major) (VOC-HDR puts 0A 01) + 18-19 2's Comp of Ver. # + 1234h (VOC-HDR puts 29 11) + +- --------------------------------------------------------------- + +DATA BLOCK: +----------- + + Data Block: TYPE(1-byte), SIZE(3-bytes), INFO(0+ bytes) + NOTE: Terminator Block is an exception -- it has only the TYPE byte. + + TYPE Description Size (3-byte int) Info + ---- ----------- ----------------- ----------------------- + 00 Terminator (NONE) (NONE) + 01 Sound data 2+length of data * + 02 Sound continue length of data Voice Data + 03 Silence 3 ** + 04 Marker 2 Marker# (2 bytes) + 05 ASCII length of string null terminated string + 06 Repeat 2 Count# (2 bytes) + 07 End repeat 0 (NONE) + 08 Extended 4 *** + + *Sound Info Format: **Silence Info Format: + --------------------- ---------------------------- + 00 Sample Rate 00-01 Length of silence - 1 + 01 Compression Type 02 Sample Rate + 02+ Voice Data + + ***Extended Info Format: + --------------------- + 00-01 Time Constant: Mono: 65536 - (256000000/sample_rate) + Stereo: 65536 - (25600000/(2*sample_rate)) + 02 Pack + 03 Mode: 0 = mono + 1 = stereo + + + Marker# -- Driver keeps the most recent marker in a status byte + Count# -- Number of repetitions + 1 + Count# may be 1 to FFFE for 0 - FFFD repetitions + or FFFF for endless repetitions + Sample Rate -- SR byte = 256-(1000000/sample_rate) + Length of silence -- in units of sampling cycle + Compression Type -- of voice data + 8-bits = 0 + 4-bits = 1 + 2.6-bits = 2 + 2-bits = 3 + Multi DAC = 3+(# of channels) [interesting-- + this isn't in the developer's manual] + +Detailed description of new data blocks (VOC files version 1.20 and above): + + (Source is fax from Barry Boone at Creative Labs, 405/742-6622) + +BLOCK 8 - digitized sound attribute extension, must preceed block 1. + Used to define stereo, 8 bit audio + BYTE bBlockID; // = 8 + BYTE nBlockLen[3]; // 3 byte length + WORD wTimeConstant; // time constant = same as block 1 + BYTE bPackMethod; // same as in block 1 + BYTE bVoiceMode; // 0-mono, 1-stereo + + Data is stored left, right + +BLOCK 9 - data block that supersedes blocks 1 and 8. + Used for stereo, 16 bit. + + BYTE bBlockID; // = 9 + BYTE nBlockLen[3]; // length 12 plus length of sound + DWORD dwSamplesPerSec; // samples per second, not time const. + BYTE bBitsPerSample; // e.g., 8 or 16 + BYTE bChannels; // 1 for mono, 2 for stereo + WORD wFormat; // see below + BYTE reserved[4]; // pad to make block w/o data + // have a size of 16 bytes + + Valid values of wFormat are: + + 0x0000 8-bit unsigned PCM + 0x0001 Creative 8-bit to 4-bit ADPCM + 0x0002 Creative 8-bit to 3-bit ADPCM + 0x0003 Creative 8-bit to 2-bit ADPCM + 0x0004 16-bit signed PCM + 0x0006 CCITT a-Law + 0x0007 CCITT u-Law + 0x02000 Creative 16-bit to 4-bit ADPCM + + Data is stored left, right + +------------------------------------------------------------------------*/ +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: 40a50167-a81c-463a-9e1d-3282ff84e09d +*/ diff --git a/Libraries/SndFile/Files/src/vox_adpcm.c b/Libraries/SndFile/Files/src/vox_adpcm.c new file mode 100644 index 000000000..666761ec8 --- /dev/null +++ b/Libraries/SndFile/Files/src/vox_adpcm.c @@ -0,0 +1,537 @@ +/* +** Copyright (C) 2002-2004 Erik de Castro Lopo +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU Lesser General Public License as published by +** the Free Software Foundation; either version 2.1 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU Lesser General Public License for more details. +** +** You should have received a copy of the GNU Lesser General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +/* +** This is the OKI / Dialogic ADPCM encoder/decoder. It converts from +** 12 bit linear sample data to a 4 bit ADPCM. +** +** Implemented from the description found here: +** +** http://www.comptek.ru:8100/telephony/tnotes/tt1-13.html +** +** and compared against the encoder/decoder found here: +** +** http://ibiblio.org/pub/linux/apps/sound/convert/vox.tar.gz +*/ + +#include +#include +#include + +#include "sndfile.h" +#include "config.h" +#include "sfendian.h" +#include "float_cast.h" +#include "common.h" + +#define VOX_DATA_LEN 2048 +#define PCM_DATA_LEN (VOX_DATA_LEN *2) + +typedef struct +{ short last ; + short step_index ; + + int vox_bytes, pcm_samples ; + + unsigned char vox_data [VOX_DATA_LEN] ; + short pcm_data [PCM_DATA_LEN] ; +} VOX_ADPCM_PRIVATE ; + +static int vox_adpcm_encode_block (VOX_ADPCM_PRIVATE *pvox) ; +static int vox_adpcm_decode_block (VOX_ADPCM_PRIVATE *pvox) ; + +static short vox_adpcm_decode (char code, VOX_ADPCM_PRIVATE *pvox) ; +static char vox_adpcm_encode (short samp, VOX_ADPCM_PRIVATE *pvox) ; + +static sf_count_t vox_read_s (SF_PRIVATE *psf, short *ptr, sf_count_t len) ; +static sf_count_t vox_read_i (SF_PRIVATE *psf, int *ptr, sf_count_t len) ; +static sf_count_t vox_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ; +static sf_count_t vox_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ; + +static sf_count_t vox_write_s (SF_PRIVATE *psf, short *ptr, sf_count_t len) ; +static sf_count_t vox_write_i (SF_PRIVATE *psf, int *ptr, sf_count_t len) ; +static sf_count_t vox_write_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ; +static sf_count_t vox_write_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ; + +static int vox_read_block (SF_PRIVATE *psf, VOX_ADPCM_PRIVATE *pvox, short *ptr, int len) ; +static int vox_write_block (SF_PRIVATE *psf, VOX_ADPCM_PRIVATE *pvox, short *ptr, int len) ; + +/*============================================================================================ +** Predefined OKI ADPCM encoder/decoder tables. +*/ + +static short step_size_table [49] = +{ 16, 17, 19, 21, 23, 25, 28, 31, 34, 37, 41, 45, 50, 55, 60, + 66, 73, 80, 88, 97, 107, 118, 130, 143, 157, 173, 190, 209, + 230, 253, 279, 307, 337, 371, 408, 449, 494, 544, 598, 658, + 724, 796, 876, 963, 1060, 1166, 1282, 1408, 1552 +} ; /* step_size_table */ + +static short step_adjust_table [8] = +{ -1, -1, -1, -1, 2, 4, 6, 8 +} ; /* step_adjust_table */ + +/*------------------------------------------------------------------------------ +*/ + +int +vox_adpcm_init (SF_PRIVATE *psf) +{ VOX_ADPCM_PRIVATE *pvox = NULL ; + + if (psf->mode == SFM_RDWR) + return SFE_BAD_MODE_RW ; + + if (psf->mode == SFM_WRITE && psf->sf.channels != 1) + return SFE_CHANNEL_COUNT ; + + if ((pvox = malloc (sizeof (VOX_ADPCM_PRIVATE))) == NULL) + return SFE_MALLOC_FAILED ; + + psf->fdata = (void*) pvox ; + memset (pvox, 0, sizeof (VOX_ADPCM_PRIVATE)) ; + + if (psf->mode == SFM_WRITE) + { psf->write_short = vox_write_s ; + psf->write_int = vox_write_i ; + psf->write_float = vox_write_f ; + psf->write_double = vox_write_d ; + } + else + { psf_log_printf (psf, "Header-less OKI Dialogic ADPCM encoded file.\n") ; + psf_log_printf (psf, "Setting up for 8kHz, mono, Vox ADPCM.\n") ; + + psf->read_short = vox_read_s ; + psf->read_int = vox_read_i ; + psf->read_float = vox_read_f ; + psf->read_double = vox_read_d ; + } ; + + /* Standard sample rate chennels etc. */ + if (psf->sf.samplerate < 1) + psf->sf.samplerate = 8000 ; + psf->sf.channels = 1 ; + + psf->sf.frames = psf->filelength * 2 ; + + psf->sf.seekable = SF_FALSE ; + + /* Seek back to start of data. */ + if (psf_fseek (psf, 0 , SEEK_SET) == -1) + return SFE_BAD_SEEK ; + + return 0 ; +} /* vox_adpcm_init */ + +/*------------------------------------------------------------------------------ +*/ + +static char +vox_adpcm_encode (short samp, VOX_ADPCM_PRIVATE *pvox) +{ short code ; + short diff, error, stepsize ; + + stepsize = step_size_table [pvox->step_index] ; + code = 0 ; + + diff = samp - pvox->last ; + if (diff < 0) + { code = 0x08 ; + error = -diff ; + } + else + error = diff ; + + if (error >= stepsize) + { code = code | 0x04 ; + error -= stepsize ; + } ; + + if (error >= stepsize / 2) + { code = code | 0x02 ; + error -= stepsize / 2 ; + } ; + + if (error >= stepsize / 4) + code = code | 0x01 ; + + /* + ** To close the feedback loop, the deocder is used to set the + ** estimate of last sample and in doing so, also set the step_index. + */ + pvox->last = vox_adpcm_decode (code, pvox) ; + + return code ; +} /* vox_adpcm_encode */ + +static short +vox_adpcm_decode (char code, VOX_ADPCM_PRIVATE *pvox) +{ short diff, error, stepsize, samp ; + + stepsize = step_size_table [pvox->step_index] ; + + error = stepsize / 8 ; + + if (code & 0x01) + error += stepsize / 4 ; + + if (code & 0x02) + error += stepsize / 2 ; + + if (code & 0x04) + error += stepsize ; + + diff = (code & 0x08) ? -error : error ; + samp = pvox->last + diff ; + + /* + ** Apply clipping. + */ + if (samp > 2048) + samp = 2048 ; + if (samp < -2048) + samp = -2048 ; + + pvox->last = samp ; + pvox->step_index += step_adjust_table [code & 0x7] ; + + if (pvox->step_index < 0) + pvox->step_index = 0 ; + if (pvox->step_index > 48) + pvox->step_index = 48 ; + + return samp ; +} /* vox_adpcm_decode */ + +static int +vox_adpcm_encode_block (VOX_ADPCM_PRIVATE *pvox) +{ unsigned char code ; + int j, k ; + + /* If data_count is odd, add an extra zero valued sample. */ + if (pvox->pcm_samples & 1) + pvox->pcm_data [pvox->pcm_samples++] = 0 ; + + for (j = k = 0 ; k < pvox->pcm_samples ; j++) + { code = vox_adpcm_encode (pvox->pcm_data [k++] / 16, pvox) << 4 ; + code |= vox_adpcm_encode (pvox->pcm_data [k++] / 16, pvox) ; + pvox->vox_data [j] = code ; + } ; + + pvox->vox_bytes = j ; + + return 0 ; +} /* vox_adpcm_encode_block */ + +static int +vox_adpcm_decode_block (VOX_ADPCM_PRIVATE *pvox) +{ unsigned char code ; + int j, k ; + + for (j = k = 0 ; j < pvox->vox_bytes ; j++) + { code = pvox->vox_data [j] ; + pvox->pcm_data [k++] = 16 * vox_adpcm_decode ((code >> 4) & 0x0f, pvox) ; + pvox->pcm_data [k++] = 16 * vox_adpcm_decode (code & 0x0f, pvox) ; + } ; + + pvox->pcm_samples = k ; + + return 0 ; +} /* vox_adpcm_decode_block */ + +/*============================================================================== +*/ + +static int +vox_read_block (SF_PRIVATE *psf, VOX_ADPCM_PRIVATE *pvox, short *ptr, int len) +{ int indx = 0, k ; + + while (indx < len) + { pvox->vox_bytes = (len - indx > PCM_DATA_LEN) ? VOX_DATA_LEN : (len - indx + 1) / 2 ; + + if ((k = psf_fread (pvox->vox_data, 1, pvox->vox_bytes, psf)) != pvox->vox_bytes) + { if (psf_ftell (psf) + k != psf->filelength) + psf_log_printf (psf, "*** Warning : short read (%d != %d).\n", k, pvox->vox_bytes) ; + if (k == 0) + break ; + } ; + + pvox->vox_bytes = k ; + + vox_adpcm_decode_block (pvox) ; + + memcpy (&(ptr [indx]), pvox->pcm_data, pvox->pcm_samples * sizeof (short)) ; + indx += pvox->pcm_samples ; + } ; + + return indx ; +} /* vox_read_block */ + + +static sf_count_t +vox_read_s (SF_PRIVATE *psf, short *ptr, sf_count_t len) +{ VOX_ADPCM_PRIVATE *pvox ; + int readcount, count ; + sf_count_t total = 0 ; + + if (! psf->fdata) + return 0 ; + pvox = (VOX_ADPCM_PRIVATE*) psf->fdata ; + + while (len > 0) + { readcount = (len > 0x10000000) ? 0x10000000 : (int) len ; + + count = vox_read_block (psf, pvox, ptr, readcount) ; + + total += count ; + len -= count ; + if (count != readcount) + break ; + } ; + + return total ; +} /* vox_read_s */ + +static sf_count_t +vox_read_i (SF_PRIVATE *psf, int *ptr, sf_count_t len) +{ VOX_ADPCM_PRIVATE *pvox ; + short *sptr ; + int k, bufferlen, readcount, count ; + sf_count_t total = 0 ; + + if (! psf->fdata) + return 0 ; + pvox = (VOX_ADPCM_PRIVATE*) psf->fdata ; + + sptr = psf->u.sbuf ; + bufferlen = ARRAY_LEN (psf->u.sbuf) ; + while (len > 0) + { readcount = (len >= bufferlen) ? bufferlen : (int) len ; + count = vox_read_block (psf, pvox, sptr, readcount) ; + for (k = 0 ; k < readcount ; k++) + ptr [total + k] = ((int) sptr [k]) << 16 ; + total += count ; + len -= readcount ; + if (count != readcount) + break ; + } ; + + return total ; +} /* vox_read_i */ + +static sf_count_t +vox_read_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) +{ VOX_ADPCM_PRIVATE *pvox ; + short *sptr ; + int k, bufferlen, readcount, count ; + sf_count_t total = 0 ; + float normfact ; + + if (! psf->fdata) + return 0 ; + pvox = (VOX_ADPCM_PRIVATE*) psf->fdata ; + + normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x8000) : 1.0 ; + + sptr = psf->u.sbuf ; + bufferlen = ARRAY_LEN (psf->u.sbuf) ; + while (len > 0) + { readcount = (len >= bufferlen) ? bufferlen : (int) len ; + count = vox_read_block (psf, pvox, sptr, readcount) ; + for (k = 0 ; k < readcount ; k++) + ptr [total + k] = normfact * (float) (sptr [k]) ; + total += count ; + len -= readcount ; + if (count != readcount) + break ; + } ; + + return total ; +} /* vox_read_f */ + +static sf_count_t +vox_read_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) +{ VOX_ADPCM_PRIVATE *pvox ; + short *sptr ; + int k, bufferlen, readcount, count ; + sf_count_t total = 0 ; + double normfact ; + + if (! psf->fdata) + return 0 ; + pvox = (VOX_ADPCM_PRIVATE*) psf->fdata ; + + normfact = (psf->norm_double == SF_TRUE) ? 1.0 / ((double) 0x8000) : 1.0 ; + + sptr = psf->u.sbuf ; + bufferlen = ARRAY_LEN (psf->u.sbuf) ; + while (len > 0) + { readcount = (len >= bufferlen) ? bufferlen : (int) len ; + count = vox_read_block (psf, pvox, sptr, readcount) ; + for (k = 0 ; k < readcount ; k++) + ptr [total + k] = normfact * (double) (sptr [k]) ; + total += count ; + len -= readcount ; + if (count != readcount) + break ; + } ; + + return total ; +} /* vox_read_d */ + +/*------------------------------------------------------------------------------ +*/ + +static int +vox_write_block (SF_PRIVATE *psf, VOX_ADPCM_PRIVATE *pvox, short *ptr, int len) +{ int indx = 0, k ; + + while (indx < len) + { pvox->pcm_samples = (len - indx > PCM_DATA_LEN) ? PCM_DATA_LEN : len - indx ; + + memcpy (pvox->pcm_data, &(ptr [indx]), pvox->pcm_samples * sizeof (short)) ; + + vox_adpcm_encode_block (pvox) ; + + if ((k = psf_fwrite (pvox->vox_data, 1, pvox->vox_bytes, psf)) != pvox->vox_bytes) + psf_log_printf (psf, "*** Warning : short read (%d != %d).\n", k, pvox->vox_bytes) ; + + indx += pvox->pcm_samples ; + } ; + + return indx ; +} /* vox_write_block */ + +static sf_count_t +vox_write_s (SF_PRIVATE *psf, short *ptr, sf_count_t len) +{ VOX_ADPCM_PRIVATE *pvox ; + int writecount, count ; + sf_count_t total = 0 ; + + if (! psf->fdata) + return 0 ; + pvox = (VOX_ADPCM_PRIVATE*) psf->fdata ; + + while (len) + { writecount = (len > 0x10000000) ? 0x10000000 : (int) len ; + + count = vox_write_block (psf, pvox, ptr, writecount) ; + + total += count ; + len -= count ; + if (count != writecount) + break ; + } ; + + return total ; +} /* vox_write_s */ + +static sf_count_t +vox_write_i (SF_PRIVATE *psf, int *ptr, sf_count_t len) +{ VOX_ADPCM_PRIVATE *pvox ; + short *sptr ; + int k, bufferlen, writecount, count ; + sf_count_t total = 0 ; + + if (! psf->fdata) + return 0 ; + pvox = (VOX_ADPCM_PRIVATE*) psf->fdata ; + + sptr = psf->u.sbuf ; + bufferlen = ARRAY_LEN (psf->u.sbuf) ; + while (len > 0) + { writecount = (len >= bufferlen) ? bufferlen : (int) len ; + for (k = 0 ; k < writecount ; k++) + sptr [k] = ptr [total + k] >> 16 ; + count = vox_write_block (psf, pvox, sptr, writecount) ; + total += count ; + len -= writecount ; + if (count != writecount) + break ; + } ; + + return total ; +} /* vox_write_i */ + +static sf_count_t +vox_write_f (SF_PRIVATE *psf, float *ptr, sf_count_t len) +{ VOX_ADPCM_PRIVATE *pvox ; + short *sptr ; + int k, bufferlen, writecount, count ; + sf_count_t total = 0 ; + float normfact ; + + if (! psf->fdata) + return 0 ; + pvox = (VOX_ADPCM_PRIVATE*) psf->fdata ; + + normfact = (psf->norm_float == SF_TRUE) ? (1.0 * 0x7FFF) : 1.0 ; + + sptr = psf->u.sbuf ; + bufferlen = ARRAY_LEN (psf->u.sbuf) ; + while (len > 0) + { writecount = (len >= bufferlen) ? bufferlen : (int) len ; + for (k = 0 ; k < writecount ; k++) + sptr [k] = lrintf (normfact * ptr [total + k]) ; + count = vox_write_block (psf, pvox, sptr, writecount) ; + total += count ; + len -= writecount ; + if (count != writecount) + break ; + } ; + + return total ; +} /* vox_write_f */ + +static sf_count_t +vox_write_d (SF_PRIVATE *psf, double *ptr, sf_count_t len) +{ VOX_ADPCM_PRIVATE *pvox ; + short *sptr ; + int k, bufferlen, writecount, count ; + sf_count_t total = 0 ; + double normfact ; + + if (! psf->fdata) + return 0 ; + pvox = (VOX_ADPCM_PRIVATE*) psf->fdata ; + + normfact = (psf->norm_double == SF_TRUE) ? (1.0 * 0x7FFF) : 1.0 ; + + sptr = psf->u.sbuf ; + bufferlen = ARRAY_LEN (psf->u.sbuf) ; + while (len > 0) + { writecount = (len >= bufferlen) ? bufferlen : (int) len ; + for (k = 0 ; k < writecount ; k++) + sptr [k] = lrint (normfact * ptr [total + k]) ; + count = vox_write_block (psf, pvox, sptr, writecount) ; + total += count ; + len -= writecount ; + if (count != writecount) + break ; + } ; + + return total ; +} /* vox_write_d */ + + +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: e15e97fe-ff9d-4b46-a489-7059fb2d0b1e +*/ diff --git a/Libraries/SndFile/Files/src/w64.c b/Libraries/SndFile/Files/src/w64.c new file mode 100644 index 000000000..f5e8f399f --- /dev/null +++ b/Libraries/SndFile/Files/src/w64.c @@ -0,0 +1,581 @@ +/* +** Copyright (C) 1999-2004 Erik de Castro Lopo +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU Lesser General Public License as published by +** the Free Software Foundation; either version 2.1 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU Lesser General Public License for more details. +** +** You should have received a copy of the GNU Lesser General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include +#include +#include +#include + +#include "sndfile.h" +#include "config.h" +#include "sfendian.h" +#include "common.h" +#include "wav_w64.h" + +/*------------------------------------------------------------------------------ +** W64 files use 16 byte markers as opposed to the four byte marker of +** WAV files. +** For comparison purposes, an integer is required, so make an integer +** hash for the 16 bytes using MAKE_HASH16 macro, but also create a 16 +** byte array containing the complete 16 bytes required when writing the +** header. +*/ + +#define MAKE_HASH16(x0,x1,x2,x3,x4,x5,x6,x7,x8,x9,xa,xb,xc,xd,xe,xf) \ + ( (x0) ^ ((x1) << 1) ^ ((x2) << 2) ^ ((x3) << 3) ^ \ + ((x4) << 4) ^ ((x5) << 5) ^ ((x6) << 6) ^ ((x7) << 7) ^ \ + ((x8) << 8) ^ ((x9) << 9) ^ ((xa) << 10) ^ ((xb) << 11) ^ \ + ((xc) << 12) ^ ((xd) << 13) ^ ((xe) << 14) ^ ((xf) << 15) ) + +#define MAKE_MARKER16(name,x0,x1,x2,x3,x4,x5,x6,x7,x8,x9,xa,xb,xc,xd,xe,xf) \ + static unsigned char name [16] = { (x0), (x1), (x2), (x3), (x4), (x5), \ + (x6), (x7), (x8), (x9), (xa), (xb), (xc), (xd), (xe), (xf) } + +#define riff_HASH16 MAKE_HASH16 ('r', 'i', 'f', 'f', 0x2E, 0x91, 0xCF, 0x11, 0xA5, \ + 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00) + +#define wave_HASH16 MAKE_HASH16 ('w', 'a', 'v', 'e', 0xF3, 0xAC, 0xD3, 0x11, \ + 0x8C, 0xD1, 0x00, 0xC0, 0x4F, 0x8E, 0xDB, 0x8A) + +#define fmt_HASH16 MAKE_HASH16 ('f', 'm', 't', ' ', 0xF3, 0xAC, 0xD3, 0x11, \ + 0x8C, 0xD1, 0x00, 0xC0, 0x4F, 0x8E, 0xDB, 0x8A) + +#define fact_HASH16 MAKE_HASH16 ('f', 'a', 'c', 't', 0xF3, 0xAC, 0xD3, 0x11, \ + 0x8C, 0xD1, 0x00, 0xC0, 0x4F, 0x8E, 0xDB, 0x8A) + +#define data_HASH16 MAKE_HASH16 ('d', 'a', 't', 'a', 0xF3, 0xAC, 0xD3, 0x11, \ + 0x8C, 0xD1, 0x00, 0xC0, 0x4F, 0x8E, 0xDB, 0x8A) + +#define ACID_HASH16 MAKE_HASH16 (0x6D, 0x07, 0x1C, 0xEA, 0xA3, 0xEF, 0x78, 0x4C, \ + 0x90, 0x57, 0x7F, 0x79, 0xEE, 0x25, 0x2A, 0xAE) + +MAKE_MARKER16 (riff_MARKER16, 'r', 'i', 'f', 'f', 0x2E, 0x91, 0xCF, 0x11, + 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00) ; + + +MAKE_MARKER16 (wave_MARKER16, 'w', 'a', 'v', 'e', 0xF3, 0xAC, 0xD3, 0x11, + 0x8C, 0xD1, 0x00, 0xC0, 0x4F, 0x8E, 0xDB, 0x8A) ; + +MAKE_MARKER16 (fmt_MARKER16, 'f', 'm', 't', ' ', 0xF3, 0xAC, 0xD3, 0x11, + 0x8C, 0xD1, 0x00, 0xC0, 0x4F, 0x8E, 0xDB, 0x8A) ; + +MAKE_MARKER16 (fact_MARKER16, 'f', 'a', 'c', 't', 0xF3, 0xAC, 0xD3, 0x11, + 0x8C, 0xD1, 0x00, 0xC0, 0x4F, 0x8E, 0xDB, 0x8A) ; + +MAKE_MARKER16 (data_MARKER16, 'd', 'a', 't', 'a', 0xF3, 0xAC, 0xD3, 0x11, + 0x8C, 0xD1, 0x00, 0xC0, 0x4F, 0x8E, 0xDB, 0x8A) ; + +enum +{ HAVE_riff = 0x01, + HAVE_wave = 0x02, + HAVE_fmt = 0x04, + HAVE_fact = 0x08, + HAVE_data = 0x20 +} ; + +/*------------------------------------------------------------------------------ + * Private static functions. + */ + +static int w64_read_header (SF_PRIVATE *psf, int *blockalign, int *framesperblock) ; +static int w64_write_header (SF_PRIVATE *psf, int calc_length) ; +static int w64_close (SF_PRIVATE *psf) ; + +/*------------------------------------------------------------------------------ +** Public function. +*/ + +int +w64_open (SF_PRIVATE *psf) +{ int subformat, error, blockalign = 0, framesperblock = 0 ; + + if (psf->mode == SFM_READ || (psf->mode == SFM_RDWR &&psf->filelength > 0)) + { if ((error = w64_read_header (psf, &blockalign, &framesperblock))) + return error ; + } ; + + if ((psf->sf.format & SF_FORMAT_TYPEMASK) != SF_FORMAT_W64) + return SFE_BAD_OPEN_FORMAT ; + + subformat = psf->sf.format & SF_FORMAT_SUBMASK ; + + if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR) + { if (psf->is_pipe) + return SFE_NO_PIPE_WRITE ; + + psf->endian = SF_ENDIAN_LITTLE ; /* All W64 files are little endian. */ + + psf->blockwidth = psf->bytewidth * psf->sf.channels ; + + if (subformat == SF_FORMAT_IMA_ADPCM || subformat == SF_FORMAT_MS_ADPCM) + { blockalign = wav_w64_srate2blocksize (psf->sf.samplerate * psf->sf.channels) ; + framesperblock = -1 ; + + /* FIXME : This block must go */ + psf->filelength = SF_COUNT_MAX ; + psf->datalength = psf->filelength ; + if (psf->sf.frames <= 0) + psf->sf.frames = (psf->blockwidth) ? psf->filelength / psf->blockwidth : psf->filelength ; + /* EMXIF : This block must go */ + } ; + + if ((error = w64_write_header (psf, SF_FALSE))) + return error ; + + psf->write_header = w64_write_header ; + } ; + + psf->close = w64_close ; + + switch (subformat) + { case SF_FORMAT_PCM_U8 : + error = pcm_init (psf) ; + break ; + + case SF_FORMAT_PCM_16 : + case SF_FORMAT_PCM_24 : + case SF_FORMAT_PCM_32 : + error = pcm_init (psf) ; + break ; + + case SF_FORMAT_ULAW : + error = ulaw_init (psf) ; + break ; + + case SF_FORMAT_ALAW : + error = alaw_init (psf) ; + break ; + + /* Lite remove start */ + case SF_FORMAT_FLOAT : + error = float32_init (psf) ; + break ; + + case SF_FORMAT_DOUBLE : + error = double64_init (psf) ; + break ; + + case SF_FORMAT_IMA_ADPCM : + error = wav_w64_ima_init (psf, blockalign, framesperblock) ; + break ; + + case SF_FORMAT_MS_ADPCM : + error = wav_w64_msadpcm_init (psf, blockalign, framesperblock) ; + break ; + /* Lite remove end */ + + case SF_FORMAT_GSM610 : + error = gsm610_init (psf) ; + break ; + + default : return SFE_UNIMPLEMENTED ; + } ; + + return error ; +} /* w64_open */ + +/*========================================================================= +** Private functions. +*/ + +static int +w64_read_header (SF_PRIVATE *psf, int *blockalign, int *framesperblock) +{ WAV_FMT wav_fmt ; + int dword = 0, marker, format = 0 ; + sf_count_t chunk_size, bytesread = 0 ; + int parsestage = 0, error, done = 0 ; + + /* Set position to start of file to begin reading header. */ + psf_binheader_readf (psf, "p", 0) ; + + while (! done) + { /* Read the 4 byte marker and jump 12 bytes. */ + bytesread += psf_binheader_readf (psf, "h", &marker) ; + chunk_size = 0 ; + + switch (marker) + { case riff_HASH16 : + if (parsestage) + return SFE_W64_NO_RIFF ; + + bytesread += psf_binheader_readf (psf, "e8", &chunk_size) ; + + if (psf->filelength < chunk_size) + psf_log_printf (psf, "riff : %D (should be %D)\n", chunk_size, psf->filelength) ; + else + psf_log_printf (psf, "riff : %D\n", chunk_size) ; + + parsestage |= HAVE_riff ; + break ; + + case ACID_HASH16: + psf_log_printf (psf, "Looks like an ACID file. Exiting.\n") ; + return SFE_UNIMPLEMENTED ; + + case wave_HASH16 : + if ((parsestage & HAVE_riff) != HAVE_riff) + return SFE_W64_NO_WAVE ; + psf_log_printf (psf, "wave\n") ; + parsestage |= HAVE_wave ; + break ; + + case fmt_HASH16 : + if ((parsestage & (HAVE_riff | HAVE_wave)) != (HAVE_riff | HAVE_wave)) + return SFE_W64_NO_FMT ; + + bytesread += psf_binheader_readf (psf, "e8", &chunk_size) ; + psf_log_printf (psf, " fmt : %D\n", chunk_size) ; + + /* size of 16 byte marker and 8 byte chunk_size value. */ + chunk_size -= 24 ; + + if ((error = wav_w64_read_fmt_chunk (psf, &wav_fmt, (int) chunk_size))) + return error ; + + if (chunk_size % 8) + psf_binheader_readf (psf, "j", 8 - (chunk_size % 8)) ; + + format = wav_fmt.format ; + parsestage |= HAVE_fmt ; + break ; + + case fact_HASH16: + { sf_count_t frames ; + + psf_binheader_readf (psf, "e88", &chunk_size, &frames) ; + psf_log_printf (psf, " fact : %D\n frames : %D\n", + chunk_size, frames) ; + } ; + break ; + + + case data_HASH16 : + if ((parsestage & (HAVE_riff | HAVE_wave | HAVE_fmt)) != (HAVE_riff | HAVE_wave | HAVE_fmt)) + return SFE_W64_NO_DATA ; + + psf_binheader_readf (psf, "e8", &chunk_size) ; + + psf->dataoffset = psf_ftell (psf) ; + + psf->datalength = chunk_size - 24 ; + + if (chunk_size % 8) + chunk_size += 8 - (chunk_size % 8) ; + + psf_log_printf (psf, "data : %D\n", chunk_size) ; + + parsestage |= HAVE_data ; + + if (! psf->sf.seekable) + break ; + + /* Seek past data and continue reading header. */ + psf_fseek (psf, chunk_size, SEEK_CUR) ; + break ; + + default : + if (psf_ftell (psf) & 0x0F) + { psf_log_printf (psf, " Unknown chunk marker at position %d. Resynching.\n", dword - 4) ; + psf_binheader_readf (psf, "j", -3) ; + break ; + } ; + psf_log_printf (psf, "*** Unknown chunk marker : %X. Exiting parser.\n", marker) ; + done = SF_TRUE ; + break ; + } ; /* switch (dword) */ + + if (psf->sf.seekable == 0 && (parsestage & HAVE_data)) + break ; + + if (psf_ftell (psf) >= (psf->filelength - (2 * SIGNED_SIZEOF (dword)))) + break ; + + if (psf->logindex >= SIGNED_SIZEOF (psf->logbuffer) - 2) + return SFE_LOG_OVERRUN ; + } ; /* while (1) */ + + if (! psf->dataoffset) + return SFE_W64_NO_DATA ; + + psf->endian = SF_ENDIAN_LITTLE ; /* All WAV files are little endian. */ + + if (psf_ftell (psf) != psf->dataoffset) + psf_fseek (psf, psf->dataoffset, SEEK_SET) ; + + psf->close = w64_close ; + + if (psf->blockwidth) + { if (psf->filelength - psf->dataoffset < psf->datalength) + psf->sf.frames = (psf->filelength - psf->dataoffset) / psf->blockwidth ; + else + psf->sf.frames = psf->datalength / psf->blockwidth ; + } ; + + switch (format) + { case WAVE_FORMAT_PCM : + case WAVE_FORMAT_EXTENSIBLE : + /* extensible might be FLOAT, MULAW, etc as well! */ + psf->sf.format = SF_FORMAT_W64 | u_bitwidth_to_subformat (psf->bytewidth * 8) ; + break ; + + case WAVE_FORMAT_MULAW : + psf->sf.format = (SF_FORMAT_W64 | SF_FORMAT_ULAW) ; + break ; + + case WAVE_FORMAT_ALAW : + psf->sf.format = (SF_FORMAT_W64 | SF_FORMAT_ALAW) ; + break ; + + case WAVE_FORMAT_MS_ADPCM : + psf->sf.format = (SF_FORMAT_W64 | SF_FORMAT_MS_ADPCM) ; + *blockalign = wav_fmt.msadpcm.blockalign ; + *framesperblock = wav_fmt.msadpcm.samplesperblock ; + break ; + + case WAVE_FORMAT_IMA_ADPCM : + psf->sf.format = (SF_FORMAT_W64 | SF_FORMAT_IMA_ADPCM) ; + *blockalign = wav_fmt.ima.blockalign ; + *framesperblock = wav_fmt.ima.samplesperblock ; + break ; + + case WAVE_FORMAT_GSM610 : + psf->sf.format = (SF_FORMAT_W64 | SF_FORMAT_GSM610) ; + break ; + + case WAVE_FORMAT_IEEE_FLOAT : + psf->sf.format = SF_FORMAT_W64 ; + psf->sf.format |= (psf->bytewidth == 8) ? SF_FORMAT_DOUBLE : SF_FORMAT_FLOAT ; + break ; + + default : return SFE_UNIMPLEMENTED ; + } ; + + return 0 ; +} /* w64_read_header */ + +static int +w64_write_header (SF_PRIVATE *psf, int calc_length) +{ sf_count_t fmt_size, current ; + size_t fmt_pad = 0 ; + int subformat, add_fact_chunk = SF_FALSE ; + + current = psf_ftell (psf) ; + + if (calc_length) + { psf->filelength = psf_get_filelen (psf) ; + + psf->datalength = psf->filelength - psf->dataoffset ; + if (psf->dataend) + psf->datalength -= psf->filelength - psf->dataend ; + + if (psf->bytewidth) + psf->sf.frames = psf->datalength / (psf->bytewidth * psf->sf.channels) ; + } ; + + /* Reset the current header length to zero. */ + psf->header [0] = 0 ; + psf->headindex = 0 ; + psf_fseek (psf, 0, SEEK_SET) ; + + /* riff marker, length, wave and 'fmt ' markers. */ + psf_binheader_writef (psf, "eh8hh", riff_MARKER16, psf->filelength - 8, wave_MARKER16, fmt_MARKER16) ; + + subformat = psf->sf.format & SF_FORMAT_SUBMASK ; + + switch (subformat) + { case SF_FORMAT_PCM_U8 : + case SF_FORMAT_PCM_16 : + case SF_FORMAT_PCM_24 : + case SF_FORMAT_PCM_32 : + fmt_size = 24 + 2 + 2 + 4 + 4 + 2 + 2 ; + fmt_pad = (size_t) (8 - (fmt_size & 0x7)) ; + fmt_size += fmt_pad ; + + /* fmt : format, channels, samplerate */ + psf_binheader_writef (psf, "e8224", fmt_size, WAVE_FORMAT_PCM, psf->sf.channels, psf->sf.samplerate) ; + /* fmt : bytespersec */ + psf_binheader_writef (psf, "e4", psf->sf.samplerate * psf->bytewidth * psf->sf.channels) ; + /* fmt : blockalign, bitwidth */ + psf_binheader_writef (psf, "e22", psf->bytewidth * psf->sf.channels, psf->bytewidth * 8) ; + break ; + + case SF_FORMAT_FLOAT : + case SF_FORMAT_DOUBLE : + fmt_size = 24 + 2 + 2 + 4 + 4 + 2 + 2 ; + fmt_pad = (size_t) (8 - (fmt_size & 0x7)) ; + fmt_size += fmt_pad ; + + /* fmt : format, channels, samplerate */ + psf_binheader_writef (psf, "e8224", fmt_size, WAVE_FORMAT_IEEE_FLOAT, psf->sf.channels, psf->sf.samplerate) ; + /* fmt : bytespersec */ + psf_binheader_writef (psf, "e4", psf->sf.samplerate * psf->bytewidth * psf->sf.channels) ; + /* fmt : blockalign, bitwidth */ + psf_binheader_writef (psf, "e22", psf->bytewidth * psf->sf.channels, psf->bytewidth * 8) ; + + add_fact_chunk = SF_TRUE ; + break ; + + case SF_FORMAT_ULAW : + fmt_size = 24 + 2 + 2 + 4 + 4 + 2 + 2 ; + fmt_pad = (size_t) (8 - (fmt_size & 0x7)) ; + fmt_size += fmt_pad ; + + /* fmt : format, channels, samplerate */ + psf_binheader_writef (psf, "e8224", fmt_size, WAVE_FORMAT_MULAW, psf->sf.channels, psf->sf.samplerate) ; + /* fmt : bytespersec */ + psf_binheader_writef (psf, "e4", psf->sf.samplerate * psf->bytewidth * psf->sf.channels) ; + /* fmt : blockalign, bitwidth */ + psf_binheader_writef (psf, "e22", psf->bytewidth * psf->sf.channels, 8) ; + + add_fact_chunk = SF_TRUE ; + break ; + + case SF_FORMAT_ALAW : + fmt_size = 24 + 2 + 2 + 4 + 4 + 2 + 2 ; + fmt_pad = (size_t) (8 - (fmt_size & 0x7)) ; + fmt_size += fmt_pad ; + + /* fmt : format, channels, samplerate */ + psf_binheader_writef (psf, "e8224", fmt_size, WAVE_FORMAT_ALAW, psf->sf.channels, psf->sf.samplerate) ; + /* fmt : bytespersec */ + psf_binheader_writef (psf, "e4", psf->sf.samplerate * psf->bytewidth * psf->sf.channels) ; + /* fmt : blockalign, bitwidth */ + psf_binheader_writef (psf, "e22", psf->bytewidth * psf->sf.channels, 8) ; + + add_fact_chunk = SF_TRUE ; + break ; + + /* Lite remove start */ + case SF_FORMAT_IMA_ADPCM : + { int blockalign, framesperblock, bytespersec ; + + blockalign = wav_w64_srate2blocksize (psf->sf.samplerate * psf->sf.channels) ; + framesperblock = 2 * (blockalign - 4 * psf->sf.channels) / psf->sf.channels + 1 ; + bytespersec = (psf->sf.samplerate * blockalign) / framesperblock ; + + /* fmt chunk. */ + fmt_size = 24 + 2 + 2 + 4 + 4 + 2 + 2 + 2 + 2 ; + fmt_pad = (size_t) (8 - (fmt_size & 0x7)) ; + fmt_size += fmt_pad ; + + /* fmt : size, WAV format type, channels. */ + psf_binheader_writef (psf, "e822", fmt_size, WAVE_FORMAT_IMA_ADPCM, psf->sf.channels) ; + + /* fmt : samplerate, bytespersec. */ + psf_binheader_writef (psf, "e44", psf->sf.samplerate, bytespersec) ; + + /* fmt : blockalign, bitwidth, extrabytes, framesperblock. */ + psf_binheader_writef (psf, "e2222", blockalign, 4, 2, framesperblock) ; + } ; + + add_fact_chunk = SF_TRUE ; + break ; + + case SF_FORMAT_MS_ADPCM : + { int blockalign, framesperblock, bytespersec, extrabytes ; + + blockalign = wav_w64_srate2blocksize (psf->sf.samplerate * psf->sf.channels) ; + framesperblock = 2 + 2 * (blockalign - 7 * psf->sf.channels) / psf->sf.channels ; + bytespersec = (psf->sf.samplerate * blockalign) / framesperblock ; + + /* fmt chunk. */ + extrabytes = 2 + 2 + MSADPCM_ADAPT_COEFF_COUNT * (2 + 2) ; + fmt_size = 24 + 2 + 2 + 4 + 4 + 2 + 2 + 2 + extrabytes ; + fmt_pad = (size_t) (8 - (fmt_size & 0x7)) ; + fmt_size += fmt_pad ; + + /* fmt : size, W64 format type, channels. */ + psf_binheader_writef (psf, "e822", fmt_size, WAVE_FORMAT_MS_ADPCM, psf->sf.channels) ; + + /* fmt : samplerate, bytespersec. */ + psf_binheader_writef (psf, "e44", psf->sf.samplerate, bytespersec) ; + + /* fmt : blockalign, bitwidth, extrabytes, framesperblock. */ + psf_binheader_writef (psf, "e22222", blockalign, 4, extrabytes, framesperblock, 7) ; + + msadpcm_write_adapt_coeffs (psf) ; + } ; + + add_fact_chunk = SF_TRUE ; + break ; + /* Lite remove end */ + + case SF_FORMAT_GSM610 : + { int bytespersec ; + + bytespersec = (psf->sf.samplerate * WAV_W64_GSM610_BLOCKSIZE) / WAV_W64_GSM610_SAMPLES ; + + /* fmt chunk. */ + fmt_size = 24 + 2 + 2 + 4 + 4 + 2 + 2 + 2 + 2 ; + fmt_pad = (size_t) (8 - (fmt_size & 0x7)) ; + fmt_size += fmt_pad ; + + /* fmt : size, WAV format type, channels. */ + psf_binheader_writef (psf, "e822", fmt_size, WAVE_FORMAT_GSM610, psf->sf.channels) ; + + /* fmt : samplerate, bytespersec. */ + psf_binheader_writef (psf, "e44", psf->sf.samplerate, bytespersec) ; + + /* fmt : blockalign, bitwidth, extrabytes, framesperblock. */ + psf_binheader_writef (psf, "e2222", WAV_W64_GSM610_BLOCKSIZE, 0, 2, WAV_W64_GSM610_SAMPLES) ; + } ; + + add_fact_chunk = SF_TRUE ; + break ; + + default : return SFE_UNIMPLEMENTED ; + } ; + + /* Pad to 8 bytes with zeros. */ + if (fmt_pad > 0) + psf_binheader_writef (psf, "z", fmt_pad) ; + + if (add_fact_chunk) + psf_binheader_writef (psf, "eh88", fact_MARKER16, 16 + 8 + 8, psf->sf.frames) ; + + psf_binheader_writef (psf, "eh8", data_MARKER16, psf->datalength + 24) ; + psf_fwrite (psf->header, psf->headindex, 1, psf) ; + + if (psf->error) + return psf->error ; + + psf->dataoffset = psf->headindex ; + + if (current > 0) + psf_fseek (psf, current, SEEK_SET) ; + + return psf->error ; +} /* w64_write_header */ + +static int +w64_close (SF_PRIVATE *psf) +{ + if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR) + w64_write_header (psf, SF_TRUE) ; + + return 0 ; +} /* w64_close */ + + +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: 9aa4e141-538a-4dd9-99c9-b3f0f2dd4f4a +*/ diff --git a/Libraries/SndFile/Files/src/wav.c b/Libraries/SndFile/Files/src/wav.c new file mode 100644 index 000000000..610732360 --- /dev/null +++ b/Libraries/SndFile/Files/src/wav.c @@ -0,0 +1,1391 @@ +/* +** Copyright (C) 1999-2004 Erik de Castro Lopo +** Copyright (C) 2004 David Viens +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU Lesser General Public License as published by +** the Free Software Foundation; either version 2.1 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU Lesser General Public License for more details. +** +** You should have received a copy of the GNU Lesser General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + + +#include +#include +#include +#include +#include + +#include "sndfile.h" +#include "config.h" +#include "sfendian.h" +#include "common.h" +#include "wav_w64.h" + +/*------------------------------------------------------------------------------ + * Macros to handle big/little endian issues. + */ + +#define RIFF_MARKER (MAKE_MARKER ('R', 'I', 'F', 'F')) +#define WAVE_MARKER (MAKE_MARKER ('W', 'A', 'V', 'E')) +#define fmt_MARKER (MAKE_MARKER ('f', 'm', 't', ' ')) +#define data_MARKER (MAKE_MARKER ('d', 'a', 't', 'a')) +#define fact_MARKER (MAKE_MARKER ('f', 'a', 'c', 't')) +#define PEAK_MARKER (MAKE_MARKER ('P', 'E', 'A', 'K')) + +#define cue_MARKER (MAKE_MARKER ('c', 'u', 'e', ' ')) +#define LIST_MARKER (MAKE_MARKER ('L', 'I', 'S', 'T')) +#define slnt_MARKER (MAKE_MARKER ('s', 'l', 'n', 't')) +#define wavl_MARKER (MAKE_MARKER ('w', 'a', 'v', 'l')) +#define INFO_MARKER (MAKE_MARKER ('I', 'N', 'F', 'O')) +#define plst_MARKER (MAKE_MARKER ('p', 'l', 's', 't')) +#define adtl_MARKER (MAKE_MARKER ('a', 'd', 't', 'l')) +#define labl_MARKER (MAKE_MARKER ('l', 'a', 'b', 'l')) +#define ltxt_MARKER (MAKE_MARKER ('l', 't', 'x', 't')) +#define note_MARKER (MAKE_MARKER ('n', 'o', 't', 'e')) +#define smpl_MARKER (MAKE_MARKER ('s', 'm', 'p', 'l')) +#define bext_MARKER (MAKE_MARKER ('b', 'e', 'x', 't')) +#define MEXT_MARKER (MAKE_MARKER ('M', 'E', 'X', 'T')) +#define DISP_MARKER (MAKE_MARKER ('D', 'I', 'S', 'P')) +#define acid_MARKER (MAKE_MARKER ('a', 'c', 'i', 'd')) +#define strc_MARKER (MAKE_MARKER ('s', 't', 'r', 'c')) +#define PAD_MARKER (MAKE_MARKER ('P', 'A', 'D', ' ')) +#define afsp_MARKER (MAKE_MARKER ('a', 'f', 's', 'p')) +#define clm_MARKER (MAKE_MARKER ('c', 'l', 'm', ' ')) + +#define ISFT_MARKER (MAKE_MARKER ('I', 'S', 'F', 'T')) +#define ICRD_MARKER (MAKE_MARKER ('I', 'C', 'R', 'D')) +#define ICOP_MARKER (MAKE_MARKER ('I', 'C', 'O', 'P')) +#define IARL_MARKER (MAKE_MARKER ('I', 'A', 'R', 'L')) +#define IART_MARKER (MAKE_MARKER ('I', 'A', 'R', 'T')) +#define INAM_MARKER (MAKE_MARKER ('I', 'N', 'A', 'M')) +#define IENG_MARKER (MAKE_MARKER ('I', 'E', 'N', 'G')) +#define IART_MARKER (MAKE_MARKER ('I', 'A', 'R', 'T')) +#define ICOP_MARKER (MAKE_MARKER ('I', 'C', 'O', 'P')) +#define IPRD_MARKER (MAKE_MARKER ('I', 'P', 'R', 'D')) +#define ISRC_MARKER (MAKE_MARKER ('I', 'S', 'R', 'C')) +#define ISBJ_MARKER (MAKE_MARKER ('I', 'S', 'B', 'J')) +#define ICMT_MARKER (MAKE_MARKER ('I', 'C', 'M', 'T')) + +/* Weird WAVPACK marker which can show up at the start of the DATA section. */ +#define wvpk_MARKER (MAKE_MARKER ('w', 'v', 'p', 'k')) +#define OggS_MARKER (MAKE_MARKER ('O', 'g', 'g', 'S')) + +enum +{ HAVE_RIFF = 0x01, + HAVE_WAVE = 0x02, + HAVE_fmt = 0x04, + HAVE_fact = 0x08, + HAVE_PEAK = 0x10, + HAVE_data = 0x20, + HAVE_other = 0x80000000 +} ; + + + +/* known WAVEFORMATEXTENSIBLE GUIDS */ +static const EXT_SUBFORMAT MSGUID_SUBTYPE_PCM = +{ 0x00000001, 0x0000, 0x0010, { 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 } +} ; + +static const EXT_SUBFORMAT MSGUID_SUBTYPE_MS_ADPCM = +{ 0x00000002, 0x0000, 0x0010, { 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 } +} ; + +static const EXT_SUBFORMAT MSGUID_SUBTYPE_IEEE_FLOAT = +{ 0x00000003, 0x0000, 0x0010, { 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 } +} ; + +static const EXT_SUBFORMAT MSGUID_SUBTYPE_ALAW = +{ 0x00000006, 0x0000, 0x0010, { 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 } +} ; + +static const EXT_SUBFORMAT MSGUID_SUBTYPE_MULAW = +{ 0x00000007, 0x0000, 0x0010, { 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 } +} ; + +#if 0 +/* maybe interesting one day to read the following through sf_read_raw */ +/* http://www.bath.ac.uk/~masrwd/pvocex/pvocex.html */ +static const EXT_SUBFORMAT MSGUID_SUBTYPE_PVOCEX = +{ 0x8312B9C2, 0x2E6E, 0x11d4, { 0xA8, 0x24, 0xDE, 0x5B, 0x96, 0xC3, 0xAB, 0x21 } +} ; +#endif + +/*------------------------------------------------------------------------------ +** Private static functions. +*/ + +static int wav_read_header (SF_PRIVATE *psf, int *blockalign, int *framesperblock) ; +static int wav_write_header (SF_PRIVATE *psf, int calc_length) ; + +static void wavex_write_guid (SF_PRIVATE *psf, const EXT_SUBFORMAT * subformat) ; +static int wavex_write_header (SF_PRIVATE *psf, int calc_length) ; + +static int wav_write_tailer (SF_PRIVATE *psf) ; +static void wav_write_strings (SF_PRIVATE *psf, int location) ; +static int wav_command (SF_PRIVATE *psf, int command, void *data, int datasize) ; +static int wav_close (SF_PRIVATE *psf) ; + +static int wav_subchunk_parse (SF_PRIVATE *psf, int chunk) ; +static int wav_read_smpl_chunk (SF_PRIVATE *psf, unsigned int chunklen) ; +static int wav_read_acid_chunk (SF_PRIVATE *psf, unsigned int chunklen) ; + +static int wavex_write_guid_equal (const EXT_SUBFORMAT * first, const EXT_SUBFORMAT * second) ; + +/*------------------------------------------------------------------------------ +** Public function. +*/ + +int +wav_open (SF_PRIVATE *psf) +{ int format, subformat, error, blockalign = 0, framesperblock = 0 ; + + if (psf->mode == SFM_READ || (psf->mode == SFM_RDWR && psf->filelength > 0)) + { if ((error = wav_read_header (psf, &blockalign, &framesperblock))) + return error ; + } ; + + subformat = psf->sf.format & SF_FORMAT_SUBMASK ; + + if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR) + { if (psf->is_pipe) + return SFE_NO_PIPE_WRITE ; + + format = psf->sf.format & SF_FORMAT_TYPEMASK ; + if (format != SF_FORMAT_WAV && format != SF_FORMAT_WAVEX) + return SFE_BAD_OPEN_FORMAT ; + + psf->endian = SF_ENDIAN_LITTLE ; /* All WAV files are little endian. */ + + psf->blockwidth = psf->bytewidth * psf->sf.channels ; + + if (psf->mode != SFM_RDWR || psf->filelength < 44) + { psf->filelength = 0 ; + psf->datalength = 0 ; + psf->dataoffset = 0 ; + psf->sf.frames = 0 ; + } ; + + if (subformat == SF_FORMAT_IMA_ADPCM || subformat == SF_FORMAT_MS_ADPCM) + { blockalign = wav_w64_srate2blocksize (psf->sf.samplerate * psf->sf.channels) ; + framesperblock = -1 ; /* Corrected later. */ + } ; + + psf->str_flags = SF_STR_ALLOW_START | SF_STR_ALLOW_END ; + + /* By default, add the peak chunk to floating point files. Default behaviour + ** can be switched off using sf_command (SFC_SET_PEAK_CHUNK, SF_FALSE). + */ + if (psf->mode == SFM_WRITE && (subformat == SF_FORMAT_FLOAT || subformat == SF_FORMAT_DOUBLE)) + { psf->pchunk = calloc (1, sizeof (PEAK_CHUNK) * psf->sf.channels * sizeof (PEAK_POS)) ; + if (psf->pchunk == NULL) + return SFE_MALLOC_FAILED ; + psf->has_peak = SF_TRUE ; + psf->peak_loc = SF_PEAK_START ; + } ; + + psf->write_header = (format == SF_FORMAT_WAV) ? wav_write_header : wavex_write_header ; + } ; + + psf->close = wav_close ; + psf->command = wav_command ; + + switch (subformat) + { case SF_FORMAT_PCM_U8 : + case SF_FORMAT_PCM_16 : + case SF_FORMAT_PCM_24 : + case SF_FORMAT_PCM_32 : + error = pcm_init (psf) ; + break ; + + case SF_FORMAT_ULAW : + error = ulaw_init (psf) ; + break ; + + case SF_FORMAT_ALAW : + error = alaw_init (psf) ; + break ; + + /* Lite remove start */ + case SF_FORMAT_FLOAT : + error = float32_init (psf) ; + break ; + + case SF_FORMAT_DOUBLE : + error = double64_init (psf) ; + break ; + + case SF_FORMAT_IMA_ADPCM : + error = wav_w64_ima_init (psf, blockalign, framesperblock) ; + break ; + + case SF_FORMAT_MS_ADPCM : + error = wav_w64_msadpcm_init (psf, blockalign, framesperblock) ; + break ; + /* Lite remove end */ + + case SF_FORMAT_GSM610 : + error = gsm610_init (psf) ; + break ; + + default : return SFE_UNIMPLEMENTED ; + } ; + + if (psf->mode == SFM_WRITE || (psf->mode == SFM_RDWR && psf->filelength == 0)) + return psf->write_header (psf, SF_FALSE) ; + + return error ; +} /* wav_open */ + +/*========================================================================= +** Private functions. +*/ + +static int +wav_read_header (SF_PRIVATE *psf, int *blockalign, int *framesperblock) +{ WAV_FMT wav_fmt ; + FACT_CHUNK fact_chunk ; + int dword, marker, RIFFsize, done = 0 ; + int parsestage = 0, error, format = 0 ; + char *cptr ; + + /* Set position to start of file to begin reading header. */ + psf_binheader_readf (psf, "p", 0) ; + + while (! done) + { psf_binheader_readf (psf, "m", &marker) ; + + switch (marker) + { case RIFF_MARKER : + if (parsestage) + return SFE_WAV_NO_RIFF ; + + parsestage |= HAVE_RIFF ; + + psf_binheader_readf (psf, "e4", &RIFFsize) ; + + if (psf->fileoffset > 0 && psf->filelength > RIFFsize + 8) + { /* Set file length. */ + psf->filelength = RIFFsize + 8 ; + psf_log_printf (psf, "RIFF : %u\n", RIFFsize) ; + } + else if (psf->filelength < RIFFsize + 2 * SIGNED_SIZEOF (dword)) + { psf_log_printf (psf, "RIFF : %u (should be %D)\n", RIFFsize, psf->filelength - 2 * SIGNED_SIZEOF (dword)) ; + RIFFsize = dword ; + } + else + psf_log_printf (psf, "RIFF : %u\n", RIFFsize) ; + + break ; + + case WAVE_MARKER : + if ((parsestage & HAVE_RIFF) != HAVE_RIFF) + return SFE_WAV_NO_WAVE ; + parsestage |= HAVE_WAVE ; + + psf_log_printf (psf, "WAVE\n") ; + break ; + + case fmt_MARKER : + if ((parsestage & (HAVE_RIFF | HAVE_WAVE)) != (HAVE_RIFF | HAVE_WAVE)) + return SFE_WAV_NO_FMT ; + + /* If this file has a SECOND fmt chunk, I don't want to know about it. */ + if (parsestage & HAVE_fmt) + break ; + + parsestage |= HAVE_fmt ; + + psf_binheader_readf (psf, "e4", &dword) ; + psf_log_printf (psf, "fmt : %d\n", dword) ; + + if ((error = wav_w64_read_fmt_chunk (psf, &wav_fmt, dword))) + return error ; + + format = wav_fmt.format ; + break ; + + case data_MARKER : + if ((parsestage & (HAVE_RIFF | HAVE_WAVE | HAVE_fmt)) != (HAVE_RIFF | HAVE_WAVE | HAVE_fmt)) + return SFE_WAV_NO_DATA ; + + if (psf->mode == SFM_RDWR && (parsestage & HAVE_other) != 0) + return SFE_RDWR_BAD_HEADER ; + + parsestage |= HAVE_data ; + + psf_binheader_readf (psf, "e4", &dword) ; + + psf->datalength = dword ; + psf->dataoffset = psf_ftell (psf) ; + + if (dword == 0 && RIFFsize == 8 && psf->filelength > 44) + { psf_log_printf (psf, "*** Looks like a WAV file which wasn't closed properly. Fixing it.\n") ; + psf->datalength = dword = psf->filelength - psf->dataoffset ; + } ; + + if (psf->datalength > psf->filelength - psf->dataoffset) + { psf_log_printf (psf, "data : %D (should be %D)\n", psf->datalength, psf->filelength - psf->dataoffset) ; + psf->datalength = psf->filelength - psf->dataoffset ; + } + else + psf_log_printf (psf, "data : %D\n", psf->datalength) ; + + /* Only set dataend if there really is data at the end. */ + if (psf->datalength + psf->dataoffset < psf->filelength) + psf->dataend = psf->datalength + psf->dataoffset ; + + if (format == WAVE_FORMAT_MS_ADPCM && psf->datalength % 2) + { psf->datalength ++ ; + psf_log_printf (psf, "*** Data length odd. Increasing it by 1.\n") ; + } ; + + if (! psf->sf.seekable) + break ; + + /* Seek past data and continue reading header. */ + psf_fseek (psf, psf->datalength, SEEK_CUR) ; + + dword = psf_ftell (psf) ; + if (dword != (sf_count_t) (psf->dataoffset + psf->datalength)) + psf_log_printf (psf, "*** psf_fseek past end error ***\n", dword, psf->dataoffset + psf->datalength) ; + break ; + + case fact_MARKER : + if ((parsestage & (HAVE_RIFF | HAVE_WAVE)) != (HAVE_RIFF | HAVE_WAVE)) + return SFE_WAV_BAD_FACT ; + + parsestage |= HAVE_fact ; + + if ((parsestage & HAVE_fmt) != HAVE_fmt) + psf_log_printf (psf, "*** Should have 'fmt ' chunk before 'fact'\n") ; + + psf_binheader_readf (psf, "e44", &dword, & (fact_chunk.frames)) ; + + if (dword > SIGNED_SIZEOF (fact_chunk)) + psf_binheader_readf (psf, "j", (int) (dword - SIGNED_SIZEOF (fact_chunk))) ; + + if (dword) + psf_log_printf (psf, "%M : %d\n", marker, dword) ; + else + psf_log_printf (psf, "%M : %d (should not be zero)\n", marker, dword) ; + + psf_log_printf (psf, " frames : %d\n", fact_chunk.frames) ; + break ; + + case PEAK_MARKER : + if ((parsestage & (HAVE_RIFF | HAVE_WAVE | HAVE_fmt)) != (HAVE_RIFF | HAVE_WAVE | HAVE_fmt)) + return SFE_WAV_PEAK_B4_FMT ; + + parsestage |= HAVE_PEAK ; + + psf_binheader_readf (psf, "e4", &dword) ; + + psf_log_printf (psf, "%M : %d\n", marker, dword) ; + if (dword != SIGNED_SIZEOF (PEAK_CHUNK) + psf->sf.channels * SIGNED_SIZEOF (PEAK_POS)) + { psf_binheader_readf (psf, "j", dword) ; + psf_log_printf (psf, "*** File PEAK chunk size doesn't fit with number of channels.\n") ; + return SFE_WAV_BAD_PEAK ; + } ; + + psf->pchunk = calloc (1, sizeof (PEAK_CHUNK) * psf->sf.channels * sizeof (PEAK_POS)) ; + if (psf->pchunk == NULL) + return SFE_MALLOC_FAILED ; + + /* read in rest of PEAK chunk. */ + psf_binheader_readf (psf, "e44", & (psf->pchunk->version), & (psf->pchunk->timestamp)) ; + + if (psf->pchunk->version != 1) + psf_log_printf (psf, " version : %d *** (should be version 1)\n", psf->pchunk->version) ; + else + psf_log_printf (psf, " version : %d\n", psf->pchunk->version) ; + + psf_log_printf (psf, " time stamp : %d\n", psf->pchunk->timestamp) ; + psf_log_printf (psf, " Ch Position Value\n") ; + + cptr = psf->u.cbuf ; + for (dword = 0 ; dword < psf->sf.channels ; dword++) + { psf_binheader_readf (psf, "ef4", & (psf->pchunk->peaks [dword].value), + & (psf->pchunk->peaks [dword].position)) ; + + LSF_SNPRINTF (cptr, sizeof (psf->u.cbuf), " %2d %-12d %g\n", + dword, psf->pchunk->peaks [dword].position, psf->pchunk->peaks [dword].value) ; + cptr [sizeof (psf->u.cbuf) - 1] = 0 ; + psf_log_printf (psf, cptr) ; + } ; + + psf->has_peak = SF_TRUE ; /* Found PEAK chunk. */ + psf->peak_loc = ((parsestage & HAVE_data) == 0) ? SF_PEAK_START : SF_PEAK_END ; + break ; + + case cue_MARKER : + parsestage |= HAVE_other ; + + { int bytesread, cue_count ; + int id, position, chunk_id, chunk_start, block_start, offset ; + + bytesread = psf_binheader_readf (psf, "e44", &dword, &cue_count) ; + bytesread -= 4 ; /* Remove bytes for first dword. */ + psf_log_printf (psf, "%M : %u\n Count : %d\n", marker, dword, cue_count) ; + + while (cue_count) + { bytesread += psf_binheader_readf (psf, "e444444", &id, &position, + &chunk_id, &chunk_start, &block_start, &offset) ; + psf_log_printf (psf, " Cue ID : %2d" + " Pos : %5u Chunk : %M" + " Chk Start : %d Blk Start : %d" + " Offset : %5d\n", + id, position, chunk_id, chunk_start, block_start, offset) ; + cue_count -- ; + } ; + + if (bytesread != dword) + { psf_log_printf (psf, "**** Chunk size weirdness (%d != %d)\n", dword, bytesread) ; + psf_binheader_readf (psf, "j", dword - bytesread) ; + } ; + } ; + break ; + + case smpl_MARKER : + parsestage |= HAVE_other ; + + psf_binheader_readf (psf, "e4", &dword) ; + psf_log_printf (psf, "smpl : %u\n", dword) ; + + if ((error = wav_read_smpl_chunk (psf, dword))) + return error ; + break ; + + case acid_MARKER : + parsestage |= HAVE_other ; + + psf_binheader_readf (psf, "e4", &dword) ; + psf_log_printf (psf, "acid : %u\n", dword) ; + + if ((error = wav_read_acid_chunk (psf, dword))) + return error ; + break ; + + case INFO_MARKER : + case LIST_MARKER : + parsestage |= HAVE_other ; + + if ((error = wav_subchunk_parse (psf, marker)) != 0) + return error ; + break ; + + case strc_MARKER : /* Multiple of 32 bytes. */ + + case afsp_MARKER : + case bext_MARKER : + case clm_MARKER : + case plst_MARKER : + case DISP_MARKER : + case MEXT_MARKER : + case PAD_MARKER : + parsestage |= HAVE_other ; + + psf_binheader_readf (psf, "e4", &dword) ; + psf_log_printf (psf, "%M : %u\n", marker, dword) ; + dword += (dword & 1) ; + psf_binheader_readf (psf, "j", dword) ; + break ; + + default : + if (isprint ((marker >> 24) & 0xFF) && isprint ((marker >> 16) & 0xFF) + && isprint ((marker >> 8) & 0xFF) && isprint (marker & 0xFF)) + { psf_binheader_readf (psf, "e4", &dword) ; + psf_log_printf (psf, "*** %M : %d (unknown marker)\n", marker, dword) ; + psf_binheader_readf (psf, "j", dword) ; + break ; + } ; + if (psf_ftell (psf) & 0x03) + { psf_log_printf (psf, " Unknown chunk marker at position %d. Resynching.\n", dword - 4) ; + psf_binheader_readf (psf, "j", -3) ; + break ; + } ; + psf_log_printf (psf, "*** Unknown chunk marker : %X. Exiting parser.\n", marker) ; + done = SF_TRUE ; + break ; + } ; /* switch (dword) */ + + if (! psf->sf.seekable && (parsestage & HAVE_data)) + break ; + + if (psf_ftell (psf) >= psf->filelength - SIGNED_SIZEOF (dword)) + { psf_log_printf (psf, "End\n") ; + break ; + } ; + + if (psf->logindex >= SIGNED_SIZEOF (psf->logbuffer) - 2) + return SFE_LOG_OVERRUN ; + } ; /* while (1) */ + + if (! psf->dataoffset) + return SFE_WAV_NO_DATA ; + + psf->endian = SF_ENDIAN_LITTLE ; /* All WAV files are little endian. */ + + psf_fseek (psf, psf->dataoffset, SEEK_SET) ; + + if (psf->is_pipe == 0) + { /* + ** Check for 'wvpk' at the start of the DATA section. Not able to + ** handle this. + */ + psf_binheader_readf (psf, "e4", &marker) ; + if (marker == wvpk_MARKER || marker == OggS_MARKER) + return SFE_WAV_WVPK_DATA ; + } ; + + /* Seek to start of DATA section. */ + psf_fseek (psf, psf->dataoffset, SEEK_SET) ; + + psf->close = wav_close ; + + if (psf->blockwidth) + { if (psf->filelength - psf->dataoffset < psf->datalength) + psf->sf.frames = (psf->filelength - psf->dataoffset) / psf->blockwidth ; + else + psf->sf.frames = psf->datalength / psf->blockwidth ; + } ; + + switch (format) + { + + case WAVE_FORMAT_EXTENSIBLE : + /* compare GUIDs for known ones */ + if (wavex_write_guid_equal (&wav_fmt.ext.esf, &MSGUID_SUBTYPE_PCM)) + psf->sf.format = SF_FORMAT_WAVEX | u_bitwidth_to_subformat (psf->bytewidth * 8) ; + else + if (wavex_write_guid_equal (&wav_fmt.ext.esf, &MSGUID_SUBTYPE_MS_ADPCM)) + { psf->sf.format = (SF_FORMAT_WAVEX | SF_FORMAT_MS_ADPCM) ; + *blockalign = wav_fmt.msadpcm.blockalign ; + *framesperblock = wav_fmt.msadpcm.samplesperblock ; + } + else if (wavex_write_guid_equal (&wav_fmt.ext.esf, &MSGUID_SUBTYPE_IEEE_FLOAT)) + psf->sf.format = SF_FORMAT_WAVEX | ((psf->bytewidth == 8) ? SF_FORMAT_DOUBLE : SF_FORMAT_FLOAT) ; + else if (wavex_write_guid_equal (&wav_fmt.ext.esf, &MSGUID_SUBTYPE_ALAW)) + psf->sf.format = (SF_FORMAT_WAVEX | SF_FORMAT_ALAW) ; + else if (wavex_write_guid_equal (&wav_fmt.ext.esf, &MSGUID_SUBTYPE_MULAW)) + psf->sf.format = (SF_FORMAT_WAVEX | SF_FORMAT_ULAW) ; + else + return SFE_UNIMPLEMENTED ; + break ; + + case WAVE_FORMAT_PCM : + psf->sf.format = SF_FORMAT_WAV | u_bitwidth_to_subformat (psf->bytewidth * 8) ; + break ; + + case WAVE_FORMAT_MULAW : + case IBM_FORMAT_MULAW : + psf->sf.format = (SF_FORMAT_WAV | SF_FORMAT_ULAW) ; + break ; + + case WAVE_FORMAT_ALAW : + case IBM_FORMAT_ALAW : + psf->sf.format = (SF_FORMAT_WAV | SF_FORMAT_ALAW) ; + break ; + + case WAVE_FORMAT_MS_ADPCM : + psf->sf.format = (SF_FORMAT_WAV | SF_FORMAT_MS_ADPCM) ; + *blockalign = wav_fmt.msadpcm.blockalign ; + *framesperblock = wav_fmt.msadpcm.samplesperblock ; + break ; + + case WAVE_FORMAT_IMA_ADPCM : + psf->sf.format = (SF_FORMAT_WAV | SF_FORMAT_IMA_ADPCM) ; + *blockalign = wav_fmt.ima.blockalign ; + *framesperblock = wav_fmt.ima.samplesperblock ; + break ; + + case WAVE_FORMAT_GSM610 : + psf->sf.format = (SF_FORMAT_WAV | SF_FORMAT_GSM610) ; + break ; + + case WAVE_FORMAT_IEEE_FLOAT : + psf->sf.format = SF_FORMAT_WAV ; + psf->sf.format |= (psf->bytewidth == 8) ? SF_FORMAT_DOUBLE : SF_FORMAT_FLOAT ; + break ; + + default : return SFE_UNIMPLEMENTED ; + } ; + + return 0 ; +} /* wav_read_header */ + +static int +wav_write_header (SF_PRIVATE *psf, int calc_length) +{ sf_count_t current ; + int fmt_size, k, subformat, add_fact_chunk = SF_FALSE ; + + current = psf_ftell (psf) ; + + if (calc_length) + { psf->filelength = psf_get_filelen (psf) ; + + psf->datalength = psf->filelength - psf->dataoffset ; + + if (psf->dataend) + psf->datalength -= psf->filelength - psf->dataend ; + + if (psf->bytewidth > 0) + psf->sf.frames = psf->datalength / (psf->bytewidth * psf->sf.channels) ; + } ; + + /* Reset the current header length to zero. */ + psf->header [0] = 0 ; + psf->headindex = 0 ; + psf_fseek (psf, 0, SEEK_SET) ; + + /* RIFF marker, length, WAVE and 'fmt ' markers. */ + if (psf->filelength < 8) + psf_binheader_writef (psf, "etm8", RIFF_MARKER, 8) ; + else + psf_binheader_writef (psf, "etm8", RIFF_MARKER, psf->filelength - 8) ; + + /* WAVE and 'fmt ' markers. */ + psf_binheader_writef (psf, "emm", WAVE_MARKER, fmt_MARKER) ; + + subformat = psf->sf.format & SF_FORMAT_SUBMASK ; + + switch (subformat) + { case SF_FORMAT_PCM_U8 : + case SF_FORMAT_PCM_16 : + case SF_FORMAT_PCM_24 : + case SF_FORMAT_PCM_32 : + fmt_size = 2 + 2 + 4 + 4 + 2 + 2 ; + + /* fmt : format, channels, samplerate */ + psf_binheader_writef (psf, "e4224", fmt_size, WAVE_FORMAT_PCM, psf->sf.channels, psf->sf.samplerate) ; + /* fmt : bytespersec */ + psf_binheader_writef (psf, "e4", psf->sf.samplerate * psf->bytewidth * psf->sf.channels) ; + /* fmt : blockalign, bitwidth */ + psf_binheader_writef (psf, "e22", psf->bytewidth * psf->sf.channels, psf->bytewidth * 8) ; + break ; + + case SF_FORMAT_FLOAT : + case SF_FORMAT_DOUBLE : + fmt_size = 2 + 2 + 4 + 4 + 2 + 2 ; + + /* fmt : format, channels, samplerate */ + psf_binheader_writef (psf, "e4224", fmt_size, WAVE_FORMAT_IEEE_FLOAT, psf->sf.channels, psf->sf.samplerate) ; + /* fmt : bytespersec */ + psf_binheader_writef (psf, "e4", psf->sf.samplerate * psf->bytewidth * psf->sf.channels) ; + /* fmt : blockalign, bitwidth */ + psf_binheader_writef (psf, "e22", psf->bytewidth * psf->sf.channels, psf->bytewidth * 8) ; + + add_fact_chunk = SF_TRUE ; + break ; + + case SF_FORMAT_ULAW : + fmt_size = 2 + 2 + 4 + 4 + 2 + 2 ; + + /* fmt : format, channels, samplerate */ + psf_binheader_writef (psf, "e4224", fmt_size, WAVE_FORMAT_MULAW, psf->sf.channels, psf->sf.samplerate) ; + /* fmt : bytespersec */ + psf_binheader_writef (psf, "e4", psf->sf.samplerate * psf->bytewidth * psf->sf.channels) ; + /* fmt : blockalign, bitwidth */ + psf_binheader_writef (psf, "e22", psf->bytewidth * psf->sf.channels, 8) ; + + add_fact_chunk = SF_TRUE ; + break ; + + case SF_FORMAT_ALAW : + fmt_size = 2 + 2 + 4 + 4 + 2 + 2 ; + + /* fmt : format, channels, samplerate */ + psf_binheader_writef (psf, "e4224", fmt_size, WAVE_FORMAT_ALAW, psf->sf.channels, psf->sf.samplerate) ; + /* fmt : bytespersec */ + psf_binheader_writef (psf, "e4", psf->sf.samplerate * psf->bytewidth * psf->sf.channels) ; + /* fmt : blockalign, bitwidth */ + psf_binheader_writef (psf, "e22", psf->bytewidth * psf->sf.channels, 8) ; + + add_fact_chunk = SF_TRUE ; + break ; + + /* Lite remove start */ + case SF_FORMAT_IMA_ADPCM : + { int blockalign, framesperblock, bytespersec ; + + blockalign = wav_w64_srate2blocksize (psf->sf.samplerate * psf->sf.channels) ; + framesperblock = 2 * (blockalign - 4 * psf->sf.channels) / psf->sf.channels + 1 ; + bytespersec = (psf->sf.samplerate * blockalign) / framesperblock ; + + /* fmt chunk. */ + fmt_size = 2 + 2 + 4 + 4 + 2 + 2 + 2 + 2 ; + + /* fmt : size, WAV format type, channels, samplerate, bytespersec */ + psf_binheader_writef (psf, "e42244", fmt_size, WAVE_FORMAT_IMA_ADPCM, + psf->sf.channels, psf->sf.samplerate, bytespersec) ; + + /* fmt : blockalign, bitwidth, extrabytes, framesperblock. */ + psf_binheader_writef (psf, "e2222", blockalign, 4, 2, framesperblock) ; + } ; + + add_fact_chunk = SF_TRUE ; + break ; + + case SF_FORMAT_MS_ADPCM : + { int blockalign, framesperblock, bytespersec, extrabytes ; + + blockalign = wav_w64_srate2blocksize (psf->sf.samplerate * psf->sf.channels) ; + framesperblock = 2 + 2 * (blockalign - 7 * psf->sf.channels) / psf->sf.channels ; + bytespersec = (psf->sf.samplerate * blockalign) / framesperblock ; + + /* fmt chunk. */ + extrabytes = 2 + 2 + MSADPCM_ADAPT_COEFF_COUNT * (2 + 2) ; + fmt_size = 2 + 2 + 4 + 4 + 2 + 2 + 2 + extrabytes ; + + /* fmt : size, WAV format type, channels. */ + psf_binheader_writef (psf, "e422", fmt_size, WAVE_FORMAT_MS_ADPCM, psf->sf.channels) ; + + /* fmt : samplerate, bytespersec. */ + psf_binheader_writef (psf, "e44", psf->sf.samplerate, bytespersec) ; + + /* fmt : blockalign, bitwidth, extrabytes, framesperblock. */ + psf_binheader_writef (psf, "e22222", blockalign, 4, extrabytes, framesperblock, 7) ; + + msadpcm_write_adapt_coeffs (psf) ; + } ; + + add_fact_chunk = SF_TRUE ; + break ; + /* Lite remove end */ + + case SF_FORMAT_GSM610 : + { int blockalign, framesperblock, bytespersec ; + + blockalign = WAV_W64_GSM610_BLOCKSIZE ; + framesperblock = WAV_W64_GSM610_SAMPLES ; + bytespersec = (psf->sf.samplerate * blockalign) / framesperblock ; + + /* fmt chunk. */ + fmt_size = 2 + 2 + 4 + 4 + 2 + 2 + 2 + 2 ; + + /* fmt : size, WAV format type, channels. */ + psf_binheader_writef (psf, "e422", fmt_size, WAVE_FORMAT_GSM610, psf->sf.channels) ; + + /* fmt : samplerate, bytespersec. */ + psf_binheader_writef (psf, "e44", psf->sf.samplerate, bytespersec) ; + + /* fmt : blockalign, bitwidth, extrabytes, framesperblock. */ + psf_binheader_writef (psf, "e2222", blockalign, 0, 2, framesperblock) ; + } ; + + add_fact_chunk = SF_TRUE ; + break ; + + default : return SFE_UNIMPLEMENTED ; + } ; + + if (add_fact_chunk) + psf_binheader_writef (psf, "etm48", fact_MARKER, 4, psf->sf.frames) ; + + if (psf->str_flags & SF_STR_LOCATE_START) + wav_write_strings (psf, SF_STR_LOCATE_START) ; + + if (psf->has_peak && psf->peak_loc == SF_PEAK_START) + { psf_binheader_writef (psf, "em4", PEAK_MARKER, + sizeof (PEAK_CHUNK) + psf->sf.channels * sizeof (PEAK_POS)) ; + psf_binheader_writef (psf, "e44", 1, time (NULL)) ; + for (k = 0 ; k < psf->sf.channels ; k++) + psf_binheader_writef (psf, "ef4", psf->pchunk->peaks [k].value, psf->pchunk->peaks [k].position) ; + } ; + + psf_binheader_writef (psf, "etm8", data_MARKER, psf->datalength) ; + psf_fwrite (psf->header, psf->headindex, 1, psf) ; + if (psf->error) + return psf->error ; + + psf->dataoffset = psf->headindex ; + + if (current < psf->dataoffset) + psf_fseek (psf, psf->dataoffset, SEEK_SET) ; + else if (current > 0) + psf_fseek (psf, current, SEEK_SET) ; + + return psf->error ; +} /* wav_write_header */ + + + +static int +wavex_write_guid_equal (const EXT_SUBFORMAT * first, const EXT_SUBFORMAT * second) +{ return !memcmp (first, second, sizeof (EXT_SUBFORMAT)) ; +} /* wavex_write_guid_equal */ + + +static void +wavex_write_guid (SF_PRIVATE *psf, const EXT_SUBFORMAT * subformat) +{ + psf_binheader_writef (psf, "e422b", subformat->esf_field1, + subformat->esf_field2, subformat->esf_field3, + subformat->esf_field4, 8) ; +} /* wavex_write_guid */ + + +static int +wavex_write_header (SF_PRIVATE *psf, int calc_length) +{ sf_count_t current ; + int fmt_size, k, subformat, add_fact_chunk = SF_FALSE ; + + current = psf_ftell (psf) ; + + if (calc_length) + { psf->filelength = psf_get_filelen (psf) ; + + psf->datalength = psf->filelength - psf->dataoffset ; + + if (psf->dataend) + psf->datalength -= psf->filelength - psf->dataend ; + + if (psf->bytewidth > 0) + psf->sf.frames = psf->datalength / (psf->bytewidth * psf->sf.channels) ; + } ; + + + /* Reset the current header length to zero. */ + psf->header [0] = 0 ; + psf->headindex = 0 ; + psf_fseek (psf, 0, SEEK_SET) ; + + /* RIFF marker, length, WAVE and 'fmt ' markers. */ + if (psf->filelength < 8) + psf_binheader_writef (psf, "etm8", RIFF_MARKER, 8) ; + else + psf_binheader_writef (psf, "etm8", RIFF_MARKER, psf->filelength - 8) ; + + /* WAVE and 'fmt ' markers. */ + psf_binheader_writef (psf, "emm", WAVE_MARKER, fmt_MARKER) ; + + subformat = psf->sf.format & SF_FORMAT_SUBMASK ; + + /* initial section (same for all, it appears) */ + switch (subformat) + { case SF_FORMAT_PCM_U8 : + case SF_FORMAT_PCM_16 : + case SF_FORMAT_PCM_24 : + case SF_FORMAT_PCM_32 : + case SF_FORMAT_FLOAT : + case SF_FORMAT_DOUBLE : + case SF_FORMAT_ULAW : + case SF_FORMAT_ALAW : + fmt_size = 2 + 2 + 4 + 4 + 2 + 2 + 2 + 2 + 4 + 4 + 2 + 2 + 8 ; + + /* fmt : format, channels, samplerate */ + psf_binheader_writef (psf, "e4224", fmt_size, WAVE_FORMAT_EXTENSIBLE, psf->sf.channels, psf->sf.samplerate) ; + /* fmt : bytespersec */ + psf_binheader_writef (psf, "e4", psf->sf.samplerate * psf->bytewidth * psf->sf.channels) ; + /* fmt : blockalign, bitwidth */ + psf_binheader_writef (psf, "e22", psf->bytewidth * psf->sf.channels, psf->bytewidth * 8) ; + + /* cbSize 22 is sizeof (WAVEFORMATEXTENSIBLE) - sizeof (WAVEFORMATEX) */ + psf_binheader_writef (psf, "e2", 22) ; + + /* wValidBitsPerSample, for our use same as bitwidth as we use it fully */ + psf_binheader_writef (psf, "e2", psf->bytewidth * 8) ; + + if (psf->sf.channels == 2) + psf_binheader_writef (psf, "e4", 0x1 | 0x2 ) ; /* dwChannelMask front left and right */ + else + psf_binheader_writef (psf, "e4", 0) ; /* dwChannelMask = 0 when in doubt */ + break ; + + case SF_FORMAT_MS_ADPCM : /* todo, GUID exists might have different header as per wav_write_header */ + default : return SFE_UNIMPLEMENTED ; + } ; + + /* GUI section, different for each */ + + switch (subformat) + { case SF_FORMAT_PCM_U8 : + case SF_FORMAT_PCM_16 : + case SF_FORMAT_PCM_24 : + case SF_FORMAT_PCM_32 : + wavex_write_guid (psf, &MSGUID_SUBTYPE_PCM) ; + break ; + + case SF_FORMAT_FLOAT : + case SF_FORMAT_DOUBLE : + wavex_write_guid (psf, &MSGUID_SUBTYPE_IEEE_FLOAT) ; + add_fact_chunk = SF_TRUE ; + break ; + + case SF_FORMAT_ULAW : + wavex_write_guid (psf, &MSGUID_SUBTYPE_MULAW) ; + add_fact_chunk = SF_TRUE ; + break ; + + case SF_FORMAT_ALAW : + wavex_write_guid (psf, &MSGUID_SUBTYPE_ALAW) ; + add_fact_chunk = SF_TRUE ; + break ; + + case SF_FORMAT_MS_ADPCM : /* todo, GUID exists */ + + default : return SFE_UNIMPLEMENTED ; + } ; + + + if (add_fact_chunk) + psf_binheader_writef (psf, "etm48", fact_MARKER, 4, psf->sf.frames) ; + + if (psf->str_flags & SF_STR_LOCATE_START) + wav_write_strings (psf, SF_STR_LOCATE_START) ; + + if (psf->has_peak && psf->peak_loc == SF_PEAK_START) + { psf_binheader_writef (psf, "em4", PEAK_MARKER, + sizeof (PEAK_CHUNK) + psf->sf.channels * sizeof (PEAK_POS)) ; + psf_binheader_writef (psf, "e44", 1, time (NULL)) ; + for (k = 0 ; k < psf->sf.channels ; k++) + psf_binheader_writef (psf, "ef4", psf->pchunk->peaks [k].value, psf->pchunk->peaks [k].position) ; + } ; + + psf_binheader_writef (psf, "etm8", data_MARKER, psf->datalength) ; + psf_fwrite (psf->header, psf->headindex, 1, psf) ; + if (psf->error) + return psf->error ; + + psf->dataoffset = psf->headindex ; + + if (current < psf->dataoffset) + psf_fseek (psf, psf->dataoffset, SEEK_SET) ; + else if (current > 0) + psf_fseek (psf, current, SEEK_SET) ; + + return psf->error ; +} /* wavex_write_header */ + + + +static int +wav_write_tailer (SF_PRIVATE *psf) +{ int k ; + + /* Reset the current header buffer length to zero. */ + psf->header [0] = 0 ; + psf->headindex = 0 ; + + psf->dataend = psf_fseek (psf, 0, SEEK_END) ; + + /* Add a PEAK chunk if requested. */ + if (psf->has_peak && psf->peak_loc == SF_PEAK_END) + { psf_binheader_writef (psf, "em4", PEAK_MARKER, + sizeof (PEAK_CHUNK) + psf->sf.channels * sizeof (PEAK_POS)) ; + psf_binheader_writef (psf, "e44", 1, time (NULL)) ; + for (k = 0 ; k < psf->sf.channels ; k++) + psf_binheader_writef (psf, "ef4", psf->pchunk->peaks [k].value, psf->pchunk->peaks [k].position) ; + } ; + + if (psf->str_flags & SF_STR_LOCATE_END) + wav_write_strings (psf, SF_STR_LOCATE_END) ; + + /* Write the tailer. */ + if (psf->headindex > 0) + psf_fwrite (psf->header, psf->headindex, 1, psf) ; + + return 0 ; +} /* wav_write_tailer */ + +static void +wav_write_strings (SF_PRIVATE *psf, int location) +{ int k, prev_head_index, saved_head_index ; + + prev_head_index = psf->headindex + 4 ; + + psf_binheader_writef (psf, "em4m", LIST_MARKER, 0xBADBAD, INFO_MARKER) ; + + for (k = 0 ; k < SF_MAX_STRINGS ; k++) + { if (psf->strings [k].type == 0) + break ; + if (psf->strings [k].flags != location) + continue ; + + switch (psf->strings [k].type) + { case SF_STR_SOFTWARE : + psf_binheader_writef (psf, "ems", ISFT_MARKER, psf->strings [k].str) ; + break ; + + case SF_STR_TITLE : + psf_binheader_writef (psf, "ems", INAM_MARKER, psf->strings [k].str) ; + break ; + + case SF_STR_COPYRIGHT : + psf_binheader_writef (psf, "ems", ICOP_MARKER, psf->strings [k].str) ; + break ; + + case SF_STR_ARTIST : + psf_binheader_writef (psf, "ems", IART_MARKER, psf->strings [k].str) ; + break ; + + case SF_STR_COMMENT : + psf_binheader_writef (psf, "ems", ICMT_MARKER, psf->strings [k].str) ; + break ; + + case SF_STR_DATE : + psf_binheader_writef (psf, "ems", ICRD_MARKER, psf->strings [k].str) ; + break ; + } ; + } ; + + saved_head_index = psf->headindex ; + psf->headindex = prev_head_index ; + psf_binheader_writef (psf, "e4", saved_head_index - prev_head_index - 4) ; + psf->headindex = saved_head_index ; + +} /* wav_write_strings */ + +static int +wav_close (SF_PRIVATE *psf) +{ + if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR) + { wav_write_tailer (psf) ; + + if ((psf->sf.format & SF_FORMAT_TYPEMASK) == SF_FORMAT_WAV) + wav_write_header (psf, SF_TRUE) ; + else + wavex_write_header (psf, SF_TRUE) ; + } ; + + return 0 ; +} /* wav_close */ + +static int +wav_command (SF_PRIVATE *psf, int command, void *data, int datasize) +{ + /* Avoid compiler warnings. */ + psf = psf ; + data = data ; + datasize = datasize ; + + switch (command) + { default : break ; + } ; + + return 0 ; +} /* wav_command */ + +static int +wav_subchunk_parse (SF_PRIVATE *psf, int chunk) +{ sf_count_t current_pos ; + char *cptr ; + int dword, bytesread, length ; + + current_pos = psf_fseek (psf, 0, SEEK_CUR) ; + + bytesread = psf_binheader_readf (psf, "e4", &length) ; + + if (current_pos + length > psf->filelength) + { psf_log_printf (psf, "%M : %d (should be %d)\n", chunk, length, (int) (psf->filelength - current_pos)) ; + length = psf->filelength - current_pos ; + } + else + psf_log_printf (psf, "%M : %d\n", chunk, length) ; + + + while (bytesread < length) + { bytesread += psf_binheader_readf (psf, "m", &chunk) ; + + switch (chunk) + { case adtl_MARKER : + case INFO_MARKER : + /* These markers don't contain anything. */ + psf_log_printf (psf, " %M\n", chunk) ; + break ; + + case data_MARKER: + psf_log_printf (psf, " %M inside a LIST block??? Backing out.\n", chunk) ; + /* Jump back four bytes and return to caller. */ + psf_binheader_readf (psf, "j", -4) ; + return 0 ; + + case ISFT_MARKER : + case ICOP_MARKER : + case IARL_MARKER : + case IART_MARKER : + case ICMT_MARKER : + case ICRD_MARKER : + case IENG_MARKER : + + case INAM_MARKER : + case IPRD_MARKER : + case ISBJ_MARKER : + case ISRC_MARKER : + bytesread += psf_binheader_readf (psf, "e4", &dword) ; + dword += (dword & 1) ; + if (dword > SIGNED_SIZEOF (psf->u.cbuf)) + { psf_log_printf (psf, " *** %M : %d (too big)\n", chunk, dword) ; + return SFE_INTERNAL ; + } ; + + cptr = psf->u.cbuf ; + psf_binheader_readf (psf, "b", cptr, dword) ; + bytesread += dword ; + cptr [dword - 1] = 0 ; + psf_log_printf (psf, " %M : %s\n", chunk, cptr) ; + break ; + + case labl_MARKER : + { int mark_id ; + + bytesread += psf_binheader_readf (psf, "e44", &dword, &mark_id) ; + dword -= 4 ; + dword += (dword & 1) ; + if (dword > SIGNED_SIZEOF (psf->u.cbuf)) + { psf_log_printf (psf, " *** %M : %d (too big)\n", chunk, dword) ; + return SFE_INTERNAL ; + } ; + + cptr = psf->u.cbuf ; + psf_binheader_readf (psf, "b", cptr, dword) ; + bytesread += dword ; + cptr [dword - 1] = 0 ; + psf_log_printf (psf, " %M : %d : %s\n", chunk, mark_id, cptr) ; + } ; + break ; + + + case DISP_MARKER : + case ltxt_MARKER : + case note_MARKER : + bytesread += psf_binheader_readf (psf, "e4", &dword) ; + dword += (dword & 1) ; + psf_binheader_readf (psf, "j", dword) ; + bytesread += dword ; + psf_log_printf (psf, " %M : %d\n", chunk, dword) ; + break ; + + default : + psf_binheader_readf (psf, "e4", &dword) ; + bytesread += sizeof (dword) ; + dword += (dword & 1) ; + psf_binheader_readf (psf, "j", dword) ; + bytesread += dword ; + psf_log_printf (psf, " *** %M : %d\n", chunk, dword) ; + if (dword > length) + return 0 ; + break ; + } ; + + switch (chunk) + { case ISFT_MARKER : + psf_store_string (psf, SF_STR_SOFTWARE, psf->u.cbuf) ; + break ; + case ICOP_MARKER : + psf_store_string (psf, SF_STR_COPYRIGHT, psf->u.cbuf) ; + break ; + case INAM_MARKER : + psf_store_string (psf, SF_STR_TITLE, psf->u.cbuf) ; + break ; + case IART_MARKER : + psf_store_string (psf, SF_STR_ARTIST, psf->u.cbuf) ; + break ; + case ICMT_MARKER : + psf_store_string (psf, SF_STR_COMMENT, psf->u.cbuf) ; + break ; + case ICRD_MARKER : + psf_store_string (psf, SF_STR_DATE, psf->u.cbuf) ; + break ; + } ; + + if (psf->logindex >= SIGNED_SIZEOF (psf->logbuffer) - 2) + return SFE_LOG_OVERRUN ; + } ; + + current_pos = psf_fseek (psf, 0, SEEK_CUR) - current_pos ; + + if (current_pos - 4 != length) + psf_log_printf (psf, "**** Bad chunk length %d sbould be %D\n", length, current_pos - 4) ; + + return 0 ; +} /* wav_subchunk_parse */ + +static int +wav_read_smpl_chunk (SF_PRIVATE *psf, unsigned int chunklen) +{ unsigned int bytesread = 0, dword, sampler_data, loop_count ; + int k ; + + chunklen += (chunklen & 1) ; + + bytesread += psf_binheader_readf (psf, "e4", &dword) ; + psf_log_printf (psf, " Manufacturer : %X\n", dword) ; + + bytesread += psf_binheader_readf (psf, "e4", &dword) ; + psf_log_printf (psf, " Product : %u\n", dword) ; + + bytesread += psf_binheader_readf (psf, "e4", &dword) ; + psf_log_printf (psf, " Period : %u nsec\n", dword) ; + + bytesread += psf_binheader_readf (psf, "e4", &dword) ; + psf_log_printf (psf, " Midi Note : %u\n", dword) ; + + bytesread += psf_binheader_readf (psf, "e4", &dword) ; + if (dword != 0) + { LSF_SNPRINTF (psf->u.cbuf, sizeof (psf->u.cbuf), "%f", + (1.0 * 0x80000000) / ((unsigned int) dword)) ; + psf_log_printf (psf, " Pitch Fract. : %s\n", psf->u.cbuf) ; + } + else + psf_log_printf (psf, " Pitch Fract. : 0\n") ; + + bytesread += psf_binheader_readf (psf, "e4", &dword) ; + psf_log_printf (psf, " SMPTE Format : %u\n", dword) ; + + bytesread += psf_binheader_readf (psf, "e4", &dword) ; + LSF_SNPRINTF (psf->u.cbuf, sizeof (psf->u.cbuf), "%02d:%02d:%02d %02d", + (dword >> 24) & 0x7F, (dword >> 16) & 0x7F, (dword >> 8) & 0x7F, dword & 0x7F) ; + psf_log_printf (psf, " SMPTE Offset : %s\n", psf->u.cbuf) ; + + bytesread += psf_binheader_readf (psf, "e4", &loop_count) ; + psf_log_printf (psf, " Loop Count : %u\n", loop_count) ; + + /* Sampler Data holds the number of data bytes after the CUE chunks which + ** is not actually CUE data. Display value after CUE data. + */ + bytesread += psf_binheader_readf (psf, "e4", &sampler_data) ; + + while (loop_count > 0 && chunklen - bytesread >= 24) + { + bytesread += psf_binheader_readf (psf, "e4", &dword) ; + psf_log_printf (psf, " Cue ID : %2u", dword) ; + + bytesread += psf_binheader_readf (psf, "e4", &dword) ; + psf_log_printf (psf, " Type : %2u", dword) ; + + bytesread += psf_binheader_readf (psf, "e4", &dword) ; + psf_log_printf (psf, " Start : %5u", dword) ; + + bytesread += psf_binheader_readf (psf, "e4", &dword) ; + psf_log_printf (psf, " End : %5u", dword) ; + + bytesread += psf_binheader_readf (psf, "e4", &dword) ; + psf_log_printf (psf, " Fraction : %5u", dword) ; + + bytesread += psf_binheader_readf (psf, "e4", &dword) ; + psf_log_printf (psf, " Count : %5u\n", dword) ; + + loop_count -- ; + } ; + + if (chunklen - bytesread == 0) + { if (sampler_data != 0) + psf_log_printf (psf, " Sampler Data : %u (should be 0)\n", sampler_data) ; + else + psf_log_printf (psf, " Sampler Data : %u\n", sampler_data) ; + } + else + { if (sampler_data != chunklen - bytesread) + { psf_log_printf (psf, " Sampler Data : %u (should have been %u)\n", sampler_data, chunklen - bytesread) ; + sampler_data = chunklen - bytesread ; + } + else + psf_log_printf (psf, " Sampler Data : %u\n", sampler_data) ; + + psf_log_printf (psf, " ") ; + for (k = 0 ; k < (int) sampler_data ; k++) + { char ch ; + + if (k > 0 && (k % 20) == 0) + psf_log_printf (psf, "\n ") ; + + bytesread += psf_binheader_readf (psf, "1", &ch) ; + psf_log_printf (psf, "%02X ", ch & 0xFF) ; + } ; + + psf_log_printf (psf, "\n") ; + } ; + + return 0 ; +} /* wav_read_smpl_chunk */ + +/* +** The acid chunk goes a little something like this: +** +** 4 bytes 'acid' +** 4 bytes (int) length of chunk starting at next byte +** +** 4 bytes (int) type of file: +** this appears to be a bit mask,however some combinations +** are probably impossible and/or qualified as "errors" +** +** 0x01 On: One Shot Off: Loop +** 0x02 On: Root note is Set Off: No root +** 0x04 On: Stretch is On, Off: Strech is OFF +** 0x08 On: Disk Based Off: Ram based +** 0x10 On: ?????????? Off: ????????? (Acidizer puts that ON) +** +** 2 bytes (short) root note +** if type 0x10 is OFF : [C,C#,(...),B] -> [0x30 to 0x3B] +** if type 0x10 is ON : [C,C#,(...),B] -> [0x3C to 0x47] +** (both types fit on same MIDI pitch albeit different octaves, so who cares) +** +** 2 bytes (short) ??? always set to 0x8000 +** 4 bytes (float) ??? seems to be always 0 +** 4 bytes (int) number of beats +** 2 bytes (short) meter denominator //always 4 in SF/ACID +** 2 bytes (short) meter numerator //always 4 in SF/ACID +** //are we sure about the order?? usually its num/denom +** 4 bytes (float) tempo +** +*/ + +static int +wav_read_acid_chunk (SF_PRIVATE *psf, unsigned int chunklen) +{ unsigned int bytesread = 0 ; + int beats, flags ; + short rootnote, q1, meter_denom, meter_numer ; + float q2, tempo ; + + chunklen += (chunklen & 1) ; + + bytesread += psf_binheader_readf (psf, "e422f", &flags, &rootnote, &q1, &q2) ; + + LSF_SNPRINTF (psf->u.cbuf, sizeof (psf->u.cbuf), "%f", q2) ; + + psf_log_printf (psf, " Flags : 0x%04x (%s,%s,%s,%s,%s)\n", flags, + (flags & 0x01) ? "OneShot" : "Loop", + (flags & 0x02) ? "RootNoteValid" : "RootNoteInvalid", + (flags & 0x04) ? "StretchOn" : "StretchOff", + (flags & 0x08) ? "DiskBased" : "RAMBased", + (flags & 0x10) ? "??On" : "??Off") ; + + psf_log_printf (psf, " Root note : 0x%x\n ???? : 0x%04x\n ???? : %s\n", + rootnote, q1, psf->u.cbuf) ; + + bytesread += psf_binheader_readf (psf, "e422f", &beats, &meter_denom, &meter_numer, &tempo) ; + LSF_SNPRINTF (psf->u.cbuf, sizeof (psf->u.cbuf), "%f", tempo) ; + psf_log_printf (psf, " Beats : %d\n Meter : %d/%d\n Tempo : %s\n", + beats, meter_numer, meter_denom, psf->u.cbuf) ; + + psf_binheader_readf (psf, "j", chunklen - bytesread) ; + + if ((psf->loop_info = calloc (1, sizeof (SF_LOOP_INFO))) == NULL) + return SFE_MALLOC_FAILED ; + + psf->loop_info->time_sig_num = meter_numer ; + psf->loop_info->time_sig_den = meter_denom ; + psf->loop_info->loop_mode = (flags & 0x01) ? SF_LOOP_NONE : SF_LOOP_FORWARD ; + psf->loop_info->num_beats = beats ; + psf->loop_info->bpm = tempo ; + psf->loop_info->root_key = (flags & 0x02) ? rootnote : -1 ; + + return 0 ; +} /* wav_read_acid_chunk */ + +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: 9c551689-a1d8-4905-9f56-26a204374f18 +*/ diff --git a/Libraries/SndFile/Files/src/wav_w64.c b/Libraries/SndFile/Files/src/wav_w64.c new file mode 100644 index 000000000..8af881078 --- /dev/null +++ b/Libraries/SndFile/Files/src/wav_w64.c @@ -0,0 +1,386 @@ +/* +** Copyright (C) 1999-2004 Erik de Castro Lopo +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU Lesser General Public License as published by +** the Free Software Foundation; either version 2.1 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU Lesser General Public License for more details. +** +** You should have received a copy of the GNU Lesser General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include +#include +#include +#include + +#include "sndfile.h" +#include "config.h" +#include "sfendian.h" +#include "common.h" +#include "wav_w64.h" + +/*------------------------------------------------------------------------------ + * Private static functions. + */ + +int +wav_w64_read_fmt_chunk (SF_PRIVATE *psf, WAV_FMT *wav_fmt, int structsize) +{ int bytesread, k, bytespersec = 0 ; + + memset (wav_fmt, 0, sizeof (WAV_FMT)) ; + + if (structsize < 16) + return SFE_WAV_FMT_SHORT ; + if (structsize > SIGNED_SIZEOF (WAV_FMT)) + return SFE_WAV_FMT_TOO_BIG ; + + /* Read the minimal WAV file header here. */ + bytesread = + psf_binheader_readf (psf, "e224422", &(wav_fmt->format), &(wav_fmt->min.channels), + &(wav_fmt->min.samplerate), &(wav_fmt->min.bytespersec), + &(wav_fmt->min.blockalign), &(wav_fmt->min.bitwidth)) ; + + psf_log_printf (psf, " Format : 0x%X => %s\n", wav_fmt->format, wav_w64_format_str (wav_fmt->format)) ; + psf_log_printf (psf, " Channels : %d\n", wav_fmt->min.channels) ; + psf_log_printf (psf, " Sample Rate : %d\n", wav_fmt->min.samplerate) ; + psf_log_printf (psf, " Block Align : %d\n", wav_fmt->min.blockalign) ; + + if (wav_fmt->format == WAVE_FORMAT_PCM && wav_fmt->min.bitwidth == 24 && + wav_fmt->min.blockalign == 4 * wav_fmt->min.channels) + { + psf_log_printf (psf, "\nInvalid file generated by Syntrillium's Cooledit!\n" + "Treating as WAVE_FORMAT_IEEE_FLOAT 32 bit floating point file.\n\n") ; + psf_log_printf (psf, " Bit Width : 24 (should be 32)\n") ; + wav_fmt->min.bitwidth = 32 ; + wav_fmt->format = WAVE_FORMAT_IEEE_FLOAT ; + } + else if (wav_fmt->format == WAVE_FORMAT_GSM610 && wav_fmt->min.bitwidth != 0) + psf_log_printf (psf, " Bit Width : %d (should be 0)\n", wav_fmt->min.bitwidth) ; + else + psf_log_printf (psf, " Bit Width : %d\n", wav_fmt->min.bitwidth) ; + + + psf->sf.samplerate = wav_fmt->min.samplerate ; + psf->sf.frames = 0 ; /* Correct this when reading data chunk. */ + psf->sf.channels = wav_fmt->min.channels ; + + switch (wav_fmt->format) + { case WAVE_FORMAT_PCM : + case WAVE_FORMAT_IEEE_FLOAT : + bytespersec = wav_fmt->min.samplerate * wav_fmt->min.blockalign ; + if (wav_fmt->min.bytespersec != (unsigned) bytespersec) + psf_log_printf (psf, " Bytes/sec : %d (should be %d)\n", wav_fmt->min.bytespersec, bytespersec) ; + else + psf_log_printf (psf, " Bytes/sec : %d\n", wav_fmt->min.bytespersec) ; + + psf->bytewidth = BITWIDTH2BYTES (wav_fmt->min.bitwidth) ; + break ; + + case WAVE_FORMAT_ALAW : + case WAVE_FORMAT_MULAW : + if (wav_fmt->min.bytespersec / wav_fmt->min.blockalign != wav_fmt->min.samplerate) + psf_log_printf (psf, " Bytes/sec : %d (should be %d)\n", wav_fmt->min.bytespersec, wav_fmt->min.samplerate * wav_fmt->min.blockalign) ; + else + psf_log_printf (psf, " Bytes/sec : %d\n", wav_fmt->min.bytespersec) ; + + psf->bytewidth = 1 ; + if (structsize >= 18) + { bytesread += psf_binheader_readf (psf, "e2", &(wav_fmt->size20.extrabytes)) ; + psf_log_printf (psf, " Extra Bytes : %d\n", wav_fmt->size20.extrabytes) ; + } ; + break ; + + case WAVE_FORMAT_IMA_ADPCM : + if (wav_fmt->min.bitwidth != 4) + return SFE_WAV_ADPCM_NOT4BIT ; + if (wav_fmt->min.channels < 1 || wav_fmt->min.channels > 2) + return SFE_WAV_ADPCM_CHANNELS ; + + bytesread += + psf_binheader_readf (psf, "e22", &(wav_fmt->ima.extrabytes), &(wav_fmt->ima.samplesperblock)) ; + + bytespersec = (wav_fmt->ima.samplerate * wav_fmt->ima.blockalign) / wav_fmt->ima.samplesperblock ; + if (wav_fmt->ima.bytespersec != (unsigned) bytespersec) + psf_log_printf (psf, " Bytes/sec : %d (should be %d)\n", wav_fmt->ima.bytespersec, bytespersec) ; + else + psf_log_printf (psf, " Bytes/sec : %d\n", wav_fmt->ima.bytespersec) ; + + psf->bytewidth = 2 ; + psf_log_printf (psf, " Extra Bytes : %d\n", wav_fmt->ima.extrabytes) ; + psf_log_printf (psf, " Samples/Block : %d\n", wav_fmt->ima.samplesperblock) ; + break ; + + case WAVE_FORMAT_MS_ADPCM : + if (wav_fmt->msadpcm.bitwidth != 4) + return SFE_WAV_ADPCM_NOT4BIT ; + if (wav_fmt->msadpcm.channels < 1 || wav_fmt->msadpcm.channels > 2) + return SFE_WAV_ADPCM_CHANNELS ; + + bytesread += + psf_binheader_readf (psf, "e222", &(wav_fmt->msadpcm.extrabytes), + &(wav_fmt->msadpcm.samplesperblock), &(wav_fmt->msadpcm.numcoeffs)) ; + + bytespersec = (wav_fmt->min.samplerate * wav_fmt->min.blockalign) / wav_fmt->msadpcm.samplesperblock ; + if (wav_fmt->min.bytespersec == (unsigned) bytespersec) + psf_log_printf (psf, " Bytes/sec : %d\n", wav_fmt->min.bytespersec) ; + else if (wav_fmt->min.bytespersec == (wav_fmt->min.samplerate / wav_fmt->msadpcm.samplesperblock) * wav_fmt->min.blockalign) + psf_log_printf (psf, " Bytes/sec : %d (should be %d (MS BUG!))\n", wav_fmt->min.bytespersec, bytespersec) ; + else + psf_log_printf (psf, " Bytes/sec : %d (should be %d)\n", wav_fmt->min.bytespersec, bytespersec) ; + + + psf->bytewidth = 2 ; + psf_log_printf (psf, " Extra Bytes : %d\n", wav_fmt->msadpcm.extrabytes) ; + psf_log_printf (psf, " Samples/Block : %d\n", wav_fmt->msadpcm.samplesperblock) ; + if (wav_fmt->msadpcm.numcoeffs > SIGNED_SIZEOF (MS_ADPCM_WAV_FMT) / SIGNED_SIZEOF (int)) + { psf_log_printf (psf, " No. of Coeffs : %d ****\n", wav_fmt->msadpcm.numcoeffs) ; + wav_fmt->msadpcm.numcoeffs = SIGNED_SIZEOF (MS_ADPCM_WAV_FMT) / SIGNED_SIZEOF (int) ; + } + else + psf_log_printf (psf, " No. of Coeffs : %d\n", wav_fmt->msadpcm.numcoeffs) ; + + psf_log_printf (psf, " Index Coeffs1 Coeffs2\n") ; + for (k = 0 ; k < wav_fmt->msadpcm.numcoeffs ; k++) + { bytesread += + psf_binheader_readf (psf, "e22", &(wav_fmt->msadpcm.coeffs [k].coeff1), &(wav_fmt->msadpcm.coeffs [k].coeff2)) ; + LSF_SNPRINTF (psf->u.cbuf, sizeof (psf->u.cbuf), " %2d %7d %7d\n", k, wav_fmt->msadpcm.coeffs [k].coeff1, wav_fmt->msadpcm.coeffs [k].coeff2) ; + psf_log_printf (psf, psf->u.cbuf) ; + } ; + break ; + + case WAVE_FORMAT_GSM610 : + if (wav_fmt->gsm610.channels != 1 || wav_fmt->gsm610.blockalign != 65) + return SFE_WAV_GSM610_FORMAT ; + + bytesread += + psf_binheader_readf (psf, "e22", &(wav_fmt->gsm610.extrabytes), &(wav_fmt->gsm610.samplesperblock)) ; + + if (wav_fmt->gsm610.samplesperblock != 320) + return SFE_WAV_GSM610_FORMAT ; + + bytespersec = (wav_fmt->gsm610.samplerate * wav_fmt->gsm610.blockalign) / wav_fmt->gsm610.samplesperblock ; + if (wav_fmt->gsm610.bytespersec != (unsigned) bytespersec) + psf_log_printf (psf, " Bytes/sec : %d (should be %d)\n", wav_fmt->gsm610.bytespersec, bytespersec) ; + else + psf_log_printf (psf, " Bytes/sec : %d\n", wav_fmt->gsm610.bytespersec) ; + + psf->bytewidth = 2 ; + psf_log_printf (psf, " Extra Bytes : %d\n", wav_fmt->gsm610.extrabytes) ; + psf_log_printf (psf, " Samples/Block : %d\n", wav_fmt->gsm610.samplesperblock) ; + break ; + + case WAVE_FORMAT_EXTENSIBLE : + if (wav_fmt->ext.bytespersec / wav_fmt->ext.blockalign != wav_fmt->ext.samplerate) + psf_log_printf (psf, " Bytes/sec : %d (should be %d)\n", wav_fmt->ext.bytespersec, wav_fmt->ext.samplerate * wav_fmt->ext.blockalign) ; + else + psf_log_printf (psf, " Bytes/sec : %d\n", wav_fmt->ext.bytespersec) ; + + bytesread += + psf_binheader_readf (psf, "e224", &(wav_fmt->ext.extrabytes), &(wav_fmt->ext.validbits), + &(wav_fmt->ext.channelmask)) ; + + psf_log_printf (psf, " Valid Bits : %d\n", wav_fmt->ext.validbits) ; + psf_log_printf (psf, " Channel Mask : 0x%X\n", wav_fmt->ext.channelmask) ; + + bytesread += + psf_binheader_readf (psf, "e422", &(wav_fmt->ext.esf.esf_field1), &(wav_fmt->ext.esf.esf_field2), + &(wav_fmt->ext.esf.esf_field3)) ; + + /* compare the esf_fields with each known GUID? and print?*/ + psf_log_printf (psf, " Subformat\n") ; + psf_log_printf (psf, " esf_field1 : 0x%X\n", wav_fmt->ext.esf.esf_field1) ; + psf_log_printf (psf, " esf_field2 : 0x%X\n", wav_fmt->ext.esf.esf_field2) ; + psf_log_printf (psf, " esf_field3 : 0x%X\n", wav_fmt->ext.esf.esf_field3) ; + psf_log_printf (psf, " esf_field4 : ") ; + for (k = 0 ; k < 8 ; k++) + { bytesread += psf_binheader_readf (psf, "1", &(wav_fmt->ext.esf.esf_field4 [k])) ; + psf_log_printf (psf, "0x%X ", wav_fmt->ext.esf.esf_field4 [k] & 0xFF) ; + } ; + psf_log_printf (psf, "\n") ; + psf->bytewidth = BITWIDTH2BYTES (wav_fmt->ext.bitwidth) ; + break ; + + default : break ; + } ; + + if (bytesread > structsize) + { psf_log_printf (psf, "*** wav_w64_read_fmt_chunk (bytesread > structsize)\n") ; + return SFE_W64_FMT_SHORT ; + } + else + psf_binheader_readf (psf, "j", structsize - bytesread) ; + + psf->blockwidth = wav_fmt->min.channels * psf->bytewidth ; + + return 0 ; +} /* wav_w64_read_fmt_chunk */ + +/*============================================================================== +*/ + +typedef struct +{ int ID ; + const char *name ; +} WAV_FORMAT_DESC ; + +#define STR(x) #x +#define FORMAT_TYPE(x) { x, STR (x) } + +static WAV_FORMAT_DESC wave_descs [] = +{ FORMAT_TYPE (WAVE_FORMAT_PCM), + FORMAT_TYPE (WAVE_FORMAT_MS_ADPCM), + FORMAT_TYPE (WAVE_FORMAT_IEEE_FLOAT), + FORMAT_TYPE (WAVE_FORMAT_VSELP), + FORMAT_TYPE (WAVE_FORMAT_IBM_CVSD), + FORMAT_TYPE (WAVE_FORMAT_ALAW), + FORMAT_TYPE (WAVE_FORMAT_MULAW), + FORMAT_TYPE (WAVE_FORMAT_OKI_ADPCM), + FORMAT_TYPE (WAVE_FORMAT_IMA_ADPCM), + FORMAT_TYPE (WAVE_FORMAT_MEDIASPACE_ADPCM), + FORMAT_TYPE (WAVE_FORMAT_SIERRA_ADPCM), + FORMAT_TYPE (WAVE_FORMAT_G723_ADPCM), + FORMAT_TYPE (WAVE_FORMAT_DIGISTD), + FORMAT_TYPE (WAVE_FORMAT_DIGIFIX), + FORMAT_TYPE (WAVE_FORMAT_DIALOGIC_OKI_ADPCM), + FORMAT_TYPE (WAVE_FORMAT_MEDIAVISION_ADPCM), + FORMAT_TYPE (WAVE_FORMAT_CU_CODEC), + FORMAT_TYPE (WAVE_FORMAT_YAMAHA_ADPCM), + FORMAT_TYPE (WAVE_FORMAT_SONARC), + FORMAT_TYPE (WAVE_FORMAT_DSPGROUP_TRUESPEECH), + FORMAT_TYPE (WAVE_FORMAT_ECHOSC1), + FORMAT_TYPE (WAVE_FORMAT_AUDIOFILE_AF36), + FORMAT_TYPE (WAVE_FORMAT_APTX), + FORMAT_TYPE (WAVE_FORMAT_AUDIOFILE_AF10), + FORMAT_TYPE (WAVE_FORMAT_PROSODY_1612), + FORMAT_TYPE (WAVE_FORMAT_LRC), + FORMAT_TYPE (WAVE_FORMAT_DOLBY_AC2), + FORMAT_TYPE (WAVE_FORMAT_GSM610), + FORMAT_TYPE (WAVE_FORMAT_MSNAUDIO), + FORMAT_TYPE (WAVE_FORMAT_ANTEX_ADPCME), + FORMAT_TYPE (WAVE_FORMAT_CONTROL_RES_VQLPC), + FORMAT_TYPE (WAVE_FORMAT_DIGIREAL), + FORMAT_TYPE (WAVE_FORMAT_DIGIADPCM), + FORMAT_TYPE (WAVE_FORMAT_CONTROL_RES_CR10), + FORMAT_TYPE (WAVE_FORMAT_NMS_VBXADPCM), + FORMAT_TYPE (WAVE_FORMAT_ROLAND_RDAC), + FORMAT_TYPE (WAVE_FORMAT_ECHOSC3), + FORMAT_TYPE (WAVE_FORMAT_ROCKWELL_ADPCM), + FORMAT_TYPE (WAVE_FORMAT_ROCKWELL_DIGITALK), + FORMAT_TYPE (WAVE_FORMAT_XEBEC), + FORMAT_TYPE (WAVE_FORMAT_G721_ADPCM), + FORMAT_TYPE (WAVE_FORMAT_G728_CELP), + FORMAT_TYPE (WAVE_FORMAT_MSG723), + FORMAT_TYPE (WAVE_FORMAT_MPEG), + FORMAT_TYPE (WAVE_FORMAT_RT24), + FORMAT_TYPE (WAVE_FORMAT_PAC), + FORMAT_TYPE (WAVE_FORMAT_MPEGLAYER3), + FORMAT_TYPE (WAVE_FORMAT_LUCENT_G723), + FORMAT_TYPE (WAVE_FORMAT_CIRRUS), + FORMAT_TYPE (WAVE_FORMAT_ESPCM), + FORMAT_TYPE (WAVE_FORMAT_VOXWARE), + FORMAT_TYPE (WAVE_FORMAT_CANOPUS_ATRAC), + FORMAT_TYPE (WAVE_FORMAT_G726_ADPCM), + FORMAT_TYPE (WAVE_FORMAT_G722_ADPCM), + FORMAT_TYPE (WAVE_FORMAT_DSAT), + FORMAT_TYPE (WAVE_FORMAT_DSAT_DISPLAY), + FORMAT_TYPE (WAVE_FORMAT_VOXWARE_BYTE_ALIGNED), + FORMAT_TYPE (WAVE_FORMAT_VOXWARE_AC8), + FORMAT_TYPE (WAVE_FORMAT_VOXWARE_AC10), + FORMAT_TYPE (WAVE_FORMAT_VOXWARE_AC16), + FORMAT_TYPE (WAVE_FORMAT_VOXWARE_AC20), + FORMAT_TYPE (WAVE_FORMAT_VOXWARE_RT24), + FORMAT_TYPE (WAVE_FORMAT_VOXWARE_RT29), + FORMAT_TYPE (WAVE_FORMAT_VOXWARE_RT29HW), + FORMAT_TYPE (WAVE_FORMAT_VOXWARE_VR12), + FORMAT_TYPE (WAVE_FORMAT_VOXWARE_VR18), + FORMAT_TYPE (WAVE_FORMAT_VOXWARE_TQ40), + FORMAT_TYPE (WAVE_FORMAT_SOFTSOUND), + FORMAT_TYPE (WAVE_FORMAT_VOXARE_TQ60), + FORMAT_TYPE (WAVE_FORMAT_MSRT24), + FORMAT_TYPE (WAVE_FORMAT_G729A), + FORMAT_TYPE (WAVE_FORMAT_MVI_MV12), + FORMAT_TYPE (WAVE_FORMAT_DF_G726), + FORMAT_TYPE (WAVE_FORMAT_DF_GSM610), + FORMAT_TYPE (WAVE_FORMAT_ONLIVE), + FORMAT_TYPE (WAVE_FORMAT_SBC24), + FORMAT_TYPE (WAVE_FORMAT_DOLBY_AC3_SPDIF), + FORMAT_TYPE (WAVE_FORMAT_ZYXEL_ADPCM), + FORMAT_TYPE (WAVE_FORMAT_PHILIPS_LPCBB), + FORMAT_TYPE (WAVE_FORMAT_PACKED), + FORMAT_TYPE (WAVE_FORMAT_RHETOREX_ADPCM), + FORMAT_TYPE (IBM_FORMAT_MULAW), + FORMAT_TYPE (IBM_FORMAT_ALAW), + FORMAT_TYPE (IBM_FORMAT_ADPCM), + FORMAT_TYPE (WAVE_FORMAT_VIVO_G723), + FORMAT_TYPE (WAVE_FORMAT_VIVO_SIREN), + FORMAT_TYPE (WAVE_FORMAT_DIGITAL_G723), + FORMAT_TYPE (WAVE_FORMAT_CREATIVE_ADPCM), + FORMAT_TYPE (WAVE_FORMAT_CREATIVE_FASTSPEECH8), + FORMAT_TYPE (WAVE_FORMAT_CREATIVE_FASTSPEECH10), + FORMAT_TYPE (WAVE_FORMAT_QUARTERDECK), + FORMAT_TYPE (WAVE_FORMAT_FM_TOWNS_SND), + FORMAT_TYPE (WAVE_FORMAT_BZV_DIGITAL), + FORMAT_TYPE (WAVE_FORMAT_VME_VMPCM), + FORMAT_TYPE (WAVE_FORMAT_OLIGSM), + FORMAT_TYPE (WAVE_FORMAT_OLIADPCM), + FORMAT_TYPE (WAVE_FORMAT_OLICELP), + FORMAT_TYPE (WAVE_FORMAT_OLISBC), + FORMAT_TYPE (WAVE_FORMAT_OLIOPR), + FORMAT_TYPE (WAVE_FORMAT_LH_CODEC), + FORMAT_TYPE (WAVE_FORMAT_NORRIS), + FORMAT_TYPE (WAVE_FORMAT_SOUNDSPACE_MUSICOMPRESS), + FORMAT_TYPE (WAVE_FORMAT_DVM), + FORMAT_TYPE (WAVE_FORMAT_INTERWAV_VSC112), + FORMAT_TYPE (WAVE_FORMAT_EXTENSIBLE), +} ; + +char const* +wav_w64_format_str (int k) +{ int lower, upper, mid ; + + lower = -1 ; + upper = sizeof (wave_descs) / sizeof (WAV_FORMAT_DESC) ; + + /* binary search */ + if ((wave_descs [0].ID <= k) & (k <= wave_descs [upper - 1].ID)) + { + while (lower + 1 < upper) + { mid = (upper + lower) / 2 ; + + if (k == wave_descs [mid].ID) + return wave_descs [mid].name ; + if (k < wave_descs [mid].ID) + upper = mid ; + else + lower = mid ; + } ; + } ; + + return "Unknown format" ; +} /* wav_w64_format_str */ + +int +wav_w64_srate2blocksize (int srate_chan_product) +{ if (srate_chan_product < 12000) + return 256 ; + if (srate_chan_product < 23000) + return 512 ; + if (srate_chan_product < 44000) + return 1024 ; + return 2048 ; +} /* srate2blocksize */ +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: 43c1b1dd-8abd-43da-a8cd-44da914b64a5 +*/ diff --git a/Libraries/SndFile/Files/src/wav_w64.h b/Libraries/SndFile/Files/src/wav_w64.h new file mode 100644 index 000000000..8bacdb677 --- /dev/null +++ b/Libraries/SndFile/Files/src/wav_w64.h @@ -0,0 +1,282 @@ +/* +** Copyright (C) 1999-2004 Erik de Castro Lopo +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU Lesser General Public License as published by +** the Free Software Foundation; either version 2.1 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU Lesser General Public License for more details. +** +** You should have received a copy of the GNU Lesser General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +/* This file contains definitions commong to WAV and W64 files. */ + + +#ifndef WAV_W64_H_INCLUDED +#define WAV_W64_H_INCLUDED + +/*------------------------------------------------------------------------------ +** List of known WAV format tags +*/ + +enum +{ + /* keep sorted for wav_w64_format_str() */ + WAVE_FORMAT_UNKNOWN = 0x0000, /* Microsoft Corporation */ + WAVE_FORMAT_PCM = 0x0001, /* Microsoft PCM format */ + WAVE_FORMAT_MS_ADPCM = 0x0002, /* Microsoft ADPCM */ + WAVE_FORMAT_IEEE_FLOAT = 0x0003, /* Micrososft 32 bit float format */ + WAVE_FORMAT_VSELP = 0x0004, /* Compaq Computer Corporation */ + WAVE_FORMAT_IBM_CVSD = 0x0005, /* IBM Corporation */ + WAVE_FORMAT_ALAW = 0x0006, /* Microsoft Corporation */ + WAVE_FORMAT_MULAW = 0x0007, /* Microsoft Corporation */ + WAVE_FORMAT_OKI_ADPCM = 0x0010, /* OKI */ + WAVE_FORMAT_IMA_ADPCM = 0x0011, /* Intel Corporation */ + WAVE_FORMAT_MEDIASPACE_ADPCM = 0x0012, /* Videologic */ + WAVE_FORMAT_SIERRA_ADPCM = 0x0013, /* Sierra Semiconductor Corp */ + WAVE_FORMAT_G723_ADPCM = 0x0014, /* Antex Electronics Corporation */ + WAVE_FORMAT_DIGISTD = 0x0015, /* DSP Solutions, Inc. */ + WAVE_FORMAT_DIGIFIX = 0x0016, /* DSP Solutions, Inc. */ + WAVE_FORMAT_DIALOGIC_OKI_ADPCM = 0x0017, /* Dialogic Corporation */ + WAVE_FORMAT_MEDIAVISION_ADPCM = 0x0018, /* Media Vision, Inc. */ + WAVE_FORMAT_CU_CODEC = 0x0019, /* Hewlett-Packard Company */ + WAVE_FORMAT_YAMAHA_ADPCM = 0x0020, /* Yamaha Corporation of America */ + WAVE_FORMAT_SONARC = 0x0021, /* Speech Compression */ + WAVE_FORMAT_DSPGROUP_TRUESPEECH = 0x0022, /* DSP Group, Inc */ + WAVE_FORMAT_ECHOSC1 = 0x0023, /* Echo Speech Corporation */ + WAVE_FORMAT_AUDIOFILE_AF36 = 0x0024, /* Audiofile, Inc. */ + WAVE_FORMAT_APTX = 0x0025, /* Audio Processing Technology */ + WAVE_FORMAT_AUDIOFILE_AF10 = 0x0026, /* Audiofile, Inc. */ + WAVE_FORMAT_PROSODY_1612 = 0x0027, /* Aculab plc */ + WAVE_FORMAT_LRC = 0x0028, /* Merging Technologies S.A. */ + WAVE_FORMAT_DOLBY_AC2 = 0x0030, /* Dolby Laboratories */ + WAVE_FORMAT_GSM610 = 0x0031, /* Microsoft Corporation */ + WAVE_FORMAT_MSNAUDIO = 0x0032, /* Microsoft Corporation */ + WAVE_FORMAT_ANTEX_ADPCME = 0x0033, /* Antex Electronics Corporation */ + WAVE_FORMAT_CONTROL_RES_VQLPC = 0x0034, /* Control Resources Limited */ + WAVE_FORMAT_DIGIREAL = 0x0035, /* DSP Solutions, Inc. */ + WAVE_FORMAT_DIGIADPCM = 0x0036, /* DSP Solutions, Inc. */ + WAVE_FORMAT_CONTROL_RES_CR10 = 0x0037, /* Control Resources Limited */ + WAVE_FORMAT_NMS_VBXADPCM = 0x0038, /* Natural MicroSystems */ + WAVE_FORMAT_ROLAND_RDAC = 0x0039, /* Roland */ + WAVE_FORMAT_ECHOSC3 = 0x003A, /* Echo Speech Corporation */ + WAVE_FORMAT_ROCKWELL_ADPCM = 0x003B, /* Rockwell International */ + WAVE_FORMAT_ROCKWELL_DIGITALK = 0x003C, /* Rockwell International */ + WAVE_FORMAT_XEBEC = 0x003D, /* Xebec Multimedia Solutions Limited */ + WAVE_FORMAT_G721_ADPCM = 0x0040, /* Antex Electronics Corporation */ + WAVE_FORMAT_G728_CELP = 0x0041, /* Antex Electronics Corporation */ + WAVE_FORMAT_MSG723 = 0x0042, /* Microsoft Corporation */ + WAVE_FORMAT_MPEG = 0x0050, /* Microsoft Corporation */ + WAVE_FORMAT_RT24 = 0x0052, /* InSoft Inc. */ + WAVE_FORMAT_PAC = 0x0053, /* InSoft Inc. */ + WAVE_FORMAT_MPEGLAYER3 = 0x0055, /* MPEG 3 Layer 1 */ + WAVE_FORMAT_LUCENT_G723 = 0x0059, /* Lucent Technologies */ + WAVE_FORMAT_CIRRUS = 0x0060, /* Cirrus Logic */ + WAVE_FORMAT_ESPCM = 0x0061, /* ESS Technology */ + WAVE_FORMAT_VOXWARE = 0x0062, /* Voxware Inc */ + WAVE_FORMAT_CANOPUS_ATRAC = 0x0063, /* Canopus, Co., Ltd. */ + WAVE_FORMAT_G726_ADPCM = 0x0064, /* APICOM */ + WAVE_FORMAT_G722_ADPCM = 0x0065, /* APICOM */ + WAVE_FORMAT_DSAT = 0x0066, /* Microsoft Corporation */ + WAVE_FORMAT_DSAT_DISPLAY = 0x0067, /* Microsoft Corporation */ + WAVE_FORMAT_VOXWARE_BYTE_ALIGNED = 0x0069, /* Voxware Inc. */ + WAVE_FORMAT_VOXWARE_AC8 = 0x0070, /* Voxware Inc. */ + WAVE_FORMAT_VOXWARE_AC10 = 0x0071, /* Voxware Inc. */ + WAVE_FORMAT_VOXWARE_AC16 = 0x0072, /* Voxware Inc. */ + WAVE_FORMAT_VOXWARE_AC20 = 0x0073, /* Voxware Inc. */ + WAVE_FORMAT_VOXWARE_RT24 = 0x0074, /* Voxware Inc. */ + WAVE_FORMAT_VOXWARE_RT29 = 0x0075, /* Voxware Inc. */ + WAVE_FORMAT_VOXWARE_RT29HW = 0x0076, /* Voxware Inc. */ + WAVE_FORMAT_VOXWARE_VR12 = 0x0077, /* Voxware Inc. */ + WAVE_FORMAT_VOXWARE_VR18 = 0x0078, /* Voxware Inc. */ + WAVE_FORMAT_VOXWARE_TQ40 = 0x0079, /* Voxware Inc. */ + WAVE_FORMAT_SOFTSOUND = 0x0080, /* Softsound, Ltd. */ + WAVE_FORMAT_VOXARE_TQ60 = 0x0081, /* Voxware Inc. */ + WAVE_FORMAT_MSRT24 = 0x0082, /* Microsoft Corporation */ + WAVE_FORMAT_G729A = 0x0083, /* AT&T Laboratories */ + WAVE_FORMAT_MVI_MV12 = 0x0084, /* Motion Pixels */ + WAVE_FORMAT_DF_G726 = 0x0085, /* DataFusion Systems (Pty) (Ltd) */ + WAVE_FORMAT_DF_GSM610 = 0x0086, /* DataFusion Systems (Pty) (Ltd) */ + /* removed because duplicate */ + /* WAVE_FORMAT_ISIAUDIO = 0x0088, */ /* Iterated Systems, Inc. */ + WAVE_FORMAT_ONLIVE = 0x0089, /* OnLive! Technologies, Inc. */ + WAVE_FORMAT_SBC24 = 0x0091, /* Siemens Business Communications Systems */ + WAVE_FORMAT_DOLBY_AC3_SPDIF = 0x0092, /* Sonic Foundry */ + WAVE_FORMAT_ZYXEL_ADPCM = 0x0097, /* ZyXEL Communications, Inc. */ + WAVE_FORMAT_PHILIPS_LPCBB = 0x0098, /* Philips Speech Processing */ + WAVE_FORMAT_PACKED = 0x0099, /* Studer Professional Audio AG */ + WAVE_FORMAT_RHETOREX_ADPCM = 0x0100, /* Rhetorex, Inc. */ + + /* removed because of the following */ + /* WAVE_FORMAT_IRAT = 0x0101,*/ /* BeCubed Software Inc. */ + + /* these three are unofficial */ + IBM_FORMAT_MULAW = 0x0101, /* IBM mu-law format */ + IBM_FORMAT_ALAW = 0x0102, /* IBM a-law format */ + IBM_FORMAT_ADPCM = 0x0103, /* IBM AVC Adaptive Differential PCM format */ + + WAVE_FORMAT_VIVO_G723 = 0x0111, /* Vivo Software */ + WAVE_FORMAT_VIVO_SIREN = 0x0112, /* Vivo Software */ + WAVE_FORMAT_DIGITAL_G723 = 0x0123, /* Digital Equipment Corporation */ + WAVE_FORMAT_CREATIVE_ADPCM = 0x0200, /* Creative Labs, Inc */ + WAVE_FORMAT_CREATIVE_FASTSPEECH8 = 0x0202, /* Creative Labs, Inc */ + WAVE_FORMAT_CREATIVE_FASTSPEECH10 = 0x0203, /* Creative Labs, Inc */ + WAVE_FORMAT_QUARTERDECK = 0x0220, /* Quarterdeck Corporation */ + WAVE_FORMAT_FM_TOWNS_SND = 0x0300, /* Fujitsu Corporation */ + WAVE_FORMAT_BZV_DIGITAL = 0x0400, /* Brooktree Corporation */ + WAVE_FORMAT_VME_VMPCM = 0x0680, /* AT&T Labs, Inc. */ + WAVE_FORMAT_OLIGSM = 0x1000, /* Ing C. Olivetti & C., S.p.A. */ + WAVE_FORMAT_OLIADPCM = 0x1001, /* Ing C. Olivetti & C., S.p.A. */ + WAVE_FORMAT_OLICELP = 0x1002, /* Ing C. Olivetti & C., S.p.A. */ + WAVE_FORMAT_OLISBC = 0x1003, /* Ing C. Olivetti & C., S.p.A. */ + WAVE_FORMAT_OLIOPR = 0x1004, /* Ing C. Olivetti & C., S.p.A. */ + WAVE_FORMAT_LH_CODEC = 0x1100, /* Lernout & Hauspie */ + WAVE_FORMAT_NORRIS = 0x1400, /* Norris Communications, Inc. */ + /* removed because duplicate */ + /* WAVE_FORMAT_ISIAUDIO = 0x1401, */ /* AT&T Labs, Inc. */ + WAVE_FORMAT_SOUNDSPACE_MUSICOMPRESS = 0x1500, /* AT&T Labs, Inc. */ + WAVE_FORMAT_DVM = 0x2000, /* FAST Multimedia AG */ + WAVE_FORMAT_INTERWAV_VSC112 = 0x7150, /* ????? */ + WAVE_FORMAT_EXTENSIBLE = 0xFFFE +} ; + +typedef struct +{ unsigned short format ; + unsigned short channels ; + unsigned int samplerate ; + unsigned int bytespersec ; + unsigned short blockalign ; + unsigned short bitwidth ; +} MIN_WAV_FMT ; + +typedef struct +{ unsigned short format ; + unsigned short channels ; + unsigned int samplerate ; + unsigned int bytespersec ; + unsigned short blockalign ; + unsigned short bitwidth ; + unsigned short extrabytes ; + unsigned short dummy ; +} WAV_FMT_SIZE20 ; + +typedef struct +{ unsigned short format ; + unsigned short channels ; + unsigned int samplerate ; + unsigned int bytespersec ; + unsigned short blockalign ; + unsigned short bitwidth ; + unsigned short extrabytes ; + unsigned short samplesperblock ; + unsigned short numcoeffs ; + struct + { short coeff1 ; + short coeff2 ; + } coeffs [7] ; +} MS_ADPCM_WAV_FMT ; + +typedef struct +{ unsigned short format ; + unsigned short channels ; + unsigned int samplerate ; + unsigned int bytespersec ; + unsigned short blockalign ; + unsigned short bitwidth ; + unsigned short extrabytes ; + unsigned short samplesperblock ; +} IMA_ADPCM_WAV_FMT ; + +typedef struct +{ unsigned short format ; + unsigned short channels ; + unsigned int samplerate ; + unsigned int bytespersec ; + unsigned short blockalign ; + unsigned short bitwidth ; + unsigned short extrabytes ; + unsigned short auxblocksize ; +} G72x_ADPCM_WAV_FMT ; + + +typedef struct +{ unsigned short format ; + unsigned short channels ; + unsigned int samplerate ; + unsigned int bytespersec ; + unsigned short blockalign ; + unsigned short bitwidth ; + unsigned short extrabytes ; + unsigned short samplesperblock ; +} GSM610_WAV_FMT ; + +typedef struct +{ unsigned int esf_field1 ; + unsigned short esf_field2 ; + unsigned short esf_field3 ; + char esf_field4 [8] ; +} EXT_SUBFORMAT ; + +typedef struct +{ unsigned short format ; + unsigned short channels ; + unsigned int samplerate ; + unsigned int bytespersec ; + unsigned short blockalign ; + unsigned short bitwidth ; + unsigned short extrabytes ; + unsigned short validbits ; + unsigned int channelmask ; + EXT_SUBFORMAT esf ; +} EXTENSIBLE_WAV_FMT ; + +typedef union +{ unsigned short format ; + MIN_WAV_FMT min ; + IMA_ADPCM_WAV_FMT ima ; + MS_ADPCM_WAV_FMT msadpcm ; + G72x_ADPCM_WAV_FMT g72x ; + EXTENSIBLE_WAV_FMT ext ; + GSM610_WAV_FMT gsm610 ; + WAV_FMT_SIZE20 size20 ; + char padding [512] ; +} WAV_FMT ; + +typedef struct +{ int frames ; +} FACT_CHUNK ; + +#define WAV_W64_GSM610_BLOCKSIZE 65 +#define WAV_W64_GSM610_SAMPLES 320 + +/*------------------------------------------------------------------------------------ +** Functions defined in wav_ms_adpcm.c +*/ + +#define MSADPCM_ADAPT_COEFF_COUNT 7 + +void msadpcm_write_adapt_coeffs (SF_PRIVATE *psf) ; + +/*------------------------------------------------------------------------------------ +** Functions defined in wav_gsm610.c +*/ + +int wav_w64_srate2blocksize (int srate_chan_product) ; +char const* wav_w64_format_str (int k) ; +int wav_w64_read_fmt_chunk (SF_PRIVATE *psf, WAV_FMT *wav_fmt, int structsize) ; + +#endif +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: 877fde12-9be3-4a31-8a5a-fdae39958613 +*/ diff --git a/Libraries/SndFile/Files/src/wve.c b/Libraries/SndFile/Files/src/wve.c new file mode 100644 index 000000000..d5588e84a --- /dev/null +++ b/Libraries/SndFile/Files/src/wve.c @@ -0,0 +1,124 @@ +/* +** Copyright (C) 2002-2004 Erik de Castro Lopo +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU Lesser General Public License as published by +** the Free Software Foundation; either version 2.1 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU Lesser General Public License for more details. +** +** You should have received a copy of the GNU Lesser General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include +#include +#include +#include + +#include "sndfile.h" +#include "config.h" +#include "sfendian.h" +#include "common.h" + +#if (ENABLE_EXPERIMENTAL_CODE == 0) + +int +wve_open (SF_PRIVATE *psf) +{ if (psf) + return SFE_UNIMPLEMENTED ; + return (psf && 0) ; +} /* wve_open */ + +#else + +#define SFE_WVE_NOT_WVE 666 + +/*------------------------------------------------------------------------------ +** Macros to handle big/little endian issues. +*/ + +#define ALAW_MARKER MAKE_MARKER ('A', 'L', 'a', 'w') +#define SOUN_MARKER MAKE_MARKER ('S', 'o', 'u', 'n') +#define DFIL_MARKER MAKE_MARKER ('d', 'F', 'i', 'l') + +/*------------------------------------------------------------------------------ +** Private static functions. +*/ + +static int wve_read_header (SF_PRIVATE *psf) ; + +/*------------------------------------------------------------------------------ +** Public function. +*/ + +int +wve_open (SF_PRIVATE *psf) +{ int subformat, error = 0 ; + + if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR) + return SFE_UNIMPLEMENTED ; + + if ((error = wve_read_header (psf))) + return error ; + + if ((psf->sf.format & SF_FORMAT_TYPEMASK) != SF_FORMAT_WVE) + return SFE_BAD_OPEN_FORMAT ; + + subformat = psf->sf.format & SF_FORMAT_SUBMASK ; + + return error ; +} /* wve_open */ + +/*------------------------------------------------------------------------------ +*/ + +static int +wve_read_header (SF_PRIVATE *psf) +{ int marker ; + + /* Set position to start of file to begin reading header. */ + psf_binheader_readf (psf, "pm", 0, &marker) ; + if (marker != ALAW_MARKER) + return SFE_WVE_NOT_WVE ; + + psf_binheader_readf (psf, "m", &marker) ; + if (marker != SOUN_MARKER) + return SFE_WVE_NOT_WVE ; + + psf_binheader_readf (psf, "m", &marker) ; + if (marker != DFIL_MARKER) + return SFE_WVE_NOT_WVE ; + + psf_log_printf (psf, "Read only : Psion Palmtop Alaw (.wve)\n" + " Sample Rate : 8000\n" + " Channels : 1\n" + " Encoding : A-law\n") ; + + psf->dataoffset = 0x20 ; + psf->datalength = psf->filelength - psf->dataoffset ; + + psf->sf.format = SF_FORMAT_WVE | SF_FORMAT_ALAW ; + psf->sf.samplerate = 8000 ; + psf->sf.frames = psf->datalength ; + psf->sf.channels = 1 ; + + return alaw_init (psf) ; +} /* wve_read_header */ + +/*------------------------------------------------------------------------------ +*/ + +#endif +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: ba368cb5-523f-45e4-98c1-5b99a102f73f +*/ diff --git a/Libraries/SndFile/Files/src/xi.c b/Libraries/SndFile/Files/src/xi.c new file mode 100644 index 000000000..04994b25b --- /dev/null +++ b/Libraries/SndFile/Files/src/xi.c @@ -0,0 +1,1194 @@ +/* +** Copyright (C) 2003,2004 Erik de Castro Lopo +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU Lesser General Public License as published by +** the Free Software Foundation; either version 2.1 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU Lesser General Public License for more details. +** +** You should have received a copy of the GNU Lesser General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include "config.h" + +#include +#include +#include +#include +#include + +#include "sndfile.h" +#include "sfendian.h" +#include "common.h" +#include "float_cast.h" + +#define MAX_XI_SAMPLES 16 + +/*------------------------------------------------------------------------------ +** Private static functions and tyepdefs. +*/ + +typedef struct +{ /* Warning, this filename is NOT nul terminated. */ + char filename [22] ; + char software [20] ; + char sample_name [22] ; + + int loop_begin, loop_end ; + int sample_flags ; + + /* Data for encoder and decoder. */ + short last_16 ; +} XI_PRIVATE ; + +static int xi_close (SF_PRIVATE *psf) ; +static int xi_write_header (SF_PRIVATE *psf, int calc_length) ; +static int xi_read_header (SF_PRIVATE *psf) ; +static int dpcm_init (SF_PRIVATE *psf) ; + + +static sf_count_t dpcm_seek (SF_PRIVATE *psf, int mode, sf_count_t offset) ; + +/*------------------------------------------------------------------------------ +** Public function. +*/ + +int +xi_open (SF_PRIVATE *psf) +{ XI_PRIVATE *pxi ; + int subformat, error = 0 ; + + if (psf->is_pipe) + return SFE_XI_NO_PIPE ; + + if (psf->fdata) + pxi = psf->fdata ; + else if ((pxi = calloc (1, sizeof (XI_PRIVATE))) == NULL) + return SFE_MALLOC_FAILED ; + + psf->fdata = pxi ; + + if (psf->mode == SFM_READ || (psf->mode == SFM_RDWR && psf->filelength > 0)) + { if ((error = xi_read_header (psf))) + return error ; + } ; + + subformat = psf->sf.format & SF_FORMAT_SUBMASK ; + + if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR) + { if ((psf->sf.format & SF_FORMAT_TYPEMASK) != SF_FORMAT_XI) + return SFE_BAD_OPEN_FORMAT ; + + psf->endian = SF_ENDIAN_LITTLE ; + psf->sf.channels = 1 ; /* Always mono */ + psf->sf.samplerate = 44100 ; /* Always */ + + /* Set up default instrument and software name. */ + memcpy (pxi->filename, "Default Name ", sizeof (pxi->filename)) ; + memcpy (pxi->software, PACKAGE "-" VERSION " ", sizeof (pxi->software)) ; + + memset (pxi->sample_name, 0, sizeof (pxi->sample_name)) ; + LSF_SNPRINTF (pxi->sample_name, sizeof (pxi->sample_name), "%s", "Sample #1") ; + + pxi->sample_flags = (subformat == SF_FORMAT_DPCM_16) ? 16 : 0 ; + + if (xi_write_header (psf, SF_FALSE)) + return psf->error ; + + psf->write_header = xi_write_header ; + } ; + + psf->close = xi_close ; + psf->seek = dpcm_seek ; + + psf->sf.seekable = SF_FALSE ; + + psf->blockwidth = psf->bytewidth * psf->sf.channels ; + + switch (subformat) + { case SF_FORMAT_DPCM_8 : /* 8-bit differential PCM. */ + case SF_FORMAT_DPCM_16 : /* 16-bit differential PCM. */ + error = dpcm_init (psf) ; + break ; + + default : break ; + } ; + + return error ; +} /* xi_open */ + +/*------------------------------------------------------------------------------ +*/ + +static int +xi_close (SF_PRIVATE *psf) +{ + psf = psf ; + + return 0 ; +} /* xi_close */ + +/*============================================================================== +*/ + +static sf_count_t dpcm_read_dsc2s (SF_PRIVATE *psf, short *ptr, sf_count_t len) ; +static sf_count_t dpcm_read_dsc2i (SF_PRIVATE *psf, int *ptr, sf_count_t len) ; +static sf_count_t dpcm_read_dsc2f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ; +static sf_count_t dpcm_read_dsc2d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ; + +static sf_count_t dpcm_write_s2dsc (SF_PRIVATE *psf, short *ptr, sf_count_t len) ; +static sf_count_t dpcm_write_i2dsc (SF_PRIVATE *psf, int *ptr, sf_count_t len) ; +static sf_count_t dpcm_write_f2dsc (SF_PRIVATE *psf, float *ptr, sf_count_t len) ; +static sf_count_t dpcm_write_d2dsc (SF_PRIVATE *psf, double *ptr, sf_count_t len) ; + +static sf_count_t dpcm_read_dles2s (SF_PRIVATE *psf, short *ptr, sf_count_t len) ; +static sf_count_t dpcm_read_dles2i (SF_PRIVATE *psf, int *ptr, sf_count_t len) ; +static sf_count_t dpcm_read_dles2f (SF_PRIVATE *psf, float *ptr, sf_count_t len) ; +static sf_count_t dpcm_read_dles2d (SF_PRIVATE *psf, double *ptr, sf_count_t len) ; + +static sf_count_t dpcm_write_s2dles (SF_PRIVATE *psf, short *ptr, sf_count_t len) ; +static sf_count_t dpcm_write_i2dles (SF_PRIVATE *psf, int *ptr, sf_count_t len) ; +static sf_count_t dpcm_write_f2dles (SF_PRIVATE *psf, float *ptr, sf_count_t len) ; +static sf_count_t dpcm_write_d2dles (SF_PRIVATE *psf, double *ptr, sf_count_t len) ; + +static int +dpcm_init (SF_PRIVATE *psf) +{ if (psf->bytewidth == 0 || psf->sf.channels == 0) + return SFE_INTERNAL ; + + psf->blockwidth = psf->bytewidth * psf->sf.channels ; + + if (psf->mode == SFM_READ || psf->mode == SFM_RDWR) + { switch (psf->bytewidth) + { case 1 : + psf->read_short = dpcm_read_dsc2s ; + psf->read_int = dpcm_read_dsc2i ; + psf->read_float = dpcm_read_dsc2f ; + psf->read_double = dpcm_read_dsc2d ; + break ; + case 2 : + psf->read_short = dpcm_read_dles2s ; + psf->read_int = dpcm_read_dles2i ; + psf->read_float = dpcm_read_dles2f ; + psf->read_double = dpcm_read_dles2d ; + break ; + default : + psf_log_printf (psf, "dpcm_init() returning SFE_UNIMPLEMENTED\n") ; + return SFE_UNIMPLEMENTED ; + } ; + } ; + + if (psf->mode == SFM_WRITE || psf->mode == SFM_RDWR) + { switch (psf->bytewidth) + { case 1 : + psf->write_short = dpcm_write_s2dsc ; + psf->write_int = dpcm_write_i2dsc ; + psf->write_float = dpcm_write_f2dsc ; + psf->write_double = dpcm_write_d2dsc ; + break ; + case 2 : + psf->write_short = dpcm_write_s2dles ; + psf->write_int = dpcm_write_i2dles ; + psf->write_float = dpcm_write_f2dles ; + psf->write_double = dpcm_write_d2dles ; + break ; + default : + psf_log_printf (psf, "dpcm_init() returning SFE_UNIMPLEMENTED\n") ; + return SFE_UNIMPLEMENTED ; + } ; + } ; + + psf->filelength = psf_get_filelen (psf) ; + psf->datalength = (psf->dataend) ? psf->dataend - psf->dataoffset : + psf->filelength - psf->dataoffset ; + psf->sf.frames = psf->datalength / psf->blockwidth ; + + return 0 ; +} /* dpcm_init */ + +/*============================================================================== +*/ + +static sf_count_t +dpcm_seek (SF_PRIVATE *psf, int mode, sf_count_t offset) +{ XI_PRIVATE *pxi ; + int total, bufferlen, len ; + + if ((pxi = psf->fdata) == NULL) + return SFE_INTERNAL ; + + if (psf->datalength < 0 || psf->dataoffset < 0) + { psf->error = SFE_BAD_SEEK ; + return ((sf_count_t) -1) ; + } ; + + if (offset == 0) + { psf_fseek (psf, psf->dataoffset, SEEK_SET) ; + pxi->last_16 = 0 ; + return 0 ; + } ; + + if (offset < 0 || offset > psf->sf.frames) + { psf->error = SFE_BAD_SEEK ; + return ((sf_count_t) -1) ; + } ; + + if (mode != SFM_READ) + { /* What to do about write??? */ + psf->error = SFE_BAD_SEEK ; + return ((sf_count_t) -1) ; + } ; + + psf_fseek (psf, psf->dataoffset, SEEK_SET) ; + + if ((psf->sf.format & SF_FORMAT_SUBMASK) == SF_FORMAT_DPCM_16) + { total = offset ; + bufferlen = ARRAY_LEN (psf->u.sbuf) ; + while (total > 0) + { len = (total > bufferlen) ? bufferlen : total ; + total -= dpcm_read_dles2s (psf, psf->u.sbuf, len) ; + } ; + } + else + { total = offset ; + bufferlen = ARRAY_LEN (psf->u.sbuf) ; + while (total > 0) + { len = (total > bufferlen) ? bufferlen : total ; + total -= dpcm_read_dsc2s (psf, psf->u.sbuf, len) ; + } ; + } ; + + return offset ; +} /* dpcm_seek */ + + +static int +xi_write_header (SF_PRIVATE *psf, int calc_length) +{ XI_PRIVATE *pxi ; + sf_count_t current ; + const char *string ; + + if ((pxi = psf->fdata) == NULL) + return SFE_INTERNAL ; + + calc_length = calc_length ; /* Avoid a compiler warning. */ + + current = psf_ftell (psf) ; + + /* Reset the current header length to zero. */ + psf->header [0] = 0 ; + psf->headindex = 0 ; + psf_fseek (psf, 0, SEEK_SET) ; + + string = "Extended Instrument: " ; + psf_binheader_writef (psf, "b", string, strlen (string)) ; + psf_binheader_writef (psf, "b1", pxi->filename, sizeof (pxi->filename), 0x1A) ; + + /* Write software version and two byte XI version. */ + psf_binheader_writef (psf, "eb2", pxi->software, sizeof (pxi->software), (1 << 8) + 2) ; + + /* + ** Jump note numbers (96), volume envelope (48), pan envelope (48), + ** volume points (1), pan points (1) + */ + psf_binheader_writef (psf, "z", (size_t) (96 + 48 + 48 + 1 + 1)) ; + + /* Jump volume loop (3 bytes), pan loop (3), envelope flags (3), vibrato (3) + ** fade out (2), 22 unknown bytes, and then write sample_count (2 bytes). + */ + psf_binheader_writef (psf, "ez2z2", (size_t) (4 * 3), 0x1234, (size_t) 22, 1) ; + +psf->sf.frames = 12 ; +pxi->loop_begin = 0 ; +pxi->loop_end = 0 ; + + psf_binheader_writef (psf, "et844", psf->sf.frames, pxi->loop_begin, pxi->loop_end) ; + + /* volume, fine tune, flags, pan, note, namelen */ + psf_binheader_writef (psf, "111111", 128, 0, pxi->sample_flags, 128, 0, strlen (pxi->sample_name)) ; + + psf_binheader_writef (psf, "b", pxi->sample_name, sizeof (pxi->sample_name)) ; + + + + + + /* Header construction complete so write it out. */ + psf_fwrite (psf->header, psf->headindex, 1, psf) ; + + if (psf->error) + return psf->error ; + + psf->dataoffset = psf->headindex ; + + if (current > 0) + psf_fseek (psf, current, SEEK_SET) ; + + return psf->error ; +} /* xi_write_header */ + +static int +xi_read_header (SF_PRIVATE *psf) +{ char buffer [64], name [32] ; + short version, fade_out, sample_count ; + int k, loop_begin, loop_end ; + int sample_sizes [MAX_XI_SAMPLES] ; + + psf_binheader_readf (psf, "pb", 0, buffer, 21) ; + + memset (sample_sizes, 0, sizeof (sample_sizes)) ; + + buffer [20] = 0 ; + if (strcmp (buffer, "Extended Instrument:") != 0) + return SFE_XI_BAD_HEADER ; + + memset (buffer, 0, sizeof (buffer)) ; + psf_binheader_readf (psf, "b", buffer, 23) ; + + if (buffer [22] != 0x1A) + return SFE_XI_BAD_HEADER ; + + buffer [22] = 0 ; + psf_log_printf (psf, "Extended Instrument : %s\n", buffer) ; + + psf_binheader_readf (psf, "be2", buffer, 20, &version) ; + buffer [19] = 0 ; + psf_log_printf (psf, "Software : %s\nVersion : %d.%02d\n", buffer, version / 256, version % 256) ; + + /* Jump note numbers (96), volume envelope (48), pan envelope (48), + ** volume points (1), pan points (1) + */ + psf_binheader_readf (psf, "j", 96 + 48 + 48 + 1 + 1) ; + + psf_binheader_readf (psf, "b", buffer, 12) ; + psf_log_printf (psf, "Volume Loop\n sustain : %u\n begin : %u\n end : %u\n", + buffer [0], buffer [1], buffer [2]) ; + psf_log_printf (psf, "Pan Loop\n sustain : %u\n begin : %u\n end : %u\n", + buffer [3], buffer [4], buffer [5]) ; + psf_log_printf (psf, "Envelope Flags\n volume : 0x%X\n pan : 0x%X\n", + buffer [6] & 0xFF, buffer [7] & 0xFF) ; + + psf_log_printf (psf, "Vibrato\n type : %u\n sweep : %u\n depth : %u\n rate : %u\n", + buffer [8], buffer [9], buffer [10], buffer [11]) ; + + /* + ** Read fade_out then jump reserved (2 bytes) and ???? (20 bytes) and + ** sample_count. + */ + psf_binheader_readf (psf, "e2j2", &fade_out, 2 + 20, &sample_count) ; + psf_log_printf (psf, "Fade out : %d\n", fade_out) ; + + /* XI file can contain up to 16 samples. */ + if (sample_count > MAX_XI_SAMPLES) + return SFE_XI_EXCESS_SAMPLES ; + + /* Log all data for each sample. */ + for (k = 0 ; k < sample_count ; k++) + { psf_binheader_readf (psf, "e444", &(sample_sizes [k]), &loop_begin, &loop_end) ; + + /* Read 5 know bytes, 1 unknown byte and 22 name bytes. */ + psf_binheader_readf (psf, "bb", buffer, 6, name, 22) ; + name [21] = 0 ; + + psf_log_printf (psf, "Sample #%d\n name : %s\n size : %d\n", k + 1, name, sample_sizes [k]) ; + psf_log_printf (psf, " loop\n begin : %d\n end : %d\n", loop_begin, loop_end) ; + + psf_log_printf (psf, " volume : %u\n f. tune : %d\n flags : 0x%02X ", + buffer [0] & 0xFF, buffer [1] & 0xFF, buffer [2] & 0xFF) ; + + psf_log_printf (psf, " (") ; + if (buffer [2] & 1) + psf_log_printf (psf, " Loop") ; + if (buffer [2] & 2) + psf_log_printf (psf, " PingPong") ; + psf_log_printf (psf, (buffer [2] & 16) ? " 16bit" : " 8bit") ; + psf_log_printf (psf, " )\n") ; + + psf_log_printf (psf, " pan : %u\n note : %d\n namelen : %d\n", + buffer [3] & 0xFF, buffer [4], buffer [5]) ; + + if (k != 0) + continue ; + + if (buffer [2] & 16) + { psf->sf.format = SF_FORMAT_XI | SF_FORMAT_DPCM_16 ; + psf->bytewidth = 2 ; + } + else + { psf->sf.format = SF_FORMAT_XI | SF_FORMAT_DPCM_8 ; + psf->bytewidth = 1 ; + } ; + } ; + + while (sample_count > 1 && sample_sizes [sample_count - 1] == 0) + sample_count -- ; + + /* Currently, we can only handle 1 sample per file. */ + + if (sample_count > 2) + { psf_log_printf (psf, "*** Sample count is less than 16 but more than 1.\n") ; + psf_log_printf (psf, " sample count : %d sample_sizes [%d] : %d\n", + sample_count, sample_count - 1, sample_sizes [sample_count - 1]) ; + return SFE_XI_EXCESS_SAMPLES ; + } ; + + psf->dataoffset = psf_fseek (psf, 0, SEEK_CUR) ; + psf_log_printf (psf, "Data Offset : %D\n", psf->dataoffset) ; + + psf->datalength = sample_sizes [0] ; + + if (psf->dataoffset + psf->datalength > psf->filelength) + { psf_log_printf (psf, "*** File seems to be truncated. Should be at least %D bytes long.\n", + psf->dataoffset + sample_sizes [0]) ; + psf->datalength = psf->filelength - psf->dataoffset ; + } ; + + if (psf_fseek (psf, psf->dataoffset, SEEK_SET) != psf->dataoffset) + return SFE_BAD_SEEK ; + + psf->close = xi_close ; + + psf->endian = SF_ENDIAN_LITTLE ; + psf->sf.channels = 1 ; /* Always mono */ + psf->sf.samplerate = 44100 ; /* Always */ + + psf->blockwidth = psf->sf.channels * psf->bytewidth ; + + if (! psf->sf.frames && psf->blockwidth) + psf->sf.frames = (psf->filelength - psf->dataoffset) / psf->blockwidth ; + + return 0 ; +} /* xi_read_header */ + +/*============================================================================== +*/ + +static void dsc2s_array (XI_PRIVATE *pxi, signed char *src, int count, short *dest) ; +static void dsc2i_array (XI_PRIVATE *pxi, signed char *src, int count, int *dest) ; +static void dsc2f_array (XI_PRIVATE *pxi, signed char *src, int count, float *dest, float normfact) ; +static void dsc2d_array (XI_PRIVATE *pxi, signed char *src, int count, double *dest, double normfact) ; + +static void dles2s_array (XI_PRIVATE *pxi, short *src, int count, short *dest) ; +static void dles2i_array (XI_PRIVATE *pxi, short *src, int count, int *dest) ; +static void dles2f_array (XI_PRIVATE *pxi, short *src, int count, float *dest, float normfact) ; +static void dles2d_array (XI_PRIVATE *pxi, short *src, int count, double *dest, double normfact) ; + +static sf_count_t +dpcm_read_dsc2s (SF_PRIVATE *psf, short *ptr, sf_count_t len) +{ XI_PRIVATE *pxi ; + int bufferlen, readcount ; + sf_count_t total = 0 ; + + if ((pxi = psf->fdata) == NULL) + return 0 ; + + bufferlen = ARRAY_LEN (psf->u.ucbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + readcount = psf_fread (psf->u.scbuf, sizeof (signed char), bufferlen, psf) ; + dsc2s_array (pxi, psf->u.scbuf, readcount, ptr + total) ; + total += readcount ; + if (readcount < bufferlen) + break ; + len -= readcount ; + } ; + + return total ; +} /* dpcm_read_dsc2s */ + +static sf_count_t +dpcm_read_dsc2i (SF_PRIVATE *psf, int *ptr, sf_count_t len) +{ XI_PRIVATE *pxi ; + int bufferlen, readcount ; + sf_count_t total = 0 ; + + if ((pxi = psf->fdata) == NULL) + return 0 ; + + bufferlen = ARRAY_LEN (psf->u.ucbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + readcount = psf_fread (psf->u.scbuf, sizeof (signed char), bufferlen, psf) ; + dsc2i_array (pxi, psf->u.scbuf, readcount, ptr + total) ; + total += readcount ; + if (readcount < bufferlen) + break ; + len -= readcount ; + } ; + + return total ; +} /* dpcm_read_dsc2i */ + +static sf_count_t +dpcm_read_dsc2f (SF_PRIVATE *psf, float *ptr, sf_count_t len) +{ XI_PRIVATE *pxi ; + int bufferlen, readcount ; + sf_count_t total = 0 ; + float normfact ; + + if ((pxi = psf->fdata) == NULL) + return 0 ; + + normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x80) : 1.0 ; + + bufferlen = ARRAY_LEN (psf->u.ucbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + readcount = psf_fread (psf->u.scbuf, sizeof (signed char), bufferlen, psf) ; + dsc2f_array (pxi, psf->u.scbuf, readcount, ptr + total, normfact) ; + total += readcount ; + if (readcount < bufferlen) + break ; + len -= readcount ; + } ; + + return total ; +} /* dpcm_read_dsc2f */ + +static sf_count_t +dpcm_read_dsc2d (SF_PRIVATE *psf, double *ptr, sf_count_t len) +{ XI_PRIVATE *pxi ; + int bufferlen, readcount ; + sf_count_t total = 0 ; + double normfact ; + + if ((pxi = psf->fdata) == NULL) + return 0 ; + + normfact = (psf->norm_double == SF_TRUE) ? 1.0 / ((double) 0x80) : 1.0 ; + + bufferlen = ARRAY_LEN (psf->u.ucbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + readcount = psf_fread (psf->u.scbuf, sizeof (signed char), bufferlen, psf) ; + dsc2d_array (pxi, psf->u.scbuf, readcount, ptr + total, normfact) ; + total += readcount ; + if (readcount < bufferlen) + break ; + len -= readcount ; + } ; + + return total ; +} /* dpcm_read_dsc2d */ + +/*------------------------------------------------------------------------------ +*/ + +static sf_count_t +dpcm_read_dles2s (SF_PRIVATE *psf, short *ptr, sf_count_t len) +{ XI_PRIVATE *pxi ; + int bufferlen, readcount ; + sf_count_t total = 0 ; + + if ((pxi = psf->fdata) == NULL) + return 0 ; + + bufferlen = ARRAY_LEN (psf->u.sbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + readcount = psf_fread (psf->u.sbuf, sizeof (short), bufferlen, psf) ; + dles2s_array (pxi, psf->u.sbuf, readcount, ptr + total) ; + total += readcount ; + if (readcount < bufferlen) + break ; + len -= readcount ; + } ; + + return total ; +} /* dpcm_read_dles2s */ + +static sf_count_t +dpcm_read_dles2i (SF_PRIVATE *psf, int *ptr, sf_count_t len) +{ XI_PRIVATE *pxi ; + int bufferlen, readcount ; + sf_count_t total = 0 ; + + if ((pxi = psf->fdata) == NULL) + return 0 ; + + bufferlen = ARRAY_LEN (psf->u.sbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + readcount = psf_fread (psf->u.sbuf, sizeof (short), bufferlen, psf) ; + dles2i_array (pxi, psf->u.sbuf, readcount, ptr + total) ; + total += readcount ; + if (readcount < bufferlen) + break ; + len -= readcount ; + } ; + + return total ; +} /* dpcm_read_dles2i */ + +static sf_count_t +dpcm_read_dles2f (SF_PRIVATE *psf, float *ptr, sf_count_t len) +{ XI_PRIVATE *pxi ; + int bufferlen, readcount ; + sf_count_t total = 0 ; + float normfact ; + + if ((pxi = psf->fdata) == NULL) + return 0 ; + + normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x8000) : 1.0 ; + + bufferlen = ARRAY_LEN (psf->u.sbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + readcount = psf_fread (psf->u.sbuf, sizeof (short), bufferlen, psf) ; + dles2f_array (pxi, psf->u.sbuf, readcount, ptr + total, normfact) ; + total += readcount ; + if (readcount < bufferlen) + break ; + len -= readcount ; + } ; + + return total ; +} /* dpcm_read_dles2f */ + +static sf_count_t +dpcm_read_dles2d (SF_PRIVATE *psf, double *ptr, sf_count_t len) +{ XI_PRIVATE *pxi ; + int bufferlen, readcount ; + sf_count_t total = 0 ; + double normfact ; + + if ((pxi = psf->fdata) == NULL) + return 0 ; + + normfact = (psf->norm_double == SF_TRUE) ? 1.0 / ((double) 0x8000) : 1.0 ; + + bufferlen = ARRAY_LEN (psf->u.sbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + readcount = psf_fread (psf->u.sbuf, sizeof (short), bufferlen, psf) ; + dles2d_array (pxi, psf->u.sbuf, readcount, ptr + total, normfact) ; + total += readcount ; + if (readcount < bufferlen) + break ; + len -= readcount ; + } ; + + return total ; +} /* dpcm_read_dles2d */ + +/*============================================================================== +*/ + +static void s2dsc_array (XI_PRIVATE *pxi, short *src, signed char *dest, int count) ; +static void i2dsc_array (XI_PRIVATE *pxi, int *src, signed char *dest, int count) ; +static void f2dsc_array (XI_PRIVATE *pxi, float *src, signed char *dest, int count, float normfact) ; +static void d2dsc_array (XI_PRIVATE *pxi, double *src, signed char *dest, int count, double normfact) ; + +static void s2dles_array (XI_PRIVATE *pxi, short *src, short *dest, int count) ; +static void i2dles_array (XI_PRIVATE *pxi, int *src, short *dest, int count) ; +static void f2dles_array (XI_PRIVATE *pxi, float *src, short *dest, int count, float normfact) ; +static void d2dles_array (XI_PRIVATE *pxi, double *src, short *dest, int count, double normfact) ; + + +static sf_count_t +dpcm_write_s2dsc (SF_PRIVATE *psf, short *ptr, sf_count_t len) +{ XI_PRIVATE *pxi ; + int bufferlen, writecount ; + sf_count_t total = 0 ; + + if ((pxi = psf->fdata) == NULL) + return 0 ; + + bufferlen = ARRAY_LEN (psf->u.ucbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + s2dsc_array (pxi, ptr + total, psf->u.scbuf, bufferlen) ; + writecount = psf_fwrite (psf->u.scbuf, sizeof (signed char), bufferlen, psf) ; + total += writecount ; + if (writecount < bufferlen) + break ; + len -= writecount ; + } ; + + return total ; +} /* dpcm_write_s2dsc */ + +static sf_count_t +dpcm_write_i2dsc (SF_PRIVATE *psf, int *ptr, sf_count_t len) +{ XI_PRIVATE *pxi ; + int bufferlen, writecount ; + sf_count_t total = 0 ; + + if ((pxi = psf->fdata) == NULL) + return 0 ; + + bufferlen = ARRAY_LEN (psf->u.ucbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + i2dsc_array (pxi, ptr + total, psf->u.scbuf, bufferlen) ; + writecount = psf_fwrite (psf->u.scbuf, sizeof (signed char), bufferlen, psf) ; + total += writecount ; + if (writecount < bufferlen) + break ; + len -= writecount ; + } ; + + return total ; +} /* dpcm_write_i2dsc */ + +static sf_count_t +dpcm_write_f2dsc (SF_PRIVATE *psf, float *ptr, sf_count_t len) +{ XI_PRIVATE *pxi ; + int bufferlen, writecount ; + sf_count_t total = 0 ; + float normfact ; + + if ((pxi = psf->fdata) == NULL) + return 0 ; + + normfact = (psf->norm_float == SF_TRUE) ? (1.0 * 0x7F) : 1.0 ; + + bufferlen = ARRAY_LEN (psf->u.ucbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + f2dsc_array (pxi, ptr + total, psf->u.scbuf, bufferlen, normfact) ; + writecount = psf_fwrite (psf->u.scbuf, sizeof (signed char), bufferlen, psf) ; + total += writecount ; + if (writecount < bufferlen) + break ; + len -= writecount ; + } ; + + return total ; +} /* dpcm_write_f2dsc */ + +static sf_count_t +dpcm_write_d2dsc (SF_PRIVATE *psf, double *ptr, sf_count_t len) +{ XI_PRIVATE *pxi ; + int bufferlen, writecount ; + sf_count_t total = 0 ; + double normfact ; + + if ((pxi = psf->fdata) == NULL) + return 0 ; + + normfact = (psf->norm_double == SF_TRUE) ? (1.0 * 0x7F) : 1.0 ; + + bufferlen = ARRAY_LEN (psf->u.ucbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + d2dsc_array (pxi, ptr + total, psf->u.scbuf, bufferlen, normfact) ; + writecount = psf_fwrite (psf->u.scbuf, sizeof (signed char), bufferlen, psf) ; + total += writecount ; + if (writecount < bufferlen) + break ; + len -= writecount ; + } ; + + return total ; +} /* dpcm_write_d2dsc */ + + +static sf_count_t +dpcm_write_s2dles (SF_PRIVATE *psf, short *ptr, sf_count_t len) +{ XI_PRIVATE *pxi ; + int bufferlen, writecount ; + sf_count_t total = 0 ; + + if ((pxi = psf->fdata) == NULL) + return 0 ; + + bufferlen = ARRAY_LEN (psf->u.sbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + s2dles_array (pxi, ptr + total, psf->u.sbuf, bufferlen) ; + writecount = psf_fwrite (psf->u.sbuf, sizeof (short), bufferlen, psf) ; + total += writecount ; + if (writecount < bufferlen) + break ; + len -= writecount ; + } ; + + return total ; +} /* dpcm_write_s2dles */ + +static sf_count_t +dpcm_write_i2dles (SF_PRIVATE *psf, int *ptr, sf_count_t len) +{ XI_PRIVATE *pxi ; + int bufferlen, writecount ; + sf_count_t total = 0 ; + + if ((pxi = psf->fdata) == NULL) + return 0 ; + + bufferlen = ARRAY_LEN (psf->u.sbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + i2dles_array (pxi, ptr + total, psf->u.sbuf, bufferlen) ; + writecount = psf_fwrite (psf->u.sbuf, sizeof (short), bufferlen, psf) ; + total += writecount ; + if (writecount < bufferlen) + break ; + len -= writecount ; + } ; + + return total ; +} /* dpcm_write_i2dles */ + +static sf_count_t +dpcm_write_f2dles (SF_PRIVATE *psf, float *ptr, sf_count_t len) +{ XI_PRIVATE *pxi ; + int bufferlen, writecount ; + sf_count_t total = 0 ; + float normfact ; + + if ((pxi = psf->fdata) == NULL) + return 0 ; + + normfact = (psf->norm_float == SF_TRUE) ? (1.0 * 0x7FFF) : 1.0 ; + + bufferlen = ARRAY_LEN (psf->u.sbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + f2dles_array (pxi, ptr + total, psf->u.sbuf, bufferlen, normfact) ; + writecount = psf_fwrite (psf->u.sbuf, sizeof (short), bufferlen, psf) ; + total += writecount ; + if (writecount < bufferlen) + break ; + len -= writecount ; + } ; + + return total ; +} /* dpcm_write_f2dles */ + +static sf_count_t +dpcm_write_d2dles (SF_PRIVATE *psf, double *ptr, sf_count_t len) +{ XI_PRIVATE *pxi ; + int bufferlen, writecount ; + sf_count_t total = 0 ; + double normfact ; + + if ((pxi = psf->fdata) == NULL) + return 0 ; + + normfact = (psf->norm_double == SF_TRUE) ? (1.0 * 0x7FFF) : 1.0 ; + + bufferlen = ARRAY_LEN (psf->u.sbuf) ; + + while (len > 0) + { if (len < bufferlen) + bufferlen = (int) len ; + d2dles_array (pxi, ptr + total, psf->u.sbuf, bufferlen, normfact) ; + writecount = psf_fwrite (psf->u.sbuf, sizeof (short), bufferlen, psf) ; + total += writecount ; + if (writecount < bufferlen) + break ; + len -= writecount ; + } ; + + return total ; +} /* dpcm_write_d2dles */ + + +/*============================================================================== +*/ + +static void +dsc2s_array (XI_PRIVATE *pxi, signed char *src, int count, short *dest) +{ signed char last_val ; + int k ; + + last_val = pxi->last_16 >> 8 ; + + for (k = 0 ; k < count ; k++) + { last_val += src [k] ; + dest [k] = last_val << 8 ; + } ; + + pxi->last_16 = last_val << 8 ; +} /* dsc2s_array */ + +static void +dsc2i_array (XI_PRIVATE *pxi, signed char *src, int count, int *dest) +{ signed char last_val ; + int k ; + + last_val = pxi->last_16 >> 8 ; + + for (k = 0 ; k < count ; k++) + { last_val += src [k] ; + dest [k] = last_val << 24 ; + } ; + + pxi->last_16 = last_val << 8 ; +} /* dsc2i_array */ + +static void +dsc2f_array (XI_PRIVATE *pxi, signed char *src, int count, float *dest, float normfact) +{ signed char last_val ; + int k ; + + last_val = pxi->last_16 >> 8 ; + + for (k = 0 ; k < count ; k++) + { last_val += src [k] ; + dest [k] = last_val * normfact ; + } ; + + pxi->last_16 = last_val << 8 ; +} /* dsc2f_array */ + +static void +dsc2d_array (XI_PRIVATE *pxi, signed char *src, int count, double *dest, double normfact) +{ signed char last_val ; + int k ; + + last_val = pxi->last_16 >> 8 ; + + for (k = 0 ; k < count ; k++) + { last_val += src [k] ; + dest [k] = last_val * normfact ; + } ; + + pxi->last_16 = last_val << 8 ; +} /* dsc2d_array */ + +/*------------------------------------------------------------------------------ +*/ + +static void +s2dsc_array (XI_PRIVATE *pxi, short *src, signed char *dest, int count) +{ signed char last_val, current ; + int k ; + + last_val = pxi->last_16 >> 8 ; + + for (k = 0 ; k < count ; k++) + { current = src [k] >> 8 ; + dest [k] = current - last_val ; + last_val = current ; + } ; + + pxi->last_16 = last_val << 8 ; +} /* s2dsc_array */ + +static void +i2dsc_array (XI_PRIVATE *pxi, int *src, signed char *dest, int count) +{ signed char last_val, current ; + int k ; + + last_val = pxi->last_16 >> 8 ; + + for (k = 0 ; k < count ; k++) + { current = src [k] >> 24 ; + dest [k] = current - last_val ; + last_val = current ; + } ; + + pxi->last_16 = last_val << 8 ; +} /* i2dsc_array */ + +static void +f2dsc_array (XI_PRIVATE *pxi, float *src, signed char *dest, int count, float normfact) +{ signed char last_val, current ; + int k ; + + last_val = pxi->last_16 >> 8 ; + + for (k = 0 ; k < count ; k++) + { current = lrintf (src [k] * normfact) ; + dest [k] = current - last_val ; + last_val = current ; + } ; + + pxi->last_16 = last_val << 8 ; +} /* f2dsc_array */ + +static void +d2dsc_array (XI_PRIVATE *pxi, double *src, signed char *dest, int count, double normfact) +{ signed char last_val, current ; + int k ; + + last_val = pxi->last_16 >> 8 ; + + for (k = 0 ; k < count ; k++) + { current = lrint (src [k] * normfact) ; + dest [k] = current - last_val ; + last_val = current ; + } ; + + pxi->last_16 = last_val << 8 ; +} /* d2dsc_array */ + +/*============================================================================== +*/ + +static void +dles2s_array (XI_PRIVATE *pxi, short *src, int count, short *dest) +{ short last_val ; + int k ; + + last_val = pxi->last_16 ; + + for (k = 0 ; k < count ; k++) + { last_val += LES2H_SHORT (src [k]) ; + dest [k] = last_val ; + } ; + + pxi->last_16 = last_val ; +} /* dles2s_array */ + +static void +dles2i_array (XI_PRIVATE *pxi, short *src, int count, int *dest) +{ short last_val ; + int k ; + + last_val = pxi->last_16 ; + + for (k = 0 ; k < count ; k++) + { last_val += LES2H_SHORT (src [k]) ; + dest [k] = last_val << 16 ; + } ; + + pxi->last_16 = last_val ; +} /* dles2i_array */ + +static void +dles2f_array (XI_PRIVATE *pxi, short *src, int count, float *dest, float normfact) +{ short last_val ; + int k ; + + last_val = pxi->last_16 ; + + for (k = 0 ; k < count ; k++) + { last_val += LES2H_SHORT (src [k]) ; + dest [k] = last_val * normfact ; + } ; + + pxi->last_16 = last_val ; +} /* dles2f_array */ + +static void +dles2d_array (XI_PRIVATE *pxi, short *src, int count, double *dest, double normfact) +{ short last_val ; + int k ; + + last_val = pxi->last_16 ; + + for (k = 0 ; k < count ; k++) + { last_val += LES2H_SHORT (src [k]) ; + dest [k] = last_val * normfact ; + } ; + + pxi->last_16 = last_val ; +} /* dles2d_array */ + +/*------------------------------------------------------------------------------ +*/ + +static void +s2dles_array (XI_PRIVATE *pxi, short *src, short *dest, int count) +{ short diff, last_val ; + int k ; + + last_val = pxi->last_16 ; + + for (k = 0 ; k < count ; k++) + { diff = src [k] - last_val ; + dest [k] = LES2H_SHORT (diff) ; + last_val = src [k] ; + } ; + + pxi->last_16 = last_val ; +} /* s2dles_array */ + +static void +i2dles_array (XI_PRIVATE *pxi, int *src, short *dest, int count) +{ short diff, last_val ; + int k ; + + last_val = pxi->last_16 ; + + for (k = 0 ; k < count ; k++) + { diff = (src [k] >> 16) - last_val ; + dest [k] = LES2H_SHORT (diff) ; + last_val = src [k] >> 16 ; + } ; + + pxi->last_16 = last_val ; +} /* i2dles_array */ + +static void +f2dles_array (XI_PRIVATE *pxi, float *src, short *dest, int count, float normfact) +{ short diff, last_val, current ; + int k ; + + last_val = pxi->last_16 ; + + for (k = 0 ; k < count ; k++) + { current = lrintf (src [k] * normfact) ; + diff = current - last_val ; + dest [k] = LES2H_SHORT (diff) ; + last_val = current ; + } ; + + pxi->last_16 = last_val ; +} /* f2dles_array */ + +static void +d2dles_array (XI_PRIVATE *pxi, double *src, short *dest, int count, double normfact) +{ short diff, last_val, current ; + int k ; + + last_val = pxi->last_16 ; + + for (k = 0 ; k < count ; k++) + { current = lrint (src [k] * normfact) ; + diff = current - last_val ; + dest [k] = LES2H_SHORT (diff) ; + last_val = current ; + } ; + + pxi->last_16 = last_val ; +} /* d2dles_array */ + +/* +** Do not edit or modify anything in this comment block. +** The arch-tag line is a file identity tag for the GNU Arch +** revision control system. +** +** arch-tag: 1ab2dbe0-29af-4d80-9c6f-cb21b67521bc +*/ diff --git a/Libraries/SndFile/Info.plist b/Libraries/SndFile/Info.plist new file mode 100644 index 000000000..0d967a2e6 --- /dev/null +++ b/Libraries/SndFile/Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + SndFile + CFBundleIconFile + + CFBundleIdentifier + com.apple.carbonframeworktemplate + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + FMWK + CFBundleSignature + ???? + CFBundleVersion + 1.0 + CFBundleShortVersionString + 1.0 + CSResourcesFileMapped + + + diff --git a/Libraries/SndFile/SndFile.xcode/project.pbxproj b/Libraries/SndFile/SndFile.xcode/project.pbxproj new file mode 100644 index 000000000..bc4a83f43 --- /dev/null +++ b/Libraries/SndFile/SndFile.xcode/project.pbxproj @@ -0,0 +1,1542 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 39; + objects = { + 034768DDFF38A45A11DB9C8B = { + children = ( + 8D07F2C80486CC7A007CD1D0, + ); + isa = PBXGroup; + name = Products; + refType = 4; + sourceTree = ""; + }; +//030 +//031 +//032 +//033 +//034 +//080 +//081 +//082 +//083 +//084 + 0867D690FE84028FC02AAC07 = { + buildSettings = { + }; + buildStyles = ( + 4F0BB7EC011F40E904CA0E50, + 4F0BB7ED011F40E904CA0E50, + ); + hasScannedForEncodings = 1; + isa = PBXProject; + mainGroup = 0867D691FE84028FC02AAC07; + productRefGroup = 034768DDFF38A45A11DB9C8B; + projectDirPath = ""; + targets = ( + 8D07F2BC0486CC7A007CD1D0, + ); + }; + 0867D691FE84028FC02AAC07 = { + children = ( + 08FB77ACFE841707C02AAC07, + 089C1665FE841158C02AAC07, + 0867D69AFE84028FC02AAC07, + 034768DDFF38A45A11DB9C8B, + ); + isa = PBXGroup; + name = SndFile; + refType = 4; + sourceTree = ""; + }; + 0867D69AFE84028FC02AAC07 = { + children = ( + ); + isa = PBXGroup; + name = "External Frameworks and Libraries"; + refType = 4; + sourceTree = ""; + }; + 089C1665FE841158C02AAC07 = { + children = ( + 8D07F2C70486CC7A007CD1D0, + 089C1666FE841158C02AAC07, + ); + isa = PBXGroup; + name = Resources; + refType = 4; + sourceTree = ""; + }; + 089C1666FE841158C02AAC07 = { + children = ( + 089C1667FE841158C02AAC07, + ); + isa = PBXVariantGroup; + name = InfoPlist.strings; + refType = 4; + sourceTree = ""; + }; + 089C1667FE841158C02AAC07 = { + fileEncoding = 10; + isa = PBXFileReference; + lastKnownFileType = text.plist.strings; + name = English; + path = English.lproj/InfoPlist.strings; + refType = 4; + sourceTree = ""; + }; + 08FB77ACFE841707C02AAC07 = { + children = ( + 8E46D028082DFF100047A975, + 8E46CF68082DFE3D0047A975, + 8E46CF69082DFE3D0047A975, + 8E46CF6A082DFE3D0047A975, + 8E46CF6B082DFE3D0047A975, + 8E46CF6C082DFE3D0047A975, + 8E46CF6D082DFE3D0047A975, + 8E46CF6E082DFE3D0047A975, + 8E46CF6F082DFE3D0047A975, + 8E46CF70082DFE3D0047A975, + 8E46CF71082DFE3D0047A975, + 8E46CF72082DFE3D0047A975, + 8E46CF73082DFE3D0047A975, + 8E46CF74082DFE3D0047A975, + 8E46CF75082DFE3D0047A975, + 8E46CF76082DFE3D0047A975, + 8E46CF77082DFE3D0047A975, + 8E46CF78082DFE3D0047A975, + 8E46CF86082DFE3D0047A975, + 8E46CF9D082DFE3D0047A975, + 8E46CF9E082DFE3D0047A975, + 8E46CF9F082DFE3D0047A975, + 8E46CFA0082DFE3D0047A975, + 8E46CFA1082DFE3D0047A975, + 8E46CFA2082DFE3D0047A975, + 8E46CFA3082DFE3D0047A975, + 8E46CFA4082DFE3D0047A975, + 8E46CFA5082DFE3D0047A975, + 8E46CFA6082DFE3D0047A975, + 8E46CFA7082DFE3D0047A975, + 8E46CFA8082DFE3D0047A975, + 8E46CFA9082DFE3D0047A975, + 8E46CFAA082DFE3D0047A975, + 8E46CFAB082DFE3D0047A975, + 8E46CFAC082DFE3D0047A975, + 8E46CFAD082DFE3D0047A975, + 8E46CFAE082DFE3D0047A975, + 8E46CFAF082DFE3D0047A975, + 8E46CFB0082DFE3D0047A975, + 8E46CFB1082DFE3D0047A975, + 8E46CFB2082DFE3D0047A975, + 8E46CFB3082DFE3D0047A975, + 8E46CFB4082DFE3D0047A975, + 8E46CFB5082DFE3D0047A975, + 8E46CFB6082DFE3D0047A975, + 8E46CFB7082DFE3D0047A975, + 8E46CFB8082DFE3D0047A975, + 8E46CFB9082DFE3D0047A975, + 8E46CFBA082DFE3D0047A975, + 8E46CFBB082DFE3D0047A975, + 8E46CFBC082DFE3D0047A975, + 8E46CFBD082DFE3D0047A975, + 8E46CFBE082DFE3D0047A975, + 8E46CFBF082DFE3D0047A975, + ); + isa = PBXGroup; + name = Source; + refType = 4; + sourceTree = ""; + }; +//080 +//081 +//082 +//083 +//084 +//4F0 +//4F1 +//4F2 +//4F3 +//4F4 + 4F0BB7EC011F40E904CA0E50 = { + buildSettings = { + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_GENERATE_DEBUGGING_SYMBOLS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + ZERO_LINK = YES; + }; + isa = PBXBuildStyle; + name = Development; + }; + 4F0BB7ED011F40E904CA0E50 = { + buildSettings = { + COPY_PHASE_STRIP = YES; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + ZERO_LINK = NO; + }; + isa = PBXBuildStyle; + name = Deployment; + }; +//4F0 +//4F1 +//4F2 +//4F3 +//4F4 +//8D0 +//8D1 +//8D2 +//8D3 +//8D4 + 8D07F2BC0486CC7A007CD1D0 = { + buildPhases = ( + 8D07F2BD0486CC7A007CD1D0, + 8D07F2BF0486CC7A007CD1D0, + 8D07F2C10486CC7A007CD1D0, + 8D07F2C30486CC7A007CD1D0, + 8D07F2C50486CC7A007CD1D0, + ); + buildRules = ( + ); + buildSettings = { + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + FRAMEWORK_VERSION = A; + GCC_GENERATE_DEBUGGING_SYMBOLS = NO; + GCC_PRECOMPILE_PREFIX_HEADER = NO; + GCC_PREFIX_HEADER = ""; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "@executable_path/../Frameworks"; + LIBRARY_STYLE = DYNAMIC; + PRODUCT_NAME = SndFile; + WRAPPER_EXTENSION = framework; + }; + dependencies = ( + ); + isa = PBXNativeTarget; + name = SndFile; + productInstallPath = "$(HOME)/Library/Frameworks"; + productName = SndFile; + productReference = 8D07F2C80486CC7A007CD1D0; + productType = "com.apple.product-type.framework"; + }; + 8D07F2BD0486CC7A007CD1D0 = { + buildActionMask = 2147483647; + files = ( + 8E46CFC4082DFE3D0047A975, + 8E46CFC8082DFE3D0047A975, + 8E46CFCE082DFE3D0047A975, + 8E46CFD6082DFE3D0047A975, + 8E46CFD7082DFE3D0047A975, + 8E46CFE0082DFE3D0047A975, + 8E46CFE3082DFE3D0047A975, + 8E46CFE4082DFE3D0047A975, + 8E46D006082DFE3D0047A975, + 8E46D007082DFE3D0047A975, + 8E46D009082DFE3D0047A975, + 8E46D012082DFE3D0047A975, + 8E46D029082DFF100047A975, + ); + isa = PBXHeadersBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 8D07F2BF0486CC7A007CD1D0 = { + buildActionMask = 2147483647; + files = ( + 8D07F2C00486CC7A007CD1D0, + ); + isa = PBXResourcesBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 8D07F2C00486CC7A007CD1D0 = { + fileRef = 089C1666FE841158C02AAC07; + isa = PBXBuildFile; + settings = { + }; + }; + 8D07F2C10486CC7A007CD1D0 = { + buildActionMask = 2147483647; + files = ( + 8E46CFC0082DFE3D0047A975, + 8E46CFC1082DFE3D0047A975, + 8E46CFC2082DFE3D0047A975, + 8E46CFC3082DFE3D0047A975, + 8E46CFC5082DFE3D0047A975, + 8E46CFC6082DFE3D0047A975, + 8E46CFC7082DFE3D0047A975, + 8E46CFC9082DFE3D0047A975, + 8E46CFCA082DFE3D0047A975, + 8E46CFCB082DFE3D0047A975, + 8E46CFCC082DFE3D0047A975, + 8E46CFCD082DFE3D0047A975, + 8E46CFCF082DFE3D0047A975, + 8E46CFD1082DFE3D0047A975, + 8E46CFD2082DFE3D0047A975, + 8E46CFD3082DFE3D0047A975, + 8E46CFD4082DFE3D0047A975, + 8E46CFD5082DFE3D0047A975, + 8E46CFDD082DFE3D0047A975, + 8E46CFDF082DFE3D0047A975, + 8E46CFE2082DFE3D0047A975, + 8E46CFE5082DFE3D0047A975, + 8E46CFE6082DFE3D0047A975, + 8E46CFE7082DFE3D0047A975, + 8E46CFE8082DFE3D0047A975, + 8E46CFE9082DFE3D0047A975, + 8E46CFEA082DFE3D0047A975, + 8E46CFEB082DFE3D0047A975, + 8E46CFEE082DFE3D0047A975, + 8E46CFF0082DFE3D0047A975, + 8E46CFF1082DFE3D0047A975, + 8E46CFF2082DFE3D0047A975, + 8E46CFF3082DFE3D0047A975, + 8E46CFF4082DFE3D0047A975, + 8E46CFF5082DFE3D0047A975, + 8E46CFF6082DFE3D0047A975, + 8E46CFF7082DFE3D0047A975, + 8E46CFF8082DFE3D0047A975, + 8E46CFF9082DFE3D0047A975, + 8E46CFFA082DFE3D0047A975, + 8E46CFFB082DFE3D0047A975, + 8E46CFFC082DFE3D0047A975, + 8E46CFFD082DFE3D0047A975, + 8E46CFFE082DFE3D0047A975, + 8E46CFFF082DFE3D0047A975, + 8E46D000082DFE3D0047A975, + 8E46D001082DFE3D0047A975, + 8E46D002082DFE3D0047A975, + 8E46D003082DFE3D0047A975, + 8E46D004082DFE3D0047A975, + 8E46D005082DFE3D0047A975, + 8E46D008082DFE3D0047A975, + 8E46D00A082DFE3D0047A975, + 8E46D00B082DFE3D0047A975, + 8E46D00C082DFE3D0047A975, + 8E46D00D082DFE3D0047A975, + 8E46D00E082DFE3D0047A975, + 8E46D00F082DFE3D0047A975, + 8E46D010082DFE3D0047A975, + 8E46D011082DFE3D0047A975, + 8E46D013082DFE3D0047A975, + 8E46D014082DFE3D0047A975, + 8E46D015082DFE3D0047A975, + ); + isa = PBXSourcesBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 8D07F2C30486CC7A007CD1D0 = { + buildActionMask = 2147483647; + files = ( + ); + isa = PBXFrameworksBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 8D07F2C50486CC7A007CD1D0 = { + buildActionMask = 2147483647; + files = ( + ); + isa = PBXRezBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 8D07F2C70486CC7A007CD1D0 = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = text.plist; + path = Info.plist; + refType = 4; + sourceTree = ""; + }; + 8D07F2C80486CC7A007CD1D0 = { + explicitFileType = wrapper.framework; + includeInIndex = 0; + isa = PBXFileReference; + path = SndFile.framework; + refType = 3; + sourceTree = BUILT_PRODUCTS_DIR; + }; +//8D0 +//8D1 +//8D2 +//8D3 +//8D4 +//8E0 +//8E1 +//8E2 +//8E3 +//8E4 + 8E46CF68082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = aiff.c; + path = Files/src/aiff.c; + refType = 4; + sourceTree = ""; + }; + 8E46CF69082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = alaw.c; + path = Files/src/alaw.c; + refType = 4; + sourceTree = ""; + }; + 8E46CF6A082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = au_g72x.c; + path = Files/src/au_g72x.c; + refType = 4; + sourceTree = ""; + }; + 8E46CF6B082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = au.c; + path = Files/src/au.c; + refType = 4; + sourceTree = ""; + }; + 8E46CF6C082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = au.h; + path = Files/src/au.h; + refType = 4; + sourceTree = ""; + }; + 8E46CF6D082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = avr.c; + path = Files/src/avr.c; + refType = 4; + sourceTree = ""; + }; + 8E46CF6E082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = command.c; + path = Files/src/command.c; + refType = 4; + sourceTree = ""; + }; + 8E46CF6F082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = common.c; + path = Files/src/common.c; + refType = 4; + sourceTree = ""; + }; + 8E46CF70082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = common.h; + path = Files/src/common.h; + refType = 4; + sourceTree = ""; + }; + 8E46CF71082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = dither.c; + path = Files/src/dither.c; + refType = 4; + sourceTree = ""; + }; + 8E46CF72082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = double64.c; + path = Files/src/double64.c; + refType = 4; + sourceTree = ""; + }; + 8E46CF73082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = dwd.c; + path = Files/src/dwd.c; + refType = 4; + sourceTree = ""; + }; + 8E46CF74082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = dwvw.c; + path = Files/src/dwvw.c; + refType = 4; + sourceTree = ""; + }; + 8E46CF75082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = file_io.c; + path = Files/src/file_io.c; + refType = 4; + sourceTree = ""; + }; + 8E46CF76082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = float_cast.h; + path = Files/src/float_cast.h; + refType = 4; + sourceTree = ""; + }; + 8E46CF77082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = float32.c; + path = Files/src/float32.c; + refType = 4; + sourceTree = ""; + }; + 8E46CF78082DFE3D0047A975 = { + children = ( + 8E46CF7A082DFE3D0047A975, + 8E46CF7B082DFE3D0047A975, + 8E46CF7C082DFE3D0047A975, + 8E46CF7D082DFE3D0047A975, + 8E46CF7E082DFE3D0047A975, + 8E46CF7F082DFE3D0047A975, + 8E46CF80082DFE3D0047A975, + 8E46CF81082DFE3D0047A975, + ); + isa = PBXGroup; + name = G72x; + path = Files/src/G72x; + refType = 4; + sourceTree = ""; + }; + 8E46CF7A082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + path = g721.c; + refType = 4; + sourceTree = ""; + }; + 8E46CF7B082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + path = g723_16.c; + refType = 4; + sourceTree = ""; + }; + 8E46CF7C082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + path = g723_24.c; + refType = 4; + sourceTree = ""; + }; + 8E46CF7D082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + path = g723_40.c; + refType = 4; + sourceTree = ""; + }; + 8E46CF7E082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + path = g72x.c; + refType = 4; + sourceTree = ""; + }; + 8E46CF7F082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = g72x.h; + refType = 4; + sourceTree = ""; + }; + 8E46CF80082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = g72x_priv.h; + refType = 4; + sourceTree = ""; + }; + 8E46CF81082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + path = g72x_test.c; + refType = 4; + sourceTree = ""; + }; + 8E46CF86082DFE3D0047A975 = { + children = ( + 8E46CF87082DFE3D0047A975, + 8E46CF89082DFE3D0047A975, + 8E46CF8A082DFE3D0047A975, + 8E46CF8C082DFE3D0047A975, + 8E46CF8D082DFE3D0047A975, + 8E46CF8E082DFE3D0047A975, + 8E46CF8F082DFE3D0047A975, + 8E46CF90082DFE3D0047A975, + 8E46CF91082DFE3D0047A975, + 8E46CF92082DFE3D0047A975, + 8E46CF93082DFE3D0047A975, + 8E46CF94082DFE3D0047A975, + 8E46CF95082DFE3D0047A975, + 8E46CF98082DFE3D0047A975, + 8E46CF9A082DFE3D0047A975, + 8E46CF9B082DFE3D0047A975, + 8E46CF9C082DFE3D0047A975, + ); + isa = PBXGroup; + name = GSM610; + path = Files/src/GSM610; + refType = 4; + sourceTree = ""; + }; + 8E46CF87082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + path = add.c; + refType = 4; + sourceTree = ""; + }; + 8E46CF89082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + path = code.c; + refType = 4; + sourceTree = ""; + }; + 8E46CF8A082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = config.h; + refType = 4; + sourceTree = ""; + }; + 8E46CF8C082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + path = decode.c; + refType = 4; + sourceTree = ""; + }; + 8E46CF8D082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = gsm.h; + refType = 4; + sourceTree = ""; + }; + 8E46CF8E082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = gsm610_priv.h; + refType = 4; + sourceTree = ""; + }; + 8E46CF8F082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + path = gsm_create.c; + refType = 4; + sourceTree = ""; + }; + 8E46CF90082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + path = gsm_decode.c; + refType = 4; + sourceTree = ""; + }; + 8E46CF91082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + path = gsm_destroy.c; + refType = 4; + sourceTree = ""; + }; + 8E46CF92082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + path = gsm_encode.c; + refType = 4; + sourceTree = ""; + }; + 8E46CF93082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + path = gsm_option.c; + refType = 4; + sourceTree = ""; + }; + 8E46CF94082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + path = long_term.c; + refType = 4; + sourceTree = ""; + }; + 8E46CF95082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + path = lpc.c; + refType = 4; + sourceTree = ""; + }; + 8E46CF98082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + path = preprocess.c; + refType = 4; + sourceTree = ""; + }; + 8E46CF9A082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + path = rpe.c; + refType = 4; + sourceTree = ""; + }; + 8E46CF9B082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + path = short_term.c; + refType = 4; + sourceTree = ""; + }; + 8E46CF9C082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + path = table.c; + refType = 4; + sourceTree = ""; + }; + 8E46CF9D082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = gsm610.c; + path = Files/src/gsm610.c; + refType = 4; + sourceTree = ""; + }; + 8E46CF9E082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = htk.c; + path = Files/src/htk.c; + refType = 4; + sourceTree = ""; + }; + 8E46CF9F082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = ima_adpcm.c; + path = Files/src/ima_adpcm.c; + refType = 4; + sourceTree = ""; + }; + 8E46CFA0082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = interleave.c; + path = Files/src/interleave.c; + refType = 4; + sourceTree = ""; + }; + 8E46CFA1082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = ircam.c; + path = Files/src/ircam.c; + refType = 4; + sourceTree = ""; + }; + 8E46CFA2082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = macbinary3.c; + path = Files/src/macbinary3.c; + refType = 4; + sourceTree = ""; + }; + 8E46CFA3082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = macos.c; + path = Files/src/macos.c; + refType = 4; + sourceTree = ""; + }; + 8E46CFA4082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = mat4.c; + path = Files/src/mat4.c; + refType = 4; + sourceTree = ""; + }; + 8E46CFA5082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = mat5.c; + path = Files/src/mat5.c; + refType = 4; + sourceTree = ""; + }; + 8E46CFA6082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = ms_adpcm.c; + path = Files/src/ms_adpcm.c; + refType = 4; + sourceTree = ""; + }; + 8E46CFA7082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = nist.c; + path = Files/src/nist.c; + refType = 4; + sourceTree = ""; + }; + 8E46CFA8082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = ogg.c; + path = Files/src/ogg.c; + refType = 4; + sourceTree = ""; + }; + 8E46CFA9082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = paf.c; + path = Files/src/paf.c; + refType = 4; + sourceTree = ""; + }; + 8E46CFAA082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = pcm.c; + path = Files/src/pcm.c; + refType = 4; + sourceTree = ""; + }; + 8E46CFAB082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = pvf.c; + path = Files/src/pvf.c; + refType = 4; + sourceTree = ""; + }; + 8E46CFAC082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = raw.c; + path = Files/src/raw.c; + refType = 4; + sourceTree = ""; + }; + 8E46CFAD082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = rx2.c; + path = Files/src/rx2.c; + refType = 4; + sourceTree = ""; + }; + 8E46CFAE082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = sd2.c; + path = Files/src/sd2.c; + refType = 4; + sourceTree = ""; + }; + 8E46CFAF082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = sds.c; + path = Files/src/sds.c; + refType = 4; + sourceTree = ""; + }; + 8E46CFB0082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = sf_unistd.h; + path = Files/src/sf_unistd.h; + refType = 4; + sourceTree = ""; + }; + 8E46CFB1082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = sfendian.h; + path = Files/src/sfendian.h; + refType = 4; + sourceTree = ""; + }; + 8E46CFB2082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = sndfile.c; + path = Files/src/sndfile.c; + refType = 4; + sourceTree = ""; + }; + 8E46CFB3082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = sndfile.h; + path = Files/src/sndfile.h; + refType = 4; + sourceTree = ""; + }; + 8E46CFB4082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = strings.c; + path = Files/src/strings.c; + refType = 4; + sourceTree = ""; + }; + 8E46CFB5082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = svx.c; + path = Files/src/svx.c; + refType = 4; + sourceTree = ""; + }; + 8E46CFB6082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = txw.c; + path = Files/src/txw.c; + refType = 4; + sourceTree = ""; + }; + 8E46CFB7082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = ulaw.c; + path = Files/src/ulaw.c; + refType = 4; + sourceTree = ""; + }; + 8E46CFB8082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = voc.c; + path = Files/src/voc.c; + refType = 4; + sourceTree = ""; + }; + 8E46CFB9082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = vox_adpcm.c; + path = Files/src/vox_adpcm.c; + refType = 4; + sourceTree = ""; + }; + 8E46CFBA082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = w64.c; + path = Files/src/w64.c; + refType = 4; + sourceTree = ""; + }; + 8E46CFBB082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = wav_w64.c; + path = Files/src/wav_w64.c; + refType = 4; + sourceTree = ""; + }; + 8E46CFBC082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = wav_w64.h; + path = Files/src/wav_w64.h; + refType = 4; + sourceTree = ""; + }; + 8E46CFBD082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = wav.c; + path = Files/src/wav.c; + refType = 4; + sourceTree = ""; + }; + 8E46CFBE082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = wve.c; + path = Files/src/wve.c; + refType = 4; + sourceTree = ""; + }; + 8E46CFBF082DFE3D0047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = xi.c; + path = Files/src/xi.c; + refType = 4; + sourceTree = ""; + }; + 8E46CFC0082DFE3D0047A975 = { + fileRef = 8E46CF68082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46CFC1082DFE3D0047A975 = { + fileRef = 8E46CF69082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46CFC2082DFE3D0047A975 = { + fileRef = 8E46CF6A082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46CFC3082DFE3D0047A975 = { + fileRef = 8E46CF6B082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46CFC4082DFE3D0047A975 = { + fileRef = 8E46CF6C082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46CFC5082DFE3D0047A975 = { + fileRef = 8E46CF6D082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46CFC6082DFE3D0047A975 = { + fileRef = 8E46CF6E082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46CFC7082DFE3D0047A975 = { + fileRef = 8E46CF6F082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46CFC8082DFE3D0047A975 = { + fileRef = 8E46CF70082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46CFC9082DFE3D0047A975 = { + fileRef = 8E46CF71082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46CFCA082DFE3D0047A975 = { + fileRef = 8E46CF72082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46CFCB082DFE3D0047A975 = { + fileRef = 8E46CF73082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46CFCC082DFE3D0047A975 = { + fileRef = 8E46CF74082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46CFCD082DFE3D0047A975 = { + fileRef = 8E46CF75082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46CFCE082DFE3D0047A975 = { + fileRef = 8E46CF76082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46CFCF082DFE3D0047A975 = { + fileRef = 8E46CF77082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46CFD1082DFE3D0047A975 = { + fileRef = 8E46CF7A082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46CFD2082DFE3D0047A975 = { + fileRef = 8E46CF7B082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46CFD3082DFE3D0047A975 = { + fileRef = 8E46CF7C082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46CFD4082DFE3D0047A975 = { + fileRef = 8E46CF7D082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46CFD5082DFE3D0047A975 = { + fileRef = 8E46CF7E082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46CFD6082DFE3D0047A975 = { + fileRef = 8E46CF7F082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46CFD7082DFE3D0047A975 = { + fileRef = 8E46CF80082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46CFDD082DFE3D0047A975 = { + fileRef = 8E46CF87082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46CFDF082DFE3D0047A975 = { + fileRef = 8E46CF89082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46CFE0082DFE3D0047A975 = { + fileRef = 8E46CF8A082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46CFE2082DFE3D0047A975 = { + fileRef = 8E46CF8C082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46CFE3082DFE3D0047A975 = { + fileRef = 8E46CF8D082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46CFE4082DFE3D0047A975 = { + fileRef = 8E46CF8E082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46CFE5082DFE3D0047A975 = { + fileRef = 8E46CF8F082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46CFE6082DFE3D0047A975 = { + fileRef = 8E46CF90082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46CFE7082DFE3D0047A975 = { + fileRef = 8E46CF91082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46CFE8082DFE3D0047A975 = { + fileRef = 8E46CF92082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46CFE9082DFE3D0047A975 = { + fileRef = 8E46CF93082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46CFEA082DFE3D0047A975 = { + fileRef = 8E46CF94082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46CFEB082DFE3D0047A975 = { + fileRef = 8E46CF95082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46CFEE082DFE3D0047A975 = { + fileRef = 8E46CF98082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46CFF0082DFE3D0047A975 = { + fileRef = 8E46CF9A082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46CFF1082DFE3D0047A975 = { + fileRef = 8E46CF9B082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46CFF2082DFE3D0047A975 = { + fileRef = 8E46CF9C082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46CFF3082DFE3D0047A975 = { + fileRef = 8E46CF9D082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46CFF4082DFE3D0047A975 = { + fileRef = 8E46CF9E082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46CFF5082DFE3D0047A975 = { + fileRef = 8E46CF9F082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46CFF6082DFE3D0047A975 = { + fileRef = 8E46CFA0082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46CFF7082DFE3D0047A975 = { + fileRef = 8E46CFA1082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46CFF8082DFE3D0047A975 = { + fileRef = 8E46CFA2082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46CFF9082DFE3D0047A975 = { + fileRef = 8E46CFA3082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46CFFA082DFE3D0047A975 = { + fileRef = 8E46CFA4082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46CFFB082DFE3D0047A975 = { + fileRef = 8E46CFA5082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46CFFC082DFE3D0047A975 = { + fileRef = 8E46CFA6082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46CFFD082DFE3D0047A975 = { + fileRef = 8E46CFA7082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46CFFE082DFE3D0047A975 = { + fileRef = 8E46CFA8082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46CFFF082DFE3D0047A975 = { + fileRef = 8E46CFA9082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46D000082DFE3D0047A975 = { + fileRef = 8E46CFAA082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46D001082DFE3D0047A975 = { + fileRef = 8E46CFAB082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46D002082DFE3D0047A975 = { + fileRef = 8E46CFAC082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46D003082DFE3D0047A975 = { + fileRef = 8E46CFAD082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46D004082DFE3D0047A975 = { + fileRef = 8E46CFAE082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46D005082DFE3D0047A975 = { + fileRef = 8E46CFAF082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46D006082DFE3D0047A975 = { + fileRef = 8E46CFB0082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46D007082DFE3D0047A975 = { + fileRef = 8E46CFB1082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46D008082DFE3D0047A975 = { + fileRef = 8E46CFB2082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46D009082DFE3D0047A975 = { + fileRef = 8E46CFB3082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + ATTRIBUTES = ( + Public, + ); + }; + }; + 8E46D00A082DFE3D0047A975 = { + fileRef = 8E46CFB4082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46D00B082DFE3D0047A975 = { + fileRef = 8E46CFB5082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46D00C082DFE3D0047A975 = { + fileRef = 8E46CFB6082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46D00D082DFE3D0047A975 = { + fileRef = 8E46CFB7082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46D00E082DFE3D0047A975 = { + fileRef = 8E46CFB8082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46D00F082DFE3D0047A975 = { + fileRef = 8E46CFB9082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46D010082DFE3D0047A975 = { + fileRef = 8E46CFBA082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46D011082DFE3D0047A975 = { + fileRef = 8E46CFBB082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46D012082DFE3D0047A975 = { + fileRef = 8E46CFBC082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46D013082DFE3D0047A975 = { + fileRef = 8E46CFBD082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46D014082DFE3D0047A975 = { + fileRef = 8E46CFBE082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46D015082DFE3D0047A975 = { + fileRef = 8E46CFBF082DFE3D0047A975; + isa = PBXBuildFile; + settings = { + }; + }; + 8E46D028082DFF100047A975 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = config.h; + path = Files/src/config.h; + refType = 4; + sourceTree = ""; + }; + 8E46D029082DFF100047A975 = { + fileRef = 8E46D028082DFF100047A975; + isa = PBXBuildFile; + settings = { + }; + }; + }; + rootObject = 0867D690FE84028FC02AAC07; +} diff --git a/Libraries/SndFile/SndFile.xcode/xugg.mode1 b/Libraries/SndFile/SndFile.xcode/xugg.mode1 new file mode 100644 index 000000000..7ae5f7a47 --- /dev/null +++ b/Libraries/SndFile/SndFile.xcode/xugg.mode1 @@ -0,0 +1,1249 @@ + + + + + ActivePerspectiveName + Project + AllowedModules + + + BundleLoadPath + + MaxInstances + n + Module + PBXSmartGroupTreeModule + Name + Groups and Files Outline View + + + BundleLoadPath + + MaxInstances + n + Module + PBXNavigatorGroup + Name + Editor + + + BundleLoadPath + + MaxInstances + n + Module + XCTaskListModule + Name + Task List + + + BundleLoadPath + + MaxInstances + n + Module + XCDetailModule + Name + File and Smart Group Detail Viewer + + + BundleLoadPath + + MaxInstances + 1 + Module + PBXBuildResultsModule + Name + Detailed Build Results Viewer + + + BundleLoadPath + + MaxInstances + 1 + Module + PBXProjectFindModule + Name + Project Batch Find Tool + + + BundleLoadPath + + MaxInstances + n + Module + PBXRunSessionModule + Name + Run Log + + + BundleLoadPath + + MaxInstances + n + Module + PBXBookmarksModule + Name + Bookmarks Tool + + + BundleLoadPath + + MaxInstances + n + Module + PBXClassBrowserModule + Name + Class Browser + + + BundleLoadPath + + MaxInstances + n + Module + PBXCVSModule + Name + Source Code Control Tool + + + BundleLoadPath + + MaxInstances + n + Module + PBXDebugBreakpointsModule + Name + Debug Breakpoints Tool + + + BundleLoadPath + + MaxInstances + n + Module + XCDockableInspector + Name + Inspector + + + BundleLoadPath + + MaxInstances + n + Module + PBXOpenQuicklyModule + Name + Open Quickly Tool + + + BundleLoadPath + + MaxInstances + 1 + Module + PBXDebugSessionModule + Name + Debugger + + + BundleLoadPath + + MaxInstances + 1 + Module + PBXDebugCLIModule + Name + Debug Console + + + Description + DefaultDescriptionKey + DockingSystemVisible + + Extension + mode1 + FavBarConfig + + PBXProjectModuleGUID + 8E46D03C082DFF310047A975 + XCBarModuleItemNames + + XCBarModuleItems + + + FirstTimeWindowDisplayed + + Identifier + com.apple.perspectives.project.mode1 + MajorVersion + 31 + MinorVersion + 1 + Name + Default + Notifications + + OpenEditors + + PerspectiveWidths + + -1 + -1 + + Perspectives + + + ChosenToolbarItems + + active-target-popup + action + NSToolbarFlexibleSpaceItem + buildOrClean + build-and-runOrDebug + com.apple.ide.PBXToolbarStopButton + get-info + toggle-editor + NSToolbarFlexibleSpaceItem + com.apple.pbx.toolbar.searchfield + + ControllerClassBaseName + + IconName + WindowOfProjectWithEditor + Identifier + perspective.project + IsVertical + + Layout + + + ContentConfiguration + + PBXBottomSmartGroupGIDs + + 1C37FBAC04509CD000000102 + 1C37FAAC04509CD000000102 + 1C08E77C0454961000C914BD + 1C37FABC05509CD000000102 + 1C37FABC05539CD112110102 + E2644B35053B69B200211256 + 1C37FABC04509CD000100104 + 1CC0EA4004350EF90044410B + 1CC0EA4004350EF90041110B + + PBXProjectModuleGUID + 1CE0B1FE06471DED0097A5F4 + PBXProjectModuleLabel + Files + PBXProjectStructureProvided + yes + PBXSmartGroupTreeModuleColumnData + + PBXSmartGroupTreeModuleColumnWidthsKey + + 186 + + PBXSmartGroupTreeModuleColumnsKey_v4 + + MainColumn + + + PBXSmartGroupTreeModuleOutlineStateKey_v7 + + PBXSmartGroupTreeModuleOutlineStateExpansionKey + + 0867D691FE84028FC02AAC07 + 08FB77ACFE841707C02AAC07 + 8E46CF78082DFE3D0047A975 + 1C37FBAC04509CD000000102 + 1C37FABC05509CD000000102 + + PBXSmartGroupTreeModuleOutlineStateSelectionKey + + + 27 + 19 + 1 + 0 + + + PBXSmartGroupTreeModuleOutlineStateVisibleRectKey + {{0, 251}, {186, 338}} + + PBXTopSmartGroupGIDs + + XCIncludePerspectivesSwitch + + XCSharingToken + com.apple.Xcode.GFSharingToken + + GeometryConfiguration + + Frame + {{0, 0}, {203, 356}} + GroupTreeTableConfiguration + + MainColumn + 186 + + RubberWindowFrame + 167 339 690 397 0 0 1024 746 + + Module + PBXSmartGroupTreeModule + Proportion + 203pt + + + Dock + + + ContentConfiguration + + PBXProjectModuleGUID + 1CE0B20306471E060097A5F4 + PBXProjectModuleLabel + g72x_test.c + PBXSplitModuleInNavigatorKey + + Split0 + + PBXProjectModuleGUID + 1CE0B20406471E060097A5F4 + PBXProjectModuleLabel + g72x_test.c + _historyCapacity + 0 + bookmark + 8E6F2A4508480E490011F126 + history + + 8E46D034082DFF310047A975 + 8E46D035082DFF310047A975 + 8EE4A652082E6D1D00415456 + 8EE4A773082E711300415456 + 8E6F2A3608480DE90011F126 + 8E6F2A4408480E490011F126 + + prevStack + + 8E46D037082DFF310047A975 + 8E46D038082DFF310047A975 + 8EE4A653082E6D1D00415456 + 8EE4A775082E711300415456 + 8E6F2A3808480DE90011F126 + + + SplitCount + 1 + + StatusBarVisibility + + + GeometryConfiguration + + Frame + {{0, 0}, {482, 246}} + RubberWindowFrame + 167 339 690 397 0 0 1024 746 + + Module + PBXNavigatorGroup + Proportion + 246pt + + + BecomeActive + + ContentConfiguration + + PBXProjectModuleGUID + 1CE0B20506471E060097A5F4 + PBXProjectModuleLabel + Detail + + GeometryConfiguration + + Frame + {{0, 251}, {482, 105}} + RubberWindowFrame + 167 339 690 397 0 0 1024 746 + + Module + XCDetailModule + Proportion + 105pt + + + Proportion + 482pt + + + Name + Project + ServiceClasses + + XCModuleDock + PBXSmartGroupTreeModule + XCModuleDock + PBXNavigatorGroup + XCDetailModule + + TableOfContents + + 8E6F2A3A08480DE90011F126 + 1CE0B1FE06471DED0097A5F4 + 8E6F2A3B08480DE90011F126 + 1CE0B20306471E060097A5F4 + 1CE0B20506471E060097A5F4 + + ToolbarConfiguration + xcode.toolbar.config.default + + + ControllerClassBaseName + + IconName + WindowOfProject + Identifier + perspective.morph + IsVertical + 0 + Layout + + + BecomeActive + 1 + ContentConfiguration + + PBXBottomSmartGroupGIDs + + 1C37FBAC04509CD000000102 + 1C37FAAC04509CD000000102 + 1C08E77C0454961000C914BD + 1C37FABC05509CD000000102 + 1C37FABC05539CD112110102 + E2644B35053B69B200211256 + 1C37FABC04509CD000100104 + 1CC0EA4004350EF90044410B + 1CC0EA4004350EF90041110B + + PBXProjectModuleGUID + 11E0B1FE06471DED0097A5F4 + PBXProjectModuleLabel + Files + PBXProjectStructureProvided + yes + PBXSmartGroupTreeModuleColumnData + + PBXSmartGroupTreeModuleColumnWidthsKey + + 186 + + PBXSmartGroupTreeModuleColumnsKey_v4 + + MainColumn + + + PBXSmartGroupTreeModuleOutlineStateKey_v7 + + PBXSmartGroupTreeModuleOutlineStateExpansionKey + + 29B97314FDCFA39411CA2CEA + 1C37FABC05509CD000000102 + + PBXSmartGroupTreeModuleOutlineStateSelectionKey + + + 0 + + + PBXSmartGroupTreeModuleOutlineStateVisibleRectKey + {{0, 0}, {186, 337}} + + PBXTopSmartGroupGIDs + + XCIncludePerspectivesSwitch + 1 + XCSharingToken + com.apple.Xcode.GFSharingToken + + GeometryConfiguration + + Frame + {{0, 0}, {203, 355}} + GroupTreeTableConfiguration + + MainColumn + 186 + + RubberWindowFrame + 373 269 690 397 0 0 1440 878 + + Module + PBXSmartGroupTreeModule + Proportion + 100% + + + Name + Morph + PreferredWidth + 300 + ServiceClasses + + XCModuleDock + PBXSmartGroupTreeModule + + TableOfContents + + 11E0B1FE06471DED0097A5F4 + + ToolbarConfiguration + xcode.toolbar.config.default.short + + + PerspectivesBarVisible + + ShelfIsVisible + + SourceDescription + file at '/System/Library/PrivateFrameworks/DevToolsInterface.framework/Versions/A/Resources/XCPerspectivesSpecificationMode1.xcperspec' + StatusbarIsVisible + + TimeStamp + 0.0 + ToolbarDisplayMode + 1 + ToolbarIsVisible + + ToolbarSizeMode + 1 + Type + Perspectives + UpdateMessage + The Default Workspace in this version of Xcode now includes support to hide and show the detail view (what has been referred to as the "Metro-Morph" feature). You must discard your current Default Workspace settings and update to the latest Default Workspace in order to gain this feature. Do you wish to update to the latest Workspace defaults for project '%@'? + WindowJustification + 5 + WindowOrderList + + 1C530D57069F1CE1000CFCEE + /Users/xugg/Projects/Cog/Libraries/SndFile/SndFile.xcode + + WindowString + 167 339 690 397 0 0 1024 746 + WindowTools + + + FirstTimeWindowDisplayed + + Identifier + windowTool.build + IsVertical + + Layout + + + Dock + + + BecomeActive + + ContentConfiguration + + PBXProjectModuleGUID + 1CD0528F0623707200166675 + PBXProjectModuleLabel + aiff.c + StatusBarVisibility + + + GeometryConfiguration + + Frame + {{0, 0}, {500, 218}} + RubberWindowFrame + 188 213 500 500 0 0 1024 746 + + Module + PBXNavigatorGroup + Proportion + 218pt + + + ContentConfiguration + + PBXProjectModuleGUID + XCMainBuildResultsModuleGUID + PBXProjectModuleLabel + Build + XCBuildResultsTrigger_Collapse + 1021 + XCBuildResultsTrigger_Open + 1011 + + GeometryConfiguration + + Frame + {{0, 223}, {500, 236}} + RubberWindowFrame + 188 213 500 500 0 0 1024 746 + + Module + PBXBuildResultsModule + Proportion + 236pt + + + Proportion + 459pt + + + Name + Build Results + ServiceClasses + + PBXBuildResultsModule + + StatusbarIsVisible + + TableOfContents + + 8E46D01B082DFE610047A975 + 8EE4A64F082E6D1C00415456 + 1CD0528F0623707200166675 + XCMainBuildResultsModuleGUID + + ToolbarConfiguration + xcode.toolbar.config.build + WindowString + 188 213 500 500 0 0 1024 746 + WindowToolGUID + 8E46D01B082DFE610047A975 + WindowToolIsVisible + + + + Identifier + windowTool.debugger + Layout + + + Dock + + + ContentConfiguration + + Debugger + + HorizontalSplitView + + _collapsingFrameDimension + 0.0 + _indexOfCollapsedView + 0 + _percentageOfCollapsedView + 0.0 + isCollapsed + yes + sizes + + {{0, 0}, {317, 164}} + {{317, 0}, {377, 164}} + + + VerticalSplitView + + _collapsingFrameDimension + 0.0 + _indexOfCollapsedView + 0 + _percentageOfCollapsedView + 0.0 + isCollapsed + yes + sizes + + {{0, 0}, {694, 164}} + {{0, 164}, {694, 216}} + + + + LauncherConfigVersion + 8 + PBXProjectModuleGUID + 1C162984064C10D400B95A72 + PBXProjectModuleLabel + Debug - GLUTExamples (Underwater) + + GeometryConfiguration + + DebugConsoleDrawerSize + {100, 120} + DebugConsoleVisible + None + DebugConsoleWindowFrame + {{200, 200}, {500, 300}} + DebugSTDIOWindowFrame + {{200, 200}, {500, 300}} + Frame + {{0, 0}, {694, 380}} + RubberWindowFrame + 321 238 694 422 0 0 1440 878 + + Module + PBXDebugSessionModule + Proportion + 100% + + + Proportion + 100% + + + Name + Debugger + ServiceClasses + + PBXDebugSessionModule + + StatusbarIsVisible + 1 + TableOfContents + + 1CD10A99069EF8BA00B06720 + 1C0AD2AB069F1E9B00FABCE6 + 1C162984064C10D400B95A72 + 1C0AD2AC069F1E9B00FABCE6 + + ToolbarConfiguration + xcode.toolbar.config.debug + WindowString + 321 238 694 422 0 0 1440 878 + WindowToolGUID + 1CD10A99069EF8BA00B06720 + WindowToolIsVisible + 0 + + + FirstTimeWindowDisplayed + + Identifier + windowTool.find + IsVertical + + Layout + + + Dock + + + Dock + + + BecomeActive + + ContentConfiguration + + PBXProjectModuleGUID + 1CDD528C0622207200134675 + PBXProjectModuleLabel + g72x_test.c + StatusBarVisibility + + + GeometryConfiguration + + Frame + {{0, 0}, {781, 212}} + RubberWindowFrame + 209 220 781 470 0 0 1024 746 + + Module + PBXNavigatorGroup + Proportion + 781pt + + + Proportion + 212pt + + + ContentConfiguration + + PBXProjectModuleGUID + 1CD0528E0623707200166675 + PBXProjectModuleLabel + Project Find + + GeometryConfiguration + + Frame + {{0, 217}, {781, 212}} + RubberWindowFrame + 209 220 781 470 0 0 1024 746 + + Module + PBXProjectFindModule + Proportion + 212pt + + + Proportion + 429pt + + + Name + Project Find + ServiceClasses + + PBXProjectFindModule + + StatusbarIsVisible + + TableOfContents + + 1C530D57069F1CE1000CFCEE + 8E6F2A3C08480DE90011F126 + 8E6F2A3D08480DE90011F126 + 1CDD528C0622207200134675 + 1CD0528E0623707200166675 + + WindowString + 209 220 781 470 0 0 1024 746 + WindowToolGUID + 1C530D57069F1CE1000CFCEE + WindowToolIsVisible + + + + Identifier + MENUSEPARATOR + + + Identifier + windowTool.debuggerConsole + Layout + + + Dock + + + BecomeActive + 1 + ContentConfiguration + + PBXProjectModuleGUID + 1C78EAAC065D492600B07095 + PBXProjectModuleLabel + Debugger Console + + GeometryConfiguration + + Frame + {{0, 0}, {440, 358}} + RubberWindowFrame + 650 41 440 400 0 0 1280 1002 + + Module + PBXDebugCLIModule + Proportion + 358pt + + + Proportion + 358pt + + + Name + Debugger Console + ServiceClasses + + PBXDebugCLIModule + + StatusbarIsVisible + 1 + TableOfContents + + 1C78EAAD065D492600B07095 + 1C78EAAE065D492600B07095 + 1C78EAAC065D492600B07095 + + WindowString + 650 41 440 400 0 0 1280 1002 + + + Identifier + windowTool.run + Layout + + + Dock + + + ContentConfiguration + + LauncherConfigVersion + 3 + PBXProjectModuleGUID + 1CD0528B0623707200166675 + PBXProjectModuleLabel + Run + Runner + + HorizontalSplitView + + _collapsingFrameDimension + 0.0 + _indexOfCollapsedView + 0 + _percentageOfCollapsedView + 0.0 + isCollapsed + yes + sizes + + {{0, 0}, {493, 167}} + {{0, 176}, {493, 267}} + + + VerticalSplitView + + _collapsingFrameDimension + 0.0 + _indexOfCollapsedView + 0 + _percentageOfCollapsedView + 0.0 + isCollapsed + yes + sizes + + {{0, 0}, {405, 443}} + {{414, 0}, {514, 443}} + + + + + GeometryConfiguration + + Frame + {{0, 0}, {460, 159}} + RubberWindowFrame + 316 696 459 200 0 0 1280 1002 + + Module + PBXRunSessionModule + Proportion + 159pt + + + Proportion + 159pt + + + Name + Run Log + ServiceClasses + + PBXRunSessionModule + + StatusbarIsVisible + 1 + TableOfContents + + 1C0AD2B3069F1EA900FABCE6 + 1C0AD2B4069F1EA900FABCE6 + 1CD0528B0623707200166675 + 1C0AD2B5069F1EA900FABCE6 + + ToolbarConfiguration + xcode.toolbar.config.run + WindowString + 316 696 459 200 0 0 1280 1002 + WindowToolGUID + 1C0AD2B3069F1EA900FABCE6 + WindowToolIsVisible + 0 + + + Identifier + windowTool.scm + Layout + + + Dock + + + ContentConfiguration + + PBXProjectModuleGUID + 1C78EAB2065D492600B07095 + PBXProjectModuleLabel + <No Editor> + PBXSplitModuleInNavigatorKey + + Split0 + + PBXProjectModuleGUID + 1C78EAB3065D492600B07095 + + SplitCount + 1 + + StatusBarVisibility + 1 + + GeometryConfiguration + + Frame + {{0, 0}, {452, 0}} + RubberWindowFrame + 743 379 452 308 0 0 1280 1002 + + Module + PBXNavigatorGroup + Proportion + 0pt + + + BecomeActive + 1 + ContentConfiguration + + PBXProjectModuleGUID + 1CD052920623707200166675 + PBXProjectModuleLabel + SCM + + GeometryConfiguration + + ConsoleFrame + {{0, 259}, {452, 0}} + Frame + {{0, 7}, {452, 259}} + RubberWindowFrame + 743 379 452 308 0 0 1280 1002 + TableConfiguration + + Status + 30 + FileName + 199 + Path + 197.09500122070312 + + TableFrame + {{0, 0}, {452, 250}} + + Module + PBXCVSModule + Proportion + 262pt + + + Proportion + 266pt + + + Name + SCM + ServiceClasses + + PBXCVSModule + + StatusbarIsVisible + 1 + TableOfContents + + 1C78EAB4065D492600B07095 + 1C78EAB5065D492600B07095 + 1C78EAB2065D492600B07095 + 1CD052920623707200166675 + + ToolbarConfiguration + xcode.toolbar.config.scm + WindowString + 743 379 452 308 0 0 1280 1002 + + + Identifier + windowTool.breakpoints + Layout + + + Dock + + + BecomeActive + 1 + ContentConfiguration + + PBXProjectModuleGUID + 1CD052930623707200166675 + PBXProjectModuleLabel + Breakpoints + + GeometryConfiguration + + BreakpointsTreeTableConfiguration + + enabledColumn + 16 + breakpointColumn + 201.5830078125 + + Frame + {{0, 0}, {240, 195}} + RubberWindowFrame + 342 421 240 216 0 0 1440 878 + + Module + PBXDebugBreakpointsModule + Proportion + 195pt + + + Proportion + 195pt + + + Name + Breakpoints + ServiceClasses + + PBXDebugBreakpointsModule + + StatusbarIsVisible + 0 + TableOfContents + + 1C0AD2AD069F1E9B00FABCE6 + 1C0AD2AE069F1E9B00FABCE6 + 1CD052930623707200166675 + + WindowString + 342 421 240 216 0 0 1440 878 + WindowToolGUID + 1C0AD2AD069F1E9B00FABCE6 + WindowToolIsVisible + 0 + + + Identifier + windowTool.bookmarks + Layout + + + Dock + + + Module + PBXBookmarksModule + Proportion + 100% + + + Proportion + 100% + + + Name + Bookmarks + ServiceClasses + + PBXBookmarksModule + + StatusbarIsVisible + 0 + WindowString + 538 42 401 187 0 0 1280 1002 + + + Identifier + windowTool.classBrowser + Layout + + + Dock + + + BecomeActive + 1 + ContentConfiguration + + OptionsSetName + Hierarchy, all classes + PBXProjectModuleGUID + 1CA6456E063B45B4001379D8 + PBXProjectModuleLabel + Class Browser - NSObject + + GeometryConfiguration + + ClassesFrame + {{0, 0}, {374, 96}} + ClassesTreeTableConfiguration + + PBXClassNameColumnIdentifier + 208 + PBXClassBookColumnIdentifier + 22 + + Frame + {{0, 0}, {630, 331}} + MembersFrame + {{0, 105}, {374, 395}} + MembersTreeTableConfiguration + + PBXMemberTypeIconColumnIdentifier + 22 + PBXMemberNameColumnIdentifier + 216 + PBXMemberTypeColumnIdentifier + 97 + PBXMemberBookColumnIdentifier + 22 + + PBXModuleWindowStatusBarHidden2 + 1 + RubberWindowFrame + 385 179 630 352 0 0 1440 878 + + Module + PBXClassBrowserModule + Proportion + 332pt + + + Proportion + 332pt + + + Name + Class Browser + ServiceClasses + + PBXClassBrowserModule + + StatusbarIsVisible + 0 + TableOfContents + + 1C0AD2AF069F1E9B00FABCE6 + 1C0AD2B0069F1E9B00FABCE6 + 1CA6456E063B45B4001379D8 + + ToolbarConfiguration + xcode.toolbar.config.classbrowser + WindowString + 385 179 630 352 0 0 1440 878 + WindowToolGUID + 1C0AD2AF069F1E9B00FABCE6 + WindowToolIsVisible + 0 + + + + diff --git a/Libraries/SndFile/SndFile.xcode/xugg.pbxuser b/Libraries/SndFile/SndFile.xcode/xugg.pbxuser new file mode 100644 index 000000000..b4999b10c --- /dev/null +++ b/Libraries/SndFile/SndFile.xcode/xugg.pbxuser @@ -0,0 +1,274 @@ +// !$*UTF8*$! +{ + 0867D690FE84028FC02AAC07 = { + activeBuildStyle = 4F0BB7ED011F40E904CA0E50; + activeTarget = 8D07F2BC0486CC7A007CD1D0; + addToTargets = ( + 8D07F2BC0486CC7A007CD1D0, + ); + codeSenseManager = 8E46CF65082DFDF00047A975; + perUserDictionary = { + PBXConfiguration.PBXFileTableDataSource3.PBXExecutablesDataSource = { + PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; + PBXFileTableDataSourceColumnSortingKey = PBXExecutablesDataSource_NameID; + PBXFileTableDataSourceColumnWidthsKey = ( + 22, + 300, + 130.5835, + ); + PBXFileTableDataSourceColumnsKey = ( + PBXExecutablesDataSource_ActiveFlagID, + PBXExecutablesDataSource_NameID, + PBXExecutablesDataSource_CommentsID, + ); + }; + PBXConfiguration.PBXFileTableDataSource3.PBXFileTableDataSource = { + PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; + PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID; + PBXFileTableDataSourceColumnWidthsKey = ( + 20, + 243, + 20, + 48, + 43, + 43, + 20, + ); + PBXFileTableDataSourceColumnsKey = ( + PBXFileDataSource_FiletypeID, + PBXFileDataSource_Filename_ColumnID, + PBXFileDataSource_Built_ColumnID, + PBXFileDataSource_ObjectSize_ColumnID, + PBXFileDataSource_Errors_ColumnID, + PBXFileDataSource_Warnings_ColumnID, + PBXFileDataSource_Target_ColumnID, + ); + }; + PBXConfiguration.PBXTargetDataSource.PBXTargetDataSource = { + PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; + PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID; + PBXFileTableDataSourceColumnWidthsKey = ( + 20, + 200, + 63, + 20, + 48.1626, + 43, + 43, + ); + PBXFileTableDataSourceColumnsKey = ( + PBXFileDataSource_FiletypeID, + PBXFileDataSource_Filename_ColumnID, + PBXTargetDataSource_PrimaryAttribute, + PBXFileDataSource_Built_ColumnID, + PBXFileDataSource_ObjectSize_ColumnID, + PBXFileDataSource_Errors_ColumnID, + PBXFileDataSource_Warnings_ColumnID, + ); + }; + PBXPerProjectTemplateStateSaveDate = 138939859; + PBXWorkspaceStateSaveDate = 138939859; + }; + perUserProjectItems = { + 8E46D034082DFF310047A975 = 8E46D034082DFF310047A975; + 8E46D035082DFF310047A975 = 8E46D035082DFF310047A975; + 8E46D037082DFF310047A975 = 8E46D037082DFF310047A975; + 8E46D038082DFF310047A975 = 8E46D038082DFF310047A975; + 8E6F2A3608480DE90011F126 = 8E6F2A3608480DE90011F126; + 8E6F2A3808480DE90011F126 = 8E6F2A3808480DE90011F126; + 8E6F2A4408480E490011F126 = 8E6F2A4408480E490011F126; + 8E6F2A4508480E490011F126 = 8E6F2A4508480E490011F126; + 8EE4A652082E6D1D00415456 = 8EE4A652082E6D1D00415456; + 8EE4A653082E6D1D00415456 = 8EE4A653082E6D1D00415456; + 8EE4A773082E711300415456 = 8EE4A773082E711300415456; + 8EE4A775082E711300415456 = 8EE4A775082E711300415456; + }; + sourceControlManager = 8E46CF64082DFDF00047A975; + userBuildSettings = { + }; + }; + 8D07F2BC0486CC7A007CD1D0 = { + activeExec = 0; + }; + 8E46CF64082DFDF00047A975 = { + fallbackIsa = XCSourceControlManager; + isSCMEnabled = 0; + isa = PBXSourceControlManager; + scmConfiguration = { + }; + scmType = ""; + }; + 8E46CF65082DFDF00047A975 = { + indexTemplatePath = ""; + isa = PBXCodeSenseManager; + }; + 8E46CF68082DFE3D0047A975 = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {1016, 18844}}"; + sepNavSelRange = "{12483, 27}"; + sepNavVisRect = "{{0, 5813}, {441, 319}}"; + }; + }; + 8E46CF77082DFE3D0047A975 = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {668, 13454}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRect = "{{0, 0}, {441, 319}}"; + }; + }; + 8E46CF81082DFE3D0047A975 = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {698, 3122}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRect = "{{0, 0}, {441, 214}}"; + }; + }; + 8E46CF8A082DFE3D0047A975 = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {441, 476}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRect = "{{0, 157}, {441, 319}}"; + }; + }; + 8E46CFA2082DFE3D0047A975 = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {488, 826}}"; + sepNavSelRange = "{969, 0}"; + sepNavVisRect = "{{0, 320}, {459, 186}}"; + }; + }; + 8E46CFB3082DFE3D0047A975 = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {578, 6888}}"; + sepNavSelRange = "{7786, 0}"; + sepNavVisRect = "{{0, 6566}, {441, 214}}"; + }; + }; + 8E46D028082DFF100047A975 = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {488, 3360}}"; + sepNavSelRange = "{5194, 6}"; + sepNavVisRect = "{{0, 2529}, {441, 319}}"; + }; + }; + 8E46D034082DFF310047A975 = { + fRef = 8E46CF8A082DFE3D0047A975; + isa = PBXTextBookmark; + name = "config.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 658; + vrLoc = 344; + }; + 8E46D035082DFF310047A975 = { + fRef = 8E46CF77082DFE3D0047A975; + isa = PBXTextBookmark; + name = "float32.c: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 897; + vrLoc = 0; + }; + 8E46D037082DFF310047A975 = { + fRef = 8E46CF8A082DFE3D0047A975; + isa = PBXTextBookmark; + name = "config.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 658; + vrLoc = 344; + }; + 8E46D038082DFF310047A975 = { + fRef = 8E46CF77082DFE3D0047A975; + isa = PBXTextBookmark; + name = "float32.c: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 897; + vrLoc = 0; + }; + 8E6F2A3608480DE90011F126 = { + fRef = 8E46CFB3082DFE3D0047A975; + isa = PBXTextBookmark; + name = "sndfile.h: sf_count_t"; + rLen = 0; + rLoc = 7786; + rType = 0; + vrLen = 633; + vrLoc = 15393; + }; + 8E6F2A3808480DE90011F126 = { + fRef = 8E46CFB3082DFE3D0047A975; + isa = PBXTextBookmark; + name = "sndfile.h: sf_count_t"; + rLen = 0; + rLoc = 7786; + rType = 0; + vrLen = 633; + vrLoc = 15393; + }; + 8E6F2A4408480E490011F126 = { + fRef = 8E46CF81082DFE3D0047A975; + isa = PBXTextBookmark; + name = "g72x_test.c: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 794; + vrLoc = 0; + }; + 8E6F2A4508480E490011F126 = { + fRef = 8E46CF81082DFE3D0047A975; + isa = PBXTextBookmark; + name = "g72x_test.c: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 794; + vrLoc = 0; + }; + 8EE4A652082E6D1D00415456 = { + fRef = 8E46D028082DFF100047A975; + isa = PBXTextBookmark; + name = loff_t; + rLen = 6; + rLoc = 5194; + rType = 0; + vrLen = 628; + vrLoc = 4870; + }; + 8EE4A653082E6D1D00415456 = { + fRef = 8E46D028082DFF100047A975; + isa = PBXTextBookmark; + name = loff_t; + rLen = 6; + rLoc = 5194; + rType = 0; + vrLen = 628; + vrLoc = 4870; + }; + 8EE4A773082E711300415456 = { + fRef = 8E46CF68082DFE3D0047A975; + isa = PBXTextBookmark; + name = "cptr = psf->u.scbuf ;"; + rLen = 27; + rLoc = 12483; + rType = 0; + vrLen = 1020; + vrLoc = 11991; + }; + 8EE4A775082E711300415456 = { + fRef = 8E46CF68082DFE3D0047A975; + isa = PBXTextBookmark; + name = "cptr = psf->u.scbuf ;"; + rLen = 27; + rLoc = 12483; + rType = 0; + vrLen = 1020; + vrLoc = 11991; + }; +} diff --git a/Libraries/TagLib/English.lproj/InfoPlist.strings b/Libraries/TagLib/English.lproj/InfoPlist.strings new file mode 100644 index 0000000000000000000000000000000000000000..80c359b69f1b11bb6c469753eb71fe2a87557f7d GIT binary patch literal 142 zcmW-a%?g5G5Jk`0r}%K`LLVU96a+%J>IKT55Gx}ysE1b%GR)k$m&44wkdY8LF;H>g zPRE~y+U%>o8BGSBYEWBep=;e!UK>C1G3}*)8CGfCHS4W;)VY9O~`&ib35 JJFdDN(F&Nn7^naM literal 0 HcmV?d00001 diff --git a/Libraries/TagLib/Files/AUTHORS b/Libraries/TagLib/Files/AUTHORS new file mode 100644 index 000000000..463ed20f3 --- /dev/null +++ b/Libraries/TagLib/Files/AUTHORS @@ -0,0 +1,8 @@ +Scott Wheeler + Author, maintainer +Ismael Orenstein + Xing header implementation +Allan Sandfeld Jensen + FLAC metadata implementation +Teemu Tervo + Numerous bug reports and fixes diff --git a/Libraries/TagLib/Files/COPYING b/Libraries/TagLib/Files/COPYING new file mode 100644 index 000000000..e38ffa837 --- /dev/null +++ b/Libraries/TagLib/Files/COPYING @@ -0,0 +1,481 @@ + GNU LIBRARY GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1991 Free Software Foundation, Inc. + 59 Temple Place - Suite 330 + Boston, MA 02111-1307, USA. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the library GPL. It is + numbered 2 because it goes with version 2 of the ordinary GPL.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Library General Public License, applies to some +specially designated Free Software Foundation software, and to any +other libraries whose authors decide to use it. You can use it for +your libraries, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if +you distribute copies of the library, or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link a program with the library, you must provide +complete object files to the recipients so that they can relink them +with the library, after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + Our method of protecting your rights has two steps: (1) copyright +the library, and (2) offer you this license which gives you legal +permission to copy, distribute and/or modify the library. + + Also, for each distributor's protection, we want to make certain +that everyone understands that there is no warranty for this free +library. If the library is modified by someone else and passed on, we +want its recipients to know that what they have is not the original +version, so that any problems introduced by others will not reflect on +the original authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that companies distributing free +software will individually obtain patent licenses, thus in effect +transforming the program into proprietary software. To prevent this, +we have made it clear that any patent must be licensed for everyone's +free use or not licensed at all. + + Most GNU software, including some libraries, is covered by the ordinary +GNU General Public License, which was designed for utility programs. This +license, the GNU Library General Public License, applies to certain +designated libraries. This license is quite different from the ordinary +one; be sure to read it in full, and don't assume that anything in it is +the same as in the ordinary license. + + The reason we have a separate public license for some libraries is that +they blur the distinction we usually make between modifying or adding to a +program and simply using it. Linking a program with a library, without +changing the library, is in some sense simply using the library, and is +analogous to running a utility program or application program. However, in +a textual and legal sense, the linked executable is a combined work, a +derivative of the original library, and the ordinary General Public License +treats it as such. + + Because of this blurred distinction, using the ordinary General +Public License for libraries did not effectively promote software +sharing, because most developers did not use the libraries. We +concluded that weaker conditions might promote sharing better. + + However, unrestricted linking of non-free programs would deprive the +users of those programs of all benefit from the free status of the +libraries themselves. This Library General Public License is intended to +permit developers of non-free programs to use free libraries, while +preserving your freedom as a user of such programs to change the free +libraries that are incorporated in them. (We have not seen how to achieve +this as regards changes in header files, but we have achieved it as regards +changes in the actual functions of the Library.) The hope is that this +will lead to faster development of free libraries. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, while the latter only +works together with the library. + + Note that it is possible for a library to be covered by the ordinary +General Public License rather than by this special one. + + GNU LIBRARY GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library which +contains a notice placed by the copyright holder or other authorized +party saying it may be distributed under the terms of this Library +General Public License (also called "this License"). Each licensee is +addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also compile or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + c) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + d) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the source code distributed need not include anything that is normally +distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Library General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! diff --git a/Libraries/TagLib/Files/ChangeLog b/Libraries/TagLib/Files/ChangeLog new file mode 100644 index 000000000..e69de29bb diff --git a/Libraries/TagLib/Files/INSTALL b/Libraries/TagLib/Files/INSTALL new file mode 100644 index 000000000..02a4a0740 --- /dev/null +++ b/Libraries/TagLib/Files/INSTALL @@ -0,0 +1,167 @@ +Basic Installation +================== + + These are generic installation instructions. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, a file +`config.cache' that saves the results of its tests to speed up +reconfiguring, and a file `config.log' containing compiler output +(useful mainly for debugging `configure'). + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If at some point `config.cache' +contains results you don't want to keep, you may remove or edit it. + + The file `configure.in' is used to create `configure' by a program +called `autoconf'. You only need `configure.in' if you want to change +it or regenerate `configure' using a newer version of `autoconf'. + +The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. If you're + using `csh' on an old version of System V, you might need to type + `sh ./configure' instead to prevent `csh' from trying to execute + `configure' itself. + + Running `configure' takes a while. While running, it prints some + messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Type `make install' to install the programs and any data files and + documentation. + + 4. You can remove the program binaries and object files from the + source code directory by typing `make clean'. + +Compilers and Options +===================== + + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. You can give `configure' +initial values for variables by setting them in the environment. Using +a Bourne-compatible shell, you can do that on the command line like +this: + CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure + +Or on systems that have the `env' program, you can do it like this: + env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure + +Compiling For Multiple Architectures +==================================== + + You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you must use a version of `make' that +supports the `VPATH' variable, such as GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. + + If you have to use a `make' that does not supports the `VPATH' +variable, you have to compile the package for one architecture at a time +in the source code directory. After you have installed the package for +one architecture, use `make distclean' before reconfiguring for another +architecture. + +Installation Names +================== + + By default, `make install' will install the package's files in +`/usr/local/bin', `/usr/local/man', etc. You can specify an +installation prefix other than `/usr/local' by giving `configure' the +option `--prefix=PATH'. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +give `configure' the option `--exec-prefix=PATH', the package will use +PATH as the prefix for installing programs and libraries. +Documentation and other data files will still use the regular prefix. + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + +Optional Features +================= + + Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + +Specifying the System Type +========================== + + There may be some features `configure' can not figure out +automatically, but needs to determine by the type of host the package +will run on. Usually `configure' can figure that out, but if it prints +a message saying it can not guess the host type, give it the +`--host=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name with three fields: + CPU-COMPANY-SYSTEM + +See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the host type. + + If you are building compiler tools for cross-compiling, you can also +use the `--target=TYPE' option to select the type of system they will +produce code for and the `--build=TYPE' option to select the type of +system on which you are compiling the package. + +Sharing Defaults +================ + + If you want to set default values for `configure' scripts to share, +you can create a site shell script called `config.site' that gives +default values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Operation Controls +================== + + `configure' recognizes the following options to control how it +operates. + +`--cache-file=FILE' + Use and save the results of the tests in FILE instead of + `./config.cache'. Set FILE to `/dev/null' to disable caching, for + debugging `configure'. + +`--help' + Print a summary of the options to `configure', and exit. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`--version' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`configure' also accepts some other, not widely useful, options. + diff --git a/Libraries/TagLib/Files/Makefile.am b/Libraries/TagLib/Files/Makefile.am new file mode 100644 index 000000000..1c1f9be51 --- /dev/null +++ b/Libraries/TagLib/Files/Makefile.am @@ -0,0 +1,29 @@ +SUBDIRS = taglib bindings tests + +EXTRA_DIST = admin AUTHORS COPYING ChangeLog INSTALL README TODO taglib.lsm + +AUTOMAKE_OPTIONS = foreign + +$(top_srcdir)/configure.in: configure.in.in $(top_srcdir)/subdirs + cd $(top_srcdir) && $(MAKE) -f admin/Makefile.common configure.in ; + +$(top_srcdir)/subdirs: + cd $(top_srcdir) && $(MAKE) -f admin/Makefile.common subdirs + +$(top_srcdir)/acinclude.m4: $(top_srcdir)/admin/acinclude.m4.in $(top_srcdir)/admin/libtool.m4.in + @cd $(top_srcdir) && cat admin/acinclude.m4.in admin/libtool.m4.in > acinclude.m4 + +MAINTAINERCLEANFILES = subdirs configure.in acinclude.m4 configure.files + +package-messages: + $(MAKE) -f admin/Makefile.common package-messages + +dist-hook: + cd $(top_distdir) && perl admin/am_edit -padmin + cd $(top_distdir) && $(MAKE) -f admin/Makefile.common subdirs + +examples: examples-all + +examples-all: + cd examples ; \ + $(MAKE) all diff --git a/Libraries/TagLib/Files/Makefile.cvs b/Libraries/TagLib/Files/Makefile.cvs new file mode 100644 index 000000000..ac8066e05 --- /dev/null +++ b/Libraries/TagLib/Files/Makefile.cvs @@ -0,0 +1,14 @@ +all: + @echo "This Makefile is only for the CVS repository" + @echo "This will be deleted before making the distribution" + @echo "" + @if test ! -d admin; then \ + echo "Please recheckout this module!" ;\ + echo "for cvs: use checkout once and after that update again" ;\ + echo "for cvsup: checkout kde-common from cvsup and" ;\ + echo " link kde-common/admin to ./admin" ;\ + exit 1 ;\ + fi + $(MAKE) -f admin/Makefile.common cvs + +.SILENT: diff --git a/Libraries/TagLib/Files/Makefile.in b/Libraries/TagLib/Files/Makefile.in new file mode 100644 index 000000000..96e23ee5c --- /dev/null +++ b/Libraries/TagLib/Files/Makefile.in @@ -0,0 +1,643 @@ +# Makefile.in generated by automake 1.7.6 from Makefile.am. +# KDE tags expanded automatically by am_edit - $Revision$ +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = . + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTODIRS = @AUTODIRS@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CONF_FILES = @CONF_FILES@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +KDE_PLUGIN = @KDE_PLUGIN@ +KDE_USE_CLOSURE_FALSE = @KDE_USE_CLOSURE_FALSE@ +KDE_USE_CLOSURE_TRUE = @KDE_USE_CLOSURE_TRUE@ +KDE_USE_FINAL_FALSE = @KDE_USE_FINAL_FALSE@ +KDE_USE_FINAL_TRUE = @KDE_USE_FINAL_TRUE@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +NOOPT_CFLAGS = @NOOPT_CFLAGS@ +NOOPT_CXXFLAGS = @NOOPT_CXXFLAGS@ +NOREPO = @NOREPO@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +REPO = @REPO@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +TOPSUBDIRS = @TOPSUBDIRS@ +USE_EXCEPTIONS = @USE_EXCEPTIONS@ +USE_RTTI = @USE_RTTI@ +VERSION = @VERSION@ +WOVERLOADED_VIRTUAL = @WOVERLOADED_VIRTUAL@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +all_includes = @all_includes@ +all_libraries = @all_libraries@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +link_zlib_FALSE = @link_zlib_FALSE@ +link_zlib_TRUE = @link_zlib_TRUE@ +localstatedir = @localstatedir@ +mandir = @mandir@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +SUBDIRS = taglib bindings tests + +EXTRA_DIST = admin AUTHORS COPYING ChangeLog INSTALL README TODO taglib.lsm + +AUTOMAKE_OPTIONS = foreign + +MAINTAINERCLEANFILES = subdirs configure.in acinclude.m4 configure.files +subdir = . +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/admin/mkinstalldirs +CONFIG_HEADER = config.h +CONFIG_CLEAN_FILES = +DIST_SOURCES = + +RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \ + ps-recursive install-info-recursive uninstall-info-recursive \ + all-recursive install-data-recursive install-exec-recursive \ + installdirs-recursive install-recursive uninstall-recursive \ + check-recursive installcheck-recursive +DIST_COMMON = README AUTHORS COPYING ChangeLog INSTALL Makefile.am \ + Makefile.in TODO acinclude.m4 aclocal.m4 admin/ChangeLog \ + admin/compile admin/config.guess admin/config.sub admin/depcomp \ + admin/install-sh admin/ltmain.sh admin/missing \ + admin/mkinstalldirs admin/ylwrap config.h.in configure \ + configure.in +DIST_SUBDIRS = $(SUBDIRS) +#>- all: config.h +#>+ 1 +all: docs-am config.h + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +.SUFFIXES: + +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ + configure.lineno +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) +#>- cd $(top_srcdir) && \ +#>- $(AUTOMAKE) --foreign Makefile +#>+ 3 + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign Makefile + cd $(top_srcdir) && perl admin/am_edit Makefile.in +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe) + +$(top_builddir)/config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck +$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) + cd $(srcdir) && $(AUTOCONF) + +$(ACLOCAL_M4): configure.in acinclude.m4 + cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) + +config.h: stamp-h1 + @if test ! -f $@; then \ + rm -f stamp-h1; \ + $(MAKE) stamp-h1; \ + else :; fi + +stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status + @rm -f stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status config.h + +$(srcdir)/config.h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOHEADER) + touch $(srcdir)/config.h.in + +distclean-hdr: + -rm -f config.h stamp-h1 + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ETAGS = etags +ETAGSFLAGS = + +CTAGS = ctags +CTAGSFLAGS = + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique + +TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if (etags --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + else \ + include_option=--include; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -f $$subdir/TAGS && \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique + +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +#>- DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +#>+ 4 +KDE_DIST=configure.files configure.in.in Makefile.cvs subdirs + +DISTFILES= $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) $(KDE_DIST) + + +top_distdir = . +distdir = $(PACKAGE)-$(VERSION) + +am__remove_distdir = \ + { test ! -d $(distdir) \ + || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -fr $(distdir); }; } + +GZIP_ENV = --best +distuninstallcheck_listfiles = find . -type f -print +distcleancheck_listfiles = find . -type f -print + +distdir: $(DISTFILES) + $(am__remove_distdir) + mkdir $(distdir) + $(mkinstalldirs) $(distdir)/admin $(distdir)/taglib + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d $(distdir)/$$subdir \ + || mkdir $(distdir)/$$subdir \ + || exit 1; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" \ + distdir=../$(distdir)/$$subdir \ + distdir) \ + || exit 1; \ + fi; \ + done + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" distdir="$(distdir)" \ + dist-hook + -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ + ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ + || chmod -R a+r $(distdir) +dist-gzip: distdir + $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + +dist dist-all: distdir + $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + $(am__remove_distdir) + GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf - + chmod -R a-w $(distdir); chmod a+w $(distdir) + mkdir $(distdir)/_build + mkdir $(distdir)/_inst + chmod a-w $(distdir) + dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ + && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ + && cd $(distdir)/_build \ + && ../configure --srcdir=.. --prefix="$$dc_install_base" \ + $(DISTCHECK_CONFIGURE_FLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ + distuninstallcheck \ + && chmod -R a-w "$$dc_install_base" \ + && ({ \ + (cd ../.. && $(mkinstalldirs) "$$dc_destdir") \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ + distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ + } || { rm -rf "$$dc_destdir"; exit 1; }) \ + && rm -rf "$$dc_destdir" \ + && $(MAKE) $(AM_MAKEFLAGS) dist-gzip \ + && rm -f $(distdir).tar.gz \ + && $(MAKE) $(AM_MAKEFLAGS) distcleancheck + $(am__remove_distdir) + @echo "$(distdir).tar.gz is ready for distribution" | \ + sed 'h;s/./=/g;p;x;p;x' +distuninstallcheck: + @cd $(distuninstallcheck_dir) \ + && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ + || { echo "ERROR: files left after uninstall:" ; \ + if test -n "$(DESTDIR)"; then \ + echo " (check DESTDIR support)"; \ + fi ; \ + $(distuninstallcheck_listfiles) ; \ + exit 1; } >&2 +distcleancheck: distclean + @if test '$(srcdir)' = . ; then \ + echo "ERROR: distcleancheck can only run from a VPATH build" ; \ + exit 1 ; \ + fi + @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left in build directory after distclean:" ; \ + $(distcleancheck_listfiles) ; \ + exit 1; } >&2 +check-am: all-am +check: check-recursive +all-am: Makefile config.h +installdirs: installdirs-recursive +installdirs-am: + +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +#>- clean: clean-recursive +#>+ 1 +clean: kde-rpo-clean clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) +distclean-am: clean-am distclean-generic distclean-hdr distclean-libtool \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-recursive + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf $(top_srcdir)/autom4te.cache +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-info-am + +uninstall-info: uninstall-info-recursive + +.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \ + clean-generic clean-libtool clean-recursive ctags \ + ctags-recursive dist dist-all dist-gzip distcheck distclean \ + distclean-generic distclean-hdr distclean-libtool \ + distclean-recursive distclean-tags distcleancheck distdir \ + distuninstallcheck dvi dvi-am dvi-recursive info info-am \ + info-recursive install install-am install-data install-data-am \ + install-data-recursive install-exec install-exec-am \ + install-exec-recursive install-info install-info-am \ + install-info-recursive install-man install-recursive \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am installdirs-recursive maintainer-clean \ + maintainer-clean-generic maintainer-clean-recursive mostlyclean \ + mostlyclean-generic mostlyclean-libtool mostlyclean-recursive \ + pdf pdf-am pdf-recursive ps ps-am ps-recursive tags \ + tags-recursive uninstall uninstall-am uninstall-info-am \ + uninstall-info-recursive uninstall-recursive + + +$(top_srcdir)/configure.in: configure.in.in $(top_srcdir)/subdirs + cd $(top_srcdir) && $(MAKE) -f admin/Makefile.common configure.in ; + +$(top_srcdir)/subdirs: + cd $(top_srcdir) && $(MAKE) -f admin/Makefile.common subdirs + +$(top_srcdir)/acinclude.m4: $(top_srcdir)/admin/acinclude.m4.in $(top_srcdir)/admin/libtool.m4.in + @cd $(top_srcdir) && cat admin/acinclude.m4.in admin/libtool.m4.in > acinclude.m4 + +package-messages: + $(MAKE) -f admin/Makefile.common package-messages + +dist-hook: + cd $(top_distdir) && perl admin/am_edit -padmin + cd $(top_distdir) && $(MAKE) -f admin/Makefile.common subdirs + +examples: examples-all + +examples-all: + cd examples ; \ + $(MAKE) all +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: + +#>+ 2 +docs-am: + +#>+ 6 +force-reedit: + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign Makefile + cd $(top_srcdir) && perl admin/am_edit Makefile.in + + +#>+ 2 +final: + $(MAKE) all-am +#>+ 2 +final-install: + $(MAKE) install-am +#>+ 2 +no-final: + $(MAKE) all-am +#>+ 2 +no-final-install: + $(MAKE) install-am +#>+ 3 +cvs-clean: + $(MAKE) admindir=$(top_srcdir)/admin -f $(top_srcdir)/admin/Makefile.common cvs-clean + +#>+ 3 +kde-rpo-clean: + -rm -f *.rpo diff --git a/Libraries/TagLib/Files/README b/Libraries/TagLib/Files/README new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/Libraries/TagLib/Files/README @@ -0,0 +1 @@ + diff --git a/Libraries/TagLib/Files/TODO b/Libraries/TagLib/Files/TODO new file mode 100644 index 000000000..e69de29bb diff --git a/Libraries/TagLib/Files/config.h b/Libraries/TagLib/Files/config.h new file mode 100644 index 000000000..1df8d2bb0 --- /dev/null +++ b/Libraries/TagLib/Files/config.h @@ -0,0 +1,65 @@ +/* config.h. Generated by configure. */ +/* config.h.in. Generated from configure.in by autoheader. */ + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 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_MEMORY_H 1 + +/* 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_STDLIB_H 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. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* C++ compiler supports template repository */ +#define HAVE_TEMPLATE_REPOSITORY 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* have zlib */ +#define HAVE_ZLIB 0 + +/* Suffix for lib directories */ +#define KDELIBSUFF "" + +/* Name of package */ +#define PACKAGE "taglib" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "" + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Version number of package */ +#define VERSION "0.1" diff --git a/Libraries/TagLib/Files/taglib/ape/Makefile.am b/Libraries/TagLib/Files/taglib/ape/Makefile.am new file mode 100644 index 000000000..6d0635a7f --- /dev/null +++ b/Libraries/TagLib/Files/taglib/ape/Makefile.am @@ -0,0 +1,13 @@ +INCLUDES = \ + -I$(top_srcdir)/taglib \ + -I$(top_srcdir)/taglib/toolkit \ + $(all_includes) + +noinst_LTLIBRARIES = libape.la + +libape_la_SOURCES = apetag.cpp apefooter.cpp apeitem.cpp + +taglib_include_HEADERS = apetag.h apefooter.h apeitem.h +taglib_includedir = $(includedir)/taglib + +EXTRA_DIST = $(libape_la_SOURCES) $(taglib_include_HEADERS) diff --git a/Libraries/TagLib/Files/taglib/ape/Makefile.in b/Libraries/TagLib/Files/taglib/ape/Makefile.in new file mode 100644 index 000000000..b3248e61b --- /dev/null +++ b/Libraries/TagLib/Files/taglib/ape/Makefile.in @@ -0,0 +1,553 @@ +# Makefile.in generated by automake 1.7.6 from Makefile.am. +# KDE tags expanded automatically by am_edit - $Revision$ +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../.. + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTODIRS = @AUTODIRS@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CONF_FILES = @CONF_FILES@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +KDE_PLUGIN = @KDE_PLUGIN@ +KDE_USE_CLOSURE_FALSE = @KDE_USE_CLOSURE_FALSE@ +KDE_USE_CLOSURE_TRUE = @KDE_USE_CLOSURE_TRUE@ +KDE_USE_FINAL_FALSE = @KDE_USE_FINAL_FALSE@ +KDE_USE_FINAL_TRUE = @KDE_USE_FINAL_TRUE@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +NOOPT_CFLAGS = @NOOPT_CFLAGS@ +NOOPT_CXXFLAGS = @NOOPT_CXXFLAGS@ +NOREPO = @NOREPO@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +REPO = @REPO@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +TOPSUBDIRS = @TOPSUBDIRS@ +USE_EXCEPTIONS = @USE_EXCEPTIONS@ +USE_RTTI = @USE_RTTI@ +VERSION = @VERSION@ +WOVERLOADED_VIRTUAL = @WOVERLOADED_VIRTUAL@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +all_includes = @all_includes@ +all_libraries = @all_libraries@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +link_zlib_FALSE = @link_zlib_FALSE@ +link_zlib_TRUE = @link_zlib_TRUE@ +localstatedir = @localstatedir@ +mandir = @mandir@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +INCLUDES = \ + -I$(top_srcdir)/taglib \ + -I$(top_srcdir)/taglib/toolkit \ + $(all_includes) + + +noinst_LTLIBRARIES = libape.la + +libape_la_SOURCES = apetag.cpp apefooter.cpp apeitem.cpp + +taglib_include_HEADERS = apetag.h apefooter.h apeitem.h +taglib_includedir = $(includedir)/taglib + +EXTRA_DIST = $(libape_la_SOURCES) $(taglib_include_HEADERS) +subdir = taglib/ape +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/admin/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) + +libape_la_LDFLAGS = +libape_la_LIBADD = +am_libape_la_OBJECTS = apetag.lo apefooter.lo apeitem.lo +#>- libape_la_OBJECTS = $(am_libape_la_OBJECTS) +#>+ 4 +libape_la_final_OBJECTS = libape_la.all_cpp.lo +libape_la_nofinal_OBJECTS = apetag.lo apefooter.lo apeitem.lo +@KDE_USE_FINAL_FALSE@libape_la_OBJECTS = $(libape_la_nofinal_OBJECTS) +@KDE_USE_FINAL_TRUE@libape_la_OBJECTS = $(libape_la_final_OBJECTS) + +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/admin/depcomp +am__depfiles_maybe = depfiles +#>- @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/apefooter.Plo \ +#>- @AMDEP_TRUE@ ./$(DEPDIR)/apeitem.Plo ./$(DEPDIR)/apetag.Plo +#>+ 5 +@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@DEP_FILES = $(DEPDIR)/libape_la.all_cpp.P ./$(DEPDIR)/apefooter.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@ @AMDEP_TRUE@ ./$(DEPDIR)/apeitem.Plo ./$(DEPDIR)/apetag.Plo +@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@DEP_FILES = ./$(DEPDIR)/apefooter.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@ @AMDEP_TRUE@ ./$(DEPDIR)/apeitem.Plo ./$(DEPDIR)/apetag.Plo + +#>- CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ +#>- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +#>+ 2 +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(KDE_CXXFLAGS) +#>- LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) \ +#>- $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ +#>- $(AM_CXXFLAGS) $(CXXFLAGS) +#>+ 3 +LTCXXCOMPILE = $(LIBTOOL) --mode=compile --tag=CXX $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) $(KDE_CXXFLAGS) +CXXLD = $(CXX) +#>- CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \ +#>- $(AM_LDFLAGS) $(LDFLAGS) -o $@ +#>+ 2 +CXXLINK = $(LIBTOOL) --mode=link --tag=CXX $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(KDE_CXXFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +DIST_SOURCES = $(libape_la_SOURCES) +HEADERS = $(taglib_include_HEADERS) + +DIST_COMMON = $(taglib_include_HEADERS) Makefile.am Makefile.in +SOURCES = $(libape_la_SOURCES) + +#>- all: all-am +#>+ 1 +all: docs-am all-am + +.SUFFIXES: +.SUFFIXES: .cpp .lo .o .obj +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) +#>- cd $(top_srcdir) && \ +#>- $(AUTOMAKE) --gnu taglib/ape/Makefile +#>+ 3 + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu taglib/ape/Makefile + cd $(top_srcdir) && perl admin/am_edit taglib/ape/Makefile.in +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" = "$$p" && dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libape.la: $(libape_la_OBJECTS) $(libape_la_DEPENDENCIES) + $(CXXLINK) $(libape_la_LDFLAGS) $(libape_la_OBJECTS) $(libape_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) core *.core + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/apefooter.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/apeitem.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/apetag.Plo@am__quote@ + +distclean-depend: + -rm -rf ./$(DEPDIR) + +.cpp.o: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + +.cpp.obj: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` + +.cpp.lo: +@am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: +taglib_includeHEADERS_INSTALL = $(INSTALL_HEADER) +install-taglib_includeHEADERS: $(taglib_include_HEADERS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(taglib_includedir) + @list='$(taglib_include_HEADERS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(taglib_includeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(taglib_includedir)/$$f"; \ + $(taglib_includeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(taglib_includedir)/$$f; \ + done + +uninstall-taglib_includeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(taglib_include_HEADERS)'; for p in $$list; do \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " rm -f $(DESTDIR)$(taglib_includedir)/$$f"; \ + rm -f $(DESTDIR)$(taglib_includedir)/$$f; \ + done + +ETAGS = etags +ETAGSFLAGS = + +CTAGS = ctags +CTAGSFLAGS = + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique + +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +#>- DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +#>+ 4 +KDE_DIST=ape-tag-format.txt + +DISTFILES= $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) $(KDE_DIST) + + +top_distdir = ../.. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) + +installdirs: + $(mkinstalldirs) $(DESTDIR)$(taglib_includedir) +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +#>- clean: clean-am +#>+ 1 +clean: kde-rpo-clean clean-am + +#>- clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ +#>- mostlyclean-am +#>+ 2 +clean-am: clean-final clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + +distclean-am: clean-am distclean-compile distclean-depend \ + distclean-generic distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: install-taglib_includeHEADERS + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am uninstall-taglib_includeHEADERS + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstLTLIBRARIES ctags distclean \ + distclean-compile distclean-depend distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am info \ + info-am install install-am install-data install-data-am \ + install-exec install-exec-am install-info install-info-am \ + install-man install-strip install-taglib_includeHEADERS \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-info-am \ + uninstall-taglib_includeHEADERS + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: + +#>+ 2 +docs-am: + +#>+ 6 +force-reedit: + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu taglib/ape/Makefile + cd $(top_srcdir) && perl admin/am_edit taglib/ape/Makefile.in + + +#>+ 11 +libape_la.all_cpp.cpp: $(srcdir)/Makefile.in $(srcdir)/apetag.cpp $(srcdir)/apefooter.cpp $(srcdir)/apeitem.cpp + @echo 'creating libape_la.all_cpp.cpp ...'; \ + rm -f libape_la.all_cpp.files libape_la.all_cpp.final; \ + echo "#define KDE_USE_FINAL 1" >> libape_la.all_cpp.final; \ + for file in apetag.cpp apefooter.cpp apeitem.cpp ; do \ + echo "#include \"$$file\"" >> libape_la.all_cpp.files; \ + test ! -f $(srcdir)/$$file || egrep '^#pragma +implementation' $(srcdir)/$$file >> libape_la.all_cpp.final; \ + done; \ + cat libape_la.all_cpp.final libape_la.all_cpp.files > libape_la.all_cpp.cpp; \ + rm -f libape_la.all_cpp.final libape_la.all_cpp.files + +#>+ 3 +clean-final: + -rm -f libape_la.all_cpp.cpp + +#>+ 2 +final: + $(MAKE) libape_la_OBJECTS="$(libape_la_final_OBJECTS)" all-am +#>+ 2 +final-install: + $(MAKE) libape_la_OBJECTS="$(libape_la_final_OBJECTS)" install-am +#>+ 2 +no-final: + $(MAKE) libape_la_OBJECTS="$(libape_la_nofinal_OBJECTS)" all-am +#>+ 2 +no-final-install: + $(MAKE) libape_la_OBJECTS="$(libape_la_nofinal_OBJECTS)" install-am +#>+ 3 +cvs-clean: + $(MAKE) admindir=$(top_srcdir)/admin -f $(top_srcdir)/admin/Makefile.common cvs-clean + +#>+ 3 +kde-rpo-clean: + -rm -f *.rpo diff --git a/Libraries/TagLib/Files/taglib/ape/ape-tag-format.txt b/Libraries/TagLib/Files/taglib/ape/ape-tag-format.txt new file mode 100644 index 000000000..21ff1c861 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/ape/ape-tag-format.txt @@ -0,0 +1,170 @@ +================================================================================ += APE Tag Specification, Version 2.000 +================================================================================ + +Original Content (C) 2004, Frank Klemm +Formatting / Editing (C) 2004, Scott Wheeler + +================================================================================ += Contents +================================================================================ + +1 - APE Tag General Structure +2 - APE Tag Header / Footer Format +3 - APE Tag Flags +4 - APE Tag Item Format +5 - APE Tag Item Supported Keys +6 - APE Tag Item Content +7 - Data Types +7.1 - Data Types / UTF-8 +7.2 - Data Types / Dates +7.3 - Data Types / Timestamps + +================================================================================ += 1 - APE Tag General Structure +================================================================================ + +Member of Basic Components of SV8 Stream Note: + +It is strongly recommended that the data size be stored in the tags. The size +should normally be in the roughly one kilobyte, never more than 8 kilobytes. + +Larger data should be stored externally using link entries. Linked data is much +easier to process by normal programs, so for instance JPEG data should not be +included inside the audio file. + +APE Tag Version 2.000 (with header, recommended): + +/================================\ +| APE Tag Header | 32 bytes | +|-------------------|------------| +| APE Tag Item 1 | > 10 bytes | +| APE Tag Item 2 | > 10 bytes | +| APE Tag Item n-1 | > 10 bytes | +| APE Tag Item n | > 10 bytes | +|-------------------|------------| +| APE Tag Footer | 32 bytes | +\================================/ + + +APE tag items should be sorted ascending by size. When streaming, parts of the +APE tag may be dropped to reduce the danger of drop outs between tracks. This +is not required, but is strongly recommended. It would be desirable for the i +tems to be sorted by importance / size, but this is not feasible. This +convention should only be broken when adding less important small items and it +is not desirable to rewrite the entire tag. An APE tag at the end of a file +(the recommended location) must have at least a footer; an APE tag at the +beginning of a file (strongly discouraged) must have at least a header. + +APE Tag Version 1.000 (without header, deprecated) + +/================================\ +| APE Tag Item 1 | > 10 bytes | +| APE Tag Item 2 | > 10 bytes | +| APE Tag Item n-1 | > 10 bytes | +| APE Tag Item n | > 10 bytes | +|-------------------|------------| +| APE Tag Footer | 32 bytes | +\================================/ + +================================================================================ += 2 - APE Tag Header / Footer Format +================================================================================ + +Contains number, length and attributes of all tag items + +Header and Footer are different in 1 bit in the Tags Flags to distinguish +between them. + +Member of APE Tag 2.0 + +/===========================================================================\ +| Preamble | 8 bytes | { 'A', 'P', 'E', 'T', 'A', 'G', 'E', 'X' } | +|----------------|---------|------------------------------------------------| +| Version Number | 4 bytes | 1000 = Version 1.000, 2000 = Version 2.000 | +|----------------|---------|------------------------------------------------| +| Tag Size | 4 bytes | Tag size in bytes including footer and all tag | +| | | items excluding the header (for 1.000 | +| | | compatibility) | +|----------------|---------|------------------------------------------------| +| Item Count | 4 bytes | Number of items in the tag | +|----------------|---------|------------------------------------------------| +| Tag Flags | 4 bytes | Global flags | +|----------------|---------|------------------------------------------------| +| Reserved | 8 bytes | Must be zeroed | +\===========================================================================/ + +================================================================================ += 3 - APE Tag Flags +================================================================================ + +The general flag structure for either items or headers / footers is the same. +Bits 31, 30 and 29 are specific to headers / footers, whereas 2 through 0 are +item specific. + +Note: APE Tags from Version 1.0 do not use any of the following. All flags in +that version are zeroed and ignored when reading. + +/=================================================================\ +| Contains Header | Bit 31 | 1 - has header | 0 - no header | +|-----------------|-------------|---------------------------------| +| Contains Footer | Bit 30 | 1 - has footer | 0 - no footer | +|-----------------|-------------|---------------------------------| +| Is Header | Bit 29 | 1 - is header | 0 - is footer | +|-----------------|-------------|---------------------------------| +| Undefined | Bits 28 - 3 | Undefined, must be zeroed | +|-----------------|-------------|---------------------------------| +| Encoding | Bits 2 - 1 | 00 - UTF-8 | +| | | 01 - Binary Data * | +| | | 10 - External Reference ** | +| | | 11 - Reserved | +|-----------------|-------------|---------------------------------| +| Read Only | Bit 0 | 1 - read only | 0 - read/write | +\=================================================================/ + + (*) Should be ignored by tools for editing text values +(**) Allowed external reference formats: + - http://host/directory/filename.ext + - ftp://host/directory/filename.ext + - filename.ext + - /directory/filename.ext + - DRIVE:/directory/filename.ext + + Note: External references are also UTF-8 encoded. + +================================================================================ += 4 - APE Tag Item Format +================================================================================ + +APE Tag Items are stored as key-value pairs. APE Tags Item Key are case +sensitive, however it is illegal to use keys which only differ in case and +it is recommended that tag reading not be case sensitive. + +Every key can only occur (at most) once. It is not possible to repeat a key +to signify updated contents. + +Tags can be partially or completely repeated in the streaming format. This +makes it possible to display an artist and / or title if it was missed at the +beginning of the stream. It is recommended that the important information like +artist, album and title should occur approximately every 2 minutes in the +stream and again 5 to 10 seconds before the end. However, care should be tak +en not to replicate this information too often or during passages with high +bitrate demands to avoid unnecessary drop-outs. + +/==============================================================================\ +| Content Size | 4 bytes | Length of the value in bytes | +|----------------|---------------|---------------------------------------------| +| Flags | 4 bytes | Item flags | +|----------------|---------------|---------------------------------------------| +| Key | 2 - 255 bytes | Item key | +|----------------|---------------|---------------------------------------------| +| Key Terminator | 1 byte | Null byte that indicates the end of the key | +|----------------|---------------|---------------------------------------------| +| Value | variable | Content (formatted according to the flags) | +\==============================================================================/ + +================================================================================ + +Sections 5 - 7 haven't yet been converted from: + +http://www.personal.uni-jena.de/~pfk/mpp/sv8/apetag.html diff --git a/Libraries/TagLib/Files/taglib/ape/apefooter.cpp b/Libraries/TagLib/Files/taglib/ape/apefooter.cpp new file mode 100644 index 000000000..5fc8c2602 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/ape/apefooter.cpp @@ -0,0 +1,232 @@ +/*************************************************************************** + copyright : (C) 2004 by Allan Sandfeld Jensen + (C) 2002, 2003 by Scott Wheeler (id3v2header.cpp) + email : kde@carewolf.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#include +#include + +#include +#include + +#include "apefooter.h" + +using namespace TagLib; +using namespace APE; + +class Footer::FooterPrivate +{ +public: + FooterPrivate() : version(0), + footerPresent(true), + headerPresent(false), + isHeader(false), + itemCount(0), + tagSize(0) {} + + ~FooterPrivate() {} + + uint version; + + bool footerPresent; + bool headerPresent; + + bool isHeader; + + uint itemCount; + uint tagSize; + + static const uint size = 32; +}; + +//////////////////////////////////////////////////////////////////////////////// +// static members +//////////////////////////////////////////////////////////////////////////////// + +TagLib::uint Footer::size() +{ + return FooterPrivate::size; +} + +ByteVector Footer::fileIdentifier() +{ + return ByteVector::fromCString("APETAGEX"); +} + +//////////////////////////////////////////////////////////////////////////////// +// public members +//////////////////////////////////////////////////////////////////////////////// + +Footer::Footer() +{ + d = new FooterPrivate; +} + +Footer::Footer(const ByteVector &data) +{ + d = new FooterPrivate; + parse(data); +} + +Footer::~Footer() +{ + delete d; +} + +TagLib::uint Footer::version() const +{ + return d->version; +} + +bool Footer::headerPresent() const +{ + return d->headerPresent; +} + +bool Footer::footerPresent() const +{ + return d->footerPresent; +} + +bool Footer::isHeader() const +{ + return d->isHeader; +} + +void Footer::setHeaderPresent(bool b) const +{ + d->headerPresent = b; +} + +TagLib::uint Footer::itemCount() const +{ + return d->itemCount; +} + +void Footer::setItemCount(uint s) +{ + d->itemCount = s; +} + +TagLib::uint Footer::tagSize() const +{ + return d->tagSize; +} + +TagLib::uint Footer::completeTagSize() const +{ + if(d->headerPresent) + return d->tagSize + d->size; + else + return d->tagSize; +} + +void Footer::setTagSize(uint s) +{ + d->tagSize = s; +} + +void Footer::setData(const ByteVector &data) +{ + parse(data); +} + +ByteVector Footer::renderFooter() const +{ + return render(false); +} + +ByteVector Footer::renderHeader() const +{ + if (!d->headerPresent) return ByteVector(); + + return render(true); +} + +//////////////////////////////////////////////////////////////////////////////// +// protected members +//////////////////////////////////////////////////////////////////////////////// + +void Footer::parse(const ByteVector &data) +{ + if(data.size() < size()) + return; + + // The first eight bytes, data[0..7], are the File Identifier, "APETAGEX". + + // Read the version number + + d->version = data.mid(8, 4).toUInt(false); + + // Read the tag size + + d->tagSize = data.mid(12, 4).toUInt(false); + + // Read the item count + + d->itemCount = data.mid(16, 4).toUInt(false); + + // Read the flags + + std::bitset<32> flags(data.mid(20, 4).toUInt(false)); + + d->headerPresent = flags[31]; + d->footerPresent = !flags[30]; + d->isHeader = flags[29]; + +} + +ByteVector Footer::render(bool isHeader) const +{ + ByteVector v; + + // add the file identifier -- "APETAGEX" + + v.append(fileIdentifier()); + + // add the version number -- we always render a 2.000 tag regardless of what + // the tag originally was. + + v.append(ByteVector::fromUInt(2000, false)); + + // add the tag size + + v.append(ByteVector::fromUInt(d->tagSize, false)); + + // add the item count + + v.append(ByteVector::fromUInt(d->itemCount, false)); + + // render and add the flags + + std::bitset<32> flags; + + flags[31] = d->headerPresent; + flags[30] = false; // footer is always present + flags[29] = isHeader; + + v.append(ByteVector::fromUInt(flags.to_ulong(), false)); + + // add the reserved 64bit + + v.append(ByteVector::fromLongLong(0)); + + return v; +} diff --git a/Libraries/TagLib/Files/taglib/ape/apefooter.h b/Libraries/TagLib/Files/taglib/ape/apefooter.h new file mode 100644 index 000000000..b3359d13f --- /dev/null +++ b/Libraries/TagLib/Files/taglib/ape/apefooter.h @@ -0,0 +1,168 @@ +/*************************************************************************** + copyright : (C) 2004 by Allan Sandfeld Jensen + email : kde@carewolf.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#ifndef TAGLIB_APEFOOTER_H +#define TAGLIB_APEFOOTER_H + +#include + +namespace TagLib { + + namespace APE { + + //! An implementation of APE footers + + /*! + * This class implements APE footers (and headers). It attempts to follow, both + * semantically and programatically, the structure specified in + * the APE v2.0 standard. The API is based on the properties of APE footer and + * headers specified there. + */ + + class Footer + { + public: + /*! + * Constructs an empty APE footer. + */ + Footer(); + + /*! + * Constructs an APE footer based on \a data. parse() is called + * immediately. + */ + Footer(const ByteVector &data); + + /*! + * Destroys the footer. + */ + virtual ~Footer(); + + /*! + * Returns the version number. (Note: This is the 1000 or 2000.) + */ + uint version() const; + + /*! + * Returns true if a header is present in the tag. + */ + bool headerPresent() const; + + /*! + * Returns true if a footer is present in the tag. + */ + bool footerPresent() const; + + /*! + * Returns true this is actually the header. + */ + bool isHeader() const; + + /*! + * Sets whether the header should be rendered or not + */ + void setHeaderPresent(bool b) const; + + /*! + * Returns the number of items in the tag. + */ + uint itemCount() const; + + /*! + * Set the item count to \a s. + * \see itemCount() + */ + void setItemCount(uint s); + + /*! + * Returns the tag size in bytes. This is the size of the frame content and footer. + * The size of the \e entire tag will be this plus the header size, if present. + * + * \see completeTagSize() + */ + uint tagSize() const; + + /*! + * Returns the tag size, including if present, the header + * size. + * + * \see tagSize() + */ + uint completeTagSize() const; + + /*! + * Set the tag size to \a s. + * \see tagSize() + */ + void setTagSize(uint s); + + /*! + * Returns the size of the footer. Presently this is always 32 bytes. + */ + static uint size(); + + /*! + * Returns the string used to identify an APE tag inside of a file. + * Presently this is always "APETAGEX". + */ + static ByteVector fileIdentifier(); + + /*! + * Sets the data that will be used as the footer. 32 bytes, + * starting from \a data will be used. + */ + void setData(const ByteVector &data); + + /*! + * Renders the footer back to binary format. + */ + ByteVector renderFooter() const; + + /*! + * Renders the header corresponding to the footer. If headerPresent is + * set to false, it returns an empty ByteVector. + */ + ByteVector renderHeader() const; + + protected: + /*! + * Called by setData() to parse the footer data. It makes this information + * available through the public API. + */ + void parse(const ByteVector &data); + + /*! + * Called by renderFooter and renderHeader + */ + ByteVector render(bool isHeader) const; + + private: + Footer(const Footer &); + Footer &operator=(const Footer &); + + class FooterPrivate; + FooterPrivate *d; + }; + + } +} + +#endif diff --git a/Libraries/TagLib/Files/taglib/ape/apeitem.cpp b/Libraries/TagLib/Files/taglib/ape/apeitem.cpp new file mode 100644 index 000000000..a211220b4 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/ape/apeitem.cpp @@ -0,0 +1,186 @@ +/*************************************************************************** + copyright : (C) 2004 by Allan Sandfeld Jensen + email : kde@carewolf.com + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#include + +#include "apeitem.h" + +using namespace TagLib; +using namespace APE; + +class APE::Item::ItemPrivate +{ +public: + ItemPrivate() : type(Text), readOnly(false) {} + + Item::ItemTypes type; + String key; + ByteVector value; + StringList text; + bool readOnly; +}; + +APE::Item::Item() +{ + d = new ItemPrivate; +} + +APE::Item::Item(const String &key, const String &value) +{ + d = new ItemPrivate; + d->key = key; + d->text.append(value); +} + +APE::Item::Item(const String &key, const StringList &values) +{ + d = new ItemPrivate; + d->key = key; + d->text = values; +} + +APE::Item::Item(const Item &item) +{ + d = new ItemPrivate(*item.d); +} + +Item &APE::Item::operator=(const Item &item) +{ + delete d; + d = new ItemPrivate(*item.d); + return *this; +} + +void APE::Item::setReadOnly(bool readOnly) +{ + d->readOnly = readOnly; +} + +bool APE::Item::isReadOnly() const +{ + return d->readOnly; +} + +void APE::Item::setType(APE::Item::ItemTypes val) +{ + d->type = val; +} + +APE::Item::ItemTypes APE::Item::type() const +{ + return d->type; +} + +String APE::Item::key() const +{ + return d->key; +} + +ByteVector APE::Item::value() const +{ + return d->value; +} + +int APE::Item::size() const +{ + return 8 + d->key.size() + 1 + d->value.size(); +} + +StringList APE::Item::toStringList() const +{ + return d->text; +} + +String APE::Item::toString() const +{ + return d->text.front(); +} + +bool APE::Item::isEmpty() const +{ + switch(d->type) { + case 0: + case 1: + if(d->text.isEmpty()) + return true; + if(d->text.size() == 1 && d->text.front() == "") + return true; + return false; + case 2: + return d->value.isEmpty(); + default: + return false; + } +} + +void APE::Item::parse(const ByteVector &data) +{ + // 11 bytes is the minimum size for an APE item + + if(data.size() < 11) { + debug("APE::Item::parse() -- no data in item"); + return; + } + + uint valueLength = data.mid(0, 4).toUInt(false); + uint flags = data.mid(4, 4).toUInt(false); + + d->key = String(data.mid(8), String::UTF8); + + d->value = data.mid(8 + d->key.size() + 1, valueLength); + + setReadOnly(flags & 1); + setType(ItemTypes((flags >> 1) & 3)); + + if(int(d->type) < 2) + d->text = StringList(ByteVectorList::split(d->value, '\0'), String::UTF8); +} + +ByteVector APE::Item::render() const +{ + ByteVector data; + TagLib::uint flags = ((d->readOnly) ? 1 : 0) | (d->type << 1); + ByteVector value; + + if(isEmpty()) + return data; + + if(d->type != Item::Binary) { + StringList::ConstIterator it = d->text.begin(); + value.append(it->data(String::UTF8)); + it++; + for(; it != d->text.end(); ++it) { + value.append('\0'); + value.append(it->data(String::UTF8)); + } + d->value = value; + } + else + value.append(d->value); + + data.append(ByteVector::fromUInt(value.size(), false)); + data.append(ByteVector::fromUInt(flags, false)); + data.append(d->key.data(String::UTF8)); + data.append(ByteVector('\0')); + data.append(value); + + return data; +} diff --git a/Libraries/TagLib/Files/taglib/ape/apeitem.h b/Libraries/TagLib/Files/taglib/ape/apeitem.h new file mode 100644 index 000000000..f0a1d16ab --- /dev/null +++ b/Libraries/TagLib/Files/taglib/ape/apeitem.h @@ -0,0 +1,150 @@ +/*************************************************************************** + copyright : (C) 2004 by Allan Sandfeld Jensen + email : kde@carewolf.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#ifndef TAGLIB_APEITEM_H +#define TAGLIB_APEITEM_H + +#include +#include +#include + +namespace TagLib { + + namespace APE { + + //! An implementation of APE-items + + /*! + * This class provides the features of items in the APEv2 standard. + */ + class Item + { + public: + /*! + * Enum of types an Item can have. The value of 3 is reserved. + */ + enum ItemTypes { + //! Item contains text information coded in UTF-8 + Text = 0, + //! Item contains binary information + Binary = 1, + //! Item is a locator of external stored information + Locator = 2 + }; + /*! + * Constructs an empty item. + */ + Item(); + + /*! + * Constructs an item with \a key and \a value. + */ + Item(const String &key, const String &value); + + /*! + * Constructs an item with \a key and \a values. + */ + Item(const String &key, const StringList &values); + + /*! + * Construct an item as a copy of \a item. + */ + Item(const Item &item); + + /*! + * Copies the contents of \a item into this item. + */ + Item &operator=(const Item &item); + + /*! + * Returns the key. + */ + String key() const; + + /*! + * Returns the binary value. + */ + ByteVector value() const; + + /*! + * Returns the size of the full item. + */ + int size() const; + + /*! + * Returns the value as a single string. In case of multiple strings, + * the first is returned. + */ + String toString() const; + + /*! + * Returns the value as a string list. + */ + StringList toStringList() const; + + /*! + * Render the item to a ByteVector. + */ + ByteVector render() const; + + /*! + * Parse the item from the ByteVector \a data. + */ + void parse(const ByteVector& data); + + /*! + * Set the item to read-only. + */ + void setReadOnly(bool readOnly); + + /*! + * Return true if the item is read-only. + */ + bool isReadOnly() const; + + /*! + * Sets the type of the item to \a type. + * + * \see ItemTypes + */ + void setType(ItemTypes type); + + /*! + * Returns the type of the item. + */ + ItemTypes type() const; + + /*! + * Returns if the item has any real content. + */ + bool isEmpty() const; + + private: + class ItemPrivate; + ItemPrivate *d; + }; + } + +} + +#endif + + diff --git a/Libraries/TagLib/Files/taglib/ape/apetag.cpp b/Libraries/TagLib/Files/taglib/ape/apetag.cpp new file mode 100644 index 000000000..3fecad8ba --- /dev/null +++ b/Libraries/TagLib/Files/taglib/ape/apetag.cpp @@ -0,0 +1,255 @@ +/*************************************************************************** + copyright : (C) 2004 by Allan Sandfeld Jensen + email : kde@carewolf.com + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#include +#include +#include +#include + +#include "apetag.h" +#include "apefooter.h" +#include "apeitem.h" + +using namespace TagLib; +using namespace APE; + +class APE::Tag::TagPrivate +{ +public: + TagPrivate() : file(0), tagOffset(-1), tagLength(0) {} + + File *file; + long tagOffset; + long tagLength; + + Footer footer; + + ItemListMap itemListMap; +}; + +//////////////////////////////////////////////////////////////////////////////// +// public methods +//////////////////////////////////////////////////////////////////////////////// + +APE::Tag::Tag() : TagLib::Tag() +{ + d = new TagPrivate; +} + +APE::Tag::Tag(File *file, long tagOffset) : TagLib::Tag() +{ + d = new TagPrivate; + d->file = file; + d->tagOffset = tagOffset; + + read(); +} + +APE::Tag::~Tag() +{ + delete d; +} + +ByteVector APE::Tag::fileIdentifier() +{ + return ByteVector::fromCString("APETAGEX"); +} + +String APE::Tag::title() const +{ + if(d->itemListMap["TITLE"].isEmpty()) + return String::null; + return d->itemListMap["TITLE"].toString(); +} + +String APE::Tag::artist() const +{ + if(d->itemListMap["ARTIST"].isEmpty()) + return String::null; + return d->itemListMap["ARTIST"].toString(); +} + +String APE::Tag::album() const +{ + if(d->itemListMap["ALBUM"].isEmpty()) + return String::null; + return d->itemListMap["ALBUM"].toString(); +} + +String APE::Tag::comment() const +{ + if(d->itemListMap["COMMENT"].isEmpty()) + return String::null; + return d->itemListMap["COMMENT"].toString(); +} + +String APE::Tag::genre() const +{ + if(d->itemListMap["GENRE"].isEmpty()) + return String::null; + return d->itemListMap["GENRE"].toString(); +} + +TagLib::uint APE::Tag::year() const +{ + if(d->itemListMap["YEAR"].isEmpty()) + return 0; + return d->itemListMap["YEAR"].toString().toInt(); +} + +TagLib::uint APE::Tag::track() const +{ + if(d->itemListMap["TRACK"].isEmpty()) + return 0; + return d->itemListMap["TRACK"].toString().toInt(); +} + +void APE::Tag::setTitle(const String &s) +{ + addValue("TITLE", s, true); +} + +void APE::Tag::setArtist(const String &s) +{ + addValue("ARTIST", s, true); +} + +void APE::Tag::setAlbum(const String &s) +{ + addValue("ALBUM", s, true); +} + +void APE::Tag::setComment(const String &s) +{ + addValue("COMMENT", s, true); +} + +void APE::Tag::setGenre(const String &s) +{ + addValue("GENRE", s, true); +} + +void APE::Tag::setYear(uint i) +{ + if(i <= 0) + removeItem("YEAR"); + else + addValue("YEAR", String::number(i), true); +} + +void APE::Tag::setTrack(uint i) +{ + if(i <= 0) + removeItem("TRACK"); + else + addValue("TRACK", String::number(i), true); +} + +APE::Footer *APE::Tag::footer() const +{ + return &d->footer; +} + +const APE::ItemListMap& APE::Tag::itemListMap() const +{ + return d->itemListMap; +} + +void APE::Tag::removeItem(const String &key) +{ + Map::Iterator it = d->itemListMap.find(key.upper()); + if(it != d->itemListMap.end()) + d->itemListMap.erase(it); +} + +void APE::Tag::addValue(const String &key, const String &value, bool replace) +{ + if(replace) + removeItem(key); + if(!value.isEmpty()) { + if(d->itemListMap.contains(key) || !replace) + d->itemListMap[key.upper()].toStringList().append(value); + else + setItem(key, Item(key, value)); + } +} + +void APE::Tag::setItem(const String &key, const Item &item) +{ + d->itemListMap.insert(key.upper(), item); +} + +//////////////////////////////////////////////////////////////////////////////// +// protected methods +//////////////////////////////////////////////////////////////////////////////// + +void APE::Tag::read() +{ + if(d->file && d->file->isValid()) { + + d->file->seek(d->tagOffset); + d->footer.setData(d->file->readBlock(Footer::size())); + + if(d->footer.tagSize() == 0 || + d->footer.tagSize() > uint(d->file->length())) + return; + + d->file->seek(d->tagOffset + Footer::size() - d->footer.tagSize()); + parse(d->file->readBlock(d->footer.tagSize() - Footer::size())); + } +} + +ByteVector APE::Tag::render() const +{ + ByteVector data; + uint itemCount = 0; + + { + for(Map::ConstIterator it = d->itemListMap.begin(); + it != d->itemListMap.end(); ++it) + { + data.append(it->second.render()); + itemCount++; + } + } + + d->footer.setItemCount(itemCount); + d->footer.setTagSize(data.size()+Footer::size()); + d->footer.setHeaderPresent(true); + + return d->footer.renderHeader() + data + d->footer.renderFooter(); +} + +void APE::Tag::parse(const ByteVector &data) +{ + uint pos = 0; + + // 11 bytes is the minimum size for an APE item + + for(uint i = 0; i < d->footer.itemCount() && pos <= data.size() - 11; i++) { + APE::Item item; + item.parse(data.mid(pos)); + + d->itemListMap.insert(item.key().upper(), item); + + pos += item.size(); + } +} diff --git a/Libraries/TagLib/Files/taglib/ape/apetag.h b/Libraries/TagLib/Files/taglib/ape/apetag.h new file mode 100644 index 000000000..b06f1e254 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/ape/apetag.h @@ -0,0 +1,157 @@ +/*************************************************************************** + copyright : (C) 2004 by Allan Sandfeld Jensen + email : kde@carewolf.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#ifndef TAGLIB_APETAG_H +#define TAGLIB_APETAG_H + +#include +#include +#include +#include + +#include "apeitem.h" + +namespace TagLib { + + class File; + + //! An implementation of the APE tagging format + + namespace APE { + + class Footer; + + /*! + * A mapping between a list of item names, or keys, and the associated item. + * + * \see APE::Tag::itemListMap() + */ + typedef Map ItemListMap; + + + //! An APE tag implementation + + class Tag : public TagLib::Tag + { + public: + /*! + * Create an APE tag with default values. + */ + Tag(); + + /*! + * Create an APE tag and parse the data in \a file with APE footer at + * \a tagOffset. + */ + Tag(File *file, long tagOffset); + + /*! + * Destroys this Tag instance. + */ + virtual ~Tag(); + + /*! + * Renders the in memory values to a ByteVector suitable for writing to + * the file. + */ + ByteVector render() const; + + /*! + * Returns the string "APETAGEX" suitable for usage in locating the tag in a + * file. + */ + static ByteVector fileIdentifier(); + + // Reimplementations. + + virtual String title() const; + virtual String artist() const; + virtual String album() const; + virtual String comment() const; + virtual String genre() const; + virtual uint year() const; + virtual uint track() const; + + virtual void setTitle(const String &s); + virtual void setArtist(const String &s); + virtual void setAlbum(const String &s); + virtual void setComment(const String &s); + virtual void setGenre(const String &s); + virtual void setYear(uint i); + virtual void setTrack(uint i); + + /*! + * Returns a pointer to the tag's footer. + */ + Footer *footer() const; + + /*! + * Returns a reference to the item list map. This is an ItemListMap of + * all of the items in the tag. + * + * This is the most powerfull structure for accessing the items of the tag. + * + * \warning You should not modify this data structure directly, instead + * use setItem() and removeItem(). + */ + const ItemListMap &itemListMap() const; + + /*! + * Removes the \a key item from the tag + */ + void removeItem(const String &key); + + /*! + * Adds to the item specified by \a key the data \a value. If \a replace + * is true, then all of the other values on the same key will be removed + * first. + */ + void addValue(const String &key, const String &value, bool replace = true); + + /*! + * Sets the \a key item to the value of \a item. If an item with the \a key is already + * present, it will be replaced. + */ + void setItem(const String &key, const Item &item); + + protected: + + /*! + * Reads from the file specified in the constructor. + */ + void read(); + + /*! + * Parses the body of the tag in \a data. + */ + void parse(const ByteVector &data); + + private: + Tag(const Tag &); + Tag &operator=(const Tag &); + + class TagPrivate; + TagPrivate *d; + }; + } +} + +#endif diff --git a/Libraries/TagLib/Files/taglib/audioproperties.cpp b/Libraries/TagLib/Files/taglib/audioproperties.cpp new file mode 100644 index 000000000..48e620fe0 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/audioproperties.cpp @@ -0,0 +1,47 @@ +/*************************************************************************** + copyright : (C) 2003 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#include "audioproperties.h" + +using namespace TagLib; + +class AudioProperties::AudioPropertiesPrivate +{ + +}; + +//////////////////////////////////////////////////////////////////////////////// +// public methods +//////////////////////////////////////////////////////////////////////////////// + +AudioProperties::~AudioProperties() +{ + +} + +//////////////////////////////////////////////////////////////////////////////// +// protected methods +//////////////////////////////////////////////////////////////////////////////// + +AudioProperties::AudioProperties(ReadStyle) +{ + +} diff --git a/Libraries/TagLib/Files/taglib/audioproperties.h b/Libraries/TagLib/Files/taglib/audioproperties.h new file mode 100644 index 000000000..4584b8693 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/audioproperties.h @@ -0,0 +1,104 @@ +/*************************************************************************** + copyright : (C) 2003 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#ifndef TAGLIB_AUDIOPROPERTIES_H +#define TAGLIB_AUDIOPROPERTIES_H + +namespace TagLib { + + //! A simple, abstract interface to common audio properties + + /*! + * The values here are common to most audio formats. For more specific, codec + * dependant values, please see see the subclasses APIs. This is meant to + * compliment the TagLib::File and TagLib::Tag APIs in providing a simple + * interface that is sufficient for most applications. + */ + + class AudioProperties + { + public: + + /*! + * Reading audio properties from a file can sometimes be very time consuming + * and for the most accurate results can often involve reading the entire + * file. Because in many situations speed is critical or the accuracy of the + * values is not particularly important this allows the level of desired + * accuracy to be set. + */ + enum ReadStyle { + //! Read as little of the file as possible + Fast, + //! Read more of the file and make better values guesses + Average, + //! Read as much of the file as needed to report accurate values + Accurate + }; + + /*! + * Destroys this AudioProperties instance. + */ + virtual ~AudioProperties(); + + /*! + * Returns the lenght of the file in seconds. + */ + virtual int length() const = 0; + + /*! + * Returns the most appropriate bit rate for the file in kb/s. For constant + * bitrate formats this is simply the bitrate of the file. For variable + * bitrate formats this is either the average or nominal bitrate. + */ + virtual int bitrate() const = 0; + + /*! + * Returns the sample rate in Hz. + */ + virtual int sampleRate() const = 0; + + /*! + * Returns the number of audio channels. + */ + virtual int channels() const = 0; + + protected: + + /*! + * Construct an audio properties instance. This is protected as this class + * should not be instantiated directly, but should be instantiated via its + * subclasses and can be fetched from the FileRef or File APIs. + * + * \see ReadStyle + */ + AudioProperties(ReadStyle style); + + private: + AudioProperties(const AudioProperties &); + AudioProperties &operator=(const AudioProperties &); + + class AudioPropertiesPrivate; + AudioPropertiesPrivate *d; + }; + +} + +#endif diff --git a/Libraries/TagLib/Files/taglib/configure.in.bot b/Libraries/TagLib/Files/taglib/configure.in.bot new file mode 100644 index 000000000..b3e513c0d --- /dev/null +++ b/Libraries/TagLib/Files/taglib/configure.in.bot @@ -0,0 +1,8 @@ +if test "x$have_zlib" = "xfalse"; then + echo "**************************************************" + echo "*" + echo "* You don't seem to have libz / zlib.h installed." + echo "* Compressed frames have been disabled." + echo "*" + echo "**************************************************" +fi diff --git a/Libraries/TagLib/Files/taglib/configure.in.in b/Libraries/TagLib/Files/taglib/configure.in.in new file mode 100644 index 000000000..9d678d6df --- /dev/null +++ b/Libraries/TagLib/Files/taglib/configure.in.in @@ -0,0 +1,18 @@ +#AM_INIT_AUTOMAKE(taglib,1.0) +dnl don't remove the below +dnl AC_OUTPUT(taglib/taglib-config) + +AC_DEFUN([AC_HAVE_ZLIB], +[ + AC_DEFINE(HAVE_ZLIB, 1, [have zlib]) + have_zlib=true +]) + +AC_DEFUN([AC_NO_ZLIB], +[ + AC_DEFINE(HAVE_ZLIB, 0, [have zlib]) + have_zlib=false +]) + +AC_CHECK_HEADER(zlib.h, AC_HAVE_ZLIB, AC_NO_ZLIB) +AM_CONDITIONAL(link_zlib, test x$have_zlib = xtrue) diff --git a/Libraries/TagLib/Files/taglib/fileref.cpp b/Libraries/TagLib/Files/taglib/fileref.cpp new file mode 100644 index 000000000..2da2e71ff --- /dev/null +++ b/Libraries/TagLib/Files/taglib/fileref.cpp @@ -0,0 +1,143 @@ +/*************************************************************************** + copyright : (C) 2003 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#include +#include + +#include "fileref.h" +#include "mpegfile.h" +#include "vorbisfile.h" +#include "flacfile.h" +#include "mpcfile.h" + +using namespace TagLib; + +class FileRef::FileRefPrivate : public RefCounter +{ +public: + FileRefPrivate(File *f) : RefCounter(), file(f) {} + ~FileRefPrivate() { + delete file; + } + + File *file; +}; + +//////////////////////////////////////////////////////////////////////////////// +// public members +//////////////////////////////////////////////////////////////////////////////// + +FileRef::FileRef() +{ + d = new FileRefPrivate(0); +} + +FileRef::FileRef(const char *fileName, bool readAudioProperties, + AudioProperties::ReadStyle audioPropertiesStyle) +{ + d = new FileRefPrivate(create(fileName, readAudioProperties, audioPropertiesStyle)); +} + +FileRef::FileRef(File *file) +{ + d = new FileRefPrivate(file); +} + +FileRef::FileRef(const FileRef &ref) : d(ref.d) +{ + d->ref(); +} + +FileRef::~FileRef() +{ + if(d->deref()) + delete d; +} + +Tag *FileRef::tag() const +{ + return d->file->tag(); +} + +AudioProperties *FileRef::audioProperties() const +{ + return d->file->audioProperties(); +} + +File *FileRef::file() const +{ + return d->file; +} + +bool FileRef::save() +{ + return d->file->save(); +} + +bool FileRef::isNull() const +{ + return !d->file || !d->file->isValid(); +} + +FileRef &FileRef::operator=(const FileRef &ref) +{ + if(&ref == this) + return *this; + + if(d->deref()) + delete d; + + d = ref.d; + d->ref(); + + return *this; +} + +bool FileRef::operator==(const FileRef &ref) const +{ + return ref.d->file == d->file; +} + +bool FileRef::operator!=(const FileRef &ref) const +{ + return ref.d->file != d->file; +} + +File *FileRef::create(const char *fileName, bool readAudioProperties, + AudioProperties::ReadStyle audioPropertiesStyle) // static +{ + // Ok, this is really dumb for now, but it works for testing. + + String s = fileName; + + if(s.size() > 4) { + if(s.substr(s.size() - 4, 4).upper() == ".OGG") + return new Vorbis::File(fileName, readAudioProperties, audioPropertiesStyle); + if(s.substr(s.size() - 4, 4).upper() == ".MP3") + return new MPEG::File(fileName, readAudioProperties, audioPropertiesStyle); + if(s.substr(s.size() - 5, 5).upper() == ".FLAC") + return new FLAC::File(fileName, readAudioProperties, audioPropertiesStyle); + if(s.substr(s.size() - 4, 4).upper() == ".MPC") + return new MPC::File(fileName, readAudioProperties, audioPropertiesStyle); + } + + return 0; +} diff --git a/Libraries/TagLib/Files/taglib/fileref.h b/Libraries/TagLib/Files/taglib/fileref.h new file mode 100644 index 000000000..ffa7864fc --- /dev/null +++ b/Libraries/TagLib/Files/taglib/fileref.h @@ -0,0 +1,183 @@ +/*************************************************************************** + copyright : (C) 2003 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#ifndef TAGLIB_FILEREF_H +#define TAGLIB_FILEREF_H + +#include "audioproperties.h" + +namespace TagLib { + + class String; + class File; + class Tag; + + //! This class provides a simple abstraction for creating and handling files + + /*! + * FileRef exists to provide a minimal, generic and value-based wrapper around + * a File. It is lightweight and implicitly shared, and as such suitable for + * pass-by-value use. This hides some of the uglier details of TagLib::File + * and the non-generic portions of the concrete file implementations. + * + * This class is useful in a "simple usage" situation where it is desirable + * to be able to get and set some of the tag information that is similar + * across file types. + * + * Also note that it is probably a good idea to plug this into your mime + * type system rather than using the constructor that accepts a file name. + * + * For example in KDE this could be done with: + * + * \code + * + * TagLib::FileRef createFileRef( const QString &fileName ) + * { + * KMimeType::Ptr result = KMimeType::findByPath( fileName, 0, true ); + * + * if( result->name() == "audio/x-mp3" ) + * return FileRef( new MPEG::File( QFile::encodeName( fileName ).data() ) ); + * + * if( result->name() == "application/ogg" ) + * return FileRef( new Vorbis::File( QFile::encodeName( fileName ).data() ) ); + * + * return FileRef( 0 ); + * } + * + * \endcode + */ + + class FileRef + { + public: + + FileRef(); + + /*! + * Create a FileRef from \a fileName. If \a readAudioProperties is true then + * the audio properties will be read using \a audioPropertiesStyle. If + * \a readAudioProperties is false then \a audioPropertiesStyle will be + * ignored. + * + * Also see the note in the class documentation about why you may not want to + * use this method in your application. + */ + explicit FileRef(const char *fileName, + bool readAudioProperties = true, + AudioProperties::ReadStyle + audioPropertiesStyle = AudioProperties::Average); + + /*! + * Contruct a FileRef using \a file. The FileRef now takes ownership of the + * pointer and will delete the File when it passes out of scope. + */ + explicit FileRef(File *file); + + /*! + * Make a copy of \a ref. + */ + FileRef(const FileRef &ref); + + /*! + * Destroys this FileRef instance. + */ + virtual ~FileRef(); + + /*! + * Returns a pointer to represented file's tag. + * + * \warning This pointer will become invalid when this FileRef and all + * copies pass out of scope. + * + * \see File::tag() + */ + Tag *tag() const; + + /*! + * Returns the audio properties for this FileRef. If no audio properties + * were read then this will returns a null pointer. + */ + AudioProperties *audioProperties() const; + + /*! + * Returns a pointer to the file represented by this handler class. + * + * As a general rule this call should be avoided since if you need to work + * with file objects directly, you are probably better served instantiating + * the File subclasses (i.e. MPEG::File) manually and working with their APIs. + * + * This handle exists to provide a minimal, generic and value-based + * wrapper around a File. Accessing the file directly generally indicates + * a moving away from this simplicity (and into things beyond the scope of + * FileRef). + * + * \warning This pointer will become invalid when this FileRef and all + * copies pass out of scope. + */ + File *file() const; + + /*! + * Saves the file. Returns true on success. + */ + bool save(); + + /*! + * Returns true if the file (and as such other pointers) are null. + */ + bool isNull() const; + + /*! + * Assign the file pointed to by \a ref to this FileRef. + */ + FileRef &operator=(const FileRef &ref); + + /*! + * Returns true if this FileRef and \a ref point to the same File object. + */ + bool operator==(const FileRef &ref) const; + + /*! + * Returns true if this FileRef and \a ref do not point to the same File + * object. + */ + bool operator!=(const FileRef &ref) const; + + /*! + * A simple implementation of file type guessing. If \a readAudioProperties + * is true then the audio properties will be read using + * \a audioPropertiesStyle. If \a readAudioProperties is false then + * \a audioPropertiesStyle will be ignored. + * + * \note You generally shouldn't use this method, but instead the constructor + * directly. + */ + static File *create(const char *fileName, + bool readAudioProperties = true, + AudioProperties::ReadStyle audioPropertiesStyle = AudioProperties::Average); + + private: + class FileRefPrivate; + FileRefPrivate *d; + }; + +} // namespace TagLib + +#endif diff --git a/Libraries/TagLib/Files/taglib/flac/Makefile.am b/Libraries/TagLib/Files/taglib/flac/Makefile.am new file mode 100644 index 000000000..40caf2ea9 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/flac/Makefile.am @@ -0,0 +1,16 @@ +INCLUDES = \ + -I$(top_srcdir)/taglib \ + -I$(top_srcdir)/taglib/toolkit \ + -I$(top_srcdir)/taglib/ogg \ + -I$(top_srcdir)/taglib/mpeg/id3v2 \ + -I$(top_srcdir)/taglib/mpeg/id3v1 \ + $(all_includes) + +noinst_LTLIBRARIES = libflac.la + +libflac_la_SOURCES = flacfile.cpp flacproperties.cpp + +taglib_include_HEADERS = flacfile.h flacproperties.h +taglib_includedir = $(includedir)/taglib + +EXTRA_DIST = $(libflac_la_SOURCES) $(taglib_include_HEADERS) diff --git a/Libraries/TagLib/Files/taglib/flac/Makefile.in b/Libraries/TagLib/Files/taglib/flac/Makefile.in new file mode 100644 index 000000000..2b479cf4c --- /dev/null +++ b/Libraries/TagLib/Files/taglib/flac/Makefile.in @@ -0,0 +1,555 @@ +# Makefile.in generated by automake 1.7.6 from Makefile.am. +# KDE tags expanded automatically by am_edit - $Revision$ +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../.. + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTODIRS = @AUTODIRS@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CONF_FILES = @CONF_FILES@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +KDE_PLUGIN = @KDE_PLUGIN@ +KDE_USE_CLOSURE_FALSE = @KDE_USE_CLOSURE_FALSE@ +KDE_USE_CLOSURE_TRUE = @KDE_USE_CLOSURE_TRUE@ +KDE_USE_FINAL_FALSE = @KDE_USE_FINAL_FALSE@ +KDE_USE_FINAL_TRUE = @KDE_USE_FINAL_TRUE@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +NOOPT_CFLAGS = @NOOPT_CFLAGS@ +NOOPT_CXXFLAGS = @NOOPT_CXXFLAGS@ +NOREPO = @NOREPO@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +REPO = @REPO@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +TOPSUBDIRS = @TOPSUBDIRS@ +USE_EXCEPTIONS = @USE_EXCEPTIONS@ +USE_RTTI = @USE_RTTI@ +VERSION = @VERSION@ +WOVERLOADED_VIRTUAL = @WOVERLOADED_VIRTUAL@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +all_includes = @all_includes@ +all_libraries = @all_libraries@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +link_zlib_FALSE = @link_zlib_FALSE@ +link_zlib_TRUE = @link_zlib_TRUE@ +localstatedir = @localstatedir@ +mandir = @mandir@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +INCLUDES = \ + -I$(top_srcdir)/taglib \ + -I$(top_srcdir)/taglib/toolkit \ + -I$(top_srcdir)/taglib/ogg \ + -I$(top_srcdir)/taglib/mpeg/id3v2 \ + -I$(top_srcdir)/taglib/mpeg/id3v1 \ + $(all_includes) + + +noinst_LTLIBRARIES = libflac.la + +libflac_la_SOURCES = flacfile.cpp flacproperties.cpp + +taglib_include_HEADERS = flacfile.h flacproperties.h +taglib_includedir = $(includedir)/taglib + +EXTRA_DIST = $(libflac_la_SOURCES) $(taglib_include_HEADERS) +subdir = taglib/flac +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/admin/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) + +libflac_la_LDFLAGS = +libflac_la_LIBADD = +am_libflac_la_OBJECTS = flacfile.lo flacproperties.lo +#>- libflac_la_OBJECTS = $(am_libflac_la_OBJECTS) +#>+ 4 +libflac_la_final_OBJECTS = libflac_la.all_cpp.lo +libflac_la_nofinal_OBJECTS = flacfile.lo flacproperties.lo +@KDE_USE_FINAL_FALSE@libflac_la_OBJECTS = $(libflac_la_nofinal_OBJECTS) +@KDE_USE_FINAL_TRUE@libflac_la_OBJECTS = $(libflac_la_final_OBJECTS) + +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/admin/depcomp +am__depfiles_maybe = depfiles +#>- @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/flacfile.Plo \ +#>- @AMDEP_TRUE@ ./$(DEPDIR)/flacproperties.Plo +#>+ 5 +@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@DEP_FILES = $(DEPDIR)/libflac_la.all_cpp.P ./$(DEPDIR)/flacfile.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@ @AMDEP_TRUE@ ./$(DEPDIR)/flacproperties.Plo +@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@DEP_FILES = ./$(DEPDIR)/flacfile.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@ @AMDEP_TRUE@ ./$(DEPDIR)/flacproperties.Plo + +#>- CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ +#>- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +#>+ 2 +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(KDE_CXXFLAGS) +#>- LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) \ +#>- $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ +#>- $(AM_CXXFLAGS) $(CXXFLAGS) +#>+ 3 +LTCXXCOMPILE = $(LIBTOOL) --mode=compile --tag=CXX $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) $(KDE_CXXFLAGS) +CXXLD = $(CXX) +#>- CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \ +#>- $(AM_LDFLAGS) $(LDFLAGS) -o $@ +#>+ 2 +CXXLINK = $(LIBTOOL) --mode=link --tag=CXX $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(KDE_CXXFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +DIST_SOURCES = $(libflac_la_SOURCES) +HEADERS = $(taglib_include_HEADERS) + +DIST_COMMON = $(taglib_include_HEADERS) Makefile.am Makefile.in +SOURCES = $(libflac_la_SOURCES) + +#>- all: all-am +#>+ 1 +all: docs-am all-am + +.SUFFIXES: +.SUFFIXES: .cpp .lo .o .obj +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) +#>- cd $(top_srcdir) && \ +#>- $(AUTOMAKE) --gnu taglib/flac/Makefile +#>+ 3 + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu taglib/flac/Makefile + cd $(top_srcdir) && perl admin/am_edit taglib/flac/Makefile.in +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" = "$$p" && dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libflac.la: $(libflac_la_OBJECTS) $(libflac_la_DEPENDENCIES) + $(CXXLINK) $(libflac_la_LDFLAGS) $(libflac_la_OBJECTS) $(libflac_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) core *.core + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/flacfile.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/flacproperties.Plo@am__quote@ + +distclean-depend: + -rm -rf ./$(DEPDIR) + +.cpp.o: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + +.cpp.obj: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` + +.cpp.lo: +@am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: +taglib_includeHEADERS_INSTALL = $(INSTALL_HEADER) +install-taglib_includeHEADERS: $(taglib_include_HEADERS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(taglib_includedir) + @list='$(taglib_include_HEADERS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(taglib_includeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(taglib_includedir)/$$f"; \ + $(taglib_includeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(taglib_includedir)/$$f; \ + done + +uninstall-taglib_includeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(taglib_include_HEADERS)'; for p in $$list; do \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " rm -f $(DESTDIR)$(taglib_includedir)/$$f"; \ + rm -f $(DESTDIR)$(taglib_includedir)/$$f; \ + done + +ETAGS = etags +ETAGSFLAGS = + +CTAGS = ctags +CTAGSFLAGS = + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique + +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +#>- DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +#>+ 4 +KDE_DIST=flactag.h + +DISTFILES= $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) $(KDE_DIST) + + +top_distdir = ../.. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) + +installdirs: + $(mkinstalldirs) $(DESTDIR)$(taglib_includedir) +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +#>- clean: clean-am +#>+ 1 +clean: kde-rpo-clean clean-am + +#>- clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ +#>- mostlyclean-am +#>+ 2 +clean-am: clean-final clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + +distclean-am: clean-am distclean-compile distclean-depend \ + distclean-generic distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: install-taglib_includeHEADERS + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am uninstall-taglib_includeHEADERS + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstLTLIBRARIES ctags distclean \ + distclean-compile distclean-depend distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am info \ + info-am install install-am install-data install-data-am \ + install-exec install-exec-am install-info install-info-am \ + install-man install-strip install-taglib_includeHEADERS \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-info-am \ + uninstall-taglib_includeHEADERS + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: + +#>+ 2 +docs-am: + +#>+ 6 +force-reedit: + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu taglib/flac/Makefile + cd $(top_srcdir) && perl admin/am_edit taglib/flac/Makefile.in + + +#>+ 11 +libflac_la.all_cpp.cpp: $(srcdir)/Makefile.in $(srcdir)/flacfile.cpp $(srcdir)/flacproperties.cpp + @echo 'creating libflac_la.all_cpp.cpp ...'; \ + rm -f libflac_la.all_cpp.files libflac_la.all_cpp.final; \ + echo "#define KDE_USE_FINAL 1" >> libflac_la.all_cpp.final; \ + for file in flacfile.cpp flacproperties.cpp ; do \ + echo "#include \"$$file\"" >> libflac_la.all_cpp.files; \ + test ! -f $(srcdir)/$$file || egrep '^#pragma +implementation' $(srcdir)/$$file >> libflac_la.all_cpp.final; \ + done; \ + cat libflac_la.all_cpp.final libflac_la.all_cpp.files > libflac_la.all_cpp.cpp; \ + rm -f libflac_la.all_cpp.final libflac_la.all_cpp.files + +#>+ 3 +clean-final: + -rm -f libflac_la.all_cpp.cpp + +#>+ 2 +final: + $(MAKE) libflac_la_OBJECTS="$(libflac_la_final_OBJECTS)" all-am +#>+ 2 +final-install: + $(MAKE) libflac_la_OBJECTS="$(libflac_la_final_OBJECTS)" install-am +#>+ 2 +no-final: + $(MAKE) libflac_la_OBJECTS="$(libflac_la_nofinal_OBJECTS)" all-am +#>+ 2 +no-final-install: + $(MAKE) libflac_la_OBJECTS="$(libflac_la_nofinal_OBJECTS)" install-am +#>+ 3 +cvs-clean: + $(MAKE) admindir=$(top_srcdir)/admin -f $(top_srcdir)/admin/Makefile.common cvs-clean + +#>+ 3 +kde-rpo-clean: + -rm -f *.rpo diff --git a/Libraries/TagLib/Files/taglib/flac/flacfile.cpp b/Libraries/TagLib/Files/taglib/flac/flacfile.cpp new file mode 100644 index 000000000..a60e02e20 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/flac/flacfile.cpp @@ -0,0 +1,468 @@ +/*************************************************************************** + copyright : (C) 2003-2004 by Allan Sandfeld Jensen + email : kde@carewolf.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#include +#include +#include +#include + +#include +#include +#include + +#include "flacfile.h" +#include "flactag.h" + +using namespace TagLib; + +namespace TagLib { +namespace FLAC { + enum BLOCK_TYPE { STREAMINFO = 0, PADDING, APPLICATION, SEEKTABLE, VORBISCOMMENT, CUESHEET }; +}} + +class FLAC::File::FilePrivate +{ +public: + FilePrivate() : + ID3v2FrameFactory(ID3v2::FrameFactory::instance()), + ID3v2Tag(0), + ID3v2Location(-1), + ID3v2OriginalSize(0), + ID3v1Tag(0), + ID3v1Location(-1), + comment(0), + properties(0), + flacStart(0), + streamStart(0), + streamLength(0), + scanned(false), + hasXiphComment(false), + hasID3v2(false), + hasID3v1(false) {} + + ~FilePrivate() + { + delete ID3v2Tag; + delete ID3v1Tag; + delete comment; + delete properties; + } + + const ID3v2::FrameFactory *ID3v2FrameFactory; + ID3v2::Tag *ID3v2Tag; + long ID3v2Location; + uint ID3v2OriginalSize; + + ID3v1::Tag *ID3v1Tag; + long ID3v1Location; + + Ogg::XiphComment *comment; + + FLAC::Tag *tag; + + Properties *properties; +// Map metaData; + ByteVector streamInfoData; + ByteVector xiphCommentData; + long flacStart; + long streamStart; + long streamLength; + bool scanned; + + bool hasXiphComment; + bool hasID3v2; + bool hasID3v1; +}; + +//////////////////////////////////////////////////////////////////////////////// +// public members +//////////////////////////////////////////////////////////////////////////////// + +FLAC::File::File(const char *file, bool readProperties, + Properties::ReadStyle propertiesStyle) : + TagLib::File(file) +{ + d = new FilePrivate; + read(readProperties, propertiesStyle); +} + +FLAC::File::File(const char *file, ID3v2::FrameFactory *frameFactory, + bool readProperties, Properties::ReadStyle propertiesStyle) : + TagLib::File(file) +{ + d = new FilePrivate; + d->ID3v2FrameFactory = frameFactory; + read(readProperties, propertiesStyle); +} + +FLAC::File::~File() +{ + delete d; +} + +TagLib::Tag *FLAC::File::tag() const +{ + return d->tag; +} + +FLAC::Properties *FLAC::File::audioProperties() const +{ + return d->properties; +} + + +bool FLAC::File::save() +{ + if(readOnly()) { + debug("FLAC::File::save() - Cannot save to a read only file."); + return false; + } + + // Create new vorbis comments + + if(!d->comment) { + d->comment = new Ogg::XiphComment; + if(d->tag) + Tag::duplicate(d->tag, d->comment, true); + } + + d->xiphCommentData = d->comment->render(false); + + ByteVector v = ByteVector::fromUInt(d->xiphCommentData.size()); + + // Set the type of the comment to be a Xiph / Vorbis comment + // (See scan() for comments on header-format) + v[0] = 4; + v.append(d->xiphCommentData); + + + // If file already have comment => find and update it + // if not => insert one + // TODO: Search for padding and use that + + if(d->hasXiphComment) { + long nextPageOffset = d->flacStart; + seek(nextPageOffset); + ByteVector header = readBlock(4); + uint length = header.mid(1, 3).toUInt(); + + nextPageOffset += length + 4; + + // Search through the remaining metadata + + char blockType = header[0] & 0x7f; + bool lastBlock = header[0] & 0x80; + + while(!lastBlock) { + seek(nextPageOffset); + + header = readBlock(4); + blockType = header[0] & 0x7f; + lastBlock = header[0] & 0x80; + length = header.mid(1, 3).toUInt(); + + // Type is vorbiscomment + if(blockType == 4) { + v[0] = header[0]; + insert(v, nextPageOffset, length + 4); + break; + } + + nextPageOffset += length + 4; + } + } + else { + long nextPageOffset = d->flacStart; + + seek(nextPageOffset); + + ByteVector header = readBlock(4); + // char blockType = header[0] & 0x7f; + bool lastBlock = header[0] & 0x80; + uint length = header.mid(1, 3).toUInt(); + + // If last block was last, make this one last + + if(lastBlock) { + + // Copy the bottom seven bits into the new value + + ByteVector h(static_cast(header[0] & 0x7F)); + insert(h, nextPageOffset, 1); + + // Set the last bit + v[0] |= 0x80; + } + + insert(v, nextPageOffset + length + 4, 0); + d->hasXiphComment = true; + } + + // Update ID3 tags + + if(d->ID3v2Tag) { + if(d->hasID3v2) + insert(d->ID3v2Tag->render(), d->ID3v2Location, d->ID3v2OriginalSize); + else + insert(d->ID3v2Tag->render(), 0, 0); + } + + if(d->ID3v1Tag) { + if(d->hasID3v1) + seek(-128, End); + else + seek(0, End); + writeBlock(d->ID3v1Tag->render()); + } + + return true; +} + +ID3v2::Tag *FLAC::File::ID3v2Tag(bool create) +{ + if(!create || d->ID3v2Tag) + return d->ID3v2Tag; + + // no ID3v2 tag exists and we've been asked to create one + + d->ID3v2Tag = new ID3v2::Tag; + return d->ID3v2Tag; +} + +ID3v1::Tag *FLAC::File::ID3v1Tag(bool create) +{ + if(!create || d->ID3v1Tag) + return d->ID3v1Tag; + + // no ID3v1 tag exists and we've been asked to create one + + d->ID3v1Tag = new ID3v1::Tag; + return d->ID3v1Tag; +} + +Ogg::XiphComment *FLAC::File::xiphComment(bool create) +{ + if(!create || d->comment) + return d->comment; + + // no XiphComment exists and we've been asked to create one + + d->comment = new Ogg::XiphComment; + return d->comment; +} + +void FLAC::File::setID3v2FrameFactory(const ID3v2::FrameFactory *factory) +{ + d->ID3v2FrameFactory = factory; +} + + +//////////////////////////////////////////////////////////////////////////////// +// private members +//////////////////////////////////////////////////////////////////////////////// + +void FLAC::File::read(bool readProperties, Properties::ReadStyle propertiesStyle) +{ + // Look for an ID3v2 tag + + d->ID3v2Location = findID3v2(); + + if(d->ID3v2Location >= 0) { + + d->ID3v2Tag = new ID3v2::Tag(this, d->ID3v2Location, d->ID3v2FrameFactory); + + d->ID3v2OriginalSize = d->ID3v2Tag->header()->completeTagSize(); + + if(d->ID3v2Tag->header()->tagSize() <= 0) { + delete d->ID3v2Tag; + d->ID3v2Tag = 0; + } + else + d->hasID3v2 = true; + } + + // Look for an ID3v1 tag + + d->ID3v1Location = findID3v1(); + + if(d->ID3v1Location >= 0) { + d->ID3v1Tag = new ID3v1::Tag(this, d->ID3v1Location); + d->hasID3v1 = true; + } + + // Look for FLAC metadata, including vorbis comments + + scan(); + + if (!isValid()) return; + + if(d->hasXiphComment) + d->comment = new Ogg::XiphComment(xiphCommentData()); + + if(d->hasXiphComment || d->hasID3v2 || d->hasID3v1) + d->tag = new FLAC::Tag(d->comment, d->ID3v2Tag, d->ID3v1Tag); + else + d->tag = new FLAC::Tag(new Ogg::XiphComment); + + if(readProperties) + d->properties = new Properties(streamInfoData(), streamLength(), propertiesStyle); +} + +ByteVector FLAC::File::streamInfoData() +{ + if (isValid()) + return d->streamInfoData; +// return d->metaData[STREAMINFO]; + else + return ByteVector(); +} + +ByteVector FLAC::File::xiphCommentData() +{ + if (isValid() && d->hasXiphComment) + return d->xiphCommentData; +// return d->metaData[VORBISCOMMENT]; + else + return ByteVector(); +} + +long FLAC::File::streamLength() +{ + return d->streamLength; +} + +void FLAC::File::scan() +{ + // Scan the metadata pages + + if(d->scanned) + return; + + if(!isValid()) + return; + + long nextPageOffset; + long fileSize = length(); + + if (d->hasID3v2) + nextPageOffset = find("fLaC", d->ID3v2Location+d->ID3v2OriginalSize); + else + nextPageOffset = find("fLaC"); + + if(nextPageOffset < 0) { + debug("FLAC::File::scan() -- FLAC stream not found"); + setValid(false); + return; + } + + nextPageOffset += 4; + d->flacStart = nextPageOffset; + + seek(nextPageOffset); + + ByteVector header = readBlock(4); + + // Header format (from spec): + // <1> Last-metadata-block flag + // <7> BLOCK_TYPE + // 0 : STREAMINFO + // 1 : PADDING + // .. + // 4 : VORBIS_COMMENT + // .. + // <24> Length of metadata to follow + + char blockType = header[0] & 0x7f; + bool lastBlock = header[0] & 0x80; + uint length = header.mid(1, 3).toUInt(); + + // First block should be the stream_info metadata + if(blockType != 0) { + debug("FLAC::File::scan() -- invalid FLAC stream"); + setValid(false); + return; + } + d->streamInfoData = readBlock(length); +// d->metadata.insert(STREAMINFO, readBlock(length)); + nextPageOffset += length + 4; + + // Search through the remaining metadata + + while(!lastBlock) { + header = readBlock(4); + blockType = header[0] & 0x7f; + lastBlock = header[0] & 0x80; + length = header.mid(1, 3).toUInt(); + + if(blockType == 1) { + // debug("FLAC::File::scan() -- Padding found"); + } + // Found the vorbis-comment + else if(blockType == 4) { + d->xiphCommentData = readBlock(length); +// d->metadata.insert(VORBISCOMMENT, readBlock(length)); + d->hasXiphComment = true; + } + + nextPageOffset += length + 4; + if (nextPageOffset >= fileSize) { + debug("FLAC::File::scan() -- FLAC stream corrupted"); + setValid(false); + return; + } + seek(nextPageOffset); + } + + // End of metadata, now comes the datastream + d->streamStart = nextPageOffset; + d->streamLength = File::length() - d->streamStart; + if (d->hasID3v1) + d->streamLength -= 128; + + d->scanned = true; +} + +long FLAC::File::findID3v1() +{ + if(!isValid()) + return -1; + + seek(-128, End); + long p = tell(); + + if(readBlock(3) == ID3v1::Tag::fileIdentifier()) + return p; + + return -1; +} + +long FLAC::File::findID3v2() +{ + if(!isValid()) + return -1; + + seek(0); + + if(readBlock(3) == ID3v2::Header::fileIdentifier()) + return 0; + + return -1; +} diff --git a/Libraries/TagLib/Files/taglib/flac/flacfile.h b/Libraries/TagLib/Files/taglib/flac/flacfile.h new file mode 100644 index 000000000..9fef90398 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/flac/flacfile.h @@ -0,0 +1,196 @@ +/*************************************************************************** + copyright : (C) 2003 by Allan Sandfeld Jensen + email : kde@carewolf.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#ifndef TAGLIB_FLACFILE_H +#define TAGLIB_FLACFILE_H + +#include + +#include "flacproperties.h" + +namespace TagLib { + + class Tag; + + namespace ID3v2 { class FrameFactory; class Tag; } + namespace ID3v1 { class Tag; } + namespace Ogg { class XiphComment; } + + //! An implementation of FLAC metadata + + /*! + * This is implementation of FLAC metadata for non-Ogg FLAC files. At some + * point when Ogg / FLAC is more common there will be a similar implementation + * under the Ogg hiearchy. + * + * This supports ID3v1, ID3v2 and Xiph style comments as well as reading stream + * properties from the file. + */ + + namespace FLAC { + + //! An implementation of TagLib::File with FLAC specific methods + + /*! + * This implements and provides an interface for FLAC files to the + * TagLib::Tag and TagLib::AudioProperties interfaces by way of implementing + * the abstract TagLib::File API as well as providing some additional + * information specific to FLAC files. + */ + + class File : public TagLib::File + { + public: + /*! + * Contructs a FLAC file from \a file. If \a readProperties is true the + * file's audio properties will also be read using \a propertiesStyle. If + * false, \a propertiesStyle is ignored. + * + * \deprecated This constructor will be dropped in favor of the one below + * in a future version. + */ + File(const char *file, bool readProperties = true, + Properties::ReadStyle propertiesStyle = Properties::Average); + + /*! + * Contructs a FLAC file from \a file. If \a readProperties is true the + * file's audio properties will also be read using \a propertiesStyle. If + * false, \a propertiesStyle is ignored. + * + * If this file contains and ID3v2 tag the frames will be created using + * \a frameFactory. + */ + // BIC: merge with the above constructor + File(const char *file, ID3v2::FrameFactory *frameFactory, + bool readProperties = true, + Properties::ReadStyle propertiesStyle = Properties::Average); + + /*! + * Destroys this instance of the File. + */ + virtual ~File(); + + /*! + * Returns the Tag for this file. This will be a union of XiphComment, + * ID3v1 and ID3v2 tags. + * + * \see ID3v2Tag() + * \see ID3v1Tag() + * \see XiphComment() + */ + virtual TagLib::Tag *tag() const; + + /*! + * Returns the FLAC::Properties for this file. If no audio properties + * were read then this will return a null pointer. + */ + virtual Properties *audioProperties() const; + + /*! + * Save the file. This will primarily save the XiphComment, but + * will also keep any old ID3-tags up to date. If the file + * has no XiphComment, one will be constructed from the ID3-tags. + * + * This returns true if the save was successful. + */ + virtual bool save(); + + /*! + * Returns a pointer to the ID3v2 tag of the file. + * + * If \a create is false (the default) this will return a null pointer + * if there is no valid ID3v2 tag. If \a create is true it will create + * an ID3v2 tag if one does not exist. + * + * \note The Tag is still owned by the FLAC::File and should not be + * deleted by the user. It will be deleted when the file (object) is + * destroyed. + */ + ID3v2::Tag *ID3v2Tag(bool create = false); + + /*! + * Returns a pointer to the ID3v1 tag of the file. + * + * If \a create is false (the default) this will return a null pointer + * if there is no valid ID3v1 tag. If \a create is true it will create + * an ID3v1 tag if one does not exist. + * + * \note The Tag is still owned by the FLAC::File and should not be + * deleted by the user. It will be deleted when the file (object) is + * destroyed. + */ + ID3v1::Tag *ID3v1Tag(bool create = false); + + /*! + * Returns a pointer to the XiphComment for the file. + * + * If \a create is false (the default) this will return a null pointer + * if there is no valid XiphComment. If \a create is true it will create + * a XiphComment if one does not exist. + * + * \note The Tag is still owned by the FLAC::File and should not be + * deleted by the user. It will be deleted when the file (object) is + * destroyed. + */ + Ogg::XiphComment *xiphComment(bool create = false); + + /*! + * Set the ID3v2::FrameFactory to something other than the default. This + * can be used to specify the way that ID3v2 frames will be interpreted + * when + * + * \see ID3v2FrameFactory + */ + void setID3v2FrameFactory(const ID3v2::FrameFactory *factory); + + /*! + * Returns the block of data used by FLAC::Properties for parsing the + * stream properties. + * + * \deprecated This method will not be public in a future release. + */ + ByteVector streamInfoData(); // BIC: remove + + /*! + * Returns the length of the audio-stream, used by FLAC::Properties for + * calculating the bitrate. + * + * \deprecated This method will not be public in a future release. + */ + long streamLength(); // BIC: remove + + private: + File(const File &); + File &operator=(const File &); + + void read(bool readProperties, Properties::ReadStyle propertiesStyle); + void scan(); + long findID3v2(); + long findID3v1(); + ByteVector xiphCommentData(); + + class FilePrivate; + FilePrivate *d; + }; + } +} + +#endif diff --git a/Libraries/TagLib/Files/taglib/flac/flacproperties.cpp b/Libraries/TagLib/Files/taglib/flac/flacproperties.cpp new file mode 100644 index 000000000..821de3ca4 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/flac/flacproperties.cpp @@ -0,0 +1,146 @@ +/*************************************************************************** + copyright : (C) 2003 by Allan Sandfeld Jensen + email : kde@carewolf.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#include +#include + +#include "flacproperties.h" +#include "flacfile.h" + +using namespace TagLib; + +class FLAC::Properties::PropertiesPrivate +{ +public: + PropertiesPrivate(ByteVector d, long st, ReadStyle s) : + data(d), + streamLength(st), + style(s), + length(0), + bitrate(0), + sampleRate(0), + sampleWidth(0), + channels(0) {} + + ByteVector data; + long streamLength; + ReadStyle style; + int length; + int bitrate; + int sampleRate; + int sampleWidth; + int channels; +}; + +//////////////////////////////////////////////////////////////////////////////// +// public members +//////////////////////////////////////////////////////////////////////////////// + +FLAC::Properties::Properties(ByteVector data, long streamLength, ReadStyle style) : AudioProperties(style) +{ + d = new PropertiesPrivate(data, streamLength, style); + read(); +} + +FLAC::Properties::Properties(File *file, ReadStyle style) : AudioProperties(style) +{ + d = new PropertiesPrivate(file->streamInfoData(), file->streamLength(), style); + read(); +} + +FLAC::Properties::~Properties() +{ + delete d; +} + +int FLAC::Properties::length() const +{ + return d->length; +} + +int FLAC::Properties::bitrate() const +{ + return d->bitrate; +} + +int FLAC::Properties::sampleRate() const +{ + return d->sampleRate; +} + +int FLAC::Properties::sampleWidth() const +{ + return d->sampleWidth; +} + +int FLAC::Properties::channels() const +{ + return d->channels; +} + +//////////////////////////////////////////////////////////////////////////////// +// private members +//////////////////////////////////////////////////////////////////////////////// + +void FLAC::Properties::read() +{ + if(d->data.size() < 18) { + debug("FLAC::Properties::read() - FLAC properties must contain at least 18 bytes."); + return; + } + + int pos = 0; + + // Minimum block size (in samples) + pos += 2; + + // Maximum block size (in samples) + pos += 2; + + // Minimum frame size (in bytes) + pos += 3; + + // Maximum frame size (in bytes) + pos += 3; + + uint flags = d->data.mid(pos, 4).toUInt(true); + d->sampleRate = flags >> 12; + d->channels = ((flags >> 9) & 7) + 1; + d->sampleWidth = ((flags >> 4) & 31) + 1; + + // The last 4 bits are the most significant 4 bits for the 36 bit + // stream length in samples. (Audio files measured in days) + + uint highLength =d->sampleRate > 0 ? (((flags & 0xf) << 28) / d->sampleRate) << 4 : 0; + pos += 4; + + d->length = d->sampleRate > 0 ? + (d->data.mid(pos, 4).toUInt(true)) / d->sampleRate + highLength : 0; + pos += 4; + + // Uncompressed bitrate: + + //d->bitrate = ((d->sampleRate * d->channels) / 1000) * d->sampleWidth; + + // Real bitrate: + + d->bitrate = d->length > 0 ? ((d->streamLength * 8L) / d->length) / 1000 : 0; +} diff --git a/Libraries/TagLib/Files/taglib/flac/flacproperties.h b/Libraries/TagLib/Files/taglib/flac/flacproperties.h new file mode 100644 index 000000000..c1d1a4fae --- /dev/null +++ b/Libraries/TagLib/Files/taglib/flac/flacproperties.h @@ -0,0 +1,84 @@ +/*************************************************************************** + copyright : (C) 2003 by Allan Sandfeld Jensen + email : kde@carewolf.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#ifndef TAGLIB_FLACPROPERTIES_H +#define TAGLIB_FLACPROPERTIES_H + +#include + +namespace TagLib { + + namespace FLAC { + + class File; + + //! An implementation of audio property reading for FLAC + + /*! + * This reads the data from an FLAC stream found in the AudioProperties + * API. + */ + + class Properties : public AudioProperties + { + public: + /*! + * Create an instance of FLAC::Properties with the data read from the + * ByteVector \a data. + */ + // BIC: switch to const reference + Properties(ByteVector data, long streamLength, ReadStyle style = Average); + + /*! + * Create an instance of FLAC::Properties with the data read from the + * FLAC::File \a file. + */ + // BIC: remove + Properties(File *file, ReadStyle style = Average); + + /*! + * Destroys this FLAC::Properties instance. + */ + virtual ~Properties(); + + // Reimplementations. + + virtual int length() const; + virtual int bitrate() const; + virtual int sampleRate() const; + virtual int channels() const; + + /*! + * Returns the sample width as read from the FLAC identification + * header. + */ + int sampleWidth() const; + + private: + void read(); + + class PropertiesPrivate; + PropertiesPrivate *d; + }; + } +} + +#endif diff --git a/Libraries/TagLib/Files/taglib/flac/flactag.h b/Libraries/TagLib/Files/taglib/flac/flactag.h new file mode 100644 index 000000000..89d4b63e6 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/flac/flactag.h @@ -0,0 +1,212 @@ +/*************************************************************************** + copyright : (C) 2003 by Allan Sandfeld Jensen + email : kde@carewolf.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#ifndef DO_NOT_DOCUMENT // Tell Doxygen not to document this header + +#ifndef TAGLIB_FLACTAG_H +#define TAGLIB_FLACTAG_H + +//////////////////////////////////////////////////////////////////////////////// +// Note that this header is not installed. +//////////////////////////////////////////////////////////////////////////////// + +#include +#include +#include + +namespace TagLib { + + namespace FLAC { + + /*! + * A union of Xiph, ID3v2 and ID3v1 tags. + */ + class Tag : public TagLib::Tag + { + public: + Tag(Ogg::XiphComment *xiph, ID3v2::Tag *id3v2 = 0, ID3v1::Tag *id3v1 = 0) : + TagLib::Tag(), + xiph(xiph), id3v2(id3v2), id3v1(id3v1) {} + + virtual String title() const { + if(xiph && !xiph->title().isEmpty()) + return xiph->title(); + + if(id3v2 && !id3v2->title().isEmpty()) + return id3v2->title(); + + if(id3v1) + return id3v1->title(); + + return String::null; + } + + virtual String artist() const { + if(xiph && !xiph->artist().isEmpty()) + return xiph->artist(); + + if(id3v2 && !id3v2->artist().isEmpty()) + return id3v2->artist(); + + if(id3v1) + return id3v1->artist(); + + return String::null; + } + + virtual String album() const { + if(xiph && !xiph->album().isEmpty()) + return xiph->album(); + + if(id3v2 && !id3v2->album().isEmpty()) + return id3v2->album(); + + if(id3v1) + return id3v1->album(); + + return String::null; + } + + virtual String comment() const { + if(xiph && !xiph->comment().isEmpty()) + return xiph->comment(); + + if(id3v2 && !id3v2->comment().isEmpty()) + return id3v2->comment(); + + if(id3v1) + return id3v1->comment(); + + return String::null; + } + + virtual String genre() const { + if(xiph && !xiph->genre().isEmpty()) + return xiph->genre(); + + if(id3v2 && !id3v2->genre().isEmpty()) + return id3v2->genre(); + + if(id3v1) + return id3v1->genre(); + + return String::null; + } + + virtual uint year() const { + if(xiph && xiph->year() > 0) + return xiph->year(); + + if(id3v2 && id3v2->year() > 0) + return id3v2->year(); + + if(id3v1) + return id3v1->year(); + + return 0; + } + + virtual uint track() const { + if(xiph && xiph->track() > 0) + return xiph->track(); + + if(id3v2 && id3v2->track() > 0) + return id3v2->track(); + + if(id3v1) + return id3v1->track(); + + return 0; + } + + virtual void setTitle(const String &s) { + if(xiph) + xiph->setTitle(s); + if(id3v2) + id3v2->setTitle(s); + if(id3v1) + id3v1->setTitle(s); + } + + virtual void setArtist(const String &s) { + if(xiph) + xiph->setArtist(s); + if(id3v2) + id3v2->setArtist(s); + if(id3v1) + id3v1->setArtist(s); + } + + virtual void setAlbum(const String &s) { + if(xiph) + xiph->setAlbum(s); + if(id3v2) + id3v2->setAlbum(s); + if(id3v1) + id3v1->setAlbum(s); + } + + virtual void setComment(const String &s) { + if(xiph) + xiph->setComment(s); + if(id3v2) + id3v2->setComment(s); + if(id3v1) + id3v1->setComment(s); + } + + virtual void setGenre(const String &s) { + if(xiph) + xiph->setGenre(s); + if(id3v2) + id3v2->setGenre(s); + if(id3v1) + id3v1->setGenre(s); + } + + virtual void setYear(uint i) { + if(xiph) + xiph->setYear(i); + if(id3v2) + id3v2->setYear(i); + if(id3v1) + id3v1->setYear(i); + } + + virtual void setTrack(uint i) { + if(xiph) + xiph->setTrack(i); + if(id3v2) + id3v2->setTrack(i); + if(id3v1) + id3v1->setTrack(i); + } + + private: + Ogg::XiphComment *xiph; + ID3v2::Tag *id3v2; + ID3v1::Tag *id3v1; + }; + } +} + +#endif +#endif diff --git a/Libraries/TagLib/Files/taglib/mpc/Makefile.am b/Libraries/TagLib/Files/taglib/mpc/Makefile.am new file mode 100644 index 000000000..4d12cb660 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/mpc/Makefile.am @@ -0,0 +1,16 @@ +INCLUDES = \ + -I$(top_srcdir)/taglib \ + -I$(top_srcdir)/taglib/toolkit \ + -I$(top_srcdir)/taglib/ape \ + -I$(top_srcdir)/taglib/mpeg/id3v1 \ + -I$(top_srcdir)/taglib/mpeg/id3v2 \ + $(all_includes) + +noinst_LTLIBRARIES = libmpc.la + +libmpc_la_SOURCES = mpcfile.cpp mpcproperties.cpp + +taglib_include_HEADERS = mpcfile.h mpcproperties.h +taglib_includedir = $(includedir)/taglib + +EXTRA_DIST = $(libmpc_la_SOURCES) $(taglib_include_HEADERS) diff --git a/Libraries/TagLib/Files/taglib/mpc/Makefile.in b/Libraries/TagLib/Files/taglib/mpc/Makefile.in new file mode 100644 index 000000000..ca98a1028 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/mpc/Makefile.in @@ -0,0 +1,555 @@ +# Makefile.in generated by automake 1.7.6 from Makefile.am. +# KDE tags expanded automatically by am_edit - $Revision$ +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../.. + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTODIRS = @AUTODIRS@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CONF_FILES = @CONF_FILES@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +KDE_PLUGIN = @KDE_PLUGIN@ +KDE_USE_CLOSURE_FALSE = @KDE_USE_CLOSURE_FALSE@ +KDE_USE_CLOSURE_TRUE = @KDE_USE_CLOSURE_TRUE@ +KDE_USE_FINAL_FALSE = @KDE_USE_FINAL_FALSE@ +KDE_USE_FINAL_TRUE = @KDE_USE_FINAL_TRUE@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +NOOPT_CFLAGS = @NOOPT_CFLAGS@ +NOOPT_CXXFLAGS = @NOOPT_CXXFLAGS@ +NOREPO = @NOREPO@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +REPO = @REPO@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +TOPSUBDIRS = @TOPSUBDIRS@ +USE_EXCEPTIONS = @USE_EXCEPTIONS@ +USE_RTTI = @USE_RTTI@ +VERSION = @VERSION@ +WOVERLOADED_VIRTUAL = @WOVERLOADED_VIRTUAL@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +all_includes = @all_includes@ +all_libraries = @all_libraries@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +link_zlib_FALSE = @link_zlib_FALSE@ +link_zlib_TRUE = @link_zlib_TRUE@ +localstatedir = @localstatedir@ +mandir = @mandir@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +INCLUDES = \ + -I$(top_srcdir)/taglib \ + -I$(top_srcdir)/taglib/toolkit \ + -I$(top_srcdir)/taglib/ape \ + -I$(top_srcdir)/taglib/mpeg/id3v1 \ + -I$(top_srcdir)/taglib/mpeg/id3v2 \ + $(all_includes) + + +noinst_LTLIBRARIES = libmpc.la + +libmpc_la_SOURCES = mpcfile.cpp mpcproperties.cpp + +taglib_include_HEADERS = mpcfile.h mpcproperties.h +taglib_includedir = $(includedir)/taglib + +EXTRA_DIST = $(libmpc_la_SOURCES) $(taglib_include_HEADERS) +subdir = taglib/mpc +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/admin/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) + +libmpc_la_LDFLAGS = +libmpc_la_LIBADD = +am_libmpc_la_OBJECTS = mpcfile.lo mpcproperties.lo +#>- libmpc_la_OBJECTS = $(am_libmpc_la_OBJECTS) +#>+ 4 +libmpc_la_final_OBJECTS = libmpc_la.all_cpp.lo +libmpc_la_nofinal_OBJECTS = mpcfile.lo mpcproperties.lo +@KDE_USE_FINAL_FALSE@libmpc_la_OBJECTS = $(libmpc_la_nofinal_OBJECTS) +@KDE_USE_FINAL_TRUE@libmpc_la_OBJECTS = $(libmpc_la_final_OBJECTS) + +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/admin/depcomp +am__depfiles_maybe = depfiles +#>- @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/mpcfile.Plo \ +#>- @AMDEP_TRUE@ ./$(DEPDIR)/mpcproperties.Plo +#>+ 5 +@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@DEP_FILES = $(DEPDIR)/libmpc_la.all_cpp.P ./$(DEPDIR)/mpcfile.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@ @AMDEP_TRUE@ ./$(DEPDIR)/mpcproperties.Plo +@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@DEP_FILES = ./$(DEPDIR)/mpcfile.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@ @AMDEP_TRUE@ ./$(DEPDIR)/mpcproperties.Plo + +#>- CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ +#>- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +#>+ 2 +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(KDE_CXXFLAGS) +#>- LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) \ +#>- $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ +#>- $(AM_CXXFLAGS) $(CXXFLAGS) +#>+ 3 +LTCXXCOMPILE = $(LIBTOOL) --mode=compile --tag=CXX $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) $(KDE_CXXFLAGS) +CXXLD = $(CXX) +#>- CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \ +#>- $(AM_LDFLAGS) $(LDFLAGS) -o $@ +#>+ 2 +CXXLINK = $(LIBTOOL) --mode=link --tag=CXX $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(KDE_CXXFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +DIST_SOURCES = $(libmpc_la_SOURCES) +HEADERS = $(taglib_include_HEADERS) + +DIST_COMMON = $(taglib_include_HEADERS) Makefile.am Makefile.in +SOURCES = $(libmpc_la_SOURCES) + +#>- all: all-am +#>+ 1 +all: docs-am all-am + +.SUFFIXES: +.SUFFIXES: .cpp .lo .o .obj +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) +#>- cd $(top_srcdir) && \ +#>- $(AUTOMAKE) --gnu taglib/mpc/Makefile +#>+ 3 + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu taglib/mpc/Makefile + cd $(top_srcdir) && perl admin/am_edit taglib/mpc/Makefile.in +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" = "$$p" && dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libmpc.la: $(libmpc_la_OBJECTS) $(libmpc_la_DEPENDENCIES) + $(CXXLINK) $(libmpc_la_LDFLAGS) $(libmpc_la_OBJECTS) $(libmpc_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) core *.core + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpcfile.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpcproperties.Plo@am__quote@ + +distclean-depend: + -rm -rf ./$(DEPDIR) + +.cpp.o: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + +.cpp.obj: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` + +.cpp.lo: +@am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: +taglib_includeHEADERS_INSTALL = $(INSTALL_HEADER) +install-taglib_includeHEADERS: $(taglib_include_HEADERS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(taglib_includedir) + @list='$(taglib_include_HEADERS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(taglib_includeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(taglib_includedir)/$$f"; \ + $(taglib_includeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(taglib_includedir)/$$f; \ + done + +uninstall-taglib_includeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(taglib_include_HEADERS)'; for p in $$list; do \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " rm -f $(DESTDIR)$(taglib_includedir)/$$f"; \ + rm -f $(DESTDIR)$(taglib_includedir)/$$f; \ + done + +ETAGS = etags +ETAGSFLAGS = + +CTAGS = ctags +CTAGSFLAGS = + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique + +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +#>- DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +#>+ 4 +KDE_DIST=combinedtag.h + +DISTFILES= $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) $(KDE_DIST) + + +top_distdir = ../.. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) + +installdirs: + $(mkinstalldirs) $(DESTDIR)$(taglib_includedir) +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +#>- clean: clean-am +#>+ 1 +clean: kde-rpo-clean clean-am + +#>- clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ +#>- mostlyclean-am +#>+ 2 +clean-am: clean-final clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + +distclean-am: clean-am distclean-compile distclean-depend \ + distclean-generic distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: install-taglib_includeHEADERS + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am uninstall-taglib_includeHEADERS + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstLTLIBRARIES ctags distclean \ + distclean-compile distclean-depend distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am info \ + info-am install install-am install-data install-data-am \ + install-exec install-exec-am install-info install-info-am \ + install-man install-strip install-taglib_includeHEADERS \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-info-am \ + uninstall-taglib_includeHEADERS + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: + +#>+ 2 +docs-am: + +#>+ 6 +force-reedit: + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu taglib/mpc/Makefile + cd $(top_srcdir) && perl admin/am_edit taglib/mpc/Makefile.in + + +#>+ 11 +libmpc_la.all_cpp.cpp: $(srcdir)/Makefile.in $(srcdir)/mpcfile.cpp $(srcdir)/mpcproperties.cpp + @echo 'creating libmpc_la.all_cpp.cpp ...'; \ + rm -f libmpc_la.all_cpp.files libmpc_la.all_cpp.final; \ + echo "#define KDE_USE_FINAL 1" >> libmpc_la.all_cpp.final; \ + for file in mpcfile.cpp mpcproperties.cpp ; do \ + echo "#include \"$$file\"" >> libmpc_la.all_cpp.files; \ + test ! -f $(srcdir)/$$file || egrep '^#pragma +implementation' $(srcdir)/$$file >> libmpc_la.all_cpp.final; \ + done; \ + cat libmpc_la.all_cpp.final libmpc_la.all_cpp.files > libmpc_la.all_cpp.cpp; \ + rm -f libmpc_la.all_cpp.final libmpc_la.all_cpp.files + +#>+ 3 +clean-final: + -rm -f libmpc_la.all_cpp.cpp + +#>+ 2 +final: + $(MAKE) libmpc_la_OBJECTS="$(libmpc_la_final_OBJECTS)" all-am +#>+ 2 +final-install: + $(MAKE) libmpc_la_OBJECTS="$(libmpc_la_final_OBJECTS)" install-am +#>+ 2 +no-final: + $(MAKE) libmpc_la_OBJECTS="$(libmpc_la_nofinal_OBJECTS)" all-am +#>+ 2 +no-final-install: + $(MAKE) libmpc_la_OBJECTS="$(libmpc_la_nofinal_OBJECTS)" install-am +#>+ 3 +cvs-clean: + $(MAKE) admindir=$(top_srcdir)/admin -f $(top_srcdir)/admin/Makefile.common cvs-clean + +#>+ 3 +kde-rpo-clean: + -rm -f *.rpo diff --git a/Libraries/TagLib/Files/taglib/mpc/combinedtag.h b/Libraries/TagLib/Files/taglib/mpc/combinedtag.h new file mode 100644 index 000000000..c2a199821 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/mpc/combinedtag.h @@ -0,0 +1,171 @@ +/*************************************************************************** + copyright : (C) 2004 by Allan Sandfeld Jensen + email : kde@carewolf.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#ifndef DO_NOT_DOCUMENT // Tell Doxygen not to document this header + +#ifndef TAGLIB_COMBINEDTAG_H +#define TAGLIB_COMBINEDTAG_H + +//////////////////////////////////////////////////////////////////////////////// +// Note that this header is not installed. +//////////////////////////////////////////////////////////////////////////////// + +#include + +namespace TagLib { + + /*! + * A union of two TagLib::Tags. + */ + class CombinedTag : public TagLib::Tag + { + public: + CombinedTag(Tag *tag1 = 0, Tag *tag2 = 0) + : TagLib::Tag(), + tag1(tag1), tag2(tag2) {} + + virtual String title() const { + if(tag1 && !tag1->title().isEmpty()) + return tag1->title(); + + if(tag2) + return tag2->title(); + + return String::null; + } + + virtual String artist() const { + if(tag1 && !tag1->artist().isEmpty()) + return tag1->artist(); + + if(tag2) + return tag2->artist(); + + return String::null; + } + + virtual String album() const { + if(tag1 && !tag1->album().isEmpty()) + return tag1->album(); + + if(tag2) + return tag2->album(); + + return String::null; + } + + virtual String comment() const { + if(tag1 && !tag1->comment().isEmpty()) + return tag1->comment(); + + if(tag2) + return tag2->comment(); + + return String::null; + } + + virtual String genre() const { + if(tag1 && !tag1->genre().isEmpty()) + return tag1->genre(); + + if(tag2) + return tag2->genre(); + + return String::null; + } + + virtual uint year() const { + if(tag1 && tag1->year() > 0) + return tag1->year(); + + if(tag2) + return tag2->year(); + + return 0; + } + + virtual uint track() const { + if(tag1 && tag1->track() > 0) + return tag1->track(); + + if(tag2) + return tag2->track(); + + return 0; + } + + virtual void setTitle(const String &s) { + if(tag1) + tag1->setTitle(s); + if(tag2) + tag2->setTitle(s); + } + + virtual void setArtist(const String &s) { + if(tag1) + tag1->setArtist(s); + if(tag2) + tag2->setArtist(s); + } + + virtual void setAlbum(const String &s) { + if(tag1) + tag1->setAlbum(s); + if(tag2) + tag2->setAlbum(s); + } + + virtual void setComment(const String &s) { + if(tag1) + tag1->setComment(s); + if(tag2) + tag2->setComment(s); + } + + virtual void setGenre(const String &s) { + if(tag1) + tag1->setGenre(s); + if(tag2) + tag2->setGenre(s); + } + + virtual void setYear(uint i) { + if(tag1) + tag1->setYear(i); + if(tag2) + tag2->setYear(i); + } + + virtual void setTrack(uint i) { + if(tag1) + tag1->setTrack(i); + if(tag2) + tag2->setTrack(i); + } + + private: + Tag *tag1; + Tag *tag2; + }; +} + +#endif +#endif diff --git a/Libraries/TagLib/Files/taglib/mpc/mpcfile.cpp b/Libraries/TagLib/Files/taglib/mpc/mpcfile.cpp new file mode 100644 index 000000000..ae77e37b2 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/mpc/mpcfile.cpp @@ -0,0 +1,358 @@ +/*************************************************************************** + copyright : (C) 2004 by Allan Sandfeld Jensen + email : kde@carewolf.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#include +#include +#include + +#include "mpcfile.h" +#include "id3v1tag.h" +#include "id3v2header.h" +#include "apetag.h" +#include "apefooter.h" +#include "combinedtag.h" + +using namespace TagLib; + +class MPC::File::FilePrivate +{ +public: + FilePrivate() : + APETag(0), + APELocation(-1), + APESize(0), + ID3v1Tag(0), + ID3v1Location(-1), + ID3v2Header(0), + ID3v2Location(-1), + ID3v2Size(0), + tag(0), + properties(0), + scanned(false), + hasAPE(false), + hasID3v1(false), + hasID3v2(false) {} + + ~FilePrivate() + { + delete ID3v1Tag; + delete properties; + } + + APE::Tag *APETag; + // long APEFooter; + long APELocation; + uint APESize; + + ID3v1::Tag *ID3v1Tag; + long ID3v1Location; + + ID3v2::Header *ID3v2Header; + long ID3v2Location; + uint ID3v2Size; + + Tag *tag; + + Properties *properties; + bool scanned; + + // These indicate whether the file *on disk* has these tags, not if + // this data structure does. This is used in computing offsets. + + bool hasAPE; + bool hasID3v1; + bool hasID3v2; +}; + +//////////////////////////////////////////////////////////////////////////////// +// public members +//////////////////////////////////////////////////////////////////////////////// + +MPC::File::File(const char *file, bool readProperties, + Properties::ReadStyle propertiesStyle) : TagLib::File(file) +{ + d = new FilePrivate; + read(readProperties, propertiesStyle); +} + +MPC::File::~File() +{ + delete d; +} + +TagLib::Tag *MPC::File::tag() const +{ + return d->tag; +} + +MPC::Properties *MPC::File::audioProperties() const +{ + return d->properties; +} + +bool MPC::File::save() +{ + if(readOnly()) { + debug("MPC::File::save() -- File is read only."); + return false; + } + + // Possibly strip ID3v2 tag + + if(d->hasID3v2 && !d->ID3v2Header) { + removeBlock(d->ID3v2Location, d->ID3v2Size); + d->hasID3v2 = false; + if(d->hasID3v1) + d->ID3v1Location -= d->ID3v2Size; + if(d->hasAPE) + d->APELocation -= d->ID3v2Size; + } + + // Update ID3v1 tag + + if(d->ID3v1Tag) { + if(d->hasID3v1) { + seek(d->ID3v1Location); + writeBlock(d->ID3v1Tag->render()); + } + else { + seek(0, End); + d->ID3v1Location = tell(); + writeBlock(d->ID3v1Tag->render()); + d->hasID3v1 = true; + } + } else + if(d->hasID3v1) { + removeBlock(d->ID3v1Location, 128); + d->hasID3v1 = false; + if(d->hasAPE) { + if(d->APELocation > d->ID3v1Location) + d->APELocation -= 128; + } + } + + // Update APE tag + + if(d->APETag) { + if(d->hasAPE) + insert(d->APETag->render(), d->APELocation, d->APESize); + else { + if(d->hasID3v1) { + insert(d->APETag->render(), d->ID3v1Location, 0); + d->APESize = d->APETag->footer()->completeTagSize(); + d->hasAPE = true; + d->APELocation = d->ID3v1Location; + d->ID3v1Location += d->APESize; + } + else { + seek(0, End); + d->APELocation = tell(); + writeBlock(d->APETag->render()); + d->APESize = d->APETag->footer()->completeTagSize(); + d->hasAPE = true; + } + } + } + else + if(d->hasAPE) { + removeBlock(d->APELocation, d->APESize); + d->hasAPE = false; + if(d->hasID3v1) { + if (d->ID3v1Location > d->APELocation) + d->ID3v1Location -= d->APESize; + } + } + + return true; +} + +ID3v1::Tag *MPC::File::ID3v1Tag(bool create) +{ + if(!create || d->ID3v1Tag) + return d->ID3v1Tag; + + // no ID3v1 tag exists and we've been asked to create one + + d->ID3v1Tag = new ID3v1::Tag; + + if(d->APETag) + d->tag = new CombinedTag(d->APETag, d->ID3v1Tag); + else + d->tag = d->ID3v1Tag; + + return d->ID3v1Tag; +} + +APE::Tag *MPC::File::APETag(bool create) +{ + if(!create || d->APETag) + return d->APETag; + + // no APE tag exists and we've been asked to create one + + d->APETag = new APE::Tag; + + if(d->ID3v1Tag) + d->tag = new CombinedTag(d->APETag, d->ID3v1Tag); + else + d->tag = d->APETag; + + return d->APETag; +} + +void MPC::File::remove(int tags) +{ + if(tags & ID3v1) { + delete d->ID3v1Tag; + d->ID3v1Tag = 0; + + if(d->APETag) + d->tag = d->APETag; + else + d->tag = d->APETag = new APE::Tag(); + } + + if(tags & ID3v2) { + delete d->ID3v2Header; + d->ID3v2Header = 0; + } + + if(tags & APE) { + delete d->APETag; + d->APETag = 0; + + if(d->ID3v1Tag) + d->tag = d->ID3v1Tag; + else + d->tag = d->APETag = new APE::Tag(); + } +} + + +//////////////////////////////////////////////////////////////////////////////// +// private members +//////////////////////////////////////////////////////////////////////////////// + +void MPC::File::read(bool readProperties, Properties::ReadStyle /* propertiesStyle */) +{ + // Look for an ID3v1 tag + + d->ID3v1Location = findID3v1(); + + if(d->ID3v1Location >= 0) { + d->ID3v1Tag = new ID3v1::Tag(this, d->ID3v1Location); + d->hasID3v1 = true; + } + + // Look for an APE tag + + findAPE(); + + d->APELocation = findAPE(); + + if(d->APELocation >= 0) { + d->APETag = new APE::Tag(this, d->APELocation); + d->APESize = d->APETag->footer()->completeTagSize(); + d->APELocation = d->APELocation + d->APETag->footer()->size() - d->APESize; + d->hasAPE = true; + } + + if(d->hasID3v1 && d->hasAPE) + d->tag = new CombinedTag(d->APETag, d->ID3v1Tag); + else { + if(d->hasID3v1) + d->tag = d->ID3v1Tag; + else { + if(d->hasAPE) + d->tag = d->APETag; + else + d->tag = d->APETag = new APE::Tag(); + } + } + + // Look for and skip an ID3v2 tag + + d->ID3v2Location = findID3v2(); + + if(d->ID3v2Location >= 0) { + seek(d->ID3v2Location); + d->ID3v2Header = new ID3v2::Header(readBlock(ID3v2::Header::size())); + d->ID3v2Size = d->ID3v2Header->completeTagSize(); + d->hasID3v2 = true; + } + + if(d->hasID3v2) + seek(d->ID3v2Location + d->ID3v2Size); + else + seek(0); + + // Look for MPC metadata + + if(readProperties) { + d->properties = new Properties(readBlock(MPC::HeaderSize), + length() - d->ID3v2Size - d->APESize); + } +} + +long MPC::File::findAPE() +{ + if(!isValid()) + return -1; + + if(d->hasID3v1) + seek(-160, End); + else + seek(-32, End); + + long p = tell(); + + if(readBlock(8) == APE::Tag::fileIdentifier()) + return p; + + return -1; +} + +long MPC::File::findID3v1() +{ + if(!isValid()) + return -1; + + seek(-128, End); + long p = tell(); + + if(readBlock(3) == ID3v1::Tag::fileIdentifier()) + return p; + + return -1; +} + +long MPC::File::findID3v2() +{ + if(!isValid()) + return -1; + + seek(0); + + if(readBlock(3) == ID3v2::Header::fileIdentifier()) + return 0; + + return -1; +} diff --git a/Libraries/TagLib/Files/taglib/mpc/mpcfile.h b/Libraries/TagLib/Files/taglib/mpc/mpcfile.h new file mode 100644 index 000000000..aa40e953f --- /dev/null +++ b/Libraries/TagLib/Files/taglib/mpc/mpcfile.h @@ -0,0 +1,162 @@ +/*************************************************************************** + copyright : (C) 2004 by Allan Sandfeld Jensen + email : kde@carewolf.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#ifndef TAGLIB_MPCFILE_H +#define TAGLIB_MPCFILE_H + +#include "tfile.h" + +#include "mpcproperties.h" + +namespace TagLib { + + class Tag; + + namespace ID3v1 { class Tag; } + namespace APE { class Tag; } + + //! An implementation of MPC metadata + + /*! + * This is implementation of MPC metadata. + * + * This supports ID3v1 and APE (v1 and v2) style comments as well as reading stream + * properties from the file. ID3v2 tags are invalid in MPC-files, but will be skipped + * and ignored. + */ + + namespace MPC { + + //! An implementation of TagLib::File with MPC specific methods + + /*! + * This implements and provides an interface for MPC files to the + * TagLib::Tag and TagLib::AudioProperties interfaces by way of implementing + * the abstract TagLib::File API as well as providing some additional + * information specific to MPC files. + * The only invalid tag combination supported is an ID3v1 tag after an APE tag. + */ + + class File : public TagLib::File + { + public: + /*! + * This set of flags is used for various operations and is suitable for + * being OR-ed together. + */ + enum TagTypes { + //! Empty set. Matches no tag types. + NoTags = 0x0000, + //! Matches ID3v1 tags. + ID3v1 = 0x0001, + //! Matches ID3v2 tags. + ID3v2 = 0x0002, + //! Matches APE tags. + APE = 0x0004, + //! Matches all tag types. + AllTags = 0xffff + }; + + /*! + * Contructs an MPC file from \a file. If \a readProperties is true the + * file's audio properties will also be read using \a propertiesStyle. If + * false, \a propertiesStyle is ignored. + */ + File(const char *file, bool readProperties = true, + Properties::ReadStyle propertiesStyle = Properties::Average); + + /*! + * Destroys this instance of the File. + */ + virtual ~File(); + + /*! + * Returns the Tag for this file. This will be an APE tag, an ID3v1 tag + * or a combination of the two. + */ + virtual TagLib::Tag *tag() const; + + /*! + * Returns the MPC::Properties for this file. If no audio properties + * were read then this will return a null pointer. + */ + virtual Properties *audioProperties() const; + + /*! + * Saves the file. + */ + virtual bool save(); + + /*! + * Returns a pointer to the ID3v1 tag of the file. + * + * If \a create is false (the default) this will return a null pointer + * if there is no valid ID3v1 tag. If \a create is true it will create + * an ID3v1 tag if one does not exist. If there is already an APE tag, the + * new ID3v1 tag will be placed after it. + * + * \note The Tag is still owned by the APE::File and should not be + * deleted by the user. It will be deleted when the file (object) is + * destroyed. + */ + ID3v1::Tag *ID3v1Tag(bool create = false); + + /*! + * Returns a pointer to the APE tag of the file. + * + * If \a create is false (the default) this will return a null pointer + * if there is no valid APE tag. If \a create is true it will create + * a APE tag if one does not exist. If there is already an ID3v1 tag, thes + * new APE tag will be placed before it. + * + * \note The Tag is still owned by the APE::File and should not be + * deleted by the user. It will be deleted when the file (object) is + * destroyed. + */ + APE::Tag *APETag(bool create = false); + + /*! + * This will remove the tags that match the OR-ed together TagTypes from the + * file. By default it removes all tags. + * + * \note This will also invalidate pointers to the tags + * as their memory will be freed. + * \note In order to make the removal permanent save() still needs to be called + */ + void remove(int tags = AllTags); + + private: + File(const File &); + File &operator=(const File &); + + void read(bool readProperties, Properties::ReadStyle propertiesStyle); + void scan(); + long findAPE(); + long findID3v1(); + long findID3v2(); + + class FilePrivate; + FilePrivate *d; + }; + } +} + +#endif diff --git a/Libraries/TagLib/Files/taglib/mpc/mpcproperties.cpp b/Libraries/TagLib/Files/taglib/mpc/mpcproperties.cpp new file mode 100644 index 000000000..fb61b244d --- /dev/null +++ b/Libraries/TagLib/Files/taglib/mpc/mpcproperties.cpp @@ -0,0 +1,140 @@ +/*************************************************************************** + copyright : (C) 2004 by Allan Sandfeld Jensen + email : kde@carewolf.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#include +#include +#include + +#include "mpcproperties.h" +#include "mpcfile.h" + +using namespace TagLib; + +class MPC::Properties::PropertiesPrivate +{ +public: + PropertiesPrivate(const ByteVector &d, long length, ReadStyle s) : + data(d), + streamLength(length), + style(s), + version(0), + length(0), + bitrate(0), + sampleRate(0), + channels(0) {} + + ByteVector data; + long streamLength; + ReadStyle style; + int version; + int length; + int bitrate; + int sampleRate; + int channels; +}; + +//////////////////////////////////////////////////////////////////////////////// +// public members +//////////////////////////////////////////////////////////////////////////////// + +MPC::Properties::Properties(const ByteVector &data, long streamLength, ReadStyle style) : AudioProperties(style) +{ + d = new PropertiesPrivate(data, streamLength, style); + read(); +} + +MPC::Properties::~Properties() +{ + delete d; +} + +int MPC::Properties::length() const +{ + return d->length; +} + +int MPC::Properties::bitrate() const +{ + return d->bitrate; +} + +int MPC::Properties::sampleRate() const +{ + return d->sampleRate; +} + +/* +int MPC::Properties::sampleWidth() const +{ + return d->sampleWidth; +} +*/ + +int MPC::Properties::channels() const +{ + return d->channels; +} + +int MPC::Properties::mpcVersion() const +{ + return d->version; +} + +//////////////////////////////////////////////////////////////////////////////// +// private members +//////////////////////////////////////////////////////////////////////////////// + +static const unsigned short sftable [4] = { 44100, 48000, 37800, 32000 }; + +void MPC::Properties::read() +{ + if(d->data.mid(0, 3) != "MP+") + return; + + d->version = d->data[3] & 15; + + unsigned int frames; + + if(d->version >= 7) { + frames = d->data.mid(4, 4).toUInt(false); + + std::bitset<32> flags = d->data.mid(8, 4).toUInt(true); + d->sampleRate = sftable[flags[17] * 2 + flags[16]]; + d->channels = 2; + } + else { + unsigned int headerData = d->data.mid(0, 4).toUInt(false); + d->bitrate = (headerData >> 23) & 0x01ff; + d->version = (headerData >> 11) & 0x03ff; + d->sampleRate = 44100; + d->channels = 2; + if(d->version >= 5) + frames = d->data.mid(4, 4).toUInt(false); + else + frames = d->data.mid(4, 2).toUInt(false); + } + + unsigned int samples = frames * 1152 - 576; + d->length = d->sampleRate > 0 ? (samples + (d->sampleRate / 2)) / d->sampleRate : 0; + + if(!d->bitrate) + d->bitrate = d->length > 0 ? ((d->streamLength * 8L) / d->length) / 1000 : 0; +} diff --git a/Libraries/TagLib/Files/taglib/mpc/mpcproperties.h b/Libraries/TagLib/Files/taglib/mpc/mpcproperties.h new file mode 100644 index 000000000..4febde4db --- /dev/null +++ b/Libraries/TagLib/Files/taglib/mpc/mpcproperties.h @@ -0,0 +1,77 @@ +/*************************************************************************** + copyright : (C) 2004 by Allan Sandfeld Jensen + email : kde@carewolf.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#ifndef TAGLIB_MPCPROPERTIES_H +#define TAGLIB_MPCPROPERTIES_H + +#include "audioproperties.h" + +namespace TagLib { + + namespace MPC { + + class File; + + static const uint HeaderSize = 8*7; + + //! An implementation of audio property reading for MPC + + /*! + * This reads the data from an MPC stream found in the AudioProperties + * API. + */ + + class Properties : public AudioProperties + { + public: + /*! + * Create an instance of MPC::Properties with the data read from the + * ByteVector \a data. + */ + Properties(const ByteVector &data, long streamLength, ReadStyle style = Average); + + /*! + * Destroys this MPC::Properties instance. + */ + virtual ~Properties(); + + // Reimplementations. + + virtual int length() const; + virtual int bitrate() const; + virtual int sampleRate() const; + virtual int channels() const; + + /*! + * Returns the version of the bitstream (SV4-SV7) + */ + int mpcVersion() const; + + private: + void read(); + + class PropertiesPrivate; + PropertiesPrivate *d; + }; + } +} + +#endif diff --git a/Libraries/TagLib/Files/taglib/mpeg/Makefile.am b/Libraries/TagLib/Files/taglib/mpeg/Makefile.am new file mode 100644 index 000000000..acc3614ea --- /dev/null +++ b/Libraries/TagLib/Files/taglib/mpeg/Makefile.am @@ -0,0 +1,19 @@ +SUBDIRS = id3v1 id3v2 +INCLUDES = \ + -I$(top_srcdir)/taglib\ + -I$(top_srcdir)/taglib/toolkit \ + -I$(top_srcdir)/taglib/ape \ + -I$(top_srcdir)/taglib/mpeg/id3v2 -I./id3v2 \ + -I$(top_srcdir)/taglib/mpeg/id3v1 -I./id3v1 \ + $(all_includes) + +noinst_LTLIBRARIES = libmpeg.la + +libmpeg_la_SOURCES = mpegfile.cpp mpegproperties.cpp mpegheader.cpp xingheader.cpp + +taglib_include_HEADERS = mpegfile.h mpegproperties.h mpegheader.h xingheader.h +taglib_includedir = $(includedir)/taglib + +libmpeg_la_LIBADD = ./id3v2/libid3v2.la ./id3v1/libid3v1.la + +EXTRA_DIST = $(libmpeg_la_SOURCES) $(taglib_include_HEADERS) diff --git a/Libraries/TagLib/Files/taglib/mpeg/Makefile.in b/Libraries/TagLib/Files/taglib/mpeg/Makefile.in new file mode 100644 index 000000000..5aa094401 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/mpeg/Makefile.in @@ -0,0 +1,662 @@ +# Makefile.in generated by automake 1.7.6 from Makefile.am. +# KDE tags expanded automatically by am_edit - $Revision$ +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../.. + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTODIRS = @AUTODIRS@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CONF_FILES = @CONF_FILES@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +KDE_PLUGIN = @KDE_PLUGIN@ +KDE_USE_CLOSURE_FALSE = @KDE_USE_CLOSURE_FALSE@ +KDE_USE_CLOSURE_TRUE = @KDE_USE_CLOSURE_TRUE@ +KDE_USE_FINAL_FALSE = @KDE_USE_FINAL_FALSE@ +KDE_USE_FINAL_TRUE = @KDE_USE_FINAL_TRUE@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +NOOPT_CFLAGS = @NOOPT_CFLAGS@ +NOOPT_CXXFLAGS = @NOOPT_CXXFLAGS@ +NOREPO = @NOREPO@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +REPO = @REPO@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +TOPSUBDIRS = @TOPSUBDIRS@ +USE_EXCEPTIONS = @USE_EXCEPTIONS@ +USE_RTTI = @USE_RTTI@ +VERSION = @VERSION@ +WOVERLOADED_VIRTUAL = @WOVERLOADED_VIRTUAL@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +all_includes = @all_includes@ +all_libraries = @all_libraries@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +link_zlib_FALSE = @link_zlib_FALSE@ +link_zlib_TRUE = @link_zlib_TRUE@ +localstatedir = @localstatedir@ +mandir = @mandir@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +SUBDIRS = id3v1 id3v2 +INCLUDES = \ + -I$(top_srcdir)/taglib\ + -I$(top_srcdir)/taglib/toolkit \ + -I$(top_srcdir)/taglib/ape \ + -I$(top_srcdir)/taglib/mpeg/id3v2 -I./id3v2 \ + -I$(top_srcdir)/taglib/mpeg/id3v1 -I./id3v1 \ + $(all_includes) + + +noinst_LTLIBRARIES = libmpeg.la + +libmpeg_la_SOURCES = mpegfile.cpp mpegproperties.cpp mpegheader.cpp xingheader.cpp + +taglib_include_HEADERS = mpegfile.h mpegproperties.h mpegheader.h xingheader.h +taglib_includedir = $(includedir)/taglib + +libmpeg_la_LIBADD = ./id3v2/libid3v2.la ./id3v1/libid3v1.la + +EXTRA_DIST = $(libmpeg_la_SOURCES) $(taglib_include_HEADERS) +subdir = taglib/mpeg +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/admin/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) + +libmpeg_la_LDFLAGS = +libmpeg_la_DEPENDENCIES = ./id3v2/libid3v2.la ./id3v1/libid3v1.la +am_libmpeg_la_OBJECTS = mpegfile.lo mpegproperties.lo mpegheader.lo \ + xingheader.lo +#>- libmpeg_la_OBJECTS = $(am_libmpeg_la_OBJECTS) +#>+ 5 +libmpeg_la_final_OBJECTS = libmpeg_la.all_cpp.lo +libmpeg_la_nofinal_OBJECTS = mpegfile.lo mpegproperties.lo mpegheader.lo \ + xingheader.lo +@KDE_USE_FINAL_FALSE@libmpeg_la_OBJECTS = $(libmpeg_la_nofinal_OBJECTS) +@KDE_USE_FINAL_TRUE@libmpeg_la_OBJECTS = $(libmpeg_la_final_OBJECTS) + +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/admin/depcomp +am__depfiles_maybe = depfiles +#>- @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/mpegfile.Plo \ +#>- @AMDEP_TRUE@ ./$(DEPDIR)/mpegheader.Plo \ +#>- @AMDEP_TRUE@ ./$(DEPDIR)/mpegproperties.Plo \ +#>- @AMDEP_TRUE@ ./$(DEPDIR)/xingheader.Plo +#>+ 9 +@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@DEP_FILES = $(DEPDIR)/libmpeg_la.all_cpp.P ./$(DEPDIR)/mpegfile.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@ @AMDEP_TRUE@ ./$(DEPDIR)/mpegheader.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@ @AMDEP_TRUE@ ./$(DEPDIR)/mpegproperties.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@ @AMDEP_TRUE@ ./$(DEPDIR)/xingheader.Plo +@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@DEP_FILES = ./$(DEPDIR)/mpegfile.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@ @AMDEP_TRUE@ ./$(DEPDIR)/mpegheader.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@ @AMDEP_TRUE@ ./$(DEPDIR)/mpegproperties.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@ @AMDEP_TRUE@ ./$(DEPDIR)/xingheader.Plo + +#>- CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ +#>- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +#>+ 2 +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(KDE_CXXFLAGS) +#>- LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) \ +#>- $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ +#>- $(AM_CXXFLAGS) $(CXXFLAGS) +#>+ 3 +LTCXXCOMPILE = $(LIBTOOL) --mode=compile --tag=CXX $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) $(KDE_CXXFLAGS) +CXXLD = $(CXX) +#>- CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \ +#>- $(AM_LDFLAGS) $(LDFLAGS) -o $@ +#>+ 2 +CXXLINK = $(LIBTOOL) --mode=link --tag=CXX $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(KDE_CXXFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +DIST_SOURCES = $(libmpeg_la_SOURCES) +HEADERS = $(taglib_include_HEADERS) + + +RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \ + ps-recursive install-info-recursive uninstall-info-recursive \ + all-recursive install-data-recursive install-exec-recursive \ + installdirs-recursive install-recursive uninstall-recursive \ + check-recursive installcheck-recursive +DIST_COMMON = $(taglib_include_HEADERS) Makefile.am Makefile.in +DIST_SUBDIRS = $(SUBDIRS) +SOURCES = $(libmpeg_la_SOURCES) + +#>- all: all-recursive +#>+ 1 +all: docs-am all-recursive + +.SUFFIXES: +.SUFFIXES: .cpp .lo .o .obj +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) +#>- cd $(top_srcdir) && \ +#>- $(AUTOMAKE) --gnu taglib/mpeg/Makefile +#>+ 3 + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu taglib/mpeg/Makefile + cd $(top_srcdir) && perl admin/am_edit taglib/mpeg/Makefile.in +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" = "$$p" && dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libmpeg.la: $(libmpeg_la_OBJECTS) $(libmpeg_la_DEPENDENCIES) + $(CXXLINK) $(libmpeg_la_LDFLAGS) $(libmpeg_la_OBJECTS) $(libmpeg_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) core *.core + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpegfile.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpegheader.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpegproperties.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xingheader.Plo@am__quote@ + +distclean-depend: + -rm -rf ./$(DEPDIR) + +.cpp.o: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + +.cpp.obj: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` + +.cpp.lo: +@am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: +taglib_includeHEADERS_INSTALL = $(INSTALL_HEADER) +install-taglib_includeHEADERS: $(taglib_include_HEADERS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(taglib_includedir) + @list='$(taglib_include_HEADERS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(taglib_includeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(taglib_includedir)/$$f"; \ + $(taglib_includeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(taglib_includedir)/$$f; \ + done + +uninstall-taglib_includeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(taglib_include_HEADERS)'; for p in $$list; do \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " rm -f $(DESTDIR)$(taglib_includedir)/$$f"; \ + rm -f $(DESTDIR)$(taglib_includedir)/$$f; \ + done + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ETAGS = etags +ETAGSFLAGS = + +CTAGS = ctags +CTAGSFLAGS = + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if (etags --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + else \ + include_option=--include; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -f $$subdir/TAGS && \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique + +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = ../.. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d $(distdir)/$$subdir \ + || mkdir $(distdir)/$$subdir \ + || exit 1; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" \ + distdir=../$(distdir)/$$subdir \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile $(LTLIBRARIES) $(HEADERS) +installdirs: installdirs-recursive +installdirs-am: + $(mkinstalldirs) $(DESTDIR)$(taglib_includedir) + +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +#>- clean: clean-recursive +#>+ 1 +clean: kde-rpo-clean clean-recursive + +#>- clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ +#>- mostlyclean-am +#>+ 2 +clean-am: clean-final clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-recursive + +distclean-am: clean-am distclean-compile distclean-depend \ + distclean-generic distclean-libtool distclean-tags + +dvi: dvi-recursive + +dvi-am: + +info: info-recursive + +info-am: + +install-data-am: install-taglib_includeHEADERS + +install-exec-am: + +install-info: install-info-recursive + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-info-am uninstall-taglib_includeHEADERS + +uninstall-info: uninstall-info-recursive + +.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \ + clean-generic clean-libtool clean-noinstLTLIBRARIES \ + clean-recursive ctags ctags-recursive distclean \ + distclean-compile distclean-depend distclean-generic \ + distclean-libtool distclean-recursive distclean-tags distdir \ + dvi dvi-am dvi-recursive info info-am info-recursive install \ + install-am install-data install-data-am install-data-recursive \ + install-exec install-exec-am install-exec-recursive \ + install-info install-info-am install-info-recursive install-man \ + install-recursive install-strip install-taglib_includeHEADERS \ + installcheck installcheck-am installdirs installdirs-am \ + installdirs-recursive maintainer-clean maintainer-clean-generic \ + maintainer-clean-recursive mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool mostlyclean-recursive \ + pdf pdf-am pdf-recursive ps ps-am ps-recursive tags \ + tags-recursive uninstall uninstall-am uninstall-info-am \ + uninstall-info-recursive uninstall-recursive \ + uninstall-taglib_includeHEADERS + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: + +#>+ 2 +docs-am: + +#>+ 6 +force-reedit: + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu taglib/mpeg/Makefile + cd $(top_srcdir) && perl admin/am_edit taglib/mpeg/Makefile.in + + +#>+ 11 +libmpeg_la.all_cpp.cpp: $(srcdir)/Makefile.in $(srcdir)/mpegfile.cpp $(srcdir)/mpegproperties.cpp $(srcdir)/mpegheader.cpp $(srcdir)/xingheader.cpp + @echo 'creating libmpeg_la.all_cpp.cpp ...'; \ + rm -f libmpeg_la.all_cpp.files libmpeg_la.all_cpp.final; \ + echo "#define KDE_USE_FINAL 1" >> libmpeg_la.all_cpp.final; \ + for file in mpegfile.cpp mpegproperties.cpp mpegheader.cpp xingheader.cpp ; do \ + echo "#include \"$$file\"" >> libmpeg_la.all_cpp.files; \ + test ! -f $(srcdir)/$$file || egrep '^#pragma +implementation' $(srcdir)/$$file >> libmpeg_la.all_cpp.final; \ + done; \ + cat libmpeg_la.all_cpp.final libmpeg_la.all_cpp.files > libmpeg_la.all_cpp.cpp; \ + rm -f libmpeg_la.all_cpp.final libmpeg_la.all_cpp.files + +#>+ 3 +clean-final: + -rm -f libmpeg_la.all_cpp.cpp + +#>+ 2 +final: + $(MAKE) libmpeg_la_OBJECTS="$(libmpeg_la_final_OBJECTS)" all-am +#>+ 2 +final-install: + $(MAKE) libmpeg_la_OBJECTS="$(libmpeg_la_final_OBJECTS)" install-am +#>+ 2 +no-final: + $(MAKE) libmpeg_la_OBJECTS="$(libmpeg_la_nofinal_OBJECTS)" all-am +#>+ 2 +no-final-install: + $(MAKE) libmpeg_la_OBJECTS="$(libmpeg_la_nofinal_OBJECTS)" install-am +#>+ 3 +cvs-clean: + $(MAKE) admindir=$(top_srcdir)/admin -f $(top_srcdir)/admin/Makefile.common cvs-clean + +#>+ 3 +kde-rpo-clean: + -rm -f *.rpo diff --git a/Libraries/TagLib/Files/taglib/mpeg/id3v1/Makefile.am b/Libraries/TagLib/Files/taglib/mpeg/id3v1/Makefile.am new file mode 100644 index 000000000..ae0b590a1 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/mpeg/id3v1/Makefile.am @@ -0,0 +1,14 @@ +INCLUDES = \ + -I$(top_srcdir)/taglib \ + -I$(top_srcdir)/taglib/toolkit \ + -I$(top_srcdir)/taglib/mpeg \ + $(all_includes) + +noinst_LTLIBRARIES = libid3v1.la + +libid3v1_la_SOURCES = id3v1tag.cpp id3v1genres.cpp + +taglib_include_HEADERS = id3v1tag.h id3v1genres.h +taglib_includedir = $(includedir)/taglib + +EXTRA_DIST = $(libid3v1_la_SOURCES) $(taglib_include_HEADERS) diff --git a/Libraries/TagLib/Files/taglib/mpeg/id3v1/Makefile.in b/Libraries/TagLib/Files/taglib/mpeg/id3v1/Makefile.in new file mode 100644 index 000000000..9d51ea92d --- /dev/null +++ b/Libraries/TagLib/Files/taglib/mpeg/id3v1/Makefile.in @@ -0,0 +1,548 @@ +# Makefile.in generated by automake 1.7.6 from Makefile.am. +# KDE tags expanded automatically by am_edit - $Revision$ +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../../.. + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTODIRS = @AUTODIRS@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CONF_FILES = @CONF_FILES@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +KDE_PLUGIN = @KDE_PLUGIN@ +KDE_USE_CLOSURE_FALSE = @KDE_USE_CLOSURE_FALSE@ +KDE_USE_CLOSURE_TRUE = @KDE_USE_CLOSURE_TRUE@ +KDE_USE_FINAL_FALSE = @KDE_USE_FINAL_FALSE@ +KDE_USE_FINAL_TRUE = @KDE_USE_FINAL_TRUE@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +NOOPT_CFLAGS = @NOOPT_CFLAGS@ +NOOPT_CXXFLAGS = @NOOPT_CXXFLAGS@ +NOREPO = @NOREPO@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +REPO = @REPO@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +TOPSUBDIRS = @TOPSUBDIRS@ +USE_EXCEPTIONS = @USE_EXCEPTIONS@ +USE_RTTI = @USE_RTTI@ +VERSION = @VERSION@ +WOVERLOADED_VIRTUAL = @WOVERLOADED_VIRTUAL@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +all_includes = @all_includes@ +all_libraries = @all_libraries@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +link_zlib_FALSE = @link_zlib_FALSE@ +link_zlib_TRUE = @link_zlib_TRUE@ +localstatedir = @localstatedir@ +mandir = @mandir@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +INCLUDES = \ + -I$(top_srcdir)/taglib \ + -I$(top_srcdir)/taglib/toolkit \ + -I$(top_srcdir)/taglib/mpeg \ + $(all_includes) + + +noinst_LTLIBRARIES = libid3v1.la + +libid3v1_la_SOURCES = id3v1tag.cpp id3v1genres.cpp + +taglib_include_HEADERS = id3v1tag.h id3v1genres.h +taglib_includedir = $(includedir)/taglib + +EXTRA_DIST = $(libid3v1_la_SOURCES) $(taglib_include_HEADERS) +subdir = taglib/mpeg/id3v1 +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/admin/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) + +libid3v1_la_LDFLAGS = +libid3v1_la_LIBADD = +am_libid3v1_la_OBJECTS = id3v1tag.lo id3v1genres.lo +#>- libid3v1_la_OBJECTS = $(am_libid3v1_la_OBJECTS) +#>+ 4 +libid3v1_la_final_OBJECTS = libid3v1_la.all_cpp.lo +libid3v1_la_nofinal_OBJECTS = id3v1tag.lo id3v1genres.lo +@KDE_USE_FINAL_FALSE@libid3v1_la_OBJECTS = $(libid3v1_la_nofinal_OBJECTS) +@KDE_USE_FINAL_TRUE@libid3v1_la_OBJECTS = $(libid3v1_la_final_OBJECTS) + +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/admin/depcomp +am__depfiles_maybe = depfiles +#>- @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/id3v1genres.Plo \ +#>- @AMDEP_TRUE@ ./$(DEPDIR)/id3v1tag.Plo +#>+ 5 +@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@DEP_FILES = $(DEPDIR)/libid3v1_la.all_cpp.P ./$(DEPDIR)/id3v1genres.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@ @AMDEP_TRUE@ ./$(DEPDIR)/id3v1tag.Plo +@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@DEP_FILES = ./$(DEPDIR)/id3v1genres.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@ @AMDEP_TRUE@ ./$(DEPDIR)/id3v1tag.Plo + +#>- CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ +#>- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +#>+ 2 +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(KDE_CXXFLAGS) +#>- LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) \ +#>- $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ +#>- $(AM_CXXFLAGS) $(CXXFLAGS) +#>+ 3 +LTCXXCOMPILE = $(LIBTOOL) --mode=compile --tag=CXX $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) $(KDE_CXXFLAGS) +CXXLD = $(CXX) +#>- CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \ +#>- $(AM_LDFLAGS) $(LDFLAGS) -o $@ +#>+ 2 +CXXLINK = $(LIBTOOL) --mode=link --tag=CXX $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(KDE_CXXFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +DIST_SOURCES = $(libid3v1_la_SOURCES) +HEADERS = $(taglib_include_HEADERS) + +DIST_COMMON = $(taglib_include_HEADERS) Makefile.am Makefile.in +SOURCES = $(libid3v1_la_SOURCES) + +#>- all: all-am +#>+ 1 +all: docs-am all-am + +.SUFFIXES: +.SUFFIXES: .cpp .lo .o .obj +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) +#>- cd $(top_srcdir) && \ +#>- $(AUTOMAKE) --gnu taglib/mpeg/id3v1/Makefile +#>+ 3 + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu taglib/mpeg/id3v1/Makefile + cd $(top_srcdir) && perl admin/am_edit taglib/mpeg/id3v1/Makefile.in +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" = "$$p" && dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libid3v1.la: $(libid3v1_la_OBJECTS) $(libid3v1_la_DEPENDENCIES) + $(CXXLINK) $(libid3v1_la_LDFLAGS) $(libid3v1_la_OBJECTS) $(libid3v1_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) core *.core + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/id3v1genres.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/id3v1tag.Plo@am__quote@ + +distclean-depend: + -rm -rf ./$(DEPDIR) + +.cpp.o: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + +.cpp.obj: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` + +.cpp.lo: +@am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: +taglib_includeHEADERS_INSTALL = $(INSTALL_HEADER) +install-taglib_includeHEADERS: $(taglib_include_HEADERS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(taglib_includedir) + @list='$(taglib_include_HEADERS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(taglib_includeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(taglib_includedir)/$$f"; \ + $(taglib_includeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(taglib_includedir)/$$f; \ + done + +uninstall-taglib_includeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(taglib_include_HEADERS)'; for p in $$list; do \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " rm -f $(DESTDIR)$(taglib_includedir)/$$f"; \ + rm -f $(DESTDIR)$(taglib_includedir)/$$f; \ + done + +ETAGS = etags +ETAGSFLAGS = + +CTAGS = ctags +CTAGSFLAGS = + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique + +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = ../../.. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) + +installdirs: + $(mkinstalldirs) $(DESTDIR)$(taglib_includedir) +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +#>- clean: clean-am +#>+ 1 +clean: kde-rpo-clean clean-am + +#>- clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ +#>- mostlyclean-am +#>+ 2 +clean-am: clean-final clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + +distclean-am: clean-am distclean-compile distclean-depend \ + distclean-generic distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: install-taglib_includeHEADERS + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am uninstall-taglib_includeHEADERS + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstLTLIBRARIES ctags distclean \ + distclean-compile distclean-depend distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am info \ + info-am install install-am install-data install-data-am \ + install-exec install-exec-am install-info install-info-am \ + install-man install-strip install-taglib_includeHEADERS \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-info-am \ + uninstall-taglib_includeHEADERS + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: + +#>+ 2 +docs-am: + +#>+ 6 +force-reedit: + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu taglib/mpeg/id3v1/Makefile + cd $(top_srcdir) && perl admin/am_edit taglib/mpeg/id3v1/Makefile.in + + +#>+ 11 +libid3v1_la.all_cpp.cpp: $(srcdir)/Makefile.in $(srcdir)/id3v1tag.cpp $(srcdir)/id3v1genres.cpp + @echo 'creating libid3v1_la.all_cpp.cpp ...'; \ + rm -f libid3v1_la.all_cpp.files libid3v1_la.all_cpp.final; \ + echo "#define KDE_USE_FINAL 1" >> libid3v1_la.all_cpp.final; \ + for file in id3v1tag.cpp id3v1genres.cpp ; do \ + echo "#include \"$$file\"" >> libid3v1_la.all_cpp.files; \ + test ! -f $(srcdir)/$$file || egrep '^#pragma +implementation' $(srcdir)/$$file >> libid3v1_la.all_cpp.final; \ + done; \ + cat libid3v1_la.all_cpp.final libid3v1_la.all_cpp.files > libid3v1_la.all_cpp.cpp; \ + rm -f libid3v1_la.all_cpp.final libid3v1_la.all_cpp.files + +#>+ 3 +clean-final: + -rm -f libid3v1_la.all_cpp.cpp + +#>+ 2 +final: + $(MAKE) libid3v1_la_OBJECTS="$(libid3v1_la_final_OBJECTS)" all-am +#>+ 2 +final-install: + $(MAKE) libid3v1_la_OBJECTS="$(libid3v1_la_final_OBJECTS)" install-am +#>+ 2 +no-final: + $(MAKE) libid3v1_la_OBJECTS="$(libid3v1_la_nofinal_OBJECTS)" all-am +#>+ 2 +no-final-install: + $(MAKE) libid3v1_la_OBJECTS="$(libid3v1_la_nofinal_OBJECTS)" install-am +#>+ 3 +cvs-clean: + $(MAKE) admindir=$(top_srcdir)/admin -f $(top_srcdir)/admin/Makefile.common cvs-clean + +#>+ 3 +kde-rpo-clean: + -rm -f *.rpo diff --git a/Libraries/TagLib/Files/taglib/mpeg/id3v1/id3v1genres.cpp b/Libraries/TagLib/Files/taglib/mpeg/id3v1/id3v1genres.cpp new file mode 100644 index 000000000..0f4fd4382 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/mpeg/id3v1/id3v1genres.cpp @@ -0,0 +1,215 @@ +/*************************************************************************** + copyright : (C) 2002 by Scott Wheeler + email : wheeler@kde.org +***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#include "id3v1genres.h" + +using namespace TagLib; + +namespace TagLib { + namespace ID3v1 { + + static const int genresSize = 148; + static const String genres[] = { + "Blues", + "Classic Rock", + "Country", + "Dance", + "Disco", + "Funk", + "Grunge", + "Hip-Hop", + "Jazz", + "Metal", + "New Age", + "Oldies", + "Other", + "Pop", + "R&B", + "Rap", + "Reggae", + "Rock", + "Techno", + "Industrial", + "Alternative", + "Ska", + "Death Metal", + "Pranks", + "Soundtrack", + "Euro-Techno", + "Ambient", + "Trip-Hop", + "Vocal", + "Jazz+Funk", + "Fusion", + "Trance", + "Classical", + "Instrumental", + "Acid", + "House", + "Game", + "Sound Clip", + "Gospel", + "Noise", + "Alternative Rock", + "Bass", + "Soul", + "Punk", + "Space", + "Meditative", + "Instrumental Pop", + "Instrumental Rock", + "Ethnic", + "Gothic", + "Darkwave", + "Techno-Industrial", + "Electronic", + "Pop-Folk", + "Eurodance", + "Dream", + "Southern Rock", + "Comedy", + "Cult", + "Gangsta", + "Top 40", + "Christian Rap", + "Pop/Funk", + "Jungle", + "Native American", + "Cabaret", + "New Wave", + "Psychedelic", + "Rave", + "Showtunes", + "Trailer", + "Lo-Fi", + "Tribal", + "Acid Punk", + "Acid Jazz", + "Polka", + "Retro", + "Musical", + "Rock & Roll", + "Hard Rock", + "Folk", + "Folk/Rock", + "National Folk", + "Swing", + "Fusion", + "Bebob", + "Latin", + "Revival", + "Celtic", + "Bluegrass", + "Avantgarde", + "Gothic Rock", + "Progressive Rock", + "Psychedelic Rock", + "Symphonic Rock", + "Slow Rock", + "Big Band", + "Chorus", + "Easy Listening", + "Acoustic", + "Humour", + "Speech", + "Chanson", + "Opera", + "Chamber Music", + "Sonata", + "Symphony", + "Booty Bass", + "Primus", + "Porn Groove", + "Satire", + "Slow Jam", + "Club", + "Tango", + "Samba", + "Folklore", + "Ballad", + "Power Ballad", + "Rhythmic Soul", + "Freestyle", + "Duet", + "Punk Rock", + "Drum Solo", + "A Capella", + "Euro-House", + "Dance Hall", + "Goa", + "Drum & Bass", + "Club-House", + "Hardcore", + "Terror", + "Indie", + "BritPop", + "Negerpunk", + "Polsk Punk", + "Beat", + "Christian Gangsta Rap", + "Heavy Metal", + "Black Metal", + "Crossover", + "Contemporary Christian", + "Christian Rock", + "Merengue", + "Salsa", + "Thrash Metal", + "Anime", + "Jpop", + "Synthpop" + }; + } +} + +StringList ID3v1::genreList() +{ + static StringList l; + if(l.isEmpty()) { + for(int i = 0; i < genresSize; i++) + l.append(genres[i]); + } + return l; +} + +ID3v1::GenreMap ID3v1::genreMap() +{ + static GenreMap m; + if(m.isEmpty()) { + for(int i = 0; i < genresSize; i++) + m.insert(genres[i], i); + } + return m; +} + +String ID3v1::genre(int i) +{ + if(i >= 0 && i < genresSize) + return genres[i]; + return String::null; +} + +int ID3v1::genreIndex(const String &name) +{ + if(genreMap().contains(name)) + return genreMap()[name]; + return 255; +} diff --git a/Libraries/TagLib/Files/taglib/mpeg/id3v1/id3v1genres.h b/Libraries/TagLib/Files/taglib/mpeg/id3v1/id3v1genres.h new file mode 100644 index 000000000..97caee8ac --- /dev/null +++ b/Libraries/TagLib/Files/taglib/mpeg/id3v1/id3v1genres.h @@ -0,0 +1,61 @@ +/*************************************************************************** + copyright : (C) 2003 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#ifndef TAGLIB_ID3V1GENRE_H +#define TAGLIB_ID3V1GENRE_H + +#include +#include + +namespace TagLib { + namespace ID3v1 { + + typedef Map GenreMap; + + /*! + * Returns the list of canonical ID3v1 genre names in the order that they + * are listed in the standard. + */ + StringList genreList(); + + /*! + * A "reverse mapping" that goes from the canonical ID3v1 genre name to the + * respective genre number. genreMap()["Rock"] == + */ + GenreMap genreMap(); + + /*! + * Returns the name of the genre at \a index in the ID3v1 genre list. If + * \a index is out of range -- less than zero or greater than 146 -- a null + * string will be returned. + */ + String genre(int index); + + /*! + * Returns the genre index for the (case sensitive) genre \a name. If the + * genre is not in the list 255 (which signifies an unknown genre in ID3v1) + * will be returned. + */ + int genreIndex(const String &name); + } +} + +#endif diff --git a/Libraries/TagLib/Files/taglib/mpeg/id3v1/id3v1tag.cpp b/Libraries/TagLib/Files/taglib/mpeg/id3v1/id3v1tag.cpp new file mode 100644 index 000000000..624f56b89 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/mpeg/id3v1/id3v1tag.cpp @@ -0,0 +1,239 @@ +/*************************************************************************** + copyright : (C) 2002, 2003 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#include +#include + +#include "id3v1tag.h" +#include "id3v1genres.h" + +using namespace TagLib; +using namespace ID3v1; + +class ID3v1::Tag::TagPrivate +{ +public: + TagPrivate() : file(0), tagOffset(-1), track(0), genre(255) {} + + File *file; + long tagOffset; + + String title; + String artist; + String album; + String year; + String comment; + uchar track; + uchar genre; + + static const StringHandler *stringHandler; +}; + +const ID3v1::StringHandler *ID3v1::Tag::TagPrivate::stringHandler = new StringHandler; + +//////////////////////////////////////////////////////////////////////////////// +// StringHandler implementation +//////////////////////////////////////////////////////////////////////////////// + +String ID3v1::StringHandler::parse(const ByteVector &data) const +{ + return String(data, String::Latin1); +} + +ByteVector ID3v1::StringHandler::render(const String &s) const +{ + return s.data(String::Latin1); +} + +//////////////////////////////////////////////////////////////////////////////// +// public methods +//////////////////////////////////////////////////////////////////////////////// + +ID3v1::Tag::Tag() : TagLib::Tag() +{ + d = new TagPrivate; +} + +ID3v1::Tag::Tag(File *file, long tagOffset) : TagLib::Tag() +{ + d = new TagPrivate; + d->file = file; + d->tagOffset = tagOffset; + + read(); +} + +ID3v1::Tag::~Tag() +{ + delete d; +} + +ByteVector ID3v1::Tag::render() const +{ + ByteVector data; + + data.append(fileIdentifier()); + data.append(TagPrivate::stringHandler->render(d->title).resize(30)); + data.append(TagPrivate::stringHandler->render(d->artist).resize(30)); + data.append(TagPrivate::stringHandler->render(d->album).resize(30)); + data.append(TagPrivate::stringHandler->render(d->year).resize(4)); + data.append(TagPrivate::stringHandler->render(d->comment).resize(28)); + data.append(char(0)); + data.append(char(d->track)); + data.append(char(d->genre)); + + return data; +} + +ByteVector ID3v1::Tag::fileIdentifier() +{ + return ByteVector::fromCString("TAG"); +} + +String ID3v1::Tag::title() const +{ + return d->title; +} + +String ID3v1::Tag::artist() const +{ + return d->artist; +} + +String ID3v1::Tag::album() const +{ + return d->album; +} + +String ID3v1::Tag::comment() const +{ + return d->comment; +} + +String ID3v1::Tag::genre() const +{ + return ID3v1::genre(d->genre); +} + +TagLib::uint ID3v1::Tag::year() const +{ + return d->year.toInt(); +} + +TagLib::uint ID3v1::Tag::track() const +{ + return d->track; +} + +void ID3v1::Tag::setTitle(const String &s) +{ + d->title = s; +} + +void ID3v1::Tag::setArtist(const String &s) +{ + d->artist = s; +} + +void ID3v1::Tag::setAlbum(const String &s) +{ + d->album = s; +} + +void ID3v1::Tag::setComment(const String &s) +{ + d->comment = s; +} + +void ID3v1::Tag::setGenre(const String &s) +{ + d->genre = ID3v1::genreIndex(s); +} + +void ID3v1::Tag::setYear(uint i) +{ + d->year = String::number(i); +} + +void ID3v1::Tag::setTrack(uint i) +{ + d->track = i < 256 ? i : 0; +} + +void ID3v1::Tag::setStringHandler(const StringHandler *handler) +{ + delete TagPrivate::stringHandler; + TagPrivate::stringHandler = handler; +} + +//////////////////////////////////////////////////////////////////////////////// +// protected methods +//////////////////////////////////////////////////////////////////////////////// + +void ID3v1::Tag::read() +{ + if(d->file && d->file->isValid()) { + d->file->seek(d->tagOffset); + // read the tag -- always 128 bytes + ByteVector data = d->file->readBlock(128); + + // some initial sanity checking + if(data.size() == 128 && data.mid(0, 3) == "TAG") + parse(data); + else + debug("ID3v1 tag is not valid or could not be read at the specified offset."); + } +} + +void ID3v1::Tag::parse(const ByteVector &data) +{ + int offset = 3; + + d->title = TagPrivate::stringHandler->parse(data.mid(offset, 30)); + offset += 30; + + d->artist = TagPrivate::stringHandler->parse(data.mid(offset, 30)); + offset += 30; + + d->album = TagPrivate::stringHandler->parse(data.mid(offset, 30)); + offset += 30; + + d->year = TagPrivate::stringHandler->parse(data.mid(offset, 4)); + offset += 4; + + // Check for ID3v1.1 -- Note that ID3v1 *does not* support "track zero" -- this + // is not a bug in TagLib. Since a zeroed byte is what we would expect to + // indicate the end of a C-String, specifically the comment string, a value of + // zero must be assumed to be just that. + + if(data[offset + 28] == 0 && data[offset + 29] != 0) { + // ID3v1.1 detected + + d->comment = TagPrivate::stringHandler->parse(data.mid(offset, 28)); + d->track = uchar(data[offset + 29]); + } + else + d->comment = data.mid(offset, 30); + + offset += 30; + + d->genre = uchar(data[offset]); +} diff --git a/Libraries/TagLib/Files/taglib/mpeg/id3v1/id3v1tag.h b/Libraries/TagLib/Files/taglib/mpeg/id3v1/id3v1tag.h new file mode 100644 index 000000000..37b7c5a09 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/mpeg/id3v1/id3v1tag.h @@ -0,0 +1,172 @@ +/*************************************************************************** + copyright : (C) 2002, 2003 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#ifndef TAGLIB_ID3V1TAG_H +#define TAGLIB_ID3V1TAG_H + +#include +#include + +namespace TagLib { + + class File; + + //! An ID3v1 implementation + + namespace ID3v1 { + + //! A abstraction for the string to data encoding in ID3v1 tags. + + /*! + * ID3v1 should in theory always contain ISO-8859-1 (Latin1) data. In + * practice it does not. TagLib by default only supports ISO-8859-1 data + * in ID3v1 tags. + * + * However by subclassing this class and reimplementing parse() and render() + * and setting your reimplementation as the default with + * ID3v1::Tag::setStringHandler() you can define how you would like these + * transformations to be done. + * + * \warning It is advisable not to write non-ISO-8859-1 data to ID3v1 + * tags. Please consider disabling the writing of ID3v1 tags in the case + * that the data is ISO-8859-1. + * + * \see ID3v1::Tag::setStringHandler() + */ + + class StringHandler + { + public: + /*! + * Decode a string from \a data. The default implementation assumes that + * \a data is an ISO-8859-1 (Latin1) character array. + */ + virtual String parse(const ByteVector &data) const; + + /*! + * Encode a ByteVector with the data from \a s. The default implementation + * assumes that \a s is an ISO-8859-1 (Latin1) string. + * + * \warning It is recommended that you not override this method, but + * instead do not write an ID3v1 tag in the case that the data is not + * ISO-8859-1. + */ + virtual ByteVector render(const String &s) const; + }; + + //! The main class in the ID3v1 implementation + + /*! + * This is an implementation of the ID3v1 format. ID3v1 is both the simplist + * and most common of tag formats but is rather limited. Because of its + * pervasiveness and the way that applications have been written around the + * fields that it provides, the generic TagLib::Tag API is a mirror of what is + * provided by ID3v1. + * + * ID3v1 tags should generally only contain Latin1 information. However because + * many applications do not follow this rule there is now support for overriding + * the ID3v1 string handling using the ID3v1::StringHandler class. Please see + * the documentation for that class for more information. + * + * \see StringHandler + * + * \note Most fields are truncated to a maximum of 28-30 bytes. The + * truncation happens automatically when the tag is rendered. + */ + + class Tag : public TagLib::Tag + { + public: + /*! + * Create an ID3v1 tag with default values. + */ + Tag(); + + /*! + * Create an ID3v1 tag and parse the data in \a file starting at + * \a tagOffset. + */ + Tag(File *file, long tagOffset); + + /*! + * Destroys this Tag instance. + */ + virtual ~Tag(); + + /*! + * Renders the in memory values to a ByteVector suitable for writing to + * the file. + */ + ByteVector render() const; + + /*! + * Returns the string "TAG" suitable for usage in locating the tag in a + * file. + */ + static ByteVector fileIdentifier(); + + // Reimplementations. + + virtual String title() const; + virtual String artist() const; + virtual String album() const; + virtual String comment() const; + virtual String genre() const; + virtual uint year() const; + virtual uint track() const; + + virtual void setTitle(const String &s); + virtual void setArtist(const String &s); + virtual void setAlbum(const String &s); + virtual void setComment(const String &s); + virtual void setGenre(const String &s); + virtual void setYear(uint i); + virtual void setTrack(uint i); + + /*! + * Sets the string handler that decides how the ID3v1 data will be + * converted to and from binary data. + * + * \see StringHandler + */ + static void setStringHandler(const StringHandler *handler); + + protected: + /*! + * Reads from the file specified in the constructor. + */ + void read(); + /*! + * Pareses the body of the tag in \a data. + */ + void parse(const ByteVector &data); + + private: + Tag(const Tag &); + Tag &operator=(const Tag &); + + class TagPrivate; + TagPrivate *d; + }; + } +} + +#endif diff --git a/Libraries/TagLib/Files/taglib/mpeg/id3v2/Makefile.am b/Libraries/TagLib/Files/taglib/mpeg/id3v2/Makefile.am new file mode 100644 index 000000000..a58c83e95 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/mpeg/id3v2/Makefile.am @@ -0,0 +1,28 @@ +SUBDIRS = frames +INCLUDES = \ + -I$(top_srcdir)/taglib \ + -I$(top_srcdir)/taglib/toolkit \ + -I$(top_srcdir)/taglib/mpeg \ + -I$(top_srcdir)/taglib/mpeg/id3v1 \ + $(all_includes) + +noinst_LTLIBRARIES = libid3v2.la + +libid3v2_la_SOURCES = \ + id3v2framefactory.cpp id3v2synchdata.cpp id3v2tag.cpp \ + id3v2header.cpp id3v2frame.cpp id3v2footer.cpp \ + id3v2extendedheader.cpp + +taglib_include_HEADERS = \ + id3v2extendedheader.h id3v2frame.h id3v2header.h \ + id3v2synchdata.h id3v2footer.h id3v2framefactory.h id3v2tag.h + +taglib_includedir = $(includedir)/taglib + +if link_zlib +zlib = -lz +endif + +libid3v2_la_LIBADD = ./frames/libframes.la $(zlib) + +EXTRA_DIST = $(libid3v2_la_SOURCES) $(taglib_include_HEADERS) id3v2.4.0-frames.txt id3v2.4.0-structure.txt diff --git a/Libraries/TagLib/Files/taglib/mpeg/id3v2/Makefile.in b/Libraries/TagLib/Files/taglib/mpeg/id3v2/Makefile.in new file mode 100644 index 000000000..12b17c0d1 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/mpeg/id3v2/Makefile.in @@ -0,0 +1,686 @@ +# Makefile.in generated by automake 1.7.6 from Makefile.am. +# KDE tags expanded automatically by am_edit - $Revision$ +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../../.. + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTODIRS = @AUTODIRS@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CONF_FILES = @CONF_FILES@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +KDE_PLUGIN = @KDE_PLUGIN@ +KDE_USE_CLOSURE_FALSE = @KDE_USE_CLOSURE_FALSE@ +KDE_USE_CLOSURE_TRUE = @KDE_USE_CLOSURE_TRUE@ +KDE_USE_FINAL_FALSE = @KDE_USE_FINAL_FALSE@ +KDE_USE_FINAL_TRUE = @KDE_USE_FINAL_TRUE@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +NOOPT_CFLAGS = @NOOPT_CFLAGS@ +NOOPT_CXXFLAGS = @NOOPT_CXXFLAGS@ +NOREPO = @NOREPO@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +REPO = @REPO@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +TOPSUBDIRS = @TOPSUBDIRS@ +USE_EXCEPTIONS = @USE_EXCEPTIONS@ +USE_RTTI = @USE_RTTI@ +VERSION = @VERSION@ +WOVERLOADED_VIRTUAL = @WOVERLOADED_VIRTUAL@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +all_includes = @all_includes@ +all_libraries = @all_libraries@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +link_zlib_FALSE = @link_zlib_FALSE@ +link_zlib_TRUE = @link_zlib_TRUE@ +localstatedir = @localstatedir@ +mandir = @mandir@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +SUBDIRS = frames +INCLUDES = \ + -I$(top_srcdir)/taglib \ + -I$(top_srcdir)/taglib/toolkit \ + -I$(top_srcdir)/taglib/mpeg \ + -I$(top_srcdir)/taglib/mpeg/id3v1 \ + $(all_includes) + + +noinst_LTLIBRARIES = libid3v2.la + +libid3v2_la_SOURCES = \ + id3v2framefactory.cpp id3v2synchdata.cpp id3v2tag.cpp \ + id3v2header.cpp id3v2frame.cpp id3v2footer.cpp \ + id3v2extendedheader.cpp + + +taglib_include_HEADERS = \ + id3v2extendedheader.h id3v2frame.h id3v2header.h \ + id3v2synchdata.h id3v2footer.h id3v2framefactory.h id3v2tag.h + + +taglib_includedir = $(includedir)/taglib + +@link_zlib_TRUE@zlib = -lz + +libid3v2_la_LIBADD = ./frames/libframes.la $(zlib) + +EXTRA_DIST = $(libid3v2_la_SOURCES) $(taglib_include_HEADERS) id3v2.4.0-frames.txt id3v2.4.0-structure.txt +subdir = taglib/mpeg/id3v2 +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/admin/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) + +libid3v2_la_LDFLAGS = +@link_zlib_TRUE@libid3v2_la_DEPENDENCIES = ./frames/libframes.la +@link_zlib_FALSE@libid3v2_la_DEPENDENCIES = ./frames/libframes.la +am_libid3v2_la_OBJECTS = id3v2framefactory.lo id3v2synchdata.lo \ + id3v2tag.lo id3v2header.lo id3v2frame.lo id3v2footer.lo \ + id3v2extendedheader.lo +#>- libid3v2_la_OBJECTS = $(am_libid3v2_la_OBJECTS) +#>+ 6 +libid3v2_la_final_OBJECTS = libid3v2_la.all_cpp.lo +libid3v2_la_nofinal_OBJECTS = id3v2framefactory.lo id3v2synchdata.lo \ + id3v2tag.lo id3v2header.lo id3v2frame.lo id3v2footer.lo \ + id3v2extendedheader.lo +@KDE_USE_FINAL_FALSE@libid3v2_la_OBJECTS = $(libid3v2_la_nofinal_OBJECTS) +@KDE_USE_FINAL_TRUE@libid3v2_la_OBJECTS = $(libid3v2_la_final_OBJECTS) + +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/admin/depcomp +am__depfiles_maybe = depfiles +#>- @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/id3v2extendedheader.Plo \ +#>- @AMDEP_TRUE@ ./$(DEPDIR)/id3v2footer.Plo \ +#>- @AMDEP_TRUE@ ./$(DEPDIR)/id3v2frame.Plo \ +#>- @AMDEP_TRUE@ ./$(DEPDIR)/id3v2framefactory.Plo \ +#>- @AMDEP_TRUE@ ./$(DEPDIR)/id3v2header.Plo \ +#>- @AMDEP_TRUE@ ./$(DEPDIR)/id3v2synchdata.Plo \ +#>- @AMDEP_TRUE@ ./$(DEPDIR)/id3v2tag.Plo +#>+ 15 +@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@DEP_FILES = $(DEPDIR)/libid3v2_la.all_cpp.P ./$(DEPDIR)/id3v2extendedheader.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@ @AMDEP_TRUE@ ./$(DEPDIR)/id3v2footer.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@ @AMDEP_TRUE@ ./$(DEPDIR)/id3v2frame.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@ @AMDEP_TRUE@ ./$(DEPDIR)/id3v2framefactory.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@ @AMDEP_TRUE@ ./$(DEPDIR)/id3v2header.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@ @AMDEP_TRUE@ ./$(DEPDIR)/id3v2synchdata.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@ @AMDEP_TRUE@ ./$(DEPDIR)/id3v2tag.Plo +@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@DEP_FILES = ./$(DEPDIR)/id3v2extendedheader.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@ @AMDEP_TRUE@ ./$(DEPDIR)/id3v2footer.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@ @AMDEP_TRUE@ ./$(DEPDIR)/id3v2frame.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@ @AMDEP_TRUE@ ./$(DEPDIR)/id3v2framefactory.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@ @AMDEP_TRUE@ ./$(DEPDIR)/id3v2header.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@ @AMDEP_TRUE@ ./$(DEPDIR)/id3v2synchdata.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@ @AMDEP_TRUE@ ./$(DEPDIR)/id3v2tag.Plo + +#>- CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ +#>- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +#>+ 2 +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(KDE_CXXFLAGS) +#>- LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) \ +#>- $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ +#>- $(AM_CXXFLAGS) $(CXXFLAGS) +#>+ 3 +LTCXXCOMPILE = $(LIBTOOL) --mode=compile --tag=CXX $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) $(KDE_CXXFLAGS) +CXXLD = $(CXX) +#>- CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \ +#>- $(AM_LDFLAGS) $(LDFLAGS) -o $@ +#>+ 2 +CXXLINK = $(LIBTOOL) --mode=link --tag=CXX $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(KDE_CXXFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +DIST_SOURCES = $(libid3v2_la_SOURCES) +HEADERS = $(taglib_include_HEADERS) + + +RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \ + ps-recursive install-info-recursive uninstall-info-recursive \ + all-recursive install-data-recursive install-exec-recursive \ + installdirs-recursive install-recursive uninstall-recursive \ + check-recursive installcheck-recursive +DIST_COMMON = $(taglib_include_HEADERS) Makefile.am Makefile.in +DIST_SUBDIRS = $(SUBDIRS) +SOURCES = $(libid3v2_la_SOURCES) + +#>- all: all-recursive +#>+ 1 +all: docs-am all-recursive + +.SUFFIXES: +.SUFFIXES: .cpp .lo .o .obj +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) +#>- cd $(top_srcdir) && \ +#>- $(AUTOMAKE) --gnu taglib/mpeg/id3v2/Makefile +#>+ 3 + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu taglib/mpeg/id3v2/Makefile + cd $(top_srcdir) && perl admin/am_edit taglib/mpeg/id3v2/Makefile.in +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" = "$$p" && dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libid3v2.la: $(libid3v2_la_OBJECTS) $(libid3v2_la_DEPENDENCIES) + $(CXXLINK) $(libid3v2_la_LDFLAGS) $(libid3v2_la_OBJECTS) $(libid3v2_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) core *.core + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/id3v2extendedheader.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/id3v2footer.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/id3v2frame.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/id3v2framefactory.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/id3v2header.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/id3v2synchdata.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/id3v2tag.Plo@am__quote@ + +distclean-depend: + -rm -rf ./$(DEPDIR) + +.cpp.o: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + +.cpp.obj: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` + +.cpp.lo: +@am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: +taglib_includeHEADERS_INSTALL = $(INSTALL_HEADER) +install-taglib_includeHEADERS: $(taglib_include_HEADERS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(taglib_includedir) + @list='$(taglib_include_HEADERS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(taglib_includeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(taglib_includedir)/$$f"; \ + $(taglib_includeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(taglib_includedir)/$$f; \ + done + +uninstall-taglib_includeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(taglib_include_HEADERS)'; for p in $$list; do \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " rm -f $(DESTDIR)$(taglib_includedir)/$$f"; \ + rm -f $(DESTDIR)$(taglib_includedir)/$$f; \ + done + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ETAGS = etags +ETAGSFLAGS = + +CTAGS = ctags +CTAGSFLAGS = + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if (etags --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + else \ + include_option=--include; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -f $$subdir/TAGS && \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique + +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = ../../.. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d $(distdir)/$$subdir \ + || mkdir $(distdir)/$$subdir \ + || exit 1; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" \ + distdir=../$(distdir)/$$subdir \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile $(LTLIBRARIES) $(HEADERS) +installdirs: installdirs-recursive +installdirs-am: + $(mkinstalldirs) $(DESTDIR)$(taglib_includedir) + +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +#>- clean: clean-recursive +#>+ 1 +clean: kde-rpo-clean clean-recursive + +#>- clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ +#>- mostlyclean-am +#>+ 2 +clean-am: clean-final clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-recursive + +distclean-am: clean-am distclean-compile distclean-depend \ + distclean-generic distclean-libtool distclean-tags + +dvi: dvi-recursive + +dvi-am: + +info: info-recursive + +info-am: + +install-data-am: install-taglib_includeHEADERS + +install-exec-am: + +install-info: install-info-recursive + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-info-am uninstall-taglib_includeHEADERS + +uninstall-info: uninstall-info-recursive + +.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \ + clean-generic clean-libtool clean-noinstLTLIBRARIES \ + clean-recursive ctags ctags-recursive distclean \ + distclean-compile distclean-depend distclean-generic \ + distclean-libtool distclean-recursive distclean-tags distdir \ + dvi dvi-am dvi-recursive info info-am info-recursive install \ + install-am install-data install-data-am install-data-recursive \ + install-exec install-exec-am install-exec-recursive \ + install-info install-info-am install-info-recursive install-man \ + install-recursive install-strip install-taglib_includeHEADERS \ + installcheck installcheck-am installdirs installdirs-am \ + installdirs-recursive maintainer-clean maintainer-clean-generic \ + maintainer-clean-recursive mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool mostlyclean-recursive \ + pdf pdf-am pdf-recursive ps ps-am ps-recursive tags \ + tags-recursive uninstall uninstall-am uninstall-info-am \ + uninstall-info-recursive uninstall-recursive \ + uninstall-taglib_includeHEADERS + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: + +#>+ 2 +docs-am: + +#>+ 6 +force-reedit: + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu taglib/mpeg/id3v2/Makefile + cd $(top_srcdir) && perl admin/am_edit taglib/mpeg/id3v2/Makefile.in + + +#>+ 11 +libid3v2_la.all_cpp.cpp: $(srcdir)/Makefile.in $(srcdir)/id3v2framefactory.cpp $(srcdir)/id3v2synchdata.cpp $(srcdir)/id3v2tag.cpp $(srcdir)/id3v2header.cpp $(srcdir)/id3v2frame.cpp $(srcdir)/id3v2footer.cpp $(srcdir)/id3v2extendedheader.cpp + @echo 'creating libid3v2_la.all_cpp.cpp ...'; \ + rm -f libid3v2_la.all_cpp.files libid3v2_la.all_cpp.final; \ + echo "#define KDE_USE_FINAL 1" >> libid3v2_la.all_cpp.final; \ + for file in id3v2framefactory.cpp id3v2synchdata.cpp id3v2tag.cpp id3v2header.cpp id3v2frame.cpp id3v2footer.cpp id3v2extendedheader.cpp ; do \ + echo "#include \"$$file\"" >> libid3v2_la.all_cpp.files; \ + test ! -f $(srcdir)/$$file || egrep '^#pragma +implementation' $(srcdir)/$$file >> libid3v2_la.all_cpp.final; \ + done; \ + cat libid3v2_la.all_cpp.final libid3v2_la.all_cpp.files > libid3v2_la.all_cpp.cpp; \ + rm -f libid3v2_la.all_cpp.final libid3v2_la.all_cpp.files + +#>+ 3 +clean-final: + -rm -f libid3v2_la.all_cpp.cpp + +#>+ 2 +final: + $(MAKE) libid3v2_la_OBJECTS="$(libid3v2_la_final_OBJECTS)" all-am +#>+ 2 +final-install: + $(MAKE) libid3v2_la_OBJECTS="$(libid3v2_la_final_OBJECTS)" install-am +#>+ 2 +no-final: + $(MAKE) libid3v2_la_OBJECTS="$(libid3v2_la_nofinal_OBJECTS)" all-am +#>+ 2 +no-final-install: + $(MAKE) libid3v2_la_OBJECTS="$(libid3v2_la_nofinal_OBJECTS)" install-am +#>+ 3 +cvs-clean: + $(MAKE) admindir=$(top_srcdir)/admin -f $(top_srcdir)/admin/Makefile.common cvs-clean + +#>+ 3 +kde-rpo-clean: + -rm -f *.rpo diff --git a/Libraries/TagLib/Files/taglib/mpeg/id3v2/frames/Makefile.am b/Libraries/TagLib/Files/taglib/mpeg/id3v2/frames/Makefile.am new file mode 100644 index 000000000..929485b3b --- /dev/null +++ b/Libraries/TagLib/Files/taglib/mpeg/id3v2/frames/Makefile.am @@ -0,0 +1,27 @@ +INCLUDES = \ + -I$(top_srcdir)/taglib \ + -I$(top_srcdir)/taglib/toolkit \ + -I$(top_srcdir)/taglib/mpeg/id3v2 \ + $(all_includes) + +noinst_LTLIBRARIES = libframes.la + +libframes_la_SOURCES = \ + attachedpictureframe.cpp \ + commentsframe.cpp \ + relativevolumeframe.cpp \ + textidentificationframe.cpp \ + uniquefileidentifierframe.cpp \ + unknownframe.cpp + +taglib_include_HEADERS = \ + attachedpictureframe.h \ + commentsframe.h \ + relativevolumeframe.h \ + textidentificationframe.h \ + uniquefileidentifierframe.h \ + unknownframe.h + +taglib_includedir = $(includedir)/taglib + +EXTRA_DIST = $(libframes_la_SOURCES) $(taglib_include_HEADERS) diff --git a/Libraries/TagLib/Files/taglib/mpeg/id3v2/frames/Makefile.in b/Libraries/TagLib/Files/taglib/mpeg/id3v2/frames/Makefile.in new file mode 100644 index 000000000..68868cfec --- /dev/null +++ b/Libraries/TagLib/Files/taglib/mpeg/id3v2/frames/Makefile.in @@ -0,0 +1,583 @@ +# Makefile.in generated by automake 1.7.6 from Makefile.am. +# KDE tags expanded automatically by am_edit - $Revision$ +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../../../.. + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTODIRS = @AUTODIRS@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CONF_FILES = @CONF_FILES@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +KDE_PLUGIN = @KDE_PLUGIN@ +KDE_USE_CLOSURE_FALSE = @KDE_USE_CLOSURE_FALSE@ +KDE_USE_CLOSURE_TRUE = @KDE_USE_CLOSURE_TRUE@ +KDE_USE_FINAL_FALSE = @KDE_USE_FINAL_FALSE@ +KDE_USE_FINAL_TRUE = @KDE_USE_FINAL_TRUE@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +NOOPT_CFLAGS = @NOOPT_CFLAGS@ +NOOPT_CXXFLAGS = @NOOPT_CXXFLAGS@ +NOREPO = @NOREPO@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +REPO = @REPO@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +TOPSUBDIRS = @TOPSUBDIRS@ +USE_EXCEPTIONS = @USE_EXCEPTIONS@ +USE_RTTI = @USE_RTTI@ +VERSION = @VERSION@ +WOVERLOADED_VIRTUAL = @WOVERLOADED_VIRTUAL@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +all_includes = @all_includes@ +all_libraries = @all_libraries@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +link_zlib_FALSE = @link_zlib_FALSE@ +link_zlib_TRUE = @link_zlib_TRUE@ +localstatedir = @localstatedir@ +mandir = @mandir@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +INCLUDES = \ + -I$(top_srcdir)/taglib \ + -I$(top_srcdir)/taglib/toolkit \ + -I$(top_srcdir)/taglib/mpeg/id3v2 \ + $(all_includes) + + +noinst_LTLIBRARIES = libframes.la + +libframes_la_SOURCES = \ + attachedpictureframe.cpp \ + commentsframe.cpp \ + relativevolumeframe.cpp \ + textidentificationframe.cpp \ + uniquefileidentifierframe.cpp \ + unknownframe.cpp + + +taglib_include_HEADERS = \ + attachedpictureframe.h \ + commentsframe.h \ + relativevolumeframe.h \ + textidentificationframe.h \ + uniquefileidentifierframe.h \ + unknownframe.h + + +taglib_includedir = $(includedir)/taglib + +EXTRA_DIST = $(libframes_la_SOURCES) $(taglib_include_HEADERS) +subdir = taglib/mpeg/id3v2/frames +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/admin/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) + +libframes_la_LDFLAGS = +libframes_la_LIBADD = +am_libframes_la_OBJECTS = attachedpictureframe.lo commentsframe.lo \ + relativevolumeframe.lo textidentificationframe.lo \ + uniquefileidentifierframe.lo unknownframe.lo +#>- libframes_la_OBJECTS = $(am_libframes_la_OBJECTS) +#>+ 6 +libframes_la_final_OBJECTS = libframes_la.all_cpp.lo +libframes_la_nofinal_OBJECTS = attachedpictureframe.lo commentsframe.lo \ + relativevolumeframe.lo textidentificationframe.lo \ + uniquefileidentifierframe.lo unknownframe.lo +@KDE_USE_FINAL_FALSE@libframes_la_OBJECTS = $(libframes_la_nofinal_OBJECTS) +@KDE_USE_FINAL_TRUE@libframes_la_OBJECTS = $(libframes_la_final_OBJECTS) + +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/admin/depcomp +am__depfiles_maybe = depfiles +#>- @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/attachedpictureframe.Plo \ +#>- @AMDEP_TRUE@ ./$(DEPDIR)/commentsframe.Plo \ +#>- @AMDEP_TRUE@ ./$(DEPDIR)/relativevolumeframe.Plo \ +#>- @AMDEP_TRUE@ ./$(DEPDIR)/textidentificationframe.Plo \ +#>- @AMDEP_TRUE@ ./$(DEPDIR)/uniquefileidentifierframe.Plo \ +#>- @AMDEP_TRUE@ ./$(DEPDIR)/unknownframe.Plo +#>+ 13 +@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@DEP_FILES = $(DEPDIR)/libframes_la.all_cpp.P ./$(DEPDIR)/attachedpictureframe.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@ @AMDEP_TRUE@ ./$(DEPDIR)/commentsframe.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@ @AMDEP_TRUE@ ./$(DEPDIR)/relativevolumeframe.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@ @AMDEP_TRUE@ ./$(DEPDIR)/textidentificationframe.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@ @AMDEP_TRUE@ ./$(DEPDIR)/uniquefileidentifierframe.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@ @AMDEP_TRUE@ ./$(DEPDIR)/unknownframe.Plo +@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@DEP_FILES = ./$(DEPDIR)/attachedpictureframe.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@ @AMDEP_TRUE@ ./$(DEPDIR)/commentsframe.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@ @AMDEP_TRUE@ ./$(DEPDIR)/relativevolumeframe.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@ @AMDEP_TRUE@ ./$(DEPDIR)/textidentificationframe.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@ @AMDEP_TRUE@ ./$(DEPDIR)/uniquefileidentifierframe.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@ @AMDEP_TRUE@ ./$(DEPDIR)/unknownframe.Plo + +#>- CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ +#>- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +#>+ 2 +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(KDE_CXXFLAGS) +#>- LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) \ +#>- $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ +#>- $(AM_CXXFLAGS) $(CXXFLAGS) +#>+ 3 +LTCXXCOMPILE = $(LIBTOOL) --mode=compile --tag=CXX $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) $(KDE_CXXFLAGS) +CXXLD = $(CXX) +#>- CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \ +#>- $(AM_LDFLAGS) $(LDFLAGS) -o $@ +#>+ 2 +CXXLINK = $(LIBTOOL) --mode=link --tag=CXX $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(KDE_CXXFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +DIST_SOURCES = $(libframes_la_SOURCES) +HEADERS = $(taglib_include_HEADERS) + +DIST_COMMON = $(taglib_include_HEADERS) Makefile.am Makefile.in +SOURCES = $(libframes_la_SOURCES) + +#>- all: all-am +#>+ 1 +all: docs-am all-am + +.SUFFIXES: +.SUFFIXES: .cpp .lo .o .obj +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) +#>- cd $(top_srcdir) && \ +#>- $(AUTOMAKE) --gnu taglib/mpeg/id3v2/frames/Makefile +#>+ 3 + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu taglib/mpeg/id3v2/frames/Makefile + cd $(top_srcdir) && perl admin/am_edit taglib/mpeg/id3v2/frames/Makefile.in +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" = "$$p" && dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libframes.la: $(libframes_la_OBJECTS) $(libframes_la_DEPENDENCIES) + $(CXXLINK) $(libframes_la_LDFLAGS) $(libframes_la_OBJECTS) $(libframes_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) core *.core + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/attachedpictureframe.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/commentsframe.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/relativevolumeframe.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/textidentificationframe.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uniquefileidentifierframe.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unknownframe.Plo@am__quote@ + +distclean-depend: + -rm -rf ./$(DEPDIR) + +.cpp.o: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + +.cpp.obj: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` + +.cpp.lo: +@am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: +taglib_includeHEADERS_INSTALL = $(INSTALL_HEADER) +install-taglib_includeHEADERS: $(taglib_include_HEADERS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(taglib_includedir) + @list='$(taglib_include_HEADERS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(taglib_includeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(taglib_includedir)/$$f"; \ + $(taglib_includeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(taglib_includedir)/$$f; \ + done + +uninstall-taglib_includeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(taglib_include_HEADERS)'; for p in $$list; do \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " rm -f $(DESTDIR)$(taglib_includedir)/$$f"; \ + rm -f $(DESTDIR)$(taglib_includedir)/$$f; \ + done + +ETAGS = etags +ETAGSFLAGS = + +CTAGS = ctags +CTAGSFLAGS = + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique + +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = ../../../.. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) + +installdirs: + $(mkinstalldirs) $(DESTDIR)$(taglib_includedir) +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +#>- clean: clean-am +#>+ 1 +clean: kde-rpo-clean clean-am + +#>- clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ +#>- mostlyclean-am +#>+ 2 +clean-am: clean-final clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + +distclean-am: clean-am distclean-compile distclean-depend \ + distclean-generic distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: install-taglib_includeHEADERS + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am uninstall-taglib_includeHEADERS + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstLTLIBRARIES ctags distclean \ + distclean-compile distclean-depend distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am info \ + info-am install install-am install-data install-data-am \ + install-exec install-exec-am install-info install-info-am \ + install-man install-strip install-taglib_includeHEADERS \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-info-am \ + uninstall-taglib_includeHEADERS + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: + +#>+ 2 +docs-am: + +#>+ 6 +force-reedit: + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu taglib/mpeg/id3v2/frames/Makefile + cd $(top_srcdir) && perl admin/am_edit taglib/mpeg/id3v2/frames/Makefile.in + + +#>+ 11 +libframes_la.all_cpp.cpp: $(srcdir)/Makefile.in $(srcdir)/attachedpictureframe.cpp $(srcdir)/commentsframe.cpp $(srcdir)/relativevolumeframe.cpp $(srcdir)/textidentificationframe.cpp $(srcdir)/uniquefileidentifierframe.cpp $(srcdir)/unknownframe.cpp + @echo 'creating libframes_la.all_cpp.cpp ...'; \ + rm -f libframes_la.all_cpp.files libframes_la.all_cpp.final; \ + echo "#define KDE_USE_FINAL 1" >> libframes_la.all_cpp.final; \ + for file in attachedpictureframe.cpp commentsframe.cpp relativevolumeframe.cpp textidentificationframe.cpp uniquefileidentifierframe.cpp unknownframe.cpp ; do \ + echo "#include \"$$file\"" >> libframes_la.all_cpp.files; \ + test ! -f $(srcdir)/$$file || egrep '^#pragma +implementation' $(srcdir)/$$file >> libframes_la.all_cpp.final; \ + done; \ + cat libframes_la.all_cpp.final libframes_la.all_cpp.files > libframes_la.all_cpp.cpp; \ + rm -f libframes_la.all_cpp.final libframes_la.all_cpp.files + +#>+ 3 +clean-final: + -rm -f libframes_la.all_cpp.cpp + +#>+ 2 +final: + $(MAKE) libframes_la_OBJECTS="$(libframes_la_final_OBJECTS)" all-am +#>+ 2 +final-install: + $(MAKE) libframes_la_OBJECTS="$(libframes_la_final_OBJECTS)" install-am +#>+ 2 +no-final: + $(MAKE) libframes_la_OBJECTS="$(libframes_la_nofinal_OBJECTS)" all-am +#>+ 2 +no-final-install: + $(MAKE) libframes_la_OBJECTS="$(libframes_la_nofinal_OBJECTS)" install-am +#>+ 3 +cvs-clean: + $(MAKE) admindir=$(top_srcdir)/admin -f $(top_srcdir)/admin/Makefile.common cvs-clean + +#>+ 3 +kde-rpo-clean: + -rm -f *.rpo diff --git a/Libraries/TagLib/Files/taglib/mpeg/id3v2/frames/attachedpictureframe.cpp b/Libraries/TagLib/Files/taglib/mpeg/id3v2/frames/attachedpictureframe.cpp new file mode 100644 index 000000000..5700dfe64 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/mpeg/id3v2/frames/attachedpictureframe.cpp @@ -0,0 +1,165 @@ +/*************************************************************************** + copyright : (C) 2004 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#include + +#include "attachedpictureframe.h" + +using namespace TagLib; +using namespace ID3v2; + +class AttachedPictureFrame::AttachedPictureFramePrivate +{ +public: + AttachedPictureFramePrivate() : textEncoding(String::Latin1), + type(AttachedPictureFrame::Other) {} + + String::Type textEncoding; + String mimeType; + AttachedPictureFrame::Type type; + String description; + ByteVector data; +}; + +//////////////////////////////////////////////////////////////////////////////// +// public members +//////////////////////////////////////////////////////////////////////////////// + +AttachedPictureFrame::AttachedPictureFrame() : Frame("APIC") +{ + d = new AttachedPictureFramePrivate; +} + +AttachedPictureFrame::AttachedPictureFrame(const ByteVector &data) : Frame(data) +{ + setData(data); + d = new AttachedPictureFramePrivate; +} + +AttachedPictureFrame::~AttachedPictureFrame() +{ + delete d; +} + +String AttachedPictureFrame::toString() const +{ + String s = "[" + d->mimeType + "]"; + return d->description.isEmpty() ? s : d->description + " " + s; +} + +String::Type AttachedPictureFrame::textEncoding() const +{ + return d->textEncoding; +} + +void AttachedPictureFrame::setTextEncoding(String::Type t) +{ + d->textEncoding = t; +} + +String AttachedPictureFrame::mimeType() const +{ + return d->mimeType; +} + +void AttachedPictureFrame::setMimeType(const String &m) +{ + d->mimeType = m; +} + +AttachedPictureFrame::Type AttachedPictureFrame::type() const +{ + return d->type; +} + +void AttachedPictureFrame::setType(Type t) +{ + d->type = t; +} + +ByteVector AttachedPictureFrame::picture() const +{ + return d->data; +} + +void AttachedPictureFrame::setPicture(const ByteVector &p) +{ + d->data = p; +} + +//////////////////////////////////////////////////////////////////////////////// +// protected members +//////////////////////////////////////////////////////////////////////////////// + +void AttachedPictureFrame::parseFields(const ByteVector &data) +{ + if(data.size() < 5) { + debug("A picture frame must contain at least 5 bytes."); + return; + } + + int pos = 0; + + d->textEncoding = String::Type(data[pos]); + pos += 1; + + int offset = data.find(textDelimiter(String::Latin1), pos); + if(offset < pos) + return; + d->mimeType = String(data.mid(pos, offset - pos), String::Latin1); + pos = offset + 1; + + d->type = Type(data[pos]); + pos += 1; + + offset = data.find(textDelimiter(d->textEncoding), pos); + if(offset < pos) + return; + d->description = String(data.mid(pos, offset - pos), d->textEncoding); + pos = offset + 1; + + d->data = data.mid(pos); +} + +ByteVector AttachedPictureFrame::renderFields() const +{ + ByteVector data; + + data.append(char(d->textEncoding)); + data.append(d->mimeType.data(String::Latin1)); + data.append(textDelimiter(String::Latin1)); + data.append(char(d->type)); + data.append(d->description.data(d->textEncoding)); + data.append(textDelimiter(d->textEncoding)); + data.append(d->data); + + return data; +} + +//////////////////////////////////////////////////////////////////////////////// +// private members +//////////////////////////////////////////////////////////////////////////////// + +AttachedPictureFrame::AttachedPictureFrame(const ByteVector &data, Header *h) : Frame(h) +{ + d = new AttachedPictureFramePrivate; + parseFields(fieldData(data)); +} diff --git a/Libraries/TagLib/Files/taglib/mpeg/id3v2/frames/attachedpictureframe.h b/Libraries/TagLib/Files/taglib/mpeg/id3v2/frames/attachedpictureframe.h new file mode 100644 index 000000000..896f00217 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/mpeg/id3v2/frames/attachedpictureframe.h @@ -0,0 +1,195 @@ +/*************************************************************************** + copyright : (C) 2004 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#ifndef TAGLIB_ATTACHEDPICTUREFRAME_H +#define TAGLIB_ATTACHEDPICTUREFRAME_H + +#include +#include + +namespace TagLib { + + namespace ID3v2 { + + //! An ID3v2 attached picture frame implementation + + /*! + * This is an implementation of ID3v2 attached pictures. Pictures may be + * included in tags, one per APIC frame (but there may be multiple APIC + * frames in a single tag). These pictures are usually in either JPEG or + * PNG format. + */ + + class AttachedPictureFrame : public Frame + { + friend class FrameFactory; + + public: + + /*! + * This describes the function or content of the picture. + */ + enum Type { + //! A type not enumerated below + Other = 0x00, + //! 32x32 PNG image that should be used as the file icon + FileIcon = 0x01, + //! File icon of a different size or format + OtherFileIcon = 0x02, + //! Front cover image of the album + FrontCover = 0x03, + //! Back cover image of the album + BackCover = 0x04, + //! Inside leaflet page of the album + LeafletPage = 0x05, + //! Image from the album itself + Media = 0x06, + //! Picture of the lead artist or soloist + LeadArtist = 0x07, + //! Picture of the artist or performer + Artist = 0x08, + //! Picture of the conductor + Conductor = 0x09, + //! Picture of the band or orchestra + Band = 0x0A, + //! Picture of the composer + Composer = 0x0B, + //! Picture of the lyricist or text writer + Lyricist = 0x0C, + //! Picture of the recording location or studio + RecordingLocation = 0x0D, + //! Picture of the artists during recording + DuringRecording = 0x0E, + //! Picture of the artists during performance + DuringPerformance = 0x0F, + //! Picture from a movie or video related to the track + MovieScreenCapture = 0x10, + //! Picture of a large, coloured fish + ColouredFish = 0x11, + //! Illustration related to the track + Illustration = 0x12, + //! Logo of the band or performer + BandLogo = 0x13, + //! Logo of the publisher (record company) + PublisherLogo = 0x14 + }; + + /*! + * Constructs an empty picture frame. The description, content and text + * encoding should be set manually. + */ + AttachedPictureFrame(); + + /*! + * Constructs an AttachedPicture frame based on \a data. + */ + explicit AttachedPictureFrame(const ByteVector &data); + + /*! + * Destroys the AttahcedPictureFrame instance. + */ + virtual ~AttachedPictureFrame(); + + /*! + * Returns a string containing the description and mime-type + */ + virtual String toString() const; + + /*! + * Returns the text encoding used for the description. + * + * \see setTextEncoding() + * \see description() + */ + String::Type textEncoding() const; + + /*! + * Set the text encoding used for the description. + * + * \see description() + */ + void setTextEncoding(String::Type t); + + /*! + * Returns the mime type of the image. This should in most cases be + * "image/png" or "image/jpeg". + */ + String mimeType() const; + + /*! + * Sets the mime type of the image. This should in most cases be + * "image/png" or "image/jpeg". + */ + void setMimeType(const String &m); + + /*! + * Returns the type of the image. + * + * \see Type + * \see setType() + */ + Type type() const; + + /*! + * Sets the type for the image. + * + * \see Type + * \see type() + */ + void setType(Type t); + + /*! + * Returns the image data as a ByteVector. + * + * \note ByteVector has a data() method that returns a const char * which + * should make it easy to export this data to external programs. + * + * \see setPicture() + * \see mimeType() + */ + ByteVector picture() const; + + /*! + * Sets the image data to \a p. \a p should be of the type specified in + * this frame's mime-type specification. + * + * \see picture() + * \see mimeType() + * \see setMimeType() + */ + void setPicture(const ByteVector &p); + + protected: + virtual void parseFields(const ByteVector &data); + virtual ByteVector renderFields() const; + + private: + AttachedPictureFrame(const ByteVector &data, Header *h); + AttachedPictureFrame(const AttachedPictureFrame &); + AttachedPictureFrame &operator=(const AttachedPictureFrame &); + + class AttachedPictureFramePrivate; + AttachedPictureFramePrivate *d; + }; + } +} + +#endif diff --git a/Libraries/TagLib/Files/taglib/mpeg/id3v2/frames/commentsframe.cpp b/Libraries/TagLib/Files/taglib/mpeg/id3v2/frames/commentsframe.cpp new file mode 100644 index 000000000..fcabbbc6c --- /dev/null +++ b/Libraries/TagLib/Files/taglib/mpeg/id3v2/frames/commentsframe.cpp @@ -0,0 +1,152 @@ +/*************************************************************************** + copyright : (C) 2002, 2003 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#include +#include + +#include "commentsframe.h" + +using namespace TagLib; +using namespace ID3v2; + +class CommentsFrame::CommentsFramePrivate +{ +public: + CommentsFramePrivate() : textEncoding(String::Latin1) {} + String::Type textEncoding; + ByteVector language; + String description; + String text; +}; + +//////////////////////////////////////////////////////////////////////////////// +// public members +//////////////////////////////////////////////////////////////////////////////// + +CommentsFrame::CommentsFrame(String::Type encoding) : Frame("COMM") +{ + d = new CommentsFramePrivate; + d->textEncoding = encoding; +} + +CommentsFrame::CommentsFrame(const ByteVector &data) : Frame(data) +{ + d = new CommentsFramePrivate; + setData(data); +} + +CommentsFrame::~CommentsFrame() +{ + delete d; +} + +String CommentsFrame::toString() const +{ + return d->text; +} + +ByteVector CommentsFrame::language() const +{ + return d->language; +} + +String CommentsFrame::description() const +{ + return d->description; +} + +String CommentsFrame::text() const +{ + return d->text; +} + +void CommentsFrame::setLanguage(const ByteVector &languageEncoding) +{ + d->language = languageEncoding.mid(0, 3); +} + +void CommentsFrame::setDescription(const String &s) +{ + d->description = s; +} + +void CommentsFrame::setText(const String &s) +{ + d->text = s; +} + + +String::Type CommentsFrame::textEncoding() const +{ + return d->textEncoding; +} + +void CommentsFrame::setTextEncoding(String::Type encoding) +{ + d->textEncoding = encoding; +} + +//////////////////////////////////////////////////////////////////////////////// +// protected members +//////////////////////////////////////////////////////////////////////////////// + +void CommentsFrame::parseFields(const ByteVector &data) +{ + if(data.size() < 5) { + debug("A comment frame must contain at least 5 bytes."); + return; + } + + d->textEncoding = String::Type(data[0]); + d->language = data.mid(1, 3); + + int byteAlign = d->textEncoding == String::Latin1 || d->textEncoding == String::UTF8 ? 1 : 2; + + ByteVectorList l = ByteVectorList::split(data.mid(4), textDelimiter(d->textEncoding), byteAlign); + + if(l.size() == 2) { + d->description = String(l.front(), d->textEncoding); + d->text = String(l.back(), d->textEncoding); + } +} + +ByteVector CommentsFrame::renderFields() const +{ + ByteVector v; + + v.append(char(d->textEncoding)); + v.append(d->language.size() == 3 ? d->language : " "); + v.append(d->description.data(d->textEncoding)); + v.append(textDelimiter(d->textEncoding)); + v.append(d->text.data(d->textEncoding)); + + return v; +} + +//////////////////////////////////////////////////////////////////////////////// +// private members +//////////////////////////////////////////////////////////////////////////////// + +CommentsFrame::CommentsFrame(const ByteVector &data, Header *h) : Frame(h) +{ + d = new CommentsFramePrivate(); + parseFields(fieldData(data)); +} diff --git a/Libraries/TagLib/Files/taglib/mpeg/id3v2/frames/commentsframe.h b/Libraries/TagLib/Files/taglib/mpeg/id3v2/frames/commentsframe.h new file mode 100644 index 000000000..2c8b2c003 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/mpeg/id3v2/frames/commentsframe.h @@ -0,0 +1,154 @@ +/*************************************************************************** + copyright : (C) 2002, 2003 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#ifndef TAGLIB_COMMENTSFRAME_H +#define TAGLIB_COMMENTSFRAME_H + +#include + +namespace TagLib { + + namespace ID3v2 { + + //! An implementation of ID3v2 comments + + /*! + * This implements the ID3v2 comment format. An ID3v2 comment concists of + * a language encoding, a description and a single text field. + */ + + class CommentsFrame : public Frame + { + friend class FrameFactory; + + public: + /*! + * Construct an empty comment frame that will use the text encoding + * \a encoding. + */ + explicit CommentsFrame(String::Type encoding = String::Latin1); + + /*! + * Construct a comment based on the data in \a data. + */ + explicit CommentsFrame(const ByteVector &data); + + /*! + * Destroys this CommentFrame instance. + */ + virtual ~CommentsFrame(); + + /*! + * Returns the text of this comment. + * + * \see text() + */ + virtual String toString() const; + + /*! + * Returns the language encoding as a 3 byte encoding as specified by + * ISO-639-2. + * + * \note Most taggers simply ignore this value. + * + * \see setLanguage() + */ + ByteVector language() const; + + /*! + * Returns the description of this comment. + * + * \note Most taggers simply ignore this value. + * + * \see setDescription() + */ + String description() const; + + /*! + * Returns the text of this comment. + * + * \see setText() + */ + String text() const; + + /*! + * Set the language using the 3 byte language code from + * ISO-639-2 to + * \a languageCode. + * + * \see language() + */ + void setLanguage(const ByteVector &languageCode); + + /*! + * Sets the description of the comment to \a s. + * + * \see decription() + */ + void setDescription(const String &s); + + /*! + * Sets the text portion of the comment to \a s. + * + * \see text() + */ + virtual void setText(const String &s); + + /*! + * Returns the text encoding that will be used in rendering this frame. + * This defaults to the type that was either specified in the constructor + * or read from the frame when parsed. + * + * \see setTextEncoding() + * \see render() + */ + String::Type textEncoding() const; + + /*! + * Sets the text encoding to be used when rendering this frame to + * \a encoding. + * + * \see textEncoding() + * \see render() + */ + void setTextEncoding(String::Type encoding); + + protected: + // Reimplementations. + + virtual void parseFields(const ByteVector &data); + virtual ByteVector renderFields() const; + + private: + /*! + * The constructor used by the FrameFactory. + */ + CommentsFrame(const ByteVector &data, Header *h); + CommentsFrame(const CommentsFrame &); + CommentsFrame &operator=(const CommentsFrame &); + + class CommentsFramePrivate; + CommentsFramePrivate *d; + }; + + } +} +#endif diff --git a/Libraries/TagLib/Files/taglib/mpeg/id3v2/frames/relativevolumeframe.cpp b/Libraries/TagLib/Files/taglib/mpeg/id3v2/frames/relativevolumeframe.cpp new file mode 100644 index 000000000..171ba91dc --- /dev/null +++ b/Libraries/TagLib/Files/taglib/mpeg/id3v2/frames/relativevolumeframe.cpp @@ -0,0 +1,137 @@ +/*************************************************************************** + copyright : (C) 2004 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#include "relativevolumeframe.h" + +using namespace TagLib; +using namespace ID3v2; + +class RelativeVolumeFrame::RelativeVolumeFramePrivate +{ +public: + RelativeVolumeFramePrivate() : channelType(Other), volumeAdjustment(0) {} + + String identification; + ChannelType channelType; + short volumeAdjustment; + PeakVolume peakVolume; +}; + +//////////////////////////////////////////////////////////////////////////////// +// public members +//////////////////////////////////////////////////////////////////////////////// + +RelativeVolumeFrame::RelativeVolumeFrame(const ByteVector &data) : Frame(data) +{ + d = new RelativeVolumeFramePrivate; + setData(data); +} + +RelativeVolumeFrame::~RelativeVolumeFrame() +{ + delete d; +} + +String RelativeVolumeFrame::toString() const +{ + return d->identification; +} + +RelativeVolumeFrame::ChannelType RelativeVolumeFrame::channelType() const +{ + return d->channelType; +} + +void RelativeVolumeFrame::setChannelType(ChannelType t) +{ + d->channelType = t; +} + +short RelativeVolumeFrame::volumeAdjustmentIndex() const +{ + return d->volumeAdjustment; +} + +void RelativeVolumeFrame::setVolumeAdjustmentIndex(short index) +{ + d->volumeAdjustment = index; +} + +float RelativeVolumeFrame::volumeAdjustment() const +{ + return float(d->volumeAdjustment) / float(512); +} + +void RelativeVolumeFrame::setVolumeAdjustment(float adjustment) +{ + d->volumeAdjustment = short(adjustment / float(512)); +} + +RelativeVolumeFrame::PeakVolume RelativeVolumeFrame::peakVolume() const +{ + return d->peakVolume; +} + +void RelativeVolumeFrame::setPeakVolume(const PeakVolume &peak) +{ + d->peakVolume = peak; +} + +//////////////////////////////////////////////////////////////////////////////// +// protected members +//////////////////////////////////////////////////////////////////////////////// + +void RelativeVolumeFrame::parseFields(const ByteVector &data) +{ + int pos = data.find(textDelimiter(String::Latin1)); + d->identification = String(data.mid(0, pos), String::Latin1); + + d->volumeAdjustment = data.mid(pos, 2).toShort(); + pos += 2; + + d->peakVolume.bitsRepresentingPeak = data[pos]; + pos += 1; + + d->peakVolume.peakVolume = data.mid(pos, d->peakVolume.bitsRepresentingPeak); +} + +ByteVector RelativeVolumeFrame::renderFields() const +{ + ByteVector data; + + data.append(d->identification.data(String::Latin1)); + data.append(textDelimiter(String::Latin1)); + data.append(ByteVector::fromShort(d->volumeAdjustment)); + data.append(char(d->peakVolume.bitsRepresentingPeak)); + data.append(d->peakVolume.peakVolume); + + return data; +} + +//////////////////////////////////////////////////////////////////////////////// +// private members +//////////////////////////////////////////////////////////////////////////////// + +RelativeVolumeFrame::RelativeVolumeFrame(const ByteVector &data, Header *h) : Frame(h) +{ + d = new RelativeVolumeFramePrivate; + parseFields(fieldData(data)); +} diff --git a/Libraries/TagLib/Files/taglib/mpeg/id3v2/frames/relativevolumeframe.h b/Libraries/TagLib/Files/taglib/mpeg/id3v2/frames/relativevolumeframe.h new file mode 100644 index 000000000..f2d9a9dc3 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/mpeg/id3v2/frames/relativevolumeframe.h @@ -0,0 +1,207 @@ +/*************************************************************************** + copyright : (C) 2004 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#ifndef TAGLIB_RELATIVEVOLUMEFRAME_H +#define TAGLIB_RELATIVEVOLUMEFRAME_H + +#include + +namespace TagLib { + + namespace ID3v2 { + + //! An ID3v2 relative volume adjustment frame implementation + + /*! + * This is an implementation of ID3v2 relative volume adjustment. The + * presense of this frame makes it possible to specify an increase in volume + * for an audio file or specific audio tracks in that file. + * + * Multiple relative volume adjustment frames may be present in the tag + * each with a unique identification and describing volume adjustment for + * different channel types. + */ + + class RelativeVolumeFrame : public Frame + { + friend class FrameFactory; + + public: + + /*! + * This indicates the type of volume adjustment that should be applied. + */ + enum ChannelType { + //! A type not enumerated below + Other = 0x00, + //! The master volume for the track + MasterVolume = 0x01, + //! The front right audio channel + FrontRight = 0x02, + //! The front left audio channel + FrontLeft = 0x03, + //! The back right audio channel + BackRight = 0x04, + //! The back left audio channel + BackLeft = 0x05, + //! The front center audio channel + FrontCentre = 0x06, + //! The back center audio channel + BackCentre = 0x07, + //! The subwoofer audio channel + Subwoofer = 0x08 + }; + + //! Struct that stores the relevant values for ID3v2 peak volume + + /*! + * The peak volume is described as a series of bits that is padded to fill + * a block of bytes. These two values should always be updated in tandem. + */ + struct PeakVolume + { + /*! + * Constructs an empty peak volume description. + */ + PeakVolume() : bitsRepresentingPeak(0) {} + /*! + * The number of bits (in the range of 0 to 255) used to describe the + * peak volume. + */ + unsigned char bitsRepresentingPeak; + /*! + * The array of bits (represented as a series of bytes) used to describe + * the peak volume. + */ + ByteVector peakVolume; + }; + + /*! + * Constructs a RelativeVolumeFrame. The relevant data should be set + * manually. + */ + RelativeVolumeFrame(); + + /*! + * Constructs a RelativeVolumeFrame based on the contents of \a data. + */ + RelativeVolumeFrame(const ByteVector &data); + + /*! + * Destroys the RelativeVolumeFrame instance. + */ + virtual ~RelativeVolumeFrame(); + + /*! + * Returns the frame's identification. + * + * \see identification() + */ + virtual String toString() const; + + /*! + * Returns the channel type that this frame refers to. + * + * \see setChannelType() + */ + ChannelType channelType() const; + + /*! + * Sets the channel type that this frame refers to. + * + * \see channelType() + */ + void setChannelType(ChannelType t); + + /*! + * Returns the relative volume adjustment "index". As indicated by the + * ID3v2 standard this is a 16-bit signed integer that reflects the + * decibils of adjustment when divided by 512. + * + * \see setVolumeAdjustmentIndex() + * \see volumeAjustment() + */ + short volumeAdjustmentIndex() const; + + /*! + * Set the volume adjustment to \a index. As indicated by the ID3v2 + * standard this is a 16-bit signed integer that reflects the decibils of + * adjustment when divided by 512. + * + * \see volumeAdjustmentIndex() + * \see setVolumeAjustment() + */ + void setVolumeAdjustmentIndex(short index); + + /*! + * Returns the relative volume adjustment in decibels. + * + * \note Because this is actually stored internally as an "index" to this + * value the value returned by this method may not be identical to the + * value set using setVolumeAdjustment(). + * + * \see setVolumeAdjustment() + * \see volumeAdjustmentIndex() + */ + float volumeAdjustment() const; + + /*! + * Set the relative volume adjustment in decibels to \a adjustment. + * + * \note Because this is actually stored internally as an "index" to this + * value the value set by this method may not be identical to the one + * returned by volumeAdjustment(). + * + * \see setVolumeAdjustment() + * \see volumeAdjustmentIndex() + */ + void setVolumeAdjustment(float adjustment); + + /*! + * Returns the peak volume (represented as a length and a string of bits). + * + * \see setPeakVolume() + */ + PeakVolume peakVolume() const; + + /*! + * Sets the peak volume to \a peak. + * + * \see peakVolume() + */ + void setPeakVolume(const PeakVolume &peak); + + protected: + virtual void parseFields(const ByteVector &data); + virtual ByteVector renderFields() const; + + private: + RelativeVolumeFrame(const ByteVector &data, Header *h); + RelativeVolumeFrame(const RelativeVolumeFrame &); + RelativeVolumeFrame &operator=(const RelativeVolumeFrame &); + + class RelativeVolumeFramePrivate; + RelativeVolumeFramePrivate *d; + }; + + } +} +#endif diff --git a/Libraries/TagLib/Files/taglib/mpeg/id3v2/frames/textidentificationframe.cpp b/Libraries/TagLib/Files/taglib/mpeg/id3v2/frames/textidentificationframe.cpp new file mode 100644 index 000000000..ee2137875 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/mpeg/id3v2/frames/textidentificationframe.cpp @@ -0,0 +1,245 @@ +/*************************************************************************** + copyright : (C) 2002, 2003 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#include +#include + +#include "textidentificationframe.h" + +using namespace TagLib; +using namespace ID3v2; + +class TextIdentificationFrame::TextIdentificationFramePrivate +{ +public: + TextIdentificationFramePrivate() : textEncoding(String::Latin1) {} + String::Type textEncoding; + StringList fieldList; +}; + +//////////////////////////////////////////////////////////////////////////////// +// TextIdentificationFrame public members +//////////////////////////////////////////////////////////////////////////////// + +TextIdentificationFrame::TextIdentificationFrame(const ByteVector &type, String::Type encoding) : + Frame(type) +{ + d = new TextIdentificationFramePrivate; + d->textEncoding = encoding; +} + +TextIdentificationFrame::TextIdentificationFrame(const ByteVector &data) : + Frame(data) +{ + d = new TextIdentificationFramePrivate; + setData(data); +} + +TextIdentificationFrame::~TextIdentificationFrame() +{ + delete d; +} + +void TextIdentificationFrame::setText(const StringList &l) +{ + d->fieldList = l; +} + +void TextIdentificationFrame::setText(const String &s) +{ + d->fieldList = s; +} + +String TextIdentificationFrame::toString() const +{ + return d->fieldList.toString(); +} + +StringList TextIdentificationFrame::fieldList() const +{ + return d->fieldList; +} + +String::Type TextIdentificationFrame::textEncoding() const +{ + return d->textEncoding; +} + +void TextIdentificationFrame::setTextEncoding(String::Type encoding) +{ + d->textEncoding = encoding; +} + +//////////////////////////////////////////////////////////////////////////////// +// TextIdentificationFrame protected members +//////////////////////////////////////////////////////////////////////////////// + +void TextIdentificationFrame::parseFields(const ByteVector &data) +{ + // read the string data type (the first byte of the field data) + + d->textEncoding = String::Type(data[0]); + + // split the byte array into chunks based on the string type (two byte delimiter + // for unicode encodings) + + int byteAlign = d->textEncoding == String::Latin1 || d->textEncoding == String::UTF8 ? 1 : 2; + + ByteVectorList l = ByteVectorList::split(data.mid(1), textDelimiter(d->textEncoding), byteAlign); + + d->fieldList.clear(); + + // append those split values to the list and make sure that the new string's + // type is the same specified for this frame + + for(ByteVectorList::Iterator it = l.begin(); it != l.end(); it++) { + String s(*it, d->textEncoding); + d->fieldList.append(s); + } +} + +ByteVector TextIdentificationFrame::renderFields() const +{ + ByteVector v; + + if(d->fieldList.size() > 0) { + + v.append(char(d->textEncoding)); + + for(StringList::Iterator it = d->fieldList.begin(); it != d->fieldList.end(); it++) { + + // Since the field list is null delimited, if this is not the first + // element in the list, append the appropriate delimiter for this + // encoding. + + if(it != d->fieldList.begin()) + v.append(textDelimiter(d->textEncoding)); + + v.append((*it).data(d->textEncoding)); + } + } + + return v; +} + +//////////////////////////////////////////////////////////////////////////////// +// TextIdentificationFrame private members +//////////////////////////////////////////////////////////////////////////////// + +TextIdentificationFrame::TextIdentificationFrame(const ByteVector &data, Header *h) : Frame(h) +{ + d = new TextIdentificationFramePrivate; + parseFields(fieldData(data)); +} + +//////////////////////////////////////////////////////////////////////////////// +// UserTextIdentificationFrame public members +//////////////////////////////////////////////////////////////////////////////// + +UserTextIdentificationFrame::UserTextIdentificationFrame(String::Type encoding) : + TextIdentificationFrame("TXXX", encoding), + d(0) +{ + StringList l; + l.append(String::null); + l.append(String::null); + setText(l); +} + + +UserTextIdentificationFrame::UserTextIdentificationFrame(const ByteVector &data) : + TextIdentificationFrame(data) +{ + +} + +String UserTextIdentificationFrame::toString() const +{ + return "[" + description() + "] " + fieldList().toString(); +} + +String UserTextIdentificationFrame::description() const +{ + return !TextIdentificationFrame::fieldList().isEmpty() + ? TextIdentificationFrame::fieldList().front() + : String::null; +} + +StringList UserTextIdentificationFrame::fieldList() const +{ + StringList l = TextIdentificationFrame::fieldList(); + + if(!l.isEmpty()) { + StringList::Iterator it = l.begin(); + l.erase(it); + } + + return l; +} + +void UserTextIdentificationFrame::setText(const String &text) +{ + if(description().isEmpty()) + setDescription(String::null); + + TextIdentificationFrame::setText(StringList(description()).append(text)); +} + +void UserTextIdentificationFrame::setText(const StringList &fields) +{ + if(description().isEmpty()) + setDescription(String::null); + + TextIdentificationFrame::setText(StringList(description()).append(fields)); +} + +void UserTextIdentificationFrame::setDescription(const String &s) +{ + StringList l = fieldList(); + + if(l.isEmpty()) + l.append(s); + else + l[0] = s; + + TextIdentificationFrame::setText(l); +} + +UserTextIdentificationFrame *find(ID3v2::Tag *tag, const String &description) // static +{ + FrameList l = tag->frameList("TXXX"); + for(FrameList::Iterator it = l.begin(); it != l.end(); ++it) { + UserTextIdentificationFrame *f = dynamic_cast(*it); + if(f && f->description() == description) + return f; + } + return 0; +} + +//////////////////////////////////////////////////////////////////////////////// +// UserTextIdentificationFrame private members +//////////////////////////////////////////////////////////////////////////////// + +UserTextIdentificationFrame::UserTextIdentificationFrame(const ByteVector &data, Header *h) : + TextIdentificationFrame(data, h) +{ + +} diff --git a/Libraries/TagLib/Files/taglib/mpeg/id3v2/frames/textidentificationframe.h b/Libraries/TagLib/Files/taglib/mpeg/id3v2/frames/textidentificationframe.h new file mode 100644 index 000000000..00c13851e --- /dev/null +++ b/Libraries/TagLib/Files/taglib/mpeg/id3v2/frames/textidentificationframe.h @@ -0,0 +1,241 @@ +/*************************************************************************** + copyright : (C) 2002, 2003 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#ifndef TAGLIB_TEXTIDENTIFICATIONFRAME_H +#define TAGLIB_TEXTIDENTIFICATIONFRAME_H + +#include + +#include + +namespace TagLib { + + namespace ID3v2 { + + class Tag; + + //! An ID3v2 text identification frame implementation + + /*! + * This is an implementation of the most common type of ID3v2 frame -- text + * identification frames. There are a number of variations on this. Those + * enumerated in the ID3v2.4 standard are: + * + *
    + *
  • TALB Album/Movie/Show title
  • + *
  • TBPM BPM (beats per minute)
  • + *
  • TCOM Composer
  • + *
  • TCON Content type
  • + *
  • TCOP Copyright message
  • + *
  • TDEN Encoding time
  • + *
  • TDLY Playlist delay
  • + *
  • TDOR Original release time
  • + *
  • TDRC Recording time
  • + *
  • TDRL Release time
  • + *
  • TDTG Tagging time
  • + *
  • TENC Encoded by
  • + *
  • TEXT Lyricist/Text writer
  • + *
  • TFLT File type
  • + *
  • TIPL Involved people list
  • + *
  • TIT1 Content group description
  • + *
  • TIT2 Title/songname/content description
  • + *
  • TIT3 Subtitle/Description refinement
  • + *
  • TKEY Initial key
  • + *
  • TLAN Language(s)
  • + *
  • TLEN Length
  • + *
  • TMCL Musician credits list
  • + *
  • TMED Media type
  • + *
  • TMOO Mood
  • + *
  • TOAL Original album/movie/show title
  • + *
  • TOFN Original filename
  • + *
  • TOLY Original lyricist(s)/text writer(s)
  • + *
  • TOPE Original artist(s)/performer(s)
  • + *
  • TOWN File owner/licensee
  • + *
  • TPE1 Lead performer(s)/Soloist(s)
  • + *
  • TPE2 Band/orchestra/accompaniment
  • + *
  • TPE3 Conductor/performer refinement
  • + *
  • TPE4 Interpreted, remixed, or otherwise modified by
  • + *
  • TPOS Part of a set
  • + *
  • TPRO Produced notice
  • + *
  • TPUB Publisher
  • + *
  • TRCK Track number/Position in set
  • + *
  • TRSN Internet radio station name
  • + *
  • TRSO Internet radio station owner
  • + *
  • TSOA Album sort order
  • + *
  • TSOP Performer sort order
  • + *
  • TSOT Title sort order
  • + *
  • TSRC ISRC (international standard recording code)
  • + *
  • TSSE Software/Hardware and settings used for encoding
  • + *
  • TSST Set subtitle
  • + *
+ * + * The ID3v2 Frames document gives a description of each of these formats + * and the expected order of strings in each. ID3v2::Header::frameID() can + * be used to determine the frame type. + */ + + class TextIdentificationFrame : public Frame + { + friend class FrameFactory; + + public: + /*! + * Construct an empty frame of type \a type. Uses \a encoding as the + * default text encoding. + * + * \note In this case you must specify the text encoding as it + * resolves the ambiguity between constructors. + */ + TextIdentificationFrame(const ByteVector &type, String::Type encoding); + + /*! + * This is a dual purpose constructor. \a data can either be binary data + * that should be parsed or (at a minimum) the frame ID. + */ + explicit TextIdentificationFrame(const ByteVector &data); + + /*! + * Destroys this TextIdentificationFrame instance. + */ + virtual ~TextIdentificationFrame(); + + /*! + * Text identification frames are a list of string fields. + * + * This function will accept either a StringList or a String (using the + * StringList constructor that accepts a single String). + * + * \note This will not change the text encoding of the frame even if the + * strings passed in are not of the same encoding. Please use + * setEncoding(s.type()) if you wish to change the encoding of the frame. + */ + void setText(const StringList &l); + + // Reimplementations. + + virtual void setText(const String &s); + virtual String toString() const; + + /*! + * Returns the text encoding that will be used in rendering this frame. + * This defaults to the type that was either specified in the constructor + * or read from the frame when parsed. + * + * \see setTextEncoding() + * \see render() + */ + String::Type textEncoding() const; + + /*! + * Sets the text encoding to be used when rendering this frame to + * \a encoding. + * + * \see textEncoding() + * \see render() + */ + void setTextEncoding(String::Type encoding); + + /*! + * Returns a list of the strings in this frame. + */ + StringList fieldList() const; + + protected: + // Reimplementations. + + virtual void parseFields(const ByteVector &data); + virtual ByteVector renderFields() const; + + /*! + * The constructor used by the FrameFactory. + */ + TextIdentificationFrame(const ByteVector &data, Header *h); + + private: + TextIdentificationFrame(const TextIdentificationFrame &); + TextIdentificationFrame &operator=(const TextIdentificationFrame &); + + class TextIdentificationFramePrivate; + TextIdentificationFramePrivate *d; + }; + + /*! + * This is a specialization of text identification frames that allows for + * user defined entries. Each entry has a description in addition to the + * normal list of fields that a text identification frame has. + * + * This description identifies the frame and must be unique. + */ + + //! An ID3v2 custom text identification frame implementationx + + class UserTextIdentificationFrame : public TextIdentificationFrame + { + friend class FrameFactory; + + public: + /*! + * Constructs an empty user defined text identification frame. For this to be + * a useful frame both a description and text must be set. + */ + explicit UserTextIdentificationFrame(String::Type encoding = String::Latin1); + + /*! + * Creates a frame based on \a data. + */ + explicit UserTextIdentificationFrame(const ByteVector &data); + + virtual String toString() const; + + /*! + * Returns the description for this frame. + */ + String description() const; + + /*! + * Sets the description of the frame to \a s. \a s must be unique. You can + * check for the presense of another user defined text frame of the same type + * using find() and testing for null. + */ + void setDescription(const String &s); + + StringList fieldList() const; + void setText(const String &text); + void setText(const StringList &fields); + + /*! + * Searches for the user defined text frame with the description \a description + * in \a tag. This returns null if no matching frames were found. + */ + static UserTextIdentificationFrame *find(Tag *tag, const String &description); + + private: + UserTextIdentificationFrame(const ByteVector &data, Header *h); + UserTextIdentificationFrame(const TextIdentificationFrame &); + UserTextIdentificationFrame &operator=(const UserTextIdentificationFrame &); + + class UserTextIdentificationFramePrivate; + UserTextIdentificationFramePrivate *d; + }; + + } +} +#endif diff --git a/Libraries/TagLib/Files/taglib/mpeg/id3v2/frames/uniquefileidentifierframe.cpp b/Libraries/TagLib/Files/taglib/mpeg/id3v2/frames/uniquefileidentifierframe.cpp new file mode 100644 index 000000000..0eee906c0 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/mpeg/id3v2/frames/uniquefileidentifierframe.cpp @@ -0,0 +1,107 @@ +/*************************************************************************** + copyright : (C) 2004 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#include + +#include "uniquefileidentifierframe.h" + +using namespace TagLib; +using namespace ID3v2; + +class UniqueFileIdentifierFrame::UniqueFileIdentifierFramePrivate +{ +public: + String owner; + ByteVector identifier; +}; + +//////////////////////////////////////////////////////////////////////////////// +// public methods +//////////////////////////////////////////////////////////////////////////////// + +UniqueFileIdentifierFrame::UniqueFileIdentifierFrame(const ByteVector &data) : + ID3v2::Frame(data) +{ + d = new UniqueFileIdentifierFramePrivate; + setData(data); +} + +UniqueFileIdentifierFrame::UniqueFileIdentifierFrame(const String &owner, const ByteVector &id) : + ID3v2::Frame("UFID") +{ + d = new UniqueFileIdentifierFramePrivate; + d->owner = owner; + d->identifier = id; +} + +String UniqueFileIdentifierFrame::owner() const +{ + return d->owner; +} + +ByteVector UniqueFileIdentifierFrame::identifier() const +{ + return d->identifier; +} + +void UniqueFileIdentifierFrame::setOwner(const String &s) +{ + d->owner = s; +} + +void UniqueFileIdentifierFrame::setIdentifier(const ByteVector &v) +{ + d->identifier = v; +} + +String UniqueFileIdentifierFrame::toString() const +{ + return String::null; +} + +void UniqueFileIdentifierFrame::parseFields(const ByteVector &data) +{ + ByteVectorList fields = ByteVectorList::split(data, char(0)); + + if(fields.size() != 2) + return; + + d->owner = fields.front(); + d->identifier = fields.back(); +} + +ByteVector UniqueFileIdentifierFrame::renderFields() const +{ + ByteVector data; + + data.append(d->owner.data(String::Latin1)); + data.append(char(0)); + data.append(d->identifier); + + return data; +} + +UniqueFileIdentifierFrame::UniqueFileIdentifierFrame(const ByteVector &data, Header *h) : + Frame(h) +{ + d = new UniqueFileIdentifierFramePrivate; + parseFields(fieldData(data)); +} diff --git a/Libraries/TagLib/Files/taglib/mpeg/id3v2/frames/uniquefileidentifierframe.h b/Libraries/TagLib/Files/taglib/mpeg/id3v2/frames/uniquefileidentifierframe.h new file mode 100644 index 000000000..a8bbfe8cb --- /dev/null +++ b/Libraries/TagLib/Files/taglib/mpeg/id3v2/frames/uniquefileidentifierframe.h @@ -0,0 +1,101 @@ +/*************************************************************************** + copyright : (C) 2004 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#ifndef TAGLIB_UNIQUEFILEIDENTIFIERFRAME +#define TAGLIB_UNIQUEFILEIDENTIFIERFRAME + +#include + +namespace TagLib { + + namespace ID3v2 { + + /*! + * This is an implementation of ID3v2 unique file identifier frames. This + * frame is used to identify the file in an arbitrary database identified + * by the owner field. + */ + + //! An implementation of ID3v2 unique identifier frames + + class UniqueFileIdentifierFrame : public ID3v2::Frame + { + friend class FrameFactory; + + public: + /*! + * Creates a uniqe file identifier frame based on \a data. + */ + UniqueFileIdentifierFrame(const ByteVector &data); + + /*! + * Creates a unique file identifier frame with the owner \a owner and + * the identification \a id. + */ + UniqueFileIdentifierFrame(const String &owner, const ByteVector &id); + + /*! + * Returns the owner for the frame; essentially this is the key for + * determining which identification scheme this key belongs to. This + * will usually either be an email address or URL for the person or tool + * used to create the unique identifier. + * + * \see setOwner() + */ + String owner() const; + + /*! + * Returns the unique identifier. Though sometimes this is a text string + * it also may be binary data and as much should be assumed when handling + * it. + */ + ByteVector identifier() const; + + /*! + * Sets the owner of the identification scheme to \a s. + * + * \see owner() + */ + void setOwner(const String &s); + + /*! + * Sets the unique file identifier to \a v. + * + * \see identifier() + */ + void setIdentifier(const ByteVector &v); + + virtual String toString() const; + + protected: + virtual void parseFields(const ByteVector &data); + virtual ByteVector renderFields() const; + + private: + UniqueFileIdentifierFrame(const ByteVector &data, Header *h); + + class UniqueFileIdentifierFramePrivate; + UniqueFileIdentifierFramePrivate *d; + }; + } +} + +#endif diff --git a/Libraries/TagLib/Files/taglib/mpeg/id3v2/frames/unknownframe.cpp b/Libraries/TagLib/Files/taglib/mpeg/id3v2/frames/unknownframe.cpp new file mode 100644 index 000000000..0f4ed2e82 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/mpeg/id3v2/frames/unknownframe.cpp @@ -0,0 +1,80 @@ +/*************************************************************************** + copyright : (C) 2002 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#include "unknownframe.h" + +using namespace TagLib; +using namespace ID3v2; + +class UnknownFrame::UnknownFramePrivate +{ +public: + ByteVector fieldData; +}; + +//////////////////////////////////////////////////////////////////////////////// +// public members +//////////////////////////////////////////////////////////////////////////////// + +UnknownFrame::UnknownFrame(const ByteVector &data) : Frame(data) +{ + d = new UnknownFramePrivate; + setData(data); +} + +UnknownFrame::~UnknownFrame() +{ + delete d; +} + +String UnknownFrame::toString() const +{ + return String::null; +} + +ByteVector UnknownFrame::data() const +{ + return d->fieldData; +} + +//////////////////////////////////////////////////////////////////////////////// +// protected members +//////////////////////////////////////////////////////////////////////////////// + +void UnknownFrame::parseFields(const ByteVector &data) +{ + d->fieldData = data; +} + +ByteVector UnknownFrame::renderFields() const +{ + return d->fieldData; +} + +//////////////////////////////////////////////////////////////////////////////// +// private members +//////////////////////////////////////////////////////////////////////////////// + +UnknownFrame::UnknownFrame(const ByteVector &data, Header *h) : Frame(h) +{ + d = new UnknownFramePrivate; + parseFields(fieldData(data)); +} diff --git a/Libraries/TagLib/Files/taglib/mpeg/id3v2/frames/unknownframe.h b/Libraries/TagLib/Files/taglib/mpeg/id3v2/frames/unknownframe.h new file mode 100644 index 000000000..21de8263c --- /dev/null +++ b/Libraries/TagLib/Files/taglib/mpeg/id3v2/frames/unknownframe.h @@ -0,0 +1,74 @@ +/*************************************************************************** + copyright : (C) 2002 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#ifndef TAGLIB_UNKNOWNFRAME_H +#define TAGLIB_UNKNOWNFRAME_H + +#include + +namespace TagLib { + + namespace ID3v2 { + + //! A frame type \e unknown to TagLib. + + /*! + * This class represents a frame type not known (or more often simply + * unimplemented) in TagLib. This is here provide a basic API for + * manipulating the binary data of unknown frames and to provide a means + * of rendering such \e unknown frames. + * + * Please note that a cleaner way of handling frame types that TagLib + * does not understand is to subclass ID3v2::Frame and ID3v2::FrameFactory + * to have your frame type supported through the standard ID3v2 mechanism. + */ + + class UnknownFrame : public Frame + { + friend class FrameFactory; + + public: + UnknownFrame(const ByteVector &data); + virtual ~UnknownFrame(); + + virtual String toString() const; + + /*! + * Returns the field data (everything but the header) for this frame. + */ + ByteVector data() const; + + protected: + virtual void parseFields(const ByteVector &data); + virtual ByteVector renderFields() const; + + private: + UnknownFrame(const ByteVector &data, Header *h); + UnknownFrame(const UnknownFrame &); + UnknownFrame &operator=(const UnknownFrame &); + + class UnknownFramePrivate; + UnknownFramePrivate *d; + }; + + } +} +#endif diff --git a/Libraries/TagLib/Files/taglib/mpeg/id3v2/id3v2.4.0-frames.txt b/Libraries/TagLib/Files/taglib/mpeg/id3v2/id3v2.4.0-frames.txt new file mode 100644 index 000000000..74a21bed3 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/mpeg/id3v2/id3v2.4.0-frames.txt @@ -0,0 +1,1734 @@ +$Id$ + +Informal standard M. Nilsson +Document: id3v2.4.0-frames.txt 1st November 2000 + + + ID3 tag version 2.4.0 - Native Frames + +Status of this document + + This document is an informal standard and replaces the ID3v2.3.0 + standard [ID3v2]. A formal standard will use another revision number + even if the content is identical to document. The contents in this + document may change for clarifications but never for added or altered + functionallity. + + Distribution of this document is unlimited. + + +Abstract + + This document describes the frames natively supported by ID3v2.4.0, + which is a revised version of the ID3v2 informal standard [ID3v2.3.0] + version 2.3.0. The ID3v2 offers a flexible way of storing audio meta + information within audio file itself. The information may be + technical information, such as equalisation curves, as well as title, + performer, copyright etc. + + ID3v2.4.0 is meant to be as close as possible to ID3v2.3.0 in order + to allow for implementations to be revised as easily as possible. + + +1. Table of contents + + 2. Conventions in this document + 3. Default flags + 4. Declared ID3v2 frames + 4.1. Unique file identifier + 4.2. Text information frames + 4.2.1. Identification frames + 4.2.2. Involved persons frames + 4.2.3. Derived and subjective properties frames + 4.2.4. Rights and license frames + 4.2.5. Other text frames + 4.2.6. User defined text information frame + 4.3. URL link frames + 4.3.1. URL link frames - details + 4.3.2. User defined URL link frame + 4.4. Music CD Identifier + 4.5. Event timing codes + 4.6. MPEG location lookup table + 4.7. Synced tempo codes + 4.8. Unsynchronised lyrics/text transcription + 4.9. Synchronised lyrics/text + 4.10. Comments + 4.11. Relative volume adjustment (2) + 4.12. Equalisation (2) + 4.13. Reverb + 4.14. Attached picture + 4.15. General encapsulated object + 4.16. Play counter + 4.17. Popularimeter + 4.18. Recommended buffer size + 4.19. Audio encryption + 4.20. Linked information + 4.21. Position synchronisation frame + 4.22. Terms of use + 4.23. Ownership frame + 4.24. Commercial frame + 4.25. Encryption method registration + 4.26. Group identification registration + 4.27. Private frame + 4.28. Signature frame + 4.29. Seek frame + 4.30. Audio seek point index + 5. Copyright + 6. References + 7. Appendix + A. Appendix A - Genre List from ID3v1 + 8. Author's Address + + +2. Conventions in this document + + Text within "" is a text string exactly as it appears in a tag. + Numbers preceded with $ are hexadecimal and numbers preceded with % + are binary. $xx is used to indicate a byte with unknown content. %x + is used to indicate a bit with unknown content. The most significant + bit (MSB) of a byte is called 'bit 7' and the least significant bit + (LSB) is called 'bit 0'. + + A tag is the whole tag described the ID3v2 main structure document + [ID3v2-strct]. A frame is a block of information in the tag. The tag + consists of a header, frames and optional padding. A field is a piece + of information; one value, a string etc. A numeric string is a string + that consists of the characters "0123456789" only. + + The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", + "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this + document are to be interpreted as described in RFC 2119 [KEYWORDS]. + + +3. Default flags + + The default settings for the frames described in this document can be + divided into the following classes. The flags may be set differently + if found more suitable by the software. + + 1. Discarded if tag is altered, discarded if file is altered. + + None. + + 2. Discarded if tag is altered, preserved if file is altered. + + None. + + 3. Preserved if tag is altered, discarded if file is altered. + + ASPI, AENC, ETCO, EQU2, MLLT, POSS, SEEK, SYLT, SYTC, RVA2, TENC, + TLEN + + 4. Preserved if tag is altered, preserved if file is altered. + + The rest of the frames. + + +4. Declared ID3v2 frames + + The following frames are declared in this draft. + + 4.19 AENC Audio encryption + 4.14 APIC Attached picture + 4.30 ASPI Audio seek point index + + 4.10 COMM Comments + 4.24 COMR Commercial frame + + 4.25 ENCR Encryption method registration + 4.12 EQU2 Equalisation (2) + 4.5 ETCO Event timing codes + + 4.15 GEOB General encapsulated object + 4.26 GRID Group identification registration + + 4.20 LINK Linked information + + 4.4 MCDI Music CD identifier + 4.6 MLLT MPEG location lookup table + + 4.23 OWNE Ownership frame + + 4.27 PRIV Private frame + 4.16 PCNT Play counter + 4.17 POPM Popularimeter + 4.21 POSS Position synchronisation frame + + 4.18 RBUF Recommended buffer size + 4.11 RVA2 Relative volume adjustment (2) + 4.13 RVRB Reverb + + 4.29 SEEK Seek frame + 4.28 SIGN Signature frame + 4.9 SYLT Synchronised lyric/text + 4.7 SYTC Synchronised tempo codes + + 4.2.1 TALB Album/Movie/Show title + 4.2.3 TBPM BPM (beats per minute) + 4.2.2 TCOM Composer + 4.2.3 TCON Content type + 4.2.4 TCOP Copyright message + 4.2.5 TDEN Encoding time + 4.2.5 TDLY Playlist delay + 4.2.5 TDOR Original release time + 4.2.5 TDRC Recording time + 4.2.5 TDRL Release time + 4.2.5 TDTG Tagging time + 4.2.2 TENC Encoded by + 4.2.2 TEXT Lyricist/Text writer + 4.2.3 TFLT File type + 4.2.2 TIPL Involved people list + 4.2.1 TIT1 Content group description + 4.2.1 TIT2 Title/songname/content description + 4.2.1 TIT3 Subtitle/Description refinement + 4.2.3 TKEY Initial key + 4.2.3 TLAN Language(s) + 4.2.3 TLEN Length + 4.2.2 TMCL Musician credits list + 4.2.3 TMED Media type + 4.2.3 TMOO Mood + 4.2.1 TOAL Original album/movie/show title + 4.2.5 TOFN Original filename + 4.2.2 TOLY Original lyricist(s)/text writer(s) + 4.2.2 TOPE Original artist(s)/performer(s) + 4.2.4 TOWN File owner/licensee + 4.2.2 TPE1 Lead performer(s)/Soloist(s) + 4.2.2 TPE2 Band/orchestra/accompaniment + 4.2.2 TPE3 Conductor/performer refinement + 4.2.2 TPE4 Interpreted, remixed, or otherwise modified by + 4.2.1 TPOS Part of a set + 4.2.4 TPRO Produced notice + 4.2.4 TPUB Publisher + 4.2.1 TRCK Track number/Position in set + 4.2.4 TRSN Internet radio station name + 4.2.4 TRSO Internet radio station owner + 4.2.5 TSOA Album sort order + 4.2.5 TSOP Performer sort order + 4.2.5 TSOT Title sort order + 4.2.1 TSRC ISRC (international standard recording code) + 4.2.5 TSSE Software/Hardware and settings used for encoding + 4.2.1 TSST Set subtitle + 4.2.2 TXXX User defined text information frame + + 4.1 UFID Unique file identifier + 4.22 USER Terms of use + 4.8 USLT Unsynchronised lyric/text transcription + + 4.3.1 WCOM Commercial information + 4.3.1 WCOP Copyright/Legal information + 4.3.1 WOAF Official audio file webpage + 4.3.1 WOAR Official artist/performer webpage + 4.3.1 WOAS Official audio source webpage + 4.3.1 WORS Official Internet radio station homepage + 4.3.1 WPAY Payment + 4.3.1 WPUB Publishers official webpage + 4.3.2 WXXX User defined URL link frame + + +4.1. Unique file identifier + + This frame's purpose is to be able to identify the audio file in a + database, that may provide more information relevant to the content. + Since standardisation of such a database is beyond this document, all + UFID frames begin with an 'owner identifier' field. It is a null- + terminated string with a URL [URL] containing an email address, or a + link to a location where an email address can be found, that belongs + to the organisation responsible for this specific database + implementation. Questions regarding the database should be sent to + the indicated email address. The URL should not be used for the + actual database queries. The string + "http://www.id3.org/dummy/ufid.html" should be used for tests. The + 'Owner identifier' must be non-empty (more than just a termination). + The 'Owner identifier' is then followed by the actual identifier, + which may be up to 64 bytes. There may be more than one "UFID" frame + in a tag, but only one with the same 'Owner identifier'. + +
+ Owner identifier $00 + Identifier + + +4.2. Text information frames + + The text information frames are often the most important frames, + containing information like artist, album and more. There may only be + one text information frame of its kind in an tag. All text + information frames supports multiple strings, stored as a null + separated list, where null is reperesented by the termination code + for the charater encoding. All text frame identifiers begin with "T". + Only text frame identifiers begin with "T", with the exception of the + "TXXX" frame. All the text information frames have the following + format: + +
+ Text encoding $xx + Information + + +4.2.1. Identification frames + + TIT1 + The 'Content group description' frame is used if the sound belongs to + a larger category of sounds/music. For example, classical music is + often sorted in different musical sections (e.g. "Piano Concerto", + "Weather - Hurricane"). + + TIT2 + The 'Title/Songname/Content description' frame is the actual name of + the piece (e.g. "Adagio", "Hurricane Donna"). + + TIT3 + The 'Subtitle/Description refinement' frame is used for information + directly related to the contents title (e.g. "Op. 16" or "Performed + live at Wembley"). + + TALB + The 'Album/Movie/Show title' frame is intended for the title of the + recording (or source of sound) from which the audio in the file is + taken. + + TOAL + The 'Original album/movie/show title' frame is intended for the title + of the original recording (or source of sound), if for example the + music in the file should be a cover of a previously released song. + + TRCK + The 'Track number/Position in set' frame is a numeric string + containing the order number of the audio-file on its original + recording. This MAY be extended with a "/" character and a numeric + string containing the total number of tracks/elements on the original + recording. E.g. "4/9". + + TPOS + The 'Part of a set' frame is a numeric string that describes which + part of a set the audio came from. This frame is used if the source + described in the "TALB" frame is divided into several mediums, e.g. a + double CD. The value MAY be extended with a "/" character and a + numeric string containing the total number of parts in the set. E.g. + "1/2". + + TSST + The 'Set subtitle' frame is intended for the subtitle of the part of + a set this track belongs to. + + TSRC + The 'ISRC' frame should contain the International Standard Recording + Code [ISRC] (12 characters). + + +4.2.2. Involved persons frames + + TPE1 + The 'Lead artist/Lead performer/Soloist/Performing group' is + used for the main artist. + + TPE2 + The 'Band/Orchestra/Accompaniment' frame is used for additional + information about the performers in the recording. + + TPE3 + The 'Conductor' frame is used for the name of the conductor. + + TPE4 + The 'Interpreted, remixed, or otherwise modified by' frame contains + more information about the people behind a remix and similar + interpretations of another existing piece. + + TOPE + The 'Original artist/performer' frame is intended for the performer + of the original recording, if for example the music in the file + should be a cover of a previously released song. + + TEXT + The 'Lyricist/Text writer' frame is intended for the writer of the + text or lyrics in the recording. + + TOLY + The 'Original lyricist/text writer' frame is intended for the + text writer of the original recording, if for example the music in + the file should be a cover of a previously released song. + + TCOM + The 'Composer' frame is intended for the name of the composer. + + TMCL + The 'Musician credits list' is intended as a mapping between + instruments and the musician that played it. Every odd field is an + instrument and every even is an artist or a comma delimited list of + artists. + + TIPL + The 'Involved people list' is very similar to the musician credits + list, but maps between functions, like producer, and names. + + TENC + The 'Encoded by' frame contains the name of the person or + organisation that encoded the audio file. This field may contain a + copyright message, if the audio file also is copyrighted by the + encoder. + + +4.2.3. Derived and subjective properties frames + + TBPM + The 'BPM' frame contains the number of beats per minute in the + main part of the audio. The BPM is an integer and represented as a + numerical string. + + TLEN + The 'Length' frame contains the length of the audio file in + milliseconds, represented as a numeric string. + + TKEY + The 'Initial key' frame contains the musical key in which the sound + starts. It is represented as a string with a maximum length of three + characters. The ground keys are represented with "A","B","C","D","E", + "F" and "G" and halfkeys represented with "b" and "#". Minor is + represented as "m", e.g. "Dbm" $00. Off key is represented with an + "o" only. + + TLAN + The 'Language' frame should contain the languages of the text or + lyrics spoken or sung in the audio. The language is represented with + three characters according to ISO-639-2 [ISO-639-2]. If more than one + language is used in the text their language codes should follow + according to the amount of their usage, e.g. "eng" $00 "sve" $00. + + TCON + The 'Content type', which ID3v1 was stored as a one byte numeric + value only, is now a string. You may use one or several of the ID3v1 + types as numerical strings, or, since the category list would be + impossible to maintain with accurate and up to date categories, + define your own. Example: "21" $00 "Eurodisco" $00 + + You may also use any of the following keywords: + + RX Remix + CR Cover + + TFLT + The 'File type' frame indicates which type of audio this tag defines. + The following types and refinements are defined: + + MIME MIME type follows + MPG MPEG Audio + /1 MPEG 1/2 layer I + /2 MPEG 1/2 layer II + /3 MPEG 1/2 layer III + /2.5 MPEG 2.5 + /AAC Advanced audio compression + VQF Transform-domain Weighted Interleave Vector Quantisation + PCM Pulse Code Modulated audio + + but other types may be used, but not for these types though. This is + used in a similar way to the predefined types in the "TMED" frame, + but without parentheses. If this frame is not present audio type is + assumed to be "MPG". + + TMED + The 'Media type' frame describes from which media the sound + originated. This may be a text string or a reference to the + predefined media types found in the list below. Example: + "VID/PAL/VHS" $00. + + DIG Other digital media + /A Analogue transfer from media + + ANA Other analogue media + /WAC Wax cylinder + /8CA 8-track tape cassette + + CD CD + /A Analogue transfer from media + /DD DDD + /AD ADD + /AA AAD + + LD Laserdisc + + TT Turntable records + /33 33.33 rpm + /45 45 rpm + /71 71.29 rpm + /76 76.59 rpm + /78 78.26 rpm + /80 80 rpm + + MD MiniDisc + /A Analogue transfer from media + + DAT DAT + /A Analogue transfer from media + /1 standard, 48 kHz/16 bits, linear + /2 mode 2, 32 kHz/16 bits, linear + /3 mode 3, 32 kHz/12 bits, non-linear, low speed + /4 mode 4, 32 kHz/12 bits, 4 channels + /5 mode 5, 44.1 kHz/16 bits, linear + /6 mode 6, 44.1 kHz/16 bits, 'wide track' play + + DCC DCC + /A Analogue transfer from media + + DVD DVD + /A Analogue transfer from media + + TV Television + /PAL PAL + /NTSC NTSC + /SECAM SECAM + + VID Video + /PAL PAL + /NTSC NTSC + /SECAM SECAM + /VHS VHS + /SVHS S-VHS + /BETA BETAMAX + + RAD Radio + /FM FM + /AM AM + /LW LW + /MW MW + + TEL Telephone + /I ISDN + + MC MC (normal cassette) + /4 4.75 cm/s (normal speed for a two sided cassette) + /9 9.5 cm/s + /I Type I cassette (ferric/normal) + /II Type II cassette (chrome) + /III Type III cassette (ferric chrome) + /IV Type IV cassette (metal) + + REE Reel + /9 9.5 cm/s + /19 19 cm/s + /38 38 cm/s + /76 76 cm/s + /I Type I cassette (ferric/normal) + /II Type II cassette (chrome) + /III Type III cassette (ferric chrome) + /IV Type IV cassette (metal) + + TMOO + The 'Mood' frame is intended to reflect the mood of the audio with a + few keywords, e.g. "Romantic" or "Sad". + + +4.2.4. Rights and license frames + + TCOP + The 'Copyright message' frame, in which the string must begin with a + year and a space character (making five characters), is intended for + the copyright holder of the original sound, not the audio file + itself. The absence of this frame means only that the copyright + information is unavailable or has been removed, and must not be + interpreted to mean that the audio is public domain. Every time this + field is displayed the field must be preceded with "Copyright " (C) " + ", where (C) is one character showing a C in a circle. + + TPRO + The 'Produced notice' frame, in which the string must begin with a + year and a space character (making five characters), is intended for + the production copyright holder of the original sound, not the audio + file itself. The absence of this frame means only that the production + copyright information is unavailable or has been removed, and must + not be interpreted to mean that the audio is public domain. Every + time this field is displayed the field must be preceded with + "Produced " (P) " ", where (P) is one character showing a P in a + circle. + + TPUB + The 'Publisher' frame simply contains the name of the label or + publisher. + + TOWN + The 'File owner/licensee' frame contains the name of the owner or + licensee of the file and it's contents. + + TRSN + The 'Internet radio station name' frame contains the name of the + internet radio station from which the audio is streamed. + + TRSO + The 'Internet radio station owner' frame contains the name of the + owner of the internet radio station from which the audio is + streamed. + +4.2.5. Other text frames + + TOFN + The 'Original filename' frame contains the preferred filename for the + file, since some media doesn't allow the desired length of the + filename. The filename is case sensitive and includes its suffix. + + TDLY + The 'Playlist delay' defines the numbers of milliseconds of silence + that should be inserted before this audio. The value zero indicates + that this is a part of a multifile audio track that should be played + continuously. + + TDEN + The 'Encoding time' frame contains a timestamp describing when the + audio was encoded. Timestamp format is described in the ID3v2 + structure document [ID3v2-strct]. + + TDOR + The 'Original release time' frame contains a timestamp describing + when the original recording of the audio was released. Timestamp + format is described in the ID3v2 structure document [ID3v2-strct]. + + TDRC + The 'Recording time' frame contains a timestamp describing when the + audio was recorded. Timestamp format is described in the ID3v2 + structure document [ID3v2-strct]. + + TDRL + The 'Release time' frame contains a timestamp describing when the + audio was first released. Timestamp format is described in the ID3v2 + structure document [ID3v2-strct]. + + TDTG + The 'Tagging time' frame contains a timestamp describing then the + audio was tagged. Timestamp format is described in the ID3v2 + structure document [ID3v2-strct]. + + TSSE + The 'Software/Hardware and settings used for encoding' frame + includes the used audio encoder and its settings when the file was + encoded. Hardware refers to hardware encoders, not the computer on + which a program was run. + + TSOA + The 'Album sort order' frame defines a string which should be used + instead of the album name (TALB) for sorting purposes. E.g. an album + named "A Soundtrack" might preferably be sorted as "Soundtrack". + + TSOP + The 'Performer sort order' frame defines a string which should be + used instead of the performer (TPE2) for sorting purposes. + + TSOT + The 'Title sort order' frame defines a string which should be used + instead of the title (TIT2) for sorting purposes. + + +4.2.6. User defined text information frame + + This frame is intended for one-string text information concerning the + audio file in a similar way to the other "T"-frames. The frame body + consists of a description of the string, represented as a terminated + string, followed by the actual string. There may be more than one + "TXXX" frame in each tag, but only one with the same description. + +
+ Text encoding $xx + Description $00 (00) + Value + + +4.3. URL link frames + + With these frames dynamic data such as webpages with touring + information, price information or plain ordinary news can be added to + the tag. There may only be one URL [URL] link frame of its kind in an + tag, except when stated otherwise in the frame description. If the + text string is followed by a string termination, all the following + information should be ignored and not be displayed. All URL link + frame identifiers begins with "W". Only URL link frame identifiers + begins with "W", except for "WXXX". All URL link frames have the + following format: + +
+ URL + + +4.3.1. URL link frames - details + + WCOM + The 'Commercial information' frame is a URL pointing at a webpage + with information such as where the album can be bought. There may be + more than one "WCOM" frame in a tag, but not with the same content. + + WCOP + The 'Copyright/Legal information' frame is a URL pointing at a + webpage where the terms of use and ownership of the file is + described. + + WOAF + The 'Official audio file webpage' frame is a URL pointing at a file + specific webpage. + + WOAR + The 'Official artist/performer webpage' frame is a URL pointing at + the artists official webpage. There may be more than one "WOAR" frame + in a tag if the audio contains more than one performer, but not with + the same content. + + WOAS + The 'Official audio source webpage' frame is a URL pointing at the + official webpage for the source of the audio file, e.g. a movie. + + WORS + The 'Official Internet radio station homepage' contains a URL + pointing at the homepage of the internet radio station. + + WPAY + The 'Payment' frame is a URL pointing at a webpage that will handle + the process of paying for this file. + + WPUB + The 'Publishers official webpage' frame is a URL pointing at the + official webpage for the publisher. + + +4.3.2. User defined URL link frame + + This frame is intended for URL [URL] links concerning the audio file + in a similar way to the other "W"-frames. The frame body consists + of a description of the string, represented as a terminated string, + followed by the actual URL. The URL is always encoded with ISO-8859-1 + [ISO-8859-1]. There may be more than one "WXXX" frame in each tag, + but only one with the same description. + +
+ Text encoding $xx + Description $00 (00) + URL + + +4.4. Music CD identifier + + This frame is intended for music that comes from a CD, so that the CD + can be identified in databases such as the CDDB [CDDB]. The frame + consists of a binary dump of the Table Of Contents, TOC, from the CD, + which is a header of 4 bytes and then 8 bytes/track on the CD plus 8 + bytes for the 'lead out', making a maximum of 804 bytes. The offset + to the beginning of every track on the CD should be described with a + four bytes absolute CD-frame address per track, and not with absolute + time. When this frame is used the presence of a valid "TRCK" frame is + REQUIRED, even if the CD's only got one track. It is recommended that + this frame is always added to tags originating from CDs. There may + only be one "MCDI" frame in each tag. + +
+ CD TOC + + +4.5. Event timing codes + + This frame allows synchronisation with key events in the audio. The + header is: + +
+ Time stamp format $xx + + Where time stamp format is: + + $01 Absolute time, 32 bit sized, using MPEG [MPEG] frames as unit + $02 Absolute time, 32 bit sized, using milliseconds as unit + + Absolute time means that every stamp contains the time from the + beginning of the file. + + Followed by a list of key events in the following format: + + Type of event $xx + Time stamp $xx (xx ...) + + The 'Time stamp' is set to zero if directly at the beginning of the + sound or after the previous event. All events MUST be sorted in + chronological order. The type of event is as follows: + + $00 padding (has no meaning) + $01 end of initial silence + $02 intro start + $03 main part start + $04 outro start + $05 outro end + $06 verse start + $07 refrain start + $08 interlude start + $09 theme start + $0A variation start + $0B key change + $0C time change + $0D momentary unwanted noise (Snap, Crackle & Pop) + $0E sustained noise + $0F sustained noise end + $10 intro end + $11 main part end + $12 verse end + $13 refrain end + $14 theme end + $15 profanity + $16 profanity end + + $17-$DF reserved for future use + + $E0-$EF not predefined synch 0-F + + $F0-$FC reserved for future use + + $FD audio end (start of silence) + $FE audio file ends + $FF one more byte of events follows (all the following bytes with + the value $FF have the same function) + + Terminating the start events such as "intro start" is OPTIONAL. The + 'Not predefined synch's ($E0-EF) are for user events. You might want + to synchronise your music to something, like setting off an explosion + on-stage, activating a screensaver etc. + + There may only be one "ETCO" frame in each tag. + + +4.6. MPEG location lookup table + + To increase performance and accuracy of jumps within a MPEG [MPEG] + audio file, frames with time codes in different locations in the file + might be useful. This ID3v2 frame includes references that the + software can use to calculate positions in the file. After the frame + header follows a descriptor of how much the 'frame counter' should be + increased for every reference. If this value is two then the first + reference points out the second frame, the 2nd reference the 4th + frame, the 3rd reference the 6th frame etc. In a similar way the + 'bytes between reference' and 'milliseconds between reference' points + out bytes and milliseconds respectively. + + Each reference consists of two parts; a certain number of bits, as + defined in 'bits for bytes deviation', that describes the difference + between what is said in 'bytes between reference' and the reality and + a certain number of bits, as defined in 'bits for milliseconds + deviation', that describes the difference between what is said in + 'milliseconds between reference' and the reality. The number of bits + in every reference, i.e. 'bits for bytes deviation'+'bits for + milliseconds deviation', must be a multiple of four. There may only + be one "MLLT" frame in each tag. + +
+ MPEG frames between reference $xx xx + Bytes between reference $xx xx xx + Milliseconds between reference $xx xx xx + Bits for bytes deviation $xx + Bits for milliseconds dev. $xx + + Then for every reference the following data is included; + + Deviation in bytes %xxx.... + Deviation in milliseconds %xxx.... + + +4.7. Synchronised tempo codes + + For a more accurate description of the tempo of a musical piece, this + frame might be used. After the header follows one byte describing + which time stamp format should be used. Then follows one or more + tempo codes. Each tempo code consists of one tempo part and one time + part. The tempo is in BPM described with one or two bytes. If the + first byte has the value $FF, one more byte follows, which is added + to the first giving a range from 2 - 510 BPM, since $00 and $01 is + reserved. $00 is used to describe a beat-free time period, which is + not the same as a music-free time period. $01 is used to indicate one + single beat-stroke followed by a beat-free period. + + The tempo descriptor is followed by a time stamp. Every time the + tempo in the music changes, a tempo descriptor may indicate this for + the player. All tempo descriptors MUST be sorted in chronological + order. The first beat-stroke in a time-period is at the same time as + the beat description occurs. There may only be one "SYTC" frame in + each tag. + +
+ Time stamp format $xx + Tempo data + + Where time stamp format is: + + $01 Absolute time, 32 bit sized, using MPEG [MPEG] frames as unit + $02 Absolute time, 32 bit sized, using milliseconds as unit + + Absolute time means that every stamp contains the time from the + beginning of the file. + + +4.8. Unsynchronised lyrics/text transcription + + This frame contains the lyrics of the song or a text transcription of + other vocal activities. The head includes an encoding descriptor and + a content descriptor. The body consists of the actual text. The + 'Content descriptor' is a terminated string. If no descriptor is + entered, 'Content descriptor' is $00 (00) only. Newline characters + are allowed in the text. There may be more than one 'Unsynchronised + lyrics/text transcription' frame in each tag, but only one with the + same language and content descriptor. + +
+ Text encoding $xx + Language $xx xx xx + Content descriptor $00 (00) + Lyrics/text + + +4.9. Synchronised lyrics/text + + This is another way of incorporating the words, said or sung lyrics, + in the audio file as text, this time, however, in sync with the + audio. It might also be used to describing events e.g. occurring on a + stage or on the screen in sync with the audio. The header includes a + content descriptor, represented with as terminated text string. If no + descriptor is entered, 'Content descriptor' is $00 (00) only. + +
+ Text encoding $xx + Language $xx xx xx + Time stamp format $xx + Content type $xx + Content descriptor $00 (00) + + Content type: $00 is other + $01 is lyrics + $02 is text transcription + $03 is movement/part name (e.g. "Adagio") + $04 is events (e.g. "Don Quijote enters the stage") + $05 is chord (e.g. "Bb F Fsus") + $06 is trivia/'pop up' information + $07 is URLs to webpages + $08 is URLs to images + + Time stamp format: + + $01 Absolute time, 32 bit sized, using MPEG [MPEG] frames as unit + $02 Absolute time, 32 bit sized, using milliseconds as unit + + Absolute time means that every stamp contains the time from the + beginning of the file. + + The text that follows the frame header differs from that of the + unsynchronised lyrics/text transcription in one major way. Each + syllable (or whatever size of text is considered to be convenient by + the encoder) is a null terminated string followed by a time stamp + denoting where in the sound file it belongs. Each sync thus has the + following structure: + + Terminated text to be synced (typically a syllable) + Sync identifier (terminator to above string) $00 (00) + Time stamp $xx (xx ...) + + The 'time stamp' is set to zero or the whole sync is omitted if + located directly at the beginning of the sound. All time stamps + should be sorted in chronological order. The sync can be considered + as a validator of the subsequent string. + + Newline characters are allowed in all "SYLT" frames and MUST be used + after every entry (name, event etc.) in a frame with the content type + $03 - $04. + + A few considerations regarding whitespace characters: Whitespace + separating words should mark the beginning of a new word, thus + occurring in front of the first syllable of a new word. This is also + valid for new line characters. A syllable followed by a comma should + not be broken apart with a sync (both the syllable and the comma + should be before the sync). + + An example: The "USLT" passage + + "Strangers in the night" $0A "Exchanging glances" + + would be "SYLT" encoded as: + + "Strang" $00 xx xx "ers" $00 xx xx " in" $00 xx xx " the" $00 xx xx + " night" $00 xx xx 0A "Ex" $00 xx xx "chang" $00 xx xx "ing" $00 xx + xx "glan" $00 xx xx "ces" $00 xx xx + + There may be more than one "SYLT" frame in each tag, but only one + with the same language and content descriptor. + + +4.10. Comments + + This frame is intended for any kind of full text information that + does not fit in any other frame. It consists of a frame header + followed by encoding, language and content descriptors and is ended + with the actual comment as a text string. Newline characters are + allowed in the comment text string. There may be more than one + comment frame in each tag, but only one with the same language and + content descriptor. + +
+ Text encoding $xx + Language $xx xx xx + Short content descrip. $00 (00) + The actual text + + +4.11. Relative volume adjustment (2) + + This is a more subjective frame than the previous ones. It allows the + user to say how much he wants to increase/decrease the volume on each + channel when the file is played. The purpose is to be able to align + all files to a reference volume, so that you don't have to change the + volume constantly. This frame may also be used to balance adjust the + audio. The volume adjustment is encoded as a fixed point decibel + value, 16 bit signed integer representing (adjustment*512), giving + +/- 64 dB with a precision of 0.001953125 dB. E.g. +2 dB is stored as + $04 00 and -2 dB is $FC 00. There may be more than one "RVA2" frame + in each tag, but only one with the same identification string. + +
+ Identification $00 + + The 'identification' string is used to identify the situation and/or + device where this adjustment should apply. The following is then + repeated for every channel + + Type of channel $xx + Volume adjustment $xx xx + Bits representing peak $xx + Peak volume $xx (xx ...) + + + Type of channel: $00 Other + $01 Master volume + $02 Front right + $03 Front left + $04 Back right + $05 Back left + $06 Front centre + $07 Back centre + $08 Subwoofer + + Bits representing peak can be any number between 0 and 255. 0 means + that there is no peak volume field. The peak volume field is always + padded to whole bytes, setting the most significant bits to zero. + + +4.12. Equalisation (2) + + This is another subjective, alignment frame. It allows the user to + predefine an equalisation curve within the audio file. There may be + more than one "EQU2" frame in each tag, but only one with the same + identification string. + +
+ Interpolation method $xx + Identification $00 + + The 'interpolation method' describes which method is preferred when + an interpolation between the adjustment point that follows. The + following methods are currently defined: + + $00 Band + No interpolation is made. A jump from one adjustment level to + another occurs in the middle between two adjustment points. + $01 Linear + Interpolation between adjustment points is linear. + + The 'identification' string is used to identify the situation and/or + device where this adjustment should apply. The following is then + repeated for every adjustment point + + Frequency $xx xx + Volume adjustment $xx xx + + The frequency is stored in units of 1/2 Hz, giving it a range from 0 + to 32767 Hz. + + The volume adjustment is encoded as a fixed point decibel value, 16 + bit signed integer representing (adjustment*512), giving +/- 64 dB + with a precision of 0.001953125 dB. E.g. +2 dB is stored as $04 00 + and -2 dB is $FC 00. + + Adjustment points should be ordered by frequency and one frequency + should only be described once in the frame. + + +4.13. Reverb + + Yet another subjective frame, with which you can adjust echoes of + different kinds. Reverb left/right is the delay between every bounce + in ms. Reverb bounces left/right is the number of bounces that should + be made. $FF equals an infinite number of bounces. Feedback is the + amount of volume that should be returned to the next echo bounce. $00 + is 0%, $FF is 100%. If this value were $7F, there would be 50% volume + reduction on the first bounce, 50% of that on the second and so on. + Left to left means the sound from the left bounce to be played in the + left speaker, while left to right means sound from the left bounce to + be played in the right speaker. + + 'Premix left to right' is the amount of left sound to be mixed in the + right before any reverb is applied, where $00 id 0% and $FF is 100%. + 'Premix right to left' does the same thing, but right to left. + Setting both premix to $FF would result in a mono output (if the + reverb is applied symmetric). There may only be one "RVRB" frame in + each tag. + +
+ Reverb left (ms) $xx xx + Reverb right (ms) $xx xx + Reverb bounces, left $xx + Reverb bounces, right $xx + Reverb feedback, left to left $xx + Reverb feedback, left to right $xx + Reverb feedback, right to right $xx + Reverb feedback, right to left $xx + Premix left to right $xx + Premix right to left $xx + + +4.14. Attached picture + + This frame contains a picture directly related to the audio file. + Image format is the MIME type and subtype [MIME] for the image. In + the event that the MIME media type name is omitted, "image/" will be + implied. The "image/png" [PNG] or "image/jpeg" [JFIF] picture format + should be used when interoperability is wanted. Description is a + short description of the picture, represented as a terminated + text string. There may be several pictures attached to one file, each + in their individual "APIC" frame, but only one with the same content + descriptor. There may only be one picture with the picture type + declared as picture type $01 and $02 respectively. There is the + possibility to put only a link to the image file by using the 'MIME + type' "-->" and having a complete URL [URL] instead of picture data. + The use of linked files should however be used sparingly since there + is the risk of separation of files. + +
+ Text encoding $xx + MIME type $00 + Picture type $xx + Description $00 (00) + Picture data + + + Picture type: $00 Other + $01 32x32 pixels 'file icon' (PNG only) + $02 Other file icon + $03 Cover (front) + $04 Cover (back) + $05 Leaflet page + $06 Media (e.g. label side of CD) + $07 Lead artist/lead performer/soloist + $08 Artist/performer + $09 Conductor + $0A Band/Orchestra + $0B Composer + $0C Lyricist/text writer + $0D Recording Location + $0E During recording + $0F During performance + $10 Movie/video screen capture + $11 A bright coloured fish + $12 Illustration + $13 Band/artist logotype + $14 Publisher/Studio logotype + + +4.15. General encapsulated object + + In this frame any type of file can be encapsulated. After the header, + 'Frame size' and 'Encoding' follows 'MIME type' [MIME] represented as + as a terminated string encoded with ISO 8859-1 [ISO-8859-1]. The + filename is case sensitive and is encoded as 'Encoding'. Then follows + a content description as terminated string, encoded as 'Encoding'. + The last thing in the frame is the actual object. The first two + strings may be omitted, leaving only their terminations. MIME type is + always an ISO-8859-1 text string. There may be more than one "GEOB" + frame in each tag, but only one with the same content descriptor. + +
+ Text encoding $xx + MIME type $00 + Filename $00 (00) + Content description $00 (00) + Encapsulated object + + +4.16. Play counter + + This is simply a counter of the number of times a file has been + played. The value is increased by one every time the file begins to + play. There may only be one "PCNT" frame in each tag. When the + counter reaches all one's, one byte is inserted in front of the + counter thus making the counter eight bits bigger. The counter must + be at least 32-bits long to begin with. + +
+ Counter $xx xx xx xx (xx ...) + + +4.17. Popularimeter + + The purpose of this frame is to specify how good an audio file is. + Many interesting applications could be found to this frame such as a + playlist that features better audio files more often than others or + it could be used to profile a person's taste and find other 'good' + files by comparing people's profiles. The frame contains the email + address to the user, one rating byte and a four byte play counter, + intended to be increased with one for every time the file is played. + The email is a terminated string. The rating is 1-255 where 1 is + worst and 255 is best. 0 is unknown. If no personal counter is wanted + it may be omitted. When the counter reaches all one's, one byte is + inserted in front of the counter thus making the counter eight bits + bigger in the same away as the play counter ("PCNT"). There may be + more than one "POPM" frame in each tag, but only one with the same + email address. + +
+ Email to user $00 + Rating $xx + Counter $xx xx xx xx (xx ...) + + +4.18. Recommended buffer size + + Sometimes the server from which an audio file is streamed is aware of + transmission or coding problems resulting in interruptions in the + audio stream. In these cases, the size of the buffer can be + recommended by the server using this frame. If the 'embedded info + flag' is true (1) then this indicates that an ID3 tag with the + maximum size described in 'Buffer size' may occur in the audio + stream. In such case the tag should reside between two MPEG [MPEG] + frames, if the audio is MPEG encoded. If the position of the next tag + is known, 'offset to next tag' may be used. The offset is calculated + from the end of tag in which this frame resides to the first byte of + the header in the next. This field may be omitted. Embedded tags are + generally not recommended since this could render unpredictable + behaviour from present software/hardware. + + For applications like streaming audio it might be an idea to embed + tags into the audio stream though. If the clients connects to + individual connections like HTTP and there is a possibility to begin + every transmission with a tag, then this tag should include a + 'recommended buffer size' frame. If the client is connected to a + arbitrary point in the stream, such as radio or multicast, then the + 'recommended buffer size' frame SHOULD be included in every tag. + + The 'Buffer size' should be kept to a minimum. There may only be one + "RBUF" frame in each tag. + +
+ Buffer size $xx xx xx + Embedded info flag %0000000x + Offset to next tag $xx xx xx xx + + +4.19. Audio encryption + + This frame indicates if the actual audio stream is encrypted, and by + whom. Since standardisation of such encryption scheme is beyond this + document, all "AENC" frames begin with a terminated string with a + URL containing an email address, or a link to a location where an + email address can be found, that belongs to the organisation + responsible for this specific encrypted audio file. Questions + regarding the encrypted audio should be sent to the email address + specified. If a $00 is found directly after the 'Frame size' and the + audio file indeed is encrypted, the whole file may be considered + useless. + + After the 'Owner identifier', a pointer to an unencrypted part of the + audio can be specified. The 'Preview start' and 'Preview length' is + described in frames. If no part is unencrypted, these fields should + be left zeroed. After the 'preview length' field follows optionally a + data block required for decryption of the audio. There may be more + than one "AENC" frames in a tag, but only one with the same 'Owner + identifier'. + +
+ Owner identifier $00 + Preview start $xx xx + Preview length $xx xx + Encryption info + + +4.20. Linked information + + To keep information duplication as low as possible this frame may be + used to link information from another ID3v2 tag that might reside in + another audio file or alone in a binary file. It is RECOMMENDED that + this method is only used when the files are stored on a CD-ROM or + other circumstances when the risk of file separation is low. The + frame contains a frame identifier, which is the frame that should be + linked into this tag, a URL [URL] field, where a reference to the + file where the frame is given, and additional ID data, if needed. + Data should be retrieved from the first tag found in the file to + which this link points. There may be more than one "LINK" frame in a + tag, but only one with the same contents. A linked frame is to be + considered as part of the tag and has the same restrictions as if it + was a physical part of the tag (i.e. only one "RVRB" frame allowed, + whether it's linked or not). + +
+ Frame identifier $xx xx xx xx + URL $00 + ID and additional data + + Frames that may be linked and need no additional data are "ASPI", + "ETCO", "EQU2", "MCID", "MLLT", "OWNE", "RVA2", "RVRB", "SYTC", the + text information frames and the URL link frames. + + The "AENC", "APIC", "GEOB" and "TXXX" frames may be linked with + the content descriptor as additional ID data. + + The "USER" frame may be linked with the language field as additional + ID data. + + The "PRIV" frame may be linked with the owner identifier as + additional ID data. + + The "COMM", "SYLT" and "USLT" frames may be linked with three bytes + of language descriptor directly followed by a content descriptor as + additional ID data. + + +4.21. Position synchronisation frame + + This frame delivers information to the listener of how far into the + audio stream he picked up; in effect, it states the time offset from + the first frame in the stream. The frame layout is: + + + Time stamp format $xx + Position $xx (xx ...) + + Where time stamp format is: + + $01 Absolute time, 32 bit sized, using MPEG frames as unit + $02 Absolute time, 32 bit sized, using milliseconds as unit + + and position is where in the audio the listener starts to receive, + i.e. the beginning of the next frame. If this frame is used in the + beginning of a file the value is always 0. There may only be one + "POSS" frame in each tag. + + +4.22. Terms of use frame + + This frame contains a brief description of the terms of use and + ownership of the file. More detailed information concerning the legal + terms might be available through the "WCOP" frame. Newlines are + allowed in the text. There may be more than one 'Terms of use' frame + in a tag, but only one with the same 'Language'. + +
+ Text encoding $xx + Language $xx xx xx + The actual text + + +4.23. Ownership frame + + The ownership frame might be used as a reminder of a made transaction + or, if signed, as proof. Note that the "USER" and "TOWN" frames are + good to use in conjunction with this one. The frame begins, after the + frame ID, size and encoding fields, with a 'price paid' field. The + first three characters of this field contains the currency used for + the transaction, encoded according to ISO 4217 [ISO-4217] alphabetic + currency code. Concatenated to this is the actual price paid, as a + numerical string using "." as the decimal separator. Next is an 8 + character date string (YYYYMMDD) followed by a string with the name + of the seller as the last field in the frame. There may only be one + "OWNE" frame in a tag. + +
+ Text encoding $xx + Price paid $00 + Date of purch. + Seller + + +4.24. Commercial frame + + This frame enables several competing offers in the same tag by + bundling all needed information. That makes this frame rather complex + but it's an easier solution than if one tries to achieve the same + result with several frames. The frame begins, after the frame ID, + size and encoding fields, with a price string field. A price is + constructed by one three character currency code, encoded according + to ISO 4217 [ISO-4217] alphabetic currency code, followed by a + numerical value where "." is used as decimal separator. In the price + string several prices may be concatenated, separated by a "/" + character, but there may only be one currency of each type. + + The price string is followed by an 8 character date string in the + format YYYYMMDD, describing for how long the price is valid. After + that is a contact URL, with which the user can contact the seller, + followed by a one byte 'received as' field. It describes how the + audio is delivered when bought according to the following list: + + $00 Other + $01 Standard CD album with other songs + $02 Compressed audio on CD + $03 File over the Internet + $04 Stream over the Internet + $05 As note sheets + $06 As note sheets in a book with other sheets + $07 Music on other media + $08 Non-musical merchandise + + Next follows a terminated string with the name of the seller followed + by a terminated string with a short description of the product. The + last thing is the ability to include a company logotype. The first of + them is the 'Picture MIME type' field containing information about + which picture format is used. In the event that the MIME media type + name is omitted, "image/" will be implied. Currently only "image/png" + and "image/jpeg" are allowed. This format string is followed by the + binary picture data. This two last fields may be omitted if no + picture is attached. There may be more than one 'commercial frame' in + a tag, but no two may be identical. + +
+ Text encoding $xx + Price string $00 + Valid until + Contact URL $00 + Received as $xx + Name of seller $00 (00) + Description $00 (00) + Picture MIME type $00 + Seller logo + + +4.25. Encryption method registration + + To identify with which method a frame has been encrypted the + encryption method must be registered in the tag with this frame. The + 'Owner identifier' is a null-terminated string with a URL [URL] + containing an email address, or a link to a location where an email + address can be found, that belongs to the organisation responsible + for this specific encryption method. Questions regarding the + encryption method should be sent to the indicated email address. The + 'Method symbol' contains a value that is associated with this method + throughout the whole tag, in the range $80-F0. All other values are + reserved. The 'Method symbol' may optionally be followed by + encryption specific data. There may be several "ENCR" frames in a tag + but only one containing the same symbol and only one containing the + same owner identifier. The method must be used somewhere in the tag. + See the description of the frame encryption flag in the ID3v2 + structure document [ID3v2-strct] for more information. + +
+ Owner identifier $00 + Method symbol $xx + Encryption data + + +4.26. Group identification registration + + This frame enables grouping of otherwise unrelated frames. This can + be used when some frames are to be signed. To identify which frames + belongs to a set of frames a group identifier must be registered in + the tag with this frame. The 'Owner identifier' is a null-terminated + string with a URL [URL] containing an email address, or a link to a + location where an email address can be found, that belongs to the + organisation responsible for this grouping. Questions regarding the + grouping should be sent to the indicated email address. The 'Group + symbol' contains a value that associates the frame with this group + throughout the whole tag, in the range $80-F0. All other values are + reserved. The 'Group symbol' may optionally be followed by some group + specific data, e.g. a digital signature. There may be several "GRID" + frames in a tag but only one containing the same symbol and only one + containing the same owner identifier. The group symbol must be used + somewhere in the tag. See the description of the frame grouping flag + in the ID3v2 structure document [ID3v2-strct] for more information. + +
+ Owner identifier $00 + Group symbol $xx + Group dependent data + + +4.27. Private frame + + This frame is used to contain information from a software producer + that its program uses and does not fit into the other frames. The + frame consists of an 'Owner identifier' string and the binary data. + The 'Owner identifier' is a null-terminated string with a URL [URL] + containing an email address, or a link to a location where an email + address can be found, that belongs to the organisation responsible + for the frame. Questions regarding the frame should be sent to the + indicated email address. The tag may contain more than one "PRIV" + frame but only with different contents. + +
+ Owner identifier $00 + The private data + + +4.28. Signature frame + + This frame enables a group of frames, grouped with the 'Group + identification registration', to be signed. Although signatures can + reside inside the registration frame, it might be desired to store + the signature elsewhere, e.g. in watermarks. There may be more than + one 'signature frame' in a tag, but no two may be identical. + +
+ Group symbol $xx + Signature + + +4.29. Seek frame + + This frame indicates where other tags in a file/stream can be found. + The 'minimum offset to next tag' is calculated from the end of this + tag to the beginning of the next. There may only be one 'seek frame' + in a tag. + +
+ Minimum offset to next tag $xx xx xx xx + + +4.30. Audio seek point index + + Audio files with variable bit rates are intrinsically difficult to + deal with in the case of seeking within the file. The ASPI frame + makes seeking easier by providing a list a seek points within the + audio file. The seek points are a fractional offset within the audio + data, providing a starting point from which to find an appropriate + point to start decoding. The presence of an ASPI frame requires the + existence of a TLEN frame, indicating the duration of the file in + milliseconds. There may only be one 'audio seek point index' frame in + a tag. + +
+ Indexed data start (S) $xx xx xx xx + Indexed data length (L) $xx xx xx xx + Number of index points (N) $xx xx + Bits per index point (b) $xx + + Then for every index point the following data is included; + + Fraction at index (Fi) $xx (xx) + + 'Indexed data start' is a byte offset from the beginning of the file. + 'Indexed data length' is the byte length of the audio data being + indexed. 'Number of index points' is the number of index points, as + the name implies. The recommended number is 100. 'Bits per index + point' is 8 or 16, depending on the chosen precision. 8 bits works + well for short files (less than 5 minutes of audio), while 16 bits is + advantageous for long files. 'Fraction at index' is the numerator of + the fraction representing a relative position in the data. The + denominator is 2 to the power of b. + + Here are the algorithms to be used in the calculation. The known data + must be the offset of the start of the indexed data (S), the offset + of the end of the indexed data (E), the number of index points (N), + the offset at index i (Oi). We calculate the fraction at index i + (Fi). + + Oi is the offset of the frame whose start is soonest after the point + for which the time offset is (i/N * duration). + + The frame data should be calculated as follows: + + Fi = Oi/L * 2^b (rounded down to the nearest integer) + + Offset calculation should be calculated as follows from data in the + frame: + + Oi = (Fi/2^b)*L (rounded up to the nearest integer) + + +5. Copyright + + Copyright (C) Martin Nilsson 2000. All Rights Reserved. + + This document and translations of it may be copied and furnished to + others, and derivative works that comment on or otherwise explain it + or assist in its implementation may be prepared, copied, published + and distributed, in whole or in part, without restriction of any + kind, provided that a reference to this document is included on all + such copies and derivative works. However, this document itself may + not be modified in any way and reissued as the original document. + + The limited permissions granted above are perpetual and will not be + revoked. + + This document and the information contained herein is provided on an + "AS IS" basis and THE AUTHORS DISCLAIMS ALL WARRANTIES, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF + THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED + WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + + +6. References + + [CDDB] Compact Disc Data Base + + + + [ID3v2.3.0] Martin Nilsson, "ID3v2 informal standard". + + + + [ID3v2-strct] Martin Nilsson, + "ID3 tag version 2.4.0 - Main Structure" + + + + [ISO-639-2] ISO/FDIS 639-2. + Codes for the representation of names of languages, Part 2: Alpha-3 + code. Technical committee / subcommittee: TC 37 / SC 2 + + [ISO-4217] ISO 4217:1995. + Codes for the representation of currencies and funds. + Technical committee / subcommittee: TC 68 + + [ISO-8859-1] ISO/IEC DIS 8859-1. + 8-bit single-byte coded graphic character sets, Part 1: Latin + alphabet No. 1. Technical committee / subcommittee: JTC 1 / SC 2 + + [ISRC] ISO 3901:1986 + International Standard Recording Code (ISRC). + Technical committee / subcommittee: TC 46 / SC 9 + + [JFIF] JPEG File Interchange Format, version 1.02 + + + + [KEYWORDS] S. Bradner, 'Key words for use in RFCs to Indicate + Requirement Levels', RFC 2119, March 1997. + + + + [MIME] Freed, N. and N. Borenstein, "Multipurpose Internet Mail + Extensions (MIME) Part One: Format of Internet Message Bodies", + RFC 2045, November 1996. + + + + [MPEG] ISO/IEC 11172-3:1993. + Coding of moving pictures and associated audio for digital storage + media at up to about 1,5 Mbit/s, Part 3: Audio. + Technical committee / subcommittee: JTC 1 / SC 29 + and + ISO/IEC 13818-3:1995 + Generic coding of moving pictures and associated audio information, + Part 3: Audio. + Technical committee / subcommittee: JTC 1 / SC 29 + and + ISO/IEC DIS 13818-3 + Generic coding of moving pictures and associated audio information, + Part 3: Audio (Revision of ISO/IEC 13818-3:1995) + + + [PNG] Portable Network Graphics, version 1.0 + + + + [URL] T. Berners-Lee, L. Masinter & M. McCahill, "Uniform Resource + Locators (URL).", RFC 1738, December 1994. + + + + [ZLIB] P. Deutsch, Aladdin Enterprises & J-L. Gailly, "ZLIB + Compressed + Data Format Specification version 3.3", RFC 1950, May 1996. + + + + +7. Appendix + + +A. Appendix A - Genre List from ID3v1 + + The following genres is defined in ID3v1 + + 0.Blues + 1.Classic Rock + 2.Country + 3.Dance + 4.Disco + 5.Funk + 6.Grunge + 7.Hip-Hop + 8.Jazz + 9.Metal + 10.New Age + 11.Oldies + 12.Other + 13.Pop + 14.R&B + 15.Rap + 16.Reggae + 17.Rock + 18.Techno + 19.Industrial + 20.Alternative + 21.Ska + 22.Death Metal + 23.Pranks + 24.Soundtrack + 25.Euro-Techno + 26.Ambient + 27.Trip-Hop + 28.Vocal + 29.Jazz+Funk + 30.Fusion + 31.Trance + 32.Classical + 33.Instrumental + 34.Acid + 35.House + 36.Game + 37.Sound Clip + 38.Gospel + 39.Noise + 40.AlternRock + 41.Bass + 42.Soul + 43.Punk + 44.Space + 45.Meditative + 46.Instrumental Pop + 47.Instrumental Rock + 48.Ethnic + 49.Gothic + 50.Darkwave + 51.Techno-Industrial + 52.Electronic + 53.Pop-Folk + 54.Eurodance + 55.Dream + 56.Southern Rock + 57.Comedy + 58.Cult + 59.Gangsta + 60.Top 40 + 61.Christian Rap + 62.Pop/Funk + 63.Jungle + 64.Native American + 65.Cabaret + 66.New Wave + 67.Psychadelic + 68.Rave + 69.Showtunes + 70.Trailer + 71.Lo-Fi + 72.Tribal + 73.Acid Punk + 74.Acid Jazz + 75.Polka + 76.Retro + 77.Musical + 78.Rock & Roll + 79.Hard Rock + + +8. Author's Address + + Written by + + Martin Nilsson + Rydsvägen 246 C. 30 + SE-584 34 Linköping + Sweden + + Email: nilsson@id3.org diff --git a/Libraries/TagLib/Files/taglib/mpeg/id3v2/id3v2.4.0-structure.txt b/Libraries/TagLib/Files/taglib/mpeg/id3v2/id3v2.4.0-structure.txt new file mode 100644 index 000000000..5fa156a0a --- /dev/null +++ b/Libraries/TagLib/Files/taglib/mpeg/id3v2/id3v2.4.0-structure.txt @@ -0,0 +1,733 @@ + +Informal standard M. Nilsson +Document: id3v2.4.0-structure.txt 16 September 2001 + + + ID3 tag version 2.4.0 - Main Structure + +Status of this document + + This document is an informal standard and replaces the ID3v2.3.0 + standard [ID3v2]. A formal standard will use another revision number + even if the content is identical to document. The contents in this + document may change for clarifications but never for added or altered + functionallity. + + Distribution of this document is unlimited. + + +Abstract + + This document describes the main structure of ID3v2.4.0, which is a + revised version of the ID3v2 informal standard [ID3v2] version + 2.3.0. The ID3v2 offers a flexible way of storing audio meta + information within the audio file itself. The information may be + technical information, such as equalisation curves, as well as + title, performer, copyright etc. + + ID3v2.4.0 is meant to be as close as possible to ID3v2.3.0 in order + to allow for implementations to be revised as easily as possible. + + +1. Table of contents + + Status of this document + Abstract + 1. Table of contents + 2. Conventions in this document + 2. Standard overview + 3. ID3v2 overview + 3.1. ID3v2 header + 3.2. ID3v2 extended header + 3.3. Padding + 3.4. ID3v2 footer + 4. ID3v2 frames overview + 4.1. Frame header flags + 4.1.1. Frame status flags + 4.1.2. Frame format flags + 5. Tag location + 6. Unsynchronisation + 6.1. The unsynchronisation scheme + 6.2. Synchsafe integers + 7. Copyright + 8. References + 9. Author's Address + + +2. Conventions in this document + + Text within "" is a text string exactly as it appears in a tag. + Numbers preceded with $ are hexadecimal and numbers preceded with % + are binary. $xx is used to indicate a byte with unknown content. %x + is used to indicate a bit with unknown content. The most significant + bit (MSB) of a byte is called 'bit 7' and the least significant bit + (LSB) is called 'bit 0'. + + A tag is the whole tag described in this document. A frame is a block + of information in the tag. The tag consists of a header, frames and + optional padding. A field is a piece of information; one value, a + string etc. A numeric string is a string that consists of the + characters "0123456789" only. + + The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", + "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this + document are to be interpreted as described in RFC 2119 [KEYWORDS]. + + +3. ID3v2 overview + + ID3v2 is a general tagging format for audio, which makes it possible + to store meta data about the audio inside the audio file itself. The + ID3 tag described in this document is mainly targeted at files + encoded with MPEG-1/2 layer I, MPEG-1/2 layer II, MPEG-1/2 layer III + and MPEG-2.5, but may work with other types of encoded audio or as a + stand alone format for audio meta data. + + ID3v2 is designed to be as flexible and expandable as possible to + meet new meta information needs that might arise. To achieve that + ID3v2 is constructed as a container for several information blocks, + called frames, whose format need not be known to the software that + encounters them. At the start of every frame is an unique and + predefined identifier, a size descriptor that allows software to skip + unknown frames and a flags field. The flags describes encoding + details and if the frame should remain in the tag, should it be + unknown to the software, if the file is altered. + + The bitorder in ID3v2 is most significant bit first (MSB). The + byteorder in multibyte numbers is most significant byte first (e.g. + $12345678 would be encoded $12 34 56 78), also known as big endian + and network byte order. + + Overall tag structure: + + +-----------------------------+ + | Header (10 bytes) | + +-----------------------------+ + | Extended Header | + | (variable length, OPTIONAL) | + +-----------------------------+ + | Frames (variable length) | + +-----------------------------+ + | Padding | + | (variable length, OPTIONAL) | + +-----------------------------+ + | Footer (10 bytes, OPTIONAL) | + +-----------------------------+ + + In general, padding and footer are mutually exclusive. See details in + sections 3.3, 3.4 and 5. + + +3.1. ID3v2 header + + The first part of the ID3v2 tag is the 10 byte tag header, laid out + as follows: + + ID3v2/file identifier "ID3" + ID3v2 version $04 00 + ID3v2 flags %abcd0000 + ID3v2 size 4 * %0xxxxxxx + + The first three bytes of the tag are always "ID3", to indicate that + this is an ID3v2 tag, directly followed by the two version bytes. The + first byte of ID3v2 version is its major version, while the second + byte is its revision number. In this case this is ID3v2.4.0. All + revisions are backwards compatible while major versions are not. If + software with ID3v2.4.0 and below support should encounter version + five or higher it should simply ignore the whole tag. Version or + revision will never be $FF. + + The version is followed by the ID3v2 flags field, of which currently + four flags are used. + + + a - Unsynchronisation + + Bit 7 in the 'ID3v2 flags' indicates whether or not + unsynchronisation is applied on all frames (see section 6.1 for + details); a set bit indicates usage. + + + b - Extended header + + The second bit (bit 6) indicates whether or not the header is + followed by an extended header. The extended header is described in + section 3.2. A set bit indicates the presence of an extended + header. + + + c - Experimental indicator + + The third bit (bit 5) is used as an 'experimental indicator'. This + flag SHALL always be set when the tag is in an experimental stage. + + + d - Footer present + + Bit 4 indicates that a footer (section 3.4) is present at the very + end of the tag. A set bit indicates the presence of a footer. + + + All the other flags MUST be cleared. If one of these undefined flags + are set, the tag might not be readable for a parser that does not + know the flags function. + + The ID3v2 tag size is stored as a 32 bit synchsafe integer (section + 6.2), making a total of 28 effective bits (representing up to 256MB). + + The ID3v2 tag size is the sum of the byte length of the extended + header, the padding and the frames after unsynchronisation. If a + footer is present this equals to ('total size' - 20) bytes, otherwise + ('total size' - 10) bytes. + + An ID3v2 tag can be detected with the following pattern: + $49 44 33 yy yy xx zz zz zz zz + Where yy is less than $FF, xx is the 'flags' byte and zz is less than + $80. + + +3.2. Extended header + + The extended header contains information that can provide further + insight in the structure of the tag, but is not vital to the correct + parsing of the tag information; hence the extended header is + optional. + + Extended header size 4 * %0xxxxxxx + Number of flag bytes $01 + Extended Flags $xx + + Where the 'Extended header size' is the size of the whole extended + header, stored as a 32 bit synchsafe integer. An extended header can + thus never have a size of fewer than six bytes. + + The extended flags field, with its size described by 'number of flag + bytes', is defined as: + + %0bcd0000 + + Each flag that is set in the extended header has data attached, which + comes in the order in which the flags are encountered (i.e. the data + for flag 'b' comes before the data for flag 'c'). Unset flags cannot + have any attached data. All unknown flags MUST be unset and their + corresponding data removed when a tag is modified. + + Every set flag's data starts with a length byte, which contains a + value between 0 and 127 ($00 - $7f), followed by data that has the + field length indicated by the length byte. If a flag has no attached + data, the value $00 is used as length byte. + + + b - Tag is an update + + If this flag is set, the present tag is an update of a tag found + earlier in the present file or stream. If frames defined as unique + are found in the present tag, they are to override any + corresponding ones found in the earlier tag. This flag has no + corresponding data. + + Flag data length $00 + + c - CRC data present + + If this flag is set, a CRC-32 [ISO-3309] data is included in the + extended header. The CRC is calculated on all the data between the + header and footer as indicated by the header's tag length field, + minus the extended header. Note that this includes the padding (if + there is any), but excludes the footer. The CRC-32 is stored as an + 35 bit synchsafe integer, leaving the upper four bits always + zeroed. + + Flag data length $05 + Total frame CRC 5 * %0xxxxxxx + + d - Tag restrictions + + For some applications it might be desired to restrict a tag in more + ways than imposed by the ID3v2 specification. Note that the + presence of these restrictions does not affect how the tag is + decoded, merely how it was restricted before encoding. If this flag + is set the tag is restricted as follows: + + Flag data length $01 + Restrictions %ppqrrstt + + p - Tag size restrictions + + 00 No more than 128 frames and 1 MB total tag size. + 01 No more than 64 frames and 128 KB total tag size. + 10 No more than 32 frames and 40 KB total tag size. + 11 No more than 32 frames and 4 KB total tag size. + + q - Text encoding restrictions + + 0 No restrictions + 1 Strings are only encoded with ISO-8859-1 [ISO-8859-1] or + UTF-8 [UTF-8]. + + r - Text fields size restrictions + + 00 No restrictions + 01 No string is longer than 1024 characters. + 10 No string is longer than 128 characters. + 11 No string is longer than 30 characters. + + Note that nothing is said about how many bytes is used to + represent those characters, since it is encoding dependent. If a + text frame consists of more than one string, the sum of the + strungs is restricted as stated. + + s - Image encoding restrictions + + 0 No restrictions + 1 Images are encoded only with PNG [PNG] or JPEG [JFIF]. + + t - Image size restrictions + + 00 No restrictions + 01 All images are 256x256 pixels or smaller. + 10 All images are 64x64 pixels or smaller. + 11 All images are exactly 64x64 pixels, unless required + otherwise. + + +3.3. Padding + + It is OPTIONAL to include padding after the final frame (at the end + of the ID3 tag), making the size of all the frames together smaller + than the size given in the tag header. A possible purpose of this + padding is to allow for adding a few additional frames or enlarge + existing frames within the tag without having to rewrite the entire + file. The value of the padding bytes must be $00. A tag MUST NOT have + any padding between the frames or between the tag header and the + frames. Furthermore it MUST NOT have any padding when a tag footer is + added to the tag. + + +3.4. ID3v2 footer + + To speed up the process of locating an ID3v2 tag when searching from + the end of a file, a footer can be added to the tag. It is REQUIRED + to add a footer to an appended tag, i.e. a tag located after all + audio data. The footer is a copy of the header, but with a different + identifier. + + ID3v2 identifier "3DI" + ID3v2 version $04 00 + ID3v2 flags %abcd0000 + ID3v2 size 4 * %0xxxxxxx + + +4. ID3v2 frame overview + + All ID3v2 frames consists of one frame header followed by one or more + fields containing the actual information. The header is always 10 + bytes and laid out as follows: + + Frame ID $xx xx xx xx (four characters) + Size 4 * %0xxxxxxx + Flags $xx xx + + The frame ID is made out of the characters capital A-Z and 0-9. + Identifiers beginning with "X", "Y" and "Z" are for experimental + frames and free for everyone to use, without the need to set the + experimental bit in the tag header. Bear in mind that someone else + might have used the same identifier as you. All other identifiers are + either used or reserved for future use. + + The frame ID is followed by a size descriptor containing the size of + the data in the final frame, after encryption, compression and + unsynchronisation. The size is excluding the frame header ('total + frame size' - 10 bytes) and stored as a 32 bit synchsafe integer. + + In the frame header the size descriptor is followed by two flag + bytes. These flags are described in section 4.1. + + There is no fixed order of the frames' appearance in the tag, + although it is desired that the frames are arranged in order of + significance concerning the recognition of the file. An example of + such order: UFID, TIT2, MCDI, TRCK ... + + A tag MUST contain at least one frame. A frame must be at least 1 + byte big, excluding the header. + + If nothing else is said, strings, including numeric strings and URLs + [URL], are represented as ISO-8859-1 [ISO-8859-1] characters in the + range $20 - $FF. Such strings are represented in frame descriptions + as , or if newlines are allowed. If + nothing else is said newline character is forbidden. In ISO-8859-1 a + newline is represented, when allowed, with $0A only. + + Frames that allow different types of text encoding contains a text + encoding description byte. Possible encodings: + + $00 ISO-8859-1 [ISO-8859-1]. Terminated with $00. + $01 UTF-16 [UTF-16] encoded Unicode [UNICODE] with BOM. All + strings in the same frame SHALL have the same byteorder. + Terminated with $00 00. + $02 UTF-16BE [UTF-16] encoded Unicode [UNICODE] without BOM. + Terminated with $00 00. + $03 UTF-8 [UTF-8] encoded Unicode [UNICODE]. Terminated with $00. + + Strings dependent on encoding are represented in frame descriptions + as , or if newlines are allowed. Any empty strings of + type $01 which are NULL-terminated may have the Unicode BOM followed + by a Unicode NULL ($FF FE 00 00 or $FE FF 00 00). + + The timestamp fields are based on a subset of ISO 8601. When being as + precise as possible the format of a time string is + yyyy-MM-ddTHH:mm:ss (year, "-", month, "-", day, "T", hour (out of + 24), ":", minutes, ":", seconds), but the precision may be reduced by + removing as many time indicators as wanted. Hence valid timestamps + are + yyyy, yyyy-MM, yyyy-MM-dd, yyyy-MM-ddTHH, yyyy-MM-ddTHH:mm and + yyyy-MM-ddTHH:mm:ss. All time stamps are UTC. For durations, use + the slash character as described in 8601, and for multiple non- + contiguous dates, use multiple strings, if allowed by the frame + definition. + + The three byte language field, present in several frames, is used to + describe the language of the frame's content, according to ISO-639-2 + [ISO-639-2]. The language should be represented in lower case. If the + language is not known the string "XXX" should be used. + + All URLs [URL] MAY be relative, e.g. "picture.png", "../doc.txt". + + If a frame is longer than it should be, e.g. having more fields than + specified in this document, that indicates that additions to the + frame have been made in a later version of the ID3v2 standard. This + is reflected by the revision number in the header of the tag. + + +4.1. Frame header flags + + In the frame header the size descriptor is followed by two flag + bytes. All unused flags MUST be cleared. The first byte is for + 'status messages' and the second byte is a format description. If an + unknown flag is set in the first byte the frame MUST NOT be changed + without that bit cleared. If an unknown flag is set in the second + byte the frame is likely to not be readable. Some flags in the second + byte indicates that extra information is added to the header. These + fields of extra information is ordered as the flags that indicates + them. The flags field is defined as follows (l and o left out because + ther resemblence to one and zero): + + %0abc0000 %0h00kmnp + + Some frame format flags indicate that additional information fields + are added to the frame. This information is added after the frame + header and before the frame data in the same order as the flags that + indicates them. I.e. the four bytes of decompressed size will precede + the encryption method byte. These additions affects the 'frame size' + field, but are not subject to encryption or compression. + + The default status flags setting for a frame is, unless stated + otherwise, 'preserved if tag is altered' and 'preserved if file is + altered', i.e. %00000000. + + +4.1.1. Frame status flags + + a - Tag alter preservation + + This flag tells the tag parser what to do with this frame if it is + unknown and the tag is altered in any way. This applies to all + kinds of alterations, including adding more padding and reordering + the frames. + + 0 Frame should be preserved. + 1 Frame should be discarded. + + + b - File alter preservation + + This flag tells the tag parser what to do with this frame if it is + unknown and the file, excluding the tag, is altered. This does not + apply when the audio is completely replaced with other audio data. + + 0 Frame should be preserved. + 1 Frame should be discarded. + + + c - Read only + + This flag, if set, tells the software that the contents of this + frame are intended to be read only. Changing the contents might + break something, e.g. a signature. If the contents are changed, + without knowledge of why the frame was flagged read only and + without taking the proper means to compensate, e.g. recalculating + the signature, the bit MUST be cleared. + + +4.1.2. Frame format flags + + h - Grouping identity + + This flag indicates whether or not this frame belongs in a group + with other frames. If set, a group identifier byte is added to the + frame. Every frame with the same group identifier belongs to the + same group. + + 0 Frame does not contain group information + 1 Frame contains group information + + + k - Compression + + This flag indicates whether or not the frame is compressed. + A 'Data Length Indicator' byte MUST be included in the frame. + + 0 Frame is not compressed. + 1 Frame is compressed using zlib [zlib] deflate method. + If set, this requires the 'Data Length Indicator' bit + to be set as well. + + + m - Encryption + + This flag indicates whether or not the frame is encrypted. If set, + one byte indicating with which method it was encrypted will be + added to the frame. See description of the ENCR frame for more + information about encryption method registration. Encryption + should be done after compression. Whether or not setting this flag + requires the presence of a 'Data Length Indicator' depends on the + specific algorithm used. + + 0 Frame is not encrypted. + 1 Frame is encrypted. + + n - Unsynchronisation + + This flag indicates whether or not unsynchronisation was applied + to this frame. See section 6 for details on unsynchronisation. + If this flag is set all data from the end of this header to the + end of this frame has been unsynchronised. Although desirable, the + presence of a 'Data Length Indicator' is not made mandatory by + unsynchronisation. + + 0 Frame has not been unsynchronised. + 1 Frame has been unsyrchronised. + + p - Data length indicator + + This flag indicates that a data length indicator has been added to + the frame. The data length indicator is the value one would write + as the 'Frame length' if all of the frame format flags were + zeroed, represented as a 32 bit synchsafe integer. + + 0 There is no Data Length Indicator. + 1 A data length Indicator has been added to the frame. + + +5. Tag location + + The default location of an ID3v2 tag is prepended to the audio so + that players can benefit from the information when the data is + streamed. It is however possible to append the tag, or make a + prepend/append combination. When deciding upon where an unembedded + tag should be located, the following order of preference SHOULD be + considered. + + 1. Prepend the tag. + + 2. Prepend a tag with all vital information and add a second tag at + the end of the file, before tags from other tagging systems. The + first tag is required to have a SEEK frame. + + 3. Add a tag at the end of the file, before tags from other tagging + systems. + + In case 2 and 3 the tag can simply be appended if no other known tags + are present. The suggested method to find ID3v2 tags are: + + 1. Look for a prepended tag using the pattern found in section 3.1. + + 2. If a SEEK frame was found, use its values to guide further + searching. + + 3. Look for a tag footer, scanning from the back of the file. + + For every new tag that is found, the old tag should be discarded + unless the update flag in the extended header (section 3.2) is set. + + +6. Unsynchronisation + + The only purpose of unsynchronisation is to make the ID3v2 tag as + compatible as possible with existing software and hardware. There is + no use in 'unsynchronising' tags if the file is only to be processed + only by ID3v2 aware software and hardware. Unsynchronisation is only + useful with tags in MPEG 1/2 layer I, II and III, MPEG 2.5 and AAC + files. + + +6.1. The unsynchronisation scheme + + Whenever a false synchronisation is found within the tag, one zeroed + byte is inserted after the first false synchronisation byte. The + format of synchronisations that should be altered by ID3 encoders is + as follows: + + %11111111 111xxxxx + + and should be replaced with: + + %11111111 00000000 111xxxxx + + This has the side effect that all $FF 00 combinations have to be + altered, so they will not be affected by the decoding process. + Therefore all the $FF 00 combinations have to be replaced with the + $FF 00 00 combination during the unsynchronisation. + + To indicate usage of the unsynchronisation, the unsynchronisation + flag in the frame header should be set. This bit MUST be set if the + frame was altered by the unsynchronisation and SHOULD NOT be set if + unaltered. If all frames in the tag are unsynchronised the + unsynchronisation flag in the tag header SHOULD be set. It MUST NOT + be set if the tag has a frame which is not unsynchronised. + + Assume the first byte of the audio to be $FF. The special case when + the last byte of the last frame is $FF and no padding nor footer is + used will then introduce a false synchronisation. This can be solved + by adding a footer, adding padding or unsynchronising the frame and + add $00 to the end of the frame data, thus adding more byte to the + frame size than a normal unsynchronisation would. Although not + preferred, it is allowed to apply the last method on all frames + ending with $FF. + + It is preferred that the tag is either completely unsynchronised or + not unsynchronised at all. A completely unsynchronised tag has no + false synchonisations in it, as defined above, and does not end with + $FF. A completely non-unsynchronised tag contains no unsynchronised + frames, and thus the unsynchronisation flag in the header is cleared. + + Do bear in mind, that if compression or encryption is used, the + unsynchronisation scheme MUST be applied afterwards. When decoding an + unsynchronised frame, the unsynchronisation scheme MUST be reversed + first, encryption and decompression afterwards. + + +6.2. Synchsafe integers + + In some parts of the tag it is inconvenient to use the + unsychronisation scheme because the size of unsynchronised data is + not known in advance, which is particularly problematic with size + descriptors. The solution in ID3v2 is to use synchsafe integers, in + which there can never be any false synchs. Synchsafe integers are + integers that keep its highest bit (bit 7) zeroed, making seven bits + out of eight available. Thus a 32 bit synchsafe integer can store 28 + bits of information. + + Example: + + 255 (%11111111) encoded as a 16 bit synchsafe integer is 383 + (%00000001 01111111). + + +7. Copyright + + Copyright (C) Martin Nilsson 2000. All Rights Reserved. + + This document and translations of it may be copied and furnished to + others, and derivative works that comment on or otherwise explain it + or assist in its implementation may be prepared, copied, published + and distributed, in whole or in part, without restriction of any + kind, provided that a reference to this document is included on all + such copies and derivative works. However, this document itself may + not be modified in any way and reissued as the original document. + + The limited permissions granted above are perpetual and will not be + revoked. + + This document and the information contained herein is provided on an + 'AS IS' basis and THE AUTHORS DISCLAIMS ALL WARRANTIES, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF + THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED + WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + + +8. References + + [ID3v2] Martin Nilsson, 'ID3v2 informal standard'. + + + + [ISO-639-2] ISO/FDIS 639-2. + 'Codes for the representation of names of languages, Part 2: Alpha-3 + code.' Technical committee / subcommittee: TC 37 / SC 2 + + [ISO-3309] ISO 3309 + 'Information Processing Systems--Data Communication High-Level Data + Link Control Procedure--Frame Structure', IS 3309, October 1984, 3rd + Edition. + + [ISO-8859-1] ISO/IEC DIS 8859-1. + '8-bit single-byte coded graphic character sets, Part 1: Latin + alphabet No. 1.' Technical committee / subcommittee: JTC 1 / SC 2 + + [JFIF] 'JPEG File Interchange Format, version 1.02' + + + + [KEYWORDS] S. Bradner, 'Key words for use in RFCs to Indicate + Requirement Levels', RFC 2119, March 1997. + + + + [MPEG] ISO/IEC 11172-3:1993. + 'Coding of moving pictures and associated audio for digital storage + media at up to about 1,5 Mbit/s, Part 3: Audio.' + Technical committee / subcommittee: JTC 1 / SC 29 + and + ISO/IEC 13818-3:1995 + 'Generic coding of moving pictures and associated audio information, + Part 3: Audio.' + Technical committee / subcommittee: JTC 1 / SC 29 + and + ISO/IEC DIS 13818-3 + 'Generic coding of moving pictures and associated audio information, + Part 3: Audio (Revision of ISO/IEC 13818-3:1995)' + + [PNG] 'Portable Network Graphics, version 1.0' + + + + [UNICODE] The Unicode Consortium, + 'The Unicode Standard Version 3.0', ISBN 0-201-61633-5. + + + + [URL] T. Berners-Lee, L. Masinter & M. McCahill, 'Uniform Resource + Locators (URL)', RFC 1738, December 1994. + + + + [UTF-8] F. Yergeau, 'UTF-8, a transformation format of ISO 10646', + RFC 2279, January 1998. + + + + [UTF-16] F. Yergeau, 'UTF-16, an encoding of ISO 10646', RFC 2781, + February 2000. + + + + [ZLIB] P. Deutsch, Aladdin Enterprises & J-L. Gailly, 'ZLIB + Compressed Data Format Specification version 3.3', RFC 1950, + May 1996. + + + + +9. Author's Address + + Written by + + Martin Nilsson + Rydsvägen 246 C. 30 + SE-584 34 Linköping + Sweden + + Email: nilsson@id3.org + diff --git a/Libraries/TagLib/Files/taglib/mpeg/id3v2/id3v2extendedheader.cpp b/Libraries/TagLib/Files/taglib/mpeg/id3v2/id3v2extendedheader.cpp new file mode 100644 index 000000000..ed6bfe3dc --- /dev/null +++ b/Libraries/TagLib/Files/taglib/mpeg/id3v2/id3v2extendedheader.cpp @@ -0,0 +1,67 @@ +/*************************************************************************** + copyright : (C) 2002, 2003 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#include "id3v2extendedheader.h" +#include "id3v2synchdata.h" + +using namespace TagLib; +using namespace ID3v2; + +class ExtendedHeader::ExtendedHeaderPrivate +{ +public: + ExtendedHeaderPrivate() : size(0) {} + + uint size; +}; + +//////////////////////////////////////////////////////////////////////////////// +// public methods +//////////////////////////////////////////////////////////////////////////////// + +ExtendedHeader::ExtendedHeader() +{ + d = new ExtendedHeaderPrivate(); +} + +ExtendedHeader::~ExtendedHeader() +{ + delete d; +} + +TagLib::uint ExtendedHeader::size() const +{ + return d->size; +} + +void ExtendedHeader::setData(const ByteVector &data) +{ + parse(data); +} + +//////////////////////////////////////////////////////////////////////////////// +// protected members +//////////////////////////////////////////////////////////////////////////////// + +void ExtendedHeader::parse(const ByteVector &data) +{ + d->size = SynchData::toUInt(data.mid(0, 4)); // (structure 3.2 "Extended header size") +} diff --git a/Libraries/TagLib/Files/taglib/mpeg/id3v2/id3v2extendedheader.h b/Libraries/TagLib/Files/taglib/mpeg/id3v2/id3v2extendedheader.h new file mode 100644 index 000000000..8ca0dff94 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/mpeg/id3v2/id3v2extendedheader.h @@ -0,0 +1,88 @@ +/*************************************************************************** + copyright : (C) 2002, 2003 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#ifndef TAGLIB_ID3V2EXTENDEDHEADER_H +#define TAGLIB_ID3V2EXTENDEDHEADER_H + +#include +#include + +namespace TagLib { + + namespace ID3v2 { + + //! ID3v2 extended header implementation + + /*! + * This class implements ID3v2 extended headers. It attempts to follow, + * both semantically and programatically, the structure specified in + * the ID3v2 standard. The API is based on the properties of ID3v2 extended + * headers specified there. If any of the terms used in this documentation + * are unclear please check the specification in the linked section. + * (Structure, 3.2) + */ + + class ExtendedHeader + { + public: + /*! + * Constructs an empty ID3v2 extended header. + */ + ExtendedHeader(); + + /*! + * Destroys the extended header. + */ + virtual ~ExtendedHeader(); + + /*! + * Returns the size of the extended header. This is variable for the + * extended header. + */ + uint size() const; + + /*! + * Sets the data that will be used as the extended header. Since the + * length is not known before the extended header has been parsed, this + * should just be a pointer to the first byte of the extended header. It + * will determine the length internally and make that available through + * size(). + */ + void setData(const ByteVector &data); + + protected: + /*! + * Called by setData() to parse the extended header data. It makes this + * information available through the public API. + */ + void parse(const ByteVector &data); + + private: + ExtendedHeader(const ExtendedHeader &); + ExtendedHeader &operator=(const ExtendedHeader &); + + class ExtendedHeaderPrivate; + ExtendedHeaderPrivate *d; + }; + + } +} +#endif diff --git a/Libraries/TagLib/Files/taglib/mpeg/id3v2/id3v2footer.cpp b/Libraries/TagLib/Files/taglib/mpeg/id3v2/id3v2footer.cpp new file mode 100644 index 000000000..073f059c9 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/mpeg/id3v2/id3v2footer.cpp @@ -0,0 +1,56 @@ +/*************************************************************************** + copyright : (C) 2002, 2003 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#include "id3v2footer.h" +#include "id3v2header.h" + +using namespace TagLib; +using namespace ID3v2; + +class Footer::FooterPrivate +{ +public: + static const uint size = 10; +}; + +Footer::Footer() +{ + +} + +Footer::~Footer() +{ + +} + +const unsigned int Footer::size() +{ + return FooterPrivate::size; +} + +ByteVector Footer::render(const Header *header) const +{ + ByteVector headerData = header->render(); + headerData[0] = '3'; + headerData[1] = 'D'; + headerData[2] = 'I'; + return headerData; +} diff --git a/Libraries/TagLib/Files/taglib/mpeg/id3v2/id3v2footer.h b/Libraries/TagLib/Files/taglib/mpeg/id3v2/id3v2footer.h new file mode 100644 index 000000000..7a925f32a --- /dev/null +++ b/Libraries/TagLib/Files/taglib/mpeg/id3v2/id3v2footer.h @@ -0,0 +1,77 @@ +/*************************************************************************** + copyright : (C) 2002, 2003 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#ifndef TAGLIB_ID3V2FOOTER_H +#define TAGLIB_ID3V2FOOTER_H + +#include + +namespace TagLib { + + namespace ID3v2 { + + class Header; + + //! ID3v2 footer implementation + + /*! + * Per the ID3v2 specification, the tag's footer is just a copy of the + * information in the header. As such there is no API for reading the + * data from the header, it can just as easily be done from the header. + * + * In fact, at this point, TagLib does not even parse the footer since + * it is not useful internally. However, if the flag to include a footer + * has been set in the ID3v2::Tag, TagLib will render a footer. + */ + + class Footer + { + public: + /*! + * Constructs an empty ID3v2 footer. + */ + Footer(); + /*! + * Destroys the footer. + */ + virtual ~Footer(); + + /*! + * Returns the size of the footer. Presently this is always 10 bytes. + */ + static const unsigned int size(); + + /*! + * Renders the footer based on the data in \a header. + */ + ByteVector render(const Header *header) const; + + private: + Footer(const Footer &); + Footer &operator=(const Footer &); + + class FooterPrivate; + FooterPrivate *d; + }; + + } +} +#endif diff --git a/Libraries/TagLib/Files/taglib/mpeg/id3v2/id3v2frame.cpp b/Libraries/TagLib/Files/taglib/mpeg/id3v2/id3v2frame.cpp new file mode 100644 index 000000000..0675483ce --- /dev/null +++ b/Libraries/TagLib/Files/taglib/mpeg/id3v2/id3v2frame.cpp @@ -0,0 +1,467 @@ +/*************************************************************************** + copyright : (C) 2002, 2003 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#include + +#include + +#if HAVE_ZLIB +#include +#endif + +#include + +#include "id3v2frame.h" +#include "id3v2synchdata.h" + +using namespace TagLib; +using namespace ID3v2; + +class Frame::FramePrivate +{ +public: + FramePrivate() : + header(0) + {} + + ~FramePrivate() + { + delete header; + } + + Frame::Header *header; +}; + +//////////////////////////////////////////////////////////////////////////////// +// static methods +//////////////////////////////////////////////////////////////////////////////// + +TagLib::uint Frame::headerSize() +{ + return Header::size(); +} + +TagLib::uint Frame::headerSize(uint version) +{ + return Header::size(version); +} + +ByteVector Frame::textDelimiter(String::Type t) +{ + ByteVector d = char(0); + if(t == String::UTF16 || t == String::UTF16BE) + d.append(char(0)); + return d; +} + +//////////////////////////////////////////////////////////////////////////////// +// public members +//////////////////////////////////////////////////////////////////////////////// + +Frame::~Frame() +{ + delete d; +} + +ByteVector Frame::frameID() const +{ + if(d->header) + return d->header->frameID(); + else + return ByteVector::null; +} + +TagLib::uint Frame::size() const +{ + if(d->header) + return d->header->frameSize(); + else + return 0; +} + +void Frame::setData(const ByteVector &data) +{ + parse(data); +} + +void Frame::setText(const String &) +{ + +} + +ByteVector Frame::render() const +{ + ByteVector fieldData = renderFields(); + d->header->setFrameSize(fieldData.size()); + ByteVector headerData = d->header->render(); + + return headerData + fieldData; +} + +//////////////////////////////////////////////////////////////////////////////// +// protected members +//////////////////////////////////////////////////////////////////////////////// + +Frame::Frame(const ByteVector &data) +{ + d = new FramePrivate; + d->header = new Header(data); +} + +Frame::Frame(Header *h) +{ + d = new FramePrivate; + d->header = h; +} + +Frame::Header *Frame::header() const +{ + return d->header; +} + +void Frame::setHeader(Header *h, bool deleteCurrent) +{ + if(deleteCurrent) + delete d->header; + + d->header = h; +} + +void Frame::parse(const ByteVector &data) +{ + if(d->header) + d->header->setData(data); + else + d->header = new Header(data); + + parseFields(fieldData(data)); +} + +ByteVector Frame::fieldData(const ByteVector &frameData) const +{ + uint headerSize = Header::size(d->header->version()); + + uint frameDataOffset = headerSize; + uint frameDataLength = size(); + + if(d->header->compression() || d->header->dataLengthIndicator()) { + frameDataLength = frameData.mid(headerSize, 4).toUInt(); + frameDataOffset += 4; + } + +#if HAVE_ZLIB + if(d->header->compression()) { + ByteVector data(frameDataLength); + uLongf uLongTmp = frameDataLength; + ::uncompress((Bytef *) data.data(), + (uLongf *) &uLongTmp, + (Bytef *) frameData.data() + frameDataOffset, + size()); + return data; + } + else +#endif + return frameData.mid(frameDataOffset, frameDataLength); +} + +//////////////////////////////////////////////////////////////////////////////// +// Frame::Header class +//////////////////////////////////////////////////////////////////////////////// + +class Frame::Header::HeaderPrivate +{ +public: + HeaderPrivate() : + frameSize(0), + version(4), + tagAlterPreservation(false), + fileAlterPreservation(false), + readOnly(false), + groupingIdentity(false), + compression(false), + encryption(false), + unsyncronisation(false), + dataLengthIndicator(false) + {} + + ByteVector frameID; + uint frameSize; + uint version; + + // flags + + bool tagAlterPreservation; + bool fileAlterPreservation; + bool readOnly; + bool groupingIdentity; + bool compression; + bool encryption; + bool unsyncronisation; + bool dataLengthIndicator; +}; + +//////////////////////////////////////////////////////////////////////////////// +// static members (Frame::Header) +//////////////////////////////////////////////////////////////////////////////// + +TagLib::uint Frame::Header::size() +{ + return size(4); +} + +TagLib::uint Frame::Header::size(uint version) +{ + switch(version) { + case 0: + case 1: + case 2: + return 6; + case 3: + case 4: + default: + return 10; + } +} + +//////////////////////////////////////////////////////////////////////////////// +// public members (Frame::Header) +//////////////////////////////////////////////////////////////////////////////// + +Frame::Header::Header(const ByteVector &data, bool synchSafeInts) +{ + d = new HeaderPrivate; + setData(data, synchSafeInts); +} + +Frame::Header::Header(const ByteVector &data, uint version) +{ + d = new HeaderPrivate; + setData(data, version); +} + +Frame::Header::~Header() +{ + delete d; +} + +void Frame::Header::setData(const ByteVector &data, bool synchSafeInts) +{ + setData(data, uint(synchSafeInts ? 4 : 3)); +} + +void Frame::Header::setData(const ByteVector &data, uint version) +{ + d->version = version; + + switch(version) { + case 0: + case 1: + case 2: + { + // ID3v2.2 + + if(data.size() < 3) { + debug("You must at least specify a frame ID."); + return; + } + + // Set the frame ID -- the first three bytes + + d->frameID = data.mid(0, 3); + + // If the full header information was not passed in, do not continue to the + // steps to parse the frame size and flags. + + if(data.size() < 6) { + d->frameSize = 0; + return; + } + + d->frameSize = data.mid(3, 3).toUInt(); + + break; + } + case 3: + { + // ID3v2.3 + + if(data.size() < 4) { + debug("You must at least specify a frame ID."); + return; + } + + // Set the frame ID -- the first four bytes + + d->frameID = data.mid(0, 4); + + // If the full header information was not passed in, do not continue to the + // steps to parse the frame size and flags. + + if(data.size() < 10) { + d->frameSize = 0; + return; + } + + // Set the size -- the frame size is the four bytes starting at byte four in + // the frame header (structure 4) + + d->frameSize = data.mid(4, 4).toUInt(); + + { // read the first byte of flags + std::bitset<8> flags(data[8]); + d->tagAlterPreservation = flags[7]; // (structure 3.3.1.a) + d->fileAlterPreservation = flags[6]; // (structure 3.3.1.b) + d->readOnly = flags[5]; // (structure 3.3.1.c) + } + + { // read the second byte of flags + std::bitset<8> flags(data[9]); + d->compression = flags[7]; // (structure 3.3.1.i) + d->encryption = flags[6]; // (structure 3.3.1.j) + d->groupingIdentity = flags[5]; // (structure 3.3.1.k) + } + break; + } + case 4: + default: + { + // ID3v2.4 + + if(data.size() < 4) { + debug("You must at least specify a frame ID."); + return; + } + + // Set the frame ID -- the first four bytes + + d->frameID = data.mid(0, 4); + + // If the full header information was not passed in, do not continue to the + // steps to parse the frame size and flags. + + if(data.size() < 10) { + d->frameSize = 0; + return; + } + + // Set the size -- the frame size is the four bytes starting at byte four in + // the frame header (structure 4) + + d->frameSize = SynchData::toUInt(data.mid(4, 4)); + + { // read the first byte of flags + std::bitset<8> flags(data[8]); + d->tagAlterPreservation = flags[6]; // (structure 4.1.1.a) + d->fileAlterPreservation = flags[5]; // (structure 4.1.1.b) + d->readOnly = flags[4]; // (structure 4.1.1.c) + } + + { // read the second byte of flags + std::bitset<8> flags(data[9]); + d->groupingIdentity = flags[6]; // (structure 4.1.2.h) + d->compression = flags[3]; // (structure 4.1.2.k) + d->encryption = flags[2]; // (structure 4.1.2.m) + d->unsyncronisation = flags[1]; // (structure 4.1.2.n) + d->dataLengthIndicator = flags[0]; // (structure 4.1.2.p) + } + break; + } + } +} + +ByteVector Frame::Header::frameID() const +{ + return d->frameID; +} + +void Frame::Header::setFrameID(const ByteVector &id) +{ + d->frameID = id.mid(0, 4); +} + +TagLib::uint Frame::Header::frameSize() const +{ + return d->frameSize; +} + +void Frame::Header::setFrameSize(uint size) +{ + d->frameSize = size; +} + +TagLib::uint Frame::Header::version() const +{ + return d->version; +} + +bool Frame::Header::tagAlterPreservation() const +{ + return d->tagAlterPreservation; +} + +bool Frame::Header::fileAlterPreservation() const +{ + return d->fileAlterPreservation; +} + +bool Frame::Header::readOnly() const +{ + return d->readOnly; +} + +bool Frame::Header::groupingIdentity() const +{ + return d->groupingIdentity; +} + +bool Frame::Header::compression() const +{ + return d->compression; +} + +bool Frame::Header::encryption() const +{ + return d->encryption; +} + +bool Frame::Header::unsycronisation() const +{ + return d->unsyncronisation; +} + +bool Frame::Header::dataLengthIndicator() const +{ + return d->dataLengthIndicator; +} + +ByteVector Frame::Header::render() const +{ + ByteVector flags(2, char(0)); // just blank for the moment + + ByteVector v = d->frameID + SynchData::fromUInt(d->frameSize) + flags; + + return v; +} + +bool Frame::Header::frameAlterPreservation() const // deprecated +{ + return fileAlterPreservation(); +} diff --git a/Libraries/TagLib/Files/taglib/mpeg/id3v2/id3v2frame.h b/Libraries/TagLib/Files/taglib/mpeg/id3v2/id3v2frame.h new file mode 100644 index 000000000..4e12dc210 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/mpeg/id3v2/id3v2frame.h @@ -0,0 +1,369 @@ +/*************************************************************************** + copyright : (C) 2002, 2003 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#ifndef TAGLIB_ID3V2FRAME_H +#define TAGLIB_ID3V2FRAME_H + +#include +#include + +namespace TagLib { + + namespace ID3v2 { + + class FrameFactory; + + //! ID3v2 frame implementation + + /*! + * This class is the main ID3v2 frame implementation. In ID3v2, a tag is + * split between a collection of frames (which are in turn split into fields + * (Structure, 4) + * (Frames). This class provides an API for + * gathering information about and modifying ID3v2 frames. Funtionallity + * specific to a given frame type is handed in one of the many subclasses. + */ + + class Frame + { + friend class FrameFactory; + + public: + /*! + * Destroys this Frame instance. + */ + virtual ~Frame(); + + /*! + * Returns the Frame ID (Structure, 4) + * (Frames, 4) + */ + ByteVector frameID() const; + + /*! + * Returns the size of the frame. + */ + uint size() const; + + /*! + * Returns the size of the frame header + * + * \deprecated This is only accurate for ID3v2.3 or ID3v2.4. Please use + * the call below which accepts an ID3v2 version number. In the next + * non-binary compatible release this will be made into a non-static + * member that checks the internal ID3v2 version. + */ + static uint headerSize(); // BIC: remove and make non-static + + /*! + * Returns the size of the frame header for the given ID3v2 version. + * + * \deprecated Please see the explanation above. + */ + static uint headerSize(uint version); // BIC: remove and make non-static + + /*! + * Sets the data that will be used as the frame. Since the length is not + * known before the frame has been parsed, this should just be a pointer to + * the first byte of the frame. It will determine the length internally + * and make that available through size(). + */ + void setData(const ByteVector &data); + + /*! + * Set the text of frame in the sanest way possible. This should only be + * reimplemented in frames where there is some logical mapping to text. + * + * \note If the frame type supports multiple text encodings, this will not + * change the text encoding of the frame; the string will be converted to + * that frame's encoding. Please use the specific APIs of the frame types + * to set the encoding if that is desired. + */ + virtual void setText(const String &text); + + /*! + * This returns the textual representation of the data in the frame. + * Subclasses must reimplement this method to provide a string + * representation of the frame's data. + */ + virtual String toString() const = 0; + + /*! + * Render the frame back to its binary format in a ByteVector. + */ + ByteVector render() const; + + /*! + * Returns the text delimiter that is used between fields for the string + * type \a t. + */ + static ByteVector textDelimiter(String::Type t); + + protected: + class Header; + + /*! + * Constructs an ID3v2 frame using \a data to read the header information. + * All other processing of \a data should be handled in a subclass. + * + * \note This need not contain anything more than a frame ID, but + * \e must constain at least that. + */ + explicit Frame(const ByteVector &data); + + /*! + * This creates an Frame using the header \a h. + * + * The ownership of this header will be assigned to the frame and the + * header will be deleted when the frame is destroyed. + */ + Frame(Header *h); + + /*! + * Returns a pointer to the frame header. + */ + Header *header() const; + + /*! + * Sets the header to \a h. If \a deleteCurrent is true, this will free + * the memory of the current header. + * + * The ownership of this header will be assigned to the frame and the + * header will be deleted when the frame is destroyed. + */ + void setHeader(Header *h, bool deleteCurrent = true); + + /*! + * Called by setData() to parse the frame data. It makes this information + * available through the public API. + */ + void parse(const ByteVector &data); + + /*! + * Called by parse() to parse the field data. It makes this information + * available through the public API. This must be overridden by the + * subclasses. + */ + virtual void parseFields(const ByteVector &data) = 0; + + /*! + * Render the field data back to a binary format in a ByteVector. This + * must be overridden by subclasses. + */ + virtual ByteVector renderFields() const = 0; + + /*! + * Returns a ByteVector containing the field data given the frame data. + * This correctly adjusts for the header size plus any additional frame + * data that's specified in the frame header flags. + */ + ByteVector fieldData(const ByteVector &frameData) const; + + private: + Frame(const Frame &); + Frame &operator=(const Frame &); + + class FramePrivate; + FramePrivate *d; + }; + + //! ID3v2 frame header implementation + + /*! + * The ID3v2 Frame Header (Structure, 4) + * + * Every ID3v2::Frame has an associated header that gives some general + * properties of the frame and also makes it possible to identify the frame + * type. + * + * As such when reading an ID3v2 tag ID3v2::FrameFactory first creates the + * frame headers and then creates the appropriate Frame subclass based on + * the type and attaches the header. + */ + + class Frame::Header + { + public: + /*! + * Construct a Frame Header based on \a data. \a data must at least + * contain a 4 byte frame ID, and optionally can contain flag data and the + * frame size. i.e. Just the frame id -- "TALB" -- is a valid value. + * + * \deprecated Please use the constructor below that accepts a version + * number. + */ + Header(const ByteVector &data, bool synchSafeInts); + + /*! + * Construct a Frame Header based on \a data. \a data must at least + * contain a 4 byte frame ID, and optionally can contain flag data and the + * frame size. i.e. Just the frame id -- "TALB" -- is a valid value. + * + * \a version should be the ID3v2 version of the tag. + */ + explicit Header(const ByteVector &data, uint version = 4); + + /*! + * Destroys this Header instance. + */ + virtual ~Header(); + + /*! + * Sets the data for the Header. + * + * \deprecated Please use the version below that accepts an ID3v2 version + * number. + */ + void setData(const ByteVector &data, bool synchSafeInts); + + /*! + * Sets the data for the Header. \a version should indicate the ID3v2 + * version number of the tag that this frame is contained in. + */ + void setData(const ByteVector &data, uint version = 4); + + /*! + * Returns the Frame ID (Structure, 4) + * (Frames, 4) + */ + ByteVector frameID() const; + + /*! + * Sets the frame's ID to \a id. Only the first four bytes of \a id will + * be used. + * + * \warning This method should in general be avoided. It exists simply to + * provide a mechanism for transforming frames from a deprecated frame type + * to a newer one -- i.e. TYER to TDRC from ID3v2.3 to ID3v2.4. + */ + void setFrameID(const ByteVector &id); + + /*! + * Returns the size of the frame data portion, as set when setData() was + * called or set explicity via setFrameSize(). + */ + uint frameSize() const; + + /*! + * Sets the size of the frame data portion. + */ + void setFrameSize(uint size); + + /*! + * Returns the ID3v2 version of the header (as passed in from the + * construction of the header). + */ + uint version() const; + + /*! + * Returns the size of the frame header in bytes. + * + * \deprecated Please use the version of this method that accepts a + * version. This is only accurate for ID3v2.3 and ID3v2.4. This will be + * removed in the next binary incompatible release (2.0) and will be + * replaced with a non-static method that checks the frame version. + */ + static uint size(); + + /*! + * Returns the size of the frame header in bytes for the ID3v2 version + * that's given. + * + * \deprecated Please see the explanation in the version above. + */ + static uint size(uint version); + + /*! + * Returns true if the flag for tag alter preservation is set. + * + * \note This flag is currently ignored internally in TagLib. + */ + bool tagAlterPreservation() const; + + /*! + * Returns true if the flag for file alter preservation is set. + * + * \note This flag is currently ignored internally in TagLib. + */ + bool fileAlterPreservation() const; + + /*! + * Returns true if the frame is meant to be read only. + * + * \note This flag is currently ignored internally in TagLib. + */ + bool readOnly() const; + + /*! + * Returns true if the flag for the grouping identifity is set. + * + * \note This flag is currently ignored internally in TagLib. + */ + bool groupingIdentity() const; + + /*! + * Returns true if compression is enabled for this frame. + * + * \note This flag is currently ignored internally in TagLib. + */ + bool compression() const; + + /*! + * Returns true if encryption is enabled for this frame. + * + * \note This flag is currently ignored internally in TagLib. + */ + bool encryption() const; + + /*! + * Returns true if unsyncronisation is enabled for this frame. + * + * \note This flag is currently ignored internally in TagLib. + */ + bool unsycronisation() const; + + /*! + * Returns true if the flag for a data lenght indicator is set. + */ + bool dataLengthIndicator() const; + + /*! + * Render the Header back to binary format in a ByteVector. + */ + ByteVector render() const; + + /*! + * @deprecated + */ + bool frameAlterPreservation() const; + + private: + Header(const Header &); + Header &operator=(const Header &); + + class HeaderPrivate; + HeaderPrivate *d; + }; + + } +} + +#endif diff --git a/Libraries/TagLib/Files/taglib/mpeg/id3v2/id3v2framefactory.cpp b/Libraries/TagLib/Files/taglib/mpeg/id3v2/id3v2framefactory.cpp new file mode 100644 index 000000000..3fc976a5c --- /dev/null +++ b/Libraries/TagLib/Files/taglib/mpeg/id3v2/id3v2framefactory.cpp @@ -0,0 +1,309 @@ +/*************************************************************************** + copyright : (C) 2002, 2003 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#include + +#include + +#include "id3v2framefactory.h" + +#include "frames/attachedpictureframe.h" +#include "frames/commentsframe.h" +#include "frames/relativevolumeframe.h" +#include "frames/textidentificationframe.h" +#include "frames/uniquefileidentifierframe.h" +#include "frames/unknownframe.h" + +using namespace TagLib; +using namespace ID3v2; + +class FrameFactory::FrameFactoryPrivate +{ +public: + FrameFactoryPrivate() : + defaultEncoding(String::Latin1), + useDefaultEncoding(false) {} + + String::Type defaultEncoding; + bool useDefaultEncoding; +}; + +FrameFactory *FrameFactory::factory = 0; + +//////////////////////////////////////////////////////////////////////////////// +// public members +//////////////////////////////////////////////////////////////////////////////// + +FrameFactory *FrameFactory::instance() +{ + if(!factory) + factory = new FrameFactory; + return factory; +} + +Frame *FrameFactory::createFrame(const ByteVector &data, bool synchSafeInts) const +{ + return createFrame(data, uint(synchSafeInts ? 4 : 3)); +} + +Frame *FrameFactory::createFrame(const ByteVector &data, uint version) const +{ + Frame::Header *header = new Frame::Header(data, version); + ByteVector frameID = header->frameID(); + + // A quick sanity check -- make sure that the frameID is 4 uppercase Latin1 + // characters. Also make sure that there is data in the frame. + + if(!frameID.size() == (version < 3 ? 3 : 4) || header->frameSize() <= 0) { + delete header; + return 0; + } + + for(ByteVector::ConstIterator it = frameID.begin(); it != frameID.end(); it++) { + if( (*it < 'A' || *it > 'Z') && (*it < '1' || *it > '9') ) { + delete header; + return 0; + } + } + + // TagLib doesn't mess with encrypted frames, so just treat them + // as unknown frames. + +#if HAVE_ZLIB == 0 + if(header->compression()) { + debug("Compressed frames are currently not supported."); + return new UnknownFrame(data, header); + } +#endif + if(header->encryption()) { + debug("Encrypted frames are currently not supported."); + return new UnknownFrame(data, header); + } + + if(!updateFrame(header)) { + delete header; + return 0; + } + + // This is where things get necissarily nasty. Here we determine which + // Frame subclass (or if none is found simply an Frame) based + // on the frame ID. Since there are a lot of possibilities, that means + // a lot of if blocks. + + // Text Identification (frames 4.2) + + if(frameID.startsWith("T")) { + TextIdentificationFrame *f = frameID != "TXXX" + ? new TextIdentificationFrame(data, header) + : new UserTextIdentificationFrame(data, header); + + if(d->useDefaultEncoding) + f->setTextEncoding(d->defaultEncoding); + return f; + } + + // Comments (frames 4.10) + + if(frameID == "COMM") { + CommentsFrame *f = new CommentsFrame(data, header); + if(d->useDefaultEncoding) + f->setTextEncoding(d->defaultEncoding); + return f; + } + + // Attached Picture (frames 4.14) + + if(frameID == "APIC") { + AttachedPictureFrame *f = new AttachedPictureFrame(data, header); + if(d->useDefaultEncoding) + f->setTextEncoding(d->defaultEncoding); + return f; + } + + // Relative Volume Adjustment (frames 4.11) + + if(frameID == "RVA2") + return new RelativeVolumeFrame(data, header); + + // Unique File Identifier (frames 4.1) + + if(frameID == "UFID") + return new UniqueFileIdentifierFrame(data, header); + + return new UnknownFrame(data, header); +} + +String::Type FrameFactory::defaultTextEncoding() const +{ + return d->defaultEncoding; +} + +void FrameFactory::setDefaultTextEncoding(String::Type encoding) +{ + d->useDefaultEncoding = true; + d->defaultEncoding = encoding; +} + +//////////////////////////////////////////////////////////////////////////////// +// protected members +//////////////////////////////////////////////////////////////////////////////// + +FrameFactory::FrameFactory() +{ + d = new FrameFactoryPrivate; +} + +FrameFactory::~FrameFactory() +{ + delete d; +} + +bool FrameFactory::updateFrame(Frame::Header *header) const +{ + TagLib::ByteVector frameID = header->frameID(); + + switch(header->version()) { + + case 2: // ID3v2.2 + { + if(frameID == "CRM" || + frameID == "EQU" || + frameID == "LNK" || + frameID == "RVA" || + frameID == "TIM" || + frameID == "TSI") + { + debug("ID3v2.4 no longer supports the frame type " + String(frameID) + + ". It will be discarded from the tag."); + return false; + } + + // ID3v2.2 only used 3 bytes for the frame ID, so we need to convert all of + // the frames to their 4 byte ID3v2.4 equivalent. + + convertFrame("BUF", "RBUF", header); + convertFrame("CNT", "PCNT", header); + convertFrame("COM", "COMM", header); + convertFrame("CRA", "AENC", header); + convertFrame("ETC", "ETCO", header); + convertFrame("GEO", "GEOB", header); + convertFrame("IPL", "TIPL", header); + convertFrame("MCI", "MCDI", header); + convertFrame("MLL", "MLLT", header); + convertFrame("PIC", "APIC", header); + convertFrame("POP", "POPM", header); + convertFrame("REV", "RVRB", header); + convertFrame("SLT", "SYLT", header); + convertFrame("STC", "SYTC", header); + convertFrame("TAL", "TALB", header); + convertFrame("TBP", "TBPM", header); + convertFrame("TCM", "TCOM", header); + convertFrame("TCO", "TCON", header); + convertFrame("TCR", "TCOP", header); + convertFrame("TDA", "TDRC", header); + convertFrame("TDY", "TDLY", header); + convertFrame("TEN", "TENC", header); + convertFrame("TFT", "TFLT", header); + convertFrame("TKE", "TKEY", header); + convertFrame("TLA", "TLAN", header); + convertFrame("TLE", "TLEN", header); + convertFrame("TMT", "TMED", header); + convertFrame("TOA", "TOAL", header); + convertFrame("TOF", "TOFN", header); + convertFrame("TOL", "TOLY", header); + convertFrame("TOR", "TDOR", header); + convertFrame("TOT", "TOAL", header); + convertFrame("TP1", "TPE1", header); + convertFrame("TP2", "TPE2", header); + convertFrame("TP3", "TPE3", header); + convertFrame("TP4", "TPE4", header); + convertFrame("TPA", "TPOS", header); + convertFrame("TPB", "TPUB", header); + convertFrame("TRC", "TSRC", header); + convertFrame("TRD", "TDRC", header); + convertFrame("TRK", "TRCK", header); + convertFrame("TSS", "TSSE", header); + convertFrame("TT1", "TIT1", header); + convertFrame("TT2", "TIT2", header); + convertFrame("TT3", "TIT3", header); + convertFrame("TXT", "TOLY", header); + convertFrame("TXX", "TXXX", header); + convertFrame("TYE", "TDRC", header); + convertFrame("UFI", "UFID", header); + convertFrame("ULT", "USLT", header); + convertFrame("WAF", "WOAF", header); + convertFrame("WAR", "WOAR", header); + convertFrame("WAS", "WOAS", header); + convertFrame("WCM", "WCOM", header); + convertFrame("WCP", "WCOP", header); + convertFrame("WPB", "WPUB", header); + convertFrame("WXX", "WXXX", header); + + break; + } + + case 3: // ID3v2.3 + { + if(frameID == "EQUA" || + frameID == "RVAD" || + frameID == "TIME" || + frameID == "TRDA" || + frameID == "TSIZ") + { + debug("ID3v2.4 no longer supports the frame type " + String(frameID) + + ". It will be discarded from the tag."); + return false; + } + + convertFrame("TDAT", "TDRC", header); + convertFrame("TORY", "TDOR", header); + convertFrame("TYER", "TDRC", header); + + break; + } + + default: + + // This should catch a typo that existed in TagLib up to and including + // version 1.1 where TRDC was used for the year rather than TDRC. + + convertFrame("TRDC", "TDRC", header); + break; + } + + return true; +} + +//////////////////////////////////////////////////////////////////////////////// +// private members +//////////////////////////////////////////////////////////////////////////////// + +void FrameFactory::convertFrame(const char *from, const char *to, + Frame::Header *header) const +{ + if(header->frameID() != from) + return; + + // debug("ID3v2.4 no longer supports the frame type " + String(from) + " It has" + + // "been converted to the type " + String(to) + "."); + + header->setFrameID(to); +} diff --git a/Libraries/TagLib/Files/taglib/mpeg/id3v2/id3v2framefactory.h b/Libraries/TagLib/Files/taglib/mpeg/id3v2/id3v2framefactory.h new file mode 100644 index 000000000..4a0d11b4b --- /dev/null +++ b/Libraries/TagLib/Files/taglib/mpeg/id3v2/id3v2framefactory.h @@ -0,0 +1,140 @@ + /*************************************************************************** + copyright : (C) 2002, 2003 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#ifndef TAGLIB_ID3V2FRAMEFACTORY_H +#define TAGLIB_ID3V2FRAMEFACTORY_H + +#include +#include "id3v2frame.h" + +namespace TagLib { + + namespace ID3v2 { + + //! A factory for creating ID3v2 frames + + /*! + * This factory abstracts away the frame creation process and instantiates + * the appropriate ID3v2::Frame subclasses based on the contents of the + * data. + * + * Reimplementing this factory is the key to adding support for frame types + * not directly supported by TagLib to your application. To do so you would + * subclass this factory reimplement createFrame(). Then by setting your + * factory to be the default factory in ID3v2::Tag constructor or with + * MPEG::File::setID3v2FrameFactory() you can implement behavior that will + * allow for new ID3v2::Frame subclasses (also provided by you) to be used. + * + * This implements both abstract factory and singleton patterns + * of which more information is available on the web and in software design + * textbooks (Notably Design Patters). + */ + + class FrameFactory + { + public: + static FrameFactory *instance(); + /*! + * Create a frame based on \a data. \a synchSafeInts should only be set + * false if we are parsing an old tag (v2.3 or older) that does not support + * synchsafe ints. + * + * \deprecated Please use the method below that accepts an ID3 version + * number in new code. + */ + Frame *createFrame(const ByteVector &data, bool synchSafeInts) const; + + /*! + * Create a frame based on \a data. \a version should indicate the ID3v2 + * version of the tag. As ID3v2.4 is the most current version of the + * standard 4 is the default. + */ + // BIC: make virtual + Frame *createFrame(const ByteVector &data, uint version = 4) const; + + /*! + * Returns the default text encoding for text frames. If setTextEncoding() + * has not been explicitly called this will only be used for new text + * frames. However, if this value has been set explicitly all frames will be + * converted to this type (unless it's explitly set differently for the + * individual frame) when being rendered. + * + * \see setDefaultTextEncoding() + */ + String::Type defaultTextEncoding() const; + + /*! + * Set the default text encoding for all text frames that are created to + * \a encoding. If no value is set the frames with either default to the + * encoding type that was parsed and new frames default to Latin1. + * + * \see defaultTextEncoding() + */ + void setDefaultTextEncoding(String::Type encoding); + + protected: + /*! + * Constructs a frame factory. Because this is a singleton this method is + * protected, but may be used for subclasses. + */ + FrameFactory(); + + /*! + * Destroys the frame factory. In most cases this will never be called (as + * is typical of singletons). + */ + virtual ~FrameFactory(); + + /*! + * This method checks for compliance to the current ID3v2 standard (2.4) + * and does nothing in the common case. However if a frame is found that + * is not compatible with the current standard, this method either updates + * the frame or indicates that it should be discarded. + * + * This method with return true (with or without changes to the frame) if + * this frame should be kept or false if it should be discarded. + * + * See the id3v2.4.0-changes.txt document for further information. + */ + virtual bool updateFrame(Frame::Header *header) const; + + private: + FrameFactory(const FrameFactory &); + FrameFactory &operator=(const FrameFactory &); + + /*! + * This method is used internally to convert a frame from ID \a from to ID + * \a to. If the frame matches the \a from pattern and converts the frame + * ID in the \a header or simply does nothing if the frame ID does not match. + */ + void convertFrame(const char *from, const char *to, + Frame::Header *header) const; + + static FrameFactory *factory; + + class FrameFactoryPrivate; + FrameFactoryPrivate *d; + }; + + } +} + +#endif diff --git a/Libraries/TagLib/Files/taglib/mpeg/id3v2/id3v2header.cpp b/Libraries/TagLib/Files/taglib/mpeg/id3v2/id3v2header.cpp new file mode 100644 index 000000000..4ed09e8a5 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/mpeg/id3v2/id3v2header.cpp @@ -0,0 +1,227 @@ +/*************************************************************************** + copyright : (C) 2002, 2003 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#include +#include + +#include +#include + +#include "id3v2header.h" +#include "id3v2footer.h" +#include "id3v2synchdata.h" + +using namespace TagLib; +using namespace ID3v2; + +class Header::HeaderPrivate +{ +public: + HeaderPrivate() : majorVersion(0), + revisionNumber(0), + unsynchronisation(false), + extendedHeader(false), + experimentalIndicator(false), + footerPresent(false), + tagSize(0) {} + + ~HeaderPrivate() {} + + uint majorVersion; + uint revisionNumber; + + bool unsynchronisation; + bool extendedHeader; + bool experimentalIndicator; + bool footerPresent; + + uint tagSize; + + static const uint size = 10; +}; + +//////////////////////////////////////////////////////////////////////////////// +// static members +//////////////////////////////////////////////////////////////////////////////// + +TagLib::uint Header::size() +{ + return HeaderPrivate::size; +} + +ByteVector Header::fileIdentifier() +{ + return ByteVector::fromCString("ID3"); +} + +//////////////////////////////////////////////////////////////////////////////// +// public members +//////////////////////////////////////////////////////////////////////////////// + +Header::Header() +{ + d = new HeaderPrivate; +} + +Header::Header(const ByteVector &data) +{ + d = new HeaderPrivate; + parse(data); +} + +Header::~Header() +{ + delete d; +} + +TagLib::uint Header::majorVersion() const +{ + return d->majorVersion; +} + +TagLib::uint Header::revisionNumber() const +{ + return d->revisionNumber; +} + +bool Header::unsynchronisation() const +{ + return d->unsynchronisation; +} + +bool Header::extendedHeader() const +{ + return d->extendedHeader; +} + +bool Header::experimentalIndicator() const +{ + return d->experimentalIndicator; +} + +bool Header::footerPresent() const +{ + return d->footerPresent; +} + +TagLib::uint Header::tagSize() const +{ + return d->tagSize; +} + +TagLib::uint Header::completeTagSize() const +{ + if(d->footerPresent) + return d->tagSize + d->size + Footer::size(); + else + return d->tagSize + d->size; +} + +void Header::setTagSize(uint s) +{ + d->tagSize = s; +} + +void Header::setData(const ByteVector &data) +{ + parse(data); +} + +ByteVector Header::render() const +{ + ByteVector v; + + // add the file identifier -- "ID3" + v.append(fileIdentifier()); + + // add the version number -- we always render a 2.4.0 tag regardless of what + // the tag originally was. + + v.append(char(4)); + v.append(char(0)); + + // render and add the flags + std::bitset<8> flags; + + flags[7] = d->unsynchronisation; + flags[6] = d->extendedHeader; + flags[5] = d->experimentalIndicator; + flags[4] = d->footerPresent; + + v.append(char(flags.to_ulong())); + + // add the size + v.append(SynchData::fromUInt(d->tagSize)); + + return v; +} + +//////////////////////////////////////////////////////////////////////////////// +// protected members +//////////////////////////////////////////////////////////////////////////////// + +void Header::parse(const ByteVector &data) +{ + if(data.size() < size()) + return; + + + // do some sanity checking -- even in ID3v2.3.0 and less the tag size is a + // synch-safe integer, so all bytes must be less than 128. If this is not + // true then this is an invalid tag. + + // note that we're doing things a little out of order here -- the size is + // later in the bytestream than the version + + ByteVector sizeData = data.mid(6, 4); + + if(sizeData.size() != 4) { + d->tagSize = 0; + debug("TagLib::ID3v2::Header::parse() - The tag size as read was 0 bytes!"); + return; + } + + for(ByteVector::Iterator it = sizeData.begin(); it != sizeData.end(); it++) { + if(uchar(*it) >= 128) { + d->tagSize = 0; + debug("TagLib::ID3v2::Header::parse() - One of the size bytes in the id3v2 header was greater than the allowed 128."); + return; + } + } + + // The first three bytes, data[0..2], are the File Identifier, "ID3". (structure 3.1 "file identifier") + + // Read the version number from the fourth and fifth bytes. + d->majorVersion = data[3]; // (structure 3.1 "major version") + d->revisionNumber = data[4]; // (structure 3.1 "revision number") + + // Read the flags, the first four bits of the sixth byte. + std::bitset<8> flags(data[5]); + + d->unsynchronisation = flags[7]; // (structure 3.1.a) + d->extendedHeader = flags[6]; // (structure 3.1.b) + d->experimentalIndicator = flags[5]; // (structure 3.1.c) + d->footerPresent = flags[4]; // (structure 3.1.d) + + // Get the size from the remaining four bytes (read above) + + d->tagSize = SynchData::toUInt(sizeData); // (structure 3.1 "size") +} diff --git a/Libraries/TagLib/Files/taglib/mpeg/id3v2/id3v2header.h b/Libraries/TagLib/Files/taglib/mpeg/id3v2/id3v2header.h new file mode 100644 index 000000000..56d2fc8aa --- /dev/null +++ b/Libraries/TagLib/Files/taglib/mpeg/id3v2/id3v2header.h @@ -0,0 +1,159 @@ +/*************************************************************************** + copyright : (C) 2002, 2003 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#ifndef TAGLIB_ID3V2HEADER_H +#define TAGLIB_ID3V2HEADER_H + +#include + +namespace TagLib { + + namespace ID3v2 { + + //! An implementation of ID3v2 headers + + /*! + * This class implements ID3v2 headers. It attempts to follow, both + * semantically and programatically, the structure specified in + * the ID3v2 standard. The API is based on the properties of ID3v2 headers + * specified there. If any of the terms used in this documentation are + * unclear please check the specification in the linked section. + * (Structure, 3.1) + */ + + class Header + { + public: + /*! + * Constructs an empty ID3v2 header. + */ + Header(); + + /*! + * Constructs an ID3v2 header based on \a data. parse() is called + * immediately. + */ + Header(const ByteVector &data); + + /*! + * Destroys the header. + */ + virtual ~Header(); + + /*! + * Returns the major version number. (Note: This is the 4, not the 2 in + * ID3v2.4.0. The 2 is implied.) + */ + uint majorVersion() const; + + /*! + * Returns the revision number. (Note: This is the 0, not the 4 in + * ID3v2.4.0. The 2 is implied.) + */ + uint revisionNumber() const; + + /*! + * Returns true if unsynchronisation has been applied to all frames. + */ + bool unsynchronisation() const; + + /*! + * Returns true if an extended header is present in the tag. + */ + bool extendedHeader() const; + + /*! + * Returns true if the experimental indicator flag is set. + */ + bool experimentalIndicator() const; + + /*! + * Returns true if a footer is present in the tag. + */ + bool footerPresent() const; + /*! + * Returns the tag size in bytes. This is the size of the frame content. + * The size of the \e entire tag will be this plus the header size (10 + * bytes) and, if present, the footer size (potentially another 10 bytes). + * + * \note This is the value as read from the header to which TagLib attempts + * to provide an API to; it was not a design decision on the part of TagLib + * to not include the mentioned portions of the tag in the \e size. + * + * \see completeTagSize() + */ + uint tagSize() const; + + /*! + * Returns the tag size, including the header and, if present, the footer + * size. + * + * \see tagSize() + */ + uint completeTagSize() const; + + /*! + * Set the tag size to \a s. + * \see tagSize() + */ + void setTagSize(uint s); + + /*! + * Returns the size of the header. Presently this is always 10 bytes. + */ + static uint size(); + + /*! + * Returns the string used to identify and ID3v2 tag inside of a file. + * Presently this is always "ID3". + */ + static ByteVector fileIdentifier(); + + /*! + * Sets the data that will be used as the extended header. 10 bytes, + * starting from \a data will be used. + */ + void setData(const ByteVector &data); + + /*! + * Renders the Header back to binary format. + */ + ByteVector render() const; + + protected: + /*! + * Called by setData() to parse the header data. It makes this information + * available through the public API. + */ + void parse(const ByteVector &data); + + private: + Header(const Header &); + Header &operator=(const Header &); + + class HeaderPrivate; + HeaderPrivate *d; + }; + + } +} + +#endif diff --git a/Libraries/TagLib/Files/taglib/mpeg/id3v2/id3v2synchdata.cpp b/Libraries/TagLib/Files/taglib/mpeg/id3v2/id3v2synchdata.cpp new file mode 100644 index 000000000..ccb6046f5 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/mpeg/id3v2/id3v2synchdata.cpp @@ -0,0 +1,48 @@ +/*************************************************************************** + copyright : (C) 2002, 2003 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#include + +#include "id3v2synchdata.h" + +using namespace TagLib; +using namespace ID3v2; + +TagLib::uint SynchData::toUInt(const ByteVector &data) +{ + uint sum = 0; + int last = data.size() > 4 ? 3 : data.size() - 1; + + for(int i = 0; i <= last; i++) + sum |= (data[i] & 0x7f) << ((last - i) * 7); + + return sum; +} + +ByteVector SynchData::fromUInt(uint value) +{ + ByteVector v(4, 0); + + for(int i = 0; i < 4; i++) + v[i] = uchar(value >> ((3 - i) * 7) & 0x7f); + + return v; +} diff --git a/Libraries/TagLib/Files/taglib/mpeg/id3v2/id3v2synchdata.h b/Libraries/TagLib/Files/taglib/mpeg/id3v2/id3v2synchdata.h new file mode 100644 index 000000000..80a462f1b --- /dev/null +++ b/Libraries/TagLib/Files/taglib/mpeg/id3v2/id3v2synchdata.h @@ -0,0 +1,61 @@ +/*************************************************************************** + copyright : (C) 2002, 2003 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#ifndef TAGLIB_ID3V2SYNCHDATA_H +#define TAGLIB_ID3V2SYNCHDATA_H + +#include +#include + +namespace TagLib { + + namespace ID3v2 { + + //! A few functions for ID3v2 synch safe integer conversion + + /*! + * In the ID3v2.4 standard most integer values are encoded as "synch safe" + * integers which are encoded in such a way that they will not give false + * MPEG syncs and confuse MPEG decoders. This namespace provides some + * methods for converting to and from these values to ByteVectors for + * things rendering and parsing ID3v2 data. + */ + + namespace SynchData + { + /*! + * This returns the unsigned integer value of \a data where \a data is a + * ByteVector that contains a \e synchsafe integer (Structure, + * 6.2). The default \a length of + * 4 is used if another value is not specified. + */ + uint toUInt(const ByteVector &data); + + /*! + * Returns a 4 byte (32 bit) synchsafe integer based on \a value. + */ + ByteVector fromUInt(uint value); + } + + } +} + +#endif diff --git a/Libraries/TagLib/Files/taglib/mpeg/id3v2/id3v2tag.cpp b/Libraries/TagLib/Files/taglib/mpeg/id3v2/id3v2tag.cpp new file mode 100644 index 000000000..00249b81e --- /dev/null +++ b/Libraries/TagLib/Files/taglib/mpeg/id3v2/id3v2tag.cpp @@ -0,0 +1,464 @@ +/*************************************************************************** + copyright : (C) 2002, 2003 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#include +#include + +#include "id3v2tag.h" +#include "id3v2header.h" +#include "id3v2extendedheader.h" +#include "id3v2footer.h" + +#include "id3v1genres.h" + +#include "frames/textidentificationframe.h" +#include "frames/commentsframe.h" + +using namespace TagLib; +using namespace ID3v2; + +class ID3v2::Tag::TagPrivate +{ +public: + TagPrivate() : file(0), tagOffset(-1), extendedHeader(0), footer(0), paddingSize(0) + { + frameList.setAutoDelete(true); + } + ~TagPrivate() + { + delete extendedHeader; + delete footer; + } + + File *file; + long tagOffset; + const FrameFactory *factory; + + Header header; + ExtendedHeader *extendedHeader; + Footer *footer; + + int paddingSize; + + FrameListMap frameListMap; + FrameList frameList; +}; + +//////////////////////////////////////////////////////////////////////////////// +// public members +//////////////////////////////////////////////////////////////////////////////// + +ID3v2::Tag::Tag() : TagLib::Tag() +{ + d = new TagPrivate; + d->factory = FrameFactory::instance(); +} + +ID3v2::Tag::Tag(File *file, long tagOffset, const FrameFactory *factory) : + TagLib::Tag() +{ + d = new TagPrivate; + + d->file = file; + d->tagOffset = tagOffset; + d->factory = factory; + + read(); +} + +ID3v2::Tag::~Tag() +{ + delete d; +} + + +String ID3v2::Tag::title() const +{ + if(!d->frameListMap["TIT2"].isEmpty()) + return d->frameListMap["TIT2"].front()->toString(); + return String::null; +} + +String ID3v2::Tag::artist() const +{ + if(!d->frameListMap["TPE1"].isEmpty()) + return d->frameListMap["TPE1"].front()->toString(); + return String::null; +} + +String ID3v2::Tag::album() const +{ + if(!d->frameListMap["TALB"].isEmpty()) + return d->frameListMap["TALB"].front()->toString(); + return String::null; +} + +String ID3v2::Tag::comment() const +{ + if(!d->frameListMap["COMM"].isEmpty()) + return d->frameListMap["COMM"].front()->toString(); + return String::null; +} + +String ID3v2::Tag::genre() const +{ + // TODO: In the next major version (TagLib 2.0) a list of multiple genres + // should be separated by " / " instead of " ". For the moment to keep + // the behavior the same as released versions it is being left with " ". + + if(!d->frameListMap["TCON"].isEmpty() && + dynamic_cast(d->frameListMap["TCON"].front())) + { + Frame *frame = d->frameListMap["TCON"].front(); + + // ID3v2.4 lists genres as the fields in its frames field list. If the field + // is simply a number it can be assumed that it is an ID3v1 genre number. + // Here was assume that if an ID3v1 string is present that it should be + // appended to the genre string. Multiple fields will be appended as the + // string is built. + + if(d->header.majorVersion() == 4) { + TextIdentificationFrame *f = static_cast(frame); + StringList fields = f->fieldList(); + + String genreString; + bool hasNumber = false; + + for(StringList::ConstIterator it = fields.begin(); it != fields.end(); ++it) { + bool isNumber = true; + for(String::ConstIterator charIt = (*it).begin(); + isNumber && charIt != (*it).end(); + ++charIt) + { + isNumber = *charIt >= '0' && *charIt <= '9'; + } + + if(!genreString.isEmpty()) + genreString.append(' '); + + if(isNumber) { + int number = (*it).toInt(); + if(number >= 0 && number <= 255) { + hasNumber = true; + genreString.append(ID3v1::genre(number)); + } + } + else + genreString.append(*it); + } + if(hasNumber) + return genreString; + } + + String s = frame->toString(); + + // ID3v2.3 "content type" can contain a ID3v1 genre number in parenthesis at + // the beginning of the field. If this is all that the field contains, do a + // translation from that number to the name and return that. If there is a + // string folloing the ID3v1 genre number, that is considered to be + // authoritative and we return that instead. Or finally, the field may + // simply be free text, in which case we just return the value. + + int closing = s.find(")"); + if(s.substr(0, 1) == "(" && closing > 0) { + if(closing == int(s.size() - 1)) + return ID3v1::genre(s.substr(1, s.size() - 2).toInt()); + else + return s.substr(closing + 1); + } + return s; + } + return String::null; +} + +TagLib::uint ID3v2::Tag::year() const +{ + if(!d->frameListMap["TDRC"].isEmpty()) + return d->frameListMap["TDRC"].front()->toString().substr(0, 4).toInt(); + return 0; +} + +TagLib::uint ID3v2::Tag::track() const +{ + if(!d->frameListMap["TRCK"].isEmpty()) + return d->frameListMap["TRCK"].front()->toString().toInt(); + return 0; +} + +void ID3v2::Tag::setTitle(const String &s) +{ + setTextFrame("TIT2", s); +} + +void ID3v2::Tag::setArtist(const String &s) +{ + setTextFrame("TPE1", s); +} + +void ID3v2::Tag::setAlbum(const String &s) +{ + setTextFrame("TALB", s); +} + +void ID3v2::Tag::setComment(const String &s) +{ + if(s.isEmpty()) { + removeFrames("COMM"); + return; + } + + if(!d->frameListMap["COMM"].isEmpty()) + d->frameListMap["COMM"].front()->setText(s); + else { + CommentsFrame *f = new CommentsFrame(d->factory->defaultTextEncoding()); + addFrame(f); + f->setText(s); + } +} + +void ID3v2::Tag::setGenre(const String &s) +{ + if(s.isEmpty()) { + removeFrames("TCON"); + return; + } + + int index = ID3v1::genreIndex(s); + + if(index != 255) + setTextFrame("TCON", String::number(index)); + else + setTextFrame("TCON", s); +} + +void ID3v2::Tag::setYear(uint i) +{ + if(i <= 0) { + removeFrames("TDRC"); + return; + } + setTextFrame("TDRC", String::number(i)); +} + +void ID3v2::Tag::setTrack(uint i) +{ + if(i <= 0) { + removeFrames("TRCK"); + return; + } + setTextFrame("TRCK", String::number(i)); +} + +bool ID3v2::Tag::isEmpty() const +{ + return d->frameList.isEmpty(); +} + +Header *ID3v2::Tag::header() const +{ + return &(d->header); +} + +ExtendedHeader *ID3v2::Tag::extendedHeader() const +{ + return d->extendedHeader; +} + +Footer *ID3v2::Tag::footer() const +{ + return d->footer; +} + +const FrameListMap &ID3v2::Tag::frameListMap() const +{ + return d->frameListMap; +} + +const FrameList &ID3v2::Tag::frameList() const +{ + return d->frameList; +} + +const FrameList &ID3v2::Tag::frameList(const ByteVector &frameID) const +{ + return d->frameListMap[frameID]; +} + +void ID3v2::Tag::addFrame(Frame *frame) +{ + d->frameList.append(frame); + d->frameListMap[frame->frameID()].append(frame); +} + +void ID3v2::Tag::removeFrame(Frame *frame, bool del) +{ + // remove the frame from the frame list + FrameList::Iterator it = d->frameList.find(frame); + d->frameList.erase(it); + + // ...and from the frame list map + it = d->frameListMap[frame->frameID()].find(frame); + d->frameListMap[frame->frameID()].erase(it); + + // ...and delete as desired + if(del) + delete *it; +} + +void ID3v2::Tag::removeFrames(const ByteVector &id) +{ + FrameList l = d->frameListMap[id]; + for(FrameList::Iterator it = l.begin(); it != l.end(); ++it) + removeFrame(*it, true); +} + +ByteVector ID3v2::Tag::render() const +{ + // We need to render the "tag data" first so that we have to correct size to + // render in the tag's header. The "tag data" -- everything that is included + // in ID3v2::Header::tagSize() -- includes the extended header, frames and + // padding, but does not include the tag's header or footer. + + ByteVector tagData; + + // TODO: Render the extended header. + + // Loop through the frames rendering them and adding them to the tagData. + + for(FrameList::Iterator it = d->frameList.begin(); it != d->frameList.end(); it++) + tagData.append((*it)->render()); + + // Compute the amount of padding, and append that to tagData. + + uint paddingSize = 0; + uint originalSize = d->header.tagSize(); + + if(tagData.size() < originalSize) + paddingSize = originalSize - tagData.size(); + else + paddingSize = 1024; + + tagData.append(ByteVector(paddingSize, char(0))); + + // Set the tag size. + d->header.setTagSize(tagData.size()); + + // TODO: This should eventually include d->footer->render(). + return d->header.render() + tagData; +} + +//////////////////////////////////////////////////////////////////////////////// +// protected members +//////////////////////////////////////////////////////////////////////////////// + +void ID3v2::Tag::read() +{ + if(d->file && d->file->isOpen()) { + + d->file->seek(d->tagOffset); + d->header.setData(d->file->readBlock(Header::size())); + + // if the tag size is 0, then this is an invalid tag (tags must contain at + // least one frame) + + if(d->header.tagSize() == 0) + return; + + parse(d->file->readBlock(d->header.tagSize())); + } +} + +void ID3v2::Tag::parse(const ByteVector &data) +{ + uint frameDataPosition = 0; + uint frameDataLength = data.size(); + + // check for extended header + + if(d->header.extendedHeader()) { + if(!d->extendedHeader) + d->extendedHeader = new ExtendedHeader; + d->extendedHeader->setData(data); + if(d->extendedHeader->size() <= data.size()) { + frameDataPosition += d->extendedHeader->size(); + frameDataLength -= d->extendedHeader->size(); + } + } + + // check for footer -- we don't actually need to parse it, as it *must* + // contain the same data as the header, but we do need to account for its + // size. + + if(d->header.footerPresent() && Footer::size() <= frameDataLength) + frameDataLength -= Footer::size(); + + // parse frames + + // Make sure that there is at least enough room in the remaining frame data for + // a frame header. + + while(frameDataPosition < frameDataLength - Frame::headerSize(d->header.majorVersion())) { + + // If the next data is position is 0, assume that we've hit the padding + // portion of the frame data. + + if(data.at(frameDataPosition) == 0) { + if(d->header.footerPresent()) + debug("Padding *and* a footer found. This is not allowed by the spec."); + + d->paddingSize = frameDataLength - frameDataPosition; + return; + } + + Frame *frame = d->factory->createFrame(data.mid(frameDataPosition), + d->header.majorVersion()); + + if(!frame) + return; + + // Checks to make sure that frame parsed correctly. + + if(frame->size() <= 0) { + delete frame; + return; + } + + frameDataPosition += frame->size() + Frame::headerSize(d->header.majorVersion()); + addFrame(frame); + } +} + +void ID3v2::Tag::setTextFrame(const ByteVector &id, const String &value) +{ + if(value.isEmpty()) { + removeFrames(id); + return; + } + + if(!d->frameListMap[id].isEmpty()) + d->frameListMap[id].front()->setText(value); + else { + const String::Type encoding = d->factory->defaultTextEncoding(); + TextIdentificationFrame *f = new TextIdentificationFrame(id, encoding); + addFrame(f); + f->setText(value); + } +} diff --git a/Libraries/TagLib/Files/taglib/mpeg/id3v2/id3v2tag.h b/Libraries/TagLib/Files/taglib/mpeg/id3v2/id3v2tag.h new file mode 100644 index 000000000..5606c9d9c --- /dev/null +++ b/Libraries/TagLib/Files/taglib/mpeg/id3v2/id3v2tag.h @@ -0,0 +1,295 @@ +/*************************************************************************** + copyright : (C) 2002, 2003 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#ifndef TAGLIB_ID3V2TAG_H +#define TAGLIB_ID3V2TAG_H + +#include +#include +#include +#include +#include + +#include "id3v2framefactory.h" + +namespace TagLib { + + class File; + + //! An ID3v2 implementation + + /*! + * This is a relatively complete and flexible framework for working with ID3v2 + * tags. + * + * \see ID3v2::Tag + */ + + namespace ID3v2 { + + class Header; + class ExtendedHeader; + class Footer; + + typedef List FrameList; + typedef Map FrameListMap; + + //! The main class in the ID3v2 implementation + + /*! + * This is the main class in the ID3v2 implementation. It serves two + * functions. This first, as is obvious from the public API, is to provide a + * container for the other ID3v2 related classes. In addition, through the + * read() and parse() protected methods, it provides the most basic level of + * parsing. In these methods the ID3v2 tag is extracted from the file and + * split into data components. + * + * ID3v2 tags have several parts, TagLib attempts to provide an interface + * for them all. header(), footer() and extendedHeader() corespond to those + * data structures in the ID3v2 standard and the APIs for the classes that + * they return attempt to reflect this. + * + * Also ID3v2 tags are built up from a list of frames, which are in turn + * have a header and a list of fields. TagLib provides two ways of accessing + * the list of frames that are in a given ID3v2 tag. The first is simply + * via the frameList() method. This is just a list of pointers to the frames. + * The second is a map from the frame type -- i.e. "COMM" for comments -- and + * a list of frames of that type. (In some cases ID3v2 allows for multiple + * frames of the same type, hence this being a map to a list rather than just + * a map to an individual frame.) + * + * More information on the structure of frames can be found in the ID3v2::Frame + * class. + * + * read() and parse() pass binary data to the other ID3v2 class structures, + * they do not handle parsing of flags or fields, for instace. Those are + * handled by similar functions within those classes. + * + * \note All pointers to data structures within the tag will become invalid + * when the tag is destroyed. + * + * \warning Dealing with the nasty details of ID3v2 is not for the faint of + * heart and should not be done without much meditation on the spec. It's + * rather long, but if you're planning on messing with this class and others + * that deal with the details of ID3v2 (rather than the nice, safe, abstract + * TagLib::Tag and friends), it's worth your time to familiarize yourself + * with said spec (which is distrubuted with the TagLib sources). TagLib + * tries to do most of the work, but with a little luck, you can still + * convince it to generate invalid ID3v2 tags. The APIs for ID3v2 assume a + * working knowledge of ID3v2 structure. You're been warned. + */ + + class Tag : public TagLib::Tag + { + public: + /*! + * Constructs an empty ID3v2 tag. + * + * \note You must create at least one frame for this tag to be valid. + */ + Tag(); + + /*! + * Constructs an ID3v2 tag read from \a file starting at \a tagOffset. + * \a factory specifies which FrameFactory will be used for the + * construction of new frames. + * + * \note You should be able to ignore the \a factory parameter in almost + * all situations. You would want to specify your own FrameFactory + * subclass in the case that you are extending TagLib to support additional + * frame types, which would be incorperated into your factory. + * + * \see FrameFactory + */ + Tag(File *file, long tagOffset, + const FrameFactory *factory = FrameFactory::instance()); + + /*! + * Destroys this Tag instance. + */ + virtual ~Tag(); + + // Reimplementations. + + virtual String title() const; + virtual String artist() const; + virtual String album() const; + virtual String comment() const; + virtual String genre() const; + virtual uint year() const; + virtual uint track() const; + + virtual void setTitle(const String &s); + virtual void setArtist(const String &s); + virtual void setAlbum(const String &s); + virtual void setComment(const String &s); + virtual void setGenre(const String &s); + virtual void setYear(uint i); + virtual void setTrack(uint i); + + virtual bool isEmpty() const; + + /*! + * Returns a pointer to the tag's header. + */ + Header *header() const; + + /*! + * Returns a pointer to the tag's extended header or null if there is no + * extended header. + */ + ExtendedHeader *extendedHeader() const; + + /*! + * Returns a pointer to the tag's footer or null if there is no footer. + * + * \deprecated I don't see any reason to keep this around since there's + * nothing useful to be retrieved from the footer, but well, again, I'm + * prone to change my mind, so this gets to stay around until near a + * release. + */ + Footer *footer() const; + + /*! + * Returns a reference to the frame list map. This is an FrameListMap of + * all of the frames in the tag. + * + * This is the most convenient structure for accessing the tag's frames. + * Many frame types allow multiple instances of the same frame type so this + * is a map of lists. In most cases however there will only be a single + * frame of a certain type. + * + * Let's say for instance that you wanted to access the frame for total + * beats per minute -- the TBPM frame. + * + * \code + * TagLib::MPEG::File f("foo.mp3"); + * + * // Check to make sure that it has an ID3v2 tag + * + * if(f.ID3v2Tag()) { + * + * // Get the list of frames for a specific frame type + * + * TagLib::ID3v2::FrameList l = f.ID3v2Tag()->frameListMap()["TBPM"]; + * + * if(!l.isEmpty()) + * std::cout << l.front().toString() << std::endl; + * } + * + * \endcode + * + * \warning You should not modify this data structure directly, instead + * use addFrame() and removeFrame(). + * + * \see frameList() + */ + const FrameListMap &frameListMap() const; + + /*! + * Returns a reference to the frame list. This is an FrameList of all of + * the frames in the tag in the order that they were parsed. + * + * This can be useful if for example you want iterate over the tag's frames + * in the order that they occur in the tag. + * + * \warning You should not modify this data structure directly, instead + * use addFrame() and removeFrame(). + */ + const FrameList &frameList() const; + + /*! + * Returns the frame list for frames with the id \a frameID or an empty + * list if there are no frames of that type. This is just a convenience + * and is equivalent to: + * + * \code + * frameListMap()[frameID]; + * \endcode + * + * \see frameListMap() + */ + const FrameList &frameList(const ByteVector &frameID) const; + + /*! + * Add a frame to the tag. At this point the tag takes ownership of + * the frame and will handle freeing its memory. + * + * \note Using this method will invalidate any pointers on the list + * returned by frameList() + */ + void addFrame(Frame *frame); + + /*! + * Remove a frame from the tag. If \a del is true the frame's memory + * will be freed; if it is false, it must be deleted by the user. + * + * \note Using this method will invalidate any pointers on the list + * returned by frameList() + */ + void removeFrame(Frame *frame, bool del = true); + + /*! + * Remove all frames of type \a id from the tag and free their memory. + * + * \note Using this method will invalidate any pointers on the list + * returned by frameList() + */ + void removeFrames(const ByteVector &id); + + /*! + * Render the tag back to binary data, suitable to be written to disk. + */ + ByteVector render() const; + + protected: + /*! + * Reads data from the file specified in the constructor. It does basic + * parsing of the data in the largest chunks. It partitions the tag into + * the Header, the body of the tag (which contains the ExtendedHeader and + * frames) and Footer. + */ + void read(); + + /*! + * This is called by read to parse the body of the tag. It determines if an + * extended header exists and adds frames to the FrameListMap. + */ + void parse(const ByteVector &data); + + /*! + * Sets the value of the text frame with the Frame ID \a id to \a value. + * If the frame does not exist, it is created. + */ + void setTextFrame(const ByteVector &id, const String &value); + + private: + Tag(const Tag &); + Tag &operator=(const Tag &); + + class TagPrivate; + TagPrivate *d; + }; + + } +} + +#endif diff --git a/Libraries/TagLib/Files/taglib/mpeg/mpegfile.cpp b/Libraries/TagLib/Files/taglib/mpeg/mpegfile.cpp new file mode 100644 index 000000000..56c1b4870 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/mpeg/mpegfile.cpp @@ -0,0 +1,698 @@ +/*************************************************************************** + copyright : (C) 2002, 2003 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#include +#include +#include +#include +#include +#include + +#include + +#include "mpegfile.h" +#include "mpegheader.h" + +using namespace TagLib; + +namespace TagLib { + /*! + * A union of the ID3v2 and ID3v1 tags. + */ + class MPEGTag : public TagLib::Tag + { + public: + MPEGTag(MPEG::File *f) : TagLib::Tag(), file(f) {} + + virtual String title() const + { + if(file->ID3v2Tag() && !file->ID3v2Tag()->title().isEmpty()) + return file->ID3v2Tag()->title(); + + if(file->ID3v1Tag()) + return file->ID3v1Tag()->title(); + + return String::null; + } + + virtual String artist() const + { + if(file->ID3v2Tag() && !file->ID3v2Tag()->artist().isEmpty()) + return file->ID3v2Tag()->artist(); + + if(file->ID3v1Tag()) + return file->ID3v1Tag()->artist(); + + return String::null; + } + + virtual String album() const + { + if(file->ID3v2Tag() && !file->ID3v2Tag()->album().isEmpty()) + return file->ID3v2Tag()->album(); + + if(file->ID3v1Tag()) + return file->ID3v1Tag()->album(); + + return String::null; + } + + virtual String comment() const + { + if(file->ID3v2Tag() && !file->ID3v2Tag()->comment().isEmpty()) + return file->ID3v2Tag()->comment(); + + if(file->ID3v1Tag()) + return file->ID3v1Tag()->comment(); + + return String::null; + } + + virtual String genre() const + { + if(file->ID3v2Tag() && !file->ID3v2Tag()->genre().isEmpty()) + return file->ID3v2Tag()->genre(); + + if(file->ID3v1Tag()) + return file->ID3v1Tag()->genre(); + + return String::null; + } + + virtual uint year() const + { + if(file->ID3v2Tag() && file->ID3v2Tag()->year() > 0) + return file->ID3v2Tag()->year(); + + if(file->ID3v1Tag()) + return file->ID3v1Tag()->year(); + + return 0; + } + + virtual uint track() const + { + if(file->ID3v2Tag() && file->ID3v2Tag()->track() > 0) + return file->ID3v2Tag()->track(); + + if(file->ID3v1Tag()) + return file->ID3v1Tag()->track(); + + return 0; + } + + virtual void setTitle(const String &s) + { + file->ID3v2Tag(true)->setTitle(s); + file->ID3v1Tag(true)->setTitle(s); + } + + virtual void setArtist(const String &s) + { + file->ID3v2Tag(true)->setArtist(s); + file->ID3v1Tag(true)->setArtist(s); + } + + virtual void setAlbum(const String &s) + { + file->ID3v2Tag(true)->setAlbum(s); + file->ID3v1Tag(true)->setAlbum(s); + } + + virtual void setComment(const String &s) + { + file->ID3v2Tag(true)->setComment(s); + file->ID3v1Tag(true)->setComment(s); + } + + virtual void setGenre(const String &s) + { + file->ID3v2Tag(true)->setGenre(s); + file->ID3v1Tag(true)->setGenre(s); + } + + virtual void setYear(uint i) + { + file->ID3v2Tag(true)->setYear(i); + file->ID3v1Tag(true)->setYear(i); + } + + virtual void setTrack(uint i) + { + file->ID3v2Tag(true)->setTrack(i); + file->ID3v1Tag(true)->setTrack(i); + } + + private: + MPEG::File *file; + }; +} + +class MPEG::File::FilePrivate +{ +public: + FilePrivate(ID3v2::FrameFactory *frameFactory = ID3v2::FrameFactory::instance()) : + ID3v2FrameFactory(frameFactory), + ID3v2Tag(0), + ID3v2Location(-1), + ID3v2OriginalSize(0), + APETag(0), + APELocation(-1), + APEOriginalSize(0), + ID3v1Tag(0), + ID3v1Location(-1), + tag(0), + hasID3v2(false), + hasID3v1(false), + hasAPE(false), + properties(0) {} + + ~FilePrivate() { + delete ID3v2Tag; + delete ID3v1Tag; + delete tag; + delete properties; + } + + const ID3v2::FrameFactory *ID3v2FrameFactory; + ID3v2::Tag *ID3v2Tag; + long ID3v2Location; + uint ID3v2OriginalSize; + + APE::Tag *APETag; + long APELocation; + uint APEOriginalSize; + + ID3v1::Tag *ID3v1Tag; + long ID3v1Location; + + MPEGTag *tag; + + // These indicate whether the file *on disk* has these tags, not if + // this data structure does. This is used in computing offsets. + + bool hasID3v2; + bool hasID3v1; + bool hasAPE; + + Properties *properties; +}; + +//////////////////////////////////////////////////////////////////////////////// +// public members +//////////////////////////////////////////////////////////////////////////////// + +MPEG::File::File(const char *file, bool readProperties, + Properties::ReadStyle propertiesStyle) : TagLib::File(file) +{ + d = new FilePrivate; + if(isOpen()) { + d->tag = new MPEGTag(this); + read(readProperties, propertiesStyle); + } +} + +MPEG::File::File(const char *file, ID3v2::FrameFactory *frameFactory, + bool readProperties, Properties::ReadStyle propertiesStyle) : + TagLib::File(file) +{ + d = new FilePrivate(frameFactory); + if(isOpen()) { + d->tag = new MPEGTag(this); + read(readProperties, propertiesStyle); + } +} + +MPEG::File::~File() +{ + delete d; +} + +TagLib::Tag *MPEG::File::tag() const +{ + return d->tag; +} + +MPEG::Properties *MPEG::File::audioProperties() const +{ + return d->properties; +} + +bool MPEG::File::save() +{ + return save(AllTags); +} + +bool MPEG::File::save(int tags) +{ + if(tags == NoTags) + return strip(AllTags); + + if(!d->ID3v2Tag && !d->ID3v1Tag && !d->APETag) { + + if(d->hasID3v1 || d->hasID3v2 || d->hasAPE) + return strip(AllTags); + + return true; + } + + if(readOnly()) { + debug("MPEG::File::save() -- File is read only."); + return false; + } + + // Create the tags if we've been asked to. Copy the values from the tag that + // does exist into the new tag. + + if((tags & ID3v2) && d->ID3v1Tag) + Tag::duplicate(d->ID3v1Tag, ID3v2Tag(true), false); + + if((tags & ID3v1) && d->ID3v2Tag) + Tag::duplicate(d->ID3v2Tag, ID3v1Tag(true), false); + + bool success = true; + + if(ID3v2 & tags) { + + if(d->ID3v2Tag && !d->ID3v2Tag->isEmpty()) { + + if(!d->hasID3v2) + d->ID3v2Location = 0; + + insert(d->ID3v2Tag->render(), d->ID3v2Location, d->ID3v2OriginalSize); + } + else + success = strip(ID3v2, false) && success; + } + else if(d->hasID3v2) + success = strip(ID3v2) && success; + + if(ID3v1 & tags) { + if(d->ID3v1Tag && !d->ID3v1Tag->isEmpty()) { + int offset = d->hasID3v1 ? -128 : 0; + seek(offset, End); + writeBlock(d->ID3v1Tag->render()); + } + else + success = strip(ID3v1) && success; + } + else if(d->hasID3v1) + success = strip(ID3v1, false) && success; + + // Dont save an APE-tag unless one has been created + if((APE & tags) && d->APETag) { + if(d->hasAPE) + insert(d->APETag->render(), d->APELocation, d->APEOriginalSize); + else { + if(d->hasID3v1) { + insert(d->APETag->render(), d->ID3v1Location, 0); + d->APEOriginalSize = d->APETag->footer()->completeTagSize(); + d->hasAPE = true; + d->APELocation = d->ID3v1Location; + d->ID3v1Location += d->APEOriginalSize; + } + else { + seek(0, End); + d->APELocation = tell(); + writeBlock(d->APETag->render()); + d->APEOriginalSize = d->APETag->footer()->completeTagSize(); + d->hasAPE = true; + } + } + } + else if(d->hasAPE) + success = strip(APE, false) && success; + + return success; +} + +ID3v2::Tag *MPEG::File::ID3v2Tag(bool create) +{ + if(!create || d->ID3v2Tag) + return d->ID3v2Tag; + + // no ID3v2 tag exists and we've been asked to create one + + d->ID3v2Tag = new ID3v2::Tag; + return d->ID3v2Tag; +} + +ID3v1::Tag *MPEG::File::ID3v1Tag(bool create) +{ + if(!create || d->ID3v1Tag) + return d->ID3v1Tag; + + // no ID3v1 tag exists and we've been asked to create one + + d->ID3v1Tag = new ID3v1::Tag; + return d->ID3v1Tag; +} + +APE::Tag *MPEG::File::APETag(bool create) +{ + if(!create || d->APETag) + return d->APETag; + + // no APE tag exists and we've been asked to create one + + d->APETag = new APE::Tag; + return d->APETag; +} + +bool MPEG::File::strip(int tags) +{ + return strip(tags, true); +} + +bool MPEG::File::strip(int tags, bool freeMemory) +{ + if(readOnly()) { + debug("MPEG::File::strip() - Cannot strip tags from a read only file."); + return false; + } + + if((tags & ID3v2) && d->hasID3v2) { + removeBlock(d->ID3v2Location, d->ID3v2OriginalSize); + d->ID3v2Location = -1; + d->ID3v2OriginalSize = 0; + d->hasID3v2 = false; + if(freeMemory) { + delete d->ID3v2Tag; + d->ID3v2Tag = 0; + } + + // v1 tag location has changed, update if it exists + if(d->ID3v1Tag) + d->ID3v1Location = findID3v1(); + } + + if((tags & ID3v1) && d->hasID3v1) { + truncate(d->ID3v1Location); + d->ID3v1Location = -1; + d->hasID3v1 = false; + if(freeMemory) { + delete d->ID3v1Tag; + d->ID3v1Tag = 0; + } + } + + if((tags & APE) && d->hasAPE) { + removeBlock(d->APELocation, d->APEOriginalSize); + d->APELocation = -1; + d->hasAPE = false; + if(d->hasID3v1) { + if (d->ID3v1Location > d->APELocation) + d->ID3v1Location -= d->APEOriginalSize; + } + if(freeMemory) { + delete d->APETag; + d->APETag = 0; + } + } + + return true; +} + +void MPEG::File::setID3v2FrameFactory(const ID3v2::FrameFactory *factory) +{ + d->ID3v2FrameFactory = factory; +} + +long MPEG::File::nextFrameOffset(long position) +{ + // TODO: This will miss syncs spanning buffer read boundaries. + + ByteVector buffer = readBlock(bufferSize()); + + while(buffer.size() > 0) { + seek(position); + ByteVector buffer = readBlock(bufferSize()); + + for(uint i = 0; i < buffer.size(); i++) { + if(uchar(buffer[i]) == 0xff && secondSynchByte(buffer[i + 1])) + return position + i; + } + position += bufferSize(); + } + + return -1; +} + +long MPEG::File::previousFrameOffset(long position) +{ + // TODO: This will miss syncs spanning buffer read boundaries. + + while(int(position - bufferSize()) > int(bufferSize())) { + position -= bufferSize(); + seek(position); + ByteVector buffer = readBlock(bufferSize()); + + // If the amount of data is smaller than an MPEG header (4 bytes) there's no + // chance of this being valid. + + if(buffer.size() < 4) + return -1; + + for(int i = buffer.size() - 2; i >= 0; i--) { + if(uchar(buffer[i]) == 0xff && secondSynchByte(buffer[i + 1])) + return position + i; + } + } + + return -1; +} + +long MPEG::File::firstFrameOffset() +{ + long position = 0; + + if(d->ID3v2Tag) + position = d->ID3v2Location + d->ID3v2Tag->header()->completeTagSize(); + + return nextFrameOffset(position); +} + +long MPEG::File::lastFrameOffset() +{ + return previousFrameOffset(d->ID3v1Tag ? d->ID3v1Location - 1 : length()); +} + +//////////////////////////////////////////////////////////////////////////////// +// private members +//////////////////////////////////////////////////////////////////////////////// + +void MPEG::File::read(bool readProperties, Properties::ReadStyle propertiesStyle) +{ + // Look for an ID3v2 tag + + d->ID3v2Location = findID3v2(); + + if(d->ID3v2Location >= 0) { + + d->ID3v2Tag = new ID3v2::Tag(this, d->ID3v2Location, d->ID3v2FrameFactory); + + d->ID3v2OriginalSize = d->ID3v2Tag->header()->completeTagSize(); + + if(d->ID3v2Tag->header()->tagSize() <= 0) { + delete d->ID3v2Tag; + d->ID3v2Tag = 0; + } + else + d->hasID3v2 = true; + } + + // Look for an ID3v1 tag + + d->ID3v1Location = findID3v1(); + + if(d->ID3v1Location >= 0) { + d->ID3v1Tag = new ID3v1::Tag(this, d->ID3v1Location); + d->hasID3v1 = true; + } + + // Look for an APE tag + + d->APELocation = findAPE(); + + if(d->APELocation >= 0) { + + d->APETag = new APE::Tag(this, d->APELocation); + + d->APEOriginalSize = d->APETag->footer()->completeTagSize(); + + d->APELocation = d->APELocation + d->APETag->footer()->size() - d->APEOriginalSize; + + d->hasAPE = true; + } + + if(readProperties) + d->properties = new Properties(this, propertiesStyle); +} + +long MPEG::File::findID3v2() +{ + // This method is based on the contents of TagLib::File::find(), but because + // of some subtlteies -- specifically the need to look for the bit pattern of + // an MPEG sync, it has been modified for use here. + + if(isValid() && ID3v2::Header::fileIdentifier().size() <= bufferSize()) { + + // The position in the file that the current buffer starts at. + + long bufferOffset = 0; + ByteVector buffer; + + // These variables are used to keep track of a partial match that happens at + // the end of a buffer. + + int previousPartialMatch = -1; + bool previousPartialSynchMatch = false; + + // Save the location of the current read pointer. We will restore the + // position using seek() before all returns. + + long originalPosition = tell(); + + // Start the search at the beginning of the file. + + seek(0); + + // This loop is the crux of the find method. There are three cases that we + // want to account for: + // (1) The previously searched buffer contained a partial match of the search + // pattern and we want to see if the next one starts with the remainder of + // that pattern. + // + // (2) The search pattern is wholly contained within the current buffer. + // + // (3) The current buffer ends with a partial match of the pattern. We will + // note this for use in the next itteration, where we will check for the rest + // of the pattern. + + for(buffer = readBlock(bufferSize()); buffer.size() > 0; buffer = readBlock(bufferSize())) { + + // (1) previous partial match + + if(previousPartialSynchMatch && secondSynchByte(buffer[0])) + return -1; + + if(previousPartialMatch >= 0 && int(bufferSize()) > previousPartialMatch) { + const int patternOffset = (bufferSize() - previousPartialMatch); + if(buffer.containsAt(ID3v2::Header::fileIdentifier(), 0, patternOffset)) { + seek(originalPosition); + return bufferOffset - bufferSize() + previousPartialMatch; + } + } + + // (2) pattern contained in current buffer + + long location = buffer.find(ID3v2::Header::fileIdentifier()); + if(location >= 0) { + seek(originalPosition); + return bufferOffset + location; + } + + int firstSynchByte = buffer.find(char(uchar(255))); + + // Here we have to loop because there could be several of the first + // (11111111) byte, and we want to check all such instances until we find + // a full match (11111111 111) or hit the end of the buffer. + + while(firstSynchByte >= 0) { + + // if this *is not* at the end of the buffer + + if(firstSynchByte < int(buffer.size()) - 1) { + if(secondSynchByte(buffer[firstSynchByte + 1])) { + // We've found the frame synch pattern. + seek(originalPosition); + return -1; + } + else { + + // We found 11111111 at the end of the current buffer indicating a + // partial match of the synch pattern. The find() below should + // return -1 and break out of the loop. + + previousPartialSynchMatch = true; + } + } + + // Check in the rest of the buffer. + + firstSynchByte = buffer.find(char(uchar(255)), firstSynchByte + 1); + } + + // (3) partial match + + previousPartialMatch = buffer.endsWithPartialMatch(ID3v2::Header::fileIdentifier()); + + bufferOffset += bufferSize(); + } + + // Since we hit the end of the file, reset the status before continuing. + + clear(); + + seek(originalPosition); + } + + return -1; +} + +long MPEG::File::findID3v1() +{ + if(isValid()) { + seek(-128, End); + long p = tell(); + + if(readBlock(3) == ID3v1::Tag::fileIdentifier()) + return p; + } + return -1; +} + +long MPEG::File::findAPE() +{ + if(isValid()) { + if (d->hasID3v1) + seek(-160, End); + else + seek(-32, End); + + long p = tell(); + + if(readBlock(8) == APE::Tag::fileIdentifier()) + return p; + } + return -1; +} + +bool MPEG::File::secondSynchByte(char byte) +{ + if(uchar(byte) == 0xff) + return false; + + std::bitset<8> b(byte); + + // check to see if the byte matches 111xxxxx + return b.test(7) && b.test(6) && b.test(5); +} diff --git a/Libraries/TagLib/Files/taglib/mpeg/mpegfile.h b/Libraries/TagLib/Files/taglib/mpeg/mpegfile.h new file mode 100644 index 000000000..431523e08 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/mpeg/mpegfile.h @@ -0,0 +1,260 @@ +/*************************************************************************** + copyright : (C) 2002, 2003 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#ifndef TAGLIB_MPEGFILE_H +#define TAGLIB_MPEGFILE_H + +#include + +#include "mpegproperties.h" + +namespace TagLib { + + namespace ID3v2 { class Tag; class FrameFactory; } + namespace ID3v1 { class Tag; } + namespace APE { class Tag; } + + //! An implementation of TagLib::File with MPEG (MP3) specific methods + + namespace MPEG { + + //! An MPEG file class with some useful methods specific to MPEG + + /*! + * This implements the generic TagLib::File API and additionally provides + * access to properties that are distinct to MPEG files, notably access + * to the different ID3 tags. + */ + + class File : public TagLib::File + { + public: + /*! + * This set of flags is used for various operations and is suitable for + * being OR-ed together. + */ + enum TagTypes { + //! Empty set. Matches no tag types. + NoTags = 0x0000, + //! Matches ID3v1 tags. + ID3v1 = 0x0001, + //! Matches ID3v2 tags. + ID3v2 = 0x0002, + //! Matches APE tags. + APE = 0x0004, + //! Matches all tag types. + AllTags = 0xffff + }; + + /*! + * Contructs an MPEG file from \a file. If \a readProperties is true the + * file's audio properties will also be read using \a propertiesStyle. If + * false, \a propertiesStyle is ignored. + * + * \deprecated This constructor will be dropped in favor of the one below + * in a future version. + */ + File(const char *file, bool readProperties = true, + Properties::ReadStyle propertiesStyle = Properties::Average); + + /*! + * Contructs an MPEG file from \a file. If \a readProperties is true the + * file's audio properties will also be read using \a propertiesStyle. If + * false, \a propertiesStyle is ignored. The frames will be created using + * \a frameFactory. + */ + // BIC: merge with the above constructor + File(const char *file, ID3v2::FrameFactory *frameFactory, + bool readProperties = true, + Properties::ReadStyle propertiesStyle = Properties::Average); + + /*! + * Destroys this instance of the File. + */ + virtual ~File(); + + /*! + * Returns a pointer to a tag that is the union of the ID3v2 and ID3v1 + * tags. The ID3v2 tag is given priority in reading the information -- if + * requested information exists in both the ID3v2 tag and the ID3v1 tag, + * the information from the ID3v2 tag will be returned. + * + * If you would like more granular control over the content of the tags, + * with the concession of generality, use the tag-type specific calls. + * + * \note As this tag is not implemented as an ID3v2 tag or an ID3v1 tag, + * but a union of the two this pointer may not be cast to the specific + * tag types. + * + * \see ID3v1Tag() + * \see ID3v2Tag() + * \see APETag() + */ + virtual Tag *tag() const; + + /*! + * Returns the MPEG::Properties for this file. If no audio properties + * were read then this will return a null pointer. + */ + virtual Properties *audioProperties() const; + + /*! + * Save the file. If at least one tag -- ID3v1 or ID3v2 -- exists this + * will duplicate its content into the other tag. This returns true + * if saving was successful. + * + * If neither exists or if both tags are empty, this will strip the tags + * from the file. + * + * This is the same as calling save(AllTags); + * + * If you would like more granular control over the content of the tags, + * with the concession of generality, use paramaterized save call below. + * + * \see save(int tags) + */ + virtual bool save(); + + /*! + * Save the file. This will attempt to save all of the tag types that are + * specified by OR-ing together TagTypes values. The save() method above + * uses AllTags. This returns true if saving was successful. + * + * This strips all tags not included in the mask, but does not modify them + * in memory, so later calls to save() which make use of these tags will + * remain valid. This also strips empty tags. + */ + bool save(int tags); + + /*! + * Returns a pointer to the ID3v2 tag of the file. + * + * If \a create is false (the default) this will return a null pointer + * if there is no valid ID3v2 tag. If \a create is true it will create + * an ID3v2 tag if one does not exist. + * + * \note The Tag is still owned by the MPEG::File and should not be + * deleted by the user. It will be deleted when the file (object) is + * destroyed. + */ + ID3v2::Tag *ID3v2Tag(bool create = false); + + /*! + * Returns a pointer to the ID3v1 tag of the file. + * + * If \a create is false (the default) this will return a null pointer + * if there is no valid ID3v1 tag. If \a create is true it will create + * an ID3v1 tag if one does not exist. + * + * \note The Tag is still owned by the MPEG::File and should not be + * deleted by the user. It will be deleted when the file (object) is + * destroyed. + */ + ID3v1::Tag *ID3v1Tag(bool create = false); + + /*! + * Returns a pointer to the APE tag of the file. + * + * If \a create is false (the default) this will return a null pointer + * if there is no valid APE tag. If \a create is true it will create + * an APE tag if one does not exist. + * + * \note The Tag is still owned by the MPEG::File and should not be + * deleted by the user. It will be deleted when the file (object) is + * destroyed. + */ + APE::Tag *APETag(bool create = false); + + /*! + * This will strip the tags that match the OR-ed together TagTypes from the + * file. By default it strips all tags. It returns true if the tags are + * successfully stripped. + * + * This is equivalent to strip(tags, true) + * + * \note This will also invalidate pointers to the ID3 and APE tags + * as their memory will be freed. + */ + bool strip(int tags = AllTags); + + /*! + * This will strip the tags that match the OR-ed together TagTypes from the + * file. By default it strips all tags. It returns true if the tags are + * successfully stripped. + * + * If \a freeMemory is true the ID3 and APE tags will be deleted and + * pointers to them will be invalidated. + */ + // BIC: merge with the method above + bool strip(int tags, bool freeMemory); + + /*! + * Set the ID3v2::FrameFactory to something other than the default. + * + * \see ID3v2FrameFactory + */ + void setID3v2FrameFactory(const ID3v2::FrameFactory *factory); + + /*! + * Returns the position in the file of the first MPEG frame. + */ + long firstFrameOffset(); + + /*! + * Returns the position in the file of the next MPEG frame, + * using the current position as start + */ + long nextFrameOffset(long position); + + /*! + * Returns the position in the file of the previous MPEG frame, + * using the current position as start + */ + long previousFrameOffset(long position); + + /*! + * Returns the position in the file of the last MPEG frame. + */ + long lastFrameOffset(); + + private: + File(const File &); + File &operator=(const File &); + + void read(bool readProperties, Properties::ReadStyle propertiesStyle); + long findID3v2(); + long findID3v1(); + long findAPE(); + + /*! + * MPEG frames can be recognized by the bit pattern 11111111 111, so the + * first byte is easy to check for, however checking to see if the second byte + * starts with \e 111 is a bit more tricky, hence this member function. + */ + static bool secondSynchByte(char byte); + + class FilePrivate; + FilePrivate *d; + }; + } +} + +#endif diff --git a/Libraries/TagLib/Files/taglib/mpeg/mpegheader.cpp b/Libraries/TagLib/Files/taglib/mpeg/mpegheader.cpp new file mode 100644 index 000000000..eb93db451 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/mpeg/mpegheader.cpp @@ -0,0 +1,253 @@ +/*************************************************************************** + copyright : (C) 2003 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#include + +#include +#include +#include + +#include "mpegheader.h" + +using namespace TagLib; + +class MPEG::Header::HeaderPrivate : public RefCounter +{ +public: + HeaderPrivate() : + isValid(false), + version(Version1), + layer(0), + protectionEnabled(false), + sampleRate(0), + isPadded(false), + channelMode(Stereo), + isCopyrighted(false), + isOriginal(false), + frameLength(0) {} + + bool isValid; + Version version; + int layer; + bool protectionEnabled; + int bitrate; + int sampleRate; + bool isPadded; + ChannelMode channelMode; + bool isCopyrighted; + bool isOriginal; + int frameLength; +}; + +//////////////////////////////////////////////////////////////////////////////// +// public members +//////////////////////////////////////////////////////////////////////////////// + +MPEG::Header::Header(const ByteVector &data) +{ + d = new HeaderPrivate; + parse(data); +} + +MPEG::Header::Header(const Header &h) : d(h.d) +{ + d->ref(); +} + +MPEG::Header::~Header() +{ + if (d->deref()) + delete d; +} + +bool MPEG::Header::isValid() const +{ + return d->isValid; +} + +MPEG::Header::Version MPEG::Header::version() const +{ + return d->version; +} + +int MPEG::Header::layer() const +{ + return d->layer; +} + +bool MPEG::Header::protectionEnabled() const +{ + return d->protectionEnabled; +} + +int MPEG::Header::bitrate() const +{ + return d->bitrate; +} + +int MPEG::Header::sampleRate() const +{ + return d->sampleRate; +} + +bool MPEG::Header::isPadded() const +{ + return d->isPadded; +} + +MPEG::Header::ChannelMode MPEG::Header::channelMode() const +{ + return d->channelMode; +} + +bool MPEG::Header::isCopyrighted() const +{ + return d->isCopyrighted; +} + +bool MPEG::Header::isOriginal() const +{ + return d->isOriginal; +} + +int MPEG::Header::frameLength() const +{ + return d->frameLength; +} + +MPEG::Header &MPEG::Header::operator=(const Header &h) +{ + if(&h == this) + return *this; + + if(d->deref()) + delete d; + + d = h.d; + d->ref(); + return *this; +} + +//////////////////////////////////////////////////////////////////////////////// +// private members +//////////////////////////////////////////////////////////////////////////////// + +void MPEG::Header::parse(const ByteVector &data) +{ + if(data.size() < 4 || uchar(data[0]) != 0xff) { + debug("MPEG::Header::parse() -- First byte did not mactch MPEG synch."); + return; + } + + std::bitset<32> flags(data.toUInt()); + + // Check for the second byte's part of the MPEG synch + + if(!flags[23] || !flags[22] || !flags[21]) { + debug("MPEG::Header::parse() -- Second byte did not mactch MPEG synch."); + return; + } + + // Set the MPEG version + + if(!flags[20] && !flags[19]) + d->version = Version2_5; + else if(flags[20] && !flags[19]) + d->version = Version2; + else if(flags[20] && flags[19]) + d->version = Version1; + + // Set the MPEG layer + + if(!flags[18] && flags[17]) + d->layer = 3; + else if(flags[18] && !flags[17]) + d->layer = 2; + else if(flags[18] && flags[17]) + d->layer = 1; + + d->protectionEnabled = !flags[16]; + + // Set the bitrate + + static const int bitrates[2][3][16] = { + { // Version 1 + { 0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448, 0 }, // layer 1 + { 0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384, 0 }, // layer 2 + { 0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 0 } // layer 3 + }, + { // Version 2 or 2.5 + { 0, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256, 0 }, // layer 1 + { 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, 0 }, // layer 2 + { 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, 0 } // layer 3 + } + }; + + const int versionIndex = d->version == Version1 ? 0 : 1; + const int layerIndex = d->layer > 0 ? d->layer - 1 : 0; + + // The bitrate index is encoded as the first 4 bits of the 3rd byte, + // i.e. 1111xxxx + + int i = uchar(data[2]) >> 4; + + d->bitrate = bitrates[versionIndex][layerIndex][i]; + + // Set the sample rate + + static const int sampleRates[3][4] = { + { 44100, 48000, 32000, 0 }, // Version 1 + { 22050, 24000, 16000, 0 }, // Version 2 + { 11025, 12000, 8000, 0 } // Version 2.5 + }; + + // The sample rate index is encoded as two bits in the 3nd byte, i.e. xxxx11xx + + i = uchar(data[2]) >> 2 & 0x03; + + d->sampleRate = sampleRates[d->version][i]; + + if(d->sampleRate == 0) { + debug("MPEG::Header::parse() -- Invalid sample rate."); + return; + } + + // The channel mode is encoded as a 2 bit value at the end of the 3nd byte, + // i.e. xxxxxx11 + + d->channelMode = ChannelMode(uchar(data[2]) & 0x3); + + // TODO: Add mode extension for completeness + + d->isCopyrighted = flags[0]; + d->isOriginal = flags[1]; + + // Calculate the frame length + + if(d->layer == 1) + d->frameLength = 24000 * 2 * d->bitrate / d->sampleRate + int(d->isPadded); + else + d->frameLength = 72000 * d->bitrate / d->sampleRate + int(d->isPadded); + + // Now that we're done parsing, set this to be a valid frame. + + d->isValid = true; +} diff --git a/Libraries/TagLib/Files/taglib/mpeg/mpegheader.h b/Libraries/TagLib/Files/taglib/mpeg/mpegheader.h new file mode 100644 index 000000000..40c3fda48 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/mpeg/mpegheader.h @@ -0,0 +1,155 @@ +/*************************************************************************** + copyright : (C) 2003 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#ifndef TAGLIB_MPEGHEADER_H +#define TAGLIB_MPEGHEADER_H + +namespace TagLib { + + class ByteVector; + + namespace MPEG { + + //! An implementation of MP3 frame headers + + /*! + * This is an implementation of MPEG Layer III headers. The API follows more + * or less the binary format of these headers. I've used + * this + * document as a reference. + */ + + class Header + { + public: + /*! + * Parses an MPEG header based on \a data. + */ + Header(const ByteVector &data); + + /*! + * Does a shallow copy of \a h. + */ + Header(const Header &h); + + /*! + * Destroys this Header instance. + */ + virtual ~Header(); + + /*! + * Returns true if the frame is at least an appropriate size and has + * legal values. + */ + bool isValid() const; + + /*! + * The MPEG Version. + */ + enum Version { + //! MPEG Version 1 + Version1 = 0, + //! MPEG Version 2 + Version2 = 1, + //! MPEG Version 2.5 + Version2_5 = 2 + }; + + /*! + * Returns the MPEG Version of the header. + */ + Version version() const; + + /*! + * Returns the layer version. This will be between the values 1-3. + */ + int layer() const; + + /*! + * Returns true if the MPEG protection bit is enabled. + */ + bool protectionEnabled() const; + + /*! + * Returns the bitrate encoded in the header. + */ + int bitrate() const; + + /*! + * Returns the sample rate in Hz. + */ + int sampleRate() const; + + /*! + * Returns true if the frame is padded. + */ + bool isPadded() const; + + /*! + * There are a few combinations or one or two channel audio that are + * possible: + */ + enum ChannelMode { + //! Stereo + Stereo = 0, + //! Stereo + JointStereo = 1, + //! Dual Mono + DualChannel = 2, + //! Mono + SingleChannel = 3 + }; + + /*! + * Returns the channel mode for this frame. + */ + ChannelMode channelMode() const; + + /*! + * Returns true if the copyrighted bit is set. + */ + bool isCopyrighted() const; + + /*! + * Returns true if the "original" bit is set. + */ + bool isOriginal() const; + + /*! + * Returns the frame length. + */ + int frameLength() const; + + /*! + * Makes a shallow copy of the header. + */ + Header &operator=(const Header &h); + + private: + void parse(const ByteVector &data); + + class HeaderPrivate; + HeaderPrivate *d; + }; + } +} + +#endif diff --git a/Libraries/TagLib/Files/taglib/mpeg/mpegproperties.cpp b/Libraries/TagLib/Files/taglib/mpeg/mpegproperties.cpp new file mode 100644 index 000000000..ba245b206 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/mpeg/mpegproperties.cpp @@ -0,0 +1,220 @@ +/*************************************************************************** + copyright : (C) 2003 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#include +#include + +#include "mpegproperties.h" +#include "mpegfile.h" +#include "xingheader.h" + +using namespace TagLib; + +class MPEG::Properties::PropertiesPrivate +{ +public: + PropertiesPrivate(File *f, ReadStyle s) : + file(f), + style(s), + length(0), + bitrate(0), + sampleRate(0), + channels(0) {} + + File *file; + ReadStyle style; + int length; + int bitrate; + int sampleRate; + int channels; + Header::Version version; + int layer; + Header::ChannelMode channelMode; + bool isCopyrighted; + bool isOriginal; +}; + +//////////////////////////////////////////////////////////////////////////////// +// public members +//////////////////////////////////////////////////////////////////////////////// + +MPEG::Properties::Properties(File *file, ReadStyle style) : AudioProperties(style) +{ + d = new PropertiesPrivate(file, style); + + if(file && file->isOpen()) + read(); +} + +MPEG::Properties::~Properties() +{ + delete d; +} + +int MPEG::Properties::length() const +{ + return d->length; +} + +int MPEG::Properties::bitrate() const +{ + return d->bitrate; +} + +int MPEG::Properties::sampleRate() const +{ + return d->sampleRate; +} + +int MPEG::Properties::channels() const +{ + return d->channels; +} + +MPEG::Header::Version MPEG::Properties::version() const +{ + return d->version; +} + +int MPEG::Properties::layer() const +{ + return d->layer; +} + +MPEG::Header::ChannelMode MPEG::Properties::channelMode() const +{ + return d->channelMode; +} + +bool MPEG::Properties::isCopyrighted() const +{ + return d->isCopyrighted; +} + +bool MPEG::Properties::isOriginal() const +{ + return d->isOriginal; +} + +//////////////////////////////////////////////////////////////////////////////// +// private members +//////////////////////////////////////////////////////////////////////////////// + +void MPEG::Properties::read() +{ + // Since we've likely just looked for the ID3v1 tag, start at the end of the + // file where we're least likely to have to have to move the disk head. + + long last = d->file->lastFrameOffset(); + + if(last < 0) { + debug("MPEG::Properties::read() -- Could not find a valid last MPEG frame in the stream."); + return; + } + + d->file->seek(last); + Header lastHeader(d->file->readBlock(4)); + + long first = d->file->firstFrameOffset(); + + if(first < 0) { + debug("MPEG::Properties::read() -- Could not find a valid first MPEG frame in the stream."); + return; + } + + if(!lastHeader.isValid()) { + + long pos = last; + + while(pos > first) { + + pos = d->file->previousFrameOffset(pos); + + if(pos < 0) + break; + + d->file->seek(pos); + Header header(d->file->readBlock(4)); + + if(header.isValid()) { + lastHeader = header; + last = pos; + break; + } + } + } + + // Now jump back to the front of the file and read what we need from there. + + d->file->seek(first); + Header firstHeader(d->file->readBlock(4)); + + if(!firstHeader.isValid() || !lastHeader.isValid()) { + debug("MPEG::Properties::read() -- Page headers were invalid."); + return; + } + + // Check for a Xing header that will help us in gathering information about a + // VBR stream. + + int xingHeaderOffset = MPEG::XingHeader::xingHeaderOffset(firstHeader.version(), + firstHeader.channelMode()); + + d->file->seek(first + xingHeaderOffset); + XingHeader xingHeader(d->file->readBlock(16)); + + // Read the length and the bitrate from the Xing header. + + if(xingHeader.isValid() && + firstHeader.sampleRate() > 0 && + xingHeader.totalFrames() > 0) + { + static const int blockSize[] = { 0, 384, 1152, 1152 }; + + double timePerFrame = blockSize[firstHeader.layer()]; + timePerFrame = firstHeader.sampleRate() > 0 ? timePerFrame / firstHeader.sampleRate() : 0; + d->length = int(timePerFrame * xingHeader.totalFrames()); + d->bitrate = d->length > 0 ? xingHeader.totalSize() * 8 / d->length / 1000 : 0; + } + + // Since there was no valid Xing header found, we hope that we're in a constant + // bitrate file. + + // TODO: Make this more robust with audio property detection for VBR without a + // Xing header. + + else if(firstHeader.frameLength() > 0 && firstHeader.bitrate() > 0) { + int frames = (last - first) / firstHeader.frameLength() + 1; + + d->length = int(float(firstHeader.frameLength() * frames) / + float(firstHeader.bitrate() * 125) + 0.5); + d->bitrate = firstHeader.bitrate(); + } + + + d->sampleRate = firstHeader.sampleRate(); + d->channels = firstHeader.channelMode() == Header::SingleChannel ? 1 : 2; + d->version = firstHeader.version(); + d->layer = firstHeader.layer(); + d->channelMode = firstHeader.channelMode(); + d->isCopyrighted = firstHeader.isCopyrighted(); + d->isOriginal = firstHeader.isOriginal(); +} diff --git a/Libraries/TagLib/Files/taglib/mpeg/mpegproperties.h b/Libraries/TagLib/Files/taglib/mpeg/mpegproperties.h new file mode 100644 index 000000000..f50066cc0 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/mpeg/mpegproperties.h @@ -0,0 +1,105 @@ +/*************************************************************************** + copyright : (C) 2003 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#ifndef TAGLIB_MPEGPROPERTIES_H +#define TAGLIB_MPEGPROPERTIES_H + +#include + +#include "mpegheader.h" + +namespace TagLib { + + namespace MPEG { + + class File; + + //! An implementation of audio property reading for MP3 + + /*! + * This reads the data from an MPEG Layer III stream found in the + * AudioProperties API. + */ + + class Properties : public AudioProperties + { + public: + /*! + * Create an instance of MPEG::Properties with the data read from the + * MPEG::File \a file. + */ + Properties(File *file, ReadStyle style = Average); + + /*! + * Destroys this MPEG Properties instance. + */ + virtual ~Properties(); + + // Reimplementations. + + virtual int length() const; + virtual int bitrate() const; + virtual int sampleRate() const; + virtual int channels() const; + + /*! + * Returns the MPEG Version of the file. + */ + Header::Version version() const; + + /*! + * Returns the layer version. This will be between the values 1-3. + */ + int layer() const; + + /*! + * Returns true if the MPEG protection bit is enabled. + */ + bool protectionEnabled() const; + + /*! + * Returns the channel mode for this frame. + */ + Header::ChannelMode channelMode() const; + + /*! + * Returns true if the copyrighted bit is set. + */ + bool isCopyrighted() const; + + /*! + * Returns true if the "original" bit is set. + */ + bool isOriginal() const; + + private: + Properties(const Properties &); + Properties &operator=(const Properties &); + + void read(); + + class PropertiesPrivate; + PropertiesPrivate *d; + }; + } +} + +#endif diff --git a/Libraries/TagLib/Files/taglib/mpeg/xingheader.cpp b/Libraries/TagLib/Files/taglib/mpeg/xingheader.cpp new file mode 100644 index 000000000..5a0936355 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/mpeg/xingheader.cpp @@ -0,0 +1,111 @@ +/*************************************************************************** + copyright : (C) 2003 by Ismael Orenstein + email : orenstein@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#include +#include +#include + +#include "xingheader.h" + +using namespace TagLib; + +class MPEG::XingHeader::XingHeaderPrivate +{ +public: + XingHeaderPrivate() : + frames(0), + size(0), + valid(false) + {} + + uint frames; + uint size; + bool valid; +}; + +MPEG::XingHeader::XingHeader(const ByteVector &data) +{ + d = new XingHeaderPrivate; + parse(data); +} + +MPEG::XingHeader::~XingHeader() +{ + delete d; +} + +bool MPEG::XingHeader::isValid() const +{ + return d->valid; +} + +TagLib::uint MPEG::XingHeader::totalFrames() const +{ + return d->frames; +} + +TagLib::uint MPEG::XingHeader::totalSize() const +{ + return d->size; +} + +int MPEG::XingHeader::xingHeaderOffset(TagLib::MPEG::Header::Version v, + TagLib::MPEG::Header::ChannelMode c) +{ + if(v == MPEG::Header::Version1) { + if(c == MPEG::Header::SingleChannel) + return 0x15; + else + return 0x24; + } + else { + if(c == MPEG::Header::SingleChannel) + return 0x0D; + else + return 0x15; + } +} + +void MPEG::XingHeader::parse(const ByteVector &data) +{ + // Check to see if a valid Xing header is available. + + if(data.mid(0, 4) != "Xing") + return; + + // If the XingHeader doesn't contain the number of frames and the total stream + // info it's invalid. + + if(!(data[7] & 0x02)) { + debug("MPEG::XingHeader::parse() -- Xing header doesn't contain the total number of frames."); + return; + } + + if(!(data[7] & 0x04)) { + debug("MPEG::XingHeader::parse() -- Xing header doesn't contain the total stream size."); + return; + } + + d->frames = data.mid(8, 4).toUInt(); + d->size = data.mid(12, 4).toUInt(); + + d->valid = true; +} diff --git a/Libraries/TagLib/Files/taglib/mpeg/xingheader.h b/Libraries/TagLib/Files/taglib/mpeg/xingheader.h new file mode 100644 index 000000000..09e4bf91f --- /dev/null +++ b/Libraries/TagLib/Files/taglib/mpeg/xingheader.h @@ -0,0 +1,91 @@ +/*************************************************************************** + copyright : (C) 2003 by Ismael Orenstein + email : orenstein@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#ifndef TAGLIB_XINGHEADER_H +#define TAGLIB_XINGHEADER_H + +#include "mpegheader.h" + +namespace TagLib { + + class ByteVector; + + namespace MPEG { + + //! An implementation of the Xing VBR headers + + /*! + * This is a minimalistic implementation of the Xing VBR headers. Xing + * headers are often added to VBR (variable bit rate) MP3 streams to make it + * easy to compute the length and quality of a VBR stream. Our implementation + * is only concerned with the total size of the stream (so that we can + * calculate the total playing time and the average bitrate). It uses + * this text + * and the XMMS sources as references. + */ + + class XingHeader + { + public: + /*! + * Parses a Xing header based on \a data. The data must be at least 16 + * bytes long (anything longer than this is discarded). + */ + XingHeader(const ByteVector &data); + + /*! + * Destroy this XingHeader instance. + */ + virtual ~XingHeader(); + + /*! + * Returns true if the data was parsed properly and if there is a vaild + * Xing header present. + */ + bool isValid() const; + + /*! + * Returns the total number of frames. + */ + uint totalFrames() const; + + /*! + * Returns the total size of stream in bytes. + */ + uint totalSize() const; + + /*! + * Returns the offset for the start of this Xing header, given the + * version and channels of the frame + */ + static int xingHeaderOffset(TagLib::MPEG::Header::Version v, + TagLib::MPEG::Header::ChannelMode c); + + private: + void parse(const ByteVector &data); + + class XingHeaderPrivate; + XingHeaderPrivate *d; + }; + } +} + +#endif diff --git a/Libraries/TagLib/Files/taglib/ogg/Makefile.am b/Libraries/TagLib/Files/taglib/ogg/Makefile.am new file mode 100644 index 000000000..d80e5e4fe --- /dev/null +++ b/Libraries/TagLib/Files/taglib/ogg/Makefile.am @@ -0,0 +1,23 @@ +SUBDIRS = vorbis flac + +INCLUDES = -I$(top_srcdir)/taglib -I$(top_srcdir)/taglib/toolkit $(all_includes) + +noinst_LTLIBRARIES = libogg.la + +libogg_la_SOURCES = \ + oggfile.cpp \ + oggpage.cpp \ + oggpageheader.cpp \ + xiphcomment.cpp + +taglib_include_HEADERS = \ + oggfile.h \ + oggpage.h \ + oggpageheader.h \ + xiphcomment.h + +taglib_includedir = $(includedir)/taglib + +libogg_la_LIBADD = ./vorbis/libvorbis.la ./flac/liboggflac.la + +EXTRA_DIST = $(libogg_la_SOURCES) $(taglib_include_HEADERS) diff --git a/Libraries/TagLib/Files/taglib/ogg/Makefile.in b/Libraries/TagLib/Files/taglib/ogg/Makefile.in new file mode 100644 index 000000000..1f0a60eee --- /dev/null +++ b/Libraries/TagLib/Files/taglib/ogg/Makefile.in @@ -0,0 +1,664 @@ +# Makefile.in generated by automake 1.7.6 from Makefile.am. +# KDE tags expanded automatically by am_edit - $Revision$ +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../.. + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTODIRS = @AUTODIRS@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CONF_FILES = @CONF_FILES@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +KDE_PLUGIN = @KDE_PLUGIN@ +KDE_USE_CLOSURE_FALSE = @KDE_USE_CLOSURE_FALSE@ +KDE_USE_CLOSURE_TRUE = @KDE_USE_CLOSURE_TRUE@ +KDE_USE_FINAL_FALSE = @KDE_USE_FINAL_FALSE@ +KDE_USE_FINAL_TRUE = @KDE_USE_FINAL_TRUE@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +NOOPT_CFLAGS = @NOOPT_CFLAGS@ +NOOPT_CXXFLAGS = @NOOPT_CXXFLAGS@ +NOREPO = @NOREPO@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +REPO = @REPO@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +TOPSUBDIRS = @TOPSUBDIRS@ +USE_EXCEPTIONS = @USE_EXCEPTIONS@ +USE_RTTI = @USE_RTTI@ +VERSION = @VERSION@ +WOVERLOADED_VIRTUAL = @WOVERLOADED_VIRTUAL@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +all_includes = @all_includes@ +all_libraries = @all_libraries@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +link_zlib_FALSE = @link_zlib_FALSE@ +link_zlib_TRUE = @link_zlib_TRUE@ +localstatedir = @localstatedir@ +mandir = @mandir@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +SUBDIRS = vorbis flac + +INCLUDES = -I$(top_srcdir)/taglib -I$(top_srcdir)/taglib/toolkit $(all_includes) + +noinst_LTLIBRARIES = libogg.la + +libogg_la_SOURCES = \ + oggfile.cpp \ + oggpage.cpp \ + oggpageheader.cpp \ + xiphcomment.cpp + + +taglib_include_HEADERS = \ + oggfile.h \ + oggpage.h \ + oggpageheader.h \ + xiphcomment.h + + +taglib_includedir = $(includedir)/taglib + +libogg_la_LIBADD = ./vorbis/libvorbis.la ./flac/liboggflac.la + +EXTRA_DIST = $(libogg_la_SOURCES) $(taglib_include_HEADERS) +subdir = taglib/ogg +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/admin/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) + +libogg_la_LDFLAGS = +libogg_la_DEPENDENCIES = ./vorbis/libvorbis.la ./flac/liboggflac.la +am_libogg_la_OBJECTS = oggfile.lo oggpage.lo oggpageheader.lo \ + xiphcomment.lo +#>- libogg_la_OBJECTS = $(am_libogg_la_OBJECTS) +#>+ 5 +libogg_la_final_OBJECTS = libogg_la.all_cpp.lo +libogg_la_nofinal_OBJECTS = oggfile.lo oggpage.lo oggpageheader.lo \ + xiphcomment.lo +@KDE_USE_FINAL_FALSE@libogg_la_OBJECTS = $(libogg_la_nofinal_OBJECTS) +@KDE_USE_FINAL_TRUE@libogg_la_OBJECTS = $(libogg_la_final_OBJECTS) + +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/admin/depcomp +am__depfiles_maybe = depfiles +#>- @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/oggfile.Plo ./$(DEPDIR)/oggpage.Plo \ +#>- @AMDEP_TRUE@ ./$(DEPDIR)/oggpageheader.Plo \ +#>- @AMDEP_TRUE@ ./$(DEPDIR)/xiphcomment.Plo +#>+ 7 +@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@DEP_FILES = $(DEPDIR)/libogg_la.all_cpp.P ./$(DEPDIR)/oggfile.Plo ./$(DEPDIR)/oggpage.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@ @AMDEP_TRUE@ ./$(DEPDIR)/oggpageheader.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@ @AMDEP_TRUE@ ./$(DEPDIR)/xiphcomment.Plo +@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@DEP_FILES = ./$(DEPDIR)/oggfile.Plo ./$(DEPDIR)/oggpage.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@ @AMDEP_TRUE@ ./$(DEPDIR)/oggpageheader.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@ @AMDEP_TRUE@ ./$(DEPDIR)/xiphcomment.Plo + +#>- CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ +#>- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +#>+ 2 +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(KDE_CXXFLAGS) +#>- LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) \ +#>- $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ +#>- $(AM_CXXFLAGS) $(CXXFLAGS) +#>+ 3 +LTCXXCOMPILE = $(LIBTOOL) --mode=compile --tag=CXX $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) $(KDE_CXXFLAGS) +CXXLD = $(CXX) +#>- CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \ +#>- $(AM_LDFLAGS) $(LDFLAGS) -o $@ +#>+ 2 +CXXLINK = $(LIBTOOL) --mode=link --tag=CXX $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(KDE_CXXFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +DIST_SOURCES = $(libogg_la_SOURCES) +HEADERS = $(taglib_include_HEADERS) + + +RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \ + ps-recursive install-info-recursive uninstall-info-recursive \ + all-recursive install-data-recursive install-exec-recursive \ + installdirs-recursive install-recursive uninstall-recursive \ + check-recursive installcheck-recursive +DIST_COMMON = $(taglib_include_HEADERS) Makefile.am Makefile.in +DIST_SUBDIRS = $(SUBDIRS) +SOURCES = $(libogg_la_SOURCES) + +#>- all: all-recursive +#>+ 1 +all: docs-am all-recursive + +.SUFFIXES: +.SUFFIXES: .cpp .lo .o .obj +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) +#>- cd $(top_srcdir) && \ +#>- $(AUTOMAKE) --gnu taglib/ogg/Makefile +#>+ 3 + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu taglib/ogg/Makefile + cd $(top_srcdir) && perl admin/am_edit taglib/ogg/Makefile.in +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" = "$$p" && dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libogg.la: $(libogg_la_OBJECTS) $(libogg_la_DEPENDENCIES) + $(CXXLINK) $(libogg_la_LDFLAGS) $(libogg_la_OBJECTS) $(libogg_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) core *.core + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oggfile.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oggpage.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oggpageheader.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xiphcomment.Plo@am__quote@ + +distclean-depend: + -rm -rf ./$(DEPDIR) + +.cpp.o: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + +.cpp.obj: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` + +.cpp.lo: +@am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: +taglib_includeHEADERS_INSTALL = $(INSTALL_HEADER) +install-taglib_includeHEADERS: $(taglib_include_HEADERS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(taglib_includedir) + @list='$(taglib_include_HEADERS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(taglib_includeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(taglib_includedir)/$$f"; \ + $(taglib_includeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(taglib_includedir)/$$f; \ + done + +uninstall-taglib_includeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(taglib_include_HEADERS)'; for p in $$list; do \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " rm -f $(DESTDIR)$(taglib_includedir)/$$f"; \ + rm -f $(DESTDIR)$(taglib_includedir)/$$f; \ + done + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ETAGS = etags +ETAGSFLAGS = + +CTAGS = ctags +CTAGSFLAGS = + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if (etags --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + else \ + include_option=--include; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -f $$subdir/TAGS && \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique + +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = ../.. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d $(distdir)/$$subdir \ + || mkdir $(distdir)/$$subdir \ + || exit 1; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" \ + distdir=../$(distdir)/$$subdir \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile $(LTLIBRARIES) $(HEADERS) +installdirs: installdirs-recursive +installdirs-am: + $(mkinstalldirs) $(DESTDIR)$(taglib_includedir) + +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +#>- clean: clean-recursive +#>+ 1 +clean: kde-rpo-clean clean-recursive + +#>- clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ +#>- mostlyclean-am +#>+ 2 +clean-am: clean-final clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-recursive + +distclean-am: clean-am distclean-compile distclean-depend \ + distclean-generic distclean-libtool distclean-tags + +dvi: dvi-recursive + +dvi-am: + +info: info-recursive + +info-am: + +install-data-am: install-taglib_includeHEADERS + +install-exec-am: + +install-info: install-info-recursive + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-info-am uninstall-taglib_includeHEADERS + +uninstall-info: uninstall-info-recursive + +.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \ + clean-generic clean-libtool clean-noinstLTLIBRARIES \ + clean-recursive ctags ctags-recursive distclean \ + distclean-compile distclean-depend distclean-generic \ + distclean-libtool distclean-recursive distclean-tags distdir \ + dvi dvi-am dvi-recursive info info-am info-recursive install \ + install-am install-data install-data-am install-data-recursive \ + install-exec install-exec-am install-exec-recursive \ + install-info install-info-am install-info-recursive install-man \ + install-recursive install-strip install-taglib_includeHEADERS \ + installcheck installcheck-am installdirs installdirs-am \ + installdirs-recursive maintainer-clean maintainer-clean-generic \ + maintainer-clean-recursive mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool mostlyclean-recursive \ + pdf pdf-am pdf-recursive ps ps-am ps-recursive tags \ + tags-recursive uninstall uninstall-am uninstall-info-am \ + uninstall-info-recursive uninstall-recursive \ + uninstall-taglib_includeHEADERS + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: + +#>+ 2 +docs-am: + +#>+ 6 +force-reedit: + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu taglib/ogg/Makefile + cd $(top_srcdir) && perl admin/am_edit taglib/ogg/Makefile.in + + +#>+ 11 +libogg_la.all_cpp.cpp: $(srcdir)/Makefile.in $(srcdir)/oggfile.cpp $(srcdir)/oggpage.cpp $(srcdir)/oggpageheader.cpp $(srcdir)/xiphcomment.cpp + @echo 'creating libogg_la.all_cpp.cpp ...'; \ + rm -f libogg_la.all_cpp.files libogg_la.all_cpp.final; \ + echo "#define KDE_USE_FINAL 1" >> libogg_la.all_cpp.final; \ + for file in oggfile.cpp oggpage.cpp oggpageheader.cpp xiphcomment.cpp ; do \ + echo "#include \"$$file\"" >> libogg_la.all_cpp.files; \ + test ! -f $(srcdir)/$$file || egrep '^#pragma +implementation' $(srcdir)/$$file >> libogg_la.all_cpp.final; \ + done; \ + cat libogg_la.all_cpp.final libogg_la.all_cpp.files > libogg_la.all_cpp.cpp; \ + rm -f libogg_la.all_cpp.final libogg_la.all_cpp.files + +#>+ 3 +clean-final: + -rm -f libogg_la.all_cpp.cpp + +#>+ 2 +final: + $(MAKE) libogg_la_OBJECTS="$(libogg_la_final_OBJECTS)" all-am +#>+ 2 +final-install: + $(MAKE) libogg_la_OBJECTS="$(libogg_la_final_OBJECTS)" install-am +#>+ 2 +no-final: + $(MAKE) libogg_la_OBJECTS="$(libogg_la_nofinal_OBJECTS)" all-am +#>+ 2 +no-final-install: + $(MAKE) libogg_la_OBJECTS="$(libogg_la_nofinal_OBJECTS)" install-am +#>+ 3 +cvs-clean: + $(MAKE) admindir=$(top_srcdir)/admin -f $(top_srcdir)/admin/Makefile.common cvs-clean + +#>+ 3 +kde-rpo-clean: + -rm -f *.rpo diff --git a/Libraries/TagLib/Files/taglib/ogg/flac/Makefile.am b/Libraries/TagLib/Files/taglib/ogg/flac/Makefile.am new file mode 100644 index 000000000..83c08539f --- /dev/null +++ b/Libraries/TagLib/Files/taglib/ogg/flac/Makefile.am @@ -0,0 +1,15 @@ +INCLUDES = \ + -I$(top_srcdir)/taglib \ + -I$(top_srcdir)/taglib/toolkit \ + -I$(top_srcdir)/taglib/ogg \ + -I$(top_srcdir)/taglib/flac \ + $(all_includes) + +noinst_LTLIBRARIES = liboggflac.la + +liboggflac_la_SOURCES = oggflacfile.cpp + +taglib_include_HEADERS = oggflacfile.h +taglib_includedir = $(includedir)/taglib + +EXTRA_DIST = $(liboggflac_la_SOURCES) $(taglib_include_HEADERS) diff --git a/Libraries/TagLib/Files/taglib/ogg/flac/Makefile.in b/Libraries/TagLib/Files/taglib/ogg/flac/Makefile.in new file mode 100644 index 000000000..3cddf2363 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/ogg/flac/Makefile.in @@ -0,0 +1,522 @@ +# Makefile.in generated by automake 1.7.6 from Makefile.am. +# KDE tags expanded automatically by am_edit - $Revision$ +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../../.. + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTODIRS = @AUTODIRS@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CONF_FILES = @CONF_FILES@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +KDE_PLUGIN = @KDE_PLUGIN@ +KDE_USE_CLOSURE_FALSE = @KDE_USE_CLOSURE_FALSE@ +KDE_USE_CLOSURE_TRUE = @KDE_USE_CLOSURE_TRUE@ +KDE_USE_FINAL_FALSE = @KDE_USE_FINAL_FALSE@ +KDE_USE_FINAL_TRUE = @KDE_USE_FINAL_TRUE@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +NOOPT_CFLAGS = @NOOPT_CFLAGS@ +NOOPT_CXXFLAGS = @NOOPT_CXXFLAGS@ +NOREPO = @NOREPO@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +REPO = @REPO@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +TOPSUBDIRS = @TOPSUBDIRS@ +USE_EXCEPTIONS = @USE_EXCEPTIONS@ +USE_RTTI = @USE_RTTI@ +VERSION = @VERSION@ +WOVERLOADED_VIRTUAL = @WOVERLOADED_VIRTUAL@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +all_includes = @all_includes@ +all_libraries = @all_libraries@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +link_zlib_FALSE = @link_zlib_FALSE@ +link_zlib_TRUE = @link_zlib_TRUE@ +localstatedir = @localstatedir@ +mandir = @mandir@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +INCLUDES = \ + -I$(top_srcdir)/taglib \ + -I$(top_srcdir)/taglib/toolkit \ + -I$(top_srcdir)/taglib/ogg \ + -I$(top_srcdir)/taglib/flac \ + $(all_includes) + + +noinst_LTLIBRARIES = liboggflac.la + +liboggflac_la_SOURCES = oggflacfile.cpp + +taglib_include_HEADERS = oggflacfile.h +taglib_includedir = $(includedir)/taglib + +EXTRA_DIST = $(liboggflac_la_SOURCES) $(taglib_include_HEADERS) +subdir = taglib/ogg/flac +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/admin/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) + +liboggflac_la_LDFLAGS = +liboggflac_la_LIBADD = +am_liboggflac_la_OBJECTS = oggflacfile.lo +#>- liboggflac_la_OBJECTS = $(am_liboggflac_la_OBJECTS) +#>+ 1 +liboggflac_la_OBJECTS = oggflacfile.lo + +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/admin/depcomp +am__depfiles_maybe = depfiles +#>- @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/oggflacfile.Plo +#>+ 2 +@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/oggflacfile.Plo + +#>- CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ +#>- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +#>+ 2 +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(KDE_CXXFLAGS) +#>- LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) \ +#>- $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ +#>- $(AM_CXXFLAGS) $(CXXFLAGS) +#>+ 3 +LTCXXCOMPILE = $(LIBTOOL) --mode=compile --tag=CXX $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) $(KDE_CXXFLAGS) +CXXLD = $(CXX) +#>- CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \ +#>- $(AM_LDFLAGS) $(LDFLAGS) -o $@ +#>+ 2 +CXXLINK = $(LIBTOOL) --mode=link --tag=CXX $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(KDE_CXXFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +DIST_SOURCES = $(liboggflac_la_SOURCES) +HEADERS = $(taglib_include_HEADERS) + +DIST_COMMON = $(taglib_include_HEADERS) Makefile.am Makefile.in +SOURCES = $(liboggflac_la_SOURCES) + +#>- all: all-am +#>+ 1 +all: docs-am all-am + +.SUFFIXES: +.SUFFIXES: .cpp .lo .o .obj +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) +#>- cd $(top_srcdir) && \ +#>- $(AUTOMAKE) --gnu taglib/ogg/flac/Makefile +#>+ 3 + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu taglib/ogg/flac/Makefile + cd $(top_srcdir) && perl admin/am_edit taglib/ogg/flac/Makefile.in +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" = "$$p" && dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +liboggflac.la: $(liboggflac_la_OBJECTS) $(liboggflac_la_DEPENDENCIES) + $(CXXLINK) $(liboggflac_la_LDFLAGS) $(liboggflac_la_OBJECTS) $(liboggflac_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) core *.core + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oggflacfile.Plo@am__quote@ + +distclean-depend: + -rm -rf ./$(DEPDIR) + +.cpp.o: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + +.cpp.obj: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` + +.cpp.lo: +@am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: +taglib_includeHEADERS_INSTALL = $(INSTALL_HEADER) +install-taglib_includeHEADERS: $(taglib_include_HEADERS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(taglib_includedir) + @list='$(taglib_include_HEADERS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(taglib_includeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(taglib_includedir)/$$f"; \ + $(taglib_includeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(taglib_includedir)/$$f; \ + done + +uninstall-taglib_includeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(taglib_include_HEADERS)'; for p in $$list; do \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " rm -f $(DESTDIR)$(taglib_includedir)/$$f"; \ + rm -f $(DESTDIR)$(taglib_includedir)/$$f; \ + done + +ETAGS = etags +ETAGSFLAGS = + +CTAGS = ctags +CTAGSFLAGS = + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique + +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = ../../.. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) + +installdirs: + $(mkinstalldirs) $(DESTDIR)$(taglib_includedir) +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +#>- clean: clean-am +#>+ 1 +clean: kde-rpo-clean clean-am + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + +distclean-am: clean-am distclean-compile distclean-depend \ + distclean-generic distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: install-taglib_includeHEADERS + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am uninstall-taglib_includeHEADERS + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstLTLIBRARIES ctags distclean \ + distclean-compile distclean-depend distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am info \ + info-am install install-am install-data install-data-am \ + install-exec install-exec-am install-info install-info-am \ + install-man install-strip install-taglib_includeHEADERS \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-info-am \ + uninstall-taglib_includeHEADERS + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: + +#>+ 2 +docs-am: + +#>+ 6 +force-reedit: + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu taglib/ogg/flac/Makefile + cd $(top_srcdir) && perl admin/am_edit taglib/ogg/flac/Makefile.in + + +#>+ 2 +final: + $(MAKE) all-am +#>+ 2 +final-install: + $(MAKE) install-am +#>+ 2 +no-final: + $(MAKE) all-am +#>+ 2 +no-final-install: + $(MAKE) install-am +#>+ 3 +cvs-clean: + $(MAKE) admindir=$(top_srcdir)/admin -f $(top_srcdir)/admin/Makefile.common cvs-clean + +#>+ 3 +kde-rpo-clean: + -rm -f *.rpo diff --git a/Libraries/TagLib/Files/taglib/ogg/flac/oggflacfile.cpp b/Libraries/TagLib/Files/taglib/ogg/flac/oggflacfile.cpp new file mode 100644 index 000000000..9f8fd7cf8 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/ogg/flac/oggflacfile.cpp @@ -0,0 +1,245 @@ +/*************************************************************************** + copyright : (C) 2004 by Allan Sandfeld Jensen + email : kde@carewolf.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#include +#include +#include + +#include +#include "oggflacfile.h" + +using namespace TagLib; +using TagLib::FLAC::Properties; + +class Ogg::FLAC::File::FilePrivate +{ +public: + FilePrivate() : + comment(0), + properties(0), + streamStart(0), + streamLength(0), + scanned(false), + hasXiphComment(false), + commentPacket(0) {} + + ~FilePrivate() + { + delete comment; + delete properties; + } + + Ogg::XiphComment *comment; + + Properties *properties; + ByteVector streamInfoData; + ByteVector xiphCommentData; + long streamStart; + long streamLength; + bool scanned; + + bool hasXiphComment; + int commentPacket; +}; + +//////////////////////////////////////////////////////////////////////////////// +// public members +//////////////////////////////////////////////////////////////////////////////// + +Ogg::FLAC::File::File(const char *file, bool readProperties, + Properties::ReadStyle propertiesStyle) : Ogg::File(file) +{ + d = new FilePrivate; + read(readProperties, propertiesStyle); +} + +Ogg::FLAC::File::~File() +{ + delete d; +} + +Ogg::XiphComment *Ogg::FLAC::File::tag() const +{ + return d->comment; +} + +Properties *Ogg::FLAC::File::audioProperties() const +{ + return d->properties; +} + + +bool Ogg::FLAC::File::save() +{ + d->xiphCommentData = d->comment->render(); + + // Create FLAC metadata-block: + + // Put the size in the first 32 bit (I assume no more than 24 bit are used) + + ByteVector v = ByteVector::fromUInt(d->xiphCommentData.size()); + + // Set the type of the metadata-block to be a Xiph / Vorbis comment + + v[0] = 4; + + // Append the comment-data after the 32 bit header + + v.append(d->xiphCommentData); + + // Save the packet at the old spot + // FIXME: Use padding if size is increasing + + setPacket(d->commentPacket, v); + + return Ogg::File::save(); +} + +//////////////////////////////////////////////////////////////////////////////// +// private members +//////////////////////////////////////////////////////////////////////////////// + +void Ogg::FLAC::File::read(bool readProperties, Properties::ReadStyle propertiesStyle) +{ + // Sanity: Check if we really have an Ogg/FLAC file + +/* + ByteVector oggHeader = packet(0); + + if (oggHeader.mid(28,4) != "fLaC") { + debug("Ogg::FLAC::File::read() -- Not an Ogg/FLAC file"); + setValid(false); + return; + }*/ + + // Look for FLAC metadata, including vorbis comments + + scan(); + + if (!d->scanned) { + setValid(false); + return; + } + + + if(d->hasXiphComment) + d->comment = new Ogg::XiphComment(xiphCommentData()); + else + d->comment = new Ogg::XiphComment; + + + if(readProperties) + d->properties = new Properties(streamInfoData(), streamLength(), propertiesStyle); +} + +ByteVector Ogg::FLAC::File::streamInfoData() +{ + scan(); + return d->streamInfoData; +} + +ByteVector Ogg::FLAC::File::xiphCommentData() +{ + scan(); + return d->xiphCommentData; +} + +long Ogg::FLAC::File::streamLength() +{ + scan(); + return d->streamLength; +} + +void Ogg::FLAC::File::scan() +{ + // Scan the metadata pages + + if(d->scanned) + return; + + if(!isValid()) + return; + + int ipacket = 1; + long overhead = 0; + + ByteVector metadataHeader = packet(ipacket); + + if(metadataHeader.isNull()) + return; + + ByteVector header = metadataHeader.mid(0,4); + + // Header format (from spec): + // <1> Last-metadata-block flag + // <7> BLOCK_TYPE + // 0 : STREAMINFO + // 1 : PADDING + // .. + // 4 : VORBIS_COMMENT + // .. + // <24> Length of metadata to follow + + char blockType = header[0] & 0x7f; + bool lastBlock = header[0] & 0x80; + uint length = header.mid(1, 3).toUInt(); + overhead += length; + + // Sanity: First block should be the stream_info metadata + + if(blockType != 0) { + debug("Ogg::FLAC::File::scan() -- Invalid Ogg/FLAC stream"); + return; + } + + d->streamInfoData = metadataHeader.mid(4,length); + + // Search through the remaining metadata + + while(!lastBlock) { + metadataHeader = packet(++ipacket); + + header = metadataHeader.mid(0, 4); + blockType = header[0] & 0x7f; + lastBlock = header[0] & 0x80; + length = header.mid(1, 3).toUInt(); + overhead += length; + + if(blockType == 1) { + // debug("Ogg::FLAC::File::scan() -- Padding found"); + } + else if(blockType == 4) { + // debug("Ogg::FLAC::File::scan() -- Vorbis-comments found"); + d->xiphCommentData = metadataHeader.mid(4, length); + d->hasXiphComment = true; + d->commentPacket = ipacket; + } + else if(blockType > 5) + debug("Ogg::FLAC::File::scan() -- Unknown metadata block"); + + } + + // End of metadata, now comes the datastream + d->streamStart = overhead; + d->streamLength = File::length() - d->streamStart; + + d->scanned = true; +} diff --git a/Libraries/TagLib/Files/taglib/ogg/flac/oggflacfile.h b/Libraries/TagLib/Files/taglib/ogg/flac/oggflacfile.h new file mode 100644 index 000000000..94ec57509 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/ogg/flac/oggflacfile.h @@ -0,0 +1,113 @@ +/*************************************************************************** + copyright : (C) 2004 by Allan Sandfeld Jensen + email : kde@carewolf.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#ifndef TAGLIB_OGGFLACFILE_H +#define TAGLIB_OGGFLACFILE_H + +#include +#include + +#include + +namespace TagLib { + + class Tag; + + namespace Ogg { + + //! An implementation of Ogg FLAC metadata + + /*! + * This is implementation of FLAC metadata for Ogg FLAC files. For "pure" + * FLAC files look under the FLAC hiearchy. + * + * Unlike "pure" FLAC-files, Ogg FLAC only supports Xiph-comments, + * while the audio-properties are the same. + */ + namespace FLAC { + + using TagLib::FLAC::Properties; + + //! An implementation of TagLib::File with Ogg/FLAC specific methods + + /*! + * This implements and provides an interface for Ogg/FLAC files to the + * TagLib::Tag and TagLib::AudioProperties interfaces by way of implementing + * the abstract TagLib::File API as well as providing some additional + * information specific to Ogg FLAC files. + */ + + class File : public Ogg::File + { + public: + /*! + * Contructs an Ogg/FLAC file from \a file. If \a readProperties is true + * the file's audio properties will also be read using \a propertiesStyle. + * If false, \a propertiesStyle is ignored. + */ + File(const char *file, bool readProperties = true, + Properties::ReadStyle propertiesStyle = Properties::Average); + + /*! + * Destroys this instance of the File. + */ + virtual ~File(); + + /*! + * Returns the Tag for this file. This will always be a XiphComment. + */ + virtual XiphComment *tag() const; + + /*! + * Returns the FLAC::Properties for this file. If no audio properties + * were read then this will return a null pointer. + */ + virtual Properties *audioProperties() const; + + /*! + * Save the file. This will primarily save and update the XiphComment. + * Returns true if the save is successful. + */ + virtual bool save(); + + /*! + * Returns the length of the audio-stream, used by FLAC::Properties for + * calculating the bitrate. + */ + long streamLength(); + + private: + File(const File &); + File &operator=(const File &); + + void read(bool readProperties, Properties::ReadStyle propertiesStyle); + void scan(); + ByteVector streamInfoData(); + ByteVector xiphCommentData(); + + class FilePrivate; + FilePrivate *d; + }; + } // namespace FLAC + } // namespace Ogg +} // namespace TagLib + +#endif diff --git a/Libraries/TagLib/Files/taglib/ogg/oggfile.cpp b/Libraries/TagLib/Files/taglib/ogg/oggfile.cpp new file mode 100644 index 000000000..357a30edd --- /dev/null +++ b/Libraries/TagLib/Files/taglib/ogg/oggfile.cpp @@ -0,0 +1,332 @@ +/*************************************************************************** + copyright : (C) 2003 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#include +#include +#include +#include + +#include "oggfile.h" +#include "oggpage.h" +#include "oggpageheader.h" + +using namespace TagLib; + +class Ogg::File::FilePrivate +{ +public: + FilePrivate() : + streamSerialNumber(0), + firstPageHeader(0), + lastPageHeader(0), + currentPage(0), + currentPacketPage(0) + { + pages.setAutoDelete(true); + } + + ~FilePrivate() + { + delete firstPageHeader; + delete lastPageHeader; + } + + uint streamSerialNumber; + List pages; + PageHeader *firstPageHeader; + PageHeader *lastPageHeader; + std::vector< List > packetToPageMap; + Map dirtyPackets; + List dirtyPages; + + //! The current page for the reader -- used by nextPage() + Page *currentPage; + //! The current page for the packet parser -- used by packet() + Page *currentPacketPage; + //! The packets for the currentPacketPage -- used by packet() + ByteVectorList currentPackets; +}; + +//////////////////////////////////////////////////////////////////////////////// +// public members +//////////////////////////////////////////////////////////////////////////////// + +Ogg::File::~File() +{ + delete d; +} + +ByteVector Ogg::File::packet(uint i) +{ + // Check to see if we're called setPacket() for this packet since the last + // save: + + if(d->dirtyPackets.contains(i)) + return d->dirtyPackets[i]; + + // If we haven't indexed the page where the packet we're interested in starts, + // begin reading pages until we have. + + while(d->packetToPageMap.size() <= i) { + if(!nextPage()) { + debug("Ogg::File::packet() -- Could not find the requested packet."); + return ByteVector::null; + } + } + + // Start reading at the first page that contains part (or all) of this packet. + // If the last read stopped at the packet that we're interested in, don't + // reread its packet list. (This should make sequential packet reads fast.) + + uint pageIndex = d->packetToPageMap[i].front(); + if(d->currentPacketPage != d->pages[pageIndex]) { + d->currentPacketPage = d->pages[pageIndex]; + d->currentPackets = d->currentPacketPage->packets(); + } + + // If the packet is completely contained in the first page that it's in, then + // just return it now. + + if(d->currentPacketPage->containsPacket(i) & Page::CompletePacket) + return d->currentPackets[i - d->currentPacketPage->firstPacketIndex()]; + + // If the packet is *not* completely contained in the first page that it's a + // part of then that packet trails off the end of the page. Continue appending + // the pages' packet data until we hit a page that either does not end with the + // packet that we're fetching or where the last packet is complete. + + ByteVector packet = d->currentPackets.back(); + while(d->currentPacketPage->containsPacket(i) & Page::EndsWithPacket && + !d->currentPacketPage->header()->lastPacketCompleted()) + { + pageIndex++; + if(pageIndex == d->pages.size()) { + if(!nextPage()) { + debug("Ogg::File::packet() -- Could not find the requested packet."); + return ByteVector::null; + } + } + d->currentPacketPage = d->pages[pageIndex]; + d->currentPackets = d->currentPacketPage->packets(); + packet.append(d->currentPackets.front()); + } + + return packet; +} + +void Ogg::File::setPacket(uint i, const ByteVector &p) +{ + while(d->packetToPageMap.size() <= i) { + if(!nextPage()) { + debug("Ogg::File::setPacket() -- Could not set the requested packet."); + return; + } + } + + List::ConstIterator it = d->packetToPageMap[i].begin(); + for(; it != d->packetToPageMap[i].end(); ++it) + d->dirtyPages.sortedInsert(*it, true); + + d->dirtyPackets.insert(i, p); +} + +const Ogg::PageHeader *Ogg::File::firstPageHeader() +{ + if(d->firstPageHeader) + return d->firstPageHeader->isValid() ? d->firstPageHeader : 0; + + long firstPageHeaderOffset = find("OggS"); + + if(firstPageHeaderOffset < 0) + return 0; + + d->firstPageHeader = new PageHeader(this, firstPageHeaderOffset); + return d->firstPageHeader->isValid() ? d->firstPageHeader : 0; +} + +const Ogg::PageHeader *Ogg::File::lastPageHeader() +{ + if(d->lastPageHeader) + return d->lastPageHeader->isValid() ? d->lastPageHeader : 0; + + long lastPageHeaderOffset = rfind("OggS"); + + if(lastPageHeaderOffset < 0) + return 0; + + d->lastPageHeader = new PageHeader(this, lastPageHeaderOffset); + return d->lastPageHeader->isValid() ? d->lastPageHeader : 0; +} + +bool Ogg::File::save() +{ + if(readOnly()) { + debug("Ogg::File::save() - Cannot save to a read only file."); + return false; + } + + List pageGroup; + + for(List::ConstIterator it = d->dirtyPages.begin(); it != d->dirtyPages.end(); ++it) { + if(!pageGroup.isEmpty() && pageGroup.back() + 1 != *it) { + writePageGroup(pageGroup); + pageGroup.clear(); + } + else + pageGroup.append(*it); + } + writePageGroup(pageGroup); + d->dirtyPages.clear(); + d->dirtyPackets.clear(); + + return true; +} + +//////////////////////////////////////////////////////////////////////////////// +// protected members +//////////////////////////////////////////////////////////////////////////////// + +Ogg::File::File(const char *file) : TagLib::File(file) +{ + d = new FilePrivate; +} + +//////////////////////////////////////////////////////////////////////////////// +// private members +//////////////////////////////////////////////////////////////////////////////// + +bool Ogg::File::nextPage() +{ + long nextPageOffset; + int currentPacket; + + if(d->pages.isEmpty()) { + currentPacket = 0; + nextPageOffset = find("OggS"); + if(nextPageOffset < 0) + return false; + } + else { + if(d->currentPage->header()->lastPageOfStream()) + return false; + + if(d->currentPage->header()->lastPacketCompleted()) + currentPacket = d->currentPage->firstPacketIndex() + d->currentPage->packetCount(); + else + currentPacket = d->currentPage->firstPacketIndex() + d->currentPage->packetCount() - 1; + + nextPageOffset = d->currentPage->fileOffset() + d->currentPage->size(); + } + + // Read the next page and add it to the page list. + + d->currentPage = new Page(this, nextPageOffset); + + if(!d->currentPage->header()->isValid()) { + delete d->currentPage; + d->currentPage = 0; + return false; + } + + d->currentPage->setFirstPacketIndex(currentPacket); + + if(d->pages.isEmpty()) + d->streamSerialNumber = d->currentPage->header()->streamSerialNumber(); + + d->pages.append(d->currentPage); + + // Loop through the packets in the page that we just read appending the + // current page number to the packet to page map for each packet. + + for(uint i = 0; i < d->currentPage->packetCount(); i++) { + uint currentPacket = d->currentPage->firstPacketIndex() + i; + if(d->packetToPageMap.size() <= currentPacket) + d->packetToPageMap.push_back(List()); + d->packetToPageMap[currentPacket].append(d->pages.size() - 1); + } + + return true; +} + +void Ogg::File::writePageGroup(const List &pageGroup) +{ + if(pageGroup.isEmpty()) + return; + + ByteVectorList packets; + + // If the first page of the group isn't dirty, append its partial content here. + + if(!d->dirtyPages.contains(d->pages[pageGroup.front()]->firstPacketIndex())) + packets.append(d->pages[pageGroup.front()]->packets().front()); + + int previousPacket = -1; + int originalSize = 0; + + for(List::ConstIterator it = pageGroup.begin(); it != pageGroup.end(); ++it) { + uint firstPacket = d->pages[*it]->firstPacketIndex(); + uint lastPacket = firstPacket + d->pages[*it]->packetCount() - 1; + + List::ConstIterator last = --pageGroup.end(); + + for(uint i = firstPacket; i <= lastPacket; i++) { + + if(it == last && i == lastPacket && !d->dirtyPages.contains(i)) + packets.append(d->pages[*it]->packets().back()); + else if(int(i) != previousPacket) { + previousPacket = i; + packets.append(packet(i)); + } + } + originalSize += d->pages[*it]->size(); + } + + const bool continued = d->pages[pageGroup.front()]->header()->firstPacketContinued(); + const bool completed = d->pages[pageGroup.back()]->header()->lastPacketCompleted(); + + // TODO: This pagination method isn't accurate for what's being done here. + // This should account for real possibilities like non-aligned packets and such. + + List pages = Page::paginate(packets, Page::SinglePagePerGroup, + d->streamSerialNumber, pageGroup.front(), + continued, completed); + + ByteVector data; + for(List::ConstIterator it = pages.begin(); it != pages.end(); ++it) + data.append((*it)->render()); + + // The insertion algorithms could also be improve to queue and prioritize data + // on the way out. Currently it requires rewriting the file for every page + // group rather than just once; however, for tagging applications there will + // generally only be one page group, so it's not worth the time for the + // optimization at the moment. + + insert(data, d->pages[pageGroup.front()]->fileOffset(), originalSize); + + // Update the page index to include the pages we just created and to delete the + // old pages. + + for(List::ConstIterator it = pages.begin(); it != pages.end(); ++it) { + const int index = (*it)->header()->pageSequenceNumber(); + delete d->pages[index]; + d->pages[index] = *it; + } +} diff --git a/Libraries/TagLib/Files/taglib/ogg/oggfile.h b/Libraries/TagLib/Files/taglib/ogg/oggfile.h new file mode 100644 index 000000000..0ca59dd99 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/ogg/oggfile.h @@ -0,0 +1,107 @@ +/*************************************************************************** + copyright : (C) 2003 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#include +#include + +#ifndef TAGLIB_OGGFILE_H +#define TAGLIB_OGGFILE_H + +namespace TagLib { + + //! A namespace for the classes used by Ogg-based metadata files + + namespace Ogg { + + class PageHeader; + + //! An implementation of TagLib::File with some helpers for Ogg based formats + + /*! + * This is an implementation of Ogg file page and packet rendering and is of + * use to Ogg based formats. While the API is small this handles the + * non-trivial details of breaking up an Ogg stream into packets and makes + * these available (via subclassing) to the codec meta data implementations. + */ + + class File : public TagLib::File + { + public: + virtual ~File(); + + /*! + * Returns the packet contents for the i-th packet (starting from zero) + * in the Ogg bitstream. + * + * \warning The requires reading at least the packet header for every page + * up to the requested page. + */ + ByteVector packet(uint i); + + /*! + * Sets the packet with index \a i to the value \a p. + */ + void setPacket(uint i, const ByteVector &p); + + /*! + * Returns a pointer to the PageHeader for the first page in the stream or + * null if the page could not be found. + */ + const PageHeader *firstPageHeader(); + + /*! + * Returns a pointer to the PageHeader for the last page in the stream or + * null if the page could not be found. + */ + const PageHeader *lastPageHeader(); + + virtual bool save(); + + protected: + /*! + * Contructs an Ogg file from \a file. If \a readProperties is true the + * file's audio properties will also be read using \a propertiesStyle. If + * false, \a propertiesStyle is ignored. + * + * \note This constructor is protected since Ogg::File shouldn't be + * instantiated directly but rather should be used through the codec + * specific subclasses. + */ + File(const char *file); + + private: + File(const File &); + File &operator=(const File &); + + /*! + * Reads the next page and updates the internal "current page" pointer. + */ + bool nextPage(); + void writePageGroup(const List &group); + + class FilePrivate; + FilePrivate *d; + }; + + } +} + +#endif diff --git a/Libraries/TagLib/Files/taglib/ogg/oggpage.cpp b/Libraries/TagLib/Files/taglib/ogg/oggpage.cpp new file mode 100644 index 000000000..4387905e2 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/ogg/oggpage.cpp @@ -0,0 +1,251 @@ +/*************************************************************************** + copyright : (C) 2003 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#include + +#include "oggpage.h" +#include "oggpageheader.h" +#include "oggfile.h" + +using namespace TagLib; + +class Ogg::Page::PagePrivate +{ +public: + PagePrivate(File *f = 0, long pageOffset = -1) : + file(f), + fileOffset(pageOffset), + packetOffset(0), + header(f, pageOffset), + firstPacketIndex(-1) + { + if(file) { + packetOffset = fileOffset + header.size(); + packetSizes = header.packetSizes(); + dataSize = header.dataSize(); + } + } + + File *file; + long fileOffset; + long packetOffset; + int dataSize; + List packetSizes; + PageHeader header; + int firstPacketIndex; + ByteVectorList packets; +}; + +//////////////////////////////////////////////////////////////////////////////// +// public members +//////////////////////////////////////////////////////////////////////////////// + +Ogg::Page::Page(Ogg::File *file, long pageOffset) +{ + d = new PagePrivate(file, pageOffset); +} + +Ogg::Page::~Page() +{ + delete d; +} + +long Ogg::Page::fileOffset() const +{ + return d->fileOffset; +} + +const Ogg::PageHeader *Ogg::Page::header() const +{ + return &d->header; +} + +int Ogg::Page::firstPacketIndex() const +{ + return d->firstPacketIndex; +} + +void Ogg::Page::setFirstPacketIndex(int index) +{ + d->firstPacketIndex = index; +} + +Ogg::Page::ContainsPacketFlags Ogg::Page::containsPacket(int index) const +{ + int lastPacketIndex = d->firstPacketIndex + packetCount() - 1; + if(index < d->firstPacketIndex || index > lastPacketIndex) + return DoesNotContainPacket; + + ContainsPacketFlags flags = DoesNotContainPacket; + + if(index == d->firstPacketIndex) + flags = ContainsPacketFlags(flags | BeginsWithPacket); + + if(index == lastPacketIndex) + flags = ContainsPacketFlags(flags | EndsWithPacket); + + // If there's only one page and it's complete: + + if(packetCount() == 1 && + !d->header.firstPacketContinued() && + d->header.lastPacketCompleted()) + { + flags = ContainsPacketFlags(flags | CompletePacket); + } + + // Or if the page is (a) the first page and it's complete or (b) the last page + // and it's complete or (c) a page in the middle. + + else if((flags & BeginsWithPacket && !d->header.firstPacketContinued()) || + (flags & EndsWithPacket && d->header.lastPacketCompleted()) || + (!(flags & BeginsWithPacket) && !(flags & EndsWithPacket))) + { + flags = ContainsPacketFlags(flags | CompletePacket); + } + + return flags; +} + +TagLib::uint Ogg::Page::packetCount() const +{ + return d->header.packetSizes().size(); +} + +ByteVectorList Ogg::Page::packets() const +{ + if(!d->packets.isEmpty()) + return d->packets; + + ByteVectorList l; + + if(d->file && d->header.isValid()) { + + d->file->seek(d->packetOffset); + + List packetSizes = d->header.packetSizes(); + + List::ConstIterator it = packetSizes.begin(); + for(; it != packetSizes.end(); ++it) + l.append(d->file->readBlock(*it)); + } + else + debug("Ogg::Page::packets() -- attempting to read packets from an invalid page."); + + return l; +} + +int Ogg::Page::size() const +{ + return d->header.size() + d->header.dataSize(); +} + +ByteVector Ogg::Page::render() const +{ + ByteVector data; + + data.append(d->header.render()); + + if(d->packets.isEmpty()) { + if(d->file) { + d->file->seek(d->packetOffset); + data.append(d->file->readBlock(d->dataSize)); + } + else + debug("Ogg::Page::render() -- this page is empty!"); + } + else { + ByteVectorList::ConstIterator it = d->packets.begin(); + for(; it != d->packets.end(); ++it) + data.append(*it); + } + + // Compute and set the checksum for the Ogg page. The checksum is taken over + // the entire page with the 4 bytes reserved for the checksum zeroed and then + // inserted in bytes 22-25 of the page header. + + ByteVector checksum = ByteVector::fromUInt(data.checksum(), false); + for(int i = 0; i < 4; i++) + data[i + 22] = checksum[i]; + + return data; +} + +List Ogg::Page::paginate(const ByteVectorList &packets, + PaginationStrategy strategy, + uint streamSerialNumber, + int firstPage, + bool firstPacketContinued, + bool lastPacketCompleted, + bool containsLastPacket) +{ + List l; + + int totalSize = 0; + + for(ByteVectorList::ConstIterator it = packets.begin(); it != packets.end(); ++it) + totalSize += (*it).size(); + + if(strategy == Repaginate || totalSize + packets.size() > 255 * 256) { + debug("Ogg::Page::paginate() -- Sorry! Repagination is not yet implemented."); + return l; + } + + // TODO: Handle creation of multiple pages here with appropriate pagination. + + Page *p = new Page(packets, streamSerialNumber, firstPage, firstPacketContinued, + lastPacketCompleted, containsLastPacket); + l.append(p); + + return l; +} + +//////////////////////////////////////////////////////////////////////////////// +// protected members +//////////////////////////////////////////////////////////////////////////////// + +Ogg::Page::Page(const ByteVectorList &packets, + uint streamSerialNumber, + int pageNumber, + bool firstPacketContinued, + bool lastPacketCompleted, + bool containsLastPacket) +{ + d = new PagePrivate; + + ByteVector data; + List packetSizes; + + d->header.setFirstPageOfStream(pageNumber == 0 && !firstPacketContinued); + d->header.setLastPageOfStream(containsLastPacket); + d->header.setFirstPacketContinued(firstPacketContinued); + d->header.setLastPacketCompleted(lastPacketCompleted); + d->header.setStreamSerialNumber(streamSerialNumber); + d->header.setPageSequenceNumber(pageNumber); + + // Build a page from the list of packets. + + for(ByteVectorList::ConstIterator it = packets.begin(); it != packets.end(); ++it) { + packetSizes.append((*it).size()); + data.append(*it); + } + d->packets = packets; + d->header.setPacketSizes(packetSizes); +} diff --git a/Libraries/TagLib/Files/taglib/ogg/oggpage.h b/Libraries/TagLib/Files/taglib/ogg/oggpage.h new file mode 100644 index 000000000..c4b0792a2 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/ogg/oggpage.h @@ -0,0 +1,198 @@ +/*************************************************************************** + copyright : (C) 2003 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#ifndef TAGLIB_OGGPAGE_H +#define TAGLIB_OGGPAGE_H + +#include + +namespace TagLib { + + namespace Ogg { + + class File; + class PageHeader; + + //! An implementation of Ogg pages + + /*! + * This is an implementation of the pages that make up an Ogg stream. + * This handles parsing pages and breaking them down into packets and handles + * the details of packets spanning multiple pages and pages that contiain + * multiple packets. + * + * In most Xiph.org formats the comments are found in the first few packets, + * this however is a reasonably complete implementation of Ogg pages that + * could potentially be useful for non-meta data purposes. + */ + + class Page + { + public: + /*! + * Read an Ogg page from the \a file at the position \a pageOffset. + */ + Page(File *file, long pageOffset); + + virtual ~Page(); + + /*! + * Returns the page's position within the file (in bytes). + */ + long fileOffset() const; + + /*! + * Returns a pointer to the header for this page. This pointer will become + * invalid when the page is deleted. + */ + const PageHeader *header() const; + + /*! + * Returns the index of the first packet wholly or partially contained in + * this page. + * + * \see setFirstPacketIndex() + */ + int firstPacketIndex() const; + + /*! + * Sets the index of the first packet in the page. + * + * \see firstPacketIndex() + */ + void setFirstPacketIndex(int index); + + /*! + * When checking to see if a page contains a given packet this set of flags + * represents the possible values for that packets status in the page. + * + * \see containsPacket() + */ + enum ContainsPacketFlags { + //! No part of the packet is contained in the page + DoesNotContainPacket = 0x0000, + //! The packet is wholly contained in the page + CompletePacket = 0x0001, + //! The page starts with the given packet + BeginsWithPacket = 0x0002, + //! The page ends with the given packet + EndsWithPacket = 0x0004 + }; + + /*! + * Checks to see if the specified \a packet is contained in the current + * page. + * + * \see ContainsPacketFlags + */ + ContainsPacketFlags containsPacket(int index) const; + + /*! + * Returns the number of packets (whole or partial) in this page. + */ + uint packetCount() const; + + /*! + * Returns a list of the packets in this page. + * + * \note Either or both the first and last packets may be only partial. + * \see PageHeader::firstPacketContinued() + */ + ByteVectorList packets() const; + + /*! + * Returns the size of the page in bytes. + */ + int size() const; + + ByteVector render() const; + + /*! + * Defines a strategy for pagination, or grouping pages into Ogg packets, + * for use with pagination methods. + * + * \note Yes, I'm aware that this is not a canonical "Strategy Pattern", + * the term was simply convenient. + */ + enum PaginationStrategy { + /*! + * Attempt to put the specified set of packets into a single Ogg packet. + * If the sum of the packet data is greater than will fit into a single + * Ogg page -- 65280 bytes -- this will fall back to repagination using + * the recommended page sizes. + */ + SinglePagePerGroup, + /*! + * Split the packet or group of packets into pages that conform to the + * sizes recommended in the Ogg standard. + */ + Repaginate + }; + + /*! + * Pack \a packets into Ogg pages using the \a strategy for pagination. + * The page number indicater inside of the rendered packets will start + * with \a firstPage and be incremented for each page rendered. + * \a containsLastPacket should be set to true if \a packets contains the + * last page in the stream and will set the appropriate flag in the last + * rendered Ogg page's header. \a streamSerialNumber should be set to + * the serial number for this stream. + * + * \note The "absolute granule position" is currently always zeroed using + * this method as this suffices for the comment headers. + * + * \warning The pages returned by this method must be deleted by the user. + * You can use List::setAutoDelete(true) to set these pages to be + * automatically deleted when this list passes out of scope. + * + * \see PaginationStrategy + * \see List::setAutoDelete() + */ + static List paginate(const ByteVectorList &packets, + PaginationStrategy strategy, + uint streamSerialNumber, + int firstPage, + bool firstPacketContinued = false, + bool lastPacketCompleted = true, + bool containsLastPacket = false); + + protected: + /*! + * Creates an Ogg packet based on the data in \a packets. The page number + * for each page will be set to \a pageNumber. + */ + Page(const ByteVectorList &packets, + uint streamSerialNumber, + int pageNumber, + bool firstPacketContinued = false, + bool lastPacketCompleted = true, + bool containsLastPacket = false); + + private: + Page(const Page &); + Page &operator=(const Page &); + + class PagePrivate; + PagePrivate *d; + }; + } +} +#endif diff --git a/Libraries/TagLib/Files/taglib/ogg/oggpageheader.cpp b/Libraries/TagLib/Files/taglib/ogg/oggpageheader.cpp new file mode 100644 index 000000000..40fe92dca --- /dev/null +++ b/Libraries/TagLib/Files/taglib/ogg/oggpageheader.cpp @@ -0,0 +1,317 @@ +/*************************************************************************** + copyright : (C) 2003 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#include + +#include +#include +#include + +#include "oggpageheader.h" +#include "oggfile.h" + +using namespace TagLib; + +class Ogg::PageHeader::PageHeaderPrivate +{ +public: + PageHeaderPrivate(File *f, long pageOffset) : + file(f), + fileOffset(pageOffset), + isValid(false), + firstPacketContinued(false), + lastPacketCompleted(false), + firstPageOfStream(false), + lastPageOfStream(false), + absoluteGranularPosition(0), + streamSerialNumber(0), + pageSequenceNumber(-1), + size(0), + dataSize(0) + {} + + File *file; + long fileOffset; + bool isValid; + List packetSizes; + bool firstPacketContinued; + bool lastPacketCompleted; + bool firstPageOfStream; + bool lastPageOfStream; + long long absoluteGranularPosition; + uint streamSerialNumber; + int pageSequenceNumber; + int size; + int dataSize; +}; + +//////////////////////////////////////////////////////////////////////////////// +// public members +//////////////////////////////////////////////////////////////////////////////// + +Ogg::PageHeader::PageHeader(Ogg::File *file, long pageOffset) +{ + d = new PageHeaderPrivate(file, pageOffset); + if(file && pageOffset >= 0) + read(); +} + +Ogg::PageHeader::~PageHeader() +{ + delete d; +} + +bool Ogg::PageHeader::isValid() const +{ + return d->isValid; +} + +List Ogg::PageHeader::packetSizes() const +{ + return d->packetSizes; +} + +void Ogg::PageHeader::setPacketSizes(const List &sizes) +{ + d->packetSizes = sizes; +} + +bool Ogg::PageHeader::firstPacketContinued() const +{ + return d->firstPacketContinued; +} + +void Ogg::PageHeader::setFirstPacketContinued(bool continued) +{ + d->firstPacketContinued = continued; +} + +bool Ogg::PageHeader::lastPacketCompleted() const +{ + return d->lastPacketCompleted; +} + +void Ogg::PageHeader::setLastPacketCompleted(bool completed) +{ + d->lastPacketCompleted = completed; +} + +bool Ogg::PageHeader::firstPageOfStream() const +{ + return d->firstPageOfStream; +} + +void Ogg::PageHeader::setFirstPageOfStream(bool first) +{ + d->firstPageOfStream = first; +} + +bool Ogg::PageHeader::lastPageOfStream() const +{ + return d->lastPageOfStream; +} + +void Ogg::PageHeader::setLastPageOfStream(bool last) +{ + d->lastPageOfStream = last; +} + +long long Ogg::PageHeader::absoluteGranularPosition() const +{ + return d->absoluteGranularPosition; +} + +void Ogg::PageHeader::setAbsoluteGranularPosition(long long agp) +{ + d->absoluteGranularPosition = agp; +} + +int Ogg::PageHeader::pageSequenceNumber() const +{ + return d->pageSequenceNumber; +} + +void Ogg::PageHeader::setPageSequenceNumber(int sequenceNumber) +{ + d->pageSequenceNumber = sequenceNumber; +} + +TagLib::uint Ogg::PageHeader::streamSerialNumber() const +{ + return d->streamSerialNumber; +} + +void Ogg::PageHeader::setStreamSerialNumber(uint n) +{ + d->streamSerialNumber = n; +} + +int Ogg::PageHeader::size() const +{ + return d->size; +} + +int Ogg::PageHeader::dataSize() const +{ + return d->dataSize; +} + +ByteVector Ogg::PageHeader::render() const +{ + ByteVector data; + + // capture patern + + data.append("OggS"); + + // stream structure version + + data.append(char(0)); + + // header type flag + + std::bitset<8> flags; + flags[0] = d->firstPacketContinued; + flags[1] = d->pageSequenceNumber == 0; + flags[2] = d->lastPageOfStream; + + data.append(char(flags.to_ulong())); + + // absolute granular position + + data.append(ByteVector::fromLongLong(d->absoluteGranularPosition, false)); + + // stream serial number + + data.append(ByteVector::fromUInt(d->streamSerialNumber, false)); + + // page sequence number + + data.append(ByteVector::fromUInt(d->pageSequenceNumber, false)); + + // checksum -- this is left empty and should be filled in by the Ogg::Page + // class + + data.append(ByteVector(4, 0)); + + // page segment count and page segment table + + ByteVector pageSegments = lacingValues(); + + data.append(char(uchar(pageSegments.size()))); + data.append(pageSegments); + + return data; +} + +//////////////////////////////////////////////////////////////////////////////// +// private members +//////////////////////////////////////////////////////////////////////////////// + +void Ogg::PageHeader::read() +{ + d->file->seek(d->fileOffset); + + // An Ogg page header is at least 27 bytes, so we'll go ahead and read that + // much and then get the rest when we're ready for it. + + ByteVector data = d->file->readBlock(27); + + // Sanity check -- make sure that we were in fact able to read as much data as + // we asked for and that the page begins with "OggS". + + if(data.size() != 27 || data.mid(0, 4) != "OggS") { + debug("Ogg::PageHeader::read() -- error reading page header"); + return; + } + + std::bitset<8> flags(data[5]); + + d->firstPacketContinued = flags.test(0); + d->firstPageOfStream = flags.test(1); + d->lastPageOfStream = flags.test(2); + + d->absoluteGranularPosition = data.mid(6, 8).toLongLong(false); + d->streamSerialNumber = data.mid(14, 4).toUInt(false); + d->pageSequenceNumber = data.mid(18, 4).toUInt(false); + + // Byte number 27 is the number of page segments, which is the only variable + // length portion of the page header. After reading the number of page + // segments we'll then read in the coresponding data for this count. + + int pageSegmentCount = uchar(data[26]); + + ByteVector pageSegments = d->file->readBlock(pageSegmentCount); + + // Another sanity check. + + if(pageSegmentCount < 1 || int(pageSegments.size()) != pageSegmentCount) + return; + + // The base size of an Ogg page 27 bytes plus the number of lacing values. + + d->size = 27 + pageSegmentCount; + + int packetSize = 0; + + for(int i = 0; i < pageSegmentCount; i++) { + d->dataSize += uchar(pageSegments[i]); + packetSize += uchar(pageSegments[i]); + + if(uchar(pageSegments[i]) < 255) { + d->packetSizes.append(packetSize); + packetSize = 0; + } + } + + if(packetSize > 0) { + d->packetSizes.append(packetSize); + d->lastPacketCompleted = false; + } + else + d->lastPacketCompleted = true; + + d->isValid = true; +} + +ByteVector Ogg::PageHeader::lacingValues() const +{ + ByteVector data; + + List sizes = d->packetSizes; + for(List::ConstIterator it = sizes.begin(); it != sizes.end(); ++it) { + + // The size of a packet in an Ogg page is indicated by a series of "lacing + // values" where the sum of the values is the packet size in bytes. Each of + // these values is a byte. A value of less than 255 (0xff) indicates the end + // of the packet. + + div_t n = div(*it, 255); + + for(int i = 0; i < n.quot; i++) + data.append(char(uchar(255))); + + if(it != --sizes.end() || d->lastPacketCompleted) + data.append(char(uchar(n.rem))); + } + + return data; +} diff --git a/Libraries/TagLib/Files/taglib/ogg/oggpageheader.h b/Libraries/TagLib/Files/taglib/ogg/oggpageheader.h new file mode 100644 index 000000000..45f22a83e --- /dev/null +++ b/Libraries/TagLib/Files/taglib/ogg/oggpageheader.h @@ -0,0 +1,227 @@ +/*************************************************************************** + copyright : (C) 2003 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#ifndef TAGLIB_OGGPAGEHEADER_H +#define TAGLIB_OGGPAGEHEADER_H + +#include +#include + +namespace TagLib { + + namespace Ogg { + + class File; + + //! An implementation of the page headers associated with each Ogg::Page + + /*! + * This class implements Ogg page headers which contain the information + * about Ogg pages needed to break them into packets which can be passed on + * to the codecs. + */ + + class PageHeader + { + public: + /*! + * Reads a PageHeader from \a file starting at \a pageOffset. The defaults + * create a page with no (and as such, invalid) data that must be set + * later. + */ + PageHeader(File *file = 0, long pageOffset = -1); + + /*! + * Deletes this instance of the PageHeader. + */ + virtual ~PageHeader(); + + /*! + * Returns true if the header parsed properly and is valid. + */ + bool isValid() const; + + /*! + * Ogg pages contain a list of packets (which are used by the contained + * codecs). The sizes of these pages is encoded in the page header. This + * returns a list of the packet sizes in bytes. + * + * \see setPacketSizes() + */ + List packetSizes() const; + + /*! + * Sets the sizes of the packets in this page to \a sizes. Internally this + * updates the lacing values in the header. + * + * \see packetSizes() + */ + void setPacketSizes(const List &sizes); + + /*! + * Some packets can be continued across multiple pages. If the + * first packet in the current page is a continuation this will return + * true. If this is page starts with a new packet this will return false. + * + * \see lastPacketCompleted() + * \see setFirstPacketContinued() + */ + bool firstPacketContinued() const; + + /*! + * Sets the internal flag indicating if the first packet in this page is + * continued to \a continued. + * + * \see firstPacketContinued() + */ + void setFirstPacketContinued(bool continued); + + /*! + * Returns true if the last packet of this page is completely contained in + * this page. + * + * \see firstPacketContinued() + * \see setLastPacketCompleted() + */ + bool lastPacketCompleted() const; + + /*! + * Sets the internal flag indicating if the last packet in this page is + * complete to \a completed. + * + * \see lastPacketCompleted() + */ + void setLastPacketCompleted(bool completed); + + /*! + * This returns true if this is the first page of the Ogg (logical) stream. + * + * \see setFirstPageOfStream() + */ + bool firstPageOfStream() const; + + /*! + * Marks this page as the first page of the Ogg stream. + * + * \see firstPageOfStream() + */ + void setFirstPageOfStream(bool first); + + /*! + * This returns true if this is the last page of the Ogg (logical) stream. + * + * \see setLastPageOfStream() + */ + bool lastPageOfStream() const; + + /*! + * Marks this page as the last page of the Ogg stream. + * + * \see lastPageOfStream() + */ + void setLastPageOfStream(bool last); + + /*! + * A special value of containing the position of the packet to be + * interpreted by the codec. In the case of Vorbis this contains the PCM + * value and is used to calculate the length of the stream. + * + * \see setAbsoluteGranularPosition() + */ + long long absoluteGranularPosition() const; + + /*! + * A special value of containing the position of the packet to be + * interpreted by the codec. It is only supported here so that it may be + * coppied from one page to another. + * + * \see absoluteGranularPosition() + */ + void setAbsoluteGranularPosition(long long agp); + + /*! + * Every Ogg logical stream is given a random serial number which is common + * to every page in that logical stream. This returns the serial number of + * the stream associated with this packet. + * + * \see setStreamSerialNumber() + */ + uint streamSerialNumber() const; + + /*! + * Every Ogg logical stream is given a random serial number which is common + * to every page in that logical stream. This sets this pages serial + * number. This method should be used when adding new pages to a logical + * stream. + * + * \see streamSerialNumber() + */ + void setStreamSerialNumber(uint n); + + /*! + * Returns the index of the page within the Ogg stream. This helps make it + * possible to determine if pages have been lost. + * + * \see setPageSequenceNumber() + */ + int pageSequenceNumber() const; + + /*! + * Sets the page's position in the stream to \a sequenceNumber. + * + * \see pageSequenceNumber() + */ + void setPageSequenceNumber(int sequenceNumber); + + /*! + * Returns the complete header size. + */ + int size() const; + + /*! + * Returns the size of the data portion of the page -- i.e. the size of the + * page less the header size. + */ + int dataSize() const; + + /*! + * Render the page header to binary data. + * + * \note The checksum -- bytes 22 - 25 -- will be left empty and must be + * filled in when rendering the entire page. + */ + ByteVector render() const; + + private: + PageHeader(const PageHeader &); + PageHeader &operator=(const PageHeader &); + + void read(); + ByteVector lacingValues() const; + + class PageHeaderPrivate; + PageHeaderPrivate *d; + }; + + } +} + +#endif diff --git a/Libraries/TagLib/Files/taglib/ogg/vorbis/Makefile.am b/Libraries/TagLib/Files/taglib/ogg/vorbis/Makefile.am new file mode 100644 index 000000000..4a6393c1f --- /dev/null +++ b/Libraries/TagLib/Files/taglib/ogg/vorbis/Makefile.am @@ -0,0 +1,14 @@ +INCLUDES = \ + -I$(top_srcdir)/taglib \ + -I$(top_srcdir)/taglib/toolkit \ + -I$(top_srcdir)/taglib/ogg \ + $(all_includes) + +noinst_LTLIBRARIES = libvorbis.la + +libvorbis_la_SOURCES = vorbisfile.cpp vorbisproperties.cpp + +taglib_include_HEADERS = vorbisfile.h vorbisproperties.h +taglib_includedir = $(includedir)/taglib + +EXTRA_DIST = $(libvorbis_la_SOURCES) $(taglib_include_HEADERS) diff --git a/Libraries/TagLib/Files/taglib/ogg/vorbis/Makefile.in b/Libraries/TagLib/Files/taglib/ogg/vorbis/Makefile.in new file mode 100644 index 000000000..70286f019 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/ogg/vorbis/Makefile.in @@ -0,0 +1,548 @@ +# Makefile.in generated by automake 1.7.6 from Makefile.am. +# KDE tags expanded automatically by am_edit - $Revision$ +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../../.. + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTODIRS = @AUTODIRS@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CONF_FILES = @CONF_FILES@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +KDE_PLUGIN = @KDE_PLUGIN@ +KDE_USE_CLOSURE_FALSE = @KDE_USE_CLOSURE_FALSE@ +KDE_USE_CLOSURE_TRUE = @KDE_USE_CLOSURE_TRUE@ +KDE_USE_FINAL_FALSE = @KDE_USE_FINAL_FALSE@ +KDE_USE_FINAL_TRUE = @KDE_USE_FINAL_TRUE@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +NOOPT_CFLAGS = @NOOPT_CFLAGS@ +NOOPT_CXXFLAGS = @NOOPT_CXXFLAGS@ +NOREPO = @NOREPO@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +REPO = @REPO@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +TOPSUBDIRS = @TOPSUBDIRS@ +USE_EXCEPTIONS = @USE_EXCEPTIONS@ +USE_RTTI = @USE_RTTI@ +VERSION = @VERSION@ +WOVERLOADED_VIRTUAL = @WOVERLOADED_VIRTUAL@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +all_includes = @all_includes@ +all_libraries = @all_libraries@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +link_zlib_FALSE = @link_zlib_FALSE@ +link_zlib_TRUE = @link_zlib_TRUE@ +localstatedir = @localstatedir@ +mandir = @mandir@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +INCLUDES = \ + -I$(top_srcdir)/taglib \ + -I$(top_srcdir)/taglib/toolkit \ + -I$(top_srcdir)/taglib/ogg \ + $(all_includes) + + +noinst_LTLIBRARIES = libvorbis.la + +libvorbis_la_SOURCES = vorbisfile.cpp vorbisproperties.cpp + +taglib_include_HEADERS = vorbisfile.h vorbisproperties.h +taglib_includedir = $(includedir)/taglib + +EXTRA_DIST = $(libvorbis_la_SOURCES) $(taglib_include_HEADERS) +subdir = taglib/ogg/vorbis +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/admin/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) + +libvorbis_la_LDFLAGS = +libvorbis_la_LIBADD = +am_libvorbis_la_OBJECTS = vorbisfile.lo vorbisproperties.lo +#>- libvorbis_la_OBJECTS = $(am_libvorbis_la_OBJECTS) +#>+ 4 +libvorbis_la_final_OBJECTS = libvorbis_la.all_cpp.lo +libvorbis_la_nofinal_OBJECTS = vorbisfile.lo vorbisproperties.lo +@KDE_USE_FINAL_FALSE@libvorbis_la_OBJECTS = $(libvorbis_la_nofinal_OBJECTS) +@KDE_USE_FINAL_TRUE@libvorbis_la_OBJECTS = $(libvorbis_la_final_OBJECTS) + +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/admin/depcomp +am__depfiles_maybe = depfiles +#>- @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/vorbisfile.Plo \ +#>- @AMDEP_TRUE@ ./$(DEPDIR)/vorbisproperties.Plo +#>+ 5 +@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@DEP_FILES = $(DEPDIR)/libvorbis_la.all_cpp.P ./$(DEPDIR)/vorbisfile.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@ @AMDEP_TRUE@ ./$(DEPDIR)/vorbisproperties.Plo +@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@DEP_FILES = ./$(DEPDIR)/vorbisfile.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@ @AMDEP_TRUE@ ./$(DEPDIR)/vorbisproperties.Plo + +#>- CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ +#>- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +#>+ 2 +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(KDE_CXXFLAGS) +#>- LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) \ +#>- $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ +#>- $(AM_CXXFLAGS) $(CXXFLAGS) +#>+ 3 +LTCXXCOMPILE = $(LIBTOOL) --mode=compile --tag=CXX $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) $(KDE_CXXFLAGS) +CXXLD = $(CXX) +#>- CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \ +#>- $(AM_LDFLAGS) $(LDFLAGS) -o $@ +#>+ 2 +CXXLINK = $(LIBTOOL) --mode=link --tag=CXX $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(KDE_CXXFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +DIST_SOURCES = $(libvorbis_la_SOURCES) +HEADERS = $(taglib_include_HEADERS) + +DIST_COMMON = $(taglib_include_HEADERS) Makefile.am Makefile.in +SOURCES = $(libvorbis_la_SOURCES) + +#>- all: all-am +#>+ 1 +all: docs-am all-am + +.SUFFIXES: +.SUFFIXES: .cpp .lo .o .obj +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) +#>- cd $(top_srcdir) && \ +#>- $(AUTOMAKE) --gnu taglib/ogg/vorbis/Makefile +#>+ 3 + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu taglib/ogg/vorbis/Makefile + cd $(top_srcdir) && perl admin/am_edit taglib/ogg/vorbis/Makefile.in +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" = "$$p" && dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libvorbis.la: $(libvorbis_la_OBJECTS) $(libvorbis_la_DEPENDENCIES) + $(CXXLINK) $(libvorbis_la_LDFLAGS) $(libvorbis_la_OBJECTS) $(libvorbis_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) core *.core + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vorbisfile.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vorbisproperties.Plo@am__quote@ + +distclean-depend: + -rm -rf ./$(DEPDIR) + +.cpp.o: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + +.cpp.obj: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` + +.cpp.lo: +@am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: +taglib_includeHEADERS_INSTALL = $(INSTALL_HEADER) +install-taglib_includeHEADERS: $(taglib_include_HEADERS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(taglib_includedir) + @list='$(taglib_include_HEADERS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(taglib_includeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(taglib_includedir)/$$f"; \ + $(taglib_includeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(taglib_includedir)/$$f; \ + done + +uninstall-taglib_includeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(taglib_include_HEADERS)'; for p in $$list; do \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " rm -f $(DESTDIR)$(taglib_includedir)/$$f"; \ + rm -f $(DESTDIR)$(taglib_includedir)/$$f; \ + done + +ETAGS = etags +ETAGSFLAGS = + +CTAGS = ctags +CTAGSFLAGS = + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique + +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = ../../.. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) + +installdirs: + $(mkinstalldirs) $(DESTDIR)$(taglib_includedir) +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +#>- clean: clean-am +#>+ 1 +clean: kde-rpo-clean clean-am + +#>- clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ +#>- mostlyclean-am +#>+ 2 +clean-am: clean-final clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + +distclean-am: clean-am distclean-compile distclean-depend \ + distclean-generic distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: install-taglib_includeHEADERS + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am uninstall-taglib_includeHEADERS + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstLTLIBRARIES ctags distclean \ + distclean-compile distclean-depend distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am info \ + info-am install install-am install-data install-data-am \ + install-exec install-exec-am install-info install-info-am \ + install-man install-strip install-taglib_includeHEADERS \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-info-am \ + uninstall-taglib_includeHEADERS + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: + +#>+ 2 +docs-am: + +#>+ 6 +force-reedit: + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu taglib/ogg/vorbis/Makefile + cd $(top_srcdir) && perl admin/am_edit taglib/ogg/vorbis/Makefile.in + + +#>+ 11 +libvorbis_la.all_cpp.cpp: $(srcdir)/Makefile.in $(srcdir)/vorbisfile.cpp $(srcdir)/vorbisproperties.cpp + @echo 'creating libvorbis_la.all_cpp.cpp ...'; \ + rm -f libvorbis_la.all_cpp.files libvorbis_la.all_cpp.final; \ + echo "#define KDE_USE_FINAL 1" >> libvorbis_la.all_cpp.final; \ + for file in vorbisfile.cpp vorbisproperties.cpp ; do \ + echo "#include \"$$file\"" >> libvorbis_la.all_cpp.files; \ + test ! -f $(srcdir)/$$file || egrep '^#pragma +implementation' $(srcdir)/$$file >> libvorbis_la.all_cpp.final; \ + done; \ + cat libvorbis_la.all_cpp.final libvorbis_la.all_cpp.files > libvorbis_la.all_cpp.cpp; \ + rm -f libvorbis_la.all_cpp.final libvorbis_la.all_cpp.files + +#>+ 3 +clean-final: + -rm -f libvorbis_la.all_cpp.cpp + +#>+ 2 +final: + $(MAKE) libvorbis_la_OBJECTS="$(libvorbis_la_final_OBJECTS)" all-am +#>+ 2 +final-install: + $(MAKE) libvorbis_la_OBJECTS="$(libvorbis_la_final_OBJECTS)" install-am +#>+ 2 +no-final: + $(MAKE) libvorbis_la_OBJECTS="$(libvorbis_la_nofinal_OBJECTS)" all-am +#>+ 2 +no-final-install: + $(MAKE) libvorbis_la_OBJECTS="$(libvorbis_la_nofinal_OBJECTS)" install-am +#>+ 3 +cvs-clean: + $(MAKE) admindir=$(top_srcdir)/admin -f $(top_srcdir)/admin/Makefile.common cvs-clean + +#>+ 3 +kde-rpo-clean: + -rm -f *.rpo diff --git a/Libraries/TagLib/Files/taglib/ogg/vorbis/vorbisfile.cpp b/Libraries/TagLib/Files/taglib/ogg/vorbis/vorbisfile.cpp new file mode 100644 index 000000000..a6e8b94c9 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/ogg/vorbis/vorbisfile.cpp @@ -0,0 +1,113 @@ +/*************************************************************************** + copyright : (C) 2003 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#include + +#include +#include + +#include "vorbisfile.h" + +using namespace TagLib; + +class Vorbis::File::FilePrivate +{ +public: + FilePrivate() : + comment(0), + properties(0) {} + + ~FilePrivate() + { + delete comment; + delete properties; + } + + Ogg::XiphComment *comment; + Properties *properties; +}; + +namespace TagLib { + /*! + * Vorbis headers can be found with one type ID byte and the string "vorbis" in + * an Ogg stream. 0x03 indicates the comment header. + */ + static const char vorbisCommentHeaderID[] = { 0x03, 'v', 'o', 'r', 'b', 'i', 's', 0 }; +} + +//////////////////////////////////////////////////////////////////////////////// +// public members +//////////////////////////////////////////////////////////////////////////////// + +Vorbis::File::File(const char *file, bool readProperties, + Properties::ReadStyle propertiesStyle) : Ogg::File(file) +{ + d = new FilePrivate; + read(readProperties, propertiesStyle); +} + +Vorbis::File::~File() +{ + delete d; +} + +Ogg::XiphComment *Vorbis::File::tag() const +{ + return d->comment; +} + +Vorbis::Properties *Vorbis::File::audioProperties() const +{ + return d->properties; +} + +bool Vorbis::File::save() +{ + ByteVector v(vorbisCommentHeaderID); + + if(!d->comment) + d->comment = new Ogg::XiphComment; + v.append(d->comment->render()); + + setPacket(1, v); + + return Ogg::File::save(); +} + +//////////////////////////////////////////////////////////////////////////////// +// private members +//////////////////////////////////////////////////////////////////////////////// + +void Vorbis::File::read(bool readProperties, Properties::ReadStyle propertiesStyle) +{ + ByteVector commentHeaderData = packet(1); + + if(commentHeaderData.mid(0, 7) != vorbisCommentHeaderID) { + debug("Vorbis::File::read() - Could not find the Vorbis comment header."); + setValid(false); + return; + } + + d->comment = new Ogg::XiphComment(commentHeaderData.mid(7)); + + if(readProperties) + d->properties = new Properties(this, propertiesStyle); +} diff --git a/Libraries/TagLib/Files/taglib/ogg/vorbis/vorbisfile.h b/Libraries/TagLib/Files/taglib/ogg/vorbis/vorbisfile.h new file mode 100644 index 000000000..f85e4bee6 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/ogg/vorbis/vorbisfile.h @@ -0,0 +1,113 @@ +/*************************************************************************** + copyright : (C) 2002 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#ifndef TAGLIB_VORBISFILE_H +#define TAGLIB_VORBISFILE_H + +#include +#include + +#include "vorbisproperties.h" + +namespace TagLib { + +/* + * This is just to make this appear to be in the Ogg namespace in the + * documentation. The typedef below will make this work with the current code. + * In the next BIC version of TagLib this will be really moved into the Ogg + * namespace. + */ + +#ifdef DOXYGEN + namespace Ogg { +#endif + + //! A namespace containing classes for Vorbis metadata + + namespace Vorbis { + + + //! An implementation of Ogg::File with Vorbis specific methods + + /*! + * This is the central class in the Ogg Vorbis metadata processing collection + * of classes. It's built upon Ogg::File which handles processing of the Ogg + * logical bitstream and breaking it down into pages which are handled by + * the codec implementations, in this case Vorbis specifically. + */ + + class File : public Ogg::File + { + public: + /*! + * Contructs a Vorbis file from \a file. If \a readProperties is true the + * file's audio properties will also be read using \a propertiesStyle. If + * false, \a propertiesStyle is ignored. + */ + File(const char *file, bool readProperties = true, + Properties::ReadStyle propertiesStyle = Properties::Average); + + /*! + * Destroys this instance of the File. + */ + virtual ~File(); + + /*! + * Returns the XiphComment for this file. XiphComment implements the tag + * interface, so this serves as the reimplementation of + * TagLib::File::tag(). + */ + virtual Ogg::XiphComment *tag() const; + + /*! + * Returns the Vorbis::Properties for this file. If no audio properties + * were read then this will return a null pointer. + */ + virtual Properties *audioProperties() const; + + virtual bool save(); + + private: + File(const File &); + File &operator=(const File &); + + void read(bool readProperties, Properties::ReadStyle propertiesStyle); + + class FilePrivate; + FilePrivate *d; + }; + } + +/* + * To keep compatibility with the current version put Vorbis in the Ogg namespace + * only in the docs and provide a typedef to make it work. In the next BIC + * version this will be removed and it will only exist in the Ogg namespace. + */ + +#ifdef DOXYGEN + } +#else + namespace Ogg { namespace Vorbis { typedef TagLib::Vorbis::File File; } } +#endif + +} + +#endif diff --git a/Libraries/TagLib/Files/taglib/ogg/vorbis/vorbisproperties.cpp b/Libraries/TagLib/Files/taglib/ogg/vorbis/vorbisproperties.cpp new file mode 100644 index 000000000..bee7f8d69 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/ogg/vorbis/vorbisproperties.cpp @@ -0,0 +1,179 @@ +/*************************************************************************** + copyright : (C) 2003 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#include +#include + +#include + +#include "vorbisproperties.h" +#include "vorbisfile.h" + +using namespace TagLib; + +class Vorbis::Properties::PropertiesPrivate +{ +public: + PropertiesPrivate(File *f, ReadStyle s) : + file(f), + style(s), + length(0), + bitrate(0), + sampleRate(0), + channels(0), + vorbisVersion(0), + bitrateMaximum(0), + bitrateNominal(0), + bitrateMinimum(0) {} + + File *file; + ReadStyle style; + int length; + int bitrate; + int sampleRate; + int channels; + int vorbisVersion; + int bitrateMaximum; + int bitrateNominal; + int bitrateMinimum; +}; + +namespace TagLib { + /*! + * Vorbis headers can be found with one type ID byte and the string "vorbis" in + * an Ogg stream. 0x01 indicates the setup header. + */ + static const char vorbisSetupHeaderID[] = { 0x01, 'v', 'o', 'r', 'b', 'i', 's', 0 }; +} + +//////////////////////////////////////////////////////////////////////////////// +// public members +//////////////////////////////////////////////////////////////////////////////// + +Vorbis::Properties::Properties(File *file, ReadStyle style) : AudioProperties(style) +{ + d = new PropertiesPrivate(file, style); + read(); +} + +Vorbis::Properties::~Properties() +{ + delete d; +} + +int Vorbis::Properties::length() const +{ + return d->length; +} + +int Vorbis::Properties::bitrate() const +{ + return int(float(d->bitrate) / float(1000) + 0.5); +} + +int Vorbis::Properties::sampleRate() const +{ + return d->sampleRate; +} + +int Vorbis::Properties::channels() const +{ + return d->channels; +} + +int Vorbis::Properties::vorbisVersion() const +{ + return d->vorbisVersion; +} + +int Vorbis::Properties::bitrateMaximum() const +{ + return d->bitrateMaximum; +} + +int Vorbis::Properties::bitrateNominal() const +{ + return d->bitrateNominal; +} + +int Vorbis::Properties::bitrateMinimum() const +{ + return d->bitrateMinimum; +} + +//////////////////////////////////////////////////////////////////////////////// +// private members +//////////////////////////////////////////////////////////////////////////////// + +void Vorbis::Properties::read() +{ + // Get the identification header from the Ogg implementation. + + ByteVector data = d->file->packet(0); + + int pos = 0; + + if(data.mid(pos, 7) != vorbisSetupHeaderID) { + debug("Vorbis::Properties::read() -- invalid Vorbis identification header"); + return; + } + + pos += 7; + + d->vorbisVersion = data.mid(pos, 4).toUInt(false); + pos += 4; + + d->channels = uchar(data[pos]); + pos += 1; + + d->sampleRate = data.mid(pos, 4).toUInt(false); + pos += 4; + + d->bitrateMaximum = data.mid(pos, 4).toUInt(false); + pos += 4; + + d->bitrateNominal = data.mid(pos, 4).toUInt(false); + pos += 4; + + d->bitrateMinimum = data.mid(pos, 4).toUInt(false); + + // TODO: Later this should be only the "fast" mode. + d->bitrate = d->bitrateNominal; + + // Find the length of the file. See http://wiki.xiph.org/VorbisStreamLength/ + // for my notes on the topic. + + const Ogg::PageHeader *first = d->file->firstPageHeader(); + const Ogg::PageHeader *last = d->file->lastPageHeader(); + + if(first && last) { + long long start = first->absoluteGranularPosition(); + long long end = last->absoluteGranularPosition(); + + if(start >= 0 && end >= 0 && d->sampleRate > 0) + d->length = (end - start) / (long long) d->sampleRate; + else + debug("Vorbis::Properties::read() -- Either the PCM values for the start or " + "end of this file was incorrect or the sample rate is zero."); + } + else + debug("Vorbis::Properties::read() -- Could not find valid first and last Ogg pages."); +} diff --git a/Libraries/TagLib/Files/taglib/ogg/vorbis/vorbisproperties.h b/Libraries/TagLib/Files/taglib/ogg/vorbis/vorbisproperties.h new file mode 100644 index 000000000..01dffed94 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/ogg/vorbis/vorbisproperties.h @@ -0,0 +1,120 @@ +/*************************************************************************** + copyright : (C) 2003 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#ifndef TAGLIB_VORBISPROPERTIES_H +#define TAGLIB_VORBISPROPERTIES_H + +#include + +namespace TagLib { + +/* + * This is just to make this appear to be in the Ogg namespace in the + * documentation. The typedef below will make this work with the current code. + * In the next BIC version of TagLib this will be really moved into the Ogg + * namespace. + */ + +#ifdef DOXYGEN + namespace Ogg { +#endif + + namespace Vorbis { + + class File; + + //! An implementation of audio property reading for Ogg Vorbis + + /*! + * This reads the data from an Ogg Vorbis stream found in the AudioProperties + * API. + */ + + class Properties : public AudioProperties + { + public: + /*! + * Create an instance of Vorbis::Properties with the data read from the + * Vorbis::File \a file. + */ + Properties(File *file, ReadStyle style = Average); + + /*! + * Destroys this VorbisProperties instance. + */ + virtual ~Properties(); + + // Reimplementations. + + virtual int length() const; + virtual int bitrate() const; + virtual int sampleRate() const; + virtual int channels() const; + + /*! + * Returns the Vorbis version, currently "0" (as specified by the spec). + */ + int vorbisVersion() const; + + /*! + * Returns the maximum bitrate as read from the Vorbis identification + * header. + */ + int bitrateMaximum() const; + + /*! + * Returns the nominal bitrate as read from the Vorbis identification + * header. + */ + int bitrateNominal() const; + + /*! + * Returns the minimum bitrate as read from the Vorbis identification + * header. + */ + int bitrateMinimum() const; + + private: + Properties(const Properties &); + Properties &operator=(const Properties &); + + void read(); + + class PropertiesPrivate; + PropertiesPrivate *d; + }; + } + +/* + * To keep compatibility with the current version put Vorbis in the Ogg namespace + * only in the docs and provide a typedef to make it work. In the next BIC + * version this will be removed and it will only exist in the Ogg namespace. + */ + +#ifdef DOXYGEN + } +#else + namespace Ogg { namespace Vorbis { typedef TagLib::AudioProperties AudioProperties; } } +#endif + +} + +#endif diff --git a/Libraries/TagLib/Files/taglib/ogg/xiphcomment.cpp b/Libraries/TagLib/Files/taglib/ogg/xiphcomment.cpp new file mode 100644 index 000000000..62c45ec41 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/ogg/xiphcomment.cpp @@ -0,0 +1,293 @@ +/*************************************************************************** + copyright : (C) 2003 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#include +#include + +#include + +using namespace TagLib; + +class Ogg::XiphComment::XiphCommentPrivate +{ +public: + FieldListMap fieldListMap; + String vendorID; +}; + +//////////////////////////////////////////////////////////////////////////////// +// public members +//////////////////////////////////////////////////////////////////////////////// + +Ogg::XiphComment::XiphComment() : TagLib::Tag() +{ + d = new XiphCommentPrivate; +} + +Ogg::XiphComment::XiphComment(const ByteVector &data) : TagLib::Tag() +{ + d = new XiphCommentPrivate; + parse(data); +} + +Ogg::XiphComment::~XiphComment() +{ + delete d; +} + +String Ogg::XiphComment::title() const +{ + if(d->fieldListMap["TITLE"].isEmpty()) + return String::null; + return d->fieldListMap["TITLE"].front(); +} + +String Ogg::XiphComment::artist() const +{ + if(d->fieldListMap["ARTIST"].isEmpty()) + return String::null; + return d->fieldListMap["ARTIST"].front(); +} + +String Ogg::XiphComment::album() const +{ + if(d->fieldListMap["ALBUM"].isEmpty()) + return String::null; + return d->fieldListMap["ALBUM"].front(); +} + +String Ogg::XiphComment::comment() const +{ + if(d->fieldListMap["DESCRIPTION"].isEmpty()) + return String::null; + return d->fieldListMap["DESCRIPTION"].front(); +} + +String Ogg::XiphComment::genre() const +{ + if(d->fieldListMap["GENRE"].isEmpty()) + return String::null; + return d->fieldListMap["GENRE"].front(); +} + +TagLib::uint Ogg::XiphComment::year() const +{ + if(d->fieldListMap["DATE"].isEmpty()) + return 0; + return d->fieldListMap["DATE"].front().toInt(); +} + +TagLib::uint Ogg::XiphComment::track() const +{ + if(d->fieldListMap["TRACKNUMBER"].isEmpty()) + return 0; + return d->fieldListMap["TRACKNUMBER"].front().toInt(); +} + +void Ogg::XiphComment::setTitle(const String &s) +{ + addField("TITLE", s); +} + +void Ogg::XiphComment::setArtist(const String &s) +{ + addField("ARTIST", s); +} + +void Ogg::XiphComment::setAlbum(const String &s) +{ + addField("ALBUM", s); +} + +void Ogg::XiphComment::setComment(const String &s) +{ + addField("DESCRIPTION", s); +} + +void Ogg::XiphComment::setGenre(const String &s) +{ + addField("GENRE", s); +} + +void Ogg::XiphComment::setYear(uint i) +{ + if(i == 0) + removeField("DATE"); + else + addField("DATE", String::number(i)); +} + +void Ogg::XiphComment::setTrack(uint i) +{ + if(i == 0) + removeField("TRACKNUMBER"); + else + addField("TRACKNUMBER", String::number(i)); +} + +bool Ogg::XiphComment::isEmpty() const +{ + FieldListMap::ConstIterator it = d->fieldListMap.begin(); + for(; it != d->fieldListMap.end(); ++it) + if(!(*it).second.isEmpty()) + return false; + + return true; +} + +TagLib::uint Ogg::XiphComment::fieldCount() const +{ + uint count = 0; + + FieldListMap::ConstIterator it = d->fieldListMap.begin(); + for(; it != d->fieldListMap.end(); ++it) + count += (*it).second.size(); + + return count; +} + +const Ogg::FieldListMap &Ogg::XiphComment::fieldListMap() const +{ + return d->fieldListMap; +} + +String Ogg::XiphComment::vendorID() const +{ + return d->vendorID; +} + +void Ogg::XiphComment::addField(const String &key, const String &value, bool replace) +{ + if(replace) + removeField(key.upper()); + + if(!key.isEmpty()) + d->fieldListMap[key.upper()].append(value); +} + +void Ogg::XiphComment::removeField(const String &key, const String &value) +{ + if(!value.isNull()) { + StringList::Iterator it = d->fieldListMap[key].begin(); + for(; it != d->fieldListMap[key].end(); ++it) { + if(value == *it) + d->fieldListMap[key].erase(it); + } + } + else + d->fieldListMap[key].clear(); +} + +ByteVector Ogg::XiphComment::render() const +{ + return render(true); +} + +ByteVector Ogg::XiphComment::render(bool addFramingBit) const +{ + ByteVector data; + + // Add the vendor ID length and the vendor ID. It's important to use the + // lenght of the data(String::UTF8) rather than the lenght of the the string + // since this is UTF8 text and there may be more characters in the data than + // in the UTF16 string. + + ByteVector vendorData = d->vendorID.data(String::UTF8); + + data.append(ByteVector::fromUInt(vendorData.size(), false)); + data.append(vendorData); + + // Add the number of fields. + + data.append(ByteVector::fromUInt(fieldCount(), false)); + + // Iterate over the the field lists. Our iterator returns a + // std::pair where the first String is the field name and + // the StringList is the values associated with that field. + + FieldListMap::ConstIterator it = d->fieldListMap.begin(); + for(; it != d->fieldListMap.end(); ++it) { + + // And now iterate over the values of the current list. + + String fieldName = (*it).first; + StringList values = (*it).second; + + StringList::ConstIterator valuesIt = values.begin(); + for(; valuesIt != values.end(); ++valuesIt) { + ByteVector fieldData = fieldName.data(String::UTF8); + fieldData.append('='); + fieldData.append((*valuesIt).data(String::UTF8)); + + data.append(ByteVector::fromUInt(fieldData.size(), false)); + data.append(fieldData); + } + } + + // Append the "framing bit". + + if(addFramingBit) + data.append(char(1)); + + return data; +} + +//////////////////////////////////////////////////////////////////////////////// +// protected members +//////////////////////////////////////////////////////////////////////////////// + +void Ogg::XiphComment::parse(const ByteVector &data) +{ + // The first thing in the comment data is the vendor ID length, followed by a + // UTF8 string with the vendor ID. + + int pos = 0; + + int vendorLength = data.mid(0, 4).toUInt(false); + pos += 4; + + d->vendorID = String(data.mid(pos, vendorLength), String::UTF8); + pos += vendorLength; + + // Next the number of fields in the comment vector. + + int commentFields = data.mid(pos, 4).toUInt(false); + pos += 4; + + for(int i = 0; i < commentFields; i++) { + + // Each comment field is in the format "KEY=value" in a UTF8 string and has + // 4 bytes before the text starts that gives the length. + + int commentLength = data.mid(pos, 4).toUInt(false); + pos += 4; + + String comment = String(data.mid(pos, commentLength), String::UTF8); + pos += commentLength; + + int commentSeparatorPosition = comment.find("="); + + String key = comment.substr(0, commentSeparatorPosition); + String value = comment.substr(commentSeparatorPosition + 1); + + addField(key, value, false); + } +} diff --git a/Libraries/TagLib/Files/taglib/ogg/xiphcomment.h b/Libraries/TagLib/Files/taglib/ogg/xiphcomment.h new file mode 100644 index 000000000..dbcde9d5e --- /dev/null +++ b/Libraries/TagLib/Files/taglib/ogg/xiphcomment.h @@ -0,0 +1,190 @@ +/*************************************************************************** + copyright : (C) 2003 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#ifndef TAGLIB_VORBISCOMMENT_H +#define TAGLIB_VORBISCOMMENT_H + +#include +#include +#include +#include +#include +#include + +namespace TagLib { + + namespace Ogg { + + /*! + * A mapping between a list of field names, or keys, and a list of values + * associated with that field. + * + * \see XiphComment::fieldListMap() + */ + typedef Map FieldListMap; + + //! Ogg Vorbis comment implementation + + /*! + * This class is an implementation of the Ogg Vorbis comment specification, + * to be found in section 5 of the Ogg Vorbis specification. Because this + * format is also used in other (currently unsupported) Xiph.org formats, it + * has been made part of a generic implementation rather than being limited + * to strictly Vorbis. + * + * Vorbis comments are a simple vector of keys and values, called fields. + * Multiple values for a given key are supported. + * + * \see fieldListMap() + */ + + class XiphComment : public TagLib::Tag + { + public: + /*! + * Constructs an empty Vorbis comment. + */ + XiphComment(); + + /*! + * Constructs a Vorbis comment from \a data. + */ + XiphComment(const ByteVector &data); + + /*! + * Destroys this instance of the XiphComment. + */ + virtual ~XiphComment(); + + virtual String title() const; + virtual String artist() const; + virtual String album() const; + virtual String comment() const; + virtual String genre() const; + virtual uint year() const; + virtual uint track() const; + + virtual void setTitle(const String &s); + virtual void setArtist(const String &s); + virtual void setAlbum(const String &s); + virtual void setComment(const String &s); + virtual void setGenre(const String &s); + virtual void setYear(uint i); + virtual void setTrack(uint i); + + virtual bool isEmpty() const; + + /*! + * Returns the number of fields present in the comment. + */ + uint fieldCount() const; + + /*! + * Returns a reference to the map of field lists. Because Xiph comments + * support multiple fields with the same key, a pure Map would not work. + * As such this is a Map of string lists, keyed on the comment field name. + * + * The standard set of Xiph/Vorbis fields (which may or may not be + * contained in any specific comment) is: + * + *
    + *
  • TITLE
  • + *
  • VERSION
  • + *
  • ALBUM
  • + *
  • ARTIST
  • + *
  • PERFORMER
  • + *
  • COPYRIGHT
  • + *
  • ORGANIZATION
  • + *
  • DESCRIPTION
  • + *
  • GENRE
  • + *
  • DATE
  • + *
  • LOCATION
  • + *
  • CONTACT
  • + *
  • ISRC
  • + *
+ * + * For a more detailed description of these fields, please see the Ogg + * Vorbis specification, section 5.2.2.1. + * + * \note The Ogg Vorbis comment specification does allow these key values + * to be either upper or lower case. However, it is conventional for them + * to be upper case. As such, TagLib, when parsing a Xiph/Vorbis comment, + * converts all fields to uppercase. When you are using this data + * structure, you will need to specify the field name in upper case. + * + * \warning You should not modify this data structure directly, instead + * use addField() and removeField(). + */ + const FieldListMap &fieldListMap() const; + + /*! + * Returns the vendor ID of the Ogg Vorbis encoder. libvorbis 1.0 as the + * most common case always returns "Xiph.Org libVorbis I 20020717". + */ + String vendorID() const; + + /*! + * Add the field specified by \a key with the data \a value. If \a replace + * is true, then all of the other fields with the same key will be removed + * first. + * + * If the field value is empty, the field will be removed. + */ + void addField(const String &key, const String &value, bool replace = true); + + /*! + * Remove the field specified by \a key with the data \a value. If + * \a value is null, all of the fields with the given key will be removed. + */ + void removeField(const String &key, const String &value = String::null); + + /*! + * Renders the comment to a ByteVector suitable for inserting into a file. + */ + ByteVector render() const; // BIC: remove and merge with below + + /*! + * Renders the comment to a ByteVector suitable for inserting into a file. + * + * If \a addFramingBit is true the standard Vorbis comment framing bit will + * be appended. However some formats (notably FLAC) do not work with this + * in place. + */ + ByteVector render(bool addFramingBit) const; + + protected: + /*! + * Reads the tag from the file specified in the constructor and fills the + * FieldListMap. + */ + void parse(const ByteVector &data); + + private: + XiphComment(const XiphComment &); + XiphComment &operator=(const XiphComment &); + + class XiphCommentPrivate; + XiphCommentPrivate *d; + }; + } +} + +#endif diff --git a/Libraries/TagLib/Files/taglib/tag.cpp b/Libraries/TagLib/Files/taglib/tag.cpp new file mode 100644 index 000000000..9ab539b06 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/tag.cpp @@ -0,0 +1,79 @@ +/*************************************************************************** + copyright : (C) 2003 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#include "tag.h" + +using namespace TagLib; + +class Tag::TagPrivate +{ + +}; + +Tag::Tag() +{ + +} + +Tag::~Tag() +{ + +} + +bool Tag::isEmpty() const +{ + return (title().isEmpty() && + artist().isEmpty() && + album().isEmpty() && + comment().isEmpty() && + genre().isEmpty() && + year() == 0 && + track() == 0); +} + +void Tag::duplicate(const Tag *source, Tag *target, bool overwrite) // static +{ + if(overwrite) { + target->setTitle(source->title()); + target->setArtist(source->artist()); + target->setAlbum(source->album()); + target->setComment(source->comment()); + target->setGenre(source->genre()); + target->setYear(source->year()); + target->setTrack(source->track()); + } + else { + if(target->title().isEmpty()) + target->setTitle(source->title()); + if(target->artist().isEmpty()) + target->setArtist(source->artist()); + if(target->album().isEmpty()) + target->setAlbum(source->album()); + if(target->comment().isEmpty()) + target->setComment(source->comment()); + if(target->genre().isEmpty()) + target->setGenre(source->genre()); + if(target->year() <= 0) + target->setYear(source->year()); + if(target->track() <= 0) + target->setTrack(source->track()); + } +} diff --git a/Libraries/TagLib/Files/taglib/tag.h b/Libraries/TagLib/Files/taglib/tag.h new file mode 100644 index 000000000..5c9d5a6d3 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/tag.h @@ -0,0 +1,168 @@ +/*************************************************************************** + copyright : (C) 2003 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#ifndef TAGLIB_TAG_H +#define TAGLIB_TAG_H + +#include + +namespace TagLib { + + //! A simple, generic interface to common audio meta data fields + + /*! + * This is an attempt to abstract away the difference in the meta data formats + * of various audio codecs and tagging schemes. As such it is generally a + * subset of what is available in the specific formats but should be suitable + * for most applications. This is meant to complient the generic APIs found + * in TagLib::AudioProperties, TagLib::File and TagLib::FileRef. + */ + + class Tag + { + public: + + /*! + * Detroys this Tag instance. + */ + virtual ~Tag(); + + /*! + * Returns the track name; if no track name is present in the tag + * String::null will be returned. + */ + virtual String title() const = 0; + + /*! + * Returns the artist name; if no artist name is present in the tag + * String::null will be returned. + */ + virtual String artist() const = 0; + + /*! + * Returns the album name; if no album name is present in the tag + * String::null will be returned. + */ + virtual String album() const = 0; + + /*! + * Returns the track comment; if no comment is present in the tag + * String::null will be returned. + */ + virtual String comment() const = 0; + + /*! + * Returns the genre name; if no genre is present in the tag String::null + * will be returned. + */ + virtual String genre() const = 0; + + /*! + * Returns the year; if there is no year set, this will return 0. + */ + virtual uint year() const = 0; + + /*! + * Returns the track number; if there is no track number set, this will + * return 0. + */ + virtual uint track() const = 0; + + /*! + * Sets the title to \a s. If \a s is String::null then this value will be + * cleared. + */ + virtual void setTitle(const String &s) = 0; + + /*! + * Sets the artist to \a s. If \a s is String::null then this value will be + * cleared. + */ + virtual void setArtist(const String &s) = 0; + + /*! + * Sets the album to \a s. If \a s is String::null then this value will be + * cleared. + */ + virtual void setAlbum(const String &s) = 0; + + /*! + * Sets the album to \a s. If \a s is String::null then this value will be + * cleared. + */ + virtual void setComment(const String &s) = 0; + + /*! + * Sets the genre to \a s. If \a s is String::null then this value will be + * cleared. For tag formats that use a fixed set of genres, the appropriate + * value will be selected based on a string comparison. A list of available + * genres for those formats should be available in that type's + * implementation. + */ + virtual void setGenre(const String &s) = 0; + + /*! + * Sets the year to \a i. If \a s is 0 then this value will be cleared. + */ + virtual void setYear(uint i) = 0; + + /*! + * Sets the track to \a i. If \a s is 0 then this value will be cleared. + */ + virtual void setTrack(uint i) = 0; + + /*! + * Returns true if the tag does not contain any data. This should be + * reimplemented in subclasses that provide more than the basic tagging + * abilities in this class. + */ + virtual bool isEmpty() const; + + /*! + * Copies the generic data from one tag to another. + * + * \note This will no affect any of the lower level details of the tag. For + * instance if any of the tag type specific data (maybe a URL for a band) is + * set, this will not modify or copy that. This just copies using the API + * in this class. + * + * If \a overwrite is true then the values will be unconditionally copied. + * If false only empty values will be overwritten. + */ + static void duplicate(const Tag *source, Tag *target, bool overwrite = true); + + protected: + /*! + * Construct a Tag. This is protected since tags should only be instantiated + * through subclasses. + */ + Tag(); + + private: + Tag(const Tag &); + Tag &operator=(const Tag &); + + class TagPrivate; + TagPrivate *d; + }; +} + +#endif diff --git a/Libraries/TagLib/Files/taglib/taglib-config.in b/Libraries/TagLib/Files/taglib/taglib-config.in new file mode 100644 index 000000000..991abb856 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/taglib-config.in @@ -0,0 +1,55 @@ +#!/bin/sh + +usage() +{ + echo "usage: $0 [OPTIONS]" +cat << EOH + +options: + [--libs] + [--cflags] + [--version] + [--prefix] +EOH + exit 1; +} + +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +flags="" + +if test $# -eq 0 ; then + usage +fi + +while test $# -gt 0 +do + case $1 in + --libs) + flags="$flags -L$libdir -ltag" + ;; + --cflags) + flags="$flags -I$includedir/taglib" + ;; + --version) + echo 1.3.1 + ;; + --prefix) + echo $prefix + ;; + *) + echo "$0: unknown option $1" + echo + usage + ;; + esac + shift +done + +if test -n "$flags" +then + echo $flags +fi diff --git a/Libraries/TagLib/Files/taglib/toolkit/Makefile.am b/Libraries/TagLib/Files/taglib/toolkit/Makefile.am new file mode 100644 index 000000000..287a9e9ad --- /dev/null +++ b/Libraries/TagLib/Files/taglib/toolkit/Makefile.am @@ -0,0 +1,16 @@ +INCLUDES = $(all_includes) + +noinst_LTLIBRARIES = libtoolkit.la + +libtoolkit_la_SOURCES = \ + tstring.cpp tstringlist.cpp tbytevector.cpp \ + tbytevectorlist.cpp tfile.cpp tdebug.cpp unicode.cpp + +taglib_include_HEADERS = \ + taglib.h tstring.h tlist.h tlist.tcc tstringlist.h \ + tbytevector.h tbytevectorlist.h tfile.h tdebug.h \ + tmap.h tmap.tcc + +taglib_includedir = $(includedir)/taglib + +EXTRA_DIST = $(libtoolkit_la_SOURCES) $(taglib_include_HEADERS) diff --git a/Libraries/TagLib/Files/taglib/toolkit/Makefile.in b/Libraries/TagLib/Files/taglib/toolkit/Makefile.in new file mode 100644 index 000000000..c3c89018a --- /dev/null +++ b/Libraries/TagLib/Files/taglib/toolkit/Makefile.in @@ -0,0 +1,572 @@ +# Makefile.in generated by automake 1.7.6 from Makefile.am. +# KDE tags expanded automatically by am_edit - $Revision$ +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../.. + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTODIRS = @AUTODIRS@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CONF_FILES = @CONF_FILES@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +KDE_PLUGIN = @KDE_PLUGIN@ +KDE_USE_CLOSURE_FALSE = @KDE_USE_CLOSURE_FALSE@ +KDE_USE_CLOSURE_TRUE = @KDE_USE_CLOSURE_TRUE@ +KDE_USE_FINAL_FALSE = @KDE_USE_FINAL_FALSE@ +KDE_USE_FINAL_TRUE = @KDE_USE_FINAL_TRUE@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +NOOPT_CFLAGS = @NOOPT_CFLAGS@ +NOOPT_CXXFLAGS = @NOOPT_CXXFLAGS@ +NOREPO = @NOREPO@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +REPO = @REPO@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +TOPSUBDIRS = @TOPSUBDIRS@ +USE_EXCEPTIONS = @USE_EXCEPTIONS@ +USE_RTTI = @USE_RTTI@ +VERSION = @VERSION@ +WOVERLOADED_VIRTUAL = @WOVERLOADED_VIRTUAL@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +all_includes = @all_includes@ +all_libraries = @all_libraries@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +link_zlib_FALSE = @link_zlib_FALSE@ +link_zlib_TRUE = @link_zlib_TRUE@ +localstatedir = @localstatedir@ +mandir = @mandir@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +INCLUDES = $(all_includes) + +noinst_LTLIBRARIES = libtoolkit.la + +libtoolkit_la_SOURCES = \ + tstring.cpp tstringlist.cpp tbytevector.cpp \ + tbytevectorlist.cpp tfile.cpp tdebug.cpp unicode.cpp + + +taglib_include_HEADERS = \ + taglib.h tstring.h tlist.h tlist.tcc tstringlist.h \ + tbytevector.h tbytevectorlist.h tfile.h tdebug.h \ + tmap.h tmap.tcc + + +taglib_includedir = $(includedir)/taglib + +EXTRA_DIST = $(libtoolkit_la_SOURCES) $(taglib_include_HEADERS) +subdir = taglib/toolkit +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/admin/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) + +libtoolkit_la_LDFLAGS = +libtoolkit_la_LIBADD = +am_libtoolkit_la_OBJECTS = tstring.lo tstringlist.lo tbytevector.lo \ + tbytevectorlist.lo tfile.lo tdebug.lo unicode.lo +#>- libtoolkit_la_OBJECTS = $(am_libtoolkit_la_OBJECTS) +#>+ 5 +libtoolkit_la_final_OBJECTS = libtoolkit_la.all_cpp.lo +libtoolkit_la_nofinal_OBJECTS = tstring.lo tstringlist.lo tbytevector.lo \ + tbytevectorlist.lo tfile.lo tdebug.lo unicode.lo +@KDE_USE_FINAL_FALSE@libtoolkit_la_OBJECTS = $(libtoolkit_la_nofinal_OBJECTS) +@KDE_USE_FINAL_TRUE@libtoolkit_la_OBJECTS = $(libtoolkit_la_final_OBJECTS) + +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/admin/depcomp +am__depfiles_maybe = depfiles +#>- @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/tbytevector.Plo \ +#>- @AMDEP_TRUE@ ./$(DEPDIR)/tbytevectorlist.Plo \ +#>- @AMDEP_TRUE@ ./$(DEPDIR)/tdebug.Plo ./$(DEPDIR)/tfile.Plo \ +#>- @AMDEP_TRUE@ ./$(DEPDIR)/tstring.Plo ./$(DEPDIR)/tstringlist.Plo \ +#>- @AMDEP_TRUE@ ./$(DEPDIR)/unicode.Plo +#>+ 11 +@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@DEP_FILES = $(DEPDIR)/libtoolkit_la.all_cpp.P ./$(DEPDIR)/tbytevector.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@ @AMDEP_TRUE@ ./$(DEPDIR)/tbytevectorlist.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@ @AMDEP_TRUE@ ./$(DEPDIR)/tdebug.Plo ./$(DEPDIR)/tfile.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@ @AMDEP_TRUE@ ./$(DEPDIR)/tstring.Plo ./$(DEPDIR)/tstringlist.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@ @AMDEP_TRUE@ ./$(DEPDIR)/unicode.Plo +@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@DEP_FILES = ./$(DEPDIR)/tbytevector.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@ @AMDEP_TRUE@ ./$(DEPDIR)/tbytevectorlist.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@ @AMDEP_TRUE@ ./$(DEPDIR)/tdebug.Plo ./$(DEPDIR)/tfile.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@ @AMDEP_TRUE@ ./$(DEPDIR)/tstring.Plo ./$(DEPDIR)/tstringlist.Plo \ +@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@ @AMDEP_TRUE@ ./$(DEPDIR)/unicode.Plo + +#>- CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ +#>- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +#>+ 2 +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(KDE_CXXFLAGS) +#>- LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) \ +#>- $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ +#>- $(AM_CXXFLAGS) $(CXXFLAGS) +#>+ 3 +LTCXXCOMPILE = $(LIBTOOL) --mode=compile --tag=CXX $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) $(KDE_CXXFLAGS) +CXXLD = $(CXX) +#>- CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \ +#>- $(AM_LDFLAGS) $(LDFLAGS) -o $@ +#>+ 2 +CXXLINK = $(LIBTOOL) --mode=link --tag=CXX $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(KDE_CXXFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +DIST_SOURCES = $(libtoolkit_la_SOURCES) +HEADERS = $(taglib_include_HEADERS) + +DIST_COMMON = $(taglib_include_HEADERS) Makefile.am Makefile.in +SOURCES = $(libtoolkit_la_SOURCES) + +#>- all: all-am +#>+ 1 +all: docs-am all-am + +.SUFFIXES: +.SUFFIXES: .cpp .lo .o .obj +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) +#>- cd $(top_srcdir) && \ +#>- $(AUTOMAKE) --gnu taglib/toolkit/Makefile +#>+ 3 + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu taglib/toolkit/Makefile + cd $(top_srcdir) && perl admin/am_edit taglib/toolkit/Makefile.in +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" = "$$p" && dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libtoolkit.la: $(libtoolkit_la_OBJECTS) $(libtoolkit_la_DEPENDENCIES) + $(CXXLINK) $(libtoolkit_la_LDFLAGS) $(libtoolkit_la_OBJECTS) $(libtoolkit_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) core *.core + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tbytevector.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tbytevectorlist.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tdebug.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tfile.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tstring.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tstringlist.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unicode.Plo@am__quote@ + +distclean-depend: + -rm -rf ./$(DEPDIR) + +.cpp.o: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + +.cpp.obj: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` + +.cpp.lo: +@am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \ +@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCXX_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: +taglib_includeHEADERS_INSTALL = $(INSTALL_HEADER) +install-taglib_includeHEADERS: $(taglib_include_HEADERS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(taglib_includedir) + @list='$(taglib_include_HEADERS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(taglib_includeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(taglib_includedir)/$$f"; \ + $(taglib_includeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(taglib_includedir)/$$f; \ + done + +uninstall-taglib_includeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(taglib_include_HEADERS)'; for p in $$list; do \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " rm -f $(DESTDIR)$(taglib_includedir)/$$f"; \ + rm -f $(DESTDIR)$(taglib_includedir)/$$f; \ + done + +ETAGS = etags +ETAGSFLAGS = + +CTAGS = ctags +CTAGSFLAGS = + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique + +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +#>- DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +#>+ 4 +KDE_DIST=unicode.h + +DISTFILES= $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) $(KDE_DIST) + + +top_distdir = ../.. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) + +installdirs: + $(mkinstalldirs) $(DESTDIR)$(taglib_includedir) +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +#>- clean: clean-am +#>+ 1 +clean: kde-rpo-clean clean-am + +#>- clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ +#>- mostlyclean-am +#>+ 2 +clean-am: clean-final clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + +distclean-am: clean-am distclean-compile distclean-depend \ + distclean-generic distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: install-taglib_includeHEADERS + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am uninstall-taglib_includeHEADERS + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstLTLIBRARIES ctags distclean \ + distclean-compile distclean-depend distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am info \ + info-am install install-am install-data install-data-am \ + install-exec install-exec-am install-info install-info-am \ + install-man install-strip install-taglib_includeHEADERS \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-info-am \ + uninstall-taglib_includeHEADERS + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: + +#>+ 2 +docs-am: + +#>+ 6 +force-reedit: + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu taglib/toolkit/Makefile + cd $(top_srcdir) && perl admin/am_edit taglib/toolkit/Makefile.in + + +#>+ 11 +libtoolkit_la.all_cpp.cpp: $(srcdir)/Makefile.in $(srcdir)/tstring.cpp $(srcdir)/tstringlist.cpp $(srcdir)/tbytevector.cpp $(srcdir)/tbytevectorlist.cpp $(srcdir)/tfile.cpp $(srcdir)/tdebug.cpp $(srcdir)/unicode.cpp + @echo 'creating libtoolkit_la.all_cpp.cpp ...'; \ + rm -f libtoolkit_la.all_cpp.files libtoolkit_la.all_cpp.final; \ + echo "#define KDE_USE_FINAL 1" >> libtoolkit_la.all_cpp.final; \ + for file in tstring.cpp tstringlist.cpp tbytevector.cpp tbytevectorlist.cpp tfile.cpp tdebug.cpp unicode.cpp ; do \ + echo "#include \"$$file\"" >> libtoolkit_la.all_cpp.files; \ + test ! -f $(srcdir)/$$file || egrep '^#pragma +implementation' $(srcdir)/$$file >> libtoolkit_la.all_cpp.final; \ + done; \ + cat libtoolkit_la.all_cpp.final libtoolkit_la.all_cpp.files > libtoolkit_la.all_cpp.cpp; \ + rm -f libtoolkit_la.all_cpp.final libtoolkit_la.all_cpp.files + +#>+ 3 +clean-final: + -rm -f libtoolkit_la.all_cpp.cpp + +#>+ 2 +final: + $(MAKE) libtoolkit_la_OBJECTS="$(libtoolkit_la_final_OBJECTS)" all-am +#>+ 2 +final-install: + $(MAKE) libtoolkit_la_OBJECTS="$(libtoolkit_la_final_OBJECTS)" install-am +#>+ 2 +no-final: + $(MAKE) libtoolkit_la_OBJECTS="$(libtoolkit_la_nofinal_OBJECTS)" all-am +#>+ 2 +no-final-install: + $(MAKE) libtoolkit_la_OBJECTS="$(libtoolkit_la_nofinal_OBJECTS)" install-am +#>+ 3 +cvs-clean: + $(MAKE) admindir=$(top_srcdir)/admin -f $(top_srcdir)/admin/Makefile.common cvs-clean + +#>+ 3 +kde-rpo-clean: + -rm -f *.rpo diff --git a/Libraries/TagLib/Files/taglib/toolkit/taglib.h b/Libraries/TagLib/Files/taglib/toolkit/taglib.h new file mode 100644 index 000000000..a32407ecb --- /dev/null +++ b/Libraries/TagLib/Files/taglib/toolkit/taglib.h @@ -0,0 +1,155 @@ +/*************************************************************************** + copyright : (C) 2002 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#ifndef TAGLIB_H +#define TAGLIB_H + +#define TAGLIB_MAJOR_VERSION 1 +#define TAGLIB_MINOR_VERSION 3 +#define TAGLIB_PATCH_VERSION 1 + +#include + +//! A namespace for all TagLib related classes and functions + +/*! + * This namespace contains everything in TagLib. For projects working with + * TagLib extensively it may be conveniten to add a + * \code + * using namespace TagLib; + * \endcode + */ + +namespace TagLib { + + class String; + + typedef wchar_t wchar; + typedef unsigned char uchar; + typedef unsigned int uint; + typedef unsigned long ulong; + + /*! + * Unfortunately std::wstring isn't defined on some systems, (i.e. GCC < 3) + * so I'm providing something here that should be constant. + */ + typedef std::basic_string wstring; + +#ifndef DO_NOT_DOCUMENT // Tell Doxygen to skip this class. + /*! + * \internal + * This is just used as a base class for shared classes in TagLib. + * + * \warning This is not part of the TagLib public API! + */ + + class RefCounter + { + public: + RefCounter() : refCount(1) {} + void ref() { refCount++; } + bool deref() { return ! --refCount ; } + int count() { return refCount; } + private: + uint refCount; + }; + +#endif // DO_NOT_DOCUMENT + +} + +/*! + * \mainpage TagLib + * \section intro Introduction + * TagLib, is well, a library for reading and editing audio meta data, commonly know as \e tags. + * + * Some goals of TagLib: + * - A clean, high level, C++ API to handling audio meta data. + * - Support for at least ID3v1, ID3v2 and Ogg Vorbis \e comments. + * - A generic, \e simple API for the most common tagging related functions. + * - Binary compatibility between minor releases using the standard KDE/Qt techniques for C++ binary compatibility. + * - Make the tagging framework extensible by library users; i.e. it will be possible for libarary users to implement + * additional ID3v2 frames, without modifying the TagLib source (through the use of Abstract Factories and + * such. + * + * Because TagLib desires to be toolkit agnostic, in hope of being widely adopted and the most flexible in licensing + * TagLib provides many of its own toolkit classes; in fact the only external dependancy that TagLib has, it a + * semi-sane STL implementation. + * + * \section why Why TagLib? + * + * TagLib was written to fill a gap in the Open Source/Free Software community. Currently there is a lack in the + * OSS/FS for a homogenous API to the most common music types. + * + * As TagLib will be initially injected into the KDE community, while I am not linking to any of the KDE or Qt libraries + * I have tried to follow the coding style of those libraries. Again, this is in sharp contrast to id3lib, which + * basically provides a hybrid C/C++ API and uses a dubious object model. + * + * I get asked rather frequently why I am replacing id3lib (mostly by people that have never worked with id3lib), if + * you are concerned about this please email me; I can provide my lengthy standard rant. :-) + * + * \section examples Examples: + * + * I've talked a lot about the \e homogenous API to common music formats. Here's an example of how things (will) work: + * + * \code + * + * TagLib::FileRef f("Latex Solar Beef.mp3"); + * TagLib::String artist = f.tag()->artist(); // artist == "Frank Zappa" + * + * f.tag()->setAlbum("Fillmore East"); + * f.save(); + * + * TagLib::FileRef g("Free City Rhymes.ogg"); + * TagLib::String album = g.tag()->album(); // album == "NYC Ghosts & Flowers" + * + * g.tag()->setTrack(1); + * g.save(); + * + * \endcode + * + * Note that these high level functions work for Ogg, FLAC, MPC \e and MP3 (or any other formats supported in the + * future). For this high level API, which is suitable for most applications, the differences between tag and file + * formats can all be ignored. + * + * \section Building + * + * TagLib provides a script called taglib-config that returns the necessary compiler and linker flags, as well as the + * version number. To build a small sample program one would use: + * + * g++ taglib-test.cpp `taglib-config --cflags --libs` -o taglib-test + * + * This should generally be integrated into the configure check for TagLib in your project. + * + * \note TagLib includes assume that you have the TagLib include path specified in the compile line, by default + * -I/usr/local/include/taglib. Using #include will not work. (Though this + * is usually handled by the taglib-config script mentioned above.) + * + * \section Contact + * + * - TagLib Homepage + * - TagLib Mailing List (taglib-devel@kde.org) + * + * \author Scott Wheeler + * + */ + +#endif diff --git a/Libraries/TagLib/Files/taglib/toolkit/tbytevector.cpp b/Libraries/TagLib/Files/taglib/toolkit/tbytevector.cpp new file mode 100644 index 000000000..de4ca6f9f --- /dev/null +++ b/Libraries/TagLib/Files/taglib/toolkit/tbytevector.cpp @@ -0,0 +1,627 @@ +/*************************************************************************** + copyright : (C) 2002 - 2004 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#include + +#include +#include + +#include "tbytevector.h" + +// This is a bit ugly to keep writing over and over again. + +// A rather obscure feature of the C++ spec that I hadn't thought of that makes +// working with C libs much more effecient. There's more here: +// +// http://www.informit.com/isapi/product_id~{9C84DAB4-FE6E-49C5-BB0A-FB50331233EA}/content/index.asp + +#define DATA(x) (&(x->data[0])) + +namespace TagLib { + static const uint crcTable[256] = { + 0x00000000, 0x04c11db7, 0x09823b6e, 0x0d4326d9, 0x130476dc, 0x17c56b6b, + 0x1a864db2, 0x1e475005, 0x2608edb8, 0x22c9f00f, 0x2f8ad6d6, 0x2b4bcb61, + 0x350c9b64, 0x31cd86d3, 0x3c8ea00a, 0x384fbdbd, 0x4c11db70, 0x48d0c6c7, + 0x4593e01e, 0x4152fda9, 0x5f15adac, 0x5bd4b01b, 0x569796c2, 0x52568b75, + 0x6a1936c8, 0x6ed82b7f, 0x639b0da6, 0x675a1011, 0x791d4014, 0x7ddc5da3, + 0x709f7b7a, 0x745e66cd, 0x9823b6e0, 0x9ce2ab57, 0x91a18d8e, 0x95609039, + 0x8b27c03c, 0x8fe6dd8b, 0x82a5fb52, 0x8664e6e5, 0xbe2b5b58, 0xbaea46ef, + 0xb7a96036, 0xb3687d81, 0xad2f2d84, 0xa9ee3033, 0xa4ad16ea, 0xa06c0b5d, + 0xd4326d90, 0xd0f37027, 0xddb056fe, 0xd9714b49, 0xc7361b4c, 0xc3f706fb, + 0xceb42022, 0xca753d95, 0xf23a8028, 0xf6fb9d9f, 0xfbb8bb46, 0xff79a6f1, + 0xe13ef6f4, 0xe5ffeb43, 0xe8bccd9a, 0xec7dd02d, 0x34867077, 0x30476dc0, + 0x3d044b19, 0x39c556ae, 0x278206ab, 0x23431b1c, 0x2e003dc5, 0x2ac12072, + 0x128e9dcf, 0x164f8078, 0x1b0ca6a1, 0x1fcdbb16, 0x018aeb13, 0x054bf6a4, + 0x0808d07d, 0x0cc9cdca, 0x7897ab07, 0x7c56b6b0, 0x71159069, 0x75d48dde, + 0x6b93dddb, 0x6f52c06c, 0x6211e6b5, 0x66d0fb02, 0x5e9f46bf, 0x5a5e5b08, + 0x571d7dd1, 0x53dc6066, 0x4d9b3063, 0x495a2dd4, 0x44190b0d, 0x40d816ba, + 0xaca5c697, 0xa864db20, 0xa527fdf9, 0xa1e6e04e, 0xbfa1b04b, 0xbb60adfc, + 0xb6238b25, 0xb2e29692, 0x8aad2b2f, 0x8e6c3698, 0x832f1041, 0x87ee0df6, + 0x99a95df3, 0x9d684044, 0x902b669d, 0x94ea7b2a, 0xe0b41de7, 0xe4750050, + 0xe9362689, 0xedf73b3e, 0xf3b06b3b, 0xf771768c, 0xfa325055, 0xfef34de2, + 0xc6bcf05f, 0xc27dede8, 0xcf3ecb31, 0xcbffd686, 0xd5b88683, 0xd1799b34, + 0xdc3abded, 0xd8fba05a, 0x690ce0ee, 0x6dcdfd59, 0x608edb80, 0x644fc637, + 0x7a089632, 0x7ec98b85, 0x738aad5c, 0x774bb0eb, 0x4f040d56, 0x4bc510e1, + 0x46863638, 0x42472b8f, 0x5c007b8a, 0x58c1663d, 0x558240e4, 0x51435d53, + 0x251d3b9e, 0x21dc2629, 0x2c9f00f0, 0x285e1d47, 0x36194d42, 0x32d850f5, + 0x3f9b762c, 0x3b5a6b9b, 0x0315d626, 0x07d4cb91, 0x0a97ed48, 0x0e56f0ff, + 0x1011a0fa, 0x14d0bd4d, 0x19939b94, 0x1d528623, 0xf12f560e, 0xf5ee4bb9, + 0xf8ad6d60, 0xfc6c70d7, 0xe22b20d2, 0xe6ea3d65, 0xeba91bbc, 0xef68060b, + 0xd727bbb6, 0xd3e6a601, 0xdea580d8, 0xda649d6f, 0xc423cd6a, 0xc0e2d0dd, + 0xcda1f604, 0xc960ebb3, 0xbd3e8d7e, 0xb9ff90c9, 0xb4bcb610, 0xb07daba7, + 0xae3afba2, 0xaafbe615, 0xa7b8c0cc, 0xa379dd7b, 0x9b3660c6, 0x9ff77d71, + 0x92b45ba8, 0x9675461f, 0x8832161a, 0x8cf30bad, 0x81b02d74, 0x857130c3, + 0x5d8a9099, 0x594b8d2e, 0x5408abf7, 0x50c9b640, 0x4e8ee645, 0x4a4ffbf2, + 0x470cdd2b, 0x43cdc09c, 0x7b827d21, 0x7f436096, 0x7200464f, 0x76c15bf8, + 0x68860bfd, 0x6c47164a, 0x61043093, 0x65c52d24, 0x119b4be9, 0x155a565e, + 0x18197087, 0x1cd86d30, 0x029f3d35, 0x065e2082, 0x0b1d065b, 0x0fdc1bec, + 0x3793a651, 0x3352bbe6, 0x3e119d3f, 0x3ad08088, 0x2497d08d, 0x2056cd3a, + 0x2d15ebe3, 0x29d4f654, 0xc5a92679, 0xc1683bce, 0xcc2b1d17, 0xc8ea00a0, + 0xd6ad50a5, 0xd26c4d12, 0xdf2f6bcb, 0xdbee767c, 0xe3a1cbc1, 0xe760d676, + 0xea23f0af, 0xeee2ed18, 0xf0a5bd1d, 0xf464a0aa, 0xf9278673, 0xfde69bc4, + 0x89b8fd09, 0x8d79e0be, 0x803ac667, 0x84fbdbd0, 0x9abc8bd5, 0x9e7d9662, + 0x933eb0bb, 0x97ffad0c, 0xafb010b1, 0xab710d06, 0xa6322bdf, 0xa2f33668, + 0xbcb4666d, 0xb8757bda, 0xb5365d03, 0xb1f740b4 + }; + + /*! + * A templatized find that works both with a ByteVector and a ByteVectorMirror. + */ + + template + int vectorFind(const Vector &v, const Vector &pattern, uint offset, int byteAlign) + { + if(pattern.size() > v.size() || offset >= v.size() - 1) + return -1; + + // if an offset was specified, just do a recursive call on the substring + + if(offset > 0) { + + // start at the next byte aligned block + + Vector section = v.mid(offset + byteAlign - 1 - offset % byteAlign); + int match = section.find(pattern, 0, byteAlign); + return match >= 0 ? int(match + offset) : -1; + } + + // this is a simplified Boyer-Moore string searching algorithm + + uchar lastOccurrence[256]; + + + for(uint i = 0; i < 256; ++i) + lastOccurrence[i] = uchar(pattern.size()); + + for(uint i = 0; i < pattern.size() - 1; ++i) + lastOccurrence[unsigned(pattern[i])] = uchar(pattern.size() - i - 1); + + for(uint i = pattern.size() - 1; i < v.size(); i += lastOccurrence[uchar(v.at(i))]) { + int iBuffer = i; + int iPattern = pattern.size() - 1; + + while(iPattern >= 0 && v.at(iBuffer) == pattern[iPattern]) { + --iBuffer; + --iPattern; + } + + if(-1 == iPattern && (iBuffer + 1) % byteAlign == 0) + return iBuffer + 1; + } + + return -1; + } + + /*! + * Wraps the accessors to a ByteVector to make the search algorithm access the + * elements in reverse. + * + * \see vectorFind() + * \see ByteVector::rfind() + */ + + class ByteVectorMirror + { + public: + ByteVectorMirror(const ByteVector &source) : v(source) {} + const char operator[](int index) const + { + return v[v.size() - index - 1]; + } + + const char at(int index) const + { + return v.at(v.size() - index - 1); + } + + ByteVectorMirror mid(uint index, uint length = 0xffffffff) const + { + return length == 0xffffffff ? v.mid(0, index) : v.mid(index - length, length); + } + + uint size() const + { + return v.size(); + } + + int find(const ByteVectorMirror &pattern, uint offset = 0, int byteAlign = 1) const + { + ByteVectorMirror v(*this); + + const int pos = vectorFind(v, pattern, offset, byteAlign); + + // If the offset is zero then we need to adjust the location in the search + // to be appropriately reversed. If not we need to account for the fact + // that the recursive call (called from the above line) has already ajusted + // for this but that the normal templatized find above will add the offset + // to the returned value. + // + // This is a little confusing at first if you don't first stop to think + // through the logic involved in the forward search. + + if(pos == -1) + return -1; + + if(offset == 0) + return size() - pos - pattern.size(); + else + return pos - offset; + } + + private: + const ByteVector v; + }; + + template + T toNumber(const std::vector &data, bool mostSignificantByteFirst) + { + T sum = 0; + + if(data.size() <= 0) { + debug("ByteVectorMirror::toNumber() -- data is empty, returning 0"); + return sum; + } + + uint size = sizeof(T); + uint last = data.size() > size ? size - 1 : data.size() - 1; + + for(uint i = 0; i <= last; i++) + sum |= (T) uchar(data[i]) << ((mostSignificantByteFirst ? last - i : i) * 8); + + return sum; + } + + template + ByteVector fromNumber(T value, bool mostSignificantByteFirst) + { + int size = sizeof(T); + + ByteVector v(size, 0); + + for(int i = 0; i < size; i++) + v[i] = uchar(value >> ((mostSignificantByteFirst ? size - 1 - i : i) * 8) & 0xff); + + return v; + } +} + +using namespace TagLib; + +class ByteVector::ByteVectorPrivate : public RefCounter +{ +public: + ByteVectorPrivate() : RefCounter(), size(0) {} + ByteVectorPrivate(const std::vector &v) : RefCounter(), data(v), size(v.size()) {} + ByteVectorPrivate(TagLib::uint len, char value) : RefCounter(), data(len, value), size(len) {} + + std::vector data; + + // std::vector::size() is very slow, so we'll cache the value + + uint size; +}; + +//////////////////////////////////////////////////////////////////////////////// +// static members +//////////////////////////////////////////////////////////////////////////////// + +ByteVector ByteVector::null; + +ByteVector ByteVector::fromCString(const char *s, uint length) +{ + ByteVector v; + + if(length == 0xffffffff) + v.setData(s); + else + v.setData(s, length); + + return v; +} + +ByteVector ByteVector::fromUInt(uint value, bool mostSignificantByteFirst) +{ + return fromNumber(value, mostSignificantByteFirst); +} + +ByteVector ByteVector::fromShort(short value, bool mostSignificantByteFirst) +{ + return fromNumber(value, mostSignificantByteFirst); +} + +ByteVector ByteVector::fromLongLong(long long value, bool mostSignificantByteFirst) +{ + return fromNumber(value, mostSignificantByteFirst); +} + +//////////////////////////////////////////////////////////////////////////////// +// public members +//////////////////////////////////////////////////////////////////////////////// + +ByteVector::ByteVector() +{ + d = new ByteVectorPrivate; +} + +ByteVector::ByteVector(uint size, char value) +{ + d = new ByteVectorPrivate(size, value); +} + +ByteVector::ByteVector(const ByteVector &v) : d(v.d) +{ + d->ref(); +} + +ByteVector::ByteVector(char c) +{ + d = new ByteVectorPrivate; + d->data.push_back(c); + d->size = 1; +} + +ByteVector::ByteVector(const char *data, uint length) +{ + d = new ByteVectorPrivate; + setData(data, length); +} + +ByteVector::ByteVector(const char *data) +{ + d = new ByteVectorPrivate; + setData(data); +} + +ByteVector::~ByteVector() +{ + if(d->deref()) + delete d; +} + +void ByteVector::setData(const char *data, uint length) +{ + detach(); + + resize(length); + ::memcpy(DATA(d), data, length); +} + +void ByteVector::setData(const char *data) +{ + setData(data, ::strlen(data)); +} + +char *ByteVector::data() +{ + detach(); + return DATA(d); +} + +const char *ByteVector::data() const +{ + return DATA(d); +} + +ByteVector ByteVector::mid(uint index, uint length) const +{ + ByteVector v; + + ConstIterator endIt; + + if(length < 0xffffffff && length + index < size()) + endIt = d->data.begin() + index + length; + else + endIt = d->data.end(); + + v.d->data.insert(v.d->data.begin(), ConstIterator(d->data.begin() + index), endIt); + v.d->size = v.d->data.size(); + + return v; +} + +char ByteVector::at(uint index) const +{ + return index < size() ? d->data[index] : 0; +} + +int ByteVector::find(const ByteVector &pattern, uint offset, int byteAlign) const +{ + return vectorFind(*this, pattern, offset, byteAlign); +} + +int ByteVector::rfind(const ByteVector &pattern, uint offset, int byteAlign) const +{ + // Ok, this is a little goofy, but pretty cool after it sinks in. Instead of + // reversing the find method's Boyer-Moore search algorithm I created a "mirror" + // for a ByteVector to reverse the behavior of the accessors. + + ByteVectorMirror v(*this); + ByteVectorMirror p(pattern); + + return v.find(p, offset, byteAlign); +} + +bool ByteVector::containsAt(const ByteVector &pattern, uint offset, uint patternOffset, uint patternLength) const +{ + if(pattern.size() < patternLength) + patternLength = pattern.size(); + + // do some sanity checking -- all of these things are needed for the search to be valid + + if(patternLength > size() || offset >= size() || patternOffset >= pattern.size() || patternLength == 0) + return false; + + // loop through looking for a mismatch + + for(uint i = 0; i < patternLength - patternOffset; i++) { + if(at(i + offset) != pattern[i + patternOffset]) + return false; + } + + return true; +} + +bool ByteVector::startsWith(const ByteVector &pattern) const +{ + return containsAt(pattern, 0); +} + +bool ByteVector::endsWith(const ByteVector &pattern) const +{ + return containsAt(pattern, size() - pattern.size()); +} + +int ByteVector::endsWithPartialMatch(const ByteVector &pattern) const +{ + if(pattern.size() > size()) + return -1; + + const int startIndex = size() - pattern.size(); + + // try to match the last n-1 bytes from the vector (where n is the pattern + // size) -- continue trying to match n-2, n-3...1 bytes + + for(uint i = 1; i < pattern.size(); i++) { + if(containsAt(pattern, startIndex + i, 0, pattern.size() - i)) + return startIndex + i; + } + + return -1; +} + +void ByteVector::append(const ByteVector &v) +{ + detach(); + + uint originalSize = d->size; + resize(d->size + v.d->size); + ::memcpy(DATA(d) + originalSize, DATA(v.d), v.size()); +} + +void ByteVector::clear() +{ + detach(); + d->data.clear(); +} + +TagLib::uint ByteVector::size() const +{ + return d->size; +} + +ByteVector &ByteVector::resize(uint size, char padding) +{ + if(d->size < size) { + d->data.reserve(size); + d->data.insert(d->data.end(), size - d->size, padding); + } + else + d->data.erase(d->data.begin() + size, d->data.end()); + + d->size = size; + + return *this; +} + +ByteVector::Iterator ByteVector::begin() +{ + return d->data.begin(); +} + +ByteVector::ConstIterator ByteVector::begin() const +{ + return d->data.begin(); +} + +ByteVector::Iterator ByteVector::end() +{ + return d->data.end(); +} + +ByteVector::ConstIterator ByteVector::end() const +{ + return d->data.end(); +} + +bool ByteVector::isNull() const +{ + return d == null.d; +} + +bool ByteVector::isEmpty() const +{ + return d->data.size() == 0; +} + +TagLib::uint ByteVector::checksum() const +{ + uint sum = 0; + for(ByteVector::ConstIterator it = begin(); it != end(); ++it) + sum = (sum << 8) ^ crcTable[((sum >> 24) & 0xff) ^ uchar(*it)]; + return sum; +} + +TagLib::uint ByteVector::toUInt(bool mostSignificantByteFirst) const +{ + return toNumber(d->data, mostSignificantByteFirst); +} + +short ByteVector::toShort(bool mostSignificantByteFirst) const +{ + return toNumber(d->data, mostSignificantByteFirst); +} + +long long ByteVector::toLongLong(bool mostSignificantByteFirst) const +{ + return toNumber(d->data, mostSignificantByteFirst); +} + +const char &ByteVector::operator[](int index) const +{ + return d->data[index]; +} + +char &ByteVector::operator[](int index) +{ + detach(); + + return d->data[index]; +} + +bool ByteVector::operator==(const ByteVector &v) const +{ + if(d->size != v.d->size) + return false; + + return ::memcmp(data(), v.data(), size()) == 0; +} + +bool ByteVector::operator!=(const ByteVector &v) const +{ + return !operator==(v); +} + +bool ByteVector::operator==(const char *s) const +{ + if(d->size != ::strlen(s)) + return false; + + return ::memcmp(data(), s, d->size) == 0; +} + +bool ByteVector::operator!=(const char *s) const +{ + return !operator==(s); +} + +bool ByteVector::operator<(const ByteVector &v) const +{ + int result = ::memcmp(data(), v.data(), d->size < v.d->size ? d->size : v.d->size); + + if(result != 0) + return result < 0; + else + return size() < v.size(); +} + +bool ByteVector::operator>(const ByteVector &v) const +{ + return v < *this; +} + +ByteVector ByteVector::operator+(const ByteVector &v) const +{ + ByteVector sum(*this); + sum.append(v); + return sum; +} + +ByteVector &ByteVector::operator=(const ByteVector &v) +{ + if(&v == this) + return *this; + + if(d->deref()) + delete d; + + d = v.d; + d->ref(); + return *this; +} + +ByteVector &ByteVector::operator=(char c) +{ + if(d->deref()) + delete d; + *this = ByteVector(c); + return *this; +} + +ByteVector &ByteVector::operator=(const char *data) +{ + if(d->deref()) + delete d; + *this = ByteVector(data); + return *this; +} + +//////////////////////////////////////////////////////////////////////////////// +// protected members +//////////////////////////////////////////////////////////////////////////////// + +void ByteVector::detach() +{ + if(d->count() > 1) { + d->deref(); + d = new ByteVectorPrivate(d->data); + } +} + +//////////////////////////////////////////////////////////////////////////////// +// related functions +//////////////////////////////////////////////////////////////////////////////// + +std::ostream &operator<<(std::ostream &s, const ByteVector &v) +{ + for(TagLib::uint i = 0; i < v.size(); i++) + s << v[i]; + return s; +} diff --git a/Libraries/TagLib/Files/taglib/toolkit/tbytevector.h b/Libraries/TagLib/Files/taglib/toolkit/tbytevector.h new file mode 100644 index 000000000..b7d88f41e --- /dev/null +++ b/Libraries/TagLib/Files/taglib/toolkit/tbytevector.h @@ -0,0 +1,397 @@ +/*************************************************************************** + copyright : (C) 2002 - 2004 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#ifndef TAGLIB_BYTEVECTOR_H +#define TAGLIB_BYTEVECTOR_H + +#include "taglib.h" + +#include + +namespace TagLib { + + //! A byte vector + + /*! + * This class provides a byte vector with some methods that are useful for + * tagging purposes. Many of the search functions are tailored to what is + * useful for finding tag related paterns in a data array. + */ + + class ByteVector + { + public: +#ifndef DO_NOT_DOCUMENT + typedef std::vector::iterator Iterator; + typedef std::vector::const_iterator ConstIterator; +#endif + + /*! + * Constructs an empty byte vector. + */ + ByteVector(); + + /*! + * Construct a vector of size \a size with all values set to \a value by + * default. + */ + ByteVector(uint size, char value = 0); + + /*! + * Contructs a byte vector that is a copy of \a v. + */ + ByteVector(const ByteVector &v); + + /*! + * Contructs a byte vector that contains \a c. + */ + ByteVector(char c); + + /*! + * Constructs a byte vector that copies \a data for up to \a length bytes. + */ + ByteVector(const char *data, uint length); + + /*! + * Constructs a byte vector that copies \a data up to the first null + * byte. The behavior is undefined if \a data is not null terminated. + * This is particularly useful for constructing byte arrays from string + * constants. + */ + ByteVector(const char *data); + + /*! + * Destroys this ByteVector instance. + */ + virtual ~ByteVector(); + + /*! + * Sets the data for the byte array using the first \a length bytes of \a data + */ + void setData(const char *data, uint length); + + /*! + * Sets the data for the byte array copies \a data up to the first null + * byte. The behavior is undefined if \a data is not null terminated. + */ + void setData(const char *data); + + /*! + * Returns a pointer to the internal data structure. + * + * \warning Care should be taken when modifying this data structure as it is + * easy to corrupt the ByteVector when doing so. Specifically, while the + * data may be changed, its length may not be. + */ + char *data(); + + /*! + * Returns a pointer to the internal data structure which may not be modified. + */ + const char *data() const; + + /*! + * Returns a byte vector made up of the bytes starting at \a index and + * for \a length bytes. If \a length is not specified it will return the bytes + * from \a index to the end of the vector. + */ + ByteVector mid(uint index, uint length = 0xffffffff) const; + + /*! + * This essentially performs the same as operator[](), but instead of causing + * a runtime error if the index is out of bounds, it will return a null byte. + */ + char at(uint index) const; + + /*! + * Searches the ByteVector for \a pattern starting at \a offset and returns + * the offset. Returns -1 if the pattern was not found. If \a byteAlign is + * specified the pattern will only be matched if it starts on a byteDivisible + * by \a byteAlign. + */ + int find(const ByteVector &pattern, uint offset = 0, int byteAlign = 1) const; + + /*! + * Searches the ByteVector for \a pattern starting from either the end of the + * vector or \a offset and returns the offset. Returns -1 if the pattern was + * not found. If \a byteAlign is specified the pattern will only be matched + * if it starts on a byteDivisible by \a byteAlign. + */ + int rfind(const ByteVector &pattern, uint offset = 0, int byteAlign = 1) const; + + /*! + * Checks to see if the vector contains the \a pattern starting at position + * \a offset. Optionally, if you only want to search for part of the pattern + * you can specify an offset within the pattern to start from. Also, you can + * specify to only check for the first \a patternLength bytes of \a pattern with + * the \a patternLength argument. + */ + bool containsAt(const ByteVector &pattern, uint offset, uint patternOffset = 0, uint patternLength = 0xffffffff) const; + + /*! + * Returns true if the vector starts with \a pattern. + */ + bool startsWith(const ByteVector &pattern) const; + + /*! + * Returns true if the vector ends with \a pattern. + */ + bool endsWith(const ByteVector &pattern) const; + + /*! + * Checks for a partial match of \a pattern at the end of the vector. It + * returns the offset of the partial match within the vector, or -1 if the + * pattern is not found. This method is particularly useful when searching for + * patterns that start in one vector and end in another. When combined with + * startsWith() it can be used to find a pattern that overlaps two buffers. + * + * \note This will not match the complete pattern at the end of the string; use + * endsWith() for that. + */ + int endsWithPartialMatch(const ByteVector &pattern) const; + + /*! + * Appends \a v to the end of the ByteVector. + */ + void append(const ByteVector &v); + + /*! + * Clears the data. + */ + void clear(); + + /*! + * Returns the size of the array. + */ + uint size() const; + + /*! + * Resize the vector to \a size. If the vector is currently less than + * \a size, pad the remaining spaces with \a padding. Returns a reference + * to the resized vector. + */ + ByteVector &resize(uint size, char padding = 0); + + /*! + * Returns an Iterator that points to the front of the vector. + */ + Iterator begin(); + + /*! + * Returns a ConstIterator that points to the front of the vector. + */ + ConstIterator begin() const; + + /*! + * Returns an Iterator that points to the back of the vector. + */ + Iterator end(); + + /*! + * Returns a ConstIterator that points to the back of the vector. + */ + ConstIterator end() const; + + /*! + * Returns true if the vector is null. + * + * \note A vector may be empty without being null. + * \see isEmpty() + */ + bool isNull() const; + + /*! + * Returns true if the ByteVector is empty. + * + * \see size() + * \see isNull() + */ + bool isEmpty() const; + + /*! + * Returns a CRC checksum of the byte vector's data. + */ + uint checksum() const; + + /*! + * Converts the first 4 bytes of the vector to an unsigned integer. + * + * If \a mostSignificantByteFirst is true this will operate left to right + * evaluating the integer. For example if \a mostSignificantByteFirst is + * true then $00 $00 $00 $01 == 0x00000001 == 1, if false, $01 00 00 00 == + * 0x01000000 == 1. + * + * \see fromUInt() + */ + uint toUInt(bool mostSignificantByteFirst = true) const; + + /*! + * Converts the first 2 bytes of the vector to a short. + * + * If \a mostSignificantByteFirst is true this will operate left to right + * evaluating the integer. For example if \a mostSignificantByteFirst is + * true then $00 $01 == 0x0001 == 1, if false, $01 00 == 0x01000000 == 1. + * + * \see fromShort() + */ + short toShort(bool mostSignificantByteFirst = true) const; + + /*! + * Converts the first 8 bytes of the vector to a (signed) long long. + * + * If \a mostSignificantByteFirst is true this will operate left to right + * evaluating the integer. For example if \a mostSignificantByteFirst is + * true then $00 00 00 00 00 00 00 01 == 0x0000000000000001 == 1, + * if false, $01 00 00 00 00 00 00 00 == 0x0100000000000000 == 1. + * + * \see fromUInt() + */ + long long toLongLong(bool mostSignificantByteFirst = true) const; + + /*! + * Creates a 4 byte ByteVector based on \a value. If + * \a mostSignificantByteFirst is true, then this will operate left to right + * in building the ByteVector. For example if \a mostSignificantByteFirst is + * true then $00 00 00 01 == 0x00000001 == 1, if false, $01 00 00 00 == + * 0x01000000 == 1. + * + * \see toUInt() + */ + static ByteVector fromUInt(uint value, bool mostSignificantByteFirst = true); + + /*! + * Creates a 2 byte ByteVector based on \a value. If + * \a mostSignificantByteFirst is true, then this will operate left to right + * in building the ByteVector. For example if \a mostSignificantByteFirst is + * true then $00 01 == 0x0001 == 1, if false, $01 00 == 0x0100 == 1. + * + * \see toShort() + */ + static ByteVector fromShort(short value, bool mostSignificantByteFirst = true); + + /*! + * Creates a 8 byte ByteVector based on \a value. If + * \a mostSignificantByteFirst is true, then this will operate left to right + * in building the ByteVector. For example if \a mostSignificantByteFirst is + * true then $00 00 00 01 == 0x0000000000000001 == 1, if false, + * $01 00 00 00 00 00 00 00 == 0x0100000000000000 == 1. + * + * \see toLongLong() + */ + static ByteVector fromLongLong(long long value, bool mostSignificantByteFirst = true); + + /*! + * Returns a ByteVector based on the CString \a s. + */ + static ByteVector fromCString(const char *s, uint length = 0xffffffff); + + /*! + * Returns a const refernence to the byte at \a index. + */ + const char &operator[](int index) const; + + /*! + * Returns a reference to the byte at \a index. + */ + char &operator[](int index); + + /*! + * Returns true if this ByteVector and \a v are equal. + */ + bool operator==(const ByteVector &v) const; + + /*! + * Returns true if this ByteVector and \a v are not equal. + */ + bool operator!=(const ByteVector &v) const; + + /*! + * Returns true if this ByteVector and the null terminated C string \a s + * contain the same data. + */ + bool operator==(const char *s) const; + + /*! + * Returns true if this ByteVector and the null terminated C string \a s + * do not contain the same data. + */ + bool operator!=(const char *s) const; + + /*! + * Returns true if this ByteVector is less than \a v. The value of the + * vectors is determined by evaluating the character from left to right, and + * in the event one vector is a superset of the other, the size is used. + */ + bool operator<(const ByteVector &v) const; + + /*! + * Returns true if this ByteVector is greater than \a v. + */ + bool operator>(const ByteVector &v) const; + + /*! + * Returns a vector that is \a v appended to this vector. + */ + ByteVector operator+(const ByteVector &v) const; + + /*! + * Copies ByteVector \a v. + */ + ByteVector &operator=(const ByteVector &v); + + /*! + * Copies ByteVector \a v. + */ + ByteVector &operator=(char c); + + /*! + * Copies ByteVector \a v. + */ + ByteVector &operator=(const char *data); + + /*! + * A static, empty ByteVector which is convenient and fast (since returning + * an empty or "null" value does not require instantiating a new ByteVector). + */ + static ByteVector null; + + protected: + /* + * If this ByteVector is being shared via implicit sharing, do a deep copy + * of the data and separate from the shared members. This should be called + * by all non-const subclass members. + */ + void detach(); + + private: + class ByteVectorPrivate; + ByteVectorPrivate *d; + }; + +} + +/*! + * \relates TagLib::ByteVector + * Streams the ByteVector \a v to the output stream \a s. + */ +std::ostream &operator<<(std::ostream &s, const TagLib::ByteVector &v); + +#endif diff --git a/Libraries/TagLib/Files/taglib/toolkit/tbytevectorlist.cpp b/Libraries/TagLib/Files/taglib/toolkit/tbytevectorlist.cpp new file mode 100644 index 000000000..3799f5e7a --- /dev/null +++ b/Libraries/TagLib/Files/taglib/toolkit/tbytevectorlist.cpp @@ -0,0 +1,88 @@ +/*************************************************************************** + copyright : (C) 2002, 2003 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#include "tbytevectorlist.h" + +using namespace TagLib; + +class ByteVectorListPrivate +{ + +}; + +//////////////////////////////////////////////////////////////////////////////// +// static members +//////////////////////////////////////////////////////////////////////////////// + +ByteVectorList ByteVectorList::split(const ByteVector &v, const ByteVector &pattern, + int byteAlign) +{ + ByteVectorList l; + + uint previousOffset = 0; + for(int offset = v.find(pattern, 0, byteAlign); + offset != -1; + offset = v.find(pattern, offset + pattern.size(), byteAlign)) + { + l.append(v.mid(previousOffset, offset - previousOffset)); + previousOffset = offset + pattern.size(); + } + + if(previousOffset < v.size()) + l.append(v.mid(previousOffset, v.size() - previousOffset)); + + return l; +} + +//////////////////////////////////////////////////////////////////////////////// +// public members +//////////////////////////////////////////////////////////////////////////////// + +ByteVectorList::ByteVectorList() : List() +{ + +} + +ByteVectorList::ByteVectorList(const ByteVectorList &l) : List(l) +{ + +} + +ByteVectorList::~ByteVectorList() +{ + +} + +ByteVector ByteVectorList::toByteVector(const ByteVector &separator) const +{ + ByteVector v; + + ConstIterator it = begin(); + + while(it != end()) { + v.append(*it); + it++; + if(it != end()) + v.append(separator); + } + + return v; +} diff --git a/Libraries/TagLib/Files/taglib/toolkit/tbytevectorlist.h b/Libraries/TagLib/Files/taglib/toolkit/tbytevectorlist.h new file mode 100644 index 000000000..ab5e2d625 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/toolkit/tbytevectorlist.h @@ -0,0 +1,77 @@ +/*************************************************************************** + copyright : (C) 2002, 2003 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#ifndef TAGLIB_BYTEVECTORLIST_H +#define TAGLIB_BYTEVECTORLIST_H + +#include "tbytevector.h" +#include "tlist.h" + +namespace TagLib { + + //! A list of ByteVectors + + /*! + * A List specialization with some handy features useful for ByteVectors. + */ + + class ByteVectorList : public List + { + public: + + /*! + * Construct an empty ByteVectorList. + */ + ByteVectorList(); + + /*! + * Destroys this ByteVectorList instance. + */ + virtual ~ByteVectorList(); + + /*! + * Make a shallow, implicitly shared, copy of \a l. Because this is + * implicitly shared, this method is lightweight and suitable for + * pass-by-value usage. + */ + ByteVectorList(const ByteVectorList &l); + + /*! + * Convert the ByteVectorList to a ByteVector separated by \a separator. By + * default a space is used. + */ + ByteVector toByteVector(const ByteVector &separator = " ") const; + + /*! + * Splits the ByteVector \a v into several strings at \a pattern. This will + * not include the pattern in the returned ByteVectors. + */ + static ByteVectorList split(const ByteVector &v, const ByteVector &pattern, + int byteAlign = 1); + + private: + class ByteVectorListPrivate; + ByteVectorListPrivate *d; + }; + +} + +#endif diff --git a/Libraries/TagLib/Files/taglib/toolkit/tdebug.cpp b/Libraries/TagLib/Files/taglib/toolkit/tdebug.cpp new file mode 100644 index 000000000..4b3b40e8a --- /dev/null +++ b/Libraries/TagLib/Files/taglib/toolkit/tdebug.cpp @@ -0,0 +1,51 @@ +/*************************************************************************** + copyright : (C) 2002, 2003 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#include +#include + +#include "tdebug.h" +#include "tstring.h" + +using namespace TagLib; + +#ifndef NDEBUG +void TagLib::debug(const String &s) +{ + std::cerr << "TagLib: " << s << std::endl; +} + +void TagLib::debugData(const ByteVector &v) +{ + for(uint i = 0; i < v.size(); i++) { + + std::cout << "*** [" << i << "] - '" << char(v[i]) << "' - int " << int(v[i]) + << std::endl; + + std::bitset<8> b(v[i]); + + for(int j = 0; j < 8; j++) + std::cout << i << ":" << j << " " << b.test(j) << std::endl; + + std::cout << std::endl; + } +} +#endif diff --git a/Libraries/TagLib/Files/taglib/toolkit/tdebug.h b/Libraries/TagLib/Files/taglib/toolkit/tdebug.h new file mode 100644 index 000000000..fe7838ae0 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/toolkit/tdebug.h @@ -0,0 +1,67 @@ +/*************************************************************************** + copyright : (C) 2002, 2003 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#ifndef TAGLIB_DEBUG_H +#define TAGLIB_DEBUG_H + +namespace TagLib { + + class String; + class ByteVector; + +#ifndef DO_NOT_DOCUMENT +#ifndef NDEBUG + + /*! + * A simple function that prints debugging output to cerr if debugging is + * not disabled. + * + * \warning Do not use this outside of TagLib, it could lead to undefined + * symbols in your build if TagLib is built with NDEBUG defined and your + * application is not. + * + * \internal + */ + void debug(const String &s); + + /*! + * For debugging binary data. + * + * \warning Do not use this outside of TagLib, it could lead to undefined + * symbols in your build if TagLib is built with NDEBUG defined and your + * application is not. + * + * \internal + */ + void debugData(const ByteVector &v); + +#else + + // Define these to an empty statement if debugging is disabled. + +#define debug(x) +#define debugData(x) + +#endif +#endif +} + +#endif diff --git a/Libraries/TagLib/Files/taglib/toolkit/tfile.cpp b/Libraries/TagLib/Files/taglib/toolkit/tfile.cpp new file mode 100644 index 000000000..7994efdd5 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/toolkit/tfile.cpp @@ -0,0 +1,484 @@ +/*************************************************************************** + copyright : (C) 2002, 2003 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#include "tfile.h" +#include "tstring.h" +#include "tdebug.h" + +#include +#include +#include + +using namespace TagLib; + +class File::FilePrivate +{ +public: + FilePrivate(const char *fileName) : + file(0), + name(fileName), + readOnly(true), + valid(true) + {} + + ~FilePrivate() + { + free((void *)name); + } + + FILE *file; + const char *name; + bool readOnly; + bool valid; + static const uint bufferSize = 1024; +}; + +//////////////////////////////////////////////////////////////////////////////// +// public members +//////////////////////////////////////////////////////////////////////////////// + +File::File(const char *file) +{ + d = new FilePrivate(::strdup(file)); + + d->readOnly = !isWritable(file); + d->file = fopen(file, d->readOnly ? "r" : "r+"); + + if(!d->file) + debug("Could not open file " + String(file)); +} + +File::~File() +{ + if(d->file) + fclose(d->file); + delete d; +} + +const char *File::name() const +{ + return d->name; +} + +ByteVector File::readBlock(ulong length) +{ + if(!d->file) { + debug("File::readBlock() -- Invalid File"); + return ByteVector::null; + } + + ByteVector v(static_cast(length)); + const int count = fread(v.data(), sizeof(char), length, d->file); + v.resize(count); + return v; +} + +void File::writeBlock(const ByteVector &data) +{ + if(!d->file) + return; + + if(d->readOnly) { + debug("File::writeBlock() -- attempted to write to a file that is not writable"); + return; + } + + fwrite(data.data(), sizeof(char), data.size(), d->file); +} + +long File::find(const ByteVector &pattern, long fromOffset, const ByteVector &before) +{ + if(!d->file || pattern.size() > d->bufferSize) + return -1; + + // The position in the file that the current buffer starts at. + + long bufferOffset = fromOffset; + ByteVector buffer; + + // These variables are used to keep track of a partial match that happens at + // the end of a buffer. + + int previousPartialMatch = -1; + int beforePreviousPartialMatch = -1; + + // Save the location of the current read pointer. We will restore the + // position using seek() before all returns. + + long originalPosition = tell(); + + // Start the search at the offset. + + seek(fromOffset); + + // This loop is the crux of the find method. There are three cases that we + // want to account for: + // + // (1) The previously searched buffer contained a partial match of the search + // pattern and we want to see if the next one starts with the remainder of + // that pattern. + // + // (2) The search pattern is wholly contained within the current buffer. + // + // (3) The current buffer ends with a partial match of the pattern. We will + // note this for use in the next itteration, where we will check for the rest + // of the pattern. + // + // All three of these are done in two steps. First we check for the pattern + // and do things appropriately if a match (or partial match) is found. We + // then check for "before". The order is important because it gives priority + // to "real" matches. + + for(buffer = readBlock(d->bufferSize); buffer.size() > 0; buffer = readBlock(d->bufferSize)) { + + // (1) previous partial match + + if(previousPartialMatch >= 0 && int(d->bufferSize) > previousPartialMatch) { + const int patternOffset = (d->bufferSize - previousPartialMatch); + if(buffer.containsAt(pattern, 0, patternOffset)) { + seek(originalPosition); + return bufferOffset - d->bufferSize + previousPartialMatch; + } + } + + if(!before.isNull() && beforePreviousPartialMatch >= 0 && int(d->bufferSize) > beforePreviousPartialMatch) { + const int beforeOffset = (d->bufferSize - beforePreviousPartialMatch); + if(buffer.containsAt(before, 0, beforeOffset)) { + seek(originalPosition); + return -1; + } + } + + // (2) pattern contained in current buffer + + long location = buffer.find(pattern); + if(location >= 0) { + seek(originalPosition); + return bufferOffset + location; + } + + if(!before.isNull() && buffer.find(before) >= 0) { + seek(originalPosition); + return -1; + } + + // (3) partial match + + previousPartialMatch = buffer.endsWithPartialMatch(pattern); + + if(!before.isNull()) + beforePreviousPartialMatch = buffer.endsWithPartialMatch(before); + + bufferOffset += d->bufferSize; + } + + // Since we hit the end of the file, reset the status before continuing. + + clear(); + + seek(originalPosition); + + return -1; +} + + +long File::rfind(const ByteVector &pattern, long fromOffset, const ByteVector &before) +{ + if(!d->file || pattern.size() > d->bufferSize) + return -1; + + // The position in the file that the current buffer starts at. + + ByteVector buffer; + + // These variables are used to keep track of a partial match that happens at + // the end of a buffer. + + /* + int previousPartialMatch = -1; + int beforePreviousPartialMatch = -1; + */ + + // Save the location of the current read pointer. We will restore the + // position using seek() before all returns. + + long originalPosition = tell(); + + // Start the search at the offset. + + long bufferOffset; + if(fromOffset == 0) { + seek(-1 * int(d->bufferSize), End); + bufferOffset = tell(); + } + else { + seek(fromOffset + -1 * int(d->bufferSize), Beginning); + bufferOffset = tell(); + } + + // See the notes in find() for an explanation of this algorithm. + + for(buffer = readBlock(d->bufferSize); buffer.size() > 0; buffer = readBlock(d->bufferSize)) { + + // TODO: (1) previous partial match + + // (2) pattern contained in current buffer + + long location = buffer.rfind(pattern); + if(location >= 0) { + seek(originalPosition); + return bufferOffset + location; + } + + if(!before.isNull() && buffer.find(before) >= 0) { + seek(originalPosition); + return -1; + } + + // TODO: (3) partial match + + bufferOffset -= d->bufferSize; + seek(bufferOffset); + } + + // Since we hit the end of the file, reset the status before continuing. + + clear(); + + seek(originalPosition); + + return -1; +} + +void File::insert(const ByteVector &data, ulong start, ulong replace) +{ + if(!d->file) + return; + + if(data.size() == replace) { + seek(start); + writeBlock(data); + return; + } + else if(data.size() < replace) { + seek(start); + writeBlock(data); + removeBlock(start + data.size(), replace - data.size()); + return; + } + + // Woohoo! Faster (about 20%) than id3lib at last. I had to get hardcore + // and avoid TagLib's high level API for rendering just copying parts of + // the file that don't contain tag data. + // + // Now I'll explain the steps in this ugliness: + + // First, make sure that we're working with a buffer that is longer than + // the *differnce* in the tag sizes. We want to avoid overwriting parts + // that aren't yet in memory, so this is necessary. + + ulong bufferLength = bufferSize(); + while(data.size() - replace > bufferLength) + bufferLength += bufferSize(); + + // Set where to start the reading and writing. + + long readPosition = start + replace; + long writePosition = start; + + ByteVector buffer; + ByteVector aboutToOverwrite(static_cast(bufferLength)); + + // This is basically a special case of the loop below. Here we're just + // doing the same steps as below, but since we aren't using the same buffer + // size -- instead we're using the tag size -- this has to be handled as a + // special case. We're also using File::writeBlock() just for the tag. + // That's a bit slower than using char *'s so, we're only doing it here. + + seek(readPosition); + int bytesRead = fread(aboutToOverwrite.data(), sizeof(char), bufferLength, d->file); + readPosition += bufferLength; + + seek(writePosition); + writeBlock(data); + writePosition += data.size(); + + buffer = aboutToOverwrite; + + // Ok, here's the main loop. We want to loop until the read fails, which + // means that we hit the end of the file. + + while(bytesRead != 0) { + + // Seek to the current read position and read the data that we're about + // to overwrite. Appropriately increment the readPosition. + + seek(readPosition); + bytesRead = fread(aboutToOverwrite.data(), sizeof(char), bufferLength, d->file); + aboutToOverwrite.resize(bytesRead); + readPosition += bufferLength; + + // Check to see if we just read the last block. We need to call clear() + // if we did so that the last write succeeds. + + if(ulong(bytesRead) < bufferLength) + clear(); + + // Seek to the write position and write our buffer. Increment the + // writePosition. + + seek(writePosition); + fwrite(buffer.data(), sizeof(char), bufferLength, d->file); + writePosition += bufferLength; + + // Make the current buffer the data that we read in the beginning. + + buffer = aboutToOverwrite; + + // Again, we need this for the last write. We don't want to write garbage + // at the end of our file, so we need to set the buffer size to the amount + // that we actually read. + + bufferLength = bytesRead; + } +} + +void File::removeBlock(ulong start, ulong length) +{ + if(!d->file) + return; + + ulong bufferLength = bufferSize(); + + long readPosition = start + length; + long writePosition = start; + + ByteVector buffer(static_cast(bufferLength)); + + ulong bytesRead = true; + + while(bytesRead != 0) { + seek(readPosition); + bytesRead = fread(buffer.data(), sizeof(char), bufferLength, d->file); + buffer.resize(bytesRead); + readPosition += bytesRead; + + // Check to see if we just read the last block. We need to call clear() + // if we did so that the last write succeeds. + + if(bytesRead < bufferLength) + clear(); + + seek(writePosition); + fwrite(buffer.data(), sizeof(char), bytesRead, d->file); + writePosition += bytesRead; + } + truncate(writePosition); +} + +bool File::readOnly() const +{ + return d->readOnly; +} + +bool File::isReadable(const char *file) +{ + return access(file, R_OK) == 0; +} + +bool File::isOpen() const +{ + return d->file; +} + +bool File::isValid() const +{ + return d->file && d->valid; +} + +void File::seek(long offset, Position p) +{ + if(!d->file) { + debug("File::seek() -- trying to seek in a file that isn't opened."); + return; + } + + switch(p) { + case Beginning: + fseek(d->file, offset, SEEK_SET); + break; + case Current: + fseek(d->file, offset, SEEK_CUR); + break; + case End: + fseek(d->file, offset, SEEK_END); + break; + } +} + +void File::clear() +{ + clearerr(d->file); +} + +long File::tell() const +{ + return ftell(d->file); +} + +long File::length() +{ + if(!d->file) + return 0; + + long curpos = tell(); + + seek(0, End); + long endpos = tell(); + + seek(curpos, Beginning); + + return endpos; +} + +bool File::isWritable(const char *file) +{ + return access(file, W_OK) == 0; +} + +//////////////////////////////////////////////////////////////////////////////// +// protected members +//////////////////////////////////////////////////////////////////////////////// + +void File::setValid(bool valid) +{ + d->valid = valid; +} + +void File::truncate(long length) +{ + ftruncate(fileno(d->file), length); +} + +TagLib::uint File::bufferSize() +{ + return FilePrivate::bufferSize; +} diff --git a/Libraries/TagLib/Files/taglib/toolkit/tfile.h b/Libraries/TagLib/Files/taglib/toolkit/tfile.h new file mode 100644 index 000000000..bde30d200 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/toolkit/tfile.h @@ -0,0 +1,240 @@ +/*************************************************************************** + copyright : (C) 2002, 2003 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#ifndef TAGLIB_FILE_H +#define TAGLIB_FILE_H + +#include "taglib.h" +#include "tbytevector.h" + +namespace TagLib { + + class String; + class Tag; + class AudioProperties; + + //! A file class with some useful methods for tag manipulation + + /*! + * This class is a basic file class with some methods that are particularly + * useful for tag editors. It has methods to take advantage of + * ByteVector and a binary search method for finding patterns in a file. + */ + + class File + { + public: + /*! + * Position in the file used for seeking. + */ + enum Position { + //! Seek from the beginning of the file. + Beginning, + //! Seek from the current position in the file. + Current, + //! Seek from the end of the file. + End + }; + + /*! + * Destroys this File instance. + */ + virtual ~File(); + + /*! + * Returns the file name in the local file system encoding. + */ + const char *name() const; + + /*! + * Returns a pointer to this file's tag. This should be reimplemented in + * the concrete subclasses. + */ + virtual Tag *tag() const = 0; + + /*! + * Returns a pointer to this file's audio properties. This should be + * reimplemented in the concrete subclasses. If no audio properties were + * read then this will return a null pointer. + */ + virtual AudioProperties *audioProperties() const = 0; + + /*! + * Save the file and its associated tags. This should be reimplemented in + * the concrete subclasses. Returns true if the save succeeds. + */ + virtual bool save() = 0; + + /*! + * Reads a block of size \a length at the current get pointer. + */ + ByteVector readBlock(ulong length); + + /*! + * Attempts to write the block \a data at the current get pointer. If the + * file is currently only opened read only -- i.e. readOnly() returns true -- + * this attempts to reopen the file in read/write mode. + * + * \note This should be used instead of using the streaming output operator + * for a ByteVector. And even this function is significantly slower than + * doing output with a char[]. + */ + void writeBlock(const ByteVector &data); + + /*! + * Returns the offset in the file that \a pattern occurs at or -1 if it can + * not be found. If \a before is set, the search will only continue until the + * pattern \a before is found. This is useful for tagging purposes to search + * for a tag before the synch frame. + * + * Searching starts at \a fromOffset, which defaults to the beginning of the + * file. + * + * \note This has the practial limitation that \a pattern can not be longer + * than the buffer size used by readBlock(). Currently this is 1024 bytes. + */ + long find(const ByteVector &pattern, + long fromOffset = 0, + const ByteVector &before = ByteVector::null); + + /*! + * Returns the offset in the file that \a pattern occurs at or -1 if it can + * not be found. If \a before is set, the search will only continue until the + * pattern \a before is found. This is useful for tagging purposes to search + * for a tag before the synch frame. + * + * Searching starts at \a fromOffset and proceeds from the that point to the + * beginning of the file and defaults to the end of the file. + * + * \note This has the practial limitation that \a pattern can not be longer + * than the buffer size used by readBlock(). Currently this is 1024 bytes. + */ + long rfind(const ByteVector &pattern, + long fromOffset = 0, + const ByteVector &before = ByteVector::null); + + /*! + * Insert \a data at position \a start in the file overwriting \a replace + * bytes of the original content. + * + * \note This method is slow since it requires rewriting all of the file + * after the insertion point. + */ + void insert(const ByteVector &data, ulong start = 0, ulong replace = 0); + + /*! + * Removes a block of the file starting a \a start and continuing for + * \a length bytes. + * + * \note This method is slow since it involves rewriting all of the file + * after the removed portion. + */ + void removeBlock(ulong start = 0, ulong length = 0); + + /*! + * Returns true if the file is read only (or if the file can not be opened). + */ + bool readOnly() const; + + /*! + * Since the file can currently only be opened as an argument to the + * constructor (sort-of by design), this returns if that open succeeded. + */ + bool isOpen() const; + + /*! + * Returns true if the file is open and readble and valid information for + * the Tag and / or AudioProperties was found. + */ + bool isValid() const; + + /*! + * Move the I/O pointer to \a offset in the file from position \a p. This + * defaults to seeking from the beginning of the file. + * + * \see Position + */ + void seek(long offset, Position p = Beginning); + + /*! + * Reset the end-of-file and error flags on the file. + */ + void clear(); + + /*! + * Returns the current offset withing the file. + */ + long tell() const; + + /*! + * Returns the length of the file. + */ + long length(); + + /*! + * Returns true if \a file can be opened for reading. If the file does not + * exist, this will return false. + */ + static bool isReadable(const char *file); + + /*! + * Returns true if \a file can be opened for writing. + */ + static bool isWritable(const char *name); + + protected: + /*! + * Construct a File object and opens the \a file. \a file should be a + * be a C-string in the local file system encoding. + * + * \note Constructor is protected since this class should only be + * instantiated through subclasses. + */ + File(const char *file); + + /*! + * Marks the file as valid or invalid. + * + * \see isValid() + */ + void setValid(bool valid); + + /*! + * Truncates the file to a \a length. + */ + void truncate(long length); + + /*! + * Returns the buffer size that is used for internal buffering. + */ + static uint bufferSize(); + + private: + File(const File &); + File &operator=(const File &); + + class FilePrivate; + FilePrivate *d; + }; + +} + +#endif diff --git a/Libraries/TagLib/Files/taglib/toolkit/tlist.h b/Libraries/TagLib/Files/taglib/toolkit/tlist.h new file mode 100644 index 000000000..3ea7a669e --- /dev/null +++ b/Libraries/TagLib/Files/taglib/toolkit/tlist.h @@ -0,0 +1,236 @@ +/*************************************************************************** + copyright : (C) 2002 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#ifndef TAGLIB_LIST_H +#define TAGLIB_LIST_H + +#include "taglib.h" + +#include + +namespace TagLib { + + //! A generic, implicitly shared list. + + /*! + * This is basic generic list that's somewhere between a std::list and a + * QValueList. This class is implicitly shared. For example: + * + * \code + * + * TagLib::List l = someOtherIntList; + * + * \endcode + * + * The above example is very cheap. This also makes lists suitable for the + * return types of functions. The above example will just copy a pointer rather + * than copying the data in the list. When your \e shared list's data changes, + * only \e then will the data be copied. + */ + + template class List + { + public: +#ifndef DO_NOT_DOCUMENT + typedef typename std::list::iterator Iterator; + typedef typename std::list::const_iterator ConstIterator; +#endif + + /*! + * Constructs an empty list. + */ + List(); + + /*! + * Make a shallow, implicitly shared, copy of \a l. Because this is + * implicitly shared, this method is lightweight and suitable for + * pass-by-value usage. + */ + List(const List &l); + + /*! + * Destroys this List instance. If auto deletion is enabled and this list + * contains a pointer type all of the memebers are also deleted. + */ + virtual ~List(); + + /*! + * Returns an STL style iterator to the beginning of the list. See + * std::list::const_iterator for the semantics. + */ + Iterator begin(); + + /*! + * Returns an STL style constant iterator to the beginning of the list. See + * std::list::iterator for the semantics. + */ + ConstIterator begin() const; + + /*! + * Returns an STL style iterator to the end of the list. See + * std::list::iterator for the semantics. + */ + Iterator end(); + + /*! + * Returns an STL style constant iterator to the end of the list. See + * std::list::const_iterator for the semantics. + */ + ConstIterator end() const; + + /*! + * Inserts a copy of \a value before \a it. + */ + void insert(Iterator it, const T &value); + + /*! + * Inserts the \a value into the list. This assumes that the list is + * currently sorted. If \a unique is true then the value will not + * be inserted if it is already in the list. + */ + void sortedInsert(const T &value, bool unique = false); + + /*! + * Appends \a item to the end of the list and returns a reference to the + * list. + */ + List &append(const T &item); + + /*! + * Appends all of the values in \a l to the end of the list and returns a + * reference to the list. + */ + List &append(const List &l); + + /*! + * Clears the list. If auto deletion is enabled and this list contains a + * pointer type the members are also deleted. + * + * \see setAutoDelete() + */ + void clear(); + + /*! + * Returns the number of elements in the list. + */ + uint size() const; + bool isEmpty() const; + + /*! + * Find the first occurance of \a value. + */ + Iterator find(const T &value); + + /*! + * Find the first occurance of \a value. + */ + ConstIterator find(const T &value) const; + + /*! + * Returns true if the list contains \a value. + */ + bool contains(const T &value) const; + + /*! + * Erase the item at \a it from the list. + */ + void erase(Iterator it); + + /*! + * Returns a reference to the first item in the list. + */ + const T &front() const; + + /*! + * Returns a reference to the first item in the list. + */ + T &front(); + + /*! + * Returns a reference to the last item in the list. + */ + const T &back() const; + + /*! + * Returns a reference to the last item in the list. + */ + T &back(); + + /*! + * Auto delete the members of the list when the last reference to the list + * passes out of scope. This will have no effect on lists which do not + * contain a pointer type. + * + * \note This relies on partial template instantiation -- most modern C++ + * compilers should now support this. + */ + void setAutoDelete(bool autoDelete); + + /*! + * Returns a reference to item \a i in the list. + * + * \warning This method is slow. Use iterators to loop through the list. + */ + T &operator[](uint i); + + /*! + * Returns a const reference to item \a i in the list. + * + * \warning This method is slow. Use iterators to loop through the list. + */ + const T &operator[](uint i) const; + + /*! + * Make a shallow, implicitly shared, copy of \a l. Because this is + * implicitly shared, this method is lightweight and suitable for + * pass-by-value usage. + */ + List &operator=(const List &l); + + /*! + * Compares this list with \a l and returns true if all of the elements are + * the same. + */ + bool operator==(const List &l) const; + + protected: + /* + * If this List is being shared via implicit sharing, do a deep copy of the + * data and separate from the shared members. This should be called by all + * non-const subclass members. + */ + void detach(); + + private: +#ifndef DO_NOT_DOCUMENT + template class ListPrivate; + ListPrivate *d; +#endif + }; + +} + +// Since GCC doesn't support the "export" keyword, we have to include the +// implementation. + +#include "tlist.tcc" + +#endif diff --git a/Libraries/TagLib/Files/taglib/toolkit/tlist.tcc b/Libraries/TagLib/Files/taglib/toolkit/tlist.tcc new file mode 100644 index 000000000..e94b85a71 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/toolkit/tlist.tcc @@ -0,0 +1,296 @@ +/*************************************************************************** + copyright : (C) 2002 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#include + +#include + +namespace TagLib { + +//////////////////////////////////////////////////////////////////////////////// +// public members +//////////////////////////////////////////////////////////////////////////////// + +// The functionality of List::setAutoDelete() is implemented here partial +// template specialization. This is implemented in such a way that calling +// setAutoDelete() on non-pointer types will simply have no effect. + +// A base for the generic and specialized private class types. New +// non-templatized members should be added here. + +class ListPrivateBase : public RefCounter +{ +public: + ListPrivateBase() : autoDelete(false) {} + bool autoDelete; +}; + +// A generic implementation + +template +template class List::ListPrivate : public ListPrivateBase +{ +public: + ListPrivate() : ListPrivateBase() {} + ListPrivate(const std::list &l) : ListPrivateBase(), list(l) {} + void clear() { + list.clear(); + } + std::list list; +}; + +// A partial specialization for all pointer types that implements the +// setAutoDelete() functionality. + +template +template class List::ListPrivate : public ListPrivateBase +{ +public: + ListPrivate() : ListPrivateBase() {} + ListPrivate(const std::list &l) : ListPrivateBase(), list(l) {} + ~ListPrivate() { + clear(); + } + void clear() { + if(autoDelete) { + typename std::list::const_iterator it = list.begin(); + for(; it != list.end(); ++it) + delete *it; + } + list.clear(); + } + std::list list; +}; + +//////////////////////////////////////////////////////////////////////////////// +// public members +//////////////////////////////////////////////////////////////////////////////// + +template +List::List() +{ + d = new ListPrivate; +} + +template +List::List(const List &l) : d(l.d) +{ + d->ref(); +} + +template +List::~List() +{ + if(d->deref()) + delete d; +} + +template +typename List::Iterator List::begin() +{ + detach(); + return d->list.begin(); +} + +template +typename List::ConstIterator List::begin() const +{ + return d->list.begin(); +} + +template +typename List::Iterator List::end() +{ + detach(); + return d->list.end(); +} + +template +typename List::ConstIterator List::end() const +{ + return d->list.end(); +} + +template +void List::insert(Iterator it, const T &item) +{ + detach(); + d->list.insert(it, item); +} + +template +void List::sortedInsert(const T &value, bool unique) +{ + detach(); + Iterator it = begin(); + while(*it < value && it != end()) + ++it; + if(unique && it != end() && *it == value) + return; + insert(it, value); +} + +template +List &List::append(const T &item) +{ + detach(); + d->list.push_back(item); + return *this; +} + +template +List &List::append(const List &l) +{ + detach(); + d->list.insert(d->list.end(), l.begin(), l.end()); + return *this; +} + +template +void List::clear() +{ + detach(); + d->clear(); +} + +template +TagLib::uint List::size() const +{ + return d->list.size(); +} + +template +bool List::isEmpty() const +{ + return d->list.empty(); +} + +template +typename List::Iterator List::find(const T &value) +{ + return std::find(d->list.begin(), d->list.end(), value); +} + +template +typename List::ConstIterator List::find(const T &value) const +{ + return std::find(d->list.begin(), d->list.end(), value); +} + +template +bool List::contains(const T &value) const +{ + return std::find(d->list.begin(), d->list.end(), value) != d->list.end(); +} + +template +void List::erase(Iterator it) +{ + d->list.erase(it); +} + +template +const T &List::front() const +{ + return d->list.front(); +} + +template +T &List::front() +{ + detach(); + return d->list.front(); +} + +template +const T &List::back() const +{ + return d->list.back(); +} + +template +void List::setAutoDelete(bool autoDelete) +{ + d->autoDelete = autoDelete; +} + +template +T &List::back() +{ + detach(); + return d->list.back(); +} + +template +T &List::operator[](uint i) +{ + Iterator it = d->list.begin(); + + for(uint j = 0; j < i; j++) + ++it; + + return *it; +} + +template +const T &List::operator[](uint i) const +{ + ConstIterator it = d->list.begin(); + + for(uint j = 0; j < i; j++) + ++it; + + return *it; +} + +template +List &List::operator=(const List &l) +{ + if(&l == this) + return *this; + + if(d->deref()) + delete d; + d = l.d; + d->ref(); + return *this; +} + +template +bool List::operator==(const List &l) const +{ + return d->list == l.d->list; +} + +//////////////////////////////////////////////////////////////////////////////// +// protected members +//////////////////////////////////////////////////////////////////////////////// + +template +void List::detach() +{ + if(d->count() > 1) { + d->deref(); + d = new ListPrivate(d->list); + } +} + +} // namespace TagLib diff --git a/Libraries/TagLib/Files/taglib/toolkit/tmap.h b/Libraries/TagLib/Files/taglib/toolkit/tmap.h new file mode 100644 index 000000000..f67bcbaad --- /dev/null +++ b/Libraries/TagLib/Files/taglib/toolkit/tmap.h @@ -0,0 +1,177 @@ +/*************************************************************************** + copyright : (C) 2003 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#ifndef TAGLIB_MAP_H +#define TAGLIB_MAP_H + +#include "taglib.h" + +#include + +namespace TagLib { + + //! A generic, implicitly shared map. + + /*! + * This implements a standard map container that associates a key with a value + * and has fast key-based lookups. This map is also implicitly shared making + * it suitable for pass-by-value usage. + */ + + template class Map + { + public: +#ifndef DO_NOT_DOCUMENT + typedef typename std::map::iterator Iterator; + typedef typename std::map::const_iterator ConstIterator; +#endif + + /*! + * Constructs an empty Map. + */ + Map(); + + /*! + * Make a shallow, implicitly shared, copy of \a m. Because this is + * implicitly shared, this method is lightweight and suitable for + * pass-by-value usage. + */ + Map(const Map &m); + + /*! + * Destroys this instance of the Map. + */ + virtual ~Map(); + + /*! + * Returns an STL style iterator to the beginning of the map. See + * std::map::iterator for the semantics. + */ + Iterator begin(); + + /*! + * Returns an STL style iterator to the beginning of the map. See + * std::map::const_iterator for the semantics. + */ + ConstIterator begin() const; + + /*! + * Returns an STL style iterator to the end of the map. See + * std::map::iterator for the semantics. + */ + Iterator end(); + + /*! + * Returns an STL style iterator to the end of the map. See + * std::map::const_iterator for the semantics. + */ + ConstIterator end() const; + + /*! + * Inserts \a value under \a key in the map. If a value for \a key already + * exists it will be overwritten. + */ + void insert(const Key &key, const T &value); + + /*! + * Removes all of the elements from elements from the map. This however + * will not delete pointers if the mapped type is a pointer type. + */ + void clear(); + + /*! + * The number of elements in the map. + * + * \see isEmpty() + */ + uint size() const; + + /*! + * Returns true if the map is empty. + * + * \see size() + */ + bool isEmpty() const; + + /*! + * Find the first occurance of \a key. + */ + Iterator find(const Key &key); + + /*! + * Find the first occurance of \a key. + */ + ConstIterator find(const Key &key) const; + + /*! + * Returns true if the map contains an instance of \a key. + */ + bool contains(const Key &key) const; + + /*! + * Erase the item at \a it from the list. + */ + void erase(Iterator it); + + /*! + * Returns a reference to the value associated with \a key. + * + * \note This has undefined behavior if the key is not present in the map. + */ + const T &operator[](const Key &key) const; + + /*! + * Returns a reference to the value associated with \a key. + * + * \note This has undefined behavior if the key is not present in the map. + */ + T &operator[](const Key &key); + + /*! + * Make a shallow, implicitly shared, copy of \a m. Because this is + * implicitly shared, this method is lightweight and suitable for + * pass-by-value usage. + */ + Map &operator=(const Map &m); + + protected: + /* + * If this List is being shared via implicit sharing, do a deep copy of the + * data and separate from the shared members. This should be called by all + * non-const subclass members. + */ + void detach(); + + private: +#ifndef DO_NOT_DOCUMENT + template class MapPrivate; + MapPrivate *d; +#endif + }; + +} + +// Since GCC doesn't support the "export" keyword, we have to include the +// implementation. + +#include "tmap.tcc" + +#endif diff --git a/Libraries/TagLib/Files/taglib/toolkit/tmap.tcc b/Libraries/TagLib/Files/taglib/toolkit/tmap.tcc new file mode 100644 index 000000000..fff5f6649 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/toolkit/tmap.tcc @@ -0,0 +1,172 @@ +/*************************************************************************** + copyright : (C) 2002 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +namespace TagLib { + +//////////////////////////////////////////////////////////////////////////////// +// public members +//////////////////////////////////////////////////////////////////////////////// + +template +template class Map::MapPrivate : public RefCounter +{ +public: + MapPrivate() : RefCounter() {} + MapPrivate(const std::map &m) : RefCounter(), map(m) {} + + std::map map; +}; + +template +Map::Map() +{ + d = new MapPrivate; +} + +template +Map::Map(const Map &m) : d(m.d) +{ + d->ref(); +} + +template +Map::~Map() +{ + if(d->deref()) + delete(d); +} + +template +typename Map::Iterator Map::begin() +{ + detach(); + return d->map.begin(); +} + +template +typename Map::ConstIterator Map::begin() const +{ + return d->map.begin(); +} + +template +typename Map::Iterator Map::end() +{ + detach(); + return d->map.end(); +} + +template +typename Map::ConstIterator Map::end() const +{ + return d->map.end(); +} + +template +void Map::insert(const Key &key, const T &value) +{ + detach(); + std::pair item(key, value); + d->map.insert(item); +} + +template +void Map::clear() +{ + detach(); + d->map.clear(); +} + +template +bool Map::isEmpty() const +{ + return d->map.empty(); +} + +template +typename Map::Iterator Map::find(const Key &key) +{ + return d->map.find(key); +} + +template +typename Map::ConstIterator Map::find(const Key &key) const +{ + return d->map.find(key); +} + +template +bool Map::contains(const Key &key) const +{ + return d->map.find(key) != d->map.end(); +} + +template +void Map::erase(Iterator it) +{ + d->map.erase(it); +} + +template +TagLib::uint Map::size() const +{ + return d->map.size(); +} + +template +const T &Map::operator[](const Key &key) const +{ + return d->map[key]; +} + +template +T &Map::operator[](const Key &key) +{ + return d->map[key]; +} + +template +Map &Map::operator=(const Map &m) +{ + if(&m == this) + return *this; + + if(d->deref()) + delete(d); + d = m.d; + d->ref(); + return *this; +} + +//////////////////////////////////////////////////////////////////////////////// +// protected members +//////////////////////////////////////////////////////////////////////////////// + +template +void Map::detach() +{ + if(d->count() > 1) { + d->deref(); + d = new MapPrivate(d->map); + } +} + +} // namespace TagLib diff --git a/Libraries/TagLib/Files/taglib/toolkit/tstring.cpp b/Libraries/TagLib/Files/taglib/toolkit/tstring.cpp new file mode 100644 index 000000000..c6b89218e --- /dev/null +++ b/Libraries/TagLib/Files/taglib/toolkit/tstring.cpp @@ -0,0 +1,723 @@ +/*************************************************************************** + copyright : (C) 2002, 2003 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#include "tstring.h" +#include "unicode.h" +#include "tdebug.h" + +#include + +namespace TagLib { + + inline unsigned short byteSwap(unsigned short x) + { + return ((x) >> 8) & 0xff | ((x) & 0xff) << 8; + } + + inline unsigned short combine(unsigned char c1, unsigned char c2) + { + return (c1 << 8) | c2; + } +} + +using namespace TagLib; + +class String::StringPrivate : public RefCounter +{ +public: + StringPrivate(const wstring &s) : + RefCounter(), + data(s), + CString(0) {} + + StringPrivate() : + RefCounter(), + CString(0) {} + + ~StringPrivate() { + delete [] CString; + } + + wstring data; + + /*! + * This is only used to hold the a pointer to the most recent value of + * toCString. + */ + char *CString; +}; + +String String::null; + +//////////////////////////////////////////////////////////////////////////////// + +String::String() +{ + d = new StringPrivate; +} + +String::String(const String &s) : d(s.d) +{ + d->ref(); +} + +String::String(const std::string &s, Type t) +{ + d = new StringPrivate; + + if(t == UTF16 || t == UTF16BE) { + debug("String::String() -- A std::string should not contain UTF16."); + return; + } + + int length = s.length(); + d->data.resize(length); + wstring::iterator targetIt = d->data.begin(); + + for(std::string::const_iterator it = s.begin(); it != s.end(); it++) { + *targetIt = uchar(*it); + ++targetIt; + } + + prepare(t); +} + +String::String(const wstring &s, Type t) +{ + d = new StringPrivate(s); + prepare(t); +} + +String::String(const wchar_t *s, Type t) +{ + d = new StringPrivate(s); + prepare(t); +} + +String::String(const char *s, Type t) +{ + d = new StringPrivate; + + if(t == UTF16 || t == UTF16BE) { + debug("String::String() -- A const char * should not contain UTF16."); + return; + } + + int length = ::strlen(s); + d->data.resize(length); + + wstring::iterator targetIt = d->data.begin(); + + for(int i = 0; i < length; i++) { + *targetIt = uchar(s[i]); + ++targetIt; + } + + prepare(t); +} + +String::String(wchar_t c, Type t) +{ + d = new StringPrivate; + d->data += c; + prepare(t); +} + +String::String(char c, Type t) +{ + d = new StringPrivate; + + if(t == UTF16 || t == UTF16BE) { + debug("String::String() -- A std::string should not contain UTF16."); + return; + } + + d->data += uchar(c); + prepare(t); +} + +String::String(const ByteVector &v, Type t) +{ + d = new StringPrivate; + + if(v.isEmpty()) + return; + + if(t == Latin1 || t == UTF8) { + + int length = 0; + d->data.resize(v.size()); + wstring::iterator targetIt = d->data.begin(); + for(ByteVector::ConstIterator it = v.begin(); it != v.end() && (*it); ++it) { + *targetIt = uchar(*it); + ++targetIt; + ++length; + } + d->data.resize(length); + } + else { + d->data.resize(v.size() / 2); + wstring::iterator targetIt = d->data.begin(); + + for(ByteVector::ConstIterator it = v.begin(); + it != v.end() && it + 1 != v.end() && combine(*it, *(it + 1)); + it += 2) + { + *targetIt = combine(*it, *(it + 1)); + ++targetIt; + } + } + prepare(t); +} + +//////////////////////////////////////////////////////////////////////////////// + +String::~String() +{ + if(d->deref()) + delete d; +} + +std::string String::to8Bit(bool unicode) const +{ + std::string s; + s.resize(d->data.size()); + + if(!unicode) { + std::string::iterator targetIt = s.begin(); + for(wstring::const_iterator it = d->data.begin(); it != d->data.end(); it++) { + *targetIt = char(*it); + ++targetIt; + } + return s; + } + + const int outputBufferSize = d->data.size() * 3 + 1; + + Unicode::UTF16 *sourceBuffer = new Unicode::UTF16[d->data.size() + 1]; + Unicode::UTF8 *targetBuffer = new Unicode::UTF8[outputBufferSize]; + + for(unsigned int i = 0; i < d->data.size(); i++) + sourceBuffer[i] = Unicode::UTF16(d->data[i]); + + const Unicode::UTF16 *source = sourceBuffer; + Unicode::UTF8 *target = targetBuffer; + + Unicode::ConversionResult result = + Unicode::ConvertUTF16toUTF8(&source, sourceBuffer + d->data.size(), + &target, targetBuffer + outputBufferSize, + Unicode::lenientConversion); + + if(result != Unicode::conversionOK) + debug("String::to8Bit() - Unicode conversion error."); + + int newSize = target - targetBuffer; + s.resize(newSize); + targetBuffer[newSize] = 0; + + s = (char *) targetBuffer; + + delete [] sourceBuffer; + delete [] targetBuffer; + + return s; +} + +const char *String::toCString(bool unicode) const +{ + delete [] d->CString; + + std::string buffer = to8Bit(unicode); + d->CString = new char[buffer.size() + 1]; + strcpy(d->CString, buffer.c_str()); + + return d->CString; +} + +String::Iterator String::begin() +{ + return d->data.begin(); +} + +String::ConstIterator String::begin() const +{ + return d->data.begin(); +} + +String::Iterator String::end() +{ + return d->data.end(); +} + +String::ConstIterator String::end() const +{ + return d->data.end(); +} + +int String::find(const String &s, int offset) const +{ + wstring::size_type position = d->data.find(s.d->data, offset); + + if(position != wstring::npos) + return position; + else + return -1; +} + +String String::substr(uint position, uint n) const +{ + if(n > position + d->data.size()) + n = d->data.size() - position; + + String s; + s.d->data = d->data.substr(position, n); + return s; +} + +String &String::append(const String &s) +{ + detach(); + d->data += s.d->data; + return *this; +} + +String String::upper() const +{ + String s; + + static int shift = 'A' - 'a'; + + for(wstring::const_iterator it = d->data.begin(); it != d->data.end(); ++it) { + if(*it >= 'a' && *it <= 'z') + s.d->data.push_back(*it + shift); + else + s.d->data.push_back(*it); + } + + return s; +} + +TagLib::uint String::size() const +{ + return d->data.size(); +} + +bool String::isEmpty() const +{ + return d->data.size() == 0; +} + +bool String::isNull() const +{ + return d == null.d; +} + +ByteVector String::data(Type t) const +{ + ByteVector v; + + switch(t) { + + case Latin1: + { + for(wstring::const_iterator it = d->data.begin(); it != d->data.end(); it++) + v.append(char(*it)); + break; + } + case UTF8: + { + std::string s = to8Bit(true); + v.setData(s.c_str(), s.length()); + break; + } + case UTF16: + { + // Assume that if we're doing UTF16 and not UTF16BE that we want little + // endian encoding. (Byte Order Mark) + + v.append(char(0xff)); + v.append(char(0xfe)); + + for(wstring::const_iterator it = d->data.begin(); it != d->data.end(); it++) { + + char c1 = *it & 0xff; + char c2 = *it >> 8; + + v.append(c1); + v.append(c2); + } + break; + } + case UTF16BE: + { + for(wstring::const_iterator it = d->data.begin(); it != d->data.end(); it++) { + + char c1 = *it >> 8; + char c2 = *it & 0xff; + + v.append(c2); + v.append(c1); + } + break; + } + } + + return v; +} + +int String::toInt() const +{ + int value = 0; + + bool negative = d->data[0] == '-'; + uint i = negative ? 1 : 0; + + for(; i < d->data.size() && d->data[i] >= '0' && d->data[i] <= '9'; i++) + value = value * 10 + (d->data[i] - '0'); + + if(negative) + value = value * -1; + + return value; +} + +String String::stripWhiteSpace() const +{ + wstring::const_iterator begin = d->data.begin(); + wstring::const_iterator end = d->data.end(); + + while(*begin == '\t' || *begin == '\n' || *begin == '\f' || + *begin == '\r' || *begin == ' ' && begin != end) + { + ++begin; + } + + if(begin == end) + return null; + + // There must be at least one non-whitespace charater here for us to have + // gotten this far, so we should be safe not doing bounds checking. + + do { + --end; + } while(*end == '\t' || *end == '\n' || + *end == '\f' || *end == '\r' || *end == ' '); + + return String(wstring(begin, end + 1)); +} + +String String::number(int n) // static +{ + if(n == 0) + return String("0"); + + String charStack; + + bool negative = n < 0; + + if(negative) + n = n * -1; + + while(n > 0) { + int remainder = n % 10; + charStack += char(remainder + '0'); + n = (n - remainder) / 10; + } + + String s; + + if(negative) + s += '-'; + + for(int i = charStack.d->data.size() - 1; i >= 0; i--) + s += charStack.d->data[i]; + + return s; +} + +TagLib::wchar &String::operator[](int i) +{ + return d->data[i]; +} + +const TagLib::wchar &String::operator[](int i) const +{ + return d->data[i]; +} + +bool String::operator==(const String &s) const +{ + return d == s.d || d->data == s.d->data; +} + +String &String::operator+=(const String &s) +{ + detach(); + + d->data += s.d->data; + return *this; +} + +String &String::operator+=(const wchar_t *s) +{ + detach(); + + d->data += s; + return *this; +} + +String &String::operator+=(const char *s) +{ + detach(); + + for(int i = 0; s[i] != 0; i++) + d->data += uchar(s[i]); + return *this; +} + +String &String::operator+=(wchar_t c) +{ + detach(); + + d->data += c; + return *this; +} + +String &String::operator+=(char c) +{ + d->data += uchar(c); + return *this; +} + +String &String::operator=(const String &s) +{ + if(&s == this) + return *this; + + if(d->deref()) + delete d; + d = s.d; + d->ref(); + return *this; +} + +String &String::operator=(const std::string &s) +{ + if(d->deref()) + delete d; + + d = new StringPrivate; + + d->data.resize(s.size()); + + wstring::iterator targetIt = d->data.begin(); + for(std::string::const_iterator it = s.begin(); it != s.end(); it++) { + *targetIt = uchar(*it); + ++targetIt; + } + + return *this; +} + +String &String::operator=(const wstring &s) +{ + if(d->deref()) + delete d; + d = new StringPrivate(s); + return *this; +} + +String &String::operator=(const wchar_t *s) +{ + if(d->deref()) + delete d; + d = new StringPrivate(s); + return *this; +} + +String &String::operator=(char c) +{ + if(d->deref()) + delete d; + d = new StringPrivate; + d->data += uchar(c); + return *this; +} + +String &String::operator=(wchar_t c) +{ + if(d->deref()) + delete d; + d = new StringPrivate; + d->data += c; + return *this; +} + +String &String::operator=(const char *s) +{ + if(d->deref()) + delete d; + + d = new StringPrivate; + + int length = ::strlen(s); + d->data.resize(length); + + wstring::iterator targetIt = d->data.begin(); + for(int i = 0; i < length; i++) { + *targetIt = uchar(s[i]); + ++targetIt; + } + + return *this; +} + +String &String::operator=(const ByteVector &v) +{ + if(d->deref()) + delete d; + + d = new StringPrivate; + d->data.resize(v.size()); + wstring::iterator targetIt = d->data.begin(); + + uint i = 0; + + for(ByteVector::ConstIterator it = v.begin(); it != v.end() && (*it); ++it) { + *targetIt = uchar(*it); + ++targetIt; + ++i; + } + + // If we hit a null in the ByteVector, shrink the string again. + + d->data.resize(i); + + return *this; +} + +bool String::operator<(const String &s) const +{ + return d->data < s.d->data; +} + +//////////////////////////////////////////////////////////////////////////////// +// protected members +//////////////////////////////////////////////////////////////////////////////// + +void String::detach() +{ + if(d->count() > 1) { + d->deref(); + d = new StringPrivate(d->data); + } +} + +//////////////////////////////////////////////////////////////////////////////// +// private members +//////////////////////////////////////////////////////////////////////////////// + +void String::prepare(Type t) +{ + switch(t) { + case UTF16: + { + if(d->data.size() > 1) { + bool swap = d->data[0] != 0xfeff; + d->data.erase(d->data.begin(), d->data.begin() + 1); + if(swap) { + for(uint i = 0; i < d->data.size(); i++) + d->data[i] = byteSwap((unsigned short)d->data[i]); + } + } + else { + debug("String::prepare() - Invalid UTF16 string."); + d->data.erase(d->data.begin(), d->data.end()); + } + break; + } + case UTF8: + { + int bufferSize = d->data.size() + 1; + Unicode::UTF8 *sourceBuffer = new Unicode::UTF8[bufferSize]; + Unicode::UTF16 *targetBuffer = new Unicode::UTF16[bufferSize]; + + unsigned int i = 0; + for(; i < d->data.size(); i++) + sourceBuffer[i] = Unicode::UTF8(d->data[i]); + sourceBuffer[i] = 0; + + const Unicode::UTF8 *source = sourceBuffer; + Unicode::UTF16 *target = targetBuffer; + + Unicode::ConversionResult result = + Unicode::ConvertUTF8toUTF16(&source, sourceBuffer + bufferSize, + &target, targetBuffer + bufferSize, + Unicode::lenientConversion); + + if(result != Unicode::conversionOK) + debug("String::prepare() - Unicode conversion error."); + + + int newSize = target != targetBuffer ? target - targetBuffer - 1 : 0; + d->data.resize(newSize); + + for(int i = 0; i < newSize; i++) + d->data[i] = targetBuffer[i]; + + delete [] sourceBuffer; + delete [] targetBuffer; + } + default: + break; + } +} + +//////////////////////////////////////////////////////////////////////////////// +// related functions +//////////////////////////////////////////////////////////////////////////////// + +const TagLib::String operator+(const TagLib::String &s1, const TagLib::String &s2) +{ + String s(s1); + s.append(s2); + return s; +} + +const TagLib::String operator+(const char *s1, const TagLib::String &s2) +{ + String s(s1); + s.append(s2); + return s; +} + +const TagLib::String operator+(const TagLib::String &s1, const char *s2) +{ + String s(s1); + s.append(s2); + return s; +} + +std::ostream &operator<<(std::ostream &s, const String &str) +{ + s << str.to8Bit(); + return s; +} diff --git a/Libraries/TagLib/Files/taglib/toolkit/tstring.h b/Libraries/TagLib/Files/taglib/toolkit/tstring.h new file mode 100644 index 000000000..6ffd65630 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/toolkit/tstring.h @@ -0,0 +1,414 @@ +/*************************************************************************** + copyright : (C) 2002, 2003 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#ifndef TAGLIB_STRING_H +#define TAGLIB_STRING_H + +#include "taglib.h" +#include "tbytevector.h" + +#include + +/*! + * \relates TagLib::String + * + * Converts a TagLib::String to a QString without a requirement to link to Qt. + */ +#define QStringToTString(s) TagLib::String(s.utf8().data(), TagLib::String::UTF8) + +/*! + * \relates TagLib::String + * + * Converts a TagLib::String to a QString without a requirement to link to Qt. + */ +#define TStringToQString(s) QString::fromUtf8(s.toCString(true)) + +namespace TagLib { + + //! A \e wide string class suitable for unicode. + + /*! + * This is an implicitly shared \e wide string. For storage it uses + * TagLib::wstring, but as this is an implementation detail this of + * course could change. Strings are stored internally as UTF-16BE. (Without + * the BOM (Byte Order Mark) + * + * The use of implicit sharing means that copying a string is cheap, the only + * \e cost comes into play when the copy is modified. Prior to that the string + * just has a pointer to the data of the \e parent String. This also makes + * this class suitable as a function return type. + * + * In addition to adding implicit sharing, this class keeps track of four + * possible encodings, which are the four supported by the ID3v2 standard. + */ + + class String + { + public: + +#ifndef DO_NOT_DOCUMENT + typedef std::basic_string::iterator Iterator; + typedef std::basic_string::const_iterator ConstIterator; +#endif + + /** + * The four types of string encodings supported by the ID3v2 specification. + * ID3v1 is assumed to be Latin1 and Ogg Vorbis comments use UTF8. + */ + enum Type { + /*! + * IS08859-1, or Latin1 encoding. 8 bit characters. + */ + Latin1 = 0, + /*! + * UTF16 with a byte order mark. 16 bit characters. + */ + UTF16 = 1, + /*! + * UTF16 big endian. 16 bit characters. This is the encoding used + * internally by TagLib. + */ + UTF16BE = 2, + /*! + * UTF8 encoding. Characters are usually 8 bits but can be up to 32. + */ + UTF8 = 3 + }; + + /*! + * Constructs an empty String. + */ + String(); + + /*! + * Make a shallow, implicitly shared, copy of \a s. Because this is + * implicitly shared, this method is lightweight and suitable for + * pass-by-value usage. + */ + String(const String &s); + + /*! + * Makes a deep copy of the data in \a s. + * + * \note This should only be used with the 8-bit codecs Latin1 and UTF8, when + * used with other codecs it will simply print a warning and exit. + */ + String(const std::string &s, Type t = Latin1); + + /*! + * Makes a deep copy of the data in \a s. + */ + String(const wstring &s, Type t = UTF16BE); + + /*! + * Makes a deep copy of the data in \a s. + */ + String(const wchar_t *s, Type t = UTF16BE); + + /*! + * Makes a deep copy of the data in \a c. + * + * \note This should only be used with the 8-bit codecs Latin1 and UTF8, when + * used with other codecs it will simply print a warning and exit. + */ + String(char c, Type t = Latin1); + + /*! + * Makes a deep copy of the data in \a c. + */ + String(wchar_t c, Type t = Latin1); + + + /*! + * Makes a deep copy of the data in \a s. + * + * \note This should only be used with the 8-bit codecs Latin1 and UTF8, when + * used with other codecs it will simply print a warning and exit. + */ + String(const char *s, Type t = Latin1); + + /*! + * Makes a deep copy of the data in \a s. + * + * \note This should only be used with the 8-bit codecs Latin1 and UTF8, when + * used with other codecs it will simply print a warning and exit. + */ + String(const ByteVector &v, Type t = Latin1); + + /*! + * Destroys this String instance. + */ + virtual ~String(); + + /*! + * If \a unicode if false (the default) this will return a \e Latin1 encoded + * std::string. If it is true the returned std::wstring will be UTF-8 + * encoded. + */ + std::string to8Bit(bool unicode = false) const; + + /*! + * Creates and returns a C-String based on the data. This string is still + * owned by the String (class) and as such should not be deleted by the user. + * + * If \a unicode if false (the default) this string will be encoded in + * \e Latin1. If it is true the returned C-String will be UTF-8 encoded. + * + * This string remains valid until the String instance is destroyed or + * another export method is called. + * + * \warning This however has the side effect that this C-String will remain + * in memory in addition to other memory that is consumed by the + * String instance. So, this method should not be used on large strings or + * where memory is critical. + */ + const char *toCString(bool unicode = false) const; + + /*! + * Returns an iterator pointing to the beginning of the string. + */ + Iterator begin(); + + /*! + * Returns a const iterator pointing to the beginning of the string. + */ + ConstIterator begin() const; + + /*! + * Returns an iterator pointing to the end of the string (the position + * after the last character). + */ + Iterator end(); + + /*! + * Returns a const iterator pointing to the end of the string (the position + * after the last character). + */ + ConstIterator end() const; + + /*! + * Finds the first occurance of pattern \a s in this string starting from + * \a offset. If the pattern is not found, -1 is returned. + */ + int find(const String &s, int offset = 0) const; + + /*! + * Extract a substring from this string starting at \a position and + * continuing for \a n characters. + */ + String substr(uint position, uint n = 0xffffffff) const; + + /*! + * Append \a s to the current string and return a reference to the current + * string. + */ + String &append(const String &s); + + /*! + * Returns an upper case version of the string. + * + * \warning This only works for the characters in US-ASCII, i.e. A-Z. + */ + String upper() const; + + /*! + * Returns the size of the string. + */ + uint size() const; + + /*! + * Returns true if the string is empty. + * + * \see isNull() + */ + bool isEmpty() const; + + /*! + * Returns true if this string is null -- i.e. it is a copy of the + * String::null string. + * + * \note A string can be empty and not null. + * \see isEmpty() + */ + bool isNull() const; + + /*! + * Returns a ByteVector containing the string's data. If \a t is Latin1 or + * UTF8, this will return a vector of 8 bit characters, otherwise it will use + * 16 bit characters. + */ + ByteVector data(Type t) const; + + /*! + * Convert the string to an integer. + */ + int toInt() const; + + /*! + * Returns a string with the leading and trailing whitespace stripped. + */ + String stripWhiteSpace() const; + + /*! + * Converts the base-10 integer \a n to a string. + */ + static String number(int n); + + /*! + * Returns a reference to the character at position \a i. + */ + wchar &operator[](int i); + + /*! + * Returns a const reference to the character at position \a i. + */ + const wchar &operator[](int i) const; + + /*! + * Compares each character of the String with each character of \a s and + * returns true if the strings match. + */ + bool operator==(const String &s) const; + + /*! + * Appends \a s to the end of the String. + */ + String &operator+=(const String &s); + + /*! + * Appends \a s to the end of the String. + */ + String &operator+=(const wchar_t* s); + + /*! + * Appends \a s to the end of the String. + */ + String &operator+=(const char* s); + + /*! + * Appends \a s to the end of the String. + */ + String &operator+=(wchar_t c); + + /*! + * Appends \a c to the end of the String. + */ + String &operator+=(char c); + + /*! + * Performs a shallow, implicitly shared, copy of \a s, overwriting the + * String's current data. + */ + String &operator=(const String &s); + + /*! + * Performs a deep copy of the data in \a s. + */ + String &operator=(const std::string &s); + + /*! + * Performs a deep copy of the data in \a s. + */ + String &operator=(const wstring &s); + + /*! + * Performs a deep copy of the data in \a s. + */ + String &operator=(const wchar_t *s); + + /*! + * Performs a deep copy of the data in \a s. + */ + String &operator=(char c); + + /*! + * Performs a deep copy of the data in \a s. + */ + String &operator=(wchar_t c); + + /*! + * Performs a deep copy of the data in \a s. + */ + String &operator=(const char *s); + + /*! + * Performs a deep copy of the data in \a v. + */ + String &operator=(const ByteVector &v); + + /*! + * To be able to use this class in a Map, this operator needed to be + * implemented. Returns true if \a s is less than this string in a bytewise + * comparison. + */ + bool operator<(const String &s) const; + + /*! + * A null string provided for convenience. + */ + static String null; + + protected: + /*! + * If this String is being shared via implicit sharing, do a deep copy of the + * data and separate from the shared members. This should be called by all + * non-const subclass members. + */ + void detach(); + + private: + /*! + * This checks to see if the string is in \e UTF-16 (with BOM) or \e UTF-8 + * format and if so converts it to \e UTF-16BE for internal use. \e Latin1 + * does not require conversion since it is a subset of \e UTF-16BE and + * \e UTF16-BE requires no conversion since it is used internally. + */ + void prepare(Type t); + + class StringPrivate; + StringPrivate *d; + }; + +} + +/*! + * \relates TagLib::String + */ +const TagLib::String operator+(const TagLib::String &s1, const TagLib::String &s2); + +/*! + * \relates TagLib::String + */ +const TagLib::String operator+(const char *s1, const TagLib::String &s2); + +/*! + * \relates TagLib::String + */ +const TagLib::String operator+(const TagLib::String &s1, const char *s2); + + +/*! + * \relates TagLib::String + * Send the string to an output stream. + */ +std::ostream &operator<<(std::ostream &s, const TagLib::String &str); + +#endif diff --git a/Libraries/TagLib/Files/taglib/toolkit/tstringlist.cpp b/Libraries/TagLib/Files/taglib/toolkit/tstringlist.cpp new file mode 100644 index 000000000..f37b30bf8 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/toolkit/tstringlist.cpp @@ -0,0 +1,118 @@ +/*************************************************************************** + copyright : (C) 2002, 2003 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#include "tstringlist.h" + +using namespace TagLib; + +class StringListPrivate +{ + +}; + +//////////////////////////////////////////////////////////////////////////////// +// static members +//////////////////////////////////////////////////////////////////////////////// + +StringList StringList::split(const String &s, const String &pattern) +{ + StringList l; + + int previousOffset = 0; + for(int offset = s.find(pattern); offset != -1; offset = s.find(pattern, offset + 1)) { + l.append(s.substr(previousOffset, offset - previousOffset)); + previousOffset = offset + 1; + } + + l.append(s.substr(previousOffset, s.size() - previousOffset)); + + return l; +} + +//////////////////////////////////////////////////////////////////////////////// +// public members +//////////////////////////////////////////////////////////////////////////////// + +StringList::StringList() : List() +{ + +} + +StringList::StringList(const StringList &l) : List(l) +{ + +} + +StringList::StringList(const String &s) : List() +{ + append(s); +} + +StringList::StringList(const ByteVectorList &bl, String::Type t) : List() +{ + ByteVectorList::ConstIterator i = bl.begin(); + for(;i != bl.end(); i++) { + append(String(*i, t)); + } +} + +StringList::~StringList() +{ + +} + +String StringList::toString(const String &separator) const +{ + String s; + + ConstIterator it = begin(); + + while(it != end()) { + s += *it; + it++; + if(it != end()) + s += separator; + } + + return s; +} + +StringList &StringList::append(const String &s) +{ + List::append(s); + return *this; +} + +StringList &StringList::append(const StringList &l) +{ + List::append(l); + return *this; +} + +//////////////////////////////////////////////////////////////////////////////// +// related functions +//////////////////////////////////////////////////////////////////////////////// + +std::ostream &operator<<(std::ostream &s, const StringList &l) +{ + s << l.toString(); + return s; +} diff --git a/Libraries/TagLib/Files/taglib/toolkit/tstringlist.h b/Libraries/TagLib/Files/taglib/toolkit/tstringlist.h new file mode 100644 index 000000000..5a2219e21 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/toolkit/tstringlist.h @@ -0,0 +1,110 @@ +/*************************************************************************** + copyright : (C) 2002, 2003 by Scott Wheeler + email : wheeler@kde.org + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + ***************************************************************************/ + +#ifndef TAGLIB_STRINGLIST_H +#define TAGLIB_STRINGLIST_H + +#include "tstring.h" +#include "tlist.h" +#include "tbytevectorlist.h" + +#include + +namespace TagLib { + + //! A list of strings + + /*! + * This is a spcialization of the List class with some members convention for + * string operations. + */ + + class StringList : public List + { + public: + + /*! + * Constructs an empty StringList. + */ + StringList(); + + /*! + * Make a shallow, implicitly shared, copy of \a l. Because this is + * implicitly shared, this method is lightweight and suitable for + * pass-by-value usage. + */ + StringList(const StringList &l); + + /*! + * Constructs a StringList with \a s as a member. + */ + StringList(const String &s); + + /*! + * Makes a deep copy of the data in \a vl. + * + * \note This should only be used with the 8-bit codecs Latin1 and UTF8, when + * used with other codecs it will simply print a warning and exit. + */ + StringList(const ByteVectorList &vl, String::Type t = String::Latin1); + + /*! + * Destroys this StringList instance. + */ + virtual ~StringList(); + + /*! + * Concatenate the list of strings into one string separated by \a separator. + */ + String toString(const String &separator = " ") const; + + /*! + * Appends \a s to the end of the list and returns a reference to the + * list. + */ + StringList &append(const String &s); + + /*! + * Appends all of the values in \a l to the end of the list and returns a + * reference to the list. + */ + StringList &append(const StringList &l); + + /*! + * Splits the String \a s into several strings at \a pattern. This will not include + * the pattern in the returned strings. + */ + static StringList split(const String &s, const String &pattern); + + private: + class StringListPrivate; + StringListPrivate *d; + }; + +} + +/*! + * \related TagLib::StringList + * Send the StringList to an output stream. + */ +std::ostream &operator<<(std::ostream &s, const TagLib::StringList &l); + +#endif diff --git a/Libraries/TagLib/Files/taglib/toolkit/unicode.cpp b/Libraries/TagLib/Files/taglib/toolkit/unicode.cpp new file mode 100644 index 000000000..b60264d91 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/toolkit/unicode.cpp @@ -0,0 +1,303 @@ +/******************************************************************************* + * * + * THIS FILE IS INCLUDED IN TAGLIB, BUT IS NOT COPYRIGHTED BY THE TAGLIB * + * AUTHORS, NOT PART OF THE TAGLIB API AND COULD GO AWAY AT ANY POINT IN TIME. * + * AS SUCH IT SHOULD BE CONSIERED FOR INTERNAL USE ONLY. * + * * + *******************************************************************************/ + +/* + * Copyright 2001 Unicode, Inc. + * + * Disclaimer + * + * This source code is provided as is by Unicode, Inc. No claims are + * made as to fitness for any particular purpose. No warranties of any + * kind are expressed or implied. The recipient agrees to determine + * applicability of information provided. If this file has been + * purchased on magnetic or optical media from Unicode, Inc., the + * sole remedy for any claim will be exchange of defective media + * within 90 days of receipt. + * + * Limitations on Rights to Redistribute This Code + * + * Unicode, Inc. hereby grants the right to freely use the information + * supplied in this file in the creation of products supporting the + * Unicode Standard, and to make copies of this file in any form + * for internal or external distribution as long as this notice + * remains attached. + */ + +/* + * This file has been modified by Scott Wheeler to remove + * the UTF32 conversion functions and to place the appropriate functions + * in their own C++ namespace. + */ + +/* --------------------------------------------------------------------- + + Conversions between UTF32, UTF-16, and UTF-8. Source code file. + Author: Mark E. Davis, 1994. + Rev History: Rick McGowan, fixes & updates May 2001. + Sept 2001: fixed const & error conditions per + mods suggested by S. Parent & A. Lillich. + + See the header file "ConvertUTF.h" for complete documentation. + +------------------------------------------------------------------------ */ + + +#include "unicode.h" +#include + +#define UNI_SUR_HIGH_START (UTF32)0xD800 +#define UNI_SUR_HIGH_END (UTF32)0xDBFF +#define UNI_SUR_LOW_START (UTF32)0xDC00 +#define UNI_SUR_LOW_END (UTF32)0xDFFF +#define false 0 +#define true 1 + +namespace Unicode { + +static const int halfShift = 10; /* used for shifting by 10 bits */ + +static const UTF32 halfBase = 0x0010000UL; +static const UTF32 halfMask = 0x3FFUL; + +/* + * Index into the table below with the first byte of a UTF-8 sequence to + * get the number of trailing bytes that are supposed to follow it. + */ +static const char trailingBytesForUTF8[256] = { + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5 +}; + +/* + * Magic values subtracted from a buffer value during UTF8 conversion. + * This table contains as many values as there might be trailing bytes + * in a UTF-8 sequence. + */ +static const UTF32 offsetsFromUTF8[6] = { 0x00000000UL, 0x00003080UL, 0x000E2080UL, + 0x03C82080UL, 0xFA082080UL, 0x82082080UL }; + +/* + * Once the bits are split out into bytes of UTF-8, this is a mask OR-ed + * into the first byte, depending on how many bytes follow. There are + * as many entries in this table as there are UTF-8 sequence types. + * (I.e., one byte sequence, two byte... six byte sequence.) + */ +static const UTF8 firstByteMark[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC }; + +/* --------------------------------------------------------------------- */ + +/* The interface converts a whole buffer to avoid function-call overhead. + * Constants have been gathered. Loops & conditionals have been removed as + * much as possible for efficiency, in favor of drop-through switches. + * (See "Note A" at the bottom of the file for equivalent code.) + * If your compiler supports it, the "isLegalUTF8" call can be turned + * into an inline function. + */ + +/* --------------------------------------------------------------------- */ + +ConversionResult ConvertUTF16toUTF8 ( + const UTF16** sourceStart, const UTF16* sourceEnd, + UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags) { + ConversionResult result = conversionOK; + const UTF16* source = *sourceStart; + UTF8* target = *targetStart; + while (source < sourceEnd) { + UTF32 ch; + unsigned short bytesToWrite = 0; + const UTF32 byteMask = 0xBF; + const UTF32 byteMark = 0x80; + const UTF16* oldSource = source; /* In case we have to back up because of target overflow. */ + ch = *source++; + /* If we have a surrogate pair, convert to UTF32 first. */ + if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_HIGH_END && source < sourceEnd) { + UTF32 ch2 = *source; + if (ch2 >= UNI_SUR_LOW_START && ch2 <= UNI_SUR_LOW_END) { + ch = ((ch - UNI_SUR_HIGH_START) << halfShift) + + (ch2 - UNI_SUR_LOW_START) + halfBase; + ++source; + } else if (flags == strictConversion) { /* it's an unpaired high surrogate */ + --source; /* return to the illegal value itself */ + result = sourceIllegal; + break; + } + } else if ((flags == strictConversion) && (ch >= UNI_SUR_LOW_START && ch <= UNI_SUR_LOW_END)) { + --source; /* return to the illegal value itself */ + result = sourceIllegal; + break; + } + /* Figure out how many bytes the result will require */ + if (ch < (UTF32)0x80) { bytesToWrite = 1; + } else if (ch < (UTF32)0x800) { bytesToWrite = 2; + } else if (ch < (UTF32)0x10000) { bytesToWrite = 3; + } else if (ch < (UTF32)0x200000) { bytesToWrite = 4; + } else { bytesToWrite = 2; + ch = UNI_REPLACEMENT_CHAR; + } + // printf("bytes to write = %i\n", bytesToWrite); + target += bytesToWrite; + if (target > targetEnd) { + source = oldSource; /* Back up source pointer! */ + target -= bytesToWrite; result = targetExhausted; break; + } + switch (bytesToWrite) { /* note: everything falls through. */ + case 4: *--target = (ch | byteMark) & byteMask; ch >>= 6; + case 3: *--target = (ch | byteMark) & byteMask; ch >>= 6; + case 2: *--target = (ch | byteMark) & byteMask; ch >>= 6; + case 1: *--target = ch | firstByteMark[bytesToWrite]; + } + target += bytesToWrite; + } + *sourceStart = source; + *targetStart = target; + return result; +} + +/* --------------------------------------------------------------------- */ + +/* + * Utility routine to tell whether a sequence of bytes is legal UTF-8. + * This must be called with the length pre-determined by the first byte. + * If not calling this from ConvertUTF8to*, then the length can be set by: + * length = trailingBytesForUTF8[*source]+1; + * and the sequence is illegal right away if there aren't that many bytes + * available. + * If presented with a length > 4, this returns false. The Unicode + * definition of UTF-8 goes up to 4-byte sequences. + */ + +static Boolean isLegalUTF8(const UTF8 *source, int length) { + UTF8 a; + const UTF8 *srcptr = source+length; + switch (length) { + default: return false; + /* Everything else falls through when "true"... */ + case 4: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return false; + case 3: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return false; + case 2: if ((a = (*--srcptr)) > 0xBF) return false; + switch (*source) { + /* no fall-through in this inner switch */ + case 0xE0: if (a < 0xA0) return false; break; + case 0xF0: if (a < 0x90) return false; break; + case 0xF4: if (a > 0x8F) return false; break; + default: if (a < 0x80) return false; + } + case 1: if (*source >= 0x80 && *source < 0xC2) return false; + if (*source > 0xF4) return false; + } + return true; +} + +/* --------------------------------------------------------------------- */ + +/* + * Exported function to return whether a UTF-8 sequence is legal or not. + * This is not used here; it's just exported. + */ +Boolean isLegalUTF8Sequence(const UTF8 *source, const UTF8 *sourceEnd) { + int length = trailingBytesForUTF8[*source]+1; + if (source+length > sourceEnd) { + return false; + } + return isLegalUTF8(source, length); +} + +/* --------------------------------------------------------------------- */ + +ConversionResult ConvertUTF8toUTF16 ( + const UTF8** sourceStart, const UTF8* sourceEnd, + UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags) { + ConversionResult result = conversionOK; + const UTF8* source = *sourceStart; + UTF16* target = *targetStart; + while (source < sourceEnd) { + UTF32 ch = 0; + unsigned short extraBytesToRead = trailingBytesForUTF8[*source]; + if (source + extraBytesToRead >= sourceEnd) { + result = sourceExhausted; break; + } + /* Do this check whether lenient or strict */ + if (! isLegalUTF8(source, extraBytesToRead+1)) { + result = sourceIllegal; + break; + } + /* + * The cases all fall through. See "Note A" below. + */ + switch (extraBytesToRead) { + case 3: ch += *source++; ch <<= 6; + case 2: ch += *source++; ch <<= 6; + case 1: ch += *source++; ch <<= 6; + case 0: ch += *source++; + } + ch -= offsetsFromUTF8[extraBytesToRead]; + + if (target >= targetEnd) { + source -= (extraBytesToRead+1); /* Back up source pointer! */ + result = targetExhausted; break; + } + if (ch <= UNI_MAX_BMP) { /* Target is a character <= 0xFFFF */ + if ((flags == strictConversion) && (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END)) { + source -= (extraBytesToRead+1); /* return to the illegal value itself */ + result = sourceIllegal; + break; + } else { + *target++ = ch; /* normal case */ + } + } else if (ch > UNI_MAX_UTF16) { + if (flags == strictConversion) { + result = sourceIllegal; + source -= (extraBytesToRead+1); /* return to the start */ + break; /* Bail out; shouldn't continue */ + } else { + *target++ = UNI_REPLACEMENT_CHAR; + } + } else { + /* target is a character in range 0xFFFF - 0x10FFFF. */ + if (target + 1 >= targetEnd) { + source -= (extraBytesToRead+1); /* Back up source pointer! */ + result = targetExhausted; break; + } + ch -= halfBase; + *target++ = (ch >> halfShift) + UNI_SUR_HIGH_START; + *target++ = (ch & halfMask) + UNI_SUR_LOW_START; + } + } + *sourceStart = source; + *targetStart = target; + return result; +} + +} + +/* --------------------------------------------------------------------- + + Note A. + The fall-through switches in UTF-8 reading code save a + temp variable, some decrements & conditionals. The switches + are equivalent to the following loop: + { + int tmpBytesToRead = extraBytesToRead+1; + do { + ch += *source++; + --tmpBytesToRead; + if (tmpBytesToRead) ch <<= 6; + } while (tmpBytesToRead > 0); + } + In UTF-8 writing code, the switches on "bytesToWrite" are + similarly unrolled loops. + + --------------------------------------------------------------------- */ + + diff --git a/Libraries/TagLib/Files/taglib/toolkit/unicode.h b/Libraries/TagLib/Files/taglib/toolkit/unicode.h new file mode 100644 index 000000000..45d726b28 --- /dev/null +++ b/Libraries/TagLib/Files/taglib/toolkit/unicode.h @@ -0,0 +1,149 @@ +#ifndef TAGLIB_UNICODE_H +#define TAGLIB_UNICODE_H + +/******************************************************************************* + * * + * THIS FILE IS INCLUDED IN TAGLIB, BUT IS NOT COPYRIGHTED BY THE TAGLIB * + * AUTHORS, NOT PART OF THE TAGLIB API AND COULD GO AWAY AT ANY POINT IN TIME. * + * AS SUCH IT SHOULD BE CONSIERED FOR INTERNAL USE ONLY. * + * * + *******************************************************************************/ + +#ifndef DO_NOT_DOCUMENT // tell Doxygen not to document this header + +/* + * Copyright 2001 Unicode, Inc. + * + * Disclaimer + * + * This source code is provided as is by Unicode, Inc. No claims are + * made as to fitness for any particular purpose. No warranties of any + * kind are expressed or implied. The recipient agrees to determine + * applicability of information provided. If this file has been + * purchased on magnetic or optical media from Unicode, Inc., the + * sole remedy for any claim will be exchange of defective media + * within 90 days of receipt. + * + * Limitations on Rights to Redistribute This Code + * + * Unicode, Inc. hereby grants the right to freely use the information + * supplied in this file in the creation of products supporting the + * Unicode Standard, and to make copies of this file in any form + * for internal or external distribution as long as this notice + * remains attached. + */ + +/* + * This file has been modified by Scott Wheeler to remove + * the UTF32 conversion functions and to place the appropriate functions + * in their own C++ namespace. + */ + +/* --------------------------------------------------------------------- + + Conversions between UTF32, UTF-16, and UTF-8. Header file. + + Several funtions are included here, forming a complete set of + conversions between the three formats. UTF-7 is not included + here, but is handled in a separate source file. + + Each of these routines takes pointers to input buffers and output + buffers. The input buffers are const. + + Each routine converts the text between *sourceStart and sourceEnd, + putting the result into the buffer between *targetStart and + targetEnd. Note: the end pointers are *after* the last item: e.g. + *(sourceEnd - 1) is the last item. + + The return result indicates whether the conversion was successful, + and if not, whether the problem was in the source or target buffers. + (Only the first encountered problem is indicated.) + + After the conversion, *sourceStart and *targetStart are both + updated to point to the end of last text successfully converted in + the respective buffers. + + Input parameters: + sourceStart - pointer to a pointer to the source buffer. + The contents of this are modified on return so that + it points at the next thing to be converted. + targetStart - similarly, pointer to pointer to the target buffer. + sourceEnd, targetEnd - respectively pointers to the ends of the + two buffers, for overflow checking only. + + These conversion functions take a ConversionFlags argument. When this + flag is set to strict, both irregular sequences and isolated surrogates + will cause an error. When the flag is set to lenient, both irregular + sequences and isolated surrogates are converted. + + Whether the flag is strict or lenient, all illegal sequences will cause + an error return. This includes sequences such as: , , + or in UTF-8, and values above 0x10FFFF in UTF-32. Conformant code + must check for illegal sequences. + + When the flag is set to lenient, characters over 0x10FFFF are converted + to the replacement character; otherwise (when the flag is set to strict) + they constitute an error. + + Output parameters: + The value "sourceIllegal" is returned from some routines if the input + sequence is malformed. When "sourceIllegal" is returned, the source + value will point to the illegal value that caused the problem. E.g., + in UTF-8 when a sequence is malformed, it points to the start of the + malformed sequence. + + Author: Mark E. Davis, 1994. + Rev History: Rick McGowan, fixes & updates May 2001. + Fixes & updates, Sept 2001. + +------------------------------------------------------------------------ */ + +/* --------------------------------------------------------------------- + The following 4 definitions are compiler-specific. + The C standard does not guarantee that wchar_t has at least + 16 bits, so wchar_t is no less portable than unsigned short! + All should be unsigned values to avoid sign extension during + bit mask & shift operations. +------------------------------------------------------------------------ */ + +/* Some fundamental constants */ +#define UNI_REPLACEMENT_CHAR (UTF32)0x0000FFFD +#define UNI_MAX_BMP (UTF32)0x0000FFFF +#define UNI_MAX_UTF16 (UTF32)0x0010FFFF +#define UNI_MAX_UTF32 (UTF32)0x7FFFFFFF + +namespace Unicode { + +typedef unsigned long UTF32; /* at least 32 bits */ +typedef unsigned short UTF16; /* at least 16 bits */ +typedef unsigned char UTF8; /* typically 8 bits */ +typedef unsigned char Boolean; /* 0 or 1 */ + +typedef enum { + conversionOK = 0, /* conversion successful */ + sourceExhausted = 1, /* partial character in source, but hit end */ + targetExhausted = 2, /* insuff. room in target for conversion */ + sourceIllegal = 3 /* source sequence is illegal/malformed */ +} ConversionResult; + +typedef enum { + strictConversion = 0, + lenientConversion +} ConversionFlags; + +ConversionResult ConvertUTF8toUTF16 ( + const UTF8** sourceStart, const UTF8* sourceEnd, + UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags); + +ConversionResult ConvertUTF16toUTF8 ( + const UTF16** sourceStart, const UTF16* sourceEnd, + UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags); + +Boolean isLegalUTF8Sequence(const UTF8 *source, const UTF8 *sourceEnd); + +} // namespace Unicode + +/* --------------------------------------------------------------------- */ + +#endif +#endif diff --git a/Libraries/TagLib/Info.plist b/Libraries/TagLib/Info.plist new file mode 100644 index 000000000..03c000701 --- /dev/null +++ b/Libraries/TagLib/Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + TagLib + CFBundleIconFile + + CFBundleIdentifier + com.apple.carbonframeworktemplate + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + FMWK + CFBundleSignature + ???? + CFBundleVersion + 1.0 + CFBundleShortVersionString + 1.0 + CSResourcesFileMapped + + + diff --git a/Libraries/TagLib/TagLib.xcode/project.pbxproj b/Libraries/TagLib/TagLib.xcode/project.pbxproj new file mode 100644 index 000000000..fe01b89d9 --- /dev/null +++ b/Libraries/TagLib/TagLib.xcode/project.pbxproj @@ -0,0 +1,1906 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 39; + objects = { + 034768DDFF38A45A11DB9C8B = { + children = ( + 8D07F2C80486CC7A007CD1D0, + ); + isa = PBXGroup; + name = Products; + refType = 4; + sourceTree = ""; + }; +//030 +//031 +//032 +//033 +//034 +//080 +//081 +//082 +//083 +//084 + 0867D690FE84028FC02AAC07 = { + buildSettings = { + }; + buildStyles = ( + 4F0BB7EC011F40E904CA0E50, + 4F0BB7ED011F40E904CA0E50, + ); + hasScannedForEncodings = 1; + isa = PBXProject; + mainGroup = 0867D691FE84028FC02AAC07; + productRefGroup = 034768DDFF38A45A11DB9C8B; + projectDirPath = ""; + targets = ( + 8D07F2BC0486CC7A007CD1D0, + ); + }; + 0867D691FE84028FC02AAC07 = { + children = ( + 08FB77ACFE841707C02AAC07, + 089C1665FE841158C02AAC07, + 0867D69AFE84028FC02AAC07, + 034768DDFF38A45A11DB9C8B, + ); + isa = PBXGroup; + name = TagLib; + refType = 4; + sourceTree = ""; + }; + 0867D69AFE84028FC02AAC07 = { + children = ( + ); + isa = PBXGroup; + name = "External Frameworks and Libraries"; + refType = 4; + sourceTree = ""; + }; + 089C1665FE841158C02AAC07 = { + children = ( + 8D07F2C70486CC7A007CD1D0, + 089C1666FE841158C02AAC07, + ); + isa = PBXGroup; + name = Resources; + refType = 4; + sourceTree = ""; + }; + 089C1666FE841158C02AAC07 = { + children = ( + 089C1667FE841158C02AAC07, + ); + isa = PBXVariantGroup; + name = InfoPlist.strings; + refType = 4; + sourceTree = ""; + }; + 089C1667FE841158C02AAC07 = { + fileEncoding = 10; + isa = PBXFileReference; + lastKnownFileType = text.plist.strings; + name = English; + path = English.lproj/InfoPlist.strings; + refType = 4; + sourceTree = ""; + }; + 08FB77ACFE841707C02AAC07 = { + children = ( + 8E5A8FFA084CB37000AE6D62, + 8E5A8FDA084CB2F700AE6D62, + 8E5A8ED6084CB29500AE6D62, + 8E5A8EE0084CB29600AE6D62, + 8E5A8EE1084CB29600AE6D62, + 8E5A8EE4084CB29600AE6D62, + 8E5A8EE5084CB29600AE6D62, + 8E5A8EE6084CB29600AE6D62, + 8E5A8EF0084CB29600AE6D62, + 8E5A8EF8084CB29600AE6D62, + 8E5A8F2C084CB29600AE6D62, + 8E5A8F43084CB29600AE6D62, + 8E5A8F44084CB29600AE6D62, + 8E5A8F46084CB29600AE6D62, + ); + isa = PBXGroup; + name = Source; + refType = 4; + sourceTree = ""; + }; +//080 +//081 +//082 +//083 +//084 +//4F0 +//4F1 +//4F2 +//4F3 +//4F4 + 4F0BB7EC011F40E904CA0E50 = { + buildSettings = { + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_GENERATE_DEBUGGING_SYMBOLS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + ZERO_LINK = YES; + }; + isa = PBXBuildStyle; + name = Development; + }; + 4F0BB7ED011F40E904CA0E50 = { + buildSettings = { + COPY_PHASE_STRIP = YES; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + ZERO_LINK = NO; + }; + isa = PBXBuildStyle; + name = Deployment; + }; +//4F0 +//4F1 +//4F2 +//4F3 +//4F4 +//8D0 +//8D1 +//8D2 +//8D3 +//8D4 + 8D07F2BC0486CC7A007CD1D0 = { + buildPhases = ( + 8D07F2BD0486CC7A007CD1D0, + 8D07F2BF0486CC7A007CD1D0, + 8D07F2C10486CC7A007CD1D0, + 8D07F2C30486CC7A007CD1D0, + 8D07F2C50486CC7A007CD1D0, + ); + buildRules = ( + ); + buildSettings = { + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + FRAMEWORK_VERSION = A; + GCC_GENERATE_DEBUGGING_SYMBOLS = NO; + GCC_PRECOMPILE_PREFIX_HEADER = NO; + GCC_PREFIX_HEADER = ""; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "@executable_path/../Frameworks"; + LIBRARY_STYLE = DYNAMIC; + PRODUCT_NAME = TagLib; + WRAPPER_EXTENSION = framework; + }; + dependencies = ( + ); + isa = PBXNativeTarget; + name = TagLib; + productInstallPath = "$(HOME)/Library/Frameworks"; + productName = TagLib; + productReference = 8D07F2C80486CC7A007CD1D0; + productType = "com.apple.product-type.framework"; + }; + 8D07F2BD0486CC7A007CD1D0 = { + buildActionMask = 2147483647; + files = ( + 8E5A8F5E084CB29600AE6D62, + 8E5A8F60084CB29600AE6D62, + 8E5A8F62084CB29600AE6D62, + 8E5A8F66084CB29600AE6D62, + 8E5A8F6A084CB29600AE6D62, + 8E5A8F6C084CB29600AE6D62, + 8E5A8F6E084CB29600AE6D62, + 8E5A8F6F084CB29600AE6D62, + 8E5A8F74084CB29600AE6D62, + 8E5A8F78084CB29600AE6D62, + 8E5A8F7A084CB29600AE6D62, + 8E5A8F7C084CB29600AE6D62, + 8E5A8F7E084CB29600AE6D62, + 8E5A8F82084CB29600AE6D62, + 8E5A8F84084CB29600AE6D62, + 8E5A8F88084CB29600AE6D62, + 8E5A8F8A084CB29600AE6D62, + 8E5A8F8C084CB29600AE6D62, + 8E5A8F8E084CB29600AE6D62, + 8E5A8F92084CB29600AE6D62, + 8E5A8F94084CB29600AE6D62, + 8E5A8F96084CB29600AE6D62, + 8E5A8F98084CB29600AE6D62, + 8E5A8F9A084CB29600AE6D62, + 8E5A8F9C084CB29600AE6D62, + 8E5A8F9E084CB29600AE6D62, + 8E5A8FA4084CB29600AE6D62, + 8E5A8FA6084CB29600AE6D62, + 8E5A8FA8084CB29600AE6D62, + 8E5A8FAA084CB29600AE6D62, + 8E5A8FAE084CB29600AE6D62, + 8E5A8FB2084CB29600AE6D62, + 8E5A8FB4084CB29600AE6D62, + 8E5A8FB6084CB29600AE6D62, + 8E5A8FBA084CB29600AE6D62, + 8E5A8FBC084CB29600AE6D62, + 8E5A8FBE084CB29600AE6D62, + 8E5A8FC0084CB29600AE6D62, + 8E5A8FC4084CB29600AE6D62, + 8E5A8FC6084CB29600AE6D62, + 8E5A8FC8084CB29600AE6D62, + 8E5A8FCA084CB29600AE6D62, + 8E5A8FCC084CB29600AE6D62, + 8E5A8FCD084CB29600AE6D62, + 8E5A8FCF084CB29600AE6D62, + 8E5A8FD2084CB29600AE6D62, + 8E5A8FD4084CB29600AE6D62, + 8E5A8FD6084CB29600AE6D62, + 8E5A8FE4084CB2F700AE6D62, + 8E5A8FFB084CB37000AE6D62, + ); + isa = PBXHeadersBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 8D07F2BF0486CC7A007CD1D0 = { + buildActionMask = 2147483647; + files = ( + 8D07F2C00486CC7A007CD1D0, + 8E5A8FCE084CB29600AE6D62, + 8E5A8FD0084CB29600AE6D62, + ); + isa = PBXResourcesBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 8D07F2C00486CC7A007CD1D0 = { + fileRef = 089C1666FE841158C02AAC07; + isa = PBXBuildFile; + settings = { + }; + }; + 8D07F2C10486CC7A007CD1D0 = { + buildActionMask = 2147483647; + files = ( + 8E5A8F5D084CB29600AE6D62, + 8E5A8F5F084CB29600AE6D62, + 8E5A8F61084CB29600AE6D62, + 8E5A8F65084CB29600AE6D62, + 8E5A8F69084CB29600AE6D62, + 8E5A8F6B084CB29600AE6D62, + 8E5A8F6D084CB29600AE6D62, + 8E5A8F77084CB29600AE6D62, + 8E5A8F79084CB29600AE6D62, + 8E5A8F7B084CB29600AE6D62, + 8E5A8F7D084CB29600AE6D62, + 8E5A8F81084CB29600AE6D62, + 8E5A8F83084CB29600AE6D62, + 8E5A8F87084CB29600AE6D62, + 8E5A8F89084CB29600AE6D62, + 8E5A8F8B084CB29600AE6D62, + 8E5A8F8D084CB29600AE6D62, + 8E5A8F91084CB29600AE6D62, + 8E5A8F93084CB29600AE6D62, + 8E5A8F95084CB29600AE6D62, + 8E5A8F97084CB29600AE6D62, + 8E5A8F99084CB29600AE6D62, + 8E5A8F9B084CB29600AE6D62, + 8E5A8F9D084CB29600AE6D62, + 8E5A8FA3084CB29600AE6D62, + 8E5A8FA5084CB29600AE6D62, + 8E5A8FA7084CB29600AE6D62, + 8E5A8FA9084CB29600AE6D62, + 8E5A8FAD084CB29600AE6D62, + 8E5A8FB1084CB29600AE6D62, + 8E5A8FB3084CB29600AE6D62, + 8E5A8FB5084CB29600AE6D62, + 8E5A8FB9084CB29600AE6D62, + 8E5A8FBB084CB29600AE6D62, + 8E5A8FBD084CB29600AE6D62, + 8E5A8FBF084CB29600AE6D62, + 8E5A8FC5084CB29600AE6D62, + 8E5A8FC7084CB29600AE6D62, + 8E5A8FC9084CB29600AE6D62, + 8E5A8FCB084CB29600AE6D62, + 8E5A8FD1084CB29600AE6D62, + 8E5A8FD3084CB29600AE6D62, + 8E5A8FD5084CB29600AE6D62, + 8E5A8FE3084CB2F700AE6D62, + ); + isa = PBXSourcesBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 8D07F2C30486CC7A007CD1D0 = { + buildActionMask = 2147483647; + files = ( + ); + isa = PBXFrameworksBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 8D07F2C50486CC7A007CD1D0 = { + buildActionMask = 2147483647; + files = ( + ); + isa = PBXRezBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 8D07F2C70486CC7A007CD1D0 = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = text.plist; + path = Info.plist; + refType = 4; + sourceTree = ""; + }; + 8D07F2C80486CC7A007CD1D0 = { + explicitFileType = wrapper.framework; + includeInIndex = 0; + isa = PBXFileReference; + path = TagLib.framework; + refType = 3; + sourceTree = BUILT_PRODUCTS_DIR; + }; +//8D0 +//8D1 +//8D2 +//8D3 +//8D4 +//8E0 +//8E1 +//8E2 +//8E3 +//8E4 + 8E5A8ED6084CB29500AE6D62 = { + children = ( + 8E5A8ED8084CB29600AE6D62, + 8E5A8ED9084CB29600AE6D62, + 8E5A8EDA084CB29600AE6D62, + 8E5A8EDB084CB29600AE6D62, + 8E5A8EDC084CB29600AE6D62, + 8E5A8EDD084CB29600AE6D62, + ); + isa = PBXGroup; + name = ape; + path = Files/taglib/ape; + refType = 4; + sourceTree = ""; + }; + 8E5A8ED8084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + path = apefooter.cpp; + refType = 4; + sourceTree = ""; + }; + 8E5A8ED9084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = apefooter.h; + refType = 4; + sourceTree = ""; + }; + 8E5A8EDA084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + path = apeitem.cpp; + refType = 4; + sourceTree = ""; + }; + 8E5A8EDB084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = apeitem.h; + refType = 4; + sourceTree = ""; + }; + 8E5A8EDC084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + path = apetag.cpp; + refType = 4; + sourceTree = ""; + }; + 8E5A8EDD084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = apetag.h; + refType = 4; + sourceTree = ""; + }; + 8E5A8EE0084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + name = audioproperties.cpp; + path = Files/taglib/audioproperties.cpp; + refType = 4; + sourceTree = ""; + }; + 8E5A8EE1084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = audioproperties.h; + path = Files/taglib/audioproperties.h; + refType = 4; + sourceTree = ""; + }; + 8E5A8EE4084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + name = fileref.cpp; + path = Files/taglib/fileref.cpp; + refType = 4; + sourceTree = ""; + }; + 8E5A8EE5084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = fileref.h; + path = Files/taglib/fileref.h; + refType = 4; + sourceTree = ""; + }; + 8E5A8EE6084CB29600AE6D62 = { + children = ( + 8E5A8EE7084CB29600AE6D62, + 8E5A8EE8084CB29600AE6D62, + 8E5A8EE9084CB29600AE6D62, + 8E5A8EEA084CB29600AE6D62, + 8E5A8EEB084CB29600AE6D62, + ); + isa = PBXGroup; + name = flac; + path = Files/taglib/flac; + refType = 4; + sourceTree = ""; + }; + 8E5A8EE7084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + path = flacfile.cpp; + refType = 4; + sourceTree = ""; + }; + 8E5A8EE8084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = flacfile.h; + refType = 4; + sourceTree = ""; + }; + 8E5A8EE9084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + path = flacproperties.cpp; + refType = 4; + sourceTree = ""; + }; + 8E5A8EEA084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = flacproperties.h; + refType = 4; + sourceTree = ""; + }; + 8E5A8EEB084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = flactag.h; + refType = 4; + sourceTree = ""; + }; + 8E5A8EF0084CB29600AE6D62 = { + children = ( + 8E5A8EF1084CB29600AE6D62, + 8E5A8EF4084CB29600AE6D62, + 8E5A8EF5084CB29600AE6D62, + 8E5A8EF6084CB29600AE6D62, + 8E5A8EF7084CB29600AE6D62, + ); + isa = PBXGroup; + name = mpc; + path = Files/taglib/mpc; + refType = 4; + sourceTree = ""; + }; + 8E5A8EF1084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = combinedtag.h; + refType = 4; + sourceTree = ""; + }; + 8E5A8EF4084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + path = mpcfile.cpp; + refType = 4; + sourceTree = ""; + }; + 8E5A8EF5084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = mpcfile.h; + refType = 4; + sourceTree = ""; + }; + 8E5A8EF6084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + path = mpcproperties.cpp; + refType = 4; + sourceTree = ""; + }; + 8E5A8EF7084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = mpcproperties.h; + refType = 4; + sourceTree = ""; + }; + 8E5A8EF8084CB29600AE6D62 = { + children = ( + 8E5A8EF9084CB29600AE6D62, + 8E5A8F00084CB29600AE6D62, + 8E5A8F24084CB29600AE6D62, + 8E5A8F25084CB29600AE6D62, + 8E5A8F26084CB29600AE6D62, + 8E5A8F27084CB29600AE6D62, + 8E5A8F28084CB29600AE6D62, + 8E5A8F29084CB29600AE6D62, + 8E5A8F2A084CB29600AE6D62, + 8E5A8F2B084CB29600AE6D62, + ); + isa = PBXGroup; + name = mpeg; + path = Files/taglib/mpeg; + refType = 4; + sourceTree = ""; + }; + 8E5A8EF9084CB29600AE6D62 = { + children = ( + 8E5A8EFA084CB29600AE6D62, + 8E5A8EFB084CB29600AE6D62, + 8E5A8EFC084CB29600AE6D62, + 8E5A8EFD084CB29600AE6D62, + ); + isa = PBXGroup; + path = id3v1; + refType = 4; + sourceTree = ""; + }; + 8E5A8EFA084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + path = id3v1genres.cpp; + refType = 4; + sourceTree = ""; + }; + 8E5A8EFB084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = id3v1genres.h; + refType = 4; + sourceTree = ""; + }; + 8E5A8EFC084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + path = id3v1tag.cpp; + refType = 4; + sourceTree = ""; + }; + 8E5A8EFD084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = id3v1tag.h; + refType = 4; + sourceTree = ""; + }; + 8E5A8F00084CB29600AE6D62 = { + children = ( + 8E5A8F01084CB29600AE6D62, + 8E5A8F12084CB29600AE6D62, + 8E5A8F13084CB29600AE6D62, + 8E5A8F14084CB29600AE6D62, + 8E5A8F15084CB29600AE6D62, + 8E5A8F16084CB29600AE6D62, + 8E5A8F17084CB29600AE6D62, + 8E5A8F18084CB29600AE6D62, + 8E5A8F19084CB29600AE6D62, + 8E5A8F1A084CB29600AE6D62, + 8E5A8F1B084CB29600AE6D62, + 8E5A8F1C084CB29600AE6D62, + 8E5A8F1D084CB29600AE6D62, + 8E5A8F1E084CB29600AE6D62, + 8E5A8F1F084CB29600AE6D62, + ); + isa = PBXGroup; + path = id3v2; + refType = 4; + sourceTree = ""; + }; + 8E5A8F01084CB29600AE6D62 = { + children = ( + 8E5A8F02084CB29600AE6D62, + 8E5A8F03084CB29600AE6D62, + 8E5A8F04084CB29600AE6D62, + 8E5A8F05084CB29600AE6D62, + 8E5A8F08084CB29600AE6D62, + 8E5A8F09084CB29600AE6D62, + 8E5A8F0A084CB29600AE6D62, + 8E5A8F0B084CB29600AE6D62, + 8E5A8F0C084CB29600AE6D62, + 8E5A8F0D084CB29600AE6D62, + 8E5A8F0E084CB29600AE6D62, + 8E5A8F0F084CB29600AE6D62, + ); + isa = PBXGroup; + path = frames; + refType = 4; + sourceTree = ""; + }; + 8E5A8F02084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + path = attachedpictureframe.cpp; + refType = 4; + sourceTree = ""; + }; + 8E5A8F03084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = attachedpictureframe.h; + refType = 4; + sourceTree = ""; + }; + 8E5A8F04084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + path = commentsframe.cpp; + refType = 4; + sourceTree = ""; + }; + 8E5A8F05084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = commentsframe.h; + refType = 4; + sourceTree = ""; + }; + 8E5A8F08084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + path = relativevolumeframe.cpp; + refType = 4; + sourceTree = ""; + }; + 8E5A8F09084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = relativevolumeframe.h; + refType = 4; + sourceTree = ""; + }; + 8E5A8F0A084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + path = textidentificationframe.cpp; + refType = 4; + sourceTree = ""; + }; + 8E5A8F0B084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = textidentificationframe.h; + refType = 4; + sourceTree = ""; + }; + 8E5A8F0C084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + path = uniquefileidentifierframe.cpp; + refType = 4; + sourceTree = ""; + }; + 8E5A8F0D084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = uniquefileidentifierframe.h; + refType = 4; + sourceTree = ""; + }; + 8E5A8F0E084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + path = unknownframe.cpp; + refType = 4; + sourceTree = ""; + }; + 8E5A8F0F084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = unknownframe.h; + refType = 4; + sourceTree = ""; + }; + 8E5A8F12084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + path = id3v2extendedheader.cpp; + refType = 4; + sourceTree = ""; + }; + 8E5A8F13084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = id3v2extendedheader.h; + refType = 4; + sourceTree = ""; + }; + 8E5A8F14084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + path = id3v2footer.cpp; + refType = 4; + sourceTree = ""; + }; + 8E5A8F15084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = id3v2footer.h; + refType = 4; + sourceTree = ""; + }; + 8E5A8F16084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + path = id3v2frame.cpp; + refType = 4; + sourceTree = ""; + }; + 8E5A8F17084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = id3v2frame.h; + refType = 4; + sourceTree = ""; + }; + 8E5A8F18084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + path = id3v2framefactory.cpp; + refType = 4; + sourceTree = ""; + }; + 8E5A8F19084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = id3v2framefactory.h; + refType = 4; + sourceTree = ""; + }; + 8E5A8F1A084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + path = id3v2header.cpp; + refType = 4; + sourceTree = ""; + }; + 8E5A8F1B084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = id3v2header.h; + refType = 4; + sourceTree = ""; + }; + 8E5A8F1C084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + path = id3v2synchdata.cpp; + refType = 4; + sourceTree = ""; + }; + 8E5A8F1D084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = id3v2synchdata.h; + refType = 4; + sourceTree = ""; + }; + 8E5A8F1E084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + path = id3v2tag.cpp; + refType = 4; + sourceTree = ""; + }; + 8E5A8F1F084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = id3v2tag.h; + refType = 4; + sourceTree = ""; + }; + 8E5A8F24084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + path = mpegfile.cpp; + refType = 4; + sourceTree = ""; + }; + 8E5A8F25084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = mpegfile.h; + refType = 4; + sourceTree = ""; + }; + 8E5A8F26084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + path = mpegheader.cpp; + refType = 4; + sourceTree = ""; + }; + 8E5A8F27084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = mpegheader.h; + refType = 4; + sourceTree = ""; + }; + 8E5A8F28084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + path = mpegproperties.cpp; + refType = 4; + sourceTree = ""; + }; + 8E5A8F29084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = mpegproperties.h; + refType = 4; + sourceTree = ""; + }; + 8E5A8F2A084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + path = xingheader.cpp; + refType = 4; + sourceTree = ""; + }; + 8E5A8F2B084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = xingheader.h; + refType = 4; + sourceTree = ""; + }; + 8E5A8F2C084CB29600AE6D62 = { + children = ( + 8E5A8F2D084CB29600AE6D62, + 8E5A8F34084CB29600AE6D62, + 8E5A8F35084CB29600AE6D62, + 8E5A8F36084CB29600AE6D62, + 8E5A8F37084CB29600AE6D62, + 8E5A8F38084CB29600AE6D62, + 8E5A8F39084CB29600AE6D62, + 8E5A8F3A084CB29600AE6D62, + 8E5A8F41084CB29600AE6D62, + 8E5A8F42084CB29600AE6D62, + ); + isa = PBXGroup; + name = ogg; + path = Files/taglib/ogg; + refType = 4; + sourceTree = ""; + }; + 8E5A8F2D084CB29600AE6D62 = { + children = ( + 8E5A8F30084CB29600AE6D62, + 8E5A8F31084CB29600AE6D62, + ); + isa = PBXGroup; + path = flac; + refType = 4; + sourceTree = ""; + }; + 8E5A8F30084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + path = oggflacfile.cpp; + refType = 4; + sourceTree = ""; + }; + 8E5A8F31084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = oggflacfile.h; + refType = 4; + sourceTree = ""; + }; + 8E5A8F34084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + path = oggfile.cpp; + refType = 4; + sourceTree = ""; + }; + 8E5A8F35084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = oggfile.h; + refType = 4; + sourceTree = ""; + }; + 8E5A8F36084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + path = oggpage.cpp; + refType = 4; + sourceTree = ""; + }; + 8E5A8F37084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = oggpage.h; + refType = 4; + sourceTree = ""; + }; + 8E5A8F38084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + path = oggpageheader.cpp; + refType = 4; + sourceTree = ""; + }; + 8E5A8F39084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = oggpageheader.h; + refType = 4; + sourceTree = ""; + }; + 8E5A8F3A084CB29600AE6D62 = { + children = ( + 8E5A8F3D084CB29600AE6D62, + 8E5A8F3E084CB29600AE6D62, + 8E5A8F3F084CB29600AE6D62, + 8E5A8F40084CB29600AE6D62, + ); + isa = PBXGroup; + path = vorbis; + refType = 4; + sourceTree = ""; + }; + 8E5A8F3D084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + path = vorbisfile.cpp; + refType = 4; + sourceTree = ""; + }; + 8E5A8F3E084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = vorbisfile.h; + refType = 4; + sourceTree = ""; + }; + 8E5A8F3F084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + path = vorbisproperties.cpp; + refType = 4; + sourceTree = ""; + }; + 8E5A8F40084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = vorbisproperties.h; + refType = 4; + sourceTree = ""; + }; + 8E5A8F41084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + path = xiphcomment.cpp; + refType = 4; + sourceTree = ""; + }; + 8E5A8F42084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = xiphcomment.h; + refType = 4; + sourceTree = ""; + }; + 8E5A8F43084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + name = tag.cpp; + path = Files/taglib/tag.cpp; + refType = 4; + sourceTree = ""; + }; + 8E5A8F44084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = tag.h; + path = Files/taglib/tag.h; + refType = 4; + sourceTree = ""; + }; + 8E5A8F46084CB29600AE6D62 = { + children = ( + 8E5A8F49084CB29600AE6D62, + 8E5A8F4A084CB29600AE6D62, + 8E5A8F4B084CB29600AE6D62, + 8E5A8F4C084CB29600AE6D62, + 8E5A8F4D084CB29600AE6D62, + 8E5A8F4E084CB29600AE6D62, + 8E5A8F4F084CB29600AE6D62, + 8E5A8F50084CB29600AE6D62, + 8E5A8F51084CB29600AE6D62, + 8E5A8F52084CB29600AE6D62, + 8E5A8F53084CB29600AE6D62, + 8E5A8F54084CB29600AE6D62, + 8E5A8F55084CB29600AE6D62, + 8E5A8F56084CB29600AE6D62, + 8E5A8F57084CB29600AE6D62, + 8E5A8F58084CB29600AE6D62, + 8E5A8F59084CB29600AE6D62, + 8E5A8F5A084CB29600AE6D62, + 8E5A8F5B084CB29600AE6D62, + ); + isa = PBXGroup; + name = toolkit; + path = Files/taglib/toolkit; + refType = 4; + sourceTree = ""; + }; + 8E5A8F49084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = taglib.h; + refType = 4; + sourceTree = ""; + }; + 8E5A8F4A084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + path = tbytevector.cpp; + refType = 4; + sourceTree = ""; + }; + 8E5A8F4B084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = tbytevector.h; + refType = 4; + sourceTree = ""; + }; + 8E5A8F4C084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + path = tbytevectorlist.cpp; + refType = 4; + sourceTree = ""; + }; + 8E5A8F4D084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = tbytevectorlist.h; + refType = 4; + sourceTree = ""; + }; + 8E5A8F4E084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + path = tdebug.cpp; + refType = 4; + sourceTree = ""; + }; + 8E5A8F4F084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = tdebug.h; + refType = 4; + sourceTree = ""; + }; + 8E5A8F50084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + path = tfile.cpp; + refType = 4; + sourceTree = ""; + }; + 8E5A8F51084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = tfile.h; + refType = 4; + sourceTree = ""; + }; + 8E5A8F52084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = tlist.h; + refType = 4; + sourceTree = ""; + }; + 8E5A8F53084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = text; + path = tlist.tcc; + refType = 4; + sourceTree = ""; + }; + 8E5A8F54084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = tmap.h; + refType = 4; + sourceTree = ""; + }; + 8E5A8F55084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = text; + path = tmap.tcc; + refType = 4; + sourceTree = ""; + }; + 8E5A8F56084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + path = tstring.cpp; + refType = 4; + sourceTree = ""; + }; + 8E5A8F57084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = tstring.h; + refType = 4; + sourceTree = ""; + }; + 8E5A8F58084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + path = tstringlist.cpp; + refType = 4; + sourceTree = ""; + }; + 8E5A8F59084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = tstringlist.h; + refType = 4; + sourceTree = ""; + }; + 8E5A8F5A084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + path = unicode.cpp; + refType = 4; + sourceTree = ""; + }; + 8E5A8F5B084CB29600AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = unicode.h; + refType = 4; + sourceTree = ""; + }; + 8E5A8F5D084CB29600AE6D62 = { + fileRef = 8E5A8ED8084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8F5E084CB29600AE6D62 = { + fileRef = 8E5A8ED9084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8F5F084CB29600AE6D62 = { + fileRef = 8E5A8EDA084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8F60084CB29600AE6D62 = { + fileRef = 8E5A8EDB084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8F61084CB29600AE6D62 = { + fileRef = 8E5A8EDC084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8F62084CB29600AE6D62 = { + fileRef = 8E5A8EDD084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8F65084CB29600AE6D62 = { + fileRef = 8E5A8EE0084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8F66084CB29600AE6D62 = { + fileRef = 8E5A8EE1084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8F69084CB29600AE6D62 = { + fileRef = 8E5A8EE4084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8F6A084CB29600AE6D62 = { + fileRef = 8E5A8EE5084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8F6B084CB29600AE6D62 = { + fileRef = 8E5A8EE7084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8F6C084CB29600AE6D62 = { + fileRef = 8E5A8EE8084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8F6D084CB29600AE6D62 = { + fileRef = 8E5A8EE9084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8F6E084CB29600AE6D62 = { + fileRef = 8E5A8EEA084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8F6F084CB29600AE6D62 = { + fileRef = 8E5A8EEB084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8F74084CB29600AE6D62 = { + fileRef = 8E5A8EF1084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8F77084CB29600AE6D62 = { + fileRef = 8E5A8EF4084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8F78084CB29600AE6D62 = { + fileRef = 8E5A8EF5084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8F79084CB29600AE6D62 = { + fileRef = 8E5A8EF6084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8F7A084CB29600AE6D62 = { + fileRef = 8E5A8EF7084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8F7B084CB29600AE6D62 = { + fileRef = 8E5A8EFA084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8F7C084CB29600AE6D62 = { + fileRef = 8E5A8EFB084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8F7D084CB29600AE6D62 = { + fileRef = 8E5A8EFC084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8F7E084CB29600AE6D62 = { + fileRef = 8E5A8EFD084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8F81084CB29600AE6D62 = { + fileRef = 8E5A8F02084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8F82084CB29600AE6D62 = { + fileRef = 8E5A8F03084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8F83084CB29600AE6D62 = { + fileRef = 8E5A8F04084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8F84084CB29600AE6D62 = { + fileRef = 8E5A8F05084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8F87084CB29600AE6D62 = { + fileRef = 8E5A8F08084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8F88084CB29600AE6D62 = { + fileRef = 8E5A8F09084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8F89084CB29600AE6D62 = { + fileRef = 8E5A8F0A084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8F8A084CB29600AE6D62 = { + fileRef = 8E5A8F0B084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8F8B084CB29600AE6D62 = { + fileRef = 8E5A8F0C084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8F8C084CB29600AE6D62 = { + fileRef = 8E5A8F0D084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8F8D084CB29600AE6D62 = { + fileRef = 8E5A8F0E084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8F8E084CB29600AE6D62 = { + fileRef = 8E5A8F0F084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8F91084CB29600AE6D62 = { + fileRef = 8E5A8F12084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8F92084CB29600AE6D62 = { + fileRef = 8E5A8F13084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8F93084CB29600AE6D62 = { + fileRef = 8E5A8F14084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8F94084CB29600AE6D62 = { + fileRef = 8E5A8F15084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8F95084CB29600AE6D62 = { + fileRef = 8E5A8F16084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8F96084CB29600AE6D62 = { + fileRef = 8E5A8F17084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8F97084CB29600AE6D62 = { + fileRef = 8E5A8F18084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8F98084CB29600AE6D62 = { + fileRef = 8E5A8F19084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8F99084CB29600AE6D62 = { + fileRef = 8E5A8F1A084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8F9A084CB29600AE6D62 = { + fileRef = 8E5A8F1B084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8F9B084CB29600AE6D62 = { + fileRef = 8E5A8F1C084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8F9C084CB29600AE6D62 = { + fileRef = 8E5A8F1D084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8F9D084CB29600AE6D62 = { + fileRef = 8E5A8F1E084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8F9E084CB29600AE6D62 = { + fileRef = 8E5A8F1F084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8FA3084CB29600AE6D62 = { + fileRef = 8E5A8F24084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8FA4084CB29600AE6D62 = { + fileRef = 8E5A8F25084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8FA5084CB29600AE6D62 = { + fileRef = 8E5A8F26084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8FA6084CB29600AE6D62 = { + fileRef = 8E5A8F27084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8FA7084CB29600AE6D62 = { + fileRef = 8E5A8F28084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8FA8084CB29600AE6D62 = { + fileRef = 8E5A8F29084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8FA9084CB29600AE6D62 = { + fileRef = 8E5A8F2A084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8FAA084CB29600AE6D62 = { + fileRef = 8E5A8F2B084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8FAD084CB29600AE6D62 = { + fileRef = 8E5A8F30084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8FAE084CB29600AE6D62 = { + fileRef = 8E5A8F31084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8FB1084CB29600AE6D62 = { + fileRef = 8E5A8F34084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8FB2084CB29600AE6D62 = { + fileRef = 8E5A8F35084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8FB3084CB29600AE6D62 = { + fileRef = 8E5A8F36084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8FB4084CB29600AE6D62 = { + fileRef = 8E5A8F37084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8FB5084CB29600AE6D62 = { + fileRef = 8E5A8F38084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8FB6084CB29600AE6D62 = { + fileRef = 8E5A8F39084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8FB9084CB29600AE6D62 = { + fileRef = 8E5A8F3D084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8FBA084CB29600AE6D62 = { + fileRef = 8E5A8F3E084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8FBB084CB29600AE6D62 = { + fileRef = 8E5A8F3F084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8FBC084CB29600AE6D62 = { + fileRef = 8E5A8F40084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8FBD084CB29600AE6D62 = { + fileRef = 8E5A8F41084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8FBE084CB29600AE6D62 = { + fileRef = 8E5A8F42084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8FBF084CB29600AE6D62 = { + fileRef = 8E5A8F43084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8FC0084CB29600AE6D62 = { + fileRef = 8E5A8F44084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + ATTRIBUTES = ( + Public, + ); + }; + }; + 8E5A8FC4084CB29600AE6D62 = { + fileRef = 8E5A8F49084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8FC5084CB29600AE6D62 = { + fileRef = 8E5A8F4A084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8FC6084CB29600AE6D62 = { + fileRef = 8E5A8F4B084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8FC7084CB29600AE6D62 = { + fileRef = 8E5A8F4C084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8FC8084CB29600AE6D62 = { + fileRef = 8E5A8F4D084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8FC9084CB29600AE6D62 = { + fileRef = 8E5A8F4E084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8FCA084CB29600AE6D62 = { + fileRef = 8E5A8F4F084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8FCB084CB29600AE6D62 = { + fileRef = 8E5A8F50084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8FCC084CB29600AE6D62 = { + fileRef = 8E5A8F51084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8FCD084CB29600AE6D62 = { + fileRef = 8E5A8F52084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8FCE084CB29600AE6D62 = { + fileRef = 8E5A8F53084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8FCF084CB29600AE6D62 = { + fileRef = 8E5A8F54084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8FD0084CB29600AE6D62 = { + fileRef = 8E5A8F55084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8FD1084CB29600AE6D62 = { + fileRef = 8E5A8F56084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8FD2084CB29600AE6D62 = { + fileRef = 8E5A8F57084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8FD3084CB29600AE6D62 = { + fileRef = 8E5A8F58084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8FD4084CB29600AE6D62 = { + fileRef = 8E5A8F59084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8FD5084CB29600AE6D62 = { + fileRef = 8E5A8F5A084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8FD6084CB29600AE6D62 = { + fileRef = 8E5A8F5B084CB29600AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8FDA084CB2F700AE6D62 = { + children = ( + 8E5A8FDE084CB2F700AE6D62, + 8E5A8FDF084CB2F700AE6D62, + ); + isa = PBXGroup; + name = c; + path = Files/bindings/c; + refType = 4; + sourceTree = ""; + }; + 8E5A8FDE084CB2F700AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; + path = tag_c.cpp; + refType = 4; + sourceTree = ""; + }; + 8E5A8FDF084CB2F700AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = tag_c.h; + refType = 4; + sourceTree = ""; + }; + 8E5A8FE3084CB2F700AE6D62 = { + fileRef = 8E5A8FDE084CB2F700AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + 8E5A8FE4084CB2F700AE6D62 = { + fileRef = 8E5A8FDF084CB2F700AE6D62; + isa = PBXBuildFile; + settings = { + ATTRIBUTES = ( + Public, + ); + }; + }; + 8E5A8FFA084CB37000AE6D62 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = config.h; + path = Files/config.h; + refType = 4; + sourceTree = ""; + }; + 8E5A8FFB084CB37000AE6D62 = { + fileRef = 8E5A8FFA084CB37000AE6D62; + isa = PBXBuildFile; + settings = { + }; + }; + }; + rootObject = 0867D690FE84028FC02AAC07; +} diff --git a/Libraries/TagLib/TagLib.xcode/xugg.mode1 b/Libraries/TagLib/TagLib.xcode/xugg.mode1 new file mode 100644 index 000000000..293e89c53 --- /dev/null +++ b/Libraries/TagLib/TagLib.xcode/xugg.mode1 @@ -0,0 +1,1258 @@ + + + + + ActivePerspectiveName + Project + AllowedModules + + + BundleLoadPath + + MaxInstances + n + Module + PBXSmartGroupTreeModule + Name + Groups and Files Outline View + + + BundleLoadPath + + MaxInstances + n + Module + PBXNavigatorGroup + Name + Editor + + + BundleLoadPath + + MaxInstances + n + Module + XCTaskListModule + Name + Task List + + + BundleLoadPath + + MaxInstances + n + Module + XCDetailModule + Name + File and Smart Group Detail Viewer + + + BundleLoadPath + + MaxInstances + 1 + Module + PBXBuildResultsModule + Name + Detailed Build Results Viewer + + + BundleLoadPath + + MaxInstances + 1 + Module + PBXProjectFindModule + Name + Project Batch Find Tool + + + BundleLoadPath + + MaxInstances + n + Module + PBXRunSessionModule + Name + Run Log + + + BundleLoadPath + + MaxInstances + n + Module + PBXBookmarksModule + Name + Bookmarks Tool + + + BundleLoadPath + + MaxInstances + n + Module + PBXClassBrowserModule + Name + Class Browser + + + BundleLoadPath + + MaxInstances + n + Module + PBXCVSModule + Name + Source Code Control Tool + + + BundleLoadPath + + MaxInstances + n + Module + PBXDebugBreakpointsModule + Name + Debug Breakpoints Tool + + + BundleLoadPath + + MaxInstances + n + Module + XCDockableInspector + Name + Inspector + + + BundleLoadPath + + MaxInstances + n + Module + PBXOpenQuicklyModule + Name + Open Quickly Tool + + + BundleLoadPath + + MaxInstances + 1 + Module + PBXDebugSessionModule + Name + Debugger + + + BundleLoadPath + + MaxInstances + 1 + Module + PBXDebugCLIModule + Name + Debug Console + + + Description + DefaultDescriptionKey + DockingSystemVisible + + Extension + mode1 + FavBarConfig + + PBXProjectModuleGUID + 8E5A8EBB084CB1B900AE6D62 + XCBarModuleItemNames + + XCBarModuleItems + + + FirstTimeWindowDisplayed + + Identifier + com.apple.perspectives.project.mode1 + MajorVersion + 31 + MinorVersion + 1 + Name + Default + Notifications + + OpenEditors + + PerspectiveWidths + + -1 + -1 + + Perspectives + + + ChosenToolbarItems + + active-target-popup + action + NSToolbarFlexibleSpaceItem + buildOrClean + build-and-runOrDebug + com.apple.ide.PBXToolbarStopButton + get-info + toggle-editor + NSToolbarFlexibleSpaceItem + com.apple.pbx.toolbar.searchfield + + ControllerClassBaseName + + IconName + WindowOfProjectWithEditor + Identifier + perspective.project + IsVertical + + Layout + + + ContentConfiguration + + PBXBottomSmartGroupGIDs + + 1C37FBAC04509CD000000102 + 1C37FAAC04509CD000000102 + 1C08E77C0454961000C914BD + 1C37FABC05509CD000000102 + 1C37FABC05539CD112110102 + E2644B35053B69B200211256 + 1C37FABC04509CD000100104 + 1CC0EA4004350EF90044410B + 1CC0EA4004350EF90041110B + + PBXProjectModuleGUID + 1CE0B1FE06471DED0097A5F4 + PBXProjectModuleLabel + Files + PBXProjectStructureProvided + yes + PBXSmartGroupTreeModuleColumnData + + PBXSmartGroupTreeModuleColumnWidthsKey + + 257 + + PBXSmartGroupTreeModuleColumnsKey_v4 + + MainColumn + + + PBXSmartGroupTreeModuleOutlineStateKey_v7 + + PBXSmartGroupTreeModuleOutlineStateExpansionKey + + 0867D691FE84028FC02AAC07 + 08FB77ACFE841707C02AAC07 + 8E5A8FDA084CB2F700AE6D62 + 8E5A8F46084CB29600AE6D62 + 0867D69AFE84028FC02AAC07 + 034768DDFF38A45A11DB9C8B + 8D07F2C80486CC7A007CD1D0 + 1C37FBAC04509CD000000102 + 1C37FAAC04509CD000000102 + 1C37FABC05509CD000000102 + + PBXSmartGroupTreeModuleOutlineStateSelectionKey + + + 33 + 17 + 1 + 0 + + + PBXSmartGroupTreeModuleOutlineStateVisibleRectKey + {{0, 235}, {257, 567}} + + PBXTopSmartGroupGIDs + + XCIncludePerspectivesSwitch + + XCSharingToken + com.apple.Xcode.GFSharingToken + + GeometryConfiguration + + Frame + {{0, 0}, {274, 585}} + GroupTreeTableConfiguration + + MainColumn + 257 + + RubberWindowFrame + 0 120 1024 626 0 0 1024 746 + + Module + PBXSmartGroupTreeModule + Proportion + 274pt + + + Dock + + + BecomeActive + + ContentConfiguration + + PBXProjectModuleGUID + 1CE0B20306471E060097A5F4 + PBXProjectModuleLabel + tstringlist.cpp + PBXSplitModuleInNavigatorKey + + Split0 + + PBXProjectModuleGUID + 1CE0B20406471E060097A5F4 + PBXProjectModuleLabel + tstringlist.cpp + _historyCapacity + 0 + bookmark + 8E50FC61084E14420048349E + history + + 8E5A907C084CB91900AE6D62 + 8E5A907D084CB91900AE6D62 + 8E5A907E084CB91900AE6D62 + 8E5A907F084CB91900AE6D62 + 8E50FC5A084E14420048349E + 8E50FC5B084E14420048349E + 8E50FC5C084E14420048349E + 8E50FC5D084E14420048349E + + prevStack + + 8E5A9081084CB91900AE6D62 + 8E5A9082084CB91900AE6D62 + 8E5A9083084CB91900AE6D62 + 8E5A9085084CB91900AE6D62 + 8E5A9086084CB91900AE6D62 + 8E50FC5E084E14420048349E + 8E50FC5F084E14420048349E + 8E50FC60084E14420048349E + + + SplitCount + 1 + + StatusBarVisibility + + + GeometryConfiguration + + Frame + {{0, 0}, {745, 435}} + RubberWindowFrame + 0 120 1024 626 0 0 1024 746 + + Module + PBXNavigatorGroup + Proportion + 435pt + + + ContentConfiguration + + PBXProjectModuleGUID + 1CE0B20506471E060097A5F4 + PBXProjectModuleLabel + Detail + + GeometryConfiguration + + Frame + {{0, 440}, {745, 145}} + RubberWindowFrame + 0 120 1024 626 0 0 1024 746 + + Module + XCDetailModule + Proportion + 145pt + + + Proportion + 745pt + + + Name + Project + ServiceClasses + + XCModuleDock + PBXSmartGroupTreeModule + XCModuleDock + PBXNavigatorGroup + XCDetailModule + + TableOfContents + + 8E50FC62084E14420048349E + 1CE0B1FE06471DED0097A5F4 + 8E50FC63084E14420048349E + 1CE0B20306471E060097A5F4 + 1CE0B20506471E060097A5F4 + + ToolbarConfiguration + xcode.toolbar.config.default + + + ControllerClassBaseName + + IconName + WindowOfProject + Identifier + perspective.morph + IsVertical + 0 + Layout + + + BecomeActive + 1 + ContentConfiguration + + PBXBottomSmartGroupGIDs + + 1C37FBAC04509CD000000102 + 1C37FAAC04509CD000000102 + 1C08E77C0454961000C914BD + 1C37FABC05509CD000000102 + 1C37FABC05539CD112110102 + E2644B35053B69B200211256 + 1C37FABC04509CD000100104 + 1CC0EA4004350EF90044410B + 1CC0EA4004350EF90041110B + + PBXProjectModuleGUID + 11E0B1FE06471DED0097A5F4 + PBXProjectModuleLabel + Files + PBXProjectStructureProvided + yes + PBXSmartGroupTreeModuleColumnData + + PBXSmartGroupTreeModuleColumnWidthsKey + + 186 + + PBXSmartGroupTreeModuleColumnsKey_v4 + + MainColumn + + + PBXSmartGroupTreeModuleOutlineStateKey_v7 + + PBXSmartGroupTreeModuleOutlineStateExpansionKey + + 29B97314FDCFA39411CA2CEA + 1C37FABC05509CD000000102 + + PBXSmartGroupTreeModuleOutlineStateSelectionKey + + + 0 + + + PBXSmartGroupTreeModuleOutlineStateVisibleRectKey + {{0, 0}, {186, 337}} + + PBXTopSmartGroupGIDs + + XCIncludePerspectivesSwitch + 1 + XCSharingToken + com.apple.Xcode.GFSharingToken + + GeometryConfiguration + + Frame + {{0, 0}, {203, 355}} + GroupTreeTableConfiguration + + MainColumn + 186 + + RubberWindowFrame + 373 269 690 397 0 0 1440 878 + + Module + PBXSmartGroupTreeModule + Proportion + 100% + + + Name + Morph + PreferredWidth + 300 + ServiceClasses + + XCModuleDock + PBXSmartGroupTreeModule + + TableOfContents + + 11E0B1FE06471DED0097A5F4 + + ToolbarConfiguration + xcode.toolbar.config.default.short + + + PerspectivesBarVisible + + ShelfIsVisible + + SourceDescription + file at '/System/Library/PrivateFrameworks/DevToolsInterface.framework/Versions/A/Resources/XCPerspectivesSpecificationMode1.xcperspec' + StatusbarIsVisible + + TimeStamp + 0.0 + ToolbarDisplayMode + 1 + ToolbarIsVisible + + ToolbarSizeMode + 1 + Type + Perspectives + UpdateMessage + The Default Workspace in this version of Xcode now includes support to hide and show the detail view (what has been referred to as the "Metro-Morph" feature). You must discard your current Default Workspace settings and update to the latest Default Workspace in order to gain this feature. Do you wish to update to the latest Workspace defaults for project '%@'? + WindowJustification + 5 + WindowOrderList + + /Users/xugg/Projects/Cog/Libraries/TagLib/TagLib.xcode + + WindowString + 0 120 1024 626 0 0 1024 746 + WindowTools + + + FirstTimeWindowDisplayed + + Identifier + windowTool.build + IsVertical + + Layout + + + Dock + + + ContentConfiguration + + PBXProjectModuleGUID + 1CD0528F0623707200166675 + PBXProjectModuleLabel + id3v2framefactory.cpp + StatusBarVisibility + + + GeometryConfiguration + + Frame + {{0, 0}, {500, 218}} + RubberWindowFrame + 188 213 500 500 0 0 1024 746 + + Module + PBXNavigatorGroup + Proportion + 218pt + + + BecomeActive + + ContentConfiguration + + PBXProjectModuleGUID + XCMainBuildResultsModuleGUID + PBXProjectModuleLabel + Build + XCBuildResultsTrigger_Collapse + 1021 + XCBuildResultsTrigger_Open + 1011 + + GeometryConfiguration + + Frame + {{0, 223}, {500, 236}} + RubberWindowFrame + 188 213 500 500 0 0 1024 746 + + Module + PBXBuildResultsModule + Proportion + 236pt + + + Proportion + 459pt + + + Name + Build Results + ServiceClasses + + PBXBuildResultsModule + + StatusbarIsVisible + + TableOfContents + + 8E5A8FE9084CB31B00AE6D62 + 8E5A8FEA084CB31B00AE6D62 + 1CD0528F0623707200166675 + XCMainBuildResultsModuleGUID + + ToolbarConfiguration + xcode.toolbar.config.build + WindowString + 188 213 500 500 0 0 1024 746 + WindowToolGUID + 8E5A8FE9084CB31B00AE6D62 + WindowToolIsVisible + + + + Identifier + windowTool.debugger + Layout + + + Dock + + + ContentConfiguration + + Debugger + + HorizontalSplitView + + _collapsingFrameDimension + 0.0 + _indexOfCollapsedView + 0 + _percentageOfCollapsedView + 0.0 + isCollapsed + yes + sizes + + {{0, 0}, {317, 164}} + {{317, 0}, {377, 164}} + + + VerticalSplitView + + _collapsingFrameDimension + 0.0 + _indexOfCollapsedView + 0 + _percentageOfCollapsedView + 0.0 + isCollapsed + yes + sizes + + {{0, 0}, {694, 164}} + {{0, 164}, {694, 216}} + + + + LauncherConfigVersion + 8 + PBXProjectModuleGUID + 1C162984064C10D400B95A72 + PBXProjectModuleLabel + Debug - GLUTExamples (Underwater) + + GeometryConfiguration + + DebugConsoleDrawerSize + {100, 120} + DebugConsoleVisible + None + DebugConsoleWindowFrame + {{200, 200}, {500, 300}} + DebugSTDIOWindowFrame + {{200, 200}, {500, 300}} + Frame + {{0, 0}, {694, 380}} + RubberWindowFrame + 321 238 694 422 0 0 1440 878 + + Module + PBXDebugSessionModule + Proportion + 100% + + + Proportion + 100% + + + Name + Debugger + ServiceClasses + + PBXDebugSessionModule + + StatusbarIsVisible + 1 + TableOfContents + + 1CD10A99069EF8BA00B06720 + 1C0AD2AB069F1E9B00FABCE6 + 1C162984064C10D400B95A72 + 1C0AD2AC069F1E9B00FABCE6 + + ToolbarConfiguration + xcode.toolbar.config.debug + WindowString + 321 238 694 422 0 0 1440 878 + WindowToolGUID + 1CD10A99069EF8BA00B06720 + WindowToolIsVisible + 0 + + + FirstTimeWindowDisplayed + + Identifier + windowTool.find + IsVertical + + Layout + + + Dock + + + Dock + + + BecomeActive + + ContentConfiguration + + PBXProjectModuleGUID + 1CDD528C0622207200134675 + PBXProjectModuleLabel + id3v2frame.cpp + StatusBarVisibility + + + GeometryConfiguration + + Frame + {{0, 0}, {781, 212}} + RubberWindowFrame + 188 243 781 470 0 0 1024 746 + + Module + PBXNavigatorGroup + Proportion + 781pt + + + Proportion + 212pt + + + ContentConfiguration + + PBXProjectModuleGUID + 1CD0528E0623707200166675 + PBXProjectModuleLabel + Project Find + + GeometryConfiguration + + Frame + {{0, 217}, {781, 212}} + RubberWindowFrame + 188 243 781 470 0 0 1024 746 + + Module + PBXProjectFindModule + Proportion + 212pt + + + Proportion + 429pt + + + Name + Project Find + ServiceClasses + + PBXProjectFindModule + + StatusbarIsVisible + + TableOfContents + + 1C530D57069F1CE1000CFCEE + 8E5A8FF8084CB34C00AE6D62 + 8E5A8FF9084CB34C00AE6D62 + 1CDD528C0622207200134675 + 1CD0528E0623707200166675 + + WindowString + 188 243 781 470 0 0 1024 746 + WindowToolGUID + 1C530D57069F1CE1000CFCEE + WindowToolIsVisible + + + + Identifier + MENUSEPARATOR + + + Identifier + windowTool.debuggerConsole + Layout + + + Dock + + + BecomeActive + 1 + ContentConfiguration + + PBXProjectModuleGUID + 1C78EAAC065D492600B07095 + PBXProjectModuleLabel + Debugger Console + + GeometryConfiguration + + Frame + {{0, 0}, {440, 358}} + RubberWindowFrame + 650 41 440 400 0 0 1280 1002 + + Module + PBXDebugCLIModule + Proportion + 358pt + + + Proportion + 358pt + + + Name + Debugger Console + ServiceClasses + + PBXDebugCLIModule + + StatusbarIsVisible + 1 + TableOfContents + + 1C78EAAD065D492600B07095 + 1C78EAAE065D492600B07095 + 1C78EAAC065D492600B07095 + + WindowString + 650 41 440 400 0 0 1280 1002 + + + Identifier + windowTool.run + Layout + + + Dock + + + ContentConfiguration + + LauncherConfigVersion + 3 + PBXProjectModuleGUID + 1CD0528B0623707200166675 + PBXProjectModuleLabel + Run + Runner + + HorizontalSplitView + + _collapsingFrameDimension + 0.0 + _indexOfCollapsedView + 0 + _percentageOfCollapsedView + 0.0 + isCollapsed + yes + sizes + + {{0, 0}, {493, 167}} + {{0, 176}, {493, 267}} + + + VerticalSplitView + + _collapsingFrameDimension + 0.0 + _indexOfCollapsedView + 0 + _percentageOfCollapsedView + 0.0 + isCollapsed + yes + sizes + + {{0, 0}, {405, 443}} + {{414, 0}, {514, 443}} + + + + + GeometryConfiguration + + Frame + {{0, 0}, {460, 159}} + RubberWindowFrame + 316 696 459 200 0 0 1280 1002 + + Module + PBXRunSessionModule + Proportion + 159pt + + + Proportion + 159pt + + + Name + Run Log + ServiceClasses + + PBXRunSessionModule + + StatusbarIsVisible + 1 + TableOfContents + + 1C0AD2B3069F1EA900FABCE6 + 1C0AD2B4069F1EA900FABCE6 + 1CD0528B0623707200166675 + 1C0AD2B5069F1EA900FABCE6 + + ToolbarConfiguration + xcode.toolbar.config.run + WindowString + 316 696 459 200 0 0 1280 1002 + WindowToolGUID + 1C0AD2B3069F1EA900FABCE6 + WindowToolIsVisible + 0 + + + Identifier + windowTool.scm + Layout + + + Dock + + + ContentConfiguration + + PBXProjectModuleGUID + 1C78EAB2065D492600B07095 + PBXProjectModuleLabel + <No Editor> + PBXSplitModuleInNavigatorKey + + Split0 + + PBXProjectModuleGUID + 1C78EAB3065D492600B07095 + + SplitCount + 1 + + StatusBarVisibility + 1 + + GeometryConfiguration + + Frame + {{0, 0}, {452, 0}} + RubberWindowFrame + 743 379 452 308 0 0 1280 1002 + + Module + PBXNavigatorGroup + Proportion + 0pt + + + BecomeActive + 1 + ContentConfiguration + + PBXProjectModuleGUID + 1CD052920623707200166675 + PBXProjectModuleLabel + SCM + + GeometryConfiguration + + ConsoleFrame + {{0, 259}, {452, 0}} + Frame + {{0, 7}, {452, 259}} + RubberWindowFrame + 743 379 452 308 0 0 1280 1002 + TableConfiguration + + Status + 30 + FileName + 199 + Path + 197.09500122070312 + + TableFrame + {{0, 0}, {452, 250}} + + Module + PBXCVSModule + Proportion + 262pt + + + Proportion + 266pt + + + Name + SCM + ServiceClasses + + PBXCVSModule + + StatusbarIsVisible + 1 + TableOfContents + + 1C78EAB4065D492600B07095 + 1C78EAB5065D492600B07095 + 1C78EAB2065D492600B07095 + 1CD052920623707200166675 + + ToolbarConfiguration + xcode.toolbar.config.scm + WindowString + 743 379 452 308 0 0 1280 1002 + + + Identifier + windowTool.breakpoints + Layout + + + Dock + + + BecomeActive + 1 + ContentConfiguration + + PBXProjectModuleGUID + 1CD052930623707200166675 + PBXProjectModuleLabel + Breakpoints + + GeometryConfiguration + + BreakpointsTreeTableConfiguration + + enabledColumn + 16 + breakpointColumn + 201.5830078125 + + Frame + {{0, 0}, {240, 195}} + RubberWindowFrame + 342 421 240 216 0 0 1440 878 + + Module + PBXDebugBreakpointsModule + Proportion + 195pt + + + Proportion + 195pt + + + Name + Breakpoints + ServiceClasses + + PBXDebugBreakpointsModule + + StatusbarIsVisible + 0 + TableOfContents + + 1C0AD2AD069F1E9B00FABCE6 + 1C0AD2AE069F1E9B00FABCE6 + 1CD052930623707200166675 + + WindowString + 342 421 240 216 0 0 1440 878 + WindowToolGUID + 1C0AD2AD069F1E9B00FABCE6 + WindowToolIsVisible + 0 + + + Identifier + windowTool.bookmarks + Layout + + + Dock + + + Module + PBXBookmarksModule + Proportion + 100% + + + Proportion + 100% + + + Name + Bookmarks + ServiceClasses + + PBXBookmarksModule + + StatusbarIsVisible + 0 + WindowString + 538 42 401 187 0 0 1280 1002 + + + Identifier + windowTool.classBrowser + Layout + + + Dock + + + BecomeActive + 1 + ContentConfiguration + + OptionsSetName + Hierarchy, all classes + PBXProjectModuleGUID + 1CA6456E063B45B4001379D8 + PBXProjectModuleLabel + Class Browser - NSObject + + GeometryConfiguration + + ClassesFrame + {{0, 0}, {374, 96}} + ClassesTreeTableConfiguration + + PBXClassNameColumnIdentifier + 208 + PBXClassBookColumnIdentifier + 22 + + Frame + {{0, 0}, {630, 331}} + MembersFrame + {{0, 105}, {374, 395}} + MembersTreeTableConfiguration + + PBXMemberTypeIconColumnIdentifier + 22 + PBXMemberNameColumnIdentifier + 216 + PBXMemberTypeColumnIdentifier + 97 + PBXMemberBookColumnIdentifier + 22 + + PBXModuleWindowStatusBarHidden2 + 1 + RubberWindowFrame + 385 179 630 352 0 0 1440 878 + + Module + PBXClassBrowserModule + Proportion + 332pt + + + Proportion + 332pt + + + Name + Class Browser + ServiceClasses + + PBXClassBrowserModule + + StatusbarIsVisible + 0 + TableOfContents + + 1C0AD2AF069F1E9B00FABCE6 + 1C0AD2B0069F1E9B00FABCE6 + 1CA6456E063B45B4001379D8 + + ToolbarConfiguration + xcode.toolbar.config.classbrowser + WindowString + 385 179 630 352 0 0 1440 878 + WindowToolGUID + 1C0AD2AF069F1E9B00FABCE6 + WindowToolIsVisible + 0 + + + + diff --git a/Libraries/TagLib/TagLib.xcode/xugg.pbxuser b/Libraries/TagLib/TagLib.xcode/xugg.pbxuser new file mode 100644 index 000000000..0035ca066 --- /dev/null +++ b/Libraries/TagLib/TagLib.xcode/xugg.pbxuser @@ -0,0 +1,338 @@ +// !$*UTF8*$! +{ + 0867D690FE84028FC02AAC07 = { + activeBuildStyle = 4F0BB7ED011F40E904CA0E50; + activeTarget = 8D07F2BC0486CC7A007CD1D0; + addToTargets = ( + 8D07F2BC0486CC7A007CD1D0, + ); + codeSenseManager = 8E5A8EBD084CB1B900AE6D62; + perUserDictionary = { + PBXConfiguration.PBXFileTableDataSource3.PBXFileTableDataSource = { + PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; + PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID; + PBXFileTableDataSourceColumnWidthsKey = ( + 20, + 506, + 20, + 48, + 43, + 43, + 20, + ); + PBXFileTableDataSourceColumnsKey = ( + PBXFileDataSource_FiletypeID, + PBXFileDataSource_Filename_ColumnID, + PBXFileDataSource_Built_ColumnID, + PBXFileDataSource_ObjectSize_ColumnID, + PBXFileDataSource_Errors_ColumnID, + PBXFileDataSource_Warnings_ColumnID, + PBXFileDataSource_Target_ColumnID, + ); + }; + PBXConfiguration.PBXTargetDataSource.PBXTargetDataSource = { + PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; + PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID; + PBXFileTableDataSourceColumnWidthsKey = ( + 20, + 200, + 217, + 20, + 48, + 43, + 43, + ); + PBXFileTableDataSourceColumnsKey = ( + PBXFileDataSource_FiletypeID, + PBXFileDataSource_Filename_ColumnID, + PBXTargetDataSource_PrimaryAttribute, + PBXFileDataSource_Built_ColumnID, + PBXFileDataSource_ObjectSize_ColumnID, + PBXFileDataSource_Errors_ColumnID, + PBXFileDataSource_Warnings_ColumnID, + ); + }; + PBXPerProjectTemplateStateSaveDate = 139334669; + PBXWorkspaceStateSaveDate = 139334669; + }; + perUserProjectItems = { + 8E50FC5A084E14420048349E = 8E50FC5A084E14420048349E; + 8E50FC5B084E14420048349E = 8E50FC5B084E14420048349E; + 8E50FC5C084E14420048349E = 8E50FC5C084E14420048349E; + 8E50FC5D084E14420048349E = 8E50FC5D084E14420048349E; + 8E50FC5E084E14420048349E = 8E50FC5E084E14420048349E; + 8E50FC5F084E14420048349E = 8E50FC5F084E14420048349E; + 8E50FC60084E14420048349E = 8E50FC60084E14420048349E; + 8E50FC61084E14420048349E = 8E50FC61084E14420048349E; + 8E5A907C084CB91900AE6D62 = 8E5A907C084CB91900AE6D62; + 8E5A907D084CB91900AE6D62 = 8E5A907D084CB91900AE6D62; + 8E5A907E084CB91900AE6D62 = 8E5A907E084CB91900AE6D62; + 8E5A907F084CB91900AE6D62 = 8E5A907F084CB91900AE6D62; + 8E5A9081084CB91900AE6D62 = 8E5A9081084CB91900AE6D62; + 8E5A9082084CB91900AE6D62 = 8E5A9082084CB91900AE6D62; + 8E5A9083084CB91900AE6D62 = 8E5A9083084CB91900AE6D62; + 8E5A9085084CB91900AE6D62 = 8E5A9085084CB91900AE6D62; + 8E5A9086084CB91900AE6D62 = 8E5A9086084CB91900AE6D62; + }; + sourceControlManager = 8E5A8EBC084CB1B900AE6D62; + userBuildSettings = { + }; + }; + 8D07F2BC0486CC7A007CD1D0 = { + activeExec = 0; + }; + 8E50FC5A084E14420048349E = { + fRef = 8E5A8FDE084CB2F700AE6D62; + isa = PBXTextBookmark; + name = "tag_c.cpp: 205"; + rLen = 0; + rLoc = 6194; + rType = 0; + vrLen = 736; + vrLoc = 5857; + }; + 8E50FC5B084E14420048349E = { + fRef = 8E5A8F5A084CB29600AE6D62; + isa = PBXTextBookmark; + name = "unicode.cpp: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1411; + vrLoc = 0; + }; + 8E50FC5C084E14420048349E = { + fRef = 8E5A8F59084CB29600AE6D62; + isa = PBXTextBookmark; + name = "tstringlist.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1562; + vrLoc = 0; + }; + 8E50FC5D084E14420048349E = { + fRef = 8E5A8F58084CB29600AE6D62; + isa = PBXBookmark; + }; + 8E50FC5E084E14420048349E = { + fRef = 8E5A8FDE084CB2F700AE6D62; + isa = PBXTextBookmark; + name = "tag_c.cpp: 205"; + rLen = 0; + rLoc = 6194; + rType = 0; + vrLen = 736; + vrLoc = 5857; + }; + 8E50FC5F084E14420048349E = { + fRef = 8E5A8F5A084CB29600AE6D62; + isa = PBXTextBookmark; + name = "unicode.cpp: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1411; + vrLoc = 0; + }; + 8E50FC60084E14420048349E = { + fRef = 8E5A8F59084CB29600AE6D62; + isa = PBXTextBookmark; + name = "tstringlist.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1562; + vrLoc = 0; + }; + 8E50FC61084E14420048349E = { + fRef = 8E5A8F58084CB29600AE6D62; + isa = PBXTextBookmark; + name = "tstringlist.cpp: 15"; + rLen = 0; + rLoc = 953; + rType = 0; + vrLen = 542; + vrLoc = 2817; + }; + 8E5A8EBC084CB1B900AE6D62 = { + fallbackIsa = XCSourceControlManager; + isSCMEnabled = 0; + isa = PBXSourceControlManager; + scmConfiguration = { + }; + scmType = ""; + }; + 8E5A8EBD084CB1B900AE6D62 = { + indexTemplatePath = ""; + isa = PBXCodeSenseManager; + }; + 8E5A8F16084CB29600AE6D62 = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {740, 6552}}"; + sepNavSelRange = "{4123, 0}"; + sepNavVisRect = "{{0, 2339}, {740, 180}}"; + }; + }; + 8E5A8F18084CB29600AE6D62 = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {530, 4340}}"; + sepNavSelRange = "{1415, 20}"; + sepNavVisRect = "{{0, 208}, {459, 186}}"; + }; + }; + 8E5A8F43084CB29600AE6D62 = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {704, 1120}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRect = "{{0, 0}, {704, 548}}"; + }; + }; + 8E5A8F44084CB29600AE6D62 = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {704, 2366}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRect = "{{0, 0}, {704, 197}}"; + }; + }; + 8E5A8F53084CB29600AE6D62 = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {977, 4158}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRect = "{{0, 529}, {977, 551}}"; + sepNavWindowFrame = "{{15, 61}, {1016, 680}}"; + }; + }; + 8E5A8F58084CB29600AE6D62 = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {704, 1666}}"; + sepNavSelRange = "{953, 0}"; + sepNavVisRect = "{{0, 1263}, {704, 403}}"; + }; + }; + 8E5A8F59084CB29600AE6D62 = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {704, 1554}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRect = "{{0, 0}, {704, 403}}"; + }; + }; + 8E5A8F5A084CB29600AE6D62 = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {704, 4256}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRect = "{{0, 0}, {704, 403}}"; + }; + }; + 8E5A8FDE084CB2F700AE6D62 = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {704, 3332}}"; + sepNavSelRange = "{6194, 0}"; + sepNavVisRect = "{{0, 2607}, {704, 403}}"; + }; + }; + 8E5A8FDF084CB2F700AE6D62 = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {704, 3514}}"; + sepNavSelRange = "{5570, 0}"; + sepNavVisRect = "{{0, 2716}, {704, 403}}"; + }; + }; + 8E5A8FFA084CB37000AE6D62 = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {488, 924}}"; + sepNavSelRange = "{1070, 0}"; + sepNavVisRect = "{{0, 366}, {370, 319}}"; + }; + }; + 8E5A907C084CB91900AE6D62 = { + fRef = 8E5A8FFA084CB37000AE6D62; + isa = PBXTextBookmark; + name = "config.h: 38"; + rLen = 0; + rLoc = 1070; + rType = 0; + vrLen = 554; + vrLoc = 778; + }; + 8E5A907D084CB91900AE6D62 = { + fRef = 8E5A8F43084CB29600AE6D62; + isa = PBXTextBookmark; + name = "tag.cpp: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1516; + vrLoc = 0; + }; + 8E5A907E084CB91900AE6D62 = { + fRef = 8E5A8F44084CB29600AE6D62; + isa = PBXTextBookmark; + name = "tag.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1022; + vrLoc = 0; + }; + 8E5A907F084CB91900AE6D62 = { + fRef = 8E5A8FDF084CB2F700AE6D62; + isa = PBXTextBookmark; + name = "tag_c.h: 157"; + rLen = 0; + rLoc = 5570; + rType = 0; + vrLen = 791; + vrLoc = 6433; + }; + 8E5A9081084CB91900AE6D62 = { + fRef = 8E5A8FFA084CB37000AE6D62; + isa = PBXTextBookmark; + name = "config.h: 38"; + rLen = 0; + rLoc = 1070; + rType = 0; + vrLen = 554; + vrLoc = 778; + }; + 8E5A9082084CB91900AE6D62 = { + fRef = 8E5A8FDF084CB2F700AE6D62; + isa = PBXTextBookmark; + name = "tag_c.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1139; + vrLoc = 4604; + }; + 8E5A9083084CB91900AE6D62 = { + fRef = 8E5A8FDE084CB2F700AE6D62; + isa = PBXTextBookmark; + name = "tag_c.cpp: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1737; + vrLoc = 0; + }; + 8E5A9085084CB91900AE6D62 = { + fRef = 8E5A8F43084CB29600AE6D62; + isa = PBXTextBookmark; + name = "tag.cpp: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1516; + vrLoc = 0; + }; + 8E5A9086084CB91900AE6D62 = { + fRef = 8E5A8F44084CB29600AE6D62; + isa = PBXTextBookmark; + name = "tag.h: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 1975; + vrLoc = 0; + }; +} diff --git a/Libraries/Vorbis/.cvsignore b/Libraries/Vorbis/.cvsignore new file mode 100644 index 000000000..76a225de6 --- /dev/null +++ b/Libraries/Vorbis/.cvsignore @@ -0,0 +1,18 @@ +aclocal.m4 +config.h.in +Makefile.in +Makefile +config.status +libtool +ltmain.sh +config.cache +config.log +config.sub +config.guess +configure +*.gz +*.zip +.libs +.deps +*.ogg +vorbis-config diff --git a/Libraries/Vorbis/English.lproj/InfoPlist.strings b/Libraries/Vorbis/English.lproj/InfoPlist.strings new file mode 100644 index 0000000000000000000000000000000000000000..cfe1b22a882c2fbdf1a83e1f56d3003b12e59d29 GIT binary patch literal 142 zcmW-Z!3u&<5Jk`0uXwn0VIL4~3IZWoy027-Qo~n4e!O~+Vdl=g9PYfZBO`ET;Lep7 z4<;IFv!6N=O$K^3sI9luwf;HpjgNdxpVI%0%Ir*>BPR}grE9r{i~XG%DBP6Fj**-F IQMV^q0h_28>Hq)$ literal 0 HcmV?d00001 diff --git a/Libraries/Vorbis/Files/AUTHORS b/Libraries/Vorbis/Files/AUTHORS new file mode 100644 index 000000000..0da10363c --- /dev/null +++ b/Libraries/Vorbis/Files/AUTHORS @@ -0,0 +1,3 @@ +Monty + +and the rest of the Xiph.org Foundation. diff --git a/Libraries/Vorbis/Files/CHANGES b/Libraries/Vorbis/Files/CHANGES new file mode 100644 index 000000000..5a654413a --- /dev/null +++ b/Libraries/Vorbis/Files/CHANGES @@ -0,0 +1,23 @@ +libvorbis 1.1.0 (2004-09-22) -- "Xiph.Org libVorbis I 20040629" + + * merges tuning improvements from Aoyumi's aoTuV with fixups + * new managed bitrate (CBR) mode support + * new vorbis_encoder_ctl() interface + * extensive documentation updates + * application/ogg mimetype is now official + * autotools cleanup from Thomas Vander Stichele + * SymbianOS build support from Colin Ward at CSIRO + * various bugfixes + * various packaging improvements + +libvorbis 1.0.1 (2003-11-17) -- "Xiph.Org libVorbis I 20030909" + + * numerous bug fixes + * specification corrections + * new crosslap and halfrate APIs for game use + * packaging and build updates + +libvorbis 1.0.0 (2002-07-19) -- "Xiph.Org libVorbis I 20020717" + + * first stable release + diff --git a/Libraries/Vorbis/Files/COPYING b/Libraries/Vorbis/Files/COPYING new file mode 100644 index 000000000..7cf076b68 --- /dev/null +++ b/Libraries/Vorbis/Files/COPYING @@ -0,0 +1,28 @@ +Copyright (c) 2002-2004 Xiph.org Foundation + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +- Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + +- Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + +- Neither the name of the Xiph.org Foundation nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION +OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/Libraries/Vorbis/Files/README b/Libraries/Vorbis/Files/README new file mode 100644 index 000000000..06b9653aa --- /dev/null +++ b/Libraries/Vorbis/Files/README @@ -0,0 +1,130 @@ +******************************************************************** +* * +* THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * +* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * +* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * +* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * +* * +* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2004 * +* by the Xiph.org Foundation, http://www.xiph.org/ * +* * +******************************************************************** + +Vorbis is a general purpose audio and music encoding format +contemporary to MPEG-4's AAC and TwinVQ, the next generation beyond +MPEG audio layer 3. Unlike the MPEG sponsored formats (and other +proprietary formats such as RealAudio G2 and Windows' flavor of the +month), the Vorbis CODEC specification belongs to the public domain. +All the technical details are published and documented, and any +software entity may make full use of the format without license +fee, royalty or patent concerns. + +This package contains: + +* libvorbis, a BSD-style license software implementation of + the Vorbis specification by the Xiph.Org Foundation + (http://www.xiph.org/) + +* libvorbisfile, a BSD-style license convenience library + built on Vorbis designed to simplify common uses + +* libvorbisenc, a BSD-style license library that provides a simple, + programmatic encoding setup interface + +* example code making use of libogg, libvorbis, libvorbisfile and + libvorbisenc + +WHAT'S HERE: + +This source distribution includes libvorbis and an example +encoder/player to demonstrate use of libvorbis as well as +documentation on the Ogg Vorbis audio coding format. + +You'll need libogg (distributed separately) to compile this library. +A more comprehensive set of utilities is available in the vorbis-tools +package. + +Directory: + +./lib The source for the libraries, a BSD-license implementation + of the public domain Ogg Vorbis audio encoding format. + +./include Library API headers + +./debian Rules/spec files for building Debian .deb packages + +./doc Vorbis documentation + +./examples Example code illustrating programmatic use of libvorbis, + libvorbisfile and libvorbisenc + +./mac Codewarrior project files and build tweaks for MacOS. + +./macosx Project files for MacOS X. + +./win32 Win32 projects files and build automation + +./vq Internal utilities for training/building new LSP/residue + and auxiliary codebooks. + +CONTACT: + +The Ogg homepage is located at 'http://www.xiph.org/ogg/'. +Vorbis's homepage is located at 'http://www.xiph.org/ogg/vorbis/'. +Up to date technical documents, contact information, source code and +pre-built utilities may be found there. + +BUILDING FROM TRUNK: + +Development source is under subversion revision control at +http://svn.xiph.org/trunk/vorbis/. You will also need the +newest versions of autoconf, automake, and libtool in order +to compile vorbis from development source. A configure script +is provided for you in the source tarball distributions. + + [update or checkout latest source] + ./autogen.sh + make + +and as root if desired: + + make install + +This will install the vorbis libraries (static and shared) into +/usr/local/lib, includes into /usr/local/include and API manpages +(once we write some) into /usr/local/man. + +BUILDING FROM TARBALL DISTRIBUTIONS: + + ./configure + make + +and optionally (as root): + make install + +BUILDING RPMS: + +after normal configuring: + + make dist + rpm -ta libvorbis-.tar.gz + +BUILDING ON MACOS 9: + +Vorbis on MacOS 9 is built using Metroworks CodeWarrior. To build it, +first verify that the Ogg libraries are already built following the +instructions in the Ogg module README. Open vorbis/mac/libvorbis.mcp, +switch to the "Targets" pane, select everything, and make the project. +Do the same thing to build libvorbisenc.mcp, and libvorbisfile.mcp (in +that order). In vorbis/mac/Output you will now have both debug and final +versions of Vorbis shared libraries to link your projects against. + +To build a project using Ogg Vorbis, add access paths to your +CodeWarrior project for the ogg/include, ogg/mac/Output, +vorbis/include, and vorbis/mac/Output folders. Be sure that +"interpret DOS and Unix paths" is turned on in your project; it can +be found in the "access paths" pane in your project settings. Now +simply add the shared libraries you need to your project (OggLib and +VorbisLib at least) and #include "ogg/ogg.h" and "vorbis/codec.h" +wherever you need to access Ogg and Vorbis functionality. + diff --git a/Libraries/Vorbis/Files/include/.cvsignore b/Libraries/Vorbis/Files/include/.cvsignore new file mode 100644 index 000000000..282522db0 --- /dev/null +++ b/Libraries/Vorbis/Files/include/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/Libraries/Vorbis/Files/include/Makefile.am b/Libraries/Vorbis/Files/include/Makefile.am new file mode 100644 index 000000000..0f34fab4c --- /dev/null +++ b/Libraries/Vorbis/Files/include/Makefile.am @@ -0,0 +1,3 @@ +## Process this file with automake to produce Makefile.in + +SUBDIRS = vorbis diff --git a/Libraries/Vorbis/Files/include/vorbis/.cvsignore b/Libraries/Vorbis/Files/include/vorbis/.cvsignore new file mode 100644 index 000000000..282522db0 --- /dev/null +++ b/Libraries/Vorbis/Files/include/vorbis/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/Libraries/Vorbis/Files/include/vorbis/Makefile.am b/Libraries/Vorbis/Files/include/vorbis/Makefile.am new file mode 100644 index 000000000..cb45cf78f --- /dev/null +++ b/Libraries/Vorbis/Files/include/vorbis/Makefile.am @@ -0,0 +1,7 @@ +## Process this file with automake to produce Makefile.in + +includedir = $(prefix)/include/vorbis + +include_HEADERS = codec.h vorbisfile.h vorbisenc.h + + diff --git a/Libraries/Vorbis/Files/include/vorbis/codec.h b/Libraries/Vorbis/Files/include/vorbis/codec.h new file mode 100644 index 000000000..617f7f4d4 --- /dev/null +++ b/Libraries/Vorbis/Files/include/vorbis/codec.h @@ -0,0 +1,240 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * + * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 * + * by the XIPHOPHORUS Company http://www.xiph.org/ * + + ******************************************************************** + + function: libvorbis codec headers + last mod: $Id$ + + ********************************************************************/ + +#ifndef _vorbis_codec_h_ +#define _vorbis_codec_h_ + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#include + +typedef struct vorbis_info{ + int version; + int channels; + long rate; + + /* The below bitrate declarations are *hints*. + Combinations of the three values carry the following implications: + + all three set to the same value: + implies a fixed rate bitstream + only nominal set: + implies a VBR stream that averages the nominal bitrate. No hard + upper/lower limit + upper and or lower set: + implies a VBR bitstream that obeys the bitrate limits. nominal + may also be set to give a nominal rate. + none set: + the coder does not care to speculate. + */ + + long bitrate_upper; + long bitrate_nominal; + long bitrate_lower; + long bitrate_window; + + void *codec_setup; +} vorbis_info; + +/* vorbis_dsp_state buffers the current vorbis audio + analysis/synthesis state. The DSP state belongs to a specific + logical bitstream ****************************************************/ +typedef struct vorbis_dsp_state{ + int analysisp; + vorbis_info *vi; + + float **pcm; + float **pcmret; + int pcm_storage; + int pcm_current; + int pcm_returned; + + int preextrapolate; + int eofflag; + + long lW; + long W; + long nW; + long centerW; + + ogg_int64_t granulepos; + ogg_int64_t sequence; + + ogg_int64_t glue_bits; + ogg_int64_t time_bits; + ogg_int64_t floor_bits; + ogg_int64_t res_bits; + + void *backend_state; +} vorbis_dsp_state; + +typedef struct vorbis_block{ + /* necessary stream state for linking to the framing abstraction */ + float **pcm; /* this is a pointer into local storage */ + oggpack_buffer opb; + + long lW; + long W; + long nW; + int pcmend; + int mode; + + int eofflag; + ogg_int64_t granulepos; + ogg_int64_t sequence; + vorbis_dsp_state *vd; /* For read-only access of configuration */ + + /* local storage to avoid remallocing; it's up to the mapping to + structure it */ + void *localstore; + long localtop; + long localalloc; + long totaluse; + struct alloc_chain *reap; + + /* bitmetrics for the frame */ + long glue_bits; + long time_bits; + long floor_bits; + long res_bits; + + void *internal; + +} vorbis_block; + +/* vorbis_block is a single block of data to be processed as part of +the analysis/synthesis stream; it belongs to a specific logical +bitstream, but is independant from other vorbis_blocks belonging to +that logical bitstream. *************************************************/ + +struct alloc_chain{ + void *ptr; + struct alloc_chain *next; +}; + +/* vorbis_info contains all the setup information specific to the + specific compression/decompression mode in progress (eg, + psychoacoustic settings, channel setup, options, codebook + etc). vorbis_info and substructures are in backends.h. +*********************************************************************/ + +/* the comments are not part of vorbis_info so that vorbis_info can be + static storage */ +typedef struct vorbis_comment{ + /* unlimited user comment fields. libvorbis writes 'libvorbis' + whatever vendor is set to in encode */ + char **user_comments; + int *comment_lengths; + int comments; + char *vendor; + +} vorbis_comment; + + +/* libvorbis encodes in two abstraction layers; first we perform DSP + and produce a packet (see docs/analysis.txt). The packet is then + coded into a framed OggSquish bitstream by the second layer (see + docs/framing.txt). Decode is the reverse process; we sync/frame + the bitstream and extract individual packets, then decode the + packet back into PCM audio. + + The extra framing/packetizing is used in streaming formats, such as + files. Over the net (such as with UDP), the framing and + packetization aren't necessary as they're provided by the transport + and the streaming layer is not used */ + +/* Vorbis PRIMITIVES: general ***************************************/ + +extern void vorbis_info_init(vorbis_info *vi); +extern void vorbis_info_clear(vorbis_info *vi); +extern int vorbis_info_blocksize(vorbis_info *vi,int zo); +extern void vorbis_comment_init(vorbis_comment *vc); +extern void vorbis_comment_add(vorbis_comment *vc, char *comment); +extern void vorbis_comment_add_tag(vorbis_comment *vc, + char *tag, char *contents); +extern char *vorbis_comment_query(vorbis_comment *vc, char *tag, int count); +extern int vorbis_comment_query_count(vorbis_comment *vc, char *tag); +extern void vorbis_comment_clear(vorbis_comment *vc); + +extern int vorbis_block_init(vorbis_dsp_state *v, vorbis_block *vb); +extern int vorbis_block_clear(vorbis_block *vb); +extern void vorbis_dsp_clear(vorbis_dsp_state *v); +extern double vorbis_granule_time(vorbis_dsp_state *v, + ogg_int64_t granulepos); + +/* Vorbis PRIMITIVES: analysis/DSP layer ****************************/ + +extern int vorbis_analysis_init(vorbis_dsp_state *v,vorbis_info *vi); +extern int vorbis_commentheader_out(vorbis_comment *vc, ogg_packet *op); +extern int vorbis_analysis_headerout(vorbis_dsp_state *v, + vorbis_comment *vc, + ogg_packet *op, + ogg_packet *op_comm, + ogg_packet *op_code); +extern float **vorbis_analysis_buffer(vorbis_dsp_state *v,int vals); +extern int vorbis_analysis_wrote(vorbis_dsp_state *v,int vals); +extern int vorbis_analysis_blockout(vorbis_dsp_state *v,vorbis_block *vb); +extern int vorbis_analysis(vorbis_block *vb,ogg_packet *op); + +extern int vorbis_bitrate_addblock(vorbis_block *vb); +extern int vorbis_bitrate_flushpacket(vorbis_dsp_state *vd, + ogg_packet *op); + +/* Vorbis PRIMITIVES: synthesis layer *******************************/ +extern int vorbis_synthesis_headerin(vorbis_info *vi,vorbis_comment *vc, + ogg_packet *op); + +extern int vorbis_synthesis_init(vorbis_dsp_state *v,vorbis_info *vi); +extern int vorbis_synthesis_restart(vorbis_dsp_state *v); +extern int vorbis_synthesis(vorbis_block *vb,ogg_packet *op); +extern int vorbis_synthesis_trackonly(vorbis_block *vb,ogg_packet *op); +extern int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb); +extern int vorbis_synthesis_pcmout(vorbis_dsp_state *v,float ***pcm); +extern int vorbis_synthesis_lapout(vorbis_dsp_state *v,float ***pcm); +extern int vorbis_synthesis_read(vorbis_dsp_state *v,int samples); +extern long vorbis_packet_blocksize(vorbis_info *vi,ogg_packet *op); + +extern int vorbis_synthesis_halfrate(vorbis_info *v,int flag); +extern int vorbis_synthesis_halfrate_p(vorbis_info *v); + +/* Vorbis ERRORS and return codes ***********************************/ + +#define OV_FALSE -1 +#define OV_EOF -2 +#define OV_HOLE -3 + +#define OV_EREAD -128 +#define OV_EFAULT -129 +#define OV_EIMPL -130 +#define OV_EINVAL -131 +#define OV_ENOTVORBIS -132 +#define OV_EBADHEADER -133 +#define OV_EVERSION -134 +#define OV_ENOTAUDIO -135 +#define OV_EBADPACKET -136 +#define OV_EBADLINK -137 +#define OV_ENOSEEK -138 + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif + diff --git a/Libraries/Vorbis/Files/include/vorbis/vorbisenc.h b/Libraries/Vorbis/Files/include/vorbis/vorbisenc.h new file mode 100644 index 000000000..211ea3996 --- /dev/null +++ b/Libraries/Vorbis/Files/include/vorbis/vorbisenc.h @@ -0,0 +1,112 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * + * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 * + * by the XIPHOPHORUS Company http://www.xiph.org/ * + * * + ******************************************************************** + + function: vorbis encode-engine setup + last mod: $Id$ + + ********************************************************************/ + +#ifndef _OV_ENC_H_ +#define _OV_ENC_H_ + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#include "codec.h" + +extern int vorbis_encode_init(vorbis_info *vi, + long channels, + long rate, + + long max_bitrate, + long nominal_bitrate, + long min_bitrate); + +extern int vorbis_encode_setup_managed(vorbis_info *vi, + long channels, + long rate, + + long max_bitrate, + long nominal_bitrate, + long min_bitrate); + +extern int vorbis_encode_setup_vbr(vorbis_info *vi, + long channels, + long rate, + + float quality /* quality level from 0. (lo) to 1. (hi) */ + ); + +extern int vorbis_encode_init_vbr(vorbis_info *vi, + long channels, + long rate, + + float base_quality /* quality level from 0. (lo) to 1. (hi) */ + ); + +extern int vorbis_encode_setup_init(vorbis_info *vi); + +extern int vorbis_encode_ctl(vorbis_info *vi,int number,void *arg); + + /* deprecated rate management supported only for compatability */ +#define OV_ECTL_RATEMANAGE_GET 0x10 +#define OV_ECTL_RATEMANAGE_SET 0x11 +#define OV_ECTL_RATEMANAGE_AVG 0x12 +#define OV_ECTL_RATEMANAGE_HARD 0x13 + +struct ovectl_ratemanage_arg { + int management_active; + + long bitrate_hard_min; + long bitrate_hard_max; + double bitrate_hard_window; + + long bitrate_av_lo; + long bitrate_av_hi; + double bitrate_av_window; + double bitrate_av_window_center; +}; + + + /* new rate setup */ +#define OV_ECTL_RATEMANAGE2_GET 0x14 +#define OV_ECTL_RATEMANAGE2_SET 0x15 + +struct ovectl_ratemanage2_arg { + int management_active; + + long bitrate_limit_min_kbps; + long bitrate_limit_max_kbps; + long bitrate_limit_reservoir_bits; + double bitrate_limit_reservoir_bias; + + long bitrate_average_kbps; + double bitrate_average_damping; +}; + + + +#define OV_ECTL_LOWPASS_GET 0x20 +#define OV_ECTL_LOWPASS_SET 0x21 + +#define OV_ECTL_IBLOCK_GET 0x30 +#define OV_ECTL_IBLOCK_SET 0x31 + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif + + diff --git a/Libraries/Vorbis/Files/include/vorbis/vorbisfile.h b/Libraries/Vorbis/Files/include/vorbis/vorbisfile.h new file mode 100644 index 000000000..1f207e8df --- /dev/null +++ b/Libraries/Vorbis/Files/include/vorbis/vorbisfile.h @@ -0,0 +1,143 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * + * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 * + * by the XIPHOPHORUS Company http://www.xiph.org/ * + * * + ******************************************************************** + + function: stdio-based convenience library for opening/seeking/decoding + last mod: $Id$ + + ********************************************************************/ + +#ifndef _OV_FILE_H_ +#define _OV_FILE_H_ + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#include +#include "codec.h" + +/* The function prototypes for the callbacks are basically the same as for + * the stdio functions fread, fseek, fclose, ftell. + * The one difference is that the FILE * arguments have been replaced with + * a void * - this is to be used as a pointer to whatever internal data these + * functions might need. In the stdio case, it's just a FILE * cast to a void * + * + * If you use other functions, check the docs for these functions and return + * the right values. For seek_func(), you *MUST* return -1 if the stream is + * unseekable + */ +typedef struct { + size_t (*read_func) (void *ptr, size_t size, size_t nmemb, void *datasource); + int (*seek_func) (void *datasource, ogg_int64_t offset, int whence); + int (*close_func) (void *datasource); + long (*tell_func) (void *datasource); +} ov_callbacks; + +#define NOTOPEN 0 +#define PARTOPEN 1 +#define OPENED 2 +#define STREAMSET 3 +#define INITSET 4 + +typedef struct OggVorbis_File { + void *datasource; /* Pointer to a FILE *, etc. */ + int seekable; + ogg_int64_t offset; + ogg_int64_t end; + ogg_sync_state oy; + + /* If the FILE handle isn't seekable (eg, a pipe), only the current + stream appears */ + int links; + ogg_int64_t *offsets; + ogg_int64_t *dataoffsets; + long *serialnos; + ogg_int64_t *pcmlengths; /* overloaded to maintain binary + compatability; x2 size, stores both + beginning and end values */ + vorbis_info *vi; + vorbis_comment *vc; + + /* Decoding working state local storage */ + ogg_int64_t pcm_offset; + int ready_state; + long current_serialno; + int current_link; + + double bittrack; + double samptrack; + + ogg_stream_state os; /* take physical pages, weld into a logical + stream of packets */ + vorbis_dsp_state vd; /* central working state for the packet->PCM decoder */ + vorbis_block vb; /* local working space for packet->PCM decode */ + + ov_callbacks callbacks; + +} OggVorbis_File; + +extern int ov_clear(OggVorbis_File *vf); +extern int ov_open(FILE *f,OggVorbis_File *vf,char *initial,long ibytes); +extern int ov_open_callbacks(void *datasource, OggVorbis_File *vf, + char *initial, long ibytes, ov_callbacks callbacks); + +extern int ov_test(FILE *f,OggVorbis_File *vf,char *initial,long ibytes); +extern int ov_test_callbacks(void *datasource, OggVorbis_File *vf, + char *initial, long ibytes, ov_callbacks callbacks); +extern int ov_test_open(OggVorbis_File *vf); + +extern long ov_bitrate(OggVorbis_File *vf,int i); +extern long ov_bitrate_instant(OggVorbis_File *vf); +extern long ov_streams(OggVorbis_File *vf); +extern long ov_seekable(OggVorbis_File *vf); +extern long ov_serialnumber(OggVorbis_File *vf,int i); + +extern ogg_int64_t ov_raw_total(OggVorbis_File *vf,int i); +extern ogg_int64_t ov_pcm_total(OggVorbis_File *vf,int i); +extern double ov_time_total(OggVorbis_File *vf,int i); + +extern int ov_raw_seek(OggVorbis_File *vf,ogg_int64_t pos); +extern int ov_pcm_seek(OggVorbis_File *vf,ogg_int64_t pos); +extern int ov_pcm_seek_page(OggVorbis_File *vf,ogg_int64_t pos); +extern int ov_time_seek(OggVorbis_File *vf,double pos); +extern int ov_time_seek_page(OggVorbis_File *vf,double pos); + +extern int ov_raw_seek_lap(OggVorbis_File *vf,ogg_int64_t pos); +extern int ov_pcm_seek_lap(OggVorbis_File *vf,ogg_int64_t pos); +extern int ov_pcm_seek_page_lap(OggVorbis_File *vf,ogg_int64_t pos); +extern int ov_time_seek_lap(OggVorbis_File *vf,double pos); +extern int ov_time_seek_page_lap(OggVorbis_File *vf,double pos); + +extern ogg_int64_t ov_raw_tell(OggVorbis_File *vf); +extern ogg_int64_t ov_pcm_tell(OggVorbis_File *vf); +extern double ov_time_tell(OggVorbis_File *vf); + +extern vorbis_info *ov_info(OggVorbis_File *vf,int link); +extern vorbis_comment *ov_comment(OggVorbis_File *vf,int link); + +extern long ov_read_float(OggVorbis_File *vf,float ***pcm_channels,int samples, + int *bitstream); +extern long ov_read(OggVorbis_File *vf,char *buffer,int length, + int bigendianp,int word,int sgned,int *bitstream); +extern int ov_crosslap(OggVorbis_File *vf1,OggVorbis_File *vf2); + +extern int ov_halfrate(OggVorbis_File *vf,int flag); +extern int ov_halfrate_p(OggVorbis_File *vf); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif + + diff --git a/Libraries/Vorbis/Files/lib/.cvsignore b/Libraries/Vorbis/Files/lib/.cvsignore new file mode 100644 index 000000000..0839b71df --- /dev/null +++ b/Libraries/Vorbis/Files/lib/.cvsignore @@ -0,0 +1,6 @@ +*.la +*.lo +.libs +.deps +Makefile +Makefile.in diff --git a/Libraries/Vorbis/Files/lib/Makefile.am b/Libraries/Vorbis/Files/lib/Makefile.am new file mode 100644 index 000000000..8929e0757 --- /dev/null +++ b/Libraries/Vorbis/Files/lib/Makefile.am @@ -0,0 +1,44 @@ +## Process this file with automake to produce Makefile.in + +SUBDIRS = modes books + +INCLUDES = -I$(top_srcdir)/include @OGG_CFLAGS@ + +lib_LTLIBRARIES = libvorbis.la libvorbisfile.la libvorbisenc.la + +libvorbis_la_SOURCES = mdct.c smallft.c block.c envelope.c window.c lsp.c \ + lpc.c analysis.c synthesis.c psy.c info.c \ + floor1.c floor0.c\ + res0.c mapping0.c registry.c codebook.c sharedbook.c\ + lookup.c bitrate.c\ + envelope.h lpc.h lsp.h codebook.h misc.h psy.h\ + masking.h os.h mdct.h smallft.h highlevel.h\ + registry.h scales.h window.h lookup.h lookup_data.h\ + codec_internal.h backends.h bitrate.h +libvorbis_la_LDFLAGS = -no-undefined -version-info @V_LIB_CURRENT@:@V_LIB_REVISION@:@V_LIB_AGE@ +libvorbis_la_LIBADD = @OGG_LIBS@ @VORBIS_LIBS@ + +libvorbisfile_la_SOURCES = vorbisfile.c +libvorbisfile_la_LDFLAGS = -no-undefined -version-info @VF_LIB_CURRENT@:@VF_LIB_REVISION@:@VF_LIB_AGE@ +libvorbisfile_la_LIBADD = libvorbis.la + +libvorbisenc_la_SOURCES = vorbisenc.c +libvorbisenc_la_LDFLAGS = -no-undefined -version-info @VE_LIB_CURRENT@:@VE_LIB_REVISION@:@VE_LIB_AGE@ +libvorbisenc_la_LIBADD = libvorbis.la + +EXTRA_PROGRAMS = barkmel tone psytune +CLEANFILES = $(EXTRA_PROGRAMS) + +barkmel_SOURCES = barkmel.c +tone_SOURCES = tone.c +psytune_SOURCES = psytune.c +psytune_LDFLAGS = -static +psytune_LDADD = libvorbis.la + +EXTRA_DIST = lookups.pl + +debug: + $(MAKE) all CFLAGS="@DEBUG@" + +profile: + $(MAKE) all CFLAGS="@PROFILE@" diff --git a/Libraries/Vorbis/Files/lib/analysis.c b/Libraries/Vorbis/Files/lib/analysis.c new file mode 100644 index 000000000..1097c1de5 --- /dev/null +++ b/Libraries/Vorbis/Files/lib/analysis.c @@ -0,0 +1,121 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * + * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * + * by the XIPHOPHORUS Company http://www.xiph.org/ * + * * + ******************************************************************** + + function: single-block PCM analysis mode dispatch + last mod: $Id$ + + ********************************************************************/ + +#include +#include +#include +#include +#include "vorbis/codec.h" +#include "codec_internal.h" +#include "registry.h" +#include "scales.h" +#include "os.h" +#include "misc.h" + +int analysis_noisy=1; + +/* decides between modes, dispatches to the appropriate mapping. */ +int vorbis_analysis(vorbis_block *vb, ogg_packet *op){ + int ret,i; + vorbis_block_internal *vbi=vb->internal; + + vb->glue_bits=0; + vb->time_bits=0; + vb->floor_bits=0; + vb->res_bits=0; + + /* first things first. Make sure encode is ready */ + for(i=0;ipacketblob[i]); + + /* we only have one mapping type (0), and we let the mapping code + itself figure out what soft mode to use. This allows easier + bitrate management */ + + if((ret=_mapping_P[0]->forward(vb))) + return(ret); + + if(op){ + if(vorbis_bitrate_managed(vb)) + /* The app is using a bitmanaged mode... but not using the + bitrate management interface. */ + return(OV_EINVAL); + + op->packet=oggpack_get_buffer(&vb->opb); + op->bytes=oggpack_bytes(&vb->opb); + op->b_o_s=0; + op->e_o_s=vb->eofflag; + op->granulepos=vb->granulepos; + op->packetno=vb->sequence; /* for sake of completeness */ + } + return(0); +} + +/* there was no great place to put this.... */ +void _analysis_output_always(char *base,int i,float *v,int n,int bark,int dB,ogg_int64_t off){ + int j; + FILE *of; + char buffer[80]; + + /* if(i==5870){*/ + sprintf(buffer,"%s_%d.m",base,i); + of=fopen(buffer,"w"); + + if(!of)perror("failed to open data dump file"); + + for(j=0;j +#include "scales.h" +int main(){ + int i; + double rate; + for(i=64;i<32000;i*=2){ + rate=48000.f; + fprintf(stderr,"rate=%gHz, block=%d, f(1)=%.2gHz bark(1)=%.2g (of %.2g)\n", + rate,i,rate/2 / (i/2),toBARK(rate/2 /(i/2)),toBARK(rate/2)); + + rate=44100.f; + fprintf(stderr,"rate=%gHz, block=%d, f(1)=%.2gHz bark(1)=%.2g (of %.2g)\n", + rate,i,rate/2 / (i/2),toBARK(rate/2 /(i/2)),toBARK(rate/2)); + + rate=32000.f; + fprintf(stderr,"rate=%gHz, block=%d, f(1)=%.2gHz bark(1)=%.2g (of %.2g)\n", + rate,i,rate/2 / (i/2),toBARK(rate/2 /(i/2)),toBARK(rate/2)); + + rate=22050.f; + fprintf(stderr,"rate=%gHz, block=%d, f(1)=%.2gHz bark(1)=%.2g (of %.2g)\n", + rate,i,rate/2 / (i/2),toBARK(rate/2 /(i/2)),toBARK(rate/2)); + + rate=16000.f; + fprintf(stderr,"rate=%gHz, block=%d, f(1)=%.2gHz bark(1)=%.2g (of %.2g)\n", + rate,i,rate/2 / (i/2),toBARK(rate/2 /(i/2)),toBARK(rate/2)); + + rate=11025.f; + fprintf(stderr,"rate=%gHz, block=%d, f(1)=%.2gHz bark(1)=%.2g (of %.2g)\n", + rate,i,rate/2 / (i/2),toBARK(rate/2 /(i/2)),toBARK(rate/2)); + + rate=8000.f; + fprintf(stderr,"rate=%gHz, block=%d, f(1)=%.2gHz bark(1)=%.2g (of %.2g)\n\n", + rate,i,rate/2 / (i/2),toBARK(rate/2 /(i/2)),toBARK(rate/2)); + + + } + { + float i; + int j; + for(i=0.,j=0;i<28;i+=1,j++){ + fprintf(stderr,"(%d) bark=%f %gHz (%d of 128)\n", + j,i,fromBARK(i),(int)(fromBARK(i)/22050.*128.)); + } + } + return(0); +} + diff --git a/Libraries/Vorbis/Files/lib/bitrate.c b/Libraries/Vorbis/Files/lib/bitrate.c new file mode 100644 index 000000000..bbf489243 --- /dev/null +++ b/Libraries/Vorbis/Files/lib/bitrate.c @@ -0,0 +1,253 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * + * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * + * by the XIPHOPHORUS Company http://www.xiph.org/ * + * * + ******************************************************************** + + function: bitrate tracking and management + last mod: $Id$ + + ********************************************************************/ + +#include +#include +#include +#include +#include "vorbis/codec.h" +#include "codec_internal.h" +#include "os.h" +#include "misc.h" +#include "bitrate.h" + +/* compute bitrate tracking setup */ +void vorbis_bitrate_init(vorbis_info *vi,bitrate_manager_state *bm){ + codec_setup_info *ci=vi->codec_setup; + bitrate_manager_info *bi=&ci->bi; + + memset(bm,0,sizeof(*bm)); + + if(bi && (bi->reservoir_bits>0)){ + long ratesamples=vi->rate; + int halfsamples=ci->blocksizes[0]>>1; + + bm->short_per_long=ci->blocksizes[1]/ci->blocksizes[0]; + bm->managed=1; + + bm->avg_bitsper= rint(1.*bi->avg_rate*halfsamples/ratesamples); + bm->min_bitsper= rint(1.*bi->min_rate*halfsamples/ratesamples); + bm->max_bitsper= rint(1.*bi->max_rate*halfsamples/ratesamples); + + bm->avgfloat=PACKETBLOBS/2; + + /* not a necessary fix, but one that leads to a more balanced + typical initialization */ + { + long desired_fill=bi->reservoir_bits*bi->reservoir_bias; + bm->minmax_reservoir=desired_fill; + bm->avg_reservoir=desired_fill; + } + + } +} + +void vorbis_bitrate_clear(bitrate_manager_state *bm){ + memset(bm,0,sizeof(*bm)); + return; +} + +int vorbis_bitrate_managed(vorbis_block *vb){ + vorbis_dsp_state *vd=vb->vd; + private_state *b=vd->backend_state; + bitrate_manager_state *bm=&b->bms; + + if(bm && bm->managed)return(1); + return(0); +} + +/* finish taking in the block we just processed */ +int vorbis_bitrate_addblock(vorbis_block *vb){ + vorbis_block_internal *vbi=vb->internal; + vorbis_dsp_state *vd=vb->vd; + private_state *b=vd->backend_state; + bitrate_manager_state *bm=&b->bms; + vorbis_info *vi=vd->vi; + codec_setup_info *ci=vi->codec_setup; + bitrate_manager_info *bi=&ci->bi; + + int choice=rint(bm->avgfloat); + long this_bits=oggpack_bytes(vbi->packetblob[choice])*8; + long min_target_bits=(vb->W?bm->min_bitsper*bm->short_per_long:bm->min_bitsper); + long max_target_bits=(vb->W?bm->max_bitsper*bm->short_per_long:bm->max_bitsper); + int samples=ci->blocksizes[vb->W]>>1; + long desired_fill=bi->reservoir_bits*bi->reservoir_bias; + if(!bm->managed){ + /* not a bitrate managed stream, but for API simplicity, we'll + buffer the packet to keep the code path clean */ + + if(bm->vb)return(-1); /* one has been submitted without + being claimed */ + bm->vb=vb; + return(0); + } + + bm->vb=vb; + + /* look ahead for avg floater */ + if(bm->avg_bitsper>0){ + double slew=0.; + long avg_target_bits=(vb->W?bm->avg_bitsper*bm->short_per_long:bm->avg_bitsper); + double slewlimit= 15./bi->slew_damp; + + /* choosing a new floater: + if we're over target, we slew down + if we're under target, we slew up + + choose slew as follows: look through packetblobs of this frame + and set slew as the first in the appropriate direction that + gives us the slew we want. This may mean no slew if delta is + already favorable. + + Then limit slew to slew max */ + + if(bm->avg_reservoir+(this_bits-avg_target_bits)>desired_fill){ + while(choice>0 && this_bits>avg_target_bits && + bm->avg_reservoir+(this_bits-avg_target_bits)>desired_fill){ + choice--; + this_bits=oggpack_bytes(vbi->packetblob[choice])*8; + } + }else if(bm->avg_reservoir+(this_bits-avg_target_bits)avg_reservoir+(this_bits-avg_target_bits)packetblob[choice])*8; + } + } + + slew=rint(choice-bm->avgfloat)/samples*vi->rate; + if(slew<-slewlimit)slew=-slewlimit; + if(slew>slewlimit)slew=slewlimit; + choice=rint(bm->avgfloat+= slew/vi->rate*samples); + this_bits=oggpack_bytes(vbi->packetblob[choice])*8; + } + + + + /* enforce min(if used) on the current floater (if used) */ + if(bm->min_bitsper>0){ + /* do we need to force the bitrate up? */ + if(this_bitsminmax_reservoir-(min_target_bits-this_bits)<0){ + choice++; + if(choice>=PACKETBLOBS)break; + this_bits=oggpack_bytes(vbi->packetblob[choice])*8; + } + } + } + + /* enforce max (if used) on the current floater (if used) */ + if(bm->max_bitsper>0){ + /* do we need to force the bitrate down? */ + if(this_bits>max_target_bits){ + while(bm->minmax_reservoir+(this_bits-max_target_bits)>bi->reservoir_bits){ + choice--; + if(choice<0)break; + this_bits=oggpack_bytes(vbi->packetblob[choice])*8; + } + } + } + + /* Choice of packetblobs now made based on floater, and min/max + requirements. Now boundary check extreme choices */ + + if(choice<0){ + /* choosing a smaller packetblob is insufficient to trim bitrate. + frame will need to be truncated */ + long maxsize=(max_target_bits+(bi->reservoir_bits-bm->minmax_reservoir))/8; + bm->choice=choice=0; + + if(oggpack_bytes(vbi->packetblob[choice])>maxsize){ + + oggpack_writetrunc(vbi->packetblob[choice],maxsize*8); + this_bits=oggpack_bytes(vbi->packetblob[choice])*8; + } + }else{ + long minsize=(min_target_bits-bm->minmax_reservoir+7)/8; + if(choice>=PACKETBLOBS) + choice=PACKETBLOBS-1; + + bm->choice=choice; + + /* prop up bitrate according to demand. pad this frame out with zeroes */ + minsize-=oggpack_bytes(vbi->packetblob[choice]); + while(minsize-->0)oggpack_write(vbi->packetblob[choice],0,8); + this_bits=oggpack_bytes(vbi->packetblob[choice])*8; + + } + + /* now we have the final packet and the final packet size. Update statistics */ + /* min and max reservoir */ + if(bm->min_bitsper>0 || bm->max_bitsper>0){ + + if(max_target_bits>0 && this_bits>max_target_bits){ + bm->minmax_reservoir+=(this_bits-max_target_bits); + }else if(min_target_bits>0 && this_bitsminmax_reservoir+=(this_bits-min_target_bits); + }else{ + /* inbetween; we want to take reservoir toward but not past desired_fill */ + if(bm->minmax_reservoir>desired_fill){ + if(max_target_bits>0){ /* logical bulletproofing against initialization state */ + bm->minmax_reservoir+=(this_bits-max_target_bits); + if(bm->minmax_reservoirminmax_reservoir=desired_fill; + }else{ + bm->minmax_reservoir=desired_fill; + } + }else{ + if(min_target_bits>0){ /* logical bulletproofing against initialization state */ + bm->minmax_reservoir+=(this_bits-min_target_bits); + if(bm->minmax_reservoir>desired_fill)bm->minmax_reservoir=desired_fill; + }else{ + bm->minmax_reservoir=desired_fill; + } + } + } + } + + /* avg reservoir */ + if(bm->avg_bitsper>0){ + long avg_target_bits=(vb->W?bm->avg_bitsper*bm->short_per_long:bm->avg_bitsper); + bm->avg_reservoir+=this_bits-avg_target_bits; + } + + return(0); +} + +int vorbis_bitrate_flushpacket(vorbis_dsp_state *vd,ogg_packet *op){ + private_state *b=vd->backend_state; + bitrate_manager_state *bm=&b->bms; + vorbis_block *vb=bm->vb; + int choice=PACKETBLOBS/2; + if(!vb)return 0; + + if(op){ + vorbis_block_internal *vbi=vb->internal; + + if(vorbis_bitrate_managed(vb)) + choice=bm->choice; + + op->packet=oggpack_get_buffer(vbi->packetblob[choice]); + op->bytes=oggpack_bytes(vbi->packetblob[choice]); + op->b_o_s=0; + op->e_o_s=vb->eofflag; + op->granulepos=vb->granulepos; + op->packetno=vb->sequence; /* for sake of completeness */ + } + + bm->vb=0; + return(1); +} diff --git a/Libraries/Vorbis/Files/lib/bitrate.h b/Libraries/Vorbis/Files/lib/bitrate.h new file mode 100644 index 000000000..af04eb575 --- /dev/null +++ b/Libraries/Vorbis/Files/lib/bitrate.h @@ -0,0 +1,59 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * + * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * + * by the XIPHOPHORUS Company http://www.xiph.org/ * + * * + ******************************************************************** + + function: bitrate tracking and management + last mod: $Id$ + + ********************************************************************/ + +#ifndef _V_BITRATE_H_ +#define _V_BITRATE_H_ + +#include "vorbis/codec.h" +#include "codec_internal.h" +#include "os.h" + +/* encode side bitrate tracking */ +typedef struct bitrate_manager_state { + int managed; + + long avg_reservoir; + long minmax_reservoir; + long avg_bitsper; + long min_bitsper; + long max_bitsper; + + long short_per_long; + double avgfloat; + + vorbis_block *vb; + int choice; +} bitrate_manager_state; + +typedef struct bitrate_manager_info{ + long avg_rate; + long min_rate; + long max_rate; + long reservoir_bits; + double reservoir_bias; + + double slew_damp; + +} bitrate_manager_info; + +extern void vorbis_bitrate_init(vorbis_info *vi,bitrate_manager_state *bs); +extern void vorbis_bitrate_clear(bitrate_manager_state *bs); +extern int vorbis_bitrate_managed(vorbis_block *vb); +extern int vorbis_bitrate_addblock(vorbis_block *vb); +extern int vorbis_bitrate_flushpacket(vorbis_dsp_state *vd, ogg_packet *op); + +#endif diff --git a/Libraries/Vorbis/Files/lib/block.c b/Libraries/Vorbis/Files/lib/block.c new file mode 100644 index 000000000..ababd451e --- /dev/null +++ b/Libraries/Vorbis/Files/lib/block.c @@ -0,0 +1,985 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * + * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2003 * + * by the XIPHOPHORUS Company http://www.xiph.org/ * + * * + ******************************************************************** + + function: PCM data vector blocking, windowing and dis/reassembly + last mod: $Id$ + + Handle windowing, overlap-add, etc of the PCM vectors. This is made + more amusing by Vorbis' current two allowed block sizes. + + ********************************************************************/ + +#include +#include +#include +#include +#include "vorbis/codec.h" +#include "codec_internal.h" + +#include "window.h" +#include "mdct.h" +#include "lpc.h" +#include "registry.h" +#include "misc.h" + +static int ilog2(unsigned int v){ + int ret=0; + if(v)--v; + while(v){ + ret++; + v>>=1; + } + return(ret); +} + +/* pcm accumulator examples (not exhaustive): + + <-------------- lW ----------------> + <--------------- W ----------------> +: .....|..... _______________ | +: .''' | '''_--- | |\ | +:.....''' |_____--- '''......| | \_______| +:.................|__________________|_______|__|______| + |<------ Sl ------>| > Sr < |endW + |beginSl |endSl | |endSr + |beginW |endlW |beginSr + + + |< lW >| + <--------------- W ----------------> + | | .. ______________ | + | | ' `/ | ---_ | + |___.'___/`. | ---_____| + |_______|__|_______|_________________| + | >|Sl|< |<------ Sr ----->|endW + | | |endSl |beginSr |endSr + |beginW | |endlW + mult[0] |beginSl mult[n] + + <-------------- lW -----------------> + |<--W-->| +: .............. ___ | | +: .''' |`/ \ | | +:.....''' |/`....\|...| +:.........................|___|___|___| + |Sl |Sr |endW + | | |endSr + | |beginSr + | |endSl + |beginSl + |beginW +*/ + +/* block abstraction setup *********************************************/ + +#ifndef WORD_ALIGN +#define WORD_ALIGN 8 +#endif + +int vorbis_block_init(vorbis_dsp_state *v, vorbis_block *vb){ + int i; + memset(vb,0,sizeof(*vb)); + vb->vd=v; + vb->localalloc=0; + vb->localstore=NULL; + if(v->analysisp){ + vorbis_block_internal *vbi= + vb->internal=_ogg_calloc(1,sizeof(vorbis_block_internal)); + vbi->ampmax=-9999; + + for(i=0;ipacketblob[i]=&vb->opb; + }else{ + vbi->packetblob[i]= + _ogg_calloc(1,sizeof(oggpack_buffer)); + } + oggpack_writeinit(vbi->packetblob[i]); + } + } + + return(0); +} + +void *_vorbis_block_alloc(vorbis_block *vb,long bytes){ + bytes=(bytes+(WORD_ALIGN-1)) & ~(WORD_ALIGN-1); + if(bytes+vb->localtop>vb->localalloc){ + /* can't just _ogg_realloc... there are outstanding pointers */ + if(vb->localstore){ + struct alloc_chain *link=_ogg_malloc(sizeof(*link)); + vb->totaluse+=vb->localtop; + link->next=vb->reap; + link->ptr=vb->localstore; + vb->reap=link; + } + /* highly conservative */ + vb->localalloc=bytes; + vb->localstore=_ogg_malloc(vb->localalloc); + vb->localtop=0; + } + { + void *ret=(void *)(((char *)vb->localstore)+vb->localtop); + vb->localtop+=bytes; + return ret; + } +} + +/* reap the chain, pull the ripcord */ +void _vorbis_block_ripcord(vorbis_block *vb){ + /* reap the chain */ + struct alloc_chain *reap=vb->reap; + while(reap){ + struct alloc_chain *next=reap->next; + _ogg_free(reap->ptr); + memset(reap,0,sizeof(*reap)); + _ogg_free(reap); + reap=next; + } + /* consolidate storage */ + if(vb->totaluse){ + vb->localstore=_ogg_realloc(vb->localstore,vb->totaluse+vb->localalloc); + vb->localalloc+=vb->totaluse; + vb->totaluse=0; + } + + /* pull the ripcord */ + vb->localtop=0; + vb->reap=NULL; +} + +int vorbis_block_clear(vorbis_block *vb){ + int i; + vorbis_block_internal *vbi=vb->internal; + + _vorbis_block_ripcord(vb); + if(vb->localstore)_ogg_free(vb->localstore); + + if(vbi){ + for(i=0;ipacketblob[i]); + if(i!=PACKETBLOBS/2)_ogg_free(vbi->packetblob[i]); + } + _ogg_free(vbi); + } + memset(vb,0,sizeof(*vb)); + return(0); +} + +/* Analysis side code, but directly related to blocking. Thus it's + here and not in analysis.c (which is for analysis transforms only). + The init is here because some of it is shared */ + +static int _vds_shared_init(vorbis_dsp_state *v,vorbis_info *vi,int encp){ + int i; + codec_setup_info *ci=vi->codec_setup; + private_state *b=NULL; + int hs; + + if(ci==NULL) return 1; + hs=ci->halfrate_flag; + + memset(v,0,sizeof(*v)); + b=v->backend_state=_ogg_calloc(1,sizeof(*b)); + + v->vi=vi; + b->modebits=ilog2(ci->modes); + + b->transform[0]=_ogg_calloc(VI_TRANSFORMB,sizeof(*b->transform[0])); + b->transform[1]=_ogg_calloc(VI_TRANSFORMB,sizeof(*b->transform[1])); + + /* MDCT is tranform 0 */ + + b->transform[0][0]=_ogg_calloc(1,sizeof(mdct_lookup)); + b->transform[1][0]=_ogg_calloc(1,sizeof(mdct_lookup)); + mdct_init(b->transform[0][0],ci->blocksizes[0]>>hs); + mdct_init(b->transform[1][0],ci->blocksizes[1]>>hs); + + /* Vorbis I uses only window type 0 */ + b->window[0]=ilog2(ci->blocksizes[0])-6; + b->window[1]=ilog2(ci->blocksizes[1])-6; + + if(encp){ /* encode/decode differ here */ + + /* analysis always needs an fft */ + drft_init(&b->fft_look[0],ci->blocksizes[0]); + drft_init(&b->fft_look[1],ci->blocksizes[1]); + + /* finish the codebooks */ + if(!ci->fullbooks){ + ci->fullbooks=_ogg_calloc(ci->books,sizeof(*ci->fullbooks)); + for(i=0;ibooks;i++) + vorbis_book_init_encode(ci->fullbooks+i,ci->book_param[i]); + } + + b->psy=_ogg_calloc(ci->psys,sizeof(*b->psy)); + for(i=0;ipsys;i++){ + _vp_psy_init(b->psy+i, + ci->psy_param[i], + &ci->psy_g_param, + ci->blocksizes[ci->psy_param[i]->blockflag]/2, + vi->rate); + } + + v->analysisp=1; + }else{ + /* finish the codebooks */ + if(!ci->fullbooks){ + ci->fullbooks=_ogg_calloc(ci->books,sizeof(*ci->fullbooks)); + for(i=0;ibooks;i++){ + vorbis_book_init_decode(ci->fullbooks+i,ci->book_param[i]); + /* decode codebooks are now standalone after init */ + vorbis_staticbook_destroy(ci->book_param[i]); + ci->book_param[i]=NULL; + } + } + } + + /* initialize the storage vectors. blocksize[1] is small for encode, + but the correct size for decode */ + v->pcm_storage=ci->blocksizes[1]; + v->pcm=_ogg_malloc(vi->channels*sizeof(*v->pcm)); + v->pcmret=_ogg_malloc(vi->channels*sizeof(*v->pcmret)); + { + int i; + for(i=0;ichannels;i++) + v->pcm[i]=_ogg_calloc(v->pcm_storage,sizeof(*v->pcm[i])); + } + + /* all 1 (large block) or 0 (small block) */ + /* explicitly set for the sake of clarity */ + v->lW=0; /* previous window size */ + v->W=0; /* current window size */ + + /* all vector indexes */ + v->centerW=ci->blocksizes[1]/2; + + v->pcm_current=v->centerW; + + /* initialize all the backend lookups */ + b->flr=_ogg_calloc(ci->floors,sizeof(*b->flr)); + b->residue=_ogg_calloc(ci->residues,sizeof(*b->residue)); + + for(i=0;ifloors;i++) + b->flr[i]=_floor_P[ci->floor_type[i]]-> + look(v,ci->floor_param[i]); + + for(i=0;iresidues;i++) + b->residue[i]=_residue_P[ci->residue_type[i]]-> + look(v,ci->residue_param[i]); + + return 0; +} + +/* arbitrary settings and spec-mandated numbers get filled in here */ +int vorbis_analysis_init(vorbis_dsp_state *v,vorbis_info *vi){ + private_state *b=NULL; + + if(_vds_shared_init(v,vi,1))return 1; + b=v->backend_state; + b->psy_g_look=_vp_global_look(vi); + + /* Initialize the envelope state storage */ + b->ve=_ogg_calloc(1,sizeof(*b->ve)); + _ve_envelope_init(b->ve,vi); + + vorbis_bitrate_init(vi,&b->bms); + + return(0); +} + +void vorbis_dsp_clear(vorbis_dsp_state *v){ + int i; + if(v){ + vorbis_info *vi=v->vi; + codec_setup_info *ci=(vi?vi->codec_setup:NULL); + private_state *b=v->backend_state; + + if(b){ + + if(b->ve){ + _ve_envelope_clear(b->ve); + _ogg_free(b->ve); + } + + if(b->transform[0]){ + mdct_clear(b->transform[0][0]); + _ogg_free(b->transform[0][0]); + _ogg_free(b->transform[0]); + } + if(b->transform[1]){ + mdct_clear(b->transform[1][0]); + _ogg_free(b->transform[1][0]); + _ogg_free(b->transform[1]); + } + + if(b->flr){ + for(i=0;ifloors;i++) + _floor_P[ci->floor_type[i]]-> + free_look(b->flr[i]); + _ogg_free(b->flr); + } + if(b->residue){ + for(i=0;iresidues;i++) + _residue_P[ci->residue_type[i]]-> + free_look(b->residue[i]); + _ogg_free(b->residue); + } + if(b->psy){ + for(i=0;ipsys;i++) + _vp_psy_clear(b->psy+i); + _ogg_free(b->psy); + } + + if(b->psy_g_look)_vp_global_free(b->psy_g_look); + vorbis_bitrate_clear(&b->bms); + + drft_clear(&b->fft_look[0]); + drft_clear(&b->fft_look[1]); + + } + + if(v->pcm){ + for(i=0;ichannels;i++) + if(v->pcm[i])_ogg_free(v->pcm[i]); + _ogg_free(v->pcm); + if(v->pcmret)_ogg_free(v->pcmret); + } + + if(b){ + /* free header, header1, header2 */ + if(b->header)_ogg_free(b->header); + if(b->header1)_ogg_free(b->header1); + if(b->header2)_ogg_free(b->header2); + _ogg_free(b); + } + + memset(v,0,sizeof(*v)); + } +} + +float **vorbis_analysis_buffer(vorbis_dsp_state *v, int vals){ + int i; + vorbis_info *vi=v->vi; + private_state *b=v->backend_state; + + /* free header, header1, header2 */ + if(b->header)_ogg_free(b->header);b->header=NULL; + if(b->header1)_ogg_free(b->header1);b->header1=NULL; + if(b->header2)_ogg_free(b->header2);b->header2=NULL; + + /* Do we have enough storage space for the requested buffer? If not, + expand the PCM (and envelope) storage */ + + if(v->pcm_current+vals>=v->pcm_storage){ + v->pcm_storage=v->pcm_current+vals*2; + + for(i=0;ichannels;i++){ + v->pcm[i]=_ogg_realloc(v->pcm[i],v->pcm_storage*sizeof(*v->pcm[i])); + } + } + + for(i=0;ichannels;i++) + v->pcmret[i]=v->pcm[i]+v->pcm_current; + + return(v->pcmret); +} + +static void _preextrapolate_helper(vorbis_dsp_state *v){ + int i; + int order=32; + float *lpc=alloca(order*sizeof(*lpc)); + float *work=alloca(v->pcm_current*sizeof(*work)); + long j; + v->preextrapolate=1; + + if(v->pcm_current-v->centerW>order*2){ /* safety */ + for(i=0;ivi->channels;i++){ + /* need to run the extrapolation in reverse! */ + for(j=0;jpcm_current;j++) + work[j]=v->pcm[i][v->pcm_current-j-1]; + + /* prime as above */ + vorbis_lpc_from_data(work,lpc,v->pcm_current-v->centerW,order); + + /* run the predictor filter */ + vorbis_lpc_predict(lpc,work+v->pcm_current-v->centerW-order, + order, + work+v->pcm_current-v->centerW, + v->centerW); + + for(j=0;jpcm_current;j++) + v->pcm[i][v->pcm_current-j-1]=work[j]; + + } + } +} + + +/* call with val<=0 to set eof */ + +int vorbis_analysis_wrote(vorbis_dsp_state *v, int vals){ + vorbis_info *vi=v->vi; + codec_setup_info *ci=vi->codec_setup; + + if(vals<=0){ + int order=32; + int i; + float *lpc=alloca(order*sizeof(*lpc)); + + /* if it wasn't done earlier (very short sample) */ + if(!v->preextrapolate) + _preextrapolate_helper(v); + + /* We're encoding the end of the stream. Just make sure we have + [at least] a few full blocks of zeroes at the end. */ + /* actually, we don't want zeroes; that could drop a large + amplitude off a cliff, creating spread spectrum noise that will + suck to encode. Extrapolate for the sake of cleanliness. */ + + vorbis_analysis_buffer(v,ci->blocksizes[1]*3); + v->eofflag=v->pcm_current; + v->pcm_current+=ci->blocksizes[1]*3; + + for(i=0;ichannels;i++){ + if(v->eofflag>order*2){ + /* extrapolate with LPC to fill in */ + long n; + + /* make a predictor filter */ + n=v->eofflag; + if(n>ci->blocksizes[1])n=ci->blocksizes[1]; + vorbis_lpc_from_data(v->pcm[i]+v->eofflag-n,lpc,n,order); + + /* run the predictor filter */ + vorbis_lpc_predict(lpc,v->pcm[i]+v->eofflag-order,order, + v->pcm[i]+v->eofflag,v->pcm_current-v->eofflag); + }else{ + /* not enough data to extrapolate (unlikely to happen due to + guarding the overlap, but bulletproof in case that + assumtion goes away). zeroes will do. */ + memset(v->pcm[i]+v->eofflag,0, + (v->pcm_current-v->eofflag)*sizeof(*v->pcm[i])); + + } + } + }else{ + + if(v->pcm_current+vals>v->pcm_storage) + return(OV_EINVAL); + + v->pcm_current+=vals; + + /* we may want to reverse extrapolate the beginning of a stream + too... in case we're beginning on a cliff! */ + /* clumsy, but simple. It only runs once, so simple is good. */ + if(!v->preextrapolate && v->pcm_current-v->centerW>ci->blocksizes[1]) + _preextrapolate_helper(v); + + } + return(0); +} + +/* do the deltas, envelope shaping, pre-echo and determine the size of + the next block on which to continue analysis */ +int vorbis_analysis_blockout(vorbis_dsp_state *v,vorbis_block *vb){ + int i; + vorbis_info *vi=v->vi; + codec_setup_info *ci=vi->codec_setup; + private_state *b=v->backend_state; + vorbis_look_psy_global *g=b->psy_g_look; + long beginW=v->centerW-ci->blocksizes[v->W]/2,centerNext; + vorbis_block_internal *vbi=(vorbis_block_internal *)vb->internal; + + /* check to see if we're started... */ + if(!v->preextrapolate)return(0); + + /* check to see if we're done... */ + if(v->eofflag==-1)return(0); + + /* By our invariant, we have lW, W and centerW set. Search for + the next boundary so we can determine nW (the next window size) + which lets us compute the shape of the current block's window */ + + /* we do an envelope search even on a single blocksize; we may still + be throwing more bits at impulses, and envelope search handles + marking impulses too. */ + { + long bp=_ve_envelope_search(v); + if(bp==-1){ + + if(v->eofflag==0)return(0); /* not enough data currently to search for a + full long block */ + v->nW=0; + }else{ + + if(ci->blocksizes[0]==ci->blocksizes[1]) + v->nW=0; + else + v->nW=bp; + } + } + + centerNext=v->centerW+ci->blocksizes[v->W]/4+ci->blocksizes[v->nW]/4; + + { + /* center of next block + next block maximum right side. */ + + long blockbound=centerNext+ci->blocksizes[v->nW]/2; + if(v->pcm_currentlW=v->lW; + vb->W=v->W; + vb->nW=v->nW; + + if(v->W){ + if(!v->lW || !v->nW){ + vbi->blocktype=BLOCKTYPE_TRANSITION; + /*fprintf(stderr,"-");*/ + }else{ + vbi->blocktype=BLOCKTYPE_LONG; + /*fprintf(stderr,"_");*/ + } + }else{ + if(_ve_envelope_mark(v)){ + vbi->blocktype=BLOCKTYPE_IMPULSE; + /*fprintf(stderr,"|");*/ + + }else{ + vbi->blocktype=BLOCKTYPE_PADDING; + /*fprintf(stderr,".");*/ + + } + } + + vb->vd=v; + vb->sequence=v->sequence++; + vb->granulepos=v->granulepos; + vb->pcmend=ci->blocksizes[v->W]; + + /* copy the vectors; this uses the local storage in vb */ + + /* this tracks 'strongest peak' for later psychoacoustics */ + /* moved to the global psy state; clean this mess up */ + if(vbi->ampmax>g->ampmax)g->ampmax=vbi->ampmax; + g->ampmax=_vp_ampmax_decay(g->ampmax,v); + vbi->ampmax=g->ampmax; + + vb->pcm=_vorbis_block_alloc(vb,sizeof(*vb->pcm)*vi->channels); + vbi->pcmdelay=_vorbis_block_alloc(vb,sizeof(*vbi->pcmdelay)*vi->channels); + for(i=0;ichannels;i++){ + vbi->pcmdelay[i]= + _vorbis_block_alloc(vb,(vb->pcmend+beginW)*sizeof(*vbi->pcmdelay[i])); + memcpy(vbi->pcmdelay[i],v->pcm[i],(vb->pcmend+beginW)*sizeof(*vbi->pcmdelay[i])); + vb->pcm[i]=vbi->pcmdelay[i]+beginW; + + /* before we added the delay + vb->pcm[i]=_vorbis_block_alloc(vb,vb->pcmend*sizeof(*vb->pcm[i])); + memcpy(vb->pcm[i],v->pcm[i]+beginW,ci->blocksizes[v->W]*sizeof(*vb->pcm[i])); + */ + + } + + /* handle eof detection: eof==0 means that we've not yet received EOF + eof>0 marks the last 'real' sample in pcm[] + eof<0 'no more to do'; doesn't get here */ + + if(v->eofflag){ + if(v->centerW>=v->eofflag){ + v->eofflag=-1; + vb->eofflag=1; + return(1); + } + } + + /* advance storage vectors and clean up */ + { + int new_centerNext=ci->blocksizes[1]/2; + int movementW=centerNext-new_centerNext; + + if(movementW>0){ + + _ve_envelope_shift(b->ve,movementW); + v->pcm_current-=movementW; + + for(i=0;ichannels;i++) + memmove(v->pcm[i],v->pcm[i]+movementW, + v->pcm_current*sizeof(*v->pcm[i])); + + + v->lW=v->W; + v->W=v->nW; + v->centerW=new_centerNext; + + if(v->eofflag){ + v->eofflag-=movementW; + if(v->eofflag<=0)v->eofflag=-1; + /* do not add padding to end of stream! */ + if(v->centerW>=v->eofflag){ + v->granulepos+=movementW-(v->centerW-v->eofflag); + }else{ + v->granulepos+=movementW; + } + }else{ + v->granulepos+=movementW; + } + } + } + + /* done */ + return(1); +} + +int vorbis_synthesis_restart(vorbis_dsp_state *v){ + vorbis_info *vi=v->vi; + codec_setup_info *ci; + int hs; + + if(!v->backend_state)return -1; + if(!vi)return -1; + ci=vi->codec_setup; + if(!ci)return -1; + hs=ci->halfrate_flag; + + v->centerW=ci->blocksizes[1]>>(hs+1); + v->pcm_current=v->centerW>>hs; + + v->pcm_returned=-1; + v->granulepos=-1; + v->sequence=-1; + v->eofflag=0; + ((private_state *)(v->backend_state))->sample_count=-1; + + return(0); +} + +int vorbis_synthesis_init(vorbis_dsp_state *v,vorbis_info *vi){ + if(_vds_shared_init(v,vi,0)) return 1; + vorbis_synthesis_restart(v); + + return 0; +} + +/* Unlike in analysis, the window is only partially applied for each + block. The time domain envelope is not yet handled at the point of + calling (as it relies on the previous block). */ + +int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb){ + vorbis_info *vi=v->vi; + codec_setup_info *ci=vi->codec_setup; + private_state *b=v->backend_state; + int hs=ci->halfrate_flag; + int i,j; + + if(!vb)return(OV_EINVAL); + if(v->pcm_current>v->pcm_returned && v->pcm_returned!=-1)return(OV_EINVAL); + + v->lW=v->W; + v->W=vb->W; + v->nW=-1; + + if((v->sequence==-1)|| + (v->sequence+1 != vb->sequence)){ + v->granulepos=-1; /* out of sequence; lose count */ + b->sample_count=-1; + } + + v->sequence=vb->sequence; + + if(vb->pcm){ /* no pcm to process if vorbis_synthesis_trackonly + was called on block */ + int n=ci->blocksizes[v->W]>>(hs+1); + int n0=ci->blocksizes[0]>>(hs+1); + int n1=ci->blocksizes[1]>>(hs+1); + + int thisCenter; + int prevCenter; + + v->glue_bits+=vb->glue_bits; + v->time_bits+=vb->time_bits; + v->floor_bits+=vb->floor_bits; + v->res_bits+=vb->res_bits; + + if(v->centerW){ + thisCenter=n1; + prevCenter=0; + }else{ + thisCenter=0; + prevCenter=n1; + } + + /* v->pcm is now used like a two-stage double buffer. We don't want + to have to constantly shift *or* adjust memory usage. Don't + accept a new block until the old is shifted out */ + + for(j=0;jchannels;j++){ + /* the overlap/add section */ + if(v->lW){ + if(v->W){ + /* large/large */ + float *w=_vorbis_window_get(b->window[1]-hs); + float *pcm=v->pcm[j]+prevCenter; + float *p=vb->pcm[j]; + for(i=0;iwindow[0]-hs); + float *pcm=v->pcm[j]+prevCenter+n1/2-n0/2; + float *p=vb->pcm[j]; + for(i=0;iW){ + /* small/large */ + float *w=_vorbis_window_get(b->window[0]-hs); + float *pcm=v->pcm[j]+prevCenter; + float *p=vb->pcm[j]+n1/2-n0/2; + for(i=0;iwindow[0]-hs); + float *pcm=v->pcm[j]+prevCenter; + float *p=vb->pcm[j]; + for(i=0;ipcm[j]+thisCenter; + float *p=vb->pcm[j]+n; + for(i=0;icenterW) + v->centerW=0; + else + v->centerW=n1; + + /* deal with initial packet state; we do this using the explicit + pcm_returned==-1 flag otherwise we're sensitive to first block + being short or long */ + + if(v->pcm_returned==-1){ + v->pcm_returned=thisCenter; + v->pcm_current=thisCenter; + }else{ + v->pcm_returned=prevCenter; + v->pcm_current=prevCenter+ + ((ci->blocksizes[v->lW]/4+ + ci->blocksizes[v->W]/4)>>hs); + } + + } + + /* track the frame number... This is for convenience, but also + making sure our last packet doesn't end with added padding. If + the last packet is partial, the number of samples we'll have to + return will be past the vb->granulepos. + + This is not foolproof! It will be confused if we begin + decoding at the last page after a seek or hole. In that case, + we don't have a starting point to judge where the last frame + is. For this reason, vorbisfile will always try to make sure + it reads the last two marked pages in proper sequence */ + + if(b->sample_count==-1){ + b->sample_count=0; + }else{ + b->sample_count+=ci->blocksizes[v->lW]/4+ci->blocksizes[v->W]/4; + } + + if(v->granulepos==-1){ + if(vb->granulepos!=-1){ /* only set if we have a position to set to */ + + v->granulepos=vb->granulepos; + + /* is this a short page? */ + if(b->sample_count>v->granulepos){ + /* corner case; if this is both the first and last audio page, + then spec says the end is cut, not beginning */ + if(vb->eofflag){ + /* trim the end */ + /* no preceeding granulepos; assume we started at zero (we'd + have to in a short single-page stream) */ + /* granulepos could be -1 due to a seek, but that would result + in a long count, not short count */ + + v->pcm_current-=(b->sample_count-v->granulepos)>>hs; + }else{ + /* trim the beginning */ + v->pcm_returned+=(b->sample_count-v->granulepos)>>hs; + if(v->pcm_returned>v->pcm_current) + v->pcm_returned=v->pcm_current; + } + + } + + } + }else{ + v->granulepos+=ci->blocksizes[v->lW]/4+ci->blocksizes[v->W]/4; + if(vb->granulepos!=-1 && v->granulepos!=vb->granulepos){ + + if(v->granulepos>vb->granulepos){ + long extra=v->granulepos-vb->granulepos; + + if(extra) + if(vb->eofflag){ + /* partial last frame. Strip the extra samples off */ + v->pcm_current-=extra>>hs; + } /* else {Shouldn't happen *unless* the bitstream is out of + spec. Either way, believe the bitstream } */ + } /* else {Shouldn't happen *unless* the bitstream is out of + spec. Either way, believe the bitstream } */ + v->granulepos=vb->granulepos; + } + } + + /* Update, cleanup */ + + if(vb->eofflag)v->eofflag=1; + return(0); + +} + +/* pcm==NULL indicates we just want the pending samples, no more */ +int vorbis_synthesis_pcmout(vorbis_dsp_state *v,float ***pcm){ + vorbis_info *vi=v->vi; + + if(v->pcm_returned>-1 && v->pcm_returnedpcm_current){ + if(pcm){ + int i; + for(i=0;ichannels;i++) + v->pcmret[i]=v->pcm[i]+v->pcm_returned; + *pcm=v->pcmret; + } + return(v->pcm_current-v->pcm_returned); + } + return(0); +} + +int vorbis_synthesis_read(vorbis_dsp_state *v,int n){ + if(n && v->pcm_returned+n>v->pcm_current)return(OV_EINVAL); + v->pcm_returned+=n; + return(0); +} + +/* intended for use with a specific vorbisfile feature; we want access + to the [usually synthetic/postextrapolated] buffer and lapping at + the end of a decode cycle, specifically, a half-short-block worth. + This funtion works like pcmout above, except it will also expose + this implicit buffer data not normally decoded. */ +int vorbis_synthesis_lapout(vorbis_dsp_state *v,float ***pcm){ + vorbis_info *vi=v->vi; + codec_setup_info *ci=vi->codec_setup; + int hs=ci->halfrate_flag; + + int n=ci->blocksizes[v->W]>>(hs+1); + int n0=ci->blocksizes[0]>>(hs+1); + int n1=ci->blocksizes[1]>>(hs+1); + int i,j; + + if(v->pcm_returned<0)return 0; + + /* our returned data ends at pcm_returned; because the synthesis pcm + buffer is a two-fragment ring, that means our data block may be + fragmented by buffering, wrapping or a short block not filling + out a buffer. To simplify things, we unfragment if it's at all + possibly needed. Otherwise, we'd need to call lapout more than + once as well as hold additional dsp state. Opt for + simplicity. */ + + /* centerW was advanced by blockin; it would be the center of the + *next* block */ + if(v->centerW==n1){ + /* the data buffer wraps; swap the halves */ + /* slow, sure, small */ + for(j=0;jchannels;j++){ + float *p=v->pcm[j]; + for(i=0;ipcm_current-=n1; + v->pcm_returned-=n1; + v->centerW=0; + } + + /* solidify buffer into contiguous space */ + if((v->lW^v->W)==1){ + /* long/short or short/long */ + for(j=0;jchannels;j++){ + float *s=v->pcm[j]; + float *d=v->pcm[j]+(n1-n0)/2; + for(i=(n1+n0)/2-1;i>=0;--i) + d[i]=s[i]; + } + v->pcm_returned+=(n1-n0)/2; + v->pcm_current+=(n1-n0)/2; + }else{ + if(v->lW==0){ + /* short/short */ + for(j=0;jchannels;j++){ + float *s=v->pcm[j]; + float *d=v->pcm[j]+n1-n0; + for(i=n0-1;i>=0;--i) + d[i]=s[i]; + } + v->pcm_returned+=n1-n0; + v->pcm_current+=n1-n0; + } + } + + if(pcm){ + int i; + for(i=0;ichannels;i++) + v->pcmret[i]=v->pcm[i]+v->pcm_returned; + *pcm=v->pcmret; + } + + return(n1+n-v->pcm_returned); + +} + +float *vorbis_window(vorbis_dsp_state *v,int W){ + vorbis_info *vi=v->vi; + codec_setup_info *ci=vi->codec_setup; + int hs=ci->halfrate_flag; + private_state *b=v->backend_state; + + if(b->window[W]-1<0)return NULL; + return _vorbis_window_get(b->window[W]-hs); +} + diff --git a/Libraries/Vorbis/Files/lib/books/.cvsignore b/Libraries/Vorbis/Files/lib/books/.cvsignore new file mode 100644 index 000000000..282522db0 --- /dev/null +++ b/Libraries/Vorbis/Files/lib/books/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/Libraries/Vorbis/Files/lib/books/Makefile.am b/Libraries/Vorbis/Files/lib/books/Makefile.am new file mode 100644 index 000000000..3697a7177 --- /dev/null +++ b/Libraries/Vorbis/Files/lib/books/Makefile.am @@ -0,0 +1,3 @@ +## Process this file with automake to produce Makefile.in + +SUBDIRS = coupled uncoupled floor diff --git a/Libraries/Vorbis/Files/lib/books/coupled/.cvsignore b/Libraries/Vorbis/Files/lib/books/coupled/.cvsignore new file mode 100644 index 000000000..282522db0 --- /dev/null +++ b/Libraries/Vorbis/Files/lib/books/coupled/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/Libraries/Vorbis/Files/lib/books/coupled/Makefile.am b/Libraries/Vorbis/Files/lib/books/coupled/Makefile.am new file mode 100644 index 000000000..7f94da538 --- /dev/null +++ b/Libraries/Vorbis/Files/lib/books/coupled/Makefile.am @@ -0,0 +1,3 @@ +## Process this file with automake to produce Makefile.in + +EXTRA_DIST = res_books_stereo.h diff --git a/Libraries/Vorbis/Files/lib/books/coupled/res_books_stereo.h b/Libraries/Vorbis/Files/lib/books/coupled/res_books_stereo.h new file mode 100644 index 000000000..e5847d87f --- /dev/null +++ b/Libraries/Vorbis/Files/lib/books/coupled/res_books_stereo.h @@ -0,0 +1,20989 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * + * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * + * by the Xiph.Org Foundation http://www.xiph.org/ * + * * + ******************************************************************** + + function: static codebooks autogenerated by huff/huffbuld + last modified: $Id$ + + ********************************************************************/ + +#include "codebook.h" +static long _vq_quantlist__16c0_s_p1_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__16c0_s_p1_0[] = { + 1, 4, 4, 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, 0, 0, 0, + 0, 0, 5, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 5, 8, 8, 0, 0, 0, 0, 0, 0, 8, 9,10, 0, 0, 0, + 0, 0, 0, 7, 9,10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 5, 8, 8, 0, 0, 0, 0, 0, 0, 7, 9, 9, 0, 0, + 0, 0, 0, 0, 7, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 8, 8, 0, 0, 0, 0, + 0, 0, 8,10,10, 0, 0, 0, 0, 0, 0, 8,10,10, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7,10,10, 0, 0, 0, + 0, 0, 0, 9, 9,12, 0, 0, 0, 0, 0, 0,10,12,11, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7,10,10, 0, 0, + 0, 0, 0, 0, 9,12,10, 0, 0, 0, 0, 0, 0,10,11,12, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 5, 8, 8, 0, 0, 0, 0, 0, 0, 8,10,10, 0, 0, + 0, 0, 0, 0, 8,10,10, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 7,10,10, 0, 0, 0, 0, 0, 0,10,12,11, 0, + 0, 0, 0, 0, 0, 9,10,12, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 7,10,10, 0, 0, 0, 0, 0, 0,10,11,12, + 0, 0, 0, 0, 0, 0, 9,12, 9, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + +static float _vq_quantthresh__16c0_s_p1_0[] = { + -0.5, 0.5, +}; + +static long _vq_quantmap__16c0_s_p1_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__16c0_s_p1_0 = { + _vq_quantthresh__16c0_s_p1_0, + _vq_quantmap__16c0_s_p1_0, + 3, + 3 +}; + +static static_codebook _16c0_s_p1_0 = { + 8, 6561, + _vq_lengthlist__16c0_s_p1_0, + 1, -535822336, 1611661312, 2, 0, + _vq_quantlist__16c0_s_p1_0, + NULL, + &_vq_auxt__16c0_s_p1_0, + NULL, + 0 +}; + +static long _vq_quantlist__16c0_s_p2_0[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__16c0_s_p2_0[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + +static float _vq_quantthresh__16c0_s_p2_0[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__16c0_s_p2_0[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__16c0_s_p2_0 = { + _vq_quantthresh__16c0_s_p2_0, + _vq_quantmap__16c0_s_p2_0, + 5, + 5 +}; + +static static_codebook _16c0_s_p2_0 = { + 4, 625, + _vq_lengthlist__16c0_s_p2_0, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__16c0_s_p2_0, + NULL, + &_vq_auxt__16c0_s_p2_0, + NULL, + 0 +}; + +static long _vq_quantlist__16c0_s_p3_0[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__16c0_s_p3_0[] = { + 1, 4, 4, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 6, 6, 7, 6, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 4, 6, 6, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6, 9, 9, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 6, 6, 6, 9, 9, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + +static float _vq_quantthresh__16c0_s_p3_0[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__16c0_s_p3_0[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__16c0_s_p3_0 = { + _vq_quantthresh__16c0_s_p3_0, + _vq_quantmap__16c0_s_p3_0, + 5, + 5 +}; + +static static_codebook _16c0_s_p3_0 = { + 4, 625, + _vq_lengthlist__16c0_s_p3_0, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__16c0_s_p3_0, + NULL, + &_vq_auxt__16c0_s_p3_0, + NULL, + 0 +}; + +static long _vq_quantlist__16c0_s_p4_0[] = { + 4, + 3, + 5, + 2, + 6, + 1, + 7, + 0, + 8, +}; + +static long _vq_lengthlist__16c0_s_p4_0[] = { + 1, 3, 2, 7, 8, 0, 0, 0, 0, 0, 0, 0, 6, 6, 0, 0, + 0, 0, 0, 0, 0, 6, 6, 0, 0, 0, 0, 0, 0, 0, 7, 7, + 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, + 8, 8, 0, 0, 0, 0, 0, 0, 0, 8, 8, 0, 0, 0, 0, 0, + 0, 0, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + +static float _vq_quantthresh__16c0_s_p4_0[] = { + -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, +}; + +static long _vq_quantmap__16c0_s_p4_0[] = { + 7, 5, 3, 1, 0, 2, 4, 6, + 8, +}; + +static encode_aux_threshmatch _vq_auxt__16c0_s_p4_0 = { + _vq_quantthresh__16c0_s_p4_0, + _vq_quantmap__16c0_s_p4_0, + 9, + 9 +}; + +static static_codebook _16c0_s_p4_0 = { + 2, 81, + _vq_lengthlist__16c0_s_p4_0, + 1, -531628032, 1611661312, 4, 0, + _vq_quantlist__16c0_s_p4_0, + NULL, + &_vq_auxt__16c0_s_p4_0, + NULL, + 0 +}; + +static long _vq_quantlist__16c0_s_p5_0[] = { + 4, + 3, + 5, + 2, + 6, + 1, + 7, + 0, + 8, +}; + +static long _vq_lengthlist__16c0_s_p5_0[] = { + 1, 3, 3, 6, 6, 6, 6, 8, 8, 0, 0, 0, 7, 7, 7, 7, + 8, 8, 0, 0, 0, 7, 7, 7, 7, 8, 8, 0, 0, 0, 7, 7, + 8, 8, 9, 9, 0, 0, 0, 7, 7, 8, 8, 9, 9, 0, 0, 0, + 8, 9, 8, 8,10,10, 0, 0, 0, 8, 8, 8, 8,10,10, 0, + 0, 0,10,10, 9, 9,10,10, 0, 0, 0, 0, 0, 9, 9,10, + 10, +}; + +static float _vq_quantthresh__16c0_s_p5_0[] = { + -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, +}; + +static long _vq_quantmap__16c0_s_p5_0[] = { + 7, 5, 3, 1, 0, 2, 4, 6, + 8, +}; + +static encode_aux_threshmatch _vq_auxt__16c0_s_p5_0 = { + _vq_quantthresh__16c0_s_p5_0, + _vq_quantmap__16c0_s_p5_0, + 9, + 9 +}; + +static static_codebook _16c0_s_p5_0 = { + 2, 81, + _vq_lengthlist__16c0_s_p5_0, + 1, -531628032, 1611661312, 4, 0, + _vq_quantlist__16c0_s_p5_0, + NULL, + &_vq_auxt__16c0_s_p5_0, + NULL, + 0 +}; + +static long _vq_quantlist__16c0_s_p6_0[] = { + 8, + 7, + 9, + 6, + 10, + 5, + 11, + 4, + 12, + 3, + 13, + 2, + 14, + 1, + 15, + 0, + 16, +}; + +static long _vq_lengthlist__16c0_s_p6_0[] = { + 1, 3, 4, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9,10,10,11, + 11, 0, 0, 0, 7, 7, 8, 8, 9, 9, 9, 9,10,10,10,11, + 11,11, 0, 0, 0, 6, 6, 8, 8, 9, 9, 9, 9,10,10,11, + 11,11,11, 0, 0, 0, 7, 7, 8, 8, 9, 9, 9, 9,10,10, + 11,11,12,12, 0, 0, 0, 7, 7, 8, 8, 9, 9, 9, 9,10, + 10,11,11,12,12, 0, 0, 0, 8, 8, 9, 9,10,10,10,10, + 11,11,12,12,12,12, 0, 0, 0, 8, 8, 9, 9,10,10,10, + 10,11,11,12,12,12,13, 0, 0, 0, 9, 9, 9, 9,10,10, + 10,10,11,11,12,12,13,13, 0, 0, 0, 0, 0,10,10,10, + 10,10,10,11,11,12,12,13,13, 0, 0, 0, 0, 0, 9, 9, + 10,10,11,11,12,12,13,13,13,13, 0, 0, 0, 0, 0, 9, + 9,10,10,11,11,12,12,13,13,13,14, 0, 0, 0, 0, 0, + 10,10,10,11,11,11,12,12,13,13,13,14, 0, 0, 0, 0, + 0, 0, 0,10,10,11,11,12,12,13,13,14,14, 0, 0, 0, + 0, 0, 0, 0,11,11,12,12,13,13,13,13,14,14, 0, 0, + 0, 0, 0, 0, 0,11,11,12,12,12,13,13,14,15,14, 0, + 0, 0, 0, 0, 0, 0,12,12,12,12,13,13,13,14,14,15, + 0, 0, 0, 0, 0, 0, 0, 0, 0,12,12,13,13,14,13,14, + 14, +}; + +static float _vq_quantthresh__16c0_s_p6_0[] = { + -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, + 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, +}; + +static long _vq_quantmap__16c0_s_p6_0[] = { + 15, 13, 11, 9, 7, 5, 3, 1, + 0, 2, 4, 6, 8, 10, 12, 14, + 16, +}; + +static encode_aux_threshmatch _vq_auxt__16c0_s_p6_0 = { + _vq_quantthresh__16c0_s_p6_0, + _vq_quantmap__16c0_s_p6_0, + 17, + 17 +}; + +static static_codebook _16c0_s_p6_0 = { + 2, 289, + _vq_lengthlist__16c0_s_p6_0, + 1, -529530880, 1611661312, 5, 0, + _vq_quantlist__16c0_s_p6_0, + NULL, + &_vq_auxt__16c0_s_p6_0, + NULL, + 0 +}; + +static long _vq_quantlist__16c0_s_p7_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__16c0_s_p7_0[] = { + 1, 4, 4, 6, 6, 6, 7, 6, 6, 4, 7, 7,11,10,10,11, + 11,10, 4, 7, 7,10,10,10,11,10,10, 6,10,10,11,11, + 11,11,11,10, 6, 9, 9,11,12,12,11, 9, 9, 6, 9,10, + 11,12,12,11, 9,10, 7,11,11,11,11,11,12,13,12, 6, + 9,10,11,10,10,12,13,13, 6,10, 9,11,10,10,11,12, + 13, +}; + +static float _vq_quantthresh__16c0_s_p7_0[] = { + -5.5, 5.5, +}; + +static long _vq_quantmap__16c0_s_p7_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__16c0_s_p7_0 = { + _vq_quantthresh__16c0_s_p7_0, + _vq_quantmap__16c0_s_p7_0, + 3, + 3 +}; + +static static_codebook _16c0_s_p7_0 = { + 4, 81, + _vq_lengthlist__16c0_s_p7_0, + 1, -529137664, 1618345984, 2, 0, + _vq_quantlist__16c0_s_p7_0, + NULL, + &_vq_auxt__16c0_s_p7_0, + NULL, + 0 +}; + +static long _vq_quantlist__16c0_s_p7_1[] = { + 5, + 4, + 6, + 3, + 7, + 2, + 8, + 1, + 9, + 0, + 10, +}; + +static long _vq_lengthlist__16c0_s_p7_1[] = { + 1, 3, 4, 6, 6, 7, 7, 8, 8, 8, 8,10,10,10, 7, 7, + 8, 8, 8, 9, 9, 9,10,10,10, 6, 7, 8, 8, 8, 8, 9, + 8,10,10,10, 7, 7, 8, 8, 9, 9, 9, 9,10,10,10, 7, + 7, 8, 8, 9, 9, 8, 9,10,10,10, 8, 8, 9, 9, 9, 9, + 9, 9,11,11,11, 8, 8, 9, 9, 9, 9, 9,10,10,11,11, + 9, 9, 9, 9, 9, 9, 9,10,11,11,11,10,11, 9, 9, 9, + 9,10, 9,11,11,11,10,11,10,10, 9, 9,10,10,11,11, + 11,11,11, 9, 9, 9, 9,10,10, +}; + +static float _vq_quantthresh__16c0_s_p7_1[] = { + -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, + 3.5, 4.5, +}; + +static long _vq_quantmap__16c0_s_p7_1[] = { + 9, 7, 5, 3, 1, 0, 2, 4, + 6, 8, 10, +}; + +static encode_aux_threshmatch _vq_auxt__16c0_s_p7_1 = { + _vq_quantthresh__16c0_s_p7_1, + _vq_quantmap__16c0_s_p7_1, + 11, + 11 +}; + +static static_codebook _16c0_s_p7_1 = { + 2, 121, + _vq_lengthlist__16c0_s_p7_1, + 1, -531365888, 1611661312, 4, 0, + _vq_quantlist__16c0_s_p7_1, + NULL, + &_vq_auxt__16c0_s_p7_1, + NULL, + 0 +}; + +static long _vq_quantlist__16c0_s_p8_0[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__16c0_s_p8_0[] = { + 1, 4, 4, 7, 7, 7, 7, 7, 6, 8, 8,10,10, 6, 5, 6, + 8, 8, 8, 8, 8, 8, 8, 9,10,10, 7, 6, 6, 8, 8, 8, + 8, 8, 8, 8, 8,10,10, 0, 8, 8, 8, 8, 9, 8, 9, 9, + 9,10,10,10, 0, 9, 8, 8, 8, 9, 9, 8, 8, 9, 9,10, + 10, 0,12,11, 8, 8, 9, 9, 9, 9,10,10,11,10, 0,12, + 13, 8, 8, 9,10, 9, 9,11,11,11,12, 0, 0, 0, 8, 8, + 8, 8,10, 9,12,13,12,14, 0, 0, 0, 8, 8, 8, 9,10, + 10,12,12,13,14, 0, 0, 0,13,13, 9, 9,11,11, 0, 0, + 14, 0, 0, 0, 0,14,14,10,10,12,11,12,14,14,14, 0, + 0, 0, 0, 0,11,11,13,13,14,13,14,14, 0, 0, 0, 0, + 0,12,13,13,12,13,14,14,14, +}; + +static float _vq_quantthresh__16c0_s_p8_0[] = { + -27.5, -22.5, -17.5, -12.5, -7.5, -2.5, 2.5, 7.5, + 12.5, 17.5, 22.5, 27.5, +}; + +static long _vq_quantmap__16c0_s_p8_0[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__16c0_s_p8_0 = { + _vq_quantthresh__16c0_s_p8_0, + _vq_quantmap__16c0_s_p8_0, + 13, + 13 +}; + +static static_codebook _16c0_s_p8_0 = { + 2, 169, + _vq_lengthlist__16c0_s_p8_0, + 1, -526516224, 1616117760, 4, 0, + _vq_quantlist__16c0_s_p8_0, + NULL, + &_vq_auxt__16c0_s_p8_0, + NULL, + 0 +}; + +static long _vq_quantlist__16c0_s_p8_1[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__16c0_s_p8_1[] = { + 1, 4, 3, 5, 5, 7, 7, 7, 6, 6, 7, 7, 7, 5, 5, 7, + 7, 7, 6, 6, 7, 7, 7, 6, 6, +}; + +static float _vq_quantthresh__16c0_s_p8_1[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__16c0_s_p8_1[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__16c0_s_p8_1 = { + _vq_quantthresh__16c0_s_p8_1, + _vq_quantmap__16c0_s_p8_1, + 5, + 5 +}; + +static static_codebook _16c0_s_p8_1 = { + 2, 25, + _vq_lengthlist__16c0_s_p8_1, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__16c0_s_p8_1, + NULL, + &_vq_auxt__16c0_s_p8_1, + NULL, + 0 +}; + +static long _vq_quantlist__16c0_s_p9_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__16c0_s_p9_0[] = { + 1, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, +}; + +static float _vq_quantthresh__16c0_s_p9_0[] = { + -157.5, 157.5, +}; + +static long _vq_quantmap__16c0_s_p9_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__16c0_s_p9_0 = { + _vq_quantthresh__16c0_s_p9_0, + _vq_quantmap__16c0_s_p9_0, + 3, + 3 +}; + +static static_codebook _16c0_s_p9_0 = { + 4, 81, + _vq_lengthlist__16c0_s_p9_0, + 1, -518803456, 1628680192, 2, 0, + _vq_quantlist__16c0_s_p9_0, + NULL, + &_vq_auxt__16c0_s_p9_0, + NULL, + 0 +}; + +static long _vq_quantlist__16c0_s_p9_1[] = { + 7, + 6, + 8, + 5, + 9, + 4, + 10, + 3, + 11, + 2, + 12, + 1, + 13, + 0, + 14, +}; + +static long _vq_lengthlist__16c0_s_p9_1[] = { + 1, 5, 5, 5, 5, 9,11,11,10,10,10,10,10,10,10, 7, + 6, 6, 6, 6,10,10,10,10,10,10,10,10,10,10, 7, 6, + 6, 6, 6,10, 9,10,10,10,10,10,10,10,10,10, 7, 7, + 8, 9,10,10,10,10,10,10,10,10,10,10,10, 8, 7,10, + 10,10, 9,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10, +}; + +static float _vq_quantthresh__16c0_s_p9_1[] = { + -136.5, -115.5, -94.5, -73.5, -52.5, -31.5, -10.5, 10.5, + 31.5, 52.5, 73.5, 94.5, 115.5, 136.5, +}; + +static long _vq_quantmap__16c0_s_p9_1[] = { + 13, 11, 9, 7, 5, 3, 1, 0, + 2, 4, 6, 8, 10, 12, 14, +}; + +static encode_aux_threshmatch _vq_auxt__16c0_s_p9_1 = { + _vq_quantthresh__16c0_s_p9_1, + _vq_quantmap__16c0_s_p9_1, + 15, + 15 +}; + +static static_codebook _16c0_s_p9_1 = { + 2, 225, + _vq_lengthlist__16c0_s_p9_1, + 1, -520986624, 1620377600, 4, 0, + _vq_quantlist__16c0_s_p9_1, + NULL, + &_vq_auxt__16c0_s_p9_1, + NULL, + 0 +}; + +static long _vq_quantlist__16c0_s_p9_2[] = { + 10, + 9, + 11, + 8, + 12, + 7, + 13, + 6, + 14, + 5, + 15, + 4, + 16, + 3, + 17, + 2, + 18, + 1, + 19, + 0, + 20, +}; + +static long _vq_lengthlist__16c0_s_p9_2[] = { + 1, 5, 5, 7, 8, 8, 7, 9, 9, 9,12,12,11,12,12,10, + 10,11,12,12,12,11,12,12, 8, 9, 8, 7, 9,10,10,11, + 11,10,11,12,10,12,10,12,12,12,11,12,11, 9, 8, 8, + 9,10, 9, 8, 9,10,12,12,11,11,12,11,10,11,12,11, + 12,12, 8, 9, 9, 9,10,11,12,11,12,11,11,11,11,12, + 12,11,11,12,12,11,11, 9, 9, 8, 9, 9,11, 9, 9,10, + 9,11,11,11,11,12,11,11,10,12,12,12, 9,12,11,10, + 11,11,11,11,12,12,12,11,11,11,12,10,12,12,12,10, + 10, 9,10, 9,10,10, 9, 9, 9,10,10,12,10,11,11, 9, + 11,11,10,11,11,11,10,10,10, 9, 9,10,10, 9, 9,10, + 11,11,10,11,10,11,10,11,11,10,11,11,11,10, 9,10, + 10, 9,10, 9, 9,11, 9, 9,11,10,10,11,11,10,10,11, + 10,11, 8, 9,11,11,10, 9,10,11,11,10,11,11,10,10, + 10,11,10, 9,10,10,11, 9,10,10, 9,11,10,10,10,10, + 11,10,11,11, 9,11,10,11,10,10,11,11,10,10,10, 9, + 10,10,11,11,11, 9,10,10,10,10,10,11,10,10,10, 9, + 10,10,11,10,10,10,10,10, 9,10,11,10,10,10,10,11, + 11,11,10,10,10,10,10,11,10,11,10,11,10,10,10, 9, + 11,11,10,10,10,11,11,10,10,10,10,10,10,10,10,11, + 11, 9,10,10,10,11,10,11,10,10,10,11, 9,10,11,10, + 11,10,10, 9,10,10,10,11,10,11,10,10,10,10,10,11, + 11,10,11,11,10,10,11,11,10, 9, 9,10,10,10,10,10, + 9,11, 9,10,10,10,11,11,10,10,10,10,11,11,11,10, + 9, 9,10,10,11,10,10,10,10,10,11,11,11,10,10,10, + 11,11,11, 9,10,10,10,10, 9,10, 9,10,11,10,11,10, + 10,11,11,10,11,11,11,11,11,10,11,10,10,10, 9,11, + 11,10,11,11,11,11,11,11,11,11,11,10,11,10,10,10, + 10,11,10,10,11, 9,10,10,10, +}; + +static float _vq_quantthresh__16c0_s_p9_2[] = { + -9.5, -8.5, -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, + -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, + 6.5, 7.5, 8.5, 9.5, +}; + +static long _vq_quantmap__16c0_s_p9_2[] = { + 19, 17, 15, 13, 11, 9, 7, 5, + 3, 1, 0, 2, 4, 6, 8, 10, + 12, 14, 16, 18, 20, +}; + +static encode_aux_threshmatch _vq_auxt__16c0_s_p9_2 = { + _vq_quantthresh__16c0_s_p9_2, + _vq_quantmap__16c0_s_p9_2, + 21, + 21 +}; + +static static_codebook _16c0_s_p9_2 = { + 2, 441, + _vq_lengthlist__16c0_s_p9_2, + 1, -529268736, 1611661312, 5, 0, + _vq_quantlist__16c0_s_p9_2, + NULL, + &_vq_auxt__16c0_s_p9_2, + NULL, + 0 +}; + +static long _huff_lengthlist__16c0_s_single[] = { + 3, 4,19, 7, 9, 7, 8,11, 9,12, 4, 1,19, 6, 7, 7, + 8,10,11,13,18,18,18,18,18,18,18,18,18,18, 8, 6, + 18, 8, 9, 9,11,12,14,18, 9, 6,18, 9, 7, 8, 9,11, + 12,18, 7, 6,18, 8, 7, 7, 7, 9,11,17, 8, 8,18, 9, + 7, 6, 6, 8,11,17,10,10,18,12, 9, 8, 7, 9,12,18, + 13,15,18,15,13,11,10,11,15,18,14,18,18,18,18,18, + 16,16,18,18, +}; + +static static_codebook _huff_book__16c0_s_single = { + 2, 100, + _huff_lengthlist__16c0_s_single, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist__16c1_s_long[] = { + 2, 5,20, 7,10, 7, 8,10,11,11, 4, 2,20, 5, 8, 6, + 7, 9,10,10,20,20,20,20,19,19,19,19,19,19, 7, 5, + 19, 6,10, 7, 9,11,13,17,11, 8,19,10, 7, 7, 8,10, + 11,15, 7, 5,19, 7, 7, 5, 6, 9,11,16, 7, 6,19, 8, + 7, 6, 6, 7, 9,13, 9, 9,19,11, 9, 8, 6, 7, 8,13, + 12,14,19,16,13,10, 9, 8, 9,13,14,17,19,18,18,17, + 12,11,11,13, +}; + +static static_codebook _huff_book__16c1_s_long = { + 2, 100, + _huff_lengthlist__16c1_s_long, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _vq_quantlist__16c1_s_p1_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__16c1_s_p1_0[] = { + 1, 5, 5, 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, 0, 0, 0, + 0, 0, 5, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 5, 8, 7, 0, 0, 0, 0, 0, 0, 7, 9, 9, 0, 0, 0, + 0, 0, 0, 7, 8, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 5, 7, 8, 0, 0, 0, 0, 0, 0, 7, 9, 8, 0, 0, + 0, 0, 0, 0, 7, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 8, 7, 0, 0, 0, 0, + 0, 0, 8, 9, 9, 0, 0, 0, 0, 0, 0, 7, 9, 9, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 9, 9, 0, 0, 0, + 0, 0, 0, 9, 9,11, 0, 0, 0, 0, 0, 0, 9,11,10, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 9, 9, 0, 0, + 0, 0, 0, 0, 8,11, 9, 0, 0, 0, 0, 0, 0, 9,10,11, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 5, 7, 8, 0, 0, 0, 0, 0, 0, 7, 9, 9, 0, 0, + 0, 0, 0, 0, 8, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 7, 9, 9, 0, 0, 0, 0, 0, 0, 9,11,10, 0, + 0, 0, 0, 0, 0, 8, 9,11, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 7, 9, 9, 0, 0, 0, 0, 0, 0, 9,10,11, + 0, 0, 0, 0, 0, 0, 9,11, 9, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + +static float _vq_quantthresh__16c1_s_p1_0[] = { + -0.5, 0.5, +}; + +static long _vq_quantmap__16c1_s_p1_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__16c1_s_p1_0 = { + _vq_quantthresh__16c1_s_p1_0, + _vq_quantmap__16c1_s_p1_0, + 3, + 3 +}; + +static static_codebook _16c1_s_p1_0 = { + 8, 6561, + _vq_lengthlist__16c1_s_p1_0, + 1, -535822336, 1611661312, 2, 0, + _vq_quantlist__16c1_s_p1_0, + NULL, + &_vq_auxt__16c1_s_p1_0, + NULL, + 0 +}; + +static long _vq_quantlist__16c1_s_p2_0[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__16c1_s_p2_0[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + +static float _vq_quantthresh__16c1_s_p2_0[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__16c1_s_p2_0[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__16c1_s_p2_0 = { + _vq_quantthresh__16c1_s_p2_0, + _vq_quantmap__16c1_s_p2_0, + 5, + 5 +}; + +static static_codebook _16c1_s_p2_0 = { + 4, 625, + _vq_lengthlist__16c1_s_p2_0, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__16c1_s_p2_0, + NULL, + &_vq_auxt__16c1_s_p2_0, + NULL, + 0 +}; + +static long _vq_quantlist__16c1_s_p3_0[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__16c1_s_p3_0[] = { + 1, 4, 4, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 5, 5, 7, 7, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 4, 5, 5, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 9, 9, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 6, 7, 7, 9, 9, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + +static float _vq_quantthresh__16c1_s_p3_0[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__16c1_s_p3_0[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__16c1_s_p3_0 = { + _vq_quantthresh__16c1_s_p3_0, + _vq_quantmap__16c1_s_p3_0, + 5, + 5 +}; + +static static_codebook _16c1_s_p3_0 = { + 4, 625, + _vq_lengthlist__16c1_s_p3_0, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__16c1_s_p3_0, + NULL, + &_vq_auxt__16c1_s_p3_0, + NULL, + 0 +}; + +static long _vq_quantlist__16c1_s_p4_0[] = { + 4, + 3, + 5, + 2, + 6, + 1, + 7, + 0, + 8, +}; + +static long _vq_lengthlist__16c1_s_p4_0[] = { + 1, 2, 3, 7, 7, 0, 0, 0, 0, 0, 0, 0, 6, 6, 0, 0, + 0, 0, 0, 0, 0, 6, 6, 0, 0, 0, 0, 0, 0, 0, 7, 7, + 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, + 8, 8, 0, 0, 0, 0, 0, 0, 0, 8, 9, 0, 0, 0, 0, 0, + 0, 0,10,10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + +static float _vq_quantthresh__16c1_s_p4_0[] = { + -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, +}; + +static long _vq_quantmap__16c1_s_p4_0[] = { + 7, 5, 3, 1, 0, 2, 4, 6, + 8, +}; + +static encode_aux_threshmatch _vq_auxt__16c1_s_p4_0 = { + _vq_quantthresh__16c1_s_p4_0, + _vq_quantmap__16c1_s_p4_0, + 9, + 9 +}; + +static static_codebook _16c1_s_p4_0 = { + 2, 81, + _vq_lengthlist__16c1_s_p4_0, + 1, -531628032, 1611661312, 4, 0, + _vq_quantlist__16c1_s_p4_0, + NULL, + &_vq_auxt__16c1_s_p4_0, + NULL, + 0 +}; + +static long _vq_quantlist__16c1_s_p5_0[] = { + 4, + 3, + 5, + 2, + 6, + 1, + 7, + 0, + 8, +}; + +static long _vq_lengthlist__16c1_s_p5_0[] = { + 1, 3, 3, 5, 5, 6, 6, 8, 8, 0, 0, 0, 7, 7, 7, 7, + 9, 9, 0, 0, 0, 7, 7, 7, 7, 9, 9, 0, 0, 0, 8, 8, + 8, 8, 9, 9, 0, 0, 0, 8, 8, 8, 8,10,10, 0, 0, 0, + 9, 9, 8, 8,10,10, 0, 0, 0, 9, 9, 8, 8,10,10, 0, + 0, 0,10,10, 9, 9,10,10, 0, 0, 0, 0, 0, 9, 9,10, + 10, +}; + +static float _vq_quantthresh__16c1_s_p5_0[] = { + -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, +}; + +static long _vq_quantmap__16c1_s_p5_0[] = { + 7, 5, 3, 1, 0, 2, 4, 6, + 8, +}; + +static encode_aux_threshmatch _vq_auxt__16c1_s_p5_0 = { + _vq_quantthresh__16c1_s_p5_0, + _vq_quantmap__16c1_s_p5_0, + 9, + 9 +}; + +static static_codebook _16c1_s_p5_0 = { + 2, 81, + _vq_lengthlist__16c1_s_p5_0, + 1, -531628032, 1611661312, 4, 0, + _vq_quantlist__16c1_s_p5_0, + NULL, + &_vq_auxt__16c1_s_p5_0, + NULL, + 0 +}; + +static long _vq_quantlist__16c1_s_p6_0[] = { + 8, + 7, + 9, + 6, + 10, + 5, + 11, + 4, + 12, + 3, + 13, + 2, + 14, + 1, + 15, + 0, + 16, +}; + +static long _vq_lengthlist__16c1_s_p6_0[] = { + 1, 3, 3, 6, 6, 8, 8, 9, 9, 9, 9,10,10,11,11,12, + 12, 0, 0, 0, 7, 7, 8, 8, 9, 9, 9, 9,10,10,11,11, + 12,12, 0, 0, 0, 7, 7, 8, 8, 9, 9, 9, 9,10,10,11, + 11,12,12, 0, 0, 0, 8, 8, 8, 9,10, 9,10,10,10,10, + 11,11,12,12, 0, 0, 0, 8, 8, 9, 9,10,10,10,10,11, + 11,11,12,12,12, 0, 0, 0, 8, 8, 9, 9,10,10,10,10, + 11,11,12,12,12,12, 0, 0, 0, 8, 8, 9, 9,10,10,10, + 10,11,11,12,12,13,13, 0, 0, 0, 9, 9, 9, 9,10,10, + 10,10,11,11,12,12,13,13, 0, 0, 0, 0, 0, 9, 9,10, + 10,10,10,11,11,12,12,13,13, 0, 0, 0, 0, 0, 9, 9, + 10,10,11,11,12,12,12,12,13,13, 0, 0, 0, 0, 0, 9, + 9,10,10,11,11,12,12,12,12,13,13, 0, 0, 0, 0, 0, + 10,10,11,10,11,11,12,12,13,13,13,13, 0, 0, 0, 0, + 0, 0, 0,10,10,11,11,12,12,13,13,13,13, 0, 0, 0, + 0, 0, 0, 0,11,11,12,12,12,12,13,13,14,14, 0, 0, + 0, 0, 0, 0, 0,11,11,12,12,12,12,13,13,14,14, 0, + 0, 0, 0, 0, 0, 0,12,12,12,12,13,13,13,13,14,14, + 0, 0, 0, 0, 0, 0, 0, 0, 0,12,12,13,13,13,13,14, + 14, +}; + +static float _vq_quantthresh__16c1_s_p6_0[] = { + -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, + 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, +}; + +static long _vq_quantmap__16c1_s_p6_0[] = { + 15, 13, 11, 9, 7, 5, 3, 1, + 0, 2, 4, 6, 8, 10, 12, 14, + 16, +}; + +static encode_aux_threshmatch _vq_auxt__16c1_s_p6_0 = { + _vq_quantthresh__16c1_s_p6_0, + _vq_quantmap__16c1_s_p6_0, + 17, + 17 +}; + +static static_codebook _16c1_s_p6_0 = { + 2, 289, + _vq_lengthlist__16c1_s_p6_0, + 1, -529530880, 1611661312, 5, 0, + _vq_quantlist__16c1_s_p6_0, + NULL, + &_vq_auxt__16c1_s_p6_0, + NULL, + 0 +}; + +static long _vq_quantlist__16c1_s_p7_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__16c1_s_p7_0[] = { + 1, 4, 4, 6, 6, 6, 7, 6, 6, 4, 7, 7,10, 9,10,10, + 10, 9, 4, 7, 7,10,10,10,11,10,10, 6,10,10,11,11, + 11,11,10,10, 6,10, 9,11,11,11,11,10,10, 6,10,10, + 11,11,11,11,10,10, 7,11,11,11,11,11,12,12,11, 6, + 10,10,11,10,10,11,11,11, 6,10,10,10,11,10,11,11, + 11, +}; + +static float _vq_quantthresh__16c1_s_p7_0[] = { + -5.5, 5.5, +}; + +static long _vq_quantmap__16c1_s_p7_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__16c1_s_p7_0 = { + _vq_quantthresh__16c1_s_p7_0, + _vq_quantmap__16c1_s_p7_0, + 3, + 3 +}; + +static static_codebook _16c1_s_p7_0 = { + 4, 81, + _vq_lengthlist__16c1_s_p7_0, + 1, -529137664, 1618345984, 2, 0, + _vq_quantlist__16c1_s_p7_0, + NULL, + &_vq_auxt__16c1_s_p7_0, + NULL, + 0 +}; + +static long _vq_quantlist__16c1_s_p7_1[] = { + 5, + 4, + 6, + 3, + 7, + 2, + 8, + 1, + 9, + 0, + 10, +}; + +static long _vq_lengthlist__16c1_s_p7_1[] = { + 2, 3, 3, 5, 6, 7, 7, 7, 7, 8, 8,10,10,10, 6, 6, + 7, 7, 8, 8, 8, 8,10,10,10, 6, 6, 7, 7, 8, 8, 8, + 8,10,10,10, 7, 7, 7, 7, 8, 8, 8, 8,10,10,10, 7, + 7, 7, 7, 8, 8, 8, 8,10,10,10, 7, 7, 8, 8, 8, 8, + 8, 8,10,10,10, 7, 7, 8, 8, 8, 8, 8, 8,10,10,10, + 8, 8, 8, 8, 8, 8, 9, 9,10,10,10,10,10, 8, 8, 8, + 8, 9, 9,10,10,10,10,10, 9, 9, 8, 8, 9, 9,10,10, + 10,10,10, 8, 8, 8, 8, 9, 9, +}; + +static float _vq_quantthresh__16c1_s_p7_1[] = { + -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, + 3.5, 4.5, +}; + +static long _vq_quantmap__16c1_s_p7_1[] = { + 9, 7, 5, 3, 1, 0, 2, 4, + 6, 8, 10, +}; + +static encode_aux_threshmatch _vq_auxt__16c1_s_p7_1 = { + _vq_quantthresh__16c1_s_p7_1, + _vq_quantmap__16c1_s_p7_1, + 11, + 11 +}; + +static static_codebook _16c1_s_p7_1 = { + 2, 121, + _vq_lengthlist__16c1_s_p7_1, + 1, -531365888, 1611661312, 4, 0, + _vq_quantlist__16c1_s_p7_1, + NULL, + &_vq_auxt__16c1_s_p7_1, + NULL, + 0 +}; + +static long _vq_quantlist__16c1_s_p8_0[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__16c1_s_p8_0[] = { + 1, 4, 4, 6, 6, 7, 7, 7, 7, 8, 8, 9, 9, 6, 5, 5, + 7, 8, 8, 9, 8, 8, 9, 9,10,11, 6, 5, 5, 8, 8, 9, + 9, 8, 8, 9,10,10,11, 0, 8, 8, 8, 9, 9, 9, 9, 9, + 10,10,11,11, 0, 9, 9, 9, 8, 9, 9, 9, 9,10,10,11, + 11, 0,13,13, 9, 9,10,10,10,10,11,11,12,12, 0,14, + 13, 9, 9,10,10,10,10,11,11,12,12, 0, 0, 0,10,10, + 9, 9,11,11,12,12,13,12, 0, 0, 0,10,10, 9, 9,10, + 10,12,12,13,13, 0, 0, 0,13,14,11,10,11,11,12,12, + 13,14, 0, 0, 0,14,14,10,10,11,11,12,12,13,13, 0, + 0, 0, 0, 0,12,12,12,12,13,13,14,15, 0, 0, 0, 0, + 0,12,12,12,12,13,13,14,15, +}; + +static float _vq_quantthresh__16c1_s_p8_0[] = { + -27.5, -22.5, -17.5, -12.5, -7.5, -2.5, 2.5, 7.5, + 12.5, 17.5, 22.5, 27.5, +}; + +static long _vq_quantmap__16c1_s_p8_0[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__16c1_s_p8_0 = { + _vq_quantthresh__16c1_s_p8_0, + _vq_quantmap__16c1_s_p8_0, + 13, + 13 +}; + +static static_codebook _16c1_s_p8_0 = { + 2, 169, + _vq_lengthlist__16c1_s_p8_0, + 1, -526516224, 1616117760, 4, 0, + _vq_quantlist__16c1_s_p8_0, + NULL, + &_vq_auxt__16c1_s_p8_0, + NULL, + 0 +}; + +static long _vq_quantlist__16c1_s_p8_1[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__16c1_s_p8_1[] = { + 2, 3, 3, 5, 5, 6, 6, 6, 5, 5, 6, 6, 6, 5, 5, 6, + 6, 6, 5, 5, 6, 6, 6, 5, 5, +}; + +static float _vq_quantthresh__16c1_s_p8_1[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__16c1_s_p8_1[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__16c1_s_p8_1 = { + _vq_quantthresh__16c1_s_p8_1, + _vq_quantmap__16c1_s_p8_1, + 5, + 5 +}; + +static static_codebook _16c1_s_p8_1 = { + 2, 25, + _vq_lengthlist__16c1_s_p8_1, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__16c1_s_p8_1, + NULL, + &_vq_auxt__16c1_s_p8_1, + NULL, + 0 +}; + +static long _vq_quantlist__16c1_s_p9_0[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__16c1_s_p9_0[] = { + 1, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, +}; + +static float _vq_quantthresh__16c1_s_p9_0[] = { + -1732.5, -1417.5, -1102.5, -787.5, -472.5, -157.5, 157.5, 472.5, + 787.5, 1102.5, 1417.5, 1732.5, +}; + +static long _vq_quantmap__16c1_s_p9_0[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__16c1_s_p9_0 = { + _vq_quantthresh__16c1_s_p9_0, + _vq_quantmap__16c1_s_p9_0, + 13, + 13 +}; + +static static_codebook _16c1_s_p9_0 = { + 2, 169, + _vq_lengthlist__16c1_s_p9_0, + 1, -513964032, 1628680192, 4, 0, + _vq_quantlist__16c1_s_p9_0, + NULL, + &_vq_auxt__16c1_s_p9_0, + NULL, + 0 +}; + +static long _vq_quantlist__16c1_s_p9_1[] = { + 7, + 6, + 8, + 5, + 9, + 4, + 10, + 3, + 11, + 2, + 12, + 1, + 13, + 0, + 14, +}; + +static long _vq_lengthlist__16c1_s_p9_1[] = { + 1, 4, 4, 4, 4, 8, 8,12,13,14,14,14,14,14,14, 6, + 6, 6, 6, 6,10, 9,14,14,14,14,14,14,14,14, 7, 6, + 5, 6, 6,10, 9,12,13,13,13,13,13,13,13,13, 7, 7, + 9, 9,11,11,12,13,13,13,13,13,13,13,13, 7, 7, 8, + 8,11,12,13,13,13,13,13,13,13,13,13,12,12,10,10, + 13,12,13,13,13,13,13,13,13,13,13,12,12,10,10,13, + 13,13,13,13,13,13,13,13,13,13,13,13,13,12,13,12, + 13,13,13,13,13,13,13,13,13,13,13,13,12,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,13,12,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13,12,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13, +}; + +static float _vq_quantthresh__16c1_s_p9_1[] = { + -136.5, -115.5, -94.5, -73.5, -52.5, -31.5, -10.5, 10.5, + 31.5, 52.5, 73.5, 94.5, 115.5, 136.5, +}; + +static long _vq_quantmap__16c1_s_p9_1[] = { + 13, 11, 9, 7, 5, 3, 1, 0, + 2, 4, 6, 8, 10, 12, 14, +}; + +static encode_aux_threshmatch _vq_auxt__16c1_s_p9_1 = { + _vq_quantthresh__16c1_s_p9_1, + _vq_quantmap__16c1_s_p9_1, + 15, + 15 +}; + +static static_codebook _16c1_s_p9_1 = { + 2, 225, + _vq_lengthlist__16c1_s_p9_1, + 1, -520986624, 1620377600, 4, 0, + _vq_quantlist__16c1_s_p9_1, + NULL, + &_vq_auxt__16c1_s_p9_1, + NULL, + 0 +}; + +static long _vq_quantlist__16c1_s_p9_2[] = { + 10, + 9, + 11, + 8, + 12, + 7, + 13, + 6, + 14, + 5, + 15, + 4, + 16, + 3, + 17, + 2, + 18, + 1, + 19, + 0, + 20, +}; + +static long _vq_lengthlist__16c1_s_p9_2[] = { + 1, 4, 4, 6, 6, 7, 7, 8, 7, 8, 8, 9, 9, 9, 9,10, + 10,10, 9,10,10,11,12,12, 8, 8, 8, 8, 9, 9, 9, 9, + 10,10,10,10,10,11,11,10,12,11,11,13,11, 7, 7, 8, + 8, 8, 8, 9, 9, 9,10,10,10,10, 9,10,10,11,11,12, + 11,11, 8, 8, 8, 8, 9, 9,10,10,10,10,11,11,11,11, + 11,11,11,12,11,12,12, 8, 8, 9, 9, 9, 9, 9,10,10, + 10,10,10,10,11,11,11,11,11,11,12,11, 9, 9, 9, 9, + 10,10,10,10,11,10,11,11,11,11,11,11,12,12,12,12, + 11, 9, 9, 9, 9,10,10,10,10,11,11,11,11,11,11,11, + 11,11,12,12,12,13, 9,10,10, 9,11,10,10,10,10,11, + 11,11,11,11,10,11,12,11,12,12,11,12,11,10, 9,10, + 10,11,10,11,11,11,11,11,11,11,11,11,12,12,11,12, + 12,12,10,10,10,11,10,11,11,11,11,11,11,11,11,11, + 11,11,12,13,12,12,11, 9,10,10,11,11,10,11,11,11, + 12,11,11,11,11,11,12,12,13,13,12,13,10,10,12,10, + 11,11,11,11,11,11,11,11,11,12,12,11,13,12,12,12, + 12,13,12,11,11,11,11,11,11,12,11,12,11,11,11,11, + 12,12,13,12,11,12,12,11,11,11,11,11,12,11,11,11, + 11,12,11,11,12,11,12,13,13,12,12,12,12,11,11,11, + 11,11,12,11,11,12,11,12,11,11,11,11,13,12,12,12, + 12,13,11,11,11,12,12,11,11,11,12,11,12,12,12,11, + 12,13,12,11,11,12,12,11,12,11,11,11,12,12,11,12, + 11,11,11,12,12,12,12,13,12,13,12,12,12,12,11,11, + 12,11,11,11,11,11,11,12,12,12,13,12,11,13,13,12, + 12,11,12,10,11,11,11,11,12,11,12,12,11,12,12,13, + 12,12,13,12,12,12,12,12,11,12,12,12,11,12,11,11, + 11,12,13,12,13,13,13,13,13,12,13,13,12,12,13,11, + 11,11,11,11,12,11,11,12,11, +}; + +static float _vq_quantthresh__16c1_s_p9_2[] = { + -9.5, -8.5, -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, + -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, + 6.5, 7.5, 8.5, 9.5, +}; + +static long _vq_quantmap__16c1_s_p9_2[] = { + 19, 17, 15, 13, 11, 9, 7, 5, + 3, 1, 0, 2, 4, 6, 8, 10, + 12, 14, 16, 18, 20, +}; + +static encode_aux_threshmatch _vq_auxt__16c1_s_p9_2 = { + _vq_quantthresh__16c1_s_p9_2, + _vq_quantmap__16c1_s_p9_2, + 21, + 21 +}; + +static static_codebook _16c1_s_p9_2 = { + 2, 441, + _vq_lengthlist__16c1_s_p9_2, + 1, -529268736, 1611661312, 5, 0, + _vq_quantlist__16c1_s_p9_2, + NULL, + &_vq_auxt__16c1_s_p9_2, + NULL, + 0 +}; + +static long _huff_lengthlist__16c1_s_short[] = { + 5, 6,17, 8,12, 9,10,10,12,13, 5, 2,17, 4, 9, 5, + 7, 8,11,13,16,16,16,16,16,16,16,16,16,16, 6, 4, + 16, 5,10, 5, 7,10,14,16,13, 9,16,11, 8, 7, 8, 9, + 13,16, 7, 4,16, 5, 7, 4, 6, 8,11,13, 8, 6,16, 7, + 8, 5, 5, 7, 9,13, 9, 8,16, 9, 8, 6, 6, 7, 9,13, + 11,11,16,10,10, 7, 7, 7, 9,13,13,13,16,13,13, 9, + 9, 9,10,13, +}; + +static static_codebook _huff_book__16c1_s_short = { + 2, 100, + _huff_lengthlist__16c1_s_short, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist__16c2_s_long[] = { + 4, 7, 9, 9, 9, 8, 9,10,15,19, 5, 4, 5, 6, 7, 7, + 8, 9,14,16, 6, 5, 4, 5, 6, 7, 8,10,12,19, 7, 6, + 5, 4, 5, 6, 7, 9,11,18, 8, 7, 6, 5, 5, 5, 7, 9, + 10,17, 8, 7, 7, 5, 5, 5, 6, 7,12,18, 8, 8, 8, 7, + 7, 5, 5, 7,12,18, 8, 9,10, 9, 9, 7, 6, 7,12,17, + 14,18,16,16,15,12,11,10,12,18,15,17,18,18,18,15, + 14,14,16,18, +}; + +static static_codebook _huff_book__16c2_s_long = { + 2, 100, + _huff_lengthlist__16c2_s_long, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _vq_quantlist__16c2_s_p1_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__16c2_s_p1_0[] = { + 1, 3, 3, 0, 0, 0, 0, 0, 0, 4, 5, 5, 0, 0, 0, 0, + 0, 0, 4, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + +static float _vq_quantthresh__16c2_s_p1_0[] = { + -0.5, 0.5, +}; + +static long _vq_quantmap__16c2_s_p1_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__16c2_s_p1_0 = { + _vq_quantthresh__16c2_s_p1_0, + _vq_quantmap__16c2_s_p1_0, + 3, + 3 +}; + +static static_codebook _16c2_s_p1_0 = { + 4, 81, + _vq_lengthlist__16c2_s_p1_0, + 1, -535822336, 1611661312, 2, 0, + _vq_quantlist__16c2_s_p1_0, + NULL, + &_vq_auxt__16c2_s_p1_0, + NULL, + 0 +}; + +static long _vq_quantlist__16c2_s_p2_0[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__16c2_s_p2_0[] = { + 2, 4, 3, 7, 7, 0, 0, 0, 7, 8, 0, 0, 0, 8, 8, 0, + 0, 0, 8, 8, 0, 0, 0, 8, 8, 4, 5, 4, 8, 8, 0, 0, + 0, 8, 8, 0, 0, 0, 8, 8, 0, 0, 0, 9, 9, 0, 0, 0, + 9, 9, 4, 4, 5, 8, 8, 0, 0, 0, 8, 8, 0, 0, 0, 8, + 8, 0, 0, 0, 9, 9, 0, 0, 0, 9, 9, 7, 8, 8,10,10, + 0, 0, 0,12,11, 0, 0, 0,11,11, 0, 0, 0,14,13, 0, + 0, 0,14,13, 7, 8, 8, 9,10, 0, 0, 0,11,12, 0, 0, + 0,11,11, 0, 0, 0,14,14, 0, 0, 0,13,14, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8,11,11, 0, 0, 0, + 11,11, 0, 0, 0,12,11, 0, 0, 0,12,12, 0, 0, 0,13, + 13, 8, 8, 8,11,11, 0, 0, 0,11,11, 0, 0, 0,11,12, + 0, 0, 0,12,13, 0, 0, 0,13,13, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 8, 8, 8,12,11, 0, 0, 0,12,11, 0, + 0, 0,11,11, 0, 0, 0,13,13, 0, 0, 0,13,12, 8, 8, + 8,11,12, 0, 0, 0,11,12, 0, 0, 0,11,11, 0, 0, 0, + 13,13, 0, 0, 0,12,13, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 8, 9, 9,14,13, 0, 0, 0,13,12, 0, 0, 0,13, + 13, 0, 0, 0,13,12, 0, 0, 0,13,13, 8, 9, 9,13,14, + 0, 0, 0,12,13, 0, 0, 0,13,13, 0, 0, 0,12,13, 0, + 0, 0,13,13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, + 9, 9,14,13, 0, 0, 0,13,13, 0, 0, 0,13,12, 0, 0, + 0,13,13, 0, 0, 0,13,12, 8, 9, 9,14,14, 0, 0, 0, + 13,13, 0, 0, 0,12,13, 0, 0, 0,13,13, 0, 0, 0,12, + 13, +}; + +static float _vq_quantthresh__16c2_s_p2_0[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__16c2_s_p2_0[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__16c2_s_p2_0 = { + _vq_quantthresh__16c2_s_p2_0, + _vq_quantmap__16c2_s_p2_0, + 5, + 5 +}; + +static static_codebook _16c2_s_p2_0 = { + 4, 625, + _vq_lengthlist__16c2_s_p2_0, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__16c2_s_p2_0, + NULL, + &_vq_auxt__16c2_s_p2_0, + NULL, + 0 +}; + +static long _vq_quantlist__16c2_s_p3_0[] = { + 4, + 3, + 5, + 2, + 6, + 1, + 7, + 0, + 8, +}; + +static long _vq_lengthlist__16c2_s_p3_0[] = { + 1, 3, 3, 6, 6, 7, 7, 8, 8, 0, 0, 0, 6, 6, 7, 7, + 9, 9, 0, 0, 0, 6, 6, 7, 7, 9, 9, 0, 0, 0, 7, 7, + 8, 8,10,10, 0, 0, 0, 7, 7, 8, 8,10,10, 0, 0, 0, + 7, 7, 9, 9,10,10, 0, 0, 0, 7, 7, 9, 9,10,10, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + +static float _vq_quantthresh__16c2_s_p3_0[] = { + -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, +}; + +static long _vq_quantmap__16c2_s_p3_0[] = { + 7, 5, 3, 1, 0, 2, 4, 6, + 8, +}; + +static encode_aux_threshmatch _vq_auxt__16c2_s_p3_0 = { + _vq_quantthresh__16c2_s_p3_0, + _vq_quantmap__16c2_s_p3_0, + 9, + 9 +}; + +static static_codebook _16c2_s_p3_0 = { + 2, 81, + _vq_lengthlist__16c2_s_p3_0, + 1, -531628032, 1611661312, 4, 0, + _vq_quantlist__16c2_s_p3_0, + NULL, + &_vq_auxt__16c2_s_p3_0, + NULL, + 0 +}; + +static long _vq_quantlist__16c2_s_p4_0[] = { + 8, + 7, + 9, + 6, + 10, + 5, + 11, + 4, + 12, + 3, + 13, + 2, + 14, + 1, + 15, + 0, + 16, +}; + +static long _vq_lengthlist__16c2_s_p4_0[] = { + 2, 3, 3, 5, 5, 6, 6, 7, 7, 7, 7, 8, 8, 9, 9,10, + 10, 0, 0, 0, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9,10,10, + 11,11, 0, 0, 0, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9,10, + 10,10,11, 0, 0, 0, 6, 6, 8, 8, 8, 8, 9, 9,10,10, + 10,11,11,11, 0, 0, 0, 6, 6, 8, 8, 9, 9, 9, 9,10, + 10,11,11,11,11, 0, 0, 0, 7, 7, 8, 8, 9, 9, 9, 9, + 10,10,11,11,12,12, 0, 0, 0, 7, 7, 8, 8, 9, 9, 9, + 9,10,10,11,11,12,12, 0, 0, 0, 7, 7, 8, 8, 9, 9, + 10,10,11,11,12,12,12,12, 0, 0, 0, 0, 0, 8, 8, 9, + 9,10,10,11,11,12,12,12,12, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + +static float _vq_quantthresh__16c2_s_p4_0[] = { + -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, + 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, +}; + +static long _vq_quantmap__16c2_s_p4_0[] = { + 15, 13, 11, 9, 7, 5, 3, 1, + 0, 2, 4, 6, 8, 10, 12, 14, + 16, +}; + +static encode_aux_threshmatch _vq_auxt__16c2_s_p4_0 = { + _vq_quantthresh__16c2_s_p4_0, + _vq_quantmap__16c2_s_p4_0, + 17, + 17 +}; + +static static_codebook _16c2_s_p4_0 = { + 2, 289, + _vq_lengthlist__16c2_s_p4_0, + 1, -529530880, 1611661312, 5, 0, + _vq_quantlist__16c2_s_p4_0, + NULL, + &_vq_auxt__16c2_s_p4_0, + NULL, + 0 +}; + +static long _vq_quantlist__16c2_s_p5_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__16c2_s_p5_0[] = { + 1, 4, 4, 5, 7, 7, 6, 7, 7, 4, 6, 6,10,10,10,10, + 10,10, 4, 7, 6,10,10,10,10,10,10, 5, 9, 9, 9,12, + 11,10,11,12, 7,10,10,12,12,12,12,12,12, 7,10,10, + 11,12,12,12,12,13, 6,10,10,10,12,12,10,12,12, 7, + 10,10,11,13,12,12,12,12, 7,10,10,11,12,12,12,12, + 12, +}; + +static float _vq_quantthresh__16c2_s_p5_0[] = { + -5.5, 5.5, +}; + +static long _vq_quantmap__16c2_s_p5_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__16c2_s_p5_0 = { + _vq_quantthresh__16c2_s_p5_0, + _vq_quantmap__16c2_s_p5_0, + 3, + 3 +}; + +static static_codebook _16c2_s_p5_0 = { + 4, 81, + _vq_lengthlist__16c2_s_p5_0, + 1, -529137664, 1618345984, 2, 0, + _vq_quantlist__16c2_s_p5_0, + NULL, + &_vq_auxt__16c2_s_p5_0, + NULL, + 0 +}; + +static long _vq_quantlist__16c2_s_p5_1[] = { + 5, + 4, + 6, + 3, + 7, + 2, + 8, + 1, + 9, + 0, + 10, +}; + +static long _vq_lengthlist__16c2_s_p5_1[] = { + 2, 3, 3, 6, 6, 7, 7, 7, 7, 8, 8,11,11,11, 6, 6, + 7, 7, 8, 8, 8, 8,11,11,11, 6, 6, 7, 7, 8, 8, 8, + 8,11,11,11, 6, 6, 8, 8, 8, 8, 9, 9,11,11,11, 6, + 6, 8, 8, 8, 8, 9, 9,11,11,11, 7, 7, 8, 8, 8, 8, + 8, 8,11,11,11, 7, 7, 8, 8, 8, 8, 8, 9,11,11,11, + 8, 8, 8, 8, 8, 8, 8, 8,11,11,11,11,11, 8, 8, 8, + 8, 8, 8,11,11,11,11,11, 8, 8, 8, 8, 8, 8,11,11, + 11,11,11, 7, 7, 8, 8, 8, 8, +}; + +static float _vq_quantthresh__16c2_s_p5_1[] = { + -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, + 3.5, 4.5, +}; + +static long _vq_quantmap__16c2_s_p5_1[] = { + 9, 7, 5, 3, 1, 0, 2, 4, + 6, 8, 10, +}; + +static encode_aux_threshmatch _vq_auxt__16c2_s_p5_1 = { + _vq_quantthresh__16c2_s_p5_1, + _vq_quantmap__16c2_s_p5_1, + 11, + 11 +}; + +static static_codebook _16c2_s_p5_1 = { + 2, 121, + _vq_lengthlist__16c2_s_p5_1, + 1, -531365888, 1611661312, 4, 0, + _vq_quantlist__16c2_s_p5_1, + NULL, + &_vq_auxt__16c2_s_p5_1, + NULL, + 0 +}; + +static long _vq_quantlist__16c2_s_p6_0[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__16c2_s_p6_0[] = { + 1, 4, 4, 7, 6, 8, 8, 9, 9,10,10,11,11, 5, 5, 5, + 7, 7, 9, 9, 9, 9,11,11,12,12, 6, 5, 5, 7, 7, 9, + 9,10,10,11,11,12,12, 0, 6, 6, 7, 7, 9, 9,10,10, + 11,11,12,12, 0, 7, 7, 7, 7, 9, 9,10,10,11,12,12, + 12, 0,11,11, 8, 8,10,10,11,11,12,12,13,13, 0,11, + 12, 8, 8,10,10,11,11,12,12,13,13, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, +}; + +static float _vq_quantthresh__16c2_s_p6_0[] = { + -27.5, -22.5, -17.5, -12.5, -7.5, -2.5, 2.5, 7.5, + 12.5, 17.5, 22.5, 27.5, +}; + +static long _vq_quantmap__16c2_s_p6_0[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__16c2_s_p6_0 = { + _vq_quantthresh__16c2_s_p6_0, + _vq_quantmap__16c2_s_p6_0, + 13, + 13 +}; + +static static_codebook _16c2_s_p6_0 = { + 2, 169, + _vq_lengthlist__16c2_s_p6_0, + 1, -526516224, 1616117760, 4, 0, + _vq_quantlist__16c2_s_p6_0, + NULL, + &_vq_auxt__16c2_s_p6_0, + NULL, + 0 +}; + +static long _vq_quantlist__16c2_s_p6_1[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__16c2_s_p6_1[] = { + 2, 3, 3, 5, 5, 6, 6, 6, 5, 5, 6, 6, 6, 5, 5, 6, + 6, 6, 5, 5, 6, 6, 6, 5, 5, +}; + +static float _vq_quantthresh__16c2_s_p6_1[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__16c2_s_p6_1[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__16c2_s_p6_1 = { + _vq_quantthresh__16c2_s_p6_1, + _vq_quantmap__16c2_s_p6_1, + 5, + 5 +}; + +static static_codebook _16c2_s_p6_1 = { + 2, 25, + _vq_lengthlist__16c2_s_p6_1, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__16c2_s_p6_1, + NULL, + &_vq_auxt__16c2_s_p6_1, + NULL, + 0 +}; + +static long _vq_quantlist__16c2_s_p7_0[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__16c2_s_p7_0[] = { + 1, 4, 4, 7, 7, 8, 8, 9, 9,10,10,11,11, 5, 5, 5, + 8, 8, 9, 9,10,10,11,11,12,12, 6, 5, 5, 8, 8, 9, + 9,10,10,11,11,12,13,18, 6, 6, 7, 7, 9, 9,10,10, + 12,12,13,13,18, 6, 6, 7, 7, 9, 9,10,10,12,12,13, + 13,18,11,10, 8, 8,10,10,11,11,12,12,13,13,18,11, + 11, 8, 8,10,10,11,11,12,13,13,13,18,18,18,10,11, + 11,11,12,12,13,13,14,14,18,18,18,11,11,11,11,12, + 12,13,13,14,14,18,18,18,14,14,12,12,12,12,14,14, + 15,14,18,18,18,15,15,11,12,12,12,13,13,15,15,18, + 18,18,18,18,13,13,13,13,13,14,17,16,18,18,18,18, + 18,13,14,13,13,14,13,15,14, +}; + +static float _vq_quantthresh__16c2_s_p7_0[] = { + -60.5, -49.5, -38.5, -27.5, -16.5, -5.5, 5.5, 16.5, + 27.5, 38.5, 49.5, 60.5, +}; + +static long _vq_quantmap__16c2_s_p7_0[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__16c2_s_p7_0 = { + _vq_quantthresh__16c2_s_p7_0, + _vq_quantmap__16c2_s_p7_0, + 13, + 13 +}; + +static static_codebook _16c2_s_p7_0 = { + 2, 169, + _vq_lengthlist__16c2_s_p7_0, + 1, -523206656, 1618345984, 4, 0, + _vq_quantlist__16c2_s_p7_0, + NULL, + &_vq_auxt__16c2_s_p7_0, + NULL, + 0 +}; + +static long _vq_quantlist__16c2_s_p7_1[] = { + 5, + 4, + 6, + 3, + 7, + 2, + 8, + 1, + 9, + 0, + 10, +}; + +static long _vq_lengthlist__16c2_s_p7_1[] = { + 2, 4, 4, 6, 6, 7, 7, 7, 7, 7, 7, 9, 9, 9, 6, 6, + 7, 7, 8, 8, 8, 8, 9, 9, 9, 6, 6, 7, 7, 8, 8, 8, + 8, 9, 9, 9, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 7, + 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 7, 7, 7, 7, 8, 8, + 8, 8, 9, 9, 9, 7, 7, 7, 7, 7, 7, 8, 8, 9, 9, 9, + 7, 7, 8, 8, 7, 7, 8, 8, 9, 9, 9, 9, 9, 7, 7, 7, + 7, 8, 8, 9, 9, 9, 9, 9, 8, 8, 7, 7, 8, 8, 9, 9, + 9, 9, 9, 7, 7, 7, 7, 8, 8, +}; + +static float _vq_quantthresh__16c2_s_p7_1[] = { + -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, + 3.5, 4.5, +}; + +static long _vq_quantmap__16c2_s_p7_1[] = { + 9, 7, 5, 3, 1, 0, 2, 4, + 6, 8, 10, +}; + +static encode_aux_threshmatch _vq_auxt__16c2_s_p7_1 = { + _vq_quantthresh__16c2_s_p7_1, + _vq_quantmap__16c2_s_p7_1, + 11, + 11 +}; + +static static_codebook _16c2_s_p7_1 = { + 2, 121, + _vq_lengthlist__16c2_s_p7_1, + 1, -531365888, 1611661312, 4, 0, + _vq_quantlist__16c2_s_p7_1, + NULL, + &_vq_auxt__16c2_s_p7_1, + NULL, + 0 +}; + +static long _vq_quantlist__16c2_s_p8_0[] = { + 7, + 6, + 8, + 5, + 9, + 4, + 10, + 3, + 11, + 2, + 12, + 1, + 13, + 0, + 14, +}; + +static long _vq_lengthlist__16c2_s_p8_0[] = { + 1, 4, 4, 7, 6, 7, 7, 6, 6, 8, 8, 9, 9,10,10, 6, + 6, 6, 8, 8, 9, 8, 8, 8, 9, 9,11,10,11,11, 7, 6, + 6, 8, 8, 9, 8, 7, 7, 9, 9,10,10,12,11,14, 8, 8, + 8, 9, 9, 9, 9, 9,10, 9,10,10,11,13,14, 8, 8, 8, + 8, 9, 9, 8, 8, 9, 9,10,10,11,12,14,13,11, 9, 9, + 9, 9, 9, 9, 9,10,11,10,13,12,14,11,13, 8, 9, 9, + 9, 9, 9,10,10,11,10,13,12,14,14,14, 8, 9, 9, 9, + 11,11,11,11,11,12,13,13,14,14,14, 9, 8, 9, 9,10, + 10,12,10,11,12,12,14,14,14,14,11,12,10,10,12,12, + 12,12,13,14,12,12,14,14,14,12,12, 9,10,11,11,12, + 14,12,14,14,14,14,14,14,14,14,11,11,12,11,12,14, + 14,14,14,14,14,14,14,14,14,12,11,11,11,11,14,14, + 14,14,14,14,14,14,14,14,14,14,13,12,14,14,14,14, + 14,14,14,14,14,14,14,14,14,12,12,12,13,14,14,13, + 13, +}; + +static float _vq_quantthresh__16c2_s_p8_0[] = { + -136.5, -115.5, -94.5, -73.5, -52.5, -31.5, -10.5, 10.5, + 31.5, 52.5, 73.5, 94.5, 115.5, 136.5, +}; + +static long _vq_quantmap__16c2_s_p8_0[] = { + 13, 11, 9, 7, 5, 3, 1, 0, + 2, 4, 6, 8, 10, 12, 14, +}; + +static encode_aux_threshmatch _vq_auxt__16c2_s_p8_0 = { + _vq_quantthresh__16c2_s_p8_0, + _vq_quantmap__16c2_s_p8_0, + 15, + 15 +}; + +static static_codebook _16c2_s_p8_0 = { + 2, 225, + _vq_lengthlist__16c2_s_p8_0, + 1, -520986624, 1620377600, 4, 0, + _vq_quantlist__16c2_s_p8_0, + NULL, + &_vq_auxt__16c2_s_p8_0, + NULL, + 0 +}; + +static long _vq_quantlist__16c2_s_p8_1[] = { + 10, + 9, + 11, + 8, + 12, + 7, + 13, + 6, + 14, + 5, + 15, + 4, + 16, + 3, + 17, + 2, + 18, + 1, + 19, + 0, + 20, +}; + +static long _vq_lengthlist__16c2_s_p8_1[] = { + 2, 4, 4, 6, 6, 7, 7, 7, 7, 8, 7, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8,11,12,11, 7, 7, 8, 8, 8, 8, 9, 9, + 9, 9, 9, 9, 9, 9, 9,10, 9, 9,11,11,10, 7, 7, 8, + 8, 8, 8, 9, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,11, + 11,11, 8, 7, 8, 8, 9, 9, 9, 9, 9, 9,10,10, 9,10, + 10, 9,10,10,11,11,12, 8, 8, 8, 8, 9, 9, 9, 9, 9, + 9, 9, 9,10, 9,10,10,10,10,11,11,11, 8, 8, 9, 9, + 9, 9, 9, 9, 9,10,10,10,10,10,10,10,10,10,11,11, + 11, 8, 8, 9, 8, 9, 9, 9, 9,10, 9, 9, 9,10,10,10, + 10, 9,10,11,11,11, 9, 9, 9, 9,10, 9, 9, 9,10,10, + 9,10, 9,10,10,10,10,10,11,12,11,11,11, 9, 9, 9, + 9, 9,10,10, 9,10,10,10,10,10,10,10,10,12,11,13, + 13,11, 9, 9, 9, 9,10,10, 9,10,10,10,10,11,10,10, + 10,10,11,12,11,12,11, 9, 9, 9,10,10, 9,10,10,10, + 10,10,10,10,10,10,10,11,11,11,12,11, 9,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,11,12,12,12, + 11,11,11,10, 9,10,10,10,10,10,10,10,10,11,10,10, + 10,11,11,11,11,11,11,11,10,10,10,11,10,10,10,10, + 10,10,10,10,10,10,11,11,11,11,12,12,11,10,10,10, + 10,10,10,10,10,11,10,10,10,11,10,12,11,11,12,11, + 11,11,10,10,10,10,10,11,10,10,10,10,10,11,10,10, + 11,11,11,12,11,12,11,11,12,10,10,10,10,10,10,10, + 11,10,10,11,10,12,11,11,11,12,11,11,11,11,10,10, + 10,10,10,10,10,11,11,11,10,11,12,11,11,11,12,11, + 12,11,12,10,11,10,10,10,10,11,10,10,10,10,10,10, + 12,11,11,11,11,11,12,12,10,10,10,10,10,11,10,10, + 11,10,11,11,11,11,11,11,11,11,11,11,11,11,12,11, + 10,11,10,10,10,10,10,10,10, +}; + +static float _vq_quantthresh__16c2_s_p8_1[] = { + -9.5, -8.5, -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, + -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, + 6.5, 7.5, 8.5, 9.5, +}; + +static long _vq_quantmap__16c2_s_p8_1[] = { + 19, 17, 15, 13, 11, 9, 7, 5, + 3, 1, 0, 2, 4, 6, 8, 10, + 12, 14, 16, 18, 20, +}; + +static encode_aux_threshmatch _vq_auxt__16c2_s_p8_1 = { + _vq_quantthresh__16c2_s_p8_1, + _vq_quantmap__16c2_s_p8_1, + 21, + 21 +}; + +static static_codebook _16c2_s_p8_1 = { + 2, 441, + _vq_lengthlist__16c2_s_p8_1, + 1, -529268736, 1611661312, 5, 0, + _vq_quantlist__16c2_s_p8_1, + NULL, + &_vq_auxt__16c2_s_p8_1, + NULL, + 0 +}; + +static long _vq_quantlist__16c2_s_p9_0[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__16c2_s_p9_0[] = { + 1, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, +}; + +static float _vq_quantthresh__16c2_s_p9_0[] = { + -5120.5, -4189.5, -3258.5, -2327.5, -1396.5, -465.5, 465.5, 1396.5, + 2327.5, 3258.5, 4189.5, 5120.5, +}; + +static long _vq_quantmap__16c2_s_p9_0[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__16c2_s_p9_0 = { + _vq_quantthresh__16c2_s_p9_0, + _vq_quantmap__16c2_s_p9_0, + 13, + 13 +}; + +static static_codebook _16c2_s_p9_0 = { + 2, 169, + _vq_lengthlist__16c2_s_p9_0, + 1, -510275072, 1631393792, 4, 0, + _vq_quantlist__16c2_s_p9_0, + NULL, + &_vq_auxt__16c2_s_p9_0, + NULL, + 0 +}; + +static long _vq_quantlist__16c2_s_p9_1[] = { + 8, + 7, + 9, + 6, + 10, + 5, + 11, + 4, + 12, + 3, + 13, + 2, + 14, + 1, + 15, + 0, + 16, +}; + +static long _vq_lengthlist__16c2_s_p9_1[] = { + 1, 5, 5, 9, 8, 7, 7, 7, 6,10,11,11,11,11,11,11, + 11, 8, 7, 6, 8, 8,10, 9,10,10,10, 9,11,10,10,10, + 10,10, 8, 6, 6, 8, 8, 9, 8, 9, 8, 9,10,10,10,10, + 10,10,10,10, 8,10, 9, 9, 9, 9,10,10,10,10,10,10, + 10,10,10,10,10, 8, 9, 9, 9,10,10, 9,10,10,10,10, + 10,10,10,10,10,10,10,10, 9, 8, 9, 9,10,10,10,10, + 10,10,10,10,10,10,10,10, 9, 8, 8, 9, 9,10,10,10, + 10,10,10,10,10,10,10,10,10,10, 9,10, 9, 9,10,10, + 10,10,10,10,10,10,10,10,10,10,10, 9, 8, 9, 9,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 9, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 8,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10, 9,10, 9,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10, 9,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10, +}; + +static float _vq_quantthresh__16c2_s_p9_1[] = { + -367.5, -318.5, -269.5, -220.5, -171.5, -122.5, -73.5, -24.5, + 24.5, 73.5, 122.5, 171.5, 220.5, 269.5, 318.5, 367.5, +}; + +static long _vq_quantmap__16c2_s_p9_1[] = { + 15, 13, 11, 9, 7, 5, 3, 1, + 0, 2, 4, 6, 8, 10, 12, 14, + 16, +}; + +static encode_aux_threshmatch _vq_auxt__16c2_s_p9_1 = { + _vq_quantthresh__16c2_s_p9_1, + _vq_quantmap__16c2_s_p9_1, + 17, + 17 +}; + +static static_codebook _16c2_s_p9_1 = { + 2, 289, + _vq_lengthlist__16c2_s_p9_1, + 1, -518488064, 1622704128, 5, 0, + _vq_quantlist__16c2_s_p9_1, + NULL, + &_vq_auxt__16c2_s_p9_1, + NULL, + 0 +}; + +static long _vq_quantlist__16c2_s_p9_2[] = { + 13, + 12, + 14, + 11, + 15, + 10, + 16, + 9, + 17, + 8, + 18, + 7, + 19, + 6, + 20, + 5, + 21, + 4, + 22, + 3, + 23, + 2, + 24, + 1, + 25, + 0, + 26, +}; + +static long _vq_lengthlist__16c2_s_p9_2[] = { + 1, 4, 4, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 8, 7, 8, 7, 7, 4, 4, +}; + +static float _vq_quantthresh__16c2_s_p9_2[] = { + -12.5, -11.5, -10.5, -9.5, -8.5, -7.5, -6.5, -5.5, + -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, + 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, 10.5, + 11.5, 12.5, +}; + +static long _vq_quantmap__16c2_s_p9_2[] = { + 25, 23, 21, 19, 17, 15, 13, 11, + 9, 7, 5, 3, 1, 0, 2, 4, + 6, 8, 10, 12, 14, 16, 18, 20, + 22, 24, 26, +}; + +static encode_aux_threshmatch _vq_auxt__16c2_s_p9_2 = { + _vq_quantthresh__16c2_s_p9_2, + _vq_quantmap__16c2_s_p9_2, + 27, + 27 +}; + +static static_codebook _16c2_s_p9_2 = { + 1, 27, + _vq_lengthlist__16c2_s_p9_2, + 1, -528875520, 1611661312, 5, 0, + _vq_quantlist__16c2_s_p9_2, + NULL, + &_vq_auxt__16c2_s_p9_2, + NULL, + 0 +}; + +static long _huff_lengthlist__16c2_s_short[] = { + 7,10,11,11,11,14,15,15,17,14, 8, 6, 7, 7, 8, 9, + 11,11,14,17, 9, 6, 6, 6, 7, 7,10,11,15,16, 9, 6, + 6, 4, 4, 5, 8, 9,12,16,10, 6, 6, 4, 4, 4, 6, 9, + 13,16,10, 7, 6, 5, 4, 3, 5, 7,13,16,11, 9, 8, 7, + 6, 5, 5, 6,12,15,10,10,10, 9, 7, 6, 6, 7,11,15, + 13,13,13,13,11,10,10, 9,12,16,16,16,16,14,16,15, + 15,12,14,14, +}; + +static static_codebook _huff_book__16c2_s_short = { + 2, 100, + _huff_lengthlist__16c2_s_short, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _vq_quantlist__8c0_s_p1_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__8c0_s_p1_0[] = { + 1, 5, 4, 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, 0, 0, 0, + 0, 0, 5, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 5, 8, 8, 0, 0, 0, 0, 0, 0, 7, 8, 9, 0, 0, 0, + 0, 0, 0, 7, 8, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 5, 8, 8, 0, 0, 0, 0, 0, 0, 7, 9, 9, 0, 0, + 0, 0, 0, 0, 7, 9, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 8, 8, 0, 0, 0, 0, + 0, 0, 8,10,10, 0, 0, 0, 0, 0, 0, 8, 9, 9, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7,10, 9, 0, 0, 0, + 0, 0, 0, 8, 9,11, 0, 0, 0, 0, 0, 0, 9,11,11, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 9,10, 0, 0, + 0, 0, 0, 0, 9,11,10, 0, 0, 0, 0, 0, 0, 9,11,11, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 5, 8, 8, 0, 0, 0, 0, 0, 0, 8, 9, 9, 0, 0, + 0, 0, 0, 0, 8, 9,10, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 7, 9, 9, 0, 0, 0, 0, 0, 0, 9,11,11, 0, + 0, 0, 0, 0, 0, 9,10,11, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 7, 9,10, 0, 0, 0, 0, 0, 0, 9,11,11, + 0, 0, 0, 0, 0, 0, 8,11, 9, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + +static float _vq_quantthresh__8c0_s_p1_0[] = { + -0.5, 0.5, +}; + +static long _vq_quantmap__8c0_s_p1_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__8c0_s_p1_0 = { + _vq_quantthresh__8c0_s_p1_0, + _vq_quantmap__8c0_s_p1_0, + 3, + 3 +}; + +static static_codebook _8c0_s_p1_0 = { + 8, 6561, + _vq_lengthlist__8c0_s_p1_0, + 1, -535822336, 1611661312, 2, 0, + _vq_quantlist__8c0_s_p1_0, + NULL, + &_vq_auxt__8c0_s_p1_0, + NULL, + 0 +}; + +static long _vq_quantlist__8c0_s_p2_0[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__8c0_s_p2_0[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + +static float _vq_quantthresh__8c0_s_p2_0[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__8c0_s_p2_0[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__8c0_s_p2_0 = { + _vq_quantthresh__8c0_s_p2_0, + _vq_quantmap__8c0_s_p2_0, + 5, + 5 +}; + +static static_codebook _8c0_s_p2_0 = { + 4, 625, + _vq_lengthlist__8c0_s_p2_0, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__8c0_s_p2_0, + NULL, + &_vq_auxt__8c0_s_p2_0, + NULL, + 0 +}; + +static long _vq_quantlist__8c0_s_p3_0[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__8c0_s_p3_0[] = { + 1, 4, 4, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 5, 6, 7, 7, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 4, 5, 5, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 7, 7, 8, 8, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 6, 7, 7, 8, 8, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + +static float _vq_quantthresh__8c0_s_p3_0[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__8c0_s_p3_0[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__8c0_s_p3_0 = { + _vq_quantthresh__8c0_s_p3_0, + _vq_quantmap__8c0_s_p3_0, + 5, + 5 +}; + +static static_codebook _8c0_s_p3_0 = { + 4, 625, + _vq_lengthlist__8c0_s_p3_0, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__8c0_s_p3_0, + NULL, + &_vq_auxt__8c0_s_p3_0, + NULL, + 0 +}; + +static long _vq_quantlist__8c0_s_p4_0[] = { + 4, + 3, + 5, + 2, + 6, + 1, + 7, + 0, + 8, +}; + +static long _vq_lengthlist__8c0_s_p4_0[] = { + 1, 2, 3, 7, 7, 0, 0, 0, 0, 0, 0, 0, 6, 6, 0, 0, + 0, 0, 0, 0, 0, 6, 6, 0, 0, 0, 0, 0, 0, 0, 7, 7, + 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, + 8, 8, 0, 0, 0, 0, 0, 0, 0, 9, 8, 0, 0, 0, 0, 0, + 0, 0,10,10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + +static float _vq_quantthresh__8c0_s_p4_0[] = { + -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, +}; + +static long _vq_quantmap__8c0_s_p4_0[] = { + 7, 5, 3, 1, 0, 2, 4, 6, + 8, +}; + +static encode_aux_threshmatch _vq_auxt__8c0_s_p4_0 = { + _vq_quantthresh__8c0_s_p4_0, + _vq_quantmap__8c0_s_p4_0, + 9, + 9 +}; + +static static_codebook _8c0_s_p4_0 = { + 2, 81, + _vq_lengthlist__8c0_s_p4_0, + 1, -531628032, 1611661312, 4, 0, + _vq_quantlist__8c0_s_p4_0, + NULL, + &_vq_auxt__8c0_s_p4_0, + NULL, + 0 +}; + +static long _vq_quantlist__8c0_s_p5_0[] = { + 4, + 3, + 5, + 2, + 6, + 1, + 7, + 0, + 8, +}; + +static long _vq_lengthlist__8c0_s_p5_0[] = { + 1, 3, 3, 5, 5, 7, 6, 8, 8, 0, 0, 0, 7, 7, 7, 7, + 8, 8, 0, 0, 0, 7, 7, 7, 7, 8, 9, 0, 0, 0, 8, 8, + 8, 8, 9, 9, 0, 0, 0, 8, 8, 8, 8, 9, 9, 0, 0, 0, + 9, 9, 8, 8,10,10, 0, 0, 0, 9, 9, 8, 8,10,10, 0, + 0, 0,10,10, 9, 9,10,10, 0, 0, 0, 0, 0, 9, 9,10, + 10, +}; + +static float _vq_quantthresh__8c0_s_p5_0[] = { + -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, +}; + +static long _vq_quantmap__8c0_s_p5_0[] = { + 7, 5, 3, 1, 0, 2, 4, 6, + 8, +}; + +static encode_aux_threshmatch _vq_auxt__8c0_s_p5_0 = { + _vq_quantthresh__8c0_s_p5_0, + _vq_quantmap__8c0_s_p5_0, + 9, + 9 +}; + +static static_codebook _8c0_s_p5_0 = { + 2, 81, + _vq_lengthlist__8c0_s_p5_0, + 1, -531628032, 1611661312, 4, 0, + _vq_quantlist__8c0_s_p5_0, + NULL, + &_vq_auxt__8c0_s_p5_0, + NULL, + 0 +}; + +static long _vq_quantlist__8c0_s_p6_0[] = { + 8, + 7, + 9, + 6, + 10, + 5, + 11, + 4, + 12, + 3, + 13, + 2, + 14, + 1, + 15, + 0, + 16, +}; + +static long _vq_lengthlist__8c0_s_p6_0[] = { + 1, 3, 3, 6, 6, 8, 8, 9, 9, 8, 8,10, 9,10,10,11, + 11, 0, 0, 0, 7, 7, 8, 8, 9, 9, 9, 9,10,10,11,11, + 11,12, 0, 0, 0, 7, 7, 8, 8, 9, 9, 9, 9,10,10,11, + 11,12,11, 0, 0, 0, 8, 8, 9, 9,10,10, 9, 9,10,10, + 11,11,12,12, 0, 0, 0, 8, 8, 9, 9,10,10, 9, 9,11, + 10,11,11,12,12, 0, 0, 0, 9, 9, 9, 9,10,10,10,10, + 11,11,11,12,12,12, 0, 0, 0, 9, 9, 9, 9,10,10,10, + 10,11,11,12,12,13,13, 0, 0, 0,10,10,10,10,11,11, + 10,10,11,11,12,12,13,13, 0, 0, 0, 0, 0,10, 9,10, + 11,10,10,11,11,12,12,13,13, 0, 0, 0, 0, 0, 9, 9, + 10, 9,10,11,12,12,13,13,14,13, 0, 0, 0, 0, 0, 9, + 9, 9,10,10,10,11,11,13,12,13,13, 0, 0, 0, 0, 0, + 10,10,10,10,11,11,12,12,13,13,14,14, 0, 0, 0, 0, + 0, 0, 0,10,10,11,11,12,12,13,13,13,14, 0, 0, 0, + 0, 0, 0, 0,11,11,11,11,12,12,13,14,14,14, 0, 0, + 0, 0, 0, 0, 0,11,11,11,11,12,12,13,13,14,13, 0, + 0, 0, 0, 0, 0, 0,11,11,12,12,13,13,14,14,14,14, + 0, 0, 0, 0, 0, 0, 0, 0, 0,12,12,12,12,13,13,14, + 14, +}; + +static float _vq_quantthresh__8c0_s_p6_0[] = { + -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, + 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, +}; + +static long _vq_quantmap__8c0_s_p6_0[] = { + 15, 13, 11, 9, 7, 5, 3, 1, + 0, 2, 4, 6, 8, 10, 12, 14, + 16, +}; + +static encode_aux_threshmatch _vq_auxt__8c0_s_p6_0 = { + _vq_quantthresh__8c0_s_p6_0, + _vq_quantmap__8c0_s_p6_0, + 17, + 17 +}; + +static static_codebook _8c0_s_p6_0 = { + 2, 289, + _vq_lengthlist__8c0_s_p6_0, + 1, -529530880, 1611661312, 5, 0, + _vq_quantlist__8c0_s_p6_0, + NULL, + &_vq_auxt__8c0_s_p6_0, + NULL, + 0 +}; + +static long _vq_quantlist__8c0_s_p7_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__8c0_s_p7_0[] = { + 1, 4, 4, 7, 6, 6, 7, 6, 6, 4, 7, 7,11, 9,10,12, + 9,10, 4, 7, 7,10,10,10,11, 9, 9, 6,11,10,11,11, + 12,11,11,11, 6,10,10,11,11,12,11,10,10, 6, 9,10, + 11,11,11,11,10,10, 7,10,11,12,11,11,12,11,12, 6, + 9, 9,10, 9, 9,11,10,10, 6, 9, 9,10,10,10,11,10, + 10, +}; + +static float _vq_quantthresh__8c0_s_p7_0[] = { + -5.5, 5.5, +}; + +static long _vq_quantmap__8c0_s_p7_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__8c0_s_p7_0 = { + _vq_quantthresh__8c0_s_p7_0, + _vq_quantmap__8c0_s_p7_0, + 3, + 3 +}; + +static static_codebook _8c0_s_p7_0 = { + 4, 81, + _vq_lengthlist__8c0_s_p7_0, + 1, -529137664, 1618345984, 2, 0, + _vq_quantlist__8c0_s_p7_0, + NULL, + &_vq_auxt__8c0_s_p7_0, + NULL, + 0 +}; + +static long _vq_quantlist__8c0_s_p7_1[] = { + 5, + 4, + 6, + 3, + 7, + 2, + 8, + 1, + 9, + 0, + 10, +}; + +static long _vq_lengthlist__8c0_s_p7_1[] = { + 1, 3, 3, 6, 6, 8, 8, 9, 9, 9, 9,10,10,10, 7, 7, + 8, 8, 9, 9, 9, 9,10,10, 9, 7, 7, 8, 8, 9, 9, 9, + 9,10,10,10, 8, 8, 9, 9, 9, 9, 9, 9,10,10,10, 8, + 8, 9, 9, 9, 9, 8, 9,10,10,10, 8, 8, 9, 9, 9,10, + 10,10,10,10,10, 9, 9, 9, 9, 9, 9,10,10,11,10,11, + 9, 9, 9, 9,10,10,10,10,11,11,11,10,10, 9, 9,10, + 10,10, 9,11,10,10,10,10,10,10, 9, 9,10,10,11,11, + 10,10,10, 9, 9, 9,10,10,10, +}; + +static float _vq_quantthresh__8c0_s_p7_1[] = { + -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, + 3.5, 4.5, +}; + +static long _vq_quantmap__8c0_s_p7_1[] = { + 9, 7, 5, 3, 1, 0, 2, 4, + 6, 8, 10, +}; + +static encode_aux_threshmatch _vq_auxt__8c0_s_p7_1 = { + _vq_quantthresh__8c0_s_p7_1, + _vq_quantmap__8c0_s_p7_1, + 11, + 11 +}; + +static static_codebook _8c0_s_p7_1 = { + 2, 121, + _vq_lengthlist__8c0_s_p7_1, + 1, -531365888, 1611661312, 4, 0, + _vq_quantlist__8c0_s_p7_1, + NULL, + &_vq_auxt__8c0_s_p7_1, + NULL, + 0 +}; + +static long _vq_quantlist__8c0_s_p8_0[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__8c0_s_p8_0[] = { + 1, 4, 4, 7, 6, 7, 7, 7, 7, 8, 8, 9, 9, 7, 6, 6, + 7, 7, 8, 8, 7, 7, 8, 9,10,10, 7, 6, 6, 7, 7, 8, + 7, 7, 7, 9, 9,10,12, 0, 8, 8, 8, 8, 8, 9, 8, 8, + 9, 9,10,10, 0, 8, 8, 8, 8, 8, 9, 8, 9, 9, 9,11, + 10, 0, 0,13, 9, 8, 9, 9, 9, 9,10,10,11,11, 0,13, + 0, 9, 9, 9, 9, 9, 9,11,10,11,11, 0, 0, 0, 8, 9, + 10, 9,10,10,13,11,12,12, 0, 0, 0, 8, 9, 9, 9,10, + 10,13,12,12,13, 0, 0, 0,12, 0,10,10,12,11,10,11, + 12,12, 0, 0, 0,13,13,10,10,10,11,12, 0,13, 0, 0, + 0, 0, 0, 0,13,11, 0,12,12,12,13,12, 0, 0, 0, 0, + 0, 0,13,13,11,13,13,11,12, +}; + +static float _vq_quantthresh__8c0_s_p8_0[] = { + -27.5, -22.5, -17.5, -12.5, -7.5, -2.5, 2.5, 7.5, + 12.5, 17.5, 22.5, 27.5, +}; + +static long _vq_quantmap__8c0_s_p8_0[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__8c0_s_p8_0 = { + _vq_quantthresh__8c0_s_p8_0, + _vq_quantmap__8c0_s_p8_0, + 13, + 13 +}; + +static static_codebook _8c0_s_p8_0 = { + 2, 169, + _vq_lengthlist__8c0_s_p8_0, + 1, -526516224, 1616117760, 4, 0, + _vq_quantlist__8c0_s_p8_0, + NULL, + &_vq_auxt__8c0_s_p8_0, + NULL, + 0 +}; + +static long _vq_quantlist__8c0_s_p8_1[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__8c0_s_p8_1[] = { + 1, 3, 4, 5, 5, 7, 6, 6, 6, 5, 7, 7, 7, 6, 6, 7, + 7, 7, 6, 6, 7, 7, 7, 6, 6, +}; + +static float _vq_quantthresh__8c0_s_p8_1[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__8c0_s_p8_1[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__8c0_s_p8_1 = { + _vq_quantthresh__8c0_s_p8_1, + _vq_quantmap__8c0_s_p8_1, + 5, + 5 +}; + +static static_codebook _8c0_s_p8_1 = { + 2, 25, + _vq_lengthlist__8c0_s_p8_1, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__8c0_s_p8_1, + NULL, + &_vq_auxt__8c0_s_p8_1, + NULL, + 0 +}; + +static long _vq_quantlist__8c0_s_p9_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__8c0_s_p9_0[] = { + 1, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, +}; + +static float _vq_quantthresh__8c0_s_p9_0[] = { + -157.5, 157.5, +}; + +static long _vq_quantmap__8c0_s_p9_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__8c0_s_p9_0 = { + _vq_quantthresh__8c0_s_p9_0, + _vq_quantmap__8c0_s_p9_0, + 3, + 3 +}; + +static static_codebook _8c0_s_p9_0 = { + 4, 81, + _vq_lengthlist__8c0_s_p9_0, + 1, -518803456, 1628680192, 2, 0, + _vq_quantlist__8c0_s_p9_0, + NULL, + &_vq_auxt__8c0_s_p9_0, + NULL, + 0 +}; + +static long _vq_quantlist__8c0_s_p9_1[] = { + 7, + 6, + 8, + 5, + 9, + 4, + 10, + 3, + 11, + 2, + 12, + 1, + 13, + 0, + 14, +}; + +static long _vq_lengthlist__8c0_s_p9_1[] = { + 1, 4, 4, 5, 5,10, 8,11,11,11,11,11,11,11,11, 6, + 6, 6, 7, 6,11,10,11,11,11,11,11,11,11,11, 7, 5, + 6, 6, 6, 8, 7,11,11,11,11,11,11,11,11,11, 7, 8, + 8, 8, 9, 9,11,11,11,11,11,11,11,11,11, 9, 8, 7, + 8, 9,11,11,11,11,11,11,11,11,11,11,11,10,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11, +}; + +static float _vq_quantthresh__8c0_s_p9_1[] = { + -136.5, -115.5, -94.5, -73.5, -52.5, -31.5, -10.5, 10.5, + 31.5, 52.5, 73.5, 94.5, 115.5, 136.5, +}; + +static long _vq_quantmap__8c0_s_p9_1[] = { + 13, 11, 9, 7, 5, 3, 1, 0, + 2, 4, 6, 8, 10, 12, 14, +}; + +static encode_aux_threshmatch _vq_auxt__8c0_s_p9_1 = { + _vq_quantthresh__8c0_s_p9_1, + _vq_quantmap__8c0_s_p9_1, + 15, + 15 +}; + +static static_codebook _8c0_s_p9_1 = { + 2, 225, + _vq_lengthlist__8c0_s_p9_1, + 1, -520986624, 1620377600, 4, 0, + _vq_quantlist__8c0_s_p9_1, + NULL, + &_vq_auxt__8c0_s_p9_1, + NULL, + 0 +}; + +static long _vq_quantlist__8c0_s_p9_2[] = { + 10, + 9, + 11, + 8, + 12, + 7, + 13, + 6, + 14, + 5, + 15, + 4, + 16, + 3, + 17, + 2, + 18, + 1, + 19, + 0, + 20, +}; + +static long _vq_lengthlist__8c0_s_p9_2[] = { + 1, 5, 5, 7, 7, 8, 7, 8, 8,10,10, 9, 9,10,10,10, + 11,11,10,12,11,12,12,12, 9, 8, 8, 8, 8, 8, 9,10, + 10,10,10,11,11,11,10,11,11,12,12,11,12, 8, 8, 7, + 7, 8, 9,10,10,10, 9,10,10, 9,10,10,11,11,11,11, + 11,11, 9, 9, 9, 9, 8, 9,10,10,11,10,10,11,11,12, + 10,10,12,12,11,11,10, 9, 9,10, 8, 9,10,10,10, 9, + 10,10,11,11,10,11,10,10,10,12,12,12, 9,10, 9,10, + 9, 9,10,10,11,11,11,11,10,10,10,11,12,11,12,11, + 12,10,11,10,11, 9,10, 9,10, 9,10,10, 9,10,10,11, + 10,11,11,11,11,12,11, 9,10,10,10,10,11,11,11,11, + 11,10,11,11,11,11,10,12,10,12,12,11,12,10,10,11, + 10, 9,11,10,11, 9,10,11,10,10,10,11,11,11,11,12, + 12,10, 9, 9,11,10, 9,12,11,10,12,12,11,11,11,11, + 10,11,11,12,11,10,12, 9,11,10,11,10,10,11,10,11, + 9,10,10,10,11,12,11,11,12,11,10,10,11,11, 9,10, + 10,12,10,11,10,10,10, 9,10,10,10,10, 9,10,10,11, + 11,11,11,12,11,10,10,10,10,11,11,10,11,11, 9,11, + 10,12,10,12,11,10,11,10,10,10,11,10,10,11,11,10, + 11,10,10,10,10,11,11,12,10,10,10,11,10,11,12,11, + 10,11,10,10,11,11,10,12,10, 9,10,10,11,11,11,10, + 12,10,10,11,11,11,10,10,11,10,10,10,11,10,11,10, + 12,11,11,10,10,10,12,10,10,11, 9,10,11,11,11,10, + 10,11,10,10, 9,11,11,12,12,11,12,11,11,11,11,11, + 11, 9,10,11,10,12,10,10,10,10,11,10,10,11,10,10, + 12,10,10,10,10,10, 9,12,10,10,10,10,12, 9,11,10, + 10,11,10,12,12,10,12,12,12,10,10,10,10, 9,10,11, + 10,10,12,10,10,12,11,10,11,10,10,12,11,10,12,10, + 10,11, 9,11,10, 9,10, 9,10, +}; + +static float _vq_quantthresh__8c0_s_p9_2[] = { + -9.5, -8.5, -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, + -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, + 6.5, 7.5, 8.5, 9.5, +}; + +static long _vq_quantmap__8c0_s_p9_2[] = { + 19, 17, 15, 13, 11, 9, 7, 5, + 3, 1, 0, 2, 4, 6, 8, 10, + 12, 14, 16, 18, 20, +}; + +static encode_aux_threshmatch _vq_auxt__8c0_s_p9_2 = { + _vq_quantthresh__8c0_s_p9_2, + _vq_quantmap__8c0_s_p9_2, + 21, + 21 +}; + +static static_codebook _8c0_s_p9_2 = { + 2, 441, + _vq_lengthlist__8c0_s_p9_2, + 1, -529268736, 1611661312, 5, 0, + _vq_quantlist__8c0_s_p9_2, + NULL, + &_vq_auxt__8c0_s_p9_2, + NULL, + 0 +}; + +static long _huff_lengthlist__8c0_s_single[] = { + 4, 5,18, 7,10, 6, 7, 8, 9,10, 5, 2,18, 5, 7, 5, + 6, 7, 8,11,17,17,17,17,17,17,17,17,17,17, 7, 4, + 17, 6, 9, 6, 8,10,12,15,11, 7,17, 9, 6, 6, 7, 9, + 11,15, 6, 4,17, 6, 6, 4, 5, 8,11,16, 6, 6,17, 8, + 6, 5, 6, 9,13,16, 8, 9,17,11, 9, 8, 8,11,13,17, + 9,12,17,15,14,13,12,13,14,17,12,15,17,17,17,17, + 17,16,17,17, +}; + +static static_codebook _huff_book__8c0_s_single = { + 2, 100, + _huff_lengthlist__8c0_s_single, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _vq_quantlist__8c1_s_p1_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__8c1_s_p1_0[] = { + 1, 5, 5, 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, 0, 0, 0, + 0, 0, 5, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 5, 8, 7, 0, 0, 0, 0, 0, 0, 7, 8, 9, 0, 0, 0, + 0, 0, 0, 7, 8, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 5, 7, 8, 0, 0, 0, 0, 0, 0, 7, 9, 8, 0, 0, + 0, 0, 0, 0, 7, 9, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 8, 8, 0, 0, 0, 0, + 0, 0, 8, 9, 9, 0, 0, 0, 0, 0, 0, 8, 9, 9, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 9, 9, 0, 0, 0, + 0, 0, 0, 8, 8,10, 0, 0, 0, 0, 0, 0, 9,10,10, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 9, 9, 0, 0, + 0, 0, 0, 0, 8,10, 9, 0, 0, 0, 0, 0, 0, 9,10,10, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 5, 8, 8, 0, 0, 0, 0, 0, 0, 8, 9, 9, 0, 0, + 0, 0, 0, 0, 8, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 7, 9, 9, 0, 0, 0, 0, 0, 0, 9,10,10, 0, + 0, 0, 0, 0, 0, 8, 9,10, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 7, 9, 9, 0, 0, 0, 0, 0, 0, 9,10,10, + 0, 0, 0, 0, 0, 0, 8,10, 8, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + +static float _vq_quantthresh__8c1_s_p1_0[] = { + -0.5, 0.5, +}; + +static long _vq_quantmap__8c1_s_p1_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__8c1_s_p1_0 = { + _vq_quantthresh__8c1_s_p1_0, + _vq_quantmap__8c1_s_p1_0, + 3, + 3 +}; + +static static_codebook _8c1_s_p1_0 = { + 8, 6561, + _vq_lengthlist__8c1_s_p1_0, + 1, -535822336, 1611661312, 2, 0, + _vq_quantlist__8c1_s_p1_0, + NULL, + &_vq_auxt__8c1_s_p1_0, + NULL, + 0 +}; + +static long _vq_quantlist__8c1_s_p2_0[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__8c1_s_p2_0[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + +static float _vq_quantthresh__8c1_s_p2_0[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__8c1_s_p2_0[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__8c1_s_p2_0 = { + _vq_quantthresh__8c1_s_p2_0, + _vq_quantmap__8c1_s_p2_0, + 5, + 5 +}; + +static static_codebook _8c1_s_p2_0 = { + 4, 625, + _vq_lengthlist__8c1_s_p2_0, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__8c1_s_p2_0, + NULL, + &_vq_auxt__8c1_s_p2_0, + NULL, + 0 +}; + +static long _vq_quantlist__8c1_s_p3_0[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__8c1_s_p3_0[] = { + 2, 4, 4, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 6, 6, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 4, 4, 4, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6, 7, 7, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 6, 6, 6, 7, 7, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + +static float _vq_quantthresh__8c1_s_p3_0[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__8c1_s_p3_0[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__8c1_s_p3_0 = { + _vq_quantthresh__8c1_s_p3_0, + _vq_quantmap__8c1_s_p3_0, + 5, + 5 +}; + +static static_codebook _8c1_s_p3_0 = { + 4, 625, + _vq_lengthlist__8c1_s_p3_0, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__8c1_s_p3_0, + NULL, + &_vq_auxt__8c1_s_p3_0, + NULL, + 0 +}; + +static long _vq_quantlist__8c1_s_p4_0[] = { + 4, + 3, + 5, + 2, + 6, + 1, + 7, + 0, + 8, +}; + +static long _vq_lengthlist__8c1_s_p4_0[] = { + 1, 2, 3, 7, 7, 0, 0, 0, 0, 0, 0, 0, 6, 6, 0, 0, + 0, 0, 0, 0, 0, 6, 6, 0, 0, 0, 0, 0, 0, 0, 7, 7, + 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, + 8, 8, 0, 0, 0, 0, 0, 0, 0, 9, 8, 0, 0, 0, 0, 0, + 0, 0,10,10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + +static float _vq_quantthresh__8c1_s_p4_0[] = { + -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, +}; + +static long _vq_quantmap__8c1_s_p4_0[] = { + 7, 5, 3, 1, 0, 2, 4, 6, + 8, +}; + +static encode_aux_threshmatch _vq_auxt__8c1_s_p4_0 = { + _vq_quantthresh__8c1_s_p4_0, + _vq_quantmap__8c1_s_p4_0, + 9, + 9 +}; + +static static_codebook _8c1_s_p4_0 = { + 2, 81, + _vq_lengthlist__8c1_s_p4_0, + 1, -531628032, 1611661312, 4, 0, + _vq_quantlist__8c1_s_p4_0, + NULL, + &_vq_auxt__8c1_s_p4_0, + NULL, + 0 +}; + +static long _vq_quantlist__8c1_s_p5_0[] = { + 4, + 3, + 5, + 2, + 6, + 1, + 7, + 0, + 8, +}; + +static long _vq_lengthlist__8c1_s_p5_0[] = { + 1, 3, 3, 4, 5, 6, 6, 8, 8, 0, 0, 0, 8, 8, 7, 7, + 9, 9, 0, 0, 0, 8, 8, 7, 7, 9, 9, 0, 0, 0, 9,10, + 8, 8, 9, 9, 0, 0, 0,10,10, 8, 8, 9, 9, 0, 0, 0, + 11,10, 8, 8,10,10, 0, 0, 0,11,11, 8, 8,10,10, 0, + 0, 0,12,12, 9, 9,10,10, 0, 0, 0, 0, 0, 9, 9,10, + 10, +}; + +static float _vq_quantthresh__8c1_s_p5_0[] = { + -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, +}; + +static long _vq_quantmap__8c1_s_p5_0[] = { + 7, 5, 3, 1, 0, 2, 4, 6, + 8, +}; + +static encode_aux_threshmatch _vq_auxt__8c1_s_p5_0 = { + _vq_quantthresh__8c1_s_p5_0, + _vq_quantmap__8c1_s_p5_0, + 9, + 9 +}; + +static static_codebook _8c1_s_p5_0 = { + 2, 81, + _vq_lengthlist__8c1_s_p5_0, + 1, -531628032, 1611661312, 4, 0, + _vq_quantlist__8c1_s_p5_0, + NULL, + &_vq_auxt__8c1_s_p5_0, + NULL, + 0 +}; + +static long _vq_quantlist__8c1_s_p6_0[] = { + 8, + 7, + 9, + 6, + 10, + 5, + 11, + 4, + 12, + 3, + 13, + 2, + 14, + 1, + 15, + 0, + 16, +}; + +static long _vq_lengthlist__8c1_s_p6_0[] = { + 1, 3, 3, 5, 5, 8, 8, 8, 8, 9, 9,10,10,11,11,11, + 11, 0, 0, 0, 8, 8, 8, 8, 9, 9, 9, 9,10,10,11,11, + 12,12, 0, 0, 0, 8, 8, 8, 8, 9, 9, 9, 9,10,10,11, + 11,12,12, 0, 0, 0, 9, 9, 8, 8,10,10,10,10,11,11, + 12,12,12,12, 0, 0, 0, 9, 9, 8, 8,10,10,10,10,11, + 11,12,12,12,12, 0, 0, 0,10,10, 9, 9,10,10,10,10, + 11,11,12,12,13,13, 0, 0, 0,10,10, 9, 9,10,10,10, + 10,11,11,12,12,13,13, 0, 0, 0,11,11, 9, 9,10,10, + 10,10,11,11,12,12,13,13, 0, 0, 0, 0, 0, 9, 9,10, + 10,10,10,11,11,12,12,13,13, 0, 0, 0, 0, 0, 9, 9, + 10,10,11,11,12,12,12,12,13,13, 0, 0, 0, 0, 0, 9, + 9,10,10,11,11,12,11,12,12,13,13, 0, 0, 0, 0, 0, + 10,10,11,11,11,11,12,12,13,12,13,13, 0, 0, 0, 0, + 0, 0, 0,11,10,11,11,12,12,13,13,13,13, 0, 0, 0, + 0, 0, 0, 0,11,11,12,12,12,12,13,13,13,14, 0, 0, + 0, 0, 0, 0, 0,11,11,12,12,12,12,13,13,14,13, 0, + 0, 0, 0, 0, 0, 0,12,12,12,12,13,13,13,13,14,14, + 0, 0, 0, 0, 0, 0, 0, 0, 0,12,12,13,13,13,13,14, + 14, +}; + +static float _vq_quantthresh__8c1_s_p6_0[] = { + -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, + 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, +}; + +static long _vq_quantmap__8c1_s_p6_0[] = { + 15, 13, 11, 9, 7, 5, 3, 1, + 0, 2, 4, 6, 8, 10, 12, 14, + 16, +}; + +static encode_aux_threshmatch _vq_auxt__8c1_s_p6_0 = { + _vq_quantthresh__8c1_s_p6_0, + _vq_quantmap__8c1_s_p6_0, + 17, + 17 +}; + +static static_codebook _8c1_s_p6_0 = { + 2, 289, + _vq_lengthlist__8c1_s_p6_0, + 1, -529530880, 1611661312, 5, 0, + _vq_quantlist__8c1_s_p6_0, + NULL, + &_vq_auxt__8c1_s_p6_0, + NULL, + 0 +}; + +static long _vq_quantlist__8c1_s_p7_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__8c1_s_p7_0[] = { + 1, 4, 4, 6, 6, 6, 7, 6, 6, 4, 7, 7,10, 9, 9,10, + 9, 9, 5, 7, 7,10, 9, 9,10, 9, 9, 6,10,10,10,10, + 10,11,10,10, 6, 9, 9,10, 9,10,11,10,10, 6, 9, 9, + 10, 9, 9,11, 9,10, 7,10,10,11,11,11,11,10,10, 6, + 9, 9,10,10,10,11, 9, 9, 6, 9, 9,10,10,10,10, 9, + 9, +}; + +static float _vq_quantthresh__8c1_s_p7_0[] = { + -5.5, 5.5, +}; + +static long _vq_quantmap__8c1_s_p7_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__8c1_s_p7_0 = { + _vq_quantthresh__8c1_s_p7_0, + _vq_quantmap__8c1_s_p7_0, + 3, + 3 +}; + +static static_codebook _8c1_s_p7_0 = { + 4, 81, + _vq_lengthlist__8c1_s_p7_0, + 1, -529137664, 1618345984, 2, 0, + _vq_quantlist__8c1_s_p7_0, + NULL, + &_vq_auxt__8c1_s_p7_0, + NULL, + 0 +}; + +static long _vq_quantlist__8c1_s_p7_1[] = { + 5, + 4, + 6, + 3, + 7, + 2, + 8, + 1, + 9, + 0, + 10, +}; + +static long _vq_lengthlist__8c1_s_p7_1[] = { + 2, 3, 3, 5, 5, 7, 7, 7, 7, 7, 7,10,10, 9, 7, 7, + 7, 7, 8, 8, 8, 8, 9, 9, 9, 7, 7, 7, 7, 8, 8, 8, + 8,10,10,10, 7, 7, 7, 7, 8, 8, 8, 8,10,10,10, 7, + 7, 7, 7, 8, 8, 8, 8,10,10,10, 8, 8, 8, 8, 8, 8, + 8, 8,10,10,10, 8, 8, 8, 8, 8, 8, 8, 8,10,10,10, + 8, 8, 8, 8, 8, 8, 8, 8,10,10,10,10,10, 8, 8, 8, + 8, 8, 8,10,10,10,10,10, 8, 8, 8, 8, 8, 8,10,10, + 10,10,10, 8, 8, 8, 8, 8, 8, +}; + +static float _vq_quantthresh__8c1_s_p7_1[] = { + -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, + 3.5, 4.5, +}; + +static long _vq_quantmap__8c1_s_p7_1[] = { + 9, 7, 5, 3, 1, 0, 2, 4, + 6, 8, 10, +}; + +static encode_aux_threshmatch _vq_auxt__8c1_s_p7_1 = { + _vq_quantthresh__8c1_s_p7_1, + _vq_quantmap__8c1_s_p7_1, + 11, + 11 +}; + +static static_codebook _8c1_s_p7_1 = { + 2, 121, + _vq_lengthlist__8c1_s_p7_1, + 1, -531365888, 1611661312, 4, 0, + _vq_quantlist__8c1_s_p7_1, + NULL, + &_vq_auxt__8c1_s_p7_1, + NULL, + 0 +}; + +static long _vq_quantlist__8c1_s_p8_0[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__8c1_s_p8_0[] = { + 1, 4, 4, 6, 6, 8, 8, 8, 8, 9, 9,10,10, 7, 5, 5, + 7, 7, 8, 8, 8, 8, 9,10,11,11, 7, 5, 5, 7, 7, 8, + 8, 9, 9,10,10,11,11, 0, 8, 8, 8, 8, 9, 9, 9, 9, + 9,10,11,11, 0, 8, 8, 8, 8, 9, 9, 9, 9,10,10,11, + 11, 0,12,12, 9, 9, 9, 9,10, 9,10,11,11,11, 0,13, + 12, 9, 8, 9, 9,10,10,11,11,12,11, 0, 0, 0, 9, 9, + 9, 9,10,10,11,11,12,12, 0, 0, 0,10,10, 9, 9,10, + 10,11,11,12,12, 0, 0, 0,13,13,10,10,11,11,12,11, + 13,12, 0, 0, 0,14,14,10,10,11,10,11,11,12,12, 0, + 0, 0, 0, 0,12,12,11,11,12,12,13,13, 0, 0, 0, 0, + 0,12,12,11,10,12,11,13,12, +}; + +static float _vq_quantthresh__8c1_s_p8_0[] = { + -27.5, -22.5, -17.5, -12.5, -7.5, -2.5, 2.5, 7.5, + 12.5, 17.5, 22.5, 27.5, +}; + +static long _vq_quantmap__8c1_s_p8_0[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__8c1_s_p8_0 = { + _vq_quantthresh__8c1_s_p8_0, + _vq_quantmap__8c1_s_p8_0, + 13, + 13 +}; + +static static_codebook _8c1_s_p8_0 = { + 2, 169, + _vq_lengthlist__8c1_s_p8_0, + 1, -526516224, 1616117760, 4, 0, + _vq_quantlist__8c1_s_p8_0, + NULL, + &_vq_auxt__8c1_s_p8_0, + NULL, + 0 +}; + +static long _vq_quantlist__8c1_s_p8_1[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__8c1_s_p8_1[] = { + 2, 3, 3, 5, 5, 6, 6, 6, 5, 5, 6, 6, 6, 5, 5, 6, + 6, 6, 5, 5, 6, 6, 6, 5, 5, +}; + +static float _vq_quantthresh__8c1_s_p8_1[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__8c1_s_p8_1[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__8c1_s_p8_1 = { + _vq_quantthresh__8c1_s_p8_1, + _vq_quantmap__8c1_s_p8_1, + 5, + 5 +}; + +static static_codebook _8c1_s_p8_1 = { + 2, 25, + _vq_lengthlist__8c1_s_p8_1, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__8c1_s_p8_1, + NULL, + &_vq_auxt__8c1_s_p8_1, + NULL, + 0 +}; + +static long _vq_quantlist__8c1_s_p9_0[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__8c1_s_p9_0[] = { + 1, 3, 3,10,10,10,10,10,10,10,10,10,10, 5, 6, 6, + 10,10,10,10,10,10,10,10,10,10, 6, 7, 8,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10, 9, 9, 9, 9, +}; + +static float _vq_quantthresh__8c1_s_p9_0[] = { + -1732.5, -1417.5, -1102.5, -787.5, -472.5, -157.5, 157.5, 472.5, + 787.5, 1102.5, 1417.5, 1732.5, +}; + +static long _vq_quantmap__8c1_s_p9_0[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__8c1_s_p9_0 = { + _vq_quantthresh__8c1_s_p9_0, + _vq_quantmap__8c1_s_p9_0, + 13, + 13 +}; + +static static_codebook _8c1_s_p9_0 = { + 2, 169, + _vq_lengthlist__8c1_s_p9_0, + 1, -513964032, 1628680192, 4, 0, + _vq_quantlist__8c1_s_p9_0, + NULL, + &_vq_auxt__8c1_s_p9_0, + NULL, + 0 +}; + +static long _vq_quantlist__8c1_s_p9_1[] = { + 7, + 6, + 8, + 5, + 9, + 4, + 10, + 3, + 11, + 2, + 12, + 1, + 13, + 0, + 14, +}; + +static long _vq_lengthlist__8c1_s_p9_1[] = { + 1, 4, 4, 5, 5, 7, 7, 9, 9,11,11,12,12,13,13, 6, + 5, 5, 6, 6, 9, 9,10,10,12,12,12,13,15,14, 6, 5, + 5, 7, 7, 9, 9,10,10,12,12,12,13,14,13,17, 7, 7, + 8, 8,10,10,11,11,12,13,13,13,13,13,17, 7, 7, 8, + 8,10,10,11,11,13,13,13,13,14,14,17,11,11, 9, 9, + 11,11,12,12,12,13,13,14,15,13,17,12,12, 9, 9,11, + 11,12,12,13,13,13,13,14,16,17,17,17,11,12,12,12, + 13,13,13,14,15,14,15,15,17,17,17,12,12,11,11,13, + 13,14,14,15,14,15,15,17,17,17,15,15,13,13,14,14, + 15,14,15,15,16,15,17,17,17,15,15,13,13,13,14,14, + 15,15,15,15,16,17,17,17,17,16,14,15,14,14,15,14, + 14,15,15,15,17,17,17,17,17,14,14,16,14,15,15,15, + 15,15,15,17,17,17,17,17,17,16,16,15,17,15,15,14, + 17,15,17,16,17,17,17,17,16,15,14,15,15,15,15,15, + 15, +}; + +static float _vq_quantthresh__8c1_s_p9_1[] = { + -136.5, -115.5, -94.5, -73.5, -52.5, -31.5, -10.5, 10.5, + 31.5, 52.5, 73.5, 94.5, 115.5, 136.5, +}; + +static long _vq_quantmap__8c1_s_p9_1[] = { + 13, 11, 9, 7, 5, 3, 1, 0, + 2, 4, 6, 8, 10, 12, 14, +}; + +static encode_aux_threshmatch _vq_auxt__8c1_s_p9_1 = { + _vq_quantthresh__8c1_s_p9_1, + _vq_quantmap__8c1_s_p9_1, + 15, + 15 +}; + +static static_codebook _8c1_s_p9_1 = { + 2, 225, + _vq_lengthlist__8c1_s_p9_1, + 1, -520986624, 1620377600, 4, 0, + _vq_quantlist__8c1_s_p9_1, + NULL, + &_vq_auxt__8c1_s_p9_1, + NULL, + 0 +}; + +static long _vq_quantlist__8c1_s_p9_2[] = { + 10, + 9, + 11, + 8, + 12, + 7, + 13, + 6, + 14, + 5, + 15, + 4, + 16, + 3, + 17, + 2, + 18, + 1, + 19, + 0, + 20, +}; + +static long _vq_lengthlist__8c1_s_p9_2[] = { + 2, 4, 4, 6, 6, 7, 7, 8, 8, 8, 8, 9, 8, 9, 9, 9, + 9, 9, 9, 9, 9,11,11,12, 7, 7, 7, 7, 8, 8, 9, 9, + 9, 9,10,10,10,10,10,10,10,10,11,11,11, 7, 7, 7, + 7, 8, 8, 9, 8, 9, 9, 9, 9, 9, 9,10,10,10,10,11, + 11,12, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9,10,10,10,10, + 10,10,10,10,11,11,11, 7, 7, 8, 8, 8, 8, 9, 9, 9, + 9,10,10,10,10,10,10,10,10,11,11,11, 8, 8, 8, 8, + 9, 9, 9, 9, 9, 9,10,10,10,10,10,10,10,10,11,11, + 11, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9,10,10,10,10,10, + 10,10,10,11,12,11, 9, 9, 8, 9, 9, 9, 9, 9,10,10, + 10,10,10,10,10,10,10,10,11,11,11,11,11, 8, 8, 9, + 9, 9, 9,10,10,10,10,10,10,10,10,10,10,11,12,11, + 12,11, 9, 9, 9, 9, 9,10,10,10,10,10,10,10,10,10, + 10,10,11,11,11,11,11, 9, 9, 9, 9,10,10,10,10,10, + 10,10,10,10,10,10,10,12,11,12,11,11, 9, 9, 9,10, + 10,10,10,10,10,10,10,10,10,10,10,10,12,11,11,11, + 11,11,11,10,10,10,10,10,10,10,10,10,10,10,10,10, + 11,11,11,12,11,11,12,11,10,10,10,10,10,10,10,10, + 10,10,10,10,11,10,11,11,11,11,11,11,11,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,11,11,12,11,12, + 11,11,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 11,11,12,11,12,11,11,11,11,10,10,10,10,10,10,10, + 10,10,10,10,10,11,11,12,11,11,12,11,11,12,10,10, + 11,10,10,10,10,10,10,10,10,10,11,11,11,11,11,11, + 11,11,11,10,10,10,10,10,10,10,10,10,10,10,10,12, + 12,11,12,11,11,12,12,12,11,11,10,10,10,10,10,10, + 10,10,10,11,12,12,11,12,12,11,12,11,11,11,11,10, + 10,10,10,10,10,10,10,10,10, +}; + +static float _vq_quantthresh__8c1_s_p9_2[] = { + -9.5, -8.5, -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, + -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, + 6.5, 7.5, 8.5, 9.5, +}; + +static long _vq_quantmap__8c1_s_p9_2[] = { + 19, 17, 15, 13, 11, 9, 7, 5, + 3, 1, 0, 2, 4, 6, 8, 10, + 12, 14, 16, 18, 20, +}; + +static encode_aux_threshmatch _vq_auxt__8c1_s_p9_2 = { + _vq_quantthresh__8c1_s_p9_2, + _vq_quantmap__8c1_s_p9_2, + 21, + 21 +}; + +static static_codebook _8c1_s_p9_2 = { + 2, 441, + _vq_lengthlist__8c1_s_p9_2, + 1, -529268736, 1611661312, 5, 0, + _vq_quantlist__8c1_s_p9_2, + NULL, + &_vq_auxt__8c1_s_p9_2, + NULL, + 0 +}; + +static long _huff_lengthlist__8c1_s_single[] = { + 4, 6,18, 8,11, 8, 8, 9, 9,10, 4, 4,18, 5, 9, 5, + 6, 7, 8,10,18,18,18,18,17,17,17,17,17,17, 7, 5, + 17, 6,11, 6, 7, 8, 9,12,12, 9,17,12, 8, 8, 9,10, + 10,13, 7, 5,17, 6, 8, 4, 5, 6, 8,10, 6, 5,17, 6, + 8, 5, 4, 5, 7, 9, 7, 7,17, 8, 9, 6, 5, 5, 6, 8, + 8, 8,17, 9,11, 8, 6, 6, 6, 7, 9,10,17,12,12,10, + 9, 7, 7, 8, +}; + +static static_codebook _huff_book__8c1_s_single = { + 2, 100, + _huff_lengthlist__8c1_s_single, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist__44c2_s_long[] = { + 6, 6,12,10,10,10, 9,10,12,12, 6, 1,10, 5, 6, 6, + 7, 9,11,14,12, 9, 8,11, 7, 8, 9,11,13,15,10, 5, + 12, 7, 8, 7, 9,12,14,15,10, 6, 7, 8, 5, 6, 7, 9, + 12,14, 9, 6, 8, 7, 6, 6, 7, 9,12,12, 9, 7, 9, 9, + 7, 6, 6, 7,10,10,10, 9,10,11, 8, 7, 6, 6, 8,10, + 12,11,13,13,11,10, 8, 8, 8,10,11,13,15,15,14,13, + 10, 8, 8, 9, +}; + +static static_codebook _huff_book__44c2_s_long = { + 2, 100, + _huff_lengthlist__44c2_s_long, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _vq_quantlist__44c2_s_p1_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__44c2_s_p1_0[] = { + 2, 4, 4, 0, 0, 0, 0, 0, 0, 5, 6, 6, 0, 0, 0, 0, + 0, 0, 5, 6, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 5, 7, 7, 0, 0, 0, 0, 0, 0, 7, 8, 8, 0, 0, 0, + 0, 0, 0, 6, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 5, 7, 7, 0, 0, 0, 0, 0, 0, 6, 8, 7, 0, 0, + 0, 0, 0, 0, 7, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, 0, 0, 0, + 0, 0, 7, 8, 8, 0, 0, 0, 0, 0, 0, 7, 8, 8, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 8, 8, 0, 0, 0, + 0, 0, 0, 8, 9, 9, 0, 0, 0, 0, 0, 0, 8, 9, 9, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 8, 8, 0, 0, + 0, 0, 0, 0, 8, 9, 8, 0, 0, 0, 0, 0, 0, 8, 9, 9, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 4, 7, 7, 0, 0, 0, 0, 0, 0, 7, 8, 8, 0, 0, + 0, 0, 0, 0, 7, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 6, 8, 8, 0, 0, 0, 0, 0, 0, 8, 9, 9, 0, + 0, 0, 0, 0, 0, 8, 8, 9, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 7, 8, 8, 0, 0, 0, 0, 0, 0, 8, 9, 9, + 0, 0, 0, 0, 0, 0, 8, 9, 9, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + +static float _vq_quantthresh__44c2_s_p1_0[] = { + -0.5, 0.5, +}; + +static long _vq_quantmap__44c2_s_p1_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__44c2_s_p1_0 = { + _vq_quantthresh__44c2_s_p1_0, + _vq_quantmap__44c2_s_p1_0, + 3, + 3 +}; + +static static_codebook _44c2_s_p1_0 = { + 8, 6561, + _vq_lengthlist__44c2_s_p1_0, + 1, -535822336, 1611661312, 2, 0, + _vq_quantlist__44c2_s_p1_0, + NULL, + &_vq_auxt__44c2_s_p1_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c2_s_p2_0[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44c2_s_p2_0[] = { + 1, 4, 4, 0, 0, 0, 7, 7, 0, 0, 0, 7, 7, 0, 0, 0, + 8, 8, 0, 0, 0, 0, 0, 0, 0, 4, 6, 6, 0, 0, 0, 8, + 8, 0, 0, 0, 8, 8, 0, 0, 0, 9, 9, 0, 0, 0, 0, 0, + 0, 0, 4, 6, 6, 0, 0, 0, 8, 8, 0, 0, 0, 8, 8, 0, + 0, 0, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 7, 8, 8, 0, 0, 0,11,11, 0, 0, + 0,11,11, 0, 0, 0,12,11, 0, 0, 0, 0, 0, 0, 0, 7, + 8, 8, 0, 0, 0,10,11, 0, 0, 0,11,11, 0, 0, 0,11, + 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 6, 8, 8, 0, 0, 0,11,11, 0, 0, 0,11,11, + 0, 0, 0,12,12, 0, 0, 0, 0, 0, 0, 0, 6, 8, 8, 0, + 0, 0,10,11, 0, 0, 0,10,11, 0, 0, 0,11,11, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 8, 9, 9, 0, 0, 0,11,12, 0, 0, 0,11,12, 0, 0, 0, + 12,11, 0, 0, 0, 0, 0, 0, 0, 8,10, 9, 0, 0, 0,12, + 11, 0, 0, 0,12,11, 0, 0, 0,11,12, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + +static float _vq_quantthresh__44c2_s_p2_0[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__44c2_s_p2_0[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44c2_s_p2_0 = { + _vq_quantthresh__44c2_s_p2_0, + _vq_quantmap__44c2_s_p2_0, + 5, + 5 +}; + +static static_codebook _44c2_s_p2_0 = { + 4, 625, + _vq_lengthlist__44c2_s_p2_0, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__44c2_s_p2_0, + NULL, + &_vq_auxt__44c2_s_p2_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c2_s_p3_0[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44c2_s_p3_0[] = { + 2, 4, 3, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 6, 6, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 4, 4, 4, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6, 9, 9, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 6, 6, 7, 9, 9, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + +static float _vq_quantthresh__44c2_s_p3_0[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__44c2_s_p3_0[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44c2_s_p3_0 = { + _vq_quantthresh__44c2_s_p3_0, + _vq_quantmap__44c2_s_p3_0, + 5, + 5 +}; + +static static_codebook _44c2_s_p3_0 = { + 4, 625, + _vq_lengthlist__44c2_s_p3_0, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__44c2_s_p3_0, + NULL, + &_vq_auxt__44c2_s_p3_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c2_s_p4_0[] = { + 4, + 3, + 5, + 2, + 6, + 1, + 7, + 0, + 8, +}; + +static long _vq_lengthlist__44c2_s_p4_0[] = { + 1, 3, 3, 6, 6, 0, 0, 0, 0, 0, 6, 6, 6, 6, 0, 0, + 0, 0, 0, 6, 6, 6, 6, 0, 0, 0, 0, 0, 7, 7, 6, 6, + 0, 0, 0, 0, 0, 0, 0, 6, 7, 0, 0, 0, 0, 0, 0, 0, + 7, 8, 0, 0, 0, 0, 0, 0, 0, 8, 8, 0, 0, 0, 0, 0, + 0, 0, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + +static float _vq_quantthresh__44c2_s_p4_0[] = { + -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, +}; + +static long _vq_quantmap__44c2_s_p4_0[] = { + 7, 5, 3, 1, 0, 2, 4, 6, + 8, +}; + +static encode_aux_threshmatch _vq_auxt__44c2_s_p4_0 = { + _vq_quantthresh__44c2_s_p4_0, + _vq_quantmap__44c2_s_p4_0, + 9, + 9 +}; + +static static_codebook _44c2_s_p4_0 = { + 2, 81, + _vq_lengthlist__44c2_s_p4_0, + 1, -531628032, 1611661312, 4, 0, + _vq_quantlist__44c2_s_p4_0, + NULL, + &_vq_auxt__44c2_s_p4_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c2_s_p5_0[] = { + 4, + 3, + 5, + 2, + 6, + 1, + 7, + 0, + 8, +}; + +static long _vq_lengthlist__44c2_s_p5_0[] = { + 1, 3, 3, 6, 6, 7, 7, 9, 9, 0, 7, 7, 7, 7, 7, 7, + 9, 9, 0, 7, 7, 7, 7, 7, 7, 9, 9, 0, 8, 8, 7, 7, + 8, 8,10,10, 0, 0, 0, 7, 7, 8, 8,10,10, 0, 0, 0, + 9, 9, 8, 8,10,10, 0, 0, 0, 9, 9, 8, 8,10,10, 0, + 0, 0,10,10, 9, 9,11,11, 0, 0, 0, 0, 0, 9, 9,11, + 11, +}; + +static float _vq_quantthresh__44c2_s_p5_0[] = { + -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, +}; + +static long _vq_quantmap__44c2_s_p5_0[] = { + 7, 5, 3, 1, 0, 2, 4, 6, + 8, +}; + +static encode_aux_threshmatch _vq_auxt__44c2_s_p5_0 = { + _vq_quantthresh__44c2_s_p5_0, + _vq_quantmap__44c2_s_p5_0, + 9, + 9 +}; + +static static_codebook _44c2_s_p5_0 = { + 2, 81, + _vq_lengthlist__44c2_s_p5_0, + 1, -531628032, 1611661312, 4, 0, + _vq_quantlist__44c2_s_p5_0, + NULL, + &_vq_auxt__44c2_s_p5_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c2_s_p6_0[] = { + 8, + 7, + 9, + 6, + 10, + 5, + 11, + 4, + 12, + 3, + 13, + 2, + 14, + 1, + 15, + 0, + 16, +}; + +static long _vq_lengthlist__44c2_s_p6_0[] = { + 1, 4, 3, 6, 6, 8, 8, 9, 9, 9, 9, 9, 9,10,10,11, + 11, 0, 7, 7, 7, 7, 8, 8, 9, 9, 9, 9,10,10,11,11, + 12,11, 0, 7, 7, 7, 7, 8, 8, 9, 9, 9, 9,10,10,11, + 11,11,12, 0, 8, 8, 7, 7, 9, 9,10,10, 9, 9,10,10, + 11,11,12,12, 0, 0, 0, 7, 7, 9, 9,10,10,10, 9,10, + 10,11,11,12,12, 0, 0, 0, 8, 8, 9, 9,10,10,10,10, + 11,11,11,11,12,12, 0, 0, 0, 8, 8, 9, 9,10,10,10, + 10,11,11,12,12,12,12, 0, 0, 0, 9, 9, 9, 9,10,10, + 10,10,11,11,12,12,12,12, 0, 0, 0, 0, 0, 9, 9,10, + 10,10,10,11,11,12,12,13,13, 0, 0, 0, 0, 0, 9, 9, + 10,10,11,11,11,11,12,12,13,13, 0, 0, 0, 0, 0, 9, + 9,10,10,11,11,11,11,12,12,13,13, 0, 0, 0, 0, 0, + 10,10,10,10,11,11,12,12,13,12,13,13, 0, 0, 0, 0, + 0, 0, 0,10,10,11,11,12,12,13,13,13,13, 0, 0, 0, + 0, 0, 0, 0,11,11,12,12,12,12,13,13,13,14, 0, 0, + 0, 0, 0, 0, 0,11,11,12,12,12,12,13,13,13,14, 0, + 0, 0, 0, 0, 0, 0,12,12,12,12,13,13,13,13,14,14, + 0, 0, 0, 0, 0, 0, 0, 0, 0,12,12,13,13,13,13,14, + 14, +}; + +static float _vq_quantthresh__44c2_s_p6_0[] = { + -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, + 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, +}; + +static long _vq_quantmap__44c2_s_p6_0[] = { + 15, 13, 11, 9, 7, 5, 3, 1, + 0, 2, 4, 6, 8, 10, 12, 14, + 16, +}; + +static encode_aux_threshmatch _vq_auxt__44c2_s_p6_0 = { + _vq_quantthresh__44c2_s_p6_0, + _vq_quantmap__44c2_s_p6_0, + 17, + 17 +}; + +static static_codebook _44c2_s_p6_0 = { + 2, 289, + _vq_lengthlist__44c2_s_p6_0, + 1, -529530880, 1611661312, 5, 0, + _vq_quantlist__44c2_s_p6_0, + NULL, + &_vq_auxt__44c2_s_p6_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c2_s_p7_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__44c2_s_p7_0[] = { + 1, 4, 4, 7, 6, 6, 7, 6, 6, 4, 7, 7,10, 9, 9,11, + 9, 9, 4, 7, 7,10, 9, 9,10, 9, 9, 7,10,10,11,10, + 11,11,10,11, 6, 9, 9,11,10,10,11,10,10, 6, 9, 9, + 11,10,11,11,10,10, 7,11,10,11,11,11,12,11,11, 6, + 9, 9,11,10,10,11,11,10, 6, 9, 9,11,10,10,12,10, + 11, +}; + +static float _vq_quantthresh__44c2_s_p7_0[] = { + -5.5, 5.5, +}; + +static long _vq_quantmap__44c2_s_p7_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__44c2_s_p7_0 = { + _vq_quantthresh__44c2_s_p7_0, + _vq_quantmap__44c2_s_p7_0, + 3, + 3 +}; + +static static_codebook _44c2_s_p7_0 = { + 4, 81, + _vq_lengthlist__44c2_s_p7_0, + 1, -529137664, 1618345984, 2, 0, + _vq_quantlist__44c2_s_p7_0, + NULL, + &_vq_auxt__44c2_s_p7_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c2_s_p7_1[] = { + 5, + 4, + 6, + 3, + 7, + 2, + 8, + 1, + 9, + 0, + 10, +}; + +static long _vq_lengthlist__44c2_s_p7_1[] = { + 2, 3, 4, 6, 6, 7, 7, 7, 7, 7, 7, 9, 7, 7, 6, 6, + 7, 7, 8, 8, 8, 8, 9, 6, 6, 6, 6, 7, 7, 8, 8, 8, + 8,10, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8,10,10,10, 7, + 7, 7, 7, 8, 8, 8, 8,10,10,10, 7, 7, 8, 8, 8, 8, + 8, 8,10,10,10, 7, 8, 8, 8, 8, 8, 8, 8,10,10,10, + 8, 8, 8, 8, 8, 8, 8, 8,10,10,10,10,10, 8, 8, 8, + 8, 8, 8,10,10,10,10,10, 9, 9, 8, 8, 8, 8,10,10, + 10,10,10, 8, 8, 8, 8, 8, 8, +}; + +static float _vq_quantthresh__44c2_s_p7_1[] = { + -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, + 3.5, 4.5, +}; + +static long _vq_quantmap__44c2_s_p7_1[] = { + 9, 7, 5, 3, 1, 0, 2, 4, + 6, 8, 10, +}; + +static encode_aux_threshmatch _vq_auxt__44c2_s_p7_1 = { + _vq_quantthresh__44c2_s_p7_1, + _vq_quantmap__44c2_s_p7_1, + 11, + 11 +}; + +static static_codebook _44c2_s_p7_1 = { + 2, 121, + _vq_lengthlist__44c2_s_p7_1, + 1, -531365888, 1611661312, 4, 0, + _vq_quantlist__44c2_s_p7_1, + NULL, + &_vq_auxt__44c2_s_p7_1, + NULL, + 0 +}; + +static long _vq_quantlist__44c2_s_p8_0[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__44c2_s_p8_0[] = { + 1, 4, 4, 6, 6, 7, 7, 7, 7, 8, 8, 9, 9, 6, 5, 5, + 7, 7, 8, 8, 8, 8, 9, 9,10,10, 7, 6, 5, 7, 7, 8, + 8, 8, 8, 9, 9,10,10, 0, 8, 8, 8, 8, 9, 9, 9, 9, + 10,10,11,11, 0, 8, 8, 8, 8, 9, 9, 9, 9,10,10,11, + 11, 0,12,12, 9, 9,10,10,10,10,11,11,11,11, 0,13, + 13, 9, 9,10,10,10,10,11,11,12,12, 0, 0, 0,10,10, + 10,10,11,11,12,12,12,13, 0, 0, 0,10,10,10,10,11, + 11,12,12,12,12, 0, 0, 0,14,14,10,11,11,11,12,12, + 13,13, 0, 0, 0,14,14,11,10,11,11,13,12,13,13, 0, + 0, 0, 0, 0,12,12,11,12,13,12,14,14, 0, 0, 0, 0, + 0,12,12,12,12,13,12,14,14, +}; + +static float _vq_quantthresh__44c2_s_p8_0[] = { + -27.5, -22.5, -17.5, -12.5, -7.5, -2.5, 2.5, 7.5, + 12.5, 17.5, 22.5, 27.5, +}; + +static long _vq_quantmap__44c2_s_p8_0[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__44c2_s_p8_0 = { + _vq_quantthresh__44c2_s_p8_0, + _vq_quantmap__44c2_s_p8_0, + 13, + 13 +}; + +static static_codebook _44c2_s_p8_0 = { + 2, 169, + _vq_lengthlist__44c2_s_p8_0, + 1, -526516224, 1616117760, 4, 0, + _vq_quantlist__44c2_s_p8_0, + NULL, + &_vq_auxt__44c2_s_p8_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c2_s_p8_1[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44c2_s_p8_1[] = { + 2, 4, 4, 5, 4, 6, 5, 5, 5, 5, 6, 5, 5, 5, 5, 6, + 5, 5, 5, 5, 6, 6, 6, 5, 5, +}; + +static float _vq_quantthresh__44c2_s_p8_1[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__44c2_s_p8_1[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44c2_s_p8_1 = { + _vq_quantthresh__44c2_s_p8_1, + _vq_quantmap__44c2_s_p8_1, + 5, + 5 +}; + +static static_codebook _44c2_s_p8_1 = { + 2, 25, + _vq_lengthlist__44c2_s_p8_1, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__44c2_s_p8_1, + NULL, + &_vq_auxt__44c2_s_p8_1, + NULL, + 0 +}; + +static long _vq_quantlist__44c2_s_p9_0[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__44c2_s_p9_0[] = { + 1, 5, 4,12,12,12,12,12,12,12,12,12,12, 4, 9, 8, + 11,11,11,11,11,11,11,11,11,11, 2, 8, 7,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11, +}; + +static float _vq_quantthresh__44c2_s_p9_0[] = { + -1215.5, -994.5, -773.5, -552.5, -331.5, -110.5, 110.5, 331.5, + 552.5, 773.5, 994.5, 1215.5, +}; + +static long _vq_quantmap__44c2_s_p9_0[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__44c2_s_p9_0 = { + _vq_quantthresh__44c2_s_p9_0, + _vq_quantmap__44c2_s_p9_0, + 13, + 13 +}; + +static static_codebook _44c2_s_p9_0 = { + 2, 169, + _vq_lengthlist__44c2_s_p9_0, + 1, -514541568, 1627103232, 4, 0, + _vq_quantlist__44c2_s_p9_0, + NULL, + &_vq_auxt__44c2_s_p9_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c2_s_p9_1[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__44c2_s_p9_1[] = { + 1, 4, 4, 6, 6, 7, 6, 8, 8,10, 9,10,10, 6, 5, 5, + 7, 7, 8, 7,10, 9,11,11,12,13, 6, 5, 5, 7, 7, 8, + 8,10,10,11,11,13,13,18, 8, 8, 8, 8, 9, 9,10,10, + 12,12,12,13,18, 8, 8, 8, 8, 9, 9,10,10,12,12,13, + 13,18,11,11, 8, 8,10,10,11,11,12,11,13,12,18,11, + 11, 9, 7,10,10,11,11,11,12,12,13,17,17,17,10,10, + 11,11,12,12,12,10,12,12,17,17,17,11,10,11,10,13, + 12,11,12,12,12,17,17,17,15,14,11,11,12,11,13,10, + 13,12,17,17,17,14,14,12,10,11,11,13,13,13,13,17, + 17,16,17,16,13,13,12,10,13,10,14,13,17,16,17,16, + 17,13,12,12,10,13,11,14,14, +}; + +static float _vq_quantthresh__44c2_s_p9_1[] = { + -93.5, -76.5, -59.5, -42.5, -25.5, -8.5, 8.5, 25.5, + 42.5, 59.5, 76.5, 93.5, +}; + +static long _vq_quantmap__44c2_s_p9_1[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__44c2_s_p9_1 = { + _vq_quantthresh__44c2_s_p9_1, + _vq_quantmap__44c2_s_p9_1, + 13, + 13 +}; + +static static_codebook _44c2_s_p9_1 = { + 2, 169, + _vq_lengthlist__44c2_s_p9_1, + 1, -522616832, 1620115456, 4, 0, + _vq_quantlist__44c2_s_p9_1, + NULL, + &_vq_auxt__44c2_s_p9_1, + NULL, + 0 +}; + +static long _vq_quantlist__44c2_s_p9_2[] = { + 8, + 7, + 9, + 6, + 10, + 5, + 11, + 4, + 12, + 3, + 13, + 2, + 14, + 1, + 15, + 0, + 16, +}; + +static long _vq_lengthlist__44c2_s_p9_2[] = { + 2, 4, 4, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, + 8,10, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, + 9, 9,10, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, + 9, 9, 9,10, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, + 9, 9, 9, 9,10,10,10, 8, 7, 8, 8, 8, 8, 9, 9, 9, + 9, 9, 9, 9, 9,10,11,11, 8, 8, 8, 8, 9, 9, 9, 9, + 9, 9,10, 9, 9, 9,10,11,10, 8, 8, 8, 8, 9, 9, 9, + 9, 9, 9, 9,10,10,10,10,11,10, 8, 8, 9, 9, 9, 9, + 9, 9,10, 9, 9,10, 9,10,11,10,11,11,11, 8, 8, 9, + 9, 9, 9, 9, 9, 9, 9,10,10,11,11,11,11,11, 9, 9, + 9, 9, 9, 9,10, 9, 9, 9,10,10,11,11,11,11,11, 9, + 9, 9, 9, 9, 9, 9, 9, 9,10, 9,10,11,11,11,11,11, + 9, 9, 9, 9,10,10, 9, 9, 9,10,10,10,11,11,11,11, + 11,11,11, 9, 9, 9,10, 9, 9,10,10,10,10,11,11,10, + 11,11,11,11,10, 9,10,10, 9, 9, 9, 9,10,10,11,10, + 11,11,11,11,11, 9, 9, 9, 9,10, 9,10,10,10,10,11, + 10,11,11,11,11,11,10,10, 9, 9,10, 9,10,10,10,10, + 10,10,10,11,11,11,11,11,11, 9, 9,10, 9,10, 9,10, + 10, +}; + +static float _vq_quantthresh__44c2_s_p9_2[] = { + -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, + 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, +}; + +static long _vq_quantmap__44c2_s_p9_2[] = { + 15, 13, 11, 9, 7, 5, 3, 1, + 0, 2, 4, 6, 8, 10, 12, 14, + 16, +}; + +static encode_aux_threshmatch _vq_auxt__44c2_s_p9_2 = { + _vq_quantthresh__44c2_s_p9_2, + _vq_quantmap__44c2_s_p9_2, + 17, + 17 +}; + +static static_codebook _44c2_s_p9_2 = { + 2, 289, + _vq_lengthlist__44c2_s_p9_2, + 1, -529530880, 1611661312, 5, 0, + _vq_quantlist__44c2_s_p9_2, + NULL, + &_vq_auxt__44c2_s_p9_2, + NULL, + 0 +}; + +static long _huff_lengthlist__44c2_s_short[] = { + 11, 9,13,12,12,11,12,12,13,15, 8, 2,11, 4, 8, 5, + 7,10,12,15,13, 7,10, 9, 8, 8,10,13,17,17,11, 4, + 12, 5, 9, 5, 8,11,14,16,12, 6, 8, 7, 6, 6, 8,11, + 13,16,11, 4, 9, 5, 6, 4, 6,10,13,16,11, 6,11, 7, + 7, 6, 7,10,13,15,13, 9,12, 9, 8, 6, 8,10,12,14, + 14,10,10, 8, 6, 5, 6, 9,11,13,15,11,11, 9, 6, 5, + 6, 8, 9,12, +}; + +static static_codebook _huff_book__44c2_s_short = { + 2, 100, + _huff_lengthlist__44c2_s_short, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist__44c3_s_long[] = { + 5, 6,11,11,11,11,10,10,12,11, 5, 2,11, 5, 6, 6, + 7, 9,11,13,13,10, 7,11, 6, 7, 8, 9,10,12,11, 5, + 11, 6, 8, 7, 9,11,14,15,11, 6, 6, 8, 4, 5, 7, 8, + 10,13,10, 5, 7, 7, 5, 5, 6, 8,10,11,10, 7, 7, 8, + 6, 5, 5, 7, 9, 9,11, 8, 8,11, 8, 7, 6, 6, 7, 9, + 12,11,10,13, 9, 9, 7, 7, 7, 9,11,13,12,15,12,11, + 9, 8, 8, 8, +}; + +static static_codebook _huff_book__44c3_s_long = { + 2, 100, + _huff_lengthlist__44c3_s_long, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _vq_quantlist__44c3_s_p1_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__44c3_s_p1_0[] = { + 2, 4, 4, 0, 0, 0, 0, 0, 0, 5, 6, 6, 0, 0, 0, 0, + 0, 0, 5, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 5, 7, 7, 0, 0, 0, 0, 0, 0, 7, 8, 8, 0, 0, 0, + 0, 0, 0, 6, 7, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 5, 7, 7, 0, 0, 0, 0, 0, 0, 6, 8, 7, 0, 0, + 0, 0, 0, 0, 7, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, 0, 0, 0, + 0, 0, 7, 8, 8, 0, 0, 0, 0, 0, 0, 7, 8, 8, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 8, 8, 0, 0, 0, + 0, 0, 0, 8, 8, 9, 0, 0, 0, 0, 0, 0, 8, 9, 9, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 8, 8, 0, 0, + 0, 0, 0, 0, 7, 9, 8, 0, 0, 0, 0, 0, 0, 8, 9, 9, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 5, 7, 7, 0, 0, 0, 0, 0, 0, 7, 8, 8, 0, 0, + 0, 0, 0, 0, 7, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 6, 8, 8, 0, 0, 0, 0, 0, 0, 8, 9, 9, 0, + 0, 0, 0, 0, 0, 7, 8, 9, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 6, 8, 8, 0, 0, 0, 0, 0, 0, 8, 9, 9, + 0, 0, 0, 0, 0, 0, 8, 9, 8, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + +static float _vq_quantthresh__44c3_s_p1_0[] = { + -0.5, 0.5, +}; + +static long _vq_quantmap__44c3_s_p1_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__44c3_s_p1_0 = { + _vq_quantthresh__44c3_s_p1_0, + _vq_quantmap__44c3_s_p1_0, + 3, + 3 +}; + +static static_codebook _44c3_s_p1_0 = { + 8, 6561, + _vq_lengthlist__44c3_s_p1_0, + 1, -535822336, 1611661312, 2, 0, + _vq_quantlist__44c3_s_p1_0, + NULL, + &_vq_auxt__44c3_s_p1_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c3_s_p2_0[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44c3_s_p2_0[] = { + 2, 5, 5, 0, 0, 0, 5, 5, 0, 0, 0, 5, 5, 0, 0, 0, + 7, 8, 0, 0, 0, 0, 0, 0, 0, 5, 6, 6, 0, 0, 0, 7, + 7, 0, 0, 0, 7, 7, 0, 0, 0,10,10, 0, 0, 0, 0, 0, + 0, 0, 5, 6, 6, 0, 0, 0, 7, 7, 0, 0, 0, 7, 7, 0, + 0, 0,10,10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, 0, 0, 7, 7, 0, 0, + 0, 7, 7, 0, 0, 0, 9, 9, 0, 0, 0, 0, 0, 0, 0, 5, + 7, 7, 0, 0, 0, 7, 7, 0, 0, 0, 7, 7, 0, 0, 0, 9, + 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 5, 7, 7, 0, 0, 0, 7, 7, 0, 0, 0, 7, 7, + 0, 0, 0, 9, 9, 0, 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, + 0, 0, 7, 7, 0, 0, 0, 7, 7, 0, 0, 0, 9, 9, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 8,10,10, 0, 0, 0, 9, 9, 0, 0, 0, 9, 9, 0, 0, 0, + 10,10, 0, 0, 0, 0, 0, 0, 0, 8,10,10, 0, 0, 0, 9, + 9, 0, 0, 0, 9, 9, 0, 0, 0,10,10, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + +static float _vq_quantthresh__44c3_s_p2_0[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__44c3_s_p2_0[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44c3_s_p2_0 = { + _vq_quantthresh__44c3_s_p2_0, + _vq_quantmap__44c3_s_p2_0, + 5, + 5 +}; + +static static_codebook _44c3_s_p2_0 = { + 4, 625, + _vq_lengthlist__44c3_s_p2_0, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__44c3_s_p2_0, + NULL, + &_vq_auxt__44c3_s_p2_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c3_s_p3_0[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44c3_s_p3_0[] = { + 2, 4, 3, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 6, 6, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 4, 4, 4, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6, 9, 9, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 6, 6, 7, 9, 9, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + +static float _vq_quantthresh__44c3_s_p3_0[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__44c3_s_p3_0[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44c3_s_p3_0 = { + _vq_quantthresh__44c3_s_p3_0, + _vq_quantmap__44c3_s_p3_0, + 5, + 5 +}; + +static static_codebook _44c3_s_p3_0 = { + 4, 625, + _vq_lengthlist__44c3_s_p3_0, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__44c3_s_p3_0, + NULL, + &_vq_auxt__44c3_s_p3_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c3_s_p4_0[] = { + 4, + 3, + 5, + 2, + 6, + 1, + 7, + 0, + 8, +}; + +static long _vq_lengthlist__44c3_s_p4_0[] = { + 2, 3, 3, 6, 6, 0, 0, 0, 0, 0, 4, 4, 6, 6, 0, 0, + 0, 0, 0, 4, 4, 6, 6, 0, 0, 0, 0, 0, 5, 5, 6, 6, + 0, 0, 0, 0, 0, 0, 0, 6, 6, 0, 0, 0, 0, 0, 0, 0, + 7, 8, 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, + 0, 0, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + +static float _vq_quantthresh__44c3_s_p4_0[] = { + -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, +}; + +static long _vq_quantmap__44c3_s_p4_0[] = { + 7, 5, 3, 1, 0, 2, 4, 6, + 8, +}; + +static encode_aux_threshmatch _vq_auxt__44c3_s_p4_0 = { + _vq_quantthresh__44c3_s_p4_0, + _vq_quantmap__44c3_s_p4_0, + 9, + 9 +}; + +static static_codebook _44c3_s_p4_0 = { + 2, 81, + _vq_lengthlist__44c3_s_p4_0, + 1, -531628032, 1611661312, 4, 0, + _vq_quantlist__44c3_s_p4_0, + NULL, + &_vq_auxt__44c3_s_p4_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c3_s_p5_0[] = { + 4, + 3, + 5, + 2, + 6, + 1, + 7, + 0, + 8, +}; + +static long _vq_lengthlist__44c3_s_p5_0[] = { + 1, 3, 4, 6, 6, 7, 7, 9, 9, 0, 5, 5, 7, 7, 7, 8, + 9, 9, 0, 5, 5, 7, 7, 8, 8, 9, 9, 0, 7, 7, 8, 8, + 8, 8,10,10, 0, 0, 0, 8, 8, 8, 8,10,10, 0, 0, 0, + 9, 9, 9, 9,10,10, 0, 0, 0, 9, 9, 9, 9,10,10, 0, + 0, 0,10,10,10,10,11,11, 0, 0, 0, 0, 0,10,10,11, + 11, +}; + +static float _vq_quantthresh__44c3_s_p5_0[] = { + -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, +}; + +static long _vq_quantmap__44c3_s_p5_0[] = { + 7, 5, 3, 1, 0, 2, 4, 6, + 8, +}; + +static encode_aux_threshmatch _vq_auxt__44c3_s_p5_0 = { + _vq_quantthresh__44c3_s_p5_0, + _vq_quantmap__44c3_s_p5_0, + 9, + 9 +}; + +static static_codebook _44c3_s_p5_0 = { + 2, 81, + _vq_lengthlist__44c3_s_p5_0, + 1, -531628032, 1611661312, 4, 0, + _vq_quantlist__44c3_s_p5_0, + NULL, + &_vq_auxt__44c3_s_p5_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c3_s_p6_0[] = { + 8, + 7, + 9, + 6, + 10, + 5, + 11, + 4, + 12, + 3, + 13, + 2, + 14, + 1, + 15, + 0, + 16, +}; + +static long _vq_lengthlist__44c3_s_p6_0[] = { + 2, 3, 3, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9,10,10,11, + 10, 0, 5, 5, 7, 7, 8, 8, 9, 9, 9, 9,10,10,10,10, + 11,11, 0, 5, 5, 7, 7, 8, 8, 9, 9, 9, 9,10,10,10, + 10,11,11, 0, 6, 6, 7, 7, 8, 8, 9, 9, 9, 9,10,10, + 11,11,11,11, 0, 0, 0, 7, 7, 8, 8, 9, 9, 9, 9,10, + 10,11,11,11,12, 0, 0, 0, 8, 8, 8, 8, 9, 9, 9, 9, + 10,10,11,11,12,12, 0, 0, 0, 8, 8, 8, 8, 9, 9, 9, + 9,10,10,11,11,12,12, 0, 0, 0, 9, 9, 9, 9,10,10, + 10,10,11,10,11,11,12,12, 0, 0, 0, 0, 0, 9, 9,10, + 10,10,10,11,11,11,11,12,12, 0, 0, 0, 0, 0, 9, 8, + 9, 9,10,10,11,11,12,12,12,12, 0, 0, 0, 0, 0, 8, + 8, 9, 9,10,10,11,11,12,11,12,12, 0, 0, 0, 0, 0, + 9,10,10,10,11,11,11,11,12,12,13,13, 0, 0, 0, 0, + 0, 0, 0,10,10,10,10,11,11,12,12,13,13, 0, 0, 0, + 0, 0, 0, 0,11,11,11,11,12,12,12,12,13,13, 0, 0, + 0, 0, 0, 0, 0,11,11,11,11,12,12,12,12,13,13, 0, + 0, 0, 0, 0, 0, 0,11,11,12,12,12,12,13,13,13,13, + 0, 0, 0, 0, 0, 0, 0, 0, 0,12,12,12,12,13,13,13, + 13, +}; + +static float _vq_quantthresh__44c3_s_p6_0[] = { + -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, + 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, +}; + +static long _vq_quantmap__44c3_s_p6_0[] = { + 15, 13, 11, 9, 7, 5, 3, 1, + 0, 2, 4, 6, 8, 10, 12, 14, + 16, +}; + +static encode_aux_threshmatch _vq_auxt__44c3_s_p6_0 = { + _vq_quantthresh__44c3_s_p6_0, + _vq_quantmap__44c3_s_p6_0, + 17, + 17 +}; + +static static_codebook _44c3_s_p6_0 = { + 2, 289, + _vq_lengthlist__44c3_s_p6_0, + 1, -529530880, 1611661312, 5, 0, + _vq_quantlist__44c3_s_p6_0, + NULL, + &_vq_auxt__44c3_s_p6_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c3_s_p7_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__44c3_s_p7_0[] = { + 1, 4, 4, 7, 6, 6, 7, 6, 6, 4, 7, 7,10, 9, 9,11, + 9, 9, 4, 7, 7,10, 9, 9,11, 9, 9, 7,10,10,11,11, + 10,12,11,11, 6, 9, 9,11,10,10,11,10,10, 6, 9, 9, + 11,10,10,11,10,10, 7,11,11,11,11,11,12,11,11, 6, + 9, 9,11,10,10,11,10,10, 6, 9, 9,11,10,10,11,10, + 10, +}; + +static float _vq_quantthresh__44c3_s_p7_0[] = { + -5.5, 5.5, +}; + +static long _vq_quantmap__44c3_s_p7_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__44c3_s_p7_0 = { + _vq_quantthresh__44c3_s_p7_0, + _vq_quantmap__44c3_s_p7_0, + 3, + 3 +}; + +static static_codebook _44c3_s_p7_0 = { + 4, 81, + _vq_lengthlist__44c3_s_p7_0, + 1, -529137664, 1618345984, 2, 0, + _vq_quantlist__44c3_s_p7_0, + NULL, + &_vq_auxt__44c3_s_p7_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c3_s_p7_1[] = { + 5, + 4, + 6, + 3, + 7, + 2, + 8, + 1, + 9, + 0, + 10, +}; + +static long _vq_lengthlist__44c3_s_p7_1[] = { + 2, 4, 4, 6, 6, 7, 7, 7, 7, 8, 8,10, 5, 5, 6, 6, + 7, 7, 8, 8, 8, 8,10, 5, 5, 6, 6, 7, 7, 8, 8, 8, + 8,10, 6, 6, 7, 7, 8, 8, 8, 8, 8, 8,10,10,10, 7, + 7, 8, 7, 8, 8, 8, 8,10,10,10, 8, 8, 8, 8, 8, 8, + 8, 8,10,10,10, 7, 8, 8, 8, 8, 8, 8, 8,10,10,10, + 8, 8, 8, 8, 8, 8, 8, 8,10,10,10,10,10, 8, 8, 8, + 8, 8, 8,10,10,10,10,10, 9, 9, 8, 8, 9, 8,10,10, + 10,10,10, 8, 8, 8, 8, 8, 8, +}; + +static float _vq_quantthresh__44c3_s_p7_1[] = { + -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, + 3.5, 4.5, +}; + +static long _vq_quantmap__44c3_s_p7_1[] = { + 9, 7, 5, 3, 1, 0, 2, 4, + 6, 8, 10, +}; + +static encode_aux_threshmatch _vq_auxt__44c3_s_p7_1 = { + _vq_quantthresh__44c3_s_p7_1, + _vq_quantmap__44c3_s_p7_1, + 11, + 11 +}; + +static static_codebook _44c3_s_p7_1 = { + 2, 121, + _vq_lengthlist__44c3_s_p7_1, + 1, -531365888, 1611661312, 4, 0, + _vq_quantlist__44c3_s_p7_1, + NULL, + &_vq_auxt__44c3_s_p7_1, + NULL, + 0 +}; + +static long _vq_quantlist__44c3_s_p8_0[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__44c3_s_p8_0[] = { + 1, 4, 4, 6, 6, 7, 7, 8, 8, 9, 9,10,10, 6, 5, 5, + 7, 7, 8, 8, 8, 8, 9, 9,10,10, 7, 5, 5, 7, 7, 8, + 8, 8, 8, 9, 9,11,10, 0, 8, 8, 8, 8, 9, 9, 9, 9, + 10,10,11,11, 0, 8, 8, 8, 8, 9, 9, 9, 9,10,10,11, + 11, 0,12,12, 9, 9,10,10,10,10,11,11,11,12, 0,13, + 13, 9, 9,10,10,10,10,11,11,12,12, 0, 0, 0,10,10, + 10,10,11,11,12,12,12,12, 0, 0, 0,10,10,10,10,11, + 11,12,12,12,12, 0, 0, 0,14,14,11,11,11,11,12,12, + 13,13, 0, 0, 0,14,14,11,11,11,11,12,12,13,13, 0, + 0, 0, 0, 0,12,12,12,12,13,13,14,13, 0, 0, 0, 0, + 0,13,13,12,12,13,12,14,13, +}; + +static float _vq_quantthresh__44c3_s_p8_0[] = { + -27.5, -22.5, -17.5, -12.5, -7.5, -2.5, 2.5, 7.5, + 12.5, 17.5, 22.5, 27.5, +}; + +static long _vq_quantmap__44c3_s_p8_0[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__44c3_s_p8_0 = { + _vq_quantthresh__44c3_s_p8_0, + _vq_quantmap__44c3_s_p8_0, + 13, + 13 +}; + +static static_codebook _44c3_s_p8_0 = { + 2, 169, + _vq_lengthlist__44c3_s_p8_0, + 1, -526516224, 1616117760, 4, 0, + _vq_quantlist__44c3_s_p8_0, + NULL, + &_vq_auxt__44c3_s_p8_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c3_s_p8_1[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44c3_s_p8_1[] = { + 2, 4, 4, 5, 5, 6, 5, 5, 5, 5, 6, 4, 5, 5, 5, 6, + 5, 5, 5, 5, 6, 6, 6, 5, 5, +}; + +static float _vq_quantthresh__44c3_s_p8_1[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__44c3_s_p8_1[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44c3_s_p8_1 = { + _vq_quantthresh__44c3_s_p8_1, + _vq_quantmap__44c3_s_p8_1, + 5, + 5 +}; + +static static_codebook _44c3_s_p8_1 = { + 2, 25, + _vq_lengthlist__44c3_s_p8_1, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__44c3_s_p8_1, + NULL, + &_vq_auxt__44c3_s_p8_1, + NULL, + 0 +}; + +static long _vq_quantlist__44c3_s_p9_0[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__44c3_s_p9_0[] = { + 1, 4, 4,12,12,12,12,12,12,12,12,12,12, 4, 9, 8, + 12,12,12,12,12,12,12,12,12,12, 2, 9, 7,12,12,12, + 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, + 12,12,12,12,12,12,11,12,12,12,12,12,12,12,12,12, + 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, + 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, + 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, + 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, + 12,12,12,12,12,12,12,12,12,12,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11, +}; + +static float _vq_quantthresh__44c3_s_p9_0[] = { + -1402.5, -1147.5, -892.5, -637.5, -382.5, -127.5, 127.5, 382.5, + 637.5, 892.5, 1147.5, 1402.5, +}; + +static long _vq_quantmap__44c3_s_p9_0[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__44c3_s_p9_0 = { + _vq_quantthresh__44c3_s_p9_0, + _vq_quantmap__44c3_s_p9_0, + 13, + 13 +}; + +static static_codebook _44c3_s_p9_0 = { + 2, 169, + _vq_lengthlist__44c3_s_p9_0, + 1, -514332672, 1627381760, 4, 0, + _vq_quantlist__44c3_s_p9_0, + NULL, + &_vq_auxt__44c3_s_p9_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c3_s_p9_1[] = { + 7, + 6, + 8, + 5, + 9, + 4, + 10, + 3, + 11, + 2, + 12, + 1, + 13, + 0, + 14, +}; + +static long _vq_lengthlist__44c3_s_p9_1[] = { + 1, 4, 4, 6, 6, 7, 7, 8, 7, 9, 9,10,10,10,10, 6, + 5, 5, 7, 7, 8, 8,10, 8,11,10,12,12,13,13, 6, 5, + 5, 7, 7, 8, 8,10, 9,11,11,12,12,13,12,18, 8, 8, + 8, 8, 9, 9,10, 9,11,10,12,12,13,13,18, 8, 8, 8, + 8, 9, 9,10,10,11,11,13,12,14,13,18,11,11, 9, 9, + 10,10,11,11,11,12,13,12,13,14,18,11,11, 9, 8,11, + 10,11,11,11,11,12,12,14,13,18,18,18,10,11,10,11, + 12,12,12,12,13,12,14,13,18,18,18,10,11,11, 9,12, + 11,12,12,12,13,13,13,18,18,17,14,14,11,11,12,12, + 13,12,14,12,14,13,18,18,18,14,14,11,10,12, 9,12, + 13,13,13,13,13,18,18,17,16,18,13,13,12,12,13,11, + 14,12,14,14,17,18,18,17,18,13,12,13,10,12,11,14, + 14,14,14,17,18,18,18,18,15,16,12,12,13,10,14,12, + 14,15,18,18,18,16,17,16,14,12,11,13,10,13,13,14, + 15, +}; + +static float _vq_quantthresh__44c3_s_p9_1[] = { + -110.5, -93.5, -76.5, -59.5, -42.5, -25.5, -8.5, 8.5, + 25.5, 42.5, 59.5, 76.5, 93.5, 110.5, +}; + +static long _vq_quantmap__44c3_s_p9_1[] = { + 13, 11, 9, 7, 5, 3, 1, 0, + 2, 4, 6, 8, 10, 12, 14, +}; + +static encode_aux_threshmatch _vq_auxt__44c3_s_p9_1 = { + _vq_quantthresh__44c3_s_p9_1, + _vq_quantmap__44c3_s_p9_1, + 15, + 15 +}; + +static static_codebook _44c3_s_p9_1 = { + 2, 225, + _vq_lengthlist__44c3_s_p9_1, + 1, -522338304, 1620115456, 4, 0, + _vq_quantlist__44c3_s_p9_1, + NULL, + &_vq_auxt__44c3_s_p9_1, + NULL, + 0 +}; + +static long _vq_quantlist__44c3_s_p9_2[] = { + 8, + 7, + 9, + 6, + 10, + 5, + 11, + 4, + 12, + 3, + 13, + 2, + 14, + 1, + 15, + 0, + 16, +}; + +static long _vq_lengthlist__44c3_s_p9_2[] = { + 2, 5, 5, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, + 8,10, 6, 6, 7, 7, 8, 7, 8, 8, 8, 8, 8, 9, 9, 9, + 9, 9,10, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, + 9, 9, 9,10, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, + 9, 9, 9, 9,10,10,10, 7, 7, 8, 8, 8, 9, 9, 9, 9, + 9, 9, 9, 9, 9,11,11,11, 8, 8, 8, 8, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9,10,10,10, 8, 8, 8, 8, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9,10,10,10, 8, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9,10, 9,10,10,10,11,11, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9,11,10,11,11,11, 9, 9, + 9, 9, 9, 9,10,10, 9, 9,10, 9,11,10,11,11,11, 9, + 9, 9, 9, 9, 9, 9, 9,10,10,10, 9,11,11,11,11,11, + 9, 9, 9, 9,10,10, 9, 9, 9, 9,10, 9,11,11,11,11, + 11,11,11, 9, 9, 9, 9, 9, 9,10,10,10,10,11,11,11, + 11,11,11,11,10, 9,10,10, 9,10, 9, 9,10, 9,11,10, + 10,11,11,11,11, 9,10, 9, 9, 9, 9,10,10,10,10,11, + 11,11,11,11,11,10,10,10, 9, 9,10, 9,10, 9,10,10, + 10,10,11,11,11,11,11,11,11, 9, 9, 9, 9, 9,10,10, + 10, +}; + +static float _vq_quantthresh__44c3_s_p9_2[] = { + -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, + 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, +}; + +static long _vq_quantmap__44c3_s_p9_2[] = { + 15, 13, 11, 9, 7, 5, 3, 1, + 0, 2, 4, 6, 8, 10, 12, 14, + 16, +}; + +static encode_aux_threshmatch _vq_auxt__44c3_s_p9_2 = { + _vq_quantthresh__44c3_s_p9_2, + _vq_quantmap__44c3_s_p9_2, + 17, + 17 +}; + +static static_codebook _44c3_s_p9_2 = { + 2, 289, + _vq_lengthlist__44c3_s_p9_2, + 1, -529530880, 1611661312, 5, 0, + _vq_quantlist__44c3_s_p9_2, + NULL, + &_vq_auxt__44c3_s_p9_2, + NULL, + 0 +}; + +static long _huff_lengthlist__44c3_s_short[] = { + 10, 9,13,11,14,10,12,13,13,14, 7, 2,12, 5,10, 5, + 7,10,12,14,12, 6, 9, 8, 7, 7, 9,11,13,16,10, 4, + 12, 5,10, 6, 8,12,14,16,12, 6, 8, 7, 6, 5, 7,11, + 12,16,10, 4, 8, 5, 6, 4, 6, 9,13,16,10, 6,10, 7, + 7, 6, 7, 9,13,15,12, 9,11, 9, 8, 6, 7,10,12,14, + 14,11,10, 9, 6, 5, 6, 9,11,13,15,13,11,10, 6, 5, + 6, 8, 9,11, +}; + +static static_codebook _huff_book__44c3_s_short = { + 2, 100, + _huff_lengthlist__44c3_s_short, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist__44c4_s_long[] = { + 4, 7,11,11,11,11,10,11,12,11, 5, 2,11, 5, 6, 6, + 7, 9,11,12,11, 9, 6,10, 6, 7, 8, 9,10,11,11, 5, + 11, 7, 8, 8, 9,11,13,14,11, 6, 5, 8, 4, 5, 7, 8, + 10,11,10, 6, 7, 7, 5, 5, 6, 8, 9,11,10, 7, 8, 9, + 6, 6, 6, 7, 8, 9,11, 9, 9,11, 7, 7, 6, 6, 7, 9, + 12,12,10,13, 9, 8, 7, 7, 7, 8,11,13,11,14,11,10, + 9, 8, 7, 7, +}; + +static static_codebook _huff_book__44c4_s_long = { + 2, 100, + _huff_lengthlist__44c4_s_long, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _vq_quantlist__44c4_s_p1_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__44c4_s_p1_0[] = { + 2, 4, 4, 0, 0, 0, 0, 0, 0, 5, 6, 6, 0, 0, 0, 0, + 0, 0, 5, 6, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 5, 7, 7, 0, 0, 0, 0, 0, 0, 7, 8, 8, 0, 0, 0, + 0, 0, 0, 6, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 5, 7, 7, 0, 0, 0, 0, 0, 0, 6, 8, 7, 0, 0, + 0, 0, 0, 0, 7, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, 0, 0, 0, + 0, 0, 7, 8, 8, 0, 0, 0, 0, 0, 0, 7, 8, 8, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 8, 8, 0, 0, 0, + 0, 0, 0, 8, 9, 9, 0, 0, 0, 0, 0, 0, 8, 9, 9, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 8, 8, 0, 0, + 0, 0, 0, 0, 8, 9, 8, 0, 0, 0, 0, 0, 0, 8, 9, 9, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 4, 7, 7, 0, 0, 0, 0, 0, 0, 7, 8, 8, 0, 0, + 0, 0, 0, 0, 7, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 6, 8, 8, 0, 0, 0, 0, 0, 0, 8, 9, 9, 0, + 0, 0, 0, 0, 0, 8, 8, 9, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 7, 8, 8, 0, 0, 0, 0, 0, 0, 8, 9, 9, + 0, 0, 0, 0, 0, 0, 8, 9, 9, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + +static float _vq_quantthresh__44c4_s_p1_0[] = { + -0.5, 0.5, +}; + +static long _vq_quantmap__44c4_s_p1_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__44c4_s_p1_0 = { + _vq_quantthresh__44c4_s_p1_0, + _vq_quantmap__44c4_s_p1_0, + 3, + 3 +}; + +static static_codebook _44c4_s_p1_0 = { + 8, 6561, + _vq_lengthlist__44c4_s_p1_0, + 1, -535822336, 1611661312, 2, 0, + _vq_quantlist__44c4_s_p1_0, + NULL, + &_vq_auxt__44c4_s_p1_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c4_s_p2_0[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44c4_s_p2_0[] = { + 2, 5, 5, 0, 0, 0, 5, 5, 0, 0, 0, 5, 5, 0, 0, 0, + 7, 7, 0, 0, 0, 0, 0, 0, 0, 5, 6, 6, 0, 0, 0, 7, + 7, 0, 0, 0, 7, 7, 0, 0, 0,10,10, 0, 0, 0, 0, 0, + 0, 0, 5, 6, 6, 0, 0, 0, 7, 7, 0, 0, 0, 7, 7, 0, + 0, 0,10,10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 5, 8, 7, 0, 0, 0, 7, 7, 0, 0, + 0, 7, 7, 0, 0, 0, 9, 9, 0, 0, 0, 0, 0, 0, 0, 5, + 7, 8, 0, 0, 0, 7, 7, 0, 0, 0, 7, 7, 0, 0, 0, 9, + 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 5, 7, 7, 0, 0, 0, 7, 7, 0, 0, 0, 7, 7, + 0, 0, 0, 9, 9, 0, 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, + 0, 0, 7, 7, 0, 0, 0, 7, 7, 0, 0, 0, 9, 9, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 7,10,10, 0, 0, 0, 9, 9, 0, 0, 0, 9, 9, 0, 0, 0, + 10,10, 0, 0, 0, 0, 0, 0, 0, 8,10,10, 0, 0, 0, 9, + 9, 0, 0, 0, 9, 9, 0, 0, 0,10,10, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + +static float _vq_quantthresh__44c4_s_p2_0[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__44c4_s_p2_0[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44c4_s_p2_0 = { + _vq_quantthresh__44c4_s_p2_0, + _vq_quantmap__44c4_s_p2_0, + 5, + 5 +}; + +static static_codebook _44c4_s_p2_0 = { + 4, 625, + _vq_lengthlist__44c4_s_p2_0, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__44c4_s_p2_0, + NULL, + &_vq_auxt__44c4_s_p2_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c4_s_p3_0[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44c4_s_p3_0[] = { + 2, 3, 3, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 5, 4, 6, 6, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 4, 4, 5, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6, 9, 9, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 6, 6, 7, 9, 9, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + +static float _vq_quantthresh__44c4_s_p3_0[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__44c4_s_p3_0[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44c4_s_p3_0 = { + _vq_quantthresh__44c4_s_p3_0, + _vq_quantmap__44c4_s_p3_0, + 5, + 5 +}; + +static static_codebook _44c4_s_p3_0 = { + 4, 625, + _vq_lengthlist__44c4_s_p3_0, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__44c4_s_p3_0, + NULL, + &_vq_auxt__44c4_s_p3_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c4_s_p4_0[] = { + 4, + 3, + 5, + 2, + 6, + 1, + 7, + 0, + 8, +}; + +static long _vq_lengthlist__44c4_s_p4_0[] = { + 2, 3, 3, 6, 6, 0, 0, 0, 0, 0, 4, 4, 6, 6, 0, 0, + 0, 0, 0, 4, 4, 6, 6, 0, 0, 0, 0, 0, 5, 5, 6, 6, + 0, 0, 0, 0, 0, 0, 0, 6, 6, 0, 0, 0, 0, 0, 0, 0, + 7, 8, 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, + 0, 0, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + +static float _vq_quantthresh__44c4_s_p4_0[] = { + -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, +}; + +static long _vq_quantmap__44c4_s_p4_0[] = { + 7, 5, 3, 1, 0, 2, 4, 6, + 8, +}; + +static encode_aux_threshmatch _vq_auxt__44c4_s_p4_0 = { + _vq_quantthresh__44c4_s_p4_0, + _vq_quantmap__44c4_s_p4_0, + 9, + 9 +}; + +static static_codebook _44c4_s_p4_0 = { + 2, 81, + _vq_lengthlist__44c4_s_p4_0, + 1, -531628032, 1611661312, 4, 0, + _vq_quantlist__44c4_s_p4_0, + NULL, + &_vq_auxt__44c4_s_p4_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c4_s_p5_0[] = { + 4, + 3, + 5, + 2, + 6, + 1, + 7, + 0, + 8, +}; + +static long _vq_lengthlist__44c4_s_p5_0[] = { + 2, 3, 3, 6, 6, 7, 7, 9, 9, 0, 4, 4, 6, 6, 7, 7, + 9, 9, 0, 4, 5, 6, 6, 7, 7, 9, 9, 0, 6, 6, 7, 7, + 8, 8,10,10, 0, 0, 0, 7, 7, 8, 8,10, 9, 0, 0, 0, + 9, 8, 8, 8,10,10, 0, 0, 0, 8, 8, 8, 8,10,10, 0, + 0, 0,10,10, 9, 9,11,11, 0, 0, 0, 0, 0, 9, 9,10, + 10, +}; + +static float _vq_quantthresh__44c4_s_p5_0[] = { + -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, +}; + +static long _vq_quantmap__44c4_s_p5_0[] = { + 7, 5, 3, 1, 0, 2, 4, 6, + 8, +}; + +static encode_aux_threshmatch _vq_auxt__44c4_s_p5_0 = { + _vq_quantthresh__44c4_s_p5_0, + _vq_quantmap__44c4_s_p5_0, + 9, + 9 +}; + +static static_codebook _44c4_s_p5_0 = { + 2, 81, + _vq_lengthlist__44c4_s_p5_0, + 1, -531628032, 1611661312, 4, 0, + _vq_quantlist__44c4_s_p5_0, + NULL, + &_vq_auxt__44c4_s_p5_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c4_s_p6_0[] = { + 8, + 7, + 9, + 6, + 10, + 5, + 11, + 4, + 12, + 3, + 13, + 2, + 14, + 1, + 15, + 0, + 16, +}; + +static long _vq_lengthlist__44c4_s_p6_0[] = { + 2, 4, 4, 6, 6, 8, 8, 9, 9, 8, 8, 9, 9,10,10,11, + 11, 0, 4, 4, 6, 6, 8, 8, 9, 9, 9, 9,10,10,11,11, + 11,11, 0, 4, 4, 7, 6, 8, 8, 9, 9, 9, 9,10,10,11, + 11,11,11, 0, 6, 6, 7, 7, 8, 8, 9, 9, 9, 9,10,10, + 11,11,11,12, 0, 0, 0, 7, 7, 8, 8, 9, 9, 9, 9,10, + 10,11,11,12,12, 0, 0, 0, 8, 8, 8, 8, 9, 9, 9, 9, + 10,10,11,11,12,12, 0, 0, 0, 8, 8, 8, 8, 9, 9, 9, + 9,10,10,11,11,12,12, 0, 0, 0, 9, 9, 9, 9,10,10, + 10,10,11,11,11,11,12,12, 0, 0, 0, 0, 0, 9, 9,10, + 10,10,10,11,11,11,11,12,12, 0, 0, 0, 0, 0, 9, 9, + 9,10,10,10,11,11,11,11,12,12, 0, 0, 0, 0, 0, 9, + 9, 9, 9,10,10,11,11,11,12,12,12, 0, 0, 0, 0, 0, + 10,10,10,10,11,11,11,11,12,12,13,12, 0, 0, 0, 0, + 0, 0, 0,10,10,11,11,11,11,12,12,12,12, 0, 0, 0, + 0, 0, 0, 0,11,11,11,11,12,12,12,12,13,13, 0, 0, + 0, 0, 0, 0, 0,11,11,11,11,12,12,12,12,13,13, 0, + 0, 0, 0, 0, 0, 0,12,12,12,12,12,12,13,13,13,13, + 0, 0, 0, 0, 0, 0, 0, 0, 0,12,12,12,12,12,13,13, + 13, +}; + +static float _vq_quantthresh__44c4_s_p6_0[] = { + -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, + 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, +}; + +static long _vq_quantmap__44c4_s_p6_0[] = { + 15, 13, 11, 9, 7, 5, 3, 1, + 0, 2, 4, 6, 8, 10, 12, 14, + 16, +}; + +static encode_aux_threshmatch _vq_auxt__44c4_s_p6_0 = { + _vq_quantthresh__44c4_s_p6_0, + _vq_quantmap__44c4_s_p6_0, + 17, + 17 +}; + +static static_codebook _44c4_s_p6_0 = { + 2, 289, + _vq_lengthlist__44c4_s_p6_0, + 1, -529530880, 1611661312, 5, 0, + _vq_quantlist__44c4_s_p6_0, + NULL, + &_vq_auxt__44c4_s_p6_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c4_s_p7_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__44c4_s_p7_0[] = { + 1, 4, 4, 7, 6, 6, 7, 6, 6, 4, 7, 7,10, 9, 9,11, + 9, 9, 4, 7, 7,10, 9, 9,11, 9, 9, 7,10,10,11,11, + 10,11,11,11, 6, 9, 9,11,10,10,11,10,10, 6, 9, 9, + 11,10,10,11,10,10, 7,11,11,12,11,11,12,11,11, 6, + 9, 9,11,10,10,11,10,10, 6, 9, 9,11,10,10,11,10, + 10, +}; + +static float _vq_quantthresh__44c4_s_p7_0[] = { + -5.5, 5.5, +}; + +static long _vq_quantmap__44c4_s_p7_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__44c4_s_p7_0 = { + _vq_quantthresh__44c4_s_p7_0, + _vq_quantmap__44c4_s_p7_0, + 3, + 3 +}; + +static static_codebook _44c4_s_p7_0 = { + 4, 81, + _vq_lengthlist__44c4_s_p7_0, + 1, -529137664, 1618345984, 2, 0, + _vq_quantlist__44c4_s_p7_0, + NULL, + &_vq_auxt__44c4_s_p7_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c4_s_p7_1[] = { + 5, + 4, + 6, + 3, + 7, + 2, + 8, + 1, + 9, + 0, + 10, +}; + +static long _vq_lengthlist__44c4_s_p7_1[] = { + 2, 4, 4, 6, 6, 7, 7, 7, 7, 8, 8,10, 5, 5, 6, 6, + 7, 7, 8, 8, 8, 8,10, 5, 5, 6, 6, 7, 7, 8, 8, 8, + 8,10, 6, 6, 7, 7, 8, 8, 8, 8, 8, 8,10,10,10, 7, + 7, 8, 8, 8, 8, 8, 8,10,10,10, 8, 7, 8, 8, 8, 8, + 8, 8,10,10,10, 7, 7, 8, 8, 8, 8, 8, 8,10,10,10, + 8, 8, 8, 8, 8, 8, 8, 8,10,10,10,10,10, 8, 8, 8, + 8, 8, 8,10,10,10,10,10, 9, 9, 8, 8, 9, 8,10,10, + 10,10,10, 8, 8, 8, 8, 9, 9, +}; + +static float _vq_quantthresh__44c4_s_p7_1[] = { + -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, + 3.5, 4.5, +}; + +static long _vq_quantmap__44c4_s_p7_1[] = { + 9, 7, 5, 3, 1, 0, 2, 4, + 6, 8, 10, +}; + +static encode_aux_threshmatch _vq_auxt__44c4_s_p7_1 = { + _vq_quantthresh__44c4_s_p7_1, + _vq_quantmap__44c4_s_p7_1, + 11, + 11 +}; + +static static_codebook _44c4_s_p7_1 = { + 2, 121, + _vq_lengthlist__44c4_s_p7_1, + 1, -531365888, 1611661312, 4, 0, + _vq_quantlist__44c4_s_p7_1, + NULL, + &_vq_auxt__44c4_s_p7_1, + NULL, + 0 +}; + +static long _vq_quantlist__44c4_s_p8_0[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__44c4_s_p8_0[] = { + 1, 4, 4, 6, 6, 7, 7, 8, 8, 9, 9,10,10, 6, 5, 5, + 7, 7, 8, 8, 8, 8, 9,10,11,11, 7, 5, 5, 7, 7, 8, + 8, 9, 9,10,10,11,11, 0, 8, 8, 8, 8, 9, 9, 9, 9, + 10,10,11,11, 0, 8, 8, 8, 8, 9, 9, 9, 9,10,10,11, + 11, 0,12,12, 9, 9, 9, 9,10,10,10,10,11,11, 0,13, + 13, 9, 9,10, 9,10,10,11,11,11,12, 0, 0, 0,10,10, + 10,10,10,10,11,11,12,12, 0, 0, 0,10,10,10,10,10, + 10,11,11,12,12, 0, 0, 0,14,14,11,11,11,11,12,12, + 12,12, 0, 0, 0,14,14,11,11,11,11,12,12,12,13, 0, + 0, 0, 0, 0,12,12,12,12,12,12,13,13, 0, 0, 0, 0, + 0,13,12,12,12,12,12,13,13, +}; + +static float _vq_quantthresh__44c4_s_p8_0[] = { + -27.5, -22.5, -17.5, -12.5, -7.5, -2.5, 2.5, 7.5, + 12.5, 17.5, 22.5, 27.5, +}; + +static long _vq_quantmap__44c4_s_p8_0[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__44c4_s_p8_0 = { + _vq_quantthresh__44c4_s_p8_0, + _vq_quantmap__44c4_s_p8_0, + 13, + 13 +}; + +static static_codebook _44c4_s_p8_0 = { + 2, 169, + _vq_lengthlist__44c4_s_p8_0, + 1, -526516224, 1616117760, 4, 0, + _vq_quantlist__44c4_s_p8_0, + NULL, + &_vq_auxt__44c4_s_p8_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c4_s_p8_1[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44c4_s_p8_1[] = { + 2, 4, 4, 5, 5, 6, 5, 5, 5, 5, 6, 5, 4, 5, 5, 6, + 5, 5, 5, 5, 6, 6, 6, 5, 5, +}; + +static float _vq_quantthresh__44c4_s_p8_1[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__44c4_s_p8_1[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44c4_s_p8_1 = { + _vq_quantthresh__44c4_s_p8_1, + _vq_quantmap__44c4_s_p8_1, + 5, + 5 +}; + +static static_codebook _44c4_s_p8_1 = { + 2, 25, + _vq_lengthlist__44c4_s_p8_1, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__44c4_s_p8_1, + NULL, + &_vq_auxt__44c4_s_p8_1, + NULL, + 0 +}; + +static long _vq_quantlist__44c4_s_p9_0[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__44c4_s_p9_0[] = { + 1, 3, 3,12,12,12,12,12,12,12,12,12,12, 4, 7, 7, + 12,12,12,12,12,12,12,12,12,12, 3, 8, 8,12,12,12, + 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, + 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, + 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, + 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, + 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, + 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, + 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, + 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, + 12,12,12,12,12,12,12,12,12, +}; + +static float _vq_quantthresh__44c4_s_p9_0[] = { + -1732.5, -1417.5, -1102.5, -787.5, -472.5, -157.5, 157.5, 472.5, + 787.5, 1102.5, 1417.5, 1732.5, +}; + +static long _vq_quantmap__44c4_s_p9_0[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__44c4_s_p9_0 = { + _vq_quantthresh__44c4_s_p9_0, + _vq_quantmap__44c4_s_p9_0, + 13, + 13 +}; + +static static_codebook _44c4_s_p9_0 = { + 2, 169, + _vq_lengthlist__44c4_s_p9_0, + 1, -513964032, 1628680192, 4, 0, + _vq_quantlist__44c4_s_p9_0, + NULL, + &_vq_auxt__44c4_s_p9_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c4_s_p9_1[] = { + 7, + 6, + 8, + 5, + 9, + 4, + 10, + 3, + 11, + 2, + 12, + 1, + 13, + 0, + 14, +}; + +static long _vq_lengthlist__44c4_s_p9_1[] = { + 1, 4, 4, 5, 5, 7, 7, 9, 8,10, 9,10,10,10,10, 6, + 5, 5, 7, 7, 9, 8,10, 9,11,10,12,12,13,13, 6, 5, + 5, 7, 7, 9, 9,10,10,11,11,12,12,12,13,19, 8, 8, + 8, 8, 9, 9,10,10,12,11,12,12,13,13,19, 8, 8, 8, + 8, 9, 9,11,11,12,12,13,13,13,13,19,12,12, 9, 9, + 11,11,11,11,12,11,13,12,13,13,18,12,12, 9, 9,11, + 10,11,11,12,12,12,13,13,14,19,18,18,11,11,11,11, + 12,12,13,12,13,13,14,14,16,18,18,11,11,11,10,12, + 11,13,13,13,13,13,14,17,18,18,14,15,11,12,12,13, + 13,13,13,14,14,14,18,18,18,15,15,12,10,13,10,13, + 13,13,13,13,14,18,17,18,17,18,12,13,12,13,13,13, + 14,14,16,14,18,17,18,18,17,13,12,13,10,12,12,14, + 14,14,14,17,18,18,18,18,14,15,12,12,13,12,14,14, + 15,15,18,18,18,17,18,15,14,12,11,12,12,14,14,14, + 15, +}; + +static float _vq_quantthresh__44c4_s_p9_1[] = { + -136.5, -115.5, -94.5, -73.5, -52.5, -31.5, -10.5, 10.5, + 31.5, 52.5, 73.5, 94.5, 115.5, 136.5, +}; + +static long _vq_quantmap__44c4_s_p9_1[] = { + 13, 11, 9, 7, 5, 3, 1, 0, + 2, 4, 6, 8, 10, 12, 14, +}; + +static encode_aux_threshmatch _vq_auxt__44c4_s_p9_1 = { + _vq_quantthresh__44c4_s_p9_1, + _vq_quantmap__44c4_s_p9_1, + 15, + 15 +}; + +static static_codebook _44c4_s_p9_1 = { + 2, 225, + _vq_lengthlist__44c4_s_p9_1, + 1, -520986624, 1620377600, 4, 0, + _vq_quantlist__44c4_s_p9_1, + NULL, + &_vq_auxt__44c4_s_p9_1, + NULL, + 0 +}; + +static long _vq_quantlist__44c4_s_p9_2[] = { + 10, + 9, + 11, + 8, + 12, + 7, + 13, + 6, + 14, + 5, + 15, + 4, + 16, + 3, + 17, + 2, + 18, + 1, + 19, + 0, + 20, +}; + +static long _vq_lengthlist__44c4_s_p9_2[] = { + 2, 5, 5, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, + 8, 9, 9, 9, 9,11, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9, + 9, 9, 9, 9, 9, 9,10,10,10,10,11, 6, 6, 7, 7, 8, + 8, 8, 8, 9, 9, 9, 9, 9, 9,10, 9,10,10,10,10,11, + 7, 7, 7, 7, 8, 8, 9, 9, 9, 9, 9, 9, 9,10,10,10, + 10,10,10,10,12,11,11, 7, 7, 8, 8, 9, 9, 9, 9, 9, + 9,10,10,10,10,10,10,10,10,12,11,12, 8, 8, 8, 8, + 9, 9, 9, 9, 9,10,10,10,10,10,10,10,10,10,11,11, + 11, 8, 8, 8, 8, 9, 9, 9, 9,10,10,10,10,10,10,10, + 10,10,10,11,11,12, 9, 9, 9, 9, 9, 9,10, 9,10,10, + 10,10,10,10,10,10,10,10,11,11,11,11,11, 9, 9, 9, + 9,10,10,10,10,10,10,10,10,10,10,10,10,11,12,11, + 11,11, 9, 9, 9,10,10,10,10,10,10,10,10,10,10,10, + 10,10,11,11,11,11,11, 9, 9, 9, 9,10,10,10,10,10, + 10,10,10,10,10,10,10,11,11,11,12,12,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,11,12,11,12, + 11,11,11, 9,10,10,10,10,10,10,10,10,10,10,10,10, + 10,11,12,11,11,11,11,11,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,11,11,11,12,11,11,11,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,12,11,11,12,11, + 11,11,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 11,11,11,11,11,11,11,11,11,10,10,10,10,10,10,10, + 10,10,10,10,10,11,11,11,11,12,12,11,11,11,11,11, + 11,11,10,10,10,10,10,10,10,10,12,12,12,11,11,11, + 12,11,11,11,10,10,10,10,10,10,10,10,10,10,10,12, + 11,12,12,12,12,12,11,12,11,11,10,10,10,10,10,10, + 10,10,10,10,12,12,12,12,11,11,11,11,11,11,11,10, + 10,10,10,10,10,10,10,10,10, +}; + +static float _vq_quantthresh__44c4_s_p9_2[] = { + -9.5, -8.5, -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, + -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, + 6.5, 7.5, 8.5, 9.5, +}; + +static long _vq_quantmap__44c4_s_p9_2[] = { + 19, 17, 15, 13, 11, 9, 7, 5, + 3, 1, 0, 2, 4, 6, 8, 10, + 12, 14, 16, 18, 20, +}; + +static encode_aux_threshmatch _vq_auxt__44c4_s_p9_2 = { + _vq_quantthresh__44c4_s_p9_2, + _vq_quantmap__44c4_s_p9_2, + 21, + 21 +}; + +static static_codebook _44c4_s_p9_2 = { + 2, 441, + _vq_lengthlist__44c4_s_p9_2, + 1, -529268736, 1611661312, 5, 0, + _vq_quantlist__44c4_s_p9_2, + NULL, + &_vq_auxt__44c4_s_p9_2, + NULL, + 0 +}; + +static long _huff_lengthlist__44c4_s_short[] = { + 4, 7,14,10,15,10,12,15,16,15, 4, 2,11, 5,10, 6, + 8,11,14,14,14,10, 7,11, 6, 8,10,11,13,15, 9, 4, + 11, 5, 9, 6, 9,12,14,15,14, 9, 6, 9, 4, 5, 7,10, + 12,13, 9, 5, 7, 6, 5, 5, 7,10,13,13,10, 8, 9, 8, + 7, 6, 8,10,14,14,13,11,10,10, 7, 7, 8,11,14,15, + 13,12, 9, 9, 6, 5, 7,10,14,17,15,13,11,10, 6, 6, + 7, 9,12,17, +}; + +static static_codebook _huff_book__44c4_s_short = { + 2, 100, + _huff_lengthlist__44c4_s_short, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist__44c5_s_long[] = { + 3, 8, 9,13,10,12,12,12,12,12, 6, 4, 6, 8, 6, 8, + 10,10,11,12, 8, 5, 4,10, 4, 7, 8, 9,10,11,13, 8, + 10, 8, 9, 9,11,12,13,14,10, 6, 4, 9, 3, 5, 6, 8, + 10,11,11, 8, 6, 9, 5, 5, 6, 7, 9,11,12, 9, 7,11, + 6, 6, 6, 7, 8,10,12,11, 9,12, 7, 7, 6, 6, 7, 9, + 13,12,10,13, 9, 8, 7, 7, 7, 8,11,15,11,15,11,10, + 9, 8, 7, 7, +}; + +static static_codebook _huff_book__44c5_s_long = { + 2, 100, + _huff_lengthlist__44c5_s_long, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _vq_quantlist__44c5_s_p1_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__44c5_s_p1_0[] = { + 2, 4, 4, 0, 0, 0, 0, 0, 0, 4, 7, 7, 0, 0, 0, 0, + 0, 0, 4, 6, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 5, 7, 7, 0, 0, 0, 0, 0, 0, 7, 9, 9, 0, 0, 0, + 0, 0, 0, 7, 8, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 4, 7, 7, 0, 0, 0, 0, 0, 0, 7, 9, 8, 0, 0, + 0, 0, 0, 0, 7, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 7, 7, 0, 0, 0, 0, + 0, 0, 7, 9, 9, 0, 0, 0, 0, 0, 0, 7, 9, 9, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 9, 9, 0, 0, 0, + 0, 0, 0, 9,10,11, 0, 0, 0, 0, 0, 0, 9,10,10, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 9, 9, 0, 0, + 0, 0, 0, 0, 8,10, 9, 0, 0, 0, 0, 0, 0, 9,10,11, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 4, 7, 7, 0, 0, 0, 0, 0, 0, 7, 9, 9, 0, 0, + 0, 0, 0, 0, 7, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 7, 9, 9, 0, 0, 0, 0, 0, 0, 9,11,10, 0, + 0, 0, 0, 0, 0, 8, 9,10, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 7, 9, 9, 0, 0, 0, 0, 0, 0, 9,10,10, + 0, 0, 0, 0, 0, 0, 9,11,10, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + +static float _vq_quantthresh__44c5_s_p1_0[] = { + -0.5, 0.5, +}; + +static long _vq_quantmap__44c5_s_p1_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__44c5_s_p1_0 = { + _vq_quantthresh__44c5_s_p1_0, + _vq_quantmap__44c5_s_p1_0, + 3, + 3 +}; + +static static_codebook _44c5_s_p1_0 = { + 8, 6561, + _vq_lengthlist__44c5_s_p1_0, + 1, -535822336, 1611661312, 2, 0, + _vq_quantlist__44c5_s_p1_0, + NULL, + &_vq_auxt__44c5_s_p1_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c5_s_p2_0[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44c5_s_p2_0[] = { + 2, 4, 4, 0, 0, 0, 5, 5, 0, 0, 0, 5, 5, 0, 0, 0, + 8, 7, 0, 0, 0, 0, 0, 0, 0, 4, 6, 6, 0, 0, 0, 8, + 8, 0, 0, 0, 8, 7, 0, 0, 0,10,10, 0, 0, 0, 0, 0, + 0, 0, 4, 6, 6, 0, 0, 0, 8, 8, 0, 0, 0, 7, 8, 0, + 0, 0,10,10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 5, 8, 7, 0, 0, 0, 8, 8, 0, 0, + 0, 8, 8, 0, 0, 0,10,10, 0, 0, 0, 0, 0, 0, 0, 5, + 7, 8, 0, 0, 0, 8, 8, 0, 0, 0, 8, 8, 0, 0, 0,10, + 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 5, 8, 8, 0, 0, 0, 8, 8, 0, 0, 0, 8, 8, + 0, 0, 0,10,10, 0, 0, 0, 0, 0, 0, 0, 5, 8, 8, 0, + 0, 0, 8, 8, 0, 0, 0, 8, 8, 0, 0, 0,10,10, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 8,10,10, 0, 0, 0,10,10, 0, 0, 0, 9,10, 0, 0, 0, + 11,10, 0, 0, 0, 0, 0, 0, 0, 8,10,10, 0, 0, 0,10, + 10, 0, 0, 0,10,10, 0, 0, 0,10,11, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + +static float _vq_quantthresh__44c5_s_p2_0[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__44c5_s_p2_0[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44c5_s_p2_0 = { + _vq_quantthresh__44c5_s_p2_0, + _vq_quantmap__44c5_s_p2_0, + 5, + 5 +}; + +static static_codebook _44c5_s_p2_0 = { + 4, 625, + _vq_lengthlist__44c5_s_p2_0, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__44c5_s_p2_0, + NULL, + &_vq_auxt__44c5_s_p2_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c5_s_p3_0[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44c5_s_p3_0[] = { + 2, 4, 3, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 5, 5, 6, 6, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 3, 5, 5, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6, 8, 8, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 5, 6, 6, 8, 8, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + +static float _vq_quantthresh__44c5_s_p3_0[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__44c5_s_p3_0[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44c5_s_p3_0 = { + _vq_quantthresh__44c5_s_p3_0, + _vq_quantmap__44c5_s_p3_0, + 5, + 5 +}; + +static static_codebook _44c5_s_p3_0 = { + 4, 625, + _vq_lengthlist__44c5_s_p3_0, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__44c5_s_p3_0, + NULL, + &_vq_auxt__44c5_s_p3_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c5_s_p4_0[] = { + 4, + 3, + 5, + 2, + 6, + 1, + 7, + 0, + 8, +}; + +static long _vq_lengthlist__44c5_s_p4_0[] = { + 2, 3, 3, 6, 6, 0, 0, 0, 0, 0, 4, 4, 6, 6, 0, 0, + 0, 0, 0, 4, 4, 6, 6, 0, 0, 0, 0, 0, 5, 5, 6, 6, + 0, 0, 0, 0, 0, 0, 0, 6, 6, 0, 0, 0, 0, 0, 0, 0, + 7, 7, 0, 0, 0, 0, 0, 0, 0, 8, 7, 0, 0, 0, 0, 0, + 0, 0, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + +static float _vq_quantthresh__44c5_s_p4_0[] = { + -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, +}; + +static long _vq_quantmap__44c5_s_p4_0[] = { + 7, 5, 3, 1, 0, 2, 4, 6, + 8, +}; + +static encode_aux_threshmatch _vq_auxt__44c5_s_p4_0 = { + _vq_quantthresh__44c5_s_p4_0, + _vq_quantmap__44c5_s_p4_0, + 9, + 9 +}; + +static static_codebook _44c5_s_p4_0 = { + 2, 81, + _vq_lengthlist__44c5_s_p4_0, + 1, -531628032, 1611661312, 4, 0, + _vq_quantlist__44c5_s_p4_0, + NULL, + &_vq_auxt__44c5_s_p4_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c5_s_p5_0[] = { + 4, + 3, + 5, + 2, + 6, + 1, + 7, + 0, + 8, +}; + +static long _vq_lengthlist__44c5_s_p5_0[] = { + 2, 4, 3, 6, 6, 7, 7, 9, 9, 0, 4, 4, 6, 6, 7, 7, + 9, 9, 0, 4, 4, 6, 6, 7, 7, 9, 9, 0, 6, 6, 7, 7, + 7, 7, 9, 9, 0, 0, 0, 7, 6, 7, 7, 9, 9, 0, 0, 0, + 8, 8, 8, 8,10,10, 0, 0, 0, 8, 8, 8, 8,10,10, 0, + 0, 0, 9, 9, 9, 9,10,10, 0, 0, 0, 0, 0, 9, 9,10, + 10, +}; + +static float _vq_quantthresh__44c5_s_p5_0[] = { + -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, +}; + +static long _vq_quantmap__44c5_s_p5_0[] = { + 7, 5, 3, 1, 0, 2, 4, 6, + 8, +}; + +static encode_aux_threshmatch _vq_auxt__44c5_s_p5_0 = { + _vq_quantthresh__44c5_s_p5_0, + _vq_quantmap__44c5_s_p5_0, + 9, + 9 +}; + +static static_codebook _44c5_s_p5_0 = { + 2, 81, + _vq_lengthlist__44c5_s_p5_0, + 1, -531628032, 1611661312, 4, 0, + _vq_quantlist__44c5_s_p5_0, + NULL, + &_vq_auxt__44c5_s_p5_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c5_s_p6_0[] = { + 8, + 7, + 9, + 6, + 10, + 5, + 11, + 4, + 12, + 3, + 13, + 2, + 14, + 1, + 15, + 0, + 16, +}; + +static long _vq_lengthlist__44c5_s_p6_0[] = { + 2, 4, 4, 6, 6, 8, 8, 9, 9, 9, 9,10,10,10,10,11, + 11, 0, 4, 4, 6, 6, 8, 8, 9, 9, 9, 9,10,10,11,11, + 12,12, 0, 4, 4, 6, 6, 8, 8, 9, 9, 9, 9,10,10,11, + 11,12,12, 0, 6, 6, 7, 7, 8, 8, 9, 9, 9, 9,10,10, + 11,11,12,12, 0, 0, 0, 7, 7, 8, 8, 9, 9, 9, 9,10, + 10,11,11,12,12, 0, 0, 0, 7, 7, 9, 9,10,10,10,10, + 11,11,11,11,12,12, 0, 0, 0, 7, 7, 8, 9,10,10,10, + 10,11,11,11,11,12,12, 0, 0, 0, 8, 8, 9, 9,10,10, + 10,10,11,11,12,12,12,12, 0, 0, 0, 0, 0, 9, 9,10, + 10,10,10,11,11,12,12,12,12, 0, 0, 0, 0, 0, 9, 9, + 10,10,10,10,11,11,12,12,12,12, 0, 0, 0, 0, 0, 9, + 9, 9,10,10,10,11,11,12,12,12,12, 0, 0, 0, 0, 0, + 10,10,10,10,11,11,11,12,12,12,13,13, 0, 0, 0, 0, + 0, 0, 0,10,10,11,11,11,11,12,12,13,13, 0, 0, 0, + 0, 0, 0, 0,11,11,11,11,12,12,12,13,13,13, 0, 0, + 0, 0, 0, 0, 0,11,11,11,11,12,12,12,12,13,13, 0, + 0, 0, 0, 0, 0, 0,12,12,12,12,13,12,13,13,13,13, + 0, 0, 0, 0, 0, 0, 0, 0, 0,12,12,12,12,13,13,13, + 13, +}; + +static float _vq_quantthresh__44c5_s_p6_0[] = { + -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, + 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, +}; + +static long _vq_quantmap__44c5_s_p6_0[] = { + 15, 13, 11, 9, 7, 5, 3, 1, + 0, 2, 4, 6, 8, 10, 12, 14, + 16, +}; + +static encode_aux_threshmatch _vq_auxt__44c5_s_p6_0 = { + _vq_quantthresh__44c5_s_p6_0, + _vq_quantmap__44c5_s_p6_0, + 17, + 17 +}; + +static static_codebook _44c5_s_p6_0 = { + 2, 289, + _vq_lengthlist__44c5_s_p6_0, + 1, -529530880, 1611661312, 5, 0, + _vq_quantlist__44c5_s_p6_0, + NULL, + &_vq_auxt__44c5_s_p6_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c5_s_p7_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__44c5_s_p7_0[] = { + 1, 4, 4, 7, 6, 6, 7, 6, 6, 4, 7, 7,10, 9, 9,11, + 9, 9, 4, 7, 7,10, 9, 9,11, 9, 9, 7,10,10,11,11, + 10,11,11,11, 6, 9, 9,11,10,10,11,10,10, 6, 9, 9, + 11,10,10,11,10,10, 7,11,11,12,11,11,12,11,11, 6, + 9, 9,11,10,10,11,10,10, 6, 9, 9,11,10,10,11,10, + 10, +}; + +static float _vq_quantthresh__44c5_s_p7_0[] = { + -5.5, 5.5, +}; + +static long _vq_quantmap__44c5_s_p7_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__44c5_s_p7_0 = { + _vq_quantthresh__44c5_s_p7_0, + _vq_quantmap__44c5_s_p7_0, + 3, + 3 +}; + +static static_codebook _44c5_s_p7_0 = { + 4, 81, + _vq_lengthlist__44c5_s_p7_0, + 1, -529137664, 1618345984, 2, 0, + _vq_quantlist__44c5_s_p7_0, + NULL, + &_vq_auxt__44c5_s_p7_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c5_s_p7_1[] = { + 5, + 4, + 6, + 3, + 7, + 2, + 8, + 1, + 9, + 0, + 10, +}; + +static long _vq_lengthlist__44c5_s_p7_1[] = { + 2, 4, 4, 6, 6, 7, 7, 8, 8, 8, 8,10, 5, 5, 6, 6, + 7, 7, 8, 8, 8, 8,10, 5, 5, 6, 6, 7, 7, 8, 8, 8, + 8,10, 6, 6, 7, 7, 8, 8, 8, 8, 8, 8,10,10,10, 7, + 7, 8, 8, 8, 8, 8, 8,10,10,10, 7, 7, 8, 8, 8, 8, + 8, 8,10,10,10, 7, 7, 8, 8, 8, 8, 8, 8,10,10,10, + 8, 8, 8, 8, 8, 8, 8, 9,10,10,10,10,10, 8, 8, 8, + 8, 8, 8,10,10,10,10,10, 9, 9, 8, 8, 8, 8,10,10, + 10,10,10, 8, 8, 8, 8, 8, 8, +}; + +static float _vq_quantthresh__44c5_s_p7_1[] = { + -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, + 3.5, 4.5, +}; + +static long _vq_quantmap__44c5_s_p7_1[] = { + 9, 7, 5, 3, 1, 0, 2, 4, + 6, 8, 10, +}; + +static encode_aux_threshmatch _vq_auxt__44c5_s_p7_1 = { + _vq_quantthresh__44c5_s_p7_1, + _vq_quantmap__44c5_s_p7_1, + 11, + 11 +}; + +static static_codebook _44c5_s_p7_1 = { + 2, 121, + _vq_lengthlist__44c5_s_p7_1, + 1, -531365888, 1611661312, 4, 0, + _vq_quantlist__44c5_s_p7_1, + NULL, + &_vq_auxt__44c5_s_p7_1, + NULL, + 0 +}; + +static long _vq_quantlist__44c5_s_p8_0[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__44c5_s_p8_0[] = { + 1, 4, 4, 6, 6, 7, 7, 8, 8, 9, 9,10,10, 6, 5, 5, + 7, 7, 8, 8, 8, 9,10,10,10,10, 7, 5, 5, 7, 7, 8, + 8, 9, 9,10,10,10,10, 0, 8, 8, 8, 8, 9, 9, 9, 9, + 10,10,11,11, 0, 8, 8, 8, 8, 9, 9, 9, 9,10,10,11, + 11, 0,12,12, 9, 9, 9,10,10,10,10,10,11,11, 0,13, + 13, 9, 9, 9, 9,10,10,11,11,11,11, 0, 0, 0,10,10, + 10,10,10,10,11,11,11,11, 0, 0, 0,10,10,10,10,10, + 10,11,11,12,12, 0, 0, 0,14,14,11,11,11,11,12,12, + 12,12, 0, 0, 0,14,14,11,11,11,11,12,12,12,12, 0, + 0, 0, 0, 0,12,12,12,12,12,12,13,13, 0, 0, 0, 0, + 0,12,12,12,12,12,12,13,13, +}; + +static float _vq_quantthresh__44c5_s_p8_0[] = { + -27.5, -22.5, -17.5, -12.5, -7.5, -2.5, 2.5, 7.5, + 12.5, 17.5, 22.5, 27.5, +}; + +static long _vq_quantmap__44c5_s_p8_0[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__44c5_s_p8_0 = { + _vq_quantthresh__44c5_s_p8_0, + _vq_quantmap__44c5_s_p8_0, + 13, + 13 +}; + +static static_codebook _44c5_s_p8_0 = { + 2, 169, + _vq_lengthlist__44c5_s_p8_0, + 1, -526516224, 1616117760, 4, 0, + _vq_quantlist__44c5_s_p8_0, + NULL, + &_vq_auxt__44c5_s_p8_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c5_s_p8_1[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44c5_s_p8_1[] = { + 2, 4, 4, 5, 5, 6, 5, 5, 5, 5, 6, 4, 5, 5, 5, 6, + 5, 5, 5, 5, 6, 6, 6, 5, 5, +}; + +static float _vq_quantthresh__44c5_s_p8_1[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__44c5_s_p8_1[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44c5_s_p8_1 = { + _vq_quantthresh__44c5_s_p8_1, + _vq_quantmap__44c5_s_p8_1, + 5, + 5 +}; + +static static_codebook _44c5_s_p8_1 = { + 2, 25, + _vq_lengthlist__44c5_s_p8_1, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__44c5_s_p8_1, + NULL, + &_vq_auxt__44c5_s_p8_1, + NULL, + 0 +}; + +static long _vq_quantlist__44c5_s_p9_0[] = { + 7, + 6, + 8, + 5, + 9, + 4, + 10, + 3, + 11, + 2, + 12, + 1, + 13, + 0, + 14, +}; + +static long _vq_lengthlist__44c5_s_p9_0[] = { + 1, 3, 3,13,13,13,13,13,13,13,13,13,13,13,13, 4, + 7, 7,13,13,13,13,13,13,13,13,13,13,13,13, 3, 8, + 6,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13,12,12,12,12,12,12,12, + 12, +}; + +static float _vq_quantthresh__44c5_s_p9_0[] = { + -2320.5, -1963.5, -1606.5, -1249.5, -892.5, -535.5, -178.5, 178.5, + 535.5, 892.5, 1249.5, 1606.5, 1963.5, 2320.5, +}; + +static long _vq_quantmap__44c5_s_p9_0[] = { + 13, 11, 9, 7, 5, 3, 1, 0, + 2, 4, 6, 8, 10, 12, 14, +}; + +static encode_aux_threshmatch _vq_auxt__44c5_s_p9_0 = { + _vq_quantthresh__44c5_s_p9_0, + _vq_quantmap__44c5_s_p9_0, + 15, + 15 +}; + +static static_codebook _44c5_s_p9_0 = { + 2, 225, + _vq_lengthlist__44c5_s_p9_0, + 1, -512522752, 1628852224, 4, 0, + _vq_quantlist__44c5_s_p9_0, + NULL, + &_vq_auxt__44c5_s_p9_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c5_s_p9_1[] = { + 8, + 7, + 9, + 6, + 10, + 5, + 11, + 4, + 12, + 3, + 13, + 2, + 14, + 1, + 15, + 0, + 16, +}; + +static long _vq_lengthlist__44c5_s_p9_1[] = { + 1, 4, 4, 5, 5, 7, 7, 9, 8,10, 9,10,10,11,10,11, + 11, 6, 5, 5, 7, 7, 8, 9,10,10,11,10,12,11,12,11, + 13,12, 6, 5, 5, 7, 7, 9, 9,10,10,11,11,12,12,13, + 12,13,13,18, 8, 8, 8, 8, 9, 9,10,11,11,11,12,11, + 13,11,13,12,18, 8, 8, 8, 8,10,10,11,11,12,12,13, + 13,13,13,13,14,18,12,12, 9, 9,11,11,11,11,12,12, + 13,12,13,12,13,13,20,13,12, 9, 9,11,11,11,11,12, + 12,13,13,13,14,14,13,20,18,19,11,12,11,11,12,12, + 13,13,13,13,13,13,14,13,18,19,19,12,11,11,11,12, + 12,13,12,13,13,13,14,14,13,18,17,19,14,15,12,12, + 12,13,13,13,14,14,14,14,14,14,19,19,19,16,15,12, + 11,13,12,14,14,14,13,13,14,14,14,19,18,19,18,19, + 13,13,13,13,14,14,14,13,14,14,14,14,18,17,19,19, + 19,13,13,13,11,13,11,13,14,14,14,14,14,19,17,17, + 18,18,16,16,13,13,13,13,14,13,15,15,14,14,19,19, + 17,17,18,16,16,13,11,14,10,13,12,14,14,14,14,19, + 19,19,19,19,18,17,13,14,13,11,14,13,14,14,15,15, + 19,19,19,17,19,18,18,14,13,12,11,14,11,15,15,15, + 15, +}; + +static float _vq_quantthresh__44c5_s_p9_1[] = { + -157.5, -136.5, -115.5, -94.5, -73.5, -52.5, -31.5, -10.5, + 10.5, 31.5, 52.5, 73.5, 94.5, 115.5, 136.5, 157.5, +}; + +static long _vq_quantmap__44c5_s_p9_1[] = { + 15, 13, 11, 9, 7, 5, 3, 1, + 0, 2, 4, 6, 8, 10, 12, 14, + 16, +}; + +static encode_aux_threshmatch _vq_auxt__44c5_s_p9_1 = { + _vq_quantthresh__44c5_s_p9_1, + _vq_quantmap__44c5_s_p9_1, + 17, + 17 +}; + +static static_codebook _44c5_s_p9_1 = { + 2, 289, + _vq_lengthlist__44c5_s_p9_1, + 1, -520814592, 1620377600, 5, 0, + _vq_quantlist__44c5_s_p9_1, + NULL, + &_vq_auxt__44c5_s_p9_1, + NULL, + 0 +}; + +static long _vq_quantlist__44c5_s_p9_2[] = { + 10, + 9, + 11, + 8, + 12, + 7, + 13, + 6, + 14, + 5, + 15, + 4, + 16, + 3, + 17, + 2, + 18, + 1, + 19, + 0, + 20, +}; + +static long _vq_lengthlist__44c5_s_p9_2[] = { + 3, 5, 5, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 9,11, 5, 6, 7, 7, 8, 7, 8, 8, 8, 8, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,11, 5, 5, 7, 7, 7, + 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,11, + 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, + 9,10, 9,10,11,11,11, 7, 7, 8, 8, 8, 8, 9, 9, 9, + 9, 9, 9,10,10,10,10,10,10,11,11,11, 8, 8, 8, 8, + 9, 9, 9, 9, 9, 9, 9,10,10,10,10,10,10,10,11,11, + 11, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9,10,10,10,10,10, + 10,10,10,11,11,11, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 10,10,10,10,10,10,10,10,11,11,11,11,11, 9, 9, 9, + 9, 9, 9,10, 9,10,10,10,10,10,10,10,10,11,11,11, + 11,11, 9, 9, 9, 9, 9, 9,10,10,10,10,10,10,10,10, + 10,10,11,11,11,11,11, 9, 9, 9, 9, 9, 9,10,10,10, + 10,10,10,10,10,10,10,11,11,11,11,11, 9, 9,10, 9, + 10,10,10,10,10,10,10,10,10,10,10,10,11,11,11,11, + 11,11,11, 9, 9,10,10,10,10,10,10,10,10,10,10,10, + 10,11,11,11,11,11,11,11,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,11,11,11,11,11,11,11,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,11,11,11,11,11, + 11,11,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 11,11,11,11,11,11,11,11,11,10,10,10,10,10,10,10, + 10,10,10,10,10,11,11,11,11,11,11,11,11,11,10,10, + 10,10,10,10,10,10,10,10,10,10,11,11,11,11,11,11, + 11,11,11,10,10,10,10,10,10,10,10,10,10,10,10,11, + 11,11,11,11,11,11,11,11,10,10,10,10,10,10,10,10, + 10,10,10,10,11,11,11,11,11,11,11,11,11,11,11,10, + 10,10,10,10,10,10,10,10,10, +}; + +static float _vq_quantthresh__44c5_s_p9_2[] = { + -9.5, -8.5, -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, + -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, + 6.5, 7.5, 8.5, 9.5, +}; + +static long _vq_quantmap__44c5_s_p9_2[] = { + 19, 17, 15, 13, 11, 9, 7, 5, + 3, 1, 0, 2, 4, 6, 8, 10, + 12, 14, 16, 18, 20, +}; + +static encode_aux_threshmatch _vq_auxt__44c5_s_p9_2 = { + _vq_quantthresh__44c5_s_p9_2, + _vq_quantmap__44c5_s_p9_2, + 21, + 21 +}; + +static static_codebook _44c5_s_p9_2 = { + 2, 441, + _vq_lengthlist__44c5_s_p9_2, + 1, -529268736, 1611661312, 5, 0, + _vq_quantlist__44c5_s_p9_2, + NULL, + &_vq_auxt__44c5_s_p9_2, + NULL, + 0 +}; + +static long _huff_lengthlist__44c5_s_short[] = { + 5, 8,10,14,11,11,12,16,15,17, 5, 5, 7, 9, 7, 8, + 10,13,17,17, 7, 5, 5,10, 5, 7, 8,11,13,15,10, 8, + 10, 8, 8, 8,11,15,18,18, 8, 5, 5, 8, 3, 4, 6,10, + 14,16, 9, 7, 6, 7, 4, 3, 5, 9,14,18,10, 9, 8,10, + 6, 5, 6, 9,14,18,12,12,11,12, 8, 7, 8,11,14,18, + 14,13,12,10, 7, 5, 6, 9,14,18,14,14,13,10, 6, 5, + 6, 8,11,16, +}; + +static static_codebook _huff_book__44c5_s_short = { + 2, 100, + _huff_lengthlist__44c5_s_short, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist__44c6_s_long[] = { + 3, 8,11,13,14,14,13,13,16,14, 6, 3, 4, 7, 9, 9, + 10,11,14,13,10, 4, 3, 5, 7, 7, 9,10,13,15,12, 7, + 4, 4, 6, 6, 8,10,13,15,12, 8, 6, 6, 6, 6, 8,10, + 13,14,11, 9, 7, 6, 6, 6, 7, 8,12,11,13,10, 9, 8, + 7, 6, 6, 7,11,11,13,11,10, 9, 9, 7, 7, 6,10,11, + 13,13,13,13,13,11, 9, 8,10,12,12,15,15,16,15,12, + 11,10,10,12, +}; + +static static_codebook _huff_book__44c6_s_long = { + 2, 100, + _huff_lengthlist__44c6_s_long, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _vq_quantlist__44c6_s_p1_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__44c6_s_p1_0[] = { + 1, 5, 5, 0, 5, 5, 0, 5, 5, 5, 8, 7, 0, 9, 9, 0, + 9, 8, 5, 7, 8, 0, 9, 9, 0, 8, 9, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 5, 9, 8, 0, 8, 8, 0, 8, 8, 5, 8, 9, + 0, 8, 8, 0, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, + 9, 9, 0, 8, 8, 0, 8, 8, 5, 9, 9, 0, 8, 8, 0, 8, + 8, +}; + +static float _vq_quantthresh__44c6_s_p1_0[] = { + -0.5, 0.5, +}; + +static long _vq_quantmap__44c6_s_p1_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__44c6_s_p1_0 = { + _vq_quantthresh__44c6_s_p1_0, + _vq_quantmap__44c6_s_p1_0, + 3, + 3 +}; + +static static_codebook _44c6_s_p1_0 = { + 4, 81, + _vq_lengthlist__44c6_s_p1_0, + 1, -535822336, 1611661312, 2, 0, + _vq_quantlist__44c6_s_p1_0, + NULL, + &_vq_auxt__44c6_s_p1_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c6_s_p2_0[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44c6_s_p2_0[] = { + 3, 5, 5, 8, 8, 0, 5, 5, 8, 8, 0, 5, 5, 8, 8, 0, + 7, 7, 9, 9, 0, 0, 0, 9, 9, 5, 7, 7, 9, 9, 0, 8, + 8,10,10, 0, 8, 7,10, 9, 0,10,10,11,11, 0, 0, 0, + 11,11, 5, 7, 7, 9, 9, 0, 8, 8,10,10, 0, 7, 8, 9, + 10, 0,10,10,11,11, 0, 0, 0,11,11, 8, 9, 9,11,11, + 0,11,11,12,12, 0,11,10,12,12, 0,13,14,14,14, 0, + 0, 0,14,13, 8, 9, 9,11,11, 0,11,11,12,12, 0,10, + 11,12,12, 0,14,13,14,14, 0, 0, 0,13,14, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 5, 8, 7,11,10, 0, 7, 7,10,10, + 0, 7, 7,10,10, 0, 9, 9,11,10, 0, 0, 0,11,11, 5, + 7, 8,10,11, 0, 7, 7,10,10, 0, 7, 7,10,10, 0, 9, + 9,10,11, 0, 0, 0,11,11, 8,10, 9,12,12, 0,10,10, + 12,12, 0,10,10,12,12, 0,12,12,13,13, 0, 0, 0,13, + 13, 8, 9,10,12,12, 0,10,10,11,12, 0,10,10,12,12, + 0,12,12,13,13, 0, 0, 0,13,13, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 5, 8, 8,11,11, 0, 7, 7,10,10, 0, 7, 7, + 10,10, 0, 9, 9,10,11, 0, 0, 0,11,10, 5, 8, 8,11, + 11, 0, 7, 7,10,10, 0, 7, 7,10,10, 0, 9, 9,11,11, + 0, 0, 0,10,11, 8,10,10,12,12, 0,10,10,12,12, 0, + 10,10,12,12, 0,12,13,13,13, 0, 0, 0,14,13, 8,10, + 10,12,12, 0,10,10,12,12, 0,10,10,12,12, 0,13,12, + 13,13, 0, 0, 0,13,13, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 7,10,10,14,13, 0, 9, 9,13,12, 0, 9, 9,12,12, 0, + 10,10,12,12, 0, 0, 0,12,12, 7,10,10,13,14, 0, 9, + 9,12,13, 0, 9, 9,12,12, 0,10,10,12,12, 0, 0, 0, + 12,12, 9,11,11,14,13, 0,11,10,14,13, 0,11,11,13, + 13, 0,12,12,13,13, 0, 0, 0,13,13, 9,11,11,13,14, + 0,10,11,13,14, 0,11,11,13,13, 0,12,12,13,13, 0, + 0, 0,13,13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, + 11,11,14,14, 0,11,11,13,13, 0,11,10,13,13, 0,12, + 12,13,13, 0, 0, 0,13,13, 9,11,11,14,14, 0,11,11, + 13,13, 0,10,11,13,13, 0,12,12,14,13, 0, 0, 0,13, + 13, +}; + +static float _vq_quantthresh__44c6_s_p2_0[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__44c6_s_p2_0[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44c6_s_p2_0 = { + _vq_quantthresh__44c6_s_p2_0, + _vq_quantmap__44c6_s_p2_0, + 5, + 5 +}; + +static static_codebook _44c6_s_p2_0 = { + 4, 625, + _vq_lengthlist__44c6_s_p2_0, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__44c6_s_p2_0, + NULL, + &_vq_auxt__44c6_s_p2_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c6_s_p3_0[] = { + 4, + 3, + 5, + 2, + 6, + 1, + 7, + 0, + 8, +}; + +static long _vq_lengthlist__44c6_s_p3_0[] = { + 2, 3, 4, 6, 6, 7, 7, 9, 9, 0, 4, 4, 6, 6, 7, 7, + 9,10, 0, 4, 4, 6, 6, 7, 7,10, 9, 0, 5, 5, 7, 7, + 8, 8,10,10, 0, 0, 0, 7, 6, 8, 8,10,10, 0, 0, 0, + 7, 7, 9, 9,11,11, 0, 0, 0, 7, 7, 9, 9,11,11, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + +static float _vq_quantthresh__44c6_s_p3_0[] = { + -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, +}; + +static long _vq_quantmap__44c6_s_p3_0[] = { + 7, 5, 3, 1, 0, 2, 4, 6, + 8, +}; + +static encode_aux_threshmatch _vq_auxt__44c6_s_p3_0 = { + _vq_quantthresh__44c6_s_p3_0, + _vq_quantmap__44c6_s_p3_0, + 9, + 9 +}; + +static static_codebook _44c6_s_p3_0 = { + 2, 81, + _vq_lengthlist__44c6_s_p3_0, + 1, -531628032, 1611661312, 4, 0, + _vq_quantlist__44c6_s_p3_0, + NULL, + &_vq_auxt__44c6_s_p3_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c6_s_p4_0[] = { + 8, + 7, + 9, + 6, + 10, + 5, + 11, + 4, + 12, + 3, + 13, + 2, + 14, + 1, + 15, + 0, + 16, +}; + +static long _vq_lengthlist__44c6_s_p4_0[] = { + 2, 4, 4, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9, 9,10,10, + 10, 0, 4, 4, 6, 6, 8, 8, 9, 9, 9, 9,10,10,10,10, + 11,11, 0, 4, 4, 6, 6, 8, 8, 9, 9, 9, 9,10,10,10, + 10,11,11, 0, 6, 6, 7, 7, 8, 8, 9, 9, 9, 9,10,10, + 11,11,11,11, 0, 0, 0, 7, 7, 8, 8, 9, 9, 9, 9,10, + 10,11,11,11,11, 0, 0, 0, 7, 7, 9, 9,10,10,10,10, + 11,11,11,11,12,12, 0, 0, 0, 7, 7, 9, 9,10,10,10, + 10,11,11,11,11,12,12, 0, 0, 0, 7, 7, 8, 8, 9, 9, + 10,10,11,11,12,12,12,12, 0, 0, 0, 0, 0, 8, 8, 9, + 9,10,10,11,11,12,12,12,12, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + +static float _vq_quantthresh__44c6_s_p4_0[] = { + -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, + 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, +}; + +static long _vq_quantmap__44c6_s_p4_0[] = { + 15, 13, 11, 9, 7, 5, 3, 1, + 0, 2, 4, 6, 8, 10, 12, 14, + 16, +}; + +static encode_aux_threshmatch _vq_auxt__44c6_s_p4_0 = { + _vq_quantthresh__44c6_s_p4_0, + _vq_quantmap__44c6_s_p4_0, + 17, + 17 +}; + +static static_codebook _44c6_s_p4_0 = { + 2, 289, + _vq_lengthlist__44c6_s_p4_0, + 1, -529530880, 1611661312, 5, 0, + _vq_quantlist__44c6_s_p4_0, + NULL, + &_vq_auxt__44c6_s_p4_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c6_s_p5_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__44c6_s_p5_0[] = { + 1, 4, 4, 5, 7, 7, 6, 7, 7, 4, 6, 6, 9, 9,10,10, + 10, 9, 4, 6, 6, 9,10, 9,10, 9,10, 6, 9, 9,10,12, + 11,10,11,11, 7,10, 9,11,12,12,12,12,12, 7,10,10, + 11,12,12,12,12,12, 6,10,10,10,12,12,11,12,12, 7, + 9,10,11,12,12,12,12,12, 7,10, 9,12,12,12,12,12, + 12, +}; + +static float _vq_quantthresh__44c6_s_p5_0[] = { + -5.5, 5.5, +}; + +static long _vq_quantmap__44c6_s_p5_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__44c6_s_p5_0 = { + _vq_quantthresh__44c6_s_p5_0, + _vq_quantmap__44c6_s_p5_0, + 3, + 3 +}; + +static static_codebook _44c6_s_p5_0 = { + 4, 81, + _vq_lengthlist__44c6_s_p5_0, + 1, -529137664, 1618345984, 2, 0, + _vq_quantlist__44c6_s_p5_0, + NULL, + &_vq_auxt__44c6_s_p5_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c6_s_p5_1[] = { + 5, + 4, + 6, + 3, + 7, + 2, + 8, + 1, + 9, + 0, + 10, +}; + +static long _vq_lengthlist__44c6_s_p5_1[] = { + 3, 5, 4, 6, 6, 7, 7, 8, 8, 8, 8,11, 4, 4, 6, 6, + 7, 7, 8, 8, 8, 8,11, 4, 4, 6, 6, 7, 7, 8, 8, 8, + 8,11, 6, 6, 6, 6, 8, 8, 8, 8, 9, 9,11,11,11, 6, + 6, 7, 8, 8, 8, 8, 9,11,11,11, 7, 7, 8, 8, 8, 8, + 8, 8,11,11,11, 7, 7, 8, 8, 8, 8, 8, 8,11,11,11, + 8, 8, 8, 8, 8, 8, 8, 8,11,11,11,10,10, 8, 8, 8, + 8, 8, 8,11,11,11,10,10, 8, 8, 8, 8, 8, 8,11,11, + 11,10,10, 7, 7, 8, 8, 8, 8, +}; + +static float _vq_quantthresh__44c6_s_p5_1[] = { + -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, + 3.5, 4.5, +}; + +static long _vq_quantmap__44c6_s_p5_1[] = { + 9, 7, 5, 3, 1, 0, 2, 4, + 6, 8, 10, +}; + +static encode_aux_threshmatch _vq_auxt__44c6_s_p5_1 = { + _vq_quantthresh__44c6_s_p5_1, + _vq_quantmap__44c6_s_p5_1, + 11, + 11 +}; + +static static_codebook _44c6_s_p5_1 = { + 2, 121, + _vq_lengthlist__44c6_s_p5_1, + 1, -531365888, 1611661312, 4, 0, + _vq_quantlist__44c6_s_p5_1, + NULL, + &_vq_auxt__44c6_s_p5_1, + NULL, + 0 +}; + +static long _vq_quantlist__44c6_s_p6_0[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__44c6_s_p6_0[] = { + 1, 4, 4, 6, 6, 8, 8, 8, 8,10, 9,10,10, 6, 5, 5, + 7, 7, 9, 9, 9, 9,10,10,11,11, 6, 5, 5, 7, 7, 9, + 9,10, 9,11,10,11,11, 0, 6, 6, 7, 7, 9, 9,10,10, + 11,11,12,12, 0, 7, 7, 7, 7, 9, 9,10,10,11,11,12, + 12, 0,11,11, 8, 8,10,10,11,11,12,12,12,12, 0,11, + 12, 9, 8,10,10,11,11,12,12,13,13, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, +}; + +static float _vq_quantthresh__44c6_s_p6_0[] = { + -27.5, -22.5, -17.5, -12.5, -7.5, -2.5, 2.5, 7.5, + 12.5, 17.5, 22.5, 27.5, +}; + +static long _vq_quantmap__44c6_s_p6_0[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__44c6_s_p6_0 = { + _vq_quantthresh__44c6_s_p6_0, + _vq_quantmap__44c6_s_p6_0, + 13, + 13 +}; + +static static_codebook _44c6_s_p6_0 = { + 2, 169, + _vq_lengthlist__44c6_s_p6_0, + 1, -526516224, 1616117760, 4, 0, + _vq_quantlist__44c6_s_p6_0, + NULL, + &_vq_auxt__44c6_s_p6_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c6_s_p6_1[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44c6_s_p6_1[] = { + 3, 4, 4, 5, 5, 5, 4, 4, 5, 5, 5, 4, 4, 5, 5, 6, + 5, 5, 5, 5, 6, 6, 6, 5, 5, +}; + +static float _vq_quantthresh__44c6_s_p6_1[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__44c6_s_p6_1[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44c6_s_p6_1 = { + _vq_quantthresh__44c6_s_p6_1, + _vq_quantmap__44c6_s_p6_1, + 5, + 5 +}; + +static static_codebook _44c6_s_p6_1 = { + 2, 25, + _vq_lengthlist__44c6_s_p6_1, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__44c6_s_p6_1, + NULL, + &_vq_auxt__44c6_s_p6_1, + NULL, + 0 +}; + +static long _vq_quantlist__44c6_s_p7_0[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__44c6_s_p7_0[] = { + 1, 4, 4, 6, 6, 8, 8, 8, 8,10,10,11,10, 6, 5, 5, + 7, 7, 8, 8, 9, 9,10,10,12,11, 6, 5, 5, 7, 7, 8, + 8, 9, 9,10,10,12,11,21, 7, 7, 7, 7, 9, 9,10,10, + 11,11,12,12,21, 7, 7, 7, 7, 9, 9,10,10,11,11,12, + 12,21,12,12, 9, 9,10,10,11,11,11,11,12,12,21,12, + 12, 9, 9,10,10,11,11,12,12,12,12,21,21,21,11,11, + 10,10,11,12,12,12,13,13,21,21,21,11,11,10,10,12, + 12,12,12,13,13,21,21,21,15,15,11,11,12,12,13,13, + 13,13,21,21,21,15,16,11,11,12,12,13,13,14,14,21, + 21,21,21,20,13,13,13,13,13,13,14,14,20,20,20,20, + 20,13,13,13,13,13,13,14,14, +}; + +static float _vq_quantthresh__44c6_s_p7_0[] = { + -60.5, -49.5, -38.5, -27.5, -16.5, -5.5, 5.5, 16.5, + 27.5, 38.5, 49.5, 60.5, +}; + +static long _vq_quantmap__44c6_s_p7_0[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__44c6_s_p7_0 = { + _vq_quantthresh__44c6_s_p7_0, + _vq_quantmap__44c6_s_p7_0, + 13, + 13 +}; + +static static_codebook _44c6_s_p7_0 = { + 2, 169, + _vq_lengthlist__44c6_s_p7_0, + 1, -523206656, 1618345984, 4, 0, + _vq_quantlist__44c6_s_p7_0, + NULL, + &_vq_auxt__44c6_s_p7_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c6_s_p7_1[] = { + 5, + 4, + 6, + 3, + 7, + 2, + 8, + 1, + 9, + 0, + 10, +}; + +static long _vq_lengthlist__44c6_s_p7_1[] = { + 3, 5, 5, 6, 6, 7, 7, 7, 7, 7, 7, 9, 5, 5, 6, 6, + 7, 7, 7, 7, 8, 7, 8, 5, 5, 6, 6, 7, 7, 7, 7, 7, + 7, 9, 6, 6, 7, 7, 7, 7, 8, 7, 7, 8, 9, 9, 9, 7, + 7, 7, 7, 7, 7, 7, 8, 9, 9, 9, 7, 7, 7, 7, 8, 8, + 8, 8, 9, 9, 9, 7, 7, 7, 7, 7, 7, 8, 8, 9, 9, 9, + 8, 8, 8, 8, 7, 7, 8, 8, 9, 9, 9, 9, 8, 8, 8, 7, + 7, 8, 8, 9, 9, 9, 8, 8, 8, 8, 7, 7, 8, 8, 9, 9, + 9, 8, 8, 7, 7, 7, 7, 8, 8, +}; + +static float _vq_quantthresh__44c6_s_p7_1[] = { + -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, + 3.5, 4.5, +}; + +static long _vq_quantmap__44c6_s_p7_1[] = { + 9, 7, 5, 3, 1, 0, 2, 4, + 6, 8, 10, +}; + +static encode_aux_threshmatch _vq_auxt__44c6_s_p7_1 = { + _vq_quantthresh__44c6_s_p7_1, + _vq_quantmap__44c6_s_p7_1, + 11, + 11 +}; + +static static_codebook _44c6_s_p7_1 = { + 2, 121, + _vq_lengthlist__44c6_s_p7_1, + 1, -531365888, 1611661312, 4, 0, + _vq_quantlist__44c6_s_p7_1, + NULL, + &_vq_auxt__44c6_s_p7_1, + NULL, + 0 +}; + +static long _vq_quantlist__44c6_s_p8_0[] = { + 7, + 6, + 8, + 5, + 9, + 4, + 10, + 3, + 11, + 2, + 12, + 1, + 13, + 0, + 14, +}; + +static long _vq_lengthlist__44c6_s_p8_0[] = { + 1, 4, 4, 7, 7, 8, 8, 7, 7, 8, 7, 9, 8,10, 9, 6, + 5, 5, 8, 8, 9, 9, 8, 8, 9, 9,11,10,11,10, 6, 5, + 5, 8, 8, 9, 9, 8, 8, 9, 9,10,10,11,11,18, 8, 8, + 9, 8,10,10, 9, 9,10,10,10,10,11,10,18, 8, 8, 9, + 9,10,10, 9, 9,10,10,11,11,12,12,18,12,13, 9,10, + 10,10, 9,10,10,10,11,11,12,11,18,13,13, 9, 9,10, + 10,10,10,10,10,11,11,12,12,18,18,18,10,10, 9, 9, + 11,11,11,11,11,12,12,12,18,18,18,10, 9,10, 9,11, + 10,11,11,11,11,13,12,18,18,18,14,13,10,10,11,11, + 12,12,12,12,12,12,18,18,18,14,13,10,10,11,10,12, + 12,12,12,12,12,18,18,18,18,18,12,12,11,11,12,12, + 13,13,13,14,18,18,18,18,18,12,12,11,11,12,11,13, + 13,14,13,18,18,18,18,18,16,16,11,12,12,13,13,13, + 14,13,18,18,18,18,18,16,15,12,11,12,11,13,11,15, + 14, +}; + +static float _vq_quantthresh__44c6_s_p8_0[] = { + -136.5, -115.5, -94.5, -73.5, -52.5, -31.5, -10.5, 10.5, + 31.5, 52.5, 73.5, 94.5, 115.5, 136.5, +}; + +static long _vq_quantmap__44c6_s_p8_0[] = { + 13, 11, 9, 7, 5, 3, 1, 0, + 2, 4, 6, 8, 10, 12, 14, +}; + +static encode_aux_threshmatch _vq_auxt__44c6_s_p8_0 = { + _vq_quantthresh__44c6_s_p8_0, + _vq_quantmap__44c6_s_p8_0, + 15, + 15 +}; + +static static_codebook _44c6_s_p8_0 = { + 2, 225, + _vq_lengthlist__44c6_s_p8_0, + 1, -520986624, 1620377600, 4, 0, + _vq_quantlist__44c6_s_p8_0, + NULL, + &_vq_auxt__44c6_s_p8_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c6_s_p8_1[] = { + 10, + 9, + 11, + 8, + 12, + 7, + 13, + 6, + 14, + 5, + 15, + 4, + 16, + 3, + 17, + 2, + 18, + 1, + 19, + 0, + 20, +}; + +static long _vq_lengthlist__44c6_s_p8_1[] = { + 3, 5, 5, 6, 6, 7, 7, 7, 7, 8, 7, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8,10, 6, 6, 7, 7, 8, 8, 8, 8, 8, 8, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10, 6, 6, 7, 7, 8, + 8, 8, 8, 8, 8, 9, 8, 9, 9, 9, 9, 9, 9, 9, 9,10, + 7, 7, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9,10,11,11, 8, 7, 8, 8, 8, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9,11,11,11, 8, 8, 8, 8, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,11,11, + 11, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9,11,11,11, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9,11,11,11,11,11, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10, 9,11,11,11, + 11,11, 9, 9, 9, 9, 9, 9,10, 9, 9,10, 9,10, 9, 9, + 10, 9,11,11,11,11,11, 9, 9, 9, 9, 9, 9, 9,10,10, + 10,10, 9,10,10, 9,10,11,11,11,11,11, 9, 9, 9, 9, + 10,10,10, 9,10,10,10,10, 9,10,10, 9,11,11,11,11, + 11,11,11, 9, 9, 9, 9,10,10,10,10, 9,10,10,10,10, + 10,11,11,11,11,11,11,11,10, 9,10,10,10,10,10,10, + 10, 9,10, 9,10,10,11,11,11,11,11,11,11,10, 9,10, + 9,10,10, 9,10,10,10,10,10,10,10,11,11,11,11,11, + 11,11,10,10,10,10,10,10,10, 9,10,10,10,10,10, 9, + 11,11,11,11,11,11,11,11,11,10,10,10,10,10,10,10, + 10,10,10,10,10,11,11,11,11,11,11,11,11,11,10,10, + 10,10,10,10,10,10,10,10,10,10,11,11,11,11,11,11, + 11,11,11,10,10,10,10,10,10,10,10,10, 9,10,10,11, + 11,11,11,11,11,11,11,11,10,10,10, 9,10,10,10,10, + 10,10,10,10,10,11,11,11,11,11,11,11,11,10,11, 9, + 10,10,10,10,10,10,10,10,10, +}; + +static float _vq_quantthresh__44c6_s_p8_1[] = { + -9.5, -8.5, -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, + -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, + 6.5, 7.5, 8.5, 9.5, +}; + +static long _vq_quantmap__44c6_s_p8_1[] = { + 19, 17, 15, 13, 11, 9, 7, 5, + 3, 1, 0, 2, 4, 6, 8, 10, + 12, 14, 16, 18, 20, +}; + +static encode_aux_threshmatch _vq_auxt__44c6_s_p8_1 = { + _vq_quantthresh__44c6_s_p8_1, + _vq_quantmap__44c6_s_p8_1, + 21, + 21 +}; + +static static_codebook _44c6_s_p8_1 = { + 2, 441, + _vq_lengthlist__44c6_s_p8_1, + 1, -529268736, 1611661312, 5, 0, + _vq_quantlist__44c6_s_p8_1, + NULL, + &_vq_auxt__44c6_s_p8_1, + NULL, + 0 +}; + +static long _vq_quantlist__44c6_s_p9_0[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__44c6_s_p9_0[] = { + 1, 3, 3,11,11,11,11,11,11,11,11,11,11, 4, 7, 7, + 11,11,11,11,11,11,11,11,11,11, 5, 8, 9,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10, +}; + +static float _vq_quantthresh__44c6_s_p9_0[] = { + -3503.5, -2866.5, -2229.5, -1592.5, -955.5, -318.5, 318.5, 955.5, + 1592.5, 2229.5, 2866.5, 3503.5, +}; + +static long _vq_quantmap__44c6_s_p9_0[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__44c6_s_p9_0 = { + _vq_quantthresh__44c6_s_p9_0, + _vq_quantmap__44c6_s_p9_0, + 13, + 13 +}; + +static static_codebook _44c6_s_p9_0 = { + 2, 169, + _vq_lengthlist__44c6_s_p9_0, + 1, -511845376, 1630791680, 4, 0, + _vq_quantlist__44c6_s_p9_0, + NULL, + &_vq_auxt__44c6_s_p9_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c6_s_p9_1[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__44c6_s_p9_1[] = { + 1, 4, 4, 7, 7, 7, 7, 7, 6, 8, 8, 8, 8, 6, 6, 6, + 8, 8, 8, 8, 8, 7, 9, 8,10,10, 5, 6, 6, 8, 8, 9, + 9, 8, 8,10,10,10,10,16, 9, 9, 9, 9, 9, 9, 9, 8, + 10, 9,11,11,16, 8, 9, 9, 9, 9, 9, 9, 9,10,10,11, + 11,16,13,13, 9, 9,10, 9, 9,10,11,11,11,12,16,13, + 14, 9, 8,10, 8, 9, 9,10,10,12,11,16,14,16, 9, 9, + 9, 9,11,11,12,11,12,11,16,16,16, 9, 7, 9, 6,11, + 11,11,10,11,11,16,16,16,11,12, 9,10,11,11,12,11, + 13,13,16,16,16,12,11,10, 7,12,10,12,12,12,12,16, + 16,15,16,16,10,11,10,11,13,13,14,12,16,16,16,15, + 15,12,10,11,11,13,11,12,13, +}; + +static float _vq_quantthresh__44c6_s_p9_1[] = { + -269.5, -220.5, -171.5, -122.5, -73.5, -24.5, 24.5, 73.5, + 122.5, 171.5, 220.5, 269.5, +}; + +static long _vq_quantmap__44c6_s_p9_1[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__44c6_s_p9_1 = { + _vq_quantthresh__44c6_s_p9_1, + _vq_quantmap__44c6_s_p9_1, + 13, + 13 +}; + +static static_codebook _44c6_s_p9_1 = { + 2, 169, + _vq_lengthlist__44c6_s_p9_1, + 1, -518889472, 1622704128, 4, 0, + _vq_quantlist__44c6_s_p9_1, + NULL, + &_vq_auxt__44c6_s_p9_1, + NULL, + 0 +}; + +static long _vq_quantlist__44c6_s_p9_2[] = { + 24, + 23, + 25, + 22, + 26, + 21, + 27, + 20, + 28, + 19, + 29, + 18, + 30, + 17, + 31, + 16, + 32, + 15, + 33, + 14, + 34, + 13, + 35, + 12, + 36, + 11, + 37, + 10, + 38, + 9, + 39, + 8, + 40, + 7, + 41, + 6, + 42, + 5, + 43, + 4, + 44, + 3, + 45, + 2, + 46, + 1, + 47, + 0, + 48, +}; + +static long _vq_lengthlist__44c6_s_p9_2[] = { + 2, 4, 3, 4, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, +}; + +static float _vq_quantthresh__44c6_s_p9_2[] = { + -23.5, -22.5, -21.5, -20.5, -19.5, -18.5, -17.5, -16.5, + -15.5, -14.5, -13.5, -12.5, -11.5, -10.5, -9.5, -8.5, + -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, + 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, + 8.5, 9.5, 10.5, 11.5, 12.5, 13.5, 14.5, 15.5, + 16.5, 17.5, 18.5, 19.5, 20.5, 21.5, 22.5, 23.5, +}; + +static long _vq_quantmap__44c6_s_p9_2[] = { + 47, 45, 43, 41, 39, 37, 35, 33, + 31, 29, 27, 25, 23, 21, 19, 17, + 15, 13, 11, 9, 7, 5, 3, 1, + 0, 2, 4, 6, 8, 10, 12, 14, + 16, 18, 20, 22, 24, 26, 28, 30, + 32, 34, 36, 38, 40, 42, 44, 46, + 48, +}; + +static encode_aux_threshmatch _vq_auxt__44c6_s_p9_2 = { + _vq_quantthresh__44c6_s_p9_2, + _vq_quantmap__44c6_s_p9_2, + 49, + 49 +}; + +static static_codebook _44c6_s_p9_2 = { + 1, 49, + _vq_lengthlist__44c6_s_p9_2, + 1, -526909440, 1611661312, 6, 0, + _vq_quantlist__44c6_s_p9_2, + NULL, + &_vq_auxt__44c6_s_p9_2, + NULL, + 0 +}; + +static long _huff_lengthlist__44c6_s_short[] = { + 3, 9,11,11,13,14,19,17,17,19, 5, 4, 5, 8,10,10, + 13,16,18,19, 7, 4, 4, 5, 8, 9,12,14,17,19, 8, 6, + 5, 5, 7, 7,10,13,16,18,10, 8, 7, 6, 5, 5, 8,11, + 17,19,11, 9, 7, 7, 5, 4, 5, 8,17,19,13,11, 8, 7, + 7, 5, 5, 7,16,18,14,13, 8, 6, 6, 5, 5, 7,16,18, + 18,16,10, 8, 8, 7, 7, 9,16,18,18,18,12,10,10, 9, + 9,10,17,18, +}; + +static static_codebook _huff_book__44c6_s_short = { + 2, 100, + _huff_lengthlist__44c6_s_short, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist__44c7_s_long[] = { + 3, 8,11,13,15,14,14,13,15,14, 6, 4, 5, 7, 9,10, + 11,11,14,13,10, 4, 3, 5, 7, 8, 9,10,13,13,12, 7, + 4, 4, 5, 6, 8, 9,12,14,13, 9, 6, 5, 5, 6, 8, 9, + 12,14,12, 9, 7, 6, 5, 5, 6, 8,11,11,12,11, 9, 8, + 7, 6, 6, 7,10,11,13,11,10, 9, 8, 7, 6, 6, 9,11, + 13,13,12,12,12,10, 9, 8, 9,11,12,14,15,15,14,12, + 11,10,10,12, +}; + +static static_codebook _huff_book__44c7_s_long = { + 2, 100, + _huff_lengthlist__44c7_s_long, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _vq_quantlist__44c7_s_p1_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__44c7_s_p1_0[] = { + 1, 5, 5, 0, 5, 5, 0, 5, 5, 5, 8, 7, 0, 9, 9, 0, + 9, 8, 5, 7, 8, 0, 9, 9, 0, 8, 9, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 5, 9, 9, 0, 8, 8, 0, 8, 8, 5, 8, 9, + 0, 8, 8, 0, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, + 9, 9, 0, 8, 8, 0, 8, 8, 5, 8, 9, 0, 8, 8, 0, 8, + 8, +}; + +static float _vq_quantthresh__44c7_s_p1_0[] = { + -0.5, 0.5, +}; + +static long _vq_quantmap__44c7_s_p1_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__44c7_s_p1_0 = { + _vq_quantthresh__44c7_s_p1_0, + _vq_quantmap__44c7_s_p1_0, + 3, + 3 +}; + +static static_codebook _44c7_s_p1_0 = { + 4, 81, + _vq_lengthlist__44c7_s_p1_0, + 1, -535822336, 1611661312, 2, 0, + _vq_quantlist__44c7_s_p1_0, + NULL, + &_vq_auxt__44c7_s_p1_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c7_s_p2_0[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44c7_s_p2_0[] = { + 3, 5, 5, 8, 8, 0, 5, 5, 8, 8, 0, 5, 5, 8, 8, 0, + 7, 7, 9, 9, 0, 0, 0, 9, 9, 5, 7, 7, 9, 9, 0, 8, + 8,10,10, 0, 8, 7,10, 9, 0,10,10,11,11, 0, 0, 0, + 11,11, 5, 7, 7, 9, 9, 0, 8, 8,10,10, 0, 7, 8, 9, + 10, 0,10,10,11,11, 0, 0, 0,11,11, 8, 9, 9,11,10, + 0,11,11,12,12, 0,11,10,12,12, 0,13,14,14,14, 0, + 0, 0,14,13, 8, 9, 9,10,11, 0,11,11,12,12, 0,10, + 11,12,12, 0,13,13,14,14, 0, 0, 0,13,14, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 5, 8, 7,11,10, 0, 7, 7,10,10, + 0, 7, 7,10,10, 0, 9, 9,11,10, 0, 0, 0,11,11, 5, + 7, 8,10,11, 0, 7, 7,10,10, 0, 7, 7,10,10, 0, 9, + 9,10,11, 0, 0, 0,11,11, 8,10, 9,12,12, 0,10,10, + 12,12, 0,10,10,12,12, 0,12,12,13,13, 0, 0, 0,13, + 13, 8, 9,10,12,12, 0,10,10,12,12, 0,10,10,11,12, + 0,12,12,13,13, 0, 0, 0,13,13, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 5, 8, 8,11,11, 0, 7, 7,10,10, 0, 7, 7, + 10,10, 0, 9, 9,10,11, 0, 0, 0,11,10, 5, 8, 8,10, + 11, 0, 7, 7,10,10, 0, 7, 7,10,10, 0, 9, 9,11,10, + 0, 0, 0,10,11, 9,10,10,12,12, 0,10,10,12,12, 0, + 10,10,12,12, 0,12,13,13,13, 0, 0, 0,13,12, 9,10, + 10,12,12, 0,10,10,12,12, 0,10,10,12,12, 0,13,12, + 13,13, 0, 0, 0,12,13, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 7,10,10,14,13, 0, 9, 9,12,12, 0, 9, 9,12,12, 0, + 10,10,12,12, 0, 0, 0,12,12, 7,10,10,13,14, 0, 9, + 9,12,13, 0, 9, 9,12,12, 0,10,10,12,12, 0, 0, 0, + 12,12, 9,11,11,14,13, 0,11,10,13,12, 0,11,11,13, + 13, 0,12,12,13,13, 0, 0, 0,13,13, 9,11,11,13,14, + 0,10,11,12,13, 0,11,11,13,13, 0,12,12,13,13, 0, + 0, 0,13,13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, + 11,11,14,14, 0,10,11,13,13, 0,11,10,13,13, 0,12, + 12,13,13, 0, 0, 0,13,12, 9,11,11,14,14, 0,11,10, + 13,13, 0,10,11,13,13, 0,12,12,14,13, 0, 0, 0,13, + 13, +}; + +static float _vq_quantthresh__44c7_s_p2_0[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__44c7_s_p2_0[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44c7_s_p2_0 = { + _vq_quantthresh__44c7_s_p2_0, + _vq_quantmap__44c7_s_p2_0, + 5, + 5 +}; + +static static_codebook _44c7_s_p2_0 = { + 4, 625, + _vq_lengthlist__44c7_s_p2_0, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__44c7_s_p2_0, + NULL, + &_vq_auxt__44c7_s_p2_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c7_s_p3_0[] = { + 4, + 3, + 5, + 2, + 6, + 1, + 7, + 0, + 8, +}; + +static long _vq_lengthlist__44c7_s_p3_0[] = { + 2, 4, 4, 5, 5, 7, 7, 9, 9, 0, 4, 4, 6, 6, 7, 7, + 9, 9, 0, 4, 4, 6, 6, 7, 7, 9, 9, 0, 5, 5, 6, 6, + 8, 8,10,10, 0, 0, 0, 6, 6, 8, 8,10,10, 0, 0, 0, + 7, 7, 9, 9,10,10, 0, 0, 0, 7, 7, 8, 8,10,10, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + +static float _vq_quantthresh__44c7_s_p3_0[] = { + -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, +}; + +static long _vq_quantmap__44c7_s_p3_0[] = { + 7, 5, 3, 1, 0, 2, 4, 6, + 8, +}; + +static encode_aux_threshmatch _vq_auxt__44c7_s_p3_0 = { + _vq_quantthresh__44c7_s_p3_0, + _vq_quantmap__44c7_s_p3_0, + 9, + 9 +}; + +static static_codebook _44c7_s_p3_0 = { + 2, 81, + _vq_lengthlist__44c7_s_p3_0, + 1, -531628032, 1611661312, 4, 0, + _vq_quantlist__44c7_s_p3_0, + NULL, + &_vq_auxt__44c7_s_p3_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c7_s_p4_0[] = { + 8, + 7, + 9, + 6, + 10, + 5, + 11, + 4, + 12, + 3, + 13, + 2, + 14, + 1, + 15, + 0, + 16, +}; + +static long _vq_lengthlist__44c7_s_p4_0[] = { + 3, 4, 4, 5, 5, 7, 7, 8, 8, 8, 8, 9, 9,10,10,11, + 11, 0, 4, 4, 6, 6, 7, 7, 8, 8, 9, 9,10,10,11,11, + 12,12, 0, 4, 4, 6, 6, 7, 7, 8, 8, 9, 9,10,10,11, + 11,12,12, 0, 5, 5, 6, 6, 8, 8, 9, 9, 9, 9,10,10, + 11,12,12,12, 0, 0, 0, 6, 6, 8, 7, 9, 9, 9, 9,10, + 10,11,11,12,12, 0, 0, 0, 7, 7, 8, 8, 9, 9,10,10, + 11,11,12,12,13,12, 0, 0, 0, 7, 7, 8, 8, 9, 9,10, + 10,11,11,12,12,12,13, 0, 0, 0, 7, 7, 8, 8, 9, 9, + 10,10,11,11,12,12,13,13, 0, 0, 0, 0, 0, 8, 8, 9, + 9,10,10,11,11,12,12,13,13, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + +static float _vq_quantthresh__44c7_s_p4_0[] = { + -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, + 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, +}; + +static long _vq_quantmap__44c7_s_p4_0[] = { + 15, 13, 11, 9, 7, 5, 3, 1, + 0, 2, 4, 6, 8, 10, 12, 14, + 16, +}; + +static encode_aux_threshmatch _vq_auxt__44c7_s_p4_0 = { + _vq_quantthresh__44c7_s_p4_0, + _vq_quantmap__44c7_s_p4_0, + 17, + 17 +}; + +static static_codebook _44c7_s_p4_0 = { + 2, 289, + _vq_lengthlist__44c7_s_p4_0, + 1, -529530880, 1611661312, 5, 0, + _vq_quantlist__44c7_s_p4_0, + NULL, + &_vq_auxt__44c7_s_p4_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c7_s_p5_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__44c7_s_p5_0[] = { + 1, 4, 4, 5, 7, 7, 6, 7, 7, 4, 6, 7,10,10,10,10, + 10, 9, 4, 6, 6,10,10,10,10, 9,10, 5,10,10, 9,11, + 12,10,11,12, 7,10,10,11,12,12,12,12,12, 7,10,10, + 11,12,12,12,12,12, 6,10,10,10,12,12,11,12,12, 7, + 10,10,12,12,12,12,11,12, 7,10,10,11,12,12,12,12, + 12, +}; + +static float _vq_quantthresh__44c7_s_p5_0[] = { + -5.5, 5.5, +}; + +static long _vq_quantmap__44c7_s_p5_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__44c7_s_p5_0 = { + _vq_quantthresh__44c7_s_p5_0, + _vq_quantmap__44c7_s_p5_0, + 3, + 3 +}; + +static static_codebook _44c7_s_p5_0 = { + 4, 81, + _vq_lengthlist__44c7_s_p5_0, + 1, -529137664, 1618345984, 2, 0, + _vq_quantlist__44c7_s_p5_0, + NULL, + &_vq_auxt__44c7_s_p5_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c7_s_p5_1[] = { + 5, + 4, + 6, + 3, + 7, + 2, + 8, + 1, + 9, + 0, + 10, +}; + +static long _vq_lengthlist__44c7_s_p5_1[] = { + 3, 5, 5, 6, 6, 7, 7, 8, 8, 8, 8,11, 4, 4, 6, 6, + 7, 7, 8, 8, 9, 9,11, 4, 4, 6, 6, 7, 7, 8, 8, 9, + 9,12, 5, 5, 6, 6, 7, 7, 9, 9, 9, 9,12,12,12, 6, + 6, 7, 7, 9, 9, 9, 9,11,11,11, 7, 7, 7, 7, 8, 8, + 9, 9,11,11,11, 7, 7, 7, 7, 8, 8, 9, 9,11,11,11, + 7, 7, 8, 8, 8, 8, 9, 9,11,11,11,11,11, 8, 8, 8, + 8, 8, 9,11,11,11,11,11, 8, 8, 8, 8, 8, 8,11,11, + 11,11,11, 7, 7, 8, 8, 8, 8, +}; + +static float _vq_quantthresh__44c7_s_p5_1[] = { + -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, + 3.5, 4.5, +}; + +static long _vq_quantmap__44c7_s_p5_1[] = { + 9, 7, 5, 3, 1, 0, 2, 4, + 6, 8, 10, +}; + +static encode_aux_threshmatch _vq_auxt__44c7_s_p5_1 = { + _vq_quantthresh__44c7_s_p5_1, + _vq_quantmap__44c7_s_p5_1, + 11, + 11 +}; + +static static_codebook _44c7_s_p5_1 = { + 2, 121, + _vq_lengthlist__44c7_s_p5_1, + 1, -531365888, 1611661312, 4, 0, + _vq_quantlist__44c7_s_p5_1, + NULL, + &_vq_auxt__44c7_s_p5_1, + NULL, + 0 +}; + +static long _vq_quantlist__44c7_s_p6_0[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__44c7_s_p6_0[] = { + 1, 4, 4, 6, 6, 7, 7, 8, 7, 9, 8,10,10, 6, 5, 5, + 7, 7, 8, 8, 9, 9, 9,10,11,11, 7, 5, 5, 7, 7, 8, + 8, 9, 9,10,10,11,11, 0, 7, 7, 7, 7, 9, 8, 9, 9, + 10,10,11,11, 0, 8, 8, 7, 7, 8, 9, 9, 9,10,10,11, + 11, 0,11,11, 9, 9,10,10,11,10,11,11,12,12, 0,12, + 12, 9, 9,10,10,11,11,11,11,12,12, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, +}; + +static float _vq_quantthresh__44c7_s_p6_0[] = { + -27.5, -22.5, -17.5, -12.5, -7.5, -2.5, 2.5, 7.5, + 12.5, 17.5, 22.5, 27.5, +}; + +static long _vq_quantmap__44c7_s_p6_0[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__44c7_s_p6_0 = { + _vq_quantthresh__44c7_s_p6_0, + _vq_quantmap__44c7_s_p6_0, + 13, + 13 +}; + +static static_codebook _44c7_s_p6_0 = { + 2, 169, + _vq_lengthlist__44c7_s_p6_0, + 1, -526516224, 1616117760, 4, 0, + _vq_quantlist__44c7_s_p6_0, + NULL, + &_vq_auxt__44c7_s_p6_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c7_s_p6_1[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44c7_s_p6_1[] = { + 3, 4, 4, 5, 5, 5, 4, 4, 5, 5, 5, 4, 4, 5, 5, 6, + 5, 5, 5, 5, 6, 6, 6, 5, 5, +}; + +static float _vq_quantthresh__44c7_s_p6_1[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__44c7_s_p6_1[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44c7_s_p6_1 = { + _vq_quantthresh__44c7_s_p6_1, + _vq_quantmap__44c7_s_p6_1, + 5, + 5 +}; + +static static_codebook _44c7_s_p6_1 = { + 2, 25, + _vq_lengthlist__44c7_s_p6_1, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__44c7_s_p6_1, + NULL, + &_vq_auxt__44c7_s_p6_1, + NULL, + 0 +}; + +static long _vq_quantlist__44c7_s_p7_0[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__44c7_s_p7_0[] = { + 1, 4, 4, 6, 6, 7, 8, 9, 9,10,10,12,11, 6, 5, 5, + 7, 7, 8, 8, 9,10,11,11,12,12, 7, 5, 5, 7, 7, 8, + 8,10,10,11,11,12,12,20, 7, 7, 7, 7, 8, 9,10,10, + 11,11,12,13,20, 7, 7, 7, 7, 9, 9,10,10,11,12,13, + 13,20,11,11, 8, 8, 9, 9,11,11,12,12,13,13,20,11, + 11, 8, 8, 9, 9,11,11,12,12,13,13,20,20,20,10,10, + 10,10,12,12,13,13,13,13,20,20,20,10,10,10,10,12, + 12,13,13,13,14,20,20,20,14,14,11,11,12,12,13,13, + 14,14,20,20,20,14,14,11,11,12,12,13,13,14,14,20, + 20,20,20,19,13,13,13,13,14,14,15,14,19,19,19,19, + 19,13,13,13,13,14,14,15,15, +}; + +static float _vq_quantthresh__44c7_s_p7_0[] = { + -60.5, -49.5, -38.5, -27.5, -16.5, -5.5, 5.5, 16.5, + 27.5, 38.5, 49.5, 60.5, +}; + +static long _vq_quantmap__44c7_s_p7_0[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__44c7_s_p7_0 = { + _vq_quantthresh__44c7_s_p7_0, + _vq_quantmap__44c7_s_p7_0, + 13, + 13 +}; + +static static_codebook _44c7_s_p7_0 = { + 2, 169, + _vq_lengthlist__44c7_s_p7_0, + 1, -523206656, 1618345984, 4, 0, + _vq_quantlist__44c7_s_p7_0, + NULL, + &_vq_auxt__44c7_s_p7_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c7_s_p7_1[] = { + 5, + 4, + 6, + 3, + 7, + 2, + 8, + 1, + 9, + 0, + 10, +}; + +static long _vq_lengthlist__44c7_s_p7_1[] = { + 4, 5, 5, 6, 6, 7, 7, 7, 7, 7, 7, 8, 6, 6, 7, 7, + 7, 7, 7, 7, 7, 7, 8, 6, 6, 6, 7, 7, 7, 7, 7, 7, + 7, 8, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 7, + 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 7, 7, 7, 7, 7, 7, + 7, 7, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, + 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 7, 7, 7, + 7, 7, 7, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 8, 8, + 8, 8, 8, 7, 7, 7, 7, 7, 7, +}; + +static float _vq_quantthresh__44c7_s_p7_1[] = { + -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, + 3.5, 4.5, +}; + +static long _vq_quantmap__44c7_s_p7_1[] = { + 9, 7, 5, 3, 1, 0, 2, 4, + 6, 8, 10, +}; + +static encode_aux_threshmatch _vq_auxt__44c7_s_p7_1 = { + _vq_quantthresh__44c7_s_p7_1, + _vq_quantmap__44c7_s_p7_1, + 11, + 11 +}; + +static static_codebook _44c7_s_p7_1 = { + 2, 121, + _vq_lengthlist__44c7_s_p7_1, + 1, -531365888, 1611661312, 4, 0, + _vq_quantlist__44c7_s_p7_1, + NULL, + &_vq_auxt__44c7_s_p7_1, + NULL, + 0 +}; + +static long _vq_quantlist__44c7_s_p8_0[] = { + 7, + 6, + 8, + 5, + 9, + 4, + 10, + 3, + 11, + 2, + 12, + 1, + 13, + 0, + 14, +}; + +static long _vq_lengthlist__44c7_s_p8_0[] = { + 1, 4, 4, 7, 7, 8, 8, 8, 7, 9, 8, 9, 9,10,10, 6, + 5, 5, 7, 7, 9, 9, 8, 8,10, 9,11,10,12,11, 6, 5, + 5, 8, 7, 9, 9, 8, 8,10,10,11,11,12,11,19, 8, 8, + 8, 8,10,10, 9, 9,10,10,11,11,12,11,19, 8, 8, 8, + 8,10,10, 9, 9,10,10,11,11,12,12,19,12,12, 9, 9, + 10,10, 9,10,10,10,11,11,12,12,19,12,12, 9, 9,10, + 10,10,10,10,10,12,12,12,12,19,19,19, 9, 9, 9, 9, + 11,10,11,11,12,11,13,13,19,19,19, 9, 9, 9, 9,11, + 10,11,11,11,12,13,13,19,19,19,13,13,10,10,11,11, + 12,12,12,12,13,12,19,19,19,14,13,10,10,11,11,12, + 12,12,13,13,13,19,19,19,19,19,12,12,12,11,12,13, + 14,13,13,13,19,19,19,19,19,12,12,12,11,12,12,13, + 14,13,14,19,19,19,19,19,16,16,12,13,12,13,13,14, + 15,14,19,18,18,18,18,16,15,12,11,12,11,14,12,14, + 14, +}; + +static float _vq_quantthresh__44c7_s_p8_0[] = { + -136.5, -115.5, -94.5, -73.5, -52.5, -31.5, -10.5, 10.5, + 31.5, 52.5, 73.5, 94.5, 115.5, 136.5, +}; + +static long _vq_quantmap__44c7_s_p8_0[] = { + 13, 11, 9, 7, 5, 3, 1, 0, + 2, 4, 6, 8, 10, 12, 14, +}; + +static encode_aux_threshmatch _vq_auxt__44c7_s_p8_0 = { + _vq_quantthresh__44c7_s_p8_0, + _vq_quantmap__44c7_s_p8_0, + 15, + 15 +}; + +static static_codebook _44c7_s_p8_0 = { + 2, 225, + _vq_lengthlist__44c7_s_p8_0, + 1, -520986624, 1620377600, 4, 0, + _vq_quantlist__44c7_s_p8_0, + NULL, + &_vq_auxt__44c7_s_p8_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c7_s_p8_1[] = { + 10, + 9, + 11, + 8, + 12, + 7, + 13, + 6, + 14, + 5, + 15, + 4, + 16, + 3, + 17, + 2, + 18, + 1, + 19, + 0, + 20, +}; + +static long _vq_lengthlist__44c7_s_p8_1[] = { + 3, 5, 5, 7, 6, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8,10, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10, 6, 6, 7, 7, 8, + 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10, + 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9,10,10,10, 8, 8, 8, 8, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10, 8, 8, 8, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10, + 10, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9,10,10,10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9,10,11,10,10,10, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9,10, 9, 9,10, 9, 9,10,11,10, + 11,10, 9, 9, 9, 9, 9, 9, 9,10,10,10, 9,10, 9, 9, + 9, 9,11,10,11,10,10, 9, 9, 9, 9, 9, 9,10, 9, 9, + 10, 9, 9,10, 9, 9,10,11,10,10,11,10, 9, 9, 9, 9, + 9,10,10, 9,10,10,10,10, 9,10,10,10,10,10,10,11, + 11,11,10, 9, 9, 9,10,10,10,10,10,10,10,10,10,10, + 10,10,10,11,11,10,10,10,10,10,10,10,10,10,10,10, + 10, 9,10,10, 9,10,11,11,10,11,10,11,10, 9,10,10, + 9,10,10,10,10,10,10,10,10,10,10,11,11,11,11,10, + 11,11,10,10,10,10,10,10, 9,10, 9,10,10, 9,10, 9, + 10,10,10,11,10,11,10,11,11,10,10,10,10,10,10, 9, + 10,10,10,10,10,10,10,11,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,11,10,11, + 11,10,10,10,10, 9, 9,10,10, 9, 9,10, 9,10,10,10, + 10,11,11,10,10,10,10,10,10,10, 9, 9,10,10,10, 9, + 9,10,10,10,10,10,11,10,11,10,10,10,10,10,10, 9, + 10,10,10,10,10,10,10,10,10, +}; + +static float _vq_quantthresh__44c7_s_p8_1[] = { + -9.5, -8.5, -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, + -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, + 6.5, 7.5, 8.5, 9.5, +}; + +static long _vq_quantmap__44c7_s_p8_1[] = { + 19, 17, 15, 13, 11, 9, 7, 5, + 3, 1, 0, 2, 4, 6, 8, 10, + 12, 14, 16, 18, 20, +}; + +static encode_aux_threshmatch _vq_auxt__44c7_s_p8_1 = { + _vq_quantthresh__44c7_s_p8_1, + _vq_quantmap__44c7_s_p8_1, + 21, + 21 +}; + +static static_codebook _44c7_s_p8_1 = { + 2, 441, + _vq_lengthlist__44c7_s_p8_1, + 1, -529268736, 1611661312, 5, 0, + _vq_quantlist__44c7_s_p8_1, + NULL, + &_vq_auxt__44c7_s_p8_1, + NULL, + 0 +}; + +static long _vq_quantlist__44c7_s_p9_0[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__44c7_s_p9_0[] = { + 1, 3, 3,11,11,11,11,11,11,11,11,11,11, 4, 6, 6, + 11,11,11,11,11,11,11,11,11,11, 4, 7, 7,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11, +}; + +static float _vq_quantthresh__44c7_s_p9_0[] = { + -3503.5, -2866.5, -2229.5, -1592.5, -955.5, -318.5, 318.5, 955.5, + 1592.5, 2229.5, 2866.5, 3503.5, +}; + +static long _vq_quantmap__44c7_s_p9_0[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__44c7_s_p9_0 = { + _vq_quantthresh__44c7_s_p9_0, + _vq_quantmap__44c7_s_p9_0, + 13, + 13 +}; + +static static_codebook _44c7_s_p9_0 = { + 2, 169, + _vq_lengthlist__44c7_s_p9_0, + 1, -511845376, 1630791680, 4, 0, + _vq_quantlist__44c7_s_p9_0, + NULL, + &_vq_auxt__44c7_s_p9_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c7_s_p9_1[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__44c7_s_p9_1[] = { + 1, 4, 4, 7, 7, 7, 7, 7, 6, 8, 8, 8, 8, 6, 6, 6, + 8, 8, 9, 8, 8, 7, 9, 8,11,10, 5, 6, 6, 8, 8, 9, + 8, 8, 8,10, 9,11,11,16, 8, 8, 9, 8, 9, 9, 9, 8, + 10, 9,11,10,16, 8, 8, 9, 9,10,10, 9, 9,10,10,11, + 11,16,13,13, 9, 9,10,10, 9,10,11,11,12,11,16,13, + 13, 9, 8,10, 9,10,10,10,10,11,11,16,14,16, 8, 9, + 9, 9,11,10,11,11,12,11,16,16,16, 9, 7,10, 7,11, + 10,11,11,12,11,16,16,16,12,12, 9,10,11,11,12,11, + 12,12,16,16,16,12,10,10, 7,11, 8,12,11,12,12,16, + 16,15,16,16,11,12,10,10,12,11,12,12,16,16,16,15, + 15,11,11,10,10,12,12,12,12, +}; + +static float _vq_quantthresh__44c7_s_p9_1[] = { + -269.5, -220.5, -171.5, -122.5, -73.5, -24.5, 24.5, 73.5, + 122.5, 171.5, 220.5, 269.5, +}; + +static long _vq_quantmap__44c7_s_p9_1[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__44c7_s_p9_1 = { + _vq_quantthresh__44c7_s_p9_1, + _vq_quantmap__44c7_s_p9_1, + 13, + 13 +}; + +static static_codebook _44c7_s_p9_1 = { + 2, 169, + _vq_lengthlist__44c7_s_p9_1, + 1, -518889472, 1622704128, 4, 0, + _vq_quantlist__44c7_s_p9_1, + NULL, + &_vq_auxt__44c7_s_p9_1, + NULL, + 0 +}; + +static long _vq_quantlist__44c7_s_p9_2[] = { + 24, + 23, + 25, + 22, + 26, + 21, + 27, + 20, + 28, + 19, + 29, + 18, + 30, + 17, + 31, + 16, + 32, + 15, + 33, + 14, + 34, + 13, + 35, + 12, + 36, + 11, + 37, + 10, + 38, + 9, + 39, + 8, + 40, + 7, + 41, + 6, + 42, + 5, + 43, + 4, + 44, + 3, + 45, + 2, + 46, + 1, + 47, + 0, + 48, +}; + +static long _vq_lengthlist__44c7_s_p9_2[] = { + 2, 4, 3, 4, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, +}; + +static float _vq_quantthresh__44c7_s_p9_2[] = { + -23.5, -22.5, -21.5, -20.5, -19.5, -18.5, -17.5, -16.5, + -15.5, -14.5, -13.5, -12.5, -11.5, -10.5, -9.5, -8.5, + -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, + 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, + 8.5, 9.5, 10.5, 11.5, 12.5, 13.5, 14.5, 15.5, + 16.5, 17.5, 18.5, 19.5, 20.5, 21.5, 22.5, 23.5, +}; + +static long _vq_quantmap__44c7_s_p9_2[] = { + 47, 45, 43, 41, 39, 37, 35, 33, + 31, 29, 27, 25, 23, 21, 19, 17, + 15, 13, 11, 9, 7, 5, 3, 1, + 0, 2, 4, 6, 8, 10, 12, 14, + 16, 18, 20, 22, 24, 26, 28, 30, + 32, 34, 36, 38, 40, 42, 44, 46, + 48, +}; + +static encode_aux_threshmatch _vq_auxt__44c7_s_p9_2 = { + _vq_quantthresh__44c7_s_p9_2, + _vq_quantmap__44c7_s_p9_2, + 49, + 49 +}; + +static static_codebook _44c7_s_p9_2 = { + 1, 49, + _vq_lengthlist__44c7_s_p9_2, + 1, -526909440, 1611661312, 6, 0, + _vq_quantlist__44c7_s_p9_2, + NULL, + &_vq_auxt__44c7_s_p9_2, + NULL, + 0 +}; + +static long _huff_lengthlist__44c7_s_short[] = { + 4,11,12,14,15,15,17,17,18,18, 5, 6, 6, 8, 9,10, + 13,17,18,19, 7, 5, 4, 6, 8, 9,11,15,19,19, 8, 6, + 5, 5, 6, 7,11,14,16,17, 9, 7, 7, 6, 7, 7,10,13, + 15,19,10, 8, 7, 6, 7, 6, 7, 9,14,16,12,10, 9, 7, + 7, 6, 4, 5,10,15,14,13,11, 7, 6, 6, 4, 2, 7,13, + 16,16,15, 9, 8, 8, 8, 6, 9,13,19,19,17,12,11,10, + 10, 9,11,14, +}; + +static static_codebook _huff_book__44c7_s_short = { + 2, 100, + _huff_lengthlist__44c7_s_short, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist__44c8_s_long[] = { + 3, 8,12,13,14,14,14,13,14,14, 6, 4, 5, 8,10,10, + 11,11,14,13, 9, 5, 4, 5, 7, 8, 9,10,13,13,12, 7, + 5, 4, 5, 6, 8, 9,12,13,13, 9, 6, 5, 5, 5, 7, 9, + 11,14,12,10, 7, 6, 5, 4, 6, 7,10,11,12,11, 9, 8, + 7, 5, 5, 6,10,10,13,12,10, 9, 8, 6, 6, 5, 8,10, + 14,13,12,12,11,10, 9, 7, 8,10,12,13,14,14,13,12, + 11, 9, 9,10, +}; + +static static_codebook _huff_book__44c8_s_long = { + 2, 100, + _huff_lengthlist__44c8_s_long, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _vq_quantlist__44c8_s_p1_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__44c8_s_p1_0[] = { + 1, 5, 5, 0, 5, 5, 0, 5, 5, 5, 7, 7, 0, 9, 8, 0, + 9, 8, 6, 7, 7, 0, 8, 9, 0, 8, 9, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 5, 9, 8, 0, 8, 8, 0, 8, 8, 5, 8, 9, + 0, 8, 8, 0, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, + 9, 8, 0, 8, 8, 0, 8, 8, 5, 8, 9, 0, 8, 8, 0, 8, + 8, +}; + +static float _vq_quantthresh__44c8_s_p1_0[] = { + -0.5, 0.5, +}; + +static long _vq_quantmap__44c8_s_p1_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__44c8_s_p1_0 = { + _vq_quantthresh__44c8_s_p1_0, + _vq_quantmap__44c8_s_p1_0, + 3, + 3 +}; + +static static_codebook _44c8_s_p1_0 = { + 4, 81, + _vq_lengthlist__44c8_s_p1_0, + 1, -535822336, 1611661312, 2, 0, + _vq_quantlist__44c8_s_p1_0, + NULL, + &_vq_auxt__44c8_s_p1_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c8_s_p2_0[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44c8_s_p2_0[] = { + 3, 5, 5, 8, 8, 0, 5, 5, 8, 8, 0, 5, 5, 8, 8, 0, + 7, 7, 9, 9, 0, 0, 0, 9, 9, 5, 7, 7, 9, 9, 0, 8, + 7,10, 9, 0, 8, 7,10, 9, 0,10,10,11,11, 0, 0, 0, + 11,11, 5, 7, 7, 9, 9, 0, 7, 8, 9,10, 0, 7, 8, 9, + 10, 0,10,10,11,11, 0, 0, 0,11,11, 8, 9, 9,11,10, + 0,11,10,12,11, 0,11,10,12,12, 0,13,13,14,14, 0, + 0, 0,14,13, 8, 9, 9,10,11, 0,10,11,12,12, 0,10, + 11,12,12, 0,13,13,14,14, 0, 0, 0,13,14, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 5, 8, 7,11,10, 0, 7, 7,10,10, + 0, 7, 7,10,10, 0, 9, 9,10,10, 0, 0, 0,11,10, 5, + 7, 8,10,11, 0, 7, 7,10,10, 0, 7, 7,10,10, 0, 9, + 9,10,10, 0, 0, 0,10,10, 8,10, 9,12,12, 0,10,10, + 12,11, 0,10,10,12,12, 0,12,12,13,12, 0, 0, 0,13, + 12, 8, 9,10,12,12, 0,10,10,11,12, 0,10,10,11,12, + 0,12,12,13,13, 0, 0, 0,12,13, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 6, 8, 7,11,10, 0, 7, 7,10,10, 0, 7, 7, + 10,10, 0, 9, 9,10,11, 0, 0, 0,10,10, 6, 7, 8,10, + 11, 0, 7, 7,10,10, 0, 7, 7,10,10, 0, 9, 9,10,10, + 0, 0, 0,10,10, 9,10, 9,12,12, 0,10,10,12,12, 0, + 10,10,12,11, 0,12,12,13,13, 0, 0, 0,13,12, 8, 9, + 10,12,12, 0,10,10,12,12, 0,10,10,11,12, 0,12,12, + 13,13, 0, 0, 0,12,13, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 7,10,10,13,13, 0, 9, 9,12,12, 0, 9, 9,12,12, 0, + 10,10,12,12, 0, 0, 0,12,12, 7,10,10,13,13, 0, 9, + 9,12,12, 0, 9, 9,12,12, 0,10,10,12,12, 0, 0, 0, + 12,12, 9,11,11,14,13, 0,10,10,13,12, 0,11,10,13, + 12, 0,12,12,13,12, 0, 0, 0,13,13, 9,11,11,13,14, + 0,10,11,12,13, 0,10,11,13,13, 0,12,12,12,13, 0, + 0, 0,13,13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, + 11,11,14,14, 0,10,11,13,13, 0,11,10,13,13, 0,11, + 12,13,13, 0, 0, 0,13,12, 9,11,11,14,14, 0,11,10, + 13,13, 0,10,11,13,13, 0,12,12,13,13, 0, 0, 0,12, + 13, +}; + +static float _vq_quantthresh__44c8_s_p2_0[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__44c8_s_p2_0[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44c8_s_p2_0 = { + _vq_quantthresh__44c8_s_p2_0, + _vq_quantmap__44c8_s_p2_0, + 5, + 5 +}; + +static static_codebook _44c8_s_p2_0 = { + 4, 625, + _vq_lengthlist__44c8_s_p2_0, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__44c8_s_p2_0, + NULL, + &_vq_auxt__44c8_s_p2_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c8_s_p3_0[] = { + 4, + 3, + 5, + 2, + 6, + 1, + 7, + 0, + 8, +}; + +static long _vq_lengthlist__44c8_s_p3_0[] = { + 2, 4, 4, 5, 5, 7, 7, 9, 9, 0, 4, 4, 6, 6, 7, 7, + 9, 9, 0, 4, 4, 6, 6, 7, 7, 9, 9, 0, 5, 5, 6, 6, + 8, 8,10,10, 0, 0, 0, 6, 6, 8, 8,10,10, 0, 0, 0, + 7, 7, 9, 9,10,10, 0, 0, 0, 7, 7, 8, 8,10,10, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + +static float _vq_quantthresh__44c8_s_p3_0[] = { + -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, +}; + +static long _vq_quantmap__44c8_s_p3_0[] = { + 7, 5, 3, 1, 0, 2, 4, 6, + 8, +}; + +static encode_aux_threshmatch _vq_auxt__44c8_s_p3_0 = { + _vq_quantthresh__44c8_s_p3_0, + _vq_quantmap__44c8_s_p3_0, + 9, + 9 +}; + +static static_codebook _44c8_s_p3_0 = { + 2, 81, + _vq_lengthlist__44c8_s_p3_0, + 1, -531628032, 1611661312, 4, 0, + _vq_quantlist__44c8_s_p3_0, + NULL, + &_vq_auxt__44c8_s_p3_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c8_s_p4_0[] = { + 8, + 7, + 9, + 6, + 10, + 5, + 11, + 4, + 12, + 3, + 13, + 2, + 14, + 1, + 15, + 0, + 16, +}; + +static long _vq_lengthlist__44c8_s_p4_0[] = { + 3, 4, 4, 5, 5, 7, 7, 8, 8, 8, 8, 9, 9,10,10,11, + 11, 0, 4, 4, 6, 6, 7, 7, 8, 8, 9, 8,10,10,11,11, + 11,11, 0, 4, 4, 6, 6, 7, 7, 8, 8, 9, 9,10,10,11, + 11,11,11, 0, 6, 5, 6, 6, 7, 7, 9, 9, 9, 9,10,10, + 11,11,12,12, 0, 0, 0, 6, 6, 7, 7, 9, 9, 9, 9,10, + 10,11,11,12,12, 0, 0, 0, 7, 7, 8, 8, 9, 9,10,10, + 11,11,11,12,12,12, 0, 0, 0, 7, 7, 8, 8, 9, 9,10, + 10,11,11,11,12,12,12, 0, 0, 0, 7, 7, 8, 8, 9, 9, + 10,10,11,11,12,12,13,13, 0, 0, 0, 0, 0, 8, 8, 9, + 9,10,10,11,11,12,12,13,13, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + +static float _vq_quantthresh__44c8_s_p4_0[] = { + -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, + 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, +}; + +static long _vq_quantmap__44c8_s_p4_0[] = { + 15, 13, 11, 9, 7, 5, 3, 1, + 0, 2, 4, 6, 8, 10, 12, 14, + 16, +}; + +static encode_aux_threshmatch _vq_auxt__44c8_s_p4_0 = { + _vq_quantthresh__44c8_s_p4_0, + _vq_quantmap__44c8_s_p4_0, + 17, + 17 +}; + +static static_codebook _44c8_s_p4_0 = { + 2, 289, + _vq_lengthlist__44c8_s_p4_0, + 1, -529530880, 1611661312, 5, 0, + _vq_quantlist__44c8_s_p4_0, + NULL, + &_vq_auxt__44c8_s_p4_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c8_s_p5_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__44c8_s_p5_0[] = { + 1, 4, 4, 5, 7, 7, 6, 7, 7, 4, 7, 6,10,10,10,10, + 10,10, 4, 6, 6,10,10,10,10, 9,10, 5,10,10, 9,11, + 11,10,11,11, 7,10,10,11,12,12,12,12,12, 7,10,10, + 11,12,12,12,12,12, 6,10,10,10,12,12,10,12,12, 7, + 10,10,11,12,12,12,12,12, 7,10,10,11,12,12,12,12, + 12, +}; + +static float _vq_quantthresh__44c8_s_p5_0[] = { + -5.5, 5.5, +}; + +static long _vq_quantmap__44c8_s_p5_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__44c8_s_p5_0 = { + _vq_quantthresh__44c8_s_p5_0, + _vq_quantmap__44c8_s_p5_0, + 3, + 3 +}; + +static static_codebook _44c8_s_p5_0 = { + 4, 81, + _vq_lengthlist__44c8_s_p5_0, + 1, -529137664, 1618345984, 2, 0, + _vq_quantlist__44c8_s_p5_0, + NULL, + &_vq_auxt__44c8_s_p5_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c8_s_p5_1[] = { + 5, + 4, + 6, + 3, + 7, + 2, + 8, + 1, + 9, + 0, + 10, +}; + +static long _vq_lengthlist__44c8_s_p5_1[] = { + 3, 5, 5, 6, 6, 7, 7, 8, 8, 8, 8,11, 4, 5, 6, 6, + 7, 7, 8, 8, 8, 8,11, 5, 5, 6, 6, 7, 7, 8, 8, 8, + 9,12, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9,12,12,12, 6, + 6, 7, 7, 8, 8, 9, 9,11,11,11, 6, 6, 7, 7, 8, 8, + 8, 8,11,11,11, 6, 6, 7, 7, 8, 8, 8, 8,11,11,11, + 7, 7, 7, 8, 8, 8, 8, 8,11,11,11,11,11, 7, 7, 8, + 8, 8, 8,11,11,11,11,11, 7, 7, 7, 7, 8, 8,11,11, + 11,11,11, 7, 7, 7, 7, 8, 8, +}; + +static float _vq_quantthresh__44c8_s_p5_1[] = { + -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, + 3.5, 4.5, +}; + +static long _vq_quantmap__44c8_s_p5_1[] = { + 9, 7, 5, 3, 1, 0, 2, 4, + 6, 8, 10, +}; + +static encode_aux_threshmatch _vq_auxt__44c8_s_p5_1 = { + _vq_quantthresh__44c8_s_p5_1, + _vq_quantmap__44c8_s_p5_1, + 11, + 11 +}; + +static static_codebook _44c8_s_p5_1 = { + 2, 121, + _vq_lengthlist__44c8_s_p5_1, + 1, -531365888, 1611661312, 4, 0, + _vq_quantlist__44c8_s_p5_1, + NULL, + &_vq_auxt__44c8_s_p5_1, + NULL, + 0 +}; + +static long _vq_quantlist__44c8_s_p6_0[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__44c8_s_p6_0[] = { + 1, 4, 4, 6, 6, 7, 7, 8, 8, 9, 9,10,10, 6, 5, 5, + 7, 7, 8, 8, 9, 9,10,10,11,11, 6, 5, 5, 7, 7, 8, + 8, 9, 9,10,10,11,11, 0, 7, 7, 7, 7, 9, 9,10,10, + 10,10,11,11, 0, 7, 7, 7, 7, 9, 9,10,10,10,10,11, + 11, 0,11,11, 9, 9,10,10,11,11,11,11,12,12, 0,12, + 12, 9, 9,10,10,11,11,12,12,12,12, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, +}; + +static float _vq_quantthresh__44c8_s_p6_0[] = { + -27.5, -22.5, -17.5, -12.5, -7.5, -2.5, 2.5, 7.5, + 12.5, 17.5, 22.5, 27.5, +}; + +static long _vq_quantmap__44c8_s_p6_0[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__44c8_s_p6_0 = { + _vq_quantthresh__44c8_s_p6_0, + _vq_quantmap__44c8_s_p6_0, + 13, + 13 +}; + +static static_codebook _44c8_s_p6_0 = { + 2, 169, + _vq_lengthlist__44c8_s_p6_0, + 1, -526516224, 1616117760, 4, 0, + _vq_quantlist__44c8_s_p6_0, + NULL, + &_vq_auxt__44c8_s_p6_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c8_s_p6_1[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44c8_s_p6_1[] = { + 3, 4, 4, 5, 5, 5, 4, 4, 5, 5, 5, 4, 4, 5, 5, 6, + 5, 5, 5, 5, 6, 6, 6, 5, 5, +}; + +static float _vq_quantthresh__44c8_s_p6_1[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__44c8_s_p6_1[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44c8_s_p6_1 = { + _vq_quantthresh__44c8_s_p6_1, + _vq_quantmap__44c8_s_p6_1, + 5, + 5 +}; + +static static_codebook _44c8_s_p6_1 = { + 2, 25, + _vq_lengthlist__44c8_s_p6_1, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__44c8_s_p6_1, + NULL, + &_vq_auxt__44c8_s_p6_1, + NULL, + 0 +}; + +static long _vq_quantlist__44c8_s_p7_0[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__44c8_s_p7_0[] = { + 1, 4, 4, 6, 6, 8, 7, 9, 9,10,10,12,12, 6, 5, 5, + 7, 7, 8, 8,10,10,11,11,12,12, 7, 5, 5, 7, 7, 8, + 8,10,10,11,11,12,12,21, 7, 7, 7, 7, 8, 9,10,10, + 11,11,12,12,21, 7, 7, 7, 7, 9, 9,10,10,12,12,13, + 13,21,11,11, 8, 8, 9, 9,11,11,12,12,13,13,21,11, + 11, 8, 8, 9, 9,11,11,12,12,13,13,21,21,21,10,10, + 10,10,11,11,12,13,13,13,21,21,21,10,10,10,10,11, + 11,13,13,14,13,21,21,21,13,13,11,11,12,12,13,13, + 14,14,21,21,21,14,14,11,11,12,12,13,13,14,14,21, + 21,21,21,20,13,13,13,12,14,14,16,15,20,20,20,20, + 20,13,13,13,13,14,13,15,15, +}; + +static float _vq_quantthresh__44c8_s_p7_0[] = { + -60.5, -49.5, -38.5, -27.5, -16.5, -5.5, 5.5, 16.5, + 27.5, 38.5, 49.5, 60.5, +}; + +static long _vq_quantmap__44c8_s_p7_0[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__44c8_s_p7_0 = { + _vq_quantthresh__44c8_s_p7_0, + _vq_quantmap__44c8_s_p7_0, + 13, + 13 +}; + +static static_codebook _44c8_s_p7_0 = { + 2, 169, + _vq_lengthlist__44c8_s_p7_0, + 1, -523206656, 1618345984, 4, 0, + _vq_quantlist__44c8_s_p7_0, + NULL, + &_vq_auxt__44c8_s_p7_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c8_s_p7_1[] = { + 5, + 4, + 6, + 3, + 7, + 2, + 8, + 1, + 9, + 0, + 10, +}; + +static long _vq_lengthlist__44c8_s_p7_1[] = { + 4, 5, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 6, 6, 6, 7, + 7, 7, 7, 7, 7, 7, 8, 6, 6, 6, 6, 7, 7, 7, 7, 7, + 7, 8, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 7, + 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 7, 7, 7, 7, 7, 7, + 7, 7, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, + 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 7, 7, 7, + 7, 7, 7, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 8, 8, + 8, 8, 8, 7, 7, 7, 7, 7, 7, +}; + +static float _vq_quantthresh__44c8_s_p7_1[] = { + -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, + 3.5, 4.5, +}; + +static long _vq_quantmap__44c8_s_p7_1[] = { + 9, 7, 5, 3, 1, 0, 2, 4, + 6, 8, 10, +}; + +static encode_aux_threshmatch _vq_auxt__44c8_s_p7_1 = { + _vq_quantthresh__44c8_s_p7_1, + _vq_quantmap__44c8_s_p7_1, + 11, + 11 +}; + +static static_codebook _44c8_s_p7_1 = { + 2, 121, + _vq_lengthlist__44c8_s_p7_1, + 1, -531365888, 1611661312, 4, 0, + _vq_quantlist__44c8_s_p7_1, + NULL, + &_vq_auxt__44c8_s_p7_1, + NULL, + 0 +}; + +static long _vq_quantlist__44c8_s_p8_0[] = { + 7, + 6, + 8, + 5, + 9, + 4, + 10, + 3, + 11, + 2, + 12, + 1, + 13, + 0, + 14, +}; + +static long _vq_lengthlist__44c8_s_p8_0[] = { + 1, 4, 4, 7, 6, 8, 8, 8, 7, 9, 8,10,10,11,10, 6, + 5, 5, 7, 7, 9, 9, 8, 8,10,10,11,11,12,11, 6, 5, + 5, 7, 7, 9, 9, 9, 9,10,10,11,11,12,12,20, 8, 8, + 8, 8, 9, 9, 9, 9,10,10,11,11,12,12,20, 8, 8, 8, + 8,10, 9, 9, 9,10,10,11,11,12,12,20,12,12, 9, 9, + 10,10,10,10,10,11,12,12,12,12,20,12,12, 9, 9,10, + 10,10,10,11,11,12,12,13,13,20,20,20, 9, 9, 9, 9, + 11,10,11,11,12,12,12,13,20,19,19, 9, 9, 9, 9,11, + 11,11,12,12,12,13,13,19,19,19,13,13,10,10,11,11, + 12,12,13,13,13,13,19,19,19,14,13,11,10,11,11,12, + 12,12,13,13,13,19,19,19,19,19,12,12,12,12,13,13, + 13,13,14,13,19,19,19,19,19,12,12,12,11,12,12,13, + 14,14,14,19,19,19,19,19,16,15,13,12,13,13,13,14, + 14,14,19,19,19,19,19,17,17,13,12,13,11,14,13,15, + 15, +}; + +static float _vq_quantthresh__44c8_s_p8_0[] = { + -136.5, -115.5, -94.5, -73.5, -52.5, -31.5, -10.5, 10.5, + 31.5, 52.5, 73.5, 94.5, 115.5, 136.5, +}; + +static long _vq_quantmap__44c8_s_p8_0[] = { + 13, 11, 9, 7, 5, 3, 1, 0, + 2, 4, 6, 8, 10, 12, 14, +}; + +static encode_aux_threshmatch _vq_auxt__44c8_s_p8_0 = { + _vq_quantthresh__44c8_s_p8_0, + _vq_quantmap__44c8_s_p8_0, + 15, + 15 +}; + +static static_codebook _44c8_s_p8_0 = { + 2, 225, + _vq_lengthlist__44c8_s_p8_0, + 1, -520986624, 1620377600, 4, 0, + _vq_quantlist__44c8_s_p8_0, + NULL, + &_vq_auxt__44c8_s_p8_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c8_s_p8_1[] = { + 10, + 9, + 11, + 8, + 12, + 7, + 13, + 6, + 14, + 5, + 15, + 4, + 16, + 3, + 17, + 2, + 18, + 1, + 19, + 0, + 20, +}; + +static long _vq_lengthlist__44c8_s_p8_1[] = { + 4, 5, 5, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8,10, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10, 6, 6, 7, 7, 8, + 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10, + 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9,10,10,10, 8, 8, 8, 8, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10, 8, 8, 8, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10, + 10, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9,10,10,10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9,10,10,10,10,10, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10, + 10,10, 9, 9, 9, 9, 9, 9, 9, 9,10, 9, 9, 9, 9, 9, + 9, 9,10,10,10,10,10, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9,10,10,10,10,10, 9, 9, 9, 9, + 9, 9, 9, 9,10,10,10, 9, 9, 9, 9, 9,10,10,10,10, + 10,10,10, 9, 9, 9, 9, 9,10,10,10, 9, 9, 9, 9, 9, + 9,10,10,10,10,10,10,10, 9,10,10, 9,10,10,10,10, + 9,10, 9,10,10, 9,10,10,10,10,10,10,10, 9,10,10, + 10,10,10,10, 9, 9,10,10, 9,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10, 9, 9, 9,10, 9, 9, 9, 9, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10, 9, 9, + 10, 9,10, 9,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10, 9, 9,10, 9, 9, 9,10,10,10,10,10,10, + 10,10,10,10,10, 9, 9, 9, 9, 9, 9,10, 9, 9,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10, 9,10, 9, + 9,10, 9, 9,10,10,10,10,10,10,10,10,10,10,10,10, + 10, 9, 9,10,10, 9,10, 9, 9, +}; + +static float _vq_quantthresh__44c8_s_p8_1[] = { + -9.5, -8.5, -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, + -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, + 6.5, 7.5, 8.5, 9.5, +}; + +static long _vq_quantmap__44c8_s_p8_1[] = { + 19, 17, 15, 13, 11, 9, 7, 5, + 3, 1, 0, 2, 4, 6, 8, 10, + 12, 14, 16, 18, 20, +}; + +static encode_aux_threshmatch _vq_auxt__44c8_s_p8_1 = { + _vq_quantthresh__44c8_s_p8_1, + _vq_quantmap__44c8_s_p8_1, + 21, + 21 +}; + +static static_codebook _44c8_s_p8_1 = { + 2, 441, + _vq_lengthlist__44c8_s_p8_1, + 1, -529268736, 1611661312, 5, 0, + _vq_quantlist__44c8_s_p8_1, + NULL, + &_vq_auxt__44c8_s_p8_1, + NULL, + 0 +}; + +static long _vq_quantlist__44c8_s_p9_0[] = { + 8, + 7, + 9, + 6, + 10, + 5, + 11, + 4, + 12, + 3, + 13, + 2, + 14, + 1, + 15, + 0, + 16, +}; + +static long _vq_lengthlist__44c8_s_p9_0[] = { + 1, 4, 3,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11, 4, 7, 7,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11, 4, 8,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10, +}; + +static float _vq_quantthresh__44c8_s_p9_0[] = { + -6982.5, -6051.5, -5120.5, -4189.5, -3258.5, -2327.5, -1396.5, -465.5, + 465.5, 1396.5, 2327.5, 3258.5, 4189.5, 5120.5, 6051.5, 6982.5, +}; + +static long _vq_quantmap__44c8_s_p9_0[] = { + 15, 13, 11, 9, 7, 5, 3, 1, + 0, 2, 4, 6, 8, 10, 12, 14, + 16, +}; + +static encode_aux_threshmatch _vq_auxt__44c8_s_p9_0 = { + _vq_quantthresh__44c8_s_p9_0, + _vq_quantmap__44c8_s_p9_0, + 17, + 17 +}; + +static static_codebook _44c8_s_p9_0 = { + 2, 289, + _vq_lengthlist__44c8_s_p9_0, + 1, -509798400, 1631393792, 5, 0, + _vq_quantlist__44c8_s_p9_0, + NULL, + &_vq_auxt__44c8_s_p9_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c8_s_p9_1[] = { + 9, + 8, + 10, + 7, + 11, + 6, + 12, + 5, + 13, + 4, + 14, + 3, + 15, + 2, + 16, + 1, + 17, + 0, + 18, +}; + +static long _vq_lengthlist__44c8_s_p9_1[] = { + 1, 4, 4, 7, 6, 7, 7, 7, 7, 8, 8, 9, 9,10,10,10, + 10,11,11, 6, 6, 6, 8, 8, 9, 8, 8, 7,10, 8,11,10, + 12,11,12,12,13,13, 5, 5, 6, 8, 8, 9, 9, 8, 8,10, + 9,11,11,12,12,13,13,13,13,17, 8, 8, 9, 9, 9, 9, + 9, 9,10, 9,12,10,12,12,13,12,13,13,17, 9, 8, 9, + 9, 9, 9, 9, 9,10,10,12,12,12,12,13,13,13,13,17, + 13,13, 9, 9,10,10,10,10,11,11,12,11,13,12,13,13, + 14,15,17,13,13, 9, 8,10, 9,10,10,11,11,12,12,14, + 13,15,13,14,15,17,17,17, 9,10, 9,10,11,11,12,12, + 12,12,13,13,14,14,15,15,17,17,17, 9, 8, 9, 8,11, + 11,12,12,12,12,14,13,14,14,14,15,17,17,17,12,14, + 9,10,11,11,12,12,14,13,13,14,15,13,15,15,17,17, + 17,13,11,10, 8,11, 9,13,12,13,13,13,13,13,14,14, + 14,17,17,17,17,17,11,12,11,11,13,13,14,13,15,14, + 13,15,16,15,17,17,17,17,17,11,11,12, 8,13,12,14, + 13,17,14,15,14,15,14,17,17,17,17,17,15,15,12,12, + 12,12,13,14,14,14,15,14,17,14,17,17,17,17,17,16, + 17,12,12,13,12,13,13,14,14,14,14,14,14,17,17,17, + 17,17,17,17,14,14,13,12,13,13,15,15,14,13,15,17, + 17,17,17,17,17,17,17,13,14,13,13,13,13,14,15,15, + 15,14,15,17,17,17,17,17,17,17,16,15,13,14,13,13, + 14,14,15,14,14,16,17,17,17,17,17,17,17,16,16,13, + 14,13,13,14,14,15,14,15,14, +}; + +static float _vq_quantthresh__44c8_s_p9_1[] = { + -416.5, -367.5, -318.5, -269.5, -220.5, -171.5, -122.5, -73.5, + -24.5, 24.5, 73.5, 122.5, 171.5, 220.5, 269.5, 318.5, + 367.5, 416.5, +}; + +static long _vq_quantmap__44c8_s_p9_1[] = { + 17, 15, 13, 11, 9, 7, 5, 3, + 1, 0, 2, 4, 6, 8, 10, 12, + 14, 16, 18, +}; + +static encode_aux_threshmatch _vq_auxt__44c8_s_p9_1 = { + _vq_quantthresh__44c8_s_p9_1, + _vq_quantmap__44c8_s_p9_1, + 19, + 19 +}; + +static static_codebook _44c8_s_p9_1 = { + 2, 361, + _vq_lengthlist__44c8_s_p9_1, + 1, -518287360, 1622704128, 5, 0, + _vq_quantlist__44c8_s_p9_1, + NULL, + &_vq_auxt__44c8_s_p9_1, + NULL, + 0 +}; + +static long _vq_quantlist__44c8_s_p9_2[] = { + 24, + 23, + 25, + 22, + 26, + 21, + 27, + 20, + 28, + 19, + 29, + 18, + 30, + 17, + 31, + 16, + 32, + 15, + 33, + 14, + 34, + 13, + 35, + 12, + 36, + 11, + 37, + 10, + 38, + 9, + 39, + 8, + 40, + 7, + 41, + 6, + 42, + 5, + 43, + 4, + 44, + 3, + 45, + 2, + 46, + 1, + 47, + 0, + 48, +}; + +static long _vq_lengthlist__44c8_s_p9_2[] = { + 2, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, +}; + +static float _vq_quantthresh__44c8_s_p9_2[] = { + -23.5, -22.5, -21.5, -20.5, -19.5, -18.5, -17.5, -16.5, + -15.5, -14.5, -13.5, -12.5, -11.5, -10.5, -9.5, -8.5, + -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, + 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, + 8.5, 9.5, 10.5, 11.5, 12.5, 13.5, 14.5, 15.5, + 16.5, 17.5, 18.5, 19.5, 20.5, 21.5, 22.5, 23.5, +}; + +static long _vq_quantmap__44c8_s_p9_2[] = { + 47, 45, 43, 41, 39, 37, 35, 33, + 31, 29, 27, 25, 23, 21, 19, 17, + 15, 13, 11, 9, 7, 5, 3, 1, + 0, 2, 4, 6, 8, 10, 12, 14, + 16, 18, 20, 22, 24, 26, 28, 30, + 32, 34, 36, 38, 40, 42, 44, 46, + 48, +}; + +static encode_aux_threshmatch _vq_auxt__44c8_s_p9_2 = { + _vq_quantthresh__44c8_s_p9_2, + _vq_quantmap__44c8_s_p9_2, + 49, + 49 +}; + +static static_codebook _44c8_s_p9_2 = { + 1, 49, + _vq_lengthlist__44c8_s_p9_2, + 1, -526909440, 1611661312, 6, 0, + _vq_quantlist__44c8_s_p9_2, + NULL, + &_vq_auxt__44c8_s_p9_2, + NULL, + 0 +}; + +static long _huff_lengthlist__44c8_s_short[] = { + 4,11,13,14,15,15,18,17,19,17, 5, 6, 8, 9,10,10, + 12,15,19,19, 6, 6, 6, 6, 8, 8,11,14,18,19, 8, 6, + 5, 4, 6, 7,10,13,16,17, 9, 7, 6, 5, 6, 7, 9,12, + 15,19,10, 8, 7, 6, 6, 6, 7, 9,13,15,12,10, 9, 8, + 7, 6, 4, 5,10,15,13,13,11, 8, 6, 6, 4, 2, 7,12, + 17,15,16,10, 8, 8, 7, 6, 9,12,19,18,17,13,11,10, + 10, 9,11,14, +}; + +static static_codebook _huff_book__44c8_s_short = { + 2, 100, + _huff_lengthlist__44c8_s_short, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist__44c9_s_long[] = { + 3, 8,12,14,15,15,15,13,15,15, 6, 5, 8,10,12,12, + 13,12,14,13,10, 6, 5, 6, 8, 9,11,11,13,13,13, 8, + 5, 4, 5, 6, 8,10,11,13,14,10, 7, 5, 4, 5, 7, 9, + 11,12,13,11, 8, 6, 5, 4, 5, 7, 9,11,12,11,10, 8, + 7, 5, 4, 5, 9,10,13,13,11,10, 8, 6, 5, 4, 7, 9, + 15,14,13,12,10, 9, 8, 7, 8, 9,12,12,14,13,12,11, + 10, 9, 8, 9, +}; + +static static_codebook _huff_book__44c9_s_long = { + 2, 100, + _huff_lengthlist__44c9_s_long, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _vq_quantlist__44c9_s_p1_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__44c9_s_p1_0[] = { + 1, 5, 5, 0, 5, 5, 0, 5, 5, 6, 8, 8, 0, 9, 8, 0, + 9, 8, 6, 8, 8, 0, 8, 9, 0, 8, 9, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 5, 8, 8, 0, 7, 7, 0, 8, 8, 5, 8, 8, + 0, 7, 8, 0, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, + 9, 8, 0, 8, 8, 0, 7, 7, 5, 8, 9, 0, 8, 8, 0, 7, + 7, +}; + +static float _vq_quantthresh__44c9_s_p1_0[] = { + -0.5, 0.5, +}; + +static long _vq_quantmap__44c9_s_p1_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__44c9_s_p1_0 = { + _vq_quantthresh__44c9_s_p1_0, + _vq_quantmap__44c9_s_p1_0, + 3, + 3 +}; + +static static_codebook _44c9_s_p1_0 = { + 4, 81, + _vq_lengthlist__44c9_s_p1_0, + 1, -535822336, 1611661312, 2, 0, + _vq_quantlist__44c9_s_p1_0, + NULL, + &_vq_auxt__44c9_s_p1_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c9_s_p2_0[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44c9_s_p2_0[] = { + 3, 5, 5, 8, 8, 0, 5, 5, 8, 8, 0, 5, 5, 8, 8, 0, + 7, 7, 9, 9, 0, 0, 0, 9, 9, 6, 7, 7, 9, 8, 0, 8, + 8, 9, 9, 0, 8, 7, 9, 9, 0, 9,10,10,10, 0, 0, 0, + 11,10, 6, 7, 7, 8, 9, 0, 8, 8, 9, 9, 0, 7, 8, 9, + 9, 0,10, 9,11,10, 0, 0, 0,10,10, 8, 9, 8,10,10, + 0,10,10,12,11, 0,10,10,11,11, 0,12,13,13,13, 0, + 0, 0,13,12, 8, 8, 9,10,10, 0,10,10,11,12, 0,10, + 10,11,11, 0,13,12,13,13, 0, 0, 0,13,13, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 6, 8, 7,10,10, 0, 7, 7,10, 9, + 0, 7, 7,10,10, 0, 9, 9,10,10, 0, 0, 0,10,10, 6, + 7, 8,10,10, 0, 7, 7, 9,10, 0, 7, 7,10,10, 0, 9, + 9,10,10, 0, 0, 0,10,10, 8, 9, 9,11,11, 0,10,10, + 11,11, 0,10,10,11,11, 0,12,12,12,12, 0, 0, 0,12, + 12, 8, 9,10,11,11, 0, 9,10,11,11, 0,10,10,11,11, + 0,12,12,12,12, 0, 0, 0,12,12, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 5, 8, 7,10,10, 0, 7, 7,10,10, 0, 7, 7, + 10, 9, 0, 9, 9,10,10, 0, 0, 0,10,10, 6, 7, 8,10, + 10, 0, 7, 7,10,10, 0, 7, 7, 9,10, 0, 9, 9,10,10, + 0, 0, 0,10,10, 8,10, 9,12,11, 0,10,10,12,11, 0, + 10, 9,11,11, 0,11,12,12,12, 0, 0, 0,12,12, 8, 9, + 10,11,12, 0,10,10,11,11, 0, 9,10,11,11, 0,12,11, + 12,12, 0, 0, 0,12,12, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 7,10, 9,12,12, 0, 9, 9,12,11, 0, 9, 9,11,11, 0, + 10,10,12,11, 0, 0, 0,11,12, 7, 9,10,12,12, 0, 9, + 9,11,12, 0, 9, 9,11,11, 0,10,10,11,12, 0, 0, 0, + 11,11, 9,11,10,13,12, 0,10,10,12,12, 0,10,10,12, + 12, 0,11,11,12,12, 0, 0, 0,13,12, 9,10,11,12,13, + 0,10,10,12,12, 0,10,10,12,12, 0,11,12,12,12, 0, + 0, 0,12,13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, + 11,10,13,13, 0,10,10,12,12, 0,10,10,12,12, 0,11, + 12,12,12, 0, 0, 0,12,12, 9,10,11,13,13, 0,10,10, + 12,12, 0,10,10,12,12, 0,12,11,13,12, 0, 0, 0,12, + 12, +}; + +static float _vq_quantthresh__44c9_s_p2_0[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__44c9_s_p2_0[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44c9_s_p2_0 = { + _vq_quantthresh__44c9_s_p2_0, + _vq_quantmap__44c9_s_p2_0, + 5, + 5 +}; + +static static_codebook _44c9_s_p2_0 = { + 4, 625, + _vq_lengthlist__44c9_s_p2_0, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__44c9_s_p2_0, + NULL, + &_vq_auxt__44c9_s_p2_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c9_s_p3_0[] = { + 4, + 3, + 5, + 2, + 6, + 1, + 7, + 0, + 8, +}; + +static long _vq_lengthlist__44c9_s_p3_0[] = { + 3, 4, 4, 5, 5, 6, 6, 8, 8, 0, 4, 4, 5, 5, 6, 7, + 8, 8, 0, 4, 4, 5, 5, 7, 7, 8, 8, 0, 5, 5, 6, 6, + 7, 7, 9, 9, 0, 0, 0, 6, 6, 7, 7, 9, 9, 0, 0, 0, + 7, 7, 8, 8, 9, 9, 0, 0, 0, 7, 7, 8, 8, 9, 9, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + +static float _vq_quantthresh__44c9_s_p3_0[] = { + -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, +}; + +static long _vq_quantmap__44c9_s_p3_0[] = { + 7, 5, 3, 1, 0, 2, 4, 6, + 8, +}; + +static encode_aux_threshmatch _vq_auxt__44c9_s_p3_0 = { + _vq_quantthresh__44c9_s_p3_0, + _vq_quantmap__44c9_s_p3_0, + 9, + 9 +}; + +static static_codebook _44c9_s_p3_0 = { + 2, 81, + _vq_lengthlist__44c9_s_p3_0, + 1, -531628032, 1611661312, 4, 0, + _vq_quantlist__44c9_s_p3_0, + NULL, + &_vq_auxt__44c9_s_p3_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c9_s_p4_0[] = { + 8, + 7, + 9, + 6, + 10, + 5, + 11, + 4, + 12, + 3, + 13, + 2, + 14, + 1, + 15, + 0, + 16, +}; + +static long _vq_lengthlist__44c9_s_p4_0[] = { + 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9,10,10,10, + 10, 0, 5, 4, 5, 5, 7, 7, 8, 8, 8, 8, 9, 9,10,10, + 11,11, 0, 5, 5, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9,10, + 10,11,11, 0, 6, 5, 6, 6, 7, 7, 8, 8, 9, 9,10,10, + 11,11,11,12, 0, 0, 0, 6, 6, 7, 7, 8, 8, 9, 9,10, + 10,11,11,12,12, 0, 0, 0, 7, 7, 7, 7, 9, 9, 9, 9, + 10,10,11,11,12,12, 0, 0, 0, 7, 7, 7, 8, 9, 9, 9, + 9,10,10,11,11,12,12, 0, 0, 0, 7, 7, 8, 8, 9, 9, + 10,10,11,11,12,12,13,13, 0, 0, 0, 0, 0, 8, 8, 9, + 9,10,10,11,11,12,12,12,12, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + +static float _vq_quantthresh__44c9_s_p4_0[] = { + -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, + 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, +}; + +static long _vq_quantmap__44c9_s_p4_0[] = { + 15, 13, 11, 9, 7, 5, 3, 1, + 0, 2, 4, 6, 8, 10, 12, 14, + 16, +}; + +static encode_aux_threshmatch _vq_auxt__44c9_s_p4_0 = { + _vq_quantthresh__44c9_s_p4_0, + _vq_quantmap__44c9_s_p4_0, + 17, + 17 +}; + +static static_codebook _44c9_s_p4_0 = { + 2, 289, + _vq_lengthlist__44c9_s_p4_0, + 1, -529530880, 1611661312, 5, 0, + _vq_quantlist__44c9_s_p4_0, + NULL, + &_vq_auxt__44c9_s_p4_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c9_s_p5_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__44c9_s_p5_0[] = { + 1, 4, 4, 5, 7, 7, 6, 7, 7, 4, 7, 6, 9,10,10,10, + 10, 9, 4, 6, 7, 9,10,10,10, 9,10, 5, 9, 9, 9,11, + 11,10,11,11, 7,10, 9,11,12,11,12,12,12, 7, 9,10, + 11,11,12,12,12,12, 6,10,10,10,12,12,10,12,11, 7, + 10,10,11,12,12,11,12,12, 7,10,10,11,12,12,12,12, + 12, +}; + +static float _vq_quantthresh__44c9_s_p5_0[] = { + -5.5, 5.5, +}; + +static long _vq_quantmap__44c9_s_p5_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__44c9_s_p5_0 = { + _vq_quantthresh__44c9_s_p5_0, + _vq_quantmap__44c9_s_p5_0, + 3, + 3 +}; + +static static_codebook _44c9_s_p5_0 = { + 4, 81, + _vq_lengthlist__44c9_s_p5_0, + 1, -529137664, 1618345984, 2, 0, + _vq_quantlist__44c9_s_p5_0, + NULL, + &_vq_auxt__44c9_s_p5_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c9_s_p5_1[] = { + 5, + 4, + 6, + 3, + 7, + 2, + 8, + 1, + 9, + 0, + 10, +}; + +static long _vq_lengthlist__44c9_s_p5_1[] = { + 4, 5, 5, 6, 6, 7, 7, 7, 7, 7, 7,11, 5, 5, 6, 6, + 7, 7, 7, 7, 8, 8,11, 5, 5, 6, 6, 7, 7, 7, 7, 8, + 8,11, 5, 5, 6, 6, 7, 7, 8, 8, 8, 8,11,11,11, 6, + 6, 7, 7, 7, 8, 8, 8,11,11,11, 6, 6, 7, 7, 7, 8, + 8, 8,11,11,11, 6, 6, 7, 7, 7, 7, 8, 8,11,11,11, + 7, 7, 7, 7, 7, 7, 8, 8,11,11,11,10,10, 7, 7, 7, + 7, 8, 8,11,11,11,11,11, 7, 7, 7, 7, 7, 7,11,11, + 11,11,11, 7, 7, 7, 7, 7, 7, +}; + +static float _vq_quantthresh__44c9_s_p5_1[] = { + -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, + 3.5, 4.5, +}; + +static long _vq_quantmap__44c9_s_p5_1[] = { + 9, 7, 5, 3, 1, 0, 2, 4, + 6, 8, 10, +}; + +static encode_aux_threshmatch _vq_auxt__44c9_s_p5_1 = { + _vq_quantthresh__44c9_s_p5_1, + _vq_quantmap__44c9_s_p5_1, + 11, + 11 +}; + +static static_codebook _44c9_s_p5_1 = { + 2, 121, + _vq_lengthlist__44c9_s_p5_1, + 1, -531365888, 1611661312, 4, 0, + _vq_quantlist__44c9_s_p5_1, + NULL, + &_vq_auxt__44c9_s_p5_1, + NULL, + 0 +}; + +static long _vq_quantlist__44c9_s_p6_0[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__44c9_s_p6_0[] = { + 2, 4, 4, 6, 6, 7, 7, 7, 7, 8, 8, 9, 9, 5, 4, 4, + 6, 6, 8, 8, 9, 9, 9, 9,10,10, 6, 4, 4, 6, 6, 8, + 8, 9, 9, 9, 9,10,10, 0, 6, 6, 7, 7, 8, 8, 9, 9, + 10,10,11,11, 0, 6, 6, 7, 7, 8, 8, 9, 9,10,10,11, + 11, 0,10,10, 8, 8, 9, 9,10,10,11,11,12,12, 0,11, + 11, 8, 8, 9, 9,10,10,11,11,12,12, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, +}; + +static float _vq_quantthresh__44c9_s_p6_0[] = { + -27.5, -22.5, -17.5, -12.5, -7.5, -2.5, 2.5, 7.5, + 12.5, 17.5, 22.5, 27.5, +}; + +static long _vq_quantmap__44c9_s_p6_0[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__44c9_s_p6_0 = { + _vq_quantthresh__44c9_s_p6_0, + _vq_quantmap__44c9_s_p6_0, + 13, + 13 +}; + +static static_codebook _44c9_s_p6_0 = { + 2, 169, + _vq_lengthlist__44c9_s_p6_0, + 1, -526516224, 1616117760, 4, 0, + _vq_quantlist__44c9_s_p6_0, + NULL, + &_vq_auxt__44c9_s_p6_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c9_s_p6_1[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44c9_s_p6_1[] = { + 4, 4, 4, 5, 5, 5, 4, 4, 5, 5, 5, 4, 4, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, +}; + +static float _vq_quantthresh__44c9_s_p6_1[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__44c9_s_p6_1[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44c9_s_p6_1 = { + _vq_quantthresh__44c9_s_p6_1, + _vq_quantmap__44c9_s_p6_1, + 5, + 5 +}; + +static static_codebook _44c9_s_p6_1 = { + 2, 25, + _vq_lengthlist__44c9_s_p6_1, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__44c9_s_p6_1, + NULL, + &_vq_auxt__44c9_s_p6_1, + NULL, + 0 +}; + +static long _vq_quantlist__44c9_s_p7_0[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__44c9_s_p7_0[] = { + 2, 4, 4, 6, 6, 7, 7, 8, 8,10,10,11,11, 6, 4, 4, + 6, 6, 8, 8, 9, 9,10,10,12,12, 6, 4, 5, 6, 6, 8, + 8, 9, 9,10,10,12,12,20, 6, 6, 6, 6, 8, 8, 9,10, + 11,11,12,12,20, 6, 6, 6, 6, 8, 8,10,10,11,11,12, + 12,20,10,10, 7, 7, 9, 9,10,10,11,11,12,12,20,11, + 11, 7, 7, 9, 9,10,10,11,11,12,12,20,20,20, 9, 9, + 9, 9,11,11,12,12,13,13,20,20,20, 9, 9, 9, 9,11, + 11,12,12,13,13,20,20,20,13,13,10,10,11,11,12,13, + 13,13,20,20,20,13,13,10,10,11,11,12,13,13,13,20, + 20,20,20,19,12,12,12,12,13,13,14,15,19,19,19,19, + 19,12,12,12,12,13,13,14,14, +}; + +static float _vq_quantthresh__44c9_s_p7_0[] = { + -60.5, -49.5, -38.5, -27.5, -16.5, -5.5, 5.5, 16.5, + 27.5, 38.5, 49.5, 60.5, +}; + +static long _vq_quantmap__44c9_s_p7_0[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__44c9_s_p7_0 = { + _vq_quantthresh__44c9_s_p7_0, + _vq_quantmap__44c9_s_p7_0, + 13, + 13 +}; + +static static_codebook _44c9_s_p7_0 = { + 2, 169, + _vq_lengthlist__44c9_s_p7_0, + 1, -523206656, 1618345984, 4, 0, + _vq_quantlist__44c9_s_p7_0, + NULL, + &_vq_auxt__44c9_s_p7_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c9_s_p7_1[] = { + 5, + 4, + 6, + 3, + 7, + 2, + 8, + 1, + 9, + 0, + 10, +}; + +static long _vq_lengthlist__44c9_s_p7_1[] = { + 5, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, + 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 7, 7, 7, 7, 7, + 7, 8, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 6, + 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 7, 7, 7, 7, 7, 7, + 7, 7, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, + 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 7, 7, 7, + 7, 7, 7, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 8, 8, + 8, 8, 8, 7, 7, 7, 7, 7, 7, +}; + +static float _vq_quantthresh__44c9_s_p7_1[] = { + -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, + 3.5, 4.5, +}; + +static long _vq_quantmap__44c9_s_p7_1[] = { + 9, 7, 5, 3, 1, 0, 2, 4, + 6, 8, 10, +}; + +static encode_aux_threshmatch _vq_auxt__44c9_s_p7_1 = { + _vq_quantthresh__44c9_s_p7_1, + _vq_quantmap__44c9_s_p7_1, + 11, + 11 +}; + +static static_codebook _44c9_s_p7_1 = { + 2, 121, + _vq_lengthlist__44c9_s_p7_1, + 1, -531365888, 1611661312, 4, 0, + _vq_quantlist__44c9_s_p7_1, + NULL, + &_vq_auxt__44c9_s_p7_1, + NULL, + 0 +}; + +static long _vq_quantlist__44c9_s_p8_0[] = { + 7, + 6, + 8, + 5, + 9, + 4, + 10, + 3, + 11, + 2, + 12, + 1, + 13, + 0, + 14, +}; + +static long _vq_lengthlist__44c9_s_p8_0[] = { + 1, 4, 4, 7, 6, 8, 8, 8, 8, 9, 9,10,10,11,10, 6, + 5, 5, 7, 7, 9, 9, 8, 9,10,10,11,11,12,12, 6, 5, + 5, 7, 7, 9, 9, 9, 9,10,10,11,11,12,12,21, 7, 8, + 8, 8, 9, 9, 9, 9,10,10,11,11,12,12,21, 8, 8, 8, + 8, 9, 9, 9, 9,10,10,11,11,12,12,21,11,12, 9, 9, + 10,10,10,10,10,11,11,12,12,12,21,12,12, 9, 8,10, + 10,10,10,11,11,12,12,13,13,21,21,21, 9, 9, 9, 9, + 11,11,11,11,12,12,12,13,21,20,20, 9, 9, 9, 9,10, + 11,11,11,12,12,13,13,20,20,20,13,13,10,10,11,11, + 12,12,13,13,13,13,20,20,20,13,13,10,10,11,11,12, + 12,13,13,13,13,20,20,20,20,20,12,12,12,12,12,12, + 13,13,14,14,20,20,20,20,20,12,12,12,11,13,12,13, + 13,14,14,20,20,20,20,20,15,16,13,12,13,13,14,13, + 14,14,20,20,20,20,20,16,15,12,12,13,12,14,13,14, + 14, +}; + +static float _vq_quantthresh__44c9_s_p8_0[] = { + -136.5, -115.5, -94.5, -73.5, -52.5, -31.5, -10.5, 10.5, + 31.5, 52.5, 73.5, 94.5, 115.5, 136.5, +}; + +static long _vq_quantmap__44c9_s_p8_0[] = { + 13, 11, 9, 7, 5, 3, 1, 0, + 2, 4, 6, 8, 10, 12, 14, +}; + +static encode_aux_threshmatch _vq_auxt__44c9_s_p8_0 = { + _vq_quantthresh__44c9_s_p8_0, + _vq_quantmap__44c9_s_p8_0, + 15, + 15 +}; + +static static_codebook _44c9_s_p8_0 = { + 2, 225, + _vq_lengthlist__44c9_s_p8_0, + 1, -520986624, 1620377600, 4, 0, + _vq_quantlist__44c9_s_p8_0, + NULL, + &_vq_auxt__44c9_s_p8_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c9_s_p8_1[] = { + 10, + 9, + 11, + 8, + 12, + 7, + 13, + 6, + 14, + 5, + 15, + 4, + 16, + 3, + 17, + 2, + 18, + 1, + 19, + 0, + 20, +}; + +static long _vq_lengthlist__44c9_s_p8_1[] = { + 4, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8,10, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10, 6, 6, 7, 7, 8, + 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10, + 7, 7, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9,10,10,10, 8, 8, 8, 8, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10, 8, 8, 8, 8, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10, + 10, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9,10,10,10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9,10,10,10,10,10, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10, + 10,10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9,10,10,10,10,10, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9,10,10,10,10,10, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9,10, 9, 9, 9,10,10,10,10, + 10,10,10, 9, 9, 9, 9, 9, 9,10, 9, 9, 9, 9, 9, 9, + 9,10,10,10,10,10,10,10, 9, 9, 9,10,10,10,10,10, + 9, 9, 9, 9, 9, 9,10,10,10,10,10,10,10, 9, 9,10, + 9,10, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10,10,10,10, + 10,10,10,10, 9, 9,10,10, 9, 9, 9, 9, 9, 9, 9, 9, + 10,10,10,10,10,10,10,10,10,10,10,10,10, 9, 9, 9, + 9, 9, 9, 9, 9,10,10,10,10,10,10,10,10,10,10,10, + 10,10, 9, 9,10, 9, 9, 9, 9, 9,10,10,10,10,10,10, + 10,10,10,10,10, 9, 9,10,10, 9, 9,10, 9, 9, 9,10, + 10,10,10,10,10,10,10,10,10,10, 9, 9,10, 9, 9, 9, + 9, 9, 9, 9,10,10,10,10,10,10,10,10,10,10,10, 9, + 9, 9, 9,10, 9, 9, 9, 9, 9, +}; + +static float _vq_quantthresh__44c9_s_p8_1[] = { + -9.5, -8.5, -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, + -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, + 6.5, 7.5, 8.5, 9.5, +}; + +static long _vq_quantmap__44c9_s_p8_1[] = { + 19, 17, 15, 13, 11, 9, 7, 5, + 3, 1, 0, 2, 4, 6, 8, 10, + 12, 14, 16, 18, 20, +}; + +static encode_aux_threshmatch _vq_auxt__44c9_s_p8_1 = { + _vq_quantthresh__44c9_s_p8_1, + _vq_quantmap__44c9_s_p8_1, + 21, + 21 +}; + +static static_codebook _44c9_s_p8_1 = { + 2, 441, + _vq_lengthlist__44c9_s_p8_1, + 1, -529268736, 1611661312, 5, 0, + _vq_quantlist__44c9_s_p8_1, + NULL, + &_vq_auxt__44c9_s_p8_1, + NULL, + 0 +}; + +static long _vq_quantlist__44c9_s_p9_0[] = { + 9, + 8, + 10, + 7, + 11, + 6, + 12, + 5, + 13, + 4, + 14, + 3, + 15, + 2, + 16, + 1, + 17, + 0, + 18, +}; + +static long _vq_lengthlist__44c9_s_p9_0[] = { + 1, 4, 3,12,12,12,12,12,12,12,12,12,12,12,12,12, + 12,12,12, 4, 5, 6,12,12,12,12,12,12,12,12,12,12, + 12,12,12,12,12,12, 4, 6, 6,12,12,12,12,12,12,12, + 12,12,12,12,12,12,12,12,12,12,12,11,12,12,12,12, + 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, + 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, + 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, + 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, + 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, + 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, + 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, + 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, + 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, + 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, + 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, + 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, + 12,12,12,12,12,12,12,12,12,12,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11, +}; + +static float _vq_quantthresh__44c9_s_p9_0[] = { + -7913.5, -6982.5, -6051.5, -5120.5, -4189.5, -3258.5, -2327.5, -1396.5, + -465.5, 465.5, 1396.5, 2327.5, 3258.5, 4189.5, 5120.5, 6051.5, + 6982.5, 7913.5, +}; + +static long _vq_quantmap__44c9_s_p9_0[] = { + 17, 15, 13, 11, 9, 7, 5, 3, + 1, 0, 2, 4, 6, 8, 10, 12, + 14, 16, 18, +}; + +static encode_aux_threshmatch _vq_auxt__44c9_s_p9_0 = { + _vq_quantthresh__44c9_s_p9_0, + _vq_quantmap__44c9_s_p9_0, + 19, + 19 +}; + +static static_codebook _44c9_s_p9_0 = { + 2, 361, + _vq_lengthlist__44c9_s_p9_0, + 1, -508535424, 1631393792, 5, 0, + _vq_quantlist__44c9_s_p9_0, + NULL, + &_vq_auxt__44c9_s_p9_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c9_s_p9_1[] = { + 9, + 8, + 10, + 7, + 11, + 6, + 12, + 5, + 13, + 4, + 14, + 3, + 15, + 2, + 16, + 1, + 17, + 0, + 18, +}; + +static long _vq_lengthlist__44c9_s_p9_1[] = { + 1, 4, 4, 7, 7, 7, 7, 8, 7, 9, 8, 9, 9,10,10,11, + 11,11,11, 6, 5, 5, 8, 8, 9, 9, 9, 8,10, 9,11,10, + 12,12,13,12,13,13, 5, 5, 5, 8, 8, 9, 9, 9, 9,10, + 10,11,11,12,12,13,12,13,13,17, 8, 8, 9, 9, 9, 9, + 9, 9,10,10,12,11,13,12,13,13,13,13,18, 8, 8, 9, + 9, 9, 9, 9, 9,11,11,12,12,13,13,13,13,13,13,17, + 13,12, 9, 9,10,10,10,10,11,11,12,12,12,13,13,13, + 14,14,18,13,12, 9, 9,10,10,10,10,11,11,12,12,13, + 13,13,14,14,14,17,18,18,10,10,10,10,11,11,11,12, + 12,12,14,13,14,13,13,14,18,18,18,10, 9,10, 9,11, + 11,12,12,12,12,13,13,15,14,14,14,18,18,16,13,14, + 10,11,11,11,12,13,13,13,13,14,13,13,14,14,18,18, + 18,14,12,11, 9,11,10,13,12,13,13,13,14,14,14,13, + 14,18,18,17,18,18,11,12,12,12,13,13,14,13,14,14, + 13,14,14,14,18,18,18,18,17,12,10,12, 9,13,11,13, + 14,14,14,14,14,15,14,18,18,17,17,18,14,15,12,13, + 13,13,14,13,14,14,15,14,15,14,18,17,18,18,18,15, + 15,12,10,14,10,14,14,13,13,14,14,14,14,18,16,18, + 18,18,18,17,14,14,13,14,14,13,13,14,14,14,15,15, + 18,18,18,18,17,17,17,14,14,14,12,14,13,14,14,15, + 14,15,14,18,18,18,18,18,18,18,17,16,13,13,13,14, + 14,14,14,15,16,15,18,18,18,18,18,18,18,17,17,13, + 13,13,13,14,13,14,15,15,15, +}; + +static float _vq_quantthresh__44c9_s_p9_1[] = { + -416.5, -367.5, -318.5, -269.5, -220.5, -171.5, -122.5, -73.5, + -24.5, 24.5, 73.5, 122.5, 171.5, 220.5, 269.5, 318.5, + 367.5, 416.5, +}; + +static long _vq_quantmap__44c9_s_p9_1[] = { + 17, 15, 13, 11, 9, 7, 5, 3, + 1, 0, 2, 4, 6, 8, 10, 12, + 14, 16, 18, +}; + +static encode_aux_threshmatch _vq_auxt__44c9_s_p9_1 = { + _vq_quantthresh__44c9_s_p9_1, + _vq_quantmap__44c9_s_p9_1, + 19, + 19 +}; + +static static_codebook _44c9_s_p9_1 = { + 2, 361, + _vq_lengthlist__44c9_s_p9_1, + 1, -518287360, 1622704128, 5, 0, + _vq_quantlist__44c9_s_p9_1, + NULL, + &_vq_auxt__44c9_s_p9_1, + NULL, + 0 +}; + +static long _vq_quantlist__44c9_s_p9_2[] = { + 24, + 23, + 25, + 22, + 26, + 21, + 27, + 20, + 28, + 19, + 29, + 18, + 30, + 17, + 31, + 16, + 32, + 15, + 33, + 14, + 34, + 13, + 35, + 12, + 36, + 11, + 37, + 10, + 38, + 9, + 39, + 8, + 40, + 7, + 41, + 6, + 42, + 5, + 43, + 4, + 44, + 3, + 45, + 2, + 46, + 1, + 47, + 0, + 48, +}; + +static long _vq_lengthlist__44c9_s_p9_2[] = { + 2, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, +}; + +static float _vq_quantthresh__44c9_s_p9_2[] = { + -23.5, -22.5, -21.5, -20.5, -19.5, -18.5, -17.5, -16.5, + -15.5, -14.5, -13.5, -12.5, -11.5, -10.5, -9.5, -8.5, + -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, + 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, + 8.5, 9.5, 10.5, 11.5, 12.5, 13.5, 14.5, 15.5, + 16.5, 17.5, 18.5, 19.5, 20.5, 21.5, 22.5, 23.5, +}; + +static long _vq_quantmap__44c9_s_p9_2[] = { + 47, 45, 43, 41, 39, 37, 35, 33, + 31, 29, 27, 25, 23, 21, 19, 17, + 15, 13, 11, 9, 7, 5, 3, 1, + 0, 2, 4, 6, 8, 10, 12, 14, + 16, 18, 20, 22, 24, 26, 28, 30, + 32, 34, 36, 38, 40, 42, 44, 46, + 48, +}; + +static encode_aux_threshmatch _vq_auxt__44c9_s_p9_2 = { + _vq_quantthresh__44c9_s_p9_2, + _vq_quantmap__44c9_s_p9_2, + 49, + 49 +}; + +static static_codebook _44c9_s_p9_2 = { + 1, 49, + _vq_lengthlist__44c9_s_p9_2, + 1, -526909440, 1611661312, 6, 0, + _vq_quantlist__44c9_s_p9_2, + NULL, + &_vq_auxt__44c9_s_p9_2, + NULL, + 0 +}; + +static long _huff_lengthlist__44c9_s_short[] = { + 5,13,18,16,17,17,19,18,19,19, 5, 7,10,11,12,12, + 13,16,17,18, 6, 6, 7, 7, 9, 9,10,14,17,19, 8, 7, + 6, 5, 6, 7, 9,12,19,17, 8, 7, 7, 6, 5, 6, 8,11, + 15,19, 9, 8, 7, 6, 5, 5, 6, 8,13,15,11,10, 8, 8, + 7, 5, 4, 4,10,14,12,13,11, 9, 7, 6, 4, 2, 6,12, + 18,16,16,13, 8, 7, 7, 5, 8,13,16,17,18,15,11, 9, + 9, 8,10,13, +}; + +static static_codebook _huff_book__44c9_s_short = { + 2, 100, + _huff_lengthlist__44c9_s_short, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist__44c0_s_long[] = { + 5, 4, 8, 9, 8, 9,10,12,15, 4, 1, 5, 5, 6, 8,11, + 12,12, 8, 5, 8, 9, 9,11,13,12,12, 9, 5, 8, 5, 7, + 9,12,13,13, 8, 6, 8, 7, 7, 9,11,11,11, 9, 7, 9, + 7, 7, 7, 7,10,12,10,10,11, 9, 8, 7, 7, 9,11,11, + 12,13,12,11, 9, 8, 9,11,13,16,16,15,15,12,10,11, + 12, +}; + +static static_codebook _huff_book__44c0_s_long = { + 2, 81, + _huff_lengthlist__44c0_s_long, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _vq_quantlist__44c0_s_p1_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__44c0_s_p1_0[] = { + 1, 5, 5, 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, 0, 0, 0, + 0, 0, 5, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 5, 8, 7, 0, 0, 0, 0, 0, 0, 7, 9, 9, 0, 0, 0, + 0, 0, 0, 7, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 5, 7, 7, 0, 0, 0, 0, 0, 0, 7, 9, 9, 0, 0, + 0, 0, 0, 0, 7, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, 0, 0, 0, + 0, 0, 8,10, 9, 0, 0, 0, 0, 0, 0, 7, 9, 9, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 9, 9, 0, 0, 0, + 0, 0, 0, 9,10,11, 0, 0, 0, 0, 0, 0, 9,11,10, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 9, 9, 0, 0, + 0, 0, 0, 0, 9,11, 9, 0, 0, 0, 0, 0, 0, 9,10,11, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 5, 7, 7, 0, 0, 0, 0, 0, 0, 7, 9, 9, 0, 0, + 0, 0, 0, 0, 8, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 7, 9, 9, 0, 0, 0, 0, 0, 0, 9,11,10, 0, + 0, 0, 0, 0, 0, 9, 9,11, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 7, 9,10, 0, 0, 0, 0, 0, 0, 9,10,11, + 0, 0, 0, 0, 0, 0, 9,11,10, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + +static float _vq_quantthresh__44c0_s_p1_0[] = { + -0.5, 0.5, +}; + +static long _vq_quantmap__44c0_s_p1_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__44c0_s_p1_0 = { + _vq_quantthresh__44c0_s_p1_0, + _vq_quantmap__44c0_s_p1_0, + 3, + 3 +}; + +static static_codebook _44c0_s_p1_0 = { + 8, 6561, + _vq_lengthlist__44c0_s_p1_0, + 1, -535822336, 1611661312, 2, 0, + _vq_quantlist__44c0_s_p1_0, + NULL, + &_vq_auxt__44c0_s_p1_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c0_s_p2_0[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44c0_s_p2_0[] = { + 1, 4, 4, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 5, 5, 7, 6, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 4, 5, 6, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 7, 7, 9, 9, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 6, 7, 7, 9, 9, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + +static float _vq_quantthresh__44c0_s_p2_0[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__44c0_s_p2_0[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44c0_s_p2_0 = { + _vq_quantthresh__44c0_s_p2_0, + _vq_quantmap__44c0_s_p2_0, + 5, + 5 +}; + +static static_codebook _44c0_s_p2_0 = { + 4, 625, + _vq_lengthlist__44c0_s_p2_0, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__44c0_s_p2_0, + NULL, + &_vq_auxt__44c0_s_p2_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c0_s_p3_0[] = { + 4, + 3, + 5, + 2, + 6, + 1, + 7, + 0, + 8, +}; + +static long _vq_lengthlist__44c0_s_p3_0[] = { + 1, 3, 2, 8, 7, 0, 0, 0, 0, 0, 0, 0, 6, 6, 0, 0, + 0, 0, 0, 0, 0, 6, 6, 0, 0, 0, 0, 0, 0, 0, 7, 7, + 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, + 8, 8, 0, 0, 0, 0, 0, 0, 0, 8, 8, 0, 0, 0, 0, 0, + 0, 0, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + +static float _vq_quantthresh__44c0_s_p3_0[] = { + -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, +}; + +static long _vq_quantmap__44c0_s_p3_0[] = { + 7, 5, 3, 1, 0, 2, 4, 6, + 8, +}; + +static encode_aux_threshmatch _vq_auxt__44c0_s_p3_0 = { + _vq_quantthresh__44c0_s_p3_0, + _vq_quantmap__44c0_s_p3_0, + 9, + 9 +}; + +static static_codebook _44c0_s_p3_0 = { + 2, 81, + _vq_lengthlist__44c0_s_p3_0, + 1, -531628032, 1611661312, 4, 0, + _vq_quantlist__44c0_s_p3_0, + NULL, + &_vq_auxt__44c0_s_p3_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c0_s_p4_0[] = { + 4, + 3, + 5, + 2, + 6, + 1, + 7, + 0, + 8, +}; + +static long _vq_lengthlist__44c0_s_p4_0[] = { + 1, 3, 3, 6, 6, 6, 6, 8, 8, 0, 0, 0, 7, 7, 7, 7, + 9, 9, 0, 0, 0, 7, 7, 7, 7, 9, 9, 0, 0, 0, 7, 7, + 7, 8, 9, 9, 0, 0, 0, 7, 7, 7, 7, 9, 9, 0, 0, 0, + 9, 9, 8, 8,10,10, 0, 0, 0, 8, 9, 8, 8,10,10, 0, + 0, 0,10,10, 9, 9,10,10, 0, 0, 0, 0, 0, 9, 9,10, + 10, +}; + +static float _vq_quantthresh__44c0_s_p4_0[] = { + -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, +}; + +static long _vq_quantmap__44c0_s_p4_0[] = { + 7, 5, 3, 1, 0, 2, 4, 6, + 8, +}; + +static encode_aux_threshmatch _vq_auxt__44c0_s_p4_0 = { + _vq_quantthresh__44c0_s_p4_0, + _vq_quantmap__44c0_s_p4_0, + 9, + 9 +}; + +static static_codebook _44c0_s_p4_0 = { + 2, 81, + _vq_lengthlist__44c0_s_p4_0, + 1, -531628032, 1611661312, 4, 0, + _vq_quantlist__44c0_s_p4_0, + NULL, + &_vq_auxt__44c0_s_p4_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c0_s_p5_0[] = { + 8, + 7, + 9, + 6, + 10, + 5, + 11, + 4, + 12, + 3, + 13, + 2, + 14, + 1, + 15, + 0, + 16, +}; + +static long _vq_lengthlist__44c0_s_p5_0[] = { + 1, 4, 3, 6, 6, 8, 7, 8, 8, 8, 8, 9, 9,10,10,11, + 11, 0, 0, 0, 7, 7, 8, 8, 9, 9, 9, 9, 9,10,10,10, + 11,11, 0, 0, 0, 7, 7, 8, 8, 9, 9, 9, 9,10,10,10, + 10,11,11, 0, 0, 0, 7, 7, 8, 8, 9, 9, 9, 9,10,10, + 11,11,11,11, 0, 0, 0, 7, 7, 8, 8, 9, 9, 9, 9,10, + 10,11,11,11,11, 0, 0, 0, 8, 8, 9, 9, 9, 9,10,10, + 10,10,11,11,12,12, 0, 0, 0, 8, 8, 9, 9, 9, 9,10, + 10,10,10,11,11,12,12, 0, 0, 0, 9, 9, 9, 9,10,10, + 10,10,11,11,11,12,12,12, 0, 0, 0, 0, 0, 9, 9,10, + 10,10,10,11,11,11,11,12,12, 0, 0, 0, 0, 0, 9, 9, + 10,10,10,10,11,11,12,12,13,13, 0, 0, 0, 0, 0, 9, + 9,10,10,10,10,11,11,12,12,13,13, 0, 0, 0, 0, 0, + 10,10,11,11,11,11,11,12,12,12,13,13, 0, 0, 0, 0, + 0, 0, 0,11,10,11,11,11,11,12,12,13,13, 0, 0, 0, + 0, 0, 0, 0,11,11,12,11,12,12,12,12,13,13, 0, 0, + 0, 0, 0, 0, 0,11,11,11,12,12,12,12,13,13,13, 0, + 0, 0, 0, 0, 0, 0,12,12,12,12,12,13,13,13,14,14, + 0, 0, 0, 0, 0, 0, 0, 0, 0,12,12,12,12,13,13,14, + 14, +}; + +static float _vq_quantthresh__44c0_s_p5_0[] = { + -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, + 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, +}; + +static long _vq_quantmap__44c0_s_p5_0[] = { + 15, 13, 11, 9, 7, 5, 3, 1, + 0, 2, 4, 6, 8, 10, 12, 14, + 16, +}; + +static encode_aux_threshmatch _vq_auxt__44c0_s_p5_0 = { + _vq_quantthresh__44c0_s_p5_0, + _vq_quantmap__44c0_s_p5_0, + 17, + 17 +}; + +static static_codebook _44c0_s_p5_0 = { + 2, 289, + _vq_lengthlist__44c0_s_p5_0, + 1, -529530880, 1611661312, 5, 0, + _vq_quantlist__44c0_s_p5_0, + NULL, + &_vq_auxt__44c0_s_p5_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c0_s_p6_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__44c0_s_p6_0[] = { + 1, 4, 4, 7, 6, 6, 7, 6, 6, 4, 7, 7,10, 9, 9,10, + 9, 9, 4, 6, 7,10, 9, 9,11, 9, 9, 7,10,10,11,11, + 11,12,10,11, 6, 9, 9,11,10,11,11,10,10, 6, 9, 9, + 11,10,11,11,10,10, 7,11,10,12,11,11,11,11,11, 7, + 9, 9,10,10,10,11,11,10, 6, 9, 9,11,10,10,11,10, + 10, +}; + +static float _vq_quantthresh__44c0_s_p6_0[] = { + -5.5, 5.5, +}; + +static long _vq_quantmap__44c0_s_p6_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__44c0_s_p6_0 = { + _vq_quantthresh__44c0_s_p6_0, + _vq_quantmap__44c0_s_p6_0, + 3, + 3 +}; + +static static_codebook _44c0_s_p6_0 = { + 4, 81, + _vq_lengthlist__44c0_s_p6_0, + 1, -529137664, 1618345984, 2, 0, + _vq_quantlist__44c0_s_p6_0, + NULL, + &_vq_auxt__44c0_s_p6_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c0_s_p6_1[] = { + 5, + 4, + 6, + 3, + 7, + 2, + 8, + 1, + 9, + 0, + 10, +}; + +static long _vq_lengthlist__44c0_s_p6_1[] = { + 2, 3, 3, 6, 6, 7, 7, 7, 7, 7, 8,10,10,10, 6, 6, + 7, 7, 8, 8, 8, 8,10,10,10, 6, 6, 7, 7, 8, 8, 8, + 8,10,10,10, 7, 7, 7, 7, 8, 8, 8, 8,10,10,10, 7, + 7, 7, 7, 8, 8, 8, 8,10,10,10, 8, 7, 8, 8, 8, 8, + 8, 8,10,10,10, 7, 7, 8, 8, 8, 8, 8, 8,10,10,10, + 8, 8, 8, 8, 8, 8, 8, 8,10,10,10,10,10, 8, 8, 8, + 8, 8, 8,10,10,10,10,10, 9, 9, 8, 8, 8, 8,10,10, + 10,10,10, 8, 8, 8, 8, 8, 8, +}; + +static float _vq_quantthresh__44c0_s_p6_1[] = { + -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, + 3.5, 4.5, +}; + +static long _vq_quantmap__44c0_s_p6_1[] = { + 9, 7, 5, 3, 1, 0, 2, 4, + 6, 8, 10, +}; + +static encode_aux_threshmatch _vq_auxt__44c0_s_p6_1 = { + _vq_quantthresh__44c0_s_p6_1, + _vq_quantmap__44c0_s_p6_1, + 11, + 11 +}; + +static static_codebook _44c0_s_p6_1 = { + 2, 121, + _vq_lengthlist__44c0_s_p6_1, + 1, -531365888, 1611661312, 4, 0, + _vq_quantlist__44c0_s_p6_1, + NULL, + &_vq_auxt__44c0_s_p6_1, + NULL, + 0 +}; + +static long _vq_quantlist__44c0_s_p7_0[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__44c0_s_p7_0[] = { + 1, 4, 4, 6, 6, 7, 7, 7, 7, 8, 8, 9, 9, 7, 5, 5, + 7, 7, 8, 8, 8, 8, 9, 9,10,10, 7, 5, 6, 7, 7, 8, + 8, 8, 8, 9, 9,10,10, 0, 8, 8, 8, 8, 9, 9, 9, 9, + 10,10,11,11, 0, 8, 8, 8, 8, 9, 9, 9, 9,10,10,11, + 11, 0,12,12, 9, 9,10,10,10,10,11,11,11,11, 0,13, + 13, 9, 9, 9, 9,10,10,11,11,11,12, 0, 0, 0,10,10, + 10,10,11,11,11,11,12,12, 0, 0, 0,10,10, 9, 9,11, + 11,11,12,12,12, 0, 0, 0,13,13,10,10,11,11,12,12, + 13,13, 0, 0, 0,14,14,10,10,11,11,12,12,13,13, 0, + 0, 0, 0, 0,11,11,11,11,13,12,13,13, 0, 0, 0, 0, + 0,12,12,11,11,12,12,13,13, +}; + +static float _vq_quantthresh__44c0_s_p7_0[] = { + -27.5, -22.5, -17.5, -12.5, -7.5, -2.5, 2.5, 7.5, + 12.5, 17.5, 22.5, 27.5, +}; + +static long _vq_quantmap__44c0_s_p7_0[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__44c0_s_p7_0 = { + _vq_quantthresh__44c0_s_p7_0, + _vq_quantmap__44c0_s_p7_0, + 13, + 13 +}; + +static static_codebook _44c0_s_p7_0 = { + 2, 169, + _vq_lengthlist__44c0_s_p7_0, + 1, -526516224, 1616117760, 4, 0, + _vq_quantlist__44c0_s_p7_0, + NULL, + &_vq_auxt__44c0_s_p7_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c0_s_p7_1[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44c0_s_p7_1[] = { + 2, 3, 3, 5, 5, 6, 6, 6, 5, 5, 6, 6, 6, 5, 5, 6, + 6, 6, 5, 5, 6, 6, 6, 5, 5, +}; + +static float _vq_quantthresh__44c0_s_p7_1[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__44c0_s_p7_1[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44c0_s_p7_1 = { + _vq_quantthresh__44c0_s_p7_1, + _vq_quantmap__44c0_s_p7_1, + 5, + 5 +}; + +static static_codebook _44c0_s_p7_1 = { + 2, 25, + _vq_lengthlist__44c0_s_p7_1, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__44c0_s_p7_1, + NULL, + &_vq_auxt__44c0_s_p7_1, + NULL, + 0 +}; + +static long _vq_quantlist__44c0_s_p8_0[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44c0_s_p8_0[] = { + 1, 5, 5,10,10, 6, 9, 8,10,10, 6,10, 9,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10, 8,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,10,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11, +}; + +static float _vq_quantthresh__44c0_s_p8_0[] = { + -331.5, -110.5, 110.5, 331.5, +}; + +static long _vq_quantmap__44c0_s_p8_0[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44c0_s_p8_0 = { + _vq_quantthresh__44c0_s_p8_0, + _vq_quantmap__44c0_s_p8_0, + 5, + 5 +}; + +static static_codebook _44c0_s_p8_0 = { + 4, 625, + _vq_lengthlist__44c0_s_p8_0, + 1, -518283264, 1627103232, 3, 0, + _vq_quantlist__44c0_s_p8_0, + NULL, + &_vq_auxt__44c0_s_p8_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c0_s_p8_1[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__44c0_s_p8_1[] = { + 1, 4, 4, 6, 6, 7, 7, 9, 9,11,12,13,12, 6, 5, 5, + 7, 7, 8, 8,10, 9,12,12,12,12, 6, 5, 5, 7, 7, 8, + 8,10, 9,12,11,11,13,16, 7, 7, 8, 8, 9, 9,10,10, + 12,12,13,12,16, 7, 7, 8, 7, 9, 9,10,10,11,12,12, + 13,16,10,10, 8, 8,10,10,11,12,12,12,13,13,16,11, + 10, 8, 7,11,10,11,11,12,11,13,13,16,16,16,10,10, + 10,10,11,11,13,12,13,13,16,16,16,11, 9,11, 9,15, + 13,12,13,13,13,16,16,16,15,13,11,11,12,13,12,12, + 14,13,16,16,16,14,13,11,11,13,12,14,13,13,13,16, + 16,16,16,16,13,13,13,12,14,13,14,14,16,16,16,16, + 16,13,13,12,12,14,14,15,13, +}; + +static float _vq_quantthresh__44c0_s_p8_1[] = { + -93.5, -76.5, -59.5, -42.5, -25.5, -8.5, 8.5, 25.5, + 42.5, 59.5, 76.5, 93.5, +}; + +static long _vq_quantmap__44c0_s_p8_1[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__44c0_s_p8_1 = { + _vq_quantthresh__44c0_s_p8_1, + _vq_quantmap__44c0_s_p8_1, + 13, + 13 +}; + +static static_codebook _44c0_s_p8_1 = { + 2, 169, + _vq_lengthlist__44c0_s_p8_1, + 1, -522616832, 1620115456, 4, 0, + _vq_quantlist__44c0_s_p8_1, + NULL, + &_vq_auxt__44c0_s_p8_1, + NULL, + 0 +}; + +static long _vq_quantlist__44c0_s_p8_2[] = { + 8, + 7, + 9, + 6, + 10, + 5, + 11, + 4, + 12, + 3, + 13, + 2, + 14, + 1, + 15, + 0, + 16, +}; + +static long _vq_lengthlist__44c0_s_p8_2[] = { + 2, 4, 4, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, + 8,10,10,10, 7, 7, 7, 8, 8, 8, 9, 9, 9, 9, 9, 9, + 9, 9,10,10,10, 7, 7, 7, 7, 8, 8, 9, 9, 9, 9, 9, + 9, 9, 9,10,10,10, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, + 9,10, 9, 9,10,10,10, 7, 7, 8, 8, 9, 8, 9, 9, 9, + 9,10, 9, 9,10,10,10,10, 8, 8, 8, 8, 9, 8, 9, 9, + 9, 9, 9,10, 9,10,10,10,10, 7, 7, 8, 8, 9, 9, 9, + 9, 9, 9,10, 9,10,10,10,10,10, 8, 8, 8, 9, 9, 9, + 9, 9, 9, 9,10,10,10, 9,11,10,10,10,10, 8, 8, 9, + 9, 9, 9, 9,10, 9, 9, 9,10,10,10,10,11,11, 9, 9, + 9, 9, 9, 9, 9, 9,10, 9, 9,10,11,10,10,11,11, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9,10, 9,11,11,10,11,11, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10, 9,11,10,10,11, + 11,11,11, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10, + 11,11,11,11, 9,10, 9,10, 9, 9, 9, 9,10, 9,10,11, + 10,11,10,10,10,10,10, 9, 9, 9,10, 9, 9, 9,10,11, + 11,10,11,11,10,11,10,10,10, 9, 9, 9, 9,10, 9, 9, + 10,11,10,11,11,11,11,10,11,10,10, 9,10, 9, 9, 9, + 10, +}; + +static float _vq_quantthresh__44c0_s_p8_2[] = { + -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, + 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, +}; + +static long _vq_quantmap__44c0_s_p8_2[] = { + 15, 13, 11, 9, 7, 5, 3, 1, + 0, 2, 4, 6, 8, 10, 12, 14, + 16, +}; + +static encode_aux_threshmatch _vq_auxt__44c0_s_p8_2 = { + _vq_quantthresh__44c0_s_p8_2, + _vq_quantmap__44c0_s_p8_2, + 17, + 17 +}; + +static static_codebook _44c0_s_p8_2 = { + 2, 289, + _vq_lengthlist__44c0_s_p8_2, + 1, -529530880, 1611661312, 5, 0, + _vq_quantlist__44c0_s_p8_2, + NULL, + &_vq_auxt__44c0_s_p8_2, + NULL, + 0 +}; + +static long _huff_lengthlist__44c0_s_short[] = { + 9, 8,12,11,12,13,14,14,16, 6, 1, 5, 6, 6, 9,12, + 14,17, 9, 4, 5, 9, 7, 9,13,15,16, 8, 5, 8, 6, 8, + 10,13,17,17, 9, 6, 7, 7, 8, 9,13,15,17,11, 8, 9, + 9, 9,10,12,16,16,13, 7, 8, 7, 7, 9,12,14,15,13, + 6, 7, 5, 5, 7,10,13,13,14, 7, 8, 5, 6, 7, 9,10, + 12, +}; + +static static_codebook _huff_book__44c0_s_short = { + 2, 81, + _huff_lengthlist__44c0_s_short, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist__44c0_sm_long[] = { + 5, 4, 9,10, 9,10,11,12,13, 4, 1, 5, 7, 7, 9,11, + 12,14, 8, 5, 7, 9, 8,10,13,13,13,10, 7, 9, 4, 6, + 7,10,12,14, 9, 6, 7, 6, 6, 7,10,12,12, 9, 8, 9, + 7, 6, 7, 8,11,12,11,11,11, 9, 8, 7, 8,10,12,12, + 13,14,12,11, 9, 9, 9,12,12,17,17,15,16,12,10,11, + 13, +}; + +static static_codebook _huff_book__44c0_sm_long = { + 2, 81, + _huff_lengthlist__44c0_sm_long, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _vq_quantlist__44c0_sm_p1_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__44c0_sm_p1_0[] = { + 1, 5, 5, 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, 0, 0, 0, + 0, 0, 5, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 5, 8, 7, 0, 0, 0, 0, 0, 0, 7, 9, 9, 0, 0, 0, + 0, 0, 0, 7, 8, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 5, 7, 7, 0, 0, 0, 0, 0, 0, 7, 9, 8, 0, 0, + 0, 0, 0, 0, 7, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 8, 7, 0, 0, 0, 0, + 0, 0, 8, 9, 9, 0, 0, 0, 0, 0, 0, 8, 9, 9, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 9, 9, 0, 0, 0, + 0, 0, 0, 9,10,10, 0, 0, 0, 0, 0, 0, 9,10,10, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 9, 9, 0, 0, + 0, 0, 0, 0, 8,10, 9, 0, 0, 0, 0, 0, 0, 9,10,10, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 5, 7, 8, 0, 0, 0, 0, 0, 0, 7, 9, 9, 0, 0, + 0, 0, 0, 0, 8, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 7, 9, 9, 0, 0, 0, 0, 0, 0, 9,10,10, 0, + 0, 0, 0, 0, 0, 9, 9,10, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 7, 9, 9, 0, 0, 0, 0, 0, 0, 9,10,10, + 0, 0, 0, 0, 0, 0, 9,10,10, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + +static float _vq_quantthresh__44c0_sm_p1_0[] = { + -0.5, 0.5, +}; + +static long _vq_quantmap__44c0_sm_p1_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__44c0_sm_p1_0 = { + _vq_quantthresh__44c0_sm_p1_0, + _vq_quantmap__44c0_sm_p1_0, + 3, + 3 +}; + +static static_codebook _44c0_sm_p1_0 = { + 8, 6561, + _vq_lengthlist__44c0_sm_p1_0, + 1, -535822336, 1611661312, 2, 0, + _vq_quantlist__44c0_sm_p1_0, + NULL, + &_vq_auxt__44c0_sm_p1_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c0_sm_p2_0[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44c0_sm_p2_0[] = { + 1, 4, 4, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 5, 5, 7, 7, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 4, 5, 5, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 7, 7, 9, 9, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 7, 7, 7, 9, 9, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + +static float _vq_quantthresh__44c0_sm_p2_0[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__44c0_sm_p2_0[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44c0_sm_p2_0 = { + _vq_quantthresh__44c0_sm_p2_0, + _vq_quantmap__44c0_sm_p2_0, + 5, + 5 +}; + +static static_codebook _44c0_sm_p2_0 = { + 4, 625, + _vq_lengthlist__44c0_sm_p2_0, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__44c0_sm_p2_0, + NULL, + &_vq_auxt__44c0_sm_p2_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c0_sm_p3_0[] = { + 4, + 3, + 5, + 2, + 6, + 1, + 7, + 0, + 8, +}; + +static long _vq_lengthlist__44c0_sm_p3_0[] = { + 1, 3, 3, 7, 7, 0, 0, 0, 0, 0, 5, 4, 7, 7, 0, 0, + 0, 0, 0, 5, 5, 7, 7, 0, 0, 0, 0, 0, 6, 7, 8, 8, + 0, 0, 0, 0, 0, 0, 0, 8, 8, 0, 0, 0, 0, 0, 0, 0, + 9,10, 0, 0, 0, 0, 0, 0, 0, 9, 9, 0, 0, 0, 0, 0, + 0, 0,11,11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + +static float _vq_quantthresh__44c0_sm_p3_0[] = { + -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, +}; + +static long _vq_quantmap__44c0_sm_p3_0[] = { + 7, 5, 3, 1, 0, 2, 4, 6, + 8, +}; + +static encode_aux_threshmatch _vq_auxt__44c0_sm_p3_0 = { + _vq_quantthresh__44c0_sm_p3_0, + _vq_quantmap__44c0_sm_p3_0, + 9, + 9 +}; + +static static_codebook _44c0_sm_p3_0 = { + 2, 81, + _vq_lengthlist__44c0_sm_p3_0, + 1, -531628032, 1611661312, 4, 0, + _vq_quantlist__44c0_sm_p3_0, + NULL, + &_vq_auxt__44c0_sm_p3_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c0_sm_p4_0[] = { + 4, + 3, + 5, + 2, + 6, + 1, + 7, + 0, + 8, +}; + +static long _vq_lengthlist__44c0_sm_p4_0[] = { + 1, 4, 3, 6, 6, 7, 7, 9, 9, 0, 5, 5, 7, 7, 8, 7, + 9, 9, 0, 5, 5, 7, 7, 8, 8, 9, 9, 0, 7, 7, 8, 8, + 8, 8,10,10, 0, 0, 0, 8, 8, 8, 8,10,10, 0, 0, 0, + 9, 9, 9, 9,11,11, 0, 0, 0, 9, 9, 9, 9,11,11, 0, + 0, 0,10,10,10,10,11,11, 0, 0, 0, 0, 0, 9, 9,11, + 11, +}; + +static float _vq_quantthresh__44c0_sm_p4_0[] = { + -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, +}; + +static long _vq_quantmap__44c0_sm_p4_0[] = { + 7, 5, 3, 1, 0, 2, 4, 6, + 8, +}; + +static encode_aux_threshmatch _vq_auxt__44c0_sm_p4_0 = { + _vq_quantthresh__44c0_sm_p4_0, + _vq_quantmap__44c0_sm_p4_0, + 9, + 9 +}; + +static static_codebook _44c0_sm_p4_0 = { + 2, 81, + _vq_lengthlist__44c0_sm_p4_0, + 1, -531628032, 1611661312, 4, 0, + _vq_quantlist__44c0_sm_p4_0, + NULL, + &_vq_auxt__44c0_sm_p4_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c0_sm_p5_0[] = { + 8, + 7, + 9, + 6, + 10, + 5, + 11, + 4, + 12, + 3, + 13, + 2, + 14, + 1, + 15, + 0, + 16, +}; + +static long _vq_lengthlist__44c0_sm_p5_0[] = { + 1, 4, 4, 6, 6, 8, 8, 8, 8, 8, 8, 9, 9,10,10,11, + 11, 0, 6, 6, 7, 7, 8, 8, 9, 9, 9, 9,10,10,10,11, + 11,11, 0, 5, 6, 7, 7, 8, 8, 9, 9, 9, 9,10,10,10, + 11,11,11, 0, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9,10,10, + 11,11,12,12, 0, 0, 0, 8, 8, 8, 8, 9, 9, 9, 9,10, + 10,11,11,12,12, 0, 0, 0, 8, 8, 9, 9,10,10,10,10, + 11,11,11,11,12,12, 0, 0, 0, 8, 8, 9, 9,10,10,10, + 10,11,11,11,11,12,12, 0, 0, 0, 9, 9, 9, 9,10,10, + 10,10,11,11,12,12,12,13, 0, 0, 0, 0, 0, 9, 9,10, + 10,10,10,11,11,12,12,13,13, 0, 0, 0, 0, 0, 9, 9, + 10,10,11,11,11,11,12,12,13,13, 0, 0, 0, 0, 0, 9, + 9,10,10,11,10,11,11,12,12,13,13, 0, 0, 0, 0, 0, + 10,10,10,10,11,11,12,12,12,13,13,13, 0, 0, 0, 0, + 0, 0, 0,10,10,11,11,12,12,12,13,13,13, 0, 0, 0, + 0, 0, 0, 0,11,11,12,12,12,12,13,13,14,14, 0, 0, + 0, 0, 0, 0, 0,11,11,12,11,12,12,13,13,13,13, 0, + 0, 0, 0, 0, 0, 0,12,12,12,12,13,13,13,13,14,14, + 0, 0, 0, 0, 0, 0, 0, 0, 0,12,12,12,12,13,13,14, + 14, +}; + +static float _vq_quantthresh__44c0_sm_p5_0[] = { + -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, + 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, +}; + +static long _vq_quantmap__44c0_sm_p5_0[] = { + 15, 13, 11, 9, 7, 5, 3, 1, + 0, 2, 4, 6, 8, 10, 12, 14, + 16, +}; + +static encode_aux_threshmatch _vq_auxt__44c0_sm_p5_0 = { + _vq_quantthresh__44c0_sm_p5_0, + _vq_quantmap__44c0_sm_p5_0, + 17, + 17 +}; + +static static_codebook _44c0_sm_p5_0 = { + 2, 289, + _vq_lengthlist__44c0_sm_p5_0, + 1, -529530880, 1611661312, 5, 0, + _vq_quantlist__44c0_sm_p5_0, + NULL, + &_vq_auxt__44c0_sm_p5_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c0_sm_p6_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__44c0_sm_p6_0[] = { + 1, 4, 4, 7, 6, 6, 7, 6, 6, 4, 7, 7,10, 9, 9,11, + 9, 9, 4, 7, 7,10, 9, 9,11, 9, 9, 7,10,10,10,11, + 11,11,10,10, 6, 9, 9,11,11,10,11,10,10, 6, 9, 9, + 11,10,11,11,10,10, 7,11,10,11,11,11,11,11,11, 6, + 9, 9,11,10,10,11,11,10, 6, 9, 9,11,10,10,11,10, + 11, +}; + +static float _vq_quantthresh__44c0_sm_p6_0[] = { + -5.5, 5.5, +}; + +static long _vq_quantmap__44c0_sm_p6_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__44c0_sm_p6_0 = { + _vq_quantthresh__44c0_sm_p6_0, + _vq_quantmap__44c0_sm_p6_0, + 3, + 3 +}; + +static static_codebook _44c0_sm_p6_0 = { + 4, 81, + _vq_lengthlist__44c0_sm_p6_0, + 1, -529137664, 1618345984, 2, 0, + _vq_quantlist__44c0_sm_p6_0, + NULL, + &_vq_auxt__44c0_sm_p6_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c0_sm_p6_1[] = { + 5, + 4, + 6, + 3, + 7, + 2, + 8, + 1, + 9, + 0, + 10, +}; + +static long _vq_lengthlist__44c0_sm_p6_1[] = { + 2, 4, 4, 6, 6, 7, 7, 7, 7, 7, 8, 9, 5, 5, 6, 6, + 7, 7, 8, 8, 8, 8, 9, 5, 5, 6, 6, 7, 7, 8, 8, 8, + 8,10, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8,10,10,10, 7, + 7, 7, 7, 8, 8, 8, 8,10,10,10, 8, 8, 8, 8, 8, 8, + 8, 8,10,10,10, 8, 8, 8, 8, 8, 8, 8, 8,10,10,10, + 8, 8, 8, 8, 8, 8, 8, 8,10,10,10,10,10, 8, 8, 8, + 8, 8, 8,10,10,10,10,10, 9, 9, 8, 8, 8, 8,10,10, + 10,10,10, 8, 8, 8, 8, 8, 8, +}; + +static float _vq_quantthresh__44c0_sm_p6_1[] = { + -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, + 3.5, 4.5, +}; + +static long _vq_quantmap__44c0_sm_p6_1[] = { + 9, 7, 5, 3, 1, 0, 2, 4, + 6, 8, 10, +}; + +static encode_aux_threshmatch _vq_auxt__44c0_sm_p6_1 = { + _vq_quantthresh__44c0_sm_p6_1, + _vq_quantmap__44c0_sm_p6_1, + 11, + 11 +}; + +static static_codebook _44c0_sm_p6_1 = { + 2, 121, + _vq_lengthlist__44c0_sm_p6_1, + 1, -531365888, 1611661312, 4, 0, + _vq_quantlist__44c0_sm_p6_1, + NULL, + &_vq_auxt__44c0_sm_p6_1, + NULL, + 0 +}; + +static long _vq_quantlist__44c0_sm_p7_0[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__44c0_sm_p7_0[] = { + 1, 4, 4, 6, 6, 7, 7, 7, 7, 8, 8, 9, 9, 7, 5, 5, + 7, 7, 8, 8, 8, 8, 9, 9,10,10, 7, 6, 5, 7, 7, 8, + 8, 8, 8, 9, 9,10,10, 0, 8, 8, 8, 8, 9, 9, 9, 9, + 10,10,11,11, 0, 8, 8, 8, 8, 9, 9, 9, 9,10,10,11, + 11, 0,12,12, 9, 9,10,10,10,10,11,11,11,11, 0,13, + 13, 9, 9, 9, 9,10,10,11,11,11,12, 0, 0, 0, 9,10, + 10,10,11,11,12,11,12,12, 0, 0, 0,10,10, 9, 9,11, + 11,12,12,12,12, 0, 0, 0,13,13,10,10,11,11,12,12, + 13,13, 0, 0, 0,14,14,10,10,11,11,12,12,13,13, 0, + 0, 0, 0, 0,11,12,11,11,13,12,13,13, 0, 0, 0, 0, + 0,12,12,11,11,13,12,14,14, +}; + +static float _vq_quantthresh__44c0_sm_p7_0[] = { + -27.5, -22.5, -17.5, -12.5, -7.5, -2.5, 2.5, 7.5, + 12.5, 17.5, 22.5, 27.5, +}; + +static long _vq_quantmap__44c0_sm_p7_0[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__44c0_sm_p7_0 = { + _vq_quantthresh__44c0_sm_p7_0, + _vq_quantmap__44c0_sm_p7_0, + 13, + 13 +}; + +static static_codebook _44c0_sm_p7_0 = { + 2, 169, + _vq_lengthlist__44c0_sm_p7_0, + 1, -526516224, 1616117760, 4, 0, + _vq_quantlist__44c0_sm_p7_0, + NULL, + &_vq_auxt__44c0_sm_p7_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c0_sm_p7_1[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44c0_sm_p7_1[] = { + 2, 4, 4, 4, 4, 6, 5, 5, 5, 5, 6, 5, 5, 5, 5, 6, + 6, 6, 5, 5, 6, 6, 6, 5, 5, +}; + +static float _vq_quantthresh__44c0_sm_p7_1[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__44c0_sm_p7_1[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44c0_sm_p7_1 = { + _vq_quantthresh__44c0_sm_p7_1, + _vq_quantmap__44c0_sm_p7_1, + 5, + 5 +}; + +static static_codebook _44c0_sm_p7_1 = { + 2, 25, + _vq_lengthlist__44c0_sm_p7_1, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__44c0_sm_p7_1, + NULL, + &_vq_auxt__44c0_sm_p7_1, + NULL, + 0 +}; + +static long _vq_quantlist__44c0_sm_p8_0[] = { + 4, + 3, + 5, + 2, + 6, + 1, + 7, + 0, + 8, +}; + +static long _vq_lengthlist__44c0_sm_p8_0[] = { + 1, 3, 3,11,11,11,11,11,11, 3, 7, 6,11,11,11,11, + 11,11, 4, 8, 7,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, + 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, + 12, +}; + +static float _vq_quantthresh__44c0_sm_p8_0[] = { + -773.5, -552.5, -331.5, -110.5, 110.5, 331.5, 552.5, 773.5, +}; + +static long _vq_quantmap__44c0_sm_p8_0[] = { + 7, 5, 3, 1, 0, 2, 4, 6, + 8, +}; + +static encode_aux_threshmatch _vq_auxt__44c0_sm_p8_0 = { + _vq_quantthresh__44c0_sm_p8_0, + _vq_quantmap__44c0_sm_p8_0, + 9, + 9 +}; + +static static_codebook _44c0_sm_p8_0 = { + 2, 81, + _vq_lengthlist__44c0_sm_p8_0, + 1, -516186112, 1627103232, 4, 0, + _vq_quantlist__44c0_sm_p8_0, + NULL, + &_vq_auxt__44c0_sm_p8_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c0_sm_p8_1[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__44c0_sm_p8_1[] = { + 1, 4, 4, 6, 6, 7, 7, 9, 9,10,11,12,12, 6, 5, 5, + 7, 7, 8, 8,10,10,12,11,12,12, 6, 5, 5, 7, 7, 8, + 8,10,10,12,11,12,12,17, 7, 7, 8, 8, 9, 9,10,10, + 12,12,13,13,18, 7, 7, 8, 7, 9, 9,10,10,12,12,12, + 13,19,10,10, 8, 8,10,10,11,11,12,12,13,14,19,11, + 10, 8, 7,10,10,11,11,12,12,13,12,19,19,19,10,10, + 10,10,11,11,12,12,13,13,19,19,19,11, 9,11, 9,14, + 12,13,12,13,13,19,20,18,13,14,11,11,12,12,13,13, + 14,13,20,20,20,15,13,11,10,13,11,13,13,14,13,20, + 20,20,20,20,13,14,12,12,13,13,13,13,20,20,20,20, + 20,13,13,12,12,16,13,15,13, +}; + +static float _vq_quantthresh__44c0_sm_p8_1[] = { + -93.5, -76.5, -59.5, -42.5, -25.5, -8.5, 8.5, 25.5, + 42.5, 59.5, 76.5, 93.5, +}; + +static long _vq_quantmap__44c0_sm_p8_1[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__44c0_sm_p8_1 = { + _vq_quantthresh__44c0_sm_p8_1, + _vq_quantmap__44c0_sm_p8_1, + 13, + 13 +}; + +static static_codebook _44c0_sm_p8_1 = { + 2, 169, + _vq_lengthlist__44c0_sm_p8_1, + 1, -522616832, 1620115456, 4, 0, + _vq_quantlist__44c0_sm_p8_1, + NULL, + &_vq_auxt__44c0_sm_p8_1, + NULL, + 0 +}; + +static long _vq_quantlist__44c0_sm_p8_2[] = { + 8, + 7, + 9, + 6, + 10, + 5, + 11, + 4, + 12, + 3, + 13, + 2, + 14, + 1, + 15, + 0, + 16, +}; + +static long _vq_lengthlist__44c0_sm_p8_2[] = { + 2, 5, 5, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, + 8,10, 6, 6, 7, 7, 7, 7, 8, 8, 9, 9, 9, 9, 9, 9, + 9, 9,10, 6, 6, 7, 7, 8, 7, 8, 8, 9, 9, 9, 9, 9, + 9, 9, 9,10, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9, 9, 9, + 9, 9, 9, 9,10,10,10, 7, 7, 8, 8, 9, 8, 9, 9, 9, + 9,10, 9, 9,10,10,10,11, 8, 8, 8, 8, 9, 9, 9, 9, + 9, 9, 9,10, 9,10,10,10,10, 8, 8, 8, 8, 9, 9, 9, + 9, 9, 9, 9, 9,10,10,11,10,10, 8, 8, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9,10,10,10,10,10,11,11, 8, 8, 9, + 9, 9, 9, 9, 9, 9, 9, 9,10,11,11,11,11,11, 9, 9, + 9, 9, 9, 9, 9, 9,10, 9,10, 9,11,11,10,11,11, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9,10, 9,11,11,10,11,11, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10, 9,11,10,11,11, + 11,11,11, 9, 9,10, 9, 9, 9, 9, 9, 9, 9,10,11,10, + 11,11,11,11,10,10,10,10, 9, 9, 9, 9, 9, 9,10,11, + 11,11,11,11,11, 9,10, 9, 9, 9, 9, 9, 9, 9, 9,11, + 11,10,11,11,11,10,10,10, 9, 9, 9, 9, 9, 9, 9, 9, + 10,11,10,11,11,11,11,11,11, 9, 9, 9, 9, 9, 9, 9, + 9, +}; + +static float _vq_quantthresh__44c0_sm_p8_2[] = { + -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, + 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, +}; + +static long _vq_quantmap__44c0_sm_p8_2[] = { + 15, 13, 11, 9, 7, 5, 3, 1, + 0, 2, 4, 6, 8, 10, 12, 14, + 16, +}; + +static encode_aux_threshmatch _vq_auxt__44c0_sm_p8_2 = { + _vq_quantthresh__44c0_sm_p8_2, + _vq_quantmap__44c0_sm_p8_2, + 17, + 17 +}; + +static static_codebook _44c0_sm_p8_2 = { + 2, 289, + _vq_lengthlist__44c0_sm_p8_2, + 1, -529530880, 1611661312, 5, 0, + _vq_quantlist__44c0_sm_p8_2, + NULL, + &_vq_auxt__44c0_sm_p8_2, + NULL, + 0 +}; + +static long _huff_lengthlist__44c0_sm_short[] = { + 6, 6,12,13,13,14,16,17,17, 4, 2, 5, 8, 7, 9,12, + 15,15, 9, 4, 5, 9, 7, 9,12,16,18,11, 6, 7, 4, 6, + 8,11,14,18,10, 5, 6, 5, 5, 7,10,14,17,10, 5, 7, + 7, 6, 7,10,13,16,11, 5, 7, 7, 7, 8,10,12,15,13, + 6, 7, 5, 5, 7, 9,12,13,16, 8, 9, 6, 6, 7, 9,10, + 12, +}; + +static static_codebook _huff_book__44c0_sm_short = { + 2, 81, + _huff_lengthlist__44c0_sm_short, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist__44c1_s_long[] = { + 5, 5, 9,10, 9, 9,10,11,12, 5, 1, 5, 6, 6, 7,10, + 12,14, 9, 5, 6, 8, 8,10,12,14,14,10, 5, 8, 5, 6, + 8,11,13,14, 9, 5, 7, 6, 6, 8,10,12,11, 9, 7, 9, + 7, 6, 6, 7,10,10,10, 9,12, 9, 8, 7, 7,10,12,11, + 11,13,12,10, 9, 8, 9,11,11,14,15,15,13,11, 9, 9, + 11, +}; + +static static_codebook _huff_book__44c1_s_long = { + 2, 81, + _huff_lengthlist__44c1_s_long, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _vq_quantlist__44c1_s_p1_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__44c1_s_p1_0[] = { + 2, 4, 4, 0, 0, 0, 0, 0, 0, 5, 7, 6, 0, 0, 0, 0, + 0, 0, 5, 6, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 5, 7, 7, 0, 0, 0, 0, 0, 0, 7, 8, 8, 0, 0, 0, + 0, 0, 0, 7, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 5, 7, 7, 0, 0, 0, 0, 0, 0, 7, 8, 8, 0, 0, + 0, 0, 0, 0, 7, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 7, 7, 0, 0, 0, 0, + 0, 0, 7, 8, 8, 0, 0, 0, 0, 0, 0, 7, 8, 8, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 8, 8, 0, 0, 0, + 0, 0, 0, 8, 9,10, 0, 0, 0, 0, 0, 0, 8, 9, 9, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 8, 8, 0, 0, + 0, 0, 0, 0, 8, 9, 8, 0, 0, 0, 0, 0, 0, 8, 9, 9, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 4, 7, 7, 0, 0, 0, 0, 0, 0, 7, 8, 8, 0, 0, + 0, 0, 0, 0, 7, 8, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 6, 8, 8, 0, 0, 0, 0, 0, 0, 8,10, 9, 0, + 0, 0, 0, 0, 0, 8, 8, 9, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 7, 8, 8, 0, 0, 0, 0, 0, 0, 8, 9, 9, + 0, 0, 0, 0, 0, 0, 8, 9, 9, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + +static float _vq_quantthresh__44c1_s_p1_0[] = { + -0.5, 0.5, +}; + +static long _vq_quantmap__44c1_s_p1_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__44c1_s_p1_0 = { + _vq_quantthresh__44c1_s_p1_0, + _vq_quantmap__44c1_s_p1_0, + 3, + 3 +}; + +static static_codebook _44c1_s_p1_0 = { + 8, 6561, + _vq_lengthlist__44c1_s_p1_0, + 1, -535822336, 1611661312, 2, 0, + _vq_quantlist__44c1_s_p1_0, + NULL, + &_vq_auxt__44c1_s_p1_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c1_s_p2_0[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44c1_s_p2_0[] = { + 2, 3, 4, 6, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 6, 6, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 4, 4, 5, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6, 8, 8, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 6, 6, 6, 8, 8, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + +static float _vq_quantthresh__44c1_s_p2_0[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__44c1_s_p2_0[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44c1_s_p2_0 = { + _vq_quantthresh__44c1_s_p2_0, + _vq_quantmap__44c1_s_p2_0, + 5, + 5 +}; + +static static_codebook _44c1_s_p2_0 = { + 4, 625, + _vq_lengthlist__44c1_s_p2_0, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__44c1_s_p2_0, + NULL, + &_vq_auxt__44c1_s_p2_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c1_s_p3_0[] = { + 4, + 3, + 5, + 2, + 6, + 1, + 7, + 0, + 8, +}; + +static long _vq_lengthlist__44c1_s_p3_0[] = { + 1, 3, 2, 7, 7, 0, 0, 0, 0, 0,13,13, 6, 6, 0, 0, + 0, 0, 0,12, 0, 6, 6, 0, 0, 0, 0, 0, 0, 0, 7, 7, + 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, + 8, 9, 0, 0, 0, 0, 0, 0, 0, 8, 8, 0, 0, 0, 0, 0, + 0, 0,11,10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + +static float _vq_quantthresh__44c1_s_p3_0[] = { + -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, +}; + +static long _vq_quantmap__44c1_s_p3_0[] = { + 7, 5, 3, 1, 0, 2, 4, 6, + 8, +}; + +static encode_aux_threshmatch _vq_auxt__44c1_s_p3_0 = { + _vq_quantthresh__44c1_s_p3_0, + _vq_quantmap__44c1_s_p3_0, + 9, + 9 +}; + +static static_codebook _44c1_s_p3_0 = { + 2, 81, + _vq_lengthlist__44c1_s_p3_0, + 1, -531628032, 1611661312, 4, 0, + _vq_quantlist__44c1_s_p3_0, + NULL, + &_vq_auxt__44c1_s_p3_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c1_s_p4_0[] = { + 4, + 3, + 5, + 2, + 6, + 1, + 7, + 0, + 8, +}; + +static long _vq_lengthlist__44c1_s_p4_0[] = { + 1, 3, 3, 6, 5, 6, 6, 8, 8, 0, 0, 0, 7, 7, 7, 7, + 9, 9, 0, 0, 0, 7, 7, 7, 7, 9, 9, 0, 0, 0, 7, 7, + 8, 8,10,10, 0, 0, 0, 7, 7, 8, 8,10,10, 0, 0, 0, + 9, 9, 8, 8,10,10, 0, 0, 0, 8, 8, 8, 8,10,10, 0, + 0, 0,10,10, 9, 9,11,11, 0, 0, 0, 0, 0, 9, 9,11, + 11, +}; + +static float _vq_quantthresh__44c1_s_p4_0[] = { + -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, +}; + +static long _vq_quantmap__44c1_s_p4_0[] = { + 7, 5, 3, 1, 0, 2, 4, 6, + 8, +}; + +static encode_aux_threshmatch _vq_auxt__44c1_s_p4_0 = { + _vq_quantthresh__44c1_s_p4_0, + _vq_quantmap__44c1_s_p4_0, + 9, + 9 +}; + +static static_codebook _44c1_s_p4_0 = { + 2, 81, + _vq_lengthlist__44c1_s_p4_0, + 1, -531628032, 1611661312, 4, 0, + _vq_quantlist__44c1_s_p4_0, + NULL, + &_vq_auxt__44c1_s_p4_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c1_s_p5_0[] = { + 8, + 7, + 9, + 6, + 10, + 5, + 11, + 4, + 12, + 3, + 13, + 2, + 14, + 1, + 15, + 0, + 16, +}; + +static long _vq_lengthlist__44c1_s_p5_0[] = { + 1, 4, 3, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9,10,10,11, + 11, 0, 0, 0, 7, 7, 8, 8, 9, 9, 9, 9,10,10,10,10, + 11,11, 0, 0, 0, 7, 7, 8, 8, 9, 9, 9, 9,10,10,10, + 10,11,11, 0, 0, 0, 7, 7, 8, 8, 9, 9, 9, 9,10,10, + 11,11,11,11, 0, 0, 0, 7, 7, 8, 8, 9, 9, 9, 9,10, + 10,11,11,12,11, 0, 0, 0, 8, 8, 9, 9, 9,10,10,10, + 10,10,11,11,12,12, 0, 0, 0, 8, 8, 9, 9,10, 9,10, + 10,10,10,11,11,12,12, 0, 0, 0, 9, 9, 9, 9,10,10, + 10,10,11,11,12,12,12,12, 0, 0, 0, 0, 0, 9, 9,10, + 10,10,10,11,11,12,12,12,12, 0, 0, 0, 0, 0, 9, 9, + 10,10,10,11,11,11,12,12,13,13, 0, 0, 0, 0, 0, 9, + 9,10,10,10,10,11,11,12,12,13,13, 0, 0, 0, 0, 0, + 10,10,10,10,11,11,12,12,12,12,13,13, 0, 0, 0, 0, + 0, 0, 0,10,10,11,11,12,12,12,12,13,13, 0, 0, 0, + 0, 0, 0, 0,11,11,12,12,12,12,13,13,13,13, 0, 0, + 0, 0, 0, 0, 0,11,11,11,11,12,12,13,13,13,13, 0, + 0, 0, 0, 0, 0, 0,12,12,12,12,12,12,13,13,14,14, + 0, 0, 0, 0, 0, 0, 0, 0, 0,12,12,12,12,13,13,14, + 14, +}; + +static float _vq_quantthresh__44c1_s_p5_0[] = { + -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, + 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, +}; + +static long _vq_quantmap__44c1_s_p5_0[] = { + 15, 13, 11, 9, 7, 5, 3, 1, + 0, 2, 4, 6, 8, 10, 12, 14, + 16, +}; + +static encode_aux_threshmatch _vq_auxt__44c1_s_p5_0 = { + _vq_quantthresh__44c1_s_p5_0, + _vq_quantmap__44c1_s_p5_0, + 17, + 17 +}; + +static static_codebook _44c1_s_p5_0 = { + 2, 289, + _vq_lengthlist__44c1_s_p5_0, + 1, -529530880, 1611661312, 5, 0, + _vq_quantlist__44c1_s_p5_0, + NULL, + &_vq_auxt__44c1_s_p5_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c1_s_p6_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__44c1_s_p6_0[] = { + 1, 4, 4, 7, 6, 6, 7, 6, 6, 4, 7, 7,10, 9, 9,11, + 9, 9, 4, 7, 7,10, 9, 9,11, 9, 9, 6,10,10,11,11, + 11,11,10,10, 6, 9, 9,11,10,10,11,10,10, 6, 9, 9, + 11,10,11,11,10,10, 7,11,10,11,11,11,12,11,11, 7, + 9, 9,11,10,10,11,11,10, 6, 9, 9,10,10,10,12,10, + 11, +}; + +static float _vq_quantthresh__44c1_s_p6_0[] = { + -5.5, 5.5, +}; + +static long _vq_quantmap__44c1_s_p6_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__44c1_s_p6_0 = { + _vq_quantthresh__44c1_s_p6_0, + _vq_quantmap__44c1_s_p6_0, + 3, + 3 +}; + +static static_codebook _44c1_s_p6_0 = { + 4, 81, + _vq_lengthlist__44c1_s_p6_0, + 1, -529137664, 1618345984, 2, 0, + _vq_quantlist__44c1_s_p6_0, + NULL, + &_vq_auxt__44c1_s_p6_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c1_s_p6_1[] = { + 5, + 4, + 6, + 3, + 7, + 2, + 8, + 1, + 9, + 0, + 10, +}; + +static long _vq_lengthlist__44c1_s_p6_1[] = { + 2, 3, 3, 6, 6, 7, 7, 7, 7, 8, 8,10,10,10, 6, 6, + 7, 7, 8, 8, 8, 8,10,10,10, 6, 6, 7, 7, 8, 8, 8, + 8,10,10,10, 7, 7, 7, 7, 8, 8, 8, 8,10,10,10, 7, + 7, 7, 7, 8, 8, 8, 8,10,10,10, 7, 7, 8, 8, 8, 8, + 8, 8,10,10,10, 7, 7, 8, 8, 8, 8, 8, 8,10,10,10, + 8, 8, 8, 8, 8, 8, 8, 8,10,10,10,10,10, 8, 8, 8, + 8, 8, 8,10,10,10,10,10, 9, 9, 8, 8, 8, 8,10,10, + 10,10,10, 8, 8, 8, 8, 8, 8, +}; + +static float _vq_quantthresh__44c1_s_p6_1[] = { + -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, + 3.5, 4.5, +}; + +static long _vq_quantmap__44c1_s_p6_1[] = { + 9, 7, 5, 3, 1, 0, 2, 4, + 6, 8, 10, +}; + +static encode_aux_threshmatch _vq_auxt__44c1_s_p6_1 = { + _vq_quantthresh__44c1_s_p6_1, + _vq_quantmap__44c1_s_p6_1, + 11, + 11 +}; + +static static_codebook _44c1_s_p6_1 = { + 2, 121, + _vq_lengthlist__44c1_s_p6_1, + 1, -531365888, 1611661312, 4, 0, + _vq_quantlist__44c1_s_p6_1, + NULL, + &_vq_auxt__44c1_s_p6_1, + NULL, + 0 +}; + +static long _vq_quantlist__44c1_s_p7_0[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__44c1_s_p7_0[] = { + 1, 4, 4, 6, 6, 7, 7, 7, 7, 8, 8,10, 9, 7, 5, 6, + 7, 7, 8, 8, 8, 8, 9, 9,10,10, 7, 5, 5, 7, 7, 8, + 8, 8, 8, 9, 9,10,10, 0, 8, 8, 8, 8, 9, 9, 9, 9, + 10,10,11,10, 0, 8, 8, 8, 8, 9, 9, 9, 9,10,10,11, + 11, 0,12,12, 9, 9, 9,10,10,10,11,11,11,11, 0,13, + 13, 9, 9, 9, 9,10,10,11,11,11,11, 0, 0, 0,10,10, + 10,10,11,11,12,11,12,12, 0, 0, 0,10,10,10, 9,11, + 11,12,11,13,12, 0, 0, 0,13,13,10,10,11,11,12,12, + 13,13, 0, 0, 0,14,14,10,10,11,11,12,12,13,13, 0, + 0, 0, 0, 0,11,12,11,11,12,12,14,13, 0, 0, 0, 0, + 0,12,11,11,11,13,10,14,13, +}; + +static float _vq_quantthresh__44c1_s_p7_0[] = { + -27.5, -22.5, -17.5, -12.5, -7.5, -2.5, 2.5, 7.5, + 12.5, 17.5, 22.5, 27.5, +}; + +static long _vq_quantmap__44c1_s_p7_0[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__44c1_s_p7_0 = { + _vq_quantthresh__44c1_s_p7_0, + _vq_quantmap__44c1_s_p7_0, + 13, + 13 +}; + +static static_codebook _44c1_s_p7_0 = { + 2, 169, + _vq_lengthlist__44c1_s_p7_0, + 1, -526516224, 1616117760, 4, 0, + _vq_quantlist__44c1_s_p7_0, + NULL, + &_vq_auxt__44c1_s_p7_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c1_s_p7_1[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44c1_s_p7_1[] = { + 2, 3, 3, 5, 5, 6, 6, 6, 5, 5, 6, 6, 6, 5, 5, 6, + 6, 6, 5, 5, 6, 6, 6, 5, 5, +}; + +static float _vq_quantthresh__44c1_s_p7_1[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__44c1_s_p7_1[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44c1_s_p7_1 = { + _vq_quantthresh__44c1_s_p7_1, + _vq_quantmap__44c1_s_p7_1, + 5, + 5 +}; + +static static_codebook _44c1_s_p7_1 = { + 2, 25, + _vq_lengthlist__44c1_s_p7_1, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__44c1_s_p7_1, + NULL, + &_vq_auxt__44c1_s_p7_1, + NULL, + 0 +}; + +static long _vq_quantlist__44c1_s_p8_0[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__44c1_s_p8_0[] = { + 1, 4, 3,10,10,10,10,10,10,10,10,10,10, 4, 8, 6, + 10,10,10,10,10,10,10,10,10,10, 4, 8, 7,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10, +}; + +static float _vq_quantthresh__44c1_s_p8_0[] = { + -1215.5, -994.5, -773.5, -552.5, -331.5, -110.5, 110.5, 331.5, + 552.5, 773.5, 994.5, 1215.5, +}; + +static long _vq_quantmap__44c1_s_p8_0[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__44c1_s_p8_0 = { + _vq_quantthresh__44c1_s_p8_0, + _vq_quantmap__44c1_s_p8_0, + 13, + 13 +}; + +static static_codebook _44c1_s_p8_0 = { + 2, 169, + _vq_lengthlist__44c1_s_p8_0, + 1, -514541568, 1627103232, 4, 0, + _vq_quantlist__44c1_s_p8_0, + NULL, + &_vq_auxt__44c1_s_p8_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c1_s_p8_1[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__44c1_s_p8_1[] = { + 1, 4, 4, 6, 5, 7, 7, 9, 9,10,10,12,12, 6, 5, 5, + 7, 7, 8, 8,10,10,12,11,12,12, 6, 5, 5, 7, 7, 8, + 8,10,10,11,11,12,12,15, 7, 7, 8, 8, 9, 9,11,11, + 12,12,13,12,15, 8, 8, 8, 7, 9, 9,10,10,12,12,13, + 13,16,11,10, 8, 8,10,10,11,11,12,12,13,13,16,11, + 11, 9, 8,11,10,11,11,12,12,13,12,16,16,16,10,11, + 10,11,12,12,12,12,13,13,16,16,16,11, 9,11, 9,14, + 12,12,12,13,13,16,16,16,12,14,11,12,12,12,13,13, + 14,13,16,16,16,15,13,12,10,13,10,13,14,13,13,16, + 16,16,16,16,13,14,12,13,13,12,13,13,16,16,16,16, + 16,13,12,12,11,14,12,15,13, +}; + +static float _vq_quantthresh__44c1_s_p8_1[] = { + -93.5, -76.5, -59.5, -42.5, -25.5, -8.5, 8.5, 25.5, + 42.5, 59.5, 76.5, 93.5, +}; + +static long _vq_quantmap__44c1_s_p8_1[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__44c1_s_p8_1 = { + _vq_quantthresh__44c1_s_p8_1, + _vq_quantmap__44c1_s_p8_1, + 13, + 13 +}; + +static static_codebook _44c1_s_p8_1 = { + 2, 169, + _vq_lengthlist__44c1_s_p8_1, + 1, -522616832, 1620115456, 4, 0, + _vq_quantlist__44c1_s_p8_1, + NULL, + &_vq_auxt__44c1_s_p8_1, + NULL, + 0 +}; + +static long _vq_quantlist__44c1_s_p8_2[] = { + 8, + 7, + 9, + 6, + 10, + 5, + 11, + 4, + 12, + 3, + 13, + 2, + 14, + 1, + 15, + 0, + 16, +}; + +static long _vq_lengthlist__44c1_s_p8_2[] = { + 2, 4, 4, 6, 6, 6, 6, 7, 7, 8, 8, 8, 8, 8, 8, 8, + 8,10,10,10, 7, 7, 7, 7, 8, 8, 9, 9, 9, 9, 9, 9, + 9, 9,10,10,10, 7, 7, 8, 7, 8, 8, 9, 9, 9, 9, 9, + 9, 9, 9,10,10,10, 7, 7, 8, 8, 8, 9, 9, 9, 9, 9, + 9,10, 9, 9,10,10,10, 7, 7, 8, 8, 9, 8, 9, 9, 9, + 9,10, 9, 9,10,10,11,11, 8, 8, 8, 8, 9, 9, 9, 9, + 9, 9,10, 9, 9,10,10,10,10, 8, 8, 8, 8, 9, 9, 9, + 9, 9, 9, 9, 9,10,10,11,11,11, 8, 8, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9,10,10,10,10,11,11,11, 8, 8, 9, + 9, 9, 9,10, 9, 9, 9, 9, 9,11,11,11,11,11, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,11,10,10,11,11, 9, + 9, 9, 9, 9, 9, 9, 9, 9,10,10,10,10,11,10,11,11, + 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10, 9,10,10,11,11, + 11,11,11, 9, 9, 9,10, 9, 9, 9, 9, 9, 9,10,11,11, + 11,11,11,11,10,10,10,10, 9, 9, 9, 9, 9, 9,10,11, + 11,11,11,11,11, 9,10, 9, 9, 9, 9,10, 9, 9, 9,11, + 11,11,11,11,11,11,10,10, 9, 9, 9, 9, 9, 9,10, 9, + 11,11,10,11,11,11,11,10,11, 9, 9, 9, 9, 9, 9, 9, + 9, +}; + +static float _vq_quantthresh__44c1_s_p8_2[] = { + -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, + 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, +}; + +static long _vq_quantmap__44c1_s_p8_2[] = { + 15, 13, 11, 9, 7, 5, 3, 1, + 0, 2, 4, 6, 8, 10, 12, 14, + 16, +}; + +static encode_aux_threshmatch _vq_auxt__44c1_s_p8_2 = { + _vq_quantthresh__44c1_s_p8_2, + _vq_quantmap__44c1_s_p8_2, + 17, + 17 +}; + +static static_codebook _44c1_s_p8_2 = { + 2, 289, + _vq_lengthlist__44c1_s_p8_2, + 1, -529530880, 1611661312, 5, 0, + _vq_quantlist__44c1_s_p8_2, + NULL, + &_vq_auxt__44c1_s_p8_2, + NULL, + 0 +}; + +static long _huff_lengthlist__44c1_s_short[] = { + 6, 8,13,12,13,14,15,16,16, 4, 2, 4, 7, 6, 8,11, + 13,15,10, 4, 4, 8, 6, 8,11,14,17,11, 5, 6, 5, 6, + 8,12,14,17,11, 5, 5, 6, 5, 7,10,13,16,12, 6, 7, + 8, 7, 8,10,13,15,13, 8, 8, 7, 7, 8,10,12,15,15, + 7, 7, 5, 5, 7, 9,12,14,15, 8, 8, 6, 6, 7, 8,10, + 11, +}; + +static static_codebook _huff_book__44c1_s_short = { + 2, 81, + _huff_lengthlist__44c1_s_short, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist__44c1_sm_long[] = { + 5, 4, 8,10, 9, 9,10,11,12, 4, 2, 5, 6, 6, 8,10, + 11,13, 8, 4, 6, 8, 7, 9,12,12,14,10, 6, 8, 4, 5, + 6, 9,11,12, 9, 5, 6, 5, 5, 6, 9,11,11, 9, 7, 9, + 6, 5, 5, 7,10,10,10, 9,11, 8, 7, 6, 7, 9,11,11, + 12,13,10,10, 9, 8, 9,11,11,15,15,12,13,11, 9,10, + 11, +}; + +static static_codebook _huff_book__44c1_sm_long = { + 2, 81, + _huff_lengthlist__44c1_sm_long, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _vq_quantlist__44c1_sm_p1_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__44c1_sm_p1_0[] = { + 1, 5, 5, 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, 0, 0, 0, + 0, 0, 5, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 5, 8, 7, 0, 0, 0, 0, 0, 0, 7, 9, 9, 0, 0, 0, + 0, 0, 0, 7, 8, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 5, 7, 7, 0, 0, 0, 0, 0, 0, 7, 9, 8, 0, 0, + 0, 0, 0, 0, 7, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 8, 7, 0, 0, 0, 0, + 0, 0, 8, 9, 9, 0, 0, 0, 0, 0, 0, 8, 9, 9, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 9, 9, 0, 0, 0, + 0, 0, 0, 9, 9,10, 0, 0, 0, 0, 0, 0, 9,10,10, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 9, 9, 0, 0, + 0, 0, 0, 0, 8,10, 9, 0, 0, 0, 0, 0, 0, 9,10,10, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 5, 7, 8, 0, 0, 0, 0, 0, 0, 8, 9, 9, 0, 0, + 0, 0, 0, 0, 8, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 7, 9, 9, 0, 0, 0, 0, 0, 0, 9,10,10, 0, + 0, 0, 0, 0, 0, 8, 9,10, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 7, 9, 9, 0, 0, 0, 0, 0, 0, 9,10,10, + 0, 0, 0, 0, 0, 0, 9,10, 9, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + +static float _vq_quantthresh__44c1_sm_p1_0[] = { + -0.5, 0.5, +}; + +static long _vq_quantmap__44c1_sm_p1_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__44c1_sm_p1_0 = { + _vq_quantthresh__44c1_sm_p1_0, + _vq_quantmap__44c1_sm_p1_0, + 3, + 3 +}; + +static static_codebook _44c1_sm_p1_0 = { + 8, 6561, + _vq_lengthlist__44c1_sm_p1_0, + 1, -535822336, 1611661312, 2, 0, + _vq_quantlist__44c1_sm_p1_0, + NULL, + &_vq_auxt__44c1_sm_p1_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c1_sm_p2_0[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44c1_sm_p2_0[] = { + 2, 3, 4, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 6, 6, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 4, 4, 4, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6, 9, 9, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 6, 6, 7, 9, 9, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + +static float _vq_quantthresh__44c1_sm_p2_0[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__44c1_sm_p2_0[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44c1_sm_p2_0 = { + _vq_quantthresh__44c1_sm_p2_0, + _vq_quantmap__44c1_sm_p2_0, + 5, + 5 +}; + +static static_codebook _44c1_sm_p2_0 = { + 4, 625, + _vq_lengthlist__44c1_sm_p2_0, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__44c1_sm_p2_0, + NULL, + &_vq_auxt__44c1_sm_p2_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c1_sm_p3_0[] = { + 4, + 3, + 5, + 2, + 6, + 1, + 7, + 0, + 8, +}; + +static long _vq_lengthlist__44c1_sm_p3_0[] = { + 1, 3, 3, 7, 7, 0, 0, 0, 0, 0, 5, 5, 6, 6, 0, 0, + 0, 0, 0, 5, 5, 7, 7, 0, 0, 0, 0, 0, 7, 7, 7, 7, + 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, + 8, 9, 0, 0, 0, 0, 0, 0, 0, 8, 8, 0, 0, 0, 0, 0, + 0, 0,10,10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + +static float _vq_quantthresh__44c1_sm_p3_0[] = { + -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, +}; + +static long _vq_quantmap__44c1_sm_p3_0[] = { + 7, 5, 3, 1, 0, 2, 4, 6, + 8, +}; + +static encode_aux_threshmatch _vq_auxt__44c1_sm_p3_0 = { + _vq_quantthresh__44c1_sm_p3_0, + _vq_quantmap__44c1_sm_p3_0, + 9, + 9 +}; + +static static_codebook _44c1_sm_p3_0 = { + 2, 81, + _vq_lengthlist__44c1_sm_p3_0, + 1, -531628032, 1611661312, 4, 0, + _vq_quantlist__44c1_sm_p3_0, + NULL, + &_vq_auxt__44c1_sm_p3_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c1_sm_p4_0[] = { + 4, + 3, + 5, + 2, + 6, + 1, + 7, + 0, + 8, +}; + +static long _vq_lengthlist__44c1_sm_p4_0[] = { + 1, 3, 3, 6, 6, 7, 7, 9, 9, 0, 6, 6, 7, 7, 8, 8, + 9, 9, 0, 6, 6, 7, 7, 8, 8, 9, 9, 0, 7, 7, 8, 8, + 8, 8,10,10, 0, 0, 0, 8, 8, 8, 8,10,10, 0, 0, 0, + 8, 8, 9, 9,11,11, 0, 0, 0, 9, 9, 9, 9,11,11, 0, + 0, 0,10,10,10,10,11,11, 0, 0, 0, 0, 0, 9, 9,11, + 11, +}; + +static float _vq_quantthresh__44c1_sm_p4_0[] = { + -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, +}; + +static long _vq_quantmap__44c1_sm_p4_0[] = { + 7, 5, 3, 1, 0, 2, 4, 6, + 8, +}; + +static encode_aux_threshmatch _vq_auxt__44c1_sm_p4_0 = { + _vq_quantthresh__44c1_sm_p4_0, + _vq_quantmap__44c1_sm_p4_0, + 9, + 9 +}; + +static static_codebook _44c1_sm_p4_0 = { + 2, 81, + _vq_lengthlist__44c1_sm_p4_0, + 1, -531628032, 1611661312, 4, 0, + _vq_quantlist__44c1_sm_p4_0, + NULL, + &_vq_auxt__44c1_sm_p4_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c1_sm_p5_0[] = { + 8, + 7, + 9, + 6, + 10, + 5, + 11, + 4, + 12, + 3, + 13, + 2, + 14, + 1, + 15, + 0, + 16, +}; + +static long _vq_lengthlist__44c1_sm_p5_0[] = { + 2, 3, 3, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9,10,10,11, + 11, 0, 5, 5, 6, 6, 8, 8, 9, 9, 9, 9,10,10,10,10, + 11,11, 0, 5, 5, 6, 6, 8, 8, 9, 9, 9, 9,10,10,10, + 10,11,11, 0, 7, 7, 7, 7, 8, 8, 9, 9, 9, 9,10,10, + 11,11,12,12, 0, 0, 0, 7, 7, 8, 8, 9, 9, 9, 9,10, + 10,11,11,12,12, 0, 0, 0, 8, 8, 8, 8, 9, 9,10,10, + 10,11,11,11,12,12, 0, 0, 0, 8, 8, 8, 8, 9, 9,10, + 10,10,10,11,11,12,12, 0, 0, 0, 9, 9, 9, 9,10,10, + 10,10,11,11,12,12,12,12, 0, 0, 0, 0, 0, 9, 9,10, + 10,10,10,11,11,12,12,13,13, 0, 0, 0, 0, 0, 9, 9, + 9, 9,10,10,11,11,12,12,13,13, 0, 0, 0, 0, 0, 9, + 9, 9, 9,10,10,11,11,12,12,13,13, 0, 0, 0, 0, 0, + 9, 9,10,10,11,11,12,12,12,12,13,13, 0, 0, 0, 0, + 0, 0, 0,10,10,11,11,12,12,12,12,13,13, 0, 0, 0, + 0, 0, 0, 0,11,11,11,11,12,12,13,13,13,13, 0, 0, + 0, 0, 0, 0, 0,11,11,11,11,12,12,13,13,13,13, 0, + 0, 0, 0, 0, 0, 0,11,11,12,12,12,12,13,13,14,14, + 0, 0, 0, 0, 0, 0, 0, 0, 0,12,12,12,12,13,13,14, + 14, +}; + +static float _vq_quantthresh__44c1_sm_p5_0[] = { + -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, + 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, +}; + +static long _vq_quantmap__44c1_sm_p5_0[] = { + 15, 13, 11, 9, 7, 5, 3, 1, + 0, 2, 4, 6, 8, 10, 12, 14, + 16, +}; + +static encode_aux_threshmatch _vq_auxt__44c1_sm_p5_0 = { + _vq_quantthresh__44c1_sm_p5_0, + _vq_quantmap__44c1_sm_p5_0, + 17, + 17 +}; + +static static_codebook _44c1_sm_p5_0 = { + 2, 289, + _vq_lengthlist__44c1_sm_p5_0, + 1, -529530880, 1611661312, 5, 0, + _vq_quantlist__44c1_sm_p5_0, + NULL, + &_vq_auxt__44c1_sm_p5_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c1_sm_p6_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__44c1_sm_p6_0[] = { + 1, 4, 4, 7, 6, 6, 7, 6, 6, 4, 7, 7,10, 9, 9,11, + 9, 9, 4, 7, 7,10, 9, 9,11, 9, 9, 7,10,10,10,11, + 11,11,10,10, 6, 9, 9,11,11,10,11,10,10, 6, 9, 9, + 11,10,11,11,10,10, 7,11,11,11,11,11,11,11,11, 6, + 9, 9,11,10,10,11,11,10, 6, 9, 9,10,10,10,11,10, + 11, +}; + +static float _vq_quantthresh__44c1_sm_p6_0[] = { + -5.5, 5.5, +}; + +static long _vq_quantmap__44c1_sm_p6_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__44c1_sm_p6_0 = { + _vq_quantthresh__44c1_sm_p6_0, + _vq_quantmap__44c1_sm_p6_0, + 3, + 3 +}; + +static static_codebook _44c1_sm_p6_0 = { + 4, 81, + _vq_lengthlist__44c1_sm_p6_0, + 1, -529137664, 1618345984, 2, 0, + _vq_quantlist__44c1_sm_p6_0, + NULL, + &_vq_auxt__44c1_sm_p6_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c1_sm_p6_1[] = { + 5, + 4, + 6, + 3, + 7, + 2, + 8, + 1, + 9, + 0, + 10, +}; + +static long _vq_lengthlist__44c1_sm_p6_1[] = { + 2, 4, 4, 6, 6, 7, 7, 7, 7, 8, 8,10, 5, 5, 6, 6, + 7, 7, 8, 8, 8, 8,10, 5, 5, 6, 6, 7, 7, 8, 8, 8, + 8,10, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8,10,10,10, 7, + 7, 7, 7, 8, 8, 8, 8,10,10,10, 7, 7, 8, 8, 8, 8, + 8, 8,10,10,10, 7, 7, 8, 8, 8, 8, 8, 8,10,10,10, + 8, 8, 8, 8, 8, 8, 9, 8,10,10,10,10,10, 8, 8, 8, + 8, 8, 8,10,10,10,10,10, 9, 9, 8, 8, 8, 8,10,10, + 10,10,10, 8, 8, 8, 8, 8, 8, +}; + +static float _vq_quantthresh__44c1_sm_p6_1[] = { + -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, + 3.5, 4.5, +}; + +static long _vq_quantmap__44c1_sm_p6_1[] = { + 9, 7, 5, 3, 1, 0, 2, 4, + 6, 8, 10, +}; + +static encode_aux_threshmatch _vq_auxt__44c1_sm_p6_1 = { + _vq_quantthresh__44c1_sm_p6_1, + _vq_quantmap__44c1_sm_p6_1, + 11, + 11 +}; + +static static_codebook _44c1_sm_p6_1 = { + 2, 121, + _vq_lengthlist__44c1_sm_p6_1, + 1, -531365888, 1611661312, 4, 0, + _vq_quantlist__44c1_sm_p6_1, + NULL, + &_vq_auxt__44c1_sm_p6_1, + NULL, + 0 +}; + +static long _vq_quantlist__44c1_sm_p7_0[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__44c1_sm_p7_0[] = { + 1, 4, 4, 6, 6, 7, 7, 7, 7, 8, 8, 9, 9, 7, 5, 5, + 7, 7, 8, 8, 8, 8, 9, 9,10,10, 7, 5, 6, 7, 7, 8, + 8, 8, 8, 9, 9,11,10, 0, 8, 8, 8, 8, 9, 9, 9, 9, + 10,10,11,11, 0, 8, 8, 8, 8, 9, 9, 9, 9,10,10,11, + 11, 0,12,12, 9, 9,10,10,10,10,11,11,11,11, 0,13, + 13, 9, 9, 9, 9,10,10,11,11,12,12, 0, 0, 0, 9,10, + 9,10,11,11,12,11,13,12, 0, 0, 0,10,10, 9, 9,11, + 11,12,12,13,12, 0, 0, 0,13,13,10,10,11,11,12,12, + 13,13, 0, 0, 0,14,14,10,10,11,11,12,12,13,13, 0, + 0, 0, 0, 0,11,12,11,11,12,13,14,13, 0, 0, 0, 0, + 0,12,12,11,11,13,12,14,13, +}; + +static float _vq_quantthresh__44c1_sm_p7_0[] = { + -27.5, -22.5, -17.5, -12.5, -7.5, -2.5, 2.5, 7.5, + 12.5, 17.5, 22.5, 27.5, +}; + +static long _vq_quantmap__44c1_sm_p7_0[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__44c1_sm_p7_0 = { + _vq_quantthresh__44c1_sm_p7_0, + _vq_quantmap__44c1_sm_p7_0, + 13, + 13 +}; + +static static_codebook _44c1_sm_p7_0 = { + 2, 169, + _vq_lengthlist__44c1_sm_p7_0, + 1, -526516224, 1616117760, 4, 0, + _vq_quantlist__44c1_sm_p7_0, + NULL, + &_vq_auxt__44c1_sm_p7_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c1_sm_p7_1[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44c1_sm_p7_1[] = { + 2, 4, 4, 4, 5, 6, 5, 5, 5, 5, 6, 5, 5, 5, 5, 6, + 5, 5, 5, 5, 6, 6, 6, 5, 5, +}; + +static float _vq_quantthresh__44c1_sm_p7_1[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__44c1_sm_p7_1[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44c1_sm_p7_1 = { + _vq_quantthresh__44c1_sm_p7_1, + _vq_quantmap__44c1_sm_p7_1, + 5, + 5 +}; + +static static_codebook _44c1_sm_p7_1 = { + 2, 25, + _vq_lengthlist__44c1_sm_p7_1, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__44c1_sm_p7_1, + NULL, + &_vq_auxt__44c1_sm_p7_1, + NULL, + 0 +}; + +static long _vq_quantlist__44c1_sm_p8_0[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__44c1_sm_p8_0[] = { + 1, 3, 3,13,13,13,13,13,13,13,13,13,13, 3, 6, 6, + 13,13,13,13,13,13,13,13,13,13, 4, 8, 7,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13, +}; + +static float _vq_quantthresh__44c1_sm_p8_0[] = { + -1215.5, -994.5, -773.5, -552.5, -331.5, -110.5, 110.5, 331.5, + 552.5, 773.5, 994.5, 1215.5, +}; + +static long _vq_quantmap__44c1_sm_p8_0[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__44c1_sm_p8_0 = { + _vq_quantthresh__44c1_sm_p8_0, + _vq_quantmap__44c1_sm_p8_0, + 13, + 13 +}; + +static static_codebook _44c1_sm_p8_0 = { + 2, 169, + _vq_lengthlist__44c1_sm_p8_0, + 1, -514541568, 1627103232, 4, 0, + _vq_quantlist__44c1_sm_p8_0, + NULL, + &_vq_auxt__44c1_sm_p8_0, + NULL, + 0 +}; + +static long _vq_quantlist__44c1_sm_p8_1[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__44c1_sm_p8_1[] = { + 1, 4, 4, 6, 6, 7, 7, 9, 9,10,11,12,12, 6, 5, 5, + 7, 7, 8, 7,10,10,11,11,12,12, 6, 5, 5, 7, 7, 8, + 8,10,10,11,11,12,12,16, 7, 7, 8, 8, 9, 9,11,11, + 12,12,13,13,17, 7, 7, 8, 7, 9, 9,11,10,12,12,13, + 13,19,11,10, 8, 8,10,10,11,11,12,12,13,13,19,11, + 11, 9, 7,11,10,11,11,12,12,13,12,19,19,19,10,10, + 10,10,11,12,12,12,13,14,18,19,19,11, 9,11, 9,13, + 12,12,12,13,13,19,20,19,13,15,11,11,12,12,13,13, + 14,13,18,19,20,15,13,12,10,13,10,13,13,13,14,20, + 20,20,20,20,13,14,12,12,13,12,13,13,20,20,20,20, + 20,13,12,12,12,14,12,14,13, +}; + +static float _vq_quantthresh__44c1_sm_p8_1[] = { + -93.5, -76.5, -59.5, -42.5, -25.5, -8.5, 8.5, 25.5, + 42.5, 59.5, 76.5, 93.5, +}; + +static long _vq_quantmap__44c1_sm_p8_1[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__44c1_sm_p8_1 = { + _vq_quantthresh__44c1_sm_p8_1, + _vq_quantmap__44c1_sm_p8_1, + 13, + 13 +}; + +static static_codebook _44c1_sm_p8_1 = { + 2, 169, + _vq_lengthlist__44c1_sm_p8_1, + 1, -522616832, 1620115456, 4, 0, + _vq_quantlist__44c1_sm_p8_1, + NULL, + &_vq_auxt__44c1_sm_p8_1, + NULL, + 0 +}; + +static long _vq_quantlist__44c1_sm_p8_2[] = { + 8, + 7, + 9, + 6, + 10, + 5, + 11, + 4, + 12, + 3, + 13, + 2, + 14, + 1, + 15, + 0, + 16, +}; + +static long _vq_lengthlist__44c1_sm_p8_2[] = { + 2, 5, 5, 6, 6, 7, 6, 7, 7, 8, 8, 8, 8, 8, 8, 8, + 8,10, 6, 6, 7, 7, 7, 7, 8, 8, 9, 9, 9, 9, 9, 9, + 9, 9,10, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, + 9, 9, 9,10, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9, 9, 9, + 9, 9, 9, 9,10,10,10, 7, 7, 8, 8, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9,10,11,11, 8, 8, 8, 8, 9, 9, 9, 9, + 9, 9,10,10, 9,10,10,10,10, 8, 8, 8, 8, 9, 9, 9, + 9, 9, 9, 9, 9,10,10,11,10,10, 8, 8, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9,10, 9,10,10,10,11,11, 8, 8, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9,11,11,11,11,11, 9, 9, + 9, 9, 9, 9, 9, 9,10, 9,10, 9,11,11,11,11,11, 9, + 8, 9, 9, 9, 9, 9, 9, 9,10,10, 9,11,11,10,11,11, + 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10, 9,11,11,11,11, + 11,11,11, 9, 9,10, 9, 9, 9, 9,10, 9,10,10,11,10, + 11,11,11,11, 9,10,10,10, 9, 9, 9, 9, 9, 9,10,11, + 11,11,11,11,11, 9, 9, 9, 9, 9, 9, 9, 9,10, 9,11, + 11,10,11,11,11,11,10,10, 9, 9, 9, 9, 9, 9,10, 9, + 10,11,10,11,11,11,11,11,11, 9, 9,10, 9, 9, 9, 9, + 9, +}; + +static float _vq_quantthresh__44c1_sm_p8_2[] = { + -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, + 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, +}; + +static long _vq_quantmap__44c1_sm_p8_2[] = { + 15, 13, 11, 9, 7, 5, 3, 1, + 0, 2, 4, 6, 8, 10, 12, 14, + 16, +}; + +static encode_aux_threshmatch _vq_auxt__44c1_sm_p8_2 = { + _vq_quantthresh__44c1_sm_p8_2, + _vq_quantmap__44c1_sm_p8_2, + 17, + 17 +}; + +static static_codebook _44c1_sm_p8_2 = { + 2, 289, + _vq_lengthlist__44c1_sm_p8_2, + 1, -529530880, 1611661312, 5, 0, + _vq_quantlist__44c1_sm_p8_2, + NULL, + &_vq_auxt__44c1_sm_p8_2, + NULL, + 0 +}; + +static long _huff_lengthlist__44c1_sm_short[] = { + 4, 7,13,14,14,15,16,18,18, 4, 2, 5, 8, 7, 9,12, + 15,15,10, 4, 5,10, 6, 8,11,15,17,12, 5, 7, 5, 6, + 8,11,14,17,11, 5, 6, 6, 5, 6, 9,13,17,12, 6, 7, + 6, 5, 6, 8,12,14,14, 7, 8, 6, 6, 7, 9,11,14,14, + 8, 9, 6, 5, 6, 9,11,13,16,10,10, 7, 6, 7, 8,10, + 11, +}; + +static static_codebook _huff_book__44c1_sm_short = { + 2, 81, + _huff_lengthlist__44c1_sm_short, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist__44cn1_s_long[] = { + 4, 4, 7, 8, 7, 8,10,12,17, 3, 1, 6, 6, 7, 8,10, + 12,15, 7, 6, 9, 9, 9,11,12,14,17, 8, 6, 9, 6, 7, + 9,11,13,17, 7, 6, 9, 7, 7, 8, 9,12,15, 8, 8,10, + 8, 7, 7, 7,10,14, 9,10,12,10, 8, 8, 8,10,14,11, + 13,15,13,12,11,11,12,16,17,18,18,19,20,18,16,16, + 20, +}; + +static static_codebook _huff_book__44cn1_s_long = { + 2, 81, + _huff_lengthlist__44cn1_s_long, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _vq_quantlist__44cn1_s_p1_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__44cn1_s_p1_0[] = { + 1, 4, 4, 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, 0, 0, 0, + 0, 0, 5, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 5, 8, 8, 0, 0, 0, 0, 0, 0, 8, 9, 9, 0, 0, 0, + 0, 0, 0, 7, 9,10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 5, 8, 8, 0, 0, 0, 0, 0, 0, 7,10, 9, 0, 0, + 0, 0, 0, 0, 8,10, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 8, 8, 0, 0, 0, 0, + 0, 0, 8,10,10, 0, 0, 0, 0, 0, 0, 8, 9,10, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7,10,10, 0, 0, 0, + 0, 0, 0, 9, 9,11, 0, 0, 0, 0, 0, 0,10,11,11, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7,10,10, 0, 0, + 0, 0, 0, 0, 9,11, 9, 0, 0, 0, 0, 0, 0,10,11,11, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 5, 8, 8, 0, 0, 0, 0, 0, 0, 8,10,10, 0, 0, + 0, 0, 0, 0, 8,10,10, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 7,10,10, 0, 0, 0, 0, 0, 0,10,11,11, 0, + 0, 0, 0, 0, 0, 9, 9,11, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 7,10,10, 0, 0, 0, 0, 0, 0,10,11,11, + 0, 0, 0, 0, 0, 0, 9,11, 9, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + +static float _vq_quantthresh__44cn1_s_p1_0[] = { + -0.5, 0.5, +}; + +static long _vq_quantmap__44cn1_s_p1_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__44cn1_s_p1_0 = { + _vq_quantthresh__44cn1_s_p1_0, + _vq_quantmap__44cn1_s_p1_0, + 3, + 3 +}; + +static static_codebook _44cn1_s_p1_0 = { + 8, 6561, + _vq_lengthlist__44cn1_s_p1_0, + 1, -535822336, 1611661312, 2, 0, + _vq_quantlist__44cn1_s_p1_0, + NULL, + &_vq_auxt__44cn1_s_p1_0, + NULL, + 0 +}; + +static long _vq_quantlist__44cn1_s_p2_0[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44cn1_s_p2_0[] = { + 1, 4, 4, 7, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 5, 5, 7, 7, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 4, 5, 5, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 7, 7, 9, 9, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 6, 7, 7, 9, 9, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + +static float _vq_quantthresh__44cn1_s_p2_0[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__44cn1_s_p2_0[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44cn1_s_p2_0 = { + _vq_quantthresh__44cn1_s_p2_0, + _vq_quantmap__44cn1_s_p2_0, + 5, + 5 +}; + +static static_codebook _44cn1_s_p2_0 = { + 4, 625, + _vq_lengthlist__44cn1_s_p2_0, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__44cn1_s_p2_0, + NULL, + &_vq_auxt__44cn1_s_p2_0, + NULL, + 0 +}; + +static long _vq_quantlist__44cn1_s_p3_0[] = { + 4, + 3, + 5, + 2, + 6, + 1, + 7, + 0, + 8, +}; + +static long _vq_lengthlist__44cn1_s_p3_0[] = { + 1, 2, 3, 7, 7, 0, 0, 0, 0, 0, 0, 0, 6, 6, 0, 0, + 0, 0, 0, 0, 0, 6, 6, 0, 0, 0, 0, 0, 0, 0, 7, 7, + 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, + 9, 8, 0, 0, 0, 0, 0, 0, 0, 8, 8, 0, 0, 0, 0, 0, + 0, 0,10,10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + +static float _vq_quantthresh__44cn1_s_p3_0[] = { + -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, +}; + +static long _vq_quantmap__44cn1_s_p3_0[] = { + 7, 5, 3, 1, 0, 2, 4, 6, + 8, +}; + +static encode_aux_threshmatch _vq_auxt__44cn1_s_p3_0 = { + _vq_quantthresh__44cn1_s_p3_0, + _vq_quantmap__44cn1_s_p3_0, + 9, + 9 +}; + +static static_codebook _44cn1_s_p3_0 = { + 2, 81, + _vq_lengthlist__44cn1_s_p3_0, + 1, -531628032, 1611661312, 4, 0, + _vq_quantlist__44cn1_s_p3_0, + NULL, + &_vq_auxt__44cn1_s_p3_0, + NULL, + 0 +}; + +static long _vq_quantlist__44cn1_s_p4_0[] = { + 4, + 3, + 5, + 2, + 6, + 1, + 7, + 0, + 8, +}; + +static long _vq_lengthlist__44cn1_s_p4_0[] = { + 1, 3, 3, 6, 6, 6, 6, 8, 8, 0, 0, 0, 6, 6, 7, 7, + 9, 9, 0, 0, 0, 6, 6, 7, 7, 9, 9, 0, 0, 0, 7, 7, + 8, 8,10,10, 0, 0, 0, 7, 7, 8, 8,10,10, 0, 0, 0, + 9, 9, 9, 9,10,10, 0, 0, 0, 9, 9, 9, 9,10,10, 0, + 0, 0,10,10,10,10,11,11, 0, 0, 0, 0, 0,10,10,11, + 11, +}; + +static float _vq_quantthresh__44cn1_s_p4_0[] = { + -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, +}; + +static long _vq_quantmap__44cn1_s_p4_0[] = { + 7, 5, 3, 1, 0, 2, 4, 6, + 8, +}; + +static encode_aux_threshmatch _vq_auxt__44cn1_s_p4_0 = { + _vq_quantthresh__44cn1_s_p4_0, + _vq_quantmap__44cn1_s_p4_0, + 9, + 9 +}; + +static static_codebook _44cn1_s_p4_0 = { + 2, 81, + _vq_lengthlist__44cn1_s_p4_0, + 1, -531628032, 1611661312, 4, 0, + _vq_quantlist__44cn1_s_p4_0, + NULL, + &_vq_auxt__44cn1_s_p4_0, + NULL, + 0 +}; + +static long _vq_quantlist__44cn1_s_p5_0[] = { + 8, + 7, + 9, + 6, + 10, + 5, + 11, + 4, + 12, + 3, + 13, + 2, + 14, + 1, + 15, + 0, + 16, +}; + +static long _vq_lengthlist__44cn1_s_p5_0[] = { + 1, 4, 3, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9,10,10,10, + 10, 0, 0, 0, 7, 7, 8, 8, 9, 9, 9, 9,10,10,10,10, + 11,11, 0, 0, 0, 7, 7, 8, 8, 9, 9, 9, 9,10,10,10, + 10,11,11, 0, 0, 0, 7, 7, 8, 8, 9, 9, 9, 9,10,10, + 11,11,11,12, 0, 0, 0, 7, 7, 8, 8, 9, 9, 9, 9,10, + 10,11,11,11,11, 0, 0, 0, 8, 8, 9, 9, 9, 9,10,10, + 10,10,11,11,12,12, 0, 0, 0, 8, 8, 9, 9, 9, 9,10, + 10,10,11,11,11,12,12, 0, 0, 0, 9, 9,10, 9,10,10, + 10,10,11,11,11,11,12,12, 0, 0, 0, 0, 0, 9, 9,10, + 10,10,10,11,11,12,12,12,12, 0, 0, 0, 0, 0, 9, 9, + 10,10,10,11,11,11,12,12,13,13, 0, 0, 0, 0, 0, 9, + 9,10,10,10,10,11,11,12,12,13,13, 0, 0, 0, 0, 0, + 10,10,11,10,11,11,11,12,13,12,13,13, 0, 0, 0, 0, + 0, 0, 0,11,10,11,11,12,12,12,12,13,13, 0, 0, 0, + 0, 0, 0, 0,11,11,12,12,12,12,13,13,13,14, 0, 0, + 0, 0, 0, 0, 0,11,11,12,12,12,12,13,13,13,14, 0, + 0, 0, 0, 0, 0, 0,12,12,12,13,13,13,13,13,14,14, + 0, 0, 0, 0, 0, 0, 0, 0, 0,12,12,13,12,13,13,14, + 14, +}; + +static float _vq_quantthresh__44cn1_s_p5_0[] = { + -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, + 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, +}; + +static long _vq_quantmap__44cn1_s_p5_0[] = { + 15, 13, 11, 9, 7, 5, 3, 1, + 0, 2, 4, 6, 8, 10, 12, 14, + 16, +}; + +static encode_aux_threshmatch _vq_auxt__44cn1_s_p5_0 = { + _vq_quantthresh__44cn1_s_p5_0, + _vq_quantmap__44cn1_s_p5_0, + 17, + 17 +}; + +static static_codebook _44cn1_s_p5_0 = { + 2, 289, + _vq_lengthlist__44cn1_s_p5_0, + 1, -529530880, 1611661312, 5, 0, + _vq_quantlist__44cn1_s_p5_0, + NULL, + &_vq_auxt__44cn1_s_p5_0, + NULL, + 0 +}; + +static long _vq_quantlist__44cn1_s_p6_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__44cn1_s_p6_0[] = { + 1, 4, 4, 7, 6, 6, 7, 6, 6, 4, 6, 6,10, 9, 9,11, + 9, 9, 4, 6, 6,10, 9, 9,10, 9, 9, 7,10,10,11,11, + 11,12,11,11, 7, 9, 9,11,11,10,11,10,10, 7, 9, 9, + 11,10,11,11,10,10, 7,10,10,11,11,11,12,11,11, 7, + 9, 9,11,10,10,11,10,10, 7, 9, 9,11,10,10,11,10, + 10, +}; + +static float _vq_quantthresh__44cn1_s_p6_0[] = { + -5.5, 5.5, +}; + +static long _vq_quantmap__44cn1_s_p6_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__44cn1_s_p6_0 = { + _vq_quantthresh__44cn1_s_p6_0, + _vq_quantmap__44cn1_s_p6_0, + 3, + 3 +}; + +static static_codebook _44cn1_s_p6_0 = { + 4, 81, + _vq_lengthlist__44cn1_s_p6_0, + 1, -529137664, 1618345984, 2, 0, + _vq_quantlist__44cn1_s_p6_0, + NULL, + &_vq_auxt__44cn1_s_p6_0, + NULL, + 0 +}; + +static long _vq_quantlist__44cn1_s_p6_1[] = { + 5, + 4, + 6, + 3, + 7, + 2, + 8, + 1, + 9, + 0, + 10, +}; + +static long _vq_lengthlist__44cn1_s_p6_1[] = { + 1, 4, 4, 6, 6, 7, 7, 8, 8, 8, 8,10,10,10, 7, 6, + 8, 8, 8, 8, 8, 8,10,10,10, 7, 6, 7, 7, 8, 8, 8, + 8,10,10,10, 7, 7, 8, 8, 8, 8, 8, 8,10,10,10, 7, + 7, 8, 8, 8, 8, 8, 8,10,10,10, 8, 8, 8, 8, 9, 9, + 9, 9,10,10,10, 8, 8, 8, 8, 9, 9, 9, 9,10,10,10, + 9, 9, 9, 9, 9, 9, 9, 9,10,10,10,10,10, 9, 9, 9, + 9, 9, 9,10,10,10,10,10, 9, 9, 9, 9, 9, 9,10,10, + 10,10,10, 9, 9, 9, 9, 9, 9, +}; + +static float _vq_quantthresh__44cn1_s_p6_1[] = { + -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, + 3.5, 4.5, +}; + +static long _vq_quantmap__44cn1_s_p6_1[] = { + 9, 7, 5, 3, 1, 0, 2, 4, + 6, 8, 10, +}; + +static encode_aux_threshmatch _vq_auxt__44cn1_s_p6_1 = { + _vq_quantthresh__44cn1_s_p6_1, + _vq_quantmap__44cn1_s_p6_1, + 11, + 11 +}; + +static static_codebook _44cn1_s_p6_1 = { + 2, 121, + _vq_lengthlist__44cn1_s_p6_1, + 1, -531365888, 1611661312, 4, 0, + _vq_quantlist__44cn1_s_p6_1, + NULL, + &_vq_auxt__44cn1_s_p6_1, + NULL, + 0 +}; + +static long _vq_quantlist__44cn1_s_p7_0[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__44cn1_s_p7_0[] = { + 1, 4, 4, 6, 6, 7, 7, 8, 8, 9, 9,10,10, 6, 5, 5, + 7, 7, 8, 8, 8, 8, 9, 9,11,11, 7, 5, 5, 7, 7, 8, + 8, 8, 8, 9,10,11,11, 0, 8, 8, 8, 8, 9, 9, 9, 9, + 10,10,11,11, 0, 8, 8, 8, 8, 9, 9, 9, 9,10,10,11, + 11, 0,12,12, 9, 9, 9,10,10,10,11,11,11,12, 0,13, + 13, 9, 9, 9, 9,10,10,11,11,11,12, 0, 0, 0,10,10, + 10,10,11,11,12,12,12,13, 0, 0, 0,10,10,10,10,11, + 11,12,12,13,12, 0, 0, 0,14,14,11,10,11,12,12,13, + 13,14, 0, 0, 0,15,15,11,11,12,11,12,12,14,13, 0, + 0, 0, 0, 0,12,12,12,12,13,13,14,14, 0, 0, 0, 0, + 0,13,13,12,12,13,13,13,14, +}; + +static float _vq_quantthresh__44cn1_s_p7_0[] = { + -27.5, -22.5, -17.5, -12.5, -7.5, -2.5, 2.5, 7.5, + 12.5, 17.5, 22.5, 27.5, +}; + +static long _vq_quantmap__44cn1_s_p7_0[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__44cn1_s_p7_0 = { + _vq_quantthresh__44cn1_s_p7_0, + _vq_quantmap__44cn1_s_p7_0, + 13, + 13 +}; + +static static_codebook _44cn1_s_p7_0 = { + 2, 169, + _vq_lengthlist__44cn1_s_p7_0, + 1, -526516224, 1616117760, 4, 0, + _vq_quantlist__44cn1_s_p7_0, + NULL, + &_vq_auxt__44cn1_s_p7_0, + NULL, + 0 +}; + +static long _vq_quantlist__44cn1_s_p7_1[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44cn1_s_p7_1[] = { + 2, 3, 3, 5, 5, 6, 6, 6, 5, 5, 6, 6, 6, 5, 5, 6, + 6, 6, 5, 5, 6, 6, 6, 5, 5, +}; + +static float _vq_quantthresh__44cn1_s_p7_1[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__44cn1_s_p7_1[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44cn1_s_p7_1 = { + _vq_quantthresh__44cn1_s_p7_1, + _vq_quantmap__44cn1_s_p7_1, + 5, + 5 +}; + +static static_codebook _44cn1_s_p7_1 = { + 2, 25, + _vq_lengthlist__44cn1_s_p7_1, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__44cn1_s_p7_1, + NULL, + &_vq_auxt__44cn1_s_p7_1, + NULL, + 0 +}; + +static long _vq_quantlist__44cn1_s_p8_0[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44cn1_s_p8_0[] = { + 1, 7, 7,11,11, 8,11,11,11,11, 4,11, 3,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,10,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11, 7,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,10,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11, 8,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,12,12,12,12,12,12,12,12,12, + 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, + 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, + 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, + 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, + 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, + 12, +}; + +static float _vq_quantthresh__44cn1_s_p8_0[] = { + -331.5, -110.5, 110.5, 331.5, +}; + +static long _vq_quantmap__44cn1_s_p8_0[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44cn1_s_p8_0 = { + _vq_quantthresh__44cn1_s_p8_0, + _vq_quantmap__44cn1_s_p8_0, + 5, + 5 +}; + +static static_codebook _44cn1_s_p8_0 = { + 4, 625, + _vq_lengthlist__44cn1_s_p8_0, + 1, -518283264, 1627103232, 3, 0, + _vq_quantlist__44cn1_s_p8_0, + NULL, + &_vq_auxt__44cn1_s_p8_0, + NULL, + 0 +}; + +static long _vq_quantlist__44cn1_s_p8_1[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__44cn1_s_p8_1[] = { + 1, 4, 4, 6, 6, 8, 8, 9,10,10,11,11,11, 6, 5, 5, + 7, 7, 8, 8, 9,10, 9,11,11,12, 5, 5, 5, 7, 7, 8, + 9,10,10,12,12,14,13,15, 7, 7, 8, 8, 9,10,11,11, + 10,12,10,11,15, 7, 8, 8, 8, 9, 9,11,11,13,12,12, + 13,15,10,10, 8, 8,10,10,12,12,11,14,10,10,15,11, + 11, 8, 8,10,10,12,13,13,14,15,13,15,15,15,10,10, + 10,10,12,12,13,12,13,10,15,15,15,10,10,11,10,13, + 11,13,13,15,13,15,15,15,13,13,10,11,11,11,12,10, + 14,11,15,15,14,14,13,10,10,12,11,13,13,14,14,15, + 15,15,15,15,11,11,11,11,12,11,15,12,15,15,15,15, + 15,12,12,11,11,14,12,13,14, +}; + +static float _vq_quantthresh__44cn1_s_p8_1[] = { + -93.5, -76.5, -59.5, -42.5, -25.5, -8.5, 8.5, 25.5, + 42.5, 59.5, 76.5, 93.5, +}; + +static long _vq_quantmap__44cn1_s_p8_1[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__44cn1_s_p8_1 = { + _vq_quantthresh__44cn1_s_p8_1, + _vq_quantmap__44cn1_s_p8_1, + 13, + 13 +}; + +static static_codebook _44cn1_s_p8_1 = { + 2, 169, + _vq_lengthlist__44cn1_s_p8_1, + 1, -522616832, 1620115456, 4, 0, + _vq_quantlist__44cn1_s_p8_1, + NULL, + &_vq_auxt__44cn1_s_p8_1, + NULL, + 0 +}; + +static long _vq_quantlist__44cn1_s_p8_2[] = { + 8, + 7, + 9, + 6, + 10, + 5, + 11, + 4, + 12, + 3, + 13, + 2, + 14, + 1, + 15, + 0, + 16, +}; + +static long _vq_lengthlist__44cn1_s_p8_2[] = { + 3, 4, 3, 6, 6, 7, 7, 8, 8, 9, 9, 9, 9, 9, 9, 9, + 9,10,11,11, 6, 6, 7, 7, 8, 8, 9, 9, 9, 9, 9, 9, + 9, 9,10,10,10, 6, 6, 7, 7, 8, 8, 9, 9, 9, 9, 9, + 9, 9, 9,10,10,10, 7, 7, 7, 8, 8, 8, 9, 9, 9, 9, + 9, 9,10, 9,10,11,10, 7, 6, 7, 7, 8, 8, 9, 9, 9, + 9, 9, 9, 9,10,10,10,11, 7, 7, 8, 8, 8, 8, 9, 9, + 9, 9, 9, 9, 9, 9,10,10,10, 7, 7, 8, 8, 8, 8, 9, + 9, 9, 9, 9, 9, 9,10,11,11,11, 8, 8, 8, 8, 8, 8, + 9, 9, 9, 9, 9, 9, 9, 9,11,10,10,11,11, 8, 8, 8, + 9, 9, 9, 9, 9, 9,10, 9,10,10,10,10,11,11, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,11,11,10,11,11, 9, + 9, 9, 9, 9, 9, 9, 9, 9,10,10,10,10,11,10,11,11, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,11,10,10,11, + 11,11,11, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10,11,11, + 10,11,11,11, 9,10,10, 9, 9, 9, 9, 9, 9, 9,10,11, + 11,11,11,11,11, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,11, + 11,11,11,11,11,11,10,10, 9, 9, 9, 9, 9, 9, 9, 9, + 11,11,11,10,11,11,11,11,11, 9, 9, 9,10, 9, 9, 9, + 9, +}; + +static float _vq_quantthresh__44cn1_s_p8_2[] = { + -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, + 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, +}; + +static long _vq_quantmap__44cn1_s_p8_2[] = { + 15, 13, 11, 9, 7, 5, 3, 1, + 0, 2, 4, 6, 8, 10, 12, 14, + 16, +}; + +static encode_aux_threshmatch _vq_auxt__44cn1_s_p8_2 = { + _vq_quantthresh__44cn1_s_p8_2, + _vq_quantmap__44cn1_s_p8_2, + 17, + 17 +}; + +static static_codebook _44cn1_s_p8_2 = { + 2, 289, + _vq_lengthlist__44cn1_s_p8_2, + 1, -529530880, 1611661312, 5, 0, + _vq_quantlist__44cn1_s_p8_2, + NULL, + &_vq_auxt__44cn1_s_p8_2, + NULL, + 0 +}; + +static long _huff_lengthlist__44cn1_s_short[] = { + 10, 9,12,15,12,13,16,14,16, 7, 1, 5,14, 7,10,13, + 16,16, 9, 4, 6,16, 8,11,16,16,16,14, 4, 7,16, 9, + 12,14,16,16,10, 5, 7,14, 9,12,14,15,15,13, 8, 9, + 14,10,12,13,14,15,13, 9, 9, 7, 6, 8,11,12,12,14, + 8, 8, 5, 4, 5, 8,11,12,16,10,10, 6, 5, 6, 8, 9, + 10, +}; + +static static_codebook _huff_book__44cn1_s_short = { + 2, 81, + _huff_lengthlist__44cn1_s_short, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist__44cn1_sm_long[] = { + 3, 3, 8, 8, 8, 8,10,12,14, 3, 2, 6, 7, 7, 8,10, + 12,16, 7, 6, 7, 9, 8,10,12,14,16, 8, 6, 8, 4, 5, + 7, 9,11,13, 7, 6, 8, 5, 6, 7, 9,11,14, 8, 8,10, + 7, 7, 6, 8,10,13, 9,11,12, 9, 9, 7, 8,10,12,10, + 13,15,11,11,10, 9,10,13,13,16,17,14,15,14,13,14, + 17, +}; + +static static_codebook _huff_book__44cn1_sm_long = { + 2, 81, + _huff_lengthlist__44cn1_sm_long, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _vq_quantlist__44cn1_sm_p1_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__44cn1_sm_p1_0[] = { + 1, 4, 5, 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, 0, 0, 0, + 0, 0, 5, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 5, 8, 8, 0, 0, 0, 0, 0, 0, 8, 9, 9, 0, 0, 0, + 0, 0, 0, 7, 8, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 5, 8, 8, 0, 0, 0, 0, 0, 0, 7, 9, 8, 0, 0, + 0, 0, 0, 0, 8, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 8, 8, 0, 0, 0, 0, + 0, 0, 8,10, 9, 0, 0, 0, 0, 0, 0, 8, 9, 9, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7,10, 9, 0, 0, 0, + 0, 0, 0, 9, 9,10, 0, 0, 0, 0, 0, 0, 9,10,10, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 9, 9, 0, 0, + 0, 0, 0, 0, 8,10, 9, 0, 0, 0, 0, 0, 0, 9,10,10, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 5, 8, 8, 0, 0, 0, 0, 0, 0, 8, 9, 9, 0, 0, + 0, 0, 0, 0, 8, 9,10, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 7, 9, 9, 0, 0, 0, 0, 0, 0, 9,10,10, 0, + 0, 0, 0, 0, 0, 8, 9,10, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 7, 9,10, 0, 0, 0, 0, 0, 0, 9,10,10, + 0, 0, 0, 0, 0, 0, 9,10, 9, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + +static float _vq_quantthresh__44cn1_sm_p1_0[] = { + -0.5, 0.5, +}; + +static long _vq_quantmap__44cn1_sm_p1_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__44cn1_sm_p1_0 = { + _vq_quantthresh__44cn1_sm_p1_0, + _vq_quantmap__44cn1_sm_p1_0, + 3, + 3 +}; + +static static_codebook _44cn1_sm_p1_0 = { + 8, 6561, + _vq_lengthlist__44cn1_sm_p1_0, + 1, -535822336, 1611661312, 2, 0, + _vq_quantlist__44cn1_sm_p1_0, + NULL, + &_vq_auxt__44cn1_sm_p1_0, + NULL, + 0 +}; + +static long _vq_quantlist__44cn1_sm_p2_0[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44cn1_sm_p2_0[] = { + 1, 4, 4, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 5, 5, 7, 7, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 4, 5, 5, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 7, 7, 9, 9, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 7, 7, 7, 9, 9, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + +static float _vq_quantthresh__44cn1_sm_p2_0[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__44cn1_sm_p2_0[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44cn1_sm_p2_0 = { + _vq_quantthresh__44cn1_sm_p2_0, + _vq_quantmap__44cn1_sm_p2_0, + 5, + 5 +}; + +static static_codebook _44cn1_sm_p2_0 = { + 4, 625, + _vq_lengthlist__44cn1_sm_p2_0, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__44cn1_sm_p2_0, + NULL, + &_vq_auxt__44cn1_sm_p2_0, + NULL, + 0 +}; + +static long _vq_quantlist__44cn1_sm_p3_0[] = { + 4, + 3, + 5, + 2, + 6, + 1, + 7, + 0, + 8, +}; + +static long _vq_lengthlist__44cn1_sm_p3_0[] = { + 1, 3, 4, 7, 7, 0, 0, 0, 0, 0, 4, 4, 7, 7, 0, 0, + 0, 0, 0, 4, 5, 7, 7, 0, 0, 0, 0, 0, 6, 7, 8, 8, + 0, 0, 0, 0, 0, 0, 0, 8, 8, 0, 0, 0, 0, 0, 0, 0, + 9, 9, 0, 0, 0, 0, 0, 0, 0,10, 9, 0, 0, 0, 0, 0, + 0, 0,11,11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + +static float _vq_quantthresh__44cn1_sm_p3_0[] = { + -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, +}; + +static long _vq_quantmap__44cn1_sm_p3_0[] = { + 7, 5, 3, 1, 0, 2, 4, 6, + 8, +}; + +static encode_aux_threshmatch _vq_auxt__44cn1_sm_p3_0 = { + _vq_quantthresh__44cn1_sm_p3_0, + _vq_quantmap__44cn1_sm_p3_0, + 9, + 9 +}; + +static static_codebook _44cn1_sm_p3_0 = { + 2, 81, + _vq_lengthlist__44cn1_sm_p3_0, + 1, -531628032, 1611661312, 4, 0, + _vq_quantlist__44cn1_sm_p3_0, + NULL, + &_vq_auxt__44cn1_sm_p3_0, + NULL, + 0 +}; + +static long _vq_quantlist__44cn1_sm_p4_0[] = { + 4, + 3, + 5, + 2, + 6, + 1, + 7, + 0, + 8, +}; + +static long _vq_lengthlist__44cn1_sm_p4_0[] = { + 1, 4, 3, 6, 6, 7, 7, 9, 9, 0, 5, 5, 7, 7, 8, 7, + 9, 9, 0, 5, 5, 7, 7, 8, 8, 9, 9, 0, 7, 7, 8, 8, + 8, 8,10,10, 0, 0, 0, 8, 8, 8, 8,10,10, 0, 0, 0, + 9, 9, 9, 9,10,10, 0, 0, 0, 9, 9, 9, 9,10,10, 0, + 0, 0,10,10,10,10,11,11, 0, 0, 0, 0, 0,10,10,11, + 11, +}; + +static float _vq_quantthresh__44cn1_sm_p4_0[] = { + -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, +}; + +static long _vq_quantmap__44cn1_sm_p4_0[] = { + 7, 5, 3, 1, 0, 2, 4, 6, + 8, +}; + +static encode_aux_threshmatch _vq_auxt__44cn1_sm_p4_0 = { + _vq_quantthresh__44cn1_sm_p4_0, + _vq_quantmap__44cn1_sm_p4_0, + 9, + 9 +}; + +static static_codebook _44cn1_sm_p4_0 = { + 2, 81, + _vq_lengthlist__44cn1_sm_p4_0, + 1, -531628032, 1611661312, 4, 0, + _vq_quantlist__44cn1_sm_p4_0, + NULL, + &_vq_auxt__44cn1_sm_p4_0, + NULL, + 0 +}; + +static long _vq_quantlist__44cn1_sm_p5_0[] = { + 8, + 7, + 9, + 6, + 10, + 5, + 11, + 4, + 12, + 3, + 13, + 2, + 14, + 1, + 15, + 0, + 16, +}; + +static long _vq_lengthlist__44cn1_sm_p5_0[] = { + 1, 4, 4, 6, 6, 8, 8, 9, 9, 8, 8, 9, 9,10,10,11, + 11, 0, 6, 6, 7, 7, 8, 8, 9, 9, 9, 9,10,10,11,11, + 12,12, 0, 6, 5, 7, 7, 8, 8, 9, 9, 9, 9,10,10,11, + 11,12,12, 0, 7, 7, 7, 7, 8, 8, 9, 9, 9, 9,10,10, + 11,11,12,12, 0, 0, 0, 7, 7, 8, 8, 9, 9,10,10,11, + 11,11,11,12,12, 0, 0, 0, 8, 8, 9, 9,10,10,10,10, + 11,11,12,12,12,12, 0, 0, 0, 8, 8, 9, 9,10,10,10, + 10,11,11,12,12,12,12, 0, 0, 0, 9, 9, 9, 9,10,10, + 10,10,11,11,12,12,13,13, 0, 0, 0, 0, 0, 9, 9,10, + 10,10,10,11,11,12,12,13,13, 0, 0, 0, 0, 0, 9, 9, + 10,10,11,11,12,12,13,13,13,13, 0, 0, 0, 0, 0, 9, + 9,10,10,11,11,12,12,12,13,13,13, 0, 0, 0, 0, 0, + 10,10,11,11,11,11,12,12,13,13,14,14, 0, 0, 0, 0, + 0, 0, 0,11,11,11,11,12,12,13,13,14,14, 0, 0, 0, + 0, 0, 0, 0,11,11,12,12,13,13,13,13,14,14, 0, 0, + 0, 0, 0, 0, 0,11,11,12,12,13,13,13,13,14,14, 0, + 0, 0, 0, 0, 0, 0,12,12,12,13,13,13,14,14,14,14, + 0, 0, 0, 0, 0, 0, 0, 0, 0,12,12,13,13,14,14,14, + 14, +}; + +static float _vq_quantthresh__44cn1_sm_p5_0[] = { + -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, + 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, +}; + +static long _vq_quantmap__44cn1_sm_p5_0[] = { + 15, 13, 11, 9, 7, 5, 3, 1, + 0, 2, 4, 6, 8, 10, 12, 14, + 16, +}; + +static encode_aux_threshmatch _vq_auxt__44cn1_sm_p5_0 = { + _vq_quantthresh__44cn1_sm_p5_0, + _vq_quantmap__44cn1_sm_p5_0, + 17, + 17 +}; + +static static_codebook _44cn1_sm_p5_0 = { + 2, 289, + _vq_lengthlist__44cn1_sm_p5_0, + 1, -529530880, 1611661312, 5, 0, + _vq_quantlist__44cn1_sm_p5_0, + NULL, + &_vq_auxt__44cn1_sm_p5_0, + NULL, + 0 +}; + +static long _vq_quantlist__44cn1_sm_p6_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__44cn1_sm_p6_0[] = { + 1, 4, 4, 7, 6, 6, 7, 6, 6, 4, 7, 6,10, 9, 9,11, + 9, 9, 4, 6, 7,10, 9, 9,11, 9, 9, 7,10,10,10,11, + 11,11,11,10, 6, 9, 9,11,10,10,11,10,10, 6, 9, 9, + 11,10,11,11,10,10, 7,11,11,11,11,11,12,11,11, 7, + 9, 9,11,10,10,12,10,10, 7, 9, 9,11,10,10,11,10, + 10, +}; + +static float _vq_quantthresh__44cn1_sm_p6_0[] = { + -5.5, 5.5, +}; + +static long _vq_quantmap__44cn1_sm_p6_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__44cn1_sm_p6_0 = { + _vq_quantthresh__44cn1_sm_p6_0, + _vq_quantmap__44cn1_sm_p6_0, + 3, + 3 +}; + +static static_codebook _44cn1_sm_p6_0 = { + 4, 81, + _vq_lengthlist__44cn1_sm_p6_0, + 1, -529137664, 1618345984, 2, 0, + _vq_quantlist__44cn1_sm_p6_0, + NULL, + &_vq_auxt__44cn1_sm_p6_0, + NULL, + 0 +}; + +static long _vq_quantlist__44cn1_sm_p6_1[] = { + 5, + 4, + 6, + 3, + 7, + 2, + 8, + 1, + 9, + 0, + 10, +}; + +static long _vq_lengthlist__44cn1_sm_p6_1[] = { + 2, 4, 4, 5, 5, 7, 7, 7, 7, 8, 8,10, 5, 5, 6, 6, + 7, 7, 8, 8, 8, 8,10, 5, 5, 6, 6, 7, 7, 8, 8, 8, + 8,10, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8,10,10,10, 7, + 7, 7, 7, 8, 8, 8, 8,10,10,10, 8, 8, 8, 8, 8, 8, + 8, 8,10,10,10, 8, 8, 8, 8, 8, 8, 8, 8,10,10,10, + 8, 8, 8, 8, 8, 8, 9, 9,10,10,10,10,10, 8, 8, 8, + 8, 9, 9,10,10,10,10,10, 9, 9, 9, 9, 8, 9,10,10, + 10,10,10, 8, 9, 8, 8, 9, 8, +}; + +static float _vq_quantthresh__44cn1_sm_p6_1[] = { + -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, + 3.5, 4.5, +}; + +static long _vq_quantmap__44cn1_sm_p6_1[] = { + 9, 7, 5, 3, 1, 0, 2, 4, + 6, 8, 10, +}; + +static encode_aux_threshmatch _vq_auxt__44cn1_sm_p6_1 = { + _vq_quantthresh__44cn1_sm_p6_1, + _vq_quantmap__44cn1_sm_p6_1, + 11, + 11 +}; + +static static_codebook _44cn1_sm_p6_1 = { + 2, 121, + _vq_lengthlist__44cn1_sm_p6_1, + 1, -531365888, 1611661312, 4, 0, + _vq_quantlist__44cn1_sm_p6_1, + NULL, + &_vq_auxt__44cn1_sm_p6_1, + NULL, + 0 +}; + +static long _vq_quantlist__44cn1_sm_p7_0[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__44cn1_sm_p7_0[] = { + 1, 4, 4, 6, 6, 7, 7, 7, 7, 9, 9,10,10, 7, 5, 5, + 7, 7, 8, 8, 8, 8,10, 9,11,10, 7, 5, 5, 7, 7, 8, + 8, 8, 8, 9,10,11,11, 0, 8, 8, 8, 8, 9, 9, 9, 9, + 10,10,11,11, 0, 8, 8, 8, 8, 9, 9, 9, 9,10,10,11, + 11, 0,12,12, 9, 9, 9,10,10,10,11,11,12,12, 0,13, + 13, 9, 9, 9, 9,10,10,11,11,12,12, 0, 0, 0,10,10, + 10,10,11,11,12,12,12,13, 0, 0, 0,10,10,10,10,11, + 11,12,12,12,12, 0, 0, 0,14,14,11,11,11,11,12,13, + 13,13, 0, 0, 0,14,14,11,10,11,11,12,12,13,13, 0, + 0, 0, 0, 0,12,12,12,12,13,13,13,14, 0, 0, 0, 0, + 0,13,12,12,12,13,13,13,14, +}; + +static float _vq_quantthresh__44cn1_sm_p7_0[] = { + -27.5, -22.5, -17.5, -12.5, -7.5, -2.5, 2.5, 7.5, + 12.5, 17.5, 22.5, 27.5, +}; + +static long _vq_quantmap__44cn1_sm_p7_0[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__44cn1_sm_p7_0 = { + _vq_quantthresh__44cn1_sm_p7_0, + _vq_quantmap__44cn1_sm_p7_0, + 13, + 13 +}; + +static static_codebook _44cn1_sm_p7_0 = { + 2, 169, + _vq_lengthlist__44cn1_sm_p7_0, + 1, -526516224, 1616117760, 4, 0, + _vq_quantlist__44cn1_sm_p7_0, + NULL, + &_vq_auxt__44cn1_sm_p7_0, + NULL, + 0 +}; + +static long _vq_quantlist__44cn1_sm_p7_1[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44cn1_sm_p7_1[] = { + 2, 4, 4, 4, 5, 6, 5, 5, 5, 5, 6, 5, 5, 5, 5, 6, + 5, 5, 5, 5, 6, 6, 6, 5, 5, +}; + +static float _vq_quantthresh__44cn1_sm_p7_1[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__44cn1_sm_p7_1[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44cn1_sm_p7_1 = { + _vq_quantthresh__44cn1_sm_p7_1, + _vq_quantmap__44cn1_sm_p7_1, + 5, + 5 +}; + +static static_codebook _44cn1_sm_p7_1 = { + 2, 25, + _vq_lengthlist__44cn1_sm_p7_1, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__44cn1_sm_p7_1, + NULL, + &_vq_auxt__44cn1_sm_p7_1, + NULL, + 0 +}; + +static long _vq_quantlist__44cn1_sm_p8_0[] = { + 4, + 3, + 5, + 2, + 6, + 1, + 7, + 0, + 8, +}; + +static long _vq_lengthlist__44cn1_sm_p8_0[] = { + 1, 4, 4,12,11,13,13,14,14, 4, 7, 7,11,13,14,14, + 14,14, 3, 8, 3,14,14,14,14,14,14,14,10,12,14,14, + 14,14,14,14,14,14, 5,14, 8,14,14,14,14,14,12,14, + 13,14,14,14,14,14,14,14,13,14,10,14,14,14,14,14, + 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14, + 14, +}; + +static float _vq_quantthresh__44cn1_sm_p8_0[] = { + -773.5, -552.5, -331.5, -110.5, 110.5, 331.5, 552.5, 773.5, +}; + +static long _vq_quantmap__44cn1_sm_p8_0[] = { + 7, 5, 3, 1, 0, 2, 4, 6, + 8, +}; + +static encode_aux_threshmatch _vq_auxt__44cn1_sm_p8_0 = { + _vq_quantthresh__44cn1_sm_p8_0, + _vq_quantmap__44cn1_sm_p8_0, + 9, + 9 +}; + +static static_codebook _44cn1_sm_p8_0 = { + 2, 81, + _vq_lengthlist__44cn1_sm_p8_0, + 1, -516186112, 1627103232, 4, 0, + _vq_quantlist__44cn1_sm_p8_0, + NULL, + &_vq_auxt__44cn1_sm_p8_0, + NULL, + 0 +}; + +static long _vq_quantlist__44cn1_sm_p8_1[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__44cn1_sm_p8_1[] = { + 1, 4, 4, 6, 6, 8, 8, 9, 9,10,11,11,11, 6, 5, 5, + 7, 7, 8, 8,10,10,10,11,11,11, 6, 5, 5, 7, 7, 8, + 8,10,10,11,12,12,12,14, 7, 7, 7, 8, 9, 9,11,11, + 11,12,11,12,17, 7, 7, 8, 7, 9, 9,11,11,12,12,12, + 12,14,11,11, 8, 8,10,10,11,12,12,13,11,12,14,11, + 11, 8, 8,10,10,11,12,12,13,13,12,14,15,14,10,10, + 10,10,11,12,12,12,12,11,14,13,16,10,10,10, 9,12, + 11,12,12,13,14,14,15,14,14,13,10,10,11,11,12,11, + 13,11,14,12,15,13,14,11,10,12,10,12,12,13,13,13, + 13,14,15,15,12,12,11,11,12,11,13,12,14,14,14,14, + 17,12,12,11,10,13,11,13,13, +}; + +static float _vq_quantthresh__44cn1_sm_p8_1[] = { + -93.5, -76.5, -59.5, -42.5, -25.5, -8.5, 8.5, 25.5, + 42.5, 59.5, 76.5, 93.5, +}; + +static long _vq_quantmap__44cn1_sm_p8_1[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__44cn1_sm_p8_1 = { + _vq_quantthresh__44cn1_sm_p8_1, + _vq_quantmap__44cn1_sm_p8_1, + 13, + 13 +}; + +static static_codebook _44cn1_sm_p8_1 = { + 2, 169, + _vq_lengthlist__44cn1_sm_p8_1, + 1, -522616832, 1620115456, 4, 0, + _vq_quantlist__44cn1_sm_p8_1, + NULL, + &_vq_auxt__44cn1_sm_p8_1, + NULL, + 0 +}; + +static long _vq_quantlist__44cn1_sm_p8_2[] = { + 8, + 7, + 9, + 6, + 10, + 5, + 11, + 4, + 12, + 3, + 13, + 2, + 14, + 1, + 15, + 0, + 16, +}; + +static long _vq_lengthlist__44cn1_sm_p8_2[] = { + 3, 4, 4, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, + 9,10, 6, 6, 6, 6, 7, 7, 8, 8, 8, 9, 9, 9, 9, 9, + 9, 9,10, 6, 6, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9, 9, + 9, 9, 9,10, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, + 9, 9, 9, 9,10,10,10, 7, 7, 7, 8, 8, 8, 9, 9, 9, + 9, 9, 9, 9, 9,10,10,10, 8, 8, 8, 8, 8, 8, 9, 9, + 9, 9, 9, 9, 9, 9,10,10,10, 8, 8, 8, 8, 8, 8, 9, + 9, 9, 9, 9, 9, 9, 9,11,10,11, 8, 8, 8, 8, 8, 8, + 9, 9, 9, 9, 9, 9, 9, 9,10,10,10,11,11, 8, 8, 8, + 8, 9, 9, 9, 9, 9, 9, 9, 9,11,10,11,11,11, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,11,10,11,11, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,11,11,10,11,11, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,11,10,11,11, + 11,11,11, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,11,11, + 11,11,11,11, 9,10,10,10, 9, 9, 9, 9, 9, 9,11,10, + 11,11,11,11,11, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,11, + 11,11,11,11,11,11,10,10, 9, 9, 9, 9, 9, 9, 9, 9, + 10,11,11,11,11,11,11,11,11, 9, 9, 9, 9, 9, 9, 9, + 9, +}; + +static float _vq_quantthresh__44cn1_sm_p8_2[] = { + -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, + 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, +}; + +static long _vq_quantmap__44cn1_sm_p8_2[] = { + 15, 13, 11, 9, 7, 5, 3, 1, + 0, 2, 4, 6, 8, 10, 12, 14, + 16, +}; + +static encode_aux_threshmatch _vq_auxt__44cn1_sm_p8_2 = { + _vq_quantthresh__44cn1_sm_p8_2, + _vq_quantmap__44cn1_sm_p8_2, + 17, + 17 +}; + +static static_codebook _44cn1_sm_p8_2 = { + 2, 289, + _vq_lengthlist__44cn1_sm_p8_2, + 1, -529530880, 1611661312, 5, 0, + _vq_quantlist__44cn1_sm_p8_2, + NULL, + &_vq_auxt__44cn1_sm_p8_2, + NULL, + 0 +}; + +static long _huff_lengthlist__44cn1_sm_short[] = { + 5, 6,12,14,12,14,16,17,18, 4, 2, 5,11, 7,10,12, + 14,15, 9, 4, 5,11, 7,10,13,15,18,15, 6, 7, 5, 6, + 8,11,13,16,11, 5, 6, 5, 5, 6, 9,13,15,12, 5, 7, + 6, 5, 6, 9,12,14,12, 6, 7, 8, 6, 7, 9,12,13,14, + 8, 8, 7, 5, 5, 8,10,12,16, 9, 9, 8, 6, 6, 7, 9, + 9, +}; + +static static_codebook _huff_book__44cn1_sm_short = { + 2, 81, + _huff_lengthlist__44cn1_sm_short, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + diff --git a/Libraries/Vorbis/Files/lib/books/floor/.cvsignore b/Libraries/Vorbis/Files/lib/books/floor/.cvsignore new file mode 100644 index 000000000..282522db0 --- /dev/null +++ b/Libraries/Vorbis/Files/lib/books/floor/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/Libraries/Vorbis/Files/lib/books/floor/Makefile.am b/Libraries/Vorbis/Files/lib/books/floor/Makefile.am new file mode 100644 index 000000000..272ab1a28 --- /dev/null +++ b/Libraries/Vorbis/Files/lib/books/floor/Makefile.am @@ -0,0 +1,3 @@ +## Process this file with automake to produce Makefile.in + +EXTRA_DIST = floor_books.h diff --git a/Libraries/Vorbis/Files/lib/books/floor/floor_books.h b/Libraries/Vorbis/Files/lib/books/floor/floor_books.h new file mode 100644 index 000000000..c6b83848e --- /dev/null +++ b/Libraries/Vorbis/Files/lib/books/floor/floor_books.h @@ -0,0 +1,1838 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * + * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * + * by the Xiph.Org Foundation http://www.xiph.org/ * + * * + ******************************************************************** + + function: static codebooks autogenerated by huff/huffbuld + last modified: $Id$ + + ********************************************************************/ + +#include "codebook.h" + +static long _huff_lengthlist_line_256x7_0sub1[] = { + 0, 2, 3, 3, 3, 3, 4, 3, 4, +}; + +static static_codebook _huff_book_line_256x7_0sub1 = { + 1, 9, + _huff_lengthlist_line_256x7_0sub1, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_256x7_0sub2[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 4, 3, 4, 3, 5, 3, + 6, 3, 6, 4, 6, 4, 7, 5, 7, +}; + +static static_codebook _huff_book_line_256x7_0sub2 = { + 1, 25, + _huff_lengthlist_line_256x7_0sub2, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_256x7_0sub3[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 5, 2, 5, 3, 5, 3, + 6, 3, 6, 4, 7, 6, 7, 8, 7, 9, 8, 9, 9, 9,10, 9, + 11,13,11,13,10,10,13,13,13,13,13,13,12,12,12,12, +}; + +static static_codebook _huff_book_line_256x7_0sub3 = { + 1, 64, + _huff_lengthlist_line_256x7_0sub3, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_256x7_1sub1[] = { + 0, 3, 3, 3, 3, 2, 4, 3, 4, +}; + +static static_codebook _huff_book_line_256x7_1sub1 = { + 1, 9, + _huff_lengthlist_line_256x7_1sub1, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_256x7_1sub2[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 3, 4, 3, 4, 4, + 5, 4, 6, 5, 6, 7, 6, 8, 8, +}; + +static static_codebook _huff_book_line_256x7_1sub2 = { + 1, 25, + _huff_lengthlist_line_256x7_1sub2, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_256x7_1sub3[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 2, 4, 3, 6, 3, 7, + 3, 8, 5, 8, 6, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 7, +}; + +static static_codebook _huff_book_line_256x7_1sub3 = { + 1, 64, + _huff_lengthlist_line_256x7_1sub3, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_256x7_class0[] = { + 7, 5, 5, 9, 9, 6, 6, 9,12, 8, 7, 8,11, 8, 9,15, + 6, 3, 3, 7, 7, 4, 3, 6, 9, 6, 5, 6, 8, 6, 8,15, + 8, 5, 5, 9, 8, 5, 4, 6,10, 7, 5, 5,11, 8, 7,15, + 14,15,13,13,13,13, 8,11,15,10, 7, 6,11, 9,10,15, +}; + +static static_codebook _huff_book_line_256x7_class0 = { + 1, 64, + _huff_lengthlist_line_256x7_class0, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_256x7_class1[] = { + 5, 6, 8,15, 6, 9,10,15,10,11,12,15,15,15,15,15, + 4, 6, 7,15, 6, 7, 8,15, 9, 8, 9,15,15,15,15,15, + 6, 8, 9,15, 7, 7, 8,15,10, 9,10,15,15,15,15,15, + 15,13,15,15,15,10,11,15,15,13,13,15,15,15,15,15, + 4, 6, 7,15, 6, 8, 9,15,10,10,12,15,15,15,15,15, + 2, 5, 6,15, 5, 6, 7,15, 8, 6, 7,15,15,15,15,15, + 5, 6, 8,15, 5, 6, 7,15, 9, 6, 7,15,15,15,15,15, + 14,12,13,15,12,10,11,15,15,15,15,15,15,15,15,15, + 7, 8, 9,15, 9,10,10,15,15,14,14,15,15,15,15,15, + 5, 6, 7,15, 7, 8, 9,15,12, 9,10,15,15,15,15,15, + 7, 7, 9,15, 7, 7, 8,15,12, 8, 9,15,15,15,15,15, + 13,13,14,15,12,11,12,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 13,13,13,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,12,13,15,15,12,13,15,15,14,15,15,15,15,15,15, + 15,15,15,15,15,15,13,15,15,15,15,15,15,15,15,15, +}; + +static static_codebook _huff_book_line_256x7_class1 = { + 1, 256, + _huff_lengthlist_line_256x7_class1, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_512x17_0sub0[] = { + 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 6, 5, 6, 6, 6, 6, 5, 6, 6, 7, 6, 7, 6, 7, 6, + 7, 6, 8, 7, 8, 7, 8, 7, 8, 7, 8, 7, 9, 7, 9, 7, + 9, 7, 9, 8, 9, 8,10, 8,10, 8,10, 7,10, 6,10, 8, + 10, 8,11, 7,10, 7,11, 8,11,11,12,12,11,11,12,11, + 13,11,13,11,13,12,15,12,13,13,14,14,14,14,14,15, + 15,15,16,14,17,19,19,18,18,18,18,18,18,18,18,18, + 18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18, +}; + +static static_codebook _huff_book_line_512x17_0sub0 = { + 1, 128, + _huff_lengthlist_line_512x17_0sub0, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_512x17_1sub0[] = { + 2, 4, 5, 4, 5, 4, 5, 4, 5, 5, 5, 5, 5, 5, 6, 5, + 6, 5, 6, 6, 7, 6, 7, 6, 8, 7, 8, 7, 8, 7, 8, 7, +}; + +static static_codebook _huff_book_line_512x17_1sub0 = { + 1, 32, + _huff_lengthlist_line_512x17_1sub0, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_512x17_1sub1[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 4, 3, 5, 3, 5, 4, 5, 4, 5, 4, 5, 5, 5, 5, 6, 5, + 6, 5, 7, 5, 8, 6, 8, 6, 8, 6, 8, 6, 8, 7, 9, 7, + 9, 7,11, 9,11,11,12,11,14,12,14,16,14,16,13,16, + 14,16,12,15,13,16,14,16,13,14,12,15,13,15,13,13, + 13,15,12,14,14,15,13,15,12,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, +}; + +static static_codebook _huff_book_line_512x17_1sub1 = { + 1, 128, + _huff_lengthlist_line_512x17_1sub1, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_512x17_2sub1[] = { + 0, 4, 5, 4, 4, 4, 5, 4, 4, 4, 5, 4, 5, 4, 5, 3, + 5, 3, +}; + +static static_codebook _huff_book_line_512x17_2sub1 = { + 1, 18, + _huff_lengthlist_line_512x17_2sub1, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_512x17_2sub2[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 4, 3, 4, 3, 4, 4, 5, 4, 5, 4, 6, 4, 6, 5, + 6, 5, 7, 5, 7, 6, 8, 6, 8, 6, 8, 7, 8, 7, 9, 7, + 9, 8, +}; + +static static_codebook _huff_book_line_512x17_2sub2 = { + 1, 50, + _huff_lengthlist_line_512x17_2sub2, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_512x17_2sub3[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 3, 3, 3, 3, 4, 3, 4, 4, 5, 5, 6, 6, 7, 7, + 7, 8, 8,11, 8, 9, 9, 9,10,11,11,11, 9,10,10,11, + 11,11,11,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, +}; + +static static_codebook _huff_book_line_512x17_2sub3 = { + 1, 128, + _huff_lengthlist_line_512x17_2sub3, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_512x17_3sub1[] = { + 0, 4, 4, 4, 4, 4, 4, 3, 4, 4, 4, 4, 4, 5, 4, 5, + 5, 5, +}; + +static static_codebook _huff_book_line_512x17_3sub1 = { + 1, 18, + _huff_lengthlist_line_512x17_3sub1, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_512x17_3sub2[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 2, 3, 3, 4, 3, 5, 4, 6, 4, 6, 5, 7, 6, 7, + 6, 8, 6, 8, 7, 9, 8,10, 8,12, 9,13,10,15,10,15, + 11,14, +}; + +static static_codebook _huff_book_line_512x17_3sub2 = { + 1, 50, + _huff_lengthlist_line_512x17_3sub2, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_512x17_3sub3[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 4, 8, 4, 8, 4, 8, 4, 8, 5, 8, 5, 8, 6, 8, + 4, 8, 4, 8, 5, 8, 5, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, +}; + +static static_codebook _huff_book_line_512x17_3sub3 = { + 1, 128, + _huff_lengthlist_line_512x17_3sub3, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_512x17_class1[] = { + 1, 2, 3, 6, 5, 4, 7, 7, +}; + +static static_codebook _huff_book_line_512x17_class1 = { + 1, 8, + _huff_lengthlist_line_512x17_class1, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_512x17_class2[] = { + 3, 3, 3,14, 5, 4, 4,11, 8, 6, 6,10,17,12,11,17, + 6, 5, 5,15, 5, 3, 4,11, 8, 5, 5, 8,16, 9,10,14, + 10, 8, 9,17, 8, 6, 6,13,10, 7, 7,10,16,11,13,14, + 17,17,17,17,17,16,16,16,16,15,16,16,16,16,16,16, +}; + +static static_codebook _huff_book_line_512x17_class2 = { + 1, 64, + _huff_lengthlist_line_512x17_class2, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_512x17_class3[] = { + 2, 4, 6,17, 4, 5, 7,17, 8, 7,10,17,17,17,17,17, + 3, 4, 6,15, 3, 3, 6,15, 7, 6, 9,17,17,17,17,17, + 6, 8,10,17, 6, 6, 8,16, 9, 8,10,17,17,15,16,17, + 17,17,17,17,12,15,15,16,12,15,15,16,16,16,16,16, +}; + +static static_codebook _huff_book_line_512x17_class3 = { + 1, 64, + _huff_lengthlist_line_512x17_class3, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_128x4_class0[] = { + 7, 7, 7,11, 6, 6, 7,11, 7, 6, 6,10,12,10,10,13, + 7, 7, 8,11, 7, 7, 7,11, 7, 6, 7,10,11,10,10,13, + 10,10, 9,12, 9, 9, 9,11, 8, 8, 8,11,13,11,10,14, + 15,15,14,15,15,14,13,14,15,12,12,17,17,17,17,17, + 7, 7, 6, 9, 6, 6, 6, 9, 7, 6, 6, 8,11,11,10,12, + 7, 7, 7, 9, 7, 6, 6, 9, 7, 6, 6, 9,13,10,10,11, + 10, 9, 8,10, 9, 8, 8,10, 8, 8, 7, 9,13,12,10,11, + 17,14,14,13,15,14,12,13,17,13,12,15,17,17,14,17, + 7, 6, 6, 7, 6, 6, 5, 7, 6, 6, 6, 6,11, 9, 9, 9, + 7, 7, 6, 7, 7, 6, 6, 7, 6, 6, 6, 6,10, 9, 8, 9, + 10, 9, 8, 8, 9, 8, 7, 8, 8, 7, 6, 8,11,10, 9,10, + 17,17,12,15,15,15,12,14,14,14,10,12,15,13,12,13, + 11,10, 8,10,11,10, 8, 8,10, 9, 7, 7,10, 9, 9,11, + 11,11, 9,10,11,10, 8, 9,10, 8, 6, 8,10, 9, 9,11, + 14,13,10,12,12,11,10,10, 8, 7, 8,10,10,11,11,12, + 17,17,15,17,17,17,17,17,17,13,12,17,17,17,14,17, +}; + +static static_codebook _huff_book_line_128x4_class0 = { + 1, 256, + _huff_lengthlist_line_128x4_class0, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_128x4_0sub0[] = { + 2, 2, 2, 2, +}; + +static static_codebook _huff_book_line_128x4_0sub0 = { + 1, 4, + _huff_lengthlist_line_128x4_0sub0, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_128x4_0sub1[] = { + 0, 0, 0, 0, 3, 2, 3, 2, 3, 3, +}; + +static static_codebook _huff_book_line_128x4_0sub1 = { + 1, 10, + _huff_lengthlist_line_128x4_0sub1, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_128x4_0sub2[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 4, 3, 4, 3, + 4, 4, 5, 4, 5, 4, 6, 5, 6, +}; + +static static_codebook _huff_book_line_128x4_0sub2 = { + 1, 25, + _huff_lengthlist_line_128x4_0sub2, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_128x4_0sub3[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 4, 3, 5, 3, 5, 3, + 5, 4, 6, 5, 6, 5, 7, 6, 6, 7, 7, 9, 9,11,11,16, + 11,14,10,11,11,13,16,15,15,15,15,15,15,15,15,15, +}; + +static static_codebook _huff_book_line_128x4_0sub3 = { + 1, 64, + _huff_lengthlist_line_128x4_0sub3, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_256x4_class0[] = { + 6, 7, 7,12, 6, 6, 7,12, 7, 6, 6,10,15,12,11,13, + 7, 7, 8,13, 7, 7, 8,12, 7, 7, 7,11,12,12,11,13, + 10, 9, 9,11, 9, 9, 9,10,10, 8, 8,12,14,12,12,14, + 11,11,12,14,11,12,11,15,15,12,13,15,15,15,15,15, + 6, 6, 7,10, 6, 6, 6,11, 7, 6, 6, 9,14,12,11,13, + 7, 7, 7,10, 6, 6, 7, 9, 7, 7, 6,10,13,12,10,12, + 9, 9, 9,11, 9, 9, 8, 9, 9, 8, 8,10,13,12,10,12, + 12,12,11,13,12,12,11,12,15,13,12,15,15,15,14,14, + 6, 6, 6, 8, 6, 6, 5, 6, 7, 7, 6, 5,11,10, 9, 8, + 7, 6, 6, 7, 6, 6, 5, 6, 7, 7, 6, 6,11,10, 9, 8, + 8, 8, 8, 9, 8, 8, 7, 8, 8, 8, 6, 7,11,10, 9, 9, + 14,11,10,14,14,11,10,15,13,11, 9,11,15,12,12,11, + 11, 9, 8, 8,10, 9, 8, 9,11,10, 9, 8,12,11,12,11, + 13,10, 8, 9,11,10, 8, 9,10, 9, 8, 9,10, 8,12,12, + 15,11,10,10,13,11,10,10, 8, 8, 7,12,10, 9,11,12, + 15,12,11,15,13,11,11,15,12,14,11,13,15,15,13,13, +}; + +static static_codebook _huff_book_line_256x4_class0 = { + 1, 256, + _huff_lengthlist_line_256x4_class0, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_256x4_0sub0[] = { + 2, 2, 2, 2, +}; + +static static_codebook _huff_book_line_256x4_0sub0 = { + 1, 4, + _huff_lengthlist_line_256x4_0sub0, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_256x4_0sub1[] = { + 0, 0, 0, 0, 2, 2, 3, 3, 3, 3, +}; + +static static_codebook _huff_book_line_256x4_0sub1 = { + 1, 10, + _huff_lengthlist_line_256x4_0sub1, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_256x4_0sub2[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 3, 4, 3, 4, 3, + 5, 3, 5, 4, 5, 4, 6, 4, 6, +}; + +static static_codebook _huff_book_line_256x4_0sub2 = { + 1, 25, + _huff_lengthlist_line_256x4_0sub2, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_256x4_0sub3[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 4, 3, 5, 3, 5, 3, + 6, 4, 7, 4, 7, 5, 7, 6, 7, 6, 7, 8,10,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,12,12,12,12,12, +}; + +static static_codebook _huff_book_line_256x4_0sub3 = { + 1, 64, + _huff_lengthlist_line_256x4_0sub3, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_128x7_class0[] = { + 10, 7, 8,13, 9, 6, 7,11,10, 8, 8,12,17,17,17,17, + 7, 5, 5, 9, 6, 4, 4, 8, 8, 5, 5, 8,16,14,13,16, + 7, 5, 5, 7, 6, 3, 3, 5, 8, 5, 4, 7,14,12,12,15, + 10, 7, 8, 9, 7, 5, 5, 6, 9, 6, 5, 5,15,12, 9,10, +}; + +static static_codebook _huff_book_line_128x7_class0 = { + 1, 64, + _huff_lengthlist_line_128x7_class0, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_128x7_class1[] = { + 8,13,17,17, 8,11,17,17,11,13,17,17,17,17,17,17, + 6,10,16,17, 6,10,15,17, 8,10,16,17,17,17,17,17, + 9,13,15,17, 8,11,17,17,10,12,17,17,17,17,17,17, + 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17, + 6,11,15,17, 7,10,15,17, 8,10,17,17,17,15,17,17, + 4, 8,13,17, 4, 7,13,17, 6, 8,15,17,16,15,17,17, + 6,11,15,17, 6, 9,13,17, 8,10,17,17,15,17,17,17, + 16,17,17,17,12,14,15,17,13,14,15,17,17,17,17,17, + 5,10,14,17, 5, 9,14,17, 7, 9,15,17,15,15,17,17, + 3, 7,12,17, 3, 6,11,17, 5, 7,13,17,12,12,17,17, + 5, 9,14,17, 3, 7,11,17, 5, 8,13,17,13,11,16,17, + 12,17,17,17, 9,14,15,17,10,11,14,17,16,14,17,17, + 8,12,17,17, 8,12,17,17,10,12,17,17,17,17,17,17, + 5,10,17,17, 5, 9,15,17, 7, 9,17,17,13,13,17,17, + 7,11,17,17, 6,10,15,17, 7, 9,15,17,12,11,17,17, + 12,15,17,17,11,14,17,17,11,10,15,17,17,16,17,17, +}; + +static static_codebook _huff_book_line_128x7_class1 = { + 1, 256, + _huff_lengthlist_line_128x7_class1, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_128x7_0sub1[] = { + 0, 3, 3, 3, 3, 3, 3, 3, 3, +}; + +static static_codebook _huff_book_line_128x7_0sub1 = { + 1, 9, + _huff_lengthlist_line_128x7_0sub1, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_128x7_0sub2[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 4, 4, 4, 4, + 5, 4, 5, 4, 5, 4, 6, 4, 6, +}; + +static static_codebook _huff_book_line_128x7_0sub2 = { + 1, 25, + _huff_lengthlist_line_128x7_0sub2, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_128x7_0sub3[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 5, 3, 5, 3, 5, 4, + 5, 4, 5, 5, 5, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, + 7, 8, 9,11,13,13,13,13,13,13,13,13,13,13,13,13, +}; + +static static_codebook _huff_book_line_128x7_0sub3 = { + 1, 64, + _huff_lengthlist_line_128x7_0sub3, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_128x7_1sub1[] = { + 0, 3, 3, 2, 3, 3, 4, 3, 4, +}; + +static static_codebook _huff_book_line_128x7_1sub1 = { + 1, 9, + _huff_lengthlist_line_128x7_1sub1, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_128x7_1sub2[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 4, 3, 6, 3, 6, 3, + 6, 3, 7, 3, 8, 4, 9, 4, 9, +}; + +static static_codebook _huff_book_line_128x7_1sub2 = { + 1, 25, + _huff_lengthlist_line_128x7_1sub2, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_128x7_1sub3[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 7, 2, 7, 3, 8, 4, + 9, 5, 9, 8,10,11,11,12,14,14,14,14,14,14,14,14, + 14,14,14,14,14,14,14,14,14,14,14,14,13,13,13,13, +}; + +static static_codebook _huff_book_line_128x7_1sub3 = { + 1, 64, + _huff_lengthlist_line_128x7_1sub3, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_128x11_class1[] = { + 1, 6, 3, 7, 2, 4, 5, 7, +}; + +static static_codebook _huff_book_line_128x11_class1 = { + 1, 8, + _huff_lengthlist_line_128x11_class1, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_128x11_class2[] = { + 1, 6,12,16, 4,12,15,16, 9,15,16,16,16,16,16,16, + 2, 5,11,16, 5,11,13,16, 9,13,16,16,16,16,16,16, + 4, 8,12,16, 5, 9,12,16, 9,13,15,16,16,16,16,16, + 15,16,16,16,11,14,13,16,12,15,16,16,16,16,16,15, +}; + +static static_codebook _huff_book_line_128x11_class2 = { + 1, 64, + _huff_lengthlist_line_128x11_class2, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_128x11_class3[] = { + 7, 6, 9,17, 7, 6, 8,17,12, 9,11,16,16,16,16,16, + 5, 4, 7,16, 5, 3, 6,14, 9, 6, 8,15,16,16,16,16, + 5, 4, 6,13, 3, 2, 4,11, 7, 4, 6,13,16,11,10,14, + 12,12,12,16, 9, 7,10,15,12, 9,11,16,16,15,15,16, +}; + +static static_codebook _huff_book_line_128x11_class3 = { + 1, 64, + _huff_lengthlist_line_128x11_class3, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_128x11_0sub0[] = { + 5, 5, 5, 5, 5, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, + 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 6, 6, 6, 7, 6, + 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 8, 6, 8, 6, 8, 7, + 8, 7, 8, 7, 8, 7, 9, 7, 9, 8, 9, 8, 9, 8,10, 8, + 10, 9,10, 9,10, 9,11, 9,11, 9,10,10,11,10,11,10, + 11,11,11,11,11,11,12,13,14,14,14,15,15,16,16,16, + 17,15,16,15,16,16,17,17,16,17,17,17,17,17,17,17, + 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17, +}; + +static static_codebook _huff_book_line_128x11_0sub0 = { + 1, 128, + _huff_lengthlist_line_128x11_0sub0, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_128x11_1sub0[] = { + 2, 5, 5, 5, 5, 5, 5, 4, 5, 5, 5, 5, 5, 5, 5, 5, + 6, 5, 6, 5, 6, 5, 7, 6, 7, 6, 7, 6, 8, 6, 8, 6, +}; + +static static_codebook _huff_book_line_128x11_1sub0 = { + 1, 32, + _huff_lengthlist_line_128x11_1sub0, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_128x11_1sub1[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 5, 3, 5, 3, 6, 4, 6, 4, 7, 4, 7, 4, 7, 4, 8, 4, + 8, 4, 9, 5, 9, 5, 9, 5, 9, 6,10, 6,10, 6,11, 7, + 10, 7,10, 8,11, 9,11, 9,11,10,11,11,12,11,11,12, + 15,15,12,14,11,14,12,14,11,14,13,14,12,14,11,14, + 11,14,12,14,11,14,11,14,13,13,14,14,14,14,14,14, + 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14, +}; + +static static_codebook _huff_book_line_128x11_1sub1 = { + 1, 128, + _huff_lengthlist_line_128x11_1sub1, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_128x11_2sub1[] = { + 0, 4, 5, 4, 5, 4, 5, 3, 5, 3, 5, 3, 5, 4, 4, 4, + 5, 5, +}; + +static static_codebook _huff_book_line_128x11_2sub1 = { + 1, 18, + _huff_lengthlist_line_128x11_2sub1, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_128x11_2sub2[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 3, 3, 3, 4, 4, 4, 4, 5, 4, 5, 4, 6, 5, 7, + 5, 7, 6, 8, 6, 8, 6, 9, 7, 9, 7,10, 7, 9, 8,11, + 8,11, +}; + +static static_codebook _huff_book_line_128x11_2sub2 = { + 1, 50, + _huff_lengthlist_line_128x11_2sub2, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_128x11_2sub3[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 4, 8, 3, 8, 4, 8, 4, 8, 6, 8, 5, 8, 4, 8, + 4, 8, 6, 8, 7, 8, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, +}; + +static static_codebook _huff_book_line_128x11_2sub3 = { + 1, 128, + _huff_lengthlist_line_128x11_2sub3, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_128x11_3sub1[] = { + 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 4, + 5, 4, +}; + +static static_codebook _huff_book_line_128x11_3sub1 = { + 1, 18, + _huff_lengthlist_line_128x11_3sub1, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_128x11_3sub2[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 5, 3, 5, 4, 6, 4, 6, 4, 7, 4, 7, 4, 8, 4, + 8, 4, 9, 4, 9, 4,10, 4,10, 5,10, 5,11, 5,12, 6, + 12, 6, +}; + +static static_codebook _huff_book_line_128x11_3sub2 = { + 1, 50, + _huff_lengthlist_line_128x11_3sub2, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_128x11_3sub3[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 7, 1, 6, 3, 7, 3, 8, 4, 8, 5, 8, 8, 8, 9, + 7, 8, 8, 7, 7, 7, 8, 9,10, 9, 9,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10, 9, 9, +}; + +static static_codebook _huff_book_line_128x11_3sub3 = { + 1, 128, + _huff_lengthlist_line_128x11_3sub3, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_128x17_class1[] = { + 1, 3, 4, 7, 2, 5, 6, 7, +}; + +static static_codebook _huff_book_line_128x17_class1 = { + 1, 8, + _huff_lengthlist_line_128x17_class1, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_128x17_class2[] = { + 1, 4,10,19, 3, 8,13,19, 7,12,19,19,19,19,19,19, + 2, 6,11,19, 8,13,19,19, 9,11,19,19,19,19,19,19, + 6, 7,13,19, 9,13,19,19,10,13,18,18,18,18,18,18, + 18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18, +}; + +static static_codebook _huff_book_line_128x17_class2 = { + 1, 64, + _huff_lengthlist_line_128x17_class2, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_128x17_class3[] = { + 3, 6,10,17, 4, 8,11,20, 8,10,11,20,20,20,20,20, + 2, 4, 8,18, 4, 6, 8,17, 7, 8,10,20,20,17,20,20, + 3, 5, 8,17, 3, 4, 6,17, 8, 8,10,17,17,12,16,20, + 13,13,15,20,10,10,12,20,15,14,15,20,20,20,19,19, +}; + +static static_codebook _huff_book_line_128x17_class3 = { + 1, 64, + _huff_lengthlist_line_128x17_class3, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_128x17_0sub0[] = { + 5, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, + 7, 5, 7, 5, 7, 5, 7, 5, 7, 5, 7, 5, 8, 5, 8, 5, + 8, 5, 8, 5, 8, 6, 8, 6, 8, 6, 9, 6, 9, 6, 9, 6, + 9, 6, 9, 7, 9, 7, 9, 7, 9, 7,10, 7,10, 8,10, 8, + 10, 8,10, 8,10, 8,11, 8,11, 8,11, 8,11, 8,11, 9, + 12, 9,12, 9,12, 9,12, 9,12,10,12,10,13,11,13,11, + 14,12,14,13,15,14,16,14,17,15,18,16,20,20,20,20, + 20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20, +}; + +static static_codebook _huff_book_line_128x17_0sub0 = { + 1, 128, + _huff_lengthlist_line_128x17_0sub0, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_128x17_1sub0[] = { + 2, 5, 5, 4, 5, 4, 5, 4, 5, 5, 5, 5, 5, 5, 6, 5, + 6, 5, 6, 5, 7, 6, 7, 6, 7, 6, 8, 6, 9, 7, 9, 7, +}; + +static static_codebook _huff_book_line_128x17_1sub0 = { + 1, 32, + _huff_lengthlist_line_128x17_1sub0, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_128x17_1sub1[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 4, 3, 5, 3, 5, 3, 6, 3, 6, 4, 6, 4, 7, 4, 7, 5, + 8, 5, 8, 6, 9, 7, 9, 7, 9, 8,10, 9,10, 9,11,10, + 11,11,11,11,11,11,12,12,12,13,12,13,12,14,12,15, + 12,14,12,16,13,17,13,17,14,17,14,16,13,17,14,17, + 14,17,15,17,15,15,16,17,17,17,17,17,17,17,17,17, + 17,17,17,17,17,17,16,16,16,16,16,16,16,16,16,16, +}; + +static static_codebook _huff_book_line_128x17_1sub1 = { + 1, 128, + _huff_lengthlist_line_128x17_1sub1, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_128x17_2sub1[] = { + 0, 4, 5, 4, 6, 4, 8, 3, 9, 3, 9, 2, 9, 3, 8, 4, + 9, 4, +}; + +static static_codebook _huff_book_line_128x17_2sub1 = { + 1, 18, + _huff_lengthlist_line_128x17_2sub1, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_128x17_2sub2[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 5, 1, 5, 3, 5, 3, 5, 4, 7, 5,10, 7,10, 7, + 12,10,14,10,14, 9,14,11,14,14,14,13,13,13,13,13, + 13,13, +}; + +static static_codebook _huff_book_line_128x17_2sub2 = { + 1, 50, + _huff_lengthlist_line_128x17_2sub2, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_128x17_2sub3[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, +}; + +static static_codebook _huff_book_line_128x17_2sub3 = { + 1, 128, + _huff_lengthlist_line_128x17_2sub3, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_128x17_3sub1[] = { + 0, 4, 4, 4, 4, 4, 4, 4, 5, 3, 5, 3, 5, 4, 6, 4, + 6, 4, +}; + +static static_codebook _huff_book_line_128x17_3sub1 = { + 1, 18, + _huff_lengthlist_line_128x17_3sub1, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_128x17_3sub2[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 5, 3, 6, 3, 6, 4, 7, 4, 7, 4, 7, 4, 8, 4, + 8, 4, 8, 4, 8, 4, 9, 4, 9, 5,10, 5,10, 7,10, 8, + 10, 8, +}; + +static static_codebook _huff_book_line_128x17_3sub2 = { + 1, 50, + _huff_lengthlist_line_128x17_3sub2, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_128x17_3sub3[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 3, 2, 4, 3, 4, 4, 4, 5, 4, 7, 5, 8, 5,11, + 6,10, 6,12, 7,12, 7,12, 8,12, 8,12,10,12,12,12, + 12,12,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, +}; + +static static_codebook _huff_book_line_128x17_3sub3 = { + 1, 128, + _huff_lengthlist_line_128x17_3sub3, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_1024x27_class1[] = { + 2,10, 8,14, 7,12,11,14, 1, 5, 3, 7, 4, 9, 7,13, +}; + +static static_codebook _huff_book_line_1024x27_class1 = { + 1, 16, + _huff_lengthlist_line_1024x27_class1, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_1024x27_class2[] = { + 1, 4, 2, 6, 3, 7, 5, 7, +}; + +static static_codebook _huff_book_line_1024x27_class2 = { + 1, 8, + _huff_lengthlist_line_1024x27_class2, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_1024x27_class3[] = { + 1, 5, 7,21, 5, 8, 9,21,10, 9,12,20,20,16,20,20, + 4, 8, 9,20, 6, 8, 9,20,11,11,13,20,20,15,17,20, + 9,11,14,20, 8,10,15,20,11,13,15,20,20,20,20,20, + 20,20,20,20,13,20,20,20,18,18,20,20,20,20,20,20, + 3, 6, 8,20, 6, 7, 9,20,10, 9,12,20,20,20,20,20, + 5, 7, 9,20, 6, 6, 9,20,10, 9,12,20,20,20,20,20, + 8,10,13,20, 8, 9,12,20,11,10,12,20,20,20,20,20, + 18,20,20,20,15,17,18,20,18,17,18,20,20,20,20,20, + 7,10,12,20, 8, 9,11,20,14,13,14,20,20,20,20,20, + 6, 9,12,20, 7, 8,11,20,12,11,13,20,20,20,20,20, + 9,11,15,20, 8,10,14,20,12,11,14,20,20,20,20,20, + 20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20, + 11,16,18,20,15,15,17,20,20,17,20,20,20,20,20,20, + 9,14,16,20,12,12,15,20,17,15,18,20,20,20,20,20, + 16,19,18,20,15,16,20,20,17,17,20,20,20,20,20,20, + 20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20, +}; + +static static_codebook _huff_book_line_1024x27_class3 = { + 1, 256, + _huff_lengthlist_line_1024x27_class3, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_1024x27_class4[] = { + 2, 3, 7,13, 4, 4, 7,15, 8, 6, 9,17,21,16,15,21, + 2, 5, 7,11, 5, 5, 7,14, 9, 7,10,16,17,15,16,21, + 4, 7,10,17, 7, 7, 9,15,11, 9,11,16,21,18,15,21, + 18,21,21,21,15,17,17,19,21,19,18,20,21,21,21,20, +}; + +static static_codebook _huff_book_line_1024x27_class4 = { + 1, 64, + _huff_lengthlist_line_1024x27_class4, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_1024x27_0sub0[] = { + 5, 5, 5, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, + 6, 5, 6, 5, 6, 5, 6, 5, 7, 5, 7, 5, 7, 5, 7, 5, + 8, 6, 8, 6, 8, 6, 9, 6, 9, 6,10, 6,10, 6,11, 6, + 11, 7,11, 7,12, 7,12, 7,12, 7,12, 7,12, 7,12, 7, + 12, 7,12, 8,13, 8,12, 8,12, 8,13, 8,13, 9,13, 9, + 13, 9,13, 9,12,10,12,10,13,10,14,11,14,12,14,13, + 14,13,14,14,15,16,15,15,15,14,15,17,21,22,22,21, + 22,22,22,22,22,22,21,21,21,21,21,21,21,21,21,21, +}; + +static static_codebook _huff_book_line_1024x27_0sub0 = { + 1, 128, + _huff_lengthlist_line_1024x27_0sub0, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_1024x27_1sub0[] = { + 2, 5, 5, 4, 5, 4, 5, 4, 5, 4, 6, 5, 6, 5, 6, 5, + 6, 5, 7, 5, 7, 6, 8, 6, 8, 6, 8, 6, 9, 6, 9, 6, +}; + +static static_codebook _huff_book_line_1024x27_1sub0 = { + 1, 32, + _huff_lengthlist_line_1024x27_1sub0, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_1024x27_1sub1[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 8, 5, 8, 4, 9, 4, 9, 4, 9, 4, 9, 4, 9, 4, 9, 4, + 9, 4, 9, 4, 9, 4, 8, 4, 8, 4, 9, 5, 9, 5, 9, 5, + 9, 5, 9, 6,10, 6,10, 7,10, 8,11, 9,11,11,12,13, + 12,14,13,15,13,15,14,16,14,17,15,17,15,15,16,16, + 15,16,16,16,15,18,16,15,17,17,19,19,19,19,19,19, + 19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19, +}; + +static static_codebook _huff_book_line_1024x27_1sub1 = { + 1, 128, + _huff_lengthlist_line_1024x27_1sub1, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_1024x27_2sub0[] = { + 1, 5, 5, 5, 5, 5, 5, 5, 6, 5, 6, 5, 6, 5, 6, 5, + 6, 6, 7, 7, 7, 7, 8, 7, 8, 8, 9, 8,10, 9,10, 9, +}; + +static static_codebook _huff_book_line_1024x27_2sub0 = { + 1, 32, + _huff_lengthlist_line_1024x27_2sub0, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_1024x27_2sub1[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 4, 3, 4, 3, 4, 4, 5, 4, 5, 4, 5, 5, 6, 5, 6, 5, + 7, 5, 7, 6, 7, 6, 8, 7, 8, 7, 8, 7, 9, 8, 9, 9, + 9, 9,10,10,10,11, 9,12, 9,12, 9,15,10,14, 9,13, + 10,13,10,12,10,12,10,13,10,12,11,13,11,14,12,13, + 13,14,14,13,14,15,14,16,13,13,14,16,16,16,16,16, + 16,16,16,16,16,16,16,16,16,16,16,16,16,16,15,15, +}; + +static static_codebook _huff_book_line_1024x27_2sub1 = { + 1, 128, + _huff_lengthlist_line_1024x27_2sub1, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_1024x27_3sub1[] = { + 0, 4, 5, 4, 5, 3, 5, 3, 5, 3, 5, 4, 4, 4, 4, 5, + 5, 5, +}; + +static static_codebook _huff_book_line_1024x27_3sub1 = { + 1, 18, + _huff_lengthlist_line_1024x27_3sub1, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_1024x27_3sub2[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 3, 3, 4, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, + 5, 7, 5, 8, 6, 8, 6, 9, 7,10, 7,10, 8,10, 8,11, + 9,11, +}; + +static static_codebook _huff_book_line_1024x27_3sub2 = { + 1, 50, + _huff_lengthlist_line_1024x27_3sub2, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_1024x27_3sub3[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 3, 7, 3, 8, 3,10, 3, 8, 3, 9, 3, 8, 4, 9, + 4, 9, 5, 9, 6,10, 6, 9, 7,11, 7,12, 9,13,10,13, + 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, + 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, + 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, +}; + +static static_codebook _huff_book_line_1024x27_3sub3 = { + 1, 128, + _huff_lengthlist_line_1024x27_3sub3, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_1024x27_4sub1[] = { + 0, 4, 5, 4, 5, 4, 5, 4, 5, 3, 5, 3, 5, 3, 5, 4, + 5, 4, +}; + +static static_codebook _huff_book_line_1024x27_4sub1 = { + 1, 18, + _huff_lengthlist_line_1024x27_4sub1, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_1024x27_4sub2[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 4, 2, 4, 2, 5, 3, 5, 4, 6, 6, 6, 7, 7, 8, + 7, 8, 7, 8, 7, 9, 8, 9, 8, 9, 8,10, 8,11, 9,12, + 9,12, +}; + +static static_codebook _huff_book_line_1024x27_4sub2 = { + 1, 50, + _huff_lengthlist_line_1024x27_4sub2, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_1024x27_4sub3[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 2, 5, 2, 6, 3, 6, 4, 7, 4, 7, 5, 9, 5,11, + 6,11, 6,11, 7,11, 6,11, 6,11, 9,11, 8,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,10,10,10,10,10,10, +}; + +static static_codebook _huff_book_line_1024x27_4sub3 = { + 1, 128, + _huff_lengthlist_line_1024x27_4sub3, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_2048x27_class1[] = { + 2, 6, 8, 9, 7,11,13,13, 1, 3, 5, 5, 6, 6,12,10, +}; + +static static_codebook _huff_book_line_2048x27_class1 = { + 1, 16, + _huff_lengthlist_line_2048x27_class1, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_2048x27_class2[] = { + 1, 2, 3, 6, 4, 7, 5, 7, +}; + +static static_codebook _huff_book_line_2048x27_class2 = { + 1, 8, + _huff_lengthlist_line_2048x27_class2, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_2048x27_class3[] = { + 3, 3, 6,16, 5, 5, 7,16, 9, 8,11,16,16,16,16,16, + 5, 5, 8,16, 5, 5, 7,16, 8, 7, 9,16,16,16,16,16, + 9, 9,12,16, 6, 8,11,16, 9,10,11,16,16,16,16,16, + 16,16,16,16,13,16,16,16,15,16,16,16,16,16,16,16, + 5, 4, 7,16, 6, 5, 8,16, 9, 8,10,16,16,16,16,16, + 5, 5, 7,15, 5, 4, 6,15, 7, 6, 8,16,16,16,16,16, + 9, 9,11,15, 7, 7, 9,16, 8, 8, 9,16,16,16,16,16, + 16,16,16,16,15,15,15,16,15,15,14,16,16,16,16,16, + 8, 8,11,16, 8, 9,10,16,11,10,14,16,16,16,16,16, + 6, 8,10,16, 6, 7,10,16, 8, 8,11,16,14,16,16,16, + 10,11,14,16, 9, 9,11,16,10,10,11,16,16,16,16,16, + 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, + 16,16,16,16,15,16,16,16,16,16,16,16,16,16,16,16, + 12,16,15,16,12,14,16,16,16,16,16,16,16,16,16,16, + 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, + 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, +}; + +static static_codebook _huff_book_line_2048x27_class3 = { + 1, 256, + _huff_lengthlist_line_2048x27_class3, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_2048x27_class4[] = { + 2, 4, 7,13, 4, 5, 7,15, 8, 7,10,16,16,14,16,16, + 2, 4, 7,16, 3, 4, 7,14, 8, 8,10,16,16,16,15,16, + 6, 8,11,16, 7, 7, 9,16,11, 9,13,16,16,16,15,16, + 16,16,16,16,14,16,16,16,16,16,16,16,16,16,16,16, +}; + +static static_codebook _huff_book_line_2048x27_class4 = { + 1, 64, + _huff_lengthlist_line_2048x27_class4, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_2048x27_0sub0[] = { + 5, 5, 5, 5, 5, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, + 6, 5, 7, 5, 7, 5, 7, 5, 8, 5, 8, 5, 8, 5, 9, 5, + 9, 6,10, 6,10, 6,11, 6,11, 6,11, 6,11, 6,11, 6, + 11, 6,11, 6,12, 7,11, 7,11, 7,11, 7,11, 7,10, 7, + 11, 7,11, 7,12, 7,11, 8,11, 8,11, 8,11, 8,13, 8, + 12, 9,11, 9,11, 9,11,10,12,10,12, 9,12,10,12,11, + 14,12,16,12,12,11,14,16,17,17,17,17,17,17,17,17, + 17,17,17,17,17,17,17,17,17,17,17,17,16,16,16,16, +}; + +static static_codebook _huff_book_line_2048x27_0sub0 = { + 1, 128, + _huff_lengthlist_line_2048x27_0sub0, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_2048x27_1sub0[] = { + 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 6, 6, 6, 6, 6, 6, 7, 6, 7, 6, 7, 6, 7, 6, +}; + +static static_codebook _huff_book_line_2048x27_1sub0 = { + 1, 32, + _huff_lengthlist_line_2048x27_1sub0, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_2048x27_1sub1[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 6, 5, 7, 5, 7, 4, 7, 4, 8, 4, 8, 4, 8, 4, 8, 3, + 8, 4, 9, 4, 9, 4, 9, 4, 9, 4, 9, 5, 9, 5, 9, 6, + 9, 7, 9, 8, 9, 9, 9,10, 9,11, 9,14, 9,15,10,15, + 10,15,10,15,10,15,11,15,10,14,12,14,11,14,13,14, + 13,15,15,15,12,15,15,15,13,15,13,15,13,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,14, +}; + +static static_codebook _huff_book_line_2048x27_1sub1 = { + 1, 128, + _huff_lengthlist_line_2048x27_1sub1, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_2048x27_2sub0[] = { + 2, 4, 5, 4, 5, 4, 5, 4, 5, 5, 5, 5, 5, 5, 6, 5, + 6, 5, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, +}; + +static static_codebook _huff_book_line_2048x27_2sub0 = { + 1, 32, + _huff_lengthlist_line_2048x27_2sub0, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_2048x27_2sub1[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 3, 4, 3, 4, 3, 4, 4, 5, 4, 5, 5, 5, 6, 6, 6, 7, + 6, 8, 6, 8, 6, 9, 7,10, 7,10, 7,10, 7,12, 7,12, + 7,12, 9,12,11,12,10,12,10,12,11,12,12,12,10,12, + 10,12,10,12, 9,12,11,12,12,12,12,12,11,12,11,12, + 12,12,12,12,12,12,12,12,10,10,12,12,12,12,12,10, + 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, +}; + +static static_codebook _huff_book_line_2048x27_2sub1 = { + 1, 128, + _huff_lengthlist_line_2048x27_2sub1, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_2048x27_3sub1[] = { + 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 5, 5, +}; + +static static_codebook _huff_book_line_2048x27_3sub1 = { + 1, 18, + _huff_lengthlist_line_2048x27_3sub1, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_2048x27_3sub2[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, + 6, 7, 6, 7, 6, 8, 6, 9, 7, 9, 7, 9, 9,11, 9,12, + 10,12, +}; + +static static_codebook _huff_book_line_2048x27_3sub2 = { + 1, 50, + _huff_lengthlist_line_2048x27_3sub2, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_2048x27_3sub3[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 3, 6, 3, 7, 3, 7, 5, 7, 7, 7, 7, 7, 6, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, +}; + +static static_codebook _huff_book_line_2048x27_3sub3 = { + 1, 128, + _huff_lengthlist_line_2048x27_3sub3, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_2048x27_4sub1[] = { + 0, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 4, 5, 4, 5, 4, + 4, 5, +}; + +static static_codebook _huff_book_line_2048x27_4sub1 = { + 1, 18, + _huff_lengthlist_line_2048x27_4sub1, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_2048x27_4sub2[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 3, 2, 4, 3, 4, 4, 4, 5, 5, 6, 5, 6, 5, 7, + 6, 6, 6, 7, 7, 7, 8, 9, 9, 9,12,10,11,10,10,12, + 10,10, +}; + +static static_codebook _huff_book_line_2048x27_4sub2 = { + 1, 50, + _huff_lengthlist_line_2048x27_4sub2, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_2048x27_4sub3[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 3, 6, 5, 7, 5, 7, 7, 7, 7, 7, 5, 7, 5, 7, + 5, 7, 5, 7, 7, 7, 7, 7, 4, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, +}; + +static static_codebook _huff_book_line_2048x27_4sub3 = { + 1, 128, + _huff_lengthlist_line_2048x27_4sub3, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_256x4low_class0[] = { + 4, 5, 6,11, 5, 5, 6,10, 7, 7, 6, 6,14,13, 9, 9, + 6, 6, 6,10, 6, 6, 6, 9, 8, 7, 7, 9,14,12, 8,11, + 8, 7, 7,11, 8, 8, 7,11, 9, 9, 7, 9,13,11, 9,13, + 19,19,18,19,15,16,16,19,11,11,10,13,10,10, 9,15, + 5, 5, 6,13, 6, 6, 6,11, 8, 7, 6, 7,14,11,10,11, + 6, 6, 6,12, 7, 6, 6,11, 8, 7, 7,11,13,11, 9,11, + 9, 7, 6,12, 8, 7, 6,12, 9, 8, 8,11,13,10, 7,13, + 19,19,17,19,17,14,14,19,12,10, 8,12,13,10, 9,16, + 7, 8, 7,12, 7, 7, 7,11, 8, 7, 7, 8,12,12,11,11, + 8, 8, 7,12, 8, 7, 6,11, 8, 7, 7,10,10,11,10,11, + 9, 8, 8,13, 9, 8, 7,12,10, 9, 7,11, 9, 8, 7,11, + 18,18,15,18,18,16,17,18,15,11,10,18,11, 9, 9,18, + 16,16,13,16,12,11,10,16,12,11, 9, 6,15,12,11,13, + 16,16,14,14,13,11,12,16,12, 9, 9,13,13,10,10,12, + 17,18,17,17,14,15,14,16,14,12,14,15,12,10,11,12, + 18,18,18,18,18,18,18,18,18,12,13,18,16,11, 9,18, +}; + +static static_codebook _huff_book_line_256x4low_class0 = { + 1, 256, + _huff_lengthlist_line_256x4low_class0, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_256x4low_0sub0[] = { + 1, 3, 2, 3, +}; + +static static_codebook _huff_book_line_256x4low_0sub0 = { + 1, 4, + _huff_lengthlist_line_256x4low_0sub0, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_256x4low_0sub1[] = { + 0, 0, 0, 0, 2, 3, 2, 3, 3, 3, +}; + +static static_codebook _huff_book_line_256x4low_0sub1 = { + 1, 10, + _huff_lengthlist_line_256x4low_0sub1, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_256x4low_0sub2[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 4, 3, 4, + 4, 4, 4, 4, 5, 5, 5, 6, 6, +}; + +static static_codebook _huff_book_line_256x4low_0sub2 = { + 1, 25, + _huff_lengthlist_line_256x4low_0sub2, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist_line_256x4low_0sub3[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 4, 2, 4, 3, 5, 4, + 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 7, 7, 8, 6, 9, + 7,12,11,16,13,16,12,15,13,15,12,14,12,15,15,15, +}; + +static static_codebook _huff_book_line_256x4low_0sub3 = { + 1, 64, + _huff_lengthlist_line_256x4low_0sub3, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + diff --git a/Libraries/Vorbis/Files/lib/books/uncoupled/.cvsignore b/Libraries/Vorbis/Files/lib/books/uncoupled/.cvsignore new file mode 100644 index 000000000..282522db0 --- /dev/null +++ b/Libraries/Vorbis/Files/lib/books/uncoupled/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/Libraries/Vorbis/Files/lib/books/uncoupled/Makefile.am b/Libraries/Vorbis/Files/lib/books/uncoupled/Makefile.am new file mode 100644 index 000000000..93ff417c8 --- /dev/null +++ b/Libraries/Vorbis/Files/lib/books/uncoupled/Makefile.am @@ -0,0 +1,3 @@ +## Process this file with automake to produce Makefile.in + +EXTRA_DIST = res_books_uncoupled.h diff --git a/Libraries/Vorbis/Files/lib/books/uncoupled/res_books_uncoupled.h b/Libraries/Vorbis/Files/lib/books/uncoupled/res_books_uncoupled.h new file mode 100644 index 000000000..853d3485d --- /dev/null +++ b/Libraries/Vorbis/Files/lib/books/uncoupled/res_books_uncoupled.h @@ -0,0 +1,11517 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * + * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * + * by the Xiph.Org Foundation http://www.xiph.org/ * + * * + ******************************************************************** + + function: static codebooks autogenerated by huff/huffbuld + last modified: $Id$ + + ********************************************************************/ + +#include "codebook.h" +static long _vq_quantlist__16u0__p1_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__16u0__p1_0[] = { + 1, 4, 4, 5, 7, 7, 5, 7, 8, 5, 8, 8, 8,10,10, 8, + 10,11, 5, 8, 8, 8,10,10, 8,10,10, 4, 9, 9, 9,12, + 11, 8,11,11, 8,12,11,10,12,14,10,13,13, 7,11,11, + 10,14,12,11,14,14, 4, 9, 9, 8,11,11, 9,11,12, 7, + 11,11,10,13,14,10,12,14, 8,11,12,10,14,14,10,13, + 12, +}; + +static float _vq_quantthresh__16u0__p1_0[] = { + -0.5, 0.5, +}; + +static long _vq_quantmap__16u0__p1_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__16u0__p1_0 = { + _vq_quantthresh__16u0__p1_0, + _vq_quantmap__16u0__p1_0, + 3, + 3 +}; + +static static_codebook _16u0__p1_0 = { + 4, 81, + _vq_lengthlist__16u0__p1_0, + 1, -535822336, 1611661312, 2, 0, + _vq_quantlist__16u0__p1_0, + NULL, + &_vq_auxt__16u0__p1_0, + NULL, + 0 +}; + +static long _vq_quantlist__16u0__p2_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__16u0__p2_0[] = { + 2, 4, 4, 5, 6, 6, 5, 6, 6, 5, 7, 7, 7, 8, 9, 7, + 8, 9, 5, 7, 7, 7, 9, 8, 7, 9, 7, 4, 7, 7, 7, 9, + 9, 7, 8, 8, 6, 9, 8, 7, 8,11, 9,11,10, 6, 8, 9, + 8,11, 8, 9,10,11, 4, 7, 7, 7, 8, 8, 7, 9, 9, 6, + 9, 8, 9,11,10, 8, 8,11, 6, 8, 9, 9,10,11, 8,11, + 8, +}; + +static float _vq_quantthresh__16u0__p2_0[] = { + -0.5, 0.5, +}; + +static long _vq_quantmap__16u0__p2_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__16u0__p2_0 = { + _vq_quantthresh__16u0__p2_0, + _vq_quantmap__16u0__p2_0, + 3, + 3 +}; + +static static_codebook _16u0__p2_0 = { + 4, 81, + _vq_lengthlist__16u0__p2_0, + 1, -535822336, 1611661312, 2, 0, + _vq_quantlist__16u0__p2_0, + NULL, + &_vq_auxt__16u0__p2_0, + NULL, + 0 +}; + +static long _vq_quantlist__16u0__p3_0[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__16u0__p3_0[] = { + 1, 5, 5, 7, 7, 6, 7, 7, 8, 8, 6, 7, 8, 8, 8, 8, + 9, 9,11,11, 8, 9, 9,11,11, 6, 9, 8,10,10, 8,10, + 10,11,11, 8,10,10,11,11,10,11,10,13,12, 9,11,10, + 13,13, 6, 8, 9,10,10, 8,10,10,11,11, 8,10,10,11, + 11, 9,10,11,13,12,10,10,11,12,12, 8,11,11,14,13, + 10,12,11,15,13, 9,12,11,15,14,12,14,13,16,14,12, + 13,13,17,14, 8,11,11,13,14, 9,11,12,14,15,10,11, + 12,13,15,11,13,13,14,16,12,13,14,14,16, 5, 9, 9, + 11,11, 9,11,11,12,12, 8,11,11,12,12,11,12,12,15, + 14,10,12,12,15,15, 8,11,11,13,12,10,12,12,13,13, + 10,12,12,14,13,12,12,13,14,15,11,13,13,17,16, 7, + 11,11,13,13,10,12,12,14,13,10,12,12,13,14,12,13, + 12,15,14,11,13,13,15,14, 9,12,12,16,15,11,13,13, + 17,16,10,13,13,16,16,13,14,15,15,16,13,15,14,19, + 17, 9,12,12,14,16,11,13,13,15,16,10,13,13,17,16, + 13,14,13,17,15,12,15,15,16,17, 5, 9, 9,11,11, 8, + 11,11,13,12, 9,11,11,12,12,10,12,12,14,15,11,12, + 12,14,14, 7,11,10,13,12,10,12,12,14,13,10,11,12, + 13,13,11,13,13,15,16,12,12,13,15,15, 7,11,11,13, + 13,10,13,13,14,14,10,12,12,13,13,11,13,13,16,15, + 12,13,13,15,14, 9,12,12,15,15,10,13,13,17,16,11, + 12,13,15,15,12,15,14,18,18,13,14,14,16,17, 9,12, + 12,15,16,10,13,13,15,16,11,13,13,15,16,13,15,15, + 17,17,13,15,14,16,15, 7,11,11,15,16,10,13,12,16, + 17,10,12,13,15,17,15,16,16,18,17,13,15,15,17,18, + 8,12,12,16,16,11,13,14,17,18,11,13,13,18,16,15, + 17,16,17,19,14,15,15,17,16, 8,12,12,16,15,11,14, + 13,18,17,11,13,14,18,17,15,16,16,18,17,13,16,16, + 18,18,11,15,14,18,17,13,14,15,18, 0,12,15,15, 0, + 17,17,16,17,17,18,14,16,18,18, 0,11,14,14,17, 0, + 12,15,14,17,19,12,15,14,18, 0,15,18,16, 0,17,14, + 18,16,18, 0, 7,11,11,16,15,10,12,12,18,16,10,13, + 13,16,15,13,15,14,17,17,14,16,16,19,18, 8,12,12, + 16,16,11,13,13,18,16,11,13,14,17,16,14,15,15,19, + 18,15,16,16, 0,19, 8,12,12,16,17,11,13,13,17,17, + 11,14,13,17,17,13,15,15,17,19,15,17,17,19, 0,11, + 14,15,19,17,12,15,16,18,18,12,14,15,19,17,14,16, + 17, 0,18,16,16,19,17, 0,11,14,14,18,19,12,15,14, + 17,17,13,16,14,17,16,14,17,16,18,18,15,18,15, 0, + 18, +}; + +static float _vq_quantthresh__16u0__p3_0[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__16u0__p3_0[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__16u0__p3_0 = { + _vq_quantthresh__16u0__p3_0, + _vq_quantmap__16u0__p3_0, + 5, + 5 +}; + +static static_codebook _16u0__p3_0 = { + 4, 625, + _vq_lengthlist__16u0__p3_0, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__16u0__p3_0, + NULL, + &_vq_auxt__16u0__p3_0, + NULL, + 0 +}; + +static long _vq_quantlist__16u0__p4_0[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__16u0__p4_0[] = { + 3, 5, 5, 8, 8, 6, 6, 6, 9, 9, 6, 6, 6, 9, 9, 9, + 10, 9,11,11, 9, 9, 9,11,11, 6, 7, 7,10,10, 7, 7, + 8,10,10, 7, 7, 8,10,10,10,10,10,11,12, 9,10,10, + 11,12, 6, 7, 7,10,10, 7, 8, 7,10,10, 7, 8, 7,10, + 10,10,11,10,12,11,10,10,10,13,10, 9,10,10,12,12, + 10,11,10,14,12, 9,11,11,13,13,11,12,13,13,13,11, + 12,12,15,13, 9,10,10,12,13, 9,11,10,12,13,10,10, + 11,12,13,11,12,12,12,13,11,12,12,13,13, 5, 7, 7, + 10,10, 7, 8, 8,10,10, 7, 8, 8,10,10,10,11,10,12, + 13,10,10,11,12,12, 6, 8, 8,11,10, 7, 8, 9,10,12, + 8, 9, 9,11,11,11,10,11,11,12,10,11,11,13,12, 7, + 8, 8,10,11, 8, 9, 8,11,10, 8, 9, 9,11,11,10,12, + 10,13,11,10,11,11,13,13,10,11,10,14,13,10,10,11, + 13,13,10,12,11,14,13,12,11,13,12,13,13,12,13,14, + 14,10,11,11,13,13,10,11,10,12,13,10,12,12,12,14, + 12,12,12,14,12,12,13,12,17,15, 5, 7, 7,10,10, 7, + 8, 8,10,10, 7, 8, 8,11,10,10,10,11,12,12,10,11, + 11,12,13, 6, 8, 8,11,10, 8, 9, 9,11,11, 7, 8, 9, + 10,11,11,11,11,12,12,10,10,11,12,13, 6, 8, 8,10, + 11, 8, 9, 9,11,11, 7, 9, 7,11,10,10,12,12,13,13, + 11,11,10,13,11, 9,11,10,14,13,11,11,11,15,13,10, + 10,11,13,13,12,13,13,14,14,12,11,12,12,13,10,11, + 11,12,13,10,11,12,13,13,10,11,10,13,12,12,12,13, + 14, 0,12,13,11,13,11, 8,10,10,13,13,10,11,11,14, + 13,10,11,11,13,12,13,14,14,14,15,12,12,12,15,14, + 9,11,10,13,12,10,10,11,13,14,11,11,11,15,12,13, + 12,14,15,16,13,13,13,14,13, 9,11,11,12,12,10,12, + 11,13,13,10,11,11,13,14,13,13,13,15,15,13,13,14, + 17,15,11,12,12,14,14,10,11,12,13,15,12,13,13, 0, + 15,13,11,14,12,16,14,16,14, 0,15,11,12,12,14,16, + 11,13,12,16,15,12,13,13,14,15,12,14,12,15,13,15, + 14,14,16,16, 8,10,10,13,13,10,11,10,13,14,10,11, + 11,13,13,13,13,12,14,14,14,13,13,16,17, 9,10,10, + 12,14,10,12,11,14,13,10,11,12,13,14,12,12,12,15, + 15,13,13,13,14,14, 9,10,10,13,13,10,11,12,12,14, + 10,11,10,13,13,13,13,13,14,16,13,13,13,14,14,11, + 12,13,15,13,12,14,13,14,16,12,12,13,13,14,13,14, + 14,17,15,13,12,17,13,16,11,12,13,14,15,12,13,14, + 14,17,11,12,11,14,14,13,16,14,16, 0,14,15,11,15, + 11, +}; + +static float _vq_quantthresh__16u0__p4_0[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__16u0__p4_0[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__16u0__p4_0 = { + _vq_quantthresh__16u0__p4_0, + _vq_quantmap__16u0__p4_0, + 5, + 5 +}; + +static static_codebook _16u0__p4_0 = { + 4, 625, + _vq_lengthlist__16u0__p4_0, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__16u0__p4_0, + NULL, + &_vq_auxt__16u0__p4_0, + NULL, + 0 +}; + +static long _vq_quantlist__16u0__p5_0[] = { + 4, + 3, + 5, + 2, + 6, + 1, + 7, + 0, + 8, +}; + +static long _vq_lengthlist__16u0__p5_0[] = { + 1, 4, 4, 7, 7, 7, 7, 9, 9, 4, 6, 6, 8, 8, 8, 8, + 9, 9, 4, 6, 6, 8, 8, 8, 8, 9, 9, 7, 8, 8, 9, 9, + 9, 9,11,10, 7, 8, 8, 9, 9, 9, 9,10,11, 7, 8, 8, + 9, 9,10,10,11,11, 7, 8, 8, 9, 9,10,10,11,11, 9, + 9, 9,10,10,11,11,12,12, 9, 9, 9,10,10,11,11,12, + 12, +}; + +static float _vq_quantthresh__16u0__p5_0[] = { + -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, +}; + +static long _vq_quantmap__16u0__p5_0[] = { + 7, 5, 3, 1, 0, 2, 4, 6, + 8, +}; + +static encode_aux_threshmatch _vq_auxt__16u0__p5_0 = { + _vq_quantthresh__16u0__p5_0, + _vq_quantmap__16u0__p5_0, + 9, + 9 +}; + +static static_codebook _16u0__p5_0 = { + 2, 81, + _vq_lengthlist__16u0__p5_0, + 1, -531628032, 1611661312, 4, 0, + _vq_quantlist__16u0__p5_0, + NULL, + &_vq_auxt__16u0__p5_0, + NULL, + 0 +}; + +static long _vq_quantlist__16u0__p6_0[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__16u0__p6_0[] = { + 1, 4, 4, 7, 7,10,10,12,12,13,13,18,17, 3, 6, 6, + 9, 9,11,11,13,13,14,14,18,17, 3, 6, 6, 9, 9,11, + 11,13,13,14,14,17,18, 7, 9, 9,11,11,13,13,14,14, + 15,15, 0, 0, 7, 9, 9,11,11,13,13,14,14,15,16,19, + 18,10,11,11,13,13,14,14,16,15,17,18, 0, 0,10,11, + 11,13,13,14,14,15,15,16,18, 0, 0,11,13,13,14,14, + 15,15,17,17, 0,19, 0, 0,11,13,13,14,14,14,15,16, + 18, 0,19, 0, 0,13,14,14,15,15,18,17,18,18, 0,19, + 0, 0,13,14,14,15,16,16,16,18,18,19, 0, 0, 0,16, + 17,17, 0,17,19,19, 0,19, 0, 0, 0, 0,16,19,16,17, + 18, 0,19, 0, 0, 0, 0, 0, 0, +}; + +static float _vq_quantthresh__16u0__p6_0[] = { + -27.5, -22.5, -17.5, -12.5, -7.5, -2.5, 2.5, 7.5, + 12.5, 17.5, 22.5, 27.5, +}; + +static long _vq_quantmap__16u0__p6_0[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__16u0__p6_0 = { + _vq_quantthresh__16u0__p6_0, + _vq_quantmap__16u0__p6_0, + 13, + 13 +}; + +static static_codebook _16u0__p6_0 = { + 2, 169, + _vq_lengthlist__16u0__p6_0, + 1, -526516224, 1616117760, 4, 0, + _vq_quantlist__16u0__p6_0, + NULL, + &_vq_auxt__16u0__p6_0, + NULL, + 0 +}; + +static long _vq_quantlist__16u0__p6_1[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__16u0__p6_1[] = { + 1, 4, 5, 6, 6, 4, 6, 6, 6, 6, 4, 6, 6, 6, 6, 6, + 6, 6, 7, 7, 6, 6, 6, 7, 7, +}; + +static float _vq_quantthresh__16u0__p6_1[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__16u0__p6_1[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__16u0__p6_1 = { + _vq_quantthresh__16u0__p6_1, + _vq_quantmap__16u0__p6_1, + 5, + 5 +}; + +static static_codebook _16u0__p6_1 = { + 2, 25, + _vq_lengthlist__16u0__p6_1, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__16u0__p6_1, + NULL, + &_vq_auxt__16u0__p6_1, + NULL, + 0 +}; + +static long _vq_quantlist__16u0__p7_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__16u0__p7_0[] = { + 1, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, +}; + +static float _vq_quantthresh__16u0__p7_0[] = { + -157.5, 157.5, +}; + +static long _vq_quantmap__16u0__p7_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__16u0__p7_0 = { + _vq_quantthresh__16u0__p7_0, + _vq_quantmap__16u0__p7_0, + 3, + 3 +}; + +static static_codebook _16u0__p7_0 = { + 4, 81, + _vq_lengthlist__16u0__p7_0, + 1, -518803456, 1628680192, 2, 0, + _vq_quantlist__16u0__p7_0, + NULL, + &_vq_auxt__16u0__p7_0, + NULL, + 0 +}; + +static long _vq_quantlist__16u0__p7_1[] = { + 7, + 6, + 8, + 5, + 9, + 4, + 10, + 3, + 11, + 2, + 12, + 1, + 13, + 0, + 14, +}; + +static long _vq_lengthlist__16u0__p7_1[] = { + 1, 5, 5, 6, 5, 9,10,11,11,10,10,10,10,10,10, 5, + 8, 8, 8,10,10,10,10,10,10,10,10,10,10,10, 5, 8, + 9, 9, 9,10,10,10,10,10,10,10,10,10,10, 5,10, 8, + 10,10,10,10,10,10,10,10,10,10,10,10, 4, 8, 9,10, + 10,10,10,10,10,10,10,10,10,10,10, 9,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10, 9,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10, +}; + +static float _vq_quantthresh__16u0__p7_1[] = { + -136.5, -115.5, -94.5, -73.5, -52.5, -31.5, -10.5, 10.5, + 31.5, 52.5, 73.5, 94.5, 115.5, 136.5, +}; + +static long _vq_quantmap__16u0__p7_1[] = { + 13, 11, 9, 7, 5, 3, 1, 0, + 2, 4, 6, 8, 10, 12, 14, +}; + +static encode_aux_threshmatch _vq_auxt__16u0__p7_1 = { + _vq_quantthresh__16u0__p7_1, + _vq_quantmap__16u0__p7_1, + 15, + 15 +}; + +static static_codebook _16u0__p7_1 = { + 2, 225, + _vq_lengthlist__16u0__p7_1, + 1, -520986624, 1620377600, 4, 0, + _vq_quantlist__16u0__p7_1, + NULL, + &_vq_auxt__16u0__p7_1, + NULL, + 0 +}; + +static long _vq_quantlist__16u0__p7_2[] = { + 10, + 9, + 11, + 8, + 12, + 7, + 13, + 6, + 14, + 5, + 15, + 4, + 16, + 3, + 17, + 2, + 18, + 1, + 19, + 0, + 20, +}; + +static long _vq_lengthlist__16u0__p7_2[] = { + 1, 6, 6, 7, 8, 7, 7,10, 9,10, 9,11,10, 9,11,10, + 9, 9, 9, 9,10, 6, 8, 7, 9, 9, 8, 8,10,10, 9,11, + 11,12,12,10, 9,11, 9,12,10, 9, 6, 9, 8, 9,12, 8, + 8,11, 9,11,11,12,11,12,12,10,11,11,10,10,11, 7, + 10, 9, 9, 9, 9, 9,10, 9,10, 9,10,10,12,10,10,10, + 11,12,10,10, 7, 9, 9, 9,10, 9, 9,10,10, 9, 9, 9, + 11,11,10,10,10,10, 9, 9,12, 7, 9,10, 9,11, 9,10, + 9,10,11,11,11,10,11,12, 9,12,11,10,10,10, 7, 9, + 9, 9, 9,10,12,10, 9,11,12,10,11,12,12,11, 9,10, + 11,10,11, 7, 9,10,10,11,10, 9,10,11,11,11,10,12, + 12,12,11,11,10,11,11,12, 8, 9,10,12,11,10,10,12, + 12,12,12,12,10,11,11, 9,11,10,12,11,11, 8, 9,10, + 10,11,12,11,11,10,10,10,12,12,12, 9,10,12,12,12, + 12,12, 8,10,11,10,10,12, 9,11,12,12,11,12,12,12, + 12,10,12,10,10,10,10, 8,12,11,11,11,10,10,11,12, + 12,12,12,11,12,12,12,11,11,11,12,10, 9,10,10,12, + 10,12,10,12,12,10,10,10,11,12,12,12,11,12,12,12, + 11,10,11,12,12,12,11,12,12,11,12,12,11,12,12,12, + 12,11,12,12,10,10,10,10,11,11,12,11,12,12,12,12, + 12,12,12,11,12,11,10,11,11,12,11,11, 9,10,10,10, + 12,10,10,11, 9,11,12,11,12,11,12,12,10,11,10,12, + 9, 9, 9,12,11,10,11,10,12,10,12,10,12,12,12,11, + 11,11,11,11,10, 9,10,10,11,10,11,11,12,11,10,11, + 12,12,12,11,11, 9,12,10,12, 9,10,12,10,10,11,10, + 11,11,12,11,10,11,10,11,11,11,11,12,11,11,10, 9, + 10,10,10, 9,11,11,10, 9,12,10,11,12,11,12,12,11, + 12,11,12,11,10,11,10,12,11,12,11,12,11,12,10,11, + 10,10,12,11,10,11,11,11,10, +}; + +static float _vq_quantthresh__16u0__p7_2[] = { + -9.5, -8.5, -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, + -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, + 6.5, 7.5, 8.5, 9.5, +}; + +static long _vq_quantmap__16u0__p7_2[] = { + 19, 17, 15, 13, 11, 9, 7, 5, + 3, 1, 0, 2, 4, 6, 8, 10, + 12, 14, 16, 18, 20, +}; + +static encode_aux_threshmatch _vq_auxt__16u0__p7_2 = { + _vq_quantthresh__16u0__p7_2, + _vq_quantmap__16u0__p7_2, + 21, + 21 +}; + +static static_codebook _16u0__p7_2 = { + 2, 441, + _vq_lengthlist__16u0__p7_2, + 1, -529268736, 1611661312, 5, 0, + _vq_quantlist__16u0__p7_2, + NULL, + &_vq_auxt__16u0__p7_2, + NULL, + 0 +}; + +static long _huff_lengthlist__16u0__single[] = { + 3, 5, 8, 7,14, 8, 9,19, 5, 2, 5, 5, 9, 6, 9,19, + 8, 4, 5, 7, 8, 9,13,19, 7, 4, 6, 5, 9, 6, 9,19, + 12, 8, 7, 9,10,11,13,19, 8, 5, 8, 6, 9, 6, 7,19, + 8, 8,10, 7, 7, 4, 5,19,12,17,19,15,18,13,11,18, +}; + +static static_codebook _huff_book__16u0__single = { + 2, 64, + _huff_lengthlist__16u0__single, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist__16u1__long[] = { + 3, 6,10, 8,12, 8,14, 8,14,19, 5, 3, 5, 5, 7, 6, + 11, 7,16,19, 7, 5, 6, 7, 7, 9,11,12,19,19, 6, 4, + 7, 5, 7, 6,10, 7,18,18, 8, 6, 7, 7, 7, 7, 8, 9, + 18,18, 7, 5, 8, 5, 7, 5, 8, 6,18,18,12, 9,10, 9, + 9, 9, 8, 9,18,18, 8, 7,10, 6, 8, 5, 6, 4,11,18, + 11,15,16,12,11, 8, 8, 6, 9,18,14,18,18,18,16,16, + 16,13,16,18, +}; + +static static_codebook _huff_book__16u1__long = { + 2, 100, + _huff_lengthlist__16u1__long, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _vq_quantlist__16u1__p1_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__16u1__p1_0[] = { + 1, 4, 4, 5, 7, 7, 5, 7, 7, 5, 8, 7, 7,10,10, 7, + 9,10, 5, 7, 8, 7,10, 9, 7,10,10, 5, 8, 8, 8,10, + 10, 8,10,10, 7,10,10,10,11,12,10,12,13, 7,10,10, + 9,13,11,10,12,13, 5, 8, 8, 8,10,10, 8,10,10, 7, + 10,10,10,12,12, 9,11,12, 7,10,11,10,12,12,10,13, + 11, +}; + +static float _vq_quantthresh__16u1__p1_0[] = { + -0.5, 0.5, +}; + +static long _vq_quantmap__16u1__p1_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__16u1__p1_0 = { + _vq_quantthresh__16u1__p1_0, + _vq_quantmap__16u1__p1_0, + 3, + 3 +}; + +static static_codebook _16u1__p1_0 = { + 4, 81, + _vq_lengthlist__16u1__p1_0, + 1, -535822336, 1611661312, 2, 0, + _vq_quantlist__16u1__p1_0, + NULL, + &_vq_auxt__16u1__p1_0, + NULL, + 0 +}; + +static long _vq_quantlist__16u1__p2_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__16u1__p2_0[] = { + 3, 4, 4, 5, 6, 6, 5, 6, 6, 5, 6, 6, 6, 7, 8, 6, + 7, 8, 5, 6, 6, 6, 8, 7, 6, 8, 7, 5, 6, 6, 6, 8, + 8, 6, 8, 8, 6, 8, 8, 7, 7,10, 8, 9, 9, 6, 8, 8, + 7, 9, 8, 8, 9,10, 5, 6, 6, 6, 8, 8, 7, 8, 8, 6, + 8, 8, 8,10, 9, 7, 8, 9, 6, 8, 8, 8, 9, 9, 7,10, + 8, +}; + +static float _vq_quantthresh__16u1__p2_0[] = { + -0.5, 0.5, +}; + +static long _vq_quantmap__16u1__p2_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__16u1__p2_0 = { + _vq_quantthresh__16u1__p2_0, + _vq_quantmap__16u1__p2_0, + 3, + 3 +}; + +static static_codebook _16u1__p2_0 = { + 4, 81, + _vq_lengthlist__16u1__p2_0, + 1, -535822336, 1611661312, 2, 0, + _vq_quantlist__16u1__p2_0, + NULL, + &_vq_auxt__16u1__p2_0, + NULL, + 0 +}; + +static long _vq_quantlist__16u1__p3_0[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__16u1__p3_0[] = { + 1, 5, 5, 8, 8, 6, 7, 7, 9, 9, 5, 7, 7, 9, 9, 9, + 10, 9,11,11, 9, 9,10,11,11, 6, 8, 8,10,10, 8, 9, + 10,11,11, 8, 9,10,11,11,10,11,11,12,13,10,11,11, + 13,13, 6, 8, 8,10,10, 8,10, 9,11,11, 8,10, 9,11, + 11,10,11,11,13,13,10,11,11,13,12, 9,11,11,14,13, + 10,12,12,15,14,10,12,11,14,13,12,13,13,15,15,12, + 13,13,16,14, 9,11,11,13,14,10,11,12,14,14,10,12, + 12,14,15,12,13,13,14,15,12,13,14,15,16, 5, 8, 8, + 11,11, 8,10,10,12,12, 8,10,10,12,12,11,12,12,14, + 14,11,12,12,14,14, 8,10,10,12,12, 9,11,12,12,13, + 10,12,12,13,13,12,12,13,14,15,11,13,13,15,15, 7, + 10,10,12,12, 9,12,11,13,12,10,11,12,13,13,12,13, + 12,15,14,11,12,13,15,15,10,12,12,15,14,11,13,13, + 16,15,11,13,13,16,15,14,13,14,15,16,13,15,15,17, + 17,10,12,12,14,15,11,12,12,15,15,11,13,13,15,16, + 13,15,13,16,15,13,15,15,16,17, 5, 8, 8,11,11, 8, + 10,10,12,12, 8,10,10,12,12,11,12,12,14,14,11,12, + 12,14,14, 7,10,10,12,12,10,12,12,14,13, 9,11,12, + 12,13,12,13,13,15,15,12,12,13,13,15, 7,10,10,12, + 13,10,11,12,13,13,10,12,11,13,13,11,13,13,15,15, + 12,13,12,15,14, 9,12,12,15,14,11,13,13,15,15,11, + 12,13,15,15,13,14,14,17,19,13,13,14,16,16,10,12, + 12,14,15,11,13,13,15,16,11,13,12,16,15,13,15,15, + 17,18,14,15,13,16,15, 8,11,11,15,14,10,12,12,16, + 15,10,12,12,16,16,14,15,15,18,17,13,14,15,16,18, + 9,12,12,15,15,11,12,14,16,17,11,13,13,16,15,15, + 15,15,17,18,14,15,16,17,17, 9,12,12,15,15,11,14, + 13,16,16,11,13,13,16,16,15,16,15,17,18,14,16,15, + 17,16,12,14,14,17,16,12,14,15,18,17,13,15,15,17, + 17,15,15,18,16,20,15,16,17,18,18,11,14,14,16,17, + 13,15,14,18,17,13,15,15,17,17,15,17,15,18,17,15, + 17,16,19,18, 8,11,11,14,15,10,12,12,15,15,10,12, + 12,16,16,13,14,14,17,16,14,15,15,17,17, 9,12,12, + 15,16,11,13,13,16,16,11,12,13,16,16,14,16,15,20, + 17,14,16,16,17,17, 9,12,12,15,16,11,13,13,16,17, + 11,13,13,17,16,14,15,15,17,18,15,15,15,18,18,11, + 14,14,17,16,13,15,15,17,17,13,14,14,18,17,15,16, + 16,18,19,15,15,17,17,19,11,14,14,16,17,13,15,14, + 17,19,13,15,14,18,17,15,17,16,18,18,15,17,15,18, + 16, +}; + +static float _vq_quantthresh__16u1__p3_0[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__16u1__p3_0[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__16u1__p3_0 = { + _vq_quantthresh__16u1__p3_0, + _vq_quantmap__16u1__p3_0, + 5, + 5 +}; + +static static_codebook _16u1__p3_0 = { + 4, 625, + _vq_lengthlist__16u1__p3_0, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__16u1__p3_0, + NULL, + &_vq_auxt__16u1__p3_0, + NULL, + 0 +}; + +static long _vq_quantlist__16u1__p4_0[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__16u1__p4_0[] = { + 4, 5, 5, 8, 8, 6, 6, 7, 9, 9, 6, 6, 6, 9, 9, 9, + 10, 9,11,11, 9, 9,10,11,11, 6, 7, 7,10, 9, 7, 7, + 8, 9,10, 7, 7, 8,10,10,10,10,10,10,12, 9, 9,10, + 11,12, 6, 7, 7, 9, 9, 7, 8, 7,10,10, 7, 8, 7,10, + 10, 9,10, 9,12,11,10,10, 9,12,10, 9,10,10,12,11, + 10,10,10,12,12, 9,10,10,12,12,12,11,12,13,13,11, + 11,12,12,13, 9,10,10,11,12, 9,10,10,12,12,10,10, + 10,12,12,11,12,11,14,13,11,12,12,14,13, 5, 7, 7, + 10,10, 7, 8, 8,10,10, 7, 8, 7,10,10,10,10,10,12, + 12,10,10,10,12,12, 6, 8, 7,10,10, 7, 7, 9,10,11, + 8, 9, 9,11,10,10,10,11,11,13,10,10,11,12,13, 6, + 8, 8,10,10, 7, 9, 8,11,10, 8, 9, 9,10,11,10,11, + 10,13,11,10,11,10,12,12,10,11,10,12,11,10,10,10, + 12,13,10,11,11,13,12,11,11,13,11,14,12,12,13,14, + 14, 9,10,10,12,13,10,11,10,13,12,10,11,11,12,13, + 11,12,11,14,12,12,13,13,15,14, 5, 7, 7,10,10, 7, + 7, 8,10,10, 7, 8, 8,10,10,10,10,10,11,12,10,10, + 10,12,12, 7, 8, 8,10,10, 8, 9, 8,11,10, 7, 8, 9, + 10,11,10,11,11,12,12,10,10,11,11,13, 7, 7, 8,10, + 10, 8, 8, 9,10,11, 7, 9, 7,11,10,10,11,11,13,12, + 11,11,10,13,11, 9,10,10,12,12,10,11,11,13,12,10, + 10,11,12,12,12,13,13,14,14,11,11,12,12,14,10,10, + 11,12,12,10,11,11,12,13,10,10,10,13,12,12,13,13, + 15,14,12,13,10,14,11, 8,10,10,12,12,10,11,10,13, + 13, 9,10,10,12,12,12,13,13,15,14,11,12,12,13,13, + 9,10,10,13,12,10,10,11,13,13,10,11,10,13,12,12, + 12,13,14,15,12,13,12,15,13, 9,10,10,12,13,10,11, + 10,13,12,10,10,11,12,13,12,14,12,15,13,12,12,13, + 14,15,11,12,11,14,13,11,11,12,14,15,12,13,12,15, + 14,13,11,15,11,16,13,14,14,16,15,11,12,12,14,14, + 11,12,11,14,13,12,12,13,14,15,13,14,12,16,12,14, + 14,14,15,15, 8,10,10,12,12, 9,10,10,12,12,10,10, + 11,13,13,11,12,12,13,13,12,13,13,14,15, 9,10,10, + 13,12,10,11,11,13,12,10,10,11,13,13,12,13,12,15, + 14,12,12,13,13,16, 9, 9,10,12,13,10,10,11,12,13, + 10,11,10,13,13,12,12,13,13,15,13,13,12,15,13,11, + 12,12,14,14,12,13,12,15,14,11,11,12,13,14,14,14, + 14,16,15,13,12,15,12,16,11,11,12,13,14,12,13,13, + 14,15,10,12,11,14,13,14,15,14,16,16,13,14,11,15, + 11, +}; + +static float _vq_quantthresh__16u1__p4_0[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__16u1__p4_0[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__16u1__p4_0 = { + _vq_quantthresh__16u1__p4_0, + _vq_quantmap__16u1__p4_0, + 5, + 5 +}; + +static static_codebook _16u1__p4_0 = { + 4, 625, + _vq_lengthlist__16u1__p4_0, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__16u1__p4_0, + NULL, + &_vq_auxt__16u1__p4_0, + NULL, + 0 +}; + +static long _vq_quantlist__16u1__p5_0[] = { + 4, + 3, + 5, + 2, + 6, + 1, + 7, + 0, + 8, +}; + +static long _vq_lengthlist__16u1__p5_0[] = { + 1, 4, 4, 7, 7, 7, 7, 9, 9, 4, 6, 6, 8, 8, 8, 8, + 10,10, 4, 5, 6, 8, 8, 8, 8,10,10, 7, 8, 8, 9, 9, + 9, 9,11,11, 7, 8, 8, 9, 9, 9, 9,11,11, 7, 8, 8, + 10, 9,11,11,12,11, 7, 8, 8, 9, 9,11,11,12,12, 9, + 10,10,11,11,12,12,13,12, 9,10,10,11,11,12,12,12, + 13, +}; + +static float _vq_quantthresh__16u1__p5_0[] = { + -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, +}; + +static long _vq_quantmap__16u1__p5_0[] = { + 7, 5, 3, 1, 0, 2, 4, 6, + 8, +}; + +static encode_aux_threshmatch _vq_auxt__16u1__p5_0 = { + _vq_quantthresh__16u1__p5_0, + _vq_quantmap__16u1__p5_0, + 9, + 9 +}; + +static static_codebook _16u1__p5_0 = { + 2, 81, + _vq_lengthlist__16u1__p5_0, + 1, -531628032, 1611661312, 4, 0, + _vq_quantlist__16u1__p5_0, + NULL, + &_vq_auxt__16u1__p5_0, + NULL, + 0 +}; + +static long _vq_quantlist__16u1__p6_0[] = { + 4, + 3, + 5, + 2, + 6, + 1, + 7, + 0, + 8, +}; + +static long _vq_lengthlist__16u1__p6_0[] = { + 3, 4, 4, 6, 6, 7, 7, 9, 9, 4, 4, 4, 6, 6, 8, 8, + 9, 9, 4, 4, 4, 6, 6, 7, 7, 9, 9, 6, 6, 6, 7, 7, + 8, 8,10, 9, 6, 6, 6, 7, 7, 8, 8, 9,10, 7, 8, 7, + 8, 8, 9, 9,10,10, 7, 8, 8, 8, 8, 9, 9,10,10, 9, + 9, 9,10,10,10,10,11,11, 9, 9, 9,10,10,10,10,11, + 11, +}; + +static float _vq_quantthresh__16u1__p6_0[] = { + -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, +}; + +static long _vq_quantmap__16u1__p6_0[] = { + 7, 5, 3, 1, 0, 2, 4, 6, + 8, +}; + +static encode_aux_threshmatch _vq_auxt__16u1__p6_0 = { + _vq_quantthresh__16u1__p6_0, + _vq_quantmap__16u1__p6_0, + 9, + 9 +}; + +static static_codebook _16u1__p6_0 = { + 2, 81, + _vq_lengthlist__16u1__p6_0, + 1, -531628032, 1611661312, 4, 0, + _vq_quantlist__16u1__p6_0, + NULL, + &_vq_auxt__16u1__p6_0, + NULL, + 0 +}; + +static long _vq_quantlist__16u1__p7_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__16u1__p7_0[] = { + 1, 4, 4, 4, 8, 8, 4, 8, 8, 5,11, 9, 8,12,11, 8, + 12,11, 5,10,11, 8,11,12, 8,11,12, 4,11,11,11,14, + 13,10,13,13, 8,14,13,12,14,16,12,16,15, 8,14,14, + 13,16,14,12,15,16, 4,11,11,10,14,13,11,14,14, 8, + 15,14,12,15,15,12,14,16, 8,14,14,11,16,15,12,15, + 13, +}; + +static float _vq_quantthresh__16u1__p7_0[] = { + -5.5, 5.5, +}; + +static long _vq_quantmap__16u1__p7_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__16u1__p7_0 = { + _vq_quantthresh__16u1__p7_0, + _vq_quantmap__16u1__p7_0, + 3, + 3 +}; + +static static_codebook _16u1__p7_0 = { + 4, 81, + _vq_lengthlist__16u1__p7_0, + 1, -529137664, 1618345984, 2, 0, + _vq_quantlist__16u1__p7_0, + NULL, + &_vq_auxt__16u1__p7_0, + NULL, + 0 +}; + +static long _vq_quantlist__16u1__p7_1[] = { + 5, + 4, + 6, + 3, + 7, + 2, + 8, + 1, + 9, + 0, + 10, +}; + +static long _vq_lengthlist__16u1__p7_1[] = { + 2, 4, 4, 6, 6, 7, 7, 8, 8, 8, 8, 4, 6, 5, 7, 7, + 8, 8, 8, 8, 8, 8, 4, 5, 6, 7, 7, 8, 8, 8, 8, 8, + 8, 6, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 6, 7, 7, 8, + 8, 8, 8, 9, 9, 9, 9, 7, 8, 8, 8, 8, 9, 9, 9,10, + 9,10, 7, 8, 8, 8, 8, 9, 9, 9, 9,10, 9, 8, 8, 8, + 9, 9,10,10,10,10,10,10, 8, 8, 8, 9, 9, 9, 9,10, + 10,10,10, 8, 8, 8, 9, 9, 9,10,10,10,10,10, 8, 8, + 8, 9, 9,10,10,10,10,10,10, +}; + +static float _vq_quantthresh__16u1__p7_1[] = { + -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, + 3.5, 4.5, +}; + +static long _vq_quantmap__16u1__p7_1[] = { + 9, 7, 5, 3, 1, 0, 2, 4, + 6, 8, 10, +}; + +static encode_aux_threshmatch _vq_auxt__16u1__p7_1 = { + _vq_quantthresh__16u1__p7_1, + _vq_quantmap__16u1__p7_1, + 11, + 11 +}; + +static static_codebook _16u1__p7_1 = { + 2, 121, + _vq_lengthlist__16u1__p7_1, + 1, -531365888, 1611661312, 4, 0, + _vq_quantlist__16u1__p7_1, + NULL, + &_vq_auxt__16u1__p7_1, + NULL, + 0 +}; + +static long _vq_quantlist__16u1__p8_0[] = { + 5, + 4, + 6, + 3, + 7, + 2, + 8, + 1, + 9, + 0, + 10, +}; + +static long _vq_lengthlist__16u1__p8_0[] = { + 1, 4, 4, 5, 5, 8, 8,10,10,12,12, 4, 7, 7, 8, 8, + 9, 9,12,11,14,13, 4, 7, 7, 7, 8, 9,10,11,11,13, + 12, 5, 8, 8, 9, 9,11,11,12,13,15,14, 5, 7, 8, 9, + 9,11,11,13,13,17,15, 8, 9,10,11,11,12,13,17,14, + 17,16, 8,10, 9,11,11,12,12,13,15,15,17,10,11,11, + 12,13,14,15,15,16,16,17, 9,11,11,12,12,14,15,17, + 15,15,16,11,14,12,14,15,16,15,16,16,16,15,11,13, + 13,14,14,15,15,16,16,15,16, +}; + +static float _vq_quantthresh__16u1__p8_0[] = { + -49.5, -38.5, -27.5, -16.5, -5.5, 5.5, 16.5, 27.5, + 38.5, 49.5, +}; + +static long _vq_quantmap__16u1__p8_0[] = { + 9, 7, 5, 3, 1, 0, 2, 4, + 6, 8, 10, +}; + +static encode_aux_threshmatch _vq_auxt__16u1__p8_0 = { + _vq_quantthresh__16u1__p8_0, + _vq_quantmap__16u1__p8_0, + 11, + 11 +}; + +static static_codebook _16u1__p8_0 = { + 2, 121, + _vq_lengthlist__16u1__p8_0, + 1, -524582912, 1618345984, 4, 0, + _vq_quantlist__16u1__p8_0, + NULL, + &_vq_auxt__16u1__p8_0, + NULL, + 0 +}; + +static long _vq_quantlist__16u1__p8_1[] = { + 5, + 4, + 6, + 3, + 7, + 2, + 8, + 1, + 9, + 0, + 10, +}; + +static long _vq_lengthlist__16u1__p8_1[] = { + 2, 5, 5, 6, 6, 7, 7, 8, 8, 8, 8, 4, 6, 6, 7, 7, + 8, 7, 8, 8, 8, 8, 4, 6, 6, 7, 7, 7, 7, 8, 8, 8, + 8, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8, 9, 6, 7, 7, 7, + 7, 8, 8, 8, 8, 9, 9, 7, 7, 7, 8, 8, 8, 8, 9, 9, + 9, 9, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 8, 8, 8, + 8, 8, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 9, 9, 9, + 9, 9, 9, 8, 8, 8, 9, 8, 9, 9, 9, 9, 9, 9, 8, 8, + 8, 9, 9, 9, 9, 9, 9, 9, 9, +}; + +static float _vq_quantthresh__16u1__p8_1[] = { + -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, + 3.5, 4.5, +}; + +static long _vq_quantmap__16u1__p8_1[] = { + 9, 7, 5, 3, 1, 0, 2, 4, + 6, 8, 10, +}; + +static encode_aux_threshmatch _vq_auxt__16u1__p8_1 = { + _vq_quantthresh__16u1__p8_1, + _vq_quantmap__16u1__p8_1, + 11, + 11 +}; + +static static_codebook _16u1__p8_1 = { + 2, 121, + _vq_lengthlist__16u1__p8_1, + 1, -531365888, 1611661312, 4, 0, + _vq_quantlist__16u1__p8_1, + NULL, + &_vq_auxt__16u1__p8_1, + NULL, + 0 +}; + +static long _vq_quantlist__16u1__p9_0[] = { + 7, + 6, + 8, + 5, + 9, + 4, + 10, + 3, + 11, + 2, + 12, + 1, + 13, + 0, + 14, +}; + +static long _vq_lengthlist__16u1__p9_0[] = { + 1, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, +}; + +static float _vq_quantthresh__16u1__p9_0[] = { + -1657.5, -1402.5, -1147.5, -892.5, -637.5, -382.5, -127.5, 127.5, + 382.5, 637.5, 892.5, 1147.5, 1402.5, 1657.5, +}; + +static long _vq_quantmap__16u1__p9_0[] = { + 13, 11, 9, 7, 5, 3, 1, 0, + 2, 4, 6, 8, 10, 12, 14, +}; + +static encode_aux_threshmatch _vq_auxt__16u1__p9_0 = { + _vq_quantthresh__16u1__p9_0, + _vq_quantmap__16u1__p9_0, + 15, + 15 +}; + +static static_codebook _16u1__p9_0 = { + 2, 225, + _vq_lengthlist__16u1__p9_0, + 1, -514071552, 1627381760, 4, 0, + _vq_quantlist__16u1__p9_0, + NULL, + &_vq_auxt__16u1__p9_0, + NULL, + 0 +}; + +static long _vq_quantlist__16u1__p9_1[] = { + 7, + 6, + 8, + 5, + 9, + 4, + 10, + 3, + 11, + 2, + 12, + 1, + 13, + 0, + 14, +}; + +static long _vq_lengthlist__16u1__p9_1[] = { + 1, 6, 5, 9, 9,10,10, 6, 7, 9, 9,10,10,10,10, 5, + 10, 8,10, 8,10,10, 8, 8,10, 9,10,10,10,10, 5, 8, + 9,10,10,10,10, 8,10,10,10,10,10,10,10, 9,10,10, + 10,10,10,10, 9, 9,10,10,10,10,10,10, 9, 9, 8, 9, + 10,10,10, 9,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10, 8,10,10,10,10, + 10,10,10,10,10,10,10,10,10, 6, 8, 8,10,10,10, 8, + 10,10,10,10,10,10,10,10, 5, 8, 8,10,10,10, 9, 9, + 10,10,10,10,10,10,10,10, 9,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, +}; + +static float _vq_quantthresh__16u1__p9_1[] = { + -110.5, -93.5, -76.5, -59.5, -42.5, -25.5, -8.5, 8.5, + 25.5, 42.5, 59.5, 76.5, 93.5, 110.5, +}; + +static long _vq_quantmap__16u1__p9_1[] = { + 13, 11, 9, 7, 5, 3, 1, 0, + 2, 4, 6, 8, 10, 12, 14, +}; + +static encode_aux_threshmatch _vq_auxt__16u1__p9_1 = { + _vq_quantthresh__16u1__p9_1, + _vq_quantmap__16u1__p9_1, + 15, + 15 +}; + +static static_codebook _16u1__p9_1 = { + 2, 225, + _vq_lengthlist__16u1__p9_1, + 1, -522338304, 1620115456, 4, 0, + _vq_quantlist__16u1__p9_1, + NULL, + &_vq_auxt__16u1__p9_1, + NULL, + 0 +}; + +static long _vq_quantlist__16u1__p9_2[] = { + 8, + 7, + 9, + 6, + 10, + 5, + 11, + 4, + 12, + 3, + 13, + 2, + 14, + 1, + 15, + 0, + 16, +}; + +static long _vq_lengthlist__16u1__p9_2[] = { + 1, 6, 6, 7, 8, 8,11,10, 9, 9,11, 9,10, 9,11,11, + 9, 6, 7, 6,11, 8,11, 9,10,10,11, 9,11,10,10,10, + 11, 9, 5, 7, 7, 8, 8,10,11, 8, 8,11, 9, 9,10,11, + 9,10,11, 8, 9, 6, 8, 8, 9, 9,10,10,11,11,11, 9, + 11,10, 9,11, 8, 8, 8, 9, 8, 9,10,11, 9, 9,11,11, + 10, 9, 9,11,10, 8,11, 8, 9, 8,11, 9,10, 9,10,11, + 11,10,10, 9,10,10, 8, 8, 9,10,10,10, 9,11, 9,10, + 11,11,11,11,10, 9,11, 9, 9,11,11,10, 8,11,11,11, + 9,10,10,11,10,11,11, 9,11,10, 9,11,10,10,10,10, + 9,11,10,11,10, 9, 9,10,11, 9, 8,10,11,11,10,10, + 11, 9,11,10,11,11,10,11, 9, 9, 8,10, 8, 9,11, 9, + 8,10,10, 9,11,10,11,10,11, 9,11, 8,10,11,11,11, + 11,10,10,11,11,11,11,10,11,11,10, 9, 8,10,10, 9, + 11,10,11,11,11, 9, 9, 9,11,11,11,10,10, 9, 9,10, + 9,11,11,11,11, 8,10,11,10,11,11,10,11,11, 9, 9, + 9,10, 9,11, 9,11,11,11,11,11,10,11,11,10,11,10, + 11,11, 9,11,10,11,10, 9,10, 9,10,10,11,11,11,11, + 9,10, 9,10,11,11,10,11,11,11,11,11,11,10,11,11, + 10, +}; + +static float _vq_quantthresh__16u1__p9_2[] = { + -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, + 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, +}; + +static long _vq_quantmap__16u1__p9_2[] = { + 15, 13, 11, 9, 7, 5, 3, 1, + 0, 2, 4, 6, 8, 10, 12, 14, + 16, +}; + +static encode_aux_threshmatch _vq_auxt__16u1__p9_2 = { + _vq_quantthresh__16u1__p9_2, + _vq_quantmap__16u1__p9_2, + 17, + 17 +}; + +static static_codebook _16u1__p9_2 = { + 2, 289, + _vq_lengthlist__16u1__p9_2, + 1, -529530880, 1611661312, 5, 0, + _vq_quantlist__16u1__p9_2, + NULL, + &_vq_auxt__16u1__p9_2, + NULL, + 0 +}; + +static long _huff_lengthlist__16u1__short[] = { + 5, 7,10, 9,11,10,15,11,13,16, 6, 4, 6, 6, 7, 7, + 10, 9,12,16,10, 6, 5, 6, 6, 7,10,11,16,16, 9, 6, + 7, 6, 7, 7,10, 8,14,16,11, 6, 5, 4, 5, 6, 8, 9, + 15,16, 9, 6, 6, 5, 6, 6, 9, 8,14,16,12, 7, 6, 6, + 5, 6, 6, 7,13,16, 8, 6, 7, 6, 5, 5, 4, 4,11,16, + 9, 8, 9, 9, 7, 7, 6, 5,13,16,14,14,16,15,16,15, + 16,16,16,16, +}; + +static static_codebook _huff_book__16u1__short = { + 2, 100, + _huff_lengthlist__16u1__short, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist__16u2__long[] = { + 5, 7,10,10,10,11,11,13,18,19, 6, 5, 5, 6, 7, 8, + 9,12,19,19, 8, 5, 4, 4, 6, 7, 9,13,19,19, 8, 5, + 4, 4, 5, 6, 8,12,17,19, 7, 5, 5, 4, 4, 5, 7,12, + 18,18, 8, 7, 7, 6, 5, 5, 6,10,18,18, 9, 9, 9, 8, + 6, 5, 6, 9,18,18,11,13,13,13, 8, 7, 7, 9,16,18, + 13,17,18,16,11, 9, 9, 9,17,18,15,18,18,18,15,13, + 13,14,18,18, +}; + +static static_codebook _huff_book__16u2__long = { + 2, 100, + _huff_lengthlist__16u2__long, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist__16u2__short[] = { + 8,11,12,12,14,15,16,16,16,16, 9, 7, 7, 8, 9,11, + 13,14,16,16,13, 7, 6, 6, 7, 9,12,13,15,16,15, 7, + 6, 5, 4, 6,10,11,14,16,12, 8, 7, 4, 2, 4, 7,10, + 14,16,11, 9, 7, 5, 3, 4, 6, 9,14,16,11,10, 9, 7, + 5, 5, 6, 9,16,16,10,10, 9, 8, 6, 6, 7,10,16,16, + 11,11,11,10,10,10,11,14,16,16,16,14,14,13,14,16, + 16,16,16,16, +}; + +static static_codebook _huff_book__16u2__short = { + 2, 100, + _huff_lengthlist__16u2__short, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _vq_quantlist__16u2_p1_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__16u2_p1_0[] = { + 1, 5, 5, 5, 7, 7, 5, 7, 7, 5, 7, 7, 7, 9, 9, 7, + 9, 9, 5, 7, 7, 7, 9, 9, 7, 9, 9, 5, 7, 7, 8, 9, + 9, 7, 9, 9, 7, 9, 9, 9,10,10, 9,10,10, 7, 9, 9, + 9,10,10, 9,10,11, 5, 7, 8, 8, 9, 9, 8, 9, 9, 7, + 9, 9, 9,10,10, 9, 9,10, 7, 9, 9, 9,10,10, 9,11, + 10, +}; + +static float _vq_quantthresh__16u2_p1_0[] = { + -0.5, 0.5, +}; + +static long _vq_quantmap__16u2_p1_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__16u2_p1_0 = { + _vq_quantthresh__16u2_p1_0, + _vq_quantmap__16u2_p1_0, + 3, + 3 +}; + +static static_codebook _16u2_p1_0 = { + 4, 81, + _vq_lengthlist__16u2_p1_0, + 1, -535822336, 1611661312, 2, 0, + _vq_quantlist__16u2_p1_0, + NULL, + &_vq_auxt__16u2_p1_0, + NULL, + 0 +}; + +static long _vq_quantlist__16u2_p2_0[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__16u2_p2_0[] = { + 3, 5, 5, 8, 8, 5, 7, 7, 9, 9, 5, 7, 7, 9, 9, 9, + 10, 9,11,11, 9, 9, 9,11,11, 5, 7, 7, 9, 9, 7, 8, + 8,10,10, 7, 8, 8,10,10,10,10,10,12,12, 9,10,10, + 11,12, 5, 7, 7, 9, 9, 7, 8, 8,10,10, 7, 8, 8,10, + 10, 9,10,10,12,11,10,10,10,12,12, 9,10,10,12,12, + 10,11,10,13,12, 9,10,10,12,12,12,12,12,14,14,11, + 12,12,13,14, 9,10,10,12,12, 9,10,10,12,12,10,10, + 10,12,12,11,12,12,14,13,12,13,12,14,14, 5, 7, 7, + 9, 9, 7, 8, 8,10,10, 7, 8, 8,10,10,10,11,10,12, + 12,10,10,11,12,12, 7, 8, 8,10,10, 8, 9, 9,11,11, + 8, 9, 9,11,11,11,11,11,12,13,10,11,11,12,13, 7, + 8, 8,10,10, 8, 9, 8,11,10, 8, 9, 9,11,11,10,11, + 10,13,12,10,11,11,13,13, 9,11,10,13,13,10,11,11, + 13,13,10,11,11,13,13,12,12,13,13,15,12,12,13,14, + 15, 9,10,10,12,12,10,11,10,13,12,10,11,11,13,13, + 11,13,11,14,13,12,13,13,15,15, 5, 7, 7, 9, 9, 7, + 8, 8,10,10, 7, 8, 8,10,10,10,10,10,12,12,10,10, + 11,12,12, 7, 8, 8,10,10, 8, 9, 9,11,11, 8, 8, 9, + 10,11,10,11,11,13,13,10,10,11,12,13, 7, 8, 8,10, + 11, 8, 9, 9,11,11, 8, 9, 9,11,11,10,11,11,13,12, + 11,11,11,13,12, 9,10,10,12,12,10,11,11,13,13,10, + 10,11,12,13,12,13,13,15,14,11,11,13,12,14,10,10, + 11,13,13,10,11,11,13,13,10,11,11,13,13,12,13,13, + 14,14,12,13,12,14,13, 8,10, 9,12,12, 9,11,10,13, + 13, 9,10,10,12,13,12,13,13,14,14,12,12,13,14,14, + 9,11,10,13,13,10,11,11,13,13,10,11,11,13,13,12, + 13,13,15,15,13,13,13,14,15, 9,10,10,12,13,10,11, + 10,13,12,10,11,11,13,13,12,13,12,15,14,13,13,13, + 14,15,11,12,12,15,14,12,12,13,15,15,12,13,13,15, + 14,14,13,15,14,16,13,14,15,16,16,11,12,12,14,14, + 11,12,12,15,14,12,13,13,15,15,13,14,13,16,14,14, + 14,14,16,16, 8, 9, 9,12,12, 9,10,10,13,12, 9,10, + 10,13,13,12,12,12,14,14,12,12,13,15,15, 9,10,10, + 13,12,10,11,11,13,13,10,10,11,13,14,12,13,13,15, + 15,12,12,13,14,15, 9,10,10,13,13,10,11,11,13,13, + 10,11,11,13,13,12,13,13,14,14,13,14,13,15,14,11, + 12,12,14,14,12,13,13,15,14,11,12,12,14,15,14,14, + 14,16,15,13,12,14,14,16,11,12,13,14,15,12,13,13, + 14,16,12,13,12,15,14,13,15,14,16,16,14,15,13,16, + 13, +}; + +static float _vq_quantthresh__16u2_p2_0[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__16u2_p2_0[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__16u2_p2_0 = { + _vq_quantthresh__16u2_p2_0, + _vq_quantmap__16u2_p2_0, + 5, + 5 +}; + +static static_codebook _16u2_p2_0 = { + 4, 625, + _vq_lengthlist__16u2_p2_0, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__16u2_p2_0, + NULL, + &_vq_auxt__16u2_p2_0, + NULL, + 0 +}; + +static long _vq_quantlist__16u2_p3_0[] = { + 4, + 3, + 5, + 2, + 6, + 1, + 7, + 0, + 8, +}; + +static long _vq_lengthlist__16u2_p3_0[] = { + 2, 4, 4, 6, 6, 7, 7, 9, 9, 4, 5, 5, 6, 6, 8, 7, + 9, 9, 4, 5, 5, 6, 6, 7, 8, 9, 9, 6, 6, 6, 7, 7, + 8, 8,10,10, 6, 6, 6, 7, 7, 8, 8, 9,10, 7, 8, 7, + 8, 8, 9, 9,10,10, 7, 8, 8, 8, 8, 9, 9,10,10, 9, + 9, 9,10, 9,10,10,11,11, 9, 9, 9,10,10,10,10,11, + 11, +}; + +static float _vq_quantthresh__16u2_p3_0[] = { + -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, +}; + +static long _vq_quantmap__16u2_p3_0[] = { + 7, 5, 3, 1, 0, 2, 4, 6, + 8, +}; + +static encode_aux_threshmatch _vq_auxt__16u2_p3_0 = { + _vq_quantthresh__16u2_p3_0, + _vq_quantmap__16u2_p3_0, + 9, + 9 +}; + +static static_codebook _16u2_p3_0 = { + 2, 81, + _vq_lengthlist__16u2_p3_0, + 1, -531628032, 1611661312, 4, 0, + _vq_quantlist__16u2_p3_0, + NULL, + &_vq_auxt__16u2_p3_0, + NULL, + 0 +}; + +static long _vq_quantlist__16u2_p4_0[] = { + 8, + 7, + 9, + 6, + 10, + 5, + 11, + 4, + 12, + 3, + 13, + 2, + 14, + 1, + 15, + 0, + 16, +}; + +static long _vq_lengthlist__16u2_p4_0[] = { + 2, 4, 4, 6, 6, 7, 7, 8, 8, 9, 9,10,10,11,11,11, + 11, 5, 5, 5, 7, 7, 8, 8, 9, 9, 9, 9,10,10,11,11, + 12,11, 5, 5, 5, 7, 7, 8, 8, 9, 9, 9, 9,10,10,11, + 11,12,12, 6, 7, 7, 7, 7, 8, 8, 9, 9, 9, 9,10,10, + 11,11,12,12, 6, 7, 7, 7, 7, 8, 8, 9, 9, 9, 9,10, + 10,11,11,12,12, 7, 8, 8, 8, 8, 9, 9, 9, 9,10,10, + 11,11,12,12,12,12, 7, 8, 8, 8, 8, 9, 9, 9, 9,10, + 10,11,11,11,12,12,12, 9, 9, 9, 9, 9, 9,10,10,10, + 10,10,11,11,12,12,13,13, 8, 9, 9, 9, 9,10, 9,10, + 10,10,10,11,11,12,12,13,13, 9, 9, 9, 9, 9,10,10, + 10,10,11,11,11,12,12,12,13,13, 9, 9, 9, 9, 9,10, + 10,10,10,11,11,12,11,12,12,13,13,10,10,10,10,10, + 11,11,11,11,11,12,12,12,12,13,13,14,10,10,10,10, + 10,11,11,11,11,12,11,12,12,13,12,13,13,11,11,11, + 11,11,12,12,12,12,12,12,13,13,13,13,14,14,11,11, + 11,11,11,12,12,12,12,12,12,13,12,13,13,14,14,11, + 12,12,12,12,12,12,13,13,13,13,13,13,14,14,14,14, + 11,12,12,12,12,12,12,13,13,13,13,14,13,14,14,14, + 14, +}; + +static float _vq_quantthresh__16u2_p4_0[] = { + -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, + 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, +}; + +static long _vq_quantmap__16u2_p4_0[] = { + 15, 13, 11, 9, 7, 5, 3, 1, + 0, 2, 4, 6, 8, 10, 12, 14, + 16, +}; + +static encode_aux_threshmatch _vq_auxt__16u2_p4_0 = { + _vq_quantthresh__16u2_p4_0, + _vq_quantmap__16u2_p4_0, + 17, + 17 +}; + +static static_codebook _16u2_p4_0 = { + 2, 289, + _vq_lengthlist__16u2_p4_0, + 1, -529530880, 1611661312, 5, 0, + _vq_quantlist__16u2_p4_0, + NULL, + &_vq_auxt__16u2_p4_0, + NULL, + 0 +}; + +static long _vq_quantlist__16u2_p5_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__16u2_p5_0[] = { + 1, 4, 4, 5, 7, 7, 5, 7, 7, 5, 9, 8, 7,10, 9, 7, + 10, 9, 5, 8, 9, 7, 9,10, 7, 9,10, 4, 9, 9, 9,11, + 11, 8,11,11, 7,11,11,10,10,13,10,14,13, 7,11,11, + 10,13,11,10,13,14, 5, 9, 9, 8,11,11, 9,11,11, 7, + 11,11,10,14,13,10,12,14, 7,11,11,10,13,13,10,13, + 10, +}; + +static float _vq_quantthresh__16u2_p5_0[] = { + -5.5, 5.5, +}; + +static long _vq_quantmap__16u2_p5_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__16u2_p5_0 = { + _vq_quantthresh__16u2_p5_0, + _vq_quantmap__16u2_p5_0, + 3, + 3 +}; + +static static_codebook _16u2_p5_0 = { + 4, 81, + _vq_lengthlist__16u2_p5_0, + 1, -529137664, 1618345984, 2, 0, + _vq_quantlist__16u2_p5_0, + NULL, + &_vq_auxt__16u2_p5_0, + NULL, + 0 +}; + +static long _vq_quantlist__16u2_p5_1[] = { + 5, + 4, + 6, + 3, + 7, + 2, + 8, + 1, + 9, + 0, + 10, +}; + +static long _vq_lengthlist__16u2_p5_1[] = { + 2, 5, 5, 6, 6, 7, 7, 8, 8, 8, 8, 5, 5, 5, 7, 7, + 7, 7, 8, 8, 8, 8, 5, 5, 6, 7, 7, 7, 7, 8, 8, 8, + 8, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 6, 7, 7, 7, + 7, 8, 8, 8, 8, 8, 8, 7, 7, 7, 8, 8, 8, 8, 9, 9, + 9, 9, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 8, 8, 8, + 8, 8, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 9, 9, 9, + 9, 9, 9, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 8, 8, + 8, 8, 8, 9, 9, 9, 9, 9, 9, +}; + +static float _vq_quantthresh__16u2_p5_1[] = { + -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, + 3.5, 4.5, +}; + +static long _vq_quantmap__16u2_p5_1[] = { + 9, 7, 5, 3, 1, 0, 2, 4, + 6, 8, 10, +}; + +static encode_aux_threshmatch _vq_auxt__16u2_p5_1 = { + _vq_quantthresh__16u2_p5_1, + _vq_quantmap__16u2_p5_1, + 11, + 11 +}; + +static static_codebook _16u2_p5_1 = { + 2, 121, + _vq_lengthlist__16u2_p5_1, + 1, -531365888, 1611661312, 4, 0, + _vq_quantlist__16u2_p5_1, + NULL, + &_vq_auxt__16u2_p5_1, + NULL, + 0 +}; + +static long _vq_quantlist__16u2_p6_0[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__16u2_p6_0[] = { + 1, 4, 4, 7, 7, 8, 8, 8, 8, 9, 9,10,10, 4, 6, 6, + 8, 8, 9, 9, 9, 9,10,10,12,11, 4, 6, 6, 8, 8, 9, + 9, 9, 9,10,10,11,12, 7, 8, 8, 9, 9,10,10,10,10, + 12,12,13,12, 7, 8, 8, 9, 9,10,10,10,10,11,12,12, + 12, 8, 9, 9,10,10,11,11,11,11,12,12,13,13, 8, 9, + 9,10,10,11,11,11,11,12,13,13,13, 8, 9, 9,10,10, + 11,11,12,12,13,13,14,14, 8, 9, 9,10,10,11,11,12, + 12,13,13,14,14, 9,10,10,11,12,13,12,13,14,14,14, + 14,14, 9,10,10,11,12,12,13,13,13,14,14,14,14,10, + 11,11,12,12,13,13,14,14,15,15,15,15,10,11,11,12, + 12,13,13,14,14,14,14,15,15, +}; + +static float _vq_quantthresh__16u2_p6_0[] = { + -27.5, -22.5, -17.5, -12.5, -7.5, -2.5, 2.5, 7.5, + 12.5, 17.5, 22.5, 27.5, +}; + +static long _vq_quantmap__16u2_p6_0[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__16u2_p6_0 = { + _vq_quantthresh__16u2_p6_0, + _vq_quantmap__16u2_p6_0, + 13, + 13 +}; + +static static_codebook _16u2_p6_0 = { + 2, 169, + _vq_lengthlist__16u2_p6_0, + 1, -526516224, 1616117760, 4, 0, + _vq_quantlist__16u2_p6_0, + NULL, + &_vq_auxt__16u2_p6_0, + NULL, + 0 +}; + +static long _vq_quantlist__16u2_p6_1[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__16u2_p6_1[] = { + 2, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 6, 6, 5, 5, 5, 6, 6, +}; + +static float _vq_quantthresh__16u2_p6_1[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__16u2_p6_1[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__16u2_p6_1 = { + _vq_quantthresh__16u2_p6_1, + _vq_quantmap__16u2_p6_1, + 5, + 5 +}; + +static static_codebook _16u2_p6_1 = { + 2, 25, + _vq_lengthlist__16u2_p6_1, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__16u2_p6_1, + NULL, + &_vq_auxt__16u2_p6_1, + NULL, + 0 +}; + +static long _vq_quantlist__16u2_p7_0[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__16u2_p7_0[] = { + 1, 4, 4, 7, 7, 7, 7, 8, 8, 9, 9,10,10, 4, 6, 6, + 9, 9, 9, 9, 9, 9,10,10,11,11, 4, 6, 6, 8, 9, 9, + 9, 9, 9,10,11,12,11, 7, 8, 9,10,10,10,10,11,10, + 11,12,12,13, 7, 9, 9,10,10,10,10,10,10,11,12,13, + 13, 7, 9, 8,10,10,11,11,11,12,12,13,13,14, 7, 9, + 9,10,10,11,11,11,12,13,13,13,13, 8, 9, 9,10,11, + 11,12,12,12,13,13,13,13, 8, 9, 9,10,11,11,11,12, + 12,13,13,14,14, 9,10,10,12,11,12,13,13,13,14,13, + 13,13, 9,10,10,11,11,12,12,13,14,13,13,14,13,10, + 11,11,12,13,14,14,14,15,14,14,14,14,10,11,11,12, + 12,13,13,13,14,14,14,15,14, +}; + +static float _vq_quantthresh__16u2_p7_0[] = { + -60.5, -49.5, -38.5, -27.5, -16.5, -5.5, 5.5, 16.5, + 27.5, 38.5, 49.5, 60.5, +}; + +static long _vq_quantmap__16u2_p7_0[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__16u2_p7_0 = { + _vq_quantthresh__16u2_p7_0, + _vq_quantmap__16u2_p7_0, + 13, + 13 +}; + +static static_codebook _16u2_p7_0 = { + 2, 169, + _vq_lengthlist__16u2_p7_0, + 1, -523206656, 1618345984, 4, 0, + _vq_quantlist__16u2_p7_0, + NULL, + &_vq_auxt__16u2_p7_0, + NULL, + 0 +}; + +static long _vq_quantlist__16u2_p7_1[] = { + 5, + 4, + 6, + 3, + 7, + 2, + 8, + 1, + 9, + 0, + 10, +}; + +static long _vq_lengthlist__16u2_p7_1[] = { + 3, 5, 5, 6, 6, 7, 7, 7, 7, 7, 7, 5, 6, 6, 7, 7, + 7, 7, 7, 7, 8, 8, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, + 8, 6, 6, 7, 7, 7, 8, 7, 8, 8, 8, 8, 6, 7, 7, 7, + 7, 7, 7, 8, 8, 8, 8, 7, 7, 7, 7, 7, 8, 8, 8, 8, + 8, 8, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, + 8, 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 8, 8, 8, 8, 8, + 8, 8, 8, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 7, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, +}; + +static float _vq_quantthresh__16u2_p7_1[] = { + -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, + 3.5, 4.5, +}; + +static long _vq_quantmap__16u2_p7_1[] = { + 9, 7, 5, 3, 1, 0, 2, 4, + 6, 8, 10, +}; + +static encode_aux_threshmatch _vq_auxt__16u2_p7_1 = { + _vq_quantthresh__16u2_p7_1, + _vq_quantmap__16u2_p7_1, + 11, + 11 +}; + +static static_codebook _16u2_p7_1 = { + 2, 121, + _vq_lengthlist__16u2_p7_1, + 1, -531365888, 1611661312, 4, 0, + _vq_quantlist__16u2_p7_1, + NULL, + &_vq_auxt__16u2_p7_1, + NULL, + 0 +}; + +static long _vq_quantlist__16u2_p8_0[] = { + 7, + 6, + 8, + 5, + 9, + 4, + 10, + 3, + 11, + 2, + 12, + 1, + 13, + 0, + 14, +}; + +static long _vq_lengthlist__16u2_p8_0[] = { + 1, 5, 5, 7, 7, 8, 8, 7, 7, 8, 8,10, 9,11,11, 4, + 6, 6, 8, 8,10, 9, 9, 8, 9, 9,10,10,12,14, 4, 6, + 7, 8, 9, 9,10, 9, 8, 9, 9,10,12,12,11, 7, 8, 8, + 10,10,10,10, 9, 9,10,10,11,13,13,12, 7, 8, 8, 9, + 11,11,10, 9, 9,11,10,12,11,11,14, 8, 9, 9,11,10, + 11,11,10,10,11,11,13,12,14,12, 8, 9, 9,11,12,11, + 11,10,10,12,11,12,12,12,14, 7, 8, 8, 9, 9,10,10, + 10,11,12,11,13,13,14,12, 7, 8, 9, 9, 9,10,10,11, + 11,11,12,12,14,14,14, 8,10, 9,10,11,11,11,11,14, + 12,12,13,14,14,13, 9, 9, 9,10,11,11,11,12,12,12, + 14,12,14,13,14,10,10,10,12,11,12,11,14,13,14,13, + 14,14,13,14, 9,10,10,11,12,11,13,12,13,13,14,14, + 14,13,14,10,13,13,12,12,11,12,14,13,14,13,14,12, + 14,13,10,11,11,12,11,12,12,14,14,14,13,14,14,14, + 14, +}; + +static float _vq_quantthresh__16u2_p8_0[] = { + -136.5, -115.5, -94.5, -73.5, -52.5, -31.5, -10.5, 10.5, + 31.5, 52.5, 73.5, 94.5, 115.5, 136.5, +}; + +static long _vq_quantmap__16u2_p8_0[] = { + 13, 11, 9, 7, 5, 3, 1, 0, + 2, 4, 6, 8, 10, 12, 14, +}; + +static encode_aux_threshmatch _vq_auxt__16u2_p8_0 = { + _vq_quantthresh__16u2_p8_0, + _vq_quantmap__16u2_p8_0, + 15, + 15 +}; + +static static_codebook _16u2_p8_0 = { + 2, 225, + _vq_lengthlist__16u2_p8_0, + 1, -520986624, 1620377600, 4, 0, + _vq_quantlist__16u2_p8_0, + NULL, + &_vq_auxt__16u2_p8_0, + NULL, + 0 +}; + +static long _vq_quantlist__16u2_p8_1[] = { + 10, + 9, + 11, + 8, + 12, + 7, + 13, + 6, + 14, + 5, + 15, + 4, + 16, + 3, + 17, + 2, + 18, + 1, + 19, + 0, + 20, +}; + +static long _vq_lengthlist__16u2_p8_1[] = { + 2, 5, 5, 7, 7, 8, 8, 8, 8, 9, 9,10, 9,10, 9, 9, + 9,10,10,10,10, 5, 6, 6, 7, 7, 8, 8, 9, 9, 9, 9, + 10, 9,10,10,10,10,10,10,11,10, 5, 6, 6, 7, 7, 8, + 8, 8, 9, 9,10,10,10,10,10,10,10,10,10,10,10, 7, + 7, 7, 8, 8, 9, 8, 9, 9,10, 9,10,10,10,10,10,10, + 11,10,11,10, 7, 7, 7, 8, 8, 8, 9, 9, 9,10, 9,10, + 10,10,10,10,10,10,10,10,10, 8, 8, 8, 9, 9, 9, 9, + 10, 9,10,10,10,10,10,10,10,11,10,10,11,10, 8, 8, + 8, 8, 9, 9, 9, 9,10,10,10,10,10,10,10,10,10,11, + 11,10,10, 8, 9, 9, 9, 9, 9, 9,10,10,10,10,10,10, + 11,10,11,10,11,10,11,10, 8, 9, 9, 9, 9, 9,10,10, + 10,10,10,10,10,10,10,10,11,11,10,10,10, 9,10, 9, + 9,10,10,10,11,10,10,10,10,10,10,10,10,11,11,11, + 11,11, 9, 9, 9,10, 9,10,10,10,10,10,10,11,10,11, + 10,11,11,11,11,10,10, 9,10, 9,10,10,10,10,11,10, + 10,10,10,10,11,10,11,10,11,10,10,11, 9,10,10,10, + 10,10,10,10,10,10,11,10,10,11,11,10,11,11,11,11, + 11, 9, 9,10,10,10,10,10,11,10,10,11,10,10,11,10, + 10,11,11,11,11,11, 9,10,10,10,10,10,10,10,11,10, + 11,10,11,10,11,11,11,11,11,10,11,10,10,10,10,10, + 10,10,10,10,11,11,11,11,11,11,11,11,11,10,11,11, + 10,10,10,10,10,11,10,10,10,11,10,11,11,11,11,10, + 12,11,11,11,10,10,10,10,10,10,11,10,10,10,11,11, + 12,11,11,11,11,11,11,11,11,11,10,10,10,11,10,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10, + 10,10,11,10,11,10,10,11,11,11,11,11,11,11,11,11, + 11,11,11,10,10,10,10,10,10,10,11,11,10,11,11,10, + 11,11,10,11,11,11,10,11,11, +}; + +static float _vq_quantthresh__16u2_p8_1[] = { + -9.5, -8.5, -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, + -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, + 6.5, 7.5, 8.5, 9.5, +}; + +static long _vq_quantmap__16u2_p8_1[] = { + 19, 17, 15, 13, 11, 9, 7, 5, + 3, 1, 0, 2, 4, 6, 8, 10, + 12, 14, 16, 18, 20, +}; + +static encode_aux_threshmatch _vq_auxt__16u2_p8_1 = { + _vq_quantthresh__16u2_p8_1, + _vq_quantmap__16u2_p8_1, + 21, + 21 +}; + +static static_codebook _16u2_p8_1 = { + 2, 441, + _vq_lengthlist__16u2_p8_1, + 1, -529268736, 1611661312, 5, 0, + _vq_quantlist__16u2_p8_1, + NULL, + &_vq_auxt__16u2_p8_1, + NULL, + 0 +}; + +static long _vq_quantlist__16u2_p9_0[] = { + 5586, + 4655, + 6517, + 3724, + 7448, + 2793, + 8379, + 1862, + 9310, + 931, + 10241, + 0, + 11172, + 5521, + 5651, +}; + +static long _vq_lengthlist__16u2_p9_0[] = { + 1,10,10,10,10,10,10,10,10,10,10,10,10, 5, 4,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10, 4,10,10,10,10,10,10,10,10,10,10,10,10, + 6, 6, 5,10,10,10,10, 9, 9, 9, 9, 9, 9, 9, 9, 5, + 5, +}; + +static float _vq_quantthresh__16u2_p9_0[] = { + -5120.5, -4189.5, -3258.5, -2327.5, -1396.5, -498, -32.5, 32.5, + 498, 1396.5, 2327.5, 3258.5, 4189.5, 5120.5, +}; + +static long _vq_quantmap__16u2_p9_0[] = { + 11, 9, 7, 5, 3, 1, 13, 0, + 14, 2, 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__16u2_p9_0 = { + _vq_quantthresh__16u2_p9_0, + _vq_quantmap__16u2_p9_0, + 15, + 15 +}; + +static static_codebook _16u2_p9_0 = { + 2, 225, + _vq_lengthlist__16u2_p9_0, + 1, -510275072, 1611661312, 14, 0, + _vq_quantlist__16u2_p9_0, + NULL, + &_vq_auxt__16u2_p9_0, + NULL, + 0 +}; + +static long _vq_quantlist__16u2_p9_1[] = { + 392, + 343, + 441, + 294, + 490, + 245, + 539, + 196, + 588, + 147, + 637, + 98, + 686, + 49, + 735, + 0, + 784, + 388, + 396, +}; + +static long _vq_lengthlist__16u2_p9_1[] = { + 1,12,10,12,10,12,10,12,11,12,12,12,12,12,12,12, + 12, 5, 5, 9,10,12,11,11,12,12,12,12,12,12,12,12, + 12,12,12,12,10, 9, 9,11, 9,11,11,12,11,12,12,12, + 12,12,12,12,12,12,12, 8, 8,10,11, 9,12,11,12,12, + 12,12,12,12,12,12,12,12,12,12, 9, 8,10,11,12,11, + 12,11,12,12,12,12,12,12,12,12,12,12,12, 8, 9,11, + 11,10,12,12,12,12,12,12,12,12,12,12,12,12,12,12, + 9,10,11,12,11,12,11,12,12,12,12,12,12,12,12,12, + 12,12,12, 9, 9,11,12,12,12,12,12,12,12,12,12,12, + 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, + 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, + 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, + 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, + 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, + 12,12,12,12,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11, 5, 8, 9, 9, 8,11, 9,11,11,11,11,11,11, + 11,11,11,11, 5, 5, 4, 8, 8, 8, 8,10, 9,10,10,11, + 11,11,11,11,11,11,11, 5, 4, +}; + +static float _vq_quantthresh__16u2_p9_1[] = { + -367.5, -318.5, -269.5, -220.5, -171.5, -122.5, -73.5, -26.5, + -2, 2, 26.5, 73.5, 122.5, 171.5, 220.5, 269.5, + 318.5, 367.5, +}; + +static long _vq_quantmap__16u2_p9_1[] = { + 15, 13, 11, 9, 7, 5, 3, 1, + 17, 0, 18, 2, 4, 6, 8, 10, + 12, 14, 16, +}; + +static encode_aux_threshmatch _vq_auxt__16u2_p9_1 = { + _vq_quantthresh__16u2_p9_1, + _vq_quantmap__16u2_p9_1, + 19, + 19 +}; + +static static_codebook _16u2_p9_1 = { + 2, 361, + _vq_lengthlist__16u2_p9_1, + 1, -518488064, 1611661312, 10, 0, + _vq_quantlist__16u2_p9_1, + NULL, + &_vq_auxt__16u2_p9_1, + NULL, + 0 +}; + +static long _vq_quantlist__16u2_p9_2[] = { + 24, + 23, + 25, + 22, + 26, + 21, + 27, + 20, + 28, + 19, + 29, + 18, + 30, + 17, + 31, + 16, + 32, + 15, + 33, + 14, + 34, + 13, + 35, + 12, + 36, + 11, + 37, + 10, + 38, + 9, + 39, + 8, + 40, + 7, + 41, + 6, + 42, + 5, + 43, + 4, + 44, + 3, + 45, + 2, + 46, + 1, + 47, + 0, + 48, +}; + +static long _vq_lengthlist__16u2_p9_2[] = { + 1, 3, 3, 4, 7, 7, 7, 8, 7, 7, 7, 7, 8, 8, 8, 8, + 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 7, 9, 9, 8, 9, 9, + 9, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,12,12,10, + 11, +}; + +static float _vq_quantthresh__16u2_p9_2[] = { + -23.5, -22.5, -21.5, -20.5, -19.5, -18.5, -17.5, -16.5, + -15.5, -14.5, -13.5, -12.5, -11.5, -10.5, -9.5, -8.5, + -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, + 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, + 8.5, 9.5, 10.5, 11.5, 12.5, 13.5, 14.5, 15.5, + 16.5, 17.5, 18.5, 19.5, 20.5, 21.5, 22.5, 23.5, +}; + +static long _vq_quantmap__16u2_p9_2[] = { + 47, 45, 43, 41, 39, 37, 35, 33, + 31, 29, 27, 25, 23, 21, 19, 17, + 15, 13, 11, 9, 7, 5, 3, 1, + 0, 2, 4, 6, 8, 10, 12, 14, + 16, 18, 20, 22, 24, 26, 28, 30, + 32, 34, 36, 38, 40, 42, 44, 46, + 48, +}; + +static encode_aux_threshmatch _vq_auxt__16u2_p9_2 = { + _vq_quantthresh__16u2_p9_2, + _vq_quantmap__16u2_p9_2, + 49, + 49 +}; + +static static_codebook _16u2_p9_2 = { + 1, 49, + _vq_lengthlist__16u2_p9_2, + 1, -526909440, 1611661312, 6, 0, + _vq_quantlist__16u2_p9_2, + NULL, + &_vq_auxt__16u2_p9_2, + NULL, + 0 +}; + +static long _vq_quantlist__8u0__p1_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__8u0__p1_0[] = { + 1, 4, 4, 5, 7, 7, 5, 7, 7, 5, 8, 8, 8,10,10, 7, + 10,10, 5, 8, 8, 7,10,10, 8,10,10, 4, 9, 8, 8,11, + 11, 8,11,11, 7,11,11,10,11,13,10,13,13, 7,11,11, + 10,13,12,10,13,13, 5, 9, 8, 8,11,11, 8,11,11, 7, + 11,11, 9,13,13,10,12,13, 7,11,11,10,13,13,10,13, + 11, +}; + +static float _vq_quantthresh__8u0__p1_0[] = { + -0.5, 0.5, +}; + +static long _vq_quantmap__8u0__p1_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__8u0__p1_0 = { + _vq_quantthresh__8u0__p1_0, + _vq_quantmap__8u0__p1_0, + 3, + 3 +}; + +static static_codebook _8u0__p1_0 = { + 4, 81, + _vq_lengthlist__8u0__p1_0, + 1, -535822336, 1611661312, 2, 0, + _vq_quantlist__8u0__p1_0, + NULL, + &_vq_auxt__8u0__p1_0, + NULL, + 0 +}; + +static long _vq_quantlist__8u0__p2_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__8u0__p2_0[] = { + 2, 4, 4, 5, 6, 6, 5, 6, 6, 5, 7, 7, 6, 7, 8, 6, + 7, 8, 5, 7, 7, 6, 8, 8, 7, 9, 7, 5, 7, 7, 7, 9, + 9, 7, 8, 8, 6, 9, 8, 7, 7,10, 8,10,10, 6, 8, 8, + 8,10, 8, 8,10,10, 5, 7, 7, 7, 8, 8, 7, 8, 9, 6, + 8, 8, 8,10,10, 8, 8,10, 6, 8, 9, 8,10,10, 7,10, + 8, +}; + +static float _vq_quantthresh__8u0__p2_0[] = { + -0.5, 0.5, +}; + +static long _vq_quantmap__8u0__p2_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__8u0__p2_0 = { + _vq_quantthresh__8u0__p2_0, + _vq_quantmap__8u0__p2_0, + 3, + 3 +}; + +static static_codebook _8u0__p2_0 = { + 4, 81, + _vq_lengthlist__8u0__p2_0, + 1, -535822336, 1611661312, 2, 0, + _vq_quantlist__8u0__p2_0, + NULL, + &_vq_auxt__8u0__p2_0, + NULL, + 0 +}; + +static long _vq_quantlist__8u0__p3_0[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__8u0__p3_0[] = { + 1, 5, 5, 7, 7, 6, 7, 7, 9, 9, 6, 7, 7, 9, 9, 8, + 10, 9,11,11, 8, 9, 9,11,11, 6, 8, 8,10,10, 8,10, + 10,11,11, 8,10,10,11,11,10,11,11,12,12,10,11,11, + 12,13, 6, 8, 8,10,10, 8,10,10,11,11, 8,10,10,11, + 11, 9,10,11,12,12,10,11,11,12,12, 8,11,11,14,13, + 10,12,11,15,13,10,12,11,14,14,12,13,12,16,14,12, + 14,12,16,15, 8,11,11,13,14,10,11,12,13,15,10,11, + 12,13,15,11,12,13,14,15,12,12,14,14,16, 5, 8, 8, + 11,11, 9,11,11,12,12, 8,10,11,12,12,11,12,12,15, + 14,11,12,12,14,14, 7,11,10,13,12,10,11,12,13,14, + 10,12,12,14,13,12,13,13,14,15,12,13,13,15,15, 7, + 10,11,12,13,10,12,11,14,13,10,12,13,13,15,12,13, + 12,14,14,11,13,13,15,16, 9,12,12,15,14,11,13,13, + 15,16,11,13,13,16,16,13,14,15,15,15,12,14,15,17, + 16, 9,12,12,14,15,11,13,13,15,16,11,13,13,16,18, + 13,14,14,17,16,13,15,15,17,18, 5, 8, 9,11,11, 8, + 11,11,12,12, 8,10,11,12,12,11,12,12,14,14,11,12, + 12,14,15, 7,11,10,12,13,10,12,12,14,13,10,11,12, + 13,14,11,13,13,15,14,12,13,13,14,15, 7,10,11,13, + 13,10,12,12,13,14,10,12,12,13,13,11,13,13,16,16, + 12,13,13,15,14, 9,12,12,16,15,10,13,13,15,15,11, + 13,13,17,15,12,15,15,18,17,13,14,14,15,16, 9,12, + 12,15,15,11,13,13,15,16,11,13,13,15,15,12,15,15, + 16,16,13,15,14,17,15, 7,11,11,15,15,10,13,13,16, + 15,10,13,13,15,16,14,15,15,17,19,13,15,14,15,18, + 9,12,12,16,16,11,13,14,17,16,11,13,13,17,16,15, + 15,16,17,19,13,15,16, 0,18, 9,12,12,16,15,11,14, + 13,17,17,11,13,14,16,16,15,16,16,19,18,13,15,15, + 17,19,11,14,14,19,16,12,14,15, 0,18,12,16,15,18, + 17,15,15,18,16,19,14,15,17,19,19,11,14,14,18,19, + 13,15,14,19,19,12,16,15,18,17,15,17,15, 0,16,14, + 17,16,19, 0, 7,11,11,14,14,10,12,12,15,15,10,13, + 13,16,15,13,15,15,17, 0,14,15,15,16,19, 9,12,12, + 16,16,11,14,14,16,16,11,13,13,16,16,14,17,16,19, + 0,14,18,17,17,19, 9,12,12,15,16,11,13,13,15,17, + 12,14,13,19,16,13,15,15,17,19,15,17,16,17,19,11, + 14,14,19,16,12,15,15,19,17,13,14,15,17,19,14,16, + 17,19,19,16,15,16,17,19,11,15,14,16,16,12,15,15, + 19, 0,12,14,15,19,19,14,16,16, 0,18,15,19,14,18, + 16, +}; + +static float _vq_quantthresh__8u0__p3_0[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__8u0__p3_0[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__8u0__p3_0 = { + _vq_quantthresh__8u0__p3_0, + _vq_quantmap__8u0__p3_0, + 5, + 5 +}; + +static static_codebook _8u0__p3_0 = { + 4, 625, + _vq_lengthlist__8u0__p3_0, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__8u0__p3_0, + NULL, + &_vq_auxt__8u0__p3_0, + NULL, + 0 +}; + +static long _vq_quantlist__8u0__p4_0[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__8u0__p4_0[] = { + 3, 5, 5, 8, 8, 5, 6, 7, 9, 9, 6, 7, 6, 9, 9, 9, + 9, 9,10,11, 9, 9, 9,11,10, 6, 7, 7,10,10, 7, 7, + 8,10,10, 7, 8, 8,10,10,10,10,10,10,11, 9,10,10, + 11,12, 6, 7, 7,10,10, 7, 8, 8,10,10, 7, 8, 7,10, + 10, 9,10,10,12,11,10,10,10,11,10, 9,10,10,12,11, + 10,10,10,13,11, 9,10,10,12,12,11,11,12,12,13,11, + 11,11,12,13, 9,10,10,12,12,10,10,11,12,12,10,10, + 11,12,12,11,11,11,13,13,11,12,12,13,13, 5, 7, 7, + 10,10, 7, 8, 8,10,10, 7, 8, 8,10,10,10,11,11,12, + 12,10,11,10,12,12, 7, 8, 8,11,11, 7, 8, 9,10,11, + 8, 9, 9,11,11,11,10,11,10,12,10,11,11,12,13, 7, + 8, 8,10,11, 8, 9, 8,12,10, 8, 9, 9,11,12,10,11, + 10,13,11,10,11,11,13,12, 9,11,10,13,12,10,10,11, + 12,12,10,11,11,13,13,12,10,13,11,14,11,12,12,15, + 13, 9,11,11,13,13,10,11,11,13,12,10,11,11,12,14, + 12,13,11,14,12,12,12,12,14,14, 5, 7, 7,10,10, 7, + 8, 8,10,10, 7, 8, 8,11,10,10,11,11,12,12,10,11, + 10,12,12, 7, 8, 8,10,11, 8, 9, 9,12,11, 8, 8, 9, + 10,11,10,11,11,12,13,11,10,11,11,13, 6, 8, 8,10, + 11, 8, 9, 9,11,11, 7, 9, 7,11,10,10,11,11,12,12, + 10,11,10,13,10, 9,11,10,13,12,10,12,11,13,13,10, + 10,11,12,13,11,12,13,15,14,11,11,13,12,13, 9,10, + 11,12,13,10,11,11,12,13,10,11,10,13,12,12,13,13, + 13,14,12,12,11,14,11, 8,10,10,12,13,10,11,11,13, + 13,10,11,10,13,13,12,13,14,15,14,12,12,12,14,13, + 9,10,10,13,12,10,10,12,13,13,10,11,11,15,12,12, + 12,13,15,14,12,13,13,15,13, 9,10,11,12,13,10,12, + 10,13,12,10,11,11,12,13,12,14,12,15,13,12,12,12, + 15,14,11,12,11,14,13,11,11,12,14,14,12,13,13,14, + 13,13,11,15,11,15,14,14,14,16,15,11,12,12,13,14, + 11,13,11,14,14,12,12,13,14,15,12,14,12,15,12,13, + 15,14,16,15, 8,10,10,12,12,10,10,10,12,13,10,11, + 11,13,13,12,12,12,13,14,13,13,13,15,15, 9,10,10, + 12,12,10,11,11,13,12,10,10,11,13,13,12,12,12,14, + 14,12,12,13,15,14, 9,10,10,13,12,10,10,12,12,13, + 10,11,10,13,13,12,13,13,14,14,12,13,12,14,13,11, + 12,12,14,13,12,13,12,14,14,10,12,12,14,14,14,14, + 14,16,14,13,12,14,12,15,10,12,12,14,15,12,13,13, + 14,16,11,12,11,15,14,13,14,14,14,15,13,14,11,14, + 12, +}; + +static float _vq_quantthresh__8u0__p4_0[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__8u0__p4_0[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__8u0__p4_0 = { + _vq_quantthresh__8u0__p4_0, + _vq_quantmap__8u0__p4_0, + 5, + 5 +}; + +static static_codebook _8u0__p4_0 = { + 4, 625, + _vq_lengthlist__8u0__p4_0, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__8u0__p4_0, + NULL, + &_vq_auxt__8u0__p4_0, + NULL, + 0 +}; + +static long _vq_quantlist__8u0__p5_0[] = { + 4, + 3, + 5, + 2, + 6, + 1, + 7, + 0, + 8, +}; + +static long _vq_lengthlist__8u0__p5_0[] = { + 1, 4, 4, 7, 7, 7, 7, 9, 9, 4, 6, 6, 8, 7, 8, 8, + 10,10, 4, 6, 6, 8, 8, 8, 8,10,10, 6, 8, 8, 9, 9, + 9, 9,11,11, 7, 8, 8, 9, 9, 9, 9,11,11, 7, 8, 8, + 9, 9,10,10,12,11, 7, 8, 8, 9, 9,10,10,11,11, 9, + 10,10,11,11,11,12,12,12, 9,10,10,11,11,12,12,12, + 12, +}; + +static float _vq_quantthresh__8u0__p5_0[] = { + -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, +}; + +static long _vq_quantmap__8u0__p5_0[] = { + 7, 5, 3, 1, 0, 2, 4, 6, + 8, +}; + +static encode_aux_threshmatch _vq_auxt__8u0__p5_0 = { + _vq_quantthresh__8u0__p5_0, + _vq_quantmap__8u0__p5_0, + 9, + 9 +}; + +static static_codebook _8u0__p5_0 = { + 2, 81, + _vq_lengthlist__8u0__p5_0, + 1, -531628032, 1611661312, 4, 0, + _vq_quantlist__8u0__p5_0, + NULL, + &_vq_auxt__8u0__p5_0, + NULL, + 0 +}; + +static long _vq_quantlist__8u0__p6_0[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__8u0__p6_0[] = { + 1, 4, 4, 7, 7, 9, 9,11,11,12,12,16,16, 3, 6, 6, + 9, 9,11,11,12,12,13,14,18,16, 3, 6, 7, 9, 9,11, + 11,13,12,14,14,17,16, 7, 9, 9,11,11,12,12,14,14, + 14,14,17,16, 7, 9, 9,11,11,13,12,13,13,14,14,17, + 0, 9,11,11,12,13,14,14,14,13,15,14,17,17, 9,11, + 11,12,12,14,14,13,14,14,15, 0, 0,11,12,12,15,14, + 15,14,15,14,15,16,17, 0,11,12,13,13,13,14,14,15, + 14,15,15, 0, 0,12,14,14,15,15,14,16,15,15,17,16, + 0,18,13,14,14,15,14,15,14,15,16,17,16, 0, 0,17, + 17,18, 0,16,18,16, 0, 0, 0,17, 0, 0,16, 0, 0,16, + 16, 0,15, 0,17, 0, 0, 0, 0, +}; + +static float _vq_quantthresh__8u0__p6_0[] = { + -27.5, -22.5, -17.5, -12.5, -7.5, -2.5, 2.5, 7.5, + 12.5, 17.5, 22.5, 27.5, +}; + +static long _vq_quantmap__8u0__p6_0[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__8u0__p6_0 = { + _vq_quantthresh__8u0__p6_0, + _vq_quantmap__8u0__p6_0, + 13, + 13 +}; + +static static_codebook _8u0__p6_0 = { + 2, 169, + _vq_lengthlist__8u0__p6_0, + 1, -526516224, 1616117760, 4, 0, + _vq_quantlist__8u0__p6_0, + NULL, + &_vq_auxt__8u0__p6_0, + NULL, + 0 +}; + +static long _vq_quantlist__8u0__p6_1[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__8u0__p6_1[] = { + 1, 4, 4, 6, 6, 4, 6, 5, 7, 7, 4, 5, 6, 7, 7, 6, + 7, 7, 7, 7, 6, 7, 7, 7, 7, +}; + +static float _vq_quantthresh__8u0__p6_1[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__8u0__p6_1[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__8u0__p6_1 = { + _vq_quantthresh__8u0__p6_1, + _vq_quantmap__8u0__p6_1, + 5, + 5 +}; + +static static_codebook _8u0__p6_1 = { + 2, 25, + _vq_lengthlist__8u0__p6_1, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__8u0__p6_1, + NULL, + &_vq_auxt__8u0__p6_1, + NULL, + 0 +}; + +static long _vq_quantlist__8u0__p7_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__8u0__p7_0[] = { + 1, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, +}; + +static float _vq_quantthresh__8u0__p7_0[] = { + -157.5, 157.5, +}; + +static long _vq_quantmap__8u0__p7_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__8u0__p7_0 = { + _vq_quantthresh__8u0__p7_0, + _vq_quantmap__8u0__p7_0, + 3, + 3 +}; + +static static_codebook _8u0__p7_0 = { + 4, 81, + _vq_lengthlist__8u0__p7_0, + 1, -518803456, 1628680192, 2, 0, + _vq_quantlist__8u0__p7_0, + NULL, + &_vq_auxt__8u0__p7_0, + NULL, + 0 +}; + +static long _vq_quantlist__8u0__p7_1[] = { + 7, + 6, + 8, + 5, + 9, + 4, + 10, + 3, + 11, + 2, + 12, + 1, + 13, + 0, + 14, +}; + +static long _vq_lengthlist__8u0__p7_1[] = { + 1, 5, 5, 5, 5,10,10,11,11,11,11,11,11,11,11, 5, + 7, 6, 8, 8, 9,10,11,11,11,11,11,11,11,11, 6, 6, + 7, 9, 7,11,10,11,11,11,11,11,11,11,11, 5, 6, 6, + 11, 8,11,11,11,11,11,11,11,11,11,11, 5, 6, 6, 9, + 10,11,10,11,11,11,11,11,11,11,11, 7,10,10,11,11, + 11,11,11,11,11,11,11,11,11,11, 7,11, 8,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10, +}; + +static float _vq_quantthresh__8u0__p7_1[] = { + -136.5, -115.5, -94.5, -73.5, -52.5, -31.5, -10.5, 10.5, + 31.5, 52.5, 73.5, 94.5, 115.5, 136.5, +}; + +static long _vq_quantmap__8u0__p7_1[] = { + 13, 11, 9, 7, 5, 3, 1, 0, + 2, 4, 6, 8, 10, 12, 14, +}; + +static encode_aux_threshmatch _vq_auxt__8u0__p7_1 = { + _vq_quantthresh__8u0__p7_1, + _vq_quantmap__8u0__p7_1, + 15, + 15 +}; + +static static_codebook _8u0__p7_1 = { + 2, 225, + _vq_lengthlist__8u0__p7_1, + 1, -520986624, 1620377600, 4, 0, + _vq_quantlist__8u0__p7_1, + NULL, + &_vq_auxt__8u0__p7_1, + NULL, + 0 +}; + +static long _vq_quantlist__8u0__p7_2[] = { + 10, + 9, + 11, + 8, + 12, + 7, + 13, + 6, + 14, + 5, + 15, + 4, + 16, + 3, + 17, + 2, + 18, + 1, + 19, + 0, + 20, +}; + +static long _vq_lengthlist__8u0__p7_2[] = { + 1, 6, 5, 7, 7, 9, 9, 9, 9,10,12,12,10,11,11,10, + 11,11,11,10,11, 6, 8, 8, 9, 9,10,10, 9,10,11,11, + 10,11,11,11,11,10,11,11,11,11, 6, 7, 8, 9, 9, 9, + 10,11,10,11,12,11,10,11,11,11,11,11,11,12,10, 8, + 9, 9,10, 9,10,10, 9,10,10,10,10,10, 9,10,10,10, + 10, 9,10,10, 9, 9, 9, 9,10,10, 9, 9,10,10,11,10, + 9,12,10,11,10, 9,10,10,10, 8, 9, 9,10, 9,10, 9, + 9,10,10, 9,10, 9,11,10,10,10,10,10, 9,10, 8, 8, + 9, 9,10, 9,11, 9, 8, 9, 9,10,11,10,10,10,11,12, + 9, 9,11, 8, 9, 8,11,10,11,10,10, 9,11,10,10,10, + 10,10,10,10,11,11,11,11, 8, 9, 9, 9,10,10,10,11, + 11,12,11,12,11,10,10,10,12,11,11,11,10, 8,10, 9, + 11,10,10,11,12,10,11,12,11,11,12,11,12,12,10,11, + 11,10, 9, 9,10,11,12,10,10,10,11,10,11,11,10,12, + 12,10,11,10,11,12,10, 9,10,10,11,10,11,11,11,11, + 11,12,11,11,11, 9,11,10,11,10,11,10, 9, 9,10,11, + 11,11,10,10,11,12,12,11,12,11,11,11,12,12,12,12, + 11, 9,11,11,12,10,11,11,11,11,11,11,12,11,11,12, + 11,11,11,10,11,11, 9,11,10,11,11,11,10,10,10,11, + 11,11,12,10,11,10,11,11,11,11,12, 9,11,10,11,11, + 10,10,11,11, 9,11,11,12,10,10,10,10,10,11,11,10, + 9,10,11,11,12,11,10,10,12,11,11,12,11,12,11,11, + 10,10,11,11,10,12,11,10,11,10,11,10,10,10,11,11, + 10,10,11,11,11,11,10,10,10,12,11,11,11,11,10, 9, + 10,11,11,11,12,11,11,11,12,10,11,11,11, 9,10,11, + 11,11,11,11,11,10,10,11,11,12,11,10,11,12,11,10, + 10,11, 9,10,11,11,11,11,11,10,11,11,10,12,11,11, + 11,12,11,11,11,10,10,11,11, +}; + +static float _vq_quantthresh__8u0__p7_2[] = { + -9.5, -8.5, -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, + -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, + 6.5, 7.5, 8.5, 9.5, +}; + +static long _vq_quantmap__8u0__p7_2[] = { + 19, 17, 15, 13, 11, 9, 7, 5, + 3, 1, 0, 2, 4, 6, 8, 10, + 12, 14, 16, 18, 20, +}; + +static encode_aux_threshmatch _vq_auxt__8u0__p7_2 = { + _vq_quantthresh__8u0__p7_2, + _vq_quantmap__8u0__p7_2, + 21, + 21 +}; + +static static_codebook _8u0__p7_2 = { + 2, 441, + _vq_lengthlist__8u0__p7_2, + 1, -529268736, 1611661312, 5, 0, + _vq_quantlist__8u0__p7_2, + NULL, + &_vq_auxt__8u0__p7_2, + NULL, + 0 +}; + +static long _huff_lengthlist__8u0__single[] = { + 4, 7,11, 9,12, 8, 7,10, 6, 4, 5, 5, 7, 5, 6,16, + 9, 5, 5, 6, 7, 7, 9,16, 7, 4, 6, 5, 7, 5, 7,17, + 10, 7, 7, 8, 7, 7, 8,18, 7, 5, 6, 4, 5, 4, 5,15, + 7, 6, 7, 5, 6, 4, 5,15,12,13,18,12,17,11, 9,17, +}; + +static static_codebook _huff_book__8u0__single = { + 2, 64, + _huff_lengthlist__8u0__single, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _vq_quantlist__8u1__p1_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__8u1__p1_0[] = { + 1, 4, 4, 5, 7, 7, 5, 7, 7, 5, 8, 8, 7, 9,10, 7, + 9, 9, 5, 8, 8, 7,10, 9, 7, 9, 9, 5, 8, 8, 8,10, + 10, 8,10,10, 7,10,10, 9,10,12,10,12,12, 7,10,10, + 9,12,11,10,12,12, 5, 8, 8, 8,10,10, 8,10,10, 7, + 10,10,10,12,12, 9,11,12, 7,10,10,10,12,12, 9,12, + 10, +}; + +static float _vq_quantthresh__8u1__p1_0[] = { + -0.5, 0.5, +}; + +static long _vq_quantmap__8u1__p1_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__8u1__p1_0 = { + _vq_quantthresh__8u1__p1_0, + _vq_quantmap__8u1__p1_0, + 3, + 3 +}; + +static static_codebook _8u1__p1_0 = { + 4, 81, + _vq_lengthlist__8u1__p1_0, + 1, -535822336, 1611661312, 2, 0, + _vq_quantlist__8u1__p1_0, + NULL, + &_vq_auxt__8u1__p1_0, + NULL, + 0 +}; + +static long _vq_quantlist__8u1__p2_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__8u1__p2_0[] = { + 3, 4, 5, 5, 6, 6, 5, 6, 6, 5, 7, 6, 6, 7, 8, 6, + 7, 8, 5, 6, 6, 6, 8, 7, 6, 8, 7, 5, 6, 6, 7, 8, + 8, 6, 7, 7, 6, 8, 7, 7, 7, 9, 8, 9, 9, 6, 7, 8, + 7, 9, 7, 8, 9, 9, 5, 6, 6, 6, 7, 7, 7, 8, 8, 6, + 8, 7, 8, 9, 9, 7, 7, 9, 6, 7, 8, 8, 9, 9, 7, 9, + 7, +}; + +static float _vq_quantthresh__8u1__p2_0[] = { + -0.5, 0.5, +}; + +static long _vq_quantmap__8u1__p2_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__8u1__p2_0 = { + _vq_quantthresh__8u1__p2_0, + _vq_quantmap__8u1__p2_0, + 3, + 3 +}; + +static static_codebook _8u1__p2_0 = { + 4, 81, + _vq_lengthlist__8u1__p2_0, + 1, -535822336, 1611661312, 2, 0, + _vq_quantlist__8u1__p2_0, + NULL, + &_vq_auxt__8u1__p2_0, + NULL, + 0 +}; + +static long _vq_quantlist__8u1__p3_0[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__8u1__p3_0[] = { + 1, 5, 5, 7, 7, 6, 7, 7, 9, 9, 6, 7, 7, 9, 9, 8, + 10, 9,11,11, 9, 9, 9,11,11, 6, 8, 8,10,10, 8,10, + 10,11,11, 8, 9,10,11,11,10,11,11,12,12,10,11,11, + 12,13, 6, 8, 8,10,10, 8,10, 9,11,11, 8,10, 9,11, + 11,10,11,11,12,12,10,11,11,12,12, 9,11,11,14,13, + 10,12,11,14,14,10,12,11,14,13,12,13,13,15,14,12, + 13,13,15,14, 8,11,11,13,14,10,11,12,13,15,10,11, + 12,14,14,12,13,13,14,15,12,13,13,14,15, 5, 8, 8, + 11,11, 8,10,10,12,12, 8,10,10,12,12,11,12,12,14, + 13,11,12,12,13,14, 8,10,10,12,12, 9,11,12,13,14, + 10,12,12,13,13,12,12,13,14,14,11,13,13,15,15, 7, + 10,10,12,12, 9,12,11,14,12,10,11,12,13,14,12,13, + 12,14,14,12,13,13,15,16,10,12,12,15,14,11,12,13, + 15,15,11,13,13,15,16,14,14,15,15,16,13,14,15,17, + 15, 9,12,12,14,15,11,13,12,15,15,11,13,13,15,15, + 13,14,13,15,14,13,14,14,17, 0, 5, 8, 8,11,11, 8, + 10,10,12,12, 8,10,10,12,12,11,12,12,14,14,11,12, + 12,14,14, 7,10,10,12,12,10,12,12,13,13, 9,11,12, + 12,13,11,12,13,15,15,11,12,13,14,15, 8,10,10,12, + 12,10,12,11,13,13,10,12,11,13,13,11,13,13,15,14, + 12,13,12,15,13, 9,12,12,14,14,11,13,13,16,15,11, + 12,13,16,15,13,14,15,16,16,13,13,15,15,16,10,12, + 12,15,14,11,13,13,14,16,11,13,13,15,16,13,15,15, + 16,17,13,15,14,16,15, 8,11,11,14,15,10,12,12,15, + 15,10,12,12,15,16,14,15,15,16,17,13,14,14,16,16, + 9,12,12,15,15,11,13,14,15,17,11,13,13,15,16,14, + 15,16,19,17,13,15,15, 0,17, 9,12,12,15,15,11,14, + 13,16,15,11,13,13,15,16,15,15,15,18,17,13,15,15, + 17,17,11,15,14,18,16,12,14,15,17,17,12,15,15,18, + 18,15,15,16,15,19,14,16,16, 0, 0,11,14,14,16,17, + 12,15,14,18,17,12,15,15,18,18,15,17,15,18,16,14, + 16,16,18,18, 7,11,11,14,14,10,12,12,15,15,10,12, + 13,15,15,13,14,15,16,16,14,15,15,18,18, 9,12,12, + 15,15,11,13,13,16,15,11,12,13,16,16,14,15,15,17, + 16,15,16,16,17,17, 9,12,12,15,15,11,13,13,15,17, + 11,14,13,16,15,13,15,15,17,17,15,15,15,18,17,11, + 14,14,17,15,12,14,15,17,18,13,13,15,17,17,14,16, + 16,19,18,16,15,17,17, 0,11,14,14,17,17,12,15,15, + 18, 0,12,15,14,18,16,14,17,17,19, 0,16,18,15, 0, + 16, +}; + +static float _vq_quantthresh__8u1__p3_0[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__8u1__p3_0[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__8u1__p3_0 = { + _vq_quantthresh__8u1__p3_0, + _vq_quantmap__8u1__p3_0, + 5, + 5 +}; + +static static_codebook _8u1__p3_0 = { + 4, 625, + _vq_lengthlist__8u1__p3_0, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__8u1__p3_0, + NULL, + &_vq_auxt__8u1__p3_0, + NULL, + 0 +}; + +static long _vq_quantlist__8u1__p4_0[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__8u1__p4_0[] = { + 4, 5, 5, 9, 9, 6, 7, 7, 9, 9, 6, 7, 7, 9, 9, 9, + 9, 9,11,11, 9, 9, 9,11,11, 6, 7, 7, 9, 9, 7, 7, + 8, 9,10, 7, 7, 8, 9,10, 9, 9,10,10,11, 9, 9,10, + 10,12, 6, 7, 7, 9, 9, 7, 8, 7,10, 9, 7, 8, 7,10, + 9, 9,10, 9,12,11,10,10, 9,12,10, 9,10,10,12,11, + 9,10,10,12,11, 9,10,10,12,12,11,11,12,12,13,11, + 11,12,12,13, 9, 9,10,12,11, 9,10,10,12,12,10,10, + 10,12,12,11,12,11,13,12,11,12,11,13,12, 6, 7, 7, + 9, 9, 7, 8, 8,10,10, 7, 8, 7,10, 9,10,10,10,12, + 12,10,10,10,12,11, 7, 8, 7,10,10, 7, 7, 9,10,11, + 8, 9, 9,11,10,10,10,11,10,12,10,10,11,12,12, 7, + 8, 8,10,10, 7, 9, 8,11,10, 8, 8, 9,11,11,10,11, + 10,12,11,10,11,11,12,12, 9,10,10,12,12, 9,10,10, + 12,12,10,11,11,13,12,11,10,12,10,14,12,12,12,13, + 14, 9,10,10,12,12, 9,11,10,12,12,10,11,11,12,12, + 11,12,11,14,12,12,12,12,14,14, 5, 7, 7, 9, 9, 7, + 7, 7, 9,10, 7, 8, 8,10,10,10,10,10,11,11,10,10, + 10,12,12, 7, 8, 8,10,10, 8, 9, 8,11,10, 7, 8, 9, + 10,11,10,10,10,11,12,10,10,11,11,13, 6, 7, 8,10, + 10, 8, 9, 9,10,10, 7, 9, 7,11,10,10,11,10,12,12, + 10,11,10,12,10, 9,10,10,12,12,10,11,11,13,12, 9, + 10,10,12,12,12,12,12,14,13,11,11,12,11,14, 9,10, + 10,11,12,10,11,11,12,13, 9,10,10,12,12,12,12,12, + 14,13,11,12,10,14,11, 9, 9,10,11,12, 9,10,10,12, + 12, 9,10,10,12,12,12,12,12,14,14,11,12,12,13,12, + 9,10, 9,12,12, 9,10,11,12,13,10,11,10,13,11,12, + 12,13,13,14,12,12,12,13,13, 9,10,10,12,12,10,11, + 10,13,12,10,10,11,12,13,12,13,12,14,13,12,12,12, + 13,14,11,12,11,14,13,10,10,11,13,13,12,12,12,14, + 13,12,10,14,10,15,13,14,14,14,14,11,11,12,13,14, + 10,12,11,13,13,12,12,12,13,15,12,13,11,15,12,13, + 13,14,14,14, 9,10, 9,12,12, 9,10,10,12,12,10,10, + 10,12,12,11,11,12,12,13,12,12,12,14,14, 9,10,10, + 12,12,10,11,10,13,12,10,10,11,12,13,12,12,12,14, + 13,12,12,13,13,14, 9,10,10,12,13,10,10,11,11,12, + 9,11,10,13,12,12,12,12,13,14,12,13,12,14,13,11, + 12,11,13,13,12,13,12,14,13,10,11,12,13,13,13,13, + 13,14,15,12,11,14,12,14,11,11,12,12,13,12,12,12, + 13,14,10,12,10,14,13,13,13,13,14,15,12,14,11,15, + 10, +}; + +static float _vq_quantthresh__8u1__p4_0[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__8u1__p4_0[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__8u1__p4_0 = { + _vq_quantthresh__8u1__p4_0, + _vq_quantmap__8u1__p4_0, + 5, + 5 +}; + +static static_codebook _8u1__p4_0 = { + 4, 625, + _vq_lengthlist__8u1__p4_0, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__8u1__p4_0, + NULL, + &_vq_auxt__8u1__p4_0, + NULL, + 0 +}; + +static long _vq_quantlist__8u1__p5_0[] = { + 4, + 3, + 5, + 2, + 6, + 1, + 7, + 0, + 8, +}; + +static long _vq_lengthlist__8u1__p5_0[] = { + 1, 4, 4, 7, 7, 7, 7, 9, 9, 4, 6, 5, 8, 7, 8, 8, + 10,10, 4, 6, 6, 8, 8, 8, 8,10,10, 7, 8, 8, 9, 9, + 9, 9,11,11, 7, 8, 8, 9, 9, 9, 9,11,11, 8, 8, 8, + 9, 9,10,10,12,11, 8, 8, 8, 9, 9,10,10,11,11, 9, + 10,10,11,11,11,11,13,12, 9,10,10,11,11,12,12,12, + 13, +}; + +static float _vq_quantthresh__8u1__p5_0[] = { + -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, +}; + +static long _vq_quantmap__8u1__p5_0[] = { + 7, 5, 3, 1, 0, 2, 4, 6, + 8, +}; + +static encode_aux_threshmatch _vq_auxt__8u1__p5_0 = { + _vq_quantthresh__8u1__p5_0, + _vq_quantmap__8u1__p5_0, + 9, + 9 +}; + +static static_codebook _8u1__p5_0 = { + 2, 81, + _vq_lengthlist__8u1__p5_0, + 1, -531628032, 1611661312, 4, 0, + _vq_quantlist__8u1__p5_0, + NULL, + &_vq_auxt__8u1__p5_0, + NULL, + 0 +}; + +static long _vq_quantlist__8u1__p6_0[] = { + 4, + 3, + 5, + 2, + 6, + 1, + 7, + 0, + 8, +}; + +static long _vq_lengthlist__8u1__p6_0[] = { + 3, 4, 4, 6, 6, 7, 7, 9, 9, 4, 4, 5, 6, 6, 7, 7, + 9, 9, 4, 4, 4, 6, 6, 7, 7, 9, 9, 6, 6, 6, 7, 7, + 8, 8, 9, 9, 6, 6, 6, 7, 7, 8, 8, 9, 9, 7, 7, 7, + 8, 8, 8, 9,10,10, 7, 7, 7, 8, 8, 9, 8,10,10, 9, + 9, 9, 9, 9,10,10,10,10, 9, 9, 9, 9, 9,10,10,10, + 10, +}; + +static float _vq_quantthresh__8u1__p6_0[] = { + -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, +}; + +static long _vq_quantmap__8u1__p6_0[] = { + 7, 5, 3, 1, 0, 2, 4, 6, + 8, +}; + +static encode_aux_threshmatch _vq_auxt__8u1__p6_0 = { + _vq_quantthresh__8u1__p6_0, + _vq_quantmap__8u1__p6_0, + 9, + 9 +}; + +static static_codebook _8u1__p6_0 = { + 2, 81, + _vq_lengthlist__8u1__p6_0, + 1, -531628032, 1611661312, 4, 0, + _vq_quantlist__8u1__p6_0, + NULL, + &_vq_auxt__8u1__p6_0, + NULL, + 0 +}; + +static long _vq_quantlist__8u1__p7_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__8u1__p7_0[] = { + 1, 4, 4, 5, 7, 7, 5, 7, 7, 5, 9, 9, 8,10,10, 8, + 10,10, 5, 9, 9, 7,10,10, 8,10,10, 4,10,10, 9,12, + 12, 9,11,11, 7,12,11,10,11,13,10,13,13, 7,12,12, + 10,13,12,10,13,13, 4,10,10, 9,12,12, 9,12,12, 7, + 12,12,10,13,13,10,12,13, 7,11,12,10,13,13,10,13, + 11, +}; + +static float _vq_quantthresh__8u1__p7_0[] = { + -5.5, 5.5, +}; + +static long _vq_quantmap__8u1__p7_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__8u1__p7_0 = { + _vq_quantthresh__8u1__p7_0, + _vq_quantmap__8u1__p7_0, + 3, + 3 +}; + +static static_codebook _8u1__p7_0 = { + 4, 81, + _vq_lengthlist__8u1__p7_0, + 1, -529137664, 1618345984, 2, 0, + _vq_quantlist__8u1__p7_0, + NULL, + &_vq_auxt__8u1__p7_0, + NULL, + 0 +}; + +static long _vq_quantlist__8u1__p7_1[] = { + 5, + 4, + 6, + 3, + 7, + 2, + 8, + 1, + 9, + 0, + 10, +}; + +static long _vq_lengthlist__8u1__p7_1[] = { + 2, 4, 4, 6, 6, 7, 7, 8, 8, 8, 8, 4, 5, 5, 7, 7, + 8, 8, 9, 9, 9, 9, 4, 5, 5, 7, 7, 8, 8, 9, 9, 9, + 9, 6, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 6, 7, 7, 8, + 8, 8, 8, 9, 9, 9, 9, 8, 8, 8, 8, 8, 9, 9, 9, 9, + 9, 9, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 8, 9, 9, + 9, 9, 9, 9,10,10,10,10, 8, 9, 9, 9, 9, 9, 9,10, + 10,10,10, 8, 9, 9, 9, 9, 9, 9,10,10,10,10, 8, 9, + 9, 9, 9, 9, 9,10,10,10,10, +}; + +static float _vq_quantthresh__8u1__p7_1[] = { + -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, + 3.5, 4.5, +}; + +static long _vq_quantmap__8u1__p7_1[] = { + 9, 7, 5, 3, 1, 0, 2, 4, + 6, 8, 10, +}; + +static encode_aux_threshmatch _vq_auxt__8u1__p7_1 = { + _vq_quantthresh__8u1__p7_1, + _vq_quantmap__8u1__p7_1, + 11, + 11 +}; + +static static_codebook _8u1__p7_1 = { + 2, 121, + _vq_lengthlist__8u1__p7_1, + 1, -531365888, 1611661312, 4, 0, + _vq_quantlist__8u1__p7_1, + NULL, + &_vq_auxt__8u1__p7_1, + NULL, + 0 +}; + +static long _vq_quantlist__8u1__p8_0[] = { + 5, + 4, + 6, + 3, + 7, + 2, + 8, + 1, + 9, + 0, + 10, +}; + +static long _vq_lengthlist__8u1__p8_0[] = { + 1, 4, 4, 6, 6, 8, 8,10,10,11,11, 4, 6, 6, 7, 7, + 9, 9,11,11,13,12, 4, 6, 6, 7, 7, 9, 9,11,11,12, + 12, 6, 7, 7, 9, 9,11,11,12,12,13,13, 6, 7, 7, 9, + 9,11,11,12,12,13,13, 8, 9, 9,11,11,12,12,13,13, + 14,14, 8, 9, 9,11,11,12,12,13,13,14,14, 9,11,11, + 12,12,13,13,14,14,15,15, 9,11,11,12,12,13,13,14, + 14,15,14,11,12,12,13,13,14,14,15,15,16,16,11,12, + 12,13,13,14,14,15,15,15,15, +}; + +static float _vq_quantthresh__8u1__p8_0[] = { + -49.5, -38.5, -27.5, -16.5, -5.5, 5.5, 16.5, 27.5, + 38.5, 49.5, +}; + +static long _vq_quantmap__8u1__p8_0[] = { + 9, 7, 5, 3, 1, 0, 2, 4, + 6, 8, 10, +}; + +static encode_aux_threshmatch _vq_auxt__8u1__p8_0 = { + _vq_quantthresh__8u1__p8_0, + _vq_quantmap__8u1__p8_0, + 11, + 11 +}; + +static static_codebook _8u1__p8_0 = { + 2, 121, + _vq_lengthlist__8u1__p8_0, + 1, -524582912, 1618345984, 4, 0, + _vq_quantlist__8u1__p8_0, + NULL, + &_vq_auxt__8u1__p8_0, + NULL, + 0 +}; + +static long _vq_quantlist__8u1__p8_1[] = { + 5, + 4, + 6, + 3, + 7, + 2, + 8, + 1, + 9, + 0, + 10, +}; + +static long _vq_lengthlist__8u1__p8_1[] = { + 2, 5, 5, 6, 6, 7, 7, 7, 7, 8, 8, 5, 6, 6, 7, 7, + 7, 7, 8, 8, 8, 8, 5, 6, 6, 7, 7, 7, 7, 8, 8, 8, + 8, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 6, 7, 7, 7, + 7, 8, 8, 8, 8, 8, 8, 7, 7, 7, 8, 8, 8, 8, 8, 8, + 8, 8, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 9, 8, 9, 9, 7, 8, 8, 8, 8, 8, 8, 9, + 8, 9, 9, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 8, 8, + 8, 8, 8, 8, 8, 9, 9, 9, 9, +}; + +static float _vq_quantthresh__8u1__p8_1[] = { + -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, + 3.5, 4.5, +}; + +static long _vq_quantmap__8u1__p8_1[] = { + 9, 7, 5, 3, 1, 0, 2, 4, + 6, 8, 10, +}; + +static encode_aux_threshmatch _vq_auxt__8u1__p8_1 = { + _vq_quantthresh__8u1__p8_1, + _vq_quantmap__8u1__p8_1, + 11, + 11 +}; + +static static_codebook _8u1__p8_1 = { + 2, 121, + _vq_lengthlist__8u1__p8_1, + 1, -531365888, 1611661312, 4, 0, + _vq_quantlist__8u1__p8_1, + NULL, + &_vq_auxt__8u1__p8_1, + NULL, + 0 +}; + +static long _vq_quantlist__8u1__p9_0[] = { + 7, + 6, + 8, + 5, + 9, + 4, + 10, + 3, + 11, + 2, + 12, + 1, + 13, + 0, + 14, +}; + +static long _vq_lengthlist__8u1__p9_0[] = { + 1, 4, 4,11,11,11,11,11,11,11,11,11,11,11,11, 3, + 11, 8,11,11,11,11,11,11,11,11,11,11,11,11, 3, 9, + 9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10, +}; + +static float _vq_quantthresh__8u1__p9_0[] = { + -1657.5, -1402.5, -1147.5, -892.5, -637.5, -382.5, -127.5, 127.5, + 382.5, 637.5, 892.5, 1147.5, 1402.5, 1657.5, +}; + +static long _vq_quantmap__8u1__p9_0[] = { + 13, 11, 9, 7, 5, 3, 1, 0, + 2, 4, 6, 8, 10, 12, 14, +}; + +static encode_aux_threshmatch _vq_auxt__8u1__p9_0 = { + _vq_quantthresh__8u1__p9_0, + _vq_quantmap__8u1__p9_0, + 15, + 15 +}; + +static static_codebook _8u1__p9_0 = { + 2, 225, + _vq_lengthlist__8u1__p9_0, + 1, -514071552, 1627381760, 4, 0, + _vq_quantlist__8u1__p9_0, + NULL, + &_vq_auxt__8u1__p9_0, + NULL, + 0 +}; + +static long _vq_quantlist__8u1__p9_1[] = { + 7, + 6, + 8, + 5, + 9, + 4, + 10, + 3, + 11, + 2, + 12, + 1, + 13, + 0, + 14, +}; + +static long _vq_lengthlist__8u1__p9_1[] = { + 1, 4, 4, 7, 7, 9, 9, 7, 7, 8, 8,10,10,11,11, 4, + 7, 7, 9, 9,10,10, 8, 8,10,10,10,11,10,11, 4, 7, + 7, 9, 9,10,10, 8, 8,10, 9,11,11,11,11, 7, 9, 9, + 12,12,11,12,10,10,11,10,12,11,11,11, 7, 9, 9,11, + 11,13,12, 9, 9,11,10,11,11,12,11, 9,10,10,12,12, + 14,14,10,10,11,12,12,11,11,11, 9,10,11,11,13,14, + 13,10,11,11,11,12,11,12,12, 7, 8, 8,10, 9,11,10, + 11,12,12,11,12,14,12,13, 7, 8, 8, 9,10,10,11,12, + 12,12,11,12,12,12,13, 9, 9, 9,11,11,13,12,12,12, + 12,11,12,12,13,12, 8,10,10,11,10,11,12,12,12,12, + 12,12,14,12,12, 9,11,11,11,12,12,12,12,13,13,12, + 12,13,13,12,10,11,11,12,11,12,12,12,11,12,13,12, + 12,12,13,11,11,12,12,12,13,12,12,11,12,13,13,12, + 12,13,12,11,12,12,13,13,12,13,12,13,13,13,13,14, + 13, +}; + +static float _vq_quantthresh__8u1__p9_1[] = { + -110.5, -93.5, -76.5, -59.5, -42.5, -25.5, -8.5, 8.5, + 25.5, 42.5, 59.5, 76.5, 93.5, 110.5, +}; + +static long _vq_quantmap__8u1__p9_1[] = { + 13, 11, 9, 7, 5, 3, 1, 0, + 2, 4, 6, 8, 10, 12, 14, +}; + +static encode_aux_threshmatch _vq_auxt__8u1__p9_1 = { + _vq_quantthresh__8u1__p9_1, + _vq_quantmap__8u1__p9_1, + 15, + 15 +}; + +static static_codebook _8u1__p9_1 = { + 2, 225, + _vq_lengthlist__8u1__p9_1, + 1, -522338304, 1620115456, 4, 0, + _vq_quantlist__8u1__p9_1, + NULL, + &_vq_auxt__8u1__p9_1, + NULL, + 0 +}; + +static long _vq_quantlist__8u1__p9_2[] = { + 8, + 7, + 9, + 6, + 10, + 5, + 11, + 4, + 12, + 3, + 13, + 2, + 14, + 1, + 15, + 0, + 16, +}; + +static long _vq_lengthlist__8u1__p9_2[] = { + 2, 5, 4, 6, 6, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, + 9, 5, 6, 6, 7, 7, 8, 8, 9, 8, 9, 9, 9, 9, 9, 9, + 9, 9, 5, 6, 6, 7, 7, 8, 8, 8, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 7, 7, 7, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, + 9,10,10, 9, 7, 7, 7, 8, 8, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9,10,10, 8, 8, 8, 9, 9, 9, 9,10,10,10, 9, + 10,10,10,10,10,10, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, + 10,10,10,10,10,10,10, 9, 9, 9, 9, 9, 9, 9, 9,10, + 10,10,10,10,10,10,10,10, 9, 9, 9, 9, 9,10,10,10, + 10,10,10,10,10,10,10,10,10, 9, 9, 9, 9, 9, 9,10, + 10,10,10,10,10,10,10,10,10,10, 9, 9, 9, 9, 9,10, + 10,10,10,10,10,10,10,10,10,10,10, 9, 9, 9, 9,10, + 10,10,10,10,10,10,10,10,10,10,10,10, 9, 9, 9, 9, + 9,10,10,10,10,10,10,10,10,10,10,10,10, 9, 9, 9, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10, 9,10, + 9, 9, 9,10,10,10,10,10,10,10,10,10,10,10,10, 9, + 10, 9,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 9, 9,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10, +}; + +static float _vq_quantthresh__8u1__p9_2[] = { + -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, + 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, +}; + +static long _vq_quantmap__8u1__p9_2[] = { + 15, 13, 11, 9, 7, 5, 3, 1, + 0, 2, 4, 6, 8, 10, 12, 14, + 16, +}; + +static encode_aux_threshmatch _vq_auxt__8u1__p9_2 = { + _vq_quantthresh__8u1__p9_2, + _vq_quantmap__8u1__p9_2, + 17, + 17 +}; + +static static_codebook _8u1__p9_2 = { + 2, 289, + _vq_lengthlist__8u1__p9_2, + 1, -529530880, 1611661312, 5, 0, + _vq_quantlist__8u1__p9_2, + NULL, + &_vq_auxt__8u1__p9_2, + NULL, + 0 +}; + +static long _huff_lengthlist__8u1__single[] = { + 4, 7,13, 9,15, 9,16, 8,10,13, 7, 5, 8, 6, 9, 7, + 10, 7,10,11,11, 6, 7, 8, 8, 9, 9, 9,12,16, 8, 5, + 8, 6, 8, 6, 9, 7,10,12,11, 7, 7, 7, 6, 7, 7, 7, + 11,15, 7, 5, 8, 6, 7, 5, 7, 6, 9,13,13, 9, 9, 8, + 6, 6, 5, 5, 9,14, 8, 6, 8, 6, 6, 4, 5, 3, 5,13, + 9, 9,11, 8,10, 7, 8, 4, 5,12,11,16,17,15,17,12, + 13, 8, 8,15, +}; + +static static_codebook _huff_book__8u1__single = { + 2, 100, + _huff_lengthlist__8u1__single, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist__44u0__long[] = { + 5, 8,13,10,17,11,11,15, 7, 2, 4, 5, 8, 7, 9,16, + 13, 4, 3, 5, 6, 8,11,20,10, 4, 5, 5, 7, 6, 8,18, + 15, 7, 6, 7, 8,10,14,20,10, 6, 7, 6, 9, 7, 8,17, + 9, 8,10, 8,10, 5, 4,11,12,17,19,14,16,10, 7,12, +}; + +static static_codebook _huff_book__44u0__long = { + 2, 64, + _huff_lengthlist__44u0__long, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _vq_quantlist__44u0__p1_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__44u0__p1_0[] = { + 1, 4, 4, 5, 8, 7, 5, 7, 8, 5, 8, 8, 8,11,11, 8, + 10,10, 5, 8, 8, 8,11,10, 8,11,11, 4, 8, 8, 8,11, + 11, 8,11,11, 8,12,11,11,13,13,11,13,14, 7,11,11, + 10,13,12,11,13,14, 4, 8, 8, 8,11,11, 8,11,12, 8, + 11,11,11,13,13,10,12,13, 8,11,11,11,14,13,11,14, + 13, +}; + +static float _vq_quantthresh__44u0__p1_0[] = { + -0.5, 0.5, +}; + +static long _vq_quantmap__44u0__p1_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__44u0__p1_0 = { + _vq_quantthresh__44u0__p1_0, + _vq_quantmap__44u0__p1_0, + 3, + 3 +}; + +static static_codebook _44u0__p1_0 = { + 4, 81, + _vq_lengthlist__44u0__p1_0, + 1, -535822336, 1611661312, 2, 0, + _vq_quantlist__44u0__p1_0, + NULL, + &_vq_auxt__44u0__p1_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u0__p2_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__44u0__p2_0[] = { + 2, 4, 4, 5, 6, 6, 5, 6, 6, 5, 7, 7, 7, 8, 8, 6, + 8, 8, 5, 7, 7, 6, 8, 8, 7, 8, 8, 4, 7, 7, 7, 8, + 8, 7, 8, 8, 7, 8, 8, 8, 9,10, 8,10,10, 6, 8, 8, + 8,10, 8, 8,10,10, 5, 7, 7, 7, 8, 8, 7, 8, 8, 6, + 8, 8, 8,10,10, 8, 8,10, 6, 8, 8, 8,10,10, 8,10, + 9, +}; + +static float _vq_quantthresh__44u0__p2_0[] = { + -0.5, 0.5, +}; + +static long _vq_quantmap__44u0__p2_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__44u0__p2_0 = { + _vq_quantthresh__44u0__p2_0, + _vq_quantmap__44u0__p2_0, + 3, + 3 +}; + +static static_codebook _44u0__p2_0 = { + 4, 81, + _vq_lengthlist__44u0__p2_0, + 1, -535822336, 1611661312, 2, 0, + _vq_quantlist__44u0__p2_0, + NULL, + &_vq_auxt__44u0__p2_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u0__p3_0[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44u0__p3_0[] = { + 1, 5, 5, 8, 8, 5, 8, 7, 9, 9, 5, 7, 8, 9, 9, 9, + 10, 9,12,12, 9, 9,10,12,12, 6, 8, 8,11,10, 8,10, + 10,11,11, 8, 9,10,11,11,10,11,11,14,13,10,11,11, + 13,13, 5, 8, 8,10,10, 8,10,10,11,11, 8,10,10,11, + 11,10,11,11,13,13,10,11,11,13,13, 9,11,11,15,14, + 10,12,12,15,14,10,12,11,15,14,13,14,14,16,16,12, + 14,13,17,15, 9,11,11,14,15,10,11,12,14,16,10,11, + 12,14,16,12,13,14,16,16,13,13,15,15,18, 5, 8, 8, + 11,11, 8,10,10,12,12, 8,10,10,12,13,11,12,12,14, + 14,11,12,12,15,15, 8,10,10,13,13,10,12,12,13,13, + 10,12,12,14,14,12,13,13,15,15,12,13,13,16,16, 7, + 10,10,12,12,10,12,11,13,13,10,12,12,13,14,12,13, + 12,15,14,12,13,13,16,16,10,12,12,17,16,12,13,13, + 16,15,11,13,13,17,17,15,15,15,16,17,14,15,15,19, + 19,10,12,12,15,16,11,13,12,15,18,11,13,13,16,16, + 14,15,15,17,17,14,15,15,17,19, 5, 8, 8,11,11, 8, + 10,10,12,12, 8,10,10,12,12,11,12,12,16,15,11,12, + 12,14,15, 7,10,10,13,13,10,12,12,14,13,10,11,12, + 13,13,12,13,13,16,16,12,12,13,15,15, 8,10,10,13, + 13,10,12,12,14,14,10,12,12,13,13,12,13,13,16,16, + 12,13,13,15,15,10,12,12,16,15,11,13,13,17,16,11, + 12,13,16,15,13,15,15,19,17,14,15,14,17,16,10,12, + 12,16,16,11,13,13,16,17,12,13,13,15,17,14,15,15, + 17,19,14,15,15,17,17, 8,11,11,16,16,10,13,12,17, + 17,10,12,13,16,16,15,17,16,20,19,14,15,17,18,19, + 9,12,12,16,17,11,13,14,17,18,11,13,13,19,18,16, + 17,18,19,19,15,16,16,19,19, 9,12,12,16,17,11,14, + 13,18,17,11,13,13,17,17,16,17,16,20,19,14,16,16, + 18,18,12,15,15,19,17,14,15,16, 0,20,13,15,16,20, + 17,18,16,20, 0, 0,15,16,19,20, 0,12,15,14,18,19, + 13,16,15,20,19,13,16,15,20,18,17,18,17, 0,20,16, + 17,16, 0, 0, 8,11,11,16,15,10,12,12,17,17,10,13, + 13,17,16,14,16,15,18,20,15,16,16,19,19, 9,12,12, + 16,16,11,13,13,17,16,11,13,14,17,18,15,15,16,20, + 20,16,16,17,19,19, 9,13,12,16,17,11,14,13,17,17, + 11,14,14,18,17,14,16,15,18,19,16,17,18,18,19,12, + 14,15,19,18,13,15,16,18, 0,13,14,15, 0, 0,16,16, + 17,20, 0,17,17,20,20, 0,12,15,15,19,20,13,15,15, + 0, 0,14,16,15, 0, 0,15,18,16, 0, 0,17,18,16, 0, + 19, +}; + +static float _vq_quantthresh__44u0__p3_0[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__44u0__p3_0[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44u0__p3_0 = { + _vq_quantthresh__44u0__p3_0, + _vq_quantmap__44u0__p3_0, + 5, + 5 +}; + +static static_codebook _44u0__p3_0 = { + 4, 625, + _vq_lengthlist__44u0__p3_0, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__44u0__p3_0, + NULL, + &_vq_auxt__44u0__p3_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u0__p4_0[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44u0__p4_0[] = { + 4, 5, 5, 9, 9, 5, 6, 6, 9, 9, 5, 6, 6, 9, 9, 9, + 10, 9,12,12, 9, 9,10,12,12, 5, 7, 7,10,10, 7, 7, + 8,10,10, 6, 7, 8,10,10,10,10,10,11,13,10, 9,10, + 12,13, 5, 7, 7,10,10, 6, 8, 7,10,10, 7, 8, 7,10, + 10, 9,10,10,12,12,10,10,10,13,11, 9,10,10,13,13, + 10,11,10,13,13,10,10,10,13,13,12,12,13,14,14,12, + 12,13,14,14, 9,10,10,13,13,10,10,10,13,13,10,10, + 10,13,13,12,13,12,15,14,12,13,12,15,15, 5, 7, 6, + 10,10, 7, 8, 8,10,10, 7, 8, 8,10,10,10,11,10,13, + 13,10,10,10,12,12, 7, 8, 8,11,10, 8, 8, 9,10,11, + 8, 9, 9,11,11,11,10,11,11,14,11,11,11,13,13, 6, + 8, 8,10,10, 7, 9, 8,11,10, 8, 9, 9,11,11,10,11, + 10,14,11,10,11,11,13,13,10,11,11,14,13,10,10,11, + 14,13,10,11,11,14,14,12,11,13,12,16,13,14,14,15, + 15,10,10,11,13,14,10,11,10,14,13,10,11,11,14,14, + 12,13,12,15,13,13,13,14,15,16, 5, 7, 7,10,10, 7, + 8, 8,10,10, 7, 8, 8,10,10,10,10,10,13,13,10,10, + 11,12,13, 6, 8, 8,11,10, 8, 9, 9,11,11, 7, 8, 9, + 10,11,10,11,11,13,13,10,10,11,11,13, 6, 8, 8,10, + 11, 8, 9, 9,11,11, 8, 9, 8,12,10,10,11,11,13,13, + 10,11,10,14,11,10,10,10,14,13,10,11,11,14,13,10, + 10,11,13,13,12,14,14,16,16,12,12,13,13,15,10,11, + 11,13,14,10,11,11,14,15,10,11,10,13,13,13,14,13, + 16,16,12,13,11,15,12, 9,10,10,13,13,10,11,11,14, + 13,10,10,11,13,14,13,14,13,16,16,13,13,13,15,16, + 9,10,10,13,13,10,10,11,13,14,10,11,11,15,13,13, + 13,14,14,18,13,13,14,16,15, 9,10,10,13,14,10,11, + 10,14,13,10,11,11,13,14,13,14,13,16,15,13,13,14, + 15,16,12,13,12,16,14,11,11,13,15,15,13,14,13,16, + 15,15,12,16,12,17,14,15,15,17,17,12,13,13,14,16, + 11,13,11,16,15,12,13,14,15,16,14,15,13, 0,14,14, + 16,16, 0, 0, 9,10,10,13,13,10,11,10,14,14,10,11, + 11,13,13,12,13,13,14,16,13,14,14,16,16, 9,10,10, + 14,14,11,11,11,14,13,10,10,11,14,14,13,13,13,16, + 16,13,13,14,14,17, 9,10,10,13,14,10,11,11,13,15, + 10,11,10,14,14,13,13,13,14,17,13,14,13,17,14,12, + 13,13,16,14,13,14,13,16,15,12,12,13,15,16,15,15, + 16,18,16,15,13,15,14, 0,12,12,13,14,16,13,13,14, + 15,16,11,12,11,16,14,15,16,16,17,17,14,15,12,17, + 12, +}; + +static float _vq_quantthresh__44u0__p4_0[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__44u0__p4_0[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44u0__p4_0 = { + _vq_quantthresh__44u0__p4_0, + _vq_quantmap__44u0__p4_0, + 5, + 5 +}; + +static static_codebook _44u0__p4_0 = { + 4, 625, + _vq_lengthlist__44u0__p4_0, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__44u0__p4_0, + NULL, + &_vq_auxt__44u0__p4_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u0__p5_0[] = { + 4, + 3, + 5, + 2, + 6, + 1, + 7, + 0, + 8, +}; + +static long _vq_lengthlist__44u0__p5_0[] = { + 1, 4, 4, 7, 7, 7, 7, 9, 9, 4, 6, 6, 8, 8, 8, 8, + 9, 9, 4, 6, 6, 8, 8, 8, 8, 9, 9, 7, 8, 8, 9, 9, + 9, 9,11,10, 7, 8, 8, 9, 9, 9, 9,10,10, 7, 8, 8, + 9, 9,10,10,11,11, 7, 8, 8, 9, 9,10,10,11,11, 9, + 9, 9,10,10,11,11,12,12, 9, 9, 9,10,11,11,11,12, + 12, +}; + +static float _vq_quantthresh__44u0__p5_0[] = { + -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, +}; + +static long _vq_quantmap__44u0__p5_0[] = { + 7, 5, 3, 1, 0, 2, 4, 6, + 8, +}; + +static encode_aux_threshmatch _vq_auxt__44u0__p5_0 = { + _vq_quantthresh__44u0__p5_0, + _vq_quantmap__44u0__p5_0, + 9, + 9 +}; + +static static_codebook _44u0__p5_0 = { + 2, 81, + _vq_lengthlist__44u0__p5_0, + 1, -531628032, 1611661312, 4, 0, + _vq_quantlist__44u0__p5_0, + NULL, + &_vq_auxt__44u0__p5_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u0__p6_0[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__44u0__p6_0[] = { + 1, 4, 4, 6, 6, 8, 8,10, 9,11,10,14,13, 4, 6, 5, + 8, 8, 9, 9,11,10,11,11,14,14, 4, 5, 6, 8, 8, 9, + 9,10,10,11,11,14,14, 6, 8, 8, 9, 9,10,10,11,11, + 12,12,16,15, 7, 8, 8, 9, 9,10,10,11,11,12,12,15, + 15, 9,10,10,10,10,11,11,12,12,12,12,15,15, 9,10, + 9,10,11,11,11,12,12,12,13,15,15,10,10,11,11,11, + 12,12,13,12,13,13,16,15,10,11,11,11,11,12,12,13, + 12,13,13,16,17,11,11,12,12,12,13,13,13,14,14,15, + 17,17,11,11,12,12,12,13,13,13,14,14,14,16,18,14, + 15,15,15,15,16,16,16,16,17,18, 0, 0,14,15,15,15, + 15,17,16,17,18,17,17,18, 0, +}; + +static float _vq_quantthresh__44u0__p6_0[] = { + -27.5, -22.5, -17.5, -12.5, -7.5, -2.5, 2.5, 7.5, + 12.5, 17.5, 22.5, 27.5, +}; + +static long _vq_quantmap__44u0__p6_0[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__44u0__p6_0 = { + _vq_quantthresh__44u0__p6_0, + _vq_quantmap__44u0__p6_0, + 13, + 13 +}; + +static static_codebook _44u0__p6_0 = { + 2, 169, + _vq_lengthlist__44u0__p6_0, + 1, -526516224, 1616117760, 4, 0, + _vq_quantlist__44u0__p6_0, + NULL, + &_vq_auxt__44u0__p6_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u0__p6_1[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44u0__p6_1[] = { + 2, 4, 4, 5, 5, 4, 5, 5, 5, 5, 4, 5, 5, 5, 5, 5, + 6, 6, 6, 6, 5, 6, 6, 6, 6, +}; + +static float _vq_quantthresh__44u0__p6_1[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__44u0__p6_1[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44u0__p6_1 = { + _vq_quantthresh__44u0__p6_1, + _vq_quantmap__44u0__p6_1, + 5, + 5 +}; + +static static_codebook _44u0__p6_1 = { + 2, 25, + _vq_lengthlist__44u0__p6_1, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__44u0__p6_1, + NULL, + &_vq_auxt__44u0__p6_1, + NULL, + 0 +}; + +static long _vq_quantlist__44u0__p7_0[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44u0__p7_0[] = { + 1, 4, 4,11,11, 9,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11, 9,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10, +}; + +static float _vq_quantthresh__44u0__p7_0[] = { + -253.5, -84.5, 84.5, 253.5, +}; + +static long _vq_quantmap__44u0__p7_0[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44u0__p7_0 = { + _vq_quantthresh__44u0__p7_0, + _vq_quantmap__44u0__p7_0, + 5, + 5 +}; + +static static_codebook _44u0__p7_0 = { + 4, 625, + _vq_lengthlist__44u0__p7_0, + 1, -518709248, 1626677248, 3, 0, + _vq_quantlist__44u0__p7_0, + NULL, + &_vq_auxt__44u0__p7_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u0__p7_1[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__44u0__p7_1[] = { + 1, 4, 4, 6, 6, 6, 6, 7, 7, 8, 8, 9, 9, 5, 7, 7, + 8, 7, 7, 7, 9, 8,10, 9,10,11, 5, 7, 7, 8, 8, 7, + 7, 8, 9,10,10,11,11, 6, 8, 8, 9, 9, 9, 9,11,10, + 12,12,15,12, 6, 8, 8, 9, 9, 9, 9,11,11,12,11,14, + 12, 7, 8, 8,10,10,12,12,13,13,13,15,13,13, 7, 8, + 8,10,10,11,11,13,12,14,15,15,15, 9,10,10,11,12, + 13,13,14,15,14,15,14,15, 8,10,10,12,12,14,14,15, + 14,14,15,15,14,10,12,12,14,14,15,14,15,15,15,14, + 15,15,10,12,12,13,14,15,14,15,15,14,15,15,15,12, + 15,13,15,14,15,15,15,15,15,15,15,15,13,13,15,15, + 15,15,15,15,15,15,15,15,15, +}; + +static float _vq_quantthresh__44u0__p7_1[] = { + -71.5, -58.5, -45.5, -32.5, -19.5, -6.5, 6.5, 19.5, + 32.5, 45.5, 58.5, 71.5, +}; + +static long _vq_quantmap__44u0__p7_1[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__44u0__p7_1 = { + _vq_quantthresh__44u0__p7_1, + _vq_quantmap__44u0__p7_1, + 13, + 13 +}; + +static static_codebook _44u0__p7_1 = { + 2, 169, + _vq_lengthlist__44u0__p7_1, + 1, -523010048, 1618608128, 4, 0, + _vq_quantlist__44u0__p7_1, + NULL, + &_vq_auxt__44u0__p7_1, + NULL, + 0 +}; + +static long _vq_quantlist__44u0__p7_2[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__44u0__p7_2[] = { + 2, 5, 4, 6, 6, 7, 7, 8, 8, 8, 8, 9, 8, 5, 5, 6, + 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 5, 6, 5, 7, 7, 8, + 8, 8, 8, 9, 9, 9, 9, 6, 7, 7, 8, 8, 8, 8, 9, 8, + 9, 9, 9, 9, 6, 7, 7, 8, 7, 8, 8, 9, 9, 9, 9, 9, + 9, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 7, 8, + 8, 9, 8, 9, 8, 9, 9, 9, 9, 9, 9, 8, 9, 8, 9, 9, + 9, 9, 9, 9, 9, 9,10,10, 8, 8, 9, 9, 9, 9, 9, 9, + 9, 9,10, 9,10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9,10,10,10, 9, 9, 9, 9, 9, + 9, 9, 9,10, 9, 9,10,10, 9, +}; + +static float _vq_quantthresh__44u0__p7_2[] = { + -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, + 2.5, 3.5, 4.5, 5.5, +}; + +static long _vq_quantmap__44u0__p7_2[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__44u0__p7_2 = { + _vq_quantthresh__44u0__p7_2, + _vq_quantmap__44u0__p7_2, + 13, + 13 +}; + +static static_codebook _44u0__p7_2 = { + 2, 169, + _vq_lengthlist__44u0__p7_2, + 1, -531103744, 1611661312, 4, 0, + _vq_quantlist__44u0__p7_2, + NULL, + &_vq_auxt__44u0__p7_2, + NULL, + 0 +}; + +static long _huff_lengthlist__44u0__short[] = { + 12,13,14,13,17,12,15,17, 5, 5, 6,10,10,11,15,16, + 4, 3, 3, 7, 5, 7,10,16, 7, 7, 7,10, 9,11,12,16, + 6, 5, 5, 9, 5, 6,10,16, 8, 7, 7, 9, 6, 7, 9,16, + 11, 7, 3, 6, 4, 5, 8,16,12, 9, 4, 8, 5, 7, 9,16, +}; + +static static_codebook _huff_book__44u0__short = { + 2, 64, + _huff_lengthlist__44u0__short, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist__44u1__long[] = { + 5, 8,13,10,17,11,11,15, 7, 2, 4, 5, 8, 7, 9,16, + 13, 4, 3, 5, 6, 8,11,20,10, 4, 5, 5, 7, 6, 8,18, + 15, 7, 6, 7, 8,10,14,20,10, 6, 7, 6, 9, 7, 8,17, + 9, 8,10, 8,10, 5, 4,11,12,17,19,14,16,10, 7,12, +}; + +static static_codebook _huff_book__44u1__long = { + 2, 64, + _huff_lengthlist__44u1__long, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _vq_quantlist__44u1__p1_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__44u1__p1_0[] = { + 1, 4, 4, 5, 8, 7, 5, 7, 8, 5, 8, 8, 8,11,11, 8, + 10,10, 5, 8, 8, 8,11,10, 8,11,11, 4, 8, 8, 8,11, + 11, 8,11,11, 8,12,11,11,13,13,11,13,14, 7,11,11, + 10,13,12,11,13,14, 4, 8, 8, 8,11,11, 8,11,12, 8, + 11,11,11,13,13,10,12,13, 8,11,11,11,14,13,11,14, + 13, +}; + +static float _vq_quantthresh__44u1__p1_0[] = { + -0.5, 0.5, +}; + +static long _vq_quantmap__44u1__p1_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__44u1__p1_0 = { + _vq_quantthresh__44u1__p1_0, + _vq_quantmap__44u1__p1_0, + 3, + 3 +}; + +static static_codebook _44u1__p1_0 = { + 4, 81, + _vq_lengthlist__44u1__p1_0, + 1, -535822336, 1611661312, 2, 0, + _vq_quantlist__44u1__p1_0, + NULL, + &_vq_auxt__44u1__p1_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u1__p2_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__44u1__p2_0[] = { + 2, 4, 4, 5, 6, 6, 5, 6, 6, 5, 7, 7, 7, 8, 8, 6, + 8, 8, 5, 7, 7, 6, 8, 8, 7, 8, 8, 4, 7, 7, 7, 8, + 8, 7, 8, 8, 7, 8, 8, 8, 9,10, 8,10,10, 6, 8, 8, + 8,10, 8, 8,10,10, 5, 7, 7, 7, 8, 8, 7, 8, 8, 6, + 8, 8, 8,10,10, 8, 8,10, 6, 8, 8, 8,10,10, 8,10, + 9, +}; + +static float _vq_quantthresh__44u1__p2_0[] = { + -0.5, 0.5, +}; + +static long _vq_quantmap__44u1__p2_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__44u1__p2_0 = { + _vq_quantthresh__44u1__p2_0, + _vq_quantmap__44u1__p2_0, + 3, + 3 +}; + +static static_codebook _44u1__p2_0 = { + 4, 81, + _vq_lengthlist__44u1__p2_0, + 1, -535822336, 1611661312, 2, 0, + _vq_quantlist__44u1__p2_0, + NULL, + &_vq_auxt__44u1__p2_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u1__p3_0[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44u1__p3_0[] = { + 1, 5, 5, 8, 8, 5, 8, 7, 9, 9, 5, 7, 8, 9, 9, 9, + 10, 9,12,12, 9, 9,10,12,12, 6, 8, 8,11,10, 8,10, + 10,11,11, 8, 9,10,11,11,10,11,11,14,13,10,11,11, + 13,13, 5, 8, 8,10,10, 8,10,10,11,11, 8,10,10,11, + 11,10,11,11,13,13,10,11,11,13,13, 9,11,11,15,14, + 10,12,12,15,14,10,12,11,15,14,13,14,14,16,16,12, + 14,13,17,15, 9,11,11,14,15,10,11,12,14,16,10,11, + 12,14,16,12,13,14,16,16,13,13,15,15,18, 5, 8, 8, + 11,11, 8,10,10,12,12, 8,10,10,12,13,11,12,12,14, + 14,11,12,12,15,15, 8,10,10,13,13,10,12,12,13,13, + 10,12,12,14,14,12,13,13,15,15,12,13,13,16,16, 7, + 10,10,12,12,10,12,11,13,13,10,12,12,13,14,12,13, + 12,15,14,12,13,13,16,16,10,12,12,17,16,12,13,13, + 16,15,11,13,13,17,17,15,15,15,16,17,14,15,15,19, + 19,10,12,12,15,16,11,13,12,15,18,11,13,13,16,16, + 14,15,15,17,17,14,15,15,17,19, 5, 8, 8,11,11, 8, + 10,10,12,12, 8,10,10,12,12,11,12,12,16,15,11,12, + 12,14,15, 7,10,10,13,13,10,12,12,14,13,10,11,12, + 13,13,12,13,13,16,16,12,12,13,15,15, 8,10,10,13, + 13,10,12,12,14,14,10,12,12,13,13,12,13,13,16,16, + 12,13,13,15,15,10,12,12,16,15,11,13,13,17,16,11, + 12,13,16,15,13,15,15,19,17,14,15,14,17,16,10,12, + 12,16,16,11,13,13,16,17,12,13,13,15,17,14,15,15, + 17,19,14,15,15,17,17, 8,11,11,16,16,10,13,12,17, + 17,10,12,13,16,16,15,17,16,20,19,14,15,17,18,19, + 9,12,12,16,17,11,13,14,17,18,11,13,13,19,18,16, + 17,18,19,19,15,16,16,19,19, 9,12,12,16,17,11,14, + 13,18,17,11,13,13,17,17,16,17,16,20,19,14,16,16, + 18,18,12,15,15,19,17,14,15,16, 0,20,13,15,16,20, + 17,18,16,20, 0, 0,15,16,19,20, 0,12,15,14,18,19, + 13,16,15,20,19,13,16,15,20,18,17,18,17, 0,20,16, + 17,16, 0, 0, 8,11,11,16,15,10,12,12,17,17,10,13, + 13,17,16,14,16,15,18,20,15,16,16,19,19, 9,12,12, + 16,16,11,13,13,17,16,11,13,14,17,18,15,15,16,20, + 20,16,16,17,19,19, 9,13,12,16,17,11,14,13,17,17, + 11,14,14,18,17,14,16,15,18,19,16,17,18,18,19,12, + 14,15,19,18,13,15,16,18, 0,13,14,15, 0, 0,16,16, + 17,20, 0,17,17,20,20, 0,12,15,15,19,20,13,15,15, + 0, 0,14,16,15, 0, 0,15,18,16, 0, 0,17,18,16, 0, + 19, +}; + +static float _vq_quantthresh__44u1__p3_0[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__44u1__p3_0[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44u1__p3_0 = { + _vq_quantthresh__44u1__p3_0, + _vq_quantmap__44u1__p3_0, + 5, + 5 +}; + +static static_codebook _44u1__p3_0 = { + 4, 625, + _vq_lengthlist__44u1__p3_0, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__44u1__p3_0, + NULL, + &_vq_auxt__44u1__p3_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u1__p4_0[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44u1__p4_0[] = { + 4, 5, 5, 9, 9, 5, 6, 6, 9, 9, 5, 6, 6, 9, 9, 9, + 10, 9,12,12, 9, 9,10,12,12, 5, 7, 7,10,10, 7, 7, + 8,10,10, 6, 7, 8,10,10,10,10,10,11,13,10, 9,10, + 12,13, 5, 7, 7,10,10, 6, 8, 7,10,10, 7, 8, 7,10, + 10, 9,10,10,12,12,10,10,10,13,11, 9,10,10,13,13, + 10,11,10,13,13,10,10,10,13,13,12,12,13,14,14,12, + 12,13,14,14, 9,10,10,13,13,10,10,10,13,13,10,10, + 10,13,13,12,13,12,15,14,12,13,12,15,15, 5, 7, 6, + 10,10, 7, 8, 8,10,10, 7, 8, 8,10,10,10,11,10,13, + 13,10,10,10,12,12, 7, 8, 8,11,10, 8, 8, 9,10,11, + 8, 9, 9,11,11,11,10,11,11,14,11,11,11,13,13, 6, + 8, 8,10,10, 7, 9, 8,11,10, 8, 9, 9,11,11,10,11, + 10,14,11,10,11,11,13,13,10,11,11,14,13,10,10,11, + 14,13,10,11,11,14,14,12,11,13,12,16,13,14,14,15, + 15,10,10,11,13,14,10,11,10,14,13,10,11,11,14,14, + 12,13,12,15,13,13,13,14,15,16, 5, 7, 7,10,10, 7, + 8, 8,10,10, 7, 8, 8,10,10,10,10,10,13,13,10,10, + 11,12,13, 6, 8, 8,11,10, 8, 9, 9,11,11, 7, 8, 9, + 10,11,10,11,11,13,13,10,10,11,11,13, 6, 8, 8,10, + 11, 8, 9, 9,11,11, 8, 9, 8,12,10,10,11,11,13,13, + 10,11,10,14,11,10,10,10,14,13,10,11,11,14,13,10, + 10,11,13,13,12,14,14,16,16,12,12,13,13,15,10,11, + 11,13,14,10,11,11,14,15,10,11,10,13,13,13,14,13, + 16,16,12,13,11,15,12, 9,10,10,13,13,10,11,11,14, + 13,10,10,11,13,14,13,14,13,16,16,13,13,13,15,16, + 9,10,10,13,13,10,10,11,13,14,10,11,11,15,13,13, + 13,14,14,18,13,13,14,16,15, 9,10,10,13,14,10,11, + 10,14,13,10,11,11,13,14,13,14,13,16,15,13,13,14, + 15,16,12,13,12,16,14,11,11,13,15,15,13,14,13,16, + 15,15,12,16,12,17,14,15,15,17,17,12,13,13,14,16, + 11,13,11,16,15,12,13,14,15,16,14,15,13, 0,14,14, + 16,16, 0, 0, 9,10,10,13,13,10,11,10,14,14,10,11, + 11,13,13,12,13,13,14,16,13,14,14,16,16, 9,10,10, + 14,14,11,11,11,14,13,10,10,11,14,14,13,13,13,16, + 16,13,13,14,14,17, 9,10,10,13,14,10,11,11,13,15, + 10,11,10,14,14,13,13,13,14,17,13,14,13,17,14,12, + 13,13,16,14,13,14,13,16,15,12,12,13,15,16,15,15, + 16,18,16,15,13,15,14, 0,12,12,13,14,16,13,13,14, + 15,16,11,12,11,16,14,15,16,16,17,17,14,15,12,17, + 12, +}; + +static float _vq_quantthresh__44u1__p4_0[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__44u1__p4_0[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44u1__p4_0 = { + _vq_quantthresh__44u1__p4_0, + _vq_quantmap__44u1__p4_0, + 5, + 5 +}; + +static static_codebook _44u1__p4_0 = { + 4, 625, + _vq_lengthlist__44u1__p4_0, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__44u1__p4_0, + NULL, + &_vq_auxt__44u1__p4_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u1__p5_0[] = { + 4, + 3, + 5, + 2, + 6, + 1, + 7, + 0, + 8, +}; + +static long _vq_lengthlist__44u1__p5_0[] = { + 1, 4, 4, 7, 7, 7, 7, 9, 9, 4, 6, 6, 8, 8, 8, 8, + 9, 9, 4, 6, 6, 8, 8, 8, 8, 9, 9, 7, 8, 8, 9, 9, + 9, 9,11,10, 7, 8, 8, 9, 9, 9, 9,10,10, 7, 8, 8, + 9, 9,10,10,11,11, 7, 8, 8, 9, 9,10,10,11,11, 9, + 9, 9,10,10,11,11,12,12, 9, 9, 9,10,11,11,11,12, + 12, +}; + +static float _vq_quantthresh__44u1__p5_0[] = { + -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, +}; + +static long _vq_quantmap__44u1__p5_0[] = { + 7, 5, 3, 1, 0, 2, 4, 6, + 8, +}; + +static encode_aux_threshmatch _vq_auxt__44u1__p5_0 = { + _vq_quantthresh__44u1__p5_0, + _vq_quantmap__44u1__p5_0, + 9, + 9 +}; + +static static_codebook _44u1__p5_0 = { + 2, 81, + _vq_lengthlist__44u1__p5_0, + 1, -531628032, 1611661312, 4, 0, + _vq_quantlist__44u1__p5_0, + NULL, + &_vq_auxt__44u1__p5_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u1__p6_0[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__44u1__p6_0[] = { + 1, 4, 4, 6, 6, 8, 8,10, 9,11,10,14,13, 4, 6, 5, + 8, 8, 9, 9,11,10,11,11,14,14, 4, 5, 6, 8, 8, 9, + 9,10,10,11,11,14,14, 6, 8, 8, 9, 9,10,10,11,11, + 12,12,16,15, 7, 8, 8, 9, 9,10,10,11,11,12,12,15, + 15, 9,10,10,10,10,11,11,12,12,12,12,15,15, 9,10, + 9,10,11,11,11,12,12,12,13,15,15,10,10,11,11,11, + 12,12,13,12,13,13,16,15,10,11,11,11,11,12,12,13, + 12,13,13,16,17,11,11,12,12,12,13,13,13,14,14,15, + 17,17,11,11,12,12,12,13,13,13,14,14,14,16,18,14, + 15,15,15,15,16,16,16,16,17,18, 0, 0,14,15,15,15, + 15,17,16,17,18,17,17,18, 0, +}; + +static float _vq_quantthresh__44u1__p6_0[] = { + -27.5, -22.5, -17.5, -12.5, -7.5, -2.5, 2.5, 7.5, + 12.5, 17.5, 22.5, 27.5, +}; + +static long _vq_quantmap__44u1__p6_0[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__44u1__p6_0 = { + _vq_quantthresh__44u1__p6_0, + _vq_quantmap__44u1__p6_0, + 13, + 13 +}; + +static static_codebook _44u1__p6_0 = { + 2, 169, + _vq_lengthlist__44u1__p6_0, + 1, -526516224, 1616117760, 4, 0, + _vq_quantlist__44u1__p6_0, + NULL, + &_vq_auxt__44u1__p6_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u1__p6_1[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44u1__p6_1[] = { + 2, 4, 4, 5, 5, 4, 5, 5, 5, 5, 4, 5, 5, 5, 5, 5, + 6, 6, 6, 6, 5, 6, 6, 6, 6, +}; + +static float _vq_quantthresh__44u1__p6_1[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__44u1__p6_1[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44u1__p6_1 = { + _vq_quantthresh__44u1__p6_1, + _vq_quantmap__44u1__p6_1, + 5, + 5 +}; + +static static_codebook _44u1__p6_1 = { + 2, 25, + _vq_lengthlist__44u1__p6_1, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__44u1__p6_1, + NULL, + &_vq_auxt__44u1__p6_1, + NULL, + 0 +}; + +static long _vq_quantlist__44u1__p7_0[] = { + 3, + 2, + 4, + 1, + 5, + 0, + 6, +}; + +static long _vq_lengthlist__44u1__p7_0[] = { + 1, 3, 2, 9, 9, 7, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, +}; + +static float _vq_quantthresh__44u1__p7_0[] = { + -422.5, -253.5, -84.5, 84.5, 253.5, 422.5, +}; + +static long _vq_quantmap__44u1__p7_0[] = { + 5, 3, 1, 0, 2, 4, 6, +}; + +static encode_aux_threshmatch _vq_auxt__44u1__p7_0 = { + _vq_quantthresh__44u1__p7_0, + _vq_quantmap__44u1__p7_0, + 7, + 7 +}; + +static static_codebook _44u1__p7_0 = { + 2, 49, + _vq_lengthlist__44u1__p7_0, + 1, -518017024, 1626677248, 3, 0, + _vq_quantlist__44u1__p7_0, + NULL, + &_vq_auxt__44u1__p7_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u1__p7_1[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__44u1__p7_1[] = { + 1, 4, 4, 6, 6, 6, 6, 7, 7, 8, 8, 9, 9, 5, 7, 7, + 8, 7, 7, 7, 9, 8,10, 9,10,11, 5, 7, 7, 8, 8, 7, + 7, 8, 9,10,10,11,11, 6, 8, 8, 9, 9, 9, 9,11,10, + 12,12,15,12, 6, 8, 8, 9, 9, 9, 9,11,11,12,11,14, + 12, 7, 8, 8,10,10,12,12,13,13,13,15,13,13, 7, 8, + 8,10,10,11,11,13,12,14,15,15,15, 9,10,10,11,12, + 13,13,14,15,14,15,14,15, 8,10,10,12,12,14,14,15, + 14,14,15,15,14,10,12,12,14,14,15,14,15,15,15,14, + 15,15,10,12,12,13,14,15,14,15,15,14,15,15,15,12, + 15,13,15,14,15,15,15,15,15,15,15,15,13,13,15,15, + 15,15,15,15,15,15,15,15,15, +}; + +static float _vq_quantthresh__44u1__p7_1[] = { + -71.5, -58.5, -45.5, -32.5, -19.5, -6.5, 6.5, 19.5, + 32.5, 45.5, 58.5, 71.5, +}; + +static long _vq_quantmap__44u1__p7_1[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__44u1__p7_1 = { + _vq_quantthresh__44u1__p7_1, + _vq_quantmap__44u1__p7_1, + 13, + 13 +}; + +static static_codebook _44u1__p7_1 = { + 2, 169, + _vq_lengthlist__44u1__p7_1, + 1, -523010048, 1618608128, 4, 0, + _vq_quantlist__44u1__p7_1, + NULL, + &_vq_auxt__44u1__p7_1, + NULL, + 0 +}; + +static long _vq_quantlist__44u1__p7_2[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__44u1__p7_2[] = { + 2, 5, 4, 6, 6, 7, 7, 8, 8, 8, 8, 9, 8, 5, 5, 6, + 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 5, 6, 5, 7, 7, 8, + 8, 8, 8, 9, 9, 9, 9, 6, 7, 7, 8, 8, 8, 8, 9, 8, + 9, 9, 9, 9, 6, 7, 7, 8, 7, 8, 8, 9, 9, 9, 9, 9, + 9, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 7, 8, + 8, 9, 8, 9, 8, 9, 9, 9, 9, 9, 9, 8, 9, 8, 9, 9, + 9, 9, 9, 9, 9, 9,10,10, 8, 8, 9, 9, 9, 9, 9, 9, + 9, 9,10, 9,10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9,10,10,10, 9, 9, 9, 9, 9, + 9, 9, 9,10, 9, 9,10,10, 9, +}; + +static float _vq_quantthresh__44u1__p7_2[] = { + -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, + 2.5, 3.5, 4.5, 5.5, +}; + +static long _vq_quantmap__44u1__p7_2[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__44u1__p7_2 = { + _vq_quantthresh__44u1__p7_2, + _vq_quantmap__44u1__p7_2, + 13, + 13 +}; + +static static_codebook _44u1__p7_2 = { + 2, 169, + _vq_lengthlist__44u1__p7_2, + 1, -531103744, 1611661312, 4, 0, + _vq_quantlist__44u1__p7_2, + NULL, + &_vq_auxt__44u1__p7_2, + NULL, + 0 +}; + +static long _huff_lengthlist__44u1__short[] = { + 12,13,14,13,17,12,15,17, 5, 5, 6,10,10,11,15,16, + 4, 3, 3, 7, 5, 7,10,16, 7, 7, 7,10, 9,11,12,16, + 6, 5, 5, 9, 5, 6,10,16, 8, 7, 7, 9, 6, 7, 9,16, + 11, 7, 3, 6, 4, 5, 8,16,12, 9, 4, 8, 5, 7, 9,16, +}; + +static static_codebook _huff_book__44u1__short = { + 2, 64, + _huff_lengthlist__44u1__short, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist__44u2__long[] = { + 5, 9,14,12,15,13,10,13, 7, 4, 5, 6, 8, 7, 8,12, + 13, 4, 3, 5, 5, 6, 9,15,12, 6, 5, 6, 6, 6, 7,14, + 14, 7, 4, 6, 4, 6, 8,15,12, 6, 6, 5, 5, 5, 6,14, + 9, 7, 8, 6, 7, 5, 4,10,10,13,14,14,15,10, 6, 8, +}; + +static static_codebook _huff_book__44u2__long = { + 2, 64, + _huff_lengthlist__44u2__long, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _vq_quantlist__44u2__p1_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__44u2__p1_0[] = { + 1, 4, 4, 5, 8, 7, 5, 7, 8, 5, 8, 8, 8,11,11, 8, + 10,11, 5, 8, 8, 8,11,10, 8,11,11, 4, 8, 8, 8,11, + 11, 8,11,11, 8,11,11,11,13,14,11,13,13, 7,11,11, + 10,13,12,11,14,14, 4, 8, 8, 8,11,11, 8,11,11, 8, + 11,11,11,14,13,10,12,13, 8,11,11,11,13,13,11,13, + 13, +}; + +static float _vq_quantthresh__44u2__p1_0[] = { + -0.5, 0.5, +}; + +static long _vq_quantmap__44u2__p1_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__44u2__p1_0 = { + _vq_quantthresh__44u2__p1_0, + _vq_quantmap__44u2__p1_0, + 3, + 3 +}; + +static static_codebook _44u2__p1_0 = { + 4, 81, + _vq_lengthlist__44u2__p1_0, + 1, -535822336, 1611661312, 2, 0, + _vq_quantlist__44u2__p1_0, + NULL, + &_vq_auxt__44u2__p1_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u2__p2_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__44u2__p2_0[] = { + 2, 5, 5, 5, 6, 6, 5, 6, 6, 5, 6, 6, 7, 8, 8, 6, + 8, 8, 5, 6, 6, 6, 8, 7, 7, 8, 8, 5, 6, 6, 7, 8, + 8, 6, 8, 8, 6, 8, 8, 8, 9,10, 8,10,10, 6, 8, 8, + 7,10, 8, 8,10,10, 5, 6, 6, 6, 8, 8, 7, 8, 8, 6, + 8, 8, 8,10,10, 8, 8,10, 6, 8, 8, 8,10,10, 8,10, + 9, +}; + +static float _vq_quantthresh__44u2__p2_0[] = { + -0.5, 0.5, +}; + +static long _vq_quantmap__44u2__p2_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__44u2__p2_0 = { + _vq_quantthresh__44u2__p2_0, + _vq_quantmap__44u2__p2_0, + 3, + 3 +}; + +static static_codebook _44u2__p2_0 = { + 4, 81, + _vq_lengthlist__44u2__p2_0, + 1, -535822336, 1611661312, 2, 0, + _vq_quantlist__44u2__p2_0, + NULL, + &_vq_auxt__44u2__p2_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u2__p3_0[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44u2__p3_0[] = { + 2, 4, 4, 7, 8, 5, 7, 7, 9, 9, 5, 7, 7, 9, 9, 8, + 9, 9,12,11, 8, 9, 9,11,12, 5, 7, 7,10,10, 7, 9, + 9,11,11, 7, 9, 9,10,11,10,11,11,13,13, 9,10,11, + 12,13, 5, 7, 7,10,10, 7, 9, 9,11,10, 7, 9, 9,11, + 11, 9,11,10,13,13,10,11,11,13,13, 8,10,10,14,13, + 10,11,11,15,14, 9,11,11,15,14,13,14,13,16,14,12, + 13,13,15,16, 8,10,10,13,14, 9,11,11,14,15,10,11, + 11,14,15,12,13,13,15,15,12,13,14,15,16, 5, 7, 7, + 10,10, 7, 9, 9,11,11, 7, 9, 9,11,12,10,11,11,14, + 13,10,11,11,14,14, 7, 9, 9,12,12, 9,11,11,13,13, + 9,11,11,13,13,12,13,12,14,14,11,12,13,15,15, 7, + 9, 9,12,12, 8,11,10,13,12, 9,11,11,13,13,11,13, + 12,15,13,11,13,13,15,16, 9,12,11,15,15,11,12,12, + 16,15,11,12,13,16,16,13,14,15,16,15,13,15,15,17, + 17, 9,11,11,14,15,10,12,12,15,15,11,13,12,15,16, + 13,15,14,16,16,13,15,15,17,19, 5, 7, 7,10,10, 7, + 9, 9,12,11, 7, 9, 9,11,11,10,11,11,14,14,10,11, + 11,13,14, 7, 9, 9,12,12, 9,11,11,13,13, 9,10,11, + 12,13,11,13,12,16,15,11,12,12,14,15, 7, 9, 9,12, + 12, 9,11,11,13,13, 9,11,11,13,12,11,13,12,15,16, + 12,13,13,15,14, 9,11,11,15,14,11,13,12,16,15,10, + 11,12,15,15,13,14,14,18,17,13,14,14,15,17,10,11, + 11,14,15,11,13,12,15,17,11,13,12,15,16,13,15,14, + 18,17,14,15,15,16,18, 7,10,10,14,14,10,12,12,15, + 15,10,12,12,15,15,14,15,15,18,17,13,15,15,16,16, + 9,11,11,16,15,11,13,13,16,18,11,13,13,16,16,15, + 16,16, 0, 0,14,15,16,18,17, 9,11,11,15,15,10,13, + 12,17,16,11,12,13,16,17,14,15,16,19,19,14,15,15, + 0,20,12,14,14, 0, 0,13,14,16,19,18,13,15,16,20, + 17,16,18, 0, 0, 0,15,16,17,18,19,11,14,14, 0,19, + 12,15,14,17,17,13,15,15, 0, 0,16,17,15,20,19,15, + 17,16,19, 0, 8,10,10,14,15,10,12,11,15,15,10,11, + 12,16,15,13,14,14,19,17,14,15,15, 0, 0, 9,11,11, + 16,15,11,13,13,17,16,10,12,13,16,17,14,15,15,18, + 18,14,15,16,20,19, 9,12,12, 0,15,11,13,13,16,17, + 11,13,13,19,17,14,16,16,18,17,15,16,16,17,19,11, + 14,14,18,18,13,14,15, 0, 0,12,14,15,19,18,15,16, + 19, 0,19,15,16,19,19,17,12,14,14,16,19,13,15,15, + 0,17,13,15,14,18,18,15,16,15, 0,18,16,17,17, 0, + 0, +}; + +static float _vq_quantthresh__44u2__p3_0[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__44u2__p3_0[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44u2__p3_0 = { + _vq_quantthresh__44u2__p3_0, + _vq_quantmap__44u2__p3_0, + 5, + 5 +}; + +static static_codebook _44u2__p3_0 = { + 4, 625, + _vq_lengthlist__44u2__p3_0, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__44u2__p3_0, + NULL, + &_vq_auxt__44u2__p3_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u2__p4_0[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44u2__p4_0[] = { + 4, 5, 5, 8, 8, 5, 7, 6, 9, 9, 5, 6, 7, 9, 9, 9, + 9, 9,11,11, 9, 9, 9,11,11, 5, 7, 7, 9, 9, 7, 8, + 8,10,10, 7, 7, 8,10,10,10,10,10,11,12, 9,10,10, + 11,12, 5, 7, 7, 9, 9, 6, 8, 7,10,10, 7, 8, 8,10, + 10, 9,10,10,12,11, 9,10,10,12,11, 9,10,10,12,12, + 10,10,10,13,12, 9,10,10,12,13,12,12,12,14,14,11, + 12,12,13,14, 9,10,10,12,12, 9,10,10,12,13,10,10, + 10,12,13,11,12,12,14,13,12,12,12,14,13, 5, 7, 7, + 10, 9, 7, 8, 8,10,10, 7, 8, 8,10,10,10,10,10,12, + 12,10,10,10,12,12, 7, 8, 8,11,10, 8, 8, 9,11,11, + 8, 9, 9,11,11,10,11,11,12,13,10,11,11,13,13, 6, + 8, 8,10,10, 7, 9, 8,11,10, 8, 9, 9,11,11,10,11, + 10,13,11,10,11,11,13,13, 9,10,10,13,13,10,11,11, + 13,13,10,11,11,14,13,12,11,13,12,15,12,13,13,15, + 15, 9,10,10,12,13,10,11,10,13,13,10,11,11,13,13, + 12,13,11,15,13,12,13,13,15,15, 5, 7, 7, 9,10, 7, + 8, 8,10,10, 7, 8, 8,10,10,10,10,10,12,12,10,10, + 11,12,12, 6, 8, 8,10,10, 8, 9, 9,11,11, 7, 8, 9, + 10,11,10,11,11,13,13,10,10,11,11,13, 7, 8, 8,10, + 11, 8, 9, 9,11,11, 8, 9, 8,11,11,10,11,11,13,13, + 10,11,11,13,12, 9,10,10,13,12,10,11,11,14,13,10, + 10,11,13,13,12,13,13,15,15,12,11,13,12,14, 9,10, + 10,12,13,10,11,11,13,14,10,11,11,13,13,12,13,13, + 15,15,12,13,12,15,12, 8, 9, 9,12,12, 9,11,10,13, + 13, 9,10,10,13,13,12,13,13,15,15,12,12,12,14,14, + 9,10,10,13,13,10,11,11,13,14,10,11,11,14,12,13, + 13,14,14,16,12,13,13,15,14, 9,10,10,13,13,10,11, + 10,14,13,10,11,11,13,14,12,14,13,16,14,13,13,13, + 14,15,11,13,12,15,14,11,12,13,14,15,12,13,13,16, + 15,14,12,15,12,16,14,15,15,17,16,11,12,12,14,15, + 11,13,11,15,14,12,13,13,15,16,13,15,12,17,13,14, + 15,15,16,16, 8, 9, 9,12,12, 9,10,10,13,13, 9,10, + 10,13,13,12,13,12,14,14,12,13,13,15,15, 9,10,10, + 13,13,10,11,11,14,13,10,10,11,13,14,12,13,13,15, + 14,12,12,14,14,16, 9,10,10,13,13,10,11,11,13,14, + 10,11,11,14,13,13,13,13,15,15,13,14,13,16,14,11, + 12,12,14,14,12,13,13,16,15,11,12,13,14,15,14,15, + 15,16,16,14,13,15,13,17,11,12,12,14,15,12,13,13, + 15,16,11,13,12,15,15,14,15,14,16,16,14,15,12,17, + 13, +}; + +static float _vq_quantthresh__44u2__p4_0[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__44u2__p4_0[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44u2__p4_0 = { + _vq_quantthresh__44u2__p4_0, + _vq_quantmap__44u2__p4_0, + 5, + 5 +}; + +static static_codebook _44u2__p4_0 = { + 4, 625, + _vq_lengthlist__44u2__p4_0, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__44u2__p4_0, + NULL, + &_vq_auxt__44u2__p4_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u2__p5_0[] = { + 4, + 3, + 5, + 2, + 6, + 1, + 7, + 0, + 8, +}; + +static long _vq_lengthlist__44u2__p5_0[] = { + 1, 4, 4, 7, 7, 8, 8, 9, 9, 4, 6, 5, 8, 8, 8, 8, + 10,10, 4, 5, 6, 8, 8, 8, 8,10,10, 7, 8, 8, 9, 9, + 9, 9,11,11, 7, 8, 8, 9, 9, 9, 9,11,11, 8, 8, 8, + 9, 9,10,11,12,12, 8, 8, 8, 9, 9,10,10,12,12,10, + 10,10,11,11,12,12,13,13,10,10,10,11,11,12,12,13, + 13, +}; + +static float _vq_quantthresh__44u2__p5_0[] = { + -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, +}; + +static long _vq_quantmap__44u2__p5_0[] = { + 7, 5, 3, 1, 0, 2, 4, 6, + 8, +}; + +static encode_aux_threshmatch _vq_auxt__44u2__p5_0 = { + _vq_quantthresh__44u2__p5_0, + _vq_quantmap__44u2__p5_0, + 9, + 9 +}; + +static static_codebook _44u2__p5_0 = { + 2, 81, + _vq_lengthlist__44u2__p5_0, + 1, -531628032, 1611661312, 4, 0, + _vq_quantlist__44u2__p5_0, + NULL, + &_vq_auxt__44u2__p5_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u2__p6_0[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__44u2__p6_0[] = { + 1, 4, 4, 6, 6, 8, 8,10,10,11,11,14,13, 4, 6, 5, + 8, 8, 9, 9,11,10,12,11,15,14, 4, 5, 6, 8, 8, 9, + 9,11,11,11,11,14,14, 6, 8, 8,10, 9,11,11,11,11, + 12,12,15,15, 6, 8, 8, 9, 9,11,11,11,12,12,12,15, + 15, 8,10,10,11,11,11,11,12,12,13,13,15,16, 8,10, + 10,11,11,11,11,12,12,13,13,16,16,10,11,11,12,12, + 12,12,13,13,13,13,17,16,10,11,11,12,12,12,12,13, + 13,13,14,16,17,11,12,12,13,13,13,13,14,14,15,14, + 18,17,11,12,12,13,13,13,13,14,14,14,15,19,18,14, + 15,15,15,15,16,16,18,19,18,18, 0, 0,14,15,15,16, + 15,17,17,16,18,17,18, 0, 0, +}; + +static float _vq_quantthresh__44u2__p6_0[] = { + -27.5, -22.5, -17.5, -12.5, -7.5, -2.5, 2.5, 7.5, + 12.5, 17.5, 22.5, 27.5, +}; + +static long _vq_quantmap__44u2__p6_0[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__44u2__p6_0 = { + _vq_quantthresh__44u2__p6_0, + _vq_quantmap__44u2__p6_0, + 13, + 13 +}; + +static static_codebook _44u2__p6_0 = { + 2, 169, + _vq_lengthlist__44u2__p6_0, + 1, -526516224, 1616117760, 4, 0, + _vq_quantlist__44u2__p6_0, + NULL, + &_vq_auxt__44u2__p6_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u2__p6_1[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44u2__p6_1[] = { + 2, 4, 4, 5, 5, 4, 5, 5, 6, 5, 4, 5, 5, 5, 6, 5, + 6, 5, 6, 6, 5, 5, 6, 6, 6, +}; + +static float _vq_quantthresh__44u2__p6_1[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__44u2__p6_1[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44u2__p6_1 = { + _vq_quantthresh__44u2__p6_1, + _vq_quantmap__44u2__p6_1, + 5, + 5 +}; + +static static_codebook _44u2__p6_1 = { + 2, 25, + _vq_lengthlist__44u2__p6_1, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__44u2__p6_1, + NULL, + &_vq_auxt__44u2__p6_1, + NULL, + 0 +}; + +static long _vq_quantlist__44u2__p7_0[] = { + 4, + 3, + 5, + 2, + 6, + 1, + 7, + 0, + 8, +}; + +static long _vq_lengthlist__44u2__p7_0[] = { + 1, 3, 2,12,12,12,12,12,12, 4,12,12,12,12,12,12, + 12,12, 5,12,12,12,12,12,12,12,12,12,12,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11, +}; + +static float _vq_quantthresh__44u2__p7_0[] = { + -591.5, -422.5, -253.5, -84.5, 84.5, 253.5, 422.5, 591.5, +}; + +static long _vq_quantmap__44u2__p7_0[] = { + 7, 5, 3, 1, 0, 2, 4, 6, + 8, +}; + +static encode_aux_threshmatch _vq_auxt__44u2__p7_0 = { + _vq_quantthresh__44u2__p7_0, + _vq_quantmap__44u2__p7_0, + 9, + 9 +}; + +static static_codebook _44u2__p7_0 = { + 2, 81, + _vq_lengthlist__44u2__p7_0, + 1, -516612096, 1626677248, 4, 0, + _vq_quantlist__44u2__p7_0, + NULL, + &_vq_auxt__44u2__p7_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u2__p7_1[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__44u2__p7_1[] = { + 1, 4, 4, 7, 6, 7, 6, 8, 7, 9, 7, 9, 8, 4, 7, 6, + 8, 8, 9, 8,10, 9,10,10,11,11, 4, 7, 7, 8, 8, 8, + 8, 9,10,11,11,11,11, 6, 8, 8,10,10,10,10,11,11, + 12,12,12,12, 7, 8, 8,10,10,10,10,11,11,12,12,13, + 13, 7, 9, 9,11,10,12,12,13,13,14,13,14,14, 7, 9, + 9,10,11,11,12,13,13,13,13,16,14, 9,10,10,12,12, + 13,13,14,14,15,16,15,16, 9,10,10,12,12,12,13,14, + 14,14,15,16,15,10,12,12,13,13,15,13,16,16,15,17, + 17,17,10,11,11,12,14,14,14,15,15,17,17,15,17,11, + 12,12,14,14,14,15,15,15,17,16,17,17,10,12,12,13, + 14,14,14,17,15,17,17,17,17, +}; + +static float _vq_quantthresh__44u2__p7_1[] = { + -71.5, -58.5, -45.5, -32.5, -19.5, -6.5, 6.5, 19.5, + 32.5, 45.5, 58.5, 71.5, +}; + +static long _vq_quantmap__44u2__p7_1[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__44u2__p7_1 = { + _vq_quantthresh__44u2__p7_1, + _vq_quantmap__44u2__p7_1, + 13, + 13 +}; + +static static_codebook _44u2__p7_1 = { + 2, 169, + _vq_lengthlist__44u2__p7_1, + 1, -523010048, 1618608128, 4, 0, + _vq_quantlist__44u2__p7_1, + NULL, + &_vq_auxt__44u2__p7_1, + NULL, + 0 +}; + +static long _vq_quantlist__44u2__p7_2[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__44u2__p7_2[] = { + 2, 5, 5, 6, 6, 7, 7, 8, 7, 8, 8, 8, 8, 5, 6, 6, + 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 5, 6, 6, 7, 7, 8, + 7, 8, 8, 8, 8, 8, 8, 6, 7, 7, 7, 8, 8, 8, 8, 8, + 9, 9, 9, 9, 6, 7, 7, 8, 7, 8, 8, 9, 9, 9, 9, 9, + 9, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 7, 8, + 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 8, 8, 8, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, +}; + +static float _vq_quantthresh__44u2__p7_2[] = { + -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, + 2.5, 3.5, 4.5, 5.5, +}; + +static long _vq_quantmap__44u2__p7_2[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__44u2__p7_2 = { + _vq_quantthresh__44u2__p7_2, + _vq_quantmap__44u2__p7_2, + 13, + 13 +}; + +static static_codebook _44u2__p7_2 = { + 2, 169, + _vq_lengthlist__44u2__p7_2, + 1, -531103744, 1611661312, 4, 0, + _vq_quantlist__44u2__p7_2, + NULL, + &_vq_auxt__44u2__p7_2, + NULL, + 0 +}; + +static long _huff_lengthlist__44u2__short[] = { + 13,15,17,17,15,15,12,17,11, 9, 7,10,10, 9,12,17, + 10, 6, 3, 6, 5, 7,10,17,15,10, 6, 9, 8, 9,11,17, + 15, 8, 4, 7, 3, 5, 9,16,16,10, 5, 8, 4, 5, 8,16, + 13,11, 5, 8, 3, 3, 5,14,13,12, 7,10, 5, 5, 7,14, +}; + +static static_codebook _huff_book__44u2__short = { + 2, 64, + _huff_lengthlist__44u2__short, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist__44u3__long[] = { + 6, 9,13,12,14,11,10,13, 8, 4, 5, 7, 8, 7, 8,12, + 11, 4, 3, 5, 5, 7, 9,14,11, 6, 5, 6, 6, 6, 7,13, + 13, 7, 5, 6, 4, 5, 7,14,11, 7, 6, 6, 5, 5, 6,13, + 9, 7, 8, 6, 7, 5, 3, 9, 9,12,13,12,14,10, 6, 7, +}; + +static static_codebook _huff_book__44u3__long = { + 2, 64, + _huff_lengthlist__44u3__long, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _vq_quantlist__44u3__p1_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__44u3__p1_0[] = { + 1, 4, 4, 5, 8, 7, 5, 7, 8, 5, 8, 8, 8,10,11, 8, + 10,11, 5, 8, 8, 8,11,10, 8,11,11, 4, 8, 8, 8,11, + 11, 8,11,11, 8,11,11,11,13,14,11,14,14, 8,11,11, + 10,14,12,11,14,14, 4, 8, 8, 8,11,11, 8,11,11, 7, + 11,11,11,14,14,10,12,14, 8,11,11,11,14,14,11,14, + 13, +}; + +static float _vq_quantthresh__44u3__p1_0[] = { + -0.5, 0.5, +}; + +static long _vq_quantmap__44u3__p1_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__44u3__p1_0 = { + _vq_quantthresh__44u3__p1_0, + _vq_quantmap__44u3__p1_0, + 3, + 3 +}; + +static static_codebook _44u3__p1_0 = { + 4, 81, + _vq_lengthlist__44u3__p1_0, + 1, -535822336, 1611661312, 2, 0, + _vq_quantlist__44u3__p1_0, + NULL, + &_vq_auxt__44u3__p1_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u3__p2_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__44u3__p2_0[] = { + 2, 5, 4, 5, 6, 6, 5, 6, 6, 5, 6, 6, 7, 8, 8, 6, + 8, 8, 5, 6, 6, 6, 8, 8, 7, 8, 8, 5, 7, 6, 7, 8, + 8, 6, 8, 8, 7, 8, 8, 8, 9,10, 8,10,10, 6, 8, 8, + 8,10, 8, 8,10,10, 5, 6, 6, 6, 8, 8, 7, 8, 8, 6, + 8, 8, 8,10,10, 8, 8,10, 7, 8, 8, 8,10,10, 8,10, + 9, +}; + +static float _vq_quantthresh__44u3__p2_0[] = { + -0.5, 0.5, +}; + +static long _vq_quantmap__44u3__p2_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__44u3__p2_0 = { + _vq_quantthresh__44u3__p2_0, + _vq_quantmap__44u3__p2_0, + 3, + 3 +}; + +static static_codebook _44u3__p2_0 = { + 4, 81, + _vq_lengthlist__44u3__p2_0, + 1, -535822336, 1611661312, 2, 0, + _vq_quantlist__44u3__p2_0, + NULL, + &_vq_auxt__44u3__p2_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u3__p3_0[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44u3__p3_0[] = { + 2, 4, 4, 7, 7, 5, 7, 7, 9, 9, 5, 7, 7, 9, 9, 8, + 9, 9,12,12, 8, 9, 9,11,12, 5, 7, 7,10,10, 7, 9, + 9,11,11, 7, 9, 9,10,11,10,11,11,13,13, 9,10,11, + 13,13, 5, 7, 7,10,10, 7, 9, 9,11,10, 7, 9, 9,11, + 11, 9,11,10,13,13,10,11,11,14,13, 8,10,10,14,13, + 10,11,11,15,14, 9,11,11,14,14,13,14,13,16,16,12, + 13,13,15,15, 8,10,10,13,14, 9,11,11,14,14,10,11, + 11,14,15,12,13,13,15,15,13,14,14,15,16, 5, 7, 7, + 10,10, 7, 9, 9,11,11, 7, 9, 9,11,12,10,11,11,14, + 14,10,11,11,14,14, 7, 9, 9,12,12, 9,11,11,13,13, + 9,11,11,13,13,12,12,13,15,15,11,12,13,15,16, 7, + 9, 9,11,11, 8,11,10,13,12, 9,11,11,13,13,11,13, + 12,15,13,11,13,13,15,16, 9,12,11,15,14,11,12,13, + 16,15,11,13,13,15,16,14,14,15,17,16,13,15,16, 0, + 17, 9,11,11,15,15,10,13,12,15,15,11,13,13,15,16, + 13,15,13,16,15,14,16,15, 0,19, 5, 7, 7,10,10, 7, + 9, 9,11,11, 7, 9, 9,11,11,10,12,11,14,14,10,11, + 12,14,14, 7, 9, 9,12,12, 9,11,11,14,13, 9,10,11, + 12,13,11,13,13,16,16,11,12,13,13,16, 7, 9, 9,12, + 12, 9,11,11,13,13, 9,11,11,13,13,11,13,13,15,15, + 12,13,12,15,14, 9,11,11,15,14,11,13,12,16,16,10, + 12,12,15,15,13,15,15,17,19,13,14,15,16,17,10,12, + 12,15,15,11,13,13,16,16,11,13,13,15,16,13,15,15, + 0, 0,14,15,15,16,16, 8,10,10,14,14,10,12,12,15, + 15,10,12,11,15,16,14,15,15,19,20,13,14,14,18,16, + 9,11,11,15,15,11,13,13,17,16,11,13,13,16,16,15, + 17,17,20,20,14,15,16,17,20, 9,11,11,15,15,10,13, + 12,16,15,11,13,13,15,17,14,16,15,18, 0,14,16,15, + 18,20,12,14,14, 0, 0,14,14,16, 0, 0,13,16,15, 0, + 0,17,17,18, 0, 0,16,17,19,19, 0,12,14,14,18, 0, + 12,16,14, 0,17,13,15,15,18, 0,16,18,17, 0,17,16, + 18,17, 0, 0, 7,10,10,14,14,10,12,11,15,15,10,12, + 12,16,15,13,15,15,18, 0,14,15,15,17, 0, 9,11,11, + 15,15,11,13,13,16,16,11,12,13,16,16,14,15,16,17, + 17,14,16,16,16,18, 9,11,12,16,16,11,13,13,17,17, + 11,14,13,20,17,15,16,16,19, 0,15,16,17, 0,19,11, + 13,14,17,16,14,15,15,20,18,13,14,15,17,19,16,18, + 18, 0,20,16,16,19,17, 0,12,15,14,17, 0,14,15,15, + 18,19,13,16,15,19,20,15,18,18, 0,20,17, 0,16, 0, + 0, +}; + +static float _vq_quantthresh__44u3__p3_0[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__44u3__p3_0[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44u3__p3_0 = { + _vq_quantthresh__44u3__p3_0, + _vq_quantmap__44u3__p3_0, + 5, + 5 +}; + +static static_codebook _44u3__p3_0 = { + 4, 625, + _vq_lengthlist__44u3__p3_0, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__44u3__p3_0, + NULL, + &_vq_auxt__44u3__p3_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u3__p4_0[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44u3__p4_0[] = { + 4, 5, 5, 8, 8, 5, 7, 6, 9, 9, 5, 6, 7, 9, 9, 9, + 9, 9,11,11, 9, 9, 9,11,11, 5, 7, 7, 9, 9, 7, 8, + 8,10,10, 7, 7, 8,10,10, 9,10,10,11,12, 9,10,10, + 11,12, 5, 7, 7, 9, 9, 7, 8, 7,10,10, 7, 8, 8,10, + 10, 9,10, 9,12,11, 9,10,10,12,11, 9,10, 9,12,12, + 9,10,10,13,12, 9,10,10,12,13,12,12,12,14,14,11, + 12,12,13,14, 9, 9,10,12,12, 9,10,10,12,12, 9,10, + 10,12,13,11,12,11,14,13,12,12,12,14,13, 5, 7, 7, + 9, 9, 7, 8, 8,10,10, 7, 8, 8,10,10,10,10,10,12, + 12, 9,10,10,12,12, 7, 8, 8,11,10, 8, 8, 9,11,11, + 8, 9, 9,11,11,11,11,11,12,13,10,11,11,13,13, 6, + 8, 8,10,10, 7, 9, 8,11,10, 8, 9, 9,11,11,10,11, + 10,13,11,10,11,11,13,13, 9,11,10,13,12,10,11,11, + 13,13,10,11,11,13,13,12,12,13,12,15,12,13,13,15, + 15, 9,10,10,12,13,10,11,10,13,12,10,11,11,13,14, + 12,13,11,15,13,12,13,13,15,15, 5, 7, 7, 9, 9, 7, + 8, 8,10,10, 7, 8, 8,10,10, 9,10,10,12,12,10,10, + 11,12,12, 6, 8, 8,10,10, 8, 9, 9,11,11, 7, 8, 9, + 10,11,10,11,11,13,13,10,10,11,11,13, 7, 8, 8,10, + 10, 8, 9, 9,11,11, 8, 9, 9,11,11,10,11,11,13,13, + 11,11,11,13,12, 9,10,10,13,12,10,11,11,14,13,10, + 10,11,12,13,12,13,13,15,15,12,11,13,13,14, 9,10, + 11,12,13,10,11,11,13,13,10,11,11,13,13,12,13,13, + 15,15,12,13,12,15,12, 8, 9, 9,12,12, 9,11,10,13, + 13, 9,10,10,13,13,12,13,13,15,14,12,12,12,14,13, + 9,10,10,13,12,10,11,11,13,13,10,11,11,14,12,13, + 13,14,14,16,12,13,13,15,15, 9,10,10,13,13,10,11, + 10,14,13,10,11,11,13,14,12,14,13,15,14,13,13,13, + 15,15,11,13,12,15,14,11,12,13,14,15,12,13,13,16, + 14,14,12,15,12,16,14,15,15,17,15,11,12,12,14,14, + 11,13,11,15,14,12,13,13,15,15,13,15,12,17,13,14, + 15,15,16,16, 8, 9, 9,12,12, 9,10,10,12,13, 9,10, + 10,13,13,12,12,12,14,14,12,13,13,15,15, 9,10,10, + 13,12,10,11,11,14,13,10,10,11,13,14,12,13,13,15, + 15,12,12,13,14,16, 9,10,10,13,13,10,11,11,13,14, + 10,11,11,14,13,12,13,13,14,15,13,14,13,16,14,11, + 12,12,14,14,12,13,13,15,14,11,12,13,14,15,14,15, + 15,16,16,13,13,15,13,16,11,12,12,14,15,12,13,13, + 14,15,11,13,12,15,14,14,15,15,16,16,14,15,12,16, + 13, +}; + +static float _vq_quantthresh__44u3__p4_0[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__44u3__p4_0[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44u3__p4_0 = { + _vq_quantthresh__44u3__p4_0, + _vq_quantmap__44u3__p4_0, + 5, + 5 +}; + +static static_codebook _44u3__p4_0 = { + 4, 625, + _vq_lengthlist__44u3__p4_0, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__44u3__p4_0, + NULL, + &_vq_auxt__44u3__p4_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u3__p5_0[] = { + 4, + 3, + 5, + 2, + 6, + 1, + 7, + 0, + 8, +}; + +static long _vq_lengthlist__44u3__p5_0[] = { + 2, 3, 3, 6, 6, 7, 7, 9, 9, 4, 5, 5, 7, 7, 8, 8, + 10,10, 4, 5, 5, 7, 7, 8, 8,10,10, 6, 7, 7, 8, 8, + 9, 9,11,10, 6, 7, 7, 8, 8, 9, 9,10,10, 7, 8, 8, + 9, 9,10,10,11,11, 7, 8, 8, 9, 9,10,10,11,11, 9, + 10,10,11,10,11,11,12,12, 9,10,10,10,10,11,11,12, + 12, +}; + +static float _vq_quantthresh__44u3__p5_0[] = { + -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, +}; + +static long _vq_quantmap__44u3__p5_0[] = { + 7, 5, 3, 1, 0, 2, 4, 6, + 8, +}; + +static encode_aux_threshmatch _vq_auxt__44u3__p5_0 = { + _vq_quantthresh__44u3__p5_0, + _vq_quantmap__44u3__p5_0, + 9, + 9 +}; + +static static_codebook _44u3__p5_0 = { + 2, 81, + _vq_lengthlist__44u3__p5_0, + 1, -531628032, 1611661312, 4, 0, + _vq_quantlist__44u3__p5_0, + NULL, + &_vq_auxt__44u3__p5_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u3__p6_0[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__44u3__p6_0[] = { + 1, 4, 4, 6, 6, 8, 8, 9, 9,10,11,13,14, 4, 6, 5, + 8, 8, 9, 9,10,10,11,11,14,14, 4, 6, 6, 8, 8, 9, + 9,10,10,11,11,14,14, 6, 8, 8, 9, 9,10,10,11,11, + 12,12,15,15, 6, 8, 8, 9, 9,10,11,11,11,12,12,15, + 15, 8, 9, 9,11,10,11,11,12,12,13,13,15,16, 8, 9, + 9,10,11,11,11,12,12,13,13,16,16,10,10,11,11,11, + 12,12,13,13,13,14,17,16, 9,10,11,12,11,12,12,13, + 13,13,13,16,18,11,12,11,12,12,13,13,13,14,15,14, + 17,17,11,11,12,12,12,13,13,13,14,14,15,18,17,14, + 15,15,15,15,16,16,17,17,19,18, 0,20,14,15,14,15, + 15,16,16,16,17,18,16,20,18, +}; + +static float _vq_quantthresh__44u3__p6_0[] = { + -27.5, -22.5, -17.5, -12.5, -7.5, -2.5, 2.5, 7.5, + 12.5, 17.5, 22.5, 27.5, +}; + +static long _vq_quantmap__44u3__p6_0[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__44u3__p6_0 = { + _vq_quantthresh__44u3__p6_0, + _vq_quantmap__44u3__p6_0, + 13, + 13 +}; + +static static_codebook _44u3__p6_0 = { + 2, 169, + _vq_lengthlist__44u3__p6_0, + 1, -526516224, 1616117760, 4, 0, + _vq_quantlist__44u3__p6_0, + NULL, + &_vq_auxt__44u3__p6_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u3__p6_1[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44u3__p6_1[] = { + 2, 4, 4, 5, 5, 4, 5, 5, 6, 5, 4, 5, 5, 5, 6, 5, + 6, 5, 6, 6, 5, 5, 6, 6, 6, +}; + +static float _vq_quantthresh__44u3__p6_1[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__44u3__p6_1[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44u3__p6_1 = { + _vq_quantthresh__44u3__p6_1, + _vq_quantmap__44u3__p6_1, + 5, + 5 +}; + +static static_codebook _44u3__p6_1 = { + 2, 25, + _vq_lengthlist__44u3__p6_1, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__44u3__p6_1, + NULL, + &_vq_auxt__44u3__p6_1, + NULL, + 0 +}; + +static long _vq_quantlist__44u3__p7_0[] = { + 4, + 3, + 5, + 2, + 6, + 1, + 7, + 0, + 8, +}; + +static long _vq_lengthlist__44u3__p7_0[] = { + 1, 3, 3,10,10,10,10,10,10, 4,10,10,10,10,10,10, + 10,10, 4,10,10,10,10,10,10,10,10,10,10, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, +}; + +static float _vq_quantthresh__44u3__p7_0[] = { + -892.5, -637.5, -382.5, -127.5, 127.5, 382.5, 637.5, 892.5, +}; + +static long _vq_quantmap__44u3__p7_0[] = { + 7, 5, 3, 1, 0, 2, 4, 6, + 8, +}; + +static encode_aux_threshmatch _vq_auxt__44u3__p7_0 = { + _vq_quantthresh__44u3__p7_0, + _vq_quantmap__44u3__p7_0, + 9, + 9 +}; + +static static_codebook _44u3__p7_0 = { + 2, 81, + _vq_lengthlist__44u3__p7_0, + 1, -515907584, 1627381760, 4, 0, + _vq_quantlist__44u3__p7_0, + NULL, + &_vq_auxt__44u3__p7_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u3__p7_1[] = { + 7, + 6, + 8, + 5, + 9, + 4, + 10, + 3, + 11, + 2, + 12, + 1, + 13, + 0, + 14, +}; + +static long _vq_lengthlist__44u3__p7_1[] = { + 1, 4, 4, 6, 6, 7, 6, 8, 7, 9, 8,10, 9,11,11, 4, + 7, 7, 8, 7, 9, 9,10,10,11,11,11,11,12,12, 4, 7, + 7, 7, 7, 9, 9,10,10,11,11,12,12,12,11, 6, 8, 8, + 9, 9,10,10,11,11,12,12,13,12,13,13, 6, 8, 8, 9, + 9,10,11,11,11,12,12,13,14,13,13, 8, 9, 9,11,11, + 12,12,12,13,14,13,14,14,14,15, 8, 9, 9,11,11,11, + 12,13,14,13,14,15,17,14,15, 9,10,10,12,12,13,13, + 13,14,15,15,15,16,16,16, 9,11,11,12,12,13,13,14, + 14,14,15,16,16,16,16,10,12,12,13,13,14,14,15,15, + 15,16,17,17,17,17,10,12,11,13,13,15,14,15,14,16, + 17,16,16,16,16,11,13,12,14,14,14,14,15,16,17,16, + 17,17,17,17,11,13,12,14,14,14,15,17,16,17,17,17, + 17,17,17,12,13,13,15,16,15,16,17,17,16,16,17,17, + 17,17,12,13,13,15,15,15,16,17,17,17,16,17,16,17, + 17, +}; + +static float _vq_quantthresh__44u3__p7_1[] = { + -110.5, -93.5, -76.5, -59.5, -42.5, -25.5, -8.5, 8.5, + 25.5, 42.5, 59.5, 76.5, 93.5, 110.5, +}; + +static long _vq_quantmap__44u3__p7_1[] = { + 13, 11, 9, 7, 5, 3, 1, 0, + 2, 4, 6, 8, 10, 12, 14, +}; + +static encode_aux_threshmatch _vq_auxt__44u3__p7_1 = { + _vq_quantthresh__44u3__p7_1, + _vq_quantmap__44u3__p7_1, + 15, + 15 +}; + +static static_codebook _44u3__p7_1 = { + 2, 225, + _vq_lengthlist__44u3__p7_1, + 1, -522338304, 1620115456, 4, 0, + _vq_quantlist__44u3__p7_1, + NULL, + &_vq_auxt__44u3__p7_1, + NULL, + 0 +}; + +static long _vq_quantlist__44u3__p7_2[] = { + 8, + 7, + 9, + 6, + 10, + 5, + 11, + 4, + 12, + 3, + 13, + 2, + 14, + 1, + 15, + 0, + 16, +}; + +static long _vq_lengthlist__44u3__p7_2[] = { + 2, 5, 5, 7, 6, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, + 9, 5, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, + 10,10, 5, 6, 6, 7, 7, 8, 8, 8, 8, 9, 8, 9, 9, 9, + 9,10, 9, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, + 10,10,10,10, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9,10, + 9,10,10,10,10, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, + 10,10,10,10,10,10, 7, 8, 8, 9, 8, 9, 9, 9, 9,10, + 9,10,10,10,10,10,10, 8, 8, 8, 9, 9, 9, 9, 9, 9, + 9,10,10,10,10,10,10,10, 8, 9, 8, 9, 9, 9, 9,10, + 9,10,10,10,10,10,10,10,10, 9, 9, 9, 9, 9, 9,10, + 9,10,10,10,10,10,10,10,10,10, 9, 9, 9, 9, 9,10, + 9,10,10,10,10,10,10,10,10,10,10, 9, 9, 9,10, 9, + 10,10,10,10,10,10,10,10,10,10,10,10, 9, 9, 9,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10, 9, 9, 9, + 10,10,10,10,10,10,10,10,10,10,10,10,10,11, 9,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,11, 9, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 9,10,10,10,10,10,10,10,10,10,10,10,11,11,11,10, + 11, +}; + +static float _vq_quantthresh__44u3__p7_2[] = { + -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, + 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, +}; + +static long _vq_quantmap__44u3__p7_2[] = { + 15, 13, 11, 9, 7, 5, 3, 1, + 0, 2, 4, 6, 8, 10, 12, 14, + 16, +}; + +static encode_aux_threshmatch _vq_auxt__44u3__p7_2 = { + _vq_quantthresh__44u3__p7_2, + _vq_quantmap__44u3__p7_2, + 17, + 17 +}; + +static static_codebook _44u3__p7_2 = { + 2, 289, + _vq_lengthlist__44u3__p7_2, + 1, -529530880, 1611661312, 5, 0, + _vq_quantlist__44u3__p7_2, + NULL, + &_vq_auxt__44u3__p7_2, + NULL, + 0 +}; + +static long _huff_lengthlist__44u3__short[] = { + 14,14,14,15,13,15,12,16,10, 8, 7, 9, 9, 8,12,16, + 10, 5, 4, 6, 5, 6, 9,16,14, 8, 6, 8, 7, 8,10,16, + 14, 7, 4, 6, 3, 5, 8,16,15, 9, 5, 7, 4, 4, 7,16, + 13,10, 6, 7, 4, 3, 4,13,13,12, 7, 9, 5, 5, 6,12, +}; + +static static_codebook _huff_book__44u3__short = { + 2, 64, + _huff_lengthlist__44u3__short, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist__44u4__long[] = { + 3, 8,12,12,13,12,11,13, 5, 4, 6, 7, 8, 8, 9,13, + 9, 5, 4, 5, 5, 7, 9,13, 9, 6, 5, 6, 6, 7, 8,12, + 12, 7, 5, 6, 4, 5, 8,13,11, 7, 6, 6, 5, 5, 6,12, + 10, 8, 8, 7, 7, 5, 3, 8,10,12,13,12,12, 9, 6, 7, +}; + +static static_codebook _huff_book__44u4__long = { + 2, 64, + _huff_lengthlist__44u4__long, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _vq_quantlist__44u4__p1_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__44u4__p1_0[] = { + 1, 4, 4, 5, 8, 7, 5, 7, 8, 5, 8, 8, 8,10,11, 8, + 10,11, 5, 8, 8, 8,11,10, 8,11,11, 4, 8, 8, 8,11, + 11, 8,11,11, 8,11,11,11,13,14,11,15,14, 8,11,11, + 10,13,12,11,14,14, 4, 8, 8, 8,11,11, 8,11,11, 7, + 11,11,11,15,14,10,12,14, 8,11,11,11,14,14,11,14, + 13, +}; + +static float _vq_quantthresh__44u4__p1_0[] = { + -0.5, 0.5, +}; + +static long _vq_quantmap__44u4__p1_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__44u4__p1_0 = { + _vq_quantthresh__44u4__p1_0, + _vq_quantmap__44u4__p1_0, + 3, + 3 +}; + +static static_codebook _44u4__p1_0 = { + 4, 81, + _vq_lengthlist__44u4__p1_0, + 1, -535822336, 1611661312, 2, 0, + _vq_quantlist__44u4__p1_0, + NULL, + &_vq_auxt__44u4__p1_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u4__p2_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__44u4__p2_0[] = { + 2, 5, 5, 5, 6, 6, 5, 6, 6, 5, 6, 6, 7, 8, 8, 6, + 8, 8, 5, 6, 6, 6, 8, 8, 7, 8, 8, 5, 7, 6, 6, 8, + 8, 6, 8, 8, 6, 8, 8, 8, 9,10, 8,10,10, 6, 8, 8, + 8,10, 8, 8,10,10, 5, 6, 6, 6, 8, 8, 6, 8, 8, 6, + 8, 8, 8,10,10, 8, 8,10, 6, 8, 8, 8,10,10, 8,10, + 9, +}; + +static float _vq_quantthresh__44u4__p2_0[] = { + -0.5, 0.5, +}; + +static long _vq_quantmap__44u4__p2_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__44u4__p2_0 = { + _vq_quantthresh__44u4__p2_0, + _vq_quantmap__44u4__p2_0, + 3, + 3 +}; + +static static_codebook _44u4__p2_0 = { + 4, 81, + _vq_lengthlist__44u4__p2_0, + 1, -535822336, 1611661312, 2, 0, + _vq_quantlist__44u4__p2_0, + NULL, + &_vq_auxt__44u4__p2_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u4__p3_0[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44u4__p3_0[] = { + 2, 4, 4, 8, 8, 5, 7, 7, 9, 9, 5, 7, 7, 9, 9, 8, + 10, 9,12,12, 8, 9,10,12,12, 5, 7, 7,10,10, 7, 9, + 9,11,11, 7, 9, 9,11,11,10,12,11,14,14, 9,10,11, + 13,14, 5, 7, 7,10,10, 7, 9, 9,11,11, 7, 9, 9,11, + 11, 9,11,10,14,13,10,11,11,14,14, 8,10,10,14,13, + 10,12,12,15,14, 9,11,11,15,14,13,14,14,17,17,12, + 14,14,16,16, 8,10,10,14,14, 9,11,11,14,15,10,12, + 12,14,15,12,14,13,16,16,13,14,15,15,18, 4, 7, 7, + 10,10, 7, 9, 9,12,11, 7, 9, 9,11,12,10,12,11,15, + 14,10,11,12,14,15, 7, 9, 9,12,12, 9,11,12,13,13, + 9,11,12,13,13,12,13,13,15,16,11,13,13,15,16, 7, + 9, 9,12,12, 9,11,10,13,12, 9,11,12,13,14,11,13, + 12,16,14,12,13,13,15,16,10,12,12,16,15,11,13,13, + 17,16,11,13,13,17,16,14,15,15,17,17,14,16,16,18, + 20, 9,11,11,15,16,11,13,12,16,16,11,13,13,16,17, + 14,15,14,18,16,14,16,16,17,20, 5, 7, 7,10,10, 7, + 9, 9,12,11, 7, 9,10,11,12,10,12,11,15,15,10,12, + 12,14,14, 7, 9, 9,12,12, 9,12,11,14,13, 9,10,11, + 12,13,12,13,14,16,16,11,12,13,14,16, 7, 9, 9,12, + 12, 9,12,11,13,13, 9,12,11,13,13,11,13,13,16,16, + 12,13,13,16,15, 9,11,11,16,14,11,13,13,16,16,11, + 12,13,16,16,14,16,16,17,17,13,14,15,16,17,10,12, + 12,15,15,11,13,13,16,17,11,13,13,16,16,14,16,15, + 19,19,14,15,15,17,18, 8,10,10,14,14,10,12,12,15, + 15,10,12,12,16,16,14,16,15,20,19,13,15,15,17,16, + 9,12,12,16,16,11,13,13,16,18,11,14,13,16,17,16, + 17,16,20, 0,15,16,18,18,20, 9,11,11,15,15,11,14, + 12,17,16,11,13,13,17,17,15,17,15,20,20,14,16,16, + 17, 0,13,15,14,18,16,14,15,16, 0,18,14,16,16, 0, + 0,18,16, 0, 0,20,16,18,18, 0, 0,12,14,14,17,18, + 13,15,14,20,18,14,16,15,19,19,16,20,16, 0,18,16, + 19,17,19, 0, 8,10,10,14,14,10,12,12,16,15,10,12, + 12,16,16,13,15,15,18,17,14,16,16,19, 0, 9,11,11, + 16,15,11,14,13,18,17,11,12,13,17,18,14,17,16,18, + 18,15,16,17,18,18, 9,12,12,16,16,11,13,13,16,18, + 11,14,13,17,17,15,16,16,18,20,16,17,17,20,20,12, + 14,14,18,17,14,16,16, 0,19,13,14,15,18, 0,16, 0, + 0, 0, 0,16,16, 0,19,20,13,15,14, 0, 0,14,16,16, + 18,19,14,16,15, 0,20,16,20,18, 0,20,17,20,17, 0, + 0, +}; + +static float _vq_quantthresh__44u4__p3_0[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__44u4__p3_0[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44u4__p3_0 = { + _vq_quantthresh__44u4__p3_0, + _vq_quantmap__44u4__p3_0, + 5, + 5 +}; + +static static_codebook _44u4__p3_0 = { + 4, 625, + _vq_lengthlist__44u4__p3_0, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__44u4__p3_0, + NULL, + &_vq_auxt__44u4__p3_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u4__p4_0[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44u4__p4_0[] = { + 4, 5, 5, 8, 8, 5, 7, 6, 9, 9, 5, 6, 7, 9, 9, 9, + 9, 9,11,11, 8, 9, 9,11,11, 5, 7, 7, 9, 9, 7, 8, + 8,10,10, 7, 7, 8,10,10, 9,10,10,11,12, 9,10,10, + 11,12, 5, 7, 7, 9, 9, 7, 8, 7,10,10, 7, 8, 8,10, + 10, 9,10,10,12,11, 9,10,10,12,11, 9,10, 9,12,12, + 9,10,10,13,12, 9,10,10,12,12,12,12,12,14,14,11, + 12,12,13,14, 9, 9,10,12,12, 9,10,10,13,13, 9,10, + 10,12,13,11,12,12,14,13,11,12,12,14,14, 5, 7, 7, + 9, 9, 7, 8, 8,10,10, 7, 8, 8,10,10,10,10,10,12, + 12, 9,10,10,12,12, 7, 8, 8,11,10, 8, 8, 9,11,11, + 8, 9, 9,11,11,11,11,11,12,13,10,11,11,13,13, 6, + 8, 8,10,10, 7, 9, 8,11,10, 8, 9, 9,11,11,10,11, + 10,13,11,10,11,11,13,13, 9,11,10,13,12,10,11,11, + 13,14,10,11,11,14,13,12,12,13,12,15,12,13,13,15, + 15, 9,10,10,12,13,10,11,10,13,12,10,11,11,13,14, + 12,13,11,15,13,13,13,13,15,15, 5, 7, 7, 9, 9, 7, + 8, 8,10,10, 7, 8, 8,10,10, 9,10,10,12,12,10,10, + 11,12,13, 6, 8, 8,10,10, 8, 9, 9,11,11, 7, 8, 9, + 10,11,10,11,11,13,13,10,10,11,11,13, 7, 8, 8,10, + 11, 8, 9, 9,11,11, 8, 9, 8,11,11,10,11,11,13,13, + 11,12,11,13,12, 9,10,10,13,12,10,11,11,14,13,10, + 10,11,12,13,12,13,13,15,15,12,11,13,13,14, 9,10, + 11,12,13,10,11,11,13,14,10,11,11,13,13,12,13,13, + 15,15,12,13,12,15,12, 8, 9, 9,12,12, 9,11,10,13, + 13, 9,10,10,13,13,12,13,13,15,15,12,12,12,14,14, + 9,10,10,13,13,10,11,11,13,14,10,11,11,14,13,13, + 13,14,14,16,13,13,13,15,15, 9,10,10,13,13,10,11, + 10,14,13,10,11,11,13,14,12,14,13,16,14,12,13,13, + 14,15,11,12,12,15,14,11,12,13,14,15,12,13,13,16, + 15,14,12,15,12,16,14,15,15,16,16,11,12,12,14,14, + 11,13,12,15,14,12,13,13,15,16,13,15,13,17,13,14, + 15,15,16,17, 8, 9, 9,12,12, 9,10,10,12,13, 9,10, + 10,13,13,12,12,12,14,14,12,13,13,15,15, 9,10,10, + 13,12,10,11,11,14,13,10,10,11,13,14,13,13,13,15, + 15,12,13,14,14,16, 9,10,10,13,13,10,11,11,13,14, + 10,11,11,14,14,13,13,13,15,15,13,14,13,16,14,11, + 12,12,15,14,12,13,13,16,15,11,12,13,14,15,14,15, + 15,17,16,13,13,15,13,16,11,12,13,14,15,13,13,13, + 15,16,11,13,12,15,14,14,15,15,16,16,14,15,12,17, + 13, +}; + +static float _vq_quantthresh__44u4__p4_0[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__44u4__p4_0[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44u4__p4_0 = { + _vq_quantthresh__44u4__p4_0, + _vq_quantmap__44u4__p4_0, + 5, + 5 +}; + +static static_codebook _44u4__p4_0 = { + 4, 625, + _vq_lengthlist__44u4__p4_0, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__44u4__p4_0, + NULL, + &_vq_auxt__44u4__p4_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u4__p5_0[] = { + 4, + 3, + 5, + 2, + 6, + 1, + 7, + 0, + 8, +}; + +static long _vq_lengthlist__44u4__p5_0[] = { + 2, 3, 3, 6, 6, 7, 7, 9, 9, 4, 5, 5, 7, 7, 8, 8, + 10, 9, 4, 5, 5, 7, 7, 8, 8,10,10, 6, 7, 7, 8, 8, + 9, 9,11,10, 6, 7, 7, 8, 8, 9, 9,10,11, 7, 8, 8, + 9, 9,10,10,11,11, 7, 8, 8, 9, 9,10,10,11,11, 9, + 10,10,11,10,11,11,12,12, 9,10,10,10,11,11,11,12, + 12, +}; + +static float _vq_quantthresh__44u4__p5_0[] = { + -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, +}; + +static long _vq_quantmap__44u4__p5_0[] = { + 7, 5, 3, 1, 0, 2, 4, 6, + 8, +}; + +static encode_aux_threshmatch _vq_auxt__44u4__p5_0 = { + _vq_quantthresh__44u4__p5_0, + _vq_quantmap__44u4__p5_0, + 9, + 9 +}; + +static static_codebook _44u4__p5_0 = { + 2, 81, + _vq_lengthlist__44u4__p5_0, + 1, -531628032, 1611661312, 4, 0, + _vq_quantlist__44u4__p5_0, + NULL, + &_vq_auxt__44u4__p5_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u4__p6_0[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__44u4__p6_0[] = { + 1, 4, 4, 6, 6, 8, 8, 9, 9,11,10,13,13, 4, 6, 5, + 8, 8, 9, 9,10,10,11,11,14,14, 4, 6, 6, 8, 8, 9, + 9,10,10,11,11,14,14, 6, 8, 8, 9, 9,10,10,11,11, + 12,12,15,15, 6, 8, 8, 9, 9,10,11,11,11,12,12,15, + 15, 8, 9, 9,11,10,11,11,12,12,13,13,16,16, 8, 9, + 9,10,10,11,11,12,12,13,13,16,16,10,10,10,12,11, + 12,12,13,13,14,14,16,16,10,10,10,11,12,12,12,13, + 13,13,14,16,17,11,12,11,12,12,13,13,14,14,15,14, + 18,17,11,11,12,12,12,13,13,14,14,14,15,19,18,14, + 15,14,15,15,17,16,17,17,17,17,21, 0,14,15,15,16, + 16,16,16,17,17,18,17,20,21, +}; + +static float _vq_quantthresh__44u4__p6_0[] = { + -27.5, -22.5, -17.5, -12.5, -7.5, -2.5, 2.5, 7.5, + 12.5, 17.5, 22.5, 27.5, +}; + +static long _vq_quantmap__44u4__p6_0[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__44u4__p6_0 = { + _vq_quantthresh__44u4__p6_0, + _vq_quantmap__44u4__p6_0, + 13, + 13 +}; + +static static_codebook _44u4__p6_0 = { + 2, 169, + _vq_lengthlist__44u4__p6_0, + 1, -526516224, 1616117760, 4, 0, + _vq_quantlist__44u4__p6_0, + NULL, + &_vq_auxt__44u4__p6_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u4__p6_1[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44u4__p6_1[] = { + 2, 4, 4, 5, 5, 4, 5, 5, 6, 5, 4, 5, 5, 5, 6, 5, + 6, 5, 6, 6, 5, 5, 6, 6, 6, +}; + +static float _vq_quantthresh__44u4__p6_1[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__44u4__p6_1[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44u4__p6_1 = { + _vq_quantthresh__44u4__p6_1, + _vq_quantmap__44u4__p6_1, + 5, + 5 +}; + +static static_codebook _44u4__p6_1 = { + 2, 25, + _vq_lengthlist__44u4__p6_1, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__44u4__p6_1, + NULL, + &_vq_auxt__44u4__p6_1, + NULL, + 0 +}; + +static long _vq_quantlist__44u4__p7_0[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__44u4__p7_0[] = { + 1, 3, 3,12,12,12,12,12,12,12,12,12,12, 3,12,11, + 12,12,12,12,12,12,12,12,12,12, 4,11,10,12,12,12, + 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, + 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, + 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, + 12,12,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11, +}; + +static float _vq_quantthresh__44u4__p7_0[] = { + -1402.5, -1147.5, -892.5, -637.5, -382.5, -127.5, 127.5, 382.5, + 637.5, 892.5, 1147.5, 1402.5, +}; + +static long _vq_quantmap__44u4__p7_0[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__44u4__p7_0 = { + _vq_quantthresh__44u4__p7_0, + _vq_quantmap__44u4__p7_0, + 13, + 13 +}; + +static static_codebook _44u4__p7_0 = { + 2, 169, + _vq_lengthlist__44u4__p7_0, + 1, -514332672, 1627381760, 4, 0, + _vq_quantlist__44u4__p7_0, + NULL, + &_vq_auxt__44u4__p7_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u4__p7_1[] = { + 7, + 6, + 8, + 5, + 9, + 4, + 10, + 3, + 11, + 2, + 12, + 1, + 13, + 0, + 14, +}; + +static long _vq_lengthlist__44u4__p7_1[] = { + 1, 4, 4, 6, 6, 7, 7, 9, 8,10, 8,10, 9,11,11, 4, + 7, 6, 8, 7, 9, 9,10,10,11,10,11,10,12,10, 4, 6, + 7, 8, 8, 9, 9,10,10,11,11,11,11,12,12, 6, 8, 8, + 10, 9,11,10,12,11,12,12,12,12,13,13, 6, 8, 8,10, + 10,10,11,11,11,12,12,13,12,13,13, 8, 9, 9,11,11, + 12,11,12,12,13,13,13,13,13,13, 8, 9, 9,11,11,11, + 12,12,12,13,13,13,13,13,13, 9,10,10,12,11,13,13, + 13,13,14,13,13,14,14,14, 9,10,11,11,12,12,13,13, + 13,13,13,14,15,14,14,10,11,11,12,12,13,13,14,14, + 14,14,14,15,16,16,10,11,11,12,13,13,13,13,15,14, + 14,15,16,15,16,10,12,12,13,13,14,14,14,15,15,15, + 15,15,15,16,11,12,12,13,13,14,14,14,15,15,15,16, + 15,17,16,11,12,12,13,13,13,15,15,14,16,16,16,16, + 16,17,11,12,12,13,13,14,14,15,14,15,15,17,17,16, + 16, +}; + +static float _vq_quantthresh__44u4__p7_1[] = { + -110.5, -93.5, -76.5, -59.5, -42.5, -25.5, -8.5, 8.5, + 25.5, 42.5, 59.5, 76.5, 93.5, 110.5, +}; + +static long _vq_quantmap__44u4__p7_1[] = { + 13, 11, 9, 7, 5, 3, 1, 0, + 2, 4, 6, 8, 10, 12, 14, +}; + +static encode_aux_threshmatch _vq_auxt__44u4__p7_1 = { + _vq_quantthresh__44u4__p7_1, + _vq_quantmap__44u4__p7_1, + 15, + 15 +}; + +static static_codebook _44u4__p7_1 = { + 2, 225, + _vq_lengthlist__44u4__p7_1, + 1, -522338304, 1620115456, 4, 0, + _vq_quantlist__44u4__p7_1, + NULL, + &_vq_auxt__44u4__p7_1, + NULL, + 0 +}; + +static long _vq_quantlist__44u4__p7_2[] = { + 8, + 7, + 9, + 6, + 10, + 5, + 11, + 4, + 12, + 3, + 13, + 2, + 14, + 1, + 15, + 0, + 16, +}; + +static long _vq_lengthlist__44u4__p7_2[] = { + 2, 5, 5, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, + 9, 5, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, + 9, 9, 5, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, + 9, 9, 9, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, + 10,10,10,10, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9,10, + 9,10, 9,10,10, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, + 10,10,10,10,10,10, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, + 9,10,10,10,10,10,10, 8, 9, 8, 9, 9, 9, 9, 9, 9, + 10,10,10,10,10,10,10,10, 8, 8, 8, 9, 9, 9, 9, 9, + 10,10,10,10,10,10,10,10,10, 9, 9, 9, 9, 9,10,10, + 10,10,10,10,10,10,10,10,10,10, 9, 9, 9, 9, 9,10, + 10,10,10,10,10,10,10,10,10,10,10, 9, 9, 9, 9,10, + 10,10,10,10,10,10,10,10,10,10,10,10, 9, 9, 9, 9, + 10,10,10,10,10,10,10,10,10,11,10,10,10, 9, 9, 9, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10, 9, 9, + 9,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 9, + 10, 9,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 9,10, 9,10,10,10,10,10,10,10,10,10,10,11,10,10, + 10, +}; + +static float _vq_quantthresh__44u4__p7_2[] = { + -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, + 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, +}; + +static long _vq_quantmap__44u4__p7_2[] = { + 15, 13, 11, 9, 7, 5, 3, 1, + 0, 2, 4, 6, 8, 10, 12, 14, + 16, +}; + +static encode_aux_threshmatch _vq_auxt__44u4__p7_2 = { + _vq_quantthresh__44u4__p7_2, + _vq_quantmap__44u4__p7_2, + 17, + 17 +}; + +static static_codebook _44u4__p7_2 = { + 2, 289, + _vq_lengthlist__44u4__p7_2, + 1, -529530880, 1611661312, 5, 0, + _vq_quantlist__44u4__p7_2, + NULL, + &_vq_auxt__44u4__p7_2, + NULL, + 0 +}; + +static long _huff_lengthlist__44u4__short[] = { + 14,17,15,17,16,14,13,16,10, 7, 7,10,13,10,15,16, + 9, 4, 4, 6, 5, 7, 9,16,12, 8, 7, 8, 8, 8,11,16, + 14, 7, 4, 6, 3, 5, 8,15,13, 8, 5, 7, 4, 5, 7,16, + 12, 9, 6, 8, 3, 3, 5,16,14,13, 7,10, 5, 5, 7,15, +}; + +static static_codebook _huff_book__44u4__short = { + 2, 64, + _huff_lengthlist__44u4__short, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist__44u5__long[] = { + 3, 8,13,12,14,12,16,11,13,14, 5, 4, 5, 6, 7, 8, + 10, 9,12,15,10, 5, 5, 5, 6, 8, 9, 9,13,15,10, 5, + 5, 6, 6, 7, 8, 8,11,13,12, 7, 5, 6, 4, 6, 7, 7, + 11,14,11, 7, 7, 6, 6, 6, 7, 6,10,14,14, 9, 8, 8, + 6, 7, 7, 7,11,16,11, 8, 8, 7, 6, 6, 7, 4, 7,12, + 10,10,12,10,10, 9,10, 5, 6, 9,10,12,15,13,14,14, + 14, 8, 7, 8, +}; + +static static_codebook _huff_book__44u5__long = { + 2, 100, + _huff_lengthlist__44u5__long, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _vq_quantlist__44u5__p1_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__44u5__p1_0[] = { + 1, 4, 4, 5, 8, 7, 5, 7, 7, 5, 8, 8, 8,10,10, 7, + 9,10, 5, 8, 8, 7,10, 9, 8,10,10, 5, 8, 8, 8,10, + 10, 8,10,10, 8,10,10,10,12,13,10,13,13, 7,10,10, + 10,13,11,10,13,13, 4, 8, 8, 8,11,10, 8,10,10, 7, + 10,10,10,13,13,10,11,13, 8,10,11,10,13,13,10,13, + 12, +}; + +static float _vq_quantthresh__44u5__p1_0[] = { + -0.5, 0.5, +}; + +static long _vq_quantmap__44u5__p1_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__44u5__p1_0 = { + _vq_quantthresh__44u5__p1_0, + _vq_quantmap__44u5__p1_0, + 3, + 3 +}; + +static static_codebook _44u5__p1_0 = { + 4, 81, + _vq_lengthlist__44u5__p1_0, + 1, -535822336, 1611661312, 2, 0, + _vq_quantlist__44u5__p1_0, + NULL, + &_vq_auxt__44u5__p1_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u5__p2_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__44u5__p2_0[] = { + 3, 4, 4, 5, 6, 6, 5, 6, 6, 5, 6, 6, 6, 8, 8, 6, + 7, 8, 5, 6, 6, 6, 8, 7, 6, 8, 8, 5, 6, 6, 6, 8, + 8, 6, 8, 8, 6, 8, 8, 8, 9, 9, 8, 9, 9, 6, 8, 7, + 7, 9, 8, 8, 9, 9, 5, 6, 6, 6, 8, 7, 6, 8, 8, 6, + 8, 7, 8, 9, 9, 7, 8, 9, 6, 8, 8, 8, 9, 9, 8, 9, + 9, +}; + +static float _vq_quantthresh__44u5__p2_0[] = { + -0.5, 0.5, +}; + +static long _vq_quantmap__44u5__p2_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__44u5__p2_0 = { + _vq_quantthresh__44u5__p2_0, + _vq_quantmap__44u5__p2_0, + 3, + 3 +}; + +static static_codebook _44u5__p2_0 = { + 4, 81, + _vq_lengthlist__44u5__p2_0, + 1, -535822336, 1611661312, 2, 0, + _vq_quantlist__44u5__p2_0, + NULL, + &_vq_auxt__44u5__p2_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u5__p3_0[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44u5__p3_0[] = { + 2, 4, 5, 8, 8, 5, 7, 6, 9, 9, 5, 6, 7, 9, 9, 8, + 10, 9,13,12, 8, 9,10,12,12, 5, 7, 7,10,10, 7, 9, + 9,11,11, 6, 8, 9,11,11,10,11,11,14,14, 9,10,11, + 13,14, 5, 7, 7, 9,10, 7, 9, 8,11,11, 7, 9, 9,11, + 11, 9,11,10,14,13,10,11,11,14,14, 8,10,10,13,13, + 10,11,11,15,14, 9,11,11,14,14,13,14,14,17,16,12, + 13,13,15,16, 8,10,10,13,13, 9,11,11,14,15,10,11, + 11,14,15,12,14,13,16,16,13,15,14,15,17, 5, 7, 7, + 10,10, 7, 9, 9,11,11, 7, 9, 9,11,11,10,11,11,14, + 14,10,11,12,14,14, 7, 9, 9,12,11, 9,11,11,13,13, + 9,11,11,13,13,12,13,13,15,16,11,12,13,15,16, 6, + 9, 9,11,11, 8,11,10,13,12, 9,11,11,13,14,11,13, + 12,16,14,11,13,13,16,17,10,12,11,15,15,11,13,13, + 16,16,11,13,13,17,16,14,15,15,17,17,14,16,16,17, + 18, 9,11,11,14,15,10,12,12,15,15,11,13,13,16,17, + 13,15,13,17,15,14,15,16,18, 0, 5, 7, 7,10,10, 7, + 9, 9,11,11, 7, 9, 9,11,11,10,11,11,14,14,10,11, + 12,14,15, 6, 9, 9,12,11, 9,11,11,13,13, 8,10,11, + 12,13,11,13,13,16,15,11,12,13,14,15, 7, 9, 9,11, + 12, 9,11,11,13,13, 9,11,11,13,13,11,13,13,15,16, + 11,13,13,15,14, 9,11,11,15,14,11,13,13,17,15,10, + 12,12,15,15,14,16,16,17,17,13,13,15,15,17,10,11, + 12,15,15,11,13,13,16,16,11,13,13,15,15,14,15,15, + 18,18,14,15,15,17,17, 8,10,10,13,13,10,12,11,15, + 15,10,11,12,15,15,14,15,15,18,18,13,14,14,18,18, + 9,11,11,15,16,11,13,13,17,17,11,13,13,16,16,15, + 15,16,17, 0,14,15,17, 0, 0, 9,11,11,15,15,10,13, + 12,18,16,11,13,13,15,16,14,16,15,20,20,14,15,16, + 17, 0,13,14,14,20,16,14,15,16,19,18,14,15,15,19, + 0,18,16, 0,20,20,16,18,18, 0, 0,12,14,14,18,18, + 13,15,14,18,16,14,15,16,18,20,16,19,16, 0,17,17, + 18,18,19, 0, 8,10,10,14,14,10,11,11,14,15,10,11, + 12,15,15,13,15,14,19,17,13,15,15,17, 0, 9,11,11, + 16,15,11,13,13,16,16,10,12,13,15,17,14,16,16,18, + 18,14,15,15,18, 0, 9,11,11,15,15,11,13,13,16,17, + 11,13,13,18,17,14,18,16,18,18,15,17,17,18, 0,12, + 14,14,18,18,14,15,15,20, 0,13,14,15,17, 0,16,18, + 17, 0, 0,16,16, 0,17,20,12,14,14,18,18,14,16,15, + 0,18,14,16,15,18, 0,16,19,17, 0, 0,17,18,16, 0, + 0, +}; + +static float _vq_quantthresh__44u5__p3_0[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__44u5__p3_0[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44u5__p3_0 = { + _vq_quantthresh__44u5__p3_0, + _vq_quantmap__44u5__p3_0, + 5, + 5 +}; + +static static_codebook _44u5__p3_0 = { + 4, 625, + _vq_lengthlist__44u5__p3_0, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__44u5__p3_0, + NULL, + &_vq_auxt__44u5__p3_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u5__p4_0[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44u5__p4_0[] = { + 4, 5, 5, 8, 8, 6, 7, 6, 9, 9, 6, 6, 7, 9, 9, 8, + 9, 9,11,11, 8, 9, 9,11,11, 6, 7, 7, 9, 9, 7, 8, + 8,10,10, 6, 7, 8, 9,10, 9,10,10,11,12, 9, 9,10, + 11,12, 6, 7, 7, 9, 9, 6, 8, 7,10, 9, 7, 8, 8,10, + 10, 9,10, 9,12,11, 9,10,10,12,11, 8, 9, 9,12,11, + 9,10,10,12,12, 9,10,10,12,12,11,12,12,13,14,11, + 11,12,13,14, 8, 9, 9,11,12, 9,10,10,12,12, 9,10, + 10,12,12,11,12,11,14,13,11,12,12,13,13, 5, 7, 7, + 9, 9, 7, 8, 8,10,10, 7, 8, 8,10,10, 9,10,10,12, + 12, 9,10,10,12,12, 7, 8, 8,10,10, 8, 8, 9,10,11, + 8, 9, 9,11,11,10,10,11,11,13,10,11,11,12,13, 6, + 7, 8,10,10, 7, 9, 8,11,10, 8, 9, 9,11,11,10,11, + 10,13,11,10,11,11,12,12, 9,10,10,12,12,10,10,11, + 12,13,10,11,11,13,13,12,11,13,12,15,12,13,13,14, + 15, 9,10,10,12,12, 9,11,10,13,12,10,11,11,13,13, + 11,13,11,14,12,12,13,13,14,15, 5, 7, 7, 9, 9, 7, + 8, 8,10,10, 7, 8, 8,10,10, 9,10,10,12,12, 9,10, + 10,12,12, 6, 8, 7,10,10, 8, 9, 9,11,11, 7, 8, 9, + 10,11,10,11,11,12,12,10,10,11,11,13, 7, 8, 8,10, + 10, 8, 9, 9,11,11, 8, 9, 8,11,10,10,11,11,13,12, + 10,11,10,13,11, 9,10,10,12,12,10,11,11,13,12, 9, + 10,10,12,13,12,13,13,14,15,11,11,13,12,14, 9,10, + 10,12,12,10,11,11,13,13,10,11,10,13,12,12,13,13, + 14,14,12,13,11,14,12, 8, 9, 9,12,12, 9,10,10,12, + 12, 9,10,10,12,12,12,12,12,14,14,11,12,12,14,13, + 9,10,10,12,12,10,11,11,13,13,10,11,11,13,12,12, + 12,13,14,15,12,13,13,15,14, 9,10,10,12,12,10,11, + 10,13,12,10,11,11,12,13,12,13,12,15,13,12,13,13, + 14,15,11,12,12,14,13,11,12,12,14,15,12,13,13,15, + 14,13,12,14,12,16,13,14,14,15,15,11,11,12,14,14, + 11,12,11,14,13,12,13,13,14,15,13,14,12,16,12,14, + 14,15,16,16, 8, 9, 9,11,12, 9,10,10,12,12, 9,10, + 10,12,13,11,12,12,13,13,12,12,13,14,14, 9,10,10, + 12,12,10,11,10,13,12,10,10,11,12,13,12,13,13,15, + 14,12,12,13,13,15, 9,10,10,12,13,10,11,11,12,13, + 10,11,11,13,13,12,13,13,14,15,12,13,12,15,14,11, + 12,11,14,13,12,13,13,15,14,11,11,12,13,14,14,15, + 14,16,15,13,12,14,13,16,11,12,12,13,14,12,13,13, + 14,15,11,12,11,14,14,14,14,14,15,16,13,15,12,16, + 12, +}; + +static float _vq_quantthresh__44u5__p4_0[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__44u5__p4_0[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44u5__p4_0 = { + _vq_quantthresh__44u5__p4_0, + _vq_quantmap__44u5__p4_0, + 5, + 5 +}; + +static static_codebook _44u5__p4_0 = { + 4, 625, + _vq_lengthlist__44u5__p4_0, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__44u5__p4_0, + NULL, + &_vq_auxt__44u5__p4_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u5__p5_0[] = { + 4, + 3, + 5, + 2, + 6, + 1, + 7, + 0, + 8, +}; + +static long _vq_lengthlist__44u5__p5_0[] = { + 2, 3, 3, 6, 6, 8, 8,10,10, 4, 5, 5, 8, 7, 8, 8, + 11,10, 3, 5, 5, 7, 8, 8, 8,10,11, 6, 8, 7,10, 9, + 10,10,11,11, 6, 7, 8, 9, 9, 9,10,11,12, 8, 8, 8, + 10,10,11,11,13,12, 8, 8, 9, 9,10,11,11,12,13,10, + 11,10,12,11,13,12,14,14,10,10,11,11,12,12,13,14, + 14, +}; + +static float _vq_quantthresh__44u5__p5_0[] = { + -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, +}; + +static long _vq_quantmap__44u5__p5_0[] = { + 7, 5, 3, 1, 0, 2, 4, 6, + 8, +}; + +static encode_aux_threshmatch _vq_auxt__44u5__p5_0 = { + _vq_quantthresh__44u5__p5_0, + _vq_quantmap__44u5__p5_0, + 9, + 9 +}; + +static static_codebook _44u5__p5_0 = { + 2, 81, + _vq_lengthlist__44u5__p5_0, + 1, -531628032, 1611661312, 4, 0, + _vq_quantlist__44u5__p5_0, + NULL, + &_vq_auxt__44u5__p5_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u5__p6_0[] = { + 4, + 3, + 5, + 2, + 6, + 1, + 7, + 0, + 8, +}; + +static long _vq_lengthlist__44u5__p6_0[] = { + 3, 4, 4, 5, 5, 7, 7, 9, 9, 4, 5, 4, 6, 6, 7, 7, + 9, 9, 4, 4, 5, 6, 6, 7, 7, 9, 9, 5, 6, 6, 7, 7, + 8, 8,10,10, 6, 6, 6, 7, 7, 8, 8,10,10, 7, 7, 7, + 8, 8, 9, 9,11,10, 7, 7, 7, 8, 8, 9, 9,10,11, 9, + 9, 9,10,10,11,10,11,11, 9, 9, 9,10,10,11,10,11, + 11, +}; + +static float _vq_quantthresh__44u5__p6_0[] = { + -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, +}; + +static long _vq_quantmap__44u5__p6_0[] = { + 7, 5, 3, 1, 0, 2, 4, 6, + 8, +}; + +static encode_aux_threshmatch _vq_auxt__44u5__p6_0 = { + _vq_quantthresh__44u5__p6_0, + _vq_quantmap__44u5__p6_0, + 9, + 9 +}; + +static static_codebook _44u5__p6_0 = { + 2, 81, + _vq_lengthlist__44u5__p6_0, + 1, -531628032, 1611661312, 4, 0, + _vq_quantlist__44u5__p6_0, + NULL, + &_vq_auxt__44u5__p6_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u5__p7_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__44u5__p7_0[] = { + 1, 4, 4, 5, 7, 7, 5, 7, 7, 5, 9, 9, 8,11,10, 7, + 11,10, 5, 9, 9, 7,10,10, 8,10,11, 4, 9, 9, 9,12, + 12, 9,12,12, 8,12,12,11,12,12,10,12,13, 7,12,12, + 11,12,12,10,12,13, 4, 9, 9, 9,12,12, 9,12,12, 7, + 12,11,10,13,13,11,12,12, 7,12,12,10,13,13,11,12, + 12, +}; + +static float _vq_quantthresh__44u5__p7_0[] = { + -5.5, 5.5, +}; + +static long _vq_quantmap__44u5__p7_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__44u5__p7_0 = { + _vq_quantthresh__44u5__p7_0, + _vq_quantmap__44u5__p7_0, + 3, + 3 +}; + +static static_codebook _44u5__p7_0 = { + 4, 81, + _vq_lengthlist__44u5__p7_0, + 1, -529137664, 1618345984, 2, 0, + _vq_quantlist__44u5__p7_0, + NULL, + &_vq_auxt__44u5__p7_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u5__p7_1[] = { + 5, + 4, + 6, + 3, + 7, + 2, + 8, + 1, + 9, + 0, + 10, +}; + +static long _vq_lengthlist__44u5__p7_1[] = { + 2, 4, 4, 6, 6, 7, 7, 8, 8, 8, 8, 4, 5, 5, 7, 7, + 8, 8, 9, 8, 8, 9, 4, 5, 5, 7, 7, 8, 8, 9, 9, 8, + 9, 6, 7, 7, 8, 8, 9, 8, 9, 9, 9, 9, 6, 7, 7, 8, + 8, 9, 9, 9, 9, 9, 9, 7, 8, 8, 9, 9, 9, 9, 9, 9, + 9, 9, 7, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 8, 9, 9, + 9, 9, 9, 9,10,10,10,10, 8, 9, 9, 9, 9, 9, 9,10, + 10,10,10, 8, 9, 9, 9, 9, 9, 9,10,10,10,10, 8, 9, + 9, 9, 9, 9, 9,10,10,10,10, +}; + +static float _vq_quantthresh__44u5__p7_1[] = { + -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, + 3.5, 4.5, +}; + +static long _vq_quantmap__44u5__p7_1[] = { + 9, 7, 5, 3, 1, 0, 2, 4, + 6, 8, 10, +}; + +static encode_aux_threshmatch _vq_auxt__44u5__p7_1 = { + _vq_quantthresh__44u5__p7_1, + _vq_quantmap__44u5__p7_1, + 11, + 11 +}; + +static static_codebook _44u5__p7_1 = { + 2, 121, + _vq_lengthlist__44u5__p7_1, + 1, -531365888, 1611661312, 4, 0, + _vq_quantlist__44u5__p7_1, + NULL, + &_vq_auxt__44u5__p7_1, + NULL, + 0 +}; + +static long _vq_quantlist__44u5__p8_0[] = { + 5, + 4, + 6, + 3, + 7, + 2, + 8, + 1, + 9, + 0, + 10, +}; + +static long _vq_lengthlist__44u5__p8_0[] = { + 1, 4, 4, 6, 6, 8, 8, 9, 9,10,10, 4, 6, 6, 7, 7, + 9, 9,10,10,11,11, 4, 6, 6, 7, 7, 9, 9,10,10,11, + 11, 6, 8, 7, 9, 9,10,10,11,11,13,12, 6, 8, 8, 9, + 9,10,10,11,11,12,13, 8, 9, 9,10,10,12,12,13,12, + 14,13, 8, 9, 9,10,10,12,12,13,13,14,14, 9,11,11, + 12,12,13,13,14,14,15,14, 9,11,11,12,12,13,13,14, + 14,15,14,11,12,12,13,13,14,14,15,14,15,14,11,11, + 12,13,13,14,14,14,14,15,15, +}; + +static float _vq_quantthresh__44u5__p8_0[] = { + -49.5, -38.5, -27.5, -16.5, -5.5, 5.5, 16.5, 27.5, + 38.5, 49.5, +}; + +static long _vq_quantmap__44u5__p8_0[] = { + 9, 7, 5, 3, 1, 0, 2, 4, + 6, 8, 10, +}; + +static encode_aux_threshmatch _vq_auxt__44u5__p8_0 = { + _vq_quantthresh__44u5__p8_0, + _vq_quantmap__44u5__p8_0, + 11, + 11 +}; + +static static_codebook _44u5__p8_0 = { + 2, 121, + _vq_lengthlist__44u5__p8_0, + 1, -524582912, 1618345984, 4, 0, + _vq_quantlist__44u5__p8_0, + NULL, + &_vq_auxt__44u5__p8_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u5__p8_1[] = { + 5, + 4, + 6, + 3, + 7, + 2, + 8, + 1, + 9, + 0, + 10, +}; + +static long _vq_lengthlist__44u5__p8_1[] = { + 3, 5, 5, 6, 6, 7, 7, 7, 7, 7, 7, 5, 6, 5, 7, 6, + 7, 7, 8, 8, 8, 8, 5, 5, 5, 6, 6, 7, 7, 8, 8, 8, + 8, 6, 7, 6, 7, 7, 8, 8, 8, 8, 8, 8, 6, 6, 7, 7, + 7, 8, 8, 8, 8, 8, 8, 7, 7, 7, 8, 8, 8, 8, 8, 8, + 8, 8, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 7, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 7, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, +}; + +static float _vq_quantthresh__44u5__p8_1[] = { + -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, + 3.5, 4.5, +}; + +static long _vq_quantmap__44u5__p8_1[] = { + 9, 7, 5, 3, 1, 0, 2, 4, + 6, 8, 10, +}; + +static encode_aux_threshmatch _vq_auxt__44u5__p8_1 = { + _vq_quantthresh__44u5__p8_1, + _vq_quantmap__44u5__p8_1, + 11, + 11 +}; + +static static_codebook _44u5__p8_1 = { + 2, 121, + _vq_lengthlist__44u5__p8_1, + 1, -531365888, 1611661312, 4, 0, + _vq_quantlist__44u5__p8_1, + NULL, + &_vq_auxt__44u5__p8_1, + NULL, + 0 +}; + +static long _vq_quantlist__44u5__p9_0[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__44u5__p9_0[] = { + 1, 3, 2,12,10,13,13,13,13,13,13,13,13, 4, 9, 9, + 13,13,13,13,13,13,13,13,13,13, 5,10, 9,13,13,13, + 13,13,13,13,13,13,13,12,13,13,13,13,13,13,13,13, + 13,13,13,13,11,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,13,13,12,12,12, + 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, + 12,12,12,12,12,12,12,12,12, +}; + +static float _vq_quantthresh__44u5__p9_0[] = { + -1402.5, -1147.5, -892.5, -637.5, -382.5, -127.5, 127.5, 382.5, + 637.5, 892.5, 1147.5, 1402.5, +}; + +static long _vq_quantmap__44u5__p9_0[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__44u5__p9_0 = { + _vq_quantthresh__44u5__p9_0, + _vq_quantmap__44u5__p9_0, + 13, + 13 +}; + +static static_codebook _44u5__p9_0 = { + 2, 169, + _vq_lengthlist__44u5__p9_0, + 1, -514332672, 1627381760, 4, 0, + _vq_quantlist__44u5__p9_0, + NULL, + &_vq_auxt__44u5__p9_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u5__p9_1[] = { + 7, + 6, + 8, + 5, + 9, + 4, + 10, + 3, + 11, + 2, + 12, + 1, + 13, + 0, + 14, +}; + +static long _vq_lengthlist__44u5__p9_1[] = { + 1, 4, 4, 7, 7, 8, 8, 8, 7, 8, 7, 9, 8, 9, 9, 4, + 7, 6, 9, 8,10,10, 9, 8, 9, 9, 9, 9, 9, 8, 5, 6, + 6, 8, 9,10,10, 9, 9, 9,10,10,10,10,11, 7, 8, 8, + 10,10,11,11,10,10,11,11,11,12,11,11, 7, 8, 8,10, + 10,11,11,10,10,11,11,12,11,11,11, 8, 9, 9,11,11, + 12,12,11,11,12,11,12,12,12,12, 8, 9,10,11,11,12, + 12,11,11,12,12,12,12,12,12, 8, 9, 9,10,10,12,11, + 12,12,12,12,12,12,12,13, 8, 9, 9,11,11,11,11,12, + 12,12,12,13,12,13,13, 9,10,10,11,11,12,12,12,13, + 12,13,13,13,14,13, 9,10,10,11,11,12,12,12,13,13, + 12,13,13,14,13, 9,11,10,12,11,13,12,12,13,13,13, + 13,13,13,14, 9,10,10,12,12,12,12,12,13,13,13,13, + 13,14,14,10,11,11,12,12,12,13,13,13,14,14,13,14, + 14,14,10,11,11,12,12,12,12,13,12,13,14,13,14,14, + 14, +}; + +static float _vq_quantthresh__44u5__p9_1[] = { + -110.5, -93.5, -76.5, -59.5, -42.5, -25.5, -8.5, 8.5, + 25.5, 42.5, 59.5, 76.5, 93.5, 110.5, +}; + +static long _vq_quantmap__44u5__p9_1[] = { + 13, 11, 9, 7, 5, 3, 1, 0, + 2, 4, 6, 8, 10, 12, 14, +}; + +static encode_aux_threshmatch _vq_auxt__44u5__p9_1 = { + _vq_quantthresh__44u5__p9_1, + _vq_quantmap__44u5__p9_1, + 15, + 15 +}; + +static static_codebook _44u5__p9_1 = { + 2, 225, + _vq_lengthlist__44u5__p9_1, + 1, -522338304, 1620115456, 4, 0, + _vq_quantlist__44u5__p9_1, + NULL, + &_vq_auxt__44u5__p9_1, + NULL, + 0 +}; + +static long _vq_quantlist__44u5__p9_2[] = { + 8, + 7, + 9, + 6, + 10, + 5, + 11, + 4, + 12, + 3, + 13, + 2, + 14, + 1, + 15, + 0, + 16, +}; + +static long _vq_lengthlist__44u5__p9_2[] = { + 2, 5, 5, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, + 9, 5, 6, 6, 7, 7, 8, 8, 9, 8, 9, 9, 9, 9, 9, 9, + 9, 9, 5, 6, 6, 7, 7, 8, 8, 9, 8, 9, 9, 9, 9, 9, + 9, 9, 9, 7, 7, 7, 8, 8, 9, 8, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 7, 7, 7, 8, 8, 9, 8, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, + 9,10, 9,10,10,10, 8, 8, 8, 9, 8, 9, 9, 9, 9, 9, + 9, 9,10, 9,10, 9,10, 8, 9, 9, 9, 9, 9, 9, 9, 9, + 9,10, 9,10,10,10,10,10, 8, 9, 9, 9, 9, 9, 9,10, + 9,10, 9,10,10,10,10,10,10, 9, 9, 9, 9, 9,10, 9, + 10,10,10,10,10,10,10,10,10,10, 9, 9, 9, 9, 9, 9, + 9,10, 9,10, 9,10,10,10,10,10,10, 9, 9, 9, 9, 9, + 10,10,10,10,10,10,10,10,10,10,10,10, 9, 9, 9, 9, + 9, 9,10,10,10,10,10,10,10,10,10,10,10, 9, 9, 9, + 9,10,10, 9,10,10,10,10,10,10,10,10,10,10, 9, 9, + 9, 9, 9,10,10,10,10,10,10,10,10,10,10,10,10, 9, + 9, 9, 9, 9,10,10,10,10,10,10,10,10,10,10,10,10, + 9, 9, 9,10, 9,10,10,10,10,10,10,10,10,10,10,10, + 10, +}; + +static float _vq_quantthresh__44u5__p9_2[] = { + -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, + 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, +}; + +static long _vq_quantmap__44u5__p9_2[] = { + 15, 13, 11, 9, 7, 5, 3, 1, + 0, 2, 4, 6, 8, 10, 12, 14, + 16, +}; + +static encode_aux_threshmatch _vq_auxt__44u5__p9_2 = { + _vq_quantthresh__44u5__p9_2, + _vq_quantmap__44u5__p9_2, + 17, + 17 +}; + +static static_codebook _44u5__p9_2 = { + 2, 289, + _vq_lengthlist__44u5__p9_2, + 1, -529530880, 1611661312, 5, 0, + _vq_quantlist__44u5__p9_2, + NULL, + &_vq_auxt__44u5__p9_2, + NULL, + 0 +}; + +static long _huff_lengthlist__44u5__short[] = { + 4,10,17,13,17,13,17,17,17,17, 3, 6, 8, 9,11, 9, + 15,12,16,17, 6, 5, 5, 7, 7, 8,10,11,17,17, 7, 8, + 7, 9, 9,10,13,13,17,17, 8, 6, 5, 7, 4, 7, 5, 8, + 14,17, 9, 9, 8, 9, 7, 9, 8,10,16,17,12,10, 7, 8, + 4, 7, 4, 7,16,17,12,11, 9,10, 6, 9, 5, 7,14,17, + 14,13,10,15, 4, 8, 3, 5,14,17,17,14,11,15, 6,10, + 6, 8,15,17, +}; + +static static_codebook _huff_book__44u5__short = { + 2, 100, + _huff_lengthlist__44u5__short, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist__44u6__long[] = { + 3, 9,14,13,14,13,16,12,13,14, 5, 4, 6, 6, 8, 9, + 11,10,12,15,10, 5, 5, 6, 6, 8,10,10,13,16,10, 6, + 6, 6, 6, 8, 9, 9,12,14,13, 7, 6, 6, 4, 6, 6, 7, + 11,14,10, 7, 7, 7, 6, 6, 6, 7,10,13,15,10, 9, 8, + 5, 6, 5, 6,10,14,10, 9, 8, 8, 6, 6, 5, 4, 6,11, + 11,11,12,11,10, 9, 9, 5, 5, 9,10,12,15,13,13,13, + 13, 8, 7, 7, +}; + +static static_codebook _huff_book__44u6__long = { + 2, 100, + _huff_lengthlist__44u6__long, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _vq_quantlist__44u6__p1_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__44u6__p1_0[] = { + 1, 4, 4, 4, 8, 7, 5, 7, 7, 5, 8, 8, 8,10,10, 7, + 9,10, 5, 8, 8, 7,10, 9, 8,10,10, 5, 8, 8, 8,10, + 10, 8,10,10, 8,10,10,10,12,13,10,13,13, 7,10,10, + 10,13,11,10,13,13, 5, 8, 8, 8,11,10, 8,10,10, 7, + 10,10,10,13,13,10,11,13, 8,10,11,10,13,13,10,13, + 12, +}; + +static float _vq_quantthresh__44u6__p1_0[] = { + -0.5, 0.5, +}; + +static long _vq_quantmap__44u6__p1_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__44u6__p1_0 = { + _vq_quantthresh__44u6__p1_0, + _vq_quantmap__44u6__p1_0, + 3, + 3 +}; + +static static_codebook _44u6__p1_0 = { + 4, 81, + _vq_lengthlist__44u6__p1_0, + 1, -535822336, 1611661312, 2, 0, + _vq_quantlist__44u6__p1_0, + NULL, + &_vq_auxt__44u6__p1_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u6__p2_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__44u6__p2_0[] = { + 3, 4, 4, 5, 6, 6, 5, 6, 6, 5, 6, 6, 6, 8, 8, 6, + 7, 8, 5, 6, 6, 6, 8, 7, 6, 8, 8, 5, 6, 6, 6, 8, + 8, 6, 8, 8, 6, 8, 8, 8, 9, 9, 8, 9, 9, 6, 7, 7, + 7, 9, 8, 8, 9, 9, 5, 6, 6, 6, 8, 7, 6, 8, 8, 6, + 8, 8, 8, 9, 9, 7, 8, 9, 6, 8, 8, 8, 9, 9, 8, 9, + 9, +}; + +static float _vq_quantthresh__44u6__p2_0[] = { + -0.5, 0.5, +}; + +static long _vq_quantmap__44u6__p2_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__44u6__p2_0 = { + _vq_quantthresh__44u6__p2_0, + _vq_quantmap__44u6__p2_0, + 3, + 3 +}; + +static static_codebook _44u6__p2_0 = { + 4, 81, + _vq_lengthlist__44u6__p2_0, + 1, -535822336, 1611661312, 2, 0, + _vq_quantlist__44u6__p2_0, + NULL, + &_vq_auxt__44u6__p2_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u6__p3_0[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44u6__p3_0[] = { + 2, 5, 4, 8, 8, 5, 7, 6, 9, 9, 5, 6, 7, 9, 9, 8, + 9, 9,13,12, 8, 9,10,12,13, 5, 7, 7,10, 9, 7, 9, + 9,11,11, 7, 8, 9,11,11,10,11,11,14,14, 9,10,11, + 13,14, 5, 7, 7, 9,10, 6, 9, 8,11,11, 7, 9, 9,11, + 11, 9,11,10,14,13,10,11,11,14,13, 8,10,10,13,13, + 10,11,11,15,15, 9,11,11,14,14,13,14,14,17,16,12, + 13,14,16,16, 8,10,10,13,14, 9,11,11,14,15,10,11, + 12,14,15,12,14,13,16,15,13,14,14,15,17, 5, 7, 7, + 10,10, 7, 9, 9,11,11, 7, 9, 9,11,11,10,12,11,14, + 14,10,11,11,14,14, 7, 9, 9,12,11, 9,11,11,13,13, + 9,11,11,13,13,11,13,13,14,15,11,12,13,15,16, 6, + 9, 9,11,12, 8,11,10,13,12, 9,11,11,13,14,11,13, + 12,16,14,11,13,13,15,16,10,12,11,14,15,11,13,13, + 15,17,11,13,13,17,16,15,15,16,17,16,14,15,16,18, + 0, 9,11,11,14,15,10,12,12,16,15,11,13,13,16,16, + 13,15,14,18,15,14,16,16, 0, 0, 5, 7, 7,10,10, 7, + 9, 9,11,11, 7, 9, 9,11,11,10,11,11,14,14,10,11, + 12,14,14, 6, 9, 9,11,11, 9,11,11,13,13, 8,10,11, + 12,13,11,13,13,16,15,11,12,13,14,16, 7, 9, 9,11, + 12, 9,11,11,13,13, 9,11,11,13,13,11,13,13,16,15, + 11,13,12,15,15, 9,11,11,15,14,11,13,13,17,16,10, + 12,13,15,16,14,16,16, 0,18,14,14,15,15,17,10,11, + 12,15,15,11,13,13,16,16,11,13,13,16,16,14,16,16, + 19,17,14,15,15,17,17, 8,10,10,14,14,10,12,11,15, + 15,10,11,12,16,15,14,15,15,18,20,13,14,16,17,18, + 9,11,11,15,16,11,13,13,17,17,11,13,13,17,16,15, + 16,16, 0, 0,15,16,16, 0, 0, 9,11,11,15,15,10,13, + 12,17,15,11,13,13,17,16,15,17,15,20,19,15,16,16, + 19, 0,13,15,14, 0,17,14,15,16, 0,20,15,16,16, 0, + 19,17,18, 0, 0, 0,16,17,18, 0, 0,12,14,14,19,18, + 13,15,14, 0,17,14,15,16,19,19,16,18,16, 0,19,19, + 20,17,20, 0, 8,10,10,13,14,10,11,11,15,15,10,12, + 12,15,16,14,15,14,19,16,14,15,15, 0,18, 9,11,11, + 16,15,11,13,13, 0,16,11,12,13,16,17,14,16,17, 0, + 19,15,16,16,18, 0, 9,11,11,15,16,11,13,13,16,16, + 11,14,13,18,17,15,16,16,18,20,15,17,19, 0, 0,12, + 14,14,17,17,14,16,15, 0, 0,13,14,15,19, 0,16,18, + 20, 0, 0,16,16,18,18, 0,12,14,14,17,20,14,16,16, + 19, 0,14,16,14, 0,20,16,20,17, 0, 0,17, 0,15, 0, + 19, +}; + +static float _vq_quantthresh__44u6__p3_0[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__44u6__p3_0[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44u6__p3_0 = { + _vq_quantthresh__44u6__p3_0, + _vq_quantmap__44u6__p3_0, + 5, + 5 +}; + +static static_codebook _44u6__p3_0 = { + 4, 625, + _vq_lengthlist__44u6__p3_0, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__44u6__p3_0, + NULL, + &_vq_auxt__44u6__p3_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u6__p4_0[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44u6__p4_0[] = { + 4, 5, 5, 8, 8, 6, 7, 6, 9, 9, 6, 6, 7, 9, 9, 8, + 9, 9,11,11, 8, 9, 9,11,11, 6, 7, 7, 9, 9, 7, 8, + 8,10,10, 7, 7, 8, 9,10, 9,10,10,11,11, 9, 9,10, + 11,12, 6, 7, 7, 9, 9, 7, 8, 7,10, 9, 7, 8, 8,10, + 10, 9,10, 9,12,11, 9,10,10,12,11, 8, 9, 9,11,11, + 9,10,10,12,12, 9,10,10,12,12,11,12,12,14,13,11, + 11,12,13,13, 8, 9, 9,11,11, 9,10,10,12,12, 9,10, + 10,12,12,11,12,11,13,12,11,12,12,13,13, 5, 7, 7, + 9, 9, 7, 8, 7,10,10, 7, 7, 8,10,10, 9,10,10,12, + 11, 9,10,10,11,12, 7, 8, 8,10,10, 8, 8, 9,11,11, + 8, 9, 9,11,11,10,10,11,12,13,10,10,11,12,12, 6, + 7, 7,10,10, 7, 9, 8,11,10, 8, 8, 9,10,11,10,11, + 10,13,11,10,11,11,12,12, 9,10,10,12,12,10,10,11, + 13,13,10,11,11,12,13,12,12,12,13,14,12,12,13,14, + 14, 9,10,10,12,12, 9,10,10,13,12,10,11,11,13,13, + 11,12,11,14,12,12,13,13,14,14, 6, 7, 7, 9, 9, 7, + 8, 7,10,10, 7, 8, 8,10,10, 9,10,10,12,11, 9,10, + 10,11,12, 6, 7, 7,10,10, 8, 9, 8,11,10, 7, 8, 9, + 10,11,10,11,11,12,12,10,10,11,11,13, 7, 8, 8,10, + 10, 8, 9, 9,11,11, 8, 9, 8,11,11,10,11,10,13,12, + 10,11,11,13,12, 9,10,10,12,12,10,11,11,13,12, 9, + 10,10,12,13,12,13,12,14,14,11,11,12,12,14, 9,10, + 10,12,12,10,11,11,13,13,10,11,10,13,12,12,12,12, + 14,14,12,13,12,14,13, 8, 9, 9,11,11, 9,10,10,12, + 12, 9,10,10,12,12,11,12,12,14,13,11,12,12,13,14, + 9,10,10,12,12,10,11,11,13,13,10,11,11,13,13,12, + 12,13,14,15,12,12,13,14,14, 9,10,10,12,12, 9,11, + 10,13,12,10,10,11,12,13,12,13,12,14,13,12,12,13, + 14,15,11,12,12,14,13,11,12,12,14,14,12,13,13,14, + 14,13,13,14,14,16,13,14,14,15,15,11,12,11,13,13, + 11,12,11,14,13,12,12,13,14,15,12,14,12,15,12,13, + 14,15,15,16, 8, 9, 9,11,11, 9,10,10,12,12, 9,10, + 10,12,12,11,12,12,14,13,11,12,12,13,13, 9,10,10, + 12,12,10,11,10,13,12, 9,10,11,12,13,12,13,12,14, + 14,12,12,13,13,14, 9,10,10,12,12,10,11,11,13,13, + 10,11,11,13,13,12,13,12,14,14,12,13,13,14,14,11, + 11,11,13,13,12,13,12,14,14,11,11,12,13,14,14,14, + 14,16,15,12,12,14,12,15,11,12,12,13,14,12,13,13, + 14,15,11,12,12,14,14,13,14,14,16,16,13,14,13,16, + 13, +}; + +static float _vq_quantthresh__44u6__p4_0[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__44u6__p4_0[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44u6__p4_0 = { + _vq_quantthresh__44u6__p4_0, + _vq_quantmap__44u6__p4_0, + 5, + 5 +}; + +static static_codebook _44u6__p4_0 = { + 4, 625, + _vq_lengthlist__44u6__p4_0, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__44u6__p4_0, + NULL, + &_vq_auxt__44u6__p4_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u6__p5_0[] = { + 4, + 3, + 5, + 2, + 6, + 1, + 7, + 0, + 8, +}; + +static long _vq_lengthlist__44u6__p5_0[] = { + 2, 3, 3, 6, 6, 8, 8,10,10, 4, 5, 5, 8, 7, 8, 8, + 11,11, 3, 5, 5, 7, 8, 8, 8,11,11, 6, 8, 7, 9, 9, + 10, 9,12,11, 6, 7, 8, 9, 9, 9,10,11,12, 8, 8, 8, + 10, 9,12,11,13,13, 8, 8, 9, 9,10,11,12,13,13,10, + 11,11,12,12,13,13,14,14,10,10,11,11,12,13,13,14, + 14, +}; + +static float _vq_quantthresh__44u6__p5_0[] = { + -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, +}; + +static long _vq_quantmap__44u6__p5_0[] = { + 7, 5, 3, 1, 0, 2, 4, 6, + 8, +}; + +static encode_aux_threshmatch _vq_auxt__44u6__p5_0 = { + _vq_quantthresh__44u6__p5_0, + _vq_quantmap__44u6__p5_0, + 9, + 9 +}; + +static static_codebook _44u6__p5_0 = { + 2, 81, + _vq_lengthlist__44u6__p5_0, + 1, -531628032, 1611661312, 4, 0, + _vq_quantlist__44u6__p5_0, + NULL, + &_vq_auxt__44u6__p5_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u6__p6_0[] = { + 4, + 3, + 5, + 2, + 6, + 1, + 7, + 0, + 8, +}; + +static long _vq_lengthlist__44u6__p6_0[] = { + 3, 4, 4, 5, 5, 7, 7, 9, 9, 4, 5, 4, 6, 6, 7, 7, + 9, 9, 4, 4, 5, 6, 6, 7, 8, 9, 9, 5, 6, 6, 7, 7, + 8, 8,10,10, 5, 6, 6, 7, 7, 8, 8,10,10, 7, 8, 7, + 8, 8,10, 9,11,11, 7, 7, 8, 8, 8, 9,10,10,11, 9, + 9, 9,10,10,11,11,12,11, 9, 9, 9,10,10,11,11,11, + 12, +}; + +static float _vq_quantthresh__44u6__p6_0[] = { + -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, +}; + +static long _vq_quantmap__44u6__p6_0[] = { + 7, 5, 3, 1, 0, 2, 4, 6, + 8, +}; + +static encode_aux_threshmatch _vq_auxt__44u6__p6_0 = { + _vq_quantthresh__44u6__p6_0, + _vq_quantmap__44u6__p6_0, + 9, + 9 +}; + +static static_codebook _44u6__p6_0 = { + 2, 81, + _vq_lengthlist__44u6__p6_0, + 1, -531628032, 1611661312, 4, 0, + _vq_quantlist__44u6__p6_0, + NULL, + &_vq_auxt__44u6__p6_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u6__p7_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__44u6__p7_0[] = { + 1, 4, 4, 5, 7, 7, 5, 7, 7, 5, 9, 8, 7,10,10, 8, + 10,10, 5, 8, 9, 7,10,10, 7,10, 9, 4, 8, 8, 9,11, + 11, 8,11,11, 7,11,11,10,10,13,10,13,13, 7,11,11, + 10,13,12,10,13,13, 5, 9, 8, 8,11,11, 9,11,11, 7, + 11,11,10,13,13,10,12,13, 7,11,11,10,13,13, 9,13, + 10, +}; + +static float _vq_quantthresh__44u6__p7_0[] = { + -5.5, 5.5, +}; + +static long _vq_quantmap__44u6__p7_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__44u6__p7_0 = { + _vq_quantthresh__44u6__p7_0, + _vq_quantmap__44u6__p7_0, + 3, + 3 +}; + +static static_codebook _44u6__p7_0 = { + 4, 81, + _vq_lengthlist__44u6__p7_0, + 1, -529137664, 1618345984, 2, 0, + _vq_quantlist__44u6__p7_0, + NULL, + &_vq_auxt__44u6__p7_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u6__p7_1[] = { + 5, + 4, + 6, + 3, + 7, + 2, + 8, + 1, + 9, + 0, + 10, +}; + +static long _vq_lengthlist__44u6__p7_1[] = { + 3, 4, 4, 6, 6, 7, 7, 8, 8, 8, 8, 4, 5, 5, 7, 6, + 8, 8, 8, 8, 8, 8, 4, 5, 5, 6, 7, 8, 8, 8, 8, 8, + 8, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 6, 7, 7, 7, + 7, 8, 8, 8, 8, 8, 8, 7, 8, 8, 8, 8, 8, 8, 9, 9, + 9, 9, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 8, 8, 8, + 8, 8, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 9, 9, 9, + 9, 9, 9, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 8, 8, + 8, 8, 8, 9, 9, 9, 9, 9, 9, +}; + +static float _vq_quantthresh__44u6__p7_1[] = { + -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, + 3.5, 4.5, +}; + +static long _vq_quantmap__44u6__p7_1[] = { + 9, 7, 5, 3, 1, 0, 2, 4, + 6, 8, 10, +}; + +static encode_aux_threshmatch _vq_auxt__44u6__p7_1 = { + _vq_quantthresh__44u6__p7_1, + _vq_quantmap__44u6__p7_1, + 11, + 11 +}; + +static static_codebook _44u6__p7_1 = { + 2, 121, + _vq_lengthlist__44u6__p7_1, + 1, -531365888, 1611661312, 4, 0, + _vq_quantlist__44u6__p7_1, + NULL, + &_vq_auxt__44u6__p7_1, + NULL, + 0 +}; + +static long _vq_quantlist__44u6__p8_0[] = { + 5, + 4, + 6, + 3, + 7, + 2, + 8, + 1, + 9, + 0, + 10, +}; + +static long _vq_lengthlist__44u6__p8_0[] = { + 1, 4, 4, 6, 6, 8, 8, 9, 9,10,10, 4, 6, 6, 7, 7, + 9, 9,10,10,11,11, 4, 6, 6, 7, 7, 9, 9,10,10,11, + 11, 6, 8, 8, 9, 9,10,10,11,11,12,12, 6, 8, 8, 9, + 9,10,10,11,11,12,12, 8, 9, 9,10,10,11,11,12,12, + 13,13, 8, 9, 9,10,10,11,11,12,12,13,13,10,10,10, + 11,11,13,13,13,13,15,14, 9,10,10,12,11,12,13,13, + 13,14,15,11,12,12,13,13,13,13,15,14,15,15,11,11, + 12,13,13,14,14,14,15,15,15, +}; + +static float _vq_quantthresh__44u6__p8_0[] = { + -49.5, -38.5, -27.5, -16.5, -5.5, 5.5, 16.5, 27.5, + 38.5, 49.5, +}; + +static long _vq_quantmap__44u6__p8_0[] = { + 9, 7, 5, 3, 1, 0, 2, 4, + 6, 8, 10, +}; + +static encode_aux_threshmatch _vq_auxt__44u6__p8_0 = { + _vq_quantthresh__44u6__p8_0, + _vq_quantmap__44u6__p8_0, + 11, + 11 +}; + +static static_codebook _44u6__p8_0 = { + 2, 121, + _vq_lengthlist__44u6__p8_0, + 1, -524582912, 1618345984, 4, 0, + _vq_quantlist__44u6__p8_0, + NULL, + &_vq_auxt__44u6__p8_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u6__p8_1[] = { + 5, + 4, + 6, + 3, + 7, + 2, + 8, + 1, + 9, + 0, + 10, +}; + +static long _vq_lengthlist__44u6__p8_1[] = { + 3, 5, 5, 6, 6, 7, 7, 7, 7, 7, 7, 5, 6, 5, 7, 7, + 7, 7, 8, 7, 8, 8, 5, 5, 6, 6, 7, 7, 7, 7, 7, 8, + 8, 6, 7, 7, 7, 7, 8, 7, 8, 8, 8, 8, 6, 6, 7, 7, + 7, 7, 8, 8, 8, 8, 8, 7, 7, 7, 8, 8, 8, 8, 8, 8, + 8, 8, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, + 8, 8, 8, 8, 8, 8, 8, 8, 7, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 7, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, +}; + +static float _vq_quantthresh__44u6__p8_1[] = { + -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, + 3.5, 4.5, +}; + +static long _vq_quantmap__44u6__p8_1[] = { + 9, 7, 5, 3, 1, 0, 2, 4, + 6, 8, 10, +}; + +static encode_aux_threshmatch _vq_auxt__44u6__p8_1 = { + _vq_quantthresh__44u6__p8_1, + _vq_quantmap__44u6__p8_1, + 11, + 11 +}; + +static static_codebook _44u6__p8_1 = { + 2, 121, + _vq_lengthlist__44u6__p8_1, + 1, -531365888, 1611661312, 4, 0, + _vq_quantlist__44u6__p8_1, + NULL, + &_vq_auxt__44u6__p8_1, + NULL, + 0 +}; + +static long _vq_quantlist__44u6__p9_0[] = { + 7, + 6, + 8, + 5, + 9, + 4, + 10, + 3, + 11, + 2, + 12, + 1, + 13, + 0, + 14, +}; + +static long _vq_lengthlist__44u6__p9_0[] = { + 1, 3, 2, 9, 8,15,15,15,15,15,15,15,15,15,15, 4, + 8, 9,13,14,14,14,14,14,14,14,14,14,14,14, 5, 8, + 9,14,14,14,14,14,14,14,14,14,14,14,14,11,14,14, + 14,14,14,14,14,14,14,14,14,14,14,14,11,14,14,14, + 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14, + 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14, + 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14, + 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14, + 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14, + 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14, + 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14, + 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14, + 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14, + 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14, + 14, +}; + +static float _vq_quantthresh__44u6__p9_0[] = { + -1657.5, -1402.5, -1147.5, -892.5, -637.5, -382.5, -127.5, 127.5, + 382.5, 637.5, 892.5, 1147.5, 1402.5, 1657.5, +}; + +static long _vq_quantmap__44u6__p9_0[] = { + 13, 11, 9, 7, 5, 3, 1, 0, + 2, 4, 6, 8, 10, 12, 14, +}; + +static encode_aux_threshmatch _vq_auxt__44u6__p9_0 = { + _vq_quantthresh__44u6__p9_0, + _vq_quantmap__44u6__p9_0, + 15, + 15 +}; + +static static_codebook _44u6__p9_0 = { + 2, 225, + _vq_lengthlist__44u6__p9_0, + 1, -514071552, 1627381760, 4, 0, + _vq_quantlist__44u6__p9_0, + NULL, + &_vq_auxt__44u6__p9_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u6__p9_1[] = { + 7, + 6, + 8, + 5, + 9, + 4, + 10, + 3, + 11, + 2, + 12, + 1, + 13, + 0, + 14, +}; + +static long _vq_lengthlist__44u6__p9_1[] = { + 1, 4, 4, 7, 7, 8, 9, 8, 8, 9, 8, 9, 8, 9, 9, 4, + 7, 6, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 4, 7, + 6, 9, 9,10,10, 9, 9,10,10,10,10,11,11, 7, 9, 8, + 10,10,11,11,10,10,11,11,11,11,11,11, 7, 8, 9,10, + 10,11,11,10,10,11,11,11,11,11,12, 8,10,10,11,11, + 12,12,11,11,12,12,12,12,13,12, 8,10,10,11,11,12, + 11,11,11,11,12,12,12,12,13, 8, 9, 9,11,10,11,11, + 12,12,12,12,13,12,13,12, 8, 9, 9,11,11,11,11,12, + 12,12,12,12,13,13,13, 9,10,10,11,12,12,12,12,12, + 13,13,13,13,13,13, 9,10,10,11,11,12,12,12,12,13, + 13,13,13,14,13,10,10,10,12,11,12,12,13,13,13,13, + 13,13,13,13,10,10,11,11,11,12,12,13,13,13,13,13, + 13,13,13,10,11,11,12,12,13,12,12,13,13,13,13,13, + 13,14,10,11,11,12,12,13,12,13,13,13,14,13,13,14, + 13, +}; + +static float _vq_quantthresh__44u6__p9_1[] = { + -110.5, -93.5, -76.5, -59.5, -42.5, -25.5, -8.5, 8.5, + 25.5, 42.5, 59.5, 76.5, 93.5, 110.5, +}; + +static long _vq_quantmap__44u6__p9_1[] = { + 13, 11, 9, 7, 5, 3, 1, 0, + 2, 4, 6, 8, 10, 12, 14, +}; + +static encode_aux_threshmatch _vq_auxt__44u6__p9_1 = { + _vq_quantthresh__44u6__p9_1, + _vq_quantmap__44u6__p9_1, + 15, + 15 +}; + +static static_codebook _44u6__p9_1 = { + 2, 225, + _vq_lengthlist__44u6__p9_1, + 1, -522338304, 1620115456, 4, 0, + _vq_quantlist__44u6__p9_1, + NULL, + &_vq_auxt__44u6__p9_1, + NULL, + 0 +}; + +static long _vq_quantlist__44u6__p9_2[] = { + 8, + 7, + 9, + 6, + 10, + 5, + 11, + 4, + 12, + 3, + 13, + 2, + 14, + 1, + 15, + 0, + 16, +}; + +static long _vq_lengthlist__44u6__p9_2[] = { + 3, 5, 5, 7, 7, 8, 8, 8, 8, 8, 8, 9, 8, 8, 9, 9, + 9, 5, 6, 6, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, + 9, 9, 5, 6, 6, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, + 9, 9, 9, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 8, 8, 8, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 8, 8, 8, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 8, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9,10, 9, 8, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9,10, 9, 9, 9,10, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9,10, 9, 9, 9,10, 9, 9,10, 9, + 9, 9, 9, 9, 9, 9, 9, 9,10,10,10, 9,10, 9,10,10, + 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10, 9,10,10, 9, 9, + 10, +}; + +static float _vq_quantthresh__44u6__p9_2[] = { + -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, + 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, +}; + +static long _vq_quantmap__44u6__p9_2[] = { + 15, 13, 11, 9, 7, 5, 3, 1, + 0, 2, 4, 6, 8, 10, 12, 14, + 16, +}; + +static encode_aux_threshmatch _vq_auxt__44u6__p9_2 = { + _vq_quantthresh__44u6__p9_2, + _vq_quantmap__44u6__p9_2, + 17, + 17 +}; + +static static_codebook _44u6__p9_2 = { + 2, 289, + _vq_lengthlist__44u6__p9_2, + 1, -529530880, 1611661312, 5, 0, + _vq_quantlist__44u6__p9_2, + NULL, + &_vq_auxt__44u6__p9_2, + NULL, + 0 +}; + +static long _huff_lengthlist__44u6__short[] = { + 4,11,16,13,17,13,17,16,17,17, 4, 7, 9, 9,13,10, + 16,12,16,17, 7, 6, 5, 7, 8, 9,12,12,16,17, 6, 9, + 7, 9,10,10,15,15,17,17, 6, 7, 5, 7, 5, 7, 7,10, + 16,17, 7, 9, 8, 9, 8,10,11,11,15,17, 7, 7, 7, 8, + 5, 8, 8, 9,15,17, 8, 7, 9, 9, 7, 8, 7, 2, 7,15, + 14,13,13,15, 5,10, 4, 3, 6,17,17,15,13,17, 7,11, + 7, 6, 9,16, +}; + +static static_codebook _huff_book__44u6__short = { + 2, 100, + _huff_lengthlist__44u6__short, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist__44u7__long[] = { + 3, 9,14,13,15,14,16,13,13,14, 5, 5, 7, 7, 8, 9, + 11,10,12,15,10, 6, 5, 6, 6, 9,10,10,13,16,10, 6, + 6, 6, 6, 8, 9, 9,12,15,14, 7, 6, 6, 5, 6, 6, 8, + 12,15,10, 8, 7, 7, 6, 7, 7, 7,11,13,14,10, 9, 8, + 5, 6, 4, 5, 9,12,10, 9, 9, 8, 6, 6, 5, 3, 6,11, + 12,11,12,12,10, 9, 8, 5, 5, 8,10,11,15,13,13,13, + 12, 8, 6, 7, +}; + +static static_codebook _huff_book__44u7__long = { + 2, 100, + _huff_lengthlist__44u7__long, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _vq_quantlist__44u7__p1_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__44u7__p1_0[] = { + 1, 4, 4, 4, 7, 7, 5, 7, 7, 5, 8, 8, 8,10,10, 7, + 10,10, 5, 8, 8, 7,10,10, 8,10,10, 5, 8, 8, 8,11, + 10, 8,10,10, 8,10,10,10,12,13,10,13,13, 7,10,10, + 10,13,12,10,13,13, 5, 8, 8, 8,11,10, 8,10,11, 7, + 10,10,10,13,13,10,12,13, 8,11,11,10,13,13,10,13, + 12, +}; + +static float _vq_quantthresh__44u7__p1_0[] = { + -0.5, 0.5, +}; + +static long _vq_quantmap__44u7__p1_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__44u7__p1_0 = { + _vq_quantthresh__44u7__p1_0, + _vq_quantmap__44u7__p1_0, + 3, + 3 +}; + +static static_codebook _44u7__p1_0 = { + 4, 81, + _vq_lengthlist__44u7__p1_0, + 1, -535822336, 1611661312, 2, 0, + _vq_quantlist__44u7__p1_0, + NULL, + &_vq_auxt__44u7__p1_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u7__p2_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__44u7__p2_0[] = { + 3, 4, 4, 5, 6, 6, 5, 6, 6, 5, 6, 6, 6, 8, 8, 6, + 7, 8, 5, 6, 6, 6, 8, 7, 6, 8, 8, 5, 6, 6, 6, 8, + 7, 6, 8, 8, 6, 8, 8, 8, 9, 9, 8, 9, 9, 6, 8, 7, + 7, 9, 8, 8, 9, 9, 5, 6, 6, 6, 8, 7, 6, 8, 8, 6, + 8, 8, 8, 9, 9, 7, 8, 9, 6, 8, 8, 8, 9, 9, 8, 9, + 9, +}; + +static float _vq_quantthresh__44u7__p2_0[] = { + -0.5, 0.5, +}; + +static long _vq_quantmap__44u7__p2_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__44u7__p2_0 = { + _vq_quantthresh__44u7__p2_0, + _vq_quantmap__44u7__p2_0, + 3, + 3 +}; + +static static_codebook _44u7__p2_0 = { + 4, 81, + _vq_lengthlist__44u7__p2_0, + 1, -535822336, 1611661312, 2, 0, + _vq_quantlist__44u7__p2_0, + NULL, + &_vq_auxt__44u7__p2_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u7__p3_0[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44u7__p3_0[] = { + 2, 5, 4, 8, 8, 5, 7, 6, 9, 9, 5, 6, 7, 9, 9, 8, + 9, 9,13,12, 8, 9,10,12,13, 5, 7, 7,10, 9, 7, 9, + 9,11,11, 6, 8, 9,11,11,10,11,11,14,14, 9,10,11, + 13,14, 5, 7, 7, 9, 9, 7, 9, 8,11,11, 7, 9, 9,11, + 11, 9,11,10,14,13,10,11,11,14,14, 8,10,10,14,13, + 10,11,12,15,14, 9,11,11,15,14,13,14,14,16,16,12, + 13,14,17,16, 8,10,10,13,13, 9,11,11,14,15,10,11, + 12,14,15,12,14,13,16,16,13,14,15,15,17, 5, 7, 7, + 10,10, 7, 9, 9,11,11, 7, 9, 9,11,11,10,12,11,15, + 14,10,11,12,14,14, 7, 9, 9,12,12, 9,11,11,13,13, + 9,11,11,13,13,11,13,13,14,17,11,13,13,15,16, 6, + 9, 9,11,11, 8,11,10,13,12, 9,11,11,13,13,11,13, + 12,16,14,11,13,13,16,16,10,12,12,15,15,11,13,13, + 16,16,11,13,13,16,15,14,16,17,17,19,14,16,16,18, + 0, 9,11,11,14,15,10,13,12,16,15,11,13,13,16,16, + 14,15,14, 0,16,14,16,16,18, 0, 5, 7, 7,10,10, 7, + 9, 9,12,11, 7, 9, 9,11,12,10,11,11,15,14,10,11, + 12,14,14, 6, 9, 9,11,11, 9,11,11,13,13, 8,10,11, + 12,13,11,13,13,17,15,11,12,13,14,15, 7, 9, 9,11, + 12, 9,11,11,13,13, 9,11,11,13,13,11,13,12,16,16, + 11,13,13,15,14, 9,11,11,14,15,11,13,13,16,15,10, + 12,13,16,16,15,16,16, 0, 0,14,13,15,16,18,10,11, + 11,15,15,11,13,14,16,18,11,13,13,16,15,15,16,16, + 19, 0,14,15,15,16,16, 8,10,10,13,13,10,12,11,16, + 15,10,11,11,16,15,13,15,16,18, 0,13,14,15,17,17, + 9,11,11,15,15,11,13,13,16,18,11,13,13,16,17,15, + 16,16, 0, 0,15,18,16, 0,17, 9,11,11,15,15,11,13, + 12,17,15,11,13,14,16,17,15,18,15, 0,17,15,16,16, + 18,19,13,15,14, 0,18,14,16,16,19,18,14,16,15,19, + 19,16,18,19, 0, 0,16,17, 0, 0, 0,12,14,14,17,17, + 13,16,14, 0,18,14,16,15,18, 0,16,18,16,19,17,18, + 19,17, 0, 0, 8,10,10,14,14, 9,12,11,15,15,10,11, + 12,15,17,13,15,15,18,16,14,16,15,18,17, 9,11,11, + 16,15,11,13,13, 0,16,11,12,13,16,15,15,16,16, 0, + 17,15,15,16,18,17, 9,12,11,15,17,11,13,13,16,16, + 11,14,13,16,16,15,15,16,18,19,16,18,16, 0, 0,12, + 14,14, 0,16,14,16,16, 0,18,13,14,15,16, 0,17,16, + 18, 0, 0,16,16,17,19, 0,13,14,14,17, 0,14,17,16, + 0,19,14,15,15,18,19,17,16,18, 0, 0,15,19,16, 0, + 0, +}; + +static float _vq_quantthresh__44u7__p3_0[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__44u7__p3_0[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44u7__p3_0 = { + _vq_quantthresh__44u7__p3_0, + _vq_quantmap__44u7__p3_0, + 5, + 5 +}; + +static static_codebook _44u7__p3_0 = { + 4, 625, + _vq_lengthlist__44u7__p3_0, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__44u7__p3_0, + NULL, + &_vq_auxt__44u7__p3_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u7__p4_0[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44u7__p4_0[] = { + 4, 5, 5, 8, 8, 6, 7, 6, 9, 9, 6, 6, 7, 9, 9, 8, + 9, 9,11,11, 8, 9, 9,10,11, 6, 7, 7, 9, 9, 7, 8, + 8,10,10, 6, 7, 8, 9,10, 9,10,10,12,12, 9, 9,10, + 11,12, 6, 7, 7, 9, 9, 6, 8, 7,10, 9, 7, 8, 8,10, + 10, 9,10, 9,12,11, 9,10,10,12,11, 8, 9, 9,11,11, + 9,10,10,12,12, 9,10,10,12,12,11,12,12,13,14,11, + 11,12,13,13, 8, 9, 9,11,11, 9,10,10,12,11, 9,10, + 10,12,12,11,12,11,13,13,11,12,12,13,13, 6, 7, 7, + 9, 9, 7, 8, 7,10,10, 7, 7, 8,10,10, 9,10,10,12, + 11, 9,10,10,12,12, 7, 8, 8,10,10, 8, 8, 9,11,11, + 8, 9, 9,11,11,10,11,11,12,12,10,10,11,12,13, 6, + 7, 7,10,10, 7, 9, 8,11,10, 8, 8, 9,10,11,10,11, + 10,13,11,10,11,11,12,12, 9,10,10,12,12,10,10,11, + 13,13,10,11,11,13,12,12,12,13,13,14,12,12,13,14, + 14, 9,10,10,12,12, 9,10,10,12,12,10,11,11,13,13, + 11,12,11,14,12,12,13,13,14,14, 6, 7, 7, 9, 9, 7, + 8, 7,10,10, 7, 7, 8,10,10, 9,10,10,12,11, 9,10, + 10,11,12, 6, 7, 7,10,10, 8, 9, 8,11,10, 7, 8, 9, + 10,11,10,11,11,13,12,10,10,11,11,13, 7, 8, 8,10, + 10, 8, 9, 9,11,11, 8, 9, 9,11,11,10,11,10,13,12, + 10,11,11,12,12, 9,10,10,12,12,10,11,11,13,12, 9, + 10,10,12,13,12,13,12,14,14,11,11,12,12,14, 9,10, + 10,12,12,10,11,11,13,13,10,11,11,13,13,12,13,12, + 14,14,12,13,12,14,13, 8, 9, 9,11,11, 9,10,10,12, + 12, 9,10,10,12,12,11,12,12,14,13,11,12,12,13,13, + 9,10,10,12,12,10,11,11,13,13,10,11,11,13,12,12, + 13,13,14,14,12,12,13,14,14, 9,10,10,12,12, 9,11, + 10,13,12,10,10,11,12,13,11,13,12,14,13,12,12,13, + 14,14,11,12,12,13,13,11,12,13,14,14,12,13,13,14, + 14,13,13,14,14,16,13,14,14,16,16,11,11,11,13,13, + 11,12,11,14,13,12,12,13,14,15,13,14,12,16,13,14, + 14,14,15,16, 8, 9, 9,11,11, 9,10,10,12,12, 9,10, + 10,12,12,11,12,12,14,13,11,12,12,13,14, 9,10,10, + 12,12,10,11,10,13,12, 9,10,11,12,13,12,13,12,14, + 14,12,12,13,13,14, 9,10,10,12,12,10,11,11,12,13, + 10,11,11,13,13,12,13,12,14,14,12,13,13,14,14,11, + 12,12,13,13,12,13,12,14,14,11,11,12,13,14,13,15, + 14,16,15,13,12,14,13,16,11,12,12,13,13,12,13,13, + 14,14,12,12,12,14,14,13,14,14,15,15,13,14,13,16, + 14, +}; + +static float _vq_quantthresh__44u7__p4_0[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__44u7__p4_0[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44u7__p4_0 = { + _vq_quantthresh__44u7__p4_0, + _vq_quantmap__44u7__p4_0, + 5, + 5 +}; + +static static_codebook _44u7__p4_0 = { + 4, 625, + _vq_lengthlist__44u7__p4_0, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__44u7__p4_0, + NULL, + &_vq_auxt__44u7__p4_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u7__p5_0[] = { + 4, + 3, + 5, + 2, + 6, + 1, + 7, + 0, + 8, +}; + +static long _vq_lengthlist__44u7__p5_0[] = { + 2, 3, 3, 6, 6, 7, 8,10,10, 4, 5, 5, 8, 7, 8, 8, + 11,11, 3, 5, 5, 7, 7, 8, 9,11,11, 6, 8, 7, 9, 9, + 10,10,12,12, 6, 7, 8, 9,10,10,10,12,12, 8, 8, 8, + 10,10,12,11,13,13, 8, 8, 9,10,10,11,11,13,13,10, + 11,11,12,12,13,13,14,14,10,11,11,12,12,13,13,14, + 14, +}; + +static float _vq_quantthresh__44u7__p5_0[] = { + -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, +}; + +static long _vq_quantmap__44u7__p5_0[] = { + 7, 5, 3, 1, 0, 2, 4, 6, + 8, +}; + +static encode_aux_threshmatch _vq_auxt__44u7__p5_0 = { + _vq_quantthresh__44u7__p5_0, + _vq_quantmap__44u7__p5_0, + 9, + 9 +}; + +static static_codebook _44u7__p5_0 = { + 2, 81, + _vq_lengthlist__44u7__p5_0, + 1, -531628032, 1611661312, 4, 0, + _vq_quantlist__44u7__p5_0, + NULL, + &_vq_auxt__44u7__p5_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u7__p6_0[] = { + 4, + 3, + 5, + 2, + 6, + 1, + 7, + 0, + 8, +}; + +static long _vq_lengthlist__44u7__p6_0[] = { + 3, 4, 4, 5, 5, 7, 7, 9, 9, 4, 5, 4, 6, 6, 8, 7, + 9, 9, 4, 4, 5, 6, 6, 7, 7, 9, 9, 5, 6, 6, 7, 7, + 8, 8,10,10, 5, 6, 6, 7, 7, 8, 8,10,10, 7, 8, 7, + 8, 8,10, 9,11,11, 7, 7, 8, 8, 8, 9,10,11,11, 9, + 9, 9,10,10,11,10,12,11, 9, 9, 9,10,10,11,11,11, + 12, +}; + +static float _vq_quantthresh__44u7__p6_0[] = { + -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, +}; + +static long _vq_quantmap__44u7__p6_0[] = { + 7, 5, 3, 1, 0, 2, 4, 6, + 8, +}; + +static encode_aux_threshmatch _vq_auxt__44u7__p6_0 = { + _vq_quantthresh__44u7__p6_0, + _vq_quantmap__44u7__p6_0, + 9, + 9 +}; + +static static_codebook _44u7__p6_0 = { + 2, 81, + _vq_lengthlist__44u7__p6_0, + 1, -531628032, 1611661312, 4, 0, + _vq_quantlist__44u7__p6_0, + NULL, + &_vq_auxt__44u7__p6_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u7__p7_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__44u7__p7_0[] = { + 1, 4, 4, 5, 7, 7, 5, 7, 7, 5, 9, 8, 8, 9, 9, 7, + 10,10, 5, 8, 9, 7, 9,10, 8, 9, 9, 4, 9, 9, 9,11, + 10, 8,10,10, 7,11,10,10,10,12,10,12,12, 7,10,10, + 10,12,11,10,12,12, 5, 9, 9, 8,10,10, 9,11,11, 7, + 11,10,10,12,12,10,11,12, 7,10,11,10,12,12,10,12, + 10, +}; + +static float _vq_quantthresh__44u7__p7_0[] = { + -5.5, 5.5, +}; + +static long _vq_quantmap__44u7__p7_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__44u7__p7_0 = { + _vq_quantthresh__44u7__p7_0, + _vq_quantmap__44u7__p7_0, + 3, + 3 +}; + +static static_codebook _44u7__p7_0 = { + 4, 81, + _vq_lengthlist__44u7__p7_0, + 1, -529137664, 1618345984, 2, 0, + _vq_quantlist__44u7__p7_0, + NULL, + &_vq_auxt__44u7__p7_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u7__p7_1[] = { + 5, + 4, + 6, + 3, + 7, + 2, + 8, + 1, + 9, + 0, + 10, +}; + +static long _vq_lengthlist__44u7__p7_1[] = { + 3, 4, 4, 6, 6, 7, 7, 8, 8, 8, 8, 4, 5, 5, 6, 6, + 8, 7, 8, 8, 8, 8, 4, 5, 5, 6, 6, 7, 8, 8, 8, 8, + 8, 6, 7, 6, 7, 7, 8, 8, 9, 9, 9, 9, 6, 6, 7, 7, + 7, 8, 8, 9, 9, 9, 9, 7, 8, 7, 8, 8, 9, 9, 9, 9, + 9, 9, 7, 7, 8, 8, 8, 9, 9, 9, 9, 9, 9, 8, 8, 8, + 9, 9, 9, 9,10, 9, 9, 9, 8, 8, 8, 9, 9, 9, 9, 9, + 9, 9,10, 8, 8, 8, 9, 9, 9, 9,10, 9,10,10, 8, 8, + 8, 9, 9, 9, 9, 9,10,10,10, +}; + +static float _vq_quantthresh__44u7__p7_1[] = { + -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, + 3.5, 4.5, +}; + +static long _vq_quantmap__44u7__p7_1[] = { + 9, 7, 5, 3, 1, 0, 2, 4, + 6, 8, 10, +}; + +static encode_aux_threshmatch _vq_auxt__44u7__p7_1 = { + _vq_quantthresh__44u7__p7_1, + _vq_quantmap__44u7__p7_1, + 11, + 11 +}; + +static static_codebook _44u7__p7_1 = { + 2, 121, + _vq_lengthlist__44u7__p7_1, + 1, -531365888, 1611661312, 4, 0, + _vq_quantlist__44u7__p7_1, + NULL, + &_vq_auxt__44u7__p7_1, + NULL, + 0 +}; + +static long _vq_quantlist__44u7__p8_0[] = { + 5, + 4, + 6, + 3, + 7, + 2, + 8, + 1, + 9, + 0, + 10, +}; + +static long _vq_lengthlist__44u7__p8_0[] = { + 1, 4, 4, 6, 6, 8, 8,10,10,11,11, 4, 6, 6, 7, 7, + 9, 9,11,10,12,12, 5, 6, 5, 7, 7, 9, 9,10,11,12, + 12, 6, 7, 7, 8, 8,10,10,11,11,13,13, 6, 7, 7, 8, + 8,10,10,11,12,13,13, 8, 9, 9,10,10,11,11,12,12, + 14,14, 8, 9, 9,10,10,11,11,12,12,14,14,10,10,10, + 11,11,13,12,14,14,15,15,10,10,10,12,12,13,13,14, + 14,15,15,11,12,12,13,13,14,14,15,14,16,15,11,12, + 12,13,13,14,14,15,15,15,16, +}; + +static float _vq_quantthresh__44u7__p8_0[] = { + -49.5, -38.5, -27.5, -16.5, -5.5, 5.5, 16.5, 27.5, + 38.5, 49.5, +}; + +static long _vq_quantmap__44u7__p8_0[] = { + 9, 7, 5, 3, 1, 0, 2, 4, + 6, 8, 10, +}; + +static encode_aux_threshmatch _vq_auxt__44u7__p8_0 = { + _vq_quantthresh__44u7__p8_0, + _vq_quantmap__44u7__p8_0, + 11, + 11 +}; + +static static_codebook _44u7__p8_0 = { + 2, 121, + _vq_lengthlist__44u7__p8_0, + 1, -524582912, 1618345984, 4, 0, + _vq_quantlist__44u7__p8_0, + NULL, + &_vq_auxt__44u7__p8_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u7__p8_1[] = { + 5, + 4, + 6, + 3, + 7, + 2, + 8, + 1, + 9, + 0, + 10, +}; + +static long _vq_lengthlist__44u7__p8_1[] = { + 4, 5, 5, 6, 6, 7, 7, 7, 7, 7, 7, 5, 6, 6, 7, 7, + 7, 7, 7, 7, 7, 7, 5, 6, 6, 6, 7, 7, 7, 7, 7, 7, + 7, 6, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 6, 7, 7, 7, + 7, 7, 7, 7, 7, 8, 8, 7, 7, 7, 7, 7, 8, 7, 8, 8, + 8, 8, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 7, 7, 7, + 7, 7, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 8, 8, 8, + 8, 8, 8, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 7, 7, + 7, 8, 8, 8, 8, 8, 8, 8, 8, +}; + +static float _vq_quantthresh__44u7__p8_1[] = { + -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, + 3.5, 4.5, +}; + +static long _vq_quantmap__44u7__p8_1[] = { + 9, 7, 5, 3, 1, 0, 2, 4, + 6, 8, 10, +}; + +static encode_aux_threshmatch _vq_auxt__44u7__p8_1 = { + _vq_quantthresh__44u7__p8_1, + _vq_quantmap__44u7__p8_1, + 11, + 11 +}; + +static static_codebook _44u7__p8_1 = { + 2, 121, + _vq_lengthlist__44u7__p8_1, + 1, -531365888, 1611661312, 4, 0, + _vq_quantlist__44u7__p8_1, + NULL, + &_vq_auxt__44u7__p8_1, + NULL, + 0 +}; + +static long _vq_quantlist__44u7__p9_0[] = { + 5, + 4, + 6, + 3, + 7, + 2, + 8, + 1, + 9, + 0, + 10, +}; + +static long _vq_lengthlist__44u7__p9_0[] = { + 1, 3, 3,10,10,10,10,10,10,10,10, 4,10,10,10,10, + 10,10,10,10,10,10, 4,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, +}; + +static float _vq_quantthresh__44u7__p9_0[] = { + -2866.5, -2229.5, -1592.5, -955.5, -318.5, 318.5, 955.5, 1592.5, + 2229.5, 2866.5, +}; + +static long _vq_quantmap__44u7__p9_0[] = { + 9, 7, 5, 3, 1, 0, 2, 4, + 6, 8, 10, +}; + +static encode_aux_threshmatch _vq_auxt__44u7__p9_0 = { + _vq_quantthresh__44u7__p9_0, + _vq_quantmap__44u7__p9_0, + 11, + 11 +}; + +static static_codebook _44u7__p9_0 = { + 2, 121, + _vq_lengthlist__44u7__p9_0, + 1, -512171520, 1630791680, 4, 0, + _vq_quantlist__44u7__p9_0, + NULL, + &_vq_auxt__44u7__p9_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u7__p9_1[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__44u7__p9_1[] = { + 1, 4, 4, 6, 5, 8, 6, 9, 8,10, 9,11,10, 4, 6, 6, + 8, 8, 9, 9,11,10,11,11,11,11, 4, 6, 6, 8, 8,10, + 9,11,11,11,11,11,12, 6, 8, 8,10,10,11,11,12,12, + 13,12,13,13, 6, 8, 8,10,10,11,11,12,12,12,13,14, + 13, 8,10,10,11,11,12,13,14,14,14,14,15,15, 8,10, + 10,11,12,12,13,13,14,14,14,14,15, 9,11,11,13,13, + 14,14,15,14,16,15,17,15, 9,11,11,12,13,14,14,15, + 14,15,15,15,16,10,12,12,13,14,15,15,15,15,16,17, + 16,17,10,13,12,13,14,14,16,16,16,16,15,16,17,11, + 13,13,14,15,14,17,15,16,17,17,17,17,11,13,13,14, + 15,15,15,15,17,17,16,17,16, +}; + +static float _vq_quantthresh__44u7__p9_1[] = { + -269.5, -220.5, -171.5, -122.5, -73.5, -24.5, 24.5, 73.5, + 122.5, 171.5, 220.5, 269.5, +}; + +static long _vq_quantmap__44u7__p9_1[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__44u7__p9_1 = { + _vq_quantthresh__44u7__p9_1, + _vq_quantmap__44u7__p9_1, + 13, + 13 +}; + +static static_codebook _44u7__p9_1 = { + 2, 169, + _vq_lengthlist__44u7__p9_1, + 1, -518889472, 1622704128, 4, 0, + _vq_quantlist__44u7__p9_1, + NULL, + &_vq_auxt__44u7__p9_1, + NULL, + 0 +}; + +static long _vq_quantlist__44u7__p9_2[] = { + 24, + 23, + 25, + 22, + 26, + 21, + 27, + 20, + 28, + 19, + 29, + 18, + 30, + 17, + 31, + 16, + 32, + 15, + 33, + 14, + 34, + 13, + 35, + 12, + 36, + 11, + 37, + 10, + 38, + 9, + 39, + 8, + 40, + 7, + 41, + 6, + 42, + 5, + 43, + 4, + 44, + 3, + 45, + 2, + 46, + 1, + 47, + 0, + 48, +}; + +static long _vq_lengthlist__44u7__p9_2[] = { + 2, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, + 8, +}; + +static float _vq_quantthresh__44u7__p9_2[] = { + -23.5, -22.5, -21.5, -20.5, -19.5, -18.5, -17.5, -16.5, + -15.5, -14.5, -13.5, -12.5, -11.5, -10.5, -9.5, -8.5, + -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, + 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, + 8.5, 9.5, 10.5, 11.5, 12.5, 13.5, 14.5, 15.5, + 16.5, 17.5, 18.5, 19.5, 20.5, 21.5, 22.5, 23.5, +}; + +static long _vq_quantmap__44u7__p9_2[] = { + 47, 45, 43, 41, 39, 37, 35, 33, + 31, 29, 27, 25, 23, 21, 19, 17, + 15, 13, 11, 9, 7, 5, 3, 1, + 0, 2, 4, 6, 8, 10, 12, 14, + 16, 18, 20, 22, 24, 26, 28, 30, + 32, 34, 36, 38, 40, 42, 44, 46, + 48, +}; + +static encode_aux_threshmatch _vq_auxt__44u7__p9_2 = { + _vq_quantthresh__44u7__p9_2, + _vq_quantmap__44u7__p9_2, + 49, + 49 +}; + +static static_codebook _44u7__p9_2 = { + 1, 49, + _vq_lengthlist__44u7__p9_2, + 1, -526909440, 1611661312, 6, 0, + _vq_quantlist__44u7__p9_2, + NULL, + &_vq_auxt__44u7__p9_2, + NULL, + 0 +}; + +static long _huff_lengthlist__44u7__short[] = { + 5,12,17,16,16,17,17,17,17,17, 4, 7,11,11,12, 9, + 17,10,17,17, 7, 7, 8, 9, 7, 9,11,10,15,17, 7, 9, + 10,11,10,12,14,12,16,17, 7, 8, 5, 7, 4, 7, 7, 8, + 16,16, 6,10, 9,10, 7,10,11,11,16,17, 6, 8, 8, 9, + 5, 7, 5, 8,16,17, 5, 5, 8, 7, 6, 7, 7, 6, 6,14, + 12,10,12,11, 7,11, 4, 4, 2, 7,17,15,15,15, 8,15, + 6, 8, 5, 9, +}; + +static static_codebook _huff_book__44u7__short = { + 2, 100, + _huff_lengthlist__44u7__short, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist__44u8__long[] = { + 3, 9,13,14,14,15,14,14,15,15, 5, 4, 6, 8,10,12, + 12,14,15,15, 9, 5, 4, 5, 8,10,11,13,16,16,10, 7, + 4, 3, 5, 7, 9,11,13,13,10, 9, 7, 4, 4, 6, 8,10, + 12,14,13,11, 9, 6, 5, 5, 6, 8,12,14,13,11,10, 8, + 7, 6, 6, 7,10,14,13,11,12,10, 8, 7, 6, 6, 9,13, + 12,11,14,12,11, 9, 8, 7, 9,11,11,12,14,13,14,11, + 10, 8, 8, 9, +}; + +static static_codebook _huff_book__44u8__long = { + 2, 100, + _huff_lengthlist__44u8__long, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist__44u8__short[] = { + 6,14,18,18,17,17,17,17,17,17, 4, 7, 9, 9,10,13, + 15,17,17,17, 6, 7, 5, 6, 8,11,16,17,16,17, 5, 7, + 5, 4, 6,10,14,17,17,17, 6, 6, 6, 5, 7,10,13,16, + 17,17, 7, 6, 7, 7, 7, 8, 7,10,15,16,12, 9, 9, 6, + 6, 5, 3, 5,11,15,14,14,13, 5, 5, 7, 3, 4, 8,15, + 17,17,13, 7, 7,10, 6, 6,10,15,17,17,16,10,11,14, + 10,10,15,17, +}; + +static static_codebook _huff_book__44u8__short = { + 2, 100, + _huff_lengthlist__44u8__short, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _vq_quantlist__44u8_p1_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__44u8_p1_0[] = { + 1, 5, 5, 5, 7, 7, 5, 7, 7, 5, 7, 7, 8, 9, 9, 7, + 9, 9, 5, 7, 7, 7, 9, 9, 8, 9, 9, 5, 7, 7, 7, 9, + 9, 7, 9, 9, 7, 9, 9, 9,10,11, 9,11,10, 7, 9, 9, + 9,11,10, 9,10,11, 5, 7, 7, 7, 9, 9, 7, 9, 9, 7, + 9, 9, 9,11,10, 9,10,10, 8, 9, 9, 9,11,11, 9,11, + 10, +}; + +static float _vq_quantthresh__44u8_p1_0[] = { + -0.5, 0.5, +}; + +static long _vq_quantmap__44u8_p1_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__44u8_p1_0 = { + _vq_quantthresh__44u8_p1_0, + _vq_quantmap__44u8_p1_0, + 3, + 3 +}; + +static static_codebook _44u8_p1_0 = { + 4, 81, + _vq_lengthlist__44u8_p1_0, + 1, -535822336, 1611661312, 2, 0, + _vq_quantlist__44u8_p1_0, + NULL, + &_vq_auxt__44u8_p1_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u8_p2_0[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44u8_p2_0[] = { + 4, 5, 5, 8, 8, 5, 7, 6, 9, 9, 5, 6, 7, 9, 9, 8, + 9, 9,11,11, 8, 9, 9,11,11, 5, 7, 7, 9, 9, 7, 8, + 8,10,10, 7, 8, 8,10,10, 9,10,10,12,12, 9,10,10, + 11,12, 5, 7, 7, 9, 9, 7, 8, 7,10,10, 7, 8, 8,10, + 10, 9,10, 9,12,11, 9,10,10,12,12, 8, 9, 9,12,11, + 9,10,10,12,12, 9,10,10,12,12,11,12,12,14,14,11, + 11,12,13,14, 8, 9, 9,11,11, 9,10,10,12,12, 9,10, + 10,12,12,11,12,11,13,13,11,12,12,14,14, 5, 7, 7, + 9, 9, 7, 8, 8,10,10, 7, 8, 8,10,10, 9,10,10,12, + 12, 9,10,10,11,12, 7, 8, 8,10,10, 8, 9, 9,11,11, + 8, 9, 9,11,11,10,11,11,12,13,10,11,11,12,13, 6, + 8, 8,10,10, 8, 9, 8,11,10, 8, 9, 9,11,11,10,11, + 10,13,12,10,11,11,13,13, 9,10,10,12,12,10,11,11, + 13,13,10,11,11,13,13,12,12,13,13,14,12,13,13,14, + 14, 9,10,10,12,12,10,11,10,13,12,10,11,11,13,13, + 11,13,12,14,13,12,13,13,14,14, 5, 7, 7, 9, 9, 7, + 8, 8,10,10, 7, 8, 8,10,10, 9,10,10,12,12, 9,10, + 10,12,12, 7, 8, 8,10,10, 8, 9, 9,11,11, 8, 8, 9, + 10,11,10,11,11,13,13,10,10,11,12,13, 7, 8, 8,10, + 10, 8, 9, 9,11,11, 8, 9, 9,11,11,10,11,11,13,13, + 10,11,11,13,12, 9,10,10,12,12,10,11,11,13,13,10, + 10,11,12,13,12,13,13,14,14,12,12,13,13,14, 9,10, + 10,12,12,10,11,11,13,13,10,11,11,13,13,12,13,13, + 15,14,12,13,13,14,13, 8, 9, 9,11,11, 9,10,10,12, + 12, 9,10,10,12,12,12,12,12,14,13,11,12,12,14,14, + 9,10,10,12,12,10,11,11,13,13,10,11,11,13,13,12, + 13,13,14,15,12,13,13,14,15, 9,10,10,12,12,10,11, + 10,13,12,10,11,11,13,13,12,13,12,15,14,12,13,13, + 14,15,11,12,12,14,14,12,13,13,14,14,12,13,13,15, + 14,14,14,14,14,16,14,14,15,16,16,11,12,12,14,14, + 11,12,12,14,14,12,13,13,14,15,13,14,13,16,14,14, + 14,14,16,16, 8, 9, 9,11,11, 9,10,10,12,12, 9,10, + 10,12,12,11,12,12,14,13,11,12,12,14,14, 9,10,10, + 12,12,10,11,11,13,13,10,10,11,12,13,12,13,13,15, + 14,12,12,13,13,14, 9,10,10,12,12,10,11,11,13,13, + 10,11,11,13,13,12,13,13,14,14,12,13,13,15,14,11, + 12,12,14,13,12,13,13,15,14,11,12,12,13,14,14,15, + 14,16,15,13,13,14,13,16,11,12,12,14,14,12,13,13, + 14,15,12,13,12,15,14,14,14,14,16,15,14,15,13,16, + 14, +}; + +static float _vq_quantthresh__44u8_p2_0[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__44u8_p2_0[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44u8_p2_0 = { + _vq_quantthresh__44u8_p2_0, + _vq_quantmap__44u8_p2_0, + 5, + 5 +}; + +static static_codebook _44u8_p2_0 = { + 4, 625, + _vq_lengthlist__44u8_p2_0, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__44u8_p2_0, + NULL, + &_vq_auxt__44u8_p2_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u8_p3_0[] = { + 4, + 3, + 5, + 2, + 6, + 1, + 7, + 0, + 8, +}; + +static long _vq_lengthlist__44u8_p3_0[] = { + 3, 4, 4, 5, 5, 7, 7, 9, 9, 4, 5, 4, 6, 6, 7, 7, + 9, 9, 4, 4, 5, 6, 6, 7, 7, 9, 9, 5, 6, 6, 7, 7, + 8, 8,10,10, 6, 6, 6, 7, 7, 8, 8,10,10, 7, 7, 7, + 8, 8, 9, 9,11,10, 7, 7, 7, 8, 8, 9, 9,10,11, 9, + 9, 9,10,10,11,10,12,11, 9, 9, 9, 9,10,11,11,11, + 12, +}; + +static float _vq_quantthresh__44u8_p3_0[] = { + -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, +}; + +static long _vq_quantmap__44u8_p3_0[] = { + 7, 5, 3, 1, 0, 2, 4, 6, + 8, +}; + +static encode_aux_threshmatch _vq_auxt__44u8_p3_0 = { + _vq_quantthresh__44u8_p3_0, + _vq_quantmap__44u8_p3_0, + 9, + 9 +}; + +static static_codebook _44u8_p3_0 = { + 2, 81, + _vq_lengthlist__44u8_p3_0, + 1, -531628032, 1611661312, 4, 0, + _vq_quantlist__44u8_p3_0, + NULL, + &_vq_auxt__44u8_p3_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u8_p4_0[] = { + 8, + 7, + 9, + 6, + 10, + 5, + 11, + 4, + 12, + 3, + 13, + 2, + 14, + 1, + 15, + 0, + 16, +}; + +static long _vq_lengthlist__44u8_p4_0[] = { + 4, 4, 4, 6, 6, 7, 7, 8, 8, 8, 8,10,10,11,11,11, + 11, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9,10,10,11,11, + 12,12, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9,10,10,11, + 11,12,12, 6, 6, 6, 7, 7, 8, 8, 9, 9, 9, 9,10,10, + 11,11,12,12, 6, 6, 6, 7, 7, 8, 8, 9, 9, 9, 9,10, + 10,11,11,12,12, 7, 7, 7, 8, 8, 9, 8,10, 9,10, 9, + 11,10,12,11,13,12, 7, 7, 7, 8, 8, 8, 9, 9,10, 9, + 10,10,11,11,12,12,13, 8, 8, 8, 9, 9, 9, 9,10,10, + 11,10,11,11,12,12,13,13, 8, 8, 8, 9, 9, 9,10,10, + 10,10,11,11,11,12,12,12,13, 8, 9, 9, 9, 9,10, 9, + 11,10,11,11,12,11,13,12,13,13, 8, 9, 9, 9, 9, 9, + 10,10,11,11,11,11,12,12,13,13,13,10,10,10,10,10, + 11,10,11,11,12,11,13,12,13,13,14,13,10,10,10,10, + 10,10,11,11,11,11,12,12,13,13,13,13,14,11,11,11, + 11,11,12,11,12,12,13,12,13,13,14,13,14,14,11,11, + 11,11,11,11,12,12,12,12,13,13,13,13,14,14,14,11, + 12,12,12,12,13,12,13,12,13,13,14,13,14,14,14,14, + 11,12,12,12,12,12,12,13,13,13,13,13,14,14,14,14, + 14, +}; + +static float _vq_quantthresh__44u8_p4_0[] = { + -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, + 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, +}; + +static long _vq_quantmap__44u8_p4_0[] = { + 15, 13, 11, 9, 7, 5, 3, 1, + 0, 2, 4, 6, 8, 10, 12, 14, + 16, +}; + +static encode_aux_threshmatch _vq_auxt__44u8_p4_0 = { + _vq_quantthresh__44u8_p4_0, + _vq_quantmap__44u8_p4_0, + 17, + 17 +}; + +static static_codebook _44u8_p4_0 = { + 2, 289, + _vq_lengthlist__44u8_p4_0, + 1, -529530880, 1611661312, 5, 0, + _vq_quantlist__44u8_p4_0, + NULL, + &_vq_auxt__44u8_p4_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u8_p5_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__44u8_p5_0[] = { + 1, 4, 4, 5, 7, 7, 5, 7, 7, 5, 8, 8, 8, 9, 9, 7, + 9, 9, 5, 8, 8, 7, 9, 9, 8, 9, 9, 5, 8, 8, 8,10, + 10, 8,10,10, 7,10,10, 9,10,12, 9,12,11, 7,10,10, + 9,11,10, 9,11,12, 5, 8, 8, 8,10,10, 8,10,10, 7, + 10,10, 9,11,11, 9,10,11, 7,10,10, 9,11,11,10,12, + 10, +}; + +static float _vq_quantthresh__44u8_p5_0[] = { + -5.5, 5.5, +}; + +static long _vq_quantmap__44u8_p5_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__44u8_p5_0 = { + _vq_quantthresh__44u8_p5_0, + _vq_quantmap__44u8_p5_0, + 3, + 3 +}; + +static static_codebook _44u8_p5_0 = { + 4, 81, + _vq_lengthlist__44u8_p5_0, + 1, -529137664, 1618345984, 2, 0, + _vq_quantlist__44u8_p5_0, + NULL, + &_vq_auxt__44u8_p5_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u8_p5_1[] = { + 5, + 4, + 6, + 3, + 7, + 2, + 8, + 1, + 9, + 0, + 10, +}; + +static long _vq_lengthlist__44u8_p5_1[] = { + 4, 5, 5, 6, 6, 7, 7, 7, 7, 8, 8, 5, 5, 5, 6, 6, + 7, 7, 8, 8, 8, 8, 5, 5, 5, 6, 6, 7, 7, 7, 8, 8, + 8, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 6, 6, 6, 7, + 7, 7, 7, 8, 8, 8, 8, 7, 7, 7, 7, 7, 8, 8, 8, 8, + 8, 8, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 7, 8, 7, + 8, 8, 8, 8, 8, 8, 8, 8, 7, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 9, 9, +}; + +static float _vq_quantthresh__44u8_p5_1[] = { + -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, + 3.5, 4.5, +}; + +static long _vq_quantmap__44u8_p5_1[] = { + 9, 7, 5, 3, 1, 0, 2, 4, + 6, 8, 10, +}; + +static encode_aux_threshmatch _vq_auxt__44u8_p5_1 = { + _vq_quantthresh__44u8_p5_1, + _vq_quantmap__44u8_p5_1, + 11, + 11 +}; + +static static_codebook _44u8_p5_1 = { + 2, 121, + _vq_lengthlist__44u8_p5_1, + 1, -531365888, 1611661312, 4, 0, + _vq_quantlist__44u8_p5_1, + NULL, + &_vq_auxt__44u8_p5_1, + NULL, + 0 +}; + +static long _vq_quantlist__44u8_p6_0[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__44u8_p6_0[] = { + 2, 4, 4, 6, 6, 7, 7, 8, 8, 9, 9,10,10, 4, 6, 5, + 7, 7, 8, 8, 8, 8, 9, 9,10,10, 4, 6, 6, 7, 7, 8, + 8, 8, 8, 9, 9,10,10, 6, 7, 7, 7, 8, 8, 8, 8, 9, + 9,10,10,10, 6, 7, 7, 8, 8, 8, 8, 9, 8,10, 9,11, + 10, 7, 8, 8, 8, 8, 8, 9, 9, 9,10,10,11,11, 7, 8, + 8, 8, 8, 9, 8, 9, 9,10,10,11,11, 8, 8, 8, 9, 9, + 9, 9, 9,10,10,10,11,11, 8, 8, 8, 9, 9, 9, 9,10, + 9,10,10,11,11, 9, 9, 9, 9,10,10,10,10,10,10,11, + 11,12, 9, 9, 9,10, 9,10,10,10,10,11,10,12,11,10, + 10,10,10,10,11,11,11,11,11,12,12,12,10,10,10,10, + 11,11,11,11,11,12,11,12,12, +}; + +static float _vq_quantthresh__44u8_p6_0[] = { + -27.5, -22.5, -17.5, -12.5, -7.5, -2.5, 2.5, 7.5, + 12.5, 17.5, 22.5, 27.5, +}; + +static long _vq_quantmap__44u8_p6_0[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__44u8_p6_0 = { + _vq_quantthresh__44u8_p6_0, + _vq_quantmap__44u8_p6_0, + 13, + 13 +}; + +static static_codebook _44u8_p6_0 = { + 2, 169, + _vq_lengthlist__44u8_p6_0, + 1, -526516224, 1616117760, 4, 0, + _vq_quantlist__44u8_p6_0, + NULL, + &_vq_auxt__44u8_p6_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u8_p6_1[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44u8_p6_1[] = { + 3, 4, 4, 5, 5, 4, 5, 5, 5, 5, 4, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, +}; + +static float _vq_quantthresh__44u8_p6_1[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__44u8_p6_1[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44u8_p6_1 = { + _vq_quantthresh__44u8_p6_1, + _vq_quantmap__44u8_p6_1, + 5, + 5 +}; + +static static_codebook _44u8_p6_1 = { + 2, 25, + _vq_lengthlist__44u8_p6_1, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__44u8_p6_1, + NULL, + &_vq_auxt__44u8_p6_1, + NULL, + 0 +}; + +static long _vq_quantlist__44u8_p7_0[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__44u8_p7_0[] = { + 1, 4, 5, 6, 6, 7, 7, 8, 8,10,10,11,11, 5, 6, 6, + 7, 7, 8, 8, 9, 9,11,10,12,11, 5, 6, 6, 7, 7, 8, + 8, 9, 9,10,11,11,12, 6, 7, 7, 8, 8, 9, 9,10,10, + 11,11,12,12, 6, 7, 7, 8, 8, 9, 9,10,10,11,12,13, + 12, 7, 8, 8, 9, 9,10,10,11,11,12,12,13,13, 8, 8, + 8, 9, 9,10,10,11,11,12,12,13,13, 9, 9, 9,10,10, + 11,11,12,12,13,13,14,14, 9, 9, 9,10,10,11,11,12, + 12,13,13,14,14,10,11,11,12,11,13,12,13,13,14,14, + 15,15,10,11,11,11,12,12,13,13,14,14,14,15,15,11, + 12,12,13,13,14,13,15,14,15,15,16,15,11,11,12,13, + 13,13,14,14,14,15,15,15,16, +}; + +static float _vq_quantthresh__44u8_p7_0[] = { + -60.5, -49.5, -38.5, -27.5, -16.5, -5.5, 5.5, 16.5, + 27.5, 38.5, 49.5, 60.5, +}; + +static long _vq_quantmap__44u8_p7_0[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__44u8_p7_0 = { + _vq_quantthresh__44u8_p7_0, + _vq_quantmap__44u8_p7_0, + 13, + 13 +}; + +static static_codebook _44u8_p7_0 = { + 2, 169, + _vq_lengthlist__44u8_p7_0, + 1, -523206656, 1618345984, 4, 0, + _vq_quantlist__44u8_p7_0, + NULL, + &_vq_auxt__44u8_p7_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u8_p7_1[] = { + 5, + 4, + 6, + 3, + 7, + 2, + 8, + 1, + 9, + 0, + 10, +}; + +static long _vq_lengthlist__44u8_p7_1[] = { + 4, 5, 5, 6, 6, 7, 7, 7, 7, 7, 7, 5, 6, 6, 7, 7, + 7, 7, 7, 7, 7, 7, 5, 6, 6, 7, 7, 7, 7, 7, 7, 7, + 7, 6, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 6, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 8, 7, 7, 7, 7, 7, 7, 7, 8, 8, + 8, 8, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 7, 7, 7, + 8, 7, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 8, 8, 8, + 8, 8, 8, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 7, 7, + 7, 8, 8, 8, 8, 8, 8, 8, 8, +}; + +static float _vq_quantthresh__44u8_p7_1[] = { + -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, + 3.5, 4.5, +}; + +static long _vq_quantmap__44u8_p7_1[] = { + 9, 7, 5, 3, 1, 0, 2, 4, + 6, 8, 10, +}; + +static encode_aux_threshmatch _vq_auxt__44u8_p7_1 = { + _vq_quantthresh__44u8_p7_1, + _vq_quantmap__44u8_p7_1, + 11, + 11 +}; + +static static_codebook _44u8_p7_1 = { + 2, 121, + _vq_lengthlist__44u8_p7_1, + 1, -531365888, 1611661312, 4, 0, + _vq_quantlist__44u8_p7_1, + NULL, + &_vq_auxt__44u8_p7_1, + NULL, + 0 +}; + +static long _vq_quantlist__44u8_p8_0[] = { + 7, + 6, + 8, + 5, + 9, + 4, + 10, + 3, + 11, + 2, + 12, + 1, + 13, + 0, + 14, +}; + +static long _vq_lengthlist__44u8_p8_0[] = { + 1, 4, 4, 7, 7, 8, 8, 8, 7, 9, 8,10, 9,11,10, 4, + 6, 6, 8, 8,10, 9, 9, 9,10,10,11,10,12,10, 4, 6, + 6, 8, 8,10,10, 9, 9,10,10,11,11,11,12, 7, 8, 8, + 10,10,11,11,11,10,12,11,12,12,13,11, 7, 8, 8,10, + 10,11,11,10,10,11,11,12,12,13,13, 8,10,10,11,11, + 12,11,12,11,13,12,13,12,14,13, 8,10, 9,11,11,12, + 12,12,12,12,12,13,13,14,13, 8, 9, 9,11,10,12,11, + 13,12,13,13,14,13,14,13, 8, 9, 9,10,11,12,12,12, + 12,13,13,14,15,14,14, 9,10,10,12,11,13,12,13,13, + 14,13,14,14,14,14, 9,10,10,12,12,12,12,13,13,14, + 14,14,15,14,14,10,11,11,13,12,13,12,14,14,14,14, + 14,14,15,15,10,11,11,12,12,13,13,14,14,14,15,15, + 14,16,15,11,12,12,13,12,14,14,14,13,15,14,15,15, + 15,17,11,12,12,13,13,14,14,14,15,15,14,15,15,14, + 17, +}; + +static float _vq_quantthresh__44u8_p8_0[] = { + -136.5, -115.5, -94.5, -73.5, -52.5, -31.5, -10.5, 10.5, + 31.5, 52.5, 73.5, 94.5, 115.5, 136.5, +}; + +static long _vq_quantmap__44u8_p8_0[] = { + 13, 11, 9, 7, 5, 3, 1, 0, + 2, 4, 6, 8, 10, 12, 14, +}; + +static encode_aux_threshmatch _vq_auxt__44u8_p8_0 = { + _vq_quantthresh__44u8_p8_0, + _vq_quantmap__44u8_p8_0, + 15, + 15 +}; + +static static_codebook _44u8_p8_0 = { + 2, 225, + _vq_lengthlist__44u8_p8_0, + 1, -520986624, 1620377600, 4, 0, + _vq_quantlist__44u8_p8_0, + NULL, + &_vq_auxt__44u8_p8_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u8_p8_1[] = { + 10, + 9, + 11, + 8, + 12, + 7, + 13, + 6, + 14, + 5, + 15, + 4, + 16, + 3, + 17, + 2, + 18, + 1, + 19, + 0, + 20, +}; + +static long _vq_lengthlist__44u8_p8_1[] = { + 4, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 6, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 5, 6, 6, 7, 7, 8, + 8, 9, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 7, + 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10, 9,10, 8, 8, + 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10, 9,10, + 10, 9,10, 8, 9, 8, 9, 9, 9, 9, 9, 9, 9, 9,10, 9, + 10,10,10,10,10,10,10,10, 8, 9, 8, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9,10,10,10,10, 9,10,10, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9,10, 9,10,10,10,10,10,10, + 10,10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10, 9,10, + 10,10,10,10,10,10,10, 9, 9, 9, 9, 9, 9, 9,10, 9, + 10,10,10,10,10,10,10,10,10,10,10,10, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9,10,10,10,10,10,10,10,10,10,10, + 10, 9, 9, 9, 9, 9, 9,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10, 9, 9, 9, 9, 9, 9, 9,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10, 9, 9, 9, 9, 9, + 9, 9,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 9, 9, 9, 9, 9,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10, 9, 9, 9,10, 9,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10, 9, 9, 9, 9, 9,10, + 9,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 9, + 9, 9, 9, 9, 9,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10, 9, 9, 9,10, 9,10, 9,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10, +}; + +static float _vq_quantthresh__44u8_p8_1[] = { + -9.5, -8.5, -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, + -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, + 6.5, 7.5, 8.5, 9.5, +}; + +static long _vq_quantmap__44u8_p8_1[] = { + 19, 17, 15, 13, 11, 9, 7, 5, + 3, 1, 0, 2, 4, 6, 8, 10, + 12, 14, 16, 18, 20, +}; + +static encode_aux_threshmatch _vq_auxt__44u8_p8_1 = { + _vq_quantthresh__44u8_p8_1, + _vq_quantmap__44u8_p8_1, + 21, + 21 +}; + +static static_codebook _44u8_p8_1 = { + 2, 441, + _vq_lengthlist__44u8_p8_1, + 1, -529268736, 1611661312, 5, 0, + _vq_quantlist__44u8_p8_1, + NULL, + &_vq_auxt__44u8_p8_1, + NULL, + 0 +}; + +static long _vq_quantlist__44u8_p9_0[] = { + 4, + 3, + 5, + 2, + 6, + 1, + 7, + 0, + 8, +}; + +static long _vq_lengthlist__44u8_p9_0[] = { + 1, 3, 3, 9, 9, 9, 9, 9, 9, 4, 9, 9, 9, 9, 9, 9, + 9, 9, 5, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8, 8, 8, + 8, +}; + +static float _vq_quantthresh__44u8_p9_0[] = { + -3258.5, -2327.5, -1396.5, -465.5, 465.5, 1396.5, 2327.5, 3258.5, +}; + +static long _vq_quantmap__44u8_p9_0[] = { + 7, 5, 3, 1, 0, 2, 4, 6, + 8, +}; + +static encode_aux_threshmatch _vq_auxt__44u8_p9_0 = { + _vq_quantthresh__44u8_p9_0, + _vq_quantmap__44u8_p9_0, + 9, + 9 +}; + +static static_codebook _44u8_p9_0 = { + 2, 81, + _vq_lengthlist__44u8_p9_0, + 1, -511895552, 1631393792, 4, 0, + _vq_quantlist__44u8_p9_0, + NULL, + &_vq_auxt__44u8_p9_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u8_p9_1[] = { + 9, + 8, + 10, + 7, + 11, + 6, + 12, + 5, + 13, + 4, + 14, + 3, + 15, + 2, + 16, + 1, + 17, + 0, + 18, +}; + +static long _vq_lengthlist__44u8_p9_1[] = { + 1, 4, 4, 7, 7, 8, 7, 8, 6, 9, 7,10, 8,11,10,11, + 11,11,11, 4, 7, 6, 9, 9,10, 9, 9, 9,10,10,11,10, + 11,10,11,11,13,11, 4, 7, 7, 9, 9, 9, 9, 9, 9,10, + 10,11,10,11,11,11,12,11,12, 7, 9, 8,11,11,11,11, + 10,10,11,11,12,12,12,12,12,12,14,13, 7, 8, 9,10, + 11,11,11,10,10,11,11,11,11,12,12,14,12,13,14, 8, + 9, 9,11,11,11,11,11,11,12,12,14,12,15,14,14,14, + 15,14, 8, 9, 9,11,11,11,11,12,11,12,12,13,13,13, + 13,13,13,14,14, 8, 9, 9,11,10,12,11,12,12,13,13, + 13,13,15,14,14,14,16,16, 8, 9, 9,10,11,11,12,12, + 12,13,13,13,14,14,14,15,16,15,15, 9,10,10,11,12, + 12,13,13,13,14,14,16,14,14,16,16,16,16,15, 9,10, + 10,11,11,12,13,13,14,15,14,16,14,15,16,16,16,16, + 15,10,11,11,12,13,13,14,15,15,15,15,15,16,15,16, + 15,16,15,15,10,11,11,13,13,14,13,13,15,14,15,15, + 16,15,15,15,16,15,16,10,12,12,14,14,14,14,14,16, + 16,15,15,15,16,16,16,16,16,16,11,12,12,14,14,14, + 14,15,15,16,15,16,15,16,15,16,16,16,16,12,12,13, + 14,14,15,16,16,16,16,16,16,15,16,16,16,16,16,16, + 12,13,13,14,14,14,14,15,16,15,16,16,16,16,16,16, + 16,16,16,12,13,14,14,14,16,15,16,15,16,16,16,16, + 16,16,16,16,16,16,12,14,13,14,15,15,15,16,15,16, + 16,15,16,16,16,16,16,16,16, +}; + +static float _vq_quantthresh__44u8_p9_1[] = { + -416.5, -367.5, -318.5, -269.5, -220.5, -171.5, -122.5, -73.5, + -24.5, 24.5, 73.5, 122.5, 171.5, 220.5, 269.5, 318.5, + 367.5, 416.5, +}; + +static long _vq_quantmap__44u8_p9_1[] = { + 17, 15, 13, 11, 9, 7, 5, 3, + 1, 0, 2, 4, 6, 8, 10, 12, + 14, 16, 18, +}; + +static encode_aux_threshmatch _vq_auxt__44u8_p9_1 = { + _vq_quantthresh__44u8_p9_1, + _vq_quantmap__44u8_p9_1, + 19, + 19 +}; + +static static_codebook _44u8_p9_1 = { + 2, 361, + _vq_lengthlist__44u8_p9_1, + 1, -518287360, 1622704128, 5, 0, + _vq_quantlist__44u8_p9_1, + NULL, + &_vq_auxt__44u8_p9_1, + NULL, + 0 +}; + +static long _vq_quantlist__44u8_p9_2[] = { + 24, + 23, + 25, + 22, + 26, + 21, + 27, + 20, + 28, + 19, + 29, + 18, + 30, + 17, + 31, + 16, + 32, + 15, + 33, + 14, + 34, + 13, + 35, + 12, + 36, + 11, + 37, + 10, + 38, + 9, + 39, + 8, + 40, + 7, + 41, + 6, + 42, + 5, + 43, + 4, + 44, + 3, + 45, + 2, + 46, + 1, + 47, + 0, + 48, +}; + +static long _vq_lengthlist__44u8_p9_2[] = { + 2, 3, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, +}; + +static float _vq_quantthresh__44u8_p9_2[] = { + -23.5, -22.5, -21.5, -20.5, -19.5, -18.5, -17.5, -16.5, + -15.5, -14.5, -13.5, -12.5, -11.5, -10.5, -9.5, -8.5, + -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, + 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, + 8.5, 9.5, 10.5, 11.5, 12.5, 13.5, 14.5, 15.5, + 16.5, 17.5, 18.5, 19.5, 20.5, 21.5, 22.5, 23.5, +}; + +static long _vq_quantmap__44u8_p9_2[] = { + 47, 45, 43, 41, 39, 37, 35, 33, + 31, 29, 27, 25, 23, 21, 19, 17, + 15, 13, 11, 9, 7, 5, 3, 1, + 0, 2, 4, 6, 8, 10, 12, 14, + 16, 18, 20, 22, 24, 26, 28, 30, + 32, 34, 36, 38, 40, 42, 44, 46, + 48, +}; + +static encode_aux_threshmatch _vq_auxt__44u8_p9_2 = { + _vq_quantthresh__44u8_p9_2, + _vq_quantmap__44u8_p9_2, + 49, + 49 +}; + +static static_codebook _44u8_p9_2 = { + 1, 49, + _vq_lengthlist__44u8_p9_2, + 1, -526909440, 1611661312, 6, 0, + _vq_quantlist__44u8_p9_2, + NULL, + &_vq_auxt__44u8_p9_2, + NULL, + 0 +}; + +static long _huff_lengthlist__44u9__long[] = { + 3, 9,13,13,14,15,14,14,15,15, 5, 5, 9,10,12,12, + 13,14,16,15,10, 6, 6, 6, 8,11,12,13,16,15,11, 7, + 5, 3, 5, 8,10,12,15,15,10,10, 7, 4, 3, 5, 8,10, + 12,12,12,12, 9, 7, 5, 4, 6, 8,10,13,13,12,11, 9, + 7, 5, 5, 6, 9,12,14,12,12,10, 8, 6, 6, 6, 7,11, + 13,12,14,13,10, 8, 7, 7, 7,10,11,11,12,13,12,11, + 10, 8, 8, 9, +}; + +static static_codebook _huff_book__44u9__long = { + 2, 100, + _huff_lengthlist__44u9__long, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _huff_lengthlist__44u9__short[] = { + 9,16,18,18,17,17,17,17,17,17, 5, 8,11,12,11,12, + 17,17,16,16, 6, 6, 8, 8, 9,10,14,15,16,16, 6, 7, + 7, 4, 6, 9,13,16,16,16, 6, 6, 7, 4, 5, 8,11,15, + 17,16, 7, 6, 7, 6, 6, 8, 9,10,14,16,11, 8, 8, 7, + 6, 6, 3, 4,10,15,14,12,12,10, 5, 6, 3, 3, 8,13, + 15,17,15,11, 6, 8, 6, 6, 9,14,17,15,15,12, 8,10, + 9, 9,12,15, +}; + +static static_codebook _huff_book__44u9__short = { + 2, 100, + _huff_lengthlist__44u9__short, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _vq_quantlist__44u9_p1_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__44u9_p1_0[] = { + 1, 5, 5, 5, 7, 7, 5, 7, 7, 5, 7, 7, 7, 9, 9, 7, + 9, 9, 5, 7, 7, 7, 9, 9, 7, 9, 9, 5, 7, 7, 7, 9, + 9, 7, 9, 9, 8, 9, 9, 9,10,11, 9,11,11, 7, 9, 9, + 9,11,10, 9,11,11, 5, 7, 7, 7, 9, 9, 8, 9,10, 7, + 9, 9, 9,11,11, 9,10,11, 7, 9,10, 9,11,11, 9,11, + 10, +}; + +static float _vq_quantthresh__44u9_p1_0[] = { + -0.5, 0.5, +}; + +static long _vq_quantmap__44u9_p1_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__44u9_p1_0 = { + _vq_quantthresh__44u9_p1_0, + _vq_quantmap__44u9_p1_0, + 3, + 3 +}; + +static static_codebook _44u9_p1_0 = { + 4, 81, + _vq_lengthlist__44u9_p1_0, + 1, -535822336, 1611661312, 2, 0, + _vq_quantlist__44u9_p1_0, + NULL, + &_vq_auxt__44u9_p1_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u9_p2_0[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44u9_p2_0[] = { + 3, 5, 5, 8, 8, 5, 7, 7, 9, 9, 6, 7, 7, 9, 9, 8, + 9, 9,11,10, 8, 9, 9,11,11, 6, 7, 7, 9, 9, 7, 8, + 8,10,10, 7, 8, 8, 9,10, 9,10,10,11,11, 9, 9,10, + 11,11, 6, 7, 7, 9, 9, 7, 8, 8,10, 9, 7, 8, 8,10, + 10, 9,10, 9,11,11, 9,10,10,11,11, 8, 9, 9,11,11, + 9,10,10,12,11, 9,10,10,11,12,11,11,11,13,13,11, + 11,11,12,13, 8, 9, 9,11,11, 9,10,10,11,11, 9,10, + 10,12,11,11,12,11,13,12,11,11,12,13,13, 6, 7, 7, + 9, 9, 7, 8, 8,10,10, 7, 8, 8,10,10, 9,10,10,12, + 11, 9,10,10,11,12, 7, 8, 8,10,10, 8, 9, 9,11,11, + 8, 9, 9,10,10,10,11,11,12,12,10,10,11,12,12, 7, + 8, 8,10,10, 8, 9, 8,10,10, 8, 9, 9,10,10,10,11, + 10,12,11,10,10,11,12,12, 9,10,10,11,12,10,11,11, + 12,12,10,11,10,12,12,12,12,12,13,13,11,12,12,13, + 13, 9,10,10,11,11, 9,10,10,12,12,10,11,11,12,13, + 11,12,11,13,12,12,12,12,13,14, 6, 7, 7, 9, 9, 7, + 8, 8,10,10, 7, 8, 8,10,10, 9,10,10,11,11, 9,10, + 10,11,12, 7, 8, 8,10,10, 8, 9, 9,11,10, 8, 8, 9, + 10,10,10,11,10,12,12,10,10,11,11,12, 7, 8, 8,10, + 10, 8, 9, 9,10,10, 8, 9, 9,10,10,10,11,10,12,12, + 10,11,10,12,12, 9,10,10,12,11,10,11,11,12,12, 9, + 10,10,12,12,12,12,12,13,13,11,11,12,12,14, 9,10, + 10,11,12,10,11,11,12,12,10,11,11,12,12,11,12,12, + 14,14,12,12,12,13,13, 8, 9, 9,11,11, 9,10,10,12, + 11, 9,10,10,12,12,11,12,11,13,13,11,11,12,13,13, + 9,10,10,12,12,10,11,11,12,12,10,11,11,12,12,12, + 12,12,14,14,12,12,12,13,13, 9,10,10,12,11,10,11, + 10,12,12,10,11,11,12,12,11,12,12,14,13,12,12,12, + 13,14,11,12,11,13,13,11,12,12,13,13,12,12,12,14, + 14,13,13,13,13,15,13,13,14,15,15,11,11,11,13,13, + 11,12,11,13,13,11,12,12,13,13,12,13,12,15,13,13, + 13,14,14,15, 8, 9, 9,11,11, 9,10,10,11,12, 9,10, + 10,11,12,11,12,11,13,13,11,12,12,13,13, 9,10,10, + 11,12,10,11,10,12,12,10,10,11,12,13,12,12,12,14, + 13,11,12,12,13,14, 9,10,10,12,12,10,11,11,12,12, + 10,11,11,12,12,12,12,12,14,13,12,12,12,14,13,11, + 11,11,13,13,11,12,12,14,13,11,11,12,13,13,13,13, + 13,15,14,12,12,13,13,15,11,12,12,13,13,12,12,12, + 13,14,11,12,12,13,13,13,13,14,14,15,13,13,13,14, + 14, +}; + +static float _vq_quantthresh__44u9_p2_0[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__44u9_p2_0[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44u9_p2_0 = { + _vq_quantthresh__44u9_p2_0, + _vq_quantmap__44u9_p2_0, + 5, + 5 +}; + +static static_codebook _44u9_p2_0 = { + 4, 625, + _vq_lengthlist__44u9_p2_0, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__44u9_p2_0, + NULL, + &_vq_auxt__44u9_p2_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u9_p3_0[] = { + 4, + 3, + 5, + 2, + 6, + 1, + 7, + 0, + 8, +}; + +static long _vq_lengthlist__44u9_p3_0[] = { + 3, 4, 4, 5, 5, 7, 7, 8, 8, 4, 5, 5, 6, 6, 7, 7, + 9, 9, 4, 4, 5, 6, 6, 7, 7, 9, 9, 5, 6, 6, 7, 7, + 8, 8, 9, 9, 5, 6, 6, 7, 7, 8, 8, 9, 9, 7, 7, 7, + 8, 8, 9, 9,10,10, 7, 7, 7, 8, 8, 9, 9,10,10, 8, + 9, 9,10, 9,10,10,11,11, 8, 9, 9, 9,10,10,10,11, + 11, +}; + +static float _vq_quantthresh__44u9_p3_0[] = { + -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, +}; + +static long _vq_quantmap__44u9_p3_0[] = { + 7, 5, 3, 1, 0, 2, 4, 6, + 8, +}; + +static encode_aux_threshmatch _vq_auxt__44u9_p3_0 = { + _vq_quantthresh__44u9_p3_0, + _vq_quantmap__44u9_p3_0, + 9, + 9 +}; + +static static_codebook _44u9_p3_0 = { + 2, 81, + _vq_lengthlist__44u9_p3_0, + 1, -531628032, 1611661312, 4, 0, + _vq_quantlist__44u9_p3_0, + NULL, + &_vq_auxt__44u9_p3_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u9_p4_0[] = { + 8, + 7, + 9, + 6, + 10, + 5, + 11, + 4, + 12, + 3, + 13, + 2, + 14, + 1, + 15, + 0, + 16, +}; + +static long _vq_lengthlist__44u9_p4_0[] = { + 4, 5, 5, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9,10,10,11, + 11, 5, 5, 5, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9,10,10, + 11,11, 5, 5, 5, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9,10, + 10,11,11, 6, 6, 6, 7, 6, 7, 7, 8, 8, 9, 9,10,10, + 11,11,12,11, 6, 6, 6, 6, 7, 7, 7, 8, 8, 9, 9,10, + 10,11,11,11,12, 7, 7, 7, 7, 7, 8, 8, 9, 9, 9, 9, + 10,10,11,11,12,12, 7, 7, 7, 7, 7, 8, 8, 9, 9, 9, + 9,10,10,11,11,12,12, 8, 8, 8, 8, 8, 9, 8,10, 9, + 10,10,11,10,12,11,13,12, 8, 8, 8, 8, 8, 9, 9, 9, + 10,10,10,10,11,11,12,12,12, 8, 8, 8, 9, 9, 9, 9, + 10,10,11,10,12,11,12,12,13,12, 8, 8, 8, 9, 9, 9, + 9,10,10,10,11,11,11,12,12,12,13, 9, 9, 9,10,10, + 10,10,11,10,11,11,12,11,13,12,13,13, 9, 9,10,10, + 10,10,10,10,11,11,11,11,12,12,13,13,13,10,11,10, + 11,11,11,11,12,11,12,12,13,12,13,13,14,13,10,10, + 10,11,11,11,11,11,12,12,12,12,13,13,13,13,14,11, + 11,11,12,11,12,12,12,12,13,13,13,13,14,13,14,14, + 11,11,11,11,12,12,12,12,12,12,13,13,13,13,14,14, + 14, +}; + +static float _vq_quantthresh__44u9_p4_0[] = { + -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, + 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, +}; + +static long _vq_quantmap__44u9_p4_0[] = { + 15, 13, 11, 9, 7, 5, 3, 1, + 0, 2, 4, 6, 8, 10, 12, 14, + 16, +}; + +static encode_aux_threshmatch _vq_auxt__44u9_p4_0 = { + _vq_quantthresh__44u9_p4_0, + _vq_quantmap__44u9_p4_0, + 17, + 17 +}; + +static static_codebook _44u9_p4_0 = { + 2, 289, + _vq_lengthlist__44u9_p4_0, + 1, -529530880, 1611661312, 5, 0, + _vq_quantlist__44u9_p4_0, + NULL, + &_vq_auxt__44u9_p4_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u9_p5_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__44u9_p5_0[] = { + 1, 4, 4, 5, 7, 7, 5, 7, 7, 5, 8, 8, 8, 9, 9, 7, + 9, 9, 5, 8, 8, 7, 9, 9, 8, 9, 9, 5, 8, 8, 8,10, + 10, 8,10,10, 7,10,10, 9,10,12, 9,11,11, 7,10,10, + 9,11,10, 9,11,12, 5, 8, 8, 8,10,10, 8,10,10, 7, + 10,10, 9,12,11, 9,10,11, 7,10,10, 9,11,11,10,12, + 10, +}; + +static float _vq_quantthresh__44u9_p5_0[] = { + -5.5, 5.5, +}; + +static long _vq_quantmap__44u9_p5_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__44u9_p5_0 = { + _vq_quantthresh__44u9_p5_0, + _vq_quantmap__44u9_p5_0, + 3, + 3 +}; + +static static_codebook _44u9_p5_0 = { + 4, 81, + _vq_lengthlist__44u9_p5_0, + 1, -529137664, 1618345984, 2, 0, + _vq_quantlist__44u9_p5_0, + NULL, + &_vq_auxt__44u9_p5_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u9_p5_1[] = { + 5, + 4, + 6, + 3, + 7, + 2, + 8, + 1, + 9, + 0, + 10, +}; + +static long _vq_lengthlist__44u9_p5_1[] = { + 5, 5, 5, 6, 6, 7, 7, 7, 7, 7, 7, 5, 6, 6, 6, 6, + 7, 7, 7, 7, 8, 7, 5, 6, 6, 6, 6, 7, 7, 7, 7, 7, + 7, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 6, 6, 6, 7, + 7, 7, 7, 7, 7, 8, 8, 7, 7, 7, 7, 7, 8, 7, 8, 8, + 8, 8, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 7, 7, 7, + 8, 7, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 8, 8, 8, 8, + 8, 8, 8, 7, 8, 7, 8, 8, 8, 8, 8, 8, 8, 8, 7, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, +}; + +static float _vq_quantthresh__44u9_p5_1[] = { + -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, + 3.5, 4.5, +}; + +static long _vq_quantmap__44u9_p5_1[] = { + 9, 7, 5, 3, 1, 0, 2, 4, + 6, 8, 10, +}; + +static encode_aux_threshmatch _vq_auxt__44u9_p5_1 = { + _vq_quantthresh__44u9_p5_1, + _vq_quantmap__44u9_p5_1, + 11, + 11 +}; + +static static_codebook _44u9_p5_1 = { + 2, 121, + _vq_lengthlist__44u9_p5_1, + 1, -531365888, 1611661312, 4, 0, + _vq_quantlist__44u9_p5_1, + NULL, + &_vq_auxt__44u9_p5_1, + NULL, + 0 +}; + +static long _vq_quantlist__44u9_p6_0[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__44u9_p6_0[] = { + 2, 4, 4, 6, 6, 7, 7, 8, 8, 9, 9,10,10, 4, 6, 5, + 7, 7, 8, 8, 8, 8, 9, 9,10,10, 4, 5, 6, 7, 7, 8, + 8, 8, 8, 9, 9,10,10, 6, 7, 7, 8, 8, 8, 8, 9, 9, + 10,10,10,10, 6, 7, 7, 8, 8, 8, 8, 9, 9,10,10,10, + 10, 7, 8, 8, 8, 8, 9, 9, 9, 9,10,10,11,11, 7, 8, + 8, 8, 8, 9, 9, 9, 9,10,10,11,11, 8, 8, 8, 9, 9, + 9, 9, 9,10,10,10,11,11, 8, 8, 8, 9, 9, 9, 9,10, + 9,10,10,11,11, 9, 9, 9,10,10,10,10,10,11,11,11, + 11,12, 9, 9, 9,10,10,10,10,10,10,11,10,12,11,10, + 10,10,10,10,11,11,11,11,11,12,12,12,10,10,10,10, + 10,11,11,11,11,12,11,12,12, +}; + +static float _vq_quantthresh__44u9_p6_0[] = { + -27.5, -22.5, -17.5, -12.5, -7.5, -2.5, 2.5, 7.5, + 12.5, 17.5, 22.5, 27.5, +}; + +static long _vq_quantmap__44u9_p6_0[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__44u9_p6_0 = { + _vq_quantthresh__44u9_p6_0, + _vq_quantmap__44u9_p6_0, + 13, + 13 +}; + +static static_codebook _44u9_p6_0 = { + 2, 169, + _vq_lengthlist__44u9_p6_0, + 1, -526516224, 1616117760, 4, 0, + _vq_quantlist__44u9_p6_0, + NULL, + &_vq_auxt__44u9_p6_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u9_p6_1[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44u9_p6_1[] = { + 4, 4, 4, 5, 5, 4, 5, 4, 5, 5, 4, 4, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, +}; + +static float _vq_quantthresh__44u9_p6_1[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__44u9_p6_1[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44u9_p6_1 = { + _vq_quantthresh__44u9_p6_1, + _vq_quantmap__44u9_p6_1, + 5, + 5 +}; + +static static_codebook _44u9_p6_1 = { + 2, 25, + _vq_lengthlist__44u9_p6_1, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__44u9_p6_1, + NULL, + &_vq_auxt__44u9_p6_1, + NULL, + 0 +}; + +static long _vq_quantlist__44u9_p7_0[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__44u9_p7_0[] = { + 1, 4, 5, 6, 6, 7, 7, 8, 9,10,10,11,11, 5, 6, 6, + 7, 7, 8, 8, 9, 9,10,10,11,11, 5, 6, 6, 7, 7, 8, + 8, 9, 9,10,10,11,11, 6, 7, 7, 8, 8, 9, 9,10,10, + 11,11,12,12, 6, 7, 7, 8, 8, 9, 9,10,10,11,11,12, + 12, 8, 8, 8, 9, 9,10,10,11,11,12,12,13,13, 8, 8, + 8, 9, 9,10,10,11,11,12,12,13,13, 9, 9, 9,10,10, + 11,11,12,12,13,13,13,13, 9, 9, 9,10,10,11,11,12, + 12,13,13,14,14,10,10,10,11,11,12,12,13,13,14,13, + 15,14,10,10,10,11,11,12,12,13,13,14,14,14,14,11, + 11,12,12,12,13,13,14,14,14,14,15,15,11,11,12,12, + 12,13,13,14,14,14,15,15,15, +}; + +static float _vq_quantthresh__44u9_p7_0[] = { + -60.5, -49.5, -38.5, -27.5, -16.5, -5.5, 5.5, 16.5, + 27.5, 38.5, 49.5, 60.5, +}; + +static long _vq_quantmap__44u9_p7_0[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__44u9_p7_0 = { + _vq_quantthresh__44u9_p7_0, + _vq_quantmap__44u9_p7_0, + 13, + 13 +}; + +static static_codebook _44u9_p7_0 = { + 2, 169, + _vq_lengthlist__44u9_p7_0, + 1, -523206656, 1618345984, 4, 0, + _vq_quantlist__44u9_p7_0, + NULL, + &_vq_auxt__44u9_p7_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u9_p7_1[] = { + 5, + 4, + 6, + 3, + 7, + 2, + 8, + 1, + 9, + 0, + 10, +}; + +static long _vq_lengthlist__44u9_p7_1[] = { + 5, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 7, 7, + 7, 7, 7, 7, 7, 7, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 6, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 8, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 8, 8, 7, 7, 7, 7, 7, 7, 7, 8, 7, 8, 8, 7, 7, + 7, 7, 7, 7, 7, 8, 8, 8, 8, +}; + +static float _vq_quantthresh__44u9_p7_1[] = { + -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, + 3.5, 4.5, +}; + +static long _vq_quantmap__44u9_p7_1[] = { + 9, 7, 5, 3, 1, 0, 2, 4, + 6, 8, 10, +}; + +static encode_aux_threshmatch _vq_auxt__44u9_p7_1 = { + _vq_quantthresh__44u9_p7_1, + _vq_quantmap__44u9_p7_1, + 11, + 11 +}; + +static static_codebook _44u9_p7_1 = { + 2, 121, + _vq_lengthlist__44u9_p7_1, + 1, -531365888, 1611661312, 4, 0, + _vq_quantlist__44u9_p7_1, + NULL, + &_vq_auxt__44u9_p7_1, + NULL, + 0 +}; + +static long _vq_quantlist__44u9_p8_0[] = { + 7, + 6, + 8, + 5, + 9, + 4, + 10, + 3, + 11, + 2, + 12, + 1, + 13, + 0, + 14, +}; + +static long _vq_lengthlist__44u9_p8_0[] = { + 1, 4, 4, 7, 7, 8, 8, 8, 8, 9, 9,10, 9,11,10, 4, + 6, 6, 8, 8, 9, 9, 9, 9,10,10,11,10,12,10, 4, 6, + 6, 8, 8, 9,10, 9, 9,10,10,11,11,12,12, 7, 8, 8, + 10,10,11,11,10,10,11,11,12,12,13,12, 7, 8, 8,10, + 10,11,11,10,10,11,11,12,12,12,13, 8,10, 9,11,11, + 12,12,11,11,12,12,13,13,14,13, 8, 9, 9,11,11,12, + 12,11,12,12,12,13,13,14,13, 8, 9, 9,10,10,12,11, + 13,12,13,13,14,13,15,14, 8, 9, 9,10,10,11,12,12, + 12,13,13,13,14,14,14, 9,10,10,12,11,13,12,13,13, + 14,13,14,14,14,15, 9,10,10,11,12,12,12,13,13,14, + 14,14,15,15,15,10,11,11,12,12,13,13,14,14,14,14, + 15,14,16,15,10,11,11,12,12,13,13,13,14,14,14,14, + 14,15,16,11,12,12,13,13,14,13,14,14,15,14,15,16, + 16,16,11,12,12,13,13,14,13,14,14,15,15,15,16,15, + 15, +}; + +static float _vq_quantthresh__44u9_p8_0[] = { + -136.5, -115.5, -94.5, -73.5, -52.5, -31.5, -10.5, 10.5, + 31.5, 52.5, 73.5, 94.5, 115.5, 136.5, +}; + +static long _vq_quantmap__44u9_p8_0[] = { + 13, 11, 9, 7, 5, 3, 1, 0, + 2, 4, 6, 8, 10, 12, 14, +}; + +static encode_aux_threshmatch _vq_auxt__44u9_p8_0 = { + _vq_quantthresh__44u9_p8_0, + _vq_quantmap__44u9_p8_0, + 15, + 15 +}; + +static static_codebook _44u9_p8_0 = { + 2, 225, + _vq_lengthlist__44u9_p8_0, + 1, -520986624, 1620377600, 4, 0, + _vq_quantlist__44u9_p8_0, + NULL, + &_vq_auxt__44u9_p8_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u9_p8_1[] = { + 10, + 9, + 11, + 8, + 12, + 7, + 13, + 6, + 14, + 5, + 15, + 4, + 16, + 3, + 17, + 2, + 18, + 1, + 19, + 0, + 20, +}; + +static long _vq_lengthlist__44u9_p8_1[] = { + 4, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 6, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 6, 6, 6, 7, 7, 8, + 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 7, + 7, 7, 8, 8, 8, 8, 9, 8, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9,10, 9,10,10,10, 8, 8, + 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9,10,10, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 10, 9,10, 9,10,10,10,10, 8, 8, 8, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9,10,10, 9,10,10,10,10,10, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9,10, 9,10,10,10,10,10,10, + 10,10, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10, + 10,10,10,10,10,10,10, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9,10,10,10,10,10,10,10,10,10,10, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9,10,10,10,10,10,10,10,10,10, + 10, 9, 9, 9, 9, 9, 9, 9,10, 9,10,10,10,10,10,10, + 10,10,10,10,10,10, 9, 9, 9, 9, 9, 9, 9, 9,10,10, + 10,10,10,10,10,10,10,10,10,10,10, 9, 9, 9, 9, 9, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 9, 9, 9, 9,10, 9, 9,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10, 9, 9, 9,10, 9,10, 9,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10, 9, 9, 9,10, 9,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 9, + 9, 9, 9, 9,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10, 9, 9, 9,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10, +}; + +static float _vq_quantthresh__44u9_p8_1[] = { + -9.5, -8.5, -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, + -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, + 6.5, 7.5, 8.5, 9.5, +}; + +static long _vq_quantmap__44u9_p8_1[] = { + 19, 17, 15, 13, 11, 9, 7, 5, + 3, 1, 0, 2, 4, 6, 8, 10, + 12, 14, 16, 18, 20, +}; + +static encode_aux_threshmatch _vq_auxt__44u9_p8_1 = { + _vq_quantthresh__44u9_p8_1, + _vq_quantmap__44u9_p8_1, + 21, + 21 +}; + +static static_codebook _44u9_p8_1 = { + 2, 441, + _vq_lengthlist__44u9_p8_1, + 1, -529268736, 1611661312, 5, 0, + _vq_quantlist__44u9_p8_1, + NULL, + &_vq_auxt__44u9_p8_1, + NULL, + 0 +}; + +static long _vq_quantlist__44u9_p9_0[] = { + 7, + 6, + 8, + 5, + 9, + 4, + 10, + 3, + 11, + 2, + 12, + 1, + 13, + 0, + 14, +}; + +static long _vq_lengthlist__44u9_p9_0[] = { + 1, 3, 3,11,11,11,11,11,11,11,11,11,11,11,11, 4, + 10,11,11,11,11,11,11,11,11,11,11,11,11,11, 4,10, + 10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10, +}; + +static float _vq_quantthresh__44u9_p9_0[] = { + -6051.5, -5120.5, -4189.5, -3258.5, -2327.5, -1396.5, -465.5, 465.5, + 1396.5, 2327.5, 3258.5, 4189.5, 5120.5, 6051.5, +}; + +static long _vq_quantmap__44u9_p9_0[] = { + 13, 11, 9, 7, 5, 3, 1, 0, + 2, 4, 6, 8, 10, 12, 14, +}; + +static encode_aux_threshmatch _vq_auxt__44u9_p9_0 = { + _vq_quantthresh__44u9_p9_0, + _vq_quantmap__44u9_p9_0, + 15, + 15 +}; + +static static_codebook _44u9_p9_0 = { + 2, 225, + _vq_lengthlist__44u9_p9_0, + 1, -510036736, 1631393792, 4, 0, + _vq_quantlist__44u9_p9_0, + NULL, + &_vq_auxt__44u9_p9_0, + NULL, + 0 +}; + +static long _vq_quantlist__44u9_p9_1[] = { + 9, + 8, + 10, + 7, + 11, + 6, + 12, + 5, + 13, + 4, + 14, + 3, + 15, + 2, + 16, + 1, + 17, + 0, + 18, +}; + +static long _vq_lengthlist__44u9_p9_1[] = { + 1, 4, 4, 7, 7, 8, 7, 8, 7, 9, 8,10, 9,10,10,11, + 11,12,12, 4, 7, 6, 9, 9,10, 9, 9, 8,10,10,11,10, + 12,10,13,12,13,12, 4, 6, 6, 9, 9, 9, 9, 9, 9,10, + 10,11,11,11,12,12,12,12,12, 7, 9, 8,11,10,10,10, + 11,10,11,11,12,12,13,12,13,13,13,13, 7, 8, 9,10, + 10,11,11,10,10,11,11,11,12,13,13,13,13,14,14, 8, + 9, 9,11,11,12,11,12,12,13,12,12,13,13,14,15,14, + 14,14, 8, 9, 9,10,11,11,11,12,12,13,12,13,13,14, + 14,14,15,14,16, 8, 9, 9,11,10,12,12,12,12,15,13, + 13,13,17,14,15,15,15,14, 8, 9, 9,10,11,11,12,13, + 12,13,13,13,14,15,14,14,14,16,15, 9,11,10,12,12, + 13,13,13,13,14,14,16,15,14,14,14,15,15,17, 9,10, + 10,11,11,13,13,13,14,14,13,15,14,15,14,15,16,15, + 16,10,11,11,12,12,13,14,15,14,15,14,14,15,17,16, + 15,15,17,17,10,12,11,13,12,14,14,13,14,15,15,15, + 15,16,17,17,15,17,16,11,12,12,14,13,15,14,15,16, + 17,15,17,15,17,15,15,16,17,15,11,11,12,14,14,14, + 14,14,15,15,16,15,17,17,17,16,17,16,15,12,12,13, + 14,14,14,15,14,15,15,16,16,17,16,17,15,17,17,16, + 12,14,12,14,14,15,15,15,14,14,16,16,16,15,16,16, + 15,17,15,12,13,13,14,15,14,15,17,15,17,16,17,17, + 17,16,17,16,17,17,12,13,13,14,16,15,15,15,16,15, + 17,17,15,17,15,17,16,16,17, +}; + +static float _vq_quantthresh__44u9_p9_1[] = { + -416.5, -367.5, -318.5, -269.5, -220.5, -171.5, -122.5, -73.5, + -24.5, 24.5, 73.5, 122.5, 171.5, 220.5, 269.5, 318.5, + 367.5, 416.5, +}; + +static long _vq_quantmap__44u9_p9_1[] = { + 17, 15, 13, 11, 9, 7, 5, 3, + 1, 0, 2, 4, 6, 8, 10, 12, + 14, 16, 18, +}; + +static encode_aux_threshmatch _vq_auxt__44u9_p9_1 = { + _vq_quantthresh__44u9_p9_1, + _vq_quantmap__44u9_p9_1, + 19, + 19 +}; + +static static_codebook _44u9_p9_1 = { + 2, 361, + _vq_lengthlist__44u9_p9_1, + 1, -518287360, 1622704128, 5, 0, + _vq_quantlist__44u9_p9_1, + NULL, + &_vq_auxt__44u9_p9_1, + NULL, + 0 +}; + +static long _vq_quantlist__44u9_p9_2[] = { + 24, + 23, + 25, + 22, + 26, + 21, + 27, + 20, + 28, + 19, + 29, + 18, + 30, + 17, + 31, + 16, + 32, + 15, + 33, + 14, + 34, + 13, + 35, + 12, + 36, + 11, + 37, + 10, + 38, + 9, + 39, + 8, + 40, + 7, + 41, + 6, + 42, + 5, + 43, + 4, + 44, + 3, + 45, + 2, + 46, + 1, + 47, + 0, + 48, +}; + +static long _vq_lengthlist__44u9_p9_2[] = { + 2, 4, 4, 5, 4, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 7, 6, 7, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, +}; + +static float _vq_quantthresh__44u9_p9_2[] = { + -23.5, -22.5, -21.5, -20.5, -19.5, -18.5, -17.5, -16.5, + -15.5, -14.5, -13.5, -12.5, -11.5, -10.5, -9.5, -8.5, + -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, + 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, + 8.5, 9.5, 10.5, 11.5, 12.5, 13.5, 14.5, 15.5, + 16.5, 17.5, 18.5, 19.5, 20.5, 21.5, 22.5, 23.5, +}; + +static long _vq_quantmap__44u9_p9_2[] = { + 47, 45, 43, 41, 39, 37, 35, 33, + 31, 29, 27, 25, 23, 21, 19, 17, + 15, 13, 11, 9, 7, 5, 3, 1, + 0, 2, 4, 6, 8, 10, 12, 14, + 16, 18, 20, 22, 24, 26, 28, 30, + 32, 34, 36, 38, 40, 42, 44, 46, + 48, +}; + +static encode_aux_threshmatch _vq_auxt__44u9_p9_2 = { + _vq_quantthresh__44u9_p9_2, + _vq_quantmap__44u9_p9_2, + 49, + 49 +}; + +static static_codebook _44u9_p9_2 = { + 1, 49, + _vq_lengthlist__44u9_p9_2, + 1, -526909440, 1611661312, 6, 0, + _vq_quantlist__44u9_p9_2, + NULL, + &_vq_auxt__44u9_p9_2, + NULL, + 0 +}; + +static long _huff_lengthlist__44un1__long[] = { + 5, 6,12, 9,14, 9, 9,19, 6, 1, 5, 5, 8, 7, 9,19, + 12, 4, 4, 7, 7, 9,11,18, 9, 5, 6, 6, 8, 7, 8,17, + 14, 8, 7, 8, 8,10,12,18, 9, 6, 8, 6, 8, 6, 8,18, + 9, 8,11, 8,11, 7, 5,15,16,18,18,18,17,15,11,18, +}; + +static static_codebook _huff_book__44un1__long = { + 2, 64, + _huff_lengthlist__44un1__long, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + +static long _vq_quantlist__44un1__p1_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__44un1__p1_0[] = { + 1, 4, 4, 5, 8, 7, 5, 7, 8, 5, 8, 8, 8,10,11, 8, + 10,11, 5, 8, 8, 8,11,10, 8,11,10, 4, 9, 9, 8,11, + 11, 8,11,11, 8,12,11,10,12,14,11,13,13, 7,11,11, + 10,13,11,11,13,14, 4, 8, 9, 8,11,11, 8,11,12, 7, + 11,11,11,14,13,10,11,13, 8,11,12,11,13,13,10,14, + 12, +}; + +static float _vq_quantthresh__44un1__p1_0[] = { + -0.5, 0.5, +}; + +static long _vq_quantmap__44un1__p1_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__44un1__p1_0 = { + _vq_quantthresh__44un1__p1_0, + _vq_quantmap__44un1__p1_0, + 3, + 3 +}; + +static static_codebook _44un1__p1_0 = { + 4, 81, + _vq_lengthlist__44un1__p1_0, + 1, -535822336, 1611661312, 2, 0, + _vq_quantlist__44un1__p1_0, + NULL, + &_vq_auxt__44un1__p1_0, + NULL, + 0 +}; + +static long _vq_quantlist__44un1__p2_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__44un1__p2_0[] = { + 2, 4, 4, 5, 6, 6, 5, 6, 6, 5, 7, 7, 7, 8, 8, 6, + 7, 9, 5, 7, 7, 6, 8, 7, 7, 9, 8, 4, 7, 7, 7, 9, + 8, 7, 8, 8, 7, 9, 8, 8, 8,10, 9,10,10, 6, 8, 8, + 7,10, 8, 9,10,10, 5, 7, 7, 7, 8, 8, 7, 8, 9, 6, + 8, 8, 9,10,10, 7, 8,10, 6, 8, 9, 9,10,10, 8,10, + 8, +}; + +static float _vq_quantthresh__44un1__p2_0[] = { + -0.5, 0.5, +}; + +static long _vq_quantmap__44un1__p2_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__44un1__p2_0 = { + _vq_quantthresh__44un1__p2_0, + _vq_quantmap__44un1__p2_0, + 3, + 3 +}; + +static static_codebook _44un1__p2_0 = { + 4, 81, + _vq_lengthlist__44un1__p2_0, + 1, -535822336, 1611661312, 2, 0, + _vq_quantlist__44un1__p2_0, + NULL, + &_vq_auxt__44un1__p2_0, + NULL, + 0 +}; + +static long _vq_quantlist__44un1__p3_0[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44un1__p3_0[] = { + 1, 5, 5, 8, 8, 5, 8, 7, 9, 9, 5, 7, 8, 9, 9, 9, + 10, 9,12,12, 9, 9,10,11,12, 6, 8, 8,10,10, 8,10, + 10,11,11, 8, 9,10,11,11,10,11,11,13,13,10,11,11, + 12,13, 6, 8, 8,10,10, 8,10, 9,11,11, 8,10,10,11, + 11,10,11,11,13,12,10,11,11,13,12, 9,11,11,15,13, + 10,12,11,15,13,10,11,11,15,14,12,14,13,16,15,12, + 13,13,17,16, 9,11,11,13,15,10,11,12,14,15,10,11, + 12,14,15,12,13,13,15,16,12,13,13,16,16, 5, 8, 8, + 11,11, 8,10,10,12,12, 8,10,10,12,12,11,12,12,14, + 14,11,12,12,14,14, 8,11,10,13,12,10,11,12,12,13, + 10,12,12,13,13,12,12,13,13,15,11,12,13,15,14, 7, + 10,10,12,12, 9,12,11,13,12,10,12,12,13,14,12,13, + 12,15,13,11,13,12,14,15,10,12,12,16,14,11,12,12, + 16,15,11,13,12,17,16,13,13,15,15,17,13,15,15,20, + 17,10,12,12,14,16,11,12,12,15,15,11,13,13,15,18, + 13,14,13,15,15,13,15,14,16,16, 5, 8, 8,11,11, 8, + 10,10,12,12, 8,10,10,12,12,11,12,12,14,14,11,12, + 12,14,15, 7,10,10,13,12,10,12,12,14,13, 9,10,12, + 12,13,11,13,13,15,15,11,12,13,13,15, 8,10,10,12, + 13,10,12,12,13,13,10,12,11,13,13,11,13,12,15,15, + 12,13,12,15,13,10,12,12,16,14,11,12,12,16,15,10, + 12,12,16,14,14,15,14,18,16,13,13,14,15,16,10,12, + 12,14,16,11,13,13,16,16,11,13,12,14,16,13,15,15, + 18,18,13,15,13,16,14, 8,11,11,16,16,10,13,13,17, + 16,10,12,12,16,15,14,16,15,20,17,13,14,14,17,17, + 9,12,12,16,16,11,13,14,16,17,11,13,13,16,16,15, + 15,19,18, 0,14,15,15,18,18, 9,12,12,17,16,11,13, + 12,17,16,11,12,13,15,17,15,16,15, 0,19,14,15,14, + 19,18,12,14,14, 0,16,13,14,14,19,18,13,15,16,17, + 16,15,15,17,18, 0,14,16,16,19, 0,12,14,14,16,18, + 13,15,13,17,18,13,15,14,17,18,15,18,14,18,18,16, + 17,16, 0,17, 8,11,11,15,15,10,12,12,16,16,10,13, + 13,16,16,13,15,14,17,17,14,15,17,17,18, 9,12,12, + 16,15,11,13,13,16,16,11,12,13,17,17,14,14,15,17, + 17,14,15,16, 0,18, 9,12,12,16,17,11,13,13,16,17, + 11,14,13,18,17,14,16,14,17,17,15,17,17,18,18,12, + 14,14, 0,16,13,15,15,19, 0,12,13,15, 0, 0,14,17, + 16,19, 0,16,15,18,18, 0,12,14,14,17, 0,13,14,14, + 17, 0,13,15,14, 0,18,15,16,16, 0,18,15,18,15, 0, + 17, +}; + +static float _vq_quantthresh__44un1__p3_0[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__44un1__p3_0[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44un1__p3_0 = { + _vq_quantthresh__44un1__p3_0, + _vq_quantmap__44un1__p3_0, + 5, + 5 +}; + +static static_codebook _44un1__p3_0 = { + 4, 625, + _vq_lengthlist__44un1__p3_0, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__44un1__p3_0, + NULL, + &_vq_auxt__44un1__p3_0, + NULL, + 0 +}; + +static long _vq_quantlist__44un1__p4_0[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44un1__p4_0[] = { + 3, 5, 5, 9, 9, 5, 6, 6,10, 9, 5, 6, 6, 9,10,10, + 10,10,12,11, 9,10,10,12,12, 5, 7, 7,10,10, 7, 7, + 8,10,11, 7, 7, 8,10,11,10,10,11,11,13,10,10,11, + 11,13, 6, 7, 7,10,10, 7, 8, 7,11,10, 7, 8, 7,10, + 10,10,11, 9,13,11,10,11,10,13,11,10,10,10,14,13, + 10,11,11,14,13,10,10,11,13,14,12,12,13,15,15,12, + 12,13,13,14,10,10,10,12,13,10,11,10,13,13,10,11, + 11,13,13,12,13,12,14,13,12,13,13,14,13, 5, 7, 7, + 10,10, 7, 8, 8,11,10, 7, 8, 8,10,10,11,11,11,13, + 13,10,11,11,12,12, 7, 8, 8,11,11, 7, 8, 9,10,12, + 8, 9, 9,11,11,11,10,12,11,14,11,11,12,13,13, 6, + 8, 8,10,11, 7, 9, 7,12,10, 8, 9,10,11,12,10,12, + 10,14,11,11,12,11,13,13,10,11,11,14,14,10,10,11, + 13,14,11,12,12,15,13,12,11,14,12,16,12,13,14,15, + 16,10,10,11,13,14,10,11,10,14,12,11,12,12,13,14, + 12,13,11,15,12,14,14,14,15,15, 5, 7, 7,10,10, 7, + 8, 8,10,10, 7, 8, 8,10,11,10,11,10,12,12,10,11, + 11,12,13, 6, 8, 8,11,11, 8, 9, 9,12,11, 7, 7, 9, + 10,12,11,11,11,12,13,11,10,12,11,15, 7, 8, 8,11, + 11, 8, 9, 9,11,11, 7, 9, 8,12,10,11,12,11,13,12, + 11,12,10,15,11,10,11,10,14,12,11,12,11,14,13,10, + 10,11,13,14,13,13,13,17,15,12,11,14,12,15,10,10, + 11,13,14,11,12,12,14,14,10,11,10,14,13,13,14,13, + 16,17,12,14,11,16,12, 9,10,10,14,13,10,11,10,14, + 14,10,11,11,13,13,13,14,14,16,15,12,13,13,14,14, + 9,11,10,14,13,10,10,12,13,14,11,12,11,14,13,13, + 14,14,14,15,13,14,14,15,15, 9,10,11,13,14,10,11, + 10,15,13,11,11,12,12,15,13,14,12,15,14,13,13,14, + 14,15,12,13,12,16,14,11,11,12,15,14,13,15,13,16, + 14,13,12,15,12,17,15,16,15,16,16,12,12,13,13,15, + 11,13,11,15,14,13,13,14,15,17,13,14,12, 0,13,14, + 15,14,15, 0, 9,10,10,13,13,10,11,11,13,13,10,11, + 11,13,13,12,13,12,14,14,13,14,14,15,17, 9,10,10, + 13,13,11,12,11,15,12,10,10,11,13,16,13,14,13,15, + 14,13,13,14,15,16,10,10,11,13,14,11,11,12,13,14, + 10,12,11,14,14,13,13,13,14,15,13,15,13,16,15,12, + 13,12,15,13,12,15,13,15,15,11,11,13,14,15,15,15, + 15,15,17,13,12,14,13,17,12,12,14,14,15,13,13,14, + 14,16,11,13,11,16,15,14,16,16,17, 0,14,13,11,16, + 12, +}; + +static float _vq_quantthresh__44un1__p4_0[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__44un1__p4_0[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44un1__p4_0 = { + _vq_quantthresh__44un1__p4_0, + _vq_quantmap__44un1__p4_0, + 5, + 5 +}; + +static static_codebook _44un1__p4_0 = { + 4, 625, + _vq_lengthlist__44un1__p4_0, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__44un1__p4_0, + NULL, + &_vq_auxt__44un1__p4_0, + NULL, + 0 +}; + +static long _vq_quantlist__44un1__p5_0[] = { + 4, + 3, + 5, + 2, + 6, + 1, + 7, + 0, + 8, +}; + +static long _vq_lengthlist__44un1__p5_0[] = { + 1, 4, 4, 7, 7, 8, 8, 9, 9, 4, 6, 5, 8, 7, 8, 8, + 10, 9, 4, 6, 6, 8, 8, 8, 8,10,10, 7, 8, 7, 9, 9, + 9, 9,11,10, 7, 8, 8, 9, 9, 9, 9,10,11, 8, 8, 8, + 9, 9,10,10,11,11, 8, 8, 8, 9, 9,10,10,11,11, 9, + 10,10,11,10,11,11,12,12, 9,10,10,10,11,11,11,12, + 12, +}; + +static float _vq_quantthresh__44un1__p5_0[] = { + -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, +}; + +static long _vq_quantmap__44un1__p5_0[] = { + 7, 5, 3, 1, 0, 2, 4, 6, + 8, +}; + +static encode_aux_threshmatch _vq_auxt__44un1__p5_0 = { + _vq_quantthresh__44un1__p5_0, + _vq_quantmap__44un1__p5_0, + 9, + 9 +}; + +static static_codebook _44un1__p5_0 = { + 2, 81, + _vq_lengthlist__44un1__p5_0, + 1, -531628032, 1611661312, 4, 0, + _vq_quantlist__44un1__p5_0, + NULL, + &_vq_auxt__44un1__p5_0, + NULL, + 0 +}; + +static long _vq_quantlist__44un1__p6_0[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__44un1__p6_0[] = { + 1, 4, 4, 6, 6, 8, 8,10,10,11,11,15,15, 4, 5, 5, + 8, 8, 9, 9,11,11,12,12,16,16, 4, 5, 6, 8, 8, 9, + 9,11,11,12,12,14,14, 7, 8, 8, 9, 9,10,10,11,12, + 13,13,16,17, 7, 8, 8, 9, 9,10,10,12,12,12,13,15, + 15, 9,10,10,10,10,11,11,12,12,13,13,15,16, 9, 9, + 9,10,10,11,11,13,12,13,13,17,17,10,11,11,11,12, + 12,12,13,13,14,15, 0,18,10,11,11,12,12,12,13,14, + 13,14,14,17,16,11,12,12,13,13,14,14,14,14,15,16, + 17,16,11,12,12,13,13,14,14,14,14,15,15,17,17,14, + 15,15,16,16,16,17,17,16, 0,17, 0,18,14,15,15,16, + 16, 0,15,18,18, 0,16, 0, 0, +}; + +static float _vq_quantthresh__44un1__p6_0[] = { + -27.5, -22.5, -17.5, -12.5, -7.5, -2.5, 2.5, 7.5, + 12.5, 17.5, 22.5, 27.5, +}; + +static long _vq_quantmap__44un1__p6_0[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__44un1__p6_0 = { + _vq_quantthresh__44un1__p6_0, + _vq_quantmap__44un1__p6_0, + 13, + 13 +}; + +static static_codebook _44un1__p6_0 = { + 2, 169, + _vq_lengthlist__44un1__p6_0, + 1, -526516224, 1616117760, 4, 0, + _vq_quantlist__44un1__p6_0, + NULL, + &_vq_auxt__44un1__p6_0, + NULL, + 0 +}; + +static long _vq_quantlist__44un1__p6_1[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44un1__p6_1[] = { + 2, 4, 4, 5, 5, 4, 5, 5, 5, 5, 4, 5, 5, 6, 5, 5, + 6, 5, 6, 6, 5, 6, 6, 6, 6, +}; + +static float _vq_quantthresh__44un1__p6_1[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__44un1__p6_1[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44un1__p6_1 = { + _vq_quantthresh__44un1__p6_1, + _vq_quantmap__44un1__p6_1, + 5, + 5 +}; + +static static_codebook _44un1__p6_1 = { + 2, 25, + _vq_lengthlist__44un1__p6_1, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__44un1__p6_1, + NULL, + &_vq_auxt__44un1__p6_1, + NULL, + 0 +}; + +static long _vq_quantlist__44un1__p7_0[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44un1__p7_0[] = { + 1, 5, 3,11,11,11,11,11,11,11, 8,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,10,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,10,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11, 8,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11, 7,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,10,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10, +}; + +static float _vq_quantthresh__44un1__p7_0[] = { + -253.5, -84.5, 84.5, 253.5, +}; + +static long _vq_quantmap__44un1__p7_0[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44un1__p7_0 = { + _vq_quantthresh__44un1__p7_0, + _vq_quantmap__44un1__p7_0, + 5, + 5 +}; + +static static_codebook _44un1__p7_0 = { + 4, 625, + _vq_lengthlist__44un1__p7_0, + 1, -518709248, 1626677248, 3, 0, + _vq_quantlist__44un1__p7_0, + NULL, + &_vq_auxt__44un1__p7_0, + NULL, + 0 +}; + +static long _vq_quantlist__44un1__p7_1[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__44un1__p7_1[] = { + 1, 4, 4, 6, 6, 6, 6, 9, 8, 9, 8, 8, 8, 5, 7, 7, + 7, 7, 8, 8, 8,10, 8,10, 8, 9, 5, 7, 7, 8, 7, 7, + 8,10,10,11,10,12,11, 7, 8, 8, 9, 9, 9,10,11,11, + 11,11,11,11, 7, 8, 8, 8, 9, 9, 9,10,10,10,11,11, + 12, 7, 8, 8, 9, 9,10,11,11,12,11,12,11,11, 7, 8, + 8, 9, 9,10,10,11,11,11,12,12,11, 8,10,10,10,10, + 11,11,14,11,12,12,12,13, 9,10,10,10,10,12,11,14, + 11,14,11,12,13,10,11,11,11,11,13,11,14,14,13,13, + 13,14,11,11,11,12,11,12,12,12,13,14,14,13,14,12, + 11,12,12,12,12,13,13,13,14,13,14,14,11,12,12,14, + 12,13,13,12,13,13,14,14,14, +}; + +static float _vq_quantthresh__44un1__p7_1[] = { + -71.5, -58.5, -45.5, -32.5, -19.5, -6.5, 6.5, 19.5, + 32.5, 45.5, 58.5, 71.5, +}; + +static long _vq_quantmap__44un1__p7_1[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__44un1__p7_1 = { + _vq_quantthresh__44un1__p7_1, + _vq_quantmap__44un1__p7_1, + 13, + 13 +}; + +static static_codebook _44un1__p7_1 = { + 2, 169, + _vq_lengthlist__44un1__p7_1, + 1, -523010048, 1618608128, 4, 0, + _vq_quantlist__44un1__p7_1, + NULL, + &_vq_auxt__44un1__p7_1, + NULL, + 0 +}; + +static long _vq_quantlist__44un1__p7_2[] = { + 6, + 5, + 7, + 4, + 8, + 3, + 9, + 2, + 10, + 1, + 11, + 0, + 12, +}; + +static long _vq_lengthlist__44un1__p7_2[] = { + 3, 4, 4, 6, 6, 7, 7, 8, 8, 9, 9, 9, 8, 4, 5, 5, + 6, 6, 8, 8, 9, 8, 9, 9, 9, 9, 4, 5, 5, 7, 6, 8, + 8, 8, 8, 9, 8, 9, 8, 6, 7, 7, 7, 8, 8, 8, 9, 9, + 9, 9, 9, 9, 6, 7, 7, 7, 7, 8, 8, 9, 9, 9, 9, 9, + 9, 7, 8, 8, 8, 8, 9, 8, 9, 9,10, 9, 9,10, 7, 8, + 8, 8, 8, 9, 9, 9, 9, 9, 9,10,10, 8, 9, 9, 9, 9, + 9, 9, 9, 9,10,10, 9,10, 8, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9,10,10, 9, 9, 9,10, 9, 9,10, 9, 9,10,10, + 10,10, 9, 9, 9, 9, 9, 9, 9,10, 9,10,10,10,10, 9, + 9, 9,10, 9, 9,10,10, 9,10,10,10,10, 9, 9, 9,10, + 9, 9, 9,10,10,10,10,10,10, +}; + +static float _vq_quantthresh__44un1__p7_2[] = { + -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, + 2.5, 3.5, 4.5, 5.5, +}; + +static long _vq_quantmap__44un1__p7_2[] = { + 11, 9, 7, 5, 3, 1, 0, 2, + 4, 6, 8, 10, 12, +}; + +static encode_aux_threshmatch _vq_auxt__44un1__p7_2 = { + _vq_quantthresh__44un1__p7_2, + _vq_quantmap__44un1__p7_2, + 13, + 13 +}; + +static static_codebook _44un1__p7_2 = { + 2, 169, + _vq_lengthlist__44un1__p7_2, + 1, -531103744, 1611661312, 4, 0, + _vq_quantlist__44un1__p7_2, + NULL, + &_vq_auxt__44un1__p7_2, + NULL, + 0 +}; + +static long _huff_lengthlist__44un1__short[] = { + 12,12,14,12,14,14,14,14,12, 6, 6, 8, 9, 9,11,14, + 12, 4, 2, 6, 6, 7,11,14,13, 6, 5, 7, 8, 9,11,14, + 13, 8, 5, 8, 6, 8,12,14,12, 7, 7, 8, 8, 8,10,14, + 12, 6, 3, 4, 4, 4, 7,14,11, 7, 4, 6, 6, 6, 8,14, +}; + +static static_codebook _huff_book__44un1__short = { + 2, 64, + _huff_lengthlist__44un1__short, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + diff --git a/Libraries/Vorbis/Files/lib/codebook.c b/Libraries/Vorbis/Files/lib/codebook.c new file mode 100644 index 000000000..040e1b4c5 --- /dev/null +++ b/Libraries/Vorbis/Files/lib/codebook.c @@ -0,0 +1,615 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * + * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * + * by the XIPHOPHORUS Company http://www.xiph.org/ * + * * + ******************************************************************** + + function: basic codebook pack/unpack/code/decode operations + last mod: $Id$ + + ********************************************************************/ + +#include +#include +#include +#include +#include "vorbis/codec.h" +#include "codebook.h" +#include "scales.h" +#include "misc.h" +#include "os.h" + +/* packs the given codebook into the bitstream **************************/ + +int vorbis_staticbook_pack(const static_codebook *c,oggpack_buffer *opb){ + long i,j; + int ordered=0; + + /* first the basic parameters */ + oggpack_write(opb,0x564342,24); + oggpack_write(opb,c->dim,16); + oggpack_write(opb,c->entries,24); + + /* pack the codewords. There are two packings; length ordered and + length random. Decide between the two now. */ + + for(i=1;ientries;i++) + if(c->lengthlist[i-1]==0 || c->lengthlist[i]lengthlist[i-1])break; + if(i==c->entries)ordered=1; + + if(ordered){ + /* length ordered. We only need to say how many codewords of + each length. The actual codewords are generated + deterministically */ + + long count=0; + oggpack_write(opb,1,1); /* ordered */ + oggpack_write(opb,c->lengthlist[0]-1,5); /* 1 to 32 */ + + for(i=1;ientries;i++){ + long this=c->lengthlist[i]; + long last=c->lengthlist[i-1]; + if(this>last){ + for(j=last;jentries-count)); + count=i; + } + } + } + oggpack_write(opb,i-count,_ilog(c->entries-count)); + + }else{ + /* length random. Again, we don't code the codeword itself, just + the length. This time, though, we have to encode each length */ + oggpack_write(opb,0,1); /* unordered */ + + /* algortihmic mapping has use for 'unused entries', which we tag + here. The algorithmic mapping happens as usual, but the unused + entry has no codeword. */ + for(i=0;ientries;i++) + if(c->lengthlist[i]==0)break; + + if(i==c->entries){ + oggpack_write(opb,0,1); /* no unused entries */ + for(i=0;ientries;i++) + oggpack_write(opb,c->lengthlist[i]-1,5); + }else{ + oggpack_write(opb,1,1); /* we have unused entries; thus we tag */ + for(i=0;ientries;i++){ + if(c->lengthlist[i]==0){ + oggpack_write(opb,0,1); + }else{ + oggpack_write(opb,1,1); + oggpack_write(opb,c->lengthlist[i]-1,5); + } + } + } + } + + /* is the entry number the desired return value, or do we have a + mapping? If we have a mapping, what type? */ + oggpack_write(opb,c->maptype,4); + switch(c->maptype){ + case 0: + /* no mapping */ + break; + case 1:case 2: + /* implicitly populated value mapping */ + /* explicitly populated value mapping */ + + if(!c->quantlist){ + /* no quantlist? error */ + return(-1); + } + + /* values that define the dequantization */ + oggpack_write(opb,c->q_min,32); + oggpack_write(opb,c->q_delta,32); + oggpack_write(opb,c->q_quant-1,4); + oggpack_write(opb,c->q_sequencep,1); + + { + int quantvals; + switch(c->maptype){ + case 1: + /* a single column of (c->entries/c->dim) quantized values for + building a full value list algorithmically (square lattice) */ + quantvals=_book_maptype1_quantvals(c); + break; + case 2: + /* every value (c->entries*c->dim total) specified explicitly */ + quantvals=c->entries*c->dim; + break; + default: /* NOT_REACHABLE */ + quantvals=-1; + } + + /* quantized values */ + for(i=0;iquantlist[i]),c->q_quant); + + } + break; + default: + /* error case; we don't have any other map types now */ + return(-1); + } + + return(0); +} + +/* unpacks a codebook from the packet buffer into the codebook struct, + readies the codebook auxiliary structures for decode *************/ +int vorbis_staticbook_unpack(oggpack_buffer *opb,static_codebook *s){ + long i,j; + memset(s,0,sizeof(*s)); + s->allocedp=1; + + /* make sure alignment is correct */ + if(oggpack_read(opb,24)!=0x564342)goto _eofout; + + /* first the basic parameters */ + s->dim=oggpack_read(opb,16); + s->entries=oggpack_read(opb,24); + if(s->entries==-1)goto _eofout; + + /* codeword ordering.... length ordered or unordered? */ + switch((int)oggpack_read(opb,1)){ + case 0: + /* unordered */ + s->lengthlist=_ogg_malloc(sizeof(*s->lengthlist)*s->entries); + + /* allocated but unused entries? */ + if(oggpack_read(opb,1)){ + /* yes, unused entries */ + + for(i=0;ientries;i++){ + if(oggpack_read(opb,1)){ + long num=oggpack_read(opb,5); + if(num==-1)goto _eofout; + s->lengthlist[i]=num+1; + }else + s->lengthlist[i]=0; + } + }else{ + /* all entries used; no tagging */ + for(i=0;ientries;i++){ + long num=oggpack_read(opb,5); + if(num==-1)goto _eofout; + s->lengthlist[i]=num+1; + } + } + + break; + case 1: + /* ordered */ + { + long length=oggpack_read(opb,5)+1; + s->lengthlist=_ogg_malloc(sizeof(*s->lengthlist)*s->entries); + + for(i=0;ientries;){ + long num=oggpack_read(opb,_ilog(s->entries-i)); + if(num==-1)goto _eofout; + for(j=0;jentries;j++,i++) + s->lengthlist[i]=length; + length++; + } + } + break; + default: + /* EOF */ + return(-1); + } + + /* Do we have a mapping to unpack? */ + switch((s->maptype=oggpack_read(opb,4))){ + case 0: + /* no mapping */ + break; + case 1: case 2: + /* implicitly populated value mapping */ + /* explicitly populated value mapping */ + + s->q_min=oggpack_read(opb,32); + s->q_delta=oggpack_read(opb,32); + s->q_quant=oggpack_read(opb,4)+1; + s->q_sequencep=oggpack_read(opb,1); + + { + int quantvals=0; + switch(s->maptype){ + case 1: + quantvals=_book_maptype1_quantvals(s); + break; + case 2: + quantvals=s->entries*s->dim; + break; + } + + /* quantized values */ + s->quantlist=_ogg_malloc(sizeof(*s->quantlist)*quantvals); + for(i=0;iquantlist[i]=oggpack_read(opb,s->q_quant); + + if(quantvals&&s->quantlist[quantvals-1]==-1)goto _eofout; + } + break; + default: + goto _errout; + } + + /* all set */ + return(0); + + _errout: + _eofout: + vorbis_staticbook_clear(s); + return(-1); +} + +/* returns the number of bits ************************************************/ +int vorbis_book_encode(codebook *book, int a, oggpack_buffer *b){ + oggpack_write(b,book->codelist[a],book->c->lengthlist[a]); + return(book->c->lengthlist[a]); +} + +/* One the encode side, our vector writers are each designed for a +specific purpose, and the encoder is not flexible without modification: + +The LSP vector coder uses a single stage nearest-match with no +interleave, so no step and no error return. This is specced by floor0 +and doesn't change. + +Residue0 encoding interleaves, uses multiple stages, and each stage +peels of a specific amount of resolution from a lattice (thus we want +to match by threshold, not nearest match). Residue doesn't *have* to +be encoded that way, but to change it, one will need to add more +infrastructure on the encode side (decode side is specced and simpler) */ + +/* floor0 LSP (single stage, non interleaved, nearest match) */ +/* returns entry number and *modifies a* to the quantization value *****/ +int vorbis_book_errorv(codebook *book,float *a){ + int dim=book->dim,k; + int best=_best(book,a,1); + for(k=0;kvaluelist+best*dim)[k]; + return(best); +} + +/* returns the number of bits and *modifies a* to the quantization value *****/ +int vorbis_book_encodev(codebook *book,int best,float *a,oggpack_buffer *b){ + int k,dim=book->dim; + for(k=0;kvaluelist+best*dim)[k]; + return(vorbis_book_encode(book,best,b)); +} + +/* the 'eliminate the decode tree' optimization actually requires the + codewords to be MSb first, not LSb. This is an annoying inelegancy + (and one of the first places where carefully thought out design + turned out to be wrong; Vorbis II and future Ogg codecs should go + to an MSb bitpacker), but not actually the huge hit it appears to + be. The first-stage decode table catches most words so that + bitreverse is not in the main execution path. */ + +static ogg_uint32_t bitreverse(ogg_uint32_t x){ + x= ((x>>16)&0x0000ffff) | ((x<<16)&0xffff0000); + x= ((x>> 8)&0x00ff00ff) | ((x<< 8)&0xff00ff00); + x= ((x>> 4)&0x0f0f0f0f) | ((x<< 4)&0xf0f0f0f0); + x= ((x>> 2)&0x33333333) | ((x<< 2)&0xcccccccc); + return((x>> 1)&0x55555555) | ((x<< 1)&0xaaaaaaaa); +} + +STIN long decode_packed_entry_number(codebook *book, oggpack_buffer *b){ + int read=book->dec_maxlength; + long lo,hi; + long lok = oggpack_look(b,book->dec_firsttablen); + + if (lok >= 0) { + long entry = book->dec_firsttable[lok]; + if(entry&0x80000000UL){ + lo=(entry>>15)&0x7fff; + hi=book->used_entries-(entry&0x7fff); + }else{ + oggpack_adv(b, book->dec_codelengths[entry-1]); + return(entry-1); + } + }else{ + lo=0; + hi=book->used_entries; + } + + lok = oggpack_look(b, read); + + while(lok<0 && read>1) + lok = oggpack_look(b, --read); + if(lok<0)return -1; + + /* bisect search for the codeword in the ordered list */ + { + ogg_uint32_t testword=bitreverse((ogg_uint32_t)lok); + + while(hi-lo>1){ + long p=(hi-lo)>>1; + long test=book->codelist[lo+p]>testword; + lo+=p&(test-1); + hi-=p&(-test); + } + + if(book->dec_codelengths[lo]<=read){ + oggpack_adv(b, book->dec_codelengths[lo]); + return(lo); + } + } + + oggpack_adv(b, read); + return(-1); +} + +/* Decode side is specced and easier, because we don't need to find + matches using different criteria; we simply read and map. There are + two things we need to do 'depending': + + We may need to support interleave. We don't really, but it's + convenient to do it here rather than rebuild the vector later. + + Cascades may be additive or multiplicitive; this is not inherent in + the codebook, but set in the code using the codebook. Like + interleaving, it's easiest to do it here. + addmul==0 -> declarative (set the value) + addmul==1 -> additive + addmul==2 -> multiplicitive */ + +/* returns the [original, not compacted] entry number or -1 on eof *********/ +long vorbis_book_decode(codebook *book, oggpack_buffer *b){ + long packed_entry=decode_packed_entry_number(book,b); + if(packed_entry>=0) + return(book->dec_index[packed_entry]); + + /* if there's no dec_index, the codebook unpacking isn't collapsed */ + return(packed_entry); +} + +/* returns 0 on OK or -1 on eof *************************************/ +long vorbis_book_decodevs_add(codebook *book,float *a,oggpack_buffer *b,int n){ + int step=n/book->dim; + long *entry = alloca(sizeof(*entry)*step); + float **t = alloca(sizeof(*t)*step); + int i,j,o; + + for (i = 0; i < step; i++) { + entry[i]=decode_packed_entry_number(book,b); + if(entry[i]==-1)return(-1); + t[i] = book->valuelist+entry[i]*book->dim; + } + for(i=0,o=0;idim;i++,o+=step) + for (j=0;jdim>8){ + for(i=0;ivaluelist+entry*book->dim; + for (j=0;jdim;) + a[i++]+=t[j++]; + } + }else{ + for(i=0;ivaluelist+entry*book->dim; + j=0; + switch((int)book->dim){ + case 8: + a[i++]+=t[j++]; + case 7: + a[i++]+=t[j++]; + case 6: + a[i++]+=t[j++]; + case 5: + a[i++]+=t[j++]; + case 4: + a[i++]+=t[j++]; + case 3: + a[i++]+=t[j++]; + case 2: + a[i++]+=t[j++]; + case 1: + a[i++]+=t[j++]; + case 0: + break; + } + } + } + return(0); +} + +long vorbis_book_decodev_set(codebook *book,float *a,oggpack_buffer *b,int n){ + int i,j,entry; + float *t; + + for(i=0;ivaluelist+entry*book->dim; + for (j=0;jdim;) + a[i++]=t[j++]; + } + return(0); +} + +long vorbis_book_decodevv_add(codebook *book,float **a,long offset,int ch, + oggpack_buffer *b,int n){ + long i,j,entry; + int chptr=0; + + for(i=offset/ch;i<(offset+n)/ch;){ + entry = decode_packed_entry_number(book,b); + if(entry==-1)return(-1); + { + const float *t = book->valuelist+entry*book->dim; + for (j=0;jdim;j++){ + a[chptr++][i]+=t[j]; + if(chptr==ch){ + chptr=0; + i++; + } + } + } + } + return(0); +} + +#ifdef _V_SELFTEST +/* Simple enough; pack a few candidate codebooks, unpack them. Code a + number of vectors through (keeping track of the quantized values), + and decode using the unpacked book. quantized version of in should + exactly equal out */ + +#include + +#include "vorbis/book/lsp20_0.vqh" +#include "vorbis/book/res0a_13.vqh" +#define TESTSIZE 40 + +float test1[TESTSIZE]={ + 0.105939f, + 0.215373f, + 0.429117f, + 0.587974f, + + 0.181173f, + 0.296583f, + 0.515707f, + 0.715261f, + + 0.162327f, + 0.263834f, + 0.342876f, + 0.406025f, + + 0.103571f, + 0.223561f, + 0.368513f, + 0.540313f, + + 0.136672f, + 0.395882f, + 0.587183f, + 0.652476f, + + 0.114338f, + 0.417300f, + 0.525486f, + 0.698679f, + + 0.147492f, + 0.324481f, + 0.643089f, + 0.757582f, + + 0.139556f, + 0.215795f, + 0.324559f, + 0.399387f, + + 0.120236f, + 0.267420f, + 0.446940f, + 0.608760f, + + 0.115587f, + 0.287234f, + 0.571081f, + 0.708603f, +}; + +float test3[TESTSIZE]={ + 0,1,-2,3,4,-5,6,7,8,9, + 8,-2,7,-1,4,6,8,3,1,-9, + 10,11,12,13,14,15,26,17,18,19, + 30,-25,-30,-1,-5,-32,4,3,-2,0}; + +static_codebook *testlist[]={&_vq_book_lsp20_0, + &_vq_book_res0a_13,NULL}; +float *testvec[]={test1,test3}; + +int main(){ + oggpack_buffer write; + oggpack_buffer read; + long ptr=0,i; + oggpack_writeinit(&write); + + fprintf(stderr,"Testing codebook abstraction...:\n"); + + while(testlist[ptr]){ + codebook c; + static_codebook s; + float *qv=alloca(sizeof(*qv)*TESTSIZE); + float *iv=alloca(sizeof(*iv)*TESTSIZE); + memcpy(qv,testvec[ptr],sizeof(*qv)*TESTSIZE); + memset(iv,0,sizeof(*iv)*TESTSIZE); + + fprintf(stderr,"\tpacking/coding %ld... ",ptr); + + /* pack the codebook, write the testvector */ + oggpack_reset(&write); + vorbis_book_init_encode(&c,testlist[ptr]); /* get it into memory + we can write */ + vorbis_staticbook_pack(testlist[ptr],&write); + fprintf(stderr,"Codebook size %ld bytes... ",oggpack_bytes(&write)); + for(i=0;i.000001){ + fprintf(stderr,"read (%g) != written (%g) at position (%ld)\n", + iv[i],qv[i],i); + exit(1); + } + + fprintf(stderr,"OK\n"); + ptr++; + } + + /* The above is the trivial stuff; now try unquantizing a log scale codebook */ + + exit(0); +} + +#endif diff --git a/Libraries/Vorbis/Files/lib/codebook.h b/Libraries/Vorbis/Files/lib/codebook.h new file mode 100644 index 000000000..1aa2df0b9 --- /dev/null +++ b/Libraries/Vorbis/Files/lib/codebook.h @@ -0,0 +1,160 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * + * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * + * by the XIPHOPHORUS Company http://www.xiph.org/ * + * * + ******************************************************************** + + function: basic shared codebook operations + last mod: $Id$ + + ********************************************************************/ + +#ifndef _V_CODEBOOK_H_ +#define _V_CODEBOOK_H_ + +#include + +/* This structure encapsulates huffman and VQ style encoding books; it + doesn't do anything specific to either. + + valuelist/quantlist are nonNULL (and q_* significant) only if + there's entry->value mapping to be done. + + If encode-side mapping must be done (and thus the entry needs to be + hunted), the auxiliary encode pointer will point to a decision + tree. This is true of both VQ and huffman, but is mostly useful + with VQ. + +*/ + +typedef struct static_codebook{ + long dim; /* codebook dimensions (elements per vector) */ + long entries; /* codebook entries */ + long *lengthlist; /* codeword lengths in bits */ + + /* mapping ***************************************************************/ + int maptype; /* 0=none + 1=implicitly populated values from map column + 2=listed arbitrary values */ + + /* The below does a linear, single monotonic sequence mapping. */ + long q_min; /* packed 32 bit float; quant value 0 maps to minval */ + long q_delta; /* packed 32 bit float; val 1 - val 0 == delta */ + int q_quant; /* bits: 0 < quant <= 16 */ + int q_sequencep; /* bitflag */ + + long *quantlist; /* map == 1: (int)(entries^(1/dim)) element column map + map == 2: list of dim*entries quantized entry vals + */ + + /* encode helpers ********************************************************/ + struct encode_aux_nearestmatch *nearest_tree; + struct encode_aux_threshmatch *thresh_tree; + struct encode_aux_pigeonhole *pigeon_tree; + + int allocedp; +} static_codebook; + +/* this structures an arbitrary trained book to quickly find the + nearest cell match */ +typedef struct encode_aux_nearestmatch{ + /* pre-calculated partitioning tree */ + long *ptr0; + long *ptr1; + + long *p; /* decision points (each is an entry) */ + long *q; /* decision points (each is an entry) */ + long aux; /* number of tree entries */ + long alloc; +} encode_aux_nearestmatch; + +/* assumes a maptype of 1; encode side only, so that's OK */ +typedef struct encode_aux_threshmatch{ + float *quantthresh; + long *quantmap; + int quantvals; + int threshvals; +} encode_aux_threshmatch; + +typedef struct encode_aux_pigeonhole{ + float min; + float del; + + int mapentries; + int quantvals; + long *pigeonmap; + + long fittotal; + long *fitlist; + long *fitmap; + long *fitlength; +} encode_aux_pigeonhole; + +typedef struct codebook{ + long dim; /* codebook dimensions (elements per vector) */ + long entries; /* codebook entries */ + long used_entries; /* populated codebook entries */ + const static_codebook *c; + + /* for encode, the below are entry-ordered, fully populated */ + /* for decode, the below are ordered by bitreversed codeword and only + used entries are populated */ + float *valuelist; /* list of dim*entries actual entry values */ + ogg_uint32_t *codelist; /* list of bitstream codewords for each entry */ + + int *dec_index; /* only used if sparseness collapsed */ + char *dec_codelengths; + ogg_uint32_t *dec_firsttable; + int dec_firsttablen; + int dec_maxlength; + +} codebook; + +extern void vorbis_staticbook_clear(static_codebook *b); +extern void vorbis_staticbook_destroy(static_codebook *b); +extern int vorbis_book_init_encode(codebook *dest,const static_codebook *source); +extern int vorbis_book_init_decode(codebook *dest,const static_codebook *source); +extern void vorbis_book_clear(codebook *b); + +extern float *_book_unquantize(const static_codebook *b,int n,int *map); +extern float *_book_logdist(const static_codebook *b,float *vals); +extern float _float32_unpack(long val); +extern long _float32_pack(float val); +extern int _best(codebook *book, float *a, int step); +extern int _ilog(unsigned int v); +extern long _book_maptype1_quantvals(const static_codebook *b); + +extern int vorbis_book_besterror(codebook *book,float *a,int step,int addmul); +extern long vorbis_book_codeword(codebook *book,int entry); +extern long vorbis_book_codelen(codebook *book,int entry); + + + +extern int vorbis_staticbook_pack(const static_codebook *c,oggpack_buffer *b); +extern int vorbis_staticbook_unpack(oggpack_buffer *b,static_codebook *c); + +extern int vorbis_book_encode(codebook *book, int a, oggpack_buffer *b); +extern int vorbis_book_errorv(codebook *book, float *a); +extern int vorbis_book_encodev(codebook *book, int best,float *a, + oggpack_buffer *b); + +extern long vorbis_book_decode(codebook *book, oggpack_buffer *b); +extern long vorbis_book_decodevs_add(codebook *book, float *a, + oggpack_buffer *b,int n); +extern long vorbis_book_decodev_set(codebook *book, float *a, + oggpack_buffer *b,int n); +extern long vorbis_book_decodev_add(codebook *book, float *a, + oggpack_buffer *b,int n); +extern long vorbis_book_decodevv_add(codebook *book, float **a, + long off,int ch, + oggpack_buffer *b,int n); + + + +#endif diff --git a/Libraries/Vorbis/Files/lib/codec_internal.h b/Libraries/Vorbis/Files/lib/codec_internal.h new file mode 100644 index 000000000..39970c537 --- /dev/null +++ b/Libraries/Vorbis/Files/lib/codec_internal.h @@ -0,0 +1,137 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * + * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * + * by the XIPHOPHORUS Company http://www.xiph.org/ * + * * + ******************************************************************** + + function: libvorbis codec headers + last mod: $Id$ + + ********************************************************************/ + +#ifndef _V_CODECI_H_ +#define _V_CODECI_H_ + +#include "envelope.h" +#include "codebook.h" + +#define BLOCKTYPE_IMPULSE 0 +#define BLOCKTYPE_PADDING 1 +#define BLOCKTYPE_TRANSITION 0 +#define BLOCKTYPE_LONG 1 + +#define PACKETBLOBS 15 + +typedef struct vorbis_block_internal{ + float **pcmdelay; /* this is a pointer into local storage */ + float ampmax; + int blocktype; + + oggpack_buffer *packetblob[PACKETBLOBS]; /* initialized, must be freed; + blob [PACKETBLOBS/2] points to + the oggpack_buffer in the + main vorbis_block */ +} vorbis_block_internal; + +typedef void vorbis_look_floor; +typedef void vorbis_look_residue; +typedef void vorbis_look_transform; + +/* mode ************************************************************/ +typedef struct { + int blockflag; + int windowtype; + int transformtype; + int mapping; +} vorbis_info_mode; + +typedef void vorbis_info_floor; +typedef void vorbis_info_residue; +typedef void vorbis_info_mapping; + +#include "psy.h" +#include "bitrate.h" + +typedef struct private_state { + /* local lookup storage */ + envelope_lookup *ve; /* envelope lookup */ + int window[2]; + vorbis_look_transform **transform[2]; /* block, type */ + drft_lookup fft_look[2]; + + int modebits; + vorbis_look_floor **flr; + vorbis_look_residue **residue; + vorbis_look_psy *psy; + vorbis_look_psy_global *psy_g_look; + + /* local storage, only used on the encoding side. This way the + application does not need to worry about freeing some packets' + memory and not others'; packet storage is always tracked. + Cleared next call to a _dsp_ function */ + unsigned char *header; + unsigned char *header1; + unsigned char *header2; + + bitrate_manager_state bms; + + ogg_int64_t sample_count; +} private_state; + +/* codec_setup_info contains all the setup information specific to the + specific compression/decompression mode in progress (eg, + psychoacoustic settings, channel setup, options, codebook + etc). +*********************************************************************/ + +#include "highlevel.h" +typedef struct codec_setup_info { + + /* Vorbis supports only short and long blocks, but allows the + encoder to choose the sizes */ + + long blocksizes[2]; + + /* modes are the primary means of supporting on-the-fly different + blocksizes, different channel mappings (LR or M/A), + different residue backends, etc. Each mode consists of a + blocksize flag and a mapping (along with the mapping setup */ + + int modes; + int maps; + int floors; + int residues; + int books; + int psys; /* encode only */ + + vorbis_info_mode *mode_param[64]; + int map_type[64]; + vorbis_info_mapping *map_param[64]; + int floor_type[64]; + vorbis_info_floor *floor_param[64]; + int residue_type[64]; + vorbis_info_residue *residue_param[64]; + static_codebook *book_param[256]; + codebook *fullbooks; + + vorbis_info_psy *psy_param[4]; /* encode only */ + vorbis_info_psy_global psy_g_param; + + bitrate_manager_info bi; + highlevel_encode_setup hi; /* used only by vorbisenc.c. It's a + highly redundant structure, but + improves clarity of program flow. */ + int halfrate_flag; /* painless downsample for decode */ +} codec_setup_info; + +extern vorbis_look_psy_global *_vp_global_look(vorbis_info *vi); +extern void _vp_global_free(vorbis_look_psy_global *look); + +#endif + diff --git a/Libraries/Vorbis/Files/lib/envelope.c b/Libraries/Vorbis/Files/lib/envelope.c new file mode 100644 index 000000000..fb82f357f --- /dev/null +++ b/Libraries/Vorbis/Files/lib/envelope.c @@ -0,0 +1,382 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * + * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * + * by the XIPHOPHORUS Company http://www.xiph.org/ * + * * + ******************************************************************** + + function: PCM data envelope analysis + last mod: $Id$ + + ********************************************************************/ + +#include +#include +#include +#include +#include +#include "vorbis/codec.h" +#include "codec_internal.h" + +#include "os.h" +#include "scales.h" +#include "envelope.h" +#include "mdct.h" +#include "misc.h" + +void _ve_envelope_init(envelope_lookup *e,vorbis_info *vi){ + codec_setup_info *ci=vi->codec_setup; + vorbis_info_psy_global *gi=&ci->psy_g_param; + int ch=vi->channels; + int i,j; + int n=e->winlength=128; + e->searchstep=64; /* not random */ + + e->minenergy=gi->preecho_minenergy; + e->ch=ch; + e->storage=128; + e->cursor=ci->blocksizes[1]/2; + e->mdct_win=_ogg_calloc(n,sizeof(*e->mdct_win)); + mdct_init(&e->mdct,n); + + for(i=0;imdct_win[i]=sin(i/(n-1.)*M_PI); + e->mdct_win[i]*=e->mdct_win[i]; + } + + /* magic follows */ + e->band[0].begin=2; e->band[0].end=4; + e->band[1].begin=4; e->band[1].end=5; + e->band[2].begin=6; e->band[2].end=6; + e->band[3].begin=9; e->band[3].end=8; + e->band[4].begin=13; e->band[4].end=8; + e->band[5].begin=17; e->band[5].end=8; + e->band[6].begin=22; e->band[6].end=8; + + for(j=0;jband[j].end; + e->band[j].window=_ogg_malloc(n*sizeof(*e->band[0].window)); + for(i=0;iband[j].window[i]=sin((i+.5)/n*M_PI); + e->band[j].total+=e->band[j].window[i]; + } + e->band[j].total=1./e->band[j].total; + } + + e->filter=_ogg_calloc(VE_BANDS*ch,sizeof(*e->filter)); + e->mark=_ogg_calloc(e->storage,sizeof(*e->mark)); + +} + +void _ve_envelope_clear(envelope_lookup *e){ + int i; + mdct_clear(&e->mdct); + for(i=0;iband[i].window); + _ogg_free(e->mdct_win); + _ogg_free(e->filter); + _ogg_free(e->mark); + memset(e,0,sizeof(*e)); +} + +/* fairly straight threshhold-by-band based until we find something + that works better and isn't patented. */ + +static int _ve_amp(envelope_lookup *ve, + vorbis_info_psy_global *gi, + float *data, + envelope_band *bands, + envelope_filter_state *filters, + long pos){ + long n=ve->winlength; + int ret=0; + long i,j; + float decay; + + /* we want to have a 'minimum bar' for energy, else we're just + basing blocks on quantization noise that outweighs the signal + itself (for low power signals) */ + + float minV=ve->minenergy; + float *vec=alloca(n*sizeof(*vec)); + + /* stretch is used to gradually lengthen the number of windows + considered prevoius-to-potential-trigger */ + int stretch=max(VE_MINSTRETCH,ve->stretch/2); + float penalty=gi->stretch_penalty-(ve->stretch/2-VE_MINSTRETCH); + if(penalty<0.f)penalty=0.f; + if(penalty>gi->stretch_penalty)penalty=gi->stretch_penalty; + + /*_analysis_output_always("lpcm",seq2,data,n,0,0, + totalshift+pos*ve->searchstep);*/ + + /* window and transform */ + for(i=0;imdct_win[i]; + mdct_forward(&ve->mdct,vec,vec); + + /*_analysis_output_always("mdct",seq2,vec,n/2,0,1,0); */ + + /* near-DC spreading function; this has nothing to do with + psychoacoustics, just sidelobe leakage and window size */ + { + float temp=vec[0]*vec[0]+.7*vec[1]*vec[1]+.2*vec[2]*vec[2]; + int ptr=filters->nearptr; + + /* the accumulation is regularly refreshed from scratch to avoid + floating point creep */ + if(ptr==0){ + decay=filters->nearDC_acc=filters->nearDC_partialacc+temp; + filters->nearDC_partialacc=temp; + }else{ + decay=filters->nearDC_acc+=temp; + filters->nearDC_partialacc+=temp; + } + filters->nearDC_acc-=filters->nearDC[ptr]; + filters->nearDC[ptr]=temp; + + decay*=(1./(VE_NEARDC+1)); + filters->nearptr++; + if(filters->nearptr>=VE_NEARDC)filters->nearptr=0; + decay=todB(&decay)*.5-15.f; + } + + /* perform spreading and limiting, also smooth the spectrum. yes, + the MDCT results in all real coefficients, but it still *behaves* + like real/imaginary pairs */ + for(i=0;i>1]=val; + decay-=8.; + } + + /*_analysis_output_always("spread",seq2++,vec,n/4,0,0,0);*/ + + /* perform preecho/postecho triggering by band */ + for(j=0;j=VE_AMP)filters[j].ampptr=0; + } + + /* look at min/max, decide trigger */ + if(valmax>gi->preecho_thresh[j]+penalty){ + ret|=1; + ret|=4; + } + if(valminpostecho_thresh[j]-penalty)ret|=2; + } + + return(ret); +} + +#if 0 +static int seq=0; +static ogg_int64_t totalshift=-1024; +#endif + +long _ve_envelope_search(vorbis_dsp_state *v){ + vorbis_info *vi=v->vi; + codec_setup_info *ci=vi->codec_setup; + vorbis_info_psy_global *gi=&ci->psy_g_param; + envelope_lookup *ve=((private_state *)(v->backend_state))->ve; + long i,j; + + int first=ve->current/ve->searchstep; + int last=v->pcm_current/ve->searchstep-VE_WIN; + if(first<0)first=0; + + /* make sure we have enough storage to match the PCM */ + if(last+VE_WIN+VE_POST>ve->storage){ + ve->storage=last+VE_WIN+VE_POST; /* be sure */ + ve->mark=_ogg_realloc(ve->mark,ve->storage*sizeof(*ve->mark)); + } + + for(j=first;jstretch++; + if(ve->stretch>VE_MAXSTRETCH*2) + ve->stretch=VE_MAXSTRETCH*2; + + for(i=0;ich;i++){ + float *pcm=v->pcm[i]+ve->searchstep*(j); + ret|=_ve_amp(ve,gi,pcm,ve->band,ve->filter+i*VE_BANDS,j); + } + + ve->mark[j+VE_POST]=0; + if(ret&1){ + ve->mark[j]=1; + ve->mark[j+1]=1; + } + + if(ret&2){ + ve->mark[j]=1; + if(j>0)ve->mark[j-1]=1; + } + + if(ret&4)ve->stretch=-1; + } + + ve->current=last*ve->searchstep; + + { + long centerW=v->centerW; + long testW= + centerW+ + ci->blocksizes[v->W]/4+ + ci->blocksizes[1]/2+ + ci->blocksizes[0]/4; + + j=ve->cursor; + + while(jcurrent-(ve->searchstep)){/* account for postecho + working back one window */ + if(j>=testW)return(1); + + ve->cursor=j; + + if(ve->mark[j/ve->searchstep]){ + if(j>centerW){ + +#if 0 + if(j>ve->curmark){ + float *marker=alloca(v->pcm_current*sizeof(*marker)); + int l,m; + memset(marker,0,sizeof(*marker)*v->pcm_current); + fprintf(stderr,"mark! seq=%d, cursor:%fs time:%fs\n", + seq, + (totalshift+ve->cursor)/44100., + (totalshift+j)/44100.); + _analysis_output_always("pcmL",seq,v->pcm[0],v->pcm_current,0,0,totalshift); + _analysis_output_always("pcmR",seq,v->pcm[1],v->pcm_current,0,0,totalshift); + + _analysis_output_always("markL",seq,v->pcm[0],j,0,0,totalshift); + _analysis_output_always("markR",seq,v->pcm[1],j,0,0,totalshift); + + for(m=0;msearchstep]=ve->filter[m].markers[l]*.1; + _analysis_output_always(buf,seq,marker,v->pcm_current,0,0,totalshift); + } + + for(m=0;msearchstep]=ve->filter[m+VE_BANDS].markers[l]*.1; + _analysis_output_always(buf,seq,marker,v->pcm_current,0,0,totalshift); + } + + for(l=0;lsearchstep]=ve->mark[l]*.4; + _analysis_output_always("mark",seq,marker,v->pcm_current,0,0,totalshift); + + + seq++; + + } +#endif + + ve->curmark=j; + if(j>=testW)return(1); + return(0); + } + } + j+=ve->searchstep; + } + } + + return(-1); +} + +int _ve_envelope_mark(vorbis_dsp_state *v){ + envelope_lookup *ve=((private_state *)(v->backend_state))->ve; + vorbis_info *vi=v->vi; + codec_setup_info *ci=vi->codec_setup; + long centerW=v->centerW; + long beginW=centerW-ci->blocksizes[v->W]/4; + long endW=centerW+ci->blocksizes[v->W]/4; + if(v->W){ + beginW-=ci->blocksizes[v->lW]/4; + endW+=ci->blocksizes[v->nW]/4; + }else{ + beginW-=ci->blocksizes[0]/4; + endW+=ci->blocksizes[0]/4; + } + + if(ve->curmark>=beginW && ve->curmarksearchstep; + long last=endW/ve->searchstep; + long i; + for(i=first;imark[i])return(1); + } + return(0); +} + +void _ve_envelope_shift(envelope_lookup *e,long shift){ + int smallsize=e->current/e->searchstep+VE_POST; /* adjust for placing marks + ahead of ve->current */ + int smallshift=shift/e->searchstep; + + memmove(e->mark,e->mark+smallshift,(smallsize-smallshift)*sizeof(*e->mark)); + +#if 0 + for(i=0;ich;i++) + memmove(e->filter[i].markers, + e->filter[i].markers+smallshift, + (1024-smallshift)*sizeof(*(*e->filter).markers)); + totalshift+=shift; +#endif + + e->current-=shift; + if(e->curmark>=0) + e->curmark-=shift; + e->cursor-=shift; +} + + + + + + diff --git a/Libraries/Vorbis/Files/lib/envelope.h b/Libraries/Vorbis/Files/lib/envelope.h new file mode 100644 index 000000000..3087c80fb --- /dev/null +++ b/Libraries/Vorbis/Files/lib/envelope.h @@ -0,0 +1,81 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * + * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * + * by the XIPHOPHORUS Company http://www.xiph.org/ * + * * + ******************************************************************** + + function: PCM data envelope analysis and manipulation + last mod: $Id$ + + ********************************************************************/ + +#ifndef _V_ENVELOPE_ +#define _V_ENVELOPE_ + +#include "mdct.h" + +#define VE_PRE 16 +#define VE_WIN 4 +#define VE_POST 2 +#define VE_AMP (VE_PRE+VE_POST-1) + +#define VE_BANDS 7 +#define VE_NEARDC 15 + +#define VE_MINSTRETCH 2 /* a bit less than short block */ +#define VE_MAXSTRETCH 12 /* one-third full block */ + +typedef struct { + float ampbuf[VE_AMP]; + int ampptr; + + float nearDC[VE_NEARDC]; + float nearDC_acc; + float nearDC_partialacc; + int nearptr; + +} envelope_filter_state; + +typedef struct { + int begin; + int end; + float *window; + float total; +} envelope_band; + +typedef struct { + int ch; + int winlength; + int searchstep; + float minenergy; + + mdct_lookup mdct; + float *mdct_win; + + envelope_band band[VE_BANDS]; + envelope_filter_state *filter; + int stretch; + + int *mark; + + long storage; + long current; + long curmark; + long cursor; +} envelope_lookup; + +extern void _ve_envelope_init(envelope_lookup *e,vorbis_info *vi); +extern void _ve_envelope_clear(envelope_lookup *e); +extern long _ve_envelope_search(vorbis_dsp_state *v); +extern void _ve_envelope_shift(envelope_lookup *e,long shift); +extern int _ve_envelope_mark(vorbis_dsp_state *v); + + +#endif + diff --git a/Libraries/Vorbis/Files/lib/floor0.c b/Libraries/Vorbis/Files/lib/floor0.c new file mode 100644 index 000000000..512490c48 --- /dev/null +++ b/Libraries/Vorbis/Files/lib/floor0.c @@ -0,0 +1,223 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * + * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * + * by the XIPHOPHORUS Company http://www.xiph.org/ * + * * + ******************************************************************** + + function: floor backend 0 implementation + last mod: $Id$ + + ********************************************************************/ + +#include +#include +#include +#include +#include "vorbis/codec.h" +#include "codec_internal.h" +#include "registry.h" +#include "lpc.h" +#include "lsp.h" +#include "codebook.h" +#include "scales.h" +#include "misc.h" +#include "os.h" + +#include "misc.h" +#include + +typedef struct { + int ln; + int m; + int **linearmap; + int n[2]; + + vorbis_info_floor0 *vi; + + long bits; + long frames; +} vorbis_look_floor0; + + +/***********************************************/ + +static void floor0_free_info(vorbis_info_floor *i){ + vorbis_info_floor0 *info=(vorbis_info_floor0 *)i; + if(info){ + memset(info,0,sizeof(*info)); + _ogg_free(info); + } +} + +static void floor0_free_look(vorbis_look_floor *i){ + vorbis_look_floor0 *look=(vorbis_look_floor0 *)i; + if(look){ + + if(look->linearmap){ + + if(look->linearmap[0])_ogg_free(look->linearmap[0]); + if(look->linearmap[1])_ogg_free(look->linearmap[1]); + + _ogg_free(look->linearmap); + } + memset(look,0,sizeof(*look)); + _ogg_free(look); + } +} + +static vorbis_info_floor *floor0_unpack (vorbis_info *vi,oggpack_buffer *opb){ + codec_setup_info *ci=vi->codec_setup; + int j; + + vorbis_info_floor0 *info=_ogg_malloc(sizeof(*info)); + info->order=oggpack_read(opb,8); + info->rate=oggpack_read(opb,16); + info->barkmap=oggpack_read(opb,16); + info->ampbits=oggpack_read(opb,6); + info->ampdB=oggpack_read(opb,8); + info->numbooks=oggpack_read(opb,4)+1; + + if(info->order<1)goto err_out; + if(info->rate<1)goto err_out; + if(info->barkmap<1)goto err_out; + if(info->numbooks<1)goto err_out; + + for(j=0;jnumbooks;j++){ + info->books[j]=oggpack_read(opb,8); + if(info->books[j]<0 || info->books[j]>=ci->books)goto err_out; + } + return(info); + + err_out: + floor0_free_info(info); + return(NULL); +} + +/* initialize Bark scale and normalization lookups. We could do this + with static tables, but Vorbis allows a number of possible + combinations, so it's best to do it computationally. + + The below is authoritative in terms of defining scale mapping. + Note that the scale depends on the sampling rate as well as the + linear block and mapping sizes */ + +static void floor0_map_lazy_init(vorbis_block *vb, + vorbis_info_floor *infoX, + vorbis_look_floor0 *look){ + if(!look->linearmap[vb->W]){ + vorbis_dsp_state *vd=vb->vd; + vorbis_info *vi=vd->vi; + codec_setup_info *ci=vi->codec_setup; + vorbis_info_floor0 *info=(vorbis_info_floor0 *)infoX; + int W=vb->W; + int n=ci->blocksizes[W]/2,j; + + /* we choose a scaling constant so that: + floor(bark(rate/2-1)*C)=mapped-1 + floor(bark(rate/2)*C)=mapped */ + float scale=look->ln/toBARK(info->rate/2.f); + + /* the mapping from a linear scale to a smaller bark scale is + straightforward. We do *not* make sure that the linear mapping + does not skip bark-scale bins; the decoder simply skips them and + the encoder may do what it wishes in filling them. They're + necessary in some mapping combinations to keep the scale spacing + accurate */ + look->linearmap[W]=_ogg_malloc((n+1)*sizeof(**look->linearmap)); + for(j=0;jrate/2.f)/n*j) + *scale); /* bark numbers represent band edges */ + if(val>=look->ln)val=look->ln-1; /* guard against the approximation */ + look->linearmap[W][j]=val; + } + look->linearmap[W][j]=-1; + look->n[W]=n; + } +} + +static vorbis_look_floor *floor0_look(vorbis_dsp_state *vd, + vorbis_info_floor *i){ + vorbis_info_floor0 *info=(vorbis_info_floor0 *)i; + vorbis_look_floor0 *look=_ogg_calloc(1,sizeof(*look)); + look->m=info->order; + look->ln=info->barkmap; + look->vi=info; + + look->linearmap=_ogg_calloc(2,sizeof(*look->linearmap)); + + return look; +} + +static void *floor0_inverse1(vorbis_block *vb,vorbis_look_floor *i){ + vorbis_look_floor0 *look=(vorbis_look_floor0 *)i; + vorbis_info_floor0 *info=look->vi; + int j,k; + + int ampraw=oggpack_read(&vb->opb,info->ampbits); + if(ampraw>0){ /* also handles the -1 out of data case */ + long maxval=(1<ampbits)-1; + float amp=(float)ampraw/maxval*info->ampdB; + int booknum=oggpack_read(&vb->opb,_ilog(info->numbooks)); + + if(booknum!=-1 && booknumnumbooks){ /* be paranoid */ + codec_setup_info *ci=vb->vd->vi->codec_setup; + codebook *b=ci->fullbooks+info->books[booknum]; + float last=0.f; + + /* the additional b->dim is a guard against any possible stack + smash; b->dim is provably more than we can overflow the + vector */ + float *lsp=_vorbis_block_alloc(vb,sizeof(*lsp)*(look->m+b->dim+1)); + + for(j=0;jm;j+=b->dim) + if(vorbis_book_decodev_set(b,lsp+j,&vb->opb,b->dim)==-1)goto eop; + for(j=0;jm;){ + for(k=0;kdim;k++,j++)lsp[j]+=last; + last=lsp[j-1]; + } + + lsp[look->m]=amp; + return(lsp); + } + } + eop: + return(NULL); +} + +static int floor0_inverse2(vorbis_block *vb,vorbis_look_floor *i, + void *memo,float *out){ + vorbis_look_floor0 *look=(vorbis_look_floor0 *)i; + vorbis_info_floor0 *info=look->vi; + + floor0_map_lazy_init(vb,info,look); + + if(memo){ + float *lsp=(float *)memo; + float amp=lsp[look->m]; + + /* take the coefficients back to a spectral envelope curve */ + vorbis_lsp_to_curve(out, + look->linearmap[vb->W], + look->n[vb->W], + look->ln, + lsp,look->m,amp,(float)info->ampdB); + return(1); + } + memset(out,0,sizeof(*out)*look->n[vb->W]); + return(0); +} + +/* export hooks */ +vorbis_func_floor floor0_exportbundle={ + NULL,&floor0_unpack,&floor0_look,&floor0_free_info, + &floor0_free_look,&floor0_inverse1,&floor0_inverse2 +}; + + + diff --git a/Libraries/Vorbis/Files/lib/floor1.c b/Libraries/Vorbis/Files/lib/floor1.c new file mode 100644 index 000000000..9d1c27f1a --- /dev/null +++ b/Libraries/Vorbis/Files/lib/floor1.c @@ -0,0 +1,1090 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * + * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * + * by the XIPHOPHORUS Company http://www.xiph.org/ * + * * + ******************************************************************** + + function: floor backend 1 implementation + last mod: $Id$ + + ********************************************************************/ + +#include +#include +#include +#include +#include "vorbis/codec.h" +#include "codec_internal.h" +#include "registry.h" +#include "codebook.h" +#include "misc.h" +#include "scales.h" + +#include + +#define floor1_rangedB 140 /* floor 1 fixed at -140dB to 0dB range */ + +typedef struct { + int sorted_index[VIF_POSIT+2]; + int forward_index[VIF_POSIT+2]; + int reverse_index[VIF_POSIT+2]; + + int hineighbor[VIF_POSIT]; + int loneighbor[VIF_POSIT]; + int posts; + + int n; + int quant_q; + vorbis_info_floor1 *vi; + + long phrasebits; + long postbits; + long frames; +} vorbis_look_floor1; + +typedef struct lsfit_acc{ + long x0; + long x1; + + long xa; + long ya; + long x2a; + long y2a; + long xya; + long an; +} lsfit_acc; + +/***********************************************/ + +static void floor1_free_info(vorbis_info_floor *i){ + vorbis_info_floor1 *info=(vorbis_info_floor1 *)i; + if(info){ + memset(info,0,sizeof(*info)); + _ogg_free(info); + } +} + +static void floor1_free_look(vorbis_look_floor *i){ + vorbis_look_floor1 *look=(vorbis_look_floor1 *)i; + if(look){ + /*fprintf(stderr,"floor 1 bit usage %f:%f (%f total)\n", + (float)look->phrasebits/look->frames, + (float)look->postbits/look->frames, + (float)(look->postbits+look->phrasebits)/look->frames);*/ + + memset(look,0,sizeof(*look)); + _ogg_free(look); + } +} + +static int ilog(unsigned int v){ + int ret=0; + while(v){ + ret++; + v>>=1; + } + return(ret); +} + +static int ilog2(unsigned int v){ + int ret=0; + if(v)--v; + while(v){ + ret++; + v>>=1; + } + return(ret); +} + +static void floor1_pack (vorbis_info_floor *i,oggpack_buffer *opb){ + vorbis_info_floor1 *info=(vorbis_info_floor1 *)i; + int j,k; + int count=0; + int rangebits; + int maxposit=info->postlist[1]; + int maxclass=-1; + + /* save out partitions */ + oggpack_write(opb,info->partitions,5); /* only 0 to 31 legal */ + for(j=0;jpartitions;j++){ + oggpack_write(opb,info->partitionclass[j],4); /* only 0 to 15 legal */ + if(maxclasspartitionclass[j])maxclass=info->partitionclass[j]; + } + + /* save out partition classes */ + for(j=0;jclass_dim[j]-1,3); /* 1 to 8 */ + oggpack_write(opb,info->class_subs[j],2); /* 0 to 3 */ + if(info->class_subs[j])oggpack_write(opb,info->class_book[j],8); + for(k=0;k<(1<class_subs[j]);k++) + oggpack_write(opb,info->class_subbook[j][k]+1,8); + } + + /* save out the post list */ + oggpack_write(opb,info->mult-1,2); /* only 1,2,3,4 legal now */ + oggpack_write(opb,ilog2(maxposit),4); + rangebits=ilog2(maxposit); + + for(j=0,k=0;jpartitions;j++){ + count+=info->class_dim[info->partitionclass[j]]; + for(;kpostlist[k+2],rangebits); + } +} + + +static vorbis_info_floor *floor1_unpack (vorbis_info *vi,oggpack_buffer *opb){ + codec_setup_info *ci=vi->codec_setup; + int j,k,count=0,maxclass=-1,rangebits; + + vorbis_info_floor1 *info=_ogg_calloc(1,sizeof(*info)); + /* read partitions */ + info->partitions=oggpack_read(opb,5); /* only 0 to 31 legal */ + for(j=0;jpartitions;j++){ + info->partitionclass[j]=oggpack_read(opb,4); /* only 0 to 15 legal */ + if(maxclasspartitionclass[j])maxclass=info->partitionclass[j]; + } + + /* read partition classes */ + for(j=0;jclass_dim[j]=oggpack_read(opb,3)+1; /* 1 to 8 */ + info->class_subs[j]=oggpack_read(opb,2); /* 0,1,2,3 bits */ + if(info->class_subs[j]<0) + goto err_out; + if(info->class_subs[j])info->class_book[j]=oggpack_read(opb,8); + if(info->class_book[j]<0 || info->class_book[j]>=ci->books) + goto err_out; + for(k=0;k<(1<class_subs[j]);k++){ + info->class_subbook[j][k]=oggpack_read(opb,8)-1; + if(info->class_subbook[j][k]<-1 || info->class_subbook[j][k]>=ci->books) + goto err_out; + } + } + + /* read the post list */ + info->mult=oggpack_read(opb,2)+1; /* only 1,2,3,4 legal now */ + rangebits=oggpack_read(opb,4); + + for(j=0,k=0;jpartitions;j++){ + count+=info->class_dim[info->partitionclass[j]]; + for(;kpostlist[k+2]=oggpack_read(opb,rangebits); + if(t<0 || t>=(1<postlist[0]=0; + info->postlist[1]=1<vi=info; + look->n=info->postlist[1]; + + /* we drop each position value in-between already decoded values, + and use linear interpolation to predict each new value past the + edges. The positions are read in the order of the position + list... we precompute the bounding positions in the lookup. Of + course, the neighbors can change (if a position is declined), but + this is an initial mapping */ + + for(i=0;ipartitions;i++)n+=info->class_dim[info->partitionclass[i]]; + n+=2; + look->posts=n; + + /* also store a sorted position index */ + for(i=0;ipostlist+i; + qsort(sortpointer,n,sizeof(*sortpointer),icomp); + + /* points from sort order back to range number */ + for(i=0;iforward_index[i]=sortpointer[i]-info->postlist; + /* points from range order to sorted position */ + for(i=0;ireverse_index[look->forward_index[i]]=i; + /* we actually need the post values too */ + for(i=0;isorted_index[i]=info->postlist[look->forward_index[i]]; + + /* quantize values to multiplier spec */ + switch(info->mult){ + case 1: /* 1024 -> 256 */ + look->quant_q=256; + break; + case 2: /* 1024 -> 128 */ + look->quant_q=128; + break; + case 3: /* 1024 -> 86 */ + look->quant_q=86; + break; + case 4: /* 1024 -> 64 */ + look->quant_q=64; + break; + } + + /* discover our neighbors for decode where we don't use fit flags + (that would push the neighbors outward) */ + for(i=0;in; + int currentx=info->postlist[i+2]; + for(j=0;jpostlist[j]; + if(x>lx && xcurrentx){ + hi=j; + hx=x; + } + } + look->loneighbor[i]=lo; + look->hineighbor[i]=hi; + } + + return(look); +} + +static int render_point(int x0,int x1,int y0,int y1,int x){ + y0&=0x7fff; /* mask off flag */ + y1&=0x7fff; + + { + int dy=y1-y0; + int adx=x1-x0; + int ady=abs(dy); + int err=ady*(x-x0); + + int off=err/adx; + if(dy<0)return(y0-off); + return(y0+off); + } +} + +static int vorbis_dBquant(const float *x){ + int i= *x*7.3142857f+1023.5f; + if(i>1023)return(1023); + if(i<0)return(0); + return i; +} + +static float FLOOR1_fromdB_LOOKUP[256]={ + 1.0649863e-07F, 1.1341951e-07F, 1.2079015e-07F, 1.2863978e-07F, + 1.3699951e-07F, 1.4590251e-07F, 1.5538408e-07F, 1.6548181e-07F, + 1.7623575e-07F, 1.8768855e-07F, 1.9988561e-07F, 2.128753e-07F, + 2.2670913e-07F, 2.4144197e-07F, 2.5713223e-07F, 2.7384213e-07F, + 2.9163793e-07F, 3.1059021e-07F, 3.3077411e-07F, 3.5226968e-07F, + 3.7516214e-07F, 3.9954229e-07F, 4.2550680e-07F, 4.5315863e-07F, + 4.8260743e-07F, 5.1396998e-07F, 5.4737065e-07F, 5.8294187e-07F, + 6.2082472e-07F, 6.6116941e-07F, 7.0413592e-07F, 7.4989464e-07F, + 7.9862701e-07F, 8.5052630e-07F, 9.0579828e-07F, 9.6466216e-07F, + 1.0273513e-06F, 1.0941144e-06F, 1.1652161e-06F, 1.2409384e-06F, + 1.3215816e-06F, 1.4074654e-06F, 1.4989305e-06F, 1.5963394e-06F, + 1.7000785e-06F, 1.8105592e-06F, 1.9282195e-06F, 2.0535261e-06F, + 2.1869758e-06F, 2.3290978e-06F, 2.4804557e-06F, 2.6416497e-06F, + 2.8133190e-06F, 2.9961443e-06F, 3.1908506e-06F, 3.3982101e-06F, + 3.6190449e-06F, 3.8542308e-06F, 4.1047004e-06F, 4.3714470e-06F, + 4.6555282e-06F, 4.9580707e-06F, 5.2802740e-06F, 5.6234160e-06F, + 5.9888572e-06F, 6.3780469e-06F, 6.7925283e-06F, 7.2339451e-06F, + 7.7040476e-06F, 8.2047000e-06F, 8.7378876e-06F, 9.3057248e-06F, + 9.9104632e-06F, 1.0554501e-05F, 1.1240392e-05F, 1.1970856e-05F, + 1.2748789e-05F, 1.3577278e-05F, 1.4459606e-05F, 1.5399272e-05F, + 1.6400004e-05F, 1.7465768e-05F, 1.8600792e-05F, 1.9809576e-05F, + 2.1096914e-05F, 2.2467911e-05F, 2.3928002e-05F, 2.5482978e-05F, + 2.7139006e-05F, 2.8902651e-05F, 3.0780908e-05F, 3.2781225e-05F, + 3.4911534e-05F, 3.7180282e-05F, 3.9596466e-05F, 4.2169667e-05F, + 4.4910090e-05F, 4.7828601e-05F, 5.0936773e-05F, 5.4246931e-05F, + 5.7772202e-05F, 6.1526565e-05F, 6.5524908e-05F, 6.9783085e-05F, + 7.4317983e-05F, 7.9147585e-05F, 8.4291040e-05F, 8.9768747e-05F, + 9.5602426e-05F, 0.00010181521F, 0.00010843174F, 0.00011547824F, + 0.00012298267F, 0.00013097477F, 0.00013948625F, 0.00014855085F, + 0.00015820453F, 0.00016848555F, 0.00017943469F, 0.00019109536F, + 0.00020351382F, 0.00021673929F, 0.00023082423F, 0.00024582449F, + 0.00026179955F, 0.00027881276F, 0.00029693158F, 0.00031622787F, + 0.00033677814F, 0.00035866388F, 0.00038197188F, 0.00040679456F, + 0.00043323036F, 0.00046138411F, 0.00049136745F, 0.00052329927F, + 0.00055730621F, 0.00059352311F, 0.00063209358F, 0.00067317058F, + 0.00071691700F, 0.00076350630F, 0.00081312324F, 0.00086596457F, + 0.00092223983F, 0.00098217216F, 0.0010459992F, 0.0011139742F, + 0.0011863665F, 0.0012634633F, 0.0013455702F, 0.0014330129F, + 0.0015261382F, 0.0016253153F, 0.0017309374F, 0.0018434235F, + 0.0019632195F, 0.0020908006F, 0.0022266726F, 0.0023713743F, + 0.0025254795F, 0.0026895994F, 0.0028643847F, 0.0030505286F, + 0.0032487691F, 0.0034598925F, 0.0036847358F, 0.0039241906F, + 0.0041792066F, 0.0044507950F, 0.0047400328F, 0.0050480668F, + 0.0053761186F, 0.0057254891F, 0.0060975636F, 0.0064938176F, + 0.0069158225F, 0.0073652516F, 0.0078438871F, 0.0083536271F, + 0.0088964928F, 0.009474637F, 0.010090352F, 0.010746080F, + 0.011444421F, 0.012188144F, 0.012980198F, 0.013823725F, + 0.014722068F, 0.015678791F, 0.016697687F, 0.017782797F, + 0.018938423F, 0.020169149F, 0.021479854F, 0.022875735F, + 0.024362330F, 0.025945531F, 0.027631618F, 0.029427276F, + 0.031339626F, 0.033376252F, 0.035545228F, 0.037855157F, + 0.040315199F, 0.042935108F, 0.045725273F, 0.048696758F, + 0.051861348F, 0.055231591F, 0.058820850F, 0.062643361F, + 0.066714279F, 0.071049749F, 0.075666962F, 0.080584227F, + 0.085821044F, 0.091398179F, 0.097337747F, 0.10366330F, + 0.11039993F, 0.11757434F, 0.12521498F, 0.13335215F, + 0.14201813F, 0.15124727F, 0.16107617F, 0.17154380F, + 0.18269168F, 0.19456402F, 0.20720788F, 0.22067342F, + 0.23501402F, 0.25028656F, 0.26655159F, 0.28387361F, + 0.30232132F, 0.32196786F, 0.34289114F, 0.36517414F, + 0.38890521F, 0.41417847F, 0.44109412F, 0.46975890F, + 0.50028648F, 0.53279791F, 0.56742212F, 0.60429640F, + 0.64356699F, 0.68538959F, 0.72993007F, 0.77736504F, + 0.82788260F, 0.88168307F, 0.9389798F, 1.F, +}; + +static void render_line(int x0,int x1,int y0,int y1,float *d){ + int dy=y1-y0; + int adx=x1-x0; + int ady=abs(dy); + int base=dy/adx; + int sy=(dy<0?base-1:base+1); + int x=x0; + int y=y0; + int err=0; + + ady-=abs(base*adx); + + d[x]*=FLOOR1_fromdB_LOOKUP[y]; + while(++x=adx){ + err-=adx; + y+=sy; + }else{ + y+=base; + } + d[x]*=FLOOR1_fromdB_LOOKUP[y]; + } +} + +static void render_line0(int x0,int x1,int y0,int y1,int *d){ + int dy=y1-y0; + int adx=x1-x0; + int ady=abs(dy); + int base=dy/adx; + int sy=(dy<0?base-1:base+1); + int x=x0; + int y=y0; + int err=0; + + ady-=abs(base*adx); + + d[x]=y; + while(++x=adx){ + err-=adx; + y+=sy; + }else{ + y+=base; + } + d[x]=y; + } +} + +/* the floor has already been filtered to only include relevant sections */ +static int accumulate_fit(const float *flr,const float *mdct, + int x0, int x1,lsfit_acc *a, + int n,vorbis_info_floor1 *info){ + long i; + int quantized=vorbis_dBquant(flr+x0); + + long xa=0,ya=0,x2a=0,y2a=0,xya=0,na=0, xb=0,yb=0,x2b=0,y2b=0,xyb=0,nb=0; + + memset(a,0,sizeof(*a)); + a->x0=x0; + a->x1=x1; + if(x1>=n)x1=n-1; + + for(i=x0;i<=x1;i++){ + int quantized=vorbis_dBquant(flr+i); + if(quantized){ + if(mdct[i]+info->twofitatten>=flr[i]){ + xa += i; + ya += quantized; + x2a += i*i; + y2a += quantized*quantized; + xya += i*quantized; + na++; + }else{ + xb += i; + yb += quantized; + x2b += i*i; + y2b += quantized*quantized; + xyb += i*quantized; + nb++; + } + } + } + + xb+=xa; + yb+=ya; + x2b+=x2a; + y2b+=y2a; + xyb+=xya; + nb+=na; + + /* weight toward the actually used frequencies if we meet the threshhold */ + { + int weight=nb*info->twofitweight/(na+1); + + a->xa=xa*weight+xb; + a->ya=ya*weight+yb; + a->x2a=x2a*weight+x2b; + a->y2a=y2a*weight+y2b; + a->xya=xya*weight+xyb; + a->an=na*weight+nb; + } + + return(na); +} + +static void fit_line(lsfit_acc *a,int fits,int *y0,int *y1){ + long x=0,y=0,x2=0,y2=0,xy=0,an=0,i; + long x0=a[0].x0; + long x1=a[fits-1].x1; + + for(i=0;i=0){ + x+= x0; + y+= *y0; + x2+= x0 * x0; + y2+= *y0 * *y0; + xy+= *y0 * x0; + an++; + } + + if(*y1>=0){ + x+= x1; + y+= *y1; + x2+= x1 * x1; + y2+= *y1 * *y1; + xy+= *y1 * x1; + an++; + } + + if(an){ + /* need 64 bit multiplies, which C doesn't give portably as int */ + double fx=x; + double fy=y; + double fx2=x2; + double fxy=xy; + double denom=1./(an*fx2-fx*fx); + double a=(fy*fx2-fxy*fx)*denom; + double b=(an*fxy-fx*fy)*denom; + *y0=rint(a+b*x0); + *y1=rint(a+b*x1); + + /* limit to our range! */ + if(*y0>1023)*y0=1023; + if(*y1>1023)*y1=1023; + if(*y0<0)*y0=0; + if(*y1<0)*y1=0; + + }else{ + *y0=0; + *y1=0; + } +} + +/*static void fit_line_point(lsfit_acc *a,int fits,int *y0,int *y1){ + long y=0; + int i; + + for(i=0;itwofitatten>=mask[x]){ + if(y+info->maxovermaxunder>val)return(1); + } + + while(++x=adx){ + err-=adx; + y+=sy; + }else{ + y+=base; + } + + val=vorbis_dBquant(mask+x); + mse+=((y-val)*(y-val)); + n++; + if(mdct[x]+info->twofitatten>=mask[x]){ + if(val){ + if(y+info->maxovermaxunder>val)return(1); + } + } + } + + if(info->maxover*info->maxover/n>info->maxerr)return(0); + if(info->maxunder*info->maxunder/n>info->maxerr)return(0); + if(mse/n>info->maxerr)return(1); + return(0); +} + +static int post_Y(int *A,int *B,int pos){ + if(A[pos]<0) + return B[pos]; + if(B[pos]<0) + return A[pos]; + + return (A[pos]+B[pos])>>1; +} + +static int seq=0; + +int *floor1_fit(vorbis_block *vb,vorbis_look_floor1 *look, + const float *logmdct, /* in */ + const float *logmask){ + long i,j; + vorbis_info_floor1 *info=look->vi; + long n=look->n; + long posts=look->posts; + long nonzero=0; + lsfit_acc fits[VIF_POSIT+1]; + int fit_valueA[VIF_POSIT+2]; /* index by range list position */ + int fit_valueB[VIF_POSIT+2]; /* index by range list position */ + + int loneighbor[VIF_POSIT+2]; /* sorted index of range list position (+2) */ + int hineighbor[VIF_POSIT+2]; + int *output=NULL; + int memo[VIF_POSIT+2]; + + for(i=0;isorted_index[i], + look->sorted_index[i+1],fits+i, + n,info); + } + + if(nonzero){ + /* start by fitting the implicit base case.... */ + int y0=-200; + int y1=-200; + fit_line(fits,posts-1,&y0,&y1); + + fit_valueA[0]=y0; + fit_valueB[0]=y0; + fit_valueB[1]=y1; + fit_valueA[1]=y1; + + /* Non degenerate case */ + /* start progressive splitting. This is a greedy, non-optimal + algorithm, but simple and close enough to the best + answer. */ + for(i=2;ireverse_index[i]; + int ln=loneighbor[sortpos]; + int hn=hineighbor[sortpos]; + + /* eliminate repeat searches of a particular range with a memo */ + if(memo[ln]!=hn){ + /* haven't performed this error search yet */ + int lsortpos=look->reverse_index[ln]; + int hsortpos=look->reverse_index[hn]; + memo[ln]=hn; + + { + /* A note: we want to bound/minimize *local*, not global, error */ + int lx=info->postlist[ln]; + int hx=info->postlist[hn]; + int ly=post_Y(fit_valueA,fit_valueB,ln); + int hy=post_Y(fit_valueA,fit_valueB,hn); + + if(ly==-1 || hy==-1){ + exit(1); + } + + if(inspect_error(lx,hx,ly,hy,logmask,logmdct,info)){ + /* outside error bounds/begin search area. Split it. */ + int ly0=-200; + int ly1=-200; + int hy0=-200; + int hy1=-200; + fit_line(fits+lsortpos,sortpos-lsortpos,&ly0,&ly1); + fit_line(fits+sortpos,hsortpos-sortpos,&hy0,&hy1); + + /* store new edge values */ + fit_valueB[ln]=ly0; + if(ln==0)fit_valueA[ln]=ly0; + fit_valueA[i]=ly1; + fit_valueB[i]=hy0; + fit_valueA[hn]=hy1; + if(hn==1)fit_valueB[hn]=hy1; + + if(ly1>=0 || hy0>=0){ + /* store new neighbor values */ + for(j=sortpos-1;j>=0;j--) + if(hineighbor[j]==hn) + hineighbor[j]=i; + else + break; + for(j=sortpos+1;jloneighbor[i-2]; + int hn=look->hineighbor[i-2]; + int x0=info->postlist[ln]; + int x1=info->postlist[hn]; + int y0=output[ln]; + int y1=output[hn]; + + int predicted=render_point(x0,x1,y0,y1,info->postlist[i]); + int vx=post_Y(fit_valueA,fit_valueB,i); + + if(vx>=0 && predicted!=vx){ + output[i]=vx; + }else{ + output[i]= predicted|0x8000; + } + } + } + + return(output); + +} + +int *floor1_interpolate_fit(vorbis_block *vb,vorbis_look_floor1 *look, + int *A,int *B, + int del){ + + long i; + long posts=look->posts; + int *output=NULL; + + if(A && B){ + output=_vorbis_block_alloc(vb,sizeof(*output)*posts); + + for(i=0;i>16; + if(A[i]&0x8000 && B[i]&0x8000)output[i]|=0x8000; + } + } + + return(output); +} + + +int floor1_encode(oggpack_buffer *opb,vorbis_block *vb, + vorbis_look_floor1 *look, + int *post,int *ilogmask){ + + long i,j; + vorbis_info_floor1 *info=look->vi; + long n=look->n; + long posts=look->posts; + codec_setup_info *ci=vb->vd->vi->codec_setup; + int out[VIF_POSIT+2]; + static_codebook **sbooks=ci->book_param; + codebook *books=ci->fullbooks; + static long seq=0; + + /* quantize values to multiplier spec */ + if(post){ + for(i=0;imult){ + case 1: /* 1024 -> 256 */ + val>>=2; + break; + case 2: /* 1024 -> 128 */ + val>>=3; + break; + case 3: /* 1024 -> 86 */ + val/=12; + break; + case 4: /* 1024 -> 64 */ + val>>=4; + break; + } + post[i]=val | (post[i]&0x8000); + } + + out[0]=post[0]; + out[1]=post[1]; + + /* find prediction values for each post and subtract them */ + for(i=2;iloneighbor[i-2]; + int hn=look->hineighbor[i-2]; + int x0=info->postlist[ln]; + int x1=info->postlist[hn]; + int y0=post[ln]; + int y1=post[hn]; + + int predicted=render_point(x0,x1,y0,y1,info->postlist[i]); + + if((post[i]&0x8000) || (predicted==post[i])){ + post[i]=predicted|0x8000; /* in case there was roundoff jitter + in interpolation */ + out[i]=0; + }else{ + int headroom=(look->quant_q-predictedquant_q-predicted:predicted); + + int val=post[i]-predicted; + + /* at this point the 'deviation' value is in the range +/- max + range, but the real, unique range can always be mapped to + only [0-maxrange). So we want to wrap the deviation into + this limited range, but do it in the way that least screws + an essentially gaussian probability distribution. */ + + if(val<0) + if(val<-headroom) + val=headroom-val-1; + else + val=-1-(val<<1); + else + if(val>=headroom) + val= val+headroom; + else + val<<=1; + + out[i]=val; + post[ln]&=0x7fff; + post[hn]&=0x7fff; + } + } + + /* we have everything we need. pack it out */ + /* mark nontrivial floor */ + oggpack_write(opb,1,1); + + /* beginning/end post */ + look->frames++; + look->postbits+=ilog(look->quant_q-1)*2; + oggpack_write(opb,out[0],ilog(look->quant_q-1)); + oggpack_write(opb,out[1],ilog(look->quant_q-1)); + + + /* partition by partition */ + for(i=0,j=2;ipartitions;i++){ + int class=info->partitionclass[i]; + int cdim=info->class_dim[class]; + int csubbits=info->class_subs[class]; + int csub=1<class_subbook[class][k]; + if(booknum<0){ + maxval[k]=1; + }else{ + maxval[k]=sbooks[info->class_subbook[class][k]]->entries; + } + } + for(k=0;kphrasebits+= + vorbis_book_encode(books+info->class_book[class],cval,opb); + +#ifdef TRAIN_FLOOR1 + { + FILE *of; + char buffer[80]; + sprintf(buffer,"line_%dx%ld_class%d.vqd", + vb->pcmend/2,posts-2,class); + of=fopen(buffer,"a"); + fprintf(of,"%d\n",cval); + fclose(of); + } +#endif + } + + /* write post values */ + for(k=0;kclass_subbook[class][bookas[k]]; + if(book>=0){ + /* hack to allow training with 'bad' books */ + if(out[j+k]<(books+book)->entries) + look->postbits+=vorbis_book_encode(books+book, + out[j+k],opb); + /*else + fprintf(stderr,"+!");*/ + +#ifdef TRAIN_FLOOR1 + { + FILE *of; + char buffer[80]; + sprintf(buffer,"line_%dx%ld_%dsub%d.vqd", + vb->pcmend/2,posts-2,class,bookas[k]); + of=fopen(buffer,"a"); + fprintf(of,"%d\n",out[j+k]); + fclose(of); + } +#endif + } + } + j+=cdim; + } + + { + /* generate quantized floor equivalent to what we'd unpack in decode */ + /* render the lines */ + int hx=0; + int lx=0; + int ly=post[0]*info->mult; + for(j=1;jposts;j++){ + int current=look->forward_index[j]; + int hy=post[current]&0x7fff; + if(hy==post[current]){ + + hy*=info->mult; + hx=info->postlist[current]; + + render_line0(lx,hx,ly,hy,ilogmask); + + lx=hx; + ly=hy; + } + } + for(j=hx;jpcmend/2;j++)ilogmask[j]=ly; /* be certain */ + seq++; + return(1); + } + }else{ + oggpack_write(opb,0,1); + memset(ilogmask,0,vb->pcmend/2*sizeof(*ilogmask)); + seq++; + return(0); + } +} + +static void *floor1_inverse1(vorbis_block *vb,vorbis_look_floor *in){ + vorbis_look_floor1 *look=(vorbis_look_floor1 *)in; + vorbis_info_floor1 *info=look->vi; + codec_setup_info *ci=vb->vd->vi->codec_setup; + + int i,j,k; + codebook *books=ci->fullbooks; + + /* unpack wrapped/predicted values from stream */ + if(oggpack_read(&vb->opb,1)==1){ + int *fit_value=_vorbis_block_alloc(vb,(look->posts)*sizeof(*fit_value)); + + fit_value[0]=oggpack_read(&vb->opb,ilog(look->quant_q-1)); + fit_value[1]=oggpack_read(&vb->opb,ilog(look->quant_q-1)); + + /* partition by partition */ + for(i=0,j=2;ipartitions;i++){ + int class=info->partitionclass[i]; + int cdim=info->class_dim[class]; + int csubbits=info->class_subs[class]; + int csub=1<class_book[class],&vb->opb); + + if(cval==-1)goto eop; + } + + for(k=0;kclass_subbook[class][cval&(csub-1)]; + cval>>=csubbits; + if(book>=0){ + if((fit_value[j+k]=vorbis_book_decode(books+book,&vb->opb))==-1) + goto eop; + }else{ + fit_value[j+k]=0; + } + } + j+=cdim; + } + + /* unwrap positive values and reconsitute via linear interpolation */ + for(i=2;iposts;i++){ + int predicted=render_point(info->postlist[look->loneighbor[i-2]], + info->postlist[look->hineighbor[i-2]], + fit_value[look->loneighbor[i-2]], + fit_value[look->hineighbor[i-2]], + info->postlist[i]); + int hiroom=look->quant_q-predicted; + int loroom=predicted; + int room=(hiroom=room){ + if(hiroom>loroom){ + val = val-loroom; + }else{ + val = -1-(val-hiroom); + } + }else{ + if(val&1){ + val= -((val+1)>>1); + }else{ + val>>=1; + } + } + + fit_value[i]=val+predicted; + fit_value[look->loneighbor[i-2]]&=0x7fff; + fit_value[look->hineighbor[i-2]]&=0x7fff; + + }else{ + fit_value[i]=predicted|0x8000; + } + + } + + return(fit_value); + } + eop: + return(NULL); +} + +static int floor1_inverse2(vorbis_block *vb,vorbis_look_floor *in,void *memo, + float *out){ + vorbis_look_floor1 *look=(vorbis_look_floor1 *)in; + vorbis_info_floor1 *info=look->vi; + + codec_setup_info *ci=vb->vd->vi->codec_setup; + int n=ci->blocksizes[vb->W]/2; + int j; + + if(memo){ + /* render the lines */ + int *fit_value=(int *)memo; + int hx=0; + int lx=0; + int ly=fit_value[0]*info->mult; + for(j=1;jposts;j++){ + int current=look->forward_index[j]; + int hy=fit_value[current]&0x7fff; + if(hy==fit_value[current]){ + + hy*=info->mult; + hx=info->postlist[current]; + + render_line(lx,hx,ly,hy,out); + + lx=hx; + ly=hy; + } + } + for(j=hx;j header packets + last mod: $Id$ + + ********************************************************************/ + +/* general handling of the header and the vorbis_info structure (and + substructures) */ + +#include +#include +#include +#include +#include "vorbis/codec.h" +#include "codec_internal.h" +#include "codebook.h" +#include "registry.h" +#include "window.h" +#include "psy.h" +#include "misc.h" +#include "os.h" + +/* helpers */ +static int ilog2(unsigned int v){ + int ret=0; + if(v)--v; + while(v){ + ret++; + v>>=1; + } + return(ret); +} + +static void _v_writestring(oggpack_buffer *o,char *s, int bytes){ + + while(bytes--){ + oggpack_write(o,*s++,8); + } +} + +static void _v_readstring(oggpack_buffer *o,char *buf,int bytes){ + while(bytes--){ + *buf++=oggpack_read(o,8); + } +} + +void vorbis_comment_init(vorbis_comment *vc){ + memset(vc,0,sizeof(*vc)); +} + +void vorbis_comment_add(vorbis_comment *vc,char *comment){ + vc->user_comments=_ogg_realloc(vc->user_comments, + (vc->comments+2)*sizeof(*vc->user_comments)); + vc->comment_lengths=_ogg_realloc(vc->comment_lengths, + (vc->comments+2)*sizeof(*vc->comment_lengths)); + vc->comment_lengths[vc->comments]=strlen(comment); + vc->user_comments[vc->comments]=_ogg_malloc(vc->comment_lengths[vc->comments]+1); + strcpy(vc->user_comments[vc->comments], comment); + vc->comments++; + vc->user_comments[vc->comments]=NULL; +} + +void vorbis_comment_add_tag(vorbis_comment *vc, char *tag, char *contents){ + char *comment=alloca(strlen(tag)+strlen(contents)+2); /* +2 for = and \0 */ + strcpy(comment, tag); + strcat(comment, "="); + strcat(comment, contents); + vorbis_comment_add(vc, comment); +} + +/* This is more or less the same as strncasecmp - but that doesn't exist + * everywhere, and this is a fairly trivial function, so we include it */ +static int tagcompare(const char *s1, const char *s2, int n){ + int c=0; + while(c < n){ + if(toupper(s1[c]) != toupper(s2[c])) + return !0; + c++; + } + return 0; +} + +char *vorbis_comment_query(vorbis_comment *vc, char *tag, int count){ + long i; + int found = 0; + int taglen = strlen(tag)+1; /* +1 for the = we append */ + char *fulltag = alloca(taglen+ 1); + + strcpy(fulltag, tag); + strcat(fulltag, "="); + + for(i=0;icomments;i++){ + if(!tagcompare(vc->user_comments[i], fulltag, taglen)){ + if(count == found) + /* We return a pointer to the data, not a copy */ + return vc->user_comments[i] + taglen; + else + found++; + } + } + return NULL; /* didn't find anything */ +} + +int vorbis_comment_query_count(vorbis_comment *vc, char *tag){ + int i,count=0; + int taglen = strlen(tag)+1; /* +1 for the = we append */ + char *fulltag = alloca(taglen+1); + strcpy(fulltag,tag); + strcat(fulltag, "="); + + for(i=0;icomments;i++){ + if(!tagcompare(vc->user_comments[i], fulltag, taglen)) + count++; + } + + return count; +} + +void vorbis_comment_clear(vorbis_comment *vc){ + if(vc){ + long i; + for(i=0;icomments;i++) + if(vc->user_comments[i])_ogg_free(vc->user_comments[i]); + if(vc->user_comments)_ogg_free(vc->user_comments); + if(vc->comment_lengths)_ogg_free(vc->comment_lengths); + if(vc->vendor)_ogg_free(vc->vendor); + } + memset(vc,0,sizeof(*vc)); +} + +/* blocksize 0 is guaranteed to be short, 1 is guarantted to be long. + They may be equal, but short will never ge greater than long */ +int vorbis_info_blocksize(vorbis_info *vi,int zo){ + codec_setup_info *ci = vi->codec_setup; + return ci ? ci->blocksizes[zo] : -1; +} + +/* used by synthesis, which has a full, alloced vi */ +void vorbis_info_init(vorbis_info *vi){ + memset(vi,0,sizeof(*vi)); + vi->codec_setup=_ogg_calloc(1,sizeof(codec_setup_info)); +} + +void vorbis_info_clear(vorbis_info *vi){ + codec_setup_info *ci=vi->codec_setup; + int i; + + if(ci){ + + for(i=0;imodes;i++) + if(ci->mode_param[i])_ogg_free(ci->mode_param[i]); + + for(i=0;imaps;i++) /* unpack does the range checking */ + _mapping_P[ci->map_type[i]]->free_info(ci->map_param[i]); + + for(i=0;ifloors;i++) /* unpack does the range checking */ + _floor_P[ci->floor_type[i]]->free_info(ci->floor_param[i]); + + for(i=0;iresidues;i++) /* unpack does the range checking */ + _residue_P[ci->residue_type[i]]->free_info(ci->residue_param[i]); + + for(i=0;ibooks;i++){ + if(ci->book_param[i]){ + /* knows if the book was not alloced */ + vorbis_staticbook_destroy(ci->book_param[i]); + } + if(ci->fullbooks) + vorbis_book_clear(ci->fullbooks+i); + } + if(ci->fullbooks) + _ogg_free(ci->fullbooks); + + for(i=0;ipsys;i++) + _vi_psy_free(ci->psy_param[i]); + + _ogg_free(ci); + } + + memset(vi,0,sizeof(*vi)); +} + +/* Header packing/unpacking ********************************************/ + +static int _vorbis_unpack_info(vorbis_info *vi,oggpack_buffer *opb){ + codec_setup_info *ci=vi->codec_setup; + if(!ci)return(OV_EFAULT); + + vi->version=oggpack_read(opb,32); + if(vi->version!=0)return(OV_EVERSION); + + vi->channels=oggpack_read(opb,8); + vi->rate=oggpack_read(opb,32); + + vi->bitrate_upper=oggpack_read(opb,32); + vi->bitrate_nominal=oggpack_read(opb,32); + vi->bitrate_lower=oggpack_read(opb,32); + + ci->blocksizes[0]=1<blocksizes[1]=1<rate<1)goto err_out; + if(vi->channels<1)goto err_out; + if(ci->blocksizes[0]<8)goto err_out; + if(ci->blocksizes[1]blocksizes[0])goto err_out; + + if(oggpack_read(opb,1)!=1)goto err_out; /* EOP check */ + + return(0); + err_out: + vorbis_info_clear(vi); + return(OV_EBADHEADER); +} + +static int _vorbis_unpack_comment(vorbis_comment *vc,oggpack_buffer *opb){ + int i; + int vendorlen=oggpack_read(opb,32); + if(vendorlen<0)goto err_out; + vc->vendor=_ogg_calloc(vendorlen+1,1); + _v_readstring(opb,vc->vendor,vendorlen); + vc->comments=oggpack_read(opb,32); + if(vc->comments<0)goto err_out; + vc->user_comments=_ogg_calloc(vc->comments+1,sizeof(*vc->user_comments)); + vc->comment_lengths=_ogg_calloc(vc->comments+1, sizeof(*vc->comment_lengths)); + + for(i=0;icomments;i++){ + int len=oggpack_read(opb,32); + if(len<0)goto err_out; + vc->comment_lengths[i]=len; + vc->user_comments[i]=_ogg_calloc(len+1,1); + _v_readstring(opb,vc->user_comments[i],len); + } + if(oggpack_read(opb,1)!=1)goto err_out; /* EOP check */ + + return(0); + err_out: + vorbis_comment_clear(vc); + return(OV_EBADHEADER); +} + +/* all of the real encoding details are here. The modes, books, + everything */ +static int _vorbis_unpack_books(vorbis_info *vi,oggpack_buffer *opb){ + codec_setup_info *ci=vi->codec_setup; + int i; + if(!ci)return(OV_EFAULT); + + /* codebooks */ + ci->books=oggpack_read(opb,8)+1; + /*ci->book_param=_ogg_calloc(ci->books,sizeof(*ci->book_param));*/ + for(i=0;ibooks;i++){ + ci->book_param[i]=_ogg_calloc(1,sizeof(*ci->book_param[i])); + if(vorbis_staticbook_unpack(opb,ci->book_param[i]))goto err_out; + } + + /* time backend settings; hooks are unused */ + { + int times=oggpack_read(opb,6)+1; + for(i=0;i=VI_TIMEB)goto err_out; + } + } + + /* floor backend settings */ + ci->floors=oggpack_read(opb,6)+1; + /*ci->floor_type=_ogg_malloc(ci->floors*sizeof(*ci->floor_type));*/ + /*ci->floor_param=_ogg_calloc(ci->floors,sizeof(void *));*/ + for(i=0;ifloors;i++){ + ci->floor_type[i]=oggpack_read(opb,16); + if(ci->floor_type[i]<0 || ci->floor_type[i]>=VI_FLOORB)goto err_out; + ci->floor_param[i]=_floor_P[ci->floor_type[i]]->unpack(vi,opb); + if(!ci->floor_param[i])goto err_out; + } + + /* residue backend settings */ + ci->residues=oggpack_read(opb,6)+1; + /*ci->residue_type=_ogg_malloc(ci->residues*sizeof(*ci->residue_type));*/ + /*ci->residue_param=_ogg_calloc(ci->residues,sizeof(void *));*/ + for(i=0;iresidues;i++){ + ci->residue_type[i]=oggpack_read(opb,16); + if(ci->residue_type[i]<0 || ci->residue_type[i]>=VI_RESB)goto err_out; + ci->residue_param[i]=_residue_P[ci->residue_type[i]]->unpack(vi,opb); + if(!ci->residue_param[i])goto err_out; + } + + /* map backend settings */ + ci->maps=oggpack_read(opb,6)+1; + /*ci->map_type=_ogg_malloc(ci->maps*sizeof(*ci->map_type));*/ + /*ci->map_param=_ogg_calloc(ci->maps,sizeof(void *));*/ + for(i=0;imaps;i++){ + ci->map_type[i]=oggpack_read(opb,16); + if(ci->map_type[i]<0 || ci->map_type[i]>=VI_MAPB)goto err_out; + ci->map_param[i]=_mapping_P[ci->map_type[i]]->unpack(vi,opb); + if(!ci->map_param[i])goto err_out; + } + + /* mode settings */ + ci->modes=oggpack_read(opb,6)+1; + /*vi->mode_param=_ogg_calloc(vi->modes,sizeof(void *));*/ + for(i=0;imodes;i++){ + ci->mode_param[i]=_ogg_calloc(1,sizeof(*ci->mode_param[i])); + ci->mode_param[i]->blockflag=oggpack_read(opb,1); + ci->mode_param[i]->windowtype=oggpack_read(opb,16); + ci->mode_param[i]->transformtype=oggpack_read(opb,16); + ci->mode_param[i]->mapping=oggpack_read(opb,8); + + if(ci->mode_param[i]->windowtype>=VI_WINDOWB)goto err_out; + if(ci->mode_param[i]->transformtype>=VI_WINDOWB)goto err_out; + if(ci->mode_param[i]->mapping>=ci->maps)goto err_out; + } + + if(oggpack_read(opb,1)!=1)goto err_out; /* top level EOP check */ + + return(0); + err_out: + vorbis_info_clear(vi); + return(OV_EBADHEADER); +} + +/* The Vorbis header is in three packets; the initial small packet in + the first page that identifies basic parameters, a second packet + with bitstream comments and a third packet that holds the + codebook. */ + +int vorbis_synthesis_headerin(vorbis_info *vi,vorbis_comment *vc,ogg_packet *op){ + oggpack_buffer opb; + + if(op){ + oggpack_readinit(&opb,op->packet,op->bytes); + + /* Which of the three types of header is this? */ + /* Also verify header-ness, vorbis */ + { + char buffer[6]; + int packtype=oggpack_read(&opb,8); + memset(buffer,0,6); + _v_readstring(&opb,buffer,6); + if(memcmp(buffer,"vorbis",6)){ + /* not a vorbis header */ + return(OV_ENOTVORBIS); + } + switch(packtype){ + case 0x01: /* least significant *bit* is read first */ + if(!op->b_o_s){ + /* Not the initial packet */ + return(OV_EBADHEADER); + } + if(vi->rate!=0){ + /* previously initialized info header */ + return(OV_EBADHEADER); + } + + return(_vorbis_unpack_info(vi,&opb)); + + case 0x03: /* least significant *bit* is read first */ + if(vi->rate==0){ + /* um... we didn't get the initial header */ + return(OV_EBADHEADER); + } + + return(_vorbis_unpack_comment(vc,&opb)); + + case 0x05: /* least significant *bit* is read first */ + if(vi->rate==0 || vc->vendor==NULL){ + /* um... we didn;t get the initial header or comments yet */ + return(OV_EBADHEADER); + } + + return(_vorbis_unpack_books(vi,&opb)); + + default: + /* Not a valid vorbis header type */ + return(OV_EBADHEADER); + break; + } + } + } + return(OV_EBADHEADER); +} + +/* pack side **********************************************************/ + +static int _vorbis_pack_info(oggpack_buffer *opb,vorbis_info *vi){ + codec_setup_info *ci=vi->codec_setup; + if(!ci)return(OV_EFAULT); + + /* preamble */ + oggpack_write(opb,0x01,8); + _v_writestring(opb,"vorbis", 6); + + /* basic information about the stream */ + oggpack_write(opb,0x00,32); + oggpack_write(opb,vi->channels,8); + oggpack_write(opb,vi->rate,32); + + oggpack_write(opb,vi->bitrate_upper,32); + oggpack_write(opb,vi->bitrate_nominal,32); + oggpack_write(opb,vi->bitrate_lower,32); + + oggpack_write(opb,ilog2(ci->blocksizes[0]),4); + oggpack_write(opb,ilog2(ci->blocksizes[1]),4); + oggpack_write(opb,1,1); + + return(0); +} + +static int _vorbis_pack_comment(oggpack_buffer *opb,vorbis_comment *vc){ + char temp[]="Xiph.Org libVorbis I 20040629"; + int bytes = strlen(temp); + + /* preamble */ + oggpack_write(opb,0x03,8); + _v_writestring(opb,"vorbis", 6); + + /* vendor */ + oggpack_write(opb,bytes,32); + _v_writestring(opb,temp, bytes); + + /* comments */ + + oggpack_write(opb,vc->comments,32); + if(vc->comments){ + int i; + for(i=0;icomments;i++){ + if(vc->user_comments[i]){ + oggpack_write(opb,vc->comment_lengths[i],32); + _v_writestring(opb,vc->user_comments[i], vc->comment_lengths[i]); + }else{ + oggpack_write(opb,0,32); + } + } + } + oggpack_write(opb,1,1); + + return(0); +} + +static int _vorbis_pack_books(oggpack_buffer *opb,vorbis_info *vi){ + codec_setup_info *ci=vi->codec_setup; + int i; + if(!ci)return(OV_EFAULT); + + oggpack_write(opb,0x05,8); + _v_writestring(opb,"vorbis", 6); + + /* books */ + oggpack_write(opb,ci->books-1,8); + for(i=0;ibooks;i++) + if(vorbis_staticbook_pack(ci->book_param[i],opb))goto err_out; + + /* times; hook placeholders */ + oggpack_write(opb,0,6); + oggpack_write(opb,0,16); + + /* floors */ + oggpack_write(opb,ci->floors-1,6); + for(i=0;ifloors;i++){ + oggpack_write(opb,ci->floor_type[i],16); + if(_floor_P[ci->floor_type[i]]->pack) + _floor_P[ci->floor_type[i]]->pack(ci->floor_param[i],opb); + else + goto err_out; + } + + /* residues */ + oggpack_write(opb,ci->residues-1,6); + for(i=0;iresidues;i++){ + oggpack_write(opb,ci->residue_type[i],16); + _residue_P[ci->residue_type[i]]->pack(ci->residue_param[i],opb); + } + + /* maps */ + oggpack_write(opb,ci->maps-1,6); + for(i=0;imaps;i++){ + oggpack_write(opb,ci->map_type[i],16); + _mapping_P[ci->map_type[i]]->pack(vi,ci->map_param[i],opb); + } + + /* modes */ + oggpack_write(opb,ci->modes-1,6); + for(i=0;imodes;i++){ + oggpack_write(opb,ci->mode_param[i]->blockflag,1); + oggpack_write(opb,ci->mode_param[i]->windowtype,16); + oggpack_write(opb,ci->mode_param[i]->transformtype,16); + oggpack_write(opb,ci->mode_param[i]->mapping,8); + } + oggpack_write(opb,1,1); + + return(0); +err_out: + return(-1); +} + +int vorbis_commentheader_out(vorbis_comment *vc, + ogg_packet *op){ + + oggpack_buffer opb; + + oggpack_writeinit(&opb); + if(_vorbis_pack_comment(&opb,vc)) return OV_EIMPL; + + op->packet = _ogg_malloc(oggpack_bytes(&opb)); + memcpy(op->packet, opb.buffer, oggpack_bytes(&opb)); + + op->bytes=oggpack_bytes(&opb); + op->b_o_s=0; + op->e_o_s=0; + op->granulepos=0; + + return 0; +} + +int vorbis_analysis_headerout(vorbis_dsp_state *v, + vorbis_comment *vc, + ogg_packet *op, + ogg_packet *op_comm, + ogg_packet *op_code){ + int ret=OV_EIMPL; + vorbis_info *vi=v->vi; + oggpack_buffer opb; + private_state *b=v->backend_state; + + if(!b){ + ret=OV_EFAULT; + goto err_out; + } + + /* first header packet **********************************************/ + + oggpack_writeinit(&opb); + if(_vorbis_pack_info(&opb,vi))goto err_out; + + /* build the packet */ + if(b->header)_ogg_free(b->header); + b->header=_ogg_malloc(oggpack_bytes(&opb)); + memcpy(b->header,opb.buffer,oggpack_bytes(&opb)); + op->packet=b->header; + op->bytes=oggpack_bytes(&opb); + op->b_o_s=1; + op->e_o_s=0; + op->granulepos=0; + + /* second header packet (comments) **********************************/ + + oggpack_reset(&opb); + if(_vorbis_pack_comment(&opb,vc))goto err_out; + + if(b->header1)_ogg_free(b->header1); + b->header1=_ogg_malloc(oggpack_bytes(&opb)); + memcpy(b->header1,opb.buffer,oggpack_bytes(&opb)); + op_comm->packet=b->header1; + op_comm->bytes=oggpack_bytes(&opb); + op_comm->b_o_s=0; + op_comm->e_o_s=0; + op_comm->granulepos=0; + + /* third header packet (modes/codebooks) ****************************/ + + oggpack_reset(&opb); + if(_vorbis_pack_books(&opb,vi))goto err_out; + + if(b->header2)_ogg_free(b->header2); + b->header2=_ogg_malloc(oggpack_bytes(&opb)); + memcpy(b->header2,opb.buffer,oggpack_bytes(&opb)); + op_code->packet=b->header2; + op_code->bytes=oggpack_bytes(&opb); + op_code->b_o_s=0; + op_code->e_o_s=0; + op_code->granulepos=0; + + oggpack_writeclear(&opb); + return(0); + err_out: + oggpack_writeclear(&opb); + memset(op,0,sizeof(*op)); + memset(op_comm,0,sizeof(*op_comm)); + memset(op_code,0,sizeof(*op_code)); + + if(b->header)_ogg_free(b->header); + if(b->header1)_ogg_free(b->header1); + if(b->header2)_ogg_free(b->header2); + b->header=NULL; + b->header1=NULL; + b->header2=NULL; + return(ret); +} + +double vorbis_granule_time(vorbis_dsp_state *v,ogg_int64_t granulepos){ + if(granulepos>=0) + return((double)granulepos/v->vi->rate); + return(-1); +} diff --git a/Libraries/Vorbis/Files/lib/lookup.c b/Libraries/Vorbis/Files/lib/lookup.c new file mode 100644 index 000000000..4d42b504e --- /dev/null +++ b/Libraries/Vorbis/Files/lib/lookup.c @@ -0,0 +1,94 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * + * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * + * by the XIPHOPHORUS Company http://www.xiph.org/ * + * * + ******************************************************************** + + function: lookup based functions + last mod: $Id$ + + ********************************************************************/ + +#include +#include "lookup.h" +#include "lookup_data.h" +#include "os.h" +#include "misc.h" + +#ifdef FLOAT_LOOKUP + +/* interpolated lookup based cos function, domain 0 to PI only */ +float vorbis_coslook(float a){ + double d=a*(.31830989*(float)COS_LOOKUP_SZ); + int i=vorbis_ftoi(d-.5); + + return COS_LOOKUP[i]+ (d-i)*(COS_LOOKUP[i+1]-COS_LOOKUP[i]); +} + +/* interpolated 1./sqrt(p) where .5 <= p < 1. */ +float vorbis_invsqlook(float a){ + double d=a*(2.f*(float)INVSQ_LOOKUP_SZ)-(float)INVSQ_LOOKUP_SZ; + int i=vorbis_ftoi(d-.5f); + return INVSQ_LOOKUP[i]+ (d-i)*(INVSQ_LOOKUP[i+1]-INVSQ_LOOKUP[i]); +} + +/* interpolated 1./sqrt(p) where .5 <= p < 1. */ +float vorbis_invsq2explook(int a){ + return INVSQ2EXP_LOOKUP[a-INVSQ2EXP_LOOKUP_MIN]; +} + +#include +/* interpolated lookup based fromdB function, domain -140dB to 0dB only */ +float vorbis_fromdBlook(float a){ + int i=vorbis_ftoi(a*((float)(-(1<=(FROMdB_LOOKUP_SZ<>FROMdB_SHIFT]*FROMdB2_LOOKUP[i&FROMdB2_MASK]); +} + +#endif + +#ifdef INT_LOOKUP +/* interpolated 1./sqrt(p) where .5 <= a < 1. (.100000... to .111111...) in + 16.16 format + + returns in m.8 format */ +long vorbis_invsqlook_i(long a,long e){ + long i=(a&0x7fff)>>(INVSQ_LOOKUP_I_SHIFT-1); + long d=(a&INVSQ_LOOKUP_I_MASK)<<(16-INVSQ_LOOKUP_I_SHIFT); /* 0.16 */ + long val=INVSQ_LOOKUP_I[i]- /* 1.16 */ + (((INVSQ_LOOKUP_I[i]-INVSQ_LOOKUP_I[i+1])* /* 0.16 */ + d)>>16); /* result 1.16 */ + + e+=32; + if(e&1)val=(val*5792)>>13; /* multiply val by 1/sqrt(2) */ + e=(e>>1)-8; + + return(val>>e); +} + +/* interpolated lookup based fromdB function, domain -140dB to 0dB only */ +/* a is in n.12 format */ +float vorbis_fromdBlook_i(long a){ + int i=(-a)>>(12-FROMdB2_SHIFT); + return (i<0)?1.f: + ((i>=(FROMdB_LOOKUP_SZ<>FROMdB_SHIFT]*FROMdB2_LOOKUP[i&FROMdB2_MASK]); +} + +/* interpolated lookup based cos function, domain 0 to PI only */ +/* a is in 0.16 format, where 0==0, 2^^16-1==PI, return 0.14 */ +long vorbis_coslook_i(long a){ + int i=a>>COS_LOOKUP_I_SHIFT; + int d=a&COS_LOOKUP_I_MASK; + return COS_LOOKUP_I[i]- ((d*(COS_LOOKUP_I[i]-COS_LOOKUP_I[i+1]))>> + COS_LOOKUP_I_SHIFT); +} + +#endif diff --git a/Libraries/Vorbis/Files/lib/lookup.h b/Libraries/Vorbis/Files/lib/lookup.h new file mode 100644 index 000000000..778c3f6c1 --- /dev/null +++ b/Libraries/Vorbis/Files/lib/lookup.h @@ -0,0 +1,32 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * + * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * + * by the XIPHOPHORUS Company http://www.xiph.org/ * + * * + ******************************************************************** + + function: lookup based functions + last mod: $Id$ + + ********************************************************************/ + +#ifndef _V_LOOKUP_H_ + +#ifdef FLOAT_LOOKUP +extern float vorbis_coslook(float a); +extern float vorbis_invsqlook(float a); +extern float vorbis_invsq2explook(int a); +extern float vorbis_fromdBlook(float a); +#endif +#ifdef INT_LOOKUP +extern long vorbis_invsqlook_i(long a,long e); +extern long vorbis_coslook_i(long a); +extern float vorbis_fromdBlook_i(long a); +#endif + +#endif diff --git a/Libraries/Vorbis/Files/lib/lookup_data.h b/Libraries/Vorbis/Files/lib/lookup_data.h new file mode 100644 index 000000000..a2266eac4 --- /dev/null +++ b/Libraries/Vorbis/Files/lib/lookup_data.h @@ -0,0 +1,189 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * + * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * + * by the XIPHOPHORUS Company http://www.xiph.org/ * + * * + ******************************************************************** + + function: lookup data; generated by lookups.pl; edit there + last mod: $Id$ + + ********************************************************************/ + +#ifndef _V_LOOKUP_DATA_H_ + +#ifdef FLOAT_LOOKUP +#define COS_LOOKUP_SZ 128 +static float COS_LOOKUP[COS_LOOKUP_SZ+1]={ + +1.0000000000000f,+0.9996988186962f,+0.9987954562052f,+0.9972904566787f, + +0.9951847266722f,+0.9924795345987f,+0.9891765099648f,+0.9852776423889f, + +0.9807852804032f,+0.9757021300385f,+0.9700312531945f,+0.9637760657954f, + +0.9569403357322f,+0.9495281805930f,+0.9415440651830f,+0.9329927988347f, + +0.9238795325113f,+0.9142097557035f,+0.9039892931234f,+0.8932243011955f, + +0.8819212643484f,+0.8700869911087f,+0.8577286100003f,+0.8448535652497f, + +0.8314696123025f,+0.8175848131516f,+0.8032075314806f,+0.7883464276266f, + +0.7730104533627f,+0.7572088465065f,+0.7409511253550f,+0.7242470829515f, + +0.7071067811865f,+0.6895405447371f,+0.6715589548470f,+0.6531728429538f, + +0.6343932841636f,+0.6152315905806f,+0.5956993044924f,+0.5758081914178f, + +0.5555702330196f,+0.5349976198871f,+0.5141027441932f,+0.4928981922298f, + +0.4713967368260f,+0.4496113296546f,+0.4275550934303f,+0.4052413140050f, + +0.3826834323651f,+0.3598950365350f,+0.3368898533922f,+0.3136817403989f, + +0.2902846772545f,+0.2667127574749f,+0.2429801799033f,+0.2191012401569f, + +0.1950903220161f,+0.1709618887603f,+0.1467304744554f,+0.1224106751992f, + +0.0980171403296f,+0.0735645635997f,+0.0490676743274f,+0.0245412285229f, + +0.0000000000000f,-0.0245412285229f,-0.0490676743274f,-0.0735645635997f, + -0.0980171403296f,-0.1224106751992f,-0.1467304744554f,-0.1709618887603f, + -0.1950903220161f,-0.2191012401569f,-0.2429801799033f,-0.2667127574749f, + -0.2902846772545f,-0.3136817403989f,-0.3368898533922f,-0.3598950365350f, + -0.3826834323651f,-0.4052413140050f,-0.4275550934303f,-0.4496113296546f, + -0.4713967368260f,-0.4928981922298f,-0.5141027441932f,-0.5349976198871f, + -0.5555702330196f,-0.5758081914178f,-0.5956993044924f,-0.6152315905806f, + -0.6343932841636f,-0.6531728429538f,-0.6715589548470f,-0.6895405447371f, + -0.7071067811865f,-0.7242470829515f,-0.7409511253550f,-0.7572088465065f, + -0.7730104533627f,-0.7883464276266f,-0.8032075314806f,-0.8175848131516f, + -0.8314696123025f,-0.8448535652497f,-0.8577286100003f,-0.8700869911087f, + -0.8819212643484f,-0.8932243011955f,-0.9039892931234f,-0.9142097557035f, + -0.9238795325113f,-0.9329927988347f,-0.9415440651830f,-0.9495281805930f, + -0.9569403357322f,-0.9637760657954f,-0.9700312531945f,-0.9757021300385f, + -0.9807852804032f,-0.9852776423889f,-0.9891765099648f,-0.9924795345987f, + -0.9951847266722f,-0.9972904566787f,-0.9987954562052f,-0.9996988186962f, + -1.0000000000000f, +}; + +#define INVSQ_LOOKUP_SZ 32 +static float INVSQ_LOOKUP[INVSQ_LOOKUP_SZ+1]={ + 1.414213562373f,1.392621247646f,1.371988681140f,1.352246807566f, + 1.333333333333f,1.315191898443f,1.297771369046f,1.281025230441f, + 1.264911064067f,1.249390095109f,1.234426799697f,1.219988562661f, + 1.206045378311f,1.192569588000f,1.179535649239f,1.166919931983f, + 1.154700538379f,1.142857142857f,1.131370849898f,1.120224067222f, + 1.109400392450f,1.098884511590f,1.088662107904f,1.078719779941f, + 1.069044967650f,1.059625885652f,1.050451462878f,1.041511287847f, + 1.032795558989f,1.024295039463f,1.016001016002f,1.007905261358f, + 1.000000000000f, +}; + +#define INVSQ2EXP_LOOKUP_MIN (-32) +#define INVSQ2EXP_LOOKUP_MAX 32 +static float INVSQ2EXP_LOOKUP[INVSQ2EXP_LOOKUP_MAX-\ + INVSQ2EXP_LOOKUP_MIN+1]={ + 65536.f, 46340.95001f, 32768.f, 23170.47501f, + 16384.f, 11585.2375f, 8192.f, 5792.618751f, + 4096.f, 2896.309376f, 2048.f, 1448.154688f, + 1024.f, 724.0773439f, 512.f, 362.038672f, + 256.f, 181.019336f, 128.f, 90.50966799f, + 64.f, 45.254834f, 32.f, 22.627417f, + 16.f, 11.3137085f, 8.f, 5.656854249f, + 4.f, 2.828427125f, 2.f, 1.414213562f, + 1.f, 0.7071067812f, 0.5f, 0.3535533906f, + 0.25f, 0.1767766953f, 0.125f, 0.08838834765f, + 0.0625f, 0.04419417382f, 0.03125f, 0.02209708691f, + 0.015625f, 0.01104854346f, 0.0078125f, 0.005524271728f, + 0.00390625f, 0.002762135864f, 0.001953125f, 0.001381067932f, + 0.0009765625f, 0.000690533966f, 0.00048828125f, 0.000345266983f, + 0.000244140625f,0.0001726334915f,0.0001220703125f,8.631674575e-05f, + 6.103515625e-05f,4.315837288e-05f,3.051757812e-05f,2.157918644e-05f, + 1.525878906e-05f, +}; + +#endif + +#define FROMdB_LOOKUP_SZ 35 +#define FROMdB2_LOOKUP_SZ 32 +#define FROMdB_SHIFT 5 +#define FROMdB2_SHIFT 3 +#define FROMdB2_MASK 31 +static float FROMdB_LOOKUP[FROMdB_LOOKUP_SZ]={ + 1.f, 0.6309573445f, 0.3981071706f, 0.2511886432f, + 0.1584893192f, 0.1f, 0.06309573445f, 0.03981071706f, + 0.02511886432f, 0.01584893192f, 0.01f, 0.006309573445f, + 0.003981071706f, 0.002511886432f, 0.001584893192f, 0.001f, + 0.0006309573445f,0.0003981071706f,0.0002511886432f,0.0001584893192f, + 0.0001f,6.309573445e-05f,3.981071706e-05f,2.511886432e-05f, + 1.584893192e-05f, 1e-05f,6.309573445e-06f,3.981071706e-06f, + 2.511886432e-06f,1.584893192e-06f, 1e-06f,6.309573445e-07f, + 3.981071706e-07f,2.511886432e-07f,1.584893192e-07f, +}; + +static float FROMdB2_LOOKUP[FROMdB2_LOOKUP_SZ]={ + 0.9928302478f, 0.9786445908f, 0.9646616199f, 0.9508784391f, + 0.9372921937f, 0.92390007f, 0.9106992942f, 0.8976871324f, + 0.8848608897f, 0.8722179097f, 0.8597555737f, 0.8474713009f, + 0.835362547f, 0.8234268041f, 0.8116616003f, 0.8000644989f, + 0.7886330981f, 0.7773650302f, 0.7662579617f, 0.755309592f, + 0.7445176537f, 0.7338799116f, 0.7233941627f, 0.7130582353f, + 0.7028699885f, 0.6928273125f, 0.6829281272f, 0.6731703824f, + 0.6635520573f, 0.6540711597f, 0.6447257262f, 0.6355138211f, +}; + +#ifdef INT_LOOKUP + +#define INVSQ_LOOKUP_I_SHIFT 10 +#define INVSQ_LOOKUP_I_MASK 1023 +static long INVSQ_LOOKUP_I[64+1]={ + 92682l, 91966l, 91267l, 90583l, + 89915l, 89261l, 88621l, 87995l, + 87381l, 86781l, 86192l, 85616l, + 85051l, 84497l, 83953l, 83420l, + 82897l, 82384l, 81880l, 81385l, + 80899l, 80422l, 79953l, 79492l, + 79039l, 78594l, 78156l, 77726l, + 77302l, 76885l, 76475l, 76072l, + 75674l, 75283l, 74898l, 74519l, + 74146l, 73778l, 73415l, 73058l, + 72706l, 72359l, 72016l, 71679l, + 71347l, 71019l, 70695l, 70376l, + 70061l, 69750l, 69444l, 69141l, + 68842l, 68548l, 68256l, 67969l, + 67685l, 67405l, 67128l, 66855l, + 66585l, 66318l, 66054l, 65794l, + 65536l, +}; + +#define COS_LOOKUP_I_SHIFT 9 +#define COS_LOOKUP_I_MASK 511 +#define COS_LOOKUP_I_SZ 128 +static long COS_LOOKUP_I[COS_LOOKUP_I_SZ+1]={ + 16384l, 16379l, 16364l, 16340l, + 16305l, 16261l, 16207l, 16143l, + 16069l, 15986l, 15893l, 15791l, + 15679l, 15557l, 15426l, 15286l, + 15137l, 14978l, 14811l, 14635l, + 14449l, 14256l, 14053l, 13842l, + 13623l, 13395l, 13160l, 12916l, + 12665l, 12406l, 12140l, 11866l, + 11585l, 11297l, 11003l, 10702l, + 10394l, 10080l, 9760l, 9434l, + 9102l, 8765l, 8423l, 8076l, + 7723l, 7366l, 7005l, 6639l, + 6270l, 5897l, 5520l, 5139l, + 4756l, 4370l, 3981l, 3590l, + 3196l, 2801l, 2404l, 2006l, + 1606l, 1205l, 804l, 402l, + 0l, -401l, -803l, -1204l, + -1605l, -2005l, -2403l, -2800l, + -3195l, -3589l, -3980l, -4369l, + -4755l, -5138l, -5519l, -5896l, + -6269l, -6638l, -7004l, -7365l, + -7722l, -8075l, -8422l, -8764l, + -9101l, -9433l, -9759l, -10079l, + -10393l, -10701l, -11002l, -11296l, + -11584l, -11865l, -12139l, -12405l, + -12664l, -12915l, -13159l, -13394l, + -13622l, -13841l, -14052l, -14255l, + -14448l, -14634l, -14810l, -14977l, + -15136l, -15285l, -15425l, -15556l, + -15678l, -15790l, -15892l, -15985l, + -16068l, -16142l, -16206l, -16260l, + -16304l, -16339l, -16363l, -16378l, + -16383l, +}; + +#endif + +#endif diff --git a/Libraries/Vorbis/Files/lib/lookups.pl b/Libraries/Vorbis/Files/lib/lookups.pl new file mode 100755 index 000000000..6aa6aeb49 --- /dev/null +++ b/Libraries/Vorbis/Files/lib/lookups.pl @@ -0,0 +1,142 @@ +#!/usr/bin/perl +print <<'EOD'; +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * + * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * + * by the XIPHOPHORUS Company http://www.xiph.org/ * + * * + ******************************************************************** + + function: lookup data; generated by lookups.pl; edit there + last mod: $Id$ + + ********************************************************************/ + +#ifndef _V_LOOKUP_DATA_H_ + +#ifdef FLOAT_LOOKUP +EOD + +$cos_sz=128; +$invsq_sz=32; +$invsq2exp_min=-32; +$invsq2exp_max=32; + +$fromdB_sz=35; +$fromdB_shift=5; +$fromdB2_shift=3; + +$invsq_i_shift=10; +$cos_i_shift=9; +$delta_shift=6; + +print "#define COS_LOOKUP_SZ $cos_sz\n"; +print "static float COS_LOOKUP[COS_LOOKUP_SZ+1]={\n"; + +for($i=0;$i<=$cos_sz;){ + print "\t"; + for($j=0;$j<4 && $i<=$cos_sz;$j++){ + printf "%+.13f,", cos(3.14159265358979323846*($i++)/$cos_sz) ; + } + print "\n"; +} +print "};\n\n"; + +print "#define INVSQ_LOOKUP_SZ $invsq_sz\n"; +print "static float INVSQ_LOOKUP[INVSQ_LOOKUP_SZ+1]={\n"; + +for($i=0;$i<=$invsq_sz;){ + print "\t"; + for($j=0;$j<4 && $i<=$invsq_sz;$j++){ + my$indexmap=$i++/$invsq_sz*.5+.5; + printf "%.12f,", 1./sqrt($indexmap); + } + print "\n"; +} +print "};\n\n"; + +print "#define INVSQ2EXP_LOOKUP_MIN $invsq2exp_min\n"; +print "#define INVSQ2EXP_LOOKUP_MAX $invsq2exp_max\n"; +print "static float INVSQ2EXP_LOOKUP[INVSQ2EXP_LOOKUP_MAX-\\\n". + " INVSQ2EXP_LOOKUP_MIN+1]={\n"; + +for($i=$invsq2exp_min;$i<=$invsq2exp_max;){ + print "\t"; + for($j=0;$j<4 && $i<=$invsq2exp_max;$j++){ + printf "%15.10g,", 2**($i++*-.5); + } + print "\n"; +} +print "};\n\n#endif\n\n"; + + +# 0 to -140 dB +$fromdB2_sz=1<<$fromdB_shift; +$fromdB_gran=1<<($fromdB_shift-$fromdB2_shift); +print "#define FROMdB_LOOKUP_SZ $fromdB_sz\n"; +print "#define FROMdB2_LOOKUP_SZ $fromdB2_sz\n"; +print "#define FROMdB_SHIFT $fromdB_shift\n"; +print "#define FROMdB2_SHIFT $fromdB2_shift\n"; +print "#define FROMdB2_MASK ".((1<<$fromdB_shift)-1)."\n"; + +print "static float FROMdB_LOOKUP[FROMdB_LOOKUP_SZ]={\n"; + +for($i=0;$i<$fromdB_sz;){ + print "\t"; + for($j=0;$j<4 && $i<$fromdB_sz;$j++){ + printf "%15.10g,", 10**(.05*(-$fromdB_gran*$i++)); + } + print "\n"; +} +print "};\n\n"; + +print "static float FROMdB2_LOOKUP[FROMdB2_LOOKUP_SZ]={\n"; + +for($i=0;$i<$fromdB2_sz;){ + print "\t"; + for($j=0;$j<4 && $i<$fromdB_sz;$j++){ + printf "%15.10g,", 10**(.05*(-$fromdB_gran/$fromdB2_sz*(.5+$i++))); + } + print "\n"; +} +print "};\n\n#ifdef INT_LOOKUP\n\n"; + + +$iisz=0x10000>>$invsq_i_shift; +print "#define INVSQ_LOOKUP_I_SHIFT $invsq_i_shift\n"; +print "#define INVSQ_LOOKUP_I_MASK ".(0x0ffff>>(16-$invsq_i_shift))."\n"; +print "static long INVSQ_LOOKUP_I[$iisz+1]={\n"; +for($i=0;$i<=$iisz;){ + print "\t"; + for($j=0;$j<4 && $i<=$iisz;$j++){ + my$indexmap=$i++/$iisz*.5+.5; + printf "%8d,", int(1./sqrt($indexmap)*65536.+.5); + } + print "\n"; +} +print "};\n\n"; + +$cisz=0x10000>>$cos_i_shift; +print "#define COS_LOOKUP_I_SHIFT $cos_i_shift\n"; +print "#define COS_LOOKUP_I_MASK ".(0x0ffff>>(16-$cos_i_shift))."\n"; +print "#define COS_LOOKUP_I_SZ $cisz\n"; +print "static long COS_LOOKUP_I[COS_LOOKUP_I_SZ+1]={\n"; + +for($i=0;$i<=$cisz;){ + print "\t"; + for($j=0;$j<4 && $i<=$cisz;$j++){ + printf "%8d,", int(cos(3.14159265358979323846*($i++)/$cos_sz)*16384.+.5) ; + } + print "\n"; +} +print "};\n\n"; + + +print "#endif\n\n#endif\n"; + + diff --git a/Libraries/Vorbis/Files/lib/lpc.c b/Libraries/Vorbis/Files/lib/lpc.c new file mode 100644 index 000000000..fd1c438f2 --- /dev/null +++ b/Libraries/Vorbis/Files/lib/lpc.c @@ -0,0 +1,149 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * + * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * + * by the XIPHOPHORUS Company http://www.xiph.org/ * + * * + ******************************************************************** + + function: LPC low level routines + last mod: $Id$ + + ********************************************************************/ + +/* Some of these routines (autocorrelator, LPC coefficient estimator) + are derived from code written by Jutta Degener and Carsten Bormann; + thus we include their copyright below. The entirety of this file + is freely redistributable on the condition that both of these + copyright notices are preserved without modification. */ + +/* Preserved Copyright: *********************************************/ + +/* Copyright 1992, 1993, 1994 by Jutta Degener and Carsten Bormann, +Technische Universita"t Berlin + +Any use of this software is permitted provided that this notice is not +removed and that neither the authors nor the Technische Universita"t +Berlin are deemed to have made any representations as to the +suitability of this software for any purpose nor are held responsible +for any defects of this software. THERE IS ABSOLUTELY NO WARRANTY FOR +THIS SOFTWARE. + +As a matter of courtesy, the authors request to be informed about uses +this software has found, about bugs in this software, and about any +improvements that may be of general interest. + +Berlin, 28.11.1994 +Jutta Degener +Carsten Bormann + +*********************************************************************/ + +#include +#include +#include +#include "os.h" +#include "smallft.h" +#include "lpc.h" +#include "scales.h" +#include "misc.h" + +/* Autocorrelation LPC coeff generation algorithm invented by + N. Levinson in 1947, modified by J. Durbin in 1959. */ + +/* Input : n elements of time doamin data + Output: m lpc coefficients, excitation energy */ + +float vorbis_lpc_from_data(float *data,float *lpci,int n,int m){ + double *aut=alloca(sizeof(*aut)*(m+1)); + double *lpc=alloca(sizeof(*lpc)*(m)); + double error; + int i,j; + + /* autocorrelation, p+1 lag coefficients */ + j=m+1; + while(j--){ + double d=0; /* double needed for accumulator depth */ + for(i=j;i +#include +#include +#include "lsp.h" +#include "os.h" +#include "misc.h" +#include "lookup.h" +#include "scales.h" + +/* three possible LSP to f curve functions; the exact computation + (float), a lookup based float implementation, and an integer + implementation. The float lookup is likely the optimal choice on + any machine with an FPU. The integer implementation is *not* fixed + point (due to the need for a large dynamic range and thus a + seperately tracked exponent) and thus much more complex than the + relatively simple float implementations. It's mostly for future + work on a fully fixed point implementation for processors like the + ARM family. */ + +/* undefine both for the 'old' but more precise implementation */ +#define FLOAT_LOOKUP +#undef INT_LOOKUP + +#ifdef FLOAT_LOOKUP +#include "lookup.c" /* catch this in the build system; we #include for + compilers (like gcc) that can't inline across + modules */ + +/* side effect: changes *lsp to cosines of lsp */ +void vorbis_lsp_to_curve(float *curve,int *map,int n,int ln,float *lsp,int m, + float amp,float ampoffset){ + int i; + float wdel=M_PI/ln; + vorbis_fpu_control fpu; + + vorbis_fpu_setround(&fpu); + for(i=0;i>1; + + do{ + q*=ftmp[0]-w; + p*=ftmp[1]-w; + ftmp+=2; + }while(--c); + + if(m&1){ + /* odd order filter; slightly assymetric */ + /* the last coefficient */ + q*=ftmp[0]-w; + q*=q; + p*=p*(1.f-w*w); + }else{ + /* even order filter; still symmetric */ + q*=q*(1.f+w); + p*=p*(1.f-w); + } + + q=frexp(p+q,&qexp); + q=vorbis_fromdBlook(amp* + vorbis_invsqlook(q)* + vorbis_invsq2explook(qexp+m)- + ampoffset); + + do{ + curve[i++]*=q; + }while(map[i]==k); + } + vorbis_fpu_restore(fpu); +} + +#else + +#ifdef INT_LOOKUP +#include "lookup.c" /* catch this in the build system; we #include for + compilers (like gcc) that can't inline across + modules */ + +static int MLOOP_1[64]={ + 0,10,11,11, 12,12,12,12, 13,13,13,13, 13,13,13,13, + 14,14,14,14, 14,14,14,14, 14,14,14,14, 14,14,14,14, + 15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15, + 15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15, +}; + +static int MLOOP_2[64]={ + 0,4,5,5, 6,6,6,6, 7,7,7,7, 7,7,7,7, + 8,8,8,8, 8,8,8,8, 8,8,8,8, 8,8,8,8, + 9,9,9,9, 9,9,9,9, 9,9,9,9, 9,9,9,9, + 9,9,9,9, 9,9,9,9, 9,9,9,9, 9,9,9,9, +}; + +static int MLOOP_3[8]={0,1,2,2,3,3,3,3}; + + +/* side effect: changes *lsp to cosines of lsp */ +void vorbis_lsp_to_curve(float *curve,int *map,int n,int ln,float *lsp,int m, + float amp,float ampoffset){ + + /* 0 <= m < 256 */ + + /* set up for using all int later */ + int i; + int ampoffseti=rint(ampoffset*4096.f); + int ampi=rint(amp*16.f); + long *ilsp=alloca(m*sizeof(*ilsp)); + for(i=0;i>25])) + if(!(shift=MLOOP_2[(pi|qi)>>19])) + shift=MLOOP_3[(pi|qi)>>16]; + qi=(qi>>shift)*labs(ilsp[j-1]-wi); + pi=(pi>>shift)*labs(ilsp[j]-wi); + qexp+=shift; + } + if(!(shift=MLOOP_1[(pi|qi)>>25])) + if(!(shift=MLOOP_2[(pi|qi)>>19])) + shift=MLOOP_3[(pi|qi)>>16]; + + /* pi,qi normalized collectively, both tracked using qexp */ + + if(m&1){ + /* odd order filter; slightly assymetric */ + /* the last coefficient */ + qi=(qi>>shift)*labs(ilsp[j-1]-wi); + pi=(pi>>shift)<<14; + qexp+=shift; + + if(!(shift=MLOOP_1[(pi|qi)>>25])) + if(!(shift=MLOOP_2[(pi|qi)>>19])) + shift=MLOOP_3[(pi|qi)>>16]; + + pi>>=shift; + qi>>=shift; + qexp+=shift-14*((m+1)>>1); + + pi=((pi*pi)>>16); + qi=((qi*qi)>>16); + qexp=qexp*2+m; + + pi*=(1<<14)-((wi*wi)>>14); + qi+=pi>>14; + + }else{ + /* even order filter; still symmetric */ + + /* p*=p(1-w), q*=q(1+w), let normalization drift because it isn't + worth tracking step by step */ + + pi>>=shift; + qi>>=shift; + qexp+=shift-7*m; + + pi=((pi*pi)>>16); + qi=((qi*qi)>>16); + qexp=qexp*2+m; + + pi*=(1<<14)-wi; + qi*=(1<<14)+wi; + qi=(qi+pi)>>14; + + } + + + /* we've let the normalization drift because it wasn't important; + however, for the lookup, things must be normalized again. We + need at most one right shift or a number of left shifts */ + + if(qi&0xffff0000){ /* checks for 1.xxxxxxxxxxxxxxxx */ + qi>>=1; qexp++; + }else + while(qi && !(qi&0x8000)){ /* checks for 0.0xxxxxxxxxxxxxxx or less*/ + qi<<=1; qexp--; + } + + amp=vorbis_fromdBlook_i(ampi* /* n.4 */ + vorbis_invsqlook_i(qi,qexp)- + /* m.8, m+n<=8 */ + ampoffseti); /* 8.12[0] */ + + curve[i]*=amp; + while(map[++i]==k)curve[i]*=amp; + } +} + +#else + +/* old, nonoptimized but simple version for any poor sap who needs to + figure out what the hell this code does, or wants the other + fraction of a dB precision */ + +/* side effect: changes *lsp to cosines of lsp */ +void vorbis_lsp_to_curve(float *curve,int *map,int n,int ln,float *lsp,int m, + float amp,float ampoffset){ + int i; + float wdel=M_PI/ln; + for(i=0;i= i; j--) { + g[j-2] -= g[j]; + g[j] += g[j]; + } + } +} + +static int comp(const void *a,const void *b){ + return (*(float *)a<*(float *)b)-(*(float *)a>*(float *)b); +} + +/* Newton-Raphson-Maehly actually functioned as a decent root finder, + but there are root sets for which it gets into limit cycles + (exacerbated by zero suppression) and fails. We can't afford to + fail, even if the failure is 1 in 100,000,000, so we now use + Laguerre and later polish with Newton-Raphson (which can then + afford to fail) */ + +#define EPSILON 10e-7 +static int Laguerre_With_Deflation(float *a,int ord,float *r){ + int i,m; + double lastdelta=0.f; + double *defl=alloca(sizeof(*defl)*(ord+1)); + for(i=0;i<=ord;i++)defl[i]=a[i]; + + for(m=ord;m>0;m--){ + double new=0.f,delta; + + /* iterate a root */ + while(1){ + double p=defl[m],pp=0.f,ppp=0.f,denom; + + /* eval the polynomial and its first two derivatives */ + for(i=m;i>0;i--){ + ppp = new*ppp + pp; + pp = new*pp + p; + p = new*p + defl[i-1]; + } + + /* Laguerre's method */ + denom=(m-1) * ((m-1)*pp*pp - m*p*ppp); + if(denom<0) + return(-1); /* complex root! The LPC generator handed us a bad filter */ + + if(pp>0){ + denom = pp + sqrt(denom); + if(denom-(EPSILON))denom=-(EPSILON); + } + + delta = m*p/denom; + new -= delta; + + if(delta<0.f)delta*=-1; + + if(fabs(delta/new)<10e-12)break; + lastdelta=delta; + } + + r[m-1]=new; + + /* forward deflation */ + + for(i=m;i>0;i--) + defl[i-1]+=new*defl[i]; + defl++; + + } + return(0); +} + + +/* for spit-and-polish only */ +static int Newton_Raphson(float *a,int ord,float *r){ + int i, k, count=0; + double error=1.f; + double *root=alloca(ord*sizeof(*root)); + + for(i=0; i1e-20){ + error=0; + + for(i=0; i= 0; k--) { + + pp= pp* rooti + p; + p = p * rooti + a[k]; + } + + delta = p/pp; + root[i] -= delta; + error+= delta*delta; + } + + if(count>40)return(-1); + + count++; + } + + /* Replaced the original bubble sort with a real sort. With your + help, we can eliminate the bubble sort in our lifetime. --Monty */ + + for(i=0; i>1; + int g1_order,g2_order; + float *g1=alloca(sizeof(*g1)*(order2+1)); + float *g2=alloca(sizeof(*g2)*(order2+1)); + float *g1r=alloca(sizeof(*g1r)*(order2+1)); + float *g2r=alloca(sizeof(*g2r)*(order2+1)); + int i; + + /* even and odd are slightly different base cases */ + g1_order=(m+1)>>1; + g2_order=(m) >>1; + + /* Compute the lengths of the x polynomials. */ + /* Compute the first half of K & R F1 & F2 polynomials. */ + /* Compute half of the symmetric and antisymmetric polynomials. */ + /* Remove the roots at +1 and -1. */ + + g1[g1_order] = 1.f; + for(i=1;i<=g1_order;i++) g1[g1_order-i] = lpc[i-1]+lpc[m-i]; + g2[g2_order] = 1.f; + for(i=1;i<=g2_order;i++) g2[g2_order-i] = lpc[i-1]-lpc[m-i]; + + if(g1_order>g2_order){ + for(i=2; i<=g2_order;i++) g2[g2_order-i] += g2[g2_order-i+2]; + }else{ + for(i=1; i<=g1_order;i++) g1[g1_order-i] -= g1[g1_order-i+1]; + for(i=1; i<=g2_order;i++) g2[g2_order-i] += g2[g2_order-i+1]; + } + + /* Convert into polynomials in cos(alpha) */ + cheby(g1,g1_order); + cheby(g2,g2_order); + + /* Find the roots of the 2 even polynomials.*/ + if(Laguerre_With_Deflation(g1,g1_order,g1r) || + Laguerre_With_Deflation(g2,g2_order,g2r)) + return(-1); + + Newton_Raphson(g1,g1_order,g1r); /* if it fails, it leaves g1r alone */ + Newton_Raphson(g2,g2_order,g2r); /* if it fails, it leaves g2r alone */ + + qsort(g1r,g1_order,sizeof(*g1r),comp); + qsort(g2r,g2_order,sizeof(*g2r),comp); + + for(i=0;i +#include +#include +#include +#include +#include "vorbis/codec.h" +#include "codec_internal.h" +#include "codebook.h" +#include "window.h" +#include "registry.h" +#include "psy.h" +#include "misc.h" + +/* simplistic, wasteful way of doing this (unique lookup for each + mode/submapping); there should be a central repository for + identical lookups. That will require minor work, so I'm putting it + off as low priority. + + Why a lookup for each backend in a given mode? Because the + blocksize is set by the mode, and low backend lookups may require + parameters from other areas of the mode/mapping */ + +static void mapping0_free_info(vorbis_info_mapping *i){ + vorbis_info_mapping0 *info=(vorbis_info_mapping0 *)i; + if(info){ + memset(info,0,sizeof(*info)); + _ogg_free(info); + } +} + +static int ilog(unsigned int v){ + int ret=0; + if(v)--v; + while(v){ + ret++; + v>>=1; + } + return(ret); +} + +static void mapping0_pack(vorbis_info *vi,vorbis_info_mapping *vm, + oggpack_buffer *opb){ + int i; + vorbis_info_mapping0 *info=(vorbis_info_mapping0 *)vm; + + /* another 'we meant to do it this way' hack... up to beta 4, we + packed 4 binary zeros here to signify one submapping in use. We + now redefine that to mean four bitflags that indicate use of + deeper features; bit0:submappings, bit1:coupling, + bit2,3:reserved. This is backward compatable with all actual uses + of the beta code. */ + + if(info->submaps>1){ + oggpack_write(opb,1,1); + oggpack_write(opb,info->submaps-1,4); + }else + oggpack_write(opb,0,1); + + if(info->coupling_steps>0){ + oggpack_write(opb,1,1); + oggpack_write(opb,info->coupling_steps-1,8); + + for(i=0;icoupling_steps;i++){ + oggpack_write(opb,info->coupling_mag[i],ilog(vi->channels)); + oggpack_write(opb,info->coupling_ang[i],ilog(vi->channels)); + } + }else + oggpack_write(opb,0,1); + + oggpack_write(opb,0,2); /* 2,3:reserved */ + + /* we don't write the channel submappings if we only have one... */ + if(info->submaps>1){ + for(i=0;ichannels;i++) + oggpack_write(opb,info->chmuxlist[i],4); + } + for(i=0;isubmaps;i++){ + oggpack_write(opb,0,8); /* time submap unused */ + oggpack_write(opb,info->floorsubmap[i],8); + oggpack_write(opb,info->residuesubmap[i],8); + } +} + +/* also responsible for range checking */ +static vorbis_info_mapping *mapping0_unpack(vorbis_info *vi,oggpack_buffer *opb){ + int i; + vorbis_info_mapping0 *info=_ogg_calloc(1,sizeof(*info)); + codec_setup_info *ci=vi->codec_setup; + memset(info,0,sizeof(*info)); + + if(oggpack_read(opb,1)) + info->submaps=oggpack_read(opb,4)+1; + else + info->submaps=1; + + if(oggpack_read(opb,1)){ + info->coupling_steps=oggpack_read(opb,8)+1; + + for(i=0;icoupling_steps;i++){ + int testM=info->coupling_mag[i]=oggpack_read(opb,ilog(vi->channels)); + int testA=info->coupling_ang[i]=oggpack_read(opb,ilog(vi->channels)); + + if(testM<0 || + testA<0 || + testM==testA || + testM>=vi->channels || + testA>=vi->channels) goto err_out; + } + + } + + if(oggpack_read(opb,2)>0)goto err_out; /* 2,3:reserved */ + + if(info->submaps>1){ + for(i=0;ichannels;i++){ + info->chmuxlist[i]=oggpack_read(opb,4); + if(info->chmuxlist[i]>=info->submaps)goto err_out; + } + } + for(i=0;isubmaps;i++){ + oggpack_read(opb,8); /* time submap unused */ + info->floorsubmap[i]=oggpack_read(opb,8); + if(info->floorsubmap[i]>=ci->floors)goto err_out; + info->residuesubmap[i]=oggpack_read(opb,8); + if(info->residuesubmap[i]>=ci->residues)goto err_out; + } + + return info; + + err_out: + mapping0_free_info(info); + return(NULL); +} + +#include "os.h" +#include "lpc.h" +#include "lsp.h" +#include "envelope.h" +#include "mdct.h" +#include "psy.h" +#include "scales.h" + +#if 0 +static long seq=0; +static ogg_int64_t total=0; +static float FLOOR1_fromdB_LOOKUP[256]={ + 1.0649863e-07F, 1.1341951e-07F, 1.2079015e-07F, 1.2863978e-07F, + 1.3699951e-07F, 1.4590251e-07F, 1.5538408e-07F, 1.6548181e-07F, + 1.7623575e-07F, 1.8768855e-07F, 1.9988561e-07F, 2.128753e-07F, + 2.2670913e-07F, 2.4144197e-07F, 2.5713223e-07F, 2.7384213e-07F, + 2.9163793e-07F, 3.1059021e-07F, 3.3077411e-07F, 3.5226968e-07F, + 3.7516214e-07F, 3.9954229e-07F, 4.2550680e-07F, 4.5315863e-07F, + 4.8260743e-07F, 5.1396998e-07F, 5.4737065e-07F, 5.8294187e-07F, + 6.2082472e-07F, 6.6116941e-07F, 7.0413592e-07F, 7.4989464e-07F, + 7.9862701e-07F, 8.5052630e-07F, 9.0579828e-07F, 9.6466216e-07F, + 1.0273513e-06F, 1.0941144e-06F, 1.1652161e-06F, 1.2409384e-06F, + 1.3215816e-06F, 1.4074654e-06F, 1.4989305e-06F, 1.5963394e-06F, + 1.7000785e-06F, 1.8105592e-06F, 1.9282195e-06F, 2.0535261e-06F, + 2.1869758e-06F, 2.3290978e-06F, 2.4804557e-06F, 2.6416497e-06F, + 2.8133190e-06F, 2.9961443e-06F, 3.1908506e-06F, 3.3982101e-06F, + 3.6190449e-06F, 3.8542308e-06F, 4.1047004e-06F, 4.3714470e-06F, + 4.6555282e-06F, 4.9580707e-06F, 5.2802740e-06F, 5.6234160e-06F, + 5.9888572e-06F, 6.3780469e-06F, 6.7925283e-06F, 7.2339451e-06F, + 7.7040476e-06F, 8.2047000e-06F, 8.7378876e-06F, 9.3057248e-06F, + 9.9104632e-06F, 1.0554501e-05F, 1.1240392e-05F, 1.1970856e-05F, + 1.2748789e-05F, 1.3577278e-05F, 1.4459606e-05F, 1.5399272e-05F, + 1.6400004e-05F, 1.7465768e-05F, 1.8600792e-05F, 1.9809576e-05F, + 2.1096914e-05F, 2.2467911e-05F, 2.3928002e-05F, 2.5482978e-05F, + 2.7139006e-05F, 2.8902651e-05F, 3.0780908e-05F, 3.2781225e-05F, + 3.4911534e-05F, 3.7180282e-05F, 3.9596466e-05F, 4.2169667e-05F, + 4.4910090e-05F, 4.7828601e-05F, 5.0936773e-05F, 5.4246931e-05F, + 5.7772202e-05F, 6.1526565e-05F, 6.5524908e-05F, 6.9783085e-05F, + 7.4317983e-05F, 7.9147585e-05F, 8.4291040e-05F, 8.9768747e-05F, + 9.5602426e-05F, 0.00010181521F, 0.00010843174F, 0.00011547824F, + 0.00012298267F, 0.00013097477F, 0.00013948625F, 0.00014855085F, + 0.00015820453F, 0.00016848555F, 0.00017943469F, 0.00019109536F, + 0.00020351382F, 0.00021673929F, 0.00023082423F, 0.00024582449F, + 0.00026179955F, 0.00027881276F, 0.00029693158F, 0.00031622787F, + 0.00033677814F, 0.00035866388F, 0.00038197188F, 0.00040679456F, + 0.00043323036F, 0.00046138411F, 0.00049136745F, 0.00052329927F, + 0.00055730621F, 0.00059352311F, 0.00063209358F, 0.00067317058F, + 0.00071691700F, 0.00076350630F, 0.00081312324F, 0.00086596457F, + 0.00092223983F, 0.00098217216F, 0.0010459992F, 0.0011139742F, + 0.0011863665F, 0.0012634633F, 0.0013455702F, 0.0014330129F, + 0.0015261382F, 0.0016253153F, 0.0017309374F, 0.0018434235F, + 0.0019632195F, 0.0020908006F, 0.0022266726F, 0.0023713743F, + 0.0025254795F, 0.0026895994F, 0.0028643847F, 0.0030505286F, + 0.0032487691F, 0.0034598925F, 0.0036847358F, 0.0039241906F, + 0.0041792066F, 0.0044507950F, 0.0047400328F, 0.0050480668F, + 0.0053761186F, 0.0057254891F, 0.0060975636F, 0.0064938176F, + 0.0069158225F, 0.0073652516F, 0.0078438871F, 0.0083536271F, + 0.0088964928F, 0.009474637F, 0.010090352F, 0.010746080F, + 0.011444421F, 0.012188144F, 0.012980198F, 0.013823725F, + 0.014722068F, 0.015678791F, 0.016697687F, 0.017782797F, + 0.018938423F, 0.020169149F, 0.021479854F, 0.022875735F, + 0.024362330F, 0.025945531F, 0.027631618F, 0.029427276F, + 0.031339626F, 0.033376252F, 0.035545228F, 0.037855157F, + 0.040315199F, 0.042935108F, 0.045725273F, 0.048696758F, + 0.051861348F, 0.055231591F, 0.058820850F, 0.062643361F, + 0.066714279F, 0.071049749F, 0.075666962F, 0.080584227F, + 0.085821044F, 0.091398179F, 0.097337747F, 0.10366330F, + 0.11039993F, 0.11757434F, 0.12521498F, 0.13335215F, + 0.14201813F, 0.15124727F, 0.16107617F, 0.17154380F, + 0.18269168F, 0.19456402F, 0.20720788F, 0.22067342F, + 0.23501402F, 0.25028656F, 0.26655159F, 0.28387361F, + 0.30232132F, 0.32196786F, 0.34289114F, 0.36517414F, + 0.38890521F, 0.41417847F, 0.44109412F, 0.46975890F, + 0.50028648F, 0.53279791F, 0.56742212F, 0.60429640F, + 0.64356699F, 0.68538959F, 0.72993007F, 0.77736504F, + 0.82788260F, 0.88168307F, 0.9389798F, 1.F, +}; + +#endif + +extern int *floor1_fit(vorbis_block *vb,vorbis_look_floor *look, + const float *logmdct, /* in */ + const float *logmask); +extern int *floor1_interpolate_fit(vorbis_block *vb,vorbis_look_floor *look, + int *A,int *B, + int del); +extern int floor1_encode(oggpack_buffer *opb,vorbis_block *vb, + vorbis_look_floor *look, + int *post,int *ilogmask); + + +static int mapping0_forward(vorbis_block *vb){ + vorbis_dsp_state *vd=vb->vd; + vorbis_info *vi=vd->vi; + codec_setup_info *ci=vi->codec_setup; + private_state *b=vb->vd->backend_state; + vorbis_block_internal *vbi=(vorbis_block_internal *)vb->internal; + int n=vb->pcmend; + int i,j,k; + + int *nonzero = alloca(sizeof(*nonzero)*vi->channels); + float **gmdct = _vorbis_block_alloc(vb,vi->channels*sizeof(*gmdct)); + int **ilogmaskch= _vorbis_block_alloc(vb,vi->channels*sizeof(*ilogmaskch)); + int ***floor_posts = _vorbis_block_alloc(vb,vi->channels*sizeof(*floor_posts)); + + float global_ampmax=vbi->ampmax; + float *local_ampmax=alloca(sizeof(*local_ampmax)*vi->channels); + int blocktype=vbi->blocktype; + + int modenumber=vb->W; + vorbis_info_mapping0 *info=ci->map_param[modenumber]; + vorbis_look_psy *psy_look= + b->psy+blocktype+(vb->W?2:0); + + vb->mode=modenumber; + + for(i=0;ichannels;i++){ + float scale=4.f/n; + float scale_dB; + + float *pcm =vb->pcm[i]; + float *logfft =pcm; + + gmdct[i]=_vorbis_block_alloc(vb,n/2*sizeof(**gmdct)); + + scale_dB=todB(&scale) + .345; /* + .345 is a hack; the original + todB estimation used on IEEE 754 + compliant machines had a bug that + returned dB values about a third + of a decibel too high. The bug + was harmless because tunings + implicitly took that into + account. However, fixing the bug + in the estimator requires + changing all the tunings as well. + For now, it's easier to sync + things back up here, and + recalibrate the tunings in the + next major model upgrade. */ + +#if 0 + if(vi->channels==2) + if(i==0) + _analysis_output("pcmL",seq,pcm,n,0,0,total-n/2); + else + _analysis_output("pcmR",seq,pcm,n,0,0,total-n/2); +#endif + + /* window the PCM data */ + _vorbis_apply_window(pcm,b->window,ci->blocksizes,vb->lW,vb->W,vb->nW); + +#if 0 + if(vi->channels==2) + if(i==0) + _analysis_output("windowedL",seq,pcm,n,0,0,total-n/2); + else + _analysis_output("windowedR",seq,pcm,n,0,0,total-n/2); +#endif + + /* transform the PCM data */ + /* only MDCT right now.... */ + mdct_forward(b->transform[vb->W][0],pcm,gmdct[i]); + + /* FFT yields more accurate tonal estimation (not phase sensitive) */ + drft_forward(&b->fft_look[vb->W],pcm); + logfft[0]=scale_dB+todB(pcm) + .345; /* + .345 is a hack; the + original todB estimation used on + IEEE 754 compliant machines had a + bug that returned dB values about + a third of a decibel too high. + The bug was harmless because + tunings implicitly took that into + account. However, fixing the bug + in the estimator requires + changing all the tunings as well. + For now, it's easier to sync + things back up here, and + recalibrate the tunings in the + next major model upgrade. */ + local_ampmax[i]=logfft[0]; + for(j=1;j>1]=scale_dB+.5f*todB(&temp) + .345; /* + + .345 is a hack; the original todB + estimation used on IEEE 754 + compliant machines had a bug that + returned dB values about a third + of a decibel too high. The bug + was harmless because tunings + implicitly took that into + account. However, fixing the bug + in the estimator requires + changing all the tunings as well. + For now, it's easier to sync + things back up here, and + recalibrate the tunings in the + next major model upgrade. */ + if(temp>local_ampmax[i])local_ampmax[i]=temp; + } + + if(local_ampmax[i]>0.f)local_ampmax[i]=0.f; + if(local_ampmax[i]>global_ampmax)global_ampmax=local_ampmax[i]; + +#if 0 + if(vi->channels==2){ + if(i==0){ + _analysis_output("fftL",seq,logfft,n/2,1,0,0); + }else{ + _analysis_output("fftR",seq,logfft,n/2,1,0,0); + } + } +#endif + + } + + { + float *noise = _vorbis_block_alloc(vb,n/2*sizeof(*noise)); + float *tone = _vorbis_block_alloc(vb,n/2*sizeof(*tone)); + + for(i=0;ichannels;i++){ + /* the encoder setup assumes that all the modes used by any + specific bitrate tweaking use the same floor */ + + int submap=info->chmuxlist[i]; + + /* the following makes things clearer to *me* anyway */ + float *mdct =gmdct[i]; + float *logfft =vb->pcm[i]; + + float *logmdct =logfft+n/2; + float *logmask =logfft; + + vb->mode=modenumber; + + floor_posts[i]=_vorbis_block_alloc(vb,PACKETBLOBS*sizeof(**floor_posts)); + memset(floor_posts[i],0,sizeof(**floor_posts)*PACKETBLOBS); + + for(j=0;jchannels==2){ + if(i==0) + _analysis_output("mdctL",seq,logmdct,n/2,1,0,0); + else + _analysis_output("mdctR",seq,logmdct,n/2,1,0,0); + }else{ + _analysis_output("mdct",seq,logmdct,n/2,1,0,0); + } +#endif + + /* first step; noise masking. Not only does 'noise masking' + give us curves from which we can decide how much resolution + to give noise parts of the spectrum, it also implicitly hands + us a tonality estimate (the larger the value in the + 'noise_depth' vector, the more tonal that area is) */ + + _vp_noisemask(psy_look, + logmdct, + noise); /* noise does not have by-frequency offset + bias applied yet */ +#if 0 + if(vi->channels==2){ + if(i==0) + _analysis_output("noiseL",seq,noise,n/2,1,0,0); + else + _analysis_output("noiseR",seq,noise,n/2,1,0,0); + } +#endif + + /* second step: 'all the other crap'; all the stuff that isn't + computed/fit for bitrate management goes in the second psy + vector. This includes tone masking, peak limiting and ATH */ + + _vp_tonemask(psy_look, + logfft, + tone, + global_ampmax, + local_ampmax[i]); + +#if 0 + if(vi->channels==2){ + if(i==0) + _analysis_output("toneL",seq,tone,n/2,1,0,0); + else + _analysis_output("toneR",seq,tone,n/2,1,0,0); + } +#endif + + /* third step; we offset the noise vectors, overlay tone + masking. We then do a floor1-specific line fit. If we're + performing bitrate management, the line fit is performed + multiple times for up/down tweakage on demand. */ + +#if 0 + { + float aotuv[psy_look->n]; +#endif + + _vp_offset_and_mix(psy_look, + noise, + tone, + 1, + logmask, + mdct, + logmdct); + +#if 0 + if(vi->channels==2){ + if(i==0) + _analysis_output("aotuvM1_L",seq,aotuv,psy_look->n,1,1,0); + else + _analysis_output("aotuvM1_R",seq,aotuv,psy_look->n,1,1,0); + } + } +#endif + + +#if 0 + if(vi->channels==2){ + if(i==0) + _analysis_output("mask1L",seq,logmask,n/2,1,0,0); + else + _analysis_output("mask1R",seq,logmask,n/2,1,0,0); + } +#endif + + /* this algorithm is hardwired to floor 1 for now; abort out if + we're *not* floor1. This won't happen unless someone has + broken the encode setup lib. Guard it anyway. */ + if(ci->floor_type[info->floorsubmap[submap]]!=1)return(-1); + + floor_posts[i][PACKETBLOBS/2]= + floor1_fit(vb,b->flr[info->floorsubmap[submap]], + logmdct, + logmask); + + /* are we managing bitrate? If so, perform two more fits for + later rate tweaking (fits represent hi/lo) */ + if(vorbis_bitrate_managed(vb) && floor_posts[i][PACKETBLOBS/2]){ + /* higher rate by way of lower noise curve */ + + _vp_offset_and_mix(psy_look, + noise, + tone, + 2, + logmask, + mdct, + logmdct); + +#if 0 + if(vi->channels==2){ + if(i==0) + _analysis_output("mask2L",seq,logmask,n/2,1,0,0); + else + _analysis_output("mask2R",seq,logmask,n/2,1,0,0); + } +#endif + + floor_posts[i][PACKETBLOBS-1]= + floor1_fit(vb,b->flr[info->floorsubmap[submap]], + logmdct, + logmask); + + /* lower rate by way of higher noise curve */ + _vp_offset_and_mix(psy_look, + noise, + tone, + 0, + logmask, + mdct, + logmdct); + +#if 0 + if(vi->channels==2) + if(i==0) + _analysis_output("mask0L",seq,logmask,n/2,1,0,0); + else + _analysis_output("mask0R",seq,logmask,n/2,1,0,0); +#endif + + floor_posts[i][0]= + floor1_fit(vb,b->flr[info->floorsubmap[submap]], + logmdct, + logmask); + + /* we also interpolate a range of intermediate curves for + intermediate rates */ + for(k=1;kflr[info->floorsubmap[submap]], + floor_posts[i][0], + floor_posts[i][PACKETBLOBS/2], + k*65536/(PACKETBLOBS/2)); + for(k=PACKETBLOBS/2+1;kflr[info->floorsubmap[submap]], + floor_posts[i][PACKETBLOBS/2], + floor_posts[i][PACKETBLOBS-1], + (k-PACKETBLOBS/2)*65536/(PACKETBLOBS/2)); + } + } + } + vbi->ampmax=global_ampmax; + + /* + the next phases are performed once for vbr-only and PACKETBLOB + times for bitrate managed modes. + + 1) encode actual mode being used + 2) encode the floor for each channel, compute coded mask curve/res + 3) normalize and couple. + 4) encode residue + 5) save packet bytes to the packetblob vector + + */ + + /* iterate over the many masking curve fits we've created */ + + { + float **res_bundle=alloca(sizeof(*res_bundle)*vi->channels); + float **couple_bundle=alloca(sizeof(*couple_bundle)*vi->channels); + int *zerobundle=alloca(sizeof(*zerobundle)*vi->channels); + int **sortindex=alloca(sizeof(*sortindex)*vi->channels); + float **mag_memo; + int **mag_sort; + + if(info->coupling_steps){ + mag_memo=_vp_quantize_couple_memo(vb, + &ci->psy_g_param, + psy_look, + info, + gmdct); + + mag_sort=_vp_quantize_couple_sort(vb, + psy_look, + info, + mag_memo); + + hf_reduction(&ci->psy_g_param, + psy_look, + info, + mag_memo); + } + + memset(sortindex,0,sizeof(*sortindex)*vi->channels); + if(psy_look->vi->normal_channel_p){ + for(i=0;ichannels;i++){ + float *mdct =gmdct[i]; + sortindex[i]=alloca(sizeof(**sortindex)*n/2); + _vp_noise_normalize_sort(psy_look,mdct,sortindex[i]); + } + } + + for(k=(vorbis_bitrate_managed(vb)?0:PACKETBLOBS/2); + k<=(vorbis_bitrate_managed(vb)?PACKETBLOBS-1:PACKETBLOBS/2); + k++){ + oggpack_buffer *opb=vbi->packetblob[k]; + + /* start out our new packet blob with packet type and mode */ + /* Encode the packet type */ + oggpack_write(opb,0,1); + /* Encode the modenumber */ + /* Encode frame mode, pre,post windowsize, then dispatch */ + oggpack_write(opb,modenumber,b->modebits); + if(vb->W){ + oggpack_write(opb,vb->lW,1); + oggpack_write(opb,vb->nW,1); + } + + /* encode floor, compute masking curve, sep out residue */ + for(i=0;ichannels;i++){ + int submap=info->chmuxlist[i]; + float *mdct =gmdct[i]; + float *res =vb->pcm[i]; + int *ilogmask=ilogmaskch[i]= + _vorbis_block_alloc(vb,n/2*sizeof(**gmdct)); + + nonzero[i]=floor1_encode(opb,vb,b->flr[info->floorsubmap[submap]], + floor_posts[i][k], + ilogmask); +#if 0 + { + char buf[80]; + sprintf(buf,"maskI%c%d",i?'R':'L',k); + float work[n/2]; + for(j=0;jpsy_g_param.sliding_lowpass[vb->W][k]); + + _vp_noise_normalize(psy_look,res,res+n/2,sortindex[i]); + + +#if 0 + { + char buf[80]; + float work[n/2]; + for(j=0;jcoupling_steps){ + _vp_couple(k, + &ci->psy_g_param, + psy_look, + info, + vb->pcm, + mag_memo, + mag_sort, + ilogmaskch, + nonzero, + ci->psy_g_param.sliding_lowpass[vb->W][k]); + } + + /* classify and encode by submap */ + for(i=0;isubmaps;i++){ + int ch_in_bundle=0; + long **classifications; + int resnum=info->residuesubmap[i]; + + for(j=0;jchannels;j++){ + if(info->chmuxlist[j]==i){ + zerobundle[ch_in_bundle]=0; + if(nonzero[j])zerobundle[ch_in_bundle]=1; + res_bundle[ch_in_bundle]=vb->pcm[j]; + couple_bundle[ch_in_bundle++]=vb->pcm[j]+n/2; + } + } + + classifications=_residue_P[ci->residue_type[resnum]]-> + class(vb,b->residue[resnum],couple_bundle,zerobundle,ch_in_bundle); + + _residue_P[ci->residue_type[resnum]]-> + forward(opb,vb,b->residue[resnum], + couple_bundle,NULL,zerobundle,ch_in_bundle,classifications); + } + + /* ok, done encoding. Next protopacket. */ + } + + } + +#if 0 + seq++; + total+=ci->blocksizes[vb->W]/4+ci->blocksizes[vb->nW]/4; +#endif + return(0); +} + +static int mapping0_inverse(vorbis_block *vb,vorbis_info_mapping *l){ + vorbis_dsp_state *vd=vb->vd; + vorbis_info *vi=vd->vi; + codec_setup_info *ci=vi->codec_setup; + private_state *b=vd->backend_state; + vorbis_info_mapping0 *info=(vorbis_info_mapping0 *)l; + int hs=ci->halfrate_flag; + + int i,j; + long n=vb->pcmend=ci->blocksizes[vb->W]; + + float **pcmbundle=alloca(sizeof(*pcmbundle)*vi->channels); + int *zerobundle=alloca(sizeof(*zerobundle)*vi->channels); + + int *nonzero =alloca(sizeof(*nonzero)*vi->channels); + void **floormemo=alloca(sizeof(*floormemo)*vi->channels); + + /* recover the spectral envelope; store it in the PCM vector for now */ + for(i=0;ichannels;i++){ + int submap=info->chmuxlist[i]; + floormemo[i]=_floor_P[ci->floor_type[info->floorsubmap[submap]]]-> + inverse1(vb,b->flr[info->floorsubmap[submap]]); + if(floormemo[i]) + nonzero[i]=1; + else + nonzero[i]=0; + memset(vb->pcm[i],0,sizeof(*vb->pcm[i])*n/2); + } + + /* channel coupling can 'dirty' the nonzero listing */ + for(i=0;icoupling_steps;i++){ + if(nonzero[info->coupling_mag[i]] || + nonzero[info->coupling_ang[i]]){ + nonzero[info->coupling_mag[i]]=1; + nonzero[info->coupling_ang[i]]=1; + } + } + + /* recover the residue into our working vectors */ + for(i=0;isubmaps;i++){ + int ch_in_bundle=0; + for(j=0;jchannels;j++){ + if(info->chmuxlist[j]==i){ + if(nonzero[j]) + zerobundle[ch_in_bundle]=1; + else + zerobundle[ch_in_bundle]=0; + pcmbundle[ch_in_bundle++]=vb->pcm[j]; + } + } + + _residue_P[ci->residue_type[info->residuesubmap[i]]]-> + inverse(vb,b->residue[info->residuesubmap[i]], + pcmbundle,zerobundle,ch_in_bundle); + } + + /* channel coupling */ + for(i=info->coupling_steps-1;i>=0;i--){ + float *pcmM=vb->pcm[info->coupling_mag[i]]; + float *pcmA=vb->pcm[info->coupling_ang[i]]; + + for(j=0;j0) + if(ang>0){ + pcmM[j]=mag; + pcmA[j]=mag-ang; + }else{ + pcmA[j]=mag; + pcmM[j]=mag+ang; + } + else + if(ang>0){ + pcmM[j]=mag; + pcmA[j]=mag+ang; + }else{ + pcmA[j]=mag; + pcmM[j]=mag-ang; + } + } + } + + /* compute and apply spectral envelope */ + for(i=0;ichannels;i++){ + float *pcm=vb->pcm[i]; + int submap=info->chmuxlist[i]; + _floor_P[ci->floor_type[info->floorsubmap[submap]]]-> + inverse2(vb,b->flr[info->floorsubmap[submap]], + floormemo[i],pcm); + } + + /* transform the PCM data; takes PCM vector, vb; modifies PCM vector */ + /* only MDCT right now.... */ + for(i=0;ichannels;i++){ + float *pcm=vb->pcm[i]; + mdct_backward(b->transform[vb->W][0],pcm,pcm); + } + + /* all done! */ + return(0); +} + +/* export hooks */ +vorbis_func_mapping mapping0_exportbundle={ + &mapping0_pack, + &mapping0_unpack, + &mapping0_free_info, + &mapping0_forward, + &mapping0_inverse +}; + diff --git a/Libraries/Vorbis/Files/lib/masking.h b/Libraries/Vorbis/Files/lib/masking.h new file mode 100644 index 000000000..ad64e5bd9 --- /dev/null +++ b/Libraries/Vorbis/Files/lib/masking.h @@ -0,0 +1,785 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * + * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * + * by the XIPHOPHORUS Company http://www.xiph.org/ * + * * + ******************************************************************** + + function: masking curve data for psychoacoustics + last mod: $Id$ + + ********************************************************************/ + +#ifndef _V_MASKING_H_ +#define _V_MASKING_H_ + +/* more detailed ATH; the bass if flat to save stressing the floor + overly for only a bin or two of savings. */ + +#define MAX_ATH 88 +static float ATH[]={ + /*15*/ -51, -52, -53, -54, -55, -56, -57, -58, + /*31*/ -59, -60, -61, -62, -63, -64, -65, -66, + /*63*/ -67, -68, -69, -70, -71, -72, -73, -74, + /*125*/ -75, -76, -77, -78, -80, -81, -82, -83, + /*250*/ -84, -85, -86, -87, -88, -88, -89, -89, + /*500*/ -90, -91, -91, -92, -93, -94, -95, -96, + /*1k*/ -96, -97, -98, -98, -99, -99,-100,-100, + /*2k*/ -101,-102,-103,-104,-106,-107,-107,-107, + /*4k*/ -107,-105,-103,-102,-101, -99, -98, -96, + /*8k*/ -95, -95, -96, -97, -96, -95, -93, -90, + /*16k*/ -80, -70, -50, -40, -30, -30, -30, -30 +}; + +/* The tone masking curves from Ehmer's and Fielder's papers have been + replaced by an empirically collected data set. The previously + published values were, far too often, simply on crack. */ + +#define EHMER_OFFSET 16 +#define EHMER_MAX 56 + +/* masking tones from -50 to 0dB, 62.5 through 16kHz at half octaves + test tones from -2 octaves to +5 octaves sampled at eighth octaves */ +/* (Vorbis 0dB, the loudest possible tone, is assumed to be ~100dB SPL + for collection of these curves) */ + +static float tonemasks[P_BANDS][6][EHMER_MAX]={ + /* 62.5 Hz */ + {{ -60, -60, -60, -60, -60, -60, -60, -60, + -60, -60, -60, -60, -62, -62, -65, -73, + -69, -68, -68, -67, -70, -70, -72, -74, + -75, -79, -79, -80, -83, -88, -93, -100, + -110, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + { -48, -48, -48, -48, -48, -48, -48, -48, + -48, -48, -48, -48, -48, -53, -61, -66, + -66, -68, -67, -70, -76, -76, -72, -73, + -75, -76, -78, -79, -83, -88, -93, -100, + -110, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + { -37, -37, -37, -37, -37, -37, -37, -37, + -38, -40, -42, -46, -48, -53, -55, -62, + -65, -58, -56, -56, -61, -60, -65, -67, + -69, -71, -77, -77, -78, -80, -82, -84, + -88, -93, -98, -106, -112, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + { -25, -25, -25, -25, -25, -25, -25, -25, + -25, -26, -27, -29, -32, -38, -48, -52, + -52, -50, -48, -48, -51, -52, -54, -60, + -67, -67, -66, -68, -69, -73, -73, -76, + -80, -81, -81, -85, -85, -86, -88, -93, + -100, -110, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + { -16, -16, -16, -16, -16, -16, -16, -16, + -17, -19, -20, -22, -26, -28, -31, -40, + -47, -39, -39, -40, -42, -43, -47, -51, + -57, -52, -55, -55, -60, -58, -62, -63, + -70, -67, -69, -72, -73, -77, -80, -82, + -83, -87, -90, -94, -98, -104, -115, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + { -8, -8, -8, -8, -8, -8, -8, -8, + -8, -8, -10, -11, -15, -19, -25, -30, + -34, -31, -30, -31, -29, -32, -35, -42, + -48, -42, -44, -46, -50, -50, -51, -52, + -59, -54, -55, -55, -58, -62, -63, -66, + -72, -73, -76, -75, -78, -80, -80, -81, + -84, -88, -90, -94, -98, -101, -106, -110}}, + /* 88Hz */ + {{ -66, -66, -66, -66, -66, -66, -66, -66, + -66, -66, -66, -66, -66, -67, -67, -67, + -76, -72, -71, -74, -76, -76, -75, -78, + -79, -79, -81, -83, -86, -89, -93, -97, + -100, -105, -110, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + { -47, -47, -47, -47, -47, -47, -47, -47, + -47, -47, -47, -48, -51, -55, -59, -66, + -66, -66, -67, -66, -68, -69, -70, -74, + -79, -77, -77, -78, -80, -81, -82, -84, + -86, -88, -91, -95, -100, -108, -116, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + { -36, -36, -36, -36, -36, -36, -36, -36, + -36, -37, -37, -41, -44, -48, -51, -58, + -62, -60, -57, -59, -59, -60, -63, -65, + -72, -71, -70, -72, -74, -77, -76, -78, + -81, -81, -80, -83, -86, -91, -96, -100, + -105, -110, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + { -28, -28, -28, -28, -28, -28, -28, -28, + -28, -30, -32, -32, -33, -35, -41, -49, + -50, -49, -47, -48, -48, -52, -51, -57, + -65, -61, -59, -61, -64, -69, -70, -74, + -77, -77, -78, -81, -84, -85, -87, -90, + -92, -96, -100, -107, -112, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + { -19, -19, -19, -19, -19, -19, -19, -19, + -20, -21, -23, -27, -30, -35, -36, -41, + -46, -44, -42, -40, -41, -41, -43, -48, + -55, -53, -52, -53, -56, -59, -58, -60, + -67, -66, -69, -71, -72, -75, -79, -81, + -84, -87, -90, -93, -97, -101, -107, -114, + -999, -999, -999, -999, -999, -999, -999, -999}, + { -9, -9, -9, -9, -9, -9, -9, -9, + -11, -12, -12, -15, -16, -20, -23, -30, + -37, -34, -33, -34, -31, -32, -32, -38, + -47, -44, -41, -40, -47, -49, -46, -46, + -58, -50, -50, -54, -58, -62, -64, -67, + -67, -70, -72, -76, -79, -83, -87, -91, + -96, -100, -104, -110, -999, -999, -999, -999}}, + /* 125 Hz */ + {{ -62, -62, -62, -62, -62, -62, -62, -62, + -62, -62, -63, -64, -66, -67, -66, -68, + -75, -72, -76, -75, -76, -78, -79, -82, + -84, -85, -90, -94, -101, -110, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + { -59, -59, -59, -59, -59, -59, -59, -59, + -59, -59, -59, -60, -60, -61, -63, -66, + -71, -68, -70, -70, -71, -72, -72, -75, + -81, -78, -79, -82, -83, -86, -90, -97, + -103, -113, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + { -53, -53, -53, -53, -53, -53, -53, -53, + -53, -54, -55, -57, -56, -57, -55, -61, + -65, -60, -60, -62, -63, -63, -66, -68, + -74, -73, -75, -75, -78, -80, -80, -82, + -85, -90, -96, -101, -108, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + { -46, -46, -46, -46, -46, -46, -46, -46, + -46, -46, -47, -47, -47, -47, -48, -51, + -57, -51, -49, -50, -51, -53, -54, -59, + -66, -60, -62, -67, -67, -70, -72, -75, + -76, -78, -81, -85, -88, -94, -97, -104, + -112, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + { -36, -36, -36, -36, -36, -36, -36, -36, + -39, -41, -42, -42, -39, -38, -41, -43, + -52, -44, -40, -39, -37, -37, -40, -47, + -54, -50, -48, -50, -55, -61, -59, -62, + -66, -66, -66, -69, -69, -73, -74, -74, + -75, -77, -79, -82, -87, -91, -95, -100, + -108, -115, -999, -999, -999, -999, -999, -999}, + { -28, -26, -24, -22, -20, -20, -23, -29, + -30, -31, -28, -27, -28, -28, -28, -35, + -40, -33, -32, -29, -30, -30, -30, -37, + -45, -41, -37, -38, -45, -47, -47, -48, + -53, -49, -48, -50, -49, -49, -51, -52, + -58, -56, -57, -56, -60, -61, -62, -70, + -72, -74, -78, -83, -88, -93, -100, -106}}, + /* 177 Hz */ + {{-999, -999, -999, -999, -999, -999, -999, -999, + -999, -110, -105, -100, -95, -91, -87, -83, + -80, -78, -76, -78, -78, -81, -83, -85, + -86, -85, -86, -87, -90, -97, -107, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + {-999, -999, -999, -110, -105, -100, -95, -90, + -85, -81, -77, -73, -70, -67, -67, -68, + -75, -73, -70, -69, -70, -72, -75, -79, + -84, -83, -84, -86, -88, -89, -89, -93, + -98, -105, -112, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + {-105, -100, -95, -90, -85, -80, -76, -71, + -68, -68, -65, -63, -63, -62, -62, -64, + -65, -64, -61, -62, -63, -64, -66, -68, + -73, -73, -74, -75, -76, -81, -83, -85, + -88, -89, -92, -95, -100, -108, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + { -80, -75, -71, -68, -65, -63, -62, -61, + -61, -61, -61, -59, -56, -57, -53, -50, + -58, -52, -50, -50, -52, -53, -54, -58, + -67, -63, -67, -68, -72, -75, -78, -80, + -81, -81, -82, -85, -89, -90, -93, -97, + -101, -107, -114, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + { -65, -61, -59, -57, -56, -55, -55, -56, + -56, -57, -55, -53, -52, -47, -44, -44, + -50, -44, -41, -39, -39, -42, -40, -46, + -51, -49, -50, -53, -54, -63, -60, -61, + -62, -66, -66, -66, -70, -73, -74, -75, + -76, -75, -79, -85, -89, -91, -96, -102, + -110, -999, -999, -999, -999, -999, -999, -999}, + { -52, -50, -49, -49, -48, -48, -48, -49, + -50, -50, -49, -46, -43, -39, -35, -33, + -38, -36, -32, -29, -32, -32, -32, -35, + -44, -39, -38, -38, -46, -50, -45, -46, + -53, -50, -50, -50, -54, -54, -53, -53, + -56, -57, -59, -66, -70, -72, -74, -79, + -83, -85, -90, -97, -114, -999, -999, -999}}, + /* 250 Hz */ + {{-999, -999, -999, -999, -999, -999, -110, -105, + -100, -95, -90, -86, -80, -75, -75, -79, + -80, -79, -80, -81, -82, -88, -95, -103, + -110, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + {-999, -999, -999, -999, -108, -103, -98, -93, + -88, -83, -79, -78, -75, -71, -67, -68, + -73, -73, -72, -73, -75, -77, -80, -82, + -88, -93, -100, -107, -114, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + {-999, -999, -999, -110, -105, -101, -96, -90, + -86, -81, -77, -73, -69, -66, -61, -62, + -66, -64, -62, -65, -66, -70, -72, -76, + -81, -80, -84, -90, -95, -102, -110, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + {-999, -999, -999, -107, -103, -97, -92, -88, + -83, -79, -74, -70, -66, -59, -53, -58, + -62, -55, -54, -54, -54, -58, -61, -62, + -72, -70, -72, -75, -78, -80, -81, -80, + -83, -83, -88, -93, -100, -107, -115, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + {-999, -999, -999, -105, -100, -95, -90, -85, + -80, -75, -70, -66, -62, -56, -48, -44, + -48, -46, -46, -43, -46, -48, -48, -51, + -58, -58, -59, -60, -62, -62, -61, -61, + -65, -64, -65, -68, -70, -74, -75, -78, + -81, -86, -95, -110, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + {-999, -999, -105, -100, -95, -90, -85, -80, + -75, -70, -65, -61, -55, -49, -39, -33, + -40, -35, -32, -38, -40, -33, -35, -37, + -46, -41, -45, -44, -46, -42, -45, -46, + -52, -50, -50, -50, -54, -54, -55, -57, + -62, -64, -66, -68, -70, -76, -81, -90, + -100, -110, -999, -999, -999, -999, -999, -999}}, + /* 354 hz */ + {{-999, -999, -999, -999, -999, -999, -999, -999, + -105, -98, -90, -85, -82, -83, -80, -78, + -84, -79, -80, -83, -87, -89, -91, -93, + -99, -106, -117, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + {-999, -999, -999, -999, -999, -999, -999, -999, + -105, -98, -90, -85, -80, -75, -70, -68, + -74, -72, -74, -77, -80, -82, -85, -87, + -92, -89, -91, -95, -100, -106, -112, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + {-999, -999, -999, -999, -999, -999, -999, -999, + -105, -98, -90, -83, -75, -71, -63, -64, + -67, -62, -64, -67, -70, -73, -77, -81, + -84, -83, -85, -89, -90, -93, -98, -104, + -109, -114, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + {-999, -999, -999, -999, -999, -999, -999, -999, + -103, -96, -88, -81, -75, -68, -58, -54, + -56, -54, -56, -56, -58, -60, -63, -66, + -74, -69, -72, -72, -75, -74, -77, -81, + -81, -82, -84, -87, -93, -96, -99, -104, + -110, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + {-999, -999, -999, -999, -999, -108, -102, -96, + -91, -85, -80, -74, -68, -60, -51, -46, + -48, -46, -43, -45, -47, -47, -49, -48, + -56, -53, -55, -58, -57, -63, -58, -60, + -66, -64, -67, -70, -70, -74, -77, -84, + -86, -89, -91, -93, -94, -101, -109, -118, + -999, -999, -999, -999, -999, -999, -999, -999}, + {-999, -999, -999, -108, -103, -98, -93, -88, + -83, -78, -73, -68, -60, -53, -44, -35, + -38, -38, -34, -34, -36, -40, -41, -44, + -51, -45, -46, -47, -46, -54, -50, -49, + -50, -50, -50, -51, -54, -57, -58, -60, + -66, -66, -66, -64, -65, -68, -77, -82, + -87, -95, -110, -999, -999, -999, -999, -999}}, + /* 500 Hz */ + {{-999, -999, -999, -999, -999, -999, -999, -999, + -107, -102, -97, -92, -87, -83, -78, -75, + -82, -79, -83, -85, -89, -92, -95, -98, + -101, -105, -109, -113, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + {-999, -999, -999, -999, -999, -999, -999, -106, + -100, -95, -90, -86, -81, -78, -74, -69, + -74, -74, -76, -79, -83, -84, -86, -89, + -92, -97, -93, -100, -103, -107, -110, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + {-999, -999, -999, -999, -999, -999, -106, -100, + -95, -90, -87, -83, -80, -75, -69, -60, + -66, -66, -68, -70, -74, -78, -79, -81, + -81, -83, -84, -87, -93, -96, -99, -103, + -107, -110, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + {-999, -999, -999, -999, -999, -108, -103, -98, + -93, -89, -85, -82, -78, -71, -62, -55, + -58, -58, -54, -54, -55, -59, -61, -62, + -70, -66, -66, -67, -70, -72, -75, -78, + -84, -84, -84, -88, -91, -90, -95, -98, + -102, -103, -106, -110, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + {-999, -999, -999, -999, -108, -103, -98, -94, + -90, -87, -82, -79, -73, -67, -58, -47, + -50, -45, -41, -45, -48, -44, -44, -49, + -54, -51, -48, -47, -49, -50, -51, -57, + -58, -60, -63, -69, -70, -69, -71, -74, + -78, -82, -90, -95, -101, -105, -110, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + {-999, -999, -999, -105, -101, -97, -93, -90, + -85, -80, -77, -72, -65, -56, -48, -37, + -40, -36, -34, -40, -50, -47, -38, -41, + -47, -38, -35, -39, -38, -43, -40, -45, + -50, -45, -44, -47, -50, -55, -48, -48, + -52, -66, -70, -76, -82, -90, -97, -105, + -110, -999, -999, -999, -999, -999, -999, -999}}, + /* 707 Hz */ + {{-999, -999, -999, -999, -999, -999, -999, -999, + -999, -108, -103, -98, -93, -86, -79, -76, + -83, -81, -85, -87, -89, -93, -98, -102, + -107, -112, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + {-999, -999, -999, -999, -999, -999, -999, -999, + -999, -108, -103, -98, -93, -86, -79, -71, + -77, -74, -77, -79, -81, -84, -85, -90, + -92, -93, -92, -98, -101, -108, -112, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + {-999, -999, -999, -999, -999, -999, -999, -999, + -108, -103, -98, -93, -87, -78, -68, -65, + -66, -62, -65, -67, -70, -73, -75, -78, + -82, -82, -83, -84, -91, -93, -98, -102, + -106, -110, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + {-999, -999, -999, -999, -999, -999, -999, -999, + -105, -100, -95, -90, -82, -74, -62, -57, + -58, -56, -51, -52, -52, -54, -54, -58, + -66, -59, -60, -63, -66, -69, -73, -79, + -83, -84, -80, -81, -81, -82, -88, -92, + -98, -105, -113, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + {-999, -999, -999, -999, -999, -999, -999, -107, + -102, -97, -92, -84, -79, -69, -57, -47, + -52, -47, -44, -45, -50, -52, -42, -42, + -53, -43, -43, -48, -51, -56, -55, -52, + -57, -59, -61, -62, -67, -71, -78, -83, + -86, -94, -98, -103, -110, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + {-999, -999, -999, -999, -999, -999, -105, -100, + -95, -90, -84, -78, -70, -61, -51, -41, + -40, -38, -40, -46, -52, -51, -41, -40, + -46, -40, -38, -38, -41, -46, -41, -46, + -47, -43, -43, -45, -41, -45, -56, -67, + -68, -83, -87, -90, -95, -102, -107, -113, + -999, -999, -999, -999, -999, -999, -999, -999}}, + /* 1000 Hz */ + {{-999, -999, -999, -999, -999, -999, -999, -999, + -999, -109, -105, -101, -96, -91, -84, -77, + -82, -82, -85, -89, -94, -100, -106, -110, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + {-999, -999, -999, -999, -999, -999, -999, -999, + -999, -106, -103, -98, -92, -85, -80, -71, + -75, -72, -76, -80, -84, -86, -89, -93, + -100, -107, -113, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + {-999, -999, -999, -999, -999, -999, -999, -107, + -104, -101, -97, -92, -88, -84, -80, -64, + -66, -63, -64, -66, -69, -73, -77, -83, + -83, -86, -91, -98, -104, -111, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + {-999, -999, -999, -999, -999, -999, -999, -107, + -104, -101, -97, -92, -90, -84, -74, -57, + -58, -52, -55, -54, -50, -52, -50, -52, + -63, -62, -69, -76, -77, -78, -78, -79, + -82, -88, -94, -100, -106, -111, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + {-999, -999, -999, -999, -999, -999, -106, -102, + -98, -95, -90, -85, -83, -78, -70, -50, + -50, -41, -44, -49, -47, -50, -50, -44, + -55, -46, -47, -48, -48, -54, -49, -49, + -58, -62, -71, -81, -87, -92, -97, -102, + -108, -114, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + {-999, -999, -999, -999, -999, -999, -106, -102, + -98, -95, -90, -85, -83, -78, -70, -45, + -43, -41, -47, -50, -51, -50, -49, -45, + -47, -41, -44, -41, -39, -43, -38, -37, + -40, -41, -44, -50, -58, -65, -73, -79, + -85, -92, -97, -101, -105, -109, -113, -999, + -999, -999, -999, -999, -999, -999, -999, -999}}, + /* 1414 Hz */ + {{-999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -107, -100, -95, -87, -81, + -85, -83, -88, -93, -100, -107, -114, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + {-999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -107, -101, -95, -88, -83, -76, + -73, -72, -79, -84, -90, -95, -100, -105, + -110, -115, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + {-999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -104, -98, -92, -87, -81, -70, + -65, -62, -67, -71, -74, -80, -85, -91, + -95, -99, -103, -108, -111, -114, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + {-999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -103, -97, -90, -85, -76, -60, + -56, -54, -60, -62, -61, -56, -63, -65, + -73, -74, -77, -75, -78, -81, -86, -87, + -88, -91, -94, -98, -103, -110, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + {-999, -999, -999, -999, -999, -999, -999, -105, + -100, -97, -92, -86, -81, -79, -70, -57, + -51, -47, -51, -58, -60, -56, -53, -50, + -58, -52, -50, -50, -53, -55, -64, -69, + -71, -85, -82, -78, -81, -85, -95, -102, + -112, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + {-999, -999, -999, -999, -999, -999, -999, -105, + -100, -97, -92, -85, -83, -79, -72, -49, + -40, -43, -43, -54, -56, -51, -50, -40, + -43, -38, -36, -35, -37, -38, -37, -44, + -54, -60, -57, -60, -70, -75, -84, -92, + -103, -112, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}}, + /* 2000 Hz */ + {{-999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -110, -102, -95, -89, -82, + -83, -84, -90, -92, -99, -107, -113, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + {-999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -107, -101, -95, -89, -83, -72, + -74, -78, -85, -88, -88, -90, -92, -98, + -105, -111, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + {-999, -999, -999, -999, -999, -999, -999, -999, + -999, -109, -103, -97, -93, -87, -81, -70, + -70, -67, -75, -73, -76, -79, -81, -83, + -88, -89, -97, -103, -110, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + {-999, -999, -999, -999, -999, -999, -999, -999, + -999, -107, -100, -94, -88, -83, -75, -63, + -59, -59, -63, -66, -60, -62, -67, -67, + -77, -76, -81, -88, -86, -92, -96, -102, + -109, -116, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + {-999, -999, -999, -999, -999, -999, -999, -999, + -999, -105, -98, -92, -86, -81, -73, -56, + -52, -47, -55, -60, -58, -52, -51, -45, + -49, -50, -53, -54, -61, -71, -70, -69, + -78, -79, -87, -90, -96, -104, -112, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + {-999, -999, -999, -999, -999, -999, -999, -999, + -999, -103, -96, -90, -86, -78, -70, -51, + -42, -47, -48, -55, -54, -54, -53, -42, + -35, -28, -33, -38, -37, -44, -47, -49, + -54, -63, -68, -78, -82, -89, -94, -99, + -104, -109, -114, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}}, + /* 2828 Hz */ + {{-999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -110, -100, -90, -79, + -85, -81, -82, -82, -89, -94, -99, -103, + -109, -115, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + {-999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -105, -97, -85, -72, + -74, -70, -70, -70, -76, -85, -91, -93, + -97, -103, -109, -115, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + {-999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -112, -93, -81, -68, + -62, -60, -60, -57, -63, -70, -77, -82, + -90, -93, -98, -104, -109, -113, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + {-999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -113, -100, -93, -84, -63, + -58, -48, -53, -54, -52, -52, -57, -64, + -66, -76, -83, -81, -85, -85, -90, -95, + -98, -101, -103, -106, -108, -111, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + {-999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -105, -95, -86, -74, -53, + -50, -38, -43, -49, -43, -42, -39, -39, + -46, -52, -57, -56, -72, -69, -74, -81, + -87, -92, -94, -97, -99, -102, -105, -108, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + {-999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -108, -99, -90, -76, -66, -45, + -43, -41, -44, -47, -43, -47, -40, -30, + -31, -31, -39, -33, -40, -41, -43, -53, + -59, -70, -73, -77, -79, -82, -84, -87, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}}, + /* 4000 Hz */ + {{-999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -110, -91, -76, + -75, -85, -93, -98, -104, -110, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + {-999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -110, -91, -70, + -70, -75, -86, -89, -94, -98, -101, -106, + -110, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + {-999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -110, -95, -80, -60, + -65, -64, -74, -83, -88, -91, -95, -99, + -103, -107, -110, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + {-999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -110, -95, -80, -58, + -55, -49, -66, -68, -71, -78, -78, -80, + -88, -85, -89, -97, -100, -105, -110, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + {-999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -110, -95, -80, -53, + -52, -41, -59, -59, -49, -58, -56, -63, + -86, -79, -90, -93, -98, -103, -107, -112, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + {-999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -110, -97, -91, -73, -45, + -40, -33, -53, -61, -49, -54, -50, -50, + -60, -52, -67, -74, -81, -92, -96, -100, + -105, -110, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}}, + /* 5657 Hz */ + {{-999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -113, -106, -99, -92, -77, + -80, -88, -97, -106, -115, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + {-999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -116, -109, -102, -95, -89, -74, + -72, -88, -87, -95, -102, -109, -116, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + {-999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -116, -109, -102, -95, -89, -75, + -66, -74, -77, -78, -86, -87, -90, -96, + -105, -115, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + {-999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -115, -108, -101, -94, -88, -66, + -56, -61, -70, -65, -78, -72, -83, -84, + -93, -98, -105, -110, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + {-999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -110, -105, -95, -89, -82, -57, + -52, -52, -59, -56, -59, -58, -69, -67, + -88, -82, -82, -89, -94, -100, -108, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + {-999, -999, -999, -999, -999, -999, -999, -999, + -999, -110, -101, -96, -90, -83, -77, -54, + -43, -38, -50, -48, -52, -48, -42, -42, + -51, -52, -53, -59, -65, -71, -78, -85, + -95, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}}, + /* 8000 Hz */ + {{-999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -120, -105, -86, -68, + -78, -79, -90, -100, -110, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + {-999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -120, -105, -86, -66, + -73, -77, -88, -96, -105, -115, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + {-999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -120, -105, -92, -80, -61, + -64, -68, -80, -87, -92, -100, -110, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + {-999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -120, -104, -91, -79, -52, + -60, -54, -64, -69, -77, -80, -82, -84, + -85, -87, -88, -90, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + {-999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -118, -100, -87, -77, -49, + -50, -44, -58, -61, -61, -67, -65, -62, + -62, -62, -65, -68, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + {-999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -115, -98, -84, -62, -49, + -44, -38, -46, -49, -49, -46, -39, -37, + -39, -40, -42, -43, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}}, + /* 11314 Hz */ + {{-999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -110, -88, -74, + -77, -82, -82, -85, -90, -94, -99, -104, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + {-999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -110, -88, -66, + -70, -81, -80, -81, -84, -88, -91, -93, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + {-999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -110, -88, -61, + -63, -70, -71, -74, -77, -80, -83, -85, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + {-999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -110, -86, -62, + -63, -62, -62, -58, -52, -50, -50, -52, + -54, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + {-999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -118, -108, -84, -53, + -50, -50, -50, -55, -47, -45, -40, -40, + -40, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + {-999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -118, -100, -73, -43, + -37, -42, -43, -53, -38, -37, -35, -35, + -38, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}}, + /* 16000 Hz */ + {{-999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -110, -100, -91, -84, -74, + -80, -80, -80, -80, -80, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + {-999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -110, -100, -91, -84, -74, + -68, -68, -68, -68, -68, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + {-999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -110, -100, -86, -78, -70, + -60, -45, -30, -21, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + {-999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -110, -100, -87, -78, -67, + -48, -38, -29, -21, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + {-999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -110, -100, -86, -69, -56, + -45, -35, -33, -29, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}, + {-999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -110, -100, -83, -71, -48, + -27, -38, -37, -34, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999, + -999, -999, -999, -999, -999, -999, -999, -999}} +}; + +#endif diff --git a/Libraries/Vorbis/Files/lib/mdct.c b/Libraries/Vorbis/Files/lib/mdct.c new file mode 100644 index 000000000..0f4483156 --- /dev/null +++ b/Libraries/Vorbis/Files/lib/mdct.c @@ -0,0 +1,564 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * + * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * + * by the XIPHOPHORUS Company http://www.xiph.org/ * + * * + ******************************************************************** + + function: normalized modified discrete cosine transform + power of two length transform only [64 <= n ] + last mod: $Id$ + + Original algorithm adapted long ago from _The use of multirate filter + banks for coding of high quality digital audio_, by T. Sporer, + K. Brandenburg and B. Edler, collection of the European Signal + Processing Conference (EUSIPCO), Amsterdam, June 1992, Vol.1, pp + 211-214 + + The below code implements an algorithm that no longer looks much like + that presented in the paper, but the basic structure remains if you + dig deep enough to see it. + + This module DOES NOT INCLUDE code to generate/apply the window + function. Everybody has their own weird favorite including me... I + happen to like the properties of y=sin(.5PI*sin^2(x)), but others may + vehemently disagree. + + ********************************************************************/ + +/* this can also be run as an integer transform by uncommenting a + define in mdct.h; the integerization is a first pass and although + it's likely stable for Vorbis, the dynamic range is constrained and + roundoff isn't done (so it's noisy). Consider it functional, but + only a starting point. There's no point on a machine with an FPU */ + +#include +#include +#include +#include +#include "vorbis/codec.h" +#include "mdct.h" +#include "os.h" +#include "misc.h" + +/* build lookups for trig functions; also pre-figure scaling and + some window function algebra. */ + +void mdct_init(mdct_lookup *lookup,int n){ + int *bitrev=_ogg_malloc(sizeof(*bitrev)*(n/4)); + DATA_TYPE *T=_ogg_malloc(sizeof(*T)*(n+n/4)); + + int i; + int n2=n>>1; + int log2n=lookup->log2n=rint(log((float)n)/log(2.f)); + lookup->n=n; + lookup->trig=T; + lookup->bitrev=bitrev; + +/* trig lookups... */ + + for(i=0;i>j;j++) + if((msb>>j)&i)acc|=1<scale=FLOAT_CONV(4.f/n); +} + +/* 8 point butterfly (in place, 4 register) */ +STIN void mdct_butterfly_8(DATA_TYPE *x){ + REG_TYPE r0 = x[6] + x[2]; + REG_TYPE r1 = x[6] - x[2]; + REG_TYPE r2 = x[4] + x[0]; + REG_TYPE r3 = x[4] - x[0]; + + x[6] = r0 + r2; + x[4] = r0 - r2; + + r0 = x[5] - x[1]; + r2 = x[7] - x[3]; + x[0] = r1 + r0; + x[2] = r1 - r0; + + r0 = x[5] + x[1]; + r1 = x[7] + x[3]; + x[3] = r2 + r3; + x[1] = r2 - r3; + x[7] = r1 + r0; + x[5] = r1 - r0; + +} + +/* 16 point butterfly (in place, 4 register) */ +STIN void mdct_butterfly_16(DATA_TYPE *x){ + REG_TYPE r0 = x[1] - x[9]; + REG_TYPE r1 = x[0] - x[8]; + + x[8] += x[0]; + x[9] += x[1]; + x[0] = MULT_NORM((r0 + r1) * cPI2_8); + x[1] = MULT_NORM((r0 - r1) * cPI2_8); + + r0 = x[3] - x[11]; + r1 = x[10] - x[2]; + x[10] += x[2]; + x[11] += x[3]; + x[2] = r0; + x[3] = r1; + + r0 = x[12] - x[4]; + r1 = x[13] - x[5]; + x[12] += x[4]; + x[13] += x[5]; + x[4] = MULT_NORM((r0 - r1) * cPI2_8); + x[5] = MULT_NORM((r0 + r1) * cPI2_8); + + r0 = x[14] - x[6]; + r1 = x[15] - x[7]; + x[14] += x[6]; + x[15] += x[7]; + x[6] = r0; + x[7] = r1; + + mdct_butterfly_8(x); + mdct_butterfly_8(x+8); +} + +/* 32 point butterfly (in place, 4 register) */ +STIN void mdct_butterfly_32(DATA_TYPE *x){ + REG_TYPE r0 = x[30] - x[14]; + REG_TYPE r1 = x[31] - x[15]; + + x[30] += x[14]; + x[31] += x[15]; + x[14] = r0; + x[15] = r1; + + r0 = x[28] - x[12]; + r1 = x[29] - x[13]; + x[28] += x[12]; + x[29] += x[13]; + x[12] = MULT_NORM( r0 * cPI1_8 - r1 * cPI3_8 ); + x[13] = MULT_NORM( r0 * cPI3_8 + r1 * cPI1_8 ); + + r0 = x[26] - x[10]; + r1 = x[27] - x[11]; + x[26] += x[10]; + x[27] += x[11]; + x[10] = MULT_NORM(( r0 - r1 ) * cPI2_8); + x[11] = MULT_NORM(( r0 + r1 ) * cPI2_8); + + r0 = x[24] - x[8]; + r1 = x[25] - x[9]; + x[24] += x[8]; + x[25] += x[9]; + x[8] = MULT_NORM( r0 * cPI3_8 - r1 * cPI1_8 ); + x[9] = MULT_NORM( r1 * cPI3_8 + r0 * cPI1_8 ); + + r0 = x[22] - x[6]; + r1 = x[7] - x[23]; + x[22] += x[6]; + x[23] += x[7]; + x[6] = r1; + x[7] = r0; + + r0 = x[4] - x[20]; + r1 = x[5] - x[21]; + x[20] += x[4]; + x[21] += x[5]; + x[4] = MULT_NORM( r1 * cPI1_8 + r0 * cPI3_8 ); + x[5] = MULT_NORM( r1 * cPI3_8 - r0 * cPI1_8 ); + + r0 = x[2] - x[18]; + r1 = x[3] - x[19]; + x[18] += x[2]; + x[19] += x[3]; + x[2] = MULT_NORM(( r1 + r0 ) * cPI2_8); + x[3] = MULT_NORM(( r1 - r0 ) * cPI2_8); + + r0 = x[0] - x[16]; + r1 = x[1] - x[17]; + x[16] += x[0]; + x[17] += x[1]; + x[0] = MULT_NORM( r1 * cPI3_8 + r0 * cPI1_8 ); + x[1] = MULT_NORM( r1 * cPI1_8 - r0 * cPI3_8 ); + + mdct_butterfly_16(x); + mdct_butterfly_16(x+16); + +} + +/* N point first stage butterfly (in place, 2 register) */ +STIN void mdct_butterfly_first(DATA_TYPE *T, + DATA_TYPE *x, + int points){ + + DATA_TYPE *x1 = x + points - 8; + DATA_TYPE *x2 = x + (points>>1) - 8; + REG_TYPE r0; + REG_TYPE r1; + + do{ + + r0 = x1[6] - x2[6]; + r1 = x1[7] - x2[7]; + x1[6] += x2[6]; + x1[7] += x2[7]; + x2[6] = MULT_NORM(r1 * T[1] + r0 * T[0]); + x2[7] = MULT_NORM(r1 * T[0] - r0 * T[1]); + + r0 = x1[4] - x2[4]; + r1 = x1[5] - x2[5]; + x1[4] += x2[4]; + x1[5] += x2[5]; + x2[4] = MULT_NORM(r1 * T[5] + r0 * T[4]); + x2[5] = MULT_NORM(r1 * T[4] - r0 * T[5]); + + r0 = x1[2] - x2[2]; + r1 = x1[3] - x2[3]; + x1[2] += x2[2]; + x1[3] += x2[3]; + x2[2] = MULT_NORM(r1 * T[9] + r0 * T[8]); + x2[3] = MULT_NORM(r1 * T[8] - r0 * T[9]); + + r0 = x1[0] - x2[0]; + r1 = x1[1] - x2[1]; + x1[0] += x2[0]; + x1[1] += x2[1]; + x2[0] = MULT_NORM(r1 * T[13] + r0 * T[12]); + x2[1] = MULT_NORM(r1 * T[12] - r0 * T[13]); + + x1-=8; + x2-=8; + T+=16; + + }while(x2>=x); +} + +/* N/stage point generic N stage butterfly (in place, 2 register) */ +STIN void mdct_butterfly_generic(DATA_TYPE *T, + DATA_TYPE *x, + int points, + int trigint){ + + DATA_TYPE *x1 = x + points - 8; + DATA_TYPE *x2 = x + (points>>1) - 8; + REG_TYPE r0; + REG_TYPE r1; + + do{ + + r0 = x1[6] - x2[6]; + r1 = x1[7] - x2[7]; + x1[6] += x2[6]; + x1[7] += x2[7]; + x2[6] = MULT_NORM(r1 * T[1] + r0 * T[0]); + x2[7] = MULT_NORM(r1 * T[0] - r0 * T[1]); + + T+=trigint; + + r0 = x1[4] - x2[4]; + r1 = x1[5] - x2[5]; + x1[4] += x2[4]; + x1[5] += x2[5]; + x2[4] = MULT_NORM(r1 * T[1] + r0 * T[0]); + x2[5] = MULT_NORM(r1 * T[0] - r0 * T[1]); + + T+=trigint; + + r0 = x1[2] - x2[2]; + r1 = x1[3] - x2[3]; + x1[2] += x2[2]; + x1[3] += x2[3]; + x2[2] = MULT_NORM(r1 * T[1] + r0 * T[0]); + x2[3] = MULT_NORM(r1 * T[0] - r0 * T[1]); + + T+=trigint; + + r0 = x1[0] - x2[0]; + r1 = x1[1] - x2[1]; + x1[0] += x2[0]; + x1[1] += x2[1]; + x2[0] = MULT_NORM(r1 * T[1] + r0 * T[0]); + x2[1] = MULT_NORM(r1 * T[0] - r0 * T[1]); + + T+=trigint; + x1-=8; + x2-=8; + + }while(x2>=x); +} + +STIN void mdct_butterflies(mdct_lookup *init, + DATA_TYPE *x, + int points){ + + DATA_TYPE *T=init->trig; + int stages=init->log2n-5; + int i,j; + + if(--stages>0){ + mdct_butterfly_first(T,x,points); + } + + for(i=1;--stages>0;i++){ + for(j=0;j<(1<>i)*j,points>>i,4<trig)_ogg_free(l->trig); + if(l->bitrev)_ogg_free(l->bitrev); + memset(l,0,sizeof(*l)); + } +} + +STIN void mdct_bitreverse(mdct_lookup *init, + DATA_TYPE *x){ + int n = init->n; + int *bit = init->bitrev; + DATA_TYPE *w0 = x; + DATA_TYPE *w1 = x = w0+(n>>1); + DATA_TYPE *T = init->trig+n; + + do{ + DATA_TYPE *x0 = x+bit[0]; + DATA_TYPE *x1 = x+bit[1]; + + REG_TYPE r0 = x0[1] - x1[1]; + REG_TYPE r1 = x0[0] + x1[0]; + REG_TYPE r2 = MULT_NORM(r1 * T[0] + r0 * T[1]); + REG_TYPE r3 = MULT_NORM(r1 * T[1] - r0 * T[0]); + + w1 -= 4; + + r0 = HALVE(x0[1] + x1[1]); + r1 = HALVE(x0[0] - x1[0]); + + w0[0] = r0 + r2; + w1[2] = r0 - r2; + w0[1] = r1 + r3; + w1[3] = r3 - r1; + + x0 = x+bit[2]; + x1 = x+bit[3]; + + r0 = x0[1] - x1[1]; + r1 = x0[0] + x1[0]; + r2 = MULT_NORM(r1 * T[2] + r0 * T[3]); + r3 = MULT_NORM(r1 * T[3] - r0 * T[2]); + + r0 = HALVE(x0[1] + x1[1]); + r1 = HALVE(x0[0] - x1[0]); + + w0[2] = r0 + r2; + w1[0] = r0 - r2; + w0[3] = r1 + r3; + w1[1] = r3 - r1; + + T += 4; + bit += 4; + w0 += 4; + + }while(w0n; + int n2=n>>1; + int n4=n>>2; + + /* rotate */ + + DATA_TYPE *iX = in+n2-7; + DATA_TYPE *oX = out+n2+n4; + DATA_TYPE *T = init->trig+n4; + + do{ + oX -= 4; + oX[0] = MULT_NORM(-iX[2] * T[3] - iX[0] * T[2]); + oX[1] = MULT_NORM (iX[0] * T[3] - iX[2] * T[2]); + oX[2] = MULT_NORM(-iX[6] * T[1] - iX[4] * T[0]); + oX[3] = MULT_NORM (iX[4] * T[1] - iX[6] * T[0]); + iX -= 8; + T += 4; + }while(iX>=in); + + iX = in+n2-8; + oX = out+n2+n4; + T = init->trig+n4; + + do{ + T -= 4; + oX[0] = MULT_NORM (iX[4] * T[3] + iX[6] * T[2]); + oX[1] = MULT_NORM (iX[4] * T[2] - iX[6] * T[3]); + oX[2] = MULT_NORM (iX[0] * T[1] + iX[2] * T[0]); + oX[3] = MULT_NORM (iX[0] * T[0] - iX[2] * T[1]); + iX -= 8; + oX += 4; + }while(iX>=in); + + mdct_butterflies(init,out+n2,n2); + mdct_bitreverse(init,out); + + /* roatate + window */ + + { + DATA_TYPE *oX1=out+n2+n4; + DATA_TYPE *oX2=out+n2+n4; + DATA_TYPE *iX =out; + T =init->trig+n2; + + do{ + oX1-=4; + + oX1[3] = MULT_NORM (iX[0] * T[1] - iX[1] * T[0]); + oX2[0] = -MULT_NORM (iX[0] * T[0] + iX[1] * T[1]); + + oX1[2] = MULT_NORM (iX[2] * T[3] - iX[3] * T[2]); + oX2[1] = -MULT_NORM (iX[2] * T[2] + iX[3] * T[3]); + + oX1[1] = MULT_NORM (iX[4] * T[5] - iX[5] * T[4]); + oX2[2] = -MULT_NORM (iX[4] * T[4] + iX[5] * T[5]); + + oX1[0] = MULT_NORM (iX[6] * T[7] - iX[7] * T[6]); + oX2[3] = -MULT_NORM (iX[6] * T[6] + iX[7] * T[7]); + + oX2+=4; + iX += 8; + T += 8; + }while(iXoX2); + } +} + +void mdct_forward(mdct_lookup *init, DATA_TYPE *in, DATA_TYPE *out){ + int n=init->n; + int n2=n>>1; + int n4=n>>2; + int n8=n>>3; + DATA_TYPE *w=alloca(n*sizeof(*w)); /* forward needs working space */ + DATA_TYPE *w2=w+n2; + + /* rotate */ + + /* window + rotate + step 1 */ + + REG_TYPE r0; + REG_TYPE r1; + DATA_TYPE *x0=in+n2+n4; + DATA_TYPE *x1=x0+1; + DATA_TYPE *T=init->trig+n2; + + int i=0; + + for(i=0;itrig+n2; + x0=out+n2; + + for(i=0;iscale); + x0[0] =MULT_NORM((w[0]*T[1]-w[1]*T[0])*init->scale); + w+=2; + T+=2; + } +} + diff --git a/Libraries/Vorbis/Files/lib/mdct.h b/Libraries/Vorbis/Files/lib/mdct.h new file mode 100644 index 000000000..0506b419a --- /dev/null +++ b/Libraries/Vorbis/Files/lib/mdct.h @@ -0,0 +1,83 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * + * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * + * by the XIPHOPHORUS Company http://www.xiph.org/ * + * * + ******************************************************************** + + function: modified discrete cosine transform prototypes + last mod: $Id$ + + ********************************************************************/ + +#ifndef _OGG_mdct_H_ +#define _OGG_mdct_H_ + +#include "vorbis/codec.h" + + + + + +/*#define MDCT_INTEGERIZED <- be warned there could be some hurt left here*/ +#ifdef MDCT_INTEGERIZED + +#define DATA_TYPE int +#define REG_TYPE register int +#define TRIGBITS 14 +#define cPI3_8 6270 +#define cPI2_8 11585 +#define cPI1_8 15137 + +#define FLOAT_CONV(x) ((int)((x)*(1<>TRIGBITS) +#define HALVE(x) ((x)>>1) + +#else + +#define DATA_TYPE float +#define REG_TYPE float +#define cPI3_8 .38268343236508977175F +#define cPI2_8 .70710678118654752441F +#define cPI1_8 .92387953251128675613F + +#define FLOAT_CONV(x) (x) +#define MULT_NORM(x) (x) +#define HALVE(x) ((x)*.5f) + +#endif + + +typedef struct { + int n; + int log2n; + + DATA_TYPE *trig; + int *bitrev; + + DATA_TYPE scale; +} mdct_lookup; + +extern void mdct_init(mdct_lookup *lookup,int n); +extern void mdct_clear(mdct_lookup *l); +extern void mdct_forward(mdct_lookup *init, DATA_TYPE *in, DATA_TYPE *out); +extern void mdct_backward(mdct_lookup *init, DATA_TYPE *in, DATA_TYPE *out); + +#endif + + + + + + + + + + + + diff --git a/Libraries/Vorbis/Files/lib/misc.c b/Libraries/Vorbis/Files/lib/misc.c new file mode 100644 index 000000000..ab3f0cea3 --- /dev/null +++ b/Libraries/Vorbis/Files/lib/misc.c @@ -0,0 +1,213 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * + * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * + * by the XIPHOPHORUS Company http://www.xiph.org/ * + * * + ********************************************************************/ + +#define HEAD_ALIGN 32 +#include +#include +#include +#include +#include "vorbis/codec.h" +#define MISC_C +#include "misc.h" +#include + +static pthread_mutex_t memlock=PTHREAD_MUTEX_INITIALIZER; +static void **pointers=NULL; +static long *insertlist=NULL; /* We can't embed this in the pointer list; + a pointer can have any value... */ + +static char **files=NULL; +static long *file_bytes=NULL; +static int filecount=0; + +static int ptop=0; +static int palloced=0; +static int pinsert=0; + +typedef struct { + char *file; + long line; + long ptr; + long bytes; +} head; + +long global_bytes=0; +long start_time=-1; + +static void *_insert(void *ptr,long bytes,char *file,long line){ + ((head *)ptr)->file=file; + ((head *)ptr)->line=line; + ((head *)ptr)->ptr=pinsert; + ((head *)ptr)->bytes=bytes-HEAD_ALIGN; + + pthread_mutex_lock(&memlock); + if(pinsert>=palloced){ + palloced+=64; + if(pointers){ + pointers=(void **)realloc(pointers,sizeof(void **)*palloced); + insertlist=(long *)realloc(insertlist,sizeof(long *)*palloced); + }else{ + pointers=(void **)malloc(sizeof(void **)*palloced); + insertlist=(long *)malloc(sizeof(long *)*palloced); + } + } + + pointers[pinsert]=ptr; + + if(pinsert==ptop) + pinsert=++ptop; + else + pinsert=insertlist[pinsert]; + +#ifdef _VDBG_GRAPHFILE + { + FILE *out; + struct timeval tv; + static struct timezone tz; + int i; + char buffer[80]; + gettimeofday(&tv,&tz); + + for(i=0;ifile; + long bytes =((head *)ptr)->bytes; + int i; + + gettimeofday(&tv,&tz); + fprintf(out,"%ld, %ld\n",-start_time+(tv.tv_sec*1000)+(tv.tv_usec/1000), + global_bytes); + fprintf(out,"%ld, %ld\n",-start_time+(tv.tv_sec*1000)+(tv.tv_usec/1000), + global_bytes-((head *)ptr)->bytes); + fclose(out); + + for(i=0;ibytes; + + insert=((head *)ptr)->ptr; + insertlist[insert]=pinsert; + pinsert=insert; + + if(pointers[insert]==NULL){ + fprintf(stderr,"DEBUGGING MALLOC ERROR: freeing previously freed memory\n"); + fprintf(stderr,"\t%s %ld\n",((head *)ptr)->file,((head *)ptr)->line); + } + + if(global_bytes<0){ + fprintf(stderr,"DEBUGGING MALLOC ERROR: freeing unmalloced memory\n"); + } + + pointers[insert]=NULL; + pthread_mutex_unlock(&memlock); +} + +void _VDBG_dump(void){ + int i; + pthread_mutex_lock(&memlock); + for(i=0;ifile,ptr->line); + } + + pthread_mutex_unlock(&memlock); +} + +extern void *_VDBG_malloc(void *ptr,long bytes,char *file,long line){ + bytes+=HEAD_ALIGN; + if(ptr){ + ptr-=HEAD_ALIGN; + _ripremove(ptr); + ptr=realloc(ptr,bytes); + }else{ + ptr=malloc(bytes); + memset(ptr,0,bytes); + } + return _insert(ptr,bytes,file,line); +} + +extern void _VDBG_free(void *ptr,char *file,long line){ + if(ptr){ + ptr-=HEAD_ALIGN; + _ripremove(ptr); + free(ptr); + } +} + diff --git a/Libraries/Vorbis/Files/lib/misc.h b/Libraries/Vorbis/Files/lib/misc.h new file mode 100644 index 000000000..b3a530104 --- /dev/null +++ b/Libraries/Vorbis/Files/lib/misc.h @@ -0,0 +1,52 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * + * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * + * by the XIPHOPHORUS Company http://www.xiph.org/ * + * * + ******************************************************************** + + function: miscellaneous prototypes + last mod: $Id$ + + ********************************************************************/ + +#ifndef _V_RANDOM_H_ +#define _V_RANDOM_H_ +#include "vorbis/codec.h" + +extern int analysis_noisy; + +extern void *_vorbis_block_alloc(vorbis_block *vb,long bytes); +extern void _vorbis_block_ripcord(vorbis_block *vb); +extern void _analysis_output(char *base,int i,float *v,int n,int bark,int dB, + ogg_int64_t off); + +#ifdef DEBUG_MALLOC + +#define _VDBG_GRAPHFILE "malloc.m" +extern void *_VDBG_malloc(void *ptr,long bytes,char *file,long line); +extern void _VDBG_free(void *ptr,char *file,long line); + +#ifndef MISC_C +#undef _ogg_malloc +#undef _ogg_calloc +#undef _ogg_realloc +#undef _ogg_free + +#define _ogg_malloc(x) _VDBG_malloc(NULL,(x),__FILE__,__LINE__) +#define _ogg_calloc(x,y) _VDBG_malloc(NULL,(x)*(y),__FILE__,__LINE__) +#define _ogg_realloc(x,y) _VDBG_malloc((x),(y),__FILE__,__LINE__) +#define _ogg_free(x) _VDBG_free((x),__FILE__,__LINE__) +#endif +#endif + +#endif + + + + diff --git a/Libraries/Vorbis/Files/lib/modes/.cvsignore b/Libraries/Vorbis/Files/lib/modes/.cvsignore new file mode 100644 index 000000000..282522db0 --- /dev/null +++ b/Libraries/Vorbis/Files/lib/modes/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/Libraries/Vorbis/Files/lib/modes/Makefile.am b/Libraries/Vorbis/Files/lib/modes/Makefile.am new file mode 100644 index 000000000..279a7f00a --- /dev/null +++ b/Libraries/Vorbis/Files/lib/modes/Makefile.am @@ -0,0 +1,6 @@ +## Process this file with automake to produce Makefile.in + +EXTRA_DIST = floor_all.h psych_44.h residue_44.h setup_11.h setup_32.h \ + setup_8.h psych_11.h psych_8.h residue_44u.h setup_16.h \ + setup_44.h setup_X.h psych_16.h residue_16.h residue_8.h \ + setup_22.h setup_44u.h diff --git a/Libraries/Vorbis/Files/lib/modes/floor_all.h b/Libraries/Vorbis/Files/lib/modes/floor_all.h new file mode 100644 index 000000000..9941bf0ae --- /dev/null +++ b/Libraries/Vorbis/Files/lib/modes/floor_all.h @@ -0,0 +1,248 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * + * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * + * by the XIPHOPHORUS Company http://www.xiph.org/ * + * * + ******************************************************************** + + function: key floor settings + last mod: $Id$ + + ********************************************************************/ + +#include "vorbis/codec.h" +#include "backends.h" +#include "books/floor/floor_books.h" + +static static_codebook *_floor_128x4_books[]={ + &_huff_book_line_128x4_class0, + &_huff_book_line_128x4_0sub0, + &_huff_book_line_128x4_0sub1, + &_huff_book_line_128x4_0sub2, + &_huff_book_line_128x4_0sub3, +}; +static static_codebook *_floor_256x4_books[]={ + &_huff_book_line_256x4_class0, + &_huff_book_line_256x4_0sub0, + &_huff_book_line_256x4_0sub1, + &_huff_book_line_256x4_0sub2, + &_huff_book_line_256x4_0sub3, +}; +static static_codebook *_floor_128x7_books[]={ + &_huff_book_line_128x7_class0, + &_huff_book_line_128x7_class1, + + &_huff_book_line_128x7_0sub1, + &_huff_book_line_128x7_0sub2, + &_huff_book_line_128x7_0sub3, + &_huff_book_line_128x7_1sub1, + &_huff_book_line_128x7_1sub2, + &_huff_book_line_128x7_1sub3, +}; +static static_codebook *_floor_256x7_books[]={ + &_huff_book_line_256x7_class0, + &_huff_book_line_256x7_class1, + + &_huff_book_line_256x7_0sub1, + &_huff_book_line_256x7_0sub2, + &_huff_book_line_256x7_0sub3, + &_huff_book_line_256x7_1sub1, + &_huff_book_line_256x7_1sub2, + &_huff_book_line_256x7_1sub3, +}; +static static_codebook *_floor_128x11_books[]={ + &_huff_book_line_128x11_class1, + &_huff_book_line_128x11_class2, + &_huff_book_line_128x11_class3, + + &_huff_book_line_128x11_0sub0, + &_huff_book_line_128x11_1sub0, + &_huff_book_line_128x11_1sub1, + &_huff_book_line_128x11_2sub1, + &_huff_book_line_128x11_2sub2, + &_huff_book_line_128x11_2sub3, + &_huff_book_line_128x11_3sub1, + &_huff_book_line_128x11_3sub2, + &_huff_book_line_128x11_3sub3, +}; +static static_codebook *_floor_128x17_books[]={ + &_huff_book_line_128x17_class1, + &_huff_book_line_128x17_class2, + &_huff_book_line_128x17_class3, + + &_huff_book_line_128x17_0sub0, + &_huff_book_line_128x17_1sub0, + &_huff_book_line_128x17_1sub1, + &_huff_book_line_128x17_2sub1, + &_huff_book_line_128x17_2sub2, + &_huff_book_line_128x17_2sub3, + &_huff_book_line_128x17_3sub1, + &_huff_book_line_128x17_3sub2, + &_huff_book_line_128x17_3sub3, +}; +static static_codebook *_floor_256x4low_books[]={ + &_huff_book_line_256x4low_class0, + &_huff_book_line_256x4low_0sub0, + &_huff_book_line_256x4low_0sub1, + &_huff_book_line_256x4low_0sub2, + &_huff_book_line_256x4low_0sub3, +}; +static static_codebook *_floor_1024x27_books[]={ + &_huff_book_line_1024x27_class1, + &_huff_book_line_1024x27_class2, + &_huff_book_line_1024x27_class3, + &_huff_book_line_1024x27_class4, + + &_huff_book_line_1024x27_0sub0, + &_huff_book_line_1024x27_1sub0, + &_huff_book_line_1024x27_1sub1, + &_huff_book_line_1024x27_2sub0, + &_huff_book_line_1024x27_2sub1, + &_huff_book_line_1024x27_3sub1, + &_huff_book_line_1024x27_3sub2, + &_huff_book_line_1024x27_3sub3, + &_huff_book_line_1024x27_4sub1, + &_huff_book_line_1024x27_4sub2, + &_huff_book_line_1024x27_4sub3, +}; +static static_codebook *_floor_2048x27_books[]={ + &_huff_book_line_2048x27_class1, + &_huff_book_line_2048x27_class2, + &_huff_book_line_2048x27_class3, + &_huff_book_line_2048x27_class4, + + &_huff_book_line_2048x27_0sub0, + &_huff_book_line_2048x27_1sub0, + &_huff_book_line_2048x27_1sub1, + &_huff_book_line_2048x27_2sub0, + &_huff_book_line_2048x27_2sub1, + &_huff_book_line_2048x27_3sub1, + &_huff_book_line_2048x27_3sub2, + &_huff_book_line_2048x27_3sub3, + &_huff_book_line_2048x27_4sub1, + &_huff_book_line_2048x27_4sub2, + &_huff_book_line_2048x27_4sub3, +}; + +static static_codebook *_floor_512x17_books[]={ + &_huff_book_line_512x17_class1, + &_huff_book_line_512x17_class2, + &_huff_book_line_512x17_class3, + + &_huff_book_line_512x17_0sub0, + &_huff_book_line_512x17_1sub0, + &_huff_book_line_512x17_1sub1, + &_huff_book_line_512x17_2sub1, + &_huff_book_line_512x17_2sub2, + &_huff_book_line_512x17_2sub3, + &_huff_book_line_512x17_3sub1, + &_huff_book_line_512x17_3sub2, + &_huff_book_line_512x17_3sub3, +}; + +static static_codebook **_floor_books[10]={ + _floor_128x4_books, + _floor_256x4_books, + _floor_128x7_books, + _floor_256x7_books, + _floor_128x11_books, + _floor_128x17_books, + _floor_256x4low_books, + _floor_1024x27_books, + _floor_2048x27_books, + _floor_512x17_books, +}; + +static vorbis_info_floor1 _floor[10]={ + /* 128 x 4 */ + { + 1,{0},{4},{2},{0}, + {{1,2,3,4}}, + 4,{0,128, 33,8,16,70}, + + 60,30,500, 1.,18., -1 + }, + /* 256 x 4 */ + { + 1,{0},{4},{2},{0}, + {{1,2,3,4}}, + 4,{0,256, 66,16,32,140}, + + 60,30,500, 1.,18., -1 + }, + /* 128 x 7 */ + { + 2,{0,1},{3,4},{2,2},{0,1}, + {{-1,2,3,4},{-1,5,6,7}}, + 4,{0,128, 14,4,58, 2,8,28,90}, + + 60,30,500, 1.,18., -1 + }, + /* 256 x 7 */ + { + 2,{0,1},{3,4},{2,2},{0,1}, + {{-1,2,3,4},{-1,5,6,7}}, + 4,{0,256, 28,8,116, 4,16,56,180}, + + 60,30,500, 1.,18., -1 + }, + /* 128 x 11 */ + { + 4,{0,1,2,3},{2,3,3,3},{0,1,2,2},{-1,0,1,2}, + {{3},{4,5},{-1,6,7,8},{-1,9,10,11}}, + + 2,{0,128, 8,33, 4,16,70, 2,6,12, 23,46,90}, + + 60,30,500, 1,18., -1 + }, + /* 128 x 17 */ + { + 6,{0,1,1,2,3,3},{2,3,3,3},{0,1,2,2},{-1,0,1,2}, + {{3},{4,5},{-1,6,7,8},{-1,9,10,11}}, + 2,{0,128, 12,46, 4,8,16, 23,33,70, 2,6,10, 14,19,28, 39,58,90}, + + 60,30,500, 1,18., -1 + }, + /* 256 x 4 (low bitrate version) */ + { + 1,{0},{4},{2},{0}, + {{1,2,3,4}}, + 4,{0,256, 66,16,32,140}, + + 60,30,500, 1.,18., -1 + }, + /* 1024 x 27 */ + { + 8,{0,1,2,2,3,3,4,4},{3,4,3,4,3},{0,1,1,2,2},{-1,0,1,2,3}, + {{4},{5,6},{7,8},{-1,9,10,11},{-1,12,13,14}}, + 2,{0,1024, 93,23,372, 6,46,186,750, 14,33,65, 130,260,556, + 3,10,18,28, 39,55,79,111, 158,220,312, 464,650,850}, + + 60,30,500, 3,18., -1 /* lowpass */ + }, + /* 2048 x 27 */ + { + 8,{0,1,2,2,3,3,4,4},{3,4,3,4,3},{0,1,1,2,2},{-1,0,1,2,3}, + {{4},{5,6},{7,8},{-1,9,10,11},{-1,12,13,14}}, + 2,{0,2048, 186,46,744, 12,92,372,1500, 28,66,130, 260,520,1112, + 6,20,36,56, 78,110,158,222, 316,440,624, 928,1300,1700}, + + 60,30,500, 3,18., -1 /* lowpass */ + }, + /* 512 x 17 */ + { + 6,{0,1,1,2,3,3},{2,3,3,3},{0,1,2,2},{-1,0,1,2}, + {{3},{4,5},{-1,6,7,8},{-1,9,10,11}}, + 2,{0,512, 46,186, 16,33,65, 93,130,278, + 7,23,39, 55,79,110, 156,232,360}, + + 60,30,500, 1,18., -1 /* lowpass! */ + }, + +}; + diff --git a/Libraries/Vorbis/Files/lib/modes/psych_11.h b/Libraries/Vorbis/Files/lib/modes/psych_11.h new file mode 100644 index 000000000..955c2ae98 --- /dev/null +++ b/Libraries/Vorbis/Files/lib/modes/psych_11.h @@ -0,0 +1,51 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * + * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * + * by the XIPHOPHORUS Company http://www.xiph.org/ * + * * + ******************************************************************** + + function: 11kHz settings + last mod: $Id$ + + ********************************************************************/ + +static double _psy_lowpass_11[3]={4.5,5.5,30.,}; + +static att3 _psy_tone_masteratt_11[3]={ + {{ 30, 25, 12}, 0, 0}, /* 0 */ + {{ 30, 25, 12}, 0, 0}, /* 0 */ + {{ 20, 0, -14}, 0, 0}, /* 0 */ +}; + +static vp_adjblock _vp_tonemask_adj_11[3]={ + /* adjust for mode zero */ + /* 63 125 250 500 1 2 4 8 16 */ + {{-20,-20,-20,-20,-20,-16,-10, 0, 0, 0, 0,10, 2, 0,99,99,99}}, /* 0 */ + {{-20,-20,-20,-20,-20,-16,-10, 0, 0, 0, 0, 5, 0, 0,99,99,99}}, /* 1 */ + {{-20,-20,-20,-20,-20,-16,-10, 0, 0, 0, 0, 0, 0, 0,99,99,99}}, /* 2 */ +}; + + +static noise3 _psy_noisebias_11[3]={ + /* 63 125 250 500 1k 2k 4k 8k 16k*/ + {{{-10,-10,-10,-10, -5, -5, -5, 0, 4, 10, 10, 12, 12, 12, 99, 99, 99}, + {-15,-15,-15,-15,-10,-10, -5, 0, 0, 4, 4, 5, 5, 10, 99, 99, 99}, + {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, 99, 99, 99}}}, + + {{{-10,-10,-10,-10, -5, -5, -5, 0, 4, 10, 10, 12, 12, 12, 99, 99, 99}, + {-15,-15,-15,-15,-10,-10, -5, -5, -5, 0, 0, 0, 0, 0, 99, 99, 99}, + {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, 99, 99, 99}}}, + + {{{-15,-15,-15,-15,-15,-12,-10, -8, 0, 2, 4, 4, 5, 5, 99, 99, 99}, + {-30,-30,-30,-30,-26,-22,-20,-14,-12,-12,-10,-10,-10,-10, 99, 99, 99}, + {-30,-30,-30,-30,-26,-26,-26,-26,-26,-26,-26,-26,-26,-24, 99, 99, 99}}}, +}; + +static double _noise_thresh_11[3]={ .3,.5,.5 }; + diff --git a/Libraries/Vorbis/Files/lib/modes/psych_16.h b/Libraries/Vorbis/Files/lib/modes/psych_16.h new file mode 100644 index 000000000..2f3c60344 --- /dev/null +++ b/Libraries/Vorbis/Files/lib/modes/psych_16.h @@ -0,0 +1,129 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * + * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * + * by the XIPHOPHORUS Company http://www.xiph.org/ * + * * + ******************************************************************** + + function: 16kHz settings + last mod: $Id$ + + ********************************************************************/ + +/* stereo mode by base quality level */ +static adj_stereo _psy_stereo_modes_16[4]={ + /* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 */ + {{ 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + { 6, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4}, + { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 4, 4}, + { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}}, + {{ 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + { 6, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4}, + { 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 4, 4, 4, 4, 4}, + { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}}, + {{ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + { 5, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4}, + { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}}, + {{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}, + { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}}, +}; + +static double _psy_lowpass_16[4]={6.5,8,30.,99.}; + +static att3 _psy_tone_masteratt_16[4]={ + {{ 30, 25, 12}, 0, 0}, /* 0 */ + {{ 25, 22, 12}, 0, 0}, /* 0 */ + {{ 20, 12, 0}, 0, 0}, /* 0 */ + {{ 15, 0, -14}, 0, 0}, /* 0 */ +}; + +static vp_adjblock _vp_tonemask_adj_16[4]={ + /* adjust for mode zero */ + /* 63 125 250 500 1 2 4 8 16 */ + {{-20,-20,-20,-20,-20,-16,-10, 0, 0, 0, 0,10, 0, 0, 0, 0, 0}}, /* 0 */ + {{-20,-20,-20,-20,-20,-16,-10, 0, 0, 0, 0,10, 0, 0, 0, 0, 0}}, /* 1 */ + {{-20,-20,-20,-20,-20,-16,-10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 2 */ + {{-30,-30,-30,-30,-30,-26,-20,-10, -5, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 2 */ +}; + + +static noise3 _psy_noisebias_16_short[4]={ + /* 63 125 250 500 1k 2k 4k 8k 16k*/ + {{{-15,-15,-15,-15,-15,-10,-10,-5, 4, 10, 10, 10, 10, 12, 12, 14, 20}, + {-15,-15,-15,-15,-15,-10,-10, -5, 0, 0, 4, 5, 5, 6, 8, 8, 15}, + {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, -6, -6, -6}}}, + + {{{-15,-15,-15,-15,-15,-10,-10,-5, 4, 6, 6, 6, 6, 8, 10, 12, 20}, + {-15,-15,-15,-15,-15,-15,-15,-10, -5, -5, -5, 4, 5, 6, 8, 8, 15}, + {-30,-30,-30,-30,-30,-24,-20,-14,-10,-10,-10,-10,-10,-10,-10,-10,-10}}}, + + {{{-15,-15,-15,-15,-15,-12,-10, -8, 0, 2, 4, 4, 5, 5, 5, 8, 12}, + {-20,-20,-20,-20,-16,-12,-20,-14,-10,-10, -8, 0, 0, 0, 0, 2, 5}, + {-30,-30,-30,-30,-26,-26,-26,-26,-26,-26,-26,-26,-26,-24,-20,-20,-20}}}, + + {{{-15,-15,-15,-15,-15,-12,-10, -8, -5, -5, -5, -5, -5, 0, 0, 0, 6}, + {-30,-30,-30,-30,-26,-22,-20,-14,-12,-12,-10,-10,-10,-10,-10,-10, -6}, + {-30,-30,-30,-30,-26,-26,-26,-26,-26,-26,-26,-26,-26,-24,-20,-20,-20}}}, +}; + +static noise3 _psy_noisebias_16_impulse[4]={ + /* 63 125 250 500 1k 2k 4k 8k 16k*/ + {{{-15,-15,-15,-15,-15,-10,-10,-5, 4, 10, 10, 10, 10, 12, 12, 14, 20}, + {-15,-15,-15,-15,-15,-10,-10, -5, 0, 0, 4, 5, 5, 6, 8, 8, 15}, + {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, -6, -6, -6}}}, + + {{{-15,-15,-15,-15,-15,-10,-10,-5, 4, 4, 4, 4, 5, 5, 6, 8, 15}, + {-15,-15,-15,-15,-15,-15,-15,-10, -5, -5, -5, 0, 0, 0, 0, 4, 10}, + {-30,-30,-30,-30,-30,-24,-20,-14,-10,-10,-10,-10,-10,-10,-10,-10,-10}}}, + + {{{-15,-15,-15,-15,-15,-12,-10, -8, 0, 0, 0, 0, 0, 0, 0, 4, 10}, + {-20,-20,-20,-20,-16,-12,-20,-14,-10,-10,-10,-10,-10,-10,-10, -7, -5}, + {-30,-30,-30,-30,-26,-26,-26,-26,-26,-26,-26,-26,-26,-24,-20,-20,-20}}}, + + {{{-15,-15,-15,-15,-15,-12,-10, -8, -5, -5, -5, -5, -5, 0, 0, 0, 6}, + {-30,-30,-30,-30,-26,-22,-20,-18,-18,-18,-20,-20,-20,-20,-20,-20,-16}, + {-30,-30,-30,-30,-26,-26,-26,-26,-26,-26,-26,-26,-26,-24,-20,-20,-20}}}, +}; + +static noise3 _psy_noisebias_16[4]={ + /* 63 125 250 500 1k 2k 4k 8k 16k*/ + {{{-10,-10,-10,-10, -5, -5, -5, 0, 4, 6, 8, 8, 10, 10, 10, 14, 20}, + {-10,-10,-10,-10,-10, -5, -2, -2, 0, 0, 0, 4, 5, 6, 8, 8, 15}, + {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, -6, -6, -6}}}, + + {{{-10,-10,-10,-10, -5, -5, -5, 0, 4, 6, 6, 6, 6, 8, 10, 12, 20}, + {-15,-15,-15,-15,-15,-10, -5, -5, 0, 0, 0, 4, 5, 6, 8, 8, 15}, + {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, -6, -6, -6}}}, + + {{{-15,-15,-15,-15,-15,-12,-10, -8, 0, 2, 4, 4, 5, 5, 5, 8, 12}, + {-20,-20,-20,-20,-16,-12,-20,-10, -5, -5, 0, 0, 0, 0, 0, 2, 5}, + {-30,-30,-30,-30,-26,-26,-26,-26,-26,-26,-26,-26,-26,-24,-20,-20,-20}}}, + + {{{-15,-15,-15,-15,-15,-12,-10, -8, -5, -5, -5, -5, -5, 0, 0, 0, 6}, + {-30,-30,-30,-30,-26,-22,-20,-14,-12,-12,-10,-10,-10,-10,-10,-10, -6}, + {-30,-30,-30,-30,-26,-26,-26,-26,-26,-26,-26,-26,-26,-24,-20,-20,-20}}}, +}; + +static double _noise_thresh_16[4]={ .3,.5,.5,.5 }; + +static int _noise_start_16[3]={ 256,256,9999 }; +static int _noise_part_16[4]={ 8,8,8,8 }; + +static int _psy_ath_floater_16[4]={ + -100,-100,-100,-105, +}; + +static int _psy_ath_abs_16[4]={ + -130,-130,-130,-140, +}; + + + diff --git a/Libraries/Vorbis/Files/lib/modes/psych_44.h b/Libraries/Vorbis/Files/lib/modes/psych_44.h new file mode 100644 index 000000000..b6c6132db --- /dev/null +++ b/Libraries/Vorbis/Files/lib/modes/psych_44.h @@ -0,0 +1,666 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * + * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * + * by the XIPHOPHORUS Company http://www.xiph.org/ * + * * + ******************************************************************** + + function: key psychoacoustic settings for 44.1/48kHz + last mod: $Id$ + + ********************************************************************/ + + +/* preecho trigger settings *****************************************/ + +static vorbis_info_psy_global _psy_global_44[5]={ + + {8, /* lines per eighth octave */ + {20.f,14.f,12.f,12.f,12.f,12.f,12.f}, + {-60.f,-30.f,-40.f,-40.f,-40.f,-40.f,-40.f}, 2,-75.f, + -6.f, + {99.},{{99.},{99.}},{0},{0},{{0.},{0.}} + }, + {8, /* lines per eighth octave */ + {14.f,10.f,10.f,10.f,10.f,10.f,10.f}, + {-40.f,-30.f,-25.f,-25.f,-25.f,-25.f,-25.f}, 2,-80.f, + -6.f, + {99.},{{99.},{99.}},{0},{0},{{0.},{0.}} + }, + {8, /* lines per eighth octave */ + {12.f,10.f,10.f,10.f,10.f,10.f,10.f}, + {-20.f,-20.f,-15.f,-15.f,-15.f,-15.f,-15.f}, 0,-80.f, + -6.f, + {99.},{{99.},{99.}},{0},{0},{{0.},{0.}} + }, + {8, /* lines per eighth octave */ + {10.f,8.f,8.f,8.f,8.f,8.f,8.f}, + {-20.f,-15.f,-12.f,-12.f,-12.f,-12.f,-12.f}, 0,-80.f, + -6.f, + {99.},{{99.},{99.}},{0},{0},{{0.},{0.}} + }, + {8, /* lines per eighth octave */ + {10.f,6.f,6.f,6.f,6.f,6.f,6.f}, + {-15.f,-15.f,-12.f,-12.f,-12.f,-12.f,-12.f}, 0,-85.f, + -6.f, + {99.},{{99.},{99.}},{0},{0},{{0.},{0.}} + }, +}; + +/* noise compander lookups * low, mid, high quality ****************/ +static compandblock _psy_compand_44[6]={ + /* sub-mode Z short */ + {{ + 0, 1, 2, 3, 4, 5, 6, 7, /* 7dB */ + 8, 9,10,11,12,13,14, 15, /* 15dB */ + 16,17,18,19,20,21,22, 23, /* 23dB */ + 24,25,26,27,28,29,30, 31, /* 31dB */ + 32,33,34,35,36,37,38, 39, /* 39dB */ + }}, + /* mode_Z nominal short */ + {{ + 0, 1, 2, 3, 4, 5, 6, 6, /* 7dB */ + 7, 7, 7, 7, 6, 6, 6, 7, /* 15dB */ + 7, 8, 9,10,11,12,13, 14, /* 23dB */ + 15,16,17,17,17,18,18, 19, /* 31dB */ + 19,19,20,21,22,23,24, 25, /* 39dB */ + }}, + /* mode A short */ + {{ + 0, 1, 2, 3, 4, 5, 5, 5, /* 7dB */ + 6, 6, 6, 5, 4, 4, 4, 4, /* 15dB */ + 4, 4, 5, 5, 5, 6, 6, 6, /* 23dB */ + 7, 7, 7, 8, 8, 8, 9, 10, /* 31dB */ + 11,12,13,14,15,16,17, 18, /* 39dB */ + }}, + /* sub-mode Z long */ + {{ + 0, 1, 2, 3, 4, 5, 6, 7, /* 7dB */ + 8, 9,10,11,12,13,14, 15, /* 15dB */ + 16,17,18,19,20,21,22, 23, /* 23dB */ + 24,25,26,27,28,29,30, 31, /* 31dB */ + 32,33,34,35,36,37,38, 39, /* 39dB */ + }}, + /* mode_Z nominal long */ + {{ + 0, 1, 2, 3, 4, 5, 6, 7, /* 7dB */ + 8, 9,10,11,12,12,13, 13, /* 15dB */ + 13,14,14,14,15,15,15, 15, /* 23dB */ + 16,16,17,17,17,18,18, 19, /* 31dB */ + 19,19,20,21,22,23,24, 25, /* 39dB */ + }}, + /* mode A long */ + {{ + 0, 1, 2, 3, 4, 5, 6, 7, /* 7dB */ + 8, 8, 7, 6, 5, 4, 4, 4, /* 15dB */ + 4, 4, 5, 5, 5, 6, 6, 6, /* 23dB */ + 7, 7, 7, 8, 8, 8, 9, 10, /* 31dB */ + 11,12,13,14,15,16,17, 18, /* 39dB */ + }} +}; + +/* tonal masking curve level adjustments *************************/ + +static vp_adjblock _vp_tonemask_adj_longblock[12]={ + + /* 63 125 250 500 1 2 4 8 16 */ + + {{ -3, -8,-13,-15,-10,-10,-10,-10,-10,-10,-10, 0, 0, 0, 0, 0, 0}}, /* -1 */ + +/* {{-15,-15,-15,-15,-10, -8, -4, -2, 0, 0, 0, 10, 0, 0, 0, 0, 0}}, 0 */ + {{ -4,-10,-14,-16,-15,-14,-13,-12,-12,-12,-11, -1, -1, -1, -1, -1, 0}}, /* 0 */ + +/* {{-15,-15,-15,-15,-15,-12,-10, -8, 0, 0, 0, 5, 0, 0, 0, 0, 0}}, 1 */ + {{ -6,-12,-14,-16,-15,-15,-14,-13,-13,-12,-12, -2, -2, -1, -1, -1, 0}}, /* 1 */ + +/* {{-15,-15,-15,-15,-15,-12,-10, -8, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, 2 */ + {{-12,-13,-14,-16,-16,-16,-15,-14,-13,-12,-12, -6, -3, -1, -1, -1, 0}}, /* 2 */ + +/* {{-15,-15,-15,-15,-15,-12,-10, -8, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, 3 */ + {{-15,-15,-15,-16,-16,-16,-16,-14,-13,-13,-13,-10, -4, -2, -1, -1, 0}}, /* 3 */ + +/* {{-15,-15,-15,-15,-15,-12,-10, -8, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, *//* 4 */ + {{-16,-16,-16,-16,-16,-16,-16,-15,-14,-14,-13,-11, -7 -3, -1, -1 , 0}}, /* 4 */ + +/* {{-15,-15,-15,-15,-15,-12,-10, -8, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, 5 */ + {{-16,-16,-16,-16,-16,-16,-16,-15,-14,-14,-13,-11, -7 -3, -1, -1 , 0}}, /* 5 */ + +/* {{-15,-15,-15,-15,-15,-12,-10, -8, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, 6 */ + {{-16,-16,-16,-16,-16,-16,-16,-15,-14,-14,-14,-12, -8, -4, -2, -2, 0}}, /* 6 */ + +/* {{-15,-15,-15,-15,-15,-12,-10, -8, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, 7 */ + {{-16,-16,-16,-16,-16,-16,-16,-15,-14,-14,-14,-12, -9, -4, -2, -2, 0}}, /* 7 */ + +/* {{-15,-15,-15,-15,-15,-12,-10, -8, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, 8 */ + {{-16,-16,-16,-16,-16,-16,-16,-15,-14,-14,-14,-12, -9, -4, -2, -2, 0}}, /* 8 */ + +/* {{-15,-15,-15,-15,-15,-12,-10, -8, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, 9 */ + {{-16,-16,-16,-16,-16,-16,-16,-15,-14,-14,-14,-12, -9, -4, -2, -2, 0}}, /* 9 */ + +/* {{-15,-15,-15,-15,-15,-12,-10, -8, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, 10 */ + {{-16,-16,-16,-16,-16,-16,-16,-15,-14,-14,-14,-12, -9, -4, -2, -2, 0}}, /* 10 */ +}; + +static vp_adjblock _vp_tonemask_adj_otherblock[12]={ + /* 63 125 250 500 1 2 4 8 16 */ + + {{ -3, -8,-13,-15,-10,-10, -9, -9, -9, -9, -9, 1, 1, 1, 1, 1, 1}}, /* -1 */ + +/* {{-20,-20,-20,-20,-14,-12,-10, -8, -4, 0, 0, 10, 0, 0, 0, 0, 0}}, 0 */ + {{ -4,-10,-14,-16,-14,-13,-12,-12,-11,-11,-10, 0, 0, 0, 0, 0, 0}}, /* 0 */ + +/* {{-20,-20,-20,-20,-20,-18,-16,-14,-10, 0, 0, 5, 0, 0, 0, 0, 0}}, 1 */ + {{ -6,-12,-14,-16,-15,-15,-14,-13,-13,-12,-12, -2, -2, -1, 0, 0, 0}}, /* 1 */ + +/* {{-20,-20,-20,-20,-20,-18,-16,-14,-10, 0, 0, 0, 0, 0, 0, 0, 0}}, 2 */ + {{-12,-13,-14,-16,-16,-16,-15,-14,-13,-12,-12, -5, -2, -1, 0, 0, 0}}, /* 2 */ + +/* {{-20,-20,-20,-20,-20,-18,-16,-14,-10, 0, 0, 0, 0, 0, 0, 0, 0}}, 3 */ + {{-15,-15,-15,-16,-16,-16,-16,-14,-13,-13,-13,-10, -4, -2, 0, 0, 0}}, /* 3 */ + +/* {{-20,-20,-20,-20,-20,-18,-16,-14,-10, 0, 0, 0, 0, 0, 0, 0, 0}}, 4 */ + {{-16,-16,-16,-16,-16,-16,-16,-15,-14,-14,-13,-11, -7 -3, -1, -1 , 0}}, /* 4 */ + +/* {{-20,-20,-20,-20,-20,-18,-16,-14,-10, 0, 0, 0, 0, 0, 0, 0, 0}}, 5 */ + {{-16,-16,-16,-16,-16,-16,-16,-15,-14,-14,-13,-11, -7 -3, -1, -1 , 0}}, /* 5 */ + +/* {{-20,-20,-20,-20,-20,-18,-16,-14,-10, 0, 0, 0, 0, 0, 0, 0, 0}}, 6 */ + {{-16,-16,-16,-16,-16,-16,-16,-15,-14,-14,-14,-12, -8, -4, -2, -2, 0}}, /* 6 */ + +/* {{-20,-20,-20,-20,-20,-18,-16,-14,-10, 0, 0, 0, 0, 0, 0, 0, 0}}, 7 */ + {{-16,-16,-16,-16,-16,-16,-16,-15,-14,-14,-14,-12, -9, -4, -2, -2, 0}}, /* 7 */ + +/* {{-20,-20,-20,-20,-20,-18,-16,-14,-10, 0, 0, 0, 0, 0, 0, 0, 0}}, 8 */ + {{-16,-16,-16,-16,-16,-16,-16,-15,-14,-14,-14,-12, -9, -4, -2, -2, 0}}, /* 8 */ + +/* {{-20,-20,-20,-20,-20,-18,-16,-14,-10, 0, 0, 0, 0, 0, 0, 0, 0}}, 9 */ + {{-16,-16,-16,-16,-16,-16,-16,-15,-14,-14,-14,-12, -9, -4, -2, -2, 0}}, /* 9 */ + +/* {{-20,-20,-20,-20,-20,-18,-16,-14,-10, 0, 0, 0, 0, 0, 0, 0, 0}}, 10 */ + {{-16,-16,-16,-16,-16,-16,-16,-15,-14,-14,-14,-12, -9, -4, -2, -2, 0}}, /* 10 */ +}; + +/* noise bias (transition block) */ +static noise3 _psy_noisebias_trans[12]={ + /* 63 125 250 500 1k 2k 4k 8k 16k*/ + /* -1 */ + {{{-10,-10,-10,-10,-10, -4, 0, 0, 4, 8, 8, 8, 8, 10, 12, 14, 20}, + {-30,-30,-30,-30,-26,-20,-16, -8, -6, -6, -2, 2, 2, 3, 6, 6, 15}, + {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, -6, -4, -2}}}, + /* 0 + {{{-15,-15,-15,-15,-15,-12,-10, -8, 0, 2, 4, 4, 5, 5, 5, 8, 10}, + {-30,-30,-30,-30,-26,-22,-20,-14, -8, -4, 0, 0, 0, 0, 2, 4, 10}, + {-30,-30,-30,-30,-26,-22,-20,-14,-10, -6, -6, -6, -6, -4, -4, -4, -2}}},*/ + {{{-15,-15,-15,-15,-15,-12, -6, -4, 0, 2, 4, 4, 5, 5, 5, 8, 10}, + {-30,-30,-30,-30,-26,-22,-20,-14, -8, -4, 0, 0, 0, 0, 2, 3, 6}, + {-30,-30,-30,-30,-26,-22,-20,-14,-10, -6, -6, -6, -6, -4, -4, -4, -2}}}, + /* 1 + {{{-15,-15,-15,-15,-15,-12,-10, -8, 0, 2, 4, 4, 5, 5, 5, 8, 10}, + {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -2, -2, -2, -2, 0, 2, 8}, + {-30,-30,-30,-30,-26,-22,-20,-14,-10, -8, -8, -8, -8, -6, -6, -6, -4}}},*/ + {{{-15,-15,-15,-15,-15,-12,-10, -8, 0, 2, 4, 4, 5, 5, 5, 8, 10}, + {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -2, -2, -2, -2, 0, 1, 4}, + {-30,-30,-30,-30,-26,-22,-20,-14,-10, -8, -8, -8, -8, -6, -6, -6, -4}}}, + /* 2 + {{{-15,-15,-15,-15,-15,-12,-10, -8, 0, 2, 2, 2, 4, 4, 5, 6, 10}, + {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -2, -2, -2, -2, 0, 2, 6}, + {-30,-30,-30,-30,-26,-22,-20,-14,-10,-10,-10,-10,-10, -8, -8, -8, -4}}}, */ + {{{-15,-15,-15,-15,-15,-12,-10, -8, 0, 2, 2, 2, 4, 4, 5, 6, 10}, + {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -3, -3, -3, -2, -1, 0, 3}, + {-30,-30,-30,-30,-26,-22,-20,-14,-10,-10,-10,-10,-10, -8, -8, -7, -4}}}, + /* 3 + {{{-15,-15,-15,-15,-15,-12,-10, -8, 0, 2, 2, 2, 4, 4, 4, 5, 8}, + {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -3, -3, -3, -3, -1, 1, 6}, + {-30,-30,-30,-30,-26,-22,-20,-14,-10,-10,-10,-10,-10, -8, -8, -8, -4}}},*/ + {{{-15,-15,-15,-15,-15,-12,-10, -8, 0, 2, 2, 2, 4, 4, 4, 5, 8}, + {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -3, -3, -3, -3, -2, 0, 2}, + {-30,-30,-30,-30,-26,-22,-20,-14,-10,-10,-10,-10,-10, -8, -8, -8, -4}}}, + /* 4 + {{{-20,-20,-20,-20,-20,-18,-14, -8, -1, 1, 1, 1, 2, 3, 3, 4, 7}, + {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -3, -3, -3, -3, -1, 1, 5}, + {-30,-30,-30,-30,-26,-22,-20,-14,-10,-10,-10,-10,-10, -8, -8, -8, -4}}},*/ + {{{-20,-20,-20,-20,-20,-18,-14, -8, -1, 1, 1, 1, 2, 3, 3, 4, 7}, + {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -3, -3, -3, -3, -2, -1, 1}, + {-30,-30,-30,-30,-26,-22,-20,-14,-10,-10,-10,-10,-10, -8, -8, -8, -4}}}, + /* 5 + {{{-24,-24,-24,-24,-20,-18,-14, -8, -1, 1, 1, 1, 2, 3, 3, 4, 7}, + {-32,-32,-32,-32,-28,-24,-22,-16,-12, -6, -4, -4, -4, -4, -2, -1, 2}, + {-34,-34,-34,-34,-30,-24,-24,-18,-14,-12,-12,-12,-12,-10,-10, -9, -5}}}, */ + {{{-24,-24,-24,-24,-20,-18,-14, -8, -1, 1, 1, 1, 2, 3, 3, 4, 7}, + {-32,-32,-32,-32,-28,-24,-22,-16,-12, -6, -4, -4, -4, -4, -3, -1, 0}, + {-34,-34,-34,-34,-30,-24,-24,-18,-14,-12,-12,-12,-12,-10,-10, -9, -5}}}, + /* 6 + {{{-24,-24,-24,-24,-20,-18,-14, -8, -1, 1, 1, 1, 2, 3, 3, 4, 7}, + {-32,-32,-32,-32,-28,-24,-24,-18,-14, -8, -6, -6, -6, -6, -4, -2, 1}, + {-34,-34,-34,-34,-30,-26,-24,-18,-17,-15,-15,-15,-15,-13,-13,-12, -8}}},*/ + {{{-24,-24,-24,-24,-20,-18,-14, -8, -1, 1, 1, 1, 2, 3, 3, 4, 7}, + {-32,-32,-32,-32,-28,-24,-24,-18,-14, -8, -6, -6, -6, -6, -5, -2, 0}, + {-34,-34,-34,-34,-30,-26,-26,-24,-22,-19,-19,-19,-19,-18,-17,-16,-12}}}, + /* 7 + {{{-24,-24,-24,-24,-20,-18,-14, -8, -1, 1, 1, 1, 2, 3, 3, 4, 7}, + {-32,-32,-32,-32,-28,-24,-24,-18,-14,-12,-10, -8, -8, -8, -6, -4, 0}, + {-34,-34,-34,-34,-30,-26,-26,-24,-22,-19,-19,-19,-19,-18,-17,-16,-12}}},*/ + {{{-24,-24,-24,-24,-20,-18,-14, -8, -1, 1, 1, 1, 2, 3, 3, 4, 7}, + {-32,-32,-32,-32,-28,-24,-24,-24,-18,-14,-12,-10,-10,-10, -8, -6, -2}, + {-34,-34,-34,-34,-30,-26,-26,-26,-24,-24,-24,-24,-24,-24,-24,-20,-16}}}, + /* 8 + {{{-24,-24,-24,-24,-22,-20,-15,-10, -8, -2, 0, 0, 0, 1, 2, 3, 7}, + {-36,-36,-36,-36,-30,-30,-30,-24,-18,-14,-12,-10,-10,-10, -8, -6, -2}, + {-36,-36,-36,-36,-34,-30,-28,-26,-24,-24,-24,-24,-24,-24,-24,-20,-16}}},*/ + {{{-24,-24,-24,-24,-22,-20,-15,-10, -8, -2, 0, 0, 0, 1, 2, 3, 7}, + {-36,-36,-36,-36,-30,-30,-30,-24,-20,-16,-16,-16,-16,-14,-12,-10, -7}, + {-36,-36,-36,-36,-34,-30,-28,-26,-24,-30,-30,-30,-30,-30,-30,-24,-20}}}, + /* 9 + {{{-28,-28,-28,-28,-28,-28,-28,-20,-14, -8, -4, -4, -4, -4, -4, -2, 2}, + {-36,-36,-36,-36,-34,-32,-32,-28,-20,-16,-16,-16,-16,-14,-12,-10, -7}, + {-40,-40,-40,-40,-40,-40,-40,-32,-30,-30,-30,-30,-30,-30,-30,-24,-20}}},*/ + {{{-28,-28,-28,-28,-28,-28,-28,-20,-14, -8, -4, -4, -4, -4, -4, -2, 2}, + {-38,-38,-38,-38,-36,-34,-34,-30,-24,-20,-20,-20,-20,-18,-16,-12,-10}, + {-40,-40,-40,-40,-40,-40,-40,-38,-35,-35,-35,-35,-35,-35,-35,-35,-30}}}, + /* 10 */ + {{{-30,-30,-30,-30,-30,-30,-30,-28,-20,-14,-14,-14,-14,-14,-14,-12,-10}, + {-40,-40,-40,-40,-40,-40,-40,-40,-35,-30,-30,-30,-30,-30,-30,-30,-20}, + {-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40}}}, +}; + +/* noise bias (long block) */ +static noise3 _psy_noisebias_long[12]={ + /*63 125 250 500 1k 2k 4k 8k 16k*/ + /* -1 */ + {{{-10,-10,-10,-10,-10, -4, 0, 0, 0, 6, 6, 6, 6, 10, 10, 12, 20}, + {-20,-20,-20,-20,-20,-20,-10, -2, 0, 0, 0, 0, 0, 2, 4, 6, 15}, + {-20,-20,-20,-20,-20,-20,-20,-10, -6, -6, -6, -6, -6, -4, -4, -4, -2}}}, + + /* 0 */ + /* {{{-10,-10,-10,-10,-10,-10, -8, 2, 2, 2, 4, 4, 5, 5, 5, 8, 10}, + {-20,-20,-20,-20,-20,-20,-20,-14, -6, 0, 0, 0, 0, 0, 2, 4, 10}, + {-20,-20,-20,-20,-20,-20,-20,-14, -8, -6, -6, -6, -6, -4, -4, -4, -2}}},*/ + {{{-10,-10,-10,-10,-10,-10, -8, 2, 2, 2, 4, 4, 5, 5, 5, 8, 10}, + {-20,-20,-20,-20,-20,-20,-20,-14, -6, 0, 0, 0, 0, 0, 2, 3, 6}, + {-20,-20,-20,-20,-20,-20,-20,-14, -8, -6, -6, -6, -6, -4, -4, -4, -2}}}, + /* 1 */ + /* {{{-10,-10,-10,-10,-10,-10, -8, -4, 0, 2, 4, 4, 5, 5, 5, 8, 10}, + {-20,-20,-20,-20,-20,-20,-20,-14,-10, -4, -2, -2, -2, -2, 0, 2, 8}, + {-20,-20,-20,-20,-20,-20,-20,-14,-10, -8, -8, -8, -8, -6, -6, -6, -4}}},*/ + {{{-10,-10,-10,-10,-10,-10, -8, -4, 0, 2, 4, 4, 5, 5, 5, 8, 10}, + {-20,-20,-20,-20,-20,-20,-20,-14,-10, -4, -2, -2, -2, -2, 0, 1, 4}, + {-20,-20,-20,-20,-20,-20,-20,-14,-10, -8, -8, -8, -8, -6, -6, -6, -4}}}, + /* 2 */ + /* {{{-10,-10,-10,-10,-10,-10,-10, -8, 0, 2, 2, 2, 4, 4, 5, 6, 10}, + {-20,-20,-20,-20,-20,-20,-20,-14,-10, -4, -2, -2, -2, -2, 0, 2, 6}, + {-20,-20,-20,-20,-20,-20,-20,-14,-10,-10,-10,-10,-10, -8, -8, -8, -4}}},*/ + {{{-10,-10,-10,-10,-10,-10,-10, -8, 0, 2, 2, 2, 4, 4, 5, 6, 10}, + {-20,-20,-20,-20,-20,-20,-20,-14,-10, -4, -3, -3, -3, -2, -1, 0, 3}, + {-20,-20,-20,-20,-20,-20,-20,-14,-10,-10,-10,-10,-10, -8, -8, -8, -4}}}, + /* 3 */ + /* {{{-10,-10,-10,-10,-10,-10,-10, -8, 0, 2, 2, 2, 4, 4, 4, 5, 8}, + {-20,-20,-20,-20,-20,-20,-20,-14,-10, -4, -3, -3, -3, -3, -1, 1, 6}, + {-20,-20,-20,-20,-20,-20,-20,-14,-10,-10,-10,-10,-10, -8, -8, -8, -4}}},*/ + {{{-10,-10,-10,-10,-10,-10,-10, -8, 0, 2, 2, 2, 4, 4, 4, 5, 8}, + {-20,-20,-20,-20,-20,-20,-20,-14,-10, -4, -3, -3, -3, -3, -2, 0, 2}, + {-20,-20,-20,-20,-20,-20,-20,-14,-10,-10,-10,-10,-10, -8, -8, -8, -5}}}, + /* 4 */ + /* {{{-15,-15,-15,-15,-15,-15,-15,-10, -4, 1, 1, 1, 2, 3, 3, 4, 7}, + {-20,-20,-20,-20,-20,-20,-20,-14,-10, -4, -3, -3, -3, -3, -1, 1, 5}, + {-20,-20,-20,-20,-20,-20,-20,-14,-10,-10,-10,-10,-10, -8, -8, -8, -4}}},*/ + {{{-15,-15,-15,-15,-15,-15,-15,-10, -4, 1, 1, 1, 2, 3, 3, 4, 7}, + {-20,-20,-20,-20,-20,-20,-20,-14,-10, -4, -3, -3, -3, -3, -2, -1, 1}, + {-20,-20,-20,-20,-20,-20,-20,-14,-10,-10,-10,-10,-10, -8, -8, -8, -7}}}, + /* 5 */ + /* {{{-15,-15,-15,-15,-15,-15,-15,-10, -4, 1, 1, 1, 2, 3, 3, 4, 7}, + {-22,-22,-22,-22,-22,-22,-22,-16,-12, -6, -4, -4, -4, -4, -2, -1, 2}, + {-24,-24,-24,-24,-24,-24,-24,-18,-14,-12,-12,-12,-12,-10,-10, -9, -5}}},*/ + {{{-15,-15,-15,-15,-15,-15,-15,-10, -4, 1, 1, 1, 2, 3, 3, 4, 7}, + {-22,-22,-22,-22,-22,-22,-22,-16,-12, -6, -4, -4, -4, -4, -3, -1, 0}, + {-24,-24,-24,-24,-24,-24,-24,-18,-14,-12,-12,-12,-12,-10,-10, -9, -8}}}, + /* 6 */ + /* {{{-15,-15,-15,-15,-15,-15,-15,-10, -4, 1, 1, 1, 2, 3, 3, 4, 7}, + {-24,-24,-24,-24,-24,-24,-24,-18,-14, -8, -6, -6, -6, -6, -4, -2, 1}, + {-26,-26,-26,-26,-26,-26,-26,-18,-16,-15,-15,-15,-15,-13,-13,-12, -8}}},*/ + {{{-15,-15,-15,-15,-15,-15,-15,-10, -4, 1, 1, 1, 2, 3, 3, 4, 7}, + {-24,-24,-24,-24,-24,-24,-24,-18,-14, -8, -6, -6, -6, -6, -5, -2, 0}, + {-26,-26,-26,-26,-26,-26,-26,-18,-16,-15,-15,-15,-15,-13,-13,-12,-10}}}, + /* 7 */ + {{{-15,-15,-15,-15,-15,-15,-15,-10, -4, 1, 1, 1, 2, 3, 3, 4, 7}, + {-24,-24,-24,-24,-24,-24,-24,-18,-14,-10, -8, -8, -8, -8, -6, -4, 0}, + {-26,-26,-26,-26,-26,-26,-26,-22,-20,-19,-19,-19,-19,-18,-17,-16,-12}}}, + /* 8 */ + {{{-15,-15,-15,-15,-15,-15,-15,-10, -4, 0, 0, 0, 0, 1, 2, 3, 7}, + {-26,-26,-26,-26,-26,-26,-26,-20,-16,-12,-10,-10,-10,-10, -8, -6, -2}, + {-28,-28,-28,-28,-28,-28,-28,-26,-24,-24,-24,-24,-24,-24,-24,-20,-16}}}, + /* 9 */ + {{{-22,-22,-22,-22,-22,-22,-22,-18,-14, -8, -4, -4, -4, -4, -4, -2, 2}, + {-26,-26,-26,-26,-26,-26,-26,-22,-18,-16,-16,-16,-16,-14,-12,-10, -7}, + {-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-24,-20}}}, + /* 10 */ + {{{-24,-24,-24,-24,-24,-24,-24,-24,-24,-18,-14,-14,-14,-14,-14,-12,-10}, + {-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-30,-20}, + {-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40}}}, +}; + +/* noise bias (impulse block) */ +static noise3 _psy_noisebias_impulse[12]={ + /* 63 125 250 500 1k 2k 4k 8k 16k*/ + /* -1 */ + {{{-10,-10,-10,-10,-10, -4, 0, 0, 4, 8, 8, 8, 8, 10, 12, 14, 20}, + {-30,-30,-30,-30,-26,-20,-16, -8, -6, -6, -2, 2, 2, 3, 6, 6, 15}, + {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, -6, -4, -2}}}, + + /* 0 */ + /* {{{-10,-10,-10,-10,-10, -4, 0, 0, 4, 4, 8, 8, 8, 10, 12, 14, 20}, + {-30,-30,-30,-30,-26,-22,-20,-14, -6, -2, 0, 0, 0, 0, 2, 4, 10}, + {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, -6, -4, -2}}},*/ + {{{-10,-10,-10,-10,-10, -4, 0, 0, 4, 4, 8, 8, 8, 10, 12, 14, 20}, + {-30,-30,-30,-30,-26,-22,-20,-14, -6, -2, 0, 0, 0, 0, 2, 3, 6}, + {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, -6, -4, -2}}}, + /* 1 */ + {{{-12,-12,-12,-12,-12, -8, -6, -4, 0, 4, 4, 4, 4, 10, 12, 14, 20}, + {-30,-30,-30,-30,-26,-22,-20,-14,-10, -6, -4, -4, -2, -2, -2, -2, 2}, + {-30,-30,-30,-30,-26,-22,-20,-14,-10, -8,-10,-10, -8, -8, -8, -6, -4}}}, + /* 2 */ + {{{-14,-14,-14,-14,-14,-10, -8, -6, -2, 2, 2, 2, 2, 8, 10, 10, 16}, + {-30,-30,-30,-30,-26,-22,-20,-14,-10, -6, -6, -6, -4, -4, -4, -2, 0}, + {-30,-30,-30,-30,-26,-22,-20,-14,-10,-10,-10,-10,-10,-10,-10, -8, -4}}}, + /* 3 */ + {{{-14,-14,-14,-14,-14,-10, -8, -6, -2, 2, 2, 2, 2, 6, 8, 8, 14}, + {-30,-30,-30,-30,-26,-22,-20,-14,-10, -6, -6, -6, -4, -4, -4, -2, 0}, + {-30,-30,-30,-30,-26,-22,-20,-14,-10,-10,-10,-10,-10,-10,-10, -8, -4}}}, + /* 4 */ + {{{-16,-16,-16,-16,-16,-12,-10, -6, -2, 0, 0, 0, 0, 4, 6, 6, 12}, + {-30,-30,-30,-30,-26,-22,-20,-14,-10, -6, -6, -6, -4, -4, -4, -2, 0}, + {-30,-30,-30,-30,-26,-22,-20,-14,-10,-10,-10,-10,-10,-10,-10, -8, -4}}}, + /* 5 */ + {{{-20,-20,-20,-20,-20,-18,-14,-10, -4, 0, 0, 0, 0, 4, 4, 6, 11}, + {-32,-32,-32,-32,-28,-24,-22,-16,-10, -6, -8, -8, -6, -6, -6, -4, -2}, + {-34,-34,-34,-34,-30,-26,-24,-18,-14,-12,-12,-12,-12,-12,-10, -9, -5}}}, + /* 6 + {{{-20,-20,-20,-20,-20,-18,-14,-10, -4, 0, 0, 0, 0, 4, 4, 6, 11}, + {-34,-34,-34,-34,-30,-30,-24,-20,-12,-12,-14,-14,-10, -9, -8, -6, -4}, + {-34,-34,-34,-34,-34,-30,-26,-20,-16,-15,-15,-15,-15,-15,-13,-12, -8}}},*/ + {{{-20,-20,-20,-20,-20,-18,-14,-10, -4, 0, 0, 0, 0, 4, 4, 6, 11}, + {-34,-34,-34,-34,-30,-30,-30,-24,-16,-16,-16,-16,-16,-16,-14,-14,-12}, + {-36,-36,-36,-36,-36,-34,-28,-24,-20,-20,-20,-20,-20,-20,-20,-18,-16}}}, + /* 7 */ + /* {{{-22,-22,-22,-22,-22,-20,-14,-10, -6, 0, 0, 0, 0, 4, 4, 6, 11}, + {-34,-34,-34,-34,-30,-30,-24,-20,-14,-14,-16,-16,-14,-12,-10,-10,-10}, + {-34,-34,-34,-34,-32,-32,-30,-24,-20,-19,-19,-19,-19,-19,-17,-16,-12}}},*/ + {{{-22,-22,-22,-22,-22,-20,-14,-10, -6, 0, 0, 0, 0, 4, 4, 6, 11}, + {-34,-34,-34,-34,-30,-30,-30,-30,-26,-26,-26,-26,-26,-26,-26,-24,-22}, + {-40,-40,-40,-40,-40,-40,-40,-32,-30,-30,-30,-30,-30,-30,-30,-30,-24}}}, + /* 8 */ + /* {{{-24,-24,-24,-24,-24,-22,-14,-10, -6, -1, -1, -1, -1, 3, 3, 5, 10}, + {-34,-34,-34,-34,-30,-30,-30,-24,-20,-20,-20,-20,-20,-18,-16,-16,-14}, + {-36,-36,-36,-36,-36,-34,-28,-24,-24,-24,-24,-24,-24,-24,-24,-20,-16}}},*/ + {{{-24,-24,-24,-24,-24,-22,-14,-10, -6, -1, -1, -1, -1, 3, 3, 5, 10}, + {-34,-34,-34,-34,-34,-32,-32,-30,-26,-26,-26,-26,-26,-26,-26,-26,-24}, + {-40,-40,-40,-40,-40,-40,-40,-32,-30,-30,-30,-30,-30,-30,-30,-30,-24}}}, + /* 9 */ + /* {{{-28,-28,-28,-28,-28,-28,-28,-20,-14, -8, -4, -4, -4, -4, -4, -2, 2}, + {-36,-36,-36,-36,-34,-32,-32,-30,-26,-26,-26,-26,-26,-22,-20,-20,-18}, + {-40,-40,-40,-40,-40,-40,-40,-32,-30,-30,-30,-30,-30,-30,-30,-24,-20}}},*/ + {{{-28,-28,-28,-28,-28,-28,-28,-20,-14, -8, -4, -4, -4, -4, -4, -2, 2}, + {-36,-36,-36,-36,-34,-32,-32,-30,-26,-26,-26,-26,-26,-26,-26,-26,-26}, + {-40,-40,-40,-40,-40,-40,-40,-32,-30,-30,-30,-30,-30,-30,-30,-24,-20}}}, + /* 10 */ + {{{-30,-30,-30,-30,-30,-26,-24,-24,-24,-20,-16,-16,-16,-16,-16,-14,-12}, + {-40,-40,-40,-40,-40,-40,-40,-40,-35,-30,-30,-30,-30,-30,-30,-30,-26}, + {-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40}}}, +}; + +/* noise bias (padding block) */ +static noise3 _psy_noisebias_padding[12]={ + /* 63 125 250 500 1k 2k 4k 8k 16k*/ + + /* -1 */ + {{{-10,-10,-10,-10,-10, -4, 0, 0, 4, 8, 8, 8, 8, 10, 12, 14, 20}, + {-30,-30,-30,-30,-26,-20,-16, -8, -6, -6, -2, 2, 2, 3, 6, 6, 15}, + {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, -6, -4, -2}}}, + + /* 0 */ + {{{-10,-10,-10,-10,-10, -4, 0, 0, 4, 8, 8, 8, 8, 10, 12, 14, 20}, + {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -2, 2, 3, 6, 6, 8, 10}, + {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -4, -4, -4, -4, -2, 0, 2}}}, + /* 1 */ + {{{-12,-12,-12,-12,-12, -8, -6, -4, 0, 4, 4, 4, 4, 10, 12, 14, 20}, + {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, 0, 0, 0, 2, 2, 4, 8}, + {-30,-30,-30,-30,-26,-22,-20,-14,-10, -6, -6, -6, -6, -6, -4, -2, 0}}}, + /* 2 */ + /* {{{-14,-14,-14,-14,-14,-10, -8, -6, -2, 2, 2, 2, 2, 8, 10, 10, 16}, + {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, 0, 0, 0, 2, 2, 4, 8}, + {-30,-30,-30,-30,-26,-22,-20,-14,-10, -8, -8, -8, -8, -8, -6, -4, -2}}},*/ + {{{-14,-14,-14,-14,-14,-10, -8, -6, -2, 2, 2, 2, 2, 8, 10, 10, 16}, + {-30,-30,-30,-30,-26,-22,-20,-14,-10, -6, -1, -1, -1, 0, 0, 2, 6}, + {-30,-30,-30,-30,-26,-22,-20,-14,-10, -8, -8, -8, -8, -8, -6, -4, -2}}}, + /* 3 */ + {{{-14,-14,-14,-14,-14,-10, -8, -6, -2, 2, 2, 2, 2, 6, 8, 8, 14}, + {-30,-30,-30,-30,-26,-22,-20,-14,-10, -6, -1, -1, -1, 0, 0, 2, 6}, + {-30,-30,-30,-30,-26,-22,-20,-14,-10, -8, -8, -8, -8, -8, -6, -4, -2}}}, + /* 4 */ + {{{-16,-16,-16,-16,-16,-12,-10, -6, -2, 0, 0, 0, 0, 4, 6, 6, 12}, + {-30,-30,-30,-30,-26,-22,-20,-14,-10, -6, -1, -1, -1, -1, 0, 2, 6}, + {-30,-30,-30,-30,-26,-22,-20,-14,-10, -8, -8, -8, -8, -8, -6, -4, -2}}}, + /* 5 */ + {{{-20,-20,-20,-20,-20,-18,-14,-10, -4, 0, 0, 0, 0, 4, 6, 6, 12}, + {-32,-32,-32,-32,-28,-24,-22,-16,-12, -6, -3, -3, -3, -3, -2, 0, 4}, + {-34,-34,-34,-34,-30,-26,-24,-18,-14,-10,-10,-10,-10,-10, -8, -5, -3}}}, + /* 6 */ + {{{-20,-20,-20,-20,-20,-18,-14,-10, -4, 0, 0, 0, 0, 4, 6, 6, 12}, + {-34,-34,-34,-34,-30,-30,-24,-20,-14, -8, -4, -4, -4, -4, -3, -1, 4}, + {-34,-34,-34,-34,-34,-30,-26,-20,-16,-13,-13,-13,-13,-13,-11, -8, -6}}}, + /* 7 */ + {{{-20,-20,-20,-20,-20,-18,-14,-10, -4, 0, 0, 0, 0, 4, 6, 6, 12}, + {-34,-34,-34,-34,-30,-30,-30,-24,-16,-10, -8, -6, -6, -6, -5, -3, 1}, + {-34,-34,-34,-34,-32,-32,-28,-22,-18,-16,-16,-16,-16,-16,-14,-12,-10}}}, + /* 8 */ + {{{-22,-22,-22,-22,-22,-20,-14,-10, -4, 0, 0, 0, 0, 3, 5, 5, 11}, + {-34,-34,-34,-34,-30,-30,-30,-24,-16,-12,-10, -8, -8, -8, -7, -5, -2}, + {-36,-36,-36,-36,-36,-34,-28,-22,-20,-20,-20,-20,-20,-20,-20,-16,-14}}}, + /* 9 */ + {{{-28,-28,-28,-28,-28,-28,-28,-20,-14, -8, -2, -2, -2, -2, 0, 2, 6}, + {-36,-36,-36,-36,-34,-32,-32,-24,-16,-12,-12,-12,-12,-12,-10, -8, -5}, + {-40,-40,-40,-40,-40,-40,-40,-32,-26,-24,-24,-24,-24,-24,-24,-20,-18}}}, + /* 10 */ + {{{-30,-30,-30,-30,-30,-26,-24,-24,-24,-20,-12,-12,-12,-12,-12,-10, -8}, + {-40,-40,-40,-40,-40,-40,-40,-40,-35,-30,-25,-25,-25,-25,-25,-25,-15}, + {-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40,-40}}}, +}; + + +static noiseguard _psy_noiseguards_44[4]={ + {3,3,15}, + {3,3,15}, + {10,10,100}, + {10,10,100}, +}; + +static int _psy_tone_suppress[12]={ + -20,-20,-20,-20,-20,-24,-30,-40,-40,-45,-45,-45, +}; +static int _psy_tone_0dB[12]={ + 90,90,95,95,95,95,105,105,105,105,105,105, +}; +static int _psy_noise_suppress[12]={ + -20,-20,-24,-24,-24,-24,-30,-40,-40,-45,-45,-45, +}; + +static vorbis_info_psy _psy_info_template={ + /* blockflag */ + -1, + /* ath_adjatt, ath_maxatt */ + -140.,-140., + /* tonemask att boost/decay,suppr,curves */ + {0.f,0.f,0.f}, 0.,0., -40.f, {0.}, + + /*noisemaskp,supp, low/high window, low/hi guard, minimum */ + 1, -0.f, .5f, .5f, 0,0,0, + /* noiseoffset*3, noisecompand, max_curve_dB */ + {{-1},{-1},{-1}},{-1},105.f, + /* noise normalization - channel_p, point_p, start, partition, thresh. */ + 0,0,-1,-1,0., +}; + +/* ath ****************/ + +static int _psy_ath_floater[12]={ + -100,-100,-100,-100,-100,-100,-105,-105,-105,-105,-110,-120, +}; +static int _psy_ath_abs[12]={ + -130,-130,-130,-130,-140,-140,-140,-140,-140,-140,-140,-150, +}; + +/* stereo setup. These don't map directly to quality level, there's + an additional indirection as several of the below may be used in a + single bitmanaged stream + +****************/ + +/* various stereo possibilities */ + +/* stereo mode by base quality level */ +static adj_stereo _psy_stereo_modes_44[12]={ + /* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 -1 */ + {{ 4, 4, 4, 4, 4, 4, 4, 3, 2, 2, 1, 0, 0, 0, 0}, + { 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 5, 4, 3}, + { 1, 2, 3, 4, 4, 4, 4, 4, 4, 5, 6, 7, 8, 8, 8}, + { 12,12.5, 13,13.5, 14,14.5, 15, 99, 99, 99, 99, 99, 99, 99, 99}}, + +/* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 0 */ +/*{{ 4, 4, 4, 4, 4, 4, 4, 3, 2, 2, 1, 0, 0, 0, 0}, + { 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 5, 4, 3}, + { 1, 2, 3, 4, 5, 5, 6, 6, 6, 6, 6, 7, 8, 8, 8}, + { 12,12.5, 13,13.5, 14,14.5, 15, 99, 99, 99, 99, 99, 99, 99, 99}},*/ + {{ 4, 4, 4, 4, 4, 4, 4, 3, 2, 1, 0, 0, 0, 0, 0}, + { 8, 8, 8, 8, 6, 6, 5, 5, 5, 5, 5, 5, 5, 4, 3}, + { 1, 2, 3, 4, 4, 5, 6, 6, 6, 6, 6, 8, 8, 8, 8}, + { 12,12.5, 13,13.5, 14,14.5, 15, 99, 99, 99, 99, 99, 99, 99, 99}}, + + + /* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 */ + {{ 3, 3, 3, 3, 3, 3, 3, 3, 2, 1, 0, 0, 0, 0, 0}, + { 8, 8, 8, 8, 6, 6, 5, 5, 5, 5, 5, 5, 5, 4, 3}, + { 1, 2, 3, 4, 4, 5, 6, 6, 6, 6, 6, 8, 8, 8, 8}, + { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}}, + + + /* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 2 */ + /* {{ 3, 3, 3, 3, 3, 3, 2, 2, 2, 1, 0, 0, 0, 0, 0}, + { 8, 8, 8, 6, 5, 5, 5, 5, 5, 5, 5, 4, 3, 2, 1}, + { 3, 4, 4, 4, 5, 6, 6, 6, 6, 6, 6, 8, 8, 8, 8}, + { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}}, */ + {{ 3, 3, 3, 3, 3, 3, 3, 2, 1, 1, 0, 0, 0, 0, 0}, + { 8, 8, 6, 6, 5, 5, 4, 4, 4, 4, 4, 4, 3, 2, 1}, + { 3, 4, 4, 5, 5, 6, 6, 6, 6, 6, 6, 8, 8, 8, 8}, + { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}}, + /* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 3 */ + {{ 2, 2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0}, + { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 2, 1}, + { 4, 4, 5, 6, 6, 6, 6, 6, 8, 8, 10, 10, 10, 10, 10}, + { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}}, + /* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 4 */ + {{ 2, 2, 2, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 2, 1, 0}, + { 6, 6, 6, 8, 8, 8, 8, 8, 8, 8, 10, 10, 10, 10, 10}, + { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}}, + /* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 5 */ + /* {{ 2, 2, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0}, + { 6, 6, 8, 8, 8, 8, 10, 10, 10, 10, 10, 10, 10, 10, 10}, + { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},*/ + {{ 2, 2, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0}, + { 6, 7, 8, 8, 8, 10, 10, 12, 12, 12, 12, 12, 12, 12, 12}, + { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}}, + /* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 6 */ + /* {{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 3, 3, 3, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 8, 8, 8, 8, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10}, + { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}}, */ + {{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 3, 3, 3, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 8, 8, 8, 10, 10, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12}, + { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}}, + /* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 7 */ + /* {{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 3, 3, 3, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 8, 8, 8, 8, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10}, + { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},*/ + {{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 3, 3, 3, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 8, 8, 10, 10, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12}, + { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}}, + /* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 8 */ + /* {{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 8, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10}, + { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},*/ + {{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 8, 10, 10, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12}, + { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}}, + /* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 9 */ + {{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4}, + { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}}, + /* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 10 */ + {{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4}, + { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}}, +}; + +/* tone master attenuation by base quality mode and bitrate tweak */ +static att3 _psy_tone_masteratt_44[12]={ + {{ 35, 21, 9}, 0, 0}, /* -1 */ + {{ 30, 20, 8}, -2, 1.25}, /* 0 */ + /* {{ 25, 14, 4}, 0, 0}, *//* 1 */ + {{ 25, 12, 2}, 0, 0}, /* 1 */ + /* {{ 20, 10, -2}, 0, 0}, *//* 2 */ + {{ 20, 9, -3}, 0, 0}, /* 2 */ + {{ 20, 9, -4}, 0, 0}, /* 3 */ + {{ 20, 9, -4}, 0, 0}, /* 4 */ + {{ 20, 6, -6}, 0, 0}, /* 5 */ + {{ 20, 3, -10}, 0, 0}, /* 6 */ + {{ 18, 1, -14}, 0, 0}, /* 7 */ + {{ 18, 0, -16}, 0, 0}, /* 8 */ + {{ 18, -2, -16}, 0, 0}, /* 9 */ + {{ 12, -2, -20}, 0, 0}, /* 10 */ +}; + +/* lowpass by mode **************/ +static double _psy_lowpass_44[12]={ + /* 15.1,15.8,16.5,17.9,20.5,48.,999.,999.,999.,999.,999. */ + 13.9,15.1,15.8,16.5,17.2,18.9,20.1,48.,999.,999.,999.,999. +}; + +/* noise normalization **********/ + +static int _noise_start_short_44[11]={ + /* 16,16,16,16,32,32,9999,9999,9999,9999 */ + 32,16,16,16,32,9999,9999,9999,9999,9999,9999 +}; +static int _noise_start_long_44[11]={ + /* 128,128,128,256,512,512,9999,9999,9999,9999 */ + 256,128,128,256,512,9999,9999,9999,9999,9999,9999 +}; + +static int _noise_part_short_44[11]={ + 8,8,8,8,8,8,8,8,8,8,8 +}; +static int _noise_part_long_44[11]={ + 32,32,32,32,32,32,32,32,32,32,32 +}; + +static double _noise_thresh_44[11]={ + /* .2,.2,.3,.4,.5,.5,9999.,9999.,9999.,9999., */ + .2,.2,.2,.4,.6,9999.,9999.,9999.,9999.,9999.,9999., +}; + +static double _noise_thresh_5only[2]={ + .5,.5, +}; diff --git a/Libraries/Vorbis/Files/lib/modes/psych_8.h b/Libraries/Vorbis/Files/lib/modes/psych_8.h new file mode 100644 index 000000000..b6c8bc3a3 --- /dev/null +++ b/Libraries/Vorbis/Files/lib/modes/psych_8.h @@ -0,0 +1,102 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * + * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * + * by the XIPHOPHORUS Company http://www.xiph.org/ * + * * + ******************************************************************** + + function: 8kHz psychoacoustic settings + last mod: $Id$ + + ********************************************************************/ + +static att3 _psy_tone_masteratt_8[3]={ + {{ 32, 25, 12}, 0, 0}, /* 0 */ + {{ 30, 25, 12}, 0, 0}, /* 0 */ + {{ 20, 0, -14}, 0, 0}, /* 0 */ +}; + +static vp_adjblock _vp_tonemask_adj_8[3]={ + /* adjust for mode zero */ + /* 63 125 250 500 1 2 4 8 16 */ + {{-15,-15,-15,-15,-10,-10, -6, 0, 0, 0, 0,10, 0, 0,99,99,99}}, /* 1 */ + {{-15,-15,-15,-15,-10,-10, -6, 0, 0, 0, 0,10, 0, 0,99,99,99}}, /* 1 */ + {{-15,-15,-15,-15,-10,-10, -6, 0, 0, 0, 0, 0, 0, 0,99,99,99}}, /* 1 */ +}; + + +static noise3 _psy_noisebias_8[3]={ + /* 63 125 250 500 1k 2k 4k 8k 16k*/ + {{{-10,-10,-10,-10, -5, -5, -5, 0, 4, 8, 8, 8, 10, 10, 99, 99, 99}, + {-10,-10,-10,-10, -5, -5, -5, 0, 0, 4, 4, 4, 4, 4, 99, 99, 99}, + {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, 99, 99, 99}}}, + + {{{-10,-10,-10,-10, -5, -5, -5, 0, 4, 8, 8, 8, 10, 10, 99, 99, 99}, + {-10,-10,-10,-10,-10,-10, -5, -5, -5, 0, 0, 0, 0, 0, 99, 99, 99}, + {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, 99, 99, 99}}}, + + {{{-15,-15,-15,-15,-15,-12,-10, -8, 0, 2, 4, 4, 5, 5, 99, 99, 99}, + {-30,-30,-30,-30,-26,-22,-20,-14,-12,-12,-10,-10,-10,-10, 99, 99, 99}, + {-30,-30,-30,-30,-26,-26,-26,-26,-26,-26,-26,-26,-26,-24, 99, 99, 99}}}, +}; + +/* stereo mode by base quality level */ +static adj_stereo _psy_stereo_modes_8[3]={ + /* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 */ + {{ 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + { 6, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4}, + { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, + { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}}, + {{ 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + { 6, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4}, + { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, + { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}}, + {{ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4}, + { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, + { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}}, +}; + +static noiseguard _psy_noiseguards_8[2]={ + {10,10,-1}, + {10,10,-1}, +}; + +static compandblock _psy_compand_8[2]={ + {{ + 0, 1, 2, 3, 4, 5, 6, 7, /* 7dB */ + 8, 8, 9, 9,10,10,11, 11, /* 15dB */ + 12,12,13,13,14,14,15, 15, /* 23dB */ + 16,16,17,17,17,18,18, 19, /* 31dB */ + 19,19,20,21,22,23,24, 25, /* 39dB */ + }}, + {{ + 0, 1, 2, 3, 4, 5, 6, 6, /* 7dB */ + 7, 7, 6, 6, 5, 5, 4, 4, /* 15dB */ + 3, 3, 3, 4, 5, 6, 7, 8, /* 23dB */ + 9,10,11,12,13,14,15, 16, /* 31dB */ + 17,18,19,20,21,22,23, 24, /* 39dB */ + }}, +}; + +static double _psy_lowpass_8[3]={3.,4.,4.}; +static int _noise_start_8[2]={ + 64,64, +}; +static int _noise_part_8[2]={ + 8,8, +}; + +static int _psy_ath_floater_8[3]={ + -100,-100,-105, +}; + +static int _psy_ath_abs_8[3]={ + -130,-130,-140, +}; + diff --git a/Libraries/Vorbis/Files/lib/modes/residue_16.h b/Libraries/Vorbis/Files/lib/modes/residue_16.h new file mode 100644 index 000000000..62ba23b1c --- /dev/null +++ b/Libraries/Vorbis/Files/lib/modes/residue_16.h @@ -0,0 +1,163 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * + * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * + * by the XIPHOPHORUS Company http://www.xiph.org/ * + * * + ******************************************************************** + + function: toplevel residue templates 16/22kHz + last mod: $Id$ + + ********************************************************************/ + +/***** residue backends *********************************************/ + +static static_bookblock _resbook_16s_0={ + { + {0}, + {0,0,&_16c0_s_p1_0}, + {0,0,&_16c0_s_p2_0}, + {0,0,&_16c0_s_p3_0}, + {0,0,&_16c0_s_p4_0}, + {0,0,&_16c0_s_p5_0}, + {0,0,&_16c0_s_p6_0}, + {&_16c0_s_p7_0,&_16c0_s_p7_1}, + {&_16c0_s_p8_0,&_16c0_s_p8_1}, + {&_16c0_s_p9_0,&_16c0_s_p9_1,&_16c0_s_p9_2} + } +}; +static static_bookblock _resbook_16s_1={ + { + {0}, + {0,0,&_16c1_s_p1_0}, + {0,0,&_16c1_s_p2_0}, + {0,0,&_16c1_s_p3_0}, + {0,0,&_16c1_s_p4_0}, + {0,0,&_16c1_s_p5_0}, + {0,0,&_16c1_s_p6_0}, + {&_16c1_s_p7_0,&_16c1_s_p7_1}, + {&_16c1_s_p8_0,&_16c1_s_p8_1}, + {&_16c1_s_p9_0,&_16c1_s_p9_1,&_16c1_s_p9_2} + } +}; +static static_bookblock _resbook_16s_2={ + { + {0}, + {0,0,&_16c2_s_p1_0}, + {0,0,&_16c2_s_p2_0}, + {0,0,&_16c2_s_p3_0}, + {0,0,&_16c2_s_p4_0}, + {&_16c2_s_p5_0,&_16c2_s_p5_1}, + {&_16c2_s_p6_0,&_16c2_s_p6_1}, + {&_16c2_s_p7_0,&_16c2_s_p7_1}, + {&_16c2_s_p8_0,&_16c2_s_p8_1}, + {&_16c2_s_p9_0,&_16c2_s_p9_1,&_16c2_s_p9_2} + } +}; + +static vorbis_residue_template _res_16s_0[]={ + {2,0, &_residue_44_mid, + &_huff_book__16c0_s_single,&_huff_book__16c0_s_single, + &_resbook_16s_0,&_resbook_16s_0}, +}; +static vorbis_residue_template _res_16s_1[]={ + {2,0, &_residue_44_mid, + &_huff_book__16c1_s_short,&_huff_book__16c1_s_short, + &_resbook_16s_1,&_resbook_16s_1}, + + {2,0, &_residue_44_mid, + &_huff_book__16c1_s_long,&_huff_book__16c1_s_long, + &_resbook_16s_1,&_resbook_16s_1} +}; +static vorbis_residue_template _res_16s_2[]={ + {2,0, &_residue_44_high, + &_huff_book__16c2_s_short,&_huff_book__16c2_s_short, + &_resbook_16s_2,&_resbook_16s_2}, + + {2,0, &_residue_44_high, + &_huff_book__16c2_s_long,&_huff_book__16c2_s_long, + &_resbook_16s_2,&_resbook_16s_2} +}; + +static vorbis_mapping_template _mapres_template_16_stereo[3]={ + { _map_nominal, _res_16s_0 }, /* 0 */ + { _map_nominal, _res_16s_1 }, /* 1 */ + { _map_nominal, _res_16s_2 }, /* 2 */ +}; + +static static_bookblock _resbook_16u_0={ + { + {0}, + {0,0,&_16u0__p1_0}, + {0,0,&_16u0__p2_0}, + {0,0,&_16u0__p3_0}, + {0,0,&_16u0__p4_0}, + {0,0,&_16u0__p5_0}, + {&_16u0__p6_0,&_16u0__p6_1}, + {&_16u0__p7_0,&_16u0__p7_1,&_16u0__p7_2} + } +}; +static static_bookblock _resbook_16u_1={ + { + {0}, + {0,0,&_16u1__p1_0}, + {0,0,&_16u1__p2_0}, + {0,0,&_16u1__p3_0}, + {0,0,&_16u1__p4_0}, + {0,0,&_16u1__p5_0}, + {0,0,&_16u1__p6_0}, + {&_16u1__p7_0,&_16u1__p7_1}, + {&_16u1__p8_0,&_16u1__p8_1}, + {&_16u1__p9_0,&_16u1__p9_1,&_16u1__p9_2} + } +}; +static static_bookblock _resbook_16u_2={ + { + {0}, + {0,0,&_16u2_p1_0}, + {0,0,&_16u2_p2_0}, + {0,0,&_16u2_p3_0}, + {0,0,&_16u2_p4_0}, + {&_16u2_p5_0,&_16u2_p5_1}, + {&_16u2_p6_0,&_16u2_p6_1}, + {&_16u2_p7_0,&_16u2_p7_1}, + {&_16u2_p8_0,&_16u2_p8_1}, + {&_16u2_p9_0,&_16u2_p9_1,&_16u2_p9_2} + } +}; + +static vorbis_residue_template _res_16u_0[]={ + {1,0, &_residue_44_low_un, + &_huff_book__16u0__single,&_huff_book__16u0__single, + &_resbook_16u_0,&_resbook_16u_0}, +}; +static vorbis_residue_template _res_16u_1[]={ + {1,0, &_residue_44_mid_un, + &_huff_book__16u1__short,&_huff_book__16u1__short, + &_resbook_16u_1,&_resbook_16u_1}, + + {1,0, &_residue_44_mid_un, + &_huff_book__16u1__long,&_huff_book__16u1__long, + &_resbook_16u_1,&_resbook_16u_1} +}; +static vorbis_residue_template _res_16u_2[]={ + {1,0, &_residue_44_hi_un, + &_huff_book__16u2__short,&_huff_book__16u2__short, + &_resbook_16u_2,&_resbook_16u_2}, + + {1,0, &_residue_44_hi_un, + &_huff_book__16u2__long,&_huff_book__16u2__long, + &_resbook_16u_2,&_resbook_16u_2} +}; + + +static vorbis_mapping_template _mapres_template_16_uncoupled[3]={ + { _map_nominal_u, _res_16u_0 }, /* 0 */ + { _map_nominal_u, _res_16u_1 }, /* 1 */ + { _map_nominal_u, _res_16u_2 }, /* 2 */ +}; diff --git a/Libraries/Vorbis/Files/lib/modes/residue_44.h b/Libraries/Vorbis/Files/lib/modes/residue_44.h new file mode 100644 index 000000000..4d6877995 --- /dev/null +++ b/Libraries/Vorbis/Files/lib/modes/residue_44.h @@ -0,0 +1,294 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * + * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * + * by the XIPHOPHORUS Company http://www.xiph.org/ * + * * + ******************************************************************** + + function: toplevel residue templates for 32/44.1/48kHz + last mod: $Id$ + + ********************************************************************/ + +#include "vorbis/codec.h" +#include "backends.h" +#include "books/coupled/res_books_stereo.h" + +/***** residue backends *********************************************/ + +static vorbis_info_residue0 _residue_44_low={ + 0,-1, -1, 9,-1, + /* 0 1 2 3 4 5 6 7 */ + {0}, + {-1}, + { .5, 1.5, 2.5, 2.5, 4.5, 8.5, 16.5, 32.5}, + { .5, .5, .5, 999., 4.5, 8.5, 16.5, 32.5}, +}; + +static vorbis_info_residue0 _residue_44_mid={ + 0,-1, -1, 10,-1, + /* 0 1 2 3 4 5 6 7 8 */ + {0}, + {-1}, + { .5, 1.5, 1.5, 2.5, 2.5, 4.5, 8.5, 16.5, 32.5}, + { .5, .5, 999., .5, 999., 4.5, 8.5, 16.5, 32.5}, +}; + +static vorbis_info_residue0 _residue_44_high={ + 0,-1, -1, 10,-1, + /* 0 1 2 3 4 5 6 7 8 */ + {0}, + {-1}, + { .5, 1.5, 2.5, 4.5, 8.5, 16.5, 32.5, 71.5,157.5}, + { .5, 1.5, 2.5, 3.5, 4.5, 8.5, 16.5, 71.5,157.5}, +}; + +static static_bookblock _resbook_44s_n1={ + { + {0},{0,0,&_44cn1_s_p1_0},{0,0,&_44cn1_s_p2_0}, + {0,0,&_44cn1_s_p3_0},{0,0,&_44cn1_s_p4_0},{0,0,&_44cn1_s_p5_0}, + {&_44cn1_s_p6_0,&_44cn1_s_p6_1},{&_44cn1_s_p7_0,&_44cn1_s_p7_1}, + {&_44cn1_s_p8_0,&_44cn1_s_p8_1,&_44cn1_s_p8_2} + } +}; +static static_bookblock _resbook_44sm_n1={ + { + {0},{0,0,&_44cn1_sm_p1_0},{0,0,&_44cn1_sm_p2_0}, + {0,0,&_44cn1_sm_p3_0},{0,0,&_44cn1_sm_p4_0},{0,0,&_44cn1_sm_p5_0}, + {&_44cn1_sm_p6_0,&_44cn1_sm_p6_1},{&_44cn1_sm_p7_0,&_44cn1_sm_p7_1}, + {&_44cn1_sm_p8_0,&_44cn1_sm_p8_1,&_44cn1_sm_p8_2} + } +}; + +static static_bookblock _resbook_44s_0={ + { + {0},{0,0,&_44c0_s_p1_0},{0,0,&_44c0_s_p2_0}, + {0,0,&_44c0_s_p3_0},{0,0,&_44c0_s_p4_0},{0,0,&_44c0_s_p5_0}, + {&_44c0_s_p6_0,&_44c0_s_p6_1},{&_44c0_s_p7_0,&_44c0_s_p7_1}, + {&_44c0_s_p8_0,&_44c0_s_p8_1,&_44c0_s_p8_2} + } +}; +static static_bookblock _resbook_44sm_0={ + { + {0},{0,0,&_44c0_sm_p1_0},{0,0,&_44c0_sm_p2_0}, + {0,0,&_44c0_sm_p3_0},{0,0,&_44c0_sm_p4_0},{0,0,&_44c0_sm_p5_0}, + {&_44c0_sm_p6_0,&_44c0_sm_p6_1},{&_44c0_sm_p7_0,&_44c0_sm_p7_1}, + {&_44c0_sm_p8_0,&_44c0_sm_p8_1,&_44c0_sm_p8_2} + } +}; + +static static_bookblock _resbook_44s_1={ + { + {0},{0,0,&_44c1_s_p1_0},{0,0,&_44c1_s_p2_0}, + {0,0,&_44c1_s_p3_0},{0,0,&_44c1_s_p4_0},{0,0,&_44c1_s_p5_0}, + {&_44c1_s_p6_0,&_44c1_s_p6_1},{&_44c1_s_p7_0,&_44c1_s_p7_1}, + {&_44c1_s_p8_0,&_44c1_s_p8_1,&_44c1_s_p8_2} + } +}; +static static_bookblock _resbook_44sm_1={ + { + {0},{0,0,&_44c1_sm_p1_0},{0,0,&_44c1_sm_p2_0}, + {0,0,&_44c1_sm_p3_0},{0,0,&_44c1_sm_p4_0},{0,0,&_44c1_sm_p5_0}, + {&_44c1_sm_p6_0,&_44c1_sm_p6_1},{&_44c1_sm_p7_0,&_44c1_sm_p7_1}, + {&_44c1_sm_p8_0,&_44c1_sm_p8_1,&_44c1_sm_p8_2} + } +}; + +static static_bookblock _resbook_44s_2={ + { + {0},{0,0,&_44c2_s_p1_0},{0,0,&_44c2_s_p2_0},{0,0,&_44c2_s_p3_0}, + {0,0,&_44c2_s_p4_0},{0,0,&_44c2_s_p5_0},{0,0,&_44c2_s_p6_0}, + {&_44c2_s_p7_0,&_44c2_s_p7_1},{&_44c2_s_p8_0,&_44c2_s_p8_1}, + {&_44c2_s_p9_0,&_44c2_s_p9_1,&_44c2_s_p9_2} + } +}; +static static_bookblock _resbook_44s_3={ + { + {0},{0,0,&_44c3_s_p1_0},{0,0,&_44c3_s_p2_0},{0,0,&_44c3_s_p3_0}, + {0,0,&_44c3_s_p4_0},{0,0,&_44c3_s_p5_0},{0,0,&_44c3_s_p6_0}, + {&_44c3_s_p7_0,&_44c3_s_p7_1},{&_44c3_s_p8_0,&_44c3_s_p8_1}, + {&_44c3_s_p9_0,&_44c3_s_p9_1,&_44c3_s_p9_2} + } +}; +static static_bookblock _resbook_44s_4={ + { + {0},{0,0,&_44c4_s_p1_0},{0,0,&_44c4_s_p2_0},{0,0,&_44c4_s_p3_0}, + {0,0,&_44c4_s_p4_0},{0,0,&_44c4_s_p5_0},{0,0,&_44c4_s_p6_0}, + {&_44c4_s_p7_0,&_44c4_s_p7_1},{&_44c4_s_p8_0,&_44c4_s_p8_1}, + {&_44c4_s_p9_0,&_44c4_s_p9_1,&_44c4_s_p9_2} + } +}; +static static_bookblock _resbook_44s_5={ + { + {0},{0,0,&_44c5_s_p1_0},{0,0,&_44c5_s_p2_0},{0,0,&_44c5_s_p3_0}, + {0,0,&_44c5_s_p4_0},{0,0,&_44c5_s_p5_0},{0,0,&_44c5_s_p6_0}, + {&_44c5_s_p7_0,&_44c5_s_p7_1},{&_44c5_s_p8_0,&_44c5_s_p8_1}, + {&_44c5_s_p9_0,&_44c5_s_p9_1,&_44c5_s_p9_2} + } +}; +static static_bookblock _resbook_44s_6={ + { + {0},{0,0,&_44c6_s_p1_0},{0,0,&_44c6_s_p2_0},{0,0,&_44c6_s_p3_0}, + {0,0,&_44c6_s_p4_0}, + {&_44c6_s_p5_0,&_44c6_s_p5_1}, + {&_44c6_s_p6_0,&_44c6_s_p6_1}, + {&_44c6_s_p7_0,&_44c6_s_p7_1}, + {&_44c6_s_p8_0,&_44c6_s_p8_1}, + {&_44c6_s_p9_0,&_44c6_s_p9_1,&_44c6_s_p9_2} + } +}; +static static_bookblock _resbook_44s_7={ + { + {0},{0,0,&_44c7_s_p1_0},{0,0,&_44c7_s_p2_0},{0,0,&_44c7_s_p3_0}, + {0,0,&_44c7_s_p4_0}, + {&_44c7_s_p5_0,&_44c7_s_p5_1}, + {&_44c7_s_p6_0,&_44c7_s_p6_1}, + {&_44c7_s_p7_0,&_44c7_s_p7_1}, + {&_44c7_s_p8_0,&_44c7_s_p8_1}, + {&_44c7_s_p9_0,&_44c7_s_p9_1,&_44c7_s_p9_2} + } +}; +static static_bookblock _resbook_44s_8={ + { + {0},{0,0,&_44c8_s_p1_0},{0,0,&_44c8_s_p2_0},{0,0,&_44c8_s_p3_0}, + {0,0,&_44c8_s_p4_0}, + {&_44c8_s_p5_0,&_44c8_s_p5_1}, + {&_44c8_s_p6_0,&_44c8_s_p6_1}, + {&_44c8_s_p7_0,&_44c8_s_p7_1}, + {&_44c8_s_p8_0,&_44c8_s_p8_1}, + {&_44c8_s_p9_0,&_44c8_s_p9_1,&_44c8_s_p9_2} + } +}; +static static_bookblock _resbook_44s_9={ + { + {0},{0,0,&_44c9_s_p1_0},{0,0,&_44c9_s_p2_0},{0,0,&_44c9_s_p3_0}, + {0,0,&_44c9_s_p4_0}, + {&_44c9_s_p5_0,&_44c9_s_p5_1}, + {&_44c9_s_p6_0,&_44c9_s_p6_1}, + {&_44c9_s_p7_0,&_44c9_s_p7_1}, + {&_44c9_s_p8_0,&_44c9_s_p8_1}, + {&_44c9_s_p9_0,&_44c9_s_p9_1,&_44c9_s_p9_2} + } +}; + +static vorbis_residue_template _res_44s_n1[]={ + {2,0, &_residue_44_low, + &_huff_book__44cn1_s_short,&_huff_book__44cn1_sm_short, + &_resbook_44s_n1,&_resbook_44sm_n1}, + + {2,0, &_residue_44_low, + &_huff_book__44cn1_s_long,&_huff_book__44cn1_sm_long, + &_resbook_44s_n1,&_resbook_44sm_n1} +}; +static vorbis_residue_template _res_44s_0[]={ + {2,0, &_residue_44_low, + &_huff_book__44c0_s_short,&_huff_book__44c0_sm_short, + &_resbook_44s_0,&_resbook_44sm_0}, + + {2,0, &_residue_44_low, + &_huff_book__44c0_s_long,&_huff_book__44c0_sm_long, + &_resbook_44s_0,&_resbook_44sm_0} +}; +static vorbis_residue_template _res_44s_1[]={ + {2,0, &_residue_44_low, + &_huff_book__44c1_s_short,&_huff_book__44c1_sm_short, + &_resbook_44s_1,&_resbook_44sm_1}, + + {2,0, &_residue_44_low, + &_huff_book__44c1_s_long,&_huff_book__44c1_sm_long, + &_resbook_44s_1,&_resbook_44sm_1} +}; + +static vorbis_residue_template _res_44s_2[]={ + {2,0, &_residue_44_mid, + &_huff_book__44c2_s_short,&_huff_book__44c2_s_short, + &_resbook_44s_2,&_resbook_44s_2}, + + {2,0, &_residue_44_mid, + &_huff_book__44c2_s_long,&_huff_book__44c2_s_long, + &_resbook_44s_2,&_resbook_44s_2} +}; +static vorbis_residue_template _res_44s_3[]={ + {2,0, &_residue_44_mid, + &_huff_book__44c3_s_short,&_huff_book__44c3_s_short, + &_resbook_44s_3,&_resbook_44s_3}, + + {2,0, &_residue_44_mid, + &_huff_book__44c3_s_long,&_huff_book__44c3_s_long, + &_resbook_44s_3,&_resbook_44s_3} +}; +static vorbis_residue_template _res_44s_4[]={ + {2,0, &_residue_44_mid, + &_huff_book__44c4_s_short,&_huff_book__44c4_s_short, + &_resbook_44s_4,&_resbook_44s_4}, + + {2,0, &_residue_44_mid, + &_huff_book__44c4_s_long,&_huff_book__44c4_s_long, + &_resbook_44s_4,&_resbook_44s_4} +}; +static vorbis_residue_template _res_44s_5[]={ + {2,0, &_residue_44_mid, + &_huff_book__44c5_s_short,&_huff_book__44c5_s_short, + &_resbook_44s_5,&_resbook_44s_5}, + + {2,0, &_residue_44_mid, + &_huff_book__44c5_s_long,&_huff_book__44c5_s_long, + &_resbook_44s_5,&_resbook_44s_5} +}; +static vorbis_residue_template _res_44s_6[]={ + {2,0, &_residue_44_high, + &_huff_book__44c6_s_short,&_huff_book__44c6_s_short, + &_resbook_44s_6,&_resbook_44s_6}, + + {2,0, &_residue_44_high, + &_huff_book__44c6_s_long,&_huff_book__44c6_s_long, + &_resbook_44s_6,&_resbook_44s_6} +}; +static vorbis_residue_template _res_44s_7[]={ + {2,0, &_residue_44_high, + &_huff_book__44c7_s_short,&_huff_book__44c7_s_short, + &_resbook_44s_7,&_resbook_44s_7}, + + {2,0, &_residue_44_high, + &_huff_book__44c7_s_long,&_huff_book__44c7_s_long, + &_resbook_44s_7,&_resbook_44s_7} +}; +static vorbis_residue_template _res_44s_8[]={ + {2,0, &_residue_44_high, + &_huff_book__44c8_s_short,&_huff_book__44c8_s_short, + &_resbook_44s_8,&_resbook_44s_8}, + + {2,0, &_residue_44_high, + &_huff_book__44c8_s_long,&_huff_book__44c8_s_long, + &_resbook_44s_8,&_resbook_44s_8} +}; +static vorbis_residue_template _res_44s_9[]={ + {2,0, &_residue_44_high, + &_huff_book__44c9_s_short,&_huff_book__44c9_s_short, + &_resbook_44s_9,&_resbook_44s_9}, + + {2,0, &_residue_44_high, + &_huff_book__44c9_s_long,&_huff_book__44c9_s_long, + &_resbook_44s_9,&_resbook_44s_9} +}; + +static vorbis_mapping_template _mapres_template_44_stereo[]={ + { _map_nominal, _res_44s_n1 }, /* -1 */ + { _map_nominal, _res_44s_0 }, /* 0 */ + { _map_nominal, _res_44s_1 }, /* 1 */ + { _map_nominal, _res_44s_2 }, /* 2 */ + { _map_nominal, _res_44s_3 }, /* 3 */ + { _map_nominal, _res_44s_4 }, /* 4 */ + { _map_nominal, _res_44s_5 }, /* 5 */ + { _map_nominal, _res_44s_6 }, /* 6 */ + { _map_nominal, _res_44s_7 }, /* 7 */ + { _map_nominal, _res_44s_8 }, /* 8 */ + { _map_nominal, _res_44s_9 }, /* 9 */ +}; + + diff --git a/Libraries/Vorbis/Files/lib/modes/residue_44u.h b/Libraries/Vorbis/Files/lib/modes/residue_44u.h new file mode 100644 index 000000000..78f957218 --- /dev/null +++ b/Libraries/Vorbis/Files/lib/modes/residue_44u.h @@ -0,0 +1,318 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * + * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * + * by the XIPHOPHORUS Company http://www.xiph.org/ * + * * + ******************************************************************** + + function: toplevel residue templates for 32/44.1/48kHz uncoupled + last mod: $Id$ + + ********************************************************************/ + +#include "vorbis/codec.h" +#include "backends.h" +#include "books/uncoupled/res_books_uncoupled.h" + +/***** residue backends *********************************************/ + + +static vorbis_info_residue0 _residue_44_low_un={ + 0,-1, -1, 8,-1, + {0}, + {-1}, + { .5, 1.5, 1.5, 2.5, 2.5, 4.5, 28.5}, + { -1, 25, -1, 45, -1, -1, -1} +}; + +static vorbis_info_residue0 _residue_44_mid_un={ + 0,-1, -1, 10,-1, + /* 0 1 2 3 4 5 6 7 8 9 */ + {0}, + {-1}, + { .5, 1.5, 1.5, 2.5, 2.5, 4.5, 4.5, 16.5, 60.5}, + { -1, 30, -1, 50, -1, 80, -1, -1, -1} +}; + +static vorbis_info_residue0 _residue_44_hi_un={ + 0,-1, -1, 10,-1, + /* 0 1 2 3 4 5 6 7 8 9 */ + {0}, + {-1}, + { .5, 1.5, 2.5, 4.5, 8.5, 16.5, 32.5, 71.5,157.5}, + { -1, -1, -1, -1, -1, -1, -1, -1, -1} +}; + +/* mapping conventions: + only one submap (this would change for efficient 5.1 support for example)*/ +/* Four psychoacoustic profiles are used, one for each blocktype */ +static vorbis_info_mapping0 _map_nominal_u[2]={ + {1, {0,0}, {0}, {0}, 0,{0},{0}}, + {1, {0,0}, {1}, {1}, 0,{0},{0}} +}; + +static static_bookblock _resbook_44u_n1={ + { + {0}, + {0,0,&_44un1__p1_0}, + {0,0,&_44un1__p2_0}, + {0,0,&_44un1__p3_0}, + {0,0,&_44un1__p4_0}, + {0,0,&_44un1__p5_0}, + {&_44un1__p6_0,&_44un1__p6_1}, + {&_44un1__p7_0,&_44un1__p7_1,&_44un1__p7_2} + } +}; +static static_bookblock _resbook_44u_0={ + { + {0}, + {0,0,&_44u0__p1_0}, + {0,0,&_44u0__p2_0}, + {0,0,&_44u0__p3_0}, + {0,0,&_44u0__p4_0}, + {0,0,&_44u0__p5_0}, + {&_44u0__p6_0,&_44u0__p6_1}, + {&_44u0__p7_0,&_44u0__p7_1,&_44u0__p7_2} + } +}; +static static_bookblock _resbook_44u_1={ + { + {0}, + {0,0,&_44u1__p1_0}, + {0,0,&_44u1__p2_0}, + {0,0,&_44u1__p3_0}, + {0,0,&_44u1__p4_0}, + {0,0,&_44u1__p5_0}, + {&_44u1__p6_0,&_44u1__p6_1}, + {&_44u1__p7_0,&_44u1__p7_1,&_44u1__p7_2} + } +}; +static static_bookblock _resbook_44u_2={ + { + {0}, + {0,0,&_44u2__p1_0}, + {0,0,&_44u2__p2_0}, + {0,0,&_44u2__p3_0}, + {0,0,&_44u2__p4_0}, + {0,0,&_44u2__p5_0}, + {&_44u2__p6_0,&_44u2__p6_1}, + {&_44u2__p7_0,&_44u2__p7_1,&_44u2__p7_2} + } +}; +static static_bookblock _resbook_44u_3={ + { + {0}, + {0,0,&_44u3__p1_0}, + {0,0,&_44u3__p2_0}, + {0,0,&_44u3__p3_0}, + {0,0,&_44u3__p4_0}, + {0,0,&_44u3__p5_0}, + {&_44u3__p6_0,&_44u3__p6_1}, + {&_44u3__p7_0,&_44u3__p7_1,&_44u3__p7_2} + } +}; +static static_bookblock _resbook_44u_4={ + { + {0}, + {0,0,&_44u4__p1_0}, + {0,0,&_44u4__p2_0}, + {0,0,&_44u4__p3_0}, + {0,0,&_44u4__p4_0}, + {0,0,&_44u4__p5_0}, + {&_44u4__p6_0,&_44u4__p6_1}, + {&_44u4__p7_0,&_44u4__p7_1,&_44u4__p7_2} + } +}; +static static_bookblock _resbook_44u_5={ + { + {0}, + {0,0,&_44u5__p1_0}, + {0,0,&_44u5__p2_0}, + {0,0,&_44u5__p3_0}, + {0,0,&_44u5__p4_0}, + {0,0,&_44u5__p5_0}, + {0,0,&_44u5__p6_0}, + {&_44u5__p7_0,&_44u5__p7_1}, + {&_44u5__p8_0,&_44u5__p8_1}, + {&_44u5__p9_0,&_44u5__p9_1,&_44u5__p9_2} + } +}; +static static_bookblock _resbook_44u_6={ + { + {0}, + {0,0,&_44u6__p1_0}, + {0,0,&_44u6__p2_0}, + {0,0,&_44u6__p3_0}, + {0,0,&_44u6__p4_0}, + {0,0,&_44u6__p5_0}, + {0,0,&_44u6__p6_0}, + {&_44u6__p7_0,&_44u6__p7_1}, + {&_44u6__p8_0,&_44u6__p8_1}, + {&_44u6__p9_0,&_44u6__p9_1,&_44u6__p9_2} + } +}; +static static_bookblock _resbook_44u_7={ + { + {0}, + {0,0,&_44u7__p1_0}, + {0,0,&_44u7__p2_0}, + {0,0,&_44u7__p3_0}, + {0,0,&_44u7__p4_0}, + {0,0,&_44u7__p5_0}, + {0,0,&_44u7__p6_0}, + {&_44u7__p7_0,&_44u7__p7_1}, + {&_44u7__p8_0,&_44u7__p8_1}, + {&_44u7__p9_0,&_44u7__p9_1,&_44u7__p9_2} + } +}; +static static_bookblock _resbook_44u_8={ + { + {0}, + {0,0,&_44u8_p1_0}, + {0,0,&_44u8_p2_0}, + {0,0,&_44u8_p3_0}, + {0,0,&_44u8_p4_0}, + {&_44u8_p5_0,&_44u8_p5_1}, + {&_44u8_p6_0,&_44u8_p6_1}, + {&_44u8_p7_0,&_44u8_p7_1}, + {&_44u8_p8_0,&_44u8_p8_1}, + {&_44u8_p9_0,&_44u8_p9_1,&_44u8_p9_2} + } +}; +static static_bookblock _resbook_44u_9={ + { + {0}, + {0,0,&_44u9_p1_0}, + {0,0,&_44u9_p2_0}, + {0,0,&_44u9_p3_0}, + {0,0,&_44u9_p4_0}, + {&_44u9_p5_0,&_44u9_p5_1}, + {&_44u9_p6_0,&_44u9_p6_1}, + {&_44u9_p7_0,&_44u9_p7_1}, + {&_44u9_p8_0,&_44u9_p8_1}, + {&_44u9_p9_0,&_44u9_p9_1,&_44u9_p9_2} + } +}; + +static vorbis_residue_template _res_44u_n1[]={ + {1,0, &_residue_44_low_un, + &_huff_book__44un1__short,&_huff_book__44un1__short, + &_resbook_44u_n1,&_resbook_44u_n1}, + + {1,0, &_residue_44_low_un, + &_huff_book__44un1__long,&_huff_book__44un1__long, + &_resbook_44u_n1,&_resbook_44u_n1} +}; +static vorbis_residue_template _res_44u_0[]={ + {1,0, &_residue_44_low_un, + &_huff_book__44u0__short,&_huff_book__44u0__short, + &_resbook_44u_0,&_resbook_44u_0}, + + {1,0, &_residue_44_low_un, + &_huff_book__44u0__long,&_huff_book__44u0__long, + &_resbook_44u_0,&_resbook_44u_0} +}; +static vorbis_residue_template _res_44u_1[]={ + {1,0, &_residue_44_low_un, + &_huff_book__44u1__short,&_huff_book__44u1__short, + &_resbook_44u_1,&_resbook_44u_1}, + + {1,0, &_residue_44_low_un, + &_huff_book__44u1__long,&_huff_book__44u1__long, + &_resbook_44u_1,&_resbook_44u_1} +}; +static vorbis_residue_template _res_44u_2[]={ + {1,0, &_residue_44_low_un, + &_huff_book__44u2__short,&_huff_book__44u2__short, + &_resbook_44u_2,&_resbook_44u_2}, + + {1,0, &_residue_44_low_un, + &_huff_book__44u2__long,&_huff_book__44u2__long, + &_resbook_44u_2,&_resbook_44u_2} +}; +static vorbis_residue_template _res_44u_3[]={ + {1,0, &_residue_44_low_un, + &_huff_book__44u3__short,&_huff_book__44u3__short, + &_resbook_44u_3,&_resbook_44u_3}, + + {1,0, &_residue_44_low_un, + &_huff_book__44u3__long,&_huff_book__44u3__long, + &_resbook_44u_3,&_resbook_44u_3} +}; +static vorbis_residue_template _res_44u_4[]={ + {1,0, &_residue_44_low_un, + &_huff_book__44u4__short,&_huff_book__44u4__short, + &_resbook_44u_4,&_resbook_44u_4}, + + {1,0, &_residue_44_low_un, + &_huff_book__44u4__long,&_huff_book__44u4__long, + &_resbook_44u_4,&_resbook_44u_4} +}; + +static vorbis_residue_template _res_44u_5[]={ + {1,0, &_residue_44_mid_un, + &_huff_book__44u5__short,&_huff_book__44u5__short, + &_resbook_44u_5,&_resbook_44u_5}, + + {1,0, &_residue_44_mid_un, + &_huff_book__44u5__long,&_huff_book__44u5__long, + &_resbook_44u_5,&_resbook_44u_5} +}; + +static vorbis_residue_template _res_44u_6[]={ + {1,0, &_residue_44_mid_un, + &_huff_book__44u6__short,&_huff_book__44u6__short, + &_resbook_44u_6,&_resbook_44u_6}, + + {1,0, &_residue_44_mid_un, + &_huff_book__44u6__long,&_huff_book__44u6__long, + &_resbook_44u_6,&_resbook_44u_6} +}; + +static vorbis_residue_template _res_44u_7[]={ + {1,0, &_residue_44_mid_un, + &_huff_book__44u7__short,&_huff_book__44u7__short, + &_resbook_44u_7,&_resbook_44u_7}, + + {1,0, &_residue_44_mid_un, + &_huff_book__44u7__long,&_huff_book__44u7__long, + &_resbook_44u_7,&_resbook_44u_7} +}; + +static vorbis_residue_template _res_44u_8[]={ + {1,0, &_residue_44_hi_un, + &_huff_book__44u8__short,&_huff_book__44u8__short, + &_resbook_44u_8,&_resbook_44u_8}, + + {1,0, &_residue_44_hi_un, + &_huff_book__44u8__long,&_huff_book__44u8__long, + &_resbook_44u_8,&_resbook_44u_8} +}; +static vorbis_residue_template _res_44u_9[]={ + {1,0, &_residue_44_hi_un, + &_huff_book__44u9__short,&_huff_book__44u9__short, + &_resbook_44u_9,&_resbook_44u_9}, + + {1,0, &_residue_44_hi_un, + &_huff_book__44u9__long,&_huff_book__44u9__long, + &_resbook_44u_9,&_resbook_44u_9} +}; + +static vorbis_mapping_template _mapres_template_44_uncoupled[]={ + { _map_nominal_u, _res_44u_n1 }, /* -1 */ + { _map_nominal_u, _res_44u_0 }, /* 0 */ + { _map_nominal_u, _res_44u_1 }, /* 1 */ + { _map_nominal_u, _res_44u_2 }, /* 2 */ + { _map_nominal_u, _res_44u_3 }, /* 3 */ + { _map_nominal_u, _res_44u_4 }, /* 4 */ + { _map_nominal_u, _res_44u_5 }, /* 5 */ + { _map_nominal_u, _res_44u_6 }, /* 6 */ + { _map_nominal_u, _res_44u_7 }, /* 7 */ + { _map_nominal_u, _res_44u_8 }, /* 8 */ + { _map_nominal_u, _res_44u_9 }, /* 9 */ +}; diff --git a/Libraries/Vorbis/Files/lib/modes/residue_8.h b/Libraries/Vorbis/Files/lib/modes/residue_8.h new file mode 100644 index 000000000..ed6fa5bc9 --- /dev/null +++ b/Libraries/Vorbis/Files/lib/modes/residue_8.h @@ -0,0 +1,97 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * + * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * + * by the XIPHOPHORUS Company http://www.xiph.org/ * + * * + ******************************************************************** + + function: toplevel residue templates 8/11kHz + last mod: $Id$ + + ********************************************************************/ + +#include "vorbis/codec.h" +#include "backends.h" + +/***** residue backends *********************************************/ + +static static_bookblock _resbook_8s_0={ + { + {0},{0,0,&_8c0_s_p1_0},{0,0,&_8c0_s_p2_0},{0,0,&_8c0_s_p3_0}, + {0,0,&_8c0_s_p4_0},{0,0,&_8c0_s_p5_0},{0,0,&_8c0_s_p6_0}, + {&_8c0_s_p7_0,&_8c0_s_p7_1},{&_8c0_s_p8_0,&_8c0_s_p8_1}, + {&_8c0_s_p9_0,&_8c0_s_p9_1,&_8c0_s_p9_2} + } +}; +static static_bookblock _resbook_8s_1={ + { + {0},{0,0,&_8c1_s_p1_0},{0,0,&_8c1_s_p2_0},{0,0,&_8c1_s_p3_0}, + {0,0,&_8c1_s_p4_0},{0,0,&_8c1_s_p5_0},{0,0,&_8c1_s_p6_0}, + {&_8c1_s_p7_0,&_8c1_s_p7_1},{&_8c1_s_p8_0,&_8c1_s_p8_1}, + {&_8c1_s_p9_0,&_8c1_s_p9_1,&_8c1_s_p9_2} + } +}; + +static vorbis_residue_template _res_8s_0[]={ + {2,0, &_residue_44_mid, + &_huff_book__8c0_s_single,&_huff_book__8c0_s_single, + &_resbook_8s_0,&_resbook_8s_0}, +}; +static vorbis_residue_template _res_8s_1[]={ + {2,0, &_residue_44_mid, + &_huff_book__8c1_s_single,&_huff_book__8c1_s_single, + &_resbook_8s_1,&_resbook_8s_1}, +}; + +static vorbis_mapping_template _mapres_template_8_stereo[2]={ + { _map_nominal, _res_8s_0 }, /* 0 */ + { _map_nominal, _res_8s_1 }, /* 1 */ +}; + +static static_bookblock _resbook_8u_0={ + { + {0}, + {0,0,&_8u0__p1_0}, + {0,0,&_8u0__p2_0}, + {0,0,&_8u0__p3_0}, + {0,0,&_8u0__p4_0}, + {0,0,&_8u0__p5_0}, + {&_8u0__p6_0,&_8u0__p6_1}, + {&_8u0__p7_0,&_8u0__p7_1,&_8u0__p7_2} + } +}; +static static_bookblock _resbook_8u_1={ + { + {0}, + {0,0,&_8u1__p1_0}, + {0,0,&_8u1__p2_0}, + {0,0,&_8u1__p3_0}, + {0,0,&_8u1__p4_0}, + {0,0,&_8u1__p5_0}, + {0,0,&_8u1__p6_0}, + {&_8u1__p7_0,&_8u1__p7_1}, + {&_8u1__p8_0,&_8u1__p8_1}, + {&_8u1__p9_0,&_8u1__p9_1,&_8u1__p9_2} + } +}; + +static vorbis_residue_template _res_8u_0[]={ + {1,0, &_residue_44_low_un, + &_huff_book__8u0__single,&_huff_book__8u0__single, + &_resbook_8u_0,&_resbook_8u_0}, +}; +static vorbis_residue_template _res_8u_1[]={ + {1,0, &_residue_44_mid_un, + &_huff_book__8u1__single,&_huff_book__8u1__single, + &_resbook_8u_1,&_resbook_8u_1}, +}; + +static vorbis_mapping_template _mapres_template_8_uncoupled[2]={ + { _map_nominal_u, _res_8u_0 }, /* 0 */ + { _map_nominal_u, _res_8u_1 }, /* 1 */ +}; diff --git a/Libraries/Vorbis/Files/lib/modes/setup_11.h b/Libraries/Vorbis/Files/lib/modes/setup_11.h new file mode 100644 index 000000000..2997e6411 --- /dev/null +++ b/Libraries/Vorbis/Files/lib/modes/setup_11.h @@ -0,0 +1,141 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * + * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * + * by the XIPHOPHORUS Company http://www.xiph.org/ * + * * + ******************************************************************** + + function: 11kHz settings + last mod: $Id$ + + ********************************************************************/ + +#include "psych_11.h" + +static int blocksize_11[2]={ + 512,512 +}; + +static int _floor_mapping_11[2]={ + 6,6, +}; + +static double rate_mapping_11[3]={ + 8000.,13000.,44000., +}; + +static double rate_mapping_11_uncoupled[3]={ + 12000.,20000.,50000., +}; + +static double quality_mapping_11[3]={ + -.1,.0,1. +}; + +ve_setup_data_template ve_setup_11_stereo={ + 2, + rate_mapping_11, + quality_mapping_11, + 2, + 9000, + 15000, + + blocksize_11, + blocksize_11, + + _psy_tone_masteratt_11, + _psy_tone_0dB, + _psy_tone_suppress, + + _vp_tonemask_adj_11, + NULL, + _vp_tonemask_adj_11, + + _psy_noiseguards_8, + _psy_noisebias_11, + _psy_noisebias_11, + NULL, + NULL, + _psy_noise_suppress, + + _psy_compand_8, + _psy_compand_8_mapping, + NULL, + + {_noise_start_8,_noise_start_8}, + {_noise_part_8,_noise_part_8}, + _noise_thresh_11, + + _psy_ath_floater_8, + _psy_ath_abs_8, + + _psy_lowpass_11, + + _psy_global_44, + _global_mapping_8, + _psy_stereo_modes_8, + + _floor_books, + _floor, + _floor_mapping_11, + NULL, + + _mapres_template_8_stereo +}; + +ve_setup_data_template ve_setup_11_uncoupled={ + 2, + rate_mapping_11_uncoupled, + quality_mapping_11, + -1, + 9000, + 15000, + + blocksize_11, + blocksize_11, + + _psy_tone_masteratt_11, + _psy_tone_0dB, + _psy_tone_suppress, + + _vp_tonemask_adj_11, + NULL, + _vp_tonemask_adj_11, + + _psy_noiseguards_8, + _psy_noisebias_11, + _psy_noisebias_11, + NULL, + NULL, + _psy_noise_suppress, + + _psy_compand_8, + _psy_compand_8_mapping, + NULL, + + {_noise_start_8,_noise_start_8}, + {_noise_part_8,_noise_part_8}, + _noise_thresh_11, + + _psy_ath_floater_8, + _psy_ath_abs_8, + + _psy_lowpass_11, + + _psy_global_44, + _global_mapping_8, + _psy_stereo_modes_8, + + _floor_books, + _floor, + _floor_mapping_11, + NULL, + + _mapres_template_8_uncoupled +}; + diff --git a/Libraries/Vorbis/Files/lib/modes/setup_16.h b/Libraries/Vorbis/Files/lib/modes/setup_16.h new file mode 100644 index 000000000..87f998ce2 --- /dev/null +++ b/Libraries/Vorbis/Files/lib/modes/setup_16.h @@ -0,0 +1,149 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * + * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * + * by the XIPHOPHORUS Company http://www.xiph.org/ * + * * + ******************************************************************** + + function: 16kHz settings + last mod: $Id$ + + ********************************************************************/ + +#include "psych_16.h" +#include "residue_16.h" + +static int blocksize_16_short[3]={ + 1024,512,512 +}; +static int blocksize_16_long[3]={ + 1024,1024,1024 +}; + +static int _floor_mapping_16_short[3]={ + 9,3,3 +}; +static int _floor_mapping_16[3]={ + 9,9,9 +}; + +static double rate_mapping_16[4]={ + 12000.,20000.,44000.,86000. +}; + +static double rate_mapping_16_uncoupled[4]={ + 16000.,28000.,64000.,100000. +}; + +static double _global_mapping_16[4]={ 1., 2., 3., 4. }; + +static double quality_mapping_16[4]={ -.1,.05,.5,1. }; + +static double _psy_compand_16_mapping[4]={ 0., .8, 1., 1.}; + +ve_setup_data_template ve_setup_16_stereo={ + 3, + rate_mapping_16, + quality_mapping_16, + 2, + 15000, + 19000, + + blocksize_16_short, + blocksize_16_long, + + _psy_tone_masteratt_16, + _psy_tone_0dB, + _psy_tone_suppress, + + _vp_tonemask_adj_16, + _vp_tonemask_adj_16, + _vp_tonemask_adj_16, + + _psy_noiseguards_8, + _psy_noisebias_16_impulse, + _psy_noisebias_16_short, + _psy_noisebias_16_short, + _psy_noisebias_16, + _psy_noise_suppress, + + _psy_compand_8, + _psy_compand_16_mapping, + _psy_compand_16_mapping, + + {_noise_start_16,_noise_start_16}, + { _noise_part_16, _noise_part_16}, + _noise_thresh_16, + + _psy_ath_floater_16, + _psy_ath_abs_16, + + _psy_lowpass_16, + + _psy_global_44, + _global_mapping_16, + _psy_stereo_modes_16, + + _floor_books, + _floor, + _floor_mapping_16_short, + _floor_mapping_16, + + _mapres_template_16_stereo +}; + +ve_setup_data_template ve_setup_16_uncoupled={ + 3, + rate_mapping_16_uncoupled, + quality_mapping_16, + -1, + 15000, + 19000, + + blocksize_16_short, + blocksize_16_long, + + _psy_tone_masteratt_16, + _psy_tone_0dB, + _psy_tone_suppress, + + _vp_tonemask_adj_16, + _vp_tonemask_adj_16, + _vp_tonemask_adj_16, + + _psy_noiseguards_8, + _psy_noisebias_16_impulse, + _psy_noisebias_16_short, + _psy_noisebias_16_short, + _psy_noisebias_16, + _psy_noise_suppress, + + _psy_compand_8, + _psy_compand_16_mapping, + _psy_compand_16_mapping, + + {_noise_start_16,_noise_start_16}, + { _noise_part_16, _noise_part_16}, + _noise_thresh_16, + + _psy_ath_floater_16, + _psy_ath_abs_16, + + _psy_lowpass_16, + + _psy_global_44, + _global_mapping_16, + _psy_stereo_modes_16, + + _floor_books, + _floor, + _floor_mapping_16_short, + _floor_mapping_16, + + _mapres_template_16_uncoupled +}; diff --git a/Libraries/Vorbis/Files/lib/modes/setup_22.h b/Libraries/Vorbis/Files/lib/modes/setup_22.h new file mode 100644 index 000000000..f45c8082b --- /dev/null +++ b/Libraries/Vorbis/Files/lib/modes/setup_22.h @@ -0,0 +1,128 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * + * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * + * by the XIPHOPHORUS Company http://www.xiph.org/ * + * * + ******************************************************************** + + function: 22kHz settings + last mod: $Id$ + + ********************************************************************/ + +static double rate_mapping_22[4]={ + 15000.,20000.,44000.,86000. +}; + +static double rate_mapping_22_uncoupled[4]={ + 16000.,28000.,50000.,90000. +}; + +static double _psy_lowpass_22[4]={9.5,11.,30.,99.}; + +ve_setup_data_template ve_setup_22_stereo={ + 3, + rate_mapping_22, + quality_mapping_16, + 2, + 19000, + 26000, + + blocksize_16_short, + blocksize_16_long, + + _psy_tone_masteratt_16, + _psy_tone_0dB, + _psy_tone_suppress, + + _vp_tonemask_adj_16, + _vp_tonemask_adj_16, + _vp_tonemask_adj_16, + + _psy_noiseguards_8, + _psy_noisebias_16_impulse, + _psy_noisebias_16_short, + _psy_noisebias_16_short, + _psy_noisebias_16, + _psy_noise_suppress, + + _psy_compand_8, + _psy_compand_8_mapping, + _psy_compand_8_mapping, + + {_noise_start_16,_noise_start_16}, + { _noise_part_16, _noise_part_16}, + _noise_thresh_16, + + _psy_ath_floater_16, + _psy_ath_abs_16, + + _psy_lowpass_22, + + _psy_global_44, + _global_mapping_16, + _psy_stereo_modes_16, + + _floor_books, + _floor, + _floor_mapping_16_short, + _floor_mapping_16, + + _mapres_template_16_stereo +}; + +ve_setup_data_template ve_setup_22_uncoupled={ + 3, + rate_mapping_22_uncoupled, + quality_mapping_16, + -1, + 19000, + 26000, + + blocksize_16_short, + blocksize_16_long, + + _psy_tone_masteratt_16, + _psy_tone_0dB, + _psy_tone_suppress, + + _vp_tonemask_adj_16, + _vp_tonemask_adj_16, + _vp_tonemask_adj_16, + + _psy_noiseguards_8, + _psy_noisebias_16_impulse, + _psy_noisebias_16_short, + _psy_noisebias_16_short, + _psy_noisebias_16, + _psy_noise_suppress, + + _psy_compand_8, + _psy_compand_8_mapping, + _psy_compand_8_mapping, + + {_noise_start_16,_noise_start_16}, + { _noise_part_16, _noise_part_16}, + _noise_thresh_16, + + _psy_ath_floater_16, + _psy_ath_abs_16, + + _psy_lowpass_22, + + _psy_global_44, + _global_mapping_16, + _psy_stereo_modes_16, + + _floor_books, + _floor, + _floor_mapping_16_short, + _floor_mapping_16, + + _mapres_template_16_uncoupled +}; diff --git a/Libraries/Vorbis/Files/lib/modes/setup_32.h b/Libraries/Vorbis/Files/lib/modes/setup_32.h new file mode 100644 index 000000000..0ee027c1c --- /dev/null +++ b/Libraries/Vorbis/Files/lib/modes/setup_32.h @@ -0,0 +1,132 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * + * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * + * by the XIPHOPHORUS Company http://www.xiph.org/ * + * * + ******************************************************************** + + function: toplevel settings for 32kHz + last mod: $Id$ + + ********************************************************************/ + +static double rate_mapping_32[12]={ + 18000.,28000.,35000.,45000.,56000.,60000., + 75000.,90000.,100000.,115000.,150000.,190000., +}; + +static double rate_mapping_32_un[12]={ + 30000.,42000.,52000.,64000.,72000.,78000., + 86000.,92000.,110000.,120000.,140000.,190000., +}; + +static double _psy_lowpass_32[12]={ + 12.3,13.,13.,14.,15.,99.,99.,99.,99.,99.,99.,99. +}; + +ve_setup_data_template ve_setup_32_stereo={ + 11, + rate_mapping_32, + quality_mapping_44, + 2, + 26000, + 40000, + + blocksize_short_44, + blocksize_long_44, + + _psy_tone_masteratt_44, + _psy_tone_0dB, + _psy_tone_suppress, + + _vp_tonemask_adj_otherblock, + _vp_tonemask_adj_longblock, + _vp_tonemask_adj_otherblock, + + _psy_noiseguards_44, + _psy_noisebias_impulse, + _psy_noisebias_padding, + _psy_noisebias_trans, + _psy_noisebias_long, + _psy_noise_suppress, + + _psy_compand_44, + _psy_compand_short_mapping, + _psy_compand_long_mapping, + + {_noise_start_short_44,_noise_start_long_44}, + {_noise_part_short_44,_noise_part_long_44}, + _noise_thresh_44, + + _psy_ath_floater, + _psy_ath_abs, + + _psy_lowpass_32, + + _psy_global_44, + _global_mapping_44, + _psy_stereo_modes_44, + + _floor_books, + _floor, + _floor_short_mapping_44, + _floor_long_mapping_44, + + _mapres_template_44_stereo +}; + +ve_setup_data_template ve_setup_32_uncoupled={ + 11, + rate_mapping_32_un, + quality_mapping_44, + -1, + 26000, + 40000, + + blocksize_short_44, + blocksize_long_44, + + _psy_tone_masteratt_44, + _psy_tone_0dB, + _psy_tone_suppress, + + _vp_tonemask_adj_otherblock, + _vp_tonemask_adj_longblock, + _vp_tonemask_adj_otherblock, + + _psy_noiseguards_44, + _psy_noisebias_impulse, + _psy_noisebias_padding, + _psy_noisebias_trans, + _psy_noisebias_long, + _psy_noise_suppress, + + _psy_compand_44, + _psy_compand_short_mapping, + _psy_compand_long_mapping, + + {_noise_start_short_44,_noise_start_long_44}, + {_noise_part_short_44,_noise_part_long_44}, + _noise_thresh_44, + + _psy_ath_floater, + _psy_ath_abs, + + _psy_lowpass_32, + + _psy_global_44, + _global_mapping_44, + NULL, + + _floor_books, + _floor, + _floor_short_mapping_44, + _floor_long_mapping_44, + + _mapres_template_44_uncoupled +}; diff --git a/Libraries/Vorbis/Files/lib/modes/setup_44.h b/Libraries/Vorbis/Files/lib/modes/setup_44.h new file mode 100644 index 000000000..af2c93085 --- /dev/null +++ b/Libraries/Vorbis/Files/lib/modes/setup_44.h @@ -0,0 +1,107 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * + * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * + * by the XIPHOPHORUS Company http://www.xiph.org/ * + * * + ******************************************************************** + + function: toplevel settings for 44.1/48kHz + last mod: $Id$ + + ********************************************************************/ + +#include "modes/floor_all.h" +#include "modes/residue_44.h" +#include "modes/psych_44.h" + +static double rate_mapping_44_stereo[12]={ + 22500.,32000.,40000.,48000.,56000.,64000., + 80000.,96000.,112000.,128000.,160000.,250001. +}; + +static double quality_mapping_44[12]={ + -.1,.0,.1,.2,.3,.4,.5,.6,.7,.8,.9,1.0 +}; + +static int blocksize_short_44[11]={ + 512,256,256,256,256,256,256,256,256,256,256 +}; +static int blocksize_long_44[11]={ + 4096,2048,2048,2048,2048,2048,2048,2048,2048,2048,2048 +}; + +static double _psy_compand_short_mapping[12]={ + 0.5, 1., 1., 1.3, 1.6, 2., 2., 2., 2., 2., 2., 2. +}; +static double _psy_compand_long_mapping[12]={ + 3.5, 4., 4., 4.3, 4.6, 5., 5., 5., 5., 5., 5., 5. +}; + +static double _global_mapping_44[12]={ + /* 1., 1., 1.5, 2., 2., 2.5, 2.7, 3.0, 3.5, 4., 4. */ + 0., 1., 1., 1.5, 2., 2., 2.5, 2.7, 3.0, 3.7, 4., 4. +}; + +static int _floor_short_mapping_44[11]={ + 1,0,0,2,2,4,5,5,5,5,5 +}; +static int _floor_long_mapping_44[11]={ + 8,7,7,7,7,7,7,7,7,7,7 +}; + +ve_setup_data_template ve_setup_44_stereo={ + 11, + rate_mapping_44_stereo, + quality_mapping_44, + 2, + 40000, + 50000, + + blocksize_short_44, + blocksize_long_44, + + _psy_tone_masteratt_44, + _psy_tone_0dB, + _psy_tone_suppress, + + _vp_tonemask_adj_otherblock, + _vp_tonemask_adj_longblock, + _vp_tonemask_adj_otherblock, + + _psy_noiseguards_44, + _psy_noisebias_impulse, + _psy_noisebias_padding, + _psy_noisebias_trans, + _psy_noisebias_long, + _psy_noise_suppress, + + _psy_compand_44, + _psy_compand_short_mapping, + _psy_compand_long_mapping, + + {_noise_start_short_44,_noise_start_long_44}, + {_noise_part_short_44,_noise_part_long_44}, + _noise_thresh_44, + + _psy_ath_floater, + _psy_ath_abs, + + _psy_lowpass_44, + + _psy_global_44, + _global_mapping_44, + _psy_stereo_modes_44, + + _floor_books, + _floor, + _floor_short_mapping_44, + _floor_long_mapping_44, + + _mapres_template_44_stereo +}; + diff --git a/Libraries/Vorbis/Files/lib/modes/setup_44u.h b/Libraries/Vorbis/Files/lib/modes/setup_44u.h new file mode 100644 index 000000000..b7bab698a --- /dev/null +++ b/Libraries/Vorbis/Files/lib/modes/setup_44u.h @@ -0,0 +1,74 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * + * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * + * by the XIPHOPHORUS Company http://www.xiph.org/ * + * * + ******************************************************************** + + function: toplevel settings for 44.1/48kHz uncoupled modes + last mod: $Id$ + + ********************************************************************/ + +#include "modes/residue_44u.h" + +static double rate_mapping_44_un[12]={ + 32000.,48000.,60000.,70000.,80000.,86000., + 96000.,110000.,120000.,140000.,160000.,240001. +}; + +ve_setup_data_template ve_setup_44_uncoupled={ + 11, + rate_mapping_44_un, + quality_mapping_44, + -1, + 40000, + 50000, + + blocksize_short_44, + blocksize_long_44, + + _psy_tone_masteratt_44, + _psy_tone_0dB, + _psy_tone_suppress, + + _vp_tonemask_adj_otherblock, + _vp_tonemask_adj_longblock, + _vp_tonemask_adj_otherblock, + + _psy_noiseguards_44, + _psy_noisebias_impulse, + _psy_noisebias_padding, + _psy_noisebias_trans, + _psy_noisebias_long, + _psy_noise_suppress, + + _psy_compand_44, + _psy_compand_short_mapping, + _psy_compand_long_mapping, + + {_noise_start_short_44,_noise_start_long_44}, + {_noise_part_short_44,_noise_part_long_44}, + _noise_thresh_44, + + _psy_ath_floater, + _psy_ath_abs, + + _psy_lowpass_44, + + _psy_global_44, + _global_mapping_44, + NULL, + + _floor_books, + _floor, + _floor_short_mapping_44, + _floor_long_mapping_44, + + _mapres_template_44_uncoupled +}; diff --git a/Libraries/Vorbis/Files/lib/modes/setup_8.h b/Libraries/Vorbis/Files/lib/modes/setup_8.h new file mode 100644 index 000000000..c668c14c9 --- /dev/null +++ b/Libraries/Vorbis/Files/lib/modes/setup_8.h @@ -0,0 +1,146 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * + * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * + * by the XIPHOPHORUS Company http://www.xiph.org/ * + * * + ******************************************************************** + + function: 8kHz settings + last mod: $Id$ + + ********************************************************************/ + +#include "psych_8.h" +#include "residue_8.h" + +static int blocksize_8[2]={ + 512,512 +}; + +static int _floor_mapping_8[2]={ + 6,6, +}; + +static double rate_mapping_8[3]={ + 6000.,9000.,32000., +}; + +static double rate_mapping_8_uncoupled[3]={ + 8000.,14000.,42000., +}; + +static double quality_mapping_8[3]={ + -.1,.0,1. +}; + +static double _psy_compand_8_mapping[3]={ 0., 1., 1.}; + +static double _global_mapping_8[3]={ 1., 2., 3. }; + +ve_setup_data_template ve_setup_8_stereo={ + 2, + rate_mapping_8, + quality_mapping_8, + 2, + 8000, + 9000, + + blocksize_8, + blocksize_8, + + _psy_tone_masteratt_8, + _psy_tone_0dB, + _psy_tone_suppress, + + _vp_tonemask_adj_8, + NULL, + _vp_tonemask_adj_8, + + _psy_noiseguards_8, + _psy_noisebias_8, + _psy_noisebias_8, + NULL, + NULL, + _psy_noise_suppress, + + _psy_compand_8, + _psy_compand_8_mapping, + NULL, + + {_noise_start_8,_noise_start_8}, + {_noise_part_8,_noise_part_8}, + _noise_thresh_5only, + + _psy_ath_floater_8, + _psy_ath_abs_8, + + _psy_lowpass_8, + + _psy_global_44, + _global_mapping_8, + _psy_stereo_modes_8, + + _floor_books, + _floor, + _floor_mapping_8, + NULL, + + _mapres_template_8_stereo +}; + +ve_setup_data_template ve_setup_8_uncoupled={ + 2, + rate_mapping_8_uncoupled, + quality_mapping_8, + -1, + 8000, + 9000, + + blocksize_8, + blocksize_8, + + _psy_tone_masteratt_8, + _psy_tone_0dB, + _psy_tone_suppress, + + _vp_tonemask_adj_8, + NULL, + _vp_tonemask_adj_8, + + _psy_noiseguards_8, + _psy_noisebias_8, + _psy_noisebias_8, + NULL, + NULL, + _psy_noise_suppress, + + _psy_compand_8, + _psy_compand_8_mapping, + NULL, + + {_noise_start_8,_noise_start_8}, + {_noise_part_8,_noise_part_8}, + _noise_thresh_5only, + + _psy_ath_floater_8, + _psy_ath_abs_8, + + _psy_lowpass_8, + + _psy_global_44, + _global_mapping_8, + _psy_stereo_modes_8, + + _floor_books, + _floor, + _floor_mapping_8, + NULL, + + _mapres_template_8_uncoupled +}; + diff --git a/Libraries/Vorbis/Files/lib/modes/setup_X.h b/Libraries/Vorbis/Files/lib/modes/setup_X.h new file mode 100644 index 000000000..6f8484dd2 --- /dev/null +++ b/Libraries/Vorbis/Files/lib/modes/setup_X.h @@ -0,0 +1,226 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * + * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * + * by the XIPHOPHORUS Company http://www.xiph.org/ * + * * + ******************************************************************** + + function: catch-all toplevel settings for q modes only + last mod: $Id$ + + ********************************************************************/ + +static double rate_mapping_X[12]={ + -1.,-1.,-1.,-1.,-1.,-1., + -1.,-1.,-1.,-1.,-1.,-1. +}; + +ve_setup_data_template ve_setup_X_stereo={ + 11, + rate_mapping_X, + quality_mapping_44, + 2, + 50000, + 200000, + + blocksize_short_44, + blocksize_long_44, + + _psy_tone_masteratt_44, + _psy_tone_0dB, + _psy_tone_suppress, + + _vp_tonemask_adj_otherblock, + _vp_tonemask_adj_longblock, + _vp_tonemask_adj_otherblock, + + _psy_noiseguards_44, + _psy_noisebias_impulse, + _psy_noisebias_padding, + _psy_noisebias_trans, + _psy_noisebias_long, + _psy_noise_suppress, + + _psy_compand_44, + _psy_compand_short_mapping, + _psy_compand_long_mapping, + + {_noise_start_short_44,_noise_start_long_44}, + {_noise_part_short_44,_noise_part_long_44}, + _noise_thresh_44, + + _psy_ath_floater, + _psy_ath_abs, + + _psy_lowpass_44, + + _psy_global_44, + _global_mapping_44, + _psy_stereo_modes_44, + + _floor_books, + _floor, + _floor_short_mapping_44, + _floor_long_mapping_44, + + _mapres_template_44_stereo +}; + +ve_setup_data_template ve_setup_X_uncoupled={ + 11, + rate_mapping_X, + quality_mapping_44, + -1, + 50000, + 200000, + + blocksize_short_44, + blocksize_long_44, + + _psy_tone_masteratt_44, + _psy_tone_0dB, + _psy_tone_suppress, + + _vp_tonemask_adj_otherblock, + _vp_tonemask_adj_longblock, + _vp_tonemask_adj_otherblock, + + _psy_noiseguards_44, + _psy_noisebias_impulse, + _psy_noisebias_padding, + _psy_noisebias_trans, + _psy_noisebias_long, + _psy_noise_suppress, + + _psy_compand_44, + _psy_compand_short_mapping, + _psy_compand_long_mapping, + + {_noise_start_short_44,_noise_start_long_44}, + {_noise_part_short_44,_noise_part_long_44}, + _noise_thresh_44, + + _psy_ath_floater, + _psy_ath_abs, + + _psy_lowpass_44, + + _psy_global_44, + _global_mapping_44, + NULL, + + _floor_books, + _floor, + _floor_short_mapping_44, + _floor_long_mapping_44, + + _mapres_template_44_uncoupled +}; + +ve_setup_data_template ve_setup_XX_stereo={ + 2, + rate_mapping_X, + quality_mapping_8, + 2, + 0, + 8000, + + blocksize_8, + blocksize_8, + + _psy_tone_masteratt_8, + _psy_tone_0dB, + _psy_tone_suppress, + + _vp_tonemask_adj_8, + NULL, + _vp_tonemask_adj_8, + + _psy_noiseguards_8, + _psy_noisebias_8, + _psy_noisebias_8, + NULL, + NULL, + _psy_noise_suppress, + + _psy_compand_8, + _psy_compand_8_mapping, + NULL, + + {_noise_start_8,_noise_start_8}, + {_noise_part_8,_noise_part_8}, + _noise_thresh_5only, + + _psy_ath_floater_8, + _psy_ath_abs_8, + + _psy_lowpass_8, + + _psy_global_44, + _global_mapping_8, + _psy_stereo_modes_8, + + _floor_books, + _floor, + _floor_mapping_8, + NULL, + + _mapres_template_8_stereo +}; + +ve_setup_data_template ve_setup_XX_uncoupled={ + 2, + rate_mapping_X, + quality_mapping_8, + -1, + 0, + 8000, + + blocksize_8, + blocksize_8, + + _psy_tone_masteratt_8, + _psy_tone_0dB, + _psy_tone_suppress, + + _vp_tonemask_adj_8, + NULL, + _vp_tonemask_adj_8, + + _psy_noiseguards_8, + _psy_noisebias_8, + _psy_noisebias_8, + NULL, + NULL, + _psy_noise_suppress, + + _psy_compand_8, + _psy_compand_8_mapping, + NULL, + + {_noise_start_8,_noise_start_8}, + {_noise_part_8,_noise_part_8}, + _noise_thresh_5only, + + _psy_ath_floater_8, + _psy_ath_abs_8, + + _psy_lowpass_8, + + _psy_global_44, + _global_mapping_8, + _psy_stereo_modes_8, + + _floor_books, + _floor, + _floor_mapping_8, + NULL, + + _mapres_template_8_uncoupled +}; + diff --git a/Libraries/Vorbis/Files/lib/os.h b/Libraries/Vorbis/Files/lib/os.h new file mode 100644 index 000000000..1f3977f4b --- /dev/null +++ b/Libraries/Vorbis/Files/lib/os.h @@ -0,0 +1,156 @@ +#ifndef _OS_H +#define _OS_H +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * + * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * + * by the XIPHOPHORUS Company http://www.xiph.org/ * + * * + ******************************************************************** + + function: #ifdef jail to whip a few platforms into the UNIX ideal. + last mod: $Id$ + + ********************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include + +#include "misc.h" + +#ifndef _V_IFDEFJAIL_H_ +# define _V_IFDEFJAIL_H_ + +# ifdef __GNUC__ +# define STIN static __inline__ +# elif _WIN32 +# define STIN static __inline +# else +# define STIN static +# endif + +#ifdef DJGPP +# define rint(x) (floor((x)+0.5f)) +#endif + +#ifndef M_PI +# define M_PI (3.1415926536f) +#endif + +#if defined(_WIN32) && !defined(__SYMBIAN32__) +# include +# define rint(x) (floor((x)+0.5f)) +# define NO_FLOAT_MATH_LIB +# define FAST_HYPOT(a, b) sqrt((a)*(a) + (b)*(b)) +#endif + +#if defined(__SYMBIAN32__) && defined(__WINS__) +void *_alloca(size_t size); +# define alloca _alloca +#endif + +#ifndef FAST_HYPOT +# define FAST_HYPOT hypot +#endif + +#endif + +#ifdef HAVE_ALLOCA_H +# include +#endif + +#ifdef USE_MEMORY_H +# include +#endif + +#ifndef min +# define min(x,y) ((x)>(y)?(y):(x)) +#endif + +#ifndef max +# define max(x,y) ((x)<(y)?(y):(x)) +#endif + +#if defined(__i386__) && defined(__GNUC__) && !defined(__BEOS__) +# define VORBIS_FPU_CONTROL +/* both GCC and MSVC are kinda stupid about rounding/casting to int. + Because of encapsulation constraints (GCC can't see inside the asm + block and so we end up doing stupid things like a store/load that + is collectively a noop), we do it this way */ + +/* we must set up the fpu before this works!! */ + +typedef ogg_int16_t vorbis_fpu_control; + +static inline void vorbis_fpu_setround(vorbis_fpu_control *fpu){ + ogg_int16_t ret; + ogg_int16_t temp; + __asm__ __volatile__("fnstcw %0\n\t" + "movw %0,%%dx\n\t" + "orw $62463,%%dx\n\t" + "movw %%dx,%1\n\t" + "fldcw %1\n\t":"=m"(ret):"m"(temp): "dx"); + *fpu=ret; +} + +static inline void vorbis_fpu_restore(vorbis_fpu_control fpu){ + __asm__ __volatile__("fldcw %0":: "m"(fpu)); +} + +/* assumes the FPU is in round mode! */ +static inline int vorbis_ftoi(double f){ /* yes, double! Otherwise, + we get extra fst/fld to + truncate precision */ + int i; + __asm__("fistl %0": "=m"(i) : "t"(f)); + return(i); +} +#endif + + +#if defined(_WIN32) && !defined(__GNUC__) && !defined(__BORLANDC__) +# define VORBIS_FPU_CONTROL + +typedef ogg_int16_t vorbis_fpu_control; + +static __inline int vorbis_ftoi(double f){ + int i; + __asm{ + fld f + fistp i + } + return i; +} + +static __inline void vorbis_fpu_setround(vorbis_fpu_control *fpu){ +} + +static __inline void vorbis_fpu_restore(vorbis_fpu_control fpu){ +} + +#endif + + +#ifndef VORBIS_FPU_CONTROL + +typedef int vorbis_fpu_control; + +static int vorbis_ftoi(double f){ + return (int)(f+.5); +} + +/* We don't have special code for this compiler/arch, so do it the slow way */ +# define vorbis_fpu_setround(vorbis_fpu_control) {} +# define vorbis_fpu_restore(vorbis_fpu_control) {} + +#endif + +#endif /* _OS_H */ diff --git a/Libraries/Vorbis/Files/lib/psy.c b/Libraries/Vorbis/Files/lib/psy.c new file mode 100644 index 000000000..ceb8d16c5 --- /dev/null +++ b/Libraries/Vorbis/Files/lib/psy.c @@ -0,0 +1,1224 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * + * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * + * by the XIPHOPHORUS Company http://www.xiph.org/ * + * * + ******************************************************************** + + function: psychoacoustics not including preecho + last mod: $Id$ + + ********************************************************************/ + +#include +#include +#include +#include "vorbis/codec.h" +#include "codec_internal.h" + +#include "masking.h" +#include "psy.h" +#include "os.h" +#include "lpc.h" +#include "smallft.h" +#include "scales.h" +#include "misc.h" + +#define NEGINF -9999.f +static double stereo_threshholds[]={0.0, .5, 1.0, 1.5, 2.5, 4.5, 8.5, 16.5, 9e10}; +static double stereo_threshholds_limited[]={0.0, .5, 1.0, 1.5, 2.0, 2.5, 4.5, 8.5, 9e10}; + +vorbis_look_psy_global *_vp_global_look(vorbis_info *vi){ + codec_setup_info *ci=vi->codec_setup; + vorbis_info_psy_global *gi=&ci->psy_g_param; + vorbis_look_psy_global *look=_ogg_calloc(1,sizeof(*look)); + + look->channels=vi->channels; + + look->ampmax=-9999.; + look->gi=gi; + return(look); +} + +void _vp_global_free(vorbis_look_psy_global *look){ + if(look){ + memset(look,0,sizeof(*look)); + _ogg_free(look); + } +} + +void _vi_gpsy_free(vorbis_info_psy_global *i){ + if(i){ + memset(i,0,sizeof(*i)); + _ogg_free(i); + } +} + +void _vi_psy_free(vorbis_info_psy *i){ + if(i){ + memset(i,0,sizeof(*i)); + _ogg_free(i); + } +} + +static void min_curve(float *c, + float *c2){ + int i; + for(i=0;ic[i])c[i]=c2[i]; +} + +static void attenuate_curve(float *c,float att){ + int i; + for(i=0;iATH[j+k+ath_offset])min=ATH[j+k+ath_offset]; + }else{ + if(min>ATH[MAX_ATH-1])min=ATH[MAX_ATH-1]; + } + ath[j]=min; + } + + /* copy curves into working space, replicate the 50dB curve to 30 + and 40, replicate the 100dB curve to 110 */ + for(j=0;j<6;j++) + memcpy(workc[i][j+2],tonemasks[i][j],EHMER_MAX*sizeof(*tonemasks[i][j])); + memcpy(workc[i][0],tonemasks[i][0],EHMER_MAX*sizeof(*tonemasks[i][0])); + memcpy(workc[i][1],tonemasks[i][0],EHMER_MAX*sizeof(*tonemasks[i][0])); + + /* apply centered curve boost/decay */ + for(j=0;j0)adj=0.; + if(adj>0. && center_boost<0)adj=0.; + workc[i][j][k]+=adj; + } + } + + /* normalize curves so the driving amplitude is 0dB */ + /* make temp curves with the ATH overlayed */ + for(j=0;j an eighth of an octave and that the eighth + octave values may also be composited. */ + + /* which octave curves will we be compositing? */ + bin=floor(fromOC(i*.5)/binHz); + lo_curve= ceil(toOC(bin*binHz+1)*2); + hi_curve= floor(toOC((bin+1)*binHz)*2); + if(lo_curve>i)lo_curve=i; + if(lo_curve<0)lo_curve=0; + if(hi_curve>=P_BANDS)hi_curve=P_BANDS-1; + + for(m=0;mn)lo_bin=n; + if(lo_binn)hi_bin=n; + + for(;lworkc[k][m][j]) + brute_buffer[l]=workc[k][m][j]; + } + + for(;lworkc[k][m][EHMER_MAX-1]) + brute_buffer[l]=workc[k][m][EHMER_MAX-1]; + + } + + /* be equally paranoid about being valid up to next half ocatve */ + if(i+1n)lo_bin=n; + if(lo_binn)hi_bin=n; + + for(;lworkc[k][m][j]) + brute_buffer[l]=workc[k][m][j]; + } + + for(;lworkc[k][m][EHMER_MAX-1]) + brute_buffer[l]=workc[k][m][EHMER_MAX-1]; + + } + + + for(j=0;j=n){ + ret[i][m][j+2]=-999.; + }else{ + ret[i][m][j+2]=brute_buffer[bin]; + } + } + } + + /* add fenceposts */ + for(j=0;j-200.f)break; + ret[i][m][0]=j; + + for(j=EHMER_MAX-1;j>EHMER_OFFSET+1;j--) + if(ret[i][m][j+2]>-200.f) + break; + ret[i][m][1]=j; + + } + } + + return(ret); +} + +void _vp_psy_init(vorbis_look_psy *p,vorbis_info_psy *vi, + vorbis_info_psy_global *gi,int n,long rate){ + long i,j,lo=-99,hi=1; + long maxoc; + memset(p,0,sizeof(*p)); + + p->eighth_octave_lines=gi->eighth_octave_lines; + p->shiftoc=rint(log(gi->eighth_octave_lines*8.f)/log(2.f))-1; + + p->firstoc=toOC(.25f*rate*.5/n)*(1<<(p->shiftoc+1))-gi->eighth_octave_lines; + maxoc=toOC((n+.25f)*rate*.5/n)*(1<<(p->shiftoc+1))+.5f; + p->total_octave_lines=maxoc-p->firstoc+1; + p->ath=_ogg_malloc(n*sizeof(*p->ath)); + + p->octave=_ogg_malloc(n*sizeof(*p->octave)); + p->bark=_ogg_malloc(n*sizeof(*p->bark)); + p->vi=vi; + p->n=n; + p->rate=rate; + + /* AoTuV HF weighting */ + p->m_val = 1.; + if(rate < 26000) p->m_val = 0; + else if(rate < 38000) p->m_val = .94; /* 32kHz */ + else if(rate > 46000) p->m_val = 1.275; /* 48kHz */ + + /* set up the lookups for a given blocksize and sample rate */ + + for(i=0,j=0;iath[j]=base+100.; + base+=delta; + } + } + } + + for(i=0;inoisewindowlominnoisewindowlo);lo++); + + for(;hi<=n && (hinoisewindowhimin || + toBARK(rate/(2*n)*hi)<(bark+vi->noisewindowhi));hi++); + + p->bark[i]=((lo-1)<<16)+(hi-1); + + } + + for(i=0;ioctave[i]=toOC((i+.25f)*.5*rate/n)*(1<<(p->shiftoc+1))+.5f; + + p->tonecurves=setup_tone_curves(vi->toneatt,rate*.5/n,n, + vi->tone_centerboost,vi->tone_decay); + + /* set up rolling noise median */ + p->noiseoffset=_ogg_malloc(P_NOISECURVES*sizeof(*p->noiseoffset)); + for(i=0;inoiseoffset[i]=_ogg_malloc(n*sizeof(**p->noiseoffset)); + + for(i=0;i=P_BANDS-1)halfoc=P_BANDS-1; + inthalfoc=(int)halfoc; + del=halfoc-inthalfoc; + + for(j=0;jnoiseoffset[j][i]= + p->vi->noiseoff[j][inthalfoc]*(1.-del) + + p->vi->noiseoff[j][inthalfoc+1]*del; + + } +#if 0 + { + static int ls=0; + _analysis_output_always("noiseoff0",ls,p->noiseoffset[0],n,1,0,0); + _analysis_output_always("noiseoff1",ls,p->noiseoffset[1],n,1,0,0); + _analysis_output_always("noiseoff2",ls++,p->noiseoffset[2],n,1,0,0); + } +#endif +} + +void _vp_psy_clear(vorbis_look_psy *p){ + int i,j; + if(p){ + if(p->ath)_ogg_free(p->ath); + if(p->octave)_ogg_free(p->octave); + if(p->bark)_ogg_free(p->bark); + if(p->tonecurves){ + for(i=0;itonecurves[i][j]); + } + _ogg_free(p->tonecurves[i]); + } + _ogg_free(p->tonecurves); + } + if(p->noiseoffset){ + for(i=0;inoiseoffset[i]); + } + _ogg_free(p->noiseoffset); + } + memset(p,0,sizeof(*p)); + } +} + +/* octave/(8*eighth_octave_lines) x scale and dB y scale */ +static void seed_curve(float *seed, + const float **curves, + float amp, + int oc, int n, + int linesper,float dBoffset){ + int i,post1; + int seedptr; + const float *posts,*curve; + + int choice=(int)((amp+dBoffset-P_LEVEL_0)*.1f); + choice=max(choice,0); + choice=min(choice,P_LEVELS-1); + posts=curves[choice]; + curve=posts+2; + post1=(int)posts[1]; + seedptr=oc+(posts[0]-EHMER_OFFSET)*linesper-(linesper>>1); + + for(i=posts[0];i0){ + float lin=amp+curve[i]; + if(seed[seedptr]=n)break; + } +} + +static void seed_loop(vorbis_look_psy *p, + const float ***curves, + const float *f, + const float *flr, + float *seed, + float specmax){ + vorbis_info_psy *vi=p->vi; + long n=p->n,i; + float dBoffset=vi->max_curve_dB-specmax; + + /* prime the working vector with peak values */ + + for(i=0;ioctave[i]; + while(i+1octave[i+1]==oc){ + i++; + if(f[i]>max)max=f[i]; + } + + if(max+6.f>flr[i]){ + oc=oc>>p->shiftoc; + + if(oc>=P_BANDS)oc=P_BANDS-1; + if(oc<0)oc=0; + + seed_curve(seed, + curves[oc], + max, + p->octave[i]-p->firstoc, + p->total_octave_lines, + p->eighth_octave_lines, + dBoffset); + } + } +} + +static void seed_chase(float *seeds, int linesper, long n){ + long *posstack=alloca(n*sizeof(*posstack)); + float *ampstack=alloca(n*sizeof(*ampstack)); + long stack=0; + long pos=0; + long i; + + for(i=0;i1 && ampstack[stack-1]<=ampstack[stack-2] && + iampstack[i]){ + endpos=posstack[i+1]; + }else{ + endpos=posstack[i]+linesper+1; /* +1 is important, else bin 0 is + discarded in short frames */ + } + if(endpos>n)endpos=n; + for(;pos +static void max_seeds(vorbis_look_psy *p, + float *seed, + float *flr){ + long n=p->total_octave_lines; + int linesper=p->eighth_octave_lines; + long linpos=0; + long pos; + + seed_chase(seed,linesper,n); /* for masking */ + + pos=p->octave[0]-p->firstoc-(linesper>>1); + + while(linpos+1n){ + float minV=seed[pos]; + long end=((p->octave[linpos]+p->octave[linpos+1])>>1)-p->firstoc; + if(minV>p->vi->tone_abs_limit)minV=p->vi->tone_abs_limit; + while(pos+1<=end){ + pos++; + if((seed[pos]>NEGINF && seed[pos]firstoc; + for(;linposn && p->octave[linpos]<=end;linpos++) + if(flr[linpos]total_octave_lines-1]; + for(;linposn;linpos++) + if(flr[linpos]> 16; + if( lo>=0 ) break; + hi = b[i] & 0xffff; + + tN = N[hi] + N[-lo]; + tX = X[hi] - X[-lo]; + tXX = XX[hi] + XX[-lo]; + tY = Y[hi] + Y[-lo]; + tXY = XY[hi] - XY[-lo]; + + A = tY * tXX - tX * tXY; + B = tN * tXY - tX * tY; + D = tN * tXX - tX * tX; + R = (A + x * B) / D; + if (R < 0.f) + R = 0.f; + + noise[i] = R - offset; + } + + for ( ;; i++, x += 1.f) { + + lo = b[i] >> 16; + hi = b[i] & 0xffff; + if(hi>=n)break; + + tN = N[hi] - N[lo]; + tX = X[hi] - X[lo]; + tXX = XX[hi] - XX[lo]; + tY = Y[hi] - Y[lo]; + tXY = XY[hi] - XY[lo]; + + A = tY * tXX - tX * tXY; + B = tN * tXY - tX * tY; + D = tN * tXX - tX * tX; + R = (A + x * B) / D; + if (R < 0.f) R = 0.f; + + noise[i] = R - offset; + } + for ( ; i < n; i++, x += 1.f) { + + R = (A + x * B) / D; + if (R < 0.f) R = 0.f; + + noise[i] = R - offset; + } + + if (fixed <= 0) return; + + for (i = 0, x = 0.f;; i++, x += 1.f) { + hi = i + fixed / 2; + lo = hi - fixed; + if(lo>=0)break; + + tN = N[hi] + N[-lo]; + tX = X[hi] - X[-lo]; + tXX = XX[hi] + XX[-lo]; + tY = Y[hi] + Y[-lo]; + tXY = XY[hi] - XY[-lo]; + + + A = tY * tXX - tX * tXY; + B = tN * tXY - tX * tY; + D = tN * tXX - tX * tX; + R = (A + x * B) / D; + + if (R - offset < noise[i]) noise[i] = R - offset; + } + for ( ;; i++, x += 1.f) { + + hi = i + fixed / 2; + lo = hi - fixed; + if(hi>=n)break; + + tN = N[hi] - N[lo]; + tX = X[hi] - X[lo]; + tXX = XX[hi] - XX[lo]; + tY = Y[hi] - Y[lo]; + tXY = XY[hi] - XY[lo]; + + A = tY * tXX - tX * tXY; + B = tN * tXY - tX * tY; + D = tN * tXX - tX * tX; + R = (A + x * B) / D; + + if (R - offset < noise[i]) noise[i] = R - offset; + } + for ( ; i < n; i++, x += 1.f) { + R = (A + x * B) / D; + if (R - offset < noise[i]) noise[i] = R - offset; + } +} + +static float FLOOR1_fromdB_INV_LOOKUP[256]={ + 0.F, 8.81683e+06F, 8.27882e+06F, 7.77365e+06F, + 7.29930e+06F, 6.85389e+06F, 6.43567e+06F, 6.04296e+06F, + 5.67422e+06F, 5.32798e+06F, 5.00286e+06F, 4.69759e+06F, + 4.41094e+06F, 4.14178e+06F, 3.88905e+06F, 3.65174e+06F, + 3.42891e+06F, 3.21968e+06F, 3.02321e+06F, 2.83873e+06F, + 2.66551e+06F, 2.50286e+06F, 2.35014e+06F, 2.20673e+06F, + 2.07208e+06F, 1.94564e+06F, 1.82692e+06F, 1.71544e+06F, + 1.61076e+06F, 1.51247e+06F, 1.42018e+06F, 1.33352e+06F, + 1.25215e+06F, 1.17574e+06F, 1.10400e+06F, 1.03663e+06F, + 973377.F, 913981.F, 858210.F, 805842.F, + 756669.F, 710497.F, 667142.F, 626433.F, + 588208.F, 552316.F, 518613.F, 486967.F, + 457252.F, 429351.F, 403152.F, 378551.F, + 355452.F, 333762.F, 313396.F, 294273.F, + 276316.F, 259455.F, 243623.F, 228757.F, + 214798.F, 201691.F, 189384.F, 177828.F, + 166977.F, 156788.F, 147221.F, 138237.F, + 129802.F, 121881.F, 114444.F, 107461.F, + 100903.F, 94746.3F, 88964.9F, 83536.2F, + 78438.8F, 73652.5F, 69158.2F, 64938.1F, + 60975.6F, 57254.9F, 53761.2F, 50480.6F, + 47400.3F, 44507.9F, 41792.0F, 39241.9F, + 36847.3F, 34598.9F, 32487.7F, 30505.3F, + 28643.8F, 26896.0F, 25254.8F, 23713.7F, + 22266.7F, 20908.0F, 19632.2F, 18434.2F, + 17309.4F, 16253.1F, 15261.4F, 14330.1F, + 13455.7F, 12634.6F, 11863.7F, 11139.7F, + 10460.0F, 9821.72F, 9222.39F, 8659.64F, + 8131.23F, 7635.06F, 7169.17F, 6731.70F, + 6320.93F, 5935.23F, 5573.06F, 5232.99F, + 4913.67F, 4613.84F, 4332.30F, 4067.94F, + 3819.72F, 3586.64F, 3367.78F, 3162.28F, + 2969.31F, 2788.13F, 2617.99F, 2458.24F, + 2308.24F, 2167.39F, 2035.14F, 1910.95F, + 1794.35F, 1684.85F, 1582.04F, 1485.51F, + 1394.86F, 1309.75F, 1229.83F, 1154.78F, + 1084.32F, 1018.15F, 956.024F, 897.687F, + 842.910F, 791.475F, 743.179F, 697.830F, + 655.249F, 615.265F, 577.722F, 542.469F, + 509.367F, 478.286F, 449.101F, 421.696F, + 395.964F, 371.803F, 349.115F, 327.812F, + 307.809F, 289.026F, 271.390F, 254.830F, + 239.280F, 224.679F, 210.969F, 198.096F, + 186.008F, 174.658F, 164.000F, 153.993F, + 144.596F, 135.773F, 127.488F, 119.708F, + 112.404F, 105.545F, 99.1046F, 93.0572F, + 87.3788F, 82.0469F, 77.0404F, 72.3394F, + 67.9252F, 63.7804F, 59.8885F, 56.2341F, + 52.8027F, 49.5807F, 46.5553F, 43.7144F, + 41.0470F, 38.5423F, 36.1904F, 33.9821F, + 31.9085F, 29.9614F, 28.1332F, 26.4165F, + 24.8045F, 23.2910F, 21.8697F, 20.5352F, + 19.2822F, 18.1056F, 17.0008F, 15.9634F, + 14.9893F, 14.0746F, 13.2158F, 12.4094F, + 11.6522F, 10.9411F, 10.2735F, 9.64662F, + 9.05798F, 8.50526F, 7.98626F, 7.49894F, + 7.04135F, 6.61169F, 6.20824F, 5.82941F, + 5.47370F, 5.13970F, 4.82607F, 4.53158F, + 4.25507F, 3.99542F, 3.75162F, 3.52269F, + 3.30774F, 3.10590F, 2.91638F, 2.73842F, + 2.57132F, 2.41442F, 2.26709F, 2.12875F, + 1.99885F, 1.87688F, 1.76236F, 1.65482F, + 1.55384F, 1.45902F, 1.36999F, 1.28640F, + 1.20790F, 1.13419F, 1.06499F, 1.F +}; + +void _vp_remove_floor(vorbis_look_psy *p, + float *mdct, + int *codedflr, + float *residue, + int sliding_lowpass){ + + int i,n=p->n; + + if(sliding_lowpass>n)sliding_lowpass=n; + + for(i=0;in; + float *work=alloca(n*sizeof(*work)); + + bark_noise_hybridmp(n,p->bark,logmdct,logmask, + 140.,-1); + + for(i=0;ibark,work,logmask,0., + p->vi->noisewindowfixed); + + for(i=0;i=NOISE_COMPAND_LEVELS)dB=NOISE_COMPAND_LEVELS-1; + if(dB<0)dB=0; + logmask[i]= work[i]+p->vi->noisecompand[dB]; + } + +} + +void _vp_tonemask(vorbis_look_psy *p, + float *logfft, + float *logmask, + float global_specmax, + float local_specmax){ + + int i,n=p->n; + + float *seed=alloca(sizeof(*seed)*p->total_octave_lines); + float att=local_specmax+p->vi->ath_adjatt; + for(i=0;itotal_octave_lines;i++)seed[i]=NEGINF; + + /* set the ATH (floating below localmax, not global max by a + specified att) */ + if(attvi->ath_maxatt)att=p->vi->ath_maxatt; + + for(i=0;iath[i]+att; + + /* tone masking */ + seed_loop(p,(const float ***)p->tonecurves,logfft,logmask,seed,global_specmax); + max_seeds(p,seed,logmask); + +} + +void _vp_offset_and_mix(vorbis_look_psy *p, + float *noise, + float *tone, + int offset_select, + float *logmask, + float *mdct, + float *logmdct){ + int i,n=p->n; + float de, coeffi, cx;/* AoTuV */ + float toneatt=p->vi->tone_masteratt[offset_select]; + + cx = p->m_val; + + for(i=0;inoiseoffset[offset_select][i]; + if(val>p->vi->noisemaxsupp)val=p->vi->noisemaxsupp; + logmask[i]=max(val,tone[i]+toneatt); + + + /* AoTuV */ + /** @ M1 ** + The following codes improve a noise problem. + A fundamental idea uses the value of masking and carries out + the relative compensation of the MDCT. + However, this code is not perfect and all noise problems cannot be solved. + by Aoyumi @ 2004/04/18 + */ + + if(offset_select == 1) { + coeffi = -17.2; /* coeffi is a -17.2dB threshold */ + val = val - logmdct[i]; /* val == mdct line value relative to floor in dB */ + + if(val > coeffi){ + /* mdct value is > -17.2 dB below floor */ + + de = 1.0-((val-coeffi)*0.005*cx); + /* pro-rated attenuation: + -0.00 dB boost if mdct value is -17.2dB (relative to floor) + -0.77 dB boost if mdct value is 0dB (relative to floor) + -1.64 dB boost if mdct value is +17.2dB (relative to floor) + etc... */ + + if(de < 0) de = 0.0001; + }else + /* mdct value is <= -17.2 dB below floor */ + + de = 1.0-((val-coeffi)*0.0003*cx); + /* pro-rated attenuation: + +0.00 dB atten if mdct value is -17.2dB (relative to floor) + +0.45 dB atten if mdct value is -34.4dB (relative to floor) + etc... */ + + mdct[i] *= de; + + } + } +} + +float _vp_ampmax_decay(float amp,vorbis_dsp_state *vd){ + vorbis_info *vi=vd->vi; + codec_setup_info *ci=vi->codec_setup; + vorbis_info_psy_global *gi=&ci->psy_g_param; + + int n=ci->blocksizes[vd->W]/2; + float secs=(float)n/vi->rate; + + amp+=secs*gi->ampmax_att_per_sec; + if(amp<-9999)amp=-9999; + return(amp); +} + +static void couple_lossless(float A, float B, + float *qA, float *qB){ + int test1=fabs(*qA)>fabs(*qB); + test1-= fabs(*qA)fabs(B))<<1)-1; + if(test1==1){ + *qB=(*qA>0.f?*qA-*qB:*qB-*qA); + }else{ + float temp=*qB; + *qB=(*qB>0.f?*qA-*qB:*qB-*qA); + *qA=temp; + } + + if(*qB>fabs(*qA)*1.9999f){ + *qB= -fabs(*qA)*2.f; + *qA= -*qA; + } +} + +static float hypot_lookup[32]={ + -0.009935, -0.011245, -0.012726, -0.014397, + -0.016282, -0.018407, -0.020800, -0.023494, + -0.026522, -0.029923, -0.033737, -0.038010, + -0.042787, -0.048121, -0.054064, -0.060671, + -0.068000, -0.076109, -0.085054, -0.094892, + -0.105675, -0.117451, -0.130260, -0.144134, + -0.159093, -0.175146, -0.192286, -0.210490, + -0.229718, -0.249913, -0.271001, -0.292893}; + +static void precomputed_couple_point(float premag, + int floorA,int floorB, + float *mag, float *ang){ + + int test=(floorA>floorB)-1; + int offset=31-abs(floorA-floorB); + float floormag=hypot_lookup[((offset<0)-1)&offset]+1.f; + + floormag*=FLOOR1_fromdB_INV_LOOKUP[(floorB&test)|(floorA&(~test))]; + + *mag=premag*floormag; + *ang=0.f; +} + +/* just like below, this is currently set up to only do + single-step-depth coupling. Otherwise, we'd have to do more + copying (which will be inevitable later) */ + +/* doing the real circular magnitude calculation is audibly superior + to (A+B)/sqrt(2) */ +static float dipole_hypot(float a, float b){ + if(a>0.){ + if(b>0.)return sqrt(a*a+b*b); + if(a>-b)return sqrt(a*a-b*b); + return -sqrt(b*b-a*a); + } + if(b<0.)return -sqrt(a*a+b*b); + if(-a>b)return -sqrt(a*a-b*b); + return sqrt(b*b-a*a); +} +static float round_hypot(float a, float b){ + if(a>0.){ + if(b>0.)return sqrt(a*a+b*b); + if(a>-b)return sqrt(a*a+b*b); + return -sqrt(b*b+a*a); + } + if(b<0.)return -sqrt(a*a+b*b); + if(-a>b)return -sqrt(a*a+b*b); + return sqrt(b*b+a*a); +} + +/* revert to round hypot for now */ +float **_vp_quantize_couple_memo(vorbis_block *vb, + vorbis_info_psy_global *g, + vorbis_look_psy *p, + vorbis_info_mapping0 *vi, + float **mdct){ + + int i,j,n=p->n; + float **ret=_vorbis_block_alloc(vb,vi->coupling_steps*sizeof(*ret)); + int limit=g->coupling_pointlimit[p->vi->blockflag][PACKETBLOBS/2]; + + for(i=0;icoupling_steps;i++){ + float *mdctM=mdct[vi->coupling_mag[i]]; + float *mdctA=mdct[vi->coupling_ang[i]]; + ret[i]=_vorbis_block_alloc(vb,n*sizeof(**ret)); + for(j=0;jf2); +} + +int **_vp_quantize_couple_sort(vorbis_block *vb, + vorbis_look_psy *p, + vorbis_info_mapping0 *vi, + float **mags){ + + + if(p->vi->normal_point_p){ + int i,j,k,n=p->n; + int **ret=_vorbis_block_alloc(vb,vi->coupling_steps*sizeof(*ret)); + int partition=p->vi->normal_partition; + float **work=alloca(sizeof(*work)*partition); + + for(i=0;icoupling_steps;i++){ + ret[i]=_vorbis_block_alloc(vb,n*sizeof(**ret)); + + for(j=0;jn; + vorbis_info_psy *vi=p->vi; + int partition=vi->normal_partition; + float **work=alloca(sizeof(*work)*partition); + int start=vi->normal_start; + + for(j=start;jn)partition=n-j; + for(i=0;in; + vorbis_info_psy *vi=p->vi; + int partition=vi->normal_partition; + int start=vi->normal_start; + + if(start>n)start=n; + + if(vi->normal_channel_p){ + for(;j=.25f){ + out[k]=rint(in[k]); + acc-=in[k]*in[k]; + flag=1; + }else{ + if(accnormal_thresh)break; + out[k]=unitnorm(in[k]); + acc-=1.; + } + } + + for(;in; + + /* perform any requested channel coupling */ + /* point stereo can only be used in a first stage (in this encoder) + because of the dependency on floor lookups */ + for(i=0;icoupling_steps;i++){ + + /* once we're doing multistage coupling in which a channel goes + through more than one coupling step, the floor vector + magnitudes will also have to be recalculated an propogated + along with PCM. Right now, we're not (that will wait until 5.1 + most likely), so the code isn't here yet. The memory management + here is all assuming single depth couplings anyway. */ + + /* make sure coupling a zero and a nonzero channel results in two + nonzero channels. */ + if(nonzero[vi->coupling_mag[i]] || + nonzero[vi->coupling_ang[i]]){ + + + float *rM=res[vi->coupling_mag[i]]; + float *rA=res[vi->coupling_ang[i]]; + float *qM=rM+n; + float *qA=rA+n; + int *floorM=ifloor[vi->coupling_mag[i]]; + int *floorA=ifloor[vi->coupling_ang[i]]; + float prepoint=stereo_threshholds[g->coupling_prepointamp[blobno]]; + float postpoint=stereo_threshholds[g->coupling_postpointamp[blobno]]; + int partition=(p->vi->normal_point_p?p->vi->normal_partition:p->n); + int limit=g->coupling_pointlimit[p->vi->blockflag][blobno]; + int pointlimit=limit; + + nonzero[vi->coupling_mag[i]]=1; + nonzero[vi->coupling_ang[i]]=1; + + /* The threshold of a stereo is changed with the size of n */ + if(n > 1000) + postpoint=stereo_threshholds_limited[g->coupling_postpointamp[blobno]]; + + for(j=0;jn;j+=partition){ + float acc=0.f; + + for(k=0;k=limit && fabs(rM[l])vi->normal_point_p){ + for(k=0;k=p->vi->normal_thresh;k++){ + int l=mag_sort[i][j+k]; + if(l=pointlimit && rint(qM[l])==0.f){ + qM[l]=unitnorm(qM[l]); + acc-=1.f; + } + } + } + } + } + } +} + +/* AoTuV */ +/** @ M2 ** + The boost problem by the combination of noise normalization and point stereo is eased. + However, this is a temporary patch. + by Aoyumi @ 2004/04/18 +*/ + +void hf_reduction(vorbis_info_psy_global *g, + vorbis_look_psy *p, + vorbis_info_mapping0 *vi, + float **mdct){ + + int i,j,n=p->n, de=0.3*p->m_val; + int limit=g->coupling_pointlimit[p->vi->blockflag][PACKETBLOBS/2]; + int start=p->vi->normal_start; + + for(i=0; icoupling_steps; i++){ + /* for(j=start; j +#include +#include +#include + +#include "vorbis/codec.h" +#include "codec_internal.h" +#include "os.h" +#include "misc.h" +#include "psy.h" +#include "mdct.h" +#include "smallft.h" +#include "window.h" +#include "scales.h" +#include "lpc.h" +#include "lsp.h" +#include "masking.h" +#include "registry.h" + +static vorbis_info_psy_global _psy_set0G={ + 0, /* decaydBpms */ + 8, /* lines per eighth octave */ + + /* thresh sample period, preecho clamp trigger threshhold, range, minenergy */ + 256, {26.f,26.f,26.f,30.f}, {-90.f,-90.f,-90.f,-90.f}, -90.f, + -6.f, + + 0, + + 0., + 0., +}; + +static vp_part _vp_part0[]={ + { 1,9e10f, 9e10f, 1.f,9999.f}, + { 9999, .75f, 9e10f, .5f,9999.f}, +/*{ 9999, 1.5f, 9e10f, .5f,9999.f},*/ + { 18,9e10f, 9e10f, .5f, 30.f}, + { 9999,9e10f, 9e10f, .5f, 30.f} +}; + +static vp_couple _vp_couple0[]={ + { 1, {9e10f,9e10f,0}, { 0.f, 0.f,0}, { 0.f, 0.f,0}, {0.f,0.f,0}}, + { 18, {9e10f,9e10f,0}, { 0.f, 0.f,0}, { 0.f, 0.f,0}, {0.f,0.f,0}}, + { 9999, {9e10f,9e10f,0}, { 0.f, 9e10f,0}, { 0.f,22.f,1}, {0.f,0.f,0}} +}; + +static vorbis_info_psy _psy_set0={ + ATH_Bark_dB_lineaggressive, + + -100.f, + -140.f, + 6.f, /* floor master att */ + + /* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 */ + /* x: 63 88 125 175 250 350 500 700 1k 1.4k 2k 2.8k 4k 5.6k 8k 11.5k 16k Hz */ + /* y: 0 10 20 30 40 50 60 70 80 90 100 dB */ + 1, /* tonemaskp */ + 0.f, /* tone master att */ + /* 0 10 20 30 40 50 60 70 80 90 100 */ + { + {-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f}, /*63*/ + {-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f}, /*88*/ + {-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f,-999.f}, /*125*/ + + {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*175*/ + {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*250*/ + {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*350*/ + {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*500*/ + {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*700*/ + {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*1000*/ + {-30.f,-30.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*1400*/ + {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*2000*/ + {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*2800*/ + {-40.f,-40.f,-40.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*4000*/ + + {-30.f,-35.f,-35.f,-40.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*5600*/ + + {-30.f,-30.f,-33.f,-35.f,-40.f,-50.f,-60.f,-70.f,-80.f,-90.f,-100.f}, /*8000*/ + {-30.f,-30.f,-33.f,-35.f,-40.f,-45.f,-50.f,-60.f,-70.f,-85.f,-100.f}, /*11500*/ + {-24.f,-24.f,-26.f,-32.f,-32.f,-42.f,-50.f,-60.f,-70.f,-85.f,-100.f}, /*16000*/ + + }, + + 1,/* peakattp */ + {{-14.f,-20.f,-20.f,-20.f,-26.f,-32.f,-40.f,-40.f,-40.f,-40.f,-40.f},/*63*/ + {-14.f,-20.f,-20.f,-20.f,-26.f,-32.f,-40.f,-40.f,-40.f,-40.f,-40.f},/*88*/ + {-14.f,-20.f,-20.f,-20.f,-26.f,-32.f,-40.f,-40.f,-40.f,-40.f,-40.f},/*125*/ + {-14.f,-20.f,-20.f,-20.f,-26.f,-32.f,-40.f,-40.f,-40.f,-40.f,-40.f},/*175*/ + {-14.f,-20.f,-20.f,-20.f,-26.f,-32.f,-40.f,-40.f,-40.f,-40.f,-40.f},/*250*/ + {-14.f,-20.f,-20.f,-20.f,-26.f,-32.f,-40.f,-40.f,-40.f,-40.f,-40.f},/*350*/ + {-14.f,-20.f,-20.f,-20.f,-26.f,-32.f,-40.f,-40.f,-40.f,-40.f,-40.f},/*500*/ + {-14.f,-20.f,-20.f,-20.f,-26.f,-32.f,-40.f,-40.f,-40.f,-40.f,-40.f},/*700*/ + {-14.f,-20.f,-20.f,-20.f,-26.f,-32.f,-40.f,-40.f,-40.f,-40.f,-40.f},/*1000*/ + {-14.f,-20.f,-20.f,-20.f,-26.f,-32.f,-40.f,-40.f,-40.f,-40.f,-40.f},/*1400*/ + {-14.f,-20.f,-20.f,-20.f,-26.f,-32.f,-40.f,-40.f,-40.f,-40.f,-40.f},/*2000*/ + {-14.f,-20.f,-20.f,-20.f,-26.f,-32.f,-40.f,-40.f,-40.f,-40.f,-40.f},/*2800*/ + {-14.f,-20.f,-20.f,-20.f,-26.f,-32.f,-40.f,-40.f,-40.f,-40.f,-40.f},/*4000*/ + {-10.f,-12.f,-14.f,-16.f,-16.f,-20.f,-24.f,-30.f,-32.f,-40.f,-40.f},/*5600*/ + {-10.f,-12.f,-14.f,-16.f,-16.f,-20.f,-24.f,-30.f,-32.f,-40.f,-40.f},/*8000*/ + {-10.f,-10.f,-10.f,-12.f,-14.f,-18.f,-22.f,-28.f,-32.f,-40.f,-40.f},/*11500*/ + {-10.f,-10.f,-10.f,-12.f,-14.f,-18.f,-22.f,-28.f,-32.f,-40.f,-40.f},/*16000*/ + }, + + 1,/*noisemaskp */ + -10.f, /* suppress any noise curve over maxspec+n */ + .5f, /* low window */ + .5f, /* high window */ + 10, + 10, + 25, + {.000f, 0.f, /*63*/ + .000f, 0.f, /*88*/ + .000f, 0.f, /*125*/ + .000f, 0.f, /*175*/ + .000f, 0.f, /*250*/ + .000f, 0.f, /*350*/ + .000f, 0.f, /*500*/ + .000f, 0.f, /*700*/ + .000f, 0.f, /*1000*/ + .300f, 0.f, /*1400*/ + .300f, 0.f, /*2000*/ + .300f, 0.f, /*2800*/ + .500f, 0.f, /*4000*/ + .700f, 0.f, /*5600*/ + .850f, 0.f, /*8000*/ + .900f, 0.f, /*11500*/ + .900f, 1.f, /*16000*/ + }, + + 95.f, /* even decade + 5 is important; saves an rint() later in a + tight loop) */ + -44., + + 32, + _vp_part0,_vp_couple0 +}; + +static vorbis_info_floor1 _floor_set0={1, + {0}, + + {32}, + {0}, + {0}, + {{-1}}, + + 2, + {0,1024, + + 88,31,243, + + 14,54,143,460, + + 6,3,10, 22,18,26, 41,36,47, + 69,61,78, 112,99,126, 185,162,211, + 329,282,387, 672,553,825 + }, + + 60,30,400, + 20,8,1,18., + 20,600, + 960}; + + +static vorbis_info_mapping0 mapping_info={1,{0,1},{0},{0},{0},0, 1, {0},{1}}; +static codec_setup_info codec_setup0={ {0,0}, + 1,1,1,1,1,0,1, + {NULL}, + {0},{&mapping_info}, + {0},{NULL}, + {1},{&_floor_set0}, + {2},{NULL}, + {NULL}, + {&_psy_set0}, + &_psy_set0G}; + +static int noisy=0; +void analysis(char *base,int i,float *v,int n,int bark,int dB){ + if(noisy){ + int j; + FILE *of; + char buffer[80]; + sprintf(buffer,"%s_%d.m",base,i); + of=fopen(buffer,"w"); + + for(j=0;jlook(NULL,NULL,&_floor_set0); + + /* we cheat on the WAV header; we just bypass 44 bytes and never + verify that it matches 16bit/stereo/44.1kHz. */ + + fread(buffer,1,44,stdin); + fwrite(buffer,1,44,stdout); + memset(buffer,0,framesize*2); + + analysis("window",0,window,framesize,0,0); + + fprintf(stderr,"Processing for frame size %d...\n",framesize); + + while(!eos){ + long bytes=fread(buffer2,1,framesize*2,stdin); + if(bytes>1]=todB(&temp); + if(temp>local_ampmax[i])local_ampmax[i]=temp; + } + if(local_ampmax[i]>ampmax)ampmax=local_ampmax[i]; + + mdct_forward(&m_look,pcm[i],mdct); + for(j=0;jforward(&vb,floor_look, + mdct, + logmdct, + mask, + logmax, + + flr[i]); + } + + _vp_remove_floor(&p_look, + pg_look, + logmdct, + mdct, + flr[i], + pcm[i], + local_ampmax[i]); + + for(j=0;j1500) + fprintf(stderr,"%ld ",frameno+i); + + analysis("res",frameno+i,pcm[i],framesize/2,1,0); + analysis("codedflr",frameno+i,flr[i],framesize/2,1,1); + } + + /* residue prequantization */ + _vp_partition_prequant(&p_look, + &vi, + pcm, + nonzero); + + for(i=0;i<2;i++) + analysis("quant",frameno+i,pcm[i],framesize/2,1,0); + + /* channel coupling / stereo quantization */ + + _vp_couple(&p_look, + &mapping_info, + pcm, + nonzero); + + for(i=0;i<2;i++) + analysis("coupled",frameno+i,pcm[i],framesize/2,1,0); + + /* decoupling */ + for(i=mapping_info.coupling_steps-1;i>=0;i--){ + float *pcmM=pcm[mapping_info.coupling_mag[i]]; + float *pcmA=pcm[mapping_info.coupling_ang[i]]; + + for(j=0;j0) + if(ang>0){ + pcmM[j]=mag; + pcmA[j]=mag-ang; + }else{ + pcmA[j]=mag; + pcmM[j]=mag+ang; + } + else + if(ang>0){ + pcmM[j]=mag; + pcmA[j]=mag+ang; + }else{ + pcmA[j]=mag; + pcmM[j]=mag-ang; + } + } + } + + for(i=0;i<2;i++) + analysis("decoupled",frameno+i,pcm[i],framesize/2,1,0); + + for(i=0;i<2;i++){ + float amp; + + for(j=0;j32767){ + if(!flag)fprintf(stderr,"clipping in frame %ld ",frameno+i); + flag=1; + val=32767; + } + if(val<-32768){ + if(!flag)fprintf(stderr,"clipping in frame %ld ",frameno+i); + flag=1; + val=-32768; + } + ptr[0]=val&0xff; + ptr[1]=(val>>8)&0xff; + ptr+=4; + } + } + + fprintf(stderr,"*"); + fwrite(buffer,1,framesize*2,stdout); + memmove(buffer,buffer2,framesize*2); + + for(i=0;i<2;i++){ + for(j=0,k=framesize/2;j +#include +#include +#include +#include "vorbis/codec.h" +#include "codec_internal.h" +#include "registry.h" +#include "codebook.h" +#include "misc.h" +#include "os.h" + +#if defined(TRAIN_RES) || defined (TRAIN_RESAUX) +#include +#endif + +typedef struct { + vorbis_info_residue0 *info; + + int parts; + int stages; + codebook *fullbooks; + codebook *phrasebook; + codebook ***partbooks; + + int partvals; + int **decodemap; + + long postbits; + long phrasebits; + long frames; + +#if defined(TRAIN_RES) || defined(TRAIN_RESAUX) + int train_seq; + long *training_data[8][64]; + float training_max[8][64]; + float training_min[8][64]; + float tmin; + float tmax; +#endif + +} vorbis_look_residue0; + +void res0_free_info(vorbis_info_residue *i){ + vorbis_info_residue0 *info=(vorbis_info_residue0 *)i; + if(info){ + memset(info,0,sizeof(*info)); + _ogg_free(info); + } +} + +void res0_free_look(vorbis_look_residue *i){ + int j; + if(i){ + + vorbis_look_residue0 *look=(vorbis_look_residue0 *)i; + +#ifdef TRAIN_RES + { + int j,k,l; + for(j=0;jparts;j++){ + /*fprintf(stderr,"partition %d: ",j);*/ + for(k=0;k<8;k++) + if(look->training_data[k][j]){ + char buffer[80]; + FILE *of; + codebook *statebook=look->partbooks[j][k]; + + /* long and short into the same bucket by current convention */ + sprintf(buffer,"res_part%d_pass%d.vqd",j,k); + of=fopen(buffer,"a"); + + for(l=0;lentries;l++) + fprintf(of,"%d:%ld\n",l,look->training_data[k][j][l]); + + fclose(of); + + /*fprintf(stderr,"%d(%.2f|%.2f) ",k, + look->training_min[k][j],look->training_max[k][j]);*/ + + _ogg_free(look->training_data[k][j]); + look->training_data[k][j]=NULL; + } + /*fprintf(stderr,"\n");*/ + } + } + fprintf(stderr,"min/max residue: %g::%g\n",look->tmin,look->tmax); + + /*fprintf(stderr,"residue bit usage %f:%f (%f total)\n", + (float)look->phrasebits/look->frames, + (float)look->postbits/look->frames, + (float)(look->postbits+look->phrasebits)/look->frames);*/ +#endif + + + /*vorbis_info_residue0 *info=look->info; + + fprintf(stderr, + "%ld frames encoded in %ld phrasebits and %ld residue bits " + "(%g/frame) \n",look->frames,look->phrasebits, + look->resbitsflat, + (look->phrasebits+look->resbitsflat)/(float)look->frames); + + for(j=0;jparts;j++){ + long acc=0; + fprintf(stderr,"\t[%d] == ",j); + for(k=0;kstages;k++) + if((info->secondstages[j]>>k)&1){ + fprintf(stderr,"%ld,",look->resbits[j][k]); + acc+=look->resbits[j][k]; + } + + fprintf(stderr,":: (%ld vals) %1.2fbits/sample\n",look->resvals[j], + acc?(float)acc/(look->resvals[j]*info->grouping):0); + } + fprintf(stderr,"\n");*/ + + for(j=0;jparts;j++) + if(look->partbooks[j])_ogg_free(look->partbooks[j]); + _ogg_free(look->partbooks); + for(j=0;jpartvals;j++) + _ogg_free(look->decodemap[j]); + _ogg_free(look->decodemap); + + memset(look,0,sizeof(*look)); + _ogg_free(look); + } +} + +static int ilog(unsigned int v){ + int ret=0; + while(v){ + ret++; + v>>=1; + } + return(ret); +} + +static int icount(unsigned int v){ + int ret=0; + while(v){ + ret+=v&1; + v>>=1; + } + return(ret); +} + + +void res0_pack(vorbis_info_residue *vr,oggpack_buffer *opb){ + vorbis_info_residue0 *info=(vorbis_info_residue0 *)vr; + int j,acc=0; + oggpack_write(opb,info->begin,24); + oggpack_write(opb,info->end,24); + + oggpack_write(opb,info->grouping-1,24); /* residue vectors to group and + code with a partitioned book */ + oggpack_write(opb,info->partitions-1,6); /* possible partition choices */ + oggpack_write(opb,info->groupbook,8); /* group huffman book */ + + /* secondstages is a bitmask; as encoding progresses pass by pass, a + bitmask of one indicates this partition class has bits to write + this pass */ + for(j=0;jpartitions;j++){ + if(ilog(info->secondstages[j])>3){ + /* yes, this is a minor hack due to not thinking ahead */ + oggpack_write(opb,info->secondstages[j],3); + oggpack_write(opb,1,1); + oggpack_write(opb,info->secondstages[j]>>3,5); + }else + oggpack_write(opb,info->secondstages[j],4); /* trailing zero */ + acc+=icount(info->secondstages[j]); + } + for(j=0;jbooklist[j],8); + +} + +/* vorbis_info is for range checking */ +vorbis_info_residue *res0_unpack(vorbis_info *vi,oggpack_buffer *opb){ + int j,acc=0; + vorbis_info_residue0 *info=_ogg_calloc(1,sizeof(*info)); + codec_setup_info *ci=vi->codec_setup; + + info->begin=oggpack_read(opb,24); + info->end=oggpack_read(opb,24); + info->grouping=oggpack_read(opb,24)+1; + info->partitions=oggpack_read(opb,6)+1; + info->groupbook=oggpack_read(opb,8); + + for(j=0;jpartitions;j++){ + int cascade=oggpack_read(opb,3); + if(oggpack_read(opb,1)) + cascade|=(oggpack_read(opb,5)<<3); + info->secondstages[j]=cascade; + + acc+=icount(cascade); + } + for(j=0;jbooklist[j]=oggpack_read(opb,8); + + if(info->groupbook>=ci->books)goto errout; + for(j=0;jbooklist[j]>=ci->books)goto errout; + + return(info); + errout: + res0_free_info(info); + return(NULL); +} + +vorbis_look_residue *res0_look(vorbis_dsp_state *vd, + vorbis_info_residue *vr){ + vorbis_info_residue0 *info=(vorbis_info_residue0 *)vr; + vorbis_look_residue0 *look=_ogg_calloc(1,sizeof(*look)); + codec_setup_info *ci=vd->vi->codec_setup; + + int j,k,acc=0; + int dim; + int maxstage=0; + look->info=info; + + look->parts=info->partitions; + look->fullbooks=ci->fullbooks; + look->phrasebook=ci->fullbooks+info->groupbook; + dim=look->phrasebook->dim; + + look->partbooks=_ogg_calloc(look->parts,sizeof(*look->partbooks)); + + for(j=0;jparts;j++){ + int stages=ilog(info->secondstages[j]); + if(stages){ + if(stages>maxstage)maxstage=stages; + look->partbooks[j]=_ogg_calloc(stages,sizeof(*look->partbooks[j])); + for(k=0;ksecondstages[j]&(1<partbooks[j][k]=ci->fullbooks+info->booklist[acc++]; +#ifdef TRAIN_RES + look->training_data[k][j]=_ogg_calloc(look->partbooks[j][k]->entries, + sizeof(***look->training_data)); +#endif + } + } + } + + look->partvals=rint(pow((float)look->parts,(float)dim)); + look->stages=maxstage; + look->decodemap=_ogg_malloc(look->partvals*sizeof(*look->decodemap)); + for(j=0;jpartvals;j++){ + long val=j; + long mult=look->partvals/look->parts; + look->decodemap[j]=_ogg_malloc(dim*sizeof(*look->decodemap[j])); + for(k=0;kparts; + look->decodemap[j][k]=deco; + } + } +#if defined(TRAIN_RES) || defined (TRAIN_RESAUX) + { + static int train_seq=0; + look->train_seq=train_seq++; + } +#endif + return(look); +} + +/* break an abstraction and copy some code for performance purposes */ +static int local_book_besterror(codebook *book,float *a){ + int dim=book->dim,i,k,o; + int best=0; + encode_aux_threshmatch *tt=book->c->thresh_tree; + + /* find the quant val of each scalar */ + for(k=0,o=dim;kthreshvals>>1; + + if(valquantthresh[i]){ + if(valquantthresh[i-1]){ + for(--i;i>0;--i) + if(val>=tt->quantthresh[i-1]) + break; + } + }else{ + + for(++i;ithreshvals-1;++i) + if(valquantthresh[i])break; + + } + + best=(best*tt->quantvals)+tt->quantmap[i]; + } + /* regular lattices are easy :-) */ + + if(book->c->lengthlist[best]<=0){ + const static_codebook *c=book->c; + int i,j; + float bestf=0.f; + float *e=book->valuelist; + best=-1; + for(i=0;ientries;i++){ + if(c->lengthlist[i]>0){ + float this=0.f; + for(j=0;jvaluelist+best*dim; + for(i=0;idim; + int step=n/dim; + + for(i=0;iinfo; + vorbis_info *vi=vb->vd->vi; + codec_setup_info *ci=vi->codec_setup; + + /* move all this setup out later */ + int samples_per_partition=info->grouping; + int possible_partitions=info->partitions; + int n=info->end-info->begin; + + int partvals=n/samples_per_partition; + long **partword=_vorbis_block_alloc(vb,ch*sizeof(*partword)); + float scale=100./samples_per_partition; + + /* we find the partition type for each partition of each + channel. We'll go back and do the interleaved encoding in a + bit. For now, clarity */ + + for(i=0;ibegin; + for(j=0;jmax)max=fabs(in[j][offset+k]); + ent+=fabs(rint(in[j][offset+k])); + } + ent*=scale; + + for(k=0;kclassmetric1[k] && + (info->classmetric2[k]<0 || (int)entclassmetric2[k])) + break; + + partword[j][i]=k; + } + } + +#ifdef TRAIN_RESAUX + { + FILE *of; + char buffer[80]; + + for(i=0;itrain_seq); + of=fopen(buffer,"a"); + for(j=0;jframes++; + + return(partword); +} + +/* designed for stereo or other modes where the partition size is an + integer multiple of the number of channels encoded in the current + submap */ +static long **_2class(vorbis_block *vb,vorbis_look_residue *vl,float **in, + int ch){ + long i,j,k,l; + vorbis_look_residue0 *look=(vorbis_look_residue0 *)vl; + vorbis_info_residue0 *info=look->info; + + /* move all this setup out later */ + int samples_per_partition=info->grouping; + int possible_partitions=info->partitions; + int n=info->end-info->begin; + + int partvals=n/samples_per_partition; + long **partword=_vorbis_block_alloc(vb,sizeof(*partword)); + +#if defined(TRAIN_RES) || defined (TRAIN_RESAUX) + FILE *of; + char buffer[80]; +#endif + + partword[0]=_vorbis_block_alloc(vb,n*ch/samples_per_partition*sizeof(*partword[0])); + memset(partword[0],0,n*ch/samples_per_partition*sizeof(*partword[0])); + + for(i=0,l=info->begin/ch;imagmax)magmax=fabs(in[0][l]); + for(k=1;kangmax)angmax=fabs(in[k][l]); + l++; + } + + for(j=0;jclassmetric1[j] && + angmax<=info->classmetric2[j]) + break; + + partword[0][i]=j; + + } + +#ifdef TRAIN_RESAUX + sprintf(buffer,"resaux_%d.vqd",look->train_seq); + of=fopen(buffer,"a"); + for(i=0;iframes++; + + return(partword); +} + +static int _01forward(oggpack_buffer *opb, + vorbis_block *vb,vorbis_look_residue *vl, + float **in,int ch, + long **partword, + int (*encode)(oggpack_buffer *,float *,int, + codebook *,long *)){ + long i,j,k,s; + vorbis_look_residue0 *look=(vorbis_look_residue0 *)vl; + vorbis_info_residue0 *info=look->info; + + vorbis_dsp_state *vd=vb->vd; + + /* move all this setup out later */ + int samples_per_partition=info->grouping; + int possible_partitions=info->partitions; + int partitions_per_word=look->phrasebook->dim; + int n=info->end-info->begin; + + int partvals=n/samples_per_partition; + long resbits[128]; + long resvals[128]; + +#ifdef TRAIN_RES + for(i=0;ibegin;jend;j++){ + if(in[i][j]>look->tmax)look->tmax=in[i][j]; + if(in[i][j]tmin)look->tmin=in[i][j]; + } +#endif + + memset(resbits,0,sizeof(resbits)); + memset(resvals,0,sizeof(resvals)); + + /* we code the partition words for each channel, then the residual + words for a partition per channel until we've written all the + residual words for that partition word. Then write the next + partition channel words... */ + + for(s=0;sstages;s++){ + + for(i=0;iphrasebook->entries) + look->phrasebits+=vorbis_book_encode(look->phrasebook,val,opb); +#if 0 /*def TRAIN_RES*/ + else + fprintf(stderr,"!"); +#endif + + } + } + + /* now we encode interleaved residual values for the partitions */ + for(k=0;kbegin; + + for(j=0;jsecondstages[partword[j][i]]&(1<partbooks[partword[j][i]][s]; + if(statebook){ + int ret; + long *accumulator=NULL; + +#ifdef TRAIN_RES + accumulator=look->training_data[s][partword[j][i]]; + { + int l; + float *samples=in[j]+offset; + for(l=0;ltraining_min[s][partword[j][i]]) + look->training_min[s][partword[j][i]]=samples[l]; + if(samples[l]>look->training_max[s][partword[j][i]]) + look->training_max[s][partword[j][i]]=samples[l]; + } + } +#endif + + ret=encode(opb,in[j]+offset,samples_per_partition, + statebook,accumulator); + + look->postbits+=ret; + resbits[partword[j][i]]+=ret; + } + } + } + } + } + } + + /*{ + long total=0; + long totalbits=0; + fprintf(stderr,"%d :: ",vb->mode); + for(k=0;kinfo; + + /* move all this setup out later */ + int samples_per_partition=info->grouping; + int partitions_per_word=look->phrasebook->dim; + int n=info->end-info->begin; + + int partvals=n/samples_per_partition; + int partwords=(partvals+partitions_per_word-1)/partitions_per_word; + int ***partword=alloca(ch*sizeof(*partword)); + + for(j=0;jstages;s++){ + + /* each loop decodes on partition codeword containing + partitions_pre_word partitions */ + for(i=0,l=0;iphrasebook,&vb->opb); + if(temp==-1)goto eopbreak; + partword[j][l]=look->decodemap[temp]; + if(partword[j][l]==NULL)goto errout; + } + } + + /* now we decode residual values for the partitions */ + for(k=0;kbegin+i*samples_per_partition; + if(info->secondstages[partword[j][l][k]]&(1<partbooks[partword[j][l][k]][s]; + if(stagebook){ + if(decodepart(stagebook,in[j]+offset,&vb->opb, + samples_per_partition)==-1)goto eopbreak; + } + } + } + } + } + + errout: + eopbreak: + return(0); +} + +#if 0 +/* residue 0 and 1 are just slight variants of one another. 0 is + interleaved, 1 is not */ +long **res0_class(vorbis_block *vb,vorbis_look_residue *vl, + float **in,int *nonzero,int ch){ + /* we encode only the nonzero parts of a bundle */ + int i,used=0; + for(i=0;ipcmend/2; + for(i=0;ipcmend/2; + for(i=0;ipcmend/2,used=0; + + /* don't duplicate the code; use a working vector hack for now and + reshape ourselves into a single channel res1 */ + /* ugly; reallocs for each coupling pass :-( */ + float *work=_vorbis_block_alloc(vb,ch*n*sizeof(*work)); + for(i=0;iinfo; + + /* move all this setup out later */ + int samples_per_partition=info->grouping; + int partitions_per_word=look->phrasebook->dim; + int n=info->end-info->begin; + + int partvals=n/samples_per_partition; + int partwords=(partvals+partitions_per_word-1)/partitions_per_word; + int **partword=_vorbis_block_alloc(vb,partwords*sizeof(*partword)); + + for(i=0;istages;s++){ + for(i=0,l=0;iphrasebook,&vb->opb); + if(temp==-1)goto eopbreak; + partword[l]=look->decodemap[temp]; + if(partword[l]==NULL)goto errout; + } + + /* now we decode residual values for the partitions */ + for(k=0;ksecondstages[partword[l][k]]&(1<partbooks[partword[l][k]][s]; + + if(stagebook){ + if(vorbis_book_decodevv_add(stagebook,in, + i*samples_per_partition+info->begin,ch, + &vb->opb,samples_per_partition)==-1) + goto eopbreak; + } + } + } + } + + errout: + eopbreak: + return(0); +} + + +vorbis_func_residue residue0_exportbundle={ + NULL, + &res0_unpack, + &res0_look, + &res0_free_info, + &res0_free_look, + NULL, + NULL, + &res0_inverse +}; + +vorbis_func_residue residue1_exportbundle={ + &res0_pack, + &res0_unpack, + &res0_look, + &res0_free_info, + &res0_free_look, + &res1_class, + &res1_forward, + &res1_inverse +}; + +vorbis_func_residue residue2_exportbundle={ + &res0_pack, + &res0_unpack, + &res0_look, + &res0_free_info, + &res0_free_look, + &res2_class, + &res2_forward, + &res2_inverse +}; + diff --git a/Libraries/Vorbis/Files/lib/scales.h b/Libraries/Vorbis/Files/lib/scales.h new file mode 100644 index 000000000..4bfa82ddd --- /dev/null +++ b/Libraries/Vorbis/Files/lib/scales.h @@ -0,0 +1,84 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * + * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * + * by the XIPHOPHORUS Company http://www.xiph.org/ * + * * + ******************************************************************** + + function: linear scale -> dB, Bark and Mel scales + last mod: $Id$ + + ********************************************************************/ + +#ifndef _V_SCALES_H_ +#define _V_SCALES_H_ + +#include +#include "os.h" + +/* 20log10(x) */ +#define VORBIS_IEEE_FLOAT32 1 +#ifdef VORBIS_IEEE_FLOAT32 + +static float unitnorm(float x){ + ogg_uint32_t *ix=(ogg_uint32_t *)&x; + *ix=(*ix&0x80000000UL)|(0x3f800000UL); + return(x); +} + +static float FABS(float *x){ + ogg_uint32_t *ix=(ogg_uint32_t *)x; + *ix&=0x7fffffffUL; + return(*x); +} + +/* Segher was off (too high) by ~ .3 decibel. Center the conversion correctly. */ +static float todB(const float *x){ + return (float)((*(ogg_int32_t *)x)&0x7fffffff) * 7.17711438e-7f -764.6161886f; +} + +#define todB_nn(x) todB(x) + +#else + +static float unitnorm(float x){ + if(x<0)return(-1.f); + return(1.f); +} + +#define FABS(x) fabs(*(x)) + +#define todB(x) (*(x)==0?-400.f:log(*(x)**(x))*4.34294480f) +#define todB_nn(x) (*(x)==0.f?-400.f:log(*(x))*8.6858896f) + +#endif + +#define fromdB(x) (exp((x)*.11512925f)) + +/* The bark scale equations are approximations, since the original + table was somewhat hand rolled. The below are chosen to have the + best possible fit to the rolled tables, thus their somewhat odd + appearance (these are more accurate and over a longer range than + the oft-quoted bark equations found in the texts I have). The + approximations are valid from 0 - 30kHz (nyquist) or so. + + all f in Hz, z in Bark */ + +#define toBARK(n) (13.1f*atan(.00074f*(n))+2.24f*atan((n)*(n)*1.85e-8f)+1e-4f*(n)) +#define fromBARK(z) (102.f*(z)-2.f*pow(z,2.f)+.4f*pow(z,3.f)+pow(1.46f,z)-1.f) +#define toMEL(n) (log(1.f+(n)*.001f)*1442.695f) +#define fromMEL(m) (1000.f*exp((m)/1442.695f)-1000.f) + +/* Frequency to octave. We arbitrarily declare 63.5 Hz to be octave + 0.0 */ + +#define toOC(n) (log(n)*1.442695f-5.965784f) +#define fromOC(o) (exp(((o)+5.965784f)*.693147f)) + +#endif + diff --git a/Libraries/Vorbis/Files/lib/sharedbook.c b/Libraries/Vorbis/Files/lib/sharedbook.c new file mode 100644 index 000000000..0da86c8df --- /dev/null +++ b/Libraries/Vorbis/Files/lib/sharedbook.c @@ -0,0 +1,734 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * + * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * + * by the XIPHOPHORUS Company http://www.xiph.org/ * + * * + ******************************************************************** + + function: basic shared codebook operations + last mod: $Id$ + + ********************************************************************/ + +#include +#include +#include +#include +#include "os.h" +#include "misc.h" +#include "vorbis/codec.h" +#include "codebook.h" +#include "scales.h" + +/**** pack/unpack helpers ******************************************/ +int _ilog(unsigned int v){ + int ret=0; + while(v){ + ret++; + v>>=1; + } + return(ret); +} + +/* 32 bit float (not IEEE; nonnormalized mantissa + + biased exponent) : neeeeeee eeemmmmm mmmmmmmm mmmmmmmm + Why not IEEE? It's just not that important here. */ + +#define VQ_FEXP 10 +#define VQ_FMAN 21 +#define VQ_FEXP_BIAS 768 /* bias toward values smaller than 1. */ + +/* doesn't currently guard under/overflow */ +long _float32_pack(float val){ + int sign=0; + long exp; + long mant; + if(val<0){ + sign=0x80000000; + val= -val; + } + exp= floor(log(val)/log(2.f)); + mant=rint(ldexp(val,(VQ_FMAN-1)-exp)); + exp=(exp+VQ_FEXP_BIAS)<>VQ_FMAN; + if(sign)mant= -mant; + return(ldexp(mant,exp-(VQ_FMAN-1)-VQ_FEXP_BIAS)); +} + +/* given a list of word lengths, generate a list of codewords. Works + for length ordered or unordered, always assigns the lowest valued + codewords first. Extended to handle unused entries (length 0) */ +ogg_uint32_t *_make_words(long *l,long n,long sparsecount){ + long i,j,count=0; + ogg_uint32_t marker[33]; + ogg_uint32_t *r=_ogg_malloc((sparsecount?sparsecount:n)*sizeof(*r)); + memset(marker,0,sizeof(marker)); + + for(i=0;i0){ + ogg_uint32_t entry=marker[length]; + + /* when we claim a node for an entry, we also claim the nodes + below it (pruning off the imagined tree that may have dangled + from it) as well as blocking the use of any nodes directly + above for leaves */ + + /* update ourself */ + if(length<32 && (entry>>length)){ + /* error condition; the lengths must specify an overpopulated tree */ + _ogg_free(r); + return(NULL); + } + r[count++]=entry; + + /* Look to see if the next shorter marker points to the node + above. if so, update it and repeat. */ + { + for(j=length;j>0;j--){ + + if(marker[j]&1){ + /* have to jump branches */ + if(j==1) + marker[1]++; + else + marker[j]=marker[j-1]<<1; + break; /* invariant says next upper marker would already + have been moved if it was on the same path */ + } + marker[j]++; + } + } + + /* prune the tree; the implicit invariant says all the longer + markers were dangling from our just-taken node. Dangle them + from our *new* node. */ + for(j=length+1;j<33;j++) + if((marker[j]>>1) == entry){ + entry=marker[j]; + marker[j]=marker[j-1]<<1; + }else + break; + }else + if(sparsecount==0)count++; + } + + /* bitreverse the words because our bitwise packer/unpacker is LSb + endian */ + for(i=0,count=0;i>j)&1; + } + + if(sparsecount){ + if(l[i]) + r[count++]=temp; + }else + r[count++]=temp; + } + + return(r); +} + +/* there might be a straightforward one-line way to do the below + that's portable and totally safe against roundoff, but I haven't + thought of it. Therefore, we opt on the side of caution */ +long _book_maptype1_quantvals(const static_codebook *b){ + long vals=floor(pow((float)b->entries,1.f/b->dim)); + + /* the above *should* be reliable, but we'll not assume that FP is + ever reliable when bitstream sync is at stake; verify via integer + means that vals really is the greatest value of dim for which + vals^b->bim <= b->entries */ + /* treat the above as an initial guess */ + while(1){ + long acc=1; + long acc1=1; + int i; + for(i=0;idim;i++){ + acc*=vals; + acc1*=vals+1; + } + if(acc<=b->entries && acc1>b->entries){ + return(vals); + }else{ + if(acc>b->entries){ + vals--; + }else{ + vals++; + } + } + } +} + +/* unpack the quantized list of values for encode/decode ***********/ +/* we need to deal with two map types: in map type 1, the values are + generated algorithmically (each column of the vector counts through + the values in the quant vector). in map type 2, all the values came + in in an explicit list. Both value lists must be unpacked */ +float *_book_unquantize(const static_codebook *b,int n,int *sparsemap){ + long j,k,count=0; + if(b->maptype==1 || b->maptype==2){ + int quantvals; + float mindel=_float32_unpack(b->q_min); + float delta=_float32_unpack(b->q_delta); + float *r=_ogg_calloc(n*b->dim,sizeof(*r)); + + /* maptype 1 and 2 both use a quantized value vector, but + different sizes */ + switch(b->maptype){ + case 1: + /* most of the time, entries%dimensions == 0, but we need to be + well defined. We define that the possible vales at each + scalar is values == entries/dim. If entries%dim != 0, we'll + have 'too few' values (values*dimentries;j++){ + if((sparsemap && b->lengthlist[j]) || !sparsemap){ + float last=0.f; + int indexdiv=1; + for(k=0;kdim;k++){ + int index= (j/indexdiv)%quantvals; + float val=b->quantlist[index]; + val=fabs(val)*delta+mindel+last; + if(b->q_sequencep)last=val; + if(sparsemap) + r[sparsemap[count]*b->dim+k]=val; + else + r[count*b->dim+k]=val; + indexdiv*=quantvals; + } + count++; + } + + } + break; + case 2: + for(j=0;jentries;j++){ + if((sparsemap && b->lengthlist[j]) || !sparsemap){ + float last=0.f; + + for(k=0;kdim;k++){ + float val=b->quantlist[j*b->dim+k]; + val=fabs(val)*delta+mindel+last; + if(b->q_sequencep)last=val; + if(sparsemap) + r[sparsemap[count]*b->dim+k]=val; + else + r[count*b->dim+k]=val; + } + count++; + } + } + break; + } + + return(r); + } + return(NULL); +} + +void vorbis_staticbook_clear(static_codebook *b){ + if(b->allocedp){ + if(b->quantlist)_ogg_free(b->quantlist); + if(b->lengthlist)_ogg_free(b->lengthlist); + if(b->nearest_tree){ + _ogg_free(b->nearest_tree->ptr0); + _ogg_free(b->nearest_tree->ptr1); + _ogg_free(b->nearest_tree->p); + _ogg_free(b->nearest_tree->q); + memset(b->nearest_tree,0,sizeof(*b->nearest_tree)); + _ogg_free(b->nearest_tree); + } + if(b->thresh_tree){ + _ogg_free(b->thresh_tree->quantthresh); + _ogg_free(b->thresh_tree->quantmap); + memset(b->thresh_tree,0,sizeof(*b->thresh_tree)); + _ogg_free(b->thresh_tree); + } + + memset(b,0,sizeof(*b)); + } +} + +void vorbis_staticbook_destroy(static_codebook *b){ + if(b->allocedp){ + vorbis_staticbook_clear(b); + _ogg_free(b); + } +} + +void vorbis_book_clear(codebook *b){ + /* static book is not cleared; we're likely called on the lookup and + the static codebook belongs to the info struct */ + if(b->valuelist)_ogg_free(b->valuelist); + if(b->codelist)_ogg_free(b->codelist); + + if(b->dec_index)_ogg_free(b->dec_index); + if(b->dec_codelengths)_ogg_free(b->dec_codelengths); + if(b->dec_firsttable)_ogg_free(b->dec_firsttable); + + memset(b,0,sizeof(*b)); +} + +int vorbis_book_init_encode(codebook *c,const static_codebook *s){ + + memset(c,0,sizeof(*c)); + c->c=s; + c->entries=s->entries; + c->used_entries=s->entries; + c->dim=s->dim; + c->codelist=_make_words(s->lengthlist,s->entries,0); + c->valuelist=_book_unquantize(s,s->entries,NULL); + + return(0); +} + +static ogg_uint32_t bitreverse(ogg_uint32_t x){ + x= ((x>>16)&0x0000ffffUL) | ((x<<16)&0xffff0000UL); + x= ((x>> 8)&0x00ff00ffUL) | ((x<< 8)&0xff00ff00UL); + x= ((x>> 4)&0x0f0f0f0fUL) | ((x<< 4)&0xf0f0f0f0UL); + x= ((x>> 2)&0x33333333UL) | ((x<< 2)&0xccccccccUL); + return((x>> 1)&0x55555555UL) | ((x<< 1)&0xaaaaaaaaUL); +} + +static int sort32a(const void *a,const void *b){ + return ( **(ogg_uint32_t **)a>**(ogg_uint32_t **)b)- + ( **(ogg_uint32_t **)a<**(ogg_uint32_t **)b); +} + +/* decode codebook arrangement is more heavily optimized than encode */ +int vorbis_book_init_decode(codebook *c,const static_codebook *s){ + int i,j,n=0,tabn; + int *sortindex; + memset(c,0,sizeof(*c)); + + /* count actually used entries */ + for(i=0;ientries;i++) + if(s->lengthlist[i]>0) + n++; + + c->entries=s->entries; + c->used_entries=n; + c->dim=s->dim; + + /* two different remappings go on here. + + First, we collapse the likely sparse codebook down only to + actually represented values/words. This collapsing needs to be + indexed as map-valueless books are used to encode original entry + positions as integers. + + Second, we reorder all vectors, including the entry index above, + by sorted bitreversed codeword to allow treeless decode. */ + + { + /* perform sort */ + ogg_uint32_t *codes=_make_words(s->lengthlist,s->entries,c->used_entries); + ogg_uint32_t **codep=alloca(sizeof(*codep)*n); + + if(codes==NULL)goto err_out; + + for(i=0;icodelist=_ogg_malloc(n*sizeof(*c->codelist)); + /* the index is a reverse index */ + for(i=0;icodelist[sortindex[i]]=codes[i]; + _ogg_free(codes); + } + + c->valuelist=_book_unquantize(s,n,sortindex); + c->dec_index=_ogg_malloc(n*sizeof(*c->dec_index)); + + for(n=0,i=0;ientries;i++) + if(s->lengthlist[i]>0) + c->dec_index[sortindex[n++]]=i; + + c->dec_codelengths=_ogg_malloc(n*sizeof(*c->dec_codelengths)); + for(n=0,i=0;ientries;i++) + if(s->lengthlist[i]>0) + c->dec_codelengths[sortindex[n++]]=s->lengthlist[i]; + + c->dec_firsttablen=_ilog(c->used_entries)-4; /* this is magic */ + if(c->dec_firsttablen<5)c->dec_firsttablen=5; + if(c->dec_firsttablen>8)c->dec_firsttablen=8; + + tabn=1<dec_firsttablen; + c->dec_firsttable=_ogg_calloc(tabn,sizeof(*c->dec_firsttable)); + c->dec_maxlength=0; + + for(i=0;idec_maxlengthdec_codelengths[i]) + c->dec_maxlength=c->dec_codelengths[i]; + if(c->dec_codelengths[i]<=c->dec_firsttablen){ + ogg_uint32_t orig=bitreverse(c->codelist[i]); + for(j=0;j<(1<<(c->dec_firsttablen-c->dec_codelengths[i]));j++) + c->dec_firsttable[orig|(j<dec_codelengths[i])]=i+1; + } + } + + /* now fill in 'unused' entries in the firsttable with hi/lo search + hints for the non-direct-hits */ + { + ogg_uint32_t mask=0xfffffffeUL<<(31-c->dec_firsttablen); + long lo=0,hi=0; + + for(i=0;idec_firsttablen); + if(c->dec_firsttable[bitreverse(word)]==0){ + while((lo+1)codelist[lo+1]<=word)lo++; + while( hi=(c->codelist[hi]&mask))hi++; + + /* we only actually have 15 bits per hint to play with here. + In order to overflow gracefully (nothing breaks, efficiency + just drops), encode as the difference from the extremes. */ + { + unsigned long loval=lo; + unsigned long hival=n-hi; + + if(loval>0x7fff)loval=0x7fff; + if(hival>0x7fff)hival=0x7fff; + c->dec_firsttable[bitreverse(word)]= + 0x80000000UL | (loval<<15) | hival; + } + } + } + } + + + return(0); + err_out: + vorbis_book_clear(c); + return(-1); +} + +static float _dist(int el,float *ref, float *b,int step){ + int i; + float acc=0.f; + for(i=0;ic->thresh_tree; + +#if 0 + encode_aux_nearestmatch *nt=book->c->nearest_tree; + encode_aux_pigeonhole *pt=book->c->pigeon_tree; +#endif + int dim=book->dim; + int k,o; + /*int savebest=-1; + float saverr;*/ + + /* do we have a threshhold encode hint? */ + if(tt){ + int index=0,i; + /* find the quant val of each scalar */ + for(k=0,o=step*(dim-1);kthreshvals>>1; + if(a[o]quantthresh[i]){ + + for(;i>0;i--) + if(a[o]>=tt->quantthresh[i-1]) + break; + + }else{ + + for(i++;ithreshvals-1;i++) + if(a[o]quantthresh[i])break; + + } + + index=(index*tt->quantvals)+tt->quantmap[i]; + } + /* regular lattices are easy :-) */ + if(book->c->lengthlist[index]>0) /* is this unused? If so, we'll + use a decision tree after all + and fall through*/ + return(index); + } + +#if 0 + /* do we have a pigeonhole encode hint? */ + if(pt){ + const static_codebook *c=book->c; + int i,besti=-1; + float best=0.f; + int entry=0; + + /* dealing with sequentialness is a pain in the ass */ + if(c->q_sequencep){ + int pv; + long mul=1; + float qlast=0; + for(k=0,o=0;kmin)/pt->del); + if(pv<0 || pv>=pt->mapentries)break; + entry+=pt->pigeonmap[pv]*mul; + mul*=pt->quantvals; + qlast+=pv*pt->del+pt->min; + } + }else{ + for(k=0,o=step*(dim-1);kmin)/pt->del); + if(pv<0 || pv>=pt->mapentries)break; + entry=entry*pt->quantvals+pt->pigeonmap[pv]; + } + } + + /* must be within the pigeonholable range; if we quant outside (or + in an entry that we define no list for), brute force it */ + if(k==dim && pt->fitlength[entry]){ + /* search the abbreviated list */ + long *list=pt->fitlist+pt->fitmap[entry]; + for(i=0;ifitlength[entry];i++){ + float this=_dist(dim,book->valuelist+list[i]*dim,a,step); + if(besti==-1 || thisvaluelist+nt->p[ptr]; + float *q=book->valuelist+nt->q[ptr]; + + for(k=0,o=0;k0.f) /* in A */ + ptr= -nt->ptr0[ptr]; + else /* in B */ + ptr= -nt->ptr1[ptr]; + if(ptr<=0)break; + } + return(-ptr); + } +#endif + + /* brute force it! */ + { + const static_codebook *c=book->c; + int i,besti=-1; + float best=0.f; + float *e=book->valuelist; + for(i=0;ientries;i++){ + if(c->lengthlist[i]>0){ + float this=_dist(dim,e,a,step); + if(besti==-1 || thisvaluelist+savebest*dim)[i]); + fprintf(stderr,"\n" + "bruteforce (entry %d, err %g):",besti,best); + for(i=0;ivaluelist+besti*dim)[i]); + fprintf(stderr,"\n"); + }*/ + return(besti); + } +} + +long vorbis_book_codeword(codebook *book,int entry){ + if(book->c) /* only use with encode; decode optimizations are + allowed to break this */ + return book->codelist[entry]; + return -1; +} + +long vorbis_book_codelen(codebook *book,int entry){ + if(book->c) /* only use with encode; decode optimizations are + allowed to break this */ + return book->c->lengthlist[entry]; + return -1; +} + +#ifdef _V_SELFTEST + +/* Unit tests of the dequantizer; this stuff will be OK + cross-platform, I simply want to be sure that special mapping cases + actually work properly; a bug could go unnoticed for a while */ + +#include + +/* cases: + + no mapping + full, explicit mapping + algorithmic mapping + + nonsequential + sequential +*/ + +static long full_quantlist1[]={0,1,2,3, 4,5,6,7, 8,3,6,1}; +static long partial_quantlist1[]={0,7,2}; + +/* no mapping */ +static_codebook test1={ + 4,16, + NULL, + 0, + 0,0,0,0, + NULL, + NULL,NULL +}; +static float *test1_result=NULL; + +/* linear, full mapping, nonsequential */ +static_codebook test2={ + 4,3, + NULL, + 2, + -533200896,1611661312,4,0, + full_quantlist1, + NULL,NULL +}; +static float test2_result[]={-3,-2,-1,0, 1,2,3,4, 5,0,3,-2}; + +/* linear, full mapping, sequential */ +static_codebook test3={ + 4,3, + NULL, + 2, + -533200896,1611661312,4,1, + full_quantlist1, + NULL,NULL +}; +static float test3_result[]={-3,-5,-6,-6, 1,3,6,10, 5,5,8,6}; + +/* linear, algorithmic mapping, nonsequential */ +static_codebook test4={ + 3,27, + NULL, + 1, + -533200896,1611661312,4,0, + partial_quantlist1, + NULL,NULL +}; +static float test4_result[]={-3,-3,-3, 4,-3,-3, -1,-3,-3, + -3, 4,-3, 4, 4,-3, -1, 4,-3, + -3,-1,-3, 4,-1,-3, -1,-1,-3, + -3,-3, 4, 4,-3, 4, -1,-3, 4, + -3, 4, 4, 4, 4, 4, -1, 4, 4, + -3,-1, 4, 4,-1, 4, -1,-1, 4, + -3,-3,-1, 4,-3,-1, -1,-3,-1, + -3, 4,-1, 4, 4,-1, -1, 4,-1, + -3,-1,-1, 4,-1,-1, -1,-1,-1}; + +/* linear, algorithmic mapping, sequential */ +static_codebook test5={ + 3,27, + NULL, + 1, + -533200896,1611661312,4,1, + partial_quantlist1, + NULL,NULL +}; +static float test5_result[]={-3,-6,-9, 4, 1,-2, -1,-4,-7, + -3, 1,-2, 4, 8, 5, -1, 3, 0, + -3,-4,-7, 4, 3, 0, -1,-2,-5, + -3,-6,-2, 4, 1, 5, -1,-4, 0, + -3, 1, 5, 4, 8,12, -1, 3, 7, + -3,-4, 0, 4, 3, 7, -1,-2, 2, + -3,-6,-7, 4, 1, 0, -1,-4,-5, + -3, 1, 0, 4, 8, 7, -1, 3, 2, + -3,-4,-5, 4, 3, 2, -1,-2,-3}; + +void run_test(static_codebook *b,float *comp){ + float *out=_book_unquantize(b,b->entries,NULL); + int i; + + if(comp){ + if(!out){ + fprintf(stderr,"_book_unquantize incorrectly returned NULL\n"); + exit(1); + } + + for(i=0;ientries*b->dim;i++) + if(fabs(out[i]-comp[i])>.0001){ + fprintf(stderr,"disagreement in unquantized and reference data:\n" + "position %d, %g != %g\n",i,out[i],comp[i]); + exit(1); + } + + }else{ + if(out){ + fprintf(stderr,"_book_unquantize returned a value array: \n" + " correct result should have been NULL\n"); + exit(1); + } + } +} + +int main(){ + /* run the nine dequant tests, and compare to the hand-rolled results */ + fprintf(stderr,"Dequant test 1... "); + run_test(&test1,test1_result); + fprintf(stderr,"OK\nDequant test 2... "); + run_test(&test2,test2_result); + fprintf(stderr,"OK\nDequant test 3... "); + run_test(&test3,test3_result); + fprintf(stderr,"OK\nDequant test 4... "); + run_test(&test4,test4_result); + fprintf(stderr,"OK\nDequant test 5... "); + run_test(&test5,test5_result); + fprintf(stderr,"OK\n\n"); + + return(0); +} + +#endif diff --git a/Libraries/Vorbis/Files/lib/smallft.c b/Libraries/Vorbis/Files/lib/smallft.c new file mode 100644 index 000000000..c37f23681 --- /dev/null +++ b/Libraries/Vorbis/Files/lib/smallft.c @@ -0,0 +1,1255 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * + * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * + * by the XIPHOPHORUS Company http://www.xiph.org/ * + * * + ******************************************************************** + + function: *unnormalized* fft transform + last mod: $Id$ + + ********************************************************************/ + +/* FFT implementation from OggSquish, minus cosine transforms, + * minus all but radix 2/4 case. In Vorbis we only need this + * cut-down version. + * + * To do more than just power-of-two sized vectors, see the full + * version I wrote for NetLib. + * + * Note that the packing is a little strange; rather than the FFT r/i + * packing following R_0, I_n, R_1, I_1, R_2, I_2 ... R_n-1, I_n-1, + * it follows R_0, R_1, I_1, R_2, I_2 ... R_n-1, I_n-1, I_n like the + * FORTRAN version + */ + +#include +#include +#include +#include "smallft.h" +#include "os.h" +#include "misc.h" + +static void drfti1(int n, float *wa, int *ifac){ + static int ntryh[4] = { 4,2,3,5 }; + static float tpi = 6.28318530717958648f; + float arg,argh,argld,fi; + int ntry=0,i,j=-1; + int k1, l1, l2, ib; + int ld, ii, ip, is, nq, nr; + int ido, ipm, nfm1; + int nl=n; + int nf=0; + + L101: + j++; + if (j < 4) + ntry=ntryh[j]; + else + ntry+=2; + + L104: + nq=nl/ntry; + nr=nl-ntry*nq; + if (nr!=0) goto L101; + + nf++; + ifac[nf+1]=ntry; + nl=nq; + if(ntry!=2)goto L107; + if(nf==1)goto L107; + + for (i=1;i>1; + ipp2=ip; + idp2=ido; + nbd=(ido-1)>>1; + t0=l1*ido; + t10=ip*ido; + + if(ido==1)goto L119; + for(ik=0;ikl1){ + for(j=1;j>1; + ipp2=ip; + ipph=(ip+1)>>1; + if(idol1)goto L139; + + is= -ido-1; + t1=0; + for(j=1;jn==1)return; + drftf1(l->n,data,l->trigcache,l->trigcache+l->n,l->splitcache); +} + +void drft_backward(drft_lookup *l,float *data){ + if (l->n==1)return; + drftb1(l->n,data,l->trigcache,l->trigcache+l->n,l->splitcache); +} + +void drft_init(drft_lookup *l,int n){ + l->n=n; + l->trigcache=_ogg_calloc(3*n,sizeof(*l->trigcache)); + l->splitcache=_ogg_calloc(32,sizeof(*l->splitcache)); + fdrffti(n, l->trigcache, l->splitcache); +} + +void drft_clear(drft_lookup *l){ + if(l){ + if(l->trigcache)_ogg_free(l->trigcache); + if(l->splitcache)_ogg_free(l->splitcache); + memset(l,0,sizeof(*l)); + } +} diff --git a/Libraries/Vorbis/Files/lib/smallft.h b/Libraries/Vorbis/Files/lib/smallft.h new file mode 100644 index 000000000..9c9a597cc --- /dev/null +++ b/Libraries/Vorbis/Files/lib/smallft.h @@ -0,0 +1,34 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * + * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * + * by the XIPHOPHORUS Company http://www.xiph.org/ * + * * + ******************************************************************** + + function: fft transform + last mod: $Id$ + + ********************************************************************/ + +#ifndef _V_SMFT_H_ +#define _V_SMFT_H_ + +#include "vorbis/codec.h" + +typedef struct { + int n; + float *trigcache; + int *splitcache; +} drft_lookup; + +extern void drft_forward(drft_lookup *l,float *data); +extern void drft_backward(drft_lookup *l,float *data); +extern void drft_init(drft_lookup *l,int n); +extern void drft_clear(drft_lookup *l); + +#endif diff --git a/Libraries/Vorbis/Files/lib/synthesis.c b/Libraries/Vorbis/Files/lib/synthesis.c new file mode 100644 index 000000000..e95629357 --- /dev/null +++ b/Libraries/Vorbis/Files/lib/synthesis.c @@ -0,0 +1,170 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * + * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * + * by the XIPHOPHORUS Company http://www.xiph.org/ * + * * + ******************************************************************** + + function: single-block PCM synthesis + last mod: $Id$ + + ********************************************************************/ + +#include +#include +#include "vorbis/codec.h" +#include "codec_internal.h" +#include "registry.h" +#include "misc.h" +#include "os.h" + +int vorbis_synthesis(vorbis_block *vb,ogg_packet *op){ + vorbis_dsp_state *vd=vb->vd; + private_state *b=vd->backend_state; + vorbis_info *vi=vd->vi; + codec_setup_info *ci=vi->codec_setup; + oggpack_buffer *opb=&vb->opb; + int type,mode,i; + + /* first things first. Make sure decode is ready */ + _vorbis_block_ripcord(vb); + oggpack_readinit(opb,op->packet,op->bytes); + + /* Check the packet type */ + if(oggpack_read(opb,1)!=0){ + /* Oops. This is not an audio data packet */ + return(OV_ENOTAUDIO); + } + + /* read our mode and pre/post windowsize */ + mode=oggpack_read(opb,b->modebits); + if(mode==-1)return(OV_EBADPACKET); + + vb->mode=mode; + vb->W=ci->mode_param[mode]->blockflag; + if(vb->W){ + + /* this doesn;t get mapped through mode selection as it's used + only for window selection */ + vb->lW=oggpack_read(opb,1); + vb->nW=oggpack_read(opb,1); + if(vb->nW==-1) return(OV_EBADPACKET); + }else{ + vb->lW=0; + vb->nW=0; + } + + /* more setup */ + vb->granulepos=op->granulepos; + vb->sequence=op->packetno; + vb->eofflag=op->e_o_s; + + /* alloc pcm passback storage */ + vb->pcmend=ci->blocksizes[vb->W]; + vb->pcm=_vorbis_block_alloc(vb,sizeof(*vb->pcm)*vi->channels); + for(i=0;ichannels;i++) + vb->pcm[i]=_vorbis_block_alloc(vb,vb->pcmend*sizeof(*vb->pcm[i])); + + /* unpack_header enforces range checking */ + type=ci->map_type[ci->mode_param[mode]->mapping]; + + return(_mapping_P[type]->inverse(vb,ci->map_param[ci->mode_param[mode]-> + mapping])); +} + +/* used to track pcm position without actually performing decode. + Useful for sequential 'fast forward' */ +int vorbis_synthesis_trackonly(vorbis_block *vb,ogg_packet *op){ + vorbis_dsp_state *vd=vb->vd; + private_state *b=vd->backend_state; + vorbis_info *vi=vd->vi; + codec_setup_info *ci=vi->codec_setup; + oggpack_buffer *opb=&vb->opb; + int mode; + + /* first things first. Make sure decode is ready */ + _vorbis_block_ripcord(vb); + oggpack_readinit(opb,op->packet,op->bytes); + + /* Check the packet type */ + if(oggpack_read(opb,1)!=0){ + /* Oops. This is not an audio data packet */ + return(OV_ENOTAUDIO); + } + + /* read our mode and pre/post windowsize */ + mode=oggpack_read(opb,b->modebits); + if(mode==-1)return(OV_EBADPACKET); + + vb->mode=mode; + vb->W=ci->mode_param[mode]->blockflag; + if(vb->W){ + vb->lW=oggpack_read(opb,1); + vb->nW=oggpack_read(opb,1); + if(vb->nW==-1) return(OV_EBADPACKET); + }else{ + vb->lW=0; + vb->nW=0; + } + + /* more setup */ + vb->granulepos=op->granulepos; + vb->sequence=op->packetno; + vb->eofflag=op->e_o_s; + + /* no pcm */ + vb->pcmend=0; + vb->pcm=NULL; + + return(0); +} + +long vorbis_packet_blocksize(vorbis_info *vi,ogg_packet *op){ + codec_setup_info *ci=vi->codec_setup; + oggpack_buffer opb; + int mode; + + oggpack_readinit(&opb,op->packet,op->bytes); + + /* Check the packet type */ + if(oggpack_read(&opb,1)!=0){ + /* Oops. This is not an audio data packet */ + return(OV_ENOTAUDIO); + } + + { + int modebits=0; + int v=ci->modes; + while(v>1){ + modebits++; + v>>=1; + } + + /* read our mode and pre/post windowsize */ + mode=oggpack_read(&opb,modebits); + } + if(mode==-1)return(OV_EBADPACKET); + return(ci->blocksizes[ci->mode_param[mode]->blockflag]); +} + +int vorbis_synthesis_halfrate(vorbis_info *vi,int flag){ + /* set / clear half-sample-rate mode */ + codec_setup_info *ci=vi->codec_setup; + + /* right now, our MDCT can't handle < 64 sample windows. */ + if(ci->blocksizes[0]<=64 && flag)return -1; + ci->halfrate_flag=(flag?1:0); + return 0; +} + +int vorbis_synthesis_halfrate_p(vorbis_info *vi){ + codec_setup_info *ci=vi->codec_setup; + return ci->halfrate_flag; +} + + diff --git a/Libraries/Vorbis/Files/lib/tone.c b/Libraries/Vorbis/Files/lib/tone.c new file mode 100644 index 000000000..daf2f9313 --- /dev/null +++ b/Libraries/Vorbis/Files/lib/tone.c @@ -0,0 +1,54 @@ +#include +#include +#include +#include + +void usage(){ + fprintf(stderr,"tone ,[] [,[]...]\n"); + exit(1); +} + +int main (int argc,char *argv[]){ + int i,j; + double *f; + double *amp; + + if(argc<2)usage(); + + f=alloca(sizeof(*f)*(argc-1)); + amp=alloca(sizeof(*amp)*(argc-1)); + + i=0; + while(argv[i+1]){ + char *pos=strchr(argv[i+1],','); + + f[i]=atof(argv[i+1]); + if(pos) + amp[i]=atof(pos+1)*32767.f; + else + amp[i]=32767.f; + + fprintf(stderr,"%g Hz, %g amp\n",f[i],amp[i]); + + i++; + } + + for(i=0;i<44100*10;i++){ + float val=0; + int ival; + for(j=0;j32767.f)ival=32767.f; + if(ival<-32768.f)ival=-32768.f; + + fprintf(stdout,"%c%c%c%c", + (char)(ival&0xff), + (char)((ival>>8)&0xff), + (char)(ival&0xff), + (char)((ival>>8)&0xff)); + } + return(0); +} + diff --git a/Libraries/Vorbis/Files/lib/vorbisenc.c b/Libraries/Vorbis/Files/lib/vorbisenc.c new file mode 100644 index 000000000..1208cd17b --- /dev/null +++ b/Libraries/Vorbis/Files/lib/vorbisenc.c @@ -0,0 +1,1184 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * + * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * + * by the XIPHOPHORUS Company http://www.xiph.org/ * + * * + ******************************************************************** + + function: simple programmatic interface for encoder mode setup + last mod: $Id$ + + ********************************************************************/ + +#include +#include +#include + +#include "vorbis/codec.h" +#include "vorbis/vorbisenc.h" + +#include "codec_internal.h" + +#include "os.h" +#include "misc.h" + +/* careful with this; it's using static array sizing to make managing + all the modes a little less annoying. If we use a residue backend + with > 12 partition types, or a different division of iteration, + this needs to be updated. */ +typedef struct { + static_codebook *books[12][3]; +} static_bookblock; + +typedef struct { + int res_type; + int limit_type; /* 0 lowpass limited, 1 point stereo limited */ + vorbis_info_residue0 *res; + static_codebook *book_aux; + static_codebook *book_aux_managed; + static_bookblock *books_base; + static_bookblock *books_base_managed; +} vorbis_residue_template; + +typedef struct { + vorbis_info_mapping0 *map; + vorbis_residue_template *res; +} vorbis_mapping_template; + +typedef struct vp_adjblock{ + int block[P_BANDS]; +} vp_adjblock; + +typedef struct { + int data[NOISE_COMPAND_LEVELS]; +} compandblock; + +/* high level configuration information for setting things up + step-by-step with the detailed vorbis_encode_ctl interface. + There's a fair amount of redundancy such that interactive setup + does not directly deal with any vorbis_info or codec_setup_info + initialization; it's all stored (until full init) in this highlevel + setup, then flushed out to the real codec setup structs later. */ + +typedef struct { + int att[P_NOISECURVES]; + float boost; + float decay; +} att3; +typedef struct { int data[P_NOISECURVES]; } adj3; + +typedef struct { + int pre[PACKETBLOBS]; + int post[PACKETBLOBS]; + float kHz[PACKETBLOBS]; + float lowpasskHz[PACKETBLOBS]; +} adj_stereo; + +typedef struct { + int lo; + int hi; + int fixed; +} noiseguard; +typedef struct { + int data[P_NOISECURVES][17]; +} noise3; + +typedef struct { + int mappings; + double *rate_mapping; + double *quality_mapping; + int coupling_restriction; + long samplerate_min_restriction; + long samplerate_max_restriction; + + + int *blocksize_short; + int *blocksize_long; + + att3 *psy_tone_masteratt; + int *psy_tone_0dB; + int *psy_tone_dBsuppress; + + vp_adjblock *psy_tone_adj_impulse; + vp_adjblock *psy_tone_adj_long; + vp_adjblock *psy_tone_adj_other; + + noiseguard *psy_noiseguards; + noise3 *psy_noise_bias_impulse; + noise3 *psy_noise_bias_padding; + noise3 *psy_noise_bias_trans; + noise3 *psy_noise_bias_long; + int *psy_noise_dBsuppress; + + compandblock *psy_noise_compand; + double *psy_noise_compand_short_mapping; + double *psy_noise_compand_long_mapping; + + int *psy_noise_normal_start[2]; + int *psy_noise_normal_partition[2]; + double *psy_noise_normal_thresh; + + int *psy_ath_float; + int *psy_ath_abs; + + double *psy_lowpass; + + vorbis_info_psy_global *global_params; + double *global_mapping; + adj_stereo *stereo_modes; + + static_codebook ***floor_books; + vorbis_info_floor1 *floor_params; + int *floor_short_mapping; + int *floor_long_mapping; + + vorbis_mapping_template *maps; +} ve_setup_data_template; + +/* a few static coder conventions */ +static vorbis_info_mode _mode_template[2]={ + {0,0,0,0}, + {1,0,0,1} +}; + +static vorbis_info_mapping0 _map_nominal[2]={ + {1, {0,0}, {0}, {0}, 1,{0},{1}}, + {1, {0,0}, {1}, {1}, 1,{0},{1}} +}; + +#include "modes/setup_44.h" +#include "modes/setup_44u.h" +#include "modes/setup_32.h" +#include "modes/setup_8.h" +#include "modes/setup_11.h" +#include "modes/setup_16.h" +#include "modes/setup_22.h" +#include "modes/setup_X.h" + +static ve_setup_data_template *setup_list[]={ + &ve_setup_44_stereo, + &ve_setup_44_uncoupled, + + &ve_setup_32_stereo, + &ve_setup_32_uncoupled, + + &ve_setup_22_stereo, + &ve_setup_22_uncoupled, + &ve_setup_16_stereo, + &ve_setup_16_uncoupled, + + &ve_setup_11_stereo, + &ve_setup_11_uncoupled, + &ve_setup_8_stereo, + &ve_setup_8_uncoupled, + + &ve_setup_X_stereo, + &ve_setup_X_uncoupled, + &ve_setup_XX_stereo, + &ve_setup_XX_uncoupled, + 0 +}; + +static int vorbis_encode_toplevel_setup(vorbis_info *vi,int ch,long rate){ + if(vi && vi->codec_setup){ + + vi->version=0; + vi->channels=ch; + vi->rate=rate; + + return(0); + } + return(OV_EINVAL); +} + +static void vorbis_encode_floor_setup(vorbis_info *vi,double s,int block, + static_codebook ***books, + vorbis_info_floor1 *in, + int *x){ + int i,k,is=s; + vorbis_info_floor1 *f=_ogg_calloc(1,sizeof(*f)); + codec_setup_info *ci=vi->codec_setup; + + memcpy(f,in+x[is],sizeof(*f)); + /* fill in the lowpass field, even if it's temporary */ + f->n=ci->blocksizes[block]>>1; + + /* books */ + { + int partitions=f->partitions; + int maxclass=-1; + int maxbook=-1; + for(i=0;ipartitionclass[i]>maxclass)maxclass=f->partitionclass[i]; + for(i=0;i<=maxclass;i++){ + if(f->class_book[i]>maxbook)maxbook=f->class_book[i]; + f->class_book[i]+=ci->books; + for(k=0;k<(1<class_subs[i]);k++){ + if(f->class_subbook[i][k]>maxbook)maxbook=f->class_subbook[i][k]; + if(f->class_subbook[i][k]>=0)f->class_subbook[i][k]+=ci->books; + } + } + + for(i=0;i<=maxbook;i++) + ci->book_param[ci->books++]=books[x[is]][i]; + } + + /* for now, we're only using floor 1 */ + ci->floor_type[ci->floors]=1; + ci->floor_param[ci->floors]=f; + ci->floors++; + + return; +} + +static void vorbis_encode_global_psych_setup(vorbis_info *vi,double s, + vorbis_info_psy_global *in, + double *x){ + int i,is=s; + double ds=s-is; + codec_setup_info *ci=vi->codec_setup; + vorbis_info_psy_global *g=&ci->psy_g_param; + + memcpy(g,in+(int)x[is],sizeof(*g)); + + ds=x[is]*(1.-ds)+x[is+1]*ds; + is=(int)ds; + ds-=is; + if(ds==0 && is>0){ + is--; + ds=1.; + } + + /* interpolate the trigger threshholds */ + for(i=0;i<4;i++){ + g->preecho_thresh[i]=in[is].preecho_thresh[i]*(1.-ds)+in[is+1].preecho_thresh[i]*ds; + g->postecho_thresh[i]=in[is].postecho_thresh[i]*(1.-ds)+in[is+1].postecho_thresh[i]*ds; + } + g->ampmax_att_per_sec=ci->hi.amplitude_track_dBpersec; + return; +} + +static void vorbis_encode_global_stereo(vorbis_info *vi, + highlevel_encode_setup *hi, + adj_stereo *p){ + float s=hi->stereo_point_setting; + int i,is=s; + double ds=s-is; + codec_setup_info *ci=vi->codec_setup; + vorbis_info_psy_global *g=&ci->psy_g_param; + + if(p){ + memcpy(g->coupling_prepointamp,p[is].pre,sizeof(*p[is].pre)*PACKETBLOBS); + memcpy(g->coupling_postpointamp,p[is].post,sizeof(*p[is].post)*PACKETBLOBS); + + if(hi->managed){ + /* interpolate the kHz threshholds */ + for(i=0;icoupling_pointlimit[0][i]=kHz*1000./vi->rate*ci->blocksizes[0]; + g->coupling_pointlimit[1][i]=kHz*1000./vi->rate*ci->blocksizes[1]; + g->coupling_pkHz[i]=kHz; + + kHz=p[is].lowpasskHz[i]*(1.-ds)+p[is+1].lowpasskHz[i]*ds; + g->sliding_lowpass[0][i]=kHz*1000./vi->rate*ci->blocksizes[0]; + g->sliding_lowpass[1][i]=kHz*1000./vi->rate*ci->blocksizes[1]; + + } + }else{ + float kHz=p[is].kHz[PACKETBLOBS/2]*(1.-ds)+p[is+1].kHz[PACKETBLOBS/2]*ds; + for(i=0;icoupling_pointlimit[0][i]=kHz*1000./vi->rate*ci->blocksizes[0]; + g->coupling_pointlimit[1][i]=kHz*1000./vi->rate*ci->blocksizes[1]; + g->coupling_pkHz[i]=kHz; + } + + kHz=p[is].lowpasskHz[PACKETBLOBS/2]*(1.-ds)+p[is+1].lowpasskHz[PACKETBLOBS/2]*ds; + for(i=0;isliding_lowpass[0][i]=kHz*1000./vi->rate*ci->blocksizes[0]; + g->sliding_lowpass[1][i]=kHz*1000./vi->rate*ci->blocksizes[1]; + } + } + }else{ + for(i=0;isliding_lowpass[0][i]=ci->blocksizes[0]; + g->sliding_lowpass[1][i]=ci->blocksizes[1]; + } + } + return; +} + +static void vorbis_encode_psyset_setup(vorbis_info *vi,double s, + int *nn_start, + int *nn_partition, + double *nn_thresh, + int block){ + codec_setup_info *ci=vi->codec_setup; + vorbis_info_psy *p=ci->psy_param[block]; + highlevel_encode_setup *hi=&ci->hi; + int is=s; + + if(block>=ci->psys) + ci->psys=block+1; + if(!p){ + p=_ogg_calloc(1,sizeof(*p)); + ci->psy_param[block]=p; + } + + memcpy(p,&_psy_info_template,sizeof(*p)); + p->blockflag=block>>1; + + if(hi->noise_normalize_p){ + p->normal_channel_p=1; + p->normal_point_p=1; + p->normal_start=nn_start[is]; + p->normal_partition=nn_partition[is]; + p->normal_thresh=nn_thresh[is]; + } + + return; +} + +static void vorbis_encode_tonemask_setup(vorbis_info *vi,double s,int block, + att3 *att, + int *max, + vp_adjblock *in){ + int i,is=s; + double ds=s-is; + codec_setup_info *ci=vi->codec_setup; + vorbis_info_psy *p=ci->psy_param[block]; + + /* 0 and 2 are only used by bitmanagement, but there's no harm to always + filling the values in here */ + p->tone_masteratt[0]=att[is].att[0]*(1.-ds)+att[is+1].att[0]*ds; + p->tone_masteratt[1]=att[is].att[1]*(1.-ds)+att[is+1].att[1]*ds; + p->tone_masteratt[2]=att[is].att[2]*(1.-ds)+att[is+1].att[2]*ds; + p->tone_centerboost=att[is].boost*(1.-ds)+att[is+1].boost*ds; + p->tone_decay=att[is].decay*(1.-ds)+att[is+1].decay*ds; + + p->max_curve_dB=max[is]*(1.-ds)+max[is+1]*ds; + + for(i=0;itoneatt[i]=in[is].block[i]*(1.-ds)+in[is+1].block[i]*ds; + return; +} + + +static void vorbis_encode_compand_setup(vorbis_info *vi,double s,int block, + compandblock *in, double *x){ + int i,is=s; + double ds=s-is; + codec_setup_info *ci=vi->codec_setup; + vorbis_info_psy *p=ci->psy_param[block]; + + ds=x[is]*(1.-ds)+x[is+1]*ds; + is=(int)ds; + ds-=is; + if(ds==0 && is>0){ + is--; + ds=1.; + } + + /* interpolate the compander settings */ + for(i=0;inoisecompand[i]=in[is].data[i]*(1.-ds)+in[is+1].data[i]*ds; + return; +} + +static void vorbis_encode_peak_setup(vorbis_info *vi,double s,int block, + int *suppress){ + int is=s; + double ds=s-is; + codec_setup_info *ci=vi->codec_setup; + vorbis_info_psy *p=ci->psy_param[block]; + + p->tone_abs_limit=suppress[is]*(1.-ds)+suppress[is+1]*ds; + + return; +} + +static void vorbis_encode_noisebias_setup(vorbis_info *vi,double s,int block, + int *suppress, + noise3 *in, + noiseguard *guard, + double userbias){ + int i,is=s,j; + double ds=s-is; + codec_setup_info *ci=vi->codec_setup; + vorbis_info_psy *p=ci->psy_param[block]; + + p->noisemaxsupp=suppress[is]*(1.-ds)+suppress[is+1]*ds; + p->noisewindowlomin=guard[block].lo; + p->noisewindowhimin=guard[block].hi; + p->noisewindowfixed=guard[block].fixed; + + for(j=0;jnoiseoff[j][i]=in[is].data[j][i]*(1.-ds)+in[is+1].data[j][i]*ds; + + /* impulse blocks may take a user specified bias to boost the + nominal/high noise encoding depth */ + for(j=0;jnoiseoff[j][0]+6; /* the lowest it can go */ + for(i=0;inoiseoff[j][i]+=userbias; + if(p->noiseoff[j][i]noiseoff[j][i]=min; + } + } + + return; +} + +static void vorbis_encode_ath_setup(vorbis_info *vi,int block){ + codec_setup_info *ci=vi->codec_setup; + vorbis_info_psy *p=ci->psy_param[block]; + + p->ath_adjatt=ci->hi.ath_floating_dB; + p->ath_maxatt=ci->hi.ath_absolute_dB; + return; +} + + +static int book_dup_or_new(codec_setup_info *ci,static_codebook *book){ + int i; + for(i=0;ibooks;i++) + if(ci->book_param[i]==book)return(i); + + return(ci->books++); +} + +static void vorbis_encode_blocksize_setup(vorbis_info *vi,double s, + int *shortb,int *longb){ + + codec_setup_info *ci=vi->codec_setup; + int is=s; + + int blockshort=shortb[is]; + int blocklong=longb[is]; + ci->blocksizes[0]=blockshort; + ci->blocksizes[1]=blocklong; + +} + +static void vorbis_encode_residue_setup(vorbis_info *vi, + int number, int block, + vorbis_residue_template *res){ + + codec_setup_info *ci=vi->codec_setup; + int i,n; + + vorbis_info_residue0 *r=ci->residue_param[number]= + _ogg_malloc(sizeof(*r)); + + memcpy(r,res->res,sizeof(*r)); + if(ci->residues<=number)ci->residues=number+1; + + switch(ci->blocksizes[block]){ + case 64:case 128:case 256: + r->grouping=16; + break; + default: + r->grouping=32; + break; + } + ci->residue_type[number]=res->res_type; + + /* to be adjusted by lowpass/pointlimit later */ + n=r->end=ci->blocksizes[block]>>1; + if(res->res_type==2) + n=r->end*=vi->channels; + + /* fill in all the books */ + { + int booklist=0,k; + + if(ci->hi.managed){ + for(i=0;ipartitions;i++) + for(k=0;k<3;k++) + if(res->books_base_managed->books[i][k]) + r->secondstages[i]|=(1<groupbook=book_dup_or_new(ci,res->book_aux_managed); + ci->book_param[r->groupbook]=res->book_aux_managed; + + for(i=0;ipartitions;i++){ + for(k=0;k<3;k++){ + if(res->books_base_managed->books[i][k]){ + int bookid=book_dup_or_new(ci,res->books_base_managed->books[i][k]); + r->booklist[booklist++]=bookid; + ci->book_param[bookid]=res->books_base_managed->books[i][k]; + } + } + } + + }else{ + + for(i=0;ipartitions;i++) + for(k=0;k<3;k++) + if(res->books_base->books[i][k]) + r->secondstages[i]|=(1<groupbook=book_dup_or_new(ci,res->book_aux); + ci->book_param[r->groupbook]=res->book_aux; + + for(i=0;ipartitions;i++){ + for(k=0;k<3;k++){ + if(res->books_base->books[i][k]){ + int bookid=book_dup_or_new(ci,res->books_base->books[i][k]); + r->booklist[booklist++]=bookid; + ci->book_param[bookid]=res->books_base->books[i][k]; + } + } + } + } + } + + /* lowpass setup/pointlimit */ + { + double freq=ci->hi.lowpass_kHz*1000.; + vorbis_info_floor1 *f=ci->floor_param[block]; /* by convention */ + double nyq=vi->rate/2.; + long blocksize=ci->blocksizes[block]>>1; + + /* lowpass needs to be set in the floor and the residue. */ + if(freq>nyq)freq=nyq; + /* in the floor, the granularity can be very fine; it doesn't alter + the encoding structure, only the samples used to fit the floor + approximation */ + f->n=freq/nyq*blocksize; + + /* this res may by limited by the maximum pointlimit of the mode, + not the lowpass. the floor is always lowpass limited. */ + if(res->limit_type){ + if(ci->hi.managed) + freq=ci->psy_g_param.coupling_pkHz[PACKETBLOBS-1]*1000.; + else + freq=ci->psy_g_param.coupling_pkHz[PACKETBLOBS/2]*1000.; + if(freq>nyq)freq=nyq; + } + + /* in the residue, we're constrained, physically, by partition + boundaries. We still lowpass 'wherever', but we have to round up + here to next boundary, or the vorbis spec will round it *down* to + previous boundary in encode/decode */ + if(ci->residue_type[block]==2) + r->end=(int)((freq/nyq*blocksize*2)/r->grouping+.9)* /* round up only if we're well past */ + r->grouping; + else + r->end=(int)((freq/nyq*blocksize)/r->grouping+.9)* /* round up only if we're well past */ + r->grouping; + } +} + +/* we assume two maps in this encoder */ +static void vorbis_encode_map_n_res_setup(vorbis_info *vi,double s, + vorbis_mapping_template *maps){ + + codec_setup_info *ci=vi->codec_setup; + int i,j,is=s,modes=2; + vorbis_info_mapping0 *map=maps[is].map; + vorbis_info_mode *mode=_mode_template; + vorbis_residue_template *res=maps[is].res; + + if(ci->blocksizes[0]==ci->blocksizes[1])modes=1; + + for(i=0;imap_param[i]=_ogg_calloc(1,sizeof(*map)); + ci->mode_param[i]=_ogg_calloc(1,sizeof(*mode)); + + memcpy(ci->mode_param[i],mode+i,sizeof(*_mode_template)); + if(i>=ci->modes)ci->modes=i+1; + + ci->map_type[i]=0; + memcpy(ci->map_param[i],map+i,sizeof(*map)); + if(i>=ci->maps)ci->maps=i+1; + + for(j=0;jcodec_setup; + highlevel_encode_setup *hi=&ci->hi; + ve_setup_data_template *setup=(ve_setup_data_template *)hi->setup; + int is=hi->base_setting; + double ds=hi->base_setting-is; + int ch=vi->channels; + double *r=setup->rate_mapping; + + if(r==NULL) + return(-1); + + return((r[is]*(1.-ds)+r[is+1]*ds)*ch); +} + +static void get_setup_template(vorbis_info *vi, + long ch,long srate, + double req,int q_or_bitrate){ + int i=0,j; + codec_setup_info *ci=vi->codec_setup; + highlevel_encode_setup *hi=&ci->hi; + if(q_or_bitrate)req/=ch; + + while(setup_list[i]){ + if(setup_list[i]->coupling_restriction==-1 || + setup_list[i]->coupling_restriction==ch){ + if(srate>=setup_list[i]->samplerate_min_restriction && + srate<=setup_list[i]->samplerate_max_restriction){ + int mappings=setup_list[i]->mappings; + double *map=(q_or_bitrate? + setup_list[i]->rate_mapping: + setup_list[i]->quality_mapping); + + /* the template matches. Does the requested quality mode + fall within this template's modes? */ + if(reqmap[setup_list[i]->mappings]){++i;continue;} + for(j=0;j=map[j] && reqsetup=setup_list[i]; + if(j==mappings) + hi->base_setting=j-.001; + else{ + float low=map[j]; + float high=map[j+1]; + float del=(req-low)/(high-low); + hi->base_setting=j+del; + } + + return; + } + } + i++; + } + + hi->setup=NULL; +} + +/* encoders will need to use vorbis_info_init beforehand and call + vorbis_info clear when all done */ + +/* two interfaces; this, more detailed one, and later a convenience + layer on top */ + +/* the final setup call */ +int vorbis_encode_setup_init(vorbis_info *vi){ + int i0=0,singleblock=0; + codec_setup_info *ci=vi->codec_setup; + ve_setup_data_template *setup=NULL; + highlevel_encode_setup *hi=&ci->hi; + + if(ci==NULL)return(OV_EINVAL); + if(!hi->impulse_block_p)i0=1; + + /* too low/high an ATH floater is nonsensical, but doesn't break anything */ + if(hi->ath_floating_dB>-80)hi->ath_floating_dB=-80; + if(hi->ath_floating_dB<-200)hi->ath_floating_dB=-200; + + /* again, bound this to avoid the app shooting itself int he foot + too badly */ + if(hi->amplitude_track_dBpersec>0.)hi->amplitude_track_dBpersec=0.; + if(hi->amplitude_track_dBpersec<-99999.)hi->amplitude_track_dBpersec=-99999.; + + /* get the appropriate setup template; matches the fetch in previous + stages */ + setup=(ve_setup_data_template *)hi->setup; + if(setup==NULL)return(OV_EINVAL); + + hi->set_in_stone=1; + /* choose block sizes from configured sizes as well as paying + attention to long_block_p and short_block_p. If the configured + short and long blocks are the same length, we set long_block_p + and unset short_block_p */ + vorbis_encode_blocksize_setup(vi,hi->base_setting, + setup->blocksize_short, + setup->blocksize_long); + if(ci->blocksizes[0]==ci->blocksizes[1])singleblock=1; + + /* floor setup; choose proper floor params. Allocated on the floor + stack in order; if we alloc only long floor, it's 0 */ + vorbis_encode_floor_setup(vi,hi->short_setting,0, + setup->floor_books, + setup->floor_params, + setup->floor_short_mapping); + if(!singleblock) + vorbis_encode_floor_setup(vi,hi->long_setting,1, + setup->floor_books, + setup->floor_params, + setup->floor_long_mapping); + + /* setup of [mostly] short block detection and stereo*/ + vorbis_encode_global_psych_setup(vi,hi->trigger_setting, + setup->global_params, + setup->global_mapping); + vorbis_encode_global_stereo(vi,hi,setup->stereo_modes); + + /* basic psych setup and noise normalization */ + vorbis_encode_psyset_setup(vi,hi->short_setting, + setup->psy_noise_normal_start[0], + setup->psy_noise_normal_partition[0], + setup->psy_noise_normal_thresh, + 0); + vorbis_encode_psyset_setup(vi,hi->short_setting, + setup->psy_noise_normal_start[0], + setup->psy_noise_normal_partition[0], + setup->psy_noise_normal_thresh, + 1); + if(!singleblock){ + vorbis_encode_psyset_setup(vi,hi->long_setting, + setup->psy_noise_normal_start[1], + setup->psy_noise_normal_partition[1], + setup->psy_noise_normal_thresh, + 2); + vorbis_encode_psyset_setup(vi,hi->long_setting, + setup->psy_noise_normal_start[1], + setup->psy_noise_normal_partition[1], + setup->psy_noise_normal_thresh, + 3); + } + + /* tone masking setup */ + vorbis_encode_tonemask_setup(vi,hi->block[i0].tone_mask_setting,0, + setup->psy_tone_masteratt, + setup->psy_tone_0dB, + setup->psy_tone_adj_impulse); + vorbis_encode_tonemask_setup(vi,hi->block[1].tone_mask_setting,1, + setup->psy_tone_masteratt, + setup->psy_tone_0dB, + setup->psy_tone_adj_other); + if(!singleblock){ + vorbis_encode_tonemask_setup(vi,hi->block[2].tone_mask_setting,2, + setup->psy_tone_masteratt, + setup->psy_tone_0dB, + setup->psy_tone_adj_other); + vorbis_encode_tonemask_setup(vi,hi->block[3].tone_mask_setting,3, + setup->psy_tone_masteratt, + setup->psy_tone_0dB, + setup->psy_tone_adj_long); + } + + /* noise companding setup */ + vorbis_encode_compand_setup(vi,hi->block[i0].noise_compand_setting,0, + setup->psy_noise_compand, + setup->psy_noise_compand_short_mapping); + vorbis_encode_compand_setup(vi,hi->block[1].noise_compand_setting,1, + setup->psy_noise_compand, + setup->psy_noise_compand_short_mapping); + if(!singleblock){ + vorbis_encode_compand_setup(vi,hi->block[2].noise_compand_setting,2, + setup->psy_noise_compand, + setup->psy_noise_compand_long_mapping); + vorbis_encode_compand_setup(vi,hi->block[3].noise_compand_setting,3, + setup->psy_noise_compand, + setup->psy_noise_compand_long_mapping); + } + + /* peak guarding setup */ + vorbis_encode_peak_setup(vi,hi->block[i0].tone_peaklimit_setting,0, + setup->psy_tone_dBsuppress); + vorbis_encode_peak_setup(vi,hi->block[1].tone_peaklimit_setting,1, + setup->psy_tone_dBsuppress); + if(!singleblock){ + vorbis_encode_peak_setup(vi,hi->block[2].tone_peaklimit_setting,2, + setup->psy_tone_dBsuppress); + vorbis_encode_peak_setup(vi,hi->block[3].tone_peaklimit_setting,3, + setup->psy_tone_dBsuppress); + } + + /* noise bias setup */ + vorbis_encode_noisebias_setup(vi,hi->block[i0].noise_bias_setting,0, + setup->psy_noise_dBsuppress, + setup->psy_noise_bias_impulse, + setup->psy_noiseguards, + (i0==0?hi->impulse_noisetune:0.)); + vorbis_encode_noisebias_setup(vi,hi->block[1].noise_bias_setting,1, + setup->psy_noise_dBsuppress, + setup->psy_noise_bias_padding, + setup->psy_noiseguards,0.); + if(!singleblock){ + vorbis_encode_noisebias_setup(vi,hi->block[2].noise_bias_setting,2, + setup->psy_noise_dBsuppress, + setup->psy_noise_bias_trans, + setup->psy_noiseguards,0.); + vorbis_encode_noisebias_setup(vi,hi->block[3].noise_bias_setting,3, + setup->psy_noise_dBsuppress, + setup->psy_noise_bias_long, + setup->psy_noiseguards,0.); + } + + vorbis_encode_ath_setup(vi,0); + vorbis_encode_ath_setup(vi,1); + if(!singleblock){ + vorbis_encode_ath_setup(vi,2); + vorbis_encode_ath_setup(vi,3); + } + + vorbis_encode_map_n_res_setup(vi,hi->base_setting,setup->maps); + + /* set bitrate readonlies and management */ + if(hi->bitrate_av>0) + vi->bitrate_nominal=hi->bitrate_av; + else{ + vi->bitrate_nominal=setting_to_approx_bitrate(vi); + } + + vi->bitrate_lower=hi->bitrate_min; + vi->bitrate_upper=hi->bitrate_max; + if(hi->bitrate_av) + vi->bitrate_window=(double)hi->bitrate_reservoir/hi->bitrate_av; + else + vi->bitrate_window=0.; + + if(hi->managed){ + ci->bi.avg_rate=hi->bitrate_av; + ci->bi.min_rate=hi->bitrate_min; + ci->bi.max_rate=hi->bitrate_max; + + ci->bi.reservoir_bits=hi->bitrate_reservoir; + ci->bi.reservoir_bias= + hi->bitrate_reservoir_bias; + + ci->bi.slew_damp=hi->bitrate_av_damp; + + } + + return(0); + +} + +static int vorbis_encode_setup_setting(vorbis_info *vi, + long channels, + long rate){ + int ret=0,i,is; + codec_setup_info *ci=vi->codec_setup; + highlevel_encode_setup *hi=&ci->hi; + ve_setup_data_template *setup=hi->setup; + double ds; + + ret=vorbis_encode_toplevel_setup(vi,channels,rate); + if(ret)return(ret); + + is=hi->base_setting; + ds=hi->base_setting-is; + + hi->short_setting=hi->base_setting; + hi->long_setting=hi->base_setting; + + hi->managed=0; + + hi->impulse_block_p=1; + hi->noise_normalize_p=1; + + hi->stereo_point_setting=hi->base_setting; + hi->lowpass_kHz= + setup->psy_lowpass[is]*(1.-ds)+setup->psy_lowpass[is+1]*ds; + + hi->ath_floating_dB=setup->psy_ath_float[is]*(1.-ds)+ + setup->psy_ath_float[is+1]*ds; + hi->ath_absolute_dB=setup->psy_ath_abs[is]*(1.-ds)+ + setup->psy_ath_abs[is+1]*ds; + + hi->amplitude_track_dBpersec=-6.; + hi->trigger_setting=hi->base_setting; + + for(i=0;i<4;i++){ + hi->block[i].tone_mask_setting=hi->base_setting; + hi->block[i].tone_peaklimit_setting=hi->base_setting; + hi->block[i].noise_bias_setting=hi->base_setting; + hi->block[i].noise_compand_setting=hi->base_setting; + } + + return(ret); +} + +int vorbis_encode_setup_vbr(vorbis_info *vi, + long channels, + long rate, + float quality){ + codec_setup_info *ci=vi->codec_setup; + highlevel_encode_setup *hi=&ci->hi; + + quality+=.0000001; + if(quality>=1.)quality=.9999; + + get_setup_template(vi,channels,rate,quality,0); + if(!hi->setup)return OV_EIMPL; + + return vorbis_encode_setup_setting(vi,channels,rate); +} + +int vorbis_encode_init_vbr(vorbis_info *vi, + long channels, + long rate, + + float base_quality /* 0. to 1. */ + ){ + int ret=0; + + ret=vorbis_encode_setup_vbr(vi,channels,rate,base_quality); + + if(ret){ + vorbis_info_clear(vi); + return ret; + } + ret=vorbis_encode_setup_init(vi); + if(ret) + vorbis_info_clear(vi); + return(ret); +} + +int vorbis_encode_setup_managed(vorbis_info *vi, + long channels, + long rate, + + long max_bitrate, + long nominal_bitrate, + long min_bitrate){ + + codec_setup_info *ci=vi->codec_setup; + highlevel_encode_setup *hi=&ci->hi; + double tnominal=nominal_bitrate; + int ret=0; + + if(nominal_bitrate<=0.){ + if(max_bitrate>0.){ + if(min_bitrate>0.) + nominal_bitrate=(max_bitrate+min_bitrate)*.5; + else + nominal_bitrate=max_bitrate*.875; + }else{ + if(min_bitrate>0.){ + nominal_bitrate=min_bitrate; + }else{ + return(OV_EINVAL); + } + } + } + + get_setup_template(vi,channels,rate,nominal_bitrate,1); + if(!hi->setup)return OV_EIMPL; + + ret=vorbis_encode_setup_setting(vi,channels,rate); + if(ret){ + vorbis_info_clear(vi); + return ret; + } + + /* initialize management with sane defaults */ + hi->managed=1; + hi->bitrate_min=min_bitrate; + hi->bitrate_max=max_bitrate; + hi->bitrate_av=tnominal; + hi->bitrate_av_damp=1.5f; /* full range in no less than 1.5 second */ + hi->bitrate_reservoir=nominal_bitrate*2; + hi->bitrate_reservoir_bias=.1; /* bias toward hoarding bits */ + + return(ret); + +} + +int vorbis_encode_init(vorbis_info *vi, + long channels, + long rate, + + long max_bitrate, + long nominal_bitrate, + long min_bitrate){ + + int ret=vorbis_encode_setup_managed(vi,channels,rate, + max_bitrate, + nominal_bitrate, + min_bitrate); + if(ret){ + vorbis_info_clear(vi); + return(ret); + } + + ret=vorbis_encode_setup_init(vi); + if(ret) + vorbis_info_clear(vi); + return(ret); +} + +int vorbis_encode_ctl(vorbis_info *vi,int number,void *arg){ + if(vi){ + codec_setup_info *ci=vi->codec_setup; + highlevel_encode_setup *hi=&ci->hi; + int setp=(number&0xf); /* a read request has a low nibble of 0 */ + + if(setp && hi->set_in_stone)return(OV_EINVAL); + + switch(number){ + + /* now deprecated *****************/ + case OV_ECTL_RATEMANAGE_GET: + { + + struct ovectl_ratemanage_arg *ai= + (struct ovectl_ratemanage_arg *)arg; + + ai->management_active=hi->managed; + ai->bitrate_hard_window=ai->bitrate_av_window= + (double)hi->bitrate_reservoir/vi->rate; + ai->bitrate_av_window_center=1.; + ai->bitrate_hard_min=hi->bitrate_min; + ai->bitrate_hard_max=hi->bitrate_max; + ai->bitrate_av_lo=hi->bitrate_av; + ai->bitrate_av_hi=hi->bitrate_av; + + } + return(0); + + /* now deprecated *****************/ + case OV_ECTL_RATEMANAGE_SET: + { + struct ovectl_ratemanage_arg *ai= + (struct ovectl_ratemanage_arg *)arg; + if(ai==NULL){ + hi->managed=0; + }else{ + hi->managed=ai->management_active; + vorbis_encode_ctl(vi,OV_ECTL_RATEMANAGE_AVG,arg); + vorbis_encode_ctl(vi,OV_ECTL_RATEMANAGE_HARD,arg); + } + } + return 0; + + /* now deprecated *****************/ + case OV_ECTL_RATEMANAGE_AVG: + { + struct ovectl_ratemanage_arg *ai= + (struct ovectl_ratemanage_arg *)arg; + if(ai==NULL){ + hi->bitrate_av=0; + }else{ + hi->bitrate_av=(ai->bitrate_av_lo+ai->bitrate_av_hi)*.5; + } + } + return(0); + /* now deprecated *****************/ + case OV_ECTL_RATEMANAGE_HARD: + { + struct ovectl_ratemanage_arg *ai= + (struct ovectl_ratemanage_arg *)arg; + if(ai==NULL){ + hi->bitrate_min=0; + hi->bitrate_max=0; + }else{ + hi->bitrate_min=ai->bitrate_hard_min; + hi->bitrate_max=ai->bitrate_hard_max; + hi->bitrate_reservoir=ai->bitrate_hard_window* + (hi->bitrate_max+hi->bitrate_min)*.5; + } + if(hi->bitrate_reservoir<128.) + hi->bitrate_reservoir=128.; + } + return(0); + + /* replacement ratemanage interface */ + case OV_ECTL_RATEMANAGE2_GET: + { + struct ovectl_ratemanage2_arg *ai= + (struct ovectl_ratemanage2_arg *)arg; + if(ai==NULL)return OV_EINVAL; + + ai->management_active=hi->managed; + ai->bitrate_limit_min_kbps=hi->bitrate_min/1000; + ai->bitrate_limit_max_kbps=hi->bitrate_max/1000; + ai->bitrate_average_kbps=hi->bitrate_av/1000; + ai->bitrate_average_damping=hi->bitrate_av_damp; + ai->bitrate_limit_reservoir_bits=hi->bitrate_reservoir; + ai->bitrate_limit_reservoir_bias=hi->bitrate_reservoir_bias; + } + return (0); + case OV_ECTL_RATEMANAGE2_SET: + { + struct ovectl_ratemanage2_arg *ai= + (struct ovectl_ratemanage2_arg *)arg; + if(ai==NULL){ + hi->managed=0; + }else{ + /* sanity check; only catch invariant violations */ + if(ai->bitrate_limit_min_kbps>0 && + ai->bitrate_average_kbps>0 && + ai->bitrate_limit_min_kbps>ai->bitrate_average_kbps) + return OV_EINVAL; + + if(ai->bitrate_limit_max_kbps>0 && + ai->bitrate_average_kbps>0 && + ai->bitrate_limit_max_kbpsbitrate_average_kbps) + return OV_EINVAL; + + if(ai->bitrate_limit_min_kbps>0 && + ai->bitrate_limit_max_kbps>0 && + ai->bitrate_limit_min_kbps>ai->bitrate_limit_max_kbps) + return OV_EINVAL; + + if(ai->bitrate_average_damping <= 0.) + return OV_EINVAL; + + if(ai->bitrate_limit_reservoir_bits < 0) + return OV_EINVAL; + + if(ai->bitrate_limit_reservoir_bias < 0.) + return OV_EINVAL; + + if(ai->bitrate_limit_reservoir_bias > 1.) + return OV_EINVAL; + + hi->managed=ai->management_active; + hi->bitrate_min=ai->bitrate_limit_min_kbps * 1000; + hi->bitrate_max=ai->bitrate_limit_max_kbps * 1000; + hi->bitrate_av=ai->bitrate_average_kbps * 1000; + hi->bitrate_av_damp=ai->bitrate_average_damping; + hi->bitrate_reservoir=ai->bitrate_limit_reservoir_bits; + hi->bitrate_reservoir_bias=ai->bitrate_limit_reservoir_bias; + } + } + return 0; + + case OV_ECTL_LOWPASS_GET: + { + double *farg=(double *)arg; + *farg=hi->lowpass_kHz; + } + return(0); + case OV_ECTL_LOWPASS_SET: + { + double *farg=(double *)arg; + hi->lowpass_kHz=*farg; + + if(hi->lowpass_kHz<2.)hi->lowpass_kHz=2.; + if(hi->lowpass_kHz>99.)hi->lowpass_kHz=99.; + } + return(0); + case OV_ECTL_IBLOCK_GET: + { + double *farg=(double *)arg; + *farg=hi->impulse_noisetune; + } + return(0); + case OV_ECTL_IBLOCK_SET: + { + double *farg=(double *)arg; + hi->impulse_noisetune=*farg; + + if(hi->impulse_noisetune>0.)hi->impulse_noisetune=0.; + if(hi->impulse_noisetune<-15.)hi->impulse_noisetune=-15.; + } + return(0); + } + + + return(OV_EIMPL); + } + return(OV_EINVAL); +} diff --git a/Libraries/Vorbis/Files/lib/vorbisfile.c b/Libraries/Vorbis/Files/lib/vorbisfile.c new file mode 100644 index 000000000..df0eb5fe4 --- /dev/null +++ b/Libraries/Vorbis/Files/lib/vorbisfile.c @@ -0,0 +1,1981 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * + * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * + * by the XIPHOPHORUS Company http://www.xiph.org/ * + * * + ******************************************************************** + + function: stdio-based convenience library for opening/seeking/decoding + last mod: $Id$ + + ********************************************************************/ + +#include +#include +#include +#include +#include + +#include "vorbis/codec.h" +#include "vorbis/vorbisfile.h" + +#include "os.h" +#include "misc.h" + +/* A 'chained bitstream' is a Vorbis bitstream that contains more than + one logical bitstream arranged end to end (the only form of Ogg + multiplexing allowed in a Vorbis bitstream; grouping [parallel + multiplexing] is not allowed in Vorbis) */ + +/* A Vorbis file can be played beginning to end (streamed) without + worrying ahead of time about chaining (see decoder_example.c). If + we have the whole file, however, and want random access + (seeking/scrubbing) or desire to know the total length/time of a + file, we need to account for the possibility of chaining. */ + +/* We can handle things a number of ways; we can determine the entire + bitstream structure right off the bat, or find pieces on demand. + This example determines and caches structure for the entire + bitstream, but builds a virtual decoder on the fly when moving + between links in the chain. */ + +/* There are also different ways to implement seeking. Enough + information exists in an Ogg bitstream to seek to + sample-granularity positions in the output. Or, one can seek by + picking some portion of the stream roughly in the desired area if + we only want coarse navigation through the stream. */ + +/************************************************************************* + * Many, many internal helpers. The intention is not to be confusing; + * rampant duplication and monolithic function implementation would be + * harder to understand anyway. The high level functions are last. Begin + * grokking near the end of the file */ + +/* read a little more data from the file/pipe into the ogg_sync framer +*/ +#define CHUNKSIZE 8500 /* a shade over 8k; anyone using pages well + over 8k gets what they deserve */ +static long _get_data(OggVorbis_File *vf){ + errno=0; + if(vf->datasource){ + char *buffer=ogg_sync_buffer(&vf->oy,CHUNKSIZE); + long bytes=(vf->callbacks.read_func)(buffer,1,CHUNKSIZE,vf->datasource); + if(bytes>0)ogg_sync_wrote(&vf->oy,bytes); + if(bytes==0 && errno)return(-1); + return(bytes); + }else + return(0); +} + +/* save a tiny smidge of verbosity to make the code more readable */ +static void _seek_helper(OggVorbis_File *vf,ogg_int64_t offset){ + if(vf->datasource){ + (vf->callbacks.seek_func)(vf->datasource, offset, SEEK_SET); + vf->offset=offset; + ogg_sync_reset(&vf->oy); + }else{ + /* shouldn't happen unless someone writes a broken callback */ + return; + } +} + +/* The read/seek functions track absolute position within the stream */ + +/* from the head of the stream, get the next page. boundary specifies + if the function is allowed to fetch more data from the stream (and + how much) or only use internally buffered data. + + boundary: -1) unbounded search + 0) read no additional data; use cached only + n) search for a new page beginning for n bytes + + return: <0) did not find a page (OV_FALSE, OV_EOF, OV_EREAD) + n) found a page at absolute offset n */ + +static ogg_int64_t _get_next_page(OggVorbis_File *vf,ogg_page *og, + ogg_int64_t boundary){ + if(boundary>0)boundary+=vf->offset; + while(1){ + long more; + + if(boundary>0 && vf->offset>=boundary)return(OV_FALSE); + more=ogg_sync_pageseek(&vf->oy,og); + + if(more<0){ + /* skipped n bytes */ + vf->offset-=more; + }else{ + if(more==0){ + /* send more paramedics */ + if(!boundary)return(OV_FALSE); + { + long ret=_get_data(vf); + if(ret==0)return(OV_EOF); + if(ret<0)return(OV_EREAD); + } + }else{ + /* got a page. Return the offset at the page beginning, + advance the internal offset past the page end */ + ogg_int64_t ret=vf->offset; + vf->offset+=more; + return(ret); + + } + } + } +} + +/* find the latest page beginning before the current stream cursor + position. Much dirtier than the above as Ogg doesn't have any + backward search linkage. no 'readp' as it will certainly have to + read. */ +/* returns offset or OV_EREAD, OV_FAULT */ +static ogg_int64_t _get_prev_page(OggVorbis_File *vf,ogg_page *og){ + ogg_int64_t begin=vf->offset; + ogg_int64_t end=begin; + ogg_int64_t ret; + ogg_int64_t offset=-1; + + while(offset==-1){ + begin-=CHUNKSIZE; + if(begin<0) + begin=0; + _seek_helper(vf,begin); + while(vf->offsetoffset); + if(ret==OV_EREAD)return(OV_EREAD); + if(ret<0){ + break; + }else{ + offset=ret; + } + } + } + + /* we have the offset. Actually snork and hold the page now */ + _seek_helper(vf,offset); + ret=_get_next_page(vf,og,CHUNKSIZE); + if(ret<0) + /* this shouldn't be possible */ + return(OV_EFAULT); + + return(offset); +} + +/* finds each bitstream link one at a time using a bisection search + (has to begin by knowing the offset of the lb's initial page). + Recurses for each link so it can alloc the link storage after + finding them all, then unroll and fill the cache at the same time */ +static int _bisect_forward_serialno(OggVorbis_File *vf, + ogg_int64_t begin, + ogg_int64_t searched, + ogg_int64_t end, + long currentno, + long m){ + ogg_int64_t endsearched=end; + ogg_int64_t next=end; + ogg_page og; + ogg_int64_t ret; + + /* the below guards against garbage seperating the last and + first pages of two links. */ + while(searched=0)next=ret; + }else{ + searched=ret+og.header_len+og.body_len; + } + } + + _seek_helper(vf,next); + ret=_get_next_page(vf,&og,-1); + if(ret==OV_EREAD)return(OV_EREAD); + + if(searched>=end || ret<0){ + vf->links=m+1; + vf->offsets=_ogg_malloc((vf->links+1)*sizeof(*vf->offsets)); + vf->serialnos=_ogg_malloc(vf->links*sizeof(*vf->serialnos)); + vf->offsets[m+1]=searched; + }else{ + ret=_bisect_forward_serialno(vf,next,vf->offset, + end,ogg_page_serialno(&og),m+1); + if(ret==OV_EREAD)return(OV_EREAD); + } + + vf->offsets[m]=begin; + vf->serialnos[m]=currentno; + return(0); +} + +/* uses the local ogg_stream storage in vf; this is important for + non-streaming input sources */ +static int _fetch_headers(OggVorbis_File *vf,vorbis_info *vi,vorbis_comment *vc, + long *serialno,ogg_page *og_ptr){ + ogg_page og; + ogg_packet op; + int i,ret; + + if(!og_ptr){ + ogg_int64_t llret=_get_next_page(vf,&og,CHUNKSIZE); + if(llret==OV_EREAD)return(OV_EREAD); + if(llret<0)return OV_ENOTVORBIS; + og_ptr=&og; + } + + ogg_stream_reset_serialno(&vf->os,ogg_page_serialno(og_ptr)); + if(serialno)*serialno=vf->os.serialno; + vf->ready_state=STREAMSET; + + /* extract the initial header from the first page and verify that the + Ogg bitstream is in fact Vorbis data */ + + vorbis_info_init(vi); + vorbis_comment_init(vc); + + i=0; + while(i<3){ + ogg_stream_pagein(&vf->os,og_ptr); + while(i<3){ + int result=ogg_stream_packetout(&vf->os,&op); + if(result==0)break; + if(result==-1){ + ret=OV_EBADHEADER; + goto bail_header; + } + if((ret=vorbis_synthesis_headerin(vi,vc,&op))){ + goto bail_header; + } + i++; + } + if(i<3) + if(_get_next_page(vf,og_ptr,CHUNKSIZE)<0){ + ret=OV_EBADHEADER; + goto bail_header; + } + } + return 0; + + bail_header: + vorbis_info_clear(vi); + vorbis_comment_clear(vc); + vf->ready_state=OPENED; + + return ret; +} + +/* last step of the OggVorbis_File initialization; get all the + vorbis_info structs and PCM positions. Only called by the seekable + initialization (local stream storage is hacked slightly; pay + attention to how that's done) */ + +/* this is void and does not propogate errors up because we want to be + able to open and use damaged bitstreams as well as we can. Just + watch out for missing information for links in the OggVorbis_File + struct */ +static void _prefetch_all_headers(OggVorbis_File *vf, ogg_int64_t dataoffset){ + ogg_page og; + int i; + ogg_int64_t ret; + + vf->vi=_ogg_realloc(vf->vi,vf->links*sizeof(*vf->vi)); + vf->vc=_ogg_realloc(vf->vc,vf->links*sizeof(*vf->vc)); + vf->dataoffsets=_ogg_malloc(vf->links*sizeof(*vf->dataoffsets)); + vf->pcmlengths=_ogg_malloc(vf->links*2*sizeof(*vf->pcmlengths)); + + for(i=0;ilinks;i++){ + if(i==0){ + /* we already grabbed the initial header earlier. Just set the offset */ + vf->dataoffsets[i]=dataoffset; + _seek_helper(vf,dataoffset); + + }else{ + + /* seek to the location of the initial header */ + + _seek_helper(vf,vf->offsets[i]); + if(_fetch_headers(vf,vf->vi+i,vf->vc+i,NULL,NULL)<0){ + vf->dataoffsets[i]=-1; + }else{ + vf->dataoffsets[i]=vf->offset; + } + } + + /* fetch beginning PCM offset */ + + if(vf->dataoffsets[i]!=-1){ + ogg_int64_t accumulated=0; + long lastblock=-1; + int result; + + ogg_stream_reset_serialno(&vf->os,vf->serialnos[i]); + + while(1){ + ogg_packet op; + + ret=_get_next_page(vf,&og,-1); + if(ret<0) + /* this should not be possible unless the file is + truncated/mangled */ + break; + + if(ogg_page_serialno(&og)!=vf->serialnos[i]) + break; + + /* count blocksizes of all frames in the page */ + ogg_stream_pagein(&vf->os,&og); + while((result=ogg_stream_packetout(&vf->os,&op))){ + if(result>0){ /* ignore holes */ + long thisblock=vorbis_packet_blocksize(vf->vi+i,&op); + if(lastblock!=-1) + accumulated+=(lastblock+thisblock)>>2; + lastblock=thisblock; + } + } + + if(ogg_page_granulepos(&og)!=-1){ + /* pcm offset of last packet on the first audio page */ + accumulated= ogg_page_granulepos(&og)-accumulated; + break; + } + } + + /* less than zero? This is a stream with samples trimmed off + the beginning, a normal occurrence; set the offset to zero */ + if(accumulated<0)accumulated=0; + + vf->pcmlengths[i*2]=accumulated; + } + + /* get the PCM length of this link. To do this, + get the last page of the stream */ + { + ogg_int64_t end=vf->offsets[i+1]; + _seek_helper(vf,end); + + while(1){ + ret=_get_prev_page(vf,&og); + if(ret<0){ + /* this should not be possible */ + vorbis_info_clear(vf->vi+i); + vorbis_comment_clear(vf->vc+i); + break; + } + if(ogg_page_granulepos(&og)!=-1){ + vf->pcmlengths[i*2+1]=ogg_page_granulepos(&og)-vf->pcmlengths[i*2]; + break; + } + vf->offset=ret; + } + } + } +} + +static int _make_decode_ready(OggVorbis_File *vf){ + if(vf->ready_state>STREAMSET)return 0; + if(vf->ready_stateseekable){ + if(vorbis_synthesis_init(&vf->vd,vf->vi+vf->current_link)) + return OV_EBADLINK; + }else{ + if(vorbis_synthesis_init(&vf->vd,vf->vi)) + return OV_EBADLINK; + } + vorbis_block_init(&vf->vd,&vf->vb); + vf->ready_state=INITSET; + vf->bittrack=0.f; + vf->samptrack=0.f; + return 0; +} + +static int _open_seekable2(OggVorbis_File *vf){ + long serialno=vf->current_serialno; + ogg_int64_t dataoffset=vf->offset, end; + ogg_page og; + + /* we're partially open and have a first link header state in + storage in vf */ + /* we can seek, so set out learning all about this file */ + (vf->callbacks.seek_func)(vf->datasource,0,SEEK_END); + vf->offset=vf->end=(vf->callbacks.tell_func)(vf->datasource); + + /* We get the offset for the last page of the physical bitstream. + Most OggVorbis files will contain a single logical bitstream */ + end=_get_prev_page(vf,&og); + if(end<0)return(end); + + /* more than one logical bitstream? */ + if(ogg_page_serialno(&og)!=serialno){ + + /* Chained bitstream. Bisect-search each logical bitstream + section. Do so based on serial number only */ + if(_bisect_forward_serialno(vf,0,0,end+1,serialno,0)<0)return(OV_EREAD); + + }else{ + + /* Only one logical bitstream */ + if(_bisect_forward_serialno(vf,0,end,end+1,serialno,0))return(OV_EREAD); + + } + + /* the initial header memory is referenced by vf after; don't free it */ + _prefetch_all_headers(vf,dataoffset); + return(ov_raw_seek(vf,0)); +} + +/* clear out the current logical bitstream decoder */ +static void _decode_clear(OggVorbis_File *vf){ + vorbis_dsp_clear(&vf->vd); + vorbis_block_clear(&vf->vb); + vf->ready_state=OPENED; +} + +/* fetch and process a packet. Handles the case where we're at a + bitstream boundary and dumps the decoding machine. If the decoding + machine is unloaded, it loads it. It also keeps pcm_offset up to + date (seek and read both use this. seek uses a special hack with + readp). + + return: <0) error, OV_HOLE (lost packet) or OV_EOF + 0) need more data (only if readp==0) + 1) got a packet +*/ + +static int _fetch_and_process_packet(OggVorbis_File *vf, + ogg_packet *op_in, + int readp, + int spanp){ + ogg_page og; + + /* handle one packet. Try to fetch it from current stream state */ + /* extract packets from page */ + while(1){ + + /* process a packet if we can. If the machine isn't loaded, + neither is a page */ + if(vf->ready_state==INITSET){ + while(1) { + ogg_packet op; + ogg_packet *op_ptr=(op_in?op_in:&op); + int result=ogg_stream_packetout(&vf->os,op_ptr); + ogg_int64_t granulepos; + + op_in=NULL; + if(result==-1)return(OV_HOLE); /* hole in the data. */ + if(result>0){ + /* got a packet. process it */ + granulepos=op_ptr->granulepos; + if(!vorbis_synthesis(&vf->vb,op_ptr)){ /* lazy check for lazy + header handling. The + header packets aren't + audio, so if/when we + submit them, + vorbis_synthesis will + reject them */ + + /* suck in the synthesis data and track bitrate */ + { + int oldsamples=vorbis_synthesis_pcmout(&vf->vd,NULL); + /* for proper use of libvorbis within libvorbisfile, + oldsamples will always be zero. */ + if(oldsamples)return(OV_EFAULT); + + vorbis_synthesis_blockin(&vf->vd,&vf->vb); + vf->samptrack+=vorbis_synthesis_pcmout(&vf->vd,NULL)-oldsamples; + vf->bittrack+=op_ptr->bytes*8; + } + + /* update the pcm offset. */ + if(granulepos!=-1 && !op_ptr->e_o_s){ + int link=(vf->seekable?vf->current_link:0); + int i,samples; + + /* this packet has a pcm_offset on it (the last packet + completed on a page carries the offset) After processing + (above), we know the pcm position of the *last* sample + ready to be returned. Find the offset of the *first* + + As an aside, this trick is inaccurate if we begin + reading anew right at the last page; the end-of-stream + granulepos declares the last frame in the stream, and the + last packet of the last page may be a partial frame. + So, we need a previous granulepos from an in-sequence page + to have a reference point. Thus the !op_ptr->e_o_s clause + above */ + + if(vf->seekable && link>0) + granulepos-=vf->pcmlengths[link*2]; + if(granulepos<0)granulepos=0; /* actually, this + shouldn't be possible + here unless the stream + is very broken */ + + samples=vorbis_synthesis_pcmout(&vf->vd,NULL); + + granulepos-=samples; + for(i=0;ipcmlengths[i*2+1]; + vf->pcm_offset=granulepos; + } + return(1); + } + } + else + break; + } + } + + if(vf->ready_state>=OPENED){ + ogg_int64_t ret; + if(!readp)return(0); + if((ret=_get_next_page(vf,&og,-1))<0){ + return(OV_EOF); /* eof. + leave unitialized */ + } + + /* bitrate tracking; add the header's bytes here, the body bytes + are done by packet above */ + vf->bittrack+=og.header_len*8; + + /* has our decoding just traversed a bitstream boundary? */ + if(vf->ready_state==INITSET){ + if(vf->current_serialno!=ogg_page_serialno(&og)){ + if(!spanp) + return(OV_EOF); + + _decode_clear(vf); + + if(!vf->seekable){ + vorbis_info_clear(vf->vi); + vorbis_comment_clear(vf->vc); + } + } + } + } + + /* Do we need to load a new machine before submitting the page? */ + /* This is different in the seekable and non-seekable cases. + + In the seekable case, we already have all the header + information loaded and cached; we just initialize the machine + with it and continue on our merry way. + + In the non-seekable (streaming) case, we'll only be at a + boundary if we just left the previous logical bitstream and + we're now nominally at the header of the next bitstream + */ + + if(vf->ready_state!=INITSET){ + int link; + + if(vf->ready_stateseekable){ + vf->current_serialno=ogg_page_serialno(&og); + + /* match the serialno to bitstream section. We use this rather than + offset positions to avoid problems near logical bitstream + boundaries */ + for(link=0;linklinks;link++) + if(vf->serialnos[link]==vf->current_serialno)break; + if(link==vf->links)return(OV_EBADLINK); /* sign of a bogus + stream. error out, + leave machine + uninitialized */ + + vf->current_link=link; + + ogg_stream_reset_serialno(&vf->os,vf->current_serialno); + vf->ready_state=STREAMSET; + + }else{ + /* we're streaming */ + /* fetch the three header packets, build the info struct */ + + int ret=_fetch_headers(vf,vf->vi,vf->vc,&vf->current_serialno,&og); + if(ret)return(ret); + vf->current_link++; + link=0; + } + } + + { + int ret=_make_decode_ready(vf); + if(ret<0)return ret; + } + } + ogg_stream_pagein(&vf->os,&og); + } +} + +/* if, eg, 64 bit stdio is configured by default, this will build with + fseek64 */ +static int _fseek64_wrap(FILE *f,ogg_int64_t off,int whence){ + if(f==NULL)return(-1); + return fseek(f,off,whence); +} + +static int _ov_open1(void *f,OggVorbis_File *vf,char *initial, + long ibytes, ov_callbacks callbacks){ + int offsettest=(f?callbacks.seek_func(f,0,SEEK_CUR):-1); + int ret; + + memset(vf,0,sizeof(*vf)); + vf->datasource=f; + vf->callbacks = callbacks; + + /* init the framing state */ + ogg_sync_init(&vf->oy); + + /* perhaps some data was previously read into a buffer for testing + against other stream types. Allow initialization from this + previously read data (as we may be reading from a non-seekable + stream) */ + if(initial){ + char *buffer=ogg_sync_buffer(&vf->oy,ibytes); + memcpy(buffer,initial,ibytes); + ogg_sync_wrote(&vf->oy,ibytes); + } + + /* can we seek? Stevens suggests the seek test was portable */ + if(offsettest!=-1)vf->seekable=1; + + /* No seeking yet; Set up a 'single' (current) logical bitstream + entry for partial open */ + vf->links=1; + vf->vi=_ogg_calloc(vf->links,sizeof(*vf->vi)); + vf->vc=_ogg_calloc(vf->links,sizeof(*vf->vc)); + ogg_stream_init(&vf->os,-1); /* fill in the serialno later */ + + /* Try to fetch the headers, maintaining all the storage */ + if((ret=_fetch_headers(vf,vf->vi,vf->vc,&vf->current_serialno,NULL))<0){ + vf->datasource=NULL; + ov_clear(vf); + }else + vf->ready_state=PARTOPEN; + return(ret); +} + +static int _ov_open2(OggVorbis_File *vf){ + if(vf->ready_state != PARTOPEN) return OV_EINVAL; + vf->ready_state=OPENED; + if(vf->seekable){ + int ret=_open_seekable2(vf); + if(ret){ + vf->datasource=NULL; + ov_clear(vf); + } + return(ret); + }else + vf->ready_state=STREAMSET; + + return 0; +} + + +/* clear out the OggVorbis_File struct */ +int ov_clear(OggVorbis_File *vf){ + if(vf){ + vorbis_block_clear(&vf->vb); + vorbis_dsp_clear(&vf->vd); + ogg_stream_clear(&vf->os); + + if(vf->vi && vf->links){ + int i; + for(i=0;ilinks;i++){ + vorbis_info_clear(vf->vi+i); + vorbis_comment_clear(vf->vc+i); + } + _ogg_free(vf->vi); + _ogg_free(vf->vc); + } + if(vf->dataoffsets)_ogg_free(vf->dataoffsets); + if(vf->pcmlengths)_ogg_free(vf->pcmlengths); + if(vf->serialnos)_ogg_free(vf->serialnos); + if(vf->offsets)_ogg_free(vf->offsets); + ogg_sync_clear(&vf->oy); + if(vf->datasource)(vf->callbacks.close_func)(vf->datasource); + memset(vf,0,sizeof(*vf)); + } +#ifdef DEBUG_LEAKS + _VDBG_dump(); +#endif + return(0); +} + +/* inspects the OggVorbis file and finds/documents all the logical + bitstreams contained in it. Tries to be tolerant of logical + bitstream sections that are truncated/woogie. + + return: -1) error + 0) OK +*/ + +int ov_open_callbacks(void *f,OggVorbis_File *vf,char *initial,long ibytes, + ov_callbacks callbacks){ + int ret=_ov_open1(f,vf,initial,ibytes,callbacks); + if(ret)return ret; + return _ov_open2(vf); +} + +int ov_open(FILE *f,OggVorbis_File *vf,char *initial,long ibytes){ + ov_callbacks callbacks = { + (size_t (*)(void *, size_t, size_t, void *)) fread, + (int (*)(void *, ogg_int64_t, int)) _fseek64_wrap, + (int (*)(void *)) fclose, + (long (*)(void *)) ftell + }; + + return ov_open_callbacks((void *)f, vf, initial, ibytes, callbacks); +} + +/* cheap hack for game usage where downsampling is desirable; there's + no need for SRC as we can just do it cheaply in libvorbis. */ + +int ov_halfrate(OggVorbis_File *vf,int flag){ + int i; + if(vf->vi==NULL)return OV_EINVAL; + if(!vf->seekable)return OV_EINVAL; + if(vf->ready_state>=STREAMSET) + _decode_clear(vf); /* clear out stream state; later on libvorbis + will be able to swap this on the fly, but + for now dumping the decode machine is needed + to reinit the MDCT lookups. 1.1 libvorbis + is planned to be able to switch on the fly */ + + for(i=0;ilinks;i++){ + if(vorbis_synthesis_halfrate(vf->vi+i,flag)){ + ov_halfrate(vf,0); + return OV_EINVAL; + } + } + return 0; +} + +int ov_halfrate_p(OggVorbis_File *vf){ + if(vf->vi==NULL)return OV_EINVAL; + return vorbis_synthesis_halfrate_p(vf->vi); +} + +/* Only partially open the vorbis file; test for Vorbisness, and load + the headers for the first chain. Do not seek (although test for + seekability). Use ov_test_open to finish opening the file, else + ov_clear to close/free it. Same return codes as open. */ + +int ov_test_callbacks(void *f,OggVorbis_File *vf,char *initial,long ibytes, + ov_callbacks callbacks) +{ + return _ov_open1(f,vf,initial,ibytes,callbacks); +} + +int ov_test(FILE *f,OggVorbis_File *vf,char *initial,long ibytes){ + ov_callbacks callbacks = { + (size_t (*)(void *, size_t, size_t, void *)) fread, + (int (*)(void *, ogg_int64_t, int)) _fseek64_wrap, + (int (*)(void *)) fclose, + (long (*)(void *)) ftell + }; + + return ov_test_callbacks((void *)f, vf, initial, ibytes, callbacks); +} + +int ov_test_open(OggVorbis_File *vf){ + if(vf->ready_state!=PARTOPEN)return(OV_EINVAL); + return _ov_open2(vf); +} + +/* How many logical bitstreams in this physical bitstream? */ +long ov_streams(OggVorbis_File *vf){ + return vf->links; +} + +/* Is the FILE * associated with vf seekable? */ +long ov_seekable(OggVorbis_File *vf){ + return vf->seekable; +} + +/* returns the bitrate for a given logical bitstream or the entire + physical bitstream. If the file is open for random access, it will + find the *actual* average bitrate. If the file is streaming, it + returns the nominal bitrate (if set) else the average of the + upper/lower bounds (if set) else -1 (unset). + + If you want the actual bitrate field settings, get them from the + vorbis_info structs */ + +long ov_bitrate(OggVorbis_File *vf,int i){ + if(vf->ready_state=vf->links)return(OV_EINVAL); + if(!vf->seekable && i!=0)return(ov_bitrate(vf,0)); + if(i<0){ + ogg_int64_t bits=0; + int i; + float br; + for(i=0;ilinks;i++) + bits+=(vf->offsets[i+1]-vf->dataoffsets[i])*8; + /* This once read: return(rint(bits/ov_time_total(vf,-1))); + * gcc 3.x on x86 miscompiled this at optimisation level 2 and above, + * so this is slightly transformed to make it work. + */ + br = bits/ov_time_total(vf,-1); + return(rint(br)); + }else{ + if(vf->seekable){ + /* return the actual bitrate */ + return(rint((vf->offsets[i+1]-vf->dataoffsets[i])*8/ov_time_total(vf,i))); + }else{ + /* return nominal if set */ + if(vf->vi[i].bitrate_nominal>0){ + return vf->vi[i].bitrate_nominal; + }else{ + if(vf->vi[i].bitrate_upper>0){ + if(vf->vi[i].bitrate_lower>0){ + return (vf->vi[i].bitrate_upper+vf->vi[i].bitrate_lower)/2; + }else{ + return vf->vi[i].bitrate_upper; + } + } + return(OV_FALSE); + } + } + } +} + +/* returns the actual bitrate since last call. returns -1 if no + additional data to offer since last call (or at beginning of stream), + EINVAL if stream is only partially open +*/ +long ov_bitrate_instant(OggVorbis_File *vf){ + int link=(vf->seekable?vf->current_link:0); + long ret; + if(vf->ready_statesamptrack==0)return(OV_FALSE); + ret=vf->bittrack/vf->samptrack*vf->vi[link].rate+.5; + vf->bittrack=0.f; + vf->samptrack=0.f; + return(ret); +} + +/* Guess */ +long ov_serialnumber(OggVorbis_File *vf,int i){ + if(i>=vf->links)return(ov_serialnumber(vf,vf->links-1)); + if(!vf->seekable && i>=0)return(ov_serialnumber(vf,-1)); + if(i<0){ + return(vf->current_serialno); + }else{ + return(vf->serialnos[i]); + } +} + +/* returns: total raw (compressed) length of content if i==-1 + raw (compressed) length of that logical bitstream for i==0 to n + OV_EINVAL if the stream is not seekable (we can't know the length) + or if stream is only partially open +*/ +ogg_int64_t ov_raw_total(OggVorbis_File *vf,int i){ + if(vf->ready_stateseekable || i>=vf->links)return(OV_EINVAL); + if(i<0){ + ogg_int64_t acc=0; + int i; + for(i=0;ilinks;i++) + acc+=ov_raw_total(vf,i); + return(acc); + }else{ + return(vf->offsets[i+1]-vf->offsets[i]); + } +} + +/* returns: total PCM length (samples) of content if i==-1 PCM length + (samples) of that logical bitstream for i==0 to n + OV_EINVAL if the stream is not seekable (we can't know the + length) or only partially open +*/ +ogg_int64_t ov_pcm_total(OggVorbis_File *vf,int i){ + if(vf->ready_stateseekable || i>=vf->links)return(OV_EINVAL); + if(i<0){ + ogg_int64_t acc=0; + int i; + for(i=0;ilinks;i++) + acc+=ov_pcm_total(vf,i); + return(acc); + }else{ + return(vf->pcmlengths[i*2+1]); + } +} + +/* returns: total seconds of content if i==-1 + seconds in that logical bitstream for i==0 to n + OV_EINVAL if the stream is not seekable (we can't know the + length) or only partially open +*/ +double ov_time_total(OggVorbis_File *vf,int i){ + if(vf->ready_stateseekable || i>=vf->links)return(OV_EINVAL); + if(i<0){ + double acc=0; + int i; + for(i=0;ilinks;i++) + acc+=ov_time_total(vf,i); + return(acc); + }else{ + return((double)(vf->pcmlengths[i*2+1])/vf->vi[i].rate); + } +} + +/* seek to an offset relative to the *compressed* data. This also + scans packets to update the PCM cursor. It will cross a logical + bitstream boundary, but only if it can't get any packets out of the + tail of the bitstream we seek to (so no surprises). + + returns zero on success, nonzero on failure */ + +int ov_raw_seek(OggVorbis_File *vf,ogg_int64_t pos){ + ogg_stream_state work_os; + + if(vf->ready_stateseekable) + return(OV_ENOSEEK); /* don't dump machine if we can't seek */ + + if(pos<0 || pos>vf->end)return(OV_EINVAL); + + /* don't yet clear out decoding machine (if it's initialized), in + the case we're in the same link. Restart the decode lapping, and + let _fetch_and_process_packet deal with a potential bitstream + boundary */ + vf->pcm_offset=-1; + ogg_stream_reset_serialno(&vf->os, + vf->current_serialno); /* must set serialno */ + vorbis_synthesis_restart(&vf->vd); + + _seek_helper(vf,pos); + + /* we need to make sure the pcm_offset is set, but we don't want to + advance the raw cursor past good packets just to get to the first + with a granulepos. That's not equivalent behavior to beginning + decoding as immediately after the seek position as possible. + + So, a hack. We use two stream states; a local scratch state and + the shared vf->os stream state. We use the local state to + scan, and the shared state as a buffer for later decode. + + Unfortuantely, on the last page we still advance to last packet + because the granulepos on the last page is not necessarily on a + packet boundary, and we need to make sure the granpos is + correct. + */ + + { + ogg_page og; + ogg_packet op; + int lastblock=0; + int accblock=0; + int thisblock; + int eosflag; + + ogg_stream_init(&work_os,vf->current_serialno); /* get the memory ready */ + ogg_stream_reset(&work_os); /* eliminate the spurious OV_HOLE + return from not necessarily + starting from the beginning */ + + while(1){ + if(vf->ready_state>=STREAMSET){ + /* snarf/scan a packet if we can */ + int result=ogg_stream_packetout(&work_os,&op); + + if(result>0){ + + if(vf->vi[vf->current_link].codec_setup){ + thisblock=vorbis_packet_blocksize(vf->vi+vf->current_link,&op); + if(thisblock<0){ + ogg_stream_packetout(&vf->os,NULL); + thisblock=0; + }else{ + + if(eosflag) + ogg_stream_packetout(&vf->os,NULL); + else + if(lastblock)accblock+=(lastblock+thisblock)>>2; + } + + if(op.granulepos!=-1){ + int i,link=vf->current_link; + ogg_int64_t granulepos=op.granulepos-vf->pcmlengths[link*2]; + if(granulepos<0)granulepos=0; + + for(i=0;ipcmlengths[i*2+1]; + vf->pcm_offset=granulepos-accblock; + break; + } + lastblock=thisblock; + continue; + }else + ogg_stream_packetout(&vf->os,NULL); + } + } + + if(!lastblock){ + if(_get_next_page(vf,&og,-1)<0){ + vf->pcm_offset=ov_pcm_total(vf,-1); + break; + } + }else{ + /* huh? Bogus stream with packets but no granulepos */ + vf->pcm_offset=-1; + break; + } + + /* has our decoding just traversed a bitstream boundary? */ + if(vf->ready_state>=STREAMSET) + if(vf->current_serialno!=ogg_page_serialno(&og)){ + _decode_clear(vf); /* clear out stream state */ + ogg_stream_clear(&work_os); + } + + if(vf->ready_statecurrent_serialno=ogg_page_serialno(&og); + for(link=0;linklinks;link++) + if(vf->serialnos[link]==vf->current_serialno)break; + if(link==vf->links)goto seek_error; /* sign of a bogus stream. + error out, leave + machine uninitialized */ + vf->current_link=link; + + ogg_stream_reset_serialno(&vf->os,vf->current_serialno); + ogg_stream_reset_serialno(&work_os,vf->current_serialno); + vf->ready_state=STREAMSET; + + } + + ogg_stream_pagein(&vf->os,&og); + ogg_stream_pagein(&work_os,&og); + eosflag=ogg_page_eos(&og); + } + } + + ogg_stream_clear(&work_os); + vf->bittrack=0.f; + vf->samptrack=0.f; + return(0); + + seek_error: + /* dump the machine so we're in a known state */ + vf->pcm_offset=-1; + ogg_stream_clear(&work_os); + _decode_clear(vf); + return OV_EBADLINK; +} + +/* Page granularity seek (faster than sample granularity because we + don't do the last bit of decode to find a specific sample). + + Seek to the last [granule marked] page preceeding the specified pos + location, such that decoding past the returned point will quickly + arrive at the requested position. */ +int ov_pcm_seek_page(OggVorbis_File *vf,ogg_int64_t pos){ + int link=-1; + ogg_int64_t result=0; + ogg_int64_t total=ov_pcm_total(vf,-1); + + if(vf->ready_stateseekable)return(OV_ENOSEEK); + + if(pos<0 || pos>total)return(OV_EINVAL); + + /* which bitstream section does this pcm offset occur in? */ + for(link=vf->links-1;link>=0;link--){ + total-=vf->pcmlengths[link*2+1]; + if(pos>=total)break; + } + + /* search within the logical bitstream for the page with the highest + pcm_pos preceeding (or equal to) pos. There is a danger here; + missing pages or incorrect frame number information in the + bitstream could make our task impossible. Account for that (it + would be an error condition) */ + + /* new search algorithm by HB (Nicholas Vinen) */ + { + ogg_int64_t end=vf->offsets[link+1]; + ogg_int64_t begin=vf->offsets[link]; + ogg_int64_t begintime = vf->pcmlengths[link*2]; + ogg_int64_t endtime = vf->pcmlengths[link*2+1]+begintime; + ogg_int64_t target=pos-total+begintime; + ogg_int64_t best=begin; + + ogg_page og; + while(beginoffset); + if(result==OV_EREAD) goto seek_error; + if(result<0){ + if(bisect<=begin+1) + end=begin; /* found it */ + else{ + if(bisect==0) goto seek_error; + bisect-=CHUNKSIZE; + if(bisect<=begin)bisect=begin+1; + _seek_helper(vf,bisect); + } + }else{ + ogg_int64_t granulepos=ogg_page_granulepos(&og); + if(granulepos==-1)continue; + if(granuleposoffset; /* raw offset of next page */ + begintime=granulepos; + + if(target-begintime>44100)break; + bisect=begin; /* *not* begin + 1 */ + }else{ + if(bisect<=begin+1) + end=begin; /* found it */ + else{ + if(end==vf->offset){ /* we're pretty close - we'd be stuck in */ + end=result; + bisect-=CHUNKSIZE; /* an endless loop otherwise. */ + if(bisect<=begin)bisect=begin+1; + _seek_helper(vf,bisect); + }else{ + end=result; + endtime=granulepos; + break; + } + } + } + } + } + } + + /* found our page. seek to it, update pcm offset. Easier case than + raw_seek, don't keep packets preceeding granulepos. */ + { + ogg_page og; + ogg_packet op; + + /* seek */ + _seek_helper(vf,best); + vf->pcm_offset=-1; + + if(_get_next_page(vf,&og,-1)<0)return(OV_EOF); /* shouldn't happen */ + + if(link!=vf->current_link){ + /* Different link; dump entire decode machine */ + _decode_clear(vf); + + vf->current_link=link; + vf->current_serialno=ogg_page_serialno(&og); + vf->ready_state=STREAMSET; + + }else{ + vorbis_synthesis_restart(&vf->vd); + } + + ogg_stream_reset_serialno(&vf->os,vf->current_serialno); + ogg_stream_pagein(&vf->os,&og); + + /* pull out all but last packet; the one with granulepos */ + while(1){ + result=ogg_stream_packetpeek(&vf->os,&op); + if(result==0){ + /* !!! the packet finishing this page originated on a + preceeding page. Keep fetching previous pages until we + get one with a granulepos or without the 'continued' flag + set. Then just use raw_seek for simplicity. */ + + _seek_helper(vf,best); + + while(1){ + result=_get_prev_page(vf,&og); + if(result<0) goto seek_error; + if(ogg_page_granulepos(&og)>-1 || + !ogg_page_continued(&og)){ + return ov_raw_seek(vf,result); + } + vf->offset=result; + } + } + if(result<0){ + result = OV_EBADPACKET; + goto seek_error; + } + if(op.granulepos!=-1){ + vf->pcm_offset=op.granulepos-vf->pcmlengths[vf->current_link*2]; + if(vf->pcm_offset<0)vf->pcm_offset=0; + vf->pcm_offset+=total; + break; + }else + result=ogg_stream_packetout(&vf->os,NULL); + } + } + } + + /* verify result */ + if(vf->pcm_offset>pos || pos>ov_pcm_total(vf,-1)){ + result=OV_EFAULT; + goto seek_error; + } + vf->bittrack=0.f; + vf->samptrack=0.f; + return(0); + + seek_error: + /* dump machine so we're in a known state */ + vf->pcm_offset=-1; + _decode_clear(vf); + return (int)result; +} + +/* seek to a sample offset relative to the decompressed pcm stream + returns zero on success, nonzero on failure */ + +int ov_pcm_seek(OggVorbis_File *vf,ogg_int64_t pos){ + int thisblock,lastblock=0; + int ret=ov_pcm_seek_page(vf,pos); + if(ret<0)return(ret); + if((ret=_make_decode_ready(vf)))return ret; + + /* discard leading packets we don't need for the lapping of the + position we want; don't decode them */ + + while(1){ + ogg_packet op; + ogg_page og; + + int ret=ogg_stream_packetpeek(&vf->os,&op); + if(ret>0){ + thisblock=vorbis_packet_blocksize(vf->vi+vf->current_link,&op); + if(thisblock<0){ + ogg_stream_packetout(&vf->os,NULL); + continue; /* non audio packet */ + } + if(lastblock)vf->pcm_offset+=(lastblock+thisblock)>>2; + + if(vf->pcm_offset+((thisblock+ + vorbis_info_blocksize(vf->vi,1))>>2)>=pos)break; + + /* remove the packet from packet queue and track its granulepos */ + ogg_stream_packetout(&vf->os,NULL); + vorbis_synthesis_trackonly(&vf->vb,&op); /* set up a vb with + only tracking, no + pcm_decode */ + vorbis_synthesis_blockin(&vf->vd,&vf->vb); + + /* end of logical stream case is hard, especially with exact + length positioning. */ + + if(op.granulepos>-1){ + int i; + /* always believe the stream markers */ + vf->pcm_offset=op.granulepos-vf->pcmlengths[vf->current_link*2]; + if(vf->pcm_offset<0)vf->pcm_offset=0; + for(i=0;icurrent_link;i++) + vf->pcm_offset+=vf->pcmlengths[i*2+1]; + } + + lastblock=thisblock; + + }else{ + if(ret<0 && ret!=OV_HOLE)break; + + /* suck in a new page */ + if(_get_next_page(vf,&og,-1)<0)break; + if(vf->current_serialno!=ogg_page_serialno(&og))_decode_clear(vf); + + if(vf->ready_statecurrent_serialno=ogg_page_serialno(&og); + for(link=0;linklinks;link++) + if(vf->serialnos[link]==vf->current_serialno)break; + if(link==vf->links)return(OV_EBADLINK); + vf->current_link=link; + + ogg_stream_reset_serialno(&vf->os,vf->current_serialno); + vf->ready_state=STREAMSET; + ret=_make_decode_ready(vf); + if(ret)return ret; + lastblock=0; + } + + ogg_stream_pagein(&vf->os,&og); + } + } + + vf->bittrack=0.f; + vf->samptrack=0.f; + /* discard samples until we reach the desired position. Crossing a + logical bitstream boundary with abandon is OK. */ + while(vf->pcm_offsetpcm_offset; + long samples=vorbis_synthesis_pcmout(&vf->vd,NULL); + + if(samples>target)samples=target; + vorbis_synthesis_read(&vf->vd,samples); + vf->pcm_offset+=samples; + + if(samplespcm_offset=ov_pcm_total(vf,-1); /* eof */ + } + return 0; +} + +/* seek to a playback time relative to the decompressed pcm stream + returns zero on success, nonzero on failure */ +int ov_time_seek(OggVorbis_File *vf,double seconds){ + /* translate time to PCM position and call ov_pcm_seek */ + + int link=-1; + ogg_int64_t pcm_total=ov_pcm_total(vf,-1); + double time_total=ov_time_total(vf,-1); + + if(vf->ready_stateseekable)return(OV_ENOSEEK); + if(seconds<0 || seconds>time_total)return(OV_EINVAL); + + /* which bitstream section does this time offset occur in? */ + for(link=vf->links-1;link>=0;link--){ + pcm_total-=vf->pcmlengths[link*2+1]; + time_total-=ov_time_total(vf,link); + if(seconds>=time_total)break; + } + + /* enough information to convert time offset to pcm offset */ + { + ogg_int64_t target=pcm_total+(seconds-time_total)*vf->vi[link].rate; + return(ov_pcm_seek(vf,target)); + } +} + +/* page-granularity version of ov_time_seek + returns zero on success, nonzero on failure */ +int ov_time_seek_page(OggVorbis_File *vf,double seconds){ + /* translate time to PCM position and call ov_pcm_seek */ + + int link=-1; + ogg_int64_t pcm_total=ov_pcm_total(vf,-1); + double time_total=ov_time_total(vf,-1); + + if(vf->ready_stateseekable)return(OV_ENOSEEK); + if(seconds<0 || seconds>time_total)return(OV_EINVAL); + + /* which bitstream section does this time offset occur in? */ + for(link=vf->links-1;link>=0;link--){ + pcm_total-=vf->pcmlengths[link*2+1]; + time_total-=ov_time_total(vf,link); + if(seconds>=time_total)break; + } + + /* enough information to convert time offset to pcm offset */ + { + ogg_int64_t target=pcm_total+(seconds-time_total)*vf->vi[link].rate; + return(ov_pcm_seek_page(vf,target)); + } +} + +/* tell the current stream offset cursor. Note that seek followed by + tell will likely not give the set offset due to caching */ +ogg_int64_t ov_raw_tell(OggVorbis_File *vf){ + if(vf->ready_stateoffset); +} + +/* return PCM offset (sample) of next PCM sample to be read */ +ogg_int64_t ov_pcm_tell(OggVorbis_File *vf){ + if(vf->ready_statepcm_offset); +} + +/* return time offset (seconds) of next PCM sample to be read */ +double ov_time_tell(OggVorbis_File *vf){ + int link=0; + ogg_int64_t pcm_total=0; + double time_total=0.f; + + if(vf->ready_stateseekable){ + pcm_total=ov_pcm_total(vf,-1); + time_total=ov_time_total(vf,-1); + + /* which bitstream section does this time offset occur in? */ + for(link=vf->links-1;link>=0;link--){ + pcm_total-=vf->pcmlengths[link*2+1]; + time_total-=ov_time_total(vf,link); + if(vf->pcm_offset>=pcm_total)break; + } + } + + return((double)time_total+(double)(vf->pcm_offset-pcm_total)/vf->vi[link].rate); +} + +/* link: -1) return the vorbis_info struct for the bitstream section + currently being decoded + 0-n) to request information for a specific bitstream section + + In the case of a non-seekable bitstream, any call returns the + current bitstream. NULL in the case that the machine is not + initialized */ + +vorbis_info *ov_info(OggVorbis_File *vf,int link){ + if(vf->seekable){ + if(link<0) + if(vf->ready_state>=STREAMSET) + return vf->vi+vf->current_link; + else + return vf->vi; + else + if(link>=vf->links) + return NULL; + else + return vf->vi+link; + }else{ + return vf->vi; + } +} + +/* grr, strong typing, grr, no templates/inheritence, grr */ +vorbis_comment *ov_comment(OggVorbis_File *vf,int link){ + if(vf->seekable){ + if(link<0) + if(vf->ready_state>=STREAMSET) + return vf->vc+vf->current_link; + else + return vf->vc; + else + if(link>=vf->links) + return NULL; + else + return vf->vc+link; + }else{ + return vf->vc; + } +} + +static int host_is_big_endian() { + ogg_int32_t pattern = 0xfeedface; /* deadbeef */ + unsigned char *bytewise = (unsigned char *)&pattern; + if (bytewise[0] == 0xfe) return 1; + return 0; +} + +/* up to this point, everything could more or less hide the multiple + logical bitstream nature of chaining from the toplevel application + if the toplevel application didn't particularly care. However, at + the point that we actually read audio back, the multiple-section + nature must surface: Multiple bitstream sections do not necessarily + have to have the same number of channels or sampling rate. + + ov_read returns the sequential logical bitstream number currently + being decoded along with the PCM data in order that the toplevel + application can take action on channel/sample rate changes. This + number will be incremented even for streamed (non-seekable) streams + (for seekable streams, it represents the actual logical bitstream + index within the physical bitstream. Note that the accessor + functions above are aware of this dichotomy). + + input values: buffer) a buffer to hold packed PCM data for return + length) the byte length requested to be placed into buffer + bigendianp) should the data be packed LSB first (0) or + MSB first (1) + word) word size for output. currently 1 (byte) or + 2 (16 bit short) + + return values: <0) error/hole in data (OV_HOLE), partial open (OV_EINVAL) + 0) EOF + n) number of bytes of PCM actually returned. The + below works on a packet-by-packet basis, so the + return length is not related to the 'length' passed + in, just guaranteed to fit. + + *section) set to the logical bitstream number */ + +long ov_read(OggVorbis_File *vf,char *buffer,int length, + int bigendianp,int word,int sgned,int *bitstream){ + int i,j; + int host_endian = host_is_big_endian(); + + float **pcm; + long samples; + + if(vf->ready_stateready_state==INITSET){ + samples=vorbis_synthesis_pcmout(&vf->vd,&pcm); + if(samples)break; + } + + /* suck in another packet */ + { + int ret=_fetch_and_process_packet(vf,NULL,1,1); + if(ret==OV_EOF) + return(0); + if(ret<=0) + return(ret); + } + + } + + if(samples>0){ + + /* yay! proceed to pack data into the byte buffer */ + + long channels=ov_info(vf,-1)->channels; + long bytespersample=word * channels; + vorbis_fpu_control fpu; + if(samples>length/bytespersample)samples=length/bytespersample; + + if(samples <= 0) + return OV_EINVAL; + + /* a tight loop to pack each size */ + { + int val; + if(word==1){ + int off=(sgned?0:128); + vorbis_fpu_setround(&fpu); + for(j=0;j127)val=127; + else if(val<-128)val=-128; + *buffer++=val+off; + } + vorbis_fpu_restore(fpu); + }else{ + int off=(sgned?0:32768); + + if(host_endian==bigendianp){ + if(sgned){ + + vorbis_fpu_setround(&fpu); + for(i=0;i32767)val=32767; + else if(val<-32768)val=-32768; + *dest=val; + dest+=channels; + } + } + vorbis_fpu_restore(fpu); + + }else{ + + vorbis_fpu_setround(&fpu); + for(i=0;i32767)val=32767; + else if(val<-32768)val=-32768; + *dest=val+off; + dest+=channels; + } + } + vorbis_fpu_restore(fpu); + + } + }else if(bigendianp){ + + vorbis_fpu_setround(&fpu); + for(j=0;j32767)val=32767; + else if(val<-32768)val=-32768; + val+=off; + *buffer++=(val>>8); + *buffer++=(val&0xff); + } + vorbis_fpu_restore(fpu); + + }else{ + int val; + vorbis_fpu_setround(&fpu); + for(j=0;j32767)val=32767; + else if(val<-32768)val=-32768; + val+=off; + *buffer++=(val&0xff); + *buffer++=(val>>8); + } + vorbis_fpu_restore(fpu); + + } + } + } + + vorbis_synthesis_read(&vf->vd,samples); + vf->pcm_offset+=samples; + if(bitstream)*bitstream=vf->current_link; + return(samples*bytespersample); + }else{ + return(samples); + } +} + +/* input values: pcm_channels) a float vector per channel of output + length) the sample length being read by the app + + return values: <0) error/hole in data (OV_HOLE), partial open (OV_EINVAL) + 0) EOF + n) number of samples of PCM actually returned. The + below works on a packet-by-packet basis, so the + return length is not related to the 'length' passed + in, just guaranteed to fit. + + *section) set to the logical bitstream number */ + + + +long ov_read_float(OggVorbis_File *vf,float ***pcm_channels,int length, + int *bitstream){ + + if(vf->ready_stateready_state==INITSET){ + float **pcm; + long samples=vorbis_synthesis_pcmout(&vf->vd,&pcm); + if(samples){ + if(pcm_channels)*pcm_channels=pcm; + if(samples>length)samples=length; + vorbis_synthesis_read(&vf->vd,samples); + vf->pcm_offset+=samples; + if(bitstream)*bitstream=vf->current_link; + return samples; + + } + } + + /* suck in another packet */ + { + int ret=_fetch_and_process_packet(vf,NULL,1,1); + if(ret==OV_EOF)return(0); + if(ret<=0)return(ret); + } + + } +} + +extern float *vorbis_window(vorbis_dsp_state *v,int W); +extern void _analysis_output_always(char *base,int i,float *v,int n,int bark,int dB, + ogg_int64_t off); + +static void _ov_splice(float **pcm,float **lappcm, + int n1, int n2, + int ch1, int ch2, + float *w1, float *w2){ + int i,j; + float *w=w1; + int n=n1; + + if(n1>n2){ + n=n2; + w=w2; + } + + /* splice */ + for(j=0;jready_state==INITSET)break; + /* suck in another packet */ + { + int ret=_fetch_and_process_packet(vf,NULL,1,0); + if(ret<0 && ret!=OV_HOLE)return(ret); + } + } + return 0; +} + +/* make sure vf is INITSET and that we have a primed buffer; if + we're crosslapping at a stream section boundary, this also makes + sure we're sanity checking against the right stream information */ +static int _ov_initprime(OggVorbis_File *vf){ + vorbis_dsp_state *vd=&vf->vd; + while(1){ + if(vf->ready_state==INITSET) + if(vorbis_synthesis_pcmout(vd,NULL))break; + + /* suck in another packet */ + { + int ret=_fetch_and_process_packet(vf,NULL,1,0); + if(ret<0 && ret!=OV_HOLE)return(ret); + } + } + return 0; +} + +/* grab enough data for lapping from vf; this may be in the form of + unreturned, already-decoded pcm, remaining PCM we will need to + decode, or synthetic postextrapolation from last packets. */ +static void _ov_getlap(OggVorbis_File *vf,vorbis_info *vi,vorbis_dsp_state *vd, + float **lappcm,int lapsize){ + int lapcount=0,i; + float **pcm; + + /* try first to decode the lapping data */ + while(lapcountlapsize-lapcount)samples=lapsize-lapcount; + for(i=0;ichannels;i++) + memcpy(lappcm[i]+lapcount,pcm[i],sizeof(**pcm)*samples); + lapcount+=samples; + vorbis_synthesis_read(vd,samples); + }else{ + /* suck in another packet */ + int ret=_fetch_and_process_packet(vf,NULL,1,0); /* do *not* span */ + if(ret==OV_EOF)break; + } + } + if(lapcountvd,&pcm); + if(samples==0){ + for(i=0;ichannels;i++) + memset(lappcm[i]+lapcount,0,sizeof(**pcm)*lapsize-lapcount); + lapcount=lapsize; + }else{ + if(samples>lapsize-lapcount)samples=lapsize-lapcount; + for(i=0;ichannels;i++) + memcpy(lappcm[i]+lapcount,pcm[i],sizeof(**pcm)*samples); + lapcount+=samples; + } + } +} + +/* this sets up crosslapping of a sample by using trailing data from + sample 1 and lapping it into the windowing buffer of sample 2 */ +int ov_crosslap(OggVorbis_File *vf1, OggVorbis_File *vf2){ + vorbis_info *vi1,*vi2; + float **lappcm; + float **pcm; + float *w1,*w2; + int n1,n2,i,ret,hs1,hs2; + + if(vf1==vf2)return(0); /* degenerate case */ + if(vf1->ready_stateready_statechannels); + n1=vorbis_info_blocksize(vi1,0)>>(1+hs1); + n2=vorbis_info_blocksize(vi2,0)>>(1+hs2); + w1=vorbis_window(&vf1->vd,0); + w2=vorbis_window(&vf2->vd,0); + + for(i=0;ichannels;i++) + lappcm[i]=alloca(sizeof(**lappcm)*n1); + + _ov_getlap(vf1,vi1,&vf1->vd,lappcm,n1); + + /* have a lapping buffer from vf1; now to splice it into the lapping + buffer of vf2 */ + /* consolidate and expose the buffer. */ + vorbis_synthesis_lapout(&vf2->vd,&pcm); + _analysis_output_always("pcmL",0,pcm[0],n1*2,0,0,0); + _analysis_output_always("pcmR",0,pcm[1],n1*2,0,0,0); + + /* splice */ + _ov_splice(pcm,lappcm,n1,n2,vi1->channels,vi2->channels,w1,w2); + + /* done */ + return(0); +} + +static int _ov_64_seek_lap(OggVorbis_File *vf,ogg_int64_t pos, + int (*localseek)(OggVorbis_File *,ogg_int64_t)){ + vorbis_info *vi; + float **lappcm; + float **pcm; + float *w1,*w2; + int n1,n2,ch1,ch2,hs; + int i,ret; + + if(vf->ready_statechannels; + n1=vorbis_info_blocksize(vi,0)>>(1+hs); + w1=vorbis_window(&vf->vd,0); /* window arrays from libvorbis are + persistent; even if the decode state + from this link gets dumped, this + window array continues to exist */ + + lappcm=alloca(sizeof(*lappcm)*ch1); + for(i=0;ivd,lappcm,n1); + + /* have lapping data; seek and prime the buffer */ + ret=localseek(vf,pos); + if(ret)return ret; + ret=_ov_initprime(vf); + if(ret)return(ret); + + /* Guard against cross-link changes; they're perfectly legal */ + vi=ov_info(vf,-1); + ch2=vi->channels; + n2=vorbis_info_blocksize(vi,0)>>(1+hs); + w2=vorbis_window(&vf->vd,0); + + /* consolidate and expose the buffer. */ + vorbis_synthesis_lapout(&vf->vd,&pcm); + + /* splice */ + _ov_splice(pcm,lappcm,n1,n2,ch1,ch2,w1,w2); + + /* done */ + return(0); +} + +int ov_raw_seek_lap(OggVorbis_File *vf,ogg_int64_t pos){ + return _ov_64_seek_lap(vf,pos,ov_raw_seek); +} + +int ov_pcm_seek_lap(OggVorbis_File *vf,ogg_int64_t pos){ + return _ov_64_seek_lap(vf,pos,ov_pcm_seek); +} + +int ov_pcm_seek_page_lap(OggVorbis_File *vf,ogg_int64_t pos){ + return _ov_64_seek_lap(vf,pos,ov_pcm_seek_page); +} + +static int _ov_d_seek_lap(OggVorbis_File *vf,double pos, + int (*localseek)(OggVorbis_File *,double)){ + vorbis_info *vi; + float **lappcm; + float **pcm; + float *w1,*w2; + int n1,n2,ch1,ch2,hs; + int i,ret; + + if(vf->ready_statechannels; + n1=vorbis_info_blocksize(vi,0)>>(1+hs); + w1=vorbis_window(&vf->vd,0); /* window arrays from libvorbis are + persistent; even if the decode state + from this link gets dumped, this + window array continues to exist */ + + lappcm=alloca(sizeof(*lappcm)*ch1); + for(i=0;ivd,lappcm,n1); + + /* have lapping data; seek and prime the buffer */ + ret=localseek(vf,pos); + if(ret)return ret; + ret=_ov_initprime(vf); + if(ret)return(ret); + + /* Guard against cross-link changes; they're perfectly legal */ + vi=ov_info(vf,-1); + ch2=vi->channels; + n2=vorbis_info_blocksize(vi,0)>>(1+hs); + w2=vorbis_window(&vf->vd,0); + + /* consolidate and expose the buffer. */ + vorbis_synthesis_lapout(&vf->vd,&pcm); + + /* splice */ + _ov_splice(pcm,lappcm,n1,n2,ch1,ch2,w1,w2); + + /* done */ + return(0); +} + +int ov_time_seek_lap(OggVorbis_File *vf,double pos){ + return _ov_d_seek_lap(vf,pos,ov_time_seek); +} + +int ov_time_seek_page_lap(OggVorbis_File *vf,double pos){ + return _ov_d_seek_lap(vf,pos,ov_time_seek_page); +} diff --git a/Libraries/Vorbis/Files/lib/window.c b/Libraries/Vorbis/Files/lib/window.c new file mode 100644 index 000000000..abdee5bc5 --- /dev/null +++ b/Libraries/Vorbis/Files/lib/window.c @@ -0,0 +1,2136 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * + * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * + * by the XIPHOPHORUS Company http://www.xiph.org/ * + * * + ******************************************************************** + + function: window functions + last mod: $Id$ + + ********************************************************************/ + +#include +#include +#include "os.h" +#include "misc.h" + +static float vwin64[32] = { + 0.0009460463F, 0.0085006468F, 0.0235352254F, 0.0458950567F, + 0.0753351908F, 0.1115073077F, 0.1539457973F, 0.2020557475F, + 0.2551056759F, 0.3122276645F, 0.3724270287F, 0.4346027792F, + 0.4975789974F, 0.5601459521F, 0.6211085051F, 0.6793382689F, + 0.7338252629F, 0.7837245849F, 0.8283939355F, 0.8674186656F, + 0.9006222429F, 0.9280614787F, 0.9500073081F, 0.9669131782F, + 0.9793740220F, 0.9880792941F, 0.9937636139F, 0.9971582668F, + 0.9989462667F, 0.9997230082F, 0.9999638688F, 0.9999995525F, +}; + +static float vwin128[64] = { + 0.0002365472F, 0.0021280687F, 0.0059065254F, 0.0115626550F, + 0.0190823442F, 0.0284463735F, 0.0396300935F, 0.0526030430F, + 0.0673285281F, 0.0837631763F, 0.1018564887F, 0.1215504095F, + 0.1427789367F, 0.1654677960F, 0.1895342001F, 0.2148867160F, + 0.2414252576F, 0.2690412240F, 0.2976177952F, 0.3270303960F, + 0.3571473350F, 0.3878306189F, 0.4189369387F, 0.4503188188F, + 0.4818259135F, 0.5133064334F, 0.5446086751F, 0.5755826278F, + 0.6060816248F, 0.6359640047F, 0.6650947483F, 0.6933470543F, + 0.7206038179F, 0.7467589810F, 0.7717187213F, 0.7954024542F, + 0.8177436264F, 0.8386902831F, 0.8582053981F, 0.8762669622F, + 0.8928678298F, 0.9080153310F, 0.9217306608F, 0.9340480615F, + 0.9450138200F, 0.9546851041F, 0.9631286621F, 0.9704194171F, + 0.9766389810F, 0.9818741197F, 0.9862151938F, 0.9897546035F, + 0.9925852598F, 0.9947991032F, 0.9964856900F, 0.9977308602F, + 0.9986155015F, 0.9992144193F, 0.9995953200F, 0.9998179155F, + 0.9999331503F, 0.9999825563F, 0.9999977357F, 0.9999999720F, +}; + +static float vwin256[128] = { + 0.0000591390F, 0.0005321979F, 0.0014780301F, 0.0028960636F, + 0.0047854363F, 0.0071449926F, 0.0099732775F, 0.0132685298F, + 0.0170286741F, 0.0212513119F, 0.0259337111F, 0.0310727950F, + 0.0366651302F, 0.0427069140F, 0.0491939614F, 0.0561216907F, + 0.0634851102F, 0.0712788035F, 0.0794969160F, 0.0881331402F, + 0.0971807028F, 0.1066323515F, 0.1164803426F, 0.1267164297F, + 0.1373318534F, 0.1483173323F, 0.1596630553F, 0.1713586755F, + 0.1833933062F, 0.1957555184F, 0.2084333404F, 0.2214142599F, + 0.2346852280F, 0.2482326664F, 0.2620424757F, 0.2761000481F, + 0.2903902813F, 0.3048975959F, 0.3196059553F, 0.3344988887F, + 0.3495595160F, 0.3647705766F, 0.3801144597F, 0.3955732382F, + 0.4111287047F, 0.4267624093F, 0.4424557009F, 0.4581897696F, + 0.4739456913F, 0.4897044744F, 0.5054471075F, 0.5211546088F, + 0.5368080763F, 0.5523887395F, 0.5678780103F, 0.5832575361F, + 0.5985092508F, 0.6136154277F, 0.6285587300F, 0.6433222619F, + 0.6578896175F, 0.6722449294F, 0.6863729144F, 0.7002589187F, + 0.7138889597F, 0.7272497662F, 0.7403288154F, 0.7531143679F, + 0.7655954985F, 0.7777621249F, 0.7896050322F, 0.8011158947F, + 0.8122872932F, 0.8231127294F, 0.8335866365F, 0.8437043850F, + 0.8534622861F, 0.8628575905F, 0.8718884835F, 0.8805540765F, + 0.8888543947F, 0.8967903616F, 0.9043637797F, 0.9115773078F, + 0.9184344360F, 0.9249394562F, 0.9310974312F, 0.9369141608F, + 0.9423961446F, 0.9475505439F, 0.9523851406F, 0.9569082947F, + 0.9611289005F, 0.9650563408F, 0.9687004405F, 0.9720714191F, + 0.9751798427F, 0.9780365753F, 0.9806527301F, 0.9830396204F, + 0.9852087111F, 0.9871715701F, 0.9889398207F, 0.9905250941F, + 0.9919389832F, 0.9931929973F, 0.9942985174F, 0.9952667537F, + 0.9961087037F, 0.9968351119F, 0.9974564312F, 0.9979827858F, + 0.9984239359F, 0.9987892441F, 0.9990876435F, 0.9993276081F, + 0.9995171241F, 0.9996636648F, 0.9997741654F, 0.9998550016F, + 0.9999119692F, 0.9999502656F, 0.9999744742F, 0.9999885497F, + 0.9999958064F, 0.9999989077F, 0.9999998584F, 0.9999999983F, +}; + +static float vwin512[256] = { + 0.0000147849F, 0.0001330607F, 0.0003695946F, 0.0007243509F, + 0.0011972759F, 0.0017882983F, 0.0024973285F, 0.0033242588F, + 0.0042689632F, 0.0053312973F, 0.0065110982F, 0.0078081841F, + 0.0092223540F, 0.0107533880F, 0.0124010466F, 0.0141650703F, + 0.0160451800F, 0.0180410758F, 0.0201524373F, 0.0223789233F, + 0.0247201710F, 0.0271757958F, 0.0297453914F, 0.0324285286F, + 0.0352247556F, 0.0381335972F, 0.0411545545F, 0.0442871045F, + 0.0475306997F, 0.0508847676F, 0.0543487103F, 0.0579219038F, + 0.0616036982F, 0.0653934164F, 0.0692903546F, 0.0732937809F, + 0.0774029356F, 0.0816170305F, 0.0859352485F, 0.0903567428F, + 0.0948806375F, 0.0995060259F, 0.1042319712F, 0.1090575056F, + 0.1139816300F, 0.1190033137F, 0.1241214941F, 0.1293350764F, + 0.1346429333F, 0.1400439046F, 0.1455367974F, 0.1511203852F, + 0.1567934083F, 0.1625545735F, 0.1684025537F, 0.1743359881F, + 0.1803534820F, 0.1864536069F, 0.1926349000F, 0.1988958650F, + 0.2052349715F, 0.2116506555F, 0.2181413191F, 0.2247053313F, + 0.2313410275F, 0.2380467105F, 0.2448206500F, 0.2516610835F, + 0.2585662164F, 0.2655342226F, 0.2725632448F, 0.2796513950F, + 0.2867967551F, 0.2939973773F, 0.3012512852F, 0.3085564739F, + 0.3159109111F, 0.3233125375F, 0.3307592680F, 0.3382489922F, + 0.3457795756F, 0.3533488602F, 0.3609546657F, 0.3685947904F, + 0.3762670121F, 0.3839690896F, 0.3916987634F, 0.3994537572F, + 0.4072317788F, 0.4150305215F, 0.4228476653F, 0.4306808783F, + 0.4385278181F, 0.4463861329F, 0.4542534630F, 0.4621274424F, + 0.4700057001F, 0.4778858615F, 0.4857655502F, 0.4936423891F, + 0.5015140023F, 0.5093780165F, 0.5172320626F, 0.5250737772F, + 0.5329008043F, 0.5407107971F, 0.5485014192F, 0.5562703465F, + 0.5640152688F, 0.5717338914F, 0.5794239366F, 0.5870831457F, + 0.5947092801F, 0.6023001235F, 0.6098534829F, 0.6173671907F, + 0.6248391059F, 0.6322671161F, 0.6396491384F, 0.6469831217F, + 0.6542670475F, 0.6614989319F, 0.6686768267F, 0.6757988210F, + 0.6828630426F, 0.6898676592F, 0.6968108799F, 0.7036909564F, + 0.7105061843F, 0.7172549043F, 0.7239355032F, 0.7305464154F, + 0.7370861235F, 0.7435531598F, 0.7499461068F, 0.7562635986F, + 0.7625043214F, 0.7686670148F, 0.7747504721F, 0.7807535410F, + 0.7866751247F, 0.7925141825F, 0.7982697296F, 0.8039408387F, + 0.8095266395F, 0.8150263196F, 0.8204391248F, 0.8257643590F, + 0.8310013848F, 0.8361496236F, 0.8412085555F, 0.8461777194F, + 0.8510567129F, 0.8558451924F, 0.8605428730F, 0.8651495278F, + 0.8696649882F, 0.8740891432F, 0.8784219392F, 0.8826633797F, + 0.8868135244F, 0.8908724888F, 0.8948404441F, 0.8987176157F, + 0.9025042831F, 0.9062007791F, 0.9098074886F, 0.9133248482F, + 0.9167533451F, 0.9200935163F, 0.9233459472F, 0.9265112712F, + 0.9295901680F, 0.9325833632F, 0.9354916263F, 0.9383157705F, + 0.9410566504F, 0.9437151618F, 0.9462922398F, 0.9487888576F, + 0.9512060252F, 0.9535447882F, 0.9558062262F, 0.9579914516F, + 0.9601016078F, 0.9621378683F, 0.9641014348F, 0.9659935361F, + 0.9678154261F, 0.9695683830F, 0.9712537071F, 0.9728727198F, + 0.9744267618F, 0.9759171916F, 0.9773453842F, 0.9787127293F, + 0.9800206298F, 0.9812705006F, 0.9824637665F, 0.9836018613F, + 0.9846862258F, 0.9857183066F, 0.9866995544F, 0.9876314227F, + 0.9885153662F, 0.9893528393F, 0.9901452948F, 0.9908941823F, + 0.9916009470F, 0.9922670279F, 0.9928938570F, 0.9934828574F, + 0.9940354423F, 0.9945530133F, 0.9950369595F, 0.9954886562F, + 0.9959094633F, 0.9963007242F, 0.9966637649F, 0.9969998925F, + 0.9973103939F, 0.9975965351F, 0.9978595598F, 0.9981006885F, + 0.9983211172F, 0.9985220166F, 0.9987045311F, 0.9988697776F, + 0.9990188449F, 0.9991527924F, 0.9992726499F, 0.9993794157F, + 0.9994740570F, 0.9995575079F, 0.9996306699F, 0.9996944099F, + 0.9997495605F, 0.9997969190F, 0.9998372465F, 0.9998712678F, + 0.9998996704F, 0.9999231041F, 0.9999421807F, 0.9999574732F, + 0.9999695157F, 0.9999788026F, 0.9999857885F, 0.9999908879F, + 0.9999944746F, 0.9999968817F, 0.9999984010F, 0.9999992833F, + 0.9999997377F, 0.9999999317F, 0.9999999911F, 0.9999999999F, +}; + +static float vwin1024[512] = { + 0.0000036962F, 0.0000332659F, 0.0000924041F, 0.0001811086F, + 0.0002993761F, 0.0004472021F, 0.0006245811F, 0.0008315063F, + 0.0010679699F, 0.0013339631F, 0.0016294757F, 0.0019544965F, + 0.0023090133F, 0.0026930125F, 0.0031064797F, 0.0035493989F, + 0.0040217533F, 0.0045235250F, 0.0050546946F, 0.0056152418F, + 0.0062051451F, 0.0068243817F, 0.0074729278F, 0.0081507582F, + 0.0088578466F, 0.0095941655F, 0.0103596863F, 0.0111543789F, + 0.0119782122F, 0.0128311538F, 0.0137131701F, 0.0146242260F, + 0.0155642855F, 0.0165333111F, 0.0175312640F, 0.0185581042F, + 0.0196137903F, 0.0206982797F, 0.0218115284F, 0.0229534910F, + 0.0241241208F, 0.0253233698F, 0.0265511886F, 0.0278075263F, + 0.0290923308F, 0.0304055484F, 0.0317471241F, 0.0331170013F, + 0.0345151222F, 0.0359414274F, 0.0373958560F, 0.0388783456F, + 0.0403888325F, 0.0419272511F, 0.0434935347F, 0.0450876148F, + 0.0467094213F, 0.0483588828F, 0.0500359261F, 0.0517404765F, + 0.0534724575F, 0.0552317913F, 0.0570183983F, 0.0588321971F, + 0.0606731048F, 0.0625410369F, 0.0644359070F, 0.0663576272F, + 0.0683061077F, 0.0702812571F, 0.0722829821F, 0.0743111878F, + 0.0763657775F, 0.0784466526F, 0.0805537129F, 0.0826868561F, + 0.0848459782F, 0.0870309736F, 0.0892417345F, 0.0914781514F, + 0.0937401128F, 0.0960275056F, 0.0983402145F, 0.1006781223F, + 0.1030411101F, 0.1054290568F, 0.1078418397F, 0.1102793336F, + 0.1127414119F, 0.1152279457F, 0.1177388042F, 0.1202738544F, + 0.1228329618F, 0.1254159892F, 0.1280227980F, 0.1306532471F, + 0.1333071937F, 0.1359844927F, 0.1386849970F, 0.1414085575F, + 0.1441550230F, 0.1469242403F, 0.1497160539F, 0.1525303063F, + 0.1553668381F, 0.1582254875F, 0.1611060909F, 0.1640084822F, + 0.1669324936F, 0.1698779549F, 0.1728446939F, 0.1758325362F, + 0.1788413055F, 0.1818708232F, 0.1849209084F, 0.1879913785F, + 0.1910820485F, 0.1941927312F, 0.1973232376F, 0.2004733764F, + 0.2036429541F, 0.2068317752F, 0.2100396421F, 0.2132663552F, + 0.2165117125F, 0.2197755102F, 0.2230575422F, 0.2263576007F, + 0.2296754753F, 0.2330109540F, 0.2363638225F, 0.2397338646F, + 0.2431208619F, 0.2465245941F, 0.2499448389F, 0.2533813719F, + 0.2568339669F, 0.2603023956F, 0.2637864277F, 0.2672858312F, + 0.2708003718F, 0.2743298135F, 0.2778739186F, 0.2814324472F, + 0.2850051576F, 0.2885918065F, 0.2921921485F, 0.2958059366F, + 0.2994329219F, 0.3030728538F, 0.3067254799F, 0.3103905462F, + 0.3140677969F, 0.3177569747F, 0.3214578205F, 0.3251700736F, + 0.3288934718F, 0.3326277513F, 0.3363726468F, 0.3401278914F, + 0.3438932168F, 0.3476683533F, 0.3514530297F, 0.3552469734F, + 0.3590499106F, 0.3628615659F, 0.3666816630F, 0.3705099239F, + 0.3743460698F, 0.3781898204F, 0.3820408945F, 0.3858990095F, + 0.3897638820F, 0.3936352274F, 0.3975127601F, 0.4013961936F, + 0.4052852405F, 0.4091796123F, 0.4130790198F, 0.4169831732F, + 0.4208917815F, 0.4248045534F, 0.4287211965F, 0.4326414181F, + 0.4365649248F, 0.4404914225F, 0.4444206167F, 0.4483522125F, + 0.4522859146F, 0.4562214270F, 0.4601584538F, 0.4640966984F, + 0.4680358644F, 0.4719756548F, 0.4759157726F, 0.4798559209F, + 0.4837958024F, 0.4877351199F, 0.4916735765F, 0.4956108751F, + 0.4995467188F, 0.5034808109F, 0.5074128550F, 0.5113425550F, + 0.5152696149F, 0.5191937395F, 0.5231146336F, 0.5270320028F, + 0.5309455530F, 0.5348549910F, 0.5387600239F, 0.5426603597F, + 0.5465557070F, 0.5504457754F, 0.5543302752F, 0.5582089175F, + 0.5620814145F, 0.5659474793F, 0.5698068262F, 0.5736591704F, + 0.5775042283F, 0.5813417176F, 0.5851713571F, 0.5889928670F, + 0.5928059689F, 0.5966103856F, 0.6004058415F, 0.6041920626F, + 0.6079687761F, 0.6117357113F, 0.6154925986F, 0.6192391705F, + 0.6229751612F, 0.6267003064F, 0.6304143441F, 0.6341170137F, + 0.6378080569F, 0.6414872173F, 0.6451542405F, 0.6488088741F, + 0.6524508681F, 0.6560799742F, 0.6596959469F, 0.6632985424F, + 0.6668875197F, 0.6704626398F, 0.6740236662F, 0.6775703649F, + 0.6811025043F, 0.6846198554F, 0.6881221916F, 0.6916092892F, + 0.6950809269F, 0.6985368861F, 0.7019769510F, 0.7054009085F, + 0.7088085484F, 0.7121996632F, 0.7155740484F, 0.7189315023F, + 0.7222718263F, 0.7255948245F, 0.7289003043F, 0.7321880760F, + 0.7354579530F, 0.7387097518F, 0.7419432921F, 0.7451583966F, + 0.7483548915F, 0.7515326059F, 0.7546913723F, 0.7578310265F, + 0.7609514077F, 0.7640523581F, 0.7671337237F, 0.7701953535F, + 0.7732371001F, 0.7762588195F, 0.7792603711F, 0.7822416178F, + 0.7852024259F, 0.7881426654F, 0.7910622097F, 0.7939609356F, + 0.7968387237F, 0.7996954579F, 0.8025310261F, 0.8053453193F, + 0.8081382324F, 0.8109096638F, 0.8136595156F, 0.8163876936F, + 0.8190941071F, 0.8217786690F, 0.8244412960F, 0.8270819086F, + 0.8297004305F, 0.8322967896F, 0.8348709171F, 0.8374227481F, + 0.8399522213F, 0.8424592789F, 0.8449438672F, 0.8474059356F, + 0.8498454378F, 0.8522623306F, 0.8546565748F, 0.8570281348F, + 0.8593769787F, 0.8617030779F, 0.8640064080F, 0.8662869477F, + 0.8685446796F, 0.8707795899F, 0.8729916682F, 0.8751809079F, + 0.8773473059F, 0.8794908626F, 0.8816115819F, 0.8837094713F, + 0.8857845418F, 0.8878368079F, 0.8898662874F, 0.8918730019F, + 0.8938569760F, 0.8958182380F, 0.8977568194F, 0.8996727552F, + 0.9015660837F, 0.9034368465F, 0.9052850885F, 0.9071108577F, + 0.9089142057F, 0.9106951869F, 0.9124538591F, 0.9141902832F, + 0.9159045233F, 0.9175966464F, 0.9192667228F, 0.9209148257F, + 0.9225410313F, 0.9241454187F, 0.9257280701F, 0.9272890704F, + 0.9288285075F, 0.9303464720F, 0.9318430576F, 0.9333183603F, + 0.9347724792F, 0.9362055158F, 0.9376175745F, 0.9390087622F, + 0.9403791881F, 0.9417289644F, 0.9430582055F, 0.9443670283F, + 0.9456555521F, 0.9469238986F, 0.9481721917F, 0.9494005577F, + 0.9506091252F, 0.9517980248F, 0.9529673894F, 0.9541173540F, + 0.9552480557F, 0.9563596334F, 0.9574522282F, 0.9585259830F, + 0.9595810428F, 0.9606175542F, 0.9616356656F, 0.9626355274F, + 0.9636172915F, 0.9645811114F, 0.9655271425F, 0.9664555414F, + 0.9673664664F, 0.9682600774F, 0.9691365355F, 0.9699960034F, + 0.9708386448F, 0.9716646250F, 0.9724741103F, 0.9732672685F, + 0.9740442683F, 0.9748052795F, 0.9755504729F, 0.9762800205F, + 0.9769940950F, 0.9776928703F, 0.9783765210F, 0.9790452223F, + 0.9796991504F, 0.9803384823F, 0.9809633954F, 0.9815740679F, + 0.9821706784F, 0.9827534063F, 0.9833224312F, 0.9838779332F, + 0.9844200928F, 0.9849490910F, 0.9854651087F, 0.9859683274F, + 0.9864589286F, 0.9869370940F, 0.9874030054F, 0.9878568447F, + 0.9882987937F, 0.9887290343F, 0.9891477481F, 0.9895551169F, + 0.9899513220F, 0.9903365446F, 0.9907109658F, 0.9910747662F, + 0.9914281260F, 0.9917712252F, 0.9921042433F, 0.9924273593F, + 0.9927407516F, 0.9930445982F, 0.9933390763F, 0.9936243626F, + 0.9939006331F, 0.9941680631F, 0.9944268269F, 0.9946770982F, + 0.9949190498F, 0.9951528537F, 0.9953786808F, 0.9955967011F, + 0.9958070836F, 0.9960099963F, 0.9962056061F, 0.9963940787F, + 0.9965755786F, 0.9967502693F, 0.9969183129F, 0.9970798704F, + 0.9972351013F, 0.9973841640F, 0.9975272151F, 0.9976644103F, + 0.9977959036F, 0.9979218476F, 0.9980423932F, 0.9981576901F, + 0.9982678862F, 0.9983731278F, 0.9984735596F, 0.9985693247F, + 0.9986605645F, 0.9987474186F, 0.9988300248F, 0.9989085193F, + 0.9989830364F, 0.9990537085F, 0.9991206662F, 0.9991840382F, + 0.9992439513F, 0.9993005303F, 0.9993538982F, 0.9994041757F, + 0.9994514817F, 0.9994959330F, 0.9995376444F, 0.9995767286F, + 0.9996132960F, 0.9996474550F, 0.9996793121F, 0.9997089710F, + 0.9997365339F, 0.9997621003F, 0.9997857677F, 0.9998076311F, + 0.9998277836F, 0.9998463156F, 0.9998633155F, 0.9998788692F, + 0.9998930603F, 0.9999059701F, 0.9999176774F, 0.9999282586F, + 0.9999377880F, 0.9999463370F, 0.9999539749F, 0.9999607685F, + 0.9999667820F, 0.9999720773F, 0.9999767136F, 0.9999807479F, + 0.9999842344F, 0.9999872249F, 0.9999897688F, 0.9999919127F, + 0.9999937009F, 0.9999951749F, 0.9999963738F, 0.9999973342F, + 0.9999980900F, 0.9999986724F, 0.9999991103F, 0.9999994297F, + 0.9999996543F, 0.9999998049F, 0.9999999000F, 0.9999999552F, + 0.9999999836F, 0.9999999957F, 0.9999999994F, 1.0000000000F, +}; + +static float vwin2048[1024] = { + 0.0000009241F, 0.0000083165F, 0.0000231014F, 0.0000452785F, + 0.0000748476F, 0.0001118085F, 0.0001561608F, 0.0002079041F, + 0.0002670379F, 0.0003335617F, 0.0004074748F, 0.0004887765F, + 0.0005774661F, 0.0006735427F, 0.0007770054F, 0.0008878533F, + 0.0010060853F, 0.0011317002F, 0.0012646969F, 0.0014050742F, + 0.0015528307F, 0.0017079650F, 0.0018704756F, 0.0020403610F, + 0.0022176196F, 0.0024022497F, 0.0025942495F, 0.0027936173F, + 0.0030003511F, 0.0032144490F, 0.0034359088F, 0.0036647286F, + 0.0039009061F, 0.0041444391F, 0.0043953253F, 0.0046535621F, + 0.0049191472F, 0.0051920781F, 0.0054723520F, 0.0057599664F, + 0.0060549184F, 0.0063572052F, 0.0066668239F, 0.0069837715F, + 0.0073080449F, 0.0076396410F, 0.0079785566F, 0.0083247884F, + 0.0086783330F, 0.0090391871F, 0.0094073470F, 0.0097828092F, + 0.0101655700F, 0.0105556258F, 0.0109529726F, 0.0113576065F, + 0.0117695237F, 0.0121887200F, 0.0126151913F, 0.0130489335F, + 0.0134899422F, 0.0139382130F, 0.0143937415F, 0.0148565233F, + 0.0153265536F, 0.0158038279F, 0.0162883413F, 0.0167800889F, + 0.0172790660F, 0.0177852675F, 0.0182986882F, 0.0188193231F, + 0.0193471668F, 0.0198822141F, 0.0204244594F, 0.0209738974F, + 0.0215305225F, 0.0220943289F, 0.0226653109F, 0.0232434627F, + 0.0238287784F, 0.0244212519F, 0.0250208772F, 0.0256276481F, + 0.0262415582F, 0.0268626014F, 0.0274907711F, 0.0281260608F, + 0.0287684638F, 0.0294179736F, 0.0300745833F, 0.0307382859F, + 0.0314090747F, 0.0320869424F, 0.0327718819F, 0.0334638860F, + 0.0341629474F, 0.0348690586F, 0.0355822122F, 0.0363024004F, + 0.0370296157F, 0.0377638502F, 0.0385050960F, 0.0392533451F, + 0.0400085896F, 0.0407708211F, 0.0415400315F, 0.0423162123F, + 0.0430993552F, 0.0438894515F, 0.0446864926F, 0.0454904698F, + 0.0463013742F, 0.0471191969F, 0.0479439288F, 0.0487755607F, + 0.0496140836F, 0.0504594879F, 0.0513117642F, 0.0521709031F, + 0.0530368949F, 0.0539097297F, 0.0547893979F, 0.0556758894F, + 0.0565691941F, 0.0574693019F, 0.0583762026F, 0.0592898858F, + 0.0602103410F, 0.0611375576F, 0.0620715250F, 0.0630122324F, + 0.0639596688F, 0.0649138234F, 0.0658746848F, 0.0668422421F, + 0.0678164838F, 0.0687973985F, 0.0697849746F, 0.0707792005F, + 0.0717800645F, 0.0727875547F, 0.0738016591F, 0.0748223656F, + 0.0758496620F, 0.0768835359F, 0.0779239751F, 0.0789709668F, + 0.0800244985F, 0.0810845574F, 0.0821511306F, 0.0832242052F, + 0.0843037679F, 0.0853898056F, 0.0864823050F, 0.0875812525F, + 0.0886866347F, 0.0897984378F, 0.0909166480F, 0.0920412513F, + 0.0931722338F, 0.0943095813F, 0.0954532795F, 0.0966033140F, + 0.0977596702F, 0.0989223336F, 0.1000912894F, 0.1012665227F, + 0.1024480185F, 0.1036357616F, 0.1048297369F, 0.1060299290F, + 0.1072363224F, 0.1084489014F, 0.1096676504F, 0.1108925534F, + 0.1121235946F, 0.1133607577F, 0.1146040267F, 0.1158533850F, + 0.1171088163F, 0.1183703040F, 0.1196378312F, 0.1209113812F, + 0.1221909370F, 0.1234764815F, 0.1247679974F, 0.1260654674F, + 0.1273688740F, 0.1286781995F, 0.1299934263F, 0.1313145365F, + 0.1326415121F, 0.1339743349F, 0.1353129866F, 0.1366574490F, + 0.1380077035F, 0.1393637315F, 0.1407255141F, 0.1420930325F, + 0.1434662677F, 0.1448452004F, 0.1462298115F, 0.1476200814F, + 0.1490159906F, 0.1504175195F, 0.1518246482F, 0.1532373569F, + 0.1546556253F, 0.1560794333F, 0.1575087606F, 0.1589435866F, + 0.1603838909F, 0.1618296526F, 0.1632808509F, 0.1647374648F, + 0.1661994731F, 0.1676668546F, 0.1691395880F, 0.1706176516F, + 0.1721010238F, 0.1735896829F, 0.1750836068F, 0.1765827736F, + 0.1780871610F, 0.1795967468F, 0.1811115084F, 0.1826314234F, + 0.1841564689F, 0.1856866221F, 0.1872218600F, 0.1887621595F, + 0.1903074974F, 0.1918578503F, 0.1934131947F, 0.1949735068F, + 0.1965387630F, 0.1981089393F, 0.1996840117F, 0.2012639560F, + 0.2028487479F, 0.2044383630F, 0.2060327766F, 0.2076319642F, + 0.2092359007F, 0.2108445614F, 0.2124579211F, 0.2140759545F, + 0.2156986364F, 0.2173259411F, 0.2189578432F, 0.2205943168F, + 0.2222353361F, 0.2238808751F, 0.2255309076F, 0.2271854073F, + 0.2288443480F, 0.2305077030F, 0.2321754457F, 0.2338475493F, + 0.2355239869F, 0.2372047315F, 0.2388897560F, 0.2405790329F, + 0.2422725350F, 0.2439702347F, 0.2456721043F, 0.2473781159F, + 0.2490882418F, 0.2508024539F, 0.2525207240F, 0.2542430237F, + 0.2559693248F, 0.2576995986F, 0.2594338166F, 0.2611719498F, + 0.2629139695F, 0.2646598466F, 0.2664095520F, 0.2681630564F, + 0.2699203304F, 0.2716813445F, 0.2734460691F, 0.2752144744F, + 0.2769865307F, 0.2787622079F, 0.2805414760F, 0.2823243047F, + 0.2841106637F, 0.2859005227F, 0.2876938509F, 0.2894906179F, + 0.2912907928F, 0.2930943447F, 0.2949012426F, 0.2967114554F, + 0.2985249520F, 0.3003417009F, 0.3021616708F, 0.3039848301F, + 0.3058111471F, 0.3076405901F, 0.3094731273F, 0.3113087266F, + 0.3131473560F, 0.3149889833F, 0.3168335762F, 0.3186811024F, + 0.3205315294F, 0.3223848245F, 0.3242409552F, 0.3260998886F, + 0.3279615918F, 0.3298260319F, 0.3316931758F, 0.3335629903F, + 0.3354354423F, 0.3373104982F, 0.3391881247F, 0.3410682882F, + 0.3429509551F, 0.3448360917F, 0.3467236642F, 0.3486136387F, + 0.3505059811F, 0.3524006575F, 0.3542976336F, 0.3561968753F, + 0.3580983482F, 0.3600020179F, 0.3619078499F, 0.3638158096F, + 0.3657258625F, 0.3676379737F, 0.3695521086F, 0.3714682321F, + 0.3733863094F, 0.3753063055F, 0.3772281852F, 0.3791519134F, + 0.3810774548F, 0.3830047742F, 0.3849338362F, 0.3868646053F, + 0.3887970459F, 0.3907311227F, 0.3926667998F, 0.3946040417F, + 0.3965428125F, 0.3984830765F, 0.4004247978F, 0.4023679403F, + 0.4043124683F, 0.4062583455F, 0.4082055359F, 0.4101540034F, + 0.4121037117F, 0.4140546246F, 0.4160067058F, 0.4179599190F, + 0.4199142277F, 0.4218695956F, 0.4238259861F, 0.4257833627F, + 0.4277416888F, 0.4297009279F, 0.4316610433F, 0.4336219983F, + 0.4355837562F, 0.4375462803F, 0.4395095337F, 0.4414734797F, + 0.4434380815F, 0.4454033021F, 0.4473691046F, 0.4493354521F, + 0.4513023078F, 0.4532696345F, 0.4552373954F, 0.4572055533F, + 0.4591740713F, 0.4611429123F, 0.4631120393F, 0.4650814151F, + 0.4670510028F, 0.4690207650F, 0.4709906649F, 0.4729606651F, + 0.4749307287F, 0.4769008185F, 0.4788708972F, 0.4808409279F, + 0.4828108732F, 0.4847806962F, 0.4867503597F, 0.4887198264F, + 0.4906890593F, 0.4926580213F, 0.4946266753F, 0.4965949840F, + 0.4985629105F, 0.5005304176F, 0.5024974683F, 0.5044640255F, + 0.5064300522F, 0.5083955114F, 0.5103603659F, 0.5123245790F, + 0.5142881136F, 0.5162509328F, 0.5182129997F, 0.5201742774F, + 0.5221347290F, 0.5240943178F, 0.5260530070F, 0.5280107598F, + 0.5299675395F, 0.5319233095F, 0.5338780330F, 0.5358316736F, + 0.5377841946F, 0.5397355596F, 0.5416857320F, 0.5436346755F, + 0.5455823538F, 0.5475287304F, 0.5494737691F, 0.5514174337F, + 0.5533596881F, 0.5553004962F, 0.5572398218F, 0.5591776291F, + 0.5611138821F, 0.5630485449F, 0.5649815818F, 0.5669129570F, + 0.5688426349F, 0.5707705799F, 0.5726967564F, 0.5746211290F, + 0.5765436624F, 0.5784643212F, 0.5803830702F, 0.5822998743F, + 0.5842146984F, 0.5861275076F, 0.5880382669F, 0.5899469416F, + 0.5918534968F, 0.5937578981F, 0.5956601107F, 0.5975601004F, + 0.5994578326F, 0.6013532732F, 0.6032463880F, 0.6051371429F, + 0.6070255039F, 0.6089114372F, 0.6107949090F, 0.6126758856F, + 0.6145543334F, 0.6164302191F, 0.6183035092F, 0.6201741706F, + 0.6220421700F, 0.6239074745F, 0.6257700513F, 0.6276298674F, + 0.6294868903F, 0.6313410873F, 0.6331924262F, 0.6350408745F, + 0.6368864001F, 0.6387289710F, 0.6405685552F, 0.6424051209F, + 0.6442386364F, 0.6460690702F, 0.6478963910F, 0.6497205673F, + 0.6515415682F, 0.6533593625F, 0.6551739194F, 0.6569852082F, + 0.6587931984F, 0.6605978593F, 0.6623991609F, 0.6641970728F, + 0.6659915652F, 0.6677826081F, 0.6695701718F, 0.6713542268F, + 0.6731347437F, 0.6749116932F, 0.6766850461F, 0.6784547736F, + 0.6802208469F, 0.6819832374F, 0.6837419164F, 0.6854968559F, + 0.6872480275F, 0.6889954034F, 0.6907389556F, 0.6924786566F, + 0.6942144788F, 0.6959463950F, 0.6976743780F, 0.6993984008F, + 0.7011184365F, 0.7028344587F, 0.7045464407F, 0.7062543564F, + 0.7079581796F, 0.7096578844F, 0.7113534450F, 0.7130448359F, + 0.7147320316F, 0.7164150070F, 0.7180937371F, 0.7197681970F, + 0.7214383620F, 0.7231042077F, 0.7247657098F, 0.7264228443F, + 0.7280755871F, 0.7297239147F, 0.7313678035F, 0.7330072301F, + 0.7346421715F, 0.7362726046F, 0.7378985069F, 0.7395198556F, + 0.7411366285F, 0.7427488034F, 0.7443563584F, 0.7459592717F, + 0.7475575218F, 0.7491510873F, 0.7507399471F, 0.7523240803F, + 0.7539034661F, 0.7554780839F, 0.7570479136F, 0.7586129349F, + 0.7601731279F, 0.7617284730F, 0.7632789506F, 0.7648245416F, + 0.7663652267F, 0.7679009872F, 0.7694318044F, 0.7709576599F, + 0.7724785354F, 0.7739944130F, 0.7755052749F, 0.7770111035F, + 0.7785118815F, 0.7800075916F, 0.7814982170F, 0.7829837410F, + 0.7844641472F, 0.7859394191F, 0.7874095408F, 0.7888744965F, + 0.7903342706F, 0.7917888476F, 0.7932382124F, 0.7946823501F, + 0.7961212460F, 0.7975548855F, 0.7989832544F, 0.8004063386F, + 0.8018241244F, 0.8032365981F, 0.8046437463F, 0.8060455560F, + 0.8074420141F, 0.8088331080F, 0.8102188253F, 0.8115991536F, + 0.8129740810F, 0.8143435957F, 0.8157076861F, 0.8170663409F, + 0.8184195489F, 0.8197672994F, 0.8211095817F, 0.8224463853F, + 0.8237777001F, 0.8251035161F, 0.8264238235F, 0.8277386129F, + 0.8290478750F, 0.8303516008F, 0.8316497814F, 0.8329424083F, + 0.8342294731F, 0.8355109677F, 0.8367868841F, 0.8380572148F, + 0.8393219523F, 0.8405810893F, 0.8418346190F, 0.8430825345F, + 0.8443248294F, 0.8455614974F, 0.8467925323F, 0.8480179285F, + 0.8492376802F, 0.8504517822F, 0.8516602292F, 0.8528630164F, + 0.8540601391F, 0.8552515928F, 0.8564373733F, 0.8576174766F, + 0.8587918990F, 0.8599606368F, 0.8611236868F, 0.8622810460F, + 0.8634327113F, 0.8645786802F, 0.8657189504F, 0.8668535195F, + 0.8679823857F, 0.8691055472F, 0.8702230025F, 0.8713347503F, + 0.8724407896F, 0.8735411194F, 0.8746357394F, 0.8757246489F, + 0.8768078479F, 0.8778853364F, 0.8789571146F, 0.8800231832F, + 0.8810835427F, 0.8821381942F, 0.8831871387F, 0.8842303777F, + 0.8852679127F, 0.8862997456F, 0.8873258784F, 0.8883463132F, + 0.8893610527F, 0.8903700994F, 0.8913734562F, 0.8923711263F, + 0.8933631129F, 0.8943494196F, 0.8953300500F, 0.8963050083F, + 0.8972742985F, 0.8982379249F, 0.8991958922F, 0.9001482052F, + 0.9010948688F, 0.9020358883F, 0.9029712690F, 0.9039010165F, + 0.9048251367F, 0.9057436357F, 0.9066565195F, 0.9075637946F, + 0.9084654678F, 0.9093615456F, 0.9102520353F, 0.9111369440F, + 0.9120162792F, 0.9128900484F, 0.9137582595F, 0.9146209204F, + 0.9154780394F, 0.9163296248F, 0.9171756853F, 0.9180162296F, + 0.9188512667F, 0.9196808057F, 0.9205048559F, 0.9213234270F, + 0.9221365285F, 0.9229441704F, 0.9237463629F, 0.9245431160F, + 0.9253344404F, 0.9261203465F, 0.9269008453F, 0.9276759477F, + 0.9284456648F, 0.9292100080F, 0.9299689889F, 0.9307226190F, + 0.9314709103F, 0.9322138747F, 0.9329515245F, 0.9336838721F, + 0.9344109300F, 0.9351327108F, 0.9358492275F, 0.9365604931F, + 0.9372665208F, 0.9379673239F, 0.9386629160F, 0.9393533107F, + 0.9400385220F, 0.9407185637F, 0.9413934501F, 0.9420631954F, + 0.9427278141F, 0.9433873208F, 0.9440417304F, 0.9446910576F, + 0.9453353176F, 0.9459745255F, 0.9466086968F, 0.9472378469F, + 0.9478619915F, 0.9484811463F, 0.9490953274F, 0.9497045506F, + 0.9503088323F, 0.9509081888F, 0.9515026365F, 0.9520921921F, + 0.9526768723F, 0.9532566940F, 0.9538316742F, 0.9544018300F, + 0.9549671786F, 0.9555277375F, 0.9560835241F, 0.9566345562F, + 0.9571808513F, 0.9577224275F, 0.9582593027F, 0.9587914949F, + 0.9593190225F, 0.9598419038F, 0.9603601571F, 0.9608738012F, + 0.9613828546F, 0.9618873361F, 0.9623872646F, 0.9628826591F, + 0.9633735388F, 0.9638599227F, 0.9643418303F, 0.9648192808F, + 0.9652922939F, 0.9657608890F, 0.9662250860F, 0.9666849046F, + 0.9671403646F, 0.9675914861F, 0.9680382891F, 0.9684807937F, + 0.9689190202F, 0.9693529890F, 0.9697827203F, 0.9702082347F, + 0.9706295529F, 0.9710466953F, 0.9714596828F, 0.9718685362F, + 0.9722732762F, 0.9726739240F, 0.9730705005F, 0.9734630267F, + 0.9738515239F, 0.9742360134F, 0.9746165163F, 0.9749930540F, + 0.9753656481F, 0.9757343198F, 0.9760990909F, 0.9764599829F, + 0.9768170175F, 0.9771702164F, 0.9775196013F, 0.9778651941F, + 0.9782070167F, 0.9785450909F, 0.9788794388F, 0.9792100824F, + 0.9795370437F, 0.9798603449F, 0.9801800080F, 0.9804960554F, + 0.9808085092F, 0.9811173916F, 0.9814227251F, 0.9817245318F, + 0.9820228343F, 0.9823176549F, 0.9826090160F, 0.9828969402F, + 0.9831814498F, 0.9834625674F, 0.9837403156F, 0.9840147169F, + 0.9842857939F, 0.9845535692F, 0.9848180654F, 0.9850793052F, + 0.9853373113F, 0.9855921062F, 0.9858437127F, 0.9860921535F, + 0.9863374512F, 0.9865796287F, 0.9868187085F, 0.9870547136F, + 0.9872876664F, 0.9875175899F, 0.9877445067F, 0.9879684396F, + 0.9881894112F, 0.9884074444F, 0.9886225619F, 0.9888347863F, + 0.9890441404F, 0.9892506468F, 0.9894543284F, 0.9896552077F, + 0.9898533074F, 0.9900486502F, 0.9902412587F, 0.9904311555F, + 0.9906183633F, 0.9908029045F, 0.9909848019F, 0.9911640779F, + 0.9913407550F, 0.9915148557F, 0.9916864025F, 0.9918554179F, + 0.9920219241F, 0.9921859437F, 0.9923474989F, 0.9925066120F, + 0.9926633054F, 0.9928176012F, 0.9929695218F, 0.9931190891F, + 0.9932663254F, 0.9934112527F, 0.9935538932F, 0.9936942686F, + 0.9938324012F, 0.9939683126F, 0.9941020248F, 0.9942335597F, + 0.9943629388F, 0.9944901841F, 0.9946153170F, 0.9947383593F, + 0.9948593325F, 0.9949782579F, 0.9950951572F, 0.9952100516F, + 0.9953229625F, 0.9954339111F, 0.9955429186F, 0.9956500062F, + 0.9957551948F, 0.9958585056F, 0.9959599593F, 0.9960595769F, + 0.9961573792F, 0.9962533869F, 0.9963476206F, 0.9964401009F, + 0.9965308483F, 0.9966198833F, 0.9967072261F, 0.9967928971F, + 0.9968769164F, 0.9969593041F, 0.9970400804F, 0.9971192651F, + 0.9971968781F, 0.9972729391F, 0.9973474680F, 0.9974204842F, + 0.9974920074F, 0.9975620569F, 0.9976306521F, 0.9976978122F, + 0.9977635565F, 0.9978279039F, 0.9978908736F, 0.9979524842F, + 0.9980127547F, 0.9980717037F, 0.9981293499F, 0.9981857116F, + 0.9982408073F, 0.9982946554F, 0.9983472739F, 0.9983986810F, + 0.9984488947F, 0.9984979328F, 0.9985458132F, 0.9985925534F, + 0.9986381711F, 0.9986826838F, 0.9987261086F, 0.9987684630F, + 0.9988097640F, 0.9988500286F, 0.9988892738F, 0.9989275163F, + 0.9989647727F, 0.9990010597F, 0.9990363938F, 0.9990707911F, + 0.9991042679F, 0.9991368404F, 0.9991685244F, 0.9991993358F, + 0.9992292905F, 0.9992584038F, 0.9992866914F, 0.9993141686F, + 0.9993408506F, 0.9993667526F, 0.9993918895F, 0.9994162761F, + 0.9994399273F, 0.9994628576F, 0.9994850815F, 0.9995066133F, + 0.9995274672F, 0.9995476574F, 0.9995671978F, 0.9995861021F, + 0.9996043841F, 0.9996220573F, 0.9996391352F, 0.9996556310F, + 0.9996715579F, 0.9996869288F, 0.9997017568F, 0.9997160543F, + 0.9997298342F, 0.9997431088F, 0.9997558905F, 0.9997681914F, + 0.9997800236F, 0.9997913990F, 0.9998023292F, 0.9998128261F, + 0.9998229009F, 0.9998325650F, 0.9998418296F, 0.9998507058F, + 0.9998592044F, 0.9998673362F, 0.9998751117F, 0.9998825415F, + 0.9998896358F, 0.9998964047F, 0.9999028584F, 0.9999090066F, + 0.9999148590F, 0.9999204253F, 0.9999257148F, 0.9999307368F, + 0.9999355003F, 0.9999400144F, 0.9999442878F, 0.9999483293F, + 0.9999521472F, 0.9999557499F, 0.9999591457F, 0.9999623426F, + 0.9999653483F, 0.9999681708F, 0.9999708175F, 0.9999732959F, + 0.9999756132F, 0.9999777765F, 0.9999797928F, 0.9999816688F, + 0.9999834113F, 0.9999850266F, 0.9999865211F, 0.9999879009F, + 0.9999891721F, 0.9999903405F, 0.9999914118F, 0.9999923914F, + 0.9999932849F, 0.9999940972F, 0.9999948336F, 0.9999954989F, + 0.9999960978F, 0.9999966349F, 0.9999971146F, 0.9999975411F, + 0.9999979185F, 0.9999982507F, 0.9999985414F, 0.9999987944F, + 0.9999990129F, 0.9999992003F, 0.9999993596F, 0.9999994939F, + 0.9999996059F, 0.9999996981F, 0.9999997732F, 0.9999998333F, + 0.9999998805F, 0.9999999170F, 0.9999999444F, 0.9999999643F, + 0.9999999784F, 0.9999999878F, 0.9999999937F, 0.9999999972F, + 0.9999999990F, 0.9999999997F, 1.0000000000F, 1.0000000000F, +}; + +static float vwin4096[2048] = { + 0.0000002310F, 0.0000020791F, 0.0000057754F, 0.0000113197F, + 0.0000187121F, 0.0000279526F, 0.0000390412F, 0.0000519777F, + 0.0000667623F, 0.0000833949F, 0.0001018753F, 0.0001222036F, + 0.0001443798F, 0.0001684037F, 0.0001942754F, 0.0002219947F, + 0.0002515616F, 0.0002829761F, 0.0003162380F, 0.0003513472F, + 0.0003883038F, 0.0004271076F, 0.0004677584F, 0.0005102563F, + 0.0005546011F, 0.0006007928F, 0.0006488311F, 0.0006987160F, + 0.0007504474F, 0.0008040251F, 0.0008594490F, 0.0009167191F, + 0.0009758351F, 0.0010367969F, 0.0010996044F, 0.0011642574F, + 0.0012307558F, 0.0012990994F, 0.0013692880F, 0.0014413216F, + 0.0015151998F, 0.0015909226F, 0.0016684898F, 0.0017479011F, + 0.0018291565F, 0.0019122556F, 0.0019971983F, 0.0020839845F, + 0.0021726138F, 0.0022630861F, 0.0023554012F, 0.0024495588F, + 0.0025455588F, 0.0026434008F, 0.0027430847F, 0.0028446103F, + 0.0029479772F, 0.0030531853F, 0.0031602342F, 0.0032691238F, + 0.0033798538F, 0.0034924239F, 0.0036068338F, 0.0037230833F, + 0.0038411721F, 0.0039610999F, 0.0040828664F, 0.0042064714F, + 0.0043319145F, 0.0044591954F, 0.0045883139F, 0.0047192696F, + 0.0048520622F, 0.0049866914F, 0.0051231569F, 0.0052614583F, + 0.0054015953F, 0.0055435676F, 0.0056873748F, 0.0058330166F, + 0.0059804926F, 0.0061298026F, 0.0062809460F, 0.0064339226F, + 0.0065887320F, 0.0067453738F, 0.0069038476F, 0.0070641531F, + 0.0072262899F, 0.0073902575F, 0.0075560556F, 0.0077236838F, + 0.0078931417F, 0.0080644288F, 0.0082375447F, 0.0084124891F, + 0.0085892615F, 0.0087678614F, 0.0089482885F, 0.0091305422F, + 0.0093146223F, 0.0095005281F, 0.0096882592F, 0.0098778153F, + 0.0100691958F, 0.0102624002F, 0.0104574281F, 0.0106542791F, + 0.0108529525F, 0.0110534480F, 0.0112557651F, 0.0114599032F, + 0.0116658618F, 0.0118736405F, 0.0120832387F, 0.0122946560F, + 0.0125078917F, 0.0127229454F, 0.0129398166F, 0.0131585046F, + 0.0133790090F, 0.0136013292F, 0.0138254647F, 0.0140514149F, + 0.0142791792F, 0.0145087572F, 0.0147401481F, 0.0149733515F, + 0.0152083667F, 0.0154451932F, 0.0156838304F, 0.0159242777F, + 0.0161665345F, 0.0164106001F, 0.0166564741F, 0.0169041557F, + 0.0171536443F, 0.0174049393F, 0.0176580401F, 0.0179129461F, + 0.0181696565F, 0.0184281708F, 0.0186884883F, 0.0189506084F, + 0.0192145303F, 0.0194802535F, 0.0197477772F, 0.0200171008F, + 0.0202882236F, 0.0205611449F, 0.0208358639F, 0.0211123801F, + 0.0213906927F, 0.0216708011F, 0.0219527043F, 0.0222364019F, + 0.0225218930F, 0.0228091769F, 0.0230982529F, 0.0233891203F, + 0.0236817782F, 0.0239762259F, 0.0242724628F, 0.0245704880F, + 0.0248703007F, 0.0251719002F, 0.0254752858F, 0.0257804565F, + 0.0260874117F, 0.0263961506F, 0.0267066722F, 0.0270189760F, + 0.0273330609F, 0.0276489263F, 0.0279665712F, 0.0282859949F, + 0.0286071966F, 0.0289301753F, 0.0292549303F, 0.0295814607F, + 0.0299097656F, 0.0302398442F, 0.0305716957F, 0.0309053191F, + 0.0312407135F, 0.0315778782F, 0.0319168122F, 0.0322575145F, + 0.0325999844F, 0.0329442209F, 0.0332902231F, 0.0336379900F, + 0.0339875208F, 0.0343388146F, 0.0346918703F, 0.0350466871F, + 0.0354032640F, 0.0357616000F, 0.0361216943F, 0.0364835458F, + 0.0368471535F, 0.0372125166F, 0.0375796339F, 0.0379485046F, + 0.0383191276F, 0.0386915020F, 0.0390656267F, 0.0394415008F, + 0.0398191231F, 0.0401984927F, 0.0405796086F, 0.0409624698F, + 0.0413470751F, 0.0417334235F, 0.0421215141F, 0.0425113457F, + 0.0429029172F, 0.0432962277F, 0.0436912760F, 0.0440880610F, + 0.0444865817F, 0.0448868370F, 0.0452888257F, 0.0456925468F, + 0.0460979992F, 0.0465051816F, 0.0469140931F, 0.0473247325F, + 0.0477370986F, 0.0481511902F, 0.0485670064F, 0.0489845458F, + 0.0494038074F, 0.0498247899F, 0.0502474922F, 0.0506719131F, + 0.0510980514F, 0.0515259060F, 0.0519554756F, 0.0523867590F, + 0.0528197550F, 0.0532544624F, 0.0536908800F, 0.0541290066F, + 0.0545688408F, 0.0550103815F, 0.0554536274F, 0.0558985772F, + 0.0563452297F, 0.0567935837F, 0.0572436377F, 0.0576953907F, + 0.0581488412F, 0.0586039880F, 0.0590608297F, 0.0595193651F, + 0.0599795929F, 0.0604415117F, 0.0609051202F, 0.0613704170F, + 0.0618374009F, 0.0623060704F, 0.0627764243F, 0.0632484611F, + 0.0637221795F, 0.0641975781F, 0.0646746555F, 0.0651534104F, + 0.0656338413F, 0.0661159469F, 0.0665997257F, 0.0670851763F, + 0.0675722973F, 0.0680610873F, 0.0685515448F, 0.0690436684F, + 0.0695374567F, 0.0700329081F, 0.0705300213F, 0.0710287947F, + 0.0715292269F, 0.0720313163F, 0.0725350616F, 0.0730404612F, + 0.0735475136F, 0.0740562172F, 0.0745665707F, 0.0750785723F, + 0.0755922207F, 0.0761075143F, 0.0766244515F, 0.0771430307F, + 0.0776632505F, 0.0781851092F, 0.0787086052F, 0.0792337371F, + 0.0797605032F, 0.0802889018F, 0.0808189315F, 0.0813505905F, + 0.0818838773F, 0.0824187903F, 0.0829553277F, 0.0834934881F, + 0.0840332697F, 0.0845746708F, 0.0851176899F, 0.0856623252F, + 0.0862085751F, 0.0867564379F, 0.0873059119F, 0.0878569954F, + 0.0884096867F, 0.0889639840F, 0.0895198858F, 0.0900773902F, + 0.0906364955F, 0.0911972000F, 0.0917595019F, 0.0923233995F, + 0.0928888909F, 0.0934559745F, 0.0940246485F, 0.0945949110F, + 0.0951667604F, 0.0957401946F, 0.0963152121F, 0.0968918109F, + 0.0974699893F, 0.0980497454F, 0.0986310773F, 0.0992139832F, + 0.0997984614F, 0.1003845098F, 0.1009721267F, 0.1015613101F, + 0.1021520582F, 0.1027443692F, 0.1033382410F, 0.1039336718F, + 0.1045306597F, 0.1051292027F, 0.1057292990F, 0.1063309466F, + 0.1069341435F, 0.1075388878F, 0.1081451776F, 0.1087530108F, + 0.1093623856F, 0.1099732998F, 0.1105857516F, 0.1111997389F, + 0.1118152597F, 0.1124323121F, 0.1130508939F, 0.1136710032F, + 0.1142926379F, 0.1149157960F, 0.1155404755F, 0.1161666742F, + 0.1167943901F, 0.1174236211F, 0.1180543652F, 0.1186866202F, + 0.1193203841F, 0.1199556548F, 0.1205924300F, 0.1212307078F, + 0.1218704860F, 0.1225117624F, 0.1231545349F, 0.1237988013F, + 0.1244445596F, 0.1250918074F, 0.1257405427F, 0.1263907632F, + 0.1270424667F, 0.1276956512F, 0.1283503142F, 0.1290064537F, + 0.1296640674F, 0.1303231530F, 0.1309837084F, 0.1316457312F, + 0.1323092193F, 0.1329741703F, 0.1336405820F, 0.1343084520F, + 0.1349777782F, 0.1356485582F, 0.1363207897F, 0.1369944704F, + 0.1376695979F, 0.1383461700F, 0.1390241842F, 0.1397036384F, + 0.1403845300F, 0.1410668567F, 0.1417506162F, 0.1424358061F, + 0.1431224240F, 0.1438104674F, 0.1444999341F, 0.1451908216F, + 0.1458831274F, 0.1465768492F, 0.1472719844F, 0.1479685308F, + 0.1486664857F, 0.1493658468F, 0.1500666115F, 0.1507687775F, + 0.1514723422F, 0.1521773031F, 0.1528836577F, 0.1535914035F, + 0.1543005380F, 0.1550110587F, 0.1557229631F, 0.1564362485F, + 0.1571509124F, 0.1578669524F, 0.1585843657F, 0.1593031499F, + 0.1600233024F, 0.1607448205F, 0.1614677017F, 0.1621919433F, + 0.1629175428F, 0.1636444975F, 0.1643728047F, 0.1651024619F, + 0.1658334665F, 0.1665658156F, 0.1672995067F, 0.1680345371F, + 0.1687709041F, 0.1695086050F, 0.1702476372F, 0.1709879978F, + 0.1717296843F, 0.1724726938F, 0.1732170237F, 0.1739626711F, + 0.1747096335F, 0.1754579079F, 0.1762074916F, 0.1769583819F, + 0.1777105760F, 0.1784640710F, 0.1792188642F, 0.1799749529F, + 0.1807323340F, 0.1814910049F, 0.1822509628F, 0.1830122046F, + 0.1837747277F, 0.1845385292F, 0.1853036062F, 0.1860699558F, + 0.1868375751F, 0.1876064613F, 0.1883766114F, 0.1891480226F, + 0.1899206919F, 0.1906946164F, 0.1914697932F, 0.1922462194F, + 0.1930238919F, 0.1938028079F, 0.1945829643F, 0.1953643583F, + 0.1961469868F, 0.1969308468F, 0.1977159353F, 0.1985022494F, + 0.1992897859F, 0.2000785420F, 0.2008685145F, 0.2016597005F, + 0.2024520968F, 0.2032457005F, 0.2040405084F, 0.2048365175F, + 0.2056337247F, 0.2064321269F, 0.2072317211F, 0.2080325041F, + 0.2088344727F, 0.2096376240F, 0.2104419547F, 0.2112474618F, + 0.2120541420F, 0.2128619923F, 0.2136710094F, 0.2144811902F, + 0.2152925315F, 0.2161050301F, 0.2169186829F, 0.2177334866F, + 0.2185494381F, 0.2193665340F, 0.2201847712F, 0.2210041465F, + 0.2218246565F, 0.2226462981F, 0.2234690680F, 0.2242929629F, + 0.2251179796F, 0.2259441147F, 0.2267713650F, 0.2275997272F, + 0.2284291979F, 0.2292597739F, 0.2300914518F, 0.2309242283F, + 0.2317581001F, 0.2325930638F, 0.2334291160F, 0.2342662534F, + 0.2351044727F, 0.2359437703F, 0.2367841431F, 0.2376255875F, + 0.2384681001F, 0.2393116776F, 0.2401563165F, 0.2410020134F, + 0.2418487649F, 0.2426965675F, 0.2435454178F, 0.2443953122F, + 0.2452462474F, 0.2460982199F, 0.2469512262F, 0.2478052628F, + 0.2486603262F, 0.2495164129F, 0.2503735194F, 0.2512316421F, + 0.2520907776F, 0.2529509222F, 0.2538120726F, 0.2546742250F, + 0.2555373760F, 0.2564015219F, 0.2572666593F, 0.2581327845F, + 0.2589998939F, 0.2598679840F, 0.2607370510F, 0.2616070916F, + 0.2624781019F, 0.2633500783F, 0.2642230173F, 0.2650969152F, + 0.2659717684F, 0.2668475731F, 0.2677243257F, 0.2686020226F, + 0.2694806601F, 0.2703602344F, 0.2712407419F, 0.2721221789F, + 0.2730045417F, 0.2738878265F, 0.2747720297F, 0.2756571474F, + 0.2765431760F, 0.2774301117F, 0.2783179508F, 0.2792066895F, + 0.2800963240F, 0.2809868505F, 0.2818782654F, 0.2827705647F, + 0.2836637447F, 0.2845578016F, 0.2854527315F, 0.2863485307F, + 0.2872451953F, 0.2881427215F, 0.2890411055F, 0.2899403433F, + 0.2908404312F, 0.2917413654F, 0.2926431418F, 0.2935457567F, + 0.2944492061F, 0.2953534863F, 0.2962585932F, 0.2971645230F, + 0.2980712717F, 0.2989788356F, 0.2998872105F, 0.3007963927F, + 0.3017063781F, 0.3026171629F, 0.3035287430F, 0.3044411145F, + 0.3053542736F, 0.3062682161F, 0.3071829381F, 0.3080984356F, + 0.3090147047F, 0.3099317413F, 0.3108495414F, 0.3117681011F, + 0.3126874163F, 0.3136074830F, 0.3145282972F, 0.3154498548F, + 0.3163721517F, 0.3172951841F, 0.3182189477F, 0.3191434385F, + 0.3200686525F, 0.3209945856F, 0.3219212336F, 0.3228485927F, + 0.3237766585F, 0.3247054271F, 0.3256348943F, 0.3265650560F, + 0.3274959081F, 0.3284274465F, 0.3293596671F, 0.3302925657F, + 0.3312261382F, 0.3321603804F, 0.3330952882F, 0.3340308574F, + 0.3349670838F, 0.3359039634F, 0.3368414919F, 0.3377796651F, + 0.3387184789F, 0.3396579290F, 0.3405980113F, 0.3415387216F, + 0.3424800556F, 0.3434220091F, 0.3443645779F, 0.3453077578F, + 0.3462515446F, 0.3471959340F, 0.3481409217F, 0.3490865036F, + 0.3500326754F, 0.3509794328F, 0.3519267715F, 0.3528746873F, + 0.3538231759F, 0.3547722330F, 0.3557218544F, 0.3566720357F, + 0.3576227727F, 0.3585740610F, 0.3595258964F, 0.3604782745F, + 0.3614311910F, 0.3623846417F, 0.3633386221F, 0.3642931280F, + 0.3652481549F, 0.3662036987F, 0.3671597548F, 0.3681163191F, + 0.3690733870F, 0.3700309544F, 0.3709890167F, 0.3719475696F, + 0.3729066089F, 0.3738661299F, 0.3748261285F, 0.3757866002F, + 0.3767475406F, 0.3777089453F, 0.3786708100F, 0.3796331302F, + 0.3805959014F, 0.3815591194F, 0.3825227796F, 0.3834868777F, + 0.3844514093F, 0.3854163698F, 0.3863817549F, 0.3873475601F, + 0.3883137810F, 0.3892804131F, 0.3902474521F, 0.3912148933F, + 0.3921827325F, 0.3931509650F, 0.3941195865F, 0.3950885925F, + 0.3960579785F, 0.3970277400F, 0.3979978725F, 0.3989683716F, + 0.3999392328F, 0.4009104516F, 0.4018820234F, 0.4028539438F, + 0.4038262084F, 0.4047988125F, 0.4057717516F, 0.4067450214F, + 0.4077186172F, 0.4086925345F, 0.4096667688F, 0.4106413155F, + 0.4116161703F, 0.4125913284F, 0.4135667854F, 0.4145425368F, + 0.4155185780F, 0.4164949044F, 0.4174715116F, 0.4184483949F, + 0.4194255498F, 0.4204029718F, 0.4213806563F, 0.4223585987F, + 0.4233367946F, 0.4243152392F, 0.4252939281F, 0.4262728566F, + 0.4272520202F, 0.4282314144F, 0.4292110345F, 0.4301908760F, + 0.4311709343F, 0.4321512047F, 0.4331316828F, 0.4341123639F, + 0.4350932435F, 0.4360743168F, 0.4370555794F, 0.4380370267F, + 0.4390186540F, 0.4400004567F, 0.4409824303F, 0.4419645701F, + 0.4429468716F, 0.4439293300F, 0.4449119409F, 0.4458946996F, + 0.4468776014F, 0.4478606418F, 0.4488438162F, 0.4498271199F, + 0.4508105483F, 0.4517940967F, 0.4527777607F, 0.4537615355F, + 0.4547454165F, 0.4557293991F, 0.4567134786F, 0.4576976505F, + 0.4586819101F, 0.4596662527F, 0.4606506738F, 0.4616351687F, + 0.4626197328F, 0.4636043614F, 0.4645890499F, 0.4655737936F, + 0.4665585880F, 0.4675434284F, 0.4685283101F, 0.4695132286F, + 0.4704981791F, 0.4714831570F, 0.4724681577F, 0.4734531766F, + 0.4744382089F, 0.4754232501F, 0.4764082956F, 0.4773933406F, + 0.4783783806F, 0.4793634108F, 0.4803484267F, 0.4813334237F, + 0.4823183969F, 0.4833033419F, 0.4842882540F, 0.4852731285F, + 0.4862579608F, 0.4872427462F, 0.4882274802F, 0.4892121580F, + 0.4901967751F, 0.4911813267F, 0.4921658083F, 0.4931502151F, + 0.4941345427F, 0.4951187863F, 0.4961029412F, 0.4970870029F, + 0.4980709667F, 0.4990548280F, 0.5000385822F, 0.5010222245F, + 0.5020057505F, 0.5029891553F, 0.5039724345F, 0.5049555834F, + 0.5059385973F, 0.5069214716F, 0.5079042018F, 0.5088867831F, + 0.5098692110F, 0.5108514808F, 0.5118335879F, 0.5128155277F, + 0.5137972956F, 0.5147788869F, 0.5157602971F, 0.5167415215F, + 0.5177225555F, 0.5187033945F, 0.5196840339F, 0.5206644692F, + 0.5216446956F, 0.5226247086F, 0.5236045035F, 0.5245840759F, + 0.5255634211F, 0.5265425344F, 0.5275214114F, 0.5285000474F, + 0.5294784378F, 0.5304565781F, 0.5314344637F, 0.5324120899F, + 0.5333894522F, 0.5343665461F, 0.5353433670F, 0.5363199102F, + 0.5372961713F, 0.5382721457F, 0.5392478287F, 0.5402232159F, + 0.5411983027F, 0.5421730845F, 0.5431475569F, 0.5441217151F, + 0.5450955548F, 0.5460690714F, 0.5470422602F, 0.5480151169F, + 0.5489876368F, 0.5499598155F, 0.5509316484F, 0.5519031310F, + 0.5528742587F, 0.5538450271F, 0.5548154317F, 0.5557854680F, + 0.5567551314F, 0.5577244174F, 0.5586933216F, 0.5596618395F, + 0.5606299665F, 0.5615976983F, 0.5625650302F, 0.5635319580F, + 0.5644984770F, 0.5654645828F, 0.5664302709F, 0.5673955370F, + 0.5683603765F, 0.5693247850F, 0.5702887580F, 0.5712522912F, + 0.5722153800F, 0.5731780200F, 0.5741402069F, 0.5751019362F, + 0.5760632034F, 0.5770240042F, 0.5779843341F, 0.5789441889F, + 0.5799035639F, 0.5808624549F, 0.5818208575F, 0.5827787673F, + 0.5837361800F, 0.5846930910F, 0.5856494961F, 0.5866053910F, + 0.5875607712F, 0.5885156324F, 0.5894699703F, 0.5904237804F, + 0.5913770586F, 0.5923298004F, 0.5932820016F, 0.5942336578F, + 0.5951847646F, 0.5961353179F, 0.5970853132F, 0.5980347464F, + 0.5989836131F, 0.5999319090F, 0.6008796298F, 0.6018267713F, + 0.6027733292F, 0.6037192993F, 0.6046646773F, 0.6056094589F, + 0.6065536400F, 0.6074972162F, 0.6084401833F, 0.6093825372F, + 0.6103242736F, 0.6112653884F, 0.6122058772F, 0.6131457359F, + 0.6140849604F, 0.6150235464F, 0.6159614897F, 0.6168987862F, + 0.6178354318F, 0.6187714223F, 0.6197067535F, 0.6206414213F, + 0.6215754215F, 0.6225087501F, 0.6234414028F, 0.6243733757F, + 0.6253046646F, 0.6262352654F, 0.6271651739F, 0.6280943862F, + 0.6290228982F, 0.6299507057F, 0.6308778048F, 0.6318041913F, + 0.6327298612F, 0.6336548105F, 0.6345790352F, 0.6355025312F, + 0.6364252945F, 0.6373473211F, 0.6382686070F, 0.6391891483F, + 0.6401089409F, 0.6410279808F, 0.6419462642F, 0.6428637869F, + 0.6437805452F, 0.6446965350F, 0.6456117524F, 0.6465261935F, + 0.6474398544F, 0.6483527311F, 0.6492648197F, 0.6501761165F, + 0.6510866174F, 0.6519963186F, 0.6529052162F, 0.6538133064F, + 0.6547205854F, 0.6556270492F, 0.6565326941F, 0.6574375162F, + 0.6583415117F, 0.6592446769F, 0.6601470079F, 0.6610485009F, + 0.6619491521F, 0.6628489578F, 0.6637479143F, 0.6646460177F, + 0.6655432643F, 0.6664396505F, 0.6673351724F, 0.6682298264F, + 0.6691236087F, 0.6700165157F, 0.6709085436F, 0.6717996889F, + 0.6726899478F, 0.6735793167F, 0.6744677918F, 0.6753553697F, + 0.6762420466F, 0.6771278190F, 0.6780126832F, 0.6788966357F, + 0.6797796728F, 0.6806617909F, 0.6815429866F, 0.6824232562F, + 0.6833025961F, 0.6841810030F, 0.6850584731F, 0.6859350031F, + 0.6868105894F, 0.6876852284F, 0.6885589168F, 0.6894316510F, + 0.6903034275F, 0.6911742430F, 0.6920440939F, 0.6929129769F, + 0.6937808884F, 0.6946478251F, 0.6955137837F, 0.6963787606F, + 0.6972427525F, 0.6981057560F, 0.6989677678F, 0.6998287845F, + 0.7006888028F, 0.7015478194F, 0.7024058309F, 0.7032628340F, + 0.7041188254F, 0.7049738019F, 0.7058277601F, 0.7066806969F, + 0.7075326089F, 0.7083834929F, 0.7092333457F, 0.7100821640F, + 0.7109299447F, 0.7117766846F, 0.7126223804F, 0.7134670291F, + 0.7143106273F, 0.7151531721F, 0.7159946602F, 0.7168350885F, + 0.7176744539F, 0.7185127534F, 0.7193499837F, 0.7201861418F, + 0.7210212247F, 0.7218552293F, 0.7226881526F, 0.7235199914F, + 0.7243507428F, 0.7251804039F, 0.7260089715F, 0.7268364426F, + 0.7276628144F, 0.7284880839F, 0.7293122481F, 0.7301353040F, + 0.7309572487F, 0.7317780794F, 0.7325977930F, 0.7334163868F, + 0.7342338579F, 0.7350502033F, 0.7358654202F, 0.7366795059F, + 0.7374924573F, 0.7383042718F, 0.7391149465F, 0.7399244787F, + 0.7407328655F, 0.7415401041F, 0.7423461920F, 0.7431511261F, + 0.7439549040F, 0.7447575227F, 0.7455589797F, 0.7463592723F, + 0.7471583976F, 0.7479563532F, 0.7487531363F, 0.7495487443F, + 0.7503431745F, 0.7511364244F, 0.7519284913F, 0.7527193726F, + 0.7535090658F, 0.7542975683F, 0.7550848776F, 0.7558709910F, + 0.7566559062F, 0.7574396205F, 0.7582221314F, 0.7590034366F, + 0.7597835334F, 0.7605624194F, 0.7613400923F, 0.7621165495F, + 0.7628917886F, 0.7636658072F, 0.7644386030F, 0.7652101735F, + 0.7659805164F, 0.7667496292F, 0.7675175098F, 0.7682841556F, + 0.7690495645F, 0.7698137341F, 0.7705766622F, 0.7713383463F, + 0.7720987844F, 0.7728579741F, 0.7736159132F, 0.7743725994F, + 0.7751280306F, 0.7758822046F, 0.7766351192F, 0.7773867722F, + 0.7781371614F, 0.7788862848F, 0.7796341401F, 0.7803807253F, + 0.7811260383F, 0.7818700769F, 0.7826128392F, 0.7833543230F, + 0.7840945263F, 0.7848334471F, 0.7855710833F, 0.7863074330F, + 0.7870424941F, 0.7877762647F, 0.7885087428F, 0.7892399264F, + 0.7899698137F, 0.7906984026F, 0.7914256914F, 0.7921516780F, + 0.7928763607F, 0.7935997375F, 0.7943218065F, 0.7950425661F, + 0.7957620142F, 0.7964801492F, 0.7971969692F, 0.7979124724F, + 0.7986266570F, 0.7993395214F, 0.8000510638F, 0.8007612823F, + 0.8014701754F, 0.8021777413F, 0.8028839784F, 0.8035888849F, + 0.8042924592F, 0.8049946997F, 0.8056956048F, 0.8063951727F, + 0.8070934020F, 0.8077902910F, 0.8084858381F, 0.8091800419F, + 0.8098729007F, 0.8105644130F, 0.8112545774F, 0.8119433922F, + 0.8126308561F, 0.8133169676F, 0.8140017251F, 0.8146851272F, + 0.8153671726F, 0.8160478598F, 0.8167271874F, 0.8174051539F, + 0.8180817582F, 0.8187569986F, 0.8194308741F, 0.8201033831F, + 0.8207745244F, 0.8214442966F, 0.8221126986F, 0.8227797290F, + 0.8234453865F, 0.8241096700F, 0.8247725781F, 0.8254341097F, + 0.8260942636F, 0.8267530385F, 0.8274104334F, 0.8280664470F, + 0.8287210782F, 0.8293743259F, 0.8300261889F, 0.8306766662F, + 0.8313257566F, 0.8319734591F, 0.8326197727F, 0.8332646963F, + 0.8339082288F, 0.8345503692F, 0.8351911167F, 0.8358304700F, + 0.8364684284F, 0.8371049907F, 0.8377401562F, 0.8383739238F, + 0.8390062927F, 0.8396372618F, 0.8402668305F, 0.8408949977F, + 0.8415217626F, 0.8421471245F, 0.8427710823F, 0.8433936354F, + 0.8440147830F, 0.8446345242F, 0.8452528582F, 0.8458697844F, + 0.8464853020F, 0.8470994102F, 0.8477121084F, 0.8483233958F, + 0.8489332718F, 0.8495417356F, 0.8501487866F, 0.8507544243F, + 0.8513586479F, 0.8519614568F, 0.8525628505F, 0.8531628283F, + 0.8537613897F, 0.8543585341F, 0.8549542611F, 0.8555485699F, + 0.8561414603F, 0.8567329315F, 0.8573229832F, 0.8579116149F, + 0.8584988262F, 0.8590846165F, 0.8596689855F, 0.8602519327F, + 0.8608334577F, 0.8614135603F, 0.8619922399F, 0.8625694962F, + 0.8631453289F, 0.8637197377F, 0.8642927222F, 0.8648642821F, + 0.8654344172F, 0.8660031272F, 0.8665704118F, 0.8671362708F, + 0.8677007039F, 0.8682637109F, 0.8688252917F, 0.8693854460F, + 0.8699441737F, 0.8705014745F, 0.8710573485F, 0.8716117953F, + 0.8721648150F, 0.8727164073F, 0.8732665723F, 0.8738153098F, + 0.8743626197F, 0.8749085021F, 0.8754529569F, 0.8759959840F, + 0.8765375835F, 0.8770777553F, 0.8776164996F, 0.8781538162F, + 0.8786897054F, 0.8792241670F, 0.8797572013F, 0.8802888082F, + 0.8808189880F, 0.8813477407F, 0.8818750664F, 0.8824009653F, + 0.8829254375F, 0.8834484833F, 0.8839701028F, 0.8844902961F, + 0.8850090636F, 0.8855264054F, 0.8860423218F, 0.8865568131F, + 0.8870698794F, 0.8875815212F, 0.8880917386F, 0.8886005319F, + 0.8891079016F, 0.8896138479F, 0.8901183712F, 0.8906214719F, + 0.8911231503F, 0.8916234067F, 0.8921222417F, 0.8926196556F, + 0.8931156489F, 0.8936102219F, 0.8941033752F, 0.8945951092F, + 0.8950854244F, 0.8955743212F, 0.8960618003F, 0.8965478621F, + 0.8970325071F, 0.8975157359F, 0.8979975490F, 0.8984779471F, + 0.8989569307F, 0.8994345004F, 0.8999106568F, 0.9003854005F, + 0.9008587323F, 0.9013306526F, 0.9018011623F, 0.9022702619F, + 0.9027379521F, 0.9032042337F, 0.9036691074F, 0.9041325739F, + 0.9045946339F, 0.9050552882F, 0.9055145376F, 0.9059723828F, + 0.9064288246F, 0.9068838638F, 0.9073375013F, 0.9077897379F, + 0.9082405743F, 0.9086900115F, 0.9091380503F, 0.9095846917F, + 0.9100299364F, 0.9104737854F, 0.9109162397F, 0.9113573001F, + 0.9117969675F, 0.9122352430F, 0.9126721275F, 0.9131076219F, + 0.9135417273F, 0.9139744447F, 0.9144057750F, 0.9148357194F, + 0.9152642787F, 0.9156914542F, 0.9161172468F, 0.9165416576F, + 0.9169646877F, 0.9173863382F, 0.9178066102F, 0.9182255048F, + 0.9186430232F, 0.9190591665F, 0.9194739359F, 0.9198873324F, + 0.9202993574F, 0.9207100120F, 0.9211192973F, 0.9215272147F, + 0.9219337653F, 0.9223389504F, 0.9227427713F, 0.9231452290F, + 0.9235463251F, 0.9239460607F, 0.9243444371F, 0.9247414557F, + 0.9251371177F, 0.9255314245F, 0.9259243774F, 0.9263159778F, + 0.9267062270F, 0.9270951264F, 0.9274826774F, 0.9278688814F, + 0.9282537398F, 0.9286372540F, 0.9290194254F, 0.9294002555F, + 0.9297797458F, 0.9301578976F, 0.9305347125F, 0.9309101919F, + 0.9312843373F, 0.9316571503F, 0.9320286323F, 0.9323987849F, + 0.9327676097F, 0.9331351080F, 0.9335012816F, 0.9338661320F, + 0.9342296607F, 0.9345918694F, 0.9349527596F, 0.9353123330F, + 0.9356705911F, 0.9360275357F, 0.9363831683F, 0.9367374905F, + 0.9370905042F, 0.9374422108F, 0.9377926122F, 0.9381417099F, + 0.9384895057F, 0.9388360014F, 0.9391811985F, 0.9395250989F, + 0.9398677043F, 0.9402090165F, 0.9405490371F, 0.9408877680F, + 0.9412252110F, 0.9415613678F, 0.9418962402F, 0.9422298301F, + 0.9425621392F, 0.9428931695F, 0.9432229226F, 0.9435514005F, + 0.9438786050F, 0.9442045381F, 0.9445292014F, 0.9448525971F, + 0.9451747268F, 0.9454955926F, 0.9458151963F, 0.9461335399F, + 0.9464506253F, 0.9467664545F, 0.9470810293F, 0.9473943517F, + 0.9477064238F, 0.9480172474F, 0.9483268246F, 0.9486351573F, + 0.9489422475F, 0.9492480973F, 0.9495527087F, 0.9498560837F, + 0.9501582243F, 0.9504591325F, 0.9507588105F, 0.9510572603F, + 0.9513544839F, 0.9516504834F, 0.9519452609F, 0.9522388186F, + 0.9525311584F, 0.9528222826F, 0.9531121932F, 0.9534008923F, + 0.9536883821F, 0.9539746647F, 0.9542597424F, 0.9545436171F, + 0.9548262912F, 0.9551077667F, 0.9553880459F, 0.9556671309F, + 0.9559450239F, 0.9562217272F, 0.9564972429F, 0.9567715733F, + 0.9570447206F, 0.9573166871F, 0.9575874749F, 0.9578570863F, + 0.9581255236F, 0.9583927890F, 0.9586588849F, 0.9589238134F, + 0.9591875769F, 0.9594501777F, 0.9597116180F, 0.9599719003F, + 0.9602310267F, 0.9604889995F, 0.9607458213F, 0.9610014942F, + 0.9612560206F, 0.9615094028F, 0.9617616433F, 0.9620127443F, + 0.9622627083F, 0.9625115376F, 0.9627592345F, 0.9630058016F, + 0.9632512411F, 0.9634955555F, 0.9637387471F, 0.9639808185F, + 0.9642217720F, 0.9644616100F, 0.9647003349F, 0.9649379493F, + 0.9651744556F, 0.9654098561F, 0.9656441534F, 0.9658773499F, + 0.9661094480F, 0.9663404504F, 0.9665703593F, 0.9667991774F, + 0.9670269071F, 0.9672535509F, 0.9674791114F, 0.9677035909F, + 0.9679269921F, 0.9681493174F, 0.9683705694F, 0.9685907506F, + 0.9688098636F, 0.9690279108F, 0.9692448948F, 0.9694608182F, + 0.9696756836F, 0.9698894934F, 0.9701022503F, 0.9703139569F, + 0.9705246156F, 0.9707342291F, 0.9709428000F, 0.9711503309F, + 0.9713568243F, 0.9715622829F, 0.9717667093F, 0.9719701060F, + 0.9721724757F, 0.9723738210F, 0.9725741446F, 0.9727734490F, + 0.9729717369F, 0.9731690109F, 0.9733652737F, 0.9735605279F, + 0.9737547762F, 0.9739480212F, 0.9741402656F, 0.9743315120F, + 0.9745217631F, 0.9747110216F, 0.9748992901F, 0.9750865714F, + 0.9752728681F, 0.9754581829F, 0.9756425184F, 0.9758258775F, + 0.9760082627F, 0.9761896768F, 0.9763701224F, 0.9765496024F, + 0.9767281193F, 0.9769056760F, 0.9770822751F, 0.9772579193F, + 0.9774326114F, 0.9776063542F, 0.9777791502F, 0.9779510023F, + 0.9781219133F, 0.9782918858F, 0.9784609226F, 0.9786290264F, + 0.9787962000F, 0.9789624461F, 0.9791277676F, 0.9792921671F, + 0.9794556474F, 0.9796182113F, 0.9797798615F, 0.9799406009F, + 0.9801004321F, 0.9802593580F, 0.9804173813F, 0.9805745049F, + 0.9807307314F, 0.9808860637F, 0.9810405046F, 0.9811940568F, + 0.9813467232F, 0.9814985065F, 0.9816494095F, 0.9817994351F, + 0.9819485860F, 0.9820968650F, 0.9822442750F, 0.9823908186F, + 0.9825364988F, 0.9826813184F, 0.9828252801F, 0.9829683868F, + 0.9831106413F, 0.9832520463F, 0.9833926048F, 0.9835323195F, + 0.9836711932F, 0.9838092288F, 0.9839464291F, 0.9840827969F, + 0.9842183351F, 0.9843530464F, 0.9844869337F, 0.9846199998F, + 0.9847522475F, 0.9848836798F, 0.9850142993F, 0.9851441090F, + 0.9852731117F, 0.9854013101F, 0.9855287073F, 0.9856553058F, + 0.9857811087F, 0.9859061188F, 0.9860303388F, 0.9861537717F, + 0.9862764202F, 0.9863982872F, 0.9865193756F, 0.9866396882F, + 0.9867592277F, 0.9868779972F, 0.9869959993F, 0.9871132370F, + 0.9872297131F, 0.9873454304F, 0.9874603918F, 0.9875746001F, + 0.9876880581F, 0.9878007688F, 0.9879127348F, 0.9880239592F, + 0.9881344447F, 0.9882441941F, 0.9883532104F, 0.9884614962F, + 0.9885690546F, 0.9886758883F, 0.9887820001F, 0.9888873930F, + 0.9889920697F, 0.9890960331F, 0.9891992859F, 0.9893018312F, + 0.9894036716F, 0.9895048100F, 0.9896052493F, 0.9897049923F, + 0.9898040418F, 0.9899024006F, 0.9900000717F, 0.9900970577F, + 0.9901933616F, 0.9902889862F, 0.9903839343F, 0.9904782087F, + 0.9905718122F, 0.9906647477F, 0.9907570180F, 0.9908486259F, + 0.9909395742F, 0.9910298658F, 0.9911195034F, 0.9912084899F, + 0.9912968281F, 0.9913845208F, 0.9914715708F, 0.9915579810F, + 0.9916437540F, 0.9917288928F, 0.9918134001F, 0.9918972788F, + 0.9919805316F, 0.9920631613F, 0.9921451707F, 0.9922265626F, + 0.9923073399F, 0.9923875052F, 0.9924670615F, 0.9925460114F, + 0.9926243577F, 0.9927021033F, 0.9927792508F, 0.9928558032F, + 0.9929317631F, 0.9930071333F, 0.9930819167F, 0.9931561158F, + 0.9932297337F, 0.9933027728F, 0.9933752362F, 0.9934471264F, + 0.9935184462F, 0.9935891985F, 0.9936593859F, 0.9937290112F, + 0.9937980771F, 0.9938665864F, 0.9939345418F, 0.9940019460F, + 0.9940688018F, 0.9941351118F, 0.9942008789F, 0.9942661057F, + 0.9943307950F, 0.9943949494F, 0.9944585717F, 0.9945216645F, + 0.9945842307F, 0.9946462728F, 0.9947077936F, 0.9947687957F, + 0.9948292820F, 0.9948892550F, 0.9949487174F, 0.9950076719F, + 0.9950661212F, 0.9951240679F, 0.9951815148F, 0.9952384645F, + 0.9952949196F, 0.9953508828F, 0.9954063568F, 0.9954613442F, + 0.9955158476F, 0.9955698697F, 0.9956234132F, 0.9956764806F, + 0.9957290746F, 0.9957811978F, 0.9958328528F, 0.9958840423F, + 0.9959347688F, 0.9959850351F, 0.9960348435F, 0.9960841969F, + 0.9961330977F, 0.9961815486F, 0.9962295521F, 0.9962771108F, + 0.9963242274F, 0.9963709043F, 0.9964171441F, 0.9964629494F, + 0.9965083228F, 0.9965532668F, 0.9965977840F, 0.9966418768F, + 0.9966855479F, 0.9967287998F, 0.9967716350F, 0.9968140559F, + 0.9968560653F, 0.9968976655F, 0.9969388591F, 0.9969796485F, + 0.9970200363F, 0.9970600250F, 0.9970996170F, 0.9971388149F, + 0.9971776211F, 0.9972160380F, 0.9972540683F, 0.9972917142F, + 0.9973289783F, 0.9973658631F, 0.9974023709F, 0.9974385042F, + 0.9974742655F, 0.9975096571F, 0.9975446816F, 0.9975793413F, + 0.9976136386F, 0.9976475759F, 0.9976811557F, 0.9977143803F, + 0.9977472521F, 0.9977797736F, 0.9978119470F, 0.9978437748F, + 0.9978752593F, 0.9979064029F, 0.9979372079F, 0.9979676768F, + 0.9979978117F, 0.9980276151F, 0.9980570893F, 0.9980862367F, + 0.9981150595F, 0.9981435600F, 0.9981717406F, 0.9981996035F, + 0.9982271511F, 0.9982543856F, 0.9982813093F, 0.9983079246F, + 0.9983342336F, 0.9983602386F, 0.9983859418F, 0.9984113456F, + 0.9984364522F, 0.9984612638F, 0.9984857825F, 0.9985100108F, + 0.9985339507F, 0.9985576044F, 0.9985809743F, 0.9986040624F, + 0.9986268710F, 0.9986494022F, 0.9986716583F, 0.9986936413F, + 0.9987153535F, 0.9987367969F, 0.9987579738F, 0.9987788864F, + 0.9987995366F, 0.9988199267F, 0.9988400587F, 0.9988599348F, + 0.9988795572F, 0.9988989278F, 0.9989180487F, 0.9989369222F, + 0.9989555501F, 0.9989739347F, 0.9989920780F, 0.9990099820F, + 0.9990276487F, 0.9990450803F, 0.9990622787F, 0.9990792460F, + 0.9990959841F, 0.9991124952F, 0.9991287812F, 0.9991448440F, + 0.9991606858F, 0.9991763084F, 0.9991917139F, 0.9992069042F, + 0.9992218813F, 0.9992366471F, 0.9992512035F, 0.9992655525F, + 0.9992796961F, 0.9992936361F, 0.9993073744F, 0.9993209131F, + 0.9993342538F, 0.9993473987F, 0.9993603494F, 0.9993731080F, + 0.9993856762F, 0.9993980559F, 0.9994102490F, 0.9994222573F, + 0.9994340827F, 0.9994457269F, 0.9994571918F, 0.9994684793F, + 0.9994795910F, 0.9994905288F, 0.9995012945F, 0.9995118898F, + 0.9995223165F, 0.9995325765F, 0.9995426713F, 0.9995526029F, + 0.9995623728F, 0.9995719829F, 0.9995814349F, 0.9995907304F, + 0.9995998712F, 0.9996088590F, 0.9996176954F, 0.9996263821F, + 0.9996349208F, 0.9996433132F, 0.9996515609F, 0.9996596656F, + 0.9996676288F, 0.9996754522F, 0.9996831375F, 0.9996906862F, + 0.9996981000F, 0.9997053804F, 0.9997125290F, 0.9997195474F, + 0.9997264371F, 0.9997331998F, 0.9997398369F, 0.9997463500F, + 0.9997527406F, 0.9997590103F, 0.9997651606F, 0.9997711930F, + 0.9997771089F, 0.9997829098F, 0.9997885973F, 0.9997941728F, + 0.9997996378F, 0.9998049936F, 0.9998102419F, 0.9998153839F, + 0.9998204211F, 0.9998253550F, 0.9998301868F, 0.9998349182F, + 0.9998395503F, 0.9998440847F, 0.9998485226F, 0.9998528654F, + 0.9998571146F, 0.9998612713F, 0.9998653370F, 0.9998693130F, + 0.9998732007F, 0.9998770012F, 0.9998807159F, 0.9998843461F, + 0.9998878931F, 0.9998913581F, 0.9998947424F, 0.9998980473F, + 0.9999012740F, 0.9999044237F, 0.9999074976F, 0.9999104971F, + 0.9999134231F, 0.9999162771F, 0.9999190601F, 0.9999217733F, + 0.9999244179F, 0.9999269950F, 0.9999295058F, 0.9999319515F, + 0.9999343332F, 0.9999366519F, 0.9999389088F, 0.9999411050F, + 0.9999432416F, 0.9999453196F, 0.9999473402F, 0.9999493044F, + 0.9999512132F, 0.9999530677F, 0.9999548690F, 0.9999566180F, + 0.9999583157F, 0.9999599633F, 0.9999615616F, 0.9999631116F, + 0.9999646144F, 0.9999660709F, 0.9999674820F, 0.9999688487F, + 0.9999701719F, 0.9999714526F, 0.9999726917F, 0.9999738900F, + 0.9999750486F, 0.9999761682F, 0.9999772497F, 0.9999782941F, + 0.9999793021F, 0.9999802747F, 0.9999812126F, 0.9999821167F, + 0.9999829878F, 0.9999838268F, 0.9999846343F, 0.9999854113F, + 0.9999861584F, 0.9999868765F, 0.9999875664F, 0.9999882287F, + 0.9999888642F, 0.9999894736F, 0.9999900577F, 0.9999906172F, + 0.9999911528F, 0.9999916651F, 0.9999921548F, 0.9999926227F, + 0.9999930693F, 0.9999934954F, 0.9999939015F, 0.9999942883F, + 0.9999946564F, 0.9999950064F, 0.9999953390F, 0.9999956547F, + 0.9999959541F, 0.9999962377F, 0.9999965062F, 0.9999967601F, + 0.9999969998F, 0.9999972260F, 0.9999974392F, 0.9999976399F, + 0.9999978285F, 0.9999980056F, 0.9999981716F, 0.9999983271F, + 0.9999984724F, 0.9999986081F, 0.9999987345F, 0.9999988521F, + 0.9999989613F, 0.9999990625F, 0.9999991562F, 0.9999992426F, + 0.9999993223F, 0.9999993954F, 0.9999994625F, 0.9999995239F, + 0.9999995798F, 0.9999996307F, 0.9999996768F, 0.9999997184F, + 0.9999997559F, 0.9999997895F, 0.9999998195F, 0.9999998462F, + 0.9999998698F, 0.9999998906F, 0.9999999088F, 0.9999999246F, + 0.9999999383F, 0.9999999500F, 0.9999999600F, 0.9999999684F, + 0.9999999754F, 0.9999999811F, 0.9999999858F, 0.9999999896F, + 0.9999999925F, 0.9999999948F, 0.9999999965F, 0.9999999978F, + 0.9999999986F, 0.9999999992F, 0.9999999996F, 0.9999999998F, + 0.9999999999F, 1.0000000000F, 1.0000000000F, 1.0000000000F, +}; + +static float vwin8192[4096] = { + 0.0000000578F, 0.0000005198F, 0.0000014438F, 0.0000028299F, + 0.0000046780F, 0.0000069882F, 0.0000097604F, 0.0000129945F, + 0.0000166908F, 0.0000208490F, 0.0000254692F, 0.0000305515F, + 0.0000360958F, 0.0000421021F, 0.0000485704F, 0.0000555006F, + 0.0000628929F, 0.0000707472F, 0.0000790635F, 0.0000878417F, + 0.0000970820F, 0.0001067842F, 0.0001169483F, 0.0001275744F, + 0.0001386625F, 0.0001502126F, 0.0001622245F, 0.0001746984F, + 0.0001876343F, 0.0002010320F, 0.0002148917F, 0.0002292132F, + 0.0002439967F, 0.0002592421F, 0.0002749493F, 0.0002911184F, + 0.0003077493F, 0.0003248421F, 0.0003423967F, 0.0003604132F, + 0.0003788915F, 0.0003978316F, 0.0004172335F, 0.0004370971F, + 0.0004574226F, 0.0004782098F, 0.0004994587F, 0.0005211694F, + 0.0005433418F, 0.0005659759F, 0.0005890717F, 0.0006126292F, + 0.0006366484F, 0.0006611292F, 0.0006860716F, 0.0007114757F, + 0.0007373414F, 0.0007636687F, 0.0007904576F, 0.0008177080F, + 0.0008454200F, 0.0008735935F, 0.0009022285F, 0.0009313250F, + 0.0009608830F, 0.0009909025F, 0.0010213834F, 0.0010523257F, + 0.0010837295F, 0.0011155946F, 0.0011479211F, 0.0011807090F, + 0.0012139582F, 0.0012476687F, 0.0012818405F, 0.0013164736F, + 0.0013515679F, 0.0013871235F, 0.0014231402F, 0.0014596182F, + 0.0014965573F, 0.0015339576F, 0.0015718190F, 0.0016101415F, + 0.0016489251F, 0.0016881698F, 0.0017278754F, 0.0017680421F, + 0.0018086698F, 0.0018497584F, 0.0018913080F, 0.0019333185F, + 0.0019757898F, 0.0020187221F, 0.0020621151F, 0.0021059690F, + 0.0021502837F, 0.0021950591F, 0.0022402953F, 0.0022859921F, + 0.0023321497F, 0.0023787679F, 0.0024258467F, 0.0024733861F, + 0.0025213861F, 0.0025698466F, 0.0026187676F, 0.0026681491F, + 0.0027179911F, 0.0027682935F, 0.0028190562F, 0.0028702794F, + 0.0029219628F, 0.0029741066F, 0.0030267107F, 0.0030797749F, + 0.0031332994F, 0.0031872841F, 0.0032417289F, 0.0032966338F, + 0.0033519988F, 0.0034078238F, 0.0034641089F, 0.0035208539F, + 0.0035780589F, 0.0036357237F, 0.0036938485F, 0.0037524331F, + 0.0038114775F, 0.0038709817F, 0.0039309456F, 0.0039913692F, + 0.0040522524F, 0.0041135953F, 0.0041753978F, 0.0042376599F, + 0.0043003814F, 0.0043635624F, 0.0044272029F, 0.0044913028F, + 0.0045558620F, 0.0046208806F, 0.0046863585F, 0.0047522955F, + 0.0048186919F, 0.0048855473F, 0.0049528619F, 0.0050206356F, + 0.0050888684F, 0.0051575601F, 0.0052267108F, 0.0052963204F, + 0.0053663890F, 0.0054369163F, 0.0055079025F, 0.0055793474F, + 0.0056512510F, 0.0057236133F, 0.0057964342F, 0.0058697137F, + 0.0059434517F, 0.0060176482F, 0.0060923032F, 0.0061674166F, + 0.0062429883F, 0.0063190183F, 0.0063955066F, 0.0064724532F, + 0.0065498579F, 0.0066277207F, 0.0067060416F, 0.0067848205F, + 0.0068640575F, 0.0069437523F, 0.0070239051F, 0.0071045157F, + 0.0071855840F, 0.0072671102F, 0.0073490940F, 0.0074315355F, + 0.0075144345F, 0.0075977911F, 0.0076816052F, 0.0077658768F, + 0.0078506057F, 0.0079357920F, 0.0080214355F, 0.0081075363F, + 0.0081940943F, 0.0082811094F, 0.0083685816F, 0.0084565108F, + 0.0085448970F, 0.0086337401F, 0.0087230401F, 0.0088127969F, + 0.0089030104F, 0.0089936807F, 0.0090848076F, 0.0091763911F, + 0.0092684311F, 0.0093609276F, 0.0094538805F, 0.0095472898F, + 0.0096411554F, 0.0097354772F, 0.0098302552F, 0.0099254894F, + 0.0100211796F, 0.0101173259F, 0.0102139281F, 0.0103109863F, + 0.0104085002F, 0.0105064700F, 0.0106048955F, 0.0107037766F, + 0.0108031133F, 0.0109029056F, 0.0110031534F, 0.0111038565F, + 0.0112050151F, 0.0113066289F, 0.0114086980F, 0.0115112222F, + 0.0116142015F, 0.0117176359F, 0.0118215252F, 0.0119258695F, + 0.0120306686F, 0.0121359225F, 0.0122416312F, 0.0123477944F, + 0.0124544123F, 0.0125614847F, 0.0126690116F, 0.0127769928F, + 0.0128854284F, 0.0129943182F, 0.0131036623F, 0.0132134604F, + 0.0133237126F, 0.0134344188F, 0.0135455790F, 0.0136571929F, + 0.0137692607F, 0.0138817821F, 0.0139947572F, 0.0141081859F, + 0.0142220681F, 0.0143364037F, 0.0144511927F, 0.0145664350F, + 0.0146821304F, 0.0147982791F, 0.0149148808F, 0.0150319355F, + 0.0151494431F, 0.0152674036F, 0.0153858168F, 0.0155046828F, + 0.0156240014F, 0.0157437726F, 0.0158639962F, 0.0159846723F, + 0.0161058007F, 0.0162273814F, 0.0163494142F, 0.0164718991F, + 0.0165948361F, 0.0167182250F, 0.0168420658F, 0.0169663584F, + 0.0170911027F, 0.0172162987F, 0.0173419462F, 0.0174680452F, + 0.0175945956F, 0.0177215974F, 0.0178490504F, 0.0179769545F, + 0.0181053098F, 0.0182341160F, 0.0183633732F, 0.0184930812F, + 0.0186232399F, 0.0187538494F, 0.0188849094F, 0.0190164200F, + 0.0191483809F, 0.0192807923F, 0.0194136539F, 0.0195469656F, + 0.0196807275F, 0.0198149394F, 0.0199496012F, 0.0200847128F, + 0.0202202742F, 0.0203562853F, 0.0204927460F, 0.0206296561F, + 0.0207670157F, 0.0209048245F, 0.0210430826F, 0.0211817899F, + 0.0213209462F, 0.0214605515F, 0.0216006057F, 0.0217411086F, + 0.0218820603F, 0.0220234605F, 0.0221653093F, 0.0223076066F, + 0.0224503521F, 0.0225935459F, 0.0227371879F, 0.0228812779F, + 0.0230258160F, 0.0231708018F, 0.0233162355F, 0.0234621169F, + 0.0236084459F, 0.0237552224F, 0.0239024462F, 0.0240501175F, + 0.0241982359F, 0.0243468015F, 0.0244958141F, 0.0246452736F, + 0.0247951800F, 0.0249455331F, 0.0250963329F, 0.0252475792F, + 0.0253992720F, 0.0255514111F, 0.0257039965F, 0.0258570281F, + 0.0260105057F, 0.0261644293F, 0.0263187987F, 0.0264736139F, + 0.0266288747F, 0.0267845811F, 0.0269407330F, 0.0270973302F, + 0.0272543727F, 0.0274118604F, 0.0275697930F, 0.0277281707F, + 0.0278869932F, 0.0280462604F, 0.0282059723F, 0.0283661287F, + 0.0285267295F, 0.0286877747F, 0.0288492641F, 0.0290111976F, + 0.0291735751F, 0.0293363965F, 0.0294996617F, 0.0296633706F, + 0.0298275231F, 0.0299921190F, 0.0301571583F, 0.0303226409F, + 0.0304885667F, 0.0306549354F, 0.0308217472F, 0.0309890017F, + 0.0311566989F, 0.0313248388F, 0.0314934211F, 0.0316624459F, + 0.0318319128F, 0.0320018220F, 0.0321721732F, 0.0323429663F, + 0.0325142013F, 0.0326858779F, 0.0328579962F, 0.0330305559F, + 0.0332035570F, 0.0333769994F, 0.0335508829F, 0.0337252074F, + 0.0338999728F, 0.0340751790F, 0.0342508259F, 0.0344269134F, + 0.0346034412F, 0.0347804094F, 0.0349578178F, 0.0351356663F, + 0.0353139548F, 0.0354926831F, 0.0356718511F, 0.0358514588F, + 0.0360315059F, 0.0362119924F, 0.0363929182F, 0.0365742831F, + 0.0367560870F, 0.0369383297F, 0.0371210113F, 0.0373041315F, + 0.0374876902F, 0.0376716873F, 0.0378561226F, 0.0380409961F, + 0.0382263077F, 0.0384120571F, 0.0385982443F, 0.0387848691F, + 0.0389719315F, 0.0391594313F, 0.0393473683F, 0.0395357425F, + 0.0397245537F, 0.0399138017F, 0.0401034866F, 0.0402936080F, + 0.0404841660F, 0.0406751603F, 0.0408665909F, 0.0410584576F, + 0.0412507603F, 0.0414434988F, 0.0416366731F, 0.0418302829F, + 0.0420243282F, 0.0422188088F, 0.0424137246F, 0.0426090755F, + 0.0428048613F, 0.0430010819F, 0.0431977371F, 0.0433948269F, + 0.0435923511F, 0.0437903095F, 0.0439887020F, 0.0441875285F, + 0.0443867889F, 0.0445864830F, 0.0447866106F, 0.0449871717F, + 0.0451881661F, 0.0453895936F, 0.0455914542F, 0.0457937477F, + 0.0459964738F, 0.0461996326F, 0.0464032239F, 0.0466072475F, + 0.0468117032F, 0.0470165910F, 0.0472219107F, 0.0474276622F, + 0.0476338452F, 0.0478404597F, 0.0480475056F, 0.0482549827F, + 0.0484628907F, 0.0486712297F, 0.0488799994F, 0.0490891998F, + 0.0492988306F, 0.0495088917F, 0.0497193830F, 0.0499303043F, + 0.0501416554F, 0.0503534363F, 0.0505656468F, 0.0507782867F, + 0.0509913559F, 0.0512048542F, 0.0514187815F, 0.0516331376F, + 0.0518479225F, 0.0520631358F, 0.0522787775F, 0.0524948475F, + 0.0527113455F, 0.0529282715F, 0.0531456252F, 0.0533634066F, + 0.0535816154F, 0.0538002515F, 0.0540193148F, 0.0542388051F, + 0.0544587222F, 0.0546790660F, 0.0548998364F, 0.0551210331F, + 0.0553426561F, 0.0555647051F, 0.0557871801F, 0.0560100807F, + 0.0562334070F, 0.0564571587F, 0.0566813357F, 0.0569059378F, + 0.0571309649F, 0.0573564168F, 0.0575822933F, 0.0578085942F, + 0.0580353195F, 0.0582624689F, 0.0584900423F, 0.0587180396F, + 0.0589464605F, 0.0591753049F, 0.0594045726F, 0.0596342635F, + 0.0598643774F, 0.0600949141F, 0.0603258735F, 0.0605572555F, + 0.0607890597F, 0.0610212862F, 0.0612539346F, 0.0614870049F, + 0.0617204968F, 0.0619544103F, 0.0621887451F, 0.0624235010F, + 0.0626586780F, 0.0628942758F, 0.0631302942F, 0.0633667331F, + 0.0636035923F, 0.0638408717F, 0.0640785710F, 0.0643166901F, + 0.0645552288F, 0.0647941870F, 0.0650335645F, 0.0652733610F, + 0.0655135765F, 0.0657542108F, 0.0659952636F, 0.0662367348F, + 0.0664786242F, 0.0667209316F, 0.0669636570F, 0.0672068000F, + 0.0674503605F, 0.0676943384F, 0.0679387334F, 0.0681835454F, + 0.0684287742F, 0.0686744196F, 0.0689204814F, 0.0691669595F, + 0.0694138536F, 0.0696611637F, 0.0699088894F, 0.0701570307F, + 0.0704055873F, 0.0706545590F, 0.0709039458F, 0.0711537473F, + 0.0714039634F, 0.0716545939F, 0.0719056387F, 0.0721570975F, + 0.0724089702F, 0.0726612565F, 0.0729139563F, 0.0731670694F, + 0.0734205956F, 0.0736745347F, 0.0739288866F, 0.0741836510F, + 0.0744388277F, 0.0746944166F, 0.0749504175F, 0.0752068301F, + 0.0754636543F, 0.0757208899F, 0.0759785367F, 0.0762365946F, + 0.0764950632F, 0.0767539424F, 0.0770132320F, 0.0772729319F, + 0.0775330418F, 0.0777935616F, 0.0780544909F, 0.0783158298F, + 0.0785775778F, 0.0788397349F, 0.0791023009F, 0.0793652755F, + 0.0796286585F, 0.0798924498F, 0.0801566492F, 0.0804212564F, + 0.0806862712F, 0.0809516935F, 0.0812175231F, 0.0814837597F, + 0.0817504031F, 0.0820174532F, 0.0822849097F, 0.0825527724F, + 0.0828210412F, 0.0830897158F, 0.0833587960F, 0.0836282816F, + 0.0838981724F, 0.0841684682F, 0.0844391688F, 0.0847102740F, + 0.0849817835F, 0.0852536973F, 0.0855260150F, 0.0857987364F, + 0.0860718614F, 0.0863453897F, 0.0866193211F, 0.0868936554F, + 0.0871683924F, 0.0874435319F, 0.0877190737F, 0.0879950175F, + 0.0882713632F, 0.0885481105F, 0.0888252592F, 0.0891028091F, + 0.0893807600F, 0.0896591117F, 0.0899378639F, 0.0902170165F, + 0.0904965692F, 0.0907765218F, 0.0910568740F, 0.0913376258F, + 0.0916187767F, 0.0919003268F, 0.0921822756F, 0.0924646230F, + 0.0927473687F, 0.0930305126F, 0.0933140545F, 0.0935979940F, + 0.0938823310F, 0.0941670653F, 0.0944521966F, 0.0947377247F, + 0.0950236494F, 0.0953099704F, 0.0955966876F, 0.0958838007F, + 0.0961713094F, 0.0964592136F, 0.0967475131F, 0.0970362075F, + 0.0973252967F, 0.0976147805F, 0.0979046585F, 0.0981949307F, + 0.0984855967F, 0.0987766563F, 0.0990681093F, 0.0993599555F, + 0.0996521945F, 0.0999448263F, 0.1002378506F, 0.1005312671F, + 0.1008250755F, 0.1011192757F, 0.1014138675F, 0.1017088505F, + 0.1020042246F, 0.1022999895F, 0.1025961450F, 0.1028926909F, + 0.1031896268F, 0.1034869526F, 0.1037846680F, 0.1040827729F, + 0.1043812668F, 0.1046801497F, 0.1049794213F, 0.1052790813F, + 0.1055791294F, 0.1058795656F, 0.1061803894F, 0.1064816006F, + 0.1067831991F, 0.1070851846F, 0.1073875568F, 0.1076903155F, + 0.1079934604F, 0.1082969913F, 0.1086009079F, 0.1089052101F, + 0.1092098975F, 0.1095149699F, 0.1098204270F, 0.1101262687F, + 0.1104324946F, 0.1107391045F, 0.1110460982F, 0.1113534754F, + 0.1116612359F, 0.1119693793F, 0.1122779055F, 0.1125868142F, + 0.1128961052F, 0.1132057781F, 0.1135158328F, 0.1138262690F, + 0.1141370863F, 0.1144482847F, 0.1147598638F, 0.1150718233F, + 0.1153841631F, 0.1156968828F, 0.1160099822F, 0.1163234610F, + 0.1166373190F, 0.1169515559F, 0.1172661714F, 0.1175811654F, + 0.1178965374F, 0.1182122874F, 0.1185284149F, 0.1188449198F, + 0.1191618018F, 0.1194790606F, 0.1197966960F, 0.1201147076F, + 0.1204330953F, 0.1207518587F, 0.1210709976F, 0.1213905118F, + 0.1217104009F, 0.1220306647F, 0.1223513029F, 0.1226723153F, + 0.1229937016F, 0.1233154615F, 0.1236375948F, 0.1239601011F, + 0.1242829803F, 0.1246062319F, 0.1249298559F, 0.1252538518F, + 0.1255782195F, 0.1259029586F, 0.1262280689F, 0.1265535501F, + 0.1268794019F, 0.1272056241F, 0.1275322163F, 0.1278591784F, + 0.1281865099F, 0.1285142108F, 0.1288422805F, 0.1291707190F, + 0.1294995259F, 0.1298287009F, 0.1301582437F, 0.1304881542F, + 0.1308184319F, 0.1311490766F, 0.1314800881F, 0.1318114660F, + 0.1321432100F, 0.1324753200F, 0.1328077955F, 0.1331406364F, + 0.1334738422F, 0.1338074129F, 0.1341413479F, 0.1344756472F, + 0.1348103103F, 0.1351453370F, 0.1354807270F, 0.1358164801F, + 0.1361525959F, 0.1364890741F, 0.1368259145F, 0.1371631167F, + 0.1375006805F, 0.1378386056F, 0.1381768917F, 0.1385155384F, + 0.1388545456F, 0.1391939129F, 0.1395336400F, 0.1398737266F, + 0.1402141724F, 0.1405549772F, 0.1408961406F, 0.1412376623F, + 0.1415795421F, 0.1419217797F, 0.1422643746F, 0.1426073268F, + 0.1429506358F, 0.1432943013F, 0.1436383231F, 0.1439827008F, + 0.1443274342F, 0.1446725229F, 0.1450179667F, 0.1453637652F, + 0.1457099181F, 0.1460564252F, 0.1464032861F, 0.1467505006F, + 0.1470980682F, 0.1474459888F, 0.1477942620F, 0.1481428875F, + 0.1484918651F, 0.1488411942F, 0.1491908748F, 0.1495409065F, + 0.1498912889F, 0.1502420218F, 0.1505931048F, 0.1509445376F, + 0.1512963200F, 0.1516484516F, 0.1520009321F, 0.1523537612F, + 0.1527069385F, 0.1530604638F, 0.1534143368F, 0.1537685571F, + 0.1541231244F, 0.1544780384F, 0.1548332987F, 0.1551889052F, + 0.1555448574F, 0.1559011550F, 0.1562577978F, 0.1566147853F, + 0.1569721173F, 0.1573297935F, 0.1576878135F, 0.1580461771F, + 0.1584048838F, 0.1587639334F, 0.1591233255F, 0.1594830599F, + 0.1598431361F, 0.1602035540F, 0.1605643131F, 0.1609254131F, + 0.1612868537F, 0.1616486346F, 0.1620107555F, 0.1623732160F, + 0.1627360158F, 0.1630991545F, 0.1634626319F, 0.1638264476F, + 0.1641906013F, 0.1645550926F, 0.1649199212F, 0.1652850869F, + 0.1656505892F, 0.1660164278F, 0.1663826024F, 0.1667491127F, + 0.1671159583F, 0.1674831388F, 0.1678506541F, 0.1682185036F, + 0.1685866872F, 0.1689552044F, 0.1693240549F, 0.1696932384F, + 0.1700627545F, 0.1704326029F, 0.1708027833F, 0.1711732952F, + 0.1715441385F, 0.1719153127F, 0.1722868175F, 0.1726586526F, + 0.1730308176F, 0.1734033121F, 0.1737761359F, 0.1741492886F, + 0.1745227698F, 0.1748965792F, 0.1752707164F, 0.1756451812F, + 0.1760199731F, 0.1763950918F, 0.1767705370F, 0.1771463083F, + 0.1775224054F, 0.1778988279F, 0.1782755754F, 0.1786526477F, + 0.1790300444F, 0.1794077651F, 0.1797858094F, 0.1801641771F, + 0.1805428677F, 0.1809218810F, 0.1813012165F, 0.1816808739F, + 0.1820608528F, 0.1824411530F, 0.1828217739F, 0.1832027154F, + 0.1835839770F, 0.1839655584F, 0.1843474592F, 0.1847296790F, + 0.1851122175F, 0.1854950744F, 0.1858782492F, 0.1862617417F, + 0.1866455514F, 0.1870296780F, 0.1874141211F, 0.1877988804F, + 0.1881839555F, 0.1885693461F, 0.1889550517F, 0.1893410721F, + 0.1897274068F, 0.1901140555F, 0.1905010178F, 0.1908882933F, + 0.1912758818F, 0.1916637828F, 0.1920519959F, 0.1924405208F, + 0.1928293571F, 0.1932185044F, 0.1936079625F, 0.1939977308F, + 0.1943878091F, 0.1947781969F, 0.1951688939F, 0.1955598998F, + 0.1959512141F, 0.1963428364F, 0.1967347665F, 0.1971270038F, + 0.1975195482F, 0.1979123990F, 0.1983055561F, 0.1986990190F, + 0.1990927873F, 0.1994868607F, 0.1998812388F, 0.2002759212F, + 0.2006709075F, 0.2010661974F, 0.2014617904F, 0.2018576862F, + 0.2022538844F, 0.2026503847F, 0.2030471865F, 0.2034442897F, + 0.2038416937F, 0.2042393982F, 0.2046374028F, 0.2050357071F, + 0.2054343107F, 0.2058332133F, 0.2062324145F, 0.2066319138F, + 0.2070317110F, 0.2074318055F, 0.2078321970F, 0.2082328852F, + 0.2086338696F, 0.2090351498F, 0.2094367255F, 0.2098385962F, + 0.2102407617F, 0.2106432213F, 0.2110459749F, 0.2114490220F, + 0.2118523621F, 0.2122559950F, 0.2126599202F, 0.2130641373F, + 0.2134686459F, 0.2138734456F, 0.2142785361F, 0.2146839168F, + 0.2150895875F, 0.2154955478F, 0.2159017972F, 0.2163083353F, + 0.2167151617F, 0.2171222761F, 0.2175296780F, 0.2179373670F, + 0.2183453428F, 0.2187536049F, 0.2191621529F, 0.2195709864F, + 0.2199801051F, 0.2203895085F, 0.2207991961F, 0.2212091677F, + 0.2216194228F, 0.2220299610F, 0.2224407818F, 0.2228518850F, + 0.2232632699F, 0.2236749364F, 0.2240868839F, 0.2244991121F, + 0.2249116204F, 0.2253244086F, 0.2257374763F, 0.2261508229F, + 0.2265644481F, 0.2269783514F, 0.2273925326F, 0.2278069911F, + 0.2282217265F, 0.2286367384F, 0.2290520265F, 0.2294675902F, + 0.2298834292F, 0.2302995431F, 0.2307159314F, 0.2311325937F, + 0.2315495297F, 0.2319667388F, 0.2323842207F, 0.2328019749F, + 0.2332200011F, 0.2336382988F, 0.2340568675F, 0.2344757070F, + 0.2348948166F, 0.2353141961F, 0.2357338450F, 0.2361537629F, + 0.2365739493F, 0.2369944038F, 0.2374151261F, 0.2378361156F, + 0.2382573720F, 0.2386788948F, 0.2391006836F, 0.2395227380F, + 0.2399450575F, 0.2403676417F, 0.2407904902F, 0.2412136026F, + 0.2416369783F, 0.2420606171F, 0.2424845185F, 0.2429086820F, + 0.2433331072F, 0.2437577936F, 0.2441827409F, 0.2446079486F, + 0.2450334163F, 0.2454591435F, 0.2458851298F, 0.2463113747F, + 0.2467378779F, 0.2471646389F, 0.2475916573F, 0.2480189325F, + 0.2484464643F, 0.2488742521F, 0.2493022955F, 0.2497305940F, + 0.2501591473F, 0.2505879549F, 0.2510170163F, 0.2514463311F, + 0.2518758989F, 0.2523057193F, 0.2527357916F, 0.2531661157F, + 0.2535966909F, 0.2540275169F, 0.2544585931F, 0.2548899193F, + 0.2553214948F, 0.2557533193F, 0.2561853924F, 0.2566177135F, + 0.2570502822F, 0.2574830981F, 0.2579161608F, 0.2583494697F, + 0.2587830245F, 0.2592168246F, 0.2596508697F, 0.2600851593F, + 0.2605196929F, 0.2609544701F, 0.2613894904F, 0.2618247534F, + 0.2622602586F, 0.2626960055F, 0.2631319938F, 0.2635682230F, + 0.2640046925F, 0.2644414021F, 0.2648783511F, 0.2653155391F, + 0.2657529657F, 0.2661906305F, 0.2666285329F, 0.2670666725F, + 0.2675050489F, 0.2679436616F, 0.2683825101F, 0.2688215940F, + 0.2692609127F, 0.2697004660F, 0.2701402532F, 0.2705802739F, + 0.2710205278F, 0.2714610142F, 0.2719017327F, 0.2723426830F, + 0.2727838644F, 0.2732252766F, 0.2736669191F, 0.2741087914F, + 0.2745508930F, 0.2749932235F, 0.2754357824F, 0.2758785693F, + 0.2763215837F, 0.2767648251F, 0.2772082930F, 0.2776519870F, + 0.2780959066F, 0.2785400513F, 0.2789844207F, 0.2794290143F, + 0.2798738316F, 0.2803188722F, 0.2807641355F, 0.2812096211F, + 0.2816553286F, 0.2821012574F, 0.2825474071F, 0.2829937773F, + 0.2834403673F, 0.2838871768F, 0.2843342053F, 0.2847814523F, + 0.2852289174F, 0.2856765999F, 0.2861244996F, 0.2865726159F, + 0.2870209482F, 0.2874694962F, 0.2879182594F, 0.2883672372F, + 0.2888164293F, 0.2892658350F, 0.2897154540F, 0.2901652858F, + 0.2906153298F, 0.2910655856F, 0.2915160527F, 0.2919667306F, + 0.2924176189F, 0.2928687171F, 0.2933200246F, 0.2937715409F, + 0.2942232657F, 0.2946751984F, 0.2951273386F, 0.2955796856F, + 0.2960322391F, 0.2964849986F, 0.2969379636F, 0.2973911335F, + 0.2978445080F, 0.2982980864F, 0.2987518684F, 0.2992058534F, + 0.2996600409F, 0.3001144305F, 0.3005690217F, 0.3010238139F, + 0.3014788067F, 0.3019339995F, 0.3023893920F, 0.3028449835F, + 0.3033007736F, 0.3037567618F, 0.3042129477F, 0.3046693306F, + 0.3051259102F, 0.3055826859F, 0.3060396572F, 0.3064968236F, + 0.3069541847F, 0.3074117399F, 0.3078694887F, 0.3083274307F, + 0.3087855653F, 0.3092438920F, 0.3097024104F, 0.3101611199F, + 0.3106200200F, 0.3110791103F, 0.3115383902F, 0.3119978592F, + 0.3124575169F, 0.3129173627F, 0.3133773961F, 0.3138376166F, + 0.3142980238F, 0.3147586170F, 0.3152193959F, 0.3156803598F, + 0.3161415084F, 0.3166028410F, 0.3170643573F, 0.3175260566F, + 0.3179879384F, 0.3184500023F, 0.3189122478F, 0.3193746743F, + 0.3198372814F, 0.3203000685F, 0.3207630351F, 0.3212261807F, + 0.3216895048F, 0.3221530069F, 0.3226166865F, 0.3230805430F, + 0.3235445760F, 0.3240087849F, 0.3244731693F, 0.3249377285F, + 0.3254024622F, 0.3258673698F, 0.3263324507F, 0.3267977045F, + 0.3272631306F, 0.3277287286F, 0.3281944978F, 0.3286604379F, + 0.3291265482F, 0.3295928284F, 0.3300592777F, 0.3305258958F, + 0.3309926821F, 0.3314596361F, 0.3319267573F, 0.3323940451F, + 0.3328614990F, 0.3333291186F, 0.3337969033F, 0.3342648525F, + 0.3347329658F, 0.3352012427F, 0.3356696825F, 0.3361382849F, + 0.3366070492F, 0.3370759749F, 0.3375450616F, 0.3380143087F, + 0.3384837156F, 0.3389532819F, 0.3394230071F, 0.3398928905F, + 0.3403629317F, 0.3408331302F, 0.3413034854F, 0.3417739967F, + 0.3422446638F, 0.3427154860F, 0.3431864628F, 0.3436575938F, + 0.3441288782F, 0.3446003158F, 0.3450719058F, 0.3455436478F, + 0.3460155412F, 0.3464875856F, 0.3469597804F, 0.3474321250F, + 0.3479046189F, 0.3483772617F, 0.3488500527F, 0.3493229914F, + 0.3497960774F, 0.3502693100F, 0.3507426887F, 0.3512162131F, + 0.3516898825F, 0.3521636965F, 0.3526376545F, 0.3531117559F, + 0.3535860003F, 0.3540603870F, 0.3545349157F, 0.3550095856F, + 0.3554843964F, 0.3559593474F, 0.3564344381F, 0.3569096680F, + 0.3573850366F, 0.3578605432F, 0.3583361875F, 0.3588119687F, + 0.3592878865F, 0.3597639402F, 0.3602401293F, 0.3607164533F, + 0.3611929117F, 0.3616695038F, 0.3621462292F, 0.3626230873F, + 0.3631000776F, 0.3635771995F, 0.3640544525F, 0.3645318360F, + 0.3650093496F, 0.3654869926F, 0.3659647645F, 0.3664426648F, + 0.3669206930F, 0.3673988484F, 0.3678771306F, 0.3683555390F, + 0.3688340731F, 0.3693127322F, 0.3697915160F, 0.3702704237F, + 0.3707494549F, 0.3712286091F, 0.3717078857F, 0.3721872840F, + 0.3726668037F, 0.3731464441F, 0.3736262047F, 0.3741060850F, + 0.3745860843F, 0.3750662023F, 0.3755464382F, 0.3760267915F, + 0.3765072618F, 0.3769878484F, 0.3774685509F, 0.3779493686F, + 0.3784303010F, 0.3789113475F, 0.3793925076F, 0.3798737809F, + 0.3803551666F, 0.3808366642F, 0.3813182733F, 0.3817999932F, + 0.3822818234F, 0.3827637633F, 0.3832458124F, 0.3837279702F, + 0.3842102360F, 0.3846926093F, 0.3851750897F, 0.3856576764F, + 0.3861403690F, 0.3866231670F, 0.3871060696F, 0.3875890765F, + 0.3880721870F, 0.3885554007F, 0.3890387168F, 0.3895221349F, + 0.3900056544F, 0.3904892748F, 0.3909729955F, 0.3914568160F, + 0.3919407356F, 0.3924247539F, 0.3929088702F, 0.3933930841F, + 0.3938773949F, 0.3943618021F, 0.3948463052F, 0.3953309035F, + 0.3958155966F, 0.3963003838F, 0.3967852646F, 0.3972702385F, + 0.3977553048F, 0.3982404631F, 0.3987257127F, 0.3992110531F, + 0.3996964838F, 0.4001820041F, 0.4006676136F, 0.4011533116F, + 0.4016390976F, 0.4021249710F, 0.4026109313F, 0.4030969779F, + 0.4035831102F, 0.4040693277F, 0.4045556299F, 0.4050420160F, + 0.4055284857F, 0.4060150383F, 0.4065016732F, 0.4069883899F, + 0.4074751879F, 0.4079620665F, 0.4084490252F, 0.4089360635F, + 0.4094231807F, 0.4099103763F, 0.4103976498F, 0.4108850005F, + 0.4113724280F, 0.4118599315F, 0.4123475107F, 0.4128351648F, + 0.4133228934F, 0.4138106959F, 0.4142985716F, 0.4147865201F, + 0.4152745408F, 0.4157626330F, 0.4162507963F, 0.4167390301F, + 0.4172273337F, 0.4177157067F, 0.4182041484F, 0.4186926583F, + 0.4191812359F, 0.4196698805F, 0.4201585915F, 0.4206473685F, + 0.4211362108F, 0.4216251179F, 0.4221140892F, 0.4226031241F, + 0.4230922221F, 0.4235813826F, 0.4240706050F, 0.4245598887F, + 0.4250492332F, 0.4255386379F, 0.4260281022F, 0.4265176256F, + 0.4270072075F, 0.4274968473F, 0.4279865445F, 0.4284762984F, + 0.4289661086F, 0.4294559743F, 0.4299458951F, 0.4304358704F, + 0.4309258996F, 0.4314159822F, 0.4319061175F, 0.4323963050F, + 0.4328865441F, 0.4333768342F, 0.4338671749F, 0.4343575654F, + 0.4348480052F, 0.4353384938F, 0.4358290306F, 0.4363196149F, + 0.4368102463F, 0.4373009241F, 0.4377916478F, 0.4382824168F, + 0.4387732305F, 0.4392640884F, 0.4397549899F, 0.4402459343F, + 0.4407369212F, 0.4412279499F, 0.4417190198F, 0.4422101305F, + 0.4427012813F, 0.4431924717F, 0.4436837010F, 0.4441749686F, + 0.4446662742F, 0.4451576169F, 0.4456489963F, 0.4461404118F, + 0.4466318628F, 0.4471233487F, 0.4476148690F, 0.4481064230F, + 0.4485980103F, 0.4490896302F, 0.4495812821F, 0.4500729654F, + 0.4505646797F, 0.4510564243F, 0.4515481986F, 0.4520400021F, + 0.4525318341F, 0.4530236942F, 0.4535155816F, 0.4540074959F, + 0.4544994365F, 0.4549914028F, 0.4554833941F, 0.4559754100F, + 0.4564674499F, 0.4569595131F, 0.4574515991F, 0.4579437074F, + 0.4584358372F, 0.4589279881F, 0.4594201595F, 0.4599123508F, + 0.4604045615F, 0.4608967908F, 0.4613890383F, 0.4618813034F, + 0.4623735855F, 0.4628658841F, 0.4633581984F, 0.4638505281F, + 0.4643428724F, 0.4648352308F, 0.4653276028F, 0.4658199877F, + 0.4663123849F, 0.4668047940F, 0.4672972143F, 0.4677896451F, + 0.4682820861F, 0.4687745365F, 0.4692669958F, 0.4697594634F, + 0.4702519387F, 0.4707444211F, 0.4712369102F, 0.4717294052F, + 0.4722219056F, 0.4727144109F, 0.4732069204F, 0.4736994336F, + 0.4741919498F, 0.4746844686F, 0.4751769893F, 0.4756695113F, + 0.4761620341F, 0.4766545571F, 0.4771470797F, 0.4776396013F, + 0.4781321213F, 0.4786246392F, 0.4791171544F, 0.4796096663F, + 0.4801021744F, 0.4805946779F, 0.4810871765F, 0.4815796694F, + 0.4820721561F, 0.4825646360F, 0.4830571086F, 0.4835495732F, + 0.4840420293F, 0.4845344763F, 0.4850269136F, 0.4855193407F, + 0.4860117569F, 0.4865041617F, 0.4869965545F, 0.4874889347F, + 0.4879813018F, 0.4884736551F, 0.4889659941F, 0.4894583182F, + 0.4899506268F, 0.4904429193F, 0.4909351952F, 0.4914274538F, + 0.4919196947F, 0.4924119172F, 0.4929041207F, 0.4933963046F, + 0.4938884685F, 0.4943806116F, 0.4948727335F, 0.4953648335F, + 0.4958569110F, 0.4963489656F, 0.4968409965F, 0.4973330032F, + 0.4978249852F, 0.4983169419F, 0.4988088726F, 0.4993007768F, + 0.4997926539F, 0.5002845034F, 0.5007763247F, 0.5012681171F, + 0.5017598801F, 0.5022516132F, 0.5027433157F, 0.5032349871F, + 0.5037266268F, 0.5042182341F, 0.5047098086F, 0.5052013497F, + 0.5056928567F, 0.5061843292F, 0.5066757664F, 0.5071671679F, + 0.5076585330F, 0.5081498613F, 0.5086411520F, 0.5091324047F, + 0.5096236187F, 0.5101147934F, 0.5106059284F, 0.5110970230F, + 0.5115880766F, 0.5120790887F, 0.5125700587F, 0.5130609860F, + 0.5135518700F, 0.5140427102F, 0.5145335059F, 0.5150242566F, + 0.5155149618F, 0.5160056208F, 0.5164962331F, 0.5169867980F, + 0.5174773151F, 0.5179677837F, 0.5184582033F, 0.5189485733F, + 0.5194388931F, 0.5199291621F, 0.5204193798F, 0.5209095455F, + 0.5213996588F, 0.5218897190F, 0.5223797256F, 0.5228696779F, + 0.5233595755F, 0.5238494177F, 0.5243392039F, 0.5248289337F, + 0.5253186063F, 0.5258082213F, 0.5262977781F, 0.5267872760F, + 0.5272767146F, 0.5277660932F, 0.5282554112F, 0.5287446682F, + 0.5292338635F, 0.5297229965F, 0.5302120667F, 0.5307010736F, + 0.5311900164F, 0.5316788947F, 0.5321677079F, 0.5326564554F, + 0.5331451366F, 0.5336337511F, 0.5341222981F, 0.5346107771F, + 0.5350991876F, 0.5355875290F, 0.5360758007F, 0.5365640021F, + 0.5370521327F, 0.5375401920F, 0.5380281792F, 0.5385160939F, + 0.5390039355F, 0.5394917034F, 0.5399793971F, 0.5404670159F, + 0.5409545594F, 0.5414420269F, 0.5419294179F, 0.5424167318F, + 0.5429039680F, 0.5433911261F, 0.5438782053F, 0.5443652051F, + 0.5448521250F, 0.5453389644F, 0.5458257228F, 0.5463123995F, + 0.5467989940F, 0.5472855057F, 0.5477719341F, 0.5482582786F, + 0.5487445387F, 0.5492307137F, 0.5497168031F, 0.5502028063F, + 0.5506887228F, 0.5511745520F, 0.5516602934F, 0.5521459463F, + 0.5526315103F, 0.5531169847F, 0.5536023690F, 0.5540876626F, + 0.5545728649F, 0.5550579755F, 0.5555429937F, 0.5560279189F, + 0.5565127507F, 0.5569974884F, 0.5574821315F, 0.5579666794F, + 0.5584511316F, 0.5589354875F, 0.5594197465F, 0.5599039080F, + 0.5603879716F, 0.5608719367F, 0.5613558026F, 0.5618395689F, + 0.5623232350F, 0.5628068002F, 0.5632902642F, 0.5637736262F, + 0.5642568858F, 0.5647400423F, 0.5652230953F, 0.5657060442F, + 0.5661888883F, 0.5666716272F, 0.5671542603F, 0.5676367870F, + 0.5681192069F, 0.5686015192F, 0.5690837235F, 0.5695658192F, + 0.5700478058F, 0.5705296827F, 0.5710114494F, 0.5714931052F, + 0.5719746497F, 0.5724560822F, 0.5729374023F, 0.5734186094F, + 0.5738997029F, 0.5743806823F, 0.5748615470F, 0.5753422965F, + 0.5758229301F, 0.5763034475F, 0.5767838480F, 0.5772641310F, + 0.5777442960F, 0.5782243426F, 0.5787042700F, 0.5791840778F, + 0.5796637654F, 0.5801433322F, 0.5806227778F, 0.5811021016F, + 0.5815813029F, 0.5820603814F, 0.5825393363F, 0.5830181673F, + 0.5834968737F, 0.5839754549F, 0.5844539105F, 0.5849322399F, + 0.5854104425F, 0.5858885179F, 0.5863664653F, 0.5868442844F, + 0.5873219746F, 0.5877995353F, 0.5882769660F, 0.5887542661F, + 0.5892314351F, 0.5897084724F, 0.5901853776F, 0.5906621500F, + 0.5911387892F, 0.5916152945F, 0.5920916655F, 0.5925679016F, + 0.5930440022F, 0.5935199669F, 0.5939957950F, 0.5944714861F, + 0.5949470396F, 0.5954224550F, 0.5958977317F, 0.5963728692F, + 0.5968478669F, 0.5973227244F, 0.5977974411F, 0.5982720163F, + 0.5987464497F, 0.5992207407F, 0.5996948887F, 0.6001688932F, + 0.6006427537F, 0.6011164696F, 0.6015900405F, 0.6020634657F, + 0.6025367447F, 0.6030098770F, 0.6034828621F, 0.6039556995F, + 0.6044283885F, 0.6049009288F, 0.6053733196F, 0.6058455606F, + 0.6063176512F, 0.6067895909F, 0.6072613790F, 0.6077330152F, + 0.6082044989F, 0.6086758295F, 0.6091470065F, 0.6096180294F, + 0.6100888977F, 0.6105596108F, 0.6110301682F, 0.6115005694F, + 0.6119708139F, 0.6124409011F, 0.6129108305F, 0.6133806017F, + 0.6138502139F, 0.6143196669F, 0.6147889599F, 0.6152580926F, + 0.6157270643F, 0.6161958746F, 0.6166645230F, 0.6171330088F, + 0.6176013317F, 0.6180694910F, 0.6185374863F, 0.6190053171F, + 0.6194729827F, 0.6199404828F, 0.6204078167F, 0.6208749841F, + 0.6213419842F, 0.6218088168F, 0.6222754811F, 0.6227419768F, + 0.6232083032F, 0.6236744600F, 0.6241404465F, 0.6246062622F, + 0.6250719067F, 0.6255373795F, 0.6260026799F, 0.6264678076F, + 0.6269327619F, 0.6273975425F, 0.6278621487F, 0.6283265800F, + 0.6287908361F, 0.6292549163F, 0.6297188201F, 0.6301825471F, + 0.6306460966F, 0.6311094683F, 0.6315726617F, 0.6320356761F, + 0.6324985111F, 0.6329611662F, 0.6334236410F, 0.6338859348F, + 0.6343480472F, 0.6348099777F, 0.6352717257F, 0.6357332909F, + 0.6361946726F, 0.6366558704F, 0.6371168837F, 0.6375777122F, + 0.6380383552F, 0.6384988123F, 0.6389590830F, 0.6394191668F, + 0.6398790631F, 0.6403387716F, 0.6407982916F, 0.6412576228F, + 0.6417167645F, 0.6421757163F, 0.6426344778F, 0.6430930483F, + 0.6435514275F, 0.6440096149F, 0.6444676098F, 0.6449254119F, + 0.6453830207F, 0.6458404356F, 0.6462976562F, 0.6467546820F, + 0.6472115125F, 0.6476681472F, 0.6481245856F, 0.6485808273F, + 0.6490368717F, 0.6494927183F, 0.6499483667F, 0.6504038164F, + 0.6508590670F, 0.6513141178F, 0.6517689684F, 0.6522236185F, + 0.6526780673F, 0.6531323146F, 0.6535863598F, 0.6540402024F, + 0.6544938419F, 0.6549472779F, 0.6554005099F, 0.6558535373F, + 0.6563063598F, 0.6567589769F, 0.6572113880F, 0.6576635927F, + 0.6581155906F, 0.6585673810F, 0.6590189637F, 0.6594703380F, + 0.6599215035F, 0.6603724598F, 0.6608232064F, 0.6612737427F, + 0.6617240684F, 0.6621741829F, 0.6626240859F, 0.6630737767F, + 0.6635232550F, 0.6639725202F, 0.6644215720F, 0.6648704098F, + 0.6653190332F, 0.6657674417F, 0.6662156348F, 0.6666636121F, + 0.6671113731F, 0.6675589174F, 0.6680062445F, 0.6684533538F, + 0.6689002450F, 0.6693469177F, 0.6697933712F, 0.6702396052F, + 0.6706856193F, 0.6711314129F, 0.6715769855F, 0.6720223369F, + 0.6724674664F, 0.6729123736F, 0.6733570581F, 0.6738015194F, + 0.6742457570F, 0.6746897706F, 0.6751335596F, 0.6755771236F, + 0.6760204621F, 0.6764635747F, 0.6769064609F, 0.6773491204F, + 0.6777915525F, 0.6782337570F, 0.6786757332F, 0.6791174809F, + 0.6795589995F, 0.6800002886F, 0.6804413477F, 0.6808821765F, + 0.6813227743F, 0.6817631409F, 0.6822032758F, 0.6826431785F, + 0.6830828485F, 0.6835222855F, 0.6839614890F, 0.6844004585F, + 0.6848391936F, 0.6852776939F, 0.6857159589F, 0.6861539883F, + 0.6865917815F, 0.6870293381F, 0.6874666576F, 0.6879037398F, + 0.6883405840F, 0.6887771899F, 0.6892135571F, 0.6896496850F, + 0.6900855733F, 0.6905212216F, 0.6909566294F, 0.6913917963F, + 0.6918267218F, 0.6922614055F, 0.6926958471F, 0.6931300459F, + 0.6935640018F, 0.6939977141F, 0.6944311825F, 0.6948644066F, + 0.6952973859F, 0.6957301200F, 0.6961626085F, 0.6965948510F, + 0.6970268470F, 0.6974585961F, 0.6978900980F, 0.6983213521F, + 0.6987523580F, 0.6991831154F, 0.6996136238F, 0.7000438828F, + 0.7004738921F, 0.7009036510F, 0.7013331594F, 0.7017624166F, + 0.7021914224F, 0.7026201763F, 0.7030486779F, 0.7034769268F, + 0.7039049226F, 0.7043326648F, 0.7047601531F, 0.7051873870F, + 0.7056143662F, 0.7060410902F, 0.7064675586F, 0.7068937711F, + 0.7073197271F, 0.7077454264F, 0.7081708684F, 0.7085960529F, + 0.7090209793F, 0.7094456474F, 0.7098700566F, 0.7102942066F, + 0.7107180970F, 0.7111417274F, 0.7115650974F, 0.7119882066F, + 0.7124110545F, 0.7128336409F, 0.7132559653F, 0.7136780272F, + 0.7140998264F, 0.7145213624F, 0.7149426348F, 0.7153636433F, + 0.7157843874F, 0.7162048668F, 0.7166250810F, 0.7170450296F, + 0.7174647124F, 0.7178841289F, 0.7183032786F, 0.7187221613F, + 0.7191407765F, 0.7195591239F, 0.7199772030F, 0.7203950135F, + 0.7208125550F, 0.7212298271F, 0.7216468294F, 0.7220635616F, + 0.7224800233F, 0.7228962140F, 0.7233121335F, 0.7237277813F, + 0.7241431571F, 0.7245582604F, 0.7249730910F, 0.7253876484F, + 0.7258019322F, 0.7262159422F, 0.7266296778F, 0.7270431388F, + 0.7274563247F, 0.7278692353F, 0.7282818700F, 0.7286942287F, + 0.7291063108F, 0.7295181160F, 0.7299296440F, 0.7303408944F, + 0.7307518669F, 0.7311625609F, 0.7315729763F, 0.7319831126F, + 0.7323929695F, 0.7328025466F, 0.7332118435F, 0.7336208600F, + 0.7340295955F, 0.7344380499F, 0.7348462226F, 0.7352541134F, + 0.7356617220F, 0.7360690478F, 0.7364760907F, 0.7368828502F, + 0.7372893259F, 0.7376955176F, 0.7381014249F, 0.7385070475F, + 0.7389123849F, 0.7393174368F, 0.7397222029F, 0.7401266829F, + 0.7405308763F, 0.7409347829F, 0.7413384023F, 0.7417417341F, + 0.7421447780F, 0.7425475338F, 0.7429500009F, 0.7433521791F, + 0.7437540681F, 0.7441556674F, 0.7445569769F, 0.7449579960F, + 0.7453587245F, 0.7457591621F, 0.7461593084F, 0.7465591631F, + 0.7469587259F, 0.7473579963F, 0.7477569741F, 0.7481556590F, + 0.7485540506F, 0.7489521486F, 0.7493499526F, 0.7497474623F, + 0.7501446775F, 0.7505415977F, 0.7509382227F, 0.7513345521F, + 0.7517305856F, 0.7521263229F, 0.7525217636F, 0.7529169074F, + 0.7533117541F, 0.7537063032F, 0.7541005545F, 0.7544945076F, + 0.7548881623F, 0.7552815182F, 0.7556745749F, 0.7560673323F, + 0.7564597899F, 0.7568519474F, 0.7572438046F, 0.7576353611F, + 0.7580266166F, 0.7584175708F, 0.7588082235F, 0.7591985741F, + 0.7595886226F, 0.7599783685F, 0.7603678116F, 0.7607569515F, + 0.7611457879F, 0.7615343206F, 0.7619225493F, 0.7623104735F, + 0.7626980931F, 0.7630854078F, 0.7634724171F, 0.7638591209F, + 0.7642455188F, 0.7646316106F, 0.7650173959F, 0.7654028744F, + 0.7657880459F, 0.7661729100F, 0.7665574664F, 0.7669417150F, + 0.7673256553F, 0.7677092871F, 0.7680926100F, 0.7684756239F, + 0.7688583284F, 0.7692407232F, 0.7696228080F, 0.7700045826F, + 0.7703860467F, 0.7707671999F, 0.7711480420F, 0.7715285728F, + 0.7719087918F, 0.7722886989F, 0.7726682938F, 0.7730475762F, + 0.7734265458F, 0.7738052023F, 0.7741835454F, 0.7745615750F, + 0.7749392906F, 0.7753166921F, 0.7756937791F, 0.7760705514F, + 0.7764470087F, 0.7768231508F, 0.7771989773F, 0.7775744880F, + 0.7779496827F, 0.7783245610F, 0.7786991227F, 0.7790733676F, + 0.7794472953F, 0.7798209056F, 0.7801941982F, 0.7805671729F, + 0.7809398294F, 0.7813121675F, 0.7816841869F, 0.7820558873F, + 0.7824272684F, 0.7827983301F, 0.7831690720F, 0.7835394940F, + 0.7839095957F, 0.7842793768F, 0.7846488373F, 0.7850179767F, + 0.7853867948F, 0.7857552914F, 0.7861234663F, 0.7864913191F, + 0.7868588497F, 0.7872260578F, 0.7875929431F, 0.7879595055F, + 0.7883257445F, 0.7886916601F, 0.7890572520F, 0.7894225198F, + 0.7897874635F, 0.7901520827F, 0.7905163772F, 0.7908803468F, + 0.7912439912F, 0.7916073102F, 0.7919703035F, 0.7923329710F, + 0.7926953124F, 0.7930573274F, 0.7934190158F, 0.7937803774F, + 0.7941414120F, 0.7945021193F, 0.7948624991F, 0.7952225511F, + 0.7955822752F, 0.7959416711F, 0.7963007387F, 0.7966594775F, + 0.7970178875F, 0.7973759685F, 0.7977337201F, 0.7980911422F, + 0.7984482346F, 0.7988049970F, 0.7991614292F, 0.7995175310F, + 0.7998733022F, 0.8002287426F, 0.8005838519F, 0.8009386299F, + 0.8012930765F, 0.8016471914F, 0.8020009744F, 0.8023544253F, + 0.8027075438F, 0.8030603298F, 0.8034127831F, 0.8037649035F, + 0.8041166906F, 0.8044681445F, 0.8048192647F, 0.8051700512F, + 0.8055205038F, 0.8058706222F, 0.8062204062F, 0.8065698556F, + 0.8069189702F, 0.8072677499F, 0.8076161944F, 0.8079643036F, + 0.8083120772F, 0.8086595151F, 0.8090066170F, 0.8093533827F, + 0.8096998122F, 0.8100459051F, 0.8103916613F, 0.8107370806F, + 0.8110821628F, 0.8114269077F, 0.8117713151F, 0.8121153849F, + 0.8124591169F, 0.8128025108F, 0.8131455666F, 0.8134882839F, + 0.8138306627F, 0.8141727027F, 0.8145144038F, 0.8148557658F, + 0.8151967886F, 0.8155374718F, 0.8158778154F, 0.8162178192F, + 0.8165574830F, 0.8168968067F, 0.8172357900F, 0.8175744328F, + 0.8179127349F, 0.8182506962F, 0.8185883164F, 0.8189255955F, + 0.8192625332F, 0.8195991295F, 0.8199353840F, 0.8202712967F, + 0.8206068673F, 0.8209420958F, 0.8212769820F, 0.8216115256F, + 0.8219457266F, 0.8222795848F, 0.8226131000F, 0.8229462721F, + 0.8232791009F, 0.8236115863F, 0.8239437280F, 0.8242755260F, + 0.8246069801F, 0.8249380901F, 0.8252688559F, 0.8255992774F, + 0.8259293544F, 0.8262590867F, 0.8265884741F, 0.8269175167F, + 0.8272462141F, 0.8275745663F, 0.8279025732F, 0.8282302344F, + 0.8285575501F, 0.8288845199F, 0.8292111437F, 0.8295374215F, + 0.8298633530F, 0.8301889382F, 0.8305141768F, 0.8308390688F, + 0.8311636141F, 0.8314878124F, 0.8318116637F, 0.8321351678F, + 0.8324583246F, 0.8327811340F, 0.8331035957F, 0.8334257098F, + 0.8337474761F, 0.8340688944F, 0.8343899647F, 0.8347106867F, + 0.8350310605F, 0.8353510857F, 0.8356707624F, 0.8359900904F, + 0.8363090696F, 0.8366276999F, 0.8369459811F, 0.8372639131F, + 0.8375814958F, 0.8378987292F, 0.8382156130F, 0.8385321472F, + 0.8388483316F, 0.8391641662F, 0.8394796508F, 0.8397947853F, + 0.8401095697F, 0.8404240037F, 0.8407380873F, 0.8410518204F, + 0.8413652029F, 0.8416782347F, 0.8419909156F, 0.8423032456F, + 0.8426152245F, 0.8429268523F, 0.8432381289F, 0.8435490541F, + 0.8438596279F, 0.8441698502F, 0.8444797208F, 0.8447892396F, + 0.8450984067F, 0.8454072218F, 0.8457156849F, 0.8460237959F, + 0.8463315547F, 0.8466389612F, 0.8469460154F, 0.8472527170F, + 0.8475590661F, 0.8478650625F, 0.8481707063F, 0.8484759971F, + 0.8487809351F, 0.8490855201F, 0.8493897521F, 0.8496936308F, + 0.8499971564F, 0.8503003286F, 0.8506031474F, 0.8509056128F, + 0.8512077246F, 0.8515094828F, 0.8518108872F, 0.8521119379F, + 0.8524126348F, 0.8527129777F, 0.8530129666F, 0.8533126015F, + 0.8536118822F, 0.8539108087F, 0.8542093809F, 0.8545075988F, + 0.8548054623F, 0.8551029712F, 0.8554001257F, 0.8556969255F, + 0.8559933707F, 0.8562894611F, 0.8565851968F, 0.8568805775F, + 0.8571756034F, 0.8574702743F, 0.8577645902F, 0.8580585509F, + 0.8583521566F, 0.8586454070F, 0.8589383021F, 0.8592308420F, + 0.8595230265F, 0.8598148556F, 0.8601063292F, 0.8603974473F, + 0.8606882098F, 0.8609786167F, 0.8612686680F, 0.8615583636F, + 0.8618477034F, 0.8621366874F, 0.8624253156F, 0.8627135878F, + 0.8630015042F, 0.8632890646F, 0.8635762690F, 0.8638631173F, + 0.8641496096F, 0.8644357457F, 0.8647215257F, 0.8650069495F, + 0.8652920171F, 0.8655767283F, 0.8658610833F, 0.8661450820F, + 0.8664287243F, 0.8667120102F, 0.8669949397F, 0.8672775127F, + 0.8675597293F, 0.8678415894F, 0.8681230929F, 0.8684042398F, + 0.8686850302F, 0.8689654640F, 0.8692455412F, 0.8695252617F, + 0.8698046255F, 0.8700836327F, 0.8703622831F, 0.8706405768F, + 0.8709185138F, 0.8711960940F, 0.8714733174F, 0.8717501840F, + 0.8720266939F, 0.8723028469F, 0.8725786430F, 0.8728540824F, + 0.8731291648F, 0.8734038905F, 0.8736782592F, 0.8739522711F, + 0.8742259261F, 0.8744992242F, 0.8747721653F, 0.8750447496F, + 0.8753169770F, 0.8755888475F, 0.8758603611F, 0.8761315177F, + 0.8764023175F, 0.8766727603F, 0.8769428462F, 0.8772125752F, + 0.8774819474F, 0.8777509626F, 0.8780196209F, 0.8782879224F, + 0.8785558669F, 0.8788234546F, 0.8790906854F, 0.8793575594F, + 0.8796240765F, 0.8798902368F, 0.8801560403F, 0.8804214870F, + 0.8806865768F, 0.8809513099F, 0.8812156863F, 0.8814797059F, + 0.8817433687F, 0.8820066749F, 0.8822696243F, 0.8825322171F, + 0.8827944532F, 0.8830563327F, 0.8833178556F, 0.8835790219F, + 0.8838398316F, 0.8841002848F, 0.8843603815F, 0.8846201217F, + 0.8848795054F, 0.8851385327F, 0.8853972036F, 0.8856555182F, + 0.8859134764F, 0.8861710783F, 0.8864283239F, 0.8866852133F, + 0.8869417464F, 0.8871979234F, 0.8874537443F, 0.8877092090F, + 0.8879643177F, 0.8882190704F, 0.8884734671F, 0.8887275078F, + 0.8889811927F, 0.8892345216F, 0.8894874948F, 0.8897401122F, + 0.8899923738F, 0.8902442798F, 0.8904958301F, 0.8907470248F, + 0.8909978640F, 0.8912483477F, 0.8914984759F, 0.8917482487F, + 0.8919976662F, 0.8922467284F, 0.8924954353F, 0.8927437871F, + 0.8929917837F, 0.8932394252F, 0.8934867118F, 0.8937336433F, + 0.8939802199F, 0.8942264417F, 0.8944723087F, 0.8947178210F, + 0.8949629785F, 0.8952077815F, 0.8954522299F, 0.8956963239F, + 0.8959400634F, 0.8961834486F, 0.8964264795F, 0.8966691561F, + 0.8969114786F, 0.8971534470F, 0.8973950614F, 0.8976363219F, + 0.8978772284F, 0.8981177812F, 0.8983579802F, 0.8985978256F, + 0.8988373174F, 0.8990764556F, 0.8993152405F, 0.8995536720F, + 0.8997917502F, 0.9000294751F, 0.9002668470F, 0.9005038658F, + 0.9007405317F, 0.9009768446F, 0.9012128048F, 0.9014484123F, + 0.9016836671F, 0.9019185693F, 0.9021531191F, 0.9023873165F, + 0.9026211616F, 0.9028546546F, 0.9030877954F, 0.9033205841F, + 0.9035530210F, 0.9037851059F, 0.9040168392F, 0.9042482207F, + 0.9044792507F, 0.9047099293F, 0.9049402564F, 0.9051702323F, + 0.9053998569F, 0.9056291305F, 0.9058580531F, 0.9060866248F, + 0.9063148457F, 0.9065427159F, 0.9067702355F, 0.9069974046F, + 0.9072242233F, 0.9074506917F, 0.9076768100F, 0.9079025782F, + 0.9081279964F, 0.9083530647F, 0.9085777833F, 0.9088021523F, + 0.9090261717F, 0.9092498417F, 0.9094731623F, 0.9096961338F, + 0.9099187561F, 0.9101410295F, 0.9103629540F, 0.9105845297F, + 0.9108057568F, 0.9110266354F, 0.9112471656F, 0.9114673475F, + 0.9116871812F, 0.9119066668F, 0.9121258046F, 0.9123445945F, + 0.9125630367F, 0.9127811314F, 0.9129988786F, 0.9132162785F, + 0.9134333312F, 0.9136500368F, 0.9138663954F, 0.9140824073F, + 0.9142980724F, 0.9145133910F, 0.9147283632F, 0.9149429890F, + 0.9151572687F, 0.9153712023F, 0.9155847900F, 0.9157980319F, + 0.9160109282F, 0.9162234790F, 0.9164356844F, 0.9166475445F, + 0.9168590595F, 0.9170702296F, 0.9172810548F, 0.9174915354F, + 0.9177016714F, 0.9179114629F, 0.9181209102F, 0.9183300134F, + 0.9185387726F, 0.9187471879F, 0.9189552595F, 0.9191629876F, + 0.9193703723F, 0.9195774136F, 0.9197841119F, 0.9199904672F, + 0.9201964797F, 0.9204021495F, 0.9206074767F, 0.9208124616F, + 0.9210171043F, 0.9212214049F, 0.9214253636F, 0.9216289805F, + 0.9218322558F, 0.9220351896F, 0.9222377821F, 0.9224400335F, + 0.9226419439F, 0.9228435134F, 0.9230447423F, 0.9232456307F, + 0.9234461787F, 0.9236463865F, 0.9238462543F, 0.9240457822F, + 0.9242449704F, 0.9244438190F, 0.9246423282F, 0.9248404983F, + 0.9250383293F, 0.9252358214F, 0.9254329747F, 0.9256297896F, + 0.9258262660F, 0.9260224042F, 0.9262182044F, 0.9264136667F, + 0.9266087913F, 0.9268035783F, 0.9269980280F, 0.9271921405F, + 0.9273859160F, 0.9275793546F, 0.9277724566F, 0.9279652221F, + 0.9281576513F, 0.9283497443F, 0.9285415014F, 0.9287329227F, + 0.9289240084F, 0.9291147586F, 0.9293051737F, 0.9294952536F, + 0.9296849987F, 0.9298744091F, 0.9300634850F, 0.9302522266F, + 0.9304406340F, 0.9306287074F, 0.9308164471F, 0.9310038532F, + 0.9311909259F, 0.9313776654F, 0.9315640719F, 0.9317501455F, + 0.9319358865F, 0.9321212951F, 0.9323063713F, 0.9324911155F, + 0.9326755279F, 0.9328596085F, 0.9330433577F, 0.9332267756F, + 0.9334098623F, 0.9335926182F, 0.9337750434F, 0.9339571380F, + 0.9341389023F, 0.9343203366F, 0.9345014409F, 0.9346822155F, + 0.9348626606F, 0.9350427763F, 0.9352225630F, 0.9354020207F, + 0.9355811498F, 0.9357599503F, 0.9359384226F, 0.9361165667F, + 0.9362943830F, 0.9364718716F, 0.9366490327F, 0.9368258666F, + 0.9370023733F, 0.9371785533F, 0.9373544066F, 0.9375299335F, + 0.9377051341F, 0.9378800087F, 0.9380545576F, 0.9382287809F, + 0.9384026787F, 0.9385762515F, 0.9387494993F, 0.9389224223F, + 0.9390950209F, 0.9392672951F, 0.9394392453F, 0.9396108716F, + 0.9397821743F, 0.9399531536F, 0.9401238096F, 0.9402941427F, + 0.9404641530F, 0.9406338407F, 0.9408032061F, 0.9409722495F, + 0.9411409709F, 0.9413093707F, 0.9414774491F, 0.9416452062F, + 0.9418126424F, 0.9419797579F, 0.9421465528F, 0.9423130274F, + 0.9424791819F, 0.9426450166F, 0.9428105317F, 0.9429757274F, + 0.9431406039F, 0.9433051616F, 0.9434694005F, 0.9436333209F, + 0.9437969232F, 0.9439602074F, 0.9441231739F, 0.9442858229F, + 0.9444481545F, 0.9446101691F, 0.9447718669F, 0.9449332481F, + 0.9450943129F, 0.9452550617F, 0.9454154945F, 0.9455756118F, + 0.9457354136F, 0.9458949003F, 0.9460540721F, 0.9462129292F, + 0.9463714719F, 0.9465297003F, 0.9466876149F, 0.9468452157F, + 0.9470025031F, 0.9471594772F, 0.9473161384F, 0.9474724869F, + 0.9476285229F, 0.9477842466F, 0.9479396584F, 0.9480947585F, + 0.9482495470F, 0.9484040243F, 0.9485581906F, 0.9487120462F, + 0.9488655913F, 0.9490188262F, 0.9491717511F, 0.9493243662F, + 0.9494766718F, 0.9496286683F, 0.9497803557F, 0.9499317345F, + 0.9500828047F, 0.9502335668F, 0.9503840209F, 0.9505341673F, + 0.9506840062F, 0.9508335380F, 0.9509827629F, 0.9511316810F, + 0.9512802928F, 0.9514285984F, 0.9515765982F, 0.9517242923F, + 0.9518716810F, 0.9520187646F, 0.9521655434F, 0.9523120176F, + 0.9524581875F, 0.9526040534F, 0.9527496154F, 0.9528948739F, + 0.9530398292F, 0.9531844814F, 0.9533288310F, 0.9534728780F, + 0.9536166229F, 0.9537600659F, 0.9539032071F, 0.9540460470F, + 0.9541885858F, 0.9543308237F, 0.9544727611F, 0.9546143981F, + 0.9547557351F, 0.9548967723F, 0.9550375100F, 0.9551779485F, + 0.9553180881F, 0.9554579290F, 0.9555974714F, 0.9557367158F, + 0.9558756623F, 0.9560143112F, 0.9561526628F, 0.9562907174F, + 0.9564284752F, 0.9565659366F, 0.9567031017F, 0.9568399710F, + 0.9569765446F, 0.9571128229F, 0.9572488061F, 0.9573844944F, + 0.9575198883F, 0.9576549879F, 0.9577897936F, 0.9579243056F, + 0.9580585242F, 0.9581924497F, 0.9583260824F, 0.9584594226F, + 0.9585924705F, 0.9587252264F, 0.9588576906F, 0.9589898634F, + 0.9591217452F, 0.9592533360F, 0.9593846364F, 0.9595156465F, + 0.9596463666F, 0.9597767971F, 0.9599069382F, 0.9600367901F, + 0.9601663533F, 0.9602956279F, 0.9604246143F, 0.9605533128F, + 0.9606817236F, 0.9608098471F, 0.9609376835F, 0.9610652332F, + 0.9611924963F, 0.9613194733F, 0.9614461644F, 0.9615725699F, + 0.9616986901F, 0.9618245253F, 0.9619500757F, 0.9620753418F, + 0.9622003238F, 0.9623250219F, 0.9624494365F, 0.9625735679F, + 0.9626974163F, 0.9628209821F, 0.9629442656F, 0.9630672671F, + 0.9631899868F, 0.9633124251F, 0.9634345822F, 0.9635564585F, + 0.9636780543F, 0.9637993699F, 0.9639204056F, 0.9640411616F, + 0.9641616383F, 0.9642818359F, 0.9644017549F, 0.9645213955F, + 0.9646407579F, 0.9647598426F, 0.9648786497F, 0.9649971797F, + 0.9651154328F, 0.9652334092F, 0.9653511095F, 0.9654685337F, + 0.9655856823F, 0.9657025556F, 0.9658191538F, 0.9659354773F, + 0.9660515263F, 0.9661673013F, 0.9662828024F, 0.9663980300F, + 0.9665129845F, 0.9666276660F, 0.9667420750F, 0.9668562118F, + 0.9669700766F, 0.9670836698F, 0.9671969917F, 0.9673100425F, + 0.9674228227F, 0.9675353325F, 0.9676475722F, 0.9677595422F, + 0.9678712428F, 0.9679826742F, 0.9680938368F, 0.9682047309F, + 0.9683153569F, 0.9684257150F, 0.9685358056F, 0.9686456289F, + 0.9687551853F, 0.9688644752F, 0.9689734987F, 0.9690822564F, + 0.9691907483F, 0.9692989750F, 0.9694069367F, 0.9695146337F, + 0.9696220663F, 0.9697292349F, 0.9698361398F, 0.9699427813F, + 0.9700491597F, 0.9701552754F, 0.9702611286F, 0.9703667197F, + 0.9704720490F, 0.9705771169F, 0.9706819236F, 0.9707864695F, + 0.9708907549F, 0.9709947802F, 0.9710985456F, 0.9712020514F, + 0.9713052981F, 0.9714082859F, 0.9715110151F, 0.9716134862F, + 0.9717156993F, 0.9718176549F, 0.9719193532F, 0.9720207946F, + 0.9721219794F, 0.9722229080F, 0.9723235806F, 0.9724239976F, + 0.9725241593F, 0.9726240661F, 0.9727237183F, 0.9728231161F, + 0.9729222601F, 0.9730211503F, 0.9731197873F, 0.9732181713F, + 0.9733163027F, 0.9734141817F, 0.9735118088F, 0.9736091842F, + 0.9737063083F, 0.9738031814F, 0.9738998039F, 0.9739961760F, + 0.9740922981F, 0.9741881706F, 0.9742837938F, 0.9743791680F, + 0.9744742935F, 0.9745691707F, 0.9746637999F, 0.9747581814F, + 0.9748523157F, 0.9749462029F, 0.9750398435F, 0.9751332378F, + 0.9752263861F, 0.9753192887F, 0.9754119461F, 0.9755043585F, + 0.9755965262F, 0.9756884496F, 0.9757801291F, 0.9758715650F, + 0.9759627575F, 0.9760537071F, 0.9761444141F, 0.9762348789F, + 0.9763251016F, 0.9764150828F, 0.9765048228F, 0.9765943218F, + 0.9766835802F, 0.9767725984F, 0.9768613767F, 0.9769499154F, + 0.9770382149F, 0.9771262755F, 0.9772140976F, 0.9773016815F, + 0.9773890275F, 0.9774761360F, 0.9775630073F, 0.9776496418F, + 0.9777360398F, 0.9778222016F, 0.9779081277F, 0.9779938182F, + 0.9780792736F, 0.9781644943F, 0.9782494805F, 0.9783342326F, + 0.9784187509F, 0.9785030359F, 0.9785870877F, 0.9786709069F, + 0.9787544936F, 0.9788378484F, 0.9789209714F, 0.9790038631F, + 0.9790865238F, 0.9791689538F, 0.9792511535F, 0.9793331232F, + 0.9794148633F, 0.9794963742F, 0.9795776561F, 0.9796587094F, + 0.9797395345F, 0.9798201316F, 0.9799005013F, 0.9799806437F, + 0.9800605593F, 0.9801402483F, 0.9802197112F, 0.9802989483F, + 0.9803779600F, 0.9804567465F, 0.9805353082F, 0.9806136455F, + 0.9806917587F, 0.9807696482F, 0.9808473143F, 0.9809247574F, + 0.9810019778F, 0.9810789759F, 0.9811557519F, 0.9812323064F, + 0.9813086395F, 0.9813847517F, 0.9814606433F, 0.9815363147F, + 0.9816117662F, 0.9816869981F, 0.9817620108F, 0.9818368047F, + 0.9819113801F, 0.9819857374F, 0.9820598769F, 0.9821337989F, + 0.9822075038F, 0.9822809920F, 0.9823542638F, 0.9824273195F, + 0.9825001596F, 0.9825727843F, 0.9826451940F, 0.9827173891F, + 0.9827893700F, 0.9828611368F, 0.9829326901F, 0.9830040302F, + 0.9830751574F, 0.9831460720F, 0.9832167745F, 0.9832872652F, + 0.9833575444F, 0.9834276124F, 0.9834974697F, 0.9835671166F, + 0.9836365535F, 0.9837057806F, 0.9837747983F, 0.9838436071F, + 0.9839122072F, 0.9839805990F, 0.9840487829F, 0.9841167591F, + 0.9841845282F, 0.9842520903F, 0.9843194459F, 0.9843865953F, + 0.9844535389F, 0.9845202771F, 0.9845868101F, 0.9846531383F, + 0.9847192622F, 0.9847851820F, 0.9848508980F, 0.9849164108F, + 0.9849817205F, 0.9850468276F, 0.9851117324F, 0.9851764352F, + 0.9852409365F, 0.9853052366F, 0.9853693358F, 0.9854332344F, + 0.9854969330F, 0.9855604317F, 0.9856237309F, 0.9856868310F, + 0.9857497325F, 0.9858124355F, 0.9858749404F, 0.9859372477F, + 0.9859993577F, 0.9860612707F, 0.9861229871F, 0.9861845072F, + 0.9862458315F, 0.9863069601F, 0.9863678936F, 0.9864286322F, + 0.9864891764F, 0.9865495264F, 0.9866096826F, 0.9866696454F, + 0.9867294152F, 0.9867889922F, 0.9868483769F, 0.9869075695F, + 0.9869665706F, 0.9870253803F, 0.9870839991F, 0.9871424273F, + 0.9872006653F, 0.9872587135F, 0.9873165721F, 0.9873742415F, + 0.9874317222F, 0.9874890144F, 0.9875461185F, 0.9876030348F, + 0.9876597638F, 0.9877163057F, 0.9877726610F, 0.9878288300F, + 0.9878848130F, 0.9879406104F, 0.9879962225F, 0.9880516497F, + 0.9881068924F, 0.9881619509F, 0.9882168256F, 0.9882715168F, + 0.9883260249F, 0.9883803502F, 0.9884344931F, 0.9884884539F, + 0.9885422331F, 0.9885958309F, 0.9886492477F, 0.9887024838F, + 0.9887555397F, 0.9888084157F, 0.9888611120F, 0.9889136292F, + 0.9889659675F, 0.9890181273F, 0.9890701089F, 0.9891219128F, + 0.9891735392F, 0.9892249885F, 0.9892762610F, 0.9893273572F, + 0.9893782774F, 0.9894290219F, 0.9894795911F, 0.9895299853F, + 0.9895802049F, 0.9896302502F, 0.9896801217F, 0.9897298196F, + 0.9897793443F, 0.9898286961F, 0.9898778755F, 0.9899268828F, + 0.9899757183F, 0.9900243823F, 0.9900728753F, 0.9901211976F, + 0.9901693495F, 0.9902173314F, 0.9902651436F, 0.9903127865F, + 0.9903602605F, 0.9904075659F, 0.9904547031F, 0.9905016723F, + 0.9905484740F, 0.9905951086F, 0.9906415763F, 0.9906878775F, + 0.9907340126F, 0.9907799819F, 0.9908257858F, 0.9908714247F, + 0.9909168988F, 0.9909622086F, 0.9910073543F, 0.9910523364F, + 0.9910971552F, 0.9911418110F, 0.9911863042F, 0.9912306351F, + 0.9912748042F, 0.9913188117F, 0.9913626580F, 0.9914063435F, + 0.9914498684F, 0.9914932333F, 0.9915364383F, 0.9915794839F, + 0.9916223703F, 0.9916650981F, 0.9917076674F, 0.9917500787F, + 0.9917923323F, 0.9918344286F, 0.9918763679F, 0.9919181505F, + 0.9919597769F, 0.9920012473F, 0.9920425621F, 0.9920837217F, + 0.9921247263F, 0.9921655765F, 0.9922062724F, 0.9922468145F, + 0.9922872030F, 0.9923274385F, 0.9923675211F, 0.9924074513F, + 0.9924472294F, 0.9924868557F, 0.9925263306F, 0.9925656544F, + 0.9926048275F, 0.9926438503F, 0.9926827230F, 0.9927214461F, + 0.9927600199F, 0.9927984446F, 0.9928367208F, 0.9928748486F, + 0.9929128285F, 0.9929506608F, 0.9929883459F, 0.9930258841F, + 0.9930632757F, 0.9931005211F, 0.9931376207F, 0.9931745747F, + 0.9932113836F, 0.9932480476F, 0.9932845671F, 0.9933209425F, + 0.9933571742F, 0.9933932623F, 0.9934292074F, 0.9934650097F, + 0.9935006696F, 0.9935361874F, 0.9935715635F, 0.9936067982F, + 0.9936418919F, 0.9936768448F, 0.9937116574F, 0.9937463300F, + 0.9937808629F, 0.9938152565F, 0.9938495111F, 0.9938836271F, + 0.9939176047F, 0.9939514444F, 0.9939851465F, 0.9940187112F, + 0.9940521391F, 0.9940854303F, 0.9941185853F, 0.9941516044F, + 0.9941844879F, 0.9942172361F, 0.9942498495F, 0.9942823283F, + 0.9943146729F, 0.9943468836F, 0.9943789608F, 0.9944109047F, + 0.9944427158F, 0.9944743944F, 0.9945059408F, 0.9945373553F, + 0.9945686384F, 0.9945997902F, 0.9946308112F, 0.9946617017F, + 0.9946924621F, 0.9947230926F, 0.9947535937F, 0.9947839656F, + 0.9948142086F, 0.9948443232F, 0.9948743097F, 0.9949041683F, + 0.9949338995F, 0.9949635035F, 0.9949929807F, 0.9950223315F, + 0.9950515561F, 0.9950806549F, 0.9951096282F, 0.9951384764F, + 0.9951671998F, 0.9951957987F, 0.9952242735F, 0.9952526245F, + 0.9952808520F, 0.9953089564F, 0.9953369380F, 0.9953647971F, + 0.9953925340F, 0.9954201491F, 0.9954476428F, 0.9954750153F, + 0.9955022670F, 0.9955293981F, 0.9955564092F, 0.9955833003F, + 0.9956100720F, 0.9956367245F, 0.9956632582F, 0.9956896733F, + 0.9957159703F, 0.9957421494F, 0.9957682110F, 0.9957941553F, + 0.9958199828F, 0.9958456937F, 0.9958712884F, 0.9958967672F, + 0.9959221305F, 0.9959473784F, 0.9959725115F, 0.9959975300F, + 0.9960224342F, 0.9960472244F, 0.9960719011F, 0.9960964644F, + 0.9961209148F, 0.9961452525F, 0.9961694779F, 0.9961935913F, + 0.9962175930F, 0.9962414834F, 0.9962652627F, 0.9962889313F, + 0.9963124895F, 0.9963359377F, 0.9963592761F, 0.9963825051F, + 0.9964056250F, 0.9964286361F, 0.9964515387F, 0.9964743332F, + 0.9964970198F, 0.9965195990F, 0.9965420709F, 0.9965644360F, + 0.9965866946F, 0.9966088469F, 0.9966308932F, 0.9966528340F, + 0.9966746695F, 0.9966964001F, 0.9967180260F, 0.9967395475F, + 0.9967609651F, 0.9967822789F, 0.9968034894F, 0.9968245968F, + 0.9968456014F, 0.9968665036F, 0.9968873037F, 0.9969080019F, + 0.9969285987F, 0.9969490942F, 0.9969694889F, 0.9969897830F, + 0.9970099769F, 0.9970300708F, 0.9970500651F, 0.9970699601F, + 0.9970897561F, 0.9971094533F, 0.9971290522F, 0.9971485531F, + 0.9971679561F, 0.9971872617F, 0.9972064702F, 0.9972255818F, + 0.9972445968F, 0.9972635157F, 0.9972823386F, 0.9973010659F, + 0.9973196980F, 0.9973382350F, 0.9973566773F, 0.9973750253F, + 0.9973932791F, 0.9974114392F, 0.9974295059F, 0.9974474793F, + 0.9974653599F, 0.9974831480F, 0.9975008438F, 0.9975184476F, + 0.9975359598F, 0.9975533806F, 0.9975707104F, 0.9975879495F, + 0.9976050981F, 0.9976221566F, 0.9976391252F, 0.9976560043F, + 0.9976727941F, 0.9976894950F, 0.9977061073F, 0.9977226312F, + 0.9977390671F, 0.9977554152F, 0.9977716759F, 0.9977878495F, + 0.9978039361F, 0.9978199363F, 0.9978358501F, 0.9978516780F, + 0.9978674202F, 0.9978830771F, 0.9978986488F, 0.9979141358F, + 0.9979295383F, 0.9979448566F, 0.9979600909F, 0.9979752417F, + 0.9979903091F, 0.9980052936F, 0.9980201952F, 0.9980350145F, + 0.9980497515F, 0.9980644067F, 0.9980789804F, 0.9980934727F, + 0.9981078841F, 0.9981222147F, 0.9981364649F, 0.9981506350F, + 0.9981647253F, 0.9981787360F, 0.9981926674F, 0.9982065199F, + 0.9982202936F, 0.9982339890F, 0.9982476062F, 0.9982611456F, + 0.9982746074F, 0.9982879920F, 0.9983012996F, 0.9983145304F, + 0.9983276849F, 0.9983407632F, 0.9983537657F, 0.9983666926F, + 0.9983795442F, 0.9983923208F, 0.9984050226F, 0.9984176501F, + 0.9984302033F, 0.9984426827F, 0.9984550884F, 0.9984674208F, + 0.9984796802F, 0.9984918667F, 0.9985039808F, 0.9985160227F, + 0.9985279926F, 0.9985398909F, 0.9985517177F, 0.9985634734F, + 0.9985751583F, 0.9985867727F, 0.9985983167F, 0.9986097907F, + 0.9986211949F, 0.9986325297F, 0.9986437953F, 0.9986549919F, + 0.9986661199F, 0.9986771795F, 0.9986881710F, 0.9986990946F, + 0.9987099507F, 0.9987207394F, 0.9987314611F, 0.9987421161F, + 0.9987527045F, 0.9987632267F, 0.9987736829F, 0.9987840734F, + 0.9987943985F, 0.9988046584F, 0.9988148534F, 0.9988249838F, + 0.9988350498F, 0.9988450516F, 0.9988549897F, 0.9988648641F, + 0.9988746753F, 0.9988844233F, 0.9988941086F, 0.9989037313F, + 0.9989132918F, 0.9989227902F, 0.9989322269F, 0.9989416021F, + 0.9989509160F, 0.9989601690F, 0.9989693613F, 0.9989784931F, + 0.9989875647F, 0.9989965763F, 0.9990055283F, 0.9990144208F, + 0.9990232541F, 0.9990320286F, 0.9990407443F, 0.9990494016F, + 0.9990580008F, 0.9990665421F, 0.9990750257F, 0.9990834519F, + 0.9990918209F, 0.9991001331F, 0.9991083886F, 0.9991165877F, + 0.9991247307F, 0.9991328177F, 0.9991408491F, 0.9991488251F, + 0.9991567460F, 0.9991646119F, 0.9991724232F, 0.9991801801F, + 0.9991878828F, 0.9991955316F, 0.9992031267F, 0.9992106684F, + 0.9992181569F, 0.9992255925F, 0.9992329753F, 0.9992403057F, + 0.9992475839F, 0.9992548101F, 0.9992619846F, 0.9992691076F, + 0.9992761793F, 0.9992832001F, 0.9992901701F, 0.9992970895F, + 0.9993039587F, 0.9993107777F, 0.9993175470F, 0.9993242667F, + 0.9993309371F, 0.9993375583F, 0.9993441307F, 0.9993506545F, + 0.9993571298F, 0.9993635570F, 0.9993699362F, 0.9993762678F, + 0.9993825519F, 0.9993887887F, 0.9993949785F, 0.9994011216F, + 0.9994072181F, 0.9994132683F, 0.9994192725F, 0.9994252307F, + 0.9994311434F, 0.9994370107F, 0.9994428327F, 0.9994486099F, + 0.9994543423F, 0.9994600303F, 0.9994656739F, 0.9994712736F, + 0.9994768294F, 0.9994823417F, 0.9994878105F, 0.9994932363F, + 0.9994986191F, 0.9995039592F, 0.9995092568F, 0.9995145122F, + 0.9995197256F, 0.9995248971F, 0.9995300270F, 0.9995351156F, + 0.9995401630F, 0.9995451695F, 0.9995501352F, 0.9995550604F, + 0.9995599454F, 0.9995647903F, 0.9995695953F, 0.9995743607F, + 0.9995790866F, 0.9995837734F, 0.9995884211F, 0.9995930300F, + 0.9995976004F, 0.9996021324F, 0.9996066263F, 0.9996110822F, + 0.9996155004F, 0.9996198810F, 0.9996242244F, 0.9996285306F, + 0.9996327999F, 0.9996370326F, 0.9996412287F, 0.9996453886F, + 0.9996495125F, 0.9996536004F, 0.9996576527F, 0.9996616696F, + 0.9996656512F, 0.9996695977F, 0.9996735094F, 0.9996773865F, + 0.9996812291F, 0.9996850374F, 0.9996888118F, 0.9996925523F, + 0.9996962591F, 0.9996999325F, 0.9997035727F, 0.9997071798F, + 0.9997107541F, 0.9997142957F, 0.9997178049F, 0.9997212818F, + 0.9997247266F, 0.9997281396F, 0.9997315209F, 0.9997348708F, + 0.9997381893F, 0.9997414767F, 0.9997447333F, 0.9997479591F, + 0.9997511544F, 0.9997543194F, 0.9997574542F, 0.9997605591F, + 0.9997636342F, 0.9997666797F, 0.9997696958F, 0.9997726828F, + 0.9997756407F, 0.9997785698F, 0.9997814703F, 0.9997843423F, + 0.9997871860F, 0.9997900016F, 0.9997927894F, 0.9997955494F, + 0.9997982818F, 0.9998009869F, 0.9998036648F, 0.9998063157F, + 0.9998089398F, 0.9998115373F, 0.9998141082F, 0.9998166529F, + 0.9998191715F, 0.9998216642F, 0.9998241311F, 0.9998265724F, + 0.9998289884F, 0.9998313790F, 0.9998337447F, 0.9998360854F, + 0.9998384015F, 0.9998406930F, 0.9998429602F, 0.9998452031F, + 0.9998474221F, 0.9998496171F, 0.9998517885F, 0.9998539364F, + 0.9998560610F, 0.9998581624F, 0.9998602407F, 0.9998622962F, + 0.9998643291F, 0.9998663394F, 0.9998683274F, 0.9998702932F, + 0.9998722370F, 0.9998741589F, 0.9998760591F, 0.9998779378F, + 0.9998797952F, 0.9998816313F, 0.9998834464F, 0.9998852406F, + 0.9998870141F, 0.9998887670F, 0.9998904995F, 0.9998922117F, + 0.9998939039F, 0.9998955761F, 0.9998972285F, 0.9998988613F, + 0.9999004746F, 0.9999020686F, 0.9999036434F, 0.9999051992F, + 0.9999067362F, 0.9999082544F, 0.9999097541F, 0.9999112354F, + 0.9999126984F, 0.9999141433F, 0.9999155703F, 0.9999169794F, + 0.9999183709F, 0.9999197449F, 0.9999211014F, 0.9999224408F, + 0.9999237631F, 0.9999250684F, 0.9999263570F, 0.9999276289F, + 0.9999288843F, 0.9999301233F, 0.9999313461F, 0.9999325529F, + 0.9999337437F, 0.9999349187F, 0.9999360780F, 0.9999372218F, + 0.9999383503F, 0.9999394635F, 0.9999405616F, 0.9999416447F, + 0.9999427129F, 0.9999437665F, 0.9999448055F, 0.9999458301F, + 0.9999468404F, 0.9999478365F, 0.9999488185F, 0.9999497867F, + 0.9999507411F, 0.9999516819F, 0.9999526091F, 0.9999535230F, + 0.9999544236F, 0.9999553111F, 0.9999561856F, 0.9999570472F, + 0.9999578960F, 0.9999587323F, 0.9999595560F, 0.9999603674F, + 0.9999611666F, 0.9999619536F, 0.9999627286F, 0.9999634917F, + 0.9999642431F, 0.9999649828F, 0.9999657110F, 0.9999664278F, + 0.9999671334F, 0.9999678278F, 0.9999685111F, 0.9999691835F, + 0.9999698451F, 0.9999704960F, 0.9999711364F, 0.9999717662F, + 0.9999723858F, 0.9999729950F, 0.9999735942F, 0.9999741834F, + 0.9999747626F, 0.9999753321F, 0.9999758919F, 0.9999764421F, + 0.9999769828F, 0.9999775143F, 0.9999780364F, 0.9999785495F, + 0.9999790535F, 0.9999795485F, 0.9999800348F, 0.9999805124F, + 0.9999809813F, 0.9999814417F, 0.9999818938F, 0.9999823375F, + 0.9999827731F, 0.9999832005F, 0.9999836200F, 0.9999840316F, + 0.9999844353F, 0.9999848314F, 0.9999852199F, 0.9999856008F, + 0.9999859744F, 0.9999863407F, 0.9999866997F, 0.9999870516F, + 0.9999873965F, 0.9999877345F, 0.9999880656F, 0.9999883900F, + 0.9999887078F, 0.9999890190F, 0.9999893237F, 0.9999896220F, + 0.9999899140F, 0.9999901999F, 0.9999904796F, 0.9999907533F, + 0.9999910211F, 0.9999912830F, 0.9999915391F, 0.9999917896F, + 0.9999920345F, 0.9999922738F, 0.9999925077F, 0.9999927363F, + 0.9999929596F, 0.9999931777F, 0.9999933907F, 0.9999935987F, + 0.9999938018F, 0.9999940000F, 0.9999941934F, 0.9999943820F, + 0.9999945661F, 0.9999947456F, 0.9999949206F, 0.9999950912F, + 0.9999952575F, 0.9999954195F, 0.9999955773F, 0.9999957311F, + 0.9999958807F, 0.9999960265F, 0.9999961683F, 0.9999963063F, + 0.9999964405F, 0.9999965710F, 0.9999966979F, 0.9999968213F, + 0.9999969412F, 0.9999970576F, 0.9999971707F, 0.9999972805F, + 0.9999973871F, 0.9999974905F, 0.9999975909F, 0.9999976881F, + 0.9999977824F, 0.9999978738F, 0.9999979624F, 0.9999980481F, + 0.9999981311F, 0.9999982115F, 0.9999982892F, 0.9999983644F, + 0.9999984370F, 0.9999985072F, 0.9999985750F, 0.9999986405F, + 0.9999987037F, 0.9999987647F, 0.9999988235F, 0.9999988802F, + 0.9999989348F, 0.9999989873F, 0.9999990379F, 0.9999990866F, + 0.9999991334F, 0.9999991784F, 0.9999992217F, 0.9999992632F, + 0.9999993030F, 0.9999993411F, 0.9999993777F, 0.9999994128F, + 0.9999994463F, 0.9999994784F, 0.9999995091F, 0.9999995384F, + 0.9999995663F, 0.9999995930F, 0.9999996184F, 0.9999996426F, + 0.9999996657F, 0.9999996876F, 0.9999997084F, 0.9999997282F, + 0.9999997469F, 0.9999997647F, 0.9999997815F, 0.9999997973F, + 0.9999998123F, 0.9999998265F, 0.9999998398F, 0.9999998524F, + 0.9999998642F, 0.9999998753F, 0.9999998857F, 0.9999998954F, + 0.9999999045F, 0.9999999130F, 0.9999999209F, 0.9999999282F, + 0.9999999351F, 0.9999999414F, 0.9999999472F, 0.9999999526F, + 0.9999999576F, 0.9999999622F, 0.9999999664F, 0.9999999702F, + 0.9999999737F, 0.9999999769F, 0.9999999798F, 0.9999999824F, + 0.9999999847F, 0.9999999868F, 0.9999999887F, 0.9999999904F, + 0.9999999919F, 0.9999999932F, 0.9999999943F, 0.9999999953F, + 0.9999999961F, 0.9999999969F, 0.9999999975F, 0.9999999980F, + 0.9999999985F, 0.9999999988F, 0.9999999991F, 0.9999999993F, + 0.9999999995F, 0.9999999997F, 0.9999999998F, 0.9999999999F, + 0.9999999999F, 1.0000000000F, 1.0000000000F, 1.0000000000F, + 1.0000000000F, 1.0000000000F, 1.0000000000F, 1.0000000000F, +}; + +static float *vwin[8] = { + vwin64, + vwin128, + vwin256, + vwin512, + vwin1024, + vwin2048, + vwin4096, + vwin8192, +}; + +float *_vorbis_window_get(int n){ + return vwin[n]; +} + +void _vorbis_apply_window(float *d,int *winno,long *blocksizes, + int lW,int W,int nW){ + lW=(W?lW:0); + nW=(W?nW:0); + + { + float *windowLW=vwin[winno[lW]]; + float *windowNW=vwin[winno[nW]]; + + long n=blocksizes[W]; + long ln=blocksizes[lW]; + long rn=blocksizes[nW]; + + long leftbegin=n/4-ln/4; + long leftend=leftbegin+ln/2; + + long rightbegin=n/2+n/4-rn/4; + long rightend=rightbegin+rn/2; + + int i,p; + + for(i=0;i + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + Vorbis + CFBundleIconFile + + CFBundleIdentifier + com.apple.carbonframeworktemplate + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + FMWK + CFBundleSignature + ???? + CFBundleVersion + 1.0 + CFBundleShortVersionString + 1.0 + CSResourcesFileMapped + + + diff --git a/Libraries/Vorbis/Vorbis.xcode/project.pbxproj b/Libraries/Vorbis/Vorbis.xcode/project.pbxproj new file mode 100644 index 000000000..3700a9422 --- /dev/null +++ b/Libraries/Vorbis/Vorbis.xcode/project.pbxproj @@ -0,0 +1,1452 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 39; + objects = { + 034768DDFF38A45A11DB9C8B = { + children = ( + 8D07F2C80486CC7A007CD1D0, + ); + isa = PBXGroup; + name = Products; + refType = 4; + sourceTree = ""; + }; +//030 +//031 +//032 +//033 +//034 +//080 +//081 +//082 +//083 +//084 + 0867D690FE84028FC02AAC07 = { + buildSettings = { + }; + buildStyles = ( + 4F0BB7EC011F40E904CA0E50, + 4F0BB7ED011F40E904CA0E50, + ); + hasScannedForEncodings = 1; + isa = PBXProject; + mainGroup = 0867D691FE84028FC02AAC07; + productRefGroup = 034768DDFF38A45A11DB9C8B; + projectDirPath = ""; + targets = ( + 8D07F2BC0486CC7A007CD1D0, + ); + }; + 0867D691FE84028FC02AAC07 = { + children = ( + 8EDC8177082DF9260052F5E7, + 08FB77ACFE841707C02AAC07, + 089C1665FE841158C02AAC07, + 0867D69AFE84028FC02AAC07, + 034768DDFF38A45A11DB9C8B, + ); + isa = PBXGroup; + name = Vorbis; + refType = 4; + sourceTree = ""; + }; + 0867D69AFE84028FC02AAC07 = { + children = ( + 8EE4A66D082E6DBA00415456, + ); + isa = PBXGroup; + name = "External Frameworks and Libraries"; + refType = 4; + sourceTree = ""; + }; + 089C1665FE841158C02AAC07 = { + children = ( + 8D07F2C70486CC7A007CD1D0, + 089C1666FE841158C02AAC07, + ); + isa = PBXGroup; + name = Resources; + refType = 4; + sourceTree = ""; + }; + 089C1666FE841158C02AAC07 = { + children = ( + 089C1667FE841158C02AAC07, + ); + isa = PBXVariantGroup; + name = InfoPlist.strings; + refType = 4; + sourceTree = ""; + }; + 089C1667FE841158C02AAC07 = { + fileEncoding = 10; + isa = PBXFileReference; + lastKnownFileType = text.plist.strings; + name = English; + path = English.lproj/InfoPlist.strings; + refType = 4; + sourceTree = ""; + }; + 08FB77ACFE841707C02AAC07 = { + children = ( + 8EDC817F082DF9640052F5E7, + 8EDC8180082DF9640052F5E7, + 8EDC8181082DF9640052F5E7, + 8EDC8182082DF9640052F5E7, + 8EDC8183082DF9640052F5E7, + 8EDC8184082DF9640052F5E7, + 8EDC8185082DF9640052F5E7, + 8EDC8194082DF9650052F5E7, + 8EDC8195082DF9650052F5E7, + 8EDC8196082DF9650052F5E7, + 8EDC8197082DF9650052F5E7, + 8EDC8198082DF9650052F5E7, + 8EDC8199082DF9650052F5E7, + 8EDC819A082DF9650052F5E7, + 8EDC819B082DF9650052F5E7, + 8EDC819C082DF9650052F5E7, + 8EDC819D082DF9650052F5E7, + 8EDC819E082DF9650052F5E7, + 8EDC819F082DF9650052F5E7, + 8EDC81A0082DF9650052F5E7, + 8EDC81A1082DF9650052F5E7, + 8EDC81A2082DF9650052F5E7, + 8EDC81A3082DF9650052F5E7, + 8EDC81A4082DF9650052F5E7, + 8EDC81A6082DF9650052F5E7, + 8EDC81A7082DF9650052F5E7, + 8EDC81A8082DF9650052F5E7, + 8EDC81A9082DF9650052F5E7, + 8EDC81AA082DF9650052F5E7, + 8EDC81AB082DF9650052F5E7, + 8EDC81AC082DF9650052F5E7, + 8EDC81C0082DF9650052F5E7, + 8EDC81C1082DF9650052F5E7, + 8EDC81C2082DF9650052F5E7, + 8EDC81C3082DF9650052F5E7, + 8EDC81C4082DF9650052F5E7, + 8EDC81C5082DF9650052F5E7, + 8EDC81C6082DF9650052F5E7, + 8EDC81C7082DF9650052F5E7, + 8EDC81C8082DF9650052F5E7, + 8EDC81C9082DF9650052F5E7, + 8EDC81CA082DF9650052F5E7, + 8EDC81CB082DF9650052F5E7, + 8EDC81CC082DF9650052F5E7, + 8EDC81CD082DF9650052F5E7, + 8EDC81CE082DF9650052F5E7, + 8EDC81CF082DF9650052F5E7, + 8EDC81D0082DF9650052F5E7, + ); + isa = PBXGroup; + name = Source; + refType = 4; + sourceTree = ""; + }; +//080 +//081 +//082 +//083 +//084 +//4F0 +//4F1 +//4F2 +//4F3 +//4F4 + 4F0BB7EC011F40E904CA0E50 = { + buildSettings = { + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_GENERATE_DEBUGGING_SYMBOLS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + ZERO_LINK = YES; + }; + isa = PBXBuildStyle; + name = Development; + }; + 4F0BB7ED011F40E904CA0E50 = { + buildSettings = { + COPY_PHASE_STRIP = YES; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + ZERO_LINK = NO; + }; + isa = PBXBuildStyle; + name = Deployment; + }; +//4F0 +//4F1 +//4F2 +//4F3 +//4F4 +//8D0 +//8D1 +//8D2 +//8D3 +//8D4 + 8D07F2BC0486CC7A007CD1D0 = { + buildPhases = ( + 8D07F2BD0486CC7A007CD1D0, + 8D07F2BF0486CC7A007CD1D0, + 8D07F2C10486CC7A007CD1D0, + 8D07F2C30486CC7A007CD1D0, + 8D07F2C50486CC7A007CD1D0, + ); + buildRules = ( + ); + buildSettings = { + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + FRAMEWORK_SEARCH_PATHS = /Users/xugg/Projects/Cog/Libraries/Ogg/build; + FRAMEWORK_VERSION = A; + GCC_GENERATE_DEBUGGING_SYMBOLS = NO; + GCC_PRECOMPILE_PREFIX_HEADER = NO; + GCC_PREFIX_HEADER = ""; + GCC_WARN_EFFECTIVE_CPLUSPLUS_VIOLATIONS = NO; + HEADER_SEARCH_PATHS = files/lib/; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "@executable_path/../Frameworks"; + LIBRARY_STYLE = DYNAMIC; + OTHER_CFLAGS = "-D__MACOSX__"; + PRODUCT_NAME = Vorbis; + WRAPPER_EXTENSION = framework; + }; + dependencies = ( + ); + isa = PBXNativeTarget; + name = Vorbis; + productInstallPath = "$(HOME)/Library/Frameworks"; + productName = Vorbis; + productReference = 8D07F2C80486CC7A007CD1D0; + productType = "com.apple.product-type.framework"; + }; + 8D07F2BD0486CC7A007CD1D0 = { + buildActionMask = 2147483647; + files = ( + 8EDC817C082DF93A0052F5E7, + 8EDC817D082DF93A0052F5E7, + 8EDC817E082DF93A0052F5E7, + 8EDC81D2082DF9650052F5E7, + 8EDC81D5082DF9650052F5E7, + 8EDC81DA082DF9650052F5E7, + 8EDC81DC082DF9650052F5E7, + 8EDC81E1082DF9650052F5E7, + 8EDC81E3082DF9650052F5E7, + 8EDC81E4082DF9650052F5E7, + 8EDC81E6082DF9650052F5E7, + 8EDC81E9082DF9650052F5E7, + 8EDC81EB082DF9650052F5E7, + 8EDC81ED082DF9650052F5E7, + 8EDC81F0082DF9650052F5E7, + 8EDC81F2082DF9650052F5E7, + 8EDC81F5082DF9650052F5E7, + 8EDC81F7082DF9650052F5E7, + 8EDC81F9082DF9650052F5E7, + 8EDC81FB082DF9650052F5E7, + 8EDC81FD082DF9650052F5E7, + 8EDC81FE082DF9650052F5E7, + 8EDC81FF082DF9650052F5E7, + 8EDC8200082DF9650052F5E7, + 8EDC8201082DF9650052F5E7, + 8EDC8202082DF9650052F5E7, + 8EDC8203082DF9650052F5E7, + 8EDC8204082DF9650052F5E7, + 8EDC8205082DF9650052F5E7, + 8EDC8206082DF9650052F5E7, + 8EDC8207082DF9650052F5E7, + 8EDC8208082DF9650052F5E7, + 8EDC8209082DF9650052F5E7, + 8EDC820A082DF9650052F5E7, + 8EDC820B082DF9650052F5E7, + 8EDC820C082DF9650052F5E7, + 8EDC820D082DF9650052F5E7, + 8EDC820F082DF9650052F5E7, + 8EDC8212082DF9650052F5E7, + 8EDC8214082DF9650052F5E7, + 8EDC8217082DF9650052F5E7, + 8EDC821D082DF9650052F5E7, + ); + isa = PBXHeadersBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 8D07F2BF0486CC7A007CD1D0 = { + buildActionMask = 2147483647; + files = ( + 8D07F2C00486CC7A007CD1D0, + 8EDC81EE082DF9650052F5E7, + ); + isa = PBXResourcesBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 8D07F2C00486CC7A007CD1D0 = { + fileRef = 089C1666FE841158C02AAC07; + isa = PBXBuildFile; + settings = { + }; + }; + 8D07F2C10486CC7A007CD1D0 = { + buildActionMask = 2147483647; + files = ( + 8EDC81D1082DF9650052F5E7, + 8EDC81D4082DF9650052F5E7, + 8EDC81D6082DF9650052F5E7, + 8EDC81E2082DF9650052F5E7, + 8EDC81E5082DF9650052F5E7, + 8EDC81E7082DF9650052F5E7, + 8EDC81E8082DF9650052F5E7, + 8EDC81EA082DF9650052F5E7, + 8EDC81EC082DF9650052F5E7, + 8EDC81EF082DF9650052F5E7, + 8EDC81F1082DF9650052F5E7, + 8EDC81F4082DF9650052F5E7, + 8EDC81F6082DF9650052F5E7, + 8EDC820E082DF9650052F5E7, + 8EDC8211082DF9650052F5E7, + 8EDC8213082DF9650052F5E7, + 8EDC8215082DF9650052F5E7, + 8EDC8216082DF9650052F5E7, + 8EDC8218082DF9650052F5E7, + 8EDC821A082DF9650052F5E7, + 8EDC821B082DF9650052F5E7, + 8EDC821C082DF9650052F5E7, + ); + isa = PBXSourcesBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 8D07F2C30486CC7A007CD1D0 = { + buildActionMask = 2147483647; + files = ( + 8EE4A66E082E6DBA00415456, + ); + isa = PBXFrameworksBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 8D07F2C50486CC7A007CD1D0 = { + buildActionMask = 2147483647; + files = ( + ); + isa = PBXRezBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 8D07F2C70486CC7A007CD1D0 = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = text.plist; + path = Info.plist; + refType = 4; + sourceTree = ""; + }; + 8D07F2C80486CC7A007CD1D0 = { + explicitFileType = wrapper.framework; + includeInIndex = 0; + isa = PBXFileReference; + path = Vorbis.framework; + refType = 3; + sourceTree = BUILT_PRODUCTS_DIR; + }; +//8D0 +//8D1 +//8D2 +//8D3 +//8D4 +//8E0 +//8E1 +//8E2 +//8E3 +//8E4 + 8EDC8177082DF9260052F5E7 = { + children = ( + 8EDC8179082DF93A0052F5E7, + 8EDC817A082DF93A0052F5E7, + 8EDC817B082DF93A0052F5E7, + ); + isa = PBXGroup; + name = Headers; + refType = 4; + sourceTree = ""; + }; + 8EDC8179082DF93A0052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = codec.h; + path = Files/include/vorbis/codec.h; + refType = 4; + sourceTree = ""; + }; + 8EDC817A082DF93A0052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = vorbisenc.h; + path = Files/include/vorbis/vorbisenc.h; + refType = 4; + sourceTree = ""; + }; + 8EDC817B082DF93A0052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = vorbisfile.h; + path = Files/include/vorbis/vorbisfile.h; + refType = 4; + sourceTree = ""; + }; + 8EDC817C082DF93A0052F5E7 = { + fileRef = 8EDC8179082DF93A0052F5E7; + isa = PBXBuildFile; + settings = { + ATTRIBUTES = ( + Public, + ); + }; + }; + 8EDC817D082DF93A0052F5E7 = { + fileRef = 8EDC817A082DF93A0052F5E7; + isa = PBXBuildFile; + settings = { + ATTRIBUTES = ( + Public, + ); + }; + }; + 8EDC817E082DF93A0052F5E7 = { + fileRef = 8EDC817B082DF93A0052F5E7; + isa = PBXBuildFile; + settings = { + ATTRIBUTES = ( + Public, + ); + }; + }; + 8EDC817F082DF9640052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = analysis.c; + path = Files/lib/analysis.c; + refType = 4; + sourceTree = ""; + }; + 8EDC8180082DF9640052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = backends.h; + path = Files/lib/backends.h; + refType = 4; + sourceTree = ""; + }; + 8EDC8181082DF9640052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = barkmel.c; + path = Files/lib/barkmel.c; + refType = 4; + sourceTree = ""; + }; + 8EDC8182082DF9640052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = bitrate.c; + path = Files/lib/bitrate.c; + refType = 4; + sourceTree = ""; + }; + 8EDC8183082DF9640052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = bitrate.h; + path = Files/lib/bitrate.h; + refType = 4; + sourceTree = ""; + }; + 8EDC8184082DF9640052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = block.c; + path = Files/lib/block.c; + refType = 4; + sourceTree = ""; + }; + 8EDC8185082DF9640052F5E7 = { + children = ( + 8EDC8187082DF9640052F5E7, + 8EDC818B082DF9640052F5E7, + 8EDC8190082DF9650052F5E7, + ); + isa = PBXGroup; + name = books; + path = Files/lib/books; + refType = 4; + sourceTree = ""; + }; + 8EDC8187082DF9640052F5E7 = { + children = ( + 8EDC818A082DF9640052F5E7, + ); + isa = PBXGroup; + path = coupled; + refType = 4; + sourceTree = ""; + }; + 8EDC818A082DF9640052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = res_books_stereo.h; + refType = 4; + sourceTree = ""; + }; + 8EDC818B082DF9640052F5E7 = { + children = ( + 8EDC818D082DF9650052F5E7, + ); + isa = PBXGroup; + path = floor; + refType = 4; + sourceTree = ""; + }; + 8EDC818D082DF9650052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = floor_books.h; + refType = 4; + sourceTree = ""; + }; + 8EDC8190082DF9650052F5E7 = { + children = ( + 8EDC8193082DF9650052F5E7, + ); + isa = PBXGroup; + path = uncoupled; + refType = 4; + sourceTree = ""; + }; + 8EDC8193082DF9650052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = res_books_uncoupled.h; + refType = 4; + sourceTree = ""; + }; + 8EDC8194082DF9650052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = codebook.c; + path = Files/lib/codebook.c; + refType = 4; + sourceTree = ""; + }; + 8EDC8195082DF9650052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = codebook.h; + path = Files/lib/codebook.h; + refType = 4; + sourceTree = ""; + }; + 8EDC8196082DF9650052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = codec_internal.h; + path = Files/lib/codec_internal.h; + refType = 4; + sourceTree = ""; + }; + 8EDC8197082DF9650052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = envelope.c; + path = Files/lib/envelope.c; + refType = 4; + sourceTree = ""; + }; + 8EDC8198082DF9650052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = envelope.h; + path = Files/lib/envelope.h; + refType = 4; + sourceTree = ""; + }; + 8EDC8199082DF9650052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = floor0.c; + path = Files/lib/floor0.c; + refType = 4; + sourceTree = ""; + }; + 8EDC819A082DF9650052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = floor1.c; + path = Files/lib/floor1.c; + refType = 4; + sourceTree = ""; + }; + 8EDC819B082DF9650052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = highlevel.h; + path = Files/lib/highlevel.h; + refType = 4; + sourceTree = ""; + }; + 8EDC819C082DF9650052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = info.c; + path = Files/lib/info.c; + refType = 4; + sourceTree = ""; + }; + 8EDC819D082DF9650052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = lookup_data.h; + path = Files/lib/lookup_data.h; + refType = 4; + sourceTree = ""; + }; + 8EDC819E082DF9650052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = lookup.c; + path = Files/lib/lookup.c; + refType = 4; + sourceTree = ""; + }; + 8EDC819F082DF9650052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = lookup.h; + path = Files/lib/lookup.h; + refType = 4; + sourceTree = ""; + }; + 8EDC81A0082DF9650052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = text.script.perl; + name = lookups.pl; + path = Files/lib/lookups.pl; + refType = 4; + sourceTree = ""; + }; + 8EDC81A1082DF9650052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = lpc.c; + path = Files/lib/lpc.c; + refType = 4; + sourceTree = ""; + }; + 8EDC81A2082DF9650052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = lpc.h; + path = Files/lib/lpc.h; + refType = 4; + sourceTree = ""; + }; + 8EDC81A3082DF9650052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = lsp.c; + path = Files/lib/lsp.c; + refType = 4; + sourceTree = ""; + }; + 8EDC81A4082DF9650052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = lsp.h; + path = Files/lib/lsp.h; + refType = 4; + sourceTree = ""; + }; + 8EDC81A6082DF9650052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = mapping0.c; + path = Files/lib/mapping0.c; + refType = 4; + sourceTree = ""; + }; + 8EDC81A7082DF9650052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = masking.h; + path = Files/lib/masking.h; + refType = 4; + sourceTree = ""; + }; + 8EDC81A8082DF9650052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = mdct.c; + path = Files/lib/mdct.c; + refType = 4; + sourceTree = ""; + }; + 8EDC81A9082DF9650052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = mdct.h; + path = Files/lib/mdct.h; + refType = 4; + sourceTree = ""; + }; + 8EDC81AA082DF9650052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = misc.c; + path = Files/lib/misc.c; + refType = 4; + sourceTree = ""; + }; + 8EDC81AB082DF9650052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = misc.h; + path = Files/lib/misc.h; + refType = 4; + sourceTree = ""; + }; + 8EDC81AC082DF9650052F5E7 = { + children = ( + 8EDC81AE082DF9650052F5E7, + 8EDC81B0082DF9650052F5E7, + 8EDC81B1082DF9650052F5E7, + 8EDC81B2082DF9650052F5E7, + 8EDC81B3082DF9650052F5E7, + 8EDC81B4082DF9650052F5E7, + 8EDC81B5082DF9650052F5E7, + 8EDC81B6082DF9650052F5E7, + 8EDC81B7082DF9650052F5E7, + 8EDC81B8082DF9650052F5E7, + 8EDC81B9082DF9650052F5E7, + 8EDC81BA082DF9650052F5E7, + 8EDC81BB082DF9650052F5E7, + 8EDC81BC082DF9650052F5E7, + 8EDC81BD082DF9650052F5E7, + 8EDC81BE082DF9650052F5E7, + 8EDC81BF082DF9650052F5E7, + ); + isa = PBXGroup; + name = modes; + path = Files/lib/modes; + refType = 4; + sourceTree = ""; + }; + 8EDC81AE082DF9650052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = floor_all.h; + refType = 4; + sourceTree = ""; + }; + 8EDC81B0082DF9650052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = psych_11.h; + refType = 4; + sourceTree = ""; + }; + 8EDC81B1082DF9650052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = psych_16.h; + refType = 4; + sourceTree = ""; + }; + 8EDC81B2082DF9650052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = psych_44.h; + refType = 4; + sourceTree = ""; + }; + 8EDC81B3082DF9650052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = psych_8.h; + refType = 4; + sourceTree = ""; + }; + 8EDC81B4082DF9650052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = residue_16.h; + refType = 4; + sourceTree = ""; + }; + 8EDC81B5082DF9650052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = residue_44.h; + refType = 4; + sourceTree = ""; + }; + 8EDC81B6082DF9650052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = residue_44u.h; + refType = 4; + sourceTree = ""; + }; + 8EDC81B7082DF9650052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = residue_8.h; + refType = 4; + sourceTree = ""; + }; + 8EDC81B8082DF9650052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = setup_11.h; + refType = 4; + sourceTree = ""; + }; + 8EDC81B9082DF9650052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = setup_16.h; + refType = 4; + sourceTree = ""; + }; + 8EDC81BA082DF9650052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = setup_22.h; + refType = 4; + sourceTree = ""; + }; + 8EDC81BB082DF9650052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = setup_32.h; + refType = 4; + sourceTree = ""; + }; + 8EDC81BC082DF9650052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = setup_44.h; + refType = 4; + sourceTree = ""; + }; + 8EDC81BD082DF9650052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = setup_44u.h; + refType = 4; + sourceTree = ""; + }; + 8EDC81BE082DF9650052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = setup_8.h; + refType = 4; + sourceTree = ""; + }; + 8EDC81BF082DF9650052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = setup_X.h; + refType = 4; + sourceTree = ""; + }; + 8EDC81C0082DF9650052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = os.h; + path = Files/lib/os.h; + refType = 4; + sourceTree = ""; + }; + 8EDC81C1082DF9650052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = psy.c; + path = Files/lib/psy.c; + refType = 4; + sourceTree = ""; + }; + 8EDC81C2082DF9650052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = psy.h; + path = Files/lib/psy.h; + refType = 4; + sourceTree = ""; + }; + 8EDC81C3082DF9650052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = psytune.c; + path = Files/lib/psytune.c; + refType = 4; + sourceTree = ""; + }; + 8EDC81C4082DF9650052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = registry.c; + path = Files/lib/registry.c; + refType = 4; + sourceTree = ""; + }; + 8EDC81C5082DF9650052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = registry.h; + path = Files/lib/registry.h; + refType = 4; + sourceTree = ""; + }; + 8EDC81C6082DF9650052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = res0.c; + path = Files/lib/res0.c; + refType = 4; + sourceTree = ""; + }; + 8EDC81C7082DF9650052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = scales.h; + path = Files/lib/scales.h; + refType = 4; + sourceTree = ""; + }; + 8EDC81C8082DF9650052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = sharedbook.c; + path = Files/lib/sharedbook.c; + refType = 4; + sourceTree = ""; + }; + 8EDC81C9082DF9650052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = smallft.c; + path = Files/lib/smallft.c; + refType = 4; + sourceTree = ""; + }; + 8EDC81CA082DF9650052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = smallft.h; + path = Files/lib/smallft.h; + refType = 4; + sourceTree = ""; + }; + 8EDC81CB082DF9650052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = synthesis.c; + path = Files/lib/synthesis.c; + refType = 4; + sourceTree = ""; + }; + 8EDC81CC082DF9650052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = tone.c; + path = Files/lib/tone.c; + refType = 4; + sourceTree = ""; + }; + 8EDC81CD082DF9650052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = vorbisenc.c; + path = Files/lib/vorbisenc.c; + refType = 4; + sourceTree = ""; + }; + 8EDC81CE082DF9650052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = vorbisfile.c; + path = Files/lib/vorbisfile.c; + refType = 4; + sourceTree = ""; + }; + 8EDC81CF082DF9650052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + name = window.c; + path = Files/lib/window.c; + refType = 4; + sourceTree = ""; + }; + 8EDC81D0082DF9650052F5E7 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = window.h; + path = Files/lib/window.h; + refType = 4; + sourceTree = ""; + }; + 8EDC81D1082DF9650052F5E7 = { + fileRef = 8EDC817F082DF9640052F5E7; + isa = PBXBuildFile; + settings = { + }; + }; + 8EDC81D2082DF9650052F5E7 = { + fileRef = 8EDC8180082DF9640052F5E7; + isa = PBXBuildFile; + settings = { + }; + }; + 8EDC81D4082DF9650052F5E7 = { + fileRef = 8EDC8182082DF9640052F5E7; + isa = PBXBuildFile; + settings = { + }; + }; + 8EDC81D5082DF9650052F5E7 = { + fileRef = 8EDC8183082DF9640052F5E7; + isa = PBXBuildFile; + settings = { + }; + }; + 8EDC81D6082DF9650052F5E7 = { + fileRef = 8EDC8184082DF9640052F5E7; + isa = PBXBuildFile; + settings = { + }; + }; + 8EDC81DA082DF9650052F5E7 = { + fileRef = 8EDC818A082DF9640052F5E7; + isa = PBXBuildFile; + settings = { + }; + }; + 8EDC81DC082DF9650052F5E7 = { + fileRef = 8EDC818D082DF9650052F5E7; + isa = PBXBuildFile; + settings = { + }; + }; + 8EDC81E1082DF9650052F5E7 = { + fileRef = 8EDC8193082DF9650052F5E7; + isa = PBXBuildFile; + settings = { + }; + }; + 8EDC81E2082DF9650052F5E7 = { + fileRef = 8EDC8194082DF9650052F5E7; + isa = PBXBuildFile; + settings = { + }; + }; + 8EDC81E3082DF9650052F5E7 = { + fileRef = 8EDC8195082DF9650052F5E7; + isa = PBXBuildFile; + settings = { + }; + }; + 8EDC81E4082DF9650052F5E7 = { + fileRef = 8EDC8196082DF9650052F5E7; + isa = PBXBuildFile; + settings = { + }; + }; + 8EDC81E5082DF9650052F5E7 = { + fileRef = 8EDC8197082DF9650052F5E7; + isa = PBXBuildFile; + settings = { + }; + }; + 8EDC81E6082DF9650052F5E7 = { + fileRef = 8EDC8198082DF9650052F5E7; + isa = PBXBuildFile; + settings = { + }; + }; + 8EDC81E7082DF9650052F5E7 = { + fileRef = 8EDC8199082DF9650052F5E7; + isa = PBXBuildFile; + settings = { + }; + }; + 8EDC81E8082DF9650052F5E7 = { + fileRef = 8EDC819A082DF9650052F5E7; + isa = PBXBuildFile; + settings = { + }; + }; + 8EDC81E9082DF9650052F5E7 = { + fileRef = 8EDC819B082DF9650052F5E7; + isa = PBXBuildFile; + settings = { + }; + }; + 8EDC81EA082DF9650052F5E7 = { + fileRef = 8EDC819C082DF9650052F5E7; + isa = PBXBuildFile; + settings = { + }; + }; + 8EDC81EB082DF9650052F5E7 = { + fileRef = 8EDC819D082DF9650052F5E7; + isa = PBXBuildFile; + settings = { + }; + }; + 8EDC81EC082DF9650052F5E7 = { + fileRef = 8EDC819E082DF9650052F5E7; + isa = PBXBuildFile; + settings = { + }; + }; + 8EDC81ED082DF9650052F5E7 = { + fileRef = 8EDC819F082DF9650052F5E7; + isa = PBXBuildFile; + settings = { + }; + }; + 8EDC81EE082DF9650052F5E7 = { + fileRef = 8EDC81A0082DF9650052F5E7; + isa = PBXBuildFile; + settings = { + }; + }; + 8EDC81EF082DF9650052F5E7 = { + fileRef = 8EDC81A1082DF9650052F5E7; + isa = PBXBuildFile; + settings = { + }; + }; + 8EDC81F0082DF9650052F5E7 = { + fileRef = 8EDC81A2082DF9650052F5E7; + isa = PBXBuildFile; + settings = { + }; + }; + 8EDC81F1082DF9650052F5E7 = { + fileRef = 8EDC81A3082DF9650052F5E7; + isa = PBXBuildFile; + settings = { + }; + }; + 8EDC81F2082DF9650052F5E7 = { + fileRef = 8EDC81A4082DF9650052F5E7; + isa = PBXBuildFile; + settings = { + }; + }; + 8EDC81F4082DF9650052F5E7 = { + fileRef = 8EDC81A6082DF9650052F5E7; + isa = PBXBuildFile; + settings = { + }; + }; + 8EDC81F5082DF9650052F5E7 = { + fileRef = 8EDC81A7082DF9650052F5E7; + isa = PBXBuildFile; + settings = { + }; + }; + 8EDC81F6082DF9650052F5E7 = { + fileRef = 8EDC81A8082DF9650052F5E7; + isa = PBXBuildFile; + settings = { + }; + }; + 8EDC81F7082DF9650052F5E7 = { + fileRef = 8EDC81A9082DF9650052F5E7; + isa = PBXBuildFile; + settings = { + }; + }; + 8EDC81F9082DF9650052F5E7 = { + fileRef = 8EDC81AB082DF9650052F5E7; + isa = PBXBuildFile; + settings = { + }; + }; + 8EDC81FB082DF9650052F5E7 = { + fileRef = 8EDC81AE082DF9650052F5E7; + isa = PBXBuildFile; + settings = { + }; + }; + 8EDC81FD082DF9650052F5E7 = { + fileRef = 8EDC81B0082DF9650052F5E7; + isa = PBXBuildFile; + settings = { + }; + }; + 8EDC81FE082DF9650052F5E7 = { + fileRef = 8EDC81B1082DF9650052F5E7; + isa = PBXBuildFile; + settings = { + }; + }; + 8EDC81FF082DF9650052F5E7 = { + fileRef = 8EDC81B2082DF9650052F5E7; + isa = PBXBuildFile; + settings = { + }; + }; + 8EDC8200082DF9650052F5E7 = { + fileRef = 8EDC81B3082DF9650052F5E7; + isa = PBXBuildFile; + settings = { + }; + }; + 8EDC8201082DF9650052F5E7 = { + fileRef = 8EDC81B4082DF9650052F5E7; + isa = PBXBuildFile; + settings = { + }; + }; + 8EDC8202082DF9650052F5E7 = { + fileRef = 8EDC81B5082DF9650052F5E7; + isa = PBXBuildFile; + settings = { + }; + }; + 8EDC8203082DF9650052F5E7 = { + fileRef = 8EDC81B6082DF9650052F5E7; + isa = PBXBuildFile; + settings = { + }; + }; + 8EDC8204082DF9650052F5E7 = { + fileRef = 8EDC81B7082DF9650052F5E7; + isa = PBXBuildFile; + settings = { + }; + }; + 8EDC8205082DF9650052F5E7 = { + fileRef = 8EDC81B8082DF9650052F5E7; + isa = PBXBuildFile; + settings = { + }; + }; + 8EDC8206082DF9650052F5E7 = { + fileRef = 8EDC81B9082DF9650052F5E7; + isa = PBXBuildFile; + settings = { + }; + }; + 8EDC8207082DF9650052F5E7 = { + fileRef = 8EDC81BA082DF9650052F5E7; + isa = PBXBuildFile; + settings = { + }; + }; + 8EDC8208082DF9650052F5E7 = { + fileRef = 8EDC81BB082DF9650052F5E7; + isa = PBXBuildFile; + settings = { + }; + }; + 8EDC8209082DF9650052F5E7 = { + fileRef = 8EDC81BC082DF9650052F5E7; + isa = PBXBuildFile; + settings = { + }; + }; + 8EDC820A082DF9650052F5E7 = { + fileRef = 8EDC81BD082DF9650052F5E7; + isa = PBXBuildFile; + settings = { + }; + }; + 8EDC820B082DF9650052F5E7 = { + fileRef = 8EDC81BE082DF9650052F5E7; + isa = PBXBuildFile; + settings = { + }; + }; + 8EDC820C082DF9650052F5E7 = { + fileRef = 8EDC81BF082DF9650052F5E7; + isa = PBXBuildFile; + settings = { + }; + }; + 8EDC820D082DF9650052F5E7 = { + fileRef = 8EDC81C0082DF9650052F5E7; + isa = PBXBuildFile; + settings = { + }; + }; + 8EDC820E082DF9650052F5E7 = { + fileRef = 8EDC81C1082DF9650052F5E7; + isa = PBXBuildFile; + settings = { + }; + }; + 8EDC820F082DF9650052F5E7 = { + fileRef = 8EDC81C2082DF9650052F5E7; + isa = PBXBuildFile; + settings = { + }; + }; + 8EDC8211082DF9650052F5E7 = { + fileRef = 8EDC81C4082DF9650052F5E7; + isa = PBXBuildFile; + settings = { + }; + }; + 8EDC8212082DF9650052F5E7 = { + fileRef = 8EDC81C5082DF9650052F5E7; + isa = PBXBuildFile; + settings = { + }; + }; + 8EDC8213082DF9650052F5E7 = { + fileRef = 8EDC81C6082DF9650052F5E7; + isa = PBXBuildFile; + settings = { + }; + }; + 8EDC8214082DF9650052F5E7 = { + fileRef = 8EDC81C7082DF9650052F5E7; + isa = PBXBuildFile; + settings = { + }; + }; + 8EDC8215082DF9650052F5E7 = { + fileRef = 8EDC81C8082DF9650052F5E7; + isa = PBXBuildFile; + settings = { + }; + }; + 8EDC8216082DF9650052F5E7 = { + fileRef = 8EDC81C9082DF9650052F5E7; + isa = PBXBuildFile; + settings = { + }; + }; + 8EDC8217082DF9650052F5E7 = { + fileRef = 8EDC81CA082DF9650052F5E7; + isa = PBXBuildFile; + settings = { + }; + }; + 8EDC8218082DF9650052F5E7 = { + fileRef = 8EDC81CB082DF9650052F5E7; + isa = PBXBuildFile; + settings = { + }; + }; + 8EDC821A082DF9650052F5E7 = { + fileRef = 8EDC81CD082DF9650052F5E7; + isa = PBXBuildFile; + settings = { + }; + }; + 8EDC821B082DF9650052F5E7 = { + fileRef = 8EDC81CE082DF9650052F5E7; + isa = PBXBuildFile; + settings = { + }; + }; + 8EDC821C082DF9650052F5E7 = { + fileRef = 8EDC81CF082DF9650052F5E7; + isa = PBXBuildFile; + settings = { + }; + }; + 8EDC821D082DF9650052F5E7 = { + fileRef = 8EDC81D0082DF9650052F5E7; + isa = PBXBuildFile; + settings = { + }; + }; + 8EE4A66D082E6DBA00415456 = { + isa = PBXFileReference; + lastKnownFileType = wrapper.framework; + name = Ogg.framework; + path = ../Ogg/build/Ogg.framework; + refType = 2; + sourceTree = SOURCE_ROOT; + }; + 8EE4A66E082E6DBA00415456 = { + fileRef = 8EE4A66D082E6DBA00415456; + isa = PBXBuildFile; + settings = { + }; + }; + }; + rootObject = 0867D690FE84028FC02AAC07; +} diff --git a/Libraries/Vorbis/Vorbis.xcode/xugg.mode1 b/Libraries/Vorbis/Vorbis.xcode/xugg.mode1 new file mode 100644 index 000000000..cd5e9505b --- /dev/null +++ b/Libraries/Vorbis/Vorbis.xcode/xugg.mode1 @@ -0,0 +1,1224 @@ + + + + + ActivePerspectiveName + Project + AllowedModules + + + BundleLoadPath + + MaxInstances + n + Module + PBXSmartGroupTreeModule + Name + Groups and Files Outline View + + + BundleLoadPath + + MaxInstances + n + Module + PBXNavigatorGroup + Name + Editor + + + BundleLoadPath + + MaxInstances + n + Module + XCTaskListModule + Name + Task List + + + BundleLoadPath + + MaxInstances + n + Module + XCDetailModule + Name + File and Smart Group Detail Viewer + + + BundleLoadPath + + MaxInstances + 1 + Module + PBXBuildResultsModule + Name + Detailed Build Results Viewer + + + BundleLoadPath + + MaxInstances + 1 + Module + PBXProjectFindModule + Name + Project Batch Find Tool + + + BundleLoadPath + + MaxInstances + n + Module + PBXRunSessionModule + Name + Run Log + + + BundleLoadPath + + MaxInstances + n + Module + PBXBookmarksModule + Name + Bookmarks Tool + + + BundleLoadPath + + MaxInstances + n + Module + PBXClassBrowserModule + Name + Class Browser + + + BundleLoadPath + + MaxInstances + n + Module + PBXCVSModule + Name + Source Code Control Tool + + + BundleLoadPath + + MaxInstances + n + Module + PBXDebugBreakpointsModule + Name + Debug Breakpoints Tool + + + BundleLoadPath + + MaxInstances + n + Module + XCDockableInspector + Name + Inspector + + + BundleLoadPath + + MaxInstances + n + Module + PBXOpenQuicklyModule + Name + Open Quickly Tool + + + BundleLoadPath + + MaxInstances + 1 + Module + PBXDebugSessionModule + Name + Debugger + + + BundleLoadPath + + MaxInstances + 1 + Module + PBXDebugCLIModule + Name + Debug Console + + + Description + DefaultDescriptionKey + DockingSystemVisible + + Extension + mode1 + FavBarConfig + + PBXProjectModuleGUID + 8EDC8239082DFA310052F5E7 + XCBarModuleItemNames + + XCBarModuleItems + + + FirstTimeWindowDisplayed + + Identifier + com.apple.perspectives.project.mode1 + MajorVersion + 31 + MinorVersion + 1 + Name + Default + Notifications + + OpenEditors + + PerspectiveWidths + + -1 + -1 + + Perspectives + + + ChosenToolbarItems + + active-target-popup + action + NSToolbarFlexibleSpaceItem + buildOrClean + build-and-runOrDebug + com.apple.ide.PBXToolbarStopButton + get-info + toggle-editor + NSToolbarFlexibleSpaceItem + com.apple.pbx.toolbar.searchfield + + ControllerClassBaseName + + IconName + WindowOfProjectWithEditor + Identifier + perspective.project + IsVertical + + Layout + + + ContentConfiguration + + PBXBottomSmartGroupGIDs + + 1C37FBAC04509CD000000102 + 1C37FAAC04509CD000000102 + 1C08E77C0454961000C914BD + 1C37FABC05509CD000000102 + 1C37FABC05539CD112110102 + E2644B35053B69B200211256 + 1C37FABC04509CD000100104 + 1CC0EA4004350EF90044410B + 1CC0EA4004350EF90041110B + + PBXProjectModuleGUID + 1CE0B1FE06471DED0097A5F4 + PBXProjectModuleLabel + Files + PBXProjectStructureProvided + yes + PBXSmartGroupTreeModuleColumnData + + PBXSmartGroupTreeModuleColumnWidthsKey + + 186 + + PBXSmartGroupTreeModuleColumnsKey_v4 + + MainColumn + + + PBXSmartGroupTreeModuleOutlineStateKey_v7 + + PBXSmartGroupTreeModuleOutlineStateExpansionKey + + 0867D691FE84028FC02AAC07 + 8EDC8177082DF9260052F5E7 + 034768DDFF38A45A11DB9C8B + 1C37FBAC04509CD000000102 + 1C37FABC05509CD000000102 + + PBXSmartGroupTreeModuleOutlineStateSelectionKey + + + 12 + + + PBXSmartGroupTreeModuleOutlineStateVisibleRectKey + {{0, 0}, {186, 338}} + + PBXTopSmartGroupGIDs + + XCIncludePerspectivesSwitch + + XCSharingToken + com.apple.Xcode.GFSharingToken + + GeometryConfiguration + + Frame + {{0, 0}, {203, 356}} + GroupTreeTableConfiguration + + MainColumn + 186 + + RubberWindowFrame + 170 323 690 397 0 0 1024 746 + + Module + PBXSmartGroupTreeModule + Proportion + 203pt + + + Dock + + + ContentConfiguration + + PBXProjectModuleGUID + 1CE0B20306471E060097A5F4 + PBXProjectModuleLabel + MyNewFile14.java + PBXSplitModuleInNavigatorKey + + Split0 + + PBXProjectModuleGUID + 1CE0B20406471E060097A5F4 + PBXProjectModuleLabel + MyNewFile14.java + + SplitCount + 1 + + StatusBarVisibility + + + GeometryConfiguration + + Frame + {{0, 0}, {482, 0}} + RubberWindowFrame + 170 323 690 397 0 0 1024 746 + + Module + PBXNavigatorGroup + Proportion + 0pt + + + BecomeActive + + ContentConfiguration + + PBXProjectModuleGUID + 1CE0B20506471E060097A5F4 + PBXProjectModuleLabel + Detail + + GeometryConfiguration + + Frame + {{0, 5}, {482, 351}} + RubberWindowFrame + 170 323 690 397 0 0 1024 746 + + Module + XCDetailModule + Proportion + 351pt + + + Proportion + 482pt + + + Name + Project + ServiceClasses + + XCModuleDock + PBXSmartGroupTreeModule + XCModuleDock + PBXNavigatorGroup + XCDetailModule + + TableOfContents + + 8E94DA01084BECC4007F0AEB + 1CE0B1FE06471DED0097A5F4 + 8E94DA02084BECC4007F0AEB + 1CE0B20306471E060097A5F4 + 1CE0B20506471E060097A5F4 + + ToolbarConfiguration + xcode.toolbar.config.default + + + ControllerClassBaseName + + IconName + WindowOfProject + Identifier + perspective.morph + IsVertical + 0 + Layout + + + BecomeActive + 1 + ContentConfiguration + + PBXBottomSmartGroupGIDs + + 1C37FBAC04509CD000000102 + 1C37FAAC04509CD000000102 + 1C08E77C0454961000C914BD + 1C37FABC05509CD000000102 + 1C37FABC05539CD112110102 + E2644B35053B69B200211256 + 1C37FABC04509CD000100104 + 1CC0EA4004350EF90044410B + 1CC0EA4004350EF90041110B + + PBXProjectModuleGUID + 11E0B1FE06471DED0097A5F4 + PBXProjectModuleLabel + Files + PBXProjectStructureProvided + yes + PBXSmartGroupTreeModuleColumnData + + PBXSmartGroupTreeModuleColumnWidthsKey + + 186 + + PBXSmartGroupTreeModuleColumnsKey_v4 + + MainColumn + + + PBXSmartGroupTreeModuleOutlineStateKey_v7 + + PBXSmartGroupTreeModuleOutlineStateExpansionKey + + 29B97314FDCFA39411CA2CEA + 1C37FABC05509CD000000102 + + PBXSmartGroupTreeModuleOutlineStateSelectionKey + + + 0 + + + PBXSmartGroupTreeModuleOutlineStateVisibleRectKey + {{0, 0}, {186, 337}} + + PBXTopSmartGroupGIDs + + XCIncludePerspectivesSwitch + 1 + XCSharingToken + com.apple.Xcode.GFSharingToken + + GeometryConfiguration + + Frame + {{0, 0}, {203, 355}} + GroupTreeTableConfiguration + + MainColumn + 186 + + RubberWindowFrame + 373 269 690 397 0 0 1440 878 + + Module + PBXSmartGroupTreeModule + Proportion + 100% + + + Name + Morph + PreferredWidth + 300 + ServiceClasses + + XCModuleDock + PBXSmartGroupTreeModule + + TableOfContents + + 11E0B1FE06471DED0097A5F4 + + ToolbarConfiguration + xcode.toolbar.config.default.short + + + PerspectivesBarVisible + + ShelfIsVisible + + SourceDescription + file at '/System/Library/PrivateFrameworks/DevToolsInterface.framework/Versions/A/Resources/XCPerspectivesSpecificationMode1.xcperspec' + StatusbarIsVisible + + TimeStamp + 0.0 + ToolbarDisplayMode + 1 + ToolbarIsVisible + + ToolbarSizeMode + 1 + Type + Perspectives + UpdateMessage + The Default Workspace in this version of Xcode now includes support to hide and show the detail view (what has been referred to as the "Metro-Morph" feature). You must discard your current Default Workspace settings and update to the latest Default Workspace in order to gain this feature. Do you wish to update to the latest Workspace defaults for project '%@'? + WindowJustification + 5 + WindowOrderList + + /Users/xugg/Projects/Cog/Libraries/Vorbis/Vorbis.xcode + + WindowString + 170 323 690 397 0 0 1024 746 + WindowTools + + + FirstTimeWindowDisplayed + + Identifier + windowTool.build + IsVertical + + Layout + + + Dock + + + ContentConfiguration + + PBXProjectModuleGUID + 1CD0528F0623707200166675 + PBXProjectModuleLabel + analysis.c + StatusBarVisibility + + + GeometryConfiguration + + Frame + {{0, 0}, {1024, 342}} + RubberWindowFrame + 0 122 1024 624 0 0 1024 746 + + Module + PBXNavigatorGroup + Proportion + 342pt + + + BecomeActive + + ContentConfiguration + + PBXProjectModuleGUID + XCMainBuildResultsModuleGUID + PBXProjectModuleLabel + Build + XCBuildResultsTrigger_Collapse + 1021 + XCBuildResultsTrigger_Open + 1011 + + GeometryConfiguration + + Frame + {{0, 347}, {1024, 236}} + RubberWindowFrame + 0 122 1024 624 0 0 1024 746 + + Module + PBXBuildResultsModule + Proportion + 236pt + + + Proportion + 583pt + + + Name + Build Results + ServiceClasses + + PBXBuildResultsModule + + StatusbarIsVisible + + TableOfContents + + 8EDC8224082DF9990052F5E7 + 8EE4A664082E6D7F00415456 + 1CD0528F0623707200166675 + XCMainBuildResultsModuleGUID + + ToolbarConfiguration + xcode.toolbar.config.build + WindowString + 0 122 1024 624 0 0 1024 746 + WindowToolGUID + 8EDC8224082DF9990052F5E7 + WindowToolIsVisible + + + + Identifier + windowTool.debugger + Layout + + + Dock + + + ContentConfiguration + + Debugger + + HorizontalSplitView + + _collapsingFrameDimension + 0.0 + _indexOfCollapsedView + 0 + _percentageOfCollapsedView + 0.0 + isCollapsed + yes + sizes + + {{0, 0}, {317, 164}} + {{317, 0}, {377, 164}} + + + VerticalSplitView + + _collapsingFrameDimension + 0.0 + _indexOfCollapsedView + 0 + _percentageOfCollapsedView + 0.0 + isCollapsed + yes + sizes + + {{0, 0}, {694, 164}} + {{0, 164}, {694, 216}} + + + + LauncherConfigVersion + 8 + PBXProjectModuleGUID + 1C162984064C10D400B95A72 + PBXProjectModuleLabel + Debug - GLUTExamples (Underwater) + + GeometryConfiguration + + DebugConsoleDrawerSize + {100, 120} + DebugConsoleVisible + None + DebugConsoleWindowFrame + {{200, 200}, {500, 300}} + DebugSTDIOWindowFrame + {{200, 200}, {500, 300}} + Frame + {{0, 0}, {694, 380}} + RubberWindowFrame + 321 238 694 422 0 0 1440 878 + + Module + PBXDebugSessionModule + Proportion + 100% + + + Proportion + 100% + + + Name + Debugger + ServiceClasses + + PBXDebugSessionModule + + StatusbarIsVisible + 1 + TableOfContents + + 1CD10A99069EF8BA00B06720 + 1C0AD2AB069F1E9B00FABCE6 + 1C162984064C10D400B95A72 + 1C0AD2AC069F1E9B00FABCE6 + + ToolbarConfiguration + xcode.toolbar.config.debug + WindowString + 321 238 694 422 0 0 1440 878 + WindowToolGUID + 1CD10A99069EF8BA00B06720 + WindowToolIsVisible + 0 + + + FirstTimeWindowDisplayed + + Identifier + windowTool.find + IsVertical + + Layout + + + Dock + + + Dock + + + ContentConfiguration + + PBXProjectModuleGUID + 1CDD528C0622207200134675 + PBXProjectModuleLabel + codebook.c + StatusBarVisibility + + + GeometryConfiguration + + Frame + {{0, 0}, {781, 212}} + RubberWindowFrame + 21 253 781 470 0 0 1024 746 + + Module + PBXNavigatorGroup + Proportion + 781pt + + + Proportion + 212pt + + + BecomeActive + + ContentConfiguration + + PBXProjectModuleGUID + 1CD0528E0623707200166675 + PBXProjectModuleLabel + Project Find + + GeometryConfiguration + + Frame + {{0, 217}, {781, 212}} + RubberWindowFrame + 21 253 781 470 0 0 1024 746 + + Module + PBXProjectFindModule + Proportion + 212pt + + + Proportion + 429pt + + + Name + Project Find + ServiceClasses + + PBXProjectFindModule + + StatusbarIsVisible + + TableOfContents + + 1C530D57069F1CE1000CFCEE + 8E03D4A6082DFD37007F099E + 8E03D4A7082DFD37007F099E + 1CDD528C0622207200134675 + 1CD0528E0623707200166675 + + WindowString + 21 253 781 470 0 0 1024 746 + WindowToolGUID + 1C530D57069F1CE1000CFCEE + WindowToolIsVisible + + + + Identifier + MENUSEPARATOR + + + Identifier + windowTool.debuggerConsole + Layout + + + Dock + + + BecomeActive + 1 + ContentConfiguration + + PBXProjectModuleGUID + 1C78EAAC065D492600B07095 + PBXProjectModuleLabel + Debugger Console + + GeometryConfiguration + + Frame + {{0, 0}, {440, 358}} + RubberWindowFrame + 650 41 440 400 0 0 1280 1002 + + Module + PBXDebugCLIModule + Proportion + 358pt + + + Proportion + 358pt + + + Name + Debugger Console + ServiceClasses + + PBXDebugCLIModule + + StatusbarIsVisible + 1 + TableOfContents + + 1C78EAAD065D492600B07095 + 1C78EAAE065D492600B07095 + 1C78EAAC065D492600B07095 + + WindowString + 650 41 440 400 0 0 1280 1002 + + + Identifier + windowTool.run + Layout + + + Dock + + + ContentConfiguration + + LauncherConfigVersion + 3 + PBXProjectModuleGUID + 1CD0528B0623707200166675 + PBXProjectModuleLabel + Run + Runner + + HorizontalSplitView + + _collapsingFrameDimension + 0.0 + _indexOfCollapsedView + 0 + _percentageOfCollapsedView + 0.0 + isCollapsed + yes + sizes + + {{0, 0}, {493, 167}} + {{0, 176}, {493, 267}} + + + VerticalSplitView + + _collapsingFrameDimension + 0.0 + _indexOfCollapsedView + 0 + _percentageOfCollapsedView + 0.0 + isCollapsed + yes + sizes + + {{0, 0}, {405, 443}} + {{414, 0}, {514, 443}} + + + + + GeometryConfiguration + + Frame + {{0, 0}, {460, 159}} + RubberWindowFrame + 316 696 459 200 0 0 1280 1002 + + Module + PBXRunSessionModule + Proportion + 159pt + + + Proportion + 159pt + + + Name + Run Log + ServiceClasses + + PBXRunSessionModule + + StatusbarIsVisible + 1 + TableOfContents + + 1C0AD2B3069F1EA900FABCE6 + 1C0AD2B4069F1EA900FABCE6 + 1CD0528B0623707200166675 + 1C0AD2B5069F1EA900FABCE6 + + ToolbarConfiguration + xcode.toolbar.config.run + WindowString + 316 696 459 200 0 0 1280 1002 + WindowToolGUID + 1C0AD2B3069F1EA900FABCE6 + WindowToolIsVisible + 0 + + + Identifier + windowTool.scm + Layout + + + Dock + + + ContentConfiguration + + PBXProjectModuleGUID + 1C78EAB2065D492600B07095 + PBXProjectModuleLabel + <No Editor> + PBXSplitModuleInNavigatorKey + + Split0 + + PBXProjectModuleGUID + 1C78EAB3065D492600B07095 + + SplitCount + 1 + + StatusBarVisibility + 1 + + GeometryConfiguration + + Frame + {{0, 0}, {452, 0}} + RubberWindowFrame + 743 379 452 308 0 0 1280 1002 + + Module + PBXNavigatorGroup + Proportion + 0pt + + + BecomeActive + 1 + ContentConfiguration + + PBXProjectModuleGUID + 1CD052920623707200166675 + PBXProjectModuleLabel + SCM + + GeometryConfiguration + + ConsoleFrame + {{0, 259}, {452, 0}} + Frame + {{0, 7}, {452, 259}} + RubberWindowFrame + 743 379 452 308 0 0 1280 1002 + TableConfiguration + + Status + 30 + FileName + 199 + Path + 197.09500122070312 + + TableFrame + {{0, 0}, {452, 250}} + + Module + PBXCVSModule + Proportion + 262pt + + + Proportion + 266pt + + + Name + SCM + ServiceClasses + + PBXCVSModule + + StatusbarIsVisible + 1 + TableOfContents + + 1C78EAB4065D492600B07095 + 1C78EAB5065D492600B07095 + 1C78EAB2065D492600B07095 + 1CD052920623707200166675 + + ToolbarConfiguration + xcode.toolbar.config.scm + WindowString + 743 379 452 308 0 0 1280 1002 + + + Identifier + windowTool.breakpoints + Layout + + + Dock + + + BecomeActive + 1 + ContentConfiguration + + PBXProjectModuleGUID + 1CD052930623707200166675 + PBXProjectModuleLabel + Breakpoints + + GeometryConfiguration + + BreakpointsTreeTableConfiguration + + enabledColumn + 16 + breakpointColumn + 201.5830078125 + + Frame + {{0, 0}, {240, 195}} + RubberWindowFrame + 342 421 240 216 0 0 1440 878 + + Module + PBXDebugBreakpointsModule + Proportion + 195pt + + + Proportion + 195pt + + + Name + Breakpoints + ServiceClasses + + PBXDebugBreakpointsModule + + StatusbarIsVisible + 0 + TableOfContents + + 1C0AD2AD069F1E9B00FABCE6 + 1C0AD2AE069F1E9B00FABCE6 + 1CD052930623707200166675 + + WindowString + 342 421 240 216 0 0 1440 878 + WindowToolGUID + 1C0AD2AD069F1E9B00FABCE6 + WindowToolIsVisible + 0 + + + Identifier + windowTool.bookmarks + Layout + + + Dock + + + Module + PBXBookmarksModule + Proportion + 100% + + + Proportion + 100% + + + Name + Bookmarks + ServiceClasses + + PBXBookmarksModule + + StatusbarIsVisible + 0 + WindowString + 538 42 401 187 0 0 1280 1002 + + + Identifier + windowTool.classBrowser + Layout + + + Dock + + + BecomeActive + 1 + ContentConfiguration + + OptionsSetName + Hierarchy, all classes + PBXProjectModuleGUID + 1CA6456E063B45B4001379D8 + PBXProjectModuleLabel + Class Browser - NSObject + + GeometryConfiguration + + ClassesFrame + {{0, 0}, {374, 96}} + ClassesTreeTableConfiguration + + PBXClassNameColumnIdentifier + 208 + PBXClassBookColumnIdentifier + 22 + + Frame + {{0, 0}, {630, 331}} + MembersFrame + {{0, 105}, {374, 395}} + MembersTreeTableConfiguration + + PBXMemberTypeIconColumnIdentifier + 22 + PBXMemberNameColumnIdentifier + 216 + PBXMemberTypeColumnIdentifier + 97 + PBXMemberBookColumnIdentifier + 22 + + PBXModuleWindowStatusBarHidden2 + 1 + RubberWindowFrame + 385 179 630 352 0 0 1440 878 + + Module + PBXClassBrowserModule + Proportion + 332pt + + + Proportion + 332pt + + + Name + Class Browser + ServiceClasses + + PBXClassBrowserModule + + StatusbarIsVisible + 0 + TableOfContents + + 1C0AD2AF069F1E9B00FABCE6 + 1C0AD2B0069F1E9B00FABCE6 + 1CA6456E063B45B4001379D8 + + ToolbarConfiguration + xcode.toolbar.config.classbrowser + WindowString + 385 179 630 352 0 0 1440 878 + WindowToolGUID + 1C0AD2AF069F1E9B00FABCE6 + WindowToolIsVisible + 0 + + + + diff --git a/Libraries/Vorbis/Vorbis.xcode/xugg.pbxuser b/Libraries/Vorbis/Vorbis.xcode/xugg.pbxuser new file mode 100644 index 000000000..1df23adb0 --- /dev/null +++ b/Libraries/Vorbis/Vorbis.xcode/xugg.pbxuser @@ -0,0 +1,126 @@ +// !$*UTF8*$! +{ + 0867D690FE84028FC02AAC07 = { + activeBuildStyle = 4F0BB7ED011F40E904CA0E50; + activeTarget = 8D07F2BC0486CC7A007CD1D0; + addToTargets = ( + 8D07F2BC0486CC7A007CD1D0, + ); + codeSenseManager = 8EDC8174082DF91C0052F5E7; + perUserDictionary = { + PBXConfiguration.PBXFileTableDataSource3.PBXExecutablesDataSource = { + PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; + PBXFileTableDataSourceColumnSortingKey = PBXExecutablesDataSource_NameID; + PBXFileTableDataSourceColumnWidthsKey = ( + 22, + 300, + 130.5835, + ); + PBXFileTableDataSourceColumnsKey = ( + PBXExecutablesDataSource_ActiveFlagID, + PBXExecutablesDataSource_NameID, + PBXExecutablesDataSource_CommentsID, + ); + }; + PBXConfiguration.PBXFileTableDataSource3.PBXFileTableDataSource = { + PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; + PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID; + PBXFileTableDataSourceColumnWidthsKey = ( + 20, + 243, + 20, + 48, + 43, + 43, + 20, + ); + PBXFileTableDataSourceColumnsKey = ( + PBXFileDataSource_FiletypeID, + PBXFileDataSource_Filename_ColumnID, + PBXFileDataSource_Built_ColumnID, + PBXFileDataSource_ObjectSize_ColumnID, + PBXFileDataSource_Errors_ColumnID, + PBXFileDataSource_Warnings_ColumnID, + PBXFileDataSource_Target_ColumnID, + ); + }; + PBXConfiguration.PBXTargetDataSource.PBXTargetDataSource = { + PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; + PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID; + PBXFileTableDataSourceColumnWidthsKey = ( + 20, + 200, + 63, + 20, + 48.1626, + 43, + 43, + ); + PBXFileTableDataSourceColumnsKey = ( + PBXFileDataSource_FiletypeID, + PBXFileDataSource_Filename_ColumnID, + PBXTargetDataSource_PrimaryAttribute, + PBXFileDataSource_Built_ColumnID, + PBXFileDataSource_ObjectSize_ColumnID, + PBXFileDataSource_Errors_ColumnID, + PBXFileDataSource_Warnings_ColumnID, + ); + }; + PBXPerProjectTemplateStateSaveDate = 139193513; + PBXWorkspaceStateSaveDate = 139193513; + }; + sourceControlManager = 8EDC8173082DF91C0052F5E7; + userBuildSettings = { + }; + }; + 8D07F2BC0486CC7A007CD1D0 = { + activeExec = 0; + }; + 8EDC8173082DF91C0052F5E7 = { + fallbackIsa = XCSourceControlManager; + isSCMEnabled = 0; + isa = PBXSourceControlManager; + scmConfiguration = { + }; + scmType = ""; + }; + 8EDC8174082DF91C0052F5E7 = { + indexTemplatePath = ""; + isa = PBXCodeSenseManager; + }; + 8EDC817F082DF9640052F5E7 = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {983, 1708}}"; + sepNavSelRange = "{1037, 26}"; + sepNavVisRect = "{{0, 0}, {983, 310}}"; + }; + }; + 8EDC8181082DF9640052F5E7 = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {740, 910}}"; + sepNavSelRange = "{980, 4}"; + sepNavVisRect = "{{0, 183}, {740, 180}}"; + }; + }; + 8EDC8194082DF9650052F5E7 = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {740, 8624}}"; + sepNavSelRange = "{14574, 4}"; + sepNavVisRect = "{{0, 2113}, {740, 180}}"; + }; + }; + 8EDC81BC082DF9650052F5E7 = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {983, 1512}}"; + sepNavSelRange = "{952, 29}"; + sepNavVisRect = "{{0, 0}, {983, 310}}"; + }; + }; + 8EDC81C3082DF9650052F5E7 = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {740, 7308}}"; + sepNavSelRange = "{1638, 7}"; + sepNavVisRect = "{{0, 631}, {740, 180}}"; + }; + }; +} diff --git a/PLANNED b/PLANNED new file mode 100644 index 000000000..e58af686b --- /dev/null +++ b/PLANNED @@ -0,0 +1,10 @@ +A queue system, in which a user can option+click a song, and it will be placed + in a queue, whcih will pick the next song. +Stream support for shoutcast/oggcast, or just opening via URL. +Audioscrobbler. +Improved tag reading. +mpeg4 support (FAAD) +look into realplayer (cook in mplayer) and wma +find better ape decoder +visualizer? (libvisualizer perhaps?) +hotkeys for next/prev/stop/shuffle/repeat & info window diff --git a/Playlist/DNDArrayController.h b/Playlist/DNDArrayController.h new file mode 100755 index 000000000..93cbaa8b8 --- /dev/null +++ b/Playlist/DNDArrayController.h @@ -0,0 +1,22 @@ + +#import + +extern NSString *MovedRowsType; + +@interface DNDArrayController : NSArrayController +{ + IBOutlet NSTableView *tableView; +} + +// table view drag and drop support +- (BOOL)tableView:(NSTableView *)tv writeRows:(NSArray*)rows toPasteboard:(NSPasteboard*)pboard; +- (NSDragOperation)tableView:(NSTableView*)tv validateDrop:(id )info proposedRow:(int)row proposedDropOperation:(NSTableViewDropOperation)op; +- (BOOL)tableView:(NSTableView*)tv acceptDrop:(id )info row:(int)row dropOperation:(NSTableViewDropOperation)op; + + +// utility methods +-(void)moveObjectsInArrangedObjectsFromIndexes:(NSIndexSet *)indexSet toIndex:(unsigned)index; +- (NSIndexSet *)indexSetFromRows:(NSArray *)rows; +- (int)rowsAboveRow:(int)row inIndexSet:(NSIndexSet *)indexSet; + +@end diff --git a/Playlist/DNDArrayController.m b/Playlist/DNDArrayController.m new file mode 100755 index 000000000..1bc74f3fb --- /dev/null +++ b/Playlist/DNDArrayController.m @@ -0,0 +1,147 @@ + +#import "DNDArrayController.h" + +@implementation DNDArrayController + +NSString *MovedRowsType = @"MOVED_ROWS_TYPE"; + + +- (void)awakeFromNib +{ + // register for drag and drop +// DBLog(@"AWOKE"); + [tableView registerForDraggedTypes:[NSArray arrayWithObjects:MovedRowsType, NSFilenamesPboardType, nil]]; +// [tableView setVerticalMotionCanBeginDrag:YES]; +// [tableView setAllowsMultipleSelection:NO]; +// [super awakeFromNib]; +// DBLog(@"HERE: %@", [tableView registeredDraggedTypes]); +} + + +- (BOOL)tableView:(NSTableView *)tv + writeRows:(NSArray*)rows + toPasteboard:(NSPasteboard*)pboard +{ +// DBLog(@"WRITE ROWS"); + + NSData *data; + data = [NSKeyedArchiver archivedDataWithRootObject:rows]; + + [pboard declareTypes: [NSArray arrayWithObjects:MovedRowsType, nil] owner:self]; + [pboard setData: data forType: MovedRowsType]; + + return YES; +} + + +- (NSDragOperation)tableView:(NSTableView*)tv + validateDrop:(id )info + proposedRow:(int)row + proposedDropOperation:(NSTableViewDropOperation)op +{ + NSDragOperation dragOp = NSDragOperationCopy; + +// DBLog(@"VALIDATING"); + if ([info draggingSource] == tv) + dragOp = NSDragOperationMove; + + // we want to put the object at, not over, + // the current row (contrast NSTableViewDropOn) + [tv setDropRow:row dropOperation:NSTableViewDropAbove]; + + return dragOp; +} + + +- (BOOL)tableView:(NSTableView*)tv + acceptDrop:(id )info + row:(int)row + dropOperation:(NSTableViewDropOperation)op +{ + if (row < 0) + { + row = 0; + } +// DBLog(@"ACCEPTATING"); + // if drag source is self, it's a move + if ([info draggingSource] == tableView) + { +// DBLog(@"ACCEPTATED"); + NSArray *rows = [NSKeyedUnarchiver unarchiveObjectWithData:[[info draggingPasteboard] dataForType: MovedRowsType]]; + + NSIndexSet *indexSet = [self indexSetFromRows:rows]; + + [self moveObjectsInArrangedObjectsFromIndexes:indexSet toIndex:row]; + + // set selected rows to those that were just moved + // Need to work out what moved where to determine proper selection... + int rowsAbove = [self rowsAboveRow:row inIndexSet:indexSet]; + + NSRange range = NSMakeRange(row - rowsAbove, [indexSet count]); + indexSet = [NSIndexSet indexSetWithIndexesInRange:range]; + [self setSelectionIndexes:indexSet]; + + return YES; + } + + return NO; +} + + +-(void) moveObjectsInArrangedObjectsFromIndexes:(NSIndexSet*)indexSet + toIndex:(unsigned int)insertIndex +{ + + NSArray *objects = [self arrangedObjects]; + int index = [indexSet lastIndex]; + + int aboveInsertIndexCount = 0; + id object; + int removeIndex; + + while (NSNotFound != index) + { + if (index >= insertIndex) { + removeIndex = index + aboveInsertIndexCount; + aboveInsertIndexCount += 1; + } + else + { + removeIndex = index; + insertIndex -= 1; + } + object = [objects objectAtIndex:removeIndex]; + [self removeObjectAtArrangedObjectIndex:removeIndex]; + [self insertObject:object atArrangedObjectIndex:insertIndex]; + + index = [indexSet indexLessThanIndex:index]; + } +} + + +- (NSIndexSet *)indexSetFromRows:(NSArray *)rows +{ + NSMutableIndexSet *indexSet = [NSMutableIndexSet indexSet]; + NSEnumerator *rowEnumerator = [rows objectEnumerator]; + NSNumber *idx; + while (idx = [rowEnumerator nextObject]) + { + [indexSet addIndex:[idx unsignedIntValue]]; + } + return indexSet; +} + + +- (int)rowsAboveRow:(int)row inIndexSet:(NSIndexSet *)indexSet +{ + unsigned currentIndex = [indexSet firstIndex]; + int i = 0; + while (currentIndex != NSNotFound) + { + if (currentIndex < row) { i++; } + currentIndex = [indexSet indexGreaterThanIndex:currentIndex]; + } + return i; +} + +@end diff --git a/Playlist/PlaylistController.h b/Playlist/PlaylistController.h new file mode 100644 index 000000000..9ca027d64 --- /dev/null +++ b/Playlist/PlaylistController.h @@ -0,0 +1,83 @@ +// +// PlaylistController.h +// Cog +// +// Created by Vincent Spader on 3/18/05. +// Copyright 2005 __MyCompanyName__. All rights reserved. +// + +#import +#import "DNDArrayController.h" +#import "PlaylistEntry.h" + +@interface PlaylistController : DNDArrayController { + NSArray *acceptableFileTypes; + NSArray *acceptablePlaylistTypes; + + NSString *playlistFilename; + + NSMutableArray *shuffleList; + NSMutableArray *history; + + PlaylistEntry *currentEntry; + + PlaylistEntry *nextEntry; + PlaylistEntry *prevEntry; + + BOOL shuffle; + BOOL repeat; +} + +//All these return the number of things actually added +//PRIVATE ONES +/*- (int)addPath:(NSString *)path; +- (int)insertPath:(NSString *)path atIndex:(int)index; +- (int)insertFile:(NSString *)filename atIndex:(int)index; +- (int)addFile:(NSString *)filename; +*/ +//ONLY PUBLIC ONES +- (int)addPaths:(NSArray *)paths sort:(BOOL)sort; +- (int)insertPaths:(NSArray *)paths atIndex:(int)index sort:(BOOL)sort; + +- (NSArray *)acceptableFileTypes; + +- (void)setShuffle:(BOOL)s; +- (BOOL)shuffle; +- (void)setRepeat:(BOOL)r; +- (BOOL)repeat; + +- (IBAction)takeShuffleFromObject:(id)sender; +- (IBAction)takeRepeatFromObject:(id)sender; + +//FUN PLAYLIST MANAGEMENT STUFF! +- (void)setCurrentEntry:(PlaylistEntry *)pe addToHistory:(BOOL)h; +- (id)currentEntry; +- (void)setCurrentEntry:(id)pe; + +- (void)reset; + +- (void)generateShuffleList; + +- (void)next; +- (void)prev; +- (PlaylistEntry *)prevEntry; +- (PlaylistEntry *)nextEntry; + +//load/save playlist +- (void)loadPlaylist:(NSString *)filename; +- (void)savePlaylist:(NSString *)filename; + +- (NSString *)playlistFilename; +- (void)setPlaylistFilename:(NSString *)pf; +- (NSArray *)acceptablePlaylistTypes; + +//private playlist management stuff..ssshhhh +- (void)getNextEntry; +- (void)getPrevEntry; +- (void)setPrevEntry:(PlaylistEntry *)pe; +- (void)setNextEntry:(PlaylistEntry *)pe; + +//private +- (void)updateIndexesFromRow:(int) row; + +@end diff --git a/Playlist/PlaylistController.m b/Playlist/PlaylistController.m new file mode 100644 index 000000000..9354fbb46 --- /dev/null +++ b/Playlist/PlaylistController.m @@ -0,0 +1,496 @@ +// +// PlaylistController.m +// Cog +// +// Created by Vincent Spader on 3/18/05. +// Copyright 2005 __MyCompanyName__. All rights reserved. +// + +#import "PlaylistController.h" +#import "PlaylistEntry.h" + +@implementation PlaylistController + +#define HISTORY_SIZE 100 + +- (id)initWithCoder:(NSCoder *)decoder +{ + self = [super initWithCoder:decoder]; + + if (self) + { + acceptableFileTypes = [[NSArray alloc] initWithObjects:@"ogg",@"wav",@"mpc",@"flac",@"ape",@"mp3",@"aiff",@"aif",@"aac",nil]; + acceptablePlaylistTypes = [[NSArray alloc] initWithObjects:@"playlist",nil]; + history = [[NSMutableArray alloc] init]; + shuffleList = [[NSMutableArray alloc] init]; +// DBLog(@"DAH BUTTER CHORNAR: %@", history); + } + + return self; +} + +- (void)awakeFromNib +{ + [super awakeFromNib]; +} + +- (int)insertFile:(NSString *)filename atIndex:(int)index +{ + if ([acceptableFileTypes containsObject:[filename pathExtension]]) + { + PlaylistEntry *pe = [[PlaylistEntry alloc] init]; + + [pe setFilename:filename]; //Setfilename takes car of opening the soundfile..cheap hack, but works for now + [pe setIndex:index]; + [pe readTags]; + [pe readInfo]; + + [self insertObject:pe atArrangedObjectIndex:index]; + + return 1; + } + + return 0; +} + +- (int)insertPath:(NSString *)path atIndex:(int)index +{ + BOOL isDir; + NSFileManager *manager; + + manager = [NSFileManager defaultManager]; + + if ([manager fileExistsAtPath:path isDirectory:&isDir] && isDir == YES) + { + int count; + int j; + NSArray *subpaths; + count = 0; + subpaths = [manager subpathsAtPath:path]; + + for (j = 0; j < [subpaths count]; j++) + { + NSString *filepath; + + filepath = [NSString pathWithComponents:[NSArray arrayWithObjects:path,[subpaths objectAtIndex:j],nil]]; + + count += [self insertFile:filepath atIndex:index+count]; + } + + return count; + } + else + { +// DBLog(@"Adding fiiiiile: %@", path); + return [self insertFile:path atIndex:index]; + } +} + +- (int)insertPaths:(NSArray *)paths atIndex:(int)index sort:(BOOL)sort +{ + NSArray *sortedFiles; + int count; + int i; + + if (!paths) + return 0; + + if (index < 0) + index = 0; + + count = 0; + + if (sort == YES) + sortedFiles = [paths sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)]; + else + sortedFiles = paths; + + for(i=0; i < [sortedFiles count]; i++) + { + int j; + NSString *f; + f = [sortedFiles objectAtIndex:i]; + +// DBLog(@"Adding file to index: %i", index+count); + j = [self insertPath:f atIndex:(index+count)]; +// DBLog(@"Number added: %i", j); + count+=j; + } + + if (shuffle == YES) + [self generateShuffleList]; + + return count; +} + +- (int)addFile:(NSString *)filename +{ + return [self insertFile:filename atIndex:[[self arrangedObjects] count]]; +} + +- (int)addPath:(NSString *)path +{ + return [self insertPath:path atIndex:[[self arrangedObjects] count]]; +} + +- (int)addPaths:(NSArray *)paths sort:(BOOL)sort +{ + return [self insertPaths:paths atIndex:[[self arrangedObjects] count] sort:sort]; +} + +- (NSArray *)acceptableFileTypes +{ + return acceptableFileTypes; +} + +- (BOOL)tableView:(NSTableView*)tv + acceptDrop:(id )info + row:(int)row + dropOperation:(NSTableViewDropOperation)op +{ + int i; + + [super tableView:tv acceptDrop:info row:row dropOperation:op]; + if ([info draggingSource] == tableView) + { + //DNDArrayController handles moving...still need to update the uhm...indices + NSArray *rows = [NSKeyedUnarchiver unarchiveObjectWithData:[[info draggingPasteboard] dataForType: MovedRowsType]]; + NSIndexSet *indexSet = [self indexSetFromRows:rows]; + int firstIndex = [indexSet firstIndex]; + if (firstIndex > row) + { + i = row; + } + else + { + i = firstIndex; + } + + [self updateIndexesFromRow:i]; + + return YES; + } + + if (row < 0) + row = 0; + + NSArray *files = [[info draggingPasteboard] propertyListForType:NSFilenamesPboardType]; + [self insertPaths:files atIndex:row sort:YES]; + + [self updateIndexesFromRow:row]; + + if (shuffle == YES) + [self generateShuffleList]; + + return YES; +} + +- (void)updateIndexesFromRow:(int) row +{ +// DBLog(@"UPDATE INDEXES: %i", row); + int j; + for (j = row; j < [[self content] count]; j++) + { + PlaylistEntry *p; + p = [[self content] objectAtIndex:j]; + + [p setIndex:j]; + } +} + +- (void)removeObjectsAtArrangedObjectIndexes:(NSIndexSet *)indexes +{ + NSArray *a = [[self arrangedObjects] objectsAtIndexes:indexes]; + + if ([a containsObject:currentEntry]) + { + [currentEntry setIndex:-1]; + } + + [super removeObjectsAtArrangedObjectIndexes:indexes]; + [self updateIndexesFromRow:[indexes firstIndex]]; + + if (shuffle == YES) + [self generateShuffleList]; + + [history removeObjectsInArray:a]; +} + +- (IBAction)takeShuffleFromObject:(id)sender +{ + if( [sender respondsToSelector: @selector(boolValue)] ) + [self setShuffle: [sender boolValue]]; + else + [self setShuffle: [sender state]]; +} +- (IBAction)takeRepeatFromObject:(id)sender +{ + if( [sender respondsToSelector: @selector(boolValue)] ) + [self setRepeat: [sender boolValue]]; + else + [self setRepeat: [sender state]]; +} + +- (void)next +{ + PlaylistEntry *pe; + + pe = [self nextEntry]; + if (pe == nil) + return; + + if (shuffle == YES) + { + [shuffleList removeObject:pe]; + } + [self setCurrentEntry:pe addToHistory:YES]; + [self setNextEntry:nil]; +} + +- (void)prev +{ + PlaylistEntry *pe; + + pe = [self prevEntry]; + if (pe == nil) + return; + + if (pe != [history objectAtIndex:1]) + DBLog(@"History inconcistency"); + [history removeObjectAtIndex:0]; + + [self setCurrentEntry:pe addToHistory:NO]; + [self setPrevEntry:nil]; + + //If one goes back, and goes forward, one shall receive unto thee a new song + if (shuffle == YES) + [self generateShuffleList]; +} + +- (PlaylistEntry *)prevEntry +{ + if (prevEntry == nil) + [self getPrevEntry]; + + return prevEntry; +} + +- (PlaylistEntry *)nextEntry +{ + if (nextEntry == nil) + [self getNextEntry]; + + return nextEntry; +} + +- (void)reset +{ + nextEntry = nil; + prevEntry = nil; + [self generateShuffleList]; +} + +- (void)generateShuffleList +{ +// [shuffleHistory removeAllObjects]; +// DBLog(@"Generated Shuffle List"); + [shuffleList removeAllObjects]; + [shuffleList addObjectsFromArray:[self arrangedObjects]]; + if (currentEntry != nil) + [shuffleList removeObject:currentEntry]; +} + +- (void)setCurrentEntry:(PlaylistEntry *)pe addToHistory:(BOOL)h +{ + [self setCurrentEntry:pe]; + + if (h == YES) + { + [history insertObject:pe atIndex:0]; + if ([history count] > HISTORY_SIZE) + [history removeObjectAtIndex:([history count] - 1)]; + + } +} + +- (void)getNextEntry +{ + PlaylistEntry *pe; + + if (nextEntry != nil) + return; + + if (shuffle == YES) + { +// DBLog(@"SHUFFLE IS TEH ON: %i", [shuffleList count]); + if ([shuffleList count] == 0) //out of tuuuunes + { + if (repeat == YES) + { + [self generateShuffleList]; + } + else + { + [self setNextEntry:nil]; + return; + } + } + int r; + + r = random() % [shuffleList count]; +// DBLog(@"PICKING SONG %i FROM SHUFFLE LIST", r); + pe = [shuffleList objectAtIndex:r]; + + [self setNextEntry:pe]; + } + else + { + int i = [currentEntry index] + 1; + + if (i >= [[self arrangedObjects] count]) //out of tuuuunes + { + if (repeat == YES) + { + i = 0; + } + else + { + [self setNextEntry:nil]; + return; + } + } + + pe = [[self arrangedObjects] objectAtIndex:i]; + + [self setNextEntry:pe]; + } +} + +- (id)currentEntry +{ +// DBLog(@"WOAH EGE "); + return currentEntry; +} + +- (void)setCurrentEntry:(id)pe +{ + [currentEntry setCurrent:NO]; + + [pe setCurrent:YES]; + [tableView scrollRowToVisible:[pe index]]; + + [pe retain]; + [currentEntry release]; + + currentEntry = pe; +} + +- (void)getPrevEntry +{ + PlaylistEntry *pe; + +// DBLog(@"GETTING PREVIOUS ENTRY"); + + if (prevEntry != nil) + return; + //NOTE: 1 contains the current entry + if ([history count] == 1) //Cant go back any further + { +// DBLog(@"HISTORY IS TEH EMPTY"); + [self setPrevEntry:nil]; + return; + } + else + { +// DBLog(@"IN TEH HISTORY"); + + pe = [history objectAtIndex:1]; + [self setPrevEntry:pe]; + + return; + } +} + +- (void)setPrevEntry:(PlaylistEntry *)pe +{ + [pe retain]; + [prevEntry release]; + prevEntry = pe; +} + +- (void)setNextEntry:(PlaylistEntry *)pe +{ + [pe retain]; + [nextEntry release]; + nextEntry = pe; +} + +- (void)setShuffle:(BOOL)s +{ + shuffle = s; + if (shuffle == YES) + [self generateShuffleList]; +} +- (BOOL)shuffle +{ + return shuffle; +} +- (void)setRepeat:(BOOL)r +{ + repeat = r; +} +- (BOOL)repeat +{ + return repeat; +} + +- (void)savePlaylist:(NSString *)filename +{ +// DBLog(@"SAVING PLAYLIST: %@", filename); + NSString *fileContents; + NSMutableArray *filenames = [NSMutableArray array]; + + NSEnumerator *enumerator; + PlaylistEntry *entry; + enumerator = [[self arrangedObjects] objectEnumerator]; + while (entry = [enumerator nextObject]) + { + [filenames addObject:[entry filename]]; + } + + fileContents = [filenames componentsJoinedByString:@"\n"]; + [fileContents writeToFile:filename atomically:NO]; +} + +- (void)loadPlaylist:(NSString *)filename +{ + NSString *fileContents; + + [self removeObjects:[self arrangedObjects]]; + fileContents = [NSString stringWithContentsOfFile:filename]; + if (fileContents) + { + NSArray *filenames = [fileContents componentsSeparatedByString:@"\n"]; +// DBLog(@"filenames: %@", filenames); + [self addPaths:filenames sort:NO]; + } +} + +- (NSArray *)acceptablePlaylistTypes +{ + return acceptablePlaylistTypes; +} + +- (NSString *)playlistFilename +{ + return playlistFilename; +} +- (void)setPlaylistFilename:(NSString *)pf +{ + [pf retain]; + [playlistFilename release]; + + playlistFilename = pf; +} + +@end diff --git a/Playlist/PlaylistEntry.h b/Playlist/PlaylistEntry.h new file mode 100644 index 000000000..59db67ea5 --- /dev/null +++ b/Playlist/PlaylistEntry.h @@ -0,0 +1,67 @@ +// +// PlaylistEntry.h +// Cog +// +// Created by Vincent Spader on 3/14/05. +// Copyright 2005 __MyCompanyName__. All rights reserved. +// + +#import +#import "SoundFile.h" + +@interface PlaylistEntry : NSObject { + NSString *filename; + NSString *display; + + NSString *artist; + NSString *album; + NSString *title; + NSString *genre; + + unsigned int year; + unsigned int track; + + NSString *lengthString; + + double length; + int bitRate; + int channels; + int bitsPerSample; + float sampleRate; + + BOOL current; + + int idx; +} + +-(void)setIndex:(int)i; +-(int)index; +-(void)setFilename:(NSString *)f; +-(NSString *)filename; +-(void)setDisplay:(NSString *)d; +-(NSString *)display; +-(void)setCurrent:(BOOL) b; +-(BOOL)current; + +- (void)setArtist:(NSString *)s; +- (NSString *)artist; +- (void)setAlbum:(NSString *)s; +- (NSString *)album; +- (void)setTitle:(NSString *)s; +- (NSString *)title; +- (void)setGenre:(NSString *)s; +- (NSString *)genre; + +- (NSString *)lengthString; +- (void)setLengthString:(double)l; + +- (double)length; +- (int)bitRate; +- (int)channels; +- (int)bitsPerSample; +- (float)sampleRate; + +- (void)readTags; +- (void)readInfo; + +@end diff --git a/Playlist/PlaylistEntry.m b/Playlist/PlaylistEntry.m new file mode 100644 index 000000000..94fbf7ed6 --- /dev/null +++ b/Playlist/PlaylistEntry.m @@ -0,0 +1,276 @@ +// +// PlaylistEntry.m +// Cog +// +// Created by Vincent Spader on 3/14/05. +// Copyright 2005 __MyCompanyName__. All rights reserved. +// + +#import "PlaylistEntry.h" +#import "TagLib/tag_c.h" + +@implementation PlaylistEntry + +- (id)init +{ + self = [super init]; + if (self) + { + [self setIndex:0]; + [self setFilename:@""]; + [self setDisplay:@"Untitled"]; + } + + return self; +} + +- (void)dealloc +{ + [filename release]; + [display release]; + + [super dealloc]; +} + + +-(void)setIndex:(int)i +{ + idx = i; +} +-(int)index +{ + return idx; +} + +-(void)setFilename:(NSString *)f +{ + f = [f copy]; + [filename release]; + filename = f; +/* + //GO THROUGH HELLA SHIT TO DETERMINE FILE...NEED TO MAKE SOME KIND OF REGISTERING MECHANISM + if ([[filename pathExtension] isEqualToString:@"wav"] || [[filename pathExtension] isEqualToString:@"aiff"]) + { + soundFile = [[WaveFile alloc] init]; + } + else if ([[filename pathExtension] isEqualToString:@"ogg"]) + { + soundFile = [[VorbisFile alloc] init]; + } + else if ([[filename pathExtension] isEqualToString:@"mpc"]) + { + soundFile = [[MusepackFile alloc] init]; + } + else if ([[filename pathExtension] isEqualToString:@"flac"]) + { + soundFile = [[FlacFile alloc] init]; + } + else if ([[filename pathExtension] isEqualToString:@"ape"]) + { + soundFile = [[MonkeysFile alloc] init]; + } + else if ([[filename pathExtension] isEqualToString:@"mp3"]) + { + soundFile = [[MPEGFile alloc] init]; + } + else + { + soundFile = nil; + } + + [soundFile open:[filename UTF8String]]; +*/ +} + +-(NSString *)filename +{ + return filename; +} + +-(void)setDisplay:(NSString *)d +{ + d = [d copy]; + [display release]; + display = d; +} + +-(NSString *)display +{ + return display; +} + +-(void)setCurrent:(BOOL) b +{ + current = b; +} + +-(BOOL)current +{ + return current; +} + + +- (void)setArtist:(NSString *)s +{ + [s retain]; + [artist release]; + + artist = s; +} + +- (NSString *)artist +{ + return artist; +} + +- (void)setAlbum:(NSString *)s +{ + [s retain]; + [album release]; + + album = s; +} + +- (NSString *)album +{ + return album; +} + +- (void)setTitle:(NSString *)s +{ + [s retain]; + [title release]; + + title = s; +} + +- (NSString *)title +{ +// DBLog(@"HERE FUCK: %@", title); + return title; +} + +- (void)setGenre:(NSString *)s +{ + [s retain]; + [genre release]; + + genre = s; +} + +- (NSString *)genre +{ + return genre; +} + +- (void)readInfo +{ + SoundFile *sf = [SoundFile readInfo:filename]; + + length = [sf length]; + bitRate = [sf bitRate]; + channels = [sf channels]; + bitsPerSample = [sf bitsPerSample]; + sampleRate = [sf frequency]; + + [self setLengthString:length]; +// DBLog(@"Length: %f bitRate: %i channels: %i bps: %i samplerate: %f", length, bitRate, channels, bitsPerSample, sampleRate); + + [sf close]; +} + +- (NSString *)lengthString +{ + return lengthString; +} +- (void)setLengthString:(double)l +{ + int sec = (int)(l/1000.0); + + [lengthString release]; + lengthString = [[NSString alloc] initWithFormat:@"%i:%02i",sec/60,sec%60]; +} + +- (double)length +{ + return length; +} +- (int)bitRate +{ + return bitRate; +} + +- (int)channels +{ + return channels; +} +- (int)bitsPerSample +{ + return bitsPerSample; +} +- (float)sampleRate +{ + return sampleRate; +} + +-(void)readTags +{ + TagLib_File *tagFile = taglib_file_new((const char *)[filename UTF8String]); + if (tagFile) + { + TagLib_Tag *tag = taglib_file_tag(tagFile); + + if (tag) + { + NSLog(@"TAG: %i", tag); + + char *pArtist, *pTitle, *pAlbum, *pGenre, *pComment; + + pArtist = taglib_tag_artist(tag); + pTitle = taglib_tag_title(tag); + pAlbum = taglib_tag_album(tag); + pGenre = taglib_tag_genre(tag); + pComment = taglib_tag_comment(tag); + + year = taglib_tag_year(tag); + track = taglib_tag_track(tag); + + + if (pArtist != NULL) + [self setArtist:[NSString stringWithUTF8String:(char *)pArtist]]; + else + [self setArtist:nil]; + + if (pAlbum != NULL) + [self setAlbum:[NSString stringWithUTF8String:(char *)pAlbum]]; + else + [self setAlbum:nil]; + + if (pTitle != NULL) + [self setTitle:[NSString stringWithUTF8String:(char *)pTitle]]; + else + [self setTitle:nil]; + + if (pGenre != NULL) + [self setGenre:[NSString stringWithUTF8String:(char *)pGenre]]; + else + [self setGenre:nil]; + + if ([artist isEqualToString:@""] || [title isEqualToString:@""]) + [self setDisplay:[filename lastPathComponent]]; + else + [self setDisplay:[NSString stringWithFormat:@"%@ - %@", artist, title]]; + + + taglib_tag_free_strings(); + } + + taglib_file_free(tagFile); + } + else + { + [self setDisplay:[filename lastPathComponent]]; + } +} + +@end diff --git a/Playlist/PlaylistView.h b/Playlist/PlaylistView.h new file mode 100644 index 000000000..20367c946 --- /dev/null +++ b/Playlist/PlaylistView.h @@ -0,0 +1,21 @@ +// +// PlaylistView.h +// Cog +// +// Created by Vincent Spader on 3/20/05. +// Copyright 2005 __MyCompanyName__. All rights reserved. +// + +#import + +#import "SoundController.h" +#import "PlaylistController.h" + +@interface PlaylistView : NSTableView { + + IBOutlet SoundController *soundController; + IBOutlet PlaylistController *playlistController; + +} + +@end diff --git a/Playlist/PlaylistView.m b/Playlist/PlaylistView.m new file mode 100644 index 000000000..2dfa29d72 --- /dev/null +++ b/Playlist/PlaylistView.m @@ -0,0 +1,67 @@ +// +// PlaylistView.m +// Cog +// +// Created by Vincent Spader on 3/20/05. +// Copyright 2005 __MyCompanyName__. All rights reserved. +// + +#import "PlaylistView.h" +#import "SoundController.h" +#import "PlaylistController.h" + +@implementation PlaylistView + +- (BOOL)acceptsFirstResponder +{ + return YES; +} +- (BOOL)resignFirstResponder +{ + return YES; +} + +- (void)mouseDown:(NSEvent *)e +{ +// DBLog(@"MOUSE DOWN"); + if ([e type] == NSLeftMouseDown && [e clickCount] == 2) + { + [soundController playEntryAtIndex:[self selectedRow]]; + } + else + { +// DBLog(@"Super"); + [super mouseDown:e]; + } +} + + +- (void)keyDown:(NSEvent *)e +{ + NSString *s; + unichar c; + + s = [e charactersIgnoringModifiers]; + if ([s length] != 1) + return; + + c = [s characterAtIndex:0]; + if (c == NSDeleteCharacter) + { + [playlistController remove:self]; + } + else if (c == ' ') + { + [soundController pauseResume:self]; + } + else if (c == NSEnterCharacter || c == NSCarriageReturnCharacter) + { + [soundController playEntryAtIndex:[self selectedRow]]; + } + else + { + [super keyDown:e]; + } +} + +@end diff --git a/README b/README new file mode 100644 index 000000000..e9cab0cef --- /dev/null +++ b/README @@ -0,0 +1,12 @@ + Cog is released under the GPL. See COPYING for details. + The libraries folder . It contains various decoding and tagging +frameworks, which i have created Xcode projects for, and possibly modified +to make compile on OS X. The various libraries are under each of their own +licenses. + Please note that the source code may contain vulgar language as comments, +and in debugging messages. All Cog code is copywrited by me. + If you would like the photoshop sources for the various icons and +graphics, please send me an email, and I will be happy to get them to you. + +Share and enjoy. +--Vincent Spader (cog@badahol.net) diff --git a/Sound.h b/Sound.h new file mode 100644 index 000000000..a8c8309e5 --- /dev/null +++ b/Sound.h @@ -0,0 +1,128 @@ +// +// Sound.h +// Cog +// +// Created by Zaphod Beeblebrox on 5/11/05. +// Copyright 2005 __MyCompanyName__. All rights reserved. +// + +#import + +#import +#import +#import + +#import "SoundFile/SoundFile.h" +#import "VirtualRingBuffer.h" + +//Inter thread messages +//Controller to sound messages +enum +{ + kCogPauseResumeMessage = 100, + kCogPauseMessage, + kCogResumeMessage, + kCogPlayFileMessage, + kCogChangeFileMessage, + kCogStopMessage, + kCogSeekMessage, + kCogEndOfPlaylistMessage, + + //sound to controller + kCogCheckinMessage, + kCogRequestNextFileMessage, + kCogBitrateUpdateMessage, + kCogLengthUpdateMessage, + kCogPositionUpdateMessage, + kCogFileChangedMessage +}; + +enum +{ + kCogStatusPaused, + kCogStatusStopped, + kCogStatusPlaying, + kCogStatusEndOfFile, + kCogStatusEndOfPlaylist, + kCogStatusPlaybackEnded +}; + +@interface Sound : NSObject { + //For communication with the soundcontroller + NSPort *sendPort; + NSPort *distantPort; + + SoundFile *soundFile; + unsigned long currentPosition; + unsigned long totalLength; + + //Whole lotta core audio fun + AudioUnit outputUnit; + AudioStreamBasicDescription deviceFormat; // info about the default device + AudioStreamBasicDescription sourceStreamFormat; + AURenderCallbackStruct renderCallback; + AudioConverterRef converter; + + void *conversionBuffer; + + int playbackStatus; + + NSTimer *fillTimer; //used to wake up the filler thread + //semaphore_t semaphore; //used to wake up the filler thread + NSTimer *positionTimer; + + VirtualRingBuffer *ringBuffer; + VirtualRingBuffer *auxRingBuffer; //For changing tracks + + VirtualRingBuffer *readRingBuffer; + VirtualRingBuffer *writeRingBuffer; + + //Track changing procedure...sound send changerequest to controller when it hits EOF, and sets writeringbuffer to the opposite buffer... + //when buffer is empty, sound sends changecomplete to controller, and sets readringbuffer to the opposite + + NSLock *readLock; + NSLock *writeLock; +} + +- (void)launchThreadWithPort:(id)inData; +- (void)sendPortMessage:(int)msgid; +- (void)sendPortMessage:(int)msgid withData:(void *)data ofSize:(int)size; +- (void)handlePortMessage:(NSPortMessage *)portMessage; + +- (void)scheduleFillTimer; +- (void)fireFillTimer; + +- (void)sendPositionUpdate:(id)sender; + +- (void)fillBuffer:(id)sender; +- (int)convert:(void *)destBuf packets:(int)numPackets; +- (void)resetBuffer; +- (VirtualRingBuffer *)oppositeBuffer:(VirtualRingBuffer *)buf; + +//private methodss +- (BOOL)setupAudioOutput; +- (BOOL)startAudioOutput; +- (void)stopAudioOutput; +- (void)cleanUpAudioOutput; + +- (BOOL)prepareSoundFile; +- (void)cleanUpSoundFile; + +- (void)setThreadPolicy; + +- (void)pause; +- (void)resume; +- (void)stop; + +- (void)playFile:(NSString *)filename; +- (void)changeFile:(NSString *)filename; + +- (void)setSoundFile:(NSString *)filename; + +//helper function +- (double)calculateTime:(unsigned long) pos; +- (unsigned long)calculatePos:(double) time; + + +@end + \ No newline at end of file diff --git a/Sound.m b/Sound.m new file mode 100644 index 000000000..8073c2d17 --- /dev/null +++ b/Sound.m @@ -0,0 +1,667 @@ +// +// Sound.m +// Cog +// +// Created by Zaphod Beeblebrox on 5/11/05. +// Copyright 2005 __MyCompanyName__. All rights reserved. +// + +#include +#include +#include +#include + +#import "Sound.h" +#import "FlacFile.h" +#import "MonkeysFile.h" +#import "MPEGFile.h" +#import "MusepackFile.h" +#import "VorbisFile.h" +#import "WaveFile.h" + +#import "DBLog.h" + +//128kb of floating point data gives ya ~371 milliseconds...so 512kb should give us about 1.5 seconds +#define RING_BUFFER_SIZE (512 * 1024) +//this much data is about 56 milliseconds of floating point data +#define BUFFER_WRITE_CHUNK (16 * 1024) + +//#define RING_BUFFER_SIZE 1048576 +//#define BUFFER_WRITE_CHUNK 32768 +#define FEEDER_THREAD_IMPORTANCE 4 + +//timeout should be smaller than the time itd take for the buffer to run dry...looks like were ironclad +#define TIMEOUT 1 + +void PrintStreamDesc (AudioStreamBasicDescription *inDesc) +{ + if (!inDesc) { + printf ("Can't print a NULL desc!\n"); + return; + } + printf ("- - - - - - - - - - - - - - - - - - - -\n"); + printf (" Sample Rate:%f\n", inDesc->mSampleRate); + printf (" Format ID:%s\n", (char*)&inDesc->mFormatID); + printf (" Format Flags:%lX\n", inDesc->mFormatFlags); + printf (" Bytes per Packet:%ld\n", inDesc->mBytesPerPacket); + printf (" Frames per Packet:%ld\n", inDesc->mFramesPerPacket); + printf (" Bytes per Frame:%ld\n", inDesc->mBytesPerFrame); + printf (" Channels per Frame:%ld\n", inDesc->mChannelsPerFrame); + printf (" Bits per Channel:%ld\n", inDesc->mBitsPerChannel); + printf ("- - - - - - - - - - - - - - - - - - - -\n"); +} + +@implementation Sound + +//called from the complexfill when the audio is converted...good clean fun +static OSStatus Sound_ACInputProc(AudioConverterRef inAudioConverter, UInt32* ioNumberDataPackets, AudioBufferList* ioData, AudioStreamPacketDescription** outDataPacketDescription, void* inUserData) +{ + Sound *sound = (Sound *)inUserData; + OSStatus err = noErr; + + int amountToWrite; + int amountWritten; + void *sourceBuf; + + amountToWrite = (*ioNumberDataPackets)*sound->sourceStreamFormat.mBytesPerPacket; + sourceBuf = malloc(amountToWrite); + sound->conversionBuffer = sourceBuf; + + amountWritten = [sound->soundFile fillBuffer:sourceBuf ofSize:amountToWrite]; + +// DBLog(@"PACKET NUMBER RECEIVED: %i", *ioNumberDataPackets); + ioData->mBuffers[0].mData = sourceBuf; + ioData->mBuffers[0].mDataByteSize = amountWritten; + ioData->mBuffers[0].mNumberChannels = sound->sourceStreamFormat.mChannelsPerFrame; + ioData->mNumberBuffers = 1; + + return err; +} + +//called from coreaudio, just fill the bufferlist and thats all +static OSStatus Sound_Renderer(void *inRefCon, AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inBusNumber, UInt32 inNumberFrames, AudioBufferList *ioData) +{ + Sound *sound = (Sound *)inRefCon; + OSStatus err = noErr; + + int amountAvailable; + int amountToRead; + void *readPointer; + + [sound->readLock lock]; + + amountAvailable = [sound->readRingBuffer lengthAvailableToReadReturningPointer:&readPointer]; + if (sound->playbackStatus == kCogStatusEndOfFile && amountAvailable == 0) + { +// DBLog(@"FILE CHANGED!!!!!"); + [sound sendPortMessage:kCogFileChangedMessage]; + sound->readRingBuffer = [sound oppositeBuffer:sound->readRingBuffer]; + sound->playbackStatus = kCogStatusPlaying; + + sound->currentPosition = 0; + + double time = [sound calculateTime:sound->totalLength]; + int bitrate = [sound->soundFile bitRate]; + [sound sendPortMessage:kCogLengthUpdateMessage withData:&time ofSize:(sizeof(double))]; + [sound sendPortMessage:kCogBitrateUpdateMessage withData:&bitrate ofSize:(sizeof(int))]; + } + if (sound->playbackStatus == kCogStatusEndOfPlaylist && amountAvailable == 0) + { + //Stop playback + sound->playbackStatus = kCogStatusPlaybackEnded; + } + + if (amountAvailable < ([sound->readRingBuffer bufferLength] - BUFFER_WRITE_CHUNK)) + { +// DBLog(@"AVAILABLE: %i", amountAvailable); + [sound fireFillTimer]; + } + + if (amountAvailable > inNumberFrames*sound->deviceFormat.mBytesPerPacket) + amountToRead = inNumberFrames*sound->deviceFormat.mBytesPerPacket; + else + amountToRead = amountAvailable; + + memcpy(ioData->mBuffers[0].mData, readPointer, amountToRead); + ioData->mBuffers[0].mDataByteSize = amountToRead; + + [sound->readRingBuffer didReadLength:amountToRead]; + + sound->currentPosition += amountToRead; + + [sound->readLock unlock]; + + return err; +} + +- (id)init +{ + DBLog(@"HEllo"); + self = [super init]; + if (self) + { + readLock = [[NSLock alloc] init]; + writeLock = [[NSLock alloc] init]; + + ringBuffer = [[VirtualRingBuffer alloc] initWithLength:RING_BUFFER_SIZE]; + auxRingBuffer = [[VirtualRingBuffer alloc] initWithLength:RING_BUFFER_SIZE]; + + readRingBuffer = ringBuffer; + writeRingBuffer = ringBuffer; + } + + return self; +} + +- (void)launchThreadWithPort:(id)inData +{ + NSAutoreleasePool *pool; + pool = [[NSAutoreleasePool alloc] init]; + + distantPort = (NSPort *)inData; + + sendPort = [NSPort port]; + if (sendPort) + { + [sendPort setDelegate:self]; + + NSArray *modes = [NSArray arrayWithObjects:NSDefaultRunLoopMode, nil];//NSEventTrackingRunLoopMode, nil]; + NSEnumerator *enumerator; + NSString *mode; + + enumerator = [modes objectEnumerator]; + while ((mode = [enumerator nextObject])) + [[NSRunLoop currentRunLoop] addPort:sendPort forMode:mode]; + } +// DBLog(@"SENDING CHECKIN MESSAGE"); + [self sendPortMessage:kCogCheckinMessage]; + + [self setupAudioOutput]; + + [self setThreadPolicy]; + + [[NSRunLoop currentRunLoop] run]; + + [pool release]; +} + +/*- (void)printDebugInfo:(id)sender +{ + void *ptr; + + DBLog(@"Available r/w: %i/%i", [ringBuffer lengthAvailableToReadReturningPointer:&ptr], [ringBuffer lengthAvailableToWriteReturningPointer:&ptr]); +} +*/ +- (void)setThreadPolicy +{ + // Increase this thread's priority, and turn off timesharing. + + kern_return_t error; + thread_extended_policy_data_t extendedPolicy; + thread_precedence_policy_data_t precedencePolicy; + + extendedPolicy.timeshare = 0; + error = thread_policy_set(mach_thread_self(), THREAD_EXTENDED_POLICY, (thread_policy_t)&extendedPolicy, THREAD_EXTENDED_POLICY_COUNT); + + if (error != KERN_SUCCESS) { + DBLog(@"Couldn't set feeder thread's extended policy"); + } + + precedencePolicy.importance = FEEDER_THREAD_IMPORTANCE; + error = thread_policy_set(mach_thread_self(), THREAD_PRECEDENCE_POLICY, (thread_policy_t)&precedencePolicy, THREAD_PRECEDENCE_POLICY_COUNT); + + if (error != KERN_SUCCESS) { + DBLog(@"Couldn't set feeder thread's precedence policy"); + } +} + +- (void)sendPortMessage:(int)msgid +{ + NSPortMessage *portMessage = [[NSPortMessage alloc] initWithSendPort:distantPort receivePort:sendPort components:nil]; + + if (portMessage) + { + NSDate *date = [[NSDate alloc] init]; + + [portMessage setMsgid:msgid]; + [portMessage sendBeforeDate:date]; + + [date release]; + [portMessage release]; + } +} + +- (void)sendPortMessage:(int)msgid withData:(void *)data ofSize:(int)size +{ + NSPortMessage *portMessage; + NSData *d = [[NSData alloc] initWithBytes:data length:size]; + NSArray *a = [[NSArray alloc] initWithObjects:d,nil]; + portMessage = [[NSPortMessage alloc] initWithSendPort:distantPort receivePort:sendPort components:a]; + + [a release]; + [d release]; + + if (portMessage) + { + NSDate *date = [[NSDate alloc] init]; + + [portMessage setMsgid:msgid]; + [portMessage sendBeforeDate:date]; + + [date release]; + [portMessage release]; + } + +} + +// Worker thread message handler method. +- (void)handlePortMessage:(NSPortMessage *)portMessage +{ + unsigned int msgid = [portMessage msgid]; + + // Handle messages from the main thread. + if (msgid == kCogPauseResumeMessage) + { + if (playbackStatus == kCogStatusPaused) + { + [self resume]; + } + else + { + [self pause]; + } + } + else if (msgid == kCogPauseMessage) + { + [self pause]; + } + else if (msgid == kCogResumeMessage) + { + [self resume]; + } + else if (msgid == kCogStopMessage) + { + [self stop]; + } + else if (msgid == kCogPlayFileMessage || msgid == kCogChangeFileMessage) + { + NSArray* components = [portMessage components]; + NSData *data = [components objectAtIndex:0]; + NSString *s = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; + + if (msgid == kCogPlayFileMessage) //PLAY THE FARKING FILE NOW + { + [self playFile:s]; + } + else if (kCogChangeFileMessage) //change the file, usually in response to a nexttrack request + { + [self changeFile:s]; + } + + [s release]; + } + else if (msgid == kCogSeekMessage) + { +// DBLog(@"MESAGE RECEIVED"); + NSArray* components = [portMessage components]; + NSData *data = [components objectAtIndex:0]; + double time; + unsigned long pos; + time = (*(double *)[data bytes]); + pos = [self calculatePos:time]; + + [soundFile seekToTime:time]; + [self resetBuffer]; + [readLock lock]; + currentPosition = pos; + [readLock unlock]; + } + else if (msgid == kCogEndOfPlaylistMessage) + { + playbackStatus = kCogStatusEndOfPlaylist; + } +} + +- (void)scheduleFillTimer +{ + fillTimer = [NSTimer scheduledTimerWithTimeInterval:TIMEOUT target:self selector:@selector(fillBuffer:) userInfo:nil repeats:NO]; +} + +//the only method in the whole fucking thing that should be called by an outside thread +- (void)fireFillTimer +{ + NSDate *date = [[NSDate alloc] init]; +// DBLog(@"FIRED"); + [fillTimer setFireDate:date]; + + [date release]; +} + +- (void)fillBuffer:(id)sender +{ + int amountAvailable; + int convertedSize; + void *writePointer; + + if (playbackStatus == kCogStatusPlaybackEnded) + [self stop]; + + [writeLock lock]; + + //We do this so uhm, newly started songs dont have to wait for the entire buffer to fill for data to become available. + amountAvailable = [writeRingBuffer lengthAvailableToWriteReturningPointer:&writePointer]; + + int i; + for (i = 0; i < amountAvailable; i =+ BUFFER_WRITE_CHUNK) + { + int amountToWrite; + if (amountAvailable > BUFFER_WRITE_CHUNK) + amountToWrite = BUFFER_WRITE_CHUNK; + else + amountToWrite = amountAvailable; + + convertedSize = [self convert:writePointer packets:(amountToWrite/deviceFormat.mBytesPerPacket)]; +// convertedSize = [self convert:writePointer packets:(amountAvailable/deviceFormat.mBytesPerPacket)]; + if (playbackStatus == kCogStatusPlaying && convertedSize == 0) + { +// DBLog(@"NEXT!!!!"); + [self sendPortMessage:kCogRequestNextFileMessage]; + writeRingBuffer = [self oppositeBuffer:writeRingBuffer]; + playbackStatus = kCogStatusEndOfFile; + } + +// writePointer = (char *)writePointer + convertedSize; + [writeRingBuffer didWriteLength:convertedSize]; + + amountAvailable = [writeRingBuffer lengthAvailableToWriteReturningPointer:&writePointer]; + } + [writeLock unlock]; +// DBLog(@"WRote: %i", convertedSize); + + [self scheduleFillTimer]; +} + +- (VirtualRingBuffer *)oppositeBuffer:(VirtualRingBuffer *)buf +{ + if (buf == ringBuffer) + return auxRingBuffer; + else + return ringBuffer; +} + +- (double)calculateTime:(unsigned long) pos +{ + return ((pos/deviceFormat.mBytesPerPacket)/(deviceFormat.mSampleRate/1000.0)); +} + +- (unsigned long)calculatePos:(double) time +{ + return (unsigned long)(time * (deviceFormat.mSampleRate/1000.0)) * deviceFormat.mBytesPerPacket; +} + +- (void)sendPositionUpdate:(id)sender +{ + //this may be a bad idea + [readLock lock]; + unsigned long pos = currentPosition; + [readLock unlock]; + + double time = [self calculateTime:pos]; + + [self sendPortMessage:kCogPositionUpdateMessage withData:&time ofSize:(sizeof(double))]; +} + +- (int)convert:(void *)destBuf packets:(int)numPackets +{ + AudioBufferList ioData; + UInt32 ioNumberFrames; + UInt32 destSize; + OSStatus err; + + destSize = numPackets*deviceFormat.mBytesPerPacket; + + ioNumberFrames = numPackets; + ioData.mBuffers[0].mData = destBuf; + ioData.mBuffers[0].mDataByteSize = destSize; + ioData.mBuffers[0].mNumberChannels = deviceFormat.mChannelsPerFrame; + ioData.mNumberBuffers = 1; + +// DBLog(@"THIS IS RETARDED: %i", ioData.mBuffers[0].mData); +// DBLog(@"NUMBER OF PACKETS REQUESTED: %i", ioNumberFrames); + err = AudioConverterFillComplexBuffer(converter, Sound_ACInputProc, self, &ioNumberFrames, &ioData, NULL); + if (err != noErr) + DBLog(@"Converter error: %i", err); +// DBLog(@"THIS IS ANNOYING: %i", ioData.mBuffers[0].mData); + free(conversionBuffer); + + +// DBLog(@"HERE: %i/%i", destSize, ioData.mBuffers[0].mDataByteSize); + +// DBLog(@"%i/%i",old, inNumberFrames); + return ioData.mBuffers[0].mDataByteSize; +} + +- (BOOL)setupAudioOutput +{ + ComponentDescription desc; + OSStatus err; + + desc.componentType = kAudioUnitType_Output; + desc.componentSubType = kAudioUnitSubType_DefaultOutput; + desc.componentManufacturer = kAudioUnitManufacturer_Apple; + desc.componentFlags = 0; + desc.componentFlagsMask = 0; + + Component comp = FindNextComponent(NULL, &desc); //Finds an component that meets the desc spec's + if (comp == NULL) + return NO; + + err = OpenAComponent(comp, &outputUnit); //gains access to the services provided by the component + if (err) + return NO; + + // Initialize AudioUnit + err = AudioUnitInitialize(outputUnit); + if (err != noErr) + return NO; + + + UInt32 size = sizeof (AudioStreamBasicDescription); + Boolean outWritable; + //Gets the size of the Stream Format Property and if it is writable + AudioUnitGetPropertyInfo(outputUnit, + kAudioUnitProperty_StreamFormat, + kAudioUnitScope_Output, + 0, + &size, + &outWritable); + //Get the current stream format of the output + err = AudioUnitGetProperty (outputUnit, + kAudioUnitProperty_StreamFormat, + kAudioUnitScope_Output, + 0, + &deviceFormat, + &size); + + if (err != noErr) + return NO; + +/* // change output format... + deviceFormat.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger; + deviceFormat.mBytesPerFrame = 4; + deviceFormat.mBitsPerChannel = 16; + deviceFormat.mBytesPerPacket = 4; + DBLog(@"stuff: %i %i %i %i", deviceFormat.mBitsPerChannel, deviceFormat.mBytesPerFrame, deviceFormat.mBytesPerPacket, deviceFormat.mFramesPerPacket); + err = AudioUnitSetProperty (outputUnit, + kAudioUnitProperty_StreamFormat, + kAudioUnitScope_Output, + 0, + &deviceFormat, + size); +*/ + //Set the stream format of the output to match the input + err = AudioUnitSetProperty (outputUnit, + kAudioUnitProperty_StreamFormat, + kAudioUnitScope_Input, + 0, + &deviceFormat, + size); + + //setup render callbacks + renderCallback.inputProc = Sound_Renderer; + renderCallback.inputProcRefCon = self; + + AudioUnitSetProperty(outputUnit, kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input, 0, &renderCallback, sizeof(AURenderCallbackStruct)); + +// DBLog(@"Audio output successfully initialized"); + return (err == noErr); +} + +- (BOOL)startAudioOutput +{ + return (noErr == AudioOutputUnitStart(outputUnit)); +} + +- (void)cleanUpAudioOutput +{ + AudioOutputUnitStop(outputUnit);//you must stop the audio unit + AudioUnitUninitialize (outputUnit); + CloseComponent(outputUnit); +} + +- (void)stopAudioOutput +{ + if (outputUnit) + AudioOutputUnitStop(outputUnit); +} + +- (BOOL)prepareSoundFile +{ +// DBLog(@"This fucker hates me"); + [soundFile getFormat:&sourceStreamFormat]; + +#ifdef DEBUG + PrintStreamDesc(&sourceStreamFormat); + PrintStreamDesc(&deviceFormat); +#endif + + //Make the converter + OSStatus stat = noErr; + stat = AudioConverterNew ( &sourceStreamFormat, &deviceFormat, &converter); +// DBLog(@"Created converter"); + if (stat != noErr) + { + DBLog(@"Error creating converter %i", stat); + } + + unsigned long length; + length = (unsigned long)([soundFile totalSize] * (deviceFormat.mSampleRate/sourceStreamFormat.mSampleRate) * (deviceFormat.mBytesPerPacket/sourceStreamFormat.mBytesPerPacket)); + + //again, may be bad + [readLock lock]; + totalLength = length; + [readLock unlock]; +// DBLog(@"AM I CRASHING?"); + return (stat == noErr); +} + +- (void)cleanUpSoundFile +{ + AudioConverterDispose(converter); + [soundFile close]; +} + +- (void)pause +{ + [self stopAudioOutput]; + playbackStatus = kCogStatusPaused; + + [positionTimer invalidate]; + positionTimer = nil; +} + +- (void)resume +{ + [self startAudioOutput]; + playbackStatus = kCogStatusPlaying; + + positionTimer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(sendPositionUpdate:) userInfo:nil repeats:YES]; +} + +- (void)stop +{ +// DBLog(@"STOPPING"); + [self stopAudioOutput]; + [self resetBuffer]; + playbackStatus = kCogStatusStopped; + +// DBLog(@"HERE? PORT CONFLICT...FUCK"); + unsigned long pos = 0; + [self sendPortMessage:kCogPositionUpdateMessage withData:&pos ofSize:(sizeof(unsigned long))]; +// DBLog(@"THIS IS UBER SHITE: %@", positionTimer); + + [positionTimer invalidate]; + positionTimer = nil; +// DBLog(@"INVALIDATED"); +} + +- (void)playFile:(NSString *)filename +{ + [self stop]; + +// DBLog(@"PLAYING FILE"); + [self setSoundFile:filename]; + +// DBLog(@"DONT LIKE THIS, HUH?"); + + [readLock lock]; + unsigned long length = totalLength; + int bitrate = [soundFile bitRate]; + [readLock unlock]; + + double time = [self calculateTime:length]; + + [self sendPortMessage:kCogLengthUpdateMessage withData:&time ofSize:(sizeof(double))]; + [self sendPortMessage:kCogBitrateUpdateMessage withData:&bitrate ofSize:(sizeof(int))]; + + [self resume]; + [self fillBuffer:self]; +} + +- (void)changeFile:(NSString *)filename +{ + [self setSoundFile:filename]; +} + +- (void)resetBuffer +{ + [writeLock lock]; + [readLock lock]; + + [ringBuffer empty]; + [auxRingBuffer empty]; + + readRingBuffer = ringBuffer; + writeRingBuffer = ringBuffer; + + currentPosition = 0; + + [readLock unlock]; + [writeLock unlock]; +} + +- (void)setSoundFile:(NSString *)filename +{ + [self cleanUpSoundFile]; + [soundFile release]; + + //GO THROUGH HELLA SHIT TO DETERMINE FILE...NEED TO MAKE SOME KIND OF REGISTERING MECHANISM + soundFile = [SoundFile open:filename]; + +// DBLog(@"File opened: %s", [filename UTF8String]); + [self prepareSoundFile]; + [self fireFillTimer]; +} + + +@end diff --git a/SoundController.h b/SoundController.h new file mode 100644 index 000000000..613477899 --- /dev/null +++ b/SoundController.h @@ -0,0 +1,42 @@ +/* SoundController */ + +#import + +#import "Sound.h" +#import "PlaylistController.h" +#import "TrackingSlider.h" + +@interface SoundController : NSObject +{ + IBOutlet PlaylistController *playlistController; + IBOutlet TrackingSlider *positionSlider; + IBOutlet NSTextField *timeField; + IBOutlet NSTextField *lengthField; + IBOutlet NSTextField *bitrateField; + BOOL waitingForPlay; //No sneaky changing on us + Sound *sound; + + //For communication with the sound + NSPort *sendPort; + NSPort *distantPort; +} + +- (IBAction)pauseResume:(id)sender; + +- (IBAction)pause:(id)sender; +- (IBAction)resume:(id)sender; +- (IBAction)stop:(id)sender; + +- (IBAction)next:(id)sender; +- (IBAction)prev:(id)sender; +- (IBAction)seek:(id)sender; + +- (void)playEntryAtIndex:(int)i; +- (void)playEntry:(PlaylistEntry *)pe; + +- (void)sendPortMessage:(int)msgid; +- (void)sendPortMessage:(int)msgid withData:(void *)data ofSize:(int)size; +- (void)sendPortMessage:(int)msgid withString:(NSString *)s; +- (void)handlePortMessage:(NSPortMessage *)portMessage; + +@end diff --git a/SoundController.m b/SoundController.m new file mode 100644 index 000000000..511ea1035 --- /dev/null +++ b/SoundController.m @@ -0,0 +1,261 @@ +#import "SoundController.h" +#import "Sound.h" + +#import "DBLog.h" + +@implementation SoundController + +//Note: use distributed objects for communication between Sound and SoundController....each should be in their own threads + +- (id)init +{ + self = [super init]; + if (self) + { + sound = [[Sound alloc] init]; + } + + return self; +} + +- (void)awakeFromNib +{ + [timeField setFont:[NSFont systemFontOfSize:18]]; + + sendPort = [NSPort port]; + if (sendPort) + { + [sendPort setDelegate:self]; + + NSArray *modes = [NSArray arrayWithObjects:NSDefaultRunLoopMode, NSEventTrackingRunLoopMode, NSModalPanelRunLoopMode, nil]; + NSEnumerator *enumerator; + NSString *mode; + + enumerator = [modes objectEnumerator]; + while ((mode = [enumerator nextObject])) + [[NSRunLoop currentRunLoop] addPort:sendPort forMode:mode]; + + + [NSThread detachNewThreadSelector:@selector(launchThreadWithPort:) toTarget:sound withObject:sendPort]; + } +} + + +- (IBAction)pauseResume:(id)sender +{ +// DBLog(@"Pause/Resume Sent!"); + [self sendPortMessage:kCogPauseResumeMessage]; +} + +- (IBAction)pause:(id)sender +{ +// DBLog(@"Pause Sent!"); + [self sendPortMessage:kCogPauseMessage]; +} + +- (IBAction)resume:(id)sender +{ +// DBLog(@"Resume Sent!"); + + [self sendPortMessage:kCogResumeMessage]; +} + +- (IBAction)stop:(id)sender +{ +// DBLog(@"Stop Sent!"); + + waitingForPlay = NO; + [self sendPortMessage:kCogStopMessage]; +} + +//called by double-clicking on table +- (void)playEntryAtIndex:(int)i +{ + PlaylistEntry *pe = [[playlistController arrangedObjects] objectAtIndex:i]; + + [playlistController setCurrentEntry:pe addToHistory:YES]; + [playlistController reset]; + + [self playEntry:pe]; +} + + +- (void)playEntry:(PlaylistEntry *)pe; +{ + waitingForPlay = NO; + +// DBLog(@"PlayEntry: %@ Sent!", [pe filename]); + + [self sendPortMessage:kCogPlayFileMessage withString:[pe filename]]; +} + +- (IBAction)next:(id)sender +{ + waitingForPlay = NO; + if ([playlistController nextEntry] == nil) + return; + + [playlistController next]; + [self playEntry:[playlistController currentEntry]]; +} + +- (IBAction)prev:(id)sender +{ + waitingForPlay = NO; + if ([playlistController prevEntry] == nil) + return; + + [playlistController prev]; + [self playEntry:[playlistController currentEntry]]; +} + +- (IBAction)seek:(id)sender +{ +// DBLog(@"SEEKING?"); + double time; + time = [positionSlider doubleValue]; + [self sendPortMessage:kCogSeekMessage withData:&time ofSize:(sizeof(double))]; + + int sec = (int)(time/1000.0); + NSString *text; + text = [NSString stringWithFormat:@"%i:%02i", sec/60, sec%60]; + [timeField setStringValue:text]; +} + +- (void)sendPortMessage:(int)msgid +{ + NSPortMessage *portMessage = [[NSPortMessage alloc] initWithSendPort:distantPort receivePort:sendPort components:nil]; + + if (portMessage) + { + [portMessage setMsgid:msgid]; + [portMessage sendBeforeDate:[NSDate date]]; + [portMessage release]; + } +} + +- (void)sendPortMessage:(int)msgid withData:(void *)data ofSize:(int)size +{ + NSPortMessage *portMessage; + NSData *d = [[NSData alloc] initWithBytes:data length:size]; + NSArray *a = [[NSArray alloc] initWithObjects:d,nil]; + portMessage = [[NSPortMessage alloc] initWithSendPort:distantPort receivePort:sendPort components:a]; + + [a release]; + [d release]; + + if (portMessage) + { + NSDate *date = [[NSDate alloc] init]; + + [portMessage setMsgid:msgid]; + [portMessage sendBeforeDate:date]; + + [date release]; + [portMessage release]; + } + +} + +- (void)sendPortMessage:(int)msgid withString:(NSString *)s +{ + NSData *dataString = [s dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:NO]; + + NSPortMessage *portMessage = [[NSPortMessage alloc] initWithSendPort:distantPort receivePort:sendPort components:[NSArray arrayWithObject:dataString]]; + + if (portMessage) + { + [portMessage setMsgid:msgid]; + [portMessage sendBeforeDate:[NSDate date]]; + + [portMessage release]; + } +} + +- (void)handlePortMessage:(NSPortMessage *)portMessage +{ + + unsigned int message = [portMessage msgid]; +// DBLog(@"SOUNDCONTROLLER RECEIVED MESSAGE"); + if (message == kCogCheckinMessage) + { + // Get the worker threadÕs communications port. +// DBLog(@"CHECKIN RECEIVED"); + distantPort = [portMessage sendPort]; + + // Retain and save the worker port for later use. + [distantPort retain]; + } + else if (message == kCogRequestNextFileMessage) + { + PlaylistEntry *pe; + + pe = [playlistController nextEntry]; + + if (pe == nil) + { + [self sendPortMessage:kCogEndOfPlaylistMessage]; + } + else + { + DBLog(@"REQUESTING"); + waitingForPlay = YES; + + [self sendPortMessage:kCogChangeFileMessage withString:[pe filename]]; + } + } + else if (message == kCogFileChangedMessage) + { + DBLog(@"FILE CHANGED"); + if (waitingForPlay == YES) + { + waitingForPlay = NO; + [playlistController next]; + [timeField setStringValue:@"0:00"]; + } + } + else if (message == kCogBitrateUpdateMessage) + { + NSArray* components = [portMessage components]; + NSData *data = [components objectAtIndex:0]; + + int bitrate; + bitrate = (*(int *)[data bytes]); + // DBLog(@"Received length update: %f", max); +// [bitrateField setIntValue:bitrate]; + } + else if (message == kCogLengthUpdateMessage) + { + NSArray* components = [portMessage components]; + NSData *data = [components objectAtIndex:0]; + + double max; + max = (*(double *)[data bytes]); +// DBLog(@"Received length update: %f", max); + [positionSlider setMaxValue:max]; + [positionSlider setDoubleValue:0]; +// DBLog(@"Length changed: %f", max); +// [lengthField setDoubleValue:max/1000.0]; + } + else if (message = kCogPositionUpdateMessage) + { + NSArray* components = [portMessage components]; + NSData *data = [components objectAtIndex:0]; + + double pos; + pos = (*(double *)[data bytes]); + + if ([positionSlider tracking] == NO) + { + // DBLog(@"Received pos update: %f", pos); + [positionSlider setDoubleValue:pos]; + } + + int sec = (int)(pos/1000.0); + NSString *text; + text = [NSString stringWithFormat:@"%i:%02i", sec/60, sec%60]; + [timeField setStringValue:text]; + } +} + +@end diff --git a/SoundFile/AACFile.h b/SoundFile/AACFile.h new file mode 100644 index 000000000..8d52810ab --- /dev/null +++ b/SoundFile/AACFile.h @@ -0,0 +1,30 @@ +// +// AACFile.h +// Cog +// +// Created by Zaphod Beeblebrox on 5/31/05. +// Copyright 2005 __MyCompanyName__. All rights reserved. +// + +#import + +#import + +#import "SoundFile.h" + +#define INPUT_BUFFER_SIZE 1024*16 +#define SAMPLE_BUFFER_SIZE FAAD_MIN_STREAMSIZE*1024 + +@interface AACFile : SoundFile { + FILE *inFd; + NeAACDecHandle hAac; + NeAACDecFrameInfo hInfo; + + char buffer[SAMPLE_BUFFER_SIZE]; + int bufferAmount; + + char inputBuffer[INPUT_BUFFER_SIZE]; + int inputAmount; +} + +@end diff --git a/SoundFile/AACFile.m b/SoundFile/AACFile.m new file mode 100644 index 000000000..aa0b95985 --- /dev/null +++ b/SoundFile/AACFile.m @@ -0,0 +1,139 @@ +// +// AACFile.m +// Cog +// +// Created by Zaphod Beeblebrox on 5/31/05. +// Copyright 2005 __MyCompanyName__. All rights reserved. +// + +#import "AACFile.h" + + +@implementation AACFile + +- (BOOL)open:(const char *)filename +{ + unsigned long cap = NeAACDecGetCapabilities(); + //Check if decoder has the needed capabilities + + //Open the library + hAac = NeAACDecOpen(); + + //Get the current config + NeAACDecConfigurationPtr conf = NeAACDecGetCurrentConfiguration(hAac); + +// conf->useOldADTSFormat = 1; + DBLog(@"CONFIG: %i", conf->useOldADTSFormat); + //if needed, change some of the values in conf + conf->outputFormat = FAAD_FMT_32BIT; +// conf->downMatrix = 1; +// channels = 1; + bitsPerSample = 32; + + //set the new configuration + NeAACDecSetConfiguration(hAac, conf); + + inFd = fopen(filename, "r"); + if (!inFd) + return NO; + + inputAmount = fread(inputBuffer, 1, INPUT_BUFFER_SIZE, inFd); + + unsigned long samplerate; + unsigned char c; + //Initialize the library using one of the initalization functions + char err = NeAACDecInit(hAac, (unsigned char *)inputBuffer, inputAmount, &samplerate, &c); + if (err < 0) + { + //ERROR BLARG + DBLog(@"AAC ERRROR"); + return NO; + } + + inputAmount -= err; + memmove(inputBuffer, &inputBuffer[err], inputAmount); + + frequency = (int)samplerate; + channels = c; + + isBigEndian = YES; + + return YES; +} + +- (int)fillBuffer:(void *)buf ofSize:(UInt32)size +{ + int numread = bufferAmount; + int count = 0; + char *sampleBuffer; + +// DBLog(@"FILLING BUFFER : %i, %i", size, bufferAmount); +// DBLog(@"INPUT AMOUNT: %i/%i", inputAmount, INPUT_BUFFER_SIZE); + // DBLog(@"Fill buffer: %i", size); + //Fill from buffer, going by bufferAmount + //if still needs more, decode and repeat + if (bufferAmount == 0) + { + int n; + + /* returns the length of the samples*/ + if (inputAmount < INPUT_BUFFER_SIZE && !feof(inFd)) + { + n = fread(&inputBuffer[inputAmount], 1, INPUT_BUFFER_SIZE-inputAmount, inFd); + inputAmount += n; + } + + sampleBuffer = NeAACDecDecode(hAac, &hInfo, (unsigned char *)inputBuffer, inputAmount); + + if (hInfo.error == 0 && hInfo.samples > 0) + { + inputAmount -= hInfo.bytesconsumed; + memmove(inputBuffer, &inputBuffer[hInfo.bytesconsumed], inputAmount); + + //DO STUFF with decoded data + memcpy(buffer, sampleBuffer, hInfo.samples * (bitsPerSample/8)); + } + else if (hInfo.error != 0) + { + DBLog(@"FAAD2 Warning %s %i\n", NeAACDecGetErrorMessage(hInfo.error), hInfo.channels); + if (feof(inFd) && inputAmount == 0) + { + return 0; + } + } + else + { + inputAmount -= hInfo.bytesconsumed; + memmove(inputBuffer, &inputBuffer[hInfo.bytesconsumed], inputAmount); + } + + bufferAmount = hInfo.samples*(bitsPerSample/8); +// DBLog(@"REAL BUFFER AMOUNT: %i", bufferAmount); + } + + count = bufferAmount; + if (bufferAmount > size) + { + count = size; + } + + memcpy(buf, buffer, count); + + bufferAmount -= count; + + if (bufferAmount > 0) + memmove(buffer, &buffer[count], bufferAmount); + + if (count < size) + numread = [self fillBuffer:(&((char *)buf)[count]) ofSize:(size - count)]; + else + numread = 0; + + return count + numread; +} + +- (void)close +{ +} + +@end diff --git a/SoundFile/FlacFile.h b/SoundFile/FlacFile.h new file mode 100644 index 000000000..2e639cd48 --- /dev/null +++ b/SoundFile/FlacFile.h @@ -0,0 +1,28 @@ +// +// FlacFile.h +// zyVorbis +// +// Created by Vincent Spader on 1/25/05. +// Copyright 2005 __MyCompanyName__. All rights reserved. +// + +#import +#import "flac/all.h" +#import "SoundFile.h" + +#define SAMPLES_PER_WRITE 512 +#define FLAC__MAX_SUPPORTED_CHANNELS 2 +#define SAMPLE_BUFFER_SIZE ((FLAC__MAX_BLOCK_SIZE + SAMPLES_PER_WRITE) * FLAC__MAX_SUPPORTED_CHANNELS * (24/8)) + +@interface FlacFile : SoundFile { + FLAC__FileDecoder *decoder; + char buffer[SAMPLE_BUFFER_SIZE]; + int bufferAmount; +} + +- (FLAC__FileDecoder *)decoder; +- (char *)buffer; +- (int)bufferAmount; +- (void)setBufferAmount:(int)amount; + +@end diff --git a/SoundFile/FlacFile.m b/SoundFile/FlacFile.m new file mode 100644 index 000000000..4fb8606ec --- /dev/null +++ b/SoundFile/FlacFile.m @@ -0,0 +1,186 @@ +// +// FlacFile.m +// zyVorbis +// +// Created by Vincent Spader on 1/25/05. +// Copyright 2005 __MyCompanyName__. All rights reserved. +// + +#import "FlacFile.h" + + +@implementation FlacFile + +FLAC__StreamDecoderWriteStatus WriteProc(const FLAC__FileDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const sampleBuffer[], void *client_data) +{ +// DBLog(@"Write callback"); + FlacFile *flacFile = (FlacFile *)client_data; + unsigned wide_samples = frame->header.blocksize; + unsigned channels = frame->header.channels; + + UInt16 *buffer = (UInt16 *)[flacFile buffer]; + int i, j, c; + + for (i = j = 0; i < wide_samples; i++) + { + for (c = 0; c < channels; c++, j++) + { +// buffer[j] = CFSwapInt16LittleToHost(sampleBuffer[c][i]); + buffer[j] = sampleBuffer[c][i]; + } + } + +// memcpy([flacFile buffer], sampleBuffer, wide_samples*[flacFile bitsPerSample]/8); + [flacFile setBufferAmount:(wide_samples * channels*2)]; + + return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE; +} + +void MetadataProc(const FLAC__FileDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data) +{ + FlacFile *flacFile = (FlacFile *)client_data; + + flacFile->channels = metadata->data.stream_info.channels; + flacFile->frequency = metadata->data.stream_info.sample_rate; + flacFile->bitsPerSample = metadata->data.stream_info.bits_per_sample; + +// DBLog(@"METADATAAAA LENGTH: %i %i %f", (int)(metadata->data.stream_info.total_samples),[flacFile frequency], (float)(metadata->data.stream_info.total_samples)/[flacFile frequency]); + flacFile->totalSize = metadata->data.stream_info.total_samples*metadata->data.stream_info.channels*metadata->data.stream_info.bits_per_sample/8; +} + +void ErrorProc(const FLAC__FileDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data) +{ + DBLog(@"Error callback"); +} + +- (BOOL)open:(const char *)filename +{ + FLAC__bool status; + + decoder = FLAC__file_decoder_new(); + if (decoder == NULL) + return NO; + + status = FLAC__file_decoder_set_filename(decoder, filename); + if (status == false) + return NO; + + status = FLAC__file_decoder_set_write_callback(decoder, WriteProc); + if (status == false) + return NO; + + status = FLAC__file_decoder_set_metadata_callback(decoder, MetadataProc); + if (status == false) + return NO; + + status = FLAC__file_decoder_set_error_callback(decoder, ErrorProc); + if (status == false) + return NO; + + status = FLAC__file_decoder_set_client_data(decoder, self); + if (status == false) + return NO; + + if (FLAC__file_decoder_init(decoder) != FLAC__FILE_DECODER_OK) + return NO; + + FLAC__file_decoder_process_until_end_of_metadata(decoder); + + isBigEndian = YES; + + return YES; +} + +- (BOOL)readInfo:(const char *)filename +{ + FLAC__StreamMetadata streamInfo; + + FLAC__metadata_get_streaminfo(filename, &streamInfo); + + channels = streamInfo.data.stream_info.channels; + frequency = streamInfo.data.stream_info.sample_rate; + bitsPerSample = streamInfo.data.stream_info.bits_per_sample; + + totalSize = streamInfo.data.stream_info.total_samples*channels*(bitsPerSample/8); + bitRate = 0; + + return YES; +} + +- (int)fillBuffer:(void *)buf ofSize:(UInt32)size +{ + int count; + int numread; + + if (bufferAmount == 0) + { + int i; + if (FLAC__file_decoder_get_state (decoder) == FLAC__FILE_DECODER_END_OF_FILE) + { + return 0; + } + + i = FLAC__file_decoder_process_single(decoder);// != FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE); + //return 0; +// [self writeSamplesToBuffer:buffer fromBuffer:sampleBuffer ofSize:(status*2)]; +// write callback sets bufferAmount...frickin weird, also sets sampleBuffer +// bufferAmount = status*4; + } + + count = bufferAmount; + if (bufferAmount > size) + { + count = size; + } + memcpy(buf, buffer, count); + + bufferAmount -= count; + + if (bufferAmount > 0) + memmove(buffer, &buffer[count], bufferAmount); + + if (count < size) + numread = [self fillBuffer:(&((char *)buf)[count]) ofSize:(size - count)]; + else + numread = 0; + + return count + numread; + +} + +- (void)close +{ + if (decoder) + { + FLAC__file_decoder_finish(decoder); + FLAC__file_decoder_delete(decoder); + } + decoder = NULL; + +} + +- (void)seekToTime:(double)milliseconds +{ + FLAC__file_decoder_seek_absolute(decoder, frequency * ((double)milliseconds/1000.0)); +} + +//bs methods +- (char *)buffer +{ + return buffer; +} +- (int)bufferAmount +{ + return bufferAmount; +} +- (void)setBufferAmount:(int)amount +{ + bufferAmount = amount; +} + +- (FLAC__FileDecoder *)decoder +{ + return decoder; +} + +@end diff --git a/SoundFile/MPEGFile.h b/SoundFile/MPEGFile.h new file mode 100644 index 000000000..edb8afb46 --- /dev/null +++ b/SoundFile/MPEGFile.h @@ -0,0 +1,18 @@ +// +// MPEGFile.h +// zyVorbis +// +// Created by Vincent Spader on 1/30/05. +// Copyright 2005 __MyCompanyName__. All rights reserved. +// + +#import +#import "SoundFile.h" + +#include "DecMPA/decmpa.h" + +@interface MPEGFile : SoundFile { + void *decoder; +} + +@end diff --git a/SoundFile/MPEGFile.m b/SoundFile/MPEGFile.m new file mode 100644 index 000000000..05e2f4d91 --- /dev/null +++ b/SoundFile/MPEGFile.m @@ -0,0 +1,107 @@ +// +// MPEGFile.m +// zyVorbis +// +// Created by Vincent Spader on 1/30/05. +// Copyright 2005 __MyCompanyName__. All rights reserved. +// + +#import "MPEGFile.h" + + +@implementation MPEGFile + +- (BOOL)open:(const char *)filename +{ + int err; + +// DBLog(@"Opening: %s!!!!", filename); + + err = DecMPA_CreateUsingFile(&decoder, filename, DECMPA_VERSION); + if (err != DECMPA_OK) + return NO; + + DecMPA_SetParam(decoder, DECMPA_PARAM_OUTPUT, DECMPA_OUTPUT_INT16); + + long n; + DecMPA_DecodeNoData(decoder, &n); +// DBLog(@"Woot: %i", n); + DecMPA_OutputFormat outputFormat; + err = DecMPA_GetOutputFormat(decoder, &outputFormat); + if (err != DECMPA_OK) + return NO; + + frequency = outputFormat.nFrequency; + channels = outputFormat.nChannels; + bitsPerSample = 16; + + isBigEndian = YES; + + long duration; + DecMPA_GetDuration(decoder, &duration); + totalSize = (long int)(duration*(double)frequency/1000.0*channels*bitsPerSample/8); + + DecMPA_MPEGHeader mpegHeader; + DecMPA_GetMPEGHeader(decoder, &mpegHeader); +// int totalRate = mpegHeader.nBitRateKbps; +// int num = 0; +/* + while (DecMPA_DecodeNoData(decoder, &n) == DECMPA_OK) + { + DecMPA_GetMPEGHeader(decoder, &mpegHeader); + totalRate += mpegHeader.nBitRateKbps; + DBLog(@"%i %i %i", num, mpegHeader.nBitRateIndex, mpegHeader.nBitRateKbps); + num++; + } + err = DecMPA_GetMPEGHeader(decoder, &mpegHeader); +*/ + bitRate = mpegHeader.nBitRateKbps; +// DBLog(@"Bitrate? %i", mpegHeader.); +// DBLog(@"Mpeg file opened."); + err = DecMPA_SeekToTime(decoder, 0); + if (err != DECMPA_OK) + return NO; + return YES; +} + +- (BOOL)readInfo:(const char *)filename +{ + return [self open:filename]; //does the same damn thing +} + +- (int)fillBuffer:(void *)buf ofSize:(UInt32)size +{ + long numread; + long total = 0; + + DecMPA_Decode(decoder, &((char *)buf)[total], size - total, &numread); + while (total != size && numread > 0) + { + total += numread; + + DecMPA_Decode(decoder, &((char *)buf)[total], size - total, &numread); + } + +/* int n; + for (n = 0; n < total/2; n++) + { + ((UInt16 *)buf)[n] = CFSwapInt16LittleToHost(((UInt16 *)buf)[n]); + } +*/ + currentPosition += total; + return total; +} + +- (void)close +{ + if (decoder) + DecMPA_Destroy(decoder); + decoder = NULL; +} + +- (void)seekToTime:(double)milliseconds +{ + DecMPA_SeekToTime(decoder, (unsigned long)milliseconds); +} + +@end diff --git a/SoundFile/MonkeysFile.h b/SoundFile/MonkeysFile.h new file mode 100644 index 000000000..3e3641dd8 --- /dev/null +++ b/SoundFile/MonkeysFile.h @@ -0,0 +1,19 @@ +// +// MonkeysFile.h +// zyVorbis +// +// Created by Vincent Spader on 1/30/05. +// Copyright 2005 __MyCompanyName__. All rights reserved. +// + +#import +#import +#import + +#import "SoundFile.h" + +@interface MonkeysFile : SoundFile { + IAPEDecompress * decompress; +} + +@end diff --git a/SoundFile/MonkeysFile.m b/SoundFile/MonkeysFile.m new file mode 100644 index 000000000..110d11252 --- /dev/null +++ b/SoundFile/MonkeysFile.m @@ -0,0 +1,86 @@ +// +// MonkeysFile.m +// zyVorbis +// +// Created by Vincent Spader on 1/30/05. +// Copyright 2005 __MyCompanyName__. All rights reserved. +// + +#import "MonkeysFile.h" +#import "MAC/ApeInfo.h" + +@implementation MonkeysFile + +- (BOOL)open:(const char *)filename +{ + int n; + + decompress = CreateIAPEDecompress(filename, &n); + + if (decompress == NULL) + { + DBLog(@"ERROR OPENING FILE"); + return NO; + } + + frequency = decompress->GetInfo(APE_INFO_SAMPLE_RATE); + bitsPerSample = decompress->GetInfo(APE_INFO_BITS_PER_SAMPLE); + channels = decompress->GetInfo(APE_INFO_CHANNELS); + + totalSize = decompress->GetInfo(APE_INFO_TOTAL_BLOCKS)*bitsPerSample/8*channels; + DBLog(@"APE OPENED: %i %i %i %i", frequency, bitsPerSample, channels, totalSize); + return YES; +} + +- (BOOL)readInfo:(const char *)filename +{ + int err; + CAPEInfo apeInfo(&err, filename, NULL); + + frequency = apeInfo.GetInfo(APE_INFO_SAMPLE_RATE); + bitsPerSample = apeInfo.GetInfo(APE_INFO_BITS_PER_SAMPLE); + channels = apeInfo.GetInfo(APE_INFO_CHANNELS); + + totalSize = apeInfo.GetInfo(APE_INFO_TOTAL_BLOCKS)*bitsPerSample/8*channels; + bitRate = apeInfo.GetInfo(APE_INFO_AVERAGE_BITRATE); + + DBLog(@"INFO READ: %i %i %i %i", frequency, bitsPerSample, channels, totalSize); + + return YES; +} + +- (int)fillBuffer:(void *)buf ofSize:(UInt32)size +{ + int n; + int numread; + int blockAlign = decompress->GetInfo(APE_INFO_BLOCK_ALIGN); + n = decompress->GetData((char *)buf, size/blockAlign, &numread); + if (n != ERROR_SUCCESS) + { + DBLog(@"ERROR: %i", n); + return 0; + } + numread *= blockAlign; +// DBLog(@"READ DATA: %i", numread); + +// DBLog(@"NUMREAD: %i", numread); + return numread; +} + +- (void)close +{ +// DBLog(@"CLOSE"); + if (decompress) + delete decompress; + + decompress = NULL; +} + +- (void)seekToTime:(double)milliseconds +{ + int r; +// DBLog(@"HELLO: %i", int(frequency*((double)milliseconds/1000.0))); + r = decompress->Seek(int(frequency*((double)milliseconds/1000.0))); +} + +@end diff --git a/SoundFile/MusepackFile.h b/SoundFile/MusepackFile.h new file mode 100644 index 000000000..aac651cd1 --- /dev/null +++ b/SoundFile/MusepackFile.h @@ -0,0 +1,30 @@ +// +// MusepackFile.h +// zyVorbis +// +// Created by Vincent Spader on 1/23/05. +// Copyright 2005 __MyCompanyName__. All rights reserved. +// + +#import +#import +#import "SoundFile.h" + + +@interface MusepackFile : SoundFile { + FILE *inFd; + mpc_decoder decoder; + mpc_reader_file reader; + mpc_streaminfo info; + +// int undecodedSize; + + char buffer[MPC_FRAME_LENGTH*4]; + int bufferAmount; +} +- (BOOL)writeSamplesToBuffer:(uint16_t *)sample_buffer fromBuffer:(const MPC_SAMPLE_FORMAT *)p_buffer ofSize:(unsigned)p_size; + +//- (FILE *)inFd; +//- (int)undecodedSize; + +@end diff --git a/SoundFile/MusepackFile.m b/SoundFile/MusepackFile.m new file mode 100644 index 000000000..438fc0d8e --- /dev/null +++ b/SoundFile/MusepackFile.m @@ -0,0 +1,210 @@ +// +// MusepackFile.m +// zyVorbis +// +// Created by Vincent Spader on 1/23/05. +// Copyright 2005 __MyCompanyName__. All rights reserved. +// + +#import "MusepackFile.h" + +@implementation MusepackFile + +//callbacks +/* +mpc_int32_t ReadProc(void *data, void *ptr, mpc_int32_t size) +{ + DBLog(@"Reading: %i", size); + MusepackFile *f = (MusepackFile *) data; + + return fread(ptr, 1, size, [f inFd]); +} + +BOOL SeekProc(void *data, mpc_int32_t offset) +{ + MusepackFile *f = (MusepackFile *) data; +// DBLog(@"Seeking: %i %i", offset, f->reader.is_seekable); + + return !fseek([f inFd], offset, SEEK_SET); +} + +mpc_int32_t TellProc(void *data) +{ + DBLog(@"Tell"); + MusepackFile *f = (MusepackFile *) data; + return ftell([f inFd]); +} + +mpc_int32_t GetSizeProc(void *data) +{ + DBLog(@"Size"); + + MusepackFile *f = (MusepackFile *) data; + return [f undecodedSize]; +} + +BOOL CanSeekProc(void *data) +{ + DBLog(@"Can seek"); + + MusepackFile *f = (MusepackFile *) data; + return YES; +} +*/ +//real ish +- (BOOL)open:(const char *)filename +{ + [self readInfo:filename]; + + /* instantiate a decoder with our file reader */ + mpc_decoder_setup(&decoder, &reader); + if (!mpc_decoder_initialize(&decoder, &info)) + { + DBLog(@"Error initializing decoder."); + return NO; + } +// DBLog(@"Ok to go..."); + + isBigEndian = YES; + + return YES; +} + +- (BOOL)readInfo:(const char *)filename +{ + inFd = fopen(filename, "rb"); + if (inFd == 0) + return NO; + + mpc_reader_setup_file_reader(&reader , inFd); + + mpc_streaminfo_init(&info); + if (mpc_streaminfo_read(&info, &reader) != ERROR_CODE_OK) + { + DBLog(@"Not a valid musepack file."); + return NO; + } + + bitRate = (int)(info.average_bitrate/1000.0); + frequency = info.sample_freq; + bitsPerSample = 16; + channels = 2; + + totalSize = mpc_streaminfo_get_length_samples(&info)*channels*bitsPerSample/8; + + return YES; +} + +- (BOOL)writeSamplesToBuffer:(uint16_t *)sample_buffer fromBuffer:(const MPC_SAMPLE_FORMAT *)p_buffer ofSize:(unsigned)p_size +{ + unsigned n; + int m_bps = 16; + int clip_min = - 1 << (m_bps - 1), + clip_max = (1 << (m_bps - 1)) - 1, + float_scale = 1 << (m_bps - 1); + + for (n = 0; n < p_size; n++) + { + int val; +#ifdef MPC_FIXED_POINT + val = shift_signed( p_buffer[n], m_bps - MPC_FIXED_POINT_SCALE_SHIFT ); +#else + val = (int)( p_buffer[n] * float_scale ); +#endif + + if (val < clip_min) + val = clip_min; + else if (val > clip_max) + val = clip_max; + +// sample_buffer[n] = CFSwapInt16LittleToHost(val); + sample_buffer[n] = val; + } + +// DBLog(@"Samples written."); +// m_data_bytes_written += p_size * (m_bps >> 3); + return YES; +} + +- (int)fillBuffer:(void *)buf ofSize:(UInt32)size +{ + int numread = bufferAmount; + int count = 0; + MPC_SAMPLE_FORMAT sampleBuffer[MPC_DECODER_BUFFER_LENGTH]; +// DBLog(@"Fill buffer: %i", size); + //Fill from buffer, going by bufferAmount + //if still needs more, decode and repeat + if (bufferAmount == 0) + { + /* returns the length of the samples*/ + + unsigned status = mpc_decoder_decode(&decoder, sampleBuffer, 0, 0); + if (status == (unsigned)( -1)) + { + //decode error + DBLog(@"Decode error"); + return 0; + } + else if (status == 0) //EOF + { +// DBLog(@"AHHHHHH EOF"); + return 0; + } + else //status>0 /* status == MPC_FRAME_LENGTH */ + { + [self writeSamplesToBuffer:((uint16_t*)buffer) fromBuffer:sampleBuffer ofSize:(status*2)]; + } + + bufferAmount = status*4; + } + + count = bufferAmount; + if (bufferAmount > size) + { + count = size; + } + + memcpy(buf, buffer, count); + + bufferAmount -= count; + + if (bufferAmount > 0) + memmove(buffer, &buffer[count], bufferAmount); + + if (count < size) + numread = [self fillBuffer:(&((char *)buf)[count]) ofSize:(size - count)]; + else + numread = 0; + + return count + numread; +} + +- (void)close +{ + fclose(inFd); +} + +- (void)seekToTime:(double)milliseconds +{ + BOOL r; +// double n = milliseconds; +// DBLog(@"Milliseconds: %f", n); +// DBLog(@"SEEKING TO: %f", (double)milliseconds/1000.0); + + r = mpc_decoder_seek_sample(&decoder, frequency*((double)milliseconds/1000.0)); +// DBLog(@"SEEK RESULT: %i", r); +} + +//accessors +/* +- (FILE *)inFd +{ + return inFd; +} + +- (int)undecodedSize +{ + return undecodedSize; +} +*/ +@end diff --git a/SoundFile/SoundFile.h b/SoundFile/SoundFile.h new file mode 100644 index 000000000..a4c0a5454 --- /dev/null +++ b/SoundFile/SoundFile.h @@ -0,0 +1,58 @@ +// +// SoundFile.h +// Cog +// +// Created by Vincent Spader on 1/15/05. +// Copyright 2005 __MyCompanyName__. All rights reserved. +// + +#import + +#import +#import +#import + +#import "DBLog.h" + +@interface SoundFile : NSObject { + UInt16 bitsPerSample; + UInt16 channels; + UInt32 frequency; + UInt32 bitRate; + BOOL isBigEndian; + BOOL isUnsigned; + + unsigned long totalSize; + unsigned long currentPosition; +} + +- (unsigned long)totalSize; +- (unsigned long)currentPosition; + +- (double)length; + +- (int)bitRate; + ++ (SoundFile *)soundFileFromFilename:(NSString *)filename; //PRIVATE ++ (SoundFile *)open:(NSString *)filename; ++ (SoundFile *)readInfo:(NSString *)filename; + +- (BOOL)open:(const char *)filename; +- (void)getFormat:(AudioStreamBasicDescription *)sourceStreamFormat; + +- (BOOL)readInfo:(const char *)filename; //for getting information + +- (UInt32)fillBuffer:(void *)buf ofSize:(UInt32)size; + +- (void)seek:(unsigned long)position; +- (void)seekToTime:(double)milliseconds; +- (void)close; +- (void)reset; //START AGAIN + +- (UInt16)channels; +- (UInt16)bitsPerSample; +- (UInt32)frequency; +-(BOOL)isBigEndian; +-(BOOL)isUnsigned; + +@end diff --git a/SoundFile/SoundFile.m b/SoundFile/SoundFile.m new file mode 100644 index 000000000..83e9e2edd --- /dev/null +++ b/SoundFile/SoundFile.m @@ -0,0 +1,205 @@ +// +// SoundFile.m +// Cog +// +// Created by Vincent Spader on 1/15/05. +// Copyright 2005 __MyCompanyName__. All rights reserved. +// + +#import "SoundFile.h" + + +@implementation SoundFile + +- (void)seek:(unsigned long)position +{ + unsigned long time; + unsigned long frame; + + frame = position/channels/(bitsPerSample/8); + time = (unsigned long)(((double)frame/(frequency/1000.0))); + + currentPosition = position; + + [self seekToTime:time]; +} + +- (double)length +{ + return (totalSize/channels/(bitsPerSample/8)/(frequency/1000.0)); +} + +- (int)bitRate +{ + return bitRate; +} + +//this should be done by the soundfile....not seek... +- (void)seekToTime:(double)milliseconds +{ +} + + + +@class FlacFile; +@class MonkeysFile; +@class MPEGFile; +@class MusepackFile; +@class VorbisFile; +@class WaveFile; +@class AACFile; + ++ (SoundFile *)soundFileFromFilename:(NSString *)filename +{ + SoundFile *soundFile; + + if ([[filename pathExtension] isEqualToString:@"wav"] || [[filename pathExtension] isEqualToString:@"aiff"]) + { + soundFile = [[WaveFile alloc] init]; + } + else if ([[filename pathExtension] isEqualToString:@"ogg"]) + { + soundFile = [[VorbisFile alloc] init]; + } + else if ([[filename pathExtension] isEqualToString:@"mpc"]) + { + soundFile = [[MusepackFile alloc] init]; + } + else if ([[filename pathExtension] isEqualToString:@"flac"]) + { + soundFile = [[FlacFile alloc] init]; + } + else if ([[filename pathExtension] isEqualToString:@"ape"]) + { + soundFile = [[MonkeysFile alloc] init]; + } + else if ([[filename pathExtension] isEqualToString:@"mp3"]) + { + soundFile = [[MPEGFile alloc] init]; + } + else if ([[filename pathExtension] isEqualToString:@"aac"]) + { + soundFile = [[AACFile alloc] init]; + } + else + { + soundFile = nil; + } + + return soundFile; +} + ++ (SoundFile *)open:(NSString *)filename +{ + SoundFile *soundFile; + BOOL b; + + soundFile = [SoundFile soundFileFromFilename:filename]; + + b = [soundFile open:[filename UTF8String]]; + if (b == YES) + return soundFile; + + return nil; +} + ++ (SoundFile *)readInfo:(NSString *)filename +{ + BOOL b; + SoundFile *soundFile; + + soundFile = [SoundFile soundFileFromFilename:filename]; + + b = [soundFile readInfo:[filename UTF8String]]; + if (b == YES) + return soundFile; + + return nil; +} + +- (void)reset +{ + [self seek:0]; +} + +- (void)getFormat:(AudioStreamBasicDescription *)sourceStreamFormat +{ +// NSLog(@"Getting format!"); + sourceStreamFormat->mFormatID = kAudioFormatLinearPCM; + sourceStreamFormat->mFormatFlags = 0; + + sourceStreamFormat->mSampleRate = frequency; + + sourceStreamFormat->mBitsPerChannel = bitsPerSample; + + sourceStreamFormat->mBytesPerFrame = (bitsPerSample/8)*channels; + sourceStreamFormat->mChannelsPerFrame = channels; + + sourceStreamFormat->mFramesPerPacket = 1; + sourceStreamFormat->mBytesPerPacket = (bitsPerSample/8)*channels; + sourceStreamFormat->mReserved = 0; + + if (isBigEndian == YES) + { + sourceStreamFormat->mFormatFlags |= kLinearPCMFormatFlagIsBigEndian; +// NSLog(@"FUCKER IS BIG ENDIAN"); + } + if (isUnsigned == NO) + sourceStreamFormat->mFormatFlags |= kLinearPCMFormatFlagIsSignedInteger; +} + +- (void)close +{ +} + +- (UInt32)fillBuffer:(void *)buf ofSize:(UInt32)size +{ + return 0; +} + +- (BOOL)open:(const char *)filename +{ +// NSLog(@"WRONG OPEN!!!"); + return NO; +} + +- (BOOL)readInfo:(const char *)filename +{ + return NO; +} + +- (unsigned long)currentPosition +{ + return currentPosition; +} + +- (unsigned long)totalSize +{ + return totalSize; +} + +- (UInt16)channels +{ + return channels; +} + +- (UInt16)bitsPerSample +{ + return bitsPerSample; +} + +- (UInt32)frequency +{ + return frequency; +} + +-(BOOL)isBigEndian +{ + return isBigEndian; +} +-(BOOL)isUnsigned +{ + return isUnsigned; +} + +@end diff --git a/SoundFile/VorbisFile.h b/SoundFile/VorbisFile.h new file mode 100644 index 000000000..32cd9a841 --- /dev/null +++ b/SoundFile/VorbisFile.h @@ -0,0 +1,20 @@ +// +// VorbisFile.h +// zyVorbis +// +// Created by Vincent Spader on 1/22/05. +// Copyright 2005 __MyCompanyName__. All rights reserved. +// + +#import +#import "SoundFile.h" +#import +#import + +@interface VorbisFile : SoundFile { + FILE *inFd; + OggVorbis_File vorbisRef; + int currentSection; +} +- (BOOL)readInfo; +@end diff --git a/SoundFile/VorbisFile.m b/SoundFile/VorbisFile.m new file mode 100644 index 000000000..f77fa74e8 --- /dev/null +++ b/SoundFile/VorbisFile.m @@ -0,0 +1,77 @@ +// +// VorbisFile.m +// zyVorbis +// +// Created by Vincent Spader on 1/22/05. +// Copyright 2005 __MyCompanyName__. All rights reserved. +// + +#import "VorbisFile.h" + + +@implementation VorbisFile + +- (BOOL)open:(const char *)filename +{ + inFd = fopen(filename, "rb"); + if (inFd == 0) + return NO; + + if (ov_open(inFd, &vorbisRef, NULL, 0) != 0) + return NO; + + return [self readInfo]; +} + +- (BOOL)readInfo +{ + vorbis_info *vi; + + vi = ov_info(&vorbisRef, -1); + bitRate = (int)(vi->bitrate_nominal/1000.0); + channels = vi->channels; + bitsPerSample = vi->channels * 8; + frequency = vi->rate; + + totalSize = ov_pcm_total(&vorbisRef, -1) * channels * bitsPerSample/8; + +// DBLog(@"Ok to go WITH OGG."); + + return YES; +} + +- (BOOL)readInfo:(const char *)filename +{ + return [self open:filename]; //automatically invokes readInfo +} + +- (int)fillBuffer:(void *)buf ofSize:(UInt32)size +{ + int numread; + int total = 0; + + numread = ov_read(&vorbisRef, &((char *)buf)[total], size - total, 0, bitsPerSample/8, 1, ¤tSection); + while (total != size && numread > 0) + { + total += numread; + + numread = ov_read(&vorbisRef, &((char *)buf)[total], size - total, 0, bitsPerSample/8, 1, ¤tSection); + } + + currentPosition += total; + + return total; +} + +- (void)close +{ + ov_clear(&vorbisRef); +} + +- (void)seekToTime:(double)milliseconds +{ + ov_time_seek(&vorbisRef, (double)milliseconds/1000.0); +} + + +@end diff --git a/SoundFile/WaveFile.h b/SoundFile/WaveFile.h new file mode 100644 index 000000000..cce7be372 --- /dev/null +++ b/SoundFile/WaveFile.h @@ -0,0 +1,20 @@ +// +// WaveFile.h +// zyVorbis +// +// Created by Vincent Spader on 1/31/05. +// Copyright 2005 __MyCompanyName__. All rights reserved. +// + +#import +#import "SndFile/sndfile.h" +#import "SoundFile.h" + +@interface WaveFile : SoundFile { + SNDFILE *sndFile; + SF_INFO info; +} + +- (BOOL)readInfo; + +@end diff --git a/SoundFile/WaveFile.m b/SoundFile/WaveFile.m new file mode 100644 index 000000000..f21f892c8 --- /dev/null +++ b/SoundFile/WaveFile.m @@ -0,0 +1,121 @@ +// +// WaveFile.m +// zyVorbis +// +// Created by Vincent Spader on 1/31/05. +// Copyright 2005 __MyCompanyName__. All rights reserved. +// + +#import "WaveFile.h" + +@implementation WaveFile + +- (BOOL)open:(const char *)filename +{ + sndFile = sf_open(filename, SFM_READ, &info); + + if (sndFile == NULL) + return NO; + + return [self readInfo]; +} + +- (BOOL)readInfo +{ + bitRate = 0; + frequency = info.samplerate; + channels = info.channels; + isUnsigned = NO; + + switch (info.format & SF_FORMAT_ENDMASK) + { + case SF_ENDIAN_FILE: + if (((info.format & SF_FORMAT_TYPEMASK) == SF_FORMAT_AIFF) || ((info.format & SF_FORMAT_TYPEMASK) == SF_FORMAT_AU)) + isBigEndian = YES; + else + isBigEndian = NO; + + break; + case SF_ENDIAN_CPU: + isBigEndian = YES; +// DBLog(@"&CPU ENDIAN"); + break; + case SF_ENDIAN_LITTLE: + isBigEndian = NO; +// DBLog(@"&LITTLE INDIAN"); + break; + case SF_ENDIAN_BIG: + isBigEndian = YES; +// DBLog(@"&BIG ENDIAN"); + break; + default: + isBigEndian = NO; +// DBLog(@"&WHAT THE FUCK IS GOING ON?!!!!"); + } + + switch (info.format & SF_FORMAT_SUBMASK) + { + case SF_FORMAT_PCM_S8: + bitsPerSample = 8; + break; + case SF_FORMAT_PCM_16: + bitsPerSample = 16; + break; + case SF_FORMAT_PCM_24: + bitsPerSample = 24; + break; + case SF_FORMAT_PCM_32: + bitsPerSample = 32; + break; + case SF_FORMAT_PCM_U8: + isUnsigned = YES; + bitsPerSample = 8; + break; + default: + DBLog(@"BITS PER SAMPLE NOT DEFINED"); + return NO; + } + + totalSize = info.frames*channels*bitsPerSample/8; + + return YES; +} + +- (BOOL)readInfo:(const char *)filename +{ + return [self open:filename]; +} + +- (int)fillBuffer:(void *)buf ofSize:(UInt32)size +{ + int numread; + + numread = sf_read_raw(sndFile, buf, size); +/* + if (isBigEndian == YES) + { + int n; + for (n = 0; n < numread/2; n++) + { + ((UInt16 *)buf)[n] = CFSwapInt16LittleToHost(((UInt16 *)buf)[n]); + } + } +*/ + currentPosition += numread; + + return numread; +} + +- (void)close +{ + if (sndFile) + sf_close(sndFile); + sndFile = NULL; +} + +- (void)seekToTime:(double)milliseconds +{ + sf_seek(sndFile, frequency*((double)milliseconds/1000.0), SEEK_SET); +} + +@end diff --git a/TrackingCell.h b/TrackingCell.h new file mode 100644 index 000000000..d385c21c0 --- /dev/null +++ b/TrackingCell.h @@ -0,0 +1,14 @@ +/* TrackingCell */ + +#import + +@interface TrackingCell : NSSliderCell +{ + BOOL tracking; +} + +- (BOOL)startTrackingAt:(NSPoint)startPoint inView:(NSView *)controlView; +- (void)stopTracking:(NSPoint)lastPoint at:(NSPoint)stopPoint inView:(NSView *)controlView mouseIsUp:(BOOL)flags; +- (BOOL)tracking; + +@end diff --git a/TrackingCell.m b/TrackingCell.m new file mode 100644 index 000000000..265789fe7 --- /dev/null +++ b/TrackingCell.m @@ -0,0 +1,27 @@ +#import "TrackingCell.h" + +@implementation TrackingCell + +- (BOOL)startTrackingAt:(NSPoint)startPoint inView:(NSView *)controlView +{ +// DBLog(@"TRACKING"); + tracking = YES; + return [super startTrackingAt:startPoint inView:controlView]; + +} + +- (void)stopTracking:(NSPoint)lastPoint at:(NSPoint)stopPoint inView:(NSView *)controlView mouseIsUp:(BOOL)flag +{ +// DBLog(@"NOT TRACKING"); + tracking = NO; + + [super stopTracking:lastPoint at:stopPoint inView:controlView mouseIsUp:flag]; +} + +- (BOOL)tracking +{ + return tracking; +} + + +@end diff --git a/TrackingSlider.h b/TrackingSlider.h new file mode 100644 index 000000000..54087843e --- /dev/null +++ b/TrackingSlider.h @@ -0,0 +1,10 @@ +/* TrackingSlider */ + +#import + +@interface TrackingSlider : NSSlider +{ +} +-(BOOL)tracking; + +@end diff --git a/TrackingSlider.m b/TrackingSlider.m new file mode 100644 index 000000000..5427be3dc --- /dev/null +++ b/TrackingSlider.m @@ -0,0 +1,38 @@ +#import "TrackingSlider.h" +#import "TrackingCell.h" + +@implementation TrackingSlider + +- (id)initWithCoder:(NSCoder *)decoder +{ + self = [super initWithCoder:decoder]; + if (self) + { + if (![[self cell] isKindOfClass:[TrackingCell class]]) + { + TrackingCell *trackingCell; + trackingCell = [[TrackingCell alloc] init]; + + [trackingCell setAction:[[self cell] action]]; + [trackingCell setContinuous:[[self cell] isContinuous]]; + [trackingCell setTarget:[[self cell] target]]; + [self setCell:trackingCell]; + + [trackingCell release]; + } + } + + return self; +} + ++ (Class) cellClass +{ + return [TrackingCell class]; +} + +-(BOOL)tracking +{ + return [[self cell] tracking]; +} + +@end diff --git a/Updates/MacPADSocket.h b/Updates/MacPADSocket.h new file mode 100644 index 000000000..2ad0e4bbc --- /dev/null +++ b/Updates/MacPADSocket.h @@ -0,0 +1,71 @@ +// +// MacPADSocket.h +// MacPAD Version Check +// +// Created by Kevin Ballard on Sun Dec 07 2003. +// Copyright (c) 2003-2004 TildeSoft. All rights reserved. +// + +#import + +// Result codes +typedef enum MacPADResultCode { + kMacPADResultNoNewVersion = 0, // No new version available. Not an error + kMacPADResultMissingValues, // One or both arguments to performCheck: were nil + kMacPADResultInvalidURL, // URL was invalid or could not be contacted + kMacPADResultInvalidFile, // XML file was missing or not well-formed + kMacPADResultBadSyntax, // Version info was missing from XML file + kMacPADResultNewVersion // New version is available. Not an error +} MacPADResultCode; + +@interface MacPADSocket : NSObject { +@private + NSFileHandle *_fileHandle; + NSURL *_fileURL; + NSString *_currentVersion; + NSString *_newVersion; + NSString *_releaseNotes; + NSString *_productPageURL; + NSMutableString *_buffer; + NSArray *_productDownloadURLs; + int _contentLength; + BOOL _headersReceived; + BOOL _statusReceived; + id _delegate; +} +// Public methods +- (void)performCheck:(NSURL *)url withVersion:(NSString *)version; +- (void)performCheckWithVersion:(NSString *)version; +- (void)performCheckWithURL:(NSURL *)url; +- (void)performCheck; +- (void)setDelegate:(id)delegate; +- (NSString *)newVersion; +- (NSString *)releaseNotes; +- (NSString *)productPageURL; +- (NSString *)productDownloadURL; +- (NSArray *)productDownloadURLs; + +// Private methods +- (void)initiateCheck:(id)sender; +- (void)returnError:(MacPADResultCode)code message:(NSString *)msg; +- (void)returnSuccess:(NSDictionary *)userInfo; +- (void)returnFailure:(NSDictionary *)userInfo; +- (void)processDictionary:(NSDictionary *)dict; +- (NSComparisonResult)compareVersion:(NSString *)versionA toVersion:(NSString *)versionB; +- (NSArray *)splitVersion:(NSString *)version; +- (int)getCharType:(NSString *)character; +@end + +// Constant strings +extern NSString *MacPADErrorCode; +extern NSString *MacPADErrorMessage; +extern NSString *MacPADNewVersionAvailable; + +// NSNotifications +extern NSString *MacPADErrorOccurredNotification; // @"MacPADErrorCode", @"MacPADErrorMessage" +extern NSString *MacPADCheckFinishedNotification; // @"MacPADNewVersionAvailable" + +@interface NSObject(MacPADSocketNotifications) +- (void)macPADErrorOccurred:(NSNotification *)aNotification; +- (void)macPADCheckFinished:(NSNotification *)aNotification; +@end \ No newline at end of file diff --git a/Updates/MacPADSocket.m b/Updates/MacPADSocket.m new file mode 100644 index 000000000..736ab02d1 --- /dev/null +++ b/Updates/MacPADSocket.m @@ -0,0 +1,399 @@ +// +// MacPADSocket.m +// MacPAD Version Check +// +// Created by Kevin Ballard on Sun Dec 07 2003. +// Copyright (c) 2003-2004 TildeSoft. All rights reserved. +// + +#import "MacPADSocket.h" + +// Constant strings +NSString *MacPADErrorCode = @"MacPADErrorCode"; +NSString *MacPADErrorMessage = @"MacPADErrorMessage"; +NSString *MacPADNewVersionAvailable = @"MacPADNewVersionAvailable"; + +// NSNotifications +NSString *MacPADErrorOccurredNotification = @"MacPADErrorOccurredNotification"; +NSString *MacPADCheckFinishedNotification = @"MacPADCheckFinishedNotification"; + +enum { + kNumberType, + kStringType, + kPeriodType +}; + +@implementation MacPADSocket + +// Code +- (id)init +{ + if (self = [super init]) { + _fileHandle = nil; + _fileURL = nil; + _currentVersion = nil; + _newVersion = nil; + _releaseNotes = nil; + _productPageURL = nil; + _productDownloadURLs = nil; + _buffer = nil; + } + return self; +} + +- (void)initiateCheck:(id)sender; +{ + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; +// DBLog(@"In thread...reading url"); + NSDictionary *dict = [NSDictionary dictionaryWithContentsOfURL:_fileURL]; +// DBLog(@"URL read"); + [self processDictionary:dict]; + [pool release]; +} + +- (void)performCheck:(NSURL *)url withVersion:(NSString *)version +{ + // Make sure we were actually *given* stuff + if (url == nil || version == nil) { + // Bah + [self returnError:kMacPADResultMissingValues message:@"URL or version was nil"]; + return; + } + + // Save the current version and URL + [_currentVersion release]; + _currentVersion = [version copy]; + [_fileURL release]; + _fileURL = [url copy]; + +// DBLog(@"Detaching thread for updater"); + [NSThread detachNewThreadSelector:@selector(initiateCheck:) toTarget:self withObject:nil]; +} + +- (void)performCheckWithVersion:(NSString *)version +{ + // This method makes use of the MacPAD.url file inside the application bundle + // If this file isn't there, or it's not in the correct format, this will return + // error kMacPADResultMissingValues with an appropriate message + // If it is there, it calls performCheck:withVersion: with the URL + NSString *path = [[NSBundle mainBundle] pathForResource:@"MacPAD" ofType:@"url"]; + if (path == nil) { + // File is missing + [self returnError:kMacPADResultMissingValues message:@"MacPAD.url file was not found"]; + return; + } + NSString *contents = [NSString stringWithContentsOfFile:path]; + if (contents == nil) { + // The file can't be opened + [self returnError:kMacPADResultMissingValues message:@"The MacPAD.url file can't be opened"]; + return; + } + + NSString *urlString; + NSRange range = [contents rangeOfString:@"URL="]; + if (range.location != NSNotFound) { + // We have a URL= prefix + range.location += range.length; + range.length = [contents length] - range.location; + urlString = [contents substringWithRange:range]; + } else { + // The file is the URL + urlString = contents; + } + // Strip whitespace + urlString = [urlString stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; + // Perform the check + [self performCheck:[NSURL URLWithString:urlString] withVersion:version]; +} + +- (void)performCheckWithURL:(NSURL *)url +{ + // Gets the version from the Info.plist file and calls performCheck:withVersion: + NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]; + [self performCheck:url withVersion:version]; +} + +- (void)performCheck +{ + // Gets the version from the Info.plist file and calls performCheckWithVersion: + NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]; + [self performCheckWithVersion:version]; +} + +- (void)setDelegate:(id)delegate +{ + NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; + if (_delegate != nil) { + // Unregister with the notification center + [nc removeObserver:_delegate name:MacPADErrorOccurredNotification object:self]; + [nc removeObserver:_delegate name:MacPADCheckFinishedNotification object:self]; + [_delegate autorelease]; + } + _delegate = [delegate retain]; + // Register the new MacPADSocketNotification methods for the delegate + // Only register if the delegate implements it, though + if ([_delegate respondsToSelector:@selector(macPADErrorOccurred:)]) { + [nc addObserver:_delegate selector:@selector(macPADErrorOccurred:) + name:MacPADErrorOccurredNotification object:self]; + } + if ([_delegate respondsToSelector:@selector(macPADCheckFinished:)]) { + [nc addObserver:_delegate selector:@selector(macPADCheckFinished:) + name:MacPADCheckFinishedNotification object:self]; + } +} + +- (NSString *)releaseNotes +{ + if (_releaseNotes == nil) { + return @""; + } else { + return [[_releaseNotes copy] autorelease]; + } +} + +- (NSString *)newVersion +{ + if (_newVersion == nil) { + return @""; + } else { + return [[_newVersion copy] autorelease]; + } +} + +- (NSString *)productPageURL +{ + if (_productPageURL == nil) { + return @""; + } else { + return [[_productPageURL copy] autorelease]; + } +} + +- (NSString *)productDownloadURL +{ + if (_productDownloadURLs != nil && [_productDownloadURLs count] >= 1) { + return [_productDownloadURLs objectAtIndex:0]; + } else { + return @""; + } +} + +- (NSArray *)productDownloadURLs +{ + if (_productDownloadURLs == nil) { + return [NSArray array]; + } else { + return [[_productDownloadURLs copy] autorelease]; + } +} + +- (void)returnError:(MacPADResultCode)code message:(NSString *)msg +{ + NSNumber *yesno = [NSNumber numberWithBool:(code == kMacPADResultNewVersion)]; + NSNumber *errorCode = [NSNumber numberWithInt:code]; + NSDictionary *userInfo = [NSDictionary dictionaryWithObjectsAndKeys:yesno, MacPADNewVersionAvailable, + msg, MacPADErrorMessage, errorCode, MacPADErrorCode, nil]; + if (code == 0 || code == 5) { + // Not an error + [self performSelectorOnMainThread:@selector(returnSuccess:) withObject:userInfo waitUntilDone:NO]; + } else { + // It's an error + [self performSelectorOnMainThread:@selector(returnFailure:) withObject:userInfo waitUntilDone:NO]; + } +} + +- (void)returnSuccess:(NSDictionary *)userInfo +{ + [[NSNotificationCenter defaultCenter] postNotificationName:MacPADCheckFinishedNotification + object:self userInfo:userInfo]; +} + +- (void)returnFailure:(NSDictionary *)userInfo +{ + [[NSNotificationCenter defaultCenter] postNotificationName:MacPADErrorOccurredNotification + object:self userInfo:userInfo]; +} + +- (void)processDictionary:(NSDictionary *)dict +{ + if (dict == nil) { + DBLog(@"Update error: dict is nil"); + [self returnError:kMacPADResultInvalidURL message:@"Remote file or URL was invalid"]; + return; + } +// DBLog(@"HOLY MOLY"); + _newVersion = [[dict objectForKey:@"productVersion"] copy]; + if (_newVersion == nil) { + // File is missing version information + [self returnError:kMacPADResultBadSyntax message:@"Product version information missing"]; + return; + } + + // Get release notes + _releaseNotes = [[dict objectForKey:@"productReleaseNotes"] copy]; + + // Get product page URL + _productPageURL = [[dict objectForKey:@"productPageURL"] copy]; + + // Get the first product download URL + _productDownloadURLs = [[dict objectForKey:@"productDownloadURL"] copy]; + + // Compare versions + if ([self compareVersion:_newVersion toVersion:_currentVersion] == NSOrderedAscending) { + // It's a new version + [self returnError:kMacPADResultNewVersion message:@"New version available"]; + } else { + [self returnError:kMacPADResultNoNewVersion message:@"No new version available"]; + } + + // We're done +} + +- (void)dealloc +{ + // Unregister the delegate with the notification center + NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; + [nc removeObserver:_delegate name:MacPADErrorOccurredNotification object:self]; + [nc removeObserver:_delegate name:MacPADCheckFinishedNotification object:self]; + [nc removeObserver:self]; + + // Release objects + [_delegate release]; + [_fileHandle release]; + [_currentVersion release]; + [_buffer release]; + [_newVersion release]; + [_releaseNotes release]; + [_productPageURL release]; + [_productDownloadURLs release]; + + [super dealloc]; +} + +- (NSComparisonResult)compareVersion:(NSString *)versionA toVersion:(NSString *)versionB +{ + NSArray *partsA = [self splitVersion:versionA]; + NSArray *partsB = [self splitVersion:versionB]; + + NSString *partA, *partB; + int i, n, typeA, typeB, intA, intB; + + n = MIN([partsA count], [partsB count]); + for (i = 0; i < n; ++i) { + partA = [partsA objectAtIndex:i]; + partB = [partsB objectAtIndex:i]; + + typeA = [self getCharType:partA]; + typeB = [self getCharType:partB]; + + // Compare types + if (typeA == typeB) { + // Same type; we can compare + if (typeA == kNumberType) { + intA = [partA intValue]; + intB = [partB intValue]; + if (intA > intB) { + return NSOrderedAscending; + } else if (intA < intB) { + return NSOrderedDescending; + } + } else if (typeA == kStringType) { + NSComparisonResult result = [partA compare:partB]; + if (result != NSOrderedSame) { + return result; + } + } + } else { + // Not the same type? Now we have to do some validity checking + if (typeA != kStringType && typeB == kStringType) { + // typeA wins + return NSOrderedAscending; + } else if (typeA == kStringType && typeB != kStringType) { + // typeB wins + return NSOrderedDescending; + } else { + // One is a number and the other is a period. The period is invalid + if (typeA == kNumberType) { + return NSOrderedAscending; + } else { + return NSOrderedDescending; + } + } + } + } + // The versions are equal up to the point where they both still have parts + // Lets check to see if one is larger than the other + if ([partsA count] != [partsB count]) { + // Yep. Lets get the next part of the larger + // n holds the value we want + NSString *missingPart; + int missingType, shorterResult, largerResult; + + if ([partsA count] > [partsB count]) { + missingPart = [partsA objectAtIndex:n]; + shorterResult = NSOrderedDescending; + largerResult = NSOrderedAscending; + } else { + missingPart = [partsB objectAtIndex:n]; + shorterResult = NSOrderedAscending; + largerResult = NSOrderedDescending; + } + + missingType = [self getCharType:missingPart]; + // Check the type + if (missingType == kStringType) { + // It's a string. Shorter version wins + return shorterResult; + } else { + // It's a number/period. Larger version wins + return largerResult; + } + } + + // The 2 strings are identical + return NSOrderedSame; +} + +- (NSArray *)splitVersion:(NSString *)version +{ + NSString *character; + NSMutableString *s; + int i, n, oldType, newType; + NSMutableArray *parts = [NSMutableArray array]; + if ([version length] == 0) { + // Nothing to do here + return parts; + } + s = [[[version substringToIndex:1] mutableCopy] autorelease]; + oldType = [self getCharType:s]; + n = [version length] - 1; + for (i = 1; i <= n; ++i) { + character = [version substringWithRange:NSMakeRange(i, 1)]; + newType = [self getCharType:character]; + if (oldType != newType || oldType == kPeriodType) { + // We've reached a new segment + [parts addObject:[s copy]]; + [s setString:character]; + } else { + // Add character to string and continue + [s appendString:character]; + } + oldType = newType; + } + + // Add the last part onto the array + [parts addObject:[s copy]]; + return parts; +} + +- (int)getCharType:(NSString *)character +{ + if ([character isEqualToString:@"."]) { + return kPeriodType; + } else if ([character isEqualToString:@"0"] || [character intValue] != 0) { + return kNumberType; + } else { + return kStringType; + } +} +@end diff --git a/Updates/UpdateController.h b/Updates/UpdateController.h new file mode 100644 index 000000000..2cd802760 --- /dev/null +++ b/Updates/UpdateController.h @@ -0,0 +1,46 @@ +// +// UpdateController.h +// Cog +// +// Created by Vincent Spader on 3/26/05. +// Copyright 2005 __MyCompanyName__. All rights reserved. +// + +#import +#import "MacPADSocket.h" + + +//Set to 0 for every startup +#ifndef DAYS_BETWEEN_CHECKS +#define DAYS_BETWEEN_CHECKS 0 +#endif + +@interface UpdateController : NSObject { + IBOutlet NSWindow* updateWindow; + IBOutlet NSButton* okayButton; + IBOutlet NSProgressIndicator* checkingIndicator; + IBOutlet NSTextField *statusView; + IBOutlet NSButton *autoCheckButton; + + BOOL checkInBackground; + BOOL updateAvailable; + NSString *downloadURL; + + MacPADSocket *macPAD; +} + +- (void)setCheckAtStartup: (BOOL)shouldCheck; + +- (void)checkForUpdate; + +- (void)macPADCheckFinished:(NSNotification *)aNotification; +- (void)macPADErrorOccurred:(NSNotification *)aNotification; +- (void)updateDisplay:(MacPADSocket *)socket info:(NSDictionary *)info; + +- (IBAction)openUpdateWindow:(id)sender; +- (IBAction)okay:(id)sender; +- (IBAction)takeBoolFromObject:(id)sender; + +- (void)setDownloadURL:(NSString *)d; + +@end diff --git a/Updates/UpdateController.m b/Updates/UpdateController.m new file mode 100644 index 000000000..612ee8c89 --- /dev/null +++ b/Updates/UpdateController.m @@ -0,0 +1,168 @@ +// +// UpdateController.m +// Cog +// +// Created by Vincent Spader on 3/26/05. +// Copyright 2005 __MyCompanyName__. All rights reserved. +// + +#import "UpdateController.h" + +@implementation UpdateController + +- (void)checkForUpdate +{ + [okayButton setEnabled:NO]; + [checkingIndicator startAnimation:self]; + + [statusView setStringValue:@"Checking for update..."]; + + macPAD = [[MacPADSocket alloc] init]; + [macPAD setDelegate:self]; + + [macPAD performCheckWithURL:[NSURL URLWithString:@"http://cogosx.sourceforge.net/Cog.plist"]]; +} + +- (void)updateDisplay:(MacPADSocket *)socket info:(NSDictionary *)info +{ + int result; + result = [[info objectForKey:MacPADErrorCode] intValue]; + if (result == kMacPADResultNewVersion) //New version available + { + [statusView setStringValue:@"Update available!"]; + updateAvailable = YES; + } + else if (result == kMacPADResultNoNewVersion) //No new version available + { + [statusView setStringValue:@"No updates available."]; + updateAvailable = NO; + } + else //Error connecting to update server + { + [statusView setStringValue:@"Error connecting to update server."]; + updateAvailable = NO; + } + + [self setDownloadURL:[macPAD productDownloadURL]]; + + [macPAD release]; + macPAD = nil; + + [checkingIndicator stopAnimation:self]; + [okayButton setEnabled:YES]; + +// DBLog(@"THINGS: %i %i", updateAvailable, checkInBackground); + if (updateAvailable == YES && checkInBackground == YES) + { +// DBLog(@"SHOW THE GD WINDOW"); + [updateWindow makeKeyAndOrderFront: self]; + } +} + +- (void)macPADErrorOccurred:(NSNotification *)aNotification +{ + DBLog(@"Update error occurred"); + [self updateDisplay:[aNotification object] info:[aNotification userInfo]]; +} + +- (void)macPADCheckFinished:(NSNotification *)aNotification +{ +// DBLog(@"CHECK FINISHED"); + [self updateDisplay:[aNotification object] info:[aNotification userInfo]]; +} + +- (IBAction)openUpdateWindow:(id)sender +{ + [updateWindow makeKeyAndOrderFront: sender]; + + checkInBackground = NO; + + [self checkForUpdate]; +} + +- (void)windowWillClose:(id)sender +{ +} + +- (void)checkForUpdateInBackground +{ + checkInBackground = YES; + + [self checkForUpdate]; +} + +- (IBAction)okay:(id)sender +{ + if (updateAvailable == YES) + { + DBLog(@"OPENING URL: %@", downloadURL); + [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:downloadURL]]; + } + [updateWindow close]; +} + +-(void) awakeFromNib +{ + NSNumber *doCheck = [[NSUserDefaults standardUserDefaults] objectForKey: @"Cog:CheckForUpdateAtStartup"]; + NSNumber *lastCheckDateNum = [[NSUserDefaults standardUserDefaults] objectForKey: @"Cog:LastUpdateCheckDate"]; + NSDate *lastCheckDate = nil; + + if( doCheck == nil ) // No setting in prefs yet? First launch? + { + doCheck = [NSNumber numberWithBool:NO]; + + // Save user's preference to prefs file: + [[NSUserDefaults standardUserDefaults] setObject: doCheck forKey: @"Cog:CheckForUpdateAtStartup"]; + } + + [autoCheckButton setState: [doCheck boolValue]]; // Update prefs button + + // If user wants us to check for updates at startup, do so: + if( [doCheck boolValue] ) + { + NSTimeInterval timeSinceLastCheck; + + // Determine how long since last check: + if( lastCheckDateNum == nil ) + lastCheckDate = [NSDate distantPast]; // If there's no date in prefs, use something guaranteed to be past. + else + lastCheckDate = [NSDate dateWithTimeIntervalSinceReferenceDate: [lastCheckDateNum doubleValue]]; + timeSinceLastCheck = -[lastCheckDate timeIntervalSinceNow]; + + // If last check was more than DAYS_BETWEEN_CHECKS days ago, check again now: + if( timeSinceLastCheck > (3600 * 24 * DAYS_BETWEEN_CHECKS) ) + { +// DBLog(@"CHECKING FOR UPDATE"); + [self checkForUpdateInBackground]; + [[NSUserDefaults standardUserDefaults] setObject: [NSNumber numberWithDouble: [NSDate timeIntervalSinceReferenceDate]] forKey: @"Cog:LastUpdateCheckDate"]; + } + } +} + +-(IBAction) takeBoolFromObject: (id)sender +{ + if( [sender respondsToSelector: @selector(boolValue)] ) + [self setCheckAtStartup: [sender boolValue]]; + else + [self setCheckAtStartup: [sender state]]; +} + +-(void) setCheckAtStartup: (BOOL)shouldCheck +{ + NSNumber *doCheck = [NSNumber numberWithBool: shouldCheck]; + [[NSUserDefaults standardUserDefaults] setObject: doCheck forKey: @"Cog:CheckForUpdateAtStartup"]; + + [autoCheckButton setState: shouldCheck]; + [[NSUserDefaults standardUserDefaults] setObject: [NSNumber numberWithDouble: 0] forKey: @"Cog:LastUpdateCheckDate"]; +} + + +//BULLSHIT STUFF +- (void)setDownloadURL:(NSString *)d +{ + [d retain]; + [downloadURL release]; + downloadURL = d; +} + +@end diff --git a/VirtualRingBuffer.h b/VirtualRingBuffer.h new file mode 100644 index 000000000..3f2c1544a --- /dev/null +++ b/VirtualRingBuffer.h @@ -0,0 +1,88 @@ +// +// VirtualRingBuffer.h +// PlayBufferedSoundFile +// +/* + Copyright (c) 2002, Kurt Revis. All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + * Neither the name of Snoize nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +// +// VirtualRingBuffer implements a classic ring buffer (or circular buffer), with a couple of twists. +// +// * It allows reads and writes to happen in different threads, with no explicit locking, +// so readers and writers will never block. This is useful if either thread uses the +// time-constraint scheduling policy, since it is bad for such threads to block for +// indefinite amounts of time. +// +// * It uses a virtual memory trick to allow the client to read or write using just one +// operation, even if the data involved wraps around the end of the buffer. We allocate +// our buffer normally, and then place a VM region immediately after it in the address +// space which maps back to the "real" buffer. So reads and writes into both sections +// are transparently translated into the same physical memory. +// This makes the API much simpler to use, and saves us from doing some math to +// calculate the wraparound points. +// The tradeoff is that we use twice as much address space for the buffer than we would +// otherwise. Address space is not typically constrained for most applications, though, +// so this isn't a big problem. +// The idea for this trick came from (via sweetcode.org), +// although none of that code is used here. (We use the Mach VM API directly.) +// + +// Threading note: +// It is expected that this object will be shared between exactly two threads; one will +// always read and the other will always write. In that situation, the implementation is +// thread-safe, and this object will never block or yield. +// It will also work in one thread, of course (although I don't know why you'd bother). +// However, if you have multiple reader or writer threads, all bets are off! + +#import + + +@interface VirtualRingBuffer : NSObject +{ + void *buffer; + void *bufferEnd; + UInt32 bufferLength; + // buffer is the start of the ring buffer's address space. + // bufferEnd is the end of the "real" buffer (always buffer + bufferLength). + // Note that the "virtual" portion of the buffer extends from bufferEnd to bufferEnd+bufferLength. + + void *readPointer; + void *writePointer; +} + +- (id)initWithLength:(UInt32)length; +// Note: The specified length will be rounded up to an integral number of VM pages. + +// Empties the buffer. It is NOT safe to do this while anyone is reading from or writing to the buffer. +- (void)empty; +// Checks if the buffer is empty or not. This is safe in any thread. +- (BOOL)isEmpty; + +- (UInt32)bufferLength; + +// Read operations: + +// The reading thread must call this method first. +- (UInt32)lengthAvailableToReadReturningPointer:(void **)returnedReadPointer; +// Iff a value > 0 is returned, the reading thread may go on to read that much data from the returned pointer. +// Afterwards, the reading thread must call didReadLength:. +- (void)didReadLength:(UInt32)length; + +// Write operations: + +// The writing thread must call this method first. +- (UInt32)lengthAvailableToWriteReturningPointer:(void **)returnedWritePointer; +// Iff a value > 0 is returned, the writing thread may then write that much data into the returned pointer. +// Afterwards, the writing thread must call didWriteLength:. +- (void)didWriteLength:(UInt32)length; + +@end diff --git a/VirtualRingBuffer.m b/VirtualRingBuffer.m new file mode 100644 index 000000000..01f2e8b06 --- /dev/null +++ b/VirtualRingBuffer.m @@ -0,0 +1,309 @@ +// +// VirtualRingBuffer.m +// PlayBufferedSoundFile +// +/* + Copyright (c) 2002, Kurt Revis. All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + * Neither the name of Snoize nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + +#import "VirtualRingBuffer.h" + +#include +#include + + +@implementation VirtualRingBuffer + +static void *allocateVirtualBuffer(UInt32 bufferLength); +static void deallocateVirtualBuffer(void *buffer, UInt32 bufferLength); + + +- (id)initWithLength:(UInt32)length +{ + if (![super init]) + return nil; + + // We need to allocate entire VM pages, so round the specified length up to the next page if necessary. + bufferLength = round_page(length); + + buffer = allocateVirtualBuffer(bufferLength); + if (buffer) { + bufferEnd = buffer + bufferLength; + } else { + [self release]; + return nil; + } + + readPointer = NULL; + writePointer = NULL; + + return self; +} + +- (void)dealloc +{ + if (buffer) + deallocateVirtualBuffer(buffer, bufferLength); + + [super dealloc]; +} + +- (void)empty +{ + // Assumption: + // No one is reading or writing from the buffer, in any thread, when this method is called. + + readPointer = NULL; + writePointer = NULL; +} + +- (BOOL)isEmpty +{ + return (readPointer != NULL && writePointer != NULL); +} + + +- (UInt32)bufferLength +{ + return bufferLength; +} + +// +// Theory of operation: +// +// This class keeps a pointer to the next byte to be read (readPointer) and a pointer to the next byte to be written (writePointer). +// readPointer is only advanced in the reading thread (except for one case: when the buffer first has data written to it). +// writePointer is only advanced in the writing thread. +// +// Since loading and storing word length data is atomic, each pointer can safely be modified in one thread while the other thread +// uses it, IF each thread is careful to make a local copy of the "opposite" pointer when necessary. +// + +// +// Read operations +// + +- (UInt32)lengthAvailableToReadReturningPointer:(void **)returnedReadPointer +{ + // Assumptions: + // returnedReadPointer != NULL + + UInt32 length; + // Read this pointer exactly once, so we're safe in case it is changed in another thread + void *localWritePointer = writePointer; + + // Depending on out-of-order execution and memory storage, either one of these may be NULL when the buffer is empty. So we must check both. + if (!readPointer || !localWritePointer) { + // The buffer is empty + length = 0; + } else if (localWritePointer > readPointer) { + // Write is ahead of read in the buffer + length = localWritePointer - readPointer; + } else { + // Write has wrapped around past read, OR write == read (the buffer is full) + length = bufferLength - (readPointer - localWritePointer); + } + + *returnedReadPointer = readPointer; + return length; +} + +- (void)didReadLength:(UInt32)length +{ + // Assumptions: + // [self lengthAvailableToReadReturningPointer:] currently returns a value >= length + // length > 0 + + void *newReadPointer; + + newReadPointer = readPointer + length; + if (newReadPointer >= bufferEnd) + newReadPointer -= bufferLength; + + if (newReadPointer == writePointer) { + // We just read the last data out of the buffer, so it is now empty. + newReadPointer = NULL; + } + + // Store the new read pointer. This is the only place this happens in the read thread. + readPointer = newReadPointer; +} + + +// +// Write operations +// + +- (UInt32)lengthAvailableToWriteReturningPointer:(void **)returnedWritePointer +{ + // Assumptions: + // returnedWritePointer != NULL + + UInt32 length; + // Read this pointer exactly once, so we're safe in case it is changed in another thread + void *localReadPointer = readPointer; + + // Either one of these may be NULL when the buffer is empty. So we must check both. + if (!localReadPointer || !writePointer) { + // The buffer is empty. Set it up to be written into. + // This is one of the two places the write pointer can change; both are in the write thread. + writePointer = buffer; + length = bufferLength; + } else if (writePointer <= localReadPointer) { + // Write is before read in the buffer, OR write == read (meaning that the buffer is full). + length = localReadPointer - writePointer; + } else { + // Write is behind read in the buffer. The available space wraps around. + length = (bufferEnd - writePointer) + (localReadPointer - buffer); + } + + *returnedWritePointer = writePointer; + return length; +} + +- (void)didWriteLength:(UInt32)length +{ + // Assumptions: + // [self lengthAvailableToWriteReturningPointer:] currently returns a value >= length + // length > 0 + + void *oldWritePointer = writePointer; + void *newWritePointer; + + // Advance the write pointer, wrapping around if necessary. + newWritePointer = writePointer + length; + if (newWritePointer >= bufferEnd) + newWritePointer -= bufferLength; + + // This is one of the two places the write pointer can change; both are in the write thread. + writePointer = newWritePointer; + + // Also, if the read pointer is NULL, then we just wrote into a previously empty buffer, so set the read pointer. + // This is the only place the read pointer is changed in the write thread. + // The read thread should never change the read pointer when it is NULL, so this is safe. + if (!readPointer) + readPointer = oldWritePointer; +} + +@end + + +void *allocateVirtualBuffer(UInt32 bufferLength) +{ + kern_return_t error; + vm_address_t originalAddress = NULL; + vm_address_t realAddress = NULL; + mach_port_t memoryEntry; + vm_size_t memoryEntryLength; + vm_address_t virtualAddress = NULL; + + // We want to find where we can get 2 * bufferLength bytes of contiguous address space. + // So let's just allocate that space, remember its address, and deallocate it. + // (This doesn't actually have to touch all of that memory so it's not terribly expensive.) + error = vm_allocate(mach_task_self(), &originalAddress, 2 * bufferLength, TRUE); + if (error) { +#if DEBUG + mach_error("vm_allocate initial chunk", error); +#endif + return NULL; + } + + error = vm_deallocate(mach_task_self(), originalAddress, 2 * bufferLength); + if (error) { +#if DEBUG + mach_error("vm_deallocate initial chunk", error); +#endif + return NULL; + } + + // Then allocate a "real" block of memory at the same address, but with the normal bufferLength. + realAddress = originalAddress; + error = vm_allocate(mach_task_self(), &realAddress, bufferLength, FALSE); + if (error) { +#if DEBUG + mach_error("vm_allocate real chunk", error); +#endif + return NULL; + } + if (realAddress != originalAddress) { +#if DEBUG + DBLog(@"allocateVirtualBuffer: vm_allocate 2nd time didn't return same address (%p vs %p)", originalAddress, realAddress); +#endif + goto errorReturn; + } + + // Then make a memory entry for the area we just allocated. + memoryEntryLength = bufferLength; + error = mach_make_memory_entry(mach_task_self(), &memoryEntryLength, realAddress, VM_PROT_READ | VM_PROT_WRITE, &memoryEntry, NULL); + if (error) { +#if DEBUG + mach_error("mach_make_memory_entry", error); +#endif + goto errorReturn; + } + if (!memoryEntry) { +#if DEBUG + DBLog(@"mach_make_memory_entry: returned memoryEntry of NULL"); +#endif + goto errorReturn; + } + if (memoryEntryLength != bufferLength) { +#if DEBUG + DBLog(@"mach_make_memory_entry: size changed (from %0x to %0x)", bufferLength, memoryEntryLength); +#endif + goto errorReturn; + } + + // And map the area immediately after the first block, with length bufferLength, to that memory entry. + virtualAddress = realAddress + bufferLength; + error = vm_map(mach_task_self(), &virtualAddress, bufferLength, 0, FALSE, memoryEntry, 0, FALSE, VM_PROT_READ | VM_PROT_WRITE, VM_PROT_READ | VM_PROT_WRITE, VM_INHERIT_DEFAULT); + if (error) { +#if DEBUG + mach_error("vm_map", error); +#endif + // TODO Retry from the beginning, instead of failing completely. There is a tiny (but > 0) probability that someone + // will allocate this space out from under us. + virtualAddress = NULL; + goto errorReturn; + } + if (virtualAddress != realAddress + bufferLength) { +#if DEBUG + DBLog(@"vm_map: didn't return correct address (%p vs %p)", realAddress + bufferLength, virtualAddress); +#endif + goto errorReturn; + } + + // Success! + return (void *)realAddress; + +errorReturn: + if (realAddress) + vm_deallocate(mach_task_self(), realAddress, bufferLength); + if (virtualAddress) + vm_deallocate(mach_task_self(), virtualAddress, bufferLength); + + return NULL; +} + +void deallocateVirtualBuffer(void *buffer, UInt32 bufferLength) +{ + kern_return_t error; + + // We can conveniently deallocate both the vm_allocated memory and + // the vm_mapped region at the same time. + error = vm_deallocate(mach_task_self(), (vm_address_t)buffer, bufferLength * 2); + if (error) { +#if DEBUG + mach_error("vm_deallocate in dealloc", error); +#endif + } +} diff --git a/main.m b/main.m new file mode 100644 index 000000000..e73c36c7e --- /dev/null +++ b/main.m @@ -0,0 +1,14 @@ +// +// main.m +// Cog +// +// Created by Zaphod Beeblebrox on 5/7/05. +// Copyright __MyCompanyName__ 2005. All rights reserved. +// + +#import + +int main(int argc, char *argv[]) +{ + return NSApplicationMain(argc, (const char **) argv); +} diff --git a/xchat/cog.py b/xchat/cog.py new file mode 100644 index 000000000..00668364c --- /dev/null +++ b/xchat/cog.py @@ -0,0 +1,36 @@ +import xchat +import commands +import string + +__module_name__ = "Cog status plugin" +__module_version__ = "0.1" +__module_description__ = "Displays the current song cog is playing" + +def cog_cb(word, word_eol, userdata): + command = "osascript -e \\\n\ + \"tell application \\\"Cog\\\"\n\ + set this_title to the title of the currententry\n\ + set this_artist to the artist of the currententry\n\ + set this_album to the album of the currententry\n\ + set this_bitrate to the bitrate of the currententry\n\ + set this_length to the length of the currententry\n\ + end tell\n\ + return this_title & tab & this_artist & tab & this_album & tab & this_bitrate & tab & this_length\"" + + output = commands.getoutput(command); + +# print output + info = string.split(output,"\t") + length = float(info[4]) + length = int(length/1000) + min = length / 60 + sec = length % 60 + line = "[ Artist: %s ][ Album: %s ][ Title: %s ][ %skbps ][ %i:%02i ]" % (info[1], info[2], info[0], info[3], min, sec) + + xchat.command("me is playing %s" % line) + + return xchat.EAT_ALL + +xchat.hook_command("cog", cog_cb) + +print "Cog loaded..." diff --git a/xchat/cog.script b/xchat/cog.script new file mode 100644 index 000000000..34f49376f --- /dev/null +++ b/xchat/cog.script @@ -0,0 +1,9 @@ +tell application "Cog" + set this_title to the title of the currententry + set this_artist to the artist of the currententry + set this_album to the album of the currententry + set this_bitrate to the bitrate of the currententry + set this_length to the length of the currententry +end tell +return this_title & tab & this_artist & tab & this_album & tab & this_bitrate & tab & this_length +